From 2e626373db2412ac22e8c5c27a60d11cd29e875b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sat, 28 Jan 2012 20:52:45 +0100 Subject: replace obsolete "master" branch with README that points at new repo --- .gitignore | 18 - MathMLDTD/math.dtd | 957 --- MathMLDTD/prj/build.lst | 3 - MathMLDTD/prj/d.lst | 2 - MathMLDTD/w3c_ipr_software_notice.html | 105 - README | 20 + UnoControls/inc/basecontainercontrol.hxx | 594 -- UnoControls/inc/basecontrol.hxx | 1272 ---- UnoControls/inc/multiplexer.hxx | 784 --- UnoControls/prj/build.lst | 5 - UnoControls/prj/d.lst | 6 - UnoControls/source/base/basecontainercontrol.cxx | 636 -- UnoControls/source/base/basecontrol.cxx | 1022 ---- UnoControls/source/base/makefile.mk | 46 - UnoControls/source/base/multiplexer.cxx | 530 -- UnoControls/source/base/registercontrols.cxx | 181 - .../controls/OConnectionPointContainerHelper.cxx | 190 - .../source/controls/OConnectionPointHelper.cxx | 275 - UnoControls/source/controls/framecontrol.cxx | 606 -- UnoControls/source/controls/makefile.mk | 49 - UnoControls/source/controls/progressbar.cxx | 494 -- UnoControls/source/controls/progressmonitor.cxx | 1070 ---- UnoControls/source/controls/statusindicator.cxx | 562 -- .../source/inc/OConnectionPointContainerHelper.hxx | 265 - UnoControls/source/inc/OConnectionPointHelper.hxx | 309 - UnoControls/source/inc/framecontrol.hxx | 641 -- UnoControls/source/inc/progressbar.hxx | 459 -- UnoControls/source/inc/progressmonitor.hxx | 805 --- UnoControls/source/inc/statusindicator.hxx | 584 -- UnoControls/util/ctl.component | 43 - UnoControls/util/makefile.mk | 69 - UnoControls/util/makefile.pmk | 27 - UnoControls/util/target.pmk | 35 - .../org/openoffice/accessibility/AccessBridge.java | 245 - .../org/openoffice/accessibility/KeyHandler.java | 138 - .../org/openoffice/accessibility/PopupWindow.java | 210 - .../accessibility/WindowsAccessBridgeAdapter.java | 654 -- .../accessibility/java_uno_accessbridge.component | 34 - .../org/openoffice/accessibility/makefile.mk | 62 - .../bridge/org/openoffice/accessibility/manifest | 2 - .../java/accessibility/AbstractButton.java | 176 - .../java/accessibility/AccessibleActionImpl.java | 71 - .../accessibility/AccessibleComponentImpl.java | 233 - .../accessibility/AccessibleEditableTextImpl.java | 367 -- .../accessibility/AccessibleExtendedState.java | 53 - .../accessibility/AccessibleHypertextImpl.java | 191 - .../java/accessibility/AccessibleIconImpl.java | 73 - .../java/accessibility/AccessibleKeyBinding.java | 386 -- .../accessibility/AccessibleObjectFactory.java | 545 -- .../accessibility/AccessibleRelationAdapter.java | 64 - .../java/accessibility/AccessibleRoleAdapter.java | 148 - .../accessibility/AccessibleSelectionImpl.java | 99 - .../java/accessibility/AccessibleStateAdapter.java | 214 - .../java/accessibility/AccessibleTextImpl.java | 678 --- .../java/accessibility/AccessibleValueImpl.java | 96 - .../org/openoffice/java/accessibility/Alert.java | 66 - .../openoffice/java/accessibility/Application.java | 45 - .../org/openoffice/java/accessibility/Button.java | 157 - .../openoffice/java/accessibility/CheckBox.java | 51 - .../openoffice/java/accessibility/ComboBox.java | 117 - .../openoffice/java/accessibility/Component.java | 740 --- .../openoffice/java/accessibility/Container.java | 763 --- .../java/accessibility/DescendantManager.java | 161 - .../org/openoffice/java/accessibility/Dialog.java | 633 -- .../java/accessibility/FocusTraversalPolicy.java | 89 - .../org/openoffice/java/accessibility/Frame.java | 646 -- .../org/openoffice/java/accessibility/Icon.java | 76 - .../org/openoffice/java/accessibility/Label.java | 130 - .../org/openoffice/java/accessibility/List.java | 452 -- .../org/openoffice/java/accessibility/Menu.java | 328 - .../java/accessibility/MenuContainer.java | 167 - .../openoffice/java/accessibility/MenuItem.java | 99 - .../openoffice/java/accessibility/NativeFrame.java | 35 - .../openoffice/java/accessibility/Paragraph.java | 222 - .../openoffice/java/accessibility/RadioButton.java | 50 - .../openoffice/java/accessibility/ScrollBar.java | 126 - .../openoffice/java/accessibility/Separator.java | 71 - .../org/openoffice/java/accessibility/Table.java | 727 --- .../java/accessibility/TextComponent.java | 194 - .../java/accessibility/ToggleButton.java | 62 - .../org/openoffice/java/accessibility/ToolTip.java | 117 - .../org/openoffice/java/accessibility/Tree.java | 768 --- .../org/openoffice/java/accessibility/Window.java | 551 -- .../accessibility/logging/XAccessibleEventLog.java | 186 - .../logging/XAccessibleHypertextLog.java | 61 - .../accessibility/logging/XAccessibleTextLog.java | 270 - .../org/openoffice/java/accessibility/makefile.mk | 115 - .../source/java/WindowsAccessBridgeAdapter.cxx | 317 - accessibility/bridge/source/java/exports.dxp | 4 - accessibility/bridge/source/java/makefile.mk | 70 - .../accessibility/extended/AccessibleBrowseBox.hxx | 313 - .../extended/AccessibleBrowseBoxBase.hxx | 515 -- .../extended/AccessibleBrowseBoxCheckBoxCell.hxx | 95 - .../extended/AccessibleBrowseBoxHeaderBar.hxx | 283 - .../extended/AccessibleBrowseBoxHeaderCell.hxx | 83 - .../extended/AccessibleBrowseBoxTable.hxx | 177 - .../extended/AccessibleBrowseBoxTableBase.hxx | 282 - .../extended/AccessibleBrowseBoxTableCell.hxx | 145 - .../extended/AccessibleGridControl.hxx | 267 - .../extended/AccessibleGridControlBase.hxx | 457 -- .../extended/AccessibleGridControlHeader.hxx | 220 - .../extended/AccessibleGridControlHeaderCell.hxx | 104 - .../extended/AccessibleGridControlTable.hxx | 228 - .../extended/AccessibleGridControlTableBase.hxx | 230 - .../extended/AccessibleGridControlTableCell.hxx | 170 - .../extended/AccessibleToolPanelDeck.hxx | 94 - .../extended/AccessibleToolPanelDeckTabBar.hxx | 95 - .../extended/AccessibleToolPanelDeckTabBarItem.hxx | 110 - .../extended/accessiblebrowseboxcell.hxx | 89 - .../extended/accessibleeditbrowseboxcell.hxx | 156 - .../extended/accessibleiconchoicectrl.hxx | 121 - .../extended/accessibleiconchoicectrlentry.hxx | 199 - .../accessibility/extended/accessiblelistbox.hxx | 127 - .../extended/accessiblelistboxentry.hxx | 225 - .../accessibility/extended/accessibletabbar.hxx | 122 - .../extended/accessibletabbarbase.hxx | 80 - .../extended/accessibletabbarpage.hxx | 139 - .../extended/accessibletabbarpagelist.hxx | 143 - .../extended/accessibletablistbox.hxx | 117 - .../extended/accessibletablistboxtable.hxx | 124 - .../accessibility/extended/listboxaccessible.hxx | 98 - .../extended/textwindowaccessibility.hxx | 714 --- .../accessibility/helper/IComboListBoxHelper.hxx | 71 - .../inc/accessibility/helper/acc_factory.hxx | 53 - .../inc/accessibility/helper/accessiblestrings.hrc | 53 - .../inc/accessibility/helper/accresmgr.hxx | 72 - .../helper/characterattributeshelper.hxx | 61 - .../inc/accessibility/helper/listboxhelper.hxx | 198 - .../standard/accessiblemenubasecomponent.hxx | 157 - .../standard/accessiblemenucomponent.hxx | 102 - .../standard/accessiblemenuitemcomponent.hxx | 98 - .../accessibility/standard/vclxaccessiblebox.hxx | 182 - .../standard/vclxaccessiblebutton.hxx | 88 - .../standard/vclxaccessiblecheckbox.hxx | 95 - .../standard/vclxaccessiblecombobox.hxx | 67 - .../standard/vclxaccessibledropdowncombobox.hxx | 69 - .../standard/vclxaccessibledropdownlistbox.hxx | 69 - .../accessibility/standard/vclxaccessibleedit.hxx | 121 - .../standard/vclxaccessiblefixedhyperlink.hxx | 56 - .../standard/vclxaccessiblefixedtext.hxx | 56 - .../accessibility/standard/vclxaccessiblelist.hxx | 226 - .../standard/vclxaccessiblelistbox.hxx | 65 - .../standard/vclxaccessiblelistitem.hxx | 198 - .../accessibility/standard/vclxaccessiblemenu.hxx | 86 - .../standard/vclxaccessiblemenubar.hxx | 75 - .../standard/vclxaccessiblemenuitem.hxx | 119 - .../standard/vclxaccessiblemenuseparator.hxx | 56 - .../standard/vclxaccessiblepopupmenu.hxx | 62 - .../standard/vclxaccessibleradiobutton.hxx | 86 - .../standard/vclxaccessiblescrollbar.hxx | 85 - .../standard/vclxaccessiblestatusbar.hxx | 82 - .../standard/vclxaccessiblestatusbaritem.hxx | 144 - .../standard/vclxaccessibletabcontrol.hxx | 105 - .../standard/vclxaccessibletabpage.hxx | 148 - .../standard/vclxaccessibletabpagewindow.hxx | 69 - .../standard/vclxaccessibletextcomponent.hxx | 95 - .../standard/vclxaccessibletextfield.hxx | 105 - .../standard/vclxaccessibletoolbox.hxx | 115 - .../standard/vclxaccessibletoolboxitem.hxx | 168 - accessibility/inc/makefile.mk | 47 - .../inc/pch/precompiled_accessibility.cxx | 31 - .../inc/pch/precompiled_accessibility.hxx | 40 - accessibility/prj/build.lst | 18 - accessibility/prj/d.lst | 8 - accessibility/prj/l10n | 1 - .../source/extended/AccessibleBrowseBox.cxx | 395 -- .../source/extended/AccessibleBrowseBoxBase.cxx | 652 -- .../extended/AccessibleBrowseBoxCheckBoxCell.cxx | 174 - .../extended/AccessibleBrowseBoxHeaderBar.cxx | 424 -- .../extended/AccessibleBrowseBoxHeaderCell.cxx | 175 - .../source/extended/AccessibleBrowseBoxTable.cxx | 280 - .../extended/AccessibleBrowseBoxTableBase.cxx | 360 -- .../extended/AccessibleBrowseBoxTableCell.cxx | 357 -- .../source/extended/AccessibleGridControl.cxx | 375 -- .../source/extended/AccessibleGridControlBase.cxx | 529 -- .../extended/AccessibleGridControlHeader.cxx | 289 - .../extended/AccessibleGridControlHeaderCell.cxx | 172 - .../source/extended/AccessibleGridControlTable.cxx | 378 -- .../extended/AccessibleGridControlTableBase.cxx | 296 - .../extended/AccessibleGridControlTableCell.cxx | 370 -- .../source/extended/AccessibleToolPanelDeck.cxx | 410 -- .../extended/AccessibleToolPanelDeckTabBar.cxx | 457 -- .../extended/AccessibleToolPanelDeckTabBarItem.cxx | 453 -- .../source/extended/accessiblebrowseboxcell.cxx | 94 - .../extended/accessibleeditbrowseboxcell.cxx | 276 - .../source/extended/accessibleiconchoicectrl.cxx | 374 -- .../extended/accessibleiconchoicectrlentry.cxx | 734 --- .../source/extended/accessiblelistbox.cxx | 433 -- .../source/extended/accessiblelistboxentry.cxx | 962 --- accessibility/source/extended/accessibletabbar.cxx | 557 -- .../source/extended/accessibletabbarbase.cxx | 116 - .../source/extended/accessibletabbarpage.cxx | 514 -- .../source/extended/accessibletabbarpagelist.cxx | 808 --- .../source/extended/accessibletablistbox.cxx | 137 - .../source/extended/accessibletablistboxtable.cxx | 374 -- .../source/extended/listboxaccessible.cxx | 106 - accessibility/source/extended/makefile.mk | 81 - .../source/extended/textwindowaccessibility.cxx | 2258 ------- accessibility/source/helper/acc_factory.cxx | 555 -- accessibility/source/helper/accessiblestrings.src | 76 - accessibility/source/helper/accresmgr.cxx | 83 - .../source/helper/characterattributeshelper.cxx | 114 - accessibility/source/helper/makefile.mk | 53 - .../source/inc/floatingwindowaccessible.hxx | 45 - .../standard/accessiblemenubasecomponent.cxx | 786 --- .../source/standard/accessiblemenucomponent.cxx | 474 -- .../standard/accessiblemenuitemcomponent.cxx | 506 -- .../source/standard/floatingwindowaccessible.cxx | 73 - accessibility/source/standard/makefile.mk | 78 - .../source/standard/vclxaccessiblebox.cxx | 375 -- .../source/standard/vclxaccessiblebutton.cxx | 329 - .../source/standard/vclxaccessiblecheckbox.cxx | 364 -- .../source/standard/vclxaccessiblecombobox.cxx | 98 - .../standard/vclxaccessibledropdowncombobox.cxx | 122 - .../standard/vclxaccessibledropdownlistbox.cxx | 112 - .../source/standard/vclxaccessibleedit.cxx | 629 -- .../standard/vclxaccessiblefixedhyperlink.cxx | 87 - .../source/standard/vclxaccessiblefixedtext.cxx | 99 - .../source/standard/vclxaccessiblelist.cxx | 851 --- .../source/standard/vclxaccessiblelistbox.cxx | 110 - .../source/standard/vclxaccessiblelistitem.cxx | 677 --- .../source/standard/vclxaccessiblemenu.cxx | 258 - .../source/standard/vclxaccessiblemenubar.cxx | 214 - .../source/standard/vclxaccessiblemenuitem.cxx | 610 -- .../standard/vclxaccessiblemenuseparator.cxx | 88 - .../source/standard/vclxaccessiblepopupmenu.cxx | 114 - .../source/standard/vclxaccessibleradiobutton.cxx | 317 - .../source/standard/vclxaccessiblescrollbar.cxx | 282 - .../source/standard/vclxaccessiblestatusbar.cxx | 369 -- .../standard/vclxaccessiblestatusbaritem.cxx | 632 -- .../source/standard/vclxaccessibletabcontrol.cxx | 518 -- .../source/standard/vclxaccessibletabpage.cxx | 705 --- .../standard/vclxaccessibletabpagewindow.cxx | 144 - .../standard/vclxaccessibletextcomponent.cxx | 365 -- .../source/standard/vclxaccessibletextfield.cxx | 156 - .../source/standard/vclxaccessibletoolbox.cxx | 884 --- .../source/standard/vclxaccessibletoolboxitem.cxx | 708 --- accessibility/util/acc.map | 7 - accessibility/util/makefile.mk | 82 - accessibility/workben/TODO | 13 - accessibility/workben/makefile | 9 - accessibility/workben/makefile.in | 31 - accessibility/workben/makefile.mk | 39 - .../workben/org/openoffice/accessibility/Makefile | 6 - .../accessibility/awb/AccessibilityWorkBench.java | 702 --- .../openoffice/accessibility/awb/HelpWindow.java | 187 - .../org/openoffice/accessibility/awb/Makefile | 11 - .../accessibility/awb/canvas/Canvas.java | 322 - .../accessibility/awb/canvas/CanvasShape.java | 412 -- .../openoffice/accessibility/awb/canvas/Makefile | 13 - .../accessibility/awb/canvas/MouseObserver.java | 104 - .../accessibility/awb/canvas/ShapeContainer.java | 237 - .../accessibility/awb/canvas/makefile.common | 34 - .../accessibility/awb/canvas/makefile.mk | 47 - .../openoffice/accessibility/awb/makefile.common | 30 - .../org/openoffice/accessibility/awb/makefile.mk | 57 - .../org/openoffice/accessibility/awb/manifest | 3 - .../accessibility/awb/tree/AccessibilityModel.java | 154 - .../accessibility/awb/tree/AccessibilityNode.java | 163 - .../accessibility/awb/tree/AccessibilityTree.java | 89 - .../awb/tree/AccessibilityTreeModel.java | 217 - .../awb/tree/DynamicAccessibilityModel.java | 123 - .../awb/tree/DynamicAccessibilityNode.java | 92 - .../org/openoffice/accessibility/awb/tree/Makefile | 40 - .../accessibility/awb/tree/ToolkitNode.java | 215 - .../accessibility/awb/tree/makefile.common | 35 - .../openoffice/accessibility/awb/tree/makefile.mk | 51 - .../accessibility/awb/view/ComponentView.java | 195 - .../accessibility/awb/view/ContextView.java | 115 - .../accessibility/awb/view/EditableTextView.java | 119 - .../accessibility/awb/view/EventMonitorView.java | 126 - .../accessibility/awb/view/FocusView.java | 148 - .../accessibility/awb/view/LayoutManager.java | 160 - .../org/openoffice/accessibility/awb/view/Makefile | 11 - .../accessibility/awb/view/ObjectView.java | 90 - .../awb/view/ObjectViewContainer.java | 310 - .../awb/view/ObjectViewContainerWindow.java | 35 - .../accessibility/awb/view/ParentView.java | 147 - .../accessibility/awb/view/SelectionView.java | 267 - .../awb/view/ServiceInterfaceView.java | 150 - .../accessibility/awb/view/StateSetView.java | 199 - .../accessibility/awb/view/TableView.java | 161 - .../accessibility/awb/view/TextView.java | 467 -- .../accessibility/awb/view/ViewGridLayout.java | 117 - .../accessibility/awb/view/makefile.common | 45 - .../openoffice/accessibility/awb/view/makefile.mk | 51 - .../awb/view/text/CaretSpinnerModel.java | 122 - .../accessibility/awb/view/text/Makefile | 11 - .../awb/view/text/TextActionDialog.java | 208 - .../awb/view/text/TextAttributeDialog.java | 179 - .../awb/view/text/TextDialogFactory.java | 136 - .../awb/view/text/TextEditDialog.java | 122 - .../accessibility/awb/view/text/makefile.common | 34 - .../accessibility/awb/view/text/makefile.mk | 51 - .../misc/AccessibleEventMulticaster.java | 92 - .../openoffice/accessibility/misc/Connector.java | 50 - .../accessibility/misc/InformationWriter.java | 421 -- .../org/openoffice/accessibility/misc/Makefile | 38 - .../openoffice/accessibility/misc/MessageArea.java | 125 - .../accessibility/misc/NameProvider.java | 263 - .../accessibility/misc/OfficeConnection.java | 169 - .../org/openoffice/accessibility/misc/Options.java | 106 - .../accessibility/misc/SimpleOffice.java | 413 -- .../openoffice/accessibility/misc/makefile.common | 36 - .../org/openoffice/accessibility/misc/makefile.mk | 46 - automation/inc/automation/automation.hxx | 55 - automation/inc/automation/commdefines.hxx | 150 - automation/inc/automation/commtypes.hxx | 67 - automation/inc/automation/communi.hxx | 182 - automation/inc/automation/simplecm.hxx | 339 -- automation/inc/makefile.mk | 47 - automation/inc/pch/precompiled_automation.cxx | 31 - automation/inc/pch/precompiled_automation.hxx | 34 - automation/packimages/makefile.mk | 62 - automation/prj/build.lst | 11 - automation/prj/d.lst | 27 - automation/prj/l10n | 1 - automation/source/app/makefile.mk | 52 - automation/source/app/testbasi.cxx | 148 - automation/source/app/testbasi.hxx | 67 - automation/source/communi/communi.cxx | 582 -- automation/source/communi/makefile.mk | 46 - automation/source/inc/cmdbasestream.hxx | 93 - automation/source/inc/icommstream.hxx | 67 - automation/source/inc/ittresid.hxx | 45 - automation/source/inc/rcontrol.hxx | 471 -- automation/source/inc/svcommstream.hxx | 59 - automation/source/inc/testapp.hxx | 197 - automation/source/inc/testtool.hxx | 75 - automation/source/miniapp/editwin.cxx | 122 - automation/source/miniapp/editwin.hxx | 69 - automation/source/miniapp/hid.lst | 27 - automation/source/miniapp/makefile.mk | 54 - automation/source/miniapp/servres.cxx | 56 - automation/source/miniapp/servres.hrc | 40 - automation/source/miniapp/servres.hxx | 58 - automation/source/miniapp/servres.src | 233 - automation/source/miniapp/servuid.hxx | 40 - automation/source/miniapp/test.bas | 126 - automation/source/miniapp/test.sid | 5 - automation/source/miniapp/test.win | 13 - automation/source/miniapp/testapp.cxx | 308 - automation/source/miniapp/testapp.hxx | 108 - automation/source/mozillaserver/makefile.mk | 121 - .../source/mozillaserver/mozillatesttoolserver.idl | 52 - .../mozillaserver/xmozillatesttoolserver.idl | 157 - automation/source/server/XMLParser.cxx | 689 --- automation/source/server/cmdbasestream.cxx | 353 -- automation/source/server/editwin.cxx | 166 - automation/source/server/editwin.hxx | 72 - automation/source/server/makefile.mk | 69 - automation/source/server/prof_nul.cxx | 98 - automation/source/server/prof_usl.cxx | 138 - automation/source/server/profiler.cxx | 264 - automation/source/server/profiler.hxx | 134 - automation/source/server/recorder.cxx | 661 -- automation/source/server/recorder.hxx | 85 - automation/source/server/retstrm.cxx | 127 - automation/source/server/retstrm.hxx | 87 - automation/source/server/scmdstrm.cxx | 216 - automation/source/server/scmdstrm.hxx | 62 - automation/source/server/server.cxx | 889 --- automation/source/server/server.hxx | 68 - automation/source/server/sta_list.cxx | 1194 ---- automation/source/server/statemnt.cxx | 6339 ------------------- automation/source/server/statemnt.hxx | 492 -- automation/source/server/svcommstream.cxx | 51 - automation/source/server/testtool.hrc | 55 - automation/source/simplecm/communiio.hxx | 68 - automation/source/simplecm/makefile.mk | 46 - automation/source/simplecm/packethandler.cxx | 338 -- automation/source/simplecm/packethandler.hxx | 72 - automation/source/simplecm/simplecm.cxx | 541 -- automation/source/simplecm/tcpio.cxx | 74 - automation/source/simplecm/tcpio.hxx | 64 - automation/source/testtool/cmdstrm.cxx | 455 -- automation/source/testtool/cmdstrm.hxx | 79 - automation/source/testtool/comm_bas.cxx | 439 -- automation/source/testtool/comm_bas.hxx | 121 - automation/source/testtool/cretstrm.cxx | 73 - automation/source/testtool/cretstrm.hxx | 56 - automation/source/testtool/filter.pl | 125 - automation/source/testtool/httprequest.cxx | 220 - automation/source/testtool/httprequest.hxx | 84 - automation/source/testtool/makefile.mk | 107 - automation/source/testtool/objtest.cxx | 4120 ------------- automation/source/testtool/objtest.hxx | 392 -- automation/source/testtool/registry_win.cxx | 84 - automation/source/testtool/registry_win.hxx | 34 - automation/source/testtool/sysdir_win.cxx | 105 - automation/source/testtool/sysdir_win.hxx | 34 - automation/source/testtool/tcommuni.cxx | 203 - automation/source/testtool/tcommuni.hxx | 64 - automation/source/testtool/testtool.ini | 18 - automation/util/makefile.mk | 278 - automation/util/manually_added_ids.hid | 8 - basctl/AllLangResTarget_basctl.mk | 57 - basctl/Library_basctl.mk | 135 - basctl/Makefile | 39 - basctl/Module_basctl.mk | 37 - basctl/Package_xml.mk | 42 - basctl/inc/basidesh.hrc | 174 - basctl/inc/helpid.hrc | 79 - basctl/inc/iderdll.hxx | 56 - basctl/inc/pch/precompiled_basctl.cxx | 31 - basctl/inc/pch/precompiled_basctl.hxx | 209 - basctl/prj/build.lst | 3 - basctl/prj/d.lst | 0 basctl/prj/makefile.mk | 40 - basctl/sdi/baside.sdi | 475 -- basctl/sdi/basslots.hrc | 29 - basctl/sdi/basslots.sdi | 47 - .../accessibility/accessibledialogcontrolshape.cxx | 621 -- .../accessibility/accessibledialogwindow.cxx | 1126 ---- basctl/source/basicide/basdoc.cxx | 101 - basctl/source/basicide/basdoc.hxx | 68 - basctl/source/basicide/basicbox.cxx | 546 -- basctl/source/basicide/basicbox.hxx | 154 - basctl/source/basicide/basicmod.hxx | 49 - basctl/source/basicide/basicprint.src | 38 - basctl/source/basicide/basicrenderable.cxx | 196 - basctl/source/basicide/basicrenderable.hxx | 76 - basctl/source/basicide/baside2.cxx | 1739 ------ basctl/source/basicide/baside2.hrc | 50 - basctl/source/basicide/baside2.hxx | 476 -- basctl/source/basicide/baside2b.cxx | 2266 ------- basctl/source/basicide/baside3.cxx | 1393 ----- basctl/source/basicide/basidectrlr.cxx | 153 - basctl/source/basicide/basides1.cxx | 1399 ----- basctl/source/basicide/basides2.cxx | 316 - basctl/source/basicide/basides3.cxx | 179 - basctl/source/basicide/basidesh.cxx | 1053 ---- basctl/source/basicide/basidesh.src | 638 -- basctl/source/basicide/basobj2.cxx | 458 -- basctl/source/basicide/basobj3.cxx | 519 -- basctl/source/basicide/bastype2.cxx | 880 --- basctl/source/basicide/bastype2.hxx | 222 - basctl/source/basicide/bastype3.cxx | 507 -- basctl/source/basicide/bastype3.hxx | 67 - basctl/source/basicide/bastype4.hxx | 69 - basctl/source/basicide/bastypes.cxx | 1054 ---- basctl/source/basicide/brkdlg.cxx | 274 - basctl/source/basicide/brkdlg.hrc | 45 - basctl/source/basicide/brkdlg.hxx | 75 - basctl/source/basicide/brkdlg.src | 134 - basctl/source/basicide/doceventnotifier.cxx | 280 - basctl/source/basicide/docsignature.cxx | 118 - basctl/source/basicide/documentenumeration.cxx | 206 - basctl/source/basicide/documentenumeration.hxx | 109 - basctl/source/basicide/ide_pch.cxx | 33 - basctl/source/basicide/ide_pch.hxx | 71 - basctl/source/basicide/iderdll.cxx | 201 - basctl/source/basicide/iderdll2.hxx | 109 - basctl/source/basicide/idetemp.hxx | 67 - basctl/source/basicide/localizationmgr.cxx | 1180 ---- basctl/source/basicide/macrodlg.cxx | 910 --- basctl/source/basicide/macrodlg.hrc | 59 - basctl/source/basicide/macrodlg.hxx | 114 - basctl/source/basicide/macrodlg.src | 234 - basctl/source/basicide/moduldl2.cxx | 1706 ------ basctl/source/basicide/moduldlg.cxx | 1067 ---- basctl/source/basicide/moduldlg.hrc | 68 - basctl/source/basicide/moduldlg.hxx | 277 - basctl/source/basicide/moduldlg.src | 427 -- basctl/source/basicide/moptions.hrc | 47 - basctl/source/basicide/moptions.src | 150 - basctl/source/basicide/objdlg.cxx | 298 - basctl/source/basicide/objdlg.hrc | 41 - basctl/source/basicide/objdlg.hxx | 96 - basctl/source/basicide/objdlg.src | 91 - basctl/source/basicide/register.cxx | 89 - basctl/source/basicide/scriptdocument.cxx | 1604 ----- basctl/source/basicide/tbxctl.cxx | 164 - basctl/source/basicide/tbxctl.hrc | 30 - basctl/source/basicide/tbxctl.hxx | 68 - basctl/source/basicide/unomodel.cxx | 129 - basctl/source/basicide/unomodel.hxx | 69 - basctl/source/dlged/dlged.cxx | 1361 ----- basctl/source/dlged/dlgedclip.cxx | 151 - basctl/source/dlged/dlgedfac.cxx | 198 - basctl/source/dlged/dlgedfunc.cxx | 621 -- basctl/source/dlged/dlgedlist.cxx | 116 - basctl/source/dlged/dlgedmod.cxx | 81 - basctl/source/dlged/dlgedobj.cxx | 1887 ------ basctl/source/dlged/dlgedpage.cxx | 89 - basctl/source/dlged/dlgedview.cxx | 217 - basctl/source/dlged/dlgresid.src | 175 - basctl/source/dlged/managelang.cxx | 427 -- basctl/source/dlged/managelang.hrc | 106 - basctl/source/dlged/managelang.src | 237 - basctl/source/dlged/propbrw.cxx | 596 -- basctl/source/inc/accessibledialogcontrolshape.hxx | 150 - basctl/source/inc/accessibledialogwindow.hxx | 177 - basctl/source/inc/baside3.hxx | 117 - basctl/source/inc/basidectrlr.hxx | 76 - basctl/source/inc/basidesh.hxx | 239 - basctl/source/inc/basobj.hxx | 128 - basctl/source/inc/bastypes.hxx | 352 -- basctl/source/inc/dlged.hxx | 215 - basctl/source/inc/dlgedclip.hxx | 68 - basctl/source/inc/dlgeddef.hxx | 86 - basctl/source/inc/dlgedfac.hxx | 51 - basctl/source/inc/dlgedfunc.hxx | 98 - basctl/source/inc/dlgedlist.hxx | 87 - basctl/source/inc/dlgedmod.hxx | 67 - basctl/source/inc/dlgedobj.hxx | 197 - basctl/source/inc/dlgedpage.hxx | 64 - basctl/source/inc/dlgedview.hxx | 63 - basctl/source/inc/dlgresid.hrc | 77 - basctl/source/inc/doceventnotifier.hxx | 99 - basctl/source/inc/docsignature.hxx | 92 - basctl/source/inc/iderid.hxx | 43 - basctl/source/inc/localizationmgr.hxx | 158 - basctl/source/inc/managelang.hxx | 121 - basctl/source/inc/propbrw.hxx | 118 - basctl/source/inc/sbxitem.hxx | 79 - basctl/source/inc/scriptdocument.hxx | 540 -- basctl/source/inc/svheader.hxx | 91 - basctl/uiconfig/basicide/menubar/menubar.xml | 92 - basctl/uiconfig/basicide/statusbar/statusbar.xml | 10 - basctl/uiconfig/basicide/toolbar/dialogbar.xml | 9 - basctl/uiconfig/basicide/toolbar/findbar.xml | 9 - basctl/uiconfig/basicide/toolbar/fullscreenbar.xml | 5 - .../basicide/toolbar/insertcontrolsbar.xml | 43 - basctl/uiconfig/basicide/toolbar/macrobar.xml | 22 - basctl/uiconfig/basicide/toolbar/standardbar.xml | 25 - .../uiconfig/basicide/toolbar/translationbar.xml | 6 - basctl/util/basctl.component | 34 - basctl/util/basctl.xml | 23 - bean/com/sun/star/beans/ContainerFactory.java | 47 - bean/com/sun/star/beans/JavaWindowPeerFake.java | 122 - bean/com/sun/star/beans/LocalOfficeConnection.java | 617 -- bean/com/sun/star/beans/LocalOfficeWindow.java | 309 - bean/com/sun/star/beans/NativeConnection.java | 59 - bean/com/sun/star/beans/NativeService.java | 36 - bean/com/sun/star/beans/OfficeConnection.java | 79 - bean/com/sun/star/beans/OfficeWindow.java | 55 - bean/com/sun/star/beans/makefile.mk | 64 - bean/com/sun/star/comp/beans/CallWatchThread.java | 128 - bean/com/sun/star/comp/beans/ContainerFactory.java | 47 - bean/com/sun/star/comp/beans/Controller.java | 110 - bean/com/sun/star/comp/beans/Frame.java | 182 - .../star/comp/beans/HasConnectionException.java | 40 - .../star/comp/beans/InvalidArgumentException.java | 38 - .../sun/star/comp/beans/JavaWindowPeerFake.java | 122 - .../sun/star/comp/beans/LocalOfficeConnection.java | 834 --- .../com/sun/star/comp/beans/LocalOfficeWindow.java | 288 - bean/com/sun/star/comp/beans/NativeConnection.java | 62 - bean/com/sun/star/comp/beans/NativeService.java | 37 - .../sun/star/comp/beans/NoConnectionException.java | 40 - .../sun/star/comp/beans/NoDocumentException.java | 38 - bean/com/sun/star/comp/beans/OOoBean.java | 1518 ----- bean/com/sun/star/comp/beans/OfficeConnection.java | 80 - bean/com/sun/star/comp/beans/OfficeDocument.java | 226 - bean/com/sun/star/comp/beans/OfficeWindow.java | 56 - .../sun/star/comp/beans/SystemWindowException.java | 41 - bean/com/sun/star/comp/beans/Wrapper.java | 108 - bean/com/sun/star/comp/beans/makefile.mk | 75 - .../unix/com_sun_star_beans_LocalOfficeWindow.c | 100 - .../com_sun_star_comp_beans_LocalOfficeWindow.c | 146 - bean/native/unix/makefile.mk | 40 - .../win32/com_sun_star_beans_LocalOfficeWindow.c | 95 - .../com_sun_star_comp_beans_LocalOfficeWindow.c | 230 - bean/native/win32/makefile.mk | 38 - bean/native/win32/officebean.dxp | 4 - bean/prj/build.lst | 10 - bean/prj/d.lst | 5 - bean/qa/complex/bean/OOoBeanTest.java | 737 --- bean/qa/complex/bean/ScreenComparer.java | 249 - bean/qa/complex/bean/WriterFrame.java | 210 - bean/qa/complex/bean/makefile.mk | 134 - bean/test/Test.java | 68 - bean/test/applet/oooapplet/OOoViewer.java | 208 - bean/test/applet/oooapplet/bean.policy | 16 - bean/test/applet/oooapplet/example.html | 22 - bean/test/applet/oooapplet/makefile.mk | 88 - bean/test/makefile.mk | 76 - bean/util/delzip | 0 bean/util/makefile.mk | 56 - crashrep/prj/build.lst | 5 - crashrep/prj/d.lst | 3 - crashrep/source/all/crashrep.ulf | 220 - crashrep/source/all/makefile.mk | 49 - crashrep/source/unx/main.cxx | 1121 ---- crashrep/source/unx/makefile.mk | 75 - crashrep/source/win32/base64.cpp | 84 - crashrep/source/win32/base64.h | 47 - crashrep/source/win32/ctrylnglist.txt | 29 - crashrep/source/win32/makefile.mk | 88 - crashrep/source/win32/rcfooter.txt | 1 - crashrep/source/win32/rcheader.txt | 92 - crashrep/source/win32/rctemplate.txt | 192 - crashrep/source/win32/resource.h | 123 - crashrep/source/win32/soreport.cpp | 2982 --------- cui/AllLangResTarget_cui.mk | 135 - cui/Library_cui.mk | 224 - cui/Makefile | 39 - cui/Module_cui.mk | 36 - cui/prj/build.lst | 3 - cui/prj/d.lst | 0 cui/prj/makefile.mk | 40 - cui/source/customize/acccfg.cxx | 1578 ----- cui/source/customize/acccfg.hrc | 68 - cui/source/customize/acccfg.src | 270 - cui/source/customize/cfg.cxx | 5755 ------------------ cui/source/customize/cfg.hrc | 110 - cui/source/customize/cfg.src | 899 --- cui/source/customize/cfgutil.cxx | 1261 ---- cui/source/customize/eventdlg.cxx | 242 - cui/source/customize/eventdlg.hrc | 43 - cui/source/customize/eventdlg.hxx | 80 - cui/source/customize/eventdlg.src | 104 - cui/source/customize/macropg.cxx | 1027 ---- cui/source/customize/macropg.hrc | 99 - cui/source/customize/macropg.src | 480 -- cui/source/customize/macropg_impl.hxx | 74 - cui/source/customize/selector.cxx | 1175 ---- cui/source/customize/selector.hrc | 54 - cui/source/customize/selector.src | 192 - cui/source/dialogs/SpellAttrib.cxx | 153 - cui/source/dialogs/SpellAttrib.hxx | 168 - cui/source/dialogs/SpellDialog.cxx | 2091 ------- cui/source/dialogs/SpellDialog.hrc | 54 - cui/source/dialogs/SpellDialog.src | 233 - cui/source/dialogs/about.cxx | 307 - cui/source/dialogs/about.hrc | 41 - cui/source/dialogs/about.src | 103 - cui/source/dialogs/charmap.hrc | 51 - cui/source/dialogs/charmap.src | 140 - cui/source/dialogs/colorpicker.cxx | 1659 ----- cui/source/dialogs/colorpicker.hrc | 74 - cui/source/dialogs/colorpicker.src | 492 -- cui/source/dialogs/commonlingui.cxx | 241 - cui/source/dialogs/commonlingui.hxx | 160 - cui/source/dialogs/commonlingui.src | 136 - cui/source/dialogs/cuicharmap.cxx | 581 -- cui/source/dialogs/cuifmsearch.cxx | 963 --- cui/source/dialogs/cuigaldlg.cxx | 1300 ---- cui/source/dialogs/cuigrfflt.cxx | 488 -- cui/source/dialogs/cuihyperdlg.cxx | 386 -- cui/source/dialogs/cuiimapdlg.hrc | 44 - cui/source/dialogs/cuiimapdlg.src | 154 - cui/source/dialogs/cuiimapwnd.cxx | 97 - cui/source/dialogs/cuitbxform.cxx | 65 - cui/source/dialogs/dlgname.cxx | 231 - cui/source/dialogs/dlgname.hrc | 46 - cui/source/dialogs/dlgname.src | 250 - cui/source/dialogs/fmsearch.hrc | 86 - cui/source/dialogs/fmsearch.src | 337 - cui/source/dialogs/gallery.src | 486 -- cui/source/dialogs/grfflt.hrc | 80 - cui/source/dialogs/grfflt.src | 430 -- cui/source/dialogs/hangulhanjadlg.cxx | 1883 ------ cui/source/dialogs/hangulhanjadlg.hrc | 197 - cui/source/dialogs/hangulhanjadlg.src | 454 -- cui/source/dialogs/hldocntp.cxx | 485 -- cui/source/dialogs/hldoctp.cxx | 376 -- cui/source/dialogs/hlinettp.cxx | 519 -- cui/source/dialogs/hlmailtp.cxx | 317 - cui/source/dialogs/hlmarkwn.cxx | 521 -- cui/source/dialogs/hlmarkwn.hrc | 34 - cui/source/dialogs/hlmarkwn.src | 84 - cui/source/dialogs/hltpbase.cxx | 739 --- cui/source/dialogs/hyperdlg.hrc | 92 - cui/source/dialogs/hyperdlg.src | 830 --- cui/source/dialogs/hyphen.cxx | 653 -- cui/source/dialogs/hyphen.hrc | 46 - cui/source/dialogs/hyphen.src | 128 - cui/source/dialogs/iconcdlg.cxx | 1266 ---- cui/source/dialogs/iconcdlg.src | 60 - cui/source/dialogs/insdlg.cxx | 1050 ---- cui/source/dialogs/insrc.cxx | 81 - cui/source/dialogs/insrc.hrc | 40 - cui/source/dialogs/insrc.src | 119 - cui/source/dialogs/linkdlg.cxx | 702 --- cui/source/dialogs/multifil.cxx | 183 - cui/source/dialogs/multipat.cxx | 363 -- cui/source/dialogs/multipat.hrc | 44 - cui/source/dialogs/multipat.src | 130 - cui/source/dialogs/newtabledlg.cxx | 71 - cui/source/dialogs/newtabledlg.hrc | 35 - cui/source/dialogs/newtabledlg.src | 104 - cui/source/dialogs/passwdomdlg.cxx | 281 - cui/source/dialogs/passwdomdlg.hrc | 60 - cui/source/dialogs/passwdomdlg.src | 203 - cui/source/dialogs/pastedlg.cxx | 258 - cui/source/dialogs/plfilter.cxx | 125 - cui/source/dialogs/postdlg.cxx | 262 - cui/source/dialogs/postdlg.hrc | 50 - cui/source/dialogs/postdlg.src | 160 - cui/source/dialogs/scriptdlg.cxx | 1575 ----- cui/source/dialogs/scriptdlg.hrc | 76 - cui/source/dialogs/scriptdlg.src | 294 - cui/source/dialogs/sdrcelldlg.cxx | 87 - cui/source/dialogs/sdrcelldlg.src | 109 - cui/source/dialogs/showcols.cxx | 133 - cui/source/dialogs/showcols.src | 74 - cui/source/dialogs/splitcelldlg.cxx | 109 - cui/source/dialogs/splitcelldlg.hrc | 38 - cui/source/dialogs/splitcelldlg.src | 127 - cui/source/dialogs/srchxtra.cxx | 290 - cui/source/dialogs/srchxtra.hrc | 47 - cui/source/dialogs/srchxtra.src | 283 - cui/source/dialogs/svuidlg.hrc | 134 - cui/source/dialogs/svuidlg.src | 741 --- cui/source/dialogs/tbxform.src | 66 - cui/source/dialogs/thesdlg.cxx | 694 --- cui/source/dialogs/thesdlg.hrc | 49 - cui/source/dialogs/thesdlg.src | 146 - cui/source/dialogs/thesdlg_impl.hxx | 225 - cui/source/dialogs/winpluginlib.cxx | 224 - cui/source/dialogs/zoom.cxx | 497 -- cui/source/dialogs/zoom.hrc | 52 - cui/source/dialogs/zoom.src | 168 - cui/source/factory/cuiexp.cxx | 51 - cui/source/factory/cuiresmgr.cxx | 49 - cui/source/factory/dlgfact.cxx | 1977 ------ cui/source/factory/dlgfact.hxx | 795 --- cui/source/factory/init.cxx | 53 - cui/source/inc/ControlFocusHelper.hxx | 51 - cui/source/inc/SpellDialog.hxx | 264 - cui/source/inc/about.hxx | 77 - cui/source/inc/acccfg.hxx | 234 - cui/source/inc/align.hxx | 106 - cui/source/inc/autocdlg.hxx | 522 -- cui/source/inc/backgrnd.hxx | 164 - cui/source/inc/bbdlg.hxx | 58 - cui/source/inc/border.hxx | 163 - cui/source/inc/cfg.hxx | 820 --- cui/source/inc/cfgutil.hxx | 213 - cui/source/inc/chardlg.hxx | 391 -- cui/source/inc/connect.hxx | 119 - cui/source/inc/cuicharmap.hxx | 143 - cui/source/inc/cuifmsearch.hxx | 222 - cui/source/inc/cuigaldlg.hxx | 383 -- cui/source/inc/cuigrfflt.hxx | 231 - cui/source/inc/cuihyperdlg.hxx | 116 - cui/source/inc/cuiimapwnd.hxx | 57 - cui/source/inc/cuioptgenrl.hxx | 129 - cui/source/inc/cuires.hrc | 439 -- cui/source/inc/cuisrchdlg.hxx | 75 - cui/source/inc/cuitabarea.hxx | 789 --- cui/source/inc/cuitabline.hxx | 434 -- cui/source/inc/cuitbxform.hxx | 30 - cui/source/inc/dbregister.hxx | 154 - cui/source/inc/defdlgname.hxx | 43 - cui/source/inc/dialmgr.hxx | 50 - cui/source/inc/dlgname.hxx | 197 - cui/source/inc/dstribut.hxx | 104 - cui/source/inc/gallery.hrc | 100 - cui/source/inc/grfpage.hxx | 137 - cui/source/inc/hangulhanjadlg.hxx | 350 -- cui/source/inc/headertablistbox.hxx | 71 - cui/source/inc/helpid.hrc | 390 -- cui/source/inc/hldocntp.hxx | 79 - cui/source/inc/hldoctp.hxx | 96 - cui/source/inc/hlinettp.hxx | 107 - cui/source/inc/hlmailtp.hxx | 80 - cui/source/inc/hlmarkwn.hxx | 111 - cui/source/inc/hlmarkwn_def.hxx | 38 - cui/source/inc/hltpbase.hxx | 205 - cui/source/inc/hyphen.hxx | 74 - cui/source/inc/iconcdlg.hxx | 269 - cui/source/inc/insdlg.hxx | 214 - cui/source/inc/insrc.hxx | 70 - cui/source/inc/internationaloptions.hxx | 60 - cui/source/inc/labdlg.hxx | 138 - cui/source/inc/linkdlg.hxx | 133 - cui/source/inc/macroass.hxx | 133 - cui/source/inc/macropg.hxx | 172 - cui/source/inc/measure.hxx | 129 - cui/source/inc/multifil.hxx | 61 - cui/source/inc/multipat.hxx | 90 - cui/source/inc/newtabledlg.hxx | 64 - cui/source/inc/numfmt.hxx | 184 - cui/source/inc/numpages.hxx | 454 -- cui/source/inc/optasian.hxx | 81 - cui/source/inc/optdict.hxx | 188 - cui/source/inc/optimprove.hxx | 120 - cui/source/inc/optlingu.hxx | 183 - cui/source/inc/optpath.hxx | 112 - cui/source/inc/page.hxx | 231 - cui/source/inc/paragrph.hxx | 319 - cui/source/inc/passwdomdlg.hxx | 64 - cui/source/inc/pastedlg.hxx | 96 - cui/source/inc/postdlg.hxx | 122 - cui/source/inc/radiobtnbox.hxx | 64 - cui/source/inc/scriptdlg.hxx | 229 - cui/source/inc/sdrcelldlg.hxx | 65 - cui/source/inc/selector.hxx | 247 - cui/source/inc/showcols.hxx | 66 - cui/source/inc/splitcelldlg.hxx | 72 - cui/source/inc/srchxtra.hxx | 110 - cui/source/inc/tabstpge.hxx | 144 - cui/source/inc/textanim.hxx | 129 - cui/source/inc/textattr.hxx | 116 - cui/source/inc/thesdlg.hxx | 63 - cui/source/inc/transfrm.hxx | 300 - cui/source/inc/treeopt.hxx | 352 -- cui/source/inc/zoom.hxx | 94 - cui/source/options/cfgchart.cxx | 341 -- cui/source/options/cfgchart.hxx | 123 - cui/source/options/connpoolconfig.cxx | 222 - cui/source/options/connpoolconfig.hxx | 56 - cui/source/options/connpooloptions.cxx | 505 -- cui/source/options/connpooloptions.hrc | 49 - cui/source/options/connpooloptions.hxx | 94 - cui/source/options/connpooloptions.src | 169 - cui/source/options/connpoolsettings.cxx | 112 - cui/source/options/connpoolsettings.hxx | 109 - cui/source/options/cuisrchdlg.cxx | 95 - cui/source/options/dbregister.cxx | 467 -- cui/source/options/dbregister.hrc | 42 - cui/source/options/dbregister.src | 93 - cui/source/options/dbregisterednamesconfig.cxx | 143 - cui/source/options/dbregisterednamesconfig.hxx | 56 - cui/source/options/dbregistersettings.cxx | 75 - cui/source/options/dbregistersettings.hxx | 97 - cui/source/options/doclinkdialog.cxx | 222 - cui/source/options/doclinkdialog.hrc | 50 - cui/source/options/doclinkdialog.hxx | 93 - cui/source/options/doclinkdialog.src | 155 - cui/source/options/fontsubs.cxx | 568 -- cui/source/options/fontsubs.hrc | 59 - cui/source/options/fontsubs.hxx | 127 - cui/source/options/fontsubs.src | 198 - cui/source/options/internationaloptions.cxx | 150 - cui/source/options/internationaloptions.hrc | 72 - cui/source/options/internationaloptions.src | 87 - cui/source/options/optHeaderTabListbox.cxx | 86 - cui/source/options/optHeaderTabListbox.hxx | 47 - cui/source/options/optaccessibility.cxx | 184 - cui/source/options/optaccessibility.hrc | 82 - cui/source/options/optaccessibility.hxx | 67 - cui/source/options/optaccessibility.src | 136 - cui/source/options/optasian.cxx | 439 -- cui/source/options/optasian.hrc | 49 - cui/source/options/optasian.src | 147 - cui/source/options/optchart.cxx | 305 - cui/source/options/optchart.hrc | 38 - cui/source/options/optchart.hxx | 94 - cui/source/options/optchart.src | 109 - cui/source/options/optcolor.cxx | 1677 ----- cui/source/options/optcolor.hrc | 223 - cui/source/options/optcolor.hxx | 80 - cui/source/options/optcolor.src | 567 -- cui/source/options/optctl.cxx | 170 - cui/source/options/optctl.hrc | 58 - cui/source/options/optctl.hxx | 70 - cui/source/options/optctl.src | 122 - cui/source/options/optdict.cxx | 808 --- cui/source/options/optdict.hrc | 65 - cui/source/options/optdict.src | 276 - cui/source/options/optfltr.cxx | 430 -- cui/source/options/optfltr.hrc | 56 - cui/source/options/optfltr.hxx | 118 - cui/source/options/optfltr.src | 215 - cui/source/options/optgdlg.cxx | 1931 ------ cui/source/options/optgdlg.hrc | 219 - cui/source/options/optgdlg.hxx | 224 - cui/source/options/optgdlg.src | 695 --- cui/source/options/optgenrl.cxx | 561 -- cui/source/options/optgenrl.hrc | 85 - cui/source/options/optgenrl.src | 332 - cui/source/options/opthtml.cxx | 246 - cui/source/options/opthtml.hrc | 63 - cui/source/options/opthtml.hxx | 91 - cui/source/options/opthtml.src | 303 - cui/source/options/optimprove.cxx | 199 - cui/source/options/optimprove.hrc | 50 - cui/source/options/optimprove.src | 124 - cui/source/options/optimprove2.cxx | 271 - cui/source/options/optinet2.cxx | 1469 ----- cui/source/options/optinet2.hrc | 148 - cui/source/options/optinet2.hxx | 267 - cui/source/options/optinet2.src | 482 -- cui/source/options/optjava.cxx | 1077 ---- cui/source/options/optjava.hrc | 83 - cui/source/options/optjava.hxx | 196 - cui/source/options/optjava.src | 299 - cui/source/options/optjsearch.cxx | 381 -- cui/source/options/optjsearch.hrc | 50 - cui/source/options/optjsearch.hxx | 93 - cui/source/options/optjsearch.src | 239 - cui/source/options/optlingu.cxx | 2499 -------- cui/source/options/optlingu.hrc | 92 - cui/source/options/optlingu.src | 370 -- cui/source/options/optmemory.cxx | 270 - cui/source/options/optmemory.hrc | 86 - cui/source/options/optmemory.hxx | 92 - cui/source/options/optmemory.src | 213 - cui/source/options/optpath.cxx | 850 --- cui/source/options/optpath.hrc | 43 - cui/source/options/optpath.src | 197 - cui/source/options/optsave.cxx | 665 -- cui/source/options/optsave.hrc | 80 - cui/source/options/optsave.hxx | 106 - cui/source/options/optsave.src | 327 - cui/source/options/optupdt.cxx | 411 -- cui/source/options/optupdt.hrc | 49 - cui/source/options/optupdt.hxx | 81 - cui/source/options/optupdt.src | 118 - cui/source/options/radiobtnbox.cxx | 103 - cui/source/options/readonlyimage.cxx | 69 - cui/source/options/readonlyimage.hxx | 45 - cui/source/options/readonlyimage.src | 41 - cui/source/options/sdbcdriverenum.cxx | 122 - cui/source/options/sdbcdriverenum.hxx | 77 - cui/source/options/securityoptions.cxx | 103 - cui/source/options/securityoptions.hrc | 80 - cui/source/options/securityoptions.hxx | 93 - cui/source/options/securityoptions.src | 172 - cui/source/options/treeopt.cxx | 2779 --------- cui/source/options/treeopt.hrc | 100 - cui/source/options/treeopt.src | 339 -- cui/source/options/webconninfo.cxx | 372 -- cui/source/options/webconninfo.hrc | 62 - cui/source/options/webconninfo.hxx | 88 - cui/source/options/webconninfo.src | 106 - cui/source/tabpages/align.cxx | 401 -- cui/source/tabpages/align.hrc | 86 - cui/source/tabpages/align.src | 249 - cui/source/tabpages/autocdlg.cxx | 2741 --------- cui/source/tabpages/autocdlg.hrc | 172 - cui/source/tabpages/autocdlg.src | 941 --- cui/source/tabpages/backgrnd.cxx | 1893 ------ cui/source/tabpages/backgrnd.hrc | 70 - cui/source/tabpages/backgrnd.src | 315 - cui/source/tabpages/bbdlg.cxx | 71 - cui/source/tabpages/bbdlg.src | 85 - cui/source/tabpages/border.cxx | 1224 ---- cui/source/tabpages/border.hrc | 106 - cui/source/tabpages/border.src | 449 -- cui/source/tabpages/borderconn.cxx | 303 - cui/source/tabpages/borderconn.hxx | 71 - cui/source/tabpages/chardlg.cxx | 3754 ------------ cui/source/tabpages/chardlg.h | 73 - cui/source/tabpages/chardlg.hrc | 185 - cui/source/tabpages/chardlg.src | 1182 ---- cui/source/tabpages/connect.cxx | 566 -- cui/source/tabpages/connect.hrc | 45 - cui/source/tabpages/connect.src | 275 - cui/source/tabpages/dstribut.cxx | 234 - cui/source/tabpages/dstribut.hrc | 46 - cui/source/tabpages/dstribut.src | 219 - cui/source/tabpages/frmdirlbox.src | 93 - cui/source/tabpages/grfpage.cxx | 792 --- cui/source/tabpages/grfpage.hrc | 53 - cui/source/tabpages/grfpage.src | 343 -- cui/source/tabpages/labdlg.cxx | 639 -- cui/source/tabpages/labdlg.hrc | 72 - cui/source/tabpages/labdlg.src | 287 - cui/source/tabpages/macroass.cxx | 501 -- cui/source/tabpages/macroass.hrc | 82 - cui/source/tabpages/macroass.src | 134 - cui/source/tabpages/measure.cxx | 874 --- cui/source/tabpages/measure.hrc | 53 - cui/source/tabpages/measure.src | 321 - cui/source/tabpages/numfmt.cxx | 1849 ------ cui/source/tabpages/numfmt.hrc | 73 - cui/source/tabpages/numfmt.src | 291 - cui/source/tabpages/numpages.cxx | 3606 ----------- cui/source/tabpages/numpages.hrc | 132 - cui/source/tabpages/numpages.src | 842 --- cui/source/tabpages/page.cxx | 1768 ------ cui/source/tabpages/page.h | 79 - cui/source/tabpages/page.hrc | 84 - cui/source/tabpages/page.src | 524 -- cui/source/tabpages/paragrph.cxx | 2328 ------- cui/source/tabpages/paragrph.hrc | 125 - cui/source/tabpages/paragrph.src | 742 --- cui/source/tabpages/strings.src | 134 - cui/source/tabpages/swpossizetabpage.cxx | 1867 ------ cui/source/tabpages/swpossizetabpage.hrc | 59 - cui/source/tabpages/swpossizetabpage.hxx | 159 - cui/source/tabpages/swpossizetabpage.src | 313 - cui/source/tabpages/tabarea.cxx | 351 -- cui/source/tabpages/tabarea.hrc | 191 - cui/source/tabpages/tabarea.src | 1557 ----- cui/source/tabpages/tabline.cxx | 281 - cui/source/tabpages/tabline.hrc | 130 - cui/source/tabpages/tabline.src | 890 --- cui/source/tabpages/tabstpge.cxx | 759 --- cui/source/tabpages/tabstpge.hrc | 66 - cui/source/tabpages/tabstpge.src | 215 - cui/source/tabpages/textanim.cxx | 774 --- cui/source/tabpages/textanim.hrc | 47 - cui/source/tabpages/textanim.src | 334 - cui/source/tabpages/textattr.cxx | 767 --- cui/source/tabpages/textattr.hrc | 46 - cui/source/tabpages/textattr.src | 255 - cui/source/tabpages/tparea.cxx | 2537 -------- cui/source/tabpages/tpbitmap.cxx | 1150 ---- cui/source/tabpages/tpcolor.cxx | 1264 ---- cui/source/tabpages/tpgradnt.cxx | 929 --- cui/source/tabpages/tphatch.cxx | 876 --- cui/source/tabpages/tpline.cxx | 1845 ------ cui/source/tabpages/tplnedef.cxx | 959 --- cui/source/tabpages/tplneend.cxx | 701 --- cui/source/tabpages/tpshadow.cxx | 612 -- cui/source/tabpages/transfrm.cxx | 1705 ------ cui/source/tabpages/transfrm.hrc | 76 - cui/source/tabpages/transfrm.src | 625 -- cui/source/uno/services.cxx | 60 - cui/util/cui.component | 38 - cui/util/cui.map | 8 - cui/util/hidother.src | 204 - embedserv/prj/build.lst | 5 - embedserv/prj/d.lst | 2 - embedserv/source/embed/docholder.cxx | 1533 ----- embedserv/source/embed/ed_idataobj.cxx | 327 - embedserv/source/embed/ed_iinplace.cxx | 103 - embedserv/source/embed/ed_ioleobject.cxx | 506 -- embedserv/source/embed/ed_ipersiststr.cxx | 1020 ---- embedserv/source/embed/esdll.cxx | 94 - embedserv/source/embed/guid.cxx | 216 - embedserv/source/embed/iipaobj.cxx | 133 - embedserv/source/embed/intercept.cxx | 592 -- embedserv/source/embed/makefile.mk | 79 - embedserv/source/embed/register.cxx | 102 - embedserv/source/embed/servprov.cxx | 308 - embedserv/source/embed/stdafx.cpp | 16 - embedserv/source/embed/syswinwrapper.cxx | 480 -- embedserv/source/embed/tracker.cxx | 841 --- embedserv/source/embed/xwin.cxx | 349 -- embedserv/source/inc/common.h | 59 - embedserv/source/inc/docholder.hxx | 292 - embedserv/source/inc/embeddoc.hxx | 211 - embedserv/source/inc/embeddocaccess.hxx | 86 - embedserv/source/inc/embservconst.h | 83 - embedserv/source/inc/iipaobj.hxx | 76 - embedserv/source/inc/intercept.hxx | 198 - embedserv/source/inc/servprov.hxx | 101 - embedserv/source/inc/stdafx.h | 44 - embedserv/source/inc/syswinwrapper.hxx | 180 - embedserv/source/inc/xwin.hxx | 255 - embedserv/source/inprocserv/advisesink.cxx | 184 - embedserv/source/inprocserv/advisesink.hxx | 97 - embedserv/source/inprocserv/dllentry.cxx | 351 -- embedserv/source/inprocserv/exports.dxp | 5 - embedserv/source/inprocserv/inprocembobj.cxx | 1816 ------ embedserv/source/inprocserv/inprocembobj.h | 244 - embedserv/source/inprocserv/makefile.mk | 80 - embedserv/source/inprocserv/smartpointer.hxx | 185 - embedserv/util/emser.component | 34 - embedserv/util/exports.dxp | 1 - embedserv/util/makefile.mk | 102 - extensions/inc/abpilot.hrc | 37 - extensions/inc/appsettings.hxx | 45 - extensions/inc/bibliography.hrc | 78 - extensions/inc/dbpilots.hrc | 47 - extensions/inc/extensio.hrc | 75 - extensions/inc/makefile.mk | 47 - extensions/inc/pch/precompiled_extensions.cxx | 31 - extensions/inc/pch/precompiled_extensions.hxx | 534 -- extensions/inc/propctrlr.hrc | 331 - extensions/inc/ucbhelper/ext_content.hxx | 332 - extensions/inc/update.hrc | 41 - extensions/prj/build.lst | 37 - extensions/prj/d.lst | 57 - .../complex/extensions/OfficeResourceLoader.java | 157 - .../qa/complex/extensions/extensions_all.sce | 1 - extensions/qa/complex/extensions/makefile.mk | 98 - extensions/qa/complex/extensions/orl_de.src | 31 - extensions/qa/complex/extensions/orl_en-US.src | 31 - .../integration/extensions/ComponentFactory.java | 106 - .../qa/integration/extensions/ConsoleWait.java | 128 - extensions/qa/integration/extensions/Frame.java | 226 - .../integration/extensions/HelpTextProvider.java | 50 - .../qa/integration/extensions/MethodHandler.java | 239 - .../qa/integration/extensions/ObjectInspector.java | 176 - .../qa/integration/extensions/ServicesHandler.java | 228 - .../qa/integration/extensions/TestSkeleton.java | 71 - .../integration/extensions/extensions_complex.sce | 1 - extensions/qa/integration/extensions/makefile.mk | 83 - extensions/qa/unoapi/Test.java | 50 - extensions/qa/unoapi/extensions.sce | 5 - extensions/qa/unoapi/makefile.mk | 48 - extensions/source/abpilot/abp.component | 34 - extensions/source/abpilot/abpfinalpage.cxx | 229 - extensions/source/abpilot/abpfinalpage.hxx | 94 - extensions/source/abpilot/abpresid.hrc | 222 - extensions/source/abpilot/abpservices.cxx | 78 - extensions/source/abpilot/abptypes.hxx | 50 - extensions/source/abpilot/abspage.cxx | 91 - extensions/source/abpilot/abspage.hxx | 75 - extensions/source/abpilot/abspilot.cxx | 501 -- extensions/source/abpilot/abspilot.hxx | 151 - extensions/source/abpilot/abspilot.src | 408 -- extensions/source/abpilot/addresssettings.hxx | 81 - extensions/source/abpilot/admininvokationimpl.cxx | 135 - extensions/source/abpilot/admininvokationimpl.hxx | 72 - extensions/source/abpilot/admininvokationpage.cxx | 116 - extensions/source/abpilot/admininvokationpage.hxx | 75 - extensions/source/abpilot/datasourcehandling.cxx | 641 -- extensions/source/abpilot/datasourcehandling.hxx | 217 - extensions/source/abpilot/exports.dxp | 1 - extensions/source/abpilot/fieldmappingimpl.cxx | 372 -- extensions/source/abpilot/fieldmappingimpl.hxx | 128 - extensions/source/abpilot/fieldmappingpage.cxx | 120 - extensions/source/abpilot/fieldmappingpage.hxx | 72 - extensions/source/abpilot/makefile.mk | 115 - extensions/source/abpilot/moduleabp.cxx | 34 - extensions/source/abpilot/tableselectionpage.cxx | 135 - extensions/source/abpilot/tableselectionpage.hxx | 75 - extensions/source/abpilot/typeselectionpage.cxx | 248 - extensions/source/abpilot/typeselectionpage.hxx | 108 - extensions/source/abpilot/unodialogabp.cxx | 198 - extensions/source/abpilot/unodialogabp.hxx | 103 - extensions/source/activex/main/README.txt | 33 - .../source/activex/main/SOActionsApproval.cpp | 32 - extensions/source/activex/main/SOActionsApproval.h | 83 - .../source/activex/main/SOActionsApproval.rgs | 24 - extensions/source/activex/main/SOActiveX.cpp | 1153 ---- extensions/source/activex/main/SOActiveX.h | 178 - extensions/source/activex/main/SOActiveX.rgs | 33 - extensions/source/activex/main/SOComWindowPeer.cpp | 31 - extensions/source/activex/main/SOComWindowPeer.h | 136 - extensions/source/activex/main/SOComWindowPeer.rgs | 23 - .../source/activex/main/SODispatchInterceptor.cpp | 225 - .../source/activex/main/SODispatchInterceptor.h | 158 - .../source/activex/main/SODispatchInterceptor.rgs | 23 - extensions/source/activex/main/StdAfx2.cpp | 21 - extensions/source/activex/main/StdAfx2.h | 45 - extensions/source/activex/main/com_uno_helper.h | 26 - extensions/source/activex/main/example.html | 26 - extensions/source/activex/main/makefile.mk | 151 - extensions/source/activex/main/resource.h | 28 - extensions/source/activex/main/so_activex.cpp | 686 --- extensions/source/activex/main/so_activex.def | 13 - extensions/source/activex/main/so_activex.rc | 113 - extensions/source/activex/msidl/makefile.mk | 62 - extensions/source/activex/msidl/so_activex.idl | 210 - extensions/source/bibliography/bib.component | 35 - extensions/source/bibliography/bib.hrc | 110 - extensions/source/bibliography/bib.src | 74 - extensions/source/bibliography/bibbeam.cxx | 322 - extensions/source/bibliography/bibbeam.hxx | 96 - extensions/source/bibliography/bibconfig.cxx | 370 -- extensions/source/bibliography/bibconfig.hxx | 156 - extensions/source/bibliography/bibcont.cxx | 278 - extensions/source/bibliography/bibcont.hxx | 117 - extensions/source/bibliography/bibload.cxx | 707 --- extensions/source/bibliography/bibmod.cxx | 122 - extensions/source/bibliography/bibmod.hxx | 68 - extensions/source/bibliography/bibprop.hrc | 42 - extensions/source/bibliography/bibresid.hxx | 46 - .../source/bibliography/bibshortcuthandler.hxx | 90 - extensions/source/bibliography/bibtools.hxx | 53 - extensions/source/bibliography/bibview.cxx | 219 - extensions/source/bibliography/bibview.hxx | 88 - extensions/source/bibliography/datman.cxx | 1739 ------ extensions/source/bibliography/datman.hrc | 102 - extensions/source/bibliography/datman.hxx | 202 - extensions/source/bibliography/datman.src | 500 -- .../source/bibliography/formcontrolcontainer.cxx | 160 - .../source/bibliography/formcontrolcontainer.hxx | 86 - extensions/source/bibliography/framectr.cxx | 974 --- extensions/source/bibliography/framectr.hxx | 132 - extensions/source/bibliography/general.cxx | 878 --- extensions/source/bibliography/general.hxx | 207 - extensions/source/bibliography/hidother.src | 61 - .../source/bibliography/loadlisteneradapter.cxx | 241 - .../source/bibliography/loadlisteneradapter.hxx | 187 - extensions/source/bibliography/makefile.mk | 98 - extensions/source/bibliography/sections.hrc | 128 - extensions/source/bibliography/sections.src | 584 -- extensions/source/bibliography/toolbar.cxx | 633 -- extensions/source/bibliography/toolbar.hrc | 46 - extensions/source/bibliography/toolbar.hxx | 191 - extensions/source/bibliography/toolbar.src | 153 - .../uiconfig/sbibliography/menubar/menubar.xml | 92 - extensions/source/config/ldap/componentdef.cxx | 69 - extensions/source/config/ldap/exports.dxp | 1 - extensions/source/config/ldap/ldapaccess.cxx | 321 - extensions/source/config/ldap/ldapaccess.hxx | 171 - extensions/source/config/ldap/ldapbe2.component | 34 - .../source/config/ldap/ldapuserprofilebe.cxx | 279 - .../source/config/ldap/ldapuserprofilebe.hxx | 161 - extensions/source/config/ldap/makefile.mk | 105 - extensions/source/config/ldap/wrapldapinclude.hxx | 53 - extensions/source/dbpilots/commonpagesdbp.cxx | 506 -- extensions/source/dbpilots/commonpagesdbp.hxx | 148 - extensions/source/dbpilots/commonpagesdbp.src | 226 - extensions/source/dbpilots/controlwizard.cxx | 754 --- extensions/source/dbpilots/controlwizard.hxx | 185 - extensions/source/dbpilots/dbp.component | 40 - extensions/source/dbpilots/dbpilots.src | 81 - extensions/source/dbpilots/dbpresid.hrc | 232 - extensions/source/dbpilots/dbpservices.cxx | 83 - extensions/source/dbpilots/dbptools.cxx | 72 - extensions/source/dbpilots/dbptools.hxx | 50 - extensions/source/dbpilots/dbptypes.hxx | 49 - extensions/source/dbpilots/gridpages.src | 121 - extensions/source/dbpilots/gridwizard.cxx | 487 -- extensions/source/dbpilots/gridwizard.hxx | 138 - extensions/source/dbpilots/groupboxpages.src | 240 - extensions/source/dbpilots/groupboxwiz.cxx | 565 -- extensions/source/dbpilots/groupboxwiz.hxx | 231 - extensions/source/dbpilots/listcombopages.src | 211 - extensions/source/dbpilots/listcombowizard.cxx | 564 -- extensions/source/dbpilots/listcombowizard.hxx | 229 - extensions/source/dbpilots/makefile.mk | 111 - extensions/source/dbpilots/moduledbp.cxx | 34 - extensions/source/dbpilots/optiongrouplayouter.cxx | 218 - extensions/source/dbpilots/optiongrouplayouter.hxx | 77 - extensions/source/dbpilots/unoautopilot.hxx | 108 - extensions/source/dbpilots/unoautopilot.inl | 129 - extensions/source/dbpilots/wizardcontext.hxx | 94 - extensions/source/dbpilots/wizardservices.cxx | 122 - extensions/source/dbpilots/wizardservices.hxx | 82 - extensions/source/inc/componentmodule.cxx | 293 - extensions/source/inc/componentmodule.hxx | 265 - extensions/source/logging/consolehandler.cxx | 345 -- extensions/source/logging/csvformatter.cxx | 377 -- extensions/source/logging/filehandler.cxx | 444 -- extensions/source/logging/log.component | 47 - extensions/source/logging/log_module.cxx | 62 - extensions/source/logging/log_module.hxx | 95 - extensions/source/logging/log_services.cxx | 69 - extensions/source/logging/logger.cxx | 406 -- extensions/source/logging/loggerconfig.cxx | 287 - extensions/source/logging/loggerconfig.hxx | 68 - extensions/source/logging/loghandler.cxx | 204 - extensions/source/logging/loghandler.hxx | 157 - extensions/source/logging/logrecord.cxx | 105 - extensions/source/logging/logrecord.hxx | 71 - extensions/source/logging/makefile.mk | 84 - extensions/source/logging/methodguard.hxx | 75 - extensions/source/logging/plaintextformatter.cxx | 229 - .../source/macosx/spotlight/GetMetadataForFile.m | 70 - .../source/macosx/spotlight/OOoContentDataParser.h | 61 - .../source/macosx/spotlight/OOoContentDataParser.m | 133 - .../source/macosx/spotlight/OOoMetaDataParser.h | 55 - .../source/macosx/spotlight/OOoMetaDataParser.m | 200 - .../source/macosx/spotlight/OOoSpotlightImporter.h | 45 - .../source/macosx/spotlight/OOoSpotlightImporter.m | 235 - extensions/source/macosx/spotlight/delzip | 0 extensions/source/macosx/spotlight/ioapi.h | 100 - extensions/source/macosx/spotlight/ioapi.m | 204 - extensions/source/macosx/spotlight/main.m | 225 - extensions/source/macosx/spotlight/makefile.mk | 99 - .../source/macosx/spotlight/mdimporter/Info.plist | 70 - .../spotlight/mdimporter/en.lproj/schema.strings | 1 - .../source/macosx/spotlight/mdimporter/schema.xml | 397 -- extensions/source/macosx/spotlight/unzip.h | 380 -- extensions/source/macosx/spotlight/unzip.m | 1586 ----- extensions/source/macosx/spotlight/version.plist | 16 - extensions/source/nsplugin/source/exports.dxp | 16 - extensions/source/nsplugin/source/exports_wnt.dxp | 18 - extensions/source/nsplugin/source/makefile.mk | 160 - extensions/source/nsplugin/source/npshell.cxx | 929 --- extensions/source/nsplugin/source/npshell.hxx | 94 - extensions/source/nsplugin/source/ns_debug.hxx | 42 - extensions/source/nsplugin/source/nsp_func.hxx | 106 - extensions/source/nsplugin/source/nsp_windows.cxx | 66 - extensions/source/nsplugin/source/nsp_windows.hxx | 38 - extensions/source/nsplugin/source/nsplugin.rc | 30 - extensions/source/nsplugin/source/nsplugin_oo.rc | 30 - .../source/nsplugin/source/so_closelistener.cxx | 50 - .../source/nsplugin/source/so_closelistener.hxx | 56 - extensions/source/nsplugin/source/so_env.cxx | 509 -- extensions/source/nsplugin/source/so_env.hxx | 97 - extensions/source/nsplugin/source/so_instance.cxx | 485 -- extensions/source/nsplugin/source/so_instance.hxx | 113 - extensions/source/nsplugin/source/so_main.cxx | 499 -- extensions/source/nsplugin/source/so_msg.hxx | 57 - extensions/source/ole/comifaces.hxx | 72 - extensions/source/ole/jscriptclasses.cxx | 324 - extensions/source/ole/jscriptclasses.hxx | 164 - extensions/source/ole/makefile.mk | 132 - extensions/source/ole/ole2uno.cxx | 60 - extensions/source/ole/ole2uno.hxx | 144 - extensions/source/ole/oleautobridge.component | 46 - extensions/source/ole/oleautobridge.uno.dxp | 2 - extensions/source/ole/oledll.cxx | 72 - extensions/source/ole/oleobjw.cxx | 2644 -------- extensions/source/ole/oleobjw.hxx | 295 - extensions/source/ole/olethread.cxx | 79 - extensions/source/ole/servprov.cxx | 754 --- extensions/source/ole/servprov.hxx | 276 - extensions/source/ole/servreg.cxx | 128 - extensions/source/ole/unoconversionutilities.hxx | 2445 -------- extensions/source/ole/unoobjw.cxx | 1688 ------ extensions/source/ole/unoobjw.hxx | 297 - extensions/source/ole/unotypewrapper.cxx | 181 - extensions/source/ole/unotypewrapper.hxx | 105 - extensions/source/ole/windata.cxx | 42 - extensions/source/ole/windata.hxx | 201 - extensions/source/oooimprovecore/core.cxx | 192 - extensions/source/oooimprovecore/makefile.mk | 82 - .../source/oooimprovecore/oooimprovecore.component | 34 - .../oooimprovecore/oooimprovecore_module.cxx | 56 - .../oooimprovecore/oooimprovecore_module.hxx | 89 - .../oooimprovecore/oooimprovecore_services.cxx | 53 - extensions/source/oooimprovement/Jobs.xcu | 25 - extensions/source/oooimprovement/Logging.xcu | 8 - extensions/source/oooimprovement/config.cxx | 299 - extensions/source/oooimprovement/config.hxx | 68 - .../source/oooimprovement/corecontroller.cxx | 92 - .../source/oooimprovement/corecontroller.hxx | 87 - extensions/source/oooimprovement/errormail.cxx | 208 - extensions/source/oooimprovement/errormail.hxx | 57 - extensions/source/oooimprovement/invite_job.cxx | 127 - extensions/source/oooimprovement/invite_job.hxx | 85 - extensions/source/oooimprovement/logpacker.cxx | 117 - extensions/source/oooimprovement/logpacker.hxx | 54 - extensions/source/oooimprovement/logstorage.cxx | 149 - extensions/source/oooimprovement/logstorage.hxx | 58 - extensions/source/oooimprovement/makefile.mk | 109 - extensions/source/oooimprovement/makefile.pmk | 29 - .../oooimprovement/myconfigurationhelper.cxx | 181 - .../oooimprovement/myconfigurationhelper.hxx | 217 - .../source/oooimprovement/onlogrotate_job.cxx | 243 - .../source/oooimprovement/onlogrotate_job.hxx | 86 - .../source/oooimprovement/oooimprovement.component | 38 - .../oooimprovement/oooimprovement_exports.cxx | 88 - extensions/source/oooimprovement/soaprequest.cxx | 203 - extensions/source/oooimprovement/soaprequest.hxx | 63 - extensions/source/oooimprovement/soapsender.cxx | 163 - extensions/source/oooimprovement/soapsender.hxx | 59 - extensions/source/plugin/aqua/macmgr.cxx | 654 -- extensions/source/plugin/aqua/makefile.mk | 63 - extensions/source/plugin/aqua/sysplug.cxx | 812 --- extensions/source/plugin/base/context.cxx | 354 -- extensions/source/plugin/base/evtlstnr.cxx | 77 - extensions/source/plugin/base/makefile.mk | 66 - extensions/source/plugin/base/manager.cxx | 237 - extensions/source/plugin/base/multiplx.cxx | 335 - extensions/source/plugin/base/nfuncs.cxx | 675 --- extensions/source/plugin/base/plcom.cxx | 83 - extensions/source/plugin/base/plctrl.cxx | 325 - extensions/source/plugin/base/plmodel.cxx | 206 - extensions/source/plugin/base/service.cxx | 99 - extensions/source/plugin/base/xplugin.cxx | 1157 ---- .../source/plugin/inc/plugin/aqua/sysplug.hxx | 169 - extensions/source/plugin/inc/plugin/impl.hxx | 431 -- extensions/source/plugin/inc/plugin/model.hxx | 139 - extensions/source/plugin/inc/plugin/multiplx.hxx | 169 - extensions/source/plugin/inc/plugin/plcom.hxx | 88 - extensions/source/plugin/inc/plugin/plctrl.hxx | 182 - .../source/plugin/inc/plugin/unx/mediator.hxx | 186 - .../source/plugin/inc/plugin/unx/plugcon.hxx | 250 - .../source/plugin/inc/plugin/unx/sysplug.hxx | 86 - .../source/plugin/inc/plugin/win/sysplug.hxx | 121 - extensions/source/plugin/unx/makefile.mk | 104 - extensions/source/plugin/unx/mediator.cxx | 312 - extensions/source/plugin/unx/npnapi.cxx | 905 --- extensions/source/plugin/unx/nppapi.cxx | 628 -- extensions/source/plugin/unx/npwrap.cxx | 518 -- extensions/source/plugin/unx/plugcon.cxx | 292 - extensions/source/plugin/unx/sysplug.cxx | 141 - extensions/source/plugin/unx/unxmgr.cxx | 329 - extensions/source/plugin/util/makefile.mk | 109 - extensions/source/plugin/util/makefile.pmk | 48 - extensions/source/plugin/util/pl.component | 37 - extensions/source/plugin/win/makefile.mk | 58 - extensions/source/plugin/win/sysplug.cxx | 445 -- extensions/source/plugin/win/winmgr.cxx | 453 -- .../source/propctrlr/MasterDetailLinkDialog.cxx | 160 - .../source/propctrlr/MasterDetailLinkDialog.hxx | 87 - extensions/source/propctrlr/browserline.cxx | 532 -- extensions/source/propctrlr/browserline.hxx | 143 - extensions/source/propctrlr/browserlistbox.cxx | 1311 ---- extensions/source/propctrlr/browserlistbox.hxx | 248 - extensions/source/propctrlr/browserpage.cxx | 107 - extensions/source/propctrlr/browserpage.hxx | 70 - extensions/source/propctrlr/browserview.cxx | 146 - extensions/source/propctrlr/browserview.hxx | 89 - .../source/propctrlr/buttonnavigationhandler.cxx | 297 - .../source/propctrlr/buttonnavigationhandler.hxx | 92 - extensions/source/propctrlr/cellbindinghandler.cxx | 507 -- extensions/source/propctrlr/cellbindinghandler.hxx | 111 - extensions/source/propctrlr/cellbindinghelper.cxx | 568 -- extensions/source/propctrlr/cellbindinghelper.hxx | 293 - extensions/source/propctrlr/commoncontrol.cxx | 208 - extensions/source/propctrlr/commoncontrol.hxx | 339 -- extensions/source/propctrlr/composeduiupdate.cxx | 861 --- extensions/source/propctrlr/composeduiupdate.hxx | 233 - extensions/source/propctrlr/controlfontdialog.cxx | 177 - extensions/source/propctrlr/controlfontdialog.hxx | 102 - extensions/source/propctrlr/controltype.hxx | 56 - .../source/propctrlr/defaultforminspection.cxx | 267 - .../source/propctrlr/defaultforminspection.hxx | 93 - .../source/propctrlr/defaulthelpprovider.cxx | 209 - .../source/propctrlr/defaulthelpprovider.hxx | 96 - .../source/propctrlr/editpropertyhandler.cxx | 325 - .../source/propctrlr/editpropertyhandler.hxx | 84 - extensions/source/propctrlr/eformshelper.cxx | 789 --- extensions/source/propctrlr/eformshelper.hxx | 271 - .../source/propctrlr/eformspropertyhandler.cxx | 618 -- .../source/propctrlr/eformspropertyhandler.hxx | 110 - extensions/source/propctrlr/enumrepresentation.hxx | 78 - extensions/source/propctrlr/eventhandler.cxx | 1289 ---- extensions/source/propctrlr/eventhandler.hxx | 267 - extensions/source/propctrlr/fontdialog.cxx | 608 -- extensions/source/propctrlr/fontdialog.hxx | 85 - extensions/source/propctrlr/fontdialog.src | 60 - extensions/source/propctrlr/fontitemids.hxx | 68 - extensions/source/propctrlr/formbrowsertools.cxx | 146 - extensions/source/propctrlr/formbrowsertools.hxx | 110 - .../source/propctrlr/formcomponenthandler.cxx | 3343 ---------- .../source/propctrlr/formcomponenthandler.hxx | 481 -- extensions/source/propctrlr/formcontroller.cxx | 300 - extensions/source/propctrlr/formcontroller.hxx | 142 - .../source/propctrlr/formgeometryhandler.cxx | 829 --- extensions/source/propctrlr/formlinkdialog.cxx | 675 --- extensions/source/propctrlr/formlinkdialog.hrc | 44 - extensions/source/propctrlr/formlinkdialog.hxx | 151 - extensions/source/propctrlr/formlinkdialog.src | 162 - extensions/source/propctrlr/formlocalid.hrc | 37 - extensions/source/propctrlr/formmetadata.cxx | 704 --- extensions/source/propctrlr/formmetadata.hxx | 351 -- extensions/source/propctrlr/formres.src | 1527 ----- extensions/source/propctrlr/formresid.hrc | 388 -- extensions/source/propctrlr/formstrings.cxx | 38 - extensions/source/propctrlr/formstrings.hxx | 310 - .../source/propctrlr/genericpropertyhandler.cxx | 729 --- .../source/propctrlr/genericpropertyhandler.hxx | 163 - extensions/source/propctrlr/handlerhelper.cxx | 290 - extensions/source/propctrlr/handlerhelper.hxx | 219 - .../source/propctrlr/inspectorhelpwindow.cxx | 153 - .../source/propctrlr/inspectorhelpwindow.hxx | 80 - extensions/source/propctrlr/inspectormodelbase.cxx | 275 - extensions/source/propctrlr/inspectormodelbase.hxx | 110 - extensions/source/propctrlr/linedescriptor.hxx | 72 - extensions/source/propctrlr/listselectiondlg.cxx | 170 - extensions/source/propctrlr/listselectiondlg.hrc | 39 - extensions/source/propctrlr/listselectiondlg.hxx | 89 - extensions/source/propctrlr/listselectiondlg.src | 82 - extensions/source/propctrlr/makefile.mk | 154 - extensions/source/propctrlr/modulepcr.cxx | 47 - extensions/source/propctrlr/modulepcr.hxx | 47 - extensions/source/propctrlr/newdatatype.cxx | 105 - extensions/source/propctrlr/newdatatype.hrc | 38 - extensions/source/propctrlr/newdatatype.hxx | 77 - extensions/source/propctrlr/newdatatype.src | 79 - .../source/propctrlr/objectinspectormodel.cxx | 245 - extensions/source/propctrlr/pcr.component | 91 - extensions/source/propctrlr/pcr.xml | 146 - extensions/source/propctrlr/pcrcommon.cxx | 76 - extensions/source/propctrlr/pcrcommon.hxx | 154 - extensions/source/propctrlr/pcrcommontypes.hxx | 53 - .../source/propctrlr/pcrcomponentcontext.cxx | 108 - .../source/propctrlr/pcrcomponentcontext.hxx | 170 - extensions/source/propctrlr/pcrmiscres.src | 173 - extensions/source/propctrlr/pcrservices.cxx | 114 - extensions/source/propctrlr/pcrstrings.cxx | 38 - extensions/source/propctrlr/pcrstrings.hxx | 48 - extensions/source/propctrlr/pcrunodialogs.cxx | 148 - extensions/source/propctrlr/pcrunodialogs.hxx | 96 - extensions/source/propctrlr/propcontroller.cxx | 1773 ------ extensions/source/propctrlr/propcontroller.hxx | 429 -- .../source/propctrlr/propcontrolobserver.hxx | 58 - extensions/source/propctrlr/propertycomposer.cxx | 518 -- extensions/source/propctrlr/propertycomposer.hxx | 158 - .../source/propctrlr/propertycontrolextender.cxx | 146 - .../source/propctrlr/propertycontrolextender.hxx | 77 - extensions/source/propctrlr/propertyeditor.cxx | 544 -- extensions/source/propctrlr/propertyeditor.hxx | 165 - extensions/source/propctrlr/propertyhandler.cxx | 466 -- extensions/source/propctrlr/propertyhandler.hxx | 457 -- extensions/source/propctrlr/propertyinfo.hxx | 68 - .../source/propctrlr/propeventtranslation.cxx | 107 - .../source/propctrlr/propeventtranslation.hxx | 86 - extensions/source/propctrlr/proplinelistener.hxx | 53 - extensions/source/propctrlr/propres.src | 68 - extensions/source/propctrlr/propresid.hrc | 48 - .../source/propctrlr/pushbuttonnavigation.cxx | 309 - .../source/propctrlr/pushbuttonnavigation.hxx | 111 - extensions/source/propctrlr/selectlabeldialog.cxx | 313 - extensions/source/propctrlr/selectlabeldialog.hxx | 89 - extensions/source/propctrlr/selectlabeldialog.src | 85 - extensions/source/propctrlr/sqlcommanddesign.cxx | 391 -- extensions/source/propctrlr/sqlcommanddesign.hxx | 225 - extensions/source/propctrlr/standardcontrol.cxx | 1438 ----- extensions/source/propctrlr/standardcontrol.hxx | 447 -- extensions/source/propctrlr/stlops.hxx | 72 - extensions/source/propctrlr/stringdefine.hxx | 101 - .../source/propctrlr/stringrepresentation.cxx | 645 -- extensions/source/propctrlr/submissionhandler.cxx | 450 -- extensions/source/propctrlr/submissionhandler.hxx | 127 - extensions/source/propctrlr/taborder.cxx | 417 -- extensions/source/propctrlr/taborder.hrc | 45 - extensions/source/propctrlr/taborder.hxx | 126 - extensions/source/propctrlr/taborder.src | 107 - extensions/source/propctrlr/unourl.cxx | 72 - extensions/source/propctrlr/unourl.hxx | 67 - extensions/source/propctrlr/usercontrol.cxx | 371 -- extensions/source/propctrlr/usercontrol.hxx | 174 - extensions/source/propctrlr/xsddatatypes.cxx | 252 - extensions/source/propctrlr/xsddatatypes.hxx | 116 - .../source/propctrlr/xsdvalidationhelper.cxx | 414 -- .../source/propctrlr/xsdvalidationhelper.hxx | 152 - .../propctrlr/xsdvalidationpropertyhandler.cxx | 695 --- .../propctrlr/xsdvalidationpropertyhandler.hxx | 105 - extensions/source/resource/ResourceIndexAccess.cxx | 208 - extensions/source/resource/ResourceIndexAccess.hxx | 75 - extensions/source/resource/exports.dxp | 1 - extensions/source/resource/makefile.mk | 86 - extensions/source/resource/oooresourceloader.cxx | 341 -- extensions/source/resource/oooresourceloader.hxx | 87 - extensions/source/resource/res.component | 38 - extensions/source/resource/resourceservices.cxx | 58 - extensions/source/scanner/exports.dxp | 1 - extensions/source/scanner/grid.cxx | 611 -- extensions/source/scanner/grid.hrc | 42 - extensions/source/scanner/grid.hxx | 150 - extensions/source/scanner/grid.src | 115 - extensions/source/scanner/makefile.mk | 104 - extensions/source/scanner/sane.cxx | 1007 --- extensions/source/scanner/sane.hxx | 203 - extensions/source/scanner/sanedlg.cxx | 1373 ----- extensions/source/scanner/sanedlg.hrc | 82 - extensions/source/scanner/sanedlg.hxx | 153 - extensions/source/scanner/sanedlg.src | 318 - extensions/source/scanner/scanner.cxx | 107 - extensions/source/scanner/scanner.hxx | 113 - extensions/source/scanner/scanunx.cxx | 386 -- extensions/source/scanner/scanwin.cxx | 1059 ---- extensions/source/scanner/scn.component | 34 - extensions/source/scanner/scnserv.cxx | 64 - extensions/source/scanner/twain.cxx | 480 -- extensions/source/scanner/twain.hxx | 95 - .../source/unoactivex/main/initwindowpeer.cxx | 89 - extensions/source/update/check/Addons.xcu | 26 - extensions/source/update/check/Jobs.xcu | 42 - extensions/source/update/check/actionlistener.hxx | 48 - extensions/source/update/check/download.cxx | 463 -- extensions/source/update/check/download.hxx | 86 - extensions/source/update/check/makefile.mk | 142 - extensions/source/update/check/transform.pl | 61 - extensions/source/update/check/updatecheck.cxx | 1692 ------ extensions/source/update/check/updatecheck.hxx | 197 - .../source/update/check/updatecheckconfig.cxx | 812 --- .../source/update/check/updatecheckconfig.hxx | 245 - .../update/check/updatecheckconfiglistener.hxx | 46 - extensions/source/update/check/updatecheckjob.cxx | 393 -- extensions/source/update/check/updatehdl.cxx | 1423 ----- extensions/source/update/check/updatehdl.hrc | 83 - extensions/source/update/check/updatehdl.hxx | 222 - extensions/source/update/check/updatehdl.src | 264 - extensions/source/update/check/updateinfo.hxx | 89 - extensions/source/update/check/updateprotocol.cxx | 336 - extensions/source/update/check/updateprotocol.hxx | 58 - .../source/update/check/updateprotocoltest.cxx | 97 - .../source/update/check/updchk.uno.component | 37 - extensions/source/update/check/updchk.xml | 49 - extensions/source/update/feed/makefile.mk | 72 - extensions/source/update/feed/test/makefile.mk | 58 - .../source/update/feed/test/updatefeedtest.cxx | 109 - extensions/source/update/feed/updatefeed.component | 34 - extensions/source/update/feed/updatefeed.cxx | 856 --- extensions/source/update/feed/updatefeed.xml | 49 - extensions/source/update/tools/makefile.mk | 44 - extensions/source/update/tools/ztool.cxx | 62 - extensions/source/update/ui/makefile.mk | 82 - extensions/source/update/ui/updatecheckui.cxx | 1056 ---- extensions/source/update/ui/updatecheckui.hrc | 34 - extensions/source/update/ui/updatecheckui.src | 41 - extensions/source/update/ui/updchk.component | 34 - extensions/source/update/ui/updchkui.xml | 34 - extensions/source/xmlextract/makefile.mk | 73 - extensions/source/xmlextract/xmx.component | 34 - extensions/source/xmlextract/xmxcom.hxx | 65 - extensions/source/xmlextract/xmxtrct.cxx | 200 - extensions/source/xmlextract/xmxtrct.hxx | 57 - extensions/source/xmlextract/xmxuno.cxx | 75 - extensions/stardiv/fontest/fontest.idl | 111 - extensions/stardiv/fontest/makefile.mk | 48 - extensions/stardiv/oinstchk/makefile.mk | 47 - extensions/stardiv/oinstchk/oinstchk.idl | 108 - extensions/stardiv/pgp/makefile.mk | 53 - .../test/ole/AxTestComponents/AxTestComponents.cpp | 101 - .../test/ole/AxTestComponents/AxTestComponents.def | 9 - .../test/ole/AxTestComponents/AxTestComponents.dsp | 325 - .../test/ole/AxTestComponents/AxTestComponents.idl | 257 - .../test/ole/AxTestComponents/AxTestComponents.rc | 164 - .../test/ole/AxTestComponents/AxTestComponents.sln | 31 - .../ole/AxTestComponents/AxTestComponents.vcproj | 819 --- extensions/test/ole/AxTestComponents/Basic.cpp | 1366 ----- extensions/test/ole/AxTestComponents/Basic.h | 270 - extensions/test/ole/AxTestComponents/Basic.rgs | 50 - extensions/test/ole/AxTestComponents/Foo.cpp | 49 - extensions/test/ole/AxTestComponents/Foo.h | 66 - extensions/test/ole/AxTestComponents/StdAfx.cpp | 35 - extensions/test/ole/AxTestComponents/StdAfx.h | 59 - extensions/test/ole/AxTestComponents/readme.txt | 4 - extensions/test/ole/AxTestComponents/resource.h | 47 - .../test/ole/DCOM/Clients/WriterDemo/Module1.bas | 8 - .../DCOM/Clients/WriterDemo/client_writerdemo.vbp | 33 - .../DCOM/Clients/WriterDemo/client_writerdemo.vbw | 1 - .../test/ole/DCOM/Clients/WriterDemo/readme.txt | 4 - extensions/test/ole/DCOM/dcom_test/Module1.bas | 38 - extensions/test/ole/DCOM/dcom_test/dcom_test.vbp | 37 - extensions/test/ole/DCOM/dcom_test/dcom_test.vbw | 1 - extensions/test/ole/DCOM/dcom_test/readme.txt | 5 - .../test/ole/DCOM/scriptComponents/WriterDemo.wsc | 186 - .../test/ole/DCOM/scriptComponents/readme.txt | 13 - .../EventListener/EventListener.cpp | 74 - .../EventListener/EventListener.def | 9 - .../EventListener/EventListener.idl | 39 - .../EventListener/EventListener.rc | 136 - .../EventListener/EventListener.sln | 32 - .../EventListener/EventListener.vcproj | 927 --- .../EventListener/EvtListener.cpp | 21 - .../EventListener/EvtListener.h | 38 - .../EventListener/EvtListener.rgs | 26 - .../EventListenerSample/EventListener/StdAfx.cpp | 15 - .../ole/EventListenerSample/EventListener/StdAfx.h | 30 - .../EventListenerSample/EventListener/resource.h | 20 - .../VBEventListener/Module1.bas | 9 - .../VBEventListener/VBEventListener.cls | 78 - .../VBEventListener/VBasicEventListener.dll | Bin 24576 -> 0 bytes .../VBEventListener/VBasicEventListener.vbp | 38 - .../VBEventListener/VBasicEventListener.vbw | 2 - .../EventListenerSample/VBEventListener/readme.txt | 7 - extensions/test/ole/EventListenerSample/events.htm | 98 - extensions/test/ole/EventListenerSample/readme.txt | 20 - extensions/test/ole/JScriptNewStyle.htm | 1054 ---- extensions/test/ole/MfcControl/MfcControl.cpp | 82 - extensions/test/ole/MfcControl/MfcControl.def | 9 - extensions/test/ole/MfcControl/MfcControl.dsp | 265 - extensions/test/ole/MfcControl/MfcControl.h | 36 - extensions/test/ole/MfcControl/MfcControl.odl | 82 - extensions/test/ole/MfcControl/MfcControl.rc | 145 - extensions/test/ole/MfcControl/MfcControl.sln | 25 - extensions/test/ole/MfcControl/MfcControl.vcproj | 581 -- extensions/test/ole/MfcControl/MfcControlCtl.cpp | 347 -- extensions/test/ole/MfcControl/MfcControlCtl.h | 99 - extensions/test/ole/MfcControl/MfcControlCtl.png | Bin 204 -> 0 bytes extensions/test/ole/MfcControl/MfcControlPpg.cpp | 79 - extensions/test/ole/MfcControl/MfcControlPpg.h | 49 - extensions/test/ole/MfcControl/Resource.h | 23 - extensions/test/ole/MfcControl/StdAfx.cpp | 8 - extensions/test/ole/MfcControl/StdAfx.h | 33 - extensions/test/ole/OleClient/OleClient.ini | 5 - extensions/test/ole/OleClient/axhost.cxx | 58 - extensions/test/ole/OleClient/axhost.hxx | 62 - extensions/test/ole/OleClient/clientTest.cxx | 1319 ---- extensions/test/ole/OleClient/funcs.cxx | 358 -- extensions/test/ole/OleClient/makefile.mk | 72 - extensions/test/ole/OleClient/readme.txt | 10 - extensions/test/ole/OleConverterVar1/convTest.cxx | 660 -- extensions/test/ole/OleConverterVar1/makefile.mk | 66 - extensions/test/ole/OleConverterVar1/readme.txt | 10 - extensions/test/ole/OleConverterVar1/smartarray.h | 236 - extensions/test/ole/OleTest.htm | 1063 ---- extensions/test/ole/ScriptTest.html | 1555 ----- .../test/ole/StarBasic_OleClient/oleclient.bas | 609 -- extensions/test/ole/StarBasic_OleClient/readme.txt | 10 - extensions/test/ole/VisualBasic/AssemblyInfo.vb | 33 - extensions/test/ole/VisualBasic/Module1.vb | 853 --- extensions/test/ole/VisualBasic/Project1.sln | 20 - extensions/test/ole/VisualBasic/Project1.vbproj | 90 - extensions/test/ole/VisualBasic/readme.txt | 18 - extensions/test/ole/callUnoToJava.htm | 538 -- extensions/test/ole/cpnt/cpnt.cxx | 1973 ------ extensions/test/ole/cpnt/exports.dxp | 2 - extensions/test/ole/cpnt/makefile.mk | 84 - extensions/test/ole/cpnt/readme.txt | 21 - extensions/test/ole/cppToUno/makefile.mk | 65 - extensions/test/ole/cppToUno/readme.txt | 9 - extensions/test/ole/cppToUno/testcppuno.cxx | 222 - extensions/test/ole/cpptest/cpptest.cxx | 116 - extensions/test/ole/cpptest/makefile.mk | 64 - extensions/test/ole/cpptest/readme.txt | 6 - extensions/test/ole/idl/oletest.idl | 308 - extensions/test/ole/unloading/makefile.mk | 70 - extensions/test/ole/unloading/readme.txt | 6 - extensions/test/ole/unloading/unloadTest.cxx | 216 - extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp | 37 - extensions/test/ole/unoTocomCalls/Test/StdAfx.h | 58 - extensions/test/ole/unoTocomCalls/Test/Test.cpp | 249 - extensions/test/ole/unoTocomCalls/Test/Test.dsp | 114 - extensions/test/ole/unoTocomCalls/Test/Test.sln | 19 - extensions/test/ole/unoTocomCalls/Test/Test.vcproj | 247 - .../ole/unoTocomCalls/XCallback_Impl/Basic.rgs | 27 - .../ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs | 27 - .../ole/unoTocomCalls/XCallback_Impl/Callback.cpp | 514 -- .../ole/unoTocomCalls/XCallback_Impl/Callback.h | 138 - .../ole/unoTocomCalls/XCallback_Impl/Callback.rgs | 27 - .../ole/unoTocomCalls/XCallback_Impl/Simple.cpp | 82 - .../test/ole/unoTocomCalls/XCallback_Impl/Simple.h | 67 - .../ole/unoTocomCalls/XCallback_Impl/Simple.rgs | 27 - .../ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp | 41 - .../test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h | 59 - .../XCallback_Impl/XCallback_Impl.cpp | 103 - .../XCallback_Impl/XCallback_Impl.def | 10 - .../XCallback_Impl/XCallback_Impl.dsp | 337 - .../XCallback_Impl/XCallback_Impl.idl | 151 - .../unoTocomCalls/XCallback_Impl/XCallback_Impl.rc | 163 - .../XCallback_Impl/XCallback_Impl.sln | 31 - .../XCallback_Impl/XCallback_Impl.vcproj | 816 --- .../ole/unoTocomCalls/XCallback_Impl/resource.h | 48 - extensions/test/ole/unoTocomCalls/readme.txt | 9 - extensions/test/pgp/TestPGP.java | 146 - extensions/test/pgp/makefile.mk | 71 - extensions/test/pgp/readme.txt | 33 - extensions/test/stm/datatest.cxx | 1071 ---- extensions/test/stm/exports.dxp | 2 - extensions/test/stm/makefile.mk | 61 - extensions/test/stm/marktest.cxx | 658 -- extensions/test/stm/pipetest.cxx | 448 -- extensions/test/stm/testfactreg.cxx | 171 - extensions/test/stm/testfactreg.hxx | 113 - extensions/util/hidother.src | 428 -- extensions/util/makefile.mk | 39 - extensions/util/makefile.pmk | 29 - extensions/util/target.pmk | 35 - extensions/workben/makefile.mk | 152 - extensions/workben/pythonautotest.cxx | 625 -- extensions/workben/pythontest.cxx | 560 -- extensions/workben/testcomponent.cxx | 220 - extensions/workben/testframecontrol.cxx | 319 - extensions/workben/testpgp.cxx | 753 --- extensions/workben/testresource.cxx | 92 - extensions/workben/testresource.src | 30 - forms/AllLangResTarget_frm.mk | 51 - forms/JunitTest_forms_complex.mk | 47 - forms/JunitTest_forms_unoapi.mk | 50 - forms/Library_frm.mk | 177 - forms/Makefile | 39 - forms/Module_forms.mk | 42 - forms/Package_unotypes.mk | 33 - forms/inc/pch/precompiled_forms.cxx | 31 - forms/inc/pch/precompiled_forms.hxx | 399 -- forms/prj/build.lst | 4 - forms/prj/d.lst | 0 forms/prj/makefile.mk | 40 - forms/qa/complex/forms/CheckOGroupBoxModel.java | 222 - forms/qa/forms_all.sce | 8 - forms/qa/integration/forms/BooleanValidator.java | 59 - forms/qa/integration/forms/CellBinding.java | 560 -- forms/qa/integration/forms/ControlValidation.java | 198 - forms/qa/integration/forms/ControlValidator.java | 59 - forms/qa/integration/forms/DateValidator.java | 99 - forms/qa/integration/forms/DocumentHelper.java | 404 -- forms/qa/integration/forms/DocumentType.java | 61 - forms/qa/integration/forms/DocumentViewHelper.java | 257 - forms/qa/integration/forms/FormComponent.java | 197 - forms/qa/integration/forms/FormControlTest.java | 952 --- forms/qa/integration/forms/FormLayer.java | 372 -- forms/qa/integration/forms/FormPropertyBags.java | 208 - forms/qa/integration/forms/ImageComparison.java | 73 - forms/qa/integration/forms/ListBox.java | 290 - forms/qa/integration/forms/ListSelection.java | 301 - forms/qa/integration/forms/ListSelection.props | 3 - .../integration/forms/ListSelectionValidator.java | 67 - forms/qa/integration/forms/MasterDetailForms.java | 435 -- forms/qa/integration/forms/NumericValidator.java | 86 - forms/qa/integration/forms/RadioButtons.java | 455 -- .../integration/forms/SingleControlValidation.java | 187 - .../qa/integration/forms/SpreadsheetDocument.java | 151 - forms/qa/integration/forms/SpreadsheetView.java | 81 - .../qa/integration/forms/TableCellTextBinding.java | 213 - forms/qa/integration/forms/TestCase.java | 158 - forms/qa/integration/forms/TestSkeleton.java | 75 - forms/qa/integration/forms/TextValidator.java | 86 - forms/qa/integration/forms/TimeValidator.java | 91 - forms/qa/integration/forms/ValueBinding.java | 120 - forms/qa/integration/forms/WaitForInput.java | 66 - forms/qa/integration/forms/XMLFormSettings.java | 229 - forms/qa/integration/forms/dbfTools.java | 55 - .../openoffice/complex/forms/tools/ResultSet.java | 264 - forms/qa/org/openoffice/xforms/Instance.java | 198 - forms/qa/org/openoffice/xforms/Model.java | 100 - forms/qa/org/openoffice/xforms/XMLDocument.java | 96 - forms/qa/unoapi/forms.sce | 40 - forms/qa/unoapi/knownissues.xcl | 131 - forms/qa/unoapi/testdocuments/TestDB/testDB.dbf | Bin 11101 -> 0 bytes forms/qa/unoapi/testdocuments/TestDB/testDB.dbt | Bin 18435 -> 0 bytes forms/source/component/BaseListBox.hxx | 45 - forms/source/component/Button.cxx | 781 --- forms/source/component/Button.hxx | 212 - forms/source/component/CheckBox.cxx | 275 - forms/source/component/CheckBox.hxx | 93 - forms/source/component/Columns.cxx | 602 -- forms/source/component/Columns.hxx | 223 - forms/source/component/ComboBox.cxx | 916 --- forms/source/component/ComboBox.hxx | 180 - forms/source/component/Currency.cxx | 270 - forms/source/component/Currency.hxx | 103 - forms/source/component/DatabaseForm.cxx | 4162 ------------- forms/source/component/DatabaseForm.hxx | 569 -- forms/source/component/Date.cxx | 365 -- forms/source/component/Date.hxx | 135 - forms/source/component/Edit.cxx | 761 --- forms/source/component/Edit.hxx | 189 - forms/source/component/EditBase.cxx | 361 -- forms/source/component/EditBase.hxx | 115 - forms/source/component/EventThread.cxx | 242 - forms/source/component/EventThread.hxx | 128 - forms/source/component/File.cxx | 306 - forms/source/component/File.hxx | 105 - forms/source/component/Filter.cxx | 933 --- forms/source/component/Filter.hxx | 161 - forms/source/component/FixedText.cxx | 138 - forms/source/component/FixedText.hxx | 73 - forms/source/component/FormComponent.cxx | 3070 ---------- forms/source/component/FormattedField.cxx | 1257 ---- forms/source/component/FormattedField.hxx | 200 - forms/source/component/FormattedFieldWrapper.cxx | 400 -- forms/source/component/FormattedFieldWrapper.hxx | 101 - forms/source/component/FormsCollection.cxx | 188 - forms/source/component/FormsCollection.hxx | 102 - forms/source/component/Grid.cxx | 1165 ---- forms/source/component/Grid.hxx | 221 - forms/source/component/GroupBox.cxx | 175 - forms/source/component/GroupBox.hxx | 86 - forms/source/component/GroupManager.cxx | 533 -- forms/source/component/GroupManager.hxx | 234 - forms/source/component/Hidden.cxx | 190 - forms/source/component/Hidden.hxx | 86 - forms/source/component/ImageButton.cxx | 275 - forms/source/component/ImageButton.hxx | 109 - forms/source/component/ImageControl.cxx | 1021 ---- forms/source/component/ImageControl.hxx | 212 - forms/source/component/ListBox.cxx | 1862 ------ forms/source/component/ListBox.hxx | 288 - forms/source/component/Numeric.cxx | 224 - forms/source/component/Numeric.hxx | 101 - forms/source/component/Pattern.cxx | 264 - forms/source/component/Pattern.hxx | 110 - forms/source/component/RadioButton.cxx | 438 -- forms/source/component/RadioButton.hxx | 115 - forms/source/component/Time.cxx | 367 -- forms/source/component/Time.hxx | 135 - forms/source/component/cachedrowset.cxx | 205 - forms/source/component/cachedrowset.hxx | 100 - forms/source/component/clickableimage.cxx | 927 --- forms/source/component/clickableimage.hxx | 297 - forms/source/component/cloneable.cxx | 70 - forms/source/component/entrylisthelper.cxx | 324 - forms/source/component/entrylisthelper.hxx | 201 - forms/source/component/errorbroadcaster.cxx | 115 - forms/source/component/errorbroadcaster.hxx | 76 - forms/source/component/findpos.cxx | 60 - forms/source/component/findpos.hxx | 48 - forms/source/component/formcontrolfont.cxx | 552 -- forms/source/component/imgprod.cxx | 582 -- forms/source/component/imgprod.hxx | 113 - forms/source/component/navigationbar.cxx | 512 -- forms/source/component/navigationbar.hxx | 140 - forms/source/component/propertybaghelper.cxx | 360 -- forms/source/component/refvaluecomponent.cxx | 303 - forms/source/component/refvaluecomponent.hxx | 111 - forms/source/component/scrollbar.cxx | 322 - forms/source/component/scrollbar.hxx | 104 - forms/source/component/spinbutton.cxx | 278 - forms/source/component/spinbutton.hxx | 104 - forms/source/helper/commanddescriptionprovider.cxx | 143 - forms/source/helper/commandimageprovider.cxx | 183 - forms/source/helper/controlfeatureinterception.cxx | 172 - forms/source/helper/formnavigation.cxx | 487 -- forms/source/helper/resettable.cxx | 105 - forms/source/helper/urltransformer.cxx | 105 - forms/source/helper/windowstateguard.cxx | 234 - forms/source/inc/FormComponent.hxx | 1322 ---- forms/source/inc/InterfaceContainer.hxx | 329 - forms/source/inc/cloneable.hxx | 57 - forms/source/inc/commanddescriptionprovider.hxx | 72 - forms/source/inc/commandimageprovider.hxx | 80 - forms/source/inc/componenttools.hxx | 107 - forms/source/inc/controlfeatureinterception.hxx | 102 - forms/source/inc/featuredispatcher.hxx | 113 - forms/source/inc/formcontrolfont.hxx | 104 - forms/source/inc/formnavigation.hxx | 238 - forms/source/inc/forms_module.hxx | 320 - forms/source/inc/forms_module_impl.hxx | 163 - forms/source/inc/frm_module.hxx | 39 - forms/source/inc/frm_resource.hrc | 108 - forms/source/inc/frm_resource.hxx | 79 - forms/source/inc/frm_strings.hxx | 365 -- forms/source/inc/ids.hxx | 38 - forms/source/inc/limitedformats.hxx | 107 - forms/source/inc/listenercontainers.hxx | 142 - forms/source/inc/property.hrc | 318 - forms/source/inc/property.hxx | 238 - forms/source/inc/propertybaghelper.hxx | 168 - forms/source/inc/resettable.hxx | 79 - forms/source/inc/services.hxx | 235 - forms/source/inc/togglestate.hxx | 47 - forms/source/inc/urltransformer.hxx | 88 - forms/source/inc/windowstateguard.hxx | 85 - forms/source/misc/InterfaceContainer.cxx | 1358 ----- forms/source/misc/componenttools.cxx | 125 - forms/source/misc/frm_module.cxx | 38 - forms/source/misc/frm_strings.cxx | 36 - forms/source/misc/ids.cxx | 38 - forms/source/misc/limitedformats.cxx | 404 -- forms/source/misc/listenercontainers.cxx | 72 - forms/source/misc/property.cxx | 258 - forms/source/misc/services.cxx | 394 -- forms/source/resource/frm_resource.cxx | 87 - forms/source/resource/strings.src | 161 - forms/source/resource/xforms.src | 196 - forms/source/richtext/attributedispatcher.cxx | 141 - forms/source/richtext/attributedispatcher.hxx | 106 - forms/source/richtext/clipboarddispatcher.cxx | 210 - forms/source/richtext/clipboarddispatcher.hxx | 109 - forms/source/richtext/featuredispatcher.cxx | 160 - forms/source/richtext/featuredispatcher.hxx | 109 - .../richtext/parametrizedattributedispatcher.cxx | 144 - .../richtext/parametrizedattributedispatcher.hxx | 77 - forms/source/richtext/richtextcontrol.cxx | 766 --- forms/source/richtext/richtextcontrol.hxx | 161 - forms/source/richtext/richtextengine.cxx | 163 - forms/source/richtext/richtextengine.hxx | 93 - forms/source/richtext/richtextimplcontrol.cxx | 680 --- forms/source/richtext/richtextimplcontrol.hxx | 198 - forms/source/richtext/richtextmodel.cxx | 641 -- forms/source/richtext/richtextmodel.hxx | 196 - forms/source/richtext/richtextunowrapper.cxx | 138 - forms/source/richtext/richtextunowrapper.hxx | 100 - forms/source/richtext/richtextvclcontrol.cxx | 394 -- forms/source/richtext/richtextvclcontrol.hxx | 143 - forms/source/richtext/richtextviewport.cxx | 130 - forms/source/richtext/richtextviewport.hxx | 82 - forms/source/richtext/rtattributehandler.cxx | 533 -- forms/source/richtext/rtattributehandler.hxx | 242 - forms/source/richtext/rtattributes.hxx | 174 - forms/source/richtext/specialdispatchers.cxx | 200 - forms/source/richtext/specialdispatchers.hxx | 116 - forms/source/richtext/textattributelistener.hxx | 63 - forms/source/runtime/formoperations.cxx | 1742 ------ forms/source/runtime/formoperations.hxx | 382 -- forms/source/solar/component/navbarcontrol.cxx | 567 -- forms/source/solar/component/navbarcontrol.hxx | 161 - forms/source/solar/control/navtoolbar.cxx | 732 --- forms/source/solar/inc/navtoolbar.hxx | 197 - forms/source/xforms/NameContainer.hxx | 224 - forms/source/xforms/binding.cxx | 1412 ----- forms/source/xforms/binding.hxx | 530 -- forms/source/xforms/boolexpression.cxx | 61 - forms/source/xforms/boolexpression.hxx | 58 - forms/source/xforms/collection.hxx | 340 -- forms/source/xforms/computedexpression.cxx | 249 - forms/source/xforms/computedexpression.hxx | 141 - forms/source/xforms/convert.cxx | 632 -- forms/source/xforms/convert.hxx | 116 - forms/source/xforms/datatyperepository.cxx | 295 - forms/source/xforms/datatyperepository.hxx | 100 - forms/source/xforms/datatypes.cxx | 993 --- forms/source/xforms/datatypes.hxx | 426 -- forms/source/xforms/datatypes_impl.hxx | 78 - forms/source/xforms/enumeration.cxx | 77 - forms/source/xforms/enumeration.hxx | 66 - forms/source/xforms/evaluationcontext.hxx | 78 - forms/source/xforms/mip.cxx | 129 - forms/source/xforms/mip.hxx | 125 - forms/source/xforms/model.cxx | 722 --- forms/source/xforms/model.hxx | 434 -- forms/source/xforms/model_helper.hxx | 170 - forms/source/xforms/model_ui.cxx | 1069 ---- forms/source/xforms/namedcollection.hxx | 145 - forms/source/xforms/pathexpression.cxx | 157 - forms/source/xforms/pathexpression.hxx | 94 - forms/source/xforms/propertysetbase.cxx | 195 - forms/source/xforms/propertysetbase.hxx | 374 -- forms/source/xforms/resourcehelper.cxx | 82 - forms/source/xforms/resourcehelper.hxx | 55 - forms/source/xforms/submission.cxx | 721 --- forms/source/xforms/submission.hxx | 279 - forms/source/xforms/submission/replace.cxx | 145 - forms/source/xforms/submission/serialization.hxx | 101 - .../xforms/submission/serialization_app_xml.cxx | 113 - .../xforms/submission/serialization_app_xml.hxx | 58 - .../xforms/submission/serialization_urlencoded.cxx | 196 - .../xforms/submission/serialization_urlencoded.hxx | 59 - forms/source/xforms/submission/submission.hxx | 163 - forms/source/xforms/submission/submission_get.cxx | 122 - forms/source/xforms/submission/submission_get.hxx | 47 - forms/source/xforms/submission/submission_post.cxx | 95 - forms/source/xforms/submission/submission_post.hxx | 43 - forms/source/xforms/submission/submission_put.cxx | 83 - forms/source/xforms/submission/submission_put.hxx | 46 - forms/source/xforms/unohelper.cxx | 106 - forms/source/xforms/unohelper.hxx | 60 - forms/source/xforms/warnings_guard_unicode_regex.h | 51 - forms/source/xforms/xforms_services.cxx | 75 - forms/source/xforms/xforms_services.hxx | 30 - forms/source/xforms/xformsevent.cxx | 103 - forms/source/xforms/xformsevent.hxx | 69 - forms/source/xforms/xmlhelper.cxx | 150 - forms/source/xforms/xmlhelper.hxx | 54 - forms/source/xforms/xpathlib/extension.cxx | 104 - forms/source/xforms/xpathlib/extension.hxx | 42 - forms/source/xforms/xpathlib/xpathlib.cxx | 570 -- forms/source/xforms/xpathlib/xpathlib.hxx | 59 - forms/util/frm.component | 255 - forms/util/frm.dxp | 1 - forms/util/frm.xml | 569 -- forms/workben/xforms/sickness.odt | Bin 9233 -> 0 bytes forms/workben/xforms/simple_validation.odt | Bin 7184 -> 0 bytes forms/workben/xforms/vacationrequest.odt | Bin 8089 -> 0 bytes forms/workben/xforms/xforms-ubl.odt | Bin 22265 -> 0 bytes .../Linguistic-lingucomponent-hyphenator.xcu | 14 - .../Linguistic-lingucomponent-spellchecker.xcu | 14 - .../config/Linguistic-lingucomponent-thesaurus.xcu | 14 - lingucomponent/inc/makefile.mk | 47 - .../inc/pch/precompiled_lingucomponent.cxx | 31 - .../inc/pch/precompiled_lingucomponent.hxx | 35 - lingucomponent/prj/build.lst | 10 - lingucomponent/prj/d.lst | 53 - .../hyphenator/altlinuxhyph/hyphen/exports.dxp | 1 - .../source/hyphenator/altlinuxhyph/hyphen/hreg.cxx | 73 - .../altlinuxhyph/hyphen/hyphen.component | 34 - .../hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx | 977 --- .../hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx | 161 - .../hyphenator/altlinuxhyph/hyphen/makefile.mk | 99 - .../source/languageguessing/altstrfunc.cxx | 50 - .../source/languageguessing/altstrfunc.hxx | 43 - lingucomponent/source/languageguessing/guess.cxx | 139 - lingucomponent/source/languageguessing/guess.hxx | 74 - .../source/languageguessing/guesslang.component | 34 - .../source/languageguessing/guesslang.cxx | 435 -- lingucomponent/source/languageguessing/makefile.mk | 88 - .../source/languageguessing/simpleguesser.cxx | 237 - .../source/languageguessing/simpleguesser.hxx | 124 - lingucomponent/source/lingutil/lingutil.cxx | 280 - lingucomponent/source/lingutil/lingutil.hxx | 117 - lingucomponent/source/lingutil/makefile.mk | 63 - .../spellcheck/macosxspell/MacOSXSpell.component | 34 - .../source/spellcheck/macosxspell/macreg.cxx | 73 - .../source/spellcheck/macosxspell/macspellimp.cxx | 657 -- .../source/spellcheck/macosxspell/macspellimp.hxx | 155 - .../source/spellcheck/macosxspell/makefile.mk | 100 - lingucomponent/source/spellcheck/spell/exports.dxp | 1 - lingucomponent/source/spellcheck/spell/makefile.mk | 95 - .../source/spellcheck/spell/spell.component | 34 - lingucomponent/source/spellcheck/spell/sreg.cxx | 71 - .../source/spellcheck/spell/sspellimp.cxx | 700 --- .../source/spellcheck/spell/sspellimp.hxx | 143 - lingucomponent/source/thesaurus/libnth/exports.dxp | 1 - .../source/thesaurus/libnth/lnth.component | 34 - lingucomponent/source/thesaurus/libnth/makefile.mk | 112 - .../source/thesaurus/libnth/nthesdta.cxx | 116 - .../source/thesaurus/libnth/nthesdta.hxx | 88 - .../source/thesaurus/libnth/nthesimp.cxx | 794 --- .../source/thesaurus/libnth/nthesimp.hxx | 172 - lingucomponent/source/thesaurus/libnth/ntreg.cxx | 72 - package/dtd/Manifest.dtd | 58 - package/inc/ByteChucker.hxx | 70 - package/inc/ByteGrabber.hxx | 80 - package/inc/CRC32.hxx | 59 - package/inc/Deflater.hxx | 73 - package/inc/EncryptedDataHeader.hxx | 58 - package/inc/EncryptionData.hxx | 84 - package/inc/HashMaps.hxx | 66 - package/inc/Inflater.hxx | 65 - package/inc/PackageConstants.hxx | 72 - package/inc/ZipEntry.hxx | 49 - package/inc/ZipEnumeration.hxx | 46 - package/inc/ZipFile.hxx | 217 - package/inc/ZipOutputStream.hxx | 115 - package/inc/ZipPackage.hxx | 205 - package/inc/ZipPackageBuffer.hxx | 85 - package/inc/ZipPackageEntry.hxx | 106 - package/inc/ZipPackageFolder.hxx | 150 - package/inc/ZipPackageStream.hxx | 218 - package/inc/makefile.mk | 47 - package/inc/mutexholder.hxx | 133 - package/inc/packagedllapi.hxx | 15 - package/inc/pch/precompiled_package.cxx | 31 - package/inc/pch/precompiled_package.hxx | 34 - package/inc/zipfileaccess.hxx | 111 - package/prj/build.lst | 9 - package/prj/d.lst | 12 - package/qa/ofopxmlstorages/StorageTest.java | 7 - package/qa/ofopxmlstorages/StorageUnitTest.java | 158 - package/qa/ofopxmlstorages/Test01.java | 200 - package/qa/ofopxmlstorages/Test02.java | 164 - package/qa/ofopxmlstorages/Test03.java | 233 - package/qa/ofopxmlstorages/Test04.java | 308 - package/qa/ofopxmlstorages/Test05.java | 314 - package/qa/ofopxmlstorages/Test06.java | 277 - package/qa/ofopxmlstorages/Test07.java | 258 - package/qa/ofopxmlstorages/Test08.java | 261 - package/qa/ofopxmlstorages/TestHelper.java | 1098 ---- package/qa/ofopxmlstorages/makefile.mk | 91 - package/qa/storages/BorderedStream.java | 195 - package/qa/storages/RegressionTest_114358.java | 190 - package/qa/storages/RegressionTest_125919.java | 134 - package/qa/storages/RegressionTest_i26398.java | 146 - package/qa/storages/RegressionTest_i27773.java | 299 - package/qa/storages/RegressionTest_i29169.java | 369 -- package/qa/storages/RegressionTest_i29321.java | 170 - package/qa/storages/RegressionTest_i30400.java | 435 -- package/qa/storages/RegressionTest_i30677.java | 263 - package/qa/storages/RegressionTest_i35095.java | 166 - package/qa/storages/RegressionTest_i46848.java | 191 - package/qa/storages/RegressionTest_i49755.java | 272 - package/qa/storages/RegressionTest_i55821.java | 111 - package/qa/storages/RegressionTest_i59886.java | 243 - package/qa/storages/RegressionTest_i61909.java | 167 - package/qa/storages/RegressionTest_i84234.java | 134 - package/qa/storages/StorageTest.java | 7 - package/qa/storages/StorageUnitTest.java | 326 - package/qa/storages/Test01.java | 177 - package/qa/storages/Test02.java | 163 - package/qa/storages/Test03.java | 231 - package/qa/storages/Test04.java | 307 - package/qa/storages/Test05.java | 299 - package/qa/storages/Test06.java | 279 - package/qa/storages/Test07.java | 162 - package/qa/storages/Test08.java | 230 - package/qa/storages/Test09.java | 138 - package/qa/storages/Test10.java | 232 - package/qa/storages/Test11.java | 218 - package/qa/storages/Test12.java | 240 - package/qa/storages/Test13.java | 215 - package/qa/storages/Test14.java | 188 - package/qa/storages/Test15.java | 268 - package/qa/storages/Test16.java | 159 - package/qa/storages/Test17.java | 142 - package/qa/storages/Test18.java | 172 - package/qa/storages/TestHelper.java | 1661 ----- package/qa/storages/makefile.mk | 116 - package/source/manifest/Base64Codec.cxx | 208 - package/source/manifest/Base64Codec.hxx | 48 - package/source/manifest/ManifestDefines.hxx | 86 - package/source/manifest/ManifestExport.cxx | 394 -- package/source/manifest/ManifestExport.hxx | 48 - package/source/manifest/ManifestImport.cxx | 435 -- package/source/manifest/ManifestImport.hxx | 155 - package/source/manifest/ManifestReader.cxx | 143 - package/source/manifest/ManifestReader.hxx | 72 - package/source/manifest/ManifestWriter.cxx | 128 - package/source/manifest/ManifestWriter.hxx | 72 - package/source/manifest/UnoRegister.cxx | 85 - package/source/manifest/makefile.mk | 55 - package/source/xstor/disposelistener.cxx | 59 - package/source/xstor/disposelistener.hxx | 53 - package/source/xstor/makefile.mk | 83 - package/source/xstor/ocompinstream.cxx | 761 --- package/source/xstor/ocompinstream.hxx | 130 - package/source/xstor/ohierarchyholder.cxx | 361 -- package/source/xstor/ohierarchyholder.hxx | 143 - package/source/xstor/oseekinstream.cxx | 182 - package/source/xstor/oseekinstream.hxx | 70 - package/source/xstor/owriteablestream.cxx | 3623 ----------- package/source/xstor/owriteablestream.hxx | 419 -- package/source/xstor/register.cxx | 70 - package/source/xstor/selfterminatefilestream.cxx | 155 - package/source/xstor/selfterminatefilestream.hxx | 78 - package/source/xstor/switchpersistencestream.cxx | 490 -- package/source/xstor/switchpersistencestream.hxx | 122 - package/source/xstor/xfactory.cxx | 326 - package/source/xstor/xfactory.hxx | 76 - package/source/xstor/xstor.component | 35 - package/source/xstor/xstor.dxp | 1 - package/source/xstor/xstorage.cxx | 6405 -------------------- package/source/xstor/xstorage.hxx | 860 --- package/source/zipapi/ByteChucker.cxx | 115 - package/source/zipapi/ByteGrabber.cxx | 194 - package/source/zipapi/CRC32.cxx | 98 - package/source/zipapi/Deflater.cxx | 216 - package/source/zipapi/Inflater.cxx | 165 - package/source/zipapi/MemoryByteGrabber.hxx | 180 - package/source/zipapi/XUnbufferedStream.cxx | 379 -- package/source/zipapi/XUnbufferedStream.hxx | 115 - package/source/zipapi/ZipEnumeration.cxx | 56 - package/source/zipapi/ZipFile.cxx | 1100 ---- package/source/zipapi/ZipOutputStream.cxx | 452 -- package/source/zipapi/blowfishcontext.cxx | 122 - package/source/zipapi/blowfishcontext.hxx | 58 - package/source/zipapi/makefile.mk | 62 - package/source/zipapi/sha1context.cxx | 97 - package/source/zipapi/sha1context.hxx | 59 - package/source/zippackage/ContentInfo.hxx | 70 - package/source/zippackage/ZipPackage.cxx | 1890 ------ package/source/zippackage/ZipPackageBuffer.cxx | 139 - package/source/zippackage/ZipPackageEntry.cxx | 140 - package/source/zippackage/ZipPackageFolder.cxx | 856 --- .../zippackage/ZipPackageFolderEnumeration.cxx | 82 - .../zippackage/ZipPackageFolderEnumeration.hxx | 67 - package/source/zippackage/ZipPackageSink.cxx | 51 - package/source/zippackage/ZipPackageSink.hxx | 51 - package/source/zippackage/ZipPackageStream.cxx | 946 --- package/source/zippackage/makefile.mk | 58 - package/source/zippackage/wrapstreamforshare.cxx | 182 - package/source/zippackage/wrapstreamforshare.hxx | 75 - package/source/zippackage/zipfileaccess.cxx | 493 -- package/util/exports.dxp | 1 - package/util/makefile.mk | 89 - package/util/package.pmk | 2 - package/util/package2.component | 44 - setup_native/inc/setup_native/qswin32.h | 52 - setup_native/prj/build.lst | 20 - setup_native/prj/d.lst | 54 - setup_native/scripts/admin.pl | 1443 ----- setup_native/scripts/deregister_extensions | 78 - setup_native/scripts/downloadscript.sh | 87 - setup_native/scripts/fake-db.spec | 38 - setup_native/scripts/install_create.pl | 44 - setup_native/scripts/install_linux.sh | 301 - setup_native/scripts/install_solaris.sh | 364 -- setup_native/scripts/javaloader.sh | 498 -- setup_native/scripts/langpackscript.sh | 153 - setup_native/scripts/linuxpatchscript.sh | 84 - setup_native/scripts/mac_install.script | 10 - setup_native/scripts/makefile.mk | 99 - .../scripts/osx_install_languagepack.applescript | 142 - setup_native/scripts/osx_install_patch.applescript | 139 - setup_native/scripts/register_extensions | 84 - setup_native/scripts/source/getuid.c | 137 - setup_native/scripts/source/makefile.mk | 90 - setup_native/scripts/uninstall_linux.sh | 55 - setup_native/scripts/uninstall_solaris.sh | 57 - setup_native/scripts/unpack_update.sh | 33 - setup_native/scripts/update.sh | 195 - setup_native/scripts/userland.txt | 28 - setup_native/source/java/javaversion.dat | 57 - setup_native/source/java/javaversion2.dat | 57 - setup_native/source/linux/root3.dat | 4 - setup_native/source/linux/root4.dat | 4 - setup_native/source/linux/root5.dat | 4 - setup_native/source/mac/Info.plist.langpack | 36 - setup_native/source/mac/macinstall.ulf | 68 - setup_native/source/mac/makefile.mk | 57 - setup_native/source/mac/ooo/DS_Store | Bin 15364 -> 0 bytes setup_native/source/mac/ooo/DS_Store_Langpack | Bin 12292 -> 0 bytes setup_native/source/mac/ooo/osxdndinstall.png | Bin 34637 -> 0 bytes .../source/mac/ooo/osxdndinstall_nologo.png | Bin 34637 -> 0 bytes setup_native/source/mac/ooo3_installer.icns | Bin 42710 -> 0 bytes .../source/opensolaris/bundledextensions/README | 80 - .../source/opensolaris/bundledextensions/installed | 1 - .../bundledextensions/ooo_bundled_extensions.xml | 60 - .../bundledextensions/svc-ooo_bundled_extensions | 108 - setup_native/source/packinfo/finals_instsetoo.txt | 14 - setup_native/source/packinfo/linuxcopyrightfile | 2 - setup_native/source/packinfo/openoffice.pcp | Bin 6144 -> 0 bytes .../source/packinfo/openofficelanguagepack.pcp | Bin 6144 -> 0 bytes setup_native/source/packinfo/package.txt | 1 - setup_native/source/packinfo/package_names.txt | 74 - setup_native/source/packinfo/package_names_ext.txt | 21 - .../source/packinfo/packinfo_accessories.txt | 73 - setup_native/source/packinfo/packinfo_brand.txt | 139 - .../source/packinfo/packinfo_extensions.txt | 348 -- setup_native/source/packinfo/packinfo_office.txt | 1084 ---- .../source/packinfo/packinfo_office_help.txt | 36 - .../source/packinfo/packinfo_office_lang.txt | 281 - setup_native/source/packinfo/packinfo_sdkoo.txt | 41 - setup_native/source/packinfo/packinfo_ure.txt | 52 - setup_native/source/packinfo/private1copyrightfile | 2 - setup_native/source/packinfo/shellscripts.txt | 11 - .../source/packinfo/shellscripts_brand.txt | 69 - .../source/packinfo/shellscripts_core01.txt | 69 - .../source/packinfo/shellscripts_extensions.txt | 144 - .../source/packinfo/shellscripts_module.txt | 33 - setup_native/source/packinfo/shellscripts_root.txt | 11 - setup_native/source/packinfo/solariscopyrightfile | 2 - .../source/packinfo/spellchecker_selection.txt | 54 - setup_native/source/packinfo/ure.pcp | Bin 6144 -> 0 bytes setup_native/source/ulfconv/makefile.mk | 54 - setup_native/source/ulfconv/ulfconv.cxx | 361 -- .../win32/customactions/indexingfilter/exports.dxp | 3 - .../win32/customactions/indexingfilter/makefile.mk | 68 - .../indexingfilter/restartindexingservice.cxx | 210 - .../win32/customactions/javafilter/exports.dxp | 2 - .../win32/customactions/javafilter/jfregca.cxx | 332 - .../win32/customactions/javafilter/makefile.mk | 70 - .../checkrunningofficelanguagepack.cxx | 221 - .../win32/customactions/languagepacks/exports.dxp | 6 - .../languagepacks/lngpckinsthelper.cxx | 205 - .../win32/customactions/languagepacks/makefile.mk | 87 - .../customactions/languagepacks/respintest.cxx | 215 - .../source/win32/customactions/patch/exports.dxp | 11 - .../source/win32/customactions/patch/makefile.mk | 88 - .../win32/customactions/patch/swappatchfiles.cxx | 845 --- .../win32/customactions/quickstarter/exports.dxp | 3 - .../win32/customactions/quickstarter/makefile.mk | 93 - .../win32/customactions/quickstarter/qslnkmsi.dxp | 2 - .../customactions/quickstarter/quickstarter.cxx | 223 - .../customactions/quickstarter/quickstarter.hxx | 21 - .../quickstarter/remove_quickstart_link.cxx | 63 - .../win32/customactions/quickstarter/sdqsmsi.dxp | 2 - .../quickstarter/shutdown_quickstart.cxx | 81 - .../source/win32/customactions/rebase/makefile.mk | 82 - .../source/win32/customactions/rebase/rebase.cxx | 226 - .../source/win32/customactions/rebase/rebase.dxp | 1 - .../win32/customactions/reg4allmsdoc/exports.dxp | 4 - .../win32/customactions/reg4allmsdoc/makefile.mk | 76 - .../customactions/reg4allmsdoc/reg4allmsi.cxx | 669 -- .../win32/customactions/reg4msdoc/constants.hxx | 42 - .../win32/customactions/reg4msdoc/exports.dxp | 3 - .../win32/customactions/reg4msdoc/makefile.mk | 89 - .../win32/customactions/reg4msdoc/msihelper.cxx | 105 - .../win32/customactions/reg4msdoc/msihelper.hxx | 187 - .../win32/customactions/reg4msdoc/reg4msdocmsi.cxx | 190 - .../win32/customactions/reg4msdoc/register.cxx | 342 -- .../win32/customactions/reg4msdoc/register.hxx | 85 - .../win32/customactions/reg4msdoc/registrar.cxx | 808 --- .../win32/customactions/reg4msdoc/registrar.hxx | 104 - .../reg4msdoc/registrationcontextinformation.cxx | 388 -- .../reg4msdoc/registrationcontextinformation.hxx | 175 - .../win32/customactions/reg4msdoc/registry.cxx | 245 - .../win32/customactions/reg4msdoc/registry.hxx | 337 - .../customactions/reg4msdoc/registryexception.cxx | 88 - .../customactions/reg4msdoc/registryexception.hxx | 107 - .../customactions/reg4msdoc/registryvalueimpl.cxx | 192 - .../customactions/reg4msdoc/registryvalueimpl.hxx | 111 - .../win32/customactions/reg4msdoc/registryw9x.cxx | 538 -- .../win32/customactions/reg4msdoc/registryw9x.hxx | 201 - .../win32/customactions/reg4msdoc/registrywnt.cxx | 607 -- .../win32/customactions/reg4msdoc/registrywnt.hxx | 205 - .../customactions/reg4msdoc/stringconverter.cxx | 72 - .../customactions/reg4msdoc/stringconverter.hxx | 44 - .../customactions/reg4msdoc/userregistrar.cxx | 139 - .../customactions/reg4msdoc/userregistrar.hxx | 46 - .../customactions/reg4msdoc/windowsregistry.cxx | 58 - .../customactions/reg4msdoc/windowsregistry.hxx | 43 - .../source/win32/customactions/reg64/exports.dxp | 2 - .../source/win32/customactions/reg64/makefile.mk | 76 - .../source/win32/customactions/reg64/reg64.cxx | 465 -- .../win32/customactions/regactivex/exports.dxp | 2 - .../win32/customactions/regactivex/makefile.mk | 69 - .../win32/customactions/regactivex/regactivex.cxx | 386 -- .../customactions/regpatchactivex/exports.dxp | 1 - .../customactions/regpatchactivex/makefile.mk | 87 - .../regpatchactivex/regpatchactivex.cxx | 124 - .../source/win32/customactions/sellang/exports.dxp | 1 - .../source/win32/customactions/sellang/makefile.mk | 78 - .../source/win32/customactions/sellang/sellang.cxx | 294 - .../shellextensions/checkdirectory.cxx | 120 - .../customactions/shellextensions/checkpatches.cxx | 116 - .../shellextensions/checkrunningoffice.cxx | 293 - .../shellextensions/completeinstallpath.cxx | 183 - .../shellextensions/copyeditiondata.cxx | 133 - .../shellextensions/copyextensiondata.cxx | 125 - .../customactions/shellextensions/dotnetcheck.cxx | 184 - .../customactions/shellextensions/exports.dxp | 23 - .../customactions/shellextensions/iconcache.cxx | 113 - .../customactions/shellextensions/layerlinks.cxx | 236 - .../customactions/shellextensions/makefile.mk | 98 - .../shellextensions/migrateinstallpath.cxx | 120 - .../shellextensions/postuninstall.cxx | 157 - .../shellextensions/registerextensions.cxx | 284 - .../shellextensions/setadmininstall.cxx | 69 - .../shellextensions/shellextensions.cxx | 216 - .../shellextensions/startmenuicon.cxx | 134 - .../customactions/shellextensions/upgrade.cxx | 207 - .../customactions/shellextensions/vistaspecial.cxx | 245 - .../win32/customactions/thesaurus/exports.dxp | 1 - .../win32/customactions/thesaurus/makefile.mk | 77 - .../win32/customactions/thesaurus/thesaurus.cxx | 214 - .../win32/customactions/tools/checkversion.cxx | 151 - .../source/win32/customactions/tools/exports.dxp | 1 - .../source/win32/customactions/tools/makefile.mk | 72 - .../source/win32/customactions/tools/seterror.cxx | 99 - .../source/win32/customactions/tools/seterror.hxx | 56 - setup_native/source/win32/desktophelper.txt | 1 - setup_native/source/win32/get_retval.bat | 3 - setup_native/source/win32/msi-encodinglist.txt | 150 - .../source/win32/nsis/downloadtemplate.nsi | 443 -- setup_native/source/win32/nsis/ooobanner.bmp | Bin 6274 -> 0 bytes setup_native/source/win32/nsis/ooobitmap.bmp | Bin 52242 -> 0 bytes setup_native/source/win32/nsis/ooosdkbanner.bmp | Bin 7106 -> 0 bytes setup_native/source/win32/nsis/ooosdkbitmap.bmp | Bin 52242 -> 0 bytes setup_native/source/win32/nsis/ooosetup.ico | Bin 26918 -> 0 bytes setup_native/source/win32/nsis/urebanner.bmp | Bin 7106 -> 0 bytes setup_native/source/win32/nsis/urebitmap.bmp | Bin 52242 -> 0 bytes setup_native/source/win32/patchlist.txt | 2 - .../tests/opensolaris/bundledextensions/send_ooo | 32 - wizards/AllLangResTarget_cal.mk | 46 - wizards/AllLangResTarget_dbw.mk | 46 - wizards/AllLangResTarget_eur.mk | 46 - wizards/AllLangResTarget_imp.mk | 46 - wizards/AllLangResTarget_tpl.mk | 46 - wizards/AllLangResTarget_wwz.mk | 46 - wizards/AllLangResTarget_wzi.mk | 48 - wizards/Jar_agenda.mk | 63 - wizards/Jar_commonwizards.mk | 135 - wizards/Jar_fax.mk | 61 - wizards/Jar_form.mk | 63 - wizards/Jar_letter.mk | 64 - wizards/Jar_query.mk | 56 - wizards/Jar_report.mk | 67 - wizards/Jar_reportbuilder.mk | 67 - wizards/Jar_table.mk | 62 - wizards/Jar_web.mk | 107 - wizards/Makefile | 39 - wizards/Module_wizards.mk | 70 - wizards/Zip_depot.mk | 54 - wizards/Zip_euro.mk | 46 - wizards/Zip_form.mk | 43 - wizards/Zip_gimmicks.mk | 43 - wizards/Zip_import.mk | 42 - wizards/Zip_launcher.mk | 34 - wizards/Zip_schedule.mk | 45 - wizards/Zip_share.mk | 36 - wizards/Zip_standard.mk | 37 - wizards/Zip_template.mk | 42 - wizards/Zip_tools.mk | 43 - wizards/Zip_tutorials.mk | 45 - wizards/Zip_usr.mk | 36 - wizards/Zip_web.mk | 41 - wizards/com/sun/star/wizards/RemoteFaxWizard | 7 - wizards/com/sun/star/wizards/RemoteLetterWizard | 7 - wizards/com/sun/star/wizards/__init__.py | 0 .../sun/star/wizards/agenda/AgendaTemplate.java | 1959 ------ .../star/wizards/agenda/AgendaWizardDialog.java | 385 -- .../wizards/agenda/AgendaWizardDialogConst.java | 109 - .../wizards/agenda/AgendaWizardDialogImpl.java | 596 -- .../agenda/AgendaWizardDialogResources.java | 221 - wizards/com/sun/star/wizards/agenda/CGAgenda.java | 84 - wizards/com/sun/star/wizards/agenda/CGTopic.java | 88 - .../com/sun/star/wizards/agenda/CallWizard.java | 225 - wizards/com/sun/star/wizards/agenda/MANIFEST.MF | 2 - .../sun/star/wizards/agenda/TemplateConsts.java | 146 - .../com/sun/star/wizards/agenda/TopicsControl.java | 1322 ---- .../com/sun/star/wizards/agenda/agenda.component | 35 - wizards/com/sun/star/wizards/agenda/makefile.mk | 78 - .../com/sun/star/wizards/common/ConfigGroup.java | 183 - wizards/com/sun/star/wizards/common/ConfigGroup.py | 38 - .../com/sun/star/wizards/common/ConfigNode.java | 53 - wizards/com/sun/star/wizards/common/ConfigNode.py | 15 - wizards/com/sun/star/wizards/common/ConfigSet.java | 452 -- .../com/sun/star/wizards/common/Configuration.java | 454 -- .../com/sun/star/wizards/common/Configuration.py | 213 - .../com/sun/star/wizards/common/DebugHelper.java | 58 - wizards/com/sun/star/wizards/common/DebugHelper.py | 10 - wizards/com/sun/star/wizards/common/Desktop.java | 501 -- wizards/com/sun/star/wizards/common/Desktop.py | 280 - .../com/sun/star/wizards/common/FileAccess.java | 1188 ---- wizards/com/sun/star/wizards/common/FileAccess.py | 771 --- wizards/com/sun/star/wizards/common/HelpIds.java | 1047 ---- wizards/com/sun/star/wizards/common/HelpIds.py | 1012 ---- wizards/com/sun/star/wizards/common/Helper.java | 433 -- wizards/com/sun/star/wizards/common/Helper.py | 186 - wizards/com/sun/star/wizards/common/IRenderer.java | 40 - wizards/com/sun/star/wizards/common/Indexable.java | 44 - .../star/wizards/common/InvalidQueryException.java | 40 - wizards/com/sun/star/wizards/common/JavaTools.java | 776 --- wizards/com/sun/star/wizards/common/MANIFEST.MF | 0 .../star/wizards/common/NamedValueCollection.java | 90 - .../star/wizards/common/NoValidPathException.java | 44 - .../star/wizards/common/NoValidPathException.py | 10 - .../sun/star/wizards/common/NumberFormatter.java | 333 - .../com/sun/star/wizards/common/NumberFormatter.py | 231 - .../sun/star/wizards/common/NumericalHelper.java | 1624 ----- .../com/sun/star/wizards/common/Properties.java | 126 - .../com/sun/star/wizards/common/PropertyNames.java | 68 - .../com/sun/star/wizards/common/PropertyNames.py | 15 - .../sun/star/wizards/common/PropertySetHelper.java | 396 -- .../sun/star/wizards/common/PropertySetHelper.py | 250 - wizards/com/sun/star/wizards/common/Resource.java | 140 - .../com/sun/star/wizards/common/Resource.java.orig | 140 - wizards/com/sun/star/wizards/common/Resource.py | 69 - .../com/sun/star/wizards/common/SystemDialog.java | 423 -- .../com/sun/star/wizards/common/SystemDialog.py | 236 - .../wizards/common/TerminateWizardException.java | 43 - wizards/com/sun/star/wizards/common/UCB.java | 263 - wizards/com/sun/star/wizards/common/XMLHelper.java | 74 - .../com/sun/star/wizards/common/XMLProvider.java | 46 - wizards/com/sun/star/wizards/common/__init__.py | 1 - wizards/com/sun/star/wizards/common/delzip | 0 wizards/com/sun/star/wizards/common/prova.py | 7 - .../com/sun/star/wizards/db/BlindtextCreator.java | 113 - .../com/sun/star/wizards/db/ColumnPropertySet.java | 214 - .../com/sun/star/wizards/db/CommandMetaData.java | 738 --- wizards/com/sun/star/wizards/db/CommandName.java | 266 - wizards/com/sun/star/wizards/db/DBMetaData.java | 1105 ---- .../sun/star/wizards/db/DatabaseObjectWizard.java | 76 - wizards/com/sun/star/wizards/db/FieldColumn.java | 470 -- wizards/com/sun/star/wizards/db/MANIFEST.MF | 0 wizards/com/sun/star/wizards/db/QueryMetaData.java | 301 - wizards/com/sun/star/wizards/db/RecordParser.java | 307 - .../sun/star/wizards/db/RelationController.java | 162 - .../com/sun/star/wizards/db/SQLQueryComposer.java | 470 -- .../com/sun/star/wizards/db/TableDescriptor.java | 862 --- wizards/com/sun/star/wizards/db/TypeInspector.java | 459 -- wizards/com/sun/star/wizards/document/Control.java | 359 -- .../sun/star/wizards/document/DatabaseControl.java | 268 - .../com/sun/star/wizards/document/FormHandler.java | 599 -- .../com/sun/star/wizards/document/GridControl.java | 93 - .../sun/star/wizards/document/OfficeDocument.java | 459 -- .../sun/star/wizards/document/OfficeDocument.py | 293 - wizards/com/sun/star/wizards/document/Shape.java | 142 - .../star/wizards/document/TimeStampControl.java | 169 - wizards/com/sun/star/wizards/document/__init__.py | 0 wizards/com/sun/star/wizards/fax/CGFax.java | 60 - wizards/com/sun/star/wizards/fax/CGFax.py | 31 - wizards/com/sun/star/wizards/fax/CGFaxWizard.java | 38 - wizards/com/sun/star/wizards/fax/CGFaxWizard.py | 10 - wizards/com/sun/star/wizards/fax/CallWizard.java | 241 - wizards/com/sun/star/wizards/fax/CallWizard.py | 156 - wizards/com/sun/star/wizards/fax/FaxDocument.java | 211 - wizards/com/sun/star/wizards/fax/FaxDocument.py | 131 - .../com/sun/star/wizards/fax/FaxWizardDialog.java | 628 -- .../com/sun/star/wizards/fax/FaxWizardDialog.py | 645 -- .../sun/star/wizards/fax/FaxWizardDialogConst.java | 116 - .../sun/star/wizards/fax/FaxWizardDialogConst.py | 83 - .../sun/star/wizards/fax/FaxWizardDialogImpl.java | 872 --- .../sun/star/wizards/fax/FaxWizardDialogImpl.py | 697 --- .../star/wizards/fax/FaxWizardDialogResources.java | 182 - .../star/wizards/fax/FaxWizardDialogResources.py | 141 - wizards/com/sun/star/wizards/fax/MANIFEST.MF | 2 - wizards/com/sun/star/wizards/fax/__init__.py | 1 - wizards/com/sun/star/wizards/fax/fax.component | 35 - wizards/com/sun/star/wizards/fax/makefile.mk | 69 - .../com/sun/star/wizards/form/CallFormWizard.java | 207 - .../com/sun/star/wizards/form/DataEntrySetter.java | 148 - wizards/com/sun/star/wizards/form/FieldLinker.java | 307 - wizards/com/sun/star/wizards/form/Finalizer.java | 140 - .../sun/star/wizards/form/FormConfiguration.java | 242 - .../sun/star/wizards/form/FormControlArranger.java | 719 --- .../com/sun/star/wizards/form/FormDocument.java | 594 -- wizards/com/sun/star/wizards/form/FormWizard.java | 480 -- wizards/com/sun/star/wizards/form/MANIFEST.MF | 2 - .../com/sun/star/wizards/form/StyleApplier.java | 495 -- .../sun/star/wizards/form/UIControlArranger.java | 496 -- wizards/com/sun/star/wizards/form/form.component | 35 - wizards/com/sun/star/wizards/form/makefile.mk | 70 - wizards/com/sun/star/wizards/letter/CGLetter.java | 66 - wizards/com/sun/star/wizards/letter/CGLetter.py | 37 - .../sun/star/wizards/letter/CGLetterWizard.java | 39 - .../com/sun/star/wizards/letter/CGLetterWizard.py | 10 - .../wizards/letter/CGPaperElementLocation.java | 40 - .../star/wizards/letter/CGPaperElementLocation.py | 10 - .../com/sun/star/wizards/letter/CallWizard.java | 241 - .../sun/star/wizards/letter/LetterDocument.java | 329 - .../com/sun/star/wizards/letter/LetterDocument.py | 261 - .../star/wizards/letter/LetterWizardDialog.java | 913 --- .../sun/star/wizards/letter/LetterWizardDialog.py | 1141 ---- .../wizards/letter/LetterWizardDialogConst.java | 93 - .../star/wizards/letter/LetterWizardDialogConst.py | 60 - .../wizards/letter/LetterWizardDialogEvents.java | 89 - .../wizards/letter/LetterWizardDialogImpl.java | 1491 ----- .../star/wizards/letter/LetterWizardDialogImpl.py | 1267 ---- .../letter/LetterWizardDialogResources.java | 207 - .../wizards/letter/LetterWizardDialogResources.py | 219 - .../com/sun/star/wizards/letter/LocaleCodes.java | 202 - wizards/com/sun/star/wizards/letter/LocaleCodes.py | 154 - wizards/com/sun/star/wizards/letter/MANIFEST.MF | 2 - wizards/com/sun/star/wizards/letter/__init__.py | 0 .../com/sun/star/wizards/letter/letter.component | 35 - wizards/com/sun/star/wizards/letter/makefile.mk | 72 - wizards/com/sun/star/wizards/makefile.mk | 147 - .../sun/star/wizards/query/CallQueryWizard.java | 217 - wizards/com/sun/star/wizards/query/Finalizer.java | 195 - wizards/com/sun/star/wizards/query/MANIFEST.MF | 2 - .../com/sun/star/wizards/query/QuerySummary.java | 238 - .../com/sun/star/wizards/query/QueryWizard.java | 570 -- wizards/com/sun/star/wizards/query/makefile.mk | 64 - wizards/com/sun/star/wizards/query/query.component | 35 - .../sun/star/wizards/report/CallReportWizard.java | 265 - wizards/com/sun/star/wizards/report/DBColumn.java | 482 -- .../com/sun/star/wizards/report/Dataimport.java | 223 - .../sun/star/wizards/report/GroupFieldHandler.java | 197 - .../wizards/report/IReportBuilderLayouter.java | 127 - .../report/IReportDefinitionReadAccess.java | 61 - .../sun/star/wizards/report/IReportDocument.java | 268 - wizards/com/sun/star/wizards/report/MANIFEST.MF | 2 - .../com/sun/star/wizards/report/RecordTable.java | 99 - .../sun/star/wizards/report/ReportFinalizer.java | 293 - .../wizards/report/ReportImplementationHelper.java | 68 - .../sun/star/wizards/report/ReportLayouter.java | 341 -- .../star/wizards/report/ReportTextDocument.java | 790 --- .../wizards/report/ReportTextImplementation.java | 745 --- .../com/sun/star/wizards/report/ReportWizard.java | 773 --- wizards/com/sun/star/wizards/report/delzip | 0 .../com/sun/star/wizards/report/report.component | 35 - .../com/sun/star/wizards/reportbuilder/Manifest.mf | 2 - .../reportbuilder/ReportBuilderImplementation.java | 753 --- .../reportbuilder/layout/ColumnarSingleColumn.java | 105 - .../reportbuilder/layout/ColumnarThreeColumns.java | 61 - .../reportbuilder/layout/ColumnarTwoColumns.java | 137 - .../reportbuilder/layout/DesignTemplate.java | 334 - .../reportbuilder/layout/InBlocksLabelsAbove.java | 166 - .../reportbuilder/layout/InBlocksLabelsLeft.java | 133 - .../reportbuilder/layout/LayoutConstants.java | 52 - .../layout/ReportBuilderLayouter.java | 1711 ------ .../reportbuilder/layout/SectionEmptyObject.java | 54 - .../wizards/reportbuilder/layout/SectionLabel.java | 73 - .../reportbuilder/layout/SectionObject.java | 85 - .../reportbuilder/layout/SectionTextField.java | 66 - .../star/wizards/reportbuilder/layout/Tabular.java | 152 - .../star/wizards/reportbuilder/layout/makefile.mk | 65 - wizards/com/sun/star/wizards/table/CGCategory.java | 87 - wizards/com/sun/star/wizards/table/CGTable.java | 96 - .../sun/star/wizards/table/CallTableWizard.java | 214 - .../sun/star/wizards/table/FieldDescription.java | 177 - .../com/sun/star/wizards/table/FieldFormatter.java | 433 -- wizards/com/sun/star/wizards/table/Finalizer.java | 365 -- wizards/com/sun/star/wizards/table/MANIFEST.MF | 2 - .../sun/star/wizards/table/PrimaryKeyHandler.java | 461 -- .../sun/star/wizards/table/ScenarioSelector.java | 384 -- .../com/sun/star/wizards/table/TableWizard.java | 438 -- wizards/com/sun/star/wizards/table/makefile.mk | 68 - wizards/com/sun/star/wizards/table/table.component | 35 - .../com/sun/star/wizards/text/TextDocument.java | 483 -- wizards/com/sun/star/wizards/text/TextDocument.py | 285 - .../sun/star/wizards/text/TextFieldHandler.java | 348 -- .../com/sun/star/wizards/text/TextFieldHandler.py | 190 - .../sun/star/wizards/text/TextFrameHandler.java | 50 - .../sun/star/wizards/text/TextSectionHandler.java | 272 - .../sun/star/wizards/text/TextSectionHandler.py | 133 - .../sun/star/wizards/text/TextStyleHandler.java | 115 - .../sun/star/wizards/text/TextTableHandler.java | 252 - wizards/com/sun/star/wizards/text/ViewHandler.java | 115 - wizards/com/sun/star/wizards/text/ViewHandler.py | 37 - wizards/com/sun/star/wizards/text/__init__.py | 0 .../sun/star/wizards/ui/AggregateComponent.java | 607 -- wizards/com/sun/star/wizards/ui/ButtonList.java | 907 --- .../sun/star/wizards/ui/CommandFieldSelection.java | 474 -- .../com/sun/star/wizards/ui/ControlScroller.java | 506 -- .../star/wizards/ui/DBLimitedFieldSelection.java | 156 - .../com/sun/star/wizards/ui/DocumentPreview.java | 187 - .../com/sun/star/wizards/ui/FieldSelection.java | 697 --- .../com/sun/star/wizards/ui/FilterComponent.java | 960 --- wizards/com/sun/star/wizards/ui/ImageList.java | 1135 ---- wizards/com/sun/star/wizards/ui/PathSelection.java | 189 - wizards/com/sun/star/wizards/ui/PathSelection.py | 121 - wizards/com/sun/star/wizards/ui/PeerConfig.java | 262 - .../com/sun/star/wizards/ui/SortingComponent.java | 375 -- .../com/sun/star/wizards/ui/TitlesComponent.java | 249 - wizards/com/sun/star/wizards/ui/UIConsts.java | 78 - wizards/com/sun/star/wizards/ui/UIConsts.py | 53 - wizards/com/sun/star/wizards/ui/UnoDialog.java | 1139 ---- wizards/com/sun/star/wizards/ui/UnoDialog.py | 552 -- wizards/com/sun/star/wizards/ui/UnoDialog2.java | 383 -- wizards/com/sun/star/wizards/ui/UnoDialog2.py | 259 - wizards/com/sun/star/wizards/ui/WizardDialog.java | 811 --- wizards/com/sun/star/wizards/ui/WizardDialog.py | 499 -- .../star/wizards/ui/XCommandSelectionListener.java | 43 - wizards/com/sun/star/wizards/ui/XCompletion.java | 39 - .../star/wizards/ui/XFieldSelectionListener.java | 53 - .../star/wizards/ui/XPathSelectionListener.java | 34 - .../sun/star/wizards/ui/XPathSelectionListener.py | 7 - wizards/com/sun/star/wizards/ui/__init__.py | 1 - .../star/wizards/ui/event/AbstractListener.java | 134 - .../sun/star/wizards/ui/event/CommonListener.java | 167 - .../sun/star/wizards/ui/event/CommonListener.py | 85 - .../com/sun/star/wizards/ui/event/DataAware.java | 366 -- wizards/com/sun/star/wizards/ui/event/DataAware.py | 127 - .../sun/star/wizards/ui/event/DataAwareFields.java | 507 -- .../com/sun/star/wizards/ui/event/EventNames.java | 52 - .../sun/star/wizards/ui/event/ListModelBinder.java | 210 - .../star/wizards/ui/event/MethodInvocation.java | 106 - .../sun/star/wizards/ui/event/RadioDataAware.java | 101 - .../sun/star/wizards/ui/event/RadioDataAware.py | 39 - .../sun/star/wizards/ui/event/SimpleDataAware.java | 84 - wizards/com/sun/star/wizards/ui/event/Task.java | 204 - .../com/sun/star/wizards/ui/event/TaskEvent.java | 65 - .../sun/star/wizards/ui/event/TaskListener.java | 51 - .../sun/star/wizards/ui/event/UnoDataAware.java | 266 - .../com/sun/star/wizards/ui/event/UnoDataAware.py | 74 - wizards/com/sun/star/wizards/ui/event/__init__.py | 0 .../sun/star/wizards/web/AbstractErrorHandler.java | 238 - .../sun/star/wizards/web/BackgroundsDialog.java | 291 - wizards/com/sun/star/wizards/web/CallWizard.java | 296 - wizards/com/sun/star/wizards/web/ErrorHandler.java | 117 - .../sun/star/wizards/web/ExtensionVerifier.java | 63 - wizards/com/sun/star/wizards/web/FTPDialog.java | 750 --- .../sun/star/wizards/web/FTPDialogResources.java | 98 - wizards/com/sun/star/wizards/web/IconsDialog.java | 209 - .../com/sun/star/wizards/web/ImageListDialog.java | 284 - .../com/sun/star/wizards/web/LogTaskListener.java | 99 - wizards/com/sun/star/wizards/web/MANIFEST.MF | 2 - wizards/com/sun/star/wizards/web/Process.java | 843 --- .../sun/star/wizards/web/ProcessErrorHandler.java | 92 - .../com/sun/star/wizards/web/ProcessErrors.java | 48 - .../star/wizards/web/ProcessStatusRenderer.java | 68 - wizards/com/sun/star/wizards/web/StatusDialog.java | 306 - wizards/com/sun/star/wizards/web/StylePreview.java | 155 - wizards/com/sun/star/wizards/web/TOCPreview.java | 121 - wizards/com/sun/star/wizards/web/WWD_Events.java | 1306 ---- wizards/com/sun/star/wizards/web/WWD_General.java | 394 -- wizards/com/sun/star/wizards/web/WWD_Startup.java | 985 --- wizards/com/sun/star/wizards/web/WWHID.java | 186 - wizards/com/sun/star/wizards/web/WebWizard.java | 72 - .../com/sun/star/wizards/web/WebWizardConst.java | 73 - .../com/sun/star/wizards/web/WebWizardDialog.java | 932 --- .../star/wizards/web/WebWizardDialogResources.java | 349 -- .../com/sun/star/wizards/web/data/CGArgument.java | 35 - .../com/sun/star/wizards/web/data/CGContent.java | 68 - .../com/sun/star/wizards/web/data/CGDesign.java | 91 - .../com/sun/star/wizards/web/data/CGDocument.java | 454 -- .../com/sun/star/wizards/web/data/CGExporter.java | 58 - .../com/sun/star/wizards/web/data/CGFilter.java | 35 - .../sun/star/wizards/web/data/CGGeneralInfo.java | 92 - .../com/sun/star/wizards/web/data/CGIconSet.java | 35 - wizards/com/sun/star/wizards/web/data/CGImage.java | 45 - .../com/sun/star/wizards/web/data/CGLayout.java | 87 - .../com/sun/star/wizards/web/data/CGPublish.java | 95 - .../com/sun/star/wizards/web/data/CGSession.java | 110 - .../sun/star/wizards/web/data/CGSessionName.java | 38 - .../com/sun/star/wizards/web/data/CGSettings.java | 212 - wizards/com/sun/star/wizards/web/data/CGStyle.java | 56 - .../sun/star/wizards/web/data/ConfigSetItem.java | 55 - .../sun/star/wizards/web/data/TypeDetection.java | 79 - wizards/com/sun/star/wizards/web/data/makefile.mk | 70 - .../star/wizards/web/export/AbstractExporter.java | 192 - .../wizards/web/export/ConfiguredExporter.java | 92 - .../sun/star/wizards/web/export/CopyExporter.java | 83 - .../com/sun/star/wizards/web/export/Exporter.java | 61 - .../star/wizards/web/export/FilterExporter.java | 89 - .../wizards/web/export/ImpressHTMLExporter.java | 106 - .../com/sun/star/wizards/web/export/makefile.mk | 59 - wizards/com/sun/star/wizards/web/makefile.mk | 93 - .../com/sun/star/wizards/web/status/ErrorLog.java | 64 - .../sun/star/wizards/web/status/ErrorReporter.java | 41 - .../star/wizards/web/status/LogTaskListener.java | 82 - wizards/com/sun/star/wizards/web/status/Task.java | 191 - .../com/sun/star/wizards/web/status/TaskEvent.java | 66 - .../sun/star/wizards/web/status/TaskListener.java | 53 - wizards/com/sun/star/wizards/web/web.component | 35 - wizards/prj/build.lst | 2 - wizards/prj/d.lst | 0 wizards/prj/makefile.mk | 40 - wizards/source/config/delzip | 0 wizards/source/config/dialog.xlc | 5 - wizards/source/config/script.xlc | 5 - wizards/source/configshare/delzip | 0 wizards/source/configshare/dialog.xlc | 13 - wizards/source/configshare/script.xlc | 13 - wizards/source/depot/CommonLang.xba | 351 -- wizards/source/depot/Currency.xba | 178 - wizards/source/depot/Depot.xba | 500 -- wizards/source/depot/Dialog2.xdl | 36 - wizards/source/depot/Dialog3.xdl | 45 - wizards/source/depot/Dialog4.xdl | 17 - wizards/source/depot/Internet.xba | 339 -- wizards/source/depot/Lang_de.xba | 158 - wizards/source/depot/Lang_en.xba | 158 - wizards/source/depot/Lang_es.xba | 158 - wizards/source/depot/Lang_fr.xba | 158 - wizards/source/depot/Lang_it.xba | 158 - wizards/source/depot/Lang_ja.xba | 158 - wizards/source/depot/Lang_ko.xba | 158 - wizards/source/depot/Lang_sv.xba | 157 - wizards/source/depot/Lang_tw.xba | 158 - wizards/source/depot/Lang_zh.xba | 158 - wizards/source/depot/dialog.xlb | 7 - wizards/source/depot/script.xlb | 19 - wizards/source/depot/tools.xba | 200 - wizards/source/euro/AutoPilotRun.xba | 414 -- wizards/source/euro/Common.xba | 272 - wizards/source/euro/ConvertRun.xba | 317 - wizards/source/euro/DlgConvert.xdl | 77 - wizards/source/euro/DlgPassword.xdl | 15 - wizards/source/euro/Hard.xba | 229 - wizards/source/euro/Init.xba | 604 -- wizards/source/euro/Protect.xba | 175 - wizards/source/euro/Soft.xba | 239 - wizards/source/euro/Writer.xba | 72 - wizards/source/euro/delzip | 0 wizards/source/euro/dialog.xlb | 6 - wizards/source/euro/euro.src | 476 -- wizards/source/euro/script.xlb | 12 - wizards/source/formwizard/DBMeta.xba | 330 - wizards/source/formwizard/DlgFormDB.xdl | 102 - wizards/source/formwizard/FormWizard.xba | 427 -- wizards/source/formwizard/Language.xba | 285 - wizards/source/formwizard/Layouter.xba | 380 -- wizards/source/formwizard/dbwizres.src | 3518 ----------- wizards/source/formwizard/delzip | 0 wizards/source/formwizard/develop.xba | 533 -- wizards/source/formwizard/dialog.xlb | 5 - wizards/source/formwizard/script.xlb | 10 - wizards/source/formwizard/tools.xba | 349 -- wizards/source/gimmicks/AutoText.xba | 97 - wizards/source/gimmicks/ChangeAllChars.xba | 75 - wizards/source/gimmicks/GetTexts.xba | 522 -- wizards/source/gimmicks/ReadDir.xba | 305 - wizards/source/gimmicks/ReadFolderDlg.xdl | 22 - wizards/source/gimmicks/UserfieldDlg.xdl | 49 - wizards/source/gimmicks/Userfields.xba | 219 - wizards/source/gimmicks/delzip | 0 wizards/source/gimmicks/dialog.xlb | 6 - wizards/source/gimmicks/readdirs.dlg | Bin 3180 -> 0 bytes wizards/source/gimmicks/script.xlb | 9 - wizards/source/imagelists/imagelists.src | 119 - wizards/source/importwizard/API.xba | 208 - wizards/source/importwizard/DialogModul.xba | 657 -- wizards/source/importwizard/FilesModul.xba | 825 --- wizards/source/importwizard/ImportDialog.xdl | 96 - wizards/source/importwizard/Language.xba | 157 - wizards/source/importwizard/Main.xba | 290 - wizards/source/importwizard/delzip | 0 wizards/source/importwizard/dialog.xlb | 5 - wizards/source/importwizard/importwi.src | 674 -- wizards/source/importwizard/script.xlb | 9 - wizards/source/launcher/DicOOo.xba | 59 - wizards/source/launcher/delzip | 0 wizards/source/launcher/dialog.xlb | 3 - wizards/source/launcher/script.xlb | 5 - wizards/source/schedule/BankHoliday.xba | 177 - wizards/source/schedule/CalendarMain.xba | 302 - wizards/source/schedule/CreateTable.xba | 133 - wizards/source/schedule/DlgCalendar.xdl | 64 - wizards/source/schedule/DlgControl.xba | 148 - wizards/source/schedule/GermanHolidays.xba | 132 - wizards/source/schedule/Language.xba | 95 - wizards/source/schedule/LocalHolidays.xba | 642 -- wizards/source/schedule/OwnEvents.xba | 217 - wizards/source/schedule/delzip | 0 wizards/source/schedule/dialog.xlb | 5 - wizards/source/schedule/schedule.src | 357 -- wizards/source/schedule/script.xlb | 12 - wizards/source/standard/Module1.xba | 7 - wizards/source/standard/delzip | 0 wizards/source/standard/dialog.xlb | 3 - wizards/source/standard/script.xlb | 5 - wizards/source/template/Autotext.xba | 173 - wizards/source/template/Correspondence.xba | 286 - wizards/source/template/DialogStyles.xdl | 15 - wizards/source/template/ModuleAgenda.xba | 203 - wizards/source/template/Samples.xba | 185 - wizards/source/template/TemplateDialog.xdl | 29 - wizards/source/template/delzip | 0 wizards/source/template/dialog.xlb | 7 - wizards/source/template/script.xlb | 8 - wizards/source/template/template.src | 358 -- wizards/source/tools/Debug.xba | 236 - wizards/source/tools/DlgOverwriteAll.xdl | 17 - wizards/source/tools/Listbox.xba | 353 -- wizards/source/tools/Misc.xba | 821 --- wizards/source/tools/ModuleControls.xba | 370 -- wizards/source/tools/Strings.xba | 452 -- wizards/source/tools/UCB.xba | 294 - wizards/source/tools/delzip | 0 wizards/source/tools/dialog.xlb | 5 - wizards/source/tools/script.xlb | 10 - wizards/source/tutorials/Functions.xba | 368 -- wizards/source/tutorials/RoadMap.xba | 117 - wizards/source/tutorials/ShowInfoDialog.xba | 305 - wizards/source/tutorials/TutorialClose.xba | 15 - wizards/source/tutorials/TutorialCloseDialog.xdl | 14 - wizards/source/tutorials/TutorialCreator.xba | 10 - wizards/source/tutorials/TutorialOpen.xba | 96 - wizards/source/tutorials/TutorialOpenDialog.xdl | 21 - wizards/source/tutorials/TutorialsDialog.xdl | 26 - wizards/source/tutorials/delzip | 0 wizards/source/tutorials/dialog.xlb | 7 - wizards/source/tutorials/script.xlb | 10 - wizards/source/webwizard/Bullets.xba | 117 - wizards/source/webwizard/Common.xba | 145 - wizards/source/webwizard/HtmlAutoPilotBasic.xba | 436 -- wizards/source/webwizard/Language.xba | 84 - wizards/source/webwizard/WebWzrd.xdl | 28 - wizards/source/webwizard/delzip | 0 wizards/source/webwizard/dialog.xlb | 5 - wizards/source/webwizard/script.xlb | 8 - wizards/source/webwizard/webwizar.src | 167 - .../doc/OpenDocumentSignatures-TestIntegration.sxw | Bin 14189 -> 0 bytes .../doc/OpenDocumentSignatures-Workflow.sxd | Bin 10310 -> 0 bytes xmlsecurity/doc/OpenDocumentSignatures.sxw | Bin 16195 -> 0 bytes xmlsecurity/doc/XMLSecurityFramework.sxw | Bin 187975 -> 0 bytes xmlsecurity/inc/makefile.mk | 47 - xmlsecurity/inc/pch/precompiled_xmlsecurity.cxx | 31 - xmlsecurity/inc/pch/precompiled_xmlsecurity.hxx | 34 - xmlsecurity/inc/xmlsecurity/biginteger.hxx | 43 - xmlsecurity/inc/xmlsecurity/certificatechooser.hxx | 96 - xmlsecurity/inc/xmlsecurity/certificateviewer.hxx | 168 - xmlsecurity/inc/xmlsecurity/certvalidity.hxx | 39 - .../inc/xmlsecurity/digitalsignaturesdialog.hxx | 153 - .../inc/xmlsecurity/documentsignaturehelper.hxx | 106 - xmlsecurity/inc/xmlsecurity/global.hrc | 48 - xmlsecurity/inc/xmlsecurity/macrosecurity.hxx | 178 - xmlsecurity/inc/xmlsecurity/sigstruct.hxx | 114 - xmlsecurity/inc/xmlsecurity/stbcontrl.hxx | 59 - xmlsecurity/inc/xmlsecurity/warnings.hxx | 91 - xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx | 209 - xmlsecurity/prj/build.lst | 12 - xmlsecurity/prj/d.lst | 13 - xmlsecurity/qa/certext/SanCertExt.cxx | 281 - xmlsecurity/qa/certext/User_35_Root_11.crt | 64 - xmlsecurity/qa/certext/export.map | 34 - xmlsecurity/qa/certext/makefile.mk | 71 - .../source/component/certificatecontainer.cxx | 173 - .../source/component/certificatecontainer.hxx | 97 - .../source/component/documentdigitalsignatures.cxx | 516 -- .../source/component/documentdigitalsignatures.hxx | 104 - xmlsecurity/source/component/makefile.mk | 54 - xmlsecurity/source/component/registerservices.cxx | 85 - xmlsecurity/source/component/warnbox.src | 36 - xmlsecurity/source/dialogs/certificatechooser.cxx | 241 - xmlsecurity/source/dialogs/certificatechooser.src | 88 - xmlsecurity/source/dialogs/certificateviewer.cxx | 520 -- xmlsecurity/source/dialogs/certificateviewer.src | 325 - xmlsecurity/source/dialogs/dialogs.hrc | 344 -- .../source/dialogs/digitalsignaturesdialog.cxx | 840 --- .../source/dialogs/digitalsignaturesdialog.hrc | 36 - .../source/dialogs/digitalsignaturesdialog.src | 207 - xmlsecurity/source/dialogs/helpids.hrc | 55 - xmlsecurity/source/dialogs/macrosecurity.cxx | 456 -- xmlsecurity/source/dialogs/macrosecurity.src | 241 - xmlsecurity/source/dialogs/makefile.mk | 64 - xmlsecurity/source/dialogs/resourcemanager.cxx | 430 -- xmlsecurity/source/dialogs/resourcemanager.hxx | 72 - xmlsecurity/source/dialogs/stbcontrl.cxx | 123 - xmlsecurity/source/dialogs/warnings.cxx | 141 - xmlsecurity/source/dialogs/warnings.src | 115 - xmlsecurity/source/framework/buffernode.cxx | 1198 ---- xmlsecurity/source/framework/buffernode.hxx | 136 - xmlsecurity/source/framework/decryptorimpl.cxx | 238 - xmlsecurity/source/framework/decryptorimpl.hxx | 134 - xmlsecurity/source/framework/elementcollector.cxx | 273 - xmlsecurity/source/framework/elementcollector.hxx | 106 - xmlsecurity/source/framework/elementmark.cxx | 104 - xmlsecurity/source/framework/elementmark.hxx | 84 - xmlsecurity/source/framework/encryptionengine.cxx | 209 - xmlsecurity/source/framework/encryptionengine.hxx | 102 - xmlsecurity/source/framework/encryptorimpl.cxx | 274 - xmlsecurity/source/framework/encryptorimpl.hxx | 147 - xmlsecurity/source/framework/makefile.mk | 61 - .../source/framework/saxeventkeeperimpl.cxx | 1426 ----- .../source/framework/saxeventkeeperimpl.hxx | 365 -- xmlsecurity/source/framework/securityengine.cxx | 90 - xmlsecurity/source/framework/securityengine.hxx | 169 - .../source/framework/signaturecreatorimpl.cxx | 287 - .../source/framework/signaturecreatorimpl.hxx | 145 - xmlsecurity/source/framework/signatureengine.cxx | 262 - xmlsecurity/source/framework/signatureengine.hxx | 141 - .../source/framework/signatureverifierimpl.cxx | 235 - .../source/framework/signatureverifierimpl.hxx | 133 - .../source/framework/xmlencryptiontemplateimpl.cxx | 141 - .../source/framework/xmlencryptiontemplateimpl.hxx | 112 - .../source/framework/xmlsignaturetemplateimpl.cxx | 166 - .../source/framework/xmlsignaturetemplateimpl.hxx | 122 - xmlsecurity/source/framework/xsec_framework.cxx | 168 - .../source/helper/documentsignaturehelper.cxx | 464 -- xmlsecurity/source/helper/makefile.mk | 54 - xmlsecurity/source/helper/xmlsignaturehelper.cxx | 430 -- xmlsecurity/source/helper/xmlsignaturehelper2.cxx | 235 - xmlsecurity/source/helper/xmlsignaturehelper2.hxx | 136 - xmlsecurity/source/helper/xsecctl.cxx | 1324 ---- xmlsecurity/source/helper/xsecctl.hxx | 544 -- xmlsecurity/source/helper/xsecparser.cxx | 359 -- xmlsecurity/source/helper/xsecparser.hxx | 163 - xmlsecurity/source/helper/xsecsign.cxx | 376 -- xmlsecurity/source/helper/xsecverify.cxx | 325 - xmlsecurity/source/xmlsec/biginteger.cxx | 128 - .../xmlsec/certificateextension_xmlsecimpl.cxx | 99 - .../xmlsec/certificateextension_xmlsecimpl.hxx | 67 - xmlsecurity/source/xmlsec/certvalidity.cxx | 100 - xmlsecurity/source/xmlsec/diagnose.cxx | 76 - xmlsecurity/source/xmlsec/diagnose.hxx | 43 - xmlsecurity/source/xmlsec/errorcallback.cxx | 76 - xmlsecurity/source/xmlsec/errorcallback.hxx | 44 - xmlsecurity/source/xmlsec/makefile.mk | 72 - xmlsecurity/source/xmlsec/mscrypt/makefile.mk | 74 - xmlsecurity/source/xmlsec/mscrypt/oid.hxx | 161 - .../xmlsec/mscrypt/sanextension_mscryptimpl.cxx | 182 - .../xmlsec/mscrypt/sanextension_mscryptimpl.hxx | 84 - .../mscrypt/securityenvironment_mscryptimpl.cxx | 1279 ---- .../mscrypt/securityenvironment_mscryptimpl.hxx | 205 - .../xmlsec/mscrypt/seinitializer_mscryptimpl.cxx | 240 - .../xmlsec/mscrypt/seinitializer_mscryptimpl.hxx | 105 - .../xmlsec/mscrypt/x509certificate_mscryptimpl.cxx | 656 -- .../xmlsec/mscrypt/x509certificate_mscryptimpl.hxx | 100 - .../xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx | 386 -- .../xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx | 100 - .../mscrypt/xmlsecuritycontext_mscryptimpl.cxx | 184 - .../mscrypt/xmlsecuritycontext_mscryptimpl.hxx | 134 - .../xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx | 312 - .../xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx | 100 - xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx | 87 - xmlsecurity/source/xmlsec/nss/certerrors.h | 394 -- xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 276 - xmlsecurity/source/xmlsec/nss/ciphercontext.hxx | 89 - xmlsecurity/source/xmlsec/nss/digestcontext.cxx | 101 - xmlsecurity/source/xmlsec/nss/digestcontext.hxx | 68 - xmlsecurity/source/xmlsec/nss/makefile.mk | 130 - xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 521 -- xmlsecurity/source/xmlsec/nss/nssinitializer.hxx | 90 - xmlsecurity/source/xmlsec/nss/nssrenam.h | 52 - .../source/xmlsec/nss/sanextension_nssimpl.cxx | 244 - .../source/xmlsec/nss/sanextension_nssimpl.hxx | 77 - xmlsecurity/source/xmlsec/nss/secerror.cxx | 166 - xmlsecurity/source/xmlsec/nss/secerror.hxx | 39 - .../xmlsec/nss/securityenvironment_nssimpl.cxx | 1129 ---- .../xmlsec/nss/securityenvironment_nssimpl.hxx | 171 - .../source/xmlsec/nss/seinitializer_nssimpl.cxx | 199 - .../source/xmlsec/nss/seinitializer_nssimpl.hxx | 87 - .../source/xmlsec/nss/x509certificate_nssimpl.cxx | 474 -- .../source/xmlsec/nss/x509certificate_nssimpl.hxx | 105 - .../source/xmlsec/nss/xmlencryption_nssimpl.cxx | 384 -- .../source/xmlsec/nss/xmlencryption_nssimpl.hxx | 100 - .../xmlsec/nss/xmlsecuritycontext_nssimpl.cxx | 203 - .../xmlsec/nss/xmlsecuritycontext_nssimpl.hxx | 137 - .../source/xmlsec/nss/xmlsignature_nssimpl.cxx | 344 -- .../source/xmlsec/nss/xmlsignature_nssimpl.hxx | 100 - xmlsecurity/source/xmlsec/nss/xsec_nss.cxx | 107 - xmlsecurity/source/xmlsec/saxhelper.cxx | 407 -- xmlsecurity/source/xmlsec/saxhelper.hxx | 90 - .../xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 1116 ---- .../xmlsec/xmldocumentwrapper_xmlsecimpl.hxx | 279 - .../source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx | 183 - .../source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx | 106 - xmlsecurity/source/xmlsec/xmlstreamio.cxx | 235 - xmlsecurity/source/xmlsec/xmlstreamio.hxx | 46 - xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 152 - xmlsecurity/test_docs/CAs/README.txt | 383 -- xmlsecurity/test_docs/CAs/Root_1/demoCA/cacert.pem | 19 - .../CAs/Root_1/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 xmlsecurity/test_docs/CAs/Root_1/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_1/demoCA/index.txt | 1 - .../test_docs/CAs/Root_1/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_1/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_1/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_1/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_1/openssl.cfg | 292 - .../test_docs/CAs/Root_10/demoCA/cacert.pem | 19 - xmlsecurity/test_docs/CAs/Root_10/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_10/demoCA/index.txt | 1 - .../test_docs/CAs/Root_10/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_10/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_10/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_10/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_10/openssl.cfg | 292 - .../test_docs/CAs/Root_11/demoCA/cacert.pem | 19 - xmlsecurity/test_docs/CAs/Root_11/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt | 35 - .../test_docs/CAs/Root_11/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_11/demoCA/newcerts/1000.pem | 57 - .../test_docs/CAs/Root_11/demoCA/newcerts/1002.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1003.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1004.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1005.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1006.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1007.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1008.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1009.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/100A.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/100B.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/100C.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/100D.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/100E.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/100F.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1010.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1011.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1012.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1013.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1014.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1015.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1016.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1017.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1018.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1019.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/101A.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/101B.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/101C.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/101D.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/101E.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/101F.pem | 60 - .../test_docs/CAs/Root_11/demoCA/newcerts/1020.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1021.pem | 61 - .../test_docs/CAs/Root_11/demoCA/newcerts/1022.pem | 64 - .../test_docs/CAs/Root_11/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_11/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_11/openssl.cfg | 298 - xmlsecurity/test_docs/CAs/Root_2/demoCA/cacert.pem | 19 - .../CAs/Root_2/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 xmlsecurity/test_docs/CAs/Root_2/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_2/demoCA/index.txt | 1 - .../test_docs/CAs/Root_2/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_2/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_2/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_2/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_2/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_3/demoCA/cacert.pem | 19 - xmlsecurity/test_docs/CAs/Root_3/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_3/demoCA/index.txt | 1 - .../test_docs/CAs/Root_3/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_3/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_3/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_3/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_3/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_4/README.txt | 4 - xmlsecurity/test_docs/CAs/Root_4/demoCA/cacert.pem | 19 - xmlsecurity/test_docs/CAs/Root_4/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_4/demoCA/index.txt | 2 - .../test_docs/CAs/Root_4/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_4/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_4/demoCA/newcerts/1001.pem | 62 - .../test_docs/CAs/Root_4/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_4/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_4/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_5/demoCA/cacert.pem | 19 - .../CAs/Root_5/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 xmlsecurity/test_docs/CAs/Root_5/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_5/demoCA/index.txt | 1 - .../test_docs/CAs/Root_5/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_5/demoCA/newcerts/1001.pem | 66 - .../test_docs/CAs/Root_5/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_5/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_5/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_6/README.txt | 5 - xmlsecurity/test_docs/CAs/Root_6/demoCA/cacert.pem | 19 - .../CAs/Root_6/demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../test_docs/CAs/Root_6/demoCA/crl/Root_6.crl | Bin 316 -> 0 bytes xmlsecurity/test_docs/CAs/Root_6/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_6/demoCA/index.txt | 1 - .../test_docs/CAs/Root_6/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_6/demoCA/newcerts/1001.pem | 66 - .../test_docs/CAs/Root_6/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_6/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_6/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_7/README.txt | 10 - xmlsecurity/test_docs/CAs/Root_7/demoCA/cacert.pem | 19 - .../CAs/Root_7/demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../test_docs/CAs/Root_7/demoCA/crl/Root_7.crl | Bin 353 -> 0 bytes xmlsecurity/test_docs/CAs/Root_7/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_7/demoCA/index.txt | 2 - .../test_docs/CAs/Root_7/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_7/demoCA/newcerts/1000.pem | 66 - .../test_docs/CAs/Root_7/demoCA/newcerts/1001.pem | 66 - .../test_docs/CAs/Root_7/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_7/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_7/openssl.cfg | 292 - xmlsecurity/test_docs/CAs/Root_8/README.txt | 9 - xmlsecurity/test_docs/CAs/Root_8/demoCA/cacert.pem | 19 - .../CAs/Root_8/demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../test_docs/CAs/Root_8/demoCA/crl/Root_8.crl | Bin 353 -> 0 bytes xmlsecurity/test_docs/CAs/Root_8/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_8/demoCA/index.txt | 2 - .../test_docs/CAs/Root_8/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_8/demoCA/newcerts/1000.pem | 66 - .../test_docs/CAs/Root_8/demoCA/newcerts/1001.pem | 66 - .../test_docs/CAs/Root_8/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_8/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_8/openssl.cfg | 292 - .../CAs/Root_9/DO_NOT_INSTALL_THIS_ROOT_CERT.txt | 1 - .../demoCA/DO_NO_INSTALL_THIS_ROOT_CERTIFICATE | 0 xmlsecurity/test_docs/CAs/Root_9/demoCA/Root_9.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/CAs/Root_9/demoCA/cacert.pem | 19 - xmlsecurity/test_docs/CAs/Root_9/demoCA/crlnumber | 1 - xmlsecurity/test_docs/CAs/Root_9/demoCA/index.txt | 1 - .../test_docs/CAs/Root_9/demoCA/index.txt.attr | 1 - .../test_docs/CAs/Root_9/demoCA/newcerts/1000.pem | 62 - .../test_docs/CAs/Root_9/demoCA/private/cakey.pem | 18 - xmlsecurity/test_docs/CAs/Root_9/demoCA/serial | 1 - xmlsecurity/test_docs/CAs/Root_9/openssl.cfg | 292 - .../CAs/Sub_CA_1_Root_1/demoCA/cacert.pem | 62 - .../Sub_CA_1_Root_1/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 .../test_docs/CAs/Sub_CA_1_Root_1/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_1/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_1/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_1/demoCA/newcerts/1000.pem | 58 - .../CAs/Sub_CA_1_Root_1/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_1/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_1/openssl.cfg | 292 - .../DO_NOT_INSTALL_THIS_CERTIFICATE | 0 .../test_docs/CAs/Sub_CA_1_Root_10/README.txt | 19 - .../demoCA/DO_NOT_INSTALL_THIS_CERTIFICATE | 0 .../Sub_CA_1_Root_10/demoCA/Sub_CA_1_Root_10.crt | Bin 781 -> 0 bytes .../CAs/Sub_CA_1_Root_10/demoCA/cacert.pem | 62 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../demoCA/crl/Sub_CA_1_Root_10.crl | Bin 326 -> 0 bytes .../CAs/Sub_CA_1_Root_10/demoCA/crlnumber | 1 - .../CAs/Sub_CA_1_Root_10/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_10/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_10/demoCA/newcerts/1000.pem | 67 - .../CAs/Sub_CA_1_Root_10/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_10/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_10/openssl.cfg | 293 - .../CAs/Sub_CA_1_Root_2/demoCA/cacert.pem | 62 - .../test_docs/CAs/Sub_CA_1_Root_2/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_2/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_2/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_2/demoCA/newcerts/1000.pem | 60 - .../CAs/Sub_CA_1_Root_2/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_2/demoCA/req.pem | 11 - .../test_docs/CAs/Sub_CA_1_Root_2/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_2/openssl.cfg | 292 - .../CAs/Sub_CA_1_Root_3/demoCA/cacert.pem | 62 - .../Sub_CA_1_Root_3/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 .../test_docs/CAs/Sub_CA_1_Root_3/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_3/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_3/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_3/demoCA/newcerts/1000.pem | 60 - .../CAs/Sub_CA_1_Root_3/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_3/demoCA/req.pem | 11 - .../test_docs/CAs/Sub_CA_1_Root_3/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_3/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_1_Root_4/README.txt | 4 - .../CAs/Sub_CA_1_Root_4/demoCA/cacert.pem | 62 - .../test_docs/CAs/Sub_CA_1_Root_4/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_4/demoCA/index.txt | 2 - .../CAs/Sub_CA_1_Root_4/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_4/demoCA/newcerts/1000.pem | 60 - .../CAs/Sub_CA_1_Root_4/demoCA/newcerts/1001.pem | 60 - .../CAs/Sub_CA_1_Root_4/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_4/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_4/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_1_Root_5/README.txt | 5 - .../CAs/Sub_CA_1_Root_5/demoCA/cacert.pem | 66 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../Sub_CA_1_Root_5/demoCA/crl/Sub_CA_1_Root_5.crl | Bin 325 -> 0 bytes .../test_docs/CAs/Sub_CA_1_Root_5/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_5/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_5/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_5/demoCA/newcerts/1002.pem | 62 - .../CAs/Sub_CA_1_Root_5/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_5/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_5/openssl.cfg | 292 - .../CAs/Sub_CA_1_Root_6/demoCA/cacert.pem | 66 - .../Sub_CA_1_Root_6/demoCA/crl/DO_NOT_CREATE_A_CRL | 0 .../test_docs/CAs/Sub_CA_1_Root_6/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_6/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_6/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_6/demoCA/newcerts/1000.pem | 62 - .../CAs/Sub_CA_1_Root_6/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_6/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_6/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_1_Root_7/README.txt | 3 - .../CAs/Sub_CA_1_Root_7/demoCA/cacert.pem | 66 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../Sub_CA_1_Root_7/demoCA/crl/Sub_CA_1_Root_7.crl | Bin 362 -> 0 bytes .../test_docs/CAs/Sub_CA_1_Root_7/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_7/demoCA/index.txt | 2 - .../CAs/Sub_CA_1_Root_7/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_7/demoCA/newcerts/1000.pem | 62 - .../CAs/Sub_CA_1_Root_7/demoCA/newcerts/1001.pem | 62 - .../CAs/Sub_CA_1_Root_7/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_7/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_7/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_1_Root_8/README.txt | 13 - .../CAs/Sub_CA_1_Root_8/demoCA/cacert.pem | 66 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../Sub_CA_1_Root_8/demoCA/crl/Sub_CA_1_Root_8.crl | Bin 362 -> 0 bytes .../test_docs/CAs/Sub_CA_1_Root_8/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_8/demoCA/index.txt | 2 - .../CAs/Sub_CA_1_Root_8/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_8/demoCA/newcerts/1000.pem | 62 - .../CAs/Sub_CA_1_Root_8/demoCA/newcerts/1001.pem | 62 - .../CAs/Sub_CA_1_Root_8/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_8/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_8/openssl.cfg | 292 - .../CAs/Sub_CA_1_Root_9/demoCA/cacert.pem | 62 - .../test_docs/CAs/Sub_CA_1_Root_9/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_1_Root_9/demoCA/index.txt | 1 - .../CAs/Sub_CA_1_Root_9/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_1_Root_9/demoCA/newcerts/1000.pem | 58 - .../CAs/Sub_CA_1_Root_9/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_1_Root_9/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_1_Root_9/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_2_Root_4/README.txt | 4 - .../CAs/Sub_CA_2_Root_4/demoCA/cacert.pem | 62 - .../test_docs/CAs/Sub_CA_2_Root_4/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_2_Root_4/demoCA/index.txt | 2 - .../CAs/Sub_CA_2_Root_4/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_2_Root_4/demoCA/newcerts/1001.pem | 60 - .../CAs/Sub_CA_2_Root_4/demoCA/newcerts/1002.pem | 60 - .../CAs/Sub_CA_2_Root_4/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_2_Root_4/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_2_Root_4/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_2_Root_7/README.txt | 12 - .../CAs/Sub_CA_2_Root_7/demoCA/cacert.pem | 66 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../Sub_CA_2_Root_7/demoCA/crl/Sub_CA_2_Root_7.crl | Bin 362 -> 0 bytes .../test_docs/CAs/Sub_CA_2_Root_7/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_2_Root_7/demoCA/index.txt | 2 - .../CAs/Sub_CA_2_Root_7/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_2_Root_7/demoCA/newcerts/1000.pem | 62 - .../CAs/Sub_CA_2_Root_7/demoCA/newcerts/1001.pem | 62 - .../CAs/Sub_CA_2_Root_7/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_2_Root_7/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_2_Root_7/openssl.cfg | 292 - .../test_docs/CAs/Sub_CA_2_Root_8/README.txt | 13 - .../CAs/Sub_CA_2_Root_8/demoCA/cacert.pem | 66 - .../demoCA/crl/DO_NOT_INSTALL_THIS_CRL | 0 .../Sub_CA_2_Root_8/demoCA/crl/Sub_CA_2_Root_8.crl | Bin 362 -> 0 bytes .../test_docs/CAs/Sub_CA_2_Root_8/demoCA/crlnumber | 1 - .../test_docs/CAs/Sub_CA_2_Root_8/demoCA/index.txt | 2 - .../CAs/Sub_CA_2_Root_8/demoCA/index.txt.attr | 1 - .../CAs/Sub_CA_2_Root_8/demoCA/newcerts/1002.pem | 62 - .../CAs/Sub_CA_2_Root_8/demoCA/newcerts/1003.pem | 62 - .../CAs/Sub_CA_2_Root_8/demoCA/private/cakey.pem | 18 - .../test_docs/CAs/Sub_CA_2_Root_8/demoCA/serial | 1 - .../test_docs/CAs/Sub_CA_2_Root_8/openssl.cfg | 292 - xmlsecurity/test_docs/certs/ca_certs/Root_1.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_10.crt | Bin 779 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_11.crt | Bin 779 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_2.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_3.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_4.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_5.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_6.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_7.crt | Bin 776 -> 0 bytes xmlsecurity/test_docs/certs/ca_certs/Root_8.crt | Bin 776 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_1.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_2.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_3.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_4.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_5.crt | Bin 842 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_6.crt | Bin 842 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_7.crt | Bin 842 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_8.crt | Bin 829 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_1_Root_9.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_2_Root_4.crt | Bin 778 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_2_Root_7.crt | Bin 842 -> 0 bytes .../test_docs/certs/ca_certs/Sub_CA_2_Root_8.crt | Bin 829 -> 0 bytes xmlsecurity/test_docs/certs/crl/Root_10.crl | Bin 317 -> 0 bytes xmlsecurity/test_docs/certs/crl/Root_11.crl | Bin 317 -> 0 bytes xmlsecurity/test_docs/certs/crl/Root_3.crl | Bin 316 -> 0 bytes xmlsecurity/test_docs/certs/crl/Root_4.crl | Bin 353 -> 0 bytes xmlsecurity/test_docs/certs/crl/Root_9.crl | Bin 316 -> 0 bytes .../test_docs/certs/crl/Sub_CA_1_Root_2.crl | Bin 325 -> 0 bytes .../test_docs/certs/crl/Sub_CA_1_Root_4.crl | Bin 362 -> 0 bytes .../test_docs/certs/crl/Sub_CA_1_Root_9.crl | Bin 325 -> 0 bytes .../test_docs/certs/crl/Sub_CA_2_Root_4.crl | Bin 362 -> 0 bytes .../test_docs/certs/end_certs/User_10_Root_11.crt | Bin 739 -> 0 bytes .../test_docs/certs/end_certs/User_11_Root_11.crt | Bin 733 -> 0 bytes .../test_docs/certs/end_certs/User_12_Root_11.crt | Bin 729 -> 0 bytes .../test_docs/certs/end_certs/User_13_Root_11.crt | Bin 739 -> 0 bytes .../test_docs/certs/end_certs/User_14_Root_11.crt | Bin 729 -> 0 bytes .../test_docs/certs/end_certs/User_15_Root_11.crt | Bin 720 -> 0 bytes .../test_docs/certs/end_certs/User_16_Root_11.crt | Bin 739 -> 0 bytes .../test_docs/certs/end_certs/User_17_Root_11.crt | Bin 749 -> 0 bytes .../test_docs/certs/end_certs/User_18_Root_11.crt | Bin 714 -> 0 bytes .../test_docs/certs/end_certs/User_19_Root_11.crt | Bin 710 -> 0 bytes .../test_docs/certs/end_certs/User_1_Root_11.crt | Bin 699 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_1.crt | Bin 706 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_10.crt | Bin 828 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_2.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_3.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_4.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_5.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_6.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_7.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_8.crt | Bin 726 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_1_Root_9.crt | Bin 673 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_2_Root_4.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_2_Root_7.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_1_Sub_CA_2_Root_8.crt | Bin 726 -> 0 bytes .../test_docs/certs/end_certs/User_20_Root_11.crt | Bin 710 -> 0 bytes .../test_docs/certs/end_certs/User_21_Root_11.crt | Bin 727 -> 0 bytes .../test_docs/certs/end_certs/User_22_Root_11.crt | Bin 739 -> 0 bytes .../test_docs/certs/end_certs/User_23_Root_11.crt | Bin 733 -> 0 bytes .../test_docs/certs/end_certs/User_24_Root_11.crt | Bin 729 -> 0 bytes .../test_docs/certs/end_certs/User_25_Root_11.crt | Bin 737 -> 0 bytes .../test_docs/certs/end_certs/User_26_Root_11.crt | Bin 729 -> 0 bytes .../test_docs/certs/end_certs/User_27_Root_11.crt | Bin 705 -> 0 bytes .../test_docs/certs/end_certs/User_28_Root_11.crt | Bin 700 -> 0 bytes .../test_docs/certs/end_certs/User_29_Root_11.crt | Bin 698 -> 0 bytes .../test_docs/certs/end_certs/User_2_Root_11.crt | Bin 695 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_1_Root_4.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_1_Root_7.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_1_Root_8.crt | Bin 726 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_2_Root_4.crt | Bin 719 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_2_Root_7.crt | Bin 746 -> 0 bytes .../certs/end_certs/User_2_Sub_CA_2_Root_8.crt | Bin 726 -> 0 bytes .../test_docs/certs/end_certs/User_30_Root_11.crt | Bin 716 -> 0 bytes .../test_docs/certs/end_certs/User_31_Root_11.crt | Bin 745 -> 0 bytes .../test_docs/certs/end_certs/User_32_Root_11.crt | Bin 591 -> 0 bytes .../test_docs/certs/end_certs/User_33_Root_11.crt | Bin 620 -> 0 bytes .../test_docs/certs/end_certs/User_34_Root_11.crt | Bin 637 -> 0 bytes .../test_docs/certs/end_certs/User_35_Root_11.crt | 64 - .../test_docs/certs/end_certs/User_3_Root_11.crt | Bin 719 -> 0 bytes .../test_docs/certs/end_certs/User_4_Root_11.crt | Bin 738 -> 0 bytes .../test_docs/certs/end_certs/User_5_Root_11.crt | Bin 748 -> 0 bytes .../test_docs/certs/end_certs/User_6_Root_11.crt | Bin 713 -> 0 bytes .../test_docs/certs/end_certs/User_7_Root_11.crt | Bin 709 -> 0 bytes .../test_docs/certs/end_certs/User_8_Root_11.crt | Bin 709 -> 0 bytes .../test_docs/certs/end_certs/User_9_Root_11.crt | Bin 726 -> 0 bytes xmlsecurity/test_docs/certs/p12/Root_11.p12 | Bin 1797 -> 0 bytes .../test_docs/certs/p12/User_10_Root_11.p12 | Bin 1757 -> 0 bytes .../test_docs/certs/p12/User_11_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_12_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_13_Root_11.p12 | Bin 1757 -> 0 bytes .../test_docs/certs/p12/User_14_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_15_Root_11.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_16_Root_11.p12 | Bin 1757 -> 0 bytes .../test_docs/certs/p12/User_17_Root_11.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_18_Root_11.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_19_Root_11.p12 | Bin 1725 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_1_Root_11.p12 | Bin 1717 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_1.p12 | Bin 1725 -> 0 bytes .../certs/p12/User_1_Sub_CA_1_Root_10.p12 | Bin 1845 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_2.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_3.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_4.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_5.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_6.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_7.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_8.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_1_Root_9.p12 | Bin 1693 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_2_Root_4.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_2_Root_7.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_1_Sub_CA_2_Root_8.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_20_Root_11.p12 | Bin 1725 -> 0 bytes .../test_docs/certs/p12/User_21_Root_11.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_22_Root_11.p12 | Bin 1757 -> 0 bytes .../test_docs/certs/p12/User_23_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_24_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_25_Root_11.p12 | Bin 1757 -> 0 bytes .../test_docs/certs/p12/User_26_Root_11.p12 | Bin 1749 -> 0 bytes .../test_docs/certs/p12/User_27_Root_11.p12 | Bin 1725 -> 0 bytes .../test_docs/certs/p12/User_28_Root_11.p12 | Bin 1717 -> 0 bytes .../test_docs/certs/p12/User_29_Root_11.p12 | Bin 1717 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_2_Root_11.p12 | Bin 1709 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_1_Root_4.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_1_Root_7.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_1_Root_8.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_2_Root_4.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_2_Root_7.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_2_Sub_CA_2_Root_8.p12 | Bin 1741 -> 0 bytes .../test_docs/certs/p12/User_30_Root_11.p12 | Bin 1733 -> 0 bytes .../test_docs/certs/p12/User_31_Root_11.p12 | Bin 1765 -> 0 bytes .../test_docs/certs/p12/User_32_Root_11.p12 | Bin 1605 -> 0 bytes .../test_docs/certs/p12/User_33_Root_11.p12 | Bin 1732 -> 0 bytes .../test_docs/certs/p12/User_34_Root_11.p12 | Bin 1714 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_3_Root_11.p12 | Bin 1733 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_4_Root_11.p12 | Bin 1757 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_5_Root_11.p12 | Bin 1765 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_6_Root_11.p12 | Bin 1733 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_7_Root_11.p12 | Bin 1725 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_8_Root_11.p12 | Bin 1725 -> 0 bytes xmlsecurity/test_docs/certs/p12/User_9_Root_11.p12 | Bin 1741 -> 0 bytes xmlsecurity/test_docs/documents/aia_ca_issuers.odt | Bin 9511 -> 0 bytes xmlsecurity/test_docs/documents/aia_ocsp.odt | Bin 9376 -> 0 bytes .../test_docs/documents/aia_ocsp_revoked_chain.odt | Bin 9370 -> 0 bytes .../test_docs/documents/aia_ocsp_revoked_leaf.odt | Bin 9379 -> 0 bytes .../documents/aia_ocsp_revoked_leaf_chain.odt | Bin 9378 -> 0 bytes xmlsecurity/test_docs/documents/crl.odt | Bin 9354 -> 0 bytes .../test_docs/documents/crl_revoked_chain.odt | Bin 9352 -> 0 bytes .../test_docs/documents/crl_revoked_leaf.odt | Bin 9363 -> 0 bytes .../test_docs/documents/crl_revoked_leaf_chain.odt | Bin 9351 -> 0 bytes xmlsecurity/test_docs/documents/crldp.odt | Bin 9379 -> 0 bytes .../crldp_no_intermediate_ca_revocation_info.odt | Bin 9382 -> 0 bytes .../documents/crldp_no_root_revocation_info.odt | Bin 9379 -> 0 bytes .../test_docs/documents/crldp_revoked_chain.odt | Bin 9381 -> 0 bytes .../test_docs/documents/crldp_revoked_leaf.odt | Bin 9380 -> 0 bytes .../documents/crldp_revoked_leaf_chain.odt | Bin 9383 -> 0 bytes .../test_docs/documents/dn_cyrillic_bmpstring.odt | Bin 9392 -> 0 bytes .../documents/dn_latin_ext_greak_bmpstring.odt | Bin 9388 -> 0 bytes .../test_docs/documents/dn_multivalue_rdn.odt | Bin 9272 -> 0 bytes xmlsecurity/test_docs/documents/dn_quoting.odt | Bin 28429 -> 0 bytes .../documents/dn_single_multivalue_rdn.odt | Bin 9299 -> 0 bytes .../dn_single_multivalue_rdn_with_quoting.odt | Bin 9313 -> 0 bytes .../test_docs/documents/incomplete_path.odt | Bin 9308 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_doc1.odt | Bin 9550 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_doc2.odt | Bin 6989 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_macro1.odt | Bin 12911 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_macro2.odt | Bin 12929 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_macro3.odt | Bin 13043 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_macro4.odt | Bin 13079 -> 0 bytes .../test_docs/documents/invalid_ooo2_x_macro5.odt | Bin 20336 -> 0 bytes .../test_docs/documents/invalid_ooo3_2_doc1.odt | Bin 9200 -> 0 bytes .../test_docs/documents/invalid_ooo3_2_doc3.odt | Bin 8908 -> 0 bytes .../test_docs/documents/invalid_ooo3_2_doc4.odt | Bin 8997 -> 0 bytes .../test_docs/documents/invalid_ooo_3_2_doc2.odt | Bin 9199 -> 0 bytes xmlsecurity/test_docs/documents/ocsp_crl.odt | Bin 9444 -> 0 bytes .../test_docs/documents/ocsp_crl_revoked_leaf.odt | Bin 9447 -> 0 bytes .../test_docs/documents/stateOrProvinceName.odt | Bin 10534 -> 0 bytes .../test_docs/documents/valid_no_revocation.odt | Bin 9341 -> 0 bytes .../documents/valid_no_root_revocation_info.odt | Bin 9349 -> 0 bytes .../documents/valid_no_sub_ca_revocation_info.odt | Bin 9352 -> 0 bytes .../test_docs/documents/valid_ooo2_x_doc1.odt | Bin 9880 -> 0 bytes .../test_docs/documents/valid_ooo2_x_doc_macro.odt | Bin 12425 -> 0 bytes .../documents/valid_ooo2_x_doc_unsigned_macro.odt | Bin 10821 -> 0 bytes .../test_docs/documents/valid_ooo3_0_doc1.odt | Bin 12565 -> 0 bytes .../test_docs/documents/valid_ooo3_0_doc_macro.odt | Bin 15656 -> 0 bytes .../documents/valid_ooo3_0_doc_unsigned_macro.odt | Bin 13975 -> 0 bytes .../test_docs/documents/valid_ooo3_2_doc1.odt | Bin 12514 -> 0 bytes .../test_docs/documents/valid_ooo3_2_doc_macro.odt | Bin 15579 -> 0 bytes .../documents/valid_ooo3_2_doc_unsigned_macro.odt | Bin 13929 -> 0 bytes xmlsecurity/test_docs/test_description.odt | Bin 25782 -> 0 bytes xmlsecurity/test_docs/tools/README.txt | 23 - xmlsecurity/test_docs/tools/httpserv/build.xml | 74 - .../test_docs/tools/httpserv/dist/README.TXT | 33 - .../test_docs/tools/httpserv/dist/httpserv.jar | Bin 6994 -> 0 bytes xmlsecurity/test_docs/tools/httpserv/manifest.mf | 3 - .../tools/httpserv/nbproject/build-impl.xml | 700 --- .../tools/httpserv/nbproject/genfiles.properties | 9 - .../tools/httpserv/nbproject/project.properties | 65 - .../test_docs/tools/httpserv/nbproject/project.xml | 15 - .../tools/httpserv/src/httpserv/Main.java | 210 - xmlsecurity/tools/demo/JavaFlatFilter.java | 225 - xmlsecurity/tools/demo/makefile.mk | 157 - xmlsecurity/tools/demo/manifest | 1 - xmlsecurity/tools/demo/mozprofile.cxx | 110 - xmlsecurity/tools/demo/multisigdemo.cxx | 239 - xmlsecurity/tools/demo/performance.cxx | 1874 ------ xmlsecurity/tools/demo/readme.txt | 22 - xmlsecurity/tools/demo/signdemo.cxx | 159 - xmlsecurity/tools/demo/util.cxx | 114 - xmlsecurity/tools/demo/util.hxx | 53 - xmlsecurity/tools/demo/util2.cxx | 429 -- xmlsecurity/tools/demo/verifydemo.cxx | 111 - xmlsecurity/tools/examples/demo-sample.gif | Bin 94 -> 0 bytes xmlsecurity/tools/examples/demo-sample.sxw | Bin 19891 -> 0 bytes xmlsecurity/tools/examples/demo-sample.xml | 3 - xmlsecurity/tools/examples/enc-1.xml | 31 - xmlsecurity/tools/examples/enc-2.xml | 58 - xmlsecurity/tools/examples/eval_export.txt | 7 - xmlsecurity/tools/examples/eval_import.txt | 14 - xmlsecurity/tools/examples/evaluate_win.bat | 138 - xmlsecurity/tools/examples/readme.txt | 7 - xmlsecurity/tools/examples/s-in-e-1.xml | 53 - xmlsecurity/tools/examples/s-in-e-2.xml | 53 - xmlsecurity/tools/examples/sign-0.xml | 27 - xmlsecurity/tools/examples/sign-1.xml | 29 - xmlsecurity/tools/examples/sign-2.xml | 33 - xmlsecurity/tools/examples/sign-3.xml | 41 - xmlsecurity/tools/examples/sign-4.xml | 57 - xmlsecurity/tools/examples/sign-5.xml | 89 - xmlsecurity/tools/examples/uno_win.bat | 23 - xmlsecurity/tools/examples/warmup.xml | 27 - xmlsecurity/tools/standalone/csfit/certmngr.cxx | 191 - xmlsecurity/tools/standalone/csfit/decrypter.cxx | 274 - xmlsecurity/tools/standalone/csfit/encrypter.cxx | 311 - xmlsecurity/tools/standalone/csfit/helper.cxx | 268 - xmlsecurity/tools/standalone/csfit/helper.hxx | 241 - xmlsecurity/tools/standalone/csfit/makefile.mk | 155 - xmlsecurity/tools/standalone/csfit/signer.cxx | 372 -- .../tools/standalone/csfit/util/makefile.mk | 174 - xmlsecurity/tools/standalone/csfit/verifier.cxx | 342 -- xmlsecurity/tools/standalone/mscsfit/certmngr.cxx | 154 - xmlsecurity/tools/standalone/mscsfit/decrypter.cxx | 248 - xmlsecurity/tools/standalone/mscsfit/encrypter.cxx | 310 - xmlsecurity/tools/standalone/mscsfit/helper.cxx | 222 - xmlsecurity/tools/standalone/mscsfit/helper.hxx | 204 - xmlsecurity/tools/standalone/mscsfit/makefile.mk | 131 - xmlsecurity/tools/standalone/mscsfit/signer.cxx | 344 -- .../tools/standalone/mscsfit/util/makefile.mk | 174 - xmlsecurity/tools/standalone/mscsfit/verifier.cxx | 329 - xmlsecurity/tools/standalone/readme.txt | 19 - xmlsecurity/tools/uno/AdapterNode.java | 165 - xmlsecurity/tools/uno/AttributeListHelper.java | 148 - xmlsecurity/tools/uno/DomToTreeModelAdapter.java | 166 - xmlsecurity/tools/uno/EncryptionEntity.java | 218 - xmlsecurity/tools/uno/ParsingThread.java | 248 - xmlsecurity/tools/uno/SAXEventCollector.java | 195 - xmlsecurity/tools/uno/SAXEventPrinter.java | 320 - xmlsecurity/tools/uno/SecurityEntity.java | 202 - xmlsecurity/tools/uno/SignatureEntity.java | 288 - xmlsecurity/tools/uno/TestTool.java | 1392 ----- .../tools/uno/UnsolvedReferenceTableModel.java | 89 - xmlsecurity/tools/uno/XMLFileFilter.java | 79 - .../tools/uno/XMLSecurityFrameworkController.java | 1085 ---- xmlsecurity/tools/uno/XMLTreeCellRanderer.java | 85 - xmlsecurity/tools/uno/current.gif | Bin 94 -> 0 bytes xmlsecurity/tools/uno/makefile.mk | 48 - xmlsecurity/util/exports_xsmscrypt.dxp | 1 - xmlsecurity/util/exports_xsnss.dxp | 1 - xmlsecurity/util/makefile.mk | 205 - xmlsecurity/util/target.pmk | 31 - xmlsecurity/util/xmlsecurity.component | 37 - xmlsecurity/util/xsec_fw.component | 56 - xmlsecurity/util/xsec_fw.dxp | 1 - xmlsecurity/util/xsec_xmlsec.component | 56 - xmlsecurity/util/xsec_xmlsec.windows.component | 58 - xmlsecurity/util/xsecctl.flt | 19 - xmlsecurity/workben/makefile.mk | 70 - xmlsecurity/workben/signaturetest.cxx | 358 -- 3551 files changed, 20 insertions(+), 776298 deletions(-) delete mode 100644 .gitignore delete mode 100644 MathMLDTD/math.dtd delete mode 100644 MathMLDTD/prj/build.lst delete mode 100644 MathMLDTD/prj/d.lst delete mode 100644 MathMLDTD/w3c_ipr_software_notice.html create mode 100644 README delete mode 100644 UnoControls/inc/basecontainercontrol.hxx delete mode 100644 UnoControls/inc/basecontrol.hxx delete mode 100644 UnoControls/inc/multiplexer.hxx delete mode 100644 UnoControls/prj/build.lst delete mode 100644 UnoControls/prj/d.lst delete mode 100644 UnoControls/source/base/basecontainercontrol.cxx delete mode 100644 UnoControls/source/base/basecontrol.cxx delete mode 100644 UnoControls/source/base/makefile.mk delete mode 100644 UnoControls/source/base/multiplexer.cxx delete mode 100644 UnoControls/source/base/registercontrols.cxx delete mode 100644 UnoControls/source/controls/OConnectionPointContainerHelper.cxx delete mode 100644 UnoControls/source/controls/OConnectionPointHelper.cxx delete mode 100644 UnoControls/source/controls/framecontrol.cxx delete mode 100644 UnoControls/source/controls/makefile.mk delete mode 100644 UnoControls/source/controls/progressbar.cxx delete mode 100644 UnoControls/source/controls/progressmonitor.cxx delete mode 100644 UnoControls/source/controls/statusindicator.cxx delete mode 100644 UnoControls/source/inc/OConnectionPointContainerHelper.hxx delete mode 100644 UnoControls/source/inc/OConnectionPointHelper.hxx delete mode 100644 UnoControls/source/inc/framecontrol.hxx delete mode 100644 UnoControls/source/inc/progressbar.hxx delete mode 100644 UnoControls/source/inc/progressmonitor.hxx delete mode 100644 UnoControls/source/inc/statusindicator.hxx delete mode 100644 UnoControls/util/ctl.component delete mode 100644 UnoControls/util/makefile.mk delete mode 100644 UnoControls/util/makefile.pmk delete mode 100644 UnoControls/util/target.pmk delete mode 100755 accessibility/bridge/org/openoffice/accessibility/AccessBridge.java delete mode 100755 accessibility/bridge/org/openoffice/accessibility/KeyHandler.java delete mode 100644 accessibility/bridge/org/openoffice/accessibility/PopupWindow.java delete mode 100644 accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java delete mode 100644 accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component delete mode 100755 accessibility/bridge/org/openoffice/accessibility/makefile.mk delete mode 100755 accessibility/bridge/org/openoffice/accessibility/manifest delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleRoleAdapter.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Alert.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Application.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Button.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Component.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Container.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Dialog.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Frame.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Icon.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Label.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/List.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Menu.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Separator.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Table.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Tree.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/Window.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java delete mode 100644 accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java delete mode 100755 accessibility/bridge/org/openoffice/java/accessibility/makefile.mk delete mode 100644 accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx delete mode 100644 accessibility/bridge/source/java/exports.dxp delete mode 100644 accessibility/bridge/source/java/makefile.mk delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControl.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessiblelistbox.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletabbar.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletabbarbase.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletabbarpage.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletablistbox.hxx delete mode 100644 accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx delete mode 100644 accessibility/inc/accessibility/extended/listboxaccessible.hxx delete mode 100644 accessibility/inc/accessibility/extended/textwindowaccessibility.hxx delete mode 100644 accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx delete mode 100644 accessibility/inc/accessibility/helper/acc_factory.hxx delete mode 100644 accessibility/inc/accessibility/helper/accessiblestrings.hrc delete mode 100644 accessibility/inc/accessibility/helper/accresmgr.hxx delete mode 100644 accessibility/inc/accessibility/helper/characterattributeshelper.hxx delete mode 100644 accessibility/inc/accessibility/helper/listboxhelper.hxx delete mode 100644 accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx delete mode 100644 accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx delete mode 100644 accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx delete mode 100644 accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx delete mode 100644 accessibility/inc/makefile.mk delete mode 100644 accessibility/inc/pch/precompiled_accessibility.cxx delete mode 100644 accessibility/inc/pch/precompiled_accessibility.hxx delete mode 100644 accessibility/prj/build.lst delete mode 100644 accessibility/prj/d.lst delete mode 100644 accessibility/prj/l10n delete mode 100644 accessibility/source/extended/AccessibleBrowseBox.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxBase.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxTable.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx delete mode 100644 accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControl.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlBase.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlHeader.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlHeaderCell.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlTable.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlTableBase.cxx delete mode 100644 accessibility/source/extended/AccessibleGridControlTableCell.cxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeck.cxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx delete mode 100644 accessibility/source/extended/accessiblebrowseboxcell.cxx delete mode 100644 accessibility/source/extended/accessibleeditbrowseboxcell.cxx delete mode 100644 accessibility/source/extended/accessibleiconchoicectrl.cxx delete mode 100644 accessibility/source/extended/accessibleiconchoicectrlentry.cxx delete mode 100644 accessibility/source/extended/accessiblelistbox.cxx delete mode 100644 accessibility/source/extended/accessiblelistboxentry.cxx delete mode 100644 accessibility/source/extended/accessibletabbar.cxx delete mode 100644 accessibility/source/extended/accessibletabbarbase.cxx delete mode 100644 accessibility/source/extended/accessibletabbarpage.cxx delete mode 100644 accessibility/source/extended/accessibletabbarpagelist.cxx delete mode 100644 accessibility/source/extended/accessibletablistbox.cxx delete mode 100644 accessibility/source/extended/accessibletablistboxtable.cxx delete mode 100644 accessibility/source/extended/listboxaccessible.cxx delete mode 100755 accessibility/source/extended/makefile.mk delete mode 100644 accessibility/source/extended/textwindowaccessibility.cxx delete mode 100644 accessibility/source/helper/acc_factory.cxx delete mode 100644 accessibility/source/helper/accessiblestrings.src delete mode 100644 accessibility/source/helper/accresmgr.cxx delete mode 100644 accessibility/source/helper/characterattributeshelper.cxx delete mode 100644 accessibility/source/helper/makefile.mk delete mode 100644 accessibility/source/inc/floatingwindowaccessible.hxx delete mode 100644 accessibility/source/standard/accessiblemenubasecomponent.cxx delete mode 100644 accessibility/source/standard/accessiblemenucomponent.cxx delete mode 100644 accessibility/source/standard/accessiblemenuitemcomponent.cxx delete mode 100644 accessibility/source/standard/floatingwindowaccessible.cxx delete mode 100644 accessibility/source/standard/makefile.mk delete mode 100644 accessibility/source/standard/vclxaccessiblebox.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblebutton.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblecheckbox.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblecombobox.cxx delete mode 100644 accessibility/source/standard/vclxaccessibledropdowncombobox.cxx delete mode 100644 accessibility/source/standard/vclxaccessibledropdownlistbox.cxx delete mode 100644 accessibility/source/standard/vclxaccessibleedit.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblefixedtext.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblelist.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblelistbox.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblelistitem.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblemenu.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblemenubar.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblemenuitem.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblemenuseparator.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblepopupmenu.cxx delete mode 100644 accessibility/source/standard/vclxaccessibleradiobutton.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblescrollbar.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblestatusbar.cxx delete mode 100644 accessibility/source/standard/vclxaccessiblestatusbaritem.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletabcontrol.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletabpage.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletabpagewindow.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletextcomponent.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletextfield.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletoolbox.cxx delete mode 100644 accessibility/source/standard/vclxaccessibletoolboxitem.cxx delete mode 100644 accessibility/util/acc.map delete mode 100644 accessibility/util/makefile.mk delete mode 100644 accessibility/workben/TODO delete mode 100644 accessibility/workben/makefile delete mode 100644 accessibility/workben/makefile.in delete mode 100644 accessibility/workben/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/manifest delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/Connector.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/Makefile delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/Options.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/makefile.common delete mode 100644 accessibility/workben/org/openoffice/accessibility/misc/makefile.mk delete mode 100644 automation/inc/automation/automation.hxx delete mode 100644 automation/inc/automation/commdefines.hxx delete mode 100644 automation/inc/automation/commtypes.hxx delete mode 100644 automation/inc/automation/communi.hxx delete mode 100644 automation/inc/automation/simplecm.hxx delete mode 100644 automation/inc/makefile.mk delete mode 100644 automation/inc/pch/precompiled_automation.cxx delete mode 100644 automation/inc/pch/precompiled_automation.hxx delete mode 100644 automation/packimages/makefile.mk delete mode 100644 automation/prj/build.lst delete mode 100644 automation/prj/d.lst delete mode 100644 automation/prj/l10n delete mode 100644 automation/source/app/makefile.mk delete mode 100644 automation/source/app/testbasi.cxx delete mode 100644 automation/source/app/testbasi.hxx delete mode 100644 automation/source/communi/communi.cxx delete mode 100644 automation/source/communi/makefile.mk delete mode 100644 automation/source/inc/cmdbasestream.hxx delete mode 100644 automation/source/inc/icommstream.hxx delete mode 100644 automation/source/inc/ittresid.hxx delete mode 100644 automation/source/inc/rcontrol.hxx delete mode 100644 automation/source/inc/svcommstream.hxx delete mode 100644 automation/source/inc/testapp.hxx delete mode 100644 automation/source/inc/testtool.hxx delete mode 100644 automation/source/miniapp/editwin.cxx delete mode 100644 automation/source/miniapp/editwin.hxx delete mode 100644 automation/source/miniapp/hid.lst delete mode 100644 automation/source/miniapp/makefile.mk delete mode 100644 automation/source/miniapp/servres.cxx delete mode 100644 automation/source/miniapp/servres.hrc delete mode 100644 automation/source/miniapp/servres.hxx delete mode 100644 automation/source/miniapp/servres.src delete mode 100644 automation/source/miniapp/servuid.hxx delete mode 100644 automation/source/miniapp/test.bas delete mode 100644 automation/source/miniapp/test.sid delete mode 100644 automation/source/miniapp/test.win delete mode 100644 automation/source/miniapp/testapp.cxx delete mode 100644 automation/source/miniapp/testapp.hxx delete mode 100644 automation/source/mozillaserver/makefile.mk delete mode 100644 automation/source/mozillaserver/mozillatesttoolserver.idl delete mode 100644 automation/source/mozillaserver/xmozillatesttoolserver.idl delete mode 100644 automation/source/server/XMLParser.cxx delete mode 100644 automation/source/server/cmdbasestream.cxx delete mode 100644 automation/source/server/editwin.cxx delete mode 100644 automation/source/server/editwin.hxx delete mode 100644 automation/source/server/makefile.mk delete mode 100644 automation/source/server/prof_nul.cxx delete mode 100644 automation/source/server/prof_usl.cxx delete mode 100644 automation/source/server/profiler.cxx delete mode 100644 automation/source/server/profiler.hxx delete mode 100644 automation/source/server/recorder.cxx delete mode 100644 automation/source/server/recorder.hxx delete mode 100644 automation/source/server/retstrm.cxx delete mode 100644 automation/source/server/retstrm.hxx delete mode 100644 automation/source/server/scmdstrm.cxx delete mode 100644 automation/source/server/scmdstrm.hxx delete mode 100644 automation/source/server/server.cxx delete mode 100644 automation/source/server/server.hxx delete mode 100644 automation/source/server/sta_list.cxx delete mode 100644 automation/source/server/statemnt.cxx delete mode 100644 automation/source/server/statemnt.hxx delete mode 100644 automation/source/server/svcommstream.cxx delete mode 100644 automation/source/server/testtool.hrc delete mode 100644 automation/source/simplecm/communiio.hxx delete mode 100644 automation/source/simplecm/makefile.mk delete mode 100644 automation/source/simplecm/packethandler.cxx delete mode 100644 automation/source/simplecm/packethandler.hxx delete mode 100644 automation/source/simplecm/simplecm.cxx delete mode 100644 automation/source/simplecm/tcpio.cxx delete mode 100644 automation/source/simplecm/tcpio.hxx delete mode 100644 automation/source/testtool/cmdstrm.cxx delete mode 100644 automation/source/testtool/cmdstrm.hxx delete mode 100644 automation/source/testtool/comm_bas.cxx delete mode 100644 automation/source/testtool/comm_bas.hxx delete mode 100644 automation/source/testtool/cretstrm.cxx delete mode 100644 automation/source/testtool/cretstrm.hxx delete mode 100644 automation/source/testtool/filter.pl delete mode 100644 automation/source/testtool/httprequest.cxx delete mode 100644 automation/source/testtool/httprequest.hxx delete mode 100644 automation/source/testtool/makefile.mk delete mode 100644 automation/source/testtool/objtest.cxx delete mode 100644 automation/source/testtool/objtest.hxx delete mode 100644 automation/source/testtool/registry_win.cxx delete mode 100644 automation/source/testtool/registry_win.hxx delete mode 100644 automation/source/testtool/sysdir_win.cxx delete mode 100644 automation/source/testtool/sysdir_win.hxx delete mode 100644 automation/source/testtool/tcommuni.cxx delete mode 100644 automation/source/testtool/tcommuni.hxx delete mode 100644 automation/source/testtool/testtool.ini delete mode 100644 automation/util/makefile.mk delete mode 100644 automation/util/manually_added_ids.hid delete mode 100644 basctl/AllLangResTarget_basctl.mk delete mode 100644 basctl/Library_basctl.mk delete mode 100644 basctl/Makefile delete mode 100644 basctl/Module_basctl.mk delete mode 100644 basctl/Package_xml.mk delete mode 100644 basctl/inc/basidesh.hrc delete mode 100644 basctl/inc/helpid.hrc delete mode 100644 basctl/inc/iderdll.hxx delete mode 100644 basctl/inc/pch/precompiled_basctl.cxx delete mode 100644 basctl/inc/pch/precompiled_basctl.hxx delete mode 100644 basctl/prj/build.lst delete mode 100644 basctl/prj/d.lst delete mode 100644 basctl/prj/makefile.mk delete mode 100644 basctl/sdi/baside.sdi delete mode 100644 basctl/sdi/basslots.hrc delete mode 100644 basctl/sdi/basslots.sdi delete mode 100644 basctl/source/accessibility/accessibledialogcontrolshape.cxx delete mode 100644 basctl/source/accessibility/accessibledialogwindow.cxx delete mode 100644 basctl/source/basicide/basdoc.cxx delete mode 100644 basctl/source/basicide/basdoc.hxx delete mode 100644 basctl/source/basicide/basicbox.cxx delete mode 100644 basctl/source/basicide/basicbox.hxx delete mode 100644 basctl/source/basicide/basicmod.hxx delete mode 100644 basctl/source/basicide/basicprint.src delete mode 100644 basctl/source/basicide/basicrenderable.cxx delete mode 100644 basctl/source/basicide/basicrenderable.hxx delete mode 100644 basctl/source/basicide/baside2.cxx delete mode 100644 basctl/source/basicide/baside2.hrc delete mode 100644 basctl/source/basicide/baside2.hxx delete mode 100644 basctl/source/basicide/baside2b.cxx delete mode 100644 basctl/source/basicide/baside3.cxx delete mode 100644 basctl/source/basicide/basidectrlr.cxx delete mode 100644 basctl/source/basicide/basides1.cxx delete mode 100644 basctl/source/basicide/basides2.cxx delete mode 100644 basctl/source/basicide/basides3.cxx delete mode 100644 basctl/source/basicide/basidesh.cxx delete mode 100644 basctl/source/basicide/basidesh.src delete mode 100644 basctl/source/basicide/basobj2.cxx delete mode 100644 basctl/source/basicide/basobj3.cxx delete mode 100644 basctl/source/basicide/bastype2.cxx delete mode 100644 basctl/source/basicide/bastype2.hxx delete mode 100644 basctl/source/basicide/bastype3.cxx delete mode 100644 basctl/source/basicide/bastype3.hxx delete mode 100644 basctl/source/basicide/bastype4.hxx delete mode 100644 basctl/source/basicide/bastypes.cxx delete mode 100644 basctl/source/basicide/brkdlg.cxx delete mode 100644 basctl/source/basicide/brkdlg.hrc delete mode 100644 basctl/source/basicide/brkdlg.hxx delete mode 100644 basctl/source/basicide/brkdlg.src delete mode 100644 basctl/source/basicide/doceventnotifier.cxx delete mode 100644 basctl/source/basicide/docsignature.cxx delete mode 100644 basctl/source/basicide/documentenumeration.cxx delete mode 100644 basctl/source/basicide/documentenumeration.hxx delete mode 100644 basctl/source/basicide/ide_pch.cxx delete mode 100644 basctl/source/basicide/ide_pch.hxx delete mode 100644 basctl/source/basicide/iderdll.cxx delete mode 100644 basctl/source/basicide/iderdll2.hxx delete mode 100644 basctl/source/basicide/idetemp.hxx delete mode 100644 basctl/source/basicide/localizationmgr.cxx delete mode 100644 basctl/source/basicide/macrodlg.cxx delete mode 100644 basctl/source/basicide/macrodlg.hrc delete mode 100644 basctl/source/basicide/macrodlg.hxx delete mode 100644 basctl/source/basicide/macrodlg.src delete mode 100644 basctl/source/basicide/moduldl2.cxx delete mode 100644 basctl/source/basicide/moduldlg.cxx delete mode 100644 basctl/source/basicide/moduldlg.hrc delete mode 100644 basctl/source/basicide/moduldlg.hxx delete mode 100644 basctl/source/basicide/moduldlg.src delete mode 100644 basctl/source/basicide/moptions.hrc delete mode 100644 basctl/source/basicide/moptions.src delete mode 100644 basctl/source/basicide/objdlg.cxx delete mode 100644 basctl/source/basicide/objdlg.hrc delete mode 100644 basctl/source/basicide/objdlg.hxx delete mode 100644 basctl/source/basicide/objdlg.src delete mode 100644 basctl/source/basicide/register.cxx delete mode 100644 basctl/source/basicide/scriptdocument.cxx delete mode 100644 basctl/source/basicide/tbxctl.cxx delete mode 100644 basctl/source/basicide/tbxctl.hrc delete mode 100644 basctl/source/basicide/tbxctl.hxx delete mode 100644 basctl/source/basicide/unomodel.cxx delete mode 100644 basctl/source/basicide/unomodel.hxx delete mode 100644 basctl/source/dlged/dlged.cxx delete mode 100644 basctl/source/dlged/dlgedclip.cxx delete mode 100644 basctl/source/dlged/dlgedfac.cxx delete mode 100644 basctl/source/dlged/dlgedfunc.cxx delete mode 100644 basctl/source/dlged/dlgedlist.cxx delete mode 100644 basctl/source/dlged/dlgedmod.cxx delete mode 100644 basctl/source/dlged/dlgedobj.cxx delete mode 100644 basctl/source/dlged/dlgedpage.cxx delete mode 100644 basctl/source/dlged/dlgedview.cxx delete mode 100644 basctl/source/dlged/dlgresid.src delete mode 100644 basctl/source/dlged/managelang.cxx delete mode 100644 basctl/source/dlged/managelang.hrc delete mode 100644 basctl/source/dlged/managelang.src delete mode 100644 basctl/source/dlged/propbrw.cxx delete mode 100644 basctl/source/inc/accessibledialogcontrolshape.hxx delete mode 100644 basctl/source/inc/accessibledialogwindow.hxx delete mode 100644 basctl/source/inc/baside3.hxx delete mode 100644 basctl/source/inc/basidectrlr.hxx delete mode 100644 basctl/source/inc/basidesh.hxx delete mode 100644 basctl/source/inc/basobj.hxx delete mode 100644 basctl/source/inc/bastypes.hxx delete mode 100644 basctl/source/inc/dlged.hxx delete mode 100644 basctl/source/inc/dlgedclip.hxx delete mode 100644 basctl/source/inc/dlgeddef.hxx delete mode 100644 basctl/source/inc/dlgedfac.hxx delete mode 100644 basctl/source/inc/dlgedfunc.hxx delete mode 100644 basctl/source/inc/dlgedlist.hxx delete mode 100644 basctl/source/inc/dlgedmod.hxx delete mode 100644 basctl/source/inc/dlgedobj.hxx delete mode 100644 basctl/source/inc/dlgedpage.hxx delete mode 100644 basctl/source/inc/dlgedview.hxx delete mode 100644 basctl/source/inc/dlgresid.hrc delete mode 100644 basctl/source/inc/doceventnotifier.hxx delete mode 100644 basctl/source/inc/docsignature.hxx delete mode 100644 basctl/source/inc/iderid.hxx delete mode 100644 basctl/source/inc/localizationmgr.hxx delete mode 100644 basctl/source/inc/managelang.hxx delete mode 100644 basctl/source/inc/propbrw.hxx delete mode 100644 basctl/source/inc/sbxitem.hxx delete mode 100644 basctl/source/inc/scriptdocument.hxx delete mode 100644 basctl/source/inc/svheader.hxx delete mode 100644 basctl/uiconfig/basicide/menubar/menubar.xml delete mode 100644 basctl/uiconfig/basicide/statusbar/statusbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/dialogbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/findbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/fullscreenbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/insertcontrolsbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/macrobar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/standardbar.xml delete mode 100644 basctl/uiconfig/basicide/toolbar/translationbar.xml delete mode 100644 basctl/util/basctl.component delete mode 100644 basctl/util/basctl.xml delete mode 100644 bean/com/sun/star/beans/ContainerFactory.java delete mode 100644 bean/com/sun/star/beans/JavaWindowPeerFake.java delete mode 100644 bean/com/sun/star/beans/LocalOfficeConnection.java delete mode 100644 bean/com/sun/star/beans/LocalOfficeWindow.java delete mode 100644 bean/com/sun/star/beans/NativeConnection.java delete mode 100644 bean/com/sun/star/beans/NativeService.java delete mode 100644 bean/com/sun/star/beans/OfficeConnection.java delete mode 100644 bean/com/sun/star/beans/OfficeWindow.java delete mode 100644 bean/com/sun/star/beans/makefile.mk delete mode 100644 bean/com/sun/star/comp/beans/CallWatchThread.java delete mode 100644 bean/com/sun/star/comp/beans/ContainerFactory.java delete mode 100644 bean/com/sun/star/comp/beans/Controller.java delete mode 100644 bean/com/sun/star/comp/beans/Frame.java delete mode 100644 bean/com/sun/star/comp/beans/HasConnectionException.java delete mode 100644 bean/com/sun/star/comp/beans/InvalidArgumentException.java delete mode 100644 bean/com/sun/star/comp/beans/JavaWindowPeerFake.java delete mode 100644 bean/com/sun/star/comp/beans/LocalOfficeConnection.java delete mode 100644 bean/com/sun/star/comp/beans/LocalOfficeWindow.java delete mode 100644 bean/com/sun/star/comp/beans/NativeConnection.java delete mode 100644 bean/com/sun/star/comp/beans/NativeService.java delete mode 100644 bean/com/sun/star/comp/beans/NoConnectionException.java delete mode 100644 bean/com/sun/star/comp/beans/NoDocumentException.java delete mode 100644 bean/com/sun/star/comp/beans/OOoBean.java delete mode 100644 bean/com/sun/star/comp/beans/OfficeConnection.java delete mode 100644 bean/com/sun/star/comp/beans/OfficeDocument.java delete mode 100644 bean/com/sun/star/comp/beans/OfficeWindow.java delete mode 100644 bean/com/sun/star/comp/beans/SystemWindowException.java delete mode 100644 bean/com/sun/star/comp/beans/Wrapper.java delete mode 100644 bean/com/sun/star/comp/beans/makefile.mk delete mode 100644 bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c delete mode 100644 bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c delete mode 100644 bean/native/unix/makefile.mk delete mode 100644 bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c delete mode 100644 bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c delete mode 100644 bean/native/win32/makefile.mk delete mode 100644 bean/native/win32/officebean.dxp delete mode 100644 bean/prj/build.lst delete mode 100644 bean/prj/d.lst delete mode 100644 bean/qa/complex/bean/OOoBeanTest.java delete mode 100644 bean/qa/complex/bean/ScreenComparer.java delete mode 100644 bean/qa/complex/bean/WriterFrame.java delete mode 100644 bean/qa/complex/bean/makefile.mk delete mode 100644 bean/test/Test.java delete mode 100644 bean/test/applet/oooapplet/OOoViewer.java delete mode 100644 bean/test/applet/oooapplet/bean.policy delete mode 100644 bean/test/applet/oooapplet/example.html delete mode 100644 bean/test/applet/oooapplet/makefile.mk delete mode 100644 bean/test/makefile.mk delete mode 100644 bean/util/delzip delete mode 100644 bean/util/makefile.mk delete mode 100644 crashrep/prj/build.lst delete mode 100644 crashrep/prj/d.lst delete mode 100644 crashrep/source/all/crashrep.ulf delete mode 100644 crashrep/source/all/makefile.mk delete mode 100644 crashrep/source/unx/main.cxx delete mode 100755 crashrep/source/unx/makefile.mk delete mode 100644 crashrep/source/win32/base64.cpp delete mode 100644 crashrep/source/win32/base64.h delete mode 100755 crashrep/source/win32/ctrylnglist.txt delete mode 100644 crashrep/source/win32/makefile.mk delete mode 100755 crashrep/source/win32/rcfooter.txt delete mode 100755 crashrep/source/win32/rcheader.txt delete mode 100755 crashrep/source/win32/rctemplate.txt delete mode 100644 crashrep/source/win32/resource.h delete mode 100644 crashrep/source/win32/soreport.cpp delete mode 100644 cui/AllLangResTarget_cui.mk delete mode 100644 cui/Library_cui.mk delete mode 100644 cui/Makefile delete mode 100644 cui/Module_cui.mk delete mode 100644 cui/prj/build.lst delete mode 100644 cui/prj/d.lst delete mode 100755 cui/prj/makefile.mk delete mode 100644 cui/source/customize/acccfg.cxx delete mode 100644 cui/source/customize/acccfg.hrc delete mode 100644 cui/source/customize/acccfg.src delete mode 100644 cui/source/customize/cfg.cxx delete mode 100644 cui/source/customize/cfg.hrc delete mode 100644 cui/source/customize/cfg.src delete mode 100644 cui/source/customize/cfgutil.cxx delete mode 100644 cui/source/customize/eventdlg.cxx delete mode 100644 cui/source/customize/eventdlg.hrc delete mode 100644 cui/source/customize/eventdlg.hxx delete mode 100644 cui/source/customize/eventdlg.src delete mode 100644 cui/source/customize/macropg.cxx delete mode 100644 cui/source/customize/macropg.hrc delete mode 100644 cui/source/customize/macropg.src delete mode 100644 cui/source/customize/macropg_impl.hxx delete mode 100644 cui/source/customize/selector.cxx delete mode 100644 cui/source/customize/selector.hrc delete mode 100644 cui/source/customize/selector.src delete mode 100644 cui/source/dialogs/SpellAttrib.cxx delete mode 100644 cui/source/dialogs/SpellAttrib.hxx delete mode 100644 cui/source/dialogs/SpellDialog.cxx delete mode 100644 cui/source/dialogs/SpellDialog.hrc delete mode 100644 cui/source/dialogs/SpellDialog.src delete mode 100644 cui/source/dialogs/about.cxx delete mode 100644 cui/source/dialogs/about.hrc delete mode 100644 cui/source/dialogs/about.src delete mode 100644 cui/source/dialogs/charmap.hrc delete mode 100644 cui/source/dialogs/charmap.src delete mode 100644 cui/source/dialogs/colorpicker.cxx delete mode 100644 cui/source/dialogs/colorpicker.hrc delete mode 100644 cui/source/dialogs/colorpicker.src delete mode 100644 cui/source/dialogs/commonlingui.cxx delete mode 100644 cui/source/dialogs/commonlingui.hxx delete mode 100644 cui/source/dialogs/commonlingui.src delete mode 100644 cui/source/dialogs/cuicharmap.cxx delete mode 100644 cui/source/dialogs/cuifmsearch.cxx delete mode 100644 cui/source/dialogs/cuigaldlg.cxx delete mode 100644 cui/source/dialogs/cuigrfflt.cxx delete mode 100644 cui/source/dialogs/cuihyperdlg.cxx delete mode 100644 cui/source/dialogs/cuiimapdlg.hrc delete mode 100644 cui/source/dialogs/cuiimapdlg.src delete mode 100644 cui/source/dialogs/cuiimapwnd.cxx delete mode 100644 cui/source/dialogs/cuitbxform.cxx delete mode 100644 cui/source/dialogs/dlgname.cxx delete mode 100644 cui/source/dialogs/dlgname.hrc delete mode 100644 cui/source/dialogs/dlgname.src delete mode 100644 cui/source/dialogs/fmsearch.hrc delete mode 100644 cui/source/dialogs/fmsearch.src delete mode 100644 cui/source/dialogs/gallery.src delete mode 100644 cui/source/dialogs/grfflt.hrc delete mode 100644 cui/source/dialogs/grfflt.src delete mode 100644 cui/source/dialogs/hangulhanjadlg.cxx delete mode 100644 cui/source/dialogs/hangulhanjadlg.hrc delete mode 100644 cui/source/dialogs/hangulhanjadlg.src delete mode 100644 cui/source/dialogs/hldocntp.cxx delete mode 100644 cui/source/dialogs/hldoctp.cxx delete mode 100644 cui/source/dialogs/hlinettp.cxx delete mode 100644 cui/source/dialogs/hlmailtp.cxx delete mode 100644 cui/source/dialogs/hlmarkwn.cxx delete mode 100644 cui/source/dialogs/hlmarkwn.hrc delete mode 100644 cui/source/dialogs/hlmarkwn.src delete mode 100644 cui/source/dialogs/hltpbase.cxx delete mode 100644 cui/source/dialogs/hyperdlg.hrc delete mode 100644 cui/source/dialogs/hyperdlg.src delete mode 100644 cui/source/dialogs/hyphen.cxx delete mode 100644 cui/source/dialogs/hyphen.hrc delete mode 100644 cui/source/dialogs/hyphen.src delete mode 100644 cui/source/dialogs/iconcdlg.cxx delete mode 100644 cui/source/dialogs/iconcdlg.src delete mode 100644 cui/source/dialogs/insdlg.cxx delete mode 100644 cui/source/dialogs/insrc.cxx delete mode 100644 cui/source/dialogs/insrc.hrc delete mode 100644 cui/source/dialogs/insrc.src delete mode 100644 cui/source/dialogs/linkdlg.cxx delete mode 100644 cui/source/dialogs/multifil.cxx delete mode 100644 cui/source/dialogs/multipat.cxx delete mode 100644 cui/source/dialogs/multipat.hrc delete mode 100644 cui/source/dialogs/multipat.src delete mode 100644 cui/source/dialogs/newtabledlg.cxx delete mode 100644 cui/source/dialogs/newtabledlg.hrc delete mode 100644 cui/source/dialogs/newtabledlg.src delete mode 100644 cui/source/dialogs/passwdomdlg.cxx delete mode 100755 cui/source/dialogs/passwdomdlg.hrc delete mode 100644 cui/source/dialogs/passwdomdlg.src delete mode 100644 cui/source/dialogs/pastedlg.cxx delete mode 100644 cui/source/dialogs/plfilter.cxx delete mode 100644 cui/source/dialogs/postdlg.cxx delete mode 100644 cui/source/dialogs/postdlg.hrc delete mode 100644 cui/source/dialogs/postdlg.src delete mode 100644 cui/source/dialogs/scriptdlg.cxx delete mode 100644 cui/source/dialogs/scriptdlg.hrc delete mode 100644 cui/source/dialogs/scriptdlg.src delete mode 100644 cui/source/dialogs/sdrcelldlg.cxx delete mode 100644 cui/source/dialogs/sdrcelldlg.src delete mode 100644 cui/source/dialogs/showcols.cxx delete mode 100644 cui/source/dialogs/showcols.src delete mode 100644 cui/source/dialogs/splitcelldlg.cxx delete mode 100644 cui/source/dialogs/splitcelldlg.hrc delete mode 100644 cui/source/dialogs/splitcelldlg.src delete mode 100644 cui/source/dialogs/srchxtra.cxx delete mode 100644 cui/source/dialogs/srchxtra.hrc delete mode 100644 cui/source/dialogs/srchxtra.src delete mode 100644 cui/source/dialogs/svuidlg.hrc delete mode 100644 cui/source/dialogs/svuidlg.src delete mode 100644 cui/source/dialogs/tbxform.src delete mode 100644 cui/source/dialogs/thesdlg.cxx delete mode 100644 cui/source/dialogs/thesdlg.hrc delete mode 100644 cui/source/dialogs/thesdlg.src delete mode 100644 cui/source/dialogs/thesdlg_impl.hxx delete mode 100644 cui/source/dialogs/winpluginlib.cxx delete mode 100644 cui/source/dialogs/zoom.cxx delete mode 100644 cui/source/dialogs/zoom.hrc delete mode 100644 cui/source/dialogs/zoom.src delete mode 100644 cui/source/factory/cuiexp.cxx delete mode 100644 cui/source/factory/cuiresmgr.cxx delete mode 100644 cui/source/factory/dlgfact.cxx delete mode 100644 cui/source/factory/dlgfact.hxx delete mode 100644 cui/source/factory/init.cxx delete mode 100644 cui/source/inc/ControlFocusHelper.hxx delete mode 100644 cui/source/inc/SpellDialog.hxx delete mode 100644 cui/source/inc/about.hxx delete mode 100644 cui/source/inc/acccfg.hxx delete mode 100644 cui/source/inc/align.hxx delete mode 100644 cui/source/inc/autocdlg.hxx delete mode 100644 cui/source/inc/backgrnd.hxx delete mode 100644 cui/source/inc/bbdlg.hxx delete mode 100644 cui/source/inc/border.hxx delete mode 100644 cui/source/inc/cfg.hxx delete mode 100644 cui/source/inc/cfgutil.hxx delete mode 100644 cui/source/inc/chardlg.hxx delete mode 100644 cui/source/inc/connect.hxx delete mode 100644 cui/source/inc/cuicharmap.hxx delete mode 100644 cui/source/inc/cuifmsearch.hxx delete mode 100644 cui/source/inc/cuigaldlg.hxx delete mode 100644 cui/source/inc/cuigrfflt.hxx delete mode 100644 cui/source/inc/cuihyperdlg.hxx delete mode 100644 cui/source/inc/cuiimapwnd.hxx delete mode 100644 cui/source/inc/cuioptgenrl.hxx delete mode 100644 cui/source/inc/cuires.hrc delete mode 100644 cui/source/inc/cuisrchdlg.hxx delete mode 100644 cui/source/inc/cuitabarea.hxx delete mode 100644 cui/source/inc/cuitabline.hxx delete mode 100644 cui/source/inc/cuitbxform.hxx delete mode 100644 cui/source/inc/dbregister.hxx delete mode 100644 cui/source/inc/defdlgname.hxx delete mode 100644 cui/source/inc/dialmgr.hxx delete mode 100644 cui/source/inc/dlgname.hxx delete mode 100644 cui/source/inc/dstribut.hxx delete mode 100644 cui/source/inc/gallery.hrc delete mode 100644 cui/source/inc/grfpage.hxx delete mode 100644 cui/source/inc/hangulhanjadlg.hxx delete mode 100644 cui/source/inc/headertablistbox.hxx delete mode 100644 cui/source/inc/helpid.hrc delete mode 100644 cui/source/inc/hldocntp.hxx delete mode 100644 cui/source/inc/hldoctp.hxx delete mode 100644 cui/source/inc/hlinettp.hxx delete mode 100644 cui/source/inc/hlmailtp.hxx delete mode 100644 cui/source/inc/hlmarkwn.hxx delete mode 100644 cui/source/inc/hlmarkwn_def.hxx delete mode 100644 cui/source/inc/hltpbase.hxx delete mode 100644 cui/source/inc/hyphen.hxx delete mode 100644 cui/source/inc/iconcdlg.hxx delete mode 100644 cui/source/inc/insdlg.hxx delete mode 100644 cui/source/inc/insrc.hxx delete mode 100644 cui/source/inc/internationaloptions.hxx delete mode 100644 cui/source/inc/labdlg.hxx delete mode 100644 cui/source/inc/linkdlg.hxx delete mode 100644 cui/source/inc/macroass.hxx delete mode 100644 cui/source/inc/macropg.hxx delete mode 100644 cui/source/inc/measure.hxx delete mode 100644 cui/source/inc/multifil.hxx delete mode 100644 cui/source/inc/multipat.hxx delete mode 100644 cui/source/inc/newtabledlg.hxx delete mode 100644 cui/source/inc/numfmt.hxx delete mode 100644 cui/source/inc/numpages.hxx delete mode 100644 cui/source/inc/optasian.hxx delete mode 100644 cui/source/inc/optdict.hxx delete mode 100644 cui/source/inc/optimprove.hxx delete mode 100644 cui/source/inc/optlingu.hxx delete mode 100644 cui/source/inc/optpath.hxx delete mode 100644 cui/source/inc/page.hxx delete mode 100644 cui/source/inc/paragrph.hxx delete mode 100644 cui/source/inc/passwdomdlg.hxx delete mode 100644 cui/source/inc/pastedlg.hxx delete mode 100644 cui/source/inc/postdlg.hxx delete mode 100644 cui/source/inc/radiobtnbox.hxx delete mode 100644 cui/source/inc/scriptdlg.hxx delete mode 100644 cui/source/inc/sdrcelldlg.hxx delete mode 100644 cui/source/inc/selector.hxx delete mode 100644 cui/source/inc/showcols.hxx delete mode 100644 cui/source/inc/splitcelldlg.hxx delete mode 100644 cui/source/inc/srchxtra.hxx delete mode 100644 cui/source/inc/tabstpge.hxx delete mode 100644 cui/source/inc/textanim.hxx delete mode 100644 cui/source/inc/textattr.hxx delete mode 100644 cui/source/inc/thesdlg.hxx delete mode 100644 cui/source/inc/transfrm.hxx delete mode 100644 cui/source/inc/treeopt.hxx delete mode 100644 cui/source/inc/zoom.hxx delete mode 100644 cui/source/options/cfgchart.cxx delete mode 100644 cui/source/options/cfgchart.hxx delete mode 100644 cui/source/options/connpoolconfig.cxx delete mode 100644 cui/source/options/connpoolconfig.hxx delete mode 100644 cui/source/options/connpooloptions.cxx delete mode 100644 cui/source/options/connpooloptions.hrc delete mode 100644 cui/source/options/connpooloptions.hxx delete mode 100644 cui/source/options/connpooloptions.src delete mode 100644 cui/source/options/connpoolsettings.cxx delete mode 100644 cui/source/options/connpoolsettings.hxx delete mode 100644 cui/source/options/cuisrchdlg.cxx delete mode 100644 cui/source/options/dbregister.cxx delete mode 100644 cui/source/options/dbregister.hrc delete mode 100644 cui/source/options/dbregister.src delete mode 100644 cui/source/options/dbregisterednamesconfig.cxx delete mode 100644 cui/source/options/dbregisterednamesconfig.hxx delete mode 100644 cui/source/options/dbregistersettings.cxx delete mode 100644 cui/source/options/dbregistersettings.hxx delete mode 100644 cui/source/options/doclinkdialog.cxx delete mode 100644 cui/source/options/doclinkdialog.hrc delete mode 100644 cui/source/options/doclinkdialog.hxx delete mode 100644 cui/source/options/doclinkdialog.src delete mode 100644 cui/source/options/fontsubs.cxx delete mode 100644 cui/source/options/fontsubs.hrc delete mode 100644 cui/source/options/fontsubs.hxx delete mode 100644 cui/source/options/fontsubs.src delete mode 100644 cui/source/options/internationaloptions.cxx delete mode 100644 cui/source/options/internationaloptions.hrc delete mode 100644 cui/source/options/internationaloptions.src delete mode 100644 cui/source/options/optHeaderTabListbox.cxx delete mode 100644 cui/source/options/optHeaderTabListbox.hxx delete mode 100644 cui/source/options/optaccessibility.cxx delete mode 100644 cui/source/options/optaccessibility.hrc delete mode 100644 cui/source/options/optaccessibility.hxx delete mode 100644 cui/source/options/optaccessibility.src delete mode 100644 cui/source/options/optasian.cxx delete mode 100644 cui/source/options/optasian.hrc delete mode 100644 cui/source/options/optasian.src delete mode 100644 cui/source/options/optchart.cxx delete mode 100644 cui/source/options/optchart.hrc delete mode 100644 cui/source/options/optchart.hxx delete mode 100644 cui/source/options/optchart.src delete mode 100644 cui/source/options/optcolor.cxx delete mode 100644 cui/source/options/optcolor.hrc delete mode 100644 cui/source/options/optcolor.hxx delete mode 100644 cui/source/options/optcolor.src delete mode 100644 cui/source/options/optctl.cxx delete mode 100644 cui/source/options/optctl.hrc delete mode 100644 cui/source/options/optctl.hxx delete mode 100644 cui/source/options/optctl.src delete mode 100644 cui/source/options/optdict.cxx delete mode 100644 cui/source/options/optdict.hrc delete mode 100644 cui/source/options/optdict.src delete mode 100644 cui/source/options/optfltr.cxx delete mode 100644 cui/source/options/optfltr.hrc delete mode 100644 cui/source/options/optfltr.hxx delete mode 100644 cui/source/options/optfltr.src delete mode 100644 cui/source/options/optgdlg.cxx delete mode 100644 cui/source/options/optgdlg.hrc delete mode 100644 cui/source/options/optgdlg.hxx delete mode 100644 cui/source/options/optgdlg.src delete mode 100644 cui/source/options/optgenrl.cxx delete mode 100644 cui/source/options/optgenrl.hrc delete mode 100644 cui/source/options/optgenrl.src delete mode 100644 cui/source/options/opthtml.cxx delete mode 100644 cui/source/options/opthtml.hrc delete mode 100644 cui/source/options/opthtml.hxx delete mode 100644 cui/source/options/opthtml.src delete mode 100644 cui/source/options/optimprove.cxx delete mode 100644 cui/source/options/optimprove.hrc delete mode 100644 cui/source/options/optimprove.src delete mode 100644 cui/source/options/optimprove2.cxx delete mode 100644 cui/source/options/optinet2.cxx delete mode 100755 cui/source/options/optinet2.hrc delete mode 100644 cui/source/options/optinet2.hxx delete mode 100644 cui/source/options/optinet2.src delete mode 100644 cui/source/options/optjava.cxx delete mode 100644 cui/source/options/optjava.hrc delete mode 100644 cui/source/options/optjava.hxx delete mode 100644 cui/source/options/optjava.src delete mode 100644 cui/source/options/optjsearch.cxx delete mode 100644 cui/source/options/optjsearch.hrc delete mode 100644 cui/source/options/optjsearch.hxx delete mode 100644 cui/source/options/optjsearch.src delete mode 100644 cui/source/options/optlingu.cxx delete mode 100644 cui/source/options/optlingu.hrc delete mode 100644 cui/source/options/optlingu.src delete mode 100644 cui/source/options/optmemory.cxx delete mode 100644 cui/source/options/optmemory.hrc delete mode 100644 cui/source/options/optmemory.hxx delete mode 100644 cui/source/options/optmemory.src delete mode 100644 cui/source/options/optpath.cxx delete mode 100644 cui/source/options/optpath.hrc delete mode 100644 cui/source/options/optpath.src delete mode 100644 cui/source/options/optsave.cxx delete mode 100644 cui/source/options/optsave.hrc delete mode 100644 cui/source/options/optsave.hxx delete mode 100644 cui/source/options/optsave.src delete mode 100644 cui/source/options/optupdt.cxx delete mode 100644 cui/source/options/optupdt.hrc delete mode 100644 cui/source/options/optupdt.hxx delete mode 100644 cui/source/options/optupdt.src delete mode 100644 cui/source/options/radiobtnbox.cxx delete mode 100644 cui/source/options/readonlyimage.cxx delete mode 100644 cui/source/options/readonlyimage.hxx delete mode 100644 cui/source/options/readonlyimage.src delete mode 100644 cui/source/options/sdbcdriverenum.cxx delete mode 100644 cui/source/options/sdbcdriverenum.hxx delete mode 100644 cui/source/options/securityoptions.cxx delete mode 100644 cui/source/options/securityoptions.hrc delete mode 100644 cui/source/options/securityoptions.hxx delete mode 100644 cui/source/options/securityoptions.src delete mode 100644 cui/source/options/treeopt.cxx delete mode 100644 cui/source/options/treeopt.hrc delete mode 100644 cui/source/options/treeopt.src delete mode 100644 cui/source/options/webconninfo.cxx delete mode 100644 cui/source/options/webconninfo.hrc delete mode 100644 cui/source/options/webconninfo.hxx delete mode 100644 cui/source/options/webconninfo.src delete mode 100644 cui/source/tabpages/align.cxx delete mode 100644 cui/source/tabpages/align.hrc delete mode 100644 cui/source/tabpages/align.src delete mode 100644 cui/source/tabpages/autocdlg.cxx delete mode 100644 cui/source/tabpages/autocdlg.hrc delete mode 100644 cui/source/tabpages/autocdlg.src delete mode 100644 cui/source/tabpages/backgrnd.cxx delete mode 100644 cui/source/tabpages/backgrnd.hrc delete mode 100644 cui/source/tabpages/backgrnd.src delete mode 100644 cui/source/tabpages/bbdlg.cxx delete mode 100644 cui/source/tabpages/bbdlg.src delete mode 100644 cui/source/tabpages/border.cxx delete mode 100644 cui/source/tabpages/border.hrc delete mode 100644 cui/source/tabpages/border.src delete mode 100644 cui/source/tabpages/borderconn.cxx delete mode 100644 cui/source/tabpages/borderconn.hxx delete mode 100644 cui/source/tabpages/chardlg.cxx delete mode 100644 cui/source/tabpages/chardlg.h delete mode 100644 cui/source/tabpages/chardlg.hrc delete mode 100644 cui/source/tabpages/chardlg.src delete mode 100644 cui/source/tabpages/connect.cxx delete mode 100644 cui/source/tabpages/connect.hrc delete mode 100644 cui/source/tabpages/connect.src delete mode 100644 cui/source/tabpages/dstribut.cxx delete mode 100644 cui/source/tabpages/dstribut.hrc delete mode 100644 cui/source/tabpages/dstribut.src delete mode 100644 cui/source/tabpages/frmdirlbox.src delete mode 100644 cui/source/tabpages/grfpage.cxx delete mode 100644 cui/source/tabpages/grfpage.hrc delete mode 100644 cui/source/tabpages/grfpage.src delete mode 100644 cui/source/tabpages/labdlg.cxx delete mode 100644 cui/source/tabpages/labdlg.hrc delete mode 100644 cui/source/tabpages/labdlg.src delete mode 100644 cui/source/tabpages/macroass.cxx delete mode 100644 cui/source/tabpages/macroass.hrc delete mode 100644 cui/source/tabpages/macroass.src delete mode 100644 cui/source/tabpages/measure.cxx delete mode 100644 cui/source/tabpages/measure.hrc delete mode 100644 cui/source/tabpages/measure.src delete mode 100644 cui/source/tabpages/numfmt.cxx delete mode 100644 cui/source/tabpages/numfmt.hrc delete mode 100644 cui/source/tabpages/numfmt.src delete mode 100644 cui/source/tabpages/numpages.cxx delete mode 100644 cui/source/tabpages/numpages.hrc delete mode 100644 cui/source/tabpages/numpages.src delete mode 100644 cui/source/tabpages/page.cxx delete mode 100644 cui/source/tabpages/page.h delete mode 100644 cui/source/tabpages/page.hrc delete mode 100644 cui/source/tabpages/page.src delete mode 100644 cui/source/tabpages/paragrph.cxx delete mode 100644 cui/source/tabpages/paragrph.hrc delete mode 100644 cui/source/tabpages/paragrph.src delete mode 100644 cui/source/tabpages/strings.src delete mode 100644 cui/source/tabpages/swpossizetabpage.cxx delete mode 100644 cui/source/tabpages/swpossizetabpage.hrc delete mode 100644 cui/source/tabpages/swpossizetabpage.hxx delete mode 100644 cui/source/tabpages/swpossizetabpage.src delete mode 100644 cui/source/tabpages/tabarea.cxx delete mode 100644 cui/source/tabpages/tabarea.hrc delete mode 100644 cui/source/tabpages/tabarea.src delete mode 100644 cui/source/tabpages/tabline.cxx delete mode 100644 cui/source/tabpages/tabline.hrc delete mode 100644 cui/source/tabpages/tabline.src delete mode 100644 cui/source/tabpages/tabstpge.cxx delete mode 100644 cui/source/tabpages/tabstpge.hrc delete mode 100644 cui/source/tabpages/tabstpge.src delete mode 100644 cui/source/tabpages/textanim.cxx delete mode 100644 cui/source/tabpages/textanim.hrc delete mode 100644 cui/source/tabpages/textanim.src delete mode 100644 cui/source/tabpages/textattr.cxx delete mode 100644 cui/source/tabpages/textattr.hrc delete mode 100644 cui/source/tabpages/textattr.src delete mode 100644 cui/source/tabpages/tparea.cxx delete mode 100644 cui/source/tabpages/tpbitmap.cxx delete mode 100644 cui/source/tabpages/tpcolor.cxx delete mode 100644 cui/source/tabpages/tpgradnt.cxx delete mode 100644 cui/source/tabpages/tphatch.cxx delete mode 100644 cui/source/tabpages/tpline.cxx delete mode 100644 cui/source/tabpages/tplnedef.cxx delete mode 100644 cui/source/tabpages/tplneend.cxx delete mode 100644 cui/source/tabpages/tpshadow.cxx delete mode 100644 cui/source/tabpages/transfrm.cxx delete mode 100644 cui/source/tabpages/transfrm.hrc delete mode 100644 cui/source/tabpages/transfrm.src delete mode 100644 cui/source/uno/services.cxx delete mode 100644 cui/util/cui.component delete mode 100644 cui/util/cui.map delete mode 100644 cui/util/hidother.src delete mode 100644 embedserv/prj/build.lst delete mode 100644 embedserv/prj/d.lst delete mode 100644 embedserv/source/embed/docholder.cxx delete mode 100644 embedserv/source/embed/ed_idataobj.cxx delete mode 100644 embedserv/source/embed/ed_iinplace.cxx delete mode 100644 embedserv/source/embed/ed_ioleobject.cxx delete mode 100644 embedserv/source/embed/ed_ipersiststr.cxx delete mode 100644 embedserv/source/embed/esdll.cxx delete mode 100644 embedserv/source/embed/guid.cxx delete mode 100644 embedserv/source/embed/iipaobj.cxx delete mode 100644 embedserv/source/embed/intercept.cxx delete mode 100755 embedserv/source/embed/makefile.mk delete mode 100644 embedserv/source/embed/register.cxx delete mode 100644 embedserv/source/embed/servprov.cxx delete mode 100644 embedserv/source/embed/stdafx.cpp delete mode 100644 embedserv/source/embed/syswinwrapper.cxx delete mode 100644 embedserv/source/embed/tracker.cxx delete mode 100644 embedserv/source/embed/xwin.cxx delete mode 100644 embedserv/source/inc/common.h delete mode 100644 embedserv/source/inc/docholder.hxx delete mode 100644 embedserv/source/inc/embeddoc.hxx delete mode 100644 embedserv/source/inc/embeddocaccess.hxx delete mode 100644 embedserv/source/inc/embservconst.h delete mode 100644 embedserv/source/inc/iipaobj.hxx delete mode 100644 embedserv/source/inc/intercept.hxx delete mode 100644 embedserv/source/inc/servprov.hxx delete mode 100644 embedserv/source/inc/stdafx.h delete mode 100644 embedserv/source/inc/syswinwrapper.hxx delete mode 100644 embedserv/source/inc/xwin.hxx delete mode 100644 embedserv/source/inprocserv/advisesink.cxx delete mode 100644 embedserv/source/inprocserv/advisesink.hxx delete mode 100644 embedserv/source/inprocserv/dllentry.cxx delete mode 100644 embedserv/source/inprocserv/exports.dxp delete mode 100644 embedserv/source/inprocserv/inprocembobj.cxx delete mode 100644 embedserv/source/inprocserv/inprocembobj.h delete mode 100644 embedserv/source/inprocserv/makefile.mk delete mode 100644 embedserv/source/inprocserv/smartpointer.hxx delete mode 100644 embedserv/util/emser.component delete mode 100755 embedserv/util/exports.dxp delete mode 100644 embedserv/util/makefile.mk delete mode 100644 extensions/inc/abpilot.hrc delete mode 100644 extensions/inc/appsettings.hxx delete mode 100644 extensions/inc/bibliography.hrc delete mode 100644 extensions/inc/dbpilots.hrc delete mode 100644 extensions/inc/extensio.hrc delete mode 100644 extensions/inc/makefile.mk delete mode 100644 extensions/inc/pch/precompiled_extensions.cxx delete mode 100644 extensions/inc/pch/precompiled_extensions.hxx delete mode 100644 extensions/inc/propctrlr.hrc delete mode 100644 extensions/inc/ucbhelper/ext_content.hxx delete mode 100644 extensions/inc/update.hrc delete mode 100644 extensions/prj/build.lst delete mode 100644 extensions/prj/d.lst delete mode 100644 extensions/qa/complex/extensions/OfficeResourceLoader.java delete mode 100644 extensions/qa/complex/extensions/extensions_all.sce delete mode 100644 extensions/qa/complex/extensions/makefile.mk delete mode 100644 extensions/qa/complex/extensions/orl_de.src delete mode 100644 extensions/qa/complex/extensions/orl_en-US.src delete mode 100644 extensions/qa/integration/extensions/ComponentFactory.java delete mode 100644 extensions/qa/integration/extensions/ConsoleWait.java delete mode 100644 extensions/qa/integration/extensions/Frame.java delete mode 100644 extensions/qa/integration/extensions/HelpTextProvider.java delete mode 100644 extensions/qa/integration/extensions/MethodHandler.java delete mode 100644 extensions/qa/integration/extensions/ObjectInspector.java delete mode 100644 extensions/qa/integration/extensions/ServicesHandler.java delete mode 100644 extensions/qa/integration/extensions/TestSkeleton.java delete mode 100644 extensions/qa/integration/extensions/extensions_complex.sce delete mode 100644 extensions/qa/integration/extensions/makefile.mk delete mode 100644 extensions/qa/unoapi/Test.java delete mode 100644 extensions/qa/unoapi/extensions.sce delete mode 100644 extensions/qa/unoapi/makefile.mk delete mode 100644 extensions/source/abpilot/abp.component delete mode 100644 extensions/source/abpilot/abpfinalpage.cxx delete mode 100644 extensions/source/abpilot/abpfinalpage.hxx delete mode 100644 extensions/source/abpilot/abpresid.hrc delete mode 100644 extensions/source/abpilot/abpservices.cxx delete mode 100644 extensions/source/abpilot/abptypes.hxx delete mode 100644 extensions/source/abpilot/abspage.cxx delete mode 100644 extensions/source/abpilot/abspage.hxx delete mode 100644 extensions/source/abpilot/abspilot.cxx delete mode 100644 extensions/source/abpilot/abspilot.hxx delete mode 100644 extensions/source/abpilot/abspilot.src delete mode 100644 extensions/source/abpilot/addresssettings.hxx delete mode 100644 extensions/source/abpilot/admininvokationimpl.cxx delete mode 100644 extensions/source/abpilot/admininvokationimpl.hxx delete mode 100644 extensions/source/abpilot/admininvokationpage.cxx delete mode 100644 extensions/source/abpilot/admininvokationpage.hxx delete mode 100644 extensions/source/abpilot/datasourcehandling.cxx delete mode 100644 extensions/source/abpilot/datasourcehandling.hxx delete mode 100644 extensions/source/abpilot/exports.dxp delete mode 100644 extensions/source/abpilot/fieldmappingimpl.cxx delete mode 100644 extensions/source/abpilot/fieldmappingimpl.hxx delete mode 100644 extensions/source/abpilot/fieldmappingpage.cxx delete mode 100644 extensions/source/abpilot/fieldmappingpage.hxx delete mode 100644 extensions/source/abpilot/makefile.mk delete mode 100644 extensions/source/abpilot/moduleabp.cxx delete mode 100644 extensions/source/abpilot/tableselectionpage.cxx delete mode 100644 extensions/source/abpilot/tableselectionpage.hxx delete mode 100644 extensions/source/abpilot/typeselectionpage.cxx delete mode 100644 extensions/source/abpilot/typeselectionpage.hxx delete mode 100644 extensions/source/abpilot/unodialogabp.cxx delete mode 100644 extensions/source/abpilot/unodialogabp.hxx delete mode 100644 extensions/source/activex/main/README.txt delete mode 100644 extensions/source/activex/main/SOActionsApproval.cpp delete mode 100644 extensions/source/activex/main/SOActionsApproval.h delete mode 100644 extensions/source/activex/main/SOActionsApproval.rgs delete mode 100644 extensions/source/activex/main/SOActiveX.cpp delete mode 100644 extensions/source/activex/main/SOActiveX.h delete mode 100644 extensions/source/activex/main/SOActiveX.rgs delete mode 100644 extensions/source/activex/main/SOComWindowPeer.cpp delete mode 100644 extensions/source/activex/main/SOComWindowPeer.h delete mode 100644 extensions/source/activex/main/SOComWindowPeer.rgs delete mode 100644 extensions/source/activex/main/SODispatchInterceptor.cpp delete mode 100644 extensions/source/activex/main/SODispatchInterceptor.h delete mode 100644 extensions/source/activex/main/SODispatchInterceptor.rgs delete mode 100644 extensions/source/activex/main/StdAfx2.cpp delete mode 100644 extensions/source/activex/main/StdAfx2.h delete mode 100644 extensions/source/activex/main/com_uno_helper.h delete mode 100644 extensions/source/activex/main/example.html delete mode 100644 extensions/source/activex/main/makefile.mk delete mode 100644 extensions/source/activex/main/resource.h delete mode 100644 extensions/source/activex/main/so_activex.cpp delete mode 100644 extensions/source/activex/main/so_activex.def delete mode 100644 extensions/source/activex/main/so_activex.rc delete mode 100644 extensions/source/activex/msidl/makefile.mk delete mode 100644 extensions/source/activex/msidl/so_activex.idl delete mode 100644 extensions/source/bibliography/bib.component delete mode 100644 extensions/source/bibliography/bib.hrc delete mode 100644 extensions/source/bibliography/bib.src delete mode 100644 extensions/source/bibliography/bibbeam.cxx delete mode 100644 extensions/source/bibliography/bibbeam.hxx delete mode 100644 extensions/source/bibliography/bibconfig.cxx delete mode 100644 extensions/source/bibliography/bibconfig.hxx delete mode 100644 extensions/source/bibliography/bibcont.cxx delete mode 100644 extensions/source/bibliography/bibcont.hxx delete mode 100644 extensions/source/bibliography/bibload.cxx delete mode 100644 extensions/source/bibliography/bibmod.cxx delete mode 100644 extensions/source/bibliography/bibmod.hxx delete mode 100644 extensions/source/bibliography/bibprop.hrc delete mode 100644 extensions/source/bibliography/bibresid.hxx delete mode 100644 extensions/source/bibliography/bibshortcuthandler.hxx delete mode 100644 extensions/source/bibliography/bibtools.hxx delete mode 100644 extensions/source/bibliography/bibview.cxx delete mode 100644 extensions/source/bibliography/bibview.hxx delete mode 100644 extensions/source/bibliography/datman.cxx delete mode 100644 extensions/source/bibliography/datman.hrc delete mode 100644 extensions/source/bibliography/datman.hxx delete mode 100644 extensions/source/bibliography/datman.src delete mode 100644 extensions/source/bibliography/formcontrolcontainer.cxx delete mode 100644 extensions/source/bibliography/formcontrolcontainer.hxx delete mode 100644 extensions/source/bibliography/framectr.cxx delete mode 100644 extensions/source/bibliography/framectr.hxx delete mode 100644 extensions/source/bibliography/general.cxx delete mode 100644 extensions/source/bibliography/general.hxx delete mode 100644 extensions/source/bibliography/hidother.src delete mode 100644 extensions/source/bibliography/loadlisteneradapter.cxx delete mode 100644 extensions/source/bibliography/loadlisteneradapter.hxx delete mode 100644 extensions/source/bibliography/makefile.mk delete mode 100644 extensions/source/bibliography/sections.hrc delete mode 100644 extensions/source/bibliography/sections.src delete mode 100644 extensions/source/bibliography/toolbar.cxx delete mode 100644 extensions/source/bibliography/toolbar.hrc delete mode 100644 extensions/source/bibliography/toolbar.hxx delete mode 100644 extensions/source/bibliography/toolbar.src delete mode 100644 extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml delete mode 100644 extensions/source/config/ldap/componentdef.cxx delete mode 100644 extensions/source/config/ldap/exports.dxp delete mode 100644 extensions/source/config/ldap/ldapaccess.cxx delete mode 100644 extensions/source/config/ldap/ldapaccess.hxx delete mode 100644 extensions/source/config/ldap/ldapbe2.component delete mode 100644 extensions/source/config/ldap/ldapuserprofilebe.cxx delete mode 100644 extensions/source/config/ldap/ldapuserprofilebe.hxx delete mode 100644 extensions/source/config/ldap/makefile.mk delete mode 100644 extensions/source/config/ldap/wrapldapinclude.hxx delete mode 100644 extensions/source/dbpilots/commonpagesdbp.cxx delete mode 100644 extensions/source/dbpilots/commonpagesdbp.hxx delete mode 100644 extensions/source/dbpilots/commonpagesdbp.src delete mode 100644 extensions/source/dbpilots/controlwizard.cxx delete mode 100644 extensions/source/dbpilots/controlwizard.hxx delete mode 100644 extensions/source/dbpilots/dbp.component delete mode 100644 extensions/source/dbpilots/dbpilots.src delete mode 100644 extensions/source/dbpilots/dbpresid.hrc delete mode 100644 extensions/source/dbpilots/dbpservices.cxx delete mode 100644 extensions/source/dbpilots/dbptools.cxx delete mode 100644 extensions/source/dbpilots/dbptools.hxx delete mode 100644 extensions/source/dbpilots/dbptypes.hxx delete mode 100644 extensions/source/dbpilots/gridpages.src delete mode 100644 extensions/source/dbpilots/gridwizard.cxx delete mode 100644 extensions/source/dbpilots/gridwizard.hxx delete mode 100644 extensions/source/dbpilots/groupboxpages.src delete mode 100644 extensions/source/dbpilots/groupboxwiz.cxx delete mode 100644 extensions/source/dbpilots/groupboxwiz.hxx delete mode 100644 extensions/source/dbpilots/listcombopages.src delete mode 100644 extensions/source/dbpilots/listcombowizard.cxx delete mode 100644 extensions/source/dbpilots/listcombowizard.hxx delete mode 100644 extensions/source/dbpilots/makefile.mk delete mode 100644 extensions/source/dbpilots/moduledbp.cxx delete mode 100644 extensions/source/dbpilots/optiongrouplayouter.cxx delete mode 100644 extensions/source/dbpilots/optiongrouplayouter.hxx delete mode 100644 extensions/source/dbpilots/unoautopilot.hxx delete mode 100644 extensions/source/dbpilots/unoautopilot.inl delete mode 100644 extensions/source/dbpilots/wizardcontext.hxx delete mode 100644 extensions/source/dbpilots/wizardservices.cxx delete mode 100644 extensions/source/dbpilots/wizardservices.hxx delete mode 100644 extensions/source/inc/componentmodule.cxx delete mode 100644 extensions/source/inc/componentmodule.hxx delete mode 100644 extensions/source/logging/consolehandler.cxx delete mode 100644 extensions/source/logging/csvformatter.cxx delete mode 100644 extensions/source/logging/filehandler.cxx delete mode 100644 extensions/source/logging/log.component delete mode 100644 extensions/source/logging/log_module.cxx delete mode 100644 extensions/source/logging/log_module.hxx delete mode 100644 extensions/source/logging/log_services.cxx delete mode 100644 extensions/source/logging/logger.cxx delete mode 100644 extensions/source/logging/loggerconfig.cxx delete mode 100644 extensions/source/logging/loggerconfig.hxx delete mode 100644 extensions/source/logging/loghandler.cxx delete mode 100644 extensions/source/logging/loghandler.hxx delete mode 100644 extensions/source/logging/logrecord.cxx delete mode 100644 extensions/source/logging/logrecord.hxx delete mode 100644 extensions/source/logging/makefile.mk delete mode 100644 extensions/source/logging/methodguard.hxx delete mode 100644 extensions/source/logging/plaintextformatter.cxx delete mode 100644 extensions/source/macosx/spotlight/GetMetadataForFile.m delete mode 100644 extensions/source/macosx/spotlight/OOoContentDataParser.h delete mode 100644 extensions/source/macosx/spotlight/OOoContentDataParser.m delete mode 100644 extensions/source/macosx/spotlight/OOoMetaDataParser.h delete mode 100644 extensions/source/macosx/spotlight/OOoMetaDataParser.m delete mode 100644 extensions/source/macosx/spotlight/OOoSpotlightImporter.h delete mode 100644 extensions/source/macosx/spotlight/OOoSpotlightImporter.m delete mode 100644 extensions/source/macosx/spotlight/delzip delete mode 100644 extensions/source/macosx/spotlight/ioapi.h delete mode 100644 extensions/source/macosx/spotlight/ioapi.m delete mode 100644 extensions/source/macosx/spotlight/main.m delete mode 100644 extensions/source/macosx/spotlight/makefile.mk delete mode 100644 extensions/source/macosx/spotlight/mdimporter/Info.plist delete mode 100644 extensions/source/macosx/spotlight/mdimporter/en.lproj/schema.strings delete mode 100644 extensions/source/macosx/spotlight/mdimporter/schema.xml delete mode 100644 extensions/source/macosx/spotlight/unzip.h delete mode 100644 extensions/source/macosx/spotlight/unzip.m delete mode 100644 extensions/source/macosx/spotlight/version.plist delete mode 100644 extensions/source/nsplugin/source/exports.dxp delete mode 100644 extensions/source/nsplugin/source/exports_wnt.dxp delete mode 100644 extensions/source/nsplugin/source/makefile.mk delete mode 100644 extensions/source/nsplugin/source/npshell.cxx delete mode 100644 extensions/source/nsplugin/source/npshell.hxx delete mode 100644 extensions/source/nsplugin/source/ns_debug.hxx delete mode 100644 extensions/source/nsplugin/source/nsp_func.hxx delete mode 100644 extensions/source/nsplugin/source/nsp_windows.cxx delete mode 100644 extensions/source/nsplugin/source/nsp_windows.hxx delete mode 100644 extensions/source/nsplugin/source/nsplugin.rc delete mode 100644 extensions/source/nsplugin/source/nsplugin_oo.rc delete mode 100644 extensions/source/nsplugin/source/so_closelistener.cxx delete mode 100644 extensions/source/nsplugin/source/so_closelistener.hxx delete mode 100644 extensions/source/nsplugin/source/so_env.cxx delete mode 100644 extensions/source/nsplugin/source/so_env.hxx delete mode 100644 extensions/source/nsplugin/source/so_instance.cxx delete mode 100644 extensions/source/nsplugin/source/so_instance.hxx delete mode 100644 extensions/source/nsplugin/source/so_main.cxx delete mode 100644 extensions/source/nsplugin/source/so_msg.hxx delete mode 100644 extensions/source/ole/comifaces.hxx delete mode 100644 extensions/source/ole/jscriptclasses.cxx delete mode 100644 extensions/source/ole/jscriptclasses.hxx delete mode 100644 extensions/source/ole/makefile.mk delete mode 100644 extensions/source/ole/ole2uno.cxx delete mode 100644 extensions/source/ole/ole2uno.hxx delete mode 100644 extensions/source/ole/oleautobridge.component delete mode 100644 extensions/source/ole/oleautobridge.uno.dxp delete mode 100644 extensions/source/ole/oledll.cxx delete mode 100644 extensions/source/ole/oleobjw.cxx delete mode 100644 extensions/source/ole/oleobjw.hxx delete mode 100644 extensions/source/ole/olethread.cxx delete mode 100644 extensions/source/ole/servprov.cxx delete mode 100644 extensions/source/ole/servprov.hxx delete mode 100644 extensions/source/ole/servreg.cxx delete mode 100644 extensions/source/ole/unoconversionutilities.hxx delete mode 100644 extensions/source/ole/unoobjw.cxx delete mode 100644 extensions/source/ole/unoobjw.hxx delete mode 100644 extensions/source/ole/unotypewrapper.cxx delete mode 100644 extensions/source/ole/unotypewrapper.hxx delete mode 100644 extensions/source/ole/windata.cxx delete mode 100644 extensions/source/ole/windata.hxx delete mode 100644 extensions/source/oooimprovecore/core.cxx delete mode 100644 extensions/source/oooimprovecore/makefile.mk delete mode 100644 extensions/source/oooimprovecore/oooimprovecore.component delete mode 100644 extensions/source/oooimprovecore/oooimprovecore_module.cxx delete mode 100644 extensions/source/oooimprovecore/oooimprovecore_module.hxx delete mode 100644 extensions/source/oooimprovecore/oooimprovecore_services.cxx delete mode 100644 extensions/source/oooimprovement/Jobs.xcu delete mode 100644 extensions/source/oooimprovement/Logging.xcu delete mode 100644 extensions/source/oooimprovement/config.cxx delete mode 100644 extensions/source/oooimprovement/config.hxx delete mode 100644 extensions/source/oooimprovement/corecontroller.cxx delete mode 100644 extensions/source/oooimprovement/corecontroller.hxx delete mode 100644 extensions/source/oooimprovement/errormail.cxx delete mode 100644 extensions/source/oooimprovement/errormail.hxx delete mode 100644 extensions/source/oooimprovement/invite_job.cxx delete mode 100644 extensions/source/oooimprovement/invite_job.hxx delete mode 100644 extensions/source/oooimprovement/logpacker.cxx delete mode 100644 extensions/source/oooimprovement/logpacker.hxx delete mode 100644 extensions/source/oooimprovement/logstorage.cxx delete mode 100644 extensions/source/oooimprovement/logstorage.hxx delete mode 100644 extensions/source/oooimprovement/makefile.mk delete mode 100644 extensions/source/oooimprovement/makefile.pmk delete mode 100644 extensions/source/oooimprovement/myconfigurationhelper.cxx delete mode 100644 extensions/source/oooimprovement/myconfigurationhelper.hxx delete mode 100644 extensions/source/oooimprovement/onlogrotate_job.cxx delete mode 100644 extensions/source/oooimprovement/onlogrotate_job.hxx delete mode 100644 extensions/source/oooimprovement/oooimprovement.component delete mode 100644 extensions/source/oooimprovement/oooimprovement_exports.cxx delete mode 100644 extensions/source/oooimprovement/soaprequest.cxx delete mode 100644 extensions/source/oooimprovement/soaprequest.hxx delete mode 100644 extensions/source/oooimprovement/soapsender.cxx delete mode 100644 extensions/source/oooimprovement/soapsender.hxx delete mode 100644 extensions/source/plugin/aqua/macmgr.cxx delete mode 100644 extensions/source/plugin/aqua/makefile.mk delete mode 100644 extensions/source/plugin/aqua/sysplug.cxx delete mode 100644 extensions/source/plugin/base/context.cxx delete mode 100644 extensions/source/plugin/base/evtlstnr.cxx delete mode 100644 extensions/source/plugin/base/makefile.mk delete mode 100644 extensions/source/plugin/base/manager.cxx delete mode 100644 extensions/source/plugin/base/multiplx.cxx delete mode 100644 extensions/source/plugin/base/nfuncs.cxx delete mode 100644 extensions/source/plugin/base/plcom.cxx delete mode 100644 extensions/source/plugin/base/plctrl.cxx delete mode 100644 extensions/source/plugin/base/plmodel.cxx delete mode 100644 extensions/source/plugin/base/service.cxx delete mode 100644 extensions/source/plugin/base/xplugin.cxx delete mode 100644 extensions/source/plugin/inc/plugin/aqua/sysplug.hxx delete mode 100644 extensions/source/plugin/inc/plugin/impl.hxx delete mode 100644 extensions/source/plugin/inc/plugin/model.hxx delete mode 100644 extensions/source/plugin/inc/plugin/multiplx.hxx delete mode 100644 extensions/source/plugin/inc/plugin/plcom.hxx delete mode 100644 extensions/source/plugin/inc/plugin/plctrl.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/mediator.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/plugcon.hxx delete mode 100644 extensions/source/plugin/inc/plugin/unx/sysplug.hxx delete mode 100644 extensions/source/plugin/inc/plugin/win/sysplug.hxx delete mode 100644 extensions/source/plugin/unx/makefile.mk delete mode 100644 extensions/source/plugin/unx/mediator.cxx delete mode 100644 extensions/source/plugin/unx/npnapi.cxx delete mode 100644 extensions/source/plugin/unx/nppapi.cxx delete mode 100644 extensions/source/plugin/unx/npwrap.cxx delete mode 100644 extensions/source/plugin/unx/plugcon.cxx delete mode 100644 extensions/source/plugin/unx/sysplug.cxx delete mode 100644 extensions/source/plugin/unx/unxmgr.cxx delete mode 100644 extensions/source/plugin/util/makefile.mk delete mode 100644 extensions/source/plugin/util/makefile.pmk delete mode 100644 extensions/source/plugin/util/pl.component delete mode 100644 extensions/source/plugin/win/makefile.mk delete mode 100644 extensions/source/plugin/win/sysplug.cxx delete mode 100644 extensions/source/plugin/win/winmgr.cxx delete mode 100644 extensions/source/propctrlr/MasterDetailLinkDialog.cxx delete mode 100644 extensions/source/propctrlr/MasterDetailLinkDialog.hxx delete mode 100644 extensions/source/propctrlr/browserline.cxx delete mode 100644 extensions/source/propctrlr/browserline.hxx delete mode 100644 extensions/source/propctrlr/browserlistbox.cxx delete mode 100644 extensions/source/propctrlr/browserlistbox.hxx delete mode 100644 extensions/source/propctrlr/browserpage.cxx delete mode 100644 extensions/source/propctrlr/browserpage.hxx delete mode 100644 extensions/source/propctrlr/browserview.cxx delete mode 100644 extensions/source/propctrlr/browserview.hxx delete mode 100644 extensions/source/propctrlr/buttonnavigationhandler.cxx delete mode 100644 extensions/source/propctrlr/buttonnavigationhandler.hxx delete mode 100644 extensions/source/propctrlr/cellbindinghandler.cxx delete mode 100644 extensions/source/propctrlr/cellbindinghandler.hxx delete mode 100644 extensions/source/propctrlr/cellbindinghelper.cxx delete mode 100644 extensions/source/propctrlr/cellbindinghelper.hxx delete mode 100644 extensions/source/propctrlr/commoncontrol.cxx delete mode 100644 extensions/source/propctrlr/commoncontrol.hxx delete mode 100644 extensions/source/propctrlr/composeduiupdate.cxx delete mode 100644 extensions/source/propctrlr/composeduiupdate.hxx delete mode 100644 extensions/source/propctrlr/controlfontdialog.cxx delete mode 100644 extensions/source/propctrlr/controlfontdialog.hxx delete mode 100644 extensions/source/propctrlr/controltype.hxx delete mode 100644 extensions/source/propctrlr/defaultforminspection.cxx delete mode 100644 extensions/source/propctrlr/defaultforminspection.hxx delete mode 100644 extensions/source/propctrlr/defaulthelpprovider.cxx delete mode 100644 extensions/source/propctrlr/defaulthelpprovider.hxx delete mode 100644 extensions/source/propctrlr/editpropertyhandler.cxx delete mode 100644 extensions/source/propctrlr/editpropertyhandler.hxx delete mode 100644 extensions/source/propctrlr/eformshelper.cxx delete mode 100644 extensions/source/propctrlr/eformshelper.hxx delete mode 100644 extensions/source/propctrlr/eformspropertyhandler.cxx delete mode 100644 extensions/source/propctrlr/eformspropertyhandler.hxx delete mode 100644 extensions/source/propctrlr/enumrepresentation.hxx delete mode 100644 extensions/source/propctrlr/eventhandler.cxx delete mode 100644 extensions/source/propctrlr/eventhandler.hxx delete mode 100644 extensions/source/propctrlr/fontdialog.cxx delete mode 100644 extensions/source/propctrlr/fontdialog.hxx delete mode 100644 extensions/source/propctrlr/fontdialog.src delete mode 100644 extensions/source/propctrlr/fontitemids.hxx delete mode 100644 extensions/source/propctrlr/formbrowsertools.cxx delete mode 100644 extensions/source/propctrlr/formbrowsertools.hxx delete mode 100644 extensions/source/propctrlr/formcomponenthandler.cxx delete mode 100644 extensions/source/propctrlr/formcomponenthandler.hxx delete mode 100644 extensions/source/propctrlr/formcontroller.cxx delete mode 100644 extensions/source/propctrlr/formcontroller.hxx delete mode 100644 extensions/source/propctrlr/formgeometryhandler.cxx delete mode 100644 extensions/source/propctrlr/formlinkdialog.cxx delete mode 100644 extensions/source/propctrlr/formlinkdialog.hrc delete mode 100644 extensions/source/propctrlr/formlinkdialog.hxx delete mode 100644 extensions/source/propctrlr/formlinkdialog.src delete mode 100644 extensions/source/propctrlr/formlocalid.hrc delete mode 100644 extensions/source/propctrlr/formmetadata.cxx delete mode 100644 extensions/source/propctrlr/formmetadata.hxx delete mode 100644 extensions/source/propctrlr/formres.src delete mode 100644 extensions/source/propctrlr/formresid.hrc delete mode 100644 extensions/source/propctrlr/formstrings.cxx delete mode 100644 extensions/source/propctrlr/formstrings.hxx delete mode 100644 extensions/source/propctrlr/genericpropertyhandler.cxx delete mode 100644 extensions/source/propctrlr/genericpropertyhandler.hxx delete mode 100644 extensions/source/propctrlr/handlerhelper.cxx delete mode 100644 extensions/source/propctrlr/handlerhelper.hxx delete mode 100644 extensions/source/propctrlr/inspectorhelpwindow.cxx delete mode 100644 extensions/source/propctrlr/inspectorhelpwindow.hxx delete mode 100644 extensions/source/propctrlr/inspectormodelbase.cxx delete mode 100644 extensions/source/propctrlr/inspectormodelbase.hxx delete mode 100644 extensions/source/propctrlr/linedescriptor.hxx delete mode 100644 extensions/source/propctrlr/listselectiondlg.cxx delete mode 100644 extensions/source/propctrlr/listselectiondlg.hrc delete mode 100644 extensions/source/propctrlr/listselectiondlg.hxx delete mode 100644 extensions/source/propctrlr/listselectiondlg.src delete mode 100644 extensions/source/propctrlr/makefile.mk delete mode 100644 extensions/source/propctrlr/modulepcr.cxx delete mode 100644 extensions/source/propctrlr/modulepcr.hxx delete mode 100644 extensions/source/propctrlr/newdatatype.cxx delete mode 100644 extensions/source/propctrlr/newdatatype.hrc delete mode 100644 extensions/source/propctrlr/newdatatype.hxx delete mode 100644 extensions/source/propctrlr/newdatatype.src delete mode 100644 extensions/source/propctrlr/objectinspectormodel.cxx delete mode 100644 extensions/source/propctrlr/pcr.component delete mode 100644 extensions/source/propctrlr/pcr.xml delete mode 100644 extensions/source/propctrlr/pcrcommon.cxx delete mode 100644 extensions/source/propctrlr/pcrcommon.hxx delete mode 100644 extensions/source/propctrlr/pcrcommontypes.hxx delete mode 100644 extensions/source/propctrlr/pcrcomponentcontext.cxx delete mode 100644 extensions/source/propctrlr/pcrcomponentcontext.hxx delete mode 100644 extensions/source/propctrlr/pcrmiscres.src delete mode 100644 extensions/source/propctrlr/pcrservices.cxx delete mode 100644 extensions/source/propctrlr/pcrstrings.cxx delete mode 100644 extensions/source/propctrlr/pcrstrings.hxx delete mode 100644 extensions/source/propctrlr/pcrunodialogs.cxx delete mode 100644 extensions/source/propctrlr/pcrunodialogs.hxx delete mode 100644 extensions/source/propctrlr/propcontroller.cxx delete mode 100644 extensions/source/propctrlr/propcontroller.hxx delete mode 100644 extensions/source/propctrlr/propcontrolobserver.hxx delete mode 100644 extensions/source/propctrlr/propertycomposer.cxx delete mode 100644 extensions/source/propctrlr/propertycomposer.hxx delete mode 100644 extensions/source/propctrlr/propertycontrolextender.cxx delete mode 100644 extensions/source/propctrlr/propertycontrolextender.hxx delete mode 100644 extensions/source/propctrlr/propertyeditor.cxx delete mode 100644 extensions/source/propctrlr/propertyeditor.hxx delete mode 100644 extensions/source/propctrlr/propertyhandler.cxx delete mode 100644 extensions/source/propctrlr/propertyhandler.hxx delete mode 100644 extensions/source/propctrlr/propertyinfo.hxx delete mode 100644 extensions/source/propctrlr/propeventtranslation.cxx delete mode 100644 extensions/source/propctrlr/propeventtranslation.hxx delete mode 100644 extensions/source/propctrlr/proplinelistener.hxx delete mode 100644 extensions/source/propctrlr/propres.src delete mode 100644 extensions/source/propctrlr/propresid.hrc delete mode 100644 extensions/source/propctrlr/pushbuttonnavigation.cxx delete mode 100644 extensions/source/propctrlr/pushbuttonnavigation.hxx delete mode 100644 extensions/source/propctrlr/selectlabeldialog.cxx delete mode 100644 extensions/source/propctrlr/selectlabeldialog.hxx delete mode 100644 extensions/source/propctrlr/selectlabeldialog.src delete mode 100644 extensions/source/propctrlr/sqlcommanddesign.cxx delete mode 100644 extensions/source/propctrlr/sqlcommanddesign.hxx delete mode 100644 extensions/source/propctrlr/standardcontrol.cxx delete mode 100644 extensions/source/propctrlr/standardcontrol.hxx delete mode 100644 extensions/source/propctrlr/stlops.hxx delete mode 100644 extensions/source/propctrlr/stringdefine.hxx delete mode 100644 extensions/source/propctrlr/stringrepresentation.cxx delete mode 100644 extensions/source/propctrlr/submissionhandler.cxx delete mode 100644 extensions/source/propctrlr/submissionhandler.hxx delete mode 100644 extensions/source/propctrlr/taborder.cxx delete mode 100644 extensions/source/propctrlr/taborder.hrc delete mode 100644 extensions/source/propctrlr/taborder.hxx delete mode 100644 extensions/source/propctrlr/taborder.src delete mode 100644 extensions/source/propctrlr/unourl.cxx delete mode 100644 extensions/source/propctrlr/unourl.hxx delete mode 100644 extensions/source/propctrlr/usercontrol.cxx delete mode 100644 extensions/source/propctrlr/usercontrol.hxx delete mode 100644 extensions/source/propctrlr/xsddatatypes.cxx delete mode 100644 extensions/source/propctrlr/xsddatatypes.hxx delete mode 100644 extensions/source/propctrlr/xsdvalidationhelper.cxx delete mode 100644 extensions/source/propctrlr/xsdvalidationhelper.hxx delete mode 100644 extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx delete mode 100644 extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx delete mode 100644 extensions/source/resource/ResourceIndexAccess.cxx delete mode 100644 extensions/source/resource/ResourceIndexAccess.hxx delete mode 100644 extensions/source/resource/exports.dxp delete mode 100644 extensions/source/resource/makefile.mk delete mode 100644 extensions/source/resource/oooresourceloader.cxx delete mode 100644 extensions/source/resource/oooresourceloader.hxx delete mode 100644 extensions/source/resource/res.component delete mode 100644 extensions/source/resource/resourceservices.cxx delete mode 100644 extensions/source/scanner/exports.dxp delete mode 100644 extensions/source/scanner/grid.cxx delete mode 100644 extensions/source/scanner/grid.hrc delete mode 100644 extensions/source/scanner/grid.hxx delete mode 100644 extensions/source/scanner/grid.src delete mode 100644 extensions/source/scanner/makefile.mk delete mode 100644 extensions/source/scanner/sane.cxx delete mode 100644 extensions/source/scanner/sane.hxx delete mode 100644 extensions/source/scanner/sanedlg.cxx delete mode 100644 extensions/source/scanner/sanedlg.hrc delete mode 100644 extensions/source/scanner/sanedlg.hxx delete mode 100644 extensions/source/scanner/sanedlg.src delete mode 100644 extensions/source/scanner/scanner.cxx delete mode 100644 extensions/source/scanner/scanner.hxx delete mode 100644 extensions/source/scanner/scanunx.cxx delete mode 100644 extensions/source/scanner/scanwin.cxx delete mode 100644 extensions/source/scanner/scn.component delete mode 100644 extensions/source/scanner/scnserv.cxx delete mode 100644 extensions/source/scanner/twain.cxx delete mode 100644 extensions/source/scanner/twain.hxx delete mode 100644 extensions/source/unoactivex/main/initwindowpeer.cxx delete mode 100644 extensions/source/update/check/Addons.xcu delete mode 100644 extensions/source/update/check/Jobs.xcu delete mode 100644 extensions/source/update/check/actionlistener.hxx delete mode 100644 extensions/source/update/check/download.cxx delete mode 100644 extensions/source/update/check/download.hxx delete mode 100644 extensions/source/update/check/makefile.mk delete mode 100644 extensions/source/update/check/transform.pl delete mode 100644 extensions/source/update/check/updatecheck.cxx delete mode 100644 extensions/source/update/check/updatecheck.hxx delete mode 100644 extensions/source/update/check/updatecheckconfig.cxx delete mode 100644 extensions/source/update/check/updatecheckconfig.hxx delete mode 100644 extensions/source/update/check/updatecheckconfiglistener.hxx delete mode 100644 extensions/source/update/check/updatecheckjob.cxx delete mode 100644 extensions/source/update/check/updatehdl.cxx delete mode 100644 extensions/source/update/check/updatehdl.hrc delete mode 100644 extensions/source/update/check/updatehdl.hxx delete mode 100644 extensions/source/update/check/updatehdl.src delete mode 100644 extensions/source/update/check/updateinfo.hxx delete mode 100644 extensions/source/update/check/updateprotocol.cxx delete mode 100644 extensions/source/update/check/updateprotocol.hxx delete mode 100644 extensions/source/update/check/updateprotocoltest.cxx delete mode 100644 extensions/source/update/check/updchk.uno.component delete mode 100644 extensions/source/update/check/updchk.xml delete mode 100644 extensions/source/update/feed/makefile.mk delete mode 100644 extensions/source/update/feed/test/makefile.mk delete mode 100644 extensions/source/update/feed/test/updatefeedtest.cxx delete mode 100644 extensions/source/update/feed/updatefeed.component delete mode 100644 extensions/source/update/feed/updatefeed.cxx delete mode 100644 extensions/source/update/feed/updatefeed.xml delete mode 100644 extensions/source/update/tools/makefile.mk delete mode 100644 extensions/source/update/tools/ztool.cxx delete mode 100644 extensions/source/update/ui/makefile.mk delete mode 100644 extensions/source/update/ui/updatecheckui.cxx delete mode 100644 extensions/source/update/ui/updatecheckui.hrc delete mode 100644 extensions/source/update/ui/updatecheckui.src delete mode 100644 extensions/source/update/ui/updchk.component delete mode 100644 extensions/source/update/ui/updchkui.xml delete mode 100644 extensions/source/xmlextract/makefile.mk delete mode 100644 extensions/source/xmlextract/xmx.component delete mode 100644 extensions/source/xmlextract/xmxcom.hxx delete mode 100644 extensions/source/xmlextract/xmxtrct.cxx delete mode 100644 extensions/source/xmlextract/xmxtrct.hxx delete mode 100644 extensions/source/xmlextract/xmxuno.cxx delete mode 100644 extensions/stardiv/fontest/fontest.idl delete mode 100644 extensions/stardiv/fontest/makefile.mk delete mode 100644 extensions/stardiv/oinstchk/makefile.mk delete mode 100644 extensions/stardiv/oinstchk/oinstchk.idl delete mode 100644 extensions/stardiv/pgp/makefile.mk delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.cpp delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.def delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.dsp delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.idl delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.rc delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.sln delete mode 100644 extensions/test/ole/AxTestComponents/AxTestComponents.vcproj delete mode 100644 extensions/test/ole/AxTestComponents/Basic.cpp delete mode 100644 extensions/test/ole/AxTestComponents/Basic.h delete mode 100644 extensions/test/ole/AxTestComponents/Basic.rgs delete mode 100644 extensions/test/ole/AxTestComponents/Foo.cpp delete mode 100644 extensions/test/ole/AxTestComponents/Foo.h delete mode 100644 extensions/test/ole/AxTestComponents/StdAfx.cpp delete mode 100644 extensions/test/ole/AxTestComponents/StdAfx.h delete mode 100644 extensions/test/ole/AxTestComponents/readme.txt delete mode 100644 extensions/test/ole/AxTestComponents/resource.h delete mode 100644 extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas delete mode 100644 extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp delete mode 100644 extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw delete mode 100644 extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt delete mode 100644 extensions/test/ole/DCOM/dcom_test/Module1.bas delete mode 100644 extensions/test/ole/DCOM/dcom_test/dcom_test.vbp delete mode 100644 extensions/test/ole/DCOM/dcom_test/dcom_test.vbw delete mode 100644 extensions/test/ole/DCOM/dcom_test/readme.txt delete mode 100644 extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc delete mode 100644 extensions/test/ole/DCOM/scriptComponents/readme.txt delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.def delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.idl delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.rc delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.sln delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EvtListener.h delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/StdAfx.h delete mode 100644 extensions/test/ole/EventListenerSample/EventListener/resource.h delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.dll delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw delete mode 100644 extensions/test/ole/EventListenerSample/VBEventListener/readme.txt delete mode 100644 extensions/test/ole/EventListenerSample/events.htm delete mode 100644 extensions/test/ole/EventListenerSample/readme.txt delete mode 100644 extensions/test/ole/JScriptNewStyle.htm delete mode 100644 extensions/test/ole/MfcControl/MfcControl.cpp delete mode 100644 extensions/test/ole/MfcControl/MfcControl.def delete mode 100644 extensions/test/ole/MfcControl/MfcControl.dsp delete mode 100644 extensions/test/ole/MfcControl/MfcControl.h delete mode 100644 extensions/test/ole/MfcControl/MfcControl.odl delete mode 100644 extensions/test/ole/MfcControl/MfcControl.rc delete mode 100644 extensions/test/ole/MfcControl/MfcControl.sln delete mode 100644 extensions/test/ole/MfcControl/MfcControl.vcproj delete mode 100644 extensions/test/ole/MfcControl/MfcControlCtl.cpp delete mode 100644 extensions/test/ole/MfcControl/MfcControlCtl.h delete mode 100644 extensions/test/ole/MfcControl/MfcControlCtl.png delete mode 100644 extensions/test/ole/MfcControl/MfcControlPpg.cpp delete mode 100644 extensions/test/ole/MfcControl/MfcControlPpg.h delete mode 100644 extensions/test/ole/MfcControl/Resource.h delete mode 100644 extensions/test/ole/MfcControl/StdAfx.cpp delete mode 100644 extensions/test/ole/MfcControl/StdAfx.h delete mode 100644 extensions/test/ole/OleClient/OleClient.ini delete mode 100644 extensions/test/ole/OleClient/axhost.cxx delete mode 100644 extensions/test/ole/OleClient/axhost.hxx delete mode 100644 extensions/test/ole/OleClient/clientTest.cxx delete mode 100644 extensions/test/ole/OleClient/funcs.cxx delete mode 100644 extensions/test/ole/OleClient/makefile.mk delete mode 100644 extensions/test/ole/OleClient/readme.txt delete mode 100644 extensions/test/ole/OleConverterVar1/convTest.cxx delete mode 100644 extensions/test/ole/OleConverterVar1/makefile.mk delete mode 100644 extensions/test/ole/OleConverterVar1/readme.txt delete mode 100644 extensions/test/ole/OleConverterVar1/smartarray.h delete mode 100644 extensions/test/ole/OleTest.htm delete mode 100644 extensions/test/ole/ScriptTest.html delete mode 100644 extensions/test/ole/StarBasic_OleClient/oleclient.bas delete mode 100644 extensions/test/ole/StarBasic_OleClient/readme.txt delete mode 100644 extensions/test/ole/VisualBasic/AssemblyInfo.vb delete mode 100644 extensions/test/ole/VisualBasic/Module1.vb delete mode 100644 extensions/test/ole/VisualBasic/Project1.sln delete mode 100644 extensions/test/ole/VisualBasic/Project1.vbproj delete mode 100644 extensions/test/ole/VisualBasic/readme.txt delete mode 100644 extensions/test/ole/callUnoToJava.htm delete mode 100644 extensions/test/ole/cpnt/cpnt.cxx delete mode 100644 extensions/test/ole/cpnt/exports.dxp delete mode 100644 extensions/test/ole/cpnt/makefile.mk delete mode 100644 extensions/test/ole/cpnt/readme.txt delete mode 100644 extensions/test/ole/cppToUno/makefile.mk delete mode 100644 extensions/test/ole/cppToUno/readme.txt delete mode 100644 extensions/test/ole/cppToUno/testcppuno.cxx delete mode 100644 extensions/test/ole/cpptest/cpptest.cxx delete mode 100644 extensions/test/ole/cpptest/makefile.mk delete mode 100644 extensions/test/ole/cpptest/readme.txt delete mode 100644 extensions/test/ole/idl/oletest.idl delete mode 100644 extensions/test/ole/unloading/makefile.mk delete mode 100644 extensions/test/ole/unloading/readme.txt delete mode 100644 extensions/test/ole/unloading/unloadTest.cxx delete mode 100644 extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/Test/StdAfx.h delete mode 100644 extensions/test/ole/unoTocomCalls/Test/Test.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/Test/Test.dsp delete mode 100644 extensions/test/ole/unoTocomCalls/Test/Test.sln delete mode 100644 extensions/test/ole/unoTocomCalls/Test/Test.vcproj delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj delete mode 100644 extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h delete mode 100644 extensions/test/ole/unoTocomCalls/readme.txt delete mode 100644 extensions/test/pgp/TestPGP.java delete mode 100644 extensions/test/pgp/makefile.mk delete mode 100644 extensions/test/pgp/readme.txt delete mode 100644 extensions/test/stm/datatest.cxx delete mode 100644 extensions/test/stm/exports.dxp delete mode 100644 extensions/test/stm/makefile.mk delete mode 100644 extensions/test/stm/marktest.cxx delete mode 100644 extensions/test/stm/pipetest.cxx delete mode 100644 extensions/test/stm/testfactreg.cxx delete mode 100644 extensions/test/stm/testfactreg.hxx delete mode 100644 extensions/util/hidother.src delete mode 100644 extensions/util/makefile.mk delete mode 100644 extensions/util/makefile.pmk delete mode 100644 extensions/util/target.pmk delete mode 100644 extensions/workben/makefile.mk delete mode 100644 extensions/workben/pythonautotest.cxx delete mode 100644 extensions/workben/pythontest.cxx delete mode 100644 extensions/workben/testcomponent.cxx delete mode 100644 extensions/workben/testframecontrol.cxx delete mode 100644 extensions/workben/testpgp.cxx delete mode 100644 extensions/workben/testresource.cxx delete mode 100644 extensions/workben/testresource.src delete mode 100644 forms/AllLangResTarget_frm.mk delete mode 100644 forms/JunitTest_forms_complex.mk delete mode 100644 forms/JunitTest_forms_unoapi.mk delete mode 100644 forms/Library_frm.mk delete mode 100644 forms/Makefile delete mode 100644 forms/Module_forms.mk delete mode 100644 forms/Package_unotypes.mk delete mode 100644 forms/inc/pch/precompiled_forms.cxx delete mode 100644 forms/inc/pch/precompiled_forms.hxx delete mode 100644 forms/prj/build.lst delete mode 100644 forms/prj/d.lst delete mode 100755 forms/prj/makefile.mk delete mode 100644 forms/qa/complex/forms/CheckOGroupBoxModel.java delete mode 100644 forms/qa/forms_all.sce delete mode 100644 forms/qa/integration/forms/BooleanValidator.java delete mode 100644 forms/qa/integration/forms/CellBinding.java delete mode 100644 forms/qa/integration/forms/ControlValidation.java delete mode 100644 forms/qa/integration/forms/ControlValidator.java delete mode 100644 forms/qa/integration/forms/DateValidator.java delete mode 100644 forms/qa/integration/forms/DocumentHelper.java delete mode 100644 forms/qa/integration/forms/DocumentType.java delete mode 100644 forms/qa/integration/forms/DocumentViewHelper.java delete mode 100644 forms/qa/integration/forms/FormComponent.java delete mode 100644 forms/qa/integration/forms/FormControlTest.java delete mode 100644 forms/qa/integration/forms/FormLayer.java delete mode 100644 forms/qa/integration/forms/FormPropertyBags.java delete mode 100644 forms/qa/integration/forms/ImageComparison.java delete mode 100644 forms/qa/integration/forms/ListBox.java delete mode 100644 forms/qa/integration/forms/ListSelection.java delete mode 100644 forms/qa/integration/forms/ListSelection.props delete mode 100644 forms/qa/integration/forms/ListSelectionValidator.java delete mode 100644 forms/qa/integration/forms/MasterDetailForms.java delete mode 100644 forms/qa/integration/forms/NumericValidator.java delete mode 100644 forms/qa/integration/forms/RadioButtons.java delete mode 100644 forms/qa/integration/forms/SingleControlValidation.java delete mode 100644 forms/qa/integration/forms/SpreadsheetDocument.java delete mode 100644 forms/qa/integration/forms/SpreadsheetView.java delete mode 100644 forms/qa/integration/forms/TableCellTextBinding.java delete mode 100644 forms/qa/integration/forms/TestCase.java delete mode 100644 forms/qa/integration/forms/TestSkeleton.java delete mode 100644 forms/qa/integration/forms/TextValidator.java delete mode 100644 forms/qa/integration/forms/TimeValidator.java delete mode 100644 forms/qa/integration/forms/ValueBinding.java delete mode 100644 forms/qa/integration/forms/WaitForInput.java delete mode 100644 forms/qa/integration/forms/XMLFormSettings.java delete mode 100644 forms/qa/integration/forms/dbfTools.java delete mode 100644 forms/qa/org/openoffice/complex/forms/tools/ResultSet.java delete mode 100644 forms/qa/org/openoffice/xforms/Instance.java delete mode 100644 forms/qa/org/openoffice/xforms/Model.java delete mode 100644 forms/qa/org/openoffice/xforms/XMLDocument.java delete mode 100644 forms/qa/unoapi/forms.sce delete mode 100644 forms/qa/unoapi/knownissues.xcl delete mode 100644 forms/qa/unoapi/testdocuments/TestDB/testDB.dbf delete mode 100644 forms/qa/unoapi/testdocuments/TestDB/testDB.dbt delete mode 100644 forms/source/component/BaseListBox.hxx delete mode 100644 forms/source/component/Button.cxx delete mode 100644 forms/source/component/Button.hxx delete mode 100644 forms/source/component/CheckBox.cxx delete mode 100644 forms/source/component/CheckBox.hxx delete mode 100644 forms/source/component/Columns.cxx delete mode 100644 forms/source/component/Columns.hxx delete mode 100644 forms/source/component/ComboBox.cxx delete mode 100644 forms/source/component/ComboBox.hxx delete mode 100644 forms/source/component/Currency.cxx delete mode 100644 forms/source/component/Currency.hxx delete mode 100644 forms/source/component/DatabaseForm.cxx delete mode 100644 forms/source/component/DatabaseForm.hxx delete mode 100644 forms/source/component/Date.cxx delete mode 100644 forms/source/component/Date.hxx delete mode 100644 forms/source/component/Edit.cxx delete mode 100644 forms/source/component/Edit.hxx delete mode 100644 forms/source/component/EditBase.cxx delete mode 100644 forms/source/component/EditBase.hxx delete mode 100644 forms/source/component/EventThread.cxx delete mode 100644 forms/source/component/EventThread.hxx delete mode 100644 forms/source/component/File.cxx delete mode 100644 forms/source/component/File.hxx delete mode 100644 forms/source/component/Filter.cxx delete mode 100644 forms/source/component/Filter.hxx delete mode 100644 forms/source/component/FixedText.cxx delete mode 100644 forms/source/component/FixedText.hxx delete mode 100644 forms/source/component/FormComponent.cxx delete mode 100644 forms/source/component/FormattedField.cxx delete mode 100644 forms/source/component/FormattedField.hxx delete mode 100644 forms/source/component/FormattedFieldWrapper.cxx delete mode 100644 forms/source/component/FormattedFieldWrapper.hxx delete mode 100644 forms/source/component/FormsCollection.cxx delete mode 100644 forms/source/component/FormsCollection.hxx delete mode 100644 forms/source/component/Grid.cxx delete mode 100644 forms/source/component/Grid.hxx delete mode 100644 forms/source/component/GroupBox.cxx delete mode 100644 forms/source/component/GroupBox.hxx delete mode 100644 forms/source/component/GroupManager.cxx delete mode 100644 forms/source/component/GroupManager.hxx delete mode 100644 forms/source/component/Hidden.cxx delete mode 100644 forms/source/component/Hidden.hxx delete mode 100644 forms/source/component/ImageButton.cxx delete mode 100644 forms/source/component/ImageButton.hxx delete mode 100644 forms/source/component/ImageControl.cxx delete mode 100644 forms/source/component/ImageControl.hxx delete mode 100644 forms/source/component/ListBox.cxx delete mode 100644 forms/source/component/ListBox.hxx delete mode 100644 forms/source/component/Numeric.cxx delete mode 100644 forms/source/component/Numeric.hxx delete mode 100644 forms/source/component/Pattern.cxx delete mode 100644 forms/source/component/Pattern.hxx delete mode 100644 forms/source/component/RadioButton.cxx delete mode 100644 forms/source/component/RadioButton.hxx delete mode 100644 forms/source/component/Time.cxx delete mode 100644 forms/source/component/Time.hxx delete mode 100644 forms/source/component/cachedrowset.cxx delete mode 100644 forms/source/component/cachedrowset.hxx delete mode 100644 forms/source/component/clickableimage.cxx delete mode 100644 forms/source/component/clickableimage.hxx delete mode 100644 forms/source/component/cloneable.cxx delete mode 100644 forms/source/component/entrylisthelper.cxx delete mode 100644 forms/source/component/entrylisthelper.hxx delete mode 100644 forms/source/component/errorbroadcaster.cxx delete mode 100644 forms/source/component/errorbroadcaster.hxx delete mode 100644 forms/source/component/findpos.cxx delete mode 100644 forms/source/component/findpos.hxx delete mode 100644 forms/source/component/formcontrolfont.cxx delete mode 100644 forms/source/component/imgprod.cxx delete mode 100644 forms/source/component/imgprod.hxx delete mode 100644 forms/source/component/navigationbar.cxx delete mode 100644 forms/source/component/navigationbar.hxx delete mode 100644 forms/source/component/propertybaghelper.cxx delete mode 100644 forms/source/component/refvaluecomponent.cxx delete mode 100644 forms/source/component/refvaluecomponent.hxx delete mode 100644 forms/source/component/scrollbar.cxx delete mode 100644 forms/source/component/scrollbar.hxx delete mode 100644 forms/source/component/spinbutton.cxx delete mode 100644 forms/source/component/spinbutton.hxx delete mode 100644 forms/source/helper/commanddescriptionprovider.cxx delete mode 100644 forms/source/helper/commandimageprovider.cxx delete mode 100644 forms/source/helper/controlfeatureinterception.cxx delete mode 100644 forms/source/helper/formnavigation.cxx delete mode 100644 forms/source/helper/resettable.cxx delete mode 100644 forms/source/helper/urltransformer.cxx delete mode 100644 forms/source/helper/windowstateguard.cxx delete mode 100644 forms/source/inc/FormComponent.hxx delete mode 100644 forms/source/inc/InterfaceContainer.hxx delete mode 100644 forms/source/inc/cloneable.hxx delete mode 100644 forms/source/inc/commanddescriptionprovider.hxx delete mode 100644 forms/source/inc/commandimageprovider.hxx delete mode 100644 forms/source/inc/componenttools.hxx delete mode 100644 forms/source/inc/controlfeatureinterception.hxx delete mode 100644 forms/source/inc/featuredispatcher.hxx delete mode 100644 forms/source/inc/formcontrolfont.hxx delete mode 100644 forms/source/inc/formnavigation.hxx delete mode 100644 forms/source/inc/forms_module.hxx delete mode 100644 forms/source/inc/forms_module_impl.hxx delete mode 100644 forms/source/inc/frm_module.hxx delete mode 100644 forms/source/inc/frm_resource.hrc delete mode 100644 forms/source/inc/frm_resource.hxx delete mode 100644 forms/source/inc/frm_strings.hxx delete mode 100644 forms/source/inc/ids.hxx delete mode 100644 forms/source/inc/limitedformats.hxx delete mode 100644 forms/source/inc/listenercontainers.hxx delete mode 100644 forms/source/inc/property.hrc delete mode 100644 forms/source/inc/property.hxx delete mode 100644 forms/source/inc/propertybaghelper.hxx delete mode 100644 forms/source/inc/resettable.hxx delete mode 100644 forms/source/inc/services.hxx delete mode 100644 forms/source/inc/togglestate.hxx delete mode 100644 forms/source/inc/urltransformer.hxx delete mode 100644 forms/source/inc/windowstateguard.hxx delete mode 100644 forms/source/misc/InterfaceContainer.cxx delete mode 100644 forms/source/misc/componenttools.cxx delete mode 100644 forms/source/misc/frm_module.cxx delete mode 100644 forms/source/misc/frm_strings.cxx delete mode 100644 forms/source/misc/ids.cxx delete mode 100644 forms/source/misc/limitedformats.cxx delete mode 100644 forms/source/misc/listenercontainers.cxx delete mode 100644 forms/source/misc/property.cxx delete mode 100644 forms/source/misc/services.cxx delete mode 100644 forms/source/resource/frm_resource.cxx delete mode 100644 forms/source/resource/strings.src delete mode 100644 forms/source/resource/xforms.src delete mode 100644 forms/source/richtext/attributedispatcher.cxx delete mode 100644 forms/source/richtext/attributedispatcher.hxx delete mode 100644 forms/source/richtext/clipboarddispatcher.cxx delete mode 100644 forms/source/richtext/clipboarddispatcher.hxx delete mode 100644 forms/source/richtext/featuredispatcher.cxx delete mode 100644 forms/source/richtext/featuredispatcher.hxx delete mode 100644 forms/source/richtext/parametrizedattributedispatcher.cxx delete mode 100644 forms/source/richtext/parametrizedattributedispatcher.hxx delete mode 100644 forms/source/richtext/richtextcontrol.cxx delete mode 100644 forms/source/richtext/richtextcontrol.hxx delete mode 100644 forms/source/richtext/richtextengine.cxx delete mode 100644 forms/source/richtext/richtextengine.hxx delete mode 100644 forms/source/richtext/richtextimplcontrol.cxx delete mode 100644 forms/source/richtext/richtextimplcontrol.hxx delete mode 100644 forms/source/richtext/richtextmodel.cxx delete mode 100644 forms/source/richtext/richtextmodel.hxx delete mode 100644 forms/source/richtext/richtextunowrapper.cxx delete mode 100644 forms/source/richtext/richtextunowrapper.hxx delete mode 100644 forms/source/richtext/richtextvclcontrol.cxx delete mode 100644 forms/source/richtext/richtextvclcontrol.hxx delete mode 100644 forms/source/richtext/richtextviewport.cxx delete mode 100644 forms/source/richtext/richtextviewport.hxx delete mode 100644 forms/source/richtext/rtattributehandler.cxx delete mode 100644 forms/source/richtext/rtattributehandler.hxx delete mode 100644 forms/source/richtext/rtattributes.hxx delete mode 100644 forms/source/richtext/specialdispatchers.cxx delete mode 100644 forms/source/richtext/specialdispatchers.hxx delete mode 100644 forms/source/richtext/textattributelistener.hxx delete mode 100644 forms/source/runtime/formoperations.cxx delete mode 100644 forms/source/runtime/formoperations.hxx delete mode 100644 forms/source/solar/component/navbarcontrol.cxx delete mode 100644 forms/source/solar/component/navbarcontrol.hxx delete mode 100644 forms/source/solar/control/navtoolbar.cxx delete mode 100644 forms/source/solar/inc/navtoolbar.hxx delete mode 100644 forms/source/xforms/NameContainer.hxx delete mode 100644 forms/source/xforms/binding.cxx delete mode 100644 forms/source/xforms/binding.hxx delete mode 100644 forms/source/xforms/boolexpression.cxx delete mode 100644 forms/source/xforms/boolexpression.hxx delete mode 100644 forms/source/xforms/collection.hxx delete mode 100644 forms/source/xforms/computedexpression.cxx delete mode 100644 forms/source/xforms/computedexpression.hxx delete mode 100644 forms/source/xforms/convert.cxx delete mode 100644 forms/source/xforms/convert.hxx delete mode 100644 forms/source/xforms/datatyperepository.cxx delete mode 100644 forms/source/xforms/datatyperepository.hxx delete mode 100644 forms/source/xforms/datatypes.cxx delete mode 100644 forms/source/xforms/datatypes.hxx delete mode 100644 forms/source/xforms/datatypes_impl.hxx delete mode 100644 forms/source/xforms/enumeration.cxx delete mode 100644 forms/source/xforms/enumeration.hxx delete mode 100644 forms/source/xforms/evaluationcontext.hxx delete mode 100644 forms/source/xforms/mip.cxx delete mode 100644 forms/source/xforms/mip.hxx delete mode 100644 forms/source/xforms/model.cxx delete mode 100644 forms/source/xforms/model.hxx delete mode 100644 forms/source/xforms/model_helper.hxx delete mode 100644 forms/source/xforms/model_ui.cxx delete mode 100644 forms/source/xforms/namedcollection.hxx delete mode 100644 forms/source/xforms/pathexpression.cxx delete mode 100644 forms/source/xforms/pathexpression.hxx delete mode 100644 forms/source/xforms/propertysetbase.cxx delete mode 100644 forms/source/xforms/propertysetbase.hxx delete mode 100644 forms/source/xforms/resourcehelper.cxx delete mode 100644 forms/source/xforms/resourcehelper.hxx delete mode 100644 forms/source/xforms/submission.cxx delete mode 100644 forms/source/xforms/submission.hxx delete mode 100644 forms/source/xforms/submission/replace.cxx delete mode 100644 forms/source/xforms/submission/serialization.hxx delete mode 100644 forms/source/xforms/submission/serialization_app_xml.cxx delete mode 100644 forms/source/xforms/submission/serialization_app_xml.hxx delete mode 100644 forms/source/xforms/submission/serialization_urlencoded.cxx delete mode 100644 forms/source/xforms/submission/serialization_urlencoded.hxx delete mode 100644 forms/source/xforms/submission/submission.hxx delete mode 100644 forms/source/xforms/submission/submission_get.cxx delete mode 100644 forms/source/xforms/submission/submission_get.hxx delete mode 100644 forms/source/xforms/submission/submission_post.cxx delete mode 100644 forms/source/xforms/submission/submission_post.hxx delete mode 100644 forms/source/xforms/submission/submission_put.cxx delete mode 100644 forms/source/xforms/submission/submission_put.hxx delete mode 100644 forms/source/xforms/unohelper.cxx delete mode 100644 forms/source/xforms/unohelper.hxx delete mode 100644 forms/source/xforms/warnings_guard_unicode_regex.h delete mode 100644 forms/source/xforms/xforms_services.cxx delete mode 100644 forms/source/xforms/xforms_services.hxx delete mode 100644 forms/source/xforms/xformsevent.cxx delete mode 100644 forms/source/xforms/xformsevent.hxx delete mode 100644 forms/source/xforms/xmlhelper.cxx delete mode 100644 forms/source/xforms/xmlhelper.hxx delete mode 100644 forms/source/xforms/xpathlib/extension.cxx delete mode 100644 forms/source/xforms/xpathlib/extension.hxx delete mode 100644 forms/source/xforms/xpathlib/xpathlib.cxx delete mode 100644 forms/source/xforms/xpathlib/xpathlib.hxx delete mode 100644 forms/util/frm.component delete mode 100644 forms/util/frm.dxp delete mode 100644 forms/util/frm.xml delete mode 100644 forms/workben/xforms/sickness.odt delete mode 100644 forms/workben/xforms/simple_validation.odt delete mode 100644 forms/workben/xforms/vacationrequest.odt delete mode 100644 forms/workben/xforms/xforms-ubl.odt delete mode 100644 lingucomponent/config/Linguistic-lingucomponent-hyphenator.xcu delete mode 100644 lingucomponent/config/Linguistic-lingucomponent-spellchecker.xcu delete mode 100644 lingucomponent/config/Linguistic-lingucomponent-thesaurus.xcu delete mode 100644 lingucomponent/inc/makefile.mk delete mode 100644 lingucomponent/inc/pch/precompiled_lingucomponent.cxx delete mode 100644 lingucomponent/inc/pch/precompiled_lingucomponent.hxx delete mode 100644 lingucomponent/prj/build.lst delete mode 100644 lingucomponent/prj/d.lst delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphen.component delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx delete mode 100644 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk delete mode 100644 lingucomponent/source/languageguessing/altstrfunc.cxx delete mode 100644 lingucomponent/source/languageguessing/altstrfunc.hxx delete mode 100644 lingucomponent/source/languageguessing/guess.cxx delete mode 100644 lingucomponent/source/languageguessing/guess.hxx delete mode 100644 lingucomponent/source/languageguessing/guesslang.component delete mode 100644 lingucomponent/source/languageguessing/guesslang.cxx delete mode 100644 lingucomponent/source/languageguessing/makefile.mk delete mode 100644 lingucomponent/source/languageguessing/simpleguesser.cxx delete mode 100644 lingucomponent/source/languageguessing/simpleguesser.hxx delete mode 100644 lingucomponent/source/lingutil/lingutil.cxx delete mode 100644 lingucomponent/source/lingutil/lingutil.hxx delete mode 100644 lingucomponent/source/lingutil/makefile.mk delete mode 100644 lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component delete mode 100644 lingucomponent/source/spellcheck/macosxspell/macreg.cxx delete mode 100644 lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx delete mode 100644 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx delete mode 100644 lingucomponent/source/spellcheck/macosxspell/makefile.mk delete mode 100644 lingucomponent/source/spellcheck/spell/exports.dxp delete mode 100644 lingucomponent/source/spellcheck/spell/makefile.mk delete mode 100644 lingucomponent/source/spellcheck/spell/spell.component delete mode 100644 lingucomponent/source/spellcheck/spell/sreg.cxx delete mode 100644 lingucomponent/source/spellcheck/spell/sspellimp.cxx delete mode 100644 lingucomponent/source/spellcheck/spell/sspellimp.hxx delete mode 100644 lingucomponent/source/thesaurus/libnth/exports.dxp delete mode 100644 lingucomponent/source/thesaurus/libnth/lnth.component delete mode 100644 lingucomponent/source/thesaurus/libnth/makefile.mk delete mode 100644 lingucomponent/source/thesaurus/libnth/nthesdta.cxx delete mode 100644 lingucomponent/source/thesaurus/libnth/nthesdta.hxx delete mode 100644 lingucomponent/source/thesaurus/libnth/nthesimp.cxx delete mode 100644 lingucomponent/source/thesaurus/libnth/nthesimp.hxx delete mode 100644 lingucomponent/source/thesaurus/libnth/ntreg.cxx delete mode 100644 package/dtd/Manifest.dtd delete mode 100644 package/inc/ByteChucker.hxx delete mode 100644 package/inc/ByteGrabber.hxx delete mode 100644 package/inc/CRC32.hxx delete mode 100644 package/inc/Deflater.hxx delete mode 100644 package/inc/EncryptedDataHeader.hxx delete mode 100644 package/inc/EncryptionData.hxx delete mode 100644 package/inc/HashMaps.hxx delete mode 100644 package/inc/Inflater.hxx delete mode 100644 package/inc/PackageConstants.hxx delete mode 100644 package/inc/ZipEntry.hxx delete mode 100644 package/inc/ZipEnumeration.hxx delete mode 100644 package/inc/ZipFile.hxx delete mode 100644 package/inc/ZipOutputStream.hxx delete mode 100644 package/inc/ZipPackage.hxx delete mode 100644 package/inc/ZipPackageBuffer.hxx delete mode 100644 package/inc/ZipPackageEntry.hxx delete mode 100644 package/inc/ZipPackageFolder.hxx delete mode 100644 package/inc/ZipPackageStream.hxx delete mode 100644 package/inc/makefile.mk delete mode 100644 package/inc/mutexholder.hxx delete mode 100644 package/inc/packagedllapi.hxx delete mode 100644 package/inc/pch/precompiled_package.cxx delete mode 100644 package/inc/pch/precompiled_package.hxx delete mode 100644 package/inc/zipfileaccess.hxx delete mode 100644 package/prj/build.lst delete mode 100644 package/prj/d.lst delete mode 100644 package/qa/ofopxmlstorages/StorageTest.java delete mode 100644 package/qa/ofopxmlstorages/StorageUnitTest.java delete mode 100644 package/qa/ofopxmlstorages/Test01.java delete mode 100644 package/qa/ofopxmlstorages/Test02.java delete mode 100644 package/qa/ofopxmlstorages/Test03.java delete mode 100644 package/qa/ofopxmlstorages/Test04.java delete mode 100644 package/qa/ofopxmlstorages/Test05.java delete mode 100644 package/qa/ofopxmlstorages/Test06.java delete mode 100644 package/qa/ofopxmlstorages/Test07.java delete mode 100644 package/qa/ofopxmlstorages/Test08.java delete mode 100644 package/qa/ofopxmlstorages/TestHelper.java delete mode 100644 package/qa/ofopxmlstorages/makefile.mk delete mode 100644 package/qa/storages/BorderedStream.java delete mode 100644 package/qa/storages/RegressionTest_114358.java delete mode 100644 package/qa/storages/RegressionTest_125919.java delete mode 100644 package/qa/storages/RegressionTest_i26398.java delete mode 100644 package/qa/storages/RegressionTest_i27773.java delete mode 100644 package/qa/storages/RegressionTest_i29169.java delete mode 100644 package/qa/storages/RegressionTest_i29321.java delete mode 100644 package/qa/storages/RegressionTest_i30400.java delete mode 100644 package/qa/storages/RegressionTest_i30677.java delete mode 100644 package/qa/storages/RegressionTest_i35095.java delete mode 100644 package/qa/storages/RegressionTest_i46848.java delete mode 100644 package/qa/storages/RegressionTest_i49755.java delete mode 100644 package/qa/storages/RegressionTest_i55821.java delete mode 100644 package/qa/storages/RegressionTest_i59886.java delete mode 100644 package/qa/storages/RegressionTest_i61909.java delete mode 100644 package/qa/storages/RegressionTest_i84234.java delete mode 100644 package/qa/storages/StorageTest.java delete mode 100644 package/qa/storages/StorageUnitTest.java delete mode 100644 package/qa/storages/Test01.java delete mode 100644 package/qa/storages/Test02.java delete mode 100644 package/qa/storages/Test03.java delete mode 100644 package/qa/storages/Test04.java delete mode 100644 package/qa/storages/Test05.java delete mode 100644 package/qa/storages/Test06.java delete mode 100644 package/qa/storages/Test07.java delete mode 100644 package/qa/storages/Test08.java delete mode 100644 package/qa/storages/Test09.java delete mode 100644 package/qa/storages/Test10.java delete mode 100644 package/qa/storages/Test11.java delete mode 100644 package/qa/storages/Test12.java delete mode 100644 package/qa/storages/Test13.java delete mode 100644 package/qa/storages/Test14.java delete mode 100644 package/qa/storages/Test15.java delete mode 100644 package/qa/storages/Test16.java delete mode 100644 package/qa/storages/Test17.java delete mode 100644 package/qa/storages/Test18.java delete mode 100644 package/qa/storages/TestHelper.java delete mode 100644 package/qa/storages/makefile.mk delete mode 100644 package/source/manifest/Base64Codec.cxx delete mode 100644 package/source/manifest/Base64Codec.hxx delete mode 100644 package/source/manifest/ManifestDefines.hxx delete mode 100644 package/source/manifest/ManifestExport.cxx delete mode 100644 package/source/manifest/ManifestExport.hxx delete mode 100644 package/source/manifest/ManifestImport.cxx delete mode 100644 package/source/manifest/ManifestImport.hxx delete mode 100644 package/source/manifest/ManifestReader.cxx delete mode 100644 package/source/manifest/ManifestReader.hxx delete mode 100644 package/source/manifest/ManifestWriter.cxx delete mode 100644 package/source/manifest/ManifestWriter.hxx delete mode 100644 package/source/manifest/UnoRegister.cxx delete mode 100644 package/source/manifest/makefile.mk delete mode 100644 package/source/xstor/disposelistener.cxx delete mode 100644 package/source/xstor/disposelistener.hxx delete mode 100644 package/source/xstor/makefile.mk delete mode 100644 package/source/xstor/ocompinstream.cxx delete mode 100644 package/source/xstor/ocompinstream.hxx delete mode 100644 package/source/xstor/ohierarchyholder.cxx delete mode 100644 package/source/xstor/ohierarchyholder.hxx delete mode 100644 package/source/xstor/oseekinstream.cxx delete mode 100644 package/source/xstor/oseekinstream.hxx delete mode 100644 package/source/xstor/owriteablestream.cxx delete mode 100644 package/source/xstor/owriteablestream.hxx delete mode 100644 package/source/xstor/register.cxx delete mode 100644 package/source/xstor/selfterminatefilestream.cxx delete mode 100644 package/source/xstor/selfterminatefilestream.hxx delete mode 100644 package/source/xstor/switchpersistencestream.cxx delete mode 100644 package/source/xstor/switchpersistencestream.hxx delete mode 100644 package/source/xstor/xfactory.cxx delete mode 100644 package/source/xstor/xfactory.hxx delete mode 100644 package/source/xstor/xstor.component delete mode 100644 package/source/xstor/xstor.dxp delete mode 100644 package/source/xstor/xstorage.cxx delete mode 100644 package/source/xstor/xstorage.hxx delete mode 100644 package/source/zipapi/ByteChucker.cxx delete mode 100644 package/source/zipapi/ByteGrabber.cxx delete mode 100644 package/source/zipapi/CRC32.cxx delete mode 100644 package/source/zipapi/Deflater.cxx delete mode 100644 package/source/zipapi/Inflater.cxx delete mode 100644 package/source/zipapi/MemoryByteGrabber.hxx delete mode 100644 package/source/zipapi/XUnbufferedStream.cxx delete mode 100644 package/source/zipapi/XUnbufferedStream.hxx delete mode 100644 package/source/zipapi/ZipEnumeration.cxx delete mode 100644 package/source/zipapi/ZipFile.cxx delete mode 100644 package/source/zipapi/ZipOutputStream.cxx delete mode 100644 package/source/zipapi/blowfishcontext.cxx delete mode 100644 package/source/zipapi/blowfishcontext.hxx delete mode 100644 package/source/zipapi/makefile.mk delete mode 100644 package/source/zipapi/sha1context.cxx delete mode 100644 package/source/zipapi/sha1context.hxx delete mode 100644 package/source/zippackage/ContentInfo.hxx delete mode 100644 package/source/zippackage/ZipPackage.cxx delete mode 100644 package/source/zippackage/ZipPackageBuffer.cxx delete mode 100644 package/source/zippackage/ZipPackageEntry.cxx delete mode 100644 package/source/zippackage/ZipPackageFolder.cxx delete mode 100644 package/source/zippackage/ZipPackageFolderEnumeration.cxx delete mode 100644 package/source/zippackage/ZipPackageFolderEnumeration.hxx delete mode 100644 package/source/zippackage/ZipPackageSink.cxx delete mode 100644 package/source/zippackage/ZipPackageSink.hxx delete mode 100644 package/source/zippackage/ZipPackageStream.cxx delete mode 100644 package/source/zippackage/makefile.mk delete mode 100644 package/source/zippackage/wrapstreamforshare.cxx delete mode 100644 package/source/zippackage/wrapstreamforshare.hxx delete mode 100644 package/source/zippackage/zipfileaccess.cxx delete mode 100644 package/util/exports.dxp delete mode 100644 package/util/makefile.mk delete mode 100644 package/util/package.pmk delete mode 100644 package/util/package2.component delete mode 100644 setup_native/inc/setup_native/qswin32.h delete mode 100644 setup_native/prj/build.lst delete mode 100644 setup_native/prj/d.lst delete mode 100644 setup_native/scripts/admin.pl delete mode 100644 setup_native/scripts/deregister_extensions delete mode 100644 setup_native/scripts/downloadscript.sh delete mode 100644 setup_native/scripts/fake-db.spec delete mode 100755 setup_native/scripts/install_create.pl delete mode 100644 setup_native/scripts/install_linux.sh delete mode 100644 setup_native/scripts/install_solaris.sh delete mode 100644 setup_native/scripts/javaloader.sh delete mode 100644 setup_native/scripts/langpackscript.sh delete mode 100644 setup_native/scripts/linuxpatchscript.sh delete mode 100644 setup_native/scripts/mac_install.script delete mode 100644 setup_native/scripts/makefile.mk delete mode 100644 setup_native/scripts/osx_install_languagepack.applescript delete mode 100644 setup_native/scripts/osx_install_patch.applescript delete mode 100644 setup_native/scripts/register_extensions delete mode 100644 setup_native/scripts/source/getuid.c delete mode 100644 setup_native/scripts/source/makefile.mk delete mode 100644 setup_native/scripts/uninstall_linux.sh delete mode 100644 setup_native/scripts/uninstall_solaris.sh delete mode 100644 setup_native/scripts/unpack_update.sh delete mode 100644 setup_native/scripts/update.sh delete mode 100644 setup_native/scripts/userland.txt delete mode 100755 setup_native/source/java/javaversion.dat delete mode 100644 setup_native/source/java/javaversion2.dat delete mode 100644 setup_native/source/linux/root3.dat delete mode 100644 setup_native/source/linux/root4.dat delete mode 100644 setup_native/source/linux/root5.dat delete mode 100644 setup_native/source/mac/Info.plist.langpack delete mode 100644 setup_native/source/mac/macinstall.ulf delete mode 100644 setup_native/source/mac/makefile.mk delete mode 100644 setup_native/source/mac/ooo/DS_Store delete mode 100644 setup_native/source/mac/ooo/DS_Store_Langpack delete mode 100644 setup_native/source/mac/ooo/osxdndinstall.png delete mode 100644 setup_native/source/mac/ooo/osxdndinstall_nologo.png delete mode 100644 setup_native/source/mac/ooo3_installer.icns delete mode 100644 setup_native/source/opensolaris/bundledextensions/README delete mode 100644 setup_native/source/opensolaris/bundledextensions/installed delete mode 100644 setup_native/source/opensolaris/bundledextensions/ooo_bundled_extensions.xml delete mode 100644 setup_native/source/opensolaris/bundledextensions/svc-ooo_bundled_extensions delete mode 100644 setup_native/source/packinfo/finals_instsetoo.txt delete mode 100644 setup_native/source/packinfo/linuxcopyrightfile delete mode 100644 setup_native/source/packinfo/openoffice.pcp delete mode 100644 setup_native/source/packinfo/openofficelanguagepack.pcp delete mode 100644 setup_native/source/packinfo/package.txt delete mode 100644 setup_native/source/packinfo/package_names.txt delete mode 100644 setup_native/source/packinfo/package_names_ext.txt delete mode 100644 setup_native/source/packinfo/packinfo_accessories.txt delete mode 100644 setup_native/source/packinfo/packinfo_brand.txt delete mode 100644 setup_native/source/packinfo/packinfo_extensions.txt delete mode 100755 setup_native/source/packinfo/packinfo_office.txt delete mode 100755 setup_native/source/packinfo/packinfo_office_help.txt delete mode 100755 setup_native/source/packinfo/packinfo_office_lang.txt delete mode 100755 setup_native/source/packinfo/packinfo_sdkoo.txt delete mode 100755 setup_native/source/packinfo/packinfo_ure.txt delete mode 100644 setup_native/source/packinfo/private1copyrightfile delete mode 100755 setup_native/source/packinfo/shellscripts.txt delete mode 100644 setup_native/source/packinfo/shellscripts_brand.txt delete mode 100644 setup_native/source/packinfo/shellscripts_core01.txt delete mode 100755 setup_native/source/packinfo/shellscripts_extensions.txt delete mode 100755 setup_native/source/packinfo/shellscripts_module.txt delete mode 100755 setup_native/source/packinfo/shellscripts_root.txt delete mode 100755 setup_native/source/packinfo/solariscopyrightfile delete mode 100644 setup_native/source/packinfo/spellchecker_selection.txt delete mode 100644 setup_native/source/packinfo/ure.pcp delete mode 100644 setup_native/source/ulfconv/makefile.mk delete mode 100644 setup_native/source/ulfconv/ulfconv.cxx delete mode 100644 setup_native/source/win32/customactions/indexingfilter/exports.dxp delete mode 100644 setup_native/source/win32/customactions/indexingfilter/makefile.mk delete mode 100644 setup_native/source/win32/customactions/indexingfilter/restartindexingservice.cxx delete mode 100644 setup_native/source/win32/customactions/javafilter/exports.dxp delete mode 100644 setup_native/source/win32/customactions/javafilter/jfregca.cxx delete mode 100644 setup_native/source/win32/customactions/javafilter/makefile.mk delete mode 100644 setup_native/source/win32/customactions/languagepacks/checkrunningofficelanguagepack.cxx delete mode 100644 setup_native/source/win32/customactions/languagepacks/exports.dxp delete mode 100644 setup_native/source/win32/customactions/languagepacks/lngpckinsthelper.cxx delete mode 100644 setup_native/source/win32/customactions/languagepacks/makefile.mk delete mode 100644 setup_native/source/win32/customactions/languagepacks/respintest.cxx delete mode 100755 setup_native/source/win32/customactions/patch/exports.dxp delete mode 100755 setup_native/source/win32/customactions/patch/makefile.mk delete mode 100644 setup_native/source/win32/customactions/patch/swappatchfiles.cxx delete mode 100644 setup_native/source/win32/customactions/quickstarter/exports.dxp delete mode 100644 setup_native/source/win32/customactions/quickstarter/makefile.mk delete mode 100644 setup_native/source/win32/customactions/quickstarter/qslnkmsi.dxp delete mode 100644 setup_native/source/win32/customactions/quickstarter/quickstarter.cxx delete mode 100644 setup_native/source/win32/customactions/quickstarter/quickstarter.hxx delete mode 100644 setup_native/source/win32/customactions/quickstarter/remove_quickstart_link.cxx delete mode 100644 setup_native/source/win32/customactions/quickstarter/sdqsmsi.dxp delete mode 100644 setup_native/source/win32/customactions/quickstarter/shutdown_quickstart.cxx delete mode 100644 setup_native/source/win32/customactions/rebase/makefile.mk delete mode 100644 setup_native/source/win32/customactions/rebase/rebase.cxx delete mode 100644 setup_native/source/win32/customactions/rebase/rebase.dxp delete mode 100644 setup_native/source/win32/customactions/reg4allmsdoc/exports.dxp delete mode 100644 setup_native/source/win32/customactions/reg4allmsdoc/makefile.mk delete mode 100644 setup_native/source/win32/customactions/reg4allmsdoc/reg4allmsi.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/constants.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/exports.dxp delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/makefile.mk delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/msihelper.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/msihelper.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/reg4msdocmsi.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/register.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/register.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrar.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrar.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrationcontextinformation.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registry.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registry.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryexception.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryexception.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryvalueimpl.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryw9x.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registryw9x.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrywnt.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/registrywnt.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/stringconverter.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/stringconverter.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/userregistrar.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/userregistrar.hxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/windowsregistry.cxx delete mode 100644 setup_native/source/win32/customactions/reg4msdoc/windowsregistry.hxx delete mode 100755 setup_native/source/win32/customactions/reg64/exports.dxp delete mode 100644 setup_native/source/win32/customactions/reg64/makefile.mk delete mode 100644 setup_native/source/win32/customactions/reg64/reg64.cxx delete mode 100644 setup_native/source/win32/customactions/regactivex/exports.dxp delete mode 100644 setup_native/source/win32/customactions/regactivex/makefile.mk delete mode 100644 setup_native/source/win32/customactions/regactivex/regactivex.cxx delete mode 100644 setup_native/source/win32/customactions/regpatchactivex/exports.dxp delete mode 100644 setup_native/source/win32/customactions/regpatchactivex/makefile.mk delete mode 100644 setup_native/source/win32/customactions/regpatchactivex/regpatchactivex.cxx delete mode 100644 setup_native/source/win32/customactions/sellang/exports.dxp delete mode 100644 setup_native/source/win32/customactions/sellang/makefile.mk delete mode 100644 setup_native/source/win32/customactions/sellang/sellang.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/checkdirectory.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/checkpatches.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/copyeditiondata.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/copyextensiondata.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/dotnetcheck.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/exports.dxp delete mode 100644 setup_native/source/win32/customactions/shellextensions/iconcache.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/layerlinks.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/makefile.mk delete mode 100644 setup_native/source/win32/customactions/shellextensions/migrateinstallpath.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/postuninstall.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/registerextensions.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/setadmininstall.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/shellextensions.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/startmenuicon.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/upgrade.cxx delete mode 100644 setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx delete mode 100755 setup_native/source/win32/customactions/thesaurus/exports.dxp delete mode 100755 setup_native/source/win32/customactions/thesaurus/makefile.mk delete mode 100644 setup_native/source/win32/customactions/thesaurus/thesaurus.cxx delete mode 100644 setup_native/source/win32/customactions/tools/checkversion.cxx delete mode 100644 setup_native/source/win32/customactions/tools/exports.dxp delete mode 100644 setup_native/source/win32/customactions/tools/makefile.mk delete mode 100644 setup_native/source/win32/customactions/tools/seterror.cxx delete mode 100644 setup_native/source/win32/customactions/tools/seterror.hxx delete mode 100644 setup_native/source/win32/desktophelper.txt delete mode 100755 setup_native/source/win32/get_retval.bat delete mode 100644 setup_native/source/win32/msi-encodinglist.txt delete mode 100644 setup_native/source/win32/nsis/downloadtemplate.nsi delete mode 100644 setup_native/source/win32/nsis/ooobanner.bmp delete mode 100644 setup_native/source/win32/nsis/ooobitmap.bmp delete mode 100644 setup_native/source/win32/nsis/ooosdkbanner.bmp delete mode 100644 setup_native/source/win32/nsis/ooosdkbitmap.bmp delete mode 100644 setup_native/source/win32/nsis/ooosetup.ico delete mode 100644 setup_native/source/win32/nsis/urebanner.bmp delete mode 100644 setup_native/source/win32/nsis/urebitmap.bmp delete mode 100644 setup_native/source/win32/patchlist.txt delete mode 100644 setup_native/tests/opensolaris/bundledextensions/send_ooo delete mode 100644 wizards/AllLangResTarget_cal.mk delete mode 100644 wizards/AllLangResTarget_dbw.mk delete mode 100644 wizards/AllLangResTarget_eur.mk delete mode 100644 wizards/AllLangResTarget_imp.mk delete mode 100644 wizards/AllLangResTarget_tpl.mk delete mode 100644 wizards/AllLangResTarget_wwz.mk delete mode 100644 wizards/AllLangResTarget_wzi.mk delete mode 100644 wizards/Jar_agenda.mk delete mode 100644 wizards/Jar_commonwizards.mk delete mode 100644 wizards/Jar_fax.mk delete mode 100644 wizards/Jar_form.mk delete mode 100644 wizards/Jar_letter.mk delete mode 100644 wizards/Jar_query.mk delete mode 100644 wizards/Jar_report.mk delete mode 100644 wizards/Jar_reportbuilder.mk delete mode 100644 wizards/Jar_table.mk delete mode 100644 wizards/Jar_web.mk delete mode 100644 wizards/Makefile delete mode 100644 wizards/Module_wizards.mk delete mode 100644 wizards/Zip_depot.mk delete mode 100644 wizards/Zip_euro.mk delete mode 100644 wizards/Zip_form.mk delete mode 100644 wizards/Zip_gimmicks.mk delete mode 100644 wizards/Zip_import.mk delete mode 100644 wizards/Zip_launcher.mk delete mode 100644 wizards/Zip_schedule.mk delete mode 100644 wizards/Zip_share.mk delete mode 100644 wizards/Zip_standard.mk delete mode 100644 wizards/Zip_template.mk delete mode 100644 wizards/Zip_tools.mk delete mode 100644 wizards/Zip_tutorials.mk delete mode 100644 wizards/Zip_usr.mk delete mode 100644 wizards/Zip_web.mk delete mode 100755 wizards/com/sun/star/wizards/RemoteFaxWizard delete mode 100755 wizards/com/sun/star/wizards/RemoteLetterWizard delete mode 100644 wizards/com/sun/star/wizards/__init__.py delete mode 100644 wizards/com/sun/star/wizards/agenda/AgendaTemplate.java delete mode 100644 wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java delete mode 100644 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java delete mode 100644 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java delete mode 100644 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java delete mode 100644 wizards/com/sun/star/wizards/agenda/CGAgenda.java delete mode 100644 wizards/com/sun/star/wizards/agenda/CGTopic.java delete mode 100644 wizards/com/sun/star/wizards/agenda/CallWizard.java delete mode 100644 wizards/com/sun/star/wizards/agenda/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/agenda/TemplateConsts.java delete mode 100644 wizards/com/sun/star/wizards/agenda/TopicsControl.java delete mode 100644 wizards/com/sun/star/wizards/agenda/agenda.component delete mode 100644 wizards/com/sun/star/wizards/agenda/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/common/ConfigGroup.java delete mode 100644 wizards/com/sun/star/wizards/common/ConfigGroup.py delete mode 100644 wizards/com/sun/star/wizards/common/ConfigNode.java delete mode 100644 wizards/com/sun/star/wizards/common/ConfigNode.py delete mode 100644 wizards/com/sun/star/wizards/common/ConfigSet.java delete mode 100644 wizards/com/sun/star/wizards/common/Configuration.java delete mode 100644 wizards/com/sun/star/wizards/common/Configuration.py delete mode 100644 wizards/com/sun/star/wizards/common/DebugHelper.java delete mode 100644 wizards/com/sun/star/wizards/common/DebugHelper.py delete mode 100644 wizards/com/sun/star/wizards/common/Desktop.java delete mode 100644 wizards/com/sun/star/wizards/common/Desktop.py delete mode 100644 wizards/com/sun/star/wizards/common/FileAccess.java delete mode 100644 wizards/com/sun/star/wizards/common/FileAccess.py delete mode 100644 wizards/com/sun/star/wizards/common/HelpIds.java delete mode 100644 wizards/com/sun/star/wizards/common/HelpIds.py delete mode 100644 wizards/com/sun/star/wizards/common/Helper.java delete mode 100644 wizards/com/sun/star/wizards/common/Helper.py delete mode 100644 wizards/com/sun/star/wizards/common/IRenderer.java delete mode 100644 wizards/com/sun/star/wizards/common/Indexable.java delete mode 100644 wizards/com/sun/star/wizards/common/InvalidQueryException.java delete mode 100644 wizards/com/sun/star/wizards/common/JavaTools.java delete mode 100644 wizards/com/sun/star/wizards/common/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/common/NamedValueCollection.java delete mode 100644 wizards/com/sun/star/wizards/common/NoValidPathException.java delete mode 100644 wizards/com/sun/star/wizards/common/NoValidPathException.py delete mode 100644 wizards/com/sun/star/wizards/common/NumberFormatter.java delete mode 100644 wizards/com/sun/star/wizards/common/NumberFormatter.py delete mode 100644 wizards/com/sun/star/wizards/common/NumericalHelper.java delete mode 100644 wizards/com/sun/star/wizards/common/Properties.java delete mode 100644 wizards/com/sun/star/wizards/common/PropertyNames.java delete mode 100644 wizards/com/sun/star/wizards/common/PropertyNames.py delete mode 100644 wizards/com/sun/star/wizards/common/PropertySetHelper.java delete mode 100644 wizards/com/sun/star/wizards/common/PropertySetHelper.py delete mode 100644 wizards/com/sun/star/wizards/common/Resource.java delete mode 100644 wizards/com/sun/star/wizards/common/Resource.java.orig delete mode 100644 wizards/com/sun/star/wizards/common/Resource.py delete mode 100644 wizards/com/sun/star/wizards/common/SystemDialog.java delete mode 100644 wizards/com/sun/star/wizards/common/SystemDialog.py delete mode 100644 wizards/com/sun/star/wizards/common/TerminateWizardException.java delete mode 100644 wizards/com/sun/star/wizards/common/UCB.java delete mode 100644 wizards/com/sun/star/wizards/common/XMLHelper.java delete mode 100644 wizards/com/sun/star/wizards/common/XMLProvider.java delete mode 100644 wizards/com/sun/star/wizards/common/__init__.py delete mode 100644 wizards/com/sun/star/wizards/common/delzip delete mode 100644 wizards/com/sun/star/wizards/common/prova.py delete mode 100644 wizards/com/sun/star/wizards/db/BlindtextCreator.java delete mode 100644 wizards/com/sun/star/wizards/db/ColumnPropertySet.java delete mode 100644 wizards/com/sun/star/wizards/db/CommandMetaData.java delete mode 100644 wizards/com/sun/star/wizards/db/CommandName.java delete mode 100644 wizards/com/sun/star/wizards/db/DBMetaData.java delete mode 100644 wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java delete mode 100644 wizards/com/sun/star/wizards/db/FieldColumn.java delete mode 100644 wizards/com/sun/star/wizards/db/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/db/QueryMetaData.java delete mode 100644 wizards/com/sun/star/wizards/db/RecordParser.java delete mode 100644 wizards/com/sun/star/wizards/db/RelationController.java delete mode 100644 wizards/com/sun/star/wizards/db/SQLQueryComposer.java delete mode 100644 wizards/com/sun/star/wizards/db/TableDescriptor.java delete mode 100644 wizards/com/sun/star/wizards/db/TypeInspector.java delete mode 100644 wizards/com/sun/star/wizards/document/Control.java delete mode 100644 wizards/com/sun/star/wizards/document/DatabaseControl.java delete mode 100644 wizards/com/sun/star/wizards/document/FormHandler.java delete mode 100644 wizards/com/sun/star/wizards/document/GridControl.java delete mode 100644 wizards/com/sun/star/wizards/document/OfficeDocument.java delete mode 100644 wizards/com/sun/star/wizards/document/OfficeDocument.py delete mode 100644 wizards/com/sun/star/wizards/document/Shape.java delete mode 100644 wizards/com/sun/star/wizards/document/TimeStampControl.java delete mode 100644 wizards/com/sun/star/wizards/document/__init__.py delete mode 100644 wizards/com/sun/star/wizards/fax/CGFax.java delete mode 100644 wizards/com/sun/star/wizards/fax/CGFax.py delete mode 100644 wizards/com/sun/star/wizards/fax/CGFaxWizard.java delete mode 100644 wizards/com/sun/star/wizards/fax/CGFaxWizard.py delete mode 100644 wizards/com/sun/star/wizards/fax/CallWizard.java delete mode 100644 wizards/com/sun/star/wizards/fax/CallWizard.py delete mode 100644 wizards/com/sun/star/wizards/fax/FaxDocument.java delete mode 100644 wizards/com/sun/star/wizards/fax/FaxDocument.py delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialog.java delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialog.py delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.py delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java delete mode 100644 wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py delete mode 100644 wizards/com/sun/star/wizards/fax/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/fax/__init__.py delete mode 100644 wizards/com/sun/star/wizards/fax/fax.component delete mode 100644 wizards/com/sun/star/wizards/fax/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/form/CallFormWizard.java delete mode 100644 wizards/com/sun/star/wizards/form/DataEntrySetter.java delete mode 100644 wizards/com/sun/star/wizards/form/FieldLinker.java delete mode 100644 wizards/com/sun/star/wizards/form/Finalizer.java delete mode 100644 wizards/com/sun/star/wizards/form/FormConfiguration.java delete mode 100644 wizards/com/sun/star/wizards/form/FormControlArranger.java delete mode 100644 wizards/com/sun/star/wizards/form/FormDocument.java delete mode 100644 wizards/com/sun/star/wizards/form/FormWizard.java delete mode 100644 wizards/com/sun/star/wizards/form/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/form/StyleApplier.java delete mode 100644 wizards/com/sun/star/wizards/form/UIControlArranger.java delete mode 100644 wizards/com/sun/star/wizards/form/form.component delete mode 100644 wizards/com/sun/star/wizards/form/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/letter/CGLetter.java delete mode 100644 wizards/com/sun/star/wizards/letter/CGLetter.py delete mode 100644 wizards/com/sun/star/wizards/letter/CGLetterWizard.java delete mode 100644 wizards/com/sun/star/wizards/letter/CGLetterWizard.py delete mode 100644 wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java delete mode 100644 wizards/com/sun/star/wizards/letter/CGPaperElementLocation.py delete mode 100644 wizards/com/sun/star/wizards/letter/CallWizard.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterDocument.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterDocument.py delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialog.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialog.py delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.py delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java delete mode 100644 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py delete mode 100644 wizards/com/sun/star/wizards/letter/LocaleCodes.java delete mode 100644 wizards/com/sun/star/wizards/letter/LocaleCodes.py delete mode 100644 wizards/com/sun/star/wizards/letter/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/letter/__init__.py delete mode 100644 wizards/com/sun/star/wizards/letter/letter.component delete mode 100644 wizards/com/sun/star/wizards/letter/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/query/CallQueryWizard.java delete mode 100644 wizards/com/sun/star/wizards/query/Finalizer.java delete mode 100644 wizards/com/sun/star/wizards/query/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/query/QuerySummary.java delete mode 100644 wizards/com/sun/star/wizards/query/QueryWizard.java delete mode 100644 wizards/com/sun/star/wizards/query/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/query/query.component delete mode 100644 wizards/com/sun/star/wizards/report/CallReportWizard.java delete mode 100644 wizards/com/sun/star/wizards/report/DBColumn.java delete mode 100644 wizards/com/sun/star/wizards/report/Dataimport.java delete mode 100644 wizards/com/sun/star/wizards/report/GroupFieldHandler.java delete mode 100755 wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java delete mode 100755 wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java delete mode 100644 wizards/com/sun/star/wizards/report/IReportDocument.java delete mode 100644 wizards/com/sun/star/wizards/report/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/report/RecordTable.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportFinalizer.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportImplementationHelper.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportLayouter.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportTextDocument.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportTextImplementation.java delete mode 100644 wizards/com/sun/star/wizards/report/ReportWizard.java delete mode 100644 wizards/com/sun/star/wizards/report/delzip delete mode 100644 wizards/com/sun/star/wizards/report/report.component delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/Manifest.mf delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java delete mode 100644 wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/table/CGCategory.java delete mode 100644 wizards/com/sun/star/wizards/table/CGTable.java delete mode 100644 wizards/com/sun/star/wizards/table/CallTableWizard.java delete mode 100644 wizards/com/sun/star/wizards/table/FieldDescription.java delete mode 100644 wizards/com/sun/star/wizards/table/FieldFormatter.java delete mode 100644 wizards/com/sun/star/wizards/table/Finalizer.java delete mode 100644 wizards/com/sun/star/wizards/table/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java delete mode 100644 wizards/com/sun/star/wizards/table/ScenarioSelector.java delete mode 100644 wizards/com/sun/star/wizards/table/TableWizard.java delete mode 100644 wizards/com/sun/star/wizards/table/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/table/table.component delete mode 100644 wizards/com/sun/star/wizards/text/TextDocument.java delete mode 100644 wizards/com/sun/star/wizards/text/TextDocument.py delete mode 100644 wizards/com/sun/star/wizards/text/TextFieldHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/TextFieldHandler.py delete mode 100644 wizards/com/sun/star/wizards/text/TextFrameHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/TextSectionHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/TextSectionHandler.py delete mode 100644 wizards/com/sun/star/wizards/text/TextStyleHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/TextTableHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/ViewHandler.java delete mode 100644 wizards/com/sun/star/wizards/text/ViewHandler.py delete mode 100644 wizards/com/sun/star/wizards/text/__init__.py delete mode 100644 wizards/com/sun/star/wizards/ui/AggregateComponent.java delete mode 100644 wizards/com/sun/star/wizards/ui/ButtonList.java delete mode 100644 wizards/com/sun/star/wizards/ui/CommandFieldSelection.java delete mode 100644 wizards/com/sun/star/wizards/ui/ControlScroller.java delete mode 100644 wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java delete mode 100644 wizards/com/sun/star/wizards/ui/DocumentPreview.java delete mode 100644 wizards/com/sun/star/wizards/ui/FieldSelection.java delete mode 100644 wizards/com/sun/star/wizards/ui/FilterComponent.java delete mode 100644 wizards/com/sun/star/wizards/ui/ImageList.java delete mode 100755 wizards/com/sun/star/wizards/ui/PathSelection.java delete mode 100644 wizards/com/sun/star/wizards/ui/PathSelection.py delete mode 100644 wizards/com/sun/star/wizards/ui/PeerConfig.java delete mode 100644 wizards/com/sun/star/wizards/ui/SortingComponent.java delete mode 100644 wizards/com/sun/star/wizards/ui/TitlesComponent.java delete mode 100644 wizards/com/sun/star/wizards/ui/UIConsts.java delete mode 100644 wizards/com/sun/star/wizards/ui/UIConsts.py delete mode 100644 wizards/com/sun/star/wizards/ui/UnoDialog.java delete mode 100644 wizards/com/sun/star/wizards/ui/UnoDialog.py delete mode 100644 wizards/com/sun/star/wizards/ui/UnoDialog2.java delete mode 100644 wizards/com/sun/star/wizards/ui/UnoDialog2.py delete mode 100644 wizards/com/sun/star/wizards/ui/WizardDialog.java delete mode 100644 wizards/com/sun/star/wizards/ui/WizardDialog.py delete mode 100644 wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java delete mode 100644 wizards/com/sun/star/wizards/ui/XCompletion.java delete mode 100644 wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java delete mode 100755 wizards/com/sun/star/wizards/ui/XPathSelectionListener.java delete mode 100644 wizards/com/sun/star/wizards/ui/XPathSelectionListener.py delete mode 100644 wizards/com/sun/star/wizards/ui/__init__.py delete mode 100644 wizards/com/sun/star/wizards/ui/event/AbstractListener.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/CommonListener.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/CommonListener.py delete mode 100644 wizards/com/sun/star/wizards/ui/event/DataAware.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/DataAware.py delete mode 100644 wizards/com/sun/star/wizards/ui/event/DataAwareFields.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/EventNames.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/ListModelBinder.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/MethodInvocation.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/RadioDataAware.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/RadioDataAware.py delete mode 100644 wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/Task.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/TaskEvent.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/TaskListener.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/UnoDataAware.java delete mode 100644 wizards/com/sun/star/wizards/ui/event/UnoDataAware.py delete mode 100644 wizards/com/sun/star/wizards/ui/event/__init__.py delete mode 100644 wizards/com/sun/star/wizards/web/AbstractErrorHandler.java delete mode 100644 wizards/com/sun/star/wizards/web/BackgroundsDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/CallWizard.java delete mode 100644 wizards/com/sun/star/wizards/web/ErrorHandler.java delete mode 100644 wizards/com/sun/star/wizards/web/ExtensionVerifier.java delete mode 100644 wizards/com/sun/star/wizards/web/FTPDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/FTPDialogResources.java delete mode 100644 wizards/com/sun/star/wizards/web/IconsDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/ImageListDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/LogTaskListener.java delete mode 100644 wizards/com/sun/star/wizards/web/MANIFEST.MF delete mode 100644 wizards/com/sun/star/wizards/web/Process.java delete mode 100644 wizards/com/sun/star/wizards/web/ProcessErrorHandler.java delete mode 100644 wizards/com/sun/star/wizards/web/ProcessErrors.java delete mode 100644 wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java delete mode 100644 wizards/com/sun/star/wizards/web/StatusDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/StylePreview.java delete mode 100644 wizards/com/sun/star/wizards/web/TOCPreview.java delete mode 100644 wizards/com/sun/star/wizards/web/WWD_Events.java delete mode 100644 wizards/com/sun/star/wizards/web/WWD_General.java delete mode 100644 wizards/com/sun/star/wizards/web/WWD_Startup.java delete mode 100644 wizards/com/sun/star/wizards/web/WWHID.java delete mode 100644 wizards/com/sun/star/wizards/web/WebWizard.java delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardConst.java delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardDialog.java delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardDialogResources.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGArgument.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGContent.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGDesign.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGDocument.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGFilter.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGIconSet.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGImage.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGLayout.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGPublish.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSession.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSessionName.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSettings.java delete mode 100644 wizards/com/sun/star/wizards/web/data/CGStyle.java delete mode 100644 wizards/com/sun/star/wizards/web/data/ConfigSetItem.java delete mode 100644 wizards/com/sun/star/wizards/web/data/TypeDetection.java delete mode 100644 wizards/com/sun/star/wizards/web/data/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/web/export/AbstractExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/CopyExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/Exporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/FilterExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java delete mode 100644 wizards/com/sun/star/wizards/web/export/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/web/makefile.mk delete mode 100644 wizards/com/sun/star/wizards/web/status/ErrorLog.java delete mode 100644 wizards/com/sun/star/wizards/web/status/ErrorReporter.java delete mode 100644 wizards/com/sun/star/wizards/web/status/LogTaskListener.java delete mode 100644 wizards/com/sun/star/wizards/web/status/Task.java delete mode 100644 wizards/com/sun/star/wizards/web/status/TaskEvent.java delete mode 100644 wizards/com/sun/star/wizards/web/status/TaskListener.java delete mode 100644 wizards/com/sun/star/wizards/web/web.component delete mode 100644 wizards/prj/build.lst delete mode 100644 wizards/prj/d.lst delete mode 100644 wizards/prj/makefile.mk delete mode 100644 wizards/source/config/delzip delete mode 100644 wizards/source/config/dialog.xlc delete mode 100644 wizards/source/config/script.xlc delete mode 100644 wizards/source/configshare/delzip delete mode 100644 wizards/source/configshare/dialog.xlc delete mode 100644 wizards/source/configshare/script.xlc delete mode 100644 wizards/source/depot/CommonLang.xba delete mode 100644 wizards/source/depot/Currency.xba delete mode 100644 wizards/source/depot/Depot.xba delete mode 100644 wizards/source/depot/Dialog2.xdl delete mode 100644 wizards/source/depot/Dialog3.xdl delete mode 100644 wizards/source/depot/Dialog4.xdl delete mode 100644 wizards/source/depot/Internet.xba delete mode 100644 wizards/source/depot/Lang_de.xba delete mode 100644 wizards/source/depot/Lang_en.xba delete mode 100644 wizards/source/depot/Lang_es.xba delete mode 100644 wizards/source/depot/Lang_fr.xba delete mode 100644 wizards/source/depot/Lang_it.xba delete mode 100644 wizards/source/depot/Lang_ja.xba delete mode 100644 wizards/source/depot/Lang_ko.xba delete mode 100644 wizards/source/depot/Lang_sv.xba delete mode 100644 wizards/source/depot/Lang_tw.xba delete mode 100644 wizards/source/depot/Lang_zh.xba delete mode 100644 wizards/source/depot/dialog.xlb delete mode 100644 wizards/source/depot/script.xlb delete mode 100644 wizards/source/depot/tools.xba delete mode 100644 wizards/source/euro/AutoPilotRun.xba delete mode 100644 wizards/source/euro/Common.xba delete mode 100644 wizards/source/euro/ConvertRun.xba delete mode 100644 wizards/source/euro/DlgConvert.xdl delete mode 100644 wizards/source/euro/DlgPassword.xdl delete mode 100644 wizards/source/euro/Hard.xba delete mode 100644 wizards/source/euro/Init.xba delete mode 100644 wizards/source/euro/Protect.xba delete mode 100644 wizards/source/euro/Soft.xba delete mode 100644 wizards/source/euro/Writer.xba delete mode 100644 wizards/source/euro/delzip delete mode 100644 wizards/source/euro/dialog.xlb delete mode 100644 wizards/source/euro/euro.src delete mode 100644 wizards/source/euro/script.xlb delete mode 100644 wizards/source/formwizard/DBMeta.xba delete mode 100644 wizards/source/formwizard/DlgFormDB.xdl delete mode 100644 wizards/source/formwizard/FormWizard.xba delete mode 100644 wizards/source/formwizard/Language.xba delete mode 100644 wizards/source/formwizard/Layouter.xba delete mode 100644 wizards/source/formwizard/dbwizres.src delete mode 100644 wizards/source/formwizard/delzip delete mode 100644 wizards/source/formwizard/develop.xba delete mode 100644 wizards/source/formwizard/dialog.xlb delete mode 100644 wizards/source/formwizard/script.xlb delete mode 100644 wizards/source/formwizard/tools.xba delete mode 100644 wizards/source/gimmicks/AutoText.xba delete mode 100644 wizards/source/gimmicks/ChangeAllChars.xba delete mode 100644 wizards/source/gimmicks/GetTexts.xba delete mode 100644 wizards/source/gimmicks/ReadDir.xba delete mode 100644 wizards/source/gimmicks/ReadFolderDlg.xdl delete mode 100644 wizards/source/gimmicks/UserfieldDlg.xdl delete mode 100644 wizards/source/gimmicks/Userfields.xba delete mode 100644 wizards/source/gimmicks/delzip delete mode 100644 wizards/source/gimmicks/dialog.xlb delete mode 100644 wizards/source/gimmicks/readdirs.dlg delete mode 100644 wizards/source/gimmicks/script.xlb delete mode 100644 wizards/source/imagelists/imagelists.src delete mode 100644 wizards/source/importwizard/API.xba delete mode 100644 wizards/source/importwizard/DialogModul.xba delete mode 100644 wizards/source/importwizard/FilesModul.xba delete mode 100644 wizards/source/importwizard/ImportDialog.xdl delete mode 100644 wizards/source/importwizard/Language.xba delete mode 100644 wizards/source/importwizard/Main.xba delete mode 100644 wizards/source/importwizard/delzip delete mode 100644 wizards/source/importwizard/dialog.xlb delete mode 100644 wizards/source/importwizard/importwi.src delete mode 100644 wizards/source/importwizard/script.xlb delete mode 100644 wizards/source/launcher/DicOOo.xba delete mode 100644 wizards/source/launcher/delzip delete mode 100644 wizards/source/launcher/dialog.xlb delete mode 100644 wizards/source/launcher/script.xlb delete mode 100644 wizards/source/schedule/BankHoliday.xba delete mode 100644 wizards/source/schedule/CalendarMain.xba delete mode 100644 wizards/source/schedule/CreateTable.xba delete mode 100644 wizards/source/schedule/DlgCalendar.xdl delete mode 100644 wizards/source/schedule/DlgControl.xba delete mode 100644 wizards/source/schedule/GermanHolidays.xba delete mode 100644 wizards/source/schedule/Language.xba delete mode 100644 wizards/source/schedule/LocalHolidays.xba delete mode 100644 wizards/source/schedule/OwnEvents.xba delete mode 100644 wizards/source/schedule/delzip delete mode 100644 wizards/source/schedule/dialog.xlb delete mode 100644 wizards/source/schedule/schedule.src delete mode 100644 wizards/source/schedule/script.xlb delete mode 100644 wizards/source/standard/Module1.xba delete mode 100644 wizards/source/standard/delzip delete mode 100644 wizards/source/standard/dialog.xlb delete mode 100644 wizards/source/standard/script.xlb delete mode 100644 wizards/source/template/Autotext.xba delete mode 100644 wizards/source/template/Correspondence.xba delete mode 100644 wizards/source/template/DialogStyles.xdl delete mode 100644 wizards/source/template/ModuleAgenda.xba delete mode 100644 wizards/source/template/Samples.xba delete mode 100644 wizards/source/template/TemplateDialog.xdl delete mode 100644 wizards/source/template/delzip delete mode 100644 wizards/source/template/dialog.xlb delete mode 100644 wizards/source/template/script.xlb delete mode 100644 wizards/source/template/template.src delete mode 100644 wizards/source/tools/Debug.xba delete mode 100644 wizards/source/tools/DlgOverwriteAll.xdl delete mode 100644 wizards/source/tools/Listbox.xba delete mode 100644 wizards/source/tools/Misc.xba delete mode 100644 wizards/source/tools/ModuleControls.xba delete mode 100644 wizards/source/tools/Strings.xba delete mode 100644 wizards/source/tools/UCB.xba delete mode 100644 wizards/source/tools/delzip delete mode 100644 wizards/source/tools/dialog.xlb delete mode 100644 wizards/source/tools/script.xlb delete mode 100644 wizards/source/tutorials/Functions.xba delete mode 100644 wizards/source/tutorials/RoadMap.xba delete mode 100644 wizards/source/tutorials/ShowInfoDialog.xba delete mode 100644 wizards/source/tutorials/TutorialClose.xba delete mode 100644 wizards/source/tutorials/TutorialCloseDialog.xdl delete mode 100644 wizards/source/tutorials/TutorialCreator.xba delete mode 100644 wizards/source/tutorials/TutorialOpen.xba delete mode 100644 wizards/source/tutorials/TutorialOpenDialog.xdl delete mode 100644 wizards/source/tutorials/TutorialsDialog.xdl delete mode 100644 wizards/source/tutorials/delzip delete mode 100644 wizards/source/tutorials/dialog.xlb delete mode 100644 wizards/source/tutorials/script.xlb delete mode 100644 wizards/source/webwizard/Bullets.xba delete mode 100644 wizards/source/webwizard/Common.xba delete mode 100644 wizards/source/webwizard/HtmlAutoPilotBasic.xba delete mode 100644 wizards/source/webwizard/Language.xba delete mode 100644 wizards/source/webwizard/WebWzrd.xdl delete mode 100644 wizards/source/webwizard/delzip delete mode 100644 wizards/source/webwizard/dialog.xlb delete mode 100644 wizards/source/webwizard/script.xlb delete mode 100644 wizards/source/webwizard/webwizar.src delete mode 100644 xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.sxw delete mode 100644 xmlsecurity/doc/OpenDocumentSignatures-Workflow.sxd delete mode 100644 xmlsecurity/doc/OpenDocumentSignatures.sxw delete mode 100644 xmlsecurity/doc/XMLSecurityFramework.sxw delete mode 100644 xmlsecurity/inc/makefile.mk delete mode 100644 xmlsecurity/inc/pch/precompiled_xmlsecurity.cxx delete mode 100644 xmlsecurity/inc/pch/precompiled_xmlsecurity.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/biginteger.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/certificatechooser.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/certificateviewer.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/certvalidity.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/global.hrc delete mode 100644 xmlsecurity/inc/xmlsecurity/macrosecurity.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/sigstruct.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/stbcontrl.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/warnings.hxx delete mode 100644 xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx delete mode 100644 xmlsecurity/prj/build.lst delete mode 100644 xmlsecurity/prj/d.lst delete mode 100644 xmlsecurity/qa/certext/SanCertExt.cxx delete mode 100644 xmlsecurity/qa/certext/User_35_Root_11.crt delete mode 100644 xmlsecurity/qa/certext/export.map delete mode 100644 xmlsecurity/qa/certext/makefile.mk delete mode 100644 xmlsecurity/source/component/certificatecontainer.cxx delete mode 100644 xmlsecurity/source/component/certificatecontainer.hxx delete mode 100644 xmlsecurity/source/component/documentdigitalsignatures.cxx delete mode 100644 xmlsecurity/source/component/documentdigitalsignatures.hxx delete mode 100644 xmlsecurity/source/component/makefile.mk delete mode 100644 xmlsecurity/source/component/registerservices.cxx delete mode 100644 xmlsecurity/source/component/warnbox.src delete mode 100644 xmlsecurity/source/dialogs/certificatechooser.cxx delete mode 100644 xmlsecurity/source/dialogs/certificatechooser.src delete mode 100644 xmlsecurity/source/dialogs/certificateviewer.cxx delete mode 100644 xmlsecurity/source/dialogs/certificateviewer.src delete mode 100644 xmlsecurity/source/dialogs/dialogs.hrc delete mode 100644 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx delete mode 100644 xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc delete mode 100644 xmlsecurity/source/dialogs/digitalsignaturesdialog.src delete mode 100644 xmlsecurity/source/dialogs/helpids.hrc delete mode 100644 xmlsecurity/source/dialogs/macrosecurity.cxx delete mode 100644 xmlsecurity/source/dialogs/macrosecurity.src delete mode 100644 xmlsecurity/source/dialogs/makefile.mk delete mode 100644 xmlsecurity/source/dialogs/resourcemanager.cxx delete mode 100644 xmlsecurity/source/dialogs/resourcemanager.hxx delete mode 100644 xmlsecurity/source/dialogs/stbcontrl.cxx delete mode 100644 xmlsecurity/source/dialogs/warnings.cxx delete mode 100644 xmlsecurity/source/dialogs/warnings.src delete mode 100644 xmlsecurity/source/framework/buffernode.cxx delete mode 100644 xmlsecurity/source/framework/buffernode.hxx delete mode 100644 xmlsecurity/source/framework/decryptorimpl.cxx delete mode 100644 xmlsecurity/source/framework/decryptorimpl.hxx delete mode 100644 xmlsecurity/source/framework/elementcollector.cxx delete mode 100644 xmlsecurity/source/framework/elementcollector.hxx delete mode 100644 xmlsecurity/source/framework/elementmark.cxx delete mode 100644 xmlsecurity/source/framework/elementmark.hxx delete mode 100644 xmlsecurity/source/framework/encryptionengine.cxx delete mode 100644 xmlsecurity/source/framework/encryptionengine.hxx delete mode 100644 xmlsecurity/source/framework/encryptorimpl.cxx delete mode 100644 xmlsecurity/source/framework/encryptorimpl.hxx delete mode 100644 xmlsecurity/source/framework/makefile.mk delete mode 100644 xmlsecurity/source/framework/saxeventkeeperimpl.cxx delete mode 100644 xmlsecurity/source/framework/saxeventkeeperimpl.hxx delete mode 100644 xmlsecurity/source/framework/securityengine.cxx delete mode 100644 xmlsecurity/source/framework/securityengine.hxx delete mode 100644 xmlsecurity/source/framework/signaturecreatorimpl.cxx delete mode 100644 xmlsecurity/source/framework/signaturecreatorimpl.hxx delete mode 100644 xmlsecurity/source/framework/signatureengine.cxx delete mode 100644 xmlsecurity/source/framework/signatureengine.hxx delete mode 100644 xmlsecurity/source/framework/signatureverifierimpl.cxx delete mode 100644 xmlsecurity/source/framework/signatureverifierimpl.hxx delete mode 100644 xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx delete mode 100644 xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx delete mode 100644 xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx delete mode 100644 xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx delete mode 100644 xmlsecurity/source/framework/xsec_framework.cxx delete mode 100644 xmlsecurity/source/helper/documentsignaturehelper.cxx delete mode 100644 xmlsecurity/source/helper/makefile.mk delete mode 100644 xmlsecurity/source/helper/xmlsignaturehelper.cxx delete mode 100644 xmlsecurity/source/helper/xmlsignaturehelper2.cxx delete mode 100644 xmlsecurity/source/helper/xmlsignaturehelper2.hxx delete mode 100644 xmlsecurity/source/helper/xsecctl.cxx delete mode 100644 xmlsecurity/source/helper/xsecctl.hxx delete mode 100644 xmlsecurity/source/helper/xsecparser.cxx delete mode 100644 xmlsecurity/source/helper/xsecparser.hxx delete mode 100644 xmlsecurity/source/helper/xsecsign.cxx delete mode 100644 xmlsecurity/source/helper/xsecverify.cxx delete mode 100644 xmlsecurity/source/xmlsec/biginteger.cxx delete mode 100644 xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/certificateextension_xmlsecimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/certvalidity.cxx delete mode 100644 xmlsecurity/source/xmlsec/diagnose.cxx delete mode 100644 xmlsecurity/source/xmlsec/diagnose.hxx delete mode 100644 xmlsecurity/source/xmlsec/errorcallback.cxx delete mode 100644 xmlsecurity/source/xmlsec/errorcallback.hxx delete mode 100644 xmlsecurity/source/xmlsec/makefile.mk delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/makefile.mk delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/oid.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/certerrors.h delete mode 100644 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/ciphercontext.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/digestcontext.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/digestcontext.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/makefile.mk delete mode 100644 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/nssinitializer.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/nssrenam.h delete mode 100644 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/secerror.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/secerror.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/nss/xsec_nss.cxx delete mode 100644 xmlsecurity/source/xmlsec/saxhelper.cxx delete mode 100644 xmlsecurity/source/xmlsec/saxhelper.hxx delete mode 100644 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx delete mode 100644 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx delete mode 100644 xmlsecurity/source/xmlsec/xmlstreamio.cxx delete mode 100644 xmlsecurity/source/xmlsec/xmlstreamio.hxx delete mode 100644 xmlsecurity/source/xmlsec/xsec_xmlsec.cxx delete mode 100755 xmlsecurity/test_docs/CAs/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_1/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_10/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1002.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1003.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1004.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1005.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1006.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1007.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1008.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1009.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100A.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100B.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100C.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100D.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100E.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/100F.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1010.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1011.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1012.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1013.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1014.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1015.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1016.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1017.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1018.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1019.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101A.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101B.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101C.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101D.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101E.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/101F.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1020.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1021.pem delete mode 100644 xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_11/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_2/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_3/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_4/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_5/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/crl/Root_6.crl delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_6/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/crl/Root_7.crl delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_7/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/crl/Root_8.crl delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_8/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/DO_NOT_INSTALL_THIS_ROOT_CERT.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/DO_NO_INSTALL_THIS_ROOT_CERTIFICATE delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/Root_9.crt delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Root_9/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_1/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/DO_NOT_INSTALL_THIS_CERTIFICATE delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/DO_NOT_INSTALL_THIS_CERTIFICATE delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/Sub_CA_1_Root_10.crt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/crl/Sub_CA_1_Root_10.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_10/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/req.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_2/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/req.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_3/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_4/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/crl/Sub_CA_1_Root_5.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/newcerts/1002.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_5/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/crl/DO_NOT_CREATE_A_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_6/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/crl/Sub_CA_1_Root_7.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_7/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/crl/Sub_CA_1_Root_8.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_8/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_1_Root_9/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/newcerts/1002.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_4/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/crl/Sub_CA_2_Root_7.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/newcerts/1000.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/newcerts/1001.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_7/openssl.cfg delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/README.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/cacert.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/crl/DO_NOT_INSTALL_THIS_CRL delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/crl/Sub_CA_2_Root_8.crl delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/crlnumber delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/index.txt delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/index.txt.attr delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/newcerts/1002.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/newcerts/1003.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/private/cakey.pem delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/demoCA/serial delete mode 100755 xmlsecurity/test_docs/CAs/Sub_CA_2_Root_8/openssl.cfg delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_1.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_10.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_2.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_3.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_5.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_6.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_1.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_2.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_3.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_5.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_6.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_1_Root_9.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_2_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_2_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/ca_certs/Sub_CA_2_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/crl/Root_10.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Root_11.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Root_3.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Root_4.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Root_9.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Sub_CA_1_Root_2.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Sub_CA_1_Root_4.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Sub_CA_1_Root_9.crl delete mode 100755 xmlsecurity/test_docs/certs/crl/Sub_CA_2_Root_4.crl delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_10_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_11_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_12_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_13_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_14_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_15_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_16_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_17_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_18_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_19_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_1.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_10.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_2.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_3.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_5.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_6.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_1_Root_9.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_2_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_2_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_1_Sub_CA_2_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_20_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_21_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_22_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_23_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_24_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_25_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_26_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_27_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_28_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_29_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_1_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_1_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_1_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_2_Root_4.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_2_Root_7.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_2_Sub_CA_2_Root_8.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_30_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_31_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_32_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_33_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_34_Root_11.crt delete mode 100644 xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_3_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_4_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_5_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_6_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_7_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_8_Root_11.crt delete mode 100755 xmlsecurity/test_docs/certs/end_certs/User_9_Root_11.crt delete mode 100644 xmlsecurity/test_docs/certs/p12/Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_10_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_11_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_12_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_13_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_14_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_15_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_16_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_17_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_18_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_19_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_1.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_10.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_2.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_3.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_4.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_5.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_6.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_7.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_8.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_1_Root_9.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_2_Root_4.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_2_Root_7.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_1_Sub_CA_2_Root_8.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_20_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_21_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_22_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_23_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_24_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_25_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_26_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_27_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_28_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_29_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_1_Root_4.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_1_Root_7.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_1_Root_8.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_2_Root_4.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_2_Root_7.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_2_Sub_CA_2_Root_8.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_30_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_31_Root_11.p12 delete mode 100644 xmlsecurity/test_docs/certs/p12/User_32_Root_11.p12 delete mode 100644 xmlsecurity/test_docs/certs/p12/User_33_Root_11.p12 delete mode 100644 xmlsecurity/test_docs/certs/p12/User_34_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_3_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_4_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_5_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_6_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_7_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_8_Root_11.p12 delete mode 100755 xmlsecurity/test_docs/certs/p12/User_9_Root_11.p12 delete mode 100644 xmlsecurity/test_docs/documents/aia_ca_issuers.odt delete mode 100644 xmlsecurity/test_docs/documents/aia_ocsp.odt delete mode 100644 xmlsecurity/test_docs/documents/aia_ocsp_revoked_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/aia_ocsp_revoked_leaf.odt delete mode 100644 xmlsecurity/test_docs/documents/aia_ocsp_revoked_leaf_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/crl.odt delete mode 100644 xmlsecurity/test_docs/documents/crl_revoked_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/crl_revoked_leaf.odt delete mode 100644 xmlsecurity/test_docs/documents/crl_revoked_leaf_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp_no_intermediate_ca_revocation_info.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp_no_root_revocation_info.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp_revoked_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp_revoked_leaf.odt delete mode 100644 xmlsecurity/test_docs/documents/crldp_revoked_leaf_chain.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_cyrillic_bmpstring.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_latin_ext_greak_bmpstring.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_multivalue_rdn.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_quoting.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_single_multivalue_rdn.odt delete mode 100644 xmlsecurity/test_docs/documents/dn_single_multivalue_rdn_with_quoting.odt delete mode 100644 xmlsecurity/test_docs/documents/incomplete_path.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_doc1.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_doc2.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_macro1.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_macro2.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_macro3.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_macro4.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo2_x_macro5.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo3_2_doc1.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo3_2_doc3.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo3_2_doc4.odt delete mode 100644 xmlsecurity/test_docs/documents/invalid_ooo_3_2_doc2.odt delete mode 100644 xmlsecurity/test_docs/documents/ocsp_crl.odt delete mode 100644 xmlsecurity/test_docs/documents/ocsp_crl_revoked_leaf.odt delete mode 100644 xmlsecurity/test_docs/documents/stateOrProvinceName.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_no_revocation.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_no_root_revocation_info.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_no_sub_ca_revocation_info.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo2_x_doc1.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo2_x_doc_macro.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo2_x_doc_unsigned_macro.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_0_doc1.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_0_doc_macro.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_0_doc_unsigned_macro.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_2_doc1.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_2_doc_macro.odt delete mode 100644 xmlsecurity/test_docs/documents/valid_ooo3_2_doc_unsigned_macro.odt delete mode 100644 xmlsecurity/test_docs/test_description.odt delete mode 100755 xmlsecurity/test_docs/tools/README.txt delete mode 100755 xmlsecurity/test_docs/tools/httpserv/build.xml delete mode 100755 xmlsecurity/test_docs/tools/httpserv/dist/README.TXT delete mode 100755 xmlsecurity/test_docs/tools/httpserv/dist/httpserv.jar delete mode 100755 xmlsecurity/test_docs/tools/httpserv/manifest.mf delete mode 100755 xmlsecurity/test_docs/tools/httpserv/nbproject/build-impl.xml delete mode 100644 xmlsecurity/test_docs/tools/httpserv/nbproject/genfiles.properties delete mode 100644 xmlsecurity/test_docs/tools/httpserv/nbproject/project.properties delete mode 100755 xmlsecurity/test_docs/tools/httpserv/nbproject/project.xml delete mode 100755 xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java delete mode 100644 xmlsecurity/tools/demo/JavaFlatFilter.java delete mode 100644 xmlsecurity/tools/demo/makefile.mk delete mode 100644 xmlsecurity/tools/demo/manifest delete mode 100644 xmlsecurity/tools/demo/mozprofile.cxx delete mode 100644 xmlsecurity/tools/demo/multisigdemo.cxx delete mode 100644 xmlsecurity/tools/demo/performance.cxx delete mode 100644 xmlsecurity/tools/demo/readme.txt delete mode 100644 xmlsecurity/tools/demo/signdemo.cxx delete mode 100644 xmlsecurity/tools/demo/util.cxx delete mode 100644 xmlsecurity/tools/demo/util.hxx delete mode 100644 xmlsecurity/tools/demo/util2.cxx delete mode 100644 xmlsecurity/tools/demo/verifydemo.cxx delete mode 100644 xmlsecurity/tools/examples/demo-sample.gif delete mode 100644 xmlsecurity/tools/examples/demo-sample.sxw delete mode 100644 xmlsecurity/tools/examples/demo-sample.xml delete mode 100644 xmlsecurity/tools/examples/enc-1.xml delete mode 100644 xmlsecurity/tools/examples/enc-2.xml delete mode 100644 xmlsecurity/tools/examples/eval_export.txt delete mode 100644 xmlsecurity/tools/examples/eval_import.txt delete mode 100644 xmlsecurity/tools/examples/evaluate_win.bat delete mode 100644 xmlsecurity/tools/examples/readme.txt delete mode 100644 xmlsecurity/tools/examples/s-in-e-1.xml delete mode 100644 xmlsecurity/tools/examples/s-in-e-2.xml delete mode 100644 xmlsecurity/tools/examples/sign-0.xml delete mode 100644 xmlsecurity/tools/examples/sign-1.xml delete mode 100644 xmlsecurity/tools/examples/sign-2.xml delete mode 100644 xmlsecurity/tools/examples/sign-3.xml delete mode 100644 xmlsecurity/tools/examples/sign-4.xml delete mode 100644 xmlsecurity/tools/examples/sign-5.xml delete mode 100644 xmlsecurity/tools/examples/uno_win.bat delete mode 100644 xmlsecurity/tools/examples/warmup.xml delete mode 100644 xmlsecurity/tools/standalone/csfit/certmngr.cxx delete mode 100644 xmlsecurity/tools/standalone/csfit/decrypter.cxx delete mode 100644 xmlsecurity/tools/standalone/csfit/encrypter.cxx delete mode 100644 xmlsecurity/tools/standalone/csfit/helper.cxx delete mode 100644 xmlsecurity/tools/standalone/csfit/helper.hxx delete mode 100644 xmlsecurity/tools/standalone/csfit/makefile.mk delete mode 100644 xmlsecurity/tools/standalone/csfit/signer.cxx delete mode 100644 xmlsecurity/tools/standalone/csfit/util/makefile.mk delete mode 100644 xmlsecurity/tools/standalone/csfit/verifier.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/certmngr.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/decrypter.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/encrypter.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/helper.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/helper.hxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/makefile.mk delete mode 100644 xmlsecurity/tools/standalone/mscsfit/signer.cxx delete mode 100644 xmlsecurity/tools/standalone/mscsfit/util/makefile.mk delete mode 100644 xmlsecurity/tools/standalone/mscsfit/verifier.cxx delete mode 100644 xmlsecurity/tools/standalone/readme.txt delete mode 100644 xmlsecurity/tools/uno/AdapterNode.java delete mode 100644 xmlsecurity/tools/uno/AttributeListHelper.java delete mode 100644 xmlsecurity/tools/uno/DomToTreeModelAdapter.java delete mode 100644 xmlsecurity/tools/uno/EncryptionEntity.java delete mode 100644 xmlsecurity/tools/uno/ParsingThread.java delete mode 100644 xmlsecurity/tools/uno/SAXEventCollector.java delete mode 100644 xmlsecurity/tools/uno/SAXEventPrinter.java delete mode 100644 xmlsecurity/tools/uno/SecurityEntity.java delete mode 100644 xmlsecurity/tools/uno/SignatureEntity.java delete mode 100644 xmlsecurity/tools/uno/TestTool.java delete mode 100644 xmlsecurity/tools/uno/UnsolvedReferenceTableModel.java delete mode 100644 xmlsecurity/tools/uno/XMLFileFilter.java delete mode 100644 xmlsecurity/tools/uno/XMLSecurityFrameworkController.java delete mode 100644 xmlsecurity/tools/uno/XMLTreeCellRanderer.java delete mode 100644 xmlsecurity/tools/uno/current.gif delete mode 100644 xmlsecurity/tools/uno/makefile.mk delete mode 100644 xmlsecurity/util/exports_xsmscrypt.dxp delete mode 100644 xmlsecurity/util/exports_xsnss.dxp delete mode 100644 xmlsecurity/util/makefile.mk delete mode 100644 xmlsecurity/util/target.pmk delete mode 100644 xmlsecurity/util/xmlsecurity.component delete mode 100644 xmlsecurity/util/xsec_fw.component delete mode 100644 xmlsecurity/util/xsec_fw.dxp delete mode 100644 xmlsecurity/util/xsec_xmlsec.component delete mode 100644 xmlsecurity/util/xsec_xmlsec.windows.component delete mode 100644 xmlsecurity/util/xsecctl.flt delete mode 100644 xmlsecurity/workben/makefile.mk delete mode 100644 xmlsecurity/workben/signaturetest.cxx diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9ea0cd6eb..000000000 --- a/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# backup and temporary files -*~ -.*.sw[op] -.gitattributes - -# the build directories -/*/unxlng?? -/*/unxlng??.pro -/*/wntmsc??? -/*/wntmsc???.pro -/*/wntgcc? -/*/wntgcc?.pro -/*/unxmac?? -/*/unxmac??.pro -/*/unxios? -/*/unxios?.pro -/*/unxand? -/*/unxand?.pro diff --git a/MathMLDTD/math.dtd b/MathMLDTD/math.dtd deleted file mode 100644 index 0349e3031..000000000 --- a/MathMLDTD/math.dtd +++ /dev/null @@ -1,957 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MathMLDTD/prj/build.lst b/MathMLDTD/prj/build.lst deleted file mode 100644 index 98f9bc77d..000000000 --- a/MathMLDTD/prj/build.lst +++ /dev/null @@ -1,3 +0,0 @@ -md MathMLDTD : solenv NULL -md MathMLDTD usr1 - all md_mkout NULL -md MathMLDTD\prj get - all md_prj NULL diff --git a/MathMLDTD/prj/d.lst b/MathMLDTD/prj/d.lst deleted file mode 100644 index b2a942fad..000000000 --- a/MathMLDTD/prj/d.lst +++ /dev/null @@ -1,2 +0,0 @@ -..\math.dtd %_DEST%\bin\math.dtd -..\w3c_ipr_software_notice.html %_DEST%\bin\w3c_ipr_software_notice.html diff --git a/MathMLDTD/w3c_ipr_software_notice.html b/MathMLDTD/w3c_ipr_software_notice.html deleted file mode 100644 index 3a4ed535c..000000000 --- a/MathMLDTD/w3c_ipr_software_notice.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - -W3C IPR SOFTWARE NOTICE - - -

W3C® SOFTWARE NOTICE AND LICENSE

- -

Copyright © 1994-2001 World -Wide Web Consortium, (Massachusetts Institute of -Technology, Institut National de -Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/

- -

This W3C work (including software, documents, or other related -items) is being provided by the copyright holders under the -following license. By obtaining, using and/or copying this work, -you (the licensee) agree that you have read, understood, and will -comply with the following terms and conditions:

- -

Permission to use, copy, modify, and distribute this software -and its documentation, with or without modification,  for any -purpose and without fee or royalty is hereby granted, provided that -you include the following on ALL copies of the software and -documentation or portions thereof, including modifications, that -you make:

- -
    -
  1. The full text of this NOTICE in a location viewable to users of -the redistributed or derivative work.
  2. - -
  3. Any pre-existing intellectual property disclaimers, notices, or -terms and conditions. If none exist, a short notice of the -following form (hypertext is preferred, text is permitted) should -be used within the body of any redistributed or derivative code: -"Copyright © [$date-of-software] -World Wide Web Consortium, (Massachusetts Institute of -Technology, Institut National de -Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. -http://www.w3.org/Consortium/Legal/"
  4. - -
  5. Notice of any changes or modifications to the W3C files, -including the date changes were made. (We recommend you provide -URIs to the location from which the code is derived.)
  6. -
- -

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND -COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF -MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE -USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD -PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

- -

COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, -SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE -SOFTWARE OR DOCUMENTATION.

- -

The name and trademarks of copyright holders may NOT be used in -advertising or publicity pertaining to the software without -specific, written prior permission. Title to copyright in this -software and any associated documentation will at all times remain -with copyright holders.

- -

____________________________________

- -

This formulation of W3C's notice and license became active on -August 14 1998 so as to improve compatibility with GPL. This -version ensures that W3C software licensing terms are no more -restrictive than GPL and consequently W3C software may be -distributed in GPL packages. See the older formulation for the -policy prior to this date. Please see our -Copyright FAQ for common questions about using materials from -our site, including specific terms and conditions for packages like -libwww, Amaya, and Jigsaw. Other questions about this notice can be -directed to -site-policy@w3.org.

- -

 

- - - - diff --git a/README b/README new file mode 100644 index 000000000..2f046a7a9 --- /dev/null +++ b/README @@ -0,0 +1,20 @@ + +This git repository is part of the "bootstrap" family of Libreoffice repos. +It is obsolete and its only useful content are the LibreOffice 3.3 +and 3.4 release branches. + +If you are interested in the latest and greatest development branch "master", +or in release branches of LibreOffice versions newer than 3.4, please +check out the "core" git repository, as described on the Wiki: + + http://wiki.documentfoundation.org/Development/Native_Build + +If you want to build the 3.3 or 3.4 release, you need to switch to the +corresponding release branch: + + ./g checkout libreoffice-3-4 + +If for some reason you want to look at obsolete in-development code, +check out the "master-backup" branch in this repository; this is most likely +to be a complete waste of time though. + diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx deleted file mode 100644 index 5c4504de5..000000000 --- a/UnoControls/inc/basecontainercontrol.hxx +++ /dev/null @@ -1,594 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX -#define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ -#include "basecontrol.hxx" - -//____________________________________________________________________________________________________________ -// "namespaces" -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_AWT ::com::sun::star::awt -#define CSS_LANG ::com::sun::star::lang -#define CSS_CONTAINER ::com::sun::star::container - -//____________________________________________________________________________________________________________ -// structs, types, forwards -//____________________________________________________________________________________________________________ - -struct IMPL_ControlInfo -{ - CSS_UNO::Reference< CSS_AWT::XControl > xControl ; - ::rtl::OUString sName ; -}; - -//____________________________________________________________________________________________________________ -// classes -//____________________________________________________________________________________________________________ - -class BaseContainerControl : public CSS_AWT::XControlModel - , public CSS_AWT::XControlContainer - , public BaseControl -{ - -//____________________________________________________________________________________________________________ -// public methods -//____________________________________________________________________________________________________________ - -public: - - //________________________________________________________________________________________________________ - // construct/destruct - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - BaseContainerControl( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual ~BaseContainerControl(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XTypeProvider - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XAggregation - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Any SAL_CALL queryAggregation( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XControl - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL createPeer( - const CSS_UNO::Reference< CSS_AWT::XToolkit >& xToolkit , - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParent - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL setModel( - const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XComponent - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL dispose() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XEventListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL disposing( const CSS_LANG::EventObject& rEvent ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XControlContainer - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addControl( - const ::rtl::OUString& sName , - const CSS_UNO::Reference< CSS_AWT::XControl >& xControl - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addContainerListener( - const CSS_UNO::Reference< CSS_CONTAINER::XContainerListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeControl( - const CSS_UNO::Reference< CSS_AWT::XControl >& xControl - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeContainerListener( - const CSS_UNO::Reference< CSS_CONTAINER::XContainerListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setStatusText( - const ::rtl::OUString& sStatusText - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControl > SAL_CALL getControl( - const ::rtl::OUString& sName - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Reference< CSS_AWT::XControl > > SAL_CALL getControls() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XUnoControlContainer - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addTabController( - const CSS_UNO::Reference< CSS_AWT::XTabController >& xTabController - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeTabController( - const CSS_UNO::Reference< CSS_AWT::XTabController >& xTabController - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setTabControllers( - const CSS_UNO::Sequence< CSS_UNO::Reference< CSS_AWT::XTabController > >& xTabControllers - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Reference< CSS_AWT::XTabController > > SAL_CALL getTabControllers() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XWindow - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( CSS_UNO::RuntimeException ); - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - using OComponentHelper::disposing; - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_AWT::WindowDescriptor* impl_getWindowDescriptor( - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParentPeer - ); - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void impl_paint( - sal_Int32 nX , - sal_Int32 nY , - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xGraphics - ); - -//____________________________________________________________________________________________________________ -// private methods -//____________________________________________________________________________________________________________ - -private: - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_activateTabControllers(); - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_cleanMemory(); - -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - // list of pointer of "struct IMPL_ControlInfo" to hold child-controls - ::std::vector< IMPL_ControlInfo* > maControlInfoList; - - // list of references of XTabController to hold tab-order in this container - CSS_UNO::Sequence< CSS_UNO::Reference< CSS_AWT::XTabController > > m_xTabControllerList ; - - ::cppu::OMultiTypeInterfaceContainerHelper m_aListeners ; - -}; // class BaseContainerControl - -// The namespace aliases are only used in this header -#undef CSS_UNO -#undef CSS_AWT -#undef CSS_LANG -#undef CSS_CONTAINER - -} // namespace unocontrols - -#endif // ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx deleted file mode 100644 index 7c6196018..000000000 --- a/UnoControls/inc/basecontrol.hxx +++ /dev/null @@ -1,1272 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX -#define _UNOCONTROLS_BASECONTROL_CTRL_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my project -//____________________________________________________________________________________________________________ -#include "multiplexer.hxx" - -//____________________________________________________________________________________________________________ -// "namespaces" -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_AWT ::com::sun::star::awt -#define CSS_LANG ::com::sun::star::lang - -//____________________________________________________________________________________________________________ -// macros -//____________________________________________________________________________________________________________ - -#define TRGB_COLORDATA(TRANSPARENCE,RED,GREEN,BLUE) \ - ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE))))|(((sal_uInt32)((sal_uInt8)(GREEN)))<<8)|(((sal_uInt32)((sal_uInt8)(RED)))<<16)|(((sal_uInt32)((sal_uInt8)(TRANSPARENCE)))<<24)) - -//____________________________________________________________________________________________________________ -// structs -//____________________________________________________________________________________________________________ - -struct IMPL_MutexContainer -{ - // Is necassery to initialize "BaseControl" and make this class thread-safe. - ::osl::Mutex m_aMutex ; -}; - -//____________________________________________________________________________________________________________ -// classes -//____________________________________________________________________________________________________________ - -class BaseControl : public CSS_LANG::XServiceInfo - , public CSS_AWT::XPaintListener - , public CSS_AWT::XWindowListener - , public CSS_AWT::XView - , public CSS_AWT::XWindow - , public CSS_AWT::XControl - , public IMPL_MutexContainer - , public ::cppu::OComponentHelper -{ -//____________________________________________________________________________________________________________ -// public methods -//____________________________________________________________________________________________________________ - -public: - - //________________________________________________________________________________________________________ - // construct/destruct - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - BaseControl( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual ~BaseControl(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //________________________________________________________________________________________________________ - // XTypeProvider - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short get implementation id - @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled. - Another way, cache is enabled. - - @seealso XTypeProvider - - @param - - - @return ID as Sequence of byte - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XAggregation - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setDelegator( - const CSS_UNO::Reference< CSS_UNO::XInterface >& xDelegator - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Any SAL_CALL queryAggregation( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XServiceInfo - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL supportsService( - const ::rtl::OUString& sServiceName - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XComponent - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL dispose() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addEventListener( - const CSS_UNO::Reference< CSS_LANG::XEventListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeEventListener( - const CSS_UNO::Reference< CSS_LANG::XEventListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XControl - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL createPeer( - const CSS_UNO::Reference< CSS_AWT::XToolkit >& xToolkit, - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParent - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setContext( - const CSS_UNO::Reference< CSS_UNO::XInterface >& xContext - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL setModel( - const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel - ) throw( CSS_UNO::RuntimeException ) = 0 ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_UNO::XInterface > SAL_CALL getContext() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ) = 0; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XWindowPeer > SAL_CALL getPeer() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XView > SAL_CALL getView() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL isDesignMode() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL isTransparent() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XWindow - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setPosSize( sal_Int32 nX , - sal_Int32 nY , - sal_Int32 nWidth , - sal_Int32 nHeight , - sal_Int16 nFlags ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setFocus() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Rectangle SAL_CALL getPosSize() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addWindowListener( - const CSS_UNO::Reference< CSS_AWT::XWindowListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addFocusListener( - const CSS_UNO::Reference< CSS_AWT::XFocusListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addKeyListener( - const CSS_UNO::Reference< CSS_AWT::XKeyListener >& xListener ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addMouseListener( - const CSS_UNO::Reference< CSS_AWT::XMouseListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addMouseMotionListener( - const CSS_UNO::Reference< CSS_AWT::XMouseMotionListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addPaintListener( - const CSS_UNO::Reference< CSS_AWT::XPaintListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeWindowListener( - const CSS_UNO::Reference< CSS_AWT::XWindowListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeFocusListener( - const CSS_UNO::Reference< CSS_AWT::XFocusListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeKeyListener( - const CSS_UNO::Reference< CSS_AWT::XKeyListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeMouseListener( - const CSS_UNO::Reference< CSS_AWT::XMouseListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeMouseMotionListener( - const CSS_UNO::Reference< CSS_AWT::XMouseMotionListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removePaintListener( - const CSS_UNO::Reference< CSS_AWT::XPaintListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XView - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL draw( sal_Int32 nX , - sal_Int32 nY ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL setGraphics( - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xDevice - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setZoom( float fZoomX , - float fZoomY ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XGraphics > SAL_CALL getGraphics() - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL getSize() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // CSS_LANG::XEventListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL disposing( - const CSS_LANG::EventObject& rSource - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XPaintListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowPaint( - const CSS_AWT::PaintEvent& rEvent - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XWindowListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowResized( const CSS_AWT::WindowEvent& aEvent ) throw( CSS_UNO::RuntimeException ); - virtual void SAL_CALL windowMoved( const CSS_AWT::WindowEvent& aEvent ) throw( CSS_UNO::RuntimeException ); - virtual void SAL_CALL windowShown( const CSS_LANG::EventObject& aEvent ) throw( CSS_UNO::RuntimeException ); - virtual void SAL_CALL windowHidden( const CSS_LANG::EventObject& aEvent ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // impl but public method to register service - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const CSS_UNO::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const ::rtl::OUString impl_getStaticImplementationName(); - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - using OComponentHelper::disposing; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory > impl_getMultiServiceFactory(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - const CSS_UNO::Reference< CSS_AWT::XWindow > impl_getPeerWindow(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - const CSS_UNO::Reference< CSS_AWT::XGraphics > impl_getGraphicsPeer(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - const sal_Int32& impl_getWidth(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - const sal_Int32& impl_getHeight(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::WindowDescriptor* impl_getWindowDescriptor( - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParentPeer - ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void impl_paint( sal_Int32 nX , - sal_Int32 nY , - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xGraphics ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void impl_recalcLayout( const CSS_AWT::WindowEvent& aEvent ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - CSS_UNO::Reference< CSS_UNO::XInterface > impl_getDelegator(); - -//____________________________________________________________________________________________________________ -// private methods -//____________________________________________________________________________________________________________ - -private: - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void impl_releasePeer(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - OMRCListenerMultiplexerHelper* impl_getMultiplexer(); - -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - - CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory > m_xFactory ; - CSS_UNO::Reference< CSS_UNO::XInterface > m_xDelegator ; - OMRCListenerMultiplexerHelper* m_pMultiplexer ; // multiplex events - CSS_UNO::Reference< CSS_UNO::XInterface > m_xMultiplexer ; - CSS_UNO::Reference< CSS_UNO::XInterface > m_xContext ; - CSS_UNO::Reference< CSS_AWT::XWindowPeer > m_xPeer ; - CSS_UNO::Reference< CSS_AWT::XWindow > m_xPeerWindow ; - CSS_UNO::Reference< CSS_AWT::XGraphics > m_xGraphicsView ; // graphics for CSS_AWT::XView-operations - CSS_UNO::Reference< CSS_AWT::XGraphics > m_xGraphicsPeer ; // graphics for painting on a peer - sal_Int32 m_nX ; // Position ... - sal_Int32 m_nY ; - sal_Int32 m_nWidth ; // ... and size of window - sal_Int32 m_nHeight ; - sal_Bool m_bVisible ; // Some state flags - sal_Bool m_bInDesignMode ; - sal_Bool m_bEnable ; - -}; // class BaseControl - -// The namespace aliaes are only used in this header -#undef CSS_UNO -#undef CSS_AWT -#undef CSS_LANG - -} // namespace unocontrols - -#endif // ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/inc/multiplexer.hxx b/UnoControls/inc/multiplexer.hxx deleted file mode 100644 index eac5085c2..000000000 --- a/UnoControls/inc/multiplexer.hxx +++ /dev/null @@ -1,784 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_MULTIPLEXER_HXX -#define _UNOCONTROLS_MULTIPLEXER_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ - -//____________________________________________________________________________________________________________ -// "namespaces" -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_AWT ::com::sun::star::awt -#define CSS_LANG ::com::sun::star::lang - -//____________________________________________________________________________________________________________ -// class -//____________________________________________________________________________________________________________ - -class OMRCListenerMultiplexerHelper : public CSS_AWT::XFocusListener - , public CSS_AWT::XWindowListener - , public CSS_AWT::XKeyListener - , public CSS_AWT::XMouseListener - , public CSS_AWT::XMouseMotionListener - , public CSS_AWT::XPaintListener - , public CSS_AWT::XTopWindowListener - , public ::cppu::OWeakObject -{ - -//____________________________________________________________________________________________________________ -// public methods -//____________________________________________________________________________________________________________ - -public: - - //________________________________________________________________________________________________________ - // construct/destruct - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short constructor - @descr Create a Multiplexer of XWindowEvents. - - @seealso - - - @param rControl The control. All listeners think that this is the original broadcaster. - @param rPeer The peer from which the original events are dispatched. Null is allowed. - - @return - - - @onerror - - */ - - OMRCListenerMultiplexerHelper( const CSS_UNO::Reference< CSS_AWT::XWindow >& xControl , - const CSS_UNO::Reference< CSS_AWT::XWindow >& xPeer ); - - /**_______________________________________________________________________________________________________ - @short copy-constructor - @descr - - @seealso - - - @param rCopyInstance C++-Reference to instance to make copy from. - - @return - - - @onerror - - */ - - OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& aCopyInstance ); - - /**_______________________________________________________________________________________________________ - @short destructor - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - ~OMRCListenerMultiplexerHelper(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //________________________________________________________________________________________________________ - // operator - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - operator CSS_UNO::Reference< CSS_UNO::XInterface >() const; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - OMRCListenerMultiplexerHelper& operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance ); - - //________________________________________________________________________________________________________ - // container methods - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short Remove all listeners from the previous set peer and add the needed listeners to rPeer. - @descr - - - @seealso - - - @param rPeer The peer from which the original events are dispatched. Null is allowed. - - @return - - - @onerror - - */ - - void setPeer( const CSS_UNO::Reference< CSS_AWT::XWindow >& xPeer ); - - /**_______________________________________________________________________________________________________ - @short Remove all listeners and send a disposing message. - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void disposeAndClear(); - - /**_______________________________________________________________________________________________________ - @short Add the specified listener to the source. - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void advise( const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener ); - - /**_______________________________________________________________________________________________________ - @short Remove the specified listener from the source. - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void unadvise( const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener ); - - //________________________________________________________________________________________________________ - // XEventListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL disposing(const CSS_LANG::EventObject& aSource) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XFocusListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL focusGained(const CSS_AWT::FocusEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL focusLost(const CSS_AWT::FocusEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XWindowListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowResized(const CSS_AWT::WindowEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowMoved(const CSS_AWT::WindowEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowShown(const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowHidden(const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XKeyListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL keyPressed( const CSS_AWT::KeyEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL keyReleased( const CSS_AWT::KeyEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XMouseListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mousePressed(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mouseReleased(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mouseEntered(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mouseExited(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XMouseMotionListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mouseDragged(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL mouseMoved(const CSS_AWT::MouseEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XPaintListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowPaint(const CSS_AWT::PaintEvent& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - //________________________________________________________________________________________________________ - // XTopWindowListener - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowOpened( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowClosing( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowClosed( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowMinimized( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowNormalized( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowActivated( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL windowDeactivated( const CSS_LANG::EventObject& aEvent ) - throw( CSS_UNO::RuntimeException ) ; - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - - /**_______________________________________________________________________________________________________ - @short Remove the listener from the peer. - @descr - - - @seealso - - - @param xPeer The peer from which the listener is removed. - @param rType The listener type, which specify the type of the listener. - - @return - - - @onerror - - */ - - void impl_adviseToPeer( const CSS_UNO::Reference< CSS_AWT::XWindow >& xPeer , - const CSS_UNO::Type& aType ); - - /**_______________________________________________________________________________________________________ - @short Add the listener to the peer. - @descr - - - @seealso - - - @param xPeer The peer to which the listener is added. - @param rType The listener type, which specify the type of the listener. - - @return - - - @onerror - - */ - - void impl_unadviseFromPeer( const CSS_UNO::Reference< CSS_AWT::XWindow >& xPeer , - const CSS_UNO::Type& aType ); - -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - - ::osl::Mutex m_aMutex ; - CSS_UNO::Reference< CSS_AWT::XWindow > m_xPeer ; /// The source of the events. Normally this is the peer object. - CSS_UNO::WeakReference< CSS_AWT::XWindow > m_xControl ; - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerHolder ; - -}; // class OMRCListenerMultiplexerHelper - -// The namespace aliases are only used in this header -#undef CSS_UNO -#undef CSS_AWT -#undef CSS_LANG - - -} // namespace unocontrols - -#endif // ifndef _UNOCONTROLS_MULTIPLEXER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/prj/build.lst b/UnoControls/prj/build.lst deleted file mode 100644 index 473776ffb..000000000 --- a/UnoControls/prj/build.lst +++ /dev/null @@ -1,5 +0,0 @@ -us UnoControls : LIBXSLT:libxslt cppuhelper offapi tools NULL -us UnoControls usr1 - all us_mkout NULL -us UnoControls\source\base nmake - all us_base NULL -us UnoControls\source\controls nmake - all us_ctrls NULL -us UnoControls\util nmake - all us_util us_base us_ctrls NULL diff --git a/UnoControls/prj/d.lst b/UnoControls/prj/d.lst deleted file mode 100644 index 4c1de78bd..000000000 --- a/UnoControls/prj/d.lst +++ /dev/null @@ -1,6 +0,0 @@ -..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll -..\%__SRC%\lib\lib*.so %_DEST%\lib -..\%__SRC%\lib\*.sl %_DEST%\lib\*.sl -..\%__SRC%\bin\*.res %_DEST%\bin\*.res -..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib -..\%__SRC%\misc\ctl.component %_DEST%\xml\ctl.component diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx deleted file mode 100644 index 123449f10..000000000 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ /dev/null @@ -1,636 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//____________________________________________________________________________________________________________ -// my own includes -//____________________________________________________________________________________________________________ - -#include "basecontainercontrol.hxx" - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ - -//____________________________________________________________________________________________________________ -// namespaces -//____________________________________________________________________________________________________________ - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::rtl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::container ; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -BaseContainerControl::BaseContainerControl( const Reference< XMultiServiceFactory >& xFactory ) - : BaseControl ( xFactory ) - , m_aListeners ( m_aMutex ) -{ -} - -BaseContainerControl::~BaseContainerControl() -{ - impl_cleanMemory(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL BaseContainerControl::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn ; - Reference< XInterface > xDel = BaseControl::impl_getDelegator(); - if ( xDel.is() == sal_True ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL BaseContainerControl::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) , - ::getCppuType(( const Reference< XControlContainer >*)NULL ) , - BaseControl::getTypes() - ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL BaseContainerControl::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XControlModel* > ( this ) , - static_cast< XControlContainer* > ( this ) - ) - ); - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return BaseControl::queryAggregation( aType ); - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::createPeer( const Reference< XToolkit >& xToolkit , - const Reference< XWindowPeer >& xParent ) throw( RuntimeException ) -{ - if ( getPeer().is() == sal_False ) - { - // create own peer - BaseControl::createPeer( xToolkit, xParent ); - - // create peers at all childs - Sequence< Reference< XControl > > seqControlList = getControls(); - sal_uInt32 nControls = seqControlList.getLength(); - - for ( sal_uInt32 n=0; ncreatePeer( xToolkit, getPeer() ); - } - - // activate new tab order - impl_activateTabControllers(); - - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL BaseContainerControl::setModel( const Reference< XControlModel >& ) throw( RuntimeException ) -{ - // This object has NO model. - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XControlModel > SAL_CALL BaseContainerControl::getModel() throw( RuntimeException ) -{ - // This object has NO model. - // return (XControlModel*)this ; - return Reference< XControlModel >(); -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException ) -{ - // Zuerst der Welt mitteilen, da� der Container wegfliegt. Dieses ist um einiges - // schneller wenn die Welt sowohl an den Controls als auch am Container horcht - - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // remove listeners - EventObject aObject ; - - aObject.Source = Reference< XComponent > ( (XControlContainer*)this, UNO_QUERY ); - m_aListeners.disposeAndClear( aObject ); - - // remove controls - Sequence< Reference< XControl > > seqCtrls = getControls(); - Reference< XControl > * pCtrls = seqCtrls.getArray(); - sal_uInt32 nCtrls = seqCtrls.getLength(); - size_t nMaxCount = maControlInfoList.size(); - size_t nCount = 0; - - for ( nCount = 0; nCount < nMaxCount; ++nCount ) - { - delete maControlInfoList[ nCount ]; - } - maControlInfoList.clear(); - - for ( nCount = 0; nCount < nCtrls; ++nCount ) - { - pCtrls [ nCount ] -> removeEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ) ; - pCtrls [ nCount ] -> dispose ( ) ; - } - - // call baseclass - BaseControl::dispose(); -} - -//____________________________________________________________________________________________________________ -// XEventListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::disposing( const EventObject& rEvent ) throw( RuntimeException ) -{ - Reference< XControl > xControl( rEvent.Source, UNO_QUERY ); - - // "removeControl" remove only, when control is an active control - removeControl( xControl ); -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Reference< XControl > & rControl ) throw( RuntimeException ) -{ - if ( !rControl.is () ) - return; - - // take memory for new item - IMPL_ControlInfo* pNewControl = new IMPL_ControlInfo ; - - if (pNewControl!=(IMPL_ControlInfo*)0) - { - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - // set control - pNewControl->sName = rName ; - pNewControl->xControl = rControl ; - - // and insert in list - maControlInfoList.push_back( pNewControl ) ; - - // initialize new control - pNewControl->xControl->setContext ( (OWeakObject*)this ) ; - pNewControl->xControl->addEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ) ; - - // when container has a peer ... - if (getPeer().is()) - { - // .. then create a peer on child - pNewControl->xControl->createPeer ( getPeer()->getToolkit(), getPeer() ) ; - impl_activateTabControllers () ; - } - - // Send message to all listener - OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ; - - if (pInterfaceContainer) - { - // Build event - ContainerEvent aEvent ; - - aEvent.Source = *this ; - aEvent.Element <<= rControl ; - - // Get all listener - OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ; - - // Send event - while ( aIterator.hasMoreElements() ) - { - ((XContainerListener*)aIterator.next())->elementInserted (aEvent) ; - } - } - } -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::addContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - m_aListeners.addInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ; -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > & rControl ) throw( RuntimeException ) -{ - if ( rControl.is() ) - { - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - size_t nControls = maControlInfoList.size(); - - for ( size_t n = 0; n < nControls; n++ ) - { - // Search for right control - IMPL_ControlInfo* pControl = maControlInfoList[ n ] ; - if ( rControl == pControl->xControl ) - { - //.is it found ... remove listener from control - pControl->xControl->removeEventListener (static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) )) ; - pControl->xControl->setContext ( Reference< XInterface > () ) ; - - // ... free memory - delete pControl ; - ::std::vector::iterator itr = maControlInfoList.begin(); - ::std::advance(itr, n); - maControlInfoList.erase(itr); - - // Send message to all other listener - OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ; - - if (pInterfaceContainer) - { - ContainerEvent aEvent ; - - aEvent.Source = *this ; - aEvent.Element <<= rControl ; - - OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ; - - while ( aIterator.hasMoreElements() ) - { - ((XContainerListener*)aIterator.next())->elementRemoved (aEvent) ; - } - } - // Break "for" ! - break ; - } - } - } -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::removeContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - m_aListeners.removeInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ; -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::setStatusText ( const OUString& rStatusText ) throw( RuntimeException ) -{ - // go down to each parent - Reference< XControlContainer > xContainer ( getContext(), UNO_QUERY ) ; - - if ( xContainer.is () ) - { - xContainer->setStatusText ( rStatusText ) ; - } -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -Reference< XControl > SAL_CALL BaseContainerControl::getControl ( const OUString& rName ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( Mutex::getGlobalMutex() ) ; - - Reference< XControl > xRetControl = Reference< XControl > (); - size_t nControls = maControlInfoList.size(); - - // Search for right control - for( size_t nCount = 0; nCount < nControls; ++nCount ) - { - IMPL_ControlInfo* pSearchControl = maControlInfoList[ nCount ]; - - if ( pSearchControl->sName == rName ) - { - // We have found it ... - // Break operation and return. - return pSearchControl->xControl ; - } - } - - // We have not found it ... return NULL. - return Reference< XControl > () ; -} - -//____________________________________________________________________________________________________________ -// XControlContainer -//____________________________________________________________________________________________________________ - -Sequence< Reference< XControl > > SAL_CALL BaseContainerControl::getControls () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( Mutex::getGlobalMutex() ) ; - - size_t nControls = maControlInfoList.size(); - size_t nCount = 0; - Sequence< Reference< XControl > > aDescriptor ( nControls ) ; - Reference< XControl > * pDestination = aDescriptor.getArray () ; - - // Copy controls to sequence - for( nCount = 0; nCount < nControls; ++nCount ) - { - IMPL_ControlInfo* pCopyControl = maControlInfoList[ nCount ]; - pDestination [ nCount ] = pCopyControl->xControl ; - } - - // Return sequence - return aDescriptor ; -} - -//____________________________________________________________________________________________________________ -// XUnoControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::addTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - sal_uInt32 nOldCount = m_xTabControllerList.getLength () ; - Sequence< Reference< XTabController > > aNewList ( nOldCount + 1 ) ; - sal_uInt32 nCount = 0 ; - - // Copy old elements of sequence to new list. - for ( nCount = 0; nCount < nOldCount; ++nCount ) - { - aNewList.getArray () [nCount] = m_xTabControllerList.getConstArray () [nCount] ; - } - - // Add new controller - aNewList.getArray () [nOldCount] = rTabController ; - - // change old and new list - m_xTabControllerList = aNewList ; -} - -//____________________________________________________________________________________________________________ -// XUnoControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::removeTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ; - sal_uInt32 nCount = 0 ; - - // Search right tabcontroller ... - for ( nCount = 0; nCount < nMaxCount; ++nCount ) - { - if ( m_xTabControllerList.getConstArray () [nCount] == rTabController ) - { - // ... if is it found ... remove it from list. - m_xTabControllerList.getArray()[ nCount ] = Reference< XTabController >() ; - break ; - } - } -} - -//____________________________________________________________________________________________________________ -// XUnoControlContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::setTabControllers ( const Sequence< Reference< XTabController > >& rTabControllers ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - m_xTabControllerList = rTabControllers ; -} - -Sequence > SAL_CALL BaseContainerControl::getTabControllers () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - return m_xTabControllerList ; -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseContainerControl::setVisible ( sal_Bool bVisible ) throw( RuntimeException ) -{ - // override baseclass definition - BaseControl::setVisible ( bVisible ) ; - - // is it a top window ? - if ( !getContext().is() && bVisible ) - { - // then show it automaticly - createPeer ( Reference< XToolkit > (), Reference< XWindowPeer > () ) ; - } -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -WindowDescriptor* BaseContainerControl::impl_getWindowDescriptor ( const Reference< XWindowPeer > & rParentPeer ) -{ - // - used from "createPeer()" to set the values of an WindowDescriptor !!! - // - if you will change the descriptor-values, you must override thid virtuell function - // - the caller must release the memory for this dynamical descriptor !!! - - WindowDescriptor * aDescriptor = new WindowDescriptor ; - - aDescriptor->Type = WindowClass_CONTAINER ; - aDescriptor->WindowServiceName = OUString(RTL_CONSTASCII_USTRINGPARAM("window")) ; - aDescriptor->ParentIndex = -1 ; - aDescriptor->Parent = rParentPeer ; - aDescriptor->Bounds = getPosSize () ; - aDescriptor->WindowAttributes = 0 ; - - return aDescriptor ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void BaseContainerControl::impl_paint ( sal_Int32 /*nX*/, sal_Int32 /*nY*/, const Reference< XGraphics > & /*rGraphics*/ ) -{ -/* - if (rGraphics.is()) - { - for ( size_t n = maControlInfoList.size(); n; ) - { - ControlInfo* pSearchControl = maControlInfoList[ --n ]; - pSearchControl->xControl->paint ( nX, nY, rGraphics ) ; - } - } -*/ -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void BaseContainerControl::impl_activateTabControllers () -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ; - sal_uInt32 nCount = 0 ; - - for ( nCount = 0; nCount < nMaxCount; ++nCount ) - { - m_xTabControllerList.getArray () [nCount]->setContainer ( this ) ; - m_xTabControllerList.getArray () [nCount]->activateTabOrder ( ) ; - } -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void BaseContainerControl::impl_cleanMemory () -{ - // Get count of listitems. - size_t nMaxCount = maControlInfoList.size(); - size_t nCount = 0; - - // Delete all items. - for ( nCount = 0; nCount < nMaxCount; ++nCount ) - { - // Delete everytime first element of list! - // We count from 0 to MAX, where "MAX=count of items" BEFORE we delete some elements! - // If we use "GetObject ( nCount )" ... it can be, that we have an index greater then count of current elements! - - IMPL_ControlInfo* pSearchControl = maControlInfoList[ nCount ]; - delete pSearchControl; - } - - // Delete list himself. - maControlInfoList.clear (); -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx deleted file mode 100644 index 90e0e601e..000000000 --- a/UnoControls/source/base/basecontrol.cxx +++ /dev/null @@ -1,1022 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//____________________________________________________________________________________________________________ -// my own include -//____________________________________________________________________________________________________________ - -#include "basecontrol.hxx" - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ -#include -#include -#include -#include -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ - -//____________________________________________________________________________________________________________ -// namespaces -//____________________________________________________________________________________________________________ - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::rtl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::awt ; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// defines -//____________________________________________________________________________________________________________ - -#define DEFAULT_PMULTIPLEXER NULL -#define DEFAULT_X 0 -#define DEFAULT_Y 0 -#define DEFAULT_WIDTH 100 -#define DEFAULT_HEIGHT 100 -#define DEFAULT_VISIBLE sal_False -#define DEFAULT_INDESIGNMODE sal_False -#define DEFAULT_ENABLE sal_True -#define SERVICE_VCLTOOLKIT "com.sun.star.awt.Toolkit" - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -BaseControl::BaseControl( const Reference< XMultiServiceFactory >& xFactory ) - : IMPL_MutexContainer ( ) - , OComponentHelper ( m_aMutex ) - , m_xFactory ( xFactory ) - , m_pMultiplexer ( DEFAULT_PMULTIPLEXER ) - , m_nX ( DEFAULT_X ) - , m_nY ( DEFAULT_Y ) - , m_nWidth ( DEFAULT_WIDTH ) - , m_nHeight ( DEFAULT_HEIGHT ) - , m_bVisible ( DEFAULT_VISIBLE ) - , m_bInDesignMode ( DEFAULT_INDESIGNMODE ) - , m_bEnable ( DEFAULT_ENABLE ) -{ -} - -BaseControl::~BaseControl() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL BaseControl::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - Any aReturn ; - if ( m_xDelegator.is() == sal_True ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = m_xDelegator->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OComponentHelper::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OComponentHelper::release(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL BaseControl::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection( ::getCppuType(( const Reference< XPaintListener >*)NULL ) , - ::getCppuType(( const Reference< XWindowListener>*)NULL ) , - ::getCppuType(( const Reference< XView >*)NULL ) , - ::getCppuType(( const Reference< XWindow >*)NULL ) , - ::getCppuType(( const Reference< XServiceInfo >*)NULL ) , - ::getCppuType(( const Reference< XControl >*)NULL ) , - OComponentHelper::getTypes() - ); - - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< sal_Int8 > SAL_CALL BaseControl::getImplementationId() throw( RuntimeException ) -{ - // Create one Id for all instances of this class. - // Use ethernet address to do this! (sal_True) - - // Optimize this method - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pID is NULL - for the second call pID is different from NULL! - static OImplementationId* pID = NULL ; - - if ( pID == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pID == NULL ) - { - // Create a new static ID ... - static OImplementationId aID( sal_False ); - // ... and set his address to static pointer! - pID = &aID ; - } - } - - return pID->getImplementationId(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setDelegator( const Reference< XInterface >& xDel ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - m_xDelegator = xDel; -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL BaseControl::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XPaintListener*> ( this ) , - static_cast< XWindowListener*> ( this ) , - static_cast< XView* > ( this ) , - static_cast< XWindow* > ( this ) , - static_cast< XServiceInfo* > ( this ) , - static_cast< XControl* > ( this ) - ) - ); - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return OComponentHelper::queryAggregation( aType ); - } -} - -//____________________________________________________________________________________________________________ -// XServiceInfo -//____________________________________________________________________________________________________________ - -OUString SAL_CALL BaseControl::getImplementationName() throw( RuntimeException ) -{ - return impl_getStaticImplementationName(); -} - -//____________________________________________________________________________________________________________ -// XServiceInfo -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL BaseControl::supportsService( const OUString& sServiceName ) throw( RuntimeException ) -{ - Sequence< OUString > seqServiceNames = getSupportedServiceNames(); - const OUString* pArray = seqServiceNames.getConstArray(); - for ( sal_Int32 nCounter=0; nCounter SAL_CALL BaseControl::getSupportedServiceNames() throw( RuntimeException ) -{ - return impl_getStaticSupportedServiceNames(); -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::dispose() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - if ( m_pMultiplexer != NULL ) - { - // to all other paint, focus, etc. - m_pMultiplexer->disposeAndClear(); - } - - // set the service manager to disposed - OComponentHelper::dispose(); - - // release context and peer - m_xContext = Reference< XInterface >(); - impl_releasePeer(); - - // release view - if ( m_xGraphicsView.is() == sal_True ) - { - m_xGraphicsView = Reference< XGraphics >(); - } -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - OComponentHelper::addEventListener( xListener ); -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - OComponentHelper::removeEventListener( xListener ); -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToolkit , - const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - if ( m_xPeer.is() == sal_False ) - { - // use method "BaseControl::getWindowDescriptor()" fot change window attributes !!! - WindowDescriptor* pDescriptor = impl_getWindowDescriptor( xParentPeer ); - - if ( m_bVisible == sal_True ) - { - pDescriptor->WindowAttributes |= WindowAttribute::SHOW ; - } - - // very slow under remote conditions! - // create the window on the server - Reference< XToolkit > xLocalToolkit = xToolkit ; - if ( xLocalToolkit.is() == sal_False ) - { - // but first create wellknown toolkit, if it not exist - xLocalToolkit = Reference< XToolkit > ( m_xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICE_VCLTOOLKIT )) ), UNO_QUERY ); - } - m_xPeer = xLocalToolkit->createWindow( *pDescriptor ); - m_xPeerWindow = Reference< XWindow >( m_xPeer, UNO_QUERY ); - - // don't forget to release the memory! - delete pDescriptor ; - - if ( m_xPeerWindow.is() == sal_True ) - { - if ( m_pMultiplexer != NULL ) - { - m_pMultiplexer->setPeer( m_xPeerWindow ); - } - - // create new referenz to xgraphics for painting on a peer - // and add a paint listener - Reference< XDevice > xDevice( m_xPeerWindow, UNO_QUERY ); - - if ( xDevice.is() == sal_True ) - { - m_xGraphicsPeer = xDevice->createGraphics(); - } - - if ( m_xGraphicsPeer.is() == sal_True ) - { - addPaintListener( this ); - addWindowListener( this ); - } - - // PosSize_POSSIZE defined in - m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, PosSize::POSSIZE ); - m_xPeerWindow->setEnable( m_bEnable ); - m_xPeerWindow->setVisible( m_bVisible && !m_bInDesignMode ); - } - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setContext( const Reference< XInterface >& xContext ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - m_xContext = xContext ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setDesignMode( sal_Bool bOn ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - m_bInDesignMode = bOn ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XInterface > SAL_CALL BaseControl::getContext() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return m_xContext ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XWindowPeer > SAL_CALL BaseControl::getPeer() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return m_xPeer ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XView > SAL_CALL BaseControl::getView() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return Reference< XView >( (OWeakObject*)this, UNO_QUERY ); -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL BaseControl::isDesignMode() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return m_bInDesignMode ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL BaseControl::isTransparent() throw( RuntimeException ) -{ - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setPosSize( sal_Int32 nX , - sal_Int32 nY , - sal_Int32 nWidth , - sal_Int32 nHeight , - sal_Int16 nFlags ) throw( RuntimeException ) -{ - // - change size and position of window and save the values - // - "nFlags" declared in ("#define PosSize_X .....") - - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - sal_Bool bChanged = sal_False ; - - if ( nFlags & PosSize::X ) - { - bChanged |= m_nX != nX, m_nX = nX ; - } - - if ( nFlags & PosSize::Y ) - { - bChanged |= m_nY != nY, m_nY = nY ; - } - - if ( nFlags & PosSize::WIDTH ) - { - bChanged |= m_nWidth != nWidth, m_nWidth = nWidth ; - } - - if ( nFlags & PosSize::HEIGHT ) - { - bChanged |= m_nHeight != nHeight, m_nHeight = nHeight ; - } - - if ( bChanged && m_xPeerWindow.is() ) - { - m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, nFlags ); - } -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setVisible( sal_Bool bVisible ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Set new state of flag - m_bVisible = bVisible ; - - if ( m_xPeerWindow.is() == sal_True ) - { - // Set it also on peerwindow - m_xPeerWindow->setVisible( m_bVisible ); - } -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setEnable( sal_Bool bEnable ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Set new state of flag - m_bEnable = bEnable ; - - if ( m_xPeerWindow.is() == sal_True ) - { - // Set it also on peerwindow - m_xPeerWindow->setEnable( m_bEnable ); - } -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setFocus() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - if ( m_xPeerWindow.is() == sal_True ) - { - m_xPeerWindow->setFocus(); - } -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -Rectangle SAL_CALL BaseControl::getPosSize() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return Rectangle( m_nX, m_nY , m_nWidth, m_nHeight ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::addPaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::removePaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException ) -{ - impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener ); -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::draw( sal_Int32 nX , - sal_Int32 nY ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // - paint to an view - // - use the method "paint()" - // - see also "windowPaint()" - impl_paint( nX, nY, m_xGraphicsView ); -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL BaseControl::setGraphics( const Reference< XGraphics >& xDevice ) throw( RuntimeException ) -{ - // - set the graphics for an view - // - in this class exist 2 graphics-member ... one for peer[_xGraphicsPeer] and one for view[_xGraphicsView] - // - they are used by "windowPaint() and draw()", forwarded to "paint ()" - sal_Bool bReturn = sal_False ; - if ( xDevice.is() == sal_True ) - { - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - m_xGraphicsView = xDevice ; - bReturn = sal_True ; - } - - return bReturn ; -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::setZoom( float /*fZoomX*/ , - float /*fZoomY*/ ) throw( RuntimeException ) -{ - // Not implemented yet -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -Reference< XGraphics > SAL_CALL BaseControl::getGraphics() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return m_xGraphicsView ; -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -Size SAL_CALL BaseControl::getSize() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - return Size( m_nWidth, m_nHeight ); -} - -//____________________________________________________________________________________________________________ -// XEventListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::disposing( const EventObject& /*aSource*/ ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // - release ALL references - // - it must be !!! - if ( m_xGraphicsPeer.is() == sal_True ) - { - removePaintListener( this ); - removeWindowListener( this ); - m_xGraphicsPeer = Reference< XGraphics >(); - } - - if ( m_xGraphicsView.is() == sal_True ) - { - m_xGraphicsView = Reference< XGraphics >(); - } -} - -//____________________________________________________________________________________________________________ -// XPaintListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::windowPaint( const PaintEvent& /*aEvent*/ ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // - repaint the peer - // - use the method "paint ()" for painting on a peer and a print device !!! - // - see also "draw ()" - impl_paint( 0, 0, m_xGraphicsPeer ); -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::windowResized( const WindowEvent& aEvent ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - m_nWidth = aEvent.Width ; - m_nHeight = aEvent.Height ; - WindowEvent aMappedEvent = aEvent; - aMappedEvent.X = 0; - aMappedEvent.Y = 0; - impl_recalcLayout( aMappedEvent ); -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::windowMoved( const WindowEvent& aEvent ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - m_nWidth = aEvent.Width ; - m_nHeight = aEvent.Height ; - WindowEvent aMappedEvent = aEvent; - aMappedEvent.X = 0; - aMappedEvent.Y = 0; - impl_recalcLayout( aMappedEvent ); -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::windowShown( const EventObject& /*aEvent*/ ) throw( RuntimeException ) -{ -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void SAL_CALL BaseControl::windowHidden( const EventObject& /*aEvent*/ ) throw( RuntimeException ) -{ -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service in DLL -// (In this BASE-implementation not implemented! Overwrite it in derived classes.) -//____________________________________________________________________________________________________________ - -const Sequence< OUString > BaseControl::impl_getStaticSupportedServiceNames() -{ - return Sequence< OUString >(); -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service in DLL -// (In this BASE-implementation not implemented! Overwrite it in derived classes.) -//____________________________________________________________________________________________________________ - -const OUString BaseControl::impl_getStaticImplementationName() -{ - return OUString(); -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -const Reference< XMultiServiceFactory > BaseControl::impl_getMultiServiceFactory() -{ - return m_xFactory ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -const Reference< XWindow > BaseControl::impl_getPeerWindow() -{ - return m_xPeerWindow ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -const Reference< XGraphics > BaseControl::impl_getGraphicsPeer() -{ - return m_xGraphicsPeer ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -const sal_Int32& BaseControl::impl_getWidth() -{ - return m_nWidth ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -const sal_Int32& BaseControl::impl_getHeight() -{ - return m_nHeight ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -WindowDescriptor* BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer ) -{ - // - used from "createPeer()" to set the values of an ::com::sun::star::awt::WindowDescriptor !!! - // - if you will change the descriptor-values, you must override this virtuell function - // - the caller must release the memory for this dynamical descriptor !!! - - WindowDescriptor* pDescriptor = new WindowDescriptor ; - - pDescriptor->Type = WindowClass_SIMPLE ; - pDescriptor->WindowServiceName = OUString(RTL_CONSTASCII_USTRINGPARAM("window")) ; - pDescriptor->ParentIndex = -1 ; - pDescriptor->Parent = xParentPeer ; - pDescriptor->Bounds = getPosSize () ; - pDescriptor->WindowAttributes = 0 ; - - return pDescriptor ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void BaseControl::impl_paint( sal_Int32 /*nX*/ , - sal_Int32 /*nY*/ , - const Reference< XGraphics >& /*xGraphics*/ ) -{ - // - one paint method for peer AND view !!! - // (see also => "windowPaint()" and "draw()") - // - not used in this implementation, but its not necessary to make it pure virtual !!! -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void BaseControl::impl_recalcLayout( const WindowEvent& /*aEvent*/ ) -{ - // We need as virtual function to support automaticly resizing of derived controls! - // But we make it not pure virtual because it's not neccessary for all derived classes! -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -Reference< XInterface > BaseControl::impl_getDelegator() -{ - return m_xDelegator ; -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void BaseControl::impl_releasePeer() -{ - if ( m_xPeer.is() == sal_True ) - { - if ( m_xGraphicsPeer.is() == sal_True ) - { - removePaintListener( this ); - removeWindowListener( this ); - m_xGraphicsPeer = Reference< XGraphics >(); - } - - m_xPeer->dispose(); - m_xPeerWindow = Reference< XWindow >(); - m_xPeer = Reference< XWindowPeer >(); - - if ( m_pMultiplexer != NULL ) - { - // take changes on multiplexer - m_pMultiplexer->setPeer( Reference< XWindow >() ); - } - } -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -OMRCListenerMultiplexerHelper* BaseControl::impl_getMultiplexer() -{ - if ( m_pMultiplexer == NULL ) - { - m_pMultiplexer = new OMRCListenerMultiplexerHelper( (XWindow*)this, m_xPeerWindow ); - m_xMultiplexer = Reference< XInterface >( (OWeakObject*)m_pMultiplexer, UNO_QUERY ); - } - - return m_pMultiplexer ; -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/base/makefile.mk b/UnoControls/source/base/makefile.mk deleted file mode 100644 index 66b87395a..000000000 --- a/UnoControls/source/base/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=UnoControls -TARGET=base -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/multiplexer.obj \ - $(SLO)$/basecontrol.obj \ - $(SLO)$/basecontainercontrol.obj \ - $(SLO)$/registercontrols.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx deleted file mode 100644 index d7be8569a..000000000 --- a/UnoControls/source/base/multiplexer.cxx +++ /dev/null @@ -1,530 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "multiplexer.hxx" - -#include - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::lang ; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// macros -//____________________________________________________________________________________________________________ - -#define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \ - \ - /* First get all interfaces from container with right type.*/ \ - OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( ::getCppuType((const Reference< INTERFACE >*)0) ); \ - /* Do the follow only, if elements in container exist.*/ \ - if( pContainer != NULL ) \ - { \ - OInterfaceIteratorHelper aIterator( *pContainer ); \ - EVENTTYP aLocalEvent = EVENT; \ - /* Remark: The control is the event source not the peer.*/ \ - /* We must change the source of the event. */ \ - aLocalEvent.Source = m_xControl ; \ - /* Is the control not destroyed? */ \ - if( aLocalEvent.Source.is() == sal_True ) \ - { \ - if( aIterator.hasMoreElements() ) \ - { \ - INTERFACE * pListener = (INTERFACE *)aIterator.next(); \ - try \ - { \ - pListener->METHOD( aLocalEvent ); \ - } \ - catch( RuntimeException& ) \ - { \ - /* Ignore all system exceptions from the listener! */ \ - } \ - } \ - } \ - } - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const Reference< XWindow >& xControl , - const Reference< XWindow >& xPeer ) - : m_xPeer ( xPeer ) - , m_xControl ( xControl ) - , m_aListenerHolder ( m_aMutex ) -{ -} - -OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& /*aCopyInstance*/ ) - : XFocusListener() - , XWindowListener() - , XKeyListener() - , XMouseListener() - , XMouseMotionListener() - , XPaintListener() - , XTopWindowListener() - , OWeakObject() - , m_aListenerHolder ( m_aMutex ) -{ -} - -OMRCListenerMultiplexerHelper::~OMRCListenerMultiplexerHelper() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL OMRCListenerMultiplexerHelper::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( rType , - static_cast< XWindowListener* > ( this ) , - static_cast< XKeyListener* > ( this ) , - static_cast< XFocusListener* > ( this ) , - static_cast< XMouseListener* > ( this ) , - static_cast< XMouseMotionListener* > ( this ) , - static_cast< XPaintListener* > ( this ) , - static_cast< XTopWindowListener* > ( this ) , - static_cast< XTopWindowListener* > ( this ) - ) - ); - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return OWeakObject::queryInterface( rType ); - } -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OMRCListenerMultiplexerHelper::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OMRCListenerMultiplexerHelper::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::release(); -} - -//____________________________________________________________________________________________________________ -// operator -//____________________________________________________________________________________________________________ - -OMRCListenerMultiplexerHelper::operator Reference< XInterface >() const -{ - return ((OWeakObject*)this) ; -} - -//____________________________________________________________________________________________________________ -// container method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer ) -{ - MutexGuard aGuard( m_aMutex ); - if( m_xPeer != xPeer ) - { - if( m_xPeer.is() ) - { - // get all types from the listener added to the peer - Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes(); - const Type* pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); - // loop over all listener types and remove the listeners from the peer - for( sal_Int32 i=0; i aContainedTypes = m_aListenerHolder.getContainedTypes(); - const Type* pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); - // loop over all listener types and add the listeners to the peer - for( sal_Int32 i = 0; i < nCount; i++ ) - impl_adviseToPeer( m_xPeer, pArray[i] ); - } - } -} - -//____________________________________________________________________________________________________________ -// container method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::disposeAndClear() -{ - EventObject aEvent ; - aEvent.Source = m_xControl ; - m_aListenerHolder.disposeAndClear( aEvent ); -} - -//____________________________________________________________________________________________________________ -// container method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::advise( const Type& aType , - const Reference< XInterface >& xListener ) -{ - MutexGuard aGuard( m_aMutex ); - if( m_aListenerHolder.addInterface( aType, xListener ) == 1 ) - { - // the first listener is added - if( m_xPeer.is() ) - { - impl_adviseToPeer( m_xPeer, aType ); - } - } -} - -//____________________________________________________________________________________________________________ -// container method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::unadvise( const Type& aType , - const Reference< XInterface >& xListener ) -{ - MutexGuard aGuard( m_aMutex ); - if( m_aListenerHolder.removeInterface( aType, xListener ) == 0 ) - { - // the last listener is removed - if ( m_xPeer.is() ) - { - impl_unadviseFromPeer( m_xPeer, aType ); - } - } -} - -//____________________________________________________________________________________________________________ -// XEventListener -//____________________________________________________________________________________________________________ - -void SAL_CALL OMRCListenerMultiplexerHelper::disposing( const EventObject& /*aSource*/ ) throw( RuntimeException ) -{ - MutexGuard aGuard( m_aMutex ); - // peer is disposed, clear the reference - m_xPeer = Reference< XWindow >(); -} - -//____________________________________________________________________________________________________________ -// XFcousListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::focusGained(const FocusEvent& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XFocusListener, focusGained, FocusEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XFcousListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::focusLost(const FocusEvent& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XFocusListener, focusLost, FocusEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowResized(const WindowEvent& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XWindowListener, windowResized, WindowEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowMoved(const WindowEvent& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XWindowListener, windowMoved, WindowEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowShown(const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XWindowListener, windowShown, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowHidden(const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XWindowListener, windowHidden, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XKeyListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::keyPressed(const KeyEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XKeyListener, keyPressed, KeyEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XKeyListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::keyReleased(const KeyEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XKeyListener, keyReleased, KeyEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mousePressed(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseListener, mousePressed, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mouseReleased(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseListener, mouseReleased, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mouseEntered(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseListener, mouseEntered, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mouseExited(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseListener, mouseExited, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseMotionListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mouseDragged(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseMotionListener, mouseDragged, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XMouseMotionListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::mouseMoved(const MouseEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XMouseMotionListener, mouseMoved, MouseEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XPaintListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowPaint(const PaintEvent& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XPaintListener, windowPaint, PaintEvent, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowOpened(const EventObject& aEvent) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowOpened, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowClosing( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowClosing, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowClosed( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowClosed, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowMinimized( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowMinimized, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowNormalized( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowNormalized, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowActivated( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowActivated, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// XTopWindowListener -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::windowDeactivated( const EventObject& aEvent ) throw( RuntimeException ) -{ - MULTIPLEX( XTopWindowListener, windowDeactivated, EventObject, aEvent ) -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWindow >& xPeer , - const Type& aType ) -{ - // add a listener to the source (peer) - if( aType == ::getCppuType((const Reference< XWindowListener >*)0) ) - xPeer->addWindowListener( this ); - else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) ) - xPeer->addKeyListener( this ); - else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) ) - xPeer->addFocusListener( this ); - else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) ) - xPeer->addMouseListener( this ); - else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) ) - xPeer->addMouseMotionListener( this ); - else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) ) - xPeer->addPaintListener( this ); - else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) ) - { - Reference< XTopWindow > xTop( xPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->addTopWindowListener( this ); - } - else - { - OSL_FAIL( "unknown listener" ); - } -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void OMRCListenerMultiplexerHelper::impl_unadviseFromPeer( const Reference< XWindow >& xPeer , - const Type& aType ) -{ - // the last listener is removed, remove the listener from the source (peer) - if( aType == ::getCppuType((const Reference< XWindowListener >*)0) ) - xPeer->removeWindowListener( this ); - else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) ) - xPeer->removeKeyListener( this ); - else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) ) - xPeer->removeFocusListener( this ); - else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) ) - xPeer->removeMouseListener( this ); - else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) ) - xPeer->removeMouseMotionListener( this ); - else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) ) - xPeer->removePaintListener( this ); - else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) ) - { - Reference< XTopWindow > xTop( xPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->removeTopWindowListener( this ); - } - else - { - OSL_FAIL( "unknown listener" ); - } -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx deleted file mode 100644 index f786c9285..000000000 --- a/UnoControls/source/base/registercontrols.cxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include - -#include - -//______________________________________________________________________________________________________________ -// includes of my own project -//______________________________________________________________________________________________________________ - -//============================================================================= -// Add new include line to use new services. -//============================================================================= -#include "framecontrol.hxx" -#include "progressbar.hxx" -#include "progressmonitor.hxx" -#include "statusindicator.hxx" -//============================================================================= - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::cppu ; -using namespace ::unocontrols ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::container ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::registry ; - -//______________________________________________________________________________________________________________ -// macros -//______________________________________________________________________________________________________________ - -//****************************************************************************************************************************** -#define CREATEINSTANCE(CLASS) \ - \ - static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \ - { \ - return Reference< XInterface >( *(OWeakObject*)(new CLASS( rServiceManager )) ); \ - } - -//****************************************************************************************************************************** -#define CREATEFACTORY_ONEINSTANCE(CLASS) \ - \ - /* Create right factory ... */ \ - xFactory = Reference< XSingleServiceFactory > \ - ( \ - cppu::createOneInstanceFactory ( xServiceManager , \ - CLASS::impl_getStaticImplementationName () , \ - CLASS##_createInstance , \ - CLASS::impl_getStaticSupportedServiceNames () ) \ - ) ; \ - -//****************************************************************************************************************************** -#define CREATEFACTORY_SINGLE(CLASS) \ - \ - /* Create right factory ... */ \ - xFactory = Reference< XSingleServiceFactory > \ - ( \ - cppu::createSingleFactory ( xServiceManager , \ - CLASS::impl_getStaticImplementationName () , \ - CLASS##_createInstance , \ - CLASS::impl_getStaticSupportedServiceNames () ) \ - ) ; \ - -//****************************************************************************************************************************** -#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \ - \ - if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ - { \ - CREATEFACTORY_ONEINSTANCE ( CLASS ) \ - } - -//****************************************************************************************************************************** -#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \ - \ - if ( CLASS::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \ - { \ - CREATEFACTORY_SINGLE ( CLASS ) \ - } - -//______________________________________________________________________________________________________________ -// declare functions to create a new instance of service -//______________________________________________________________________________________________________________ - -//============================================================================= -// Add new macro line to use new services. -// -// !!! ATTENTION !!! -// Write no ";" at end of line! (see macro) -//============================================================================= -CREATEINSTANCE ( FrameControl ) -CREATEINSTANCE ( ProgressBar ) -CREATEINSTANCE ( ProgressMonitor ) -CREATEINSTANCE ( StatusIndicator ) -//============================================================================= - -//______________________________________________________________________________________________________________ -// create right component factory -//______________________________________________________________________________________________________________ - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , - void* pServiceManager , - void* /*pRegistryKey*/ ) -{ - // Set default return value for this operation - if it failed. - void* pReturn = NULL ; - - if ( - ( pImplementationName != NULL ) && - ( pServiceManager != NULL ) - ) - { - // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory ; - Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - - //============================================================================= - // Add new macro line to handle new service. - // - // !!! ATTENTION !!! - // Write no ";" at end of line and dont forget "else" ! (see macro) - //============================================================================= - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( FrameControl ) - else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressBar ) - else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressMonitor ) - else - IF_NAME_CREATECOMPONENTFACTORY_SINGLE( StatusIndicator ) - //============================================================================= - - // Factory is valid - service was found. - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - // Return with result of this operation. - return pReturn ; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx deleted file mode 100644 index 470254f32..000000000 --- a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//______________________________________________________________________________________________________________ -// my own include -//______________________________________________________________________________________________________________ - -#include "OConnectionPointContainerHelper.hxx" - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// include of my own project -//______________________________________________________________________________________________________________ -#include "OConnectionPointHelper.hxx" - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::cppu ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; - -namespace unocontrols{ - -//______________________________________________________________________________________________________________ -// construct/destruct -//______________________________________________________________________________________________________________ - -OConnectionPointContainerHelper::OConnectionPointContainerHelper( Mutex& aMutex ) - : m_aSharedMutex ( aMutex ) - , m_aMultiTypeContainer ( aMutex ) -{ -} - -OConnectionPointContainerHelper::~OConnectionPointContainerHelper() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XConnectionPointContainer* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = OWeakObject::queryInterface( aType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointContainerHelper::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointContainerHelper::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::release(); -} - -//______________________________________________________________________________________________________________ -// XConnectionPointContainer -//______________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL OConnectionPointContainerHelper::getConnectionPointTypes() throw( RuntimeException ) -{ - // Container is threadsafe himself ! - return m_aMultiTypeContainer.getContainedTypes(); -} - -//______________________________________________________________________________________________________________ -// XConnectionPointContainer -//______________________________________________________________________________________________________________ - -Reference< XConnectionPoint > SAL_CALL OConnectionPointContainerHelper::queryConnectionPoint( const Type& aType ) throw( RuntimeException ) -{ - // Set default return value, if method failed. - Reference< XConnectionPoint > xConnectionPoint = Reference< XConnectionPoint >(); - - // Get all elements of the container, which have the searched type. - OInterfaceContainerHelper* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType ); - if ( pSpecialContainer && pSpecialContainer->getLength() > 0 ) - { - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - // If this container contains elements, build a connectionpoint-instance. - OConnectionPointHelper* pNewConnectionPoint = new OConnectionPointHelper( m_aSharedMutex, this, aType ); - xConnectionPoint = Reference< XConnectionPoint >( (OWeakObject*)pNewConnectionPoint, UNO_QUERY ); - } - - return xConnectionPoint ; -} - -//______________________________________________________________________________________________________________ -// XConnectionPointContainer -//______________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointContainerHelper::advise( const Type& aType , - const Reference< XInterface >& xListener ) throw( RuntimeException ) -{ - // Container is threadsafe himself ! - m_aMultiTypeContainer.addInterface( aType, xListener ); -} - -//______________________________________________________________________________________________________________ -// XConnectionPointContainer -//______________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointContainerHelper::unadvise( const Type& aType , - const Reference< XInterface >& xListener ) throw( RuntimeException ) -{ - // Container is threadsafe himself ! - m_aMultiTypeContainer.removeInterface( aType, xListener ); -} - -//______________________________________________________________________________________________________________ -// public but impl method! -// Is neccessary to get container member at OConnectionPoint-instance. -//______________________________________________________________________________________________________________ - -OMultiTypeInterfaceContainerHelper& OConnectionPointContainerHelper::impl_getMultiTypeContainer() -{ - // Impl methods are not threadsafe! - // "Parent" function must do this. - return m_aMultiTypeContainer; -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx deleted file mode 100644 index a9f0e606d..000000000 --- a/UnoControls/source/controls/OConnectionPointHelper.cxx +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//______________________________________________________________________________________________________________ -// my own include -//______________________________________________________________________________________________________________ - -#include "OConnectionPointHelper.hxx" - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// include of my own project -//______________________________________________________________________________________________________________ -#include "OConnectionPointContainerHelper.hxx" - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::cppu ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; - -namespace unocontrols{ - -//______________________________________________________________________________________________________________ -// construct/destruct -//______________________________________________________________________________________________________________ - -OConnectionPointHelper::OConnectionPointHelper( - Mutex& aMutex , - OConnectionPointContainerHelper* pContainerImplementation , - Type aType -) : m_aSharedMutex ( aMutex ) - , m_oContainerWeakReference ( pContainerImplementation ) - , m_pContainerImplementation ( pContainerImplementation ) - , m_aInterfaceType ( aType ) -{ -} - -OConnectionPointHelper::~OConnectionPointHelper() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XConnectionPoint* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = OWeakObject::queryInterface( aType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointHelper::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointHelper::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::release(); -} - -//______________________________________________________________________________________________________________ -// XConnectionPoint -//______________________________________________________________________________________________________________ - -Type SAL_CALL OConnectionPointHelper::getConnectionType() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - - // Set default return value, if method failed. - if ( impl_LockContainer() == sal_False ) - { - // Container not exist! Its an runtime error. - throw RuntimeException(); - } - - // If container reference valid, return right type of supported interfaces of THIS connectionpoint. - Type aReturnType = m_aInterfaceType ; - // Don't forget this! - impl_UnlockContainer(); - - return aReturnType; -} - -//______________________________________________________________________________________________________________ -// XConnectionPoint -//______________________________________________________________________________________________________________ - -Reference< XConnectionPointContainer > SAL_CALL OConnectionPointHelper::getConnectionPointContainer() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - // Convert weakreference to correct uno3-reference and return value. It can be NULL, if container destroyed! - return Reference< XConnectionPointContainer >( m_oContainerWeakReference.get(), UNO_QUERY ); -} - -//______________________________________________________________________________________________________________ -// XConnectionPoint -//______________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointHelper::advise( const Reference< XInterface >& xListener ) throw( ListenerExistException , - InvalidListenerException , - RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - - // If type of listener not the same for this special container ... - Any aCheckType = xListener->queryInterface( m_aInterfaceType ); - if ( aCheckType.hasValue() ) - { - // ... throw an exception. - throw InvalidListenerException(); - } - - // ListenerExistException is obsolete!? - // Its the same container for XConnectionPointContainer and XConnectionPoint. But only here we must control, if a listener already exist!? - // You can add a listener more then one time at XConnectionPointContainer, but here only one ... - - // Operation is permitted only, if reference to container is valid! - if ( impl_LockContainer() == sal_False ) - { - // Container not exist! Its an runtime error. - throw RuntimeException(); - } - // Forward it to OConnectionPointHelperContainer! - m_pContainerImplementation->advise( m_aInterfaceType, xListener ); - // Don't forget this! - impl_UnlockContainer(); -} - -//______________________________________________________________________________________________________________ -// XConnectionPoint -//______________________________________________________________________________________________________________ - -void SAL_CALL OConnectionPointHelper::unadvise( const Reference< XInterface >& xListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - // Operation is permitted only, if reference to container is valid! - if ( impl_LockContainer() == sal_False ) - { - // Container not exist! Its an runtime error. - throw RuntimeException(); - - } - // Forward it to OConnectionPointHelperContainer! - m_pContainerImplementation->unadvise( m_aInterfaceType, xListener ); - // Don't forget this! - impl_UnlockContainer(); -} - -//______________________________________________________________________________________________________________ -// XConnectionPoint -//______________________________________________________________________________________________________________ - -Sequence< Reference< XInterface > > SAL_CALL OConnectionPointHelper::getConnections() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aSharedMutex ); - // Operation is permitted only, if reference to container is valid! - if ( impl_LockContainer() == sal_False ) - { - // Container not exist! Its an runtime error. - throw RuntimeException(); - } - // Set default return value, if method failed. - Sequence< Reference< XInterface > > seqReturnConnections = Sequence< Reference< XInterface > >(); - // Get reference to private member of OConnectionPointHelperContainer! - OMultiTypeInterfaceContainerHelper& aSharedContainer = m_pContainerImplementation->impl_getMultiTypeContainer(); - // Get pointer to specialized container which hold all interfaces of searched type. - OInterfaceContainerHelper* pSpecialContainer = aSharedContainer.getContainer( m_aInterfaceType ); - // Get elements of searched type, if somelse exist. - if ( pSpecialContainer != NULL ) - { - seqReturnConnections = pSpecialContainer->getElements(); - } - // Don't forget this! - impl_UnlockContainer(); - - return seqReturnConnections; -} - -//______________________________________________________________________________________________________________ -// private method -//______________________________________________________________________________________________________________ - -sal_Bool OConnectionPointHelper::impl_LockContainer() -{ - // Convert weakreference to hard uno3-reference and return state. - // If this reference different from NULL, there exist a hard reference to container. Container-instance can't be destroyed. - // Don't forget to "unlock" this reference! - m_xLock = m_oContainerWeakReference.get(); - return m_xLock.is(); -} - -//______________________________________________________________________________________________________________ -// private method -//______________________________________________________________________________________________________________ - -void OConnectionPointHelper::impl_UnlockContainer() -{ - // Free hard uno3-reference to container. - // see also "impl_LockContainer()" - m_xLock = Reference< XInterface >(); -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx deleted file mode 100644 index e581988bb..000000000 --- a/UnoControls/source/controls/framecontrol.cxx +++ /dev/null @@ -1,606 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -//______________________________________________________________________________________________________________ -// my own include -//______________________________________________________________________________________________________________ - -#include "framecontrol.hxx" - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ -#include -#include -#include -#include -#include -#include -#include - -//______________________________________________________________________________________________________________ -// include of my own project -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::cppu ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::beans ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::frame ; -using namespace ::com::sun::star::util ; - -namespace unocontrols{ - -//______________________________________________________________________________________________________________ -// construct/destruct -//______________________________________________________________________________________________________________ - -FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory ) - : BaseControl ( xFactory ) - , OBroadcastHelper ( m_aMutex ) - , OPropertySetHelper ( *SAL_STATIC_CAST( OBroadcastHelper *, this ) ) - , m_aInterfaceContainer ( m_aMutex ) - , m_aConnectionPointContainer ( m_aMutex ) -{ -} - -FrameControl::~FrameControl() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL FrameControl::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn ; - Reference< XInterface > xDel = BaseControl::impl_getDelegator(); - if ( xDel.is() ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::release(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL FrameControl::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) , - ::getCppuType(( const Reference< XControlContainer >*)NULL ) , - ::getCppuType(( const Reference< XConnectionPointContainer >*)NULL ) , - BaseControl::getTypes() - ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL FrameControl::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XControlModel* > ( this ) , - static_cast< XConnectionPointContainer* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = OPropertySetHelper::queryInterface( aType ); - if ( aReturn.hasValue() == sal_False ) - { - aReturn = BaseControl::queryAggregation( aType ); - } - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::createPeer( const Reference< XToolkit >& xToolkit , - const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException ) -{ - BaseControl::createPeer( xToolkit, xParentPeer ); - if ( impl_getPeerWindow().is() ) - { - if( m_sComponentURL.getLength() > 0 ) - { - impl_createFrame( getPeer(), m_sComponentURL, m_seqLoaderArguments ); - } - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL FrameControl::setModel( const Reference< XControlModel >& /*xModel*/ ) throw( RuntimeException ) -{ - // We have no model. - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XControlModel > SAL_CALL FrameControl::getModel() throw( RuntimeException ) -{ - // We have no model. - return Reference< XControlModel >(); -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::dispose() throw( RuntimeException ) -{ - impl_deleteFrame(); - BaseControl::dispose(); -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL FrameControl::setGraphics( const Reference< XGraphics >& /*xDevice*/ ) throw( RuntimeException ) -{ - // it is not possible to print this control - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XView -//____________________________________________________________________________________________________________ - -Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeException ) -{ - // when its not posible to set graphics ! then its possible to return null - return Reference< XGraphics >(); -} - -//____________________________________________________________________________________________________________ -// XConnectionPointContainer -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException ) -{ - // Forwarded to helper class - return m_aConnectionPointContainer.getConnectionPointTypes(); -} - -//____________________________________________________________________________________________________________ -// XConnectionPointContainer -//____________________________________________________________________________________________________________ - -Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException ) -{ - // Forwarded to helper class - return m_aConnectionPointContainer.queryConnectionPoint( aType ); -} - -//____________________________________________________________________________________________________________ -// XConnectionPointContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::advise( const Type& aType , - const Reference< XInterface >& xListener ) throw( RuntimeException ) -{ - // Forwarded to helper class - m_aConnectionPointContainer.advise( aType, xListener ); -} - -//____________________________________________________________________________________________________________ -// XConnectionPointContainer -//____________________________________________________________________________________________________________ - -void SAL_CALL FrameControl::unadvise( const Type& aType , - const Reference< XInterface >& xListener ) throw( RuntimeException ) -{ - // Forwarded to helper class - m_aConnectionPointContainer.unadvise( aType, xListener ); -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames() -{ - MutexGuard aGuard( Mutex::getGlobalMutex() ); - Sequence< OUString > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_FRAMECONTROL )); - return seqServiceNames ; -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const OUString FrameControl::impl_getStaticImplementationName() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_FRAMECONTROL )); -} - -//____________________________________________________________________________________________________________ -// OPropertySetHelper -//____________________________________________________________________________________________________________ - -sal_Bool FrameControl::convertFastPropertyValue( Any& rConvertedValue , - Any& rOldValue , - sal_Int32 nHandle , - const Any& rValue ) throw( IllegalArgumentException ) -{ - sal_Bool bReturn = sal_False ; - switch (nHandle) - { - case PROPERTYHANDLE_COMPONENTURL : rConvertedValue = rValue ; - rOldValue <<= m_sComponentURL ; - bReturn = sal_True ; - break ; - - case PROPERTYHANDLE_LOADERARGUMENTS : rConvertedValue = rValue ; - rOldValue <<= m_seqLoaderArguments ; - bReturn = sal_True ; - break ; - } - - if ( bReturn == sal_False ) - { - throw IllegalArgumentException(); - } - - return bReturn ; -} - -//____________________________________________________________________________________________________________ -// OPropertySetHelper -//____________________________________________________________________________________________________________ - -void FrameControl::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , - const Any& rValue ) - throw ( ::com::sun::star::uno::Exception ) -{ - // this method only set the value - MutexGuard aGuard (m_aMutex) ; - switch (nHandle) - { - case PROPERTYHANDLE_COMPONENTURL : rValue >>= m_sComponentURL ; - if (getPeer().is()) - { - impl_createFrame ( getPeer(), m_sComponentURL, m_seqLoaderArguments ) ; - } - break ; - - case PROPERTYHANDLE_LOADERARGUMENTS : rValue >>= m_seqLoaderArguments ; - break ; - - default : OSL_ENSURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ; - } -} - -//____________________________________________________________________________________________________________ -// OPropertySetHelper -//____________________________________________________________________________________________________________ - -void FrameControl::getFastPropertyValue( Any& rRet , - sal_Int32 nHandle ) const -{ - MutexGuard aGuard ( Mutex::getGlobalMutex() ) ; - - switch (nHandle) - { - case PROPERTYHANDLE_COMPONENTURL : rRet <<= m_sComponentURL ; - break ; - - case PROPERTYHANDLE_LOADERARGUMENTS : rRet <<= m_seqLoaderArguments ; - break ; - - case PROPERTYHANDLE_FRAME : rRet <<= m_xFrame ; - break ; - - default : OSL_ENSURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ; - } -} - -//____________________________________________________________________________________________________________ -// OPropertySetHelper -//____________________________________________________________________________________________________________ - -IPropertyArrayHelper& FrameControl::getInfoHelper() -{ - // Create a table that map names to index values. - static OPropertyArrayHelper* pInfo ; - - if (!pInfo) - { - // global method must be guarded - MutexGuard aGuard ( Mutex::getGlobalMutex() ) ; - - if (!pInfo) - { - pInfo = new OPropertyArrayHelper( impl_getStaticPropertyDescriptor(), sal_True ); - } - } - - return *pInfo ; -} -/* -//-------------------------------------------------------------------------------------------------- -// start OConnectionPointContainerHelper -//-------------------------------------------------------------------------------------------------- -Uik* FrameControl::getConnectionPointUiks ( sal_Int32* pCount ) const -{ - static Uik szUiks[] = - { - ((XEventListener*)NULL)->getSmartUik (), - ::getCppuType((const Reference< XPropertyChangeListener >*)0), - ::getCppuType((const Reference< XVetoableChangeListener >*)0), - ::getCppuType((const Reference< XPropertiesChangeListener >*)0) - } ; - - *pCount = 4 ; - - return szUiks ; -} -//-------------------------------------------------------------------------------------------------- -// end OConnectionPointContainerHelper -//-------------------------------------------------------------------------------------------------- -*/ - -//____________________________________________________________________________________________________________ -// OPropertySetHelper -//____________________________________________________________________________________________________________ - -Reference< XPropertySetInfo > SAL_CALL FrameControl::getPropertySetInfo() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pInfo is NULL - for the second call pInfo is different from NULL! - static Reference< XPropertySetInfo >* pInfo = (Reference< XPropertySetInfo >*)0 ; - if ( pInfo == (Reference< XPropertySetInfo >*)0 ) - { - // Ready for multithreading - MutexGuard aGuard ( Mutex::getGlobalMutex () ) ; - // Control this pointer again, another instance can be faster then these! - if ( pInfo == (Reference< XPropertySetInfo >*)0 ) - { - // Create structure of propertysetinfo for baseclass "OPropertySetHelper". - // (Use method "getInfoHelper()".) - static Reference< XPropertySetInfo > xInfo ( createPropertySetInfo ( getInfoHelper () ) ) ; - pInfo = &xInfo ; - } - } - return ( *pInfo ) ; -} - -//____________________________________________________________________________________________________________ -// BaseControl -//____________________________________________________________________________________________________________ - -WindowDescriptor* FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer ) -{ - WindowDescriptor* pDescriptor = new WindowDescriptor ; - - pDescriptor->Type = WindowClass_CONTAINER ; - pDescriptor->ParentIndex = -1 ; - pDescriptor->Parent = xParentPeer ; - pDescriptor->Bounds = getPosSize () ; - pDescriptor->WindowAttributes = 0 ; - - return pDescriptor ; -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPeer , - const OUString& rURL , - const Sequence< PropertyValue >& rArguments ) -{ - Reference< XFrame > xOldFrame ; - Reference< XFrame > xNewFrame ; - - { - MutexGuard aGuard ( m_aMutex ) ; - xOldFrame = m_xFrame ; - } - - xNewFrame = Reference< XFrame > ( impl_getMultiServiceFactory()->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")) ), UNO_QUERY ) ; - Reference< XDispatchProvider > xDSP ( xNewFrame, UNO_QUERY ) ; - - if (xDSP.is()) - { - Reference< XWindow > xWP ( xPeer, UNO_QUERY ) ; - xNewFrame->initialize ( xWP ) ; - - // option - //xFrame->setName( "WhatYouWant" ); - - Reference< XURLTransformer > xTrans ( impl_getMultiServiceFactory()->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer")) ), UNO_QUERY ) ; - if(xTrans.is()) - { - // load file - URL aURL ; - - aURL.Complete = rURL ; - xTrans->parseStrict( aURL ) ; - - Reference< XDispatch > xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ; - if (xDisp.is()) - { - xDisp->dispatch ( aURL, rArguments ) ; - } - } - } - - // set the frame - { - MutexGuard aGuard ( m_aMutex ) ; - m_xFrame = xNewFrame ; - } - - // notify the listeners - sal_Int32 nFrameId = PROPERTYHANDLE_FRAME ; - Any aNewFrame ( &xNewFrame, ::getCppuType((const Reference< XFrame >*)0) ) ; - Any aOldFrame ( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) ) ; - - fire ( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False ) ; - - if (xOldFrame.is()) - { - xOldFrame->dispose () ; - } -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void FrameControl::impl_deleteFrame() -{ - Reference< XFrame > xOldFrame; - Reference< XFrame > xNullFrame; - - { - // do not dispose the frame in this guarded section (deadlock?) - MutexGuard aGuard( m_aMutex ); - xOldFrame = m_xFrame; - m_xFrame = Reference< XFrame > (); - } - - // notify the listeners - sal_Int32 nFrameId = PROPERTYHANDLE_FRAME; - Any aNewFrame( &xNullFrame, ::getCppuType((const Reference< XFrame >*)0) ); - Any aOldFrame( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) ); - fire( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False ); - - // dispose the frame - if( xOldFrame.is() ) - xOldFrame->dispose(); -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -const Sequence< Property > FrameControl::impl_getStaticPropertyDescriptor() -{ - // All Properties of this implementation. The array must be sorted! - static const Property pPropertys[PROPERTY_COUNT] = - { - Property( OUString(RTL_CONSTASCII_USTRINGPARAM( PROPERTYNAME_COMPONENTURL )), PROPERTYHANDLE_COMPONENTURL , ::getCppuType((const OUString*)0) , PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ), - Property( OUString(RTL_CONSTASCII_USTRINGPARAM( PROPERTYNAME_FRAME )), PROPERTYHANDLE_FRAME , ::getCppuType((const Reference< XFrame >*)0) , PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ), - Property( OUString(RTL_CONSTASCII_USTRINGPARAM( PROPERTYNAME_LOADERARGUMENTS )), PROPERTYHANDLE_LOADERARGUMENTS , ::getCppuType((const Sequence< PropertyValue >*)0), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ) - }; - - static const Sequence< Property > seqPropertys( pPropertys, PROPERTY_COUNT ); - - return seqPropertys ; -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/makefile.mk b/UnoControls/source/controls/makefile.mk deleted file mode 100644 index 20314ea8e..000000000 --- a/UnoControls/source/controls/makefile.mk +++ /dev/null @@ -1,49 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=UnoControls -TARGET=controls -ENABLE_EXCEPTIONS=TRUE -.IF "$(L10N_framework)"=="" - -# --- Settings ----------------------------------------------------- -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- -SLOFILES=\ - $(SLO)$/progressbar.obj \ - $(SLO)$/framecontrol.obj \ - $(SLO)$/progressmonitor.obj \ - $(SLO)$/OConnectionPointHelper.obj \ - $(SLO)$/OConnectionPointContainerHelper.obj \ - $(SLO)$/statusindicator.obj - -# --- Targets ------------------------------------------------------ -.ENDIF # L10N_framework - -.INCLUDE : target.mk diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx deleted file mode 100644 index fe2043693..000000000 --- a/UnoControls/source/controls/progressbar.cxx +++ /dev/null @@ -1,494 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//____________________________________________________________________________________________________________ -// my own includes -//____________________________________________________________________________________________________________ - -#include "progressbar.hxx" - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ -#include -#include -#include -#include -#include -#include - -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my project -//____________________________________________________________________________________________________________ - -//____________________________________________________________________________________________________________ -// namespace -//____________________________________________________________________________________________________________ - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::rtl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::awt ; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory ) - : BaseControl ( xFactory ) - , m_bHorizontal ( PROGRESSBAR_DEFAULT_HORIZONTAL ) - , m_aBlockSize ( PROGRESSBAR_DEFAULT_BLOCKDIMENSION ) - , m_nForegroundColor ( PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR ) - , m_nBackgroundColor ( PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR ) - , m_nMinRange ( PROGRESSBAR_DEFAULT_MINRANGE ) - , m_nMaxRange ( PROGRESSBAR_DEFAULT_MAXRANGE ) - , m_nBlockValue ( PROGRESSBAR_DEFAULT_BLOCKVALUE ) - , m_nValue ( PROGRESSBAR_DEFAULT_VALUE ) -{ -} - -ProgressBar::~ProgressBar() -{ -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL ProgressBar::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn ; - Reference< XInterface > xDel = BaseControl::impl_getDelegator(); - if ( xDel.is() ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::release(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL ProgressBar::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*) NULL ) , - ::getCppuType(( const Reference< XProgressBar >*) NULL ) , - BaseControl::getTypes() - ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL ProgressBar::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XControlModel* > ( this ) , - static_cast< XProgressBar* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = BaseControl::queryAggregation( aType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - // Safe color for later use. - m_nForegroundColor = nColor ; - - // Repaint control - impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - // Safe color for later use. - m_nBackgroundColor = nColor ; - - // Repaint control - impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::setValue ( sal_Int32 nValue ) throw( RuntimeException ) -{ - // This method is defined for follow things: - // 1) Values >= _nMinRange - // 2) Values <= _nMaxRange - - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - // save impossible cases - // This method is only defined for valid values - DBG_ASSERT ( (( nValue >= m_nMinRange ) && ( nValue <= m_nMaxRange )), "ProgressBar::setValue()\nNot valid value.\n" ) ; - - // If new value not valid ... do nothing in release version! - if ( - ( nValue >= m_nMinRange ) && - ( nValue <= m_nMaxRange ) - ) - { - // New value is ok => save this - m_nValue = nValue ; - - // Repaint to display changes - impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException ) -{ - // This method is defined for follow things: - // 1) All values of sal_Int32 - // 2) Min < Max - // 3) Min > Max - - // save impossible cases - // This method is only defined for valid values - // If you ignore this, the release version wil produce an error "division by zero" in "ProgressBar::setValue()"! - DBG_ASSERT ( ( nMin != nMax ) , "ProgressBar::setRange()\nValues for MIN and MAX are the same. This is not allowed!\n" ) ; - - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - // control the values for min and max - if ( nMin < nMax ) - { - // Take correct Min and Max - m_nMinRange = nMin ; - m_nMaxRange = nMax ; - } - else - { - // Change Min and Max automaticly - m_nMinRange = nMax ; - m_nMaxRange = nMin ; - } - - // assure that m_nValue is within the range - if (!(m_nMinRange < m_nValue && m_nValue < m_nMaxRange)) - m_nValue = m_nMinRange; - - impl_recalcRange () ; - - // Do not repaint the control at this place!!! - // An old "m_nValue" is set and can not be correct for this new range. - // Next call of "ProgressBar::setValue()" do this. -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -sal_Int32 SAL_CALL ProgressBar::getValue () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard (m_aMutex) ; - - return ( m_nValue ) ; -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressBar::setPosSize ( - sal_Int32 nX, - sal_Int32 nY, - sal_Int32 nWidth, - sal_Int32 nHeight, - sal_Int16 nFlags -) throw( RuntimeException ) -{ - // Take old size BEFORE you set the new values at baseclass! - // You will control changes. At the other way, the values are the same! - Rectangle aBasePosSize = getPosSize () ; - BaseControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; - - // Do only, if size has changed. - if ( - ( nWidth != aBasePosSize.Width ) || - ( nHeight != aBasePosSize.Height ) - ) - { - impl_recalcRange ( ) ; - impl_paint ( 0, 0, impl_getGraphicsPeer () ) ; - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL ProgressBar::setModel( const Reference< XControlModel >& /*xModel*/ ) throw( RuntimeException ) -{ - // A model is not possible for this control. - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XControlModel > SAL_CALL ProgressBar::getModel() throw( RuntimeException ) -{ - // A model is not possible for this control. - return Reference< XControlModel >(); -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const Sequence< OUString > ProgressBar::impl_getStaticSupportedServiceNames() -{ - MutexGuard aGuard( Mutex::getGlobalMutex() ); - Sequence< OUString > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_PROGRESSBAR )); - return seqServiceNames ; -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const OUString ProgressBar::impl_getStaticImplementationName() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_PROGRESSBAR )); -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) -{ - // save impossible cases - DBG_ASSERT ( rGraphics.is(), "ProgressBar::paint()\nCalled with invalid Reference< XGraphics > ." ) ; - - // This paint method ist not buffered !! - // Every request paint the completely control. ( but only, if peer exist ) - if ( rGraphics.is () ) - { - MutexGuard aGuard (m_aMutex) ; - - // Clear background - // (same color for line and fill) - rGraphics->setFillColor ( m_nBackgroundColor ) ; - rGraphics->setLineColor ( m_nBackgroundColor ) ; - rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ) ; - - // same color for line and fill for blocks - rGraphics->setFillColor ( m_nForegroundColor ) ; - rGraphics->setLineColor ( m_nForegroundColor ) ; - - sal_Int32 nBlockStart = 0 ; // = left site of new block - sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? (sal_Int32)((m_nValue-m_nMinRange)/m_nBlockValue) : 0 ; // = number of next block - - // Draw horizontal progressbar - // decision in "recalcRange()" - if (m_bHorizontal) - { - // Step to left side of window - nBlockStart = nX ; - - for ( sal_Int16 i=1; i<=nBlockCount; ++i ) - { - // step free field - nBlockStart += PROGRESSBAR_FREESPACE ; - // paint block - rGraphics->drawRect (nBlockStart, nY+PROGRESSBAR_FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ; - // step next free field - nBlockStart += m_aBlockSize.Width ; - } - } - // draw vertikal progressbar - // decision in "recalcRange()" - else - { - // step to bottom side of window - nBlockStart = nY+impl_getHeight() ; - nBlockStart -= m_aBlockSize.Height ; - - for ( sal_Int16 i=1; i<=nBlockCount; ++i ) - { - // step free field - nBlockStart -= PROGRESSBAR_FREESPACE ; - // paint block - rGraphics->drawRect (nX+PROGRESSBAR_FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ; - // step next free field - nBlockStart -= m_aBlockSize.Height; - } - } - - // Paint shadow border around the progressbar - rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_SHADOW ) ; - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; - - rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_BRIGHT ) ; - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; - } -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void ProgressBar::impl_recalcRange () -{ - MutexGuard aGuard (m_aMutex) ; - - sal_Int32 nWindowWidth = impl_getWidth() ; - sal_Int32 nWindowHeight = impl_getHeight() ; - double fBlockHeight ; - double fBlockWidth ; - double fMaxBlocks ; - - if( nWindowWidth > nWindowHeight ) - { - m_bHorizontal = sal_True ; - fBlockHeight = (nWindowHeight-(2*PROGRESSBAR_FREESPACE)) ; - fBlockWidth = fBlockHeight ; - fMaxBlocks = nWindowWidth/(fBlockWidth+PROGRESSBAR_FREESPACE); - } - else - { - m_bHorizontal = sal_False ; - fBlockWidth = (nWindowWidth-(2*PROGRESSBAR_FREESPACE)) ; - fBlockHeight = fBlockWidth ; - fMaxBlocks = nWindowHeight/(fBlockHeight+PROGRESSBAR_FREESPACE); - } - - double fRange = m_nMaxRange-m_nMinRange ; - double fBlockValue = fRange/fMaxBlocks ; - - m_nBlockValue = fBlockValue ; - m_aBlockSize.Height = (sal_Int32)fBlockHeight; - m_aBlockSize.Width = (sal_Int32)fBlockWidth ; -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx deleted file mode 100644 index 9aab0b87b..000000000 --- a/UnoControls/source/controls/progressmonitor.cxx +++ /dev/null @@ -1,1070 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//____________________________________________________________________________________________________________ -// my own includes -//____________________________________________________________________________________________________________ - -#include "progressmonitor.hxx" - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ -#include -#include -#include -#include -#include -#include -#include -#include -#include -//____________________________________________________________________________________________________________ -// includes of my project -//____________________________________________________________________________________________________________ -#include "progressbar.hxx" - -//____________________________________________________________________________________________________________ -// namespace -//____________________________________________________________________________________________________________ - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::rtl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::awt ; - -using ::std::vector; -using ::std::find; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory ) - : BaseContainerControl ( xFactory ) -{ - // Its not allowed to work with member in this method (refcounter !!!) - // But with a HACK (++refcount) its "OK" :-( - ++m_refCount ; - - // Create instances for fixedtext, button and progress ... - m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_SERVICENAME )) ), UNO_QUERY ) ; - m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_SERVICENAME )) ), UNO_QUERY ) ; - m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_SERVICENAME )) ), UNO_QUERY ) ; - m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_SERVICENAME )) ), UNO_QUERY ) ; - m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( BUTTON_SERVICENAME )) ), UNO_QUERY ) ; - m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_PROGRESSBAR )) ), UNO_QUERY ) ; - - // ... cast controls to Reference< XControl > (for "setModel"!) ... - Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; - Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; - Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; - Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; - Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; - Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; - - // ... set models ... - xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_MODELNAME )) ), UNO_QUERY ) ) ; - xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_MODELNAME )) ), UNO_QUERY ) ) ; - xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_MODELNAME )) ), UNO_QUERY ) ) ; - xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_MODELNAME )) ), UNO_QUERY ) ) ; - xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString(RTL_CONSTASCII_USTRINGPARAM( BUTTON_MODELNAME )) ), UNO_QUERY ) ) ; - // ProgressBar has no model !!! - - // ... and add controls to basecontainercontrol! - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_TEXT )) , xRef_Topic_Top ) ; - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_TEXT )) , xRef_Text_Top ) ; - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_TEXT )) , xRef_Topic_Bottom ) ; - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_TEXT )) , xRef_Text_Bottom ) ; - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_BUTTON )) , xRef_Button ) ; - addControl ( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_PROGRESSBAR )) , xRef_ProgressBar ) ; - - // FixedText make it automaticly visible by himself ... but not the progressbar !!! - // it must be set explicitly - Reference< XWindow > xWindowRef_ProgressBar( m_xProgressBar, UNO_QUERY ); - xWindowRef_ProgressBar->setVisible( sal_True ); - - // Reset to defaults !!! - // (progressbar take automaticly its own defaults) - m_xButton->setLabel ( OUString(RTL_CONSTASCII_USTRINGPARAM( DEFAULT_BUTTONLABEL )) ) ; - m_xTopic_Top->setText ( OUString(RTL_CONSTASCII_USTRINGPARAM( PROGRESSMONITOR_DEFAULT_TOPIC )) ) ; - m_xText_Top->setText ( OUString(RTL_CONSTASCII_USTRINGPARAM( PROGRESSMONITOR_DEFAULT_TEXT )) ) ; - m_xTopic_Bottom->setText ( OUString(RTL_CONSTASCII_USTRINGPARAM( PROGRESSMONITOR_DEFAULT_TOPIC )) ) ; - m_xText_Bottom->setText ( OUString(RTL_CONSTASCII_USTRINGPARAM( PROGRESSMONITOR_DEFAULT_TEXT )) ) ; - - --m_refCount ; -} - -ProgressMonitor::~ProgressMonitor() -{ - impl_cleanMemory () ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn ; - Reference< XInterface > xDel = BaseContainerControl::impl_getDelegator(); - if ( xDel.is() ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::release(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL ProgressMonitor::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , - ::getCppuType(( const Reference< XButton >*)NULL ) , - ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) , - BaseContainerControl::getTypes() - ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XLayoutConstrains* > ( this ) , - static_cast< XButton* > ( this ) , - static_cast< XProgressMonitor* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = BaseControl::queryAggregation( aType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XProgressMonitor -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::addText( - const OUString& rTopic, - const OUString& rText, - sal_Bool bbeforeProgress -) throw( RuntimeException ) -{ - // Safe impossible cases - // Check valid call of this method. - DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ) , "ProgressMonitor::addText()\nCall without valid parameters!\n") ; - DBG_ASSERT ( !(impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) , "ProgresMonitor::addText()\nThe text already exist.\n" ) ; - - // Do nothing (in Release), if topic already exist. - if ( impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) - { - return ; - } - - // Else ... take memory for new item ... - IMPL_TextlistItem* pTextItem = new IMPL_TextlistItem ; - - if ( pTextItem != NULL ) - { - // Set values ... - pTextItem->sTopic = rTopic ; - pTextItem->sText = rText ; - - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // ... and insert it in right list. - if ( bbeforeProgress == sal_True ) - { - maTextlist_Top.push_back( pTextItem ); - } - else - { - maTextlist_Bottom.push_back( pTextItem ); - } - } - - // ... update window - impl_rebuildFixedText () ; - impl_recalcLayout () ; -} - -//____________________________________________________________________________________________________________ -// XProgressMonitor -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbeforeProgress ) throw( RuntimeException ) -{ - // Safe impossible cases - // Check valid call of this method. - DBG_ASSERT ( impl_debug_checkParameter ( rTopic, bbeforeProgress ), "ProgressMonitor::removeText()\nCall without valid parameters!\n" ) ; - - // Search the topic ... - IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; - - if ( pSearchItem != NULL ) - { - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // ... delete item from right list ... - if ( bbeforeProgress == sal_True ) - { - vector< IMPL_TextlistItem* >::iterator - itr = find( maTextlist_Top.begin(), maTextlist_Top.end(), pSearchItem ); - if (itr != maTextlist_Top.end()) - maTextlist_Top.erase(itr); - } - else - { - vector< IMPL_TextlistItem* >::iterator - itr = find( maTextlist_Bottom.begin(), maTextlist_Bottom.end(), pSearchItem ); - if (itr != maTextlist_Bottom.end()) - maTextlist_Bottom.erase(itr); - } - - delete pSearchItem ; - - // ... and update window. - impl_rebuildFixedText () ; - impl_recalcLayout () ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressMonitor -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::updateText ( - const OUString& rTopic, - const OUString& rText, - sal_Bool bbeforeProgress -) throw( RuntimeException ) -{ - // Safe impossible cases - // Check valid call of this method. - DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ), "ProgressMonitor::updateText()\nCall without valid parameters!\n" ) ; - - // Search topic ... - IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; - - if ( pSearchItem != NULL ) - { - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // ... update text ... - pSearchItem->sText = rText ; - - // ... and update window. - impl_rebuildFixedText () ; - impl_recalcLayout () ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setForegroundColor ( sal_Int32 nColor ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xProgressBar.is () ) - { - m_xProgressBar->setForegroundColor ( nColor ) ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xProgressBar.is () ) - { - m_xProgressBar->setBackgroundColor ( nColor ) ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setValue ( sal_Int32 nValue ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xProgressBar.is () ) - { - m_xProgressBar->setValue ( nValue ) ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xProgressBar.is () ) - { - m_xProgressBar->setRange ( nMin, nMax ) ; - } -} - -//____________________________________________________________________________________________________________ -// XProgressBar -//____________________________________________________________________________________________________________ - -sal_Int32 SAL_CALL ProgressMonitor::getValue () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if (m_xProgressBar.is()) - { - return m_xProgressBar->getValue () ; - } - - return 0 ; -} - -//____________________________________________________________________________________________________________ -// XButton -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::addActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xButton.is () ) - { - m_xButton->addActionListener ( rListener ) ; - } -} - -//____________________________________________________________________________________________________________ -// XButton -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::removeActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xButton.is () ) - { - m_xButton->removeActionListener ( rListener ) ; - } -} - -//____________________________________________________________________________________________________________ -// XButton -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setLabel ( const OUString& rLabel ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xButton.is () ) - { - m_xButton->setLabel ( rLabel ) ; - } -} - -//____________________________________________________________________________________________________________ -// XButton -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - if ( m_xButton.is () ) - { - m_xButton->setActionCommand ( rCommand ) ; - } -} - -//____________________________________________________________________________________________________________ -// XLayoutConstrains -//____________________________________________________________________________________________________________ - -Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException ) -{ - return Size (PROGRESSMONITOR_DEFAULT_WIDTH, PROGRESSMONITOR_DEFAULT_HEIGHT) ; -} - -//____________________________________________________________________________________________________________ -// XLayoutConstrains -//____________________________________________________________________________________________________________ - -Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException ) -{ - // Ready for multithreading - ClearableMutexGuard aGuard ( m_aMutex ) ; - - // get information about required place of child controls - Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; - Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; - Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; - Reference< XWindow > xProgressBarWindow ( m_xProgressBar , UNO_QUERY ) ; - - Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize (); - Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize (); - Size aButtonSize = xButtonLayout->getPreferredSize (); - Rectangle aTempRectangle = xProgressBarWindow->getPosSize (); - Size aProgressBarSize = Size( aTempRectangle.Width, aTempRectangle.Height ); - - aGuard.clear () ; - - // calc preferred size of progressmonitor - sal_Int32 nWidth = 0 ; - sal_Int32 nHeight = 0 ; - - nWidth = 3 * PROGRESSMONITOR_FREEBORDER ; - nWidth += aProgressBarSize.Width ; - - nHeight = 6 * PROGRESSMONITOR_FREEBORDER ; - nHeight += aTopicSize_Top.Height ; - nHeight += aProgressBarSize.Height ; - nHeight += aTopicSize_Bottom.Height; - nHeight += 2 ; // 1 for black line, 1 for white line = 3D-Line! - nHeight += aButtonSize.Height ; - - // norm to minimum - if ( nWidth < PROGRESSMONITOR_DEFAULT_WIDTH ) - { - nWidth = PROGRESSMONITOR_DEFAULT_WIDTH ; - } - if ( nHeight < PROGRESSMONITOR_DEFAULT_HEIGHT ) - { - nHeight = PROGRESSMONITOR_DEFAULT_HEIGHT ; - } - - // return to caller - return Size ( nWidth, nHeight ) ; -} - -//____________________________________________________________________________________________________________ -// XLayoutConstrains -//____________________________________________________________________________________________________________ - -Size SAL_CALL ProgressMonitor::calcAdjustedSize ( const Size& /*rNewSize*/ ) throw( RuntimeException ) -{ - return getPreferredSize () ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent ) throw( RuntimeException ) -{ - if (!getPeer().is()) - { - BaseContainerControl::createPeer ( rToolkit, rParent ) ; - - // If user forget to call "setPosSize()", we have still a correct size. - // And a "MinimumSize" IS A "MinimumSize"! - // We change not the position of control at this point. - Size aDefaultSize = getMinimumSize () ; - setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ; - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL ProgressMonitor::setModel ( const Reference< XControlModel > & /*rModel*/ ) throw( RuntimeException ) -{ - // We have no model. - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XControlModel > SAL_CALL ProgressMonitor::getModel () throw( RuntimeException ) -{ - // We have no model. - // return (XControlModel*)this ; - return Reference< XControlModel > () ; -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::dispose () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // "removeControl()" control the state of a reference - Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; - Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; - Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; - Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; - Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; - Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; - - removeControl ( xRef_Topic_Top ) ; - removeControl ( xRef_Text_Top ) ; - removeControl ( xRef_Topic_Bottom ) ; - removeControl ( xRef_Text_Bottom ) ; - removeControl ( xRef_Button ) ; - removeControl ( xRef_ProgressBar ) ; - - // do'nt use "...->clear ()" or "... = XFixedText ()" - // when other hold a reference at this object !!! - xRef_Topic_Top->dispose () ; - xRef_Text_Top->dispose () ; - xRef_Topic_Bottom->dispose () ; - xRef_Text_Bottom->dispose () ; - xRef_Button->dispose () ; - xRef_ProgressBar->dispose () ; - - BaseContainerControl::dispose () ; -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) -{ - Rectangle aBasePosSize = getPosSize () ; - BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; - - // if position or size changed - if ( - ( nWidth != aBasePosSize.Width ) || - ( nHeight != aBasePosSize.Height) - ) - { - // calc new layout for controls - impl_recalcLayout () ; - // clear background (!) - // [Childs was repainted in "recalcLayout" by setPosSize() automaticly!] - getPeer()->invalidate(2); - // and repaint the control - impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; - } -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const Sequence< OUString > ProgressMonitor::impl_getStaticSupportedServiceNames() -{ - MutexGuard aGuard( Mutex::getGlobalMutex() ); - Sequence< OUString > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_PROGRESSMONITOR )); - return seqServiceNames ; -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const OUString ProgressMonitor::impl_getStaticImplementationName() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_PROGRESSMONITOR )); -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) -{ - if (rGraphics.is()) - { - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // paint shadowed border around the progressmonitor - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; - - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; - - // Paint 3D-line - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; - rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; - - rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; - rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; - } -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void ProgressMonitor::impl_recalcLayout () -{ - sal_Int32 nX_Button ; - sal_Int32 nY_Button ; - sal_Int32 nWidth_Button ; - sal_Int32 nHeight_Button ; - - sal_Int32 nX_ProgressBar ; - sal_Int32 nY_ProgressBar ; - sal_Int32 nWidth_ProgressBar ; - sal_Int32 nHeight_ProgressBar ; - - sal_Int32 nX_Text_Top ; - sal_Int32 nY_Text_Top ; - sal_Int32 nWidth_Text_Top ; - sal_Int32 nHeight_Text_Top ; - - sal_Int32 nX_Topic_Top ; - sal_Int32 nY_Topic_Top ; - sal_Int32 nWidth_Topic_Top ; - sal_Int32 nHeight_Topic_Top ; - - sal_Int32 nX_Text_Bottom ; - sal_Int32 nY_Text_Bottom ; - sal_Int32 nWidth_Text_Bottom ; - sal_Int32 nHeight_Text_Bottom ; - - sal_Int32 nX_Topic_Bottom ; - sal_Int32 nY_Topic_Bottom ; - sal_Int32 nWidth_Topic_Bottom ; - sal_Int32 nHeight_Topic_Bottom ; - - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // get information about required place of child controls - Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; - Reference< XLayoutConstrains > xTextLayout_Top ( m_xText_Top , UNO_QUERY ) ; - Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; - Reference< XLayoutConstrains > xTextLayout_Bottom ( m_xText_Bottom , UNO_QUERY ) ; - Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; - - Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize () ; - Size aTextSize_Top = xTextLayout_Top->getPreferredSize () ; - Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize () ; - Size aTextSize_Bottom = xTextLayout_Bottom->getPreferredSize () ; - Size aButtonSize = xButtonLayout->getPreferredSize () ; - - // calc position and size of child controls - // Button has preferred size! - nWidth_Button = aButtonSize.Width ; - nHeight_Button = aButtonSize.Height ; - - // Left column before progressbar has preferred size and fixed position. - // But "Width" is oriented on left column below progressbar to!!! "max(...)" - nX_Topic_Top = PROGRESSMONITOR_FREEBORDER ; - nY_Topic_Top = PROGRESSMONITOR_FREEBORDER ; - nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ; - nHeight_Topic_Top = aTopicSize_Top.Height ; - - // Right column before progressbar has relativ position to left column ... - // ... and a size as rest of dialog size! - nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+PROGRESSMONITOR_FREEBORDER; - nY_Text_Top = nY_Topic_Top ; - nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ; - // Fix size of this column to minimum! - sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*PROGRESSMONITOR_FREEBORDER) ; - if ( nSummaryWidth < PROGRESSMONITOR_DEFAULT_WIDTH ) - nWidth_Text_Top = PROGRESSMONITOR_DEFAULT_WIDTH-nWidth_Topic_Top-(3*PROGRESSMONITOR_FREEBORDER); - // Fix size of column to maximum! - if ( nSummaryWidth > impl_getWidth() ) - nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*PROGRESSMONITOR_FREEBORDER) ; - nHeight_Text_Top = nHeight_Topic_Top ; - - // Position of progressbar is relativ to columns before. - // Progressbar.Width = Dialog.Width !!! - // Progressbar.Height = Button.Height - nX_ProgressBar = nX_Topic_Top ; - nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+PROGRESSMONITOR_FREEBORDER ; - nWidth_ProgressBar = PROGRESSMONITOR_FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ; - nHeight_ProgressBar = nHeight_Button ; - - // Oriented by left column before progressbar. - nX_Topic_Bottom = nX_Topic_Top ; - nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+PROGRESSMONITOR_FREEBORDER ; - nWidth_Topic_Bottom = nWidth_Topic_Top ; - nHeight_Topic_Bottom = aTopicSize_Bottom.Height ; - - // Oriented by right column before progressbar. - nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+PROGRESSMONITOR_FREEBORDER ; - nY_Text_Bottom = nY_Topic_Bottom ; - nWidth_Text_Bottom = nWidth_Text_Top ; - nHeight_Text_Bottom = nHeight_Topic_Bottom ; - - // Oriented by progressbar. - nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button ; - nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+PROGRESSMONITOR_FREEBORDER ; - - // Calc offsets to center controls - sal_Int32 nDx ; - sal_Int32 nDy ; - - nDx = ( (2*PROGRESSMONITOR_FREEBORDER)+nWidth_ProgressBar ) ; - nDy = ( (6*PROGRESSMONITOR_FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ; - - // At this point use original dialog size to center controls! - nDx = (impl_getWidth ()/2)-(nDx/2) ; - nDy = (impl_getHeight()/2)-(nDy/2) ; - - if ( nDx<0 ) - { - nDx=0 ; - } - if ( nDy<0 ) - { - nDy=0 ; - } - - // Set new position and size on all controls - Reference< XWindow > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; - Reference< XWindow > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; - Reference< XWindow > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; - Reference< XWindow > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; - Reference< XWindow > xRef_Button ( m_xButton , UNO_QUERY ) ; - Reference< XWindow > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; - - xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ; - xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ; - xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ; - xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ; - xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ; - xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ; - - m_a3DLine.X = nDx+nX_Topic_Top ; - m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(PROGRESSMONITOR_FREEBORDER/2) ; - m_a3DLine.Width = nWidth_ProgressBar ; - m_a3DLine.Height = nHeight_ProgressBar ; - - // All childcontrols make an implicit repaint in setPosSize()! - // Make it also for this 3D-line ... - Reference< XGraphics > xGraphics = impl_getGraphicsPeer () ; - - xGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; - xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; - - xGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; - xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void ProgressMonitor::impl_rebuildFixedText () -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // Rebuild fixedtext before progress - - // Rebuild left site of text - if (m_xTopic_Top.is()) - { - OUString aCollectString ; - - // Collect all topics from list and format text. - // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! - for ( size_t n = 0; n < maTextlist_Top.size(); ++n ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Top[ n ]; - aCollectString += pSearchItem->sTopic ; - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\n")) ; - } - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\0")) ; // It's better :-) - - m_xTopic_Top->setText ( aCollectString ) ; - } - - // Rebuild right site of text - if (m_xText_Top.is()) - { - OUString aCollectString ; - - // Collect all topics from list and format text. - // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! - for ( size_t n = 0; n < maTextlist_Top.size(); ++n ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Top[ n ]; - aCollectString += pSearchItem->sText ; - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\n")) ; - } - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\0")) ; // It's better :-) - - m_xText_Top->setText ( aCollectString ) ; - } - - // Rebuild fixedtext below progress - - // Rebuild left site of text - if (m_xTopic_Bottom.is()) - { - OUString aCollectString ; - - // Collect all topics from list and format text. - // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! - for ( size_t n = 0; n < maTextlist_Bottom.size(); ++n ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Bottom[ n ]; - aCollectString += pSearchItem->sTopic ; - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\n")) ; - } - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\0")) ; // It's better :-) - - m_xTopic_Bottom->setText ( aCollectString ) ; - } - - // Rebuild right site of text - if (m_xText_Bottom.is()) - { - OUString aCollectString ; - - // Collect all topics from list and format text. - // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! - for ( size_t n = 0; n < maTextlist_Bottom.size(); ++n ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Bottom[ n ]; - aCollectString += pSearchItem->sText ; - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\n")) ; - } - aCollectString += OUString(RTL_CONSTASCII_USTRINGPARAM("\0")) ; // It's better :-) - - m_xText_Bottom->setText ( aCollectString ) ; - } -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -void ProgressMonitor::impl_cleanMemory () -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // Delete all of lists. - - for ( size_t nPosition = 0; nPosition < maTextlist_Top.size() ; ++nPosition ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Top[ nPosition ]; - delete pSearchItem ; - } - maTextlist_Top.clear(); - - for ( size_t nPosition = 0; nPosition < maTextlist_Bottom.size() ; ++nPosition ) - { - IMPL_TextlistItem* pSearchItem = maTextlist_Bottom[ nPosition ]; - delete pSearchItem ; - } - maTextlist_Bottom.clear(); -} - -//____________________________________________________________________________________________________________ -// private method -//____________________________________________________________________________________________________________ - -IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, sal_Bool bbeforeProgress ) -{ - // Get right textlist for following operations. - ::std::vector< IMPL_TextlistItem* >* pTextList ; - - // Ready for multithreading - ClearableMutexGuard aGuard ( m_aMutex ) ; - - if ( bbeforeProgress == sal_True ) - { - pTextList = &maTextlist_Top ; - } - else - { - pTextList = &maTextlist_Bottom ; - } - - // Switch off guard. - aGuard.clear () ; - - // Search the topic in textlist. - size_t nPosition = 0; - size_t nCount = pTextList->size(); - - for ( nPosition = 0; nPosition < nCount ; ++nPosition ) - { - IMPL_TextlistItem* pSearchItem = pTextList->at( nPosition ); - - if ( pSearchItem->sTopic == rTopic ) - { - // We have found this topic ... return a valid pointer. - return pSearchItem ; - } - } - - // We have'nt found this topic ... return a nonvalid pointer. - return NULL ; -} - -//____________________________________________________________________________________________________________ -// debug methods -//____________________________________________________________________________________________________________ - -#ifdef DBG_UTIL - -// addText, updateText -sal_Bool ProgressMonitor::impl_debug_checkParameter ( - const OUString& rTopic, - const OUString& rText, - sal_Bool /*bbeforeProgress*/ -) { - // Check "rTopic" - if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! - if ( rTopic.getLength () < 1 ) return sal_False ; // "" - - // Check "rText" - if ( &rText == NULL ) return sal_False ; // NULL-pointer for reference ???!!! - if ( rText.getLength () < 1 ) return sal_False ; // "" - - // "bbeforeProgress" is valid in everyway! - - // Parameter OK ... return sal_True. - return sal_True ; -} - -// removeText -sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, sal_Bool /*bbeforeProgress*/ ) -{ - // Check "rTopic" - if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! - if ( rTopic.getLength () < 1 ) return sal_False ; // "" - - // "bbeforeProgress" is valid in everyway! - - // Parameter OK ... return sal_True. - return sal_True ; -} - -#endif // #ifdef DBG_UTIL - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx deleted file mode 100644 index 9d8b6e365..000000000 --- a/UnoControls/source/controls/statusindicator.cxx +++ /dev/null @@ -1,562 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//____________________________________________________________________________________________________________ -// my own includes -//____________________________________________________________________________________________________________ - -#include "statusindicator.hxx" - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ -#include -#include -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my project -//____________________________________________________________________________________________________________ -#include "progressbar.hxx" - -//____________________________________________________________________________________________________________ -// namespace -//____________________________________________________________________________________________________________ - -using namespace ::cppu ; -using namespace ::osl ; -using namespace ::rtl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::awt ; -using namespace ::com::sun::star::task ; - -namespace unocontrols{ - -//____________________________________________________________________________________________________________ -// construct/destruct -//____________________________________________________________________________________________________________ - -StatusIndicator::StatusIndicator( const Reference< XMultiServiceFactory >& xFactory ) - : BaseContainerControl ( xFactory ) -{ - // Its not allowed to work with member in this method (refcounter !!!) - // But with a HACK (++refcount) its "OK" :-( - ++m_refCount ; - - // Create instances for fixedtext and progress ... - m_xText = Reference< XFixedText > ( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_SERVICENAME )) ), UNO_QUERY ); - m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_PROGRESSBAR )) ), UNO_QUERY ); - // ... cast controls to Reference< XControl > and set model ... - // ( ProgressBar has no model !!! ) - Reference< XControl > xTextControl ( m_xText , UNO_QUERY ); - Reference< XControl > xProgressControl ( m_xProgressBar, UNO_QUERY ); - xTextControl->setModel( Reference< XControlModel >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( FIXEDTEXT_MODELNAME )) ), UNO_QUERY ) ); - // ... and add controls to basecontainercontrol! - addControl( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_TEXT )), xTextControl ); - addControl( OUString(RTL_CONSTASCII_USTRINGPARAM( CONTROLNAME_PROGRESSBAR )), xProgressControl ); - // FixedText make it automaticly visible by himself ... but not the progressbar !!! - // it must be set explicitly - Reference< XWindow > xProgressWindow( m_xProgressBar, UNO_QUERY ); - xProgressWindow->setVisible( sal_True ); - // Reset to defaults !!! - // (progressbar take automaticly its own defaults) - m_xText->setText( OUString(RTL_CONSTASCII_USTRINGPARAM( STATUSINDICATOR_DEFAULT_TEXT )) ); - - --m_refCount ; -} - -StatusIndicator::~StatusIndicator() -{ - // Release all references - m_xText = Reference< XFixedText >(); - m_xProgressBar = Reference< XProgressBar >(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -Any SAL_CALL StatusIndicator::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn ; - Reference< XInterface > xDel = BaseContainerControl::impl_getDelegator(); - if ( xDel.is() ) - { - // If an delegator exist, forward question to his queryInterface. - // Delegator will ask his own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else - { - // If an delegator unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::acquire(); -} - -//____________________________________________________________________________________________________________ -// XInterface -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - BaseControl::release(); -} - -//____________________________________________________________________________________________________________ -// XTypeProvider -//____________________________________________________________________________________________________________ - -Sequence< Type > SAL_CALL StatusIndicator::getTypes() throw( RuntimeException ) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTypeCollection* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MutexGuard aGuard( Mutex::getGlobalMutex() ); - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , - ::getCppuType(( const Reference< XStatusIndicator >*)NULL ) , - BaseContainerControl::getTypes() - ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } - - return pTypeCollection->getTypes(); -} - -//____________________________________________________________________________________________________________ -// XAggregation -//____________________________________________________________________________________________________________ - -Any SAL_CALL StatusIndicator::queryAggregation( const Type& aType ) throw( RuntimeException ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XLayoutConstrains* > ( this ) , - static_cast< XStatusIndicator* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( aReturn.hasValue() == sal_False ) - { - // ... ask baseclasses. - aReturn = BaseControl::queryAggregation( aType ); - } - - return aReturn ; -} - -//____________________________________________________________________________________________________________ -// XStatusIndicator -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::start( const OUString& sText, sal_Int32 nRange ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Initialize status controls with given values. - m_xText->setText( sText ); - m_xProgressBar->setRange( 0, nRange ); - // force repaint ... fixedtext has changed ! - impl_recalcLayout ( WindowEvent(static_cast< OWeakObject* >(this),0,0,impl_getWidth(),impl_getHeight(),0,0,0,0) ) ; -} - -//____________________________________________________________________________________________________________ -// XStatusIndicator -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::end() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Clear values of status controls. - m_xText->setText( OUString() ); - m_xProgressBar->setValue( 0 ); - setVisible( sal_False ); -} - -//____________________________________________________________________________________________________________ -// XStatusIndicator -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::setText( const OUString& sText ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Take text on right control - m_xText->setText( sText ); -} - -//____________________________________________________________________________________________________________ -// XStatusIndicator -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::setValue( sal_Int32 nValue ) throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Take value on right control - m_xProgressBar->setValue( nValue ); -} - -//____________________________________________________________________________________________________________ -// XStatusIndicator -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::reset() throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard( m_aMutex ); - - // Clear values of status controls. - // (Don't hide the window! User will reset current values ... but he will not finish using of indicator!) - m_xText->setText( OUString() ); - m_xProgressBar->setValue( 0 ); -} - -//____________________________________________________________________________________________________________ -// XLayoutConstrains -//____________________________________________________________________________________________________________ - -Size SAL_CALL StatusIndicator::getMinimumSize () throw( RuntimeException ) -{ - return Size (STATUSINDICATOR_DEFAULT_WIDTH, STATUSINDICATOR_DEFAULT_HEIGHT) ; -} - -//____________________________________________________________________________________________________________ -// XLayoutConstrains -//____________________________________________________________________________________________________________ - -Size SAL_CALL StatusIndicator::getPreferredSize () throw( RuntimeException ) -{ - // Ready for multithreading - ClearableMutexGuard aGuard ( m_aMutex ) ; - - // get information about required place of child controls - Reference< XLayoutConstrains > xTextLayout ( m_xText, UNO_QUERY ); - Size aTextSize = xTextLayout->getPreferredSize(); - - aGuard.clear () ; - - // calc preferred size of status indicator - sal_Int32 nWidth = impl_getWidth() ; - sal_Int32 nHeight = (2*STATUSINDICATOR_FREEBORDER)+aTextSize.Height ; - - // norm to minimum - if ( nWidth & rToolkit, - const Reference< XWindowPeer > & rParent -) throw( RuntimeException ) -{ - if( getPeer().is() == sal_False ) - { - BaseContainerControl::createPeer( rToolkit, rParent ); - - // If user forget to call "setPosSize()", we have still a correct size. - // And a "MinimumSize" IS A "MinimumSize"! - // We change not the position of control at this point. - Size aDefaultSize = getMinimumSize () ; - setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ; - } -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -sal_Bool SAL_CALL StatusIndicator::setModel ( const Reference< XControlModel > & /*rModel*/ ) throw( RuntimeException ) -{ - // We have no model. - return sal_False ; -} - -//____________________________________________________________________________________________________________ -// XControl -//____________________________________________________________________________________________________________ - -Reference< XControlModel > SAL_CALL StatusIndicator::getModel () throw( RuntimeException ) -{ - // We have no model. - // return (XControlModel*)this ; - return Reference< XControlModel > () ; -} - -//____________________________________________________________________________________________________________ -// XComponent -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::dispose () throw( RuntimeException ) -{ - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // "removeControl()" control the state of a reference - Reference< XControl > xTextControl ( m_xText , UNO_QUERY ); - Reference< XControl > xProgressControl ( m_xProgressBar, UNO_QUERY ); - - removeControl( xTextControl ); - removeControl( xProgressControl ); - - // do'nt use "...->clear ()" or "... = XFixedText ()" - // when other hold a reference at this object !!! - xTextControl->dispose(); - xProgressControl->dispose(); - BaseContainerControl::dispose(); -} - -//____________________________________________________________________________________________________________ -// XWindow -//____________________________________________________________________________________________________________ - -void SAL_CALL StatusIndicator::setPosSize ( - sal_Int32 nX, - sal_Int32 nY, - sal_Int32 nWidth, - sal_Int32 nHeight, - sal_Int16 nFlags -) throw( RuntimeException ) -{ - Rectangle aBasePosSize = getPosSize () ; - BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; - - // if position or size changed - if ( - ( nWidth != aBasePosSize.Width ) || - ( nHeight != aBasePosSize.Height) - ) - { - // calc new layout for controls - impl_recalcLayout ( WindowEvent(static_cast< OWeakObject* >(this),0,0,nWidth,nHeight,0,0,0,0) ) ; - // clear background (!) - // [Childs was repainted in "recalcLayout" by setPosSize() automaticly!] - getPeer()->invalidate(2); - // and repaint the control - impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; - } -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const Sequence< OUString > StatusIndicator::impl_getStaticSupportedServiceNames() -{ - MutexGuard aGuard( Mutex::getGlobalMutex() ); - Sequence< OUString > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = OUString(RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_STATUSINDICATOR )); - return seqServiceNames ; -} - -//____________________________________________________________________________________________________________ -// impl but public method to register service -//____________________________________________________________________________________________________________ - -const OUString StatusIndicator::impl_getStaticImplementationName() -{ - return OUString(RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATIONNAME_STATUSINDICATOR )); -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -WindowDescriptor* StatusIndicator::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer ) -{ - // - used from "createPeer()" to set the values of an ::com::sun::star::awt::WindowDescriptor !!! - // - if you will change the descriptor-values, you must override this virtuell function - // - the caller must release the memory for this dynamical descriptor !!! - - WindowDescriptor* pDescriptor = new WindowDescriptor ; - - pDescriptor->Type = WindowClass_SIMPLE ; - pDescriptor->WindowServiceName = OUString(RTL_CONSTASCII_USTRINGPARAM("floatingwindow")) ; - pDescriptor->ParentIndex = -1 ; - pDescriptor->Parent = xParentPeer ; - pDescriptor->Bounds = getPosSize () ; - - return pDescriptor ; -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void StatusIndicator::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) -{ - // This paint method ist not buffered !! - // Every request paint the completely control. ( but only, if peer exist ) - if ( rGraphics.is () ) - { - MutexGuard aGuard (m_aMutex) ; - - // background = gray - Reference< XWindowPeer > xPeer( impl_getPeerWindow(), UNO_QUERY ); - if( xPeer.is() == sal_True ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // FixedText background = gray - Reference< XControl > xTextControl( m_xText, UNO_QUERY ); - xPeer = xTextControl->getPeer(); - if( xPeer.is() == sal_True ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // Progress background = gray - xPeer = Reference< XWindowPeer >( m_xProgressBar, UNO_QUERY ); - if( xPeer.is() == sal_True ) - xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); - - // paint shadow border - rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_BRIGHT ); - rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); - rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); - - rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_SHADOW ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); - rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); - } -} - -//____________________________________________________________________________________________________________ -// protected method -//____________________________________________________________________________________________________________ - -void StatusIndicator::impl_recalcLayout ( const WindowEvent& aEvent ) -{ - sal_Int32 nX_ProgressBar ; - sal_Int32 nY_ProgressBar ; - sal_Int32 nWidth_ProgressBar ; - sal_Int32 nHeight_ProgressBar ; - sal_Int32 nX_Text ; - sal_Int32 nY_Text ; - sal_Int32 nWidth_Text ; - sal_Int32 nHeight_Text ; - - // Ready for multithreading - MutexGuard aGuard ( m_aMutex ) ; - - // get information about required place of child controls - Size aWindowSize ( aEvent.Width, aEvent.Height ); - Reference< XLayoutConstrains > xTextLayout ( m_xText, UNO_QUERY ); - Size aTextSize = xTextLayout->getPreferredSize(); - - if( aWindowSize.Width < STATUSINDICATOR_DEFAULT_WIDTH ) - { - aWindowSize.Width = STATUSINDICATOR_DEFAULT_WIDTH; - } - if( aWindowSize.Height < STATUSINDICATOR_DEFAULT_HEIGHT ) - { - aWindowSize.Height = STATUSINDICATOR_DEFAULT_HEIGHT; - } - - // calc position and size of child controls - nX_Text = STATUSINDICATOR_FREEBORDER ; - nY_Text = STATUSINDICATOR_FREEBORDER ; - nWidth_Text = aTextSize.Width ; - nHeight_Text = aTextSize.Height ; - - nX_ProgressBar = nX_Text+nWidth_Text+STATUSINDICATOR_FREEBORDER ; - nY_ProgressBar = nY_Text ; - nWidth_ProgressBar = aWindowSize.Width-nWidth_Text-(3*STATUSINDICATOR_FREEBORDER) ; - nHeight_ProgressBar = nHeight_Text ; - - // Set new position and size on all controls - Reference< XWindow > xTextWindow ( m_xText , UNO_QUERY ); - Reference< XWindow > xProgressWindow ( m_xProgressBar, UNO_QUERY ); - - xTextWindow->setPosSize ( nX_Text , nY_Text , nWidth_Text , nHeight_Text , 15 ) ; - xProgressWindow->setPosSize ( nX_ProgressBar, nY_ProgressBar, nWidth_ProgressBar, nHeight_ProgressBar , 15 ) ; -} - -} // namespace unocontrols - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx deleted file mode 100644 index 511755ded..000000000 --- a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX -#define _OCONNECTIONPOINTCONTAINERHELPER_HXX - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -#include -#include -#include -#include - -//______________________________________________________________________________________________________________ -// includes of my own project -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_LANG ::com::sun::star::lang - -//______________________________________________________________________________________________________________ -// defines -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// class declaration OConnectionPointContainerHelper -//______________________________________________________________________________________________________________ - -class OConnectionPointContainerHelper : public CSS_LANG::XConnectionPointContainer - , public ::cppu::OWeakObject -{ - -//______________________________________________________________________________________________________________ -// public methods -//______________________________________________________________________________________________________________ - -public: - - //__________________________________________________________________________________________________________ - // construct/destruct - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - OConnectionPointContainerHelper( ::osl::Mutex& aMutex ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~OConnectionPointContainerHelper(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //__________________________________________________________________________________________________________ - // XConnectionPointContainer - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getConnectionPointTypes() - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_LANG::XConnectionPoint > SAL_CALL queryConnectionPoint( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL advise( - const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL unadvise( - const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - ::cppu::OMultiTypeInterfaceContainerHelper& impl_getMultiTypeContainer(); - -//______________________________________________________________________________________________________________ -// private variables -//______________________________________________________________________________________________________________ - -private: - - ::osl::Mutex& m_aSharedMutex ; - ::cppu::OMultiTypeInterfaceContainerHelper m_aMultiTypeContainer ; // Container to hold listener - -}; // class OConnectionPointContainerHelper - -// The namespace aliases are only used in this header -#undef CSS_UNO -#undef CSS_LANG - -} // namespace unocontrols - -#endif // #ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/OConnectionPointHelper.hxx b/UnoControls/source/inc/OConnectionPointHelper.hxx deleted file mode 100644 index 0f6194d90..000000000 --- a/UnoControls/source/inc/OConnectionPointHelper.hxx +++ /dev/null @@ -1,309 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OCONNECTIONPOINTHELPER_HXX -#define _OCONNECTIONPOINTHELPER_HXX - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -#include -#include -#include -#include - -//______________________________________________________________________________________________________________ -// includes of my own project -//______________________________________________________________________________________________________________ -#include "OConnectionPointContainerHelper.hxx" - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_LANG ::com::sun::star::lang - -//______________________________________________________________________________________________________________ -// defines -//______________________________________________________________________________________________________________ - -//______________________________________________________________________________________________________________ -// class declaration OConnectionPointHelper -//______________________________________________________________________________________________________________ - -class OConnectionPointHelper : public CSS_LANG::XConnectionPoint - , public ::cppu::OWeakObject -{ - -//______________________________________________________________________________________________________________ -// public methods -//______________________________________________________________________________________________________________ - -public: - - //__________________________________________________________________________________________________________ - // construct/destruct - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - OConnectionPointHelper( ::osl::Mutex& aMutex , - OConnectionPointContainerHelper* pContainerImplementation , - CSS_UNO::Type aType ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~OConnectionPointHelper(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //__________________________________________________________________________________________________________ - // XConnectionPoint - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Type SAL_CALL getConnectionType() - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_LANG::XConnectionPointContainer > SAL_CALL getConnectionPointContainer() - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL advise( - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener - ) throw ( - CSS_LANG::ListenerExistException, - CSS_LANG::InvalidListenerException , - CSS_UNO::RuntimeException - ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL unadvise( const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener ) - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Reference< CSS_UNO::XInterface > > SAL_CALL getConnections() - throw( CSS_UNO::RuntimeException ); - -//______________________________________________________________________________________________________________ -// private methods -//______________________________________________________________________________________________________________ - -private: - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - sal_Bool impl_LockContainer(); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_UnlockContainer(); - -//______________________________________________________________________________________________________________ -// private variables -//______________________________________________________________________________________________________________ - -private: - - ::osl::Mutex& m_aSharedMutex ; - CSS_UNO::WeakReference< CSS_LANG::XConnectionPointContainer > m_oContainerWeakReference ; // Reference to container-class!. Don't use Reference<...> - // It is a ring-reference => and must be a wekreference! - OConnectionPointContainerHelper* m_pContainerImplementation ; - CSS_UNO::Type m_aInterfaceType ; - CSS_UNO::Reference< CSS_UNO::XInterface > m_xLock ; - -}; // class OConnectionPointHelper - -// The namespace aliases are only used in this header -#undef CSS_UNO -#undef CSS_LANG - -} // namespace unocontrols - -#endif // #ifndef _OCONNECTIONPOINTHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx deleted file mode 100644 index 33263dfcb..000000000 --- a/UnoControls/source/inc/framecontrol.hxx +++ /dev/null @@ -1,641 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX -#define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX - -//______________________________________________________________________________________________________________ -// includes of other projects -//______________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//______________________________________________________________________________________________________________ -// includes of my own project -//______________________________________________________________________________________________________________ -#include "basecontrol.hxx" -#include "OConnectionPointContainerHelper.hxx" - -//______________________________________________________________________________________________________________ -// namespaces -//______________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_LANG ::com::sun::star::lang -#define CSS_BEANS ::com::sun::star::beans -#define CSS_AWT ::com::sun::star::awt -#define CSS_FRAME ::com::sun::star::frame - -//______________________________________________________________________________________________________________ -// defines -//______________________________________________________________________________________________________________ - -#define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl" -#define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl" -#define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments" -#define PROPERTYNAME_COMPONENTURL "ComponentURL" -#define PROPERTYNAME_FRAME "Frame" -#define ERRORTEXT_VOSENSHURE "This is an invalid property handle." -#define PROPERTY_COUNT 3 // you must count the propertys -#define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array -#define PROPERTYHANDLE_FRAME 1 -#define PROPERTYHANDLE_LOADERARGUMENTS 2 - -//______________________________________________________________________________________________________________ -// class -//______________________________________________________________________________________________________________ - -class FrameControl : public CSS_AWT::XControlModel - , public CSS_LANG::XConnectionPointContainer - , public BaseControl // This order is neccessary for right initialization of m_aMutex! - , public ::cppu::OBroadcastHelper - , public ::cppu::OPropertySetHelper -{ - -//______________________________________________________________________________________________________________ -// public methods -//______________________________________________________________________________________________________________ - -public: - - //__________________________________________________________________________________________________________ - // construct/destruct - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - FrameControl( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~FrameControl(); - - //__________________________________________________________________________________________________________ - // XInterface - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //__________________________________________________________________________________________________________ - // XTypeProvider - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XAggregation - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - CSS_UNO::Any SAL_CALL queryAggregation( - const CSS_UNO::Type& aType - ) throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XControl - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL createPeer( - const CSS_UNO::Reference< CSS_AWT::XToolkit >& xToolkit , - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParent - ) throw ( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual sal_Bool SAL_CALL setModel( - const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XComponent - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL dispose() throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XView - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual sal_Bool SAL_CALL setGraphics( - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xDevice - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_AWT::XGraphics > SAL_CALL getGraphics() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XConnectionPointContainer - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getConnectionPointTypes() - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_LANG::XConnectionPoint > SAL_CALL queryConnectionPoint( - const CSS_UNO::Type& aType - ) throw ( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL advise( - const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL unadvise( - const CSS_UNO::Type& aType , - const CSS_UNO::Reference< CSS_UNO::XInterface >& xListener - ) throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // impl but public methods to register service! - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - static const CSS_UNO::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - static const ::rtl::OUString impl_getStaticImplementationName(); - -//______________________________________________________________________________________________________________ -// protected methods -//______________________________________________________________________________________________________________ - -protected: - using OPropertySetHelper::getFastPropertyValue; - //__________________________________________________________________________________________________________ - // OPropertySetHelper - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual sal_Bool SAL_CALL convertFastPropertyValue( - CSS_UNO::Any& rConvertedValue , - CSS_UNO::Any& rOldValue , - sal_Int32 nHandle , - const CSS_UNO::Any& rValue - ) throw( CSS_LANG::IllegalArgumentException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( - sal_Int32 nHandle , - const CSS_UNO::Any& rValue - ) throw ( ::com::sun::star::uno::Exception ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL getFastPropertyValue( CSS_UNO::Any& rValue , - sal_Int32 nHandle ) const ; - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - //__________________________________________________________________________________________________________ - // XPropertySet - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - CSS_UNO::Reference< CSS_BEANS::XPropertySetInfo > SAL_CALL getPropertySetInfo() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // BaseControl - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_AWT::WindowDescriptor* impl_getWindowDescriptor( - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParentPeer - ); - -//______________________________________________________________________________________________________________ -// private methods -//______________________________________________________________________________________________________________ - -private: - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_createFrame( const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xPeer , - const ::rtl::OUString& sURL , - const CSS_UNO::Sequence< CSS_BEANS::PropertyValue >& seqArguments ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_deleteFrame(); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - static const CSS_UNO::Sequence< CSS_BEANS::Property > impl_getStaticPropertyDescriptor(); - - -//______________________________________________________________________________________________________________ -// private variables -//______________________________________________________________________________________________________________ - -private: - - CSS_UNO::Reference< CSS_FRAME::XFrame > m_xFrame ; - ::rtl::OUString m_sComponentURL ; - CSS_UNO::Sequence< CSS_BEANS::PropertyValue > m_seqLoaderArguments ; - ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer ; - OConnectionPointContainerHelper m_aConnectionPointContainer ; - -}; // class FrameControl - -// The namespace alaises are only used in the header -#undef CSS_UNO -#undef CSS_LANG -#undef CSS_BEANS -#undef CSS_AWT -#undef CSS_FRAME - -} // namespace unocontrols - -#endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx deleted file mode 100644 index 53ed3b73d..000000000 --- a/UnoControls/source/inc/progressbar.hxx +++ /dev/null @@ -1,459 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX -#define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ -#include "basecontrol.hxx" - -//____________________________________________________________________________________________________________ -// namespaces -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_LANG ::com::sun::star::lang -#define CSS_AWT ::com::sun::star::awt - -//____________________________________________________________________________________________________________ -// defines -//____________________________________________________________________________________________________________ - -#define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar" -#define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar" -#define PROGRESSBAR_FREESPACE 4 -#define PROGRESSBAR_DEFAULT_HORIZONTAL sal_True -#define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1) -#define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray -#define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue -#define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN -#define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX -#define PROGRESSBAR_DEFAULT_BLOCKVALUE 1 -#define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE -#define PROGRESSBAR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white -#define PROGRESSBAR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black - -//____________________________________________________________________________________________________________ -// classes -//____________________________________________________________________________________________________________ - -class ProgressBar : public CSS_AWT::XControlModel - , public CSS_AWT::XProgressBar - , public BaseControl -{ - -//____________________________________________________________________________________________________________ -// public methods -//____________________________________________________________________________________________________________ - -public: - - //________________________________________________________________________________________________________ - // construct/destruct - //________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - ProgressBar( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~ProgressBar(); - - //__________________________________________________________________________________________________________ - // XInterface - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //__________________________________________________________________________________________________________ - // XTypeProvider - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XAggregation - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - CSS_UNO::Any SAL_CALL queryAggregation( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XProgressBar - //________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) - throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setRange( - sal_Int32 nMin , - sal_Int32 nMax - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual sal_Int32 SAL_CALL getValue() throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XWindow - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void SAL_CALL setPosSize( - sal_Int32 nX , - sal_Int32 nY , - sal_Int32 nWidth , - sal_Int32 nHeight , - sal_Int16 nFlags - ) throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // XControl - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual sal_Bool SAL_CALL setModel( - const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel - ) throw( CSS_UNO::RuntimeException ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ); - - //__________________________________________________________________________________________________________ - // BaseControl - //__________________________________________________________________________________________________________ - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - static const CSS_UNO::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - static const ::rtl::OUString impl_getStaticImplementationName(); - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual void impl_paint( - sal_Int32 nX , - sal_Int32 nY , - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xGraphics - ); - - /**_________________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - void impl_recalcRange(); - -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - - sal_Bool m_bHorizontal ; // orientation for steps [true=horizontal/false=vertikal] - CSS_AWT::Size m_aBlockSize ; // width and height of a block [>=0,0] - sal_Int32 m_nForegroundColor ; // (alpha,r,g,b) - sal_Int32 m_nBackgroundColor ; // (alpha,r,g,b) - sal_Int32 m_nMinRange ; // lowest value = 0% [long, <_nMaxRange] - sal_Int32 m_nMaxRange ; // highest value = 100% [long, >_nMinRange] - double m_nBlockValue ; // value for one block [long, >0] - sal_Int32 m_nValue ; // value for progress [long] - -}; // class ProgressBar - -// The namespace aliases are only used in the header -#undef CSS_UNO -#undef CSS_LANG -#undef CSS_AWT - -} // namespace unocontrols - -#endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx deleted file mode 100644 index 4573ed3cc..000000000 --- a/UnoControls/source/inc/progressmonitor.hxx +++ /dev/null @@ -1,805 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX -#define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ -#include "basecontainercontrol.hxx" - -//____________________________________________________________________________________________________________ -// namespace -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_AWT ::com::sun::star::awt -#define CSS_LANG ::com::sun::star::lang - -//____________________________________________________________________________________________________________ -// defines -//____________________________________________________________________________________________________________ - -#define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor" -#define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor" -#define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls -#define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText" -#define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton" -#define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel" -#define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel" -#define CONTROLNAME_TEXT "Text" // identifier the control in container -#define CONTROLNAME_BUTTON "Button" // -||- -#define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||- -#define DEFAULT_BUTTONLABEL "Abbrechen" -#define PROGRESSMONITOR_DEFAULT_TOPIC "\0" -#define PROGRESSMONITOR_DEFAULT_TEXT "\0" -#define PROGRESSMONITOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray -#define PROGRESSMONITOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white -#define PROGRESSMONITOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black -#define PROGRESSMONITOR_DEFAULT_WIDTH 350 -#define PROGRESSMONITOR_DEFAULT_HEIGHT 100 - -//____________________________________________________________________________________________________________ -// structs, types -//____________________________________________________________________________________________________________ - -/// Item of TextList -struct IMPL_TextlistItem -{ - ::rtl::OUString sTopic ; /// Left site of textline in dialog - ::rtl::OUString sText ; /// Right site of textline in dialog -}; - -//____________________________________________________________________________________________________________ -// class declaration -//____________________________________________________________________________________________________________ - -class ProgressMonitor : public CSS_AWT::XLayoutConstrains - , public CSS_AWT::XButton - , public CSS_AWT::XProgressMonitor - , public BaseContainerControl -{ - -//____________________________________________________________________________________________________________ -// public methods -//____________________________________________________________________________________________________________ - -public: - - //________________________________________________________________________________________________________ - // construct/destruct - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - ProgressMonitor( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~ProgressMonitor(); - - //________________________________________________________________________________________________________ - // XInterface - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //________________________________________________________________________________________________________ - // XTypeProvider - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XAggregation - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Any SAL_CALL queryAggregation( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XProgressMonitor - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short add topic to dialog - @descr Add a topic with a text in right textlist (used for FixedText-member).
- ( "beforeProgress" fix the right list ). The dialog metric is recalculated. - - @seealso removeText(), updateText() - - @param sTopic Name of topic
- [sTopic != "" && sTopic != NULL] - @param sText Value of topic
- [sText != "" && sText != NULL] - @param bbeforeProgress Position of topic
- [True => before progressbar / False => below progressbar] - - @return - - - @onerror DEBUG = Assertion
- RELEASE = nothing - */ - - virtual void SAL_CALL addText( - const ::rtl::OUString& sTopic , - const ::rtl::OUString& sText , - sal_Bool bbeforeProgress - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeText( - const ::rtl::OUString& sTopic , - sal_Bool bbeforeProgress - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL updateText( - const ::rtl::OUString& sTopic , - const ::rtl::OUString& sText , - sal_Bool bbeforeProgress - ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XProgressBar - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setRange( sal_Int32 nMin , - sal_Int32 nMax ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Int32 SAL_CALL getValue() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XButton - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL addActionListener( - const CSS_UNO::Reference< CSS_AWT::XActionListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL removeActionListener( - const CSS_UNO::Reference< CSS_AWT::XActionListener >& xListener - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setLabel( const ::rtl::OUString& sLabel ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setActionCommand( const ::rtl::OUString& sCommand ) - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XLayoutConstrains - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL getMinimumSize() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL getPreferredSize() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL calcAdjustedSize( const CSS_AWT::Size& aNewSize ) - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XControl - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL createPeer( - const CSS_UNO::Reference< CSS_AWT::XToolkit >& xToolkit , - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParent - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL setModel( const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XComponent - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL dispose() throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // XWindow - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setPosSize( sal_Int32 nX , - sal_Int32 nY , - sal_Int32 nWidth , - sal_Int32 nHeight , - sal_Int16 nFlags ) throw( CSS_UNO::RuntimeException ); - - //________________________________________________________________________________________________________ - // BaseControl - //________________________________________________________________________________________________________ - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const CSS_UNO::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const ::rtl::OUString impl_getStaticImplementationName(); - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void impl_paint( sal_Int32 nX , - sal_Int32 nY , - const CSS_UNO::Reference< CSS_AWT::XGraphics >& xGraphics ); - -//____________________________________________________________________________________________________________ -// private methods -//____________________________________________________________________________________________________________ - -private: - using BaseControl::impl_recalcLayout; - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void impl_recalcLayout(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void impl_rebuildFixedText(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - void impl_cleanMemory(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - IMPL_TextlistItem* impl_searchTopic( const ::rtl::OUString& sTopic , sal_Bool bbeforeProgress ); - -//____________________________________________________________________________________________________________ -// debug methods -//____________________________________________________________________________________________________________ - -private: - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - #ifdef DBG_UTIL - - sal_Bool impl_debug_checkParameter( const ::rtl::OUString& sTopic, const ::rtl::OUString& sText, sal_Bool bbeforeProgress ); // addText, updateText - sal_Bool impl_debug_checkParameter( const ::rtl::OUString& rTopic, sal_Bool bbeforeProgress ); // removeText - - #endif -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - ::std::vector < IMPL_TextlistItem* > maTextlist_Top; // Elements before progress - CSS_UNO::Reference< CSS_AWT::XFixedText > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText") - CSS_UNO::Reference< CSS_AWT::XFixedText > m_xText_Top ; - - ::std::vector < IMPL_TextlistItem* > maTextlist_Bottom; // Elements below of progress - CSS_UNO::Reference< CSS_AWT::XFixedText > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText") - CSS_UNO::Reference< CSS_AWT::XFixedText > m_xText_Bottom ; - - CSS_UNO::Reference< CSS_AWT::XProgressBar > m_xProgressBar ; - CSS_UNO::Reference< CSS_AWT::XButton > m_xButton ; - CSS_AWT::Rectangle m_a3DLine ; - -}; // class ProgressMonitor - -// The namespaces aliases are only used the this header -#undef CSS_UNO -#undef CSS_AWT -#undef CSS_LANG - -} // namespace unocontrols - -#endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/source/inc/statusindicator.hxx b/UnoControls/source/inc/statusindicator.hxx deleted file mode 100644 index 7d357e68b..000000000 --- a/UnoControls/source/inc/statusindicator.hxx +++ /dev/null @@ -1,584 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX -#define _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX - -//____________________________________________________________________________________________________________ -// includes of other projects -//____________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//____________________________________________________________________________________________________________ -// includes of my own project -//____________________________________________________________________________________________________________ -#include "basecontainercontrol.hxx" - -//____________________________________________________________________________________________________________ -// namespace -//____________________________________________________________________________________________________________ - -namespace unocontrols{ - -#define CSS_UNO ::com::sun::star::uno -#define CSS_AWT ::com::sun::star::awt -#define CSS_LANG ::com::sun::star::lang -#define CSS_TASK ::com::sun::star::task - -//____________________________________________________________________________________________________________ -// defines -//____________________________________________________________________________________________________________ - -#define SERVICENAME_STATUSINDICATOR "com.sun.star.task.XStatusIndicator" -#define IMPLEMENTATIONNAME_STATUSINDICATOR "stardiv.UnoControls.StatusIndicator" -#define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls -#define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText" -#define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel" -#define CONTROLNAME_TEXT "Text" // identifier the control in container -#define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||- -#define STATUSINDICATOR_DEFAULT_TEXT "\0" -#define STATUSINDICATOR_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray -#define STATUSINDICATOR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white -#define STATUSINDICATOR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black -#define STATUSINDICATOR_DEFAULT_WIDTH 300 -#define STATUSINDICATOR_DEFAULT_HEIGHT 25 - -//____________________________________________________________________________________________________________ -// structs, types -//____________________________________________________________________________________________________________ - -//____________________________________________________________________________________________________________ -// class declaration -//____________________________________________________________________________________________________________ - -class StatusIndicator : public CSS_AWT::XLayoutConstrains - , public CSS_TASK::XStatusIndicator - , public BaseContainerControl -{ - - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // construct/destruct - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - StatusIndicator( const CSS_UNO::Reference< CSS_LANG::XMultiServiceFactory >& xFactory ); - - /**_______________________________________________________________________________________________________ - @short - @descr - - @seealso - - @param - - @return - - @onerror - */ - - virtual ~StatusIndicator(); - - //--------------------------------------------------------------------------------------------------------- - // XInterface - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Any SAL_CALL queryInterface( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw(); - - /**_______________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw(); - - //--------------------------------------------------------------------------------------------------------- - // XTypeProvider - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual CSS_UNO::Sequence< CSS_UNO::Type > SAL_CALL getTypes() - throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XAggregation - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Any SAL_CALL queryAggregation( const CSS_UNO::Type& aType ) - throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XStatusIndicator - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL start( - const ::rtl::OUString& sText , - sal_Int32 nRange - ) throw( CSS_UNO::RuntimeException ); - - /*-****************************************************************************************************//** - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL end() throw( CSS_UNO::RuntimeException ); - - /*-****************************************************************************************************//** - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL reset() throw( CSS_UNO::RuntimeException ); - - /*-****************************************************************************************************//** - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL setText( const ::rtl::OUString& sText ) throw( CSS_UNO::RuntimeException ); - - /*-****************************************************************************************************//** - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XLayoutConstrains - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL getMinimumSize() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL getPreferredSize() throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::Size SAL_CALL calcAdjustedSize( const CSS_AWT::Size& aNewSize ) - throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XControl - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL createPeer( - const CSS_UNO::Reference< CSS_AWT::XToolkit >& xToolkit , - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParent - ) throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual sal_Bool SAL_CALL setModel( const CSS_UNO::Reference< CSS_AWT::XControlModel >& xModel ) - throw( CSS_UNO::RuntimeException ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_UNO::Reference< CSS_AWT::XControlModel > SAL_CALL getModel() - throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XComponent - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL dispose() throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // XWindow - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void SAL_CALL setPosSize( sal_Int32 nX , - sal_Int32 nY , - sal_Int32 nWidth , - sal_Int32 nHeight , - sal_Int16 nFlags ) throw( CSS_UNO::RuntimeException ); - - //--------------------------------------------------------------------------------------------------------- - // BaseControl - //--------------------------------------------------------------------------------------------------------- - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const CSS_UNO::Sequence< ::rtl::OUString > impl_getStaticSupportedServiceNames(); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - static const ::rtl::OUString impl_getStaticImplementationName(); - -//____________________________________________________________________________________________________________ -// protected methods -//____________________________________________________________________________________________________________ - -protected: - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual CSS_AWT::WindowDescriptor* impl_getWindowDescriptor( - const CSS_UNO::Reference< CSS_AWT::XWindowPeer >& xParentPeer - ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void impl_paint ( - sal_Int32 nX, - sal_Int32 nY, - const CSS_UNO::Reference< CSS_AWT::XGraphics > & rGraphics - ); - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - - virtual void impl_recalcLayout( const CSS_AWT::WindowEvent& aEvent ); - -//____________________________________________________________________________________________________________ -// debug methods -//____________________________________________________________________________________________________________ - -private: - - /**_______________________________________________________________________________________________________ - @short - - @descr - - - @seealso - - - @param - - - @return - - - @onerror - - */ - -//____________________________________________________________________________________________________________ -// private variables -//____________________________________________________________________________________________________________ - -private: - - CSS_UNO::Reference< CSS_AWT::XFixedText > m_xText ; - CSS_UNO::Reference< CSS_AWT::XProgressBar > m_xProgressBar ; - -}; // class StatusIndicator - -// The name space aliases are only used in the header -#undef CSS_UNO -#undef CSS_AWT -#undef CSS_LANG -#undef CSS_TASK - -} // namespace unocontrols - -#endif // #ifndef _UNOCONTROLS_STATUSINDICATOR_CTRL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/UnoControls/util/ctl.component b/UnoControls/util/ctl.component deleted file mode 100644 index 32901f529..000000000 --- a/UnoControls/util/ctl.component +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/UnoControls/util/makefile.mk b/UnoControls/util/makefile.mk deleted file mode 100644 index 73617d244..000000000 --- a/UnoControls/util/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=UnoControls -TARGET=ctl -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1FILES= $(SLB)$/base.lib \ - $(SLB)$/controls.lib - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1IMPLIB= i$(TARGET) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -SHL1STDLIBS= \ - $(TOOLSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1DEPN= makefile.mk -SHL1LIBS= $(LIB1TARGET) - -# --- Targets ------------------------------------------------------ -.INCLUDE : target.mk - -ALLTAR : $(MISC)/ctl.component - -$(MISC)/ctl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - ctl.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt ctl.component diff --git a/UnoControls/util/makefile.pmk b/UnoControls/util/makefile.pmk deleted file mode 100644 index 02a34a243..000000000 --- a/UnoControls/util/makefile.pmk +++ /dev/null @@ -1,27 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -.INCLUDE : settings.mk diff --git a/UnoControls/util/target.pmk b/UnoControls/util/target.pmk deleted file mode 100644 index c7c1de9c2..000000000 --- a/UnoControls/util/target.pmk +++ /dev/null @@ -1,35 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -ALLSLO: $(SLOFILES) - -SOSHL: $(SHL1TARGETN) - -WHOLEPRJ: - cd $(PRJ)$/prj - make debug linkinc prjpch compinc - @echo "READY" - diff --git a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java deleted file mode 100755 index e881dffce..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.accessibility; - -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.awt.XTopWindow; -import com.sun.star.awt.XTopWindowListener; -import com.sun.star.awt.XWindow; -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XInitialization; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.registry.*; -import com.sun.star.uno.*; - -import org.openoffice.java.accessibility.*; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import javax.accessibility.Accessible; - - -public class AccessBridge { - // - protected static java.util.Hashtable topWindowMap = new java.util.Hashtable(); - - private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) { - // Because it can not be garantied that - // WindowsAccessBridgeAdapter.registerTopWindow() is called - // before windowOpened(), we have to make this operation - // atomic. - synchronized (topWindowMap) { - String oid = UnoRuntime.generateOid(xAccessible); - java.awt.Window w = (java.awt.Window) topWindowMap.get(oid); - - if (w == null) { - w = AccessibleObjectFactory.getTopWindow(xAccessible); - - if (w != null) { - topWindowMap.put(oid, w); - } - } - - return w; - } - } - - protected static java.awt.Window getTopWindow(XAccessible xAccessible) { - if (xAccessible != null) { - XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - - // Toolkit reports the VCL peer windows as toplevels. These have an - // accessible parent which represents the native frame window - switch(xAccessibleContext.getAccessibleRole()) { - case AccessibleRole.ROOT_PANE: - case AccessibleRole.POPUP_MENU: - return getTopWindow(xAccessibleContext.getAccessibleParent()); - - case AccessibleRole.WINDOW: - case AccessibleRole.FRAME: - case AccessibleRole.DIALOG: - case AccessibleRole.ALERT: - return getTopWindowImpl(xAccessible); - - default: - break; - } - } - } - - return null; - } - - protected static java.awt.Window removeTopWindow(XAccessible xAccessible) { - if (xAccessible != null) { - XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - - // Toolkit reports the VCL peer windows as toplevels. These have an - // accessible parent which represents the native frame window - switch(xAccessibleContext.getAccessibleRole()) { - case AccessibleRole.ROOT_PANE: - case AccessibleRole.POPUP_MENU: - return removeTopWindow(xAccessibleContext.getAccessibleParent()); - - case AccessibleRole.WINDOW: - case AccessibleRole.FRAME: - case AccessibleRole.DIALOG: - return (java.awt.Window) topWindowMap.remove(UnoRuntime.generateOid(xAccessible)); - - default: - break; - } - } - } - - return null; - } - - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, XRegistryKey regKey) { - XSingleServiceFactory xSingleServiceFactory = null; - - if (implName.equals(AccessBridge.class.getName())) { - // Initialize toolkit to register at Java <-> Windows access bridge - java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); - - xSingleServiceFactory = FactoryHelper.getServiceFactory(_AccessBridge.class, - _AccessBridge._serviceName, multiFactory, regKey); - } - - return xSingleServiceFactory; - } - - static public class _AccessBridge implements XTopWindowListener, - XInitialization, XComponent { - static final String _serviceName = "com.sun.star.accessibility.AccessBridge"; - XComponentContext xComponentContext; - - public _AccessBridge(XComponentContext xComponentContext) { - this.xComponentContext = xComponentContext; - } - - /* - * XInitialization - */ - public void initialize(java.lang.Object[] arguments) { - try { - // FIXME: Currently there is no way to determine if key event forwarding is needed or not, - // so we have to do it always .. - XExtendedToolkit unoToolkit = (XExtendedToolkit) AnyConverter.toObject(new Type( - XExtendedToolkit.class), arguments[0]); - - if (unoToolkit != null) { - // FIXME this should be done in VCL - unoToolkit.addTopWindowListener(this); - - String os = (String) System.getProperty("os.name"); - - // Try to initialize the WindowsAccessBridgeAdapter - if (os.startsWith("Windows")) { - WindowsAccessBridgeAdapter.attach(xComponentContext); - } else { - unoToolkit.addKeyHandler(new KeyHandler()); - } - } else if (Build.DEBUG) { - System.err.println( - "argument 0 is not of type XExtendedToolkit."); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - // FIXME: output - } - } - - /* - * XTopWindowListener - */ - public void windowOpened(com.sun.star.lang.EventObject event) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class, - event.Source); - java.awt.Window w = getTopWindow(xAccessible); - } - - public void windowActivated(com.sun.star.lang.EventObject event) { - } - - public void windowDeactivated(com.sun.star.lang.EventObject event) { - } - - public void windowMinimized(com.sun.star.lang.EventObject event) { - } - - public void windowNormalized(com.sun.star.lang.EventObject event) { - } - - public void windowClosing(com.sun.star.lang.EventObject event) { - } - - public void windowClosed(com.sun.star.lang.EventObject event) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class, - event.Source); - - java.awt.Window w = removeTopWindow(xAccessible); - - if (w != null) { - w.dispose(); - } - } - - public void disposing(com.sun.star.lang.EventObject event) { - } - - /* - * XComponent - */ - - public void addEventListener(com.sun.star.lang.XEventListener listener) { - } - - public void removeEventListener(com.sun.star.lang.XEventListener listener) { - } - - public void dispose() { - try { - java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait( - new Runnable() { - public void run() { - } - } ); - } catch (java.lang.InterruptedException e) { - } catch (java.lang.reflect.InvocationTargetException e) { - } - } - } -} diff --git a/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java b/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java deleted file mode 100755 index 655399c65..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -package org.openoffice.accessibility; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.awt.XKeyHandler; -import org.openoffice.java.accessibility.AccessibleKeyBinding; -import org.openoffice.java.accessibility.Build; - -import java.awt.*; -import java.awt.event.KeyEvent; -import javax.accessibility.*; - -public class KeyHandler extends Component implements XKeyHandler, java.awt.KeyEventDispatcher { - EventQueue eventQueue; - - public class VCLKeyEvent extends KeyEvent implements Runnable { - boolean consumed = true; - - public VCLKeyEvent(Component c, int id, int modifiers, int keyCode, char keyChar) { - super(c, id, System.currentTimeMillis(), modifiers, keyCode, keyChar); - } - - public void run() { - // This is a no-op .. - } - - public void setConsumed(boolean b) { - consumed = b; - } - - public boolean isConsumed() { - return consumed; - } - } - - public KeyHandler() { - eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); - java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); - } - - /** This method is called by the current KeyboardFocusManager requesting that this KeyEventDispatcher - * dispatch the specified event on its behalf - */ - public boolean dispatchKeyEvent(java.awt.event.KeyEvent e) { - if (e instanceof VCLKeyEvent) { - VCLKeyEvent event = (VCLKeyEvent) e; - event.setConsumed(false); - return true; - } - return false; - } - - /** Handler for KeyPressed events */ - public boolean keyPressed(com.sun.star.awt.KeyEvent event) { -// try { - VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_PRESSED, - AccessibleKeyBinding.convertModifiers(event.Modifiers), - AccessibleKeyBinding.convertKeyCode(event.KeyCode), - event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED); - - eventQueue.postEvent(vke); - - // VCL events for TABs have empty KeyChar - if (event.KeyCode == com.sun.star.awt.Key.TAB ) { - event.KeyChar = '\t'; - } - - // Synthesize KEY_TYPED event to emulate Java behavior - if (event.KeyChar != 0) { - eventQueue.postEvent(new VCLKeyEvent(this, - KeyEvent.KEY_TYPED, - AccessibleKeyBinding.convertModifiers(event.Modifiers), - KeyEvent.VK_UNDEFINED, - event.KeyChar)); - } - - // Wait until the key event is processed - return false; -// eventQueue.invokeAndWait(vke); -// return vke.isConsumed(); -// } catch(java.lang.InterruptedException e) { -// return false; -// } catch(java.lang.reflect.InvocationTargetException e) { -// return false; -// } - } - - /** Handler for KeyReleased events */ - public boolean keyReleased(com.sun.star.awt.KeyEvent event) { -// try { - VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_RELEASED, - AccessibleKeyBinding.convertModifiers(event.Modifiers), - AccessibleKeyBinding.convertKeyCode(event.KeyCode), - event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED); - eventQueue.postEvent(vke); - - // Wait until the key event is processed - return false; -// eventQueue.invokeAndWait(vke); -// return vke.isConsumed(); -// } catch(java.lang.InterruptedException e) { -// return false; -// } catch(java.lang.reflect.InvocationTargetException e) { -// return false; -// } - } - - public void disposing(com.sun.star.lang.EventObject event) { - java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); - } -}; diff --git a/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java b/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java deleted file mode 100644 index 291fd8c09..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.accessibility; - -import org.openoffice.java.accessibility.*; - - -/** - * - */ -public class PopupWindow extends java.awt.Window { - javax.accessibility.AccessibleContext accessibleContext = null; - ContainerProxy layeredPane = new ContainerProxy(javax.accessibility.AccessibleRole.LAYERED_PANE); - ContainerProxy rootPane = new ContainerProxy(javax.accessibility.AccessibleRole.ROOT_PANE); - ContainerProxy popupLayer = new ContainerProxy(javax.accessibility.AccessibleRole.PANEL); - boolean opened = false; - boolean visible = false; - - /** Creates a new instance of PopupWindow */ - public PopupWindow(java.awt.Window owner) { - super(owner); - super.add(rootPane); - rootPane.add(layeredPane); - - javax.accessibility.AccessibleContext ac = rootPane.getAccessibleContext(); - - if (ac != null) { - ac.setAccessibleParent(this); - } - } - - static PopupWindow create( - com.sun.star.accessibility.XAccessible xAccessible) { - java.awt.Window parent = java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager() - .getActiveWindow(); - - if (parent != null) { - PopupWindow w = new PopupWindow(parent); - w.setVisible(true); - AccessibleObjectFactory.invokeAndWait(); - AccessibleObjectFactory.addChild(w, xAccessible); - - return w; - } - - return null; - } - - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - - return (parent == null) || parent.isShowing(); - } - - return false; - } - - public void addNotify() { - } - - public void removeNotify() { - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean b) { - if (visible != b) { - visible = b; - - if (b) { - // If it is the first show, fire WINDOW_OPENED event - if (!opened) { - AccessibleObjectFactory.postWindowOpened(this); - opened = true; - } - } - } - } - - public java.awt.Component add(java.awt.Component c) { - popupLayer.add(c); - layeredPane.add(popupLayer); - - if (c instanceof javax.accessibility.Accessible) { - javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext(); - - if (ac != null) { - ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY, null, - popupLayer.getAccessibleContext()); - } - } - - return c; - } - - public void remove(java.awt.Component c) { - layeredPane.remove(popupLayer); - - if (c instanceof javax.accessibility.Accessible) { - javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext(); - - if (ac != null) { - ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY, - popupLayer.getAccessibleContext(), null); - } - } - - popupLayer.remove(c); - } - - public void dispose() { - setVisible(false); - AccessibleObjectFactory.postWindowClosed(this); - } - - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessiblePopupWindow(); - } - - return accessibleContext; - } - - protected class AccessiblePopupWindow - extends java.awt.Window.AccessibleAWTWindow { - AccessiblePopupWindow() { - } - } - - protected class ContainerProxy extends java.awt.Container - implements javax.accessibility.Accessible { - javax.accessibility.AccessibleContext accessibleContext = null; - javax.accessibility.AccessibleRole role; - - protected ContainerProxy(javax.accessibility.AccessibleRole role) { - this.role = role; - } - - public java.awt.Component add(java.awt.Component c) { - if (c instanceof javax.accessibility.Accessible) { - javax.accessibility.Accessible a = (javax.accessibility.Accessible) c; - javax.accessibility.AccessibleContext ac = a.getAccessibleContext(); - - if (ac != null) { - ac.setAccessibleParent(this); - } - } - - return super.add(c); - } - - public void remove(java.awt.Component c) { - if (c instanceof javax.accessibility.Accessible) { - javax.accessibility.Accessible a = (javax.accessibility.Accessible) c; - javax.accessibility.AccessibleContext ac = a.getAccessibleContext(); - - if (ac != null) { - ac.setAccessibleParent(null); - } - } - - super.remove(c); - } - - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessibleContainerProxy(); - } - - return accessibleContext; - } - - private class AccessibleContainerProxy - extends java.awt.Container.AccessibleAWTContainer { - AccessibleContainerProxy() { - } - - public javax.accessibility.AccessibleRole getAccessibleRole() { - return ContainerProxy.this.role; - } - } - } -} diff --git a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java deleted file mode 100644 index 299c5cc83..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java +++ /dev/null @@ -1,654 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.accessibility; - -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.java.XJavaVM; -import com.sun.star.uno.*; - -import org.openoffice.java.accessibility.*; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import javax.accessibility.*; - - -public class WindowsAccessBridgeAdapter { - private static Method registerVirtualFrame; - private static Method revokeVirtualFrame; - private static java.util.Hashtable frameMap; - - protected static native byte[] getProcessID(); - - protected static native boolean createMapping(long jvmaccess); - - // On Windows all native frames must be registered to the access bridge. - // Therefor the bridge exports two methods that we try to find here. - protected static void attach(XComponentContext xComponentContext) { - try { - Class bridge = Class.forName( - "com.sun.java.accessibility.AccessBridge"); - Class[] parameterTypes = { - javax.accessibility.Accessible.class, Integer.class - }; - - if (bridge != null) { - registerVirtualFrame = bridge.getMethod("registerVirtualFrame", - parameterTypes); - revokeVirtualFrame = bridge.getMethod("revokeVirtualFrame", - parameterTypes); - - // load the native dll - System.loadLibrary("java_uno_accessbridge"); - - Object any = xComponentContext.getValueByName( - "/singletons/com.sun.star.java.theJavaVirtualMachine"); - - if (AnyConverter.isObject(any)) { - XJavaVM xJavaVM = (XJavaVM) UnoRuntime.queryInterface(XJavaVM.class, - AnyConverter.toObject(new Type(XJavaVM.class), any)); - - if (xJavaVM != null) { - any = xJavaVM.getJavaVM(getProcessID()); - - if (AnyConverter.isLong(any)) { - createMapping(AnyConverter.toLong(any)); - frameMap = new java.util.Hashtable(); - } - } - } - } - } catch (NoSuchMethodException e) { - System.err.println("ERROR: incompatible AccessBridge found: " + - e.getMessage()); - - // Forward this exception to UNO to indicate that the service will - // not work correctly. - throw new com.sun.star.uno.RuntimeException( - "incompatible AccessBridge class: " + e.getMessage()); - } catch (java.lang.SecurityException e) { - System.err.println("ERROR: no access to AccessBridge: " + - e.getMessage()); - - // Forward this exception to UNO to indicate that the service will not work correctly. - throw new com.sun.star.uno.RuntimeException( - "Security exception caught: " + e.getMessage()); - } catch (ClassNotFoundException e) { - // Forward this exception to UNO to indicate that the service will not work correctly. - throw new com.sun.star.uno.RuntimeException( - "ClassNotFound exception caught: " + e.getMessage()); - } catch (IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught: " + - e.getMessage()); - - // Forward this exception to UNO to indicate that the service will not work correctly. - throw new com.sun.star.uno.RuntimeException( - "IllegalArgumentException caught: " + e.getMessage()); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println("UNO IllegalArgumentException caught: " + - e.getMessage()); - - // Forward this exception to UNO to indicate that the service will not work correctly. - throw new com.sun.star.uno.RuntimeException( - "UNO IllegalArgumentException caught: " + e.getMessage()); - } - } - - protected static boolean isAttached() { - return frameMap != null; - } - - protected static Accessible getAccessibleWrapper(XAccessible xAccessible) { - Accessible a = null; - - try { - XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); - - if (xAccessibleContext != null) { - switch (xAccessibleContext.getAccessibleRole()) { - case AccessibleRole.LIST: - a = (Accessible) AccessibleObjectFactory.getAccessibleComponent(xAccessible); - if (a != null) { - a = new ListProxy(a.getAccessibleContext()); - } - break; - - case AccessibleRole.MENU: - - Accessible tmp = (Accessible) AccessibleObjectFactory.getAccessibleComponent(xAccessible); - if (tmp != null) { - AccessibleContext ac = tmp.getAccessibleContext(); - - if (ac != null) { - a = new PopupMenuProxy(ac); - } - } - - break; - - case AccessibleRole.TOOL_TIP: - a = PopupWindow.create(xAccessible); - break; - - default: - a = (Accessible) AccessBridge.getTopWindow(xAccessible); - break; - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - - return a; - } - - /** Registers a native frame at the Java AccessBridge for Windows */ - public static void registerTopWindow(int handle, XAccessible xAccessible) { - Integer hwnd = new Integer(handle); - - if (!frameMap.contains(hwnd)) { - if (Build.DEBUG) { - System.err.println("Native frame " + hwnd + " of role " + - AccessibleRoleAdapter.getAccessibleRole(xAccessible) + - " has been opened"); - } - - Accessible a = getAccessibleWrapper(xAccessible); - - if (a != null) { - Object[] args = { a, hwnd }; - - frameMap.put(hwnd, a); - - if (Build.DEBUG) { - System.err.println("registering native frame " + hwnd); - } - - try { - registerVirtualFrame.invoke(null, args); - } catch (IllegalAccessException e) { - System.err.println("IllegalAccessException caught: " + - e.getMessage()); - } catch (IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught: " + - e.getMessage()); - } catch (InvocationTargetException e) { - System.err.println("InvokationTargetException caught: " + - e.getMessage()); - } - } - } - } - - /** Revokes a native frame at the Java AccessBridge for Windows */ - public static void revokeTopWindow(int handle, XAccessible xAccessible) { - Integer hwnd = new Integer(handle); - - Accessible a = (Accessible) frameMap.remove(hwnd); - - if (a != null) { - Object[] args = { a, hwnd }; - - if (Build.DEBUG) { - System.err.println("revoking native frame " + hwnd); - } - - try { - revokeVirtualFrame.invoke(null, args); - } catch (IllegalAccessException e) { - System.err.println("IllegalAccessException caught: " + - e.getMessage()); - } catch (IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught: " + - e.getMessage()); - } catch (InvocationTargetException e) { - System.err.println("InvokationTargetException caught: " + - e.getMessage()); - } - } - - if (a instanceof PopupWindow) { - PopupWindow toolTipWindow = (PopupWindow) a; - toolTipWindow.removeAll(); - toolTipWindow.dispose(); - } - } - - protected static class PopupMenuProxy extends AccessibleContext - implements Accessible, AccessibleComponent { - AccessibleContext menu; - AccessibleComponent menuComponent; - int x = 0; int y = 0; int width = 0; int height = 0; - - PopupMenuProxy(AccessibleContext ac) { - menu = ac; - menuComponent = menu.getAccessibleComponent(); - - /** calculate the bounding rectangle by iterating over the - * the children. - */ - int x2 = 0; int y2 = 0; - int count = ac.getAccessibleChildrenCount(); - for (int i = 0; i < count; i++) { - Accessible a = menu.getAccessibleChild(i); - - if (a != null) { - AccessibleContext childAC = a.getAccessibleContext(); - - if (childAC != null) { - AccessibleComponent comp = ac.getAccessibleComponent(); - - if (comp != null) { - java.awt.Point p = comp.getLocationOnScreen(); - java.awt.Dimension d = comp.getSize(); - - if (p != null && d != null) { - if (p.x < x) { - x = p.x; - } - if (p.y < y) { - y = p.y; - } - if (p.x + d.width > x2) { - x2 = p.x + d.width; - } - if (p.y + d.height > y2) { - y2 = p.y + d.height; - } - } - } - } - } - } - - width = x2 - x; - height = y2 - y; - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - return this; - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleComponent getAccessibleComponent() { - return this; - } - - /** Returns the AccessibleText associated with this object */ - public javax.accessibility.AccessibleText getAccessibleText() { - return menu.getAccessibleText(); - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - return menu.getAccessibleStateSet(); - } - - public java.util.Locale getLocale() { - return menu.getLocale(); - } - - public int getAccessibleIndexInParent() { - return -1; - } - - public int getAccessibleChildrenCount() { - return menu.getAccessibleChildrenCount(); - } - - public javax.accessibility.Accessible getAccessibleChild(int i) { - return menu.getAccessibleChild(i); - } - - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.POPUP_MENU; - } - - /* - * AccessibleComponent - */ - public void addFocusListener(java.awt.event.FocusListener fl) { - menuComponent.addFocusListener(fl); - } - - public void removeFocusListener(java.awt.event.FocusListener fl) { - menuComponent.removeFocusListener(fl); - } - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - return menuComponent.getBackground(); - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - return menuComponent.getForeground(); - } - - public void setForeground(java.awt.Color c) { - menuComponent.setForeground(c); - } - - public java.awt.Cursor getCursor() { - return menuComponent.getCursor(); - } - - public void setCursor(java.awt.Cursor cursor) { - menuComponent.setCursor(cursor); - } - - public java.awt.Font getFont() { - return menuComponent.getFont(); - } - - public void setFont(java.awt.Font f) { - menuComponent.setFont(f); - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - return menuComponent.getFontMetrics(f); - } - - public boolean isEnabled() { - return menuComponent.isEnabled(); - } - - public void setEnabled(boolean b) { - menuComponent.setEnabled(b); - } - - public boolean isVisible() { - return menuComponent.isVisible(); - } - - public void setVisible(boolean b) { - menuComponent.setVisible(b); - } - - public boolean isShowing() { - return menuComponent.isShowing(); - } - - public boolean contains(java.awt.Point p) { - java.awt.Dimension d = getSize(); - - if (Build.DEBUG) { - System.err.println("PopupMenuProxy.containsPoint(" + p.x + "," + - p.y + ") returns " + - (((d.width >= 0) && (p.x < d.width) && (d.height >= 0) && - (p.y < d.height)) ? "true" : "false")); - } - - if ((d.width >= 0) && (p.x < d.width) && (d.height >= 0) && - (p.y < d.height)) { - return true; - } - - return false; - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - return new java.awt.Point(x,y); - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - // This object represents a toplevel, so this is the same as getLocationOnScreen() - return getLocationOnScreen(); - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - return new java.awt.Rectangle(x, y, width, height); - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - return new java.awt.Dimension(width, height); - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local - * coordinate Point - */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - java.awt.Point p2 = menuComponent.getLocationOnScreen(); - return menuComponent.getAccessibleAt( - new java.awt.Point(p.x + x - p2.x, p.y + y - p2.y)); - } - - public boolean isFocusTraversable() { - return menuComponent.isFocusTraversable(); - } - - public void requestFocus() { - menuComponent.requestFocus(); - } - } - - protected static class ListProxy extends AccessibleContext - implements Accessible, AccessibleComponent { - AccessibleContext list; - AccessibleComponent listComponent; - - ListProxy(AccessibleContext ac) { - list = ac; - listComponent = list.getAccessibleComponent(); - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - return this; - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleComponent getAccessibleComponent() { - return this; - } - - /** Returns the AccessibleSelection associated with this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - return list.getAccessibleSelection(); - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - return list.getAccessibleStateSet(); - } - - public java.util.Locale getLocale() { - return list.getLocale(); - } - - public int getAccessibleIndexInParent() { - return -1; - } - - public int getAccessibleChildrenCount() { - return list.getAccessibleChildrenCount(); - } - - public javax.accessibility.Accessible getAccessibleChild(int i) { - return list.getAccessibleChild(i); - } - - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.LIST; - } - - /* - * AccessibleComponent - */ - public void addFocusListener(java.awt.event.FocusListener fl) { - listComponent.addFocusListener(fl); - } - - public void removeFocusListener(java.awt.event.FocusListener fl) { - listComponent.removeFocusListener(fl); - } - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - return listComponent.getBackground(); - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - return listComponent.getForeground(); - } - - public void setForeground(java.awt.Color c) { - listComponent.setForeground(c); - } - - public java.awt.Cursor getCursor() { - return listComponent.getCursor(); - } - - public void setCursor(java.awt.Cursor cursor) { - listComponent.setCursor(cursor); - } - - public java.awt.Font getFont() { - return listComponent.getFont(); - } - - public void setFont(java.awt.Font f) { - listComponent.setFont(f); - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - return listComponent.getFontMetrics(f); - } - - public boolean isEnabled() { - return listComponent.isEnabled(); - } - - public void setEnabled(boolean b) { - listComponent.setEnabled(b); - } - - public boolean isVisible() { - return listComponent.isVisible(); - } - - public void setVisible(boolean b) { - listComponent.setVisible(b); - } - - public boolean isShowing() { - return listComponent.isShowing(); - } - - public boolean contains(java.awt.Point p) { - return listComponent.contains(p); - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - return listComponent.getLocationOnScreen(); - } - - /** Gets the location of this component in the form of a point specifying - * the component's top-left corner - */ - public java.awt.Point getLocation() { - // This object represents a toplevel object, so getLocation() should - // return the same as getLocationOnScreen(). - return getLocationOnScreen(); - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - java.awt.Point p = getLocationOnScreen(); - java.awt.Dimension d = getSize(); - return new java.awt.Rectangle(p.x, p.y, d.width, d.height); - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - return listComponent.getSize(); - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local - * coordinate Point - */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - return listComponent.getAccessibleAt(p); - } - - public boolean isFocusTraversable() { - return listComponent.isFocusTraversable(); - } - - public void requestFocus() { - listComponent.requestFocus(); - } - } -} diff --git a/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component b/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component deleted file mode 100644 index 5fc897f2d..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/accessibility/bridge/org/openoffice/accessibility/makefile.mk b/accessibility/bridge/org/openoffice/accessibility/makefile.mk deleted file mode 100755 index 1fa29f5bf..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = accessibility -PRJ = ..$/..$/..$/.. -TARGET = java_uno_accessbridge -PACKAGE = org$/openoffice$/accessibility - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - AccessBridge.java \ - KeyHandler.java \ - PopupWindow.java \ - WindowsAccessBridgeAdapter.java - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility -CUSTOMMANIFESTFILE = manifest - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/java_uno_accessbridge.component - -$(MISC)/java_uno_accessbridge.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt java_uno_accessbridge.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_JAVA)$(JARTARGET)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt java_uno_accessbridge.component diff --git a/accessibility/bridge/org/openoffice/accessibility/manifest b/accessibility/bridge/org/openoffice/accessibility/manifest deleted file mode 100755 index 4b5ffd54d..000000000 --- a/accessibility/bridge/org/openoffice/accessibility/manifest +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: org.openoffice.accessibility.AccessBridge -UNO-Type-Path: diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java deleted file mode 100644 index 1540ba8f7..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java +++ /dev/null @@ -1,176 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -/** - */ -public abstract class AbstractButton extends Component { - - protected AbstractButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected abstract class AccessibleAbstractButton extends AccessibleUNOComponent - implements javax.accessibility.AccessibleAction { - - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleAbstractButton() { - super(); - } - - /* - * AccessibleContext - */ - - /** Gets the AccessibleAction associated with this object that supports one or more actions */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - return this; - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the relation set of this object */ - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet(); - - if (unoAccessibleRelationSet == null) { - return null; - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - getAccessibleComponents( - unoAccessibleRelation.TargetSet))); - break; - - case AccessibleRelationType.LABELED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABELED_BY, - getAccessibleComponents( - unoAccessibleRelation.TargetSet))); - break; - default: - break; - } - } - - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /* - * AccessibleAction - */ - - /** Performs the specified Action on the object */ - public boolean doAccessibleAction(int param) { - if (param == 0) { - // HACK: this action might open a modal dialog and therefor block - // until the dialog is closed. In case of this thread being the - // AWT EventDispatcherThread this means, the opened dialog will - // not be accessible, so deligate this request to another thread. - if (java.awt.EventQueue.isDispatchThread()) { - Thread t = new Thread () { - public void run() { - AbstractButton.AccessibleAbstractButton.this.doAccessibleAction(0); - } - }; - t.start(); - return true; - } else { - // Actions of MenuItems may also be performed if the item is not - // visible, so just try .. - try { - XAccessibleContext xAccessibleContext = unoAccessibleContext; - if (xAccessibleContext != null) { - // Query for XAccessibleAction interface - XAccessibleAction xAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext); - - if (xAccessibleAction != null) { - return xAccessibleAction.doAccessibleAction(0); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - } - - return false; - } - - /** Returns a description of the specified action of the object */ - public java.lang.String getAccessibleActionDescription(int param) { - return javax.swing.UIManager.getString("AbstractButton.clickText"); - } - - /** Returns the number of accessible actions available in this object */ - public int getAccessibleActionCount() { - return 1; - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java deleted file mode 100644 index ec250f68a..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.XAccessibleAction; - -/** The AccessibleActionWrapper maps the calls to the java AccessibleAction interface - * to the corresponding methods of the UNO XAccessibleAction interface. - */ -public class AccessibleActionImpl implements javax.accessibility.AccessibleAction { - - protected XAccessibleAction unoObject; - - /** Creates new AccessibleActionWrapper */ - public AccessibleActionImpl(XAccessibleAction xAccessibleAction) { - unoObject = xAccessibleAction; - } - - public boolean doAccessibleAction(int param) { - try { - return unoObject.doAccessibleAction(param); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - public java.lang.String getAccessibleActionDescription(int param) { - try { - return unoObject.getAccessibleActionDescription(param); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public int getAccessibleActionCount() { - try { - return unoObject.getAccessibleActionCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java deleted file mode 100644 index 93df646e8..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleComponent; -// import com.sun.star.accessibility.XAccessibleExtendedComponent; -import com.sun.star.uno.UnoRuntime; - -public class AccessibleComponentImpl implements javax.accessibility.AccessibleComponent { - - protected XAccessibleComponent unoObject; -// protected XAccessibleExtendedComponent unoAccessibleExtendedComponent = null; - - /** Creates new AccessibleComponentImpl */ - public AccessibleComponentImpl(XAccessibleComponent xAccessibleComponent) { - unoObject = xAccessibleComponent; - } - - protected boolean hasState(short state) { - try { - XAccessibleContext unoAccessibleContext = (XAccessibleContext) - UnoRuntime.queryInterface(XAccessibleContext.class, unoObject); - // All UNO accessibility implementations must support XAccessibleContext - // and return a valid XAccessibleStateSet .. - return unoAccessibleContext.getAccessibleStateSet().contains(state); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } catch (java.lang.NullPointerException e) { - System.err.println("XAccessibleContext unsupported or no XAccessibleStateSet returned."); - return false; - } - } - - /* - * XAccessibleComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoObject.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoObject.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return hasState(AccessibleStateType.ENABLED); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return hasState(AccessibleStateType.VISIBLE); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return hasState(AccessibleStateType.SHOWING); - } - - public boolean contains(java.awt.Point p) { - try { - return unoObject.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoObject.getLocationOnScreen(); - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoObject.getLocation(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoObject.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoObject.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - // Not supported by this implementation - return null; - } - - public boolean isFocusTraversable() { - return hasState(AccessibleStateType.FOCUSABLE); - } - - public void requestFocus() { - unoObject.grabFocus(); - } - - /** - * Adds the specified focus listener to receive focus events from - * this component when this component gains input focus. - * If listener l is null, - * no exception is thrown and no action is performed. - */ - - public void addFocusListener(java.awt.event.FocusListener l) { - // Not supported by this implementation - } - - /** - * Removes the specified focus listener so that it no longer - * receives focus events from this component. This method performs - * no function, nor does it throw an exception, if the listener - * specified by the argument was not previously added to this component. - * If listener l is null, - * no exception is thrown and no action is performed. - */ - - public void removeFocusListener(java.awt.event.FocusListener l) { - // Not supported by this implementation - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java deleted file mode 100644 index 6749aaad5..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java +++ /dev/null @@ -1,367 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.awt.*; -import com.sun.star.style.*; -import com.sun.star.uno.*; -import com.sun.star.accessibility.AccessibleTextType; -import com.sun.star.accessibility.XAccessibleEditableText; - -import javax.accessibility.AccessibleText; -import javax.swing.text.StyleConstants; - -/** The GenericAccessibleEditableText mapps the calls to the java AccessibleEditableText - * interface to the corresponding methods of the UNO XAccessibleEditableText interface. - */ -public class AccessibleEditableTextImpl extends AccessibleTextImpl implements javax.accessibility.AccessibleEditableText { - final static double toPointFactor = 1 / (7/10 + 34.5); - - /** Creates new GenericAccessibleEditableText object */ - public AccessibleEditableTextImpl(XAccessibleEditableText xAccessibleEditableText) { - super(xAccessibleEditableText); - } - - /** Cuts the text between two indices into the system clipboard */ - public void cut(int startIndex, int endIndex) { - try { - ((XAccessibleEditableText) unoObject).cutText(startIndex, endIndex); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Deletes the text between two indices */ - public void delete(int startIndex, int endIndex) { - try { - ((XAccessibleEditableText) unoObject).deleteText(startIndex, endIndex); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the text range between two indices */ - public String getTextRange(int startIndex, int endIndex) { - try { - return unoObject.getTextRange(startIndex, endIndex); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - - /** Inserts the specified string at the given index */ - public void insertTextAtIndex(int index, String s){ - try { - ((XAccessibleEditableText) unoObject).insertText(s, index); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Pastes the text form the system clipboard into the text starting at the specified index */ - public void paste(int startIndex) { - try { - ((XAccessibleEditableText) unoObject).pasteText(startIndex); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Replaces the text between two indices with the specified string */ - public void replaceText(int startIndex, int endIndex, String s) { - try { - ((XAccessibleEditableText) unoObject).replaceText(startIndex, endIndex, s); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Selects the text between two indices */ - public void selectText(int startIndex, int endIndex) { - try { - unoObject.setSelection(startIndex, endIndex); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Sets the attributes for the text between two indices */ - public void setAttributes(int startIndex, int endIndex, javax.swing.text.AttributeSet as) { - java.util.Vector propertyValues = new java.util.Vector(); - - // Convert Alignment attribute - Object attribute = as.getAttribute(StyleConstants.Alignment); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaAdjust"; - - switch (StyleConstants.getAlignment(as)) { - case StyleConstants.ALIGN_RIGHT: - propertyValue.Value = ParagraphAdjust.RIGHT; - break; - case StyleConstants.ALIGN_CENTER: - propertyValue.Value = ParagraphAdjust.CENTER; - break; - case StyleConstants.ALIGN_JUSTIFIED: - propertyValue.Value = ParagraphAdjust.BLOCK; - break; - default: - propertyValue.Value = ParagraphAdjust.LEFT; - break; - } - propertyValues.add(propertyValue); - } - - // Convert Background attribute - attribute = as.getAttribute(StyleConstants.Background); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharBackColor"; - propertyValue.Value = new Integer(StyleConstants.getBackground(as).getRGB()); - propertyValues.add(propertyValue); - } - - // FIXME: BidiLevel - - // Set Bold attribute - attribute = as.getAttribute(StyleConstants.Bold); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharWeight"; - if (StyleConstants.isBold(as)) { - propertyValue.Value = new Float(150); - } else { - propertyValue.Value = new Float(100); - } - propertyValues.add(propertyValue); - } - - // FIXME: Java 1.4 ComponentAttribute, ComponentElementName, ComposedTextAttribute - - // Set FirstLineIndent attribute - attribute = as.getAttribute(StyleConstants.FirstLineIndent); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaFirstLineIndent"; - propertyValue.Value = new Double(StyleConstants.getFirstLineIndent(as) / toPointFactor); - propertyValues.add(propertyValue); - } - - // Set font family attribute - attribute = as.getAttribute(StyleConstants.FontFamily); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharFontPitch"; - - if (StyleConstants.getFontFamily(as).equals( "Proportional" )) { - propertyValue.Value = new Short("2"); - } else { - propertyValue.Value = new Short("1"); - } - propertyValues.add(propertyValue); - } - - // Set font size attribute - attribute = as.getAttribute(StyleConstants.FontSize); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharHeight"; - propertyValue.Value = new Integer(StyleConstants.getFontSize(as)); - propertyValues.add(propertyValue); - } - - // Map foreground color - attribute = as.getAttribute(StyleConstants.Foreground); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharColor"; - propertyValue.Value = new Integer (StyleConstants.getForeground(as).getRGB()); - propertyValues.add(propertyValue); - } - - // FIXME: IconAttribute, IconElementName - - // Set italic attribute - attribute = as.getAttribute(StyleConstants.Italic); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharPosture"; - - if (StyleConstants.isItalic(as)) { - propertyValue.Value = FontSlant.ITALIC; - } else { - propertyValue.Value = FontSlant.DONTKNOW; - } - propertyValues.add(propertyValue); - } - - // Set left indent attribute - attribute = as.getAttribute(StyleConstants.LeftIndent); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaFirstLeftMargin"; - propertyValue.Value = new Integer(new Double(StyleConstants.getLeftIndent(as) / toPointFactor).intValue()); - propertyValues.add(propertyValue); - } - - // Set right indent attribute - attribute = as.getAttribute(StyleConstants.RightIndent); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaFirstRightMargin"; - propertyValue.Value = new Integer(new Double(StyleConstants.getRightIndent(as) / toPointFactor).intValue()); - propertyValues.add(propertyValue); - } - - // Set line spacing attribute - attribute = as.getAttribute(StyleConstants.LineSpacing); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaLineSpacing"; - propertyValue.Value = new Integer(new Double(StyleConstants.getLineSpacing(as) / toPointFactor).intValue()); - propertyValues.add(propertyValue); - } - - // FIXME: Java 1.4 NameAttribute, Orientation, ResolveAttribute - - // Set space above attribute - attribute = as.getAttribute(StyleConstants.SpaceAbove); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaTopMargin"; - propertyValue.Value = new Integer(new Double( StyleConstants.getSpaceAbove(as) / toPointFactor).intValue()); - propertyValues.add(propertyValue); - } - - // Set space below attribute - attribute = as.getAttribute(StyleConstants.SpaceBelow); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaBottomMargin"; - propertyValue.Value = new Integer(new Double(StyleConstants.getSpaceBelow(as) / toPointFactor).intValue()); - propertyValues.add(propertyValue); - } - - // Set strike through attribute - attribute = as.getAttribute(StyleConstants.StrikeThrough); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharPosture"; - if (StyleConstants.isStrikeThrough(as)) { - propertyValue.Value = new Short(FontStrikeout.SINGLE); - } else { - propertyValue.Value = new Short(FontStrikeout.NONE); - } - propertyValues.add(propertyValue); - } - - // Set sub-/superscript attribute - attribute = as.getAttribute(StyleConstants.Superscript); - if (null == attribute) { - attribute = as.getAttribute(StyleConstants.Subscript); - } - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharEscapement"; - - if (StyleConstants.isSuperscript(as)) { - propertyValue.Value = new Short( "1" ); - } else if (StyleConstants.isSubscript(as)) { - propertyValue.Value = new Short( "-1" ); - } else { - propertyValue.Value = new Short( "0" ); - } - propertyValues.add(propertyValue); - } - - // Set tabset attribute - attribute = as.getAttribute(StyleConstants.TabSet); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "ParaTabStops"; - - javax.swing.text.TabSet tabSet = StyleConstants.getTabSet(as); - java.util.ArrayList tabStops = new java.util.ArrayList(tabSet.getTabCount()); - - for (int i = 0, max = tabSet.getTabCount(); i < max; i++) { - javax.swing.text.TabStop tab = tabSet.getTab(i); - com.sun.star.style.TabStop unoTab = new com.sun.star.style.TabStop(); - - unoTab.Position = new Double(tab.getPosition() / toPointFactor).intValue(); - - switch (tab.getAlignment()) { - case javax.swing.text.TabStop.ALIGN_CENTER: - unoTab.Alignment = TabAlign.CENTER; - break; - case javax.swing.text.TabStop.ALIGN_RIGHT: - unoTab.Alignment = TabAlign.RIGHT; - break; - case javax.swing.text.TabStop.ALIGN_DECIMAL: - unoTab.Alignment = TabAlign.DECIMAL; - break; - default: - unoTab.Alignment = TabAlign.LEFT; - break; - } - - tabStops.add(unoTab); - } - propertyValue.Value = (com.sun.star.style.TabStop[]) tabStops.toArray(); - propertyValues.add(propertyValue); - } - - // Set underline attribute - attribute = as.getAttribute(StyleConstants.Underline); - if (null != attribute) { - com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue(); - propertyValue.Name = "CharUnderline"; - - if (StyleConstants.isUnderline(as)) { - propertyValue.Value = new Short(FontUnderline.SINGLE); - } else { - propertyValue.Value = new Short(FontUnderline.NONE); - } - propertyValues.add(propertyValue); - } - - try { - ((XAccessibleEditableText) unoObject).setAttributes(startIndex, endIndex, (com.sun.star.beans.PropertyValue[]) propertyValues.toArray()); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Sets the text contents to the specified string */ - public void setTextContents(String s) { - try { - ((XAccessibleEditableText) unoObject).setText(s); - } catch (com.sun.star.uno.RuntimeException e) { - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java deleted file mode 100644 index a6eb653ef..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; - -public class AccessibleExtendedState extends AccessibleState { - public static final AccessibleState DEFUNCT; - public static final AccessibleState INDETERMINATE; - public static final AccessibleState MANAGES_DESCENDANTS; - public static final AccessibleState SENSITIVE; - public static final AccessibleState STALE; - - static { - DEFUNCT = new AccessibleExtendedState("defunct"); - - // JAVA 1.5: will come with manages_descendants and indeterminate - INDETERMINATE = new AccessibleExtendedState("indeterminate"); - MANAGES_DESCENDANTS = new AccessibleExtendedState("managesDescendants"); - - SENSITIVE = new AccessibleExtendedState("sensitive"); - STALE = new AccessibleExtendedState("stale"); - } - - protected AccessibleExtendedState(String key) { - super(key); - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java deleted file mode 100644 index 3927f78de..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java +++ /dev/null @@ -1,191 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import org.openoffice.java.accessibility.logging.*; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -/** The AccessibleHypertextImpl mapps all calls to the java AccessibleHypertext - * interface to the corresponding methods of the UNO XAccessibleHypertext - * interface. - */ -public class AccessibleHypertextImpl extends AccessibleTextImpl - implements javax.accessibility.AccessibleHypertext { - - protected class Hyperlink extends javax.accessibility.AccessibleHyperlink { - protected XAccessibleHyperlink unoObject; - - public Hyperlink(XAccessibleHyperlink xHyperlink) { - unoObject = xHyperlink; - } - - public int getStartIndex() { - try { - System.err.println("StartIndex: " + unoObject.getStartIndex()); - return unoObject.getStartIndex(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - public Object getAccessibleActionObject(int param) { - System.err.println("getActionObject"); - try { - Object any = unoObject.getAccessibleActionObject(param); - if (AnyConverter.isString(any)) { - String url = AnyConverter.toString(any); - if (null != url) { - return new java.net.URL(url); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.lang.IllegalArgumentException e) { - } catch (java.net.MalformedURLException exception) { - } catch (com.sun.star.uno.RuntimeException e) { - } - - return null; - } - - public int getEndIndex() { - try { - System.err.println("StartIndex: " + unoObject.getEndIndex()); - return unoObject.getEndIndex(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - public Object getAccessibleActionAnchor(int param) { - System.err.println("getActionAnchor"); - try { - Object any = unoObject.getAccessibleActionObject(param); - if (AnyConverter.isString(any)) { - System.err.println("Anchor: " + AnyConverter.toString(any)); - return AnyConverter.toString(any); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.lang.IllegalArgumentException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - - public boolean isValid() { - return unoObject.isValid(); - } - - public boolean doAccessibleAction(int param) { - try { - return unoObject.doAccessibleAction(param); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - public String getAccessibleActionDescription(int param) { - try { - return unoObject.getAccessibleActionDescription(param); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } - } - - public int getAccessibleActionCount() { - try { - return unoObject.getAccessibleActionCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - } - - /** Creates new AccessibleHypertextImpl */ - public AccessibleHypertextImpl(XAccessibleHypertext xAccessibleHypertext) { - if (Build.PRODUCT) { - unoObject = xAccessibleHypertext; - } else { - String property = System.getProperty("AccessBridgeLogging"); - if ((property != null) && (property.indexOf("text") != -1)) { - unoObject = new XAccessibleHypertextLog(xAccessibleHypertext); - } else { - unoObject = xAccessibleHypertext; - } - } - } - - public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) { - try { - XAccessibleHypertext unoAccessibleHypertext = (XAccessibleHypertext) - UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject); - if (unoAccessibleHypertext != null) { - return new AccessibleHypertextImpl(unoAccessibleHypertext); - } - - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoObject); - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - - public javax.accessibility.AccessibleHyperlink getLink(int param) { - try { - return new Hyperlink(((XAccessibleHypertext) unoObject).getHyperLink(param)); - } - - catch(com.sun.star.lang.IndexOutOfBoundsException exception) { - throw new IndexOutOfBoundsException(exception.getMessage()); - } - } - - public int getLinkCount() { - try { - return ((XAccessibleHypertext) unoObject).getHyperLinkCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - public int getLinkIndex(int param) { - try { - return ((XAccessibleHypertext) unoObject).getHyperLinkIndex(param); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java deleted file mode 100644 index c79fbae89..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.XAccessibleImage; - -/** - */ -public class AccessibleIconImpl implements javax.accessibility.AccessibleIcon { - - XAccessibleImage unoAccessibleImage; - - public AccessibleIconImpl(XAccessibleImage xImage) { - unoAccessibleImage = xImage; - } - - /** Gets the description of the icon */ - public String getAccessibleIconDescription() { - try { - return unoAccessibleImage.getAccessibleImageDescription(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the height of the icon */ - public int getAccessibleIconHeight() { - try { - return unoAccessibleImage.getAccessibleImageHeight(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Gets the width of the icon */ - public int getAccessibleIconWidth() { - try { - return unoAccessibleImage.getAccessibleImageWidth(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Sets the description of the icon */ - public void setAccessibleIconDescription(String s) { - // Not supported - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java deleted file mode 100644 index fc58e6b38..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java +++ /dev/null @@ -1,386 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.awt.KeyStroke; - -/** - * - */ -public class AccessibleKeyBinding extends Object implements javax.accessibility.AccessibleKeyBinding { - - XAccessibleKeyBinding unoAccessibleKeybinding; - - public AccessibleKeyBinding(XAccessibleKeyBinding unoKB) { - unoAccessibleKeybinding = unoKB; - } - - public static int convertModifiers(short s) { - int modifiers = 0; - if ((s & com.sun.star.awt.KeyModifier.SHIFT) != 0) { - modifiers = modifiers | java.awt.event.KeyEvent.SHIFT_DOWN_MASK; - } - - if ((s & com.sun.star.awt.KeyModifier.MOD1) != 0) { - modifiers = modifiers | java.awt.event.KeyEvent.CTRL_DOWN_MASK; - } - - if ((s & com.sun.star.awt.KeyModifier.MOD2) != 0) { - modifiers = modifiers | java.awt.event.KeyEvent.ALT_DOWN_MASK; - } - - if ((s & com.sun.star.awt.KeyModifier.MOD3) != 0) { - modifiers = modifiers | java.awt.event.KeyEvent.META_DOWN_MASK; - } - - return modifiers; - } - - public static int convertKeyCode(short s) { - int keycode = java.awt.event.KeyEvent.VK_UNDEFINED; - - switch(s) { - case com.sun.star.awt.Key.NUM0: - keycode = java.awt.event.KeyEvent.VK_0; - break; - case com.sun.star.awt.Key.NUM1: - keycode = java.awt.event.KeyEvent.VK_1; - break; - case com.sun.star.awt.Key.NUM2: - keycode = java.awt.event.KeyEvent.VK_2; - break; - case com.sun.star.awt.Key.NUM3: - keycode = java.awt.event.KeyEvent.VK_3; - break; - case com.sun.star.awt.Key.NUM4: - keycode = java.awt.event.KeyEvent.VK_4; - break; - case com.sun.star.awt.Key.NUM5: - keycode = java.awt.event.KeyEvent.VK_5; - break; - case com.sun.star.awt.Key.NUM6: - keycode = java.awt.event.KeyEvent.VK_6; - break; - case com.sun.star.awt.Key.NUM7: - keycode = java.awt.event.KeyEvent.VK_7; - break; - case com.sun.star.awt.Key.NUM8: - keycode = java.awt.event.KeyEvent.VK_8; - break; - case com.sun.star.awt.Key.NUM9: - keycode = java.awt.event.KeyEvent.VK_9; - break; - case com.sun.star.awt.Key.A: - keycode = java.awt.event.KeyEvent.VK_A; - break; - case com.sun.star.awt.Key.B: - keycode = java.awt.event.KeyEvent.VK_B; - break; - case com.sun.star.awt.Key.C: - keycode = java.awt.event.KeyEvent.VK_C; - break; - case com.sun.star.awt.Key.D: - keycode = java.awt.event.KeyEvent.VK_D; - break; - case com.sun.star.awt.Key.E: - keycode = java.awt.event.KeyEvent.VK_E; - break; - case com.sun.star.awt.Key.F: - keycode = java.awt.event.KeyEvent.VK_F; - break; - case com.sun.star.awt.Key.G: - keycode = java.awt.event.KeyEvent.VK_G; - break; - case com.sun.star.awt.Key.H: - keycode = java.awt.event.KeyEvent.VK_H; - break; - case com.sun.star.awt.Key.I: - keycode = java.awt.event.KeyEvent.VK_I; - break; - case com.sun.star.awt.Key.J: - keycode = java.awt.event.KeyEvent.VK_J; - break; - case com.sun.star.awt.Key.K: - keycode = java.awt.event.KeyEvent.VK_K; - break; - case com.sun.star.awt.Key.L: - keycode = java.awt.event.KeyEvent.VK_L; - break; - case com.sun.star.awt.Key.M: - keycode = java.awt.event.KeyEvent.VK_M; - break; - case com.sun.star.awt.Key.N: - keycode = java.awt.event.KeyEvent.VK_N; - break; - case com.sun.star.awt.Key.O: - keycode = java.awt.event.KeyEvent.VK_O; - break; - case com.sun.star.awt.Key.P: - keycode = java.awt.event.KeyEvent.VK_P; - break; - case com.sun.star.awt.Key.Q: - keycode = java.awt.event.KeyEvent.VK_Q; - break; - case com.sun.star.awt.Key.R: - keycode = java.awt.event.KeyEvent.VK_R; - break; - case com.sun.star.awt.Key.S: - keycode = java.awt.event.KeyEvent.VK_S; - break; - case com.sun.star.awt.Key.T: - keycode = java.awt.event.KeyEvent.VK_T; - break; - case com.sun.star.awt.Key.U: - keycode = java.awt.event.KeyEvent.VK_U; - break; - case com.sun.star.awt.Key.V: - keycode = java.awt.event.KeyEvent.VK_V; - break; - case com.sun.star.awt.Key.W: - keycode = java.awt.event.KeyEvent.VK_W; - break; - case com.sun.star.awt.Key.X: - keycode = java.awt.event.KeyEvent.VK_X; - break; - case com.sun.star.awt.Key.Y: - keycode = java.awt.event.KeyEvent.VK_Y; - break; - case com.sun.star.awt.Key.Z: - keycode = java.awt.event.KeyEvent.VK_Z; - break; - case com.sun.star.awt.Key.F1: - keycode = java.awt.event.KeyEvent.VK_F1; - break; - case com.sun.star.awt.Key.F2: - keycode = java.awt.event.KeyEvent.VK_F2; - break; - case com.sun.star.awt.Key.F3: - keycode = java.awt.event.KeyEvent.VK_F3; - break; - case com.sun.star.awt.Key.F4: - keycode = java.awt.event.KeyEvent.VK_F4; - break; - case com.sun.star.awt.Key.F5: - keycode = java.awt.event.KeyEvent.VK_F5; - break; - case com.sun.star.awt.Key.F6: - keycode = java.awt.event.KeyEvent.VK_F6; - break; - case com.sun.star.awt.Key.F7: - keycode = java.awt.event.KeyEvent.VK_F7; - break; - case com.sun.star.awt.Key.F8: - keycode = java.awt.event.KeyEvent.VK_F8; - break; - case com.sun.star.awt.Key.F9: - keycode = java.awt.event.KeyEvent.VK_F9; - break; - case com.sun.star.awt.Key.F10: - keycode = java.awt.event.KeyEvent.VK_F10; - break; - case com.sun.star.awt.Key.F11: - keycode = java.awt.event.KeyEvent.VK_F11; - break; - case com.sun.star.awt.Key.F12: - keycode = java.awt.event.KeyEvent.VK_F12; - break; - case com.sun.star.awt.Key.F13: - keycode = java.awt.event.KeyEvent.VK_F13; - break; - case com.sun.star.awt.Key.F14: - keycode = java.awt.event.KeyEvent.VK_F14; - break; - case com.sun.star.awt.Key.F15: - keycode = java.awt.event.KeyEvent.VK_F15; - break; - case com.sun.star.awt.Key.F16: - keycode = java.awt.event.KeyEvent.VK_F16; - break; - case com.sun.star.awt.Key.F17: - keycode = java.awt.event.KeyEvent.VK_F17; - break; - case com.sun.star.awt.Key.F18: - keycode = java.awt.event.KeyEvent.VK_F18; - break; - case com.sun.star.awt.Key.F19: - keycode = java.awt.event.KeyEvent.VK_F19; - break; - case com.sun.star.awt.Key.F20: - keycode = java.awt.event.KeyEvent.VK_F20; - break; - case com.sun.star.awt.Key.F21: - keycode = java.awt.event.KeyEvent.VK_F21; - break; - case com.sun.star.awt.Key.F22: - keycode = java.awt.event.KeyEvent.VK_F22; - break; - case com.sun.star.awt.Key.F23: - keycode = java.awt.event.KeyEvent.VK_F23; - break; - case com.sun.star.awt.Key.F24: - keycode = java.awt.event.KeyEvent.VK_F24; - break; - case com.sun.star.awt.Key.DOWN: - keycode = java.awt.event.KeyEvent.VK_DOWN; - break; - case com.sun.star.awt.Key.UP: - keycode = java.awt.event.KeyEvent.VK_UP; - break; - case com.sun.star.awt.Key.LEFT: - keycode = java.awt.event.KeyEvent.VK_LEFT; - break; - case com.sun.star.awt.Key.RIGHT: - keycode = java.awt.event.KeyEvent.VK_RIGHT; - break; - case com.sun.star.awt.Key.HOME: - keycode = java.awt.event.KeyEvent.VK_HOME; - break; - case com.sun.star.awt.Key.END: - keycode = java.awt.event.KeyEvent.VK_END; - break; - case com.sun.star.awt.Key.PAGEUP: - keycode = java.awt.event.KeyEvent.VK_PAGE_UP; - break; - case com.sun.star.awt.Key.PAGEDOWN: - keycode = java.awt.event.KeyEvent.VK_PAGE_DOWN; - break; - case com.sun.star.awt.Key.RETURN: - keycode = java.awt.event.KeyEvent.VK_ENTER; - break; - case com.sun.star.awt.Key.ESCAPE: - keycode = java.awt.event.KeyEvent.VK_ESCAPE; - break; - case com.sun.star.awt.Key.TAB: - keycode = java.awt.event.KeyEvent.VK_TAB; - break; - case com.sun.star.awt.Key.BACKSPACE: - keycode = java.awt.event.KeyEvent.VK_BACK_SPACE; - break; - case com.sun.star.awt.Key.SPACE: - keycode = java.awt.event.KeyEvent.VK_SPACE; - break; - case com.sun.star.awt.Key.INSERT: - keycode = java.awt.event.KeyEvent.VK_INSERT; - break; - case com.sun.star.awt.Key.DELETE: - keycode = java.awt.event.KeyEvent.VK_DELETE; - break; - case com.sun.star.awt.Key.ADD: - keycode = java.awt.event.KeyEvent.VK_ADD; - break; - case com.sun.star.awt.Key.SUBTRACT: - keycode = java.awt.event.KeyEvent.VK_SUBTRACT; - break; - case com.sun.star.awt.Key.MULTIPLY: - keycode = java.awt.event.KeyEvent.VK_MULTIPLY; - break; - case com.sun.star.awt.Key.DIVIDE: - keycode = java.awt.event.KeyEvent.VK_DIVIDE; - break; - case com.sun.star.awt.Key.POINT: - keycode = java.awt.event.KeyEvent.VK_PERIOD; - break; - case com.sun.star.awt.Key.COMMA: - keycode = java.awt.event.KeyEvent.VK_COMMA; - break; - case com.sun.star.awt.Key.LESS: - keycode = java.awt.event.KeyEvent.VK_LESS; - break; - case com.sun.star.awt.Key.GREATER: - keycode = java.awt.event.KeyEvent.VK_GREATER; - break; - case com.sun.star.awt.Key.EQUAL: - keycode = java.awt.event.KeyEvent.VK_EQUALS; - break; - case com.sun.star.awt.Key.CUT: - keycode = java.awt.event.KeyEvent.VK_CUT; - break; - case com.sun.star.awt.Key.COPY: - keycode = java.awt.event.KeyEvent.VK_COPY; - break; - case com.sun.star.awt.Key.PASTE: - keycode = java.awt.event.KeyEvent.VK_PASTE; - break; - case com.sun.star.awt.Key.UNDO: - keycode = java.awt.event.KeyEvent.VK_UNDO; - break; - case com.sun.star.awt.Key.FIND: - keycode = java.awt.event.KeyEvent.VK_FIND; - break; - case com.sun.star.awt.Key.PROPERTIES: - keycode = java.awt.event.KeyEvent.VK_PROPS; - break; - case com.sun.star.awt.Key.HELP: - keycode = java.awt.event.KeyEvent.VK_HELP; - break; - default: - ; - } - return keycode; - } - - /* - * AccessibleKeyBinding - */ - - /** Returns a key binding for this object */ - public Object getAccessibleKeyBinding(int i) { - try { - KeyStroke[] keys = unoAccessibleKeybinding.getAccessibleKeyBinding(i); - javax.swing.KeyStroke[] data = new javax.swing.KeyStroke[keys.length]; - for (int j=0; j < keys.length; j++) { - int keyCode = convertKeyCode(keys[j].KeyCode); - if (keyCode != java.awt.event.KeyEvent.VK_UNDEFINED) { - data[j] = javax.swing.KeyStroke.getKeyStroke(keyCode, convertModifiers(keys[j].Modifiers)); - } else { - data[j] = null; - } - } - - if (keys.length == 1) { - return data[0]; - } else { - return data; - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the number of key bindings for this object */ - public int getAccessibleKeyBindingCount() { - try { - return unoAccessibleKeybinding.getAccessibleKeyBindingCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java deleted file mode 100644 index aa227692a..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java +++ /dev/null @@ -1,545 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import java.lang.ref.WeakReference; -import javax.accessibility.Accessible; -import javax.accessibility.AccessibleStateSet; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; -import org.openoffice.java.accessibility.logging.XAccessibleEventLog; - -/** -*/ -public class AccessibleObjectFactory { - // This type is needed for conversions from/to uno Any - public static final Type XAccessibleType = new Type(XAccessible.class); - - private static java.util.Hashtable objectList = new java.util.Hashtable(); - private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy(); - - private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit(). - getSystemEventQueue(); - - public static java.awt.EventQueue getEventQueue() { - return theEventQueue; - } - - public static void postFocusGained(java.awt.Component c) { - getEventQueue().postEvent(new java.awt.event.FocusEvent(c, java.awt.event.FocusEvent.FOCUS_GAINED)); - } - - public static void postWindowGainedFocus(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS); - } - - public static void postWindowLostFocus(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_LOST_FOCUS); - } - - public static void postWindowActivated(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_ACTIVATED); - } - - public static void postWindowDeactivated(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_DEACTIVATED); - } - - public static void postWindowOpened(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_OPENED); - } - - public static void postWindowClosed(java.awt.Window w) { - postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_CLOSED); - } - - public static void invokeAndWait() { - try { - theEventQueue.invokeAndWait( new java.lang.Runnable () { - public void run() { - } - }); - } catch (java.lang.reflect.InvocationTargetException e) { - } catch (java.lang.InterruptedException e) { - } - } - - private static void postWindowEvent(java.awt.Window w, int i) { - theEventQueue.postEvent(new java.awt.event.WindowEvent(w, i)); - } - - public static java.awt.Component getAccessibleComponent(XAccessible xAccessible) { - java.awt.Component c = null; - if (xAccessible != null) { - // Retrieve unique id for the original UNO object to be used as a hash key - String oid = UnoRuntime.generateOid(xAccessible); - - // Check if we already have a wrapper object for this context - synchronized (objectList) { - WeakReference r = (WeakReference) objectList.get(oid); - if(r != null) { - c = (java.awt.Component) r.get(); - } - } - } - return c; - } - - public static void addChild(java.awt.Container parent, Object any) { - try { - addChild(parent, (XAccessible) AnyConverter.toObject(XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println(e.getClass().getName() + " caught: " + e.getMessage()); - } - } - - public static void addChild(java.awt.Container parent, XAccessible child) { - try { - if (child != null) { - XAccessibleContext childAC = child.getAccessibleContext(); - if (childAC != null) { - XAccessibleStateSet stateSet = childAC.getAccessibleStateSet(); - if (stateSet != null) { - java.awt.Component c = getAccessibleComponent(child); - - // Re-use existing wrapper if possible, create a new one otherwise - if (c != null) { - // Seems to be already in child list - if (parent.equals(c.getParent())) - return; - // Update general component states - c.setEnabled(stateSet.contains(AccessibleStateType.ENABLED)); - c.setVisible(stateSet.contains(AccessibleStateType.VISIBLE)); - } else { - c = createAccessibleComponentImpl(child, childAC, stateSet); - } - - if (c != null) { - if (c instanceof java.awt.Container) { - populateContainer((java.awt.Container) c, childAC); - } - parent.add(c); - // Simulate focus gained event for new child - if (stateSet.contains(AccessibleStateType.FOCUSED)) { - postFocusGained(c); - } - } - } - } - } - } catch (com.sun.star.uno.RuntimeException e) { - System.err.println(e.getClass().getName() + " caught: " + e.getMessage()); - e.printStackTrace(); - } - } - - protected static void removeChild(java.awt.Container parent, Object any) { - try { - XAccessible xAccessible = (XAccessible) AnyConverter.toObject(XAccessibleType, any); - java.awt.Component c = getAccessibleComponent(xAccessible); - - if (c != null) { - parent.remove(c); - - if (c instanceof java.awt.Container) { - clearContainer((java.awt.Container) c); - } - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println(e.getClass().getName() + " caught: " + e.getMessage()); - } - } - - - /** - * Removes all children from the container parent - */ - - protected static void clearContainer(java.awt.Container parent) { - // Purge all children from this container - int count = parent.getComponentCount(); - for (int i = 0; i < count; i++) { - java.awt.Component c = parent.getComponent(i); - if (c instanceof java.awt.Container) { - clearContainer((java.awt.Container) c); - } - } - parent.removeAll(); - } - - - /** - * Populates the given Container parent with wrapper objects for all children of parentAC. This method is - * intended to be called when a container is added using a CHILDREN_CHANGED event. - */ - - protected static void populateContainer(java.awt.Container parent, XAccessibleContext parentAC) { - if (parentAC != null) { - try { - int childCount = parentAC.getAccessibleChildCount(); - for (int i=0; i 0 ) - c = new Container(javax.accessibility.AccessibleRole.PANEL, - xAccessible, xAccessibleContext); - else - c = new Label(xAccessible, xAccessibleContext); - break; - case AccessibleRole.TEXT: - c = new TextComponent(xAccessible, xAccessibleContext); - break; - case AccessibleRole.TEXT_FRAME: - c = new Container(javax.accessibility.AccessibleRole.PANEL, - xAccessible, xAccessibleContext); - break; - case AccessibleRole.TOGGLE_BUTTON: - c = new ToggleButton(xAccessible, xAccessibleContext); - break; - case AccessibleRole.TOOL_BAR: - c = new Container(javax.accessibility.AccessibleRole.TOOL_BAR, - xAccessible, xAccessibleContext); - break; - case AccessibleRole.TOOL_TIP: - c = new ToolTip(xAccessible, xAccessibleContext); - break; - case AccessibleRole.TREE: - c = new Tree(xAccessible, xAccessibleContext); - break; - case AccessibleRole.VIEW_PORT: - c = new Container(javax.accessibility.AccessibleRole.VIEWPORT, - xAccessible, xAccessibleContext); - break; - default: - System.err.println("Unmapped accessible object " + role); - System.err.println("usually mapped to " + AccessibleRoleAdapter.getAccessibleRole(role)); - c = new Container(AccessibleRoleAdapter.getAccessibleRole(role), - xAccessible, xAccessibleContext); - break; - } - if (c != null) { - // Add the newly created object to the cache list - synchronized (objectList) { - objectList.put(c.toString(), new WeakReference(c)); - if (Build.DEBUG) { -// System.out.println("Object cache now contains " + objectList.size() + " objects."); - } - } - - AccessibleStateAdapter.setComponentState(c, xAccessibleStateSet); - - if (! Build.PRODUCT) { - String property = System.getProperty("AccessBridgeLogging"); - if ((property != null) && (property.indexOf("event") != -1)) { - XAccessibleEventLog.addEventListener(xAccessibleContext, c); - } - } - } - - return c; - } - - protected static void disposing(java.awt.Component c) { - if (c != null) { - synchronized (objectList) { - objectList.remove(c.toString()); - } - } - } - - public static java.awt.Window getTopWindow(XAccessible xAccessible) { - XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); - - if (xAccessibleContext != null) { - short role = xAccessibleContext.getAccessibleRole(); - XAccessibleStateSet xAccessibleStateSet = xAccessibleContext.getAccessibleStateSet(); - XAccessibleComponent xAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); - - java.awt.Window w; - if (role == AccessibleRole.DIALOG) { - w = new Dialog(new Application(), - xAccessibleContext.getAccessibleName(), - xAccessibleStateSet.contains(AccessibleStateType.MODAL), - xAccessibleComponent); - } else if (role == AccessibleRole.ALERT) { - w = new Alert(new Application(), - xAccessibleContext.getAccessibleName(), - xAccessibleStateSet.contains(AccessibleStateType.MODAL), - xAccessibleComponent); - } else if (role == AccessibleRole.FRAME) { - w = new Frame(xAccessibleContext.getAccessibleName(), - xAccessibleComponent); - } else if (role == AccessibleRole.WINDOW) { - java.awt.Window activeWindow = - java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); - if (activeWindow != null) { - w = new Window(activeWindow, xAccessibleComponent); - } else { - if (Build.DEBUG) { - System.err.println("no active frame found for Window: " + role); - } - return null; - } - } else { - if (Build.DEBUG) { - System.err.println("invalid role for toplevel window: " + role); - } - return null; - } - populateContainer(w, xAccessibleContext, w); - w.setFocusTraversalPolicy(focusTraversalPolicy); - w.setVisible(true); - - // Make the new window the focused one if it has an initialy focused object set. - java.awt.Component c = ((NativeFrame) w).getInitialComponent(); - if (c != null) { - postWindowGainedFocus(w); - } - return w; - } - - return null; - } -} - - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java deleted file mode 100644 index 18f3638ee..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.Accessible; -import com.sun.star.accessibility.AccessibleRelation; -import com.sun.star.accessibility.XAccessible; - -/** - */ -public abstract class AccessibleRelationTypeMap { - - final static String[] data = { - null, - javax.accessibility.AccessibleRelation.CONTROLLED_BY, - javax.accessibility.AccessibleRelation.CONTROLLED_BY, - javax.accessibility.AccessibleRelation.CONTROLLER_FOR, - javax.accessibility.AccessibleRelation.CONTROLLER_FOR, - javax.accessibility.AccessibleRelation.LABEL_FOR, - javax.accessibility.AccessibleRelation.LABEL_FOR, - javax.accessibility.AccessibleRelation.LABELED_BY, - javax.accessibility.AccessibleRelation.LABELED_BY, - javax.accessibility.AccessibleRelation.MEMBER_OF, - javax.accessibility.AccessibleRelation.MEMBER_OF - }; - - public static void fillAccessibleRelationSet(javax.accessibility.AccessibleRelationSet s, AccessibleRelation[] relations) { - AccessibleObjectFactory factory = AccessibleObjectFactory.getDefault(); - for(int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; - -/** This class maps the AccessibleRole(s) of the UNO accessibility API - * to the corresponding javax.accessibility objects. - */ -public abstract class AccessibleRoleAdapter { - - /* This array is used as a mapping between the UNO AccessibleRole - * and the AccessibleRole objects of the Java accessibility API. - */ - public static final javax.accessibility.AccessibleRole[] data = { - javax.accessibility.AccessibleRole.UNKNOWN, - javax.accessibility.AccessibleRole.ALERT, - javax.accessibility.AccessibleRole.COLUMN_HEADER, - javax.accessibility.AccessibleRole.CANVAS, - javax.accessibility.AccessibleRole.CHECK_BOX, - javax.accessibility.AccessibleRole.CHECK_BOX, // CHECK_MENU_ITEM - javax.accessibility.AccessibleRole.COLOR_CHOOSER, - javax.accessibility.AccessibleRole.COMBO_BOX, - javax.accessibility.AccessibleRole.DATE_EDITOR, - javax.accessibility.AccessibleRole.DESKTOP_ICON, - javax.accessibility.AccessibleRole.DESKTOP_PANE, - javax.accessibility.AccessibleRole.DIRECTORY_PANE, - javax.accessibility.AccessibleRole.DIALOG, - javax.accessibility.AccessibleRole.CANVAS, // DOCUMENT - javax.accessibility.AccessibleRole.PANEL, // EMBEDDED_OBJECT - javax.accessibility.AccessibleRole.PANEL, // ENDNOTE - javax.accessibility.AccessibleRole.FILE_CHOOSER, - javax.accessibility.AccessibleRole.FILLER, - javax.accessibility.AccessibleRole.FONT_CHOOSER, - javax.accessibility.AccessibleRole.FOOTER, - javax.accessibility.AccessibleRole.PANEL, // FOOTNOTE - javax.accessibility.AccessibleRole.FRAME, - javax.accessibility.AccessibleRole.GLASS_PANE, - javax.accessibility.AccessibleRole.PANEL, // GRAPHIC - javax.accessibility.AccessibleRole.GROUP_BOX, - javax.accessibility.AccessibleRole.HEADER, - javax.accessibility.AccessibleRole.TEXT, // HEADING - javax.accessibility.AccessibleRole.HYPERLINK, - javax.accessibility.AccessibleRole.ICON, - javax.accessibility.AccessibleRole.INTERNAL_FRAME, - javax.accessibility.AccessibleRole.LABEL, - javax.accessibility.AccessibleRole.LAYERED_PANE, - javax.accessibility.AccessibleRole.LIST, - javax.accessibility.AccessibleRole.LABEL, // LIST_ITEM - required by Zoomtext - javax.accessibility.AccessibleRole.MENU, - javax.accessibility.AccessibleRole.MENU_BAR, - javax.accessibility.AccessibleRole.MENU_ITEM, - javax.accessibility.AccessibleRole.OPTION_PANE, - javax.accessibility.AccessibleRole.PAGE_TAB, - javax.accessibility.AccessibleRole.PAGE_TAB_LIST, - javax.accessibility.AccessibleRole.PANEL, - javax.accessibility.AccessibleRole.PARAGRAPH, - javax.accessibility.AccessibleRole.PASSWORD_TEXT, - javax.accessibility.AccessibleRole.POPUP_MENU, - javax.accessibility.AccessibleRole.PUSH_BUTTON, - javax.accessibility.AccessibleRole.PROGRESS_BAR, - javax.accessibility.AccessibleRole.RADIO_BUTTON, - javax.accessibility.AccessibleRole.RADIO_BUTTON, // RADIO_MENU_ITEM - javax.accessibility.AccessibleRole.ROW_HEADER, - javax.accessibility.AccessibleRole.ROOT_PANE, - javax.accessibility.AccessibleRole.SCROLL_BAR, - javax.accessibility.AccessibleRole.SCROLL_PANE, - javax.accessibility.AccessibleRole.CANVAS, // SHAPE - javax.accessibility.AccessibleRole.SEPARATOR, - javax.accessibility.AccessibleRole.SLIDER, - javax.accessibility.AccessibleRole.SPIN_BOX, - javax.accessibility.AccessibleRole.SPLIT_PANE, - javax.accessibility.AccessibleRole.STATUS_BAR, - javax.accessibility.AccessibleRole.TABLE, - javax.accessibility.AccessibleRole.LABEL, // TABLE_CELL - required by ZoomText - javax.accessibility.AccessibleRole.TEXT, - javax.accessibility.AccessibleRole.PANEL, // TEXT_FRAME - javax.accessibility.AccessibleRole.TOGGLE_BUTTON, - javax.accessibility.AccessibleRole.TOOL_BAR, - javax.accessibility.AccessibleRole.TOOL_TIP, - javax.accessibility.AccessibleRole.TREE, - javax.accessibility.AccessibleRole.VIEWPORT, - javax.accessibility.AccessibleRole.WINDOW, - javax.accessibility.AccessibleRole.RADIO_BUTTON, // BUTTON_DROPDOWN - javax.accessibility.AccessibleRole.RADIO_BUTTON, // BUTTON_MENU - javax.accessibility.AccessibleRole.PANEL, // CAPTION - javax.accessibility.AccessibleRole.PANEL, // CHART - javax.accessibility.AccessibleRole.EDITBAR, - javax.accessibility.AccessibleRole.PANEL, // FORM - javax.accessibility.AccessibleRole.PANEL, // IMAGE_MAP - javax.accessibility.AccessibleRole.PANEL, // NOTE - javax.accessibility.AccessibleRole.PANEL, // PAGE - javax.accessibility.AccessibleRole.RULER, - javax.accessibility.AccessibleRole.PANEL, // SECTION - javax.accessibility.AccessibleRole.LABEL, // TREE_ITEM - javax.accessibility.AccessibleRole.TABLE // TREE_TABLE - }; - - public static javax.accessibility.AccessibleRole getAccessibleRole(short role) { - if(role < data.length) { - if(data[role] == null) { - System.err.println("Unmapped role: " + role); - } - return data[role]; - } - // FIXME: remove debug out - System.err.println("Unmappable role: " + role); - return null; - } - - public static javax.accessibility.AccessibleRole getAccessibleRole(XAccessible unoAccessible) { - try { - XAccessibleContext unoAccessibleContext = unoAccessible.getAccessibleContext(); - if (unoAccessibleContext != null) { - return getAccessibleRole(unoAccessibleContext.getAccessibleRole()); - } - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return javax.accessibility.AccessibleRole.UNKNOWN; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java deleted file mode 100644 index 312460f23..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; - -class AccessibleSelectionImpl implements javax.accessibility.AccessibleSelection { - XAccessibleSelection unoAccessibleSelection; - - AccessibleSelectionImpl(XAccessibleSelection xAccessibleSelection) { - unoAccessibleSelection = xAccessibleSelection; - } - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - try { - return (javax.accessibility.Accessible) AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleSelection.getSelectedAccessibleChild(i)); - } catch (com.sun.star.uno.Exception e) { - return null; - } - } - - /** Adds the specified Accessible child of the object to the object's selection */ - public void addAccessibleSelection(int i) { - try { - unoAccessibleSelection.selectAccessibleChild(i); - } catch (com.sun.star.uno.Exception e) { - } - } - - /** Clears the selection in the object, so that no children in the object are selected */ - public void clearAccessibleSelection() { - try { - unoAccessibleSelection.clearAccessibleSelection(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the number of Accessible children currently selected */ - public int getAccessibleSelectionCount() { - try { - return unoAccessibleSelection.getSelectedAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Determines if the current child of this object is selected */ - public boolean isAccessibleChildSelected(int i) { - try { - return unoAccessibleSelection.isAccessibleChildSelected(i); - } catch (com.sun.star.uno.Exception e) { - return false; - } - } - - /** Removes the specified child of the object from the object's selection */ - public void removeAccessibleSelection(int i) { - try { - unoAccessibleSelection.deselectAccessibleChild(i); - } catch (com.sun.star.uno.Exception e) { - } - } - - /** Causes every child of the object to be selected if the object supports multiple selection */ - public void selectAllAccessibleSelection() { - try { - unoAccessibleSelection.selectAllAccessibleChildren(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java deleted file mode 100644 index 36ed08466..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java +++ /dev/null @@ -1,214 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - -import com.sun.star.uno.AnyConverter; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.XAccessibleStateSet; - -public class AccessibleStateAdapter { - - private static final AccessibleState[] stateTypeMap = { - null, - AccessibleState.ACTIVE, - AccessibleState.ARMED, - AccessibleState.BUSY, - AccessibleState.CHECKED, - AccessibleExtendedState.DEFUNCT, - AccessibleState.EDITABLE, - AccessibleState.ENABLED, - AccessibleState.EXPANDABLE, - AccessibleState.EXPANDED, - AccessibleState.FOCUSABLE, - AccessibleState.FOCUSED, - AccessibleState.HORIZONTAL, - AccessibleState.ICONIFIED, - AccessibleExtendedState.INDETERMINATE, - AccessibleExtendedState.MANAGES_DESCENDANTS, - AccessibleState.MODAL, - AccessibleState.MULTI_LINE, - AccessibleState.MULTISELECTABLE, - AccessibleState.OPAQUE, - AccessibleState.PRESSED, - AccessibleState.RESIZABLE, - AccessibleState.SELECTABLE, - AccessibleState.SELECTED, - AccessibleExtendedState.SENSITIVE, - AccessibleState.SHOWING, - AccessibleState.SINGLE_LINE, - AccessibleExtendedState.STALE, - AccessibleState.TRANSIENT, - AccessibleState.VERTICAL, - AccessibleState.VISIBLE - }; - - private static void printToplevelStateMessage(AccessibleState s, java.awt.Component c) { - System.err.println("*** ERROR *** " + s + " state is a toplevel window state " + c); - } - - private static String getDisplayName(java.awt.Component c) { - javax.accessibility.Accessible a = (javax.accessibility.Accessible) c; - if( a != null) { - javax.accessibility.AccessibleContext ac = a.getAccessibleContext(); - return "[" + ac.getAccessibleRole() + "] " + ac.getAccessibleName(); - } else { - return c.toString(); - } - } - - private static void printOutOfSyncMessage(AccessibleState s, java.awt.Component c, boolean enabled) { - System.err.println("*** ERROR *** " + s + " state out of sync (UNO state set: " + !enabled + ", Java component state: " + enabled + ") for " + getDisplayName(c)); - } - - public static AccessibleState getAccessibleState(Object any) { - try { - if (AnyConverter.isShort(any)) { - return getAccessibleState(AnyConverter.toShort(any)); - } - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - } - - public static AccessibleState getAccessibleState(short unoStateType) { - if (unoStateType > 0 && unoStateType < stateTypeMap.length) { - return stateTypeMap[unoStateType]; - } - return null; - } - - public static AccessibleStateSet getDefunctStateSet() { - AccessibleStateSet ass = new AccessibleStateSet(); - ass.add(AccessibleExtendedState.DEFUNCT); - return ass; - } - - public static void setComponentState(java.awt.Component c, - XAccessibleStateSet xAccessibleStateSet) { - - try { - if (xAccessibleStateSet != null) { - // Set the boundings of the component if it is visible .. - if (!xAccessibleStateSet.contains(AccessibleStateType.VISIBLE)) { - c.setVisible(false); - } - // Set the components' enabled state .. - if (!xAccessibleStateSet.contains(AccessibleStateType.ENABLED)) { - c.setEnabled(false); - } - // Set the components' focusable state .. - if (!xAccessibleStateSet.contains(AccessibleStateType.FOCUSABLE)) { - c.setFocusable(false); - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - public static AccessibleStateSet getAccessibleStateSet(java.awt.Component c, - XAccessibleStateSet xAccessibleStateSet) { - - try { - if (xAccessibleStateSet != null) { - AccessibleStateSet as = new AccessibleStateSet(); - short[] unoStateTypes = xAccessibleStateSet.getStates(); - for (int i=0; i 0 && - unoStateTypes[i] < stateTypeMap.length) { - as.add(stateTypeMap[unoStateTypes[i]]); - } - } - - // Note: COLLAPSED does not exists in the UAA. - if (as.contains(AccessibleState.EXPANDABLE) && - ! as.contains(AccessibleState.EXPANDED)) { - as.add(AccessibleState.COLLAPSED); - } - - // Sync office and Java FOCUSED state - boolean isFocusInSync; - if (c.isFocusOwner()) { - isFocusInSync = !as.add(AccessibleState.FOCUSED); - } else { - isFocusInSync = !as.remove(AccessibleState.FOCUSED); - } - - // Sync office and Java ACTIVE state - boolean isActiveInSync; - if (c instanceof java.awt.Window && ((java.awt.Window) c).isActive()) { - isActiveInSync = !as.add(AccessibleState.ACTIVE); - } else { - isActiveInSync = !as.remove(AccessibleState.ACTIVE); - } - - // Report out-of-sync messages - if (!Build.PRODUCT) { - if (!isFocusInSync) { - printOutOfSyncMessage(AccessibleState.FOCUSED, c, c.isFocusOwner()); - } - if (!isActiveInSync) { - printOutOfSyncMessage(AccessibleState.ACTIVE, c, ((java.awt.Window) c).isActive()); - } - if (as.contains(AccessibleState.ENABLED) != c.isEnabled()) { - printOutOfSyncMessage(AccessibleState.ENABLED, c, c.isEnabled()); - } - if (as.contains(AccessibleState.FOCUSABLE) != c.isFocusable()) { - printOutOfSyncMessage(AccessibleState.FOCUSABLE, c, c.isFocusable()); - } - if (as.contains(AccessibleState.SHOWING) != c.isShowing()) { - printOutOfSyncMessage(AccessibleState.SHOWING, c, c.isShowing()); - } - if (as.contains(AccessibleState.VISIBLE) != c.isVisible()) { - printOutOfSyncMessage(AccessibleState.VISIBLE, c, c.isVisible()); - } - - // The following states are for toplevel windows only - if (! (c instanceof java.awt.Window)) { - if (as.contains(AccessibleState.ACTIVE)) { - printToplevelStateMessage(AccessibleState.ACTIVE, c); - } - if (as.contains(AccessibleState.ICONIFIED)) { - printToplevelStateMessage(AccessibleState.ICONIFIED, c); - } - if (as.contains(AccessibleState.MODAL)) { - printToplevelStateMessage(AccessibleState.MODAL, c); - } - } - } - return as; - } - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return getDefunctStateSet(); - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java deleted file mode 100644 index 112b7744b..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java +++ /dev/null @@ -1,678 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.awt.*; -import com.sun.star.style.*; -import com.sun.star.uno.*; - -import org.openoffice.java.accessibility.logging.*; - -import java.text.BreakIterator; -import java.util.Locale; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleText; - -import javax.swing.text.StyleConstants; - -/** The GenericAccessibleEditableText mapps the calls to the java AccessibleEditableText - * interface to the corresponding methods of the UNO XAccessibleEditableText interface. - */ -public class AccessibleTextImpl implements javax.accessibility.AccessibleText { - final static double toPointFactor = 1 / ((7 / 10) + 34.5); - final static String[] attributeList = { - "ParaAdjust", "CharBackColor", "CharWeight", "ParaFirstLineIndent", - "CharFontPitch", "CharHeight", "CharColor", "CharPosture", - "ParaLeftMargin", "ParaLineSpacing", "ParaTopMargin", "ParaBottomMargin", - "CharStrikeout", "CharEscapement", "ParaTabStops", "CharUnderline" - }; - - final static String[] localeAttributeList = { - "CharLocale", "CharLocaleAsian", "CharLocaleComplex" - }; - - XAccessibleText unoObject; - private javax.swing.text.TabSet tabSet = null; - private javax.swing.text.TabStop[] tabStops = null; - private static Type TextSegmentType = new Type(TextSegment.class); - private static Type UnoLocaleType = new Type(com.sun.star.lang.Locale.class); - - /** Creates new GenericAccessibleEditableText object */ - public AccessibleTextImpl(XAccessibleText xAccessibleText) { - - if (Build.PRODUCT) { - unoObject = xAccessibleText; - } else { - String property = System.getProperty("AccessBridgeLogging"); - if ((property != null) && (property.indexOf("text") != -1)) { - unoObject = new XAccessibleTextLog(xAccessibleText); - } else { - unoObject = xAccessibleText; - } - } - } - - public AccessibleTextImpl() { - } - - public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) { - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoObject); - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - - protected static Object convertTextSegment(Object any) { - try { - if (AnyConverter.isObject(any)) { - TextSegment ts = (TextSegment) - AnyConverter.toObject(TextSegmentType, any); - if (ts != null) { - // Since there is nothing like a "range" object in the JAA yet, - // the Object[3] is a private negotiation with the JABG - Object[] array = { new Integer(ts.SegmentStart), - new Integer(ts.SegmentEnd), ts.SegmentText }; - return array; - } - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - - return null; - } - - /** Returns the locale object. - * - * Since switching the UI language only takes effect on the next - * office start, UI elements can return a cached value here - given - * that Java UNO initializes the default locale correctly, this is - * the perfect place to grab this cached values. - * - * However, since there are more sophisticated components with - * potentially more than one locale, we first check for the - * CharLocale[Asian|Complex] property. - */ - - protected java.util.Locale getLocale(int index) { - try { - com.sun.star.beans.PropertyValue[] propertyValues = - unoObject.getCharacterAttributes(index, localeAttributeList); - - if (null != propertyValues) { - for (int i = 0; i < propertyValues.length; i++) { - com.sun.star.lang.Locale unoLocale = (com.sun.star.lang.Locale) - AnyConverter.toObject(UnoLocaleType, propertyValues[i]); - if (unoLocale != null) { - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } - } - } - - return java.util.Locale.getDefault(); - } catch (com.sun.star.lang.IllegalArgumentException e) { - return java.util.Locale.getDefault(); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return java.util.Locale.getDefault(); - } - } - - - /** Returns the string after a given index - * - * The Java word iterator has a different understanding of what - * a word is than the word iterator used by OOo, so we use the - * Java iterators to ensure maximal compatibility with Java. - */ - public String getAfterIndex(int part, int index) { - switch (part) { - case AccessibleText.CHARACTER: - try { - String s = unoObject.getText(); - return s.substring(index+1, index+2); - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.WORD: - try { - String s = unoObject.getText(); - BreakIterator words = BreakIterator.getWordInstance(getLocale(index)); - words.setText(s); - int start = words.following(index); - if (start == BreakIterator.DONE || start >= s.length()) { - return null; - } - int end = words.following(start); - if (end == BreakIterator.DONE || end >= s.length()) { - return null; - } - return s.substring(start, end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.SENTENCE: - try { - String s = unoObject.getText(); - BreakIterator sentence = - BreakIterator.getSentenceInstance(getLocale(index)); - sentence.setText(s); - int start = sentence.following(index); - if (start == BreakIterator.DONE || start >= s.length()) { - return null; - } - int end = sentence.following(start); - if (end == BreakIterator.DONE || end >= s.length()) { - return null; - } - return s.substring(start, end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case 4: - try { - TextSegment ts = unoObject.getTextBehindIndex(index, AccessibleTextType.LINE); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Workaround for #104847# - if (index > 0 && getCharCount() == index) { - return getAfterIndex(part, index - 1); - } - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - case 5: - try { - TextSegment ts = unoObject.getTextBehindIndex(index, AccessibleTextType.ATTRIBUTE_RUN); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - default: - return null; - } - } - - /** Returns the zero-based offset of the caret */ - public int getCaretPosition() { - try { - return unoObject.getCaretPosition(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the start offset within the selected text */ - public int getSelectionStart() { - try { - int index = unoObject.getSelectionStart(); - - if (index == -1) { - index = getCaretPosition(); - } - - return index; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - protected void setAttribute(javax.swing.text.MutableAttributeSet as, - com.sun.star.beans.PropertyValue property) { - try { - // Map alignment attribute - if (property.Name.equals("ParaAdjust")) { - ParagraphAdjust adjust = null; - - if (property.Value instanceof ParagraphAdjust) { - adjust = (ParagraphAdjust) property.Value; - } else if (property.Value instanceof Any) { - adjust = (ParagraphAdjust) AnyConverter.toObject(new Type( - ParagraphAdjust.class), property.Value); - } else { - adjust = ParagraphAdjust.fromInt(AnyConverter.toInt( - property.Value)); - } - - if (adjust != null) { - if (adjust.equals(ParagraphAdjust.LEFT)) { - StyleConstants.setAlignment(as, - StyleConstants.ALIGN_LEFT); - } else if (adjust.equals(ParagraphAdjust.RIGHT)) { - StyleConstants.setAlignment(as, - StyleConstants.ALIGN_RIGHT); - } else if (adjust.equals(ParagraphAdjust.CENTER)) { - StyleConstants.setAlignment(as, - StyleConstants.ALIGN_CENTER); - } else if (adjust.equals(ParagraphAdjust.BLOCK) || - adjust.equals(ParagraphAdjust.STRETCH)) { - StyleConstants.setAlignment(as, - StyleConstants.ALIGN_JUSTIFIED); - } - } else if (Build.DEBUG) { - System.err.println( - "Invalid property value for key ParaAdjust: " + - property.Value.getClass().getName()); - } - - // Map background color - } else if (property.Name.equals("CharBackColor")) { - StyleConstants.setBackground(as, - new java.awt.Color(AnyConverter.toInt(property.Value))); - - // FIXME: BidiLevel - // Set bold attribute - } else if (property.Name.equals("CharWeight")) { - boolean isBold = AnyConverter.toFloat(property.Value) > 125; - StyleConstants.setBold(as, isBold); - - // FIXME: Java 1.4 ComponentAttribute, ComponentElementName, ComposedTextAttribute - // Set FirstLineIndent attribute - } else if (property.Name.equals("ParaFirstLineIndent")) { - StyleConstants.setFirstLineIndent(as, - (float) (toPointFactor * AnyConverter.toInt(property.Value))); - - // Set font family attribute - } else if (property.Name.equals("CharFontPitch")) { - if (AnyConverter.toShort(property.Value) == 2) { - StyleConstants.setFontFamily(as, "Proportional"); - } - - // Set font size attribute - } else if (property.Name.equals("CharHeight")) { - StyleConstants.setFontSize(as, - (int) AnyConverter.toFloat(property.Value)); - - // Map foreground color - } else if (property.Name.equals("CharColor")) { - StyleConstants.setForeground(as, - new java.awt.Color(AnyConverter.toInt(property.Value))); - - // FIXME: IconAttribute, IconElementName - // Set italic attribute - } else if (property.Name.equals("CharPosture")) { - FontSlant fs = null; - - if (property.Value instanceof FontSlant) { - fs = (FontSlant) property.Value; - } else if (property.Value instanceof Any) { - fs = (FontSlant) AnyConverter.toObject(new Type( - FontSlant.class), property.Value); - } - - if (fs != null) { - StyleConstants.setItalic(as, FontSlant.ITALIC.equals(fs)); - } - - // Set left indent attribute - } else if (property.Name.equals("ParaLeftMargin")) { - StyleConstants.setLeftIndent(as, - (float) (toPointFactor * AnyConverter.toInt(property.Value))); - - // Set right indent attribute - } else if (property.Name.equals("ParaRightMargin")) { - StyleConstants.setRightIndent(as, - (float) (toPointFactor * AnyConverter.toInt(property.Value))); - } - // Set line spacing attribute - else if (property.Name.equals("ParaLineSpacing")) { - LineSpacing ls = null; - - if (property.Value instanceof LineSpacing) { - ls = (LineSpacing) property.Value; - } else if (property.Value instanceof Any) { - ls = (LineSpacing) AnyConverter.toObject(new Type( - LineSpacing.class), property.Value); - } - - if (ls != null) { - StyleConstants.setLineSpacing(as, - (float) (toPointFactor * ls.Height)); - } - } - // FIXME: Java 1.4 NameAttribute, Orientation, ResolveAttribute - // Set space above attribute - else if (property.Name.equals("ParaTopMargin")) { - StyleConstants.setSpaceAbove(as, - (float) (toPointFactor * AnyConverter.toInt(property.Value))); - } - // Set space below attribute - else if (property.Name.equals("ParaBottomMargin")) { - StyleConstants.setSpaceBelow(as, - (float) (toPointFactor * AnyConverter.toInt(property.Value))); - - // Set strike through attribute - } else if (property.Name.equals("CharStrikeout")) { - boolean isStrikeThrough = (FontStrikeout.NONE != AnyConverter.toShort(property.Value)); - StyleConstants.setStrikeThrough(as, isStrikeThrough); - - // Set sub-/superscript attribute - } else if (property.Name.equals("CharEscapement")) { - short value = AnyConverter.toShort(property.Value); - - if (value > 0) { - StyleConstants.setSuperscript(as, true); - } else if (value < 0) { - StyleConstants.setSubscript(as, true); - } - - // Set tabset attribute - } else if (property.Name.equals("ParaTabStops")) { - TabStop[] unoTabStops = (TabStop[]) AnyConverter.toArray(property.Value); - javax.swing.text.TabStop[] tabStops = new javax.swing.text.TabStop[unoTabStops.length]; - - for (int index2 = 0; index2 < unoTabStops.length; index2++) { - float pos = (float) (toPointFactor * unoTabStops[index2].Position); - - if (unoTabStops[index2].Alignment.equals(TabAlign.LEFT)) { - tabStops[index2] = new javax.swing.text.TabStop(pos, - javax.swing.text.TabStop.ALIGN_LEFT, - javax.swing.text.TabStop.LEAD_NONE); - } else if (unoTabStops[index2].Alignment.equals( - TabAlign.CENTER)) { - tabStops[index2] = new javax.swing.text.TabStop(pos, - javax.swing.text.TabStop.ALIGN_CENTER, - javax.swing.text.TabStop.LEAD_NONE); - } else if (unoTabStops[index2].Alignment.equals( - TabAlign.RIGHT)) { - tabStops[index2] = new javax.swing.text.TabStop(pos, - javax.swing.text.TabStop.ALIGN_RIGHT, - javax.swing.text.TabStop.LEAD_NONE); - } else if (unoTabStops[index2].Alignment.equals( - TabAlign.DECIMAL)) { - tabStops[index2] = new javax.swing.text.TabStop(pos, - javax.swing.text.TabStop.ALIGN_DECIMAL, - javax.swing.text.TabStop.LEAD_NONE); - } else { - tabStops[index2] = new javax.swing.text.TabStop(pos); - } - } - - // Re-use tabSet object if possible to make AttributeSet.equals work - if ((this.tabSet == null) || - !java.util.Arrays.equals(tabStops, this.tabStops)) { - this.tabStops = tabStops; - this.tabSet = new javax.swing.text.TabSet(tabStops); - } - - StyleConstants.setTabSet(as, this.tabSet); - - // Set underline attribute - } else if (property.Name.equals("CharUnderline")) { - boolean isUnderline = (FontUnderline.NONE != AnyConverter.toShort(property.Value)); - StyleConstants.setUnderline(as, isUnderline); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - if (Build.DEBUG) { - System.err.println("*** ERROR *** " + e.getClass().getName() + - " caught for property " + property.Name + ": " + - e.getMessage()); - System.err.println(" value is of type " + - property.Value.getClass().getName()); - } - } - } - - /** Returns the AttributSet for a given character at a given index */ - public javax.swing.text.AttributeSet getCharacterAttribute(int index) { - try { - com.sun.star.beans.PropertyValue[] propertyValues = unoObject.getCharacterAttributes(index, - attributeList); - javax.swing.text.SimpleAttributeSet attributeSet = new javax.swing.text.SimpleAttributeSet(); - - if (null != propertyValues) { - for (int i = 0; i < propertyValues.length; i++) { - setAttribute(attributeSet, propertyValues[i]); - } - } - - return attributeSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - if ((index > 0) && (getCharCount() == index)) { - return getCharacterAttribute(index - 1); - } - return null; - } - } - - /** Given a point in local coordinates, return the zero-based index of the character under that point */ - public int getIndexAtPoint(java.awt.Point point) { - try { - return unoObject.getIndexAtPoint(new Point(point.x, point.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the end offset within the selected text */ - public int getSelectionEnd() { - try { - int index = unoObject.getSelectionEnd(); - - if (index == -1) { - index = getCaretPosition(); - } - - return index; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the string before a given index - * - * The Java word iterator has a different understanding of what - * a word is than the word iterator used by OOo, so we use the - * Java iterators to ensure maximal compatibility with Java. - */ - public java.lang.String getBeforeIndex(int part, int index) { - switch (part) { - case AccessibleText.CHARACTER: - try { - String s = unoObject.getText(); - return s.substring(index-1, index); - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.WORD: - try { - String s = unoObject.getText(); - BreakIterator words = BreakIterator.getWordInstance(getLocale(index)); - words.setText(s); - int end = words.following(index); - end = words.previous(); - int start = words.previous(); - if (start == BreakIterator.DONE) { - return null; - } - return s.substring(start, end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.SENTENCE: - try { - String s = unoObject.getText(); - BreakIterator sentence = - BreakIterator.getSentenceInstance(getLocale(index)); - sentence.setText(s); - int end = sentence.following(index); - end = sentence.previous(); - int start = sentence.previous(); - if (start == BreakIterator.DONE) { - return null; - } - return s.substring(start, end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case 4: - try { - TextSegment ts = unoObject.getTextBeforeIndex(index, AccessibleTextType.LINE); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Workaround for #104847# - if (index > 0 && getCharCount() == index) { - return getBeforeIndex(part, index - 1); - } - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - case 5: - try { - TextSegment ts = unoObject.getTextBeforeIndex(index, AccessibleTextType.ATTRIBUTE_RUN); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - default: - return null; - } - } - - - /** Returns the string at a given index - * - * The Java word iterator has a different understanding of what - * a word is than the word iterator used by OOo, so we use the - * Java iterators to ensure maximal compatibility with Java. - */ - public java.lang.String getAtIndex(int part, int index) { - switch (part) { - case AccessibleText.CHARACTER: - try { - String s = unoObject.getText(); - return s.substring(index, index + 1); - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.WORD: - try { - String s = unoObject.getText(); - BreakIterator words = BreakIterator.getWordInstance(getLocale(index)); - words.setText(s); - int end = words.following(index); - return s.substring(words.previous(), end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case AccessibleText.SENTENCE: - try { - String s = unoObject.getText(); - BreakIterator sentence = - BreakIterator.getSentenceInstance(getLocale(index)); - sentence.setText(s); - int end = sentence.following(index); - return s.substring(sentence.previous(), end); - } catch (IllegalArgumentException e) { - return null; - } catch (IndexOutOfBoundsException e) { - return null; - } - case 4: - try { - TextSegment ts = unoObject.getTextAtIndex(index, AccessibleTextType.LINE); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - // Workaround for #104847# - if (index > 0 && getCharCount() == index) { - return getAtIndex(part, index - 1); - } - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - case 5: - try { - TextSegment ts = unoObject.getTextAtIndex(index, AccessibleTextType.ATTRIBUTE_RUN); - return ts.SegmentText; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.lang.IllegalArgumentException e) { - return null; - } - - default: - return null; - } - } - - /** Returns the number of characters (valid indicies) */ - public int getCharCount() { - try { - return unoObject.getCharacterCount(); - } catch (com.sun.star.uno.RuntimeException e) { - } - - return 0; - } - - /** Returns the portion of the text that is selected */ - public java.lang.String getSelectedText() { - try { - return unoObject.getSelectedText(); - } catch (com.sun.star.uno.RuntimeException e) { - } - - return null; - } - - /** Determines the bounding box of the character at the given index into the string */ - public java.awt.Rectangle getCharacterBounds(int index) { - try { - Rectangle unoRect = unoObject.getCharacterBounds(index); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - if ((index > 0) && (getCharCount() == index)) { - return getCharacterBounds(index - 1); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - - return new java.awt.Rectangle(); - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java deleted file mode 100644 index d386e9bcc..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.XAccessibleValue; -import com.sun.star.uno.AnyConverter; - -/** The AccessibleValueImpl mappes the calls to the java AccessibleValue - * interface to the corresponding methods of the UNO XAccessibleValue interface - */ -public class AccessibleValueImpl implements javax.accessibility.AccessibleValue { - protected XAccessibleValue unoObject; - - /** Creates new AccessibleValueImpl */ - public AccessibleValueImpl(XAccessibleValue xAccessibleValue) { - unoObject = xAccessibleValue; - } - - public static java.lang.Number toNumber(java.lang.Object any) { - try { - if(AnyConverter.isByte(any)) { - return new Byte(AnyConverter.toByte(any)); - } else if (AnyConverter.isShort(any)) { - return new Short(AnyConverter.toShort(any)); - } else if (AnyConverter.isInt(any)) { - return new Integer(AnyConverter.toInt(any)); - } else if (AnyConverter.isLong(any)) { - return new Long(AnyConverter.toLong(any)); - } else if (AnyConverter.isFloat(any)) { - return new Float(AnyConverter.toFloat(any)); - } else if (AnyConverter.isDouble(any)) { - return new Double(AnyConverter.toDouble(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - - return null; - } - - public java.lang.Number getMinimumAccessibleValue() { - try { - return toNumber(unoObject.getMinimumValue()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public java.lang.Number getCurrentAccessibleValue() { - try { - return toNumber(unoObject.getCurrentValue()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public java.lang.Number getMaximumAccessibleValue() { - try { - return toNumber(unoObject.getMaximumValue()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public boolean setCurrentAccessibleValue(java.lang.Number number) { - try { - return unoObject.setCurrentValue(number); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Alert.java b/accessibility/bridge/org/openoffice/java/accessibility/Alert.java deleted file mode 100644 index 158fb0d7c..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Alert.java +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleRole; -import com.sun.star.accessibility.*; - -public class Alert extends Dialog { - - protected Alert(java.awt.Frame owner, XAccessibleComponent xAccessibleComponent) { - super(owner, xAccessibleComponent); - } - - protected Alert(java.awt.Frame owner, String name, XAccessibleComponent xAccessibleComponent) { - super(owner, name, xAccessibleComponent); - } - - protected Alert(java.awt.Frame owner, String name, boolean modal, XAccessibleComponent xAccessibleComponent) { - super(owner, name, modal, xAccessibleComponent); - } - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessibleAlert(); - accessibleContext.setAccessibleName(getTitle()); - } - return accessibleContext; - } - - protected class AccessibleAlert extends AccessibleDialog { - - protected AccessibleAlert() { - super(); - } - - public AccessibleRole getAccessibleRole() { - return AccessibleRole.ALERT; - } - }; -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Application.java b/accessibility/bridge/org/openoffice/java/accessibility/Application.java deleted file mode 100644 index c16f30c37..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Application.java +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.Accessible; -import javax.accessibility.AccessibleContext; - -public class Application extends java.awt.Frame implements Accessible { - - protected AccessibleContext accessibleContext = null; - - protected Application() { - super(); - } - - public boolean isShowing() { - return true; - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Button.java b/accessibility/bridge/org/openoffice/java/accessibility/Button.java deleted file mode 100644 index 08cf7d7c6..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Button.java +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -class Button extends AbstractButton implements javax.accessibility.Accessible { - - public Button(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleButtonListener(); - } - - protected class AccessibleButtonListener - extends AccessibleUNOComponentListener { - protected AccessibleButtonListener() { - super(); - } - - protected javax.accessibility.AccessibleContext getContext( Object any ) { - try { - XAccessible xAccessible = (XAccessible) - AnyConverter.toObject( AccessibleObjectFactory.XAccessibleType, any ); - - javax.accessibility.Accessible accessible = - (javax.accessibility.Accessible) Button.this.getComponent( xAccessible ); - - return accessible.getAccessibleContext(); - } catch( com.sun.star.uno.Exception e ) { - return null; - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.CHILD: - java.awt.Component c = getComponent(unoAccessible); - - Object values[] = { null, null }; - - if (AnyConverter.isObject(event.OldValue)) { - values[0] = getContext( event.OldValue ); - } - - if (AnyConverter.isObject(event.NewValue)) { - values[1] = getContext( event.NewValue); - } - - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - values[0], values[1]); - break; - - default: - super.notifyEvent(event); - } - } - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleButton(); - } - - protected java.awt.Component getComponent(XAccessible unoAccessible) { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessible); - - if (c == null) { - c = AccessibleObjectFactory.createAccessibleComponent(unoAccessible); - - if (c instanceof javax.accessibility.Accessible) { - ((javax.accessibility.Accessible) c).getAccessibleContext() - .setAccessibleParent(this); - } - - if( c instanceof java.awt.Container ) { - AccessibleObjectFactory.populateContainer((java.awt.Container) c, unoAccessible.getAccessibleContext() ); - } - } - - return c; - } - - protected class AccessibleButton extends AccessibleAbstractButton { - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.PUSH_BUTTON; - } - - /** Returns the number of accessible children of the object */ - public int getAccessibleChildrenCount() { - try { - return unoAccessibleContext.getAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the specified Accessible child of the object */ - public synchronized javax.accessibility.Accessible getAccessibleChild( int i) { - try { - return (javax.accessibility.Accessible) getComponent( unoAccessibleContext.getAccessibleChild(i) ); - } catch (com.sun.star.uno.RuntimeException e) { - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } - return null; - } - - /* - * AccessibleComponent - */ - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = getComponent(unoAccessibleComponent.getAccessibleAtPoint( - new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java b/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java deleted file mode 100644 index b7a401497..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -class CheckBox extends ToggleButton { - - public CheckBox(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleCheckBox(); - } - - protected class AccessibleCheckBox extends AccessibleToggleButton { - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.CHECK_BOX; - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java b/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java deleted file mode 100644 index 5f36ff42a..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - -import javax.swing.SwingConstants; - - -/** - */ -public class ComboBox extends Container { - private XAccessibleAction unoAccessibleAction = null; - - public ComboBox(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(javax.accessibility.AccessibleRole.COMBO_BOX, xAccessible, - xAccessibleContext); - } - - /** Appends the specified component to the end of this container */ - public java.awt.Component add(java.awt.Component c) { - // List should be always the first child - if (c instanceof List) { - return super.add(c, 0); - } else { - return super.add(c); - } - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleComboBox(); - } - - protected class AccessibleComboBox extends AccessibleContainer - implements javax.accessibility.AccessibleAction { - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleComboBox() { - super(); - } - - /* - * AccessibleContext - */ - - /** Gets the AccessibleAction associated with this object that supports one or more actions */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - if (unoAccessibleAction == null) { - unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class, - unoAccessibleContext); - - if (unoAccessibleAction == null) { - return null; - } - } - - return this; - } - - /* - * AccessibleAction - */ - - /** Performs the specified Action on the object */ - public boolean doAccessibleAction(int param) { - if (param == 0) { - try { - return unoAccessibleAction.doAccessibleAction(0); - } catch (com.sun.star.uno.Exception e) { - } - } - - return false; - } - - /** Returns a description of the specified action of the object */ - public java.lang.String getAccessibleActionDescription(int param) { - return javax.swing.UIManager.getString("ComboBox.togglePopupText"); - } - - /** Returns the number of accessible actions available in this object */ - public int getAccessibleActionCount() { - return 1; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Component.java b/accessibility/bridge/org/openoffice/java/accessibility/Component.java deleted file mode 100644 index 5101080f9..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Component.java +++ /dev/null @@ -1,740 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -public abstract class Component extends java.awt.Component { - public static final Type RectangleType = new Type(com.sun.star.awt.Rectangle.class); - public static final Type SelectionType = new Type(com.sun.star.awt.Selection.class); - - protected XAccessible unoAccessible; - protected XAccessibleContext unoAccessibleContext; - protected XAccessibleComponent unoAccessibleComponent; - - protected boolean disposed = false; - - protected Component(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(); - unoAccessible = xAccessible; - unoAccessibleContext = xAccessibleContext; - unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); - // Add the event listener right away, because the global focus notification doesn't - // work yet .. - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); - if (broadcaster != null) { - broadcaster.addEventListener(createEventListener()); - } - } - - /** - * Determines whether this Component is showing on screen. - * This means that the component must be visible, and it must be in a - * container that is visible and showing. - * @see #addNotify - * @see #removeNotify - * @since JDK1.0 - */ - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - return (parent == null) || parent.isShowing(); - } - return false; - } - - /** - * Makes this Component displayable by connecting it to a - * native screen resource. - * This method is called internally by the toolkit and should - * not be called directly by programs. - * @see #isDisplayable - * @see #removeNotify - * @since JDK1.0 - */ - public void addNotify() { - } - - /** - * Makes this Component undisplayable by destroying it native - * screen resource. - * This method is called by the toolkit internally and should - * not be called directly by programs. - * @see #isDisplayable - * @see #addNotify - * @since JDK1.0 - */ - public void removeNotify() { - } - - /* - * Fake the java focus handling. This is necessary to keep OOo focus - * in sync with the java focus. See java.awt.DefaultKeyboardFocusManager - * for implementation details. - **/ - - /** Requests focus for this object */ - public void requestFocus() { - } - - /** Requests focus for this object */ - public boolean requestFocus(boolean temporary) { - // Must be a no-op to make focus handling work - return true; - } - - /** Requests the focus for this object in the containing window */ - public boolean requestFocusInWindow() { - return requestFocusInWindow(false); - } - - /** Requests the focus for this object in the containing window */ - protected boolean requestFocusInWindow(boolean temporary) { - if (isFocusable() && isVisible()) { - getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary)); - return true; - } - return false; - } - - public Object[] getAccessibleComponents(Object[] targetSet) { - try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); - for (int i=0; i < targetSet.length; i++) { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); - if (c != null) { - list.add(c); - } - } - list.trimToSize(); - return list.toArray(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - protected java.awt.EventQueue getEventQueue() { - return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - } - - protected class PropertyChangeBroadcaster implements Runnable { - String propertyName; - Object oldValue; - Object newValue; - - public PropertyChangeBroadcaster(String name, Object param1, Object param2) { - propertyName = name; - oldValue = param1; - newValue = param2; - } - - public void run() { - // Because this code is executed in the DispatchThread, it is better to catch every - // exception that might occur - try { - AccessibleContext ac = accessibleContext; - if (ac != null) { - ac.firePropertyChange(propertyName, oldValue, newValue); - } - } catch (java.lang.Exception e) { - if (Build.DEBUG) { - System.err.println(e.getClass().getName() + " caught propagating " + propertyName + " event: " + e.getMessage()); - e.printStackTrace(); - } - } - } - } - - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue)); - } - - protected void fireStatePropertyChange(AccessibleState state, boolean set) { - PropertyChangeBroadcaster broadcaster; - -// if (Build.DEBUG) { -// System.err.println("[" + AccessibleRoleAdapter.getAccessibleRole(unoAccessibleContext.getAccessibleRole()) + "] " + -// unoAccessibleContext.getAccessibleName() + " is " + (set ? "now " : "no longer ") + state); -// } - - if (set) { - broadcaster = new PropertyChangeBroadcaster( - accessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, state); - } else { - broadcaster = new PropertyChangeBroadcaster( - accessibleContext.ACCESSIBLE_STATE_PROPERTY, - state, null); - } - getEventQueue().invokeLater(broadcaster); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleUNOComponentListener implements XAccessibleEventListener { - - protected AccessibleUNOComponentListener() { - } - - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.ACTIVE: - // Only frames should be active - break; - case AccessibleStateType.ARMED: - fireStatePropertyChange(AccessibleState.ARMED, enable); - break; - case AccessibleStateType.CHECKED: - fireStatePropertyChange(AccessibleState.CHECKED, enable); - break; - case AccessibleStateType.ENABLED: - setEnabled(enable); - // Since we can't access awt.Componet.accessibleContext, we need to fire - // this event manually .. - fireStatePropertyChange(AccessibleState.ENABLED, enable); - break; - case AccessibleStateType.FOCUSED: - getEventQueue().postEvent(new java.awt.event.FocusEvent( - Component.this, enable ? - java.awt.event.FocusEvent.FOCUS_GAINED : - java.awt.event.FocusEvent.FOCUS_LOST)); - break; - case AccessibleStateType.PRESSED: - fireStatePropertyChange(AccessibleState.PRESSED, enable); - break; - case AccessibleStateType.SELECTED: - fireStatePropertyChange(AccessibleState.SELECTED, enable); - break; - case AccessibleStateType.SENSITIVE: - // This state equals ENABLED in OOo (but not in Gtk+) and does not exist in Java 1.5 - break; - case AccessibleStateType.SHOWING: -// fireStatePropertyChange(AccessibleState.SHOWING, enable); - break; - case AccessibleStateType.VISIBLE: - Component.this.setVisible(enable); - break; - default: - if (Build.DEBUG) { - System.err.println("[component]: " + getName() + "unexpected state change " + state); - } - break; - } - } - - /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ - protected void handleNameChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - if (accessibleContext != null) { - accessibleContext.setAccessibleName(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ - protected void handleDescriptionChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - if (accessibleContext != null) { - accessibleContext.setAccessibleDescription(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the internal states and fires the appropriate PropertyChangedEvent */ - protected void handleStateChangedEvent(Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - setComponentState(AnyConverter.toShort(any1), false); - } - - if (AnyConverter.isShort(any2)) { - setComponentState(AnyConverter.toShort(any2), true); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - - if ( !disposed ) { - - switch (event.EventId) { - case AccessibleEventId.ACTION_CHANGED: - firePropertyChange(accessibleContext.ACCESSIBLE_ACTION_PROPERTY, - toNumber(event.OldValue), toNumber(event.NewValue)); - break; - case AccessibleEventId.NAME_CHANGED: - // Set the accessible name for the corresponding context, which will fire a property - // change event itself - handleNameChangedEvent(event.NewValue); - break; - case AccessibleEventId.DESCRIPTION_CHANGED: - // Set the accessible description for the corresponding context, which will fire a property - // change event itself - so do not set propertyName ! - handleDescriptionChangedEvent(event.NewValue); - break; - case AccessibleEventId.CHILD: - if (Build.DEBUG) { - System.out.println("Unexpected child event for object of role " + getAccessibleContext().getAccessibleRole()); - } - break; - case AccessibleEventId.STATE_CHANGED: - // Update the internal state set and fire the appropriate PropertyChangedEvent - handleStateChangedEvent(event.OldValue, event.NewValue); - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); - break; - case AccessibleEventId.TEXT_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY, - AccessibleTextImpl.convertTextSegment(event.OldValue), - AccessibleTextImpl.convertTextSegment(event.NewValue)); - break; - /* - * the Java AccessBridge for GNOME maps SELECTION_PROPERTY change events - * for objects of role TEXT to object:text-selection-changed - */ - case AccessibleEventId.TEXT_SELECTION_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null); - break; - case AccessibleEventId.CARET_CHANGED: - firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue)); - break; - case AccessibleEventId.VALUE_CHANGED: - firePropertyChange(accessibleContext.ACCESSIBLE_VALUE_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue)); - default: - // Warn about unhandled events - if(Build.DEBUG) { - System.out.println(this + ": unhandled accessibility event id=" + event.EventId); - } - } - } - } - - /** Called by OpenOffice process to notify that the UNO component is disposing */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposed = true; - AccessibleObjectFactory.disposing(Component.this); - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleUNOComponentListener(); - } - - protected javax.accessibility.AccessibleContext accessibleContext = null; - - /** This method actually creates the AccessibleContext object returned by - * getAccessibleContext(). - */ - protected javax.accessibility.AccessibleContext createAccessibleContext() { - return null; - } - - /** Returns the AccessibleContext associated with this object */ - public final javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - try { - AccessibleContext ac = createAccessibleContext(); - if (ac != null) { - // Set accessible name and description here to avoid - // unnecessary property change events later .. - ac.setAccessibleName(unoAccessibleContext.getAccessibleName()); - ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription()); - accessibleContext = ac; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return accessibleContext; - } - - protected abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent - implements javax.accessibility.AccessibleExtendedComponent { - - protected java.awt.event.ComponentListener accessibleComponentHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when shown/hidden.. - */ - protected class AccessibleComponentHandler implements java.awt.event.ComponentListener { - public void componentHidden(java.awt.event.ComponentEvent e) { - AccessibleUNOComponent.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.VISIBLE, null); - } - - public void componentShown(java.awt.event.ComponentEvent e) { - AccessibleUNOComponent.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, AccessibleState.VISIBLE); - } - - public void componentMoved(java.awt.event.ComponentEvent e) { - } - - public void componentResized(java.awt.event.ComponentEvent e) { - } - } // inner class AccessibleComponentHandler - - protected java.awt.event.FocusListener accessibleFocusHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when focus events happen - */ - protected class AccessibleFocusHandler implements java.awt.event.FocusListener { - public void focusGained(java.awt.event.FocusEvent event) { - AccessibleUNOComponent.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, AccessibleState.FOCUSED); - if (Build.DEBUG) { - System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is now focused"); - } - } - public void focusLost(java.awt.event.FocusEvent event) { - AccessibleUNOComponent.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.FOCUSED, null); - if (Build.DEBUG) { - System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is no longer focused"); - } - } - } // inner class AccessibleFocusHandler - - protected int propertyChangeListenerCount = 0; - - /** - * Add a PropertyChangeListener to the listener list. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (propertyChangeListenerCount++ == 0) { - accessibleComponentHandler = new AccessibleComponentHandler(); - Component.this.addComponentListener(accessibleComponentHandler); - - accessibleFocusHandler = new AccessibleFocusHandler(); - Component.this.addFocusListener(accessibleFocusHandler); - } - super.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (--propertyChangeListenerCount == 0) { - Component.this.removeComponentListener(accessibleComponentHandler); - accessibleComponentHandler = null; - - Component.this.removeFocusListener(accessibleFocusHandler); - accessibleFocusHandler = null; - } - super.removePropertyChangeListener(listener); - } - - /** - * Gets the current state set of this object. - * - * @return an instance of AccessibleStateSet - * containing the current state set of the object - * @see AccessibleState - */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - if (disposed) - return AccessibleStateAdapter.getDefunctStateSet(); - - try { - return AccessibleStateAdapter.getAccessibleStateSet(Component.this, - unoAccessibleContext.getAccessibleStateSet()); - } catch (com.sun.star.uno.RuntimeException e) { - return AccessibleStateAdapter.getDefunctStateSet(); - } - } - - /** Gets the locale of the component */ - public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { - try { - com.sun.star.lang.Locale unoLocale = unoAccessible.getAccessibleContext().getLocale(); - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } catch (IllegalAccessibleComponentStateException e) { - throw new java.awt.IllegalComponentStateException(e.getMessage()); - } catch (com.sun.star.uno.RuntimeException e) { - return java.util.Locale.getDefault(); - } - } - - /* - * AccessibleExtendedComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoAccessibleComponent.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoAccessibleComponent.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return Component.this.isEnabled(); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return Component.this.isVisible(); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return Component.this.isShowing(); - } - - public boolean contains(java.awt.Point p) { - try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); -// if (Build.DEBUG) { -// System.err.println("Returning location on screen( " + unoPoint.X + ", " + unoPoint.Y + " )" ); -// } - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - // Not supported by this implementation - return null; - } - - public boolean isFocusTraversable() { - return Component.this.isFocusable(); - } - - public void requestFocus() { - unoAccessibleComponent.grabFocus(); - } - - public String getToolTipText() { - try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) - UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); - if (unoAccessibleExtendedComponent != null) { - return unoAccessibleExtendedComponent.getToolTipText(); - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - return null; - } - - public String getTitledBorderText() { - try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) - UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); - if (unoAccessibleExtendedComponent != null) { - return unoAccessibleExtendedComponent.getTitledBorderText(); - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - return null; - } - - public javax.accessibility.AccessibleKeyBinding getAccessibleKeyBinding() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); - if (unoAccessibleAction != null) { - XAccessibleKeyBinding unoAccessibleKeyBinding = unoAccessibleAction.getAccessibleActionKeyBinding(0); - if (unoAccessibleKeyBinding != null) { - return new AccessibleKeyBinding(unoAccessibleKeyBinding); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - return null; - } - } - - // Extract a number from a UNO any - public static java.lang.Number toNumber(java.lang.Object any) { - try { - if (AnyConverter.isByte(any)) { - return new Byte(AnyConverter.toByte(any)); - } else if (AnyConverter.isShort(any)) { - return new Short(AnyConverter.toShort(any)); - } else if (AnyConverter.isInt(any)) { - return new Integer(AnyConverter.toInt(any)); - } else if (AnyConverter.isLong(any)) { - return new Long(AnyConverter.toLong(any)); - } else if (AnyConverter.isFloat(any)) { - return new Float(AnyConverter.toFloat(any)); - } else if (AnyConverter.isDouble(any)) { - return new Double(AnyConverter.toDouble(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - throw new IllegalArgumentException(e.getMessage()); - } - return null; - } - - public String toString() { - return UnoRuntime.generateOid(unoAccessible); - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Container.java b/accessibility/bridge/org/openoffice/java/accessibility/Container.java deleted file mode 100644 index b04707560..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Container.java +++ /dev/null @@ -1,763 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -public class Container extends java.awt.Container implements javax.accessibility.Accessible { - - protected XAccessible unoAccessible; - protected XAccessibleContext unoAccessibleContext; - protected XAccessibleComponent unoAccessibleComponent = null; - - protected javax.accessibility.AccessibleRole accessibleRole; - protected javax.accessibility.AccessibleText accessibleText; - protected boolean disposed = false; - - protected Container(javax.accessibility.AccessibleRole role, - XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - accessibleRole = role; - unoAccessible = xAccessible; - unoAccessibleContext = xAccessibleContext; - unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, - xAccessibleContext); - - // Add the event listener right away, because the global focus notification doesn't - // work yet .. - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleContext); - if (broadcaster != null) { - broadcaster.addEventListener(createEventListener()); - } - } - - /** - * Determines whether this Container is showing on screen. - * This means that the component must be visible, and it must be in a - * container that is visible and showing. - * @see #addNotify - * @see #removeNotify - * @since JDK1.0 - */ - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - return (parent == null) || parent.isShowing(); - } - return false; - } - - /** - * Makes this Container displayable by connecting it to a - * native screen resource. - * This method is called internally by the toolkit and should - * not be called directly by programs. - * @see #isDisplayable - * @see #removeNotify - * @since JDK1.0 - */ - public void addNotify() { - } - - /** - * Makes this Container undisplayable by destroying it native - * screen resource. - * This method is called by the toolkit internally and should - * not be called directly by programs. - * @see #isDisplayable - * @see #addNotify - * @since JDK1.0 - */ - public void removeNotify() { - } - - /* - * Fake the java focus handling. This is necessary to keep OOo focus - * in sync with the java focus. See java.awt.DefaultKeyboardFocusManager - * for implementation details. - **/ - - /** Requests focus for this object */ - public void requestFocus() { - } - - /** Requests focus for this object */ - public boolean requestFocus(boolean temporary) { - // Must be a no-op to make focus handling work - return true; - } - - /** Requests the focus for this object in the containing window */ - public boolean requestFocusInWindow() { - return requestFocusInWindow(false); - } - - /** Requests the focus for this object in the containing window */ - protected boolean requestFocusInWindow(boolean temporary) { - if (isFocusable() && isVisible()) { - getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary)); - return true; - } - return false; - } - - public Object[] getAccessibleComponents(Object[] targetSet) { - try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); - for (int i=0; i < targetSet.length; i++) { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); - if (c != null) { - list.add(c); - } - } - list.trimToSize(); - return list.toArray(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - protected java.awt.EventQueue getEventQueue() { - return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - } - - protected class PropertyChangeBroadcaster implements Runnable { - String propertyName; - Object oldValue; - Object newValue; - - public PropertyChangeBroadcaster(String name, Object param1, Object param2) { - propertyName = name; - oldValue = param1; - newValue = param2; - } - - public void run() { - // Because this code is executed in the DispatchThread, it is better tocatch every - // exception that might occur - try { - AccessibleContext ac = Container.this.accessibleContext; - if (ac != null) { - ac.firePropertyChange(propertyName, oldValue, newValue); - } - } catch (java.lang.Exception e) { - if (Build.DEBUG) { - System.err.println(e.getClass().getName() + " caught propagating " + propertyName + " event: " + e.getMessage()); - e.printStackTrace(); - } - } - } - } - - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue)); - } - - protected void fireStatePropertyChange(AccessibleState state, boolean set) { - PropertyChangeBroadcaster broadcaster; - if (set) { - broadcaster = new PropertyChangeBroadcaster( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, state); - } else { - broadcaster = new PropertyChangeBroadcaster( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - state, null); - } - getEventQueue().invokeLater(broadcaster); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleContainerListener implements XAccessibleEventListener { - - protected AccessibleContainerListener() { - } - - protected java.awt.EventQueue getEventQueue() { - return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - } - - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.ACTIVE: - // Only frames should be active - break; - case AccessibleStateType.ENABLED: - setEnabled(enable); - // Since we can't access awt.Componet.accessibleContext, we need to fire - // this event manually .. - fireStatePropertyChange(AccessibleState.ENABLED, enable); - break; - case AccessibleStateType.FOCUSED: - getEventQueue().postEvent(new java.awt.event.FocusEvent( - Container.this, enable ? - java.awt.event.FocusEvent.FOCUS_GAINED : - java.awt.event.FocusEvent.FOCUS_LOST)); - break; - case AccessibleStateType.SELECTED: - fireStatePropertyChange(AccessibleState.SELECTED, enable); - break; - case AccessibleStateType.SENSITIVE: - // This state equals ENABLED in OOo (but not in Gtk+) and does not exist in Java 1.5 - break; - case AccessibleStateType.SHOWING: - case AccessibleStateType.VISIBLE: - setVisible(enable); - break; - default: - if (Build.DEBUG) { - System.err.println(Container.this + "unexpected state change " + state); - } - break; - } - } - /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ - protected void handleNameChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - if (accessibleContext != null) { - accessibleContext.setAccessibleName(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ - protected void handleDescriptionChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - if (accessibleContext != null) { - accessibleContext.setAccessibleDescription(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the internal states and fires the appropriate PropertyChangedEvent */ - protected void handleStateChangedEvent(Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - setComponentState(AnyConverter.toShort(any1), false); - } - - if (AnyConverter.isShort(any2)) { - setComponentState(AnyConverter.toShort(any2), true); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /* This event is only necessary because some objects in the office don't know their parent - * and are therefor unable to revoke and re-insert themselves. - */ - protected void handleAllChildrenChangedEvent() { - javax.accessibility.Accessible parent = (javax.accessibility.Accessible) getParent(); - if (parent != null) { - javax.accessibility.AccessibleContext parentAC = parent.getAccessibleContext(); - if (parentAC != null) { - - parentAC.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - Container.this, - null); - - AccessibleObjectFactory.clearContainer(Container.this); - AccessibleObjectFactory.populateContainer(Container.this, unoAccessibleContext); - - parentAC.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, - Container.this); - } - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - - if ( !disposed ) { - - switch (event.EventId) { - case AccessibleEventId.NAME_CHANGED: - // Set the accessible name for the corresponding context, which will fire a property - // change event itself - handleNameChangedEvent(event.NewValue); - break; - case AccessibleEventId.DESCRIPTION_CHANGED: - // Set the accessible description for the corresponding context, which will fire a property - // change event itself - so do not set propertyName ! - handleDescriptionChangedEvent(event.NewValue); - break; - case AccessibleEventId.STATE_CHANGED: - // Update the internal state set and fire the appropriate PropertyChangedEvent - handleStateChangedEvent(event.OldValue, event.NewValue); - break; - case AccessibleEventId.TEXT_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY, - AccessibleTextImpl.convertTextSegment(event.OldValue), - AccessibleTextImpl.convertTextSegment(event.NewValue)); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - AccessibleObjectFactory.removeChild(Container.this, event.OldValue); - } else if (AnyConverter.isObject(event.NewValue)) { - AccessibleObjectFactory.addChild(Container.this, event.NewValue); - } - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); - break; - /* - * the Java AccessBridge for GNOME maps SELECTION_PROPERTY change events - * for objects of role TEXT to object:text-selection-changed - */ - case AccessibleEventId.TEXT_SELECTION_CHANGED: - case AccessibleEventId.SELECTION_CHANGED: - firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null); - break; - case AccessibleEventId.INVALIDATE_ALL_CHILDREN: - handleAllChildrenChangedEvent(); - break; - default: - // Warn about unhandled events - if(Build.DEBUG) { - System.out.println(this + ": unhandled accessibility event id=" + event.EventId); - } - } - } - } - - /** Called by OpenOffice process to notify that the UNO component is disposing */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - disposed = true; - AccessibleObjectFactory.disposing(Container.this); - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleContainerListener(); - } - - protected javax.accessibility.AccessibleContext accessibleContext = null; - - /** This method actually creates the AccessibleContext object returned by - * getAccessibleContext(). - */ - protected javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleContainer(); - } - - /** Returns the AccessibleContext associated with this object */ - public final javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - try { - AccessibleContext ac = createAccessibleContext(); - if (ac != null) { - // Set accessible name and description here to avoid - // unnecessary property change events later .. - ac.setAccessibleName(unoAccessibleContext.getAccessibleName()); - ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription()); - accessibleContext = ac; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return accessibleContext; - } - - protected class AccessibleContainer extends java.awt.Container.AccessibleAWTContainer { - - protected AccessibleContainer() { - /* Since getAccessibleText() is heavily used by the java access - * bridge for gnome and the gnome at-tools, we do a query interface - * here and remember the result. - */ - accessibleText = AccessibleTextImpl.get(unoAccessibleContext); - } - - protected AccessibleContainer(boolean query) { - /* This constructor is explicitly for subclasses that implement - * AccessibleHypertext and therefor the default constructor would - * bring unnecessary overhead. - */ - } - - protected java.awt.event.ComponentListener accessibleComponentHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when shown/hidden.. - */ - protected class AccessibleComponentHandler implements java.awt.event.ComponentListener { - public void componentHidden(java.awt.event.ComponentEvent e) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.VISIBLE, null); - } - - public void componentShown(java.awt.event.ComponentEvent e) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, AccessibleState.VISIBLE); - } - - public void componentMoved(java.awt.event.ComponentEvent e) { - } - - public void componentResized(java.awt.event.ComponentEvent e) { - } - } // inner class AccessibleContainerHandler - - protected java.awt.event.FocusListener accessibleFocusHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when focus events happen - */ - protected class AccessibleFocusHandler implements java.awt.event.FocusListener { - public void focusGained(java.awt.event.FocusEvent event) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, AccessibleState.FOCUSED); - if (Build.DEBUG) { - System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is now focused"); - } - } - public void focusLost(java.awt.event.FocusEvent event) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.FOCUSED, null); - if (Build.DEBUG) { - System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is no longer focused"); - } - } - } // inner class AccessibleFocusHandler - - protected java.awt.event.ContainerListener accessibleContainerHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when children added/removed. - */ - - protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { - public void componentAdded(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, ((javax.accessibility.Accessible) c).getAccessibleContext()); - } - } - public void componentRemoved(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleContainer.this.firePropertyChange( - AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); - } - } - } - - protected int propertyChangeListenerCount = 0; - - /** - * Add a PropertyChangeListener to the listener list. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (propertyChangeListenerCount++ == 0) { - accessibleFocusHandler = new AccessibleFocusHandler(); - Container.this.addFocusListener(accessibleFocusHandler); - - accessibleContainerHandler = new AccessibleContainerHandler(); - Container.this.addContainerListener(accessibleContainerHandler); - - accessibleComponentHandler = new AccessibleComponentHandler(); - Container.this.addComponentListener(accessibleComponentHandler); - } - super.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (--propertyChangeListenerCount == 0) { - Container.this.removeComponentListener(accessibleComponentHandler); - accessibleComponentHandler = null; - - Container.this.removeContainerListener(accessibleContainerHandler); - accessibleContainerHandler = null; - - Container.this.removeFocusListener(accessibleFocusHandler); - accessibleFocusHandler = null; - } - super.removePropertyChangeListener(listener); - } - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return accessibleRole; - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - return accessibleText; - } - - /** - * Gets the current state set of this object. - * - * @return an instance of AccessibleStateSet - * containing the current state set of the object - * @see AccessibleState - */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - if (disposed) - return AccessibleStateAdapter.getDefunctStateSet(); - - try { - return AccessibleStateAdapter.getAccessibleStateSet(Container.this, - unoAccessibleContext.getAccessibleStateSet()); - } catch (com.sun.star.uno.RuntimeException e) { - return AccessibleStateAdapter.getDefunctStateSet(); - } - } - - /** Returns the AccessibleSelection interface for this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - try { - XAccessibleSelection unoAccessibleSelection = (XAccessibleSelection) - UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); - if (unoAccessibleSelection != null) { - return new AccessibleSelectionImpl(unoAccessibleSelection); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - - return null; - } - - /** Gets the locale of the component */ - public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { - try { - com.sun.star.lang.Locale unoLocale = unoAccessible.getAccessibleContext().getLocale(); - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } catch (IllegalAccessibleComponentStateException e) { - throw new java.awt.IllegalComponentStateException(e.getMessage()); - } catch (com.sun.star.uno.RuntimeException e) { - return super.getLocale(); - } - } - - /* - * AccessibleComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoAccessibleComponent.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoAccessibleComponent.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return Container.this.isEnabled(); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return Container.this.isVisible(); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return Container.this.isShowing(); - } - - public boolean contains(java.awt.Point p) { - try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public boolean isFocusTraversable() { - return Container.this.isFocusable(); - } - - public void requestFocus() { - unoAccessibleComponent.grabFocus(); - } - } - - public String toString() { - return UnoRuntime.generateOid(unoAccessible); - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java b/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java deleted file mode 100644 index 039eea34d..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; - -import javax.accessibility.AccessibleState; - - -public abstract class DescendantManager extends Component { - protected XAccessibleSelection unoAccessibleSelection = null; - protected javax.accessibility.Accessible activeDescendant = null; - protected boolean multiselectable = false; - - protected DescendantManager(XAccessible xAccessible, - XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected DescendantManager(XAccessible xAccessible, - XAccessibleContext xAccessibleContext, boolean multiselectable) { - super(xAccessible, xAccessibleContext); - this.multiselectable = multiselectable; - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleDescendantManagerListener - extends AccessibleUNOComponentListener { - protected AccessibleDescendantManagerListener() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, - unoAccessibleContext); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.SELECTION_CHANGED: - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, - null, null); - - break; - - default: - super.notifyEvent(event); - } - } - } - - protected abstract class AccessibleDescendantManager - extends AccessibleUNOComponent - implements javax.accessibility.AccessibleSelection { - protected AccessibleDescendantManager() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, - unoAccessibleContext); - } - - /* - * AccessibleContext - */ - - /** Returns the number of accessible children of the object */ - public int getAccessibleChildrenCount() { - try { - return unoAccessibleContext.getAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the AccessibleSelection interface for this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - return (unoAccessibleSelection != null) ? this : null; - } - - /* - * AccessibleSelection - */ - - /** Adds the specified Accessible child of the object to the object's selection */ - public void addAccessibleSelection(int i) { - try { - unoAccessibleSelection.selectAccessibleChild(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Clears the selection in the object, so that no children in the object are selected */ - public void clearAccessibleSelection() { - try { - unoAccessibleSelection.clearAccessibleSelection(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the number of Accessible children currently selected */ - public int getAccessibleSelectionCount() { - try { - return unoAccessibleSelection.getSelectedAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Determines if the current child of this object is selected */ - public boolean isAccessibleChildSelected(int i) { - try { - return unoAccessibleSelection.isAccessibleChildSelected(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Removes the specified child of the object from the object's selection */ - public void removeAccessibleSelection(int i) { - try { - unoAccessibleSelection.deselectAccessibleChild(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Causes every child of the object to be selected if the object supports multiple selection */ - public void selectAllAccessibleSelection() { - try { - unoAccessibleSelection.selectAllAccessibleChildren(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java deleted file mode 100644 index 64b5572a2..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java +++ /dev/null @@ -1,633 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -public class Dialog extends java.awt.Dialog implements javax.accessibility.Accessible, NativeFrame { - protected XAccessibleComponent unoAccessibleComponent; - - boolean opened = false; - boolean visible = false; - boolean active = false; - - java.awt.EventQueue eventQueue = null; - - protected Dialog(java.awt.Frame owner, XAccessibleComponent xAccessibleComponent) { - super(owner); - initialize(xAccessibleComponent); - } - - protected Dialog(java.awt.Frame owner, String name, XAccessibleComponent xAccessibleComponent) { - super(owner, name); - initialize(xAccessibleComponent); - } - - protected Dialog(java.awt.Frame owner, String name, boolean modal, XAccessibleComponent xAccessibleComponent) { - super(owner, name, modal); - initialize(xAccessibleComponent); - } - - private void initialize(XAccessibleComponent xAccessibleComponent) { - unoAccessibleComponent = xAccessibleComponent; - eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - xAccessibleComponent); - if (broadcaster != null) { - broadcaster.addEventListener(new AccessibleDialogListener()); - } - } - - java.awt.Component initialComponent = null; - - public java.awt.Component getInitialComponent() { - return initialComponent; - } - - public void setInitialComponent(java.awt.Component c) { - initialComponent = c; - } - - public Integer getHWND() { - return null; - } - - /** - * Determines whether this Component is showing on screen. - * This means that the component must be visible, and it must be in a - * container that is visible and showing. - * @see #addNotify - * @see #removeNotify - * @since JDK1.0 - */ - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - return (parent == null) || parent.isShowing(); - } - return false; - } - - /** - * Makes this Component displayable by connecting it to a - * native screen resource. - * This method is called internally by the toolkit and should - * not be called directly by programs. - * @see #isDisplayable - * @see #removeNotify - * @since JDK1.0 - */ - public void addNotify() { -// createHierarchyEvents(0, null, null, 0, false); - } - - /** - * Makes this Component undisplayable by destroying it native - * screen resource. - * This method is called by the toolkit internally and should - * not be called directly by programs. - * @see #isDisplayable - * @see #addNotify - * @since JDK1.0 - */ - public void removeNotify() { - } - - /** - * Determines if the object is visible. Note: this means that the - * object intends to be visible; however, it may not in fact be - * showing on the screen because one of the objects that this object - * is contained by is not visible. To determine if an object is - * showing on the screen, use isShowing. - * - * @return true if object is visible; otherwise, false - */ - public boolean isVisible(){ - return visible; - } - - /** - * Shows or hides this component depending on the value of parameter - * b. - * @param b if true, shows this component; - * otherwise, hides this component - * @see #isVisible - * @since JDK1.1 - */ - public void setVisible(boolean b) { - if (visible != b){ - visible = b; - if (b) { - // If it is the first show, fire WINDOW_OPENED event - if (!opened) { - postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED); - opened = true; - } - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN); - } else { - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN); - } - } - } - - public void dispose() { - setVisible(false); - postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED); - } - - protected void postWindowEvent(int i) { - eventQueue.postEvent(new java.awt.event.WindowEvent(this, i)); - } - - protected void postComponentEvent(int i) { - eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i)); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleDialogListener implements XAccessibleEventListener { - - protected AccessibleDialogListener() { - } - - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.ACTIVE: - active = enable; - if (enable) { - AccessibleObjectFactory.postWindowActivated(Dialog.this); - } else { - AccessibleObjectFactory.postWindowLostFocus(Dialog.this); - } - break; - case AccessibleStateType.ICONIFIED: - postWindowEvent(enable ? - java.awt.event.WindowEvent.WINDOW_ICONIFIED : - java.awt.event.WindowEvent.WINDOW_DEICONIFIED); - break; - case AccessibleStateType.VISIBLE: - Dialog.this.setVisible(enable); - break; - default: - if (Build.DEBUG) { - System.err.println("[dialog]: " + getTitle() + "unexpected state change " + state); - } - break; - } - } - - /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ - protected void handleNameChangedEvent(Object any) { - try { - String title = AnyConverter.toString(any); - setTitle(title); - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac!= null) { - ac.setAccessibleName(title); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ - protected void handleDescriptionChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac!= null) { - ac.setAccessibleDescription(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the internal states and fires the appropriate PropertyChangedEvent */ - protected void handleStateChangedEvent(Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - setComponentState(AnyConverter.toShort(any1), false); - } - - if (AnyConverter.isShort(any2)) { - setComponentState(AnyConverter.toShort(any2), true); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Fires a visible data property change event */ - protected void handleVisibleDataEvent() { - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac != null) { - ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.NAME_CHANGED: - // Set the accessible name for the corresponding context, which will fire a property - // change event itself - handleNameChangedEvent(event.NewValue); - break; - case AccessibleEventId.DESCRIPTION_CHANGED: - // Set the accessible description for the corresponding context, which will fire a property - // change event itself - so do not set propertyName ! - handleDescriptionChangedEvent(event.NewValue); - break; - case AccessibleEventId.STATE_CHANGED: - // Update the internal state set and fire the appropriate PropertyChangedEvent - handleStateChangedEvent(event.OldValue, event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - AccessibleObjectFactory.removeChild(Dialog.this, event.OldValue); - } else if (AnyConverter.isObject(event.NewValue)) { - AccessibleObjectFactory.addChild(Dialog.this, event.NewValue); - } - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - handleVisibleDataEvent(); - break; - default: - // Warn about unhandled events - if(Build.DEBUG) { - System.out.println(this + ": unhandled accessibility event id=" + event.EventId); - } - } - } - - /** Called by OpenOffice process to notify that the UNO component is disposing */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - } - } - - javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessibleDialog(); - accessibleContext.setAccessibleName(getTitle()); - } - return accessibleContext; - } - - protected class AccessibleDialog extends java.awt.Dialog.AccessibleAWTDialog { - protected AccessibleDialog() { - super(); - } - - protected java.awt.event.ComponentListener accessibleComponentHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when shown/hidden.. - */ - protected class AccessibleComponentHandler implements java.awt.event.ComponentListener { - public void componentHidden(java.awt.event.ComponentEvent e) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - javax.accessibility.AccessibleState.VISIBLE, null); - } - - public void componentShown(java.awt.event.ComponentEvent e) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, javax.accessibility.AccessibleState.VISIBLE); - } - - public void componentMoved(java.awt.event.ComponentEvent e) { - } - - public void componentResized(java.awt.event.ComponentEvent e) { - } - } // inner class AccessibleComponentHandler - - protected java.awt.event.WindowListener accessibleWindowHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when window events happen - */ - protected class AccessibleWindowHandler implements java.awt.event.WindowListener { - /** Invoked when the Window is set to be the active Window. */ - public void windowActivated(java.awt.event.WindowEvent e) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, javax.accessibility.AccessibleState.ACTIVE); - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " is now active"); - } - } - - /** Invoked when a window has been closed as the result of calling dispose on the window. */ - public void windowClosed(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " has been closed"); - } - } - - /** Invoked when the user attempts to close the window from the window's system menu. */ - public void windowClosing(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " is closing"); - } - } - - /** Invoked when a Window is no longer the active Window. */ - public void windowDeactivated(java.awt.event.WindowEvent e) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - javax.accessibility.AccessibleState.ACTIVE, null); - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " is no longer active"); - } - } - - /** Invoked when a window is changed from a minimized to a normal state. */ - public void windowDeiconified(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " has been deiconified"); - } - } - - /** Invoked when a window is changed from a normal to a minimized state. */ - public void windowIconified(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " has been iconified"); - } - } - - /** Invoked the first time a window is made visible. */ - public void windowOpened(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[Dialog] " + getTitle() + " has been opened"); - } - } - - } // inner class AccessibleWindowHandler - - protected java.awt.event.ContainerListener accessibleContainerHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when children added/removed. - */ - - protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { - public void componentAdded(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, ((javax.accessibility.Accessible) c).getAccessibleContext()); - } - } - public void componentRemoved(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleDialog.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); - } - } - } - - protected int propertyChangeListenerCount = 0; - - /** - * Add a PropertyChangeListener to the listener list. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (propertyChangeListenerCount++ == 0) { - accessibleWindowHandler = new AccessibleWindowHandler(); - Dialog.this.addWindowListener(accessibleWindowHandler); - - accessibleContainerHandler = new AccessibleContainerHandler(); - Dialog.this.addContainerListener(accessibleContainerHandler); - - accessibleComponentHandler = new AccessibleComponentHandler(); - Dialog.this.addComponentListener(accessibleComponentHandler); - } - super.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (--propertyChangeListenerCount == 0) { - Dialog.this.removeComponentListener(accessibleComponentHandler); - accessibleComponentHandler = null; - - Dialog.this.removeContainerListener(accessibleContainerHandler); - accessibleContainerHandler = null; - - Dialog.this.removeWindowListener(accessibleWindowHandler); - accessibleWindowHandler = null; - } - super.removePropertyChangeListener(listener); - } - - /* - * AccessibleComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoAccessibleComponent.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoAccessibleComponent.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return Dialog.this.isEnabled(); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return Dialog.this.isVisible(); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return Dialog.this.isShowing(); - } - - public boolean contains(java.awt.Point p) { - try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public boolean isFocusTraversable() { - return Dialog.this.isFocusable(); - } - - public void requestFocus() { - unoAccessibleComponent.grabFocus(); - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java b/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java deleted file mode 100644 index 0f1c03c94..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - - -public class FocusTraversalPolicy extends java.awt.FocusTraversalPolicy { - - protected javax.accessibility.Accessible getSelectedAccessibleChild(javax.accessibility.Accessible a) { - javax.accessibility.AccessibleContext ac = a.getAccessibleContext(); - if (ac != null) { - javax.accessibility.AccessibleSelection as = ac.getAccessibleSelection(); - if (as != null) { - return as.getAccessibleSelection(0); - } - } - return null; - } - - /** Returns the Component that should receive the focus after aComponent */ - public java.awt.Component getComponentAfter(java.awt.Container focusCycleRoot, - java.awt.Component aComponent) { - return null; - } - - /** Returns the Component that should receive the focus before aComponent */ - public java.awt.Component getComponentBefore(java.awt.Container focusCycleRoot, - java.awt.Component aComponent) { - return null; - } - - /** Returns the default Component to focus */ - public java.awt.Component getDefaultComponent(java.awt.Container focusCycleRoot) { - // getDefaultComponent must not return null for Windows to make them focusable. - if (focusCycleRoot instanceof NativeFrame) { - java.awt.Component c = ((NativeFrame) focusCycleRoot).getInitialComponent(); - if (c != null) { - return c; - } - } - - if (focusCycleRoot instanceof javax.accessibility.Accessible) { - return (java.awt.Component) getSelectedAccessibleChild((javax.accessibility.Accessible) focusCycleRoot); - } - return null; - } - - /** Returns the first Component in the traversal cycle */ - public java.awt.Component getFirstComponent(java.awt.Container focusCycleRoot) { - return null; - } - - /** Returns the Component that should receive the focus when a Window is made visible for the first time */ - public java.awt.Component getInitialComponent(java.awt.Window window) { - if (window instanceof NativeFrame) { - return ((NativeFrame) window).getInitialComponent(); - } - return null; - } - - /** Returns the last Component in the traversal cycle */ - public java.awt.Component getLastComponent(java.awt.Container focusCycleRoot) { - return null; - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java deleted file mode 100644 index 7768afdc8..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java +++ /dev/null @@ -1,646 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -public class Frame extends java.awt.Frame implements javax.accessibility.Accessible, NativeFrame { - protected XAccessibleComponent unoAccessibleComponent; - - boolean opened = false; - boolean visible = false; - boolean active = false; - - java.awt.EventQueue eventQueue = null; - - protected Frame(XAccessibleComponent xAccessibleComponent) { - initialize(xAccessibleComponent); - } - - protected Frame(String name, XAccessibleComponent xAccessibleComponent) { - super(name); - initialize(xAccessibleComponent); - } - - private void initialize(XAccessibleComponent xAccessibleComponent) { - unoAccessibleComponent = xAccessibleComponent; - eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); - if (broadcaster != null) { - broadcaster.addEventListener(new AccessibleFrameListener()); - } - } - - java.awt.Component initialComponent = null; - - public java.awt.Component getInitialComponent() { - return initialComponent; - } - - public void setInitialComponent(java.awt.Component c) { - initialComponent = c; - } - - public Integer getHWND() { - return null; - } - - /** - * Determines whether this Component is showing on screen. - * This means that the component must be visible, and it must be in a - * container that is visible and showing. - * @see #addNotify - * @see #removeNotify - * @since JDK1.0 - */ - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - return (parent == null) || parent.isShowing(); - } - return false; - } - - /** - * Makes this Component displayable by connecting it to a - * native screen resource. - * This method is called internally by the toolkit and should - * not be called directly by programs. - * @see #isDisplayable - * @see #removeNotify - * @since JDK1.0 - */ - public void addNotify() { -// createHierarchyEvents(0, null, null, 0, false); - } - - /** - * Makes this Component undisplayable by destroying it native - * screen resource. - * This method is called by the toolkit internally and should - * not be called directly by programs. - * @see #isDisplayable - * @see #addNotify - * @since JDK1.0 - */ - public void removeNotify() { - } - - /** - * Determines if the object is visible. Note: this means that the - * object intends to be visible; however, it may not in fact be - * showing on the screen because one of the objects that this object - * is contained by is not visible. To determine if an object is - * showing on the screen, use isShowing. - * - * @return true if object is visible; otherwise, false - */ - public boolean isVisible(){ - return visible; - } - - /** - * Shows or hides this component depending on the value of parameter - * b. - * @param b if true, shows this component; - * otherwise, hides this component - * @see #isVisible - * @since JDK1.1 - */ - public void setVisible(boolean b) { - if (visible != b){ - visible = b; - if (b) { - // If it is the first show, fire WINDOW_OPENED event - if (!opened) { - postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED); - opened = true; - } - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN); - } else { - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN); - } - } - } - - public void dispose() { - setVisible(false); - postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED); - } - - protected void postWindowEvent(int i) { - eventQueue.postEvent(new java.awt.event.WindowEvent(this, i)); - } - - protected void postComponentEvent(int i) { - eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i)); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleFrameListener implements XAccessibleEventListener { - - protected AccessibleFrameListener() { - } - - // The only expected state changes are ACTIVE and VISIBLE - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.ACTIVE: - active = enable; - if (enable) { - AccessibleObjectFactory.postWindowActivated(Frame.this); - } else { - AccessibleObjectFactory.postWindowLostFocus(Frame.this); - } - break; - case AccessibleStateType.ICONIFIED: - if (Build.DEBUG) { - System.err.println("[frame]" + getTitle() + (enable ? " is now " : " is no longer ") + "iconified"); - } - postWindowEvent(enable ? - java.awt.event.WindowEvent.WINDOW_ICONIFIED : - java.awt.event.WindowEvent.WINDOW_DEICONIFIED); - break; - case AccessibleStateType.VISIBLE: - Frame.this.setVisible(enable); - break; - default: - if (Build.DEBUG) { - System.err.println("[frame]: " + getTitle() + "unexpected state change " + state); - } - break; - } - } - - /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ - protected void handleNameChangedEvent(Object any) { - try { - String title = AnyConverter.toString(any); - setTitle(title); - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac!= null) { - ac.setAccessibleName(title); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ - protected void handleDescriptionChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac!= null) { - ac.setAccessibleDescription(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the internal states and fires the appropriate PropertyChangedEvent */ - protected void handleStateChangedEvent(Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - setComponentState(AnyConverter.toShort(any1), false); - } - - if (AnyConverter.isShort(any2)) { - setComponentState(AnyConverter.toShort(any2), true); - } - } - - catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Fires a visible data property change event */ - protected void handleVisibleDataEvent() { - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac != null) { - ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.NAME_CHANGED: - // Set the accessible name for the corresponding context, which will fire a property - // change event itself - handleNameChangedEvent(event.NewValue); - break; - case AccessibleEventId.DESCRIPTION_CHANGED: - // Set the accessible description for the corresponding context, which will fire a property - // change event itself - so do not set propertyName ! - handleDescriptionChangedEvent(event.NewValue); - break; - case AccessibleEventId.STATE_CHANGED: - // Update the internal state set and fire the appropriate PropertyChangedEvent - handleStateChangedEvent(event.OldValue, event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - AccessibleObjectFactory.removeChild(Frame.this, event.OldValue); - } else if (AnyConverter.isObject(event.NewValue)) { - AccessibleObjectFactory.addChild(Frame.this, event.NewValue); - } - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - handleVisibleDataEvent(); - break; - default: - // Warn about unhandled events - if(Build.DEBUG) { - System.out.println(this + ": unhandled accessibility event id=" + event.EventId); - } - } - } - - /** Called by OpenOffice process to notify that the UNO component is disposing */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - } - } - - protected javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessibleFrame(); - accessibleContext.setAccessibleName(getTitle()); - } - return accessibleContext; - } - - protected class AccessibleFrame extends java.awt.Frame.AccessibleAWTFrame { - protected AccessibleFrame() { - super(); - } - - protected java.awt.event.ComponentListener accessibleComponentHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when shown/hidden.. - */ - protected class AccessibleComponentHandler implements java.awt.event.ComponentListener { - public void componentHidden(java.awt.event.ComponentEvent e) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - javax.accessibility.AccessibleState.VISIBLE, null); - } - - public void componentShown(java.awt.event.ComponentEvent e) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, javax.accessibility.AccessibleState.VISIBLE); - } - - public void componentMoved(java.awt.event.ComponentEvent e) { - } - - public void componentResized(java.awt.event.ComponentEvent e) { - } - } // inner class AccessibleComponentHandler - - protected java.awt.event.WindowListener accessibleWindowHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when window events happen - */ - protected class AccessibleWindowHandler implements java.awt.event.WindowListener { - /** Invoked when the Window is set to be the active Window. */ - public void windowActivated(java.awt.event.WindowEvent e) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, javax.accessibility.AccessibleState.ACTIVE); - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " is now active"); - } - } - - /** Invoked when a window has been closed as the result of calling dispose on the window. */ - public void windowClosed(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " has been closed"); - } - } - - /** Invoked when the user attempts to close the window from the window's system menu. */ - public void windowClosing(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " is closing"); - } - } - - /** Invoked when a Window is no longer the active Window. */ - public void windowDeactivated(java.awt.event.WindowEvent e) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - javax.accessibility.AccessibleState.ACTIVE, null); - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " is no longer active"); - } - } - - /** Invoked when a window is changed from a minimized to a normal state. */ - public void windowDeiconified(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " is no longer iconified"); - } - } - - /** Invoked when a window is changed from a normal to a minimized state. */ - public void windowIconified(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " has been iconified"); - } - } - - /** Invoked the first time a window is made visible. */ - public void windowOpened(java.awt.event.WindowEvent e) { - if (Build.DEBUG) { - System.err.println("[frame] " + getTitle() + " has been opened"); - } - } - - } // inner class AccessibleWindowHandler - - protected java.awt.event.ContainerListener accessibleContainerHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when children added/removed. - */ - - protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { - public void componentAdded(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, ((javax.accessibility.Accessible) c).getAccessibleContext()); - } - } - public void componentRemoved(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleFrame.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); - } - } - } - - protected int propertyChangeListenerCount = 0; - - /** - * Add a PropertyChangeListener to the listener list. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (propertyChangeListenerCount++ == 0) { - accessibleWindowHandler = new AccessibleWindowHandler(); - Frame.this.addWindowListener(accessibleWindowHandler); - - accessibleContainerHandler = new AccessibleContainerHandler(); - Frame.this.addContainerListener(accessibleContainerHandler); - - accessibleComponentHandler = new AccessibleComponentHandler(); - Frame.this.addComponentListener(accessibleComponentHandler); - } - super.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (--propertyChangeListenerCount == 0) { - Frame.this.removeComponentListener(accessibleComponentHandler); - accessibleComponentHandler = null; - - Frame.this.removeContainerListener(accessibleContainerHandler); - accessibleContainerHandler = null; - - Frame.this.removeWindowListener(accessibleWindowHandler); - accessibleWindowHandler = null; - } - super.removePropertyChangeListener(listener); - } - - /** - * Get the state set of this object. - * - * @return an instance of AccessibleState containing the current state - * of the object - * @see AccessibleState - */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - javax.accessibility.AccessibleStateSet states = super.getAccessibleStateSet(); - if ((getExtendedState() & java.awt.Frame.ICONIFIED) > 0) { - states.add(javax.accessibility.AccessibleState.ICONIFIED); - } - return states; - } - - /* - * AccessibleComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoAccessibleComponent.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoAccessibleComponent.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return Frame.this.isEnabled(); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return Frame.this.isVisible(); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return Frame.this.isShowing(); - } - - public boolean contains(java.awt.Point p) { - try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public boolean isFocusTraversable() { - return Frame.this.isFocusable(); - } - - public void requestFocus() { - unoAccessibleComponent.grabFocus(); - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Icon.java b/accessibility/bridge/org/openoffice/java/accessibility/Icon.java deleted file mode 100644 index 1dd151eaf..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Icon.java +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - - -/** - */ -public class Icon extends Component implements javax.accessibility.Accessible { - protected Icon(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleIcon(); - } - - protected class AccessibleIcon extends AccessibleUNOComponent { - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleIcon() { - super(); - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { - try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) UnoRuntime.queryInterface(XAccessibleImage.class, - unoAccessibleComponent); - - if (unoAccessibleImage != null) { - javax.accessibility.AccessibleIcon[] icons = { - new AccessibleIconImpl(unoAccessibleImage) - }; - - return icons; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - - return null; - } - - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Label.java b/accessibility/bridge/org/openoffice/java/accessibility/Label.java deleted file mode 100644 index 62c2155c7..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Label.java +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - - -/** - */ -public class Label extends Component implements javax.accessibility.Accessible { - protected Label(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleLabel(); - } - - protected class AccessibleLabel extends AccessibleUNOComponent { - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleLabel() { - super(); - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.LABEL; - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, - unoAccessibleContext); - - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the relation set of this object */ - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet(); - - if (unoAccessibleRelationSet == null) { - return null; - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.LABEL_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABEL_FOR, - getAccessibleComponents( - unoAccessibleRelation.TargetSet))); - - break; - - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - getAccessibleComponents( - unoAccessibleRelation.TargetSet))); - - break; - - default: - break; - } - } - - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/List.java b/accessibility/bridge/org/openoffice/java/accessibility/List.java deleted file mode 100644 index 7a0a86d16..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/List.java +++ /dev/null @@ -1,452 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.accessibility.*; - -public class List extends DescendantManager implements javax.accessibility.Accessible { - - protected List(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected void setActiveDescendant(javax.accessibility.Accessible descendant) { - javax.accessibility.Accessible oldAD = activeDescendant; - activeDescendant = descendant; - firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, - oldAD, descendant); - } - - protected void setActiveDescendant(Object any) { - javax.accessibility.Accessible descendant = null; - try { - if (AnyConverter.isObject(any)) { - XAccessible unoAccessible = (XAccessible) AnyConverter.toObject( - AccessibleObjectFactory.XAccessibleType, any); - if (unoAccessible != null) { - // FIXME: have to handle non transient objects here .. - descendant = new ListItem(unoAccessible); - if (Build.DEBUG) { - try { - if (Build.DEBUG) { - System.err.println("[List] retrieved active descendant event: new descendant is " + - unoAccessible.getAccessibleContext().getAccessibleName()); - } - } catch (java.lang.NullPointerException e) { - System.err.println("*** ERROR *** new active descendant not accessible"); - } - } - } - } - setActiveDescendant(descendant); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void add(XAccessible unoAccessible) { - if (unoAccessible != null) { - ListItem item = new ListItem(unoAccessible); - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, item.getAccessibleContext()); - } - } - - protected void remove(XAccessible unoAccessible) { - if (unoAccessible != null) { - ListItem item = new ListItem(unoAccessible); - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - item.getAccessibleContext(), null); - } - } - - protected void add(Object any) { - try { - add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void remove(Object any) { - try { - remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleListListener extends AccessibleDescendantManagerListener { - - protected AccessibleListListener() { - super(); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED: - setActiveDescendant(event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - remove(event.OldValue); - } - if (AnyConverter.isObject(event.NewValue)) { - add(event.NewValue); - } - break; - case AccessibleEventId.INVALIDATE_ALL_CHILDREN: - // Since List items a transient a child events are mostly used - // to attach/detach listeners, it is save to ignore it here - break; - default: - super.notifyEvent(event); - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleListListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleList(); - } - - protected class AccessibleList extends AccessibleDescendantManager { - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.LIST; - } - - /** Returns the specified Accessible child of the object */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = List.this.activeDescendant; - if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new ListItem(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleComponent - */ - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y)); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = List.this.activeDescendant; - if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new ListItem(xAccessible); - } - } - return child; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleSelection.getSelectedAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = List.this.activeDescendant; - if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new ListItem(xAccessible); - } - } else if (Build.DEBUG) { - System.out.println(i + "th selected child is not accessible"); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - if (Build.DEBUG) { - System.err.println("IndexOutOfBoundsException caught for AccessibleList.getAccessibleSelection(" + i + ")"); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - } - - class ListItem extends java.awt.Component implements javax.accessibility.Accessible { - - protected XAccessible unoAccessible; - - public ListItem(XAccessible xAccessible) { - unoAccessible = xAccessible; - } - - public Object[] create(Object[] targetSet) { - try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); - for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( - XAccessible.class, targetSet[i]); - if (xAccessible != null) { - list.add(new ListItem(xAccessible)); - } - } - list.trimToSize(); - return list.toArray(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - try { - XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - javax.accessibility.AccessibleContext ac = new AccessibleListItem(xAccessibleContext); - if (ac != null) { - ac.setAccessibleParent(List.this); - accessibleContext = ac; - } - AccessibleStateAdapter.setComponentState(this, xAccessibleContext.getAccessibleStateSet()); - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return accessibleContext; - } - - protected class AccessibleListItem extends javax.accessibility.AccessibleContext { - - XAccessibleContext unoAccessibleContext; - - public AccessibleListItem(XAccessibleContext xAccessibleContext) { - unoAccessibleContext = xAccessibleContext; - } - - /** Returns the accessible name of this object */ - public String getAccessibleName() { - try { - return unoAccessibleContext.getAccessibleName(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleName(String name) { - // Not supported - } - - /** Returns the accessible name of this object */ - public String getAccessibleDescription() { - try { - return unoAccessibleContext.getAccessibleDescription(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleDescription(String name) { - // Not supported - } - - /** Returns the accessible role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - try { - javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole( - unoAccessibleContext.getAccessibleRole()); - return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL; - } catch(com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the locale of the component */ - public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { - try { - com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale(); - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } catch (IllegalAccessibleComponentStateException e) { - throw new java.awt.IllegalComponentStateException(e.getMessage()); - } catch (com.sun.star.uno.RuntimeException e) { - return List.this.getLocale(); - } - } - - /** Gets the 0-based index of this object in its accessible parent */ - public int getAccessibleIndexInParent() { - try { - return unoAccessibleContext.getAccessibleIndexInParent(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the number of accessible children of the object. */ - public int getAccessibleChildrenCount() { - try { - return unoAccessibleContext.getAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the specified Accessible child of the object. */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = List.this.activeDescendant; - if ((activeDescendant instanceof ListItem) && ((ListItem) activeDescendant).unoAccessible.equals(xAccessible)) { - child = activeDescendant; - } else if (xAccessible != null) { - child = new ListItem(xAccessible); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Returns the state set of this object */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - try { - return AccessibleStateAdapter.getAccessibleStateSet(ListItem.this, - unoAccessibleContext.getAccessibleStateSet()); - } catch (com.sun.star.uno.RuntimeException e) { - return AccessibleStateAdapter.getDefunctStateSet(); - } - } - - /** Gets the AccessibleComponent associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleComponent getAccessibleComponent() { - try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); - return (unoAccessibleComponent != null) ? - new AccessibleComponentImpl(unoAccessibleComponent) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleAction associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); - return (unoAccessibleAction != null) ? - new AccessibleActionImpl(unoAccessibleAction) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); - return (unoAccessibleText != null) ? - new AccessibleTextImpl(unoAccessibleText) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleValue associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleValue getAccessibleValue() { - try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); - return (unoAccessibleValue != null) ? - new AccessibleValueImpl(unoAccessibleValue) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { - try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); - if (unoAccessibleImage != null) { - javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; - return icons; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java deleted file mode 100644 index 7ece90dcc..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java +++ /dev/null @@ -1,328 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; - - -public class Menu extends AbstractButton - implements javax.accessibility.Accessible { - private java.util.Vector children; - protected XAccessibleSelection unoAccessibleSelection = null; - - protected Menu(XAccessible xAccessible, - XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - - try { - // Create a vector with the correct initial capacity - int count = unoAccessibleContext.getAccessibleChildCount(); - children = new java.util.Vector(count); - - // Fill the vector with objects - for (int i = 0; i < count; i++) { - java.awt.Component c = getComponent(unoAccessibleContext.getAccessibleChild(i)); - - if (c != null) { - children.add(c); - } - } - } catch (com.sun.star.uno.RuntimeException e) { - if (Build.DEBUG) { - System.err.println( - "RuntimeException caught during menu initialization: " + - e.getMessage()); - } - - if (children == null) { - children = new java.util.Vector(0); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } - } - - protected synchronized void add(XAccessible unoAccessible) { - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - java.awt.Component c = getComponent(unoAccessible); - - if (c != null) { - try { - children.add(unoAccessible.getAccessibleContext() - .getAccessibleIndexInParent(), c); - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, - ((javax.accessibility.Accessible) c).getAccessibleContext()); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - } - - protected synchronized void remove(XAccessible unoAccessible) { - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - java.awt.Component c = getComponent(unoAccessible); - - if (c != null) { - try { - children.remove(c); - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), - null); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - } - - protected void add(Object any) { - try { - add((XAccessible) AnyConverter.toObject( - AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void remove(Object any) { - try { - remove((XAccessible) AnyConverter.toObject( - AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected synchronized int indexOf(Object child) { - return children.indexOf(child); - } - - protected java.awt.Component getComponent(XAccessible unoAccessible) { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessible); - - if (c == null) { - c = AccessibleObjectFactory.createAccessibleComponent(unoAccessible); - - if (c instanceof javax.accessibility.Accessible) { - ((javax.accessibility.Accessible) c).getAccessibleContext() - .setAccessibleParent(this); - } - } - - return c; - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleMenuListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleMenu(); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleMenuListener - extends AccessibleUNOComponentListener { - protected AccessibleMenuListener() { - super(); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.CHILD: - - if (AnyConverter.isObject(event.OldValue)) { - remove(event.OldValue); - } - - if (AnyConverter.isObject(event.NewValue)) { - add(event.NewValue); - } - - break; - - // #i56539# Java 1.5 does not fire ACCESSIBLE_SELECTION_PROPERTY for menus - case AccessibleEventId.SELECTION_CHANGED: - break; - - default: - super.notifyEvent(event); - } - } - } - - protected class AccessibleMenu extends AccessibleAbstractButton - implements javax.accessibility.AccessibleSelection { - protected AccessibleMenu() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, - unoAccessibleContext); - } - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.MENU; - } - - /** Gets the 0-based index of this object in its accessible parent */ - public int getAccessibleIndexInParent() { - if (getAccessibleParent() instanceof Menu) { - return ((Menu) getAccessibleParent()).indexOf(Menu.this); - } else { - return super.getAccessibleIndexInParent(); - } - } - - /** Returns the number of accessible children of the object */ - public synchronized int getAccessibleChildrenCount() { - return children.size(); - } - - /** Returns the specified Accessible child of the object */ - public synchronized javax.accessibility.Accessible getAccessibleChild( - int i) { - try { - if (i < children.size()) { - return (javax.accessibility.Accessible) children.get(i); - } else { - return null; - } - } catch (ArrayIndexOutOfBoundsException e) { - return null; - } - } - - /** Returns the AccessibleSelection interface for this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - // This method is called to determine the SELECTABLE state of every - // child, so don't do the query interface here. - return this; - } - - /* - * AccessibleComponent - */ - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessibleComponent.getAccessibleAtPoint( - new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - try { - return (javax.accessibility.Accessible) getComponent(unoAccessibleSelection.getSelectedAccessibleChild( - i)); - } catch (java.lang.Exception e) { - /* - * Possible exceptions are: - * java.lang.NullPointerException - * com.sun.star.uno.RuntimeException - * com.sun.star.lang.IndexOutOfBoundsException - */ - return null; - } - } - - /** Adds the specified Accessible child of the object to the object's selection */ - public void addAccessibleSelection(int i) { - try { - javax.accessibility.Accessible a = getAccessibleChild(i); - - // selecting menu items invokes the click action in Java 1.5 - if( a instanceof MenuItem ) - a.getAccessibleContext().getAccessibleAction().doAccessibleAction(0); - else - unoAccessibleSelection.selectAccessibleChild(i); - } catch (java.lang.Exception e) { - /* - * Possible exceptions are: - * java.lang.NullPointerException - * com.sun.star.uno.RuntimeException - * com.sun.star.lang.IndexOutOfBoundsException - */ - } - } - - /** Clears the selection in the object, so that no children in the object are selected */ - public void clearAccessibleSelection() { - try { - unoAccessibleSelection.clearAccessibleSelection(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the number of Accessible children currently selected */ - public int getAccessibleSelectionCount() { - try { - return unoAccessibleSelection.getSelectedAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Determines if the current child of this object is selected */ - public boolean isAccessibleChildSelected(int i) { - try { - return unoAccessibleSelection.isAccessibleChildSelected(i); - } catch (java.lang.Exception e) { - /* - * Possible exceptions are: - * java.lang.NullPointerException - * com.sun.star.uno.RuntimeException - * com.sun.star.lang.IndexOutOfBoundsException - */ - return false; - } - } - - /** Removes the specified child of the object from the object's selection */ - public void removeAccessibleSelection(int i) { - if (isAccessibleChildSelected(i)) { - clearAccessibleSelection(); - } - } - - /** Causes every child of the object to be selected if the object supports multiple selection */ - public void selectAllAccessibleSelection() { - // not supported - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java b/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java deleted file mode 100644 index 090c122f3..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java +++ /dev/null @@ -1,167 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -/** - * Specialized container for MenuBar and Popup-Menu(s) - * FIXME: join with Menu ? - */ -public class MenuContainer extends Container implements javax.accessibility.Accessible { - - protected XAccessibleSelection unoAccessibleSelection = null; - - protected MenuContainer(javax.accessibility.AccessibleRole role, XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(role, xAccessible, xAccessibleContext); - } - - protected class AccessibleMenuContainerListener extends AccessibleContainerListener { - - protected AccessibleMenuContainerListener() { - super(); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - - // #i56539# Java 1.5 does not fire ACCESSIBLE_SELECTION_PROPERTY for menus - case AccessibleEventId.SELECTION_CHANGED: - break; - - default: - super.notifyEvent(event); - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleMenuContainerListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleMenuContainer(); - } - - protected class AccessibleMenuContainer extends AccessibleContainer implements javax.accessibility.AccessibleSelection { - - protected AccessibleMenuContainer() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, - unoAccessibleContext); - } - - /** Returns the AccessibleSelection interface for this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - return this; - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - try { - return (javax.accessibility.Accessible) AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleSelection.getSelectedAccessibleChild(i)); - } catch (com.sun.star.uno.Exception e) { - return null; - } - } - - /** Adds the specified Accessible child of the object to the object's selection */ - public void addAccessibleSelection(int i) { - try { - javax.accessibility.Accessible a = getAccessibleChild(i); - - // selecting menu items invokes the click action in Java 1.5 - if( a instanceof MenuItem ) - a.getAccessibleContext().getAccessibleAction().doAccessibleAction(0); - else - unoAccessibleSelection.selectAccessibleChild(i); - } catch (java.lang.Exception e) { - /* - * Possible exceptions are: - * java.lang.NullPointerException - * com.sun.star.uno.RuntimeException - * com.sun.star.lang.IndexOutOfBoundsException - */ - } - } - - /** Clears the selection in the object, so that no children in the object are selected */ - public void clearAccessibleSelection() { - try { - unoAccessibleSelection.clearAccessibleSelection(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the number of Accessible children currently selected */ - public int getAccessibleSelectionCount() { - try { - return unoAccessibleSelection.getSelectedAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Determines if the current child of this object is selected */ - public boolean isAccessibleChildSelected(int i) { - try { - return unoAccessibleSelection.isAccessibleChildSelected(i); - } catch (java.lang.Exception e) { - /* - * Possible exceptions are: - * java.lang.NullPointerException - * com.sun.star.uno.RuntimeException - * com.sun.star.lang.IndexOutOfBoundsException - */ - return false; - } - } - - /** Removes the specified child of the object from the object's selection */ - public void removeAccessibleSelection(int i) { - if (isAccessibleChildSelected(i)) { - clearAccessibleSelection(); - } - } - - /** Causes every child of the object to be selected if the object supports multiple selection */ - public void selectAllAccessibleSelection() { - // not supported - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java b/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java deleted file mode 100644 index 56886bcb7..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEventListener; - - -class MenuItem extends ToggleButton { - public MenuItem(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected class AccessibleMenuItemListener extends AccessibleUNOComponentListener { - - protected AccessibleMenuItemListener() { - } - - protected void setComponentState(short state, boolean enable) { - - // #i56538# menu items in Java 1.5 are ARMED, not SELECTED - if( state == com.sun.star.accessibility.AccessibleStateType.SELECTED ) - fireStatePropertyChange(javax.accessibility.AccessibleState.ARMED, enable); - else - super.setComponentState(state, enable); - } - }; - - protected XAccessibleEventListener createEventListener() { - return new AccessibleMenuItemListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleMenuItem(); - } - - protected class AccessibleMenuItem extends AccessibleToggleButton { - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.MENU_ITEM; - } - - /** Gets the 0-based index of this object in its accessible parent */ - public int getAccessibleIndexInParent() { - if (getAccessibleParent() instanceof Menu) { - return ((Menu) getAccessibleParent()).indexOf(MenuItem.this); - } else { - return super.getAccessibleIndexInParent(); - } - } - - /** - * Gets the current state set of this object. - * - * @return an instance of AccessibleStateSet - * containing the current state set of the object - * @see AccessibleState - */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - javax.accessibility.AccessibleStateSet stateSet = super.getAccessibleStateSet(); - - // #i56538# menu items in Java do not have SELECTABLE .. - stateSet.remove(javax.accessibility.AccessibleState.SELECTABLE); - - // .. and also ARMED insted of SELECTED - if( stateSet.remove(javax.accessibility.AccessibleState.SELECTED) ) - stateSet.add(javax.accessibility.AccessibleState.ARMED); - - return stateSet; - } - - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java b/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java deleted file mode 100644 index d11bf4a44..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -public interface NativeFrame { - public java.awt.Component getInitialComponent(); - public void setInitialComponent(java.awt.Component c); -// public Integer getHWND(); -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java b/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java deleted file mode 100644 index 62d5441e9..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleText; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -/** - */ -public class Paragraph extends Container implements javax.accessibility.Accessible { - - protected Paragraph(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(javax.accessibility.AccessibleRole.TEXT, xAccessible, xAccessibleContext); - } - - protected class AccessibleParagraphListener extends AccessibleContainerListener { - - protected AccessibleParagraphListener() { - super(); - } - - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.EDITABLE: - fireStatePropertyChange(javax.accessibility.AccessibleState.EDITABLE, enable); - break; - case AccessibleStateType.MULTI_LINE: - fireStatePropertyChange(javax.accessibility.AccessibleState.MULTI_LINE, enable); - break; - case AccessibleStateType.SINGLE_LINE: - break; - default: - super.setComponentState(state, enable); - break; - } - } - - - protected void handleVisibleDataChanged() { - if (Paragraph.this.isFocusOwner()) { - AccessibleContext ac = accessibleContext; - if (ac != null) { - AccessibleText at = ac.getAccessibleText(); - if (at != null) { - int pos = at.getCaretPosition(); - // Simulating a caret event here should help at tools - // that re not aware of the paragraph approach of OOo. - firePropertyChange(ac.ACCESSIBLE_CARET_PROPERTY, - new Integer(-1), new Integer(pos)); - } - } - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.CARET_CHANGED: - firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, - Component.toNumber(event.OldValue), - Component.toNumber(event.NewValue)); - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - // Whenever a paragraph gets inserted above the currently - // focused one, this is the only event that will occur for. - handleVisibleDataChanged(); - default: - super.notifyEvent(event); - break; - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleParagraphListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleParagraph(); - } - - protected class AccessibleParagraph extends AccessibleContainer { - - protected AccessibleParagraph() { - // Don't do the queryInterface on XAccessibleText already .. - super(false); - /* Since getAccessibleText() is heavily used by the java access - * bridge for gnome and the gnome at-tools, we do a query interface - * here and remember the result. - */ - accessibleText = AccessibleHypertextImpl.get(unoAccessibleContext); - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TEXT; - } - - /** Gets the AccessibleEditableText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleEditableText getAccessibleEditableText() { - - if (disposed) - return null; - - try { - XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText) - UnoRuntime.queryInterface(XAccessibleEditableText.class, - unoAccessibleComponent); - if (unoAccessibleText != null) { - return new AccessibleEditableTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleAction associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); - return (unoAccessibleAction != null) ? - new AccessibleActionImpl(unoAccessibleAction) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the relation set of this object */ - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = - unoAccessible.getAccessibleContext().getAccessibleRelationSet(); - if (unoAccessibleRelationSet == null) { - return super.getAccessibleRelationSet(); - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.CONTROLLED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLED_BY, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTROLLER_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLER_FOR, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.LABELED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABELED_BY, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTENT_FLOWS_TO: - relationSet.add(new javax.accessibility.AccessibleRelation( - "flowsTo", - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTENT_FLOWS_FROM: - relationSet.add(new javax.accessibility.AccessibleRelation( - "flowsFrom", - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - default: - break; - } - } - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return super.getAccessibleRelationSet(); - } catch (com.sun.star.uno.RuntimeException e) { - return super.getAccessibleRelationSet(); - } - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java b/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java deleted file mode 100644 index 53f4bc128..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - - -class RadioButton extends ToggleButton { - public RadioButton(XAccessible xAccessible, - XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleRadioButton(); - } - - protected class AccessibleRadioButton extends AccessibleToggleButton { - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.RADIO_BUTTON; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java b/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java deleted file mode 100644 index 68e0a7ab0..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; -import javax.swing.SwingConstants; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -/** - */ -public class ScrollBar extends Component implements SwingConstants, javax.accessibility.Accessible { - - public ScrollBar(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleScrollBar(); - } - - protected class AccessibleScrollBar extends AccessibleUNOComponent implements - javax.accessibility.AccessibleAction { - - protected XAccessibleAction unoAccessibleAction; - protected int actionCount = 0; - - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleScrollBar() { - super(); - unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface( - XAccessibleAction.class, unoAccessibleContext); - if (unoAccessibleAction != null) { - actionCount = unoAccessibleAction.getAccessibleActionCount(); - } - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.SCROLL_BAR; - } - - /** Gets the AccessibleValue associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleValue getAccessibleValue() { - try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); - return (unoAccessibleValue != null) ? - new AccessibleValueImpl(unoAccessibleValue) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleAction associated with this object that supports one or more actions */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - return this; - } - - /* - * AccessibleAction - */ - - /** Performs the specified Action on the object */ - public boolean doAccessibleAction(int param) { - if (param < actionCount) { - try { - return unoAccessibleAction.doAccessibleAction(param); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - } - } - return false; - } - - /** Returns a description of the specified action of the object */ - public java.lang.String getAccessibleActionDescription(int param) { - if(param < actionCount) { - try { - return unoAccessibleAction.getAccessibleActionDescription(param); - } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - } - } - return null; - } - - /** Returns the number of accessible actions available in this object */ - public int getAccessibleActionCount() { - return actionCount; - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Separator.java b/accessibility/bridge/org/openoffice/java/accessibility/Separator.java deleted file mode 100644 index 54ddcf0b0..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Separator.java +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - -import javax.swing.SwingConstants; - - -/** - */ -public class Separator extends Component implements SwingConstants, - javax.accessibility.Accessible { - - public Separator(XAccessible xAccessible, - XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - setFocusable(false); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleSeparator(); - } - - protected class AccessibleSeparator extends AccessibleUNOComponent { - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleSeparator() { - super(); - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.SEPARATOR; - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Table.java b/accessibility/bridge/org/openoffice/java/accessibility/Table.java deleted file mode 100644 index d304cb7cd..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Table.java +++ /dev/null @@ -1,727 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.accessibility.*; - -public class Table extends DescendantManager implements javax.accessibility.Accessible { - - protected Table(XAccessible xAccessible, XAccessibleContext xAccessibleContext, boolean multiselectable) { - super(xAccessible, xAccessibleContext, multiselectable); - } - - protected void setActiveDescendant(javax.accessibility.Accessible descendant) { - javax.accessibility.Accessible oldAD = activeDescendant; - activeDescendant = descendant; - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, - oldAD, descendant); - } - - protected void setActiveDescendant(Object any) { - javax.accessibility.Accessible descendant = null; - try { - if (AnyConverter.isObject(any)) { - XAccessible unoAccessible = (XAccessible) AnyConverter.toObject( - AccessibleObjectFactory.XAccessibleType, any); - if (unoAccessible != null) { - // FIXME: have to handle non transient objects here .. - descendant = new TableCell(unoAccessible); - } - } - setActiveDescendant(descendant); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void add(XAccessible unoAccessible) { - if (unoAccessible != null) { - TableCell cell = new TableCell(unoAccessible); - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, cell.getAccessibleContext()); - } - } - - protected void remove(XAccessible unoAccessible) { - if (unoAccessible != null) { - TableCell cell = new TableCell(unoAccessible); - // The AccessBridge for Windows expects an instance of AccessibleContext - // as parameters - firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - cell.getAccessibleContext(), null); - } - } - - protected void add(Object any) { - try { - add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void remove(Object any) { - try { - remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleTableListener extends AccessibleDescendantManagerListener { - - protected AccessibleTableListener() { - super(); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED: - setActiveDescendant(event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - remove(event.OldValue); - } - if (AnyConverter.isObject(event.NewValue)) { - add(event.NewValue); - } - break; - default: - super.notifyEvent(event); - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleTableListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleTable(); - } - - protected class AccessibleTable extends AccessibleDescendantManager implements javax.accessibility.AccessibleExtendedTable { - - protected XAccessibleTable unoAccessibleTable; - - public AccessibleTable() { - unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); - } - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TABLE; - } - - /** Returns the AccessibleTable interface of this object */ - public javax.accessibility.AccessibleTable getAccessibleTable() { - return this; - } - - /** Returns the specified Accessible child of the object */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant; - if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TableCell(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleComponent - */ - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint( - new com.sun.star.awt.Point(p.x, p.y)); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant; - if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TableCell(xAccessible); - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleSelection.getSelectedAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant; - if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TableCell(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleTable - */ - - /** Returns the Accessible at a specified row and column in the table. */ - public javax.accessibility.Accessible getAccessibleAt(int r, int c) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleTable.getAccessibleCellAt(r,c); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant; - if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TableCell(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Returns the caption for the table. */ - public javax.accessibility.Accessible getAccessibleCaption() { - // Not yet supported. - return null; - } - - /** Returns the number of columns in the table. */ - public int getAccessibleColumnCount() { - try { - return unoAccessibleTable.getAccessibleColumnCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the description text of the specified column in the table. */ - public javax.accessibility.Accessible getAccessibleColumnDescription(int c) { - try { - return new javax.swing.JLabel( - unoAccessibleTable.getAccessibleColumnDescription(c)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** - * Returns the number of columns occupied by the Accessible - * at a specified row and column in the table. - */ - public int getAccessibleColumnExtentAt(int r, int c) { - try { - return unoAccessibleTable.getAccessibleColumnExtentAt(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return 0; - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the column headers as an AccessibleTable. */ - public javax.accessibility.AccessibleTable getAccessibleColumnHeader() { - // Not yet supported - return null; - } - - /** Returns the number of rows in the table. */ - public int getAccessibleRowCount() { - try { - return unoAccessibleTable.getAccessibleRowCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the description of the specified row in the table. */ - public javax.accessibility.Accessible getAccessibleRowDescription(int r) { - try { - return new javax.swing.JLabel( - unoAccessibleTable.getAccessibleRowDescription(r)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** - * Returns the number of rows occupied by the Accessible - * at a specified row and column in the table. - */ - public int getAccessibleRowExtentAt(int r, int c) { - try { - return unoAccessibleTable.getAccessibleRowExtentAt(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return 0; - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the row headers as an AccessibleTable. */ - public javax.accessibility.AccessibleTable getAccessibleRowHeader() { - // Not yet supported - return null; - } - - /** Returns the summary description of the table. */ - public javax.accessibility.Accessible getAccessibleSummary() { - // Not yet supported. - return null; - } - - /** Returns the selected columns in a table. */ - public int[] getSelectedAccessibleColumns() { - try { - return unoAccessibleTable.getSelectedAccessibleColumns(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the selected rows in a table. */ - public int[] getSelectedAccessibleRows() { - try { - return unoAccessibleTable.getSelectedAccessibleRows(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns a boolean value indicating whether the specified column is selected. */ - public boolean isAccessibleColumnSelected(int c) { - try { - return unoAccessibleTable.isAccessibleColumnSelected(c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns a boolean value indicating whether the specified row is selected. */ - public boolean isAccessibleRowSelected(int r) { - try { - return unoAccessibleTable.isAccessibleRowSelected(r); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** - * Returns a boolean value indicating whether the accessible - * at a specified row and column is selected. - */ - public boolean isAccessibleSelected(int r, int c) { - try { - return unoAccessibleTable.isAccessibleSelected(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Sets the caption for the table. */ - public void setAccessibleCaption(javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the description text of the specified column in the table. */ - public void setAccessibleColumnDescription(int param, javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the column headers. */ - public void setAccessibleColumnHeader(javax.accessibility.AccessibleTable accessibleTable) { - // Not supported by the UNO Accessibility API - } - - /** Sets the description text of the specified row of the table. */ - public void setAccessibleRowDescription(int param, javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the row headers. */ - public void setAccessibleRowHeader(javax.accessibility.AccessibleTable accessibleTable) { - // Not supported by the UNO Accessibility API - } - - /** Sets the summary description of the table */ - public void setAccessibleSummary(javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Returns the column number of an index in the table */ - public int getAccessibleColumn(int index) { - try { - return unoAccessibleTable.getAccessibleColumn(index); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the index of a specified row and column in the table. */ - public int getAccessibleIndex(int r, int c) { - try { - return unoAccessibleTable.getAccessibleIndex(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the row number of an index in the table */ - public int getAccessibleRow(int index) { - try { - return unoAccessibleTable.getAccessibleRow(index); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - } - - class TableCell extends java.awt.Component implements javax.accessibility.Accessible { - - protected XAccessible unoAccessible; - - public TableCell(XAccessible xAccessible) { - unoAccessible = xAccessible; - } - - public Object[] create(Object[] targetSet) { - try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); - for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( - XAccessible.class, targetSet[i]); - if (xAccessible != null) { - list.add(new TableCell(xAccessible)); - } - } - list.trimToSize(); - return list.toArray(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - try { - XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - javax.accessibility.AccessibleContext ac = new AccessibleTableCell(xAccessibleContext); - if (ac != null) { - ac.setAccessibleParent(Table.this); - accessibleContext = ac; - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return accessibleContext; - } - - protected class AccessibleTableCell extends javax.accessibility.AccessibleContext { - - XAccessibleContext unoAccessibleContext; - - public AccessibleTableCell(XAccessibleContext xAccessibleContext) { - unoAccessibleContext = xAccessibleContext; - } - - /** Returns the accessible name of this object */ - public String getAccessibleName() { - try { - return unoAccessibleContext.getAccessibleName(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleName(String name) { - // Not supported - } - - /** Returns the accessible name of this object */ - public String getAccessibleDescription() { - try { - return unoAccessibleContext.getAccessibleDescription(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleDescription(String name) { - // Not supported - } - - /** Returns the accessible role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - try { - javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole( - unoAccessibleContext.getAccessibleRole()); - return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL; - } catch(com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the locale of the component */ - public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { - try { - com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale(); - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } catch (IllegalAccessibleComponentStateException e) { - throw new java.awt.IllegalComponentStateException(e.getMessage()); - } catch (com.sun.star.uno.RuntimeException e) { - return Table.this.getLocale(); - } - } - - /** Gets the 0-based index of this object in its accessible parent */ - public int getAccessibleIndexInParent() { - try { - return unoAccessibleContext.getAccessibleIndexInParent(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the number of accessible children of the object. */ - public int getAccessibleChildrenCount() { - try { - return unoAccessibleContext.getAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the specified Accessible child of the object. */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant; - if ((activeDescendant instanceof TableCell) && ((TableCell) activeDescendant).unoAccessible.equals(xAccessible)) { - child = activeDescendant; - } else if (xAccessible != null) { - child = new TableCell(xAccessible); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Returns the state set of this object */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - try { - return AccessibleStateAdapter.getAccessibleStateSet(TableCell.this, - unoAccessibleContext.getAccessibleStateSet()); - } catch (com.sun.star.uno.RuntimeException e) { - return AccessibleStateAdapter.getDefunctStateSet(); - } - } - - /** Returns the relation set of this object */ - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet(); - if (unoAccessibleRelationSet == null) { - return null; - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.CONTROLLED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLED_BY, - create(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTROLLER_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLER_FOR, - create(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.LABELED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABELED_BY, - create(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.LABEL_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABEL_FOR, - create(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - create(unoAccessibleRelation.TargetSet))); - break; - default: - break; - } - } - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleComponent associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleComponent getAccessibleComponent() { - try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); - return (unoAccessibleComponent != null) ? - new AccessibleComponentImpl(unoAccessibleComponent) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleAction associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); - return (unoAccessibleAction != null) ? - new AccessibleActionImpl(unoAccessibleAction) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); - return (unoAccessibleText != null) ? - new AccessibleTextImpl(unoAccessibleText) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleValue associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleValue getAccessibleValue() { - try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); - return (unoAccessibleValue != null) ? - new AccessibleValueImpl(unoAccessibleValue) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { - try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); - if (unoAccessibleImage != null) { - javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; - return icons; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java b/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java deleted file mode 100644 index 86fa4e604..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.accessibility.*; - -/** - */ -public class TextComponent extends Component implements javax.accessibility.Accessible { - - protected TextComponent(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected class AccessibleTextComponentListener extends AccessibleUNOComponentListener { - - protected AccessibleTextComponentListener() { - super(); - } - - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.EDITABLE: - fireStatePropertyChange(javax.accessibility.AccessibleState.EDITABLE, enable); - break; - case AccessibleStateType.MULTI_LINE: - fireStatePropertyChange(javax.accessibility.AccessibleState.MULTI_LINE, enable); - break; - case AccessibleStateType.SINGLE_LINE: - break; - default: - super.setComponentState(state, enable); - break; - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleTextComponentListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleTextComponent(); - } - - protected class AccessibleTextComponent extends AccessibleUNOComponent { - - /** - * Though the class is abstract, this should be called by all sub-classes - */ - protected AccessibleTextComponent() { - super(); - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TEXT; - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleEditableText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleEditableText getAccessibleEditableText() { - try { - XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText) - UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent); - if (unoAccessibleText != null) { - return new AccessibleEditableTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleAction associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); - return (unoAccessibleAction != null) ? - new AccessibleActionImpl(unoAccessibleAction) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the relation set of this object */ - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = - unoAccessible.getAccessibleContext().getAccessibleRelationSet(); - if (unoAccessibleRelationSet == null) { - return super.getAccessibleRelationSet(); - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.CONTROLLED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLED_BY, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTROLLER_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.CONTROLLER_FOR, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.LABELED_BY: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABELED_BY, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTENT_FLOWS_TO: - relationSet.add(new javax.accessibility.AccessibleRelation( - "flowsTo", - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.CONTENT_FLOWS_FROM: - relationSet.add(new javax.accessibility.AccessibleRelation( - "flowsFrom", - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - default: - break; - } - } - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return super.getAccessibleRelationSet(); - } catch (com.sun.star.uno.RuntimeException e) { - return super.getAccessibleRelationSet(); - } - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java b/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java deleted file mode 100644 index ff8c87137..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - - -class ToggleButton extends AbstractButton implements javax.accessibility.Accessible { - public ToggleButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleToggleButton(); - } - - protected class AccessibleToggleButton extends AccessibleAbstractButton { - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TOGGLE_BUTTON; - } - - /** Gets the AccessibleValue associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleValue getAccessibleValue() { - try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) UnoRuntime.queryInterface(XAccessibleValue.class, - unoAccessibleContext); - - return (unoAccessibleValue != null) - ? new AccessibleValueImpl(unoAccessibleValue) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java b/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java deleted file mode 100644 index 9391d0f6c..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -import javax.accessibility.AccessibleState; -import javax.accessibility.AccessibleStateSet; - - -/** - */ -public class ToolTip extends Component implements javax.accessibility.Accessible { - protected ToolTip(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleToolTip(); - } - - protected class AccessibleToolTip extends AccessibleUNOComponent { - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TOOL_TIP; - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, - unoAccessibleComponent); - - if (unoAccessibleText != null) { - return new AccessibleTextImpl(unoAccessibleText); - } else { - return null; - } - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the relation set of this object */ - - /* - public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() { - try { - XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet(); - if (unoAccessibleRelationSet == null) { - return null; - } - - javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet(); - int count = unoAccessibleRelationSet.getRelationCount(); - for (int i = 0; i < count; i++) { - AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i); - switch (unoAccessibleRelation.RelationType) { - case AccessibleRelationType.LABEL_FOR: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.LABEL_FOR, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - case AccessibleRelationType.MEMBER_OF: - relationSet.add(new javax.accessibility.AccessibleRelation( - javax.accessibility.AccessibleRelation.MEMBER_OF, - getAccessibleComponents(unoAccessibleRelation.TargetSet))); - break; - default: - break; - } - } - return relationSet; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - */ - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Tree.java b/accessibility/bridge/org/openoffice/java/accessibility/Tree.java deleted file mode 100644 index b93752679..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Tree.java +++ /dev/null @@ -1,768 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import javax.accessibility.AccessibleContext; -import javax.accessibility.AccessibleState; - -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.accessibility.*; - -public class Tree extends DescendantManager implements javax.accessibility.Accessible { - - protected Tree(XAccessible xAccessible, XAccessibleContext xAccessibleContext) { - super(xAccessible, xAccessibleContext); - } - - protected void setActiveDescendant(javax.accessibility.Accessible descendant) { - javax.accessibility.Accessible oldAD = activeDescendant; - activeDescendant = descendant; - firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, - oldAD, descendant); - } - - protected void setActiveDescendant(Object any) { - javax.accessibility.Accessible descendant = null; - try { - if (AnyConverter.isObject(any)) { - XAccessible unoAccessible = (XAccessible) AnyConverter.toObject( - AccessibleObjectFactory.XAccessibleType, any); - if (unoAccessible != null) { - // FIXME: have to handle non transient objects here .. - descendant = new TreeItem(unoAccessible); - } - } - setActiveDescendant(descendant); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void add(XAccessible unoAccessible) { - if (unoAccessible != null) { - firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, new TreeItem(unoAccessible)); - } - } - - protected void remove(XAccessible unoAccessible) { - if (unoAccessible != null) { - firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - new TreeItem(unoAccessible), null); - } - } - - protected void add(Object any) { - try { - add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - protected void remove(Object any) { - try { - remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any)); - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleTreeListener extends AccessibleDescendantManagerListener { - - protected AccessibleTreeListener() { - super(); - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED: - setActiveDescendant(event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - remove(event.OldValue); - } - if (AnyConverter.isObject(event.NewValue)) { - add(event.NewValue); - } - break; - - case AccessibleEventId.LISTBOX_ENTRY_EXPANDED: - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.COLLAPSED, AccessibleState.EXPANDED); - break; - - case AccessibleEventId.LISTBOX_ENTRY_COLLAPSED: - firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - AccessibleState.EXPANDED, AccessibleState.COLLAPSED); - break; - - default: - super.notifyEvent(event); - } - } - } - - protected XAccessibleEventListener createEventListener() { - return new AccessibleTreeListener(); - } - - /** Creates the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext createAccessibleContext() { - return new AccessibleTree(); - } - - protected class AccessibleTree extends AccessibleDescendantManager implements javax.accessibility.AccessibleExtendedTable { - - protected XAccessibleTable unoAccessibleTable; - - public AccessibleTree() { - unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); - } - - /* - * AccessibleContext - */ - - /** Gets the role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - return javax.accessibility.AccessibleRole.TREE; - } - - /** Returns the AccessibleTable interface of this object */ - public javax.accessibility.AccessibleTable getAccessibleTable() { - return ( unoAccessibleTable != null ) ? this : null; - } - - /** Returns the specified Accessible child of the object */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant; - if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TreeItem(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleComponent - */ - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint( - new com.sun.star.awt.Point(p.x, p.y)); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant; - if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TreeItem(xAccessible); - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant; - if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TreeItem(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /* - * AccessibleTable - */ - - /** Returns the Accessible at a specified row and column in the table. */ - public javax.accessibility.Accessible getAccessibleAt(int r, int c) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleTable.getAccessibleCellAt(r,c); - if (xAccessible != null) { - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant; - if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) { - child = activeDescendant; - } else { - child = new TreeItem(xAccessible); - } - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Returns the caption for the table. */ - public javax.accessibility.Accessible getAccessibleCaption() { - // Not yet supported. - return null; - } - - /** Returns the number of columns in the table. */ - public int getAccessibleColumnCount() { - try { - return unoAccessibleTable.getAccessibleColumnCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the description text of the specified column in the table. */ - public javax.accessibility.Accessible getAccessibleColumnDescription(int c) { - try { - return new javax.swing.JLabel( - unoAccessibleTable.getAccessibleColumnDescription(c)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** - * Returns the number of columns occupied by the Accessible - * at a specified row and column in the table. - */ - public int getAccessibleColumnExtentAt(int r, int c) { - try { - return unoAccessibleTable.getAccessibleColumnExtentAt(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return 0; - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the column headers as an AccessibleTable. */ - public javax.accessibility.AccessibleTable getAccessibleColumnHeader() { - // Not yet supported - return null; - } - - /** Returns the number of rows in the table. */ - public int getAccessibleRowCount() { - try { - return unoAccessibleTable.getAccessibleRowCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the description of the specified row in the table. */ - public javax.accessibility.Accessible getAccessibleRowDescription(int r) { - try { - return new javax.swing.JLabel( - unoAccessibleTable.getAccessibleRowDescription(r)); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** - * Returns the number of rows occupied by the Accessible - * at a specified row and column in the table. - */ - public int getAccessibleRowExtentAt(int r, int c) { - try { - return unoAccessibleTable.getAccessibleRowExtentAt(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return 0; - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the row headers as an AccessibleTable. */ - public javax.accessibility.AccessibleTable getAccessibleRowHeader() { - // Not yet supported - return null; - } - - /** Returns the summary description of the table. */ - public javax.accessibility.Accessible getAccessibleSummary() { - // Not yet supported. - return null; - } - - /** Returns the selected columns in a table. */ - public int[] getSelectedAccessibleColumns() { - try { - return unoAccessibleTable.getSelectedAccessibleColumns(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the selected rows in a table. */ - public int[] getSelectedAccessibleRows() { - try { - return unoAccessibleTable.getSelectedAccessibleRows(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns a boolean value indicating whether the specified column is selected. */ - public boolean isAccessibleColumnSelected(int c) { - try { - return unoAccessibleTable.isAccessibleColumnSelected(c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns a boolean value indicating whether the specified row is selected. */ - public boolean isAccessibleRowSelected(int r) { - try { - return unoAccessibleTable.isAccessibleRowSelected(r); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** - * Returns a boolean value indicating whether the accessible - * at a specified row and column is selected. - */ - public boolean isAccessibleSelected(int r, int c) { - try { - return unoAccessibleTable.isAccessibleSelected(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Sets the caption for the table. */ - public void setAccessibleCaption(javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the description text of the specified column in the table. */ - public void setAccessibleColumnDescription(int param, javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the column headers. */ - public void setAccessibleColumnHeader(javax.accessibility.AccessibleTable accessibleTable) { - // Not supported by the UNO Accessibility API - } - - /** Sets the description text of the specified row of the table. */ - public void setAccessibleRowDescription(int param, javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Sets the row headers. */ - public void setAccessibleRowHeader(javax.accessibility.AccessibleTable accessibleTable) { - // Not supported by the UNO Accessibility API - } - - /** Sets the summary description of the table */ - public void setAccessibleSummary(javax.accessibility.Accessible accessible) { - // Not supported by the UNO Accessibility API - } - - /** Returns the column number of an index in the table */ - public int getAccessibleColumn(int index) { - try { - return unoAccessibleTable.getAccessibleColumn(index); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the index of a specified row and column in the table. */ - public int getAccessibleIndex(int r, int c) { - try { - return unoAccessibleTable.getAccessibleIndex(r,c); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the row number of an index in the table */ - public int getAccessibleRow(int index) { - try { - return unoAccessibleTable.getAccessibleRow(index); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return -1; - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - } - - class TreeItem extends java.awt.Component implements javax.accessibility.Accessible { - - protected XAccessible unoAccessible; - - public TreeItem(XAccessible xAccessible) { - unoAccessible = xAccessible; - } - - public Object[] create(Object[] targetSet) { - try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); - for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( - XAccessible.class, targetSet[i]); - if (xAccessible != null) { - list.add(new TreeItem(xAccessible)); - } - } - list.trimToSize(); - return list.toArray(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - try { - XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - javax.accessibility.AccessibleContext ac = new AccessibleTreeItem(xAccessibleContext); - if (ac != null) { - ac.setAccessibleParent(Tree.this); - accessibleContext = ac; - } - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return accessibleContext; - } - - protected class AccessibleTreeItem extends javax.accessibility.AccessibleContext - implements javax.accessibility.AccessibleSelection { - - XAccessibleContext unoAccessibleContext; - XAccessibleSelection unoAccessibleSelection; - - public AccessibleTreeItem(XAccessibleContext xAccessibleContext) { - unoAccessibleContext = xAccessibleContext; - unoAccessibleSelection = (XAccessibleSelection) - UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext); - } - - /** Returns the accessible name of this object */ - public String getAccessibleName() { - try { - return unoAccessibleContext.getAccessibleName(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleName(String name) { - // Not supported - } - - /** Returns the accessible name of this object */ - public String getAccessibleDescription() { - try { - return unoAccessibleContext.getAccessibleDescription(); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Sets the accessible name of this object */ - public void setAccessibleDescription(String name) { - // Not supported - } - - /** Returns the accessible role of this object */ - public javax.accessibility.AccessibleRole getAccessibleRole() { - try { - javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole( - unoAccessibleContext.getAccessibleRole()); - return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL; - } catch(com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the locale of the component */ - public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException { - try { - com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale(); - return new java.util.Locale(unoLocale.Language, unoLocale.Country); - } catch (IllegalAccessibleComponentStateException e) { - throw new java.awt.IllegalComponentStateException(e.getMessage()); - } catch (com.sun.star.uno.RuntimeException e) { - return Tree.this.getLocale(); - } - } - - /** Gets the 0-based index of this object in its accessible parent */ - public int getAccessibleIndexInParent() { - try { - return unoAccessibleContext.getAccessibleIndexInParent(); - } catch (com.sun.star.uno.RuntimeException e) { - return -1; - } - } - - /** Returns the number of accessible children of the object. */ - public int getAccessibleChildrenCount() { - try { - return unoAccessibleContext.getAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Returns the specified Accessible child of the object. */ - public javax.accessibility.Accessible getAccessibleChild(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - // Re-use the active descandant wrapper if possible - javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant; - if ((activeDescendant instanceof TreeItem) && ((TreeItem) activeDescendant).unoAccessible.equals(xAccessible)) { - child = activeDescendant; - } else if (xAccessible != null) { - child = new TreeItem(xAccessible); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Returns the state set of this object */ - public javax.accessibility.AccessibleStateSet getAccessibleStateSet() { - try { - return AccessibleStateAdapter.getAccessibleStateSet(TreeItem.this, - unoAccessibleContext.getAccessibleStateSet()); - } catch (com.sun.star.uno.RuntimeException e) { - return AccessibleStateAdapter.getDefunctStateSet(); - } - } - - /** Gets the AccessibleComponent associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleComponent getAccessibleComponent() { - try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); - return (unoAccessibleComponent != null) ? - new AccessibleComponentImpl(unoAccessibleComponent) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Returns the AccessibleSelection interface for this object */ - public javax.accessibility.AccessibleSelection getAccessibleSelection() { - return (unoAccessibleSelection != null) ? this : null; - } - - /** Gets the AccessibleAction associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleAction getAccessibleAction() { - try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); - return (unoAccessibleAction != null) ? - new AccessibleActionImpl(unoAccessibleAction) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleText getAccessibleText() { - - if (disposed) - return null; - - try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); - return (unoAccessibleText != null) ? - new AccessibleTextImpl(unoAccessibleText) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleValue associated with this object that has a graphical representation */ - public javax.accessibility.AccessibleValue getAccessibleValue() { - try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); - return (unoAccessibleValue != null) ? - new AccessibleValueImpl(unoAccessibleValue) : null; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the AccessibleText associated with this object presenting text on the display */ - public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { - try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); - if (unoAccessibleImage != null) { - javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; - return icons; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - return null; - } - - /* - * AccessibleSelection - */ - - /** Returns an Accessible representing the specified selected child of the object */ - public javax.accessibility.Accessible getAccessibleSelection(int i) { - javax.accessibility.Accessible child = null; - try { - XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i); - if (xAccessible != null) { - child = new TreeItem(xAccessible); - } - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - return child; - } - - /** Adds the specified Accessible child of the object to the object's selection */ - public void addAccessibleSelection(int i) { - try { - unoAccessibleSelection.selectAccessibleChild(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Clears the selection in the object, so that no children in the object are selected */ - public void clearAccessibleSelection() { - try { - unoAccessibleSelection.clearAccessibleSelection(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Returns the number of Accessible children currently selected */ - public int getAccessibleSelectionCount() { - try { - return unoAccessibleSelection.getSelectedAccessibleChildCount(); - } catch (com.sun.star.uno.RuntimeException e) { - return 0; - } - } - - /** Determines if the current child of this object is selected */ - public boolean isAccessibleChildSelected(int i) { - try { - return unoAccessibleSelection.isAccessibleChildSelected(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - return false; - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Removes the specified child of the object from the object's selection */ - public void removeAccessibleSelection(int i) { - try { - unoAccessibleSelection.deselectAccessibleChild(i); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - /** Causes every child of the object to be selected if the object supports multiple selection */ - public void selectAllAccessibleSelection() { - try { - unoAccessibleSelection.selectAllAccessibleChildren(); - } catch (com.sun.star.uno.RuntimeException e) { - } - } - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Window.java b/accessibility/bridge/org/openoffice/java/accessibility/Window.java deleted file mode 100644 index 22a701963..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/Window.java +++ /dev/null @@ -1,551 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility; - -import com.sun.star.uno.*; -import com.sun.star.accessibility.*; - -public class Window extends java.awt.Window implements javax.accessibility.Accessible, NativeFrame { - protected XAccessibleComponent unoAccessibleComponent; - - boolean opened = false; - boolean visible = false; - - java.awt.EventQueue eventQueue = null; - - public Window(java.awt.Window owner, XAccessibleComponent xAccessibleComponent) { - super(owner); - initialize(xAccessibleComponent); - } - - private void initialize(XAccessibleComponent xAccessibleComponent) { - unoAccessibleComponent = xAccessibleComponent; - eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); - if (broadcaster != null) { - broadcaster.addEventListener(new AccessibleWindowListener()); - } - } - - java.awt.Component initialComponent = null; - - public java.awt.Component getInitialComponent() { - if (Build.DEBUG) { - System.err.println("returning initial component object of class: " + initialComponent.getClass().getName()); - } - return initialComponent; - } - - public void setInitialComponent(java.awt.Component c) { - initialComponent = c; - } - - public Integer getHWND() { - return null; - } - - /** - * Determines whether this Component is showing on screen. - * This means that the component must be visible, and it must be in a - * container that is visible and showing. - * @see #addNotify - * @see #removeNotify - * @since JDK1.0 - */ - public boolean isShowing() { - if (isVisible()) { - java.awt.Container parent = getParent(); - return (parent == null) || parent.isShowing(); - } - return false; - } - - /** - * Makes this Component displayable by connecting it to a - * native screen resource. - * This method is called internally by the toolkit and should - * not be called directly by programs. - * @see #isDisplayable - * @see #removeNotify - * @since JDK1.0 - */ - public void addNotify() { -// createHierarchyEvents(0, null, null, 0, false); - } - - /** - * Makes this Component undisplayable by destroying it native - * screen resource. - * This method is called by the toolkit internally and should - * not be called directly by programs. - * @see #isDisplayable - * @see #addNotify - * @since JDK1.0 - */ - public void removeNotify() { - } - - /** - * Determines if the object is visible. Note: this means that the - * object intends to be visible; however, it may not in fact be - * showing on the screen because one of the objects that this object - * is contained by is not visible. To determine if an object is - * showing on the screen, use isShowing. - * - * @return true if object is visible; otherwise, false - */ - public boolean isVisible(){ - return visible; - } - - /** - * Shows or hides this component depending on the value of parameter - * b. - * @param b if true, shows this component; - * otherwise, hides this component - * @see #isVisible - * @since JDK1.1 - */ - public void setVisible(boolean b) { - if (visible != b){ - visible = b; - if (b) { - // If it is the first show, fire WINDOW_OPENED event - if (!opened) { - postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED); - opened = true; - } - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN); - } else { - postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN); - } - } - } - - public void dispose() { - setVisible(false); - postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED); - - // Transfer window focus back to the owner window if it is still the active frame - if ((getOwner() instanceof Frame && ((Frame) getOwner()).active) || - (getOwner() instanceof Dialog && ((Dialog) getOwner()).active)) { - eventQueue.postEvent(new java.awt.event.WindowEvent(getOwner(), - java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS)); - } - } - - protected void postWindowEvent(int i) { - eventQueue.postEvent(new java.awt.event.WindowEvent(this, i)); - } - - protected void postComponentEvent(int i) { - eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i)); - } - - /** - * Update the proxy objects appropriatly on property change events - */ - protected class AccessibleWindowListener implements XAccessibleEventListener { - - protected AccessibleWindowListener() { - } - - // The only expected state changes are ACTIVE and VISIBLE - protected void setComponentState(short state, boolean enable) { - switch (state) { - case AccessibleStateType.ICONIFIED: - postWindowEvent(enable ? - java.awt.event.WindowEvent.WINDOW_ICONIFIED : - java.awt.event.WindowEvent.WINDOW_DEICONIFIED); - break; - case AccessibleStateType.SHOWING: - case AccessibleStateType.VISIBLE: - setVisible(enable); - break; - default: - if (Build.DEBUG) { -// System.err.println("[frame]: " + getTitle() + "unexpected state change " + state); - } - break; - } - } - - /** Updates the accessible name and fires the appropriate PropertyChangedEvent */ - protected void handleNameChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac!= null) { - ac.setAccessibleName(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the accessible description and fires the appropriate PropertyChangedEvent */ - protected void handleDescriptionChangedEvent(Object any) { - try { - // This causes the property change event to be fired in the VCL thread - // context. If this causes problems, it has to be deligated to the java - // dispatch thread .. - if (accessibleContext != null) { - accessibleContext.setAccessibleDescription(AnyConverter.toString(any)); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Updates the internal states and fires the appropriate PropertyChangedEvent */ - protected void handleStateChangedEvent(Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - setComponentState(AnyConverter.toShort(any1), false); - } - - if (AnyConverter.isShort(any2)) { - setComponentState(AnyConverter.toShort(any2), true); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - /** Fires a visible data property change event */ - protected void handleVisibleDataEvent() { - javax.accessibility.AccessibleContext ac = accessibleContext; - if (ac != null) { - ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null); - } - } - - /** Called by OpenOffice process to notify property changes */ - public void notifyEvent(AccessibleEventObject event) { - switch (event.EventId) { - case AccessibleEventId.NAME_CHANGED: - // Set the accessible name for the corresponding context, which will fire a property - // change event itself - handleNameChangedEvent(event.NewValue); - break; - case AccessibleEventId.DESCRIPTION_CHANGED: - // Set the accessible description for the corresponding context, which will fire a property - // change event itself - so do not set propertyName ! - handleDescriptionChangedEvent(event.NewValue); - break; - case AccessibleEventId.STATE_CHANGED: - // Update the internal state set and fire the appropriate PropertyChangedEvent - handleStateChangedEvent(event.OldValue, event.NewValue); - break; - case AccessibleEventId.CHILD: - if (AnyConverter.isObject(event.OldValue)) { - AccessibleObjectFactory.removeChild(Window.this, event.OldValue); - } else if (AnyConverter.isObject(event.NewValue)) { - AccessibleObjectFactory.addChild(Window.this, event.NewValue); - } - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - case AccessibleEventId.BOUNDRECT_CHANGED: - handleVisibleDataEvent(); - break; - default: - // Warn about unhandled events - if(Build.DEBUG) { - System.out.println(this + ": unhandled accessibility event id=" + event.EventId); - } - } - } - - /** Called by OpenOffice process to notify that the UNO component is disposing */ - public void disposing(com.sun.star.lang.EventObject eventObject) { - } - } - - protected javax.accessibility.AccessibleContext accessibleContext = null; - - /** Returns the AccessibleContext associated with this object */ - public javax.accessibility.AccessibleContext getAccessibleContext() { - if (accessibleContext == null) { - accessibleContext = new AccessibleWindow(); -// accessibleContext.setAccessibleName(getTitle()); - } - return accessibleContext; - } - - protected class AccessibleWindow extends java.awt.Window.AccessibleAWTWindow { - protected AccessibleWindow() { - super(); - } - - protected java.awt.event.ComponentListener accessibleComponentHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when shown/hidden.. - */ - protected class AccessibleComponentHandler implements java.awt.event.ComponentListener { - public void componentHidden(java.awt.event.ComponentEvent e) { - AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - javax.accessibility.AccessibleState.VISIBLE, null); - } - - public void componentShown(java.awt.event.ComponentEvent e) { - AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY, - null, javax.accessibility.AccessibleState.VISIBLE); - } - - public void componentMoved(java.awt.event.ComponentEvent e) { - } - - public void componentResized(java.awt.event.ComponentEvent e) { - } - } // inner class AccessibleComponentHandler - - protected java.awt.event.ContainerListener accessibleContainerHandler = null; - - /** - * Fire PropertyChange listener, if one is registered, - * when children added/removed. - */ - - protected class AccessibleContainerHandler implements java.awt.event.ContainerListener { - public void componentAdded(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - null, ((javax.accessibility.Accessible) c).getAccessibleContext()); - } - } - public void componentRemoved(java.awt.event.ContainerEvent e) { - java.awt.Component c = e.getChild(); - if (c != null && c instanceof javax.accessibility.Accessible) { - AccessibleWindow.this.firePropertyChange( - javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, - ((javax.accessibility.Accessible) c).getAccessibleContext(), null); - } - } - } - - protected int propertyChangeListenerCount = 0; - - /** - * Add a PropertyChangeListener to the listener list. - * - * @param listener The PropertyChangeListener to be added - */ - public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (propertyChangeListenerCount++ == 0) { - accessibleContainerHandler = new AccessibleContainerHandler(); - Window.this.addContainerListener(accessibleContainerHandler); - - accessibleComponentHandler = new AccessibleComponentHandler(); - Window.this.addComponentListener(accessibleComponentHandler); - } - super.addPropertyChangeListener(listener); - } - - /** - * Remove a PropertyChangeListener from the listener list. - * This removes a PropertyChangeListener that was registered - * for all properties. - * - * @param listener The PropertyChangeListener to be removed - */ - public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { - if (--propertyChangeListenerCount == 0) { - Window.this.removeComponentListener(accessibleComponentHandler); - accessibleComponentHandler = null; - - Window.this.removeContainerListener(accessibleContainerHandler); - accessibleContainerHandler = null; - } - super.removePropertyChangeListener(listener); - } - - /* - * AccessibleComponent - */ - - /** Returns the background color of the object */ - public java.awt.Color getBackground() { - try { - return new java.awt.Color(unoAccessibleComponent.getBackground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setBackground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - /** Returns the foreground color of the object */ - public java.awt.Color getForeground() { - try { - return new java.awt.Color(unoAccessibleComponent.getForeground()); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public void setForeground(java.awt.Color c) { - // Not supported by UNO accessibility API - } - - public java.awt.Cursor getCursor() { - // Not supported by UNO accessibility API - return null; - } - - public void setCursor(java.awt.Cursor cursor) { - // Not supported by UNO accessibility API - } - - public java.awt.Font getFont() { - // FIXME - return null; - } - - public void setFont(java.awt.Font f) { - // Not supported by UNO accessibility API - } - - public java.awt.FontMetrics getFontMetrics(java.awt.Font f) { - // FIXME - return null; - } - - public boolean isEnabled() { - return Window.this.isEnabled(); - } - - public void setEnabled(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isVisible() { - return Window.this.isVisible(); - } - - public void setVisible(boolean b) { - // Not supported by UNO accessibility API - } - - public boolean isShowing() { - return Window.this.isShowing(); - } - - public boolean contains(java.awt.Point p) { - try { - return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y)); - } catch (com.sun.star.uno.RuntimeException e) { - return false; - } - } - - /** Returns the location of the object on the screen. */ - public java.awt.Point getLocationOnScreen() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); - return new java.awt.Point(unoPoint.X, unoPoint.Y); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Gets the location of this component in the form of a point specifying the component's top-left corner */ - public java.awt.Point getLocation() { - try { - com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen(); - return new java.awt.Point( unoPoint.X, unoPoint.Y ); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves this component to a new location */ - public void setLocation(java.awt.Point p) { - // Not supported by UNO accessibility API - } - - /** Gets the bounds of this component in the form of a Rectangle object */ - public java.awt.Rectangle getBounds() { - try { - com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds(); - return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Moves and resizes this component to conform to the new bounding rectangle r */ - public void setBounds(java.awt.Rectangle r) { - // Not supported by UNO accessibility API - } - - /** Returns the size of this component in the form of a Dimension object */ - public java.awt.Dimension getSize() { - try { - com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize(); - return new java.awt.Dimension(unoSize.Width, unoSize.Height); - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - /** Resizes this component so that it has width d.width and height d.height */ - public void setSize(java.awt.Dimension d) { - // Not supported by UNO accessibility API - } - - /** Returns the Accessible child, if one exists, contained at the local coordinate Point */ - public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) { - try { - java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y))); - - return (javax.accessibility.Accessible) c; - } catch (com.sun.star.uno.RuntimeException e) { - return null; - } - } - - public boolean isFocusTraversable() { - return Window.this.isFocusable(); - } - - public void requestFocus() { - unoAccessibleComponent.grabFocus(); - } - } -} - diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java deleted file mode 100644 index 365243fe6..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java +++ /dev/null @@ -1,186 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility.logging; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -/** - * - */ -public class XAccessibleEventLog implements XAccessibleEventListener { - - private static XAccessibleEventLog theEventListener = null; - - private static java.util.Hashtable proxyList = new java.util.Hashtable(); - - /** Creates a new instance of UNOAccessibleEventListener */ - public XAccessibleEventLog() { - } - - private static XAccessibleEventListener get() { - if (theEventListener == null) { - theEventListener = new XAccessibleEventLog(); - } - return theEventListener; - } - - public static void addEventListener(XAccessibleContext xac, java.awt.Component c) { - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac); - if (broadcaster != null) { - broadcaster.addEventListener(XAccessibleEventLog.get()); - - // remember the proxy objects - synchronized (proxyList) { -// proxyList.put(UnoRuntime.generateOid(xac), new WeakReference(c)); - proxyList.put(UnoRuntime.generateOid(xac), c); - } - } - } - - public void disposing(com.sun.star.lang.EventObject eventObject) { - } - - public void notifyEvent(com.sun.star.accessibility.AccessibleEventObject accessibleEventObject) { - switch (accessibleEventObject.EventId) { - case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED: - logMessage(accessibleEventObject.Source, "Retrieved active descendant event."); - break; - case AccessibleEventId.STATE_CHANGED: - logStateChange(accessibleEventObject.Source, - accessibleEventObject.OldValue, - accessibleEventObject.NewValue); - break; - case AccessibleEventId.CHILD: - logMessage(accessibleEventObject.Source, "Retrieved children event."); - break; - case AccessibleEventId.BOUNDRECT_CHANGED: - logMessage(accessibleEventObject.Source, "Retrieved boundrect changed event."); - break; - case AccessibleEventId.VISIBLE_DATA_CHANGED: - logMessage(accessibleEventObject.Source, "Retrieved visible data changed event."); - break; - case AccessibleEventId.INVALIDATE_ALL_CHILDREN: - logMessage(accessibleEventObject.Source, "Retrieved invalidate children event."); - break; - default: - break; - } - } - - public void logStateChange(Object o, Object any1, Object any2) { - try { - if (AnyConverter.isShort(any1)) { - logStateChange(o, AnyConverter.toShort(any1), " is no longer "); - } - - if (AnyConverter.isShort(any2)) { - logStateChange(o, AnyConverter.toShort(any2), " is now "); - } - } catch (com.sun.star.lang.IllegalArgumentException e) { - } - } - - public void logStateChange(Object o, short n, String s) { - switch(n) { - case AccessibleStateType.ACTIVE: - logMessage(o, s + javax.accessibility.AccessibleState.ACTIVE); - break; - case AccessibleStateType.ARMED: - logMessage(o, s + javax.accessibility.AccessibleState.ARMED); - break; - case AccessibleStateType.CHECKED: - logMessage(o, s + javax.accessibility.AccessibleState.CHECKED); - break; - case AccessibleStateType.ENABLED: - logMessage(o, s + javax.accessibility.AccessibleState.ENABLED); - break; - case AccessibleStateType.FOCUSED: - logMessage(o, s + javax.accessibility.AccessibleState.FOCUSED); - break; - case AccessibleStateType.PRESSED: - logMessage(o, s + javax.accessibility.AccessibleState.PRESSED); - break; - case AccessibleStateType.SELECTED: - logMessage(o, s + javax.accessibility.AccessibleState.SELECTED); - break; - case AccessibleStateType.SENSITIVE: - logMessage(o, s + "sensitive"); - break; - case AccessibleStateType.SHOWING: - logMessage(o, s + javax.accessibility.AccessibleState.SHOWING); - break; - case AccessibleStateType.VISIBLE: - logMessage(o, s + javax.accessibility.AccessibleState.VISIBLE); - break; - default: - logMessage(o, s + "??? (FIXME)"); - break; - } - } - - protected static void logMessage(Object o, String s) { - XAccessibleContext xac = (XAccessibleContext) UnoRuntime.queryInterface(XAccessibleContext.class, o); - if( xac != null ) { - String oid = UnoRuntime.generateOid(xac); - synchronized (proxyList) { - logMessage( (javax.accessibility.Accessible) proxyList.get( oid ), s ); -// WeakReference r = (WeakReference) proxyList.get( oid ); -// if(r != null) { -// System.err.println( "*** Warning *** event is " + r.get() ); -// logMessage( (javax.accessibility.Accessible) r.get(), s ); -// } else { -// System.err.println( "*** Warning *** event source not found in broadcaster list" ); -// } - } - } else - System.err.println( "*** Warning *** event source does not implement XAccessibleContext" ); - } - - protected static void logMessage(javax.accessibility.Accessible a, String s) { - if (a != null) { - logMessage(a.getAccessibleContext(), s); - } else { - logMessage(s); - } - } - - protected static void logMessage(javax.accessibility.AccessibleContext ac, String s) { - if (ac != null) { - logMessage("[" + ac.getAccessibleRole() + "] " - + ac.getAccessibleName() + ": " + s); - } else { - logMessage(s); - } - } - - protected static void logMessage(String s) { - System.err.println(s); - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java deleted file mode 100644 index 13e9b2f6d..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.java.accessibility.logging; - -import com.sun.star.accessibility.*; -import com.sun.star.uno.*; - -/** The AccessibleHypertextImpl mapps all calls to the java AccessibleHypertext - * interface to the corresponding methods of the UNO XAccessibleHypertext - * interface. - */ -public class XAccessibleHypertextLog extends XAccessibleTextLog - implements com.sun.star.accessibility.XAccessibleHypertext { - - private com.sun.star.accessibility.XAccessibleHypertext unoObject; - - /** Creates a new instance of XAccessibleTextLog */ - public XAccessibleHypertextLog(XAccessibleHypertext xAccessibleHypertext) { - super(xAccessibleHypertext); - unoObject = xAccessibleHypertext; - } - - public XAccessibleHyperlink getHyperLink(int param) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.getHyperLink(param); - } - - public int getHyperLinkCount() { - return unoObject.getHyperLinkCount(); - } - - public int getHyperLinkIndex(int param) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.getHyperLinkIndex(param); - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java deleted file mode 100644 index b7a2ffc70..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java +++ /dev/null @@ -1,270 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package org.openoffice.java.accessibility.logging; - -import org.openoffice.java.accessibility.*; - - -/** - * - */ -public class XAccessibleTextLog - implements com.sun.star.accessibility.XAccessibleText { - private com.sun.star.accessibility.XAccessibleText unoObject; - private String name = "[Unknown] NoName"; - - /** Creates a new instance of XAccessibleTextLog */ - public XAccessibleTextLog( - com.sun.star.accessibility.XAccessibleText xAccessibleText) { - unoObject = xAccessibleText; - setName(xAccessibleText); - } - - private void setName( - com.sun.star.accessibility.XAccessibleText xAccessibleText) { - try { - com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = (com.sun.star.accessibility.XAccessibleContext) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class, - xAccessibleText); - - if (unoAccessibleContext != null) { - name = "[" + - AccessibleRoleAdapter.getAccessibleRole(unoAccessibleContext.getAccessibleRole()) + - "] " + unoAccessibleContext.getAccessibleName() + ": "; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - - private String getPartString(short s) { - String part = "INVALID"; - - switch (s) { - case com.sun.star.accessibility.AccessibleTextType.CHARACTER: - part = "CHARACTER"; - - break; - - case com.sun.star.accessibility.AccessibleTextType.WORD: - part = "WORD"; - - break; - - case com.sun.star.accessibility.AccessibleTextType.SENTENCE: - part = "SENTENCE"; - - break; - - case com.sun.star.accessibility.AccessibleTextType.LINE: - part = "LINE"; - - break; - - case com.sun.star.accessibility.AccessibleTextType.ATTRIBUTE_RUN: - part = "ATTRIBUTE_RUN"; - - break; - - default: - break; - } - - return part; - } - - private String dumpTextSegment(com.sun.star.accessibility.TextSegment ts) { - if (ts != null) { - return "(" + ts.SegmentStart + "," + ts.SegmentEnd + "," + - ts.SegmentText + ")"; - } - - return "NULL"; - } - - public boolean copyText(int param, int param1) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.copyText(param, param1); - } - - public int getCaretPosition() { - int pos = unoObject.getCaretPosition(); - System.err.println(name + "getCaretPosition() returns " + pos); - - return pos; - } - - public char getCharacter(int param) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.getCharacter(param); - } - - public com.sun.star.beans.PropertyValue[] getCharacterAttributes( - int param, String[] str) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.getCharacterAttributes(param, str); - } - - public com.sun.star.awt.Rectangle getCharacterBounds(int param) - throws com.sun.star.lang.IndexOutOfBoundsException { - try { - com.sun.star.awt.Rectangle r = unoObject.getCharacterBounds(param); - System.err.println(name + "getCharacterBounds(" + param + - ") returns (" + r.X + "," + r.Y + "," + r.Width + "," + - r.Height + ")"); - - return r; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.err.println("IndexOutOufBoundsException caught for " + name + - "getCharacterBounds(" + param + ")"); - throw e; - } - } - - public int getCharacterCount() { - return unoObject.getCharacterCount(); - } - - public int getIndexAtPoint(com.sun.star.awt.Point point) { - try { - int index = unoObject.getIndexAtPoint(point); - System.err.println(name + "getIndexAtPoint(" + point.X + ", " + - point.Y + ") returns " + index); - - return index; - } catch (com.sun.star.uno.RuntimeException e) { - System.err.println(name + - "RuntimeException caught for getIndexAtPoint(" + point.X + - ", " + point.Y + ")"); - System.err.println(e.getMessage()); - throw e; - } - } - - public String getSelectedText() { - return unoObject.getSelectedText(); - } - - public int getSelectionEnd() { - return unoObject.getSelectionEnd(); - } - - public int getSelectionStart() { - return unoObject.getSelectionStart(); - } - - public String getText() { - return unoObject.getText(); - } - - public com.sun.star.accessibility.TextSegment getTextAtIndex(int param, - short param1) - throws com.sun.star.lang.IndexOutOfBoundsException, - com.sun.star.lang.IllegalArgumentException { - try { - com.sun.star.accessibility.TextSegment ts = unoObject.getTextAtIndex(param, - param1); - System.err.println(name + "getTextAtIndex(" + - getPartString(param1) + "," + param + ") returns " + - dumpTextSegment(ts)); - - return ts; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.err.println("IndexOutOufBoundsException caught for " + name + - " getTextAtIndex(" + getPartString(param1) + "," + param1 + - ")"); - throw e; - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught for " + name + - " getTextAtIndex(" + getPartString(param1) + "," + param + ")"); - throw e; - } - } - - public com.sun.star.accessibility.TextSegment getTextBeforeIndex( - int param, short param1) - throws com.sun.star.lang.IndexOutOfBoundsException, - com.sun.star.lang.IllegalArgumentException { - try { - com.sun.star.accessibility.TextSegment ts = unoObject.getTextBeforeIndex(param, - param1); - System.err.println(name + " getTextBeforeIndex(" + - getPartString(param1) + "," + param + ") returns " + - dumpTextSegment(ts)); - - return ts; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.err.println("IndexOutOufBoundsException caught for " + name + - " getTextBeforeIndex(" + getPartString(param1) + "," + param1 + - ")"); - throw e; - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught for " + name + - " getTextBeforeIndex(" + getPartString(param1) + "," + param + - ")"); - throw e; - } - } - - public com.sun.star.accessibility.TextSegment getTextBehindIndex( - int param, short param1) - throws com.sun.star.lang.IndexOutOfBoundsException, - com.sun.star.lang.IllegalArgumentException { - try { - com.sun.star.accessibility.TextSegment ts = unoObject.getTextBehindIndex(param, - param1); - System.err.println(name + " getTextBehindIndex(" + - getPartString(param1) + "," + param + ") returns " + - dumpTextSegment(ts)); - - return ts; - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - System.err.println("IndexOutOufBoundsException caught for " + name + - " getTextBehindIndex(" + getPartString(param1) + "," + param1 + - ")"); - throw e; - } catch (com.sun.star.lang.IllegalArgumentException e) { - System.err.println("IllegalArgumentException caught for " + name + - " getTextBehindIndex(" + getPartString(param1) + "," + param + - ")"); - throw e; - } - } - - public String getTextRange(int param, int param1) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.getTextRange(param, param1); - } - - public boolean setCaretPosition(int param) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.setCaretPosition(param); - } - - public boolean setSelection(int param, int param1) - throws com.sun.star.lang.IndexOutOfBoundsException { - return unoObject.setSelection(param, param1); - } -} diff --git a/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk b/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk deleted file mode 100755 index 0d98760a3..000000000 --- a/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk +++ /dev/null @@ -1,115 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = accessibility -PRJ = ..$/..$/..$/..$/.. -TARGET = java_accessibility -PACKAGE = org$/openoffice$/java$/accessibility - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -JAVADIR = $(OUT)$/misc$/java -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - logging$/XAccessibleEventLog.java \ - logging$/XAccessibleHypertextLog.java \ - logging$/XAccessibleTextLog.java \ - AbstractButton.java \ - AccessibleActionImpl.java \ - AccessibleComponentImpl.java \ - AccessibleEditableTextImpl.java \ - AccessibleExtendedState.java \ - AccessibleHypertextImpl.java \ - AccessibleIconImpl.java \ - AccessibleKeyBinding.java \ - AccessibleObjectFactory.java \ - AccessibleRoleAdapter.java \ - AccessibleSelectionImpl.java \ - AccessibleStateAdapter.java \ - AccessibleTextImpl.java \ - AccessibleValueImpl.java \ - Alert.java \ - Application.java \ - Button.java \ - CheckBox.java \ - ComboBox.java \ - Component.java \ - Container.java \ - DescendantManager.java \ - Dialog.java \ - FocusTraversalPolicy.java \ - Frame.java \ - Icon.java \ - Label.java \ - List.java \ - Menu.java \ - MenuItem.java \ - MenuContainer.java \ - NativeFrame.java \ - Paragraph.java \ - RadioButton.java \ - ScrollBar.java \ - Separator.java \ - Table.java \ - TextComponent.java \ - ToggleButton.java \ - ToolTip.java \ - Tree.java \ - Window.java - -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:s/.java//).class) $(CLASSDIR)$/$(PACKAGE)$/Build.class - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -JARCLASSDIRS = $(PACKAGE) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -# Enable logging in non-product only -.IF "$(PRODUCT)"!="" -DEBUGSWITCH = false -PRODUCTSWITCH = true -.ELSE -PRODUCTSWITCH = false -DEBUGSWITCH = true -.ENDIF - -$(JAVADIR)$/$(PACKAGE)$/%.java: makefile.mk - @@-$(MKDIRHIER) $(JAVADIR)$/$(PACKAGE) - @-echo package org.openoffice.java.accessibility\; > $@ - @-echo public class Build { >> $@ - @-echo public static final boolean DEBUG = $(DEBUGSWITCH)\; >> $@ - @-echo public static final boolean PRODUCT = $(PRODUCTSWITCH)\; >> $@ - @-echo } >> $@ - -$(CLASSDIR)$/$(PACKAGE)$/Build.class : $(JAVADIR)$/$(PACKAGE)$/Build.java - -$(JAVAC) -d $(CLASSDIR) $(JAVADIR)$/$(PACKAGE)$/Build.java - diff --git a/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx b/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx deleted file mode 100644 index 0466a646a..000000000 --- a/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -//------------------------------------------------------------------------ -// includes -//------------------------------------------------------------------------ - -#ifdef WNT -#include -#include -#endif - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "jvmaccess/unovirtualmachine.hxx" - -#include "jvmaccess/virtualmachine.hxx" - -#include - -using ::rtl::OUString; -using ::com::sun::star::uno::Mapping; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::RuntimeException; -using namespace ::com::sun::star::accessibility; - -long VCLEventListenerLinkFunc(void * pInst, void * pData); - -//------------------------------------------------------------------------ -// global vatiables -//------------------------------------------------------------------------ - -Link g_aEventListenerLink(NULL, VCLEventListenerLinkFunc); - -rtl::Reference< jvmaccess::UnoVirtualMachine > g_xUnoVirtualMachine; -typelib_InterfaceTypeDescription * g_pTypeDescription = NULL; -Mapping g_unoMapping; - -jclass g_jcWindowsAccessBridgeAdapter = NULL; -jmethodID g_jmRegisterTopWindow = 0; -jmethodID g_jmRevokeTopWindow = 0; - -//------------------------------------------------------------------------ -// functions -//------------------------------------------------------------------------ - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *, void *) -{ - return JNI_VERSION_1_2; -} - -JNIEXPORT jbyteArray JNICALL -Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_getProcessID(JNIEnv *pJNIEnv, jclass clazz) -{ - // Initialize global class and method references - g_jcWindowsAccessBridgeAdapter = - static_cast< jclass > (pJNIEnv->NewGlobalRef(clazz)); - if (NULL == g_jcWindowsAccessBridgeAdapter) { - return 0; /* jni error occurred */ - } - g_jmRegisterTopWindow = - pJNIEnv->GetStaticMethodID(clazz, "registerTopWindow", "(ILcom/sun/star/accessibility/XAccessible;)V"); - if (0 == g_jmRegisterTopWindow) { - return 0; /* jni error occurred */ - } - g_jmRevokeTopWindow = - pJNIEnv->GetStaticMethodID(clazz, "revokeTopWindow", "(ILcom/sun/star/accessibility/XAccessible;)V"); - if (0 == g_jmRevokeTopWindow) { - return 0; /* jni error occurred */ - } - - // Use the special protocol of XJavaVM.getJavaVM: If the passed in - // process ID has an extra 17th byte of value one, the returned any - // contains a pointer to a jvmaccess::UnoVirtualMachine, instead of - // the underlying JavaVM pointer: - jbyte processID[17]; - rtl_getGlobalProcessId(reinterpret_cast (processID)); - // #i51265# we need a jvmaccess::UnoVirtualMachine pointer for the - // uno_getEnvironment() call later. - processID[16] = 1; - - // Copy the result into a java byte[] and return. - jbyteArray jbaProcessID = pJNIEnv->NewByteArray(17); - pJNIEnv->SetByteArrayRegion(jbaProcessID, 0, 17, processID); - return jbaProcessID; -} - -JNIEXPORT jboolean JNICALL -Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_createMapping(JNIEnv *, jclass, jlong pointer) -{ - uno_Environment * pJava_environment = NULL; - uno_Environment * pUno_environment = NULL; - - try { - // We get a non-refcounted pointer to a jvmaccess::VirtualMachine - // from the XJavaVM service (the pointer is guaranteed to be valid - // as long as our reference to the XJavaVM service lasts), and - // convert the non-refcounted pointer into a refcounted one - // immediately: - g_xUnoVirtualMachine = reinterpret_cast< jvmaccess::UnoVirtualMachine * >(pointer); - - if ( g_xUnoVirtualMachine.is() ) - { - OUString sJava(RTL_CONSTASCII_USTRINGPARAM("java")); - uno_getEnvironment(&pJava_environment, sJava.pData, g_xUnoVirtualMachine.get()); - - OUString sCppu_current_lb_name(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)); - uno_getEnvironment(&pUno_environment, sCppu_current_lb_name.pData, NULL); - - if ( pJava_environment && pUno_environment ) - { - g_unoMapping = Mapping(pUno_environment, pJava_environment); - getCppuType((::com::sun::star::uno::Reference< XAccessible > *) 0).getDescription((typelib_TypeDescription **) & g_pTypeDescription); - } - - if ( pJava_environment ) - { - // release java environment - pJava_environment->release(pJava_environment); - pJava_environment = NULL; - } - - if ( pUno_environment ) - { - // release uno environment - pUno_environment->release(pUno_environment); - pUno_environment = NULL; - } - } - } - - catch ( RuntimeException &e) - { - OSL_TRACE("RuntimeException caught while initializing the mapping"); - } - - if ( (0 != g_jmRegisterTopWindow) && (0 != g_jmRevokeTopWindow) ) - { - ::Application::AddEventListener(g_aEventListenerLink); - } - return JNI_TRUE; -} - -JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *jvm, void *) -{ - ::Application::RemoveEventListener(g_aEventListenerLink); - - if ( NULL != g_jcWindowsAccessBridgeAdapter ) - { - JNIEnv * pJNIEnv; - if ( ! jvm->GetEnv((void **) &pJNIEnv, JNI_VERSION_1_2) ) - { - pJNIEnv->DeleteGlobalRef(g_jcWindowsAccessBridgeAdapter); - g_jcWindowsAccessBridgeAdapter = NULL; - } - } - - if ( NULL != g_pTypeDescription ) - { - typelib_typedescription_release( reinterpret_cast< typelib_TypeDescription * > (g_pTypeDescription) ); - g_pTypeDescription = NULL; - } - - g_unoMapping.clear(); - g_xUnoVirtualMachine.clear(); -} - -HWND GetHWND(Window * pWindow) -{ - const SystemEnvData * pEnvData = pWindow->GetSystemData(); - if (pEnvData != NULL) - { - return pEnvData->hWnd; - } - return (HWND) -1; -} - -void handleWindowEvent(Window * pWindow, bool bShow) -{ - if ( pWindow && pWindow->IsTopWindow() ) - { - ::com::sun::star::uno::Reference< XAccessible > xAccessible; - - // Test for combo box - drop down floating windows first - Window * pParentWindow = pWindow->GetParent(); - - if ( pParentWindow ) - { - try - { - // The parent window of a combo box floating window should have the role COMBO_BOX - ::com::sun::star::uno::Reference< XAccessible > xParentAccessible(pParentWindow->GetAccessible()); - if ( xParentAccessible.is() ) - { - ::com::sun::star::uno::Reference< XAccessibleContext > xParentAC(xParentAccessible->getAccessibleContext()); - if ( xParentAC.is() && (AccessibleRole::COMBO_BOX == xParentAC->getAccessibleRole()) ) - { - // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent. - // Let's not rely on a specific child order, just search for the child with the role LIST - sal_Int32 nCount = xParentAC->getAccessibleChildCount(); - for ( sal_Int32 n = 0; (n < nCount) && !xAccessible.is(); n++) - { - ::com::sun::star::uno::Reference< XAccessible > xChild = xParentAC->getAccessibleChild(n); - if ( xChild.is() ) - { - ::com::sun::star::uno::Reference< XAccessibleContext > xChildAC = xChild->getAccessibleContext(); - if ( xChildAC.is() && (AccessibleRole::LIST == xChildAC->getAccessibleRole()) ) - { - xAccessible = xChild; - } - } - } - } - } - } - catch (::com::sun::star::uno::RuntimeException &e) - { - // Ignore show events that throw DisposedExceptions in getAccessibleContext(), - // but keep revoking these windows in hide(s). - if (bShow) - return; - } - } - - // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext - // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the - // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete. - if ( ! xAccessible.is() ) - xAccessible = pWindow->GetAccessible(); - - if ( xAccessible.is() && g_unoMapping.is() ) - { - jobject * joXAccessible = reinterpret_cast < jobject * > (g_unoMapping.mapInterface( - xAccessible.get(), g_pTypeDescription)); - - if ( NULL != joXAccessible ) - { - jvmaccess::VirtualMachine::AttachGuard aGuard(g_xUnoVirtualMachine->getVirtualMachine()); - JNIEnv * pJNIEnv = aGuard.getEnvironment(); - - if ( NULL != pJNIEnv ) - { - // g_jmRegisterTopWindow and g_jmRevokeTopWindow are ensured to be != 0 - otherwise - // the event listener would not have been attached. - pJNIEnv->CallStaticVoidMethod(g_jcWindowsAccessBridgeAdapter, - (bShow) ? g_jmRegisterTopWindow : g_jmRevokeTopWindow, - (jint) GetHWND(pWindow), joXAccessible ); - - // Clear any exception that might have been occurred. - if (pJNIEnv->ExceptionCheck()) { - pJNIEnv->ExceptionClear(); - } - } - } - } - } -} - -long VCLEventListenerLinkFunc(void *, void * pData) -{ - ::VclSimpleEvent const * pEvent = (::VclSimpleEvent const *) pData; - - switch (pEvent->GetId()) - { - case VCLEVENT_WINDOW_SHOW: - handleWindowEvent(((::VclWindowEvent const *) pEvent)->GetWindow(), true); - break; - case VCLEVENT_WINDOW_HIDE: - handleWindowEvent(((::VclWindowEvent const *) pEvent)->GetWindow(), false); - break; - } - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/bridge/source/java/exports.dxp b/accessibility/bridge/source/java/exports.dxp deleted file mode 100644 index c97dba7d0..000000000 --- a/accessibility/bridge/source/java/exports.dxp +++ /dev/null @@ -1,4 +0,0 @@ -JNI_OnLoad -JNI_OnUnload -Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_getProcessID -Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_createMapping diff --git a/accessibility/bridge/source/java/makefile.mk b/accessibility/bridge/source/java/makefile.mk deleted file mode 100644 index 5aeb21c11..000000000 --- a/accessibility/bridge/source/java/makefile.mk +++ /dev/null @@ -1,70 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=accessibility -TARGET=accessbridge -LIBTARGET=NO -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE -VERSIONOBJ= - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(GUI)"=="WNT" && "$(SOLAR_JAVA)" != "" - -SLOFILES= $(SLO)$/WindowsAccessBridgeAdapter.obj - -SHL1TARGET=java_uno_accessbridge -SHL1IMPLIB=i$(SHL1TARGET) -SHL1STDLIBS=$(VCLLIB) $(TOOLSLIB) $(JVMACCESSLIB) $(CPPULIB) $(SALLIB) -SHL1OBJS=$(SLOFILES) -SHL1VERSIONOBJ= - -DEF1NAME=$(SHL1TARGET) -DEF1EXPORTFILE=exports.dxp - -SHL1HEADER=$(OUT)$/inc$/WindowsAccessBridgeAdapter.h - -.ENDIF # "$(GUI)"=="WNT" && "$(SOLAR_JAVA)" != "" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -.IF "$(GUI)"=="WNT" && "$(SOLAR_JAVA)" != "" - -$(SLO)$/WindowsAccessBridgeAdapter.obj : $(SHL1HEADER) - -$(SHL1HEADER) : - javah -classpath $(OUT)$/class -o $(SHL1HEADER) org.openoffice.accessibility.WindowsAccessBridgeAdapter - -.ENDIF # "$(GUI)"=="WNT" && "$(SOLAR_JAVA)" != "" diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx deleted file mode 100644 index 0944dc679..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX - -#include -#include -#include - - -#include - -// ============================================================================ - -namespace accessibility { - - class AccessibleBrowseBoxImpl; - class AccessibleBrowseBoxTable; - -// ============================================================================ - -/** This class represents the complete accessible BrowseBox object. */ -class AccessibleBrowseBox : public AccessibleBrowseBoxBase -{ - friend class AccessibleBrowseBoxAccess; - -protected: - AccessibleBrowseBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, - ::svt::IAccessibleTableProvider& _rBrowseBox - ); - - virtual ~AccessibleBrowseBox(); - - /** sets the XAccessible which created the context - -

To be called only once, and only if in the ctor NULL was passed.

- */ - void setCreator( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator - ); - - /** Cleans up members. */ - using AccessibleBrowseBoxBase::disposing; - virtual void SAL_CALL disposing(); - -protected: - // XAccessibleContext ----------------------------------------------------- - - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The role of this object (a table). */ -// virtual sal_Int16 SAL_CALL getAccessibleRole() -// throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return - The accessible child rendered under the given point. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to the BrowseBox. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - -public: - // helper functions - /** commitHeaderBarEvent commit the event at all listeners of the column/row header bar - @param nEventId - the event id - @param rNewValue - the new value - @param rOldValue - the old value - */ - void commitHeaderBarEvent(sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, - const ::com::sun::star::uno::Any& rOldValue,sal_Bool _bColumnHeaderBar = sal_True); - - // helper functions - /** commitTableEvent commit the event at all listeners of the table - @param nEventId - the event id - @param rNewValue - the new value - @param rOldValue - the old value - */ - void commitTableEvent(sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, - const ::com::sun::star::uno::Any& rOldValue); - - /** returns the accessible object for the row or the column header bar - */ - inline ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) - { - return implGetHeaderBar(_eObjType); - } - - /** returns the accessible object for the table representation - */ - inline ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - getTable( ) - { - return implGetTable(); - } - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - // internal helper methods ------------------------------------------------ - - /** This method creates (once) and returns the accessible data table child. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the data table. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > implGetTable(); - - /** This method creates (once) and returns the specified header bar. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the header bar. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetHeaderBar( ::svt::AccessibleBrowseBoxObjType eObjType ); - - /** This method returns one of the children that are always present: - Data table, row and column header bar or corner control. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the specified child. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetFixedChild( sal_Int32 nChildIndex ); - - /** This method creates and returns an accessible table. - @return An AccessibleBrowseBoxTable. */ - virtual AccessibleBrowseBoxTable* createAccessibleTable(); - -private: - // members ---------------------------------------------------------------- - ::std::auto_ptr< AccessibleBrowseBoxImpl > m_pImpl; -}; - -// ============================================================================ -/** the XAccessible which creates/returns an AccessibleBrowseBox - -

The instance holds it's XAccessibleContext with a hard reference, while - the contxt holds this instance weak.

-*/ -typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible - > AccessibleBrowseBoxAccess_Base; - -class AccessibleBrowseBoxAccess :public AccessibleBrowseBoxAccess_Base - ,public ::svt::IAccessibleBrowseBox -{ -private: - ::osl::Mutex m_aMutex; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - m_xParent; - ::svt::IAccessibleTableProvider& m_rBrowseBox; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - m_xContext; - AccessibleBrowseBox* m_pContext; - // note that this pointer is valid as long as m_xContext is valid! - -public: - AccessibleBrowseBoxAccess( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::IAccessibleTableProvider& _rBrowseBox - ); - - /// checks whether the accessible context is still alive - bool isContextAlive() const; - - /// returns the AccessibleContext belonging to this Accessible - inline AccessibleBrowseBox* getContext() { return m_pContext; } - inline const AccessibleBrowseBox* getContext() const { return m_pContext; } - -protected: - virtual ~AccessibleBrowseBoxAccess(); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); - - // IAccessibleBrowseBox - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getMyself() - { - return this; - } - void dispose(); - virtual sal_Bool isAlive() const - { - return isContextAlive(); - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; - AccessibleBrowseBox* pContext( getContext() ); - if ( pContext ) - xAccessible = pContext->getHeaderBar( _eObjType ); - return xAccessible; - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getTable() - { - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; - AccessibleBrowseBox* pContext( getContext() ); - if ( pContext ) - xAccessible = pContext->getTable(); - return xAccessible; - } - virtual void commitHeaderBarEvent( sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue, - const ::com::sun::star::uno::Any& rOldValue, sal_Bool _bColumnHeaderBar ) - { - AccessibleBrowseBox* pContext( getContext() ); - if ( pContext ) - pContext->commitHeaderBarEvent( nEventId, rNewValue, rOldValue, _bColumnHeaderBar ); - } - virtual void commitTableEvent( sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) - { - AccessibleBrowseBox* pContext( getContext() ); - if ( pContext ) - pContext->commitTableEvent( nEventId, rNewValue, rOldValue ); - } - virtual void commitEvent( sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) - { - AccessibleBrowseBox* pContext( getContext() ); - if ( pContext ) - pContext->commitEvent( nEventId, rNewValue, rOldValue ); - } - -private: - AccessibleBrowseBoxAccess(); // never implemented - AccessibleBrowseBoxAccess( const AccessibleBrowseBoxAccess& ); // never implemented - AccessibleBrowseBoxAccess& operator=( const AccessibleBrowseBoxAccess& ); // never implemented -}; - -// ============================================================================ -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx deleted file mode 100644 index 912080532..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx +++ /dev/null @@ -1,515 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ============================================================================ - -class Window; - -namespace utl { - class AccessibleStateSetHelper; -} - -namespace svt { - class IAccessibleTableProvider; -} - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -typedef ::cppu::WeakAggComponentImplHelper5< - ::com::sun::star::accessibility::XAccessibleContext, - ::com::sun::star::accessibility::XAccessibleComponent, - ::com::sun::star::accessibility::XAccessibleEventBroadcaster, - ::com::sun::star::awt::XFocusListener, - ::com::sun::star::lang::XServiceInfo > - AccessibleBrowseBoxImplHelper; - -/** The BrowseBox accessible objects inherit from this base class. It - implements basic functionality for various Accessibility interfaces and - the event broadcaster and contains the ::osl::Mutex. */ -class AccessibleBrowseBoxBase : - public ::comphelper::OBaseMutex, - public AccessibleBrowseBoxImplHelper -{ -public: - /** Constructor sets specified name and description. If the constant of a - text is BBTEXT_NONE, the derived class has to set the text via - implSetName() and implSetDescription() (in Ctor) or later via - setAccessibleName() and setAccessibleDescription() (these methods - notify the listeners about the change). - @param rxParent XAccessible interface of the parent object. - @param rBrowseBox The BrowseBox control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. */ - AccessibleBrowseBoxBase( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::AccessibleBrowseBoxObjType eObjType ); - - /** Constructor sets specified name and description. - @param rxParent XAccessible interface of the parent object. - @param rBrowseBox The BrowseBox control. - @param rName The name of this object. - @param rDescription The description text of this object. */ - AccessibleBrowseBoxBase( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::AccessibleBrowseBoxObjType eObjType, - const ::rtl::OUString& rName, - const ::rtl::OUString& rDescription ); - -protected: - virtual ~AccessibleBrowseBoxBase(); - - /** Commits DeFunc event to listeners and cleans up members. */ - virtual void SAL_CALL disposing(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return A reference to the parent accessible object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The description of this object. - */ - virtual ::rtl::OUString SAL_CALL getAccessibleDescription() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The name of this object. - */ - virtual ::rtl::OUString SAL_CALL getAccessibleName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The relation set (the BrowseBox does not have one). - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL - getAccessibleRelationSet() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The set of current states. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL - getAccessibleStateSet() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The parent's locale. */ - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() - throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, - ::com::sun::star::uno::RuntimeException ); - - /** @return - The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. - */ - virtual sal_Int16 SAL_CALL getAccessibleRole() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleChildCount, - - getAccessibleChild, - - getAccessibleRole. - Derived classes may overwrite getAccessibleIndexInParent to increase - performance. */ - - // XAccessibleComponent --------------------------------------------------- - - /** @return - , if the point lies within the bounding box of this object. */ - virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The bounding box of this object. */ - virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The upper left corner of the bounding box relative to the parent. */ - virtual ::com::sun::star::awt::Point SAL_CALL getLocation() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The upper left corner of the bounding box in screen coordinates. */ - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The size of the bounding box. */ - virtual ::com::sun::star::awt::Size SAL_CALL getSize() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object is showing. */ - virtual sal_Bool SAL_CALL isShowing() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object is visible. */ - virtual sal_Bool SAL_CALL isVisible() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object can accept the focus. */ - virtual sal_Bool SAL_CALL isFocusTraversable() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XFocusListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); - - /* Derived classes have to implement: - - getAccessibleAt, - - grabFocus, - - getAccessibleKeyBinding. */ - - /** @return - No key bindings supported by default. - */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - /** @return - The accessible child rendered under the given point. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleEventBroadcaster -------------------------------------------- - - /** Adds a new event listener */ - using cppu::WeakAggComponentImplHelperBase::addEventListener; - virtual void SAL_CALL addEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Removes an event listener. */ - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL removeEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - // XTypeProvider ---------------------------------------------------------- - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return Whether the specified service is supported by this class. */ - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return A list of all supported services. */ - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getImplementationName. */ - - // helper methods --------------------------------------------------------- - - /** @return The BrowseBox object type. */ - inline ::svt::AccessibleBrowseBoxObjType getType() const; - - /** Changes the name of the object and notifies listeners. */ - void setAccessibleName( const ::rtl::OUString& rName ); - /** Changes the description of the object and notifies listeners. */ - void setAccessibleDescription( const ::rtl::OUString& rDescription ); - - /** Commits an event to all listeners. */ - void commitEvent( - sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, - - const ::com::sun::star::uno::Any& rOldValue ); - /** @return , if the object is not disposed or disposing. */ - sal_Bool isAlive() const; - -protected: - // internal virtual methods ----------------------------------------------- - - /** Determines whether the BrowseBox control is really showing inside of - its parent accessible window. Derived classes may implement different - behaviour. - @attention This method requires locked mutex's and a living object. - @return , if the object is really showing. */ - virtual sal_Bool implIsShowing(); - - /** Derived classes return the bounding box relative to the parent window. - @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox() = 0; - /** Derived classes return the bounding box in screen coordinates. - @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen() = 0; - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. This method calls FillStateSet at the BrowseBox which - fills it with more states depending on the object type. Derived classes - may overwrite this method and add more states. - @attention This method requires locked mutex's. - @return A filled AccessibleStateSetHelper. */ - virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - // internal helper methods ------------------------------------------------ - - /** @throws DisposedException If the object is not alive. */ - void ensureIsAlive() const - throw ( ::com::sun::star::lang::DisposedException ); - - /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ - inline ::osl::Mutex& getOslMutex(); - /** @return Pointer to the global ::osl::Mutex. */ - static inline ::osl::Mutex* getOslGlobalMutex(); - - /** Changes the name of the object (flat assignment, no notify). - @attention This method requires a locked mutex. */ - inline void implSetName( const ::rtl::OUString& rName ); - /** Changes the description of the object (flat assignment, no notify). - @attention This method requires a locked mutex. */ - inline void implSetDescription( const ::rtl::OUString& rDescription ); - - /** Locks all mutex's and calculates the bounding box relative to the - parent window. - @return The bounding box (VCL rect.) relative to the parent object. */ - Rectangle getBoundingBox() - throw ( ::com::sun::star::lang::DisposedException ); - /** Locks all mutex's and calculates the bounding box in screen - coordinates. - @return The bounding box (VCL rect.) in screen coordinates. */ - Rectangle getBoundingBoxOnScreen() - throw ( ::com::sun::star::lang::DisposedException ); - - ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } - void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } - -public: - // public versions of internal helper methods, with access control - struct AccessControl { friend class SolarMethodGuard; private: AccessControl() { } }; - - inline ::osl::Mutex& getMutex( const AccessControl& ) { return getOslMutex(); } - inline void ensureIsAlive( const AccessControl& ) { ensureIsAlive(); } - -protected: - // members ---------------------------------------------------------------- - - /** The parent accessible object. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > mxParent; - /** The VCL BrowseBox control. */ - ::svt::IAccessibleTableProvider* mpBrowseBox; - - /** This is the window which get all the nice focus events - */ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xFocusWindow; - -private: - /** Localized name. */ - ::rtl::OUString maName; - /** Localized description text. */ - ::rtl::OUString maDescription; - - /** The type of this object (for names, descriptions, state sets, ...). */ - ::svt::AccessibleBrowseBoxObjType meObjType; - - ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; -}; - -// ============================================================================ -// a version of AccessibleBrowseBoxBase which implements not only the XAccessibleContext, -// but also the XAccessible - -typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible - > BrowseBoxAccessibleElement_Base; - -class BrowseBoxAccessibleElement - :public AccessibleBrowseBoxBase - ,public BrowseBoxAccessibleElement_Base -{ -protected: - /** Constructor sets specified name and description. If the constant of a - text is BBTEXT_NONE, the derived class has to set the text via - implSetName() and implSetDescription() (in Ctor) or later via - setAccessibleName() and setAccessibleDescription() (these methods - notify the listeners about the change). - - @param rxParent XAccessible interface of the parent object. - @param rBrowseBox The BrowseBox control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. - */ - BrowseBoxAccessibleElement( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::AccessibleBrowseBoxObjType eObjType ); - - /** Constructor sets specified name and description. - - @param rxParent XAccessible interface of the parent object. - @param rBrowseBox The BrowseBox control. - @param rName The name of this object. - @param rDescription The description text of this object. - */ - BrowseBoxAccessibleElement( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::AccessibleBrowseBoxObjType eObjType, - const ::rtl::OUString& rName, - const ::rtl::OUString& rDescription ); - -public: - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - -protected: - virtual ~BrowseBoxAccessibleElement(); - -protected: - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() - throw ( ::com::sun::star::uno::RuntimeException ); - -private: - BrowseBoxAccessibleElement(); // never implemented - BrowseBoxAccessibleElement( const BrowseBoxAccessibleElement& ); // never implemented - BrowseBoxAccessibleElement& operator=( const BrowseBoxAccessibleElement& ); // never implemented -}; - -// ============================================================================ -// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex - -typedef ::osl::MutexGuard OslMutexGuard; - -class SolarMethodGuard : public SolarMutexGuard, public OslMutexGuard -{ -public: - inline SolarMethodGuard( AccessibleBrowseBoxBase& _rOwner, bool _bEnsureAlive = true ) - :SolarMutexGuard( ) - ,OslMutexGuard( _rOwner.getMutex( AccessibleBrowseBoxBase::AccessControl() ) ) - { - if ( _bEnsureAlive ) - _rOwner.ensureIsAlive( AccessibleBrowseBoxBase::AccessControl() ); - } -}; - -// inlines -------------------------------------------------------------------- - -inline ::svt::AccessibleBrowseBoxObjType AccessibleBrowseBoxBase::getType() const -{ - return meObjType; -} - -inline ::osl::Mutex& AccessibleBrowseBoxBase::getOslMutex() -{ - return m_aMutex; -} - -inline ::osl::Mutex* AccessibleBrowseBoxBase::getOslGlobalMutex() -{ - return ::osl::Mutex::getGlobalMutex(); -} - -inline void AccessibleBrowseBoxBase::implSetName( - const ::rtl::OUString& rName ) -{ - maName = rName; -} - -inline void AccessibleBrowseBoxBase::implSetDescription( - const ::rtl::OUString& rDescription ) -{ - maDescription = rDescription; -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx deleted file mode 100644 index 550dd40d1..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX - -#include -#include -#include -#include "accessibility/extended/accessiblebrowseboxcell.hxx" -#include -#include -// ============================================================================ -namespace accessibility -{ -// ============================================================================ - typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleValue - > AccessibleCheckBoxCell_BASE; - - class AccessibleCheckBoxCell : public AccessibleBrowseBoxCell - ,public AccessibleCheckBoxCell_BASE - { - private: - TriState m_eState; - sal_Bool m_bEnabled; - sal_Bool m_bIsTriState; - - protected: - virtual ~AccessibleCheckBoxCell() {} - - virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - public: - AccessibleCheckBoxCell(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - const TriState& _eState, - sal_Bool _bEnabled, - sal_Bool _bIsTriState = sal_True); - - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); - virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); - - // internal - void SetChecked( sal_Bool _bChecked ); - }; -} -#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx deleted file mode 100644 index 2cf5d0930..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx +++ /dev/null @@ -1,283 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX - -#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx" -#include -#include - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessibleSelection > - AccessibleBrowseBoxHeaderBarImplHelper; - -/** This class represents the accessible object of a header bar of a BrowseBox - control (row or column header bar). This object supports the - XAccessibleSelection interface. Selecting a child of this object selects - complete rows or columns of the data table. */ -class AccessibleBrowseBoxHeaderBar : - public AccessibleBrowseBoxTableBase, - public AccessibleBrowseBoxHeaderBarImplHelper -{ -public: - /** @param eObjType One of the two allowed types BBTYPE_ROWHEADERBAR or - BBTYPE_COLUMNHEADERBAR. */ - AccessibleBrowseBoxHeaderBar( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - ::svt::AccessibleBrowseBoxObjType eObjType ); - -protected: - virtual ~AccessibleBrowseBoxHeaderBar(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return - The XAccessible interface of the specified child. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return The accessible child rendered under the given point. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to (the current cell of) the data table. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleTable ------------------------------------------------------- - - /** @return The description text of the specified row. */ - virtual ::rtl::OUString SAL_CALL - getAccessibleRowDescription( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The description text of the specified column. */ - virtual ::rtl::OUString SAL_CALL - getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the row header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleRowHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the column header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleColumnHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected rows. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleRows() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected columns. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleColumns() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified row is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified column is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the cell object at the specified - cell position. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified cell is selected. */ - virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XAccessibleSelection --------------------------------------------------- - - /** Selects the specified child (row or column of the table). */ - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified child (row/column) is selected. */ - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Clears the complete selection. */ - virtual void SAL_CALL clearAccessibleSelection() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Selects all children or first, if multiselection is not supported. */ - virtual void SAL_CALL selectAllAccessibleChildren() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The number of selected rows/columns. */ - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The specified selected row/column. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Removes the specified row/column from the selection. */ - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - - // XServiceInfo ----------------------------------------------------------- - - /** @return The name of this class. */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - /** @attention This method requires locked mutex's and a living object. - @return The count of used rows. */ - virtual sal_Int32 implGetRowCount() const; - /** @attention This method requires locked mutex's and a living object. - @return The count of used columns. */ - virtual sal_Int32 implGetColumnCount() const; - - // internal helper methods ------------------------------------------------ - - /** @return , if the objects is a header bar for rows. */ - inline sal_Bool isRowBar() const; - /** @return , if the objects is a header bar for columns. */ - inline sal_Bool isColumnBar() const; - - /** Returns the specified row or column. Uses one of the parameters, - depending on object type. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the specified column/row. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos ); - - /** @attention This method requires locked mutex's and a living object. - @return The absolute child index from the index of selected children. - @throws IndexOutOfBoundsException - If the specified index is invalid. */ - sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified row/column index (depending on type) is invalid. */ - void ensureIsValidHeaderIndex( sal_Int32 nIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); -}; - -// inlines -------------------------------------------------------------------- - -inline sal_Bool AccessibleBrowseBoxHeaderBar::isRowBar() const -{ - return getType() == ::svt::BBTYPE_ROWHEADERBAR; -} - -inline sal_Bool AccessibleBrowseBoxHeaderBar::isColumnBar() const -{ - return getType() == ::svt::BBTYPE_COLUMNHEADERBAR; -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx deleted file mode 100644 index f23822f5e..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX - -#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" - -namespace accessibility -{ - class AccessibleBrowseBoxHeaderCell : public BrowseBoxAccessibleElement - { - sal_Int32 m_nColumnRowId; - public: - AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::AccessibleBrowseBoxObjType _eObjType); - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to the BrowseBox. */ - virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); - - inline sal_Bool isRowBarCell() const - { - return getType() == ::svt::BBTYPE_ROWHEADERCELL; - } - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - protected: - virtual Rectangle implGetBoundingBox(); - - virtual Rectangle implGetBoundingBoxOnScreen(); - }; -} - -#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx deleted file mode 100644 index 0aca86571..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX - -#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx" - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -/** This class represents the accessible object of the data table of a - BrowseBox control. */ -class AccessibleBrowseBoxTable : public AccessibleBrowseBoxTableBase -{ - friend class AccessibleBrowseBox; // to create header bars - -public: - AccessibleBrowseBoxTable( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox ); - -protected: - virtual ~AccessibleBrowseBoxTable(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return The accessible child rendered under the given point. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to (the current cell of) the data table. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleTable ------------------------------------------------------- - - /** @return The description text of the specified row. */ - virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The description text of the specified column. */ - virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the row header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleRowHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the column header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleColumnHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected rows. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleRows() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected columns. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleColumns() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified row is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified column is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the cell object at the specified - cell position. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified cell is selected. */ - virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return The name of this class. */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - // internal helper methods ------------------------------------------------ - - /** @attention This method requires a locked mutex. - @return The XAccessibleTable interface of the specified header bar. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > - implGetHeaderBar( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::uno::RuntimeException ); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx deleted file mode 100644 index c24001f31..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx +++ /dev/null @@ -1,282 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX - -#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" -#include -#include - -// ============================================================================ - -namespace accessibility { - -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessibleTable > - AccessibleBrowseBoxTableImplHelper; - -/** The BrowseBox accessible table objects inherit from this base class. It - implements basic functionality for the XAccessibleTable interface. - BrowseBox table objects are: the data table, the column header bar and the - row header bar. */ -class AccessibleBrowseBoxTableBase : - public BrowseBoxAccessibleElement, - public AccessibleBrowseBoxTableImplHelper -{ -public: - /** Constructor sets specified name and description. If the constant of a - text is BBTEXT_NONE, the derived class has to set the text via - implSetName() and implSetDescription() (in Ctor) or later via - setAccessibleName() and setAccessibleDescription() (these methods - notify the listeners about the change). - @param rxParent XAccessible interface of the parent object. - @param rBrowseBox The BrowseBox control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. */ - AccessibleBrowseBoxTableBase( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::IAccessibleTableProvider& rBrowseBox, - ::svt::AccessibleBrowseBoxObjType eObjType ); - -protected: - virtual ~AccessibleBrowseBoxTableBase(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The role of this object (a table). */ - virtual sal_Int16 SAL_CALL getAccessibleRole() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleChild, - - getAccessibleIndexInParent. */ - - // XAccessibleComponent --------------------------------------------------- - - /* Derived classes have to implement: - - getAccessibleAt, - - grabFocus, - - getAccessibleKeyBinding. */ - - // XAccessibleTable ------------------------------------------------------- - - /** @return The number of used rows in the table (0 = empty table). */ - virtual sal_Int32 SAL_CALL getAccessibleRowCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The number of used columns in the table (0 = empty table). */ - virtual sal_Int32 SAL_CALL getAccessibleColumnCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The row extent of the specified cell (always 1). */ - virtual sal_Int32 SAL_CALL - getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The column extent of the specified cell (always 1). */ - virtual sal_Int32 SAL_CALL - getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The caption cell of the table (not supported). */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCaption() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The summary object of the table (not supported). */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleSummary() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The child index of the specified cell. */ - virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The row index of the specified child cell. */ - virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The column index of the specified child cell. */ - virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleRowDescription, - - getAccessibleColumnDescription, - - getAccessibleRowHeaders, - - getAccessibleColumnHeaders, - - getSelectedAccessibleRows, - - getSelectedAccessibleColumns, - - isAccessibleRowSelected, - - isAccessibleColumnSelected, - - getAccessibleCellAt, - - isAccessibleSelected. */ - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - - // XTypeProvider ---------------------------------------------------------- - - /** @return A sequence of possible types (received from base classes). */ - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /* Derived classes have to implement: - - getImplementationName */ - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The count of data rows without header bar. */ - virtual sal_Int32 implGetRowCount() const; - /** @attention This method requires locked mutex's and a living object. - @return The count of data columns without "handle column". */ - virtual sal_Int32 implGetColumnCount() const; - - // internal helper methods ------------------------------------------------ - - /** @return , if first BrowseBox column is the "handle column". */ - sal_Bool implHasHandleColumn() const; - - /** @attention This method requires locked mutex's and a living object. - @param nColumn - the position of the column in the Accessible world - @return - the position of the column in VCL the Accessible world - */ - sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; - - /** @attention This method requires locked mutex's and a living object. - @return The number of cells of the table. */ - sal_Int32 implGetChildCount() const; - - /** @attention This method requires locked mutex's and a living object. - @return The row index of the specified cell index. */ - sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; - /** @attention This method requires locked mutex's and a living object. - @return The column index of the specified cell index. */ - sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; - /** @attention This method requires locked mutex's and a living object. - @return The child index of the specified cell address. */ - sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; - - /** @attention This method requires locked mutex's and a living object. - @return , if the specified row is selected. */ - sal_Bool implIsRowSelected( sal_Int32 nRow ) const; - /** @attention This method requires locked mutex's and a living object. - @return , if the specified column is selected. */ - sal_Bool implIsColumnSelected( sal_Int32 nColumn ) const; - - /** Selects/deselects a row (tries to expand selection). - @attention This method requires locked mutex's and a living object. - @param bSelect = select, = deselect */ - void implSelectRow( sal_Int32 nRow, sal_Bool bSelect ); - /** Selects/deselects a column (tries to expand selection). - @attention This method requires locked mutex's and a living object. - @param bSelect = select, = deselect */ - void implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect ); - - /** @attention This method requires locked mutex's and a living object. - @return The count of selected rows. */ - sal_Int32 implGetSelectedRowCount() const; - /** @attention This method requires locked mutex's and a living object. - @return The count of selected columns. */ - sal_Int32 implGetSelectedColumnCount() const; - - /** Fills a sequence with sorted indexes of completely selected rows. - @attention This method requires locked mutex's and a living object. - @param rSeq Out-parameter that takes the sorted row index list. */ - void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); - /** Fills a sequence with sorted indexes of completely selected columns. - @attention This method requires locked mutex's and a living object. - @param rSeq Out-parameter that takes the sorted column index list. */ - void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); - - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified row index is invalid. */ - void ensureIsValidRow( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified column index is invalid. */ - void ensureIsValidColumn( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified cell address is invalid. */ - void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified child index is invalid. */ - void ensureIsValidIndex( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx deleted file mode 100644 index cc2f2d6cc..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX - -#include "accessibility/extended/accessiblebrowseboxcell.hxx" -#include -#include - -namespace accessibility -{ - typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText - , ::com::sun::star::accessibility::XAccessible - > AccessibleTextHelper_BASE; - - // implementation of a table cell of BrowseBox - class AccessibleBrowseBoxTableCell :public AccessibleBrowseBoxCell - ,public AccessibleTextHelper_BASE - ,public ::comphelper::OCommonAccessibleText - { - private: - sal_Int32 m_nOffset; - - protected: - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - public: - AccessibleBrowseBoxTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowId, - sal_uInt16 _nColId, - sal_Int32 _nOffset ); - - void nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName ); - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - - // XEventListener - using AccessibleBrowseBoxBase::disposing; - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) - throw(::com::sun::star::uno::RuntimeException); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The count of visible children. - */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The XAccessible interface of the specified child. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; -} -#endif // ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx deleted file mode 100644 index df113fa7a..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX - -#include -#include -#include -#include - - -#include - -using namespace ::svt::table; - -// ============================================================================ - -namespace accessibility { - - class AccessibleGridControl_Impl; - -// ============================================================================ - -/** This class represents the complete accessible Grid Control object. */ -class AccessibleGridControl : public AccessibleGridControlBase -{ - friend class AccessibleGridControlAccess; - -protected: - AccessibleGridControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, - ::svt::table::IAccessibleTable& _rTable - ); - - virtual ~AccessibleGridControl(); - - /** Cleans up members. */ - using AccessibleGridControlBase::disposing; - virtual void SAL_CALL disposing(); - -protected: - // XAccessibleContext ----------------------------------------------------- - - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The role of this object (a table). */ - virtual sal_Int16 SAL_CALL getAccessibleRole() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return - The accessible child rendered under the given point. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to the Grid Control. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - -public: - // helper functions - /** returns the accessible object for the row or the column header bar - */ - inline ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType ) - { - return implGetHeaderBar(_eObjType); - } - - /** returns the accessible object for the table representation - */ - inline ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - getTable( ) - { - return implGetTable(); - } - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - // internal helper methods ------------------------------------------------ - - /** This method creates (once) and returns the accessible data table child. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the data table. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > implGetTable(); - - /** This method creates (once) and returns the specified header bar. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the header bar. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType ); - - /** This method returns one of the children that are always present: - Data table, row and column header bar or corner control. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the specified child. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetFixedChild( sal_Int32 nChildIndex ); - - /** This method creates and returns an accessible table. - @return An AccessibleGridControlTable. */ - virtual AccessibleGridControlTable* createAccessibleTable(); - -private: - // members ---------------------------------------------------------------- - ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl; -}; - -// ============================================================================ -/** the XAccessible which creates/returns an AccessibleGridControl - -

The instance holds it's XAccessibleContext with a hard reference, while - the contxt holds this instance weak.

-*/ -typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base; - -class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base - ,public ::svt::table::IAccessibleTableControl -{ -private: - ::osl::Mutex m_aMutex; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - m_xParent; - ::svt::table::IAccessibleTable& m_rTable; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - m_xContext; - AccessibleGridControl* m_pContext; - // note that this pointer is valid as long as m_xContext is valid! - -public: - AccessibleGridControlAccess( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::table::IAccessibleTable& _rTable - ); - - /// checks whether the accessible context is still alive - bool isContextAlive() const; - - /// returns the AccessibleContext belonging to this Accessible - inline AccessibleGridControl* getContext() { return m_pContext; } - inline const AccessibleGridControl* getContext() const { return m_pContext; } - -protected: - virtual ~AccessibleGridControlAccess(); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); - - // IAccessibleTable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getMyself() - { - return this; - } - void dispose(); - virtual sal_Bool isAlive() const - { - return isContextAlive(); - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; - AccessibleGridControl* pContext( getContext() ); - if ( pContext ) - xAccessible = pContext->getHeaderBar( _eObjType ); - return xAccessible; - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getTable() - { - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; - AccessibleGridControl* pContext( getContext() ); - if ( pContext ) - xAccessible = pContext->getTable(); - return xAccessible; - } - virtual void commitEvent( sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) - { - AccessibleGridControl* pContext( getContext() ); - if ( pContext ) - pContext->commitEvent( nEventId, rNewValue, rOldValue ); - } - -private: - AccessibleGridControlAccess(); // never implemented - AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented - AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented -}; - -// ============================================================================ -} // namespace accessibility - -// ============================================================================ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx deleted file mode 100644 index 8cb276413..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ============================================================================ - -class Window; - -namespace utl { - class AccessibleStateSetHelper; -} - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -// ============================================================================ - -typedef ::cppu::WeakAggComponentImplHelper4< - ::com::sun::star::accessibility::XAccessibleContext, - ::com::sun::star::accessibility::XAccessibleComponent, - ::com::sun::star::accessibility::XAccessibleEventBroadcaster, - ::com::sun::star::lang::XServiceInfo > - AccessibleGridControlImplHelper; - -/** The GridControl accessible objects inherit from this base class. It - implements basic functionality for various Accessibility interfaces and - the event broadcaster and contains the ::osl::Mutex. */ -class AccessibleGridControlBase : - public ::comphelper::OBaseMutex, - public AccessibleGridControlImplHelper -{ -public: - /** Constructor sets specified name and description. - @param rxParent XAccessible interface of the parent object. - @param rTable The Table control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. */ - AccessibleGridControlBase( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType ); - -protected: - virtual ~AccessibleGridControlBase(); - - /** Commits DeFunc event to listeners and cleans up members. */ - virtual void SAL_CALL disposing(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return A reference to the parent accessible object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The description of this object. - */ - virtual ::rtl::OUString SAL_CALL getAccessibleDescription() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The name of this object. - */ - virtual ::rtl::OUString SAL_CALL getAccessibleName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The relation set (the GridControl does not have one). - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL - getAccessibleRelationSet() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The set of current states. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL - getAccessibleStateSet() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The parent's locale. */ - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() - throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, - ::com::sun::star::uno::RuntimeException ); - - /** @return - The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. - */ - virtual sal_Int16 SAL_CALL getAccessibleRole() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleChildCount, - - getAccessibleChild, - - getAccessibleRole. - Derived classes may overwrite getAccessibleIndexInParent to increase - performance. */ - - // XAccessibleComponent --------------------------------------------------- - - /** @return - , if the point lies within the bounding box of this object. */ - virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The bounding box of this object. */ - virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The upper left corner of the bounding box relative to the parent. */ - virtual ::com::sun::star::awt::Point SAL_CALL getLocation() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The upper left corner of the bounding box in screen coordinates. */ - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The size of the bounding box. */ - virtual ::com::sun::star::awt::Size SAL_CALL getSize() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object is showing. */ - virtual sal_Bool SAL_CALL isShowing() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object is visible. */ - virtual sal_Bool SAL_CALL isVisible() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the object can accept the focus. */ - virtual sal_Bool SAL_CALL isFocusTraversable() - throw ( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - - /* Derived classes have to implement: - - getAccessibleAt, - - grabFocus, - - getAccessibleKeyBinding. */ - - /** @return - No key bindings supported by default. - */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - /** @return - The accessible child rendered under the given point. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleEventBroadcaster -------------------------------------------- - - /** Adds a new event listener */ - using cppu::WeakAggComponentImplHelperBase::addEventListener; - virtual void SAL_CALL addEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Removes an event listener. */ - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL removeEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) - throw ( ::com::sun::star::uno::RuntimeException ); - - // XTypeProvider ---------------------------------------------------------- - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return Whether the specified service is supported by this class. */ - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return A list of all supported services. */ - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getImplementationName. */ - - // helper methods --------------------------------------------------------- - - /** @return The GridControl object type. */ - inline ::svt::table::AccessibleTableControlObjType getType() const; - - /** Commits an event to all listeners. */ - void commitEvent( - sal_Int16 nEventId, - const ::com::sun::star::uno::Any& rNewValue, - - const ::com::sun::star::uno::Any& rOldValue ); - /** @return , if the object is not disposed or disposing. */ - sal_Bool isAlive() const; - -protected: - // internal virtual methods ----------------------------------------------- - - /** Determines whether the Grid control is really showing inside of - its parent accessible window. Derived classes may implement different - behaviour. - @attention This method requires locked mutex's and a living object. - @return , if the object is really showing. */ - virtual sal_Bool implIsShowing(); - - /** Derived classes return the bounding box relative to the parent window. - @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox() = 0; - ///** Derived classes return the bounding box in screen coordinates. - // @attention This method requires locked mutex's and a living object. - // @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen() = 0; - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. This method calls FillStateSet at the GridControl which - fills it with more states depending on the object type. Derived classes - may overwrite this method and add more states. - @attention This method requires locked mutex's. - @return A filled AccessibleStateSetHelper. */ - virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - // internal helper methods ------------------------------------------------ - - /** @throws DisposedException If the object is not alive. */ - void ensureIsAlive() const - throw ( ::com::sun::star::lang::DisposedException ); - - /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ - inline ::osl::Mutex& getOslMutex(); - /** @return Pointer to the global ::osl::Mutex. */ - static inline ::osl::Mutex* getOslGlobalMutex(); - - /** Changes the name of the object (flat assignment, no notify). - @attention This method requires a locked mutex. */ - inline void implSetName( const ::rtl::OUString& rName ); - /** Changes the description of the object (flat assignment, no notify). - @attention This method requires a locked mutex. */ - inline void implSetDescription( const ::rtl::OUString& rDescription ); - - /** Locks all mutex's and calculates the bounding box relative to the - parent window. - @return The bounding box (VCL rect.) relative to the parent object. */ - Rectangle getBoundingBox() - throw ( ::com::sun::star::lang::DisposedException ); - ///** Locks all mutex's and calculates the bounding box in screen - // coordinates. - // @return The bounding box (VCL rect.) in screen coordinates. */ - Rectangle getBoundingBoxOnScreen() - throw ( ::com::sun::star::lang::DisposedException ); - - ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } - void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } - -public: - // public versions of internal helper methods, with access control - struct TC_AccessControl { friend class TC_SolarMethodGuard; private: TC_AccessControl() { } }; - - inline ::osl::Mutex& getMutex( const TC_AccessControl& ) { return getOslMutex(); } - inline void ensureIsAlive( const TC_AccessControl& ) { ensureIsAlive(); } - -protected: - // members ---------------------------------------------------------------- - - /** The parent accessible object. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > m_xParent; - /** The SVT Table control. */ - ::svt::table::IAccessibleTable& m_aTable; - /** The type of this object (for names, descriptions, state sets, ...). */ - ::svt::table::AccessibleTableControlObjType m_eObjType; - -private: - /** Localized name. */ - ::rtl::OUString m_aName; - /** Localized description text. */ - ::rtl::OUString m_aDescription; - ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; -}; - -// ============================================================================ -// a version of AccessibleGridControlBase which implements not only the XAccessibleContext, -// but also the XAccessible - -typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible - > GridControlAccessibleElement_Base; - -class GridControlAccessibleElement - :public AccessibleGridControlBase - ,public GridControlAccessibleElement_Base -{ -protected: - /** Constructor sets specified name and description. - - @param rxParent XAccessible interface of the parent object. - @param rTable The Table control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. - */ - GridControlAccessibleElement( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType ); - -public: - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - -protected: - virtual ~GridControlAccessibleElement(); - -protected: - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() - throw ( ::com::sun::star::uno::RuntimeException ); - -private: - GridControlAccessibleElement(); // never implemented - GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented - GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented -}; - -// ============================================================================ -// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex - -typedef ::osl::MutexGuard OslMutexGuard; - -class TC_SolarMethodGuard : public SolarMutexGuard, public OslMutexGuard -{ -public: - inline TC_SolarMethodGuard( AccessibleGridControlBase& _rOwner, bool _bEnsureAlive = true ) - : SolarMutexGuard(), - OslMutexGuard( _rOwner.getMutex( AccessibleGridControlBase::TC_AccessControl() ) ) - { - if ( _bEnsureAlive ) - _rOwner.ensureIsAlive( AccessibleGridControlBase::TC_AccessControl() ); - } -}; - -// inlines -------------------------------------------------------------------- - -inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::getType() const -{ - return m_eObjType; -} - -inline ::osl::Mutex& AccessibleGridControlBase::getOslMutex() -{ - return m_aMutex; -} - -inline ::osl::Mutex* AccessibleGridControlBase::getOslGlobalMutex() -{ - return ::osl::Mutex::getGlobalMutex(); -} - -inline void AccessibleGridControlBase::implSetName( - const ::rtl::OUString& rName ) -{ - m_aName = rName; -} - -inline void AccessibleGridControlBase::implSetDescription( - const ::rtl::OUString& rDescription ) -{ - m_aDescription = rDescription; -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLBASE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx deleted file mode 100644 index 21cd9d8bc..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX - - -#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" -#include "accessibility/extended/AccessibleGridControlTableBase.hxx" - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -/** This class represents the accessible object of a header bar of a Grid Control - (row or column header bar). This object supports the - XAccessibleSelection interface. Selecting a child of this object selects - complete rows or columns of the data table. */ -class AccessibleGridControlHeader : public AccessibleGridControlTableBase -{ -public: - /** @param eObjType One of the two allowed types TCTYPE_ROWHEADERBAR or - TCTYPE_COLUMNHEADERBAR. */ - AccessibleGridControlHeader( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType ); - -protected: - virtual ~AccessibleGridControlHeader(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return - The XAccessible interface of the specified child. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return The accessible child rendered under the given point. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to (the current cell of) the data table. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleTable ------------------------------------------------------- - - /** @return The description text of the specified row. */ - virtual ::rtl::OUString SAL_CALL - getAccessibleRowDescription( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The description text of the specified column. */ - virtual ::rtl::OUString SAL_CALL - getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the row header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleRowHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the column header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleColumnHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected rows. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleRows() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected columns. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleColumns() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified row is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified column is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the cell object at the specified - cell position. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified cell is selected. */ - virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XServiceInfo ----------------------------------------------------------- - - /** @return The name of this class. */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - -protected: - // internal virtual methods ----------------------------------------------- - /** @attention This method requires locked mutex's and a living object. - @return The absolute child index from the index of selected children. - @throws IndexOutOfBoundsException - If the specified index is invalid. */ - //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex ) - // throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - - /** Returns the specified row or column. Uses one of the parameters, - depending on object type. - @attention This method requires locked mutex's and a living object. - @return The XAccessible interface of the specified column/row. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > - implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos ); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - /** @attention This method requires locked mutex's and a living object. - @return The count of used rows. */ - virtual sal_Int32 implGetRowCount() const; - /** @attention This method requires locked mutex's and a living object. - @return The count of used columns. */ - virtual sal_Int32 implGetColumnCount() const; - - // internal helper methods ------------------------------------------------ - - /** @return , if the objects is a header bar for rows. */ - inline sal_Bool isRowBar() const; - /** @return , if the objects is a header bar for columns. */ - inline sal_Bool isColumnBar() const; -}; - -// inlines -------------------------------------------------------------------- - -inline sal_Bool AccessibleGridControlHeader::isRowBar() const -{ - return getType() == ::svt::table::TCTYPE_ROWHEADERBAR; -} - -inline sal_Bool AccessibleGridControlHeader::isColumnBar() const -{ - return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR; -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx deleted file mode 100644 index e8b495205..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX - -#include "accessibility/extended/AccessibleGridControlTableCell.hxx" - -namespace accessibility -{ - class AccessibleGridControlHeaderCell : public AccessibleGridControlCell, public ::com::sun::star::accessibility::XAccessible - { - sal_Int32 m_nColumnRowId; - public: - AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& _rTable, - ::svt::table::AccessibleTableControlObjType _eObjType); - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to the GridControl. */ - virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() - throw ( ::com::sun::star::uno::RuntimeException ); - //------------------------------------------------------------------------- - inline sal_Bool isRowBarCell() const - { - return getType() == ::svt::table::TCTYPE_ROWHEADERCELL; - } - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - protected: - virtual Rectangle implGetBoundingBox(); - - virtual Rectangle implGetBoundingBoxOnScreen(); - private: - ::rtl::OUString m_sHeaderName; - }; -} - -#endif // ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx deleted file mode 100644 index 63ac7545e..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX - -#include "accessibility/extended/AccessibleGridControlTableBase.hxx" -#include -#include - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessibleSelection > - AccessibleGridControlTableImplHelper1; -/** This class represents the accessible object of the data table of a - Grid control. */ -class AccessibleGridControlTable : public AccessibleGridControlTableBase, - public AccessibleGridControlTableImplHelper1 -{ -public: - AccessibleGridControlTable( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType _eType); - -protected: - virtual ~AccessibleGridControlTable(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleComponent --------------------------------------------------- - - /** @return The accessible child rendered under the given point. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Grabs the focus to (the current cell of) the data table. */ - virtual void SAL_CALL grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The key bindings associated with this object. */ - virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleTable ------------------------------------------------------- - - /** @return The description text of the specified row. */ - virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The description text of the specified column. */ - virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the row header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleRowHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessibleTable interface of the column header bar. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL - getAccessibleColumnHeaders() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected rows. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleRows() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An index list of completely selected columns. */ - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL - getSelectedAccessibleColumns() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified row is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified column is completely selected. */ - virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the cell object at the specified - cell position. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified cell is selected. */ - virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XAccessibleSelection --------------------------------------------------- - - /** Selects the specified child (row or column of the table). */ - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return , if the specified child (row/column) is selected. */ - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Clears the complete selection. */ - virtual void SAL_CALL clearAccessibleSelection() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Selects all children or first, if multiselection is not supported. */ - virtual void SAL_CALL selectAllAccessibleChildren() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The number of selected rows/columns. */ - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The specified selected row/column. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Removes the specified row/column from the selection. */ - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - // XServiceInfo ----------------------------------------------------------- - - /** @return The name of this class. */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - -protected: - // internal virtual methods ----------------------------------------------- - - /** @attention This method requires locked mutex's and a living object. - @return The bounding box (VCL rect.) relative to the parent window. */ - virtual Rectangle implGetBoundingBox(); - ///** @attention This method requires locked mutex's and a living object. - // @return The bounding box (VCL rect.) in screen coordinates. */ - virtual Rectangle implGetBoundingBoxOnScreen(); - - - //// internal helper methods ------------------------------------------------ - ///** @attention This method requires a locked mutex. - // @return The XAccessibleTable interface of the specified header bar. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleTable > - implGetHeaderBar( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::uno::RuntimeException ); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx deleted file mode 100644 index 92bd1e2e8..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX - -#include "accessibility/extended/AccessibleGridControlBase.hxx" -#include -#include - -// ============================================================================ - -namespace accessibility { - -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessibleTable > - AccessibleGridControlTableImplHelper; - -/** The Grid Control accessible table objects inherit from this base class. It - implements basic functionality for the XAccessibleTable interface. - Grid COntrol table objects are: the data table, the column header bar and the - row header bar. */ -class AccessibleGridControlTableBase : - public GridControlAccessibleElement, - public AccessibleGridControlTableImplHelper -{ -public: - /** Constructor sets specified name and description. - @param rxParent XAccessible interface of the parent object. - @param rTable The Table control. - @param eNameText The constant for the name text. - @param eDescrText The constant for the description text. */ - AccessibleGridControlTableBase( - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType ); - -protected: - virtual ~AccessibleGridControlTableBase(); - -public: - // XAccessibleContext ----------------------------------------------------- - - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The role of this object (a table). */ - virtual sal_Int16 SAL_CALL getAccessibleRole() - throw ( ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleChild, - - getAccessibleIndexInParent. */ - - // XAccessibleComponent --------------------------------------------------- - - /* Derived classes have to implement: - - getAccessibleAt, - - grabFocus, - - getAccessibleKeyBinding. */ - - // XAccessibleTable ------------------------------------------------------- - - /** @return The number of used rows in the table (0 = empty table). */ - virtual sal_Int32 SAL_CALL getAccessibleRowCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The number of used columns in the table (0 = empty table). */ - virtual sal_Int32 SAL_CALL getAccessibleColumnCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The row extent of the specified cell (always 1). */ - virtual sal_Int32 SAL_CALL - getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The column extent of the specified cell (always 1). */ - virtual sal_Int32 SAL_CALL - getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The caption cell of the table (not supported). */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleCaption() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The summary object of the table (not supported). */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleSummary() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The child index of the specified cell. */ - virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The row index of the specified child cell. */ - virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** @return The column index of the specified child cell. */ - virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /* Derived classes have to implement: - - getAccessibleRowDescription, - - getAccessibleColumnDescription, - - getAccessibleRowHeaders, - - getAccessibleColumnHeaders, - - getSelectedAccessibleRows, - - getSelectedAccessibleColumns, - - isAccessibleRowSelected, - - isAccessibleColumnSelected, - - getAccessibleCellAt, - - isAccessibleSelected. */ - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - - // XTypeProvider ---------------------------------------------------------- - - /** @return A sequence of possible types (received from base classes). */ - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return An unique implementation ID. */ - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() - throw ( ::com::sun::star::uno::RuntimeException ); - -protected: - // internal helper methods ------------------------------------------------ - - /** @attention This method requires locked mutex's and a living object. - @return The number of cells of the table. */ - sal_Int32 implGetChildCount() const; - - /** @attention This method requires locked mutex's and a living object. - @return The row index of the specified cell index. */ - sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; - /** @attention This method requires locked mutex's and a living object. - @return The column index of the specified cell index. */ - sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; - /** @attention This method requires locked mutex's and a living object. - @return The child index of the specified cell address. */ - sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; - - /** Fills a sequence with sorted indexes of completely selected rows. - @attention This method requires locked mutex's and a living object. - @param rSeq Out-parameter that takes the sorted row index list. */ - void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); - /** Fills a sequence with sorted indexes of completely selected columns. - @attention This method requires locked mutex's and a living object. - @param rSeq Out-parameter that takes the sorted column index list. */ - //void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); - - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified row index is invalid. */ - void ensureIsValidRow( sal_Int32 nRow ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified column index is invalid. */ - void ensureIsValidColumn( sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified cell address is invalid. */ - void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** @attention This method requires locked mutex's and a living object. - @throws IndexOutOfBoundsException - If the specified child index is invalid. */ - void ensureIsValidIndex( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLEBASE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx deleted file mode 100644 index d52aaee2e..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX - -#include -#include -#include "accessibility/extended/AccessibleGridControlBase.hxx" -#include - -namespace accessibility -{ - class AccessibleGridControlCell : public AccessibleGridControlBase - { - private: - sal_Int32 m_nRowPos; // the row number of the table cell - sal_Int32 m_nColPos; // the column id of the table cell - - protected: - // attribute access - inline sal_Int32 getRowPos( ) const { return m_nRowPos; } - inline sal_Int32 getColumnPos( ) const { return m_nColPos; } - - // XAccessibleComponent - virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); - - protected: - AccessibleGridControlCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::table::IAccessibleTable& _rTable, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - ::svt::table::AccessibleTableControlObjType _eType - ); - - virtual ~AccessibleGridControlCell(); - - private: - AccessibleGridControlCell(); // never implemented - AccessibleGridControlCell( const AccessibleGridControlCell& ); // never implemented - AccessibleGridControlCell& operator=( const AccessibleGridControlCell& ); // never implemented - }; - - typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText - , ::com::sun::star::accessibility::XAccessible - > AccessibleTextHelper_BASE; - // implementation of a table cell of GridControl - class AccessibleGridControlTableCell :public AccessibleGridControlCell - ,public AccessibleTextHelper_BASE - ,public ::comphelper::OCommonAccessibleText - { - private: - sal_Int32 m_nOffset; - - protected: - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - virtual Rectangle implGetBoundingBox(); - virtual Rectangle implGetBoundingBoxOnScreen(); - - public: - AccessibleGridControlTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::table::IAccessibleTable& _rTable, - sal_Int32 _nRowId, - sal_uInt16 _nColId, - svt::table::AccessibleTableControlObjType eObjType); - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ); - - /** Aquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() throw (); - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() throw (); - - /** @return The index of this object among the parent's children. */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The name of this class. - */ - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The count of visible children. - */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return - The XAccessible interface of the specified child. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); - - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() - throw ( ::com::sun::star::uno::RuntimeException ); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; -} -#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx deleted file mode 100644 index 30eef85cf..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACC_ACCESSIBLETOOLPANELDECK_HXX -#define ACC_ACCESSIBLETOOLPANELDECK_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -#include - -namespace svt -{ - class ToolPanelDeck; -} - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - //================================================================================================================== - //= AccessibleToolPanelDeck - //================================================================================================================== - class AccessibleToolPanelDeck_Impl; - typedef VCLXAccessibleComponent AccessibleToolPanelDeck_Base; - class AccessibleToolPanelDeck : public AccessibleToolPanelDeck_Base - { - public: - AccessibleToolPanelDeck( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ); - - using AccessibleToolPanelDeck_Base::NotifyAccessibleEvent; - - protected: - virtual ~AccessibleToolPanelDeck(); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - // VCLXAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); - virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); - - private: - ::boost::scoped_ptr< AccessibleToolPanelDeck_Impl > m_pImpl; - }; - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -#endif // ACC_ACCESSIBLETOOLPANELDECK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx deleted file mode 100644 index 1bdb6c854..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACC_ACCESSIBLETOOLPANELTABBAR_HXX -#define ACC_ACCESSIBLETOOLPANELTABBAR_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -#include - -namespace svt -{ - class IToolPanelDeck; - class PanelTabBar; -} - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - //================================================================================================================== - //= AccessibleToolPanelTabBar - //================================================================================================================== - class AccessibleToolPanelTabBar_Impl; - typedef VCLXAccessibleComponent AccessibleToolPanelTabBar_Base; - class AccessibleToolPanelTabBar : public AccessibleToolPanelTabBar_Base - { - public: - AccessibleToolPanelTabBar( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ); - - using AccessibleToolPanelTabBar_Base::NotifyAccessibleEvent; - - protected: - virtual ~AccessibleToolPanelTabBar(); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - // VCLXAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); - virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); - - private: - ::boost::scoped_ptr< AccessibleToolPanelTabBar_Impl > m_pImpl; - }; - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -#endif // ACC_ACCESSIBLETOOLPANELTABBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx deleted file mode 100644 index eb375eb8a..000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX -#define ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -#include - -namespace svt -{ - class IToolPanelDeck; - class PanelTabBar; -} - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - //================================================================================================================== - //= AccessibleToolPanelDeckTabBarItem - //================================================================================================================== - class AccessibleToolPanelDeckTabBarItem_Impl; - typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleToolPanelDeckTabBarItem_Base; - class AccessibleToolPanelDeckTabBarItem : public AccessibleToolPanelDeckTabBarItem_Base - { - public: - AccessibleToolPanelDeckTabBarItem( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos - ); - - using AccessibleToolPanelDeckTabBarItem_Base::NotifyAccessibleEvent; - using AccessibleToolPanelDeckTabBarItem_Base::lateInit; - - protected: - virtual ~AccessibleToolPanelDeckTabBarItem(); - - public: - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - protected: - ::boost::scoped_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_pImpl; - }; - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -#endif // ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx deleted file mode 100644 index 6c7bd7da5..000000000 --- a/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX -#define ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX - -#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" -#include - -// ................................................................................. -namespace accessibility -{ -// ................................................................................. - - // ============================================================================= - // = AccessibleBrowseBoxCell - // ============================================================================= - /** common accessibility-functionality for browse box elements which occupy a cell - */ - class AccessibleBrowseBoxCell : public AccessibleBrowseBoxBase - { - private: - sal_Int32 m_nRowPos; // the row number of the table cell - sal_uInt16 m_nColPos; // the column id of the table cell - - protected: - // attribute access - inline sal_Int32 getRowPos( ) const { return m_nRowPos; } - inline sal_Int32 getColumnPos( ) const { return m_nColPos; } - - protected: - // AccessibleBrowseBoxBase overridables - virtual Rectangle implGetBoundingBox(); - virtual Rectangle implGetBoundingBoxOnScreen(); - - // XAccessibleComponent - virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); - - protected: - AccessibleBrowseBoxCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - ::svt::IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - ::svt::AccessibleBrowseBoxObjType _eType = ::svt::BBTYPE_TABLECELL - ); - - virtual ~AccessibleBrowseBoxCell(); - - private: - AccessibleBrowseBoxCell(); // never implemented - AccessibleBrowseBoxCell( const AccessibleBrowseBoxCell& ); // never implemented - AccessibleBrowseBoxCell& operator=( const AccessibleBrowseBoxCell& ); // never implemented - }; - -// ................................................................................. -} // namespace accessibility -// ................................................................................. - - -#endif // ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx deleted file mode 100644 index c30c4f768..000000000 --- a/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX -#define ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX - -#include "accessiblebrowseboxcell.hxx" -#include -#include -#include -#include -#include -#include -#include -#include - -namespace accessibility -{ - // ============================================================================= - // = EditBrowseBoxTableCell - // ============================================================================= - class EditBrowseBoxTableCell :public AccessibleBrowseBoxCell - ,public ::comphelper::OAccessibleContextWrapperHelper - { - public: - EditBrowseBoxTableCell( - const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible, - const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _xControlChild, - ::svt::IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ); - - protected: - virtual ~EditBrowseBoxTableCell(); - - protected: - // XAccessibleComponent - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException) ; - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException) ; - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); - - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XAccessibleContext - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - - sal_Int16 SAL_CALL getAccessibleRole() throw ( ::com::sun::star::uno::RuntimeException ); - - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); - protected: - // OComponentHelper - virtual void SAL_CALL disposing(); - - // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated) - virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); - - // OAccessibleContextWrapperHelper(); - void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException); - - private: - EditBrowseBoxTableCell(); // never implemented - EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ); // never implemented - EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ); // never implemented - }; - - // ============================================================================= - // = EditBrowseBoxTableCell - // ============================================================================= - typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::accessibility::XAccessible - > EditBrowseBoxTableCellAccess_Base; - // XAccessible providing an EditBrowseBoxTableCell - class EditBrowseBoxTableCellAccess - :public ::comphelper::OBaseMutex - ,public EditBrowseBoxTableCellAccess_Base - { - protected: - ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext > - m_aContext; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - m_xParent; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - m_xControlAccessible; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > - m_xFocusWindow; - ::svt::IAccessibleTableProvider* m_pBrowseBox; - sal_Int32 m_nRowPos; - sal_uInt16 m_nColPos; - - public: - EditBrowseBoxTableCellAccess( - const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent, - const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > _xControlAccessible, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - ::svt::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ); - - protected: - virtual ~EditBrowseBoxTableCellAccess(); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent/OComponentHelper - virtual void SAL_CALL disposing(); - - private: - EditBrowseBoxTableCellAccess(); // never implemented - EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ); // never implemented - EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ); // never implemented - }; -} - -#endif // ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx deleted file mode 100644 index 55758bb80..000000000 --- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ - -#include -#include -#include -#include -#include - -// class AccessibleListBox ----------------------------------------------- - -class SvtIconChoiceCtrl; - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible - , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleIconChoiceCtrl_BASE; - - /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry - */ - class AccessibleIconChoiceCtrl :public AccessibleIconChoiceCtrl_BASE - ,public VCLXAccessibleComponent - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; - - protected: - virtual ~AccessibleIconChoiceCtrl(); - - /** this function is called upon disposing the component */ - virtual void SAL_CALL disposing(); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - SvtIconChoiceCtrl* getCtrl(); - public: - /** OAccessibleBase needs a valid view - @param _rIconCtrl - is the box for which we implement an accessible object - @param _xParent - is our parent accessible object - */ - AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XInterface - DECLARE_XINTERFACE() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); - static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; - -//........................................................................ -}// namespace accessibility -//........................................................................ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx deleted file mode 100644 index 1810c8f12..000000000 --- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -class SvxIconChoiceCtrlEntry; -class SvtIconChoiceCtrl; - -//........................................................................ -namespace accessibility -{ -//........................................................................ - -// class AccessibleIconChoiceCtrlEntry ------------------------------------------ - - typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible - , ::com::sun::star::accessibility::XAccessibleContext - , ::com::sun::star::accessibility::XAccessibleComponent - , ::com::sun::star::accessibility::XAccessibleEventBroadcaster - , ::com::sun::star::accessibility::XAccessibleText - , ::com::sun::star::accessibility::XAccessibleAction - , ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE; - - /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ - class AccessibleIconChoiceCtrlEntry : public ::comphelper::OBaseMutex, - public AccessibleIconChoiceCtrlEntry_BASE, - public ::comphelper::OCommonAccessibleText - { - private: - /** The treelistbox control */ - SvtIconChoiceCtrl* m_pIconCtrl; - sal_Int32 m_nIndex; - - protected: - /// client id in the AccessibleEventNotifier queue - sal_uInt32 m_nClientId; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; - - private: - Rectangle GetBoundingBox_Impl() const; - Rectangle GetBoundingBoxOnScreen_Impl() const; - sal_Bool IsAlive_Impl() const; - sal_Bool IsShowing_Impl() const; - - Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); - Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); - void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); - - protected: - virtual ~AccessibleIconChoiceCtrlEntry(); - /** this function is called upon disposing the component - */ - virtual void SAL_CALL disposing(); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - public: - /** Ctor() - @param _rListBox - the view control - @param _pEntry - the entry - @param _xParent - is our parent accessible object - */ - AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, - sal_uLong _nPos, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); - static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleEventBroadcaster - using cppu::WeakAggComponentImplHelperBase::addEventListener; - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; - -//........................................................................ -}// namespace accessibility -//........................................................................ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx deleted file mode 100644 index c73266375..000000000 --- a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ - -#include -#include -#include -#include -#include - - -// class AccessibleListBox ----------------------------------------------- - -class SvTreeListBox; - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible - , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE; - - /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry - */ - class AccessibleListBox :public AccessibleListBox_BASE - ,public VCLXAccessibleComponent - { - protected: - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; - - protected: - virtual ~AccessibleListBox(); - - // OComponentHelper overridables - /** this function is called upon disposing the component */ - virtual void SAL_CALL disposing(); - - // VCLXAccessibleComponent - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - SvTreeListBox* getListBox() const; - - public: - /** OAccessibleBase needs a valid view - @param _rListBox - is the box for which we implement an accessible object - @param _xParent - is our parent accessible object - */ - AccessibleListBox( SvTreeListBox& _rListBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XInterface - DECLARE_XINTERFACE() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); - static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; - -//........................................................................ -}// namespace accessibility -//........................................................................ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx deleted file mode 100644 index c7de9472b..000000000 --- a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "accessibility/extended/listboxaccessible.hxx" - -// forward --------------------------------------------------------------- - -namespace com { namespace sun { namespace star { namespace awt { - struct Point; - struct Rectangle; - struct Size; - class XFocusListener; -} } } } - -class SvTreeListBox; -class SvLBoxEntry; - -//........................................................................ -namespace accessibility -{ -//........................................................................ - -// class AccessibleListBoxEntry ------------------------------------------ - - typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible - , ::com::sun::star::accessibility::XAccessibleContext - , ::com::sun::star::accessibility::XAccessibleComponent - , ::com::sun::star::accessibility::XAccessibleEventBroadcaster - , ::com::sun::star::accessibility::XAccessibleAction - , ::com::sun::star::accessibility::XAccessibleSelection - , ::com::sun::star::accessibility::XAccessibleText - , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE; - - /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ - class AccessibleListBoxEntry:public ::comphelper::OBaseMutex - ,public AccessibleListBoxEntry_BASE - ,public ::comphelper::OCommonAccessibleText - ,public ListBoxAccessibleBase - { - friend class AccessibleListBox; - - private: - /** The treelistbox control */ - SvTreeListBox* m_pListBox; - ::std::deque< sal_Int32 > m_aEntryPath; - - protected: - /// client id in the AccessibleEventNotifier queue - sal_uInt32 m_nClientId; - - ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > - m_aParent; - - private: - Rectangle GetBoundingBox_Impl() const; - Rectangle GetBoundingBoxOnScreen_Impl() const; - sal_Bool IsAlive_Impl() const; - sal_Bool IsShowing_Impl() const; - - Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); - Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); - void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); - - protected: - virtual ~AccessibleListBoxEntry(); - - /** this function is called upon disposing the component - */ - virtual void SAL_CALL disposing(); - - // ListBoxAccessible/XComponent - virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - public: - /** Ctor() - @param _rListBox - the view control - @param _pEntry - the entry - @param _xParent - is our parent accessible object - */ - AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry, - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& _xParent ); - - protected: - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); - static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleEventBroadcaster - using cppu::WeakAggComponentImplHelperBase::addEventListener; - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const; - }; - -//........................................................................ -}// namespace accessibility -//........................................................................ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbar.hxx b/accessibility/inc/accessibility/extended/accessibletabbar.hxx deleted file mode 100644 index 23c18d90e..000000000 --- a/accessibility/inc/accessibility/extended/accessibletabbar.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ - -#include -#include -#include -#include "accessibility/extended/accessibletabbarbase.hxx" - -#include - -namespace utl { -class AccessibleStateSetHelper; -} - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - // ---------------------------------------------------- - // class AccessibleTabBar - // ---------------------------------------------------- - - typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo > AccessibleTabBar_BASE; - - class AccessibleTabBar : public AccessibleTabBarBase, - public AccessibleTabBar_BASE - { - private: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - - protected: - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - - public: - AccessibleTabBar( TabBar* pTabBar ); - ~AccessibleTabBar(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace accessibility -//......................................................................... - -#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx deleted file mode 100644 index 555dada90..000000000 --- a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX - -#include -#include - -class TabBar; -class VCLExternalSolarLock; -class VclSimpleEvent; -class VclWindowEvent; - -//......................................................................... -namespace accessibility -{ -//......................................................................... - -// ============================================================================ - -typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; - -class AccessibleTabBarBase : public AccessibleExtendedComponentHelper_BASE -{ -public: - explicit AccessibleTabBarBase( TabBar* pTabBar ); - virtual ~AccessibleTabBarBase(); - -protected: - DECL_LINK( WindowEventListener, VclSimpleEvent* ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - - // XComponent - virtual void SAL_CALL disposing(); - -private: - void SetTabBarPointer( TabBar* pTabBar ); - void ClearTabBarPointer(); - -protected: - VCLExternalSolarLock* m_pExternalLock; - TabBar* m_pTabBar; -}; - -// ============================================================================ - -//......................................................................... -} // namespace accessibility -//......................................................................... - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx deleted file mode 100644 index 07f0945ef..000000000 --- a/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ - -#include -#include -#include -#include "accessibility/extended/accessibletabbarbase.hxx" - -#include - -namespace utl { -class AccessibleStateSetHelper; -} - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - // ---------------------------------------------------- - // class AccessibleTabBarPage - // ---------------------------------------------------- - - typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPage_BASE; - - class AccessibleTabBarPage : public AccessibleTabBarBase, - public AccessibleTabBarPage_BASE - { - friend class AccessibleTabBarPageList; - - private: - sal_uInt16 m_nPageId; - sal_Bool m_bEnabled; - sal_Bool m_bShowing; - sal_Bool m_bSelected; - ::rtl::OUString m_sPageText; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; - - protected: - sal_Bool IsEnabled(); - sal_Bool IsShowing(); - sal_Bool IsSelected(); - - void SetEnabled( sal_Bool bEnabled ); - void SetShowing( sal_Bool bShowing ); - void SetSelected( sal_Bool bSelected ); - void SetPageText( const ::rtl::OUString& sPageText ); - - sal_uInt16 GetPageId() const { return m_nPageId; } - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - - public: - AccessibleTabBarPage( TabBar* pTabBar, sal_uInt16 nPageId, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent ); - virtual ~AccessibleTabBarPage(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace accessibility -//......................................................................... - -#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx deleted file mode 100644 index 67b0ec7d0..000000000 --- a/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ -#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ - -#include -#include -#include -#include -#include "accessibility/extended/accessibletabbarbase.hxx" - -#include - -namespace utl { -class AccessibleStateSetHelper; -} - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - // ---------------------------------------------------- - // class AccessibleTabBarPageList - // ---------------------------------------------------- - - typedef ::cppu::ImplHelper3< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleSelection, - ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPageList_BASE; - - class AccessibleTabBarPageList : public AccessibleTabBarBase, - public AccessibleTabBarPageList_BASE - { - private: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - sal_Int32 m_nIndexInParent; - - protected: - void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ); - void UpdateShowing( sal_Bool bShowing ); - void UpdateSelected( sal_Int32 i, sal_Bool bSelected ); - void UpdatePageText( sal_Int32 i ); - - void InsertChild( sal_Int32 i ); - void RemoveChild( sal_Int32 i ); - void MoveChild( sal_Int32 i, sal_Int32 j ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - - public: - AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent ); - virtual ~AccessibleTabBarPageList(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace accessibility -//......................................................................... - -#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx deleted file mode 100644 index 19da7b496..000000000 --- a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX - -#include "AccessibleBrowseBox.hxx" -#include -#include -#include - -class SvHeaderTabListBox; - -// ============================================================================ - -namespace accessibility { - -class AccessibleBrowseBoxTable; - -typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible - > AccessibleTabListBox_Base; - -/** !!! */ -class AccessibleTabListBox - :public AccessibleBrowseBox - ,public AccessibleTabListBox_Base - ,public ::svt::IAccessibleTabListBox -{ -private: - SvHeaderTabListBox* m_pTabListBox; - -public: - /** ctor() - @param rxParent XAccessible interface of the parent object. - @param rBox The HeaderTabListBox control. */ - AccessibleTabListBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - SvHeaderTabListBox& rBox ); - -public: - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XAccessibleContext ----------------------------------------------------- - - /** @return The count of visible children. */ - virtual sal_Int32 SAL_CALL getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ); - - /** @return The XAccessible interface of the specified child. */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int32 nChildIndex ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ); - - // XAccessibleContext - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); - - // IAccessibleTabListBox - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getMyself() - { - return this; - } - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) - { - return AccessibleBrowseBox::getHeaderBar( _eObjType ); - } - -protected: - /** dtor() */ - virtual ~AccessibleTabListBox(); - - /** This method creates and returns an accessible table. - @return An AccessibleBrowseBoxTable. */ - virtual AccessibleBrowseBoxTable* createAccessibleTable(); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx deleted file mode 100644 index 81d2964c7..000000000 --- a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX -#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX - -#include "AccessibleBrowseBoxTable.hxx" -#include -#include -#include - -class SvHeaderTabListBox; - -// ============================================================================ - -namespace accessibility { - -typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > - AccessibleTabListBoxTableImplHelper; - -class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper -{ -private: - SvHeaderTabListBox* m_pTabListBox; - - void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - DECL_LINK( WindowEventListener, VclSimpleEvent* ); - - // helpers ---------------------------------------------------------------- - - /** Throws an exception, if nIndex is not a valid child index. */ - void ensureValidIndex( sal_Int32 _nIndex ) const - SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); - - /** Returns true, if the specified row is selected. */ - sal_Bool implIsRowSelected( sal_Int32 _nRow ) const; - /** Selects the specified row. */ - void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect ); - - /** Returns the count of rows in the table. */ - sal_Int32 implGetRowCount() const; - /** Returns the total column count in the table. */ - sal_Int32 implGetColumnCount() const; - /** Returns the count of selected rows in the table. */ - sal_Int32 implGetSelRowCount() const; - /** Returns the total cell count in the table (including header). */ - inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); } - - /** Returns the row index from cell index. */ - inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); } - /** Returns the column index from cell index. */ - inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); } - /** Returns the absolute row index of the nSelRow-th selected row. */ - sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const; - /** Returns the child index from cell position. */ - inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; } - -public: - /** ctor() - @param rxParent XAccessible interface of the parent object. - @param rBox The HeaderTabListBox control. */ - AccessibleTabListBoxTable( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - SvHeaderTabListBox& rBox ); - -protected: - /** dtor() */ - virtual ~AccessibleTabListBoxTable(); - -public: - // XInterface - DECLARE_XINTERFACE( ) - - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx deleted file mode 100644 index ad8b4eed4..000000000 --- a/accessibility/inc/accessibility/extended/listboxaccessible.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE -#define ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE - -#include -#include - -class SvTreeListBox; -class VclSimpleEvent; -class VclWindowEvent; - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - //==================================================================== - //= ListBoxAccessibleBase - //==================================================================== - /** helper class which couples it's life time to the life time of an - SvTreeListBox - */ - class ListBoxAccessibleBase - { - private: - SvTreeListBox* m_pWindow; - - protected: - inline SvTreeListBox* getListBox() const - { - return const_cast< ListBoxAccessibleBase* >( this )->m_pWindow; - } - - inline bool isAlive() const { return NULL != m_pWindow; } - - public: - ListBoxAccessibleBase( SvTreeListBox& _rWindow ); - - protected: - virtual ~ListBoxAccessibleBase( ); - - // own overridables - /// will be called for any VclWindowEvent events broadcasted by our VCL window - virtual void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); - - /** will be called when our window broadcasts the VCLEVENT_OBJECT_DYING event - -

Usually, you derive your class from both ListBoxAccessibleBase and XComponent, - and call XComponent::dispose here.

- */ - virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ) = 0; - - /// to be called in the dispose method of your derived class - void disposing(); - - private: - DECL_LINK( WindowEventListener, VclSimpleEvent* ); - - private: - ListBoxAccessibleBase( ); // never implemented - ListBoxAccessibleBase( const ListBoxAccessibleBase& ); // never implemented - ListBoxAccessibleBase& operator=( const ListBoxAccessibleBase& ); // never implemented - }; - -//........................................................................ -} // namespace accessibility -//........................................................................ - -#endif // ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx deleted file mode 100644 index 3da4e7325..000000000 --- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx +++ /dev/null @@ -1,714 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if !defined INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX -#define INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -class TextEngine; -class TextView; - -namespace css = ::com::sun::star; - -namespace accessibility -{ - -class Paragraph; -class Document; - -class SfxListenerGuard -{ -public: - inline SfxListenerGuard(::SfxListener & rListener): - m_rListener(rListener), m_pNotifier(0) {} - - inline ~SfxListenerGuard() { endListening(); } - - // Not thread safe: - void startListening(::SfxBroadcaster & rNotifier); - - // Not thread safe: - void endListening(); - -private: - ::SfxListener & m_rListener; - ::SfxBroadcaster * m_pNotifier; -}; - -class WindowListenerGuard -{ -public: - inline WindowListenerGuard(::Link const & rListener): - m_aListener(rListener), m_pNotifier(0) {} - - inline ~WindowListenerGuard() { endListening(); } - - // Not thread safe: - void startListening(::Window & rNotifier); - - // Not thread safe: - void endListening(); - -private: - ::Link m_aListener; - ::Window * m_pNotifier; -}; - -class ParagraphInfo -{ -public: - inline ParagraphInfo(::sal_Int32 nHeight): m_nHeight(nHeight) {} - - inline - ::css::uno::WeakReference< ::css::accessibility::XAccessible > const & - getParagraph() const { return m_xParagraph; } - - inline ::sal_Int32 getHeight() const { return m_nHeight; } - - inline void setParagraph( - ::css::uno::Reference< ::css::accessibility::XAccessible > const & - rParagraph) { m_xParagraph = rParagraph; } - - inline void changeHeight(::sal_Int32 nHeight) { m_nHeight = nHeight; } - -private: - ::css::uno::WeakReference< ::css::accessibility::XAccessible > - m_xParagraph; - ::sal_Int32 m_nHeight; -}; - -typedef ::std::vector< ParagraphInfo > Paragraphs; - -typedef ::cppu::WeakAggComponentImplHelper7< - ::css::accessibility::XAccessible, - ::css::accessibility::XAccessibleContext, - ::css::accessibility::XAccessibleComponent, - ::css::accessibility::XAccessibleEditableText, - ::css::accessibility::XAccessibleMultiLineText, - ::css::accessibility::XAccessibleTextAttributes, - ::css::accessibility::XAccessibleEventBroadcaster > ParagraphBase; - -// The Paragraph's number is the absolute position within the text engine (from -// 0 to N - 1), whereas the Paragraph's index is the position within the text -// view/accessible parent (from 0 to M - 1). Paragraphs outside the currently -// visible range have an index of -1. -class ParagraphImpl: - public ParagraphBase, private ::comphelper::OCommonAccessibleText -{ -public: - ParagraphImpl(::rtl::Reference< Document > const & rDocument, - Paragraphs::size_type nNumber, ::osl::Mutex & rMutex); - - // Not thread-safe. - inline Paragraphs::size_type getNumber() const { return m_nNumber; } - - // Not thread-safe. - void numberChanged(bool bIncremented); - - // Not thread-safe. - void textChanged(); - - // Thread-safe. - void notifyEvent(::sal_Int16 nEventId, ::css::uno::Any const & rOldValue, - ::css::uno::Any const & rNewValue); - -protected: - // OCommonAccessibleText - virtual void implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary, - ::sal_Int32 nIndex ); - virtual void implGetLineBoundary( ::css::i18n::Boundary& rBoundary, - ::sal_Int32 nIndex ); - -private: - virtual ::css::uno::Reference< ::css::accessibility::XAccessibleContext > - SAL_CALL getAccessibleContext() throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL - getAccessibleChild(::sal_Int32 i) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL - getAccessibleParent() throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent() - throw (::css::uno::RuntimeException); - - virtual ::sal_Int16 SAL_CALL getAccessibleRole() - throw (::css::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getAccessibleDescription() - throw (::css::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getAccessibleName() - throw (::css::uno::RuntimeException); - - virtual - ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > - SAL_CALL getAccessibleRelationSet() throw (::css::uno::RuntimeException); - - virtual - ::css::uno::Reference< ::css::accessibility::XAccessibleStateSet > SAL_CALL - getAccessibleStateSet() throw (::css::uno::RuntimeException); - - virtual ::css::lang::Locale SAL_CALL getLocale() - throw (::css::accessibility::IllegalAccessibleComponentStateException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL containsPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL - getAccessibleAtPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException); - - virtual ::css::awt::Rectangle SAL_CALL getBounds() - throw (::css::uno::RuntimeException); - - virtual ::css::awt::Point SAL_CALL getLocation() - throw (::css::uno::RuntimeException); - - virtual ::css::awt::Point SAL_CALL getLocationOnScreen() - throw (::css::uno::RuntimeException); - - virtual ::css::awt::Size SAL_CALL getSize() - throw (::css::uno::RuntimeException); - - virtual void SAL_CALL grabFocus() throw (::css::uno::RuntimeException); - - virtual ::css::uno::Any SAL_CALL getAccessibleKeyBinding() - throw (::css::uno::RuntimeException); - - virtual ::css::util::Color SAL_CALL getForeground() - throw (::css::uno::RuntimeException); - - virtual ::css::util::Color SAL_CALL getBackground() - throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getCaretPosition() - throw (::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL setCaretPosition(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Unicode SAL_CALL getCharacter(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL - getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::css::awt::Rectangle SAL_CALL - getCharacterBounds(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getCharacterCount() - throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL - getIndexAtPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getSelectedText() - throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getSelectionStart() - throw (::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getSelectionEnd() - throw (::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getText() - throw (::css::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL copyText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL cutText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL pasteText(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL deleteText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL insertText(::rtl::OUString const & rText, - ::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL replaceText( - ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, - ::rtl::OUString const & rReplacement) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL setAttributes( - ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, - ::css::uno::Sequence< ::css::beans::PropertyValue > const & - rAttributeSet) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Bool SAL_CALL setText(::rtl::OUString const & rText) - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL - getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL - getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) - throw (::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) - throw (::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) - throw (::com::sun::star::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) - throw (::com::sun::star::uno::RuntimeException); - - using cppu::WeakAggComponentImplHelperBase::addEventListener; - virtual void SAL_CALL addEventListener( - ::css::uno::Reference< - ::css::accessibility::XAccessibleEventListener > const & rListener) - throw (::css::uno::RuntimeException); - - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL removeEventListener( - ::css::uno::Reference< - ::css::accessibility::XAccessibleEventListener > const & rListener) - throw (::css::uno::RuntimeException); - - virtual void SAL_CALL disposing(); - - virtual ::rtl::OUString implGetText(); - - virtual ::css::lang::Locale implGetLocale(); - - virtual void implGetSelection(::sal_Int32 & rStartIndex, - ::sal_Int32 & rEndIndex); - - // Throws ::css::lang::DisposedException: - void checkDisposed(); - - ::rtl::Reference< Document > m_xDocument; - Paragraphs::size_type m_nNumber; - -// ::cppu::OInterfaceContainerHelper m_aListeners; - /// client id in the AccessibleEventNotifier queue - sal_uInt32 m_nClientId; - - ::rtl::OUString m_aParagraphText; -}; - - -typedef ::boost::unordered_map< ::rtl::OUString, - ::css::beans::PropertyValue, - ::rtl::OUStringHash, - ::std::equal_to< ::rtl::OUString > > tPropValMap; - -class Document: public ::VCLXAccessibleComponent, public ::SfxListener -{ -public: - Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine, - ::TextView & rView, bool bCompoundControlChild); - - inline ::css::uno::Reference< ::css::accessibility::XAccessible > - getAccessible() { return m_xAccessible; } - - // Must be called only after init has been called. - ::css::lang::Locale retrieveLocale(); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const *" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::sal_Int32 retrieveParagraphIndex(ParagraphImpl const * pParagraph); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const *" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::sal_Int64 retrieveParagraphState(ParagraphImpl const * pParagraph); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::css::awt::Rectangle - retrieveParagraphBounds(ParagraphImpl const * pParagraph, bool bAbsolute); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::rtl::OUString retrieveParagraphText(ParagraphImpl const * pParagraph); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - void retrieveParagraphSelection(ParagraphImpl const * pParagraph, - ::sal_Int32 * pBegin, ::sal_Int32 * pEnd); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const *" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::sal_Int32 retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - ::css::awt::Rectangle - retrieveCharacterBounds(ParagraphImpl const * pParagraph, - ::sal_Int32 nIndex); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::sal_Int32 retrieveCharacterIndex(ParagraphImpl const * pParagraph, - ::css::awt::Point const & rPoint); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveCharacterAttributes( - ParagraphImpl const * pParagraph, ::sal_Int32 nIndex, - const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveDefaultAttributes( - ParagraphImpl const * pParagraph, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveRunAttributes( - ParagraphImpl const * pParagraph, ::sal_Int32 Index, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - void changeParagraphText(ParagraphImpl * pParagraph, - ::rtl::OUString const & rText); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - void changeParagraphText(ParagraphImpl * pParagraph, ::sal_Int32 nBegin, - ::sal_Int32 nEnd, bool bCut, bool bPaste, - ::rtl::OUString const & rText); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - void copyParagraphText(ParagraphImpl const * pParagraph, - ::sal_Int32 nBegin, ::sal_Int32 nEnd); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - void changeParagraphAttributes( - ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd, - ::css::uno::Sequence< ::css::beans::PropertyValue > const & - rAttributeSet); - - // Must be called only after init has been called. - // To make it possible for this method to be (indirectly) called from - // within Paragraph's constructor (i.e., when the Paragraph's ref count is - // still zero), pass a "ParagraphImpl const &" instead of a - // "::rtl::Reference< ParagraphImpl > const &". - // Throws ::css::lang::IndexOutOfBoundsException. - void changeParagraphSelection(ParagraphImpl * pParagraph, - ::sal_Int32 nBegin, ::sal_Int32 nEnd); - - ::css::i18n::Boundary - retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph, - ::sal_Int32 nIndex, ::sal_Int32 *pLineNo = NULL); - - ::css::i18n::Boundary - retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph, - ::sal_Int32 nIndex ); - - sal_Int32 retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph ); - - ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > - retrieveParagraphRelationSet( ParagraphImpl const * pParagraph ); - -protected: - // window event listener from base class - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - -private: - virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Reference< ::css::accessibility::XAccessible > - SAL_CALL getAccessibleChild(::sal_Int32 i) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException); - - virtual ::sal_Int16 SAL_CALL getAccessibleRole() - throw (::css::uno::RuntimeException); - - virtual ::css::uno::Reference< ::css::accessibility::XAccessible > - SAL_CALL getAccessibleAtPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException); - - // ??? Will be called with both the external (Solar) and internal mutex - // locked: - virtual void SAL_CALL disposing(); - - // ??? Will be called with the external (Solar) mutex locked. - // init will already have been called. - virtual void Notify(::SfxBroadcaster & rBC, ::SfxHint const & rHint); - - // Assuming that this will only be called with the external (Solar) mutex - // locked. - // init will already have been called. - DECL_LINK(WindowEventHandler, VclSimpleEvent *); - - // Must be called with both the external (Solar) and internal mutex - // locked. - void init(); - - // Must be called with both the external (Solar) and internal mutex - // locked, and after init has been called: - ::rtl::Reference< ParagraphImpl > - getParagraph(Paragraphs::iterator const & rIt); - - // Must be called with both the external (Solar) and internal mutex - // locked, and after init has been called. - // Throws ::css::uno::RuntimeException. - ::css::uno::Reference< ::css::accessibility::XAccessible > - getAccessibleChild(Paragraphs::iterator const & rIt); - - // Must be called with both the external (Solar) and internal mutex - // locked, and after init has been called: - void determineVisibleRange(); - - // Must be called with both the external (Solar) and internal mutex - // locked, and after init has been called: - void notifyVisibleRangeChanges( - Paragraphs::iterator const & rOldVisibleBegin, - Paragraphs::iterator const & rOldVisibleEnd, - Paragraphs::iterator const & rInserted); - - // Must be called with both the external (Solar) and internal mutex - // locked, and after init has been called: - void changeParagraphText(::sal_uLong nNumber, ::sal_uInt16 nBegin, ::sal_uInt16 nEnd, - bool bCut, bool bPaste, - ::rtl::OUString const & rText); - - void - handleParagraphNotifications(); - - void handleSelectionChangeNotification(); - - void notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast ); - - void justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd ); - - void disposeParagraphs(); - - static ::css::uno::Any mapFontColor(::Color const & rColor); - - static ::Color mapFontColor(::css::uno::Any const & rColor); - - static ::css::uno::Any mapFontWeight(::FontWeight nWeight); - - static ::FontWeight mapFontWeight(::css::uno::Any const & rWeight); - - void retrieveDefaultAttributesImpl( - ParagraphImpl const * pParagraph, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, - tPropValMap& rDefAttrSeq); - - void retrieveRunAttributesImpl( - ParagraphImpl const * pParagraph, ::sal_Int32 Index, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, - tPropValMap& rRunAttrSeq); - - static ::css::uno::Sequence< ::css::beans::PropertyValue > - convertHashMapToSequence(tPropValMap& rAttrSeq); - - ::css::uno::Reference< ::css::accessibility::XAccessible > m_xAccessible; - ::TextEngine & m_rEngine; - ::TextView & m_rView; - - SfxListenerGuard m_aEngineListener; - WindowListenerGuard m_aViewListener; - - // All the following members have valid values only after calling init: - - ::std::auto_ptr< Paragraphs > m_xParagraphs; - - // m_nViewOffset is from the start of the document (0) to the start of the - // current view, and m_nViewHeight is the height of the view: - ::sal_Int32 m_nViewOffset; - ::sal_Int32 m_nViewHeight; - - // m_aVisibleBegin points to the first Paragraph that is (partially) - // contained in the view, and m_aVisibleEnd points past the last Paragraph - // that is (partially) contained. If no Paragraphs are (partially) in the - // view, both m_aVisibleBegin and m_aVisibleEnd are set to - // m_xParagraphs->end(). These values are only changed by - // determineVisibleRange. - Paragraphs::iterator m_aVisibleBegin; - Paragraphs::iterator m_aVisibleEnd; - - // m_nVisibleBeginOffset is from m_nViewOffset back to the start of the - // Paragraph pointed to by m_aVisibleBegin (and always has a non-negative - // value). If m_aVisibleBegin == m_xParagraphs->end(), - // m_nVisibleBeginOffset is set to 0. These values are only changed by - // determineVisibleRange. - ::sal_Int32 m_nVisibleBeginOffset; - - // If no selection has yet been set, all the following four variables are - // set to -1. m_nSelectionLastPara/Pos is also the cursor position. - ::sal_Int32 m_nSelectionFirstPara; - ::sal_Int32 m_nSelectionFirstPos; - ::sal_Int32 m_nSelectionLastPara; - ::sal_Int32 m_nSelectionLastPos; - - Paragraphs::iterator m_aFocused; - - ::std::queue< ::TextHint > m_aParagraphNotifications; - bool m_bSelectionChangedNotification; - bool m_bCompoundControlChild; -}; - -} - -#endif // INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx deleted file mode 100644 index c61274e7f..000000000 --- a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX -#define ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX - -#include -#include - -namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard { - class XClipboard; -} } } } } - -class Window; -namespace accessibility -{ - class SAL_NO_VTABLE IComboListBoxHelper - { - public: - virtual String GetEntry( sal_uInt16 nPos ) const = 0; - virtual Rectangle GetDropDownPosSizePixel( ) const = 0; - virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; - virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) = 0; - virtual sal_Bool IsActive() const = 0; - virtual sal_Bool IsEntryVisible( sal_uInt16 nPos ) const = 0; - virtual sal_uInt16 GetDisplayLineCount() const = 0; - virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0; - virtual WinBits GetStyle() const = 0; - virtual sal_Bool IsMultiSelectionEnabled() const = 0; - virtual sal_uInt16 GetTopEntry() const = 0; - virtual sal_Bool IsEntryPosSelected( sal_uInt16 nPos ) const = 0; - virtual sal_uInt16 GetEntryCount() const = 0; - virtual void Select() = 0; - virtual void SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect = sal_True ) = 0; - virtual sal_uInt16 GetSelectEntryCount() const = 0; - virtual void SetNoSelection() = 0; - virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const = 0; - virtual sal_Bool IsInDropDown() const = 0; - virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; - virtual long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const = 0; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > - GetClipboard() = 0; - }; -} -#endif // ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/acc_factory.hxx b/accessibility/inc/accessibility/helper/acc_factory.hxx deleted file mode 100644 index b0b0778a0..000000000 --- a/accessibility/inc/accessibility/helper/acc_factory.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_FACTORY_HXX -#define ACCESSIBILITY_HELPER_FACTORY_HXX - -#include -#include - -/** this is the entry point to retrieve a factory for the toolkit-level Accessible/Contexts supplied - by this library - - This function implements the factory function needed in toolkit - (of type GetStandardAccComponentFactory). -*/ -extern "C" void* SAL_CALL getStandardAccessibleFactory(); - -/** this is the entry point to retrieve a factory for the svtools-level Accessible/Contexts supplied - by this library - - This function implements the factory function needed in svtools - (of type GetSvtAccessibilityComponentFactory). -*/ -extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory(); - -#endif // ACCESSIBILITY_HELPER_FACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc deleted file mode 100644 index 8040f3588..000000000 --- a/accessibility/inc/accessibility/helper/accessiblestrings.hrc +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ -#define ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ - - -//------------------------------------------------------------------------------ - -#define RID_TK_ACC_START 1000 - - -// Accessible Action Id's ------------------------------------------------------ - -#define RID_STR_ACC_ACTION_CLICK ( RID_TK_ACC_START + 0 ) -#define RID_STR_ACC_ACTION_TOGGLEPOPUP ( RID_TK_ACC_START + 1 ) -#define RID_STR_ACC_ACTION_SELECT ( RID_TK_ACC_START + 2 ) -#define RID_STR_ACC_ACTION_INCLINE ( RID_TK_ACC_START + 3 ) -#define RID_STR_ACC_ACTION_DECLINE ( RID_TK_ACC_START + 4 ) -#define RID_STR_ACC_ACTION_INCBLOCK ( RID_TK_ACC_START + 5 ) -#define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 ) - - -#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 ) -#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 ) - -// ----------------------------------------------------------------------------- - -#endif // ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ diff --git a/accessibility/inc/accessibility/helper/accresmgr.hxx b/accessibility/inc/accessibility/helper/accresmgr.hxx deleted file mode 100644 index 079ae6c83..000000000 --- a/accessibility/inc/accessibility/helper/accresmgr.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_TKARESMGR_HXX -#define ACCESSIBILITY_HELPER_TKARESMGR_HXX - -#include - -class SimpleResMgr; - -#define TK_RES_STRING(id) TkResMgr::loadString(id) - -// ----------------------------------------------------------------------------- -// TkResMgr -// ----------------------------------------------------------------------------- - -class TkResMgr -{ - static SimpleResMgr* m_pImpl; - -private: - // no instantiation allowed - TkResMgr() { } - ~TkResMgr() { } - - // we'll instantiate one static member of the following class, - // which in it's dtor ensures that m_pImpl will be deleted - class EnsureDelete - { - public: - EnsureDelete() { } - ~EnsureDelete(); - }; - friend class EnsureDelete; - -protected: - static void ensureImplExists(); - -public: - // loads the string with the specified resource id - static ::rtl::OUString loadString( sal_uInt16 nResId ); -}; - - -#endif // ACCESSIBILITY_HELPER_TKARESMGR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx deleted file mode 100644 index 4e5cb90dc..000000000 --- a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX -#define ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX - -#include -#include -#include - -#include - -// ----------------------------------------------------------------------------- -// class CharacterAttributesHelper -// ----------------------------------------------------------------------------- - -class CharacterAttributesHelper -{ -private: - - typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any, ::std::less< ::rtl::OUString > > AttributeMap; - - AttributeMap m_aAttributeMap; - -public: - - CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor ); - ~CharacterAttributesHelper(); - - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes(); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ); -}; - -#endif // ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx deleted file mode 100644 index 7747ba880..000000000 --- a/accessibility/inc/accessibility/helper/listboxhelper.hxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX -#define ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX - -#include -#include -#include -#include - -// ----------------------------------------------------------------------------- -// globals -// ----------------------------------------------------------------------------- - -const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1; - -// ----------------------------------------------------------------------------- -// class VCLListBoxHelper -// ----------------------------------------------------------------------------- - -template< class T > class VCLListBoxHelper : public ::accessibility::IComboListBoxHelper -{ -private: - T& m_aComboListBox; - -public: - inline - VCLListBoxHelper( T& _pListBox ) : - m_aComboListBox( _pListBox ){} - - // ----------------------------------------------------------------------------- - virtual String GetEntry( sal_uInt16 nPos ) const - { - return m_aComboListBox.GetEntry( nPos ); - } - // ----------------------------------------------------------------------------- - virtual Rectangle GetDropDownPosSizePixel() const - { - Rectangle aTemp = m_aComboListBox.GetWindowExtentsRelative(NULL); - Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel(); - aRet.Move(aTemp.TopLeft().X(),aTemp.TopLeft().Y()); - return aRet; - } - // ----------------------------------------------------------------------------- - virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const - { - Rectangle aRect; - if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) ) - { - Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel(); - Size aSize = aTemp.GetSize(); - aSize.Height() /= m_aComboListBox.GetDisplayLineCount(); - Point aTopLeft = aTemp.TopLeft(); - aTopLeft.Y() += aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() ); - aRect = Rectangle( aTopLeft, aSize ); - } - else - aRect = m_aComboListBox.GetBoundingRectangle( nItem ); - return aRect; - } - // ----------------------------------------------------------------------------- - virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) - { - return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow ); - } - // ----------------------------------------------------------------------------- - virtual sal_Bool IsActive() const - { - return m_aComboListBox.IsActive(); - } - // ----------------------------------------------------------------------------- - virtual sal_Bool IsEntryVisible( sal_uInt16 nPos ) const - { - sal_uInt16 nTopEntry = m_aComboListBox.GetTopEntry(); - sal_uInt16 nLines = m_aComboListBox.GetDisplayLineCount(); - return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) ); - } - // ----------------------------------------------------------------------------- - virtual sal_uInt16 GetDisplayLineCount() const - { - return m_aComboListBox.GetDisplayLineCount(); - } - // ----------------------------------------------------------------------------- - virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const - { - m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines); - } - // ----------------------------------------------------------------------------- - virtual WinBits GetStyle() const - { - return m_aComboListBox.GetStyle(); - } - // ----------------------------------------------------------------------------- - virtual sal_Bool IsMultiSelectionEnabled() const - { - return m_aComboListBox.IsMultiSelectionEnabled(); - } - // ----------------------------------------------------------------------------- - virtual sal_uInt16 GetTopEntry() const - { - return m_aComboListBox.GetTopEntry(); - } - // ----------------------------------------------------------------------------- - virtual sal_Bool IsEntryPosSelected( sal_uInt16 nPos ) const - { - return m_aComboListBox.IsEntryPosSelected(nPos); - } - // ----------------------------------------------------------------------------- - virtual sal_uInt16 GetEntryCount() const - { - return m_aComboListBox.GetEntryCount(); - } - // ----------------------------------------------------------------------------- - virtual void Select() - { - m_aComboListBox.Select(); - } - // ----------------------------------------------------------------------------- - virtual void SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect = sal_True ) - { - m_aComboListBox.SelectEntryPos(nPos,bSelect); - } - // ----------------------------------------------------------------------------- - virtual sal_uInt16 GetSelectEntryCount() const - { - return m_aComboListBox.GetSelectEntryCount(); - } - // ----------------------------------------------------------------------------- - virtual void SetNoSelection() - { - m_aComboListBox.SetNoSelection(); - } - // ----------------------------------------------------------------------------- - virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const - { - return m_aComboListBox.GetSelectEntryPos(nSelIndex); - } - // ----------------------------------------------------------------------------- - virtual sal_Bool IsInDropDown() const - { - return m_aComboListBox.IsInDropDown(); - } - // ----------------------------------------------------------------------------- - virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const - { - Rectangle aRect; - - Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos ); - if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() ) - { - long nIndex = aEntryCharacterRange.A() + _nCharacterIndex; - aRect = m_aComboListBox.GetCharacterBounds( nIndex ); - } - return aRect; - } - // ----------------------------------------------------------------------------- - long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const - { - return m_aComboListBox.GetIndexForPoint( rPoint, nPos ); - } - // ----------------------------------------------------------------------------- - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > - GetClipboard() - { - return m_aComboListBox.GetClipboard(); - } - // ----------------------------------------------------------------------------- -}; - -#endif // ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx deleted file mode 100644 index 52ed3e1e4..000000000 --- a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX -#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX - -#include -#include -#include -#include -#include -#include - -#include - -class Menu; -class VclSimpleEvent; -class VclMenuEvent; -class VCLExternalSolarLock; - -namespace utl { -class AccessibleStateSetHelper; -} - -// ---------------------------------------------------- -// class OAccessibleMenuBaseComponent -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo > OAccessibleMenuBaseComponent_BASE; - -class OAccessibleMenuBaseComponent : public AccessibleExtendedComponentHelper_BASE, - public OAccessibleMenuBaseComponent_BASE -{ - friend class OAccessibleMenuItemComponent; - friend class VCLXAccessibleMenuItem; - friend class VCLXAccessibleMenu; - -private: - VCLExternalSolarLock* m_pExternalLock; - -protected: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - Menu* m_pMenu; - - sal_Bool m_bEnabled; - sal_Bool m_bFocused; - sal_Bool m_bVisible; - sal_Bool m_bSelected; - sal_Bool m_bChecked; - - Menu* GetMenu() { return m_pMenu; } - - virtual sal_Bool IsEnabled(); - virtual sal_Bool IsFocused(); - virtual sal_Bool IsVisible(); - virtual sal_Bool IsSelected(); - virtual sal_Bool IsChecked(); - - void SetEnabled( sal_Bool bEnabled ); - void SetFocused( sal_Bool bFocused ); - void SetVisible( sal_Bool bVisible ); - void SetSelected( sal_Bool bSelected ); - void SetChecked( sal_Bool bChecked ); - - void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ); - void UpdateFocused( sal_Int32 i, sal_Bool bFocused ); - void UpdateVisible(); - void UpdateSelected( sal_Int32 i, sal_Bool bSelected ); - void UpdateChecked( sal_Int32 i, sal_Bool bChecked ); - void UpdateAccessibleName( sal_Int32 i ); - void UpdateItemText( sal_Int32 i ); - - sal_Int32 GetChildCount(); - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChild( sal_Int32 i ); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAt( const ::com::sun::star::awt::Point& rPoint ); - - void InsertChild( sal_Int32 i ); - void RemoveChild( sal_Int32 i ); - - virtual sal_Bool IsHighlighted(); - sal_Bool IsChildHighlighted(); - - void SelectChild( sal_Int32 i ); - void DeSelectAll(); - sal_Bool IsChildSelected( sal_Int32 i ); - - virtual void Select(); - virtual void DeSelect(); - virtual void Click(); - virtual sal_Bool IsPopupMenuOpen(); - - DECL_LINK( MenuEventListener, VclSimpleEvent* ); - - virtual void ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent ); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) = 0; - - // XComponent - virtual void SAL_CALL disposing(); - -public: - OAccessibleMenuBaseComponent( Menu* pMenu ); - virtual ~OAccessibleMenuBaseComponent(); - - void SetStates(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx deleted file mode 100644 index 2d292c98f..000000000 --- a/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX -#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX - -#include -#include -#include - - -// ---------------------------------------------------- -// class OAccessibleMenuComponent -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; - -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleMenuComponent_BASE; - -class OAccessibleMenuComponent : public OAccessibleMenuBaseComponent, - public OAccessibleMenuComponent_BASE -{ -protected: - virtual sal_Bool IsEnabled(); - virtual sal_Bool IsVisible(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - -public: - OAccessibleMenuComponent( Menu* pMenu ); - virtual ~OAccessibleMenuComponent(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx deleted file mode 100644 index f35e7ce8c..000000000 --- a/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX -#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX - -#include - - -// ---------------------------------------------------- -// class OAccessibleMenuItemComponent -// ---------------------------------------------------- - -class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent -{ - friend class OAccessibleMenuBaseComponent; - -protected: - Menu* m_pParent; - sal_uInt16 m_nItemPos; - ::rtl::OUString m_sAccessibleName; - ::rtl::OUString m_sItemText; - - virtual sal_Bool IsEnabled(); - virtual sal_Bool IsVisible(); - virtual void Select(); - virtual void DeSelect(); - virtual void Click(); - - void SetItemPos( sal_uInt16 nItemPos ); - void SetAccessibleName( const ::rtl::OUString& sAccessibleName ); - ::rtl::OUString GetAccessibleName(); - void SetItemText( const ::rtl::OUString& sItemText ); - ::rtl::OUString GetItemText(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ); - virtual ~OAccessibleMenuItemComponent(); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx deleted file mode 100644 index f5c8ba01a..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX - -#include -#include -#include -#include -#include - - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleAction - > VCLXAccessibleBox_BASE; - - -/** Base class for list- and combo boxes. This class manages the box' - children. The classed derived from this one have only to implement the - IsValid method and return the corrent implementation name. -*/ -class VCLXAccessibleBox - : public VCLXAccessibleComponent, - public VCLXAccessibleBox_BASE -{ -public: - enum BoxType {COMBOBOX, LISTBOX}; - - /** The constructor is initialized with the box type whitch may be - either COMBOBOX or LISTBOX and a flag - indicating whether the box is a drop down box. - */ - VCLXAccessibleBox (VCLXWindow* pVCLXindow, BoxType aType, bool bIsDropDownBox); - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XInterface - DECLARE_XINTERFACE() - - - - // XAccessible - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - - /** Each object has one or two children: an optional text field and the - actual list. The text field is not provided for non drop down list - boxes. - */ - sal_Int32 SAL_CALL getAccessibleChildCount (void) - throw (::com::sun::star::uno::RuntimeException); - /** For drop down list boxes the text field is a not editable - VCLXAccessibleTextField, for combo boxes it is an - editable VLCAccessibleEdit. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL - getAccessibleChild (sal_Int32 i) - throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - /** The role is always AccessibleRole::COMBO_BOX. - */ - sal_Int16 SAL_CALL getAccessibleRole (void) - throw (::com::sun::star::uno::RuntimeException); - - sal_Int32 SAL_CALL getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - - /** There is one action for drop down boxes and none for others. - */ - virtual sal_Int32 SAL_CALL getAccessibleActionCount (void) - throw (::com::sun::star::uno::RuntimeException); - /** The action for drop down boxes lets the user toggle the visibility of the - popup menu. - */ - virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex) - throw (::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException); - /** The returned string is assoicated with resource - RID_STR_ACC_ACTION_TOGGLEPOPUP. - */ - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex) - throw (::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException); - /** No keybinding returned so far. - */ - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL - getAccessibleActionKeyBinding( sal_Int32 nIndex ) - throw (::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException); - - // XComponent - - /** This method is called from the implementation helper during an - XComponent::dispose() call. - */ - virtual void SAL_CALL disposing (void); - - -protected: - /** Specifies whether the box is a combo box or a list box. List boxes - have multi selection. - */ - BoxType m_aBoxType; - - /// Specifies whether the box is a drop down box and thus has an action. - bool m_bIsDropDownBox; - - /// The child that represents the text field if there is one. - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> - m_xText; - - /// The child that contains the items of this box. - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> - m_xList; - - /** This flag specifies whether an object has a text field as child - regardless of whether that child being currently instantiated or - not. - */ - bool m_bHasTextChild; - - /** This flag specifies whether an object has a list as child regardless - of whether that child being currently instantiated or not. This - flag is always true in the current implementation because the list - child is just another wrapper arround this object and thus has the - same life time. - */ - bool m_bHasListChild; - - virtual ~VCLXAccessibleBox (void); - - /** Returns
when the object is valid. - */ - virtual bool IsValid (void) const = 0; - - virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent); - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); - - -private: - /// Index in parent. This is settable from the outside. - sal_Int32 m_nIndexInParent; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx deleted file mode 100644 index 2702f2a5c..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX - -#include - -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleButton -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleButton_BASE; - -class VCLXAccessibleButton : public VCLXAccessibleTextComponent, - public VCLXAccessibleButton_BASE -{ -protected: - virtual ~VCLXAccessibleButton(); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - -public: - VCLXAccessibleButton( VCLXWindow* pVCLXindow ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx deleted file mode 100644 index da1714196..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX - -#include - -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleCheckBox -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleCheckBox_BASE; - -class VCLXAccessibleCheckBox : public VCLXAccessibleTextComponent, - public VCLXAccessibleCheckBox_BASE -{ -private: - bool m_bChecked; - bool m_bIndeterminate; - -protected: - virtual ~VCLXAccessibleCheckBox(); - - bool IsChecked(); - bool IsIndeterminate(); - - void SetChecked( bool bChecked ); - void SetIndeterminate( bool bIndeterminate ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - -public: - VCLXAccessibleCheckBox( VCLXWindow* pVCLXindow ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx deleted file mode 100644 index 86fd455e0..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX - -#include -#include -#include -#include - - -/** The accessible combobox has two children. The first is the text field - represented by an object of the VCLXAccessibleEdit class. - The second is the list containing all items and is represented by an - object of the VCLXAccessibleList class which does not - support selection at the moment. -*/ -class VCLXAccessibleComboBox - : public VCLXAccessibleBox -{ -public: - VCLXAccessibleComboBox (VCLXWindow* pVCLXindow); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return combo box specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ~VCLXAccessibleComboBox (void); - - virtual bool IsValid (void) const; - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx deleted file mode 100644 index 8779fd4ca..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX - -#include -#include -#include - -#include -#include - - -/** The accessible drop down combobox has two children. The first is the - text field represented by an object of the - VCLXAccessibleEdit class. The second is the list - containing all items and is represented by an object of the - VCLXAccessibleList class which does not support selection - at the moment. -*/ -class VCLXAccessibleDropDownComboBox : public VCLXAccessibleBox -{ -public: - VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLXindow); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return drop down combo box specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ~VCLXAccessibleDropDownComboBox (void); - - virtual bool IsValid (void) const; - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx deleted file mode 100644 index de69facb7..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX - -#include -#include - -#include -#include - - -/** The accessible drop down combobox has two children. The first is the - text field represented by an object of the - VCLXAccessibleTextField class which can not be edited. The - second is the list containing all items and is represented by an object - of the VCLXAccessibleListBoxList class which does support - selection. -*/ -class VCLXAccessibleDropDownListBox : public VCLXAccessibleBox -{ -public: - VCLXAccessibleDropDownListBox (VCLXWindow* pVCLXindow); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return drop down list box specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ~VCLXAccessibleDropDownListBox (void); - - virtual bool IsValid (void) const; - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); - -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx deleted file mode 100644 index 3f4117b6d..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX - -#include -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleEdit -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleEditableText > VCLXAccessibleEdit_BASE; - -class VCLXAccessibleEdit : public VCLXAccessibleTextComponent, - public VCLXAccessibleEdit_BASE -{ - friend class VCLXAccessibleBox; - -private: - sal_Int32 m_nSelectionStart; - sal_Int32 m_nCaretPosition; - -protected: - virtual ~VCLXAccessibleEdit(); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - -public: - VCLXAccessibleEdit( VCLXWindow* pVCLXindow ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleEditableText - virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx deleted file mode 100644 index 9f9c769d3..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX - -#include - -// ---------------------------------------------------- -// class VCLXAccessibleFixedHyperlink -// ---------------------------------------------------- - -class VCLXAccessibleFixedHyperlink : public VCLXAccessibleTextComponent -{ -protected: - virtual ~VCLXAccessibleFixedHyperlink(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); - -public: - VCLXAccessibleFixedHyperlink( VCLXWindow* pVCLXindow ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx deleted file mode 100644 index 285ca562f..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX - -#include - -// ---------------------------------------------------- -// class VCLXAccessibleFixedText -// ---------------------------------------------------- - -class VCLXAccessibleFixedText : public VCLXAccessibleTextComponent -{ -protected: - virtual ~VCLXAccessibleFixedText(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); - -public: - VCLXAccessibleFixedText( VCLXWindow* pVCLXindow ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx deleted file mode 100644 index 78919ff9a..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx +++ /dev/null @@ -1,226 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX - -#include -#include -#include "accessibility/standard/vclxaccessiblelistitem.hxx" -#include -#include -#include -#include -#include -#include - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleSelection - > VCLXAccessibleList_BASE; - -typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > > - ListItems; - -namespace accessibility -{ - class IComboListBoxHelper; -} - - -/** Base class for the list contained in list- and combo boxes. This class - does not support selection because lists of combo boxes give no direct - access to their underlying list implementation. Look into derived - classes for selection. -*/ -class VCLXAccessibleList - : public VCLXAccessibleComponent, - public VCLXAccessibleList_BASE -{ -public: - enum BoxType {COMBOBOX, LISTBOX}; - - VCLXAccessibleList (VCLXWindow* pVCLXindow, BoxType aBoxType, - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& _xParent); - - /** The index that is passed to this method is returned on following - calls to getAccessibleIndexInParent. - */ - void SetIndexInParent (sal_Int32 nIndex); - - /** Process some of the events and delegate the rest to the base classes. - */ - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); - - /** Called on reception of selection events this method checks all known - list items for a possible change in their selection state and - updates that accordingly. No accessibility events are send because - the XAccessibleSelection interface is not supported and the items - are transient. - @param sTextOfSelectedItem - This string contains the text of the the currently selected - item. It is used to retrieve the index of that item. - */ - void UpdateSelection (::rtl::OUString sTextOfSelectedItem); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL - getAccessibleContext (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) - throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL - getAccessibleChild (sal_Int32 i) - throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleParent( ) - throw (::com::sun::star::uno::RuntimeException); - - /** The index returned as index in parent is always the one set with the - SetIndexInParent() method. - */ - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual sal_Bool SAL_CALL contains (const ::com::sun::star::awt::Point& aPoint) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL - getAccessibleAt (const ::com::sun::star::awt::Point& aPoint) - throw (::com::sun::star::uno::RuntimeException); - - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return list specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); - -protected: - BoxType m_aBoxType; - ::accessibility::IComboListBoxHelper* m_pListBoxHelper; - ListItems m_aAccessibleChildren; - sal_Int32 m_nVisibleLineCount; - /// Index in parent. This is settable from the outside. - sal_Int32 m_nIndexInParent; - sal_Int32 m_nLastTopEntry; - sal_uInt16 m_nLastSelectedPos; - bool m_bDisableProcessEvent; - bool m_bVisible; - - - - /// The currently selected item. - ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible> - m_xSelectedItem; - - virtual ~VCLXAccessibleList (void); - - /** This function is called from the implementation helper during a - XComponent::dispose call. Free the list of items and the items themselves. - */ - virtual void SAL_CALL disposing (void); - - /** This method adds the states - AccessibleStateType::FOCUSABLE and possibly - AccessibleStateType::MULTI_SELECTABLE to the state set - of the base classes. - */ - virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet); - - /** Create the specified child and insert it into the list of children. - Sets the child's states. - */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - CreateChild (sal_Int32 i); - - /** Call this method when the item list has been changed, i.e. items - have been deleted or inserted. - @param bItemInserted - Indicate whether items have been inserted () or removed - (). - @param nIndex - Index of the new or removed item. A value of -1 indicates that - the whole list has been cleared. - */ - virtual void HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex); - - // VCLXAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - -private: - /** We need to save the accessible parent to return it in getAccessibleParent(), - because this method of the base class returns the wrong parent. - */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > m_xParent; - - - /** dispose all items aand clears the container - */ - void clearItems(); - - void adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t& _rMemFun); - void UpdateEntryRange_Impl (void); -protected: - void UpdateSelection_Impl (sal_uInt16 nPos = 0); - sal_Bool checkEntrySelected(sal_uInt16 _nPos, - ::com::sun::star::uno::Any& _rNewValue, - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc); -private: - void notifyVisibleStates(sal_Bool _bSetNew ); - void UpdateVisibleLineCount(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx deleted file mode 100644 index 41829c0bb..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX - -#include -#include -#include -#include - - -/** The accessible drop down combobox has one children. It is the list - containing all items and is represented by an object of the - VCLXAccessibleListBoxList class which does support - selection. -*/ -class VCLXAccessibleListBox : public VCLXAccessibleBox -{ -public: - VCLXAccessibleListBox (VCLXWindow* pVCLXindow); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return list box specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ~VCLXAccessibleListBox (void); - - virtual bool IsValid (void) const; - virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx deleted file mode 100644 index 640f00241..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -namespace com { namespace sun { namespace star { namespace awt { - struct Point; - struct Rectangle; - struct Size; - class XFocusListener; -} } } } - -namespace accessibility -{ - class IComboListBoxHelper; -} - -// class VCLXAccessibleListItem ------------------------------------------ - -typedef ::cppu::WeakAggComponentImplHelper6< ::com::sun::star::accessibility::XAccessible - , ::com::sun::star::accessibility::XAccessibleContext - , ::com::sun::star::accessibility::XAccessibleComponent - , ::com::sun::star::accessibility::XAccessibleEventBroadcaster - , ::com::sun::star::accessibility::XAccessibleText - , ::com::sun::star::lang::XServiceInfo > VCLXAccessibleListItem_BASE; - -/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry -*/ -class VCLXAccessibleListItem : public ::comphelper::OBaseMutex, - public ::comphelper::OCommonAccessibleText, - public VCLXAccessibleListItem_BASE -{ -private: - ::rtl::OUString m_sEntryText; - sal_Int32 m_nIndexInParent; - sal_Bool m_bSelected; - sal_Bool m_bVisible; - -protected: - /// client id in the AccessibleEventNotifier queue - sal_uInt32 m_nClientId; - ::accessibility::IComboListBoxHelper* m_pListBoxHelper; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > m_xParentContext; - -private: - /** notifies all listeners that this object has changed - @param _nEventId - is the event id - @param _aOldValue - is the old value - @param _aNewValue - is the new value - */ - void NotifyAccessibleEvent( sal_Int16 _nEventId, - const ::com::sun::star::uno::Any& _aOldValue, - const ::com::sun::star::uno::Any& _aNewValue ); - -protected: - virtual ~VCLXAccessibleListItem(); - /** this function is called upon disposing the component - */ - virtual void SAL_CALL disposing(); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - -public: - /** OAccessibleBase needs a valid view - @param _pListBoxHelper - is the list- or combobox for which we implement an accessible object - @param _nIndexInParent - is the position of the entry inside the listbox - @param _xParent - is our parent accessible object - */ - VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper, - sal_Int32 _nIndexInParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); - - - inline sal_Bool IsSelected() const { return m_bSelected; } - void SetSelected( sal_Bool _bSelected ); - void SetVisible( sal_Bool _bVisible ); - inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;} - inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;} - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire( ) throw(); - virtual void SAL_CALL release( ) throw(); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground (void) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground (void) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleEventBroadcaster - using cppu::WeakAggComponentImplHelperBase::addEventListener; - using cppu::WeakAggComponentImplHelperBase::removeEventListener; - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx deleted file mode 100644 index 0115d5d13..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX - -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleMenu -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper1 < - ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleMenu_BASE; - -class VCLXAccessibleMenu : public VCLXAccessibleMenuItem, - public VCLXAccessibleMenu_BASE -{ -protected: - virtual sal_Bool IsFocused(); - virtual sal_Bool IsPopupMenuOpen(); - -public: - VCLXAccessibleMenu( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ); - virtual ~VCLXAccessibleMenu(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx deleted file mode 100644 index 469fad4e9..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX - -#include - -class VclSimpleEvent; -class VclWindowEvent; -class Window; - - -// ---------------------------------------------------- -// class VCLXAccessibleMenuBar -// ---------------------------------------------------- - -class VCLXAccessibleMenuBar : public OAccessibleMenuComponent -{ -protected: - Window* m_pWindow; - - virtual sal_Bool IsFocused(); - - DECL_LINK( WindowEventListener, VclSimpleEvent* ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleMenuBar( Menu* pMenu ); - virtual ~VCLXAccessibleMenuBar(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx deleted file mode 100644 index f9d3ff12c..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX - -#include - -#include -#include - -#include -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleMenuItem -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper3< - ::com::sun::star::accessibility::XAccessibleText, - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleMenuItem_BASE; - -class VCLXAccessibleMenuItem : public OAccessibleMenuItemComponent, - public ::comphelper::OCommonAccessibleText, - public VCLXAccessibleMenuItem_BASE -{ -protected: - virtual sal_Bool IsFocused(); - virtual sal_Bool IsSelected(); - virtual sal_Bool IsChecked(); - - virtual sal_Bool IsHighlighted(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - -public: - VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 ); - virtual ~VCLXAccessibleMenuItem(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx deleted file mode 100644 index 15fc571d6..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleMenuSeparator -// ---------------------------------------------------- - -class VCLXAccessibleMenuSeparator : public OAccessibleMenuItemComponent -{ -public: - VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 ); - virtual ~VCLXAccessibleMenuSeparator(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); -}; - - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx deleted file mode 100644 index 812bcd831..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX - -#include - - -// ---------------------------------------------------- -// class VCLXAccessiblePopupMenu -// ---------------------------------------------------- - -class VCLXAccessiblePopupMenu : public OAccessibleMenuComponent -{ -protected: - virtual sal_Bool IsFocused(); - -public: - VCLXAccessiblePopupMenu( Menu* pMenu ); - virtual ~VCLXAccessiblePopupMenu(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx deleted file mode 100644 index 1824bd1eb..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX - -#include - -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleRadioButton -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleRadioButton_BASE; - -class VCLXAccessibleRadioButton : public VCLXAccessibleTextComponent, - public VCLXAccessibleRadioButton_BASE -{ -protected: - virtual ~VCLXAccessibleRadioButton(); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - -public: - VCLXAccessibleRadioButton( VCLXWindow* pVCLXindow ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx deleted file mode 100644 index 415887bf3..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX - -#include - -#include -#include - -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleScrollBar -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleScrollBar_BASE; - -class VCLXAccessibleScrollBar : public VCLXAccessibleComponent, - public VCLXAccessibleScrollBar_BASE -{ -protected: - virtual ~VCLXAccessibleScrollBar(); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - -public: - VCLXAccessibleScrollBar( VCLXWindow* pVCLXindow ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx deleted file mode 100644 index 2e1d06dea..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX - -#include - -#include - -class StatusBar; - -// ---------------------------------------------------- -// class VCLXAccessibleStatusBar -// ---------------------------------------------------- - -class VCLXAccessibleStatusBar : public VCLXAccessibleComponent -{ -private: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - StatusBar* m_pStatusBar; - -protected: - void UpdateShowing( sal_Int32 i, sal_Bool bShowing ); - void UpdateItemName( sal_Int32 i ); - void UpdateItemText( sal_Int32 i ); - - void InsertChild( sal_Int32 i ); - void RemoveChild( sal_Int32 i ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow ); - ~VCLXAccessibleStatusBar(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); -}; - - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx deleted file mode 100644 index 77ce83c05..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX - -#include -#include -#include -#include - - -class StatusBar; -class VCLExternalSolarLock; - -namespace utl { -class AccessibleStateSetHelper; -} - - -// ---------------------------------------------------- -// class VCLXAccessibleStatusBarItem -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE; - -class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE, - public VCLXAccessibleStatusBarItem_BASE -{ - friend class VCLXAccessibleStatusBar; - -private: - VCLExternalSolarLock* m_pExternalLock; - StatusBar* m_pStatusBar; - sal_uInt16 m_nItemId; - ::rtl::OUString m_sItemName; - ::rtl::OUString m_sItemText; - sal_Bool m_bShowing; - -protected: - sal_Bool IsShowing(); - void SetShowing( sal_Bool bShowing ); - void SetItemName( const ::rtl::OUString& sItemName ); - ::rtl::OUString GetItemName(); - void SetItemText( const ::rtl::OUString& sItemText ); - ::rtl::OUString GetItemText(); - sal_uInt16 GetItemId() const { return m_nItemId; } - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId ); - virtual ~VCLXAccessibleStatusBarItem(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx deleted file mode 100644 index 5097144fd..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX - -#include -#include - -#include - -class TabControl; - - -// ---------------------------------------------------- -// class VCLXAccessibleTabControl -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper1 < - ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleTabControl_BASE; - -class VCLXAccessibleTabControl : public VCLXAccessibleComponent, - public VCLXAccessibleTabControl_BASE -{ -private: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - TabControl* m_pTabControl; - -protected: - void UpdateFocused(); - void UpdateSelected( sal_Int32 i, bool bSelected ); - void UpdatePageText( sal_Int32 i ); - void UpdateTabPage( sal_Int32 i, bool bNew ); - - void InsertChild( sal_Int32 i ); - void RemoveChild( sal_Int32 i ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow ); - ~VCLXAccessibleTabControl(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx deleted file mode 100644 index b29ab16aa..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX - -#include -#include -#include -#include - - -class TabControl; -class VCLExternalSolarLock; - -namespace utl { -class AccessibleStateSetHelper; -} - - -// ---------------------------------------------------- -// class VCLXAccessibleTabPage -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; - -typedef ::cppu::ImplHelper2< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo > VCLXAccessibleTabPage_BASE; - -class VCLXAccessibleTabPage : public AccessibleTextHelper_BASE, - public VCLXAccessibleTabPage_BASE -{ - friend class VCLXAccessibleTabControl; - -private: - VCLExternalSolarLock* m_pExternalLock; - TabControl* m_pTabControl; - sal_uInt16 m_nPageId; - bool m_bFocused; - bool m_bSelected; - ::rtl::OUString m_sPageText; - -protected: - bool IsFocused(); - bool IsSelected(); - - void SetFocused( bool bFocused ); - void SetSelected( bool bSelected ); - void SetPageText( const ::rtl::OUString& sPageText ); - ::rtl::OUString GetPageText(); - - void Update( bool bNew ); - - sal_uInt16 GetPageId() const { return m_nPageId; } - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId ); - virtual ~VCLXAccessibleTabPage(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx deleted file mode 100644 index 73586c558..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX - -#include - - -class TabControl; -class TabPage; - - -// ---------------------------------------------------- -// class VCLXAccessibleTabPageWindow -// ---------------------------------------------------- - -class VCLXAccessibleTabPageWindow : public VCLXAccessibleComponent -{ -private: - TabControl* m_pTabControl; - TabPage* m_pTabPage; - sal_uInt16 m_nPageId; - -protected: - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow ); - ~VCLXAccessibleTabPageWindow(); - - // XAccessibleContext - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); -}; - - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx deleted file mode 100644 index ea74885e8..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX - -#include -#include - - -// ---------------------------------------------------- -// class VCLXAccessibleTextComponent -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper1 < - ::com::sun::star::accessibility::XAccessibleText > VCLXAccessibleTextComponent_BASE; - -class VCLXAccessibleTextComponent : public VCLXAccessibleComponent, - public ::comphelper::OCommonAccessibleText, - public VCLXAccessibleTextComponent_BASE -{ -protected: - ::rtl::OUString m_sText; - - void SetText( const ::rtl::OUString& sText ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow ); - ~VCLXAccessibleTextComponent(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx deleted file mode 100644 index 244ef92c0..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX - -#include - -#include - -typedef ::cppu::ImplHelper1< - ::com::sun::star::accessibility::XAccessible - > VCLXAccessible_BASE; - - -/** This class represents non editable text fields. The object passed to - the constructor is expected to be a list (a ListBox to be - more specific). From this allways the selected item is token to be made - accessible by this class. When the selected item changes then also the - exported text changes. -*/ -class VCLXAccessibleTextField : - public VCLXAccessibleTextComponent, - public VCLXAccessible_BASE -{ -public: - VCLXAccessibleTextField (VCLXWindow* pVCLXindow, - const ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible >& _xParent); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XAccessible - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL - getAccessibleContext (void) - throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - sal_Int32 SAL_CALL getAccessibleChildCount (void) - throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL - getAccessibleChild (sal_Int32 i) - throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - sal_Int16 SAL_CALL getAccessibleRole (void) - throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL - getAccessibleParent( ) - throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName (void) - throw (::com::sun::star::uno::RuntimeException); - // Return text field specific services. - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames (void) - throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ~VCLXAccessibleTextField (void); - - /** With this method the text of the currently selected item is made - available to the VCLXAccessibleTextComponent base class. - */ - ::rtl::OUString implGetText (void); - -private: - /** We need to save the accessible parent to return it in getAccessibleParent(), - because this method of the base class returns the wrong parent. - */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > m_xParent; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx deleted file mode 100644 index 110493415..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX - -#include -#include -#include - -// ---------------------------------------------------- -// class VCLXAccessibleToolBox -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE; - -typedef std::map< sal_Int32, com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > ToolBoxItemsMap; - -class VCLXAccessibleToolBoxItem; -class ToolBox; - -class VCLXAccessibleToolBox : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE -{ -private: - ToolBoxItemsMap m_aAccessibleChildren; - - VCLXAccessibleToolBoxItem* GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus ); - - void UpdateFocus_Impl(); - void ReleaseFocus_Impl( sal_Int32 _nPos ); - void UpdateChecked_Impl( sal_Int32 _nPos ); - void UpdateIndeterminate_Impl( sal_Int32 _nPos ); - void UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded ); - void UpdateAllItems_Impl(); - void UpdateItemName_Impl( sal_Int32 _nPos ); - void UpdateItemEnabled_Impl( sal_Int32 _nPos ); - void UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ); - void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ); - void ReleaseSubToolBox( ToolBox* _pSubToolBox ); - -protected: - virtual ~VCLXAccessibleToolBox(); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent ); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ); - - // XInterface - DECLARE_XINTERFACE( ) - - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - -private: - void implReleaseToolboxItem( - ToolBoxItemsMap::iterator& _rMapPos, - bool _bNotifyRemoval, - bool _bDispose - ); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx deleted file mode 100644 index ef380176a..000000000 --- a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX -#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// class VCLXAccessibleToolBoxItem --------------------------------------------- - -class ToolBox; - -typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; -typedef ::cppu::ImplHelper4 < ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleAction, - ::com::sun::star::accessibility::XAccessibleValue, - ::com::sun::star::lang::XServiceInfo > VCLXAccessibleToolBoxItem_BASE; - -class VCLExternalSolarLock; - -class VCLXAccessibleToolBoxItem : public AccessibleTextHelper_BASE, - public VCLXAccessibleToolBoxItem_BASE -{ -private: - ::rtl::OUString m_sOldName; - ToolBox* m_pToolBox; - VCLExternalSolarLock* m_pExternalLock; - sal_Int32 m_nIndexInParent; - sal_Int16 m_nRole; - sal_uInt16 m_nItemId; - sal_Bool m_bHasFocus; - sal_Bool m_bIsChecked; - bool m_bIndeterminate; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xChild; - -public: - inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; } - inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; } - -protected: - virtual ~VCLXAccessibleToolBoxItem(); - - virtual void SAL_CALL disposing(); - - /// implements the calculation of the bounding rectangle - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // OCommonAccessibleText - virtual ::rtl::OUString implGetText(); - virtual ::com::sun::star::lang::Locale implGetLocale(); - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); - - ::rtl::OUString GetText( bool _bAsName ); - -public: - VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ); - - void SetFocus( sal_Bool _bFocus ); - inline sal_Bool HasFocus() const { return m_bHasFocus; } - void SetChecked( sal_Bool _bCheck ); - inline sal_Bool IsChecked() const { return m_bIsChecked; } - void SetIndeterminate( bool _bIndeterminate ); - inline bool IsIndeterminate() const { return m_bIndeterminate; } - inline void ReleaseToolBox() { m_pToolBox = NULL; } - void NameChanged(); - void SetChild( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild ); - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetChild() const { return m_xChild; } - void NotifyChildEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild, bool _bShow ); - - void ToggleEnableState(); - - // XInterface - DECLARE_XINTERFACE( ) - DECLARE_XTYPEPROVIDER( ) - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleText - virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFontMetrics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xFont ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleAction - virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleValue - virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/makefile.mk b/accessibility/inc/makefile.mk deleted file mode 100644 index 3afcad166..000000000 --- a/accessibility/inc/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=.. - -PRJNAME=accessibility -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" - diff --git a/accessibility/inc/pch/precompiled_accessibility.cxx b/accessibility/inc/pch/precompiled_accessibility.cxx deleted file mode 100644 index 2de9ca22a..000000000 --- a/accessibility/inc/pch/precompiled_accessibility.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_accessibility.hxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/pch/precompiled_accessibility.hxx b/accessibility/inc/pch/precompiled_accessibility.hxx deleted file mode 100644 index ed7eaf8e4..000000000 --- a/accessibility/inc/pch/precompiled_accessibility.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:28.952369 - -#ifdef PRECOMPILED_HEADERS - -//---MARKER--- - -#include "com/sun/star/accessibility/AccessibleRelationType.hpp" -#include "unotools/accessiblerelationsethelper.hxx" -#include "vcl/window.hxx" -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst deleted file mode 100644 index 61692214b..000000000 --- a/accessibility/prj/build.lst +++ /dev/null @@ -1,18 +0,0 @@ -ac accessibility : TRANSLATIONS:translations tools jurt offapi unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL -ac accessibility usr1 - all ac_mkout NULL -ac accessibility\inc nmake - all ac_inc NULL -ac accessibility\bridge\org\openoffice\java\accessibility nmake - w ac_ooja ac_inc NULL -ac accessibility\bridge\org\openoffice\accessibility nmake - w ac_ooa ac_ooja.w ac_inc NULL -ac accessibility\bridge\source\java nmake - w ac_ooan ac_ooa.w ac_inc NULL -ac accessibility\inc get - all ac_inc NULL -ac accessibility\source\helper nmake - all ac_helper ac_inc NULL -ac accessibility\source\standard nmake - all ac_standard ac_helper ac_inc NULL -ac accessibility\source\extended nmake - all ac_extended ac_inc NULL -ac accessibility\util nmake - all ac_util ac_helper ac_standard ac_extended NULL -ac accessibility\workben\org\openoffice\accessibility\awb nmake - all ac_awb_main ac_awb_misc ac_awb_canvas ac_awb_view ac_awb_tree NULL -ac accessibility\workben\org\openoffice\accessibility\misc nmake - all ac_awb_misc NULL -ac accessibility\workben\org\openoffice\accessibility\awb\canvas nmake - all ac_awb_canvas ac_awb_tree NULL -ac accessibility\workben\org\openoffice\accessibility\awb\tree nmake - all ac_awb_tree ac_awb_misc NULL -ac accessibility\workben\org\openoffice\accessibility\awb\view nmake - all ac_awb_view ac_awb_view_text NULL -# dependency on ac_awb_misc to avoid concurrent creation of java_ver.mk -ac accessibility\workben\org\openoffice\accessibility\awb\view\text nmake - all ac_awb_view_text ac_awb_misc NULL diff --git a/accessibility/prj/d.lst b/accessibility/prj/d.lst deleted file mode 100644 index 1e47390f9..000000000 --- a/accessibility/prj/d.lst +++ /dev/null @@ -1,8 +0,0 @@ -..\%__SRC%\class\java_uno_accessbridge.jar %_DEST%\bin\java_uno_accessbridge.jar -..\%__SRC%\class\java_accessibility.jar %_DEST%\bin\java_accessibility.jar - -..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll -..\%__SRC%\bin\*.res %_DEST%\bin\*.res -..\%__SRC%\lib\lib*.so %_DEST%\lib -..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib -..\%__SRC%\misc\java_uno_accessbridge.component %_DEST%\xml\java_uno_accessbridge.component diff --git a/accessibility/prj/l10n b/accessibility/prj/l10n deleted file mode 100644 index 69f0d9e5e..000000000 --- a/accessibility/prj/l10n +++ /dev/null @@ -1 +0,0 @@ -#i49922# In this module en-US and de are used as source language diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx deleted file mode 100644 index 282f29a65..000000000 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ /dev/null @@ -1,395 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/AccessibleBrowseBox.hxx" -#include "accessibility/extended/AccessibleBrowseBoxTable.hxx" -#include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx" -#include -#include -#include - -// ============================================================================ - -namespace accessibility -{ - -// ============================================================================ - -using ::rtl::OUString; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; - -// ============================================================================ -class AccessibleBrowseBoxImpl -{ -public: - /// the XAccessible which created the AccessibleBrowseBox - WeakReference< XAccessible > m_aCreator; - - /** The data table child. */ - Reference< - ::com::sun::star::accessibility::XAccessible > mxTable; - AccessibleBrowseBoxTable* m_pTable; - - /** The header bar for rows ("handle column"). */ - Reference< - ::com::sun::star::accessibility::XAccessible > mxRowHeaderBar; - AccessibleBrowseBoxHeaderBar* m_pRowHeaderBar; - - /** The header bar for columns (first row of the table). */ - Reference< - ::com::sun::star::accessibility::XAccessible > mxColumnHeaderBar; - AccessibleBrowseBoxHeaderBar* m_pColumnHeaderBar; -}; - -// Ctor/Dtor/disposing -------------------------------------------------------- - -DBG_NAME( AccessibleBrowseBox ) - -AccessibleBrowseBox::AccessibleBrowseBox( - const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator, - IAccessibleTableProvider& _rBrowseBox ) - : AccessibleBrowseBoxBase( _rxParent, _rBrowseBox,NULL, BBTYPE_BROWSEBOX ) -{ - DBG_CTOR( AccessibleBrowseBox, NULL ); - m_pImpl.reset( new AccessibleBrowseBoxImpl() ); - m_pImpl->m_aCreator = _rxCreator; - - m_xFocusWindow = VCLUnoHelper::GetInterface(mpBrowseBox->GetWindowInstance()); -} -// ----------------------------------------------------------------------------- -void AccessibleBrowseBox::setCreator( const Reference< XAccessible >& _rxCreator ) -{ -#if OSL_DEBUG_LEVEL > 0 - Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; - DBG_ASSERT( !xCreator.is(), "accessibility/extended/AccessibleBrowseBox::setCreator: creator already set!" ); -#endif - m_pImpl->m_aCreator = _rxCreator; -} - -// ----------------------------------------------------------------------------- -AccessibleBrowseBox::~AccessibleBrowseBox() -{ - DBG_DTOR( AccessibleBrowseBox, NULL ); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL AccessibleBrowseBox::disposing() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - - m_pImpl->m_pTable = NULL; - m_pImpl->m_pColumnHeaderBar = NULL; - m_pImpl->m_pRowHeaderBar = NULL; - m_pImpl->m_aCreator = Reference< XAccessible >(); - - Reference< XAccessible > xTable = m_pImpl->mxTable; - - Reference< XComponent > xComp( m_pImpl->mxTable, UNO_QUERY ); - if ( xComp.is() ) - { - xComp->dispose(); - - } -//! ::comphelper::disposeComponent(m_pImpl->mxTable); - ::comphelper::disposeComponent(m_pImpl->mxRowHeaderBar); - ::comphelper::disposeComponent(m_pImpl->mxColumnHeaderBar); - - AccessibleBrowseBoxBase::disposing(); -} -// ----------------------------------------------------------------------------- - -// XAccessibleContext --------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleBrowseBox::getAccessibleChildCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return BBINDEX_FIRSTCONTROL + mpBrowseBox->GetAccessibleControlCount(); -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBox::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Reference< XAccessible > xRet; - if( nChildIndex >= 0 ) - { - if( nChildIndex < BBINDEX_FIRSTCONTROL ) - xRet = implGetFixedChild( nChildIndex ); - else - { - // additional controls - nChildIndex -= BBINDEX_FIRSTCONTROL; - if( nChildIndex < mpBrowseBox->GetAccessibleControlCount() ) - xRet = mpBrowseBox->CreateAccessibleControl( nChildIndex ); - } - } - - if( !xRet.is() ) - throw lang::IndexOutOfBoundsException(); - return xRet; -} - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Reference< XAccessible > xChild; - sal_Int32 nIndex = 0; - if( mpBrowseBox->ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) ) - xChild = mpBrowseBox->CreateAccessibleControl( nIndex ); - else - { - // try whether point is in one of the fixed children - // (table, header bars, corner control) - Point aPoint( VCLPoint( rPoint ) ); - for( nIndex = 0; (nIndex < BBINDEX_FIRSTCONTROL) && !xChild.is(); ++nIndex ) - { - Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); - Reference< XAccessibleComponent > - xCurrChildComp( xCurrChild, uno::UNO_QUERY ); - - if( xCurrChildComp.is() && - VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) ) - xChild = xCurrChild; - } - } - return xChild; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL AccessibleBrowseBox::grabFocus() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - mpBrowseBox->GrabFocus(); -} -// ----------------------------------------------------------------------------- - -Any SAL_CALL AccessibleBrowseBox::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); -} -// ----------------------------------------------------------------------------- - -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleBrowseBox::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBox" ) ); -} -// ----------------------------------------------------------------------------- - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleBrowseBox::implGetBoundingBox() -{ - Window* pParent = mpBrowseBox->GetAccessibleParentWindow(); - DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); - return mpBrowseBox->GetWindowExtentsRelative( pParent ); -} -// ----------------------------------------------------------------------------- - -Rectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen() -{ - return mpBrowseBox->GetWindowExtentsRelative( NULL ); -} -// ----------------------------------------------------------------------------- - -// internal helper methods ---------------------------------------------------- - -Reference< XAccessible > AccessibleBrowseBox::implGetTable() -{ - if( !m_pImpl->mxTable.is() ) - { - m_pImpl->m_pTable = createAccessibleTable(); - m_pImpl->mxTable = m_pImpl->m_pTable; - - } - return m_pImpl->mxTable; -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > -AccessibleBrowseBox::implGetHeaderBar( AccessibleBrowseBoxObjType eObjType ) -{ - Reference< XAccessible > xRet; - Reference< XAccessible >* pxMember = NULL; - - if( eObjType == BBTYPE_ROWHEADERBAR ) - pxMember = &m_pImpl->mxRowHeaderBar; - else if( eObjType == BBTYPE_COLUMNHEADERBAR ) - pxMember = &m_pImpl->mxColumnHeaderBar; - - if( pxMember ) - { - if( !pxMember->is() ) - { - AccessibleBrowseBoxHeaderBar* pHeaderBar = new AccessibleBrowseBoxHeaderBar( - (Reference< XAccessible >)m_pImpl->m_aCreator, *mpBrowseBox, eObjType ); - - if ( BBTYPE_COLUMNHEADERBAR == eObjType) - m_pImpl->m_pColumnHeaderBar = pHeaderBar; - else - m_pImpl->m_pRowHeaderBar = pHeaderBar; - - *pxMember = pHeaderBar; - } - xRet = *pxMember; - } - return xRet; -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > -AccessibleBrowseBox::implGetFixedChild( sal_Int32 nChildIndex ) -{ - Reference< XAccessible > xRet; - switch( nChildIndex ) - { - case BBINDEX_COLUMNHEADERBAR: - xRet = implGetHeaderBar( BBTYPE_COLUMNHEADERBAR ); - break; - case BBINDEX_ROWHEADERBAR: - xRet = implGetHeaderBar( BBTYPE_ROWHEADERBAR ); - break; - case BBINDEX_TABLE: - xRet = implGetTable(); - break; - } - return xRet; -} -// ----------------------------------------------------------------------------- -AccessibleBrowseBoxTable* AccessibleBrowseBox::createAccessibleTable() -{ - Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; - DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleBrowseBox::createAccessibleTable: my creator died - how this?" ); - return new AccessibleBrowseBoxTable( xCreator, *mpBrowseBox ); -} -// ----------------------------------------------------------------------------- -void AccessibleBrowseBox::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue) -{ - if ( m_pImpl->mxTable.is() ) - { - m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue); - } -} -// ----------------------------------------------------------------------------- -void AccessibleBrowseBox::commitHeaderBarEvent( sal_Int16 _nEventId, - const Any& _rNewValue, - const Any& _rOldValue,sal_Bool _bColumnHeaderBar) -{ - Reference< XAccessible > xHeaderBar = _bColumnHeaderBar ? m_pImpl->mxColumnHeaderBar : m_pImpl->mxRowHeaderBar; - AccessibleBrowseBoxHeaderBar* pHeaderBar = _bColumnHeaderBar ? m_pImpl->m_pColumnHeaderBar : m_pImpl->m_pRowHeaderBar; - if ( xHeaderBar.is() ) - pHeaderBar->commitEvent(_nEventId,_rNewValue,_rOldValue); -} - -// ============================================================================ -// = AccessibleBrowseBoxAccess -// ============================================================================ -DBG_NAME( AccessibleBrowseBoxAccess ) -// ----------------------------------------------------------------------------- -AccessibleBrowseBoxAccess::AccessibleBrowseBoxAccess( const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) - :m_xParent( _rxParent ) - ,m_rBrowseBox( _rBrowseBox ) - ,m_pContext( NULL ) -{ - DBG_CTOR( AccessibleBrowseBoxAccess, NULL ); -} - -// ----------------------------------------------------------------------------- -AccessibleBrowseBoxAccess::~AccessibleBrowseBoxAccess() -{ - DBG_DTOR( AccessibleBrowseBoxAccess, NULL ); -} - -// ----------------------------------------------------------------------------- -void AccessibleBrowseBoxAccess::dispose() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - m_pContext = NULL; - ::comphelper::disposeComponent( m_xContext ); -} - -// ----------------------------------------------------------------------------- -Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxAccess::getAccessibleContext() throw ( RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ), - "accessibility/extended/AccessibleBrowseBoxAccess::getAccessibleContext: inconsistency!" ); - - // if the context died meanwhile (there is no listener, so it won't tell us explicitily when this happens), - // then reset and re-create. - if ( m_pContext && !m_pContext->isAlive() ) - m_xContext = m_pContext = NULL; - - if ( !m_xContext.is() ) - m_xContext = m_pContext = new AccessibleBrowseBox( m_xParent, this, m_rBrowseBox ); - - return m_xContext; -} - -// ----------------------------------------------------------------------------- -bool AccessibleBrowseBoxAccess::isContextAlive() const -{ - return ( NULL != m_pContext ) && m_pContext->isAlive(); -} - -// ============================================================================ - -} // namespace accessibility - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx deleted file mode 100644 index 98ed28c51..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx +++ /dev/null @@ -1,652 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" -#include -#include - -#include -#include -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; -using namespace ::svt; - - -// ============================================================================ - -namespace accessibility { - -using namespace com::sun::star::accessibility::AccessibleStateType; -// ============================================================================ - -// Ctor/Dtor/disposing -------------------------------------------------------- - -DBG_NAME( AccessibleBrowseBoxBase ) - -AccessibleBrowseBoxBase::AccessibleBrowseBoxBase( - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - AccessibleBrowseBoxObjType eObjType ) : - AccessibleBrowseBoxImplHelper( m_aMutex ), - mxParent( rxParent ), - mpBrowseBox( &rBrowseBox ), - m_xFocusWindow(_xFocusWindow), - maName( rBrowseBox.GetAccessibleObjectName( eObjType ) ), - maDescription( rBrowseBox.GetAccessibleObjectDescription( eObjType ) ), - meObjType( eObjType ), - m_aClientId(0) -{ - DBG_CTOR( AccessibleBrowseBoxBase, NULL ); - if ( m_xFocusWindow.is() ) - m_xFocusWindow->addFocusListener( this ); -} - -AccessibleBrowseBoxBase::AccessibleBrowseBoxBase( - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - AccessibleBrowseBoxObjType eObjType, - const ::rtl::OUString& rName, - const ::rtl::OUString& rDescription ) : - AccessibleBrowseBoxImplHelper( m_aMutex ), - mxParent( rxParent ), - mpBrowseBox( &rBrowseBox ), - m_xFocusWindow(_xFocusWindow), - maName( rName ), - maDescription( rDescription ), - meObjType( eObjType ), - m_aClientId(0) -{ - DBG_CTOR( AccessibleBrowseBoxBase, NULL ); - if ( m_xFocusWindow.is() ) - m_xFocusWindow->addFocusListener( this ); -} - -AccessibleBrowseBoxBase::~AccessibleBrowseBoxBase() -{ - DBG_DTOR( AccessibleBrowseBoxBase, NULL ); - - if( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } -} - -void SAL_CALL AccessibleBrowseBoxBase::disposing() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - if ( m_xFocusWindow.is() ) - { - SolarMutexGuard aSolarGuard; - m_xFocusWindow->removeFocusListener( this ); - } - - if ( getClientId( ) ) - { - AccessibleEventNotifier::TClientId nId( getClientId( ) ); - setClientId( 0 ); - AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); - } - - mxParent = NULL; - mpBrowseBox = NULL; -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleParent() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return mxParent; -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - // -1 for child not found/no parent (according to specification) - sal_Int32 nRet = -1; - - Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY ); - - // iterate over parent's children and search for this object - if( mxParent.is() ) - { - Reference< XAccessibleContext > - xParentContext( mxParent->getAccessibleContext() ); - if( xParentContext.is() ) - { - Reference< uno::XInterface > xChild; - - sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); - for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild ) - { - xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) ); - - if ( xMeMyselfAndI.get() == xChild.get() ) - { - nRet = nChild; - break; - } - } - } - } - return nRet; -} - -OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleDescription() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return maDescription; -} - -OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleName() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return maName; -} - -Reference< XAccessibleRelationSet > SAL_CALL -AccessibleBrowseBoxBase::getAccessibleRelationSet() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - // BrowseBox does not have relations. - return new utl::AccessibleRelationSetHelper; -} - -Reference< XAccessibleStateSet > SAL_CALL -AccessibleBrowseBoxBase::getAccessibleStateSet() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - // don't check whether alive -> StateSet may contain DEFUNC - return implCreateStateSetHelper(); -} - -lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale() - throw ( IllegalAccessibleComponentStateException, uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - if( mxParent.is() ) - { - Reference< XAccessibleContext > - xParentContext( mxParent->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); - } - throw IllegalAccessibleComponentStateException(); -} - -// XAccessibleComponent ------------------------------------------------------- - -sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); -} - -awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds() - throw ( uno::RuntimeException ) -{ - return AWTRectangle( getBoundingBox() ); -} - -awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation() - throw ( uno::RuntimeException ) -{ - return AWTPoint( getBoundingBox().TopLeft() ); -} - -awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen() - throw ( uno::RuntimeException ) -{ - return AWTPoint( getBoundingBoxOnScreen().TopLeft() ); -} - -awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize() - throw ( uno::RuntimeException ) -{ - return AWTSize( getBoundingBox().GetSize() ); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxBase::isShowing() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implIsShowing(); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxBase::isVisible() - throw ( uno::RuntimeException ) -{ - Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); - return xStateSet.is() ? - xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False; -} - -sal_Bool SAL_CALL AccessibleBrowseBoxBase::isFocusTraversable() - throw ( uno::RuntimeException ) -{ - Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); - return xStateSet.is() ? - xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False; -} - -void SAL_CALL AccessibleBrowseBoxBase::focusGained( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException) -{ - com::sun::star::uno::Any aFocused; - com::sun::star::uno::Any aEmpty; - aFocused <<= FOCUSED; - - commitEvent(AccessibleEventId::STATE_CHANGED,aFocused,aEmpty); -} -// ----------------------------------------------------------------------------- - -void SAL_CALL AccessibleBrowseBoxBase::focusLost( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException) -{ - com::sun::star::uno::Any aFocused; - com::sun::star::uno::Any aEmpty; - aFocused <<= FOCUSED; - - commitEvent(AccessibleEventId::STATE_CHANGED,aEmpty,aFocused); -} -// XAccessibleEventBroadcaster ------------------------------------------------ - -void SAL_CALL AccessibleBrowseBoxBase::addEventListener( - const Reference< XAccessibleEventListener>& _rxListener ) - throw ( uno::RuntimeException ) -{ - if ( _rxListener.is() ) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - if ( !getClientId( ) ) - setClientId( AccessibleEventNotifier::registerClient( ) ); - - AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener ); - } -} - -void SAL_CALL AccessibleBrowseBoxBase::removeEventListener( - const Reference< XAccessibleEventListener>& _rxListener ) - throw ( uno::RuntimeException ) -{ - if( _rxListener.is() && getClientId( ) ) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - - AccessibleEventNotifier::TClientId nId( getClientId( ) ); - setClientId( 0 ); - AccessibleEventNotifier::revokeClient( nId ); - } - } -} - -// XTypeProvider -------------------------------------------------------------- - -namespace -{ - class theAccessibleBrowseBoxBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxBaseImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleBrowseBoxBaseImplementationId::get().getSeq(); -} - -// XServiceInfo --------------------------------------------------------------- - -sal_Bool SAL_CALL AccessibleBrowseBoxBase::supportsService( - const OUString& rServiceName ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - const OUString* pArrBegin = aSupportedServices.getConstArray(); - const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength(); - const OUString* pString = pArrBegin; - - for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString ) - ; - - return pString != pArrEnd; -} - -Sequence< OUString > SAL_CALL AccessibleBrowseBoxBase::getSupportedServiceNames() - throw ( uno::RuntimeException ) -{ - const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) ); - return Sequence< OUString >( &aServiceName, 1 ); -} - -// other public methods ------------------------------------------------------- - -void AccessibleBrowseBoxBase::setAccessibleName( const OUString& rName ) -{ - ::osl::ClearableMutexGuard aGuard( getOslMutex() ); - Any aOld; - aOld <<= maName; - maName = rName; - - aGuard.clear(); - - commitEvent( - AccessibleEventId::NAME_CHANGED, - uno::makeAny( maName ), - aOld ); -} - -void AccessibleBrowseBoxBase::setAccessibleDescription( const OUString& rDescription ) -{ - ::osl::ClearableMutexGuard aGuard( getOslMutex() ); - Any aOld; - aOld <<= maDescription; - maDescription = rDescription; - - aGuard.clear(); - - commitEvent( - AccessibleEventId::DESCRIPTION_CHANGED, - uno::makeAny( maDescription ), - aOld ); -} - -// internal virtual methods --------------------------------------------------- - -sal_Bool AccessibleBrowseBoxBase::implIsShowing() -{ - sal_Bool bShowing = sal_False; - if( mxParent.is() ) - { - Reference< XAccessibleComponent > - xParentComp( mxParent->getAccessibleContext(), uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = implGetBoundingBox().IsOver( - VCLRectangle( xParentComp->getBounds() ) ); - } - return bShowing; -} - -::utl::AccessibleStateSetHelper* AccessibleBrowseBoxBase::implCreateStateSetHelper() -{ - ::utl::AccessibleStateSetHelper* - pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - // BrowseBox fills StateSet with states depending on object type - mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return pStateSetHelper; -} - -// internal helper methods ---------------------------------------------------- - -sal_Bool AccessibleBrowseBoxBase::isAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose && mpBrowseBox; -} - -void AccessibleBrowseBoxBase::ensureIsAlive() const - throw ( lang::DisposedException ) -{ - if( !isAlive() ) - throw lang::DisposedException(); -} - -Rectangle AccessibleBrowseBoxBase::getBoundingBox() - throw ( lang::DisposedException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Rectangle aRect = implGetBoundingBox(); - if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) - { - DBG_ERRORFILE( "shit" ); - } - return aRect; -} - -Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen() - throw ( lang::DisposedException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Rectangle aRect = implGetBoundingBoxOnScreen(); - if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) - { - DBG_ERRORFILE( "shit" ); - } - return aRect; -} - -void AccessibleBrowseBoxBase::commitEvent( - sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) -{ - ::osl::ClearableMutexGuard aGuard( getOslMutex() ); - if ( !getClientId( ) ) - // if we don't have a client id for the notifier, then we don't have listeners, then - // we don't need to notify anything - return; - - // build an event object - AccessibleEventObject aEvent; - aEvent.Source = *this; - aEvent.EventId = _nEventId; - aEvent.OldValue = _rOldValue; - aEvent.NewValue = _rNewValue; - - // let the notifier handle this event - - AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); -} - -sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - sal_Int16 nRole = AccessibleRole::UNKNOWN; - switch ( meObjType ) - { - case BBTYPE_ROWHEADERCELL: - nRole = AccessibleRole::ROW_HEADER; - break; - case BBTYPE_COLUMNHEADERCELL: - nRole = AccessibleRole::COLUMN_HEADER; - break; - case BBTYPE_COLUMNHEADERBAR: - case BBTYPE_ROWHEADERBAR: - case BBTYPE_TABLE: - nRole = AccessibleRole::TABLE; - break; - case BBTYPE_TABLECELL: - nRole = AccessibleRole::TABLE_CELL; - break; - case BBTYPE_BROWSEBOX: - nRole = AccessibleRole::PANEL; - break; - case BBTYPE_CHECKBOXCELL: - nRole = AccessibleRole::CHECK_BOX; - break; - } - return nRole; -} -// ----------------------------------------------------------------------------- -Any SAL_CALL AccessibleBrowseBoxBase::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - return Any(); -} -// ----------------------------------------------------------------------------- -Reference SAL_CALL AccessibleBrowseBoxBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& ) - throw ( uno::RuntimeException ) -{ - return NULL; -} -// ----------------------------------------------------------------------------- -void SAL_CALL AccessibleBrowseBoxBase::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ - m_xFocusWindow = NULL; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - sal_Int32 nColor = 0; - Window* pInst = mpBrowseBox->GetWindowInstance(); - if ( pInst ) - { - if ( pInst->IsControlForeground() ) - nColor = pInst->GetControlForeground().GetColor(); - else - { - Font aFont; - if ( pInst->IsControlFont() ) - aFont = pInst->GetControlFont(); - else - aFont = pInst->GetFont(); - nColor = aFont.GetColor().GetColor(); - } - } - - return nColor; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - sal_Int32 nColor = 0; - Window* pInst = mpBrowseBox->GetWindowInstance(); - if ( pInst ) - { - if ( pInst->IsControlBackground() ) - nColor = pInst->GetControlBackground().GetColor(); - else - nColor = pInst->GetBackground().GetColor().GetColor(); - } - - return nColor; -} - -// ============================================================================ -DBG_NAME( BrowseBoxAccessibleElement ) - -// XInterface ----------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base ) - -// XTypeProvider -------------------------------------------------------------- -IMPLEMENT_FORWARD_XTYPEPROVIDER2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base ) - -// XAccessible ---------------------------------------------------------------- - -Reference< XAccessibleContext > SAL_CALL BrowseBoxAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return this; -} - -// ---------------------------------------------------------------------------- -BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox, - const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType eObjType ) - :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType ) -{ - DBG_CTOR( BrowseBoxAccessibleElement, NULL ); -} - -// ---------------------------------------------------------------------------- -BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox, - const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType eObjType, - const ::rtl::OUString& rName, const ::rtl::OUString& rDescription ) - :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType, rName, rDescription ) -{ - DBG_CTOR( BrowseBoxAccessibleElement, NULL ); -} - -// ---------------------------------------------------------------------------- -BrowseBoxAccessibleElement::~BrowseBoxAccessibleElement( ) -{ - DBG_DTOR( BrowseBoxAccessibleElement, NULL ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx deleted file mode 100644 index 94b2947ee..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include - -namespace accessibility -{ - using namespace com::sun::star::accessibility; - using namespace com::sun::star::uno; - using namespace com::sun::star::accessibility::AccessibleEventId; - using namespace ::svt; - - AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference& _rxParent, - IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ,const TriState& _eState, - sal_Bool _bEnabled, - sal_Bool _bIsTriState) - :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos, BBTYPE_CHECKBOXCELL) - ,m_eState(_eState) - ,m_bEnabled(_bEnabled) - ,m_bIsTriState(_bIsTriState) - { - } - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) - //-------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext( ) throw (RuntimeException) - { - ensureIsAlive(); - return this; - } - // ----------------------------------------------------------------------------- - ::utl::AccessibleStateSetHelper* AccessibleCheckBoxCell::implCreateStateSetHelper() - { - ::utl::AccessibleStateSetHelper* pStateSetHelper = - AccessibleBrowseBoxCell::implCreateStateSetHelper(); - if( isAlive() ) - { - mpBrowseBox->FillAccessibleStateSetForCell( - *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - if ( m_eState == STATE_CHECK ) - pStateSetHelper->AddState( AccessibleStateType::CHECKED ); - } - return pStateSetHelper; - } - // ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- - // XAccessibleValue - // ----------------------------------------------------------------------------- - - Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - - sal_Int32 nValue = 0; - switch( m_eState ) - { - case STATE_NOCHECK: - nValue = 0; - break; - case STATE_CHECK: - nValue = 1; - break; - case STATE_DONTKNOW: - nValue = 2; - break; - } - return makeAny(nValue); - } - - // ----------------------------------------------------------------------------- - - sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) throw (RuntimeException) - { - return sal_False; - } - - // ----------------------------------------------------------------------------- - - Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - - Any aValue; - - if ( m_bIsTriState ) - aValue <<= (sal_Int32) 2; - else - aValue <<= (sal_Int32) 1; - - return aValue; - } - - // ----------------------------------------------------------------------------- - - Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue( ) throw (RuntimeException) - { - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; - } - // ----------------------------------------------------------------------------- - // XAccessibleContext - sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException) - { - return 0; - } - // ----------------------------------------------------------------------------- - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCheckBoxCell" ) ); - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - - return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos(); - } - // ----------------------------------------------------------------------------- - void AccessibleCheckBoxCell::SetChecked( sal_Bool _bChecked ) - { - m_eState = _bChecked ? STATE_CHECK : STATE_NOCHECK; - Any aOldValue, aNewValue; - if ( _bChecked ) - aNewValue <<= AccessibleStateType::CHECKED; - else - aOldValue <<= AccessibleStateType::CHECKED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx deleted file mode 100644 index 55aa3a407..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ /dev/null @@ -1,424 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx" -#include -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -// Ctor/Dtor/disposing -------------------------------------------------------- - -DBG_NAME( AccessibleBrowseBoxHeaderBar ) - -AccessibleBrowseBoxHeaderBar::AccessibleBrowseBoxHeaderBar( - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox, - AccessibleBrowseBoxObjType eObjType ) : - AccessibleBrowseBoxTableBase( rxParent, rBrowseBox,eObjType ) -{ - DBG_CTOR( AccessibleBrowseBoxHeaderBar, NULL ); - - DBG_ASSERT( isRowBar() || isColumnBar(), - "accessibility/extended/AccessibleBrowseBoxHeaderBar - invalid object type" ); -} - -AccessibleBrowseBoxHeaderBar::~AccessibleBrowseBoxHeaderBar() -{ - DBG_DTOR( AccessibleBrowseBoxHeaderBar, NULL ); -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBoxHeaderBar::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidHeaderIndex( nChildIndex ); - return implGetChild( nChildIndex, implToVCLColumnPos( nChildIndex ) ); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - return isRowBar() ? BBINDEX_ROWHEADERBAR : BBINDEX_COLUMNHEADERBAR; -} - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBoxHeaderBar::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - sal_Int32 nRow = 0; - sal_uInt16 nColumnPos = 0; - sal_Bool bConverted = isRowBar() ? - mpBrowseBox->ConvertPointToRowHeader( nRow, VCLPoint( rPoint ) ) : - mpBrowseBox->ConvertPointToColumnHeader( nColumnPos, VCLPoint( rPoint ) ); - - return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::grabFocus() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - // focus on header not supported -} - -Any SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); // no special key bindings for header -} - -// XAccessibleTable ----------------------------------------------------------- - -OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowDescription( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return OUString(); // no headers in headers -} - -OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return OUString(); // no headers in headers -} - -Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowHeaders() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // no headers in headers -} - -Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleColumnHeaders() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // no headers in headers -} - -Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleRows() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Sequence< sal_Int32 > aSelSeq; - // row of column header bar not selectable - if( isRowBar() ) - implGetSelectedRows( aSelSeq ); - return aSelSeq; -} - -Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleColumns() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Sequence< sal_Int32 > aSelSeq; - // column of row header bar ("handle column") not selectable - if( isColumnBar() ) - implGetSelectedColumns( aSelSeq ); - return aSelSeq; -} - -sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleRowSelected( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return isRowBar() ? implIsRowSelected( nRow ) : sal_False; -} - -sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return isColumnBar() ? implIsColumnSelected( nColumn ) : sal_False; -} - -Reference< XAccessible > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleCellAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return implGetChild( nRow, implToVCLColumnPos( nColumn ) ); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleSelected( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn ); -} - -// XAccessibleSelection ------------------------------------------------------- - -void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidHeaderIndex( nChildIndex ); - if( isRowBar() ) - implSelectRow( nChildIndex, sal_True ); - else - implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True ); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleChildSelected( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - // using interface methods - no mutex - return isRowBar() ? - isAccessibleRowSelected( nChildIndex ) : - isAccessibleColumnSelected( nChildIndex ); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::clearAccessibleSelection() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - mpBrowseBox->SetNoSelection(); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAllAccessibleChildren() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - // no multiselection of columns possible - if( isRowBar() ) - mpBrowseBox->SelectAll(); - else - implSelectColumn( implToVCLColumnPos( 0 ), sal_True ); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChildCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return isRowBar() ? implGetSelectedRowCount() : implGetSelectedColumnCount(); -} - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - // method may throw lang::IndexOutOfBoundsException - sal_Int32 nIndex = implGetChildIndexFromSelectedIndex( nSelectedChildIndex ); - return implGetChild( nIndex, implToVCLColumnPos( nIndex ) ); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::deselectAccessibleChild( - sal_Int32 nSelectedChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - // method may throw lang::IndexOutOfBoundsException - if ( isAccessibleChildSelected(nSelectedChildIndex) ) - { - if( isRowBar() ) - implSelectRow( nSelectedChildIndex, sal_False ); - else - implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False ); - } -} - -// XInterface ----------------------------------------------------------------- - -Any SAL_CALL AccessibleBrowseBoxHeaderBar::queryInterface( const uno::Type& rType ) - throw ( uno::RuntimeException ) -{ - Any aAny( AccessibleBrowseBoxTableBase::queryInterface( rType ) ); - return aAny.hasValue() ? - aAny : AccessibleBrowseBoxHeaderBarImplHelper::queryInterface( rType ); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::acquire() throw () -{ - AccessibleBrowseBoxTableBase::acquire(); -} - -void SAL_CALL AccessibleBrowseBoxHeaderBar::release() throw () -{ - AccessibleBrowseBoxTableBase::release(); -} - -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderBar" ) ); -} - -namespace -{ - class theAccessibleBrowseBoxHeaderBarImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxHeaderBarImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleBrowseBoxHeaderBarImplementationId::get().getSeq(); -} - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBox() -{ - return mpBrowseBox->calcHeaderRect(isColumnBar(),sal_False); -} - -Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBoxOnScreen() -{ - return mpBrowseBox->calcHeaderRect(isColumnBar(),sal_True); -} - -sal_Int32 AccessibleBrowseBoxHeaderBar::implGetRowCount() const -{ - // column header bar: only 1 row - return isRowBar() ? AccessibleBrowseBoxTableBase::implGetRowCount() : 1; -} - -sal_Int32 AccessibleBrowseBoxHeaderBar::implGetColumnCount() const -{ - // row header bar ("handle column"): only 1 column - return isColumnBar() ? AccessibleBrowseBoxTableBase::implGetColumnCount() : 1; -} - -// internal helper methods ---------------------------------------------------- - -Reference< XAccessible > AccessibleBrowseBoxHeaderBar::implGetChild( - sal_Int32 nRow, sal_uInt16 nColumnPos ) -{ - return isRowBar() ? - mpBrowseBox->CreateAccessibleRowHeader( nRow ) : - mpBrowseBox->CreateAccessibleColumnHeader( nColumnPos ); -} - -sal_Int32 AccessibleBrowseBoxHeaderBar::implGetChildIndexFromSelectedIndex( - sal_Int32 nSelectedChildIndex ) - throw ( lang::IndexOutOfBoundsException ) -{ - Sequence< sal_Int32 > aSelSeq; - if( isRowBar() ) - implGetSelectedRows( aSelSeq ); - else - implGetSelectedColumns( aSelSeq ); - - if( (nSelectedChildIndex < 0) || (nSelectedChildIndex >= aSelSeq.getLength()) ) - throw lang::IndexOutOfBoundsException(); - - return aSelSeq[ nSelectedChildIndex ]; -} - -void AccessibleBrowseBoxHeaderBar::ensureIsValidHeaderIndex( sal_Int32 nIndex ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( isRowBar() ) - ensureIsValidRow( nIndex ); - else - ensureIsValidColumn( nIndex ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx deleted file mode 100644 index 5ded893be..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx" -#include -#include "accessibility/extended/AccessibleBrowseBox.hxx" - -namespace accessibility -{ - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::uno; - using namespace ::svt; - -AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - AccessibleBrowseBoxObjType eObjType) -: BrowseBoxAccessibleElement(rxParent, - rBrowseBox, - _xFocusWindow, - eObjType, - rBrowseBox.GetAccessibleObjectName( eObjType ,_nColumnRowId), - rBrowseBox.GetAccessibleObjectDescription( eObjType ,_nColumnRowId)) -, m_nColumnRowId(_nColumnRowId) -{ -} -/** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. -*/ -::utl::AccessibleStateSetHelper* AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ::utl::AccessibleStateSetHelper* - pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - - SolarMutexGuard aSolarGuard; - pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); - pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); - pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - - sal_Bool bSelected = isRowBarCell() ? mpBrowseBox->IsRowSelected(m_nColumnRowId) : mpBrowseBox->IsColumnSelected(m_nColumnRowId); - if ( bSelected ) - pStateSetHelper->AddState( AccessibleStateType::SELECTED ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return pStateSetHelper; -} -// ----------------------------------------------------------------------------- -/** @return - The count of visible children. -*/ -sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChildCount() - throw ( RuntimeException ) -{ - return 0; -} -// ----------------------------------------------------------------------------- - -/** @return - The XAccessible interface of the specified child. -*/ -Reference SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChild( sal_Int32 ) - throw ( IndexOutOfBoundsException,RuntimeException ) -{ - throw IndexOutOfBoundsException(); -} -// ----------------------------------------------------------------------------- - -/** Grabs the focus to the column header. */ -void SAL_CALL AccessibleBrowseBoxHeaderCell::grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - if ( isRowBarCell() ) - mpBrowseBox->SelectRow(m_nColumnRowId); - else - mpBrowseBox->SelectColumn(static_cast(m_nColumnRowId)); //!!! -} -// ----------------------------------------------------------------------------- -/** @return - The name of this class. -*/ -::rtl::OUString SAL_CALL AccessibleBrowseBoxHeaderCell::getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderCell" ) ); -} -// ----------------------------------------------------------------------------- -namespace -{ - Rectangle getRectangle(IAccessibleTableProvider* _pBrowseBox,sal_Int32 _nRowColIndex, sal_Bool _bOnScreen,sal_Bool _bRowBar) - { - sal_Int32 nRow = 0; - sal_uInt16 nCol = (sal_uInt16)_nRowColIndex; - if ( _bRowBar ) - { - nRow = _nRowColIndex + 1; - nCol = 0; - } - - Rectangle aRet(_pBrowseBox->GetFieldRectPixelAbs( nRow , nCol, sal_True, _bOnScreen)); - return Rectangle(aRet.TopLeft() - Point(0,aRet.GetHeight()),aRet.GetSize()); - } -} - -Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox() -{ - return getRectangle(mpBrowseBox,m_nColumnRowId,sal_False,isRowBarCell()); -} -// ----------------------------------------------------------------------------- - -Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen() -{ - return getRectangle(mpBrowseBox,m_nColumnRowId,sal_True,isRowBarCell()); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent() - throw ( RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - sal_Int32 nIndex = m_nColumnRowId; - if ( mpBrowseBox->HasRowHeader() ) - --nIndex; - return nIndex; -} -// ----------------------------------------------------------------------------- -} // namespace accessibility -// ----------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx deleted file mode 100644 index a14a990e0..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleBrowseBoxTable.hxx" -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -// Ctor/Dtor/disposing -------------------------------------------------------- - -DBG_NAME( AccessibleBrowseBoxTable ) - -AccessibleBrowseBoxTable::AccessibleBrowseBoxTable( - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox ) : - AccessibleBrowseBoxTableBase( rxParent, rBrowseBox, BBTYPE_TABLE ) -{ - DBG_CTOR( AccessibleBrowseBoxTable, NULL ); -} - -AccessibleBrowseBoxTable::~AccessibleBrowseBoxTable() -{ - DBG_DTOR( AccessibleBrowseBoxTable, NULL ); -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBoxTable::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return mpBrowseBox->CreateAccessibleCell( - implGetRow( nChildIndex ), (sal_Int16)implGetColumn( nChildIndex ) ); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTable::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return BBINDEX_TABLE; -} - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Reference< XAccessible > xChild; - sal_Int32 nRow = 0; - sal_uInt16 nColumnPos = 0; - if( mpBrowseBox->ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) ) - xChild = mpBrowseBox->CreateAccessibleCell( nRow, nColumnPos ); - - return xChild; -} - -void SAL_CALL AccessibleBrowseBoxTable::grabFocus() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - mpBrowseBox->GrabTableFocus(); -} - -Any SAL_CALL AccessibleBrowseBoxTable::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); // no special key bindings for data table -} - -// XAccessibleTable ----------------------------------------------------------- - -OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowDescription( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return mpBrowseBox->GetRowDescription( nRow ); -} - -OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return mpBrowseBox->GetColumnDescription( (sal_uInt16)nColumn ); -} - -Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowHeaders() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetHeaderBar( BBINDEX_ROWHEADERBAR ); -} - -Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnHeaders() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetHeaderBar( BBINDEX_COLUMNHEADERBAR ); -} - -Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleRows() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Sequence< sal_Int32 > aSelSeq; - implGetSelectedRows( aSelSeq ); - return aSelSeq; -} - -Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleColumns() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Sequence< sal_Int32 > aSelSeq; - implGetSelectedColumns( aSelSeq ); - return aSelSeq; -} - -sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleRowSelected( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return implIsRowSelected( nRow ); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return implIsColumnSelected( nColumn ); -} - -Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTable::getAccessibleCellAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return mpBrowseBox->CreateAccessibleCell( nRow, (sal_Int16)nColumn ); -} - -sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleSelected( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn ); -} - -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleBrowseBoxTable::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxTable" ) ); -} - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleBrowseBoxTable::implGetBoundingBox() -{ - return mpBrowseBox->calcTableRect(sal_False); -} - -Rectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen() -{ - return mpBrowseBox->calcTableRect(); -} - -// internal helper methods ---------------------------------------------------- - -Reference< XAccessibleTable > AccessibleBrowseBoxTable::implGetHeaderBar( - sal_Int32 nChildIndex ) - throw ( uno::RuntimeException ) -{ - Reference< XAccessible > xRet; - Reference< XAccessibleContext > xContext( mxParent, uno::UNO_QUERY ); - if( xContext.is() ) - { - try - { - xRet = xContext->getAccessibleChild( nChildIndex ); - } - catch (const lang::IndexOutOfBoundsException&) - { - OSL_FAIL( "implGetHeaderBar - wrong child index" ); - } - // RuntimeException goes to caller - } - return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx deleted file mode 100644 index 7c8355f56..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx +++ /dev/null @@ -1,360 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx" -#include -#include -#include -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -// Ctor/Dtor/disposing -------------------------------------------------------- - -DBG_NAME( AccessibleBrowseBoxTableBase ) - -AccessibleBrowseBoxTableBase::AccessibleBrowseBoxTableBase( - const Reference< XAccessible >& rxParent, - IAccessibleTableProvider& rBrowseBox, - AccessibleBrowseBoxObjType eObjType ) : - BrowseBoxAccessibleElement( rxParent, rBrowseBox,NULL, eObjType ) -{ - DBG_CTOR( AccessibleBrowseBoxTableBase, NULL ); -} - -AccessibleBrowseBoxTableBase::~AccessibleBrowseBoxTableBase() -{ - DBG_DTOR( AccessibleBrowseBoxTableBase, NULL ); -} - -// XAccessibleContext --------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleChildCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetChildCount(); -} - -sal_Int16 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRole() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return AccessibleRole::TABLE; -} - -// XAccessibleTable ----------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetRowCount(); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetColumnCount(); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowExtentAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return 1; // merged cells not supported -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnExtentAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return 1; // merged cells not supported -} - -Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleCaption() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // not supported -} - -Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleSummary() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // not supported -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleIndex( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return implGetChildIndex( nRow, nColumn ); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRow( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return implGetRow( nChildIndex ); -} - -sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumn( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return implGetColumn( nChildIndex ); -} - -// XInterface ----------------------------------------------------------------- - -Any SAL_CALL AccessibleBrowseBoxTableBase::queryInterface( const uno::Type& rType ) - throw ( uno::RuntimeException ) -{ - Any aAny( BrowseBoxAccessibleElement::queryInterface( rType ) ); - return aAny.hasValue() ? - aAny : AccessibleBrowseBoxTableImplHelper::queryInterface( rType ); -} - -void SAL_CALL AccessibleBrowseBoxTableBase::acquire() throw () -{ - BrowseBoxAccessibleElement::acquire(); -} - -void SAL_CALL AccessibleBrowseBoxTableBase::release() throw () -{ - BrowseBoxAccessibleElement::release(); -} - -// XTypeProvider -------------------------------------------------------------- - -Sequence< uno::Type > SAL_CALL AccessibleBrowseBoxTableBase::getTypes() - throw ( uno::RuntimeException ) -{ - return ::comphelper::concatSequences( - BrowseBoxAccessibleElement::getTypes(), - AccessibleBrowseBoxTableImplHelper::getTypes() ); -} - -namespace -{ - class theAccessibleBrowseBoxTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleBrowseBoxTableBaseImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxTableBase::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleBrowseBoxTableBaseImplementationId::get().getSeq(); -} - -// internal virtual methods --------------------------------------------------- - -sal_Int32 AccessibleBrowseBoxTableBase::implGetRowCount() const -{ - return mpBrowseBox->GetRowCount(); -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetColumnCount() const -{ - sal_uInt16 nColumns = mpBrowseBox->GetColumnCount(); - // do not count the "handle column" - if( nColumns && implHasHandleColumn() ) - --nColumns; - return nColumns; -} - -// internal helper methods ---------------------------------------------------- - -sal_Bool AccessibleBrowseBoxTableBase::implHasHandleColumn() const -{ - return mpBrowseBox->HasRowHeader(); -} - -sal_uInt16 AccessibleBrowseBoxTableBase::implToVCLColumnPos( sal_Int32 nColumn ) const -{ - sal_uInt16 nVCLPos = 0; - if( (0 <= nColumn) && (nColumn < implGetColumnCount()) ) - { - // regard "handle column" - if( implHasHandleColumn() ) - ++nColumn; - nVCLPos = static_cast< sal_uInt16 >( nColumn ); - } - return nVCLPos; -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetChildCount() const -{ - return implGetRowCount() * implGetColumnCount(); -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetRow( sal_Int32 nChildIndex ) const -{ - sal_Int32 nColumns = implGetColumnCount(); - return nColumns ? (nChildIndex / nColumns) : 0; -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetColumn( sal_Int32 nChildIndex ) const -{ - sal_Int32 nColumns = implGetColumnCount(); - return nColumns ? (nChildIndex % nColumns) : 0; -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetChildIndex( - sal_Int32 nRow, sal_Int32 nColumn ) const -{ - return nRow * implGetColumnCount() + nColumn; -} - -sal_Bool AccessibleBrowseBoxTableBase::implIsRowSelected( sal_Int32 nRow ) const -{ - return mpBrowseBox->IsRowSelected( nRow ); -} - -sal_Bool AccessibleBrowseBoxTableBase::implIsColumnSelected( sal_Int32 nColumn ) const -{ - if( implHasHandleColumn() ) - --nColumn; - return mpBrowseBox->IsColumnSelected( nColumn ); -} - -void AccessibleBrowseBoxTableBase::implSelectRow( sal_Int32 nRow, sal_Bool bSelect ) -{ - mpBrowseBox->SelectRow( nRow, bSelect, sal_True ); -} - -void AccessibleBrowseBoxTableBase::implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect ) -{ - mpBrowseBox->SelectColumn( (sal_uInt16)nColumnPos, bSelect ); -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetSelectedRowCount() const -{ - return mpBrowseBox->GetSelectedRowCount(); -} - -sal_Int32 AccessibleBrowseBoxTableBase::implGetSelectedColumnCount() const -{ - return mpBrowseBox->GetSelectedColumnCount(); -} - -void AccessibleBrowseBoxTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq ) -{ - mpBrowseBox->GetAllSelectedRows( rSeq ); -} - -void AccessibleBrowseBoxTableBase::implGetSelectedColumns( Sequence< sal_Int32 >& rSeq ) -{ - mpBrowseBox->GetAllSelectedColumns( rSeq ); -} - -void AccessibleBrowseBoxTableBase::ensureIsValidRow( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( nRow >= implGetRowCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); -} - -void AccessibleBrowseBoxTableBase::ensureIsValidColumn( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( nColumn >= implGetColumnCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); -} - -void AccessibleBrowseBoxTableBase::ensureIsValidAddress( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException ) -{ - ensureIsValidRow( nRow ); - ensureIsValidColumn( nColumn ); -} - -void AccessibleBrowseBoxTableBase::ensureIsValidIndex( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( nChildIndex >= implGetChildCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx deleted file mode 100644 index 88c4251c1..000000000 --- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx" -#include -#include "accessibility/extended/AccessibleBrowseBox.hxx" -#include -#include -#include - -namespace accessibility -{ - namespace - { - static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - if ( _nIndex >= _sText.getLength() ) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - - static sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) - { - return _nRow * _nColumnCount + _nColumn; - } - } - using namespace ::com::sun::star::lang; - using namespace utl; - using namespace comphelper; - using ::rtl::OUString; - using ::accessibility::AccessibleBrowseBox; - using namespace ::com::sun::star::uno; - using ::com::sun::star::accessibility::XAccessible; - using namespace ::com::sun::star::accessibility; - using namespace ::svt; - - - // implementation of a table cell - ::rtl::OUString AccessibleBrowseBoxTableCell::implGetText() - { - ensureIsAlive(); - return mpBrowseBox->GetAccessibleCellText( getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - } - - ::com::sun::star::lang::Locale AccessibleBrowseBoxTableCell::implGetLocale() - { - ensureIsAlive(); - return mpBrowseBox->GetAccessible()->getAccessibleContext()->getLocale(); - } - - void AccessibleBrowseBoxTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } - - AccessibleBrowseBoxTableCell::AccessibleBrowseBoxTableCell(const Reference& _rxParent, - IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - sal_Int32 _nOffset ) - :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos ) - { - m_nOffset = ( OFFSET_DEFAULT == _nOffset ) ? (sal_Int32)BBINDEX_FIRSTCONTROL : _nOffset; - sal_Int32 nIndex = getIndex_Impl( _nRowPos, _nColPos, _rBrowseBox.GetColumnCount() ); - setAccessibleName( _rBrowseBox.GetAccessibleObjectName( BBTYPE_TABLECELL, nIndex ) ); - setAccessibleDescription( _rBrowseBox.GetAccessibleObjectDescription( BBTYPE_TABLECELL, nIndex ) ); - // Need to register as event listener - Reference< XComponent > xComponent(_rxParent, UNO_QUERY); - if( xComponent.is() ) - xComponent->addEventListener(static_cast< XEventListener *> (this)); - } - - void AccessibleBrowseBoxTableCell::nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName ) - { - implSetName( rNewName ); - Any aOldValue, aNewValue; - aOldValue <<= rOldName; - aNewValue <<= rNewName; - commitEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL AccessibleBrowseBoxTableCell::queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ) - { - Any aRet = AccessibleBrowseBoxCell::queryInterface(rType); - if ( !aRet.hasValue() ) - aRet = AccessibleTextHelper_BASE::queryInterface(rType); - return aRet; - } - - /** Aquires the object (calls acquire() on base class). */ - void SAL_CALL AccessibleBrowseBoxTableCell::acquire() throw () - { - AccessibleBrowseBoxCell::acquire(); - } - - /** Releases the object (calls release() on base class). */ - void SAL_CALL AccessibleBrowseBoxTableCell::release() throw () - { - AccessibleBrowseBoxCell::release(); - } - - ::com::sun::star::awt::Rectangle SAL_CALL AccessibleBrowseBoxTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - ::com::sun::star::awt::Rectangle aRect; - - if ( mpBrowseBox ) - { - aRect = AWTRectangle( mpBrowseBox->GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) ); - } - - return aRect; - } - - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException) - { - //! TODO CTL bidi - // DBG_ASSERT(0,"Need to be done by base class!"); - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - return mpBrowseBox->GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) ); - } - - /** @return - The name of this class. - */ - ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxTableCell" ) ); - } - - /** @return The count of visible children. */ - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ) - { - return 0; - } - - /** @return The XAccessible interface of the specified child. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - AccessibleBrowseBoxTableCell::getAccessibleChild( sal_Int32 ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ) - { - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxTableCell::implCreateStateSetHelper() - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - - mpBrowseBox->FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return pStateSetHelper; - } - - - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleContext() throw ( RuntimeException ) - { - ensureIsAlive(); - return this; - } - - // XAccessibleContext ----------------------------------------------------- - - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - return /*BBINDEX_FIRSTCONTROL*/ m_nOffset + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos(); - } - - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) - { - return -1; - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - sal_Unicode SAL_CALL AccessibleBrowseBoxTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getCharacter( nIndex ); - } - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleBrowseBoxTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getCharacterCount( ); - } - - ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectedText( ); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectionStart( ); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectionEnd( ); - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getText( ); - } - ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ::rtl::OUString sText = implGetText(); - checkIndex_Impl( nStartIndex, sText ); - checkIndex_Impl( nEndIndex, sText ); - - //!!! don't know how to put a string into the clipboard - return sal_False; - } - void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException) - { - if ( _rSource.Source == mxParent ) - { - dispose(); - } - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx deleted file mode 100644 index dc5f45661..000000000 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/AccessibleGridControl.hxx" -#include "accessibility/extended/AccessibleGridControlTable.hxx" -#include "accessibility/extended/AccessibleGridControlHeader.hxx" -#include -#include -#include - -// ============================================================================ - -namespace accessibility -{ - -// ============================================================================ - -using ::rtl::OUString; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; -using namespace ::svt::table; - -// ============================================================================ -class AccessibleGridControl_Impl -{ -public: - /// the XAccessible which created the AccessibleGridControl - WeakReference< XAccessible > m_aCreator; - - /** The data table child. */ - Reference< - ::com::sun::star::accessibility::XAccessible > m_xTable; - AccessibleGridControlTable* m_pTable; - - /** The header bar for rows. */ - Reference< - ::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar; - AccessibleGridControlHeader* m_pRowHeaderBar; - - /** The header bar for columns (first row of the table). */ - Reference< - ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar; - AccessibleGridControlHeader* m_pColumnHeaderBar; -}; - -DBG_NAME( AccessibleGridControl ) - -AccessibleGridControl::AccessibleGridControl( - const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator, - IAccessibleTable& _rTable ) - : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL ) -{ - m_pImpl.reset( new AccessibleGridControl_Impl() ); - m_pImpl->m_aCreator = _rxCreator; -} - -// ----------------------------------------------------------------------------- -AccessibleGridControl::~AccessibleGridControl() -{ -} -// ----------------------------------------------------------------------------- - -void SAL_CALL AccessibleGridControl::disposing() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - - m_pImpl->m_pTable = NULL; - m_pImpl->m_pColumnHeaderBar = NULL; - m_pImpl->m_pRowHeaderBar = NULL; - m_pImpl->m_aCreator = Reference< XAccessible >(); - - Reference< XAccessible > xTable = m_pImpl->m_xTable; - - Reference< XComponent > xComp( m_pImpl->m_xTable, UNO_QUERY ); - if ( xComp.is() ) - { - xComp->dispose(); - } - - AccessibleGridControlBase::disposing(); -} -// ----------------------------------------------------------------------------- - -// XAccessibleContext --------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleGridControl::getAccessibleChildCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_aTable.GetAccessibleControlCount(); -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - if (isAlive()) - { - if(nChildIndex == 0 && m_aTable.HasColHeader()) - { - if(!m_pImpl->m_xColumnHeaderBar.is()) - { - AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR); - m_pImpl->m_xColumnHeaderBar = pColHeaderBar; - } - xChild = m_pImpl->m_xColumnHeaderBar; - } - else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0)) - { - if(!m_pImpl->m_xRowHeaderBar.is()) - { - AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR); - m_pImpl->m_xRowHeaderBar = pRowHeaderBar; - } - xChild = m_pImpl->m_xRowHeaderBar; - } - else - { - AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE); - m_pImpl->m_xTable = pTable; - xChild = m_pImpl->m_xTable; - } - } - return xChild; -} -// ----------------------------------------------------------------------------- - -sal_Int16 SAL_CALL AccessibleGridControl::getAccessibleRole() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return AccessibleRole::PANEL; -} -// ----------------------------------------------------------------------------- - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Reference< XAccessible > xChild; - sal_Int32 nIndex = 0; - if( m_aTable.ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) ) - xChild = m_aTable.CreateAccessibleControl( nIndex ); - else - { - // try whether point is in one of the fixed children - // (table, header bars, corner control) - Point aPoint( VCLPoint( rPoint ) ); - for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex ) - { - Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); - Reference< XAccessibleComponent > - xCurrChildComp( xCurrChild, uno::UNO_QUERY ); - - if( xCurrChildComp.is() && - VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) ) - xChild = xCurrChild; - } - } - return xChild; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL AccessibleGridControl::grabFocus() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - m_aTable.GrabFocus(); -} -// ----------------------------------------------------------------------------- - -Any SAL_CALL AccessibleGridControl::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); -} -// ----------------------------------------------------------------------------- - -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleGridControl::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControl" ) ); -} -// ----------------------------------------------------------------------------- - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleGridControl::implGetBoundingBox() -{ - Window* pParent = m_aTable.GetAccessibleParentWindow(); - DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); - return m_aTable.GetWindowExtentsRelative( pParent ); -} -// ----------------------------------------------------------------------------- - -Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen() -{ - return m_aTable.GetWindowExtentsRelative( NULL ); -} -// internal helper methods ---------------------------------------------------- - -Reference< XAccessible > AccessibleGridControl::implGetTable() -{ - if( !m_pImpl->m_xTable.is() ) - { - m_pImpl->m_pTable = createAccessibleTable(); - m_pImpl->m_xTable = m_pImpl->m_pTable; - } - return m_pImpl->m_xTable; -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > -AccessibleGridControl::implGetHeaderBar( AccessibleTableControlObjType eObjType ) -{ - Reference< XAccessible > xRet; - Reference< XAccessible >* pxMember = NULL; - - if( eObjType == TCTYPE_ROWHEADERBAR ) - pxMember = &m_pImpl->m_xRowHeaderBar; - else if( eObjType == TCTYPE_COLUMNHEADERBAR ) - pxMember = &m_pImpl->m_xColumnHeaderBar; - - if( pxMember ) - { - if( !pxMember->is() ) - { - AccessibleGridControlHeader* pHeaderBar = new AccessibleGridControlHeader( - (Reference< XAccessible >)m_pImpl->m_aCreator, m_aTable, eObjType ); - - if ( TCTYPE_COLUMNHEADERBAR == eObjType) - m_pImpl->m_pColumnHeaderBar = pHeaderBar; - else - m_pImpl->m_pRowHeaderBar = pHeaderBar; - - *pxMember = pHeaderBar; - } - xRet = *pxMember; - } - return xRet; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > -AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex ) -{ - Reference< XAccessible > xRet; - switch( nChildIndex ) - { - case TCINDEX_COLUMNHEADERBAR: - xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR ); - break; - case TCINDEX_ROWHEADERBAR: - xRet = implGetHeaderBar( TCTYPE_ROWHEADERBAR ); - break; - case TCINDEX_TABLE: - xRet = implGetTable(); - break; - } - return xRet; -} -// ----------------------------------------------------------------------------- -AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable() -{ - Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; - DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" ); - return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE ); -} -// ============================================================================ -// = AccessibleGridControlAccess -// ============================================================================ -DBG_NAME( AccessibleGridControlAccess ) -// ----------------------------------------------------------------------------- -AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) - :m_xParent( _rxParent ) - ,m_rTable( _rTable ) - ,m_pContext( NULL ) -{ -} - -// ----------------------------------------------------------------------------- -AccessibleGridControlAccess::~AccessibleGridControlAccess() -{ -} - -// ----------------------------------------------------------------------------- -void AccessibleGridControlAccess::dispose() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - m_pContext = NULL; - ::comphelper::disposeComponent( m_xContext ); -} - -// ----------------------------------------------------------------------------- -Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessibleContext() throw ( RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ), - "accessibility/extended/AccessibleGridControlAccess::getAccessibleContext: inconsistency!" ); - - // if the context died meanwhile (we're no listener, so it won't tell us explicitily when this happens), - // then reset an re-create. - if ( m_pContext && !m_pContext->isAlive() ) - m_xContext = m_pContext = NULL; - - if ( !m_xContext.is() ) - m_xContext = m_pContext = new AccessibleGridControl( m_xParent, this, m_rTable ); - - return m_xContext; -} - -// ----------------------------------------------------------------------------- -bool AccessibleGridControlAccess::isContextAlive() const -{ - return ( NULL != m_pContext ) && m_pContext->isAlive(); -} - -// ============================================================================ - -} // namespace accessibility - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx deleted file mode 100644 index cdf0db3cb..000000000 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ /dev/null @@ -1,529 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/AccessibleGridControlBase.hxx" -#include -#include -// -#include -#include -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; -using namespace ::svt; -using namespace ::svt::table; - - -// ============================================================================ - -namespace accessibility { - -using namespace com::sun::star::accessibility::AccessibleStateType; -// ============================================================================ - -DBG_NAME( AccessibleGridControlBase ) - -AccessibleGridControlBase::AccessibleGridControlBase( - const Reference< XAccessible >& rxParent, - svt::table::IAccessibleTable& rTable, - AccessibleTableControlObjType eObjType ) : - AccessibleGridControlImplHelper( m_aMutex ), - m_xParent( rxParent ), - m_aTable( rTable), - m_eObjType( eObjType ), - m_aName( rTable.GetAccessibleObjectName( eObjType, 0, 0 ) ), - m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ), - m_aClientId(0) -{ -} - -AccessibleGridControlBase::~AccessibleGridControlBase() -{ - if( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } -} - -void SAL_CALL AccessibleGridControlBase::disposing() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - m_xParent = NULL; -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_xParent; -} - -sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - // -1 for child not found/no parent (according to specification) - sal_Int32 nRet = -1; - - Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY ); - - // iterate over parent's children and search for this object - if( m_xParent.is() ) - { - Reference< XAccessibleContext > - xParentContext( m_xParent->getAccessibleContext() ); - if( xParentContext.is() ) - { - Reference< uno::XInterface > xChild; - - sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); - for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild ) - { - xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) ); - if ( xMeMyselfAndI.get() == xChild.get() ) - { - nRet = nChild; - break; - } - } - } - } - return nRet; -} - -OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_aDescription; -} - -OUString SAL_CALL AccessibleGridControlBase::getAccessibleName() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_aName; -} - -Reference< XAccessibleRelationSet > SAL_CALL -AccessibleGridControlBase::getAccessibleRelationSet() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - // GridControl does not have relations. - return new utl::AccessibleRelationSetHelper; -} - -Reference< XAccessibleStateSet > SAL_CALL -AccessibleGridControlBase::getAccessibleStateSet() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - // don't check whether alive -> StateSet may contain DEFUNC - return implCreateStateSetHelper(); -} - -lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() - throw ( IllegalAccessibleComponentStateException, uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - if( m_xParent.is() ) - { - Reference< XAccessibleContext > - xParentContext( m_xParent->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); - } - throw IllegalAccessibleComponentStateException(); -} - -// XAccessibleComponent ------------------------------------------------------- - -sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); -} - -awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds() - throw ( uno::RuntimeException ) -{ - return AWTRectangle( getBoundingBox() ); -} - -awt::Point SAL_CALL AccessibleGridControlBase::getLocation() - throw ( uno::RuntimeException ) -{ - return AWTPoint( getBoundingBox().TopLeft() ); -} - -awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen() - throw ( uno::RuntimeException ) -{ - return AWTPoint( getBoundingBoxOnScreen().TopLeft() ); -} - -awt::Size SAL_CALL AccessibleGridControlBase::getSize() - throw ( uno::RuntimeException ) -{ - return AWTSize( getBoundingBox().GetSize() ); -} - -sal_Bool SAL_CALL AccessibleGridControlBase::isShowing() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implIsShowing(); -} - -sal_Bool SAL_CALL AccessibleGridControlBase::isVisible() - throw ( uno::RuntimeException ) -{ - Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); - return xStateSet.is() ? - xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False; -} - -sal_Bool SAL_CALL AccessibleGridControlBase::isFocusTraversable() - throw ( uno::RuntimeException ) -{ - Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); - return xStateSet.is() ? - xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False; -} -// XAccessibleEventBroadcaster ------------------------------------------------ - -void SAL_CALL AccessibleGridControlBase::addEventListener( - const Reference< XAccessibleEventListener>& _rxListener ) - throw ( uno::RuntimeException ) -{ - if ( _rxListener.is() ) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - if ( !getClientId( ) ) - setClientId( AccessibleEventNotifier::registerClient( ) ); - - AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener ); - } -} - -void SAL_CALL AccessibleGridControlBase::removeEventListener( - const Reference< XAccessibleEventListener>& _rxListener ) - throw ( uno::RuntimeException ) -{ - if( _rxListener.is() && getClientId( ) ) - { - ::osl::MutexGuard aGuard( getOslMutex() ); - sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - AccessibleEventNotifier::TClientId nId( getClientId( ) ); - setClientId( 0 ); - AccessibleEventNotifier::revokeClient( nId ); - } - } -} - -// XTypeProvider -------------------------------------------------------------- - -namespace -{ - class theAccessibleGridControlBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlBaseImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleGridControlBaseImplementationId::get().getSeq(); -} - -// XServiceInfo --------------------------------------------------------------- - -sal_Bool SAL_CALL AccessibleGridControlBase::supportsService( - const OUString& rServiceName ) - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - const OUString* pArrBegin = aSupportedServices.getConstArray(); - const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength(); - const OUString* pString = pArrBegin; - - for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString ) - ; - return pString != pArrEnd; -} - -Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames() - throw ( uno::RuntimeException ) -{ - const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) ); - return Sequence< OUString >( &aServiceName, 1 ); -} -// internal virtual methods --------------------------------------------------- - -sal_Bool AccessibleGridControlBase::implIsShowing() -{ - sal_Bool bShowing = sal_False; - if( m_xParent.is() ) - { - Reference< XAccessibleComponent > - xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = implGetBoundingBox().IsOver( - VCLRectangle( xParentComp->getBounds() ) ); - } - return bShowing; -} - -::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper() -{ - ::utl::AccessibleStateSetHelper* - pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with m_xParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - // GridControl fills StateSet with states depending on object type - m_aTable.FillAccessibleStateSet( *pStateSetHelper, getType() ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - return pStateSetHelper; -} - -// internal helper methods ---------------------------------------------------- - -sal_Bool AccessibleGridControlBase::isAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable; -} - -void AccessibleGridControlBase::ensureIsAlive() const - throw ( lang::DisposedException ) -{ - if( !isAlive() ) - throw lang::DisposedException(); -} - -Rectangle AccessibleGridControlBase::getBoundingBox() - throw ( lang::DisposedException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Rectangle aRect = implGetBoundingBox(); - if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) - { - DBG_ERRORFILE( "rectangle doesn't exist" ); - } - return aRect; -} - -Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() - throw ( lang::DisposedException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Rectangle aRect = implGetBoundingBoxOnScreen(); - if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) - { - DBG_ERRORFILE( "rectangle doesn't exist" ); - } - return aRect; -} - -void AccessibleGridControlBase::commitEvent( - sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) -{ - ::osl::ClearableMutexGuard aGuard( getOslMutex() ); - if ( !getClientId( ) ) - // if we don't have a client id for the notifier, then we don't have listeners, then - // we don't need to notify anything - return; - - // build an event object - AccessibleEventObject aEvent; - aEvent.Source = *this; - aEvent.EventId = _nEventId; - aEvent.OldValue = _rOldValue; - aEvent.NewValue = _rNewValue; - - // let the notifier handle this event - - AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); -} - -sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - sal_Int16 nRole = AccessibleRole::UNKNOWN; - switch ( m_eObjType ) - { - case TCTYPE_ROWHEADERCELL: - nRole = AccessibleRole::ROW_HEADER; - break; - case TCTYPE_COLUMNHEADERCELL: - nRole = AccessibleRole::COLUMN_HEADER; - break; - case TCTYPE_COLUMNHEADERBAR: - case TCTYPE_ROWHEADERBAR: - case TCTYPE_TABLE: - nRole = AccessibleRole::TABLE; - break; - case TCTYPE_TABLECELL: - nRole = AccessibleRole::TABLE_CELL; - break; - case TCTYPE_GRIDCONTROL: - nRole = AccessibleRole::PANEL; - break; - } - return nRole; -} -// ----------------------------------------------------------------------------- -Any SAL_CALL AccessibleGridControlBase::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - return Any(); -} -// ----------------------------------------------------------------------------- -Reference SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& ) - throw ( uno::RuntimeException ) -{ - return NULL; -} -//// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - sal_Int32 nColor = 0; - Window* pInst = m_aTable.GetWindowInstance(); - if ( pInst ) - { - if ( pInst->IsControlForeground() ) - nColor = pInst->GetControlForeground().GetColor(); - else - { - Font aFont; - if ( pInst->IsControlFont() ) - aFont = pInst->GetControlFont(); - else - aFont = pInst->GetFont(); - nColor = aFont.GetColor().GetColor(); - } - } - return nColor; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - sal_Int32 nColor = 0; - Window* pInst = m_aTable.GetWindowInstance(); - if ( pInst ) - { - if ( pInst->IsControlBackground() ) - nColor = pInst->GetControlBackground().GetColor(); - else - nColor = pInst->GetBackground().GetColor().GetColor(); - } - return nColor; -} - -//// ============================================================================ -GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent, - IAccessibleTable& rTable, - AccessibleTableControlObjType eObjType ) - :AccessibleGridControlBase( rxParent, rTable, eObjType ) -{ -} - -// XInterface ----------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base) - -// XTypeProvider -------------------------------------------------------------- -IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base ) - -// XAccessible ---------------------------------------------------------------- - -Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return this; -} -// ---------------------------------------------------------------------------- -GridControlAccessibleElement::~GridControlAccessibleElement( ) -{ -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx deleted file mode 100644 index 66841796c..000000000 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ /dev/null @@ -1,289 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleGridControlHeader.hxx" -#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" -#include "accessibility/extended/AccessibleGridControlTableCell.hxx" -#include -#include - - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; -using namespace ::svt::table; - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -DBG_NAME( AccessibleGridControlHeader ) - -AccessibleGridControlHeader::AccessibleGridControlHeader( - const Reference< XAccessible >& rxParent, - ::svt::table::IAccessibleTable& rTable, - ::svt::table::AccessibleTableControlObjType eObjType): - AccessibleGridControlTableBase( rxParent, rTable, eObjType ) -{ - DBG_ASSERT( isRowBar() || isColumnBar(), - "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" ); -} - -AccessibleGridControlHeader::~AccessibleGridControlHeader() -{ -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) - throw IndexOutOfBoundsException(); - ensureIsAlive(); - Reference< XAccessible > xChild; - if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR) - { - AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL); - xChild = pColHeaderCell; - } - else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR) - { - AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL); - xChild = pRowHeaderCell; - } - return xChild; -} - -sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader()) - return 1; - else - return 0; -} - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - sal_Int32 nRow = 0; - sal_Int32 nColumnPos = 0; - sal_Bool bConverted = isRowBar() ? - m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) : - m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ); - - return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); -} - -void SAL_CALL AccessibleGridControlHeader::grabFocus() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - // focus on header not supported -} - -Any SAL_CALL AccessibleGridControlHeader::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); // no special key bindings for header -} - -// XAccessibleTable ----------------------------------------------------------- - -OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return OUString(); // no headers in headers -} - -OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return OUString(); // no headers in headers -} - -Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // no headers in headers -} - -Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // no headers in headers -} -//not selectable -Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows() - throw ( uno::RuntimeException ) -{ - Sequence< sal_Int32 > aSelSeq(0); - return aSelSeq; -} -//columns aren't selectable -Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns() - throw ( uno::RuntimeException ) -{ - Sequence< sal_Int32 > aSelSeq(0); - return aSelSeq; -} -//row headers not selectable -sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - return sal_False; -} -//columns aren't selectable -sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - (void)nColumn; - return sal_False; -} -//not implemented -Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt( - sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - return NULL; -} -// not selectable -sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected( - sal_Int32 /*nRow*/, sal_Int32 /*nColumn */) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - return sal_False; -} - -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleGridControlHeader::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) ); -} - -namespace -{ - class theAccessibleGridControlHeaderImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlHeaderImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleGridControlHeaderImplementationId::get().getSeq(); -} - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleGridControlHeader::implGetBoundingBox() -{ - return m_aTable.calcHeaderRect(isColumnBar()); -} - -Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() -{ - return m_aTable.calcHeaderRect(isColumnBar()); -} - -sal_Int32 AccessibleGridControlHeader::implGetRowCount() const -{ - return 1; -} - -sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const -{ - return 1; -} - -// internal helper methods ---------------------------------------------------- - -Reference< XAccessible > AccessibleGridControlHeader::implGetChild( - sal_Int32 nRow, sal_uInt32 nColumnPos ) -{ - Reference< XAccessible > xChild; - if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR) - { - AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL); - xChild = pColHeaderCell; - } - else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR) - { - AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL); - xChild = pRowHeaderCell; - } - return xChild; -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx deleted file mode 100644 index 671668ddc..000000000 --- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" -#include -#include "accessibility/extended/AccessibleGridControl.hxx" - -namespace accessibility -{ - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::uno; - using namespace ::svt; - using namespace ::svt::table; - -AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, - const Reference< XAccessible >& rxParent, - IAccessibleTable& rTable, - AccessibleTableControlObjType eObjType) -: AccessibleGridControlCell( rxParent, rTable, _nColumnRowId, 0, eObjType) -, m_nColumnRowId(_nColumnRowId) -{ -} -/** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. -*/ -::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper() -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ::utl::AccessibleStateSetHelper* - pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - - SolarMutexGuard aSolarGuard; - pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); - pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); - pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - - if ( m_aTable.IsRowSelected(m_nColumnRowId) ) - pStateSetHelper->AddState( AccessibleStateType::SELECTED ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return pStateSetHelper; -} -// ----------------------------------------------------------------------------- -/** @return - The count of visible children. -*/ -sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChildCount() - throw ( RuntimeException ) -{ - return 0; -} -// ----------------------------------------------------------------------------- - -/** @return - The XAccessible interface of the specified child. -*/ -Reference SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChild( sal_Int32 ) - throw ( IndexOutOfBoundsException,RuntimeException ) -{ - throw IndexOutOfBoundsException(); -} -// XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlHeaderCell::queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ) - { - Any aRet = AccessibleGridControlCell::queryInterface(rType); - return aRet; - } - - /** Aquires the object (calls acquire() on base class). */ - void SAL_CALL AccessibleGridControlHeaderCell::acquire() throw () - { - AccessibleGridControlCell::acquire(); - } - - /** Releases the object (calls release() on base class). */ - void SAL_CALL AccessibleGridControlHeaderCell::release() throw () - { - AccessibleGridControlCell::release(); - } - /** @return The XAccessibleContext interface of this object. */ - Reference< com::sun::star::accessibility::XAccessibleContext > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleContext() throw ( RuntimeException ) - { - ensureIsAlive(); - return this; - } - -// ----------------------------------------------------------------------------- - -/** Grabs the focus to the column header. */ -void SAL_CALL AccessibleGridControlHeaderCell::grabFocus() - throw ( ::com::sun::star::uno::RuntimeException ) -{ -} -// ----------------------------------------------------------------------------- -/** @return - The name of this class. -*/ -::rtl::OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeaderCell" ) ); -} -// ----------------------------------------------------------------------------- -Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox() -{ - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle -} -// ----------------------------------------------------------------------------- - -Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() -{ - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent() - throw ( RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - sal_Int32 nIndex = m_nColumnRowId; - return nIndex; -} -// ----------------------------------------------------------------------------- -} // namespace accessibility -// ----------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx deleted file mode 100644 index 671277cbf..000000000 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ /dev/null @@ -1,378 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleGridControlTable.hxx" -#include "accessibility/extended/AccessibleGridControlTableCell.hxx" -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; -using namespace ::svt::table; -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -DBG_NAME( AccessibleGridControlTable ) - -AccessibleGridControlTable::AccessibleGridControlTable( - const Reference< XAccessible >& rxParent, - IAccessibleTable& rTable, - AccessibleTableControlObjType _eType) : - AccessibleGridControlTableBase( rxParent, rTable, _eType ) -{ -} - -AccessibleGridControlTable::~AccessibleGridControlTable() -{ -} - -// XAccessibleContext --------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL); -} - -sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - if(m_aTable.HasRowHeader() && m_aTable.HasColHeader()) - return 0; - else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) ) - return 1; - else - return 2; -} - -// XAccessibleComponent ------------------------------------------------------- - -Reference< XAccessible > SAL_CALL -AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - Reference< XAccessible > xChild; - sal_Int32 nRow = 0; - sal_Int32 nColumnPos = 0; - if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) ) - xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL); - - return xChild; -} - -void SAL_CALL AccessibleGridControlTable::grabFocus() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - m_aTable.GrabFocus(); -} - -Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return Any(); // no special key bindings for data table -} - -// XAccessibleTable ----------------------------------------------------------- - -OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - return m_aTable.GetRowDescription( nRow ); -} - -OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidColumn( nColumn ); - return m_aTable.GetColumnDescription( (sal_uInt16)nColumn ); -} - -Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - if(m_aTable.HasColHeader()) - return implGetHeaderBar( 1 ); - else - return implGetHeaderBar( 0 ); -} - -Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders() - throw ( uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return implGetHeaderBar( 0 ); -} - -Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Sequence< sal_Int32 > aSelSeq; - implGetSelectedRows( aSelSeq ); - return aSelSeq; -} - -//columns aren't selectable -Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns() - throw ( uno::RuntimeException ) -{ - Sequence< sal_Int32 > aSelSeq(0); - return aSelSeq; -} - -sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidRow( nRow ); - sal_Bool bSelected = sal_False; - Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); - for(int i=0; i SAL_CALL AccessibleGridControlTable::getAccessibleCellAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL); -} - -sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - (void) nColumn; - //selection of single cells not possible, so if row is selected, the cell will be selected too - return isAccessibleRowSelected(nRow); -} -void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - sal_Int32 nColumns = m_aTable.GetColumnCount(); - sal_Int32 nRow = (nChildIndex / nColumns); - m_aTable.SelectRow( nRow, sal_True ); -} -sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - sal_Int32 nColumns = m_aTable.GetColumnCount(); - sal_Int32 nRow = (nChildIndex / nColumns); - return isAccessibleRowSelected(nRow); -} -void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - m_aTable.SelectAllRows( false ); -} -void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows(); - for(int i=0;i selectedRows = getSelectedAccessibleRows(); - sal_Int32 nColumns = m_aTable.GetColumnCount(); - return selectedRows.getLength()*nColumns; -} -Reference< XAccessible > SAL_CALL -AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - if(isAccessibleChildSelected(nSelectedChildIndex)) - return getAccessibleChild(nSelectedChildIndex); - else - return NULL; -} -//not implemented yet, because only row selection possible -void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( - sal_Int32 nSelectedChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - (void)nSelectedChildIndex; -} -// XInterface ----------------------------------------------------------------- - -Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType ) - throw ( uno::RuntimeException ) -{ - Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) ); - return aAny.hasValue() ? - aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType ); -} - -void SAL_CALL AccessibleGridControlTable::acquire() throw () -{ - AccessibleGridControlTableBase::acquire(); -} - -void SAL_CALL AccessibleGridControlTable::release() throw () -{ - AccessibleGridControlTableBase::release(); -} -// XServiceInfo --------------------------------------------------------------- - -OUString SAL_CALL AccessibleGridControlTable::getImplementationName() - throw ( uno::RuntimeException ) -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) ); -} - -// internal virtual methods --------------------------------------------------- - -Rectangle AccessibleGridControlTable::implGetBoundingBox() -{ - return m_aTable.calcTableRect(); -} - -Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() -{ - return m_aTable.calcTableRect(); -} -// internal helper methods ---------------------------------------------------- -Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( - sal_Int32 nChildIndex ) - throw ( uno::RuntimeException ) -{ - Reference< XAccessible > xRet; - Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY ); - if( xContext.is() ) - { - try - { - xRet = xContext->getAccessibleChild( nChildIndex ); - } - catch (const lang::IndexOutOfBoundsException&) - { - OSL_FAIL( "implGetHeaderBar - wrong child index" ); - } - // RuntimeException goes to caller - } - return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx deleted file mode 100644 index 4c3ef1861..000000000 --- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - - -#include "accessibility/extended/AccessibleGridControlTableBase.hxx" -#include -#include -#include -#include - -// ============================================================================ - -using ::rtl::OUString; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::uno::Any; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::accessibility; -using namespace ::svt; -using namespace ::svt::table; - -// ============================================================================ - -namespace accessibility { - -// ============================================================================ - -DBG_NAME( AccessibleGridControlTableBase ) - -AccessibleGridControlTableBase::AccessibleGridControlTableBase( - const Reference< XAccessible >& rxParent, - IAccessibleTable& rTable, - AccessibleTableControlObjType eObjType ) : - GridControlAccessibleElement( rxParent, rTable, eObjType ) -{ -} - -AccessibleGridControlTableBase::~AccessibleGridControlTableBase() -{ -} - -// XAccessibleContext --------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - sal_Int32 nChildren = 0; - if(m_eObjType == TCTYPE_ROWHEADERBAR) - nChildren = m_aTable.GetRowCount(); - else if(m_eObjType == TCTYPE_TABLE) - nChildren = m_aTable.GetRowCount()*m_aTable.GetColumnCount(); - else if(m_eObjType == TCTYPE_COLUMNHEADERBAR) - nChildren = m_aTable.GetColumnCount(); - return nChildren; -} - -sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return AccessibleRole::TABLE; -} - -// XAccessibleTable ----------------------------------------------------------- - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_aTable.GetRowCount(); -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount() - throw ( uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - return m_aTable.GetColumnCount(); -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return 1; // merged cells not supported -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return 1; // merged cells not supported -} - -Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // not supported -} - -Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary() - throw ( uno::RuntimeException ) -{ - ensureIsAlive(); - return NULL; // not supported -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidAddress( nRow, nColumn ); - return implGetChildIndex( nRow, nColumn ); -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return implGetRow( nChildIndex ); -} - -sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - ensureIsValidIndex( nChildIndex ); - return implGetColumn( nChildIndex ); -} - -// XInterface ----------------------------------------------------------------- - -Any SAL_CALL AccessibleGridControlTableBase::queryInterface( const uno::Type& rType ) - throw ( uno::RuntimeException ) -{ - Any aAny( GridControlAccessibleElement::queryInterface( rType ) ); - return aAny.hasValue() ? - aAny : AccessibleGridControlTableImplHelper::queryInterface( rType ); -} - -void SAL_CALL AccessibleGridControlTableBase::acquire() throw () -{ - GridControlAccessibleElement::acquire(); -} - -void SAL_CALL AccessibleGridControlTableBase::release() throw () -{ - GridControlAccessibleElement::release(); -} - -// XTypeProvider -------------------------------------------------------------- - -Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes() - throw ( uno::RuntimeException ) -{ - return ::comphelper::concatSequences( - GridControlAccessibleElement::getTypes(), - AccessibleGridControlTableImplHelper::getTypes() ); -} - -namespace -{ - class theAccessibleGridControlTableBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleGridControlTableBaseImplementationId > {}; -} - -Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId() - throw ( uno::RuntimeException ) -{ - return theAccessibleGridControlTableBaseImplementationId::get().getSeq(); -} - -// internal helper methods ---------------------------------------------------- - -sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const -{ - return m_aTable.GetRowCount()*m_aTable.GetColumnCount(); -} - -sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const -{ - sal_Int32 nColumns = m_aTable.GetColumnCount(); - return nColumns ? (nChildIndex / nColumns) : 0; -} - -sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex ) const -{ - sal_Int32 nColumns = m_aTable.GetColumnCount(); - return nColumns ? (nChildIndex % nColumns) : 0; -} - -sal_Int32 AccessibleGridControlTableBase::implGetChildIndex( - sal_Int32 nRow, sal_Int32 nColumn ) const -{ - return nRow * m_aTable.GetColumnCount() + nColumn; -} - -void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq ) -{ - sal_Int32 const selectionCount( m_aTable.GetSelectedRowCount() ); - rSeq.realloc( selectionCount ); - for ( sal_Int32 i=0; i= m_aTable.GetRowCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); -} - -void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( nColumn >= m_aTable.GetColumnCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); -} - -void AccessibleGridControlTableBase::ensureIsValidAddress( - sal_Int32 nRow, sal_Int32 nColumn ) - throw ( lang::IndexOutOfBoundsException ) -{ - ensureIsValidRow( nRow ); - ensureIsValidColumn( nColumn ); -} - -void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex ) - throw ( lang::IndexOutOfBoundsException ) -{ - if( nChildIndex >= implGetChildCount() ) - throw lang::IndexOutOfBoundsException( - OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); -} - -// ============================================================================ - -} // namespace accessibility - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx deleted file mode 100644 index 3b1a0d6ca..000000000 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ /dev/null @@ -1,370 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleGridControlTableCell.hxx" -#include -#include "accessibility/extended/AccessibleGridControl.hxx" -#include -#include -#include - -namespace accessibility -{ - namespace - { - // FIXME this is a copy'n'paste from - // source/extended/AccessibleBrowseBoxTableCell.cxx, get rid of that... - static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - if ( _nIndex >= _sText.getLength() ) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - } - using namespace ::com::sun::star::lang; - using namespace utl; - using namespace comphelper; - using ::rtl::OUString; - using ::accessibility::AccessibleGridControl; - using namespace ::com::sun::star::uno; - using ::com::sun::star::accessibility::XAccessible; - using namespace ::com::sun::star::accessibility; - using namespace ::svt; - using namespace ::svt::table; - - - // ============================================================================= - // = AccessibleGridControlCell - // ============================================================================= - // ----------------------------------------------------------------------------- - AccessibleGridControlCell::AccessibleGridControlCell( - const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable, - sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleTableControlObjType _eType ) - :AccessibleGridControlBase( _rxParent, _rTable, _eType ) - ,m_nRowPos( _nRowPos ) - ,m_nColPos( _nColPos ) - { - // set accessible name here, because for that we need the position of the cell - // and so the base class isn't capable of doing this - ::rtl::OUString aAccName; - if(_eType == TCTYPE_TABLECELL) - aAccName = _rTable.GetAccessibleObjectName( TCTYPE_TABLECELL, _nRowPos, _nColPos ); - else if(_eType == TCTYPE_ROWHEADERCELL) - aAccName = _rTable.GetAccessibleObjectName( TCTYPE_ROWHEADERCELL, _nRowPos, 0 ); - else if(_eType == TCTYPE_COLUMNHEADERCELL) - aAccName = _rTable.GetAccessibleObjectName( TCTYPE_COLUMNHEADERCELL, 0, _nRowPos ); - implSetName( aAccName ); - } - - // ----------------------------------------------------------------------------- - AccessibleGridControlCell::~AccessibleGridControlCell() - { - } - - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - m_aTable.GoToCell( m_nColPos, m_nRowPos ); - } - //// ----------------------------------------------------------------------------- - // implementation of a table cell - ::rtl::OUString AccessibleGridControlTableCell::implGetText() - { - ensureIsAlive(); - return m_aTable.GetAccessibleCellText( getRowPos(), getColumnPos() ); - } - - ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale() - { - ensureIsAlive(); - return m_aTable.GetAccessible()->getAccessibleContext()->getLocale(); - } - - void AccessibleGridControlTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } - - AccessibleGridControlTableCell::AccessibleGridControlTableCell(const Reference& _rxParent, - IAccessibleTable& _rTable, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - AccessibleTableControlObjType eObjType) - :AccessibleGridControlCell( _rxParent, _rTable, _nRowPos, _nColPos, eObjType ) - { - } - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlTableCell::queryInterface( - const ::com::sun::star::uno::Type& rType ) - throw ( ::com::sun::star::uno::RuntimeException ) - { - Any aRet = AccessibleGridControlCell::queryInterface(rType); - if ( !aRet.hasValue() ) - aRet = AccessibleTextHelper_BASE::queryInterface(rType); - return aRet; - } - - /** Aquires the object (calls acquire() on base class). */ - void SAL_CALL AccessibleGridControlTableCell::acquire() throw () - { - AccessibleGridControlCell::acquire(); - } - - /** Releases the object (calls release() on base class). */ - void SAL_CALL AccessibleGridControlTableCell::release() throw () - { - AccessibleGridControlCell::release(); - } - - ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - ::com::sun::star::awt::Rectangle aRect; - - if ( &m_aTable ) - aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) ); - return aRect; - } - - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) ); - } - - /** @return - The name of this class. - */ - ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName() - throw ( ::com::sun::star::uno::RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTableCell" ) ); - } - - /** @return The count of visible children. */ - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount() - throw ( ::com::sun::star::uno::RuntimeException ) - { - return 0; - } - - /** @return The XAccessible interface of the specified child. */ - ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > SAL_CALL - AccessibleGridControlTableCell::getAccessibleChild( sal_Int32 ) - throw ( ::com::sun::star::lang::IndexOutOfBoundsException, - ::com::sun::star::uno::RuntimeException ) - { - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - - /** Creates a new AccessibleStateSetHelper and fills it with states of the - current object. - @return - A filled AccessibleStateSetHelper. - */ - ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper() - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; - - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - - m_aTable.FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return pStateSetHelper; - } - - - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException ) - { - ensureIsAlive(); - return this; - } - - // XAccessibleContext ----------------------------------------------------- - - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent() - throw ( ::com::sun::star::uno::RuntimeException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos(); - } - - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) - { - return -1; - } - sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getCharacter( nIndex ); - } - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getCharacterCount( ); - } - - ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectedText( ); - } - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectionStart( ); - } - sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getSelectionEnd( ); - } - sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getText( ); - } - ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } - sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ::rtl::OUString sText = implGetText(); - checkIndex_Impl( nStartIndex, sText ); - checkIndex_Impl( nEndIndex, sText ); - - //!!! don't know how to put a string into the clipboard - return sal_False; - } - - Rectangle AccessibleGridControlTableCell::implGetBoundingBox() - { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() - { - return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx deleted file mode 100644 index 9dcb47cca..000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeck.cxx +++ /dev/null @@ -1,410 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleToolPanelDeck.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::accessibility::XAccessibleContext; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::lang::Locale; - using ::com::sun::star::accessibility::XAccessibleRelationSet; - using ::com::sun::star::accessibility::XAccessibleStateSet; - using ::com::sun::star::accessibility::IllegalAccessibleComponentStateException; - using ::com::sun::star::awt::XFont; - /** === end UNO using === **/ - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - - typedef ::com::sun::star::awt::Rectangle UnoRectangle; - typedef ::com::sun::star::awt::Point UnoPoint; - - //================================================================================================================== - //= AccessibleToolPanelDeck_Impl - declaration - //================================================================================================================== - class AccessibleToolPanelDeck_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelDeck_Impl( - AccessibleToolPanelDeck& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ); - - void checkDisposed(); - bool isDisposed() const { return m_pPanelDeck == NULL; } - void dispose(); - - ~AccessibleToolPanelDeck_Impl(); - - Reference< XAccessible > getOwnAccessible() const; - Reference< XAccessible > getActivePanelAccessible(); - - protected: - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - public: - AccessibleToolPanelDeck& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - ::svt::ToolPanelDeck* m_pPanelDeck; - - typedef ::std::vector< Reference< XAccessible > > AccessibleChildren; - Reference< XAccessible > m_xActivePanelAccessible; - }; - - //================================================================================================================== - //= MethodGuard - //================================================================================================================== - namespace - { - class MethodGuard - { - public: - MethodGuard( AccessibleToolPanelDeck_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~MethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - } - - //================================================================================================================== - //= AccessibleToolPanelDeck_Impl - implementation - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeck_Impl::AccessibleToolPanelDeck_Impl( AccessibleToolPanelDeck& i_rAntiImpl, const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_xActivePanelAccessible() - { - m_pPanelDeck->AddListener( *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeck_Impl::~AccessibleToolPanelDeck_Impl() - { - if ( !isDisposed() ) - dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = NULL; - m_xAccessibleParent.clear(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::checkDisposed() - { - if ( isDisposed() ) - throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelDeck_Impl::getOwnAccessible() const - { - Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); - OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), - "AccessibleToolPanelDeck_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); - return xOwnAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelDeck_Impl::getActivePanelAccessible() - { - ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: already disposed!", NULL ); - - if ( !m_xActivePanelAccessible.is() ) - { - ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); - ENSURE_OR_RETURN( !!aActivePanel, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: this should not be called without an active panel!", NULL ); - ::svt::PToolPanel pActivePanel( m_pPanelDeck->GetPanel( *aActivePanel ) ); - ENSURE_OR_RETURN( pActivePanel.get() != NULL, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: no active panel!", NULL ); - m_xActivePanelAccessible = pActivePanel->CreatePanelAccessible( getOwnAccessible() ); - OSL_ENSURE( m_xActivePanelAccessible.is(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: illegal accessible returned by the panel!" ); - } - - return m_xActivePanelAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - (void)i_pPanel; - (void)i_nPosition; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) - { - (void)i_nPosition; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( !!i_rOldActive ) - { - if ( !m_xActivePanelAccessible.is() ) - { - // again, this might in theory happen if the XAccessible for the active panel has never before been requested. - // In this case, just say that all our children are invalid, so they all must be re-requested. - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); - } - else - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( m_xActivePanelAccessible ), Any() ); - } - } - - m_xActivePanelAccessible.clear(); - - if ( !!i_rNewActive ) - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getActivePanelAccessible() ) ); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - MethodGuard aGuard( *this ); - - (void)i_rNewLayouter; - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck_Impl::Dying() - { - // the tool panel deck is dying, so dispose ourself - m_rAntiImpl.dispose(); - } - - //================================================================================================================== - //= AccessibleToolPanelDeck - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeck::AccessibleToolPanelDeck( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck ) - :AccessibleToolPanelDeck_Base( i_rPanelDeck.GetWindowPeer() ) - ,m_pImpl( new AccessibleToolPanelDeck_Impl( *this, i_rAccessibleParent, i_rPanelDeck ) ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeck::~AccessibleToolPanelDeck() - { - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Int32 SAL_CALL AccessibleToolPanelDeck::getAccessibleChildCount( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - sal_Int32 nChildCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); - - ::boost::optional< size_t > aActivePanel( m_pImpl->m_pPanelDeck->GetActivePanel() ); - if ( !!aActivePanel ) - return ++nChildCount; - - return nChildCount; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - const sal_Int32 nChildCount( getAccessibleChildCount() ); - if ( ( i_nIndex < 0 ) || ( i_nIndex >= nChildCount ) ) - throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); - - // first "n" children are provided by the layouter - const size_t nLayouterCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); - if ( size_t( i_nIndex ) < nLayouterCount ) - return m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChild( - size_t( i_nIndex ), - m_pImpl->getOwnAccessible() - ); - - // the last child is the XAccessible of the active panel - return m_pImpl->getActivePanelAccessible(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleParent( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - const Reference< XAccessible > xParent = implGetForeignControlledParent(); - if ( xParent.is() ) - return xParent; - return m_pImpl->m_xAccessibleParent; - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Int16 SAL_CALL AccessibleToolPanelDeck::getAccessibleRole( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - return AccessibleRole::PANEL; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - const ::Point aRequestedPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); - // check the panel window itself - const ::Window& rActivePanelAnchor( m_pImpl->m_pPanelDeck->GetPanelWindowAnchor() ); - const Rectangle aPanelAnchorArea( rActivePanelAnchor.GetPosPixel(), rActivePanelAnchor.GetOutputSizePixel() ); - if ( aPanelAnchorArea.IsInside( aRequestedPoint ) ) - // note that this assumes that the Window which actually implements the concrete panel covers - // the complete area of its "anchor" Window. But this is ensured by the ToolPanelDeck implementation. - return m_pImpl->getActivePanelAccessible(); - - // check the XAccessible instances provided by the layouter - try - { - const ::svt::PDeckLayouter pLayouter( m_pImpl->m_pPanelDeck->GetLayouter() ); - ENSURE_OR_THROW( pLayouter.get() != NULL, "invalid layouter" ); - - const size_t nLayouterChildren = pLayouter->GetAccessibleChildCount(); - for ( size_t i=0; i xLayoutItemAccessible( pLayouter->GetAccessibleChild( i, m_pImpl->getOwnAccessible() ), UNO_SET_THROW ); - const Reference< XAccessibleComponent > xLayoutItemComponent( xLayoutItemAccessible->getAccessibleContext(), UNO_QUERY_THROW ); - const ::Rectangle aLayoutItemBounds( VCLUnoHelper::ConvertToVCLRect( xLayoutItemComponent->getBounds() ) ); - if ( aLayoutItemBounds.IsInside( aRequestedPoint ) ) - return xLayoutItemAccessible; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AccessibleToolPanelDeck::grabFocus( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - m_pImpl->m_pPanelDeck->GrabFocus(); - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AccessibleToolPanelDeck::disposing() - { - AccessibleToolPanelDeck_Base::disposing(); - m_pImpl->dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelDeck::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) - { - // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those - // A11Y events ourself - (void)i_rVclWindowEvent; - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeck::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) - { - AccessibleToolPanelDeck_Base::FillAccessibleStateSet( i_rStateSet ); - if ( m_pImpl->isDisposed() ) - { - i_rStateSet.AddState( AccessibleStateType::DEFUNC ); - } - else - { - i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - } - } - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx deleted file mode 100644 index 386a60d9b..000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleToolPanelDeckTabBar.hxx" -#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" -#include "accessibility/helper/accresmgr.hxx" -#include "accessibility/helper/accessiblestrings.hrc" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::accessibility::XAccessibleContext; - /** === end UNO using === **/ - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - - typedef ::com::sun::star::awt::Point UnoPoint; - typedef ::com::sun::star::awt::Size UnoSize; - typedef ::com::sun::star::awt::Rectangle UnoRectangle; - - //================================================================================================================== - //= AccessibleWrapper - //================================================================================================================== - typedef ::cppu::WeakImplHelper1< XAccessible > AccessibleWrapper_Base; - class AccessibleWrapper : public AccessibleWrapper_Base - { - public: - AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext ) - :m_xContext( i_rContext ) - { - } - - // XAccessible - virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException) - { - return m_xContext; - } - - private: - const Reference< XAccessibleContext > m_xContext; - }; - - //================================================================================================================== - //= AccessibleToolPanelTabBar_Impl - //================================================================================================================== - class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelTabBar_Impl( - AccessibleToolPanelTabBar& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ); - ~AccessibleToolPanelTabBar_Impl(); - - void checkDisposed(); - bool isDisposed() const { return m_pPanelDeck == NULL; } - void dispose(); - - ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } - ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } - const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; } - Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition ); - Reference< XAccessible > getOwnAccessible() const; - - protected: - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - DECL_LINK( OnWindowEvent, const VclSimpleEvent* ); - - private: - AccessibleToolPanelTabBar& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - ::svt::IToolPanelDeck* m_pPanelDeck; - ::svt::PanelTabBar* m_pTabBar; - ::std::vector< Reference< XAccessible > > m_aChildren; - }; - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_pTabBar( &i_rTabBar ) - ,m_aChildren() - { - m_pPanelDeck->AddListener( *this ); - m_aChildren.resize( m_pPanelDeck->GetPanelCount() ); - - const String sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) ); - i_rTabBar.SetAccessibleName( sAccessibleDescription ); - i_rTabBar.SetAccessibleDescription( sAccessibleDescription ); - - i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::checkDisposed() - { - if ( isDisposed() ) - throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl() - { - if ( !isDisposed() ) - dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = NULL; - - m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - m_pTabBar = NULL; - - m_xAccessibleParent.clear(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition ) - { - ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", NULL ); - ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", NULL ); - - Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] ); - if ( !rAccessibleChild.is() ) - { - ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem( - getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) ); - rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) ); - pAccesibleItemContext->lateInit( rAccessibleChild ); - } - return rAccessibleChild; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const - { - Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); - OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), - "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); - return xOwnAccessible; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); - (void)i_pPanel; - m_aChildren.insert( m_aChildren.begin() + i_nPosition, NULL ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition ) - { - ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); - - const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) ); - m_aChildren.erase( m_aChildren.begin() + i_nPosition ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - (void)i_rOldActive; - (void)i_rNewActive; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - (void)i_rNewLayouter; - m_rAntiImpl.dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar_Impl::Dying() - { - m_rAntiImpl.dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent ) - { - ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L ); - - const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) ); - if ( !pWindowEvent ) - return 0L; - - const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) ); - const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) ); - ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L ); - - const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW ); - const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE ); - if ( !bShow && !bHide ) - // not interested in events other than visibility changes - return 0L; - - const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() ); - const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() ); - const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild ); - - return 1L; - } - - //================================================================================================================== - //= MethodGuard - //================================================================================================================== - namespace - { - class MethodGuard - { - public: - MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~MethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - } - - //================================================================================================================== - //= AccessibleToolPanelTabBar - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) - :AccessibleToolPanelTabBar_Base( i_rTabBar.GetWindowPeer() ) - ,m_pImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar() - { - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - - return m_pImpl->getPanelDeck()->GetPanelCount() - + ( bHasScrollBack ? 1 : 0 ) - + ( bHasScrollForward ? 1 : 0 ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - - const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) ); - const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) ); - OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" ); - - if ( bScrollBackRequested || bScrollForwardRequested ) - { - Reference< XAccessible > xScrollButtonAccessible( m_pImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() ); - ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", NULL ); - #if OSL_DEBUG_LEVEL > 0 - Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() ); - ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible ); - OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_pImpl->getOwnAccessible(), - "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accesible!" ); - #endif - return xScrollButtonAccessible; - } - - return m_pImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - return m_pImpl->getAccessibleParent(); - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - return AccessibleRole::PAGE_TAB_LIST; - } - - //------------------------------------------------------------------------------------------------------------------ - namespace - { - bool lcl_covers( const ::Window& i_rWindow, const ::Point& i_rPoint ) - { - const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) ); - return aWindowBounds.IsInside( i_rPoint ); - } - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) - { - MethodGuard aGuard( *m_pImpl ); - - // check the tab items - const UnoPoint aOwnScreenPos( getLocationOnScreen() ); - const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y ); - - for ( size_t i=0; igetPanelDeck()->GetPanelCount(); ++i ) - { - const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect(i) ); - if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) ) - return m_pImpl->getAccessiblePanelItem(i); - } - - // check the scroll buttons - const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); - - const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - if ( bHasScrollBack && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) ) - return m_pImpl->getTabBar()->GetScrollButton( false ).GetAccessible(); - - const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - if ( bHasScrollForward && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) ) - return m_pImpl->getTabBar()->GetScrollButton( true ).GetAccessible(); - - // no hit - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - void SAL_CALL AccessibleToolPanelTabBar::disposing() - { - AccessibleToolPanelTabBar_Base::disposing(); - m_pImpl->dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) - { - // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those - // A11Y events ourself - (void)i_rVclWindowEvent; - return NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) - { - AccessibleToolPanelTabBar_Base::FillAccessibleStateSet( i_rStateSet ); - i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - ENSURE_OR_RETURN_VOID( !m_pImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" ); - if ( m_pImpl->getTabBar()->IsVertical() ) - i_rStateSet.AddState( AccessibleStateType::VERTICAL ); - else - i_rStateSet.AddState( AccessibleStateType::HORIZONTAL ); - } - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx deleted file mode 100644 index 5344a51fe..000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx +++ /dev/null @@ -1,453 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include - -//...................................................................................................................... -namespace accessibility -{ -//...................................................................................................................... - - typedef ::com::sun::star::awt::Rectangle UnoRectangle; - typedef ::com::sun::star::awt::Point UnoPoint; - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::accessibility::XAccessibleRelationSet; - using ::com::sun::star::accessibility::XAccessibleStateSet; - using ::com::sun::star::accessibility::XAccessibleComponent; - using ::com::sun::star::accessibility::XAccessibleExtendedComponent; - using ::com::sun::star::awt::XFont; - /** === end UNO using === **/ - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - - //================================================================================================================== - //= AccessibleToolPanelDeckTabBarItem_Impl - //================================================================================================================== - class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelDeckTabBarItem_Impl( - AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos - ); - ~AccessibleToolPanelDeckTabBarItem_Impl(); - - ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } - - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void PanelRemoved( const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); - virtual void Dying(); - - public: - bool isDisposed() const { return m_pPanelDeck == NULL; } - void checkDisposed() const; - void dispose(); - - const Reference< XAccessible >& - getAccessibleParent() const { return m_xAccessibleParent; } - size_t getItemPos() const { return m_nItemPos; } - - Reference< XAccessibleComponent > getParentAccessibleComponent() const; - ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } - ::rtl::OUString getPanelDisplayName(); - - private: - void impl_notifyBoundRectChanges(); - void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); - - private: - AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - ::svt::IToolPanelDeck* m_pPanelDeck; - ::svt::PanelTabBar* m_pTabBar; - size_t m_nItemPos; - }; - - //================================================================================================================== - //= AccessibleToolPanelDeckTabBarItem_Impl - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_pTabBar( &i_rTabBar ) - ,m_nItemPos( i_nItemPos ) - { - m_pPanelDeck->AddListener( *this ); - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl() - { - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const - { - if ( isDisposed() ) - throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" ); - - m_xAccessibleParent.clear(); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = NULL; - m_pTabBar = NULL; - } - - //------------------------------------------------------------------------------------------------------------------ - Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const - { - Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW ); - return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY ); - } - - //------------------------------------------------------------------------------------------------------------------ - ::rtl::OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName() - { - const ::svt::PToolPanel pPanel( m_pPanelDeck->GetPanel( getItemPos() ) ); - if ( pPanel.get() == NULL ) - throw DisposedException(); - return pPanel->GetDisplayName(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges() - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ) - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, - i_nLostState > -1 ? makeAny( i_nLostState ) : Any(), - i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any() - ); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - (void)i_pPanel; - if ( i_nPosition <= m_nItemPos ) - ++m_nItemPos; - impl_notifyBoundRectChanges(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition ) - { - if ( i_nPosition == m_nItemPos ) - { - m_rAntiImpl.dispose(); - } - else if ( i_nPosition < m_nItemPos ) - { - --m_nItemPos; - impl_notifyBoundRectChanges(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( m_nItemPos == i_rOldActive ) - { - impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 ); - impl_notifyStateChange( AccessibleStateType::SELECTED, -1 ); - } - else if ( m_nItemPos == i_rNewActive ) - { - impl_notifyStateChange( -1, AccessibleStateType::ACTIVE ); - impl_notifyStateChange( -1, AccessibleStateType::SELECTED ); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - (void)i_rNewLayouter; - // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was - // responsible for, died. So do we. - dispose(); - } - - //------------------------------------------------------------------------------------------------------------------ - void AccessibleToolPanelDeckTabBarItem_Impl::Dying() - { - // if the tool panel deck is dying, then its layouter dies, so should we. - dispose(); - } - - //================================================================================================================== - //= ItemMethodGuard - //================================================================================================================== - class ItemMethodGuard - { - public: - ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~ItemMethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - - //================================================================================================================== - //= AccessibleToolPanelDeckTabBarItem - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) - :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) ) - { - } - - //------------------------------------------------------------------------------------------------------------------ - AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem() - { - } - - //-------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException) - { - return 0; - } - - //-------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) - { - (void)i; - throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - return m_pImpl->getAccessibleParent(); - } - - //-------------------------------------------------------------------- - sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException) - { - return AccessibleRole::PAGE_TAB; - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - return m_pImpl->getPanelDisplayName(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - return m_pImpl->getPanelDisplayName(); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; - return pRelationSet; - } - - //-------------------------------------------------------------------- - Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - - ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); - pStateSet->AddState( AccessibleStateType::FOCUSABLE ); - pStateSet->AddState( AccessibleStateType::SELECTABLE ); - pStateSet->AddState( AccessibleStateType::ICONIFIED ); - - if ( m_pImpl->getItemPos() == m_pImpl->getPanelDeck()->GetActivePanel() ) - { - pStateSet->AddState( AccessibleStateType::ACTIVE ); - pStateSet->AddState( AccessibleStateType::SELECTED ); - } - - if ( m_pImpl->getItemPos() == m_pImpl->getTabBar()->GetFocusedPanelItem() ) - pStateSet->AddState( AccessibleStateType::FOCUSED ); - - if ( m_pImpl->getTabBar()->IsEnabled() ) - pStateSet->AddState( AccessibleStateType::ENABLED ); - - if ( m_pImpl->getTabBar()->IsVisible() ) - { - pStateSet->AddState( AccessibleStateType::SHOWING ); - pStateSet->AddState( AccessibleStateType::VISIBLE ); - } - - return pStateSet; - } - - - //-------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const UnoPoint& i_rLocation ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - // we do not have children ... - (void)i_rLocation; - return NULL; - } - - //-------------------------------------------------------------------- - void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - m_pImpl->getTabBar()->FocusPanelItem( m_pImpl->getItemPos() ); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - return xParentComponent->getForeground(); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - return xParentComponent->getBackground(); - } - - //-------------------------------------------------------------------- - Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - Reference< XAccessibleExtendedComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_QUERY_THROW ); - // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use - // a different font ... - return xParentComponent->getFont(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - // no support - return ::rtl::OUString(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - return m_pImpl->getPanelDisplayName(); - } - - //-------------------------------------------------------------------- - UnoRectangle SAL_CALL AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_pImpl ); - - const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect( m_pImpl->getItemPos() ) ); - - Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - const UnoPoint aParentLocation( xParentComponent->getLocationOnScreen() ); - return UnoRectangle( - aItemScreenRect.Left() - aParentLocation.X, - aItemScreenRect.Top() - aParentLocation.Y, - aItemScreenRect.GetWidth(), - aItemScreenRect.GetHeight() - ); - } - - //-------------------------------------------------------------------- - void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing() - { - ItemMethodGuard aGuard( *m_pImpl ); - m_pImpl->dispose(); - } - -//...................................................................................................................... -} // namespace accessibility -//...................................................................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessiblebrowseboxcell.cxx b/accessibility/source/extended/accessiblebrowseboxcell.cxx deleted file mode 100644 index 581aa0250..000000000 --- a/accessibility/source/extended/accessiblebrowseboxcell.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/accessiblebrowseboxcell.hxx" -#include - -// ................................................................................. -namespace accessibility -{ -// ................................................................................. - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::accessibility; - using namespace ::svt; - - // ============================================================================= - // = AccessibleBrowseBoxCell - // ============================================================================= - DBG_NAME( svt_AccessibleBrowseBoxCell ) - // ----------------------------------------------------------------------------- - AccessibleBrowseBoxCell::AccessibleBrowseBoxCell( - const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox, - const Reference< XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType ) - :AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType ) - ,m_nRowPos( _nRowPos ) - ,m_nColPos( _nColPos ) - { - DBG_CTOR( svt_AccessibleBrowseBoxCell, NULL ); - // set accessible name here, because for that we need the position of the cell - // and so the base class isn't capable of doing this - sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos; - ::rtl::OUString aAccName = _rBrowseBox.GetAccessibleObjectName( BBTYPE_TABLECELL, nPos ); - implSetName( aAccName ); - } - - // ----------------------------------------------------------------------------- - AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell() - { - DBG_DTOR( svt_AccessibleBrowseBoxCell, NULL ); - } - - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleBrowseBoxCell::grabFocus() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - mpBrowseBox->GoToCell( m_nRowPos, m_nColPos ); - } - // ----------------------------------------------------------------------------- - ::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() - { - return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False, sal_False ); - } - - // ----------------------------------------------------------------------------- - ::Rectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() - { - return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False ); - } - -// ................................................................................. -} // namespace accessibility -// ................................................................................. - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx deleted file mode 100644 index 12bd5f563..000000000 --- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx +++ /dev/null @@ -1,276 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include - - -// ................................................................................. -namespace accessibility -{ -// ................................................................................. - - using namespace com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::awt; - using namespace ::comphelper; - using namespace ::svt; - - DBG_NAME( acc_EditBrowseBoxTableCell ) - // ----------------------------------------------------------------------------- - EditBrowseBoxTableCell::EditBrowseBoxTableCell( - const com::sun::star::uno::Reference< XAccessible >& _rxParent, - const com::sun::star::uno::Reference< XAccessible >& _rxOwningAccessible, - const com::sun::star::uno::Reference< XAccessibleContext >& _xControlChild, - IAccessibleTableProvider& _rBrowseBox, - const Reference< XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos) - :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos ) - ,OAccessibleContextWrapperHelper( ::comphelper::getProcessServiceFactory(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent ) - { - DBG_CTOR( acc_EditBrowseBoxTableCell, NULL ); - - aggregateProxy( m_refCount, *this ); - } - - // ----------------------------------------------------------------------------- - EditBrowseBoxTableCell::~EditBrowseBoxTableCell() - { - if ( !rBHelper.bDisposed ) - { - acquire(); // to prevent duplicate dtor calls - dispose(); - } - - DBG_DTOR( acc_EditBrowseBoxTableCell, NULL ); - } - - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCellProxy" ) ); - } - - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) - - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) - - // ----------------------------------------------------------------------------- - void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException) - { - commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue ); - } - - // XAccessibleComponent - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground( ) throw (RuntimeException) - { - SolarMethodGuard aGuard( *this ); - Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); - if ( xAccComp.is() ) - return xAccComp->getForeground(); - return 0; - } - - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground( ) throw (RuntimeException) - { - SolarMethodGuard aGuard( *this ); - Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); - if ( xAccComp.is() ) - return xAccComp->getBackground(); - return 0; - } - - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent( ) throw (RuntimeException) - { - return m_xParentAccessible; - } - - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - return m_xInnerContext->getAccessibleDescription(); - } - - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - - // TODO: localize this! - String sName = mpBrowseBox->GetColumnDescription( ::sal::static_int_cast< sal_uInt16 >( getColumnPos() ) ); - if ( 0 == sName.Len() ) - { - sName = String::CreateFromAscii( "Column " ); - sName += String::CreateFromInt32( getColumnPos( ) ); - } - - sName += String::CreateFromAscii( ", Row " ); - sName += String::CreateFromInt32( getRowPos( ) ); - - return ::rtl::OUString( sName ); - } - - // ----------------------------------------------------------------------------- - Reference< XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - return OAccessibleContextWrapperHelper::getAccessibleRelationSet( ); - } - - // ----------------------------------------------------------------------------- - Reference SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - return m_xInnerContext->getAccessibleStateSet(); - // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE? - } - - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount( ) throw (RuntimeException) - { - SolarMethodGuard aGuard( *this ); - return OAccessibleContextWrapperHelper::getAccessibleChildCount(); - } - - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) - { - SolarMethodGuard aGuard( *this ); - return OAccessibleContextWrapperHelper::getAccessibleChild( i ); - } - - // ----------------------------------------------------------------------------- - sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() throw ( RuntimeException ) - { - SolarMethodGuard aGuard( *this ); - return m_xInnerContext->getAccessibleRole( ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL EditBrowseBoxTableCell::dispose() throw( RuntimeException ) - { - // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell - // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper - // so there is no need to do this here. - AccessibleBrowseBoxCell::dispose(); - } - // ----------------------------------------------------------------------------- - void SAL_CALL EditBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException) - { - AccessibleBrowseBoxCell::disposing( _rSource ); - OAccessibleContextWrapperHelper::disposing( _rSource ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL EditBrowseBoxTableCell::disposing() - { - SolarMethodGuard aGuard( *this, false ); - OAccessibleContextWrapperHelper::dispose(); - // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea? - AccessibleBrowseBoxCell::disposing(); - } - // ============================================================================= - // = EditBrowseBoxTableCell - // ============================================================================= - DBG_NAME( EditBrowseBoxTableCellAccess ) - // ----------------------------------------------------------------------------- - EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess( - const Reference< XAccessible >& _rxParent, const Reference< XAccessible > _rxControlAccessible, - const Reference< XWindow >& _rxFocusWindow, - IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos ) - :EditBrowseBoxTableCellAccess_Base( m_aMutex ) - ,m_xParent( _rxParent ) - ,m_xControlAccessible( _rxControlAccessible ) - ,m_xFocusWindow( _rxFocusWindow ) - ,m_pBrowseBox( &_rBrowseBox ) - ,m_nRowPos( _nRowPos ) - ,m_nColPos( _nColPos ) - { - DBG_CTOR( EditBrowseBoxTableCellAccess, NULL ); - } - // ----------------------------------------------------------------------------- - EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( ) - { - DBG_DTOR( EditBrowseBoxTableCellAccess, NULL ); - } - //-------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext( ) throw (RuntimeException) - { - if ( !m_pBrowseBox || !m_xControlAccessible.is() ) - throw DisposedException(); - Reference< XAccessibleContext > xMyContext( m_aContext ); - if ( !xMyContext.is() ) - { - Reference< XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext(); - Reference< XAccessible > xMe( this ); - - xMyContext = new EditBrowseBoxTableCell( m_xParent, xMe, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos ); - m_aContext = xMyContext; - } - return xMyContext; - } - //-------------------------------------------------------------------- - void SAL_CALL EditBrowseBoxTableCellAccess::disposing() - { - // dispose our context, if it still alive - Reference< XComponent > xMyContext( (Reference< XAccessibleContext >)m_aContext, UNO_QUERY ); - if ( xMyContext.is() ) - { - try - { - xMyContext->dispose(); - } - catch( const Exception& e ) - { - (void)e; - OSL_FAIL( "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" ); - } - } - - m_pBrowseBox = NULL; - m_xControlAccessible.clear(); - m_aContext = Reference< XAccessibleContext >( ); - // NO dispose of the inner object there: it is the XAccessible of an window, and disposing - // it would delete the respective VCL window - } -// ................................................................................. -} // namespace accessibility -// ................................................................................. - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx deleted file mode 100644 index 99742f78d..000000000 --- a/accessibility/source/extended/accessibleiconchoicectrl.cxx +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/accessibleiconchoicectrl.hxx" -#include "accessibility/extended/accessibleiconchoicectrlentry.hxx" -#include -#include -#include -#include -#include -#include -#include -#include - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - // class AccessibleIconChoiceCtrl ---------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleIconChoiceCtrl) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) : - - VCLXAccessibleComponent( _rIconCtrl.GetWindowPeer() ), - m_xParent ( _xParent ) - { - DBG_CTOR( AccessibleIconChoiceCtrl, NULL ); - } - // ----------------------------------------------------------------------------- - AccessibleIconChoiceCtrl::~AccessibleIconChoiceCtrl() - { - DBG_DTOR( AccessibleIconChoiceCtrl, NULL ); - } - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE) - IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE) - // ----------------------------------------------------------------------------- - void AccessibleIconChoiceCtrl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - if ( isAlive() ) - { - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_LISTBOX_SELECT : - { - // First send an event that tells the listeners of a - // modified selection. The active descendant event is - // send after that so that the receiving AT has time to - // read the text or name of the active child. - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - SvtIconChoiceCtrl* pCtrl = getCtrl(); - if ( pCtrl && pCtrl->HasFocus() ) - { - SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - sal_uLong nPos = pCtrl->GetEntryListPos( pEntry ); - Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, nPos, this ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - } - } - break; - } - default: - VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); - } - } - } - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrl::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); - - m_xParent = NULL; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() throw (RuntimeException) - { - return getImplementationName_Static(); - } - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() throw (RuntimeException) - { - return getSupportedServiceNames_Static(); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported ) - ; - - return pSupported != pEnd; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - static methods - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > AccessibleIconChoiceCtrl::getSupportedServiceNames_Static(void) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(3); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") ); - aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") ); - aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControl") ); - return aSupported; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleIconChoiceCtrl::getImplementationName_Static(void) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControl") ); - } - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) throw (RuntimeException) - { - ensureAlive(); - return this; - } - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChildCount( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - return getCtrl()->GetEntryCount(); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChild( sal_Int32 i ) throw (RuntimeException, IndexOutOfBoundsException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - SvtIconChoiceCtrl* pCtrl = getCtrl(); - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry(i); - if ( !pEntry ) - throw RuntimeException(); - - return new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleParent( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ensureAlive(); - return m_xParent; - } - // ----------------------------------------------------------------------------- - sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) throw (RuntimeException) - { - return AccessibleRole::TREE; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - return getCtrl()->GetAccessibleDescription(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleName( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - ::rtl::OUString sName = getCtrl()->GetAccessibleName(); - if ( sName.getLength() == 0 ) - sName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconChoiceControl" ) ); - return sName; - } - // ----------------------------------------------------------------------------- - // XAccessibleSelection - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - SvtIconChoiceCtrl* pCtrl = getCtrl(); - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - pCtrl->SetCursor( pEntry ); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - SvtIconChoiceCtrl* pCtrl = getCtrl(); - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - return ( pCtrl->GetCursor() == pEntry ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrl::clearAccessibleSelection( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - getCtrl()->SetNoSelection(); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrl::selectAllAccessibleChildren( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 i, nCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); - nCount = pCtrl->GetEntryCount(); - for ( i = 0; i < nCount; ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); - if ( pCtrl->GetCursor() != pEntry ) - pCtrl->SetCursor( pEntry ); - } - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChildCount( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 i, nSelCount = 0, nCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); - nCount = pCtrl->GetEntryCount(); - for ( i = 0; i < nCount; ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); - if ( pCtrl->GetCursor() == pEntry ) - ++nSelCount; - } - - return nSelCount; - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - sal_Int32 i, nSelCount = 0, nCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); - nCount = pCtrl->GetEntryCount(); - for ( i = 0; i < nCount; ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); - if ( pCtrl->GetCursor() == pEntry ) - ++nSelCount; - - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); - break; - } - } - - return xChild; - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrl::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - sal_Int32 i, nSelCount = 0, nCount = 0; - SvtIconChoiceCtrl* pCtrl = getCtrl(); - nCount = pCtrl->GetEntryCount(); - bool bFound = false; - for ( i = 0; i < nCount; ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); - if ( pEntry->IsSelected() ) - { - ++nSelCount; - if ( i == nSelectedChildIndex ) - bFound = true; - } - } - - // if only one entry is selected and its index is choosen to deselect -> no selection anymore - if ( 1 == nSelCount && bFound ) - pCtrl->SetNoSelection(); - } - // ----------------------------------------------------------------------------- - void AccessibleIconChoiceCtrl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - if ( isAlive() ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - } - } - // ----------------------------------------------------------------------------- - SvtIconChoiceCtrl* AccessibleIconChoiceCtrl::getCtrl() - { - return static_cast(GetWindow()); - } - -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx deleted file mode 100644 index aa8e66a52..000000000 --- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx +++ /dev/null @@ -1,734 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ACCESSIBLE_ACTION_COUNT 1 -#define AID_EXPAND 0 -#define AID_COLLAPSE 1 - -namespace -{ - void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT ) - // only three actions - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } -} - -//........................................................................ -namespace accessibility -{ - - // class AccessibleIconChoiceCtrlEntry ----------------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleIconChoiceCtrlEntry) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, - sal_uLong _nPos, - const Reference< XAccessible >& _xParent ) : - - AccessibleIconChoiceCtrlEntry_BASE ( m_aMutex ), - - m_pIconCtrl ( &_rIconCtrl ), - m_nIndex ( _nPos ), - m_nClientId ( 0 ), - m_xParent ( _xParent ) - - { - osl_incrementInterlockedCount( &m_refCount ); - { - Reference< XComponent > xComp( m_xParent, UNO_QUERY ); - if ( xComp.is() ) - xComp->addEventListener( this ); - } - osl_decrementInterlockedCount( &m_refCount ); - - DBG_CTOR( AccessibleIconChoiceCtrlEntry, NULL ); - } - // ----------------------------------------------------------------------------- - void AccessibleIconChoiceCtrlEntry::disposing( const EventObject& _rSource ) -throw(RuntimeException) - { - if ( _rSource.Source == m_xParent ) - { - dispose(); - DBG_ASSERT( !m_xParent.is() && ( NULL == m_pIconCtrl ), "" ); - } - } - // ----------------------------------------------------------------------------- - AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry() - { - DBG_DTOR( AccessibleIconChoiceCtrlEntry, NULL ); - - if ( IsAlive_Impl() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const - { - Rectangle aRect; - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - - return aRect; - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const - { - Rectangle aRect; - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - { - aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - Point aTopLeft = aRect.TopLeft(); - aTopLeft += m_pIconCtrl->GetWindowExtentsRelative( NULL ).TopLeft(); - aRect = Rectangle( aTopLeft, aRect.GetSize() ); - } - - return aRect; - } - // ----------------------------------------------------------------------------- - sal_Bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const - { - return ( !rBHelper.bDisposed && !rBHelper.bInDispose && m_pIconCtrl ); - } - // ----------------------------------------------------------------------------- - sal_Bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const - { - sal_Bool bShowing = sal_False; - Reference< XAccessibleContext > m_xParentContext = - m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >(); - if( m_xParentContext.is() ) - { - Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) ); - } - - return bShowing; - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox() throw ( lang::DisposedException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return GetBoundingBox_Impl(); - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return GetBoundingBoxOnScreen_Impl(); - } - // ----------------------------------------------------------------------------- - void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const throw ( lang::DisposedException ) - { - if ( !IsAlive_Impl() ) - throw lang::DisposedException(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleIconChoiceCtrlEntry::implGetText() - { - ::rtl::OUString sRet; - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - sRet = pEntry->GetDisplayText(); - return sRet; - } - // ----------------------------------------------------------------------------- - Locale AccessibleIconChoiceCtrlEntry::implGetLocale() - { - Locale aLocale; - aLocale = Application::GetSettings().GetUILocale(); - - return aLocale; - } - void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } - // ----------------------------------------------------------------------------- - // XTypeProvider - // ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- - Sequence< sal_Int8 > AccessibleIconChoiceCtrlEntry::getImplementationId() throw (RuntimeException) - { - static ::cppu::OImplementationId* pId = NULL; - - if ( !pId ) - { - ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex ); - - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); - } - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // Send a disposing to all listeners. - if ( m_nClientId ) - { - sal_uInt32 nId = m_nClientId; - m_nClientId = 0; - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); - } - - Reference< XComponent > xComp( m_xParent, UNO_QUERY ); - if ( xComp.is() ) - xComp->removeEventListener( this ); - - m_pIconCtrl = NULL; - m_xParent = NULL; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported ) - ; - - return pSupported != pEnd; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - static methods - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static(void) throw( RuntimeException ) - { - Sequence< ::rtl::OUString > aSupported(3); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") ); - aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") ); - aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControlEntry") ); - return aSupported; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleIconChoiceCtrlEntry::getImplementationName_Static(void) throw( RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry") ); - } - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) throw (RuntimeException) - { - EnsureIsAlive(); - return this; - } - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) throw (RuntimeException) - { - return 0; // no children - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException,RuntimeException) - { - throw IndexOutOfBoundsException(); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return m_xParent; - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - return m_nIndex; - } - // ----------------------------------------------------------------------------- - sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException) - { - return AccessibleRole::LABEL; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException) - { - // no description for every item - return ::rtl::OUString(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return implGetText(); - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) throw (RuntimeException) - { - return new utl::AccessibleRelationSetHelper; - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleStateSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xStateSet = pStateSetHelper; - - if ( IsAlive_Impl() ) - { - pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); - pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - pStateSetHelper->AddState( AccessibleStateType::ENABLED ); - pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); - if ( IsShowing_Impl() ) - { - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - } - - if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) ) - pStateSetHelper->AddState( AccessibleStateType::SELECTED ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return xStateSet; - } - // ----------------------------------------------------------------------------- - Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return implGetLocale(); - } - // ----------------------------------------------------------------------------- - // XAccessibleComponent - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException) - { - return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) - { - return Reference< XAccessible >(); - } - // ----------------------------------------------------------------------------- - awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getBounds( ) throw (RuntimeException) - { - return AWTRectangle( GetBoundingBox() ); - } - // ----------------------------------------------------------------------------- - awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocation( ) throw (RuntimeException) - { - return AWTPoint( GetBoundingBox().TopLeft() ); - } - // ----------------------------------------------------------------------------- - awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) throw (RuntimeException) - { - return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); - } - // ----------------------------------------------------------------------------- - awt::Size SAL_CALL AccessibleIconChoiceCtrlEntry::getSize( ) throw (RuntimeException) - { - return AWTSize( GetBoundingBox().GetSize() ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) throw (RuntimeException) - { - // do nothing, because no focus for each item - } - // ----------------------------------------------------------------------------- - sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; - } - // ----------------------------------------------------------------------------- - sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; - } - // ----------------------------------------------------------------------------- - // XAccessibleText - // ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- - awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( ( 0 > _nIndex ) || ( getCharacterCount() <= _nIndex ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pIconCtrl ) - { - Rectangle aItemRect = GetBoundingBox_Impl(); - Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nIndex = -1; - if ( m_pIconCtrl ) - { - ::vcl::ControlLayoutData aLayoutData; - Rectangle aItemRect = GetBoundingBox_Impl(); - m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - nIndex = aLayoutData.GetIndexForPoint( aPnt ); - - long nLen = aLayoutData.m_aUnicodeBoundRects.size(); - for ( long i = 0; i < nLen; ++i ) - { - Rectangle aRect = aLayoutData.GetCharacterBounds(i); - sal_Bool bInside = aRect.IsInside( aPnt ); - - if ( bInside ) - break; - } - } - - return nIndex; - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - String sText = getText(); - if ( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex ) - || ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) ) - throw IndexOutOfBoundsException(); - - sal_Int32 nLen = nEndIndex - nStartIndex + 1; - ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), m_pIconCtrl ); - - return sal_True; - } - // ----------------------------------------------------------------------------- - // XAccessibleEventBroadcaster - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrlEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) - { - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!m_nClientId) - m_nClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener ); - } - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleIconChoiceCtrlEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) - { - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - sal_Int32 nId = m_nClientId; - m_nClientId = 0; - comphelper::AccessibleEventNotifier::revokeClient( nId ); - } - } - } - - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) - { - return -1; - } - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getCharacter( nIndex ); - } - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getCharacterCount( ); - } - - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectedText( ); - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectionStart( ); - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectionEnd( ); - } - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getText( ); - } - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } - - // ----------------------------------------------------------------------------- - // XAccessibleAction - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // three actions supported - return ACCESSIBLE_ACTION_COUNT; - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Bool bRet = sal_False; - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); - - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry && !pEntry->IsSelected() ) - { - m_pIconCtrl->SetNoSelection(); - m_pIconCtrl->SetCursor( pEntry ); - bRet = sal_True; - } - - return bRet; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); - - static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "Select" ) ); - return sActionDesc; - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XAccessibleKeyBinding > xRet; - checkActionIndex_Impl( nIndex ); - // ... which key? - return xRet; - } -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx deleted file mode 100644 index c1311f216..000000000 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ /dev/null @@ -1,433 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - // class AccessibleListBox ----------------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleListBox) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleListBox::AccessibleListBox( SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) : - - VCLXAccessibleComponent( _rListBox.GetWindowPeer() ), - m_xParent( _xParent ) - { - DBG_CTOR( AccessibleListBox, NULL ); - } - // ----------------------------------------------------------------------------- - AccessibleListBox::~AccessibleListBox() - { - DBG_DTOR( AccessibleListBox, NULL ); - if ( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } - } - IMPLEMENT_FORWARD_XINTERFACE2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE) - IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE) - // ----------------------------------------------------------------------------- - SvTreeListBox* AccessibleListBox::getListBox() const - { - return static_cast< SvTreeListBox* >( const_cast(this)->GetWindow() ); - } - // ----------------------------------------------------------------------------- - void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - if ( isAlive() ) - { - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_CHECKBOX_TOGGLE : - { - if ( getListBox() && getListBox()->HasFocus() ) - { - SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); - if ( !pEntry ) - pEntry = getListBox()->GetCurEntry(); - - if ( pEntry ) - { - Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - } - } - break; - } - - case VCLEVENT_LISTBOX_SELECT : - { - // First send an event that tells the listeners of a - // modified selection. The active descendant event is - // send after that so that the receiving AT has time to - // read the text or name of the active child. - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - if ( getListBox() && getListBox()->HasFocus() ) - { - SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - } - } - break; - - // #i92103# - case VCLEVENT_ITEM_EXPANDED : - case VCLEVENT_ITEM_COLLAPSED : - { - SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - AccessibleListBoxEntry* pAccListBoxEntry = - new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - Reference< XAccessible > xChild = pAccListBoxEntry; - const short nAccEvent = - ( rVclWindowEvent.GetId() == VCLEVENT_ITEM_EXPANDED ) - ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED - : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; - uno::Any aListBoxEntry; - aListBoxEntry <<= xChild; - NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry ); - if ( getListBox() && getListBox()->HasFocus() ) - { - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry ); - } - } - break; - } - } - default: - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - } - } - } - // ----------------------------------------------------------------------------- - void AccessibleListBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) - { - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - { - } - break; - default: - { - VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); - } - break; - } - } - - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBox::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); - - VCLXAccessibleComponent::disposing(); - m_xParent = NULL; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBox::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL AccessibleListBox::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBox::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported ) - ; - - return pSupported != pEnd; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - static methods - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > AccessibleListBox::getSupportedServiceNames_Static(void) throw( RuntimeException ) - { - Sequence< ::rtl::OUString > aSupported(3); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") ); - aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") ); - aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTreeListBox") ); - return aSupported; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleListBox::getImplementationName_Static(void) throw( RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleTreeListBox") ); - } - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleListBox::getAccessibleContext( ) throw (RuntimeException) - { - ensureAlive(); - return this; - } - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBox::getAccessibleChildCount( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 nCount = 0; - SvTreeListBox* pSvTreeListBox = getListBox(); - if ( pSvTreeListBox ) - nCount = pSvTreeListBox->GetLevelChildCount( NULL ); - - return nCount; - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - SvLBoxEntry* pEntry = getListBox()->GetEntry(i); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - return new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleParent( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ensureAlive(); - return m_xParent; - } - // ----------------------------------------------------------------------------- - sal_Int16 SAL_CALL AccessibleListBox::getAccessibleRole( ) throw (RuntimeException) - { - return AccessibleRole::TREE; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleDescription( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - return getListBox()->GetAccessibleDescription(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleName( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - return getListBox()->GetAccessibleName(); - } - // ----------------------------------------------------------------------------- - // XAccessibleSelection - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - SvLBoxEntry* pEntry = getListBox()->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - getListBox()->Select( pEntry, sal_True ); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - SvLBoxEntry* pEntry = getListBox()->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - return getListBox()->IsSelected( pEntry ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBox::clearAccessibleSelection( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 i, nCount = 0; - nCount = getListBox()->GetLevelChildCount( NULL ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( i ); - if ( getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry, sal_False ); - } - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBox::selectAllAccessibleChildren( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 i, nCount = 0; - nCount = getListBox()->GetLevelChildCount( NULL ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( i ); - if ( !getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry, sal_True ); - } - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBox::getSelectedAccessibleChildCount( ) throw (RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - sal_Int32 i, nSelCount = 0, nCount = 0; - nCount = getListBox()->GetLevelChildCount( NULL ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( i ); - if ( getListBox()->IsSelected( pEntry ) ) - ++nSelCount; - } - - return nSelCount; - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - sal_Int32 i, nSelCount = 0, nCount = 0; - nCount = getListBox()->GetLevelChildCount( NULL ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( i ); - if ( getListBox()->IsSelected( pEntry ) ) - ++nSelCount; - - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - break; - } - } - - return xChild; - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBox::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::comphelper::OExternalLockGuard aGuard( this ); - - ensureAlive(); - - SvLBoxEntry* pEntry = getListBox()->GetEntry( nSelectedChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - getListBox()->Select( pEntry, sal_False ); - } - // ----------------------------------------------------------------------------- - void AccessibleListBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - if ( getListBox() && isAlive() ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); - if ( getListBox()->GetSelectionMode() == MULTIPLE_SELECTION ) - rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE ); - } - } - - -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx deleted file mode 100644 index a597a0ee8..000000000 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ /dev/null @@ -1,962 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/accessiblelistboxentry.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define ACCESSIBLE_ACTION_COUNT 1 - -namespace -{ - void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT ) - // only three actions - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } -} - -//........................................................................ -namespace accessibility -{ - // class AccessibleListBoxEntry ----------------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleListBoxEntry) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox, - SvLBoxEntry* _pEntry, - const Reference< XAccessible >& _xParent ) : - - AccessibleListBoxEntry_BASE ( m_aMutex ), - ListBoxAccessibleBase( _rListBox ), - - m_nClientId ( 0 ), - m_aParent ( _xParent ) - - { - DBG_CTOR( AccessibleListBoxEntry, NULL ); - - _rListBox.FillEntryPath( _pEntry, m_aEntryPath ); - } - // ----------------------------------------------------------------------------- - AccessibleListBoxEntry::~AccessibleListBoxEntry() - { - DBG_DTOR( AccessibleListBoxEntry, NULL ); - - if ( IsAlive_Impl() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } - } - - // ----------------------------------------------------------------------------- - Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const - { - Rectangle aRect; - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - aRect = getListBox()->GetBoundingRect( pEntry ); - SvLBoxEntry* pParent = getListBox()->GetParent( pEntry ); - if ( pParent ) - { - // position relative to parent entry - Point aTopLeft = aRect.TopLeft(); - aTopLeft -= getListBox()->GetBoundingRect( pParent ).TopLeft(); - aRect = Rectangle( aTopLeft, aRect.GetSize() ); - } - } - - return aRect; - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen_Impl() const - { - Rectangle aRect; - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - aRect = getListBox()->GetBoundingRect( pEntry ); - Point aTopLeft = aRect.TopLeft(); - aTopLeft += getListBox()->GetWindowExtentsRelative( NULL ).TopLeft(); - aRect = Rectangle( aTopLeft, aRect.GetSize() ); - } - - return aRect; - } - // ----------------------------------------------------------------------------- - sal_Bool AccessibleListBoxEntry::IsAlive_Impl() const - { - return ( !rBHelper.bDisposed && !rBHelper.bInDispose && isAlive() ); - } - // ----------------------------------------------------------------------------- - sal_Bool AccessibleListBoxEntry::IsShowing_Impl() const - { - Reference< XAccessible > xParent = implGetParentAccessible( ); - - sal_Bool bShowing = sal_False; - Reference< XAccessibleContext > m_xParentContext = - xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >(); - if( m_xParentContext.is() ) - { - Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) ); - } - - return bShowing; - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleListBoxEntry::GetBoundingBox() throw ( lang::DisposedException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return GetBoundingBox_Impl(); - } - // ----------------------------------------------------------------------------- - Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return GetBoundingBoxOnScreen_Impl(); - } - // ----------------------------------------------------------------------------- - void AccessibleListBoxEntry::EnsureIsAlive() const throw ( lang::DisposedException ) - { - if ( !IsAlive_Impl() ) - throw lang::DisposedException(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleListBoxEntry::implGetText() - { - ::rtl::OUString sRet; - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - sRet = getListBox()->SearchEntryText( pEntry ); - return sRet; - } - // ----------------------------------------------------------------------------- - Locale AccessibleListBoxEntry::implGetLocale() - { - Locale aLocale; - aLocale = Application::GetSettings().GetUILocale(); - - return aLocale; - } - void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } - // ----------------------------------------------------------------------------- - // XTypeProvider - // ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- - Sequence< sal_Int8 > AccessibleListBoxEntry::getImplementationId() throw (RuntimeException) - { - static ::cppu::OImplementationId* pId = NULL; - - if ( !pId ) - { - ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex ); - - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); - } - - // ----------------------------------------------------------------------------- - // XComponent/ListBoxAccessibleBase - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::dispose() throw ( uno::RuntimeException ) - { - AccessibleListBoxEntry_BASE::dispose(); - } - - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::disposing() - { - SolarMutexGuard(); - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XAccessible > xKeepAlive( this ); - - // Send a disposing to all listeners. - if ( m_nClientId ) - { - ::comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId; - m_nClientId = 0; - ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); - } - - // clean up - { - - ListBoxAccessibleBase::disposing(); - } - m_aParent = WeakReference< XAccessible >(); - } - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported ) - ; - - return pSupported != pEnd; - } - // ----------------------------------------------------------------------------- - // XServiceInfo - static methods - // ----------------------------------------------------------------------------- - Sequence< ::rtl::OUString > AccessibleListBoxEntry::getSupportedServiceNames_Static(void) throw( RuntimeException ) - { - Sequence< ::rtl::OUString > aSupported(3); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") ); - aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") ); - aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTreeListBoxEntry") ); - return aSupported; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleListBoxEntry::getImplementationName_Static(void) throw( RuntimeException ) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleTreeListBoxEntry") ); - } - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext( ) throw (RuntimeException) - { - EnsureIsAlive(); - return this; - } - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - sal_Int32 nCount = 0; - if ( pEntry ) - nCount = getListBox()->GetLevelChildCount( pEntry ); - - return nCount; - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL; - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - return new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - } - - // ----------------------------------------------------------------------------- - Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const - { - Reference< XAccessible > xParent = (Reference< XAccessible >)m_aParent; - if ( !xParent.is() ) - { - DBG_ASSERT( m_aEntryPath.size(), "AccessibleListBoxEntry::getAccessibleParent: invalid path!" ); - if ( 1 == m_aEntryPath.size() ) - { // we're a top level entry - // -> our parent is the tree listbox itself - if ( getListBox() ) - xParent = getListBox()->GetAccessible( ); - } - else - { // we have a entry as parent -> get it's accessible - - // shorten our access path by one - ::std::deque< sal_Int32 > aParentPath( m_aEntryPath ); - aParentPath.pop_back(); - - // get the entry for this shortened access path - SvLBoxEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - DBG_ASSERT( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" ); - - if ( pParentEntry ) - xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, NULL ); - // note that we pass NULL here as parent-accessible: - // this is allowed, as the AccessibleListBoxEntry class will create it's parent - // when needed - } - } - - return xParent; - } - - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - return implGetParentAccessible( ); - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - DBG_ASSERT( !m_aEntryPath.empty(), "empty path" ); - return m_aEntryPath.empty() ? -1 : m_aEntryPath.back(); - } - // ----------------------------------------------------------------------------- - sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( ) throw (RuntimeException) - { - return AccessibleRole::LABEL; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) throw (RuntimeException) - { - // no description for every item - return ::rtl::OUString(); - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - return implGetText(); - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) throw (RuntimeException) - { - Reference< XAccessibleRelationSet > xRelSet; - Reference< XAccessible > xParent; - if ( m_aEntryPath.size() > 1 ) // not a root entry - xParent = implGetParentAccessible(); - if ( xParent.is() ) - { - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Sequence< Reference< XInterface > > aSequence(1); - aSequence[0] = xParent; - pRelationSetHelper->AddRelation( - AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) ); - xRelSet = pRelationSetHelper; - } - return xRelSet; - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleStateSet > SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xStateSet = pStateSetHelper; - - if ( IsAlive_Impl() ) - { - pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); - pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - pStateSetHelper->AddState( AccessibleStateType::ENABLED ); - pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); - if ( getListBox()->IsInplaceEditingEnabled() ) - pStateSetHelper->AddState( AccessibleStateType::EDITABLE ); - if ( IsShowing_Impl() ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - getListBox()->FillAccessibleEntryStateSet( - getListBox()->GetEntryFromPath( m_aEntryPath ), *pStateSetHelper ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return xStateSet; - } - // ----------------------------------------------------------------------------- - Locale SAL_CALL AccessibleListBoxEntry::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return implGetLocale(); - } - // ----------------------------------------------------------------------------- - // XAccessibleComponent - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBoxEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException) - { - return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - SvLBoxEntry* pEntry = getListBox()->GetEntry( VCLPoint( _aPoint ) ); - if ( !pEntry ) - throw RuntimeException(); - - Reference< XAccessible > xAcc; - AccessibleListBoxEntry* pAccEntry = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - Rectangle aRect = pAccEntry->GetBoundingBox_Impl(); - if ( aRect.IsInside( VCLPoint( _aPoint ) ) ) - xAcc = pAccEntry; - return xAcc; - } - // ----------------------------------------------------------------------------- - awt::Rectangle SAL_CALL AccessibleListBoxEntry::getBounds( ) throw (RuntimeException) - { - return AWTRectangle( GetBoundingBox() ); - } - // ----------------------------------------------------------------------------- - awt::Point SAL_CALL AccessibleListBoxEntry::getLocation( ) throw (RuntimeException) - { - return AWTPoint( GetBoundingBox().TopLeft() ); - } - // ----------------------------------------------------------------------------- - awt::Point SAL_CALL AccessibleListBoxEntry::getLocationOnScreen( ) throw (RuntimeException) - { - return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); - } - // ----------------------------------------------------------------------------- - awt::Size SAL_CALL AccessibleListBoxEntry::getSize( ) throw (RuntimeException) - { - return AWTSize( GetBoundingBox().GetSize() ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::grabFocus( ) throw (RuntimeException) - { - // do nothing, because no focus for each item - } - // ----------------------------------------------------------------------------- - sal_Int32 AccessibleListBoxEntry::getForeground( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; - } - // ----------------------------------------------------------------------------- - sal_Int32 AccessibleListBoxEntry::getBackground( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; - } - // ----------------------------------------------------------------------------- - // XAccessibleText - // ----------------------------------------------------------------------------- - // ----------------------------------------------------------------------------- - awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - ::vcl::ControlLayoutData aLayoutData; - Rectangle aItemRect = GetBoundingBox(); - getListBox()->RecordLayoutData( &aLayoutData, aItemRect ); - Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - sal_Int32 nIndex = -1; - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - ::vcl::ControlLayoutData aLayoutData; - Rectangle aItemRect = GetBoundingBox(); - getListBox()->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - nIndex = aLayoutData.GetIndexForPoint( aPnt ); - } - - return nIndex; - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - String sText = getText(); - if ( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex ) - || ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) ) - throw IndexOutOfBoundsException(); - - sal_Int32 nLen = nEndIndex - nStartIndex + 1; - ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), getListBox() ); - - return sal_True; - } - // ----------------------------------------------------------------------------- - // XAccessibleEventBroadcaster - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) - { - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!m_nClientId) - m_nClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener ); - } - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) - { - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - sal_Int32 nId = m_nClientId; - m_nClientId = 0; - comphelper::AccessibleEventNotifier::revokeClient( nId ); - - } - } - } - // ----------------------------------------------------------------------------- - // XAccessibleAction - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // three actions supported - return ACCESSIBLE_ACTION_COUNT; - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Bool bRet = sal_False; - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); - - SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - if ( getListBox()->IsExpanded( pEntry ) ) - getListBox()->Collapse( pEntry ); - else - getListBox()->Expand( pEntry ); - bRet = sal_True; - } - - return bRet; - } - // ----------------------------------------------------------------------------- - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); - - static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "toggleExpand" ) ); - return sActionDesc; - } - // ----------------------------------------------------------------------------- - Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XAccessibleKeyBinding > xRet; - checkActionIndex_Impl( nIndex ); - // ... which key? - return xRet; - } - // ----------------------------------------------------------------------------- - // XAccessibleSelection - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - getListBox()->Select( pEntry, sal_True ); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - return getListBox()->IsSelected( pEntry ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(); - sal_Int32 i, nCount = 0; - nCount = getListBox()->GetLevelChildCount( pParent ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i ); - if ( getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry, sal_False ); - } - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(); - sal_Int32 i, nCount = 0; - nCount = getListBox()->GetLevelChildCount( pParent ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i ); - if ( !getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry, sal_True ); - } - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - sal_Int32 i, nSelCount = 0, nCount = 0; - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(); - nCount = getListBox()->GetLevelChildCount( pParent ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i ); - if ( getListBox()->IsSelected( pEntry ) ) - ++nSelCount; - } - - return nSelCount; - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - sal_Int32 i, nSelCount = 0, nCount = 0; - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(); - nCount = getListBox()->GetLevelChildCount( pParent ); - for ( i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i ); - if ( getListBox()->IsSelected( pEntry ) ) - ++nSelCount; - - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - break; - } - } - - return xChild; - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - - SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath ); - SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nSelectedChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); - - getListBox()->Select( pEntry, sal_False ); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) - { - return -1; - } - sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getCharacter( nIndex ); - } - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getCharacterCount( ); - } - - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectedText( ); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectionStart( ); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getSelectionEnd( ); - } - sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; - } - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getText( ) throw (::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getText( ); - } - ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx deleted file mode 100644 index ba319541d..000000000 --- a/accessibility/source/extended/accessibletabbar.cxx +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::accessibility; - using namespace ::comphelper; - - DBG_NAME( AccessibleTabBar ) - - // ---------------------------------------------------- - // class AccessibleTabBar - // ---------------------------------------------------- - - AccessibleTabBar::AccessibleTabBar( TabBar* pTabBar ) - :AccessibleTabBarBase( pTabBar ) - { - DBG_CTOR( AccessibleTabBar, NULL ); - - if ( m_pTabBar ) - m_aAccessibleChildren.assign( m_pTabBar->GetAccessibleChildWindowCount() + 1, Reference< XAccessible >() ); - } - - // ----------------------------------------------------------------------------- - - AccessibleTabBar::~AccessibleTabBar() - { - DBG_DTOR( AccessibleTabBar, NULL ); - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - Any aOldValue, aNewValue; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_ENABLED: - { - aNewValue <<= AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - aNewValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_DISABLED: - { - aOldValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - aOldValue <<= AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_GETFOCUS: - { - aNewValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - { - aOldValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_SHOW: - { - aNewValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_HIDE: - { - aOldValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - default: - { - AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent ); - } - break; - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) - { - if ( m_pTabBar ) - { - if ( m_pTabBar->IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( m_pTabBar->HasFocus() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - if ( m_pTabBar->IsVisible() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); - - if ( m_pTabBar->GetStyle() & WB_SIZEABLE ) - rStateSet.AddState( AccessibleStateType::RESIZABLE ); - } - } - - // ----------------------------------------------------------------------------- - // OCommonAccessibleComponent - // ----------------------------------------------------------------------------- - - awt::Rectangle AccessibleTabBar::implGetBounds() throw (RuntimeException) - { - awt::Rectangle aBounds; - if ( m_pTabBar ) - aBounds = AWTRectangle( Rectangle( m_pTabBar->GetPosPixel(), m_pTabBar->GetSizePixel() ) ); - - return aBounds; - } - - // ----------------------------------------------------------------------------- - // XInterface - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE ) - - // ----------------------------------------------------------------------------- - // XTypeProvider - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE ) - - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - - void AccessibleTabBar::disposing() - { - AccessibleTabBarBase::disposing(); - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBar::getImplementationName() throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleTabBar" )); - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBar::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > AccessibleTabBar::getSupportedServiceNames() throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleTabBar" )); - return aNames; - } - - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - - Reference< XAccessibleContext > AccessibleTabBar::getAccessibleContext( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return this; - } - - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBar::getAccessibleChildCount() throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_aAccessibleChildren.size(); - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - { - if ( m_pTabBar ) - { - sal_Int32 nCount = m_pTabBar->GetAccessibleChildWindowCount(); - - if ( i < nCount ) - { - Window* pChild = m_pTabBar->GetAccessibleChildWindow( (sal_uInt16)i ); - if ( pChild ) - xChild = pChild->GetAccessible(); - } - else if ( i == nCount ) - { - xChild = new AccessibleTabBarPageList( m_pTabBar, i ); - } - - // insert into child list - m_aAccessibleChildren[i] = xChild; - } - } - - return xChild; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBar::getAccessibleParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pTabBar ) - { - Window* pParent = m_pTabBar->GetAccessibleParentWindow(); - if ( pParent ) - xParent = pParent->GetAccessible(); - } - - return xParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBar::getAccessibleIndexInParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - if ( m_pTabBar ) - { - Window* pParent = m_pTabBar->GetAccessibleParentWindow(); - if ( pParent ) - { - for ( sal_uInt16 i = 0, nCount = pParent->GetAccessibleChildWindowCount(); i < nCount; ++i ) - { - Window* pChild = pParent->GetAccessibleChildWindow( i ); - if ( pChild == static_cast< Window* >( m_pTabBar ) ) - { - nIndexInParent = i; - break; - } - } - } - } - - return nIndexInParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int16 AccessibleTabBar::getAccessibleRole( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PANEL; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBar::getAccessibleDescription( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pTabBar ) - sDescription = m_pTabBar->GetAccessibleDescription(); - - return sDescription; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBar::getAccessibleName( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sName; - if ( m_pTabBar ) - sName = m_pTabBar->GetAccessibleName(); - - return sName; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleRelationSet > AccessibleTabBar::getAccessibleRelationSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleStateSet > AccessibleTabBar::getAccessibleStateSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; - } - - // ----------------------------------------------------------------------------- - - Locale AccessibleTabBar::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); - } - - // ----------------------------------------------------------------------------- - // XAccessibleComponent - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBar::grabFocus( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( m_pTabBar ) - m_pTabBar->GrabFocus(); - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBar::getForeground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pTabBar ) - { - if ( m_pTabBar->IsControlForeground() ) - nColor = m_pTabBar->GetControlForeground().GetColor(); - else - { - Font aFont; - if ( m_pTabBar->IsControlFont() ) - aFont = m_pTabBar->GetControlFont(); - else - aFont = m_pTabBar->GetFont(); - nColor = aFont.GetColor().GetColor(); - } - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBar::getBackground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pTabBar ) - { - if ( m_pTabBar->IsControlBackground() ) - nColor = m_pTabBar->GetControlBackground().GetColor(); - else - nColor = m_pTabBar->GetBackground().GetColor().GetColor(); - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - // XAccessibleExtendedComponent - // ----------------------------------------------------------------------------- - - Reference< awt::XFont > AccessibleTabBar::getFont( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - if ( m_pTabBar ) - { - Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - Font aFont; - if ( m_pTabBar->IsControlFont() ) - aFont = m_pTabBar->GetControlFont(); - else - aFont = m_pTabBar->GetFont(); - VCLXFont* pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev.get(), aFont ); - xFont = pVCLXFont; - } - } - - return xFont; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBar::getTitledBorderText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText; - if ( m_pTabBar ) - sText = m_pTabBar->GetText(); - - return sText; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBar::getToolTipText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText; - if ( m_pTabBar ) - sText = m_pTabBar->GetQuickHelpText(); - - return sText; - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace accessibility -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletabbarbase.cxx b/accessibility/source/extended/accessibletabbarbase.cxx deleted file mode 100644 index 8c485c4f3..000000000 --- a/accessibility/source/extended/accessibletabbarbase.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include "accessibility/extended/accessibletabbarbase.hxx" -#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST -#include "accessibility/extended/accessibletabbarpagelist.hxx" -#endif -#include -#include - -//......................................................................... -namespace accessibility -{ -//......................................................................... - -AccessibleTabBarBase::AccessibleTabBarBase( TabBar* pTabBar ) : - AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ), - m_pTabBar( 0 ) -{ - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - SetTabBarPointer( pTabBar ); -} - -AccessibleTabBarBase::~AccessibleTabBarBase() -{ - ClearTabBarPointer(); - DELETEZ( m_pExternalLock ); -} - -IMPL_LINK( AccessibleTabBarBase, WindowEventListener, VclSimpleEvent*, pEvent ) -{ - VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent ); - DBG_ASSERT( pWinEvent, "AccessibleTabBarBase::WindowEventListener - unknown window event" ); - if( pWinEvent ) - { - Window* pEventWindow = pWinEvent->GetWindow(); - DBG_ASSERT( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" ); - - if( ( pWinEvent->GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) && - ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TabBar::PAGE_NOT_FOUND ) && - ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) ) - { - return 0; - } - - if ( !pEventWindow->IsAccessibilityEventsSuppressed() || (pWinEvent->GetId() == VCLEVENT_OBJECT_DYING) ) - ProcessWindowEvent( *pWinEvent ); - } - return 0; -} - -void AccessibleTabBarBase::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - if( rVclWindowEvent.GetId() == VCLEVENT_OBJECT_DYING ) - ClearTabBarPointer(); -} - -// XComponent - -void AccessibleTabBarBase::disposing() -{ - AccessibleExtendedComponentHelper_BASE::disposing(); - ClearTabBarPointer(); -} - -// private - -void AccessibleTabBarBase::SetTabBarPointer( TabBar* pTabBar ) -{ - DBG_ASSERT( !m_pTabBar, "AccessibleTabBarBase::SetTabBarPointer - multiple call" ); - m_pTabBar = pTabBar; - if( m_pTabBar ) - m_pTabBar->AddEventListener( LINK( this, AccessibleTabBarBase, WindowEventListener ) ); -} - -void AccessibleTabBarBase::ClearTabBarPointer() -{ - if( m_pTabBar ) - { - m_pTabBar->RemoveEventListener( LINK( this, AccessibleTabBarBase, WindowEventListener ) ); - m_pTabBar = 0; - } -} - -//......................................................................... -} // namespace accessibility -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx deleted file mode 100644 index f3a4084c5..000000000 --- a/accessibility/source/extended/accessibletabbarpage.cxx +++ /dev/null @@ -1,514 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - using namespace ::comphelper; - - // ----------------------------------------------------------------------------- - // class AccessibleTabBarPage - // ----------------------------------------------------------------------------- - - AccessibleTabBarPage::AccessibleTabBarPage( TabBar* pTabBar, sal_uInt16 nPageId, const Reference< XAccessible >& rxParent ) - :AccessibleTabBarBase( pTabBar ) - ,m_nPageId( nPageId ) - ,m_xParent( rxParent ) - { - m_bEnabled = IsEnabled(); - m_bShowing = IsShowing(); - m_bSelected = IsSelected(); - - if ( m_pTabBar ) - m_sPageText = m_pTabBar->GetPageText( m_nPageId ); - } - - // ----------------------------------------------------------------------------- - - AccessibleTabBarPage::~AccessibleTabBarPage() - { - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPage::IsEnabled() - { - OExternalLockGuard aGuard( this ); - - sal_Bool bEnabled = sal_False; - if ( m_pTabBar ) - bEnabled = m_pTabBar->IsPageEnabled( m_nPageId ); - - return bEnabled; - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPage::IsShowing() - { - sal_Bool bShowing = sal_False; - - if ( m_pTabBar && m_pTabBar->IsVisible() ) - bShowing = sal_True; - - return bShowing; - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPage::IsSelected() - { - sal_Bool bSelected = sal_False; - - if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_nPageId ) - bSelected = sal_True; - - return bSelected; - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::SetEnabled( sal_Bool bEnabled ) - { - if ( m_bEnabled != bEnabled ) - { - Any aOldValue[2], aNewValue[2]; - if ( m_bEnabled ) - { - aOldValue[0] <<= AccessibleStateType::SENSITIVE; - aOldValue[1] <<= AccessibleStateType::ENABLED; - } - else - { - - aNewValue[0] <<= AccessibleStateType::ENABLED; - aNewValue[1] <<= AccessibleStateType::SENSITIVE; - } - m_bEnabled = bEnabled; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] ); - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] ); - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::SetShowing( sal_Bool bShowing ) - { - if ( m_bShowing != bShowing ) - { - Any aOldValue, aNewValue; - if ( m_bShowing ) - aOldValue <<= AccessibleStateType::SHOWING; - else - aNewValue <<= AccessibleStateType::SHOWING; - m_bShowing = bShowing; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::SetSelected( sal_Bool bSelected ) - { - if ( m_bSelected != bSelected ) - { - Any aOldValue, aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::SetPageText( const ::rtl::OUString& sPageText ) - { - if ( !m_sPageText.equals( sPageText ) ) - { - Any aOldValue, aNewValue; - aOldValue <<= m_sPageText; - aNewValue <<= sPageText; - m_sPageText = sPageText; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) - { - if ( IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - if ( IsShowing() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); - - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - - if ( IsSelected() ) - rStateSet.AddState( AccessibleStateType::SELECTED ); - } - - // ----------------------------------------------------------------------------- - // OCommonAccessibleComponent - // ----------------------------------------------------------------------------- - - awt::Rectangle AccessibleTabBarPage::implGetBounds() throw (RuntimeException) - { - awt::Rectangle aBounds; - if ( m_pTabBar ) - { - // get bounding rectangle relative to the AccessibleTabBar - aBounds = AWTRectangle( m_pTabBar->GetPageRect( m_nPageId ) ); - - // get position of the AccessibleTabBarPageList relative to the AccessibleTabBar - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComponent.is() ) - { - awt::Point aParentLoc = xParentComponent->getLocation(); - - // calculate bounding rectangle relative to the AccessibleTabBarPageList - aBounds.X -= aParentLoc.X; - aBounds.Y -= aParentLoc.Y; - } - } - } - - return aBounds; - } - - // ----------------------------------------------------------------------------- - // XInterface - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPage, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPage_BASE ) - - // ----------------------------------------------------------------------------- - // XTypeProvider - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPage, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPage_BASE ) - - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::disposing() - { - AccessibleTabBarBase::disposing(); - m_sPageText = ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPage::getImplementationName() throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleTabBarPage" )); - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPage::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > AccessibleTabBarPage::getSupportedServiceNames() throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleTabBarPage" )); - return aNames; - } - - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - - Reference< XAccessibleContext > AccessibleTabBarPage::getAccessibleContext( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return this; - } - - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPage::getAccessibleChildCount() throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return 0; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPage::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPage::getAccessibleParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_xParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPage::getAccessibleIndexInParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - if ( m_pTabBar ) - nIndexInParent = m_pTabBar->GetPagePos( m_nPageId ); - - return nIndexInParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int16 AccessibleTabBarPage::getAccessibleRole( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PAGE_TAB; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPage::getAccessibleDescription( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pTabBar ) - sDescription = m_pTabBar->GetHelpText( m_nPageId ); - - return sDescription; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPage::getAccessibleName( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_sPageText; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleRelationSet > AccessibleTabBarPage::getAccessibleRelationSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleStateSet > AccessibleTabBarPage::getAccessibleStateSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; - } - - // ----------------------------------------------------------------------------- - - Locale AccessibleTabBarPage::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); - } - - // ----------------------------------------------------------------------------- - // XAccessibleComponent - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPage::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return Reference< XAccessible >(); - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPage::grabFocus( ) throw (RuntimeException) - { - // no focus - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPage::getForeground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPage::getBackground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - // XAccessibleExtendedComponent - // ----------------------------------------------------------------------------- - - Reference< awt::XFont > AccessibleTabBarPage::getFont( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPage::getTitledBorderText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_sPageText; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPage::getToolTipText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace accessibility -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx deleted file mode 100644 index 31073238c..000000000 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ /dev/null @@ -1,808 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//......................................................................... -namespace accessibility -{ -//......................................................................... - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - using namespace ::comphelper; - - DBG_NAME( AccessibleTabBarPageList ) - - // ----------------------------------------------------------------------------- - // class AccessibleTabBarPageList - // ----------------------------------------------------------------------------- - - AccessibleTabBarPageList::AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent ) - :AccessibleTabBarBase( pTabBar ) - ,m_nIndexInParent( nIndexInParent ) - { - DBG_CTOR( AccessibleTabBarPageList, NULL ); - if ( m_pTabBar ) - m_aAccessibleChildren.assign( m_pTabBar->GetPageCount(), Reference< XAccessible >() ); - } - - // ----------------------------------------------------------------------------- - - AccessibleTabBarPageList::~AccessibleTabBarPageList() - { - DBG_DTOR( AccessibleTabBarPageList, NULL ); - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ) - { - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() ); - if ( pAccessibleTabBarPage ) - pAccessibleTabBarPage->SetEnabled( bEnabled ); - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::UpdateShowing( sal_Bool bShowing ) - { - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() ); - if ( pAccessibleTabBarPage ) - pAccessibleTabBarPage->SetShowing( bShowing ); - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::UpdateSelected( sal_Int32 i, sal_Bool bSelected ) - { - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() ); - if ( pAccessibleTabBarPage ) - pAccessibleTabBarPage->SetSelected( bSelected ); - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::UpdatePageText( sal_Int32 i ) - { - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() ); - if ( pAccessibleTabBarPage ) - { - if ( m_pTabBar ) - { - ::rtl::OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( (sal_uInt16)i ) ); - pAccessibleTabBarPage->SetPageText( sPageText ); - } - } - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::InsertChild( sal_Int32 i ) - { - if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() ) - { - // insert entry in child list - m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() ); - - // send accessible child event - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::RemoveChild( sal_Int32 i ) - { - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - // get the accessible of the removed page - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - - // remove entry in child list - m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::MoveChild( sal_Int32 i, sal_Int32 j ) - { - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() && - j >= 0 && j <= (sal_Int32)m_aAccessibleChildren.size() ) - { - if ( i < j ) - --j; - - // get the accessible of the moved page - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - - // remove entry in child list at old position - m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); - - // insert entry in child list at new position - m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + j, xChild ); - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_ENABLED: - { - Any aNewValue; - aNewValue <<= AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue ); - aNewValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue ); - } - break; - case VCLEVENT_WINDOW_DISABLED: - { - Any aOldValue; - aOldValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() ); - aOldValue <<= AccessibleStateType::SENSITIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() ); - } - break; - case VCLEVENT_WINDOW_SHOW: - { - Any aOldValue, aNewValue; - aNewValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - UpdateShowing( sal_True ); - } - break; - case VCLEVENT_WINDOW_HIDE: - { - Any aOldValue, aNewValue; - aOldValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - UpdateShowing( sal_False ); - } - break; - case VCLEVENT_TABBAR_PAGEENABLED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - UpdateEnabled( nPagePos, sal_True ); - } - } - break; - case VCLEVENT_TABBAR_PAGEDISABLED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - UpdateEnabled( nPagePos, sal_False ); - } - } - break; - case VCLEVENT_TABBAR_PAGESELECTED: - { - // do nothing - } - break; - case VCLEVENT_TABBAR_PAGEACTIVATED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - UpdateSelected( nPagePos, sal_True ); - } - } - break; - case VCLEVENT_TABBAR_PAGEDEACTIVATED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - UpdateSelected( nPagePos, sal_False ); - } - } - break; - case VCLEVENT_TABBAR_PAGEINSERTED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - InsertChild( nPagePos ); - } - } - break; - case VCLEVENT_TABBAR_PAGEREMOVED: - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - - if ( nPageId == TabBar::PAGE_NOT_FOUND ) - { - for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) - RemoveChild( i ); - } - else - { - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() ); - if ( pAccessibleTabBarPage && pAccessibleTabBarPage->GetPageId() == nPageId ) - { - RemoveChild( i ); - break; - } - } - } - } - } - } - break; - case VCLEVENT_TABBAR_PAGEMOVED: - { - Pair* pPair = (Pair*) rVclWindowEvent.GetData(); - if ( pPair ) - MoveChild( pPair->A(), pPair->B() ); - } - break; - case VCLEVENT_TABBAR_PAGETEXTCHANGED: - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId ); - UpdatePageText( nPagePos ); - } - break; - default: - { - AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent ); - } - break; - } - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) - { - if ( m_pTabBar ) - { - if ( m_pTabBar->IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - if ( m_pTabBar->IsVisible() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); - } - } - - // ----------------------------------------------------------------------------- - // OCommonAccessibleComponent - // ----------------------------------------------------------------------------- - - awt::Rectangle AccessibleTabBarPageList::implGetBounds() throw (RuntimeException) - { - awt::Rectangle aBounds; - if ( m_pTabBar ) - aBounds = AWTRectangle( m_pTabBar->GetPageArea() ); - - return aBounds; - } - - // ----------------------------------------------------------------------------- - // XInterface - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE ) - - // ----------------------------------------------------------------------------- - // XTypeProvider - // ----------------------------------------------------------------------------- - - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE ) - - // ----------------------------------------------------------------------------- - // XComponent - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::disposing() - { - AccessibleTabBarBase::disposing(); - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPageList::getImplementationName() throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleTabBarPageList" )); - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPageList::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; - } - - // ----------------------------------------------------------------------------- - - Sequence< ::rtl::OUString > AccessibleTabBarPageList::getSupportedServiceNames() throw (RuntimeException) - { - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleTabBarPageList" )); - return aNames; - } - - // ----------------------------------------------------------------------------- - // XAccessible - // ----------------------------------------------------------------------------- - - Reference< XAccessibleContext > AccessibleTabBarPageList::getAccessibleContext( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return this; - } - - // ----------------------------------------------------------------------------- - // XAccessibleContext - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPageList::getAccessibleChildCount() throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_aAccessibleChildren.size(); - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPageList::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - { - if ( m_pTabBar ) - { - sal_uInt16 nPageId = m_pTabBar->GetPageId( (sal_uInt16)i ); - - xChild = new AccessibleTabBarPage( m_pTabBar, nPageId, this ); - - // insert into child list - m_aAccessibleChildren[i] = xChild; - } - } - - return xChild; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPageList::getAccessibleParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pTabBar ) - xParent = m_pTabBar->GetAccessible(); - - return xParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPageList::getAccessibleIndexInParent( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return m_nIndexInParent; - } - - // ----------------------------------------------------------------------------- - - sal_Int16 AccessibleTabBarPageList::getAccessibleRole( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PAGE_TAB_LIST; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPageList::getAccessibleDescription( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPageList::getAccessibleName( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleRelationSet > AccessibleTabBarPageList::getAccessibleRelationSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessibleStateSet > AccessibleTabBarPageList::getAccessibleStateSet( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; - } - - // ----------------------------------------------------------------------------- - - Locale AccessibleTabBarPageList::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); - } - - // ----------------------------------------------------------------------------- - // XAccessibleComponent - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPageList::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::grabFocus( ) throw (RuntimeException) - { - // no focus - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPageList::getForeground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPageList::getBackground( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; - } - - // ----------------------------------------------------------------------------- - // XAccessibleExtendedComponent - // ----------------------------------------------------------------------------- - - Reference< awt::XFont > AccessibleTabBarPageList::getFont( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPageList::getTitledBorderText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - - ::rtl::OUString AccessibleTabBarPageList::getToolTipText( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); - } - - // ----------------------------------------------------------------------------- - // XAccessibleSelection - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - if ( m_pTabBar ) - { - m_pTabBar->SetCurPageId( m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) ); - m_pTabBar->Update(); - m_pTabBar->ActivatePage(); - m_pTabBar->Select(); - } - } - - // ----------------------------------------------------------------------------- - - sal_Bool AccessibleTabBarPageList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - sal_Bool bSelected = sal_False; - if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) ) - bSelected = sal_True; - - return bSelected; - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::clearAccessibleSelection( ) throw (RuntimeException) - { - // This method makes no sense in a TabBar, and so does nothing. - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::selectAllAccessibleChildren( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - selectAccessibleChild( 0 ); - } - - // ----------------------------------------------------------------------------- - - sal_Int32 AccessibleTabBarPageList::getSelectedAccessibleChildCount( ) throw (RuntimeException) - { - OExternalLockGuard aGuard( this ); - - return 1; - } - - // ----------------------------------------------------------------------------- - - Reference< XAccessible > AccessibleTabBarPageList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = getAccessibleChild( i ); - break; - } - } - - return xChild; - } - - // ----------------------------------------------------------------------------- - - void AccessibleTabBarPageList::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - // This method makes no sense in a TabBar, and so does nothing. - } - - // ----------------------------------------------------------------------------- - -//......................................................................... -} // namespace accessibility -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletablistbox.cxx b/accessibility/source/extended/accessibletablistbox.cxx deleted file mode 100644 index a50001d59..000000000 --- a/accessibility/source/extended/accessibletablistbox.cxx +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/accessibletablistbox.hxx" -#include "accessibility/extended/accessibletablistboxtable.hxx" -#include -#include - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - // class AccessibleTabListBox ----------------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleTabListBox) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) - :AccessibleBrowseBox( rxParent, NULL, rBox ) - ,m_pTabListBox( &rBox ) - - { - DBG_CTOR( AccessibleTabListBox, NULL ); - - osl_incrementInterlockedCount( &m_refCount ); - { - setCreator( this ); - } - osl_decrementInterlockedCount( &m_refCount ); - } - - // ----------------------------------------------------------------------------- - AccessibleTabListBox::~AccessibleTabListBox() - { - DBG_DTOR( AccessibleTabListBox, NULL ); - - if ( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } - } - // ----------------------------------------------------------------------------- - AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable() - { - return new AccessibleTabListBoxTable( this, *m_pTabListBox ); - } - - // XInterface ----------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) - - // XTypeProvider -------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) - - // XAccessibleContext --------------------------------------------------------- - - sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount() - throw ( uno::RuntimeException ) - { - return 2; // header and table - } - - // ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException ) - { - return this; - } - - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL - AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex ) - throw ( IndexOutOfBoundsException, RuntimeException ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - ensureIsAlive(); - - if ( nChildIndex < 0 || nChildIndex > 1 ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xRet; - if (nChildIndex == 0) - { - //! so far the actual implementation object only supports column headers - xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR ); - } - else if (nChildIndex == 1) - xRet = implGetFixedChild( ::svt::BBINDEX_TABLE ); - - if ( !xRet.is() ) - throw RuntimeException(); - - return xRet; - } - -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/accessibletablistboxtable.cxx b/accessibility/source/extended/accessibletablistboxtable.cxx deleted file mode 100644 index ae793039a..000000000 --- a/accessibility/source/extended/accessibletablistboxtable.cxx +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include "accessibility/extended/accessibletablistboxtable.hxx" -#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx" -#include "accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx" -#include -#include - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - // class AccessibleTabListBoxTable --------------------------------------------- - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - - DBG_NAME(AccessibleTabListBoxTable) - - // ----------------------------------------------------------------------------- - // Ctor() and Dtor() - // ----------------------------------------------------------------------------- - AccessibleTabListBoxTable::AccessibleTabListBoxTable( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) : - - AccessibleBrowseBoxTable( rxParent, rBox ), - - m_pTabListBox ( &rBox ) - - { - DBG_CTOR( AccessibleTabListBoxTable, NULL ); - - m_pTabListBox->AddEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); - } - // ----------------------------------------------------------------------------- - AccessibleTabListBoxTable::~AccessibleTabListBoxTable() - { - DBG_DTOR( AccessibleTabListBoxTable, NULL ); - - if ( isAlive() ) - { - m_pTabListBox = NULL; - - // increment ref count to prevent double call of Dtor - osl_incrementInterlockedCount( &m_refCount ); - dispose(); - } - } - // ----------------------------------------------------------------------------- - void AccessibleTabListBoxTable::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - if ( isAlive() ) - { - sal_uLong nEventId = rVclWindowEvent.GetId(); - switch ( nEventId ) - { - case VCLEVENT_OBJECT_DYING : - { - m_pTabListBox->RemoveEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); - m_pTabListBox = NULL; - break; - } - - case VCLEVENT_CONTROL_GETFOCUS : - case VCLEVENT_CONTROL_LOSEFOCUS : - { - uno::Any aOldValue, aNewValue; - if ( VCLEVENT_CONTROL_GETFOCUS == nEventId ) - aNewValue <<= AccessibleStateType::FOCUSED; - else - aOldValue <<= AccessibleStateType::FOCUSED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - break; - } - - case VCLEVENT_LISTBOX_SELECT : - { - // First send an event that tells the listeners of a - // modified selection. The active descendant event is - // send after that so that the receiving AT has time to - // read the text or name of the active child. - commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - if ( m_pTabListBox && m_pTabListBox->HasFocus() ) - { - SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); - Reference< XAccessible > xChild = - m_pTabListBox->CreateAccessibleCell( nRow, nCol ); - uno::Any aOldValue, aNewValue; - - if ( m_pTabListBox->IsTransientChildrenDisabled() ) - { - aNewValue <<= AccessibleStateType::FOCUSED; - TriState eState = STATE_DONTKNOW; - if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) ) - { - AccessibleCheckBoxCell* pCell = - static_cast< AccessibleCheckBoxCell* >( xChild.get() ); - pCell->commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - } - else - { - AccessibleBrowseBoxTableCell* pCell = - static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() ); - pCell->commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - } - } - else - { - aNewValue <<= xChild; - commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue, aOldValue ); - } - } - } - break; - } - - case VCLEVENT_CHECKBOX_TOGGLE : - { - if ( m_pTabListBox && m_pTabListBox->HasFocus() ) - { - SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); - TriState eState = STATE_DONTKNOW; - if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) ) - { - Reference< XAccessible > xChild = - m_pTabListBox->CreateAccessibleCell( nRow, nCol ); - AccessibleCheckBoxCell* pCell = - static_cast< AccessibleCheckBoxCell* >( xChild.get() ); - pCell->SetChecked( m_pTabListBox->IsItemChecked( pEntry, nCol ) ); - } - } - } - break; - } - - case VCLEVENT_TABLECELL_NAMECHANGED : - { - if ( m_pTabListBox->IsTransientChildrenDisabled() ) - { - commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - TabListBoxEventData* pData = static_cast< TabListBoxEventData* >( rVclWindowEvent.GetData() ); - SvLBoxEntry* pEntry = pData != NULL ? pData->m_pEntry : NULL; - if ( pEntry ) - { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - sal_uInt16 nCol = pData->m_nColumn; - Reference< XAccessible > xChild = - m_pTabListBox->CreateAccessibleCell( nRow, nCol ); - uno::Any aOldValue, aNewValue; - aOldValue <<= ::rtl::OUString( pData->m_sOldText ); - ::rtl::OUString sNewText( m_pTabListBox->GetCellText( nRow, nCol ) ); - aNewValue <<= sNewText; - TriState eState = STATE_DONTKNOW; - - if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) ) - { - AccessibleCheckBoxCell* pCell = - static_cast< AccessibleCheckBoxCell* >( xChild.get() ); - pCell->commitEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } - else - { - AccessibleBrowseBoxTableCell* pCell = - static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() ); - pCell->nameChanged( sNewText, pData->m_sOldText ); - } - } - } - break; - } - } - } - } - // ----------------------------------------------------------------------------- - IMPL_LINK( AccessibleTabListBoxTable, WindowEventListener, VclSimpleEvent*, pEvent ) - { - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) - { - DBG_ASSERT( ( (VclWindowEvent*)pEvent )->GetWindow() && m_pTabListBox, "no event window" ); - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } - return 0; - } - // helpers -------------------------------------------------------------------- - - void AccessibleTabListBoxTable::ensureValidIndex( sal_Int32 _nIndex ) const - SAL_THROW( ( IndexOutOfBoundsException ) ) - { - if ( ( _nIndex < 0 ) || ( _nIndex >= implGetCellCount() ) ) - throw IndexOutOfBoundsException(); - } - - sal_Bool AccessibleTabListBoxTable::implIsRowSelected( sal_Int32 _nRow ) const - { - return m_pTabListBox ? m_pTabListBox->IsSelected( m_pTabListBox->GetEntry( _nRow ) ) : sal_False; - } - - void AccessibleTabListBoxTable::implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect ) - { - if ( m_pTabListBox ) - m_pTabListBox->Select( m_pTabListBox->GetEntry( _nRow ), _bSelect ); - } - - sal_Int32 AccessibleTabListBoxTable::implGetRowCount() const - { - return m_pTabListBox ? m_pTabListBox->GetEntryCount() : 0; - } - - sal_Int32 AccessibleTabListBoxTable::implGetColumnCount() const - { - return m_pTabListBox ? m_pTabListBox->GetColumnCount() : 0; - } - - sal_Int32 AccessibleTabListBoxTable::implGetSelRowCount() const - { - return m_pTabListBox ? m_pTabListBox->GetSelectionCount() : 0; - } - - sal_Int32 AccessibleTabListBoxTable::implGetSelRow( sal_Int32 nSelRow ) const - { - if ( m_pTabListBox ) - { - sal_Int32 nRow = 0; - SvLBoxEntry* pEntry = m_pTabListBox->FirstSelected(); - while ( pEntry ) - { - ++nRow; - if ( nRow == nSelRow ) - return m_pTabListBox->GetEntryPos( pEntry ); - pEntry = m_pTabListBox->NextSelected( pEntry ); - } - } - - return 0; - } - // ----------------------------------------------------------------------------- - // XInterface & XTypeProvider - // ----------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) - IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) - // ----------------------------------------------------------------------------- - // XServiceInfo - // ----------------------------------------------------------------------------- - ::rtl::OUString AccessibleTabListBoxTable::getImplementationName (void) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleTabListBoxTable" )); - } - // ----------------------------------------------------------------------------- - // XAccessibleSelection - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleTabListBoxTable::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - ensureValidIndex( nChildIndex ); - - implSelectRow( implGetRow( nChildIndex ), sal_True ); - } - // ----------------------------------------------------------------------------- - sal_Bool SAL_CALL AccessibleTabListBoxTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - ensureValidIndex( nChildIndex ); - - return implIsRowSelected( implGetRow( nChildIndex ) ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleTabListBoxTable::clearAccessibleSelection( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - - m_pTabListBox->SetNoSelection(); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleTabListBoxTable::selectAllAccessibleChildren( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - - m_pTabListBox->SelectAll(); - } - // ----------------------------------------------------------------------------- - sal_Int32 SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChildCount( ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - - return implGetColumnCount() * implGetSelRowCount(); - } - // ----------------------------------------------------------------------------- - Reference< XAccessible > SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - - sal_Int32 nRows = implGetSelRowCount(); - if ( nRows == 0 ) - throw IndexOutOfBoundsException(); - - sal_Int32 nRow = implGetSelRow( nSelectedChildIndex % nRows ); - sal_Int32 nColumn = nSelectedChildIndex / nRows; - return getAccessibleCellAt( nRow, nColumn ); - } - // ----------------------------------------------------------------------------- - void SAL_CALL AccessibleTabListBoxTable::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getOslMutex() ); - - ensureIsAlive(); - ensureValidIndex( nSelectedChildIndex ); - - implSelectRow( implGetRow( nSelectedChildIndex ), sal_False ); - } - -//........................................................................ -}// namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/listboxaccessible.cxx b/accessibility/source/extended/listboxaccessible.cxx deleted file mode 100644 index 04a67146a..000000000 --- a/accessibility/source/extended/listboxaccessible.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include - -//........................................................................ -namespace accessibility -{ -//........................................................................ - - //==================================================================== - //= ListBoxAccessibleBase - //==================================================================== - //-------------------------------------------------------------------- - ListBoxAccessibleBase::ListBoxAccessibleBase( SvTreeListBox& _rWindow ) - :m_pWindow( &_rWindow ) - { - m_pWindow->AddEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) ); - } - - //-------------------------------------------------------------------- - ListBoxAccessibleBase::~ListBoxAccessibleBase( ) - { - if ( m_pWindow ) - { - // cannot call "dispose" here, as it is abstract, so the VTABLE of the derived class - // is not intact anymore - // so we call our "disposing" only - disposing(); - } - } - - //-------------------------------------------------------------------- - IMPL_LINK( ListBoxAccessibleBase, WindowEventListener, VclSimpleEvent*, pEvent ) - { - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "ListBoxAccessibleBase::WindowEventListener: unexpected WindowEvent!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) - { - DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" ); - DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" ); - - ProcessWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) ); - } - return 0; - } - - // ----------------------------------------------------------------------------- - void ListBoxAccessibleBase::disposing() - { - if ( m_pWindow ) - m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) ); - m_pWindow = NULL; - } - - // ----------------------------------------------------------------------------- - void ListBoxAccessibleBase::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) - { - if ( isAlive() ) - { - switch ( _rVclWindowEvent.GetId() ) - { - case VCLEVENT_OBJECT_DYING : - { - if ( m_pWindow ) - m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) ); - m_pWindow = NULL; - dispose(); - break; - } - } - } - } - -//........................................................................ -} // namespace accessibility -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk deleted file mode 100755 index 27f4403c8..000000000 --- a/accessibility/source/extended/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=accessibility -TARGET=extended - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -.IF "$(OS)$(COM)"=="SOLARISI" -NOOPTFILES=$(SLO)$/accessibletabbarpagelist.obj -.ENDIF # "$(OS)$(COM)"=="SOLARISI" - -SLOFILES=\ - $(SLO)$/AccessibleBrowseBoxCheckBoxCell.obj \ - $(SLO)$/AccessibleBrowseBoxBase.obj \ - $(SLO)$/AccessibleBrowseBox.obj \ - $(SLO)$/AccessibleBrowseBoxTableCell.obj \ - $(SLO)$/AccessibleBrowseBoxHeaderCell.obj \ - $(SLO)$/AccessibleBrowseBoxTableBase.obj \ - $(SLO)$/AccessibleBrowseBoxTable.obj \ - $(SLO)$/AccessibleBrowseBoxHeaderBar.obj \ - $(SLO)$/accessibleiconchoicectrl.obj \ - $(SLO)$/accessibleiconchoicectrlentry.obj \ - $(SLO)$/accessiblelistbox.obj \ - $(SLO)$/accessiblelistboxentry.obj \ - $(SLO)$/accessibletabbarbase.obj \ - $(SLO)$/accessibletabbar.obj \ - $(SLO)$/accessibletabbarpage.obj \ - $(SLO)$/accessibletabbarpagelist.obj \ - $(SLO)$/accessibletablistbox.obj \ - $(SLO)$/accessibletablistboxtable.obj \ - $(SLO)$/listboxaccessible.obj \ - $(SLO)$/accessiblebrowseboxcell.obj \ - $(SLO)$/accessibleeditbrowseboxcell.obj \ - $(SLO)$/textwindowaccessibility.obj \ - $(SLO)$/AccessibleGridControlBase.obj \ - $(SLO)$/AccessibleGridControl.obj \ - $(SLO)$/AccessibleGridControlTableBase.obj \ - $(SLO)$/AccessibleGridControlHeader.obj \ - $(SLO)$/AccessibleGridControlTableCell.obj \ - $(SLO)$/AccessibleGridControlHeaderCell.obj \ - $(SLO)$/AccessibleGridControlTable.obj \ - $(SLO)$/AccessibleToolPanelDeck.obj \ - $(SLO)$/AccessibleToolPanelDeckTabBar.obj \ - $(SLO)$/AccessibleToolPanelDeckTabBarItem.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx deleted file mode 100644 index b605ed740..000000000 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ /dev/null @@ -1,2258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include -#include "comphelper/accessibleeventnotifier.hxx" -#include "unotools/accessiblerelationsethelper.hxx" -#include -#include -#include - -#include -#include -#include - -namespace css = ::com::sun::star; - -namespace accessibility -{ - -// Both ::osl::Mutex and ParagraphBase implement acquire and release, and thus -// ::rtl::Reference< Paragraph > does not work. So ParagraphImpl was factored -// out and ::rtl::Reference< ParagraphImpl > is used instead. -class Paragraph: private ::osl::Mutex, public ParagraphImpl -{ -public: - inline Paragraph(::rtl::Reference< Document > const & rDocument, - Paragraphs::size_type nNumber): - ParagraphImpl(rDocument, nNumber, *this) {} -}; - -void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier) -{ - OSL_ENSURE(m_pNotifier == 0, "called more than once"); - m_pNotifier = &rNotifier; - m_rListener.StartListening(*m_pNotifier, true); -} - -void SfxListenerGuard::endListening() -{ - if (m_pNotifier != 0) - { - m_rListener.EndListening(*m_pNotifier); - m_pNotifier = 0; - } -} - -void WindowListenerGuard::startListening(::Window & rNotifier) -{ - OSL_ENSURE(m_pNotifier == 0, "called more than once"); - m_pNotifier = &rNotifier; - m_pNotifier->AddEventListener(m_aListener); -} - -void WindowListenerGuard::endListening() -{ - if (m_pNotifier != 0) - { - m_pNotifier->RemoveEventListener(m_aListener); - m_pNotifier = 0; - } -} - -ParagraphImpl::ParagraphImpl(::rtl::Reference< Document > const & rDocument, - Paragraphs::size_type nNumber, - ::osl::Mutex & rMutex): - ParagraphBase(rMutex), - m_xDocument(rDocument), - m_nNumber(nNumber), - m_nClientId(0) -{ - m_aParagraphText = m_xDocument->retrieveParagraphText(this); -} - -void -ParagraphImpl::numberChanged(bool bIncremented) -{ - if (bIncremented) - ++m_nNumber; - else - --m_nNumber; -} - -void ParagraphImpl::textChanged() -{ - ::rtl::OUString aParagraphText = implGetText(); - ::css::uno::Any aOldValue, aNewValue; - if ( implInitTextChangedEvent( m_aParagraphText, aParagraphText, aOldValue, aNewValue ) ) - { - m_aParagraphText = aParagraphText; - notifyEvent(::css::accessibility::AccessibleEventId:: - TEXT_CHANGED, - aOldValue, aNewValue); - } -} - -void ParagraphImpl::notifyEvent(::sal_Int16 nEventId, - ::css::uno::Any const & rOldValue, - ::css::uno::Any const & rNewValue) -{ - if (m_nClientId) - comphelper::AccessibleEventNotifier::addEvent( m_nClientId, ::css::accessibility::AccessibleEventObject( - static_cast< ::cppu::OWeakObject * >(this), - nEventId, rNewValue, rOldValue) ); -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessibleContext > SAL_CALL -ParagraphImpl::getAccessibleContext() throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return this; -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getAccessibleChildCount() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return 0; -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL -ParagraphImpl::getAccessibleChild(::sal_Int32) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " ParagraphImpl::getAccessibleChild")), - static_cast< ::css::uno::XWeak * >(this)); -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL -ParagraphImpl::getAccessibleParent() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->getAccessible(); -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getAccessibleIndexInParent() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveParagraphIndex(this); -} - -// virtual -::sal_Int16 SAL_CALL ParagraphImpl::getAccessibleRole() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return ::css::accessibility::AccessibleRole::PARAGRAPH; -} - -// virtual -::rtl::OUString SAL_CALL ParagraphImpl::getAccessibleDescription() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return ::rtl::OUString(); -} - -// virtual -::rtl::OUString SAL_CALL ParagraphImpl::getAccessibleName() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return ::rtl::OUString(); -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > -SAL_CALL ParagraphImpl::getAccessibleRelationSet() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveParagraphRelationSet( this ); -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessibleStateSet > -SAL_CALL ParagraphImpl::getAccessibleStateSet() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - - // FIXME Notification of changes (STATE_CHANGED) missing when - // m_rView.IsReadOnly() changes: - return new ::utl::AccessibleStateSetHelper( - m_xDocument->retrieveParagraphState(this)); -} - -// virtual -::css::lang::Locale SAL_CALL ParagraphImpl::getLocale() - throw (::css::accessibility::IllegalAccessibleComponentStateException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveLocale(); -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::containsPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this, - false)); - return rPoint.X >= 0 && rPoint.X < aRect.Width - && rPoint.Y >= 0 && rPoint.Y < aRect.Height; -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL -ParagraphImpl::getAccessibleAtPoint(::css::awt::Point const &) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return 0; -} - -// virtual -::css::awt::Rectangle SAL_CALL ParagraphImpl::getBounds() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveParagraphBounds(this, false); -} - -// virtual -::css::awt::Point SAL_CALL ParagraphImpl::getLocation() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this, - false)); - return ::css::awt::Point(aRect.X, aRect.Y); -} - -// virtual -::css::awt::Point SAL_CALL ParagraphImpl::getLocationOnScreen() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this, - true)); - return ::css::awt::Point(aRect.X, aRect.Y); -} - -// virtual -::css::awt::Size SAL_CALL ParagraphImpl::getSize() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this, - false)); - return ::css::awt::Size(aRect.Width, aRect.Height); -} - -// virtual -void SAL_CALL ParagraphImpl::grabFocus() throw (::css::uno::RuntimeException) -{ - checkDisposed(); - Window* pWindow = m_xDocument->GetWindow(); - if ( pWindow ) - { - pWindow->GrabFocus(); - } - try - { - m_xDocument->changeParagraphSelection(this, 0, 0); - } - catch (const ::css::lang::IndexOutOfBoundsException & rEx) - { - OSL_TRACE( - "textwindowaccessibility.cxx: ParagraphImpl::grabFocus:" - " caught unexpected %s\n", - ::rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_UTF8). - getStr()); - } -} - -// virtual -::css::uno::Any SAL_CALL ParagraphImpl::getAccessibleKeyBinding() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return ::css::uno::Any(); -} - -// virtual -::css::util::Color SAL_CALL ParagraphImpl::getForeground() - throw (::css::uno::RuntimeException) -{ - return 0; // TODO -} - -// virtual -::css::util::Color SAL_CALL ParagraphImpl::getBackground() - throw (::css::uno::RuntimeException) -{ - return 0; // TODO -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getCaretPosition() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveParagraphCaretPosition(this); -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::setCaretPosition(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphSelection(this, nIndex, nIndex); - return true; -} - -// virtual -::sal_Unicode SAL_CALL ParagraphImpl::getCharacter(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getCharacter(nIndex); -} - -// virtual -::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL -ParagraphImpl::getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveCharacterAttributes( this, nIndex, aRequestedAttributes ); -} - -// virtual -::css::awt::Rectangle SAL_CALL -ParagraphImpl::getCharacterBounds(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Rectangle aBounds(m_xDocument->retrieveCharacterBounds(this, nIndex)); - ::css::awt::Rectangle aParaBounds(m_xDocument->retrieveParagraphBounds(this, false)); - aBounds.X -= aParaBounds.X; - aBounds.Y -= aParaBounds.Y; - return aBounds; -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getCharacterCount() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getCharacterCount(); -} - -// virtual -::sal_Int32 SAL_CALL -ParagraphImpl::getIndexAtPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - ::css::awt::Point aPoint(rPoint); - ::css::awt::Rectangle aParaBounds(m_xDocument->retrieveParagraphBounds(this, false)); - aPoint.X += aParaBounds.X; - aPoint.Y += aParaBounds.Y; - return m_xDocument->retrieveCharacterIndex(this, aPoint); -} - -// virtual -::rtl::OUString SAL_CALL ParagraphImpl::getSelectedText() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - - return OCommonAccessibleText::getSelectedText(); -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getSelectionStart() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getSelectionStart(); -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getSelectionEnd() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getSelectionEnd(); -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::setSelection(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphSelection(this, nStartIndex, nEndIndex); - return true; -} - -// virtual -::rtl::OUString SAL_CALL ParagraphImpl::getText() - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getText(); -} - -// virtual -::rtl::OUString SAL_CALL ParagraphImpl::getTextRange(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex); -} - -// virtual -::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getTextAtIndex(nIndex, aTextType); -} - -// virtual -::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getTextBeforeIndex(nIndex, aTextType); -} - -// virtual -::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - checkDisposed(); - return OCommonAccessibleText::getTextBehindIndex(nIndex, aTextType); -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::copyText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->copyParagraphText(this, nStartIndex, nEndIndex); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::cutText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, true, false, - ::rtl::OUString()); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::pasteText(::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, nIndex, nIndex, false, true, - ::rtl::OUString()); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::deleteText(::sal_Int32 nStartIndex, - ::sal_Int32 nEndIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, false, false, - ::rtl::OUString()); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::insertText(::rtl::OUString const & rText, - ::sal_Int32 nIndex) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, nIndex, nIndex, false, false, rText); - return true; -} - -// virtual -::sal_Bool SAL_CALL -ParagraphImpl::replaceText(::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, - ::rtl::OUString const & rReplacement) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, false, false, - rReplacement); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::setAttributes( - ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, - ::css::uno::Sequence< ::css::beans::PropertyValue > const & rAttributeSet) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphAttributes(this, nStartIndex, nEndIndex, - rAttributeSet); - return true; -} - -// virtual -::sal_Bool SAL_CALL ParagraphImpl::setText(::rtl::OUString const & rText) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - m_xDocument->changeParagraphText(this, rText); - return true; -} - -// virtual -::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL -ParagraphImpl::getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveDefaultAttributes( this, RequestedAttributes ); -} - -// virtual -::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL -ParagraphImpl::getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveRunAttributes( this, Index, RequestedAttributes ); -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getLineNumberAtIndex( ::sal_Int32 nIndex ) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - - ::sal_Int32 nLineNo = -1; - m_xDocument->retrieveParagraphLineBoundary( this, nIndex, &nLineNo ); - - return nLineNo; -} - -// virtual -::css::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtLineNumber( ::sal_Int32 nLineNo ) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - checkDisposed(); - - ::css::i18n::Boundary aBoundary = - m_xDocument->retrieveParagraphBoundaryOfLine( this, nLineNo ); - - return ::css::accessibility::TextSegment( getTextRange(aBoundary.startPos, aBoundary.endPos), - aBoundary.startPos, aBoundary.endPos); -} - -// virtual -::css::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtLineWithCaret( ) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - - sal_Int32 nLineNo = getNumberOfLineWithCaret(); - - try { - return ( nLineNo >= 0 ) ? - getTextAtLineNumber( nLineNo ) : - ::css::accessibility::TextSegment(); - } catch (const ::css::lang::IndexOutOfBoundsException&) { - throw ::css::uno::RuntimeException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " ParagraphImpl::getTextAtLineWithCaret") ), - static_cast< ::css::uno::XWeak * >( this ) ); - } -} - -// virtual -::sal_Int32 SAL_CALL ParagraphImpl::getNumberOfLineWithCaret( ) - throw (::css::uno::RuntimeException) -{ - checkDisposed(); - return m_xDocument->retrieveParagraphLineWithCursor(this); -} - - -// virtual -void SAL_CALL ParagraphImpl::addEventListener( - ::css::uno::Reference< - ::css::accessibility::XAccessibleEventListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - if (rListener.is()) - { - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - aGuard.clear(); - rListener->disposing(::css::lang::EventObject( - static_cast< ::cppu::OWeakObject * >(this))); - } - else - { - if (!m_nClientId) - m_nClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, rListener ); - } - } -} - -// virtual -void SAL_CALL ParagraphImpl::removeEventListener( - ::css::uno::Reference< - ::css::accessibility::XAccessibleEventListener > const & rListener) - throw (::css::uno::RuntimeException) -{ - comphelper::AccessibleEventNotifier::TClientId nId = 0; - { - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - if (rListener.is() && m_nClientId != 0 - && comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, rListener ) == 0) - { - nId = m_nClientId; - m_nClientId = 0; - } - } - if (nId != 0) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - comphelper::AccessibleEventNotifier::revokeClient(nId); - } -} - -// virtual -void SAL_CALL ParagraphImpl::disposing() -{ - comphelper::AccessibleEventNotifier::TClientId nId = 0; - { - ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex); - nId = m_nClientId; - m_nClientId = 0; - } - if (nId != 0) - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(nId, *this); -} - -// virtual -::rtl::OUString ParagraphImpl::implGetText() -{ - return m_xDocument->retrieveParagraphText(this); -} - -// virtual -::css::lang::Locale ParagraphImpl::implGetLocale() -{ - return m_xDocument->retrieveLocale(); -} - -// virtual -void ParagraphImpl::implGetSelection(::sal_Int32 & rStartIndex, - ::sal_Int32 & rEndIndex) -{ - m_xDocument->retrieveParagraphSelection(this, &rStartIndex, &rEndIndex); -} - -// virtual -void ParagraphImpl::implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary, - ::sal_Int32 nIndex ) -{ - ::rtl::OUString sText( implGetText() ); - ::sal_Int32 nLength = sText.getLength(); - - if ( implIsValidIndex( nIndex, nLength ) ) - { - rBoundary.startPos = 0; - rBoundary.endPos = nLength; - } - else - { - rBoundary.startPos = nIndex; - rBoundary.endPos = nIndex; - } -} - -// virtual -void ParagraphImpl::implGetLineBoundary( ::css::i18n::Boundary& rBoundary, - ::sal_Int32 nIndex ) -{ - ::rtl::OUString sText( implGetText() ); - ::sal_Int32 nLength = sText.getLength(); - - if ( implIsValidIndex( nIndex, nLength ) || nIndex == nLength ) - { - ::css::i18n::Boundary aBoundary = - m_xDocument->retrieveParagraphLineBoundary( this, nIndex ); - rBoundary.startPos = aBoundary.startPos; - rBoundary.endPos = aBoundary.endPos; - } - else - { - rBoundary.startPos = nIndex; - rBoundary.endPos = nIndex; - } -} - - -void ParagraphImpl::checkDisposed() -{ - ::osl::MutexGuard aGuard(rBHelper.rMutex); - if (!(rBHelper.bDisposed || rBHelper.bInDispose)) - return; - throw ::css::lang::DisposedException( - ::rtl::OUString(), static_cast< ::css::uno::XWeak * >(this)); -} - -Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine, - ::TextView & rView, bool bCompoundControlChild): - VCLXAccessibleComponent(pVclXWindow), - m_xAccessible(pVclXWindow), - m_rEngine(rEngine), - m_rView(rView), - m_aEngineListener(*this), - m_aViewListener(LINK(this, Document, WindowEventHandler)), - m_bCompoundControlChild(bCompoundControlChild) -{} - -::css::lang::Locale Document::retrieveLocale() -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - return m_rEngine.GetLocale(); -} - -::sal_Int32 Document::retrieveParagraphIndex(ParagraphImpl const * pParagraph) -{ - ::osl::MutexGuard aInternalGuard(GetMutex()); - - // If a client holds on to a Paragraph that is no longer visible, it can - // happen that this Paragraph lies outside the range from m_aVisibleBegin - // to m_aVisibleEnd. In that case, return -1 instead of a valid index: - Paragraphs::iterator aPara(m_xParagraphs->begin() - + pParagraph->getNumber()); - return aPara < m_aVisibleBegin || aPara >= m_aVisibleEnd - ? -1 : static_cast< ::sal_Int32 >(aPara - m_aVisibleBegin); - // XXX numeric overflow -} - -::sal_Int64 Document::retrieveParagraphState(ParagraphImpl const * pParagraph) -{ - ::osl::MutexGuard aInternalGuard(GetMutex()); - - // If a client holds on to a Paragraph that is no longer visible, it can - // happen that this Paragraph lies outside the range from m_aVisibleBegin - // to m_aVisibleEnd. In that case, it is neither VISIBLE nor SHOWING: - ::sal_Int64 nState - = (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::ENABLED) - | (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::SENSITIVE) - | (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::FOCUSABLE) - | (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::MULTI_LINE); - if (!m_rView.IsReadOnly()) - nState |= (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::EDITABLE); - Paragraphs::iterator aPara(m_xParagraphs->begin() - + pParagraph->getNumber()); - if (aPara >= m_aVisibleBegin && aPara < m_aVisibleEnd) - { - nState - |= (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::VISIBLE) - | (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::SHOWING); - if (aPara == m_aFocused) - nState |= (static_cast< ::sal_Int64 >(1) - << ::css::accessibility::AccessibleStateType::FOCUSED); - } - return nState; -}; - -::css::awt::Rectangle -Document::retrieveParagraphBounds(ParagraphImpl const * pParagraph, - bool bAbsolute) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - - // If a client holds on to a Paragraph that is no longer visible (as it - // scrolled out the top of the view), it can happen that this Paragraph - // lies before m_aVisibleBegin. In that case, calculate the vertical - // position of the Paragraph starting at paragraph 0, otherwise optimize - // and start at m_aVisibleBegin: - Paragraphs::iterator aPara(m_xParagraphs->begin() - + pParagraph->getNumber()); - ::sal_Int32 nPos; - Paragraphs::iterator aIt; - if (aPara < m_aVisibleBegin) - { - nPos = 0; - aIt = m_xParagraphs->begin(); - } - else - { - nPos = m_nViewOffset - m_nVisibleBeginOffset; - aIt = m_aVisibleBegin; - } - for (; aIt != aPara; ++aIt) - nPos += aIt->getHeight(); - - Point aOrig(0, 0); - if (bAbsolute) - aOrig = m_rView.GetWindow()->OutputToAbsoluteScreenPixel(aOrig); - - return ::css::awt::Rectangle( - static_cast< ::sal_Int32 >(aOrig.X()), - static_cast< ::sal_Int32 >(aOrig.Y()) + nPos - m_nViewOffset, - m_rView.GetWindow()->GetOutputSizePixel().Width(), aPara->getHeight()); - // XXX numeric overflow (3x) -} - -::rtl::OUString -Document::retrieveParagraphText(ParagraphImpl const * pParagraph) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - return m_rEngine.GetText(static_cast< ::sal_uLong >(pParagraph->getNumber())); - // numeric overflow cannot happen here -} - -void Document::retrieveParagraphSelection(ParagraphImpl const * pParagraph, - ::sal_Int32 * pBegin, - ::sal_Int32 * pEnd) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::TextSelection const & rSelection = m_rView.GetSelection(); - Paragraphs::size_type nNumber = pParagraph->getNumber(); - TextPaM aStartPaM( rSelection.GetStart() ); - TextPaM aEndPaM( rSelection.GetEnd() ); - TextPaM aMinPaM( ::std::min( aStartPaM, aEndPaM ) ); - TextPaM aMaxPaM( ::std::max( aStartPaM, aEndPaM ) ); - - if ( nNumber >= aMinPaM.GetPara() && nNumber <= aMaxPaM.GetPara() ) - { - *pBegin = nNumber > aMinPaM.GetPara() - ? 0 - : static_cast< ::sal_Int32 >( aMinPaM.GetIndex() ); - // XXX numeric overflow - *pEnd = nNumber < aMaxPaM.GetPara() - ? static_cast< ::sal_Int32 >( m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).Len() ) - : static_cast< ::sal_Int32 >( aMaxPaM.GetIndex() ); - // XXX numeric overflow (3x) - - if ( aStartPaM > aEndPaM ) - ::std::swap( *pBegin, *pEnd ); - } - else - { - *pBegin = 0; - *pEnd = 0; - } -} - -::sal_Int32 Document::retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::TextSelection const & rSelection = m_rView.GetSelection(); - Paragraphs::size_type nNumber = pParagraph->getNumber(); - TextPaM aEndPaM( rSelection.GetEnd() ); - - return aEndPaM.GetPara() == nNumber - ? static_cast< ::sal_Int32 >(aEndPaM.GetIndex()) : -1; -} - -::css::awt::Rectangle -Document::retrieveCharacterBounds(ParagraphImpl const * pParagraph, - ::sal_Int32 nIndex) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - sal_Int32 nLength = m_rEngine.GetText(nNumber).Len(); - // XXX numeric overflow - if (nIndex < 0 || nIndex > nLength) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::retrieveCharacterAttributes")), - static_cast< ::css::uno::XWeak * >(this)); - ::css::awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( nIndex == nLength ) - { - aBounds = AWTRectangle( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex)))); - } - else - { - ::Rectangle aLeft( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex)))); - // XXX numeric overflow - ::Rectangle aRight( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex) - + 1))); - // XXX numeric overflow (2x) - // FIXME If the vertical extends of the two cursors do not match, assume - // nIndex is the last character on the line; the bounding box will then - // extend to m_rEnginge.GetMaxTextWidth(): - ::sal_Int32 nWidth = (aLeft.Top() == aRight.Top() - && aLeft.Bottom() == aRight.Bottom()) - ? static_cast< ::sal_Int32 >(aRight.Left() - aLeft.Left()) - : static_cast< ::sal_Int32 >(m_rEngine.GetMaxTextWidth() - - aLeft.Left()); - // XXX numeric overflow (4x) - aBounds = ::css::awt::Rectangle(static_cast< ::sal_Int32 >(aLeft.Left()), - static_cast< ::sal_Int32 >(aLeft.Top() - m_nViewOffset), - nWidth, - static_cast< ::sal_Int32 >(aLeft.Bottom() - - aLeft.Top())); - // XXX numeric overflow (4x) - } - return aBounds; -} - -::sal_Int32 Document::retrieveCharacterIndex(ParagraphImpl const * pParagraph, - ::css::awt::Point const & rPoint) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - ::TextPaM aPaM(m_rEngine.GetPaM(::Point(static_cast< long >(rPoint.X), - static_cast< long >(rPoint.Y)))); - // XXX numeric overflow (2x) - return aPaM.GetPara() == nNumber - ? static_cast< ::sal_Int32 >(aPaM.GetIndex()) : -1; - // XXX numeric overflow -} - -::css::uno::Sequence< ::css::beans::PropertyValue > -Document::retrieveCharacterAttributes( - ParagraphImpl const * pParagraph, ::sal_Int32 nIndex, - const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).Len()) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::retrieveCharacterAttributes")), - static_cast< ::css::uno::XWeak * >(this)); - - // retrieve default attributes - tPropValMap aCharAttrSeq; - retrieveDefaultAttributesImpl( pParagraph, aRequestedAttributes, aCharAttrSeq ); - - // retrieve run attributes - tPropValMap aRunAttrSeq; - retrieveRunAttributesImpl( pParagraph, nIndex, aRequestedAttributes, aRunAttrSeq ); - - // merge default and run attributes - for ( tPropValMap::const_iterator aRunIter = aRunAttrSeq.begin(); - aRunIter != aRunAttrSeq.end(); - ++aRunIter ) - { - aCharAttrSeq[ aRunIter->first ] = aRunIter->second; - } - - return convertHashMapToSequence( aCharAttrSeq ); -} - -void Document::retrieveDefaultAttributesImpl( - ParagraphImpl const * pParagraph, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, - tPropValMap& rDefAttrSeq) -{ - // default attributes are not supported by text engine - (void) pParagraph; - (void) RequestedAttributes; - (void) rDefAttrSeq; -} - -::css::uno::Sequence< ::css::beans::PropertyValue > -Document::retrieveDefaultAttributes( - ParagraphImpl const * pParagraph, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() ); - ::osl::MutexGuard aInternalGuard( GetMutex() ); - - tPropValMap aDefAttrSeq; - retrieveDefaultAttributesImpl( pParagraph, RequestedAttributes, aDefAttrSeq ); - return convertHashMapToSequence( aDefAttrSeq ); -} - -// static -::css::uno::Sequence< ::css::beans::PropertyValue > -Document::convertHashMapToSequence(tPropValMap& rAttrSeq) -{ - ::css::uno::Sequence< ::css::beans::PropertyValue > aValues( rAttrSeq.size() ); - ::css::beans::PropertyValue* pValues = aValues.getArray(); - ::sal_Int32 i = 0; - for ( tPropValMap::const_iterator aIter = rAttrSeq.begin(); - aIter != rAttrSeq.end(); - ++aIter ) - { - pValues[i] = aIter->second; - ++i; - } - return aValues; -} - -void Document::retrieveRunAttributesImpl( - ParagraphImpl const * pParagraph, ::sal_Int32 Index, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, - tPropValMap& rRunAttrSeq) -{ - ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - ::TextPaM aPaM( nNumber, static_cast< ::sal_uInt16 >( Index ) ); - // XXX numeric overflow - // FIXME TEXTATTR_HYPERLINK ignored: - ::TextAttribFontColor const * pColor - = static_cast< ::TextAttribFontColor const * >( - m_rEngine.FindAttrib( aPaM, TEXTATTR_FONTCOLOR ) ); - ::TextAttribFontWeight const * pWeight - = static_cast< ::TextAttribFontWeight const * >( - m_rEngine.FindAttrib( aPaM, TEXTATTR_FONTWEIGHT ) ); - tPropValMap aRunAttrSeq; - if ( pColor ) - { - ::css::beans::PropertyValue aPropVal; - aPropVal.Name = - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ); - aPropVal.Handle = -1; - aPropVal.Value = mapFontColor( pColor->GetColor() ); - aPropVal.State = ::css::beans::PropertyState_DIRECT_VALUE; - aRunAttrSeq[ aPropVal.Name ] = aPropVal; - } - if ( pWeight ) - { - ::css::beans::PropertyValue aPropVal; - aPropVal.Name = - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ); - aPropVal.Handle = -1; - aPropVal.Value = mapFontWeight( pWeight->getFontWeight() ); - aPropVal.State = ::css::beans::PropertyState_DIRECT_VALUE; - aRunAttrSeq[ aPropVal.Name ] = aPropVal; - } - if ( RequestedAttributes.getLength() == 0 ) - { - rRunAttrSeq = aRunAttrSeq; - } - else - { - const ::rtl::OUString* pReqAttrs = RequestedAttributes.getConstArray(); - const ::sal_Int32 nLength = RequestedAttributes.getLength(); - for ( ::sal_Int32 i = 0; i < nLength; ++i ) - { - tPropValMap::iterator aIter = aRunAttrSeq.find( pReqAttrs[i] ); - if ( aIter != aRunAttrSeq.end() ) - { - rRunAttrSeq[ (*aIter).first ] = (*aIter).second; - } - } - } -} - -::css::uno::Sequence< ::css::beans::PropertyValue > -Document::retrieveRunAttributes( - ParagraphImpl const * pParagraph, ::sal_Int32 Index, - const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() ); - ::osl::MutexGuard aInternalGuard( GetMutex() ); - ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - // XXX numeric overflow - if ( Index < 0 || Index >= m_rEngine.GetText(nNumber).Len() ) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::retrieveRunAttributes") ), - static_cast< ::css::uno::XWeak * >( this ) ); - - tPropValMap aRunAttrSeq; - retrieveRunAttributesImpl( pParagraph, Index, RequestedAttributes, aRunAttrSeq ); - return convertHashMapToSequence( aRunAttrSeq ); -} - -void Document::changeParagraphText(ParagraphImpl * pParagraph, - ::rtl::OUString const & rText) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - changeParagraphText(nNumber, 0, m_rEngine.GetTextLen(nNumber), false, - false, rText); - } -} - -void Document::changeParagraphText(ParagraphImpl * pParagraph, - ::sal_Int32 nBegin, ::sal_Int32 nEnd, - bool bCut, bool bPaste, - ::rtl::OUString const & rText) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::changeParagraphText")), - static_cast< ::css::uno::XWeak * >(this)); - changeParagraphText(nNumber, static_cast< ::sal_uInt16 >(nBegin), - static_cast< ::sal_uInt16 >(nEnd), bCut, bPaste, rText); - // XXX numeric overflow (2x) - } -} - -void Document::copyParagraphText(ParagraphImpl const * pParagraph, - ::sal_Int32 nBegin, ::sal_Int32 nEnd) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::copyParagraphText")), - static_cast< ::css::uno::XWeak * >(this)); - m_rView.SetSelection( - ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)), - ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd)))); - // XXX numeric overflow (2x) - m_rView.Copy(); - } -} - -void Document::changeParagraphAttributes( - ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd, - ::css::uno::Sequence< ::css::beans::PropertyValue > const & rAttributeSet) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::changeParagraphAttributes")), - static_cast< ::css::uno::XWeak * >(this)); - - // FIXME The new attributes are added to any attributes already set, - // they do not replace the old attributes as required by - // XAccessibleEditableText.setAttributes: - for (::sal_Int32 i = 0; i < rAttributeSet.getLength(); ++i) - if (rAttributeSet[i].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("CharColor"))) - m_rEngine.SetAttrib(::TextAttribFontColor( - mapFontColor(rAttributeSet[i].Value)), - nNumber, static_cast< ::sal_uInt16 >(nBegin), - static_cast< ::sal_uInt16 >(nEnd)); - // XXX numeric overflow (2x) - else if (rAttributeSet[i].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("CharWeight"))) - m_rEngine.SetAttrib(::TextAttribFontWeight( - mapFontWeight(rAttributeSet[i].Value)), - nNumber, static_cast< ::sal_uInt16 >(nBegin), - static_cast< ::sal_uInt16 >(nEnd)); - // XXX numeric overflow (2x) - } -} - -void Document::changeParagraphSelection(ParagraphImpl * pParagraph, - ::sal_Int32 nBegin, ::sal_Int32 nEnd) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - // XXX numeric overflow - if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::changeParagraphSelection")), - static_cast< ::css::uno::XWeak * >(this)); - m_rView.SetSelection( - ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)), - ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd)))); - // XXX numeric overflow (2x) - } -} - -::css::i18n::Boundary -Document::retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph, - ::sal_Int32 nIndex, ::sal_Int32 *pLineNo ) -{ - ::css::i18n::Boundary aBoundary; - aBoundary.startPos = nIndex; - aBoundary.endPos = nIndex; - - ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() ); - { - ::osl::MutexGuard aInternalGuard( GetMutex() ); - ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - if ( nIndex < 0 || nIndex > m_rEngine.GetText( nNumber ).Len() ) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::retrieveParagraphLineBoundary" ) ), - static_cast< ::css::uno::XWeak * >( this ) ); - ::sal_Int32 nLineStart = 0; - ::sal_Int32 nLineEnd = 0; - ::sal_uInt16 nLineCount = m_rEngine.GetLineCount( nNumber ); - for ( ::sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine ) - { - ::sal_Int32 nLineLength = static_cast< ::sal_Int32 >( - m_rEngine.GetLineLen( nNumber, nLine ) ); - nLineStart = nLineEnd; - nLineEnd += nLineLength; - if ( nIndex >= nLineStart && ( ( nLine == nLineCount - 1 ) ? nIndex <= nLineEnd : nIndex < nLineEnd ) ) - { - aBoundary.startPos = nLineStart; - aBoundary.endPos = nLineEnd; - if( pLineNo ) - pLineNo[0] = nLine; - break; - } - } - } - - return aBoundary; -} - -::css::i18n::Boundary -Document::retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph, - ::sal_Int32 nLineNo ) -{ - ::css::i18n::Boundary aBoundary; - aBoundary.startPos = 0; - aBoundary.endPos = 0; - - ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() ); - { - ::osl::MutexGuard aInternalGuard( GetMutex() ); - ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - if ( nLineNo >= m_rEngine.GetLineCount( nNumber ) ) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::retrieveParagraphBoundaryOfLine" ) ), - static_cast< ::css::uno::XWeak * >( this ) ); - ::sal_Int32 nLineStart = 0; - ::sal_Int32 nLineEnd = 0; - for ( ::sal_uInt16 nLine = 0; nLine <= nLineNo; ++nLine ) - { - ::sal_Int32 nLineLength = static_cast< ::sal_Int32 >( - m_rEngine.GetLineLen( nNumber, nLine ) ); - nLineStart = nLineEnd; - nLineEnd += nLineLength; - } - - aBoundary.startPos = nLineStart; - aBoundary.endPos = nLineEnd; - } - - return aBoundary; -} - -sal_Int32 Document::retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph ) -{ - ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); - ::osl::MutexGuard aInternalGuard(GetMutex()); - ::TextSelection const & rSelection = m_rView.GetSelection(); - Paragraphs::size_type nNumber = pParagraph->getNumber(); - TextPaM aEndPaM( rSelection.GetEnd() ); - - return aEndPaM.GetPara() == nNumber - ? m_rView.GetLineNumberOfCursorInSelection() : -1; -} - - -::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > -Document::retrieveParagraphRelationSet( ParagraphImpl const * pParagraph ) -{ - ::osl::MutexGuard aInternalGuard( GetMutex() ); - - ::utl::AccessibleRelationSetHelper* pRelationSetHelper = new ::utl::AccessibleRelationSetHelper(); - ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper; - - Paragraphs::iterator aPara( m_xParagraphs->begin() + pParagraph->getNumber() ); - - if ( aPara > m_aVisibleBegin && aPara < m_aVisibleEnd ) - { - ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > aSequence(1); - aSequence[0] = getAccessibleChild( aPara - 1 ); - ::css::accessibility::AccessibleRelation aRelation( ::css::accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM, aSequence ); - pRelationSetHelper->AddRelation( aRelation ); - } - - if ( aPara >= m_aVisibleBegin && aPara < m_aVisibleEnd -1 ) - { - ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > aSequence(1); - aSequence[0] = getAccessibleChild( aPara + 1 ); - ::css::accessibility::AccessibleRelation aRelation( ::css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ); - pRelationSetHelper->AddRelation( aRelation ); - } - - return xSet; -} - -void Document::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_GETFOCUS: - case VCLEVENT_WINDOW_LOSEFOCUS: - { - // #107179# if our parent is a compound control (e.g. MultiLineEdit), - // suppress the window focus events here - if ( !m_bCompoundControlChild ) - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// virtual -::sal_Int32 SAL_CALL Document::getAccessibleChildCount() - throw (::css::uno::RuntimeException) -{ - ::comphelper::OExternalLockGuard aGuard(this); - init(); - return m_aVisibleEnd - m_aVisibleBegin; -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL -Document::getAccessibleChild(::sal_Int32 i) - throw (::css::lang::IndexOutOfBoundsException, - ::css::uno::RuntimeException) -{ - ::comphelper::OExternalLockGuard aGuard(this); - init(); - if (i < 0 || i >= m_aVisibleEnd - m_aVisibleBegin) - throw ::css::lang::IndexOutOfBoundsException( - ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "textwindowaccessibility.cxx:" - " Document::getAccessibleChild")), - static_cast< ::css::uno::XWeak * >(this)); - return getAccessibleChild(m_aVisibleBegin - + static_cast< Paragraphs::size_type >(i)); -} - -// virtual -::sal_Int16 SAL_CALL Document::getAccessibleRole() - throw (::css::uno::RuntimeException) -{ - return ::css::accessibility::AccessibleRole::TEXT_FRAME; -} - -// virtual -::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL -Document::getAccessibleAtPoint(::css::awt::Point const & rPoint) - throw (::css::uno::RuntimeException) -{ - ::comphelper::OExternalLockGuard aGuard(this); - init(); - if (rPoint.X >= 0 - && rPoint.X < m_rView.GetWindow()->GetOutputSizePixel().Width() - && rPoint.Y >= 0 && rPoint.Y < m_nViewHeight) - { - ::sal_Int32 nOffset = m_nViewOffset + rPoint.Y; // XXX numeric overflow - ::sal_Int32 nPos = m_nViewOffset - m_nVisibleBeginOffset; - for (Paragraphs::iterator aIt(m_aVisibleBegin); aIt != m_aVisibleEnd; - ++aIt) - { - nPos += aIt->getHeight(); // XXX numeric overflow - if (nOffset < nPos) - return getAccessibleChild(aIt); - } - } - return 0; -} - -// virtual -void SAL_CALL Document::disposing() -{ - m_aEngineListener.endListening(); - m_aViewListener.endListening(); - if (m_xParagraphs.get() != 0) - disposeParagraphs(); - VCLXAccessibleComponent::disposing(); -} - -// virtual -void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint) -{ - if (rHint.ISA(::TextHint)) - { - ::TextHint const & rTextHint - = static_cast< ::TextHint const & >(rHint); - switch (rTextHint.GetId()) - { - case TEXT_HINT_PARAINSERTED: - case TEXT_HINT_PARAREMOVED: - // TEXT_HINT_PARAINSERTED and TEXT_HINT_PARAREMOVED are sent at - // "unsafe" times (when the text engine has not yet re-formatted its - // content), so that for example calling ::TextEngine::GetTextHeight - // from within the code that handles TEXT_HINT_PARAINSERTED causes - // trouble within the text engine. Therefore, these hints are just - // buffered until a following ::TextEngine::FormatDoc causes a - // TEXT_HINT_TEXTFORMATTED to come in: - case TEXT_HINT_FORMATPARA: - // ::TextEngine::FormatDoc sends a sequence of - // TEXT_HINT_FORMATPARAs, followed by an optional - // TEXT_HINT_TEXTHEIGHTCHANGED, followed in all cases by one - // TEXT_HINT_TEXTFORMATTED. Only the TEXT_HINT_FORMATPARAs contain - // the the numbers of the affected paragraphs, but they are sent - // before the changes are applied. Therefore, TEXT_HINT_FORMATPARAs - // are just buffered until another hint comes in: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - - m_aParagraphNotifications.push(rTextHint); - break; - } - case TEXT_HINT_TEXTFORMATTED: - case TEXT_HINT_TEXTHEIGHTCHANGED: - case TEXT_HINT_MODIFIED: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - handleParagraphNotifications(); - break; - } - case TEXT_HINT_VIEWSCROLLED: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - handleParagraphNotifications(); - - ::sal_Int32 nOffset = static_cast< ::sal_Int32 >( - m_rView.GetStartDocPos().Y()); - // XXX numeric overflow - if (nOffset != m_nViewOffset) - { - m_nViewOffset = nOffset; - - Paragraphs::iterator aOldVisibleBegin( - m_aVisibleBegin); - Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd); - - determineVisibleRange(); - - notifyVisibleRangeChanges(aOldVisibleBegin, - aOldVisibleEnd, - m_xParagraphs->end()); - } - break; - } - case TEXT_HINT_VIEWSELECTIONCHANGED: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - - if (m_aParagraphNotifications.empty()) - { - handleSelectionChangeNotification(); - } - else - { - // TEXT_HINT_VIEWSELECTIONCHANGED is sometimes sent at - // "unsafe" times (when the text engine has not yet re- - // formatted its content), so that for example calling - // ::TextEngine::GetTextHeight from within the code that - // handles a previous TEXT_HINT_PARAINSERTED causes - // trouble within the text engine. Therefore, these - // hints are just buffered (along with - // TEXT_HINT_PARAINSERTED/REMOVED/FORMATPARA) until a - // following ::TextEngine::FormatDoc causes a - // TEXT_HINT_TEXTFORMATTED to come in: - m_bSelectionChangedNotification = true; - } - break; - } - } - } -} - -IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent) -{ - switch (pEvent->GetId()) - { - case VCLEVENT_WINDOW_RESIZE: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - - ::sal_Int32 nHeight = static_cast< ::sal_Int32 >( - m_rView.GetWindow()->GetOutputSizePixel().Height()); - // XXX numeric overflow - if (nHeight != m_nViewHeight) - { - m_nViewHeight = nHeight; - - Paragraphs::iterator aOldVisibleBegin(m_aVisibleBegin); - Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd); - - determineVisibleRange(); - - notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd, - m_xParagraphs->end()); - } - break; - } - case VCLEVENT_WINDOW_GETFOCUS: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - - if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd) - { - ::rtl::Reference< ParagraphImpl > xParagraph( - getParagraph(m_aFocused)); - if (xParagraph.is()) - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId:: - STATE_CHANGED, - ::css::uno::Any(), - ::css::uno::makeAny( - ::css::accessibility::AccessibleStateType:: - FOCUSED)); - } - break; - } - case VCLEVENT_WINDOW_LOSEFOCUS: - { - ::osl::MutexGuard aInternalGuard(GetMutex()); - if (!isAlive()) - break; - - if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd) - { - ::rtl::Reference< ParagraphImpl > xParagraph( - getParagraph(m_aFocused)); - if (xParagraph.is()) - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId:: - STATE_CHANGED, - ::css::uno::makeAny( - ::css::accessibility::AccessibleStateType:: - FOCUSED), - ::css::uno::Any()); - } - break; - } - } - return 0; -} - -void Document::init() -{ - if (m_xParagraphs.get() == 0) - { - ::sal_uLong nCount = m_rEngine.GetParagraphCount(); - ::std::auto_ptr< Paragraphs > p(new Paragraphs); - p->reserve(static_cast< Paragraphs::size_type >(nCount)); - // numeric overflow is harmless here - for (::sal_uLong i = 0; i < nCount; ++i) - p->push_back(ParagraphInfo(static_cast< ::sal_Int32 >( - m_rEngine.GetTextHeight(i)))); - // XXX numeric overflow - m_nViewOffset = static_cast< ::sal_Int32 >( - m_rView.GetStartDocPos().Y()); // XXX numeric overflow - m_nViewHeight = static_cast< ::sal_Int32 >( - m_rView.GetWindow()->GetOutputSizePixel().Height()); - // XXX numeric overflow - m_xParagraphs = p; - determineVisibleRange(); - m_nSelectionFirstPara = -1; - m_nSelectionFirstPos = -1; - m_nSelectionLastPara = -1; - m_nSelectionLastPos = -1; - m_aFocused = m_xParagraphs->end(); - m_bSelectionChangedNotification = false; - m_aEngineListener.startListening(m_rEngine); - m_aViewListener.startListening(*m_rView.GetWindow()); - } -} - -::rtl::Reference< ParagraphImpl > -Document::getParagraph(Paragraphs::iterator const & rIt) -{ - return static_cast< ParagraphImpl * >( - ::css::uno::Reference< ::css::accessibility::XAccessible >( - rIt->getParagraph()).get()); -} - -::css::uno::Reference< ::css::accessibility::XAccessible > -Document::getAccessibleChild(Paragraphs::iterator const & rIt) -{ - ::css::uno::Reference< ::css::accessibility::XAccessible > xParagraph( - rIt->getParagraph()); - if (!xParagraph.is()) - { - xParagraph = new Paragraph(this, rIt - m_xParagraphs->begin()); - rIt->setParagraph(xParagraph); - } - return xParagraph; -} - -void Document::determineVisibleRange() -{ - Paragraphs::iterator const aEnd = m_xParagraphs->end(); - - m_aVisibleBegin = aEnd; - m_aVisibleEnd = aEnd; - m_nVisibleBeginOffset = 0; - - ::sal_Int32 nPos = 0; - for (Paragraphs::iterator aIt = m_xParagraphs->begin(); m_aVisibleEnd == aEnd && aIt != aEnd; ++aIt) - { - ::sal_Int32 const nOldPos = nPos; - nPos += aIt->getHeight(); // XXX numeric overflow - if (m_aVisibleBegin == aEnd) - { - if (nPos >= m_nViewOffset) - { - m_aVisibleBegin = aIt; - m_nVisibleBeginOffset = m_nViewOffset - nOldPos; - } - } - else - { - if (nPos >= m_nViewOffset + m_nViewHeight) // XXX numeric overflow - { - m_aVisibleEnd = aIt; - } - } - } - - OSL_POSTCOND( - (m_aVisibleBegin == m_xParagraphs->end() && m_aVisibleEnd == m_xParagraphs->end() && m_nVisibleBeginOffset == 0) - || (m_aVisibleBegin < m_aVisibleEnd && m_nVisibleBeginOffset >= 0), - "invalid visible range"); -} - -void Document::notifyVisibleRangeChanges( - Paragraphs::iterator const & rOldVisibleBegin, - Paragraphs::iterator const & rOldVisibleEnd, - Paragraphs::iterator const & rInserted) -{ - // XXX Replace this code that determines which paragraphs have changed from - // invisible to visible or vice versa with a better algorithm. - {for (Paragraphs::iterator aIt(rOldVisibleBegin); aIt != rOldVisibleEnd; - ++aIt) - if (aIt != rInserted - && (aIt < m_aVisibleBegin || aIt >= m_aVisibleEnd)) - NotifyAccessibleEvent( - ::css::accessibility::AccessibleEventId:: - CHILD, - ::css::uno::makeAny(getAccessibleChild(aIt)), - ::css::uno::Any()); - } - {for (Paragraphs::iterator aIt(m_aVisibleBegin); aIt != m_aVisibleEnd; - ++aIt) - if (aIt == rInserted - || aIt < rOldVisibleBegin || aIt >= rOldVisibleEnd) - NotifyAccessibleEvent( - ::css::accessibility::AccessibleEventId:: - CHILD, - ::css::uno::Any(), - ::css::uno::makeAny(getAccessibleChild(aIt))); - } -} - -void -Document::changeParagraphText(::sal_uLong nNumber, ::sal_uInt16 nBegin, ::sal_uInt16 nEnd, - bool bCut, bool bPaste, - ::rtl::OUString const & rText) -{ - m_rView.SetSelection(::TextSelection(::TextPaM(nNumber, nBegin), - ::TextPaM(nNumber, nEnd))); - if (bCut) - m_rView.Cut(); - else if (nBegin != nEnd) - m_rView.DeleteSelected(); - if (bPaste) - m_rView.Paste(); - else if (rText.getLength() != 0) - m_rView.InsertText(rText); -} - -void Document::handleParagraphNotifications() -{ - while (!m_aParagraphNotifications.empty()) - { - ::TextHint aHint(m_aParagraphNotifications.front()); - m_aParagraphNotifications.pop(); - switch (aHint.GetId()) - { - case TEXT_HINT_PARAINSERTED: - { - ::sal_uLong n = aHint.GetValue(); - OSL_ENSURE(n <= m_xParagraphs->size(), - "bad TEXT_HINT_PARAINSERTED event"); - - // Save the values of old iterators (the iterators themselves - // will get invalidated), and adjust the old values so that they - // reflect the insertion of the new paragraph: - Paragraphs::size_type nOldVisibleBegin - = m_aVisibleBegin - m_xParagraphs->begin(); - Paragraphs::size_type nOldVisibleEnd - = m_aVisibleEnd - m_xParagraphs->begin(); - Paragraphs::size_type nOldFocused - = m_aFocused - m_xParagraphs->begin(); - if (n <= nOldVisibleBegin) - ++nOldVisibleBegin; // XXX numeric overflow - if (n <= nOldVisibleEnd) - ++nOldVisibleEnd; // XXX numeric overflow - if (n <= nOldFocused) - ++nOldFocused; // XXX numeric overflow - if (sal::static_int_cast(n) <= m_nSelectionFirstPara) - ++m_nSelectionFirstPara; // XXX numeric overflow - if (sal::static_int_cast(n) <= m_nSelectionLastPara) - ++m_nSelectionLastPara; // XXX numeric overflow - - Paragraphs::iterator aIns( - m_xParagraphs->insert( - m_xParagraphs->begin() + n, - ParagraphInfo(static_cast< ::sal_Int32 >( - m_rEngine.GetTextHeight(n))))); - // XXX numeric overflow (2x) - - determineVisibleRange(); - m_aFocused = m_xParagraphs->begin() + nOldFocused; - - for (Paragraphs::iterator aIt(aIns);;) - { - ++aIt; - if (aIt == m_xParagraphs->end()) - break; - ::rtl::Reference< ParagraphImpl > xParagraph( - getParagraph(aIt)); - if (xParagraph.is()) - xParagraph->numberChanged(true); - } - - notifyVisibleRangeChanges( - m_xParagraphs->begin() + nOldVisibleBegin, - m_xParagraphs->begin() + nOldVisibleEnd, aIns); - break; - } - case TEXT_HINT_PARAREMOVED: - { - ::sal_uLong n = aHint.GetValue(); - if (n == TEXT_PARA_ALL) - { - {for (Paragraphs::iterator aIt(m_aVisibleBegin); - aIt != m_aVisibleEnd; ++aIt) - NotifyAccessibleEvent( - ::css::accessibility::AccessibleEventId:: - CHILD, - ::css::uno::makeAny(getAccessibleChild(aIt)), - ::css::uno::Any()); - } - disposeParagraphs(); - m_xParagraphs->clear(); - determineVisibleRange(); - m_nSelectionFirstPara = -1; - m_nSelectionFirstPos = -1; - m_nSelectionLastPara = -1; - m_nSelectionLastPos = -1; - m_aFocused = m_xParagraphs->end(); - } - else - { - OSL_ENSURE(n < m_xParagraphs->size(), - "Bad TEXT_HINT_PARAREMOVED event"); - - Paragraphs::iterator aIt(m_xParagraphs->begin() + n); - // numeric overflow cannot occur - - // Save the values of old iterators (the iterators - // themselves will get invalidated), and adjust the old - // values so that they reflect the removal of the paragraph: - Paragraphs::size_type nOldVisibleBegin - = m_aVisibleBegin - m_xParagraphs->begin(); - Paragraphs::size_type nOldVisibleEnd - = m_aVisibleEnd - m_xParagraphs->begin(); - bool bWasVisible - = nOldVisibleBegin <= n && n < nOldVisibleEnd; - Paragraphs::size_type nOldFocused - = m_aFocused - m_xParagraphs->begin(); - bool bWasFocused = aIt == m_aFocused; - if (n < nOldVisibleBegin) - --nOldVisibleBegin; - if (n < nOldVisibleEnd) - --nOldVisibleEnd; - if (n < nOldFocused) - --nOldFocused; - if (sal::static_int_cast(n) < m_nSelectionFirstPara) - --m_nSelectionFirstPara; - else if (sal::static_int_cast(n) == m_nSelectionFirstPara) - { - if (m_nSelectionFirstPara == m_nSelectionLastPara) - { - m_nSelectionFirstPara = -1; - m_nSelectionFirstPos = -1; - m_nSelectionLastPara = -1; - m_nSelectionLastPos = -1; - } - else - { - ++m_nSelectionFirstPara; - m_nSelectionFirstPos = 0; - } - } - if (sal::static_int_cast(n) < m_nSelectionLastPara) - --m_nSelectionLastPara; - else if (sal::static_int_cast(n) == m_nSelectionLastPara) - { - OSL_ENSURE(m_nSelectionFirstPara < m_nSelectionLastPara, - "logic error"); - --m_nSelectionLastPara; - m_nSelectionLastPos = 0x7FFFFFFF; - } - - ::css::uno::Reference< ::css::accessibility::XAccessible > - xStrong; - if (bWasVisible) - xStrong = getAccessibleChild(aIt); - ::css::uno::WeakReference< - ::css::accessibility::XAccessible > xWeak( - aIt->getParagraph()); - aIt = m_xParagraphs->erase(aIt); - - determineVisibleRange(); - m_aFocused = bWasFocused ? m_xParagraphs->end() - : m_xParagraphs->begin() + nOldFocused; - - for (; aIt != m_xParagraphs->end(); ++aIt) - { - ::rtl::Reference< ParagraphImpl > xParagraph( - getParagraph(aIt)); - if (xParagraph.is()) - xParagraph->numberChanged(false); - } - - if (bWasVisible) - NotifyAccessibleEvent( - ::css::accessibility::AccessibleEventId:: - CHILD, - ::css::uno::makeAny(xStrong), - ::css::uno::Any()); - - ::css::uno::Reference< ::css::lang::XComponent > xComponent( - xWeak.get(), ::css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - - notifyVisibleRangeChanges( - m_xParagraphs->begin() + nOldVisibleBegin, - m_xParagraphs->begin() + nOldVisibleEnd, - m_xParagraphs->end()); - } - break; - } - case TEXT_HINT_FORMATPARA: - { - ::sal_uLong n = aHint.GetValue(); - OSL_ENSURE(n < m_xParagraphs->size(), - "Bad TEXT_HINT_FORMATPARA event"); - - (*m_xParagraphs)[static_cast< Paragraphs::size_type >(n)]. - changeHeight(static_cast< ::sal_Int32 >( - m_rEngine.GetTextHeight(n))); - // XXX numeric overflow - Paragraphs::iterator aOldVisibleBegin(m_aVisibleBegin); - Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd); - determineVisibleRange(); - notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd, - m_xParagraphs->end()); - - if (n < m_xParagraphs->size()) - { - Paragraphs::iterator aIt(m_xParagraphs->begin() + n); - ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt)); - if (xParagraph.is()) - xParagraph->textChanged(); - } - break; - } - default: - OSL_FAIL( "bad buffered hint"); - break; - } - } - if (m_bSelectionChangedNotification) - { - m_bSelectionChangedNotification = false; - handleSelectionChangeNotification(); - } -} - -void Document::handleSelectionChangeNotification() -{ - ::TextSelection const & rSelection = m_rView.GetSelection(); - OSL_ENSURE(rSelection.GetStart().GetPara() < m_xParagraphs->size() - && rSelection.GetEnd().GetPara() < m_xParagraphs->size(), - "bad TEXT_HINT_VIEWSELECTIONCHANGED event"); - ::sal_Int32 nNewFirstPara - = static_cast< ::sal_Int32 >(rSelection.GetStart().GetPara()); - ::sal_Int32 nNewFirstPos - = static_cast< ::sal_Int32 >(rSelection.GetStart().GetIndex()); - // XXX numeric overflow - ::sal_Int32 nNewLastPara - = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetPara()); - ::sal_Int32 nNewLastPos - = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetIndex()); - // XXX numeric overflow - - // Lose focus: - Paragraphs::iterator aIt(m_xParagraphs->begin() + nNewLastPara); - if (m_aFocused != m_xParagraphs->end() && m_aFocused != aIt - && m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd) - { - ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(m_aFocused)); - if (xParagraph.is()) - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId:: - STATE_CHANGED, - ::css::uno::makeAny( - ::css::accessibility::AccessibleStateType::FOCUSED), - ::css::uno::Any()); - } - - // Gain focus and update cursor position: - if (aIt >= m_aVisibleBegin && aIt < m_aVisibleEnd - && (aIt != m_aFocused - || nNewLastPara != m_nSelectionLastPara - || nNewLastPos != m_nSelectionLastPos)) - { - ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt)); - if (xParagraph.is()) - { - if (aIt != m_aFocused) - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId:: - STATE_CHANGED, - ::css::uno::Any(), - ::css::uno::makeAny( - ::css::accessibility::AccessibleStateType::FOCUSED)); - if (nNewLastPara != m_nSelectionLastPara - || nNewLastPos != m_nSelectionLastPos) - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId:: - CARET_CHANGED, - ::css::uno::makeAny< ::sal_Int32 >( - nNewLastPara == m_nSelectionLastPara - ? m_nSelectionLastPos : 0), - ::css::uno::makeAny(nNewLastPos)); - } - } - m_aFocused = aIt; - - // Update both old and new selection. (Regardless of how the two selections - // look like, there will always be two ranges to the left and right of the - // overlap---the overlap and/or the range to the right of it possibly being - // empty. Only for these two ranges notifications have to be sent.) - - TextPaM aOldTextStart( static_cast< sal_uLong >( m_nSelectionFirstPara ), static_cast< sal_uInt16 >( m_nSelectionFirstPos ) ); - TextPaM aOldTextEnd( static_cast< sal_uLong >( m_nSelectionLastPara ), static_cast< sal_uInt16 >( m_nSelectionLastPos ) ); - TextPaM aNewTextStart( static_cast< sal_uLong >( nNewFirstPara ), static_cast< sal_uInt16 >( nNewFirstPos ) ); - TextPaM aNewTextEnd( static_cast< sal_uLong >( nNewLastPara ), static_cast< sal_uInt16 >( nNewLastPos ) ); - - // justify selections - justifySelection( aOldTextStart, aOldTextEnd ); - justifySelection( aNewTextStart, aNewTextEnd ); - - sal_Int32 nFirst1; - sal_Int32 nLast1; - sal_Int32 nFirst2; - sal_Int32 nLast2; - - if ( m_nSelectionFirstPara == -1 ) - { - // old selection not initialized yet => notify events only for new selection (if not empty) - nFirst1 = aNewTextStart.GetPara(); - nLast1 = aNewTextEnd.GetPara() + ( aNewTextStart != aNewTextEnd ? 1 : 0 ); - nFirst2 = 0; - nLast2 = 0; - } - else if ( aOldTextStart == aOldTextEnd && aNewTextStart == aNewTextEnd ) - { - // old and new selection empty => no events - nFirst1 = 0; - nLast1 = 0; - nFirst2 = 0; - nLast2 = 0; - } - else if ( aOldTextStart != aOldTextEnd && aNewTextStart == aNewTextEnd ) - { - // old selection not empty + new selection empty => notify events only for old selection - nFirst1 = aOldTextStart.GetPara(); - nLast1 = aOldTextEnd.GetPara() + 1; - nFirst2 = 0; - nLast2 = 0; - } - else if ( aOldTextStart == aOldTextEnd && aNewTextStart != aNewTextEnd ) - { - // old selection empty + new selection not empty => notify events only for new selection - nFirst1 = aNewTextStart.GetPara(); - nLast1 = aNewTextEnd.GetPara() + 1; - nFirst2 = 0; - nLast2 = 0; - } - else - { - // old and new selection not empty => notify events for the two ranges left and right of the overlap - ::std::vector< TextPaM > aTextPaMs(4); - aTextPaMs[0] = aOldTextStart; - aTextPaMs[1] = aOldTextEnd; - aTextPaMs[2] = aNewTextStart; - aTextPaMs[3] = aNewTextEnd; - ::std::sort( aTextPaMs.begin(), aTextPaMs.end() ); - - nFirst1 = aTextPaMs[0].GetPara(); - nLast1 = aTextPaMs[1].GetPara() + ( aTextPaMs[0] != aTextPaMs[1] ? 1 : 0 ); - - nFirst2 = aTextPaMs[2].GetPara(); - nLast2 = aTextPaMs[3].GetPara() + ( aTextPaMs[2] != aTextPaMs[3] ? 1 : 0 ); - - // adjust overlapping ranges - if ( nLast1 > nFirst2 ) - nLast1 = nFirst2; - } - - // notify selection changes - notifySelectionChange( nFirst1, nLast1 ); - notifySelectionChange( nFirst2, nLast2 ); - - m_nSelectionFirstPara = nNewFirstPara; - m_nSelectionFirstPos = nNewFirstPos; - m_nSelectionLastPara = nNewLastPara; - m_nSelectionLastPos = nNewLastPos; -} - -void Document::notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast ) -{ - if ( nFirst < nLast ) - { - Paragraphs::iterator aEnd( ::std::min( m_xParagraphs->begin() + nLast, m_aVisibleEnd ) ); - for ( Paragraphs::iterator aIt = ::std::max( m_xParagraphs->begin() + nFirst, m_aVisibleBegin ); aIt < aEnd; ++aIt ) - { - ::rtl::Reference< ParagraphImpl > xParagraph( getParagraph( aIt ) ); - if ( xParagraph.is() ) - { - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId::SELECTION_CHANGED, - ::css::uno::Any(), ::css::uno::Any() ); - xParagraph->notifyEvent( - ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED, - ::css::uno::Any(), ::css::uno::Any() ); - } - } - } -} - -void Document::justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd ) -{ - if ( rTextStart > rTextEnd ) - { - TextPaM aTextPaM( rTextStart ); - rTextStart = rTextEnd; - rTextEnd = aTextPaM; - } -} - -void Document::disposeParagraphs() -{ - for (Paragraphs::iterator aIt(m_xParagraphs->begin()); - aIt != m_xParagraphs->end(); ++aIt) - { - ::css::uno::Reference< ::css::lang::XComponent > xComponent( - aIt->getParagraph().get(), ::css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } -} - -// static -::css::uno::Any Document::mapFontColor(::Color const & rColor) -{ - return ::css::uno::makeAny( - static_cast< ::sal_Int32 >(COLORDATA_RGB(rColor.GetColor()))); - // FIXME keep transparency? -} - -// static -::Color Document::mapFontColor(::css::uno::Any const & rColor) -{ - ::sal_Int32 nColor = 0; - rColor >>= nColor; - return ::Color(static_cast< ::ColorData >(nColor)); -} - -// static -::css::uno::Any Document::mapFontWeight(::FontWeight nWeight) -{ - // Map from ::FontWeight to ::css:awt::FontWeight, depends on order of - // elements in ::FontWeight (vcl/vclenum.hxx): - static float const aWeight[] - = { ::css::awt::FontWeight::DONTKNOW, // WEIGHT_DONTKNOW - ::css::awt::FontWeight::THIN, // WEIGHT_THIN - ::css::awt::FontWeight::ULTRALIGHT, // WEIGHT_ULTRALIGHT - ::css::awt::FontWeight::LIGHT, // WEIGHT_LIGHT - ::css::awt::FontWeight::SEMILIGHT, // WEIGHT_SEMILIGHT - ::css::awt::FontWeight::NORMAL, // WEIGHT_NORMAL - ::css::awt::FontWeight::NORMAL, // WEIGHT_MEDIUM - ::css::awt::FontWeight::SEMIBOLD, // WEIGHT_SEMIBOLD - ::css::awt::FontWeight::BOLD, // WEIGHT_BOLD - ::css::awt::FontWeight::ULTRABOLD, // WEIGHT_ULTRABOLD - ::css::awt::FontWeight::BLACK }; // WEIGHT_BLACK - return ::css::uno::makeAny(aWeight[nWeight]); -} - -// static -::FontWeight Document::mapFontWeight(::css::uno::Any const & rWeight) -{ - float nWeight = ::css::awt::FontWeight::NORMAL; - rWeight >>= nWeight; - return nWeight <= ::css::awt::FontWeight::DONTKNOW ? WEIGHT_DONTKNOW - : nWeight <= ::css::awt::FontWeight::THIN ? WEIGHT_THIN - : nWeight <= ::css::awt::FontWeight::ULTRALIGHT ? WEIGHT_ULTRALIGHT - : nWeight <= ::css::awt::FontWeight::LIGHT ? WEIGHT_LIGHT - : nWeight <= ::css::awt::FontWeight::SEMILIGHT ? WEIGHT_SEMILIGHT - : nWeight <= ::css::awt::FontWeight::NORMAL ? WEIGHT_NORMAL - : nWeight <= ::css::awt::FontWeight::SEMIBOLD ? WEIGHT_SEMIBOLD - : nWeight <= ::css::awt::FontWeight::BOLD ? WEIGHT_BOLD - : nWeight <= ::css::awt::FontWeight::ULTRABOLD ? WEIGHT_ULTRABOLD - : WEIGHT_BLACK; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx deleted file mode 100644 index 0c0bf172e..000000000 --- a/accessibility/source/helper/acc_factory.cxx +++ /dev/null @@ -1,555 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "floatingwindowaccessible.hxx" - -//........................................................................ -namespace accessibility -{ - -inline bool hasFloatingChild(Window *pWindow) -{ - Window * pChild = pWindow->GetAccessibleChildWindow(0); - if( pChild && WINDOW_FLOATINGWINDOW == pChild->GetType() ) - return true; - - return false; -} - -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::accessibility; - using namespace ::svt; - using namespace ::svt::table; - - //================================================================ - //= IAccessibleFactory - //================================================================ - class AccessibleFactory :public ::toolkit::IAccessibleFactory - ,public ::svt::IAccessibleFactory - { - private: - oslInterlockedCount m_refCount; - - public: - AccessibleFactory(); - - // IReference - virtual oslInterlockedCount SAL_CALL acquire(); - virtual oslInterlockedCount SAL_CALL release(); - - // ::toolkit::IAccessibleFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXButton* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXCheckBox* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXRadioButton* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXListBox* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXFixedText* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXFixedHyperlink* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXScrollBar* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXEdit* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXComboBox* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXToolBox* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleContext( VCLXWindow* _pXWindow ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar ); - - // ::svt::IAccessibleFactory - virtual IAccessibleTabListBox* - createAccessibleTabListBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - SvHeaderTabListBox& rBox - ) const; - - virtual IAccessibleBrowseBox* - createAccessibleBrowseBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - IAccessibleTableProvider& _rBrowseBox - ) const; - - virtual IAccessibleTableControl* - createAccessibleTableControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - IAccessibleTable& _rTable - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleIconChoiceCtrl( - SvtIconChoiceCtrl& _rIconCtrl, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleTabBar( - TabBar& _rTabBar - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleTextWindowContext( - VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleTreeListBox( - SvTreeListBox& _rListBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderBar( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - IAccessibleTableProvider& _rOwningTable, - AccessibleBrowseBoxObjType _eObjType - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleBrowseBoxTableCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowId, - sal_uInt16 _nColId, - sal_Int32 _nOffset - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderCell( - sal_Int32 _nColumnRowId, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, - IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - AccessibleBrowseBoxObjType _eObjType - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleCheckBoxCell( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, - IAccessibleTableProvider& _rBrowseBox, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - const TriState& _eState, - sal_Bool _bEnabled, - sal_Bool _bIsTriState - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createEditBrowseBoxTableCellAccess( - const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent, - const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxControlAccessible, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _rxFocusWindow, - IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ) const; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleToolPanelDeck( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > - createAccessibleToolPanelTabBar( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ); - - protected: - virtual ~AccessibleFactory(); - }; - - - //-------------------------------------------------------------------- - AccessibleFactory::AccessibleFactory() - :m_refCount( 0 ) - { - } - - //-------------------------------------------------------------------- - AccessibleFactory::~AccessibleFactory() - { - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL AccessibleFactory::acquire() - { - return osl_incrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL AccessibleFactory::release() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - { - delete this; - return 0; - } - return m_refCount; - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar ) - { - OAccessibleMenuBaseComponent* pAccessible; - if ( _bIsMenuBar ) - pAccessible = new VCLXAccessibleMenuBar( _pMenu ); - else - pAccessible = new VCLXAccessiblePopupMenu( _pMenu ); - pAccessible->SetStates(); - return pAccessible; - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXButton* _pXWindow ) - { - return new VCLXAccessibleButton( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXCheckBox* _pXWindow ) - { - return new VCLXAccessibleCheckBox( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXRadioButton* _pXWindow ) - { - return new VCLXAccessibleRadioButton( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXListBox* _pXWindow ) - { - sal_Bool bIsDropDownBox = sal_False; - ListBox* pBox = static_cast< ListBox* >( _pXWindow->GetWindow() ); - if ( pBox ) - bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ); - - if ( bIsDropDownBox ) - return new VCLXAccessibleDropDownListBox( _pXWindow ); - else - return new VCLXAccessibleListBox( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedText* _pXWindow ) - { - return new VCLXAccessibleFixedText( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) - { - return new VCLXAccessibleFixedHyperlink( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXScrollBar* _pXWindow ) - { - return new VCLXAccessibleScrollBar( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXEdit* _pXWindow ) - { - return new VCLXAccessibleEdit( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow ) - { - sal_Bool bIsDropDownBox = sal_False; - ComboBox* pBox = static_cast< ComboBox* >( _pXWindow->GetWindow() ); - if ( pBox ) - bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ); - - if ( bIsDropDownBox ) - return new VCLXAccessibleDropDownComboBox( _pXWindow ); - else - return new VCLXAccessibleComboBox( _pXWindow ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXWindow* _pXWindow ) - { - Reference< XAccessibleContext > xContext; - - Window* pWindow = _pXWindow->GetWindow(); - if ( pWindow ) - { - WindowType nType = pWindow->GetType(); - - if ( nType == WINDOW_MENUBARWINDOW || pWindow->IsMenuFloatingWindow() || pWindow->IsToolbarFloatingWindow() ) - { - Reference< XAccessible > xAcc( pWindow->GetAccessible() ); - if ( xAcc.is() ) - { - Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() ); - if ( pWindow->GetType() == WINDOW_MENUBARWINDOW || - ( xCont.is() && xCont->getAccessibleRole() == AccessibleRole::POPUP_MENU ) ) - { - xContext = xCont; - } - } - } - else if ( nType == WINDOW_STATUSBAR ) - { - xContext = (XAccessibleContext*) new VCLXAccessibleStatusBar( _pXWindow ); - } - else if ( nType == WINDOW_TABCONTROL ) - { - xContext = (XAccessibleContext*) new VCLXAccessibleTabControl( _pXWindow ); - } - else if ( nType == WINDOW_TABPAGE && pWindow->GetAccessibleParentWindow() && pWindow->GetAccessibleParentWindow()->GetType() == WINDOW_TABCONTROL ) - { - xContext = new VCLXAccessibleTabPageWindow( _pXWindow ); - } - else if ( nType == WINDOW_FLOATINGWINDOW ) - { - xContext = new FloatingWindowAccessible( _pXWindow ); - } - else if ( nType == WINDOW_BORDERWINDOW && hasFloatingChild( pWindow ) ) - { - PopupMenuFloatingWindow* pChild = dynamic_cast( - pWindow->GetAccessibleChildWindow(0)); - if ( pChild && pChild->IsPopupMenu() ) - { - // Get the accessible context from the child window. - Reference xAccessible = pChild->CreateAccessible(); - if (xAccessible.is()) - xContext = xAccessible->getAccessibleContext(); - } - else - xContext = new FloatingWindowAccessible( _pXWindow ); - } - else if ( ( nType == WINDOW_HELPTEXTWINDOW ) || ( nType == WINDOW_FIXEDLINE ) ) - { - xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleFixedText( _pXWindow ); - } - else - { - xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleComponent( _pXWindow ); - } - } - - return xContext; - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXToolBox* _pXWindow ) - { - return new VCLXAccessibleToolBox( _pXWindow ); - } - - //-------------------------------------------------------------------- - IAccessibleTabListBox* AccessibleFactory::createAccessibleTabListBox( - const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) const - { - return new AccessibleTabListBox( rxParent, rBox ); - } - - //-------------------------------------------------------------------- - IAccessibleBrowseBox* AccessibleFactory::createAccessibleBrowseBox( - const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) const - { - return new AccessibleBrowseBoxAccess( _rxParent, _rBrowseBox ); - } - - //-------------------------------------------------------------------- - IAccessibleTableControl* AccessibleFactory::createAccessibleTableControl( - const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) const - { - return new AccessibleGridControlAccess( _rxParent, _rTable ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl( - SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) const - { - return new AccessibleIconChoiceCtrl( _rIconCtrl, _xParent ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTabBar ) const - { - return new AccessibleTabBar( &_rTabBar ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleTextWindowContext( - VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild ) const - { - return new Document( pVclXWindow, rEngine, rView, bCompoundControlChild ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleTreeListBox( - SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) const - { - return new AccessibleListBox( _rListBox, _xParent ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderBar( - const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rOwningTable, - AccessibleBrowseBoxObjType _eObjType ) const - { - return new AccessibleBrowseBoxHeaderBar( rxParent, _rOwningTable, _eObjType ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxTableCell( - const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox, - const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowId, sal_uInt16 _nColId, sal_Int32 _nOffset ) const - { - return new AccessibleBrowseBoxTableCell( _rxParent, _rBrowseBox, _xFocusWindow, - _nRowId, _nColId, _nOffset ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderCell( - sal_Int32 _nColumnRowId, const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rBrowseBox, - const Reference< XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType _eObjType ) const - { - return new AccessibleBrowseBoxHeaderCell( _nColumnRowId, rxParent, _rBrowseBox, - _xFocusWindow, _eObjType ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createAccessibleCheckBoxCell( - const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox, - const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowPos, sal_uInt16 _nColPos, - const TriState& _eState, sal_Bool _bEnabled, sal_Bool _bIsTriState ) const - { - return new AccessibleCheckBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, - _nRowPos, _nColPos, _eState, _bEnabled, _bIsTriState ); - } - - //-------------------------------------------------------------------- - Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess( - const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxControlAccessible, - const Reference< XWindow >& _rxFocusWindow, IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, sal_uInt16 _nColPos ) const - { - return new EditBrowseBoxTableCellAccess( _rxParent, _rxControlAccessible, - _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck( - const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck ) - { - return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck ); - } - - //-------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar( - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) - { - return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar ); - } - -//........................................................................ -} // namespace accessibility -//........................................................................ - -//======================================================================== -extern "C" void* SAL_CALL getStandardAccessibleFactory() -{ - ::toolkit::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory; - pFactory->acquire(); - return pFactory; -} - -extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory() -{ - ::svt::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory; - pFactory->acquire(); - return pFactory; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/accessiblestrings.src b/accessibility/source/helper/accessiblestrings.src deleted file mode 100644 index 34f3b381b..000000000 --- a/accessibility/source/helper/accessiblestrings.src +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ -#include -#endif - - -String RID_STR_ACC_ACTION_CLICK -{ - Text = "click"; -}; - -String RID_STR_ACC_ACTION_TOGGLEPOPUP -{ - Text = "togglePopup"; -}; - -String RID_STR_ACC_ACTION_SELECT -{ - Text = "select"; -}; - -String RID_STR_ACC_ACTION_INCLINE -{ - Text = "incrementLine"; -}; - -String RID_STR_ACC_ACTION_DECLINE -{ - Text = "decrementLine"; -}; - -String RID_STR_ACC_ACTION_INCBLOCK -{ - Text = "incrementBlock"; -}; - -String RID_STR_ACC_ACTION_DECBLOCK -{ - Text = "decrementBlock"; -}; - -String RID_STR_ACC_NAME_BROWSEBUTTON -{ - Text [ en-US ] = "Browse"; -}; - -String RID_STR_ACC_DESC_PANELDECL_TABBAR -{ - Text [ en-US ] = "Panel Deck Tab Bar"; -}; diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx deleted file mode 100644 index f81231156..000000000 --- a/accessibility/source/helper/accresmgr.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include -#include - - -// ----------------------------------------------------------------------------- -// TkResMgr -// ----------------------------------------------------------------------------- - -SimpleResMgr* TkResMgr::m_pImpl = NULL; - -// ----------------------------------------------------------------------------- - -TkResMgr::EnsureDelete::~EnsureDelete() -{ - delete TkResMgr::m_pImpl; -} - -// ----------------------------------------------------------------------------- - -void TkResMgr::ensureImplExists() -{ - if (m_pImpl) - return; - - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - - m_pImpl = SimpleResMgr::Create("acc", aLocale ); - - if (m_pImpl) - { - // now that we have a impl class, make sure it's deleted on unloading the library - static TkResMgr::EnsureDelete s_aDeleteTheImplClass; - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString TkResMgr::loadString( sal_uInt16 nResId ) -{ - ::rtl::OUString sReturn; - - ensureImplExists(); - if ( m_pImpl ) - sReturn = m_pImpl->ReadString( nResId ); - - return sReturn; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/accessibility/source/helper/characterattributeshelper.cxx deleted file mode 100644 index ec800b73e..000000000 --- a/accessibility/source/helper/characterattributeshelper.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; - - -CharacterAttributesHelper::CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor ) -{ - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharBackColor" )), makeAny( (sal_Int32) nBackColor ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" )), makeAny( (sal_Int32) nColor ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" )), makeAny( (sal_Int16) rFont.GetCharSet() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamily" )), makeAny( (sal_Int16) rFont.GetFamily() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" )), makeAny( (::rtl::OUString) rFont.GetName() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitch" )), makeAny( (sal_Int16) rFont.GetPitch() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontStyleName" )), makeAny( (::rtl::OUString) rFont.GetStyleName() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" )), makeAny( (sal_Int16) rFont.GetSize().Height() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharScaleWidth" )), makeAny( (sal_Int16) rFont.GetSize().Width() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" )), makeAny( (sal_Int16) rFont.GetStrikeout() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" )), makeAny( (sal_Int16) rFont.GetUnderline() ) ) ); - m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" )), makeAny( (float) rFont.GetWeight() ) ) ); -} - - -CharacterAttributesHelper::~CharacterAttributesHelper() -{ - m_aAttributeMap.clear(); -} - - -Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes() -{ - Sequence< PropertyValue > aValues( m_aAttributeMap.size() ); - PropertyValue* pValues = aValues.getArray(); - - for ( AttributeMap::iterator aIt = m_aAttributeMap.begin(); aIt != m_aAttributeMap.end(); ++aIt, ++pValues ) - { - pValues->Name = aIt->first; - pValues->Handle = (sal_Int32) -1; - pValues->Value = aIt->second; - pValues->State = PropertyState_DIRECT_VALUE; - } - - return aValues; -} - - -Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes( const Sequence< ::rtl::OUString >& aRequestedAttributes ) -{ - Sequence< PropertyValue > aValues; - sal_Int32 nLength = aRequestedAttributes.getLength(); - - if ( nLength != 0 ) - { - const ::rtl::OUString* pNames = aRequestedAttributes.getConstArray(); - AttributeMap aAttributeMap; - - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - AttributeMap::iterator aFound = m_aAttributeMap.find( pNames[i] ); - if ( aFound != m_aAttributeMap.end() ) - aAttributeMap.insert( *aFound ); - } - - aValues.realloc( aAttributeMap.size() ); - PropertyValue* pValues = aValues.getArray(); - - for ( AttributeMap::iterator aIt = aAttributeMap.begin(); aIt != aAttributeMap.end(); ++aIt, ++pValues ) - { - pValues->Name = aIt->first; - pValues->Handle = (sal_Int32) -1; - pValues->Value = aIt->second; - pValues->State = PropertyState_DIRECT_VALUE; - } - } - else - { - aValues = GetCharacterAttributes(); - } - - return aValues; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/makefile.mk b/accessibility/source/helper/makefile.mk deleted file mode 100644 index 72284e38f..000000000 --- a/accessibility/source/helper/makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=accessibility -TARGET=helper - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/acc_factory.obj \ - $(SLO)$/accresmgr.obj \ - $(SLO)$/characterattributeshelper.obj \ - -SRS1NAME=$(TARGET) -SRC1FILES=\ - accessiblestrings.src - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/accessibility/source/inc/floatingwindowaccessible.hxx b/accessibility/source/inc/floatingwindowaccessible.hxx deleted file mode 100644 index d967238fb..000000000 --- a/accessibility/source/inc/floatingwindowaccessible.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX -#define ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX - -#include - -class FloatingWindowAccessible : public VCLXAccessibleComponent -{ -public: - FloatingWindowAccessible( VCLXWindow* pWindow ); - virtual ~FloatingWindowAccessible(); - - virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ); -}; - -#endif // ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx deleted file mode 100644 index 6688215e3..000000000 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ /dev/null @@ -1,786 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// OAccessibleMenuBaseComponent -// ----------------------------------------------------------------------------- - -OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent( Menu* pMenu ) - :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) - ,m_pMenu( pMenu ) - ,m_bEnabled( sal_False ) - ,m_bFocused( sal_False ) - ,m_bVisible( sal_False ) - ,m_bSelected( sal_False ) - ,m_bChecked( sal_False ) -{ - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - - if ( m_pMenu ) - { - m_aAccessibleChildren.assign( m_pMenu->GetItemCount(), Reference< XAccessible >() ); - m_pMenu->AddEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) ); - } -} - -// ----------------------------------------------------------------------------- - -OAccessibleMenuBaseComponent::~OAccessibleMenuBaseComponent() -{ - if ( m_pMenu ) - m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) ); - - delete m_pExternalLock; - m_pExternalLock = NULL; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsEnabled() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsFocused() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsVisible() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsSelected() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsChecked() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetStates() -{ - m_bEnabled = IsEnabled(); - m_bFocused = IsFocused(); - m_bVisible = IsVisible(); - m_bSelected = IsSelected(); - m_bChecked = IsChecked(); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetEnabled( sal_Bool bEnabled ) -{ - if ( m_bEnabled != bEnabled ) - { - Any aOldValue[2], aNewValue[2]; - if ( m_bEnabled ) - { - aOldValue[0] <<= AccessibleStateType::SENSITIVE; - aOldValue[1] <<= AccessibleStateType::ENABLED; - } - else - { - aNewValue[0] <<= AccessibleStateType::ENABLED; - aNewValue[1] <<= AccessibleStateType::SENSITIVE; - } - m_bEnabled = bEnabled; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] ); - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] ); - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetFocused( sal_Bool bFocused ) -{ - if ( m_bFocused != bFocused ) - { - Any aOldValue, aNewValue; - if ( m_bFocused ) - aOldValue <<= AccessibleStateType::FOCUSED; - else - aNewValue <<= AccessibleStateType::FOCUSED; - m_bFocused = bFocused; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetVisible( sal_Bool bVisible ) -{ - if ( m_bVisible != bVisible ) - { - Any aOldValue, aNewValue; - if ( m_bVisible ) - aOldValue <<= AccessibleStateType::VISIBLE; - else - aNewValue <<= AccessibleStateType::VISIBLE; - m_bVisible = bVisible; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetSelected( sal_Bool bSelected ) -{ - if ( m_bSelected != bSelected ) - { - Any aOldValue, aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SetChecked( sal_Bool bChecked ) -{ - if ( m_bChecked != bChecked ) - { - Any aOldValue, aNewValue; - if ( m_bChecked ) - aOldValue <<= AccessibleStateType::CHECKED; - else - aNewValue <<= AccessibleStateType::CHECKED; - m_bChecked = bChecked; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetEnabled( bEnabled ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, sal_Bool bFocused ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetFocused( bFocused ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateVisible() -{ - SetVisible( IsVisible() ); - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetVisible( pComp->IsVisible() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateSelected( sal_Int32 i, sal_Bool bSelected ) -{ - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetSelected( bSelected ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateChecked( sal_Int32 i, sal_Bool bChecked ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetChecked( bChecked ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateAccessibleName( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetAccessibleName( pComp->GetAccessibleName() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::UpdateItemText( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetItemText( pComp->GetItemText() ); - } - } -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuBaseComponent::GetChildCount() -{ - return m_aAccessibleChildren.size(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i ) -{ - Reference< XAccessible > xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - { - if ( m_pMenu ) - { - // create a new child - OAccessibleMenuBaseComponent* pChild; - - if ( m_pMenu->GetItemType( (sal_uInt16)i ) == MENUITEM_SEPARATOR ) - { - pChild = new VCLXAccessibleMenuSeparator( m_pMenu, (sal_uInt16)i ); - } - else - { - PopupMenu* pPopupMenu = m_pMenu->GetPopupMenu( m_pMenu->GetItemId( (sal_uInt16)i ) ); - if ( pPopupMenu ) - { - pChild = new VCLXAccessibleMenu( m_pMenu, (sal_uInt16)i, pPopupMenu ); - pPopupMenu->SetAccessible( pChild ); - } - else - { - pChild = new VCLXAccessibleMenuItem( m_pMenu, (sal_uInt16)i ); - } - } - - // set states - pChild->SetStates(); - - xChild = pChild; - - // insert into menu item list - m_aAccessibleChildren[i] = xChild; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint ) -{ - Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::InsertChild( sal_Int32 i ) -{ - if ( i > (sal_Int32)m_aAccessibleChildren.size() ) - i = m_aAccessibleChildren.size(); - - if ( i >= 0 ) - { - // insert entry in child list - m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() ); - - // update item position of accessible children - for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j ) - { - Reference< XAccessible > xAcc( m_aAccessibleChildren[j] ); - if ( xAcc.is() ) - { - OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() ); - if ( pComp ) - pComp->SetItemPos( (sal_uInt16)j ); - } - } - - // send accessible child event - Reference< XAccessible > xChild( GetChild( i ) ); - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::RemoveChild( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - // keep the accessible of the removed item - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - - // remove entry in child list - m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); - - // update item position of accessible children - for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j ) - { - Reference< XAccessible > xAcc( m_aAccessibleChildren[j] ); - if ( xAcc.is() ) - { - OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() ); - if ( pComp ) - pComp->SetItemPos( (sal_uInt16)j ); - } - } - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - } -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsHighlighted() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsChildHighlighted() -{ - sal_Bool bChildHighlighted = sal_False; - - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp && pComp->IsHighlighted() ) - { - bChildHighlighted = sal_True; - break; - } - } - } - - return bChildHighlighted; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::SelectChild( sal_Int32 i ) -{ - // open the menu - if ( getAccessibleRole() == AccessibleRole::MENU && !IsPopupMenuOpen() ) - Click(); - - // highlight the child - if ( m_pMenu ) - m_pMenu->HighlightItem( (sal_uInt16)i ); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::DeSelectAll() -{ - if ( m_pMenu ) - m_pMenu->DeHighlight(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsChildSelected( sal_Int32 i ) -{ - sal_Bool bSelected = sal_False; - - if ( m_pMenu && m_pMenu->IsHighlighted( (sal_uInt16)i ) ) - bSelected = sal_True; - - return bSelected; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::Select() -{ -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::DeSelect() -{ -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::Click() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::IsPopupMenuOpen() -{ - return sal_False; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( OAccessibleMenuBaseComponent, MenuEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_ASSERT( pEvent && pEvent->ISA( VclMenuEvent ), "OAccessibleMenuBaseComponent - Unknown MenuEvent!" ); - if ( pEvent && pEvent->ISA( VclMenuEvent ) ) - { - DBG_ASSERT( ((VclMenuEvent*)pEvent)->GetMenu(), "OAccessibleMenuBaseComponent - Menu?" ); - ProcessMenuEvent( *(VclMenuEvent*)pEvent ); - } - return 0; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent ) -{ - sal_uInt16 nItemPos = rVclMenuEvent.GetItemPos(); - - switch ( rVclMenuEvent.GetId() ) - { - case VCLEVENT_MENU_SHOW: - case VCLEVENT_MENU_HIDE: - { - UpdateVisible(); - } - break; - case VCLEVENT_MENU_HIGHLIGHT: - { - SetFocused( sal_False ); - UpdateFocused( nItemPos, sal_True ); - UpdateSelected( nItemPos, sal_True ); - } - break; - case VCLEVENT_MENU_DEHIGHLIGHT: - { - UpdateFocused( nItemPos, sal_False ); - UpdateSelected( nItemPos, sal_False ); - } - break; - case VCLEVENT_MENU_SUBMENUACTIVATE: - { - } - break; - case VCLEVENT_MENU_SUBMENUDEACTIVATE: - { - UpdateFocused( nItemPos, sal_True ); - } - break; - case VCLEVENT_MENU_ENABLE: - { - UpdateEnabled( nItemPos, sal_True ); - } - break; - case VCLEVENT_MENU_DISABLE: - { - UpdateEnabled( nItemPos, sal_False ); - } - break; - case VCLEVENT_MENU_SUBMENUCHANGED: - { - RemoveChild( nItemPos ); - InsertChild( nItemPos ); - } - break; - case VCLEVENT_MENU_INSERTITEM: - { - InsertChild( nItemPos ); - } - break; - case VCLEVENT_MENU_REMOVEITEM: - { - RemoveChild( nItemPos ); - } - break; - case VCLEVENT_MENU_ACCESSIBLENAMECHANGED: - { - UpdateAccessibleName( nItemPos ); - } - break; - case VCLEVENT_MENU_ITEMTEXTCHANGED: - { - UpdateAccessibleName( nItemPos ); - UpdateItemText( nItemPos ); - } - break; - case VCLEVENT_MENU_ITEMCHECKED: - { - UpdateChecked( nItemPos, sal_True ); - } - break; - case VCLEVENT_MENU_ITEMUNCHECKED: - { - UpdateChecked( nItemPos, sal_False ); - } - break; - case VCLEVENT_OBJECT_DYING: - { - if ( m_pMenu ) - { - m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) ); - - m_pMenu = NULL; - - // dispose all menu items - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - } - break; - default: - { - } - break; - } -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuBaseComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleMenuBaseComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuBaseComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleMenuBaseComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void OAccessibleMenuBaseComponent::disposing() -{ - AccessibleExtendedComponentHelper_BASE::disposing(); - - if ( m_pMenu ) - { - m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) ); - - m_pMenu = NULL; - - // dispose all menu items - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuBaseComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- - -Reference< XAccessibleContext > OAccessibleMenuBaseComponent::getAccessibleContext( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return this; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx deleted file mode 100644 index 1773779b3..000000000 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ /dev/null @@ -1,474 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class OAccessibleMenuComponent -// ----------------------------------------------------------------------------- - -OAccessibleMenuComponent::OAccessibleMenuComponent( Menu* pMenu ) - :OAccessibleMenuBaseComponent( pMenu ) -{ -} - -// ----------------------------------------------------------------------------- - -OAccessibleMenuComponent::~OAccessibleMenuComponent() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuComponent::IsEnabled() -{ - return sal_True; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuComponent::IsVisible() -{ - sal_Bool bVisible = sal_False; - - if ( m_pMenu ) - bVisible = m_pMenu->IsMenuVisible(); - - return bVisible; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - if ( IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( IsFocused() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - if ( IsVisible() ) - { - rStateSet.AddState( AccessibleStateType::VISIBLE ); - rStateSet.AddState( AccessibleStateType::SHOWING ); - } - - rStateSet.AddState( AccessibleStateType::OPAQUE ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle OAccessibleMenuComponent::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - // get bounding rectangle of the window in screen coordinates - Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); - aBounds = AWTRectangle( aRect ); - - // get position of the accessible parent in screen coordinates - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComponent.is() ) - { - awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen(); - - // calculate position of the window relative to the accessible parent - aBounds.X -= aParentScreenLoc.X; - aBounds.Y -= aParentScreenLoc.Y; - } - } - } - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuComponent::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetChildCount(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuComponent::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - return GetChild( i ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuComponent::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - Window* pParent = pWindow->GetAccessibleParentWindow(); - if ( pParent ) - xParent = pParent->GetAccessible(); - } - } - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 OAccessibleMenuComponent::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::UNKNOWN; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuComponent::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - sDescription = pWindow->GetAccessibleDescription(); - } - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuComponent::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale OAccessibleMenuComponent::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuComponent::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetChildAt( rPoint ); -} - -// ----------------------------------------------------------------------------- - -awt::Point OAccessibleMenuComponent::getLocationOnScreen( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - awt::Point aPos; - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); - aPos = AWTPoint( aRect.TopLeft() ); - } - } - - return aPos; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::grabFocus( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - pWindow->GrabFocus(); - } -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuComponent::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - sal_Int32 nColor = rStyleSettings.GetMenuTextColor().GetColor(); - - return nColor; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuComponent::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > OAccessibleMenuComponent::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - VCLXFont* pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev.get(), rStyleSettings.GetMenuFont() ); - xFont = pVCLXFont; - } - } - } - - return xFont; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuComponent::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuComponent::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - SelectChild( nChildIndex ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - return IsChildSelected( nChildIndex ); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::clearAccessibleSelection( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - DeSelectAll(); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - // This method makes no sense in a menu, and so does nothing. -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuComponent::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nRet = 0; - - for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ ) - { - if ( IsChildSelected( i ) ) - ++nRet; - } - - return nRet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - - for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ ) - { - if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = GetChild( i ); - break; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuComponent::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - DeSelectAll(); -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx deleted file mode 100644 index 103c236e8..000000000 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class OAccessibleMenuItemComponent -// ----------------------------------------------------------------------------- - -OAccessibleMenuItemComponent::OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ) - :OAccessibleMenuBaseComponent( pMenu ) - ,m_pParent( pParent ) - ,m_nItemPos( nItemPos ) -{ - m_sAccessibleName = GetAccessibleName(); - m_sItemText = GetItemText(); -} - -// ----------------------------------------------------------------------------- - -OAccessibleMenuItemComponent::~OAccessibleMenuItemComponent() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuItemComponent::IsEnabled() -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bEnabled = sal_False; - if ( m_pParent ) - bEnabled = m_pParent->IsItemEnabled( m_pParent->GetItemId( m_nItemPos ) ); - - return bEnabled; -} - -// ----------------------------------------------------------------------------- - -sal_Bool OAccessibleMenuItemComponent::IsVisible() -{ - sal_Bool bVisible = sal_False; - - if ( m_pParent ) - bVisible = m_pParent->IsItemPosVisible( m_nItemPos ); - - return bVisible; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::Select() -{ - // open the parent menu - Reference< XAccessible > xParent( getAccessibleParent() ); - if ( xParent.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() ); - if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() ) - pComp->Click(); - } - - // highlight the menu item - if ( m_pParent ) - m_pParent->HighlightItem( m_nItemPos ); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::DeSelect() -{ - if ( m_pParent && IsSelected() ) - m_pParent->DeHighlight(); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::Click() -{ - // open the parent menu - Reference< XAccessible > xParent( getAccessibleParent() ); - if ( xParent.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() ); - if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() ) - pComp->Click(); - } - - // click the menu item - if ( m_pParent ) - { - Window* pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - // #102438# Menu items are not selectable - // Popup menus are executed asynchronously, triggered by a timer. - // As Menu::SelectItem only works, if the corresponding menu window is - // already created, we have to set the menu delay to 0, so - // that the popup menus are executed synchronously. - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - sal_uLong nDelay = aMouseSettings.GetMenuDelay(); - aMouseSettings.SetMenuDelay( 0 ); - aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings ); - - m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) ); - - // meanwhile the window pointer may be invalid - pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - // set the menu delay back to the old value - aSettings = pWindow->GetSettings(); - aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetMenuDelay( nDelay ); - aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::SetItemPos( sal_uInt16 nItemPos ) -{ - m_nItemPos = nItemPos; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAccessibleName ) -{ - if ( !m_sAccessibleName.equals( sAccessibleName ) ) - { - Any aOldValue, aNewValue; - aOldValue <<= m_sAccessibleName; - aNewValue <<= sAccessibleName; - m_sAccessibleName = sAccessibleName; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::GetAccessibleName() -{ - ::rtl::OUString sName; - if ( m_pParent ) - { - sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos ); - sName = m_pParent->GetAccessibleName( nItemId ); - if ( sName.getLength() == 0 ) - sName = m_pParent->GetItemText( nItemId ); - sName = OutputDevice::GetNonMnemonicString( sName ); - } - - return sName; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::SetItemText( const ::rtl::OUString& sItemText ) -{ - Any aOldValue, aNewValue; - if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) ) - { - m_sItemText = sItemText; - NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::GetItemText() -{ - ::rtl::OUString sText; - if ( m_pParent ) - sText = OutputDevice::GetNonMnemonicString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) ); - - return sText; -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - if ( IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - - if ( IsVisible() ) - { - rStateSet.AddState( AccessibleStateType::VISIBLE ); - rStateSet.AddState( AccessibleStateType::SHOWING ); - } - - rStateSet.AddState( AccessibleStateType::OPAQUE ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - - if ( m_pParent ) - { - // get bounding rectangle of the item relative to the containing window - aBounds = AWTRectangle( m_pParent->GetBoundingRectangle( m_nItemPos ) ); - - // get position of containing window in screen coordinates - Window* pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); - awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() ); - - // get position of accessible parent in screen coordinates - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComponent.is() ) - { - awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen(); - - // calculate bounding rectangle of the item relative to the accessible parent - aBounds.X += aWindowScreenLoc.X - aParentScreenLoc.X; - aBounds.Y += aWindowScreenLoc.Y - aParentScreenLoc.Y; - } - } - } - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void SAL_CALL OAccessibleMenuItemComponent::disposing() -{ - OAccessibleMenuBaseComponent::disposing(); - - m_pParent = NULL; - m_sAccessibleName = ::rtl::OUString(); - m_sItemText = ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuItemComponent::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_pParent->GetAccessible(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuItemComponent::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_nItemPos; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 OAccessibleMenuItemComponent::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::UNKNOWN; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pParent ) - sDescription = m_pParent->GetHelpText( m_pParent->GetItemId( m_nItemPos ) ); - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_sAccessibleName; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale OAccessibleMenuItemComponent::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -void OAccessibleMenuItemComponent::grabFocus( ) throw (RuntimeException) -{ - // no focus for items -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuItemComponent::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 OAccessibleMenuItemComponent::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString OAccessibleMenuItemComponent::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sRet; - if ( m_pParent ) - sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) ); - - return sRet; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/floatingwindowaccessible.cxx b/accessibility/source/standard/floatingwindowaccessible.cxx deleted file mode 100644 index 6bb332fe7..000000000 --- a/accessibility/source/standard/floatingwindowaccessible.cxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include - - -#include -#include -#include - -namespace uno = ::com::sun::star::uno; - -using ::com::sun::star::accessibility::AccessibleRelation; -namespace AccessibleRelationType = ::com::sun::star::accessibility::AccessibleRelationType; - -//------------------------------------------------------------------- - -FloatingWindowAccessible::FloatingWindowAccessible(VCLXWindow* pWindow) : - VCLXAccessibleComponent(pWindow) -{ -} - -//------------------------------------------------------------------- - -FloatingWindowAccessible::~FloatingWindowAccessible() -{ -} - -//------------------------------------------------------------------- - -void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelationSetHelper& rRelationSet) -{ - Window* pWindow = GetWindow(); - if ( pWindow ) - { - Window* pParentWindow = pWindow->GetParent(); - if( pParentWindow ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); - aSequence[0] = pParentWindow->GetAccessible(); - rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::SUB_WINDOW_OF, aSequence ) ); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/makefile.mk b/accessibility/source/standard/makefile.mk deleted file mode 100644 index b79d98f65..000000000 --- a/accessibility/source/standard/makefile.mk +++ /dev/null @@ -1,78 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=accessibility -TARGET=standard - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/accessiblemenubasecomponent.obj \ - $(SLO)$/accessiblemenucomponent.obj \ - $(SLO)$/accessiblemenuitemcomponent.obj \ - $(SLO)$/floatingwindowaccessible.obj \ - $(SLO)$/vclxaccessiblebox.obj \ - $(SLO)$/vclxaccessiblebutton.obj \ - $(SLO)$/vclxaccessiblecheckbox.obj \ - $(SLO)$/vclxaccessiblecombobox.obj \ - $(SLO)$/vclxaccessibledropdowncombobox.obj \ - $(SLO)$/vclxaccessibledropdownlistbox.obj \ - $(SLO)$/vclxaccessibleedit.obj \ - $(SLO)$/vclxaccessiblefixedhyperlink.obj \ - $(SLO)$/vclxaccessiblefixedtext.obj \ - $(SLO)$/vclxaccessiblelist.obj \ - $(SLO)$/vclxaccessiblelistbox.obj \ - $(SLO)$/vclxaccessiblelistitem.obj \ - $(SLO)$/vclxaccessiblemenu.obj \ - $(SLO)$/vclxaccessiblemenubar.obj \ - $(SLO)$/vclxaccessiblemenuitem.obj \ - $(SLO)$/vclxaccessiblemenuseparator.obj \ - $(SLO)$/vclxaccessiblepopupmenu.obj \ - $(SLO)$/vclxaccessibleradiobutton.obj \ - $(SLO)$/vclxaccessiblescrollbar.obj \ - $(SLO)$/vclxaccessiblestatusbar.obj \ - $(SLO)$/vclxaccessiblestatusbaritem.obj \ - $(SLO)$/vclxaccessibletabcontrol.obj \ - $(SLO)$/vclxaccessibletabpage.obj \ - $(SLO)$/vclxaccessibletabpagewindow.obj \ - $(SLO)$/vclxaccessibletextcomponent.obj \ - $(SLO)$/vclxaccessibletextfield.obj \ - $(SLO)$/vclxaccessibletoolbox.obj \ - $(SLO)$/vclxaccessibletoolboxitem.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx deleted file mode 100644 index b353cf736..000000000 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; - -VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox) - : VCLXAccessibleComponent (pVCLWindow), - m_aBoxType (aType), - m_bIsDropDownBox (bIsDropDownBox), - m_nIndexInParent (DEFAULT_INDEX_IN_PARENT) -{ - // Set up the flags that indicate which children this object has. - m_bHasListChild = true; - - // A text field is not present for non drop down list boxes. - if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox) - m_bHasTextChild = false; - else - m_bHasTextChild = true; -} - -VCLXAccessibleBox::~VCLXAccessibleBox (void) -{ -} - -void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) -{ - uno::Any aOldValue, aNewValue; - uno::Reference xAcc; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - { - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - // Just compare to the combo box text field. All other children - // are identical to this object in which case this object will - // be removed in a short time. - if (m_aBoxType==COMBOBOX) - { - ComboBox* pComboBox = static_cast(GetWindow()); - if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) ) - if (pChildWindow == pComboBox->GetSubEdit()) - { - if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW) - { - // Instantiate text field. - getAccessibleChild (0); - aNewValue <<= m_xText; - } - else - { - // Release text field. - aOldValue <<= m_xText; - m_xText = NULL; - } - // Tell the listeners about the new/removed child. - NotifyAccessibleEvent ( - AccessibleEventId::CHILD, - aOldValue, aNewValue); - } - - } - } - break; - - default: - VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); - } -} - -void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_DROPDOWN_OPEN: - case VCLEVENT_DROPDOWN_CLOSE: - case VCLEVENT_LISTBOX_DOUBLECLICK: - case VCLEVENT_LISTBOX_SCROLLED: - case VCLEVENT_LISTBOX_SELECT: - case VCLEVENT_LISTBOX_ITEMADDED: - case VCLEVENT_LISTBOX_ITEMREMOVED: - case VCLEVENT_COMBOBOX_ITEMADDED: - case VCLEVENT_COMBOBOX_ITEMREMOVED: - case VCLEVENT_COMBOBOX_SCROLLED: - { - // Forward the call to the list child. - VCLXAccessibleList* pList = static_cast(m_xList.get()); - if ( pList == NULL ) - { - getAccessibleChild ( m_bHasTextChild ? 1 : 0 ); - pList = static_cast(m_xList.get()); - } - if ( pList != NULL ) - pList->ProcessWindowEvent (rVclWindowEvent); - break; - } - - case VCLEVENT_COMBOBOX_SELECT: - case VCLEVENT_COMBOBOX_DESELECT: - { - // Selection is handled by VCLXAccessibleList which operates on - // the same VCL object as this box does. In case of the - // combobox, however, we have to help by providing the list with - // the text of the currently selected item. - VCLXAccessibleList* pList = static_cast(m_xList.get()); - if (pList != NULL && m_xText.is()) - { - Reference xText (m_xText->getAccessibleContext(), UNO_QUERY); - if ( xText.is() ) - { - ::rtl::OUString sText = xText->getSelectedText(); - if ( !sText.getLength() ) - sText = xText->getText(); - pList->UpdateSelection (sText); - } - } - break; - } - - case VCLEVENT_EDIT_MODIFY: - case VCLEVENT_EDIT_SELECTIONCHANGED: - // Modify/Selection events are handled by the combo box instead of - // directly by the edit field (Why?). Therefore, delegate this - // call to the edit field. - if (m_aBoxType==COMBOBOX) - { - if (m_xText.is()) - { - Reference xContext = m_xText->getAccessibleContext(); - VCLXAccessibleEdit* pEdit = static_cast(xContext.get()); - if (pEdit != NULL) - pEdit->ProcessWindowEvent (rVclWindowEvent); - } - } - break; - - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE) -IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE) - -//===== XAccessible ========================================================= - -Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext( ) - throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return this; -} - -//===== XAccessibleContext ================================================== - -sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleChildCount (void) - throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - // Usually a box has a text field and a list of items as its children. - // Non drop down list boxes have no text field. Additionally check - // whether the object is valid. - sal_Int32 nCount = 0; - if (IsValid()) - nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0); - else - { - // Object not valid anymore. Release references to children. - m_bHasTextChild = false; - m_xText = NULL; - m_bHasListChild = false; - m_xList = NULL; - } - - return nCount; -} - -Reference SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i) - throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if (i<0 || i>=getAccessibleChildCount()) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - if (IsValid()) - { - if (i==1 || ! m_bHasTextChild) - { - // List. - if ( ! m_xList.is()) - { - VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(), - (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX), - this); - pList->SetIndexInParent (i); - m_xList = pList; - } - xChild = m_xList; - } - else - { - // Text Field. - if ( ! m_xText.is()) - { - if (m_aBoxType==COMBOBOX) - { - ComboBox* pComboBox = static_cast(GetWindow()); - if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL) - m_xText = pComboBox->GetSubEdit()->GetAccessible(); - } - else if (m_bIsDropDownBox) - m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this); - } - xChild = m_xText; - } - } - - return xChild; -} - -sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - // Return the role COMBO_BOX for both VCL combo boxes and - // VCL list boxes in DropDown-Mode else PANEL. - // This way the Java bridge has not to handle both independently. - return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL; -} - -sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException) -{ - if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) - return m_nIndexInParent; - else - return VCLXAccessibleComponent::getAccessibleIndexInParent(); -} - -//===== XAccessibleAction =================================================== - -sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void) - throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex> aGuard (GetMutex()); - - // There is one action for drop down boxes (toggle popup) and none for - // the other boxes. - return m_bIsDropDownBox ? 1 : 0; -} - -sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex) - throw (IndexOutOfBoundsException, RuntimeException) -{ - sal_Bool bNotify = sal_False; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - - if (m_aBoxType == COMBOBOX) - { - ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() ); - if (pComboBox != NULL) - { - pComboBox->ToggleDropDown(); - bNotify = sal_True; - } - } - else if (m_aBoxType == LISTBOX) - { - ListBox* pListBox = static_cast< ListBox* >( GetWindow() ); - if (pListBox != NULL) - { - pListBox->ToggleDropDown(); - bNotify = sal_True; - } - } - } - - if (bNotify) - NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED, Any(), Any()); - - return bNotify; -} - -::rtl::OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 nIndex) - throw (IndexOutOfBoundsException, RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - return TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP); -} - -Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex ) - throw (IndexOutOfBoundsException, RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - Reference< XAccessibleKeyBinding > xRet; - - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - - // ... which key? - return xRet; -} - -//===== XComponent ========================================================== - -void SAL_CALL VCLXAccessibleBox::disposing (void) -{ - VCLXAccessibleComponent::disposing(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx deleted file mode 100644 index ddbaefcb5..000000000 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleButton -// ----------------------------------------------------------------------------- - -VCLXAccessibleButton::VCLXAccessibleButton( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleButton::~VCLXAccessibleButton() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_PUSHBUTTON_TOGGLE: - { - Any aOldValue; - Any aNewValue; - - PushButton* pButton = (PushButton*) GetWindow(); - if ( pButton && pButton->GetState() == STATE_CHECK ) - aNewValue <<= AccessibleStateType::CHECKED; - else - aOldValue <<= AccessibleStateType::CHECKED; - - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - default: - VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - - PushButton* pButton = (PushButton*) GetWindow(); - if ( pButton ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( pButton->GetState() == STATE_CHECK ) - rStateSet.AddState( AccessibleStateType::CHECKED ); - - if ( pButton->IsPressed() ) - rStateSet.AddState( AccessibleStateType::PRESSED ); - } -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleButton::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleButton") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleButton::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleButton") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleButton::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString aName( VCLXAccessibleTextComponent::getAccessibleName() ); - sal_Int32 nLength = aName.getLength(); - - if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("..."), nLength - 3 ) ) - { - if ( nLength == 3 ) - { - // it's a browse button - aName = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_NAME_BROWSEBUTTON ) ); - } - else - { - // remove the three trailing dots - aName = aName.copy( 0, nLength - 3 ); - } - } - else if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("<< "), 0 ) ) - { - // remove the leading symbols - aName = aName.copy( 3, nLength - 3 ); - } - else if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM(" >>"), nLength - 3 ) ) - { - // remove the trailing symbols - aName = aName.copy( 0, nLength - 3 ); - } - - return aName; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleButton::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - PushButton* pButton = (PushButton*) GetWindow(); - if ( pButton ) - pButton->Click(); - - return sal_True; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); - Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - KeyEvent aKeyEvent = pWindow->GetActivationKey(); - KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - if ( aKeyCode.GetCode() != 0 ) - { - awt::KeyStroke aKeyStroke; - aKeyStroke.Modifiers = 0; - if ( aKeyCode.IsShift() ) - aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; - if ( aKeyCode.IsMod1() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; - if ( aKeyCode.IsMod2() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; - if ( aKeyCode.IsMod3() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; - aKeyStroke.KeyCode = aKeyCode.GetCode(); - aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); - aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aKeyStroke ); - } - } - - return xKeyBinding; -} - -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleButton::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - PushButton* pButton = (PushButton*) GetWindow(); - if ( pButton ) - aValue <<= (sal_Int32) pButton->IsPressed(); - - return aValue; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleButton::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - PushButton* pButton = (PushButton*) GetWindow(); - if ( pButton ) - { - sal_Int32 nValue = 0; - OSL_VERIFY( aNumber >>= nValue ); - - if ( nValue < 0 ) - nValue = 0; - else if ( nValue > 1 ) - nValue = 1; - - pButton->SetPressed( (sal_Bool) nValue ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleButton::getMaximumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 1; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleButton::getMinimumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx deleted file mode 100644 index 68867a939..000000000 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ /dev/null @@ -1,364 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleCheckBox -// ----------------------------------------------------------------------------- - -VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ - m_bChecked = IsChecked(); - m_bIndeterminate = IsIndeterminate(); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleCheckBox::~VCLXAccessibleCheckBox() -{ -} - -// ----------------------------------------------------------------------------- - -bool VCLXAccessibleCheckBox::IsChecked() -{ - bool bChecked = false; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 1 ) - bChecked = true; - - return bChecked; -} - -// ----------------------------------------------------------------------------- - -bool VCLXAccessibleCheckBox::IsIndeterminate() -{ - bool bIndeterminate = false; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 2 ) - bIndeterminate = true; - - return bIndeterminate; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleCheckBox::SetChecked( bool bChecked ) -{ - if ( m_bChecked != bChecked ) - { - Any aOldValue, aNewValue; - if ( m_bChecked ) - aOldValue <<= AccessibleStateType::CHECKED; - else - aNewValue <<= AccessibleStateType::CHECKED; - m_bChecked = bChecked; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleCheckBox::SetIndeterminate( bool bIndeterminate ) -{ - if ( m_bIndeterminate != bIndeterminate ) - { - Any aOldValue, aNewValue; - if ( m_bIndeterminate ) - aOldValue <<= AccessibleStateType::INDETERMINATE; - else - aNewValue <<= AccessibleStateType::INDETERMINATE; - m_bIndeterminate = bIndeterminate; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_CHECKBOX_TOGGLE: - { - SetChecked( IsChecked() ); - SetIndeterminate( IsIndeterminate() ); - } - break; - default: - VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleCheckBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( IsChecked() ) - rStateSet.AddState( AccessibleStateType::CHECKED ); - - if ( IsIndeterminate() ) - rStateSet.AddState( AccessibleStateType::INDETERMINATE ); -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleCheckBox::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleCheckBox") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleCheckBox::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleCheckBox") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleCheckBox::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - CheckBox* pCheckBox = (CheckBox*) GetWindow(); - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pCheckBox && pVCLXCheckBox ) - { - sal_Int32 nValueMin = (sal_Int32) 0; - sal_Int32 nValueMax = (sal_Int32) 1; - - if ( pCheckBox->IsTriStateEnabled() ) - nValueMax = (sal_Int32) 2; - - sal_Int32 nValue = (sal_Int32) pVCLXCheckBox->getState(); - - ++nValue; - - if ( nValue > nValueMax ) - nValue = nValueMin; - - pVCLXCheckBox->setState( (sal_Int16) nValue ); - } - - return sal_True; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); - Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - KeyEvent aKeyEvent = pWindow->GetActivationKey(); - KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - if ( aKeyCode.GetCode() != 0 ) - { - awt::KeyStroke aKeyStroke; - aKeyStroke.Modifiers = 0; - if ( aKeyCode.IsShift() ) - aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; - if ( aKeyCode.IsMod1() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; - if ( aKeyCode.IsMod2() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; - if ( aKeyCode.IsMod3() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; - aKeyStroke.KeyCode = aKeyCode.GetCode(); - aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); - aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aKeyStroke ); - } - } - - return xKeyBinding; -} - -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleCheckBox::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox ) - aValue <<= (sal_Int32) pVCLXCheckBox->getState(); - - return aValue; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox ) - { - sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; - OSL_VERIFY( aNumber >>= nValue ); - OSL_VERIFY( getMinimumValue() >>= nValueMin ); - OSL_VERIFY( getMaximumValue() >>= nValueMax ); - - if ( nValue < nValueMin ) - nValue = nValueMin; - else if ( nValue > nValueMax ) - nValue = nValueMax; - - pVCLXCheckBox->setState( (sal_Int16) nValue ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleCheckBox::getMaximumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - CheckBox* pCheckBox = (CheckBox*) GetWindow(); - if ( pCheckBox && pCheckBox->IsTriStateEnabled() ) - aValue <<= (sal_Int32) 2; - else - aValue <<= (sal_Int32) 1; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleCheckBox::getMinimumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx deleted file mode 100644 index 821ab3041..000000000 --- a/accessibility/source/standard/vclxaccessiblecombobox.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; - - -VCLXAccessibleComboBox::VCLXAccessibleComboBox (VCLXWindow* pVCLWindow) - : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, false) -{ -} - - - - -VCLXAccessibleComboBox::~VCLXAccessibleComboBox (void) -{ -} - - - - -bool VCLXAccessibleComboBox::IsValid (void) const -{ - return static_cast(GetWindow()) != NULL; - -} - - - - -void VCLXAccessibleComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) -{ - VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent ); -} - - - - -//===== XServiceInfo ======================================================== - -::rtl::OUString VCLXAccessibleComboBox::getImplementationName (void) - throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleComboBox" )); -} - - - - -Sequence< ::rtl::OUString > VCLXAccessibleComboBox::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleComboBox" )); - return aNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx deleted file mode 100644 index e58167dbe..000000000 --- a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; - - -VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLWindow) - : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, true) -{ -} - - - - -VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox (void) -{ -} - - - -bool VCLXAccessibleDropDownComboBox::IsValid (void) const -{ - return static_cast(GetWindow()) != NULL; - -} - - - - -void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_DROPDOWN_OPEN: - case VCLEVENT_DROPDOWN_CLOSE: - { - break; - } - - default: - VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent ); - } -} - - - - -//===== XServiceInfo ======================================================== - -::rtl::OUString VCLXAccessibleDropDownComboBox::getImplementationName() - throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleDropDownComboBox" )); -} - - - - -Sequence< ::rtl::OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleDropDownComboBox" )); - return aNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx deleted file mode 100644 index db481d731..000000000 --- a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; - - -VCLXAccessibleDropDownListBox::VCLXAccessibleDropDownListBox (VCLXWindow* pVCLWindow) - : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::LISTBOX, true) -{ -} - - - - -VCLXAccessibleDropDownListBox::~VCLXAccessibleDropDownListBox() -{ -} - - - - -bool VCLXAccessibleDropDownListBox::IsValid (void) const -{ - return static_cast(GetWindow()) != NULL; - -} - - - - -void VCLXAccessibleDropDownListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - VCLXAccessibleBox::ProcessWindowEvent (rVclWindowEvent); -} - - - - -//===== XServiceInfo ======================================================== - -::rtl::OUString VCLXAccessibleDropDownListBox::getImplementationName() - throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleDropDownListBox" )); -} - - - - -Sequence< ::rtl::OUString > VCLXAccessibleDropDownListBox::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleDropDownListBox" )); - return aNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx deleted file mode 100644 index b70317c1a..000000000 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ /dev/null @@ -1,629 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleEdit -// ----------------------------------------------------------------------------- - -VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ - m_nSelectionStart = getSelectionStart(); - m_nCaretPosition = getCaretPosition(); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleEdit::~VCLXAccessibleEdit() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_EDIT_MODIFY: - { - SetText( implGetText() ); - } - break; - case VCLEVENT_EDIT_SELECTIONCHANGED: - { - sal_Int32 nOldCaretPosition = m_nCaretPosition; - sal_Int32 nOldSelectionStart = m_nSelectionStart; - - m_nCaretPosition = getCaretPosition(); - m_nSelectionStart = getSelectionStart(); - - Window* pWindow = GetWindow(); - if ( pWindow && pWindow->HasChildPathFocus() ) - { - if ( m_nCaretPosition != nOldCaretPosition ) - { - Any aOldValue, aNewValue; - aOldValue <<= (sal_Int32) nOldCaretPosition; - aNewValue <<= (sal_Int32) m_nCaretPosition; - NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); - } - - // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED - sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition ); - sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition ); - if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) ) - { - NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); - } - - } - } - break; - default: - VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - if ( pVCLXEdit ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - rStateSet.AddState( AccessibleStateType::SINGLE_LINE ); - if ( pVCLXEdit->isEditable() ) - rStateSet.AddState( AccessibleStateType::EDITABLE ); - } -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::implGetText() -{ - ::rtl::OUString aText; - - Edit* pEdit = static_cast< Edit* >( GetWindow() ); - if ( pEdit ) - { - aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() ); - - if ( getAccessibleRole() == AccessibleRole::PASSWORD_TEXT ) - { - xub_Unicode cEchoChar = pEdit->GetEchoChar(); - if ( !cEchoChar ) - cEchoChar = '*'; - XubString sTmp; - aText = sTmp.Fill( (sal_uInt16)aText.getLength(), cEchoChar ); - } - } - - return aText; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleEdit::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - awt::Selection aSelection; - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - if ( pVCLXEdit ) - aSelection = pVCLXEdit->getSelection(); - - nStartIndex = aSelection.Min; - nEndIndex = aSelection.Max; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleEdit") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleEdit::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleEdit") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleEdit::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int16 nRole; - Edit* pEdit = static_cast< Edit* >( GetWindow() ); - if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) ) - nRole = AccessibleRole::PASSWORD_TEXT; - else - nRole = AccessibleRole::TEXT; - - return nRole; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - // There is one action: activate - return 1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - sal_Bool bDoAction = sal_False; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - pWindow->GrabFocus(); - bDoAction = sal_True; - } - - return bDoAction; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - static const ::rtl::OUString sAction( RTL_CONSTASCII_USTRINGPARAM( "activate" ) ); - return sAction; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessibleKeyBinding >(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getCaretPosition( ) throw (RuntimeException) -{ - return getSelectionEnd(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - return setSelection( nIndex, nIndex ); -} - -// ----------------------------------------------------------------------------- - -sal_Unicode VCLXAccessibleEdit::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getCharacter( nIndex ); -} - -// ----------------------------------------------------------------------------- - -Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes ); -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - sal_Int32 nLength = implGetText().getLength(); - - if ( !implIsValidRange( nIndex, nIndex, nLength ) ) - throw IndexOutOfBoundsException(); - - Control* pControl = static_cast< Control* >( GetWindow() ); - if ( pControl ) - { - if ( nIndex == nLength ) - { - // #108914# calculate virtual bounding rectangle - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - Rectangle aRect = pControl->GetCharacterBounds( i ); - sal_Int32 nHeight = aRect.GetHeight(); - if ( aBounds.Height < nHeight ) - { - aBounds.Y = aRect.Top(); - aBounds.Height = nHeight; - } - if ( i == nLength - 1 ) - { - aBounds.X = aRect.Right() + 1; - aBounds.Width = 1; - } - } - } - else - { - aBounds = AWTRectangle( pControl->GetCharacterBounds( nIndex ) ); - } - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getCharacterCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getCharacterCount(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getIndexAtPoint( aPoint ); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::getSelectedText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getSelectedText(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getSelectionStart( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getSelectionStart(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleEdit::getSelectionEnd( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getSelectionEnd(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - Edit* pEdit = static_cast< Edit* >( GetWindow() ); - if ( pVCLXEdit && pEdit && pEdit->IsEnabled() ) - { - pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::getText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getText(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleEdit::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getTextRange( nStartIndex, nEndIndex ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getTextAtIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getTextBeforeIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::getTextBehindIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return VCLXAccessibleTextComponent::copyText( nStartIndex, nEndIndex ); -} - -// ----------------------------------------------------------------------------- -// XAccessibleEditableText -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return copyText( nStartIndex, nEndIndex ) && deleteText( nStartIndex, nEndIndex ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( GetWindow() ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); - if ( xClipboard.is() ) - { - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents(); - Application::AcquireSolarMutex( nRef ); - if ( xDataObj.is() ) - { - datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - if ( xDataObj->isDataFlavorSupported( aFlavor ) ) - { - Any aData = xDataObj->getTransferData( aFlavor ); - ::rtl::OUString sText; - aData >>= sText; - bReturn = replaceText( nIndex, nIndex, sText ); - } - } - } - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return replaceText( nIndex, nIndex, sText ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - sal_Int32 nMinIndex = ::std::min( nStartIndex, nEndIndex ); - sal_Int32 nMaxIndex = ::std::max( nStartIndex, nEndIndex ); - - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - if ( pVCLXEdit && pVCLXEdit->isEditable() ) - { - pVCLXEdit->setText( sText.replaceAt( nMinIndex, nMaxIndex - nMinIndex, sReplacement ) ); - sal_Int32 nIndex = nMinIndex + sReplacement.getLength(); - setSelection( nIndex, nIndex ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const Sequence& ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; // attributes cannot be set for an edit -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleEdit::setText( const ::rtl::OUString& sText ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bSuccess = sal_False; - try - { - bSuccess = replaceText( 0, implGetText().getLength(), sText ); - } - catch( const IndexOutOfBoundsException& ) - { - OSL_FAIL( "VCLXAccessibleText::setText: caught an exception!" ); - } - return bSuccess; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx b/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx deleted file mode 100644 index 1ae51f7f9..000000000 --- a/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -using namespace ::com::sun::star; - -// ----------------------------------------------------------------------------- -// VCLXAccessibleFixedHyperlink -// ----------------------------------------------------------------------------- - -VCLXAccessibleFixedHyperlink::VCLXAccessibleFixedHyperlink( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleFixedHyperlink::~VCLXAccessibleFixedHyperlink() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleFixedHyperlink::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleFixedHyperlink::implGetLineBoundary( i18n::Boundary& rBoundary, sal_Int32 nIndex ) -{ - // TODO - OCommonAccessibleText::implGetLineBoundary( rBoundary, nIndex ); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleFixedHyperlink::getImplementationName() throw (uno::RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleFixedHyperlink") ); -} - -// ----------------------------------------------------------------------------- - -uno::Sequence< ::rtl::OUString > VCLXAccessibleFixedHyperlink::getSupportedServiceNames() throw (uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleFixedHyperlink") ); - return aNames; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblefixedtext.cxx b/accessibility/source/standard/vclxaccessiblefixedtext.cxx deleted file mode 100644 index 95a32466d..000000000 --- a/accessibility/source/standard/vclxaccessiblefixedtext.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleFixedText -// ----------------------------------------------------------------------------- - -VCLXAccessibleFixedText::VCLXAccessibleFixedText( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleFixedText::~VCLXAccessibleFixedText() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleFixedText::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - - if ( GetWindow() && GetWindow()->GetStyle() & WB_WORDBREAK ) - rStateSet.AddState( AccessibleStateType::MULTI_LINE ); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleFixedText::implGetLineBoundary( i18n::Boundary& rBoundary, sal_Int32 nIndex ) -{ - // TODO - OCommonAccessibleText::implGetLineBoundary( rBoundary, nIndex ); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleFixedText::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleFixedText") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleFixedText::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleFixedText") ); - return aNames; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx deleted file mode 100644 index b63852896..000000000 --- a/accessibility/source/standard/vclxaccessiblelist.cxx +++ /dev/null @@ -1,851 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::accessibility; - -namespace -{ - void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected ) - throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount() - : (sal_Int32)_rListBox.GetEntryCount(); - if ( _nIndex < 0 || _nIndex >= nCount ) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } -} - -VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType, - const Reference< XAccessible >& _xParent) - : VCLXAccessibleComponent (pVCLWindow), - m_aBoxType (aBoxType), - m_nVisibleLineCount (0), - m_nIndexInParent (DEFAULT_INDEX_IN_PARENT), - m_nLastTopEntry ( 0 ), - m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), - m_bDisableProcessEvent ( false ), - m_bVisible ( true ), - m_xParent ( _xParent ) -{ - // Because combo boxes and list boxes don't have a common interface for - // methods with identical signature we have to write down twice the - // same code. - switch (m_aBoxType) - { - case COMBOBOX: - { - ComboBox* pBox = static_cast(GetWindow()); - if ( pBox != NULL ) - m_pListBoxHelper = new VCLListBoxHelper (*pBox); - break; - } - - case LISTBOX: - { - ListBox* pBox = static_cast(GetWindow()); - if ( pBox != NULL ) - m_pListBoxHelper = new VCLListBoxHelper (*pBox); - break; - } - } - UpdateVisibleLineCount(); - - sal_uInt16 nCount = static_cast(getAccessibleChildCount()); - m_aAccessibleChildren.reserve(nCount); -} -// ----------------------------------------------------------------------------- - -VCLXAccessibleList::~VCLXAccessibleList (void) -{ - delete m_pListBoxHelper; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex) -{ - m_nIndexInParent = nIndex; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL VCLXAccessibleList::disposing (void) -{ - VCLXAccessibleComponent::disposing(); - - // Dispose all items in the list. - clearItems(); - - delete m_pListBoxHelper; - m_pListBoxHelper = NULL; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::clearItems() -{ - // Clear the list itself and delete all the rest. - ListItems().swap(m_aAccessibleChildren); // clear and minimize -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) -{ - SolarMutexGuard aSolarGuard; - - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - // check if our list should be visible - if ( m_pListBoxHelper - && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN - && !m_pListBoxHelper->IsInDropDown() ) - { - rStateSet.RemoveState (AccessibleStateType::VISIBLE); - rStateSet.RemoveState (AccessibleStateType::SHOWING); - m_bVisible = false; - } - - // Both the combo box and list box are handled identical in the - // following but for some reason they don't have a common interface for - // the methods used. - if ( m_pListBoxHelper ) - { - if ( m_pListBoxHelper->IsMultiSelectionEnabled() ) - rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); - rStateSet.AddState (AccessibleStateType::FOCUSABLE); - // All children are transient. - rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew ) -{ - m_bVisible = _bSetNew ? true : false; - Any aOldValue, aNewValue; - (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - - ListItems::iterator aIter = m_aAccessibleChildren.begin(); - ListItems::iterator aEnd = m_aAccessibleChildren.end(); - UpdateVisibleLineCount(); - // adjust the index inside the VCLXAccessibleListItem - for (;aIter != aEnd ; ++aIter) - { - Reference< XAccessible > xHold = *aIter; - VCLXAccessibleListItem* pItem = static_cast(xHold.get()); - if ( pItem ) - { - sal_uInt16 nTopEntry = 0; - if ( m_pListBoxHelper ) - nTopEntry = m_pListBoxHelper->GetTopEntry(); - sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin()); - sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); - pItem->SetVisible( m_bVisible && bVisible ); - } - - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) -{ - // Create a reference to this object to prevent an early release of the - // listbox (VCLEVENT_OBJECT_DYING). - Reference< XAccessible > xTemp = this; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_DROPDOWN_OPEN: - notifyVisibleStates(sal_True); - break; - case VCLEVENT_DROPDOWN_CLOSE: - notifyVisibleStates(sal_False); - break; - case VCLEVENT_LISTBOX_SCROLLED: - case VCLEVENT_COMBOBOX_SCROLLED: - UpdateEntryRange_Impl(); - break; - - case VCLEVENT_LISTBOX_SELECT: - if ( !m_bDisableProcessEvent ) - UpdateSelection_Impl(); - break; - // The selection events VCLEVENT_COMBOBOX_SELECT and - // VCLEVENT_COMBOBOX_DESELECT are not handled here because here we - // have no access to the edit field. Its text is necessary to - // identify the currently selected item. - - case VCLEVENT_OBJECT_DYING: - { - dispose(); - - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - break; - } - - case VCLEVENT_LISTBOX_ITEMREMOVED: - case VCLEVENT_COMBOBOX_ITEMREMOVED: - HandleChangedItemList (false, reinterpret_cast( - rVclWindowEvent.GetData())); - break; - - case VCLEVENT_LISTBOX_ITEMADDED: - case VCLEVENT_COMBOBOX_ITEMADDED: - HandleChangedItemList (true, reinterpret_cast( - rVclWindowEvent.GetData())); - break; - case VCLEVENT_CONTROL_GETFOCUS: - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - if ( m_pListBoxHelper ) - { - uno::Any aOldValue, - aNewValue; - sal_uInt16 nPos = m_pListBoxHelper->GetSelectEntryPos(); - if ( nPos == LISTBOX_ENTRY_NOTFOUND ) - nPos = m_pListBoxHelper->GetTopEntry(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aNewValue <<= CreateChild(nPos); - - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, - aOldValue, - aNewValue ); - } - break; - - default: - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - } -} -// ----------------------------------------------------------------------------- - -/** To find out which item is currently selected and to update the SELECTED - state of the associated accessibility objects accordingly we exploit the - fact that the -*/ -void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem) -{ - if ( m_aBoxType == COMBOBOX ) - { - ComboBox* pBox = static_cast(GetWindow()); - if ( pBox != NULL ) - { - // Find the index of the selected item inside the VCL control... - sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); - // ...and then find the associated accessibility object. - if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) - nIndex = 0; - UpdateSelection_Impl(nIndex); - } - } -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t& _rMemFun) -{ - ListItems::iterator aIter = _aBegin; - ListItems::iterator aEnd = m_aAccessibleChildren.end(); - // adjust the index inside the VCLXAccessibleListItem - for (;aIter != aEnd ; ++aIter) - { - Reference< XAccessible > xHold = *aIter; - VCLXAccessibleListItem* pItem = static_cast(xHold.get()); - if ( pItem ) - _rMemFun(pItem); - } -} -// ----------------------------------------------------------------------------- - -Reference VCLXAccessibleList::CreateChild (sal_Int32 i) -{ - Reference xChild; - - sal_uInt16 nPos = static_cast(i); - if ( nPos >= m_aAccessibleChildren.size() ) - { - m_aAccessibleChildren.resize(nPos + 1); - - // insert into the container - xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this); - m_aAccessibleChildren[nPos] = xChild; - } - else - { - xChild = m_aAccessibleChildren[nPos]; - // check if position is empty and can be used else we have to adjust all entries behind this - if ( xChild.is() ) - { - ListItems::iterator aIter = m_aAccessibleChildren.begin() + nPos; - ::std::mem_fun_t aTemp(&VCLXAccessibleListItem::IncrementIndexInParent); - adjustEntriesIndexInParent( aIter, aTemp); - } - else - { - xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this); - m_aAccessibleChildren[nPos] = xChild; - } - } - - if ( xChild.is() ) - { - // Just add the SELECTED state. - sal_Bool bNowSelected = sal_False; - if ( m_pListBoxHelper ) - bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i); - VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get()); - pItem->SetSelected( bNowSelected ); - - // Set the child's VISIBLE state. - UpdateVisibleLineCount(); - sal_uInt16 nTopEntry = 0; - if ( m_pListBoxHelper ) - nTopEntry = m_pListBoxHelper->GetTopEntry(); - sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); - pItem->SetVisible( m_bVisible && bVisible ); - } - - return xChild; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex) -{ - if ( !bItemInserted ) - { - if ( nIndex == -1 ) // special handling here - { - clearItems(); - } - else - { - if ( nIndex >= 0 && static_cast(nIndex) < m_aAccessibleChildren.size() ) - { - ListItems::iterator aIter = m_aAccessibleChildren.erase(m_aAccessibleChildren.begin()+nIndex); - ::std::mem_fun_t aTemp(&VCLXAccessibleListItem::DecrementIndexInParent); - adjustEntriesIndexInParent( aIter, aTemp ); - } - } - } - else - getAccessibleChild(nIndex); - - NotifyAccessibleEvent ( - AccessibleEventId::INVALIDATE_ALL_CHILDREN, - Any(), Any()); -} -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE) -IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE) - -//===== XAccessible ========================================================= - -Reference SAL_CALL - VCLXAccessibleList::getAccessibleContext (void) - throw (RuntimeException) -{ - return this; -} -// ----------------------------------------------------------------------------- - -//===== XAccessibleContext ================================================== - -sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void) - throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Int32 nCount = 0; - if ( m_pListBoxHelper ) - nCount = m_pListBoxHelper->GetEntryCount(); - - return nCount; -} -// ----------------------------------------------------------------------------- - -Reference SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i) - throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - // search for the child - if ( static_cast(i) >= m_aAccessibleChildren.size() ) - xChild = CreateChild (i); - else - { - xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - xChild = CreateChild (i); - } - OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" ); - return xChild; -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent( ) - throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return m_xParent; -} -// ----------------------------------------------------------------------------- - -sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException) -{ - if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) - return m_nIndexInParent; - else - return VCLXAccessibleComponent::getAccessibleIndexInParent(); -} -// ----------------------------------------------------------------------------- - -sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void) - throw (RuntimeException) -{ - return AccessibleRole::LIST; -} -// ----------------------------------------------------------------------------- - -//===== XAccessibleComponent ================================================ - -sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Bool bInside = sal_False; - - Window* pListBox = GetWindow(); - if ( pListBox ) - { - Rectangle aRect( Point(0,0), pListBox->GetSizePixel() ); - bInside = aRect.IsInside( VCLPoint( rPoint ) ); - } - - return bInside; -} -// ----------------------------------------------------------------------------- - -Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint ) - throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - Reference< XAccessible > xChild; - if ( m_pListBoxHelper ) - { - UpdateVisibleLineCount(); - if ( contains( rPoint ) && m_nVisibleLineCount > 0 ) - { - Point aPos = VCLPoint( rPoint ); - sal_uInt16 nEndPos = m_pListBoxHelper->GetTopEntry() + (sal_uInt16)m_nVisibleLineCount; - for ( sal_uInt16 i = m_pListBoxHelper->GetTopEntry(); i < nEndPos; ++i ) - { - if ( m_pListBoxHelper->GetBoundingRectangle(i).IsInside( aPos ) ) - { - xChild = getAccessibleChild(i); - break; - } - } - } - } - - return xChild; -} -// ----------------------------------------------------------------------------- - -//===== XServiceInfo ========================================================== - -::rtl::OUString VCLXAccessibleList::getImplementationName (void) - throw (RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList")); -} -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleList")); - return aNames; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::UpdateVisibleLineCount() -{ - if ( m_pListBoxHelper ) - { - if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) - m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount(); - else - { - sal_uInt16 nCols = 0, - nLines = 0; - m_pListBoxHelper->GetMaxVisColumnsAndLines (nCols, nLines); - m_nVisibleLineCount = nLines; - } - } -} - -// ----------------------------------------------------------------------------- -void VCLXAccessibleList::UpdateEntryRange_Impl() -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Int32 nTop = m_nLastTopEntry; - - if ( m_pListBoxHelper ) - nTop = m_pListBoxHelper->GetTopEntry(); - if ( nTop != m_nLastTopEntry ) - { - UpdateVisibleLineCount(); - sal_Int32 nBegin = Min( m_nLastTopEntry, nTop ); - sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount ); - for (sal_uInt16 i = static_cast(nBegin); (i <= static_cast(nEnd)); ++i) - { - sal_Bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) ); - Reference< XAccessible > xHold; - if ( i < m_aAccessibleChildren.size() ) - xHold = m_aAccessibleChildren[i]; - else if ( bVisible ) - xHold = CreateChild(i); - - if ( xHold.is() ) - static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible ); - } - } - - m_nLastTopEntry = nTop; -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleList::checkEntrySelected(sal_uInt16 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc) -{ - OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!"); - sal_Bool bNowSelected = sal_False; - if ( m_pListBoxHelper ) - { - bNowSelected = m_pListBoxHelper->IsEntryPosSelected (_nPos); - if ( bNowSelected ) - { - _rxNewAcc = CreateChild(_nPos); - _rNewValue <<= _rxNewAcc; - } - } - return bNowSelected; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16) -{ - uno::Any aOldValue, aNewValue; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference< XAccessible > xNewAcc; - - if ( m_pListBoxHelper ) - { - sal_uInt16 i=0; - for ( ListItems::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter,++i) - { - Reference< XAccessible > xHold = *aIter; - if ( xHold.is() ) - { - VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() ); - // Retrieve the item's index from the list entry. - sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i); - - if ( bNowSelected && !pItem->IsSelected() ) - { - xNewAcc = *aIter; - aNewValue <<= xNewAcc; - } - else if ( pItem->IsSelected() ) - m_nLastSelectedPos = i; - - pItem->SetSelected( bNowSelected ); - } - else - { // it could happen that a child was not created before - checkEntrySelected(i,aNewValue,xNewAcc); - } - } - sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); - if ( i < nCount ) // here we have to check the if any other listbox entry is selected - { - for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i ) - ; - } - if ( xNewAcc.is() && GetWindow()->HasFocus() ) - { - if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND ) - aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos ); - aNewValue <<= xNewAcc; - } - } - } - - if ( aNewValue.hasValue() || aOldValue.hasValue() ) - NotifyAccessibleEvent( - AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, - aOldValue, - aNewValue ); - - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); -} - -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - sal_Bool bNotify = sal_False; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( m_pListBoxHelper ) - { - checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False); - - m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nChildIndex, sal_True ); - // call the select handler, don't handle events in this time - m_bDisableProcessEvent = true; - m_pListBoxHelper->Select(); - m_bDisableProcessEvent = false; - bNotify = sal_True; - } - } - - if ( bNotify ) - UpdateSelection_Impl(); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Bool bRet = sal_False; - if ( m_pListBoxHelper ) - { - checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False); - - bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex ); - } - return bRet; -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleList::clearAccessibleSelection( ) throw (RuntimeException) -{ - sal_Bool bNotify = sal_False; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( m_pListBoxHelper ) - { - m_pListBoxHelper->SetNoSelection(); - bNotify = sal_True; - } - } - - if ( bNotify ) - UpdateSelection_Impl(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - sal_Bool bNotify = sal_False; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( m_pListBoxHelper ) - { - sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - m_pListBoxHelper->SelectEntryPos( i, sal_True ); - // call the select handler, don't handle events in this time - m_bDisableProcessEvent = true; - m_pListBoxHelper->Select(); - m_bDisableProcessEvent = false; - bNotify = sal_True; - } - } - - if ( bNotify ) - UpdateSelection_Impl(); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - sal_Int32 nCount = 0; - if ( m_pListBoxHelper ) - nCount = m_pListBoxHelper->GetSelectEntryCount(); - return nCount; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( m_pListBoxHelper ) - { - checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_True); - return getAccessibleChild( (sal_Int32)m_pListBoxHelper->GetSelectEntryPos( (sal_uInt16)nSelectedChildIndex ) ); - } - - return NULL; -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - sal_Bool bNotify = sal_False; - - { - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - if ( m_pListBoxHelper ) - { - checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_False); - - m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nSelectedChildIndex, sal_False ); - // call the select handler, don't handle events in this time - m_bDisableProcessEvent = true; - m_pListBoxHelper->Select(); - m_bDisableProcessEvent = false; - bNotify = sal_True; - } - } - - if ( bNotify ) - UpdateSelection_Impl(); -} -// ----------------------------------------------------------------------------- -awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException) -{ - awt::Rectangle aBounds ( 0, 0, 0, 0 ); - if ( m_pListBoxHelper - && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) - { - if ( m_pListBoxHelper->IsInDropDown() ) - aBounds = AWTRectangle(m_pListBoxHelper->GetDropDownPosSizePixel()); - } - else - { - // a list has the same bounds as his parent but starts at (0,0) - aBounds = VCLXAccessibleComponent::implGetBounds(); - aBounds.X = 0; - aBounds.Y = 0; - if ( m_aBoxType == COMBOBOX ) - { - ComboBox* pBox = static_cast(GetWindow()); - if ( pBox ) - { - Size aSize = pBox->GetSubEdit()->GetSizePixel(); - aBounds.X += aSize.Height(); - aBounds.Y += aSize.Width(); - aBounds.Height -= aSize.Height(); - aBounds.Width -= aSize.Width(); - } - } - } - return aBounds; -} -// ----------------------------------------------------------------------------- - -awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - awt::Point aPos; - if ( m_pListBoxHelper - && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) - { - if ( m_pListBoxHelper->IsInDropDown() ) - aPos = AWTPoint(m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft()); - } - else - { - aPos = VCLXAccessibleComponent::getLocationOnScreen(); - if ( m_aBoxType == COMBOBOX ) - { - ComboBox* pBox = static_cast(GetWindow()); - if ( pBox ) - { - aPos.X += pBox->GetSubEdit()->GetSizePixel().Height(); - aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width(); - } - } - } - return aPos; -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx deleted file mode 100644 index a63063c1e..000000000 --- a/accessibility/source/standard/vclxaccessiblelistbox.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; - -VCLXAccessibleListBox::VCLXAccessibleListBox (VCLXWindow* pVCLWindow) - : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::LISTBOX, false) -{ -} - - - - -VCLXAccessibleListBox::~VCLXAccessibleListBox (void) -{ -} - - - - -bool VCLXAccessibleListBox::IsValid (void) const -{ - return static_cast(GetWindow()) != NULL; - -} - - - - -void VCLXAccessibleListBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) -{ - VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent ); -} - - - - -//===== XServiceInfo ======================================================== - -::rtl::OUString VCLXAccessibleListBox::getImplementationName (void) - throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleListBox" )); -} - - - - -Sequence< ::rtl::OUString > VCLXAccessibleListBox::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleListBox" )); - return aNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx deleted file mode 100644 index b21b75f54..000000000 --- a/accessibility/source/standard/vclxaccessiblelistitem.cxx +++ /dev/null @@ -1,677 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace -{ - void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) - { - if ( _nIndex < 0 || _nIndex > _sText.getLength() ) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } -} - -// class VCLXAccessibleListItem ------------------------------------------ - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star; - -DBG_NAME(VCLXAccessibleListItem) - -// ----------------------------------------------------------------------------- -// Ctor() and Dtor() -// ----------------------------------------------------------------------------- -VCLXAccessibleListItem::VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper, sal_Int32 _nIndexInParent, const Reference< XAccessible >& _xParent ) : - - VCLXAccessibleListItem_BASE ( m_aMutex ), - - m_nIndexInParent( _nIndexInParent ), - m_bSelected ( sal_False ), - m_bVisible ( sal_False ), - m_nClientId ( 0 ), - m_pListBoxHelper( _pListBoxHelper ), - m_xParent ( _xParent ) - -{ - DBG_CTOR( VCLXAccessibleListItem, NULL ); - - if ( m_xParent.is() ) - m_xParentContext = m_xParent->getAccessibleContext(); - - if ( m_pListBoxHelper ) - m_sEntryText = m_pListBoxHelper->GetEntry( (sal_uInt16)_nIndexInParent ); -} -// ----------------------------------------------------------------------------- -VCLXAccessibleListItem::~VCLXAccessibleListItem() -{ - DBG_DTOR( VCLXAccessibleListItem, NULL ); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleListItem::SetSelected( sal_Bool _bSelected ) -{ - if ( m_bSelected != _bSelected ) - { - Any aOldValue; - Any aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = _bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleListItem::SetVisible( sal_Bool _bVisible ) -{ - if ( m_bVisible != _bVisible ) - { - Any aOldValue, aNewValue; - m_bVisible = _bVisible; - (_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - (_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleListItem::NotifyAccessibleEvent( sal_Int16 _nEventId, - const ::com::sun::star::uno::Any& _aOldValue, - const ::com::sun::star::uno::Any& _aNewValue ) -{ - AccessibleEventObject aEvt; - aEvt.Source = *this; - aEvt.EventId = _nEventId; - aEvt.OldValue = _aOldValue; - aEvt.NewValue = _aNewValue; - - if (m_nClientId) - comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEvt ); -} -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleListItem::implGetText() -{ - return m_sEntryText; -} -// ----------------------------------------------------------------------------- -Locale VCLXAccessibleListItem::implGetLocale() -{ - return Application::GetSettings().GetLocale(); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleListItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- -Any SAL_CALL VCLXAccessibleListItem::queryInterface( Type const & rType ) throw (RuntimeException) -{ - return VCLXAccessibleListItem_BASE::queryInterface( rType ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::acquire() throw () -{ - VCLXAccessibleListItem_BASE::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::release() throw () -{ - VCLXAccessibleListItem_BASE::release(); -} -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- -Sequence< Type > SAL_CALL VCLXAccessibleListItem::getTypes( ) throw (RuntimeException) -{ - return VCLXAccessibleListItem_BASE::getTypes(); -} -// ----------------------------------------------------------------------------- -Sequence< sal_Int8 > VCLXAccessibleListItem::getImplementationId() throw (RuntimeException) -{ - static ::cppu::OImplementationId* pId = NULL; - - if ( !pId ) - { - ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex ); - - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::disposing() -{ - comphelper::AccessibleEventNotifier::TClientId nId( 0 ); - Reference< XInterface > xEventSource; - { - ::osl::MutexGuard aGuard( m_aMutex ); - - VCLXAccessibleListItem_BASE::disposing(); - m_sEntryText = ::rtl::OUString(); - m_pListBoxHelper = NULL; - m_xParent = NULL; - m_xParentContext = NULL; - - nId = m_nClientId; - m_nClientId = 0; - if ( nId ) - xEventSource = *this; - } - - // Send a disposing to all listeners. - if ( nId ) - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); -} -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleListItem::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleListItem" )); -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleListItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} -// ----------------------------------------------------------------------------- -Sequence< ::rtl::OUString > VCLXAccessibleListItem::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(3); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" )); - aNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleComponent" )); - aNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleListItem" )); - return aNames; -} -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- -Reference< XAccessibleContext > SAL_CALL VCLXAccessibleListItem::getAccessibleContext( ) throw (RuntimeException) -{ - return this; -} -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleChildCount( ) throw (RuntimeException) -{ - return 0; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sal_Int32 ) throw (RuntimeException) -{ - return Reference< XAccessible >(); -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleParent( ) throw (RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - return m_xParent; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - return m_nIndexInParent; -} -// ----------------------------------------------------------------------------- -sal_Int16 SAL_CALL VCLXAccessibleListItem::getAccessibleRole( ) throw (RuntimeException) -{ - return AccessibleRole::LIST_ITEM; - // return AccessibleRole::LABEL; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleDescription( ) throw (RuntimeException) -{ - // no description for every item - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( ) throw (RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // entry text == accessible name - return implGetText(); -} -// ----------------------------------------------------------------------------- -Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet( ) throw (RuntimeException) -{ - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} -// ----------------------------------------------------------------------------- -Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( ) throw (RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xStateSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); - pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - pStateSetHelper->AddState( AccessibleStateType::ENABLED ); - pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); - if ( m_bSelected ) - pStateSetHelper->AddState( AccessibleStateType::SELECTED ); - if ( m_bVisible ) - { - pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - } - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return xStateSet; -} -// ----------------------------------------------------------------------------- -Locale SAL_CALL VCLXAccessibleListItem::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return implGetLocale(); -} -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoint ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Bool bInside = sal_False; - if ( m_pListBoxHelper ) - { - Rectangle aRect( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) ); - aRect.Move(-aRect.TopLeft().X(),-aRect.TopLeft().Y()); - bInside = aRect.IsInside( VCLPoint( _aPoint ) ); - } - return bInside; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) -{ - return Reference< XAccessible >(); -} -// ----------------------------------------------------------------------------- -awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - awt::Rectangle aRect; - if ( m_pListBoxHelper ) - aRect = AWTRectangle( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) ); - - return aRect; -} -// ----------------------------------------------------------------------------- -awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - Point aPoint(0,0); - if ( m_pListBoxHelper ) - { - Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ); - aPoint = aRect.TopLeft(); - } - return AWTPoint( aPoint ); -} -// ----------------------------------------------------------------------------- -awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - Point aPoint(0,0); - if ( m_pListBoxHelper ) - { - Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ); - aPoint = aRect.TopLeft(); - aPoint += m_pListBoxHelper->GetWindowExtentsRelative( NULL ).TopLeft(); - } - return AWTPoint( aPoint ); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - Size aSize; - if ( m_pListBoxHelper ) - aSize = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ).GetSize(); - - return AWTSize( aSize ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::grabFocus( ) throw (RuntimeException) -{ - // no focus for each item -} -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getCaretPosition() throw (RuntimeException) -{ - return -1; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} -// ----------------------------------------------------------------------------- -sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getCharacter( nIndex ); -} -// ----------------------------------------------------------------------------- -Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString sText( implGetText() ); - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return Sequence< PropertyValue >(); -} -// ----------------------------------------------------------------------------- -awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString sText( implGetText() ); - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pListBoxHelper ) - { - Rectangle aCharRect = m_pListBoxHelper->GetEntryCharacterBounds( m_nIndexInParent, nIndex ); - Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount() throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getCharacterCount(); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nIndex = -1; - if ( m_pListBoxHelper ) - { - sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; - Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - sal_Int32 nI = m_pListBoxHelper->GetIndexForPoint( aPnt, nPos ); - if ( nI != -1 && (sal_uInt16)m_nIndexInParent == nPos ) - nIndex = nI; - } - return nIndex; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleListItem::getSelectedText() throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getSelectedText(); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionStart() throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getSelectionStart(); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionEnd() throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getSelectionEnd(); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleListItem::getText() throw (RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getText(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); -} -// ----------------------------------------------------------------------------- -::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); -} -// ----------------------------------------------------------------------------- -::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); -} -// ----------------------------------------------------------------------------- -::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - checkIndex_Impl( nStartIndex, m_sEntryText ); - checkIndex_Impl( nEndIndex, m_sEntryText ); - - sal_Bool bRet = sal_False; - if ( m_pListBoxHelper ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pListBoxHelper->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - Application::AcquireSolarMutex( nRef ); - - bRet = sal_True; - } - } - - return bRet; -} -// ----------------------------------------------------------------------------- -// XAccessibleEventBroadcaster -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) -{ - if (xListener.is()) - { - if (!m_nClientId) - m_nClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener ); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleListItem::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException) -{ - if ( xListener.is() && m_nClientId ) - { - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - if ( m_nClientId ) - { - comphelper::AccessibleEventNotifier::TClientId nId( m_nClientId ); - m_nClientId = 0; - comphelper::AccessibleEventNotifier::revokeClient( nId ); - } - } - } -} -// ----------------------------------------------------------------------------- - - - -// AF (Oct. 29 2002): Return black as constant foreground color. This is an -// initial implementation and has to be substituted by code that determines -// the color that is actually used. -sal_Int32 SAL_CALL VCLXAccessibleListItem::getForeground (void) - throw (::com::sun::star::uno::RuntimeException) -{ - return COL_BLACK; -} - -// AF (Oct. 29 2002): Return white as constant background color. This is an -// initial implementation and has to be substituted by code that determines -// the color that is actually used. -sal_Int32 SAL_CALL VCLXAccessibleListItem::getBackground (void) - throw (::com::sun::star::uno::RuntimeException) -{ - return COL_WHITE; -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx deleted file mode 100644 index f345042ee..000000000 --- a/accessibility/source/standard/vclxaccessiblemenu.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleMenu -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenu::VCLXAccessibleMenu( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ) - :VCLXAccessibleMenuItem( pParent, nItemPos, pMenu ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenu::~VCLXAccessibleMenu() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenu::IsFocused() -{ - sal_Bool bFocused = sal_False; - - if ( IsHighlighted() && !IsChildHighlighted() ) - bFocused = sal_True; - - return bFocused; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenu::IsPopupMenuOpen() -{ - sal_Bool bPopupMenuOpen = sal_False; - - if ( m_pParent ) - { - PopupMenu* pPopupMenu = m_pParent->GetPopupMenu( m_pParent->GetItemId( m_nItemPos ) ); - if ( pPopupMenu && pPopupMenu->IsMenuVisible() ) - bPopupMenuOpen = sal_True; - } - - return bPopupMenuOpen; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenu::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleMenu") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleMenu::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleMenu") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenu::getAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetChildCount(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleMenu::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - return GetChild( i ); -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleMenu::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::MENU; -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleMenu::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetChildAt( rPoint ); -} - -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenu::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - SelectChild( nChildIndex ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenu::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - return IsChildSelected( nChildIndex ); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenu::clearAccessibleSelection( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - DeSelectAll(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenu::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - // This method makes no sense in a menu, and so does nothing. -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenu::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nRet = 0; - - for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ ) - { - if ( IsChildSelected( i ) ) - ++nRet; - } - - return nRet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - - for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ ) - { - if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = GetChild( i ); - break; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) - throw IndexOutOfBoundsException(); - - DeSelectAll(); -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx deleted file mode 100644 index a69e99655..000000000 --- a/accessibility/source/standard/vclxaccessiblemenubar.cxx +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include -#include -#include -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessibleMenuBar -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuBar::VCLXAccessibleMenuBar( Menu* pMenu ) - :OAccessibleMenuComponent( pMenu ) -{ - if ( pMenu ) - { - m_pWindow = pMenu->GetWindow(); - - if ( m_pWindow ) - m_pWindow->AddEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) ); - } -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuBar::~VCLXAccessibleMenuBar() -{ - if ( m_pWindow ) - m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuBar::IsFocused() -{ - sal_Bool bFocused = sal_False; - - if ( m_pWindow && m_pWindow->HasFocus() && !IsChildHighlighted() ) - bFocused = sal_True; - - return bFocused; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleMenuBar::WindowEventListener: unknown window event!" ); - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) - { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" ); - if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) - { - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } - } - return 0; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenuBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_GETFOCUS: - case VCLEVENT_WINDOW_LOSEFOCUS: - { - SetFocused( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS ); - } - break; - case VCLEVENT_OBJECT_DYING: - { - if ( m_pWindow ) - { - m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) ); - m_pWindow = NULL; - } - } - break; - default: - { - } - break; - } -} - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenuBar::disposing() -{ - OAccessibleMenuComponent::disposing(); - - if ( m_pWindow ) - { - m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) ); - m_pWindow = NULL; - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuBar::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleMenuBar") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleMenuBar::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleMenuBar") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuBar::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - - if ( m_pMenu ) - { - Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - Window* pParent = pWindow->GetAccessibleParentWindow(); - if ( pParent ) - { - for ( sal_uInt16 n = pParent->GetAccessibleChildWindowCount(); n; ) - { - Window* pChild = pParent->GetAccessibleChildWindow( --n ); - if ( pChild == pWindow ) - { - nIndexInParent = n; - break; - } - } - } - } - } - - return nIndexInParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleMenuBar::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::MENU_BAR; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuBar::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetStyleSettings().GetMenuBarColor().GetColor(); -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx deleted file mode 100644 index 10cb56a54..000000000 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ /dev/null @@ -1,610 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessibleMenuItem -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuItem::VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ) - :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuItem::~VCLXAccessibleMenuItem() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::IsFocused() -{ - return IsHighlighted(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::IsSelected() -{ - return IsHighlighted(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::IsChecked() -{ - sal_Bool bChecked = sal_False; - - if ( m_pParent ) - { - sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos ); - if ( m_pParent->IsItemChecked( nItemId ) ) - bChecked = sal_True; - } - - return bChecked; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::IsHighlighted() -{ - sal_Bool bHighlighted = sal_False; - - if ( m_pParent && m_pParent->IsHighlighted( m_nItemPos ) ) - bHighlighted = sal_True; - - return bHighlighted; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenuItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - OAccessibleMenuItemComponent::FillAccessibleStateSet( rStateSet ); - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( IsFocused() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - - if ( IsSelected() ) - rStateSet.AddState( AccessibleStateType::SELECTED ); - - if ( IsChecked() ) - rStateSet.AddState( AccessibleStateType::CHECKED ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::implGetText() -{ - return m_sItemText; -} - -// ----------------------------------------------------------------------------- - -Locale VCLXAccessibleMenuItem::implGetLocale() -{ - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleMenuItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleMenuItem") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleMenuItem::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleMenuItem") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleMenuItem::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::MENU_ITEM; -} - -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getCaretPosition() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return -1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Unicode VCLXAccessibleMenuItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getCharacter( nIndex ); -} - -// ----------------------------------------------------------------------------- - -Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Sequence< PropertyValue > aValues; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont(); - sal_Int32 nBackColor = getBackground(); - sal_Int32 nColor = getForeground(); - ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) ); - aValues = pHelper->GetCharacterAttributes( aRequestedAttributes ); - - return aValues; -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pParent ) - { - sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos ); - Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos ); - Rectangle aCharRect = m_pParent->GetCharacterBounds( nItemId, nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getCharacterCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getCharacterCount(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - if ( m_pParent ) - { - sal_uInt16 nItemId = 0; - Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId ); - if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId ) - nIndex = nI; - } - - return nIndex; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::getSelectedText() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectedText(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getSelectionStart() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectionStart(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getSelectionEnd() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectionEnd(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::getText() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getText(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( m_pParent ) - { - Window* pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - - Application::AcquireSolarMutex( nRef ); - - bReturn = sal_True; - } - } - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleMenuItem::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - Click(); - - return sal_True; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); - Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - - if ( m_pParent ) - { - // create auto mnemonics - if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( m_pParent->GetMenuFlags() & MENU_FLAG_NOAUTOMNEMONICS ) ) - m_pParent->CreateAutoMnemonics(); - - // activation key - KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) ); - KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - Sequence< awt::KeyStroke > aSeq1(1); - aSeq1[0].Modifiers = 0; - Reference< XAccessible > xParent( getAccessibleParent() ); - if ( xParent.is() ) - { - Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); - if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU_BAR ) - aSeq1[0].Modifiers |= awt::KeyModifier::MOD2; - } - aSeq1[0].KeyCode = aKeyCode.GetCode(); - aSeq1[0].KeyChar = aKeyEvent.GetCharCode(); - aSeq1[0].KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aSeq1 ); - - // complete menu activation key sequence - Sequence< awt::KeyStroke > aSeq; - if ( xParent.is() ) - { - Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); - if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU ) - { - Reference< XAccessibleAction > xAction( xParentContext, UNO_QUERY ); - if ( xAction.is() && xAction->getAccessibleActionCount() > 0 ) - { - Reference< XAccessibleKeyBinding > xKeyB( xAction->getAccessibleActionKeyBinding( 0 ) ); - if ( xKeyB.is() && xKeyB->getAccessibleKeyBindingCount() > 1 ) - aSeq = xKeyB->getAccessibleKeyBinding( 1 ); - } - } - } - Sequence< awt::KeyStroke > aSeq2 = ::comphelper::concatSequences( aSeq, aSeq1 ); - pKeyBindingHelper->AddKeyBinding( aSeq2 ); - - // accelerator key - KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) ); - if ( aAccelKeyCode.GetCode() != 0 ) - { - Sequence< awt::KeyStroke > aSeq3(1); - aSeq3[0].Modifiers = 0; - if ( aAccelKeyCode.IsShift() ) - aSeq3[0].Modifiers |= awt::KeyModifier::SHIFT; - if ( aAccelKeyCode.IsMod1() ) - aSeq3[0].Modifiers |= awt::KeyModifier::MOD1; - if ( aAccelKeyCode.IsMod2() ) - aSeq3[0].Modifiers |= awt::KeyModifier::MOD2; - if ( aAccelKeyCode.IsMod3() ) - aSeq3[0].Modifiers |= awt::KeyModifier::MOD3; - aSeq3[0].KeyCode = aAccelKeyCode.GetCode(); - aSeq3[0].KeyFunc = static_cast< sal_Int16 >( aAccelKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aSeq3 ); - } - } - - return xKeyBinding; -} - -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleMenuItem::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - if ( IsSelected() ) - aValue <<= (sal_Int32) 1; - else - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleMenuItem::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - sal_Int32 nValue = 0; - OSL_VERIFY( aNumber >>= nValue ); - - if ( nValue <= 0 ) - { - DeSelect(); - bReturn = sal_True; - } - else if ( nValue >= 1 ) - { - Select(); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleMenuItem::getMaximumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 1; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleMenuItem::getMinimumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx b/accessibility/source/standard/vclxaccessiblemenuseparator.cxx deleted file mode 100644 index 7a4e62a74..000000000 --- a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessibleMenuSeparator -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuSeparator::VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ) - :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleMenuSeparator::~VCLXAccessibleMenuSeparator() -{ -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleMenuSeparator::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleMenuSeparator") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleMenuSeparator::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleMenuSeparator") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleMenuSeparator::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::SEPARATOR; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx deleted file mode 100644 index c0255ea74..000000000 --- a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include - -#include -#include - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessiblePopupMenu -// ----------------------------------------------------------------------------- - -VCLXAccessiblePopupMenu::VCLXAccessiblePopupMenu( Menu* pMenu ) - :OAccessibleMenuComponent( pMenu ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessiblePopupMenu::~VCLXAccessiblePopupMenu() -{ -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessiblePopupMenu::IsFocused() -{ - return !IsChildHighlighted(); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessiblePopupMenu::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessiblePopupMenu") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessiblePopupMenu::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessiblePopupMenu") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessiblePopupMenu::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessiblePopupMenu::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::POPUP_MENU; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessiblePopupMenu::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor(); -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx deleted file mode 100644 index f55fa2d49..000000000 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// VCLXAccessibleRadioButton -// ----------------------------------------------------------------------------- - -VCLXAccessibleRadioButton::VCLXAccessibleRadioButton( VCLXWindow* pVCLWindow ) - :VCLXAccessibleTextComponent( pVCLWindow ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleRadioButton::~VCLXAccessibleRadioButton() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_RADIOBUTTON_TOGGLE: - { - Any aOldValue; - Any aNewValue; - - VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); - if ( pVCLXRadioButton && pVCLXRadioButton->getState() ) - aNewValue <<= AccessibleStateType::CHECKED; - else - aOldValue <<= AccessibleStateType::CHECKED; - - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - default: - VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleRelationSet( rRelationSet ); - - RadioButton* pRadioButton = dynamic_cast< RadioButton* >( GetWindow() ); - if ( pRadioButton ) - { - ::std::vector< RadioButton* > aGroup; - pRadioButton->GetRadioButtonGroup( aGroup, true ); - if ( !aGroup.empty() ) - { - sal_Int32 i = 0; - Sequence< Reference< XInterface > > aSequence( static_cast< sal_Int32 >( aGroup.size() ) ); - ::std::vector< RadioButton* >::const_iterator aEndItr = aGroup.end(); - for ( ::std::vector< RadioButton* >::const_iterator aItr = aGroup.begin(); aItr < aEndItr; ++aItr ) - { - aSequence[i++] = (*aItr)->GetAccessible(); - } - rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleRadioButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - - VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); - if ( pVCLXRadioButton ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - if ( pVCLXRadioButton->getState() ) - rStateSet.AddState( AccessibleStateType::CHECKED ); - } -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleRadioButton::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleRadioButton") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleRadioButton::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleRadioButton") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleRadioButton::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleRadioButton::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); - if ( pVCLXRadioButton && !pVCLXRadioButton->getState() ) - pVCLXRadioButton->setState( sal_True ); - - return sal_True; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleRadioButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); - Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - KeyEvent aKeyEvent = pWindow->GetActivationKey(); - KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - if ( aKeyCode.GetCode() != 0 ) - { - awt::KeyStroke aKeyStroke; - aKeyStroke.Modifiers = 0; - if ( aKeyCode.IsShift() ) - aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; - if ( aKeyCode.IsMod1() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; - if ( aKeyCode.IsMod2() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; - if ( aKeyCode.IsMod3() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; - aKeyStroke.KeyCode = aKeyCode.GetCode(); - aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); - aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aKeyStroke ); - } - } - - return xKeyBinding; -} - -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleRadioButton::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); - if ( pVCLXRadioButton ) - aValue <<= (sal_Int32) pVCLXRadioButton->getState(); - - return aValue; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleRadioButton::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); - if ( pVCLXRadioButton ) - { - sal_Int32 nValue = 0; - OSL_VERIFY( aNumber >>= nValue ); - - if ( nValue < 0 ) - nValue = 0; - else if ( nValue > 1 ) - nValue = 1; - - pVCLXRadioButton->setState( (sal_Bool) nValue ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleRadioButton::getMaximumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 1; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleRadioButton::getMinimumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx deleted file mode 100644 index d6e331a46..000000000 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - -// ----------------------------------------------------------------------------- -// VCLXAccessibleScrollBar -// ----------------------------------------------------------------------------- - -VCLXAccessibleScrollBar::VCLXAccessibleScrollBar( VCLXWindow* pVCLWindow ) - :VCLXAccessibleComponent( pVCLWindow ) -{ -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleScrollBar::~VCLXAccessibleScrollBar() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_SCROLLBAR_SCROLL: - { - NotifyAccessibleEvent( AccessibleEventId::VALUE_CHANGED, Any(), Any() ); - } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleScrollBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - - VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); - if ( pVCLXScrollBar ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL ) - rStateSet.AddState( AccessibleStateType::HORIZONTAL ); - else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL ) - rStateSet.AddState( AccessibleStateType::VERTICAL ); - } -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE ) - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleScrollBar::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleScrollBar") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleScrollBar::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleScrollBar") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleScrollBar::getAccessibleActionCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 4; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - sal_Bool bReturn = sal_False; - ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() ); - if ( pScrollBar ) - { - ScrollType eScrollType; - switch ( nIndex ) - { - case 0: eScrollType = SCROLL_LINEUP; break; - case 1: eScrollType = SCROLL_LINEDOWN; break; - case 2: eScrollType = SCROLL_PAGEUP; break; - case 3: eScrollType = SCROLL_PAGEDOWN; break; - default: eScrollType = SCROLL_DONTKNOW; break; - } - if ( pScrollBar->DoScrollAction( eScrollType ) ) - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleScrollBar::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - ::rtl::OUString sDescription; - - switch ( nIndex ) - { - case 0: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_DECLINE ) ); break; - case 1: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_INCLINE ) ); break; - case 2: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_DECBLOCK ) ); break; - case 3: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_INCBLOCK ) ); break; - default: break; - } - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleKeyBinding > VCLXAccessibleScrollBar::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessibleKeyBinding >(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleScrollBar::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); - if ( pVCLXScrollBar ) - aValue <<= (sal_Int32) pVCLXScrollBar->getValue(); - - return aValue; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleScrollBar::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); - if ( pVCLXScrollBar ) - { - sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; - OSL_VERIFY( aNumber >>= nValue ); - OSL_VERIFY( getMinimumValue() >>= nValueMin ); - OSL_VERIFY( getMaximumValue() >>= nValueMax ); - - if ( nValue < nValueMin ) - nValue = nValueMin; - else if ( nValue > nValueMax ) - nValue = nValueMax; - - pVCLXScrollBar->setValue( nValue ); - bReturn = sal_True; - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleScrollBar::getMaximumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - - VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() ); - if ( pVCLXScrollBar ) - aValue <<= (sal_Int32) pVCLXScrollBar->getMaximum(); - - return aValue; -} - -// ----------------------------------------------------------------------------- - -Any VCLXAccessibleScrollBar::getMinimumValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - aValue <<= (sal_Int32) 0; - - return aValue; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx deleted file mode 100644 index a8b2c85d4..000000000 --- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx +++ /dev/null @@ -1,369 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ---------------------------------------------------- -// class VCLXAccessibleStatusBar -// ---------------------------------------------------- - -VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow ) - :VCLXAccessibleComponent( pVCLXWindow ) -{ - m_pStatusBar = static_cast< StatusBar* >( GetWindow() ); - - if ( m_pStatusBar ) - m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() ); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleStatusBar::~VCLXAccessibleStatusBar() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::UpdateShowing( sal_Int32 i, sal_Bool bShowing ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() ); - if ( pVCLXAccessibleStatusBarItem ) - pVCLXAccessibleStatusBarItem->SetShowing( bShowing ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::UpdateItemName( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() ); - if ( pVCLXAccessibleStatusBarItem ) - { - ::rtl::OUString sItemName = pVCLXAccessibleStatusBarItem->GetItemName(); - pVCLXAccessibleStatusBarItem->SetItemName( sItemName ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::UpdateItemText( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() ); - if ( pVCLXAccessibleStatusBarItem ) - { - ::rtl::OUString sItemText = pVCLXAccessibleStatusBarItem->GetItemText(); - pVCLXAccessibleStatusBarItem->SetItemText( sItemText ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::InsertChild( sal_Int32 i ) -{ - if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() ) - { - // insert entry in child list - m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() ); - - // send accessible child event - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::RemoveChild( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - // get the accessible of the removed page - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - - // remove entry in child list - m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_STATUSBAR_ITEMADDED: - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId ); - InsertChild( nItemPos ); - } - } - break; - case VCLEVENT_STATUSBAR_ITEMREMOVED: - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() ); - if ( pVCLXAccessibleStatusBarItem && pVCLXAccessibleStatusBarItem->GetItemId() == nItemId ) - { - RemoveChild( i ); - break; - } - } - } - } - } - break; - case VCLEVENT_STATUSBAR_ALLITEMSREMOVED: - { - for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) - RemoveChild( i ); - } - break; - case VCLEVENT_STATUSBAR_SHOWITEM: - case VCLEVENT_STATUSBAR_HIDEITEM: - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId ); - UpdateShowing( nItemPos, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWITEM ); - } - } - break; - case VCLEVENT_STATUSBAR_SHOWALLITEMS: - case VCLEVENT_STATUSBAR_HIDEALLITEMS: - { - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - UpdateShowing( i, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWALLITEMS ); - } - break; - case VCLEVENT_STATUSBAR_NAMECHANGED: - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId ); - UpdateItemName( nItemPos ); - } - } - break; - case VCLEVENT_STATUSBAR_DRAWITEM: - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId ); - UpdateItemText( nItemPos ); - } - } - break; - case VCLEVENT_OBJECT_DYING: - { - if ( m_pStatusBar ) - { - m_pStatusBar = NULL; - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBar::disposing() -{ - VCLXAccessibleComponent::disposing(); - - if ( m_pStatusBar ) - { - m_pStatusBar = NULL; - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBar::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleStatusBar") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleStatusBar::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleStatusBar") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_aAccessibleChildren.size(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - { - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = m_pStatusBar->GetItemId( (sal_uInt16)i ); - - xChild = new VCLXAccessibleStatusBarItem( m_pStatusBar, nItemId ); - - // insert into status bar item list - m_aAccessibleChildren[i] = xChild; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xChild; - if ( m_pStatusBar ) - { - sal_uInt16 nItemId = m_pStatusBar->GetItemId( VCLPoint( rPoint ) ); - sal_Int32 nItemPos = m_pStatusBar->GetItemPos( nItemId ); - if ( nItemPos >= 0 && nItemPos < (sal_Int32)m_aAccessibleChildren.size() ) - xChild = getAccessibleChild( nItemPos ); - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx deleted file mode 100644 index f492f9e56..000000000 --- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx +++ /dev/null @@ -1,632 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessibleStatusBarItem -// ----------------------------------------------------------------------------- - -VCLXAccessibleStatusBarItem::VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId ) - :AccessibleTextHelper_BASE( new VCLExternalSolarLock() ) - ,m_pStatusBar( pStatusBar ) - ,m_nItemId( nItemId ) -{ - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - - m_sItemName = GetItemName(); - m_sItemText = GetItemText(); - m_bShowing = IsShowing(); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleStatusBarItem::~VCLXAccessibleStatusBarItem() -{ - delete m_pExternalLock; - m_pExternalLock = NULL; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleStatusBarItem::IsShowing() -{ - sal_Bool bShowing = sal_False; - - if ( m_pStatusBar ) - bShowing = m_pStatusBar->IsItemVisible( m_nItemId ); - - return bShowing; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::SetShowing( sal_Bool bShowing ) -{ - if ( m_bShowing != bShowing ) - { - Any aOldValue, aNewValue; - if ( m_bShowing ) - aOldValue <<= AccessibleStateType::SHOWING; - else - aNewValue <<= AccessibleStateType::SHOWING; - m_bShowing = bShowing; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::SetItemName( const ::rtl::OUString& sItemName ) -{ - if ( !m_sItemName.equals( sItemName ) ) - { - Any aOldValue, aNewValue; - aOldValue <<= m_sItemName; - aNewValue <<= sItemName; - m_sItemName = sItemName; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::GetItemName() -{ - ::rtl::OUString sName; - if ( m_pStatusBar ) - sName = m_pStatusBar->GetAccessibleName( m_nItemId ); - - return sName; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::SetItemText( const ::rtl::OUString& sItemText ) -{ - Any aOldValue, aNewValue; - if ( implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) ) - { - m_sItemText = sItemText; - NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::GetItemText() -{ - ::rtl::OUString sText; - ::vcl::ControlLayoutData aLayoutData; - if ( m_pStatusBar ) - { - Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId ); - m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect ); - sText = aLayoutData.m_aDisplayText; - } - - return sText; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - if ( IsShowing() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleStatusBarItem::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - - if ( m_pStatusBar ) - aBounds = AWTRectangle( m_pStatusBar->GetItemRect( m_nItemId ) ); - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::implGetText() -{ - return GetItemText(); -} - -// ----------------------------------------------------------------------------- - -lang::Locale VCLXAccessibleStatusBarItem::implGetLocale() -{ - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::disposing() -{ - AccessibleTextHelper_BASE::disposing(); - - m_pStatusBar = NULL; - m_sItemName = ::rtl::OUString(); - m_sItemText = ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleStatusBarItem" )); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleStatusBarItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleStatusBarItem::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleStatusBarItem" )); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- - -Reference< XAccessibleContext > VCLXAccessibleStatusBarItem::getAccessibleContext( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return this; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pStatusBar ) - xParent = m_pStatusBar->GetAccessible(); - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - if ( m_pStatusBar ) - nIndexInParent = m_pStatusBar->GetItemPos( m_nItemId ); - - return nIndexInParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleStatusBarItem::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::LABEL; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pStatusBar ) - sDescription = m_pStatusBar->GetHelpText( m_nItemId ); - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetItemName(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > VCLXAccessibleStatusBarItem::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale VCLXAccessibleStatusBarItem::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleStatusBarItem::grabFocus( ) throw (RuntimeException) -{ - // no focus for status bar items -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > VCLXAccessibleStatusBarItem::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetItemText(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleStatusBarItem::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getCaretPosition() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return -1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleStatusBarItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -Sequence< PropertyValue > VCLXAccessibleStatusBarItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Sequence< PropertyValue > aValues; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - if ( m_pStatusBar ) - { - Font aFont = m_pStatusBar->GetFont(); - sal_Int32 nBackColor = getBackground(); - sal_Int32 nColor = getForeground(); - ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) ); - aValues = pHelper->GetCharacterAttributes( aRequestedAttributes ); - } - - return aValues; -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleStatusBarItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pStatusBar ) - { - ::vcl::ControlLayoutData aLayoutData; - Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId ); - m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect ); - Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleStatusBarItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - if ( m_pStatusBar ) - { - ::vcl::ControlLayoutData aLayoutData; - Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId ); - m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - nIndex = aLayoutData.GetIndexForPoint( aPnt ); - } - - return nIndex; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleStatusBarItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( m_pStatusBar ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pStatusBar->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - - Application::AcquireSolarMutex( nRef ); - - bReturn = sal_True; - } - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx deleted file mode 100644 index b96a34886..000000000 --- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx +++ /dev/null @@ -1,518 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ---------------------------------------------------- -// class VCLXAccessibleTabControl -// ---------------------------------------------------- - -VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow ) - :VCLXAccessibleComponent( pVCLXWindow ) -{ - m_pTabControl = static_cast< TabControl* >( GetWindow() ); - - if ( m_pTabControl ) - m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), Reference< XAccessible >() ); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleTabControl::~VCLXAccessibleTabControl() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::UpdateFocused() -{ - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); - if ( pVCLXAccessibleTabPage ) - pVCLXAccessibleTabPage->SetFocused( pVCLXAccessibleTabPage->IsFocused() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::UpdateSelected( sal_Int32 i, bool bSelected ) -{ - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); - if ( pVCLXAccessibleTabPage ) - pVCLXAccessibleTabPage->SetSelected( bSelected ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::UpdatePageText( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); - if ( pVCLXAccessibleTabPage ) - pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::UpdateTabPage( sal_Int32 i, bool bNew ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); - if ( pVCLXAccessibleTabPage ) - pVCLXAccessibleTabPage->Update( bNew ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::InsertChild( sal_Int32 i ) -{ - if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() ) - { - // insert entry in child list - m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() ); - - // send accessible child event - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::RemoveChild( sal_Int32 i ) -{ - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - // get the accessible of the removed page - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - - // remove entry in child list - m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_TABPAGE_ACTIVATE: - case VCLEVENT_TABPAGE_DEACTIVATE: - { - if ( m_pTabControl ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); - UpdateFocused(); - UpdateSelected( nPagePos, rVclWindowEvent.GetId() == VCLEVENT_TABPAGE_ACTIVATE ); - } - } - break; - case VCLEVENT_TABPAGE_PAGETEXTCHANGED: - { - if ( m_pTabControl ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); - UpdatePageText( nPagePos ); - } - } - break; - case VCLEVENT_TABPAGE_INSERTED: - { - if ( m_pTabControl ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); - InsertChild( nPagePos ); - } - } - break; - case VCLEVENT_TABPAGE_REMOVED: - { - if ( m_pTabControl ) - { - sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xChild( getAccessibleChild( i ) ); - if ( xChild.is() ) - { - VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); - if ( pVCLXAccessibleTabPage && pVCLXAccessibleTabPage->GetPageId() == nPageId ) - { - RemoveChild( i ); - break; - } - } - } - } - } - break; - case VCLEVENT_TABPAGE_REMOVEDALL: - { - for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) - RemoveChild( i ); - } - break; - case VCLEVENT_WINDOW_GETFOCUS: - case VCLEVENT_WINDOW_LOSEFOCUS: - { - UpdateFocused(); - } - break; - case VCLEVENT_OBJECT_DYING: - { - if ( m_pTabControl ) - { - m_pTabControl = NULL; - - // dispose all tab pages - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - { - if ( m_pTabControl ) - { - Window* pChild = static_cast< Window* >( rVclWindowEvent.GetData() ); - if ( pChild && pChild->GetType() == WINDOW_TABPAGE ) - { - for ( sal_Int32 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i ) - { - sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i ); - TabPage* pTabPage = m_pTabControl->GetTabPage( nPageId ); - if ( pTabPage == (TabPage*) pChild ) - UpdateTabPage( i, rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW ); - } - } - } - } - break; - default: - VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); - } -} - - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - - if ( m_pTabControl ) - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::disposing() -{ - VCLXAccessibleComponent::disposing(); - - if ( m_pTabControl ) - { - m_pTabControl = NULL; - - // dispose all tab pages - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabControl::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleTabControl") ); -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleTabControl::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTabControl") ); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_aAccessibleChildren.size(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - { - if ( m_pTabControl ) - { - sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i ); - - xChild = new VCLXAccessibleTabPage( m_pTabControl, nPageId ); - - // insert into tab page list - m_aAccessibleChildren[i] = xChild; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleTabControl::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PAGE_TAB_LIST; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabControl::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - if ( m_pTabControl ) - m_pTabControl->SelectTabPage( m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - sal_Bool bSelected = sal_False; - if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ) - bSelected = sal_True; - - return bSelected; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::clearAccessibleSelection( ) throw (RuntimeException) -{ - // This method makes no sense in a tab control, and so does nothing. -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - selectAccessibleChild( 0 ); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabControl::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 1; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabControl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = getAccessibleChild( i ); - break; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabControl::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - // This method makes no sense in a tab control, and so does nothing. -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx deleted file mode 100644 index 358f9cc28..000000000 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ /dev/null @@ -1,705 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class VCLXAccessibleTabPage -// ----------------------------------------------------------------------------- - -VCLXAccessibleTabPage::VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId ) - :AccessibleTextHelper_BASE( new VCLExternalSolarLock() ) - ,m_pTabControl( pTabControl ) - ,m_nPageId( nPageId ) -{ - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - m_bFocused = IsFocused(); - m_bSelected = IsSelected(); - m_sPageText = GetPageText(); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleTabPage::~VCLXAccessibleTabPage() -{ - delete m_pExternalLock; - m_pExternalLock = NULL; -} - -// ----------------------------------------------------------------------------- - -bool VCLXAccessibleTabPage::IsFocused() -{ - bool bFocused = false; - - if ( m_pTabControl && m_pTabControl->HasFocus() && m_pTabControl->GetCurPageId() == m_nPageId ) - bFocused = true; - - return bFocused; -} - -// ----------------------------------------------------------------------------- - -bool VCLXAccessibleTabPage::IsSelected() -{ - bool bSelected = false; - - if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_nPageId ) - bSelected = true; - - return bSelected; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::SetFocused( bool bFocused ) -{ - if ( m_bFocused != bFocused ) - { - Any aOldValue, aNewValue; - if ( m_bFocused ) - aOldValue <<= AccessibleStateType::FOCUSED; - else - aNewValue <<= AccessibleStateType::FOCUSED; - m_bFocused = bFocused; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::SetSelected( bool bSelected ) -{ - if ( m_bSelected != bSelected ) - { - Any aOldValue, aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::SetPageText( const ::rtl::OUString& sPageText ) -{ - Any aOldValue, aNewValue; - if ( OCommonAccessibleText::implInitTextChangedEvent( m_sPageText, sPageText, aOldValue, aNewValue ) ) - { - Any aOldName, aNewName; - aOldName <<= m_sPageText; - aNewName <<= sPageText; - m_sPageText = sPageText; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldName, aNewName ); - NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::GetPageText() -{ - ::rtl::OUString sText; - if ( m_pTabControl ) - sText = OutputDevice::GetNonMnemonicString( m_pTabControl->GetPageText( m_nPageId ) ); - - return sText; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::Update( bool bNew ) -{ - if ( m_pTabControl ) - { - TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId ); - if ( pTabPage ) - { - Reference< XAccessible > xChild( pTabPage->GetAccessible( bNew ) ); - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - if ( bNew ) - aNewValue <<= xChild; - else - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( IsFocused() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - rStateSet.AddState( AccessibleStateType::SHOWING ); - - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - - if ( IsSelected() ) - rStateSet.AddState( AccessibleStateType::SELECTED ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleTabPage::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - - if ( m_pTabControl ) - aBounds = AWTRectangle( m_pTabControl->GetTabBounds( m_nPageId ) ); - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::implGetText() -{ - return GetPageText(); -} - -// ----------------------------------------------------------------------------- - -lang::Locale VCLXAccessibleTabPage::implGetLocale() -{ - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::disposing() -{ - AccessibleTextHelper_BASE::disposing(); - - m_pTabControl = NULL; - m_sPageText = ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleTabPage" )); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTabPage::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > VCLXAccessibleTabPage::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleTabPage" )); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- - -Reference< XAccessibleContext > VCLXAccessibleTabPage::getAccessibleContext( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return this; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nCount = 0; - if ( m_pTabControl ) - { - TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId ); - if ( pTabPage && pTabPage->IsVisible() ) - nCount = 1; - } - - return nCount; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - if ( m_pTabControl ) - { - TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId ); - if ( pTabPage && pTabPage->IsVisible() ) - xChild = pTabPage->GetAccessible(); - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pTabControl ) - xParent = m_pTabControl->GetAccessible(); - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - if ( m_pTabControl ) - nIndexInParent = m_pTabControl->GetPagePos( m_nPageId ); - - return nIndexInParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 VCLXAccessibleTabPage::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PAGE_TAB; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pTabControl ) - sDescription = m_pTabControl->GetHelpText( m_nPageId ); - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetPageText(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale VCLXAccessibleTabPage::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPage::grabFocus( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( m_pTabControl ) - { - m_pTabControl->SelectTabPage( m_nPageId ); - m_pTabControl->GrabFocus(); - } -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > VCLXAccessibleTabPage::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTabPage::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getCaretPosition() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return -1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTabPage::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -Sequence< PropertyValue > VCLXAccessibleTabPage::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Sequence< PropertyValue > aValues; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - if ( m_pTabControl ) - { - Font aFont = m_pTabControl->GetFont(); - sal_Int32 nBackColor = getBackground(); - sal_Int32 nColor = getForeground(); - ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) ); - aValues = pHelper->GetCharacterAttributes( aRequestedAttributes ); - } - - return aValues; -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pTabControl ) - { - Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId ); - Rectangle aCharRect = m_pTabControl->GetCharacterBounds( m_nPageId, nIndex ); - aCharRect.Move( -aPageRect.Left(), -aPageRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - if ( m_pTabControl ) - { - sal_uInt16 nPageId = 0; - Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aPageRect.TopLeft(); - sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId ); - if ( nI != -1 && m_nPageId == nPageId ) - nIndex = nI; - } - - return nIndex; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTabPage::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( m_pTabControl ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pTabControl->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - - Application::AcquireSolarMutex( nRef ); - - bReturn = sal_True; - } - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx deleted file mode 100644 index a9d3afd95..000000000 --- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ---------------------------------------------------- -// class VCLXAccessibleTabPageWindow -// ---------------------------------------------------- - -VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow ) - :VCLXAccessibleComponent( pVCLXWindow ) -{ - m_pTabPage = static_cast< TabPage* >( GetWindow() ); - if ( m_pTabPage ) - { - Window* pParent = m_pTabPage->GetAccessibleParentWindow(); - if ( pParent && pParent->GetType() == WINDOW_TABCONTROL ) - { - m_pTabControl = static_cast< TabControl* >( pParent ); - if ( m_pTabControl ) - { - for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i ) - { - sal_uInt16 nPageId = m_pTabControl->GetPageId( i ); - if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage ) - m_nPageId = nPageId; - } - } - } - } -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleTabPageWindow::~VCLXAccessibleTabPageWindow() -{ -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleTabPageWindow::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - - if ( m_pTabControl ) - { - Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId ); - if ( m_pTabPage ) - { - Rectangle aRect = Rectangle( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() ); - aRect.Move( -aPageRect.Left(), -aPageRect.Top() ); - aBounds = AWTRectangle( aRect ); - } - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTabPageWindow::disposing() -{ - VCLXAccessibleComponent::disposing(); - - m_pTabControl = NULL; - m_pTabPage = NULL; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -Reference< XAccessible > VCLXAccessibleTabPageWindow::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pTabControl ) - { - Reference< XAccessible > xAcc( m_pTabControl->GetAccessible() ); - if ( xAcc.is() ) - { - Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() ); - if ( xCont.is() ) - xParent = xCont->getAccessibleChild( m_pTabControl->GetPagePos( m_nPageId ) ); - } - } - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx deleted file mode 100644 index ead524a34..000000000 --- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx +++ /dev/null @@ -1,365 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ---------------------------------------------------- -// class VCLXAccessibleTextComponent -// ---------------------------------------------------- - -VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow ) - :VCLXAccessibleComponent( pVCLXWindow ) -{ - if ( GetWindow() ) - m_sText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() ); -} - -// ----------------------------------------------------------------------------- - -VCLXAccessibleTextComponent::~VCLXAccessibleTextComponent() -{ -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTextComponent::SetText( const ::rtl::OUString& sText ) -{ - Any aOldValue, aNewValue; - if ( implInitTextChangedEvent( m_sText, sText, aOldValue, aNewValue ) ) - { - m_sText = sText; - NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTextComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_FRAMETITLECHANGED: - { - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - SetText( implGetText() ); - } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleText -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTextComponent::implGetText() -{ - ::rtl::OUString aText; - if ( GetWindow() ) - aText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() ); - - return aText; -} - -// ----------------------------------------------------------------------------- - -lang::Locale VCLXAccessibleTextComponent::implGetLocale() -{ - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTextComponent::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void VCLXAccessibleTextComponent::disposing() -{ - VCLXAccessibleComponent::disposing(); - - m_sText = ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE ) - -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTextComponent::getCaretPosition() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return -1; -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTextComponent::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return setSelection( nIndex, nIndex ); -} - -// ----------------------------------------------------------------------------- - -sal_Unicode VCLXAccessibleTextComponent::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getCharacter( nIndex ); -} - -// ----------------------------------------------------------------------------- - -Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Sequence< PropertyValue > aValues; - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - if ( GetWindow() ) - { - Font aFont = GetWindow()->GetControlFont(); - sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor(); - sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor(); - ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) ); - aValues = pHelper->GetCharacterAttributes( aRequestedAttributes ); - } - - return aValues; -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aRect; - Control* pControl = static_cast< Control* >( GetWindow() ); - if ( pControl ) - aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) ); - - return aRect; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTextComponent::getCharacterCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getCharacterCount(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - Control* pControl = static_cast< Control* >( GetWindow() ); - if ( pControl ) - nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) ); - - return nIndex; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTextComponent::getSelectedText() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectedText(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTextComponent::getSelectionStart() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectionStart(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 VCLXAccessibleTextComponent::getSelectionEnd() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getSelectionEnd(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTextComponent::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTextComponent::getText() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getText(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString VCLXAccessibleTextComponent::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( GetWindow() ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - - Application::AcquireSolarMutex( nRef ); - - bReturn = sal_True; - } - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletextfield.cxx b/accessibility/source/standard/vclxaccessibletextfield.cxx deleted file mode 100644 index 189de3774..000000000 --- a/accessibility/source/standard/vclxaccessibletextfield.cxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; - - - - -VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) : - - VCLXAccessibleTextComponent (pVCLWindow), - - m_xParent( _xParent ) - -{ -} - - - - -VCLXAccessibleTextField::~VCLXAccessibleTextField (void) -{ -} - - - - -::rtl::OUString VCLXAccessibleTextField::implGetText (void) -{ - ::rtl::OUString aText; - ListBox* pListBox = static_cast(GetWindow()); - if (pListBox!=NULL && !pListBox->IsInDropDown()) - aText = pListBox->GetSelectEntry(); - - return aText; -} - - - - -IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE) -IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE) - - -//===== XAccessible ========================================================= - -Reference SAL_CALL - VCLXAccessibleTextField::getAccessibleContext (void) - throw (RuntimeException) -{ - return this; -} - - -//===== XAccessibleContext ================================================== - -sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void) - throw (RuntimeException) -{ - return 0; -} - - - - -Reference SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32) - throw (IndexOutOfBoundsException, RuntimeException) -{ - throw IndexOutOfBoundsException(); -} - - - - -sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void) - throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return AccessibleRole::TEXT; -} - -Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( ) - throw (RuntimeException) -{ - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - return m_xParent; -} - - - -//===== XServiceInfo ========================================================== - -::rtl::OUString VCLXAccessibleTextField::getImplementationName (void) - throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleTextField" )); -} - - - - -Sequence< ::rtl::OUString > VCLXAccessibleTextField::getSupportedServiceNames (void) - throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleTextField" )); - return aNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx deleted file mode 100644 index d2addb460..000000000 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ /dev/null @@ -1,884 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" - -// includes -------------------------------------------------------------- -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; - -namespace -{ - // ========================================================================= - // = OToolBoxWindowItemContext - // ========================================================================= - /** XAccessibleContext implementation for a toolbox item which is represented by a VCL Window - */ - class OToolBoxWindowItemContext : public OAccessibleContextWrapper - { - sal_Int32 m_nIndexInParent; - public: - OToolBoxWindowItemContext(sal_Int32 _nIndexInParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible - ) : OAccessibleContextWrapper( - _rxORB, - _rxInnerAccessibleContext, - _rxOwningAccessible, - _rxParentAccessible ) - ,m_nIndexInParent(_nIndexInParent) - { - } - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - }; - - // ------------------------------------------------------------------------- - sal_Int32 SAL_CALL OToolBoxWindowItemContext::getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return m_nIndexInParent; - } - - // ========================================================================= - // = OToolBoxWindowItem - // ========================================================================= - typedef ::cppu::ImplHelper1 < XUnoTunnel - > OToolBoxWindowItem_Base; - - /** XAccessible implementation for a toolbox item which is represented by a VCL Window - */ - class OToolBoxWindowItem - :public OAccessibleWrapper - ,public OToolBoxWindowItem_Base - { - private: - sal_Int32 m_nIndexInParent; - - public: - inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; } - inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; } - - static sal_Bool isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation = NULL ); - - public: - OToolBoxWindowItem(sal_Int32 _nIndexInParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxInnerAccessible, - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible - ) : OAccessibleWrapper( - _rxORB, - _rxInnerAccessible, - _rxParentAccessible) - ,m_nIndexInParent(_nIndexInParent) - { - } - - protected: - // XInterface - DECLARE_XINTERFACE( ) - DECLARE_XTYPEPROVIDER( ) - - // OAccessibleWrapper - virtual OAccessibleContextWrapper* createAccessibleContext( - const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerContext - ); - - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException); - static Sequence< sal_Int8 > getUnoTunnelImplementationId(); - }; - - // ------------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base ) - IMPLEMENT_FORWARD_XTYPEPROVIDER2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base ) - - // ------------------------------------------------------------------------- - OAccessibleContextWrapper* OToolBoxWindowItem::createAccessibleContext( - const Reference< XAccessibleContext >& _rxInnerContext ) - { - return new OToolBoxWindowItemContext( m_nIndexInParent,getORB(), _rxInnerContext, this, getParent() ); - } - - //-------------------------------------------------------------------- - sal_Bool OToolBoxWindowItem::isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation ) - { - OToolBoxWindowItem* pImplementation = NULL; - - Reference< XUnoTunnel > xTunnel( _rxAcc, UNO_QUERY ); - if ( xTunnel.is() ) - pImplementation = reinterpret_cast< OToolBoxWindowItem* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) ); - - if ( _ppImplementation ) - *_ppImplementation = pImplementation; - - return NULL != pImplementation; - } - - //-------------------------------------------------------------------- - Sequence< sal_Int8 > OToolBoxWindowItem::getUnoTunnelImplementationId() - { - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); - } - - //-------------------------------------------------------------------- - sal_Int64 SAL_CALL OToolBoxWindowItem::getSomething( const Sequence< sal_Int8 >& _rId ) throw (RuntimeException) - { - if ( ( 16 == _rId.getLength() ) - && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rId.getConstArray(), 16 ) ) - ) - return reinterpret_cast< sal_Int64>( this ); - - return 0; - } -} - -DBG_NAME(VCLXAccessibleToolBox) - -// ----------------------------------------------------------------------------- -// VCLXAccessibleToolBox -// ----------------------------------------------------------------------------- -VCLXAccessibleToolBox::VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ) : - - VCLXAccessibleComponent( pVCLXWindow ) - -{ - DBG_CTOR(VCLXAccessibleToolBox,NULL); -} -// ----------------------------------------------------------------------------- -VCLXAccessibleToolBox::~VCLXAccessibleToolBox() -{ - DBG_DTOR(VCLXAccessibleToolBox,NULL); -} -// ----------------------------------------------------------------------------- -VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus ) -{ - VCLXAccessibleToolBoxItem* pItem = NULL; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) ) - { - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); - // returns only toolbox buttons, not windows - if ( aIter != m_aAccessibleChildren.end() && !aIter->second.is()) - pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - } - - return pItem; -} -// ----------------------------------------------------------------------------- - -void VCLXAccessibleToolBox::UpdateFocus_Impl() -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if( !pToolBox ) - return; - - // submit events only if toolbox has the focus to avoid sending events due to mouse move - sal_Bool bHasFocus = sal_False; - if ( pToolBox->HasFocus() ) - bHasFocus = sal_True; - else - { - // check for subtoolbar, i.e. check if our parent is a toolbar - ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( pToolBox->GetParent() ); - // subtoolbars never get the focus as key input is just forwarded, so check if the parent toolbar has it - if ( pToolBoxParent && pToolBoxParent->HasFocus() ) - bHasFocus = sal_True; - } - - if ( bHasFocus ) - { - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); - sal_uInt16 nFocusCount = 0; - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) - { - sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first ); - - if ( aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem->HasFocus() && nItemId != nHighlightItemId ) - { - // reset the old focused item - pItem->SetFocus( sal_False ); - nFocusCount++; - } - if ( nItemId == nHighlightItemId ) - { - // set the new focused item - pItem->SetFocus( sal_True ); - nFocusCount++; - } - } - // both items changed? - if ( nFocusCount > 1 ) - break; - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos ) -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus - { - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); - if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem->HasFocus() ) - pItem->SetFocus( sal_False ); - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 ) -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) - { - sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first ); - - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) ); - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos ) -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)_nPos ); - - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); - if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem ) - pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ); - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::implReleaseToolboxItem( ToolBoxItemsMap::iterator& _rMapPos, - bool _bNotifyRemoval, bool _bDispose ) -{ - Reference< XAccessible > xItemAcc( _rMapPos->second ); - if ( !xItemAcc.is() ) - return; - - if ( _bNotifyRemoval ) - { - NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xItemAcc ), Any() ); - } - - OToolBoxWindowItem* pWindowItem = NULL; - if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) - { - static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() )->ReleaseToolBox(); - if ( _bDispose ) - ::comphelper::disposeComponent( xItemAcc ); - } - else - { - if ( _bDispose ) - { - if ( pWindowItem ) - { - Reference< XAccessibleContext > xContext( pWindowItem->getContextNoCreate() ); - ::comphelper::disposeComponent( xContext ); - } - } - } -} - -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded ) -{ - if ( _nPos < sal_Int32( m_aAccessibleChildren.size() ) ) - { - UpdateAllItems_Impl(); - return; - } - - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - if ( !_bItemAdded ) - { // the item was removed - // -> destroy the old item - ToolBoxItemsMap::iterator aItemPos = m_aAccessibleChildren.find( _nPos ); - if ( m_aAccessibleChildren.end() != aItemPos ) - { - implReleaseToolboxItem( aItemPos, true, true ); - m_aAccessibleChildren.erase( aItemPos ); - } - } - - // adjust the "index-in-parent"s - ToolBoxItemsMap::iterator aIndexAdjust = m_aAccessibleChildren.upper_bound( _nPos ); - while ( m_aAccessibleChildren.end() != aIndexAdjust ) - { - Reference< XAccessible > xItemAcc( aIndexAdjust->second ); - - OToolBoxWindowItem* pWindowItem = NULL; - if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) - { - VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() ); - if ( pItem ) - { - sal_Int32 nIndex = pItem->getIndexInParent( ); - nIndex += (_bItemAdded ? +1 : -1); - pItem->setIndexInParent( nIndex ); - } - } - else - { - if ( pWindowItem ) - { - sal_Int32 nIndex = pWindowItem->getIndexInParent( ); - nIndex += (_bItemAdded ? +1 : -1); - pWindowItem->setIndexInParent( nIndex ); - } - } - - ++aIndexAdjust; - } - - if ( _bItemAdded ) - { - // TODO: we should make this dependent on the existence of event listeners - // with the current implementation, we always create accessible object - Any aNewChild = makeAny( getAccessibleChild( (sal_Int32)_nPos ) ); - NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewChild ); - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateAllItems_Impl() -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - // deregister the old items - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) - { - implReleaseToolboxItem( aIter, true, true ); - } - m_aAccessibleChildren.clear(); - - // register the new items - sal_uInt16 i, nCount = pToolBox->GetItemCount(); - for ( i = 0; i < nCount; ++i ) - { - Any aNewValue; - aNewValue <<= getAccessibleChild( (sal_Int32)i );; - NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue ); - } - } -} - -// ----------------------------------------------------------------------------- - -void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ) -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if( pWindow && pToolBox ) - { - Reference< XAccessible > xChild( pWindow->GetAccessible() ); - if( xChild.is() ) - { - Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( pToolBox->GetDownItemId() ) ) ) ); - VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() ); - - pItem->SetChild( xChild ); - pItem->NotifyChildEvent( xChild, bOpen ); - } - } -} - -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateItemName_Impl( sal_Int32 _nPos ) -{ - VCLXAccessibleToolBoxItem* pItem = GetItem_Impl( _nPos, false ); - if ( pItem ) - pItem->NameChanged(); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::UpdateItemEnabled_Impl( sal_Int32 _nPos ) -{ - VCLXAccessibleToolBoxItem* pItem = GetItem_Impl( _nPos, false ); - if ( pItem ) - pItem->ToggleEnableState(); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ) -{ - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pChildWindow - && pToolBox - && pToolBox == pChildWindow->GetParent() - && pChildWindow->GetType() == WINDOW_TOOLBOX ) - { - sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); - Reference< XAccessible > xItem = getAccessibleChild( nIndex ); - if ( xItem.is() ) - { - Reference< XAccessible > xChild = pChildWindow->GetAccessible(); - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); - pItem->SetChild( xChild ); - pItem->NotifyChildEvent( xChild, _bShow ); - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox ) -{ - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); - Reference< XAccessible > xItem = getAccessibleChild( nIndex ); - if ( xItem.is() ) - { - Reference< XAccessible > xChild = _pSubToolBox->GetAccessible(); - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); - if ( pItem->GetChild() == xChild ) - { - pItem->SetChild( Reference< XAccessible >() ); - pItem->NotifyChildEvent( xChild, false ); - } - } - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - if ( pToolBox->IsHorizontal() ) - rStateSet.AddState( AccessibleStateType::HORIZONTAL ); - else - rStateSet.AddState( AccessibleStateType::VERTICAL ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING) - Reference< XAccessibleContext > xTemp = this; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_TOOLBOX_CLICK: - { - if ( rVclWindowEvent.GetData() ) - { - UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - } - break; - } - case VCLEVENT_TOOLBOX_DOUBLECLICK: - case VCLEVENT_TOOLBOX_ACTIVATE: - case VCLEVENT_TOOLBOX_DEACTIVATE: - case VCLEVENT_TOOLBOX_SELECT: - break; - - case VCLEVENT_TOOLBOX_HIGHLIGHT: - UpdateFocus_Impl(); - break; - - case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: - ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - break; - - case VCLEVENT_TOOLBOX_ITEMADDED : -// UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), VCLEVENT_TOOLBOX_ITEMADDED == rVclWindowEvent.GetId() ); - UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), sal_True ); - break; - - case VCLEVENT_TOOLBOX_ITEMREMOVED : - case VCLEVENT_TOOLBOX_ALLITEMSCHANGED : - { - UpdateAllItems_Impl(); - break; - } - - case VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED: - { - sal_Int32 nPos = (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(); - ToolBoxItemsMap::iterator aAccessiblePos( m_aAccessibleChildren.find( nPos ) ); - if ( m_aAccessibleChildren.end() != aAccessiblePos ) - { - implReleaseToolboxItem( aAccessiblePos, false, true ); - m_aAccessibleChildren.erase (aAccessiblePos); - } - - Any aNewValue; - aNewValue <<= getAccessibleChild(nPos); - NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue ); - break; - } - case VCLEVENT_TOOLBOX_ITEMTEXTCHANGED : - UpdateItemName_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - break; - - case VCLEVENT_TOOLBOX_ITEMENABLED : - case VCLEVENT_TOOLBOX_ITEMDISABLED : - { - UpdateItemEnabled_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - break; - } - - case VCLEVENT_DROPDOWN_OPEN: - case VCLEVENT_DROPDOWN_CLOSE: - { - UpdateCustomPopupItemp_Impl( static_cast< Window* >( rVclWindowEvent.GetData() ), rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN ); - break; - } - - case VCLEVENT_OBJECT_DYING : - { - // if this toolbox is a subtoolbox, we have to relese it from its parent - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox && pToolBox->GetParent() && - pToolBox->GetParent()->GetType() == WINDOW_TOOLBOX ) - { - VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >( - pToolBox->GetParent()->GetAccessible()->getAccessibleContext().get() ); - if ( pParent ) - pParent->ReleaseSubToolBox( pToolBox ); - } - - // dispose all items - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) - { - implReleaseToolboxItem( aIter, false, true ); - } - m_aAccessibleChildren.clear(); - - //!!! no break to call base class - } - - default: - VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children - { - Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent); - if ( xReturn.is() ) - NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny(xReturn) ); - else - HandleSubToolBarEvent( rVclWindowEvent, true ); - } - break; - - default: - VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); - - } -} -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE ) -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE ) -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleToolBox::disposing() -{ - VCLXAccessibleComponent::disposing(); - - // release the items - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) - { - implReleaseToolboxItem( aIter, false, true ); - } - m_aAccessibleChildren.clear(); -} -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleToolBox::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleToolBox" )); -} -// ----------------------------------------------------------------------------- -Sequence< ::rtl::OUString > VCLXAccessibleToolBox::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames(); - sal_Int32 nLength = aNames.getLength(); - aNames.realloc( nLength + 1 ); - aNames[nLength] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleToolBox" )); - return aNames; -} -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( ) throw (RuntimeException) -{ - comphelper::OExternalLockGuard aGuard( this ); - - sal_Int32 nCount = 0; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - nCount = pToolBox->GetItemCount(); - - return nCount; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - comphelper::OExternalLockGuard aGuard( this ); - - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - Reference< XAccessible > xChild; - // search for the child - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i); - if ( m_aAccessibleChildren.end() == aIter ) - { - sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)i ); - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); - Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); - // not found -> create a new child - VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); - Reference< XAccessible> xParent = pChild; - if ( pItemWindow ) - { - xChild = new OToolBoxWindowItem(0,::comphelper::getProcessServiceFactory(),pItemWindow->GetAccessible(),xParent); - pItemWindow->SetAccessible(xChild); - pChild->SetChild( xChild ); - } - xChild = pChild; - if ( nHighlightItemId > 0 && nItemId == nHighlightItemId ) - pChild->SetFocus( sal_True ); - if ( pToolBox->IsItemChecked( nItemId ) ) - pChild->SetChecked( sal_True ); - if ( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ) - pChild->SetIndeterminate( true ); - m_aAccessibleChildren.insert( ToolBoxItemsMap::value_type( i, xChild ) ); - } - else - { - // found it - xChild = aIter->second; - } - return xChild; - } - - return NULL; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( const awt::Point& _rPoint ) throw (RuntimeException) -{ - comphelper::OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xAccessible; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - sal_uInt16 nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) ); - if ( nItemPos != TOOLBOX_ITEM_NOTFOUND ) - xAccessible = getAccessibleChild( nItemPos ); - } - - return xAccessible; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ) -{ - Reference< XAccessible > xReturn; - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pChildWindow && pToolBox ) - { - sal_uInt16 nCount = pToolBox->GetItemCount(); - for (sal_uInt16 i = 0 ; i < nCount && !xReturn.is() ; ++i) - { - sal_uInt16 nItemId = pToolBox->GetItemId( i ); - Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); - if ( pItemWindow == pChildWindow ) - xReturn = getAccessibleChild(i); - } - } - return xReturn; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > VCLXAccessibleToolBox::GetChildAccessible( const VclWindowEvent& rVclWindowEvent ) -{ - Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent); - - if ( !xReturn.is() ) - xReturn = VCLXAccessibleComponent::GetChildAccessible(rVclWindowEvent); - return xReturn; -} -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); - pToolBox->ChangeHighlight( nPos ); -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); - if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) ) - return sal_True; - else - return sal_False; -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::clearAccessibleSelection( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - pToolBox -> LoseFocus(); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - // intentionally empty. makes no sense for a toolbox -} -// ----------------------------------------------------------------------------- -sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - sal_Int32 nRet = 0; - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) ) - { - nRet = 1; - break; // a toolbox can only have (n)one selected child - } - } - return nRet; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = getAccessibleChild( i ); - break; - } - } - return xChild; -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - clearAccessibleSelection(); // a toolbox can only have (n)one selected child -} -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx deleted file mode 100644 index 49c603f15..000000000 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ /dev/null @@ -1,708 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_accessibility.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// class VCLXAccessibleToolBoxItem ------------------------------------------ - -using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star; -using namespace ::comphelper; - -DBG_NAME(VCLXAccessibleToolBoxItem) - -// ----------------------------------------------------------------------------- -// Ctor() and Dtor() -// ----------------------------------------------------------------------------- -VCLXAccessibleToolBoxItem::VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ) : - - AccessibleTextHelper_BASE( new VCLExternalSolarLock() ), - - m_pToolBox ( _pToolBox ), - m_nIndexInParent( _nPos ), - m_nRole ( AccessibleRole::PUSH_BUTTON ), - m_nItemId ( 0 ), - m_bHasFocus ( sal_False ), - m_bIsChecked ( sal_False ), - m_bIndeterminate( false ) - -{ - DBG_CTOR( VCLXAccessibleToolBoxItem, NULL ); - - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) ); - - DBG_ASSERT( m_pToolBox, "invalid toolbox" ); - m_nItemId = m_pToolBox->GetItemId( (sal_uInt16)m_nIndexInParent ); - m_sOldName = GetText( true ); - m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId ); - m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == STATE_DONTKNOW ); - ToolBoxItemType eType = m_pToolBox->GetItemType( (sal_uInt16)m_nIndexInParent ); - switch ( eType ) - { - case TOOLBOXITEM_BUTTON : - { - ToolBoxItemBits nBits = m_pToolBox->GetItemBits( m_nItemId ); - if (( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN) - m_nRole = AccessibleRole::BUTTON_DROPDOWN; - else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) || - ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) ) - m_nRole = AccessibleRole::TOGGLE_BUTTON; - else if ( m_pToolBox->GetItemWindow( m_nItemId ) ) - m_nRole = AccessibleRole::PANEL; - break; - } - - case TOOLBOXITEM_SPACE : - m_nRole = AccessibleRole::FILLER; - break; - - case TOOLBOXITEM_SEPARATOR : - case TOOLBOXITEM_BREAK : - m_nRole = AccessibleRole::SEPARATOR; - break; - - default: - { - DBG_ERRORFILE( "unsupported toolbox itemtype" ); - } - } -} -// ----------------------------------------------------------------------------- -VCLXAccessibleToolBoxItem::~VCLXAccessibleToolBoxItem() -{ - DBG_DTOR( VCLXAccessibleToolBoxItem, NULL ); - - delete m_pExternalLock; - m_pExternalLock = NULL; -} -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleToolBoxItem::GetText( bool _bAsName ) -{ - ::rtl::OUString sRet; - // no text for separators and spaces - if ( m_pToolBox && m_nItemId > 0 && ( _bAsName || m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) ) - { - sRet = m_pToolBox->GetItemText( m_nItemId ); - } - return sRet; -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::SetFocus( sal_Bool _bFocus ) -{ - if ( m_bHasFocus != _bFocus ) - { - Any aOldValue; - Any aNewValue; - if ( m_bHasFocus ) - aOldValue <<= AccessibleStateType::FOCUSED; - else - aNewValue <<= AccessibleStateType::FOCUSED; - m_bHasFocus = _bFocus; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::SetChecked( sal_Bool _bCheck ) -{ - if ( m_bIsChecked != _bCheck ) - { - Any aOldValue; - Any aNewValue; - if ( m_bIsChecked ) - aOldValue <<= AccessibleStateType::CHECKED; - else - aNewValue <<= AccessibleStateType::CHECKED; - m_bIsChecked = _bCheck; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::SetIndeterminate( bool _bIndeterminate ) -{ - if ( m_bIndeterminate != _bIndeterminate ) - { - Any aOldValue, aNewValue; - if ( m_bIndeterminate ) - aOldValue <<= AccessibleStateType::INDETERMINATE; - else - aNewValue <<= AccessibleStateType::INDETERMINATE; - m_bIndeterminate = _bIndeterminate; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::NameChanged() -{ - ::rtl::OUString sNewName = implGetText(); - if ( sNewName != m_sOldName ) - { - Any aOldValue, aNewValue; - aOldValue <<= m_sOldName; - // save new name as old name for next change - m_sOldName = sNewName; - aNewValue <<= m_sOldName; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::SetChild( const Reference< XAccessible >& _xChild ) -{ - m_xChild = _xChild; -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::NotifyChildEvent( const Reference< XAccessible >& _xChild, bool _bShow ) -{ - Any aOld = _bShow ? Any() : makeAny( _xChild ); - Any aNew = _bShow ? makeAny( _xChild ) : Any(); - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOld, aNew ); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::ToggleEnableState() -{ - Any aOldValue[2], aNewValue[2]; - if ( m_pToolBox->IsItemEnabled( m_nItemId ) ) - { - aNewValue[0] <<= AccessibleStateType::SENSITIVE; - aNewValue[1] <<= AccessibleStateType::ENABLED; - } - else - { - aOldValue[0] <<= AccessibleStateType::ENABLED; - aOldValue[1] <<= AccessibleStateType::SENSITIVE; - } - - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] ); - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] ); -} -// ----------------------------------------------------------------------------- -awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::implGetBounds( ) throw (RuntimeException) -{ - awt::Rectangle aRect; - if ( m_pToolBox ) - aRect = AWTRectangle( m_pToolBox->GetItemPosRect( (sal_uInt16)m_nIndexInParent ) ); - - return aRect; -} -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleToolBoxItem::implGetText() -{ - return GetText (true); -} -// ----------------------------------------------------------------------------- -Locale VCLXAccessibleToolBoxItem::implGetLocale() -{ - return Application::GetSettings().GetUILocale(); -} -// ----------------------------------------------------------------------------- -void VCLXAccessibleToolBoxItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) -{ - nStartIndex = 0; - nEndIndex = 0; -} -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_REFCOUNT( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE ) -Any SAL_CALL VCLXAccessibleToolBoxItem::queryInterface( const Type& _rType ) throw (RuntimeException) -{ - // #i33611# - toolbox buttons without text don't support XAccessibleText - if ( _rType == ::getCppuType( ( const Reference< XAccessibleText >* ) 0 ) - && ( !m_pToolBox || m_pToolBox->GetButtonType() == BUTTON_SYMBOL ) ) - return Any(); - - ::com::sun::star::uno::Any aReturn = AccessibleTextHelper_BASE::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = VCLXAccessibleToolBoxItem_BASE::queryInterface( _rType ); - return aReturn; -} -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE, VCLXAccessibleToolBoxItem_BASE ) -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleToolBoxItem::disposing() -{ - AccessibleTextHelper_BASE::disposing(); - m_pToolBox = NULL; -} -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleToolBoxItem::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleToolBoxItem" )); -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleToolBoxItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} -// ----------------------------------------------------------------------------- -Sequence< ::rtl::OUString > VCLXAccessibleToolBoxItem::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(4); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" )); - aNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleComponent" )); - aNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleExtendedComponent" )); - aNames[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleToolBoxItem" )); - return aNames; -} -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- -Reference< XAccessibleContext > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleContext( ) throw (RuntimeException) -{ - return this; -} -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChildCount( ) throw (RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - return m_xChild.is() ? 1 : 0; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChild( sal_Int32 i ) throw (RuntimeException, com::sun::star::lang::IndexOutOfBoundsException) -{ - OContextEntryGuard aGuard( this ); - - // no child -> so index is out of bounds - if ( !m_xChild.is() || i != 0 ) - throw IndexOutOfBoundsException(); - - return m_xChild; -} -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleParent( ) throw (RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - return m_pToolBox->GetAccessible(); -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - return m_nIndexInParent; -} -// ----------------------------------------------------------------------------- -sal_Int16 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRole( ) throw (RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - return m_nRole; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pToolBox ) - sDescription = m_pToolBox->GetHelpText( m_nItemId ); - - return sDescription; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - // entry text == accessible name - return GetText( true ); -} -// ----------------------------------------------------------------------------- -Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} -// ----------------------------------------------------------------------------- -Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xStateSet = pStateSetHelper; - - if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); - if ( m_bIsChecked ) - pStateSetHelper->AddState( AccessibleStateType::CHECKED ); - if ( m_bIndeterminate ) - pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE ); - if ( m_pToolBox->IsItemEnabled( m_nItemId ) ) - { - pStateSetHelper->AddState( AccessibleStateType::ENABLED ); - pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); - } - if ( m_pToolBox->IsItemVisible( m_nItemId ) ) - pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - if ( m_pToolBox->IsItemReallyVisible( m_nItemId ) ) - pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - if ( m_bHasFocus ) - pStateSetHelper->AddState( AccessibleStateType::FOCUSED ); - } - else - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - - return xStateSet; -} -// ----------------------------------------------------------------------------- -// XAccessibleText -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition() throw (RuntimeException) -{ - return -1; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} -// ----------------------------------------------------------------------------- -Sequence< PropertyValue > SAL_CALL VCLXAccessibleToolBoxItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - return Sequence< PropertyValue >(); -} -// ----------------------------------------------------------------------------- -awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText( implGetText() ); - - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); - - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds - { - Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex ); - Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = AWTRectangle( aCharRect ); - } - - return aBounds; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndex = -1; - if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds - { - sal_uInt16 nItemId = 0; - Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); - Point aPnt( VCLPoint( aPoint ) ); - aPnt += aItemRect.TopLeft(); - sal_Int32 nIdx = m_pToolBox->GetIndexForPoint( aPnt, nItemId ); - if ( nIdx != -1 && nItemId == m_nItemId ) - nIndex = nIdx; - } - - return nIndex; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - return sal_False; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); - - sal_Bool bReturn = sal_False; - - if ( m_pToolBox ) - { - Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pToolBox->GetClipboard(); - if ( xClipboard.is() ) - { - ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) ); - - ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pDataObj, NULL ); - - Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY ); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - - Application::AcquireSolarMutex( nRef ); - - bReturn = sal_True; - } - } - - return bReturn; -} -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- -Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) -{ - return Reference< XAccessible >(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL VCLXAccessibleToolBoxItem::grabFocus( ) throw (RuntimeException) -{ - Reference< XAccessible > xParent(getAccessibleParent()); - - if( xParent.is() ) - { - Reference< XAccessibleSelection > rxAccessibleSelection(xParent->getAccessibleContext(), UNO_QUERY); - - if ( rxAccessibleSelection.is() ) - { - rxAccessibleSelection -> selectAccessibleChild ( getAccessibleIndexInParent() ); - } - } -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pToolBox ) - nColor = m_pToolBox->GetControlForeground().GetColor(); - - return nColor; -} -// ----------------------------------------------------------------------------- -sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pToolBox ) - nColor = m_pToolBox->GetControlBackground().GetColor(); - - return nColor; -} -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- -Reference< awt::XFont > SAL_CALL VCLXAccessibleToolBoxItem::getFont( ) throw (RuntimeException) -{ - return uno::Reference< awt::XFont >(); -} -// ----------------------------------------------------------------------------- -awt::FontDescriptor SAL_CALL VCLXAccessibleToolBoxItem::getFontMetrics( const Reference< awt::XFont >& xFont ) throw (RuntimeException) -{ - return xFont->getFontDescriptor(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sRet; - if ( m_pToolBox ) - sRet = m_pToolBox->GetItemText( m_nItemId ); - - return sRet; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sRet; - if ( m_pToolBox ) - { - if ( Help::IsExtHelpEnabled() ) - sRet = m_pToolBox->GetHelpText( m_nItemId ); - else - sRet = m_pToolBox->GetQuickHelpText( m_nItemId ); - if ( !sRet.getLength() ) - // no help text set, so use item text - sRet = m_pToolBox->GetItemText( m_nItemId ); - } - return sRet; -} -// ----------------------------------------------------------------------------- -// XAccessibleAction -// ----------------------------------------------------------------------------- -sal_Int32 VCLXAccessibleToolBoxItem::getAccessibleActionCount( ) throw (RuntimeException) -{ - // only one action -> "Click" - return 1; -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - if ( m_pToolBox ) - m_pToolBox->TriggerItem( m_nItemId ); - - return sal_True; -} -// ----------------------------------------------------------------------------- -::rtl::OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) ); -} -// ----------------------------------------------------------------------------- -Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OContextEntryGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessibleKeyBinding >(); -} -// ----------------------------------------------------------------------------- -// XAccessibleValue -// ----------------------------------------------------------------------------- -Any VCLXAccessibleToolBoxItem::getCurrentValue( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Any aValue; - if ( m_pToolBox ) - aValue <<= (sal_Int32)m_pToolBox->IsItemChecked( m_nItemId ); - - return aValue; -} -// ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleToolBoxItem::setCurrentValue( const Any& aNumber ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Bool bReturn = sal_False; - - if ( m_pToolBox ) - { - sal_Int32 nValue = 0; - OSL_VERIFY( aNumber >>= nValue ); - - if ( nValue < 0 ) - nValue = 0; - else if ( nValue > 1 ) - nValue = 1; - - m_pToolBox->CheckItem( m_nItemId, (sal_Bool) nValue ); - bReturn = sal_True; - } - - return bReturn; -} -// ----------------------------------------------------------------------------- -Any VCLXAccessibleToolBoxItem::getMaximumValue( ) throw (RuntimeException) -{ - return makeAny((sal_Int32)1); -} -// ----------------------------------------------------------------------------- -Any VCLXAccessibleToolBoxItem::getMinimumValue( ) throw (RuntimeException) -{ - return makeAny((sal_Int32)0); -} -// ----------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/util/acc.map b/accessibility/util/acc.map deleted file mode 100644 index b9e53f414..000000000 --- a/accessibility/util/acc.map +++ /dev/null @@ -1,7 +0,0 @@ -UDK_3_0_0 { - global: - getStandardAccessibleFactory; - getSvtAccessibilityComponentFactory; - local: - *; -}; diff --git a/accessibility/util/makefile.mk b/accessibility/util/makefile.mk deleted file mode 100644 index b9f57a8a1..000000000 --- a/accessibility/util/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -PRJNAME=accessibility -TARGET=acc -USE_DEFFILE=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -LDUMP=ldump2.exe - -# --- Library ----------------------------------- -# --- acc --------------------------------------- -LIB1TARGET=$(SLB)$/$(PRJNAME).lib -LIB1FILES=\ - $(SLB)$/standard.lib \ - $(SLB)$/extended.lib \ - $(SLB)$/helper.lib - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(VCLLIB) \ - $(COMPHELPERLIB) \ - $(SOTLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(UNOTOOLSLIB) \ - $(TKLIB) \ - $(TOOLSLIB) \ - $(SVTOOLLIB) \ - $(SVLLIB) \ - $(SALLIB) - -SHL1LIBS=$(LIB1TARGET) -SHL1DEPN=$(LIB1TARGET) \ - makefile.mk - - -SHL1VERSIONMAP= $(TARGET).map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# === .res file ========================================================== - -RES1FILELIST=\ - $(SRS)$/helper.srs - -RESLIB1NAME=$(TARGET) -RESLIB1SRSFILES=$(RES1FILELIST) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/accessibility/workben/TODO b/accessibility/workben/TODO deleted file mode 100644 index 6fdfd5cb8..000000000 --- a/accessibility/workben/TODO +++ /dev/null @@ -1,13 +0,0 @@ -This is a unsorted list of TODO's and idea regarding the Accessibility Workbench - -* increase repaint performance -* fix paint problems in ObjectViewContainer for e.g. File menu -* change package structure to be flat (apps don't need deep package names) -* add ant build script(s) -* evaluate TreeTable as enhanced overview -* add error panel and a bunch of consistency checks -* add focus tracking mode -* evaluate drawing transparent frames at screen coordinates of an object -* enhance text view (colors) -* add table view -* more generic view loading (Class.forName()) diff --git a/accessibility/workben/makefile b/accessibility/workben/makefile deleted file mode 100644 index 4bd7c05e4..000000000 --- a/accessibility/workben/makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: - cd source/org/openoffice/accessibility ; $(MAKE) all - -ROOT=source -SUBDIRS=source/org/openoffice/accessibility -include source/makefile.in - -run: all - $(JAVA) -classpath $(CLASSPATH) org.openoffice.accessibility.awb.AccessibilityWorkBench diff --git a/accessibility/workben/makefile.in b/accessibility/workben/makefile.in deleted file mode 100644 index d81df5fb7..000000000 --- a/accessibility/workben/makefile.in +++ /dev/null @@ -1,31 +0,0 @@ -PRJ=$(ROOT)/.. -SETTINGS=$(OO_SDK_HOME)/settings -include $(SETTINGS)/settings.mk -include $(SETTINGS)/std.mk -include $(SETTINGS)/dk.mk - -OUT_COMP_JAVA = $(OUT_CLASS)/$(patsubst .,/,$(PACKAGE)) -JAVAC=$(JAVA_HOME)/bin/javac -JAVA=$(JAVA_HOME)/bin/java -CLASS_FILES = $(patsubst %.java, %.class, $(JAVAFILES)) -CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(OFFICE_CLASSES_DIR)/jurt.jar\ - $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/unoil.jar\ - $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/ridl.jar\ - $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/juh.jar\ - $(PATH_SEPARATOR)$(OUT_COMP_JAVA)\ - $(PATH_SEPARATOR).\ - $(PATH_SEPARATOR)$(ROOT)\ - ) - -subdirs: - $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE);cd ..;) - -clean: - -rm *.class *.jar - $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE) clean ; cd ..;) - - -%.class : %.java - $(JAVAC) -classpath $(CLASSPATH) $< - -.PHONY: all package clean subdirs diff --git a/accessibility/workben/makefile.mk b/accessibility/workben/makefile.mk deleted file mode 100644 index 7f19d8936..000000000 --- a/accessibility/workben/makefile.mk +++ /dev/null @@ -1,39 +0,0 @@ -# copied from settings.mk -SOLARBINDIR=$(SOLARVERSION)$/$(INPATH)$/bin$(UPDMINOREXT) - -# Please modify the following lines to match your environment: -# If you use the run: target at the end of the file, then adapt pipe name -PIPE_NAME = $(USER) - -# The following variables probably don't need to be changed. -JAVA = java -# The JAR_PATH points to the jar files of your local office installation. -JAR_PATH = $(SOLARBINDIR)$/ - - -# The rest of this makefile should not need to be touched. - -JAR_FILES = \ - unoil.jar \ - ridl.jar \ - jurt.jar \ - juh.jar \ - java_uno.jar - - -JAVA_CLASSPATHS := \ - ..$/$(INPATH)$/class \ - $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \ - $(CLASSPATH) - -CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR)) - -all: - build - -# Example of how to run the work bench. -run: - +$(JAVA) -classpath "$(CLASSPATH)" org/openoffice/accessibility/awb/AccessibilityWorkBench -p $(PIPE_NAME) - -runjar: - +$(JAVA) -classpath "$(CLASSPATH)" -jar AccessibilityWorkBench.jar -p $(PIPE_NAME) diff --git a/accessibility/workben/org/openoffice/accessibility/Makefile b/accessibility/workben/org/openoffice/accessibility/Makefile deleted file mode 100644 index a6db6a05a..000000000 --- a/accessibility/workben/org/openoffice/accessibility/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all : subdirs - -ROOT=../../../ -SUBDIRS=misc awb -include $(ROOT)/makefile.in - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java deleted file mode 100644 index fa4fd69d1..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java +++ /dev/null @@ -1,702 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb; - -import java.awt.Cursor; -import java.awt.GridBagConstraints; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButtonMenuItem; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.event.TreeSelectionListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeExpansionListener; -import javax.swing.event.TreeWillExpandListener; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XTerminateListener; -import com.sun.star.lang.EventObject; -import com.sun.star.uno.UnoRuntime; - -import org.openoffice.accessibility.misc.MessageArea; -import org.openoffice.accessibility.misc.Options; -import org.openoffice.accessibility.misc.OfficeConnection; -import org.openoffice.accessibility.misc.SimpleOffice; -import org.openoffice.accessibility.awb.canvas.Canvas; -import org.openoffice.accessibility.awb.tree.AccessibilityTree; -import org.openoffice.accessibility.awb.tree.AccessibilityModel; -import org.openoffice.accessibility.awb.tree.DynamicAccessibilityModel; -import org.openoffice.accessibility.awb.view.ObjectViewContainer; -import org.openoffice.accessibility.awb.view.ObjectViewContainerWindow; - - - -/** This class manages the GUI of the work bench. - @see AccessibilityTreeModel - for the implementation of the tree view on the left side which also - manages the registration of accessibility listeners. - @see Canvas - for the graphical view of the accessible objects. -*/ -public class AccessibilityWorkBench - extends JFrame - implements XTerminateListener, - ActionListener, - TreeSelectionListener -{ - public static final String msVersion = "v1.9"; - public String msOptionsFileName = ".AWBrc"; - - public static void main (String args[]) - { - String sPipeName = System.getenv( "USER" ); - - for (int i=0; i*"); - System.out.println ("options:"); - System.out.println (" -p name of the pipe to use to connect to OpenOffice.org."); - System.out.println (" Defaults to $USER."); - System.exit (0); - } - else if (args[i].equals ("-p")) - { - sPipeName = args[++i]; - } - } - - saWorkBench = new AccessibilityWorkBench (sPipeName); - } - - - - - /** Return the one instance of the AccessibilityWorkBench - @return - Returns null when the AccessibilityWorkBench could not be - created successfully. - */ - public static AccessibilityWorkBench Instance () - { - return saWorkBench; - } - - - - /** Create an accessibility work bench that listens at the specified - port to Office applications. - */ - private AccessibilityWorkBench (String sPipeName) - { - mbInitialized = false; - - OfficeConnection.SetPipeName (sPipeName); - Options.Instance().Load (msOptionsFileName); - Layout (); - - MessageArea.println (System.getProperty ("os.name") + " / " - + System.getProperty ("os.arch") + " / " - + System.getProperty ("os.version")); - MessageArea.println ("Using pipe name " + sPipeName); - - maTree.addTreeSelectionListener (this); - - addWindowListener (new WindowAdapter () - { public void windowClosing (WindowEvent e) {Quit();} } - ); - - OfficeConnection.Instance().AddConnectionListener (this); - Initialize (); - } - - - - - /** Create and arrange the widgets of the GUI. - */ - public void Layout () - { - setSize (new java.awt.Dimension (800,600)); - - JScrollPane aScrollPane; - GridBagConstraints constraints; - - // Create new layout. - java.awt.GridBagLayout aLayout = new java.awt.GridBagLayout (); - getContentPane().setLayout (aLayout); - - // Accessible Tree. - javax.swing.tree.TreeModel treeModel = new DynamicAccessibilityModel(); - maTree = new AccessibilityTree(treeModel); - // Add the model as tree listeners to be able to populate/clear the - // child lists on demand. - maTree.addTreeExpansionListener((TreeExpansionListener) treeModel); - maTree.addTreeWillExpandListener((TreeWillExpandListener) treeModel); - - JScrollPane aTreeScrollPane = new JScrollPane( - maTree, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - aTreeScrollPane.setPreferredSize (new java.awt.Dimension (400,300)); - - // Object view shows details about the currently selected accessible - // object. - maObjectViewContainer = new ObjectViewContainer (); - JScrollPane aObjectViewContainerScrollPane = new JScrollPane( - maObjectViewContainer, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - aObjectViewContainerScrollPane.setPreferredSize ( - new java.awt.Dimension (400,300)); - JButton aCornerButton = new JButton ("CreateNewViewWindow"); - aCornerButton.addActionListener (this); - aObjectViewContainerScrollPane.setCorner ( - JScrollPane.LOWER_RIGHT_CORNER, - aCornerButton); - - // Split pane for tree view and object view. - JSplitPane aLeftViewSplitPane = new JSplitPane ( - JSplitPane.VERTICAL_SPLIT, - aTreeScrollPane, - aObjectViewContainerScrollPane - ); - aLeftViewSplitPane.setDividerLocation (300); - aLeftViewSplitPane.setContinuousLayout (true); - - // Canvas. - maCanvas = new Canvas (); - maCanvas.SetTree (maTree); - JScrollPane aScrolledCanvas = new JScrollPane(maCanvas, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - aScrolledCanvas.getViewport().setBackground (java.awt.Color.RED); - aScrolledCanvas.setPreferredSize (new java.awt.Dimension(600,400)); - - // Split pane for tree view and canvas. - JSplitPane aViewSplitPane = new JSplitPane ( - JSplitPane.HORIZONTAL_SPLIT, - aLeftViewSplitPane, - aScrolledCanvas - ); - aViewSplitPane.setOneTouchExpandable(true); - aViewSplitPane.setDividerLocation (400); - aViewSplitPane.setContinuousLayout (true); - - // Split pane for the three views at the top and the message area. - MessageArea.Instance().setPreferredSize (new java.awt.Dimension(600,50)); - JSplitPane aSplitPane = new JSplitPane ( - JSplitPane.VERTICAL_SPLIT, - aViewSplitPane, - MessageArea.Instance()); - aSplitPane.setOneTouchExpandable(true); - aSplitPane.setContinuousLayout (true); - addGridElement (aSplitPane, 0,0, 2,1, 3,3, - GridBagConstraints.CENTER, GridBagConstraints.BOTH); - - // Button bar. - maButtonBar = new javax.swing.JPanel(); - java.awt.GridBagLayout aButtonLayout = new java.awt.GridBagLayout (); - maButtonBar.setLayout (new java.awt.FlowLayout()); - addGridElement (maButtonBar, 0,3, 2,1, 1,0, - GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL); - - // Buttons. - // maConnectButton = createButton ("Connect", "connect"); - // maUpdateButton = createButton ("Update", "update"); - // maShapesButton = createButton ("Expand Shapes", "shapes"); - maExpandButton = createButton ("Expand All", "expand"); - maQuitButton = createButton ("Quit", "quit"); - UpdateButtonStates (); - - setJMenuBar (CreateMenuBar ()); - - setTitle("Accessibility Workbench " + msVersion); - - setVisible (true); - pack (); - aSplitPane.setDividerLocation (1.0); - validate (); - repaint(); - } - - - - - /** Shortcut method for adding an object to a GridBagLayout. - */ - void addGridElement (JComponent object, - int x, int y, - int width, int height, - int weightx, int weighty, - int anchor, int fill) - { - GridBagConstraints constraints = new GridBagConstraints (); - constraints.gridx = x; - constraints.gridy = y; - constraints.gridwidth = width; - constraints.gridheight = height; - constraints.weightx = weightx; - constraints.weighty = weighty; - constraints.anchor = anchor; - constraints.fill = fill; - getContentPane().add (object, constraints); - } - - - - - /** Create a new button and place at the right most position into the - button bar. - */ - public JButton createButton (String title, String command) - { - JButton aButton = new JButton (title); - aButton.setEnabled (false); - aButton.setActionCommand (command); - aButton.addActionListener (this); - - maButtonBar.add (aButton); - return aButton; - } - - - - - /** Create a menu bar for the application. - @return - Returns the new menu bar. The returned reference is also - remembered in the data member maMenuBar. - */ - javax.swing.JMenuBar CreateMenuBar() - { - // Menu bar. - maMenuBar = new JMenuBar (); - - // File menu. - JMenu aFileMenu = new JMenu ("File"); - maMenuBar.add (aFileMenu); - JMenuItem aItem; - aItem = new JMenuItem ("Quit"); - aFileMenu.add (aItem); - aItem.addActionListener (this); - - // View menu. - JMenu aViewMenu = new JMenu ("View"); - maMenuBar.add (aViewMenu); - ButtonGroup aGroup = new ButtonGroup (); - int nZoomMode = Options.GetInteger ("ZoomMode", Canvas.WHOLE_SCREEN); - JRadioButtonMenuItem aRadioButton = new JRadioButtonMenuItem ( - "Whole Screen", nZoomMode==Canvas.WHOLE_SCREEN); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - aRadioButton = new JRadioButtonMenuItem ("200%", nZoomMode==200); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - aRadioButton = new JRadioButtonMenuItem ("100%", nZoomMode==100); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - aRadioButton = new JRadioButtonMenuItem ("50%", nZoomMode==50); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - aRadioButton = new JRadioButtonMenuItem ("25%", nZoomMode==25); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - aRadioButton = new JRadioButtonMenuItem ("10%", nZoomMode==10); - aGroup.add (aRadioButton); - aViewMenu.add (aRadioButton); - aRadioButton.addActionListener (this); - - // Options menu. - JMenu aOptionsMenu = new JMenu ("Options"); - maMenuBar.add (aOptionsMenu); - JCheckBoxMenuItem aCBItem; - aCBItem = new JCheckBoxMenuItem ("Show Descriptions", - Options.GetBoolean("ShowDescriptions")); - aOptionsMenu.add (aCBItem); - aCBItem.addActionListener (this); - - aCBItem = new JCheckBoxMenuItem ("Show Names", - Options.GetBoolean ("ShowNames")); - aOptionsMenu.add (aCBItem); - aCBItem.addActionListener (this); - - aCBItem = new JCheckBoxMenuItem ("Show Text", - Options.GetBoolean ("ShowText")); - aOptionsMenu.add (aCBItem); - aCBItem.addActionListener (this); - - aCBItem = new JCheckBoxMenuItem ("Antialiased Rendering", - Options.GetBoolean ("Antialiasing")); - aOptionsMenu.add (aCBItem); - aCBItem.addActionListener (this); - - // Help menu. - JMenu aHelpMenu = new JMenu ("Help"); - maMenuBar.add (aHelpMenu); - - aItem = new JMenuItem ("Help"); - aHelpMenu.add (aItem); - aItem.addActionListener (this); - - aItem = new JMenuItem ("News"); - aHelpMenu.add (aItem); - aItem.addActionListener (this); - - aItem = new JMenuItem ("About"); - aHelpMenu.add (aItem); - aItem.addActionListener (this); - - return maMenuBar; - } - - - - - /** Initialize the AWB. This includes clearing the canvas, add - listeners, creation of a new tree model for the tree list box and - the update of the button states. - - This method may be called any number of times. Note that all - actions will be carried out every time. The main purpose of a - second call is that of a re-initialization after a reconnect. - */ - protected void Initialize () - { - maCanvas.SetTree (maTree); - - SimpleOffice aOffice = SimpleOffice.Instance (); - if (aOffice != null) - { - // Add terminate listener. - if (aOffice.GetDesktop() != null) - aOffice.GetDesktop().addTerminateListener (this); - - } - - mbInitialized = true; - UpdateButtonStates (); - } - - - - - /** Update the states of the buttons according to the internal state of - the AWB. - */ - protected void UpdateButtonStates () - { - // maConnectButton.setEnabled (mbInitialized); - maQuitButton.setEnabled (true); - // maUpdateButton.setEnabled (mbInitialized); - maExpandButton.setEnabled (mbInitialized); - // maShapesButton.setEnabled (mbInitialized); - } - - - - /** Callback for GUI actions from the buttons. - */ - public void actionPerformed (ActionEvent aEvent) - { - String sCommand = aEvent.getActionCommand(); - if (sCommand.equals("connect")) - { - SimpleOffice.Clear(); - Initialize (); - } - else if (sCommand.equals("quit")) - { - Quit (); - } - else if (sCommand.equals("update")) - { -// maTree.Dispose(); - Initialize (); - } - else if (sCommand.equals("shapes")) - { - Cursor aCursor = getCursor(); - setCursor (new Cursor (Cursor.WAIT_CURSOR)); - // maTree.expandShapes(); - setCursor (aCursor); - } - else if (sCommand.equals("expand")) - { - Cursor aCursor = getCursor(); - setCursor (new Cursor (Cursor.WAIT_CURSOR)); - - for (int i=0; i")) - { - Connected (); - } - else if (sCommand.equals ("CreateNewViewWindow")) - { - TreePath aSelectionPath = maTree.getSelectionPath(); - if (aSelectionPath != null) - { - javax.swing.tree.TreeNode aSelectedNode = - (javax.swing.tree.TreeNode)aSelectionPath.getLastPathComponent(); - if (aSelectedNode instanceof XAccessible) { - new ObjectViewContainerWindow (((XAccessible) aSelectedNode).getAccessibleContext()); - } - } - } - else - { - System.err.println("unknown command " + sCommand); - } - } - - - - - /** TreeSelectionListener - Tell the object view and the canvas about the selected object. - */ - public void valueChanged (TreeSelectionEvent aEvent) { - - if (aEvent.isAddedPath()) { - Cursor aCursor = getCursor(); - setCursor (new Cursor (Cursor.WAIT_CURSOR)); - - javax.swing.tree.TreePath aPath = aEvent.getPath(); - maTree.scrollPathToVisible (aPath); - Object aObject = aPath.getLastPathComponent(); - implSetCurrentObject( aObject ); - if (aObject instanceof XAccessible) - { - if (maObjectViewContainer != null) - maObjectViewContainer.SetObject( ((XAccessible)aObject).getAccessibleContext() ); - } - if (maCanvas != null) - maCanvas.SelectObject ((TreeNode) aObject); - setCursor (aCursor); - } else { - implSetCurrentObject( aEvent.getPath().getLastPathComponent() ); - if (maObjectViewContainer != null) - maObjectViewContainer.SetObject (null); - if (maCanvas != null) - maCanvas.SelectObject (null); - } - } - - - private void implSetCurrentObject( Object i_object ) - { - if ( maObjectViewContainer == null ) - return; - if ( maCurrentObject != null ) - { - AccessibilityModel.removeEventListener( (TreeNode)maCurrentObject, maObjectViewContainer ); - } - maCurrentObject = i_object; - if ( maCurrentObject != null ) - { - AccessibilityModel.addEventListener( (TreeNode)maCurrentObject, maObjectViewContainer ); - } - } - - // XEventListener - public void disposing (EventObject aSourceObj) - { - XFrame xFrame = (XFrame)UnoRuntime.queryInterface( - XFrame.class, aSourceObj.Source); - - if( xFrame != null ) - System.out.println("frame disposed"); - else - System.out.println("controller disposed"); - } - - - - - // XTerminateListener - public void queryTermination(final EventObject aEvent) throws com.sun.star.frame.TerminationVetoException - { - System.out.println ("Terminate Event : " + aEvent); - } - - - - - // XTerminateListener - public void notifyTermination(final EventObject aEvent) - { - System.out.println ("Notifiy Termination Event : " + aEvent); - } - - - /** Called after the AWB is connected to an Office application. - */ - private void Connected () - { - // Clear the tree and by expanding the root node initiate the - // scanning and insertion of nodes for the top-level windows. -// maTree.Clear(); -// maTree.collapseRow (0); -// maTree.expandRow (0); - - // Register the top window listener. - XExtendedToolkit xToolkit = - SimpleOffice.Instance().GetExtendedToolkit(); - if (xToolkit != null) - { - maTree.setToolkit(xToolkit); - } - } - - - /** Called when shutting down the AWB tool. - */ - private void Quit () - { -// maTree.Dispose(); - System.exit (0); - } - - /// The Singleton Workbench object. - private static AccessibilityWorkBench - saWorkBench = null; - - private JPanel maMainPanel; - private JPanel maButtonBar; - private Canvas maCanvas; - private AccessibilityTree maTree; - private ObjectViewContainer maObjectViewContainer; - private JButton - maConnectButton, - maQuitButton, - maUpdateButton, - maExpandButton, - maShapesButton; - private JMenuBar maMenuBar; - private boolean mbInitialized; - private Object maCurrentObject = null; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java b/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java deleted file mode 100644 index c344812f8..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.openoffice.accessibility.awb; - -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.JEditorPane; -import javax.swing.JButton; -import java.net.URL; -import javax.swing.event.HyperlinkListener; -import javax.swing.event.HyperlinkEvent; -import java.net.MalformedURLException; -import java.io.IOException; -import java.io.File; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.event.ActionListener; -import java.util.LinkedList; - -public class HelpWindow - implements ActionListener -{ - public static synchronized HelpWindow Instance () - { - if (maInstance == null) - maInstance = new HelpWindow(); - return maInstance; - } - - public void loadFile (String sFilename) - { - File aFile = new File (sFilename); - try - { - loadURL (aFile.toURI().toURL()); - } - catch (MalformedURLException e) - { - e.printStackTrace (System.err); - } - } - public void loadURL (String sURL) - { - try - { - loadURL (new URL (sURL)); - } - catch (MalformedURLException e) - { - e.printStackTrace (System.err); - } - } - - - - - public void loadURL (URL aURL) - { - maHistory.addLast (aURL); - selectHistoryPage (maHistory.size()-1); - maFrame.toFront (); - } - - - - - private HelpWindow () - { - try - { - maCurrentHistoryEntry = -1; - maHistory = new LinkedList(); - - maFrame = new JFrame (); - maFrame.addWindowListener (new WindowAdapter () - { - public void windowClosing (WindowEvent e) - { - maInstance = null; - } - }); - maContent = createContentWidget(); - - maFrame.getContentPane().setLayout (new GridBagLayout()); - GridBagConstraints aConstraints = new GridBagConstraints (); - aConstraints.gridx = 0; - aConstraints.gridy = 0; - aConstraints.gridwidth = 3; - aConstraints.weightx = 1; - aConstraints.weighty = 1; - aConstraints.fill = GridBagConstraints.BOTH; - maFrame.getContentPane().add (new JScrollPane (maContent), aConstraints); - - aConstraints = new GridBagConstraints(); - aConstraints.gridx = 0; - aConstraints.gridy = 1; - maPrevButton = new JButton ("Prev"); - maFrame.getContentPane().add (maPrevButton, aConstraints); - maPrevButton.addActionListener (this); - - aConstraints = new GridBagConstraints(); - aConstraints.gridx = 1; - aConstraints.gridy = 1; - maNextButton = new JButton ("Next"); - maFrame.getContentPane().add (maNextButton, aConstraints); - maNextButton.addActionListener (this); - - aConstraints = new GridBagConstraints(); - aConstraints.gridx = 2; - aConstraints.gridy = 1; - aConstraints.anchor = GridBagConstraints.EAST; - JButton aButton = new JButton ("Close"); - maFrame.getContentPane().add (aButton, aConstraints); - aButton.addActionListener (this); - - maFrame.setSize (600,400); - maFrame.setVisible (true); - } - catch (Exception e) - {} - } - - public void actionPerformed (java.awt.event.ActionEvent e) - { - if (e.getActionCommand().equals("Prev")) - { - selectHistoryPage (maCurrentHistoryEntry - 1); - } - else if (e.getActionCommand().equals("Next")) - { - selectHistoryPage (maCurrentHistoryEntry + 1); - } - else if (e.getActionCommand().equals("Close")) - { - maFrame.dispose (); - maInstance = null; - } - } - - private JEditorPane createContentWidget () - { - JEditorPane aContent = new JEditorPane (); - aContent.setEditable (false); - aContent.addHyperlinkListener (new HyperlinkListener() - { - public void hyperlinkUpdate (HyperlinkEvent e) - { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) - HelpWindow.Instance().loadURL (e.getURL()); - } - }); - return aContent; - } - - private void selectHistoryPage (int i) - { - if (i < 0) - i = 0; - else if (i >= maHistory.size()-1) - i = maHistory.size()-1; - if (i != maCurrentHistoryEntry) - { - URL aURL = (URL)maHistory.get (i); - try - { - maContent.setPage (aURL); - } - catch (java.io.IOException ex) - { - ex.printStackTrace(System.err); - } - - maCurrentHistoryEntry = i; - } - - maPrevButton.setEnabled (maCurrentHistoryEntry > 0); - maNextButton.setEnabled (maCurrentHistoryEntry < maHistory.size()-1); - } - - private static HelpWindow maInstance = null; - private JFrame maFrame; - private JEditorPane maContent; - private LinkedList maHistory; - private int maCurrentHistoryEntry; - private JButton maPrevButton; - private JButton maNextButton; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/Makefile deleted file mode 100644 index 88a004ec2..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all : package - -ROOT=../../../.. -PACKAGE = org.openoffice.accessibility.awb -SUBDIRS = canvas event tree view - -include makefile.common - -include $(ROOT)/makefile.in - -package: subdirs $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java deleted file mode 100644 index 78855b5a3..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java +++ /dev/null @@ -1,322 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.canvas; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.RenderingHints; -import java.awt.Toolkit; -import java.awt.geom.Rectangle2D; -import java.util.Iterator; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.tree.TreePath; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleComponent; - -import org.openoffice.accessibility.misc.Options; - -/** This canvas displays accessible objects graphically. Each accessible - object with graphical representation is represented by an - CanvasShape object and has to be added by the - addAccessible member function. - -

The canvas listens to selection events of the associated JTree and - highlights the first selected node of that tree.

-*/ -public class Canvas - extends JPanel -{ - // This constant can be passed to SetZoomMode to always show the whole screen. - public static final int WHOLE_SCREEN = -1; - - public Canvas () - { - super (true); - maShapeList = new ShapeContainer (this); - maMouseObserver = new MouseObserver (this); - maTree = null; - mnHOffset = 0; - mnVOffset = 0; - mnScale = 1; - maLastWidgetSize = new Dimension (0,0); - } - - - - /** Tell the canvas which tree to use to highlight accessible - objects and to observe for changes in the tree structure. - */ - public void SetTree (javax.swing.JTree aTree) - { - if (aTree != maTree) - { - maTree = aTree; - maShapeList.SetTree (maTree); - maMouseObserver.SetTree (maTree); - } - } - - - - - private void Clear () - { - maShapeList.Clear(); - } - - - - - public Iterator GetShapeIterator () - { - return maShapeList.GetIterator(); - } - - - - - public void paintComponent (Graphics g) - { - synchronized (g) - { - super.paintComponent (g); - - Graphics2D g2 = (Graphics2D)g; - if (Options.GetBoolean("Antialiasing")) - g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - else - g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_OFF); - - setupTransformation (); - g2.translate (mnHOffset, mnVOffset); - g2.scale (mnScale, mnScale); - - // Draw the screen representation to give a hint of the location of the - // accessible object on the screen. - Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle2D.Double aScreen = new Rectangle2D.Double ( - 0, - 0, - aScreenSize.getWidth(), - aScreenSize.getHeight()); - // Fill the screen rectangle and draw a frame arround it to increase its visibility. - g2.setColor (new Color (250,240,230)); - g2.fill (aScreen); - g2.setColor (Color.BLACK); - g2.draw (aScreen); - - synchronized (maShapeList) - { - Iterator aShapeIterator = maShapeList.GetIterator(); - boolean bShowDescriptions = Options.GetBoolean ("ShowDescriptions"); - boolean bShowNames = Options.GetBoolean ("ShowNames"); - boolean bShowText = Options.GetBoolean ("ShowText"); - while (aShapeIterator.hasNext()) - { - CanvasShape aCanvasShape = - (CanvasShape)aShapeIterator.next(); - try - { - aCanvasShape.paint ( - g2, - bShowDescriptions, bShowNames, bShowText); - } - catch (Exception aException) - { - System.err.println ("caught exception while painting a shape:" - + aException); - aException.printStackTrace (System.err); - } - } - } - - // Paint highlighted frame around active object as the last thing. - if (maActiveObject != null) - maActiveObject.paint_highlight (g2); - } - } - - - - - /** Set up the transformation so that the graphical display can show a - centered representation of the whole screen. - */ - private void setupTransformation () - { - // Turn off scrollbars when showing the whole screen. Otherwise show them when needed. - JViewport aViewport = (JViewport)getParent(); - JScrollPane aScrollPane = (JScrollPane)aViewport.getParent(); - int nZoomMode = Options.GetInteger ("ZoomMode", WHOLE_SCREEN); - if (nZoomMode == WHOLE_SCREEN) - { - if (aScrollPane.getHorizontalScrollBarPolicy() - != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER) - aScrollPane.setHorizontalScrollBarPolicy ( - JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - if (aScrollPane.getVerticalScrollBarPolicy() - != JScrollPane.VERTICAL_SCROLLBAR_NEVER) - aScrollPane.setVerticalScrollBarPolicy ( - JScrollPane.VERTICAL_SCROLLBAR_NEVER); - } - else - { - if (aScrollPane.getHorizontalScrollBarPolicy() - != JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) - aScrollPane.setHorizontalScrollBarPolicy ( - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - if (aScrollPane.getVerticalScrollBarPolicy() - != JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED) - aScrollPane.setVerticalScrollBarPolicy ( - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - } - - Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension aWidgetSize = aViewport.getSize(); - { - if ((aScreenSize.getWidth() > 0) && (aScreenSize.getHeight() > 0)) - { - if (nZoomMode == WHOLE_SCREEN) - { - // Calculate the scales that would map the screen onto the - // widget in both of the coordinate axes and select the - // smaller - // of the two: it maps the screen onto the widget in both - // axes at the same time. - double nHScale = (aWidgetSize.getWidth() - 10) - / aScreenSize.getWidth(); - double nVScale = (aWidgetSize.getHeight() - 10) - / aScreenSize.getHeight(); - if (nHScale < nVScale) - mnScale = nHScale; - else - mnScale = nVScale; - } - else - { - mnScale = nZoomMode / 100.0; - } - - // Calculate offsets that center the scaled screen inside - // the widget. - mnHOffset = (aWidgetSize.getWidth() - - mnScale*aScreenSize.getWidth()) / 2.0; - mnVOffset = (aWidgetSize.getHeight() - - mnScale*aScreenSize.getHeight()) / 2.0; - if (mnHOffset < 0) - mnHOffset = 0; - if (mnVOffset < 0) - mnVOffset = 0; - - setPreferredSize (new Dimension ( - (int)(2*mnHOffset + mnScale * aScreenSize.getWidth()), - (int)(2*mnVOffset + mnScale * aScreenSize.getHeight()))); - revalidate (); - } - else - { - // In case of a degenerate (not yet initialized?) screen size - // use some meaningless default values. - mnScale = 1; - mnHOffset = 0; - mnVOffset = 0; - } - } - maLastWidgetSize = aWidgetSize; - } - - - - protected boolean HighlightObject (CanvasShape aNewActiveObject) - { - if (aNewActiveObject != maActiveObject) - { - if (maActiveObject != null) - maActiveObject.Highlight (false); - - maActiveObject = aNewActiveObject; - if (maActiveObject != null) - { - /* if (maTree != null) - { - TreePath aPath = new TreePath ( - maActiveObject.GetNode().GetPath()); - maTree.scrollPathToVisible (aPath); - maTree.setSelectionPath (aPath); - maTree.repaint (); - } - */ - maActiveObject.Highlight (true); - } - repaint (); - return true; - } - else - return false; - } - - - - - /** Called when the selection of the tree changes. Highlight the - corresponding graphical representation of the object. - */ - public void SelectObject (javax.swing.tree.TreeNode aNode) - { - CanvasShape aCanvasShape = maShapeList.Get (aNode); - HighlightObject (aCanvasShape); - } - - - - - private int - mnXAnchor, - mnYAnchor, - maResizeFlag; - private double - mnHOffset, - mnVOffset, - mnScale; - private CanvasShape maActiveObject; - private javax.swing.JTree maTree; - // The size of the widget at the last call of setupTransformation() - private Dimension maLastWidgetSize; - private ShapeContainer maShapeList; - private MouseObserver maMouseObserver; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java deleted file mode 100644 index 140590466..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java +++ /dev/null @@ -1,412 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.canvas; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.geom.Point2D; -import java.awt.geom.Rectangle2D; -import java.awt.geom.AffineTransform; -import java.awt.geom.NoninvertibleTransformException; - - -import com.sun.star.accessibility.*; -import com.sun.star.lang.EventObject; -import com.sun.star.uno.UnoRuntime; - - -class CanvasShape implements XAccessibleEventListener -{ - public final Color maHighlightColor = Color.red; - public final Color maSelectionColor = Color.green; - public final Color maFocusColor = Color.blue; - - public CanvasShape (javax.swing.tree.TreeNode aNode, Canvas aCanvas) - { - maNode = aNode; - msName = ""; - msDescription = ""; - maShape = new Rectangle2D.Double (-10,-10,10,10); - maPosition = new Point (-10,-10); - maSize = new Dimension (10,10); - maFgColor = java.awt.Color.black; - maBgColor = Color.blue; - mnRole = -1; - mbHighlighted = false; - mbSelected = false; - mbFocused = false; - maCanvas = aCanvas; - - Update (); - } - - - - - public javax.swing.tree.TreePath getNodePath (javax.swing.tree.TreeNode node) - { - javax.swing.tree.TreeNode parent = node.getParent(); - return (parent != null) ? - getNodePath(parent).pathByAddingChild(node) : - new javax.swing.tree.TreePath(node); - } - - public javax.swing.tree.TreePath getNodePath () - { - return getNodePath(maNode); - } - - - - /** Update the data obtained from the AccessibilityNode - object. - */ - public void Update () - { - if (maNode instanceof XAccessible) { - mxContext = ((XAccessible) maNode).getAccessibleContext(); - mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, mxContext); - } - - if (mxContext != null) - { - msName = mxContext.getAccessibleName(); - msDescription = mxContext.getAccessibleDescription(); - mnRole = mxContext.getAccessibleRole(); - - // Extract the selected and focused flag. - XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet (); - if (xStateSet != null) - { - mbSelected = xStateSet.contains (AccessibleStateType.SELECTED); - mbFocused = xStateSet.contains (AccessibleStateType.FOCUSED); - } - } - - UpdateGeometry (); - - if (mxComponent != null) - { - // Note: alpha values in office 0..255 have to be mapped to - // 255..0 in Java - Color aCol = new Color (mxComponent.getForeground(), true); - maFgColor = new Color (aCol.getRed (), - aCol.getGreen (), - aCol.getBlue (), - 0xff - aCol.getAlpha ()); - aCol = new Color (mxComponent.getBackground(), true); - maBgColor = new Color (aCol.getRed (), - aCol.getGreen (), - aCol.getBlue (), - 0xff - aCol.getAlpha ()); - } - } - - - - public void UpdateGeometry () - { - if (mxComponent != null) - { - com.sun.star.awt.Point aLocationOnScreen = - mxComponent.getLocationOnScreen(); - com.sun.star.awt.Size aSizeOnScreen = mxComponent.getSize(); - maPosition = new Point ( - aLocationOnScreen.X, - aLocationOnScreen.Y); - maSize = new Dimension ( - aSizeOnScreen.Width, - aSizeOnScreen.Height); - } - } - - - - /** Paint the object into the specified canvas. It is transformed - according to the specified offset and scale. - */ - public void paint ( - Graphics2D g, - boolean bShowDescription, - boolean bShowName, - boolean bShowText) - { - try{ - // Transform the object's position and size according to the - // specified offset and scale. - Point aLocation = new Point(); - maShape = new Rectangle2D.Double ( - maPosition.x, - maPosition.y, - maSize.width, - maSize.height); - maTransformation = g.getTransform(); - - // Fill the object's bounding box with its background color if it - // has no children. - if (mxContext.getAccessibleChildCount() == 0) - { - g.setColor (maBgColor); - g.fill (maShape); - } - - // Remove alpha channel from color before drawing the frame. - Color color = maFgColor; - if (maFgColor.getAlpha()<128) - color = new Color (maFgColor.getRed(), maFgColor.getGreen(), maFgColor.getBlue()); - g.setColor (color); - g.draw (maShape); - - if (mbFocused) - { - g.setColor (maFocusColor); - for (int x=0; x<=2; x++) - for (int y=0; y<=2; y++) - g.fill ( - new Rectangle2D.Double ( - maShape.x + x/2.0 * maShape.width-3, - maShape.y + y/2.0 * maShape.height-3, - 6, - 6)); - } - if (mbSelected) - { - g.setColor (maSelectionColor); - for (int x=0; x<=2; x++) - for (int y=0; y<=2; y++) - g.draw ( - new Rectangle2D.Double ( - maShape.x + x/2.0 * maShape.width-2, - maShape.y + y/2.0 * maShape.height-2, - 4, - 4)); - } - - // Write the object's text OR name and description. - g.setColor (maFgColor); - if (bShowName) - paintName (g); - if (bShowDescription) - paintDescription (g); - if (bShowText) - paintText (g); - } - catch (Exception e) - { // don't care - } - } - - - public void paint_highlight (Graphics2D g) - { - if (mbHighlighted) - g.setColor (maHighlightColor); - else - g.setColor (maFgColor); - g.draw (maShape); - } - - - - - private void paintName (Graphics2D g) - { - g.drawString ("Name: " + msName, - (float)maShape.x+5, - (float)maShape.y+15); - } - - - - private void paintDescription (Graphics2D g) - { - g.drawString ("Description: " + msDescription, - (float)maShape.x+5, - (float)maShape.y+35); - } - - - - - private void paintText (Graphics2D g) - { - XAccessibleText xText = null; - // get XAccessibleText - xText = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, mxContext); - - // Draw every character in the text string. - if (xText != null) - { - String sText = xText.getText(); - try - { - for(int i = 0; i < sText.length(); i++) - { - com.sun.star.awt.Rectangle aRect = - xText.getCharacterBounds(i); - - double x = maShape.x + aRect.X; - double y = maShape.y + aRect.Y + aRect.Height; - - g.drawString (sText.substring(i, i+1), (float)x, (float)y); - } - } - catch (com.sun.star.lang.IndexOutOfBoundsException e) - {} - } - } - - - /** Compute whether the specified point lies inside the object's - bounding box. - */ - public boolean Contains (int x, int y) - { - Point2D aPosition = new Point2D.Double (x,y); - try - { - maTransformation.inverseTransform (aPosition, aPosition); - // System.out.println ("transformed "+x+","+y+" to "+aPosition); - } - catch (NoninvertibleTransformException aException) - { - return false; - } - return (maShape.contains (aPosition)); - } - - public void Highlight (boolean bFlag) - { - mbHighlighted = bFlag; - } - - public boolean IsHighlighted () - { - return mbHighlighted; - } - - public Rectangle GetBBox () - { - return new Rectangle (maPosition, maSize); - } - - public Point getOrigin () - { - return maPosition; - } - - public Dimension GetSize () - { - return maSize; - } - - public int getRole () - { - return mnRole; - } - - public XAccessibleContext getContext () - { - return mxContext; - } - - public XAccessibleComponent getComponent () - { - return mxComponent; - } - - public String toString () - { - return ">"+msName+", "+msDescription+" +"+maPosition.x+"+"+maPosition.y - +"x"+maSize.width+"x"+maSize.height+"<"; - } - - /** */ - public void notifyEvent(com.sun.star.accessibility.AccessibleEventObject aEvent) { - try { - switch (aEvent.EventId) { - case AccessibleEventId.BOUNDRECT_CHANGED: - case AccessibleEventId.VISIBLE_DATA_CHANGED: - UpdateGeometry (); - maCanvas.repaint(); - break; - default: - break; - } - } catch (Exception aException) { - System.err.println ("caught exception while updating a shape:" - + aException); - aException.printStackTrace (System.err); - } - } - - /** Callback for disposing events. - */ - public void disposing (com.sun.star.lang.EventObject e) - { - System.out.println ("Disposing"); - } - - - - - private Canvas - maCanvas; - private javax.swing.tree.TreeNode - maNode; - private XAccessibleContext - mxContext; - private XAccessibleComponent - mxComponent; - private String - msDescription, - msName; - private Rectangle2D.Double maShape; - private AffineTransform maTransformation; - private Point maPosition; - private Dimension - maTransformedSize, - maSize; - private Color - maFgColor, - maBgColor; - private boolean - // Highlighting objects is an internal concept. Corresponds to selection in the tree view. - mbHighlighted, - // Set when the accessible object is selected. - mbSelected, - // Set when the accessible object is focused. - mbFocused; - private int - mnRole; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile deleted file mode 100644 index 078ac7ee4..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all : package - -ROOT=../../../../.. -PACKAGE = org.openoffice.accessibility.awb.canvas -SUBDIRS = -include makefile.common - -include $(ROOT)/makefile.in - - -package : $(CLASS_FILES) - - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java deleted file mode 100644 index c2468ec38..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.openoffice.accessibility.awb.canvas; - -import java.awt.Dimension; -import java.awt.event.InputEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.util.Iterator; -import javax.swing.tree.TreePath; - - -/** Observe the mouse and highlight shapes of the canvas when clicked. -*/ -public class MouseObserver - implements MouseListener, - MouseMotionListener -{ - public MouseObserver (Canvas aCanvas) - { - maCanvas = aCanvas; - maCanvas.addMouseListener (this); - maCanvas.addMouseMotionListener (this); - } - - - public void SetTree (javax.swing.JTree aTree) - { - maTree = aTree; - } - - public void mouseClicked (MouseEvent e) - {} - - public void mousePressed (MouseEvent e) - { - CanvasShape aObjectUnderMouse = FindCanvasShapeUnderMouse (e); - maTree.clearSelection(); - if (aObjectUnderMouse != null) - { - TreePath aPath = aObjectUnderMouse.getNodePath(); - if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) - maTree.expandPath (aPath); - // Selecting the entry will eventually highlight the shape. - maTree.setSelectionPath (aPath); - maTree.makeVisible (aPath); - } - } - - public void mouseReleased (MouseEvent e) - {} - - public void mouseEntered (MouseEvent e) - {} - - public void mouseExited (MouseEvent e) - {} - - public void mouseDragged (MouseEvent e) - { - } - - public void mouseMoved (MouseEvent e) - { - if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0) - maCanvas.HighlightObject (FindCanvasShapeUnderMouse (e)); - } - - - /** Search for the smallest shape that contains the mouse position. - */ - protected CanvasShape FindCanvasShapeUnderMouse (MouseEvent e) - { - Dimension aSmallestSize = null; - Iterator maShapeIterator = maCanvas.GetShapeIterator(); - CanvasShape aShapeUnderMouse = null; - while (maShapeIterator.hasNext()) - { - CanvasShape aShape = (CanvasShape)maShapeIterator.next(); - if (aShape != null) - if (aShape.Contains (e.getX(),e.getY())) - { - if (aShapeUnderMouse == null) - { - aSmallestSize = aShape.GetSize(); - aShapeUnderMouse = aShape; - } - else - { - Dimension aSize = aShape.GetSize(); - if (aSize.getWidth() - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.canvas; - -import java.awt.Rectangle; -import java.util.Iterator; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeExpansionListener; -import javax.swing.event.TreeWillExpandListener; -import javax.swing.event.TreeExpansionEvent; -import javax.swing.event.TreeModelEvent; -import javax.swing.tree.TreeNode; - -import com.sun.star.accessibility.XAccessibleEventBroadcaster; - -/** Each canvas has a shape container that is responsible for maintaining - a collection of shapes that are displayed by the canvas. -*/ -public class ShapeContainer - implements TreeModelListener, - TreeExpansionListener, - TreeWillExpandListener -{ - public ShapeContainer (Canvas aCanvas) - { - maShapeList = new java.util.Hashtable(); - maBoundingBox = new Rectangle (0,0,100,100); - maCanvas = aCanvas; - maTree = null; - } - - - - - public synchronized void SetTree (javax.swing.JTree aTree) - { - if (aTree != maTree) - { - if (maTree != null) - { - maTree.getModel().removeTreeModelListener (this); - maTree.removeTreeExpansionListener (this); - maTree.removeTreeWillExpandListener (this); - } - - Clear(); - - maTree = aTree; - - maTree.getModel().addTreeModelListener (this); - maTree.addTreeExpansionListener (this); - maTree.addTreeWillExpandListener (this); - } - } - - - - - public synchronized boolean AddNode (TreeNode aNode) - { - CanvasShape aShape = (CanvasShape)maShapeList.get (aNode); - if (aShape == null) - { - aShape = new CanvasShape (aNode, maCanvas); - - if (aNode instanceof XAccessibleEventBroadcaster) - ((XAccessibleEventBroadcaster) aNode).addEventListener(aShape); - - // Update bounding box that includes all objects. - if (maShapeList.size() == 0) - maBoundingBox = aShape.GetBBox(); - else - maBoundingBox = maBoundingBox.union (aShape.GetBBox()); - - maShapeList.put (aNode, aShape); - - maCanvas.repaint(); - - return true; - } - else - return false; - } - - - /** - */ - public synchronized boolean RemoveNode (TreeNode aNode) - { - CanvasShape aShape = (CanvasShape)maShapeList.get (aNode); - if (aShape != null) - { - if (aNode instanceof XAccessibleEventBroadcaster) - ((XAccessibleEventBroadcaster) aNode).removeEventListener(aShape); - - maShapeList.remove (aNode); - maCanvas.SelectObject (null); - maCanvas.repaint (); - return true; - } - else - return false; - } - - - - - public synchronized void Clear () - { - maShapeList.clear (); - } - - - - - public Iterator GetIterator () - { - return maShapeList.values().iterator (); - } - - - - - public CanvasShape Get (TreeNode aNode) - { - if (aNode != null) { - return (CanvasShape)maShapeList.get (aNode); - } - return null; - } - - - private void PrintMessage (String aMessage, java.util.EventObject aEvent) - { - // System.out.println ("ShapeContainer: " + aMessage + ": " + aEvent); - } - - public void treeNodesChanged (TreeModelEvent aEvent) - { - PrintMessage ("treeNodesChanged", aEvent); - } - public void treeNodesInserted (TreeModelEvent aEvent) - { - PrintMessage ("treeNodesInserted", aEvent); - Object[] aNewNodes = aEvent.getChildren(); - for (int i=0; i -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - CanvasShape.java \ - Canvas.java \ - MouseObserver.java \ - ShapeContainer.java - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk deleted file mode 100644 index d2feccfb8..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/..$/.. -TARGET = awb_canvas -PACKAGE = org$/openoffice$/accessibility$/awb$/canvas - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" -.INCLUDE : makefile.common -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility/awb -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common deleted file mode 100644 index 0bf38a0fa..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/makefile.common +++ /dev/null @@ -1,30 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JAVAFILES = \ - AccessibilityWorkBench.java \ - HelpWindow.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk deleted file mode 100644 index a07d631d6..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/.. -TARGET = java_awb -PACKAGE = org$/openoffice$/accessibility$/awb - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" -JARFILES = jurt.jar unoil.jar ridl.jar - -.INCLUDE : makefile.common - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -JARCLASSDIRS = $(PACKAGE) \ - org$/openoffice$/accessibility$/misc -CUSTOMMANIFESTFILE = manifest -.ENDIF - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/manifest b/accessibility/workben/org/openoffice/accessibility/awb/manifest deleted file mode 100644 index 36111c540..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/manifest +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: org.openoffice.accessibility.awb.AccessibilityWorkBench -Class-Path: classes.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar xt.jar jaxp.jar diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java deleted file mode 100644 index fa9afae92..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import javax.swing.SwingUtilities; -import javax.swing.tree.TreeNode; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.DefaultMutableTreeNode; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.awt.XTopWindow; -import com.sun.star.awt.XTopWindowListener; -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEventBroadcaster; -import com.sun.star.accessibility.XAccessibleEventListener; - -/** - * - */ -public abstract class AccessibilityModel extends javax.swing.tree.DefaultTreeModel { - - protected java.util.Hashtable nodeList; - protected static DefaultMutableTreeNode disconnectedRootNode = - new DefaultMutableTreeNode(""); - - /** Creates a new instance of AccessibilityModel */ - public AccessibilityModel() { - super(disconnectedRootNode, false); - nodeList = new java.util.Hashtable(); - } - - /* Convenience method that creates a new Toolkit node from xToolkit - * and sets as the new root object of the tree. - */ - public synchronized void setRoot(XExtendedToolkit xToolkit) { - if (xToolkit != null) { - try { - // remove old root node as topwindow listener - if (getRoot() instanceof ToolkitNode) { - ToolkitNode tn = (ToolkitNode) getRoot(); - if (tn.xToolkit != null) { - tn.xToolkit.removeTopWindowListener(tn); - } - } - nodeList.clear(); - setRoot(new ToolkitNode(xToolkit, this)); - xToolkit.addTopWindowListener((ToolkitNode) getRoot()); - } catch (com.sun.star.uno.RuntimeException e) { - // FIXME: error message ! - } - } - } - - /* Appends the new child to parent's child list */ - public void addNodeInto(MutableTreeNode newChild, MutableTreeNode parent) { - int index = parent.getChildCount(); - if (newChild != null && newChild.getParent() == parent) { - index -= 1; - } - insertNodeInto(newChild, parent, index); - } - - /** Adds listener to the listener chain of node */ - public static void addEventListener(TreeNode node, XAccessibleEventListener listener) { - if (node instanceof AccessibilityNode) { - ((AccessibilityNode) node).addEventListener(listener); - } - } - - /** Removes listener from the listener chain of node */ - public static void removeEventListener(TreeNode node, XAccessibleEventListener listener) { - if (node instanceof AccessibilityNode) { - ((AccessibilityNode) node).removeEventListener(listener); - } - } - - protected abstract AccessibilityNode createWindowNode(XAccessible xAccessible, - XAccessibleContext xAccessibleContext); - protected abstract AccessibilityNode createNode(XAccessible xAccessible); - - /** Adds xAccessible,node to the internal hashtable */ - public AccessibilityNode putNode(XAccessible xAccessible, AccessibilityNode node) { - if (xAccessible != null) { - String oid = UnoRuntime.generateOid(xAccessible); - java.lang.ref.WeakReference ref = (java.lang.ref.WeakReference) - nodeList.put(oid, new java.lang.ref.WeakReference(node)); - if (ref != null) { - return (AccessibilityNode) ref.get(); - } - } - return null; - } - - /** Returns the AccessibilityNode for xAccessible */ - public AccessibilityNode findNode(XAccessible xAccessible) { - if (xAccessible != null) { - String oid = UnoRuntime.generateOid(xAccessible); - java.lang.ref.WeakReference ref = - (java.lang.ref.WeakReference) nodeList.get(oid); - if (ref != null) { - return (AccessibilityNode) ref.get(); - } - } - return null; - } - - /** Removes the AccessibilityNode for xAccessible from the internal hashtable */ - public AccessibilityNode removeNode(XAccessible xAccessible) { - if (xAccessible != null) { - String oid = UnoRuntime.generateOid(xAccessible); - java.lang.ref.WeakReference ref = - (java.lang.ref.WeakReference) nodeList.remove(oid); - if (ref != null) { - return (AccessibilityNode) ref.get(); - } - } - return null; - } - - public AccessibilityNode removeNode(Object o) { - if (o instanceof XAccessible) { - return removeNode((XAccessible) o); - } - return null; - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java deleted file mode 100644 index 4ca87d616..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import org.openoffice.accessibility.misc.AccessibleEventMulticaster; - -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.SwingUtilities; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEventBroadcaster; -import com.sun.star.accessibility.XAccessibleEventListener; - -import com.sun.star.uno.UnoRuntime; - -class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible, - XAccessibleEventListener, XAccessibleEventBroadcaster { - - protected AccessibilityModel treeModel; - protected XAccessibleContext unoAccessibleContext; - - private XAccessibleEventListener listener; - - public AccessibilityNode(AccessibilityModel treeModel) { - this.treeModel = treeModel; - } - - protected void finalize() throws java.lang.Throwable { - if (userObject != null) { - treeModel.removeNode(userObject); - } - } - - /** Sets the XAccessibleContext object of this node */ - public void setAccessibleContext(XAccessibleContext xAccessibleContext) { - unoAccessibleContext = xAccessibleContext; - } - - /** Returns the XAccessibleContext object of this node */ - public XAccessibleContext getAccessibleContext() { - return unoAccessibleContext; - } - - /** Attaches or Detaches the itself as listener to unoAccessibleContext */ - protected void setAttached(boolean attach) { - XAccessibleContext xAccessibleContext = unoAccessibleContext; - if (xAccessibleContext != null) { - try { - XAccessibleEventBroadcaster xAccessibleEventBroadcaster = - UnoRuntime.queryInterface( XAccessibleEventBroadcaster.class, xAccessibleContext ); - if (xAccessibleEventBroadcaster != null) { - if (attach) { - xAccessibleEventBroadcaster.addEventListener(this); - } else { - xAccessibleEventBroadcaster.removeEventListener(this); - } - } - } catch (com.sun.star.uno.RuntimeException e) { - // FIXME: error message ! - } - } - } - - public void disposing(com.sun.star.lang.EventObject eventObject) { - XAccessibleEventListener localListener = this.listener; - if (localListener != null) { - localListener.disposing(eventObject); - } - - treeModel.removeNode(userObject); - userObject = null; - unoAccessibleContext = null; - // FIXME: mark the object as being disposed in the tree view ! - } - - protected void handleChildRemoved(XAccessible xAccessible) { - final AccessibilityNode node = treeModel.findNode(xAccessible); - if (node != null) { - SwingUtilities.invokeLater(new java.lang.Runnable() { - public void run() { - treeModel.removeNodeFromParent(node); - } - }); - } - } - - protected void handleChildAdded(XAccessible xAccessible) { - final AccessibilityNode parent = this; - final AccessibilityNode node = treeModel.createNode(xAccessible); - if (node != null) { - SwingUtilities.invokeLater(new java.lang.Runnable() { - public void run() { - try { - XAccessibleContext xAC = node.getAccessibleContext(); - if (xAC != null) { - treeModel.insertNodeInto(node, parent, - xAC.getAccessibleIndexInParent()); - } - } catch (com.sun.star.uno.RuntimeException e) { - // FIXME: output - } - } - }); - } - } - - public void notifyEvent(AccessibleEventObject accessibleEventObject) { - if (accessibleEventObject.EventId == AccessibleEventId.CHILD) { - XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.OldValue ); - if (xAccessible != null) { - handleChildRemoved(xAccessible); - } - - xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.NewValue ); - if (xAccessible != null) { - handleChildAdded(xAccessible); - } - } - - XAccessibleEventListener localListener = this.listener; - if (localListener != null) { - localListener.notifyEvent(accessibleEventObject); - } - } - - public synchronized void addEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) { - listener = AccessibleEventMulticaster.add(listener, xAccessibleEventListener); - } - - public synchronized void removeEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) { - listener = AccessibleEventMulticaster.remove(listener, xAccessibleEventListener); - } -} - - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java deleted file mode 100644 index 59257702c..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import org.openoffice.accessibility.misc.NameProvider; - -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.DefaultMutableTreeNode; - -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; - -/** - * - */ -public class AccessibilityTree extends javax.swing.JTree { - - /** Creates a new instance of AccessibilityTree */ - public AccessibilityTree(javax.swing.tree.TreeModel model) { - super(model); - // always show handles to indicate expandable / collapsable - showsRootHandles = true; - } - - public void setToolkit(XExtendedToolkit xToolkit) { - AccessibilityModel model = (AccessibilityModel) getModel(); - if (model != null) { - // hide the root node when connected - setRootVisible(xToolkit == null); - // update the root node - model.setRoot(xToolkit); - model.reload(); - } - } - - public String convertValueToText(Object value, boolean selected, - boolean expanded, boolean leaf, int row, boolean hasFocus) { - - if (value instanceof DefaultMutableTreeNode) { - DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; - - Object userObject = node.getUserObject(); - if (userObject != null && userObject instanceof XAccessible) { - XAccessible xAccessible = (XAccessible) userObject; - try { - XAccessibleContext xAC = xAccessible.getAccessibleContext(); - if (xAC != null) { - String name = xAC.getAccessibleName(); - if (name.length() == 0) { - name = new String (""); - } - value = name + " / " + NameProvider.getRoleName(xAC.getAccessibleRole()); - } - } catch (com.sun.star.uno.RuntimeException e) { - value = "???"; - } - } - } - - return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus); - } - -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java deleted file mode 100644 index ad59cf8c9..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.lang.DisposedException; -import com.sun.star.lang.IndexOutOfBoundsException; - -import org.openoffice.accessibility.misc.OfficeConnection; -import org.openoffice.accessibility.awb.event.EventQueue; - -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeNode; - - -public class AccessibilityTreeModel - extends DefaultTreeModel -{ - public AccessibilityTreeModel () - { - super (null); - setAsksAllowsChildren (false); - - SetRootNode(); - } - - - - /** Release all resources. - */ - synchronized public void Dispose () - { - Clear (); - } - - - - /** Calls to this method are dispatched to the given node but are - observed for exceptions. - */ - synchronized public boolean isLeaf (Object aObject) - { - boolean bIsLeaf = true; - - if (aObject != null) - { - AccessibilityNode aNode = (AccessibilityNode)aObject; - try - { - bIsLeaf = aNode.isLeaf(); - } - catch (DisposedException aException) - { - System.out.println ("node is disposed. removing it"); - /* TreeNode aParent = aNode.GetParent(); - int nIndexInParent = aParent.getIndex (aNode); - aNode.removeFromParent (); - System.out.println ("" + aParent + " # " + aNode + " # "+ nIndexInParent); - nodesWereRemoved ( - aParent, new int[]{nIndexInParent}, new - Object[]{aNode}); - */ - } - catch (Exception aException) - { - System.err.println ("caught exception in AccessibilityTreeModel.isLeaf():" - + aException); - aException.printStackTrace (System.err); - } - } - - return bIsLeaf; - } - - - - - synchronized public int getChildCount (Object aObject) - { - AccessibilityNode aNode = (AccessibilityNode)aObject; - return aNode.getChildCount(); - } - - - - - /** Return the requested child of aParent. If that child is not yet - known to the parent then try to create it. - */ - synchronized public Object getChild (Object aParent, final int nIndex) - { - AccessibilityNode aChild = null; - - final AccessibilityNode aParentNode = (AccessibilityNode)aParent; - - // Try to get an existing child from the super class object. - aChild = aParentNode.GetChildNoCreate (nIndex); - - // When the requested child does not yet exist and this node is not a - // special node then create a new node. - if (aChild == null) - { - aChild = aParentNode.CreateChild (nIndex); - aParentNode.SetChild ((AccessibilityNode)aChild, nIndex); - /* EventQueue.Instance().AddEvent (new Runnable() { public void run() { - AccessibilityTreeModel.this.nodeWasInserted ( - aParentNode, nIndex); - }}); - */ } - - return aChild; - } - - - synchronized public void nodeWasInserted (AccessibilityNode aParent, int nIndex) - { - nodesWereInserted (aParent, new int[]{nIndex}); - nodeStructureChanged (aParent); - - } - - - - - /** Clear the tree so that afterwards it has only the root node. - */ - public void Clear () - { - AccessibilityNode aRoot = (AccessibilityNode)getRoot(); - aRoot.RemoveAllChildren(); - SetRootNode(); - nodeStructureChanged (aRoot); - } - - - - - private void SetRootNode () - { - OfficeConnection aConnection = OfficeConnection.Instance(); - AccessibilityNode aRoot; - if (aConnection!=null && aConnection.IsValid()) - aRoot = new AccessibilityNode (""); - else - aRoot = new AccessibilityNode (""); - setRoot (aRoot); - } - - - - - /** Add a new child to the root node. - */ - public synchronized void AddTopLevelNode (AccessibilityNode aNode) - { - if (aNode != null) - { - if ( ! OfficeConnection.Instance().IsValid()) - { - setRoot (null); - } - - AccessibilityNode aRoot = (AccessibilityNode)getRoot(); - if (aRoot == null) - { - aRoot = new AccessibilityNode (""); - setRoot (aRoot); - } - - aNode.SetParent (aRoot); - aRoot.Append (aNode); - nodesWereInserted (aRoot, new int[]{aRoot.getIndex (aNode)}); - } - } - - - - - /** Remove a node that is a direct child of the root. - */ - public synchronized void RemoveTopLevelNode (AccessibilityNode aNode) - { - AccessibilityNode aRoot = (AccessibilityNode)getRoot(); - if (aRoot != null) - { - int nIndex = aRoot.getIndex (aNode); - aRoot.Remove (aNode); - nodesWereRemoved (aRoot, new int[]{nIndex}, new Object[]{aNode}); - } - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java deleted file mode 100644 index a0037ba69..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import javax.swing.tree.TreeNode; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.event.TreeExpansionListener; -import javax.swing.event.TreeWillExpandListener; - -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; - -/** - * - */ -public class DynamicAccessibilityModel extends AccessibilityModel implements TreeExpansionListener, TreeWillExpandListener { - - /* Creates a AccessibilityNode object for a window */ - protected AccessibilityNode createWindowNode(XAccessible xAccessible, - XAccessibleContext xAccessibleContext) { - if (xAccessible != null) { - // Some objects inherit XAccessible, but should not appear in - // the hierarchy as toplevels (like sub-menus), so they don't - // return an accessible context. - if (xAccessibleContext != null) { - AccessibilityNode node = new AccessibilityNode(this); - node.setUserObject(xAccessible); - node.setAccessibleContext(xAccessibleContext); - putNode(xAccessible, node); - return node; - } - } - return null; - } - - /* Creates a DynamicAccessibilityNode object */ - protected AccessibilityNode createNode(XAccessible xAccessible) { - if (xAccessible != null) { - try { - // Some objects inherit XAccessible, but should not appear in - // the hierarchy as toplevels (like sub-menus), so they don't - // return an accessible context. - XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext(); - if (xAccessibleContext != null) { - AccessibilityNode node = new DynamicAccessibilityNode(this); - node.setUserObject(xAccessible); - node.setAccessibleContext(xAccessibleContext); - putNode(xAccessible, node); - return node; - } - } catch (com.sun.star.uno.RuntimeException e) { - } - } - return null; - } - - public void treeCollapsed(javax.swing.event.TreeExpansionEvent treeExpansionEvent) { - TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); - if (node instanceof DynamicAccessibilityNode) { - DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node; - dynode.clear(); - } - } - - public void treeExpanded(javax.swing.event.TreeExpansionEvent treeExpansionEvent) { - TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); - if (node instanceof AccessibilityNode) { - // Calling oneway methods from an UNO thread may cause - // deadlocks, so adding the listeners here. - for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) { - ((AccessibilityNode) e.nextElement()).setAttached(true); - } - } - } - - public void treeWillCollapse(javax.swing.event.TreeExpansionEvent treeExpansionEvent) - throws javax.swing.tree.ExpandVetoException { - TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); - if (node instanceof AccessibilityNode) { - // Calling oneway methods from an UNO thread may cause - // deadlocks, so adding the listeners here. - for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) { - ((AccessibilityNode) e.nextElement()).setAttached(false); - } - } - } - - public void treeWillExpand(javax.swing.event.TreeExpansionEvent treeExpansionEvent) - throws javax.swing.tree.ExpandVetoException { - TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent(); - if (node instanceof DynamicAccessibilityNode) { - DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node; - dynode.populate(); - } - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java deleted file mode 100644 index da6f10c96..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; - -/* - * This class is dynamic in the way that it does not contain any children - * until the node is going to be expanded. It also releases all children - * as soon as the node is collapsed again. - */ -class DynamicAccessibilityNode extends AccessibilityNode { - - public DynamicAccessibilityNode(AccessibilityModel treeModel) { - super(treeModel); - } - - // Populates the child list. Called by AccessibilityMode.treeWillExpand(). - protected void populate() { - try { - XAccessibleContext xAC = getAccessibleContext(); - if (xAC != null) { - int n = xAC.getAccessibleChildCount(); - for (int i=0; i -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -all : package - -ROOT=../../../../.. -PACKAGE = org.openoffice.accessibility.awb.tree -SUBDIRS = -include makefile.common - -include $(ROOT)/makefile.in - - -package : $(CLASS_FILES) - - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java deleted file mode 100644 index 2599dfc7f..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.tree; - -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; - -import com.sun.star.awt.XExtendedToolkit; -import com.sun.star.awt.XTopWindow; - -import com.sun.star.uno.UnoRuntime; - -import javax.swing.SwingUtilities; -import javax.swing.tree.DefaultMutableTreeNode; - -/** - * - */ -public class ToolkitNode extends DefaultMutableTreeNode - implements com.sun.star.awt.XTopWindowListener { - - protected XExtendedToolkit xToolkit; - - private AccessibilityModel treeModel; - - /** Creates a new instance of TopWindowListener */ - public ToolkitNode(XExtendedToolkit xToolkit, AccessibilityModel treeModel) { - super(""); - this.xToolkit = xToolkit; - this.treeModel = treeModel; - - // Initially fill the child list - try { - for (int i=0,j=xToolkit.getTopWindowCount(); i -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - AccessibilityModel.java \ - AccessibilityNode.java \ - AccessibilityTree.java \ - DynamicAccessibilityModel.java \ - DynamicAccessibilityNode.java \ - ToolkitNode.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk deleted file mode 100644 index 0135ca9d6..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/..$/.. -TARGET = java_tree -PACKAGE = org$/openoffice$/accessibility$/awb$/tree - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" - -.INCLUDE : makefile.common - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -.ENDIF - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java deleted file mode 100644 index 42c0a5d82..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import javax.swing.JLabel; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleComponent; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.uno.UnoRuntime; - -import org.openoffice.accessibility.misc.NameProvider; - -/** The ContextView class displays information accessible over - the XAccessibleContext interface. This includes name, - description, and role. -*/ -public class ComponentView - extends ObjectView -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - if (UnoRuntime.queryInterface( - XAccessibleComponent.class, xContext) != null) - return new ComponentView (aContainer); - else - return null; - } - - public ComponentView (ObjectViewContainer aContainer) - { - super (aContainer); - - ViewGridLayout aLayout = new ViewGridLayout (this); - - maRelativeLocationLabel = aLayout.AddLabeledEntry ("Relative Location: "); - maAbsoluteLocationLabel = aLayout.AddLabeledEntry ("Location on Screen: "); - maSizeLabel = aLayout.AddLabeledEntry ("Size"); - maBoundingBoxLabel = aLayout.AddLabeledEntry ("Bounding Box: "); - maConsistencyLabel = aLayout.AddLabeledEntry ("Consistent: "); - maForegroundColorLabel = aLayout.AddLabeledEntry ("Foreground Color: "); - maBackgroundColorLabel = aLayout.AddLabeledEntry ("Background Color: "); - } - - - public void SetObject (XAccessibleContext xContext) - { - mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, xContext); - super.SetObject (xContext); - } - - public void Update () - { - if (mxContext == null) - { - maRelativeLocationLabel.setText (""); - maAbsoluteLocationLabel.setText (""); - maSizeLabel.setText (""); - maBoundingBoxLabel.setText (""); - maConsistencyLabel.setText (""); - maForegroundColorLabel.setText (""); - maBackgroundColorLabel.setText (""); - } - else - { - com.sun.star.awt.Point aLocation = mxComponent.getLocation(); - maRelativeLocationLabel.setText ( - aLocation.X + ", " + aLocation.Y); - com.sun.star.awt.Point aLocationOnScreen = - mxComponent.getLocationOnScreen(); - maAbsoluteLocationLabel.setText ( - aLocationOnScreen.X + ", " + aLocationOnScreen.Y); - com.sun.star.awt.Size aSize = mxComponent.getSize(); - maSizeLabel.setText ( - aSize.Width + ", " + aSize.Height); - com.sun.star.awt.Rectangle aBBox = mxComponent.getBounds(); - maBoundingBoxLabel.setText ( - aBBox.X + ", " + aBBox.Y + "," - + aBBox.Width + ", " + aBBox.Height); - int nColor = mxComponent.getForeground(); - maForegroundColorLabel.setText ( - "R"+ (nColor>>16&0xff) - + "G" + (nColor>>8&0xff) - + "B" + (nColor>>0&0xff) - + "A" + (nColor>>24&0xff)); - nColor = mxComponent.getBackground(); - maBackgroundColorLabel.setText ( - "R"+ (nColor>>16&0xff) - + "G" + (nColor>>8&0xff) - + "B" + (nColor>>0&0xff) - + "A" + (nColor>>24&0xff)); - - // Check consistency of coordinates. - String sConsistency = new String (); - if (aBBox.X!=aLocation.X || aBBox.Y!=aLocation.Y) - sConsistency += (sConsistency.length()!=0?", ":"") + - "Bounding box conflicts with relative location"; - if (aBBox.Width!=aSize.Width || aBBox.Height!=aSize.Height) - sConsistency += (sConsistency.length()!=0?", ":"") + - "Bounding box conflicts with size"; - XAccessible xParent = mxContext.getAccessibleParent(); - XAccessibleComponent xParentComponent = - (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, xParent); - if (xParentComponent == null) - { - if (aLocation.X != aLocationOnScreen.X - || aLocation.Y != aLocationOnScreen.Y) - sConsistency += (sConsistency.length()!=0?", ":"") + - "location on screen does not equal " - + "relative location without parent"; - } - else - { - com.sun.star.awt.Point aParentLocationOnScreen = - xParentComponent.getLocationOnScreen(); - if (aLocation.X+aParentLocationOnScreen.X - != aLocationOnScreen.X - || aLocation.Y+aParentLocationOnScreen.Y - != aLocationOnScreen.Y) - sConsistency += (sConsistency.length()!=0?", ":"") + - "location on screen does not match " - + "relative location"; - } - if (sConsistency.length() == 0) - sConsistency += "yes"; - else - maConsistencyLabel.setBackground (GetContainer().GetErrorColor()); - maConsistencyLabel.setText (sConsistency); - } - } - - public String GetTitle () - { - return ("Component"); - } - - /** Listen for changes regarding displayed values. - */ - public void notifyEvent (AccessibleEventObject aEvent) - { - switch (aEvent.EventId) - { - case AccessibleEventId.BOUNDRECT_CHANGED : - case AccessibleEventId.VISIBLE_DATA_CHANGED : - Update (); - } - } - - private XAccessibleComponent mxComponent; - private JLabel - maRelativeLocationLabel, - maAbsoluteLocationLabel, - maSizeLabel, - maBoundingBoxLabel, - maConsistencyLabel, - maForegroundColorLabel, - maBackgroundColorLabel; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java deleted file mode 100644 index 6989f4142..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import javax.swing.JLabel; -import javax.swing.JTextField; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessibleContext; - -import org.openoffice.accessibility.misc.NameProvider; - -/** The ContextView class displays information accessible over - the XAccessibleContext interface. This includes name, - description, and role. -*/ -public class ContextView - extends ObjectView - implements ActionListener -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - if (xContext != null) - return new ContextView (aContainer); - else - return null; - } - - public ContextView (ObjectViewContainer aContainer) - { - super (aContainer); - - ViewGridLayout aLayout = new ViewGridLayout (this); - maNameLabel = aLayout.AddLabeledString ("Name:"); - maDescriptionLabel = aLayout.AddLabeledString ("Description:"); - maRoleLabel = aLayout.AddLabeledEntry ("Role:"); - } - - public void Update () - { - if (mxContext == null) - { - maNameLabel.setText (""); - maDescriptionLabel.setText (""); - maRoleLabel.setText (""); - } - else - { - maNameLabel.setText (mxContext.getAccessibleName()); - maDescriptionLabel.setText (mxContext.getAccessibleDescription()); - maRoleLabel.setText (NameProvider.getRoleName (mxContext.getAccessibleRole())); - } - } - - public String GetTitle () - { - return ("Context"); - } - - /** Listen for changes regarding displayed values. - */ - public void notifyEvent (AccessibleEventObject aEvent) - { - switch (aEvent.EventId) - { - case AccessibleEventId.NAME_CHANGED : - case AccessibleEventId.DESCRIPTION_CHANGED : - Update (); - } - } - - public void actionPerformed (ActionEvent aEvent) - { - } - - - private JLabel - maNameLabel, - maDescriptionLabel, - maRoleLabel; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java deleted file mode 100644 index ae8b9cd47..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.JButton; - -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.uno.UnoRuntime; - -import org.openoffice.accessibility.awb.view.text.TextDialogFactory; - - -public class EditableTextView - extends ObjectView - implements ActionListener -{ - /** Create a EditableTextView when the given object supports the - XAccessibleEditableText interface. - */ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - XAccessibleEditableText xEditableText = - (XAccessibleEditableText)UnoRuntime.queryInterface( - XAccessibleEditableText.class, xContext); - if (xEditableText != null) - return new EditableTextView (aContainer); - else - return null; - } - - public EditableTextView (ObjectViewContainer aContainer) - { - super (aContainer); - - JButton aButton = new JButton ("cut..."); - aButton.setFont (ViewGridLayout.GetFont()); - aButton.addActionListener (this); - add (aButton); - aButton = new JButton ("paste..."); - aButton.setFont (ViewGridLayout.GetFont()); - aButton.addActionListener (this); - add (aButton); - aButton = new JButton ("edit..."); - aButton.setFont (ViewGridLayout.GetFont()); - aButton.addActionListener (this); - add (aButton); - aButton = new JButton ("format..."); - aButton.setFont (ViewGridLayout.GetFont()); - aButton.addActionListener (this); - add (aButton); - } - - - /** Additionally to the context store a reference to the - XAccessibleEditableText interface. - */ - public void SetObject (XAccessibleContext xObject) - { - mxEditableText = (XAccessibleEditableText)UnoRuntime.queryInterface( - XAccessibleEditableText.class, xObject); - super.SetObject (xObject); - } - - public String GetTitle () - { - return ("Editable Text"); - } - - synchronized public void Destroy () - { - mxEditableText = null; - super.Destroy(); - } - - public void actionPerformed (ActionEvent aEvent) - { - String sCommand = aEvent.getActionCommand(); - if (sCommand.equals ("cut...")) - TextDialogFactory.CreateCutDialog (mxContext); - else if (sCommand.equals ("past...")) - TextDialogFactory.CreatePasteDialog (mxContext); - else if (sCommand.equals ("edit...")) - TextDialogFactory.CreateEditDialog (mxContext); - else if (sCommand.equals ("format...")) - TextDialogFactory.CreateFormatDialog (mxContext); - } - - private XAccessibleEditableText mxEditableText; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java deleted file mode 100644 index f3228e36d..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.BorderLayout; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessibleContext; - -import org.openoffice.accessibility.misc.NameProvider; - - -/** A simple event monitor that shows all events sent to one accessible - object. -*/ -class EventMonitorView - extends ObjectView -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - if (xContext != null) - return new EventMonitorView (aContainer); - else - return null; - } - - public EventMonitorView (ObjectViewContainer aContainer) - { - super (aContainer); - mnLineNo = 0; - Layout(); - } - - public String GetTitle () - { - return "Event Monitor"; - } - - /** Create and arrange the widgets for this view. - */ - private void Layout () - { - setLayout (new GridBagLayout ()); - - maText = new JTextArea(); - maText.setBackground (new Color (255,250,240)); - maText.setFont (new Font ("Helvetica", Font.PLAIN, 9)); - - maScrollPane = new JScrollPane (maText, - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - maScrollPane.setPreferredSize (new Dimension (300,200)); - - GridBagConstraints aConstraints = new GridBagConstraints (); - aConstraints.weightx = 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - add (maScrollPane, aConstraints); - } - - - public void Update () - { - } - - - private void UpdateVerticalScrollBar () - { - JScrollBar sb = maScrollPane.getVerticalScrollBar(); - if (sb != null) - { - int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1; - sb.setValue (nScrollBarValue); - } - } - - - public void notifyEvent (AccessibleEventObject aEvent) - { - maText.append ((mnLineNo++) + ". " + NameProvider.getEventName (aEvent.EventId) + " : " - + aEvent.OldValue.toString() - + " -> " - + aEvent.NewValue.toString() + "\n"); - UpdateVerticalScrollBar(); - } - - private JTextArea maText; - private int mnLineNo; - private JScrollPane maScrollPane; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java deleted file mode 100644 index 5a68a9294..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Font; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import javax.swing.JButton; -import javax.swing.JLabel; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.XAccessibleComponent; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleStateSet; -import com.sun.star.uno.UnoRuntime; - -public class FocusView - extends ObjectView - implements ActionListener -{ - /** Create a FocusView when the given object supports the - XAccessibleComponent interface. - */ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, xContext); - if (xComponent != null) - return new FocusView (aContainer); - else - return null; - } - - public FocusView (ObjectViewContainer aContainer) - { - super (aContainer); - - setLayout (new GridBagLayout()); - GridBagConstraints aConstraints = new GridBagConstraints (); - - maFocused = new JLabel (); - maFocused.setFont (GetContainer().GetViewFont()); - aConstraints.gridy = 0; - aConstraints.weightx = 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - add (maFocused, aConstraints); - - maGrabFocus = new JButton ("grabFocus"); - maGrabFocus.setFont (GetContainer().GetViewFont()); - aConstraints.gridy = 1; - aConstraints.fill = GridBagConstraints.NONE; - aConstraints.anchor = GridBagConstraints.WEST; - add (maGrabFocus, aConstraints); - - maGrabFocus.addActionListener (this); - } - - /** Additionally to the context store a reference to the - XAccessibleComponent interface. - */ - public void SetObject (XAccessibleContext xObject) - { - mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface( - XAccessibleComponent.class, xObject); - super.SetObject (xObject); - } - - synchronized public void Destroy () - { - super.Destroy(); - maGrabFocus.removeActionListener (this); - } - - synchronized public void Update () - { - if (mxContext == null) - { - maFocused.setText (""); - maGrabFocus.setEnabled (false); - } - else - { - XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet(); - if (aStateSet.contains(AccessibleStateType.FOCUSED)) - maFocused.setText ("focused"); - else - maFocused.setText ("not focused"); - if (maGrabFocus != null) - maGrabFocus.setEnabled (true); - } - } - - public String GetTitle () - { - return ("Focus"); - } - - synchronized public void actionPerformed (ActionEvent aEvent) - { - if (aEvent.getActionCommand().equals("grabFocus")) - { - mxComponent.grabFocus(); - } - } - - public void notifyEvent (AccessibleEventObject aEvent) - { - System.out.println (aEvent); - if (aEvent.EventId == AccessibleEventId.STATE_CHANGED) - Update (); - } - - private JLabel maFocused; - private JButton maGrabFocus; - private XAccessibleComponent mxComponent; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java deleted file mode 100644 index 0bbe0bd3e..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Component; -import java.awt.Cursor; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.Point; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseEvent; -import javax.swing.JComponent; - -class LayoutManager - implements MouseListener, - MouseMotionListener -{ - public LayoutManager (JComponent aLayoutedComponent) - { - maLayoutedComponent = aLayoutedComponent; - maDraggedView = null; - mbInsertionPending = false; - } - - public void mouseClicked (MouseEvent aEvent) - { - System.out.println (aEvent); - } - public void mousePressed (MouseEvent aEvent) - { - mnOldY = aEvent.getPoint().y; - } - public void mouseReleased (MouseEvent aEvent) - { - if (mbInsertionPending) - { - InsertView (maDraggedView, aEvent.getPoint().y); - mbInsertionPending = false; - maDraggedView = null; - } - } - public void mouseEntered (MouseEvent aEvent) - { - } - public void mouseExited (MouseEvent aEvent) - { - if (mbInsertionPending) - { - InsertView (maDraggedView, mnOldY); - mbInsertionPending = false; - maDraggedView = null; - } - } - public void mouseDragged (MouseEvent aEvent) - { - int dy = mnOldY - aEvent.getPoint().y; - GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout(); - if ( ! mbInsertionPending && dy != 0) - { - maDraggedView = RemoveView (mnOldY); - if (maDraggedView != null) - mbInsertionPending = true; - } - } - public void mouseMoved (MouseEvent aEvent) - { - } - - - - - private ObjectView RemoveView (int y) - { - ObjectView aView = null; - GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout(); - - Point aGridLocation = aLayout.location (10,y); - Component[] aComponentList = maLayoutedComponent.getComponents(); - System.out.println ("removing view at " + aGridLocation); - for (int i=0; i= aGridLocation.y) - { - if (aConstraints.gridy == aGridLocation.y) - maLayoutedComponent.add (maDraggedView, aConstraints); - aConstraints.gridy += 1; - aLayout.setConstraints (aComponentList[i], aConstraints); - } - } - maLayoutedComponent.validate(); - maLayoutedComponent.repaint(); - } - maLayoutedComponent.setCursor (maNormalCursor); - } - - - - - private JComponent maLayoutedComponent; - private ObjectView maDraggedView; - private int mnOldY; - private boolean mbInsertionPending; - private Cursor maNormalCursor; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile deleted file mode 100644 index feb3f7f3a..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all : package - -ROOT=../../../../.. -PACKAGE = org.openoffice.accessibility.awb.view -SUBDIRS = text -include makefile.common - -include $(ROOT)/makefile.in - - -package : $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java deleted file mode 100644 index ada74f6db..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.openoffice.accessibility.awb.view; - -import javax.swing.JPanel; - -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessibleContext; - -/** This is the base class for all object views that can be placed inside an - object view container. - -

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.

- -

The SetObject and Update methods may be called for a new object - without calling Create first. In this way an existing instance is - recycled.

-*/ -abstract public class ObjectView - extends JPanel -{ - /** This factory method creates a new instance of the (derived) class - when the given accessible object supports all necessary features. - In the ususal case this will be the support of a specific - accessibility interface. - */ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - return null; - } - - public ObjectView (ObjectViewContainer aContainer) - { - maContainer = aContainer; - mxContext = null; - } - - /** Call this when you want the object to be destroyed. Release all - resources when called. - */ - public void Destroy () - { - } - - /** Tell the view to display information for a new accessible object. - @param xObject - The given object may be null. A typical behaviour in this case - would be to display a blank area. But is also possible to show - information about the last object. - */ - public void SetObject (XAccessibleContext xContext) - { - mxContext = xContext; - Update (); - } - - - /** This is a request of a repaint with the current state of the current - object. The current object may or may not be the same as the one - when Update() was called the last time. - */ - public void Update () - { - } - - - /** Return a string that is used as a title of an enclosing frame. - */ - abstract public String GetTitle (); - - - public ObjectViewContainer GetContainer () - { - return maContainer; - } - - - /** Implement this method if you are interested in accessible events. - */ - public void notifyEvent (AccessibleEventObject aEvent) - {} - - /// Reference to the current object to display information about. - protected XAccessibleContext mxContext; - - protected ObjectViewContainer maContainer; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java deleted file mode 100644 index bc86cb3ee..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java +++ /dev/null @@ -1,310 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Font; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.awt.Insets; - -import java.util.Vector; - -import java.lang.reflect.Method; -import java.lang.NoSuchMethodException; -import java.lang.IllegalAccessException; -import java.lang.reflect.InvocationTargetException; - -import javax.swing.JPanel; -import javax.swing.JTree; -import javax.swing.BorderFactory; -import javax.swing.border.Border; -import javax.swing.border.BevelBorder; -import javax.swing.SwingUtilities; - -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleComponent; -import com.sun.star.accessibility.XAccessibleEventBroadcaster; -import com.sun.star.accessibility.XAccessibleEventListener; -import com.sun.star.accessibility.XAccessibleSelection; -import com.sun.star.lang.EventObject; -import com.sun.star.uno.UnoRuntime; - -import org.openoffice.accessibility.awb.view.ObjectView; - - - -/** This container of specialized object views displays information about - one accessible object. - In this it plays several roles: - 1. Object container. - 2. Accessibility event dispatcher. - 3. Object view class registration manager. - 4. Swing widget. -*/ -public class ObjectViewContainer - extends JPanel - implements XAccessibleEventListener -{ - public ObjectViewContainer () - { - maFont = new Font ("Dialog", Font.PLAIN, 11); - maViewTemplates = new Vector (); - maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED); - GridBagLayout aLayout = new GridBagLayout (); - setLayout (aLayout); - // maLayoutManager = new LayoutManager (this); - maLayoutManager = null; - - RegisterView (ContextView.class); - RegisterView (ComponentView.class); - RegisterView (ParentView.class); - RegisterView (StateSetView.class); - RegisterView (FocusView.class); - RegisterView (TextView.class); - RegisterView (EditableTextView.class); - RegisterView (TableView.class); - RegisterView (SelectionView.class); - RegisterView (ServiceInterfaceView.class); - RegisterView (EventMonitorView.class); - - mxContext = null; - - // addMouseListener (maLayoutManager); - // addMouseMotionListener (maLayoutManager); - } - - - - /** Remove all existing views and create new ones according to the - interfaces supported by the given object. - */ - public synchronized void SetObject (XAccessibleContext xContext) - { - // Call Destroy at all views to give them a chance to release their - // resources. - int n = getComponentCount(); - for (int i=0; i= 0) - maViewTemplates.setElementAt (aSubstitution, nIndex); - } - - - /** Return a font that should be used for widgets in the views. - */ - public Font GetViewFont () - { - return maFont; - } - - public Color GetErrorColor () - { - return new Color (255,80,50); - } - - /** Add an object view and place it below all previously added views. - @param aView - This argument may be null. In this case nothing happens. - */ - private void Add (ObjectView aView) - { - if (aView != null) - { - GridBagConstraints constraints = new GridBagConstraints (); - constraints.gridx = 0; - constraints.gridy = getComponentCount(); - constraints.gridwidth = 1; - constraints.gridheight = 1; - constraints.weightx = 1; - constraints.weighty = 0; - constraints.ipadx = 2; - constraints.ipady = 5; - constraints.insets = new Insets (5,5,5,5); - constraints.anchor = GridBagConstraints.NORTH; - constraints.fill = GridBagConstraints.HORIZONTAL; - - aView.setBorder ( - BorderFactory.createTitledBorder ( - maViewBorder, aView.GetTitle())); - - add (aView, constraints); - } - } - - /** Update the layout manager by setting the vertical weight of the - bottom entry to 1 and so make it strech to over the available - space. - - */ - private void UpdateLayoutManager () - { - // Adapt the layout manager. - if (getComponentCount() > 1000) - { - Component aComponent = getComponent (getComponentCount()-1); - GridBagLayout aLayout = (GridBagLayout)getLayout(); - GridBagConstraints aConstraints = aLayout.getConstraints (aComponent); - aConstraints.weighty = 1; - aLayout.setConstraints (aComponent, aConstraints); - } - } - - - - - /** Put the event just received into the event queue which will deliver - it soon asynchronuously to the DispatchEvent method. - */ - public void notifyEvent (final AccessibleEventObject aEvent) - { - SwingUtilities.invokeLater( - new Runnable() - { - public void run() - { - DispatchEvent (aEvent); - } - } - ); - } - - - - - /** Forward accessibility events to all views without them being - registered as event listeners each on their own. - */ - private void DispatchEvent (AccessibleEventObject aEvent) - { - int n = getComponentCount(); - for (int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import java.lang.Integer; -import javax.swing.JLabel; -import javax.swing.JTextField; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.lang.IndexOutOfBoundsException; - -import org.openoffice.accessibility.misc.NameProvider; - - -/** Show informations related to the parent/child relationship. -*/ -public class ParentView - extends ObjectView -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - if (xContext != null) - return new ParentView (aContainer); - else - return null; - } - - public ParentView (ObjectViewContainer aContainer) - { - super (aContainer); - - ViewGridLayout aLayout = new ViewGridLayout (this); - maParentLabel = aLayout.AddLabeledEntry ("Has parent: "); - maIndexLabel = aLayout.AddLabeledEntry ("Index in parent: "); - maValidLabel = aLayout.AddLabeledEntry ("Parent/Child relationship valid: "); - maChildrenLabel = aLayout.AddLabeledEntry ("Child count: "); - } - - public void Update () - { - if (mxContext == null) - { - maParentLabel.setText (""); - maIndexLabel.setText (""); - maValidLabel.setText (""); - maChildrenLabel.setText (""); - } - else - { - XAccessible xParent = mxContext.getAccessibleParent(); - int nIndex = mxContext.getAccessibleIndexInParent(); - maIndexLabel.setText (Integer.toString(nIndex)); - if (xParent != null) - { - maParentLabel.setText ("yes"); - XAccessibleContext xParentContext = - xParent.getAccessibleContext(); - if (xParentContext != null) - { - try - { - XAccessible xChild = - xParentContext.getAccessibleChild(nIndex); - if (xChild != mxContext) - maValidLabel.setText ("yes"); - else - { - maValidLabel.setText ("no"); - maValidLabel.setBackground (GetContainer().GetErrorColor()); - } - } - catch (IndexOutOfBoundsException e) - { - maValidLabel.setText ("no: invalid index in parent"); - maValidLabel.setBackground (GetContainer().GetErrorColor()); - } - } - else - { - maValidLabel.setText ("no: parent has no context"); - maValidLabel.setBackground (GetContainer().GetErrorColor()); - } - } - else - maParentLabel.setText ("no"); - maChildrenLabel.setText (Integer.toString(mxContext.getAccessibleChildCount())); - } - } - - public String GetTitle () - { - return ("Parent"); - } - - - /** Listen for changes regarding displayed values. - */ - public void notifyEvent (AccessibleEventObject aEvent) - { - switch (aEvent.EventId) - { - default: - Update (); - } - } - - - private JLabel - maParentLabel, - maIndexLabel, - maValidLabel, - maChildrenLabel; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java deleted file mode 100644 index 4970546fd..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java +++ /dev/null @@ -1,267 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.util.Vector; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; - -import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JOptionPane; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JToggleButton; -import javax.swing.ListSelectionModel; - - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleSelection; -import com.sun.star.accessibility.XAccessibleStateSet; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.IndexOutOfBoundsException; - - -/** Display a list of children and select/deselect buttons -*/ -class SelectionView - extends ObjectView - implements ActionListener -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - XAccessibleSelection xSelection = (XAccessibleSelection)UnoRuntime.queryInterface( - XAccessibleSelection.class, xContext); - if (xSelection != null) - return new SelectionView(aContainer); - else - return null; - } - - public SelectionView (ObjectViewContainer aContainer) - { - super (aContainer); - Layout(); - } - - public String GetTitle () - { - return "Selection"; - } - - /** Create and arrange the widgets for this view. - */ - private void Layout () - { - setLayout (new GridBagLayout()); - - GridBagConstraints aConstraints = new GridBagConstraints(); - - // Label that shows whether the selection is multi selectable. - aConstraints.gridx = 0; - aConstraints.gridy = 0; - aConstraints.anchor = GridBagConstraints.WEST; - maTypeLabel = new JLabel (); - maTypeLabel.setFont (maContainer.GetViewFont()); - add (maTypeLabel, aConstraints); - - // the JListBox - maChildrenSelector = new JPanel (); - maChildrenSelector.setPreferredSize (new Dimension (100,100)); - maChildrenSelector.setLayout ( - new BoxLayout (maChildrenSelector, BoxLayout.Y_AXIS)); - - aConstraints.gridx = 0; - aConstraints.gridwidth = 4; - aConstraints.gridy = 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - add (new JScrollPane (maChildrenSelector, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), - aConstraints); - - JButton aButton; - aButton = new JButton( "Select all" ); - aButton.setFont (maContainer.GetViewFont()); - aButton.setActionCommand( "Select all" ); - aButton.addActionListener( this ); - aConstraints.gridx = 0; - aConstraints.gridwidth = 1; - aConstraints.gridy = 2; - aConstraints.fill = GridBagConstraints.NONE; - aConstraints.anchor = GridBagConstraints.WEST; - add (aButton, aConstraints); - - aButton = new JButton( "Clear Selection" ); - aButton.setFont (maContainer.GetViewFont()); - aButton.setActionCommand( "Clear Selection" ); - aButton.addActionListener( this ); - aConstraints.gridx = 1; - aConstraints.gridy = 2; - aConstraints.weightx = 1; - add (aButton, aConstraints); - - setSize (getPreferredSize()); - } - - - public void SetObject (XAccessibleContext xContext) - { - mxSelection = (XAccessibleSelection)UnoRuntime.queryInterface( - XAccessibleSelection.class, xContext); - super.SetObject (xContext); - } - - - public void Update () - { - maChildrenSelector.removeAll (); - - // Determine whether multi selection is possible. - XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet(); - boolean bMultiSelectable = false; - if (aStateSet!=null && aStateSet.contains( - AccessibleStateType.MULTI_SELECTABLE)) - { - bMultiSelectable = true; - maTypeLabel.setText ("multi selectable"); - } - else - { - maTypeLabel.setText ("single selectable"); - } - - if (mxContext.getAccessibleRole() != AccessibleRole.TABLE) - { - int nCount = mxContext.getAccessibleChildCount(); - for (int i=0; i"))); - } - } - - private void CreateServiceTree () - { - XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class, mxContext); - maServiceRoot.removeAllChildren(); - if (xServiceInfo != null) - { - String[] aServiceNames = xServiceInfo.getSupportedServiceNames(); - int nCount = aServiceNames.length; - for (int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.RenderingHints; -import java.awt.geom.AffineTransform; - - - -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleStateSet; - -import org.openoffice.accessibility.misc.NameProvider; - -public class StateSetView - extends ObjectView -{ - /** Create a FocusView when the given object supports the - XAccessibleComponent interface. - */ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - ObjectView aView = null; - if (xContext != null) - aView = new StateSetView (aContainer); - - return aView; - } - - public StateSetView (ObjectViewContainer aContainer) - { - super (aContainer); - setPreferredSize (new Dimension(300,110)); - setMinimumSize (new Dimension(200,80)); - } - - public String GetTitle () - { - return ("StateSet"); - } - - public void notifyEvent (AccessibleEventObject aEvent) - { - if (aEvent.EventId == AccessibleEventId.STATE_CHANGED) - Update(); - } - - - public void Update () - { - repaint (); - } - - public void paintChildren (Graphics g) - { - if (g != null) - synchronized (g) - { - super.paintChildren (g); - - // Calculcate the are inside the border. - Insets aInsets = getInsets (); - Dimension aSize = getSize(); - Rectangle aWidgetArea = new Rectangle ( - aInsets.left, - aInsets.top, - aSize.width-aInsets.left-aInsets.right, - aSize.height-aInsets.top-aInsets.bottom); - - PaintAllStates ((Graphics2D)g, aWidgetArea); - } - } - - private void PaintAllStates (Graphics2D g, Rectangle aWidgetArea) - { - Color aTextColor = g.getColor(); - - g.setRenderingHint ( - RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - XAccessibleStateSet xStateSet = ( mxContext != null ) ? mxContext.getAccessibleStateSet() : null; - if (xStateSet != null) - { - short aStates[] = xStateSet.getStates (); - final int nMaxStateIndex = AccessibleStateType.VISIBLE;//MANAGES_DESCENDANTS; - int nStateWidth = (aWidgetArea.width-12) / (nMaxStateIndex+1); - AffineTransform aTransform = g.getTransform (); - g.setColor (aTextColor); - int y = aWidgetArea.y+aWidgetArea.height - 25; - double nTextRotation = -0.9;//-java.lang.Math.PI/2; - double nScale = 0.6; - - // Create a shape for the boxes. - int nBoxWidth = 8; - Rectangle aCheckBox = new Rectangle (-nBoxWidth/2,0,nBoxWidth,nBoxWidth); - - // For each state draw a box, fill it appropriately, and draw - // thre states name. - for (short i=0; i<=nMaxStateIndex; i++) - { - int x = nStateWidth + i * nStateWidth; - String sStateName = NameProvider.getStateName (i); - if (sStateName == null) - sStateName = new String (""); - boolean bStateSet = xStateSet.contains (i); - g.setTransform (aTransform); - g.translate (x,y); - if (bStateSet) - { - switch (i) - { - case AccessibleStateType.INVALID: - case AccessibleStateType.DEFUNC: - g.setColor (saInvalidColor); - break; - case AccessibleStateType.FOCUSED: - g.setColor (saFocusColor); - break; - case AccessibleStateType.SELECTED: - g.setColor (saSelectionColor); - break; - case AccessibleStateType.EDITABLE: - g.setColor (saEditColor); - break; - default: - g.setColor (saDefaultColor); - break; - } - g.fill (aCheckBox); - g.setColor (aTextColor); - } - g.draw (aCheckBox); - g.rotate (nTextRotation); - g.scale (nScale, nScale); - g.translate (2,-2); - g.drawString (sStateName, 0,0); - } - - // Draw string of set states. - String sStates = new String (); - for (int i=0; i 0) - sStates = sStates + ", "; - sStates = sStates + NameProvider.getStateName(aStates[i]); - } - g.setTransform (aTransform); - g.translate (10,aWidgetArea.y+aWidgetArea.height-3); - g.scale (0.9,0.9); - g.drawString (sStates,0,0); - } - } - - static private Color - saInvalidColor = new Color (255,0,255), - saFocusColor = new Color (100,100,255), - saSelectionColor = Color.GREEN, - saDefaultColor = new Color (90,90,90), - saEditColor = new Color (240,240,0); -} - - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java deleted file mode 100644 index 35f037916..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.lang.Integer; -import java.lang.StringBuffer; - -import javax.swing.JLabel; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleTable; -import com.sun.star.uno.UnoRuntime; - - - -/** The ContextView class displays information accessible over - the XAccessibleContext interface. This includes name, - description, and role. -*/ -public class TableView - extends ObjectView -{ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - if (UnoRuntime.queryInterface( - XAccessibleTable.class, xContext) != null) - return new TableView (aContainer); - else - return null; - } - - public TableView (ObjectViewContainer aContainer) - { - super (aContainer); - - ViewGridLayout aLayout = new ViewGridLayout (this); - - maRowCountLabel = aLayout.AddLabeledEntry ("Row Count: "); - maColumnCountLabel = aLayout.AddLabeledEntry ("Column Count: "); - maCellCountLabel = aLayout.AddLabeledEntry ("Cell Count: "); - maSelectedRowsLabel = aLayout.AddLabeledEntry ("Selected Rows: "); - maSelectedColumnsLabel = aLayout.AddLabeledEntry ("Selected Columns: "); - } - - - public void SetObject (XAccessibleContext xContext) - { - mxTable = (XAccessibleTable)UnoRuntime.queryInterface( - XAccessibleTable.class, xContext); - super.SetObject (xContext); - } - - - public void Update () - { - if (mxTable == null) - { - maRowCountLabel.setText (""); - maColumnCountLabel.setText (""); - maCellCountLabel.setText (""); - maSelectedRowsLabel.setText (""); - maSelectedColumnsLabel.setText (""); - } - else - { - int nRowCount = mxTable.getAccessibleRowCount(); - int nColumnCount = mxTable.getAccessibleColumnCount(); - maRowCountLabel.setText (Integer.toString (nRowCount)); - maColumnCountLabel.setText (Integer.toString (nColumnCount)); - maCellCountLabel.setText (Integer.toString (nRowCount*nColumnCount)); - - StringBuffer sList = new StringBuffer(); - int[] aSelected = mxTable.getSelectedAccessibleRows(); - boolean bFirst = true; - for (int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSpinner; -import javax.swing.JTree; -import javax.swing.tree.TreeNode; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; - -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.AccessibleTextType; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.TextSegment; -import com.sun.star.accessibility.XAccessibleText; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleMultiLineText; -import com.sun.star.accessibility.XAccessibleStateSet; -import com.sun.star.awt.Point; -import com.sun.star.awt.Rectangle; -import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.uno.UnoRuntime; - -import org.openoffice.accessibility.awb.view.text.CaretSpinnerModel; -import org.openoffice.accessibility.awb.view.text.TextDialogFactory; - - -public class TextView - extends ObjectView - implements ActionListener -{ - - /** Create a TextView when the given object supports the - XAccessibleText interface. - */ - static public ObjectView Create ( - ObjectViewContainer aContainer, - XAccessibleContext xContext) - { - XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, xContext); - if (xText != null) - return new TextView (aContainer); - else - return null; - } - - - public TextView (ObjectViewContainer aContainer) - { - super (aContainer); - - ViewGridLayout aLayout = new ViewGridLayout (this); - - maTextLabel = aLayout.AddLabeledString ("Text: "); - maCharacterArrayLabel = aLayout.AddLabeledEntry ("Characters: "); - maCharacterCountLabel = aLayout.AddLabeledEntry ("Character Count: "); - maSelectionLabel = aLayout.AddLabeledEntry ("Selection: "); - maBoundsLabel = aLayout.AddLabeledEntry ("Bounds Test: "); - maCaretPositionSpinner = (JSpinner)aLayout.AddLabeledComponent ( - "Caret position:", new JSpinner()); - Dimension aSize = maCaretPositionSpinner.getSize(); - maCaretPositionSpinner.setPreferredSize (new Dimension (100,20)); - maCaretLineNoLabel = aLayout.AddLabeledEntry ("Line number at caret: "); - maCaretLineTextLabel = aLayout.AddLabeledEntry ("Text of line at caret: "); - maLineNoFromCaretPosLabel = aLayout.AddLabeledEntry ("Line number at index of caret: "); - maLineTextFromCaretPosLabel = aLayout.AddLabeledEntry ("Text of line at index of caret: "); - - JPanel aButtonPanel = new JPanel (); - aLayout.AddComponent (aButtonPanel); - - JButton aButton = new JButton ("select..."); - aButton.setFont (aLayout.GetFont()); - aButton.addActionListener (this); - aButtonPanel.add (aButton); - - aButton = new JButton ("copy..."); - aButton.setFont (aLayout.GetFont()); - aButton.addActionListener (this); - aButtonPanel.add (aButton); - - // A tree that holds the text broken down into various segments. - maTree = new JTree (); - aLayout.AddComponent (new JScrollPane ( - maTree, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)); - } - - - /** Additionally to the context store a reference to the - XAccessibleText interface. - */ - public void SetObject (XAccessibleContext xObject) - { - mxText = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, xObject); - maCaretSpinnerModel = new CaretSpinnerModel(mxText); - maCaretPositionSpinner.setModel (maCaretSpinnerModel); - super.SetObject (xObject); - } - - synchronized public void Destroy () - { - mxText = null; - super.Destroy(); - } - - synchronized public void Update () - { - maCaretPositionSpinner.setEnabled (mxText != null); - DefaultMutableTreeNode aRoot = new DefaultMutableTreeNode ("Text Segments"); - if (mxText == null) - { - maTextLabel.setText (""); - maCharacterArrayLabel.setText (""); - maCharacterCountLabel.setText (""); - maSelectionLabel.setText (""); - maBoundsLabel.setText (""); - maCaretLineNoLabel.setText (""); - maCaretLineTextLabel.setText (""); - maLineNoFromCaretPosLabel.setText (""); - maLineTextFromCaretPosLabel.setText (""); - } - else - { - maTextLabel.setText (mxText.getText()); - maCharacterArrayLabel.setText (GetCharacterArray()); - maCharacterCountLabel.setText ( - Integer.toString(mxText.getCharacterCount())); - // Selection. - maSelectionLabel.setText ( - "[" + mxText.getSelectionStart() - + "," + mxText.getSelectionEnd() - + "] \"" + mxText.getSelectedText() + "\""); - - // Character bounds. - maBoundsLabel.setText (GetTextBoundsString()); - - // Caret position. - maCaretPositionSpinner.setValue (new Integer (mxText.getCaretPosition())); - - // Multi line methods. - XAccessibleMultiLineText xMultiText = (XAccessibleMultiLineText) - UnoRuntime.queryInterface( XAccessibleMultiLineText.class, mxText ); - - if( null != xMultiText ) { - try { - maCaretLineNoLabel.setText ( Integer.toString( xMultiText.getNumberOfLineWithCaret() ) ); - TextSegment ts = xMultiText.getTextAtLineWithCaret(); - maCaretLineTextLabel.setText ( "[" + ts.SegmentStart - + "," + ts.SegmentEnd - + "] \"" + ts.SegmentText + "\""); - maLineNoFromCaretPosLabel.setText ( Integer.toString( xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ) ); - ts = xMultiText.getTextAtLineNumber(xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ); - maLineTextFromCaretPosLabel.setText ( "[" + ts.SegmentStart - + "," + ts.SegmentEnd - + "] \"" + ts.SegmentText + "\""); - } catch( IndexOutOfBoundsException e) { - } - } - - // Text segments. - aRoot.add (CreateNode ("Character", AccessibleTextType.CHARACTER)); - aRoot.add (CreateNode ("Word", AccessibleTextType.WORD)); - aRoot.add (CreateNode ("Sentence", AccessibleTextType.SENTENCE)); - aRoot.add (CreateNode ("Paragraph", AccessibleTextType.PARAGRAPH)); - aRoot.add (CreateNode ("Line", AccessibleTextType.LINE)); - aRoot.add (CreateNode ("Attribute", AccessibleTextType.ATTRIBUTE_RUN)); - aRoot.add (CreateNode ("Glyph", AccessibleTextType.GLYPH)); - } - ((DefaultTreeModel)maTree.getModel()).setRoot (aRoot); - } - - public String GetTitle () - { - return ("Text"); - } - - public void notifyEvent (AccessibleEventObject aEvent) - { - System.out.println (aEvent); - switch (aEvent.EventId) - { - case AccessibleEventId.CARET_CHANGED : - maCaretSpinnerModel.Update(); - Update (); - break; - - case AccessibleEventId.TEXT_CHANGED : - case AccessibleEventId.TEXT_SELECTION_CHANGED: - Update (); - break; - } - } - - public void actionPerformed (ActionEvent aEvent) - { - String sCommand = aEvent.getActionCommand(); - if (sCommand.equals ("select...")) - TextDialogFactory.CreateSelectionDialog (mxContext); - else if (sCommand.equals ("copy...")) - TextDialogFactory.CreateCopyDialog (mxContext); - } - - - - /** Create a string that is a list of all characters returned by the - getCharacter() method. - */ - private String GetCharacterArray () - { - // Do not show more than 30 characters. - int nCharacterCount = mxText.getCharacterCount(); - int nMaxDisplayCount = 30; - - // build up string - StringBuffer aCharacterArray = new StringBuffer(); - int nIndex = 0; - try - { - while (nIndex= 0) && (nIndex < mxText.getCharacter(i))) - aBuffer.append (mxText.getCharacter(nIndex)); - else - aBuffer.append ('#'); - } - } - catch (IndexOutOfBoundsException aEvent) - { - // Ignore errors. - } - - return aBuffer.toString(); - } - - - - - private final static int BEFORE = -1; - private final static int AT = 0; - private final static int BEHIND = +1; - - private MutableTreeNode CreateNode (String sTitle, short nTextType) - { - DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle); - - aNode.add (CreateSegmentNode ("Before", nTextType, BEFORE)); - aNode.add (CreateSegmentNode ("At", nTextType, AT)); - aNode.add (CreateSegmentNode ("Behind", nTextType, BEHIND)); - - return aNode; - } - - private MutableTreeNode CreateSegmentNode (String sTitle, short nTextType, int nWhere) - { - TextSegment aSegment; - int nTextLength = mxText.getCharacterCount(); - DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle); - for (int nIndex=0; nIndex<=nTextLength; /* empty */) - { - aSegment = GetTextSegment (nIndex, nTextType, nWhere); - DefaultMutableTreeNode aSegmentNode = new DefaultMutableTreeNode ( - new StringBuffer ( - Integer.toString (nIndex) + " -> " - + Integer.toString (aSegment.SegmentStart) + " - " - + Integer.toString (aSegment.SegmentEnd) + " : " - + aSegment.SegmentText.toString())); - aNode.add (aSegmentNode); - if (nTextType == AccessibleTextType.ATTRIBUTE_RUN) - AddAttributeNodes (aSegmentNode, aSegment); - if (aSegment.SegmentEnd > nIndex) - nIndex = aSegment.SegmentEnd; - else - nIndex ++; - } - - return aNode; - } - - - private TextSegment GetTextSegment (int nIndex, short nTextType, int nWhere) - { - TextSegment aSegment; - - try - { - switch (nWhere) - { - case BEFORE: - aSegment = mxText.getTextBeforeIndex (nIndex, nTextType); - break; - - case AT: - aSegment = mxText.getTextAtIndex (nIndex, nTextType); - break; - - case BEHIND: - aSegment = mxText.getTextBehindIndex (nIndex, nTextType); - break; - - default: - aSegment = new TextSegment(); - aSegment.SegmentText = new String ("unknown position " + nWhere); - aSegment.SegmentStart = nIndex; - aSegment.SegmentStart = nIndex+1; - break; - } - } - catch (IndexOutOfBoundsException aException) - { - aSegment = new TextSegment (); - aSegment.SegmentText = new String ("Invalid index at ") + nIndex + " : " - + aException.toString(); - aSegment.SegmentStart = nIndex; - aSegment.SegmentEnd = nIndex+1; - } - catch (IllegalArgumentException aException) - { - aSegment = new TextSegment (); - aSegment.SegmentText = new String ("Illegal argument at ") + nIndex + " : " - + aException.toString(); - aSegment.SegmentStart = nIndex; - aSegment.SegmentEnd = nIndex+1; - } - - return aSegment; - } - - - /** Add to the given node one node for every attribute of the given segment. - */ - private void AddAttributeNodes ( - DefaultMutableTreeNode aNode, - TextSegment aSegment) - { - try - { - PropertyValue[] aValues = mxText.getCharacterAttributes ( - aSegment.SegmentStart, aAttributeList); - for (int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; -import javax.swing.JComponent; -import javax.swing.JLabel; - - -/** This class is a convenience class for views to use the GridBagLayout. -*/ -class ViewGridLayout -{ - public ViewGridLayout (JComponent aComponent) - { - maComponent = aComponent; - maComponent.setLayout (new GridBagLayout()); - maComponent.setMinimumSize (new Dimension (300,30)); - maComponent.setMaximumSize (new Dimension (300,1000)); - mnCurrentLine = 0; - } - - public JLabel AddLabeledEntry (String sTitle) - { - return (JLabel)AddLabeledComponent (sTitle, new JLabel ("")); - } - - public JLabel AddLabeledString (String sTitle) - { - JLabel aLabel = AddLabeledEntry (sTitle); - aLabel.setBackground (new Color(220,220,220)); - aLabel.setOpaque (true); - return aLabel; - } - - public JComponent AddLabeledComponent (String sTitle, JComponent aComponent) - { - GridBagConstraints constraints = new GridBagConstraints (); - constraints.gridx = 0; - constraints.anchor = GridBagConstraints.WEST; - constraints.fill = GridBagConstraints.NONE; - constraints.gridy = mnCurrentLine; - - JLabel aLabel = new JLabel(sTitle); - aLabel.setFont (saFont); - maComponent.add (aLabel, constraints); - constraints.gridx = 1; - constraints.weightx = 1; - constraints.fill = GridBagConstraints.NONE; - aComponent.setFont (saFont); - maComponent.add (aComponent, constraints); - - mnCurrentLine += 1; - - return aComponent; - } - - public JComponent AddComponent (JComponent aComponent) - { - GridBagConstraints constraints = new GridBagConstraints (); - constraints.gridx = 0; - constraints.gridwidth = 2; - constraints.weightx = 1; - constraints.anchor = GridBagConstraints.WEST; - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.gridy = mnCurrentLine; - - maComponent.add (aComponent, constraints); - - mnCurrentLine += 1; - - return aComponent; - } - - static public Font GetFont () - { - return saFont; - } - - static private Font saFont; - private int mnCurrentLine; - private JComponent maComponent; - - static - { - saFont = new Font ("Dialog", Font.PLAIN, 11); - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common deleted file mode 100644 index 38033b3ab..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common +++ /dev/null @@ -1,45 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - ComponentView.java \ - ContextView.java \ - EditableTextView.java \ - EventMonitorView.java \ - FocusView.java \ - LayoutManager.java \ - ObjectView.java \ - ObjectViewContainer.java \ - ObjectViewContainerWindow.java \ - ParentView.java \ - SelectionView.java \ - ServiceInterfaceView.java \ - StateSetView.java \ - TableView.java \ - TextView.java \ - ViewGridLayout.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk deleted file mode 100644 index 0bfa48537..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/..$/.. -TARGET = awb_view -PACKAGE = org$/openoffice$/accessibility$/awb$/view - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" - -.INCLUDE : makefile.common - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -.ENDIF - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java deleted file mode 100644 index c6d7e09ea..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view.text; - -import java.lang.Integer; -import java.util.Vector; -import javax.swing.SpinnerModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import com.sun.star.accessibility.XAccessibleText; -import com.sun.star.lang.IndexOutOfBoundsException; - - -/** A simple model for JSpinner objects that clips the spinner values to valid - text indices. -*/ -public class CaretSpinnerModel - implements SpinnerModel -{ - public CaretSpinnerModel (XAccessibleText xText) - { - mxText = xText; - maListeners = new Vector (); - } - - public void addChangeListener (ChangeListener aListener) - { - if (aListener != null) - maListeners.add (aListener); - } - - public void removeChangeListener (ChangeListener aListener) - { - maListeners.removeElement (aListener); - } - - public Object getNextValue () - { - if (mxText != null) - { - int nPosition = mxText.getCaretPosition(); - if (nPosition+1 <= mxText.getCharacterCount()) - return new Integer (nPosition+1); - } - return null; - } - - public Object getPreviousValue () - { - if (mxText != null) - { - int nPosition = mxText.getCaretPosition(); - if (nPosition > 0) - return new Integer (nPosition-1); - } - return null; - } - - public Object getValue () - { - if (mxText != null) - return new Integer (mxText.getCaretPosition()); - else - return null; - } - - public void setValue (Object aValue) - { - if (mxText != null) - if (aValue instanceof Integer) - { - try - { - if( ((Integer)aValue).intValue() != mxText.getCaretPosition() ) - mxText.setCaretPosition (((Integer)aValue).intValue()); - } - catch (IndexOutOfBoundsException aException) - { - } - } - } - - /** Call this method when the caret position has changes so that the model - can inform its listeners about it. - */ - public void Update () - { - ChangeEvent aEvent = new ChangeEvent (this); - for (int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view.text; - -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.FlowLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.text.JTextComponent; - -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleText; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.uno.UnoRuntime; - - -/** - * Display a dialog with a text field and a pair of cancel/do-it buttons - */ -class TextActionDialog - extends JDialog - implements ActionListener -{ - public TextActionDialog ( - XAccessibleContext xContext, - String sExplanation, - String sTitle) - { - super();// AccessibilityWorkBench.Instance() ); - - mxContext = xContext; - msTitle = sTitle; - msExplanation = sExplanation; - Layout (); - setSize (350, 225); - - } - - - /** build dialog */ - protected void Layout() - { - setTitle (msTitle); - - // vertical stacking of the elements - Container aContent = getContentPane(); - // aContent.setLayout( new BorderLayout() ); - - // Label with explanation. - if (msExplanation.length() > 0) - aContent.add (new JLabel (msExplanation), BorderLayout.NORTH); - - // the text field - maText = new JTextArea(); - maText.setLineWrap (true); - maText.setEditable (false); - aContent.add (maText, BorderLayout.CENTER); - - XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, mxContext); - String sText = xText.getText(); - maText.setText (sText); - maText.setRows (sText.length() / 40 + 1); - maText.setColumns (Math.min (Math.max (40, sText.length()), 20)); - - JPanel aButtons = new JPanel(); - aButtons.setLayout (new FlowLayout()); - maIndexToggle = new JCheckBox ("reverse selection"); - aButtons.add (maIndexToggle); - - JButton aActionButton = new JButton (msTitle); - aActionButton.setActionCommand ("Action"); - aActionButton.addActionListener (this); - aButtons.add (aActionButton); - - JButton aCancelButton = new JButton ("cancel"); - aCancelButton.setActionCommand ("Cancel"); - aCancelButton.addActionListener (this); - aButtons.add (aCancelButton); - - // add Panel with buttons - aContent.add (aButtons, BorderLayout.SOUTH); - } - - protected void Cancel() - { - hide(); - dispose(); - } - - public void actionPerformed(ActionEvent e) - { - String sCommand = e.getActionCommand(); - - if( "Cancel".equals( sCommand ) ) - Cancel(); - else if( "Action".equals( sCommand ) ) - Action(); - } - - - protected int GetSelectionStart() - { - return GetSelection(true); - } - protected int GetSelectionEnd() - { - return GetSelection(false); - } - private int GetSelection (boolean bStart) - { - if (bStart ^ maIndexToggle.isSelected()) - return maText.getSelectionStart(); - else - return maText.getSelectionEnd(); - } - - - - protected void Action () - { - String sError = null; - boolean bSuccess = true; - try - { - XAccessibleText xText = - (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, mxContext); - if (xText != null) - bSuccess = bSuccess && TextAction (xText); - - XAccessibleEditableText xEditableText = - (XAccessibleEditableText)UnoRuntime.queryInterface( - XAccessibleEditableText.class, mxContext); - if (xEditableText != null) - bSuccess = bSuccess && EditableTextAction (xEditableText); - - if ( ! bSuccess) - sError = "Can't execute"; - } - catch (IndexOutOfBoundsException e) - { - sError = "Index out of bounds"; - } - - if (sError != null) - JOptionPane.showMessageDialog ( - this,// AccessibilityWorkBench.Instance(), - sError, - msTitle, - JOptionPane.ERROR_MESSAGE); - - Cancel(); - } - - /** override this for dialog-specific action */ - boolean TextAction (XAccessibleText xText) - throws IndexOutOfBoundsException - { - return true; - } - - boolean EditableTextAction (XAccessibleEditableText xText) - throws IndexOutOfBoundsException - { - return true; - } - - private XAccessibleContext mxContext; - protected JTextArea maText; - private String msTitle; - private String msExplanation; - private JCheckBox maIndexToggle; -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java deleted file mode 100644 index 05d8ff480..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view.text; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.BoxLayout; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JColorChooser; -import javax.swing.JPanel; -import javax.swing.text.JTextComponent; - -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.uno.UnoRuntime; - - -class TextAttributeDialog - extends TextActionDialog -{ - public TextAttributeDialog (XAccessibleContext xContext) - { - super (xContext, - "Choose attributes, select text, and press 'Set':", - "set"); - } - - protected void Layout () - { - super.Layout (); - - maForeground = Color.black; - maBackground = Color.white; - - JPanel aPanel = new JPanel(); - aPanel.setLayout (new BoxLayout (aPanel, BoxLayout.Y_AXIS)); - - maBoldCheckBox = new JCheckBox ("bold"); - maUnderlineCheckBox = new JCheckBox ("underline"); - maItalicsCheckBox = new JCheckBox ("italics"); - - JButton aForegroundButton = new JButton ("Foreground", - new TextAttributeDialog.ColorIcon(true)); - aForegroundButton.addActionListener (new ActionListener() - { - public void actionPerformed (ActionEvent aEvent) - { - maForeground = JColorChooser.showDialog ( - TextAttributeDialog.this, - "Select Foreground Color", - maForeground); - } - } ); - - JButton aBackgroundButton = new JButton("Background", - new TextAttributeDialog.ColorIcon(false)); - aBackgroundButton.addActionListener (new ActionListener() - { - public void actionPerformed (ActionEvent eEvent) - { - maBackground = JColorChooser.showDialog( - TextAttributeDialog.this, - "Select Background Color", - maBackground); - } - } ); - - aPanel.add (maBoldCheckBox); - aPanel.add (maUnderlineCheckBox); - aPanel.add (maItalicsCheckBox); - aPanel.add (aForegroundButton); - aPanel.add (aBackgroundButton); - - getContentPane().add (aPanel, BorderLayout.WEST); - } - - - /** edit the text */ - boolean EditableTextAction (XAccessibleEditableText xText) - throws IndexOutOfBoundsException - { - PropertyValue[] aSequence = new PropertyValue[6]; - aSequence[0] = new PropertyValue(); - aSequence[0].Name = "CharWeight"; - aSequence[0].Value = new Integer (maBoldCheckBox.isSelected() ? 150 : 100); - aSequence[1] = new PropertyValue(); - aSequence[1].Name = "CharUnderline"; - aSequence[1].Value = new Integer (maUnderlineCheckBox.isSelected() ? 1 : 0); - aSequence[2] = new PropertyValue(); - aSequence[2].Name = "CharBackColor"; - aSequence[2].Value = new Integer (maBackground.getRGB()); - aSequence[3] = new PropertyValue(); - aSequence[3].Name = "CharColor"; - aSequence[3].Value = new Integer (maForeground.getRGB()); - aSequence[4] = new PropertyValue(); - aSequence[4].Name = "CharPosture"; - aSequence[4].Value = new Integer (maItalicsCheckBox.isSelected() ? 1 : 0); - aSequence[5] = new PropertyValue(); - aSequence[5].Name = "CharBackTransparent"; - aSequence[5].Value = new Boolean (false); - - return xText.setAttributes ( - GetSelectionStart(), - GetSelectionEnd(), - aSequence); - } - - class ColorIcon - implements Icon - { - public ColorIcon(boolean bWhich) { bForeground = bWhich; } - public int getIconHeight() { return nHeight; } - public int getIconWidth() { return nWidth; } - public void paintIcon (Component c, Graphics g, int x, int y) - { - g.setColor( getColor() ); - g.fillRect( x, y, nHeight, nWidth ); - g.setColor( c.getForeground() ); - g.drawRect( x, y, nHeight, nWidth ); - } - Color getColor() - { - if (bForeground) - return maForeground; - else - return maBackground; - } - - private static final int nHeight = 16; - private static final int nWidth = 16; - private boolean bForeground; - } - - - - - private JCheckBox - maBoldCheckBox, - maUnderlineCheckBox, - maItalicsCheckBox; - private Color - maForeground, - maBackground; - -} - diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java deleted file mode 100644 index 70371324d..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view.text; - -import javax.swing.JDialog; -import javax.swing.text.JTextComponent; - -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.accessibility.XAccessibleText; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.uno.UnoRuntime; - - -/** Factory for dialogs of the text views. -*/ -public class TextDialogFactory -{ - static public JDialog CreateSelectionDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextActionDialog( - xContext, - "Select range:", - "select") - { - boolean TextAction (XAccessibleText xText) - throws IndexOutOfBoundsException - { - return xText.setSelection( - GetSelectionStart(), - GetSelectionEnd() ); - } - }; - if (aDialog != null) - aDialog.show(); - return aDialog; - } - - static public JDialog CreateCopyDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextActionDialog( - xContext, - "Select range and copy:", - "copy") - { - boolean TextAction (XAccessibleText xText) - throws IndexOutOfBoundsException - { - return xText.copyText( - GetSelectionStart(), - GetSelectionEnd()); - } - }; - if (aDialog != null) - aDialog.show(); - return aDialog; - } - static public JDialog CreateCutDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextActionDialog( - xContext, - "Select range and cut:", - "cut") - { - boolean EditableTextAction (XAccessibleEditableText xText) - throws IndexOutOfBoundsException - { - return xText.cutText( - GetSelectionStart(), - GetSelectionEnd() ); - } - }; - if (aDialog != null) - aDialog.show(); - return aDialog; - } - static public JDialog CreatePasteDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextActionDialog ( - xContext, - "Place Caret and paste:", - "paste") - { - boolean EditableTextAction (XAccessibleEditableText xText) - throws IndexOutOfBoundsException - { - return xText.pasteText(maText.getCaretPosition()); - } - }; - if (aDialog != null) - aDialog.show(); - return aDialog; - } - static public JDialog CreateEditDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextEditDialog ( - xContext, - "Edit text:", - "edit"); - if (aDialog != null) - aDialog.show(); - return aDialog; - } - static public JDialog CreateFormatDialog (XAccessibleContext xContext) - { - JDialog aDialog = new TextAttributeDialog (xContext); - if (aDialog != null) - aDialog.show(); - return aDialog; - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java deleted file mode 100644 index 9d5aec464..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.awb.view.text; - -import javax.swing.text.JTextComponent; - -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.lang.IndexOutOfBoundsException; -import com.sun.star.uno.UnoRuntime; - - -class TextEditDialog - extends TextActionDialog -{ - public TextEditDialog ( - XAccessibleContext xContext, - String sExplanation, - String sTitle ) - { - super (xContext, sExplanation, sTitle); - } - - protected void Layout() - { - super.Layout(); - maText.setEditable (true); - } - - - /** edit the text */ - boolean EditableTextAction (XAccessibleEditableText xText) - { - return UpdateText (xText, maText.getText()); - } - - - /** update the text */ - boolean UpdateText (XAccessibleEditableText xText, String sNew) - { - boolean bResult = false; - - String sOld = xText.getText(); - - // false alarm? Early out if no change was done! - if ( ! sOld.equals (sNew)) - { - - // Get the minimum length of both strings. - int nMinLength = sOld.length(); - if (sNew.length() < nMinLength) - nMinLength = sNew.length(); - - // Count equal characters from front and end. - int nFront = 0; - while ((nFront < nMinLength) && - (sNew.charAt(nFront) == sOld.charAt(nFront))) - nFront++; - int nBack = 0; - while ((nBack < nMinLength) && - (sNew.charAt(sNew.length()-nBack-1) == - sOld.charAt(sOld.length()-nBack-1) )) - nBack++; - if (nFront + nBack > nMinLength) - nBack = nMinLength - nFront; - - // so... the first nFront and the last nBack characters are the - // same. Change the others! - String sDel = sOld.substring (nFront, sOld.length() - nBack); - String sIns = sNew.substring (nFront, sNew.length() - nBack); - - System.out.println ("edit text: " + - sOld.substring(0, nFront) + - " [ " + sDel + " -> " + sIns + " ] " + - sOld.substring(sOld.length() - nBack)); - - try - { - // edit the text, and use - // (set|insert|delete|replace)Text as needed - if( nFront+nBack == 0 ) - bResult = xText.setText( sIns ); - else if( sDel.length() == 0 ) - bResult = xText.insertText( sIns, nFront ); - else if( sIns.length() == 0 ) - bResult = xText.deleteText( nFront, sOld.length()-nBack ); - else - bResult = xText.replaceText(nFront, sOld.length()-nBack,sIns); - } - catch( IndexOutOfBoundsException aException) - { - } - } - - return bResult; - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common deleted file mode 100644 index 7d9a5e8fe..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common +++ /dev/null @@ -1,34 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - CaretSpinnerModel.java \ - TextActionDialog.java \ - TextEditDialog.java \ - TextAttributeDialog.java \ - TextDialogFactory.java diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk deleted file mode 100644 index 1ec7da266..000000000 --- a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/..$/..$/.. -TARGET = awb_view_text -PACKAGE = org$/openoffice$/accessibility$/awb$/view$/text - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" - -.INCLUDE : makefile.common - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -.ENDIF - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - diff --git a/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java deleted file mode 100644 index 74780b971..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package org.openoffice.accessibility.misc; - -import com.sun.star.lang.EventObject; - -import com.sun.star.accessibility.AccessibleEventObject; -import com.sun.star.accessibility.XAccessibleEventBroadcaster; -import com.sun.star.accessibility.XAccessibleEventListener; - -/** - * - */ -public class AccessibleEventMulticaster implements XAccessibleEventListener { - - private final XAccessibleEventListener a; - private final XAccessibleEventListener b; - - /** Creates a new instance of AccessibleEventMulticaster */ - protected AccessibleEventMulticaster(XAccessibleEventListener a, - XAccessibleEventListener b) { - this.a = a; - this.b = b; - } - - protected XAccessibleEventListener remove(XAccessibleEventListener l) { - if (l == a) - return b; - if (l == b) - return a; - XAccessibleEventListener a2 = remove(a, l); - XAccessibleEventListener b2 = remove(b, l); - if (a2 == a && b2 == b) { - return this; // not found - } - return add(a2, b2); - } - - public void notifyEvent(AccessibleEventObject accessibleEventObject) { - a.notifyEvent(accessibleEventObject); - b.notifyEvent(accessibleEventObject); - } - - public void disposing(EventObject eventObject) { - a.disposing(eventObject); - b.disposing(eventObject); - } - - public static XAccessibleEventListener add(XAccessibleEventListener a, XAccessibleEventListener b) { - if (a == null) - return b; - if (b == null) - return a; - return new AccessibleEventMulticaster(a,b); - } - - public static XAccessibleEventListener remove(XAccessibleEventListener l, XAccessibleEventListener oldl) { - if (l == oldl || l == null) { - return null; - } else if (l instanceof AccessibleEventMulticaster) { - return ((AccessibleEventMulticaster) l).remove(oldl); - } else { - return l; - } - } - -} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Connector.java b/accessibility/workben/org/openoffice/accessibility/misc/Connector.java deleted file mode 100644 index de188676e..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/Connector.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.openoffice.accessibility.misc; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Timer; -import java.util.TimerTask; -import java.util.Vector; - - -/** Wait for an Office application and connect to it. -*/ -public class Connector - extends TimerTask -{ - final public static long snDelay = 3000; - - public Connector () - { - maTimer = new Timer (true); - maListeners = new Vector(); - run (); - } - - public void AddConnectionListener (ActionListener aListener) - { - SimpleOffice aOffice = SimpleOffice.Instance(); - if (aOffice!=null && aOffice.IsConnected()) - aListener.actionPerformed ( - new ActionEvent (aOffice,0,"")); - maListeners.add (aListener); - } - - public void run () - { - SimpleOffice aOffice = SimpleOffice.Instance(); - if (aOffice!=null && !aOffice.IsConnected()) - if ( ! aOffice.Connect()) - maTimer.schedule (this, snDelay); - else - { - ActionEvent aEvent = new ActionEvent (aOffice,0,""); - for (int i=0; i 0) - sIndent += " "; - - // Get XAccessibleContext object if given object does not - // already support this interface. - XAccessibleContext xContext - = (XAccessibleContext) UnoRuntime.queryInterface ( - XAccessibleContext.class, xObject); - if (xContext == null) - { - XAccessible xAccessible - = (XAccessible) UnoRuntime.queryInterface ( - XAccessible.class, xObject); - if (xAccessible == null) - { - maOut.println (sIndent + "given object " + xObject - + " is not accessible"); - return false; - } - else - xContext = xAccessible.getAccessibleContext(); - } - - // Print information about the accessible context. - if (xContext != null) - { - maOut.println (sIndent + "Name : " - + xContext.getAccessibleName()); - maOut.println (sIndent + "Description : " - + xContext.getAccessibleDescription()); - maOut.println (sIndent + "Role : " - + xContext.getAccessibleRole()); - String sHasParent; - if (xContext.getAccessibleParent() != null) - { - maOut.println (sIndent + "Has parent : yes"); - maOut.println (sIndent + "Parent index : " - + xContext.getAccessibleIndexInParent()); - } - else - maOut.println (sIndent + "Has parent : no"); - maOut.println (sIndent + "Child count : " - + xContext.getAccessibleChildCount()); - maOut.print (sIndent + "Relation set : "); - XAccessibleRelationSet xRelationSet - = xContext.getAccessibleRelationSet(); - if (xRelationSet != null) - { - maOut.print (xRelationSet.getRelationCount() + " ("); - for (int i=0; i 0) - maOut.print (", "); - maOut.print (xRelationSet.getRelation(i).toString()); - } - maOut.println (")"); - } - else - maOut.println ("no relation set"); - - maOut.print (sIndent + "State set : "); - XAccessibleStateSet xStateSet = - xContext.getAccessibleStateSet(); - if (xStateSet != null) - { - XIndexAccess xStates = - (XIndexAccess) UnoRuntime.queryInterface ( - XIndexAccess.class, xStateSet); - maOut.print (xStates.getCount() + " ("); - for (int i=0; i 0) - maOut.print (", "); - maOut.print (xStates.getByIndex(i).toString()); - } - maOut.println (")"); - } - else - maOut.println ("no state set"); - - showAccessibleComponent (xContext, sIndent); - } - else - maOut.println ("object has no accessible context."); - - // showInfo (xContext); - // showServices (xContext); - // showInterfaces (xContext); - } - catch (Exception e) - { - System.out.println ("caught exception in showAccessibility :" + e); - } - return true; - } - - - - - /** @descr Print information about the given accessible component. - */ - public void showAccessibleComponent (XInterface xObject, String sIndent) - { - try - { - XAccessibleComponent xComponent = - (XAccessibleComponent) UnoRuntime.queryInterface ( - XAccessibleComponent.class, xObject); - - // Print information about the accessible context. - if (xComponent != null) - { - maOut.println (sIndent + "Position : " - + xComponent.getLocation().X+", " - + xComponent.getLocation().Y); - maOut.println (sIndent + "Screen position : " - + xComponent.getLocationOnScreen().X+", " - + xComponent.getLocationOnScreen().Y); - maOut.println (sIndent + "Size : " - + xComponent.getSize().Width+", " - + xComponent.getSize().Height); - } - } - catch (Exception e) - { - System.out.println ( - "caught exception in showAccessibleComponent : " + e); - } - } - - - /** Show a textual representation of the accessibility subtree rooted in - xRoot. - */ - public boolean showAccessibilityTree (XAccessible xRoot, int depth) - { - try - { - if ( ! showAccessibility (xRoot, depth)) - return false; - - String sIndent = ""; - for (int i=0; i -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -all : package - -ROOT=../../../.. -PACKAGE = org.openoffice.accessibility.misc -SUBDIRS = - -include makefile.common - -include $(ROOT)/makefile.in - -package: subdirs $(CLASS_FILES) diff --git a/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java b/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java deleted file mode 100644 index 1060d91eb..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.openoffice.accessibility.misc; - -import java.awt.Font; -import java.awt.Rectangle; -import java.awt.Color; -import java.awt.Graphics; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JScrollBar; - - - -/** A message area displays text in a scrollable text widget. It is a - singleton. Other objects can access it directly to display messages. -*/ -public class MessageArea - extends JScrollPane -{ - public static synchronized MessageArea Instance () - { - if (saInstance == null) - saInstance = new MessageArea (); - return saInstance; - } - - - - - /** Create a new message area. This method is private because the class is - a singleton and may therefore not be instanciated from the outside. - */ - private MessageArea () - { - maText = new JTextArea(); - maText.setBackground (new Color (255,250,240)); - maText.setFont (new Font ("Helvetica", Font.PLAIN, 9)); - setViewportView (maText); - setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - - printMessage ( - "class path is " + System.getProperty ("java.class.path") + "\n"); - } - - - - - /** Show the given string at the end of the message area and scroll to make - it visible. - */ - public static synchronized void print (String aMessage) - { - print (0, aMessage); - } - - - - - /** Show the given string at the end of the message area and scroll to make - it visible. Indent the string as requested. - */ - public static synchronized void print (int nIndentation, String aMessage) - { - while (nIndentation-- > 0) - aMessage = " " + aMessage; - Instance().printMessage(aMessage); - } - - - - - /** Show the given string at the end of the message area and scroll to make - it visible. - */ - public static void println (String aMessage) - { - println (0, aMessage); - } - - - - - /** Show the given string at the end of the message area and scroll to make - it visible. - */ - public static void println (int nIndentation, String aMessage) - { - print (nIndentation, aMessage+"\n"); - } - - - - - public void paintComponent (Graphics g) - { - synchronized (g) - { - JScrollBar sb = getVerticalScrollBar(); - if (sb != null) - { - int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1; - sb.setValue (nScrollBarValue); - } - super.paintComponent (g); - } - } - - - - - /** Append the given string to the end of the text and scroll so that it - becomes visible. This is an internal method. Use one of the static - and public ones. - */ - private synchronized void printMessage (String aMessage) - { - maText.append (aMessage); - } - - - - - private static MessageArea saInstance = null; - private JTextArea maText; -} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java b/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java deleted file mode 100644 index db8d2b0ab..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java +++ /dev/null @@ -1,263 +0,0 @@ -package org.openoffice.accessibility.misc; - -import java.util.HashMap; -import com.sun.star.accessibility.AccessibleStateType; -import com.sun.star.accessibility.AccessibleEventId; -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.AccessibleRelationType; - - -/** Provide names for several accessibility constants groups. -*/ -public class NameProvider -{ - /** Return the name of the specified state. - @param nStateId - Id of the state for which to return its name. This is one of - the ids listed in the AccessibleStateType - constants group. - @return - Returns the name of the specified state. When an invalid or - unknown state id is given then a special string is returned that - says that the state does not exist. - */ - public static String getStateName (int nStateId) - { - String sStateName = (String)maStateMap.get (new Integer(nStateId)); - if (sStateName == null) - sStateName = new String (""); - return sStateName; - } - - - /** Return the name of the specified event. - @param nEventId - Id of the event type for which to return its name. This is one - of the ids listed in the AccessibleEventId - 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 AccessibleRole - 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 AccessibleRelationType - constants group. - @return - Returns the name of the specified relation type or an empty - string if an invalid / unknown role id was given. - */ - public static String getRelationName (int nRelation) - { - return (String)maRelationMap.get (new Integer(nRelation)); - } - - - private static HashMap maStateMap = new HashMap(); - private static HashMap maEventMap = new HashMap(); - private static HashMap maRoleMap = new HashMap(); - private static HashMap maRelationMap = new HashMap(); - - static { - maStateMap.put (new Integer (AccessibleStateType.INVALID), "INVALID"); - maStateMap.put (new Integer (AccessibleStateType.ACTIVE), "ACTIVE"); - maStateMap.put (new Integer (AccessibleStateType.ARMED), "ARMED"); - maStateMap.put (new Integer (AccessibleStateType.BUSY), "BUSY"); - maStateMap.put (new Integer (AccessibleStateType.CHECKED), "CHECKED"); - // maStateMap.put (new Integer (AccessibleStateType.COLLAPSED), "COLLAPSED"); - maStateMap.put (new Integer (AccessibleStateType.DEFUNC), "DEFUNC"); - maStateMap.put (new Integer (AccessibleStateType.EDITABLE), "EDITABLE"); - maStateMap.put (new Integer (AccessibleStateType.ENABLED), "ENABLED"); - maStateMap.put (new Integer (AccessibleStateType.EXPANDABLE), "EXPANDABLE"); - maStateMap.put (new Integer (AccessibleStateType.EXPANDED), "EXPANDED"); - maStateMap.put (new Integer (AccessibleStateType.FOCUSABLE), "FOCUSABLE"); - maStateMap.put (new Integer (AccessibleStateType.FOCUSED), "FOCUSED"); - maStateMap.put (new Integer (AccessibleStateType.HORIZONTAL), "HORIZONTAL"); - maStateMap.put (new Integer (AccessibleStateType.ICONIFIED), "ICONIFIED"); - maStateMap.put (new Integer (AccessibleStateType.MODAL), "MODAL"); - maStateMap.put (new Integer (AccessibleStateType.MULTI_LINE), "MULTI_LINE"); - maStateMap.put (new Integer (AccessibleStateType.MULTI_SELECTABLE), "MULTI_SELECTABLE"); - maStateMap.put (new Integer (AccessibleStateType.OPAQUE), "OPAQUE"); - maStateMap.put (new Integer (AccessibleStateType.PRESSED), "PRESSED"); - maStateMap.put (new Integer (AccessibleStateType.RESIZABLE), "RESIZABLE"); - maStateMap.put (new Integer (AccessibleStateType.SELECTABLE), "SELECTABLE"); - maStateMap.put (new Integer (AccessibleStateType.SELECTED), "SELECTED"); - maStateMap.put (new Integer (AccessibleStateType.SENSITIVE), "SENSITIVE"); - maStateMap.put (new Integer (AccessibleStateType.SHOWING), "SHOWING"); - maStateMap.put (new Integer (AccessibleStateType.SINGLE_LINE), "SINGLE_LINE"); - maStateMap.put (new Integer (AccessibleStateType.STALE), "STALE"); - maStateMap.put (new Integer (AccessibleStateType.TRANSIENT), "TRANSIENT"); - maStateMap.put (new Integer (AccessibleStateType.VERTICAL), "VERTICAL"); - maStateMap.put (new Integer (AccessibleStateType.VISIBLE), "VISIBLE"); - maStateMap.put (new Integer (AccessibleStateType.MANAGES_DESCENDANTS), - "MANAGES_DESCENDANTS"); - //maStateMap.put (new Integer (AccessibleStateType.INCONSISTENT),"INCONSISTENT"); - - - maEventMap.put (new Integer (0), - "[UNKNOWN]"); - maEventMap.put (new Integer (AccessibleEventId.NAME_CHANGED), - "NAME_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.DESCRIPTION_CHANGED), - "DESCRIPTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.ACTION_CHANGED), - "ACTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.STATE_CHANGED), - "STATE_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.ACTIVE_DESCENDANT_CHANGED), - "ACTIVE_DESCENDANT_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.BOUNDRECT_CHANGED), - "BOUNDRECT_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CHILD), - "CHILD"); - maEventMap.put (new Integer (AccessibleEventId.INVALIDATE_ALL_CHILDREN), - "INVALIDATE_ALL_CHILDREN"); - maEventMap.put (new Integer (AccessibleEventId.SELECTION_CHANGED), - "SELECTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.VISIBLE_DATA_CHANGED), - "VISIBLE_DATA_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.VALUE_CHANGED), - "VALUE_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_FROM_RELATION_CHANGED), - "CONTENT_FLOWS_FROM_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_TO_RELATION_CHANGED), - "CONTENT_FLOWS_TO_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CONTROLLED_BY_RELATION_CHANGED), - "CONTROLLED_BY_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CONTROLLER_FOR_RELATION_CHANGED), - "CONTROLLER_FOR_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.LABEL_FOR_RELATION_CHANGED), - "LABEL_FOR_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.LABELED_BY_RELATION_CHANGED), - "LABELED_BY_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.MEMBER_OF_RELATION_CHANGED), - "MEMBER_OF_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.SUB_WINDOW_OF_RELATION_CHANGED), - "SUB_WINDOW_OF_RELATION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.CARET_CHANGED), - "CARET_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TEXT_SELECTION_CHANGED), - "TEXT_SELECTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TEXT_CHANGED), - "TEXT_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TEXT_ATTRIBUTE_CHANGED), - "TEXT_ATTRIBUTE_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.HYPERTEXT_CHANGED), - "HYPERTEXT_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_CAPTION_CHANGED), - "TABLE_CAPTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_DESCRIPTION_CHANGED), - "TABLE_COLUMN_DESCRIPTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_HEADER_CHANGED), - "TABLE_COLUMN_HEADER_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_MODEL_CHANGED), - "TABLE_MODEL_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_DESCRIPTION_CHANGED), - "TABLE_ROW_DESCRIPTION_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_HEADER_CHANGED), - "TABLE_ROW_HEADER_CHANGED"); - maEventMap.put (new Integer (AccessibleEventId.TABLE_SUMMARY_CHANGED), - "TABLE_SUMMARY_CHANGED"); - - maRoleMap.put (new Integer(AccessibleRole.UNKNOWN), "UNKNOWN"); - maRoleMap.put (new Integer (AccessibleRole.UNKNOWN), "UNKNOWN"); - maRoleMap.put (new Integer (AccessibleRole.ALERT), "ALERT"); - maRoleMap.put (new Integer (AccessibleRole.COLUMN_HEADER), "COLUMN_HEADER"); - maRoleMap.put (new Integer (AccessibleRole.CANVAS), "CANVAS"); - maRoleMap.put (new Integer (AccessibleRole.CHECK_BOX), "CHECK_BOX"); - maRoleMap.put (new Integer (AccessibleRole.CHECK_MENU_ITEM), "CHECK_MENU_ITEM"); - maRoleMap.put (new Integer (AccessibleRole.COLOR_CHOOSER), "COLOR_CHOOSER"); - maRoleMap.put (new Integer (AccessibleRole.COMBO_BOX), "COMBO_BOX"); - maRoleMap.put (new Integer (AccessibleRole.DESKTOP_ICON), "DESKTOP_ICON"); - maRoleMap.put (new Integer (AccessibleRole.DESKTOP_PANE), "DESKTOP_PANE"); - maRoleMap.put (new Integer (AccessibleRole.DIRECTORY_PANE), "DIRECTORY_PANE"); - maRoleMap.put (new Integer (AccessibleRole.DIALOG), "DIALOG"); - maRoleMap.put (new Integer (AccessibleRole.DOCUMENT), "DOCUMENT"); - maRoleMap.put (new Integer (AccessibleRole.EMBEDDED_OBJECT), "EMBEDDED_OBJECT"); - maRoleMap.put (new Integer (AccessibleRole.END_NOTE), "END_NOTE"); - maRoleMap.put (new Integer (AccessibleRole.FILE_CHOOSER), "FILE_CHOOSER"); - maRoleMap.put (new Integer (AccessibleRole.FILLER), "FILLER"); - maRoleMap.put (new Integer (AccessibleRole.FONT_CHOOSER), "FONT_CHOOSER"); - maRoleMap.put (new Integer (AccessibleRole.FOOTER), "FOOTER"); - maRoleMap.put (new Integer (AccessibleRole.FOOTNOTE), "FOOTNOTE"); - maRoleMap.put (new Integer (AccessibleRole.FRAME), "FRAME"); - maRoleMap.put (new Integer (AccessibleRole.GLASS_PANE), "GLASS_PANE"); - maRoleMap.put (new Integer (AccessibleRole.GRAPHIC), "GRAPHIC"); - maRoleMap.put (new Integer (AccessibleRole.GROUP_BOX), "GROUP_BOX"); - maRoleMap.put (new Integer (AccessibleRole.HEADER), "HEADER"); - maRoleMap.put (new Integer (AccessibleRole.HEADING), "HEADING"); - maRoleMap.put (new Integer (AccessibleRole.HYPER_LINK), "HYPER_LINK"); - maRoleMap.put (new Integer (AccessibleRole.ICON), "ICON"); - maRoleMap.put (new Integer (AccessibleRole.INTERNAL_FRAME), "INTERNAL_FRAME"); - maRoleMap.put (new Integer (AccessibleRole.LABEL), "LABEL"); - maRoleMap.put (new Integer (AccessibleRole.LAYERED_PANE), "LAYERED_PANE"); - maRoleMap.put (new Integer (AccessibleRole.LIST), "LIST"); - maRoleMap.put (new Integer (AccessibleRole.LIST_ITEM), "LIST_ITEM"); - maRoleMap.put (new Integer (AccessibleRole.MENU), "MENU"); - maRoleMap.put (new Integer (AccessibleRole.MENU_BAR), "MENU_BAR"); - maRoleMap.put (new Integer (AccessibleRole.MENU_ITEM), "MENU_ITEM"); - maRoleMap.put (new Integer (AccessibleRole.OPTION_PANE), "OPTION_PANE"); - maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB), "PAGE_TAB"); - maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB_LIST), "PAGE_TAB_LIST"); - maRoleMap.put (new Integer (AccessibleRole.PANEL), "PANEL"); - maRoleMap.put (new Integer (AccessibleRole.PARAGRAPH), "PARAGRAPH"); - maRoleMap.put (new Integer (AccessibleRole.PASSWORD_TEXT), "PASSWORD_TEXT"); - maRoleMap.put (new Integer (AccessibleRole.POPUP_MENU), "POPUP_MENU"); - maRoleMap.put (new Integer (AccessibleRole.PUSH_BUTTON), "PUSH_BUTTON"); - maRoleMap.put (new Integer (AccessibleRole.PROGRESS_BAR), "PROGRESS_BAR"); - maRoleMap.put (new Integer (AccessibleRole.RADIO_BUTTON), "RADIO_BUTTON"); - maRoleMap.put (new Integer (AccessibleRole.RADIO_MENU_ITEM), "RADIO_MENU_ITEM"); - maRoleMap.put (new Integer (AccessibleRole.ROW_HEADER), "ROW_HEADER"); - maRoleMap.put (new Integer (AccessibleRole.ROOT_PANE), "ROOT_PANE"); - maRoleMap.put (new Integer (AccessibleRole.SCROLL_BAR), "SCROLL_BAR"); - maRoleMap.put (new Integer (AccessibleRole.SCROLL_PANE), "SCROLL_PANE"); - maRoleMap.put (new Integer (AccessibleRole.SHAPE), "SHAPE"); - maRoleMap.put (new Integer (AccessibleRole.SEPARATOR), "SEPARATOR"); - maRoleMap.put (new Integer (AccessibleRole.SLIDER), "SLIDER"); - maRoleMap.put (new Integer (AccessibleRole.SPIN_BOX), "SPIN_BOX"); - maRoleMap.put (new Integer (AccessibleRole.SPLIT_PANE), "SPLIT_PANE"); - maRoleMap.put (new Integer (AccessibleRole.STATUS_BAR), "STATUS_BAR"); - maRoleMap.put (new Integer (AccessibleRole.TABLE), "TABLE"); - maRoleMap.put (new Integer (AccessibleRole.TABLE_CELL), "TABLE_CELL"); - maRoleMap.put (new Integer (AccessibleRole.TEXT), "TEXT"); - maRoleMap.put (new Integer (AccessibleRole.TEXT_FRAME), "TEXT_FRAME"); - maRoleMap.put (new Integer (AccessibleRole.TOGGLE_BUTTON), "TOGGLE_BUTTON"); - maRoleMap.put (new Integer (AccessibleRole.TOOL_BAR), "TOOL_BAR"); - maRoleMap.put (new Integer (AccessibleRole.TOOL_TIP), "TOOL_TIP"); - maRoleMap.put (new Integer (AccessibleRole.TREE), "TREE"); - maRoleMap.put (new Integer (AccessibleRole.VIEW_PORT), "VIEW_PORT"); - maRoleMap.put (new Integer (AccessibleRole.WINDOW), "WINDOW"); - - maRelationMap.put (new Integer (AccessibleRelationType.INVALID), "INVALID"); - maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_FROM), "CONTENT_FLOWS_FROM"); - maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_TO), "CONTENT_FLOWS_TO"); - maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLED_BY), "CONTROLLED_BY"); - maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLER_FOR), "CONTROLLER_FOR"); - maRelationMap.put (new Integer (AccessibleRelationType.LABEL_FOR), "LABEL_FOR"); - maRelationMap.put (new Integer (AccessibleRelationType.LABELED_BY), "LABELED_BY"); - maRelationMap.put (new Integer (AccessibleRelationType.MEMBER_OF), "MEMBER_OF"); - maRelationMap.put (new Integer (AccessibleRelationType.SUB_WINDOW_OF), "SUB_WINDOW_OF"); - } -} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java b/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java deleted file mode 100644 index 03e086f1d..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.openoffice.accessibility.misc; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.PrintStream; -import java.util.Timer; -import java.util.TimerTask; -import java.util.Vector; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.bridge.XUnoUrlResolver; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.comp.helper.Bootstrap; - -/** This class establishes a connection to a StarOffice application. - */ -public class OfficeConnection - extends TimerTask -{ - final public static long snDelay = 3000; - - public static synchronized OfficeConnection Instance () - { - if (saInstance == null) - saInstance = new OfficeConnection (); - return saInstance; - } - - - - - static public void SetPipeName (String sPipeName) - { - ssDefaultPipeName = sPipeName; - } - - - - - public void AddConnectionListener (ActionListener aListener) - { - SimpleOffice aOffice = SimpleOffice.Instance(); - if (IsValid()) - aListener.actionPerformed ( - new ActionEvent (aOffice,0,"")); - maListeners.add (aListener); - } - - - - /** @descr Return the service manager that represents the connected - StarOffice application - */ - public XMultiServiceFactory GetServiceManager () - { - return maServiceManager; - } - - - - - /** Return a flag that indicates if the constructor has been able to - establish a valid connection. - */ - public boolean IsValid () - { - return (maServiceManager != null); - } - - - - - /** Connect to a already running StarOffice application that has - been started with a command line argument like - "-accept=pipe,name=;urp;" - */ - private boolean Connect () - { - mbInitialized = true; - // Set up connection string. - String sConnectString = "uno:pipe,name=" + msPipeName - + ";urp;StarOffice.ServiceManager"; - - // connect to a running office and get the ServiceManager - try - { - // Create a URL Resolver. - XMultiServiceFactory aLocalServiceManager = - Bootstrap.createSimpleServiceManager(); - XUnoUrlResolver aURLResolver = - (XUnoUrlResolver) UnoRuntime.queryInterface ( - XUnoUrlResolver.class, - aLocalServiceManager.createInstance ( - "com.sun.star.bridge.UnoUrlResolver") - ); - - maServiceManager = - (XMultiServiceFactory) UnoRuntime.queryInterface ( - XMultiServiceFactory.class, - aURLResolver.resolve (sConnectString) - ); - } - - catch (Exception e) - { - if (maOut != null) - { - maOut.println ("Could not connect with " - + sConnectString + " : " + e); - maOut.println ("Please start OpenOffice/StarOffice with " - + "\"-accept=pipe,name=" + msPipeName + ";urp;\""); - } - } - - return maServiceManager != null; - } - - - public void run () - { - if ( ! IsValid()) - { - MessageArea.println ("trying to connect"); - if (Connect()) - { - // Stop the timer. - cancel (); - - ActionEvent aEvent = new ActionEvent (this,0,""); - for (int i=0; i 0) - { - // All shapes return as accessible object the document window's - // accessible object. This is, of course, a hack and will be - // removed as soon as the missing infrastructure for obtaining - // the object directly is implemented. - XShape xShape = null; - try{ - xShape = (XShape) UnoRuntime.queryInterface( - XShape.class, xShapeList.getByIndex (0)); - } catch (Exception e) - {} - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface ( - XAccessible.class, xShape); - return xAccessible; - } - else - return null; - } - - private SimpleOffice () - { - } - - - - private XDesktop mxDesktop; - private static SimpleOffice saInstance = null; -} diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.common b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common deleted file mode 100644 index 0d7b0a3f5..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/makefile.common +++ /dev/null @@ -1,36 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar -JAVAFILES = \ - AccessibleEventMulticaster.java \ - InformationWriter.java \ - MessageArea.java \ - NameProvider.java \ - OfficeConnection.java \ - Options.java \ - SimpleOffice.java diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk deleted file mode 100644 index fe56ef406..000000000 --- a/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJNAME = awb -PRJ = ..$/..$/..$/..$/.. -TARGET = java_misc -PACKAGE = org$/openoffice$/accessibility$/misc - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(JAVAVER:s/.//)" >= "140" -.INCLUDE : makefile.common -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/automation/inc/automation/automation.hxx b/automation/inc/automation/automation.hxx deleted file mode 100644 index ce997c8ba..000000000 --- a/automation/inc/automation/automation.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef AUTOMATION_HXX -#define AUTOMATION_HXX - -class ImplRemoteControl; - -class RemoteControl -{ - ImplRemoteControl* pImpl; -public: - RemoteControl(); - ~RemoteControl(); -}; - -#ifdef __cplusplus -extern "C" -{ -#endif - - typedef void ( *pfunc_CreateRemoteControl)(); - typedef void ( *pfunc_DestroyRemoteControl)(); - -#ifdef __cplusplus -} -#endif - -#endif // AUTOMATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/automation/commdefines.hxx b/automation/inc/automation/commdefines.hxx deleted file mode 100644 index 3333a58a7..000000000 --- a/automation/inc/automation/commdefines.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#include -#include - -#ifndef MAKEDWORD -#define MAKEDWORD(wl, wh) ((sal_uInt32)((wl) & 0xFFFF) | (((sal_uInt32)(wh) & 0xFFFF) << 16)) -#endif -#ifndef LOWORD -#define LOWORD(d) ((sal_uInt16)((sal_uInt32)(d) & 0xFFFF)) -#endif -#ifndef HIWORD -#define HIWORD(d) ((sal_uInt16)(((sal_uInt32)(d) >> 16) & 0xFFFF)) -#endif -#ifndef MAKEWORD -#define MAKEWORD(bl, bh) ((sal_uInt16)((bl) & 0xFF) | (((sal_uInt16)(bh) & 0xFF) << 8)) -#endif -#ifndef LOBYTE -#define LOBYTE(w) ((comm_BYTE)((sal_uInt16)(w) & 0xFF)) -#endif -#ifndef HIBYTE -#define HIBYTE(w) ((comm_BYTE)(((sal_uInt16)(w) >> 8) & 0xFF)) -#endif -#ifndef MAKEBYTE -#define MAKEBYTE(nl, nh) ((comm_BYTE)(((nl) & 0x0F) | (((nh) & 0x0F) << 4))) -#endif -#ifndef LONIBBLE -#define LONIBBLE(b) ((comm_BYTE)((b) & 0x0F)) -#endif -#ifndef HINIBBLE -#define HINIBBLE(b) ((comm_BYTE)(((b) >> 4) & 0x0F)) -#endif - -#ifndef SWAPWORD -#define SWAPWORD(w) MAKEWORD(HIBYTE(w),LOBYTE(w)) -#endif -#ifndef SWAPDWORD -#define SWAPDWORD(d) MAKEDWORD(SWAPWORD(HIWORD(d)),SWAPWORD(LOWORD(d))) -#endif - -#ifdef OSL_BIGENDIAN -#ifndef NETWORD -#define NETWORD(w) (sal_uInt16)(w) -#endif -#ifndef NETDWORD -#define NETDWORD(d) (sal_uInt32)(d) -#endif -#endif // OSL_BIGENDIAN - -#ifdef OSL_LITENDIAN -#ifndef NETWORD -#define NETWORD(w) MAKEWORD(HIBYTE(w),LOBYTE(w)) -#endif -#ifndef NETDWORD -#define NETDWORD(d) MAKEDWORD(NETWORD(HIWORD(d)),NETWORD(LOWORD(d))) -#endif -#endif // OSL_LITENDIAN - -/** - Es gibt zwei arten von Datenpaketen - die erste enthält in den ersten 4 Byte die Längenangabe und in den Darauffolgenden die Daten - Die Längenangabe bezieht sich nur auf die Daten ohne die Längenangabe selbst. - - Die Zweite Art von Datenpaketen enthält Header mit weitere Informationen - wie unten beschrieben. - - Umgeschaltet wird mit dem Boolean bUseMultiChannel im Konstruktor des Managers. -**/ -/** -Defines für Header Typen: - -Allgemeiner Header: - Byte Länge Inhalt - 0..3 4 Länge des Paketes ohne diese 4 Byte - 4 1 Prüfsumme über die Länge. Stimmt sie nicht wird die Verbindung geschlossen - 5..6 2 Länge des Headers ohne diese 2 Byte - 7..8 2 Typ des Headers - -CH_SimpleMultiChannel: - 9..10 2 Channel -CH_Handshake Internal Use ONLY - Keine Weiteren Daten! - -**/ -typedef comm_UINT16 CMProtocol; - -#define CM_PROTOCOL_OLDSTYLE (CMProtocol)0x0001 -#define CM_PROTOCOL_MARS (CMProtocol)0x0001 -#define CM_PROTOCOL_BROADCASTER (CMProtocol)0x0002 -#define CM_PROTOCOL_USER_START (CMProtocol)0x0100 - -typedef comm_UINT16 HandshakeType; -typedef comm_UINT16 CommunicationOption; - -#define CH_NoHeader 0x0000 -#define CH_SimpleMultiChannel 0x0001 -#define CH_Handshake 0x0002 - -#define CH_REQUEST_HandshakeAlive ((HandshakeType)0x0101) /// Fordert eine Alive Antwort an -#define CH_RESPONSE_HandshakeAlive ((HandshakeType)0x0102) /// Alive Antwort - -/** - Announce supported options: - Client announces available options - Server returns subset of these options (note that the sbset can be the entire set also) -**/ -#define CH_SUPPORT_OPTIONS ((HandshakeType)0x0103) -#define OPT_USE_SHUTDOWN_PROTOCOL ((CommunicationOption)0x0001) - -/// these are for making sure all Data is read prior to shutting sown the link -#define CH_REQUEST_ShutdownLink ((HandshakeType)0x0104) /// Request to Shutdown this link -#define CH_ShutdownLink ((HandshakeType)0x0105) /// Shutdown this link - -#define CH_SetApplication ((HandshakeType)0x0106) /// Set Description of Client - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/automation/commtypes.hxx b/automation/inc/automation/commtypes.hxx deleted file mode 100644 index cb6bdfda2..000000000 --- a/automation/inc/automation/commtypes.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to supply the types and defines for Environment independent - * building of the packethandler - * Only adaption of this file should be necessary. Else it is a bug! - * Ether including apropriate files or defining the types when not available in the environment - * - ************************************************************************/ - -/** defines: - comm_BYTE - comm_BOOL - comm_UINT16 - comm_UINT32 - comm_UniChar -**/ - -#ifndef _COMMTYPES_HXX -#define _COMMTYPES_HXX - -#include -typedef sal_Unicode comm_UniChar; -#include "rtl/string.hxx" - -#include - -#include -typedef sal_uInt8 comm_BYTE; -typedef sal_Bool comm_BOOL; -typedef sal_uInt16 comm_UINT16; -typedef sal_uInt32 comm_UINT32; - -class String; -#define comm_String String - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/automation/communi.hxx b/automation/inc/automation/communi.hxx deleted file mode 100644 index 7b0ceb81b..000000000 --- a/automation/inc/automation/communi.hxx +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _COMMUNI_HXX -#define _COMMUNI_HXX - -#include -#include -#include -#include -#include - -class SvStream; -class SvMemoryStream; -//class Application; - -class CommunicationManagerServerAcceptThread; -SV_DECL_PTRARR_SORT( CommunicationLinkList, CommunicationLink*, 1, 10 ) - -class MultiCommunicationManager : public CommunicationManager -{ -public: - MultiCommunicationManager( sal_Bool bUseMultiChannel = sal_False ); - virtual ~MultiCommunicationManager(); - virtual sal_Bool StopCommunication(); - virtual sal_Bool IsLinkValid( CommunicationLink* pCL ); - virtual sal_uInt16 GetCommunicationLinkCount(); - virtual CommunicationLinkRef GetCommunicationLink( sal_uInt16 nNr ); - - void DoQuickShutdown( sal_Bool bQuickShutdown = sal_True) { bGracefullShutdown = !bQuickShutdown; } - -protected: - virtual void CallConnectionOpened( CommunicationLink* pCL ); - virtual void CallConnectionClosed( CommunicationLink* pCL ); - CommunicationLinkList *ActiveLinks; - CommunicationLinkList *InactiveLinks; /// Hier sind die CommunicationLinks drin, die sich noch nicht selbst abgemeldet haben. - /// allerdings schon ein StopCommunication gekriegt haben, bzw ein ConnectionTerminated - virtual void DestroyingLink( CommunicationLink *pCL ); - - sal_Bool bGracefullShutdown; -}; - -class CommunicationManagerServer : public MultiCommunicationManager -{ -public: - CommunicationManagerServer( sal_Bool bUseMultiChannel = sal_False ):MultiCommunicationManager( bUseMultiChannel ){;} -}; - -class CommunicationManagerClient : public MultiCommunicationManager, public ICommunicationManagerClient -{ -public: - CommunicationManagerClient( sal_Bool bUseMultiChannel = sal_False ); -}; - -class CommunicationLinkViaSocket : public SimpleCommunicationLinkViaSocket, public osl::Thread -{ -public: - CommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket ); - virtual ~CommunicationLinkViaSocket(); - - virtual sal_Bool IsCommunicationError(); - virtual sal_Bool DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE ); - - // Diese sind Virtuelle Links!!!! - virtual long ConnectionClosed( void* = NULL ); - virtual long DataReceived( void* = NULL ); - - virtual sal_Bool StopCommunication(); - - void SetPutDataReceivedHdl( Link lPutDataReceived ){ mlPutDataReceived = lPutDataReceived; } - Link GetDataReceivedLink () {Link aLink = LINK( this, CommunicationLinkViaSocket, DataReceived ); return aLink;} - DECL_LINK( PutDataReceivedHdl, CommunicationLinkViaSocket* ); - -protected: - virtual void SAL_CALL run(); - - virtual sal_Bool ShutdownCommunication(); - sal_uLong nConnectionClosedEventId; - sal_uLong nDataReceivedEventId; - osl::Mutex aMConnectionClosed; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist - osl::Mutex aMDataReceived; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist - virtual void WaitForShutdown(); - - DECL_LINK( ShutdownLink, void* ); - Timer aShutdownTimer; - sal_Bool bShutdownStarted; - sal_Bool bDestroying; - Link mlPutDataReceived; -}; - -class CommunicationManagerServerViaSocket : public CommunicationManagerServer -{ - friend class CommunicationManagerServerAcceptThread; -public: - using CommunicationManager::StartCommunication; - - CommunicationManagerServerViaSocket( sal_uLong nPort, sal_uInt16 nMaxCon, sal_Bool bUseMultiChannel = sal_False ); - virtual ~CommunicationManagerServerViaSocket(); - - virtual sal_Bool StartCommunication(); - virtual sal_Bool StopCommunication(); - -protected: - sal_uLong nPortToListen; - sal_uInt16 nMaxConnections; - -private: - CommunicationManagerServerAcceptThread *pAcceptThread; - void AddConnection( CommunicationLink *pNewConnection ); -}; - -class CommunicationManagerServerAcceptThread: public osl::Thread -{ -public: - CommunicationManagerServerAcceptThread( CommunicationManagerServerViaSocket* pServer, sal_uLong nPort, sal_uInt16 nMaxCon = CM_UNLIMITED_CONNECTIONS ); - virtual ~CommunicationManagerServerAcceptThread(); - CommunicationLinkRef GetNewConnection(){ CommunicationLinkRef xTemp = xmNewConnection; xmNewConnection.Clear(); return xTemp; } - -protected: - virtual void SAL_CALL run(); - -private: - CommunicationManagerServerViaSocket* pMyServer; - osl::AcceptorSocket* pAcceptorSocket; - sal_uLong nPortToListen; - sal_uInt16 nMaxConnections; - sal_uLong nAddConnectionEventId; - osl::Mutex aMAddConnection; // Notwendig, da Event verarbeitet werden kann bevor Variable gesetzt ist - void CallInfoMsg( InfoString aMsg ){ pMyServer->CallInfoMsg( aMsg ); } - CM_InfoType GetInfoType(){ return pMyServer->GetInfoType(); } - - // Diese beiden werden zum Transport der Connection vom Thread zum Mainthread verwendet. - CommunicationLinkRef xmNewConnection; - DECL_LINK( AddConnection, void* ); -}; - -class CommunicationManagerClientViaSocket : public CommunicationManagerClient, CommonSocketFunctions -{ -public: - using CommunicationManager::StartCommunication; - - CommunicationManagerClientViaSocket( sal_Bool bUseMultiChannel = sal_False ); - virtual ~CommunicationManagerClientViaSocket(); - - virtual sal_Bool StartCommunication(){ return StartCommunication( aHostToTalk, nPortToTalk );} - virtual sal_Bool StartCommunication( ByteString aHost, sal_uLong nPort ){ return DoStartCommunication( this, (ICommunicationManagerClient*) this, aHost, nPort );} - -private: - ByteString aHostToTalk; - sal_uLong nPortToTalk; -protected: - virtual CommunicationLink *CreateCommunicationLink( CommunicationManager *pCM, osl::ConnectorSocket* pCS ){ return new CommunicationLinkViaSocket( pCM, pCS ); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/automation/simplecm.hxx b/automation/inc/automation/simplecm.hxx deleted file mode 100644 index 5e4d19aae..000000000 --- a/automation/inc/automation/simplecm.hxx +++ /dev/null @@ -1,339 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SIMPLECM_HXX -#define _SIMPLECM_HXX - -#include -#include -#include -#include -#include -#include - -#include - -// CM steht f�r CommunicationManager -#define CM_UNLIMITED_CONNECTIONS 0xffff - -typedef sal_uInt16 CM_NameType; -#define CM_DOTTED ( (CM_NameType) 01 ) -#define CM_FQDN ( (CM_NameType) 02 ) - -typedef sal_uInt16 CM_InfoType; -// nur eines dieser 3 defines darf verwendet werden -#define CM_NO_TEXT ( (CM_InfoType) 01 ) -#define CM_SHORT_TEXT ( (CM_InfoType) 02 ) -#define CM_VERBOSE_TEXT ( (CM_InfoType) 03 ) - -#define CM_OPEN ( (CM_InfoType) 0x0004 ) -#define CM_CLOSE ( (CM_InfoType) 0x0008 ) -#define CM_RECEIVE ( (CM_InfoType) 0x0010 ) -#define CM_SEND ( (CM_InfoType) 0x0020 ) -#define CM_ERROR ( (CM_InfoType) 0x0040 ) -#define CM_MISC ( (CM_InfoType) 0x0080 ) - -#define CM_USER_1 ( (CM_InfoType) 0x0100 ) -#define CM_USER_2 ( (CM_InfoType) 0x0200 ) -#define CM_USER_3 ( (CM_InfoType) 0x0400 ) -#define CM_USER_4 ( (CM_InfoType) 0x0800 ) - -#define CM_ALL ( CM_OPEN | CM_CLOSE | CM_RECEIVE | CM_SEND | CM_ERROR | CM_MISC ) -#define CM_NONE ( 0 ) - -#define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) ) - -#define INFO_MSG( Short, Long, Type, CLink ) \ -{ \ - if ( (Type & GetInfoType()) > 0 ) \ - { \ - switch ( GetInfoType() & 03 ) \ - { \ - case CM_NO_TEXT: \ - { \ - ByteString aByteString; \ - CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \ - } \ - break; \ - case CM_SHORT_TEXT: \ - { \ - ByteString aByteString( Short ); \ - CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \ - } \ - break; \ - case CM_VERBOSE_TEXT: \ - { \ - ByteString aByteString( Long ); \ - CallInfoMsg( InfoString( aByteString, Type, CLink ) ); \ - } \ - break; \ - default: \ - break; \ - } \ - } \ -}\ - -class CommunicationLink; - -SV_DECL_REF( CommunicationLink ) - -class InfoString : public ByteString -{ -public: - InfoString( ByteString &nMsg, CM_InfoType nIT, CommunicationLink *pCL = NULL ): ByteString( nMsg ), nInfoType( nIT ), pCommLink( pCL ) {;} - CM_InfoType GetInfoType(){ return nInfoType; } - CommunicationLinkRef GetCommunicationLink(){ return pCommLink; } -private: - CM_InfoType nInfoType; - CommunicationLinkRef pCommLink; -}; - -class PacketHandler; -class CommunicationManager; -class MultiCommunicationManager; -class CommunicationManagerServerAcceptThread; -class CommunicationLink : public SvRefBase -{ -protected: - friend class CommunicationManager; - friend class MultiCommunicationManager; - friend class CommunicationManagerServerAcceptThread; - // Darf nicht abger�umt werden zwischen Empfang des Streams und ende des Callbacks - -protected: // so da� nur �ber Ref gel�scht werden kann - virtual ~CommunicationLink(); - void InvalidateManager() { pMyManager = NULL; } - - PacketHandler* pPacketHandler; - -public: - CommunicationLink( CommunicationManager *pMan ); - - virtual sal_Bool StopCommunication()=0; - virtual sal_Bool IsCommunicationError()=0; - CommunicationManager* GetCommunicationManager(){ return pMyManager; } - -// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren - virtual ByteString GetCommunicationPartner( CM_NameType eType )=0; - -// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren - virtual ByteString GetMyName( CM_NameType eType )=0; - -// Liefert einen neuen Stream zum Versenden von Daten. - virtual SvStream* GetBestCommunicationStream()=0; - - /** will call virtual function DoTransferDataStream to do actual work - Purpos is to allow housekeeping - **/ - sal_Bool TransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE ); - - // Liefert die ID, die vom Sender angegeben wurde. - // Dadurch lassen sich virtuelle Kommunikationen �ber einen physikalischen Link realisiren. - // Da die Kommunikation zu �lteren Versionen kompatibel bleiben mu�, mu� der Empf�nger raten, - // die neue oder die alte verwendet wird, da sich der Kopf eines Auftrages dann �ndert. - sal_uInt16 GetProtocol(){ return nServiceProtocol; } - - // Der Stream wird hier �bergeben. Der Aufrufer ist f�r dessen L�schung zust�ndig - // Die Methode MUSS gerufen werden, da sonst keine weiteren Daten empfangen werden. - SvStream* GetServiceData(){ SvStream *pTemp = pServiceData; pServiceData = NULL; return pTemp; } - - /// Erm�glicht das Ausl�sen des n�chsten Callbacks. Wird auch Implizit gerufen. - void FinishCallback(){ bIsInsideCallback = sal_False; } - - /// Syncrones Empfangen der Daten. Nur f�r Kommandozeile, sonst leer implementiert - virtual sal_Bool ReceiveDataStream(){ return sal_False; } - - /// Statistics - DateTime GetStart() { return aStart; } - sal_uLong GetTotalBytes() { return nTotalBytes; } - DateTime GetLastAccess() { return aLastAccess; } - const ByteString& GetApplication() { return maApplication; } - virtual void SetApplication( const ByteString& aApp ); - -protected: - void CallInfoMsg( InfoString aMsg ); - CM_InfoType GetInfoType(); - CommunicationManager *pMyManager; -// Diese Methoden werden im Main Kontext gerufen und an den Manager weitergereicht. - virtual DECL_LINK( ConnectionClosed, void* = NULL ); - virtual DECL_LINK( DataReceived, void* = NULL ); - - virtual sal_Bool DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE ); - - SvStream *pServiceData; - sal_uInt16 nServiceProtocol; - sal_uInt16 nServiceHeaderType; - - /// Verhindert das vorzeitige Ausl�sen des n�chsten Callbacks. - void StartCallback(){ bIsInsideCallback = sal_True; } - sal_Bool bIsInsideCallback; - - virtual sal_Bool SendHandshake( HandshakeType aHandshakeType, SvStream* pData = NULL)=0; - - virtual sal_Bool ShutdownCommunication() = 0; /// Really stop the Communication - - /// Statistics - DateTime aStart; - sal_uLong nTotalBytes; - DateTime aLastAccess; - -private: - ByteString maApplication; - -#if OSL_DEBUG_LEVEL > 1 -public: - // misc (debuging) purposes - sal_Bool bFlag; - sal_uLong nSomething; -#endif - -}; - -SV_IMPL_REF( CommunicationLink ); - -class CommonSocketFunctions; -class CommunicationManager -{ - friend class CommunicationLink; - friend class CommonSocketFunctions; -public: - CommunicationManager( sal_Bool bUseMultiChannel = sal_False ); - virtual ~CommunicationManager(); - - virtual sal_Bool StartCommunication()=0; - virtual sal_Bool StartCommunication( String aApp, String aParams ); - virtual sal_Bool StartCommunication( ByteString aHost, sal_uLong nPort ); - virtual sal_Bool StopCommunication()=0; // H�lt alle CommunicationLinks an - virtual sal_Bool IsCommunicationRunning() { return bIsCommunicationRunning; } -// virtual sal_Bool IsCommunicationError(); - -// Der Name oder die IP-Adresse oder sonstwas um den Communikationspartner zu identifizieren - virtual ByteString GetMyName( CM_NameType eType ); - - virtual sal_Bool IsLinkValid( CommunicationLink* pCL )=0; // Notwendig f�r call im Destruktor - - virtual sal_uInt16 GetCommunicationLinkCount()=0; - virtual CommunicationLinkRef GetCommunicationLink( sal_uInt16 nNr )=0; - - // Liefert den letzten neuen Link oder NULL wenn dieser schon wieder geschlossen ist. - CommunicationLinkRef GetLastNewLink() { return xLastNewLink; } - - void SetConnectionOpenedHdl( Link lConnectionOpened ){ mlConnectionOpened = lConnectionOpened; } - void SetConnectionClosedHdl( Link lConnectionClosed ){ mlConnectionClosed = lConnectionClosed; } - void SetDataReceivedHdl( Link lDataReceived ){ mlDataReceived = lDataReceived; } - void SetInfoMsgHdl( Link lInfoMsg ){ mlInfoMsg = lInfoMsg; } - - void SetInfoType( CM_InfoType nIT ){ nInfoType = nIT; } - CM_InfoType GetInfoType(){ return nInfoType; } - - sal_Bool IsMultiChannel(){ return bIsMultiChannel; } - void SetApplication( const ByteString& aApp, sal_Bool bRunningLinks = sal_False ); - const ByteString& GetApplication() { return maApplication; } - -protected: - // Diese Methoden werden innerhalb gerufen. Sie erledigen eventuelles Housekeeping - // und rufen dann die entsprechende Methode - virtual void CallConnectionOpened( CommunicationLink* pCL ); - virtual void CallConnectionClosed( CommunicationLink* pCL ); - void CallDataReceived( CommunicationLink* pCL ); - void CallInfoMsg( InfoString aMsg ); - - CM_InfoType nInfoType; - - // Diese Routinen rufen den Link oder sind �berladen - virtual void ConnectionOpened( CommunicationLink* pCL ){ mlConnectionOpened.Call( pCL ); } - virtual void ConnectionClosed( CommunicationLink* pCL ){ mlConnectionClosed.Call( pCL ); } - virtual void DataReceived( CommunicationLink* pCL ){ mlDataReceived.Call( pCL ); } - virtual void InfoMsg( InfoString aMsg ){ mlInfoMsg.Call( &aMsg ); } - - sal_Bool bIsCommunicationRunning; - - virtual void DestroyingLink( CommunicationLink *pCL )=0; // Link tr�gt sich im Destruktor aus - -private: - ByteString maApplication; - Link mlConnectionOpened; - Link mlConnectionClosed; - Link mlDataReceived; - Link mlInfoMsg; - CommunicationLinkRef xLastNewLink; - - sal_Bool bIsMultiChannel; -}; - -class ICommunicationManagerClient -{ - friend class CommonSocketFunctions; -protected: - virtual sal_Bool RetryConnect() { return sal_False; } // Kann dann eventuell die Applikation starten -}; - -class TCPIO; -class SimpleCommunicationLinkViaSocket : public CommunicationLink -{ -public: - virtual sal_Bool IsCommunicationError(); - virtual sal_Bool StopCommunication(); - - virtual ByteString GetCommunicationPartner( CM_NameType eType ); - virtual ByteString GetMyName( CM_NameType eType ); - virtual SvStream* GetBestCommunicationStream(); - virtual void SetApplication( const ByteString& aApp ); - -private: - ByteString aCommunicationPartner; - ByteString aMyName; - - TCPIO* pTCPIO; - osl::StreamSocket* pStreamSocket; - -protected: - SimpleCommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket ); - virtual ~SimpleCommunicationLinkViaSocket(); - - osl::StreamSocket* GetStreamSocket() { return pStreamSocket; } - void SetStreamSocket( osl::StreamSocket* pSocket ); - - SvStream *pReceiveStream; - sal_Bool DoReceiveDataStream(); /// Recieve DataPacket from Socket - virtual sal_Bool SendHandshake( HandshakeType aHandshakeType, SvStream* pData = NULL); - sal_Bool bIsRequestShutdownPending; - virtual void WaitForShutdown()=0; - void SetNewPacketAsCurrent(); -}; - -class CommonSocketFunctions -{ -public: - sal_Bool DoStartCommunication( CommunicationManager *pCM, ICommunicationManagerClient *pCMC, ByteString aHost, sal_uLong nPort ); -protected: - virtual CommunicationLink *CreateCommunicationLink( CommunicationManager *pCM, osl::ConnectorSocket* pCS )=0; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/makefile.mk b/automation/inc/makefile.mk deleted file mode 100644 index 782b6a805..000000000 --- a/automation/inc/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=.. - -PRJNAME=automation -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" - diff --git a/automation/inc/pch/precompiled_automation.cxx b/automation/inc/pch/precompiled_automation.cxx deleted file mode 100644 index 0c5612989..000000000 --- a/automation/inc/pch/precompiled_automation.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_automation.hxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/inc/pch/precompiled_automation.hxx b/automation/inc/pch/precompiled_automation.hxx deleted file mode 100644 index 8f1227723..000000000 --- a/automation/inc/pch/precompiled_automation.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:30.061723 - -#ifdef PRECOMPILED_HEADERS -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/packimages/makefile.mk b/automation/packimages/makefile.mk deleted file mode 100644 index 305954171..000000000 --- a/automation/packimages/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=.. -PRJNAME=automation -TARGET=packimages -RSCCUSTOMIMG*=$(PRJ)$/util - -# point to an existing directory as default that poses no threat -# to a "find" that looks for "*.png" -RSCCUSTOMIMG*=$(PRJNAME)$/util - -# point to an existing directory as default that poses no threat -# to a "find" that looks for "*.png" -RSCCUSTOMIMG*=$(PRJNAME)$/util - -.INCLUDE: settings.mk - -.INCLUDE: target.mk - -ALLTAR : \ - $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(BIN))$/images_tt.zip - -#solarenv = j:\so-cwsserv04\gh7\SRC680\src.m50\solenv -#outpath = wntmsci10 -#common_outdir = common -#solarresdir = j:\so-cwsserv04\gh7\SRC680\wntmsci10\res.m50 - - -$(subst,$(OUTPATH),$(COMMON_OUTDIR) $(BIN))$/images_tt.zip .PHONY: - @echo ------------------------------ - @echo Making: $@ - $(COMMAND_ECHO)$(COPY) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(SOLARRESDIR))$/img$/stt*.ilst $(MISC) - $(COMMAND_ECHO)$(COPY) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(SOLARRESDIR))$/img$/svt*.ilst $(MISC) - $(COMMAND_ECHO)$(COPY) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(SOLARRESDIR))$/img$/fps*.ilst $(MISC) - $(COMMAND_ECHO)$(COPY) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(SOLARRESDIR))$/img$/vcl*.ilst $(MISC) - $(COMMAND_ECHO)$(COPY) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(SOLARRESDIR))$/img$/sb*.ilst $(MISC) - @-$(MKDIR) $(subst,$(OUTPATH),$(COMMON_OUTDIR) $(BIN)) >& $(NULLDEV) - $(COMMAND_ECHO)$(PERL) $(SOLARENV)$/bin$/packimages.pl -g $(SOLARSRC)$/$(RSCDEFIMG) -m $(SOLARSRC)$/$(RSCDEFIMG) -c $(RSCCUSTOMIMG) -l $(MISC) -o $@ diff --git a/automation/prj/build.lst b/automation/prj/build.lst deleted file mode 100644 index b019873f0..000000000 --- a/automation/prj/build.lst +++ /dev/null @@ -1,11 +0,0 @@ -au automation : basic fpicker NULL -au automation usr1 - all au_mkout NULL -au automation\inc nmake - all au_inc NULL -au automation\source\simplecm nmake - all au_scom au_inc NULL -au automation\source\communi nmake - all au_comm au_inc NULL -au automation\source\app nmake - all au_app au_inc NULL -au automation\source\server nmake - all au_server au_inc NULL -au automation\source\testtool nmake - all au_tt au_inc NULL -au automation\source\miniapp nmake - all au_mini au_inc NULL -au automation\packimages nmake - all au_pack NULL -au automation\util nmake - all au_util au_scom au_comm au_app au_mini au_server au_tt NULL diff --git a/automation/prj/d.lst b/automation/prj/d.lst deleted file mode 100644 index 69f82e4ad..000000000 --- a/automation/prj/d.lst +++ /dev/null @@ -1,27 +0,0 @@ -mkdir: %COMMON_DEST%\bin\hid -mkdir: %_DEST%\inc\automation - -#..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin\hid\*.hid -..\util\manually_added_ids.hid %COMMON_DEST%\bin\hid\manually_added_ids.hid -..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll -..\%__SRC%\lib\lib* %_DEST%\lib\* -..\%__SRC%\lib\ists.lib %_DEST%\lib\ists.lib -..\%__SRC%\lib\isimplecm.lib %_DEST%\lib\isimplecm.lib -..\%__SRC%\lib\icommuni.lib %_DEST%\lib\icommuni.lib - -..\inc\automation\automation.hxx %_DEST%\inc\automation\automation.hxx -..\inc\automation\commdefines.hxx %_DEST%\inc\automation\commdefines.hxx -..\inc\automation\commtypes.hxx %_DEST%\inc\automation\commtypes.hxx -..\inc\automation\communi.hxx %_DEST%\inc\automation\communi.hxx -..\inc\automation\simplecm.hxx %_DEST%\inc\automation\simplecm.hxx - -..\%__SRC%\bin\testtool.exe %_DEST%\bin\testtool.bin -..\%__SRC%\bin\testtool %_DEST%\bin\testtool.bin -..\%__SRC%\inc\classes %_DEST%\bin\classes -..\%__SRC%\inc\keycodes %_DEST%\bin\keycodes -..\%__SRC%\inc\res_type %_DEST%\bin\res_type - -..\%COMMON_OUTDIR%\bin\images_tt.zip %COMMON_DEST%\bin\images_tt.zip - -..\%__SRC%\bin\testtoolrc %_DEST%\lib\testtoolrc -..\%__SRC%\bin\testtool.ini %_DEST%\bin\testtool.ini diff --git a/automation/prj/l10n b/automation/prj/l10n deleted file mode 100644 index 69f0d9e5e..000000000 --- a/automation/prj/l10n +++ /dev/null @@ -1 +0,0 @@ -#i49922# In this module en-US and de are used as source language diff --git a/automation/source/app/makefile.mk b/automation/source/app/makefile.mk deleted file mode 100644 index 8a430b3c3..000000000 --- a/automation/source/app/makefile.mk +++ /dev/null @@ -1,52 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=app - -# --- Settings ------------------------------------------------------------ - -.INCLUDE : settings.mk - -# --- Allgemein ------------------------------------------------------------ - -CXXFILES = \ - testbasi.cxx - - -OBJFILES = \ - $(OBJ)$/testbasi.obj - - -LIBTARGET = NO - - -# --- Targets ------------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/automation/source/app/testbasi.cxx b/automation/source/app/testbasi.cxx deleted file mode 100644 index bafcf7c37..000000000 --- a/automation/source/app/testbasi.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include - -#include -#include -#include "testbasi.hxx" -#define P_FEHLERLISTE TestToolObj::pFehlerListe - -#include -#include - -TYPEINIT1(TTBasic,MyBasic) - -/*class MyFactory : public SbxFactory -{ -public: - virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX ); -}; - -static SampleObjectFac aFac1; -static MyFactory aFac2; -static CommunicationFactory aComManFac; -static ProcessFactory aProcessFac; -static short nInst = 0; - -SbxBase* MyFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCr ) -{ - if( nCr == SBXCR_TEST && nSbxId == SBXID_MYBASIC ) - return new MyBasic; - else - return NULL; -} */ - -TTBasic::TTBasic() : MyBasic() -{ -// Eigenes Objekt reinbraten - TestToolObj* pTTO = new TestToolObj( CUniString("App"), this ); - pTTO->SetLogHdl( GenLogHdl() ); - pTTO->SetWinInfoHdl( GenWinInfoHdl() ); - pTTO->SetModuleWinExistsHdl( GenModuleWinExistsHdl() ); - pTTO->SetWriteStringHdl( GenWriteStringHdl() ); - pTTO->SetCErrorHdl( LINK( this, TTBasic, CErrorImpl ) ); - - StartListeningTT( pTTO->GetTTBroadcaster() ); - - pTestObject = pTTO; - pTestObject->SetFlag( SBX_EXTSEARCH ); - Insert( pTestObject ); -} - -MyBasic* TTBasic::CreateMyBasic() -{ - return new TTBasic(); -} - -void TTBasic::LoadIniFile() -{ - ((TestToolObj*)pTestObject)->LoadIniFile(); -} - -SbTextType TTBasic::GetSymbolType( const String &rSymbol, sal_Bool bWasTTControl ) -{ - return ((TestToolObj*)pTestObject)->GetSymbolType( rSymbol, bWasTTControl ); -} - - -TTBasic::~TTBasic() -{ -} - -IMPL_LINK( TTBasic, CErrorImpl, ErrorEntry*, pData ) -{ - return CError( pData->nError, pData->aText, pData->nLine, pData->nCol1, pData->nCol2 ); -} - -sal_Bool TTBasic::Compile( SbModule* p ) -{ - p->SetComment( ((TestToolObj*)pTestObject)->GetRevision(p->GetSource()) ); - SbModule* pOldModule = GetCompileModule(); - SetCompileModule( p ); - p->SetSource( ((TestToolObj*)pTestObject)->PreCompile(p->GetSource()) ); - SetCompileModule( pOldModule ); - if ( ((TestToolObj*)pTestObject)->WasPrecompilerError() ) - return sal_False; - return MyBasic::Compile( p ); -} - -const String TTBasic::GetSpechialErrorText() -{ - String nErrorText; - if ( pTestObject && IS_ERROR() && GetErrorCode() == GET_ERROR()->nError ) - { - nErrorText = GenRealString( GET_ERROR()->aText ); - nErrorText.AppendAscii( ": " ); - nErrorText += String::CreateFromInt64( GET_ERROR()->nError ); - } - else - { - nErrorText = GetErrorText(); - } - return nErrorText; -} - -void TTBasic::ReportRuntimeError( AppBasEd *pEditWin ) -{ - SbxVariableRef aDummy = new SbxVariable; - aDummy->SetUserData( 24 ); // ID_MaybeAddErr - ((TestToolObj*)pTestObject)->Notify( pTestObject->GetBroadcaster(), SbxHint( SBX_HINT_DATAWANTED, aDummy ) ); - aDummy->SetUserData( 18 ); // ID_ExceptLog - ((TestToolObj*)pTestObject)->Notify( pTestObject->GetBroadcaster(), SbxHint( SBX_HINT_DATAWANTED, aDummy ) ); - MyBasic::ReportRuntimeError( pEditWin ); -} - -void TTBasic::DebugFindNoErrors( sal_Bool bDebugFindNoErrors ) -{ - ((TestToolObj*)pTestObject)->DebugFindNoErrors( bDebugFindNoErrors ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/app/testbasi.hxx b/automation/source/app/testbasi.hxx deleted file mode 100644 index 32e037ee9..000000000 --- a/automation/source/app/testbasi.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TTBASIC_HXX -#define _TTBASIC_HXX - -#include -#include - -class ErrorEntry; - -#define SBXID_TTBASIC 0x5454 // TTBasic: TT - -#define SBXCR_TEST2 0x54534554L // TEST - -class TTBasic : public MyBasic -{ -public: - SBX_DECL_PERSIST_NODATA(SBXCR_TEST2,SBXID_TTBASIC,1); - TYPEINFO(); - TTBasic(); - ~TTBasic(); - sal_Bool Compile( SbModule* ); - static MyBasic* CreateMyBasic(); - - // nicht mit #ifdefs klammern, da diese Headerdatei für testtool und basic - // gleichermaßen verwendet wird. - DECL_LINK( CErrorImpl, ErrorEntry* ); -// SbxObject *pTestObject; // für das Testtool; ansonsten NULL - - void LoadIniFile(); - SbTextType GetSymbolType( const String &Symbol, sal_Bool bWasTTControl ); // Besimmt den erweiterten Symboltyp für das Syntaxhighlighting - virtual const String GetSpechialErrorText(); - virtual void ReportRuntimeError( AppBasEd *pEditWin ); - virtual void DebugFindNoErrors( sal_Bool bDebugFindNoErrors ); -}; - -SV_DECL_IMPL_REF(TTBasic) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx deleted file mode 100644 index 876ae1192..000000000 --- a/automation/source/communi/communi.cxx +++ /dev/null @@ -1,582 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#if OSL_DEBUG_LEVEL > 1 -#define DEBUGPRINTF(x) { printf(x); fflush( stdout ); } -#else -#define DEBUGPRINTF(x) -#endif -#include -#include -#include -#include -#include -#include - -#include - - -/* Um den Destruktor protected zu machen wurde unten das delete entfernt. - Die Methode wird ohnehin hucht benutzt. -// delete *((AE*)pData+n); -*/ - -#undef SV_IMPL_PTRARR_SORT -#define SV_IMPL_PTRARR_SORT( nm,AE )\ -_SV_IMPL_SORTAR_ALG( nm,AE )\ - void nm::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { \ - if( nL ) {\ - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );\ - for( sal_uInt16 n=nP; n < nP + nL; n++ ) \ - OSL_FAIL("Das Element der Liste wurde nicht gel�scht"); \ - SvPtrarr::Remove( nP, nL ); \ - } \ - } \ -_SV_SEEK_PTR( nm, AE ) - - - - -SV_IMPL_PTRARR_SORT( CommunicationLinkList, CommunicationLink* ); - -osl::Mutex *pMPostUserEvent=NULL; // Notwendig, da nicht threadfest - -CommunicationLinkViaSocket::CommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket ) -: SimpleCommunicationLinkViaSocket( pMan, pSocket ) -, nConnectionClosedEventId( 0 ) -, nDataReceivedEventId( 0 ) -, bShutdownStarted( sal_False ) -, bDestroying( sal_False ) -{ - SetPutDataReceivedHdl(LINK( this, CommunicationLinkViaSocket, PutDataReceivedHdl )); - if ( !pMPostUserEvent ) - pMPostUserEvent = new osl::Mutex; - // this is necassary to prevent the running thread from sending the close event - // before the open event has been sent. - StartCallback(); - - create(); -} - -CommunicationLinkViaSocket::~CommunicationLinkViaSocket() -{ - bDestroying = sal_True; - StopCommunication(); - while ( nConnectionClosedEventId || nDataReceivedEventId ) - GetpApp()->Yield(); - { - osl::MutexGuard aGuard( aMConnectionClosed ); - if ( nConnectionClosedEventId ) - { - GetpApp()->RemoveUserEvent( nConnectionClosedEventId ); - nConnectionClosedEventId = 0; - INFO_MSG( CByteString("Event gel�scht"), - CByteString( "ConnectionClosedEvent aus Queue gel�scht"), - CM_MISC, NULL ); - } - } - { - osl::MutexGuard aGuard( aMDataReceived ); - if ( nDataReceivedEventId ) - { - GetpApp()->RemoveUserEvent( nDataReceivedEventId ); - nDataReceivedEventId = 0; - delete GetServiceData(); - INFO_MSG( CByteString("Event gel�scht"), - CByteString( "DataReceivedEvent aus Queue gel�scht"), - CM_MISC, NULL ); - } - } -} - -sal_Bool CommunicationLinkViaSocket::ShutdownCommunication() -{ - if ( isRunning() ) - { - - terminate(); - if ( GetStreamSocket() ) - GetStreamSocket()->shutdown(); - - if ( GetStreamSocket() ) // Mal wieder nach oben verschoben, da sonst nicht vom Read runtergesprungen wird. - GetStreamSocket()->close(); - - resume(); // So da� das run auch die Schleife verlassen kann - - join(); - - osl::StreamSocket* pTempSocket = GetStreamSocket(); - SetStreamSocket( NULL ); - delete pTempSocket; - -// ConnectionClosed(); Wird am Ende des Thread gerufen - - } - else - { - join(); - } - - return sal_True; -} - -sal_Bool CommunicationLinkViaSocket::StopCommunication() -{ - if ( !bShutdownStarted ) - { - return SimpleCommunicationLinkViaSocket::StopCommunication(); - } - else - { - WaitForShutdown(); - return sal_True; - } -} - - -IMPL_LINK( CommunicationLinkViaSocket, ShutdownLink, void*, EMPTYARG ) -{ - if ( !IsCommunicationError() ) - ShutdownCommunication(); - return 0; -} - - -void CommunicationLinkViaSocket::WaitForShutdown() -{ - if ( !bShutdownStarted ) - { - aShutdownTimer.SetTimeout( 30000 ); // Should be 30 Seconds - aShutdownTimer.SetTimeoutHdl( LINK( this, CommunicationLinkViaSocket, ShutdownLink ) ); - aShutdownTimer.Start(); - bShutdownStarted = sal_True; - } - if ( bDestroying ) - { - while ( pMyManager && aShutdownTimer.IsActive() ) - { - if ( IsCommunicationError() ) - return; - GetpApp()->Yield(); - } - ShutdownCommunication(); - } -} - -sal_Bool CommunicationLinkViaSocket::IsCommunicationError() -{ - return !isRunning() || SimpleCommunicationLinkViaSocket::IsCommunicationError(); -} - -void CommunicationLinkViaSocket::run() -{ - sal_Bool bWasError = sal_False; - while ( schedule() && !bWasError && GetStreamSocket() ) - { - if ( bWasError |= !DoReceiveDataStream() ) - continue; - - TimeValue sNochEins = {0, 1000000}; - while ( schedule() && bIsInsideCallback ) // solange der letzte Callback nicht beendet ist - wait( sNochEins ); - SetNewPacketAsCurrent(); - StartCallback(); - { - osl::MutexGuard aGuard( aMDataReceived ); - osl::MutexGuard aGuard2( *pMPostUserEvent ); - mlPutDataReceived.Call(this); - } - } - TimeValue sNochEins = {0, 1000000}; - while ( schedule() && bIsInsideCallback ) // solange der letzte Callback nicht beendet ist - wait( sNochEins ); - - StartCallback(); - { - osl::MutexGuard aGuard( aMConnectionClosed ); - osl::MutexGuard aGuard2( *pMPostUserEvent ); - nConnectionClosedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLinkViaSocket, ConnectionClosed ) ); - } -} - -sal_Bool CommunicationLinkViaSocket::DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol ) -{ - if ( !isRunning() ) - return sal_False; - - return SimpleCommunicationLinkViaSocket::DoTransferDataStream( pDataStream, nProtocol ); -} - -/// Dies ist ein virtueller Link!!! -long CommunicationLinkViaSocket::ConnectionClosed( void* EMPTYARG ) -{ - { - osl::MutexGuard aGuard( aMConnectionClosed ); - nConnectionClosedEventId = 0; // Achtung!! alles andere mu� oben gemacht werden. - } - ShutdownCommunication(); - return CommunicationLink::ConnectionClosed( ); -} - -/// Dies ist ein virtueller Link!!! -long CommunicationLinkViaSocket::DataReceived( void* EMPTYARG ) -{ - { - osl::MutexGuard aGuard( aMDataReceived ); - nDataReceivedEventId = 0; // Achtung!! alles andere mu� oben gemacht werden. - } - return CommunicationLink::DataReceived( ); -} - -IMPL_LINK( CommunicationLinkViaSocket, PutDataReceivedHdl, CommunicationLinkViaSocket*, EMPTYARG ) -{ - nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLink, DataReceived ) ); - return 0; -} - - - -MultiCommunicationManager::MultiCommunicationManager( sal_Bool bUseMultiChannel ) -: CommunicationManager( bUseMultiChannel ) -, bGracefullShutdown( sal_True ) -{ - ActiveLinks = new CommunicationLinkList; - InactiveLinks = new CommunicationLinkList; -} - -MultiCommunicationManager::~MultiCommunicationManager() -{ - StopCommunication(); - - if ( bGracefullShutdown ) // first try to collect all callbacks for closing channels - { - Timer aTimeout; - aTimeout.SetTimeout( 40000 ); - aTimeout.Start(); - sal_uInt16 nLinkCount = 0; - sal_uInt16 nNewLinkCount = 0; - while ( aTimeout.IsActive() ) - { - GetpApp()->Yield(); - nNewLinkCount = GetCommunicationLinkCount(); - if ( nNewLinkCount == 0 ) - aTimeout.Stop(); - if ( nNewLinkCount != nLinkCount ) - { - aTimeout.Start(); - nLinkCount = nNewLinkCount; - } - } - } - - // Alles weghauen, was nicht rechtzeitig auf die B�ume gekommen ist - // Was bei StopCommunication �brig geblieben ist, da es sich asynchron austragen wollte - sal_uInt16 i = ActiveLinks->Count(); - while ( i-- ) - { - CommunicationLinkRef rTempLink = ActiveLinks->GetObject( i ); - ActiveLinks->Remove( i ); - rTempLink->InvalidateManager(); - rTempLink->ReleaseReference(); - } - delete ActiveLinks; - - /// Die Links zwischen ConnectionClosed und Destruktor. - /// Hier NICHT gerefcounted, da sie sich sonst im Kreis festhaten w�rden, - /// da die Links sich erst in ihrem Destruktor austragen - i = InactiveLinks->Count(); - while ( i-- ) - { - CommunicationLinkRef rTempLink = InactiveLinks->GetObject( i ); - InactiveLinks->Remove( i ); - rTempLink->InvalidateManager(); - } - delete InactiveLinks; -} - -sal_Bool MultiCommunicationManager::StopCommunication() -{ - // Alle Verbindungen abbrechen - // ConnectionClosed entfernt die Links aus der Liste. Je nach Implementation syncron - // oder asyncron. Daher Von oben nach unten Abr�umen, so da� sich nichts verschiebt. - sal_uInt16 i = ActiveLinks->Count(); - int nFail = 0; - while ( i ) - { - if ( !ActiveLinks->GetObject(i-1)->StopCommunication() ) - nFail++; // Hochz�hlen, da Verbindung sich nicht (sofort) beenden l�sst. - i--; - } - - return nFail == 0; -} - -sal_Bool MultiCommunicationManager::IsLinkValid( CommunicationLink* pCL ) -{ - if ( ActiveLinks->Seek_Entry( pCL ) ) - return sal_True; - else - return sal_False; -} - -sal_uInt16 MultiCommunicationManager::GetCommunicationLinkCount() -{ - return ActiveLinks->Count(); -} - -CommunicationLinkRef MultiCommunicationManager::GetCommunicationLink( sal_uInt16 nNr ) -{ - return ActiveLinks->GetObject( nNr ); -} - -void MultiCommunicationManager::CallConnectionOpened( CommunicationLink* pCL ) -{ - CommunicationLinkRef rHold(pCL); // H�lt den Zeiger bis zum Ende des calls - ActiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); - rHold->AddRef(); - - CommunicationManager::CallConnectionOpened( pCL ); -} - -void MultiCommunicationManager::CallConnectionClosed( CommunicationLink* pCL ) -{ - CommunicationLinkRef rHold(pCL); // H�lt denm Zeiger bis zum Ende des calls - - CommunicationManager::CallConnectionClosed( pCL ); - - sal_uInt16 nPos; - if ( ActiveLinks->Seek_Entry( pCL, &nPos ) ) - { - InactiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); // Ohne Reference - ActiveLinks->Remove( nPos ); - } - pCL->ReleaseReference(); - - bIsCommunicationRunning = ActiveLinks->Count() > 0; -// delete pCL; -#if OSL_DEBUG_LEVEL > 1 - rHold->bFlag = sal_True; -#endif -} - -void MultiCommunicationManager::DestroyingLink( CommunicationLink *pCL ) -{ - sal_uInt16 nPos; - if ( InactiveLinks->Seek_Entry( pCL, &nPos ) ) - InactiveLinks->Remove( nPos ); - pCL->InvalidateManager(); -} - - - -CommunicationManagerClient::CommunicationManagerClient( sal_Bool bUseMultiChannel ) -: MultiCommunicationManager( bUseMultiChannel ) -{ - ByteString aApplication("Something inside "); - aApplication.Append( ByteString( DirEntry( Application::GetAppFileName() ).GetName(), gsl_getSystemTextEncoding() ) ); - SetApplication( aApplication ); -} - - - -CommunicationManagerServerViaSocket::CommunicationManagerServerViaSocket( sal_uLong nPort, sal_uInt16 nMaxCon, sal_Bool bUseMultiChannel ) -: CommunicationManagerServer( bUseMultiChannel ) -, nPortToListen( nPort ) -, nMaxConnections( nMaxCon ) -, pAcceptThread( NULL ) -{ -} - -CommunicationManagerServerViaSocket::~CommunicationManagerServerViaSocket() -{ - StopCommunication(); -} - -sal_Bool CommunicationManagerServerViaSocket::StartCommunication() -{ - if ( !pAcceptThread ) - pAcceptThread = new CommunicationManagerServerAcceptThread( this, nPortToListen, nMaxConnections ); - return sal_True; -} - - -sal_Bool CommunicationManagerServerViaSocket::StopCommunication() -{ - // Erst den Acceptor anhalten - delete pAcceptThread; - pAcceptThread = NULL; - - // Dann alle Verbindungen kappen - return CommunicationManagerServer::StopCommunication(); -} - - -void CommunicationManagerServerViaSocket::AddConnection( CommunicationLink *pNewConnection ) -{ - CallConnectionOpened( pNewConnection ); -} - - -CommunicationManagerServerAcceptThread::CommunicationManagerServerAcceptThread( CommunicationManagerServerViaSocket* pServer, sal_uLong nPort, sal_uInt16 nMaxCon ) -: pMyServer( pServer ) -, pAcceptorSocket( NULL ) -, nPortToListen( nPort ) -, nMaxConnections( nMaxCon ) -, nAddConnectionEventId( 0 ) -, xmNewConnection( NULL ) -{ - if ( !pMPostUserEvent ) - pMPostUserEvent = new osl::Mutex; - create(); -} - - -CommunicationManagerServerAcceptThread::~CommunicationManagerServerAcceptThread() -{ -#ifndef aUNX // Weil das Accept nicht abgebrochen werden kann, so terminiert wenigstens das Prog - // #62855# pl: gilt auch bei anderen Unixen - // die richtige Loesung waere natuerlich, etwas auf die pipe zu schreiben, - // was der thread als Abbruchbedingung erkennt - // oder wenigstens ein kill anstatt join - terminate(); - if ( pAcceptorSocket ) - pAcceptorSocket->close(); // Dann das Accept unterbrechen - - join(); // Warten bis fertig - - if ( pAcceptorSocket ) - { - delete pAcceptorSocket; - pAcceptorSocket = NULL; - } -#else - DEBUGPRINTF ("Destructor CommunicationManagerServerAcceptThread �bersprungen!!!! (wegen Solaris BUG)\n"); -#endif - { - osl::MutexGuard aGuard( aMAddConnection ); - if ( nAddConnectionEventId ) - { - GetpApp()->RemoveUserEvent( nAddConnectionEventId ); - nAddConnectionEventId = 0; - CommunicationLinkRef xNewConnection = GetNewConnection(); - INFO_MSG( CByteString("Event gel�scht"), - CByteString( "AddConnectionEvent aus Queue gel�scht"), - CM_MISC, xNewConnection ); - xNewConnection->InvalidateManager(); - xNewConnection.Clear(); // sollte das Objekt hier l�schen - } - } -} - -void CommunicationManagerServerAcceptThread::run() -{ - if ( !nPortToListen ) - return; - - pAcceptorSocket = new osl::AcceptorSocket(); - osl::SocketAddr Addr; - Addr.setPort( nPortToListen ); - pAcceptorSocket->setOption( osl_Socket_OptionReuseAddr, 1 ); - if ( !pAcceptorSocket->bind( Addr ) ) - { - return; - } - if ( !pAcceptorSocket->listen( nMaxConnections ) ) - { - return; - } - - - osl::StreamSocket* pStreamSocket = NULL; - - while ( schedule() ) - { - pStreamSocket = new osl::StreamSocket; - switch ( pAcceptorSocket->acceptConnection( *pStreamSocket ) ) - { - case osl_Socket_Ok: - { - pStreamSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 ); - - TimeValue sNochEins = {0, 100}; - while ( schedule() && xmNewConnection.Is() ) // Solange die letzte Connection nicht abgeholt wurde warten wir - wait( sNochEins ); - xmNewConnection = new CommunicationLinkViaSocket( pMyServer, pStreamSocket ); - xmNewConnection->StartCallback(); - { - osl::MutexGuard aGuard( aMAddConnection ); - osl::MutexGuard aGuard2( *pMPostUserEvent ); - nAddConnectionEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationManagerServerAcceptThread, AddConnection ) ); - } - } - break; - case osl_Socket_TimedOut: - delete pStreamSocket; - pStreamSocket = NULL; - break; - case osl_Socket_Error: - delete pStreamSocket; - pStreamSocket = NULL; - break; - - case osl_Socket_Interrupted: - case osl_Socket_InProgress: - default: - break; - } - } -} - - -IMPL_LINK( CommunicationManagerServerAcceptThread, AddConnection, void*, EMPTYARG ) -{ - { - osl::MutexGuard aGuard( aMAddConnection ); - nAddConnectionEventId = 0; - } - pMyServer->AddConnection( xmNewConnection ); - xmNewConnection.Clear(); - return 1; -} - -CommunicationManagerClientViaSocket::CommunicationManagerClientViaSocket( sal_Bool bUseMultiChannel ) -: CommunicationManagerClient( bUseMultiChannel ) -, aHostToTalk( "" ) -, nPortToTalk( 0 ) -{ -} - -CommunicationManagerClientViaSocket::~CommunicationManagerClientViaSocket() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/communi/makefile.mk b/automation/source/communi/makefile.mk deleted file mode 100644 index b4ca9c67e..000000000 --- a/automation/source/communi/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=communi - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(EXCEPTIONSFILES) - -EXCEPTIONSFILES= \ - $(SLO)$/communi.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/automation/source/inc/cmdbasestream.hxx b/automation/source/inc/cmdbasestream.hxx deleted file mode 100644 index 87803074d..000000000 --- a/automation/source/inc/cmdbasestream.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#ifndef _CMDBASESTREAM_HXX_ -#define _CMDBASESTREAM_HXX_ - -#include -#include "icommstream.hxx" - -class CmdBaseStream -{ -protected: - ICommStream* pCommStream; - CmdBaseStream(); - virtual ~CmdBaseStream(); - -public: - - void GenError( rtl::OString *pUId, comm_String *pString ); - - void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool ); - - void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr ); - void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString ); - void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool ); - void GenReturn( comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr ); - -// MacroRecorder - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod ); // also used outside MacroRecorder - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_BOOL bBool ); - void GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr ); - - void Read ( comm_UINT16 &nNr ); - void Read ( comm_UINT32 &nNr ); - void Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars ); - void Read ( comm_BOOL &bBool ); - comm_UINT16 GetNextType(); - - void Write( comm_UINT16 nNr ); - void Write( comm_UINT32 nNr ); - void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars ); - void Write( comm_BOOL bBool ); - -// Complex Datatypes to be handled system dependent - virtual void Read ( comm_String *&pString ); - virtual void Read ( rtl::OString* &pId ); - - virtual void Write( comm_String *pString ); - virtual void Write( rtl::OString* pId ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/icommstream.hxx b/automation/source/inc/icommstream.hxx deleted file mode 100644 index 147dfe56f..000000000 --- a/automation/source/inc/icommstream.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#ifndef _AUTOMATION_ICOMMSTREAM_HXX_ -#define _AUTOMATION_ICOMMSTREAM_HXX_ - -#include - -class ICommStream -{ -public: - - ICommStream(){} - virtual ~ICommStream(){} - - virtual ICommStream& operator>>( comm_UINT16& rUShort )=0; - virtual ICommStream& operator>>( comm_UINT32& rULong )=0; - virtual ICommStream& operator>>( comm_BOOL& rChar )=0; - - virtual ICommStream& operator<<( comm_UINT16 nUShort )=0; - virtual ICommStream& operator<<( comm_UINT32 nULong )=0; - virtual ICommStream& operator<<( comm_BOOL nChar )=0; - - virtual comm_UINT32 Read( void* pData, comm_UINT32 nSize )=0; - virtual comm_UINT32 Write( const void* pData, comm_UINT32 nSize )=0; - - virtual comm_BOOL IsEof() const=0; - virtual comm_UINT32 SeekRel( long nPos )=0; - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/ittresid.hxx b/automation/source/inc/ittresid.hxx deleted file mode 100644 index 088826160..000000000 --- a/automation/source/inc/ittresid.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _ITTRESID_HXX_ -#define _ITTRESID_HXX_ - -#include -#include - -class IttResId : public ResId -{ - static ResMgr* getIttResMgr(); - public: - IttResId( sal_uInt32 nId ) : ResId( nId, *getIttResMgr() ) {} -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/rcontrol.hxx b/automation/source/inc/rcontrol.hxx deleted file mode 100644 index bc756ded1..000000000 --- a/automation/source/inc/rcontrol.hxx +++ /dev/null @@ -1,471 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#ifndef _RCONTROL_HXX -#define _RCONTROL_HXX - -#define UID_ACTIVE "UID_ACTIVE" - -#define SI_IPCCommandBlock 1 -#define SI_SocketCommandBlock SI_IPCCommandBlock // Zumindest erstmal -#define SI_DirectCommandBlock 2 -#define SIControl 3 // remove after numeric HelpIDs are completely removed and no legacy testtool is used anymore -#define SISlot 4 -#define SIFlow 5 -#define SICommand 6 -#define SIUnoSlot 7 -#define SIStringControl 8 - -#define SIReturnBlock 11 -#define SIReturn 12 -#define SIReturnError 13 - -// Typisierung im Stream -#define BinUINT16 11 -#define BinUINT32 14 -#define BinString 12 -#define BinBool 13 -#define BinSbxValue 15 - -// Classes -// !!!Diese Defines duerfen niemals geaendert werden!!! -#define C_NoType -1 -// Maximale 32 einfache Controls -#define C_TabControl 0 -#define C_RadioButton 1 -#define C_CheckBox 2 -#define C_TriStateBox 3 -#define C_Edit 4 -#define C_MultiLineEdit 5 -#define C_MultiListBox 6 -#define C_ListBox 7 -#define C_ComboBox 8 -#define C_PushButton 9 - -#define C_SpinField 10 -#define C_PatternField 11 -#define C_NumericField 12 -#define C_MetricField 13 -#define C_CurrencyField 14 -#define C_DateField 15 -#define C_TimeField 16 - -#define C_ImageRadioButton 17 -#define C_NumericBox 18 -#define C_MetricBox 19 -#define C_CurrencyBox 20 -#define C_DateBox 21 -#define C_TimeBox 22 - -#define C_ImageButton 23 -#define C_MenuButton 24 -#define C_MoreButton 25 - -// Maximale 7 Container -#define C_TabPage 32 -#define C_ModalDlg 33 -#define C_FloatWin 34 -#define C_ModelessDlg 35 -#define C_WorkWin 36 -#define C_DockingWin 37 - -// Diese Defines koennen geaendert werden -#define C_MessBox 40 -#define C_InfoBox 41 -#define C_WarningBox 42 -#define C_ErrorBox 43 -#define C_QueryBox 44 - -#define C_TabDlg 45 -#define C_SingleTabDlg 46 - -#define C_Window 47 - -#define C_PatternBox 60 -#define C_ToolBox 61 -#define C_ValueSet 62 -#define C_Control 63 -#define C_TreeListBox 64 // Hurray the TreeListBox finally got its own Window Type - -#define C_OkButton 65 -#define C_CancelButton 66 -#define C_ButtonDialog 67 - -#define C_Dialog 68 - -#define M_WITH_RETURN 0x0200 // Die Variable wird zum Aufnehmen des Wertes gespeichert -#define M_KEY_STRING 0x0400 // Key Befehle werden umgewandelt i.e. "" -#define M_SOFFICE 0x0800 // Command valid for Star/Open Office -#define M_MOZILLA 0x1000 // Command valid for Mozilla -// for MacroRecorder -#define M_RET_NUM_CONTROL 0x2000 // decode ULong as Control (For Tabpages, Toolboxes, ... ) - -// Methoden -#define M_Select 21 -#define M_SetNoSelection 22 -#define M_SetText 23 -#define M_More 24 -#define M_Less 25 -#define M_ToMin 26 -#define M_ToMax 27 -#define M_Check 28 -#define M_UnCheck 29 -#define M_TriState 30 -#define M_SetPage 31 -#define M_Click 32 - -#define M_Close 33 // Push Buttons on Dialog (Auch More Button) -#define M_Cancel 34 -#define M_OK 35 -#define M_Help 36 -#define M_Default 37 // Push defaultbutton on Dialog - -#define M_Yes 38 -#define M_No 39 -#define M_Repeat 40 - -#define M_Open 41 -#define M_Pick 42 -#define M_Move 43 -#define M_Size 44 -#define M_Minimize 45 -#define M_Maximize 46 -#define M_Dock 47 -#define M_Undock 48 - -#define M_TypeKeys ( M_KEY_STRING | 50 ) -#define M_MouseDown 51 -#define M_MouseUp 52 -#define M_MouseMove 53 -#define M_MouseDoubleClick 54 -#define M_SnapShot 55 -#define M_SetNextToolBox 56 -#define M_OpenContextMenu 57 -#define M_MultiSelect 58 - -// Filedialog -#define M_SetPath 60 -#define M_SetCurFilter 61 - -// Printdialog -#define M_SetPrinter 70 -#define M_CheckRange 71 -#define M_SetRangeText 72 -#define M_SetFirstPage 73 -#define M_SetLastPage 74 -#define M_CheckCollate 75 -#define M_SetPageId 76 -#define M_SetPageNr 77 - -#define M_AnimateMouse 78 -#define M_TearOff 79 - -#define M_FadeIn 80 -#define M_FadeOut 81 -#define M_Pin 82 - -#define M_UseMenu 83 // Use the menu of the next possible parent of given Window -#define M_OpenMenu 84 // MenuButtons and Menus in ToolBoxes - -#define M_Restore 85 // Window Control together with M_Maximize and M_Minimize - -#define M_DisplayPercent 200 // Zum Anzeigen der Prozente des Windows - -#define M_LAST_NO_RETURN 200 - -#if ( M_LAST_NO_RETURN >= M_WITH_RETURN ) -#error "Bereich �berschritten" -#endif - -#define M_Exists ( M_WITH_RETURN | 1 ) -#define M_NotExists ( M_WITH_RETURN | 2 ) -#define M_IsEnabled ( M_WITH_RETURN | 3 ) -#define M_IsVisible ( M_WITH_RETURN | 4 ) -#define M_IsWritable ( M_WITH_RETURN | 5 ) - -#define M_GetPage ( M_WITH_RETURN | 6 ) -#define M_IsChecked ( M_WITH_RETURN | 7 ) -#define M_IsTristate ( M_WITH_RETURN | 8 ) -#define M_GetState ( M_WITH_RETURN | 9 ) -#define M_GetText ( M_WITH_RETURN | 10 ) -#define M_GetSelCount ( M_WITH_RETURN | 11 ) -#define M_GetSelIndex ( M_WITH_RETURN | 12 ) -#define M_GetSelText ( M_WITH_RETURN | 13 ) -#define M_GetItemCount ( M_WITH_RETURN | 14 ) -#define M_GetItemText ( M_WITH_RETURN | 15 ) -#define M_IsOpen ( M_WITH_RETURN | 16 ) -#define M_Caption ( M_WITH_RETURN | 17 ) -#define M_IsMax ( M_WITH_RETURN | 18 ) -#define M_IsDocked ( M_WITH_RETURN | 19 ) -#define M_GetRT ( M_WITH_RETURN | 20 ) -#define M_GetPageId ( M_WITH_RETURN | 21 ) -#define M_GetPageCount ( M_WITH_RETURN | 22 ) -#define M_GetPosX ( M_WITH_RETURN | 23 ) -#define M_GetPosY ( M_WITH_RETURN | 24 ) -#define M_GetSizeX ( M_WITH_RETURN | 25 ) -#define M_GetSizeY ( M_WITH_RETURN | 26 ) -#define M_GetNextToolBox ( M_WITH_RETURN | 27 ) -#define M_GetButtonCount ( M_WITH_RETURN | 28 ) -#define M_GetButtonId ( M_WITH_RETURN | 29 ) - -#define M_IsFadeIn ( M_WITH_RETURN | 30 ) -#define M_IsPin ( M_WITH_RETURN | 31 ) - -// Statusbar -#define M_StatusGetText ( M_WITH_RETURN | 32 ) -#define M_StatusIsProgress ( M_WITH_RETURN | 33 ) -#define M_StatusGetItemCount ( M_WITH_RETURN | 34 ) -#define M_StatusGetItemId ( M_WITH_RETURN | 35 ) - -#define M_GetMouseStyle ( M_WITH_RETURN | 36 ) - -// support for Messagebox with checkbox -#define M_GetCheckBoxText ( M_WITH_RETURN | 37 ) - -// Scrollbars -#define M_HasScrollBar ( M_WITH_RETURN | 38 ) -#define M_IsScrollBarEnabled ( M_WITH_RETURN | 39 ) - -// Dieser befehl wird nur intern im Controller (sts library) verwendet. Sie tauchen nicht im Testtool auf! -#define _M_IsEnabled ( M_WITH_RETURN | 50 ) - -#define M_GetFixedTextCount ( M_WITH_RETURN | 51 ) -#define M_GetFixedText ( M_WITH_RETURN | 52 ) - -#define M_IsMin ( M_WITH_RETURN | 53 ) -#define M_IsRestore ( M_WITH_RETURN | 54 ) - -#define M_GetItemType ( M_WITH_RETURN | 55 ) - -// Commands for (Edit)BrowseBox -#define M_GetColumnCount ( M_WITH_RETURN | 56 ) -#define M_GetRowCount ( M_WITH_RETURN | 57 ) -#define M_IsEditing ( M_WITH_RETURN | 58 ) - -#define M_IsItemEnabled ( M_WITH_RETURN | 59 ) - -//#define M_SOFFICE 0x0800 // Command valid for Star/Open Office -//#define M_MOZILLA 0x1000 // Command valid for Mozilla - -// RemoteCommands -#define RC_AppAbort ( M_SOFFICE | M_MOZILLA | 1 ) -#define RC_SetClipboard ( M_SOFFICE | M_MOZILLA | 2 ) -#define RC_NoDebug ( M_SOFFICE | M_MOZILLA | 3 ) -#define RC_Debug ( M_SOFFICE | M_MOZILLA | 4 ) -#define RC_GPF ( M_SOFFICE | M_MOZILLA | 5 ) -#define RC_DisplayHid ( M_SOFFICE | M_MOZILLA | 6 ) -#define RC_AppDelay ( M_SOFFICE | M_MOZILLA | 7 ) -#define RC_UseBindings ( M_SOFFICE | 8 ) -#define RC_Profile ( M_SOFFICE | M_MOZILLA | 9 ) -// (Popup)Menu -#define RC_MenuSelect ( M_SOFFICE | M_MOZILLA | 10 ) -#define RC_SetControlType ( M_SOFFICE | 11 ) // deprecated since RTTI -// RemoteFileAccess -#define RC_Kill ( M_SOFFICE | 12 ) -#define RC_RmDir ( M_SOFFICE | 13 ) -#define RC_MkDir ( M_SOFFICE | 14 ) -#define RC_FileCopy ( M_SOFFICE | 15 ) -#define RC_Name ( M_SOFFICE | 16 ) - -#define RC_CaptureAssertions (M_SOFFICE | M_MOZILLA | 17 ) -#define RC_Assert ( M_SOFFICE | M_MOZILLA | 18 ) -#define RC_MenuOpen ( M_SOFFICE | M_MOZILLA | 19 ) -#define RC_TypeKeysDelay ( M_SOFFICE | M_MOZILLA | 20 ) -#define RC_ShowBar ( M_MOZILLA | 21 ) -#define RC_LoadURL ( M_MOZILLA | 22 ) -#define RC_CloseSysDialog ( M_SOFFICE | 23 ) -#define RC_SAXRelease ( M_SOFFICE | 24 ) -#define RC_RecordMacro ( M_SOFFICE | 25 ) -#define RC_ActivateDocument ( M_SOFFICE | 26 ) -#define RC_CatchGPF ( M_SOFFICE | 27 ) - -#define _RC_LAST_NO_RETURN 27 - -#if ( _RC_LAST_NO_RETURN >= M_WITH_RETURN ) -#error "Bereich �berschritten" -#endif - -// Befehle mit Returnwert -#define RC_GetClipboard ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 1 ) -#define RC_WinTree ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 2 ) -#define RC_ResetApplication ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 3 ) -#define RC_GetNextCloseWindow ( M_SOFFICE | M_WITH_RETURN | 4 ) -#define RC_ApplicationBusy ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 5 ) -// (Popup)Menu -#define RC_MenuGetItemCount ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 6 ) -#define RC_MenuGetItemId ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 7 ) -#define RC_MenuGetItemPos ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 8 ) -#define RC_MenuIsSeperator ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 9 ) -#define RC_MenuIsItemChecked ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 10 ) -#define RC_MenuIsItemEnabled ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 11 ) -#define RC_MenuGetItemText ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 12 ) -// RemoteFileAccess -#define RC_Dir ( M_SOFFICE | M_WITH_RETURN | 18 ) -#define RC_FileLen ( M_SOFFICE | M_WITH_RETURN | 19 ) -#define RC_FileDateTime ( M_SOFFICE | M_WITH_RETURN | 20 ) - -#define RC_Translate ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 21 ) -#define RC_GetMouseStyle ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 22 ) -#define RC_UnpackStorage ( M_SOFFICE | M_WITH_RETURN | 23 ) - -#define RC_IsBarVisible ( M_MOZILLA | M_WITH_RETURN | 24 ) - -#define RC_MenuGetItemCommand ( M_SOFFICE | M_MOZILLA | M_WITH_RETURN | 25 ) - -#define RC_ExistsSysDialog ( M_SOFFICE | M_WITH_RETURN | 26 ) - -#define RC_SAXCheckWellformed ( M_SOFFICE | M_WITH_RETURN | 27 ) -#define RC_SAXReadFile ( M_SOFFICE | M_WITH_RETURN | 28 ) - -#define RC_SAXGetNodeType ( M_SOFFICE | M_WITH_RETURN | 29 ) -#define RC_SAXGetElementName ( M_SOFFICE | M_WITH_RETURN | 30 ) -#define RC_SAXGetChars ( M_SOFFICE | M_WITH_RETURN | 31 ) -#define RC_SAXGetChildCount ( M_SOFFICE | M_WITH_RETURN | 32 ) -#define RC_SAXGetAttributeCount ( M_SOFFICE | M_WITH_RETURN | 33 ) -#define RC_SAXGetAttributeName ( M_SOFFICE | M_WITH_RETURN | 34 ) -#define RC_SAXGetAttributeValue ( M_SOFFICE | M_WITH_RETURN | 35 ) -#define RC_SAXSeekElement ( M_SOFFICE | M_WITH_RETURN | 36 ) -#define RC_SAXHasElement ( M_SOFFICE | M_WITH_RETURN | 37 ) -#define RC_SAXGetElementPath ( M_SOFFICE | M_WITH_RETURN | 38 ) - -#define RC_GetDocumentCount ( M_SOFFICE | M_WITH_RETURN | 39 ) - -#define RC_GetSystemLanguage ( M_SOFFICE | M_WITH_RETURN | 40 ) - -#define RC_IsProduct ( M_SOFFICE | M_WITH_RETURN | 41 ) - -#define RC_MenuHasSubMenu ( M_SOFFICE | M_WITH_RETURN | 42 ) - -#define RC_UsePostEvents ( M_SOFFICE | M_WITH_RETURN | 43 ) - -#define RC_WaitSlot ( M_SOFFICE | M_WITH_RETURN | 44 ) - -// Flow Control -#define F_EndCommandBlock 101 // Initiiert R�ckmeldung des Status -#define F_Sequence 102 // �bergibt Sequence Nummer (1. in jedem Stream) - -// Return codes -#define RET_Sequence 132 // �bergibt Sequence Nummer (1. in jedem Stream) -#define RET_Value 133 // �bergibt Return-wert -#define RET_WinInfo 134 // Information �ber aktuelles Fenster/Control -#define RET_ProfileInfo 135 // Profile Information -#define RET_DirectLoging 136 // Direktes �bertragen von Informationen in das Log -#define RET_MacroRecorder 137 // MakroRecorder Befehl �bertragen - -// Subcodes die in nUId geliefert werden -// f�r F_ProfileInfo -#define S_ProfileReset 201 // nNr1 = Anzahl Borders - // Achtung!! Diese Defines m�ssen aufeinanderfolgende Nummern haben!! -#define S_ProfileBorder1 202 // nNr1 = Border1 in ms -#define S_ProfileBorder2 203 // nNr1 = Border2 in ms -#define S_ProfileBorder3 204 // nNr1 = Border3 in ms -#define S_ProfileBorder4 205 // nNr1 = Border4 in ms - // Achtung Ende -#define S_ProfileTime 210 // nNr1 = remote Zeit des Befehls -#define S_ProfileDump 211 // Gibt die daten aus. - -// f�r F_DirectLoging -#define S_AssertError 220 -#define S_AssertWarning 221 -#define S_AssertTrace 222 -#define S_QAError 223 - -// Constants which are available in VCLTestTool scripts - -// Different types of controls recognized via RTTI -#define CONST_CTBrowseBox 100 -#define CONST_CTValueSet 103 -#define CONST_CTORoadmap 104 -#define CONST_CTIExtensionListBox 105 -#define CONST_CTTableControl 106 -#define CONST_CTUnknown 199 - -// Konstanten f�r das ALignment des gesuchten Splitters -#define CONST_ALIGN_LEFT 120 -#define CONST_ALIGN_TOP 121 -#define CONST_ALIGN_RIGHT 122 -#define CONST_ALIGN_BOTTOM 123 - -/// What dialog to use in RC_CloseSysDialog or RC_ExistsSysDialog -#define CONST_FilePicker 301 -#define CONST_FolderPicker 302 - -/// NodeTypes of the SAX Parser -#define CONST_NodeTypeCharacter 555 -#define CONST_NodeTypeElement 556 -#define CONST_NodeTypeComment 557 - -/// ItemTypes for TreeListBox and maybe others -#define CONST_ItemTypeText 602 -#define CONST_ItemTypeBMP 601 -#define CONST_ItemTypeCheckbox 600 -#define CONST_ItemTypeContextBMP 603 -#define CONST_ItemTypeUnknown 604 - -/// Return values for WaitSlot -#define CONST_WSTimeout 701 -#define CONST_WSAborted 702 -#define CONST_WSFinished 703 - -// Beschreibt die Parametertypen als Bitfeld Reihenfolge immer! -// wie hier Aufgelistet -#define PARAM_NONE 0x0000 -#define PARAM_UINT16_1 0x0001 -#define PARAM_UINT16_2 0x0002 -#define PARAM_UINT16_3 0x0100 // Nicht in der Reihe!! -#define PARAM_UINT16_4 0x0200 // Nicht in der Reihe!! -#define PARAM_UINT32_1 0x0004 -#define PARAM_UINT32_2 0x0008 -#define PARAM_STR_1 0x0010 -#define PARAM_STR_2 0x0020 -#define PARAM_BOOL_1 0x0040 -#define PARAM_BOOL_2 0x0080 -#define PARAM_SBXVALUE_1 0x0400 // hier mit 0x0400 Weiter!!! Siehe Oben! - -// Zus�tzliche Beschreibung!! wird auch mit dem Rest verodert -//#define PARAM_STR_RAW 0x8000 // Der Zeichensatz der Strings wird nicht konvertiert(f�r Fareastern) - -#define ERR_SEND_TIMEOUT 100 -#define ERR_EXEC_TIMEOUT 101 -#define ERR_RESTART_FAIL 102 -#define ERR_RESTART 103 -#define ERR_NO_WIN 104 // Keine *.Win Dateien gefunden -#define ERR_NO_SID 105 // Keine *.Sid Dateien gefunden -#define ERR_NO_FILE 106 // Datei nicht gefunden - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/svcommstream.hxx b/automation/source/inc/svcommstream.hxx deleted file mode 100644 index 70c4a619e..000000000 --- a/automation/source/inc/svcommstream.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include -#include "icommstream.hxx" - - -class SvCommStream : public ICommStream -{ -protected: - SvStream* pStream; -public: - - SvCommStream( SvStream* pIO ); - ~SvCommStream(); - - ICommStream& operator>>( comm_UINT16& rUShort ); - ICommStream& operator>>( comm_UINT32& rULong ); - ICommStream& operator>>( comm_BOOL& rChar ); - - ICommStream& operator<<( comm_UINT16 nUShort ); - ICommStream& operator<<( comm_UINT32 nULong ); - ICommStream& operator<<( comm_BOOL nChar ); - - comm_UINT32 Read( void* pData, comm_UINT32 nSize ); - comm_UINT32 Write( const void* pData, comm_UINT32 nSize ); - - comm_BOOL IsEof() const; - comm_UINT32 SeekRel( long nPos ); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/testapp.hxx b/automation/source/inc/testapp.hxx deleted file mode 100644 index dd195b7e3..000000000 --- a/automation/source/inc/testapp.hxx +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef TESTAPP_HXX -#define TESTAPP_HXX - -#include -#include - -class CommunicationLink; -class CommunicationManagerClientViaSocketTT; -class CNames; -class ControlItemUId; -class CRevNames; -//class SbxTransportVariableRef; -class ControlsRef; -class CmdStream; -class FloatingLoadConf; -class TestToolObj; -class ControlDef; - -class SbxTransportMethod; -class Application; - -class SotStorage; - -class ImplTestToolObj; -class MyBasic; - -class ErrorEntry -{ -public: - ErrorEntry(sal_uLong nNr, String aStr = String()) : nError(nNr),aText(aStr),nLine(0),nCol1(0),nCol2(0) {} - ErrorEntry(sal_uLong nNr, String aStr, xub_StrLen l, xub_StrLen c1, xub_StrLen c2 ) - : nError(nNr),aText(aStr),nLine(l),nCol1(c1),nCol2(c2) {} - sal_uLong nError; - String aText; - xub_StrLen nLine; - xub_StrLen nCol1; - xub_StrLen nCol2; -}; - -SV_DECL_PTRARR_DEL(CErrors, ErrorEntry*, 1, 1) - -struct ControlDefLoad { - const char* Kurzname; - sal_uLong nUId; -}; - -class TestToolObj: public SbxObject -{ - friend class TTBasic; - friend class Controls; -public: - TestToolObj( String aName, String aFilePath ); // Alle Dateien in FilePath, Kein IPC - TestToolObj( String aName, MyBasic* pBas ); // Pfade aus INI, IPC benutzen - ~TestToolObj(); - void LoadIniFile(); // Laden der IniEinstellungen, die durch den ConfigDialog geändert werden können - void DebugFindNoErrors( sal_Bool bDebugFindNoErrors ); - -private: - sal_Bool bWasPrecompilerError; // True wenn beim letzten Precompile ein Fehler auftrat - sal_Bool CError( sal_uLong, const String&, xub_StrLen, xub_StrLen, xub_StrLen ); - void CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrLen &l, xub_StrLen &c ); - xub_StrLen ImplSearch( const String &aSource, const xub_StrLen nStart, const xub_StrLen nEnd, const String &aSearch, const xub_StrLen nSearchStart = 0 ); - xub_StrLen PreCompilePart( String &aSource, xub_StrLen nStart, xub_StrLen nEnd, String aFinalErrorLabel, sal_uInt16 &nLabelCount ); - void PreCompileDispatchParts( String &aSource, String aStart, String aEnd, String aFinalLable ); -public: - String GetRevision(String const &aSourceIn); // find Revision in the sourcecode - String PreCompile(String const &aSourceIn); // try catch; testcase endcase .. - sal_Bool WasPrecompilerError(); // True wenn beim letzten Precompile ein Fehler auftrat - void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); - virtual SbxVariable* Find( const String&, SbxClassType ); -// String aKeyPlusClasses; // Pfad für keycodes & classes & res_type (Aus Configdatei) - DECL_LINK( ReturnResultsLink, CommunicationLink* ); - sal_Bool ReturnResults( SvStream *pIn ); // Rücklieferung des Antwortstreams über IPC oder TCP/IP oder direkt - - void SetLogHdl( const Link& rLink ) { aLogHdl = rLink; } - const Link& GetLogHdl() const { return aLogHdl; } - - void SetWinInfoHdl( const Link& rLink ) { aWinInfoHdl = rLink; } - const Link& GetWinInfoHdl() const { return aWinInfoHdl; } - - void SetModuleWinExistsHdl( const Link& rLink ) { aModuleWinExistsHdl = rLink; } - const Link& GetModuleWinExistsHdl() const { return aModuleWinExistsHdl; } - - void SetCErrorHdl( const Link& rLink ) { aCErrorHdl = rLink; } - const Link& GetCErrorHdl() const { return aCErrorHdl; } - - void SetWriteStringHdl( const Link& rLink ) { aWriteStringHdl = rLink; } - const Link& GetWriteStringHdl() const { return aWriteStringHdl; } - - SfxBroadcaster& GetTTBroadcaster(); - -private: - ImplTestToolObj *pImpl; // Alles was von der Implementation abhängt - static const CErrors* GetFehlerListe() { return pFehlerListe; } - sal_Bool bUseIPC; - Link aLogHdl; // Zum Logen der Fehlermeldungen im Testtool - Link aWinInfoHdl; // Anzeigen der Windows/Controls der zu testenden App - Link aModuleWinExistsHdl; // Prüft ob das Modul schon im Editor geladen ist - Link aCErrorHdl; // Melden von Compilererror - Link aWriteStringHdl; // Schreiben von text (e.g. MakroRecorder) - sal_Bool bReturnOK; // Bricht WaitForAnswer ab - CRevNames *pShortNames; // Aktuell verwendete Controls, zur gewinnung des Namens aus Fehlermeldung - sal_uLong nSequence; // Sequence um Antwort und Anfrage zu syncronisieren - rtl::OString aNextReturnId; // Id des Returnwertes i.e. UId - void ReplaceNumbers(String &aText); // Zahlen im String mit speziellem Format in Namen umwandeln - - String aLastRecordedKontext;// Keeps the last kontext recorded by the Macro Recorder - -#define FLAT sal_True - String ProgPath; // Dateiname der zu Testenden APP; Gesetzt über Start - String aLogFileName; // Momentaner Logfilename (Wie Programmdatei aber mit .res) - sal_Bool IsBlock; // Innerhalb Begin/EndBlock - sal_Bool SingleCommandBlock; // Implizit um jedes kommando ein Begin/EndBlock - CmdStream *In; - - void AddName(String &aBisher, String &aNeu ); // Name eventuell mit / anhängen - void AddToListByNr( CNames *&pControls, ControlItemUId *&pNewItem ); // - CNames *m_pControls; - CNames *m_pNameKontext; // Zeigt auf den aktuellen Namenskontext, der über 'Kontext' gesetzt wurde - CNames *m_pSIds; - CNames *m_pReverseSlots; // Slots mit Kurznamen nach Nummer - CNames *m_pReverseControls; // Controls mit Kurznamen nach Nummer - CNames *m_pReverseControlsSon;// Controls mit Kurznamen nach Nummer nach Fenstern (Son) - CNames *m_pReverseUIds; // Langnamen nach Nummer - - - sal_uInt16 nMyVar; // Wievielte Var aus Pool ist dran - - void InitTestToolObj(); - CommunicationManagerClientViaSocketTT *pCommunicationManager; - void SendViaSocket(); - - sal_Bool Load( String aFileName, SbModule *pMod ); - - void ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, sal_Bool bIsFlat = sal_False ); - void ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName ); - sal_Bool ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pControls ); - sal_Bool WriteNamesBin( String Filename, CNames *pSIds, CNames *pControls ); - void ReadHidLstByNumber(); - void SortControlsByNumber( sal_Bool bIncludeActive = sal_False ); - - String GetMethodName( sal_uLong nMethodId ); - String GetKeyName( sal_uInt16 nKeyCode ); - - void WaitForAnswer (); - DECL_LINK( IdleHdl, Application* ); - DECL_LINK( CallDialogHandler, Application* ); - String aDialogHandlerName; - sal_uInt16 nWindowHandlerCallLevel; - - sal_uInt16 nIdleCount; - // wenn DialogHandler gesetzt wird er im IdleHandler inkrementiert und - // in WaitForAnswer rückgesetzt. Übersteigt er einen gewissen wert, gehe ich davon aus, - // daß WaitForAnswer still ligt und rufe die DialogHander Sub im BASIC auf. - - void BeginBlock(); - void EndBlock(); - - SbTextType GetSymbolType( const String &rSymbol, sal_Bool bWasControl ); - static ControlDefLoad const arR_Cmds[]; - static CNames *pRCommands; - - static CErrors *pFehlerListe; // Hier werden die Fehler des Testtools gespeichert - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/inc/testtool.hxx b/automation/source/inc/testtool.hxx deleted file mode 100644 index c84fc8fd7..000000000 --- a/automation/source/inc/testtool.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVTOOLS_TESTTOOL_HXX -#define SVTOOLS_TESTTOOL_HXX - -#include -#include -#include - -class Application; -class SvStream; - -class StatementFlow; -class CommunicationManager; -class CommunicationLink; -#if OSL_DEBUG_LEVEL > 1 -class EditWindow; -#endif -class ImplRC; - -class ImplRemoteControl -{ - friend class StatementFlow; - - sal_Bool m_bIdleInserted; - AutoTimer m_aIdleTimer; - sal_Bool m_bInsideExecutionLoop; -#if OSL_DEBUG_LEVEL > 1 - EditWindow *m_pDbgWin; -#endif - -public: - ImplRemoteControl(); - ~ImplRemoteControl(); - sal_Bool QueCommands( sal_uLong nServiceId, SvStream *pIn ); - SvStream* GetReturnStream(); - - DECL_LINK( IdleHdl, Application* ); - DECL_LINK( CommandHdl, Application* ); - - DECL_LINK( QueCommandsEvent, CommunicationLink* ); - -protected: - CommunicationManager *pServiceMgr; - SvStream *pRetStream; -}; - -#endif // SVTOOLS_TESTTOOL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/editwin.cxx b/automation/source/miniapp/editwin.cxx deleted file mode 100644 index b4e367670..000000000 --- a/automation/source/miniapp/editwin.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include "editwin.hxx" -#include -#include - - -sal_Bool GHEditWindow::Close() -{ - if (aInhalt.IsModified()) - { - } - delete(this); - return sal_True; -} - -void GHEditWindow::Resize() -{ - aInhalt.SetPosSizePixel(Point(1,1),GetOutputSizePixel()); -} - -GHEditWindow::GHEditWindow(Window * pParent, String aName, WinBits iWstyle) -: FloatingWindow(pParent) -, aInhalt(this,iWstyle) -{ - SetOutputSizePixel( Size( 120,80 ) ); - Show(); - Resize(); - aInhalt.Show(); - SetText(aName); -} - -void GHEditWindow::AddText( String aNew, sal_Bool bMoveToEnd) -{ - String aOld = aInhalt.GetText(); - - aOld += aNew; - aOld.ConvertLineEnd(); - aInhalt.SetText(aOld); - if (bMoveToEnd) - aInhalt.SetSelection(Selection(SELECTION_MAX,SELECTION_MAX)); -} - - -EditFileWindow::EditFileWindow(Window * pParent, String aName, WinBits iWstyle) -: GHEditWindow(pParent, aName, iWstyle) -, aFileName(aName) -{ - LoadFile(); -} - -void EditFileWindow::LoadFile() -{ - - SvFileStream Stream; - String All,Line; - - Stream.Open(aFileName, STREAM_STD_READ); - - if (!Stream.IsOpen()) - { - AddText(CUniString("could not open ").Append(aFileName).AppendAscii("\n")); - aFileName.Erase(); - return; - } - - while (!Stream.IsEof()) - { - - Stream.ReadByteStringLine( Line, RTL_TEXTENCODING_UTF8 ); - - All += Line; - All += '\n'; - - } - - All.ConvertLineEnd(); - - AddText(All,sal_False); - -} - -sal_Bool EditFileWindow::Close() -{ - - if (aInhalt.IsModified() && QueryBox(this,WB_DEF_YES | WB_YES_NO_CANCEL, String(aFileName).AppendAscii("\nhas been changed.\n\nSave file?")).Execute()) - { - - } - return GHEditWindow::Close(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/editwin.hxx b/automation/source/miniapp/editwin.hxx deleted file mode 100644 index 3f6d2c101..000000000 --- a/automation/source/miniapp/editwin.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _editwin -#define _editwin - -#include -#include -#include - -class GHEditWindow : public FloatingWindow -{ - -protected: - - MultiLineEdit aInhalt; - - virtual sal_Bool Close(); // derived - void Resize(); - -public: - - GHEditWindow(); - GHEditWindow(Window * pParent, String aName = CUniString("Neues Fenster"), WinBits iWstyle = WB_STDWORK); - - void AddText( String aNew, sal_Bool bMoveToEnd = sal_True); -}; - - - -class EditFileWindow : public GHEditWindow -{ - - String aFileName; - virtual sal_Bool Close(); // derived - void LoadFile(); - -public: - EditFileWindow(Window * pParent, String aName = CUniString("Neue Datei"), WinBits iWstyle = WB_STDWORK); - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/hid.lst b/automation/source/miniapp/hid.lst deleted file mode 100644 index 99964dba0..000000000 --- a/automation/source/miniapp/hid.lst +++ /dev/null @@ -1,27 +0,0 @@ -MENU_CLIENT 256 -IDM_FILE 1 -IDM_FILE_OPEN_TEST 2 -IDM_FILE_EXIT 3 -IDM_FILE_EXIT_HELP 0 -IDM_FILE_OPEN_TEST_HELP 1 -IDM_FILE_HELP 3 -GROSSER_TEST_DLG 256 -IDM_TEST 5 -IDM_TEST_GROSS 6 -IDM_SYS_DLG 7 -IDM_TEST_WINTREE 8 - - - -UID_GROSSER_TEST_DLG 101 -UID_CheckBox 202 -UID_TriStateBox 303 -UID_OKButton 404 -UID_TimeField 505 -UID_MultiLineEdit 606 -UID_RadioButton1 707 -UID_RadioButton2 708 -UID_MultiListBox 809 -UID_ComboBox 910 -UID_DateBox 1011 - diff --git a/automation/source/miniapp/makefile.mk b/automation/source/miniapp/makefile.mk deleted file mode 100644 index 10c16d8ab..000000000 --- a/automation/source/miniapp/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=miniapp - -# --- Settings ------------------------------------------------------------ - -.INCLUDE : settings.mk - -# --- Allgemein ------------------------------------------------------------ - -OBJFILES = \ - $(EXCEPTIONSFILES) - - -EXCEPTIONSFILES= \ - $(OBJ)$/editwin.obj \ - $(OBJ)$/servres.obj \ - $(OBJ)$/testapp.obj - -SRS1NAME=$(TARGET) -SRC1FILES = \ - servres.src - -# --- Targets ------------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/automation/source/miniapp/servres.cxx b/automation/source/miniapp/servres.cxx deleted file mode 100644 index a4b7a5df3..000000000 --- a/automation/source/miniapp/servres.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include - -#include "servres.hrc" -#include "servuid.hxx" -#include "servres.hxx" - - -ModalDialogGROSSER_TEST_DLG::ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, sal_Bool bFreeRes ) - : ModalDialog( pParent, rResId ), - aCheckBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aTriStateBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aOKButton1( this, ResId( 1, *rResId.GetResMgr() ) ), - aTimeField1( this, ResId( 1, *rResId.GetResMgr() ) ), - aMultiLineEdit1( this, ResId( 1, *rResId.GetResMgr() ) ), - aGroupBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aRadioButton1( this, ResId( 1, *rResId.GetResMgr() ) ), - aRadioButton2( this, ResId( 2, *rResId.GetResMgr() ) ), - aMultiListBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aComboBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aDateBox1( this, ResId( 1, *rResId.GetResMgr() ) ), - aFixedText1( this, ResId( 1, *rResId.GetResMgr() ) ) -{ - if( bFreeRes ) FreeResource(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/servres.hrc b/automation/source/miniapp/servres.hrc deleted file mode 100644 index 508258df4..000000000 --- a/automation/source/miniapp/servres.hrc +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -/* StarView ressource header file */ -#define MENU_CLIENT 256 -#define IDM_FILE 1 -#define IDM_FILE_OPEN_TEST 2 -#define IDM_FILE_EXIT 3 -#define IDM_FILE_EXIT_HELP "AUTOMATION_IDM_FILE_EXIT_HELP" -#define IDM_FILE_OPEN_TEST_HELP "AUTOMATION_IDM_FILE_OPEN_TEST_HELP" -#define IDM_FILE_HELP "AUTOMATION_IDM_FILE_HELP" -#define GROSSER_TEST_DLG 256 -#define IDM_TEST 5 -#define IDM_TEST_GROSS 6 -#define IDM_SYS_DLG 7 -#define IDM_TEST_WINTREE 8 - diff --git a/automation/source/miniapp/servres.hxx b/automation/source/miniapp/servres.hxx deleted file mode 100644 index 318ffd885..000000000 --- a/automation/source/miniapp/servres.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class ModalDialogGROSSER_TEST_DLG : public ModalDialog -{ -protected: - CheckBox aCheckBox1; - TriStateBox aTriStateBox1; - OKButton aOKButton1; - TimeField aTimeField1; - MultiLineEdit aMultiLineEdit1; - GroupBox aGroupBox1; - RadioButton aRadioButton1; - RadioButton aRadioButton2; - MultiListBox aMultiListBox1; - ComboBox aComboBox1; - DateBox aDateBox1; - FixedText aFixedText1; -public: - ModalDialogGROSSER_TEST_DLG( Window * pParent, const ResId & rResId, sal_Bool bFreeRes = sal_True ); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/servres.src b/automation/source/miniapp/servres.src deleted file mode 100644 index f6f7b7e65..000000000 --- a/automation/source/miniapp/servres.src +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "servres.hrc" -#include "servuid.hxx" -ModalDialog GROSSER_TEST_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - HelpID = UID_GROSSER_TEST_DLG ; - Pos = MAP_APPFONT ( 14 , 7 ) ; - Size = MAP_APPFONT ( 273 , 110 ) ; - Text = "Großer Testdialog" ; - Moveable = TRUE ; - Closeable = TRUE ; - CheckBox 1 - { - HelpID = UID_CheckBox ; - Pos = MAP_APPFONT ( 9 , 17 ) ; - Size = MAP_APPFONT ( 55 , 12 ) ; - Text = "CheckBox" ; - TabStop = TRUE ; - }; - TriStateBox 1 - { - HelpID = UID_TriStateBox ; - Pos = MAP_APPFONT ( 9 , 29 ) ; - Size = MAP_APPFONT ( 62 , 12 ) ; - Text = "TriStateBox" ; - TabStop = TRUE ; - }; - OKButton 1 - { - HelpID = "hid1" ; - Pos = MAP_APPFONT ( 132 , 92 ) ; - Size = MAP_APPFONT ( 64 , 12 ) ; - TabStop = TRUE ; - }; - TimeField 1 - { - Border = TRUE ; - HelpID = UID_TimeField ; - Pos = MAP_APPFONT ( 9 , 92 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - }; - MultiLineEdit 1 - { - Border = TRUE ; - HelpID = UID_MultiLineEdit ; - Pos = MAP_APPFONT ( 172 , 6 ) ; - Size = MAP_APPFONT ( 94 , 48 ) ; - Text = "MultiLineEdit" ; - TabStop = TRUE ; - VScroll = TRUE ; - }; - GroupBox 1 - { - Pos = MAP_APPFONT ( 9 , 42 ) ; - Size = MAP_APPFONT ( 58 , 44 ) ; - Text = "GroupBox" ; - Group = TRUE ; - }; - RadioButton 2 - { - HelpID = UID_RadioButton2 ; - Pos = MAP_APPFONT ( 16 , 68 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Text = "Radio2" ; - TabStop = TRUE ; - }; - RadioButton 1 - { - HelpID = UID_RadioButton1 ; - Pos = MAP_APPFONT ( 16 , 54 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - Text = "Radio1" ; - TabStop = TRUE ; - }; - MultiListBox 1 - { - Border = TRUE ; - HelpID = UID_MultiListBox ; - Pos = MAP_APPFONT ( 76 , 6 ) ; - Size = MAP_APPFONT ( 86 , 48 ) ; - TabStop = TRUE ; - StringList = - { - < "MultiListBox" ; Default ; > ; - < "Zeile 2" ; Default ; > ; - < "Zeile 3" ; Default ; > ; - < "Zeile 4" ; Default ; > ; - < "Zeile 5" ; Default ; > ; - < "Zeile 6" ; Default ; > ; - < "Zeile 7" ; Default ; > ; - < "Zeile 8" ; Default ; > ; - < "Zeile 9" ; Default ; > ; - < "Zeile 10" ; Default ; > ; - }; - }; - ComboBox 1 - { - HelpID = UID_ComboBox ; - Pos = MAP_APPFONT ( 76 , 58 ) ; - Size = MAP_APPFONT ( 86 , 55 ) ; - Text = "ComboBox" ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList = - { - "ComboBox" ; - "Erster" ; - "Zweiter" ; - "Dritter" ; - }; - }; - DateBox 1 - { - HelpID = UID_DateBox ; - Pos = MAP_APPFONT ( 76 , 72 ) ; - Size = MAP_APPFONT ( 86 , 54 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList = - { - "1.1.91" ; - "2.2.92" ; - "3.3.93" ; - }; - }; - FixedText 1 - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 19 , 6 ) ; - Size = MAP_APPFONT ( 39 , 9 ) ; - Text = "FixedText" ; - Center = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 202 , 92 ) ; - Size = MAP_APPFONT ( 64 , 12 ) ; - TabStop = TRUE ; - }; -}; -Menu MENU_CLIENT -{ - ItemList = - { - MenuItem - { - Identifier = IDM_FILE ; - HelpID = IDM_FILE_HELP ; - Text = "~File" ; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = IDM_FILE_OPEN_TEST ; - HelpID = IDM_FILE_OPEN_TEST_HELP ; - Text = "~Open Test Window" ; - }; - MenuItem - { - Identifier = 4 ; - Separator = TRUE ; - }; - MenuItem - { - Identifier = IDM_FILE_EXIT ; - HelpID = IDM_FILE_EXIT_HELP ; - Text = "~Beenden" ; - AccelKey = KeyCode - { - Code = KEY_F4 ; - Modifier2 = TRUE ; - }; - }; - }; - }; - }; - MenuItem - { - Identifier = IDM_TEST ; - Text = "~Test" ; - SubMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = IDM_TEST_GROSS ; - Text = "~Großer Testdialog" ; - }; - MenuItem - { - Identifier = IDM_SYS_DLG ; - Text = "~Sysdialoge" ; - }; - }; - }; - }; - }; -}; - diff --git a/automation/source/miniapp/servuid.hxx b/automation/source/miniapp/servuid.hxx deleted file mode 100644 index b7c801a9a..000000000 --- a/automation/source/miniapp/servuid.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define UID_GROSSER_TEST_DLG "AUTOMATION_UID_GROSSER_TEST_DLG" -#define UID_CheckBox "AUTOMATION_UID_CheckBox" -#define UID_TriStateBox "AUTOMATION_UID_TriStateBox" -#define UID_OKButton "AUTOMATION_UID_OKButton" -#define UID_TimeField "AUTOMATION_UID_TimeField" -#define UID_MultiLineEdit "AUTOMATION_UID_MultiLineEdit" -#define UID_RadioButton1 "AUTOMATION_UID_RadioButton1" -#define UID_RadioButton2 "AUTOMATION_UID_RadioButton2" -#define UID_MultiListBox "AUTOMATION_UID_MultiListBox" -#define UID_ComboBox "AUTOMATION_UID_ComboBox" -#define UID_DateBox "AUTOMATION_UID_DateBox" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/test.bas b/automation/source/miniapp/test.bas deleted file mode 100644 index 6d00e892f..000000000 --- a/automation/source/miniapp/test.bas +++ /dev/null @@ -1,126 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -sub main -' cMassentest -' DisplayHid - cTestdialog - cSysDlgTest - cFileOpenTest - SidWintree - - FileExit -end sub - -testcase cMassentest - -DisplayHid -resetapplication -FileDialog -kontext "GrosserTestDlg" -dim c,t,lang,i -c = 0 -lang = "0123456789abcdef" -lang = lang + lang -lang = lang + lang -lang = lang + lang -lang = lang + lang -lang = lang + lang -lang = lang + lang - -lang = lang + lang -lang = lang + lang -nodebug -while 1 - c = c + 1 - t = str(c) - MultiLineEdit.SetText t - CheckBox.check lang - CheckBox.uncheck lang - for i = 1 to 200 : next - beep -wend - -endcase - - -testcase cFileOpenTest - - FileOpenTest - setclipboard wintree - kontext - active.cancel - -endcase - - -testcase cSysDlgTest - - SysDialogs - setclipboard wintree - kontext - active.yes - setclipboard wintree - active.ok - active.Cancel - - SysDialogs - active.Cancel - active.ok - -endcase - -testcase cTestdialog - - FileDialog - - kontext "GrosserTestDlg" - CheckBox.uncheck - TriStateBox.tristate - 'OKButton -' TimeField.settext("fhsdjk") - MultiLineEdit.SetText "Das war der Text: '"+MultiLineEdit.GetText+"'" - RadioButton1.check - RadioButton2.check -' MultiListBox.select 2 - ComboBox.select("Dritter") - DateBox.select("1.1.91") - - GrosserTestDlg.ok - -endcase - - -sub LoadIncludeFiles - - start "miniapp.exe", "-enableautomation" - - use "test.win" - use "test.sid" - - testexit - -end sub - -sub testenter -end sub - -sub testexit - - dim xx - xx = resetapplication - if xx > "" then warnlog xx - -end sub - - - - - - - - - - - - - - diff --git a/automation/source/miniapp/test.sid b/automation/source/miniapp/test.sid deleted file mode 100644 index 3af8966aa..000000000 --- a/automation/source/miniapp/test.sid +++ /dev/null @@ -1,5 +0,0 @@ -FileOpenTest IDM_FILE_OPEN_TEST -FileExit IDM_FILE_EXIT -FileDialog IDM_TEST_GROSS -SidWintree IDM_TEST_WINTREE -SysDialogs IDM_SYS_DLG diff --git a/automation/source/miniapp/test.win b/automation/source/miniapp/test.win deleted file mode 100644 index 224ca5ad2..000000000 --- a/automation/source/miniapp/test.win +++ /dev/null @@ -1,13 +0,0 @@ -*active -*GrosserTestDlg UID_GROSSER_TEST_DLG -CheckBox UID_CheckBox -TriStateBox UID_TriStateBox -OKButton UID_OKButton -TimeField UID_TimeField -MultiLineEdit UID_MultiLineEdit -RadioButton1 UID_RadioButton1 -RadioButton2 UID_RadioButton2 -MultiListBox UID_MultiListBox -ComboBox UID_ComboBox -DateBox UID_DateBox - diff --git a/automation/source/miniapp/testapp.cxx b/automation/source/miniapp/testapp.cxx deleted file mode 100644 index 2fb5ef843..000000000 --- a/automation/source/miniapp/testapp.cxx +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "servres.hrc" -#include "servres.hxx" -#include "testapp.hxx" - -using namespace comphelper; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace com::sun::star::ucb; - -using ::rtl::OUString; - -static ResMgr* pAppMgr = NULL; - -MainWindow::MainWindow(MyApp *pAppl) -: WorkWindow(NULL, WB_STDWORK) -, pApp(pAppl) -{} - -IMPL_LINK(MainWindow,MenuSelectHdl,MenuBar*,aMenu) -{ - - return pApp->GetDispatcher()->ExecuteFunction(aMenu->GetCurItemId()); - -} - -void MainWindow::FileOpen() -{ - FileDialog Dlg(this,WB_OPEN ); - - Dlg.AddFilter(CUniString("Alle Dateien"), CUniString("*.*")); - Dlg.SetCurFilter (CUniString("*.*")); - - if (Dlg.Execute() == RET_OK) - { - new EditFileWindow(this,Dlg.GetPath()); - } -} - - -void MainWindow::TestGross() -{ - ModalDialogGROSSER_TEST_DLG Dlg(this,ResId(GROSSER_TEST_DLG, *pAppMgr)); - - if (Dlg.Execute() == RET_OK) - { - } -} - - -sal_Bool MainWindow::Close() -{ - WorkWindow::Close(); - FileExit(); - return sal_True; -} - -void MainWindow::FileExit() -{ - pApp->Quit(); -} - - -void MainWindow::Tree(GHEditWindow *aEditWin, Window *pBase, sal_uInt16 Indent) -{ - String sIndent,aText; - sIndent.Expand(5*Indent); - - aText = pBase->GetText(); - aText.SearchAndReplaceAllAscii("\n",CUniString("\\n")); - - aEditWin->AddText(String(sIndent).AppendAscii("Text: ").Append(aText).AppendAscii("\n")); - // FIXME: HELPID - aEditWin->AddText(String(sIndent).AppendAscii("Help: ").Append(String(rtl::OStringToOUString(pBase->GetHelpId(), RTL_TEXTENCODING_UTF8))).AppendAscii(":").Append(pBase->GetQuickHelpText()).AppendAscii(":").Append(pBase->GetHelpText()).AppendAscii("\n")); - - sal_uInt16 i; - for (i = 0 ; i < pBase->GetChildCount() ; i++) - { - Tree(aEditWin,pBase->GetChild(i),Indent+1); - } -} - -void MainWindow::WinTree() -{ - - GHEditWindow * aEditWin = new GHEditWindow(this,CUniString("Window Tree")); - Tree(aEditWin,this,0); - -} - -void MainWindow::SysDlg() -{ - switch (QueryBox(this,WB_YES_NO_CANCEL | WB_DEF_YES, CUniString("Want to open another Dialog?")).Execute()) - { - case RET_YES: - while ( WarningBox(this,WB_OK_CANCEL | WB_DEF_OK,CUniString("Well this is the last box now!")).Execute() == RET_OK ) ; - break; - case RET_NO: - break; - case RET_CANCEL:InfoBox(this,CUniString("Oh well..")).Execute(); - break; - } - -} - -MyApp aApp; - -MyApp::MyApp() -{ - pMainWin = NULL; - pMyDispatcher = NULL; -} - -void MyApp::Property( ApplicationProperty& rProp ) -{ - TTProperties* pTTProperties = PTR_CAST( TTProperties, &rProp ); - if ( pTTProperties ) - { - pTTProperties->nPropertyVersion = TT_PROPERTIES_VERSION; - switch ( pTTProperties->nActualPR ) - { - case TT_PR_DISPATCHER: - { - PlugInDispatcher* pDispatcher = GetDispatcher(); - if ( !pDispatcher ) - pTTProperties->nActualPR = TT_PR_ERR_NODISPATCHER; - else - { - pDispatcher->SetExecuteMode(EXECUTEMODE_DIALOGASYNCHRON); - if ( pDispatcher->ExecuteFunction( - pTTProperties->mnSID, pTTProperties->mppArgs, pTTProperties->mnMode ) - == EXECUTE_NO ) - pTTProperties->nActualPR = TT_PR_ERR_NOEXECUTE; - else - pTTProperties->nActualPR = 0; - } - } - break; - default: - { - pTTProperties->nPropertyVersion = 0; - } - } - return; - } -} - - -sal_uInt16 MyDispatcher::ExecuteFunction( sal_uInt16 nSID, SfxPoolItem** ppArgs, sal_uInt16 nMode) -{ - (void) ppArgs; // avoid warning about unused parameter - (void) nMode; // avoid warning about unused parameter - - switch (nSID) - { - case IDM_FILE_EXIT: pMainWin->FileExit(); break; - case IDM_FILE_OPEN_TEST: pMainWin->FileOpen(); break; - case IDM_TEST_GROSS: pMainWin->TestGross(); break; - case IDM_TEST_WINTREE: pMainWin->WinTree(); break; - case IDM_SYS_DLG: pMainWin->SysDlg(); break; - default: - { - OSL_TRACE("Dispatcher kennt Funktion nicht %s", rtl::OString::valueOf(static_cast(nSID)).getStr()); - return EXECUTE_NO; - } - - } - return EXECUTE_YES; -} - -PlugInDispatcher* MyApp::GetDispatcher() -{ - return pMyDispatcher; -} - -Reference< XContentProviderManager > InitializeUCB( void ) -{ - OUString path; - if( osl_Process_E_None != osl_getExecutableFile( (rtl_uString**)&path ) ) - { - InfoBox( NULL, String::CreateFromAscii( "Couldn't retrieve directory of executable" ) ).Execute(); - exit( 1 ); - } - OSL_ASSERT( path.lastIndexOf( '/' ) >= 0 ); - - - ::rtl::OUStringBuffer bufServices( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); - bufServices.appendAscii("services.rdb"); - OUString services = bufServices.makeStringAndClear(); - - ::rtl::OUStringBuffer bufTypes( path.copy( 0, path.lastIndexOf( '/' )+1 ) ); - bufTypes.appendAscii("types.rdb"); - OUString types = bufTypes.makeStringAndClear(); - - - Reference< XMultiServiceFactory > xSMgr; - try - { - xSMgr = createRegistryServiceFactory( types, services, sal_True ); - } - catch( com::sun::star::uno::Exception & exc ) - { - fprintf( stderr, "Couldn't bootstrap uno servicemanager for reason : %s\n" , - OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - InfoBox( NULL, String( exc.Message ) ).Execute(); - throw ; - } - - - ////////////////////////////////////////////////////////////////////// - // set global factory - setProcessServiceFactory( xSMgr ); - -// Create unconfigured Ucb: - Sequence< Any > aArgs; - ucbhelper::ContentBroker::initialize( xSMgr, aArgs ); - Reference< XContentProviderManager > xUcb = - ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); - - Reference< XContentProvider > xFileProvider - ( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.FileContentProvider" )) ), UNO_QUERY ); - xUcb->registerContentProvider( xFileProvider, OUString( RTL_CONSTASCII_USTRINGPARAM( "file" )), sal_True ); - - return xUcb; -} - -int MyApp::Main() -{ - Reference< XContentProviderManager > xUcb = InitializeUCB(); - LanguageType aRequestedLanguage; - aRequestedLanguage = LanguageType( LANGUAGE_GERMAN ); - - AllSettings aSettings = GetSettings(); - aSettings.SetUILanguage( aRequestedLanguage ); - aSettings.SetLanguage( aRequestedLanguage ); - SetSettings( aSettings ); - pAppMgr = CREATEVERSIONRESMGR( tma ); - - MainWindow MainWin(this); - pMainWin = &MainWin; - - MenuBar aMenu(ResId(MENU_CLIENT,*pAppMgr)); - MainWin.SetMenuBar( &aMenu ); - aMenu.GetPopupMenu( IDM_FILE )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); - aMenu.GetPopupMenu( IDM_TEST )->SetSelectHdl(LINK(&MainWin, MainWindow, MenuSelectHdl)); - - MyDispatcher MyDsp(pMainWin); - pMyDispatcher = &MyDsp; - - MainWin.SetText(CUniString("Star Division Test Tool Client Window")); - MainWin.Show(); - - RemoteControl aRC; - - Execute(); - return EXIT_SUCCESS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/miniapp/testapp.hxx b/automation/source/miniapp/testapp.hxx deleted file mode 100644 index 5441a6dd9..000000000 --- a/automation/source/miniapp/testapp.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _TESTAPP_HXX -#define _TESTAPP_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "editwin.hxx" - - -#define EXECUTE_NO 0 -#define EXECUTE_POSSIBLE 1 -#define EXECUTE_YES 2 -#define EXECUTEMODE_ASYNCHRON 1 -#define EXECUTEMODE_DIALOGASYNCHRON 2 - - -class MyApp; -class MainWindow : public WorkWindow -{ - MyApp *pApp; - -public: - MainWindow(MyApp *pAppl); - virtual sal_Bool Close(); // derived - - void FileExit(); - void FileOpen(); - void TestGross(); - void Tree(GHEditWindow *aEditWin, Window *pBase, sal_uInt16 Indent); - void WinTree(); - void SysDlg(); - DECL_LINK(MenuSelectHdl,MenuBar*); - -}; -#define PlugInDispatcher MyDispatcher -class MyDispatcher -{ - MainWindow *pMainWin; - -public: - MyDispatcher(MainWindow *MainWin) : pMainWin(MainWin) {}; - virtual ~MyDispatcher() {}; - virtual sal_uInt16 ExecuteFunction( sal_uInt16 nSID, SfxPoolItem** ppArgs = 0, sal_uInt16 nMode = 0); - virtual void SetExecuteMode( sal_uInt16 nMode ) - { - (void) nMode; /* avoid warning about unused parameter */ - }; // Ist hier sowieso egal -}; - -class MyApp : public Application -{ - Timer aCommandTimer; - PlugInDispatcher *pMyDispatcher; - -public: - MyApp(); - int Main(); - - virtual void Property( ApplicationProperty& ); - virtual PlugInDispatcher* GetDispatcher(); - - MainWindow *pMainWin; -}; - -// ----------------------------------------------------------------------- - -extern MyApp aApp; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/mozillaserver/makefile.mk b/automation/source/mozillaserver/makefile.mk deleted file mode 100644 index fcd7e1cc6..000000000 --- a/automation/source/mozillaserver/makefile.mk +++ /dev/null @@ -1,121 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=xxx -USE_DEFFILE=TRUE -NO_BSYMBOLIC=TRUE -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -PACKAGE := com$/sun$/star$/testtool -TARGET := com_sun_star_testtool - -RDB=$(BIN)$/mozillatesttool.rdb - - -GENJAVACLASSFILES = \ - $(CLASSDIR)$/$(PACKAGE)$/XAction.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionControl.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionCommand.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionControl.class \ - $(CLASSDIR)$/$(PACKAGE)$/XActionFlow.class \ - $(CLASSDIR)$/$(PACKAGE)$/XResult.class \ - $(CLASSDIR)$/$(PACKAGE)$/ResultType.class \ - $(CLASSDIR)$/$(PACKAGE)$/XMozillaTesttoolServer.class - - -TYPES={$(subst,.class, $(subst,$/,. $(subst,$(CLASSDIR)$/,-T $(GENJAVACLASSFILES))))} -GENJAVAFILES = {$(subst,.class,.java $(subst,$/class, $(GENJAVACLASSFILES)))} - - -UNOUCRDEP=$(RDB) -UNOUCRRDB=$(RDB) - -UNOUCROUT=$(OUT)$/inc -INCPRE+=$(OUT)$/inc - -UNOTYPES= \ - com.sun.star.uno.TypeClass \ - com.sun.star.uno.XAggregation \ - com.sun.star.uno.XWeak \ - com.sun.star.lang.XTypeProvider \ - com.sun.star.lang.XServiceInfo \ - com.sun.star.lang.XSingleServiceFactory \ - com.sun.star.lang.XMultiServiceFactory \ - com.sun.star.lang.XComponent \ - com.sun.star.lang.XMain \ - com.sun.star.loader.XImplementationLoader \ - com.sun.star.registry.XRegistryKey \ - com.sun.star.bridge.XUnoUrlResolver \ - com.sun.star.container.XSet \ - com.sun.star.testtool.XAction \ - com.sun.star.testtool.XActionControl \ - com.sun.star.testtool.XActionCommand \ - com.sun.star.testtool.XActionControl \ - com.sun.star.testtool.XActionFlow \ - com.sun.star.testtool.XResult \ - com.sun.star.testtool.ResultType \ - com.sun.star.testtool.XMozillaTesttoolServer - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(GENJAVAFILES) - -ALLIDLFILES= \ - mozillatesttoolserver.idl \ - xmozillatesttoolserver.idl - -$(RDB): $(ALLIDLFILES) - $(TOUCH) $@ - $(RM) $@ - unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $? - $(REGMERGE) $@ /UCR $(BIN)$/{$(ALLIDLFILES:f:s/.idl/.urd/)} - $(REGMERGE) $@ / $(SOLARBINDIR)$/applicat.rdb - $(REGCOMP) -register -r $@ -c $(DLLPRE)connectr$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)acceptor$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)brdgfctr$(DLLPOST) - $(REGCOMP) -register -r $@ -c $(DLLPRE)remotebridge$(DLLPOST) - $(TOUCH) $@ - - -$(GENJAVAFILES): $(RDB) - @echo Types: $(TYPES) - @echo Javafiles: $(GENJAVAFILES) - $(JAVAMAKER) -BUCR -O$(OUT) $(TYPES) $(RDB) - - diff --git a/automation/source/mozillaserver/mozillatesttoolserver.idl b/automation/source/mozillaserver/mozillatesttoolserver.idl deleted file mode 100644 index 365354ae3..000000000 --- a/automation/source/mozillaserver/mozillatesttoolserver.idl +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_testtool_MozillaTesttoolServer_idl__ -#define __com_sun_star_testtool_MozillaTesttoolServer_idl__ - -#include - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** - * This service provides the ability to control Mozilla - *
- */ -service MozillaTesttoolServer -{ - /** resolve objects via this interface. - */ - interface com::sun::star::testtool::XMozillaTesttoolServer; -}; - -//============================================================================= - -}; }; }; }; - -#endif diff --git a/automation/source/mozillaserver/xmozillatesttoolserver.idl b/automation/source/mozillaserver/xmozillatesttoolserver.idl deleted file mode 100644 index a1c6b83a5..000000000 --- a/automation/source/mozillaserver/xmozillatesttoolserver.idl +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_testtool_XMozillaTesttoolServer_idl__ -#define __com_sun_star_testtool_XMozillaTesttoolServer_idl__ - -#include -#include -#include - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XAction : com::sun::star::uno::XInterface -{ - /** execute one command -
- */ - void execute(); - -}; - -//============================================================================= - - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XActionControl : XAction -{ - /** execute one command -
- */ - void execute(); - -}; - -//============================================================================= - - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423753-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XActionCommand : XAction -{ - /** execute one command -
- */ - void execute(); - -}; - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2423743-33D6-11D1-AABE00A0-259D5623), ident( "XActionFlow", 1.0 ) ] -interface XActionFlow : XAction -{ - /** execute one command -
- */ - void execute(); - -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -module com { module sun { module star { module testtool { - - -enum ResultType - { - SEQUENCE, /// command with SEQUENCE has been executed - ERROR, /// An error has ocured - RESULT, /// Result of a request - ASSERTION, /// An Assertion has been captured - UI_INFO /// Info about the UserInterfaace - }; - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2426453-33D6-11D1-AABE00A0-259D5623), ident( "XResult", 1.0 ) ] -interface XResult : com::sun::star::uno::XInterface -{ - /** execute one command -
- */ - void SetResultType( [in] ResultType aType ); - ResultType GetResultType(); - - void SetValue( [in] any Value ); - any GetValue(); -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -module com { module sun { module star { module testtool { - -//============================================================================= -/** Service com.sun.star.devtools.IServerProxy implements this interface. - */ -[ uik(E2446735-33D6-11D1-AABE00A0-259D5623), ident( "XMozillaTesttoolServer", 1.0 ) ] -interface XMozillaTesttoolServer : com::sun::star::uno::XInterface -{ - /** Control the Mozilla Browser -
- */ - [oneway] void execute( [in] XAction aAction ); -// sequence < XResult > getResults( [in] boolean bBlock ); /// bBoch = TRUE means to wait for at least 1 result - -}; - -//============================================================================= - -}; }; }; }; - - -#endif diff --git a/automation/source/server/XMLParser.cxx b/automation/source/server/XMLParser.cxx deleted file mode 100644 index d056fba6f..000000000 --- a/automation/source/server/XMLParser.cxx +++ /dev/null @@ -1,689 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include "statemnt.hxx" -#include "rcontrol.hxx" -#include "retstrm.hxx" -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star::xml::sax; -using namespace com::sun::star::io; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; - -using ::rtl::OUString; - -class SVInputStream : public cppu::WeakImplHelper1< XInputStream > -{ - SvStream* pStream; -public: - SVInputStream( SvStream* pSt ):pStream( pSt ){}; - ~SVInputStream(){ delete pStream; pStream=NULL; } - - // Methods XInputStream - virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); -}; - - -sal_Int32 SAL_CALL SVInputStream::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) -{ - aData.realloc( nBytesToRead ); - sal_Int32 nRead = pStream->Read( aData.getArray(), nBytesToRead ); - aData.realloc( nRead ); - return nRead; -} - -sal_Int32 SAL_CALL SVInputStream::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) -{ - return readBytes( aData, nMaxBytesToRead ); -} - -void SAL_CALL SVInputStream::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) -{ - if ( nBytesToSkip > 0 ) - pStream->SeekRel( nBytesToSkip ); -} - -sal_Int32 SAL_CALL SVInputStream::available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - sal_uLong nCurrent = pStream->Tell(); - sal_uLong nSize = pStream->Seek( STREAM_SEEK_TO_END ); - sal_uLong nAvailable = nSize - nCurrent; - pStream->Seek( nCurrent ); - return nAvailable; -} - -void SAL_CALL SVInputStream::closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ -// pStream->Close(); // automatically done in destructor - delete pStream; - pStream = NULL; -} - -class Node; -SV_DECL_REF(Node) - -enum NodeType { NODE_CHARACTER = CONST_NodeTypeCharacter, - NODE_ELEMENT = CONST_NodeTypeElement, - NODE_COMMENT = CONST_NodeTypeComment }; - -class Node : public SvRefBase -{ - NodeType aNodeType; - Node* pParent; // Use pointer to prevent cyclic references resulting in undeleted objects - -protected: - Node( NodeType aType ): aNodeType( aType ), pParent( NULL ){}; - virtual ~Node(); - -public: - NodeType GetNodeType() { return aNodeType; } - void SetParent( NodeRef xNewParent ); - NodeRef GetParent(); -}; - -SV_IMPL_REF(Node) -// generate NodeRefMemberList -SV_DECL_IMPL_REF_LIST( NodeRef, Node* ) - -Node::~Node() -{ -} - -void Node::SetParent( NodeRef xNewParent ) -{ - pParent = &xNewParent; -} - -NodeRef Node::GetParent() -{ - return NodeRef( pParent ); -} - -class CharacterNode : public Node -{ - String aCharacters; -public: - CharacterNode( const String& aChars ): Node( NODE_CHARACTER ), aCharacters( aChars ){}; - - String GetCharacters() { return aCharacters; } -}; - -class ElementNode : public Node -{ - String aNodeName; - Reference < XAttributeList > xAttributeList; - NodeRefMemberList aDocumentNodeList; -public: - ElementNode( const String& aName, Reference < XAttributeList > xAttributes ); - void AppendNode( NodeRef xNewNode ); - sal_uLong GetChildCount(){ return aDocumentNodeList.Count(); } - NodeRef GetChild( sal_uInt16 nIndex ){ return aDocumentNodeList.GetObject( nIndex ); } - Reference < XAttributeList > GetAttributes(){ return xAttributeList; } - - String GetNodeName() { return aNodeName; } -}; - -ElementNode::ElementNode( const String& aName, Reference < XAttributeList > xAttributes ) -: Node( NODE_ELEMENT ) -, aNodeName( aName ) -{ - if ( xAttributes.is() ) - { - Reference < XCloneable > xAttributeCloner( xAttributes, UNO_QUERY ); - if ( xAttributeCloner.is() ) - xAttributeList = Reference < XAttributeList > ( xAttributeCloner->createClone() , UNO_QUERY ); - else - { - OSL_FAIL("Unable to clone AttributeList"); - } - } -}; - -void ElementNode::AppendNode( NodeRef xNewNode ) -{ - aDocumentNodeList.Insert ( xNewNode, LIST_APPEND ); - xNewNode->SetParent( this ); -} - -// XIndexAccess - - - - - -enum ParseAction { COLLECT_DATA, COLLECT_DATA_IGNORE_WHITESPACE, PARSE_ONLY }; - -class SAXParser : public cppu::WeakImplHelper2< XErrorHandler, XDocumentHandler > -{ - String aFilename; - Reference < XParser > xParser; - - // XErrorHandler - void AddToList( const sal_Char* cuType, const ::com::sun::star::uno::Any& aSAXParseException ); - String aErrors; - - NodeRef xTreeRoot; - NodeRef xCurrentNode; - sal_uLong nTimestamp; - ParseAction aAction; - -public: - SAXParser( const String &rFilename ); - ~SAXParser(); - - // Access Methods - NodeRef GetCurrentNode(){ return xCurrentNode; } - void SetCurrentNode( NodeRef xCurrent ){ xCurrentNode = xCurrent; } - NodeRef GetRootNode(){ return xTreeRoot; } - sal_uLong GetTimestamp(){ return nTimestamp; } - void Touch(){ nTimestamp = Time::GetSystemTicks(); } - - // Methods SAXParser - sal_Bool Parse( ParseAction aAct ); - String GetErrors(){ return aErrors; } - - // Methods XErrorHandler - virtual void SAL_CALL error( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL fatalError( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL warning( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - - // Methods XDocumentHandler - virtual void SAL_CALL startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); -}; - - -SAXParser::SAXParser( const String &rFilename ) -: aFilename( rFilename ) -{ - Touch(); -} - -SAXParser::~SAXParser() -{ - xParser.clear(); -} - -sal_Bool SAXParser::Parse( ParseAction aAct ) -{ - aAction = aAct; - Touch(); - SvStream* pStream = new SvFileStream( aFilename, STREAM_STD_READ ); - if ( pStream->GetError() ) - return sal_False; - - InputSource sSource; - sSource.aInputStream = new SVInputStream( pStream ); // is refcounted and hence deletet appropriately - sSource.sPublicId = OUString( aFilename ); - - xParser = Reference < XParser > ( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.xml.sax.Parser") ), UNO_QUERY ); - if ( xParser.is() ) - { - xParser->setErrorHandler( ( XErrorHandler*) this ); - if ( aAction == COLLECT_DATA || aAction == COLLECT_DATA_IGNORE_WHITESPACE ) - xParser->setDocumentHandler( ( XDocumentHandler*) this ); - - try - { - xParser->parseStream ( sSource ); - } - catch( class SAXParseException & rPEx) - { - // TODO - } - catch( class Exception & rEx) - { - // TODO - } - xParser->setErrorHandler( NULL ); // otherwile Object holds itself - if ( aAction == COLLECT_DATA || aAction == COLLECT_DATA_IGNORE_WHITESPACE ) - xParser->setDocumentHandler( NULL ); // otherwile Object holds itself - } - else - return sal_False; - return sal_True; -} - - -// Helper Methods XErrorHandler -void SAXParser::AddToList( const sal_Char* cuType, const ::com::sun::star::uno::Any& aSAXParseException ) -{ - SAXParseException aException; - aSAXParseException >>= aException; - - aErrors.Append( String( aException.PublicId ) ); - aErrors.AppendAscii( "(" ); - aErrors.Append( String::CreateFromInt64( aException.LineNumber ) ); - aErrors.AppendAscii( ":" ); - aErrors.Append( String::CreateFromInt64( aException.ColumnNumber ) ); - aErrors.AppendAscii( ") : " ); - aErrors.AppendAscii( cuType ); - aErrors.AppendAscii( ": " ); - aErrors.Append( String( aException.Message ) ); - aErrors.AppendAscii( "\n" ); -} - -// Methods XErrorHandler -void SAL_CALL SAXParser::error( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - AddToList( "error", aSAXParseException ); -} - -void SAL_CALL SAXParser::fatalError( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - AddToList( "fatal error", aSAXParseException ); -} - -void SAL_CALL SAXParser::warning( const ::com::sun::star::uno::Any& aSAXParseException ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - AddToList( "warning", aSAXParseException ); -} - - -// Methods XDocumentHandler -void SAXParser::startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - xTreeRoot = new ElementNode( CUniString("/"), Reference < XAttributeList > (NULL) ); - xCurrentNode = xTreeRoot; - Touch(); -} - -void SAXParser::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ -} - -void SAXParser::startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - NodeRef xNewNode = new ElementNode ( String(aName), xAttribs ); - ((ElementNode*)(&xCurrentNode))->AppendNode( xNewNode ); - xCurrentNode = xNewNode; -} - -void SAXParser::endElement( const ::rtl::OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - (void) aName; /* avoid warning about unused parameter */ - xCurrentNode = xCurrentNode->GetParent(); -} - -void SAXParser::characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - if ( aAction == COLLECT_DATA_IGNORE_WHITESPACE ) - { // check for whitespace - sal_Bool bAllWhitespace = sal_True; - for ( int i = 0 ; bAllWhitespace && i < aChars.getLength() ; i++ ) - if ( aChars[i] != 10 // LF - && aChars[i] != 13 // CR - && aChars[i] != ' ' // Blank - && aChars[i] != '\t' ) // Tab - bAllWhitespace = sal_False; - if ( bAllWhitespace ) - return; - } - NodeRef xNewNode = new CharacterNode ( String(aChars) ); - ((ElementNode*)(&xCurrentNode))->AppendNode( xNewNode ); -} - -void SAXParser::ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - (void) aWhitespaces; /* avoid warning about unused parameter */ -} - -void SAXParser::processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - (void) aTarget; /* avoid warning about unused parameter */ - (void) aData; /* avoid warning about unused parameter */ -} - -void SAXParser::setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - (void) xLocator; /* avoid warning about unused parameter */ -#if OSL_DEBUG_LEVEL > 1 - ::rtl::OUString aTester; - aTester = xLocator->getPublicId(); - aTester = xLocator->getSystemId(); -#endif -} - - - - -void StatementCommand::HandleSAXParser() -{ - static Reference < XReference > xParserKeepaliveReference; // this is to keep the Object alive only - static SAXParser* pSAXParser; - - // We need spechial prerequisites for these! - - ElementNode* pElementNode = NULL; - switch ( nMethodId ) - { - case RC_SAXGetNodeType: - case RC_SAXGetAttributeCount: - case RC_SAXGetAttributeName: - case RC_SAXGetAttributeValue: - case RC_SAXGetChildCount: - case RC_SAXGetElementName: - case RC_SAXGetChars: - - case RC_SAXSeekElement: - case RC_SAXHasElement: - case RC_SAXGetElementPath: - { - if ( xParserKeepaliveReference.is() && pSAXParser->GetCurrentNode().Is() ) - { - if ( pSAXParser->GetCurrentNode()->GetNodeType() == NODE_ELEMENT ) - { - NodeRef xNode=pSAXParser->GetCurrentNode(); - pElementNode = (ElementNode*)(&xNode); - } - } - else - { - ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) ); - return; - } - - } - } - - switch ( nMethodId ) - { - case RC_SAXCheckWellformed: - { - if( (nParams & PARAM_STR_1) ) - { - xParserKeepaliveReference.clear(); - pSAXParser = new SAXParser( aString1 ); - xParserKeepaliveReference = ( XReference* )pSAXParser; - if ( !xParserKeepaliveReference.is() ) - ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) ); - else - { - if ( !pSAXParser->Parse( PARSE_ONLY ) ) - ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) ); - pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetErrors() ); - } - - xParserKeepaliveReference.clear(); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - - case RC_SAXReadFile: - { - if( (nParams & PARAM_STR_1) ) - { - ParseAction aAction; - if( (nParams & PARAM_BOOL_1) && bBool1 ) - aAction = COLLECT_DATA; - else - aAction = COLLECT_DATA_IGNORE_WHITESPACE; - - xParserKeepaliveReference.clear(); - pSAXParser = new SAXParser( aString1 ); - xParserKeepaliveReference = ( XReference* )pSAXParser; - if ( !xParserKeepaliveReference.is() ) - ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) ); - else - { - - if ( !pSAXParser->Parse( aAction ) ) - ReportError( GEN_RES_STR1( S_NO_SAX_PARSER, RcString( nMethodId ) ) ); - pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetErrors() ); - } - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_SAXGetNodeType: - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pSAXParser->GetCurrentNode()->GetNodeType() ); - } - break; - case RC_SAXGetAttributeCount: - case RC_SAXGetAttributeName: - case RC_SAXGetAttributeValue: - case RC_SAXGetChildCount: - case RC_SAXGetElementName: - { - if ( pElementNode ) - { - Reference < XAttributeList > xAttributeList = pElementNode->GetAttributes(); - switch ( nMethodId ) - { - case RC_SAXGetElementName: - pRet->GenReturn ( RET_Value, nMethodId, pElementNode->GetNodeName() ); - break; - case RC_SAXGetChildCount: - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pElementNode->GetChildCount() ); - break; - case RC_SAXGetAttributeCount: - if ( xAttributeList.is() ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)xAttributeList->getLength() ); - else - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)0 ); - break; - case RC_SAXGetAttributeName: - { - if( (nParams & PARAM_UINT16_1) && ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, xAttributeList.is()?xAttributeList->getLength():0 ) ) - { - String aRet( xAttributeList->getNameByIndex( nNr1-1 ) ); - pRet->GenReturn ( RET_Value, nMethodId, aRet ); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_SAXGetAttributeValue: - // Number or String - { - if( (nParams & PARAM_UINT16_1) && ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, xAttributeList.is()?xAttributeList->getLength():0 ) ) - { - String aRet( xAttributeList->getValueByIndex( nNr1-1 ) ); - pRet->GenReturn ( RET_Value, nMethodId, aRet ); - } - else if( (nParams & PARAM_STR_1) && xAttributeList.is() ) - { - String aRet( xAttributeList->getValueByName( aString1 ) ); - pRet->GenReturn ( RET_Value, nMethodId, aRet ); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - - default: - ReportError( GEN_RES_STR1( S_INTERNAL_ERROR, RcString( nMethodId ) ) ); - } - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_SAXGetChars: - { - if ( pSAXParser->GetCurrentNode()->GetNodeType() == NODE_CHARACTER ) - { - NodeRef xNode=pSAXParser->GetCurrentNode(); - CharacterNode* aCharacterNode = (CharacterNode*)(&xNode); - pRet->GenReturn ( RET_Value, nMethodId, aCharacterNode->GetCharacters() ); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - - case RC_SAXSeekElement: - case RC_SAXHasElement: - // Number or String - { - sal_Bool bCheckOnly = nMethodId == RC_SAXHasElement; - - if( (nParams & PARAM_UINT16_1) && !(nParams & PARAM_STR_1) ) - { - if ( nNr1 == 0 ) - { - if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, pSAXParser->GetCurrentNode()->GetParent().Is() ); - else if ( pSAXParser->GetCurrentNode()->GetParent().Is() ) - pSAXParser->SetCurrentNode( pSAXParser->GetCurrentNode()->GetParent() ); - } - else if ( !pElementNode ) - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - else if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, pElementNode->GetChildCount() ) ); - else if ( ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, pElementNode->GetChildCount() ) ) - pSAXParser->SetCurrentNode( pElementNode->GetChild( nNr1-1 ) ); - } - else if( (nParams & PARAM_STR_1) ) - { - if ( aString1.EqualsAscii( "/" ) ) - { - if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)sal_True ); - else - pSAXParser->SetCurrentNode( pSAXParser->GetRootNode() ); - } - else if ( aString1.Copy(0,2).EqualsAscii( "*:" ) ) - { - sal_uLong nTimestamp = (sal_uLong)aString1.GetToken( 1, ':' ).ToInt64(); - sal_uLong nPointer = (sal_uLong)aString1.GetToken( 2, ':' ).ToInt64(); - if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)(pSAXParser->GetTimestamp() == nTimestamp) ); - else - if ( pSAXParser->GetTimestamp() == nTimestamp ) - { - { - Node* pNode = (Node*)nPointer; - pSAXParser->SetCurrentNode( NodeRef( pNode ) ); - } - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - else if ( pElementNode ) - { - sal_uInt16 nNthOccurrence; - if( (nParams & PARAM_UINT16_1) ) - nNthOccurrence = nNr1; - else - nNthOccurrence = 1; - - sal_uInt16 i; - NodeRef xNew; - for ( i = 0 ; i < pElementNode->GetChildCount() && !xNew.Is() ; i++ ) - { - xNew = pElementNode->GetChild( i ); - if ( xNew->GetNodeType() == NODE_ELEMENT ) - { - ElementNode* pNewElement = (ElementNode*)(&xNew); - if ( aString1.Equals( pNewElement->GetNodeName() ) ) - { - if ( nNthOccurrence > 1 ) - { - xNew.Clear(); - nNthOccurrence--; - } - } - else - xNew.Clear(); - } - else - xNew.Clear(); - } - if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, xNew.Is() ); - else - if ( xNew.Is() ) - pSAXParser->SetCurrentNode( xNew ); - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - else - if ( bCheckOnly ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)sal_False ); - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_SAXGetElementPath: - { - DBG_ASSERT( sizeof( sal_uIntPtr ) == sizeof ( void* ), "Pointertype has different size than sal_uIntPtr"); - String aPath; - aPath.AppendAscii( "*:" ); - aPath.Append( String::CreateFromInt64( pSAXParser->GetTimestamp() ) ); - aPath.AppendAscii( ":" ); - NodeRef xNode=pSAXParser->GetCurrentNode(); - Node* pNode = (Node*)(&xNode); - aPath.Append( String::CreateFromInt64( (sal_uIntPtr)pNode ) ); - pRet->GenReturn ( RET_Value, nMethodId, aPath ); - } - break; - - case RC_SAXRelease: - { - xParserKeepaliveReference.clear(); - } - break; - default: - ReportError( GEN_RES_STR1( S_INTERNAL_ERROR, RcString( nMethodId ) ) ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/cmdbasestream.cxx b/automation/source/server/cmdbasestream.cxx deleted file mode 100644 index 4d8dfe844..000000000 --- a/automation/source/server/cmdbasestream.cxx +++ /dev/null @@ -1,353 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ -#include -#include - -#include "cmdbasestream.hxx" -#include "rcontrol.hxx" - -CmdBaseStream::CmdBaseStream() -: pCommStream( NULL ) -{ -} - -CmdBaseStream::~CmdBaseStream() -{ -} - -void CmdBaseStream::GenError (rtl::OString *pUId, comm_String *pString ) -{ - Write(comm_UINT16(SIReturnError)); - Write(pUId); - Write(pString); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT32 nUId ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(nUId); - Write(comm_UINT16(PARAM_NONE)); // Typ der folgenden Parameter -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE"))) - Write(comm_UINT32(0)); - else - Write(pUId); - Write(comm_UINT16(PARAM_UINT32_1)); // Typ der folgenden Parameter - Write(nNr); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_String *pString ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE"))) - Write(comm_UINT32(0)); - else - Write(pUId); - Write(comm_UINT16(PARAM_STR_1)); // Typ der folgenden Parameter - Write(pString); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_BOOL bBool ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE"))) - Write(comm_UINT32(0)); - else - Write(pUId); - Write(comm_UINT16(PARAM_BOOL_1)); // Typ der folgenden Parameter - Write(bBool); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, rtl::OString *pUId, comm_UINT32 nNr, comm_String *pString, comm_BOOL bBool ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - if (pUId->equalsL(RTL_CONSTASCII_STRINGPARAM("UID_ACTIVE"))) - Write(comm_UINT32(0)); - else - Write(pUId); - Write(comm_UINT16(PARAM_UINT32_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter - Write(nNr); - Write(pString); - Write(bBool); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT32 nNr ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed) - Write(comm_UINT16(PARAM_UINT32_1)); // Typ der folgenden Parameter - Write(nNr); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_String *pString ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed) - Write(comm_UINT16(PARAM_STR_1)); // Typ der folgenden Parameter - Write(pString); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_BOOL bBool ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed) - Write(comm_UINT16(PARAM_BOOL_1)); // Typ der folgenden Parameter - Write(bBool); -} - -void CmdBaseStream::GenReturn (comm_UINT16 nRet, comm_UINT16 nMethod, comm_UINT16 nNr ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed) - Write(comm_UINT16(PARAM_UINT16_1)); // Typ der folgenden Parameter - Write(nNr); -} - - -// MacroRecorder -void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(pUId); - Write(comm_UINT16(PARAM_UINT16_1)); // Typ der folgenden Parameter - Write(nMethod); -} - -void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(pUId); - Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1)); // Typ der folgenden Parameter - Write(nMethod); - Write(pString); -} - -void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_String *pString, comm_BOOL bBool ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(pUId); - Write(comm_UINT16(PARAM_UINT16_1|PARAM_STR_1|PARAM_BOOL_1)); // Typ der folgenden Parameter - Write(nMethod); - Write(pString); - Write(bBool); -} - -void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_BOOL bBool ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(pUId); - Write(comm_UINT16(PARAM_UINT16_1|PARAM_BOOL_1)); // Typ der folgenden Parameter - Write(nMethod); - Write(bBool); -} - -void CmdBaseStream::GenReturn( comm_UINT16 nRet, rtl::OString *pUId, comm_UINT16 nMethod, comm_UINT32 nNr ) -{ - Write(comm_UINT16(SIReturn)); - Write(nRet); - Write(pUId); - Write(comm_UINT16(PARAM_UINT16_1|PARAM_UINT32_1)); // Typ der folgenden Parameter - Write(nMethod); - Write(nNr); -} - - - -void CmdBaseStream::Read (comm_UINT16 &nNr) -{ - comm_UINT16 nId; - *pCommStream >> nId; - if (pCommStream->IsEof()) return; -#if OSL_DEBUG_LEVEL > 1 - if (nId != BinUINT16) OSL_TRACE( "Falscher Typ im Stream: Erwartet USHORT, gefunden :%hu", nId ); -#endif - *pCommStream >> nNr; -} - -void CmdBaseStream::Read (comm_UINT32 &nNr) -{ - comm_UINT16 nId; - *pCommStream >> nId; - if (pCommStream->IsEof()) return; -#if OSL_DEBUG_LEVEL > 1 - if (nId != BinUINT32) OSL_TRACE( "Falscher Typ im Stream: Erwartet ULONG, gefunden :%hu", nId ); -#endif - *pCommStream >> nNr; -} - -void CmdBaseStream::Read (comm_UniChar* &aString, comm_UINT16 &nLenInChars ) -{ - comm_UINT16 nId; - *pCommStream >> nId; -#if OSL_DEBUG_LEVEL > 1 - if (nId != BinString) OSL_TRACE( "Falscher Typ im Stream: Erwartet String, gefunden :%hu", nId ); -#endif - - *pCommStream >> nLenInChars; - - aString = new comm_UniChar [nLenInChars]; - pCommStream->Read( aString, ((comm_UINT32)nLenInChars) * sizeof( comm_UniChar ) ); -#ifdef OSL_BIGENDIAN - // we have to change the byteorder - comm_UINT16 n; - for ( n = 0 ; n < nLenInChars ; n++ ) - aString[ n ] = aString[ n ] >> 8 | aString[ n ] << 8; -#endif -} - -void CmdBaseStream::Read (comm_BOOL &bBool) -{ - comm_UINT16 nId; - *pCommStream >> nId; -#if OSL_DEBUG_LEVEL > 1 - if (nId != BinBool) OSL_TRACE( "Falscher Typ im Stream: Erwartet BOOL, gefunden :%hu", nId ); -#endif - *pCommStream >> bBool; -} - -comm_UINT16 CmdBaseStream::GetNextType() -{ - comm_UINT16 nId; - *pCommStream >> nId; - pCommStream->SeekRel(-2); - return nId; -} - - -void CmdBaseStream::Write( comm_UINT16 nNr ) -{ - *pCommStream << comm_UINT16( BinUINT16 ); - *pCommStream << nNr; -} - -void CmdBaseStream::Write( comm_UINT32 nNr ) -{ - *pCommStream << comm_UINT16( BinUINT32 ); - *pCommStream << nNr; -} - -void CmdBaseStream::Write( const comm_UniChar* aString, comm_UINT16 nLenInChars ) -{ - *pCommStream << comm_UINT16(BinString); - - comm_UINT16 n; - - // remove BiDi and zero-width-markers 0x200B - 0x200F - // remove BiDi and paragraph-markers 0x2028 - 0x202E - - comm_UniChar* aNoBiDiString; - aNoBiDiString = new comm_UniChar [nLenInChars]; - comm_UINT16 nNewLenInChars = 0; - for ( n = 0 ; n < nLenInChars ; n++ ) - { - comm_UniChar c = aString[ n ]; - if ( ((c >= 0x200B) && (c <= 0x200F)) - ||((c >= 0x2028) && (c <= 0x202E)) ) - { //Ignore character - } - else - { - aNoBiDiString[ nNewLenInChars ] = c; - nNewLenInChars++; - } - } - - *pCommStream << nNewLenInChars; - -#ifdef OSL_BIGENDIAN - // we have to change the byteorder - comm_UniChar* aNewString; - aNewString = new comm_UniChar [nNewLenInChars]; - for ( n = 0 ; n < nNewLenInChars ; n++ ) - aNewString[ n ] = aNoBiDiString[ n ] >> 8 | aNoBiDiString[ n ] << 8; - pCommStream->Write( aNewString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) ); - delete [] aNewString; -#else - pCommStream->Write( aNoBiDiString, ((comm_UINT32)nNewLenInChars) * sizeof( comm_UniChar ) ); -#endif - - delete [] aNoBiDiString; -} - -void CmdBaseStream::Write( comm_BOOL bBool ) -{ - *pCommStream << comm_UINT16( BinBool ); - *pCommStream << bBool; -} - -void CmdBaseStream::Read ( comm_String* &pString ) -{ - (void) pString; /* avoid warning about unused parameter */ - OSL_FAIL("Read ( comm_String* &pString ) Not Implemented"); -} -void CmdBaseStream::Read ( rtl::OString* &pId ) -{ - (void) pId; /* avoid warning about unused parameter */ - OSL_FAIL("Read ( rtl::OString* &pId ) Not Implemented"); -} - -void CmdBaseStream::Write( comm_String *pString ) -{ - (void) pString; /* avoid warning about unused parameter */ - OSL_FAIL("Write( comm_String *pString ) Not Implemented"); -} -void CmdBaseStream::Write( rtl::OString* pId ) -{ - (void) pId; /* avoid warning about unused parameter */ - OSL_FAIL("Write( rtl::OString* pId ) Not Implemented"); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/editwin.cxx b/automation/source/server/editwin.cxx deleted file mode 100644 index 1decbaef4..000000000 --- a/automation/source/server/editwin.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include -#include "editwin.hxx" - - -class ImpWorkWindow : public WorkWindow -{ -public: - MultiLineEdit m_aInhalt; - ImpWorkWindow( WorkWindow *pParent, const UniString &rName, WinBits ); - ~ImpWorkWindow(); - void Resize(); -}; - -ImpWorkWindow::ImpWorkWindow( WorkWindow *pParent, const String &rName, WinBits iWstyle ) -: WorkWindow( pParent , WB_SIZEMOVE ) -, m_aInhalt( this, iWstyle ) -{ - m_aInhalt.Show(); - SetText(rName); - SetPosSizePixel( Point( 1,40 ), Size(500,150) ); - Resize(); -} - -ImpWorkWindow::~ImpWorkWindow() -{ - Hide(); -} - -void ImpWorkWindow::Resize() -{ - m_aInhalt.SetPosSizePixel( Point(), GetOutputSizePixel() ); -} - -sal_Bool EditWindow::Close() -{ - if ( pImpWorkWindow ) - { - delete pImpWorkWindow; - pImpWorkWindow = NULL; - } - return sal_True; -} - -void EditWindow::Show() -{ - if ( Check() ) - pImpWorkWindow->Show(); - else - bShowWin = sal_True; -} - -void EditWindow::Hide() -{ - if ( Check() ) - pImpWorkWindow->Hide(); - else - bShowWin = sal_False; -} - -EditWindow::EditWindow( WorkWindow *pParent, const String &rName, WinBits iWstyle ) -: pImpWorkWindow(NULL) -, pMemParent(pParent) -, aMemName(rName) -, iMemWstyle(iWstyle) -, nTextLen(0) -, bQuiet(sal_False) -{ -} - -EditWindow::~EditWindow() -{ - Close(); -} - -sal_Bool EditWindow::Check() -{ - if ( ! pImpWorkWindow && Application::IsInExecute() ) - { - pImpWorkWindow = new ImpWorkWindow( pMemParent, aMemName, iMemWstyle ); - pImpWorkWindow->m_aInhalt.SetText( aMemPreWinText ); - nTextLen = aMemPreWinText.Len(); - aMemPreWinText.Erase(); - if ( bShowWin ) - pImpWorkWindow->Show(); - return sal_True; - } - return pImpWorkWindow != NULL; -} - -void EditWindow::Clear() -{ - if ( Check() ) - { - pImpWorkWindow->m_aInhalt.SetText( String() ); - nTextLen = 0; - } - aMemPreWinText.Erase(); -} - -void EditWindow::AddText( const sal_Char* rNew ) -{ - AddText( UniString::CreateFromAscii( rNew ) ); -} - -void EditWindow::AddText( const String &rNew ) -{ - if ( bQuiet ) return; - - String aText = rNew; - aText.ConvertLineEnd(); - - if ( Check() ) - { - if ( nTextLen > 5000 ) - { - pImpWorkWindow->m_aInhalt.SetText( pImpWorkWindow->m_aInhalt.GetText().Erase(0,1000) ); - nTextLen = pImpWorkWindow->m_aInhalt.GetText().Len(); // Absolut, um Fehler sonstwo auszubügeln - } - - - pImpWorkWindow->m_aInhalt.SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) ); - pImpWorkWindow->m_aInhalt.ReplaceSelected( aText ); - nTextLen = nTextLen + aText.Len(); - pImpWorkWindow->m_aInhalt.SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) ); - } - else - { - aMemPreWinText += aText; - } -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/editwin.hxx b/automation/source/server/editwin.hxx deleted file mode 100644 index bfc7e184f..000000000 --- a/automation/source/server/editwin.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EDITWIN_HXX -#define _EDITWIN_HXX - -#if OSL_DEBUG_LEVEL > 1 - -#include - -#include - -class ImpWorkWindow; - -class EditWindow -{ -protected: - ImpWorkWindow *pImpWorkWindow; - sal_Bool check(); - - WorkWindow *pMemParent; - String aMemName; - WinBits iMemWstyle; - - String aMemPreWinText; - sal_Bool bShowWin; - - xub_StrLen nTextLen; // aus Performanzgründen eigene Länge mitführen - -public: - EditWindow( WorkWindow *pParent, const UniString &rName = UniString( RTL_CONSTASCII_USTRINGPARAM ( "Debug" ) ), WinBits iWstyle = WB_HSCROLL | WB_VSCROLL ); - virtual ~EditWindow(); - - void Clear(); - void Show(); - void Hide(); - void AddText( const String &rNew ); - void AddText( const sal_Char* rNew ); - - virtual sal_Bool Close(); // derived - sal_Bool bQuiet; - sal_Bool Check(); -}; - -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/makefile.mk b/automation/source/server/makefile.mk deleted file mode 100644 index a6e1ec711..000000000 --- a/automation/source/server/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=automation -TARGET=server - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(EXCEPTIONSFILES) \ - $(SLO)$/cmdbasestream.obj \ - $(SLO)$/editwin.obj \ - $(SLO)$/retstrm.obj \ - $(SLO)$/scmdstrm.obj \ - $(SLO)$/svcommstream.obj - - -OBJFILES = \ - $(OBJ)$/cmdbasestream.obj \ - $(OBJ)$/svcommstream.obj - -EXCEPTIONSFILES = \ - $(SLO)$/XMLParser.obj \ - $(SLO)$/profiler.obj \ - $(SLO)$/recorder.obj \ - $(SLO)$/server.obj \ - $(SLO)$/sta_list.obj \ - $(SLO)$/statemnt.obj - -NOOPTFILES = $(SLO)$/statemnt.obj - -.IF "$(OS)"=="SOLARIS" -SLOFILES += $(SLO)$/prof_usl.obj -.ELSE -SLOFILES += $(SLO)$/prof_nul.obj -.ENDIF - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/automation/source/server/prof_nul.cxx b/automation/source/server/prof_nul.cxx deleted file mode 100644 index b9106ec7c..000000000 --- a/automation/source/server/prof_nul.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - - -#include "profiler.hxx" -#include "rcontrol.hxx" -#include - -struct SysdepProfileSnapshot -{ - // Hier stehen alle Felder zum Speichern eines Snapshot -}; - - -struct SysdepStaticData -{ - // Hier steht alles, was während des Profiles ständig gebraucht wird -}; - - -void TTProfiler::InitSysdepProfiler() -{ - if ( !pSysDepStatic ) // Sollte immer so sein!! - pSysDepStatic = new SysdepStaticData; - // Hier initialisieren - -}; - -void TTProfiler::DeinitSysdepProfiler() -{ - if ( pSysDepStatic ) // Sollte immer so sein!! - { - // Hier aufräumen und eventuell Speicher freigeben - - delete pSysDepStatic; - } -}; - -SysdepProfileSnapshot *TTProfiler::NewSysdepSnapshotData() -{ - return new SysdepProfileSnapshot; -}; - -void TTProfiler::DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot ) -{ - delete pSysdepProfileSnapshot; -}; - - -// Titelzeile für Logdatei -String TTProfiler::GetSysdepProfileHeader() -{ - return String(CUniString("(noch) keine weiteren Daten Implementiert")); -}; - - -// Zustand merken -void TTProfiler::GetSysdepProfileSnapshot( SysdepProfileSnapshot *, sal_uInt16 ) -{}; - - -// Informationszeile zusammenbauen -String TTProfiler::GetSysdepProfileLine( SysdepProfileSnapshot *, SysdepProfileSnapshot * ) -{ - return String(); -}; - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/prof_usl.cxx b/automation/source/server/prof_usl.cxx deleted file mode 100644 index dfbbe0fd5..000000000 --- a/automation/source/server/prof_usl.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - - -#include -#include -#include "profiler.hxx" - - -struct SysdepProfileSnapshot -{ - pstatus mpstatus; - psinfo mpsinfo; - prusage mprusage; -}; - - -struct SysdepStaticData -{ - // Hier steht alles, was während des Profiles ständig gebraucht wird -}; - - -void TTProfiler::InitSysdepProfiler() -{ - if ( !pSysDepStatic ) // Sollte immer so sein!! - pSysDepStatic = new SysdepStaticData; - // Hier initialisieren - -}; - -void TTProfiler::DeinitSysdepProfiler() -{ - if ( pSysDepStatic ) // Sollte immer so sein!! - { - // Hier aufräumen und eventuell Speicher freigeben - - delete pSysDepStatic; - } -}; - -SysdepProfileSnapshot *TTProfiler::NewSysdepSnapshotData() -{ - return new SysdepProfileSnapshot; -}; - -void TTProfiler::DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot ) -{ - delete pSysdepProfileSnapshot; -}; - - -// Titelzeile für Logdatei -String TTProfiler::GetSysdepProfileHeader() -{ - return String::CreateFromAscii(" Size(Kb) ResidentSZ rtime ktime utime total"); -}; - - -// Zustand merken -void TTProfiler::GetSysdepProfileSnapshot( SysdepProfileSnapshot *pSysdepProfileSnapshot, sal_uInt16 ) -{ - SvFileStream aStream( String::CreateFromAscii("/proc/self/psinfo"), STREAM_READ ); // Das ist ein expliziter Pfad für UNXSOL! - if ( aStream.IsOpen() ) - { - aStream.Read( &(pSysdepProfileSnapshot->mpsinfo), sizeof( psinfo ) ); - aStream.Close(); - } - SvFileStream anotherStream( String::CreateFromAscii("/proc/self/status"), STREAM_READ ); // Das ist ein expliziter Pfad für UNXSOL! - if ( anotherStream.IsOpen() ) - { - anotherStream.Read( &(pSysdepProfileSnapshot->mpstatus), sizeof( pstatus ) ); - anotherStream.Close(); - } - SvFileStream YetAnotherStream( String::CreateFromAscii("/proc/self/usage"), STREAM_READ ); // Das ist ein expliziter Pfad für UNXSOL! - if ( YetAnotherStream.IsOpen() ) - { - YetAnotherStream.Read( &(pSysdepProfileSnapshot->mprusage), sizeof( prusage ) ); - YetAnotherStream.Close(); - } -}; - -#define DIFF2( aFirst, aSecond, Membername ) ( aSecond.Membername - aFirst.Membername ) -#define CALC_MS( nSec, nNSec ) ( nSec * 1000 + (nNSec+500000) / 1000000 ) -#define DIFF_MS( pStart, pEnd, Member ) ( CALC_MS( pEnd->Member.tv_sec, pEnd->Member.tv_nsec ) - CALC_MS( pStart->Member.tv_sec, pStart->Member.tv_nsec ) ) -// Informationszeile zusammenbauen -String TTProfiler::GetSysdepProfileLine( SysdepProfileSnapshot *pStart, SysdepProfileSnapshot *pStop ) -{ - String aProfile; - - aProfile += Pad( String::CreateFromInt64(pStop->mpsinfo.pr_size), 9); - aProfile += Pad( String::CreateFromInt64(pStop->mpsinfo.pr_rssize), 11); - - - aProfile += Pad( String::CreateFromInt64(DIFF_MS( pStart, pStop, mprusage.pr_rtime ) / AVER( pStart, pStop, mprusage.pr_count )), 7 ); - - - sal_uLong d_utime = DIFF_MS( pStart, pStop, mpstatus.pr_utime ) + DIFF_MS( pStart, pStop, mpstatus.pr_cutime ); - sal_uLong d_stime = DIFF_MS( pStart, pStop, mpstatus.pr_stime ) + DIFF_MS( pStart, pStop, mpstatus.pr_cstime ); - - aProfile += Pad( String::CreateFromInt64(d_utime), 7 ); - aProfile += Pad( String::CreateFromInt64(d_stime), 7 ); - aProfile += Pad( String::CreateFromInt64(d_utime + d_stime), 7 ); - - return aProfile; -}; - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/profiler.cxx b/automation/source/server/profiler.cxx deleted file mode 100644 index c8b623167..000000000 --- a/automation/source/server/profiler.cxx +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - - -#include -#include -#include -#include -#include - - -#include "profiler.hxx" - - -TTProfiler::TTProfiler() -: mpStart( NULL ) -, mpEnd( NULL ) -, bIsProfileIntervalStarted( sal_False ) -, bIsProfilingPerCommand( sal_False ) -, bIsPartitioning( sal_False ) -, bIsAutoProfiling( sal_False ) -, pSysDepStatic( NULL ) -{ - InitSysdepProfiler(); - mpStart = new ProfileSnapshot; - mpStart->pSysdepProfileSnapshot = NewSysdepSnapshotData(); - mpEnd = new ProfileSnapshot; - mpEnd->pSysdepProfileSnapshot = NewSysdepSnapshotData(); - StartProfileInterval(); -} - -TTProfiler::~TTProfiler() -{ - if ( IsAutoProfiling() ) - StopAutoProfiling(); - if ( mpStart ) - { - if ( mpStart->pSysdepProfileSnapshot ) - DeleteSysdepSnapshotData( mpStart->pSysdepProfileSnapshot ); - delete mpStart; - mpStart = NULL; - } - if ( mpEnd ) - { - if ( mpEnd->pSysdepProfileSnapshot ) - DeleteSysdepSnapshotData( mpEnd->pSysdepProfileSnapshot ); - delete mpEnd; - mpEnd = NULL; - } - DeinitSysdepProfiler(); -} - - -String TTProfiler::GetProfileHeader() -{ - UniString aReturn; - aReturn += '\n'; - if ( !IsAutoProfiling() ) - aReturn.AppendAscii("Befehl").Append(TabString(36)); - - aReturn.AppendAscii(" Zeitdauer"); - aReturn.AppendAscii(" Ticks in %"); - aReturn.Append( GetSysdepProfileHeader() ); - aReturn.AppendAscii("\n"); - return aReturn; -} - - -void TTProfiler::StartProfileInterval( sal_Bool bReadAnyway ) -{ - if ( !bIsProfileIntervalStarted || bReadAnyway ) - { - GetProfileSnapshot( mpStart ); - GetSysdepProfileSnapshot( mpStart->pSysdepProfileSnapshot, PROFILE_START ); - bIsProfileIntervalStarted = sal_True; - } -} - -String TTProfiler::GetProfileLine( ProfileSnapshot *pStart, ProfileSnapshot *pEnd ) -{ - String aProfileString; - - aProfileString += Pad(GetpApp()->GetAppLocaleDataWrapper().getDuration( DIFF( pStart, pEnd, aTime) , sal_True, sal_True ), 12); - - sal_uLong nProcessTicks = DIFF( pStart, pEnd, nProcessTicks ); - sal_uLong nSystemTicks = DIFF( pStart, pEnd, nSystemTicks ); - if ( nSystemTicks ) - { - aProfileString += Pad(UniString::CreateFromInt32( (100 * nProcessTicks) / nSystemTicks ), 11); - aProfileString += '%'; - } - else - aProfileString += Pad(CUniString("?? "), 12); - - return aProfileString; -} - - -String TTProfiler::GetProfileLine( String &aPrefix ) -{ - String aProfileString; - if ( IsProfilingPerCommand() || IsAutoProfiling() ) - { - aProfileString = aPrefix; - aProfileString += TabString(35); - - - aProfileString += GetProfileLine( mpStart, mpEnd ); - aProfileString += GetSysdepProfileLine( mpStart->pSysdepProfileSnapshot, mpEnd->pSysdepProfileSnapshot ); - aProfileString += '\n'; - } - - return aProfileString; -} - - -void TTProfiler::EndProfileInterval() -{ - GetProfileSnapshot( mpEnd ); - GetSysdepProfileSnapshot( mpEnd->pSysdepProfileSnapshot, PROFILE_END ); - bIsProfileIntervalStarted = sal_False; -} - - -void TTProfiler::GetProfileSnapshot( ProfileSnapshot *pProfileSnapshot ) -{ - pProfileSnapshot->aTime = Time(); - pProfileSnapshot->nProcessTicks = Time::GetProcessTicks(); - pProfileSnapshot->nSystemTicks = Time::GetSystemTicks(); -} - - -void TTProfiler::StartProfilingPerCommand() // Jeden Befehl mitschneiden -{ - bIsProfilingPerCommand = sal_True; -} - -void TTProfiler::StopProfilingPerCommand() -{ - bIsProfilingPerCommand = sal_False; -} - -void TTProfiler::StartPartitioning() -{ - bIsPartitioning = sal_True; -} - -void TTProfiler::StopPartitioning() -{ - bIsPartitioning = sal_True; -} - -sal_uLong TTProfiler::GetPartitioningTime() -{ - return DIFF( mpStart, mpEnd, nSystemTicks ); -} - - - -void TTProfiler::StartAutoProfiling( sal_uLong nMSec ) -{ - if ( !bIsAutoProfiling ) - { - pAutoStart = new ProfileSnapshot; - pAutoStart->pSysdepProfileSnapshot = NewSysdepSnapshotData(); - pAutoEnd = new ProfileSnapshot; - pAutoEnd->pSysdepProfileSnapshot = NewSysdepSnapshotData(); - GetProfileSnapshot( pAutoStart ); - GetSysdepProfileSnapshot( pAutoStart->pSysdepProfileSnapshot, PROFILE_START ); - SetTimeout( nMSec ); - bIsAutoProfiling = sal_True; - Start(); - } - -} - -void TTProfiler::Timeout() -{ - GetProfileSnapshot( pAutoEnd ); - GetSysdepProfileSnapshot( pAutoEnd->pSysdepProfileSnapshot, PROFILE_END ); - String aLine; - - aLine += GetProfileLine( pAutoStart, pAutoEnd ); - aLine += GetSysdepProfileLine( pAutoStart->pSysdepProfileSnapshot, pAutoEnd->pSysdepProfileSnapshot ); - aLine += '\n'; - - aAutoProfileBuffer += aLine; - - ProfileSnapshot *pTemp = pAutoStart; // Tauschen, so daß jetziges Ende nächsten Start wird - pAutoStart = pAutoEnd; - pAutoEnd = pTemp; - - Start(); // Timer neu starten -} - -String TTProfiler::GetAutoProfiling() -{ - String aTemp(aAutoProfileBuffer); - aAutoProfileBuffer.Erase(); - return aTemp; -} - -void TTProfiler::StopAutoProfiling() -{ - if ( bIsAutoProfiling ) - { - Stop(); - bIsAutoProfiling = sal_False; - } -} - - - -//String TTProfiler::Hex( sal_uLong nNr ) -String TTProfiler::Dec( sal_uLong nNr ) -{ - String aRet(UniString::CreateFromInt32(nNr)); - if ( nNr < 100 ) - { - aRet = Pad( aRet, 3); - aRet.SearchAndReplaceAll(' ','0'); - } - aRet.Insert( ',', aRet.Len() - 2 ); - return aRet; -} - -String TTProfiler::Pad( const String &aS, xub_StrLen nLen ) -{ - if ( nLen > aS.Len() ) - return UniString().Fill( nLen - aS.Len() ).Append( aS ); - else - return CUniString(" ").Append( aS ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/profiler.hxx b/automation/source/server/profiler.hxx deleted file mode 100644 index d6ff79b85..000000000 --- a/automation/source/server/profiler.hxx +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - - -#define AVER( pFirst, pSecond, Membername ) (( pFirst->Membername + pSecond->Membername ) / 2 ) -#define DIFF( pFirst, pSecond, Membername ) ( pSecond->Membername - pFirst->Membername ) -#define S_SAFEDIV( a,b ) ((b)==0?CUniString("#DIV"):UniString::CreateFromInt32( (ULONG) ((a)/(b)))) -#define S_SAFEDIV_DEC( a,b ) ((b)==0?CUniString("#DIV"):Dec((ULONG) ((a)/(b)))) - -#include -#include -#include - -#define PROFILE_START 0x01 -#define PROFILE_END 0x02 - - -struct SysdepProfileSnapshot; -struct SysdepStaticData; // Nicht wirklich statisch, sondern statisch �ber mehrere Snapshots - -struct ProfileSnapshot -{ - Time aTime; - SysdepProfileSnapshot *pSysdepProfileSnapshot; - sal_uLong nProcessTicks; - sal_uLong nSystemTicks; -}; - - -class TTProfiler : private Timer -{ -public: - TTProfiler(); - ~TTProfiler(); - - String GetProfileHeader(); // Titelzeile f�r Logdatei - void StartProfileInterval( sal_Bool bReadAnyway = sal_False ); // Zustand merken - void EndProfileInterval(); // Informationszeile zusammenbauen - String GetProfileLine( String &aPrefix ); - - - void StartProfilingPerCommand(); // Jeden Befehl mitschneiden - void StopProfilingPerCommand(); - sal_Bool IsProfilingPerCommand() { return bIsProfilingPerCommand; } - - void StartPartitioning(); - void StopPartitioning(); - sal_Bool IsPartitioning() { return bIsPartitioning; } - sal_uLong GetPartitioningTime(); - - void StartAutoProfiling( sal_uLong nMSec ); // Automatisch alle nMSec Milisekunden sampeln - String GetAutoProfiling(); // Aktuelle `Sammlung` abholen - void StopAutoProfiling(); // Sampeln beenden - sal_Bool IsAutoProfiling() { return bIsAutoProfiling; } - -private: - - void GetProfileSnapshot( ProfileSnapshot *pProfileSnapshot ); - - // Informationszeile zusammenbauen - String GetProfileLine( ProfileSnapshot *pStart, ProfileSnapshot *pStop ); - - - ProfileSnapshot *mpStart; - ProfileSnapshot *mpEnd; - sal_Bool bIsProfileIntervalStarted; - sal_Bool bIsProfilingPerCommand; - sal_Bool bIsPartitioning; - - -// F�r das Automatische Profiling in festen Intervallen - - ProfileSnapshot *pAutoStart; - ProfileSnapshot *pAutoEnd; - sal_Bool bIsAutoProfiling; - String aAutoProfileBuffer; - - virtual void Timeout(); - - -// Einige Hilfsfunktionen - - String Dec( sal_uLong nNr ); // Ergebnis = nNr / 100 mit 2 Dezimalen - String Pad( const String &aS, xub_StrLen nLen ); // F�gt blanks links an den String an - -/* Ab hier werden die Methoden Systemabh�ngig in den entsprechenden cxx implementiert - Sie werden von den oberen Methoden gerufen. -*/ - - SysdepStaticData *pSysDepStatic; - - void InitSysdepProfiler(); - void DeinitSysdepProfiler(); - - SysdepProfileSnapshot *NewSysdepSnapshotData(); - void DeleteSysdepSnapshotData( SysdepProfileSnapshot *pSysdepProfileSnapshot ); - - // Titelzeile f�r Logdatei - String GetSysdepProfileHeader(); - - // Zustand merken - void GetSysdepProfileSnapshot( SysdepProfileSnapshot *pSysdepProfileSnapshot, sal_uInt16 nMode = PROFILE_START | PROFILE_END ); - - // Informationszeile zusammenbauen - String GetSysdepProfileLine( SysdepProfileSnapshot *pStart, SysdepProfileSnapshot *pStop ); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/recorder.cxx b/automation/source/server/recorder.cxx deleted file mode 100644 index a88efbebf..000000000 --- a/automation/source/server/recorder.cxx +++ /dev/null @@ -1,661 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "statemnt.hxx" -#include "retstrm.hxx" -#include "rcontrol.hxx" -#include "recorder.hxx" - -#include - -MacroRecorder* MacroRecorder::pMacroRecorder = NULL; - -MacroRecorder::MacroRecorder() -: pLastWin( NULL ) -, pEditModify( NULL ) -, pActionParent( NULL ) -, aKeyUniqueID() -, pKeyWin( NULL ) -, bKeyFollowFocus( sal_False ) -, m_bRecord( sal_False ) -, m_bLog( sal_False ) -{ - aHookRefresh.SetTimeout( 500 ); - aHookRefresh.SetTimeoutHdl( LINK( this, MacroRecorder, HookRefreshHdl) ); - aHookRefresh.Start(); - aEventListenerHdl = LINK( this, MacroRecorder, EventListener ); - AddEventHooks(); -} - -MacroRecorder::~MacroRecorder() -{ - aHookRefresh.Stop(); - RemoveEventHooks(); -} - -void MacroRecorder::AddEventHooks() -{ - Window *pTopLevel = Application::GetFirstTopLevelWindow(); - while ( pTopLevel ) - { - Window *pParent = pTopLevel; - while ( pParent->GetParent() ) - pParent = pParent->GetParent(); - - pParent->RemoveChildEventListener( aEventListenerHdl ); // might be instrumented already - pParent->AddChildEventListener( aEventListenerHdl ); - - pTopLevel = Application::GetNextTopLevelWindow( pTopLevel ); - } -} - -void MacroRecorder::RemoveEventHooks() -{ - Window *pTopLevel = Application::GetFirstTopLevelWindow(); - while ( pTopLevel ) - { - pTopLevel->RemoveChildEventListener( aEventListenerHdl ); - pTopLevel = Application::GetNextTopLevelWindow( pTopLevel ); - } -} - -IMPL_LINK( MacroRecorder, HookRefreshHdl, void*, EMPTYARG ) -{ - AddEventHooks(); - return 0; -} - -void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 nParam ) -{ - ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod, nParam ); -} - -void MacroRecorder::LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod ) -{ - ::comphelper::UiEventsLogger::logVcl( Id2Str( aParentID ), nVCLWindowType, Id2Str( aID ), aMethod ); -} - -Window* MacroRecorder::GetParentWithID( Window* pThis ) -{ - Window *pOverlap = pThis->GetWindow( WINDOW_OVERLAP ); - while ( pOverlap != pThis && !pThis->GetUniqueOrHelpId().getLength() && pThis->GET_REAL_PARENT() ) - pThis = pThis->GET_REAL_PARENT(); - return pThis; -} - -rtl::OString MacroRecorder::GetParentID( Window* pThis ) -{ - if ( pThis->GetParent() ) - return pThis->GetParent()->GetUniqueOrHelpId(); - else - return rtl::OString(); -} - -IMPL_LINK( MacroRecorder, EventListener, VclSimpleEvent*, pEvent ) -{ - sal_Bool bSendData = sal_False; - - if ( pEvent->ISA( VclWindowEvent ) ) - { - VclWindowEvent* pWinEvent = ( VclWindowEvent* ) pEvent; - Window* pWin = pWinEvent->GetWindow(); - sal_uLong nEventID = pWinEvent->GetId(); -#if OSL_DEBUG_LEVEL > 1 - if ( nEventID >= 1001 && nEventID != VCLEVENT_WINDOW_KEYUP ) - nEventID = pWinEvent->GetId(); // Just something to set a breakpoint - else - return 0; -#endif - -// check for different action after collecting keys - // send if there_is_something_to_send - // and eather event_is_not_of_interest - // or ( new_window and new_window_is_interesting ) ( ignore interesting events to uninteresting window ) - - if ( aKeyString.Len() - && ( ( nEventID != VCLEVENT_WINDOW_KEYINPUT - && nEventID != VCLEVENT_WINDOW_MOUSEMOVE - && nEventID != VCLEVENT_WINDOW_COMMAND - && nEventID != VCLEVENT_WINDOW_KEYUP ) - || ( pKeyWin != pWin - && ( pWin->GetType() == WINDOW_CONTROL || pWin->GetType() == WINDOW_WINDOW ) - ) - ) - ) - { - if ( m_bRecord ) - { - // we cannot access pKeyWin since it might have dissapeared - if ( bKeyFollowFocus ) - StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString, bKeyFollowFocus ); - else - StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, aKeyString ); -#if OSL_DEBUG_LEVEL > 1 - StatementList::pRet->GenReturn( RET_MacroRecorder, aKeyUniqueID, (sal_uInt16)M_TypeKeys, String::CreateFromInt32( nEventID ) ); -#endif - bSendData = sal_True; - } - // cleanup - aKeyString.Erase(); - pKeyWin = NULL; - bKeyFollowFocus = sal_False; - } - - switch ( pWin->GetType() ) - { - case WINDOW_TABPAGE: - switch( nEventID ) - { - case VCLEVENT_WINDOW_ACTIVATE: - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, rtl::OString(), (comm_UINT16)(M_SetPage|M_RET_NUM_CONTROL), Id2Str( pWin->GetUniqueOrHelpId() ) ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("SetPage") ); - } - break; - } - break; - case WINDOW_RADIOBUTTON: - case WINDOW_IMAGERADIOBUTTON: - switch( nEventID ) - { - case VCLEVENT_BUTTON_CLICK: // VCLEVENT_RADIOBUTTON_TOGGLE - { - if ( ((RadioButton*)pWin)->IsChecked() ) - { - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Check ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Check") ); - } - } - } - break; - } - break; - case WINDOW_CHECKBOX: - case WINDOW_TRISTATEBOX: - switch( nEventID ) - { - case VCLEVENT_BUTTON_CLICK: //VCLEVENT_CHECKBOX_TOGGLE: - { - comm_UINT16 nMethod; - String aMethod; - switch ( ((TriStateBox*)pWin)->GetState() ) - { - case STATE_CHECK: nMethod = M_Check; aMethod = CUniString("Check"); break; - case STATE_NOCHECK: nMethod = M_UnCheck; aMethod = CUniString("UnCheck"); break; - case STATE_DONTKNOW: nMethod = M_TriState; aMethod = CUniString("TriState"); break; - default: nMethod = M_Check; - OSL_FAIL( "Unknown state in TriStateBox::GetState()" ); - } - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); - } - } - break; - } - break; - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - switch( nEventID ) - { - case VCLEVENT_EDIT_MODIFY: - pEditModify = pWin; - aEditModifyString = ((Edit*)pWin)->GetText(); - break; - } - break; - case WINDOW_MULTILISTBOX: - switch( nEventID ) - { - case VCLEVENT_LISTBOX_SELECT: - Sound::Beep(); - } - case WINDOW_LISTBOX: - switch( nEventID ) - { - case VCLEVENT_LISTBOX_SELECT: - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, comm_UINT32( ((ListBox*)pWin)->GetSelectEntryPos() +1 ) ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), ((ListBox*)pWin)->GetSelectEntryPos() ); - } - break; - } - break; - case WINDOW_COMBOBOX: - case WINDOW_PATTERNBOX: - case WINDOW_NUMERICBOX: - case WINDOW_METRICBOX: - case WINDOW_CURRENCYBOX: - case WINDOW_DATEBOX: - case WINDOW_TIMEBOX: - switch( nEventID ) - { - case VCLEVENT_EDIT_MODIFY: - pEditModify = pWin; - aEditModifyString = ((Edit*)pWin)->GetText(); - break; - case VCLEVENT_COMBOBOX_SELECT: - { - pEditModify = NULL; - aEditModifyString.Erase(); - - sal_uInt16 nPos = ((ComboBox*)pWin)->GetEntryPos(((ComboBox*)pWin)->GetText()); - if ( m_bRecord ) - { - if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) - Sound::Beep(); - else - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Select, (comm_UINT32) nPos+1 ); - bSendData = sal_True; - } - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Select"), nPos ); - } - } - } - break; - case WINDOW_PUSHBUTTON: - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_IMAGEBUTTON: - case WINDOW_MOREBUTTON: - case WINDOW_HELPBUTTON: - switch( nEventID ) - { - case VCLEVENT_BUTTON_CLICK: - Window* pParent = pWin->GetParent(); - sal_Bool bDone = sal_False; - if ( pParent->IsDialog() && !pWin->GetUniqueOrHelpId().getLength() ) - { - switch ( pParent->GetType() ) - { - case WINDOW_MESSBOX: - case WINDOW_INFOBOX: - case WINDOW_WARNINGBOX: - case WINDOW_ERRORBOX: - case WINDOW_QUERYBOX: - case WINDOW_BUTTONDIALOG: - { - comm_UINT16 nMethod; - String aMethod; - ButtonDialog* pBD = (ButtonDialog*)pParent; - - // we have to find the current Button ID ourselves since it is not generated at this point :-( - sal_uInt16 nCurrentButtonId = 0xffff; // Some wild value to wak up people - sal_uInt16 i; - for ( i = 0; i < pBD->GetButtonCount() ; i++ ) - { - if ( pBD->GetPushButton( pBD->GetButtonId(i) ) == pWin ) - { - nCurrentButtonId = pBD->GetButtonId(i); - break; - } - } - - switch ( nCurrentButtonId ) - { - case BUTTONID_OK: nMethod = M_OK; aMethod = CUniString("OK"); break; - case BUTTONID_CANCEL: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break; - case BUTTONID_YES: nMethod = M_Yes; aMethod = CUniString("Yes"); break; - case BUTTONID_NO: nMethod = M_No; aMethod = CUniString("No"); break; - case BUTTONID_RETRY: nMethod = M_Repeat; aMethod = CUniString("Repeat"); break; - case BUTTONID_HELP: nMethod = M_Help; aMethod = CUniString("Help"); break; - default: nMethod = M_Click; aMethod = CUniString("Click"); - } - if ( m_bRecord ) - { - if ( nMethod != M_Click ) - StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod ); - else - StatementList::pRet->GenReturn( RET_MacroRecorder, UID_ACTIVE, nMethod, (comm_UINT32)nCurrentButtonId ); - bSendData = sal_True; - } - if ( m_bLog ) - { - if ( nMethod != M_Click ) - LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); - else - LogVCL( rtl::OString(), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod, nCurrentButtonId ); - bDone = sal_True; - } - } - break; - default: - { - comm_UINT16 nMethod; - String aMethod; - switch ( pWin->GetType() ) - { - case WINDOW_OKBUTTON: nMethod = M_OK; aMethod = CUniString("OK"); break; - case WINDOW_CANCELBUTTON: nMethod = M_Cancel; aMethod = CUniString("Cancel"); break; - case WINDOW_HELPBUTTON: nMethod = M_Help; aMethod = CUniString("Help"); break; - default: nMethod = M_Default;aMethod = CUniString("Unknown Button"); - OSL_FAIL( "Unknown Button" ); - } - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pParent->GetUniqueOrHelpId(), nMethod ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); - bDone = sal_True; - } - } - break; - } - } - if ( m_bRecord ) - { - if ( !bSendData && pWin->GetUniqueOrHelpId().getLength() ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click ); - bSendData = sal_True; - } - } - if ( m_bLog ) - { - if ( !bDone ) - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") ); - } - } - break; - case WINDOW_SPINFIELD: - case WINDOW_PATTERNFIELD: - case WINDOW_NUMERICFIELD: - case WINDOW_METRICFIELD: - case WINDOW_CURRENCYFIELD: - case WINDOW_DATEFIELD: - case WINDOW_TIMEFIELD: - switch( nEventID ) - { - case VCLEVENT_SPINFIELD_UP: - case VCLEVENT_SPINFIELD_DOWN: - case VCLEVENT_SPINFIELD_FIRST: - case VCLEVENT_SPINFIELD_LAST: - { - pEditModify = NULL; - aEditModifyString.Erase(); - - comm_UINT16 nMethod; - String aMethod; - switch ( nEventID ) - { - case VCLEVENT_SPINFIELD_UP: nMethod = M_More; aMethod = CUniString("More"); break; - case VCLEVENT_SPINFIELD_DOWN: nMethod = M_Less; aMethod = CUniString("Less"); break; - case VCLEVENT_SPINFIELD_FIRST: nMethod = M_ToMin; aMethod = CUniString("ToMin"); break; - case VCLEVENT_SPINFIELD_LAST: nMethod = M_ToMax; aMethod = CUniString("ToMax"); break; - default: nMethod = M_ToMin; aMethod = CUniString("Unknown"); - OSL_FAIL( "Unknown EventID in Spinfield" ); - } - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), nMethod ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), aMethod ); - } - } - break; - case VCLEVENT_EDIT_MODIFY: - pEditModify = pWin; - aEditModifyString = ((SpinField*)pWin)->GetText(); - break; - } - break; - - case WINDOW_MENUBUTTON: - switch( nEventID ) - { - case VCLEVENT_BUTTON_CLICK: - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), (comm_UINT16)M_Click ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Click") ); - } - break; - } - break; - case WINDOW_TOOLBOX: - { - ToolBox *pTB = ((ToolBox*)pWin); - switch( nEventID ) - { - case VCLEVENT_TOOLBOX_SELECT: - { // a Button has been clicked - // so this cannot be a tearoff or OpenMenu anymore - pActionParent = NULL; - // compare to 1 for floating ToolBoxes - if ( m_bRecord ) - { - if ( !pWin->GetUniqueOrHelpId().getLength() /* || pWin->GetUniqueOrHelpId().Matches( 1 ) */ ) - // generate direct Button access - StatementList::pRet->GenReturn( RET_MacroRecorder, Str2Id( pTB->GetItemCommand( pTB->GetCurItemId() ) ), (comm_UINT16)(M_Click) ); - else - // access via Toolbox - StatementList::pRet->GenReturn( RET_MacroRecorder, pTB->GetUniqueOrHelpId(), (comm_UINT16)(M_Click|M_RET_NUM_CONTROL), Id2Str( pTB->GetHelpId( pTB->GetCurItemId() ) ) ); - bSendData = sal_True; - } - } - break; - case VCLEVENT_TOOLBOX_CLICK: /// ATTENTION this is called during initialisation of toolbox. whoever 'invented' this - pActionParent = pTB; - break; - case VCLEVENT_TOOLBOX_DEACTIVATE: - pActionParent = NULL; - break; - } - } - break; - case WINDOW_CONTROL: - case WINDOW_WINDOW: - switch( nEventID ) - { - case VCLEVENT_WINDOW_COMMAND: - break; - case VCLEVENT_WINDOW_KEYINPUT: - { - const KeyEvent *pKeyEvent = ((KeyEvent*)pWinEvent->GetData()); - const KeyCode aKeyCode = pKeyEvent->GetKeyCode(); - if ( pKeyEvent ) - { - pKeyWin = pWin; - Window *pIdWin = GetParentWithID( pWin ); - if ( pIdWin != pWin ) - bKeyFollowFocus = sal_True; - aKeyUniqueID = pIdWin->GetUniqueOrHelpId(); - if ( ( !aKeyCode.IsMod1() && !aKeyCode.IsMod2() ) && - (( aKeyCode.GetGroup() == KEYGROUP_NUM) || - ( aKeyCode.GetGroup() == KEYGROUP_ALPHA) || - ( aKeyCode.GetCode() == KEY_SPACE) || - ( aKeyCode.GetCode() == KEY_ADD) || - ( aKeyCode.GetCode() == KEY_SUBTRACT) || - ( aKeyCode.GetCode() == KEY_MULTIPLY) || - ( aKeyCode.GetCode() == KEY_DIVIDE) || - ( aKeyCode.GetCode() == KEY_POINT) || - ( aKeyCode.GetCode() == KEY_COMMA) || - ( aKeyCode.GetCode() == KEY_EQUAL) || - ( aKeyCode.GetCode() == 0) ) ) - { - DBG_ASSERT( pKeyEvent->GetCharCode(), "no charcode found" ); - aKeyString += pKeyEvent->GetCharCode(); - } - else - { // not a regular key, transfer KeyCode - aKeyString += sal_Unicode(1); // mask it - // extra for '>' which is coded as - if ( pKeyEvent->GetCharCode() == '>' ) - aKeyString += sal_Unicode( KEY_GREATER | (aKeyCode.GetAllModifier() & ~KEY_SHIFT) ); - else - aKeyString += sal_Unicode( aKeyCode.GetCode() | aKeyCode.GetAllModifier() ); - } - } - } - break; - - case VCLEVENT_WINDOW_MOUSEMOVE: - case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - } - break; - - - } - break; - case WINDOW_DOCKINGWINDOW: - { -// case 1 .. 0xffff: - OSL_TRACE( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin ); - } - break; - case WINDOW_FLOATINGWINDOW: - { - OSL_TRACE( "TT_VCLMessage %u %u %X",nEventID, pWin->GetType(), pWin ); - } - break; - } - - switch( nEventID ) - { - case VCLEVENT_CONTROL_LOSEFOCUS: - if ( pEditModify == pWin ) - { - if ( m_bRecord ) - { - StatementList::pRet->GenReturn( RET_MacroRecorder, pWin->GetUniqueOrHelpId(), M_SetText, aEditModifyString ); - bSendData = sal_True; - } - if ( m_bLog ) - { - LogVCL( GetParentID( pWin ), pWin->GetType(), pWin->GetUniqueOrHelpId(), CUniString("Modify") ); - } - pEditModify = NULL; - aEditModifyString.Erase(); //could be somewhat lengthy - } - break; - } - - pLastWin = pWin; - } // if - - if ( bSendData ) - new StatementFlow( NULL, F_EndCommandBlock ); // Kommando zum Senden erzeugen und in que eintragen - - return 0; -} - - - -static ::osl::Mutex * getRecorderMutex() -{ - static ::osl::Mutex * pMutex = NULL; - if(pMutex==NULL) - { - ::osl::MutexGuard aGuard(::osl::Mutex::getGlobalMutex()); - if(pMutex==NULL) - pMutex = new ::osl::Mutex(); - } - return pMutex; -} - - -void MacroRecorder::CheckDelete() -{ - ::osl::MutexGuard aGuard( getRecorderMutex() ); - if ( !m_bRecord && !m_bLog ) - { - pMacroRecorder = NULL; - delete this; - } -} - - -MacroRecorder* MacroRecorder::GetMacroRecorder() -{ - ::osl::MutexGuard aGuard( getRecorderMutex() ); - if ( !pMacroRecorder ) - pMacroRecorder = new MacroRecorder; - - return pMacroRecorder; -} - -sal_Bool MacroRecorder::HasMacroRecorder() -{ - ::osl::MutexGuard aGuard( getRecorderMutex() ); - return pMacroRecorder != NULL; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/recorder.hxx b/automation/source/server/recorder.hxx deleted file mode 100644 index 179319850..000000000 --- a/automation/source/server/recorder.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -class ToolBox; -class Window; -class VclSimpleEvent; - -class MacroRecorder -{ -private: - Window* GetParentWithID( Window* pThis ); - rtl::OString GetParentID( Window* pThis ); - - Link aEventListenerHdl; - DECL_LINK( EventListener, VclSimpleEvent* ); - - Window* pLastWin; - Window* pEditModify; - String aEditModifyString; - - ToolBox *pActionParent; // toolbox from which a tearoff or OpenMenu might happen - - // record keys - String aKeyString; - rtl::OString aKeyUniqueID; // has to be remembered seperately since Window might be gone when needed - Window* pKeyWin; - sal_Bool bKeyFollowFocus; - - AutoTimer aHookRefresh; - void AddEventHooks(); - void RemoveEventHooks(); - DECL_LINK( HookRefreshHdl, void* ); - - void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod, sal_uInt16 aParam ); - void LogVCL( rtl::OString aParentID, sal_uInt16 nVCLWindowType, rtl::OString aID, String aMethod ); - - static MacroRecorder *pMacroRecorder; - - MacroRecorder(); - ~MacroRecorder(); - void CheckDelete(); - - // Actions to perform - sal_Bool m_bRecord; - sal_Bool m_bLog; - -public: - - void SetActionRecord( sal_Bool bRecord = sal_True ) { m_bRecord = bRecord; CheckDelete(); }; - void SetActionLog( sal_Bool bLog = sal_True ) { m_bLog = bLog; CheckDelete(); }; - - static MacroRecorder* GetMacroRecorder(); - static sal_Bool HasMacroRecorder(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/retstrm.cxx b/automation/source/server/retstrm.cxx deleted file mode 100644 index 8cc639a43..000000000 --- a/automation/source/server/retstrm.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include - -#include "retstrm.hxx" -#include "rcontrol.hxx" -#include "svcommstream.hxx" - - -RetStream::RetStream() -{ - pSammel = new SvMemoryStream(); - pCommStream = new SvCommStream( pSammel ); -} - -RetStream::~RetStream() -{ - delete pCommStream; - delete pSammel; -} - -void RetStream::GenError ( rtl::OString aUId, String aString ) -{ - CmdBaseStream::GenError ( &aUId, &aString ); -} - -void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, String aString ) -{ - CmdBaseStream::GenReturn ( nRet, &aUId, &aString ); -} - -void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool ) -{ - CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool ); -} - -// MacroRecorder -void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString ) -{ - CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString ); -} - -void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool ) -{ - CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool ); -} - - -void RetStream::GenReturn ( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue ) -{ - Write(sal_uInt16(SIReturn)); - Write(nRet); - Write((comm_UINT32)nMethod); //HELPID BACKWARD (no sal_uLong needed) - Write(sal_uInt16(PARAM_SBXVALUE_1)); // Typ der folgenden Parameter - Write(aValue); -} - -void RetStream::GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString ) -{ - CmdBaseStream::GenReturn ( nRet, nMethod, &aString ); -} - - - - -void RetStream::Write( String *pString ) -{ - CmdBaseStream::Write( pString->GetBuffer(), pString->Len() ); -} - -void RetStream::Write( SbxValue &aValue ) -{ - *pSammel << sal_uInt16( BinSbxValue ); - aValue.Store( *pSammel ); -} - -void RetStream::Write( rtl::OString* pId ) -{ - //HELPID BACKWARD (should use ByteString or OString) - String aTmp( Id2Str( *pId ) ); - Write( &aTmp ); -} - - -SvStream* RetStream::GetStream() -{ - return pSammel; -} - -void RetStream::Reset () -{ - delete pCommStream; - delete pSammel; - pSammel = new SvMemoryStream(); - pCommStream = new SvCommStream( pSammel ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/retstrm.hxx b/automation/source/server/retstrm.hxx deleted file mode 100644 index 30e2625f5..000000000 --- a/automation/source/server/retstrm.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _RETSTRM_HXX -#define _RETSTRM_HXX - -#include -#include "cmdbasestream.hxx" - -class SvStream; - -class RetStream: public CmdBaseStream -{ - -public: - RetStream(); - ~RetStream(); - - using CmdBaseStream::GenError; - void GenError( rtl::OString aUId, String aString ); - - using CmdBaseStream::GenReturn; - void GenReturn( comm_UINT16 nRet, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, nNr );} - void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nNr );} - void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_BOOL bBool ){CmdBaseStream::GenReturn( nRet, &aUId, bBool );} - -// MacroRecorder - void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod );} // also used outside MacroRecorder - void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod, comm_BOOL bBool ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod, bBool );} - void GenReturn( comm_UINT16 nRet, rtl::OString aUId, comm_UINT16 nMethod, comm_UINT32 nNr ){CmdBaseStream::GenReturn( nRet, &aUId, nMethod, nNr );} - - void GenReturn( sal_uInt16 nRet, rtl::OString aUId, String aString ); - void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT32 nNr, String aString, sal_Bool bBool ); - -// needed for RemoteCommand and Profiling - void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue ); - void GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString ); - -// MacroRecorder - void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString ); - void GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_UINT16 nMethod, String aString, sal_Bool bBool ); - - void Reset(); - SvStream* GetStream(); - - - - using CmdBaseStream::Write; - void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );} - void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );} - void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );} - void Write( SbxValue &aValue ); - -// Complex Datatypes to be handled system dependent - virtual void Write( rtl::OString* pId ); - virtual void Write( String *pString ); - - SvStream *pSammel; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/scmdstrm.cxx b/automation/source/server/scmdstrm.cxx deleted file mode 100644 index 2ab459c7a..000000000 --- a/automation/source/server/scmdstrm.cxx +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include -#include -#include "scmdstrm.hxx" -#include "svcommstream.hxx" -#include "rcontrol.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include "editwin.hxx" -#include "statemnt.hxx" -#endif - -SCmdStream::SCmdStream(SvStream *pIn) -{ - pSammel = pIn; - pCommStream = new SvCommStream( pSammel ); -} - -SCmdStream::~SCmdStream() -{ - delete pCommStream; -} - -void SCmdStream::Read (String* &pString) -{ - if ( !pString ) - pString = new String(); - comm_UniChar* pStr; - sal_uInt16 nLenInChars; - CmdBaseStream::Read( pStr, nLenInChars ); - - *pString = String( pStr, nLenInChars ); - delete [] pStr; -} - -void SCmdStream::Read (String &aString) -{ - comm_UniChar* pStr; - sal_uInt16 nLenInChars; - CmdBaseStream::Read( pStr, nLenInChars ); - - aString = String( pStr, nLenInChars ); - delete [] pStr; -} - -void SCmdStream::Read ( SfxPoolItem *&pItem ) -{ - sal_uInt16 nType; - sal_uInt16 nId; - Read(nId); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "Parameter: " ); - StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nId ) ); - StatementList::m_pDbgWin->AddText( " " ); -#endif - Read( nType ); - switch (nType) - { - case BinUINT16: - { - comm_UINT16 nNr; - Read (nNr ); - pItem = new SfxUInt16Item(nId,nNr); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "UINT16" ); - StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) ); -#endif - } - break; - case BinUINT32: - { - comm_UINT32 nNr; - Read (nNr ); - pItem = new SfxUInt32Item(nId,nNr); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "UINT32" ); - StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) ); -#endif - } - break; - case BinString: - { - String aString; - Read (aString); - - pItem = new SfxStringItem(nId,aString); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "String:" ); - StatementList::m_pDbgWin->AddText( aString ); -#endif - } - break; - case BinBool: - { - comm_BOOL bBool; - Read (bBool); - pItem = new SfxBoolItem(nId,bBool); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "BOOL:" ); - StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" ); -#endif - } - break; - default: - OSL_TRACE( "Ungültiger Typ im Stream:%hu", nType ); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "Ungültiger Typ !!!! " ); -#endif - break; - } -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "\n" ); -#endif -} - -void SCmdStream::Read ( ::com::sun::star::beans::PropertyValue &rItem ) -{ - sal_uInt16 nType; - String aId; - Read(aId); - rItem.Name = rtl::OUString( aId ); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "Parameter: " ); - StatementList::m_pDbgWin->AddText( aId ); - StatementList::m_pDbgWin->AddText( " " ); -#endif - nType = GetNextType(); - switch (nType) - { - case BinUINT16: - { - comm_UINT16 nNr; - Read (nNr ); - rItem.Value <<= nNr; -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "UINT16" ); - StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) ); -#endif - } - break; - case BinUINT32: - { - comm_UINT32 nNr; - Read (nNr ); - rItem.Value <<= nNr; -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "UINT32" ); - StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) ); -#endif - } - break; - case BinString: - { - String aString; - Read (aString); - rItem.Value <<= ::rtl::OUString( aString ); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "String:" ); - StatementList::m_pDbgWin->AddText( aString ); -#endif - } - break; - case BinBool: - { - comm_BOOL bBool; - Read (bBool); - rItem.Value <<= bBool; -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "BOOL:" ); - StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" ); -#endif - } - break; - default: - OSL_TRACE( "Ungültiger Typ im Stream:%hu", nType ); -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "Ungültiger Typ !!!! " ); -#endif - break; - } -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "\n" ); -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/scmdstrm.hxx b/automation/source/server/scmdstrm.hxx deleted file mode 100644 index 5ef7a8c2b..000000000 --- a/automation/source/server/scmdstrm.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SCMDSTRM_HXX -#define _SCMDSTRM_HXX - -#include -#include - -#include "cmdbasestream.hxx" - -class SvStream; -class SfxPoolItem; -class String; -class ICommStream; - -class SCmdStream: public CmdBaseStream -{ - SvStream *pSammel; - -public: - SCmdStream( SvStream *pIn ); - ~SCmdStream(); - - using CmdBaseStream::Read; - void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );} - void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );} - void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );} - void Read ( String &aString ); - void Read ( SfxPoolItem *&pItem ); - void Read ( ::com::sun::star::beans::PropertyValue &rItem ); - - virtual void Read (String* &pString); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx deleted file mode 100644 index 0fdafedd4..000000000 --- a/automation/source/server/server.cxx +++ /dev/null @@ -1,889 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -// do not use Application Idle but AutoTimer instead -#define TIMERIDLE - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include "testtool.hrc" -#include -// Hat keinen Includeschutz -#include -#include -#include -#include -#include "statemnt.hxx" -#include "scmdstrm.hxx" -#include "rcontrol.hxx" -#include "server.hxx" -#include "testtool.hxx" -#include "automation/automation.hxx" -#include "recorder.hxx" - -#include "basic/svtmsg.hrc" - -#ifdef DBG_UTIL -void TestToolDebugPrint( const sal_Char *pString ) -{ - if ( !DbgFilterMessage( pString ) ) - StatementList::DirectLog( S_AssertError, UniString( pString, RTL_TEXTENCODING_UTF8 ) ); -} -void SAL_CALL osl_TestToolDebugPrint( const sal_Char *pString ) -{ - TestToolDebugPrint( pString ); -} -#endif - - -sal_uLong RemoteControlCommunicationManager::nPortIs = TT_PORT_NOT_INITIALIZED; -sal_uInt16 RemoteControlCommunicationManager::nComm = 0; -sal_Bool RemoteControlCommunicationManager::bQuiet = sal_False; - -#if OSL_DEBUG_LEVEL > 1 -RemoteControlCommunicationManager::RemoteControlCommunicationManager( EditWindow * pDbgWin ) -#else -RemoteControlCommunicationManager::RemoteControlCommunicationManager() -#endif -: CommunicationManagerServerViaSocket( GetPort(), 1, sal_True ) -#if OSL_DEBUG_LEVEL > 1 -, m_pDbgWin( pDbgWin ) -#endif -, pTimer( NULL ) -{ - bIsPortValid = ( GetPort() != 0 ); - if ( bQuiet ) - { - SetInfoType( CM_NO_TEXT ); - } - else - { - SetInfoType( CM_SHORT_TEXT | CM_ALL ); - ByteString aByteString; - InfoMsg( InfoString( aByteString, CM_ALL ) ); // Anzeigen, da� wir da sind - } -} - -RemoteControlCommunicationManager::~RemoteControlCommunicationManager() -{ - if ( pTimer ) - delete pTimer; - DoQuickShutdown(); -} - -void RemoteControlCommunicationManager::ConnectionOpened( CommunicationLink* pCL ) -{ - StatementFlow::pCommLink = pCL; - CommunicationManagerServerViaSocket::ConnectionOpened( pCL ); -} - - -void RemoteControlCommunicationManager::ConnectionClosed( CommunicationLink* pCL ) -{ - StatementFlow::pCommLink = NULL; - CommunicationManagerServerViaSocket::ConnectionClosed( pCL ); -} - - -IMPL_LINK( RemoteControlCommunicationManager, SetWinCaption, Timer*, EMPTYARG ) -{ - if ( pTimer ) - { - delete pTimer; - pTimer = NULL; - } - - if ( StatementList::GetFirstDocFrame() ) - { - if ( !aOriginalWinCaption.Len() ) - aOriginalWinCaption = StatementList::GetFirstDocFrame()->GetText(); - StatementList::GetFirstDocFrame()->SetText(String(aOriginalWinCaption).AppendAscii(" TT").Append(aAdditionalWinCaption).AppendAscii("[").Append(UniString::CreateFromInt32(nPortToListen)).AppendAscii("]")); - } - else - { // Dann Probieren wir es eben in 1 Sekunde nochmal - pTimer = new Timer(); // Wird im Link gel�scht - pTimer->SetTimeout( 1000 ); - pTimer->SetTimeoutHdl( LINK( this, RemoteControlCommunicationManager, SetWinCaption ) ); - pTimer->Start(); - } - return 0; -} - -void RemoteControlCommunicationManager::InfoMsg( InfoString aMsg ) -{ - if ( !bIsPortValid ) - return; - aAdditionalWinCaption = UniString( aMsg, RTL_TEXTENCODING_ASCII_US ); - SetWinCaption(); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( UniString( (ByteString)aMsg, RTL_TEXTENCODING_ASCII_US ) ); - m_pDbgWin->AddText( "\n" ); -#endif -} - -sal_uLong RemoteControlCommunicationManager::GetPort() -{ - if ( TT_PORT_NOT_INITIALIZED == nPortIs ) - { // Read Config - - sal_uInt16 i; - // are we to be automated at all? - sal_Bool bAutomate = sal_False; - for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("/enableautomation") - || Application::GetCommandLineParam( i ).EqualsIgnoreCaseAscii("-enableautomation")) - { - bAutomate = sal_True; - break; - } - } - -// if started within Portal determin location of testtool.ini/rc by analysing the commandline -// /userid:demo1[/export/home/user/demo1] -// -userid:demo1[/export/home/user/demo1] - String aIniFileDir; - for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("/userid:") - || Application::GetCommandLineParam( i ).Copy(0,8).EqualsIgnoreCaseAscii("-userid:") ) - { - rtl::OUString aEncHome - = Application::GetCommandLineParam(i).GetBuffer(); - - rtl::OUString aDecHome = rtl::Uri::decode(aEncHome, - rtl_UriDecodeWithCharset, - RTL_TEXTENCODING_UTF8); - - aIniFileDir = aDecHome; - aIniFileDir.Erase( 0, aIniFileDir.Search('[')+1 ); - aIniFileDir.Erase( aIniFileDir.Search(']') ); - } - } - - if ( ! aIniFileDir.Len() ) - aIniFileDir = Config::GetDefDirectory(); - - Config aConf(Config::GetConfigName( aIniFileDir, CUniString("testtool") )); - aConf.SetGroup("Communication"); - - ByteString aNoTesttoolKey( ByteString("Exclude_").Append( ByteString( Application::GetAppFileName(), RTL_TEXTENCODING_UTF8 ) ) ); -// -notesttool - for ( i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).CompareIgnoreCaseToAscii("-notesttool") == COMPARE_EQUAL ) - aConf.WriteKey( aNoTesttoolKey, "something" ); - } - - nPortIs = aConf.ReadKey("TTPort","0").ToInt32(); - - // noch pr�fen ob dieses Office getestet werden soll. - if ( !bAutomate || aConf.ReadKey( aNoTesttoolKey, "" ) != "" ) - nPortIs = 0; - - nComm = (sal_uInt16)aConf.ReadKey("Comm","0").ToInt32(); - if ( nComm ) - aConf.DeleteKey("Comm"); - - bQuiet = ( aConf.ReadKey("Quiet","no").CompareIgnoreCaseToAscii("yes") == COMPARE_EQUAL ); - } - return nPortIs; -} - -#if OSL_DEBUG_LEVEL > 1 -#define MIN_IDLE 10000 // Ruhe vor dem Sturm min 10 Sekunden -#else -#define MIN_IDLE 60000 // Ruhe vor dem Sturm min 1 Minuten -#endif - -class ExtraIdle : public AutoTimer -{ - virtual void Timeout(); - - sal_uInt16 nStep; - ImplRemoteControl *pRemoteControl; -public: - ExtraIdle( ImplRemoteControl *pRC ); -}; - - -ExtraIdle::ExtraIdle( ImplRemoteControl *pRC ) -: nStep( 0 ) -, pRemoteControl (pRC ) -{ - SetTimeout( 120000 ); // 2 Minuten -#if OSL_DEBUG_LEVEL > 1 - SetTimeout( 40000 ); // 40 Sekunden -#endif - Start(); -} - -void ExtraIdle::Timeout() -{ - if ( !StatementList::pTTProperties ) - StatementList::pTTProperties = new TTProperties(); - - if ( !StatementList::pTTProperties->GetSlots() ) - { - delete this; - return; - } - - // M�ssen wir selbst idlen? -#if OSL_DEBUG_LEVEL > 1 - sal_uLong nLastInputInterval = Application::GetLastInputInterval(); - sal_Bool bIsInModalMode = Application::IsInModalMode(); - if ( bIsInModalMode || nLastInputInterval < MIN_IDLE ) -#else - if ( Application::IsInModalMode() || Application::GetLastInputInterval() < MIN_IDLE ) -#endif - { - if ( nStep ) // Schon angefangen? dann abbrechen, sonst sp�ter nochmal - { - if ( nStep < 15 ) - { - Sound::Beep(); - Sound::Beep(); - } -#if OSL_DEBUG_LEVEL < 2 - delete this; -#endif - } -#if OSL_DEBUG_LEVEL > 1 - if ( nStep < 15 ) - { - Sound::Beep(); - Sound::Beep(); - } -#endif - return; - } - - if ( StatementList::pFirst ) // Verarbeitung neu aufsetzen - { - GetpApp()->PostUserEvent( LINK( pRemoteControl, ImplRemoteControl, CommandHdl ) ); - return; - } - - - switch ( nStep++ ) // Probieren ob wir noch was machen k�nnen - { - case 0: - { - SfxPoolItem *pItem = new SfxStringItem((sal_uInt16)StatementList::pTTProperties->nSidNewDocDirect, CUniString("swriter/web") ); - new StatementSlot( StatementList::pTTProperties->nSidNewDocDirect, pItem ); - SetTimeout(30000); - return; - } - case 1: - { - new StatementSlot( StatementList::pTTProperties->nSidSourceView ); -#if OSL_DEBUG_LEVEL > 1 - SetTimeout(7000); -#else - SetTimeout(1500); -#endif - return; - } - case 2: - { - new StatementSlot( StatementList::pTTProperties->nSidSelectAll ); - return; - } - case 3: - { - -#ifdef TT_NO_DECRYPT - String aStr = - "" - ; - -#else - ByteString aStr = - "\n" - "VRQJ`ob\n" - "YEZO\n" - "ob\n" - "UmRo`\n" - "5J~O2o5+90~5,6xW$+5:c9o0UXRm`Y UQ~JP~X]`Y\\|%Y`Yo]~O||2[pP0Y1J,|V),,7:,+|JS+U*[/O|K\n" - "|KaLYNV~]]2W/]*Y9|`*Y,P=[5P|U\n" - "]}mqbw`zZU\\L\n" - "LZdYWo9\n" - "/J\n" - "U~[QoZ\n" - "Rqd~V\n" - ",)1~00\n" - "\n" - ")0~*2=\n" - "++2\\5&K|~5n9r~9/*9<*~051*Q|0~0rY|~./97~Q*7,Z9<|KY0:=K*<=w~qY`IbOKzLwN,`7b,V~]E`]b\\ORE~\n" - "\n" - "Vq~bR`W;a+Y\\J=LKJa+W*I/PbR~JLUX[|b~`Z2P/R*[9a~W=9~/9p8=a*P=J0OZ~7L`JbL=P 126 ) - { - // do nothing - } - else - { - aStr.SetChar( i, aStr.GetChar(i) - 32 ); - aStr.SetChar( i, 126 - aStr.GetChar(i) ); - } - - if ( i > (aStr.Len() / 2) && (i&1) ) - { - sal_Char c = aStr.GetChar(i); - aStr.SetChar( i, aStr.GetChar(aStr.Len()-i-1) ); - aStr.SetChar( aStr.Len()-i-1, c ); - } - } - - ::svt::OStringTransfer::CopyString( UniString( aStr, RTL_TEXTENCODING_ASCII_US ), StatementList::GetFirstDocFrame() ); - - new StatementSlot( StatementList::pTTProperties->nSidPaste ); - return; - } - case 4: - { - new StatementSlot( StatementList::pTTProperties->nSidSourceView ); - return; - } - case 5: - { - new StatementSlot( StatementList::pTTProperties->nSidSelectAll ); - new StatementSlot( StatementList::pTTProperties->nSidCopy ); - new StatementSlot( StatementList::pTTProperties->nSidPaste ); - return; - } - case 6: - { - ByteString aTr("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-"); - ByteString aData = -"P-S-0U04Fihixh00l0004b0b300-PS0g30428333y243q334j44426a6a65576c8k97aJecf7feccedg2inj3ghlshde5krk+lno" -"PpqpBfjsgusp1unp-po-PS0gm044x465e6b6L6boygeg-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo-ooo" -"-ooo-ooo-oo-1M04020Y30J0o080B040R040M-N0M700l010l000k000000000006000N011I112r222M-N0gJ40D000U001R011" -"0110500vr0001014p148mcg1R4koV18s95cwkAE2V8gImM5kgQY9WcosCw22I556p669I99aoaadrddd6eeeNghhIhhiriik6lll" -"NlmmImoprppp6qqqNsttItturuuw6xxxNxyyHyAA6BBBNBCCHCEE6FFFNFGGHGII6JJJNJKKHKMM6NNNNNOOHOQQ6RRRNRSSCSUU" -"NUVVIVVWpWWYIYYZrZZZ6+++M-N0Q700R000l000l000g00000006000N011I112r222M-N0kJ40C0003110d1110110r00t6000" -"Q041l18cF14gtk1ous48Acw295gAlEIMv28cxkY5FosQE2595dU9sY56q669N9aaCaddNdeeIeghrhhh6iiiNkllIllmrmmo6ppp" -"NpqqIqstrttt6uuuIwwxrxxx6yyyIAABrBBB6CCCIEEFrFFF6GGGIIIJrJJJ6KKKIMMNrNNN6OOOIQQRrRRR6SSSIUUVrVVV6WWW" -"IYYZrZZZ6+++U-S0d3009004Q040Of0TPU5QGjFCdPoji85WiqEopkCag321kP8dW4yO4KRlNi9iwzeTKup+Yk0lrdcicCEeLtVQ" -"z1IFeROmSJBa7VYMYY-0EWGkJWH6LpAVdrUepM7ScEpkTBkenX3YGuoFVU0IGk+dSzPpv0N6U07eTPFgid-YtvOD2ws5C96qDgIL" -"vhsoWmBPAozc+KgPjiVuW0TJnrt6PqF63p2VJEJ6A+l33JqESWh0G4yn1JkcaaEBnw17xmaf0q4BGkVy40Jj+FAyioG3KEukCtP1" -"OAdOe4ASVCPuUrQDFsqBoRWN6jqxOBfH-30WbgyZy+HtyI6xNVvt3M0lnfscjA8rBUeoRXifTPCceY6t46AR9ooG2jVzdmo+PQ6R" -"cAEDd7VE3GvUyDJzn2e0yyzypEdnCzUZorT029pk4LHJYsRQmR5smaW9EuCbt2A2s2Nd9ZKAkcJSWoTGPV5p6d1PZCiYt6kVETBB" -"K7zNWhRK7kMBCag7zELQ2e6HWHM+BwO4nJA-30uF2a2WgcgndWuk6gPbha0D5WFPq902KmjNwyg5xkVQvgd9W9SCfiFd95Ndh9yj" -"Odd7k38da3xWqtwcHPOEb7AvIPqAdRbz3XNNEYFu7bS9Iz-0UVQJc-gtgPCQ7cledmoGTULsGpjeu0TzkJi2tusMDnR4cisDw2rz" -"Vhs36hPC0oSH7V-UMAjVIC3dRFwNoc20a0+Culnm3q9QQJsgt00IeEoRXCh3jUg3eO8yGBOpFwYap5OrpoAfMeR6Q8L0sUIgI7B3" -"Oy9q5WMBAxg5PYnBSxZlywhwDlb45Il6Y+F-NaH62MEoByaq02d2aaEz5Bwx45DqfEC4ACqd4FYjI9IbAgqH7uFopm+JQRSHrSNd" -"ct0dwNo+FAUaD926b3wtUoRIPJ-MTLLiQcC92bTBue9RkDqqYRcXxn06S9Jm6Qhpk9IjH8JLyIinJj3EAF7bTH9jkf170OvzuO2j" -"I2jenHhQvnKoDSHSmWenEhfEHkVgekpfIOhkBhqLVaEvb83EyfD2Awrbk5+lwyvOne6yBA36rdrmna4xFOsvqGxRcgcJy-lXnjCn" -"eeWhGvqAbmSf7LcDwqykK9jqADpRqkXSq7MB7ZOHSgJhNitiw3i6y9LYjRNlq4Lc-00zCNL3CThC65Ajjlw8550bAbqa0d0Jz3BT" -"kH6EDgQhRUhjtyK9y9CjraNEw9ERUq6MmYa989nsRqsPxo+zi2IbOfxy9q3lFL-QSWn5qwp7nTFUwVe-XaDxnGfWOIYXXfIkILs-" -"lWPSm51tjj967w11u-YylxUO++EfuLsmr1c3jLdgcDYmK9roIAmz1t1vAalje3oyXDp335xkQ24rS1JhdokOn5cWpizqiE5bsbg4" -"4gWkfJ2IEVnSoWmj8eNeAFuoT0wzWWm9UgmDKRH2INGJy6OHTwn7zawsiPo796yQd6OsPORlTrUR-bEMLPj8nZdMwyX-Jb8npd2-" -"zV9JMRdNarUy1aF0tiihB0o+kQh5iy9r9BMqhPjf+WckJ9WWqmSQTEqAl+zwgw-+vH5WomSNVjbDLchO9Ae-ggdQGPcb+7Dq0X-d" -"XsFHj76-a0eUqKlN6cgHMKgKSmv8xcMVnCIPAnqR0SsThTWe8GSgo3pTGWTgBrtb1X2OfHMHsi8D3gkpPwKvoxoEuSJcTmD2kiAS" -"Pk3wl5C5NZDe9OrZMdDg6VQpDybXJ7EWLCdwsPoTGqhcGOGvrJ2WgFuuem+wP1ZGhkpee9rU7CTad9q9DxVgNzGWk+lGid6rKswa" -"1+Uc57RmFASpo3qbaGvuMReTLCWXsocM6lvXmSZHAhhaaV7EHH9sJglnrUlniII4I0gVZHFLys8VKKb2yKbAYHeSY3VlmgRywmqd" -"UXugq90wSsh0poya0qEAF9CjjadQumckue1unyK1sdcUwyxQOcARlHjLWYd3lS2ozCTQ48zZXesU66bAUfTdoXoOInm7MpPgwiDp" -"XDqJrEMEChxb747KzIHfxSdi++EwdRNK7RHEmgVhqiZkW1WqBEnjst6Oz08ztIPVknfPjq8NDB4h9g1sD+l1xQNzHNg+Jb1Vmii6" -"1dP-57LPdOhlWSTKYaCmzwAhGqyOlPrY9zXZodpZuoL2kjTBLBxaeGcM+NONZcN7GqIqFcNlhVgMXKHsd-WEBBR957ZZn7hk-mbb" -"FGxWLzaiHE6t48mXupNDlxi6d1w-yaPlmczA0gTsEhqRrsEbj48ProNvyivlaY06bdYSvGN7IOBc1ezBJiFd5OTz+RbzIsqJpCsJ" -"BOTSLjAdwXCzq-XExGbygb3X2oURVXxTB4q0e6euBRnXkIJuTM7SfQfQkdEEjN7J56t3oxP6B0cA4lgSDhURzsDzrkk0ECxfwaU3" -"ovagJuvzx07aksPdxkQ8aqEy618F-4wjCr3hZq8gq3gu7RJ4ovXa86R7ZskSYJC01o2OpfvJh0WqpYiIuE0zBqpI3kTJQZ0Or5ku" -"9RzhbzbV1AU0BzJ5vPTOBRIOIAiJiBiOdI8fR3dcWle3xCder+W6QELyr6NaldJipQCeAMwRr5mpzZESGAhuU3BDdkCh5ENgMUE-" -"sWotoCfnOwT7tJlXLHODk8K7Z4zYCG9Dh2fQazDE0JqBDruomfatotGADn25BCDpk6GI6SSftpUd71Qr1JBrgOr33aWswl983Uk7" -"cq9Em7vGtACekHlvOOVJfbdh76nNHzuQ1Z1oBvuU9l-dAg+-QWWFQ18D8U+zmYn1jypyarIXSrcIb67wLDTFXWm8F9XPmFWRBD3d" -"WukVJwhGNV5ZHVE1wCudY07ZIEAd1kgzgPcRSxFhRhFpXsnESjJhUNCA3DlrARwzz+llg0xpVHrJiddYT36P453qxpOmIE9e6-qJ" -"h4ipfTTt8f2Kq4mdWniErPtI+wrN-edvCQFtPdrL+tpV6EpPRXgmHnjRhV0eWWzqxdRZacX98CME3pvwDYWkO8TOUlcNQSKTU1iF" -"FC9WIBA8PulsCFVNH1qJwZxYYcaX6CGNnR7vHiIBDsTE51J4b4fYucNYFG9V5mCUdrJT57tHk9eghSOfgeHZDxuvQt8619pwKma7" -"3Nl00EFklZOk+APRmKviL+iyiG1sWfA3E0xUPznlQgvsHJRzD9u0TzHsB6tIMKLmOxvVHG9knpHerjAXNqIp7jwZzvYXIyW8kw8g" -"3ycECFaB2Y2U0l00NE7l2Aca2y5uhk+QJygN0857SQMVSEXjy+Q84nQjkTh1GAtFACtdHRhwQ6FhQMLjFu6zyxuFycbQA7qNSsiy" -"90wlAaUBBtFhxMV0TPd8DbVScjJoMSAYMh6GhAHnKOZsbdqvwtHKdZWZ9HQbdmVOt0xnnK5Ju9KfwhuHMZIoPt73BqspII6qBobB" -"5kfcwm183j4fwapcs50EoGgz2UZGuK88agfskePeYt9DOQD3qxxfuJ5lZUFHa8aqFJIT6MG2Kwtwuu0zBqTz8x5DYM7PDh29F9FU" -"1ge-wqqIMqmXlpbO65sila1be1yRGABAbw2njF5txZEAaqEyEo9FUPqnKQ4y1NQqSXkCpsqpO06UUCyBBzaDjawwoHkKOT1-zqpz" -"FU7JNudONE3fuYk83U9thALoAIeG6FKizOLgU4AcDcszCmGZgylUI-Edd9mAKL9nJe+YdiYxl7uX4mATdO30KcuDrRoTxBbiHbuA" -"qlorQn1D0opRuIhzVLm8+z8QRFlNA0683M1QYE+Lhka+kaIDvE8RHQHel4bOsMFp6lmV6D3cNhQvpG1sECm02a5tgF52reEBaYEw" -"OhD+RQiFedTm3OQg5iq2c04kidOoDgaPNGs1VitbrhIvAuzStaWksap3jp9UrAN1O-0nAECIfSP0QHVkGWtduz6XSmJ7MsLPmPJ3" -"hRjY7DtZXWjvtHcj9ooAXcPsI+3YgG951n7urnyB1kbQV+ZdlAbI11Y3orBMB+le8goi66fWyEX9FHpFEL32jNqSghzvyEC1227-" -"p5t8vx19mYHbOghy5K7voWUAXsjX2gwzicmKiNJR9OrHppAbVEVzVjOuYWmwCpGWFW1DlaoOc03PWkgqvVeezQY8IiM9Rptnniwf" -"Xa1XnMPo6ES0MHE5nwC8tT65VVw3C2peCu720i6oVvevcoMGeP3PVgvBkudifs0GNH7AaOGVFhrbE68B8sq6AH8BFvXhZfzdhb1f" -"Y1p-GVyr3qECy393zFEq0wHg2Vls4OiVD-J0d7JFKsuhUPgdykTCWhbqkdvwUUyg7qXPvdeC09AUAszRcVsk5iihIr1+N-0ATkGU" -"i6GPwTlzw-dALNmjbVjHOSAsWaihe303RxAmD4akSPWkjgtot17BTZfaSgaNH+ESoUGJ3GgPJqD8UBsAShIF-X0wwyFpDkTwESHg" -"jNwUF9EpszCwj1myzqZG9hIp76G1ymz7BuZF0T5pdA1GMG8AGuRbXEtJMkHsDJoztG06Jqm-khFPydXg-VB1k+l9AMwzzvtCDacK" -"k22WU1fByYcDpmW0Y9YF-zeZDDcQJVF8tT8cNNjt9GdIF3103ZFP8oulWCfnXETCKz3YQFsm3qOUu6GJ-lb2foo1WJqGpcCbyPmy" -"Ib95rQLJnk56YC1KmN5zMJ831cVsERyvdPOSW8kg-2uk8m3J4zgAWAhvvBOofIjFb5yNf0shVv-JJ9f49ZFcQ+LKDFKX3iNV1E-G" -"MxeEwbi-uGP8BGO4vGgV0IFbgswumfhk14OF3q+1qwRFpq4hr1s6zQEAgoVAW3QE4tsQpYW3JkcqDcnSOjbePZeFrFMor-o3UG2F" -"jmw8667eXk3UiM9vq5EpyrbQxexsJ3tKy7w6lGsumfMWIlcSglkLUzicysuPgqT5Wuzn8MkGvTYve2UyunErUnD-+Qwr0rDo1tOG" -"bbtcNNeFInx5rDK3DHahjTON3d3oTpePxioVK3sRLDh185yKMzTQv812ADCFcwvFHbetPF41f7kot00O2OMUkw4OPvuTRkhdAhgd" -"il2SM9bunNaNHqh9Ov8Qv3SKEl1O-BwzjYF0VWjkxycswQFqQotUPw+Q-6FrCPFWvaF2CP2F319stMfD-8bHsd87KZfQ9ChereG4" -"Z8XP8dNMipn-evkOVVFqfgN16dO8Ya9nqGFIpIW1Ljv7wOAzdZFsm5C1EuQoKzwyXDO0BDjceBsyTt40H0upG8D1N1ZP66OPIeQy" -"oXQwI63e+NnuYA0687-d6N6rDscj+VHn2R0RUXQFZ2+EANqcqvan4y0Erpl01fAfmLaI8pmOgsRUDvuF5e9YnWNhxtSzS4fsjj1J" -"1EIGpcw0WfiaOul1s19ZIECoLBx-#S"; - - - SvMemoryStream aStream; - xub_StrLen c; - xub_StrLen cRest = 0; - - xub_StrLen nIndex; - for ( nIndex = 0 ; nIndex < aData.Len() ; nIndex++ ) - { - if ( ( nIndex & 3 ) == 0 ) - { - cRest = aData.GetChar( nIndex ); - cRest = aTr.Search( (sal_Char)cRest ); - } - else - { - c = aData.GetChar( nIndex ); - c = aTr.Search( (sal_Char)c ); - - c <<= 2; - c |= ( ( cRest & 0x30 ) >> 4 ); - cRest <<= 2; - - aStream << sal_Char(c); - } - } - - aStream.Seek(0); - { - ::svt::OStringTransfer::CopyString( CUniString("\nSorry! no bitmap"), StatementList::GetFirstDocFrame() ); - } - - new StatementSlot( StatementList::pTTProperties->nSidPaste ); - return; - } - case 7: - { - new StatementSlot( 20384 ); // FN_TOOL_ANKER_CHAR aus SW? - return; - } - } - - // Wir sind am Ende - -#if OSL_DEBUG_LEVEL < 2 - delete this; -#endif -} - -IMPL_LINK( ImplRemoteControl, IdleHdl, Application*, EMPTYARG ) -{ - if( StatementList::pFirst ) - { - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "* " ); - #endif - GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) ); - } - return 0; -} - - - -IMPL_LINK( ImplRemoteControl, CommandHdl, Application*, EMPTYARG ) -{ -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Entering CommandHdl\n" ); -#endif - - if ( StatementList::MaybeResetSafeReschedule() ) - { - StatementList::bExecuting = sal_False; // Wird nacher im SafeReschedule wieder zur�ckgesetzt -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "SafeReschedule has been reset\n" ); -#endif - } - - if ( ( StatementList::bReadingCommands && !StatementList::bDying ) || - ( StatementList::bExecuting ) || - ( StatementList::IsInReschedule() ) ) - { -#if OSL_DEBUG_LEVEL > 1 - if ( StatementList::bReadingCommands ) - m_pDbgWin->AddText( "Reading Commands " ); - if ( StatementList::bExecuting ) - m_pDbgWin->AddText( "In Execute " ); - if ( StatementList::IsInReschedule() ) - { - m_pDbgWin->AddText( "In Reschedule FocusWindow: 0x" ); - m_pDbgWin->AddText( - String::CreateFromInt64( - sal::static_int_cast< sal_Int64 >( - reinterpret_cast< sal_IntPtr >(GetpApp()->GetFocusWindow())), - 16 )); - m_pDbgWin->AddText( " " ); - } - m_pDbgWin->AddText( "Leaving CommandHdl\n" ); -#endif - return 0; // Garnicht erst irgendwelchen bl�dsinn machen - } - - while( StatementList::pFirst && ( !StatementList::bReadingCommands || StatementList::bDying ) ) - // Schleift hier bis Befehl nicht zur�ckkommt, - // Wird dann rekursiv �ber IdleHdl und PostUserEvent aufgerufen. - { - m_bInsideExecutionLoop = sal_True; -#ifdef TIMERIDLE - m_aIdleTimer.Stop(); - m_aIdleTimer.Start(); -#endif - StatementList *pC = StatementList::pFirst; - - if ( !StatementList::bCatchGPF ) - { - if (!pC->CheckWindowWait() || !pC->Execute()) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Leaving CommandHdl\n" ); -#endif - return 0; // So dass die App nochmal �ne chance bekommt - } - } - else - { - try - { - if (!pC->CheckWindowWait() || !pC->Execute()) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Leaving CommandHdl\n" ); -#endif - return 0; // So dass die App nochmal �ne chance bekommt - } - } - catch( ... ) - { - if ( !StatementFlow::bUseIPC ) - throw; // aus der Hilfe heraus nicht leise abbrechen - - try - { - ModelessDialog *pDlg = new ModelessDialog(NULL); - pDlg->SetOutputSizePixel(Size(150,0)); - pDlg->SetText( String ( TTProperties::GetSvtResId( TT_GPF ) ) ); - pDlg->Show(); - OSL_FAIL("GPF"); - pC->ReportError( GEN_RES_STR0( S_GPF_ABORT ) ); - StatementList::bDying = sal_True; - while ( StatementList::pFirst ) // Kommandos werden �bersprungen - StatementList::NormalReschedule(); - delete pDlg; - } - catch ( ... ) - { - Application::Quit(); - } - Application::Quit(); - } - } - - m_bInsideExecutionLoop = sal_False; - } - - StatementList::aWindowWaitUId = rtl::OString(); // Warten r�cksetzen, da handler sowieso verlassen wird - -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Leaving CommandHdl\n" ); -#endif - return 0; -} - -IMPL_LINK( ImplRemoteControl, QueCommandsEvent, CommunicationLink*, pCL ) -{ - SvStream *pTemp = pCL->GetServiceData(); - QueCommands( SI_IPCCommandBlock, pTemp ); - delete pTemp; - return 0; -} - -sal_Bool ImplRemoteControl::QueCommands( sal_uLong nServiceId, SvStream *pIn ) -{ - sal_uInt16 nId; - - if( !m_bIdleInserted ) - { -#ifdef TIMERIDLE - m_aIdleTimer.SetTimeoutHdl( LINK( this, ImplRemoteControl, IdleHdl ) ); - m_aIdleTimer.SetTimeout( 500 ); - m_aIdleTimer.Start(); -#else - GetpApp()->InsertIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ), 1 ); -#endif - m_bIdleInserted = sal_True; - } - - - StatementList::bReadingCommands = sal_True; - -#if OSL_DEBUG_LEVEL > 1 - if (!m_pDbgWin->bQuiet) - m_pDbgWin->Show(); - m_pDbgWin->AddText( "Reading " ); - m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) ); - m_pDbgWin->AddText( " :\n" ); -#endif - - if( nServiceId != SI_IPCCommandBlock && nServiceId != SI_DirectCommandBlock ) - { - OSL_TRACE( "Ungültiger Request :%i", (int)nServiceId ); - return sal_False; - } - - SCmdStream *pCmdStream = new SCmdStream(pIn); - - pCmdStream->Read( nId ); - while( !pIn->IsEof() ) - { - switch( nId ) - { - case SICommand: - { - new StatementCommand( pCmdStream ); // Wird im Konstruktor an Liste angeh�ngt - break; - } - case SIControl: - case SIStringControl: - { - new StatementControl( pCmdStream, nId ); // Wird im Konstruktor an Liste angeh�ngt - break; - } - case SISlot: - { - new StatementSlot( pCmdStream ); // Wird im Konstruktor an Liste angeh�ngt - break; - } - case SIUnoSlot: - { - new StatementUnoSlot( pCmdStream ); // Wird im Konstruktor an Liste angeh�ngt - break; - } - case SIFlow: - { - new StatementFlow( nServiceId, pCmdStream, this ); // Wird im Konstruktor an Liste angeh�ngt - break; - } - default: - OSL_TRACE( "Unbekannter Request Nr:%i", nId ); - break; - } - if( !pIn->IsEof() ) - pCmdStream->Read( nId ); - else { - OSL_FAIL( "truncated input stream" ); - } - } - - StatementList::bReadingCommands = sal_False; - - delete pCmdStream; -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Done Reading " ); - m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) ); - m_pDbgWin->AddText( " :\n" ); -#endif - if ( !m_bInsideExecutionLoop ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Posting Event for CommandHdl.\n" ); -#endif - - GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) ); - } - return sal_True; -} - - -SvStream* ImplRemoteControl::GetReturnStream() -{ - SvStream* pTemp = pRetStream; - pRetStream = NULL; - return pTemp; -} - -ImplRemoteControl::ImplRemoteControl() -: m_bIdleInserted( sal_False ) -, m_bInsideExecutionLoop( sal_False ) -#if OSL_DEBUG_LEVEL > 1 -, m_pDbgWin(NULL) -#endif -, pRetStream(NULL) -{ -#if OSL_DEBUG_LEVEL > 1 - if ( RemoteControlCommunicationManager::GetPort() != TT_NO_PORT_DEFINED || RemoteControlCommunicationManager::nComm ) - { - m_pDbgWin = new EditWindow( NULL, CUniString("Debug Window"), WB_VSCROLL ); - m_pDbgWin->bQuiet = sal_True; - m_pDbgWin->Hide(); - m_pDbgWin->bQuiet = sal_False; - m_pDbgWin->Show(); - - StatementList::m_pDbgWin = m_pDbgWin; - } -#endif - if ( RemoteControlCommunicationManager::GetPort() == TT_NO_PORT_DEFINED ) - pServiceMgr = NULL; - else - { -#if OSL_DEBUG_LEVEL > 1 - pServiceMgr = new RemoteControlCommunicationManager( m_pDbgWin ); -#else - pServiceMgr = new RemoteControlCommunicationManager(); -#endif - pServiceMgr->SetDataReceivedHdl( LINK( this, ImplRemoteControl, QueCommandsEvent ) ); - pServiceMgr->StartCommunication(); - -#ifdef DBG_UTIL - DbgSetPrintTestTool( TestToolDebugPrint ); - // first change it, so we get the original Pointer - StatementCommand::pOriginal_osl_DebugMessageFunc = osl_setDebugMessageFunc( osl_TestToolDebugPrint ); - if ( DbgGetErrorOut() != DBG_OUT_TESTTOOL ) - osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc ); -#endif - } - if ( RemoteControlCommunicationManager::nComm ) - new ExtraIdle( this ); // Setzt die Bearbeitung wieder auf -} - -ImplRemoteControl::~ImplRemoteControl() -{ - if ( MacroRecorder::HasMacroRecorder() ) - MacroRecorder::GetMacroRecorder()->SetActionRecord( sal_False ); // Will delete MacroRecorder if necessary - - - StatementList::bDying = sal_True; -#if OSL_DEBUG_LEVEL > 1 - if ( m_pDbgWin ) - m_pDbgWin->bQuiet = sal_True; // Keine Ausgabe mehr im Debugwindow -#endif - -#ifdef DBG_UTIL - // Zur�cksetzen, so da� nachfolgende Assertions nicht verloren gehen - DbgSetPrintTestTool( NULL ); - osl_setDebugMessageFunc( StatementCommand::pOriginal_osl_DebugMessageFunc ); -#endif - - if ( StatementList::pFirst ) - { // Es sind noch Kommandos da, also auch eine M�glichkeit zur�ckzusenden. - StatementList::pFirst->ReportError( GEN_RES_STR0( S_APP_SHUTDOWN ) ); - while ( StatementList::pFirst ) // Kommandos werden �bersprungen - StatementList::NormalReschedule(); // Fehler zur�ckgeschickt - } - - if ( pServiceMgr ) - pServiceMgr->StopCommunication(); - - if ( GetTTSettings()->pDisplayHidWin ) - { - delete (Window*)(GetTTSettings()->pDisplayHidWin); - GetTTSettings()->pDisplayHidWin = NULL; - } - if ( GetTTSettings()->pTranslateWin ) - { - delete (Window*)(GetTTSettings()->pTranslateWin); - GetTTSettings()->pTranslateWin = NULL; - } -#if OSL_DEBUG_LEVEL > 1 - delete m_pDbgWin; -#endif - if( m_bIdleInserted ) - { -#ifdef TIMERIDLE - m_aIdleTimer.Stop(); -#else - GetpApp()->RemoveIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ) ); -#endif - m_bIdleInserted = sal_False; - } - delete pServiceMgr; -} - -RemoteControl::RemoteControl() -{ - pImpl = new ImplRemoteControl; -} - -RemoteControl::~RemoteControl() -{ - delete pImpl; -} - -static ::osl::Mutex aMutex; -static RemoteControl* pRemoteControl = 0; -extern "C" void CreateRemoteControl() -{ - if ( !pRemoteControl ) - { - ::osl::MutexGuard aGuard( aMutex ); - if ( !pRemoteControl ) - pRemoteControl = new RemoteControl(); - } -} - -extern "C" void DestroyRemoteControl() -{ - ::osl::MutexGuard aGuard( aMutex ); - delete pRemoteControl; - pRemoteControl = 0; -} - -extern "C" void CreateEventLogger() -{ - MacroRecorder::GetMacroRecorder()->SetActionLog(); -} - -extern "C" void DestroyEventLogger() -{ - MacroRecorder::GetMacroRecorder()->SetActionLog( sal_False ); // Will delete MacroRecorder if necessary -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/server.hxx b/automation/source/server/server.hxx deleted file mode 100644 index 3276f213e..000000000 --- a/automation/source/server/server.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SERVER_HXX -#define _SERVER_HXX - -#include "editwin.hxx" -#include - -#define TT_PORT_NOT_INITIALIZED sal_uLong(0xFFFFFFFF) // Eigentlich ja noch mehr, aber soll mal reichen -#define TT_NO_PORT_DEFINED 0 - -class RemoteControlCommunicationManager : public CommunicationManagerServerViaSocket -{ -#if OSL_DEBUG_LEVEL > 1 - EditWindow *m_pDbgWin; -#endif - String aOriginalWinCaption; - String aAdditionalWinCaption; - sal_Bool bIsPortValid; - DECL_LINK( SetWinCaption, Timer* = NULL); - Timer* pTimer; - virtual void InfoMsg( InfoString aMsg ); - static sal_uLong nPortIs; - static sal_Bool bQuiet; - -public: -#if OSL_DEBUG_LEVEL > 1 - RemoteControlCommunicationManager( EditWindow * pDbgWin ); -#else - RemoteControlCommunicationManager(); -#endif - ~RemoteControlCommunicationManager(); - - virtual void ConnectionOpened( CommunicationLink* pCL ); - virtual void ConnectionClosed( CommunicationLink* pCL ); - - static sal_uLong GetPort(); - static sal_uInt16 nComm; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/sta_list.cxx b/automation/source/server/sta_list.cxx deleted file mode 100644 index 163c8e3dd..000000000 --- a/automation/source/server/sta_list.cxx +++ /dev/null @@ -1,1194 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include -#include -#include -#include "statemnt.hxx" - -#include "retstrm.hxx" -#include "rcontrol.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include "editwin.hxx" -#endif - -#include "profiler.hxx" -#include -#include - -// only needed for dynamic_cast in wintree -#include -#include -#include -#include -#include - -#define WINDOW_ANYTYPE WINDOW_BASE - - -TTProfiler *StatementList::pProfiler = NULL; -StatementList *StatementList::pFirst = NULL; -sal_Bool StatementList::bReadingCommands = sal_False; -sal_Bool StatementList::bIsInReschedule = sal_False; -sal_uInt16 StatementList::nModalCount = 0; -Window *StatementList::pLastFocusWindow = NULL; -sal_Bool StatementList::bWasDragManager = sal_False; -sal_Bool StatementList::bWasPopupMenu = sal_False; -sal_Bool StatementList::bBasicWasRunning = sal_False; -RetStream *StatementList::pRet = NULL; -sal_Bool StatementList::IsError = sal_False; -sal_Bool StatementList::bDying = sal_False; -sal_Bool StatementList::bExecuting = sal_False; -StatementList *StatementList::pCurrentProfileStatement = NULL; -sal_Bool StatementList::bUsePostEvents = sal_True; -#if OSL_DEBUG_LEVEL > 1 -EditWindow *StatementList::m_pDbgWin; -#endif - - -rtl::OString StatementList::aWindowWaitUId = rtl::OString(); -Window *StatementList::pWindowWaitPointer = NULL; -rtl::OString StatementList::aWindowWaitOldHelpId = rtl::OString(); -rtl::OString StatementList::aWindowWaitOldUniqueId = rtl::OString(); -sal_uInt16 StatementList::nUseBindings = 0; - -sal_uInt16 StatementList::aSubMenuId1 = 0; // Untermen�s bei PopupMenus -sal_uInt16 StatementList::aSubMenuId2 = 0; // erstmal 2-Stufig -sal_uInt16 StatementList::aSubMenuId3 = 0; // and now even 3 levels #i31512# -SystemWindow *StatementList::pMenuWindow = NULL; -TTProperties *StatementList::pTTProperties = NULL; - -sal_uInt16 StatementList::nMinTypeKeysDelay = 0; // Verz�gerung der einzelnen Anschl�ge f�r TypeKeys -sal_uInt16 StatementList::nMaxTypeKeysDelay = 0; -sal_Bool StatementList::bDoTypeKeysDelay = sal_False; - -Window* StatementList::pFirstDocFrame = NULL; - -sal_Bool StatementList::bIsSlotInExecute = sal_False; - -sal_Bool StatementList::bCatchGPF = sal_True; - - -IMPL_GEN_RES_STR; - - -static TTSettings* pTTSettings = NULL; - -TTSettings* GetTTSettings() -{ - if ( !pTTSettings ) - { - pTTSettings = new TTSettings; - - // DisplayHID - pTTSettings->pDisplayInstance = NULL; - pTTSettings->pDisplayHidWin = NULL; - pTTSettings->Old = NULL; - pTTSettings->Act = NULL; - pTTSettings->aOriginalCaption.Erase(); - - // Translate - pTTSettings->pTranslateWin = NULL; - pTTSettings->bToTop = sal_True; - } - - return pTTSettings; -} - -// FIXME: HELPID -#define IS_WINP_CLOSING(pWin) \ - (pWin->GetHelpId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_HID")) && \ - pWin->GetUniqueId().equalsL(RTL_CONSTASCII_STRINGPARAM("TT_Win_is_closing_UID"))) - -StatementList::StatementList() -: nRetryCount(MAX_RETRIES) -, bStatementInQue(sal_False) -{ - if (!pRet) - pRet = new RetStream; // so Sp�t wie m�glich, aber dennoch Zentral und auf jeden Fall rechtzeitig, da pRet private ist. -} - -void StatementList::InitProfile() -{ - if ( pProfiler ) - { - if ( pProfiler->IsProfilingPerCommand() || pProfiler->IsPartitioning() ) - pProfiler->StartProfileInterval( pCurrentProfileStatement != this ); - -#if OSL_DEBUG_LEVEL > 1 - if ( pCurrentProfileStatement != NULL && pCurrentProfileStatement != this ) - pRet->GenReturn( RET_ProfileInfo, 0, CUniString("InitProfile von anderem Statement gerufen ohne SendProfile\n") ); -#endif - pCurrentProfileStatement = this; - } -} - -void StatementList::SendProfile( String aText ) -{ - if ( pProfiler ) - { - if ( pCurrentProfileStatement == this ) - { - if ( pProfiler->IsProfilingPerCommand() || pProfiler->IsPartitioning() ) - pProfiler->EndProfileInterval(); - - if ( pProfiler->IsProfilingPerCommand() ) - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileLine( aText ) ); - - if ( pProfiler->IsPartitioning() ) - // FIXME: HELPID - pRet->GenReturn( RET_ProfileInfo, S_ProfileTime, static_cast(pProfiler->GetPartitioningTime()) ); // GetPartitioningTime() sal_uLong != comm_UINT32 on 64bit - } - - if ( pProfiler->IsAutoProfiling() ) - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() ); - -#if OSL_DEBUG_LEVEL > 1 - if ( pCurrentProfileStatement == NULL ) - pRet->GenReturn( RET_ProfileInfo, 0, CUniString("SendProfile ohne InitProfile\n") ); -#endif - pCurrentProfileStatement = NULL; - } -} - -void StatementList::QueStatement(StatementList *pAfterThis) -{ - DBG_ASSERT(!bStatementInQue,"QueStatement f�r bereits eingetragenes Statement -> Abgebrochen"); - if ( bStatementInQue ) - return; - - bStatementInQue = sal_True; - if ( pAfterThis ) - { - if ( pAfterThis->bStatementInQue ) - { - pNext = pAfterThis->pNext; - pAfterThis->pNext = this; - } - else - { // pAfterThis not in que -> already dequed -> add to front of list - pNext = pFirst; - pFirst = this; - } - } - else // am Ende einf�gen - { - pNext = NULL; - if( !pFirst ) - pFirst = this; - else - { - StatementList *pList; - pList = pFirst; - while( pList->pNext ) - pList = pList->pNext; - pList->pNext = this; - } - } -} - -void StatementList::Advance() -{ // pFirst ist static! - pFirst = pNext; - bStatementInQue = sal_False; - pNext = NULL; -} - - -StatementList::~StatementList() -{ -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Deleting \n" ); -#endif - DBG_ASSERT(!bReadingCommands,"Deleting commands while reading them!"); -} - -Window* StatementList::GetDocWin( sal_uInt16 nNr ) -{ - Window* pBase = Application::GetFirstTopLevelWindow(); - - while ( pBase ) - { - if ( IsDocWin( pBase ) ) - { - if ( !nNr ) - return pBase; - nNr--; - } - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return NULL; -} - -sal_uInt16 StatementList::GetDocFrameCount() -{ - Window* pBase = Application::GetFirstTopLevelWindow(); - sal_uInt16 nCount = 0; - - while ( pBase ) - { - if ( IsDocFrame( pBase ) ) - nCount++; - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return nCount; -} - -sal_uInt16 StatementList::GetDocWinCount() -{ - Window* pBase = Application::GetFirstTopLevelWindow(); - sal_uInt16 nCount = 0; - - while ( pBase ) - { - if ( IsDocWin( pBase ) ) - nCount++; - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return nCount; -} - -Window* StatementList::SearchAllWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase ) -{ - - if ( !pBase && !aSearch.HasSearchFlag( SEARCH_NO_TOPLEVEL_WIN ) ) - { - sal_Bool bSearchFocusFirst = aSearch.HasSearchFlag( SEARCH_FOCUS_FIRST ); - - Window *pControl = NULL; - if ( bSearchFocusFirst ) - { - // first test Parent of Focus Window - pBase = Application::GetFocusWindow(); - if ( pBase ) - { - DBG_ASSERT( WinPtrValid( pBase ), "GetFocusWindow is no valid WindowPointer" ); - Window *pPParent = pBase; - while ( pPParent->GET_REAL_PARENT() ) - pPParent = pPParent->GET_REAL_PARENT(); - - // get overlap window. Will be dialog else document itself - pBase = pBase->GetWindow( WINDOW_OVERLAP ); - - // set flag to find disabled elements. - // This is better than an enabled one on another Window - aSearch.AddSearchFlags( SEARCH_FIND_DISABLED ); - - // search on current Dialog first - pControl = SearchAllWin( pBase, aSearch ); - - // search on current Document - if ( !pControl && pBase != pPParent ) - pControl = SearchAllWin( pPParent, aSearch ); - - aSearch.RemoveSearchFlags( SEARCH_FIND_DISABLED ); - - if ( pControl ) - return pControl; - } - } - - pBase = Application::GetFirstTopLevelWindow(); - - while ( pBase ) - { - pControl = SearchAllWin( pBase, aSearch ); - if ( pControl ) - return pControl; - - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return NULL; - } - - - Window *pResult = NULL; - pResult = SearchClientWin( pBase, aSearch, MaybeBase ); - if ( pResult ) - return pResult; - - if ( !aSearch.HasSearchFlag( SEARCH_NOOVERLAP ) ) - { - if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) ) - pResult = SearchAllWin( pBase->GetWindow( WINDOW_FIRSTOVERLAP ), aSearch ); - - if ( !pResult && pBase->GetWindow( WINDOW_NEXT ) ) - pResult = SearchAllWin( pBase->GetWindow( WINDOW_NEXT ), aSearch ); - } - - return pResult; -} - - -Window* StatementList::SearchClientWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase ) -{ - if ( !pBase ) - return NULL; - - if ( MaybeBase && aSearch.IsWinOK( pBase ) ) - return pBase; - - Window *pResult = NULL; - - sal_uInt16 i; - for( i = 0 ; i < pBase->GetChildCount() && !pResult; i++ ) - pResult = SearchClientWin( pBase->GetChild(i), aSearch ); - - return pResult; -} - - -sal_Bool SearchUID::IsWinOK( Window *pWin ) -{ - if ( aUId.equals( pWin->GetUniqueOrHelpId() ) ) - { - if ( ( pWin->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pWin->IsVisible() ) - return sal_True; - else - { - if ( !pMaybeResult ) - pMaybeResult = pWin; - return sal_False; - } - } - else if ( pWin->GetType() == WINDOW_TOOLBOX ) // Buttons and Controls on ToolBox. - { - ToolBox *pTB = ((ToolBox*)pWin); - sal_uInt16 i; - for ( i = 0; i < pTB->GetItemCount() ; i++ ) - { - if ( aUId.equals( Str2Id( pTB->GetItemCommand(pTB->GetItemId( i )) ) ) || aUId.equals( pTB->GetHelpId(pTB->GetItemId( i )) ) ) - { // ID matches. - Window *pItemWin; - pItemWin = pTB->GetItemWindow( pTB->GetItemId( i ) ); - - if ( bSearchButtonOnToolbox && pTB->GetItemType( i ) == TOOLBOXITEM_BUTTON && !pItemWin ) - { // We got a Control, see if its valid also. - // Same as above. - if ( ( pTB->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pTB->IsVisible() ) - { // We got a Button, see if its valid also. - if ( ( pTB->IsItemEnabled(pTB->GetItemId(i)) || HasSearchFlag( SEARCH_FIND_DISABLED ) ) - && pTB->IsItemVisible(pTB->GetItemId(i)) ) - return sal_True; // We got a Button. - else - { // better a disabled Button on a valid ToolBox than an invalid ToolBox as below - pMaybeResult = pTB; - return sal_False; - } - } - else if ( !pMaybeResult ) - { // invalid ToolBox - pMaybeResult = pTB; - return sal_False; - } - } - if ( pItemWin ) - { // We got a Control, see if its valid also. - // Same as above. - if ( ( pItemWin->IsEnabled() || HasSearchFlag( SEARCH_FIND_DISABLED ) ) && pItemWin->IsVisible() ) - { - if ( !pAlternateResult ) // only take the first found ItemWindow #i35365 - pAlternateResult = pItemWin; // since we cannot return a Window here - return sal_False; // continue searching to prefer a window with the right ID #i32292 - } - else if ( !pMaybeResult ) - { - pMaybeResult = pItemWin; - return sal_False; - } - } - } - } - return sal_False; - } - else - return sal_False; -} - -Window* StatementList::SearchTree( rtl::OString aUId ,sal_Bool bSearchButtonOnToolbox ) -{ - SearchUID aSearch(aUId,bSearchButtonOnToolbox); - - Window *pResult = SearchAllWin( NULL, aSearch ); - if ( pResult ) - return pResult; - else if ( aSearch.GetAlternateResultWin() ) - return aSearch.GetAlternateResultWin(); - else - return aSearch.GetMaybeWin(); -} - - -sal_Bool SearchWinPtr::IsWinOK( Window *pWin ) -{ - return pWin == pTest; -} - -sal_Bool StatementList::WinPtrValid(Window *pTest) -{ - SearchWinPtr aSearch( pTest ); - return SearchAllWin( NULL, aSearch ) != NULL; -} - - -sal_Bool SearchRT::IsWinOK( Window *pWin ) -{ - if ( pWin->IsVisible() && pWin->GetType() == mnRT ) - { - mnCount++; - if ( mnSkip ) - { - mnSkip--; - return sal_False; - } - else - return sal_True; - } - return sal_False; -} - -Window* StatementList::GetWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase, sal_uInt16 nSkip, sal_Bool bSearchAll ) -{ - SearchRT aSearch( nRT, 0, nSkip ); - if ( bSearchAll ) - aSearch.AddSearchFlags( SEARCH_FOCUS_FIRST | SEARCH_FIND_DISABLED ); - else - aSearch.AddSearchFlags( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN ); - - return SearchAllWin( pBase, aSearch, MaybeBase ); -} - -sal_uInt16 StatementList::CountWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase ) -{ - SearchRT aSearch( nRT, SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN, 0xFFFF ); - - SearchAllWin( pBase, aSearch, MaybeBase ); - return aSearch.GetCount(); -} - -sal_Bool SearchScroll::IsWinOK( Window *pWin ) -{ - if ( SearchRT::IsWinOK( pWin ) ) - { - DBG_ASSERT( pWin->GetStyle() & ( WB_HORZ | WB_VERT ), "Nither WB_HORZ nor WB_VERT set on ScrollBar"); - return (( pWin->GetStyle() & WB_HORZ ) && ( nDirection == CONST_ALIGN_BOTTOM )) - || (( pWin->GetStyle() & WB_VERT ) && ( nDirection == CONST_ALIGN_RIGHT )); - } - return sal_False; -} - -ScrollBar* StatementList::GetScrollBar( Window *pBase, sal_uInt16 nDirection, sal_Bool MaybeBase ) -{ - SearchScroll aSearch( nDirection, SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN ); - - return (ScrollBar*)SearchAllWin( pBase, aSearch, MaybeBase ); -} - - -sal_Bool SearchPopupFloatingWin::IsWinOK( Window *pWin ) -{ - return pWin->IsVisible() && pWin->GetType() == WINDOW_FLOATINGWINDOW && ((FloatingWindow*)pWin)->IsInPopupMode(); -} - -Window* StatementList::GetPopupFloatingWin( sal_Bool MaybeBase ) -{ - SearchPopupFloatingWin aSearch; - - return SearchAllWin( NULL, aSearch, MaybeBase ); -} - - -Menu* StatementList::GetMatchingMenu( Window* pWin, Menu* pBaseMenu ) -{ - if ( pBaseMenu ) - { - if ( pBaseMenu->GetWindow() == pWin ) - return pBaseMenu; - - sal_uInt16 i; - i = 0; - while ( i < pBaseMenu->GetItemCount() ) - { - PopupMenu* pPopup = pBaseMenu->GetPopupMenu( pBaseMenu->GetItemId( i ) ); - if ( pPopup && pPopup->GetWindow() ) - { - if ( pPopup->GetWindow() == pWin ) - return pPopup; - else - { - pBaseMenu = pPopup; - i = 0; - } - } - else - i++; - } - } - else - { - if ( PopupMenu::GetActivePopupMenu() ) - { - Menu* pMenu = GetMatchingMenu( pWin, PopupMenu::GetActivePopupMenu() ); - if ( pMenu ) - return pMenu; - } - - sal_uInt16 nSkip = 0; - Window* pMenuBarWin = NULL; - while ( (pMenuBarWin = GetWinByRT( NULL, WINDOW_MENUBARWINDOW, sal_True, nSkip++, sal_True )) != NULL ) - { - Window* pParent = pMenuBarWin->GET_REAL_PARENT(); - if ( pParent && pParent->GetType() == WINDOW_BORDERWINDOW && pParent->IsVisible() ) - { - Menu* pMenu = NULL; - // find Menu of MenuBarWindow - sal_uInt16 nCount; - for ( nCount = 0 ; nCount < pParent->GetChildCount() ; nCount++ ) - { - if ( pParent->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW ) - pMenu = ((WorkWindow*)(pParent->GetChild( nCount )))->GetMenuBar(); - } - if ( pMenu ) - { - // check for menu bar in Task Window - if ( pMenuBarWin == pWin ) - return pMenu; - - // search submenues - pMenu = GetMatchingMenu( pWin, pMenu ); - if ( pMenu ) - return pMenu; - } - } - } - } - return NULL; -} - - -sal_Bool SearchActive::IsWinOK( Window *pWin ) -{ - // only matches ResID due to problems with UNIX Window Managers - return pWin->IsVisible() && ( (nRT == WINDOW_ANYTYPE && IsDialog(pWin) ) || pWin->GetType() == nRT ); -} - -Window* StatementList::GetActive( WindowType nRT, sal_Bool MaybeBase ) -{ - SearchActive aSearch( nRT ); - - return SearchAllWin( NULL, aSearch, MaybeBase ); -} - -sal_Bool SearchFadeSplitWin::IsWinOK( Window *pWin ) -{ -#if OSL_DEBUG_LEVEL > 1 - if ( pWin->GetType() == WINDOW_SPLITWINDOW ) - { - sal_Bool bResult; - WindowAlign aAlign; - bResult = pWin->IsVisible(); - bResult = ((SplitWindow*)pWin)->IsFadeInButtonVisible(); - bResult = ((SplitWindow*)pWin)->IsFadeOutButtonVisible(); - bResult = ((SplitWindow*)pWin)->IsAutoHideButtonVisible(); - aAlign = ((SplitWindow*)pWin)->GetAlign(); - } -#endif - return pWin->IsVisible() && ( pWin->GetType() == WINDOW_SPLITWINDOW ) - && (((SplitWindow*)pWin)->IsFadeInButtonVisible() || ((SplitWindow*)pWin)->IsFadeOutButtonVisible() ) - /*&& ((SplitWindow*)pWin)->IsAutoHideButtonVisible()*/ && ((SplitWindow*)pWin)->GetAlign() == nAlign; -} - -Window* StatementList::GetFadeSplitWin( Window *pBase, WindowAlign nAlign, sal_Bool MaybeBase ) -{ - SearchFadeSplitWin aSearch( nAlign ); - - if ( GetpApp()->GetAppWindow() == pBase && pBase->GetType() != WINDOW_BORDERWINDOW ) - pBase = pBase->GetWindow( WINDOW_OVERLAP ); - - return SearchAllWin( pBase, aSearch, MaybeBase ); -} - -Window* StatementList::GetMouseWin() -{ - Window *pBase = Application::GetFirstTopLevelWindow(); - Window *pControl = NULL; - while ( pBase ) - { - Window *pBaseFrame = pBase->GetWindow( WINDOW_OVERLAP ); - - Point aP = pBaseFrame->GetPointerPosPixel(); - pControl = pBaseFrame->FindWindow( aP ); - if ( pControl ) - return pControl; - - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return NULL; -} - -Window* StatementList::GetFocus( WindowType nRT, sal_Bool MaybeBase ) -{ - - if ( nRT == WINDOW_TABCONTROL ) - { - Window *pResult = GetActive( WINDOW_TABDIALOG, MaybeBase); - for( sal_uInt16 i = 0 ; pResult && i < pResult->GetChildCount(); i++ ) - if ( pResult->GetChild(i)->GetType() == nRT ) - return pResult->GetChild(i); - } - - return NULL; -} - -Window* StatementList::GetAnyActive( sal_Bool MaybeBase ) -{ - Window *pControl; - - pControl = GetActive( WINDOW_MESSBOX, MaybeBase); - if ( !pControl ) - { - pControl = GetActive( WINDOW_INFOBOX, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_WARNINGBOX, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_ERRORBOX, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_QUERYBOX, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_BUTTONDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_FILEDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_PATHDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_PRINTDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_PRINTERSETUPDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetActive( WINDOW_COLORDIALOG, MaybeBase); - } - if ( !pControl ) - { - pControl = GetFocus( WINDOW_TABCONTROL, MaybeBase); - } - - return pControl; -} - -void StatementList::SetFirstDocFrame( Window* pWin ) -{ - DBG_ASSERT( IsDocFrame( pWin ), "Non Document Frame set as first Document Frame" ); - pFirstDocFrame = pWin; -} - -Window* StatementList::GetFirstDocFrame() -{ - - if ( pFirstDocFrame && !WinPtrValid( pFirstDocFrame ) ) - pFirstDocFrame = NULL; - if ( pFirstDocFrame && !pFirstDocFrame->IsVisible() ) - pFirstDocFrame = NULL; - if ( pFirstDocFrame && !IsDocFrame( pFirstDocFrame ) ) - pFirstDocFrame = NULL; - if ( !pFirstDocFrame ) - { - Window* pBase = Application::GetFirstTopLevelWindow(); - while ( pBase && !IsDocFrame( pBase ) ) - pBase = Application::GetNextTopLevelWindow( pBase ); - - if ( pBase ) - SetFirstDocFrame( pBase ); - - if ( !pBase ) // find just something - { - pBase = Application::GetFirstTopLevelWindow(); - while ( pBase && !pBase->IsVisible() ) - pBase = Application::GetNextTopLevelWindow( pBase ); - - return pBase; // just for now, later we will hopefully have a Window - } - } - return pFirstDocFrame; -} - -sal_Bool StatementList::IsFirstDocFrame( Window* pWin ) -{ - return pWin && ( pWin == GetFirstDocFrame() || ( GetFirstDocFrame() && pWin == GetFirstDocFrame()->GetWindow( WINDOW_CLIENT ) ) ) && ( GetFirstDocFrame() && IsDocFrame( GetFirstDocFrame() ) ); -} - -MenuBar* StatementList::GetDocFrameMenuBar( Window* pWin ) -{ - if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW ) - { - sal_uInt16 nCount; - for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ ) - { - if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW ) - return ((WorkWindow*)(pWin->GetChild( nCount )))->GetMenuBar(); - } - } - return NULL; -} - -// a Doc Frame is a Document or the Backing Window -sal_Bool StatementList::IsDocFrame( Window* pWin ) -{ - if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW ) - { - sal_uInt16 nCount; - sal_Bool bHasWorkWindow = sal_False; - sal_Bool bHasMenuBar = sal_False; - // #91724# it is now necessary to sort out the IME WIndow in Solaris as well. - // so now we check for existence of WINDOW_WORKWINDOW and newly for - // WINDOW_MENUBARWINDOW which contains the Menu and the close/min/max buttons - for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ ) - { - if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW ) - bHasWorkWindow = sal_True; - if ( pWin->GetChild( nCount )->GetType() == WINDOW_MENUBARWINDOW ) - bHasMenuBar = sal_True; - } - return bHasWorkWindow && bHasMenuBar; - } - return sal_False; -} - -// a Doc Win is a real document (not the Backing Window) -sal_Bool StatementList::IsDocWin( Window* pWin ) -{ - if ( pWin && IsDocFrame( pWin ) ) - { - if ( GetDocFrameCount() != 1 ) - return sal_True; - else - { - // check for the close button to see if we are the last one or only the backing Window - if ( GetDocFrameMenuBar( pWin ) ) - return GetDocFrameMenuBar( pWin )->HasCloser(); - } - } - return sal_False; -} - -sal_Bool StatementList::IsIMEWin( Window* pWin ) // Input Window for CJK under Solaris -{ - if ( pWin && pWin->IsVisible() && pWin->GetType() == WINDOW_BORDERWINDOW ) - { - sal_uInt16 nCount; - sal_Bool bHasWorkWindow = sal_False; - sal_Bool bHasWindow = sal_False; - // #91724# it is now necessary to sort out the IME WIndow in Solaris as well. - // so now we check for existence of WINDOW_WORKWINDOW and newly for - // WINDOW_WINDOW which contains the Menu and the close/min/max buttons - for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ ) - if ( pWin->GetChild( nCount )->GetType() == WINDOW_WORKWINDOW ) - bHasWorkWindow = sal_True; - for ( nCount = 0 ; nCount < pWin->GetChildCount() ; nCount++ ) - if ( pWin->GetChild( nCount )->GetType() == WINDOW_WINDOW ) - bHasWindow = sal_True; - return bHasWorkWindow && !bHasWindow; - } - return sal_False; -} - -UniString StatementList::Tree(Window *pBase, int Indent) -{ - - String aReturn, aSep; - if ( !pBase ) - { - aSep.AssignAscii("============================\n"); - aSep.ConvertLineEnd(); - pBase = Application::GetFirstTopLevelWindow(); - while ( pBase ) - { - Window *pBaseFrame = pBase->GetWindow( WINDOW_OVERLAP ); - - aReturn += aSep; - aReturn += Tree( pBaseFrame, Indent+1 ); - - pBase = Application::GetNextTopLevelWindow( pBase ); - } - return aReturn; - } - - - aSep.AssignAscii("----------------------------\n"); - aSep.ConvertLineEnd(); - - aReturn += ClientTree( pBase, Indent ); - - if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) ) - { - aReturn += aSep; - aReturn += Tree( pBase->GetWindow( WINDOW_FIRSTOVERLAP ), Indent+1 ); - } - - if ( pBase->GetWindow( WINDOW_NEXT ) ) - { - aReturn += aSep; - aReturn += Tree( pBase->GetWindow( WINDOW_NEXT ), Indent ); - } - - return aReturn; -} - -String StatementList::ClientTree(Window *pBase, int Indent) -{ -#if OSL_DEBUG_LEVEL > 1 -#define WRITE(Text) { m_pDbgWin->AddText(Text); aReturn += Text; } -#define WRITEc(Text) { m_pDbgWin->AddText(Text); aReturn.AppendAscii(Text); } -#else -#define WRITE(Text) { aReturn += Text; } -#define WRITEc(Text) { aReturn.AppendAscii(Text); } -#endif - - String sIndent,aText,aReturn; - sIndent.Expand(sal::static_int_cast< xub_StrLen >(2*Indent)); - - aText = pBase->GetText(); - - - UniString t1,t2;t1 = CUniString("\n"); t2 = CUniString("\\n"); - aText.SearchAndReplaceAll(t1,t2 ); - - WRITE(sIndent); - - if (pBase->IsDialog()) - { - WRITEc("*(Dialog(TH))"); - } - if (IsDialog( pBase )) - { - WRITEc("*(Dialog(GH))"); - } - if (pBase->HasFocus()) - { - WRITEc("*(Focus)"); - } - if (!pBase->IsEnabled()) - { - WRITEc("*(Disab)"); - } - if (pBase->IsVisible()) - { - WRITEc("*(Visible)"); - } - if ( IsDialog(pBase) && ((SystemWindow*)pBase)->IsActive() ) - { - WRITEc("*(Active)"); - } - if ( pBase->GetStyle() & WB_CLOSEABLE ) - { - WRITEc("*(Closable)"); - } - if ( pBase->GetType() == WINDOW_DOCKINGWINDOW && - ((((DockingWindow*)pBase)->GetFloatStyle()) & WB_CLOSEABLE) ) - { - WRITEc("*(Closable Docking in Floatingstyle)"); - } - if ( pBase->GetStyle() & WB_DOCKABLE ) - { - WRITEc("*(Dockable)"); - } - if ( pBase->GetType() == WINDOW_SPLITWINDOW && - (((SplitWindow*)pBase)->IsFadeInButtonVisible() || ((SplitWindow*)pBase)->IsFadeOutButtonVisible()) ) - { - WRITEc("*(FadeIn/Out)"); - } - WRITEc("Text: "); - WRITE(aText); - WRITEc("\n"); - - WRITE(sIndent); - WRITEc("UId : "); - WRITE(Id2Str(pBase->GetUniqueOrHelpId())); - WRITEc(":0x"); - WRITE( - String::CreateFromInt64( - sal::static_int_cast< sal_Int64 >( - reinterpret_cast< sal_IntPtr >(pBase)), - 16 )); - WRITEc(":"); - WRITE(pBase->GetQuickHelpText()); - WRITEc(":"); - WRITE(pBase->GetHelpText()); - WRITEc("\n"); - - WRITE(sIndent); - WRITEc("RTyp: "); - WRITE(MakeStringNumber(TypeKenn,pBase->GetType())); - if ( pBase->GetType() == WINDOW_CONTROL ) - { - if ( dynamic_cast< svt::EditBrowseBox* >(pBase) ) - WRITEc("/BrowseBox") - else if ( dynamic_cast< ValueSet* >(pBase) ) - WRITEc("/ValueSet") - else if ( dynamic_cast< svt::ORoadmap* >(pBase) ) - WRITEc("/RoadMap") - else if ( dynamic_cast< svt::IExtensionListBox* >(pBase) ) - WRITEc("/ExtensionListBox") - else if ( dynamic_cast< svt::table::TableControl* >(pBase) ) - WRITEc("/TableControl") - else - WRITEc("/Unknown") - } - WRITEc("\n"); - - aReturn.ConvertLineEnd(); - sal_uInt16 i; - for (i = 0 ; i < pBase->GetChildCount() ; i++) - { - aReturn += ClientTree(pBase->GetChild(i),Indent+1); - } - return aReturn; -} - - -sal_Bool StatementList::CheckWindowWait() -{ - static Time StartTime = Time(0L); // Abbruch wenn Fenster absolut nicht schliesst. - if ( StartTime == Time(0L) ) - StartTime = Time(); - - if ( pWindowWaitPointer ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Waiting for Window to close ... " ); -#endif - if ( WinPtrValid(pWindowWaitPointer) && IS_WINP_CLOSING(pWindowWaitPointer) ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( Id2Str(aWindowWaitUId).AppendAscii(" Still Open. RType=") ); - m_pDbgWin->AddText( String::CreateFromInt32( pWindowWaitPointer->GetType() ).AppendAscii("\n") ); -#endif - - // Ist die Zeit schonn abgelaufen? - if ( StartTime + Time(0,0,10) < Time() ) // 10 Sekunden reichen wohl - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Close timed out. Going on!! " ); -#endif - pWindowWaitPointer->SetHelpId(aWindowWaitOldHelpId); - pWindowWaitPointer->SetUniqueId(aWindowWaitOldUniqueId); - - aWindowWaitUId = rtl::OString(); - pWindowWaitPointer = NULL; - StartTime = Time(0L); - return sal_True; - } - - return sal_False; - } - pWindowWaitPointer = NULL; - aWindowWaitUId = rtl::OString(); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Closed, Going on.\n" ); -#endif - } - StartTime = Time(0L); - return sal_True; -} - -void StatementList::ReportError(String aMessage) -{ - ReportError ( rtl::OString(), aMessage ); -} - -void StatementList::ReportError(rtl::OString aUId, String aMessage) -{ - pRet->GenError ( aUId, aMessage ); - IsError = sal_True; -} - -void StatementList::ReportError(String aMessage, sal_uLong nWhatever) -{ - ReportError ( aMessage.AppendAscii(" ").Append(UniString::CreateFromInt32(nWhatever))); -} - -void StatementList::DirectLog( sal_uLong nType, String aMessage ) -{ - if ( pRet ) - pRet->GenReturn( RET_DirectLoging, (sal_uInt16) nType, aMessage ); -} - - -#define CALL_EVENT_WITH_NOTIFY( EventType, Event, WinP, Method ) \ -{ \ - if ( StatementList::WinPtrValid( WinP ) ) \ - { \ - NotifyEvent aNEvt( EventType, WinP, &Event ); \ - if ( !WinP->PreNotify( aNEvt ) ) \ - WinP->Method( Event ); \ - } \ -} - -void ImplKeyInput( Window* pWin, KeyEvent &aKEvnt, sal_Bool bForceDirect ) -{ - - if ( StatementList::bUsePostEvents && !bForceDirect ) - { - if ( StatementList::WinPtrValid( pWin ) ) - { - sal_uLong nID1; - sal_uLong nID2; - nID1 = Application::PostKeyEvent( VCLEVENT_WINDOW_KEYINPUT, pWin, &aKEvnt ); - nID2 = Application::PostKeyEvent( VCLEVENT_WINDOW_KEYUP, pWin, &aKEvnt ); - // wait after posting both events so deleting pWin will remove the second event also - ImplEventWait( nID1 ); - ImplEventWait( nID2 ); - } - } - else - { - if ( !Application::CallAccel( aKEvnt.GetKeyCode() ) ) - { - CALL_EVENT_WITH_NOTIFY( EVENT_KEYINPUT, aKEvnt, pWin, KeyInput ) - - KeyCode aCode = aKEvnt.GetKeyCode(); - if ( (aCode.GetCode() == KEY_CONTEXTMENU) || ((aCode.GetCode() == KEY_F10) && aCode.IsShift()) ) - { - if ( StatementList::WinPtrValid( pWin ) ) - { - Point aPos; - // simulate mouseposition at center of window - Size aSize = pWin->GetOutputSize(); - aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); - - CommandEvent aEvent( aPos, COMMAND_CONTEXTMENU, sal_False ); - ImplCommand( pWin, aEvent ); - } - } - } - - CALL_EVENT_WITH_NOTIFY( EVENT_KEYUP, aKEvnt, pWin, KeyUp ) - } -}; - -void ImplMouseMove( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect ) -{ - if ( StatementList::bUsePostEvents && !bForceDirect ) - { - if ( StatementList::WinPtrValid( pWin ) ) - { - sal_uLong nID; - nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEMOVE, pWin, &aMEvnt ); - ImplEventWait( nID ); - } - } - else - { - if ( pWin->IsTracking() ) - { - TrackingEvent aTEvt( aMEvnt ); - pWin->Tracking( aTEvt ); - } - else - CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEMOVE, aMEvnt, pWin, MouseMove ) - } -}; - -void ImplMouseButtonDown( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect ) -{ - if ( StatementList::bUsePostEvents && !bForceDirect ) - { - if ( StatementList::WinPtrValid( pWin ) ) - { - sal_uLong nID; - nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pWin, &aMEvnt ); - ImplEventWait( nID ); - } - } - else - { - CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEBUTTONDOWN, aMEvnt, pWin, MouseButtonDown ) - } -}; - -void ImplMouseButtonUp( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect ) -{ - if ( StatementList::bUsePostEvents && !bForceDirect ) - { - if ( StatementList::WinPtrValid( pWin ) ) - { - sal_uLong nID; - nID = Application::PostMouseEvent( VCLEVENT_WINDOW_MOUSEBUTTONUP, pWin, &aMEvnt ); - ImplEventWait( nID ); - } - } - else - { - if ( pWin->IsTracking() ) - { - // siehe #64693 die Position ist f�r Toolboxen relevant - // #60020 Jetzt hoffentlich kein GPF mehr - // Zuerst Tracking beenden ohne Event - pWin->EndTracking( ENDTRACK_DONTCALLHDL ); - // dann eigenen Event mit richtigem Maus-Event senden - TrackingEvent aTEvt( aMEvnt, ENDTRACK_END ); - pWin->Tracking( aTEvt ); - } - else - CALL_EVENT_WITH_NOTIFY( EVENT_MOUSEBUTTONUP, aMEvnt, pWin, MouseButtonUp ) - } -}; - -void ImplEventWait( sal_uLong nID ) -{ - while ( !Application::IsProcessedMouseOrKeyEvent( nID ) ) - Application::Yield(); -} - -void ImplCommand( Window* pWin, CommandEvent &aCmdEvnt ) -{ - CALL_EVENT_WITH_NOTIFY( EVENT_COMMAND, aCmdEvnt, pWin, Command ) -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx deleted file mode 100644 index 23641de88..000000000 --- a/automation/source/server/statemnt.cxx +++ /dev/null @@ -1,6339 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// Hat keinen Includeschutz -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "statemnt.hxx" -#include "scmdstrm.hxx" - -#include "retstrm.hxx" - -#if OSL_DEBUG_LEVEL > 1 -# include "editwin.hxx" -#endif - -#include "rcontrol.hxx" -#include -#include "testtool.hxx" - -#include "profiler.hxx" - -#include "recorder.hxx" - -#include "testtool.hrc" -#include - -#include - - -using namespace com::sun::star::frame; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace svt; - - -#ifndef SBX_VALUE_DECL_DEFINED -#define SBX_VALUE_DECL_DEFINED -SV_DECL_REF(SbxValue) -#endif -SV_IMPL_REF(SbxValue) - -CommunicationLink *StatementFlow::pCommLink = NULL; -sal_Bool StatementFlow::bUseIPC = sal_True; -sal_Bool StatementFlow::bSending = sal_False; -ImplRemoteControl *StatementFlow::pRemoteControl = NULL; - -sal_uInt16 StatementCommand::nDirPos = 0; -Dir *StatementCommand::pDir = NULL; -pfunc_osl_printDebugMessage StatementCommand::pOriginal_osl_DebugMessageFunc = NULL; - - -#define SET_WINP_CLOSING(pWin) \ - pWindowWaitPointer = pWin; \ - aWindowWaitUId = pControl->GetUniqueOrHelpId(); \ - aWindowWaitOldHelpId = pWin->GetHelpId(); \ - aWindowWaitOldUniqueId = pWin->GetUniqueId(); \ - pWin->SetHelpId( rtl::OString("TT_Win_is_closing_HID") ); \ - pWin->SetUniqueId( rtl::OString("TT_Win_is_closing_UID") ); - - -StatementFlow::StatementFlow( StatementList *pAfterThis, sal_uInt16 nArtP ) -: nArt(nArtP) -, nParams(0) -, nSNr1(0) -, nLNr1(0) -, aString1() -, bBool1(sal_False) -{ - QueStatement( pAfterThis ); -} - -StatementFlow::StatementFlow( sal_uLong nServiceId, SCmdStream *pCmdIn, ImplRemoteControl *pRC ) -: nArt(0) -, nParams(0) -, nSNr1(0) -, nLNr1(0) -, aString1() -, bBool1(sal_False) -{ - QueStatement( NULL ); - bUseIPC = (nServiceId == SI_IPCCommandBlock); - pRemoteControl = pRC; - pCmdIn->Read( nArt ); - pCmdIn->Read( nParams ); - - if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nSNr1 ); - if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 ); - if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 ); - if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 );// Should NEVER happen - -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Reading FlowControl: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nArt ) ); - m_pDbgWin->AddText( " Params:" ); - if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nSNr1 ) );} - if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " l1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );} - if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );} - if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );} - m_pDbgWin->AddText( "\n" ); -#endif -} - -void StatementFlow::SendViaSocket() -{ - if ( bSending ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "SendViaSocket called recursively. Aborted!!!\n" ); -#endif - OSL_FAIL("SendViaSocket called recursively. Aborted!!!"); - return; - } - bSending = sal_True; - if ( pCommLink ) - { - if ( !pCommLink->TransferDataStream( pRet->GetStream() ) ) // tritt ein Fehler auf, so wird sofort gel�scht ... - pCommLink = NULL; - } - else - { - // Macht nix. Wenn das Basic nicht mehr da ist, ist sowiso alles egal - OSL_FAIL("Cannot send results to TestTool"); - } - - pRet->Reset(); - bSending = sal_False; - IsError = sal_False; -} - -sal_Bool StatementFlow::Execute() -{ -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Executing Flow: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nArt ) ); - m_pDbgWin->AddText( "\n" ); -#endif - switch ( nArt ) - { - case F_EndCommandBlock: - { - - if ( !bUseIPC ) - { - // bBool1 wurde im CTOR auf sal_False initialisiert - if ( !bBool1 ) // also erster Durchlauf - { - pRemoteControl->pRetStream = pRet->GetStream(); - bBool1 = sal_True; // wurde im CTOR auf sal_False initialisiert - nRetryCount = nRetryCount * 4; - } - if ( pRemoteControl->pRetStream && (nRetryCount--) ) // also solange nicht abgeholt - { - return sal_False; // Bitte einmal vom Callstack runter - } - } - - } - break; - } - - Advance(); - switch ( nArt ) - { - case F_EndCommandBlock: - if ( !bUseIPC ) - { // wird oben abgehandelt - pRet->Reset(); - IsError = sal_False; - } - else - SendViaSocket(); - - break; - - case F_Sequence: - - pRet->GenReturn(RET_Sequence,nLNr1); - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Sending Sequence Nr: " ); - m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) ); - m_pDbgWin->AddText( "\n" ); - #endif - - break; - default: - OSL_FAIL( "Unknown Flowcontrol" ); - break; - } - - delete this; - return sal_True; -} - - -// neue Hilfsfunktion, die stetig erweitert werden muss -static short ImpGetRType( Window *pWin ) -{ - short nRT = C_NoType; - WindowType eRT = pWin->GetType(); - switch( eRT ) { - case WINDOW_WINDOW: nRT = C_Window ; break; - - case WINDOW_TABCONTROL: nRT = C_TabControl ; break; - case WINDOW_RADIOBUTTON: nRT = C_RadioButton ; break; - case WINDOW_CHECKBOX: nRT = C_CheckBox ; break; - case WINDOW_TRISTATEBOX: nRT = C_TriStateBox ; break; - case WINDOW_EDIT: nRT = C_Edit ; break; - case WINDOW_MULTILINEEDIT: nRT = C_MultiLineEdit ; break; - case WINDOW_MULTILISTBOX: nRT = C_MultiListBox ; break; - case WINDOW_LISTBOX: nRT = C_ListBox ; break; - case WINDOW_COMBOBOX: nRT = C_ComboBox ; break; - case WINDOW_PUSHBUTTON: nRT = C_PushButton ; break; - case WINDOW_SPINFIELD: nRT = C_SpinField ; break; - case WINDOW_PATTERNFIELD: nRT = C_PatternField ; break; - case WINDOW_NUMERICFIELD: nRT = C_NumericField ; break; - case WINDOW_METRICFIELD: nRT = C_MetricField ; break; - case WINDOW_CURRENCYFIELD: nRT = C_CurrencyField ; break; - case WINDOW_DATEFIELD: nRT = C_DateField ; break; - case WINDOW_TIMEFIELD: nRT = C_TimeField ; break; - case WINDOW_IMAGERADIOBUTTON: nRT = C_ImageRadioButton ; break; - case WINDOW_NUMERICBOX: nRT = C_NumericBox ; break; - case WINDOW_METRICBOX: nRT = C_MetricBox ; break; - case WINDOW_CURRENCYBOX: nRT = C_CurrencyBox ; break; - case WINDOW_DATEBOX: nRT = C_DateBox ; break; - case WINDOW_TIMEBOX: nRT = C_TimeBox ; break; - case WINDOW_IMAGEBUTTON: nRT = C_ImageButton ; break; - case WINDOW_MENUBUTTON: nRT = C_MenuButton ; break; - case WINDOW_MOREBUTTON: nRT = C_MoreButton ; break; - - - case WINDOW_TABPAGE: nRT = C_TabPage; break; - case WINDOW_MODALDIALOG: nRT = C_ModalDlg; break; - case WINDOW_FLOATINGWINDOW: nRT = C_FloatWin; break; - case WINDOW_MODELESSDIALOG: nRT = C_ModelessDlg; break; - case WINDOW_WORKWINDOW: nRT = C_WorkWin; break; - case WINDOW_DOCKINGWINDOW: nRT = C_DockingWin; break; - - case WINDOW_MESSBOX: nRT = C_MessBox; break; - case WINDOW_INFOBOX: nRT = C_InfoBox; break; - case WINDOW_WARNINGBOX: nRT = C_WarningBox; break; - case WINDOW_ERRORBOX: nRT = C_ErrorBox; break; - case WINDOW_QUERYBOX: nRT = C_QueryBox; break; - case WINDOW_TABDIALOG: nRT = C_TabDlg; break; - - case WINDOW_PATTERNBOX: nRT = C_PatternBox; break; - case WINDOW_TOOLBOX: nRT = C_ToolBox; break; - case WINDOW_CONTROL: nRT = C_Control; break; - case WINDOW_OKBUTTON: nRT = C_OkButton; break; - case WINDOW_CANCELBUTTON: nRT = C_CancelButton; break; - case WINDOW_BUTTONDIALOG: nRT = C_ButtonDialog; break; - case WINDOW_TREELISTBOX: nRT = C_TreeListBox; break; - - case WINDOW_DIALOG: nRT = C_Dialog; break; - } - return nRT; -} - - -StatementSlot::StatementSlot( SCmdStream *pCmdIn ) -: pItemArr(NULL) -{ - QueStatement( NULL ); - pCmdIn->Read( nFunctionId ); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Reading Slot: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) ); - m_pDbgWin->AddText( "\n" ); -#endif - pCmdIn->Read( nAnzahl ); - if ( nAnzahl ) - { - switch ( pCmdIn->GetNextType() ) - { - case BinUINT16: // use old calling method - { - nAnzahl++; - pItemArr = new SfxPoolItem*[nAnzahl]; - for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++) - pCmdIn->Read( pItemArr[i] ); - pItemArr[nAnzahl-1] = NULL; - } - break; - case BinString: // new Method - { - aArgs.realloc(nAnzahl); - PropertyValue* pArg = aArgs.getArray(); - for (sal_uInt16 i = 0 ; i < nAnzahl ; i++) - pCmdIn->Read( pArg[i] ); - } - break; - } - } -} - -// Constructor for UnoSlot -StatementSlot::StatementSlot() -: nAnzahl( 0 ) -, pItemArr(NULL) -, nFunctionId( 0 ) -, bMenuClosed(sal_False) -{} - -StatementSlot::StatementSlot( sal_uLong nSlot, SfxPoolItem* pItem ) -: pItemArr(NULL) -, bMenuClosed(sal_False) -{ - QueStatement( NULL ); - nFunctionId = sal_uInt16(nSlot); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Reading Slot: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) ); - m_pDbgWin->AddText( "\n" ); -#endif - if ( pItem ) - { - nAnzahl = 2; - pItemArr = new SfxPoolItem*[2]; - pItemArr[0] = pItem; - pItemArr[1] = NULL; - } - else - nAnzahl = 0; -} - -StatementSlot::~StatementSlot() -{ - if (nAnzahl) - { - if ( pItemArr ) - { - for (sal_uInt16 i = 0 ; i+1 < nAnzahl ; i++) - delete pItemArr[i]; - delete[] pItemArr; - } - - aArgs.realloc( 0 ); - } -} - -void StatementSlot::AddReferer() -{ - HACK( "only to test!" ); -// because slot 6102 /*SID_VERB_START*/ crashes when called with Property Referer -// We return to the previous behavior (which was a bug realy) of not adding this Property to calls which have no properties at all -// according to MBA most likely this Property can be removed at all and is maybe only needed for Slots with URLs - if ( !nAnzahl ) - return; - - PropertyValue* pArg; - - nAnzahl++; - aArgs.realloc(nAnzahl); - pArg = aArgs.getArray(); - pArg[nAnzahl-1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" )); - pArg[nAnzahl-1].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:user" )); - - nAnzahl++; - aArgs.realloc(nAnzahl); - pArg = aArgs.getArray(); - pArg[nAnzahl-1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SynchronMode" )); - pArg[nAnzahl-1].Value <<= sal_Bool( sal_True ); -} - -class SlotStatusListener : public cppu::WeakImplHelper1< XStatusListener > -{ -public: - SlotStatusListener(); - - // XStatusListener - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) 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); - - // local Members - sal_Bool bDisposed; - sal_Bool bEnabled; -}; - -SlotStatusListener::SlotStatusListener() -: bDisposed( sal_False ) -, bEnabled( sal_True ) -{} - -// XStatusListener -void SAL_CALL SlotStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - bEnabled = Event.IsEnabled; -} - -// XEventListener -void SAL_CALL SlotStatusListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ - bDisposed = sal_True; -} - -sal_Bool StatementSlot::Execute() -{ - if ( IsError ) - { - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Skipping Slot: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) ); - m_pDbgWin->AddText( "\n" ); - #endif - - Advance(); - delete this; - return sal_True; - } - - InitProfile(); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Executing Slot: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nFunctionId ) ); - m_pDbgWin->AddText( "\n" ); -#endif - - PopupMenu *pPopup = NULL; - MenuBar *pMenuBar = NULL; - Menu *pMenu; - - GetCurrentMenues( pPopup, pMenuBar, pMenu ); - if ( pPopup ) - { - if ( !bMenuClosed ) - { - pPopup->EndExecute(0); - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - bMenuClosed = sal_True; -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Closed contextmenu\n" ); -#endif - return sal_False; - } - else if ( nRetryCount-- ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Waiting for contextmenu to close\n" ); -#endif - return sal_False; - } - else - ReportError( GEN_RES_STR0( S_MENU_NOT_CLOSING ) ); - } - - Advance(); - - if ( !IsError ) - { - if ( ( nAnzahl == 0 && !getenv("OLDSLOTHANDLING") ) || aArgs.hasElements() ) - { // trying to call slots via uno - AddReferer(); - if ( !aUnoUrl.Len() ) - aUnoUrl = CUniString("slot:").Append( String::CreateFromInt32( nFunctionId ) ); - ::com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = aUnoUrl; - Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.frame.Desktop") ), UNO_QUERY ); - Reference < XFrame > xFrame; - - if ( xDesktop.is() ) - { - xFrame = xDesktop->getActiveFrame(); - if ( !xFrame.is() ) - { - Reference < XFrames > xFrames; - xFrames = xDesktop->getFrames(); - if ( xFrames.is() && xFrames->getCount() > 0 ) - { - Any aFrame = xFrames->getByIndex( xFrames->getCount() -1 ); - aFrame >>= xFrame; - } - } - if ( !xFrame.is() ) - { - if ( GetFirstDocFrame() ) - GetFirstDocFrame()->ToTop(); - xFrame = xDesktop->getActiveFrame(); - } - } - - if ( xFrame.is() ) - xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY ); - else - xDesktop.clear(); - - while ( xDesktop.is() && xDesktop->getActiveFrame().is() ) - { - xFrame = xDesktop->getActiveFrame(); -#if OSL_DEBUG_LEVEL > 1 - ::rtl::OUString aName; - if ( xFrame.is() ) - aName = xFrame->getName(); -#endif - xDesktop = Reference < XFramesSupplier >( xFrame, UNO_QUERY ); - } - - if ( !xFrame.is() ) - ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_FRAME, aTargetURL.Complete ) ); - else - { - Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( CUniString("com.sun.star.util.URLTransformer" )), UNO_QUERY ); - xTrans->parseStrict( aTargetURL ); - - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); - Reference < XDispatch > xDisp; - while ( xProv.is() && !xDisp.is() ) - { - xDisp = xProv->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); - if ( !xDisp.is() ) - { - xFrame = Reference < XFrame > ( xFrame->getCreator(), UNO_QUERY ); - xProv = Reference < XDispatchProvider > ( xFrame, UNO_QUERY ); - } - } - - if ( xDisp.is() ) - { - Reference < XStatusListener > xListener = ( XStatusListener* )new SlotStatusListener; - xDisp->addStatusListener( xListener, aTargetURL ); - if ( static_cast< SlotStatusListener* >(xListener.get())->bEnabled ) - { - if ( bIsSlotInExecute ) - ReportError( GEN_RES_STR0( S_SLOT_IN_EXECUTE ) ); - else - { - bIsSlotInExecute = sal_True; - xDisp->dispatch( aTargetURL, aArgs ); - bIsSlotInExecute = sal_False; - } - } - else - ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_DISABLED, aTargetURL.Complete ) ); - xDisp->removeStatusListener( xListener, aTargetURL ); - } - else - ReportError( GEN_RES_STR1( S_UNO_URL_EXECUTE_FAILED_NO_DISPATCHER, aTargetURL.Complete ) ); - } - } - else - { - DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) ); - if ( !pTTProperties ) - pTTProperties = new TTProperties(); - - switch ( pTTProperties->ExecuteFunction( nFunctionId, pItemArr, EXECUTEMODE_DIALOGASYNCHRON | nUseBindings ) ) - { - case TT_PR_ERR_NODISPATCHER: - { - ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED_NO_DISPATCHER ) ); - } - break; - case TT_PR_ERR_NOEXECUTE: - { - ReportError( rtl::OString::valueOf((sal_Int32)nFunctionId), GEN_RES_STR0( S_SID_EXECUTE_FAILED ) ); - } - break; - } - } - } - - -/* Neues Verfahren ab 334! - Neue Methode zum einstellen, da� Modale Dialoge immer Asynchron aufgerufen werden - und echter Returnwert, ob Slot geklappt hat - und Testen ob Slot �berhaupt durch UI aufgerufen werden kann */ - - - SendProfile( SlotString( nFunctionId ) ); - delete this; - return sal_True; -} - - -StatementUnoSlot::StatementUnoSlot(SCmdStream *pIn) -{ - QueStatement( NULL ); - - pIn->Read( aUnoUrl ); - -#if OSL_DEBUG_LEVEL > 1 - StatementList::m_pDbgWin->AddText( "UnoUrl:" ); - StatementList::m_pDbgWin->AddText( aUnoUrl ); - StatementList::m_pDbgWin->AddText( "\n" ); -#endif - -} - - -StatementCommand::StatementCommand( StatementList *pAfterThis, sal_uInt16 MethodId, sal_uInt16 Params, sal_uInt16 Nr1 ) -: nMethodId( MethodId ) -, nParams(Params) -, nNr1(Nr1) -, nNr2(0) -, nNr3(0) -, nNr4(0) -, aString1() -, aString2() -, bBool1(sal_False) -, bBool2(sal_False) -{ - nLNr1_and_Pointer.pWindow = 0; - - QueStatement( pAfterThis ); - -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Directly adding Conmmand:" ); - m_pDbgWin->AddText( " Methode: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( " Params:" ); - if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );} - if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );} - if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );} - if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );} - if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );} - if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );} - if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );} - if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );} - if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );} - m_pDbgWin->AddText( "\n" ); -#endif -} - - -StatementCommand::StatementCommand( SCmdStream *pCmdIn ) -: nMethodId(0) -, nParams(0) -, nNr1(0) -, nNr2(0) -, nNr3(0) -, nNr4(0) -, aString1() -, aString2() -, bBool1(sal_False) -, bBool2(sal_False) -{ - nLNr1_and_Pointer.pWindow = 0; - - QueStatement( NULL ); - pCmdIn->Read( nMethodId ); - pCmdIn->Read( nParams ); - - if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 ); - if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 ); - if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 ); - if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 ); - if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1_and_Pointer.nLNr1 ); - if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 ); - if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 ); - if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 ); - if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 ); - -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Reading Conmmand:" ); - m_pDbgWin->AddText( " Methode: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( " Params:" ); - if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );} - if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );} - if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );} - if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );} - if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );} - if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );} - if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );} - if( nParams & PARAM_BOOL_1 ) {m_pDbgWin->AddText( " b1:" );m_pDbgWin->AddText( bBool1 ? "TRUE" : "FALSE" );} - if( nParams & PARAM_BOOL_2 ) {m_pDbgWin->AddText( " b2:" );m_pDbgWin->AddText( bBool2 ? "TRUE" : "FALSE" );} - m_pDbgWin->AddText( "\n" ); -#endif - - if ( nMethodId == RC_AppAbort ) - { - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "*Deleting all Commands:\n" ); - #endif - bReadingCommands = sal_False; - while ( StatementList::pFirst != this ) // Alles L�schen au�er mich selbst - { - StatementList *pDeQue = StatementList::pFirst; - pDeQue->Advance(); - delete pDeQue; - } - bReadingCommands = sal_True; - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "*Done deleting all Commands:\n" ); - #endif - } - -} - -void StatementCommand::WriteControlData( Window *pBase, sal_uLong nConf, sal_Bool bFirst ) -{ - - if ( IsDialog(pBase) && !bFirst ) - return; - - if ( bFirst ) - pRet->GenReturn ( RET_WinInfo, rtl::OString(), (comm_UINT32)nConf | DH_MODE_DATA_VALID, UniString(), sal_True ); - - if ( bFirst ) - { - if ( pBase->GetType() == WINDOW_WINDOW && pBase->GetParent() && pBase->GetParent()->GetType() == WINDOW_CONTROL && - dynamic_cast< svt::table::TableControl* > ( pBase->GetParent() ) ) - pBase = pBase->GetParent(); - } - - { // Klammerung, so da� der String nicht w�hrend der Rekursion bestehen bleibt - String aName; - sal_Bool bSkip = sal_False; - - switch ( pBase->GetType() ) - { - case WINDOW_RADIOBUTTON: - case WINDOW_CHECKBOX: - case WINDOW_TRISTATEBOX: - case WINDOW_PUSHBUTTON: - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_IMAGERADIOBUTTON: - case WINDOW_IMAGEBUTTON: - case WINDOW_MENUBUTTON: - case WINDOW_MOREBUTTON: - case WINDOW_TABPAGE: - case WINDOW_MODALDIALOG: - case WINDOW_FLOATINGWINDOW: - case WINDOW_MODELESSDIALOG: - case WINDOW_WORKWINDOW: - case WINDOW_DOCKINGWINDOW: - case WINDOW_CONTROL: - - case WINDOW_FILEDIALOG: - case WINDOW_PATHDIALOG: - case WINDOW_PRINTDIALOG: - case WINDOW_PRINTERSETUPDIALOG: - case WINDOW_COLORDIALOG: - case WINDOW_TABDIALOG: - - case WINDOW_BUTTONDIALOG: - - case WINDOW_MENUBARWINDOW: - aName = pBase->GetText().EraseAllChars('~'); - break; - - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - case WINDOW_MULTILISTBOX: - case WINDOW_LISTBOX: - case WINDOW_COMBOBOX: - case WINDOW_SPINFIELD: - case WINDOW_PATTERNFIELD: - case WINDOW_NUMERICFIELD: - case WINDOW_METRICFIELD: - case WINDOW_CURRENCYFIELD: - case WINDOW_DATEFIELD: - case WINDOW_TIMEFIELD: - case WINDOW_NUMERICBOX: - case WINDOW_METRICBOX: - case WINDOW_CURRENCYBOX: - case WINDOW_DATEBOX: - case WINDOW_TIMEBOX: - case WINDOW_PATTERNBOX: - case WINDOW_TOOLBOX: - aName = pBase->GetQuickHelpText(); - break; - - case WINDOW_MESSBOX: - case WINDOW_INFOBOX: - case WINDOW_WARNINGBOX: - case WINDOW_ERRORBOX: - case WINDOW_QUERYBOX: - aName = ((MessBox*)pBase)->GetMessText(); - break; - - default: - if ( ( pBase->GetUniqueOrHelpId().getLength() == 0 ) && !( nConf & DH_MODE_ALLWIN ) ) - bSkip = sal_True; - break; - } - - if ( !bSkip ) - { - if ( aName.Len() == 0 ) - aName = pBase->GetQuickHelpText(); - if ( aName.Len() == 0 ) - aName = pBase->GetHelpText(); - if ( aName.Len() == 0 ) - aName = pBase->GetText(); - - - String aTypeSuffix; - if ( pBase->GetType() == WINDOW_CONTROL ) - { - if ( dynamic_cast< EditBrowseBox* >(pBase) ) - aTypeSuffix.AppendAscii( "/BrowseBox", 10 ); - else if ( dynamic_cast< ValueSet* >(pBase) ) - aTypeSuffix.AppendAscii( "/ValueSet", 9 ); - else if ( dynamic_cast< ORoadmap* >(pBase) ) - aTypeSuffix.AppendAscii( "/RoadMap", 8 ); - else if ( dynamic_cast< IExtensionListBox* >(pBase) ) - aTypeSuffix.AppendAscii( "/ExtensionListBox" ); - else if ( dynamic_cast< svt::table::TableControl* >(pBase) ) - aTypeSuffix.AppendAscii( "/TableControl" ); - else - aTypeSuffix.AppendAscii( "/Unknown", 8 ); - } - - rtl::OString aId = pBase->GetUniqueOrHelpId(); - pRet->GenReturn ( RET_WinInfo, aId, (comm_UINT32)pBase->GetType(), - TypeString(pBase->GetType()).Append(aTypeSuffix).AppendAscii(": ").Append(aName), sal_False ); - - - if ( pBase->GetType() == WINDOW_TOOLBOX ) // Buttons und Controls auf Toolboxen. - { - ToolBox *pTB = ((ToolBox*)pBase); - sal_uInt16 i; - for ( i = 0; i < pTB->GetItemCount() ; i++ ) - { - aName = String(); - if ( aName.Len() == 0 ) - aName = pTB->GetHelpText( pTB->GetItemId( i ) ); - if ( aName.Len() == 0 ) - aName = pTB->GetItemText( pTB->GetItemId( i ) ); - - Window *pItemWin; - pItemWin = pTB->GetItemWindow( pTB->GetItemId( i ) ); - if ( pTB->GetItemType( i ) == TOOLBOXITEM_BUTTON && ( !pItemWin || !pItemWin->IsVisible() ) ) - { - if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_UINT32)WINDOW_BUTTON, - TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False ); - if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)WINDOW_BUTTON, - TypeString(WINDOW_BUTTON).AppendAscii(": ").Append(aName), sal_False ); - } - else - { - if ( pItemWin ) - { - if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, Str2Id(pTB->GetItemCommand(pTB->GetItemId( i ))), (comm_UINT32)pItemWin->GetType(), - TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False ); - if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)pItemWin->GetType(), - TypeString(pItemWin->GetType()).AppendAscii(": ").Append(aName), sal_False ); - sal_uInt16 ii; - for( ii = 0 ; ii < pItemWin->GetChildCount(); ii++ ) - WriteControlData( pItemWin->GetChild(ii), nConf, sal_False ); - } - else - { - if ( nConf & DH_MODE_ALLWIN ) - { - String aToolBoxItemType; - switch ( pTB->GetItemType( i ) ) - { - case TOOLBOXITEM_DONTKNOW: - aToolBoxItemType.AssignAscii("TOOLBOXITEM_DONTKNOW"); - break; - case TOOLBOXITEM_BUTTON: - aToolBoxItemType.AssignAscii("TOOLBOXITEM_BUTTON"); - break; - case TOOLBOXITEM_SPACE: - aToolBoxItemType.AssignAscii("TOOLBOXITEM_SPACE"); - break; - case TOOLBOXITEM_SEPARATOR: - aToolBoxItemType.AssignAscii("TOOLBOXITEM_SEPARATOR"); - break; - case TOOLBOXITEM_BREAK: - aToolBoxItemType.AssignAscii("TOOLBOXITEM_BREAK"); - break; - default: - OSL_TRACE( "Unknown TOOLBOXITEM %i", pTB->GetItemType( i ) ); - } - if ( pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, Str2Id( pTB->GetItemCommand(pTB->GetItemId( i )) ), (comm_UINT32)WINDOW_BASE, - aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False ); - if ( !pTB->GetItemCommand(pTB->GetItemId( i )).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, pTB->GetHelpId(pTB->GetItemId( i )), (comm_UINT32)WINDOW_BASE, - aToolBoxItemType.AppendAscii(": ").Append(aName), sal_False ); - } - } - } - } - - return; // ToolBox ist hier schon komplett abgehandelt. - } - - - if ( pBase->GetType() == WINDOW_BUTTONDIALOG // Buttons auf Buttondialogen mit ID - || pBase->GetType() == WINDOW_MESSBOX - || pBase->GetType() == WINDOW_INFOBOX - || pBase->GetType() == WINDOW_WARNINGBOX - || pBase->GetType() == WINDOW_ERRORBOX - || pBase->GetType() == WINDOW_QUERYBOX ) - { - ButtonDialog *pBD = ((ButtonDialog*)pBase); - sal_uInt16 i; - for ( i = 0; i < pBD->GetButtonCount() ; i++ ) - { - aName = String(); - if ( aName.Len() == 0 ) - aName = pBD->GetPushButton( pBD->GetButtonId(i) )->GetText(); - ByteString aID; - switch ( pBD->GetButtonId(i) ) - { - case BUTTONID_OK: - aID.Assign("Ok"); - break; - case BUTTONID_CANCEL: - aID.Assign("Cancel"); - break; - case BUTTONID_YES: - aID.Assign("Yes"); - break; - case BUTTONID_NO: - aID.Assign("No"); - break; - case BUTTONID_RETRY: - aID.Assign("Retry"); - break; - case BUTTONID_HELP: - aID.Assign("Help"); - break; - default: - aID = rtl::OString::valueOf( - static_cast(pBD->GetButtonId(i))); - break; - } - - pRet->GenReturn ( RET_WinInfo, aID, (comm_UINT32)pBD->GetPushButton( pBD->GetButtonId(i) )->GetType(), // So da� der Text angezeigt wird! - TypeString(pBD->GetPushButton( pBD->GetButtonId(i) )->GetType()).AppendAscii(": ").Append(aName) - .AppendAscii(" ButtonId = ").AppendAscii( aID.GetBuffer() ), sal_False ); - } - - return; // ButtonDialog ist hier schon komplett abgehandelt. - } - - - Menu* pMenu = GetMatchingMenu( pBase ); - - if ( pMenu ) // Menus - { - sal_uInt16 i; - for ( i = 0; i < pMenu->GetItemCount() ; i++ ) - { - sal_uInt16 nID = pMenu->GetItemId( i ); - - aName = String(); - if ( aName.Len() == 0 ) - aName = pMenu->GetHelpText( nID ); - if ( aName.Len() == 0 ) - aName = pMenu->GetItemText( nID ); - - - if ( pMenu->GetItemType( i ) == MENUITEM_STRING || pMenu->GetItemType( i ) == MENUITEM_IMAGE || pMenu->GetItemType( i ) == MENUITEM_STRINGIMAGE || (nConf & DH_MODE_ALLWIN) ) - { - String aMenuItemType; - switch ( pMenu->GetItemType( i ) ) - { - case MENUITEM_STRING: - aMenuItemType.AssignAscii("MENUITEM_STRING"); - break; - case MENUITEM_STRINGIMAGE: - aMenuItemType.AssignAscii("MENUITEM_STRINGIMAGE"); - break; - case MENUITEM_IMAGE: - aMenuItemType.AssignAscii("MENUITEM_IMAGE"); - break; - case MENUITEM_SEPARATOR: - aMenuItemType.AssignAscii("MENUITEM_SEPARATOR"); - break; - case MENUITEM_DONTKNOW: - aMenuItemType.AssignAscii("MENUITEM_DONTKNOW"); - break; - default: - OSL_TRACE( "Unknown MENUITEM %i", pMenu->GetItemType( i ) ); - } - if ( pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, Str2Id( pMenu->GetItemCommand(nID) ), (comm_UINT32)0, - aMenuItemType.AppendAscii(": ").Append(aName), sal_False ); - if ( !pMenu->GetItemCommand(nID).Len() || ( nConf & DH_MODE_ALLWIN ) ) - pRet->GenReturn ( RET_WinInfo, rtl::OString::valueOf( (sal_Int32)nID ), (comm_UINT32)0, - aMenuItemType.AppendAscii(": ").Append(aName), sal_False ); - } - } - - return; // Menu ist hier schon komplett abgehandelt. - } - } - } - - for( sal_uInt16 i = 0 ; i < pBase->GetChildCount(); i++ ) - WriteControlData( pBase->GetChild(i), nConf, sal_False ); -} - -class SysWinContainer : public WorkWindow -{ -private: - ToolBox *pClientWin; - DockingWindow *pDock; -public: - SysWinContainer( ToolBox *pClient ); - ~SysWinContainer(); - virtual void Resize(); - virtual void Resizing( Size& rSize ); -}; - -SysWinContainer::SysWinContainer( ToolBox *pClient ) -: WorkWindow( NULL, WB_BORDER | WB_SIZEMOVE | WB_CLOSEABLE ) -, pClientWin( pClient ) -{ - pDock = new DockingWindow( this ); - pClientWin->SetParent( pDock ); - pClientWin->SetFloatingMode( sal_False ); - SetText( pClient->GetText() ); - SetPosPixel( Point( 1,40 ) ); - Resize(); - pDock->Show(); - EnableAlwaysOnTop(); - Show(); -} - -SysWinContainer::~SysWinContainer() -{ - delete pDock; -} - -void SysWinContainer::Resize() -{ - Size aSize( GetOutputSizePixel() ); - Resizing( aSize ); - - if ( aSize != GetSizePixel() ) - { - SetOutputSizePixel( aSize ); - pDock->SetSizePixel( aSize ); - pClientWin->SetSizePixel( aSize ); - } -} - -void SysWinContainer::Resizing( Size& rSize ) -{ - Size aSize; - Size aBestSize; - sal_uInt16 i; - sal_Bool bHasValue = sal_False; - sal_uLong nBestValue = 0; - sal_uLong nThisValue; - for ( i=1 ; i<=1 ; i++ ) - { - aSize = pClientWin->CalcWindowSizePixel( i ); - nThisValue = Abs( aSize.Width() - rSize.Width() ) + Abs( aSize.Height() - rSize.Height() ); - if ( !bHasValue || ( nThisValue < nBestValue ) ) - { - nBestValue = nThisValue; - aBestSize = aSize; - bHasValue = sal_True; - } - } - rSize = aBestSize; -} - - -class DisplayHidWin : public ToolBox -{ - Edit *pEdit; - Size aMinEditSize; - sal_uInt16 nLastItemID; - sal_Bool bIsDraging; - sal_Bool bIsPermanentDraging; - void SetDraging( sal_Bool bNewDraging ); - Image *pShow, *pShow2; - sal_Bool bConfigChanged; - void EnableButtons( sal_uLong nConf ); - - sal_uLong nEventHookID; - static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData ) - { - return ((DisplayHidWin*)pData)->VCLEventHook( rEvt ); - } - - long VCLEventHook( NotifyEvent& rEvt ); - Window *pLastMouseMoveWin; - - SysWinContainer *pContainer; - - // aborting by pressing shist twice - sal_Bool bOldShift; - Time aLatest; - sal_uInt16 nShiftCount; - -public: - DisplayHidWin(); - ~DisplayHidWin(); - - virtual void Tracking( const TrackingEvent& rTEvt ); - virtual void Click(); - virtual void Select(); - virtual void SetText( const XubString& rStr ); - - void SetDisplayText( const String &aNewText ){ pEdit->SetText(aNewText); } - String GetDisplayText() const { return pEdit->GetText(); } - sal_Bool IsDisplayTextModified() const { return pEdit->IsModified(); } - void ClearDisplayTextModified() const { pEdit->ClearModifyFlag(); } - - void SetConfig( sal_uLong nConf ); - sal_uLong GetConfig(); - - sal_Bool IsConfigChanged() { return bConfigChanged; } - void ConfigSent() { bConfigChanged = sal_False; } - - sal_Bool IsSendData() { return GetItemState( TT_SEND_DATA ) == STATE_CHECK; } - - sal_Bool IsDraging() { return bIsDraging; } - - Window* LastMouseMoveWin() { return pLastMouseMoveWin; } -}; - -DisplayHidWin::DisplayHidWin() -: ToolBox( StatementList::GetFirstDocFrame(), TTProperties::GetSvtResId(DisplayHidToolBox) ) -, bIsDraging( sal_False ) -, bIsPermanentDraging( sal_False ) -, pShow( NULL ) -, pShow2( NULL ) -, pLastMouseMoveWin( NULL ) -, bOldShift( 0 ) -, nShiftCount( 0 ) -{ - SetOutStyle( TOOLBOX_STYLE_HANDPOINTER | TOOLBOX_STYLE_FLAT ); - pEdit = new Edit( this, WB_CENTER | WB_BORDER ); - aMinEditSize = GetItemRect( TT_OUTPUT ).GetSize(); -/**/ aMinEditSize=Size(20,20); - aMinEditSize.Width() *= 12; - pEdit->SetSizePixel( aMinEditSize ); - pEdit->Show(); - SetItemWindow( TT_OUTPUT, pEdit ); - Resize(); - pContainer = new SysWinContainer( this ); - nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this ); -} - -DisplayHidWin::~DisplayHidWin() -{ - Application::RemoveEventHook( nEventHookID ); - Hide(); // so GetFirstDocFrame won't return ourselves (needed for SOPlayer) - SetParent( StatementList::GetFirstDocFrame() ); - delete pContainer; - delete pEdit; -} - -void DisplayHidWin::SetDraging( sal_Bool bNewDraging ) -{ - if ( !pShow ) - pShow = new Image( GetItemImage( TT_SHOW ) ); - if ( !pShow2 ) - pShow2 = new Image( Bitmap( TTProperties::GetSvtResId( TT_SHOW2 ) ) ); - - if ( bNewDraging ) - SetItemImage( TT_SHOW, *pShow2 ); - else - SetItemImage( TT_SHOW, *pShow ); - - bIsDraging = bNewDraging; -} - -void DisplayHidWin::EnableButtons( sal_uLong nConf ) -{ - sal_Bool bSend = sal_Bool(nConf & DH_MODE_SEND_DATA); - EnableItem( TT_ALLWIN, bSend ); - EnableItem( TT_KURZNAME, bSend ); - EnableItem( TT_LANGNAME, bSend ); -} - -void DisplayHidWin::Tracking( const TrackingEvent& rTEvt ) -{ - if ( nLastItemID == TT_SHOW && GetItemState( TT_SHOW ) == STATE_NOCHECK ) - EndTracking( ENDTRACK_CANCEL ); - ToolBox::Tracking( rTEvt); -} - -void DisplayHidWin::Click() -{ - nLastItemID = GetCurItemId(); - if ( nLastItemID == TT_SHOW ) - { - SetDraging( sal_True ); - } - ToolBox::Click(); -} - -void DisplayHidWin::Select() -{ - if ( GetItemState( GetCurItemId() ) == STATE_NOCHECK ) - { - SetItemState( GetCurItemId(), STATE_CHECK ); - if ( GetCurItemId() == TT_SHOW ) - { - bIsPermanentDraging = sal_True; - SetDraging( sal_True ); - } - } - else - { - SetItemState( GetCurItemId(), STATE_NOCHECK ); - if ( GetCurItemId() == TT_SHOW ) - { - bIsPermanentDraging = sal_False; - SetDraging( sal_False ); - } - } - if ( GetCurItemId() == TT_SEND_DATA ) - { - EnableButtons( GetConfig() ); - } -} - -void DisplayHidWin::SetConfig( sal_uLong nConf ) -{ - SetItemState( TT_KURZNAME, ( nConf & DH_MODE_KURZNAME ) ? STATE_CHECK : STATE_NOCHECK ); - SetItemState( TT_LANGNAME, ( nConf & DH_MODE_LANGNAME ) ? STATE_CHECK : STATE_NOCHECK ); - SetItemState( TT_ALLWIN, ( nConf & DH_MODE_ALLWIN ) ? STATE_CHECK : STATE_NOCHECK ); - SetItemState( TT_SEND_DATA, ( nConf & DH_MODE_SEND_DATA ) ? STATE_CHECK : STATE_NOCHECK ); - EnableButtons( nConf ); -} - -sal_uLong DisplayHidWin::GetConfig() -{ - sal_uLong nConf = 0; - if ( GetItemState( TT_KURZNAME ) == STATE_CHECK ) - nConf |= DH_MODE_KURZNAME; - if ( GetItemState( TT_LANGNAME ) == STATE_CHECK ) - nConf |= DH_MODE_LANGNAME; - if ( GetItemState( TT_ALLWIN ) == STATE_CHECK ) - nConf |= DH_MODE_ALLWIN; - if ( IsSendData() ) - nConf |= DH_MODE_SEND_DATA; - - return nConf; -} - -void DisplayHidWin::SetText( const XubString& rStr ) -{ - pContainer->SetText( rStr ); -} - -long DisplayHidWin::VCLEventHook( NotifyEvent& rEvt ) -{ - if ( EVENT_MOUSEMOVE == rEvt.GetType() ) - { - pLastMouseMoveWin = rEvt.GetWindow(); - - // check if abort with pressing shift twice - MouseEvent* pMEvt = (MouseEvent*)rEvt.GetMouseEvent(); - - if ( ( pMEvt->IsShift() && !bOldShift ) ) // Shift pressed - { - if ( aLatest < Time() ) - { - nShiftCount = 0; - aLatest = Time()+Time( 0, 0, 0, 50 ); - } - nShiftCount++; - } - if ( ( !pMEvt->IsShift() && bOldShift ) ) // Shift released - { - nShiftCount++; - if ( nShiftCount == 4 && aLatest > Time() ) - { - bIsPermanentDraging = sal_False; - SetDraging( sal_False ); - SetItemState( TT_SHOW, STATE_NOCHECK ); - } - } - bOldShift = pMEvt->IsShift(); - } - if ( ( ( EVENT_MOUSEBUTTONUP == rEvt.GetType() && rEvt.GetMouseEvent()->GetButtons() == MOUSE_LEFT) || ( EVENT_MOUSEMOVE == rEvt.GetType() && !rEvt.GetMouseEvent()->GetButtons() ) ) - && IsDraging() && !bIsPermanentDraging ) - SetDraging( sal_False ); - return 0; -} - - -sal_Bool StatementCommand::DisplayHID() -{ - // Return sal_True -> reexecute command - - if ( !bBool2 ) // Wird auf sal_False initialisiert - { - bBool2 = sal_True; // Wir sind initialisiert. - GetTTSettings()->pDisplayInstance = this; // Und haben die Macht (Alle anderen beenden sich) - - if ( !(nParams & PARAM_UINT32_1) ) - { - if( GetTTSettings()->pDisplayHidWin ) // Nichts ver�ndern - nLNr1_and_Pointer.nLNr1 = GetTTSettings()->pDisplayHidWin->GetConfig(); - else // Beim ersten Aufruf wollen wir alles richtig einstellen - nLNr1_and_Pointer.nLNr1 = DH_MODE_KURZNAME | DH_MODE_LANGNAME; - - if( ((nParams & PARAM_BOOL_1) && bBool1) ) - nLNr1_and_Pointer.nLNr1 |= DH_MODE_SEND_DATA; - else - nLNr1_and_Pointer.nLNr1 &= ( ~DH_MODE_SEND_DATA ); - } - - if ( GetTTSettings()->pDisplayHidWin ) - GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1_and_Pointer.nLNr1 ); - } - - if ( GetTTSettings()->pDisplayInstance && GetTTSettings()->pDisplayInstance != this ) - { - DBG_WARNING("Mehrere DisplayHID am laufen"); - return sal_False; // Noch eine andere Instanz macht das gleiche! - } - - if ( !GetTTSettings()->pDisplayHidWin ) - { - GetTTSettings()->pDisplayHidWin = new DisplayHidWin(); - GetTTSettings()->aOriginalCaption = GetTTSettings()->pDisplayHidWin->GetText(); - GetTTSettings()->pDisplayHidWin->Show(); - if ( bBool1 ) - nLNr1_and_Pointer.nLNr1 |= DH_MODE_SEND_DATA; - GetTTSettings()->pDisplayHidWin->SetConfig( nLNr1_and_Pointer.nLNr1 ); - - GetTTSettings()->Old = NULL; - GetTTSettings()->Act = NULL; - GetTTSettings()->pDisplayInstance = this; - } - else - { - GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->Enable( sal_True, sal_True ); - GetTTSettings()->pDisplayHidWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True ); - } - - - if ( GetTTSettings()->pDisplayHidWin->IsVisible() && !bDying ) - { - - if ( GetTTSettings()->pDisplayHidWin->IsDraging() ) - { - - -#define HIGHLIGHT_WIN( WinPtr ) \ - { \ - Color aLineColMem = WinPtr->GetLineColor(); \ - WinPtr->SetLineColor( Color( COL_WHITE ) ); \ - Color aFillColMem = WinPtr->GetFillColor(); \ - WinPtr->SetFillColor( Color( COL_LIGHTRED ) ); \ - RasterOp aROp = WinPtr->GetRasterOp(); \ - WinPtr->SetRasterOp( ROP_XOR ); \ - Size aSz = WinPtr->PixelToLogic( WinPtr->GetSizePixel() );\ - sal_uLong nMaxCornerRadius = WinPtr->PixelToLogic( Point( 80, 0 ) ).X();\ - sal_uLong iCorner = std::max ((sal_uLong) 8, (sal_uLong) std::min( nMaxCornerRadius, (sal_uLong) std::min((sal_uLong) (aSz.Width() / 6), (sal_uLong)(aSz.Height() / 6))));\ - WinPtr->DrawRect(Rectangle(Point(),aSz), iCorner, iCorner);\ - WinPtr->SetLineColor( aLineColMem ); \ - WinPtr->SetFillColor( aFillColMem ); \ - WinPtr->SetRasterOp( aROp ); \ - } - - -#define SET_WIN( WinPtr ) \ - if ( StatementList::WinPtrValid(WinPtr) ) \ - { \ - HIGHLIGHT_WIN ( WinPtr ); \ - } - -#define RESET_WIN( WinPtr ) \ - if ( StatementList::WinPtrValid(WinPtr) ) \ - { \ - WinPtr->Invalidate( INVALIDATE_NOTRANSPARENT ); \ - WinPtr->Update(); \ - } - - - GetTTSettings()->Old = GetTTSettings()->Act; - GetTTSettings()->Act = GetTTSettings()->pDisplayHidWin->LastMouseMoveWin(); - - if ( !StatementList::WinPtrValid ( GetTTSettings()->Old ) ) - GetTTSettings()->Old = NULL; - if ( !StatementList::WinPtrValid ( GetTTSettings()->Act ) ) - GetTTSettings()->Act = NULL; - - if ( GetTTSettings()->Act && GetTTSettings()->Act->GetType() == WINDOW_BORDERWINDOW ) - GetTTSettings()->Act = GetTTSettings()->Act->GetWindow( WINDOW_CLIENT ); - - if ( GetTTSettings()->Act != GetTTSettings()->Old ) - { - if ( GetTTSettings()->Old ) - { - RESET_WIN(GetTTSettings()->Old); - } - if ( GetTTSettings()->Act ) - { - SET_WIN(GetTTSettings()->Act); - GetTTSettings()->pDisplayHidWin->SetDisplayText( Id2Str(GetTTSettings()->Act->GetUniqueOrHelpId()).AppendAscii(" WinType: ") - .Append(UniString::CreateFromInt64(GetTTSettings()->Act->GetType())).AppendAscii(" ").Append(GetTTSettings()->Act->GetText())); - if ( GetTTSettings()->Act && !GetTTSettings()->Act->GetUniqueId().equals( GetTTSettings()->Act->GetHelpId() ) ) - GetTTSettings()->pDisplayHidWin->SetText(UniString( TTProperties::GetSvtResId( TT_ALTERNATE_CAPTION ) ).AppendAscii(GetTTSettings()->Act->GetHelpId().getStr())); - else - GetTTSettings()->pDisplayHidWin->SetText( GetTTSettings()->aOriginalCaption ); - } - else - GetTTSettings()->pDisplayHidWin->SetDisplayText(CUniString("Kein Window/Control gefunden")); - } - else if ( GetTTSettings()->Act ) - { - // allow setting a HelpID manually (just enter the ID in the displayHID Window and terminate it by | - if ( GetTTSettings()->pDisplayHidWin->IsDisplayTextModified() && GetTTSettings()->pDisplayHidWin->GetDisplayText().GetTokenCount( '|' ) > 1 ) - { - GetTTSettings()->Act->SetUniqueId( Str2Id( GetTTSettings()->pDisplayHidWin->GetDisplayText().GetToken( '|' ) ) ); - GetTTSettings()->pDisplayHidWin->ClearDisplayTextModified(); - } - } - - if ( GetTTSettings()->pDisplayHidWin->IsSendData() && GetTTSettings()->Act ) - { - if ( !StatementFlow::bSending ) - { // Normalerweise syncronisierung �ber Protokoll. Hier ist das aber asyncron!!! - WriteControlData( GetTTSettings()->Act, GetTTSettings()->pDisplayHidWin->GetConfig() ); - new StatementFlow( this, F_EndCommandBlock ); // Kommando zum Senden erzeugen und in que eintragen - } - } - } - else - { - if ( GetTTSettings()->Act ) - { - RESET_WIN(GetTTSettings()->Act); - GetTTSettings()->Act = NULL; - } - } - - if ( pFirst == this ) // Sollte immer so sein, aber besser isses - if ( pNext ) // Befehle warten auf Ausf�hrung - { // An Ende neu einsortieren - Advance(); - QueStatement( NULL ); - } - } - else - { - delete GetTTSettings()->pDisplayHidWin; - GetTTSettings()->pDisplayHidWin = NULL; - GetTTSettings()->pDisplayInstance = NULL; - } - - return GetTTSettings()->pDisplayHidWin != NULL; -} - -class TranslateWin : public WorkWindow -{ -private: - DECL_LINK( DoAccept, PushButton* ); - DECL_LINK( DoNext, PushButton* ); - DECL_LINK( DoSelect, PushButton* ); - DECL_LINK( DoRestore, PushButton* ); - DECL_LINK( TranslationChanged, Edit* ); - DECL_LINK( ShowInplace, Timer* ); - - Timer InplaceTimer; - - PushButton PushButtonTT_PB_NEXT; - GroupBox GroupBoxTT_GB_TRANSLATION; - Edit EditTT_E_NEW; - GroupBox GroupBoxTT_GB_COMMENT; - Edit EditTT_E_COMMENT; - PushButton PushButtonTT_PB_ACCEPT; - FixedText FixedTextTT_FT_OLD; - PushButton PushButtonTT_PB_SELECT; - PushButton PushButtonTT_PB_RESTORE; - - Window *Old; - Window *Act; - Window *pTranslateWin; - sal_Bool bSelecting; - - sal_Bool bAvailable; - sal_Bool bNext; - - sal_Bool TestChangedDataSaved(); - - - sal_uLong nEventHookID; - static long stub_VCLEventHookProc( NotifyEvent& rEvt, void* pData ) - { - return ((TranslateWin*)pData)->VCLEventHook( rEvt ); - } - - long VCLEventHook( NotifyEvent& rEvt ); - -public: - TranslateWin(); - ~TranslateWin(); - - static String MarkShortcutErrors( Window* pBase, sal_Bool bMark ); - - sal_Bool IsTranslationAvailable(){ return bAvailable; } - sal_Bool IsNextDialog(){ return bNext; } - void ResetNextDialog(){ bNext = sal_False; } - - Window* GetTranslationWindow(){ return pTranslateWin; } - String GetOriginalText(){ return FixedTextTT_FT_OLD.GetText(); } - String GetTranslationText(){ return EditTT_E_NEW.GetText(); } - String GetComment(){ return EditTT_E_COMMENT.GetText(); } - - void EnableTranslation(); -}; - -TranslateWin::TranslateWin() -: WorkWindow( NULL, TTProperties::GetSvtResId( TT_INLINE_TRANSLATION ) ) -, PushButtonTT_PB_NEXT( this, TTProperties::GetSvtResId( TT_PB_NEXT ) ) -, GroupBoxTT_GB_TRANSLATION( this, TTProperties::GetSvtResId( TT_GB_TRANSLATION ) ) -, EditTT_E_NEW( this, TTProperties::GetSvtResId( TT_E_NEW ) ) -, GroupBoxTT_GB_COMMENT( this, TTProperties::GetSvtResId( TT_GB_COMMENT ) ) -, EditTT_E_COMMENT( this, TTProperties::GetSvtResId( TT_E_COMMENT ) ) -, PushButtonTT_PB_ACCEPT( this, TTProperties::GetSvtResId( TT_PB_ACCEPT ) ) -, FixedTextTT_FT_OLD( this, TTProperties::GetSvtResId( TT_FT_OLD ) ) -, PushButtonTT_PB_SELECT( this, TTProperties::GetSvtResId( TT_PB_SELECT ) ) -, PushButtonTT_PB_RESTORE( this, TTProperties::GetSvtResId( TT_PB_RESTORE ) ) -, Old( NULL ) -, Act( NULL ) -, pTranslateWin( NULL ) -, bSelecting( sal_False ) -, bAvailable( sal_False ) -, bNext( sal_False ) -{ - FreeResource(); - PushButtonTT_PB_NEXT.SetClickHdl( LINK( this, TranslateWin, DoNext ) ); - PushButtonTT_PB_ACCEPT.SetClickHdl( LINK( this, TranslateWin, DoAccept ) ); - PushButtonTT_PB_SELECT.SetClickHdl( LINK( this, TranslateWin, DoSelect ) ); - PushButtonTT_PB_RESTORE.SetClickHdl( LINK( this, TranslateWin, DoRestore ) ); - EditTT_E_NEW.SetModifyHdl( LINK( this, TranslateWin, TranslationChanged ) ); - InplaceTimer.SetTimeout( 250 ); - InplaceTimer.SetTimeoutHdl( LINK( this, TranslateWin, ShowInplace ) ); - EnableAlwaysOnTop(); - nEventHookID = Application::AddEventHook( stub_VCLEventHookProc, this ); -} - -TranslateWin::~TranslateWin() -{ - Application::RemoveEventHook( nEventHookID ); -} - -sal_Bool TranslateWin::TestChangedDataSaved() -{ - if ( ( EditTT_E_NEW.GetText().CompareTo( FixedTextTT_FT_OLD.GetText() ) != COMPARE_EQUAL - || EditTT_E_COMMENT.GetText().Len() ) - && PushButtonTT_PB_ACCEPT.IsEnabled() ) - { - return MessBox( this, TTProperties::GetSvtResId( TT_DISCARD_CHANGED_DATA ) ).Execute() == RET_YES; - } - else - return sal_True; -} - -IMPL_LINK( TranslateWin, DoAccept, PushButton*, EMPTYARG ) -{ - PushButtonTT_PB_SELECT.Disable(); - PushButtonTT_PB_NEXT.Disable(); - PushButtonTT_PB_RESTORE.Disable(); - EditTT_E_NEW.Disable(); - EditTT_E_COMMENT.Disable(); - PushButtonTT_PB_ACCEPT.Disable(); - bAvailable = sal_True; - return 0; -} - -IMPL_LINK( TranslateWin, DoNext, PushButton*, EMPTYARG ) -{ - if ( TestChangedDataSaved() ) - { - PushButtonTT_PB_SELECT.Disable(); - PushButtonTT_PB_NEXT.Disable(); - PushButtonTT_PB_RESTORE.Disable(); - EditTT_E_NEW.Disable(); - EditTT_E_COMMENT.Disable(); - PushButtonTT_PB_ACCEPT.Disable(); - bNext = sal_True; - } - return 0; -} - -IMPL_LINK( TranslateWin, DoSelect, PushButton*, EMPTYARG ) -{ - if ( bSelecting ) - { - bSelecting = sal_False; - } - else - { - if ( TestChangedDataSaved() ) - { - PushButtonTT_PB_RESTORE.Disable(); - bSelecting = sal_True; - } - } - return 0; -} - -IMPL_LINK( TranslateWin, DoRestore, PushButton*, EMPTYARG ) -{ - String sTT_E_OLD( FixedTextTT_FT_OLD.GetText()); - sTT_E_OLD.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") ); - sTT_E_OLD.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") ); - - String sTT_E_NEW( EditTT_E_NEW.GetText()); - sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") ); - sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") ); - - if ( StatementList::WinPtrValid( pTranslateWin ) && pTranslateWin->GetText().CompareTo( sTT_E_NEW ) == COMPARE_EQUAL ) - { // Im ersten schritt nur in der UI zur�ck - pTranslateWin->SetText( sTT_E_OLD ); - } - else - { // Im zweite Schritt auch den eingegebenen Text - EditTT_E_NEW.SetText( FixedTextTT_FT_OLD.GetText() ); - PushButtonTT_PB_RESTORE.Disable(); - } - if ( StatementList::WinPtrValid( pTranslateWin ) ) - MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True ); - return 0; -} - -IMPL_LINK( TranslateWin, TranslationChanged, Edit*, pEdit ) -{ - (void) pEdit; /* avoid warning about unused parameter */ - PushButtonTT_PB_RESTORE.Enable(); - InplaceTimer.Start(); - return 0; -} - -IMPL_LINK( TranslateWin, ShowInplace, Timer*, EMPTYARG ) -{ - PushButtonTT_PB_RESTORE.Enable(); - if ( StatementList::WinPtrValid( pTranslateWin ) ) - { - String sTT_E_NEW( EditTT_E_NEW.GetText()); - // alle CRs UnQuoten - sTT_E_NEW.SearchAndReplaceAll( CUniString("\\n"), CUniString("\n") ); - // alle TABSs UnQuoten - sTT_E_NEW.SearchAndReplaceAll( CUniString("\\t"), CUniString("\t") ); - pTranslateWin->SetText( sTT_E_NEW ); - - MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True ); - } - return 0; -} - -long TranslateWin::VCLEventHook( NotifyEvent& rEvt ) -{ - if ( EVENT_MOUSEMOVE == rEvt.GetType() ) - { - if ( bSelecting ) - { - const MouseEvent *pMEvt = rEvt.GetMouseEvent(); - Old = Act; - Act = rEvt.GetWindow(); - - if ( Act ) - { - Window *pWin = Act; - sal_uInt16 i; - for ( i = 0 ; i < Act->GetChildCount() ; i++ ) - { - pWin = Act->GetChild(i); - Rectangle aWinPosSize( pWin->GetPosPixel(), pWin->GetSizePixel() ); - - if ( ( pWin->IsMouseTransparent() || !pWin->IsEnabled() ) && aWinPosSize.IsInside( pMEvt->GetPosPixel() ) ) - { - Act = pWin; - break; - } - } - } - - if ( !StatementList::WinPtrValid ( Old ) ) - Old = NULL; - - if ( Act != Old ) - { - if ( Old ) - { - Window *pWin; - if ( Old->IsMouseTransparent() && Old->GET_REAL_PARENT() ) - pWin = Old->GET_REAL_PARENT(); - else - pWin = Old; - RESET_WIN(pWin); - } - if ( Act ) - { - SET_WIN(Act); - FixedTextTT_FT_OLD.SetText( Act->GetText() ); - } - else - FixedTextTT_FT_OLD.SetText( String() ); - } - else if ( Act ) - { - } - } - else - { - if ( Act ) - { - if ( Act->IsMouseTransparent() && Act->GET_REAL_PARENT() ) - Act = Act->GET_REAL_PARENT(); - RESET_WIN(Act); - Act = NULL; - } - } - } - else if ( EVENT_MOUSEBUTTONUP == rEvt.GetType() ) - { - if ( bSelecting ) - { - pTranslateWin = Act; - if ( pTranslateWin ) - { - MarkShortcutErrors( pTranslateWin->GetWindow( WINDOW_OVERLAP ), sal_True ); - // alle CRs quoten (NF) - String sTT_E_NEW( pTranslateWin->GetText()); - sTT_E_NEW.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") ); - // alle TABSs quoten () - sTT_E_NEW.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") ); - - FixedTextTT_FT_OLD.SetText( sTT_E_NEW ); - EditTT_E_NEW.SetText( sTT_E_NEW ); - EditTT_E_NEW.Enable(); - EditTT_E_NEW.GrabFocus(); - EditTT_E_COMMENT.SetText( String() ); - EditTT_E_COMMENT.Enable(); - PushButtonTT_PB_ACCEPT.Enable(); - } - bSelecting = sal_False; - } - } - - return 0; -} - -#define FDS_ACTION_COLLECT 1 -#define FDS_ACTION_MARK 2 -#define FDS_ACTION_UNMARK 3 - -class FindShortcutErrors: public Search -{ - String aShortcuts,aDoubleShortcuts; - sal_uInt16 nAction; -public: - FindShortcutErrors(); - virtual sal_Bool IsWinOK( Window *pWin ); - void SetAction( sal_uInt16 nA ); - String GetDoubleShortcuts() { return aDoubleShortcuts; } -}; - -FindShortcutErrors::FindShortcutErrors() -: Search( SEARCH_NOOVERLAP | SEARCH_NO_TOPLEVEL_WIN ) -{ - SetAction( FDS_ACTION_COLLECT ); // Wir fange immer mit sammeln an, ODER?? -} - -void FindShortcutErrors::SetAction( sal_uInt16 nA ) -{ - nAction = nA; - if ( FDS_ACTION_COLLECT == nAction ) - { - aShortcuts = UniString(); - aDoubleShortcuts = UniString(); - } -} - -sal_Bool FindShortcutErrors::IsWinOK( Window *pWin ) -{ - if ( pWin->IsReallyVisible() ) - { - String aText = pWin->GetText(); - xub_StrLen nPos = aText.Search('~'); - String aShortcut; - sal_Bool bHasAccel = sal_False; - if ( nPos != STRING_NOTFOUND ) - { - aShortcut = aText.Copy( nPos+1, 1 ); - aShortcut.ToLowerAscii(); - bHasAccel = aShortcut.Len() == 1; - } - - switch ( nAction ) - { - case FDS_ACTION_COLLECT: - { - if ( aShortcuts.Search( aShortcut ) != STRING_NOTFOUND ) - aDoubleShortcuts += aShortcut; - else - aShortcuts += aShortcut; - } - break; - case FDS_ACTION_MARK: - { - sal_Bool bMissing = sal_False; - if ( !bHasAccel && aText.Len() ) // should there be an accelarator defined - { - - Window* pChild; - pChild = pWin->GetWindow( WINDOW_CLIENT ); - - if ( (pChild->GetType() == WINDOW_RADIOBUTTON) || - (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) || - (pChild->GetType() == WINDOW_CHECKBOX) || - (pChild->GetType() == WINDOW_TRISTATEBOX) || - (pChild->GetType() == WINDOW_PUSHBUTTON) ) - { - if ( !pChild->GetText().EqualsAscii( "..." ) ) - bMissing = sal_True; - } - - if ( pChild->GetType() == WINDOW_FIXEDTEXT ) - { - Window* pTempChild = pWin->GetWindow( WINDOW_NEXT ); - if ( pTempChild ) - pTempChild = pTempChild->GetWindow( WINDOW_CLIENT ); - - if ( pTempChild && pChild->GetText().Len() ) - { - if ( (pTempChild->GetType() == WINDOW_EDIT) || - (pTempChild->GetType() == WINDOW_MULTILINEEDIT) || - (pTempChild->GetType() == WINDOW_SPINFIELD) || - (pTempChild->GetType() == WINDOW_PATTERNFIELD) || - (pTempChild->GetType() == WINDOW_NUMERICFIELD) || - (pTempChild->GetType() == WINDOW_METRICFIELD) || - (pTempChild->GetType() == WINDOW_CURRENCYFIELD) || - (pTempChild->GetType() == WINDOW_DATEFIELD) || - (pTempChild->GetType() == WINDOW_TIMEFIELD) || - (pTempChild->GetType() == WINDOW_LISTBOX) || - (pTempChild->GetType() == WINDOW_MULTILISTBOX) || - (pTempChild->GetType() == WINDOW_COMBOBOX) || - (pTempChild->GetType() == WINDOW_PATTERNBOX) || - (pTempChild->GetType() == WINDOW_NUMERICBOX) || - (pTempChild->GetType() == WINDOW_METRICBOX) || - (pTempChild->GetType() == WINDOW_CURRENCYBOX) || - (pTempChild->GetType() == WINDOW_DATEBOX) || - (pTempChild->GetType() == WINDOW_TIMEBOX) ) - { - bMissing = sal_True; - } - } - } - } - - if ( bHasAccel && aDoubleShortcuts.Search( aShortcut ) != STRING_NOTFOUND ) - { - if ( pWin->GetType() == WINDOW_GROUPBOX ) - pWin->SetControlForeground( Color( COL_LIGHTRED ) ); - else - { - pWin->SetControlBackground(); - Color aCol(COL_GRAY); - aCol.SetRed( 0xff ); - pWin->SetControlBackground( aCol ); - } - } - else if ( bMissing ) - { - pWin->SetControlBackground(); - Color aCol(COL_GRAY); - aCol.SetRed( 0xff ); - aCol.SetGreen( 0xff ); - pWin->SetControlBackground( aCol ); - } - else - { - pWin->SetControlForeground(); - pWin->SetControlBackground(); - } - } - break; - case FDS_ACTION_UNMARK: - { - pWin->SetControlForeground(); - pWin->SetControlBackground(); - } - break; - } - } - else - if ( FDS_ACTION_MARK == nAction || FDS_ACTION_UNMARK == nAction ) - { - pWin->SetControlForeground(); - pWin->SetControlBackground(); - } - - return sal_False; -} - -String TranslateWin::MarkShortcutErrors( Window* pBase, sal_Bool bMark ) -{ - if ( pBase ) - { - FindShortcutErrors aFinder; - if ( bMark ) - { - StatementList::SearchAllWin( pBase, aFinder, sal_True ); // collect Shortcuts first - aFinder.SetAction( FDS_ACTION_MARK ); - } - else - aFinder.SetAction( FDS_ACTION_UNMARK ); - StatementList::SearchAllWin( pBase, aFinder, sal_True ); - return aFinder.GetDoubleShortcuts(); - } - return UniString(); -} - -void TranslateWin::EnableTranslation() -{ - PushButtonTT_PB_SELECT.Enable(); - PushButtonTT_PB_NEXT.Enable(); - bAvailable = sal_False; - bNext = sal_False; -} - -void StatementCommand::Translate() -{ - // Es wurde eine initale UniqueId mitgegeben. Dann nur die dopelten Shortcuts liefern - if( (nParams & PARAM_STR_1) && nLNr1_and_Pointer.nLNr1 ) - { - String aDouble; - Window *pWin = SearchTree( Str2Id( aString1 ) ,sal_False ); - if ( pWin ) - { - pWin = pWin->GetWindow( WINDOW_OVERLAP ); - aDouble = TranslateWin::MarkShortcutErrors( pWin, sal_True ); - } - pRet->GenReturn ( RET_Value, nMethodId, aDouble ); - return; - } - - if ( !GetTTSettings()->pTranslateWin ) - { - GetTTSettings()->pTranslateWin = new TranslateWin; - GetTTSettings()->bToTop = sal_True; - } - - GetTTSettings()->pTranslateWin->Show(); - if ( GetTTSettings()->bToTop ) - { - GetTTSettings()->pTranslateWin->ToTop(); - GetTTSettings()->bToTop = sal_False; - } - - GetTTSettings()->pTranslateWin->GetWindow( WINDOW_OVERLAP )->EnableInput( sal_True, sal_True ); - - if ( GetTTSettings()->pTranslateWin->IsTranslationAvailable() ) - { - String aTranslation; - Window* pTranslationWindow = GetTTSettings()->pTranslateWin->GetTranslationWindow(); - - DBG_ASSERT( pTranslationWindow, "Kein Translation Window" ); - - if ( WinPtrValid( pTranslationWindow ) ) - { - if ( pTranslationWindow->GetType() == WINDOW_BORDERWINDOW && pTranslationWindow->GetWindow( WINDOW_CLIENT ) ) - { - Window* pNew = pTranslationWindow->GetWindow( WINDOW_CLIENT ); - // Bei Dockingwindoes das kanze Geraffel von Docking Floating �berspringen - while ( IsDialog( pNew ) && !pNew->GetUniqueOrHelpId().getLength() && pNew->GetChildCount() == 1 ) - pNew = pNew->GetChild( 0 ); - pTranslationWindow = pNew; - } - - aTranslation = CUniString("0;"); - - aTranslation += Id2Str( pTranslationWindow->GetUniqueOrHelpId() ); - aTranslation += ';'; - - aTranslation += TypeString( pTranslationWindow->GetType() ); - aTranslation += ';'; - - Window* pParentDialog = pTranslationWindow; - while ( pParentDialog && !IsDialog( pParentDialog ) ) - { - pParentDialog = pParentDialog->GET_REAL_PARENT(); - } - - if ( pParentDialog ) - { - aTranslation += Id2Str(pParentDialog->GetUniqueOrHelpId()); - aTranslation += ';'; - aTranslation += TypeString( pParentDialog->GetType() ); - } - else - aTranslation.AppendAscii( "0;" ); // Zahl + leerer String - aTranslation += ';'; - - aTranslation += '\"'; - aTranslation += GetTTSettings()->pTranslateWin->GetOriginalText(); - aTranslation += '\"'; - - aTranslation += ';'; - - aTranslation += '\"'; - aTranslation += GetTTSettings()->pTranslateWin->GetTranslationText(); - aTranslation += '\"'; - - aTranslation += ';'; - - aTranslation += '\"'; - aTranslation += GetTTSettings()->pTranslateWin->GetComment(); - aTranslation += '\"'; - - // alle CRs quoten (NF) - aTranslation.SearchAndReplaceAll( CUniString("\n"), CUniString("\\n") ); - // alle TABSs quoten () - aTranslation.SearchAndReplaceAll( CUniString("\t"), CUniString("\\t") ); - - pRet->GenReturn ( RET_Value, nMethodId, aTranslation ); - GetTTSettings()->pTranslateWin->EnableTranslation(); - GetTTSettings()->bToTop = sal_True; - } - else - { - pRet->GenReturn ( RET_Value, nMethodId, String() ); - GetTTSettings()->pTranslateWin->EnableTranslation(); - ErrorBox err( GetTTSettings()->pTranslateWin, TTProperties::GetSvtResId( TT_NO_CONTROL )); - err.Execute(); - GetTTSettings()->bToTop = sal_True; - } - - } - else if ( GetTTSettings()->pTranslateWin->IsNextDialog() ) - { - pRet->GenReturn ( RET_Value, nMethodId, CUniString("1") ); - GetTTSettings()->pTranslateWin->ResetNextDialog(); - GetTTSettings()->pTranslateWin->LoseFocus(); - GetTTSettings()->bToTop = sal_True; - } - else - { - GetTTSettings()->pTranslateWin->EnableTranslation(); - pRet->GenReturn ( RET_Value, nMethodId, String() ); - } -} - -Window* StatementCommand::GetNextOverlap( Window* pBase ) -{ // Findet irgendwelche Overlap-Fenster, die schlie�bar aussehen - // Eventuell mu� noch die Auswahl verfeinert werden. - - if ( pBase->GetType() != WINDOW_BORDERWINDOW ) - pBase = pBase->GetWindow( WINDOW_OVERLAP ); - - Window *pControl = NULL; - if ( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) ) - { - pControl = GetNextOverlap( pBase->GetWindow( WINDOW_FIRSTOVERLAP ) ); - } - - if ( !pControl && pBase->GetWindow( WINDOW_NEXT ) ) - { - pControl = GetNextOverlap( pBase->GetWindow( WINDOW_NEXT ) ); - } - - if ( !pControl ) - { - Window *pTest = pBase->GetWindow( WINDOW_CLIENT ); - if ( IsAccessable (pTest) - && pTest->IsEnabled() - && pTest->IsVisible() - && ((pTest->GetStyle() & WB_CLOSEABLE ) || (pBase->GetStyle() & WB_CLOSEABLE )) ) - return pTest; - else - return NULL; - } - else - return pControl; -} - -Window* StatementCommand::GetNextRecoverWin() -{ - // �ber die TopLevelWindows der App iterieren - Window* pBase = Application::GetFirstTopLevelWindow(); - Window *pControl = NULL; - Window* pMyFirstDocFrame = NULL; - while ( pBase ) - { - // zuerst weitere Fenster auf dem Fenster suchen und schliessen - pControl = GetNextOverlap( pBase ); - if ( pControl && pControl->GetType() == WINDOW_HELPTEXTWINDOW ) - {} // skip it - else - { - if ( pControl && pControl->IsVisible() && !IsFirstDocFrame( pControl ) && !IsIMEWin( pControl ) ) - { - Window* pTB = pControl->GetChild( 0 ); - if ( pControl->GetChildCount() == 1 && pTB->GetType() == WINDOW_TOOLBOX ) - ; // do not act on floating toolboxes #i38796 - else - return pControl; - } - - // dann das Fenster selbst Schliessen - // erstes DocWin �berspringen - // Assumption that Doc Windows are Borderwindows and ButtonDialog and such are not - if ( pBase->IsVisible() && !IsFirstDocFrame( pBase ) && pBase->GetType() != WINDOW_BORDERWINDOW && !IsIMEWin( pBase ) ) - return pBase; - - if ( !pMyFirstDocFrame && IsFirstDocFrame( pBase ) ) - pMyFirstDocFrame = pBase; - } - - pBase = Application::GetNextTopLevelWindow( pBase ); - } - // close the FirstDocFrame last, It will not be closed, but the Document inside will be closed. - if ( IsDocWin( pMyFirstDocFrame ) ) - return pMyFirstDocFrame; - - return NULL; -} - -sal_Bool StatementCommand::Execute() -{ - if ( IsError ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Skipping Command: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( "\n" ); - #endif - - Advance(); - delete this; - return sal_True; - } - - InitProfile(); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Executing Command: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( "\n" ); -#endif - - - - - -#if OSL_DEBUG_LEVEL > 1 -#define REPORT_WIN_CLOSED(pControl, aInfo) \ - _REPORT_WIN_CLOSED(pControl, aInfo) \ - m_pDbgWin->AddText( aInfo.AppendAscii(" \"").Append( pControl->GetText() ).AppendAscii("\" geschlossen, RType = ").Append( TypeString(pControl->GetType()) ).AppendAscii(", UId = ").Append( UIdString( pControl->GetUniqueOrHelpId() ) ) ); -#else -#define REPORT_WIN_CLOSED(pControl, aInfo) _REPORT_WIN_CLOSED(pControl, aInfo) -#endif - -#define REPORT_WIN_CLOSEDc(pControl, aInfo ) \ - REPORT_WIN_CLOSED(pControl, CUniString(aInfo) ) - -#define _REPORT_WIN_CLOSED(pControl, aInfo) \ - if ( aString1.Len() ) \ - aString1 += '\n'; \ - aString1 += aInfo; \ - aString1.AppendAscii(" \""); \ - aString1 += pControl->GetText(); \ - aString1.AppendAscii("\" geschlossen, RType = ");\ - aString1 += TypeString(pControl->GetType()); \ - aString1.AppendAscii(", UId = "); \ - aString1 += UIdString(pControl->GetUniqueOrHelpId()); - - - switch ( nMethodId ) - { - case RC_AppDelay: - if ( !bBool1 ) - { - nLNr1_and_Pointer.nLNr1 = Time().GetTime() + nNr1/10; - bBool1 = sal_True; - } - if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit - return sal_False; - break; - case RC_DisplayHid: - if ( DisplayHID() ) - return sal_False; - break; - case RC_ResetApplication: - { - if ( !bBool1 ) - { - nRetryCount = 150; // das sollte reichen. - bBool1 = sal_True; // Nur beim ersten mal! - nNr1 = 1; // Welcher Button ist dran? - nLNr1_and_Pointer.pWindow = 0; // Speichern des AppWin - aString1 = UniString(); // Liste der geschlossenen Fenster - - // So da� nacher auch wieder alles auf Default steht - nUseBindings = 0; - bCatchGPF = sal_True; - bUsePostEvents = sal_True; - - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - } - if ( !nRetryCount ) - ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_COMPLEX ) ); - - Window *pControl = GetNextRecoverWin(); - - if ( pControl ) - { - bBool2 = sal_False; // flag for wait when all windows are closed - pControl->GrabFocus(); - - if ( pControl->GetType() != WINDOW_DOCKINGWINDOW - && pControl->GetType() != WINDOW_FLOATINGWINDOW - && pControl->GetType() != WINDOW_MODELESSDIALOG - && pControl->GetType() != WINDOW_WORKWINDOW - && pControl->GetType() != WINDOW_TOOLBOX - && pControl->GetType() != WINDOW_BORDERWINDOW - && nRetryCount-- ) - { - short nRT = ImpGetRType( pControl ); - - if ( nRT == C_TabControl && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - { // Bei Tabcontrol den zugeh�rigen Tabdialog nehmen - pControl = pControl->GET_REAL_PARENT(); - nRT = ImpGetRType( pControl ); - } - - switch( nRT ) - { - case C_ModalDlg: - case C_Dialog: - case C_TabDlg: - REPORT_WIN_CLOSEDc(pControl, "Dialog"); - SET_WINP_CLOSING(pControl); - ((SystemWindow*)pControl)->Close(); - break; - case C_WorkWin: - break; - case C_MessBox: - case C_InfoBox: - case C_WarningBox: - case C_ErrorBox: - case C_QueryBox: - case C_ButtonDialog: - { - ButtonDialog* pBD = (ButtonDialog*)pControl; - // nNr1 >= 10 bedeutet (Custom)-Buttons durchgehen - if ( nNr1 >= 10+pBD->GetButtonCount() ) nNr1 = 1; - switch( nNr1 ) - { - case 5: - if ( pBD->GetPushButton( BUTTONID_OK ) ) - { - REPORT_WIN_CLOSEDc(pControl, "Message Box (OK)"); - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_OK); - } - nNr1 = 10; // Nochmal alle Buttons der Reihe nach - break; - case 4: - if ( pBD->GetPushButton( BUTTONID_CANCEL ) ) - { - REPORT_WIN_CLOSEDc(pControl, "Message Box (Cancel)"); - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_CANCEL); - } - nNr1++; - break; - case 3: - if ( pBD->GetPushButton( BUTTONID_YES ) ) - { - REPORT_WIN_CLOSEDc(pControl, "Message Box (Yes)"); - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_YES); - } - nNr1++; - break; - case 2: - case 1: - if ( pBD->GetPushButton( BUTTONID_NO ) ) - { - REPORT_WIN_CLOSEDc(pControl, "Message Box (No)"); - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_NO); - } - nNr1++; - break; - default: - { - sal_uInt16 nID = pBD->GetButtonId( nNr1-10 ); - if ( nID != BUTTONID_HELP ) - { - REPORT_WIN_CLOSED(pControl, CUniString("Message Box (").Append( UniString::CreateFromInt32(nID) ).AppendAscii(")")); - SET_WINP_CLOSING(pControl); - pBD->EndDialog(nID); - } - nNr1++; - } - } - break; - } - default: - OSL_FAIL( "Unknown Windowtype" ); - REPORT_WIN_CLOSEDc(pControl, "Unknown Windowtype"); - ReportError( GEN_RES_STR0( S_RESETAPPLICATION_FAILED_UNKNOWN ), pControl->GetType() ); - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( " Unbekannter Objekttyp aus UId" ); - #endif - break; - } - return sal_False; - } - else - { - if ( (pControl->GetType() == WINDOW_DOCKINGWINDOW || pControl->GetType() == WINDOW_TOOLBOX) && nRetryCount-- ) - { - if ( (((DockingWindow*)pControl)->GetStyle() | ((DockingWindow*)pControl)->GetFloatStyle()) & WB_CLOSEABLE ) - { - REPORT_WIN_CLOSED(pControl, TypeString(pControl->GetType())); - SET_WINP_CLOSING(pControl); - ((DockingWindow*)pControl)->Close(); - - // Eigentlich nur bei TaskWindows! Hoffen wir mal, da� keine anderen DockingWindows dazwischen hauen. - if ( nLNr1_and_Pointer.pWindow != pControl ) - nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en - nLNr1_and_Pointer.pWindow = pControl; - - return sal_False; - } - } - if ( nRetryCount-- - && ( (pControl->GetType() == WINDOW_FLOATINGWINDOW) - || (pControl->GetType() == WINDOW_MODELESSDIALOG) - || (pControl->GetType() == WINDOW_WORKWINDOW) - || (pControl->GetType() == WINDOW_BORDERWINDOW) ) ) - { - // Special handling for last Document; do not close the Frame, only the Document - if ( GetDocWinCount() == 1 && IsDocFrame( pControl ) ) - { - if ( IsDocWin( pControl ) ) - { - if ( GetDocFrameMenuBar( pControl ) ) - { - MenuBar* pMenu = GetDocFrameMenuBar( pControl ); - if ( pMenu->HasCloser() ) - { - REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType())); - SET_WINP_CLOSING(pControl); - - pMenu->GetCloserHdl().Call( pMenu ); - - // nur bei TaskWindows! - if ( nLNr1_and_Pointer.pWindow != pControl ) - nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en - nLNr1_and_Pointer.pWindow = pControl; - - return sal_False; - } - } - } - } - else - { - REPORT_WIN_CLOSED( pControl, TypeString(pControl->GetType())); - SET_WINP_CLOSING(pControl); - ((SystemWindow*)pControl)->Close(); - - // Eigentlich nur bei TaskWindows! - if ( nLNr1_and_Pointer.pWindow != pControl ) - nNr1 = 1; // Zum durchprobieren der Buttons beim Schlie�en - nLNr1_and_Pointer.pWindow = pControl; - - return sal_False; - } - } - } - } - // wait for some time if more windows show up - // E.g.: Floating toolbars on a Task which was hidden by another Task before - if ( !bBool2 ) - { - nLNr1_and_Pointer.nLNr1 = Time().GetTime() + 100; // 100 = 1 Second - bBool2 = sal_True; - } - if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit - return sal_False; - else - pRet->GenReturn ( RET_Value, nMethodId, aString1); - } - break; - case RC_WaitSlot: - { - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1000; // defaults to 1000 = 1 Sec. - if ( !bBool1 ) - { - nLNr1_and_Pointer.nLNr1 = Time().GetTime() + nNr1/10; - bBool1 = sal_True; - } - - if ( !bIsSlotInExecute ) - pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSFinished) ); - else - { - if ( Time().GetTime() < sal_Int32(nLNr1_and_Pointer.nLNr1) ) // Aktuelle Zeit kleiner Endzeit - return sal_False; - pRet->GenReturn ( RET_Value, nMethodId, comm_UINT16(CONST_WSTimeout) ); - } - } - break; - } - - - Advance(); - - - switch ( nMethodId ) - { - case RC_AppDelay: // Diese Befehle werden anderswo behandelt - case RC_DisplayHid: - case RC_ResetApplication: - case RC_WaitSlot: - - case RC_AppAbort: // Sofortiges L�schen aller Befehle - break; - case RC_Assert: - { - ByteString aAssertion( "Diese Assertion wurde vom Testtool per Befehl ausgel�st" ); - aAssertion = ByteString( String( aAssertion, RTL_TEXTENCODING_MS_1252 ), RTL_TEXTENCODING_UTF8 ); - DBG_ASSERT( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); - DBG_ASSERT( aString1.Len(), aAssertion.GetBuffer() ); - OSL_ENSURE( !aString1.Len(), ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); - OSL_ENSURE( aString1.Len(), aAssertion.GetBuffer() ); - } - break; - case RC_CaptureAssertions: -#ifdef DBG_UTIL - if( !(nParams & PARAM_BOOL_1) || bBool1 ) - { - DBG_INSTOUTERROR( DBG_OUT_TESTTOOL ); - osl_setDebugMessageFunc( osl_TestToolDebugPrint ); - } - else - { - DBG_INSTOUTERROR( DBG_OUT_MSGBOX ); - osl_setDebugMessageFunc( pOriginal_osl_DebugMessageFunc ); - } -#endif - break; - case RC_Translate: - Translate(); - break; - case RC_ApplicationBusy: - { - sal_Bool bWait = sal_False; - ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) ); - pRet->GenReturn ( RET_Value, nMethodId, bWait ); - break; - } - case RC_GetClipboard: - { - ::rtl::OUString aTemp; - ::svt::OStringTransfer::PasteString( aTemp, GetFirstDocFrame() ); - pRet->GenReturn ( RET_Value, nMethodId, String( aTemp ) ); - } - break; - case RC_SetClipboard: - ::svt::OStringTransfer::CopyString(aString1,GetFirstDocFrame()); - break; - case RC_WinTree: - pRet->GenReturn ( RET_Value, nMethodId, Tree( NULL, 0)); - break; - #if OSL_DEBUG_LEVEL > 1 - case RC_NoDebug: - m_pDbgWin->bQuiet = sal_True; - m_pDbgWin->Hide(); - m_pDbgWin->Clear(); - break; - case RC_Debug: - m_pDbgWin->bQuiet = sal_False; - m_pDbgWin->Show(); - break; - #endif - case RC_GPF: - ((TabControl*)NULL)->SetCurPageId( 12345 ); - break; - case RC_GetNextCloseWindow: - { - Window *pWin = GetActive( WINDOW_BASE ); // WINDOW_ANYTYPE - if ( !pWin ) - ReportError( GEN_RES_STR0( S_NO_ACTIVE_WINDOW ) ); - else if ( !IsDialog(pWin) ) - ReportError( GEN_RES_STR0( S_NO_DIALOG_IN_GETACTIVE ) ); - else - { - pRet->GenReturn( RET_Value, nMethodId, Id2Str(pWin->GetUniqueOrHelpId()) ); - } - } - break; - case RC_UseBindings: - if( !(nParams & PARAM_BOOL_1) || bBool1 ) - nUseBindings = SFX_USE_BINDINGS; - else - nUseBindings = 0; - break; - case RC_Profile: - // Bei folgenden Parametern passiert folgendes: - // ein boolean=false Alles Profiling stoppen (Ergebnisse liefern) - // ein boolean=true, 1-4 ints Einteilung der Zeiten in K�stchen - // kein! boolean keine ints loggen jeden Befehls - // kein! boolean 1 int loggen alle int Millisekunden - // ein String wird in das Logfile �bernommen(sonst passiert nichts) - if( !(nParams & PARAM_BOOL_1) || bBool1 ) - { - if ( !pProfiler ) - { - pProfiler = new TTProfiler; - InitProfile(); - } - - if( !(nParams & PARAM_BOOL_1) && (nParams & PARAM_UINT16_1) ) - { // Autoprofiling: Profile nNr - if ( pProfiler->IsProfilingPerCommand() ) - { - pProfiler->StopProfilingPerCommand(); - } - pProfiler->StartAutoProfiling( nNr1 ); - - // Der Header ist abh�ngig vom Modus - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() ); - } - else if ( nParams & PARAM_UINT16_1 ) - { // Partitioning initialisieren: Profile true [,nNr][,nNr][,nNr][,nNr] - comm_UINT32 nAnzahl=0; - if ( nParams & PARAM_UINT16_1 ) { nAnzahl++; }; - if ( nParams & PARAM_UINT16_2 ) { nAnzahl++; }; - if ( nParams & PARAM_UINT16_3 ) { nAnzahl++; }; - if ( nParams & PARAM_UINT16_4 ) { nAnzahl++; }; - - // Hier werden die Parameter ans Testtool zur�ck �bertragen. - // Das ist zwar etwas eigenartig, aber ansonsten m�sste man im Testtool - // die einfache Struktur der Remotebefehle aufbrechen. - pRet->GenReturn( RET_ProfileInfo, S_ProfileReset, nAnzahl ); - - // Und die einzelnen Grenzen - if ( nParams & PARAM_UINT16_1 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder1, (comm_UINT32)nNr1 ); }; - if ( nParams & PARAM_UINT16_2 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder2, (comm_UINT32)nNr2 ); }; - if ( nParams & PARAM_UINT16_3 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder3, (comm_UINT32)nNr3 ); }; - if ( nParams & PARAM_UINT16_4 ) { pRet->GenReturn( RET_ProfileInfo, S_ProfileBorder4, (comm_UINT32)nNr4 ); }; - - pProfiler->StartPartitioning(); - } - else if( nParams == PARAM_STR_1 ) // Genau ein String! - { // Nur einen String ins Profiling aufnehmen - aString1 += '\n'; - pRet->GenReturn( RET_ProfileInfo, 0, aString1 ); - } - else - { // Normales Profiling je Kommando: profile - if ( pProfiler->IsAutoProfiling() ) - { - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() ); - pProfiler->StopAutoProfiling(); - } - pProfiler->StartProfilingPerCommand(); - - // Der Header ist abh�ngig vom Modus - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetProfileHeader() ); - } - } - else // Profiling wieder ausschalten: Profile false - if ( pProfiler ) - { - if ( pProfiler->IsProfilingPerCommand() ) - pProfiler->StopProfilingPerCommand(); - - if ( pProfiler->IsAutoProfiling() ) - { - pRet->GenReturn( RET_ProfileInfo, 0, pProfiler->GetAutoProfiling() ); - pProfiler->StopAutoProfiling(); - } - - if ( pProfiler->IsPartitioning() ) - { - pRet->GenReturn( RET_ProfileInfo, S_ProfileDump, (comm_UINT32)0 ); - pProfiler->StopPartitioning(); - } - - delete pProfiler; - pProfiler = NULL; - } - break; - case RC_MenuGetItemCount: - case RC_MenuGetItemId: - case RC_MenuGetItemPos: - case RC_MenuIsSeperator: - case RC_MenuIsItemChecked: - case RC_MenuIsItemEnabled: - case RC_MenuGetItemText: - case RC_MenuGetItemCommand: - case RC_MenuHasSubMenu: - case RC_MenuSelect: - { - PopupMenu *pPopup = NULL; - MenuBar *pMenuBar = NULL; - Menu *pMenu; - - sal_uInt16 nErr = GetCurrentMenues( pPopup, pMenuBar, pMenu ); - - if ( !pMenu ) - { - if ( nErr == 1 ) - ReportError( GEN_RES_STR0( S_NO_POPUP ) ); - else - ReportError( GEN_RES_STR0( S_NO_SUBMENU ) ); - break; - } - - sal_uInt16 nItemCount = 0; - switch ( nMethodId ) - { - case RC_MenuGetItemCount: - case RC_MenuGetItemId: - case RC_MenuIsSeperator: - { - nItemCount = pMenu->GetItemCount(); - if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES ) - { // jep, we have to adjust the count - sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top - for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() ; i++ ) - { - if ( !pMenu->IsItemEnabled( pMenu->GetItemId( i ) ) ) - nItemCount--; - else - { - if ( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator ) - nItemCount--; - bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR; - } - } - if ( bLastWasSeperator ) // Separator at bottom - nItemCount--; - } - } - break; - } - - // for certain methods calculate the physical index (reinserting the hidden entries) - sal_uInt16 nPhysicalIndex = 0; - switch ( nMethodId ) - { - case RC_MenuGetItemId: - case RC_MenuIsSeperator: - { - nPhysicalIndex = nNr1; - if ( pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES ) - { // jep, we have to adjust the position - sal_Bool bLastWasSeperator = sal_True; // sal_True for Separator at the top - sal_uInt16 nVisibleCount = 0; - for ( sal_uInt16 i = 0 ; i < pMenu->GetItemCount() && nVisibleCount < nNr1 ; i++ ) - { - if ( pMenu->IsItemEnabled( pMenu->GetItemId( i ) ) - && !( pMenu->GetItemType( i ) == MENUITEM_SEPARATOR && bLastWasSeperator ) ) - { - nVisibleCount++; - bLastWasSeperator = pMenu->GetItemType( i ) == MENUITEM_SEPARATOR; - } - else - nPhysicalIndex++; - } - DBG_ASSERT( nVisibleCount == nNr1, "Adaption of Index failed: nVisibleCount != nNr1" ); - } - } - break; - } - - - - switch ( nMethodId ) - { - case RC_MenuGetItemCount: - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)nItemCount ); - } - break; - case RC_MenuGetItemId: - { - if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)pMenu->GetItemId(nPhysicalIndex-1) ); - } - break; - case RC_MenuGetItemPos: - { - sal_uInt16 nLogicalPos = pMenu->GetItemPos(nNr1); - if ( MENU_ITEM_NOTFOUND != nLogicalPos && pMenu->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES ) - { // jep, we have to adjust the position - if ( !pMenu->IsItemEnabled( nNr1 ) ) - nLogicalPos = MENU_ITEM_NOTFOUND; - else - { - sal_Bool bLastWasSeperator = sal_False; - for ( int i = nLogicalPos ; i >= 0 ; i-- ) - { - if ( !pMenu->IsItemEnabled( pMenu->GetItemId( sal::static_int_cast< sal_uInt16 >(i) ) ) || - ( pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR && bLastWasSeperator ) ) - nLogicalPos--; - bLastWasSeperator = pMenu->GetItemType( sal::static_int_cast< sal_uInt16 >(i) ) == MENUITEM_SEPARATOR; - } - } - } - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)(nLogicalPos+1) ); - } - break; - case RC_MenuIsSeperator: - { - if ( ValueOK( rtl::OString(), RcString( nMethodId ),nNr1,nItemCount) ) - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)(pMenu->GetItemType(nPhysicalIndex-1) == MENUITEM_SEPARATOR) ); - } - break; - case RC_MenuIsItemChecked: - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemChecked(nNr1) ); - } - break; - case RC_MenuIsItemEnabled: - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)pMenu->IsItemEnabled(nNr1) ); - } - break; - case RC_MenuGetItemText: - { - pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemText(nNr1) ); - } - break; - case RC_MenuGetItemCommand: - { - pRet->GenReturn ( RET_Value, nMethodId, (String)pMenu->GetItemCommand(nNr1) ); - } - break; - case RC_MenuHasSubMenu: - { - pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)(pMenu->GetPopupMenu(nNr1) != NULL) ); - } - break; - case RC_MenuSelect: - { - if ( pMenu->GetPopupMenu(nNr1) ) - { - if ( !aSubMenuId1 ) - aSubMenuId1 = nNr1; - else if ( !aSubMenuId2 ) - aSubMenuId2 = nNr1; - else if ( !aSubMenuId3 ) - aSubMenuId3 = nNr1; - - if ( pPopup ) - pPopup->SelectEntry(nNr1); - else - pMenuBar->SelectEntry(nNr1); - } - else - { - if ( pPopup ) - { - pPopup->EndExecute(nNr1); - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - } - else - { - pMenuBar->SelectEntry(nNr1); - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - } - } - } - break; - } - } - break; - case RC_SetControlType: - { - DirectLog( S_QAError, GEN_RES_STR0( S_DEPRECATED ) ); - } - break; - case RC_Kill: - case RC_RmDir: - case RC_MkDir: - case RC_FileCopy: - case RC_Name: - case RC_Dir: - case RC_FileLen: - case RC_FileDateTime: - { - long nErrorcode = FSYS_ERR_OK; - switch ( nMethodId ) - { - case RC_Kill: - { - DirEntry aFile( aString1 ); - nErrorcode = aFile.GetError(); - if ( FSYS_ERR_OK == nErrorcode && FileStat( aFile ).IsKind( FSYS_KIND_FILE ) ) - nErrorcode = aFile.Kill(); - else - nErrorcode = FSYS_ERR_NOTAFILE; - } - break; - case RC_RmDir: - { - DirEntry aDir( aString1 ); - nErrorcode = aDir.GetError(); - if ( FSYS_ERR_OK == nErrorcode && FileStat( aDir ).IsKind( FSYS_KIND_DIR ) ) - nErrorcode = aDir.Kill(); - else - nErrorcode = FSYS_ERR_NOTADIRECTORY; - } - break; - case RC_MkDir: - { - DirEntry aDir( aString1 ); - nErrorcode = aDir.GetError(); - if ( !nErrorcode && !aDir.MakeDir() ) - nErrorcode = FSYS_ERR_UNKNOWN; - } - break; - case RC_FileCopy: - { - nErrorcode = DirEntry( aString1 ).CopyTo( DirEntry( aString2 ), FSYS_ACTION_COPYFILE ); - } - break; - case RC_Name: - { - nErrorcode = DirEntry( aString1 ).MoveTo( DirEntry( aString2 ) ); - } - break; - case RC_Dir: - { - - String aPath; - sal_uInt16 nDirFlags = 0; -// from basic/source/inc/runtime.hxx -#define Sb_ATTR_NORMAL 0x0000 -#define Sb_ATTR_HIDDEN 0x0002 -#define Sb_ATTR_SYSTEM 0x0004 -#define Sb_ATTR_VOLUME 0x0008 -#define Sb_ATTR_DIRECTORY 0x0010 -#define Sb_ATTR_ARCHIVE 0x0020 - // copied from Basic and adapted basic/source/runtime/methods.cxx Revision 1.54 - if ( (nParams & PARAM_STR_1) ) - { - delete pDir; - pDir = NULL; // wg. Sonderbehandlung Sb_ATTR_VOLUME - DirEntry aEntry( aString1 ); - FileStat aStat( aEntry ); - if(!aStat.GetError() && (aStat.GetKind() & FSYS_KIND_FILE)) - { - // OK, only a filename - // cut off path (VB4) - aPath = aEntry.GetName(); - } - else - { - sal_uInt16 nFlags = 0; - if ( (nParams & PARAM_UINT16_1) ) - nDirFlags = nFlags = nNr1; - else - nDirFlags = nFlags = Sb_ATTR_HIDDEN | Sb_ATTR_SYSTEM | Sb_ATTR_DIRECTORY; - - // Nur diese Bitmaske ist unter Windows erlaubt - // Sb_ATTR_VOLUME wird getrennt gehandelt - if( nDirFlags & Sb_ATTR_VOLUME ) - aPath = aEntry.GetVolume(); - else - { - // Die richtige Auswahl treffen - sal_uInt16 nMode = FSYS_KIND_FILE; - if( nFlags & Sb_ATTR_DIRECTORY ) - nMode |= FSYS_KIND_DIR; - if( nFlags == Sb_ATTR_DIRECTORY ) - nMode = FSYS_KIND_DIR; - pDir = new Dir( aEntry, (DirEntryKind) nMode ); - nErrorcode = pDir->GetError(); - nDirPos = 0; - } - } - } - - if( pDir ) - { - for( ;; ) - { - if( nDirPos >= pDir->Count() ) - { - delete pDir; - pDir = NULL; - aPath.Erase(); - break; - } - DirEntry aNextEntry=(*(pDir))[nDirPos++]; - aPath = aNextEntry.GetName(); - break; - } - } - if ( !nErrorcode ) - { - pRet->GenReturn ( RET_Value, nMethodId, aPath ); - } - - } - break; - case RC_FileLen: - { - DirEntry aFile( aString1 ); - nErrorcode = aFile.GetError(); - if ( FSYS_ERR_OK == nErrorcode ) - { - FileStat aFS( aFile ); - pRet->GenReturn ( RET_Value, nMethodId, static_cast(aFS.GetSize()) ); //GetSize() sal_uLong != comm_UINT32 on 64bit - nErrorcode = aFS.GetError(); - } - } - break; - case RC_FileDateTime: - { - DirEntry aFile( aString1 ); - nErrorcode = aFile.GetError(); - if ( FSYS_ERR_OK == nErrorcode ) - { - FileStat aStat( aFile ); - Time aTime( aStat.TimeModified() ); - Date aDate( aStat.DateModified() ); - nErrorcode = aStat.GetError(); - - double fSerial = (double)( aDate - Date(30,12,1899) ); - long nSeconds = aTime.GetHour(); - nSeconds *= 3600; - nSeconds += aTime.GetMin() * 60; - nSeconds += aTime.GetSec(); - double nDays = ((double)nSeconds) / (double)(24.0*3600.0); - fSerial += nDays; - - SbxValueRef xValue = new SbxValue( SbxDATE ); - xValue->PutDate( fSerial ); - - pRet->GenReturn ( RET_Value, nMethodId, *xValue ); - } - } - break; - } - switch ( nErrorcode ) - { - case FSYS_ERR_OK: - break; - case FSYS_ERR_MISPLACEDCHAR: - { - ReportError( CUniString("MISPLACEDCHAR") ); - } - break; - case FSYS_ERR_INVALIDCHAR: - { - ReportError( CUniString("INVALIDCHAR") ); - } - break; - case FSYS_ERR_NOTEXISTS: - { - ReportError( CUniString("NOTEXISTS") ); - } - break; - case FSYS_ERR_ALREADYEXISTS: - { - ReportError( CUniString("ALREADYEXISTS") ); - } - break; - case FSYS_ERR_NOTADIRECTORY: - { - ReportError( CUniString("NOTADIRECTORY") ); - } - break; - case FSYS_ERR_NOTAFILE: - { - ReportError( CUniString("NOTAFILE") ); - } - break; - case FSYS_ERR_INVALIDDEVICE: - { - ReportError( CUniString("INVALIDDEVICE") ); - } - break; - case FSYS_ERR_ACCESSDENIED: - { - ReportError( CUniString("ACCESSDENIED") ); - } - break; - case FSYS_ERR_LOCKVIOLATION: - { - ReportError( CUniString("LOCKVIOLATION") ); - } - break; - case FSYS_ERR_VOLUMEFULL: - { - ReportError( CUniString("VOLUMEFULL") ); - } - break; - case FSYS_ERR_ISWILDCARD: - { - ReportError( CUniString("ISWILDCARD") ); - } - break; - case FSYS_ERR_NOTSUPPORTED: - { - ReportError( CUniString("NOTSUPPORTED") ); - } - break; - case FSYS_ERR_UNKNOWN: - { - ReportError( CUniString("UNKNOWN") ); - } - break; - default: - { - ReportError( CUniString("Not an FSYS Error") ); - } - } - - } - break; - case RC_TypeKeysDelay: - { - if( (nParams & PARAM_BOOL_1) ) - { - bDoTypeKeysDelay = bBool1; - } - else if( nParams & PARAM_UINT16_1 ) - { - nMinTypeKeysDelay = nNr1; - if( nParams & PARAM_UINT16_2 ) - nMaxTypeKeysDelay = nNr2; - else - nMaxTypeKeysDelay = nMinTypeKeysDelay; - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_GetMouseStyle: - { - Pointer aPointer; - Window *pActualWin = GetMouseWin(); - if ( pActualWin ) - aPointer = pActualWin->GetPointer(); - else - { - ReportError( GEN_RES_STR1( S_POINTER_OUTSIDE_APPWIN, RcString( nMethodId ) ) ); - aPointer = Pointer( POINTER_NULL ); - } - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT32)aPointer.GetStyle() ); - } - break; - case RC_UnpackStorage: - { - if( (nParams & PARAM_STR_1) ) - { - String aFileName( aString1 ); - DirEntry aDestPath; - if( (nParams & PARAM_STR_2) ) - aDestPath = DirEntry( aString2 ); - else - { - aDestPath = DirEntry( aFileName ); - aDestPath.SetExtension( CUniString( "plaintext" ) ); - } - -#if OSL_DEBUG_LEVEL > 1 - sal_uInt16 nEntries = Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count(); - (void) nEntries; /* avoid warning about unused parameter */ -#endif - // The Count is only larger than 2 is the path is a directory which is not empty - // the Count of 2 results from the "." and ".." directory - if ( Dir( aDestPath, FSYS_KIND_FILE | FSYS_KIND_DIR ).Count() > 2 ) - DirectLog( S_QAError, GEN_RES_STR1( S_DIRECTORY_NOT_EMPTY, aDestPath.GetFull() ) ); - - SotStorageRef xStorage = new SotStorage( aFileName, STREAM_STD_READ ); - if ( xStorage->GetError() ) - ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aFileName, aDestPath.GetFull()) ); - else - UnpackStorage( xStorage, aDestPath ); - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_CloseSysDialog: - case RC_ExistsSysDialog: - { - if( (nParams & PARAM_UINT16_1) ) - { - Reference < ::com::sun::star::util::XCancellable > xPicker; - switch( nNr1 ) - { - case CONST_FilePicker: - { - xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFilePicker(), UNO_QUERY ) ); - } - break; - case CONST_FolderPicker: - { - xPicker.set( Reference < ::com::sun::star::util::XCancellable >( svt::GetTopMostFolderPicker(), UNO_QUERY ) ); - } - break; - default: - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - switch( nMethodId ) - { - case RC_CloseSysDialog: - { - if ( xPicker.is() ) - xPicker->cancel(); - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_ExistsSysDialog: - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_BOOL)xPicker.is() ); - } - break; - default: - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_SAXCheckWellformed: - case RC_SAXReadFile: - - case RC_SAXGetNodeType: - case RC_SAXGetAttributeCount: - case RC_SAXGetAttributeName: - case RC_SAXGetAttributeValue: - case RC_SAXGetChildCount: - case RC_SAXGetElementName: - case RC_SAXGetChars: - - case RC_SAXSeekElement: - case RC_SAXHasElement: - case RC_SAXGetElementPath: - - case RC_SAXRelease: - { - HandleSAXParser(); - } - break; - case RC_RecordMacro: - { - if ( ! (nParams & PARAM_BOOL_1) ) - bBool1 = sal_True; - - MacroRecorder::GetMacroRecorder()->SetActionRecord( bBool1 ); - } - break; - case RC_GetDocumentCount : - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT16)GetDocWinCount() ); - } - break; - case RC_ActivateDocument : - { - if( nParams & PARAM_UINT16_1 ) - { - if ( ValueOK( rtl::OString(), RcString( nMethodId ), nNr1, GetDocWinCount() ) ) - { - Window* pWin = GetDocWin( nNr1-1 ); - if ( pWin ) - { - pWin->ToTop(); - pWin->GrabFocus(); - } - } - } - else - ReportError( GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - } - break; - case RC_GetSystemLanguage : - { - pRet->GenReturn ( RET_Value, nMethodId, (comm_UINT16)Application::GetSettings().GetLanguage() ); - } - break; - case RC_CatchGPF : - { - if( (nParams & PARAM_BOOL_1) ) - bCatchGPF = bBool1; - else - bCatchGPF = sal_True; - } - break; - case RC_IsProduct : - { - sal_Bool bIsProduct; - #ifdef DBG_UTIL - bIsProduct = sal_False; - #else - bIsProduct = sal_True; - #endif - pRet->GenReturn ( RET_Value, nMethodId, (sal_Bool)bIsProduct ); - } - break; - case RC_UsePostEvents : - { - if( (nParams & PARAM_BOOL_1) ) - bUsePostEvents = bBool1; - else - bUsePostEvents = sal_True; - } - break; - default: - ReportError( GEN_RES_STR1( S_UNKNOWN_COMMAND, RcString( nMethodId ) ) ); - } - SendProfile( RcString(nMethodId) ); - delete this; - return sal_True; -} - - -sal_Bool StatementCommand::UnpackStorage( SotStorageRef xStorage, DirEntry &aBaseDir ) -{ - SvStorageInfoList aList; - xStorage->FillInfoList( &aList ); - - for( size_t i = 0; i < aList.size(); i++ ) - { - SvStorageInfo& rInfo = aList[ i ]; - String aName = rInfo.GetName(); - DirEntry aPath ( aBaseDir ); - aPath += DirEntry( aName ); - sal_Bool bIsStorage = xStorage->IsStorage( aName ); - if ( bIsStorage ) - { - SotStorageRef xSubStorage = xStorage->OpenSotStorage( aName, STREAM_STD_READ ); - if ( xSubStorage->GetError() ) - { - ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) ); - return sal_False; - } - UnpackStorage( xSubStorage, aPath ); - } - else - { - if ( !aPath.MakeDir( sal_True ) ) - { - ReportError( GEN_RES_STR1(S_CANNOT_CREATE_DIRECTORY, aPath.GetFull()) ); - return sal_False; - } - SotStorageStreamRef xStream = xStorage->OpenSotStream( aName, STREAM_STD_READ ); - SvFileStream aDestination( aPath.GetFull(), STREAM_STD_READWRITE | STREAM_TRUNC ); - (*xStream) >> aDestination; - if ( aDestination.GetError() != ERRCODE_NONE ) - { - ReportError( GEN_RES_STR2(S_UNPACKING_STORAGE_FAILED, aName, aPath.GetFull()) ); - return sal_False; - } - aDestination.Close(); - } - } - return sal_True; -} - - -StatementControl::StatementControl( SCmdStream *pCmdIn, sal_uInt16 nControlIdType ) -: StatementList() -, nNr1( 0 ) -, nNr2( 0 ) -, nNr3( 0 ) -, nNr4( 0 ) -, nLNr1( 0 ) -, aString1() -, aString2() -, bBool1(sal_False) -, bBool2(sal_False) -{ - QueStatement( NULL ); - //HELPID BACKWARD (SIControl is no longer needed) - if ( nControlIdType == SIControl ) - { - comm_UINT32 nId; - pCmdIn->Read( nId ); - aUId = rtl::OString( nId ); - if ( nId == 0 ) - aUId = UID_ACTIVE; - else - ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) ); - } - else if ( nControlIdType == SIStringControl ) - { - String aId; - pCmdIn->Read( aId ); - aUId = Str2Id( aId ); - } - else - { - OSL_FAIL( "Wrong ControlType" ); - } - - pCmdIn->Read( nMethodId ); - pCmdIn->Read( nParams ); - - if( nParams & PARAM_UINT16_1 ) pCmdIn->Read( nNr1 ); - if( nParams & PARAM_UINT16_2 ) pCmdIn->Read( nNr2 ); - if( nParams & PARAM_UINT16_3 ) pCmdIn->Read( nNr3 ); - if( nParams & PARAM_UINT16_4 ) pCmdIn->Read( nNr4 ); - if( nParams & PARAM_UINT32_1 ) pCmdIn->Read( nLNr1 ); - if( nParams & PARAM_STR_1 ) pCmdIn->Read( aString1 ); - if( nParams & PARAM_STR_2 ) pCmdIn->Read( aString2 ); - if( nParams & PARAM_BOOL_1 ) pCmdIn->Read( bBool1 ); - if( nParams & PARAM_BOOL_2 ) pCmdIn->Read( bBool2 ); - -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Reading Control: UId: " ); - m_pDbgWin->AddText( Id2Str( aUId ) ); - m_pDbgWin->AddText( " Methode: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( " Params:" ); - if( nParams & PARAM_UINT16_1 ) {m_pDbgWin->AddText( " n1:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr1 ) );} - if( nParams & PARAM_UINT16_2 ) {m_pDbgWin->AddText( " n2:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr2 ) );} - if( nParams & PARAM_UINT16_3 ) {m_pDbgWin->AddText( " n3:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr3 ) );} - if( nParams & PARAM_UINT16_4 ) {m_pDbgWin->AddText( " n4:" );m_pDbgWin->AddText( String::CreateFromInt32( nNr4 ) );} - if( nParams & PARAM_UINT32_1 ) {m_pDbgWin->AddText( " nl1:" );m_pDbgWin->AddText( String::CreateFromInt64( nLNr1 ) );} - if( nParams & PARAM_STR_1 ) {m_pDbgWin->AddText( " s1:" );m_pDbgWin->AddText( aString1 );} - if( nParams & PARAM_STR_2 ) {m_pDbgWin->AddText( " s2:" );m_pDbgWin->AddText( aString2 );} - m_pDbgWin->AddText( "\n" ); -#endif -} - -sal_Bool IsDialog(Window *pWin) -{ // Alles was von SystemWindow abgeleitet ist - if ( !pWin ) - return sal_False; - - switch (pWin->GetType()) - { - case WINDOW_FLOATINGWINDOW: - case WINDOW_DOCKINGWINDOW: - case WINDOW_MODELESSDIALOG: - case WINDOW_DIALOG: - case WINDOW_MODALDIALOG: - case WINDOW_WORKWINDOW: - case WINDOW_TABDIALOG: - - case WINDOW_MESSBOX: - case WINDOW_INFOBOX: - case WINDOW_WARNINGBOX: - case WINDOW_ERRORBOX: - case WINDOW_QUERYBOX: - case WINDOW_BUTTONDIALOG: - case WINDOW_FILEDIALOG: - case WINDOW_PRINTDIALOG: - case WINDOW_PRINTERSETUPDIALOG: - -// ab hier nicht ansprechbar (da nicht implementiert) - case WINDOW_SYSWINDOW: - case WINDOW_SYSTEMDIALOG: - case WINDOW_COLORDIALOG: - case WINDOW_FONTDIALOG: - case WINDOW_PATHDIALOG: - - - return sal_True; - default: - return sal_False; - } -} - - -sal_Bool IsAccessable(Window *pWin) -{ - if ( pWin == NULL ) - return sal_False; - - return pWin->IsEnabled() && pWin->IsInputEnabled(); -} - - - -// neue Hilfsfunktion -static Window*ImpGetButton( Window *pBase, WinBits nMask, WinBits nWinBits ) -{ - sal_uInt16 n = pBase->GetChildCount(); - for( sal_uInt16 i = 0 ; i < n; i++ ) { - Window *pChild = pBase->GetChild(i); - if( pChild->GetType() == WINDOW_OKBUTTON - || pChild->GetType() == WINDOW_CANCELBUTTON - || pChild->GetType() == WINDOW_HELPBUTTON - || pChild->GetType() == WINDOW_PUSHBUTTON ) - if( !nMask || ( pChild->GetStyle() & nMask ) == nWinBits ) - return pChild; - } - return NULL; -} - -sal_Bool StatementControl::ControlOK( Window *pControl, const sal_Char* cBezeichnung ) -{ - if ( pControl && ( ( ( IsAccessable(pControl) || (nMethodId & M_WITH_RETURN) ) && - pControl->IsVisible() ) || - aUId.equals( UID_ACTIVE ) ) ) - return sal_True; - else - { - UniString aBezeichnung( cBezeichnung, RTL_TEXTENCODING_ASCII_US ); - if ( aBezeichnung.Len() > 0 ) - { - if (!pControl) - ReportError( aUId, GEN_RES_STR1( S_WIN_NOT_FOUND, aBezeichnung ) ); - else if ( !pControl->IsVisible() ) - ReportError( aUId, GEN_RES_STR1( S_WIN_INVISIBLE, aBezeichnung ) ); - else - ReportError( aUId, GEN_RES_STR1( S_WIN_DISABLED, aBezeichnung ) ); - } - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( aBezeichnung.AppendAscii(" NotFound or Disabled or Invisible") ); - #endif - - return sal_False; - } -} - - -sal_Bool StatementList::ValueOK( rtl::OString aId, String aBezeichnung, sal_uLong nValue, sal_uLong nMax ) -{ - - if ( nMax < nValue ) - { - if ( aBezeichnung.Len() > 0 ) - ReportError( aId, GEN_RES_STR3( S_NUMBER_TOO_BIG, aBezeichnung, UniString::CreateFromInt32( nValue ), UniString::CreateFromInt32( nMax ) ) ); - return sal_False; - } - if ( nValue < 1 ) - { - if ( aBezeichnung.Len() > 0 ) - ReportError( aId, GEN_RES_STR3c3( S_NUMBER_TOO_SMALL, aBezeichnung, UniString::CreateFromInt32( nValue ), "1" ) ); - return sal_False; - } - return sal_True; -} - -sal_uInt16 StatementList::GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu ) -{ - if ( WinPtrValid( pMenuWindow ) ) - pMenuBar = pMenuWindow->GetMenuBar(); - - if ( pMenuBar ) // use MenuBar as base - pMenu = pMenuBar; - else // use contextmenu as base - { - pMenu = PopupMenu::GetActivePopupMenu(); - pPopup = PopupMenu::GetActivePopupMenu(); - } - - if ( !pMenu ) - return 1; - - if ( aSubMenuId1 ) - { - pPopup = pMenu->GetPopupMenu( aSubMenuId1 ); - pMenu = pPopup; - } - - if ( pMenu && aSubMenuId2 ) - { - pPopup = pMenu->GetPopupMenu( aSubMenuId2 ); - pMenu = pPopup; - } - - if ( pMenu && aSubMenuId3 ) - { - pPopup = pMenu->GetPopupMenu( aSubMenuId3 ); - pMenu = pPopup; - } - - return 0; -} - -void StatementControl::AnimateMouse( Window *pControl, TTHotSpots aWohin ) -{ - Point aZiel; - - switch (aWohin) - { - case MitteLinks: - { - long nHeight = pControl->GetSizePixel().Height(); - aZiel.X() += 5; - aZiel.Y() += nHeight / 2; - } - break; - case Mitte: - { - Size aSize = pControl->GetOutputSizePixel(); - aZiel.Move( aSize.Width() / 2, aSize.Height() / 2 ); - } - break; - case MitteOben: - { - long nWidth = pControl->GetSizePixel().Width(); - aZiel.X() += nWidth / 2; - aZiel.Y() += 5; - } - break; - } - AnimateMouse( pControl, aZiel ); -} - - -void StatementControl::AnimateMouse( Window *pControl, Point aWohin ) -{ - Point aAkt = pControl->GetPointerPosPixel(); - Point aZiel = aWohin; - - long nSteps; - Point aDiff = aAkt - aZiel; - - if ( Abs(aDiff.X()) < Abs(aDiff.Y()) ) - nSteps = Abs(aDiff.Y()) / 5; - else - nSteps = Abs(aDiff.X()) / 5; - if ( nSteps == 0 ) - return; - - aDiff *= 1000; - aDiff /= nSteps; - - StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack - // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird. - - for ( ; nSteps ; nSteps-- ) - { - if ( Abs((aAkt - pControl->GetPointerPosPixel()).X()) > 5 || - Abs((aAkt - pControl->GetPointerPosPixel()).Y()) > 5 ) - nSteps = 1; - aAkt = aZiel + aDiff * nSteps / 1000; - pControl->SetPointerPosPixel(aAkt); - SafeReschedule(); - } - pControl->SetPointerPosPixel(aZiel); - StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack -} - - -sal_Bool StatementControl::MaybeDoTypeKeysDelay( Window *pTestWindow ) -{ - if ( bDoTypeKeysDelay ) - { - sal_uLong nTimeWait = nMinTypeKeysDelay; - if ( nMaxTypeKeysDelay != nMinTypeKeysDelay ) - nTimeWait += Time::GetSystemTicks() % ( nMaxTypeKeysDelay - nMinTypeKeysDelay ); - Timer aTimer; - aTimer.SetTimeout( nTimeWait ); - aTimer.Start(); - StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack - // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird. - while ( aTimer.IsActive() ) - { - SafeReschedule( sal_True ); - } - StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack - if ( !WinPtrValid(pTestWindow ) ) - { - ReportError( aUId, GEN_RES_STR1( S_WINDOW_DISAPPEARED, MethodString( nMethodId ) ) ); - return sal_False; - } - } - return sal_True; -} - -sal_Bool StatementControl::HandleVisibleControls( Window *pControl ) -{ - if( pControl ) // Also auch bei Disabled nicht jedoch bei Invisible - { - switch( nMethodId ) - { - case M_IsEnabled: - pRet->GenReturn ( RET_Value, aUId, IsAccessable(pControl) ); - break; - case M_IsVisible: - pRet->GenReturn ( RET_Value, aUId, pControl->IsVisible() ); - break; - case M_GetPosX: - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows - if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border - if ( (nParams & PARAM_BOOL_1) && bBool1 ) - pControl = pControl->GetWindow( WINDOW_OVERLAP ); - - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW ) - { - Point aPos = pControl->GetPosPixel(); - aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos ); - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)aPos.X() ); - } - else - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetPosPixel().X() ); - break; - case M_GetPosY: - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows - if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border - if ( (nParams & PARAM_BOOL_1) && bBool1 ) - pControl = pControl->GetWindow( WINDOW_OVERLAP ); - - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_SPLITWINDOW ) - { - Point aPos = pControl->GetPosPixel(); - aPos = pControl->GET_REAL_PARENT()->OutputToScreenPixel( aPos ); - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)aPos.Y() ); - } - else - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetPosPixel().Y() ); - break; - case M_GetSizeX: - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows - if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border - if ( (nParams & PARAM_BOOL_1) && bBool1 ) - pControl = pControl->GetWindow( WINDOW_OVERLAP ); - - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetSizePixel().Width() ); - break; - case M_GetSizeY: - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows - if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border - if ( (nParams & PARAM_BOOL_1) && bBool1 ) - pControl = pControl->GetWindow( WINDOW_OVERLAP ); - - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetSizePixel().Height() ); - break; - case M_SnapShot: - { - if ( pControl->GetType() == WINDOW_DOCKINGWINDOW && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r FloatingWindows - if ( pControl->GetType() == WINDOW_TABCONTROL && pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_TABDIALOG ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r TabDialoge - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_BORDERWINDOW ) - pControl = pControl->GET_REAL_PARENT(); // Sonderbehandlung f�r Border - if ( (nParams & PARAM_BOOL_1) && bBool1 ) - pControl = pControl->GetWindow( WINDOW_OVERLAP ); - - Bitmap aBmp = pControl->SnapShot(); - if ( pControl->GetType() == WINDOW_WORKWINDOW ) - { - Point aStart = pControl->GetPosPixel(); - if ( !(nParams & PARAM_UINT16_4) ) - { - nParams |= PARAM_UINT16_1; - nParams |= PARAM_UINT16_2; - nParams |= PARAM_UINT16_3; - nParams |= PARAM_UINT16_4; - nNr1 = (sal_uInt16)-aStart.X(); - nNr2 = (sal_uInt16)-aStart.Y(); - nNr3 = (sal_uInt16)pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X(); - nNr4 = (sal_uInt16)pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y(); - } - nNr1 = std::max((sal_uInt16)-aStart.X(),nNr1); - nNr2 = std::max((sal_uInt16)-aStart.Y(),nNr2); - nNr3 = std::min((sal_uInt16)(pControl->GetSizePixel().Width() + 2*(sal_uInt16)aStart.X()),nNr3); - nNr4 = std::min((sal_uInt16)(pControl->GetSizePixel().Height() + 2*(sal_uInt16)aStart.Y()),nNr4); - } - if( nParams & PARAM_UINT16_4 ) - { // Zuschneiden - Point aPt(-nNr1,-nNr2); - Size aSz(nNr3,nNr4); - VirtualDevice aVDev( *pControl ); - - aVDev.SetOutputSizePixel( aSz ); - aVDev.DrawBitmap( aPt, aBmp ); - aBmp = aVDev.GetBitmap( Point(), aSz ); - } - - SvFileStream fOut; - fOut.Open(aString1,STREAM_STD_WRITE); - aBmp.Write(fOut); - if ( fOut.GetError() ) - ReportError( aUId, GEN_RES_STR1( S_ERROR_SAVING_IMAGE, UniString::CreateFromInt32( fOut.GetError() ) ) ); - fOut.Close(); - } - break; - case M_GetFixedTextCount: - { - pRet->GenReturn ( RET_Value, aUId, CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) ); - } - break; - case M_GetFixedText: - { - if( ( nParams & PARAM_UINT16_1 ) == 0 ) - nNr1 = 1; - - FixedText* pFixedText = (FixedText*)GetWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True, nNr1-1 ); - if ( pFixedText ) - pRet->GenReturn ( RET_Value, aUId, pFixedText->GetText() ); - else - ValueOK(aUId, MethodString( nMethodId ),nNr1,CountWinByRT( pControl, WINDOW_FIXEDTEXT, sal_True ) ); - } - break; - default: - return sal_False; - } - SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) ); - return sal_True; - } - return sal_False; -} - -sal_Bool StatementControl::HandleCommonMethods( Window *pControl ) -{ - switch( nMethodId ) // Diese k�nnen an jedem Window ausgef�hrt werden - { - case M_Exists: // Oben schon Behandelt. Unterdr�ckt hier nur Fehler - case M_NotExists: - case M_IsEnabled: - case M_IsVisible: - case M_SnapShot: - break; - case M_Caption : - { - if ( pControl->GetText().Len() == 0 && IsDocFrame( pControl->GetWindow( WINDOW_FRAME ) ) ) - pRet->GenReturn ( RET_Value, aUId, pControl->GetWindow( WINDOW_FRAME )->GetText()); - else - pRet->GenReturn ( RET_Value, aUId, pControl->GetText()); - } - break; - case M_GetRT: - { - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pControl->GetType() ); - } - break; - case M_TypeKeys: - { - if( !(nParams & PARAM_UINT16_1) ) // Anzahl wiederholungen - nNr1 = 1; - if( !(nParams & PARAM_BOOL_1) ) // Follow Focus - bBool1 = sal_False; // so bleibt das bisherige Verhalten - - if ( !bBool1 ) // Altes Verhalten - pControl->GrabFocus(); - else // If focus is not inside given control we grab it once. - { - Window *pFocus = GetpApp()->GetFocusWindow(); - if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) ) - pControl->GrabFocus(); - } - - - // maybe this can get removed since we are using GetPreferredKeyInputWindow() - if ( pControl->GetType() == WINDOW_COMBOBOX ) - { // Bei COMBOBOX an das Edit direkt liefern - Window *pTemp = NULL; - for ( sal_uInt16 i = 0 ; i < pControl->GetChildCount() && !pTemp ; i++ ) - if ( pControl->GetChild( i )->GetType() == WINDOW_EDIT ) - pTemp = pControl->GetChild( i ); - if ( pTemp ) - pControl = pTemp; - } - - Window *pDeliverHere = pControl; - for (int j = 0; j < nNr1; j++) - for (xub_StrLen i = 0; i < aString1.Len(); i++) - { - if ( StatementList::bUsePostEvents ) - { // grab focus every time - Window *pFocus = GetpApp()->GetFocusWindow(); - if ( !pFocus || !pControl->IsWindowOrChild( pFocus, sal_True ) ) - pControl->GrabFocus(); - } - if ( bBool1 ) // Jedesmal das FocusWindow finden - { - Window *pFocus = GetpApp()->GetFocusWindow(); - if ( pFocus && pControl->IsWindowOrChild( pFocus, sal_True ) ) - pDeliverHere = pFocus; - else // sonst fallback auf das Basisfenster - pDeliverHere = pControl; - } - pDeliverHere = pDeliverHere->GetPreferredKeyInputWindow(); - KeyEvent aEvent; - if ( ((sal_uInt16)aString1.GetChar(i)) <= 7 ) - { - sal_uInt16 nVal = 0; - switch (aString1.GetChar(i)) - { - case 1: nVal = aString1.GetChar(i+1) + (aString1.GetChar(i+2) << 8); - i += 2; - break; - case 3: nVal = (aString1.GetChar(i+1) << 8); - i++; - break; - case 5: nVal = aString1.GetChar(i+1); - i++; - break; - case 7: nVal = 0; - break; - } - // #105672# - // find out the keycode - sal_uInt16 nKeygroup = nVal & KEYGROUP_TYPE; - sal_uInt16 nKeyCode = nVal & KEY_CODE; - sal_Unicode aCh; - switch (nKeygroup) - { - case KEYGROUP_NUM: - aCh = nKeyCode - KEY_0 + '0'; - break; - case KEYGROUP_ALPHA: - aCh = nKeyCode - KEY_A; - if ( nVal & KEY_MOD1 ) - {} - else if ( nVal & KEY_SHIFT ) - aCh += 'A'; - else - aCh += 'a'; - break; - case KEYGROUP_MISC: - { // CR ESC TAB BACK - ByteString aPrintableMisc("\x0d\x1b\x09\x08 **+-*/.,<>=",16); - if ( nKeyCode-KEY_RETURN < aPrintableMisc.Len() - && nKeyCode != KEY_INSERT && nKeyCode != KEY_DELETE ) - aCh = aPrintableMisc.GetChar( nKeyCode-KEY_RETURN ); - else - aCh = 0; - } - break; - case KEYGROUP_CURSOR: - case KEYGROUP_FKEYS: - default: - aCh = 0; - } - aEvent = KeyEvent(aCh,KeyCode(nVal & 0xFFF,nVal & 0xF000)); - } - else - { - // CR ESC TAB BACK - String aPrintableMisc = CUniString("\x0d\x1b\x09\x08 xx+-*/.,<>="); - sal_Unicode aCh = aString1.GetChar(i); - if ( aCh >= 'a' && aCh <= 'z' ) - aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', 0)); - else if ( aCh >= 'A' && aCh <= 'Z' ) - aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_ALPHA + aCh-'a', KEY_SHIFT)); - else if ( aCh >= '0' && aCh <= '9' ) - aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_NUM + aCh-'0', 0)); - else if ( aPrintableMisc.Search(aCh) != STRING_NOTFOUND ) - aEvent = KeyEvent(aCh, KeyCode(KEYGROUP_MISC + (sal_uInt16)aPrintableMisc.Search(aCh), 0)); - else // Sollte eigentlich nicht auftreten - aEvent = KeyEvent(aCh, KeyCode()); - } - ImplKeyInput( pDeliverHere, aEvent ); - if ( !MaybeDoTypeKeysDelay( pControl ) ) - break; - else - SafeReschedule();SafeReschedule();SafeReschedule(); - } - } - break; - -#define CalcMouseButton\ - sal_uInt16 nButton = MOUSE_LEFT;\ - if ( (nParams & PARAM_UINT16_3) )\ - {\ - switch ( nNr3 )\ - {\ - case 1: nButton = MOUSE_LEFT; break;\ - case 2: nButton = MOUSE_MIDDLE; break;\ - case 3: nButton = MOUSE_RIGHT; break;\ - }\ - }\ - - case M_MouseDown: - { - CalcMouseButton; - Size aS = pControl->GetOutputSizePixel(); - Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100); - Window *pActualWin = pControl->FindWindow( aPos ); - - if ( pActualWin ) - aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) ); - else - pActualWin = pControl; - - AnimateMouse( pActualWin, aPos ); - pActualWin->GrabFocus(); - MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton); - ImplMouseButtonDown( pActualWin, aMEvnt ); - } - break; - case M_MouseUp: - { - CalcMouseButton; - Size aS = pControl->GetOutputSizePixel(); - Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100); - Window *pActualWin = pControl->FindWindow( aPos ); - - if ( pActualWin ) - aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) ); - else - pActualWin = pControl; - - AnimateMouse( pActualWin, aPos ); - MouseEvent aMEvt( aPos, 1, MOUSE_SIMPLECLICK|MOUSE_SELECT, nButton ); - ImplMouseButtonUp( pActualWin, aMEvt ); - } - break; - case M_MouseMove: - { - CalcMouseButton; - Size aS = pControl->GetOutputSizePixel(); - Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100); - Window *pActualWin = pControl->FindWindow( aPos ); - - if ( pActualWin ) - { - aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) ); - } - else - pActualWin = pControl; - - AnimateMouse( pActualWin, aPos ); - MouseEvent aMEvt( aPos, 0, MOUSE_SIMPLEMOVE|MOUSE_DRAGMOVE, nButton ); - ImplMouseMove( pActualWin, aMEvt ); - } - break; - case M_MouseDoubleClick: - { - CalcMouseButton; - Size aS = pControl->GetOutputSizePixel(); - Point aPos = Point(aS.Width() * nNr1 / 100,aS.Height() * nNr2 / 100); - Window *pActualWin = pControl->FindWindow( aPos ); - - if ( pActualWin ) - { - aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) ); - } - else - pActualWin = pControl; - - AnimateMouse( pActualWin, aPos ); - pActualWin->GrabFocus(); - MouseEvent aMEvnt; - aMEvnt = MouseEvent(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton); - ImplMouseButtonDown( pActualWin, aMEvnt ); - ImplMouseButtonUp ( pActualWin, aMEvnt ); - aMEvnt = MouseEvent(aPos,2,MOUSE_SIMPLECLICK|MOUSE_SELECT,nButton); - ImplMouseButtonDown( pActualWin, aMEvnt ); - ImplMouseButtonUp ( pActualWin, aMEvnt ); - } - break; - case M_DisplayPercent: - { - ModelessDialog *pDlg = new ModelessDialog(NULL); - pDlg->SetOutputSizePixel(Size(100,30)); - - Edit *pMyEd = new Edit(pDlg,WB_CENTER | WB_BORDER ); - pMyEd->SetSizePixel(Size(100,30)); - pDlg->SetText(UniString("Schlie�en", RTL_TEXTENCODING_ISO_8859_1)); - pDlg->Show(); - pMyEd->Show(); - sal_uLong nTime = Time().GetTime(); - - while (pDlg->IsVisible()) - { - pDlg->ToTop(); - for (int i = 1 ; i<10 ; i++) - SafeReschedule(); - Point Pos = pControl->GetPointerPosPixel(); - Size Siz=pControl->GetOutputSizePixel(); - if ( Time().GetTime() - nTime > 10 ) - { - nTime = Time().GetTime(); - pMyEd->SetText(UniString::CreateFromInt32(Pos.X()*100/Siz.Width()).AppendAscii("%x").Append( UniString::CreateFromInt32(Pos.Y()*100/Siz.Height()) ).Append('%')); - } - } - - delete pMyEd; - delete pDlg; - } - break; - case M_OpenContextMenu: - { - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - Point aPos; - ToolBox* pTB = (ToolBox*)pControl; - if ( (pControl->GetType() == WINDOW_TOOLBOX) && pTB->IsMenuEnabled() ) - { - pTB->ExecuteCustomMenu(); - } - else - { - sal_Bool bAtMousePos = ( nParams & PARAM_BOOL_1 ) && bBool1; - if ( bAtMousePos ) - { - aPos = pControl->GetPointerPosPixel(); - Window *pActualWin = pControl->FindWindow( aPos ); - - if ( pActualWin ) - { - aPos = pActualWin->AbsoluteScreenToOutputPixel( pControl->OutputToAbsoluteScreenPixel ( aPos ) ); - pControl = pActualWin; - } - } - CommandEvent aEvent( aPos, COMMAND_CONTEXTMENU, bAtMousePos ); - ImplCommand( pControl, aEvent ); - } - } - break; - case M_UseMenu: - { - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - - while ( pControl && !( ( pControl->GetType() == WINDOW_SYSWINDOW || pControl->GetType() == WINDOW_WORKWINDOW ) && ControlOK( pControl, "" ) ) ) - pControl = pControl->GET_REAL_PARENT(); - - if ( pControl && ((SystemWindow*)pControl)->GetMenuBar() ) - pMenuWindow = ((SystemWindow*)pControl); - else - ReportError( GEN_RES_STR1( S_NO_MENU, MethodString( nMethodId ) ) ); - } - break; - case M_FadeIn: - case M_FadeOut: - case M_Pin: - case M_IsFadeIn: - case M_IsPin: - { - WindowAlign aWindowAlign = WINDOWALIGN_LEFT; - if ( (nParams & PARAM_UINT16_1) ) - { - switch ( nNr1 ) - { - case CONST_ALIGN_LEFT: - aWindowAlign = WINDOWALIGN_LEFT; - break; - case CONST_ALIGN_TOP: - aWindowAlign = WINDOWALIGN_TOP; - break; - case CONST_ALIGN_RIGHT: - aWindowAlign = WINDOWALIGN_RIGHT; - break; - case CONST_ALIGN_BOTTOM: - aWindowAlign = WINDOWALIGN_BOTTOM; - break; - default: - ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) ); - } - } - - Window* pTemp = NULL; - while ( !pTemp && pControl ) - { - pTemp = GetFadeSplitWin( pControl, aWindowAlign ); - pControl = pControl->GET_REAL_PARENT(); - } - - if ( !pTemp ) - { - ReportError( aUId, GEN_RES_STR1( S_SPLITWIN_NOT_FOUND, MethodString( nMethodId ) ) ); - break; - } - - pControl = pTemp; // So da� wir unten ohne Fehler durchkommen - SplitWindow *pSW = (SplitWindow*) pTemp; - - switch( nMethodId ) - { - case M_FadeIn: - if ( pSW->IsFadeInButtonVisible() ) - pSW->FadeIn(); - break; - case M_FadeOut: - if ( pSW->IsFadeOutButtonVisible() ) - pSW->FadeOut(); - break; - case M_Pin: - if ( ( pSW->GetAutoHideState() && bBool1 ) - || ( !pSW->GetAutoHideState() && !bBool1 ) ) - { - MouseEvent aMEvnt; - Point aPt( pSW->GetAutoHideRect().Center() ); - aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT ); - ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL ); - ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL ); - } - break; - case M_IsFadeIn: - pRet->GenReturn ( RET_Value, aUId, pSW->IsFadeOutButtonVisible() ); - break; - case M_IsPin: - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!pSW->GetAutoHideState() ); - break; - default: - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - } - SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) ); - } - break; - case M_StatusGetText: - case M_StatusIsProgress: - case M_StatusGetItemCount: - case M_StatusGetItemId: - { - StatusBar *pStatus = NULL; - while ( !pStatus && pControl ) - { - pStatus = (StatusBar*)GetWinByRT( pControl, WINDOW_STATUSBAR, sal_True ); - pControl = pControl->GET_REAL_PARENT(); - } - - if ( !pStatus ) - { - ReportError( aUId, GEN_RES_STR1( S_NO_STATUSBAR, MethodString( nMethodId ) ) ); - break; - } - - switch ( nMethodId ) - { - case M_StatusGetText: - { - if ( (nParams & PARAM_UINT16_1) ) - { - if ( pStatus->AreItemsVisible() ) - pRet->GenReturn ( RET_Value, aUId, String(pStatus->GetItemText(nNr1))); - else - ReportError( aUId, GEN_RES_STR1( S_ITEMS_INVISIBLE, MethodString( nMethodId ) ) ); - } - else - { - if ( pStatus->AreItemsVisible() ) - { - if ( pStatus->GetItemCount() == 1 ) - { - pRet->GenReturn ( RET_Value, aUId, pStatus->GetItemText( pStatus->GetItemId(0) )); - } - else - { - pRet->GenReturn ( RET_Value, aUId, String() ); - } - } - else - pRet->GenReturn ( RET_Value, aUId, (String)pStatus->GetText() ); - } - } - break; - case M_StatusIsProgress: - { - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pStatus->IsProgressMode() ); - } - break; - case M_StatusGetItemCount: - if ( pStatus->AreItemsVisible() ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pStatus->GetItemCount())); - else - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0)); - break; - case M_StatusGetItemId: - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pStatus->GetItemCount()) ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pStatus->GetItemId(nNr1-1))); - break; - } - } - break; - case M_HasScrollBar: - case M_IsScrollBarEnabled: - { - if ( (nParams | PARAM_UINT16_1) != PARAM_UINT16_1 ) // so there are other params - { - ReportError( aUId, GEN_RES_STR0( S_INVALID_PARAMETERS ) ); - break; - } - - if( !(nParams & PARAM_UINT16_1) ) - nNr1 = CONST_ALIGN_RIGHT; // default is right Scrollbar(vertical) - - if ( (nNr1 != CONST_ALIGN_RIGHT) && (nNr1 != CONST_ALIGN_BOTTOM) ) - { - ReportError( aUId, GEN_RES_STR1( S_INVALID_POSITION, MethodString( nMethodId ) ) ); - break; - } - - ScrollBar *pScroll = NULL; - - sal_uInt16 nSteps = 2; - while ( !pScroll && pControl && nSteps-- ) - { - pScroll = GetScrollBar( pControl, nNr1, sal_True ); - pControl = pControl->GET_REAL_PARENT(); - } - - switch ( nMethodId ) - { - case M_HasScrollBar: - { - if ( pScroll ) - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True ); - else - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False ); - } - break; - case M_IsScrollBarEnabled: - { - if ( !pScroll ) - { - ReportError( aUId, GEN_RES_STR1( S_NO_SCROLLBAR, MethodString( nMethodId ) ) ); - break; - } - pRet->GenReturn ( RET_Value, aUId, pScroll->IsEnabled() ); - } - break; - } - } - break; - default: - return sal_False; - } - return sal_True; -} - - -sal_Bool StatementControl::Execute() -{ - Window *pControl; - sal_Bool bStatementDone = sal_True; - - - if ( IsError ) - { - #if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Skipping Window: " ); - m_pDbgWin->AddText( Id2Str( aUId ) ); - m_pDbgWin->AddText( " Method: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( "\n" ); - #endif - Advance(); - delete this; - return sal_True; - } - - InitProfile(); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Executing Window: " ); - m_pDbgWin->AddText( Id2Str( aUId ) ); - m_pDbgWin->AddText( " Method: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nMethodId ) ); - m_pDbgWin->AddText( "\n" ); -#endif - - - if ( aUId.equals( UID_ACTIVE ) ) - pControl = GetAnyActive(); - else - { - sal_Bool bSearchButtonOnToolbox = (nParams == PARAM_NONE) && ((M_Click == nMethodId) || (M_TearOff == nMethodId) || (M_IsEnabled == nMethodId) || (M_OpenMenu == nMethodId)); - bSearchButtonOnToolbox |= (nParams == PARAM_UINT16_1) && (M_GetState == nMethodId); - if ( nMethodId == M_TypeKeys || nMethodId == M_MouseDown - || nMethodId == M_MouseUp || nMethodId == M_MouseMove - || nMethodId == M_SnapShot ) - { - pControl = NULL; - if ( /*(nMethodId == M_SnapShot || nMethodId == M_TypeKeys) &&*/ !pControl ) - pControl = SearchTree( aUId ,bSearchButtonOnToolbox ); - } - else - pControl = SearchTree( aUId ,bSearchButtonOnToolbox ); - } - - - if ( pControl && pControl->GetType() == WINDOW_TOOLBOX ) - { - if ( !aUId.equals( pControl->GetUniqueOrHelpId() ) ) - { // Also wenn wir irgendwas auf einer Toolbox gefunden haben - switch ( nMethodId ) - { - case M_Click: - case M_TearOff: - case M_OpenMenu: - case M_GetState: - break; - case M_IsEnabled: - nMethodId = _M_IsEnabled; // Umlabeln, da die Behandlung essentiell anders ist! - break; - default: - pControl = NULL; - } - } - } - - - switch ( nMethodId ) - { - case M_Exists: - case M_NotExists: - Time aT; - sal_uInt16 aSeconds = aT.GetMin()*60+aT.GetSec(); - if ( !bBool2 ) // wurde im Konstruktor auf sal_False gesetzt - { - bBool2 = sal_True; - nNr2 = aSeconds; - if( !(nParams & PARAM_UINT16_1) ) - nNr1 = 0; // defaultm��ig sofort zur�ck - } - if ( aSeconds < nNr2 ) // Falls die Stunde umgesprungen ist - aSeconds += 60*60; - - if ( !pControl || !pControl->IsVisible() ) - pControl = NULL; - if ( ((nMethodId == M_Exists) && pControl) || - ((nMethodId == M_NotExists) && !pControl) ) - { // Wenn Bedingung erf�llt - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_True ); - } - else - if ( aSeconds <= nNr2 + nNr1 ) // Zeit ist noch nicht abgelaufen - return sal_False; - else - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)sal_False ); - - Advance(); - delete this; - return sal_True; - } - - - short nRT = 0; - - if( pControl ) // Das Fenster Existiert irgendwo, kann aber auch hidden sein! - { - nRT = ImpGetRType( pControl ); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Type is: " ); - m_pDbgWin->AddText( String::CreateFromInt32( nRT ) ); - m_pDbgWin->AddText( "\n" ); -#endif - } - - if ( nRT == C_Window && // Search for WorkWindow to satisfy these commands - ( nMethodId == M_Close - || nMethodId == M_IsMax - || nMethodId == M_IsMin - || nMethodId == M_IsRestore - || nMethodId == M_Minimize - || nMethodId == M_Maximize - || nMethodId == M_Restore ) ) - { - Window* pNewControl = pControl; - while ( pNewControl && pNewControl->GetType() != WINDOW_WORKWINDOW ) - pNewControl = pNewControl->GET_REAL_PARENT(); - - if ( pNewControl ) - { - pControl = pNewControl; - nRT = C_WorkWin; - } - } - - - if ( (!ControlOK( pControl, "" )) && ( nMethodId != M_SnapShot ) && (nRetryCount--)) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( CUniString("Reschedule command (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") ); -#endif - return sal_False; - } - - if( ControlOK( pControl, "" ) ) - { - if ( nMethodId == M_OpenContextMenu && !bBool2 ) - { - pControl->GrabFocus(); // to get asyncron focus on unix - bBool2 = sal_True; - return sal_False; - } - // TODO: handle GetFocus for all Methods and Windows like this (remove part below) - // See for impact of changed focus for HandleVisibleControls() (taking Snapshots might be different, possible exclude those methods) - if (( (nRT == C_TreeListBox) && !bBool2 ) - && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht - && nMethodId != M_MouseDown - && nMethodId != M_MouseUp - && nMethodId != M_MouseMove ) - { - if ( !pControl->HasFocus() ) - { - pControl->GrabFocus(); - int i = 10; - while ( i-- && !pControl->HasFocus() ) // reschedule a bit - { - SafeReschedule(); - if ( !WinPtrValid( pControl ) ) - return sal_False; - } - if ( !pControl->HasFocus() ) // to get asyncronous focus - { - bBool2 = sal_True; - return sal_False; - } - } - } - } - - Advance(); - - if ( HandleVisibleControls( pControl ) ) - { - delete this; - return sal_True; - } - if( ControlOK( pControl, "Window/Control" ) ) - { - if (((( nRT < C_TabPage && nRT > C_TabControl ) - || nRT == C_PatternBox - || nRT == C_ToolBox - || nRT == C_ValueSet - || nRT == C_Control - || nRT == C_TreeListBox - ) - || nMethodId == M_OpenContextMenu ) - && nMethodId != M_TypeKeys // TypeKeys macht das selbst, falls eigenes Focushandling gew�nscht - && nMethodId != M_MouseDown - && nMethodId != M_MouseUp - && nMethodId != M_MouseMove ) - pControl->GrabFocus(); - - if ( !HandleCommonMethods( pControl ) ) - { - switch( nRT ) - { - case C_TabControl: - switch( nMethodId ) - { - case M_GetPageId: - if ( (nParams & PARAM_UINT16_1) ) - { - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) ) - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetPageId(nNr1-1)); - } - else - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetCurPageId()); - break; - case M_GetPageCount: - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)((TabControl*)pControl)->GetPageCount()); - break; - case M_SetPageId: - if (((TabControl*)pControl)->GetCurPageId()) - ((TabControl*)pControl)->DeactivatePage(); - ((TabControl*)pControl)->SetCurPageId( nNr1 ); - ((TabControl*)pControl)->ActivatePage(); - break; - case M_SetPageNr: - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((TabControl*)pControl)->GetPageCount() ) ) - { - if (((TabControl*)pControl)->GetCurPageId()) - ((TabControl*)pControl)->DeactivatePage(); - ((TabControl*)pControl)->SetCurPageId( ((TabControl*)pControl)->GetPageId( nNr1-1 ) ); - ((TabControl*)pControl)->ActivatePage(); - } - break; - case M_GetPage: - pRet->GenReturn ( RET_Value, aUId, Id2Str( ((TabControl*)pControl)->GetTabPage(((TabControl*)pControl)->GetCurPageId())->GetUniqueOrHelpId() ) ); - break; - case M_SetPage : - { // Wegen lokaler Variablen - TabControl *pTControl = ((TabControl*)pControl); - sal_uInt16 nActive = pTControl->GetCurPageId(); - sal_uInt16 i,anz; - rtl::OString aID; - rtl::OString aWantedID; - //HELPID BACKWARD (No numbers please (remove PARAM_UINT32_1 part) - if ( (nParams & PARAM_UINT32_1) ) - { - ReportError( aUId, GEN_RES_STR1c( S_INTERNAL_ERROR, "using numeric HelpID from old Testtool" ) ); - } - else if ( (nParams & PARAM_STR_1) ) - { - aWantedID = Str2Id( aString1 ); - } - else - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - - i = pTControl->GetPagePos( pTControl->GetCurPageId() ); - for ( anz=0 ; anz < pTControl->GetPageCount() && !aID.equals( aWantedID ) ; anz++ ) - { - pTControl->SelectTabPage( pTControl->GetPageId(i) ); - aID = pTControl->GetTabPage(pTControl->GetCurPageId())->GetUniqueOrHelpId(); - i++; - if ( i >= pTControl->GetPageCount() ) - i = 0; - if ( !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) || !MaybeDoTypeKeysDelay( pTControl ) ) // 3 Mal aufrufen - break; - } - if ( !aID.equals( aWantedID ) ) - { - pTControl->SelectTabPage( nActive ); - ReportError( aWantedID, GEN_RES_STR1( S_TABPAGE_NOT_FOUND, MethodString( nMethodId ) ) ); - } - } - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TabControl" ) ); - break; - } - break; - case C_RadioButton: - case C_ImageRadioButton: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteLinks); - break; - case M_IsChecked : - pRet->GenReturn ( RET_Value, aUId, ((RadioButton*)pControl)->IsChecked()); - break; - case M_Check : - ((RadioButton*)pControl)->Check(); - ((RadioButton*)pControl)->Click(); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RadioButton" ) ); - break; - } - break; - case C_CheckBox: - case C_TriStateBox: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteLinks); - break; - case M_IsChecked : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_CHECK) ); - break; - case M_IsTristate : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL( ((TriStateBox*)pControl)->GetState() == STATE_DONTKNOW) ); - break; - case M_GetState : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((TriStateBox*)pControl)->GetState())); - break; - case M_Check : - ((TriStateBox*)pControl)->SetState( STATE_CHECK ); - ((TriStateBox*)pControl)->Click(); - break; - case M_UnCheck : - ((TriStateBox*)pControl)->SetState( STATE_NOCHECK ); - ((TriStateBox*)pControl)->Click(); - break; - case M_TriState : - if ( ((TriStateBox*)pControl)->IsTriStateEnabled() ) - { - ((TriStateBox*)pControl)->SetState( STATE_DONTKNOW ); - ((TriStateBox*)pControl)->Click(); - } - else - { - ReportError( aUId, GEN_RES_STR0( S_TRISTATE_NOT_ALLOWED ) ); - } - break; - case M_Click : - { - TriStateBox *pTB = ((TriStateBox*)pControl); - if ( pTB->GetState() == STATE_NOCHECK ) - pTB->SetState( STATE_CHECK ); - else if ( pTB->GetState() == STATE_CHECK ) - { - if ( pTB->IsTriStateEnabled() ) - pTB->SetState( STATE_DONTKNOW ); - else - pTB->SetState( STATE_NOCHECK ); - } - else - pTB->SetState( STATE_NOCHECK ); - pTB->Click(); - } - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TriStateBox" ) ); - break; - } - break; - case C_Edit: - case C_MultiLineEdit: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_GetText : - pRet->GenReturn ( RET_Value, aUId, ((Edit*)pControl)->GetText()); - break; - case M_IsWritable: - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((Edit*)pControl)->IsReadOnly() ); - break; - default: - if ( ! ((Edit*)pControl)->IsReadOnly() ) - { - switch( nMethodId ) - { - case M_SetText : - ((Edit*)pControl)->SetText( aString1 ); - if ( nRT == C_MultiLineEdit ) // since SetModifyFlag is not virtual we have to do this - ((MultiLineEdit*)pControl)->SetModifyFlag(); - else - ((Edit*)pControl)->SetModifyFlag(); - ((Edit*)pControl)->Modify(); - if ( ((Edit*)pControl)->GetText().CompareTo(aString1) != COMPARE_EQUAL ) - ReportError( aUId, GEN_RES_STR1( S_ERROR_IN_SET_TEXT, MethodString( nMethodId ) ) ); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(MultiLine)Edit" ) ); - break; - } - } - else - ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "(MultiLine)Edit" ) ); - } - break; - case C_MultiListBox: - case C_ListBox: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_GetSelCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetSelectEntryCount())); - break; - case M_GetSelIndex : - if ( ! (nParams & PARAM_UINT16_1) ) - { - if ( ((ListBox*)pControl)->GetSelectEntryCount() == 0 ) - { - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0)); - break; - } - nNr1 = 1; - } - ValueOK(aUId, MethodString( nMethodId ),nNr1,((ListBox*)pControl)->GetSelectEntryCount()); - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetSelectEntryPos(nNr1-1)) +1); - break; - case M_GetSelText : - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1; - pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetSelectEntry(nNr1-1)); - break; - case M_GetItemCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ListBox*)pControl)->GetEntryCount())); - break; - case M_GetItemText : - pRet->GenReturn ( RET_Value, aUId, ((ListBox*)pControl)->GetEntry(nNr1-1)); - break; - case M_Select: - case M_MultiSelect: - { - sal_Bool bUnselectBeforeSelect = ( nMethodId == M_Select ); - sal_Bool bFehler = sal_False; - if ( ! (nParams & PARAM_BOOL_1) ) - bBool1 = sal_True; - - if ( nMethodId == M_MultiSelect && nRT == C_ListBox ) - { - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ListBox" ) ); - bFehler = sal_True; - } - - if ( !bBool1 && nMethodId == M_Select ) - { - ReportError( aUId, GEN_RES_STR1( S_NO_SELECT_FALSE, MethodString( nMethodId ) ) ); - bFehler = sal_True; - } - - if ( !bFehler ) - { - if( nParams & PARAM_STR_1 ) - { - ListBox *pLB = ((ListBox*)pControl); - sal_uInt16 nPos; - if ( (nPos = pLB->GetEntryPos( aString1 )) == LISTBOX_ENTRY_NOTFOUND ) - ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) ); - else - { - if ( bUnselectBeforeSelect ) - pLB->SetNoSelection(); - pLB->SelectEntryPos( nPos, bBool1 ); - if ( pLB->IsEntryPosSelected( nPos ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL - ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), aString1 ) ); - } - } - else - { - ListBox *pLB = ((ListBox*)pControl); - pLB = static_cast(pControl); - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pLB->GetEntryCount()) ) - { - if ( bUnselectBeforeSelect ) - pLB->SetNoSelection(); - pLB->SelectEntryPos( nNr1-1, bBool1 ); - if ( pLB->IsEntryPosSelected( nNr1-1 ) ? !bBool1 : bBool1 ) // XOR rein mit BOOL - ReportError( aUId, GEN_RES_STR2( S_METHOD_FAILED, MethodString( nMethodId ), UniString::CreateFromInt32( nNr1 ) ) ); - } - } - ((ListBox*)pControl)->Select(); - } - } - break; - case M_SetNoSelection : - ((ListBox*)pControl)->SetNoSelection(); - ((ListBox*)pControl)->Select(); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "(Multi)ListBox" ) ); - break; - } - break; - case C_ComboBox: - case C_PatternBox: - case C_NumericBox: - case C_MetricBox: - case C_CurrencyBox: - case C_DateBox: - case C_TimeBox: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_GetSelText : - pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetText()); - break; - case M_GetSelIndex : - { - sal_uInt16 nPos = ((ComboBox*)pControl)->GetEntryPos(((ComboBox*)pControl)->GetText()); - if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) - nPos = 0; - else - nPos++; - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32) nPos); - } - break; - case M_GetItemCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((ComboBox*)pControl)->GetEntryCount())); - break; - case M_GetItemText : - pRet->GenReturn ( RET_Value, aUId, ((ComboBox*)pControl)->GetEntry(nNr1-1)); - break; - case M_IsWritable: - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((ComboBox*)pControl)->IsReadOnly() ); - break; - case M_Select : - if( nParams & PARAM_UINT16_1 ) - { - if ( !ValueOK(aUId, MethodString( nMethodId ),nNr1,((ComboBox*)pControl)->GetEntryCount()) ) - break; - aString1 = ((ComboBox*)pControl)->GetEntry(nNr1-1); - } - else - { - if ( ((ComboBox*)pControl)->GetEntryPos( aString1 ) == COMBOBOX_ENTRY_NOTFOUND ) - { - ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) ); - break; - } - } - - - ((ComboBox*)pControl)->SetText( aString1 ); - ((ComboBox*)pControl)->SetModifyFlag(); - ((ComboBox*)pControl)->Modify(); - break; - case M_SetText : - if ( ! ((ComboBox*)pControl)->IsReadOnly() ) - { - if ( ! (nParams & PARAM_STR_1) ) - aString1 = String(); - ((ComboBox*)pControl)->SetText( aString1 ); - ((ComboBox*)pControl)->SetModifyFlag(); - ((ComboBox*)pControl)->Modify(); - } - else - ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "ComboBox" ) ); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ComboBox" ) ); - break; - } - break; - case C_PushButton: - case C_OkButton: - case C_CancelButton: - case C_ImageButton: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_Click : - ((PushButton*)pControl)->Click(); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "PushButton" ) ); - break; - } - break; - case C_MoreButton: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_IsOpen : - pRet->GenReturn ( RET_Value, aUId, ((MoreButton*)pControl)->GetState()); - break; - case M_Click : - ((MoreButton*)pControl)->Click(); - break; - case M_Open : - ((MoreButton*)pControl)->SetState(sal_True); - break; - case M_Close : - ((MoreButton*)pControl)->SetState(sal_False); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MoreButton" ) ); - break; - } - break; - case C_SpinField: - case C_PatternField: - case C_NumericField: - case C_MetricField: - case C_CurrencyField: - case C_DateField: - case C_TimeField: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_GetText : - pRet->GenReturn ( RET_Value, aUId, ((SpinField*)pControl)->GetText()); - break; - case M_IsWritable: - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((SpinField*)pControl)->IsReadOnly() ); - break; - case M_SetText : - if ( ! ((SpinField*)pControl)->IsReadOnly() ) - { - ((SpinField*)pControl)->SetText( aString1 ); - ((SpinField*)pControl)->SetModifyFlag(); - ((SpinField*)pControl)->Modify(); - } - else - ReportError( aUId, GEN_RES_STR1c( S_ATTEMPT_TO_WRITE_READONLY, "SpinField" ) ); - break; - case M_More : - { - if ( !(nParams & PARAM_UINT16_1) ) - nNr1 = 1; - for (int i = 1; i<= nNr1; i++) - { - ((SpinField*)pControl)->Up(); - ((SpinField*)pControl)->SetModifyFlag(); - ((SpinField*)pControl)->Modify(); - } - } - break; - case M_Less : - { - if ( !(nParams & PARAM_UINT16_1) ) - nNr1 = 1; - for (int i = 1; i<= nNr1; i++) - { - ((SpinField*)pControl)->Down(); - ((SpinField*)pControl)->SetModifyFlag(); - ((SpinField*)pControl)->Modify(); - } - } - break; - case M_ToMin : - ((SpinField*)pControl)->First(); - ((SpinField*)pControl)->SetModifyFlag(); - ((SpinField*)pControl)->Modify(); - break; - case M_ToMax : - ((SpinField*)pControl)->Last(); - ((SpinField*)pControl)->SetModifyFlag(); - ((SpinField*)pControl)->Modify(); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "SpinField" ) ); - break; - } - break; - - case C_MenuButton: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_Click : - { - MouseEvent aMEvnt; - Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 ); - aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT ); - ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL ); - ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL ); - } - break; - case M_Open : - case M_OpenMenu : - { - MouseEvent aMEvnt; - Point aPt( pControl->GetSizePixel().Width() / 2, pControl->GetSizePixel().Height() / 2 ); - aMEvnt = MouseEvent( aPt,1,MOUSE_SIMPLECLICK,MOUSE_LEFT ); - ImplMouseButtonDown( pControl, aMEvnt, FORCE_DIRECT_CALL ); - - sal_uLong nStart = Time::GetSystemTicks(); - sal_uLong nDelay = pControl->GetSettings().GetMouseSettings().GetActionDelay(); - while ( ( Time::GetSystemTicks() - nStart ) < nDelay + 100 ) - SafeReschedule(); - - ImplMouseButtonUp ( pControl, aMEvnt, FORCE_DIRECT_CALL ); - - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - } - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MenuButton" ) ); - break; - } - break; - case C_ToolBox: - { - ToolBox *pTB = ((ToolBox*)pControl); - if ( !aUId.equals( pTB->GetUniqueOrHelpId() ) ) // So we found a Button on the ToolBox - { - if ( (nParams == PARAM_NONE) || (nParams == PARAM_UINT16_1) ) - { // Wir f�lschen einen Parameter - nParams |= PARAM_STR_1; - aString1 = Id2Str( aUId ); - } - else - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - } - -#define FIND_ITEM\ - sal_uInt16 nItemPos = 0;\ - sal_Bool bItemFound = sal_False;\ - {\ - rtl::OString aButtonId;\ - if( nParams & PARAM_STR_1 )\ - aButtonId = Str2Id( aString1 );\ - else\ - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) );\ - for ( nItemPos = 0; nItemPos < pTB->GetItemCount() && !aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) &&\ - !aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos))) ; nItemPos++ ) {}\ - bItemFound = aButtonId.equals(Str2Id( pTB->GetItemCommand(pTB->GetItemId(nItemPos)) )) || aButtonId.equals(pTB->GetHelpId(pTB->GetItemId(nItemPos)));\ - if ( !bItemFound )\ - ReportError( aUId, GEN_RES_STR1( S_HELPID_ON_TOOLBOX_NOT_FOUND, MethodString( nMethodId ) ) );\ - else\ - {\ - if ( !pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) && nMethodId != _M_IsEnabled && nMethodId != M_GetState )\ - {\ - ReportError( aUId, GEN_RES_STR1( S_BUTTON_DISABLED_ON_TOOLBOX, MethodString( nMethodId ) ) );\ - bItemFound = sal_False;\ - }\ - else if ( !pTB->IsItemVisible( pTB->GetItemId(nItemPos) ) && nMethodId != M_GetState )\ - {\ - ReportError( aUId, GEN_RES_STR1( S_BUTTON_HIDDEN_ON_TOOLBOX, MethodString( nMethodId ) ) );\ - bItemFound = sal_False;\ - }\ - else\ - {\ - if ( pTB->IsMenuEnabled() )\ - { /* button is in Menu */\ - }\ - else\ - { /* Try the multi line way */\ - if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\ - {\ - sal_uInt16 nLine = pTB->GetCurLine();\ - do\ - {\ - pTB->ShowLine( sal_False );\ - for ( int i = 1 ; i < 30 ; i++ )\ - SafeReschedule();\ - }\ - while ( pTB->GetCurLine() != nLine && pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() );\ - pTB->Invalidate( pTB->GetScrollRect() );\ - }\ - if ( pTB->GetItemRect(pTB->GetItemId(nItemPos)).IsEmpty() )\ - {\ - ReportError( aUId, GEN_RES_STR1( S_CANNOT_MAKE_BUTTON_VISIBLE_IN_TOOLBOX, MethodString( nMethodId ) ) );\ - bItemFound = sal_False;\ - }\ - }\ - }\ - }\ - } - - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteLinks); - break; - case M_Click : - { - FIND_ITEM; - if ( bItemFound ) // FIND_ITEM Erfolgreich - { - Rectangle aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos)); - if ( aRect.IsEmpty() ) - { - pTB->ExecuteCustomMenu(); - - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - - new StatementCommand( this, RC_MenuSelect, PARAM_UINT16_1, pTB->GetItemId(nItemPos) + TOOLBOX_MENUITEM_START ); - } - else - { - aRect = pTB->GetItemRect(pTB->GetItemId(nItemPos)); - MouseEvent aMEvnt; - aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT); - ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL ); - ImplMouseButtonUp ( pTB, aMEvnt, FORCE_DIRECT_CALL ); - } - } - } - break; - case M_TearOff : - { - FIND_ITEM; - if ( bItemFound ) // FIND_ITEM Erfolgreich - { - Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos ); - AnimateMouse( pControl, aRect.Center() ); - MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT); - ImplMouseButtonDown( pTB, aMEvnt, FORCE_DIRECT_CALL ); - - Window *pWin = NULL; - // Wait for the window to open. - StatementList::bExecuting = sal_True; // Bah ist das ein ekliger Hack - { // Das verhindert, da� schon der n�chste Befehl ausgef�hrt wird. - Time aDelay; - while ( !pWin && ( (pWin = GetPopupFloatingWin()) == NULL ) && ( Time() - aDelay ).GetSec() < 15 ) - SafeReschedule(); - } - StatementList::bExecuting = sal_False; // Bah ist das ein ekliger Hack - - if ( pWin && pWin->GetType() == WINDOW_FLOATINGWINDOW ) - { - aMEvnt = MouseEvent(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT); - ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL ); - ((FloatingWindow*)pWin)->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF ); - } - else - { - aMEvnt = MouseEvent(Point(1,-10), 1, MOUSE_SIMPLECLICK,MOUSE_LEFT); - ImplMouseButtonUp( pTB, aMEvnt, FORCE_DIRECT_CALL ); - ReportError( aUId, GEN_RES_STR1( S_TEAROFF_FAILED, MethodString( nMethodId ) ) ); - } - } - } - break; - case M_OpenMenu : - { - FIND_ITEM; - if ( bItemFound ) // FIND_ITEM Erfolgreich - { - Rectangle aRect = pTB->GetItemPosDropDownRect( nItemPos ); - AnimateMouse( pControl, aRect.Center() ); - MouseEvent aMEvnt(aRect.Center(),1,MOUSE_SIMPLECLICK,MOUSE_LEFT); - ImplMouseButtonDown( pTB, aMEvnt); - ImplMouseButtonUp( pTB, aMEvnt); - - // Das Fenster ist offen. - aSubMenuId1 = 0; - aSubMenuId2 = 0; - aSubMenuId3 = 0; - pMenuWindow = NULL; - } - } - break; - case _M_IsEnabled: - { - FIND_ITEM; - if ( bItemFound ) // FIND_ITEM Erfolgreich - { - pRet->GenReturn ( RET_Value, aUId, pTB->IsItemEnabled( pTB->GetItemId(nItemPos) ) ); - } - } - break; - case M_GetState : - { - FIND_ITEM; - if ( bItemFound ) // FIND_ITEM Erfolgreich - { - if ( ValueOK( aUId, CUniString("GetState"), nNr1, 4 ) ) - switch (nNr1) - { - case 0: - pRet->GenReturn ( RET_Value, aUId, Id2Str( pTB->GetHelpId(pTB->GetItemId(nItemPos)) ) ); - break; - case 1: - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemType(nItemPos)); - break; - case 2: - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemState(pTB->GetItemId(nItemPos))); - break; - case 3: - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemId(nItemPos)); - break; - default: - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0)); - break; - } - } - } - break; - case M_GetItemText : - pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetItemText(nNr1)); - break; - case M_GetText : - pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetText()); - break; - case M_GetItemCount : - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTB->GetItemCount()); - break; - case M_SetNextToolBox : - if ( (nParams & PARAM_STR_1) ) - pTB->SetNextToolBox( aString1 ); - else - pTB->SetNextToolBox( pTB->GetNextToolBox() ); - pTB->NextToolBox(); - break; - case M_GetNextToolBox : - pRet->GenReturn ( RET_Value, aUId, (String)pTB->GetNextToolBox()); - break; - case M_Dock : - case M_Undock : - case M_IsDocked : - case M_Close: - case M_Size: - case M_Move: - case M_IsMax: - case M_Minimize: - case M_Maximize: - case M_Help: // Alles was unten weiterbehandelt werden soll - goto DockingWin; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ToolBox" ) ); - break; - } - } - break; - - case C_TreeListBox: - switch( nMethodId ) - { - - - -#define GET_NTH_ENTRY_LBOX( First, Next, Anzahl) \ - SvLBoxEntry *pThisEntry = ((SvTreeListBox*)pControl)->First(); \ - { \ - int niTemp = Anzahl; \ - while ( niTemp-- ) \ - { \ - pThisEntry = ((SvTreeListBox*)pControl)->Next( pThisEntry ); \ - } \ - } - - case M_GetText : // Get the first text of the given (default=1) line - { // should get removed some time - SvTreeListBox *pTree = (SvTreeListBox*)pControl; - SvLBoxEntry *pThisEntry = pTree->GetCurEntry(); - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1; - if ( pThisEntry ) - { - SvLBoxString* pItem = NULL; - sal_uInt16 nValidTextItemCount = 0; - { - sal_uInt16 nIndex = 0; - SvLBoxItem *pMyItem; - while ( ( nValidTextItemCount < nNr1 ) && nIndex < pThisEntry->ItemCount() ) - { - pMyItem = pThisEntry->GetItem( nIndex ); - if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - pItem = (SvLBoxString*)pMyItem; - nValidTextItemCount++; - } - nIndex++; - } - } - if ( ValueOK( aUId, CUniString("GetText"), nNr1, nValidTextItemCount ) ) - pRet->GenReturn ( RET_Value, aUId, pItem->GetText() ); - } - else - ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) ); - } - break; - case M_GetSelCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((SvLBox*)pControl)->GetSelectionCount())); - break; - case M_GetItemCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(((SvLBox*)pControl)->GetVisibleCount()) ); - break; - case M_GetSelIndex : - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1; - if ( ValueOK(aUId, CUniString("GetSelIndex"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) ) - { - nNr1--; - GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1); - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( ((SvTreeListBox*)pControl)->GetVisiblePos( pThisEntry )) +1 ); - } - break; - case M_Select : - if ( ! (nParams & PARAM_BOOL_1) ) - bBool1 = sal_True; - if( nParams & PARAM_STR_1 ) - { - ReportError( aUId, GEN_RES_STR1( S_SELECT_DESELECT_VIA_STRING_NOT_IMPLEMENTED, MethodString( nMethodId ) ) ); - } - else - { - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) ) - { - SvLBoxEntry *pEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 ); - ((SvTreeListBox*)pControl)->Select ( pEntry, bBool1 ); - } - } - break; - case M_GetSelText : - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1; - if ( ! (nParams & PARAM_UINT16_2) ) - nNr2 = 1; - if ( ValueOK(aUId, CUniString("GetSelText"),nNr1,((SvLBox*)pControl)->GetSelectionCount()) ) - { - nNr1--; - GET_NTH_ENTRY_LBOX( FirstSelected, NextSelected, nNr1); - if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) ) - { - SvLBoxString* pItem = NULL; - if ( ! (nParams & PARAM_UINT16_2) ) - pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING ); - else - { - SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 ); - if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - pItem = (SvLBoxString*)pMyItem; - } - - if ( pItem ) - pRet->GenReturn ( RET_Value, aUId, pItem->GetText() ); - else - ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) ); - } - } - break; - case M_GetItemText : - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) ) - { - SvLBoxEntry *pThisEntry = (SvLBoxEntry*)((SvTreeListBox*)pControl)->GetEntryAtVisPos( nNr1-1 ); - if ( ! (nParams & PARAM_UINT16_2) ) - nNr2 = 1; - if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) ) - { - SvLBoxString* pItem = NULL; - if ( ! (nParams & PARAM_UINT16_2) ) - pItem = (SvLBoxString*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING ); - else - { - SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 ); - if ( pMyItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - pItem = (SvLBoxString*)pMyItem; - } - - if ( pItem ) - pRet->GenReturn ( RET_Value, aUId, pItem->GetText() ); - else - ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_STRING, MethodString( nMethodId ) ) ); - } - } - break; - case M_IsChecked : - case M_IsTristate : - case M_GetState : - case M_Check : - case M_UnCheck : - case M_TriState : - { - SvTreeListBox *pTree = (SvTreeListBox*)pControl; - SvLBoxEntry *pThisEntry = NULL; - - if ( ! (nParams & PARAM_UINT16_1) ) - { - pThisEntry = pTree->GetCurEntry(); - if ( !pThisEntry ) - ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) ); - } - else - { - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) ) - { - pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 ); - } - } - - if ( ! (nParams & PARAM_UINT16_2) ) - nNr2 = 1; - - if ( pThisEntry ) - { - if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) ) - { - SvLBoxButton* pItem = NULL; - if ( ! (nParams & PARAM_UINT16_2) ) - pItem = (SvLBoxButton*)pThisEntry->GetFirstItem( SV_ITEM_ID_LBOXBUTTON ); - else - { - SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 ); - if ( pMyItem->IsA() == SV_ITEM_ID_LBOXBUTTON ) - pItem = (SvLBoxButton*)pMyItem; - } - - if ( pItem ) - { - switch( nMethodId ) - { - case M_IsChecked : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateChecked() ) ); - break; - case M_IsTristate : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pItem->IsStateTristate() ) ); - break; - case M_GetState : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pItem->GetButtonFlags() & ~SV_STATE_MASK )); - break; - case M_Check : - if ( !pItem->IsStateChecked() ) - { - pItem->SetStateChecked(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); - } - break; - case M_UnCheck : - if ( pItem->IsStateChecked() || pItem->IsStateTristate() ) - { - pItem->SetStateUnchecked(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); - } - break; - case M_TriState : - if ( !pItem->IsStateTristate() ) - { - pItem->SetStateTristate(); - pTree->CheckButtonHdl(); - pTree->InvalidateEntry( pThisEntry ); - } - break; - default: - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - break; - } - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_LIST_BOX_BUTTON, MethodString( nMethodId ) ) ); - } - } - } - break; - case M_GetItemType : - { - SvTreeListBox *pTree = (SvTreeListBox*)pControl; - SvLBoxEntry *pThisEntry = NULL; - - if ( ! (nParams & PARAM_UINT16_1) ) - { - pThisEntry = pTree->GetCurEntry(); - if ( !pThisEntry ) - ReportError( aUId, GEN_RES_STR2c2( S_NO_SELECTED_ENTRY, MethodString( nMethodId ), "TreeListBox" ) ); - } - else - { - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,((SvLBox*)pControl)->GetVisibleCount()) ) - { - pThisEntry = (SvLBoxEntry*)pTree->GetEntryAtVisPos( nNr1-1 ); - } - } - - if ( pThisEntry ) - { - if ( ! (nParams & PARAM_UINT16_2) ) - nNr2 = 1; - if ( ValueOK( aUId, MethodString( nMethodId ),nNr2,pThisEntry->ItemCount() ) ) - { - SvLBoxItem *pMyItem = pThisEntry->GetItem( nNr2-1 ); - comm_UINT16 nType; - switch ( pMyItem->IsA() ) - { - case SV_ITEM_ID_LBOXSTRING: nType = CONST_ItemTypeText ; break; - case SV_ITEM_ID_LBOXBMP: nType = CONST_ItemTypeBMP ; break; - case SV_ITEM_ID_LBOXBUTTON: nType = CONST_ItemTypeCheckbox ; break; - case SV_ITEM_ID_LBOXCONTEXTBMP: nType = CONST_ItemTypeContextBMP ; break; - default: nType = CONST_ItemTypeUnknown; - } - pRet->GenReturn ( RET_Value, aUId, nType ); - } - } - } - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TreeListBox" ) ); - break; - } - break; - case C_Control: - { - sal_uInt16 nRealControlType = 0; - if ( dynamic_cast< EditBrowseBox* >(pControl) ) - nRealControlType = CONST_CTBrowseBox; - else if ( dynamic_cast< ValueSet* >(pControl) ) - nRealControlType = CONST_CTValueSet; - else if ( dynamic_cast< ORoadmap* >(pControl) ) - nRealControlType = CONST_CTORoadmap; - else if ( dynamic_cast< IExtensionListBox* >(pControl) ) - nRealControlType = CONST_CTIExtensionListBox; - else if ( dynamic_cast< ::svt::table::TableControl* >(pControl) ) - nRealControlType = CONST_CTTableControl; - else - nRealControlType = CONST_CTUnknown; - - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - default: - switch( nRealControlType ) - { - case CONST_CTBrowseBox: - { - EditBrowseBox* pEBBox = dynamic_cast< EditBrowseBox* >(pControl); - switch( nMethodId ) - { - case M_GetSelText : - { - pRet->GenReturn ( RET_Value, aUId, pEBBox->GetCellText( pEBBox->GetCurrRow(), pEBBox->GetColumnId( pEBBox->GetCurrColumn() ))); - } - break; - case M_GetColumnCount : - { - sal_uInt16 nColCount = pEBBox->GetColumnCount(); - comm_UINT16 nUnfrozenColCount = 0; - sal_uInt16 i; - for ( i=0 ; i < nColCount ; i++ ) - { - if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) ) - nUnfrozenColCount++; - } - pRet->GenReturn ( RET_Value, aUId, nUnfrozenColCount ); - } - break; - case M_GetRowCount : - { - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pEBBox->GetRowCount() ); - } - break; - case M_IsEditing : - { - CellControllerRef aControler; - aControler = pEBBox->Controller(); - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)aControler.Is() ); - } - break; - case M_Select : - { - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pEBBox->GetRowCount() ) ) - { - sal_uInt16 nColCount = pEBBox->GetColumnCount(); - comm_UINT16 nUnfrozenColCount = 0; - sal_uInt16 i; - for ( i=0 ; i < nColCount ; i++ ) - { - if ( !pEBBox->IsFrozen( pEBBox->GetColumnId( i ) ) ) - nUnfrozenColCount++; - } - if ( ValueOK(aUId, MethodString( nMethodId ),nNr2,nUnfrozenColCount ) ) - pEBBox->GoToRowColumnId( nNr1-1, pEBBox->GetColumnId( nNr2 ) ); - } - } - break; - - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "EditBrowseBox" ) ); - break; - } - } - break; - case CONST_CTValueSet: - { - ValueSet *pVS = dynamic_cast< ValueSet* >(pControl); - switch ( nMethodId ) - { - case M_GetItemCount: - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pVS->GetItemCount())); - break; - case M_GetItemText: - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() )) - pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetItemId( nNr1-1 ) ) ); - break; - case M_Select: - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pVS->GetItemCount() )) - pVS->SelectItem( pVS->GetItemId( nNr1-1 ) ); - break; - case M_GetSelIndex : - if ( pVS->IsNoSelection() ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(0)); - else - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pVS->GetItemPos( pVS->GetSelectItemId() ) +1)); - break; - case M_GetSelText : - if ( pVS->IsNoSelection() ) - pRet->GenReturn ( RET_Value, aUId, String() ); - else - pRet->GenReturn ( RET_Value, aUId, pVS->GetItemText( pVS->GetSelectItemId() ) ); - break; - case M_SetNoSelection : - pVS->SetNoSelection(); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "ValueSet" ) ); - break; - } - } - break; - case CONST_CTORoadmap: - { - ORoadmap *pRM = dynamic_cast< ORoadmap* >(pControl); - switch ( nMethodId ) - { - case M_GetItemCount: - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pRM->GetItemCount())); - break; - case M_GetItemText: - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() )) - pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetItemID( nNr1-1 ) ) ); - break; - case M_Select: - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() )) - { - if ( pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) ) - pRM->SelectRoadmapItemByID( pRM->GetItemID( nNr1-1 ) ); - else - ReportError( aUId, GEN_RES_STR1c( S_WIN_DISABLED, "RoadmapItem" ) ); - } - break; - case M_GetSelIndex : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pRM->GetItemIndex( pRM->GetCurrentRoadmapItemID() ) +1)); - break; - case M_GetSelText : - pRet->GenReturn ( RET_Value, aUId, pRM->GetRoadmapItemLabel( pRM->GetCurrentRoadmapItemID() ) ); - break; - case M_IsItemEnabled : - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pRM->GetItemCount() )) - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)pRM->IsRoadmapItemEnabled( pRM->GetItemID( nNr1-1 ) ) ); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) ); - break; - } - } - break; - case CONST_CTIExtensionListBox: - { - IExtensionListBox *pELB = dynamic_cast< IExtensionListBox* >(pControl); - switch ( nMethodId ) - { - case M_GetItemCount: - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pELB->getItemCount())); - break; - case M_GetItemText: - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() )) - switch ( nNr2 ) - { - case 1: - pRet->GenReturn ( RET_Value, aUId, pELB->getItemName( nNr1 -1 ) ); - break; - case 2: - pRet->GenReturn ( RET_Value, aUId, pELB->getItemVersion( nNr1 -1 ) ); - break; - case 3: - pRet->GenReturn ( RET_Value, aUId, pELB->getItemDescription( nNr1 -1 ) ); - break; - case 4: - pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisher( nNr1 -1 ) ); - break; - case 5: - pRet->GenReturn ( RET_Value, aUId, pELB->getItemPublisherLink( nNr1 -1 ) ); - break; - default: - ValueOK( aUId, MethodString( nMethodId ).AppendAscii(" String Number"), nNr2, 5 ); - } - break; - case M_Select: - if ( (nParams & PARAM_UINT16_1) ) - { - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pELB->getItemCount() )) - { - pELB->select( nNr1-1 ); - } - } - else if ( (nParams & PARAM_STR_1) ) - { - pELB->select( aString1 ); - sal_Bool bSuccess = sal_True; - if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND ) - bSuccess = sal_False; - else - { - if ( !aString1.Equals( String( pELB->getItemName( pELB->getSelIndex() ) ) ) ) - bSuccess = sal_False; - } - if ( !bSuccess ) - ReportError( aUId, GEN_RES_STR2( S_ENTRY_NOT_FOUND, MethodString( nMethodId ), aString1 ) ); - } - break; - case M_GetSelCount : - if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 0 )); - else - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 1 )); - break; - case M_GetSelIndex : - if ( pELB->getSelIndex() == EXTENSION_LISTBOX_ENTRY_NOTFOUND ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( 0 )); - else - pRet->GenReturn ( RET_Value, aUId, comm_UINT32( pELB->getSelIndex() +1)); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "RoadMap" ) ); - break; - } - } - break; - - case CONST_CTTableControl: - { - ::svt::table::TableControl *pTC = dynamic_cast< ::svt::table::TableControl* >(pControl); - switch ( nMethodId ) - { - case M_GetItemType : - { - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) && - ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() )) - { - ::svt::table::PTableModel pModel = pTC->GetModel(); - Any aCell; - pModel->getCellContent( nNr1-1, nNr2-1, aCell ); - pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() )); - } - } - break; - case M_GetItemText : - { - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetColumnCount() ) && - ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() )) - { - ::svt::table::PTableModel pModel = pTC->GetModel(); - Any aCell; - pModel->getCellContent( nNr1-1, nNr2-1, aCell ); - - Type aType = aCell.getValueType(); - TypeClass eTypeClass = aType.getTypeClass(); - switch( eTypeClass ) - { - case TypeClass_BOOLEAN: - pRet->GenReturn ( RET_Value, aUId, *(sal_Bool*)aCell.getValue() ); - break; - case TypeClass_CHAR: - { - ::rtl::OUString aContent( *(sal_Unicode*)aCell.getValue() ); - pRet->GenReturn ( RET_Value, aUId, aContent ); - } - break; - case TypeClass_STRING: - { - ::rtl::OUString aContent; - aCell >>= aContent; - pRet->GenReturn ( RET_Value, aUId, aContent ); - } - break; - case TypeClass_BYTE: - case TypeClass_SHORT: - case TypeClass_LONG: - case TypeClass_HYPER: - case TypeClass_UNSIGNED_LONG: - case TypeClass_UNSIGNED_HYPER: - { - comm_UINT32 val = 0; - aCell >>= val; - pRet->GenReturn ( RET_Value, aUId, val ); - } - break; - case TypeClass_UNSIGNED_SHORT: - { - comm_UINT16 val = 0; - aCell >>= val; - pRet->GenReturn ( RET_Value, aUId, val ); - } - break; - default: - pRet->GenReturn ( RET_Value, aUId, comm_UINT16(0) ); - break; - } - } - } - break; - case M_GetColumnCount : - { - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTC->GetColumnCount() ); - } - break; - case M_GetRowCount : - { - pRet->GenReturn ( RET_Value, aUId, (comm_UINT32)pTC->GetRowCount() ); - } - break; - case M_Select : - { - if ( ValueOK( aUId, MethodString( nMethodId ), nNr1, pTC->GetRowCount() )) - { - if ( pTC->GoToRow( ::svt::table::RowPos( nNr1-1 ) ) ) - { - Size aSize( pTC->GetSizePixel() ); - Point aPos( aSize.Width() / 2, aSize.Height() / 2 ); - long nStep = aSize.Height() / 4; - ::svt::table::RowPos nLastPos; - while ( ( nLastPos = pTC->getTableControlInterface().hitTest( aPos ).nRow ) != nNr1-1 && nStep > 0 ) - { - if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID ) - aPos.Y() -= nStep; - else - aPos.Y() += nStep; - nStep /= 2; - } - if ( pTC->getTableControlInterface().hitTest( aPos ).nRow == nNr1-1 ) - { - MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1); - pTC->getSelEngine()->SelMouseButtonDown( aMEvnt ); - pTC->getSelEngine()->SelMouseButtonUp( aMEvnt ); - if ( pTC->IsRowSelected( nNr1-1 ) ) - pTC->Select(); - } - else - ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "find pos" ) ); - } - else - ReportError( aUId, GEN_RES_STR2c2( S_METHOD_FAILED, MethodString( nMethodId ), "GoTo" ) ); - } - } - break; - case M_GetSelCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT16( pTC->GetSelectedRowCount() )); - break; - case M_GetSelIndex : - if ( ! (nParams & PARAM_UINT16_1) ) - nNr1 = 1; - if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRowCount() ) ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT16( pTC->GetSelectedRowIndex( nNr1-1 ) +1 ) ); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "TableControl" ) ); - break; - } - } - break; - - case CONST_CTUnknown: - ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) ); - break; - default: - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - break; - } - } - break; - } - case C_Window: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Window" ) ); - break; - } - break; - - case C_DockingWin: - DockingWin: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_Dock : - if ( ((DockingWindow*)pControl)->IsFloatingMode() ) - ((DockingWindow*)pControl)->SetFloatingMode(sal_False); - else - ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) ); - break; - case M_Undock : - if ( !((DockingWindow*)pControl)->IsFloatingMode() ) - ((DockingWindow*)pControl)->SetFloatingMode(sal_True); - else - ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_FLOATING_MODE, MethodString( nMethodId ) ) ); - break; - case M_IsDocked : - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL) !((DockingWindow*)pControl)->IsFloatingMode()); - break; - case M_Close: - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((DockingWindow*)pControl)->Close(); - break; - case M_Size: - case M_Move: - case M_IsMax: - case M_Minimize: - case M_Maximize: - if ( ((DockingWindow*)pControl)->IsFloatingMode() ) - { - Window* pFloat = ((DockingWindow*)pControl)->GetFloatingWindow(); - if ( !pFloat && ((DockingWindow*)pControl)->IsFloatingMode() ) - { - if ( pControl->GET_REAL_PARENT() && pControl->GET_REAL_PARENT()->GetType() == WINDOW_FLOATINGWINDOW ) - pFloat = pControl->GET_REAL_PARENT(); - else - { - OSL_FAIL("FloatingMode set but Parent is no FloatingWindow"); - } - } - if ( pFloat && pFloat->GetType() == WINDOW_FLOATINGWINDOW ) - { - pControl = pFloat; - goto FloatWin; - } - else - ReportError( aUId, GEN_RES_STR1( S_CANNOT_FIND_FLOATING_WIN, MethodString( nMethodId ) ) ); - } - else - ReportError( aUId, GEN_RES_STR1( S_ALLOWED_ONLY_IN_DOCKING_MODE, MethodString( nMethodId ) ) ); - break; - case M_Help: // Alles was unten weiterbehandelt werden soll - goto MoreDialog; - - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "DockingWindow" ) ); - break; - } - break; - case C_FloatWin: - FloatWin: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_IsMax : - pRet->GenReturn ( RET_Value, aUId, (comm_BOOL)!((FloatingWindow*)pControl)->IsRollUp()); - break; - case M_Minimize : - ((FloatingWindow*)pControl)->RollUp(); - break; - case M_Maximize : - ((FloatingWindow*)pControl)->RollDown(); - break; - case M_Size: - { - if ( pControl->GetStyle() & WB_SIZEABLE ) - { - Size aMin = ((FloatingWindow*)pControl)->GetMinOutputSizePixel(); - if ( aMin.Width() <= nNr1 && aMin.Height() <= nNr2 ) - { - pControl->SetSizePixel(Size(nNr1,nNr2)); - pControl->Resize(); - } - else - { - ReportError( aUId, GEN_RES_STR2( S_SIZE_BELOW_MINIMUM, String::CreateFromInt32( aMin.Width() ), String::CreateFromInt32( aMin.Height() ) ) ); - } - } - else - ReportError( aUId, GEN_RES_STR1( S_SIZE_NOT_CHANGEABLE, MethodString( nMethodId ) ) ); - break; - } - case M_Close: - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((FloatingWindow*)pControl)->Close(); - break; - case M_Help: // Alles was unten weiterbehandelt werden soll - case M_Move: - goto MoreDialog; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "FloatingWin" ) ); - break; - } - break; - case C_ModelessDlg: - case C_ModalDlg: - case C_Dialog: - case C_TabDlg: - MoreDialog: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_Close: - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((SystemWindow*)pControl)->Close(); - break; - case M_OK: - { - Window *pChild = GetWinByRT( pControl, WINDOW_OKBUTTON ); - if( ControlOK( pChild, "OK Button" ) ) - { - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((Button*)pChild)->Click(); - } - break; - } - case M_Cancel: - { - Window *pChild = GetWinByRT( pControl, WINDOW_CANCELBUTTON ); - if( ControlOK( pChild, "Cancel Button" ) ) - { - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((Button*)pChild)->Click(); - } - break; - } - case M_Help: - { - Window *pChild = GetWinByRT( pControl, WINDOW_HELPBUTTON ); - if( ControlOK( pChild, "Help Button" ) ) - ((Button*)pChild)->Click(); - break; - } - case M_Default: - { - Window *pChild = ImpGetButton( pControl, WB_DEFBUTTON, WB_DEFBUTTON ); - if( ControlOK( pChild, "Default Button" ) ) - ((Button*)pChild)->Click(); - break; - } - case M_Move: - { - pControl->SetPosPixel(Point(nNr1,nNr2)); - break; - } - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "Dialog" ) ); - break; - } - break; - case C_WorkWin: - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, MitteOben); - break; - case M_Close: - DBG_ASSERT( aUId.equals( pControl->GetUniqueOrHelpId() ), "aUID != UniqueOrHelpId"); - SET_WINP_CLOSING(pControl); - ((WorkWindow*)pControl)->Close(); - break; - case M_Size: - case M_Move: - goto FloatWin; - case M_IsMax : - pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMaximized() ); - break; - case M_IsMin : - pRet->GenReturn ( RET_Value, aUId, ((WorkWindow*)pControl)->IsMinimized() ); - break; - case M_IsRestore : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL (!((WorkWindow*)pControl)->IsMaximized() && !((WorkWindow*)pControl)->IsMinimized()) ); - break; - case M_Minimize : - ((WorkWindow*)pControl)->Maximize( sal_False ); - ((WorkWindow*)pControl)->Minimize(); - break; - case M_Maximize : - ((WorkWindow*)pControl)->Maximize(); - break; - case M_Restore : - ((WorkWindow*)pControl)->Maximize( sal_False ); - ((WorkWindow*)pControl)->Restore(); - break; - case M_Help: // Alles was unten weiterbehandelt werden soll - goto MoreDialog; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "WorkWindow" ) ); - break; - } - break; - case C_TabPage: - ReportError( aUId, GEN_RES_STR1( S_INTERNAL_ERROR, MethodString( nMethodId ) ) ); - break; - case C_MessBox: - case C_InfoBox: - case C_WarningBox: - case C_ErrorBox: - case C_QueryBox: - { - sal_Bool bDone = sal_True; - MessBox* pMB = (MessBox*)pControl; - switch( nMethodId ) - { - case M_GetCheckBoxText: - pRet->GenReturn ( RET_Value, aUId, pMB->GetCheckBoxText() ); - break; - case M_IsChecked : - pRet->GenReturn ( RET_Value, aUId, comm_BOOL( pMB->GetCheckBoxState() == STATE_CHECK) ); - break; - case M_Check : - pMB->SetCheckBoxState( sal_True ); - break; - case M_UnCheck : - pMB->SetCheckBoxState( sal_False ); - break; - case M_GetText : - pRet->GenReturn ( RET_Value, aUId, pMB->GetMessText()); - break; - - default: - bDone = sal_False; - break; - } - if ( bDone ) - break; // break the case here else continue at C_ButtonDialog - } - case C_ButtonDialog: - { - ButtonDialog* pBD = (ButtonDialog*)pControl; -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "Working MessBox: " ); - if (pControl->IsVisible()) - m_pDbgWin->AddText("*(Visible)\n"); - else - m_pDbgWin->AddText("*(nicht Visible)\n"); -#endif - switch( nMethodId ) - { - case M_AnimateMouse : - AnimateMouse( pControl, Mitte); - break; - case M_OK: - if ( pBD->GetPushButton( BUTTONID_OK ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_OK); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_OK_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_Cancel: - if ( pBD->GetPushButton( BUTTONID_CANCEL ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_CANCEL); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_CANCEL_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_Yes: - if ( pBD->GetPushButton( BUTTONID_YES ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_YES); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_YES_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_No: - if ( pBD->GetPushButton( BUTTONID_NO ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_NO); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_NO_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_Repeat: - if ( pBD->GetPushButton( BUTTONID_RETRY ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_RETRY); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_RETRY_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_Help: - if ( pBD->GetPushButton( BUTTONID_HELP ) ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(BUTTONID_HELP); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_HELP_BUTTON, MethodString( nMethodId ) ) ); - break; - case M_Default: - { - WinBits Style = pControl->GetStyle(); - if ( Style & WB_DEF_OK ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_OK); - } - else if ( Style & WB_DEF_CANCEL ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_CANCEL); - } - else if ( Style & WB_DEF_YES ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_YES); - } - else if ( Style & WB_DEF_NO ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_NO); - } - else if ( Style & WB_DEF_RETRY ) - { - SET_WINP_CLOSING(pControl); - pBD->EndDialog(RET_RETRY); - } - else - ReportError( aUId, GEN_RES_STR1( S_NO_DEFAULT_BUTTON, MethodString( nMethodId ) ) ); - } - break; - case M_GetText : - pRet->GenReturn ( RET_Value, aUId, pControl->GetText()); - break; - case M_Click: - if ( nParams & PARAM_UINT16_1 ) - { - if ( pBD->GetPushButton( nNr1 ) ) - { - if ( nNr1 != BUTTONID_HELP ) - { - SET_WINP_CLOSING(pControl); - } - pBD->GetPushButton( nNr1 )->Click(); - } - else - ReportError( aUId, GEN_RES_STR2( S_NO_DEFAULT_BUTTON, UniString::CreateFromInt32( nNr1 ), MethodString( nMethodId ) ) ); - } - else - ReportError( aUId, GEN_RES_STR1( S_BUTTONID_REQUIRED, MethodString( nMethodId ) ) ); - break; - case M_GetButtonCount : - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pBD->GetButtonCount())); - break; - case M_GetButtonId : - if ( ValueOK(aUId, MethodString( nMethodId ),nNr1,pBD->GetButtonCount()) ) - pRet->GenReturn ( RET_Value, aUId, comm_UINT32(pBD->GetButtonId(nNr1-1))); - break; - default: - ReportError( aUId, GEN_RES_STR2c2( S_UNKNOWN_METHOD, MethodString(nMethodId), "MessageBox" ) ); - break; - } - break; - } - default: - OSL_FAIL( "Unknown Objekttype from UId or Method not suported" ); - ReportError( aUId, GEN_RES_STR2( S_UNKNOWN_TYPE, UniString::CreateFromInt32( nRT ), MethodString(nMethodId) ) ); -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( " Unknown Objekttype from UId or Method not suported" ); -#endif - break; - } - } - for( int i = 0; i < 32; i++ ) - SafeReschedule(); - } -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( "\n" ); -#endif - if ( bStatementDone ) - { - SendProfile( UIdString( aUId ).Append('.').Append( MethodString( nMethodId ) ) ); - delete this; - } - else - { - if ( nRetryCount-- ) - { -#if OSL_DEBUG_LEVEL > 1 - m_pDbgWin->AddText( CUniString("Reschedule command (requed) (").Append( UniString::CreateFromInt32(nRetryCount) ).AppendAscii(")\n") ); -#endif - QueStatement( this ); // will que at the start of the list - } - else - { - bStatementDone=sal_True; - } - } - return bStatementDone; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/statemnt.hxx b/automation/source/server/statemnt.hxx deleted file mode 100644 index fa8f0ffdd..000000000 --- a/automation/source/server/statemnt.hxx +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -/*************************************************************************** -** -** Von StatementList werden alle Statements abgeleitet. -** Es gibt immer nur eine Statementliste, die verpointert ist. -** jederzeit kann das der Anfang der Kette abgefragt werden. -** -***************************************************************************/ -#ifndef _STATEMNT_HXX -#define _STATEMNT_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class Window; -class SystemWindow; -class Point; -class SfxPoolItem; - -class ScrollBar; - -class SCmdStream; -class RetStream; -class ImplRemoteControl; - -class TTProfiler; -class TTProperties; - -class Dir; - -class CommunicationLink; - -#if OSL_DEBUG_LEVEL > 1 -class EditWindow; -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - void SAL_CALL osl_TestToolDebugPrint( const sal_Char *pString ); -#ifdef __cplusplus -} -#endif - - -#define IsVisible IsReallyVisible -#define GET_REAL_PARENT() GetWindow( WINDOW_REALPARENT ) - -// switch behaviour of ImplMouse* and ImplKeyInput -#define FORCE_DIRECT_CALL sal_True - -typedef sal_uInt16 SearchFlags; -#define SEARCH_NOOVERLAP ((SearchFlags) 0x0001) -#define SEARCH_NO_TOPLEVEL_WIN ((SearchFlags) 0x0002) -#define SEARCH_FOCUS_FIRST ((SearchFlags) 0x0004) -#define SEARCH_FIND_DISABLED ((SearchFlags) 0x0008) - -class Search -{ - SearchFlags nmSearchFlags; -public: - Search( SearchFlags nSearchFlags = 0): nmSearchFlags(nSearchFlags) {} - virtual ~Search() {} - - virtual sal_Bool IsWinOK( Window *pWin ) = 0; - SearchFlags GetSearchFlags() { return nmSearchFlags; } - void AddSearchFlags( SearchFlags aNewFlags ) { nmSearchFlags |= aNewFlags; } - void RemoveSearchFlags( SearchFlags aRemoveFlags ) { nmSearchFlags &= ( ~aRemoveFlags ); } - sal_Bool HasSearchFlag( SearchFlags aQueryFlag ) { return (nmSearchFlags & aQueryFlag) == aQueryFlag; } -}; - -sal_Bool IsDialog(Window *pWin); // Ist *pWin von SystemWindow abgeleitet (Kann es Active sein) -sal_Bool IsAccessable(Window *pWin); // Ist *pWin Zugreifbar (�ber IsEnabled und Parents gepr�ft) - - -class SafePointer -{ - SafePointer *pSelf; -public: - SafePointer() { pSelf = this; } - virtual ~SafePointer() { DBG_ASSERT(pSelf==this,"Destructor von Nicht existierendem Objekt aufgerufen"); - pSelf = NULL; } -}; - - -class DisplayHidWin; -class StatementCommand; -class TranslateWin; - -struct TTSettings -{ - // DisplayHID - StatementCommand *pDisplayInstance; - DisplayHidWin *pDisplayHidWin; - Window *Old; - Window *Act; - String aOriginalCaption; - - // Translate - TranslateWin *pTranslateWin; - sal_Bool bToTop; -}; - - -TTSettings* GetTTSettings(); - - -#define MAX_RETRIES 9 -class StatementList : public SafePointer -{ -private: - StatementList(const StatementList&); - StatementList & operator=(const StatementList&); - -protected: - StatementList(); - sal_uInt16 nRetryCount; - void QueStatement(StatementList *pAfterThis); - sal_Bool bStatementInQue; - static sal_uInt16 nUseBindings; - - static TTProfiler *pProfiler; - void InitProfile(); - void SendProfile( String aText ); - static StatementList *pCurrentProfileStatement; - - static sal_Bool bIsInReschedule; - static sal_uInt16 nModalCount; - static Window *pLastFocusWindow; // Wenn dieses sich �ndert wird Safe Reschedule abgebrochen - static sal_Bool bWasDragManager; // Wenn dieses sich �ndert wird Safe Reschedule abgebrochen - static sal_Bool bWasPopupMenu; // Wenn dieses sich �ndert wird Safe Reschedule abgebrochen - static sal_Bool bBasicWasRunning; - - static sal_uInt16 nMinTypeKeysDelay; /// Verz�gerung der einzelnen Anschl�ge f�r TypeKeys - static sal_uInt16 nMaxTypeKeysDelay; - static sal_Bool bDoTypeKeysDelay; - - static Window* pFirstDocFrame; - - static sal_Bool bIsSlotInExecute; - -public: - static sal_Bool IsInReschedule() { return bIsInReschedule; } - void SafeReschedule( sal_Bool bYield = sal_False ) // Setzt Flag, so da� nicht schon der n�chste Befehl ausgef�hrt wird - { - nModalCount = Application::GetModalModeCount(); - bIsInReschedule = sal_True; - pLastFocusWindow = GetpApp()->GetFocusWindow(); - bWasDragManager = false /*!= DragManager::GetDragManager()*/; - bWasPopupMenu = NULL != PopupMenu::GetActivePopupMenu(); - bBasicWasRunning = StarBASIC::IsRunning(); - bWasExecuting = bExecuting; - if ( bYield ) - GetpApp()->Yield(); - else - GetpApp()->Reschedule(); - bExecuting = bWasExecuting; - bBasicWasRunning = sal_False; - bWasPopupMenu = sal_False; - bWasDragManager = sal_False; - pLastFocusWindow = NULL; - bIsInReschedule = sal_False; - nModalCount = 0; - } - static sal_Bool MaybeResetSafeReschedule() - { // Implementierung mu� hier zwar nicht sein, ist aber �bersichtlicher so - if ( !bIsInReschedule ) - return sal_False; - - if ( pLastFocusWindow != GetpApp()->GetFocusWindow() - || ( Application::GetModalModeCount() > nModalCount ) - || ( PopupMenu::GetActivePopupMenu() && !bWasPopupMenu ) - || ( StarBASIC::IsRunning() && !bBasicWasRunning ) ) - { - bIsInReschedule = sal_False; - pLastFocusWindow = NULL; - return sal_True; - } - else - return sal_False; - } - static void NormalReschedule() // Setzt das flag nicht - { - GetpApp()->Reschedule(); - } -#define Reschedule RescheduleNichtBenutzen_StattdessenSafeRescheduleAnStatementList - - static Window* GetMouseWin(); - static sal_Bool WinPtrValid(Window *pTest); - static Window* SearchAllWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase = sal_True ); -protected: - static Window* SearchClientWin( Window *pBase, Search &aSearch, sal_Bool MaybeBase = sal_True ); - - Window* SearchTree( rtl::OString aUId, sal_Bool bSearchButtonOnToolbox = sal_False ); - Window* GetActive( WindowType nRT, sal_Bool MaybeBase = sal_True ); - Window* GetFocus( WindowType nRT, sal_Bool MaybeBase = sal_True ); - Window* GetAnyActive( sal_Bool MaybeBase = sal_True ); - ScrollBar* GetScrollBar( Window *pBase, sal_uInt16 nDirection, sal_Bool MaybeBase = sal_True ); - Window* GetPopupFloatingWin( sal_Bool MaybeBase = sal_True ); - Menu* GetMatchingMenu( Window* pWin, Menu* pBaseMenu = NULL ); - Window* GetWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase = sal_True, sal_uInt16 nSkip = 0, sal_Bool bSearchAll = sal_False ); - sal_uInt16 CountWinByRT( Window *pBase, WindowType nRT, sal_Bool MaybeBase = sal_True ); - Window* GetDocWin( sal_uInt16 nNr ); - sal_uInt16 GetDocWinCount(); - Window* GetFadeSplitWin( Window *pBase, WindowAlign nAlign, sal_Bool MaybeBase = sal_True ); - sal_Bool ValueOK(rtl::OString nId, String aBezeichnung, sal_uLong nValue, sal_uLong nMax); - - sal_uInt16 GetCurrentMenues( PopupMenu *&pPopup, MenuBar *&pMenuBar, Menu *&pMenu ); - -public: - virtual ~StatementList(); - void Advance(); - virtual sal_Bool Execute() = 0; -/*************************************************************************** -** Bestimmt erst den n�chsten Befehl, setzt Current -** und f�hrt dann aus. -** Returnwert gibt an, ob Befehl nochmal ausgef�hrt -** werden soll. Dann mu� auch der UserEvent verlassen werden, um der Applikation -** normales Arbeiten zu erm�glichen (Dialog schliessen) -** sal_True bedeutet, dass alles klar gegangen ist -** sal_False bedeutet nochmal Bitte -***************************************************************************/ - - void ReportError(String aMessage); - void ReportError(rtl::OString aUId, String aMessage); - void ReportError(String aMessage, sal_uLong nWhatever); - - static void DirectLog( sal_uLong nType, String aString ); - - String Tree(Window *pBase, int Indent); - String ClientTree(Window *pBase, int Indent); - - StatementList *pNext; - static StatementList /**pCurrent,*/ *pFirst; - static sal_Bool bReadingCommands; - static rtl::OString aWindowWaitUId; - static Window *pWindowWaitPointer; - static rtl::OString aWindowWaitOldHelpId; - static rtl::OString aWindowWaitOldUniqueId; - static RetStream *pRet; - static sal_Bool IsError; - static sal_Bool bDying; - static sal_Bool bExecuting; // Gesetzt, wenn ein Befehl rescheduled ohne einen neuen Befehl zu erlauben - sal_Bool bWasExecuting; // Wurde bei einem MaybeResetSafeReschedule resettet, so wird der Zustand danach wiederhergestellt - static sal_uInt16 aSubMenuId1; // Untermen�s bei PopupMenus - static sal_uInt16 aSubMenuId2; // erstmal 2-Stufig - static sal_uInt16 aSubMenuId3; // and now even 3 levels #i31512# - static SystemWindow *pMenuWindow; // when using MenuBar as base for MenuCommands - static TTProperties *pTTProperties; // Hier stehen die SlotIDs aus dem SFX drin - - sal_Bool CheckWindowWait(); //True heisst, dass Window noch existiert - //False -> Window weg; - static void SetFirstDocFrame( Window* pWin ); - static Window* GetFirstDocFrame(); - static sal_Bool IsFirstDocFrame( Window* pWin ); - static sal_Bool IsDocWin( Window* pWin ); - static sal_Bool IsIMEWin( Window* pWin ); // Input Window for CJK under Solaris - static sal_Bool IsDocFrame( Window* pWin ); - static MenuBar* GetDocFrameMenuBar( Window* pWin ); - static sal_uInt16 GetDocFrameCount(); - - static sal_Bool bCatchGPF; - - static sal_Bool bUsePostEvents; // use Application::Post*Event or own impl to handle key and mouseevents - -#if OSL_DEBUG_LEVEL > 1 - static EditWindow *m_pDbgWin; -#endif -}; - -class StatementSlot : public StatementList //Slots aufrufen -{ -protected: - sal_uInt16 nAnzahl; - SfxPoolItem **pItemArr; - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aArgs; - sal_uInt16 nFunctionId; // can get removed when the old (numeric) slothandling is removed - String aUnoUrl; - sal_Bool bMenuClosed; - - StatementSlot(); - void AddReferer(); -public: - StatementSlot( SCmdStream *pIn ); - StatementSlot( sal_uLong nSlot, SfxPoolItem* pItem = NULL ); - virtual ~StatementSlot(); - virtual sal_Bool Execute(); -}; - -class StatementUnoSlot : public StatementSlot //Uno Slots aufrufen -{ -public: - StatementUnoSlot(SCmdStream *pIn); -}; - -union munge -{ - comm_UINT32 nLNr1; - Window *pWindow; -}; - -class StatementCommand : public StatementList // Befehl ausf�hren (wintree, resetaplication ...) -{ - friend class ImplRemoteControl; -protected: - sal_uInt16 nMethodId; - sal_uInt16 nParams; - comm_UINT16 nNr1,nNr2,nNr3,nNr4; - munge nLNr1_and_Pointer; - String aString1,aString2; - sal_Bool bBool1,bBool2; - - Window* GetNextOverlap( Window* pBase ); - Window* GetNextRecoverWin(); - - static sal_uInt16 nDirPos; - static Dir *pDir; - static pfunc_osl_printDebugMessage pOriginal_osl_DebugMessageFunc; - - - sal_Bool UnpackStorage( SotStorageRef xStorage, DirEntry &aBaseDir ); - - void HandleSAXParser(); - -public: - StatementCommand( SCmdStream *pIn ); - StatementCommand( StatementList *pAfterThis, sal_uInt16 MethodId, sal_uInt16 Params, sal_uInt16 Nr1 ); - virtual sal_Bool Execute(); - sal_Bool DisplayHID(); - void Translate(); - void WriteControlData( Window *pBase, sal_uLong nConf, sal_Bool bFirst = sal_True ); - -}; - - -enum TTHotSpots { MitteLinks, Mitte, MitteOben }; - -class StatementControl : public StatementList -{ -protected: - rtl::OString aUId; - sal_uInt16 nMethodId; - sal_uInt16 nParams; - comm_UINT16 nNr1,nNr2,nNr3,nNr4; - comm_UINT32 nLNr1; - String aString1,aString2; - sal_Bool bBool1,bBool2; - sal_Bool ControlOK( Window *pControl, const sal_Char* aBezeichnung ); - void AnimateMouse( Window *pControl, TTHotSpots aWohin ); - void AnimateMouse( Window *pControl, Point aWohin ); - - sal_Bool MaybeDoTypeKeysDelay( Window *pTestWindow ); - - sal_Bool HandleVisibleControls( Window *pControl ); - sal_Bool HandleCommonMethods( Window *pControl ); - -public: - StatementControl( SCmdStream *pIn, sal_uInt16 nControlType ); - virtual sal_Bool Execute(); - -}; - -class StatementFlow : public StatementList // Kommunikation mit Sequence -{ - sal_uInt16 nArt; - - sal_uInt16 nParams; - comm_UINT16 nSNr1; - comm_UINT32 nLNr1; - String aString1; - sal_Bool bBool1; - - -public: - StatementFlow (sal_uLong nServiceId, SCmdStream *pIn, ImplRemoteControl *pRC ); - StatementFlow( StatementList *pAfterThis, sal_uInt16 nArtP ); - virtual sal_Bool Execute(); - static CommunicationLink *pCommLink; - static sal_Bool bSending; - - static sal_Bool bUseIPC; // Soll zur r�ckmeldung IPC verwendet werden? - static ImplRemoteControl *pRemoteControl; // Static f�r 2. Constructor - -private: - void SendViaSocket(); -}; - -class SearchUID : public Search -{ - Window *pMaybeResult; - Window *pAlternateResult; - rtl::OString aUId; - sal_Bool bSearchButtonOnToolbox; -public: - SearchUID( rtl::OString aUIdP, sal_Bool bSearchButtonOnToolboxP ): Search( SEARCH_FOCUS_FIRST ), pMaybeResult(NULL), pAlternateResult(NULL), aUId(aUIdP), bSearchButtonOnToolbox(bSearchButtonOnToolboxP) {} - virtual sal_Bool IsWinOK( Window *pWin ); - Window* GetMaybeWin() { return pMaybeResult; } - Window* GetAlternateResultWin() { return pAlternateResult; } -}; -class SearchActive : public Search -{ - WindowType nRT; -public: - SearchActive( WindowType nRTP ): nRT(nRTP) {} - virtual sal_Bool IsWinOK( Window *pWin ); -}; -class SearchPopupFloatingWin : public Search -{ -public: - SearchPopupFloatingWin(): Search( SEARCH_FOCUS_FIRST ) {} - virtual sal_Bool IsWinOK( Window *pWin ); -}; -class SearchRT : public Search -{ - WindowType mnRT; - sal_uInt16 mnSkip; - sal_uInt16 mnCount; -public: - SearchRT( WindowType nRTP, SearchFlags nSearchFlags, sal_uInt16 nSkip = 0 ): Search(nSearchFlags), mnRT(nRTP), mnSkip( nSkip ), mnCount( 0 ) {} - virtual sal_Bool IsWinOK( Window *pWin ); - sal_uInt16 GetCount(){ return mnCount; } -}; -class SearchScroll : public SearchRT -{ - sal_uInt16 nDirection; -public: - SearchScroll( sal_uInt16 nDir, SearchFlags nSearchFlags ): SearchRT(WINDOW_SCROLLBAR, nSearchFlags), nDirection(nDir) {} - virtual sal_Bool IsWinOK( Window *pWin ); -}; -class SearchWinPtr : public Search -{ - Window *pTest; -public: - SearchWinPtr( Window *pTestP ): pTest(pTestP) {} - virtual sal_Bool IsWinOK( Window *pWin ); -}; -class SearchFadeSplitWin : public Search -{ - WindowAlign nAlign; -public: - SearchFadeSplitWin( WindowAlign nAlignP ): nAlign(nAlignP) {} - virtual sal_Bool IsWinOK( Window *pWin ); -}; - - -void ImplKeyInput( Window* pWin, KeyEvent &aKEvnt, sal_Bool bForceDirect=sal_False ); -void ImplMouseMove( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False ); -void ImplMouseButtonDown( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False ); -void ImplMouseButtonUp( Window* pWin, MouseEvent &aMEvnt, sal_Bool bForceDirect=sal_False ); -void ImplCommand( Window* pWin, CommandEvent &aCmdEvnt ); -void ImplEventWait( sal_uLong nID ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/svcommstream.cxx b/automation/source/server/svcommstream.cxx deleted file mode 100644 index 730cfabc6..000000000 --- a/automation/source/server/svcommstream.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include "svcommstream.hxx" - -SvCommStream::SvCommStream( SvStream* pIO ) { pStream = pIO; } -SvCommStream::~SvCommStream() {} - -ICommStream& SvCommStream::operator>>( comm_UINT16& rUShort ) { *pStream >> rUShort; return *this; } -ICommStream& SvCommStream::operator>>( comm_UINT32& rULong ) { *pStream >> rULong; return *this; } -ICommStream& SvCommStream::operator>>( comm_BOOL& rChar ) { *pStream >> rChar; return *this; } - -ICommStream& SvCommStream::operator<<( comm_UINT16 nUShort ) { *pStream << nUShort; return *this; } -ICommStream& SvCommStream::operator<<( comm_UINT32 nULong ) { *pStream << nULong; return *this; } -ICommStream& SvCommStream::operator<<( comm_BOOL nChar ) { *pStream << nChar; return *this; } - -comm_UINT32 SvCommStream::Read( void* pData, comm_UINT32 nSize ) { return pStream->Read( pData, nSize ); } -comm_UINT32 SvCommStream::Write( const void* pData, comm_UINT32 nSize ) { return pStream->Write( pData, nSize ); } - -comm_BOOL SvCommStream::IsEof() const { return pStream->IsEof(); } -comm_UINT32 SvCommStream::SeekRel( long nPos ) { return pStream->SeekRel( nPos ); } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/server/testtool.hrc b/automation/source/server/testtool.hrc deleted file mode 100644 index e8d1c04ac..000000000 --- a/automation/source/server/testtool.hrc +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define TTSTART 12345 - -#define DisplayHidToolBox ( TTSTART + 0 ) -#define TT_SHOW 1 -#define TT_SHOW2 ( TTSTART + 1 ) -#define TT_OUTPUT 3 -#define TT_SEND_DATA 4 -#define TT_ALLWIN 5 -#define TT_KURZNAME 6 -#define TT_LANGNAME 7 -#define TT_ALTERNATE_CAPTION ( TTSTART + 2 ) - -#define TT_INLINE_TRANSLATION ( TTSTART + 3) -#define TT_GB_TRANSLATION 1 -#define TT_E_NEW 2 -#define TT_FT_OLD 3 -#define TT_GB_COMMENT 4 -#define TT_E_COMMENT 5 - -#define TT_PB_SELECT 6 -#define TT_PB_RESTORE 7 -#define TT_PB_ACCEPT 8 -#define TT_PB_NEXT 9 - -#define TT_DISCARD_CHANGED_DATA ( TTSTART + 4 ) -#define TT_NO_CONTROL ( TTSTART + 5 ) - - -#define TT_GPF ( TTSTART + 6 ) diff --git a/automation/source/simplecm/communiio.hxx b/automation/source/simplecm/communiio.hxx deleted file mode 100644 index c6a342d39..000000000 --- a/automation/source/simplecm/communiio.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#include - -#define C_ERROR_NONE 0x0001 -#define C_ERROR_PERMANENT 0x0002 -#define C_ERROR_RETRY 0x0003 -#define C_ERROR_TIMEOUT 0x0004 - -class ITransmiter -{ -protected: - comm_UINT32 nLastSent; -public: - ITransmiter() :nLastSent( 0 ){} - virtual ~ITransmiter() {} - virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen ) = 0; - - comm_UINT32 GetLastSent() const { return nLastSent; } -}; - -class IReceiver -{ -protected: - comm_UINT32 nLastReceived; -public: - IReceiver() :nLastReceived( 0 ){} - virtual ~IReceiver() {;} - virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen ) = 0; - - comm_UINT32 GetLastReceived() const { return nLastReceived; } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/simplecm/makefile.mk b/automation/source/simplecm/makefile.mk deleted file mode 100644 index b6318ab4f..000000000 --- a/automation/source/simplecm/makefile.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=simplecm - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/tcpio.obj \ - $(SLO)$/packethandler.obj \ - $(SLO)$/simplecm.obj \ - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/automation/source/simplecm/packethandler.cxx b/automation/source/simplecm/packethandler.cxx deleted file mode 100644 index 70feb9c04..000000000 --- a/automation/source/simplecm/packethandler.cxx +++ /dev/null @@ -1,338 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#include "packethandler.hxx" -#include -#include -#include "communiio.hxx" -#include - -/** -Forces switch to multichannel headers even for old communication Method -**/ -#define FORCE_MULTI_CHANNEL_HEADERS - - -PacketHandler::PacketHandler( ITransmiter* pTransmitter_, IReceiver* pReceiver_, comm_BOOL bMC ) -: pTransmitter( pTransmitter_ ) -, pReceiver( pReceiver_ ) -, bMultiChannel( bMC ) -{ -} - -unsigned char PacketHandler::CalcCheckByte( comm_UINT32 nBytes ) -{ - comm_UINT16 nRes = 0; - nRes += HIBYTE( HIWORD( nBytes ) ) ^ 0xf0; - nRes += LOBYTE( HIWORD( nBytes ) ) ^ 0x0f; - nRes += HIBYTE( LOWORD( nBytes ) ) ^ 0xf0; - nRes += LOBYTE( LOWORD( nBytes ) ) ^ 0x0f; - - nRes ^= HIBYTE( nRes ); - - return LOBYTE( nRes ); -} - - -#define READ_SOCKET( pBuffer, nLength )\ - if ( !bWasError )\ - {\ - bWasError |= pReceiver->ReceiveBytes( pBuffer, nLength ) != C_ERROR_NONE;\ - } - -#define READ_SOCKET_LEN( pBuffer, nLength, nTotal )\ - READ_SOCKET( pBuffer, nLength );\ - if ( !bWasError )\ - {nTotal += nLength;} - -comm_BOOL PacketHandler::ReceiveData( void* &pData, comm_UINT32 &nLen ) -{ - DBG_ASSERT( !pData, "pData should be NULL -> memory leak" ); - - nLen = 0; - pData = NULL; - comm_BOOL bWasError = sal_False; - comm_BOOL bForceMultiChannelThisPacket = sal_False; - if ( pReceiver ) - { - comm_UINT32 nBytes = 0; - nReceiveProtocol = CM_PROTOCOL_OLDSTYLE; - nReceiveHeaderType = CH_NoHeader; - - READ_SOCKET( &nBytes, sizeof(nBytes) ) - if ( bWasError ) - return sal_False; - - if ( 0xFFFFFFFF == nBytes ) // Expliziter Request f�r dieses Datenpaket auf MultiChannel umzuschalten - { - READ_SOCKET( &nBytes, sizeof(nBytes) ) - if ( bWasError ) - return sal_False; - bForceMultiChannelThisPacket = sal_True; - } - - nBytes = NETDWORD( nBytes ); - - if ( bMultiChannel || bForceMultiChannelThisPacket ) - { - comm_UINT32 nReadSoFar = 0; - comm_UINT32 nHeaderReadSoFar = 0; - - // Pr�fbyte f�r L�ngenangabe - unsigned char nLenCheck = 0; - READ_SOCKET_LEN( &nLenCheck, 1, nReadSoFar ); - // Stimmt das Pr�fbyte? - bWasError |= nLenCheck != CalcCheckByte( nBytes ); - - - comm_UINT16 nHeaderBytes; - READ_SOCKET_LEN( &nHeaderBytes, 2, nReadSoFar ); - nHeaderBytes = NETWORD( nHeaderBytes ); - // reicht der Header �ber das Ende hinaus? - bWasError |= !(nBytes >= nReadSoFar + nHeaderBytes); - - READ_SOCKET_LEN( &nReceiveHeaderType, 2, nHeaderReadSoFar ); - nReceiveHeaderType = NETWORD( nReceiveHeaderType ); - - switch ( nReceiveHeaderType ) - { - case CH_SimpleMultiChannel: - { - READ_SOCKET_LEN( &nReceiveProtocol, 2, nHeaderReadSoFar ); - nReceiveProtocol = NETWORD( nReceiveProtocol ); - } - break; - case CH_Handshake: - { - } - break; - default: - { - OSL_FAIL("Unbekannter Headertyp in der Kommunikation"); - bWasError = sal_True; - } - - } - - if ( bWasError ) - return sal_False; - - /// L�ngen anpassen und ggf restheader �berlesen. - while ( nHeaderBytes > nHeaderReadSoFar ) - { - unsigned char nDummy; - READ_SOCKET_LEN( &nDummy, 1, nHeaderReadSoFar ); - } - - nReadSoFar += nHeaderReadSoFar; - nBytes -= nReadSoFar; - - } - - /* @@@ Notes @@@ - * - * 1) a 'void*' allocated via 'new char[]' is always deallocated - * via plain 'delete()', not via array 'delete[]()'; it's just - * raw memory. - * - * 2) as the caller of this routine later-on changes ownership - * of 'pData' via 'SvMemoryStream::SetBuffer()' (in 'simplecm.cxx', - * 'SimpleCommunicationLinkViaSocket::DoReceiveDataStream()'), - * the allocator used here for 'void* pData' must match the - * deallocator used in 'SvMemoryStream::FreeMemory()', i.e. - * '::operator delete()'. - */ - pData = ::operator new(nBytes); - READ_SOCKET( pData, nBytes ) - if ( bWasError ) - { - ::operator delete(pData), pData = 0; - return sal_False; - } - nLen = nBytes; - } - else - bWasError = sal_True; - - return !bWasError; -} - -/*#define WRITE_SOCKET( pBuffer, nLength )\ - if ( !bWasError )\ - bWasError |= !pStreamSocket || (pStreamSocket->write( pBuffer, nLength ) != nLength)*/ - -#define WRITE_SOCKET( pBuffer, nLength )\ - if ( !bWasError )\ - {bWasError |= pTransmitter->TransferBytes( pBuffer, nLength ) != C_ERROR_NONE;} - - - -comm_BOOL PacketHandler::TransferData( const void* pData, comm_UINT32 nLen, CMProtocol nProtocol ) -{ - comm_UINT32 nBuffer = nLen; - comm_BOOL bWasError = sal_False; - -#ifndef FORCE_MULTI_CHANNEL_HEADERS - if ( bMultiChannel ) -#endif - nBuffer += 1+2+2+2; // f�r einen CH_SimpleMultiChannel - -#ifdef FORCE_MULTI_CHANNEL_HEADERS - if ( !bMultiChannel ) - { - comm_UINT32 n32; - n32 = 0xffffffff; // Umschalten auf MultiChannel - n32 = NETDWORD( n32 ); - WRITE_SOCKET( &n32, 4 ); - } -#endif - - - comm_UINT32 nNetworkBuffer = NETDWORD( nBuffer ); - WRITE_SOCKET( &nNetworkBuffer, sizeof(nNetworkBuffer) ); - - -#ifndef FORCE_MULTI_CHANNEL_HEADERS - if ( bMultiChannel ) -#endif - { - comm_UINT16 n16; - unsigned char c; - - c = CalcCheckByte( nBuffer ); - WRITE_SOCKET( &c, 1 ); - - n16 = 4; // L�nge des Headers f�r einen CH_SimpleMultiChannel - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - - n16 = CH_SimpleMultiChannel; // Typ des Headers - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - - nProtocol = NETWORD( nProtocol ); - WRITE_SOCKET( &nProtocol, 2 ); - } - - WRITE_SOCKET( pData, nLen ); - return !bWasError; -} - -comm_BOOL PacketHandler::SendHandshake( HandshakeType aHandshakeType, const void* pData, comm_UINT32 nLen ) -{ - comm_BOOL bWasError = sal_False; - - comm_UINT32 nBuffer = 0; - -// if ( pMyManager->IsMultiChannel() ) Wir senden immer FFFFFFFF vorweg -> immer MultiChannel (Oder GPF bei �lteren) - nBuffer += 1+2+2; // f�r einen CH_Handshake - - nBuffer += 2; // f�r den Typ des Handshakes - - switch ( aHandshakeType ) - { - case CH_REQUEST_HandshakeAlive: - nBuffer += 0; // Keine extra Daten - break; - case CH_RESPONSE_HandshakeAlive: - nBuffer += 0; // Keine extra Daten - break; - case CH_REQUEST_ShutdownLink: - nBuffer += 0; // Keine extra Daten - break; - case CH_ShutdownLink: - nBuffer += 0; // Keine extra Daten - break; - case CH_SUPPORT_OPTIONS: - nBuffer += 2 ; // one word extradata for options - break; - case CH_SetApplication: - nBuffer += 0 ; // one word extradata for options - break; - default: - OSL_FAIL("Unknown HandshakeType"); - } - - if ( pData ) - nBuffer += nLen; // Extra data in Buffer - - comm_UINT32 n32; - n32 = 0xffffffff; // Umschalten auf MultiChannel - n32 = NETDWORD( n32 ); - WRITE_SOCKET( &n32, 4 ); - - comm_UINT32 nNetworkBuffer = NETDWORD( nBuffer ); - WRITE_SOCKET( &nNetworkBuffer, sizeof(nNetworkBuffer) ); - - - comm_UINT16 n16; - unsigned char c; - - c = CalcCheckByte( nBuffer ); - WRITE_SOCKET( &c, 1 ); - - n16 = 2; // L�nge des Headers f�r einen CH_Handshake - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - - n16 = CH_Handshake; // Typ des Headers - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - - n16 = aHandshakeType; // Typ des Handshakes - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - - - switch ( aHandshakeType ) - { - case CH_SUPPORT_OPTIONS: - n16 = OPT_USE_SHUTDOWN_PROTOCOL; - n16 = NETWORD( n16 ); - WRITE_SOCKET( &n16, 2 ); - break; - } - - if ( pData ) - WRITE_SOCKET( pData, nLen ); - - return !bWasError; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/simplecm/packethandler.hxx b/automation/source/simplecm/packethandler.hxx deleted file mode 100644 index d61e6a252..000000000 --- a/automation/source/simplecm/packethandler.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/************************************************************************* - * - * ATTENTION - * This file is intended to work inside and outside the StarOffice environment. - * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! - * - ************************************************************************/ - -#ifndef _TOOLS_PACKETHANDLER_HXX_ -#define _TOOLS_PACKETHANDLER_HXX_ - -#include -#include - -class ITransmiter; -class IReceiver; - -class PacketHandler -{ -private: - unsigned char CalcCheckByte( comm_UINT32 nBytes ); - ITransmiter* pTransmitter; - IReceiver* pReceiver; - - comm_BOOL bMultiChannel; - -protected: - comm_UINT16 nReceiveProtocol; - comm_UINT16 nReceiveHeaderType; - -public: - PacketHandler( ITransmiter* pTransmitter_, IReceiver* pReceiver_, comm_BOOL bMC = sal_False ); - - comm_UINT16 GetReceiveProtocol() const { return nReceiveProtocol; } - comm_UINT16 GetReceiveHeaderType() const { return nReceiveHeaderType; } - - comm_BOOL ReceiveData( void* &pData, comm_UINT32 &nLen ); /// Recieve DataPacket from Socket - virtual comm_BOOL SendHandshake( HandshakeType aHandshakeType, const void* pData = NULL, comm_UINT32 nLen = 0 ); - virtual comm_BOOL TransferData( const void* pData, comm_UINT32 nLen, CMProtocol nProtocol = CM_PROTOCOL_OLDSTYLE ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/simplecm/simplecm.cxx b/automation/source/simplecm/simplecm.cxx deleted file mode 100644 index e90be4a79..000000000 --- a/automation/source/simplecm/simplecm.cxx +++ /dev/null @@ -1,541 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - - -#define ENABLE_BYTESTRING_STREAM_OPERATORS -#include -#include -#include - -#include -#include "packethandler.hxx" -#include "tcpio.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include -void debug_printf( const char *chars ) -{ - static BOOL bPrint = (getenv("DEBUG") != NULL); - if ( bPrint ) - { - printf( "%c\n", chars ); - fflush( stdout ); - } -} -#endif - -CommunicationLink::CommunicationLink( CommunicationManager *pMan ) -: pMyManager(pMan) -, pServiceData(NULL) -, nServiceProtocol( 0 ) -, bIsInsideCallback( sal_False ) -, nTotalBytes( 0 ) -, maApplication("Undefined") -#if OSL_DEBUG_LEVEL > 1 -, bFlag( sal_False ) -, nSomething( 0 ) -#endif -{ -} - -CommunicationLink::~CommunicationLink() -{ -#if OSL_DEBUG_LEVEL > 1 - if ( !bFlag ) // bFlag will be set if deletion is expected else we can set a breakpoint - bFlag = sal_False; -#endif - if ( pMyManager ) - pMyManager->DestroyingLink( this ); -} - -void CommunicationLink::CallInfoMsg( InfoString aMsg ) -{ - if ( pMyManager ) - pMyManager->InfoMsg( aMsg ); -}; - -CM_InfoType CommunicationLink::GetInfoType() -{ - if ( pMyManager ) - return pMyManager->GetInfoType(); - else - return CM_NO_TEXT; -} - -IMPL_LINK( CommunicationLink, ConnectionClosed, void*, EMPTYARG ) -{ - if ( pMyManager ) - pMyManager->CallConnectionClosed( this ); - return 1; -} - -IMPL_LINK( CommunicationLink, DataReceived, void*, EMPTYARG ) -{ - if ( pMyManager ) - pMyManager->CallDataReceived( this ); - return 1; -} - -sal_Bool CommunicationLink::DoTransferDataStream( SvStream *pDataStream, CMProtocol nProtocol ) -{ - INFO_MSG( CByteString("S :").Append( GetCommunicationPartner( CM_FQDN ) ), - CByteString("Daten Senden:").Append( GetCommunicationPartner( CM_FQDN ) ), - CM_SEND, this ); - sal_Bool bWasError = sal_False; - - sal_uInt32 nBuffer; - nBuffer = pDataStream->SeekRel(0) +1; - bWasError = pPacketHandler->TransferData( ((SvMemoryStream*)pDataStream)->GetData(), nBuffer, nProtocol ) != C_ERROR_NONE; - - if ( bWasError ) - { - INFO_MSG( CByteString("Send Failed:").Append( GetCommunicationPartner( CM_FQDN ) ), - CByteString( "Socket wird wegen Fehlers beim Senden geschlossen: ").Append( GetCommunicationPartner( CM_FQDN ) ), - CM_ERROR, this ); - ShutdownCommunication(); - } - return !bWasError; -} - -sal_Bool CommunicationLink::TransferDataStream( SvStream *pDataStream, CMProtocol nProtocol ) -{ - aLastAccess = DateTime(); - nTotalBytes += pDataStream->Seek( STREAM_SEEK_TO_END ); - return DoTransferDataStream( pDataStream, nProtocol ); -} - -void CommunicationLink::SetApplication( const ByteString& aApp ) -{ - maApplication = aApp; -} - - -SimpleCommunicationLinkViaSocket::SimpleCommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket ) -: CommunicationLink( pMan ) -, aCommunicationPartner() -, aMyName() -, pStreamSocket( pSocket ) -, pReceiveStream( NULL ) -, bIsRequestShutdownPending( sal_False ) -{ - pTCPIO = new TCPIO( pStreamSocket ); - pPacketHandler = new PacketHandler( (ITransmiter*) pTCPIO, pTCPIO, pMyManager->IsMultiChannel() ); -} - -SimpleCommunicationLinkViaSocket::~SimpleCommunicationLinkViaSocket() -{ - delete pPacketHandler; - pPacketHandler = NULL; - delete pTCPIO; - pTCPIO = NULL; - delete pStreamSocket; - pStreamSocket = NULL; -} - -void SimpleCommunicationLinkViaSocket::SetStreamSocket( osl::StreamSocket* pSocket ) -{ - if ( pTCPIO ) - pTCPIO->SetStreamSocket( pSocket ); - pStreamSocket = pSocket; -} - -sal_Bool SimpleCommunicationLinkViaSocket::StopCommunication() -{ - CommunicationLinkRef rHold(this); // avoid deleting this link before the end of the method - if ( !IsCommunicationError() ) // Meaning that the Communication is still runnung - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Sending REQUEST_ShutdownLink\n"); -#endif - SendHandshake( CH_REQUEST_ShutdownLink ); - } - WaitForShutdown(); - return sal_True; -} - -sal_Bool SimpleCommunicationLinkViaSocket::IsCommunicationError() -{ - return !pStreamSocket; -} - -ByteString SimpleCommunicationLinkViaSocket::GetCommunicationPartner( CM_NameType eType ) -{ - if ( pStreamSocket ) - { - switch ( eType ) - { - case CM_DOTTED: - { - rtl::OUString aDotted; - osl::SocketAddr* pPeerAdr = new osl::SocketAddr; - pStreamSocket->getPeerAddr( *pPeerAdr ); - osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData); - delete pPeerAdr; - return ByteString( UniString(aDotted), RTL_TEXTENCODING_UTF8 ); - } - //break; - case CM_FQDN: - { - if ( !aCommunicationPartner.Len() ) - { - rtl::OUString aFQDN( pStreamSocket->getPeerHost()); - aCommunicationPartner = ByteString( UniString(aFQDN), RTL_TEXTENCODING_UTF8 ); - } - return aCommunicationPartner; - } - //break; - } - } - return CByteString( "Unknown" ); -} - -ByteString SimpleCommunicationLinkViaSocket::GetMyName( CM_NameType eType ) -{ - if ( pStreamSocket ) - { - switch ( eType ) - { - case CM_DOTTED: - { - rtl::OUString aDotted; - osl::SocketAddr* pPeerAdr = new osl::SocketAddr; - pStreamSocket->getPeerAddr( *pPeerAdr ); - osl_getDottedInetAddrOfSocketAddr( pPeerAdr->getHandle(), &aDotted.pData); - delete pPeerAdr; - return ByteString( UniString(aDotted), RTL_TEXTENCODING_UTF8 ); - } - //break; - case CM_FQDN: - { - if ( !aMyName.Len() ) - { - rtl::OUString aFQDN(pStreamSocket->getLocalHost()); - aMyName = ByteString( UniString(aFQDN), RTL_TEXTENCODING_UTF8 ); - } - return aMyName; - } - //break; - } - } - return CByteString( "Error" ); -} - -SvStream* SimpleCommunicationLinkViaSocket::GetBestCommunicationStream() -{ - SvStream* pStream = new SvMemoryStream; -// pStream->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - return pStream; -} - -#define READ_SOCKET( pBuffer, nLength )\ - if ( !bWasError )\ - {bWasError |= pTCPIO->ReceiveBytes( pBuffer, nLength ) != C_ERROR_NONE;} - -#define READ_SOCKET_LEN( pBuffer, nLength, nTotal )\ - READ_SOCKET( pBuffer, nLength );\ - if ( !bWasError )\ - {nTotal += nLength;} - -sal_Bool SimpleCommunicationLinkViaSocket::DoReceiveDataStream() -{ - sal_Bool bWasError = sal_False; - void* pBuffer = NULL; - comm_UINT32 nLen; - bWasError = pPacketHandler->ReceiveData( pBuffer, nLen ) != C_ERROR_NONE; - if ( !bWasError ) - { - pReceiveStream = GetBestCommunicationStream(); - DBG_ASSERT( pReceiveStream->IsA() == ID_MEMORYSTREAM, "CommunicationStream is not an SvMemoryStream. Communication has to be reimplemented here!"); - if ( pReceiveStream->IsA() == ID_MEMORYSTREAM ) - ((SvMemoryStream*)pReceiveStream)->SetBuffer( pBuffer, nLen, sal_True, nLen ); - DBG_ASSERT( pReceiveStream, "Datastream is NULL"); - } - - return !bWasError; -} - -void SimpleCommunicationLinkViaSocket::SetApplication( const ByteString& aApp ) -{ - CommunicationLink::SetApplication( aApp ); - SvStream* pData = GetBestCommunicationStream(); - *pData << aApp; - SendHandshake( CH_SetApplication, pData ); - delete pData; -} - -void SimpleCommunicationLinkViaSocket::SetNewPacketAsCurrent() -{ - pServiceData = pReceiveStream; - nServiceProtocol = pPacketHandler->GetReceiveProtocol(); - nServiceHeaderType = pPacketHandler->GetReceiveHeaderType(); -} - -sal_Bool SimpleCommunicationLinkViaSocket::SendHandshake( HandshakeType aHandshakeType, SvStream* pData ) -{ - sal_Bool bWasError; - - if ( pData ) - { - sal_uInt32 nBuffer; - nBuffer = pData->Seek( STREAM_SEEK_TO_END ); - bWasError = !pPacketHandler->SendHandshake( aHandshakeType, ((SvMemoryStream*)pData)->GetData(), nBuffer ); - } - else - bWasError = !pPacketHandler->SendHandshake( aHandshakeType ); - - - if ( bWasError ) - { - INFO_MSG( CByteString("Send Failed:").Append( GetCommunicationPartner( CM_FQDN ) ), - CByteString( "Socket wird wegen Fehlers beim Senden geschlossen: ").Append( GetCommunicationPartner( CM_FQDN ) ), - CM_ERROR, this ); - ShutdownCommunication(); - } - else - { // set new status - switch ( aHandshakeType ) - { - case CH_REQUEST_HandshakeAlive: - break; - case CH_RESPONSE_HandshakeAlive: - break; - case CH_REQUEST_ShutdownLink: - bIsRequestShutdownPending = sal_True; - break; - case CH_ShutdownLink: - break; - case CH_SUPPORT_OPTIONS: - break; - case CH_SetApplication: - break; - default: - OSL_FAIL("Unknown HandshakeType"); - } - } - return !bWasError; -} - -CommunicationManager::CommunicationManager( sal_Bool bUseMultiChannel ) -: nInfoType( CM_NONE ) -, bIsCommunicationRunning( sal_False ) -, maApplication("Unknown") -, bIsMultiChannel( bUseMultiChannel ) -{ -} - -CommunicationManager::~CommunicationManager() -{ - xLastNewLink.Clear(); -} - -sal_Bool CommunicationManager::StartCommunication( String aApp, String aParams ) -{ - (void) aApp; /* avoid warning about unused parameter */ - (void) aParams; /* avoid warning about unused parameter */ - return sal_False; -} - -sal_Bool CommunicationManager::StartCommunication( ByteString aHost, sal_uLong nPort ) -{ - (void) aHost; /* avoid warning about unused parameter */ - (void) nPort; /* avoid warning about unused parameter */ - return sal_False; -} - -ByteString CommunicationManager::GetMyName( CM_NameType ) -{ - rtl::OUString aHostname( osl::SocketAddr::getLocalHostname()); - return ByteString( UniString(aHostname), RTL_TEXTENCODING_UTF8 ); -} - -void CommunicationManager::CallConnectionOpened( CommunicationLink* pCL ) -{ - pCL->StartCallback(); // Sollte bereits vor dem Aufruf gerufen werden - pCL->aStart = DateTime(); - pCL->aLastAccess = pCL->aStart; - bIsCommunicationRunning = sal_True; - pCL->SetApplication( GetApplication() ); - - xLastNewLink = pCL; - - INFO_MSG( CByteString("C+:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CByteString("Verbindung aufgebaut: ").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CM_OPEN, pCL ); - ConnectionOpened( pCL ); - pCL->FinishCallback(); -} - -void CommunicationManager::CallConnectionClosed( CommunicationLink* pCL ) -{ - pCL->StartCallback(); // Sollte bereits vor dem Aufruf gerufen werden - pCL->aLastAccess = DateTime(); - - INFO_MSG( CByteString("C-:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CByteString("Verbindung abgebrochen: ").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CM_CLOSE, pCL ); - ConnectionClosed( pCL ); - - if ( xLastNewLink == pCL ) - xLastNewLink.Clear(); - - pCL->FinishCallback(); -// delete pCL; -} - -void CommunicationManager::CallDataReceived( CommunicationLink* pCL ) -{ - pCL->StartCallback(); // Sollte bereits vor dem Aufruf gerufen werden - pCL->aLastAccess = DateTime(); - CommunicationLinkRef rHold(pCL); // H�lt den Zeiger bis zum Ende des calls - - // should be impossible but happens for mysterious reasons - if ( !pCL->pServiceData ) - { - OSL_FAIL( "Datastream is NULL" ); - pCL->FinishCallback(); - return; - } - - - if ( CH_Handshake == pCL->nServiceHeaderType ) - { - SvStream *pData = pCL->GetServiceData(); - sal_uInt16 nType; - pData->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); // Unfortulately it is written this way :(( - *pData >> nType; - pData->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - switch ( nType ) - { - case CH_REQUEST_HandshakeAlive: - { - pCL->SendHandshake( CH_RESPONSE_HandshakeAlive ); - } - break; - case CH_REQUEST_ShutdownLink: - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Sending ShutdownLink\n"); -#endif - pCL->SendHandshake( CH_ShutdownLink ); - } - break; - case CH_ShutdownLink: - { -#if OSL_DEBUG_LEVEL > 1 - debug_printf("Executing ShutdownLink\n"); -#endif - pCL->ShutdownCommunication(); - } - break; - case CH_SetApplication: - { - ByteString aApplication; - *pData >> aApplication; - pCL->CommunicationLink::SetApplication( aApplication ); -#if OSL_DEBUG_LEVEL > 1 - debug_printf( "Setting Application to " ); - debug_printf( aApplication.GetBuffer() ); - debug_printf( "\n" ); -#endif - } - break; - -#if OSL_DEBUG_LEVEL > 1 - default: - { - debug_printf("Unknown Handshake received\n"); - } -#endif - } - delete pData; - } - else - { - if ( pCL->pServiceData ) - { - pCL->nTotalBytes += pCL->pServiceData->Seek( STREAM_SEEK_TO_END ); - pCL->pServiceData->Seek( STREAM_SEEK_TO_BEGIN ); - } - - INFO_MSG( CByteString("D :").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CByteString("Daten Empfangen:").Append( pCL->GetCommunicationPartner( CM_FQDN ) ), - CM_RECEIVE, pCL ); - DataReceived( pCL ); - } - delete pCL->GetServiceData(); - pCL->FinishCallback(); -} - -void CommunicationManager::CallInfoMsg( InfoString aMsg ) -{ - // Hier wird es wohl kein Housekeeping geben - InfoMsg( aMsg ); -} - -void CommunicationManager::SetApplication( const ByteString& aApp, sal_Bool bRunningLinks ) -{ - maApplication = aApp; - if ( bRunningLinks ) - { - sal_uInt16 i; - for ( i = 0 ; i < GetCommunicationLinkCount() ; i++ ) - GetCommunicationLink( i )->SetApplication( aApp ); - } -} - -sal_Bool CommonSocketFunctions::DoStartCommunication( CommunicationManager *pCM, ICommunicationManagerClient *pCMC, ByteString aHost, sal_uLong nPort ) -{ - osl::SocketAddr Addr( rtl::OUString( UniString( aHost, RTL_TEXTENCODING_UTF8 ) ), nPort ); - osl::ConnectorSocket *pConnSocket; - - - TimeValue aTV; - aTV.Seconds = 10; // Warte 10 Sekunden - aTV.Nanosec = 0; - do - { - pConnSocket = new osl::ConnectorSocket(); - pConnSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 ); - if ( pConnSocket->connect( Addr, &aTV ) == osl_Socket_Ok ) - { - pConnSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 ); - pCM->CallConnectionOpened( CreateCommunicationLink( pCM, pConnSocket ) ); - return sal_True; - } - else - delete pConnSocket; - - } while ( pCMC->RetryConnect() ); - - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/simplecm/tcpio.cxx b/automation/source/simplecm/tcpio.cxx deleted file mode 100644 index 9c0bc2185..000000000 --- a/automation/source/simplecm/tcpio.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include "tcpio.hxx" - -/// implement ITransmiter -comm_UINT16 TCPIO::TransferBytes( const void* pBuffer, comm_UINT32 nLen ) -{ - osl::MutexGuard aGuard( aMSocketWriteAccess ); - if ( !pStreamSocket ) - { - nLastSent = 0; - return C_ERROR_PERMANENT; - } - nLastSent = pStreamSocket->write( pBuffer, nLen ); - if ( nLastSent == nLen ) - return C_ERROR_NONE; - return C_ERROR_PERMANENT; -} - - -/// implement IReceiver -comm_UINT16 TCPIO::ReceiveBytes( void* pBuffer, comm_UINT32 nLen ) -{ - osl::MutexGuard aGuard( aMSocketReadAccess ); - if ( !pStreamSocket ) - { - nLastReceived = 0; - return C_ERROR_PERMANENT; - } - nLastReceived = pStreamSocket->read( pBuffer, nLen ); - if ( nLastReceived == nLen ) - return C_ERROR_NONE; - return C_ERROR_PERMANENT; -} - - -// helper -void TCPIO::SetStreamSocket( osl::StreamSocket* pSocket ) -{ - osl::MutexGuard aRGuard( aMSocketReadAccess ); - osl::MutexGuard aWGuard( aMSocketWriteAccess ); - pStreamSocket = pSocket; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/simplecm/tcpio.hxx b/automation/source/simplecm/tcpio.hxx deleted file mode 100644 index 3240a8156..000000000 --- a/automation/source/simplecm/tcpio.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef TCPIO_HXX -#define TCPIO_HXX - -#include -#include - -#include "communiio.hxx" - -class TCPIO : public ITransmiter, public IReceiver -{ -private: - osl::StreamSocket* pStreamSocket; - osl::Mutex aMSocketReadAccess; - osl::Mutex aMSocketWriteAccess; - -public: - - /// - TCPIO( osl::StreamSocket* pSocket ):pStreamSocket( pSocket ){} - virtual ~TCPIO(){} - - - /// implement ITransmiter - virtual comm_UINT16 TransferBytes( const void* pBuffer, comm_UINT32 nLen ); - - /// implement IReceiver - virtual comm_UINT16 ReceiveBytes( void* pBuffer, comm_UINT32 nLen ); - - // helper - void SetStreamSocket( osl::StreamSocket* pSocket ); - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/cmdstrm.cxx b/automation/source/testtool/cmdstrm.cxx deleted file mode 100644 index ff81f4a57..000000000 --- a/automation/source/testtool/cmdstrm.cxx +++ /dev/null @@ -1,455 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include -#include -#include - -#include "cmdstrm.hxx" -#include "rcontrol.hxx" -#include "objtest.hxx" -#include "ittresid.hxx" -#include "svcommstream.hxx" -#include - -ControlDefLoad const CmdStream::arKeyCodes [] = -#include -CNames *CmdStream::pKeyCodes = NULL; - -ResMgr* IttResId::getIttResMgr() -{ - static ResMgr* pMgr = NULL; - if( ! pMgr ) - pMgr = CREATEVERSIONRESMGR( stt ); - return pMgr; -} - -CmdStream::CmdStream() -{ - pSammel = new SvMemoryStream(); - pCommStream = new SvCommStream( pSammel ); -} - -CmdStream::~CmdStream() -{ - delete pCommStream; - delete pSammel; -} - - -#define PUT_CHAR(ch) \ - sal_uInt16 nMCode = nModify + ch; \ - sal_uInt16 _Code = 1; \ - if ( (nMCode & 0xFF) == 0 ) \ - _Code |= 2; \ - if ( (nMCode >> 8) == 0 ) \ - _Code |= 4; \ - Result += (char) _Code; \ - Result += (char) ( nMCode & 0xFF ); \ - Result += (char) ( nMCode >> 8 ) - - -String CmdStream::WandleKeyEventString( String aKeys ) -{ - if ( !pKeyCodes ) - ReadFlatArray(arKeyCodes,pKeyCodes); - if ( !pKeyCodes ) - return aKeys; - - xub_StrLen nPos1 = 0; - while ( (nPos1 = aKeys.Search('<',nPos1)) != STRING_NOTFOUND) - { - xub_StrLen nPos2 = aKeys.Search('>',nPos1); - if ( nPos2 != STRING_NOTFOUND ) - { - String Work = aKeys.Copy(nPos1+1,nPos2-nPos1+1-2); - aKeys.Erase(nPos1,nPos2-nPos1+1); // Inclusive Spitze Klammern weg - String Result, Token; - sal_uInt16 nModify = 0; - while ( Work.Len() > 0 ) - { - Token = Work.GetToken(0,' '); - Work.Erase(0,Token.Len()+1); - ControlDef WhatName(Token,rtl::OString()); - sal_uInt16 nElement; - if (pKeyCodes->Seek_Entry(&WhatName,&nElement)) - { - // FIXME: HELPID - sal_uInt16 nCode = 0;//(sal_uInt16) pKeyCodes->GetObject(nElement)->pData->aUId.GetNum(); - if ( nCode >= KEY_SHIFT ) - nModify ^= nCode; - else - { - if ( ( nModify == 0 ) && - (((nCode & 0xFF00) == KEYGROUP_NUM) || - ((nCode & 0xFF00) == KEYGROUP_ALPHA) || - ( nCode == KEY_SPACE) || - ( nCode == KEY_ADD) || - ( nCode == KEY_SUBTRACT) || - ( nCode == KEY_MULTIPLY) || - ( nCode == KEY_DIVIDE) || - ( nCode == KEY_POINT) || - ( nCode == KEY_COMMA) || - ( nCode == KEY_LESS) || - ( nCode == KEY_GREATER) || - ( nCode == KEY_EQUAL) ) ) - { - switch ( nCode ) - { - case KEY_SPACE: Token = ' '; break; - case KEY_ADD: Token = '+'; break; - case KEY_SUBTRACT: Token = '-'; break; - case KEY_MULTIPLY: Token = '*'; break; - case KEY_DIVIDE: Token = '/'; break; - case KEY_POINT: Token = '.'; break; - case KEY_COMMA: Token = ','; break; - case KEY_LESS: Token = '<'; break; - case KEY_GREATER: Token = '>'; break; - case KEY_EQUAL: Token = '='; break; - default: -// if ( nModify == 0 ) -// Token.ToLower(); -// else -// Token.ToUpper(); - ; - } - Result += Token; - } - else - { - PUT_CHAR (nCode); - } - } - } - else - { - Result += '<'; - Result += Token; - Result += ' '; - Result += String( IttResId( S_INVALID_KEYCODE ) ); - Result += '>'; - } - } - aKeys.Insert(Result,nPos1); - nPos1 = nPos1 + Result.Len(); - } - else - nPos1 = aKeys.Len() + 1; - } - - return aKeys; -} - - -void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString ) -{ - sal_uInt16 nParams = PARAM_NONE; - sal_uInt16 nNr1=0,nNr2=0,nNr3=0,nNr4=0; - comm_UINT32 nLNr1=0; - String aString1,aString2; - sal_Bool bBool1=sal_False,bBool2=sal_False; - - if ( rPar ) - { - for ( sal_uInt16 i = 1; i < rPar->Count() ; i++) - { - switch (rPar->Get( i )->GetType()) - { - case SbxLONG: // alles immer als Short �bertragen - case SbxULONG: - case SbxSALINT64: - case SbxSALUINT64: - case SbxDOUBLE: - case SbxINTEGER: - case SbxBYTE: - case SbxUSHORT: - case SbxINT: - case SbxUINT: - case SbxSINGLE: - if ( (nParams & PARAM_UINT16_1) == 0 ) - { - nParams |= PARAM_UINT16_1; - nNr1 = rPar->Get( i )->GetUShort(); - } - else if ( (nParams & PARAM_UINT16_2) == 0 ) - { - nParams |= PARAM_UINT16_2; - nNr2 = rPar->Get( i )->GetUShort(); - } - else if ( (nParams & PARAM_UINT16_3) == 0 ) - { - nParams |= PARAM_UINT16_3; - nNr3 = rPar->Get( i )->GetUShort(); - } - else if ( (nParams & PARAM_UINT16_4) == 0 ) - { - nParams |= PARAM_UINT16_4; - nNr4 = rPar->Get( i )->GetUShort(); - } - else - SbxBase::SetError( SbxERR_WRONG_ARGS ); - break; - case SbxOBJECT: // whenever a control is passed. TabPage, MenuBar - { - SbxProperty *pMember = NULL; - if ( rPar->Get( i )->ISA( SbxObject ) ) - pMember = ((SbxObject*)rPar->Get( i ))->GetDfltProperty(); - if ( pMember != NULL ) - { - if ( pMember->GetType() == SbxSTRING ) - { - if ( nParams & PARAM_STR_1 ) - if ( nParams & PARAM_STR_2 ) - SbxBase::SetError( SbxERR_WRONG_ARGS ); - else - { - nParams |= PARAM_STR_2; - aString2 = pMember->GetString(); - } - else - { - nParams |= PARAM_STR_1; - aString1 = pMember->GetString(); - } - break; - } - else if ( pMember->GetType() == SbxULONG ) - { - if ( nParams & PARAM_UINT32_1 ) - SbxBase::SetError( SbxERR_WRONG_ARGS ); - else - { - nParams |= PARAM_UINT32_1; - nLNr1 = pMember->GetULong(); - } - } - else - SbxBase::SetError( SbxERR_NAMED_NOT_FOUND ); - } - else - { - SbxBase::SetError( SbxERR_NAMED_NOT_FOUND ); - } - } - break; - case SbxSTRING: - case SbxCHAR: - if ( nParams & PARAM_STR_1 ) - if ( nParams & PARAM_STR_2 ) - SbxBase::SetError( SbxERR_WRONG_ARGS ); - else - { - nParams |= PARAM_STR_2; - aString2 = rPar->Get( i )->GetString(); - } - else - { - nParams |= PARAM_STR_1; - aString1 = rPar->Get( i )->GetString(); - } - break; - case SbxBOOL: - if ( nParams & PARAM_BOOL_1 ) - if ( nParams & PARAM_BOOL_2 ) - SbxBase::SetError( SbxERR_WRONG_ARGS ); - else - { - nParams |= PARAM_BOOL_2; - bBool2 = rPar->Get( i )->GetBool(); - } - else - { - nParams |= PARAM_BOOL_1; - bBool1 = rPar->Get( i )->GetBool(); - } - break; - default: - SbxBase::SetError( SbxERR_WRONG_ARGS ); - break; - } - } - } - Write (nParams); - if( nParams & PARAM_UINT16_1 ) Write( nNr1 ); - if( nParams & PARAM_UINT16_2 ) Write( nNr2 ); - if( nParams & PARAM_UINT16_3 ) Write( nNr3 ); - if( nParams & PARAM_UINT16_4 ) Write( nNr4 ); - if( nParams & PARAM_UINT32_1 ) Write( nLNr1 ); - if( nParams & PARAM_STR_1 ) Write( aString1, IsKeyString ); - if( nParams & PARAM_STR_2 ) Write( aString2, IsKeyString ); - if( nParams & PARAM_BOOL_1 ) Write( bBool1 ); - if( nParams & PARAM_BOOL_2 ) Write( bBool2 ); -} - -void CmdStream::GenCmdCommand( sal_uInt16 nNr, SbxArray* rPar ) -{ - Write(sal_uInt16(SICommand)); - Write(nNr); - WriteSortedParams(rPar, (nNr & M_KEY_STRING) != 0 ); -} - -void CmdStream::GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar ) -{ - Write(sal_uInt16(SISlot)); - Write(nNr); - if (rPar) - { - sal_uInt16 nAnz = (rPar->Count()-1) >> 1; // Geteilt durch 2 - Write(nAnz); - sal_Bool bWriteUnoSlot = rPar->Get( 1 )->GetType() == SbxSTRING; - - for (sal_uInt16 n = 1 ; n <= nAnz ; n++) - { - /// #59513# nicht mehr ben�tigt -// sal_uLong nUserData = rPar->Get( 2*n-1 )->GetUserData(); -// rPar->Get( 2*n-1 )->SetUserData(ID_DoNothing); // Verhindert Ausf�hrung der Slots, die als Parameter �bergeben sind. - - if ( bWriteUnoSlot ) - Write(rPar->Get( 2*n-1 )->GetString()); - else - Write(rPar->Get( 2*n-1 )->GetUShort()); - switch (rPar->Get( 2*n )->GetType()) - { - case SbxINTEGER: - case SbxBYTE: - case SbxUSHORT: - case SbxINT: - case SbxUINT: - case SbxSINGLE: - if ( !bWriteUnoSlot ) - Write( (sal_uInt16)BinUINT16 ); - Write(rPar->Get( 2*n )->GetUShort()); - break; - case SbxLONG: - case SbxULONG: - case SbxSALINT64: - case SbxSALUINT64: - case SbxDOUBLE: - if ( !bWriteUnoSlot ) - Write( (sal_uInt16)BinUINT32 ); - Write(rPar->Get( 2*n )->GetULong()); - break; - case SbxSTRING: - case SbxCHAR: - if ( !bWriteUnoSlot ) - Write( (sal_uInt16)BinString); - Write((String)rPar->Get( 2*n )->GetString()); // Cast f�r OS/2 - break; - case SbxBOOL: - if ( !bWriteUnoSlot ) - Write( (sal_uInt16)BinBool); - Write(rPar->Get( 2*n )->GetBool()); - break; - default: - SbxBase::SetError( SbxERR_WRONG_ARGS ); - break; - } - - /// #59513# nicht mehr ben�tigt ( siehe oben ) -// rPar->Get( 2*n-1 )->SetUserData(nUserData); // Und wieder zur�cksetzen, so da� auch alles sauber ist. - } - } - else - Write(sal_uInt16(0)); -} - -void CmdStream::GenCmdUNOSlot( const String &aURL ) -{ - Write( sal_uInt16(SIUnoSlot) ); -/* Write( sal_uInt16(0) ); // Hier wird im Office die SID_OPENURL Eingetragen. - // Dies mu� nat�rlich im Office hart verdratet werden und nicht hier, - // da sich die ID ja mal �ndern kann. - - // Da auch die ID f�r das PoolItem im Office entnommen werden mu� hier also kein PoolItem - // gesendet werden. - - Write( sal_uInt16(0) ); // Anzahl PoolItems - - // Stattdessen wird noch eine extra String gesendet, der dann Officeseitig in ein - // SfxStringItem mit entsprechender ID gewandelt wird. - Write( aURL ); // String f�r das PoolItem*/ - - Write( aURL ); // Die UNO URL eben -} - -void CmdStream::GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar ) -{ - Write(sal_uInt16(SIControl)); - Write(nUId); - Write(nMethodId); - WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 ); -} - -void CmdStream::GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar ) -{ - Write(sal_uInt16(SIStringControl)); - Write(aUId); - Write(nMethodId); - WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 ); -} - -void CmdStream::GenCmdFlow( sal_uInt16 nArt ) -{ - Write(sal_uInt16(SIFlow)); - Write(nArt); - Write(sal_uInt16(PARAM_NONE)); // Typ der folgenden Parameter -} - -void CmdStream::GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 ) -{ - Write(sal_uInt16(SIFlow)); - Write(nArt); - Write(sal_uInt16(PARAM_UINT32_1)); // Typ der folgenden Parameter - Write(nNr1); -} - -void CmdStream::Write( String aString, sal_Bool IsKeyString ) -{ - if ( IsKeyString ) - Write( WandleKeyEventString( aString ), sal_False ); - else - Write( aString.GetBuffer(), aString.Len() ); -} - -SvMemoryStream* CmdStream::GetStream() -{ - return pSammel; -} - -void CmdStream::Reset( comm_UINT32 nSequence ) -{ - delete pCommStream; - delete pSammel; - pSammel = new SvMemoryStream(); - pCommStream = new SvCommStream( pSammel ); - GenCmdFlow (F_Sequence,nSequence); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/cmdstrm.hxx b/automation/source/testtool/cmdstrm.hxx deleted file mode 100644 index 7fbbf88ec..000000000 --- a/automation/source/testtool/cmdstrm.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CMDSTRM_HXX -#define _CMDSTRM_HXX - -#include -#include -#include "cmdbasestream.hxx" - -class CmdStream : public CmdBaseStream -{ -public: - CmdStream(); - ~CmdStream(); - - void WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString = sal_False ); - - void GenCmdCommand( sal_uInt16 nNr, SbxArray* rPar ); - - void GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar ); - - void GenCmdUNOSlot( const String &aURL ); - - void GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar ); - void GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar ); - - - void GenCmdFlow( sal_uInt16 nArt ); - void GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 ); - - void Reset(comm_UINT32 nSequence); - - SvMemoryStream* GetStream(); - - static CNames *pKeyCodes; // Namen der Sondertasten MOD1, F1, LEFT ... - static ControlDefLoad const arKeyCodes []; - -private: - String WandleKeyEventString( String aKeys ); // Nutzt pKeyCodes. - - using CmdBaseStream::Write; - void Write( comm_UINT16 nNr ){CmdBaseStream::Write( nNr );} - void Write( comm_UINT32 nNr ){CmdBaseStream::Write( nNr );} - void Write( const comm_UniChar* aString, comm_UINT16 nLenInChars ){CmdBaseStream::Write( aString, nLenInChars );} - void Write( comm_BOOL bBool ){CmdBaseStream::Write( bBool );} -// new - void Write( String aString, sal_Bool IsKeyString = sal_False ); - - SvMemoryStream *pSammel; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/comm_bas.cxx b/automation/source/testtool/comm_bas.cxx deleted file mode 100644 index 9919369d0..000000000 --- a/automation/source/testtool/comm_bas.cxx +++ /dev/null @@ -1,439 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include "comm_bas.hxx" -#include -#include -#include -#include -#include -#include -#include - -// Der CommunicationManager hat folgende Elemente: -// 1) Properties: -// Keine -// 2) Methoden: -// CommunicationLink StartCommunication( Host, Port ) -// StopAllCommunication // Alle Kommunikation wird abgebrochen -// sal_Bool IsCommunicationRunning // Läuft noch irgendwas -// String GetMyName Der eigene Name -// sal_Bool IsLinkValid( CommunicationLink ) // Ist dieser Link noch gültig -// SetCommunicationEventHandler( String ) // Diese Funktion wird aufgerufen bei jedem Event - -// Der CommunicationLink hat folgende Elemente: -// 1) Properties: -// Keine -// 2) Methoden: -// StopCommunication Die Kommunikation wird abgebrochen -// String GetMyName Der eigene Name -// String GetHostName Der Name des Anderen -// Send(String ) String an den Partner schicken -// String GetString Ergebnis des letzten Empfangs - - -// Diese Implementation ist ein Beispiel fuer eine tabellengesteuerte -// Version, die sehr viele Elemente enthalten kann. Die Elemente werden -// je nach Bedarf aus der Tabelle in das Objekt uebernommen. - -// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt: - -#define _ARGSMASK 0x00FF // Bis zu 255 Argumente -#define _RWMASK 0x0F00 // Maske fuer R/W-Bits -#define _TYPEMASK 0xF000 // Maske fuer den Typ des Eintrags - -#define _READ 0x0100 // kann gelesen werden -#define _BWRITE 0x0200 // kann as Lvalue verwendet werden -#define _LVALUE _BWRITE // kann as Lvalue verwendet werden -#define _READWRITE 0x0300 // beides -#define _OPT 0x0400 // TRUE: optionaler Parameter -#define _METHOD 0x1000 // Masken-Bit fuer eine Methode -#define _PROPERTY 0x2000 // Masken-Bit fuer eine Property -#define _COLL 0x4000 // Masken-Bit fuer eine Collection - // Kombination von oberen Bits: -#define _FUNCTION 0x1100 // Maske fuer Function -#define _LFUNCTION 0x1300 // Maske fuer Function, die auch als Lvalue geht -#define _ROPROP 0x2100 // Maske Read Only-Property -#define _WOPROP 0x2200 // Maske Write Only-Property -#define _RWPROP 0x2300 // Maske Read/Write-Property -#define _COLLPROP 0x4100 // Maske Read-Collection-Element - -#define COLLNAME "Elements" // Name der Collection, hier mal hart verdrahtet - - - -CommunicationWrapper::Methods CommunicationWrapper::aManagerMethods[] = { -// Neue Kommunikation aufbauen -{ "StartCommunication", SbxEMPTY, &CommunicationWrapper::MStartCommunication, 2 | _FUNCTION }, - // Zwei Named Parameter - { "Host", SbxSTRING, NULL, 0 }, - { "Port", SbxLONG, NULL, 0 }, -// Alle Kommunikation wird abgebrochen -{ "StopAllCommunication", SbxEMPTY, &CommunicationWrapper::MStopAllCommunication, 0 | _FUNCTION }, -// Läuft noch irgendwas -{ "IsCommunicationRunning", SbxBOOL, &CommunicationWrapper::MIsCommunicationRunning, 0 | _FUNCTION }, -// Hostname als FQDN erfragen -{ "GetMyName", SbxSTRING, &CommunicationWrapper::MGetMyName, 0 | _FUNCTION }, -// Abfragen ob der Link überhaupt noch gültig ist -{ "IsLinkValid", SbxBOOL, &CommunicationWrapper::MIsLinkValid, 1 | _FUNCTION }, - // Ein Named Parameter - { "Link", SbxOBJECT, NULL, 0 }, -// Dieser Handler wird dauernd gerufen -{ "SetCommunicationEventHandler", SbxEMPTY, &CommunicationWrapper::MSetCommunicationEventHandler, 1 | _FUNCTION }, - // Ein Named Parameter - { "FuncName", SbxSTRING, NULL, 0 }, - -{ NULL, SbxNULL, NULL, -1 }}; // Tabellenende - - - - - - -CommunicationWrapper::Methods CommunicationWrapper::aLinkMethods[] = { -// Die Kommunikation wird abgebrochen -{ "StopCommunication", SbxEMPTY, &CommunicationWrapper::LStopCommunication, 0 | _FUNCTION }, -// Der eigene Name -{ "GetMyName", SbxSTRING, &CommunicationWrapper::LGetMyName, 0 | _FUNCTION }, -// Der Name des Anderen -{ "GetHostName", SbxSTRING, &CommunicationWrapper::LGetHostName, 0 | _FUNCTION }, -// String an den Partner schicken -{ "Send", SbxEMPTY, &CommunicationWrapper::LSend, 1 | _FUNCTION }, - // Ein Named Parameter - { "SendString", SbxSTRING, NULL, 0 }, -// Ergebnis des letzten Empfangs -{ "GetString", SbxSTRING, &CommunicationWrapper::LGetString, 0 | _FUNCTION }, - -{ NULL, SbxNULL, NULL, -1 }}; // Tabellenende - - - - - -// Konstruktor für den Manager -CommunicationWrapper::CommunicationWrapper( const String& rClass ) : SbxObject( rClass ) -, m_pLink( NULL ) -, m_bIsManager( sal_True ) -, m_bCatchOpen( sal_False ) -, m_pNewLink( NULL ) -{ - m_pMethods = &aManagerMethods[0]; - m_pManager = new CommunicationManagerClientViaSocket; - m_pManager->SetConnectionOpenedHdl( LINK( this, CommunicationWrapper, Open ) ); - m_pManager->SetConnectionClosedHdl( LINK( this, CommunicationWrapper, Close ) ); - m_pManager->SetDataReceivedHdl( LINK( this, CommunicationWrapper, Data ) ); -} - -// Konstruktor für den Link -CommunicationWrapper::CommunicationWrapper( CommunicationLink *pThisLink ) : SbxObject( CUniString("Link") ) -, m_pLink( pThisLink ) -, m_bIsManager( sal_False ) -, m_bCatchOpen( sal_False ) -, m_pNewLink( NULL ) -{ - m_pMethods = &aLinkMethods[0]; - m_pManager = (CommunicationManagerClientViaSocket*)pThisLink->GetCommunicationManager(); -} - -// Destruktor -CommunicationWrapper::~CommunicationWrapper() -{ - if ( m_bIsManager ) - delete m_pManager; -} - - -// Suche nach einem Element: -// Hier wird linear durch die Methodentabelle gegangen, bis eine -// passende Methode gefunden wurde. -// Wenn die Methode/Property nicht gefunden wurde, nur NULL ohne -// Fehlercode zurueckliefern, da so auch eine ganze Chain von -// Objekten nach der Methode/Property befragt werden kann. - -SbxVariable* CommunicationWrapper::Find( const String& rName, SbxClassType t ) -{ - // Ist das Element bereits vorhanden? - SbxVariable* pRes = SbxObject::Find( rName, t ); - if( !pRes && t != SbxCLASS_OBJECT ) - { - // sonst suchen - Methods* p = m_pMethods; - short nIndex = 0; - sal_Bool bFound = sal_False; - while( p->nArgs != -1 ) - { - if( rName.CompareIgnoreCaseToAscii( p->pName ) == COMPARE_EQUAL ) - { - bFound = sal_True; break; - } - nIndex += ( p->nArgs & _ARGSMASK ) + 1; - p = m_pMethods + nIndex; - } - if( bFound ) - { - // Args-Felder isolieren: - short nAccess = ( p->nArgs & _RWMASK ) >> 8; - short nType = ( p->nArgs & _TYPEMASK ); - String aName( p->pName, RTL_TEXTENCODING_ASCII_US ); - SbxClassType eCT = SbxCLASS_OBJECT; - if( nType & _PROPERTY ) - eCT = SbxCLASS_PROPERTY; - else if( nType & _METHOD ) - eCT = SbxCLASS_METHOD; - pRes = Make( aName, eCT, p->eType ); - // Wir setzen den Array-Index + 1, da ja noch andere - // Standard-Properties existieren, die auch aktiviert - // werden muessen. - pRes->SetUserData( nIndex + 1 ); - pRes->SetFlags( nAccess ); - } - } - return pRes; -} - -// Aktivierung eines Elements oder Anfordern eines Infoblocks - -void CommunicationWrapper::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCT, - const SfxHint& rHint, const TypeId& rHT ) -{ - const SbxHint* pHint = PTR_CAST(SbxHint,&rHint); - if( pHint ) - { - SbxVariable* pVar = pHint->GetVar(); - SbxArray* pPar = pVar->GetParameters(); - sal_uInt16 nIndex = (sal_uInt16) pVar->GetUserData(); - // kein Index: weiterreichen! - if( nIndex ) - { - sal_uLong t = pHint->GetId(); - if( t == SBX_HINT_INFOWANTED ) - pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) ); - else - { - sal_Bool bWrite = sal_False; - if( t == SBX_HINT_DATACHANGED ) - bWrite = sal_True; - if( t == SBX_HINT_DATAWANTED || bWrite ) - { - // Parameter-Test fuer Methoden: - sal_uInt16 nPar = m_pMethods[ --nIndex ].nArgs & 0x00FF; - // Element 0 ist der Returnwert - if( ( !pPar && nPar ) - || ( pPar && pPar->Count() != nPar+1 ) ) - SetError( SbxERR_WRONG_ARGS ); - // Alles klar, man kann den Call ausfuehren - else - { - (this->*(m_pMethods[ nIndex ].pFunc))( pVar, pPar, bWrite ); - } - } - } - } - SbxObject::SFX_NOTIFY( rBC, rBCT, rHint, rHT ); - } -} - -// Zusammenbau der Infostruktur fuer einzelne Elemente - -SbxInfo* CommunicationWrapper::GetInfo( short nIdx ) -{ - Methods* p = &m_pMethods[ nIdx ]; - // Wenn mal eine Hilfedatei zur Verfuegung steht: - // SbxInfo* pInfo = new SbxInfo( Hilfedateiname, p->nHelpId ); - SbxInfo* pRetInfo = new SbxInfo; - short nPar = p->nArgs & _ARGSMASK; - for( short i = 0; i < nPar; i++ ) - { - p++; - String aName( p->pName, RTL_TEXTENCODING_ASCII_US ); - sal_uInt16 nIFlags = ( p->nArgs >> 8 ) & 0x03; - if( p->nArgs & _OPT ) - nIFlags |= SBX_OPTIONAL; - pRetInfo->AddParam( aName, p->eType, nIFlags ); - } - return pRetInfo; -} - - -//////////////////////////////////////////////////////////////////////////// - -// Hilfsmethoden für den Manager - -IMPL_LINK( CommunicationWrapper, Open, CommunicationLink*, pLink ) -{ - if ( m_bCatchOpen ) - m_pNewLink = pLink; - else - Events( CUniString("Open"), pLink ); - return 1; -} - -IMPL_LINK( CommunicationWrapper, Close, CommunicationLink*, pLink ) -{ - Events( CUniString("Close"), pLink ); - return 1; -} - -IMPL_LINK( CommunicationWrapper, Data, CommunicationLink*, pLink ) -{ - Events( CUniString("Data"), pLink ); - return 1; -} - -void CommunicationWrapper::Events( String aType, CommunicationLink* pLink ) -{ - if ( m_aEventHandlerName.Len() ) - { - SbxArrayRef pPar = new SbxArray( SbxVARIANT ); - pPar->Put( new SbxVariable( SbxSTRING ), 1 ); - pPar->Get( 1 )->PutString( aType ); - - pPar->Put( new SbxVariable( SbxOBJECT ), 2 ); - pPar->Get( 2 )->PutObject( new CommunicationWrapper( pLink ) ); - - Call( m_aEventHandlerName, pPar ); - } - else - delete pLink->GetServiceData(); // Stream wegschmeissen um nicht zu blockieren -} - - -//////////////////////////////////////////////////////////////////////////// - -// Properties und Methoden legen beim Get (bPut = sal_False) den Returnwert -// im Element 0 des Argv ab; beim Put (bPut = sal_True) wird der Wert aus -// Element 0 gespeichert. - -// Die Methoden: - -// Manager -void CommunicationWrapper::MStartCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool /*bWrite*/ ) -{ // CommunicationLink StartCommunication( Host, Port ) - m_bCatchOpen = sal_True; - if ( m_pManager->StartCommunication( ByteString( pPar->Get( 1 )->GetString(), RTL_TEXTENCODING_UTF8 ), pPar->Get( 2 )->GetULong() ) ) - { - while ( !m_pNewLink ) - GetpApp()->Reschedule(); - m_bCatchOpen = sal_False; - CommunicationWrapper *pNewLinkWrapper = new CommunicationWrapper( m_pNewLink ); - m_pNewLink = NULL; - pVar->PutObject( pNewLinkWrapper ); - } - -} - -void CommunicationWrapper::MStopAllCommunication( SbxVariable* /*pVar*/, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // StopAllCommunication // Alle Kommunikation wird abgebrochen - m_pManager->StopCommunication(); -} - -void CommunicationWrapper::MIsCommunicationRunning( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // sal_Bool IsCommunicationRunning // Läuft noch irgendwas - pVar->PutBool( m_pManager->IsCommunicationRunning() ); -} - -void CommunicationWrapper::MGetMyName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // String GetMyName Der eigene Name - pVar->PutString( UniString( m_pManager->GetMyName( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) ); -} - -void CommunicationWrapper::MIsLinkValid( SbxVariable* pVar, SbxArray* pPar, sal_Bool /*bWrite*/ ) -{ // sal_Bool IsLinkValid( CommunicationLink ) // Ist dieser Link noch gültig - CommunicationWrapper *pWrapper = (CommunicationWrapper*)(pPar->Get( 1 )->GetObject()); - pVar->PutBool( m_pManager->IsLinkValid( pWrapper->GetCommunicationLink() ) ); -} - -void CommunicationWrapper::MSetCommunicationEventHandler( SbxVariable* /*pVar*/, SbxArray* pPar, sal_Bool /*bWrite*/ ) -{ // SetCommunicationEventHandler( String ) // Diese Funktion wird aufgerufen bei jedem Event - m_aEventHandlerName = pPar->Get( 1 )->GetString(); -} - - - - - -// Link -void CommunicationWrapper::LStopCommunication( SbxVariable* /*pVar*/, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // StopCommunication Die Kommunikation wird abgebrochen - m_pLink->StopCommunication(); -} - -void CommunicationWrapper::LGetMyName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // String GetMyName Der eigene Name - pVar->PutString( UniString( m_pLink->GetMyName( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) ); -} - -void CommunicationWrapper::LGetHostName( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // String GetHostName Der Name des Anderen - pVar->PutString( UniString( m_pLink->GetCommunicationPartner( CM_FQDN ), RTL_TEXTENCODING_UTF8 ) ); -} - -void CommunicationWrapper::LSend( SbxVariable* /*pVar*/, SbxArray* pPar, sal_Bool /*bWrite*/ ) -{ // Send(String ) String an den Partner schicken - SvStream *pSendStream = m_pLink->GetBestCommunicationStream(); - String aSendString = pPar->Get( 1 )->GetString(); - pSendStream->WriteByteString( aSendString, RTL_TEXTENCODING_UTF8 ); - m_pLink->TransferDataStream( pSendStream ); - delete pSendStream; -} - -void CommunicationWrapper::LGetString( SbxVariable* pVar, SbxArray* /*pPar*/, sal_Bool /*bWrite*/ ) -{ // String GetString Ergebnis des letzten Empfangs - SvStream *pReceiveStream = m_pLink->GetServiceData(); - if ( pReceiveStream ) - { - sal_uLong nLength = pReceiveStream->Seek( STREAM_SEEK_TO_END ); - pReceiveStream->Seek( STREAM_SEEK_TO_BEGIN ); - char *pBuffer = new char[nLength]; - pReceiveStream->Read( pBuffer, nLength ); - String aReceive( - pBuffer, sal::static_int_cast< xub_StrLen >( nLength ), - RTL_TEXTENCODING_UTF8 ); - delete [] pBuffer; - pVar->PutString( aReceive ); - delete pReceiveStream; - } - else - pVar->PutString( UniString() ); -} - - - -// Die Factory legt unser Objekte an. - -SbxObject* CommunicationFactory::CreateObject( const String& rClass ) -{ - if( rClass.CompareIgnoreCaseToAscii( "CommunicationManager" ) == COMPARE_EQUAL ) - return new CommunicationWrapper( rClass ); - return NULL; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/comm_bas.hxx b/automation/source/testtool/comm_bas.hxx deleted file mode 100644 index 99d54a427..000000000 --- a/automation/source/testtool/comm_bas.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _COMM_BAS_HXX -#define _COMM_BAS_HXX - -#include -#include -#include - -class CommunicationManagerClientViaSocket; -class CommunicationLink; - -class CommunicationWrapper : public SbxObject // Einer f�r Manager und Links -{ - // Definition eines Tabelleneintrags. Dies wird hier gemacht, - // da dadurch die Methoden und Properties als private deklariert - // werden koennen. -#if defined ( ICC ) || defined ( C50 ) -public: -#endif - typedef void( CommunicationWrapper::*pMeth ) - ( SbxVariable* pThis, SbxArray* pArgs, sal_Bool bWrite ); -#if defined ( ICC ) -private: -#endif - - struct Methods { - const char* pName; // Name des Eintrags - SbxDataType eType; // Datentyp - pMeth pFunc; // Function Pointer - short nArgs; // Argumente und Flags - }; - static Methods aManagerMethods[]; // Methodentabelle - static Methods aLinkMethods[]; // Methodentabelle - Methods *m_pMethods; // Aktuelle Methodentabelle - - // Methoden - // Manager - void MStartCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void MStopAllCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void MIsCommunicationRunning( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void MGetMyName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void MIsLinkValid( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void MSetCommunicationEventHandler( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - - // Link - void LStopCommunication( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void LGetMyName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void LGetHostName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void LSend( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - void LGetString( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite ); - - // Interne Member und Methoden - CommunicationManagerClientViaSocket *m_pManager; - CommunicationLink *m_pLink; - sal_Bool m_bIsManager; // Ist es kein Manager, so ist es ein Link - - // Kram f�r Manager - DECL_LINK( Open, CommunicationLink* ); - DECL_LINK( Close, CommunicationLink* ); - DECL_LINK( Data, CommunicationLink* ); - void Events( String aType, CommunicationLink* pLink ); - sal_Bool m_bCatchOpen; - CommunicationLink *m_pNewLink; - String m_aEventHandlerName; - - using SbxVariable::GetInfo; - // Infoblock auffuellen - SbxInfo* GetInfo( short nIdx ); - - // Broadcaster Notification - virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, - const SfxHint& rHint, const TypeId& rHintType ); -public: - CommunicationWrapper( const String& ); - CommunicationWrapper( CommunicationLink *pThisLink ); - ~CommunicationWrapper(); - // Suchen eines Elements - virtual SbxVariable* Find( const String&, SbxClassType ); - - CommunicationLink* GetCommunicationLink() { return m_pLink; } -}; - - -// Die dazugehoerige Factory: - -class CommunicationFactory : public SbxFactory -{ -public: - virtual SbxObject* CreateObject( const String& ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/cretstrm.cxx b/automation/source/testtool/cretstrm.cxx deleted file mode 100644 index 0fb0285ea..000000000 --- a/automation/source/testtool/cretstrm.cxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" -#include "cretstrm.hxx" -#include -#include "rcontrol.hxx" -#include "svcommstream.hxx" - - -SV_IMPL_REF(SbxBase) - -CRetStream::CRetStream(SvStream *pIn) -{ - pSammel = pIn; - delete pCommStream; - pCommStream = new SvCommStream( pSammel ); -} - -CRetStream::~CRetStream() -{ - delete pCommStream; -} - -void CRetStream::Read ( String &aString ) -{ - comm_UniChar* pStr; - sal_uInt16 nLenInChars; - CmdBaseStream::Read( pStr, nLenInChars ); - - aString = String( pStr, nLenInChars ); - delete [] pStr; -} - -void CRetStream::Read( SbxValue &aValue ) -{ - *pSammel >> nId; - if (nId != BinSbxValue) - { - OSL_TRACE( "Falscher Typ im Stream: Erwartet SbxValue, gefunden :%hu", nId ); - } - SbxBaseRef xBase = SbxBase::Load( *pSammel ); - if ( IS_TYPE( SbxValue, xBase ) ) - aValue = *PTR_CAST( SbxValue, &xBase ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/cretstrm.hxx b/automation/source/testtool/cretstrm.hxx deleted file mode 100644 index f33dc65a8..000000000 --- a/automation/source/testtool/cretstrm.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CRETSTRM_HXX -#define _CRETSTRM_HXX - -#include -#include - -#include "cmdbasestream.hxx" - -class CRetStream : public CmdBaseStream -{ - SvStream *pSammel; - sal_uInt16 nId; - -public: - CRetStream( SvStream *pIn ); - ~CRetStream(); - - using CmdBaseStream::Read; - void Read ( comm_UINT16 &nNr ){CmdBaseStream::Read ( nNr );} - void Read ( comm_UINT32 &nNr ){CmdBaseStream::Read ( nNr );} - virtual void Read ( rtl::OString* &pId ){CmdBaseStream::Read ( pId );} - void Read ( comm_BOOL &bBool ){CmdBaseStream::Read ( bBool );} - void Read( String &aString ); - void Read( SbxValue &aValue ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/filter.pl b/automation/source/testtool/filter.pl deleted file mode 100644 index 7542dea9c..000000000 --- a/automation/source/testtool/filter.pl +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/perl -#************************************************************************* -#* -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************/ - -$debug = ""; -$ctrue = 1; -$cfalse = 0; -# reads a block -# Parameter: FileHandle -# list of Regular Expressions which terminate the block. -# for '#ifdef' block would then be ("^#else\$", "^#endif\$") - -sub read_block { - - local($file) = @_; - print "reading block '$file' ",scalar(@_),"\n" if $debug; - while ( <$file> ) { - chop; - s/\s*$//; # remove trailing whitespaces - s/^\s*//; # remove leading whitespaces - print "Input : \"$_\"\n" if $debug; - s/\/\/.*//; # Remove line comment - s/\/\*.*?\*\///g; # remove comments within one line - s/\s+/ /g; # Change all whitespace into a single blank - s/ *$//; # Remove whitespace at end - s/^# /#/; # Change # to # - - - @line = split(/ /,$_,3); - - $_ = $line[0]; - if ( $_ && /^#/ ) { # Line starts with '#' -> preprocessor command - print "proccessing line: @line\n" if $debug; - if (/#define/) - { - if ( $line[1] =~ /^$namefilter/ ) - { - $mykey = $line[1]; - $mykey =~ s/^$namefilter//; - $count += 1; - print OUT "$mykey ", $line[2], "\n"; - print OUT2 "\t{ \"$mykey\", ", $line[2] ," },\n"; - } - } - } - } - print "Leaving read_block at the end\n" if $debug; -} - -# Read a file. -# first parameter ist the filename -sub read_file { - - local ($filename,$file) = @_; - $file++; # String increment - local $TempFileName = $basename."/".$filename; - print "reading file $TempFileName as $file\n" if $debug; - open($file, $TempFileName) || die "error: Could not open file $TempFileName. "; - - &read_block($file); # read data - close($file); - print "done reading $filename\n" if $debug; -} - -# main starts here - -$basename = "."; -$basename = $ARGV[0] if defined($ARGV[0]); - -$filename = "app.hrc"; -$filename = $ARGV[1] if defined($ARGV[1]); - - -$outfilebase = $filename; -$outfilebase =~ s/\.[^.]+$//; # cut off suffix -$outfilebase = $ARGV[2] if defined($ARGV[2]); - - -$namefilter = $ARGV[3] if defined($ARGV[3]); - - -print "Generating $outfilebase:\n"; - -$count = 0; - -open(OUT,">$outfilebase"); -open(OUT2,">$outfilebase.hxx"); -print OUT2 "\{\n"; - -&read_file ($filename,"f00"); - -print OUT2 "\t{ \"\" ,0 }\n\};\n"; - -close(OUT); -close(OUT2); - -if ( $count == 0 ) -{ - die "Error: No Entries Found generating \"$outfilebase.hxx\". Testtool will not work!" -} - diff --git a/automation/source/testtool/httprequest.cxx b/automation/source/testtool/httprequest.cxx deleted file mode 100644 index b94082843..000000000 --- a/automation/source/testtool/httprequest.cxx +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include -#include "httprequest.hxx" -#include -#include - - -void HttpRequest::Init() -{ - nResultId = 0; - aHeader = rtl::OString(); - aContentType = rtl::OString(); - delete pStream; - pStream = NULL; -} - -HttpRequest::HttpRequest() - : nStatus(HTTP_INIT), pOutSocket(NULL), - nResultId(0), pStream(NULL) -{ -} - -HttpRequest::~HttpRequest() -{ - delete pStream; - delete pOutSocket; -} - -void HttpRequest::SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort ) -{ - nStatus = HTTP_REQUEST_SET; - Init(); - aRequestHost = aHost; - aRequestPath = aPath; - nRequestPort = nPort; -} - -void HttpRequest::SetProxy( rtl::OString aHost, sal_uInt16 nPort ) -{ - nStatus = HTTP_REQUEST_SET; - Init(); - aProxyHost = aHost; - nProxyPort = nPort; -} - -sal_Bool HttpRequest::Execute() -{ - nStatus = HTTP_REQUEST_PENDING; - Init(); - - // Open channel to standard redir host - osl::SocketAddr aConnectAddr; - - if ( aProxyHost.getLength() ) - { - aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aProxyHost, RTL_TEXTENCODING_UTF8 ), nProxyPort ); - } - else - { - aConnectAddr = osl::SocketAddr( rtl::OStringToOUString( aRequestHost, RTL_TEXTENCODING_UTF8 ), nRequestPort ); - } - - TimeValue aTV; - aTV.Seconds = 10; // Warte 10 Sekunden - aTV.Nanosec = 0; - - pOutSocket = new osl::ConnectorSocket(); - if ( pOutSocket->connect( aConnectAddr, &aTV ) != osl_Socket_Ok ) - { - delete pOutSocket; - pOutSocket = NULL; - nStatus = HTTP_REQUEST_ERROR; - return sal_False; - } - - SendString( pOutSocket, "GET " ); - if ( aProxyHost.getLength() ) - { - //GET http://staroffice-doc.germany.sun.com/cgi-bin/htdig/binarycopy.sh?CopyIt=++CopyIt++ HTTP/1.0 - SendString( pOutSocket, "http://" ); - SendString( pOutSocket, aRequestHost ); - SendString( pOutSocket, ":" ); - SendString( pOutSocket, rtl::OString::valueOf( (sal_Int32) nRequestPort ) ); - SendString( pOutSocket, aRequestPath ); - SendString( pOutSocket, " HTTP/1.0\n" ); - - SendString( pOutSocket, "Proxy-Connection: Keep-Alive\n" ); - } - else - { - //GET /cgi-bin/htdig/binarycopy.sh?CopyIt=++CopyIt++ HTTP/1.0 - SendString( pOutSocket, aRequestPath ); - SendString( pOutSocket, " HTTP/1.0\n" ); - - SendString( pOutSocket, "Connection: Keep-Alive\n" ); - } - - SendString( pOutSocket, "User-Agent: Mozilla/4.7 [de] (Linux; I)" ); - SendString( pOutSocket, "Host: " ); - SendString( pOutSocket, aRequestHost ); - // Terminate with empty line - SendString( pOutSocket, "\n\n" ); - - - -#define BUFFRE_SIZE 0x10000 // 64K Buffer - char* pBuffer = new char[ BUFFRE_SIZE ]; - - sal_Bool bWasError = ( nStatus != HTTP_REQUEST_PENDING ); - - sal_uLong nDataRead; - pStream = new SvMemoryStream( 0x10000, 0x10000 ); - while ( !bWasError ) - { - bWasError |= ( BUFFRE_SIZE != ( nDataRead = pOutSocket->read( pBuffer, BUFFRE_SIZE ) ) ); - - pStream->Write( pBuffer, nDataRead ); - } - - delete [] pBuffer; - pOutSocket->shutdown(); - pOutSocket->close(); - - pStream->Seek( 0 ); - - rtl::OString aLine; - sal_Bool bInsideHeader = sal_True; - sal_Int32 nIndex; - while ( bInsideHeader ) - { - pStream->ReadLine( aLine ); - if ( !aLine.getLength() ) - bInsideHeader = sal_False; - else - { - if ( IsItem( "HTTP/", aLine ) ) { - nIndex = 0; - nResultId = (sal_uInt16)aLine.getToken( (sal_Int32)1, ' ', nIndex ).toInt32(); - } - if ( IsItem( "Content-Type:", aLine ) ) - { - aContentType = aLine.copy( 13 ); - aContentType.trim(); - } - aHeader += aLine; - aHeader += "\n"; - } - } - - if ( nStatus == HTTP_REQUEST_PENDING ) - { - nStatus = HTTP_REQUEST_DONE; - return sal_True; - } - else - { - nStatus = HTTP_REQUEST_ERROR; - return sal_False; - } -} -/* -HTTP/1.1 200 OK -Date: Tue, 22 Jan 2002 14:16:20 GMT -Server: Apache/1.3.14 (Unix) (SuSE/Linux) mod_throttle/3.0 mod_layout/1.0 mod_f -astcgi/2.2.2 mod_jk -Set-Cookie2: JSESSIONID=ffkpgb7tm1;Version=1;Discard;Path="/bugtracker" -Set-Cookie: JSESSIONID=ffkpgb7tm1;Path=/bugtracker -Servlet-Engine: Tomcat Web Server/3.2.1 (JSP 1.1; Servlet 2.2; Java 1.3.0; Linux - 2.4.0-4GB i386; java.vendor=Sun Microsystems Inc.) -Connection: close -Content-Type: text/xml; charset=ISO-8859-1 - */ -void HttpRequest::SendString( osl::StreamSocket* pSocket , rtl::OString aText ) -{ - if ( nStatus == HTTP_REQUEST_PENDING ) - pSocket->write( aText.getStr(), aText.getLength() ); -} - -sal_Bool HttpRequest::IsItem( rtl::OString aItem, rtl::OString aLine ) -{ - return aItem.match( aLine ); -} - - -SvMemoryStream* HttpRequest::GetBody() -{ - return pStream; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/httprequest.hxx b/automation/source/testtool/httprequest.hxx deleted file mode 100644 index 438dba8da..000000000 --- a/automation/source/testtool/httprequest.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _HTTPREQUEST_HXX_ -#define _HTTPREQUEST_HXX_ - -#define HTTP_INIT 0 -#define HTTP_REQUEST_SET 1 -#define HTTP_REQUEST_PENDING 2 -#define HTTP_REQUEST_DONE 3 -#define HTTP_REQUEST_ERROR 4 - -#include -#include - -namespace osl -{ - class StreamSocket; - class ConnectorSocket; -} - -class HttpRequest -{ - rtl::OString aRequestPath; - rtl::OString aRequestHost; - sal_uInt16 nRequestPort; - rtl::OString aProxyHost; - sal_uInt16 nProxyPort; - - sal_uInt16 nStatus; - osl::ConnectorSocket *pOutSocket; - - rtl::OString aHeader; - sal_uInt16 nResultId; - rtl::OString aContentType; - SvMemoryStream* pStream; - - void SendString( osl::StreamSocket* pSocket, ::rtl::OString aText ); - sal_Bool IsItem( rtl::OString aItem, rtl::OString aLine ); - void Init(); -public: - HttpRequest(); - ~HttpRequest(); - - void SetRequest( rtl::OString aHost, rtl::OString aPath, sal_uInt16 nPort ); - void SetProxy( rtl::OString aHost, sal_uInt16 nPort ); - - sal_Bool Execute(); - - rtl::OString GetHeader() const { return aHeader; } - SvMemoryStream* GetBody(); - - rtl::OString GetContentType() const { return aContentType; } - sal_uInt16 GetResultId() const { return nResultId; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/makefile.mk b/automation/source/testtool/makefile.mk deleted file mode 100644 index d23069e78..000000000 --- a/automation/source/testtool/makefile.mk +++ /dev/null @@ -1,107 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=automation -TARGET=testtool - -# --- Settings ------------------------------------------------------------ - -.INCLUDE : settings.mk - -# --- Allgemein ------------------------------------------------------------ - -OBJFILES = \ - $(EXCEPTIONSFILES) \ - $(OBJ)$/cretstrm.obj \ - $(OBJ)$/httprequest.obj \ - - -EXCEPTIONSFILES= \ - $(OBJ)$/cmdstrm.obj \ - $(OBJ)$/comm_bas.obj \ - $(OBJ)$/objtest.obj \ - $(OBJ)$/tcommuni.obj - -HXXFILES = $(INCCOM)$/keycodes.hxx \ - $(INCCOM)$/classes.hxx \ - $(INCCOM)$/r_cmds.hxx \ - $(INCCOM)$/res_type.hxx - -.IF "$(GUI)" == "WNT" -OBJFILES += $(OBJ)$/sysdir_win.obj -OBJFILES += $(OBJ)$/registry_win.obj -.ENDIF -# --- Targets ------------------------------------------------------------ - -.INCLUDE : target.mk - - -$(OBJFILES) : $(HXXFILES) -$(HXXFILES) : $(MISC)$/xfilter.pl - - -$(INCCOM)$/keycodes.hxx : $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/vcl$/keycodes.hxx \ - $(MISC)$/xfilter.pl - $(PERL) $(MISC)$/xfilter.pl $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT) vcl$/keycodes.hxx $(INCCOM)$/keycodes KEY_ - -$(INCCOM)$/classes.hxx : ..$/inc$/rcontrol.hxx \ - $(MISC)$/xfilter.pl - $(PERL) $(MISC)$/xfilter.pl ..$/inc rcontrol.hxx $(INCCOM)$/classes M_ - -$(INCCOM)$/r_cmds.hxx : ..$/inc$/rcontrol.hxx \ - $(MISC)$/xfilter.pl - $(PERL) $(MISC)$/xfilter.pl ..$/inc rcontrol.hxx $(INCCOM)$/r_cmds RC_ - -$(INCCOM)$/res_type.hxx : $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT)$/tools$/wintypes.hxx \ - $(MISC)$/xfilter.pl - $(PERL) $(MISC)$/xfilter.pl $(SOLARVERSION)$/$(INPATH)$/inc$(UPDMINOREXT) tools$/wintypes.hxx $(INCCOM)$/res_type WINDOW_ - - - -$(MISC)$/xfilter.pl : filter.pl - tr -d "\015" < filter.pl > $(MISC)$/xfilter.pl - chmod 664 $(MISC)$/xfilter.pl - - - -.IF "$(GUI)"=="UNX" -INIFILESUFFIX=rc -BRANDPATH=none -.ELIF "$(GUI)"=="WNT" -INIFILESUFFIX=.ini -BRANDPATH=.. -.END - -$(BIN)$/testtool$(INIFILESUFFIX): testtool.ini - $(SED) -e s/$(EMQ)!INIFILESUFFIX$(EMQ)!/$(INIFILESUFFIX)/ \ - -e s/$(EMQ)!BRANDPATH$(EMQ)!/$(BRANDPATH)/ < $< > $@ - -ALLTAR: \ - $(BIN)$/testtool$(INIFILESUFFIX) - diff --git a/automation/source/testtool/objtest.cxx b/automation/source/testtool/objtest.cxx deleted file mode 100644 index 77f2f10d6..000000000 --- a/automation/source/testtool/objtest.cxx +++ /dev/null @@ -1,4120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -#include "sysdir_win.hxx" -#include "registry_win.hxx" -#include "ittresid.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::frame; -using namespace com::sun::star::bridge; -using namespace com::sun::star::connection; - -using ::rtl::OUString; - -#include - -#ifdef UNX -#include // readlink -#include -#endif - -#include - -#include -#include -#include "tcommuni.hxx" -#include "comm_bas.hxx" -#include - -#include "objtest.hxx" -#include "rcontrol.hxx" - -#include -#include - -#include -#include -#include - -#include - -#ifndef SBX_VALUE_DECL_DEFINED -#define SBX_VALUE_DECL_DEFINED -SV_DECL_REF(SbxValue) -#endif -SV_IMPL_REF(SbxValue) - -static CommunicationFactory aComManFac; - -#define cMyDelim ' ' -#define P_FEHLERLISTE pFehlerListe -#define KEEP_SEQUENCES 100 // Keep Names of last 100 Calls - - -ControlDefLoad const Controls::arClasses [] = -#include "classes.hxx" -CNames *Controls::pClasses = NULL; - -ControlDefLoad const TestToolObj::arR_Cmds [] = -#include "r_cmds.hxx" -CNames *TestToolObj::pRCommands = NULL; -CErrors *TestToolObj::pFehlerListe = NULL; // Hier werden die Fehler des Testtools gespeichert - - -DBG_NAME( ControlItem ) -DBG_NAME( ControlDef ) - -ControlItem::ControlItem( const sal_Char *Name, rtl::OString aUIdP ) -{ -DBG_CTOR(ControlItem,0); - InitData(); - pData->Kurzname.AssignAscii( Name ); - pData->aUId = aUIdP; -} - -ControlItem::ControlItem( const String &Name, rtl::OString aUIdP ) -{ -DBG_CTOR(ControlItem,0); - InitData(); - pData->Kurzname = Name; - pData->aUId = aUIdP; -} - -ControlItem::ControlItem( ControlData *pDataP ) -{ -DBG_CTOR(ControlItem,0); - pData = pDataP; -} - -ControlSon::~ControlSon() -{ - if (pSons) - { - delete pSons; - pSons = NULL; - } -} - -ControlItemSon::ControlItemSon(const String &Name, rtl::OString aUIdP ) -: ControlItem( Name, aUIdP ) -{} - -sal_Bool ControlDef::operator < (const ControlItem &rPar) -{ - return pData->Kurzname.CompareIgnoreCaseToAscii(rPar.pData->Kurzname) == COMPARE_LESS; -} - -sal_Bool ControlDef::operator == (const ControlItem &rPar) -{ - return pData->Kurzname.CompareIgnoreCaseToAscii(rPar.pData->Kurzname) == COMPARE_EQUAL; -} - -void ControlDef::Write( SvStream &aStream ) -{ - // FIXME: HELPID - #if 0 - if ( pSons ) - aStream.WriteByteString( String('*').Append( pData->Kurzname ), RTL_TEXTENCODING_UTF8 ); - else - aStream.WriteByteString( pData->Kurzname, RTL_TEXTENCODING_UTF8 ); - aStream << ((sal_uInt16)pData->aUId.HasNumeric()); - if ( pData->aUId.HasString() ) - aStream.WriteByteString( pData->aUId.GetStr(), RTL_TEXTENCODING_UTF8 ); - else - aStream << static_cast(pData->aUId.GetNum()); //GetNum() sal_uLong != comm_UINT32 on 64bit - if ( pSons ) - for ( sal_uInt16 i = 0 ; pSons->Count() > i ; i++ ) - ((ControlDef*)(*pSons)[i])->Write(aStream); - #else - (void)aStream; - #endif -} - -ControlDef::ControlDef(const String &Name, rtl::OString aUIdP ) -: ControlItemSon( Name, aUIdP) -{ - DBG_CTOR(ControlDef,0); -} - -ControlDef::ControlDef(const String &aOldName, const String &aNewName, ControlDef *pOriginal, sal_Bool bWithSons ) -: ControlItemSon("", pOriginal->pData->aUId) -{ - DBG_CTOR(ControlDef,0); - if ( pOriginal->pData->Kurzname == aOldName ) - pData->Kurzname = aNewName; - else - pData->Kurzname = pOriginal->pData->Kurzname; - - if ( bWithSons && pOriginal->pSons ) - { - pSons = new CNames(); - for ( sal_uInt16 i = 0; i < pOriginal->pSons->Count() ; i++) - { - ControlDef *pNewDef; - pNewDef = new ControlDef( aOldName, aNewName, pOriginal->SonGetObject(i) ,sal_True ); - if (! SonInsert(pNewDef)) - { - OSL_FAIL("Name Doppelt im CopyConstructor. Neuer Name = Controlname!!"); - delete pNewDef; - } - } - - } - else - pSons = NULL; -} - -sal_Bool ControlItemUId::operator < (const ControlItem &rPar) -{ - return pData->aUId < rPar.pData->aUId; -} - -sal_Bool ControlItemUId::operator == (const ControlItem &rPar) -{ - return pData->aUId == rPar.pData->aUId; -} - -SV_IMPL_OP_PTRARR_SORT( CNames, ControlItem* ) - -void CRevNames::Insert( String aName, rtl::OString aUId, sal_uLong nSeq ) -{ - ControlItem *pRN = new ReverseName(aName,aUId,nSeq); - sal_uInt16 nPos; - if ( Seek_Entry(pRN,&nPos) ) - DeleteAndDestroy(nPos); - - if ( !CNames::C40_PTR_INSERT( ControlItem, pRN) ) - { - OSL_FAIL("Interner Fehler beim Speichern der Lokalen KurzNamen"); - delete pRN; - } - -} - -String CRevNames::GetName( rtl::OString aUId ) -{ - ReverseName *pRN = new ReverseName(UniString(),aUId,0); - sal_uInt16 nPos; - sal_Bool bSeekOK = Seek_Entry(pRN,&nPos); - - delete pRN; - if ( bSeekOK ) - return GetObject(nPos)->pData->Kurzname; - else - { - // FIXME: HELPID - #if 0 - if ( aUId.Matches( UID_ACTIVE ) ) - return CUniString("Active"); - else - return GEN_RES_STR1( S_NAME_NOT_THERE, aUId.GetText() ); - #else - return String(); - #endif - } -} - -void CRevNames::Invalidate ( sal_uLong nSeq ) -{ - sal_uInt16 i; - for (i = 0; i < Count() ;) - { - if (((ReverseName*)GetObject(i))->LastSequence < nSeq) - DeleteAndDestroy(i); - else - i++; - } -} - - -SV_IMPL_PTRARR(CErrors, ErrorEntry*) - - -SbxTransportMethod::SbxTransportMethod( SbxDataType DT ) -: SbxMethod(CUniString("Dummy"),DT) -{ - nValue = 0; -} - - -TestToolObj::TestToolObj( String aName, String aFilePath ) // Interner Aufruf -: SbxObject( aName ) -, bUseIPC(sal_False) -, bReturnOK(sal_True) -, nSequence(KEEP_SEQUENCES) -, ProgPath() -, IsBlock(sal_False) -, SingleCommandBlock(sal_True) -, m_pControls(NULL) -, m_pNameKontext(NULL) -, m_pSIds(NULL) -, m_pReverseSlots(NULL) -, m_pReverseControls(NULL) -, m_pReverseControlsSon(NULL) -, m_pReverseUIds(NULL) -, pCommunicationManager(NULL) -, aDialogHandlerName() -, nWindowHandlerCallLevel(0) -, nIdleCount(0) -{ - pImpl = new ImplTestToolObj; - pImpl->ProgParam = String(); - pImpl->aFileBase = DirEntry(aFilePath); - pImpl->aHIDDir = DirEntry(aFilePath); - pImpl->bIsStart = sal_False; - pImpl->pMyBasic = NULL; - - pImpl->aServerTimeout = Time(0,1,00); // 1:00 Minuten fest - InitTestToolObj(); -} - -TestToolObj::TestToolObj( String aName, MyBasic* pBas ) // Aufruf im Testtool -: SbxObject( aName ) -, bUseIPC(sal_True) -, bReturnOK(sal_True) -, nSequence(KEEP_SEQUENCES) -, ProgPath() -, IsBlock(sal_False) -, SingleCommandBlock(sal_True) -, m_pControls(NULL) -, m_pNameKontext(NULL) -, m_pSIds(NULL) -, m_pReverseSlots(NULL) -, m_pReverseControls(NULL) -, m_pReverseControlsSon(NULL) -, m_pReverseUIds(NULL) -, pCommunicationManager(NULL) -, aDialogHandlerName() -, nWindowHandlerCallLevel(0) -, nIdleCount(0) -{ - pImpl = new ImplTestToolObj; - pImpl->ProgParam = String(); - pImpl->bIsStart = sal_False; - pImpl->pMyBasic = pBas; - - LoadIniFile(); - InitTestToolObj(); - - pCommunicationManager = new CommunicationManagerClientViaSocketTT(); - pCommunicationManager->SetDataReceivedHdl( LINK( this, TestToolObj, ReturnResultsLink )); -} - -void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die durch den ConfigDialog ge�ndert werden k�nnen -{ -#define GETSET(aVar, KeyName, Dafault) \ - { \ - ByteString __##aVar##__; \ - __##aVar##__ = aConf.ReadKey(KeyName); \ - if ( !__##aVar##__.Len() ) \ - { \ - __##aVar##__ = Dafault; \ - aConf.WriteKey(KeyName, __##aVar##__); \ - } \ - aVar = UniString( __##aVar##__, RTL_TEXTENCODING_UTF8 );\ - } - -#define NEWOLD( NewKey, OldKey ) \ - { \ - ByteString aValue; \ - if ( ( (aValue = aConf.ReadKey( OldKey )).Len() ) && !aConf.ReadKey( NewKey ).Len() ) \ - aConf.WriteKey( NewKey, aValue ); \ - } - - - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Misc"); - ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); - aConf.SetGroup( aCurrentProfile ); - - NEWOLD( "BaseDir", "Basisverzeichnis" ) - String aFB; - GETSET( aFB, "BaseDir", "" ); - pImpl->aFileBase = DirEntry(aFB); - - // remove old keys - if ( aConf.ReadKey("KeyCodes + Classes").Len() != 0 || - aConf.ReadKey("KeyCodes + Classes + Res_Type").Len() != 0 ) - { - aConf.DeleteKey("KeyCodes + Classes + Res_Type"); - aConf.DeleteKey("KeyCodes + Classes"); - } - - NEWOLD( "LogBaseDir", "LogBasisverzeichnis" ) - String aLFB; - GETSET( aLFB, "LogBaseDir", ByteString( aFB, RTL_TEXTENCODING_UTF8 ) ); - pImpl->aLogFileBase = DirEntry(aLFB); - - NEWOLD( "HIDDir", "HIDVerzeichnis" ) - String aHID; - GETSET( aHID, "HIDDir", "" ); - pImpl->aHIDDir = DirEntry(aHID); - - - aConf.SetGroup("Misc"); - - String aST; - GETSET( aST, "ServerTimeout", rtl::OString::valueOf(Time(0,0,45).GetTime()) ); // 45 Sekunden Initial - pImpl->aServerTimeout = Time(sal_uLong(aST.ToInt64())); - - String aSOSE; - aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Misc" ); - aConf.SetGroup( aCurrentProfile ); - GETSET( aSOSE, "StopOnSyntaxError", "0" ); - pImpl->bStopOnSyntaxError = aSOSE.EqualsAscii("1"); - - - aConf.SetGroup("GUI Platform"); - -// #i68804# Write default Communication section to testtoolrc/.ini -// this is not fastest but too keep defaultsettings in one place in the code - GetHostConfig(); - GetTTPortConfig(); - GetUnoPortConfig(); - - aConf.SetGroup("Crashreporter"); - - String aUP; - GETSET( aUP, "UseProxy", "false" ); - String aPS; - GETSET( aPS, "ProxyServer", "" ); - String aPP; - GETSET( aPP, "ProxyPort", "" ); - String aAC; - GETSET( aAC, "AllowContact", "false" ); - String aRA; - GETSET( aRA, "ReturnAddress", "" ); - - OUString sPath; - if( osl_getExecutableFile( (rtl_uString**)&sPath ) == osl_Process_E_None) - { - sPath = sPath.copy(7); // strip file:// - - int i = sPath.lastIndexOf('/'); - if (i >= 0) - i = sPath.lastIndexOf('/', i-1 ); - - if (i >= 0) - { - sPath = sPath.copy(0, i); - ByteString bsPath( sPath.getStr(), sPath.getLength(), - RTL_TEXTENCODING_UTF8 ); - - aConf.SetGroup( "OOoProgramDir" ); - String aOPD; - // testtool is installed in Basis3.x/program/ dir nowadays - bsPath += "/../program"; - GETSET( aOPD, "Current", bsPath); - - ByteString aSrcRoot(getenv("SRC_ROOT")); - aConf.SetGroup( "_profile_Default" ); - if (aSrcRoot.Len()) - { - String aPBD; - aSrcRoot += "/testautomation"; - GETSET( aPBD, "BaseDir", aSrcRoot ); - - String aPHD; - aSrcRoot += "/global/hid"; - GETSET( aPHD, "HIDDir", aSrcRoot ); - } - else - { - String aPBD; - bsPath += "/qatesttool"; - GETSET( aPBD, "BaseDir", bsPath ); - - String aPHD; - bsPath += "/global/hid"; - GETSET( aPHD, "HIDDir", bsPath ); - } - - String aLD; - GETSET( aLD, "LogBaseDir", ByteString( "/tmp" ) ); - } - } -} - -#define MAKE_TT_KEYWORD( cName, aType, aResultType, nID ) \ -{ \ - SbxVariableRef pMeth; \ - pMeth = Make( CUniString(cName), aType, aResultType ); \ - pMeth->SetUserData( nID ); \ -} - -// SetUserData mu� irgendwas sein, sonst wird es im Find rausgefiltert!!! -#define MAKE_USHORT_CONSTANT(cName, nValue) \ - { \ - SbxProperty *pVal = new SbxProperty( CUniString( cName) , SbxINTEGER ); \ - pVal->PutInteger( nValue ) ; \ - pVal->SetUserData( 32000 ); \ - Insert( pVal ); \ - } - -#define RTLNAME "@SBRTL" // copied from basic/source/classes/sb.cxx - -void TestToolObj::InitTestToolObj() -{ - pImpl->nNumBorders = 0; // F�r Profiling mit k�stchen - - pImpl->nMinRemoteCommandDelay = 0; - pImpl->nMaxRemoteCommandDelay = 0; - pImpl->bDoRemoteCommandDelay = sal_False; - - pImpl->bLnaguageExtensionLoaded= sal_False; - pImpl->pTTSfxBroadcaster = NULL; - - pImpl->nErrorCount = 0; - pImpl->nWarningCount = 0; - pImpl->nQAErrorCount = 0; - pImpl->nIncludeFileWarningCount = 0; - - pImpl->xErrorList = new SbxDimArray( SbxSTRING ); - pImpl->xWarningList = new SbxDimArray( SbxSTRING ); - pImpl->xQAErrorList = new SbxDimArray( SbxSTRING ); - pImpl->xIncludeFileWarningList = new SbxDimArray( SbxSTRING ); - - pImpl->nTestCaseLineNr = 0; - - pImpl->bEnableQaErrors = sal_True; - pImpl->bDebugFindNoErrors = sal_False; - - pImpl->pChildEnv = new Environment; - - if (!pFehlerListe) - pFehlerListe = new CErrors; // Vor allem anderen. Wer weiss, wer alles einen Fehler ausl�st. - - In = new CmdStream(); - - pShortNames = new CRevNames; - - pImpl->pHttpRequest = NULL; - -// overwrite standard "wait" method, cause we can do better than that!! -// Insert Object into SbiStdObject but change listening. - SbxVariable* pRTL = pImpl->pMyBasic->Find( CUniString(RTLNAME), SbxCLASS_DONTCARE ); - SbxObject* pRTLObject = PTR_CAST( SbxObject, pRTL ); - if ( pRTLObject ) - { - SbxVariableRef pWait; - pWait = pRTLObject->Make( CUniString("Wait"), SbxCLASS_METHOD, SbxNULL ); - pWait->SetUserData( ID_Wait ); - // change listener here - pRTLObject->EndListening( pWait->GetBroadcaster(), sal_True ); - StartListening( pWait->GetBroadcaster(), sal_True ); - } - else - { - OSL_FAIL("Testtool: Could not replace Wait method"); - } - - MAKE_TT_KEYWORD( "Kontext", SbxCLASS_METHOD, SbxNULL, ID_Kontext ); - MAKE_TT_KEYWORD( "GetNextError", SbxCLASS_VARIABLE, SbxVARIANT, ID_GetError ); - MAKE_TT_KEYWORD( "Start", SbxCLASS_METHOD, SbxSTRING, ID_Start ); - MAKE_TT_KEYWORD( "Use", SbxCLASS_METHOD, SbxNULL, ID_Use ); - MAKE_TT_KEYWORD( "StartUse", SbxCLASS_METHOD, SbxNULL, ID_StartUse ); - MAKE_TT_KEYWORD( "FinishUse", SbxCLASS_METHOD, SbxNULL, ID_FinishUse ); - - MAKE_TT_KEYWORD( "CaseLog", SbxCLASS_METHOD, SbxNULL, ID_CaseLog ); - MAKE_TT_KEYWORD( "ExceptLog", SbxCLASS_METHOD, SbxNULL, ID_ExceptLog ); - MAKE_TT_KEYWORD( "PrintLog", SbxCLASS_METHOD, SbxNULL, ID_PrintLog ); - MAKE_TT_KEYWORD( "WarnLog", SbxCLASS_METHOD, SbxNULL, ID_WarnLog ); - MAKE_TT_KEYWORD( "ErrorLog", SbxCLASS_METHOD, SbxNULL, ID_ErrorLog ); - MAKE_TT_KEYWORD( "QAErrorLog", SbxCLASS_METHOD, SbxNULL, ID_QAErrorLog ); - MAKE_TT_KEYWORD( "EnableQaErrors", SbxCLASS_PROPERTY, SbxBOOL, ID_EnableQaErrors ); - MAKE_TT_KEYWORD( "MaybeAddErr", SbxCLASS_METHOD, SbxNULL, ID_MaybeAddErr ); - MAKE_TT_KEYWORD( "ClearError", SbxCLASS_METHOD, SbxNULL, ID_ClearError ); - MAKE_TT_KEYWORD( "SaveIDs", SbxCLASS_METHOD, SbxBOOL, ID_SaveIDs ); - MAKE_TT_KEYWORD( "AutoExecute", SbxCLASS_PROPERTY, SbxBOOL, ID_AutoExecute ); // Achtung! PROPERTY Also eine Variable - MAKE_TT_KEYWORD( "Execute", SbxCLASS_METHOD, SbxNULL, ID_Execute ); - MAKE_TT_KEYWORD( "StopOnSyntaxError", SbxCLASS_PROPERTY, SbxBOOL, ID_StopOnSyntaxError ); - -/* Dialog Handler werden gebraucht, wenn im internen Testtool ein Dialog - hochgerissen wird. Nach versenden der Remote-Kommandos wird IdleHandler aktiviert. - Er testet, ob das Reschedule zum WaitForAnswer zur�ckkehrt. Bleibt das aus, so - wird erst der RemoteHandler zur�ckgesetzt und dann die Handler-Sub im Basic - gerufen.(Entkoppelt �ber PostUserEvent.) - - In returndaten_verarbeiten wird flag f�r ausf�hrung des n�chsten remote-befehls - r�ckgesetzt. Der Handler wird damit auch entwertet. Er gilt also nur f�r den - n�chsten Remotebefehl. -*/ - MAKE_TT_KEYWORD( "DialogHandler", SbxCLASS_METHOD, SbxNULL, ID_DialogHandler ); - - MAKE_TT_KEYWORD( "GetUnoApp", SbxCLASS_METHOD, SbxOBJECT, ID_GetUnoApp ); - MAKE_TT_KEYWORD( "GetIServer", SbxCLASS_METHOD, SbxOBJECT, ID_GetIServer ); - - MAKE_TT_KEYWORD( "RemoteCommandDelay", SbxCLASS_METHOD, SbxNULL, ID_RemoteCommandDelay ); - - MAKE_TT_KEYWORD( "GetApplicationPath", SbxCLASS_METHOD, SbxSTRING, ID_GetApplicationPath ); - MAKE_TT_KEYWORD( "GetCommonApplicationPath", SbxCLASS_METHOD, SbxSTRING, ID_GetCommonApplicationPath ); - MAKE_TT_KEYWORD( "MakeIniFileName", SbxCLASS_METHOD, SbxSTRING, ID_MakeIniFileName ); - -/// active constants returning error and warning count - MAKE_TT_KEYWORD( "GetErrorCount", SbxCLASS_METHOD, SbxULONG, ID_GetErrorCount ); - MAKE_TT_KEYWORD( "GetWarningCount", SbxCLASS_METHOD, SbxULONG, ID_GetWarningCount ); - MAKE_TT_KEYWORD( "GetQAErrorCount", SbxCLASS_METHOD, SbxULONG, ID_GetQAErrorCount ); - MAKE_TT_KEYWORD( "GetUseFileWarningCount", SbxCLASS_METHOD, SbxULONG, ID_GetUseFileWarningCount ); - - MAKE_TT_KEYWORD( "GetErrorList", SbxCLASS_METHOD, SbxOBJECT, ID_GetErrorList ); - MAKE_TT_KEYWORD( "GetWarningList", SbxCLASS_METHOD, SbxOBJECT, ID_GetWarningList ); - MAKE_TT_KEYWORD( "GetQAErrorList", SbxCLASS_METHOD, SbxOBJECT, ID_GetQAErrorList ); - MAKE_TT_KEYWORD( "GetUseFileWarningList", SbxCLASS_METHOD, SbxOBJECT, ID_GetUseFileWarningList ); - - MAKE_TT_KEYWORD( "GetTestCaseName", SbxCLASS_METHOD, SbxSTRING, ID_GetTestCaseName ); - MAKE_TT_KEYWORD( "GetTestCaseFileName", SbxCLASS_METHOD, SbxSTRING, ID_GetTestCaseFileName ); - MAKE_TT_KEYWORD( "GetTestCaseLineNr", SbxCLASS_METHOD, SbxUSHORT, ID_GetTestCaseLineNr ); - - MAKE_TT_KEYWORD( "SetChildEnv", SbxCLASS_METHOD, SbxNULL, ID_SetChildEnv ); - MAKE_TT_KEYWORD( "GetChildEnv", SbxCLASS_METHOD, SbxSTRING, ID_GetChildEnv ); - - MAKE_TT_KEYWORD( "GetLinkDestination", SbxCLASS_METHOD, SbxSTRING, ID_GetLinkDestination ); - MAKE_TT_KEYWORD( "GetRegistryValue", SbxCLASS_METHOD, SbxSTRING, ID_GetRegistryValue ); - - MAKE_TT_KEYWORD( "KillApp", SbxCLASS_METHOD, SbxNULL, ID_KillApp ); - - MAKE_TT_KEYWORD( "HTTPSend", SbxCLASS_METHOD, SbxUSHORT, ID_HTTPSend ); - MAKE_TT_KEYWORD( "HTTPSetProxy", SbxCLASS_METHOD, SbxNULL, ID_HTTPSetProxy ); - - // Load the Remote Commands from list - if ( !pRCommands ) // Ist static, wird also nur einmal geladen - ReadFlatArray( arR_Cmds, pRCommands ); - sal_uInt16 i; - for ( i = 0 ; i < pRCommands->Count() ; i++ ) - { - SbxTransportMethod *pMeth = new SbxTransportMethod( SbxVARIANT ); - pMeth->SetName( pRCommands->GetObject( i )->pData->Kurzname ); - pMeth->SetUserData( ID_RemoteCommand ); - // FIXME: HELPID - #if 0 - pMeth->nValue = pRCommands->GetObject( i )->pData->aUId.GetNum(); - #else - pMeth->nValue = 0; - #endif - Insert( pMeth ); - StartListening( pMeth->GetBroadcaster(), sal_True ); - } - -// Konstanten f�r SetControlType - MAKE_USHORT_CONSTANT("CTBrowseBox",CONST_CTBrowseBox); - MAKE_USHORT_CONSTANT("CTValueSet",CONST_CTValueSet); - -// Konstanten f�r das Alignment des gesuchten Splitters - MAKE_USHORT_CONSTANT("AlignLeft",CONST_ALIGN_LEFT); - MAKE_USHORT_CONSTANT("AlignTop",CONST_ALIGN_TOP); - MAKE_USHORT_CONSTANT("AlignRight",CONST_ALIGN_RIGHT); - MAKE_USHORT_CONSTANT("AlignBottom",CONST_ALIGN_BOTTOM); - -/// What dialog to use in RC_CloseSysDialog or RC_ExistsSysDialog - MAKE_USHORT_CONSTANT("FilePicker",CONST_FilePicker); - MAKE_USHORT_CONSTANT("FolderPicker",CONST_FolderPicker); - -/// NodeTypes of the SAX Parser - MAKE_USHORT_CONSTANT("NodeTypeCharacter",CONST_NodeTypeCharacter); - MAKE_USHORT_CONSTANT("NodeTypeElement",CONST_NodeTypeElement); - MAKE_USHORT_CONSTANT("NodeTypeComment",CONST_NodeTypeComment); - - -/// ItemTypes for TreeListBox and maybe others - MAKE_USHORT_CONSTANT("ItemTypeText",CONST_ItemTypeText); - MAKE_USHORT_CONSTANT("ItemTypeBMP",CONST_ItemTypeBMP); - MAKE_USHORT_CONSTANT("ItemTypeCheckbox",CONST_ItemTypeCheckbox); - MAKE_USHORT_CONSTANT("ItemTypeContextBMP",CONST_ItemTypeContextBMP); - MAKE_USHORT_CONSTANT("ItemTypeUnknown",CONST_ItemTypeUnknown); - - -/// Return values for WaitSlot - MAKE_USHORT_CONSTANT("WSTimeout",CONST_WSTimeout); - MAKE_USHORT_CONSTANT("WSAborted",CONST_WSAborted); - MAKE_USHORT_CONSTANT("WSFinished",CONST_WSFinished); - - - pImpl->pControlsObj = new Controls( CUniString("GetNextCloseWindow") ); - pImpl->pControlsObj->SetType( SbxVARIANT ); - Insert( pImpl->pControlsObj ); - pImpl->pControlsObj->SetUserData( ID_GetNextCloseWindow ); - pImpl->pControlsObj->ChangeListener( this ); - - for ( i=0;ipMyVars[i] = new SbxTransportMethod( SbxVARIANT ); - pImpl->pMyVars[i]->SetName( CUniString("VarDummy").Append(String::CreateFromInt32(i) ) ); - - Insert( pImpl->pMyVars[i] ); - } - - m_pControls = new CNames(); - m_pSIds = new CNames(); - m_pNameKontext = m_pControls; - - nMyVar = 0; - - pImpl->pMyBasic->AddFactory( &aComManFac ); -} - - -TestToolObj::~TestToolObj() -{ - pImpl->pMyBasic->RemoveFactory( &aComManFac ); - EndListening( ((StarBASIC*)GetParent())->GetBroadcaster() ); - pImpl->pNextReturn.Clear(); - - pImpl->pControlsObj.Clear(); - - for ( int i = 0 ; i < VAR_POOL_SIZE ; i++ ) - { - pImpl->pMyVars[i].Clear(); - } - - delete m_pControls; - delete m_pReverseSlots; - delete m_pReverseControls; - delete m_pReverseControlsSon; - delete m_pReverseUIds; - delete m_pSIds; - - if (pFehlerListe) - { - delete pFehlerListe; - pFehlerListe = NULL; // da pFehlerListe static ist!! - } - - if ( pCommunicationManager ) - { - pCommunicationManager->StopCommunication(); - delete pCommunicationManager; - } - - delete In; - delete pImpl->pTTSfxBroadcaster; - delete pImpl->pHttpRequest; - delete pImpl->pChildEnv; - - pImpl->xErrorList.Clear(); - pImpl->xWarningList.Clear(); - pImpl->xQAErrorList.Clear(); - pImpl->xIncludeFileWarningList.Clear(); - - delete pImpl; - - delete pShortNames; -} - -SfxBroadcaster& TestToolObj::GetTTBroadcaster() -{ - if ( !pImpl->pTTSfxBroadcaster ) - pImpl->pTTSfxBroadcaster = new SfxBroadcaster; - return *pImpl->pTTSfxBroadcaster; -} - -void TestToolObj::ReadNames( String Filename, CNames *&pNames, CNames *&pUIds, sal_Bool bIsFlat ) -{ -/******************************************************************************* -** -** Folgende Dateiendungen sind vorhanden -** -** hid.lst Langname UId -** *.sid Slot Ids Kurzname Langname Datei ist flach -** *.win Controlname Langname Datei mit *name und +name Notation -** -** -*******************************************************************************/ - - - SvFileStream Stream; - String aLine,aShortname,aLongname; - rtl::OString aUId; - xub_StrLen nLineNr; - sal_uInt16 nElement; - ControlDef *pNewDef, *pNewDef2; - ControlDef *pFatherDef = NULL; - - nLineNr = 0; // Wir sind ja noch vor der Datei - - if (! pUIds) - { - String aFileName = (pImpl->aHIDDir + DirEntry(CUniString("hid.lst"))).GetFull(); - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_LONGNAMES)), aFileName ); - GetTTBroadcaster().Broadcast( aHint ); - } - ReadFlat( aFileName ,pUIds, sal_True ); - if ( !pUIds ) - return; - pNewDef = new ControlDef("Active",rtl::OString()); - const ControlItem *pItem = pNewDef; - if (! pUIds->Insert(pItem)) - { - ADD_WARNING_LOG2( GEN_RES_STR1c( S_DOUBLE_NAME, "Active" ), Filename, nLineNr ); - delete pNewDef; - } - - } - - ADD_MESSAGE_LOG( Filename ); - - Stream.Open(Filename, STREAM_STD_READ); - if (!Stream.IsOpen()) - { - ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename)); - return; - } - - if ( bIsFlat && !pNames ) - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_SLOT_IDS)), Filename ); - GetTTBroadcaster().Broadcast( aHint ); - } - else - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_CONTROLS)), Filename ); - GetTTBroadcaster().Broadcast( aHint ); - } - - if ( !pNames ) - pNames = new CNames(); - - { - TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - while (!Stream.IsEof()) - { - nLineNr++; - - Stream.ReadByteStringLine(aLine, RTL_TEXTENCODING_IBM_850); - aLine.EraseLeadingChars(); - aLine.EraseTrailingChars(); - while ( aLine.SearchAscii(" ") != STRING_NOTFOUND ) - aLine.SearchAndReplaceAllAscii(" ",UniString(' ')); - if (aLine.Len() == 0) continue; - if (aLine.Copy(0,4).CompareIgnoreCaseToAscii("Rem ") == COMPARE_EQUAL) continue; - if (aLine.Copy(0,1).CompareToAscii("'") == COMPARE_EQUAL) continue; - - if ( (aLine.GetTokenCount(cMyDelim) < 2 || aLine.GetTokenCount(cMyDelim) > 3) && aLine.CompareIgnoreCaseToAscii("*Active") != COMPARE_EQUAL ) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_INVALID_LINE, aLine ), Filename, nLineNr ); - continue; - } - - aShortname = aLine.GetToken(0,cMyDelim); - aLongname = aLine.GetToken(1,cMyDelim); - - String aFirstAllowedExtra, aAllowed; - aFirstAllowedExtra.AssignAscii("+*"); - aAllowed.AssignAscii("_"); - xub_StrLen nIndex = 0; - sal_Bool bOK = sal_True; - - while ( bOK && nIndex < aShortname.Len() ) - { - sal_Unicode aChar = aShortname.GetChar( nIndex ); - sal_Bool bOKThis = sal_False; - bOKThis |= ( aAllowed.Search( aChar ) != STRING_NOTFOUND ); - if ( !nIndex ) - bOKThis |= ( aFirstAllowedExtra.Search( aChar ) != STRING_NOTFOUND ); - bOKThis |= ( aChar >= 'A' && aChar <= 'Z' ); - bOKThis |= ( aChar >= 'a' && aChar <= 'z' ); - bOKThis |= ( aChar >= '0' && aChar <= '9' ); - - bOK &= bOKThis; - nIndex++; - } - if ( !bOK ) - { - ADD_WARNING_LOG2( CUniString("Zeile \"").Append(aLine).AppendAscii("\" enth�lt ung�ltige Zeichen."), Filename, nLineNr ); - continue; - } - - sal_Bool bUnoName = ( aLongname.Copy( 0, 5 ).EqualsIgnoreCaseAscii( ".uno:" ) - || aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "http" ) - || aLongname.Copy( 0, 15 ).EqualsIgnoreCaseAscii( "private:factory" ) - || aLongname.Copy( 0, 8 ).EqualsIgnoreCaseAscii( "service:" ) - || aLongname.Copy( 0, 6 ).EqualsIgnoreCaseAscii( "macro:" ) - || aLongname.Copy( 0, 8 ).EqualsIgnoreCaseAscii( ".HelpId:" ) ); - // generic method to mark longnames as symbolic - if ( aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "sym:" ) ) - { - bUnoName = sal_True; - aLongname.Erase( 0, 4 ); - } - sal_Bool bMozillaName = ( !bIsFlat && aLongname.Copy( 0, 4 ).EqualsIgnoreCaseAscii( ".moz" ) ); - - if ( aShortname.GetChar(0) == '+' ) // Kompletten Eintrag kopieren - { - aShortname.Erase(0,1); - ControlDef WhatName(aLongname,rtl::OString()); - ControlDef *OldTree; - if (pNames->Seek_Entry(&WhatName,&nElement)) - { - OldTree = (ControlDef*)pNames->GetObject(nElement); - pNewDef = new ControlDef(aLongname,aShortname,OldTree,sal_True); - - const ControlItem *pItem = pNewDef; - if (! pNames->Insert(pItem)) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr ); - delete pNewDef; - pFatherDef = NULL; - } - else - { - pFatherDef = pNewDef; - } - } - else - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_SHORTNAME_UNKNOWN, aLine ), Filename, nLineNr ); - continue; - } - - } - else - { - - // FIXME: HELPID - #if 0 - if (aShortname.CompareIgnoreCaseToAscii("*Active") == COMPARE_EQUAL) - aUId = rtl::OString( UID_ACTIVE ); - else - #endif - if ( !bUnoName && !bMozillaName ) - { // Bestimmen der ID aus der Hid.Lst - ControlDef WhatName(aLongname,rtl::OString()); - if (pUIds->Seek_Entry(&WhatName,&nElement)) - aUId = pUIds->GetObject(nElement)->pData->aUId; - else - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_LONGNAME_UNKNOWN, aLine ), Filename, nLineNr ); - continue; - } - } - else - { - // FIXME: HELPID - #if 0 - if ( bUnoName ) - aUId = rtl::OString( aLongname ); - else if ( bMozillaName ) - aUId = rtl::OString( aLongname ); - else - { - OSL_FAIL("Unknown URL schema"); - } - #endif - } - - - - if (aShortname.GetChar(0) == '*' || bIsFlat) // Globaler Kurzname (Dialogname oder SId) - { - if (!bIsFlat) - aShortname.Erase(0,1); - - pNewDef = new ControlDef(aShortname,aUId); - - if (!bIsFlat) - { - pNewDef->Sons( new CNames() ); - - pNewDef2 = new ControlDef(aShortname,aUId); - if (!pNewDef->SonInsert( pNewDef2 )) // Dialog in eigenen Namespace eintragen - { - delete pNewDef2; - OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen in leere Liste!"); - } - } - - const ControlItem *pItem = pNewDef; - if (! pNames->Insert(pItem)) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr ); - delete pNewDef; - pFatherDef = NULL; - } - else - { - pFatherDef = pNewDef; - } - } - else - { - if (!pFatherDef) - { - ADD_WARNING_LOG2( GEN_RES_STR0( S_FIRST_SHORTNAME_REQ_ASTRX ), Filename, nLineNr ); - } - else - { - pNewDef = new ControlDef(aShortname,aUId); - if (! pFatherDef->SonInsert(pNewDef)) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr ); - delete pNewDef; - } - } - } - } - GetpApp()->Reschedule(); - } - { - TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - { - TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION ); - GetTTBroadcaster().Broadcast( aHint ); - } - - Stream.Close(); -} - - -void TestToolObj::AddName(String &aBisher, String &aNeu ) -{ - String aSl( '/' ); - if ( UniString(aSl).Append(aBisher).Append(aSl).ToUpperAscii().Search( UniString(aSl).Append(aNeu).Append(aSl).ToUpperAscii() ) == STRING_NOTFOUND ) - { - aBisher += aSl; - aBisher += aNeu; - } -} - - -void TestToolObj::ReadFlat( String Filename, CNames *&pNames, sal_Bool bSortByName ) -// Wenn bSortByName == sal_False, dann nach UId Sortieren (ControlItemUId statt ControlDef) -{ - SvFileStream Stream; - String aLine,aLongname; - rtl::OString aUId; - xub_StrLen nLineNr; - ControlItem *pNewItem; - sal_uInt16 nDoubleCount = 0; - - Stream.Open(Filename, STREAM_STD_READ); - - if (!Stream.IsOpen()) - { - ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename)); - return; - } - - nLineNr = 0; // Wir sind ja noch vor der Datei - - if ( !pNames ) - pNames = new CNames(); - - { - TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - ADD_MESSAGE_LOG( Filename ); - while (!Stream.IsEof()) - { - nLineNr++; - - Stream.ReadByteStringLine(aLine, RTL_TEXTENCODING_IBM_850); - aLine.EraseLeadingChars(); - aLine.EraseTrailingChars(); - while ( aLine.SearchAscii(" ") != STRING_NOTFOUND ) - aLine.SearchAndReplaceAllAscii(" ",UniString(' ')); - if (aLine.Len() == 0) continue; - - if ( (aLine.GetTokenCount(cMyDelim) < 2 || aLine.GetTokenCount(cMyDelim) > 3) && aLine.CompareIgnoreCaseToAscii("*Active") != COMPARE_EQUAL ) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_INVALID_LINE, aLine ), Filename, nLineNr ); - continue; - } - - aLongname = aLine.GetToken(0,cMyDelim); - // FIXME: HELPID - aUId = rtl::OUStringToOString( aLine.GetToken(1,cMyDelim), RTL_TEXTENCODING_UTF8 ); - - if ( bSortByName ) - pNewItem = new ControlDef( aLongname, aUId ); - else - pNewItem = new ControlItemUId( aLongname, aUId ); - if ( !pNames->C40_PTR_INSERT( ControlItem, pNewItem ) ) - { - if ( bSortByName ) - { - if ( nDoubleCount++ < 10 ) - { - ADD_WARNING_LOG2( GEN_RES_STR1( S_DOUBLE_NAME, aLine ), Filename, nLineNr ); - } - } - else - { - sal_uInt16 nNr; - pNames->Seek_Entry( pNewItem, &nNr ); - AddName( pNames->GetObject(nNr)->pData->Kurzname, pNewItem->pData->Kurzname ); - } - delete pNewItem; - } - GetpApp()->Reschedule(); - } - { - TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - - Stream.Close(); -} - -void ReadFlatArray( const ControlDefLoad arWas [], CNames *&pNames ) -{ - sal_uInt16 nIndex = 0; - - if ( !pNames ) - pNames = new CNames(); - - while ( String::CreateFromAscii(arWas[nIndex].Kurzname).Len() > 0 ) - { - // FIXME: HELPID - rtl::OString aUId;// (arWas[nIndex].nUId); - const ControlItem *pX = new ControlDef( arWas[nIndex].Kurzname, aUId); - pNames->C40_PTR_INSERT(ControlItem, pX); - nIndex++; - } -} - -void TestToolObj::WaitForAnswer () -{ - if ( bUseIPC ) - { - sal_Bool bWasRealWait = !bReturnOK; - BasicRuntime aRun( NULL ); - if ( BasicRuntimeAccess::HasRuntime() ) - aRun = BasicRuntimeAccess::GetRuntime(); - - // this timer to terminate Yield below - Timer aTimer; - aTimer.SetTimeout( pImpl->aServerTimeout.GetMSFromTime() ); - aTimer.Start(); - while ( !bReturnOK && aTimer.IsActive() && pCommunicationManager->IsCommunicationRunning() - && aRun.IsValid() && aRun.IsRun() ) - { - GetpApp()->Yield(); - if ( BasicRuntimeAccess::HasRuntime() ) - aRun = BasicRuntimeAccess::GetRuntime(); - else - aRun = BasicRuntime( NULL ); - } - if ( bWasRealWait && aDialogHandlerName.Len() > 0 ) // Damit das ganze auch im Testtool l�uft - CallDialogHandler(GetpApp()); - } - else - { - Time Ende; - - Ende += pImpl->aServerTimeout; - SvStream *pTemp = NULL; - - while ( !bReturnOK && Ende > Time() ) - { - if ( pTemp ) - { - ReturnResults( pTemp ); - bReturnOK = sal_True; - } - else - { - GetpApp()->Reschedule(); - } - nIdleCount = 0; - } - } - - - if ( !bReturnOK ) - { - ADD_ERROR(ERR_EXEC_TIMEOUT,GEN_RES_STR1(S_TIMOUT_WAITING, String::CreateFromInt64(nSequence))); - bReturnOK = sal_True; - nSequence++; - } -} - - -IMPL_LINK( TestToolObj, IdleHdl, Application*, EMPTYARG ) -{ - if ( !bReturnOK ) - nIdleCount++; - if ( nIdleCount > 10 ) // d.h. Schon 10 mal hier gewesen und noch keinmal im WaitForAnswer - { - GetpApp()->RemoveIdleHdl( LINK( this, TestToolObj, IdleHdl ) ); - GetpApp()->PostUserEvent( LINK( this, TestToolObj, CallDialogHandler ) ); - } - return 0; -} - -IMPL_LINK( TestToolObj, CallDialogHandler, Application*, EMPTYARG ) -{ - nWindowHandlerCallLevel++; - String aHandlerName(aDialogHandlerName); - aDialogHandlerName.Erase(); - - sal_uLong nRememberSequence = nSequence; // Da sich die Sequence im DialogHandler �ndert - ((StarBASIC*)GetParent())->Call( aHandlerName ); - nSequence = nRememberSequence; - // Die Sequenznummern werden dann zwar doppelt vergeben, aber wen k�mmerts. - - nWindowHandlerCallLevel--; - return 0; -} - - -void TestToolObj::BeginBlock() -{ - WaitForAnswer(); - if ( IsError() ) - return; - - DBG_ASSERT(!IsBlock,"BeginBlock innerhalb eines Blockes"); - In->Reset(nSequence); - IsBlock = sal_True; -} - - -void TestToolObj::SendViaSocket() -{ - if ( !pCommunicationManager ) - { - OSL_FAIL("Kein CommunicationManager vorhanden!!"); - return; - } - - if ( !pCommunicationManager->IsCommunicationRunning() ) - { - // first try to run basic sub "startTheOffice" see i86540 - SbxVariable* pMeth = pImpl->pMyBasic->Find( CUniString( "startTheOffice" ), SbxCLASS_DONTCARE); - if( !pImpl->bIsStart && pMeth && pMeth->ISA(SbxMethod) ) - { - pImpl->pMyBasic->Call( CUniString( "startTheOffice" ) ); - } - else - { - pImpl->pMyBasic->ResetError(); // reset error produced by failed Find above - if ( !pCommunicationManager->StartCommunication( ProgPath, pImpl->ProgParam, pImpl->pChildEnv ) ) - { - ADD_ERROR(ERR_RESTART_FAIL,GEN_RES_STR1(S_APPLICATION_START_FAILED, ProgPath)); - } - else - { - if ( !pImpl->bIsStart ) - { - ADD_ERROR(ERR_RESTART,GEN_RES_STR0(S_APPLICATION_RESTARTED)); - } - } - } - } - - bReturnOK = sal_False; - if ( pCommunicationManager->GetLastNewLink() ) - { - if ( !pCommunicationManager->GetLastNewLink()->TransferDataStream( In->GetStream() ) ) - { - ADD_ERROR(ERR_SEND_TIMEOUT,GEN_RES_STR1(S_TIMOUT_SENDING, String::CreateFromInt64(nSequence))); - nSequence++; - bReturnOK = sal_True; // Kein Return zu erwarten - } - } - else - { - ADD_ERROR(ERR_SEND_TIMEOUT,GEN_RES_STR1(S_NO_CONNECTION, String::CreateFromInt64(nSequence))); - nSequence++; - bReturnOK = sal_True; // Kein Return zu erwarten - } - -} - -void TestToolObj::EndBlock() -{ - if (IsBlock) - { - pImpl->LocalStarttime = Time::GetSystemTicks(); // Setzen der Anfangszeit f�r Performancemessung - - In->GenCmdFlow (F_EndCommandBlock); - - if ( pImpl->bDoRemoteCommandDelay ) - { - sal_uLong nTimeWait = pImpl->nMinRemoteCommandDelay; - if ( pImpl->nMaxRemoteCommandDelay != pImpl->nMinRemoteCommandDelay ) - nTimeWait += Time::GetSystemTicks() % ( pImpl->nMaxRemoteCommandDelay - pImpl->nMinRemoteCommandDelay ); - Timer aTimer; - aTimer.SetTimeout( nTimeWait ); - aTimer.Start(); - while ( aTimer.IsActive() && pCommunicationManager->IsCommunicationRunning() ) - { - GetpApp()->Yield(); - } - } - - if ( bUseIPC ) - SendViaSocket(); - else - { - bReturnOK = sal_False; - if ( aDialogHandlerName.Len() > 0 ) - GetpApp()->InsertIdleHdl( LINK( this, TestToolObj, IdleHdl ), 1 ); - } - IsBlock = sal_False; - } - else - { - OSL_FAIL("EndBlock au�erhalb eines Blockes"); - } -} - - -sal_Bool TestToolObj::Load( String aFileName, SbModule *pMod ) -{ - sal_Bool bOk = sal_True; - SvFileStream aStrm( aFileName, STREAM_STD_READ ); - if( aStrm.IsOpen() ) - { - String aText, aLine; - sal_Bool bIsFirstLine = sal_True; - rtl_TextEncoding aFileEncoding = RTL_TEXTENCODING_IBM_850; - while( !aStrm.IsEof() && bOk ) - { - aStrm.ReadByteStringLine( aLine, aFileEncoding ); - if ( bIsFirstLine && IsTTSignatureForUnicodeTextfile( aLine ) ) - aFileEncoding = RTL_TEXTENCODING_UTF8; - else - { - if ( !bIsFirstLine ) - aText += '\n'; - aText += aLine; - bIsFirstLine = sal_False; - } - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - } - aText.ConvertLineEnd(); - pMod->SetName(CUniString("--").Append(aFileName)); - - pMod->SetComment( GetRevision( aText ) ); - - SbModule* pOldModule = MyBasic::GetCompileModule(); - MyBasic::SetCompileModule( pMod ); - - pMod->SetSource( PreCompile( aText ) ); - - MyBasic::SetCompileModule( pOldModule ); - if ( WasPrecompilerError() ) - bOk = sal_False; - - } - else - bOk = sal_False; - return bOk; -} - - -sal_Bool TestToolObj::ReadNamesBin( String Filename, CNames *&pSIds, CNames *&pControls ) -{ - SvFileStream aStream; - String aName,aURL; - rtl::OString aUId; - ControlDef *pNewDef, *pNewDef2; - ControlDef *pFatherDef = NULL; - - - aStream.Open(Filename, STREAM_STD_READ); - if (!aStream.IsOpen()) - { - ADD_ERROR(ERR_NO_FILE,GEN_RES_STR1(S_CANNOT_OPEN_FILE, Filename)); - return sal_False; - } - - if ( !pSIds ) - pSIds = new CNames(); - if ( !pControls ) - pControls = new CNames(); - - { - TTExecutionStatusHint aHint( TT_EXECUTION_ENTERWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - - sal_uInt16 nAnz; - aStream >> nAnz; - CNames *pNames = pSIds; // first read all the slots - sal_Bool bIsFlat = sal_True; // Slots do not have children - - while ( nAnz && !aStream.IsEof() ) - { - - aStream.ReadByteString( aName, RTL_TEXTENCODING_UTF8 ); - - sal_uInt16 nType; - aStream >> nType; - if ( !nType /* HasNumeric() */) - { - String aStrId; - aStream.ReadByteString( aStrId, RTL_TEXTENCODING_UTF8 ); - // FIXME: HELPID - #if 0 - aUId = rtl::OString( aStrId ); - #endif - } - else - { - comm_UINT32 nUId; - aStream >> nUId; - aUId = rtl::OString();// nUId; - } - - if (aName.GetChar(0) == '*' || bIsFlat ) // Globaler Kurzname (Dialogname oder SId) - { - if (!bIsFlat) - aName.Erase(0,1); - pNewDef = new ControlDef(aName,aUId); - - if (!bIsFlat) - { - pNewDef->Sons(new CNames()); - - pNewDef2 = new ControlDef(aName,aUId); // Noch einen machen - if (!pNewDef->SonInsert(pNewDef2)) // Dialog in eigenen Namespace eintragen - { - delete pNewDef2; - OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen in leere Liste!"); - } - } - - const ControlItem *pItem = pNewDef; - if (! pNames->Insert(pItem)) - { - OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen eines namens!"); - delete pNewDef; - pFatherDef = NULL; - } - else - { - pFatherDef = pNewDef; - } - } - else - { - if (!pFatherDef) - { - OSL_FAIL( "Internal Error: Erster Kurzname mu� mit * beginnen. �berspringe." ); - } - else - { - pNewDef = new ControlDef(aName,aUId); - if (! pFatherDef->SonInsert(pNewDef)) - { - delete pNewDef; - OSL_FAIL(" !!!! ACHTUNG !!!! Fehler beim einf�gen eines namens!"); - } - } - } - - - nAnz--; - if ( !nAnz && bIsFlat ) // We have read all slots - { - aStream >> nAnz; - pNames = pControls; // Now read the controls - bIsFlat = sal_False; // Controls *do* have children - } - - - GetpApp()->Reschedule(); - } - { - TTExecutionStatusHint aHint( TT_EXECUTION_LEAVEWAIT ); - GetTTBroadcaster().Broadcast( aHint ); - } - - aStream.Close(); - return sal_True; -} - - -sal_Bool TestToolObj::WriteNamesBin( String Filename, CNames *pSIds, CNames *pControls ) -{ - sal_Bool bOk = sal_True; - SvFileStream aStrm( String(Filename).AppendAscii(".bin"), STREAM_STD_WRITE ); - if( aStrm.IsOpen() ) - { - sal_uInt16 i; - if ( pSIds ) - { - aStrm << pSIds->Count(); - for ( i = 0 ; pSIds->Count() > i && bOk ; i++ ) - { - ((ControlDef*)(*pSIds)[i])->Write(aStrm); - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - } - } - else - aStrm << sal_uInt16( 0 ); - - if ( pControls ) - { - aStrm << pControls->Count(); - for ( i = 0 ; pControls->Count() > i && bOk ; i++ ) - { - ((ControlDef*)(*pControls)[i])->Write(aStrm); - if( aStrm.GetError() != SVSTREAM_OK ) - bOk = sal_False; - } - } - else - aStrm << sal_uInt16( 0 ); - } - else - bOk = sal_False; - return bOk; -} - - -void TestToolObj::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, - const SfxHint& rHint, const TypeId& ) -{ - static CNames *pUIds = NULL; // Halten der hid.lst - - const SbxHint* p = PTR_CAST(SbxHint,&rHint); - if( p ) - { - SbxVariable* pVar = p->GetVar(); - SbxArray* rPar = pVar->GetParameters(); - - sal_uLong nHintId = p->GetId(); - sal_uLong nHintUserData = pVar->GetUserData(); - if( nHintId == SBX_HINT_DATAWANTED ) - { - nMyVar = 0; - switch( nHintUserData ) - { - case ID_Kontext: - if ( !rPar ) - { - m_pNameKontext = m_pControls; - - // So da� nicht immer mal wieder was aus einem alten Kontext dazwischenhaut - for (sal_uInt16 i=0;ipMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) ); - } - } - else if ( rPar && rPar->Count() == 2 ) - { - sal_uInt16 nElement; - SbxVariableRef pArg = rPar->Get( 1 ); - String aKontext = pArg->GetString(); - ControlDef WhatName(aKontext,rtl::OString()); - if (m_pControls && m_pControls->Seek_Entry(&WhatName,&nElement)) - { - m_pNameKontext = ((ControlDef*)m_pControls->GetObject(nElement))->GetSons(); - - // So da� nicht immer mal wieder was aus einem alten Kontext dazwischenhaut - for (sal_uInt16 i=0;ipMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) ); - } - } - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_Start: - if ( rPar && rPar->Count() >= 2 ) - { - SbxVariableRef pArg = rPar->Get( 1 ); - ProgPath = pArg->GetString(); - if ( rPar && rPar->Count() >= 3 ) - { - pArg = rPar->Get( 2 ); - pImpl->ProgParam = pArg->GetString(); - } - else - pImpl->ProgParam.Erase(); - - String aTmpStr(ProgPath); - aTmpStr += ' '; - aTmpStr += pImpl->ProgParam; - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_STARTING_APPLICATION)), aTmpStr ); - GetTTBroadcaster().Broadcast( aHint ); - } - - pImpl->bIsStart = sal_True; - BeginBlock(); - EndBlock(); - pImpl->bIsStart = sal_False; - { - TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION ); - GetTTBroadcaster().Broadcast( aHint ); - } - } - break; - case ID_KillApp: - pCommunicationManager->KillApplication(); - break; - case ID_SaveIDs: - if ( rPar && rPar->Count() >= 2 ) // Genau ein Parameter - { - SbxVariableRef pArg = rPar->Get( 1 ); - #if defined(WNT) - DirEntry FilePath = pImpl->aFileBase + DirEntry(pArg->GetString(),FSYS_STYLE_NTFS); - #else - DirEntry FilePath = pImpl->aFileBase + DirEntry(pArg->GetString(),FSYS_STYLE_UNX); - #endif - WriteNamesBin( FilePath.GetFull(), m_pSIds, m_pControls ); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_AutoExecute: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - pVar->PutBool(SingleCommandBlock); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_Execute: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - EndBlock(); - BeginBlock(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_DialogHandler: - if ( rPar && rPar->Count() >= 2 ) // Genau ein Parameter - { - SbxVariableRef pArg = rPar->Get( 1 ); - aDialogHandlerName = pArg->GetString(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_GetError: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - WaitForAnswer(); - if ( IS_ERROR() ) - { - pVar->PutString( GET_ERROR()->aText ); - POP_ERROR(); - } - else - { - pVar->PutString( String() ); - } - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_StartUse: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - { - BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); - aLogFileName = DirEntry(aRun.GetModuleName(SbxNAME_NONE)).GetBase().AppendAscii(".res"); - } - - ADD_RUN_LOG(); - ADD_CASE_LOG(GEN_RES_STR0(S_READING_FILE)); - - pCommunicationManager->StopCommunication(); - // Wait for asynchronous events to be processed, so communication will be restarted properly - while ( pCommunicationManager->IsCommunicationRunning() ) - Application::Reschedule(); - - SingleCommandBlock = sal_True; - IsBlock = sal_False; - - for (sal_uInt16 i=0;ipMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) ); - } - nMyVar = 0; - - if (m_pControls) - { - delete m_pControls; - m_pControls = NULL; - } - if (m_pReverseSlots) - { - delete m_pReverseSlots; - m_pReverseSlots = NULL; - } - if (m_pReverseControls) - { - delete m_pReverseControls; - m_pReverseControls = NULL; - } - if (m_pReverseControlsSon) - { - delete m_pReverseControlsSon; - m_pReverseControlsSon = NULL; - } - if (m_pSIds) - { - delete m_pSIds; - m_pSIds = NULL; - } - if (pUIds) - { - delete pUIds; - pUIds = NULL; - } - if (m_pReverseUIds) - { - delete m_pReverseUIds; - m_pReverseUIds = NULL; - } - m_pNameKontext = m_pControls; - pImpl->bLnaguageExtensionLoaded = sal_False; - SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED ); - GetTTBroadcaster().Broadcast( aHint ); - - pImpl->nMinRemoteCommandDelay = 0; - pImpl->nMaxRemoteCommandDelay = 0; - pImpl->bDoRemoteCommandDelay = sal_False; - pImpl->aTestCaseName.Erase(); - pImpl->aTestCaseFileName.Erase(); - pImpl->nTestCaseLineNr = 0; - - pImpl->bEnableQaErrors = sal_True; - pImpl->bDebugFindNoErrors = sal_False; - - pImpl->pChildEnv->clear(); - - String aName( CUniString( "StopOnSyntaxError" ) ); - SbxVariableRef xStopOnSyntaxError = SbxObject::Find( aName, SbxCLASS_PROPERTY ); - if ( xStopOnSyntaxError.Is() ) - xStopOnSyntaxError->PutBool( pImpl->bStopOnSyntaxError ); - else - SetError( SbxERR_BAD_ACTION ); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_Use: - if ( rPar && rPar->Count() >= 2 ) - { - SbxVariableRef pArg = rPar->Get( 1 ); - #if defined(WNT) - DirEntry FilePath(pArg->GetString(),FSYS_STYLE_NTFS); - #else - DirEntry FilePath(pArg->GetString(),FSYS_STYLE_UNX); - #endif - if ( !FilePath.IsAbs() ) - FilePath = pImpl->aFileBase + FilePath; - String Ext = FilePath.GetExtension(); - if ( Ext.CompareIgnoreCaseToAscii("Win") == COMPARE_EQUAL ) - { - ReadNames( FilePath.GetFull(),m_pControls,pUIds); - pImpl->bLnaguageExtensionLoaded = sal_True; - SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED ); - GetTTBroadcaster().Broadcast( aHint ); - } - else if ( Ext.CompareIgnoreCaseToAscii("Sid") == COMPARE_EQUAL ) - { - ReadNames( FilePath.GetFull(),m_pSIds,pUIds,FLAT); - pImpl->bLnaguageExtensionLoaded = sal_True; - SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED ); - GetTTBroadcaster().Broadcast( aHint ); - } - else if ( Ext.CompareIgnoreCaseToAscii("Bin") == COMPARE_EQUAL ) - { - ReadNamesBin( FilePath.GetFull(), m_pSIds, m_pControls ); - pImpl->bLnaguageExtensionLoaded = sal_True; - SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED ); - GetTTBroadcaster().Broadcast( aHint ); - } - else if ( Ext.CompareIgnoreCaseToAscii("Inc") == COMPARE_EQUAL ) - { - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_BASIC_MODULE)), FilePath.GetFull() ); - GetTTBroadcaster().Broadcast( aHint ); - } - String aFullPathname = FilePath.GetFull(); - StarBASIC *pBasic = (StarBASIC*)GetParent(); - if ( !aModuleWinExistsHdl.Call( &aFullPathname ) && - !pBasic->FindModule( CUniString( "--" ).Append(aFullPathname) ) ) - { - SbModule *pMod; - pMod = pBasic->MakeModule( CUniString("--"), String() ); - pMod->Clear(); - if ( Load( aFullPathname, pMod ) ) - { - if ( !IS_ERROR() ) - { - pBasic->Compile( pMod ); - pMod->RunInit(); - } - } - else - { - ADD_ERROR( SbxERR_CANNOT_LOAD, FilePath.GetFull() ); - } - } - { - TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION ); - GetTTBroadcaster().Broadcast( aHint ); - } - } - else - { - ADD_ERROR(SbxERR_CANNOT_LOAD,FilePath.GetFull()); - } - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_FinishUse: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - ADD_CASE_LOG( String() ); // Case abschliessen - if (!m_pControls) - m_pControls = new CNames(); - - if (!m_pSIds) - m_pSIds = new CNames(); - - if (pUIds) - { // save some memory - delete pUIds; - pUIds = NULL; - } - - m_pNameKontext = m_pControls; - - if ( pImpl->bLnaguageExtensionLoaded ) - { - SfxSimpleHint aHint( SBX_HINT_LANGUAGE_EXTENSION_LOADED ); - GetTTBroadcaster().Broadcast( aHint ); - } - - pImpl->nIncludeFileWarningCount = pImpl->nWarningCount; - pImpl->nWarningCount = 0; - - *pImpl->xIncludeFileWarningList = *pImpl->xWarningList; - pImpl->xWarningList->SbxArray::Clear(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_CaseLog: - if ( rPar ) // rPar != NULL <=> Es gibt Parameter - { - sal_uInt16 n; - String aX; - for ( n = 1; n < rPar->Count(); n++ ) - { - SbxVariableRef pArg = rPar->Get( n ); - aX += pArg->GetString(); - } - pImpl->aTestCaseName = aX; - if ( pImpl->aTestCaseName.Len() && BasicRuntimeAccess::HasRuntime() ) - { - BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); - pImpl->aTestCaseFileName = aRun.GetModuleName(SbxNAME_SHORT_TYPES); - if ( pImpl->aTestCaseFileName.Copy(0,2).CompareToAscii( "--" ) == COMPARE_EQUAL ) - pImpl->aTestCaseFileName.Erase(0,2); - pImpl->nTestCaseLineNr = aRun.GetLine(); - } - else - { - pImpl->aTestCaseFileName.Erase(); - pImpl->nTestCaseLineNr = 0; - } - ADD_CASE_LOG( aX ); - } - break; - case ID_ExceptLog: - if ( IS_ERROR() ) - { - BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); - sal_Bool bWasNewError = sal_False; - - if ( BasicRuntimeAccess::HasStack() ) - { - for ( sal_uInt16 i = 0 ; i < BasicRuntimeAccess::GetStackEntryCount() -1 ; i++ ) - { - BasicErrorStackEntry aThisEntry = BasicRuntimeAccess::GetStackEntry(i); - if ( !bWasNewError ) - { - bWasNewError = sal_True; - ADD_ERROR_LOG( GET_ERROR()->aText, aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES), - aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2(), aThisEntry.GetSourceRevision() ); - } - ADD_CALL_STACK_LOG( String(aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES)) - .AppendAscii(": ").Append(aThisEntry.GetMethodName(SbxNAME_SHORT_TYPES)), - aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES), - aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2() ); - - } - BasicRuntimeAccess::DeleteStack(); - } - - sal_Bool bIsFirst = sal_True; - while ( aRun.IsValid() ) - { - xub_StrLen nErrLn; - xub_StrLen nCol1; - xub_StrLen nCol2; - if ( bIsFirst ) - { - bIsFirst = sal_False; - nErrLn = GET_ERROR()->nLine; - nCol1 = GET_ERROR()->nCol1; - nCol2 = GET_ERROR()->nCol2; - } - else - { - nErrLn = aRun.GetLine(); - nCol1 = aRun.GetCol1(); - nCol2 = aRun.GetCol2(); - } - - if ( !bWasNewError ) - { - bWasNewError = sal_True; - ADD_ERROR_LOG( GET_ERROR()->aText, aRun.GetModuleName(SbxNAME_SHORT_TYPES), - nErrLn, nCol1, nCol2, aRun.GetSourceRevision() ); - } - ADD_CALL_STACK_LOG( String(aRun.GetModuleName(SbxNAME_SHORT_TYPES)) - .AppendAscii(": ").Append(aRun.GetMethodName(SbxNAME_SHORT_TYPES)), - aRun.GetModuleName(SbxNAME_SHORT_TYPES), - nErrLn, nCol1, nCol2 ); - aRun = aRun.GetNextRuntime(); - } - } - break; - case ID_ErrorLog: - if ( IS_ERROR() ) - { - BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); - if ( BasicRuntimeAccess::HasStack() ) - { - BasicErrorStackEntry aThisEntry = BasicRuntimeAccess::GetStackEntry( 0 ); - ADD_ERROR_LOG( GET_ERROR()->aText, aThisEntry.GetModuleName(SbxNAME_SHORT_TYPES), - aThisEntry.GetLine(), aThisEntry.GetCol1(), aThisEntry.GetCol2(), aThisEntry.GetSourceRevision() ); - BasicRuntimeAccess::DeleteStack(); - } - else - { - ADD_ERROR_LOG( GET_ERROR()->aText, aRun.GetModuleName(SbxNAME_SHORT_TYPES), - StarBASIC::GetErl(), aRun.GetCol1(), aRun.GetCol2(), aRun.GetSourceRevision() ); - } - } - break; - case ID_QAErrorLog: - if ( rPar ) // rPar != NULL <=> Es gibt Parameter - { - sal_uInt16 n; - String aSammel; - for ( n = 1; n < rPar->Count(); n++ ) - { - SbxVariableRef pArg = rPar->Get( n ); - aSammel += pArg->GetString(); - } - ADD_QA_ERROR_LOG( aSammel ); - } - break; - case ID_PrintLog: - if ( rPar ) // rPar != NULL <=> Es gibt Parameter - { - sal_uInt16 n; - String aSammel; - for ( n = 1; n < rPar->Count(); n++ ) - { - SbxVariableRef pArg = rPar->Get( n ); - aSammel += pArg->GetString(); - } - ADD_MESSAGE_LOG( aSammel ); - } - break; - case ID_WarnLog: - if ( rPar ) // rPar != NULL <=> Es gibt Parameter - { - sal_uInt16 n; - String aSammel; - for ( n = 1; n < rPar->Count(); n++ ) - { - SbxVariableRef pArg = rPar->Get( n ); - aSammel += pArg->GetString(); - } - ADD_WARNING_LOG( aSammel ); - - } - break; - case ID_ClearError: - while ( IS_ERROR() ) - { - POP_ERROR(); - } - break; - case ID_MaybeAddErr: - if ( ((StarBASIC*)GetParent())->GetErrBasic() && ( !IS_ERROR() || - pFehlerListe->GetObject(pFehlerListe->Count()-1)->nError != ((StarBASIC*)GetParent())->GetErrBasic() ) ) - { - ((StarBASIC*)GetParent())->MakeErrorText(((StarBASIC*)GetParent())->GetErrBasic(),String()); - ADD_ERROR_QUIET(((StarBASIC*)GetParent())->GetErrBasic() , ((StarBASIC*)GetParent())->GetErrorText()) - } - break; - case ID_GetNextCloseWindow: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - SetError( SbxERR_NOTIMP ); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_RemoteCommand: - { - if ( SingleCommandBlock ) - BeginBlock(); - else - if ( ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - SetError( SbxERR_NOTIMP ); - } - if ( !IsError() ) - In->GenCmdCommand ((sal_uInt16)(((SbxTransportMethod*)pVar)->nValue),rPar); - if ( !IsError() && ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - pImpl->pNextReturn = ((SbxTransportMethod*)pVar); - // FIXME: HELPID - aNextReturnId = rtl::OString();// ((SbxTransportMethod*)pVar)->nValue ); - } - if ( SingleCommandBlock ) - EndBlock(); - if ( !IsError() && (sal_uInt16)((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - WaitForAnswer(); - } - // f�r einige noch etwas Nachbehandlung - switch ( ((SbxTransportMethod*)pVar)->nValue ) - { - case RC_WinTree: - break; - } - - } - break; - case ID_Dispatch: - if ( !rPar || (rPar->Count() % 2) == 1 ) // rPar = NULL <=> Kein Parameter ansonsten Gerade Anzahl(Ungerade, da immer Anzahl+1 - { - if ( SingleCommandBlock ) - BeginBlock(); - if ( !IsError() ) - In->GenCmdSlot ( (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar ); - pVar->PutInteger( (sal_uInt16)((SbxTransportMethod*)pVar)->nValue ); - if ( SingleCommandBlock ) - EndBlock(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_UNODispatch: - if ( !rPar ) // rPar = NULL <=> Kein Parameter ansonsten Gerade Anzahl(Ungerade, da immer Anzahl+1 - { - if ( SingleCommandBlock ) - BeginBlock(); - if ( !IsError() ) - In->GenCmdUNOSlot ( ((SbxTransportMethod*)pVar)->aUnoSlot ); - pVar->PutString( ((SbxTransportMethod*)pVar)->aUnoSlot ); - if ( SingleCommandBlock ) - EndBlock(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_Control: - case ID_StringControl: - // if only the object is given in the script we don't have to do anything (object stands for itself) - if ( !pVar->ISA( SbxObject ) ) - { - if ( SingleCommandBlock ) - BeginBlock(); - else - if ( ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - SetError( SbxERR_NOTIMP ); - } - if ( !IsError() ) - { - SbxVariable *pMember = NULL; - if ( pVar->GetParent() ) - pMember = pVar->GetParent()->Find(CUniString("ID"),SbxCLASS_DONTCARE); - if ( pMember == NULL ) - { - SetError( SbxERR_NAMED_NOT_FOUND ); - } - else - { - if ( nHintUserData == ID_Control ) - { - In->GenCmdControl (pMember->GetULong(), - (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar); - // FIXME: HELPID - aNextReturnId = rtl::OString();// pMember->GetULong() ); - } - else - { - In->GenCmdControl (pMember->GetString(), - (sal_uInt16)((SbxTransportMethod*)pVar)->nValue, rPar); - // FIXME: HELPID - #if 0 - aNextReturnId = rtl::OString( pMember->GetString() ); - #endif - } - } - - if ( !IsError() && ((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - pImpl->pNextReturn = ((SbxTransportMethod*)pVar); - } - else - { - pImpl->pNextReturn = NULL; - aNextReturnId = rtl::OString(); - } - - } - if ( SingleCommandBlock ) - EndBlock(); - if ( !IsError() && (sal_uInt16)((SbxTransportMethod*)pVar)->nValue & M_WITH_RETURN ) - { - WaitForAnswer(); - } - } - - break; - case ID_GetUnoApp: - { - // Hier wird der Remote UNO Kram gestartet - // Eintrag in die Konfiguration unter - // org.openoffice.Office.Common/Start/Connection - // socket,host=0,port=12345;iiop;XBla - // oder - // socket,host=0,port=12345;urp;;XBla - - String aString; - aString.AppendAscii( "socket,host=" ); - aString += GetHostConfig(); - aString.AppendAscii( ",port=" ); - aString += String::CreateFromInt32( GetUnoPortConfig() ); - - Reference< XMultiServiceFactory > smgr_xMultiserviceFactory; - try - { - Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory(); - - OUString aURL( aString ); - Reference< XConnector > xConnector( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector") ) ), UNO_QUERY ); - Reference< XConnection > xConnection( xConnector->connect( aURL ) ); - - Reference< XBridgeFactory > xBridgeFactory( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ) ), UNO_QUERY ); - Reference< XBridge > xBridge( xBridgeFactory->createBridge( - OUString(), OUString( RTL_CONSTASCII_USTRINGPARAM("urp") ), - xConnection, Reference< XInstanceProvider >() ) ); - - Reference< XInterface > xRet( xBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice.ServiceManager")) ) ); - - smgr_xMultiserviceFactory = Reference< XMultiServiceFactory >(xRet, UNO_QUERY); - //MBA fragen!! - } - catch( class Exception & rEx) - { - ADD_ERROR(SbxERR_BAD_ACTION, String( rEx.Message ) ); - } - catch( ... ) - { - ADD_ERROR(SbxERR_BAD_ACTION, CUniString( "Unknown Error" ) ); - } - - if( smgr_xMultiserviceFactory.is() ) - { - Any aAny; - aAny <<= smgr_xMultiserviceFactory; - - SbxObjectRef xMySbxObj = GetSbUnoObject( CUniString("RemoteUnoAppFuerTesttool"), aAny ); - if ( xMySbxObj.Is() ) - pVar->PutObject( xMySbxObj ); - } - } - break; - case ID_GetIServer: - { - // Hier wird der Remote UNO Kram gestartet - - String aString; - - Reference< XMultiServiceFactory > xSMgr; - { - xSMgr = ::cppu::createRegistryServiceFactory(OUString(RTL_CONSTASCII_USTRINGPARAM("g:\\iserverproxy.rdb")), sal_True); - } - - OUString aURL( aString ); - Reference< XConnector > xConnector( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector") ) ), UNO_QUERY ); - Reference< XConnection > xConnection( xConnector->connect( OUString( RTL_CONSTASCII_USTRINGPARAM("socket,host=grande,port=7453")) ) ); - - Reference< XBridgeFactory > xBridgeFactory( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory") ) ), UNO_QUERY ); - Reference< XBridge > xBridge( xBridgeFactory->createBridge( - OUString(), OUString( RTL_CONSTASCII_USTRINGPARAM("urp") ), - xConnection, Reference< XInstanceProvider >() ) ); - - Reference< XInterface > xRet( xBridge->getInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("XIServerProxy")) ) ); - - - if( xRet.is() ) - { - Any aAny; - aAny <<= xRet; - - SbxObjectRef xMySbxObj = GetSbUnoObject( CUniString("IServerProxy"), aAny ); - if ( xMySbxObj.Is() ) - pVar->PutObject( xMySbxObj ); - } - // In Basic: - // msgbox dbg_SupportedInterfaces - // msgbox dbg_Properties - // msgbox dbg_Methods - } - break; - case ID_RemoteCommandDelay: - if ( rPar && rPar->Count() >= 2 && rPar->Count() <=3 ) - { - switch (rPar->Get( 1 )->GetType()) - { - case SbxLONG: // alles immer als Short �bertragen - case SbxULONG: - case SbxSALINT64: - case SbxSALUINT64: - case SbxDOUBLE: - case SbxINTEGER: - case SbxBYTE: - case SbxUSHORT: - case SbxINT: - case SbxUINT: - case SbxSINGLE: - pImpl->nMinRemoteCommandDelay = rPar->Get( 1 )->GetULong(); - if ( rPar->Count() == 3 ) - pImpl->nMaxRemoteCommandDelay = rPar->Get( 2 )->GetULong(); - else - pImpl->nMaxRemoteCommandDelay = pImpl->nMinRemoteCommandDelay; - break; - case SbxBOOL: - pImpl->bDoRemoteCommandDelay = rPar->Get( 1 )->GetBool(); - break; - default: - SbxBase::SetError( SbxERR_WRONG_ARGS ); - break; - } - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_GetApplicationPath: - if ( !rPar ) - { - OUString aUrl = Config::GetDefDirectory(); - OUString aPath; - osl::FileBase::getSystemPathFromFileURL( aUrl, aPath ); - pVar->PutString( String( aPath ) ); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_GetCommonApplicationPath: - if ( !rPar ) - { -#ifdef WNT - //////// adapted this from setup2\win\source\system\winos.cxx - String aSysPath; - aSysPath = _SHGetSpecialFolder_COMMON_APPDATA(); - if ( aSysPath.Len() ) - { - pVar->PutString( aSysPath ); - } - else // default to ID_GetApplicationPath (same as in setup) - { - OUString aUrl = Config::GetDefDirectory(); - OUString aPath; - osl::FileBase::getSystemPathFromFileURL( aUrl, aPath ); - pVar->PutString( String( aPath ) ); - } -#else -#if UNX - pVar->PutString( CUniString( "/etc" ) ); -#else -#error not implemented -#endif -#endif - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_MakeIniFileName: - if ( rPar && rPar->Count() == 2 ) - { - OUString aUrl = Config::GetConfigName( String(), rPar->Get( 1 )->GetString() ); - OUString aPath; - osl::FileBase::getSystemPathFromFileURL( aUrl, aPath ); - pVar->PutString( String( aPath ) ); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_Wait: - { - if( rPar && rPar->Count() == 2 ) - { - long nWait = rPar->Get(1)->GetLong(); - if( nWait >= 0 ) - { -#ifdef DEBUG - Time aStart; -#endif - Timer aTimer; - aTimer.SetTimeout( nWait ); - aTimer.Start(); - while ( aTimer.IsActive() ) - Application::Yield(); -#ifdef DEBUG - Time aEnd; - Time aDiff = aEnd - aStart; - long aMS = long( aDiff.GetMSFromTime() ); - if ( Abs( aMS - nWait ) > 100 ) - { - OSL_TRACE("Wait was off limit by %i", aDiff.GetMSFromTime() - nWait ); - } -#endif - } - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_GetErrorCount: - { - pVar->PutULong( pImpl->nErrorCount ); - } - break; - case ID_GetWarningCount: - { - pVar->PutULong( pImpl->nWarningCount ); - } - break; - case ID_GetQAErrorCount: - { - pVar->PutULong( pImpl->nQAErrorCount ); - } - break; - case ID_GetUseFileWarningCount: - { - pVar->PutULong( pImpl->nIncludeFileWarningCount ); - } - break; - case ID_GetErrorList: - { - if ( ! pImpl->xErrorList->GetDims() ) - pImpl->xErrorList->AddDim( 1, 32000 ); - pVar->PutObject( pImpl->xErrorList ); - } - break; - case ID_GetWarningList: - { - if ( ! pImpl->xWarningList->GetDims() ) - pImpl->xWarningList->AddDim( 1, 32000 ); - pVar->PutObject( pImpl->xWarningList ); - } - break; - case ID_GetQAErrorList: - { - if ( ! pImpl->xQAErrorList->GetDims() ) - pImpl->xQAErrorList->AddDim( 1, 32000 ); - pVar->PutObject( pImpl->xQAErrorList ); - } - break; - case ID_GetUseFileWarningList: - { - if ( ! pImpl->xIncludeFileWarningList->GetDims() ) - pImpl->xIncludeFileWarningList->AddDim( 1, 32000 ); - pVar->PutObject( pImpl->xIncludeFileWarningList ); - } - break; - case ID_GetTestCaseName: - { - pVar->PutString( pImpl->aTestCaseName ); - } - break; - case ID_GetTestCaseFileName: - { - pVar->PutString( pImpl->aTestCaseFileName ); - } - break; - case ID_GetTestCaseLineNr: - { - pVar->PutUShort( pImpl->nTestCaseLineNr ); - } - break; - case ID_SetChildEnv: - { - if( rPar && rPar->Count() == 3 ) - { - pImpl->pChildEnv->erase( rPar->Get(1)->GetString() ); - pImpl->pChildEnv->insert( EnvironmentVariable( rPar->Get(1)->GetString(), rPar->Get(2)->GetString() ) ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_GetChildEnv: - { - if( rPar && rPar->Count() == 2 ) - { - Environment::const_iterator aIter = pImpl->pChildEnv->find( rPar->Get(1)->GetString() ); - if ( aIter != pImpl->pChildEnv->end() ) - pVar->PutString( (*aIter).second ); - else - pVar->PutString( String() ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_GetLinkDestination: - { - if( rPar && rPar->Count() == 2 ) - { - String aSource,aDest; - aSource = rPar->Get(1)->GetString(); -#ifdef UNX - ByteString aByteSource( aSource, osl_getThreadTextEncoding() ); - char cDest[1024]; - int nLen = 0; - if ( ( nLen = readlink( aByteSource.GetBuffer(), cDest, sizeof(cDest) ) ) >= 0 ) - { - aDest = String( cDest, nLen, osl_getThreadTextEncoding() ); - } - else - { - int nErr = errno; - switch ( nErr ) - { - case EINVAL: aDest = aSource; - break; - default: - SetError( SbERR_ACCESS_ERROR ); - } - } -#else - aDest = aSource; -#endif - pVar->PutString( aDest ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_GetRegistryValue: - { - if( rPar && rPar->Count() == 3 ) - { - String aValue; -#ifdef WNT - aValue = ReadRegistry( rPar->Get(1)->GetString(), rPar->Get(2)->GetString() ); -#endif - pVar->PutString( aValue ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_HTTPSend: - { - if( rPar && ( rPar->Count() == 4 || rPar->Count() == 5 ) ) - { - if ( !pImpl->pHttpRequest ) - pImpl->pHttpRequest = new HttpRequest; - pImpl->pHttpRequest->SetRequest( ByteString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), ByteString( rPar->Get(2)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(3)->GetUShort() ); - - if ( pImpl->pHttpRequest->Execute() ) - { - if ( rPar->Count() == 5 ) - { // filename is given - SvFileStream aDestination( rPar->Get(4)->GetString(), STREAM_STD_READWRITE | STREAM_TRUNC ); - (*(pImpl->pHttpRequest->GetBody())) >> aDestination; - if ( aDestination.GetError() != ERRCODE_NONE ) - SetError( SbERR_ACCESS_ERROR ); - aDestination.Close(); - } - pVar->PutUShort( pImpl->pHttpRequest->GetResultId() ); - } - else - SetError( SbERR_ACCESS_ERROR ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - case ID_HTTPSetProxy: - { - if( rPar && rPar->Count() == 3 ) - { - if ( !pImpl->pHttpRequest ) - pImpl->pHttpRequest = new HttpRequest; - pImpl->pHttpRequest->SetProxy( ByteString( rPar->Get(1)->GetString(), RTL_TEXTENCODING_ASCII_US ), rPar->Get(2)->GetUShort() ); - } - else - SetError( SbERR_BAD_NUMBER_OF_ARGS ); - } - break; - } // switch( nHintUserData ) - } // if( nHintId == SBX_HINT_DATAWANTED ) - else if( nHintId == SBX_HINT_DATACHANGED ) - { - switch( nHintUserData ) - { - case ID_AutoExecute: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - { - SingleCommandBlock = pVar->GetBool(); - if ( SingleCommandBlock ) - EndBlock(); - else - BeginBlock(); - } - else - SetError( SbxERR_WRONG_ARGS ); - break; - case ID_EnableQaErrors: - if ( !rPar ) // rPar = NULL <=> Kein Parameter - pImpl->bEnableQaErrors = pVar->GetBool(); - else - SetError( SbxERR_WRONG_ARGS ); - break; - } - } // if( nHintId == SBX_HINT_DATACHANGED ) - else if( nHintId == SBX_HINT_BASICSTART ) - { - pImpl->nErrorCount = 0; - pImpl->nWarningCount = 0; - pImpl->nQAErrorCount = 0; - pImpl->nIncludeFileWarningCount = 0; - - pImpl->xErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xQAErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xIncludeFileWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - - if (pFehlerListe) - delete pFehlerListe; - pFehlerListe = new CErrors; - - for (sal_uInt16 i=0;ipMyVars[i]->SetName( CUniString("VarDummy").Append(UniString::CreateFromInt32(i)) ); - } - nMyVar = 0; - - } // if( nHintId == SBX_HINT_BASICSTART ) - else if( nHintId == SBX_HINT_BASICSTOP ) - { - // Log summary to journal - ADD_CASE_LOG( String() ); // Case abschliessen - ADD_MESSAGE_LOG( CUniString("***************************************************") ); - if ( pImpl->nErrorCount ) - { - ADD_WARNING_LOG( GEN_RES_STR1( S_ERRORS_DETECTED, String::CreateFromInt32( pImpl->nErrorCount ) ) ); - pImpl->nWarningCount--; // Anpassen, da diese Warnung nicht in die Statistik soll - } - else - ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_ERRORS_DETECTED ) ); - - if ( pImpl->nWarningCount ) - ADD_WARNING_LOG( GEN_RES_STR1( S_WARNINGS_DETECTED, String::CreateFromInt32( pImpl->nWarningCount ) ) ) - else - ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_WARNINGS_DETECTED ) ); - - if ( pImpl->nIncludeFileWarningCount ) - ADD_WARNING_LOG( GEN_RES_STR1( S_INCLUDE_FILE_WARNINGS_DETECTED, String::CreateFromInt32( pImpl->nIncludeFileWarningCount ) ) ) - else - ADD_MESSAGE_LOG( GEN_RES_STR0( S_NO_INCLUDE_FILE_WARNINGS_DETECTED ) ); - ADD_MESSAGE_LOG( CUniString("***************************************************") ); - - pImpl->nErrorCount = 0; - pImpl->nWarningCount = 0; - pImpl->nQAErrorCount = 0; - pImpl->nIncludeFileWarningCount = 0; - - pImpl->xErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xQAErrorList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - pImpl->xIncludeFileWarningList->SbxArray::Clear(); // call SbxArray::Clear because SbxVarArray::Clear only clears dimensions but no content - } // if( nHintId == SBX_HINT_BASICSTOP ) - WaitForAnswer(); - if ( IsError() && ( !IS_ERROR() || GET_ERROR()->nError != GetError() ) ) - { - ((StarBASIC*)GetParent())->MakeErrorText(GetError(),String()); - ADD_ERROR_QUIET(GetError(),String(pVar->GetName()).AppendAscii(": "). - Append(((StarBASIC*)GetParent())->GetErrorText())); - } - } -} - -void TestToolObj::DebugFindNoErrors( sal_Bool bDebugFindNoErrors ) -{ - pImpl->bDebugFindNoErrors = bDebugFindNoErrors; -} - -SbxVariable* TestToolObj::Find( const String& aStr, SbxClassType aType) -{ - if ( BasicRuntimeAccess::IsRunInit() - || ( aStr == String( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ) ) ) // wegen Find im "Global" Befehl des Basic - return NULL; - - SbxVariableRef Old = SbxObject::Find(aStr, aType ); - // do not return any objects from pMyVars[] - if (Old && Old->GetUserData() != ID_Dispatch - && Old->GetUserData() != ID_UNODispatch - && Old->GetUserData() != ID_ErrorDummy - && Old->GetUserData() != 0 ) - return Old; - else if ( aStr.SearchAscii(":") != STRING_NOTFOUND ) - { // ignore qualified names e.g. main:FormWizard If this was removed an error would be generated - } - else - { - - sal_uInt16 nElement; - ControlDef *pWhatName = new ControlDef(aStr,rtl::OString()); - - /// nach Controls suchen - if (m_pNameKontext && m_pNameKontext->Seek_Entry(pWhatName,&nElement)) - { - delete pWhatName; - pWhatName = ((ControlDef*)m_pNameKontext->GetObject(nElement)); - -//// new Controls Object every time - pImpl->pControlsObj = new Controls( pWhatName->pData->Kurzname ); - pImpl->pControlsObj->SetType( SbxOBJECT ); - pImpl->pControlsObj->ChangeListener( this ); - - - // Will be set on method-child further down - // FIXME: HELPID - #if 0 - if ( pWhatName->pData->aUId.HasNumeric() ) - pImpl->pControlsObj->SetUserData( ID_Control ); - else - #endif - pImpl->pControlsObj->SetUserData( ID_StringControl ); - - pShortNames->Insert(pWhatName->pData->Kurzname,pWhatName->pData->aUId,nSequence); - - SbxVariable *pMember = pImpl->pControlsObj->Find(CUniString("ID"),SbxCLASS_DONTCARE); - if ( pMember == NULL ) - { - SbxProperty* pID = new SbxProperty(CUniString("ID"),SbxVARIANT); - pImpl->pControlsObj->Insert(pID); - pImpl->pControlsObj->SetDfltProperty(pID); - pMember = pID; - } - // FIXME: HELPID - #if 0 - if ( pWhatName->pData->aUId.HasNumeric() ) - pMember->PutULong(pWhatName->pData->aUId.GetNum()); - else - pMember->PutString(pWhatName->pData->aUId.GetStr()); - #endif - - pMember = pImpl->pControlsObj->Find(CUniString("name"),SbxCLASS_DONTCARE); - if ( pMember != NULL ) - pMember->PutString(pWhatName->pData->Kurzname); - - return pImpl->pControlsObj; - } - - /// Nach slots suchen - if (m_pSIds && m_pSIds->Seek_Entry(pWhatName,&nElement)) - { - SbxTransportMethodRef pMyVar; - pMyVar = pImpl->pMyVars[nMyVar++]; - if ( nMyVar >= VAR_POOL_SIZE ) - nMyVar = 0; - delete pWhatName; - pWhatName = ( (ControlDef*)m_pSIds->GetObject( nElement ) ); - pMyVar->SetName( pWhatName->pData->Kurzname ); - - // FIXME: HELPID - #if 0 - if ( pWhatName->pData->aUId.HasNumeric() ) - { - pMyVar->SetUserData( ID_Dispatch ); - pMyVar->nValue = pWhatName->pData->aUId.GetNum(); - pShortNames->Insert( aStr, pWhatName->pData->aUId, nSequence ); - } - else - { - pMyVar->SetUserData( ID_UNODispatch ); - pMyVar->aUnoSlot = pWhatName->pData->aUId.GetStr(); - } - #endif - return pMyVar; - } - - /// es kann sich noch um eine SlotID handeln, die numerisch abgefragt wird, statt ausgef�hrt zu werden - if ( aStr.Copy( aStr.Len()-3, 3 ).CompareIgnoreCaseToAscii("_ID") == COMPARE_EQUAL && m_pSIds ) - { - delete pWhatName; - pWhatName = new ControlDef( aStr.Copy( 0, aStr.Len()-3 ), rtl::OString() ); - if ( m_pSIds->Seek_Entry( pWhatName, &nElement ) ) - { // Nach slots suchen - SbxVariable *pReturn = new SbxVariable; - delete pWhatName; - pWhatName = ( (ControlDef*)m_pSIds->GetObject( nElement ) ); - pReturn->SetName( pWhatName->pData->Kurzname ); - - // FIXME: HELPID - #if 0 - if ( pWhatName->pData->aUId.HasNumeric() ) - pReturn->PutULong(pWhatName->pData->aUId.GetNum()); - else - pReturn->PutString(pWhatName->pData->aUId.GetStr()); - #endif - return pReturn; - } - } - if ( !pImpl->bDebugFindNoErrors ) - { - ADD_ERROR(SbxERR_PROC_UNDEFINED,GEN_RES_STR1(S_UNKNOWN_SLOT_CONTROL, aStr) ); - } - - delete pWhatName; - } - return NULL; -} - -String TestToolObj::GetRevision( String const &aSourceIn ) -{ - // search $Revision: 1.40 $ - xub_StrLen nPos; - if ( ( nPos = aSourceIn.SearchAscii( "$Revision:" ) ) != STRING_NOTFOUND ) - return aSourceIn.Copy( nPos+ 10, aSourceIn.SearchAscii( "$", nPos+10 ) -nPos-10); - else - return String::CreateFromAscii("No Revision found"); -} - -sal_Bool TestToolObj::CError( sal_uLong code, const String& rMsg, xub_StrLen l, xub_StrLen c1, xub_StrLen c2 ) -{ - bWasPrecompilerError = sal_True; - if ( aCErrorHdl.IsSet() ) - { - ErrorEntry aErrorEntry( code, rMsg, l, c1, c2 ); - return (sal_Bool)aCErrorHdl.Call( &aErrorEntry ); - } - else - { - ADD_ERROR( code, rMsg ) - return sal_True; - } -} - -void TestToolObj::CalcPosition( String const &aSource, xub_StrLen nPos, xub_StrLen &l, xub_StrLen &c ) -{ - l = 1; - xub_StrLen nAkt = 0; - xub_StrLen nNext; - while ( (nNext = aSource.Search( '\n', nAkt )) != STRING_NOTFOUND && nNext < nPos ) - { - l++; - nAkt = nNext+1; - } - c = nPos - nAkt; -} - - -#define CATCH_LABEL CUniString( "ctch" ) -#define CATCHRES_LABEL CUniString( "ctchres" ) -#define ENDCATCH_LABEL CUniString( "endctch" ) - -sal_Bool IsAlphaChar( sal_Unicode cChar ) -{ - return ( cChar >= 'a' && cChar <= 'z' ) || - ( cChar >= 'A' && cChar <= 'Z' ); -} - -sal_Bool IsInsideString( const String& aSource, const xub_StrLen nStart ) -{ - sal_Bool bInside = sal_False; - xub_StrLen nPos = nStart-1; - - while ( nPos && aSource.GetChar(nPos) != _CR && aSource.GetChar(nPos) != _LF ) - { - if ( aSource.GetChar(nPos) == '"' ) - bInside = !bInside; - nPos--; - } - return bInside; -} - -sal_Bool IsValidHit( const String& aSource, const xub_StrLen nStart, const xub_StrLen nEnd ) -{ - return !IsAlphaChar( aSource.GetChar(nStart-1) ) && !IsAlphaChar( aSource.GetChar(nEnd+1)) - && !IsInsideString( aSource, nStart ); -} - - -xub_StrLen TestToolObj::ImplSearch( const String &aSource, const xub_StrLen nStart, const xub_StrLen nEnd, const String &aSearch, const xub_StrLen nSearchStart ) -{ - xub_StrLen nPos = aSource.Search( aSearch, std::max( nSearchStart, nStart ) ); - if ( nPos > nEnd - aSearch.Len() || nPos == STRING_NOTFOUND ) - return STRING_NOTFOUND; - else - { - if ( IsValidHit( aSource, nPos, nPos+aSearch.Len()-1 ) ) - return nPos; - else - return ImplSearch( aSource, nStart, nEnd, aSearch, nPos+aSearch.Len() ); - } -} - -xub_StrLen TestToolObj::PreCompilePart( String &aSource, xub_StrLen nStart, xub_StrLen nEnd, String aFinalErrorLabel, sal_uInt16 &nLabelCount ) -{ - xub_StrLen nTry,nCatch,nEndcatch; - if( (nTry = ImplSearch( aSource, nStart, nEnd, CUniString("try"), nStart )) == STRING_NOTFOUND ) - return nEnd; - if ( (nCatch = ImplSearch( aSource, nStart, nEnd, CUniString("catch"), nTry )) == STRING_NOTFOUND ) - { - xub_StrLen l,c; - CalcPosition( aSource, nTry, l, c ); - CError( SbERR_BAD_BLOCK, CUniString("catch"), l, c, c+2 ); - return nEnd; - } - if ( (nEndcatch = ImplSearch( aSource, nStart, nEnd, CUniString("endcatch"), nCatch )) == STRING_NOTFOUND ) - { - xub_StrLen l,c; - CalcPosition( aSource, nCatch, l, c ); - CError( SbERR_BAD_BLOCK, CUniString("endcatch"), l, c, c+4 ); - return nEnd; - } - - nLabelCount++; - String aStr = String::CreateFromInt32( nLabelCount ); - String aCatchLabel(CATCH_LABEL); - aCatchLabel += aStr; - String aCatchresLabel(CATCHRES_LABEL); - aCatchresLabel += aStr; - String aEndcatchLabel( ENDCATCH_LABEL); - aEndcatchLabel += aStr; - - xub_StrLen nTry2 = 0; - while ( !WasPrecompilerError() && (nTry2 = ImplSearch( aSource, nStart, nEnd, CUniString("try"), nTry+1 )) != STRING_NOTFOUND ) - { // Wir rekursieren erstmal mit dem 2. Try - if ( nTry2 < nCatch ) - nEnd += PreCompilePart( aSource, nTry2, nEndcatch+8, aCatchLabel, nLabelCount ) - nEndcatch-8; - else - nEnd = PreCompilePart( aSource, nTry2, nEnd, aFinalErrorLabel, nLabelCount ); - - if ( (nCatch = ImplSearch( aSource, nStart, nEnd, CUniString("catch"), nTry )) == STRING_NOTFOUND ) - { - xub_StrLen l,c; - CalcPosition( aSource, nTry, l, c ); - CError( SbERR_BAD_BLOCK, CUniString("catch"), l, c, c+2 ); - return nEnd; - } - if ( (nEndcatch = ImplSearch( aSource, nStart, nEnd, CUniString("endcatch"), nCatch )) == STRING_NOTFOUND ) - { - xub_StrLen l,c; - CalcPosition( aSource, nCatch, l, c ); - CError( SbERR_BAD_BLOCK, CUniString("endcatch"), l, c, c+4 ); - return nEnd; - } - } - - String aReplacement; - int nTotalLength = -3 -5 -8; // try, catch und endcatch fallen raus - - aReplacement.AppendAscii( "on error goto " ); - aReplacement += aCatchLabel; - aSource.SearchAndReplaceAscii( "try", aReplacement, nTry ); - nTotalLength += aReplacement.Len(); - - aReplacement.Erase(); - aReplacement.AppendAscii( "on error goto " ); - aReplacement += aFinalErrorLabel; - aReplacement.AppendAscii( " : goto " ); - aReplacement += aEndcatchLabel; - aReplacement.AppendAscii( " : " ); - aReplacement += aCatchLabel; - aReplacement.AppendAscii( ": if err = 35 or err = 18 then : on error goto 0 : resume : endif" ); - aReplacement.AppendAscii( " : MaybeAddErr : on error goto " ); - aReplacement += aFinalErrorLabel; - aReplacement.AppendAscii( " : resume " ); - aReplacement += aCatchresLabel; - aReplacement.AppendAscii( " : " ); - aReplacement += aCatchresLabel; - aReplacement.AppendAscii( ": " ); - aSource.SearchAndReplaceAscii( "catch", aReplacement, nCatch ); - nTotalLength += aReplacement.Len(); - - - aReplacement.Erase(); - aReplacement.AppendAscii("ClearError : "); - aReplacement += aEndcatchLabel; - aReplacement.AppendAscii(": "); - aSource.SearchAndReplaceAscii( "endcatch", aReplacement, nEndcatch ); - nTotalLength += aReplacement.Len(); - - if ( aSource.Len() >= STRING_MAXLEN ) - { - xub_StrLen l,c; - CalcPosition( aSource, nEndcatch, l, c ); - CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 ); - } - - return xub_StrLen( nEnd + nTotalLength ); -} - - -void TestToolObj::PreCompileDispatchParts( String &aSource, String aStart, String aEnd, String aFinalLable ) -{ - sal_uInt16 nLabelCount = 0; - xub_StrLen nPartPos = 0; - - while ( !WasPrecompilerError() && (nPartPos = ImplSearch( aSource, nPartPos, aSource.Len(), aStart )) != STRING_NOTFOUND ) - { - xub_StrLen nEndPart = ImplSearch( aSource, nPartPos, aSource.Len(), aEnd ); - if ( nEndPart == STRING_NOTFOUND ) - return; - nPartPos = PreCompilePart( aSource, nPartPos, nEndPart, aFinalLable, nLabelCount ); - nPartPos = nPartPos + aEnd.Len(); - } -} - - -sal_Bool TestToolObj::WasPrecompilerError() -{ - return bWasPrecompilerError; -} - -String TestToolObj::PreCompile( String const &aSourceIn ) -{ - // Im CTOR zu fr�h, und hier grade nicg rechtzeitig. Start und Stop von Programmausf�hrung - StartListening( ((StarBASIC*)GetParent())->GetBroadcaster(), sal_True ); - - xub_StrLen nTestCase; - xub_StrLen nEndCase; - xub_StrLen nStartPos = 0; - String aSource(aSourceIn); - bWasPrecompilerError = sal_False; - -HACK("Ich gestehe alles: Ich war zu faul das richtig zu machen.") - aSource = String(' ').Append( aSource ); // Da Schl�sselworte an Position 0 sonst nicht gefunden werden - - -// Erstmal alle "'" Kommentare raus - - xub_StrLen nComment; - while ( (nComment = aSource.SearchAscii("'",nStartPos)) != STRING_NOTFOUND ) - { - sal_uInt16 nStringEndCount = 0; - xub_StrLen nIndex = nComment; - while ( nIndex && aSource.GetChar(nIndex) != '\n' ) - { - if ( aSource.GetChar(nIndex) == '"' ) - nStringEndCount++; - nIndex--; - } - if ( (nStringEndCount & 1) == 0 ) // Wir waren also nicht innerhalb eines Strings - { - xub_StrLen nComEnd = aSource.SearchAscii("\n",nComment); - - while ( aSource.GetChar(nComEnd) == _CR || aSource.GetChar(nComEnd) == _LF ) - nComEnd--; - - nComEnd++; - - aSource.Erase(nComment,nComEnd-nComment); - } - else - nComment++; - nStartPos = nComment; - } - - - PreCompileDispatchParts( aSource, CUniString("sub"), CUniString("end sub"), CUniString("0") ); - PreCompileDispatchParts( aSource, CUniString("function"), CUniString("end function"), CUniString("0") ); - PreCompileDispatchParts( aSource, CUniString("testcase"), CUniString("endcase"), CUniString("endcse") ); - - - xub_StrLen nMainPos = ImplSearch( aSource, 0, aSource.Len(), CUniString("sub main") ); - aSource.SearchAndReplaceAscii("sub main",CUniString("Sub Main StartUse : LoadIncludeFiles : FinishUse "), nMainPos ); - if ( aSource.Len() >= STRING_MAXLEN ) - { - xub_StrLen l,c; - CalcPosition( aSource, nMainPos, l, c ); - CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 ); - } - - while ( (nTestCase = ImplSearch( aSource, 0, aSource.Len(), CUniString("testcase") ) ) != STRING_NOTFOUND ) - { - xub_StrLen nTcEnd = aSource.SearchAscii("\n",nTestCase); - - while ( aSource.GetChar(nTcEnd) == _CR || aSource.GetChar(nTcEnd) == _LF ) - nTcEnd--; - - nTcEnd++; - - if ( aSource.SearchAscii(":",nTestCase) < nTcEnd ) - nTcEnd = aSource.SearchAscii(":",nTestCase) -1; - String aSuffix = aSource.Copy(nTestCase+8,nTcEnd-nTestCase-8); - sal_uInt16 nOldLen; - do - { - nOldLen = aSuffix.Len(); - aSuffix.EraseLeadingAndTrailingChars( ' ' ); - aSuffix.EraseLeadingAndTrailingChars( 0x09 ); - } while ( nOldLen != aSuffix.Len() ); - aSource.Erase(nTestCase,nTcEnd-nTestCase); - aSource.Insert(CUniString("Sub ").Append(aSuffix).AppendAscii(" CaseLog \"").Append(aSuffix).AppendAscii("\" : on error goto endcse : TestEnter "),nTestCase); - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////// - // Attention!!! The lable endsub is officially used to exit a sub instead of using 'exit sub' or 'return' - ///////////////////////////////////////////////////////////////////////////////////////////////////////// - while ( (nEndCase = ImplSearch( aSource, 0, aSource.Len(), CUniString("endcase") ) ) != STRING_NOTFOUND ) - aSource.SearchAndReplaceAscii("endcase",CUniString("goto endsub : endcse: if ( err = 35 and StopOnSyntaxError ) or err = 18 then : on error goto 0 : resume : endif : MaybeAddErr : ExceptLog : resume endcse_res : endcse_res: on error goto 0 : endsub: TestExit : ClearError : CaseLog \"\" : end sub "), nEndCase ); - - if ( aSource.Len() >= STRING_MAXLEN ) - { - xub_StrLen l,c; - CalcPosition( aSource, 0, l, c ); - CError( SbERR_PROG_TOO_LARGE, CUniString("endcatch"), l, c, c+2 ); - } - return aSource; -} - -void TestToolObj::AddToListByNr( CNames *&pControls, ControlItemUId *&pNewItem ) -{ - sal_uInt16 nNr; - if ( pControls->Seek_Entry( pNewItem, &nNr ) ) - { - AddName( pControls->GetObject(nNr)->pData->Kurzname, pNewItem->pData->Kurzname ); - delete pNewItem; - pNewItem = (ControlItemUId*)pControls->GetObject(nNr); // f�r einf�gen der S�hne - } - else - { - ControlItem* pNI = pNewItem; - pControls->C40_PTR_INSERT(ControlItem,pNI); - } -} - -IMPL_LINK( TestToolObj, ReturnResultsLink, CommunicationLink*, pCommLink ) -{ - return ReturnResults( pCommLink->GetServiceData() ); -} - -void TestToolObj::ReadHidLstByNumber() -{ - // Die Hid.Lst nach Nummern sortiert einlesen - if ( !m_pReverseUIds ) - { - String aName = (pImpl->aHIDDir + DirEntry(CUniString("hid.lst"))).GetFull(); - - { - TTExecutionStatusHint aHint( TT_EXECUTION_SHOW_ACTION, String(IttResId(S_READING_LONGNAMES)), aName ); - GetTTBroadcaster().Broadcast( aHint ); - } - - ReadFlat( aName, m_pReverseUIds, sal_False ); - - { - TTExecutionStatusHint aHint( TT_EXECUTION_HIDE_ACTION ); - GetTTBroadcaster().Broadcast( aHint ); - } - } -} - -void TestToolObj::SortControlsByNumber( sal_Bool bIncludeActive ) -{ - // Die Controls einmal hirarchisch und einmal alle flach nach nummer sortiert - if ( !m_pReverseControls && !m_pReverseControlsSon && m_pControls ) - { - m_pReverseControls = new CNames; - m_pReverseControlsSon = new CNames; - sal_uInt16 nWin,nCont; - const String aSl('/'); - for ( nWin = 0 ; nWin < m_pControls->Count() ; nWin++ ) - { - String aFatherName( m_pControls->GetObject(nWin)->pData->Kurzname ); - ControlItemUId *pNewFather = new ControlItemUIdSon(aFatherName,m_pControls->GetObject(nWin)->pData->aUId); - AddToListByNr( m_pReverseControlsSon, pNewFather ); - if (! ((ControlItemUIdSon*)pNewFather)->GetSons() ) - ((ControlItemUIdSon*)pNewFather)->Sons( new CNames ); - - // Existieren S�hne, diese in beide Listen eintragen - CNames *pControlList = ((ControlItemSon*)m_pControls->GetObject(nWin))->GetSons(); - if ( pControlList ) - for ( nCont = 0 ; nCont < pControlList->Count() ; nCont++ ) - { - ControlItemUId *pNewItem; - - String aCombinedName( aFatherName ); - aCombinedName.AppendAscii( ":" ); - aCombinedName.Append( pControlList->GetObject(nCont)->pData->Kurzname ); - pNewItem = new ControlItemUId( aCombinedName, pControlList->GetObject(nCont)->pData->aUId ); - AddToListByNr( m_pReverseControls, pNewItem ); - - pNewItem = new ControlItemUId( pControlList->GetObject(nCont)->pData->Kurzname, pControlList->GetObject(nCont)->pData->aUId ); - AddToListByNr( ((ControlItemUIdSon*)pNewFather)->GetSons(), pNewItem ); - } - } - if ( !bIncludeActive ) - { - // FIXME: HELPID - ControlItem *pZeroItem = new ControlItemUId( UniString(), rtl::OString() ); - sal_uInt16 nNr; - if ( m_pReverseControls->Seek_Entry( pZeroItem, &nNr ) ) - { - m_pReverseControls->DeleteAndDestroy( nNr ); -// um VorlagenLaden/UntergeordneteIniDatei/SpeichernDlg/OrdnerDlg/OeffnenDlg/MessageBox/LetzteVersion/GrafikEinfuegenDlg/FarbeDlg/ExportierenDlg/DruckerEinrichten/DruckenDlg/DateiEinfuegenDlg/Active zu verhindern - } - delete pZeroItem; - } - } -} - - -sal_Bool TestToolObj::ReturnResults( SvStream *pIn ) -{ - - sal_uInt16 nId; - sal_uLong nClearSequence = 0; - sal_Bool bSequenceOK = sal_True; - CNames *pReverseControlsKontext = NULL; - - CRetStream *pRetStream = new CRetStream(pIn); - - pRetStream->Read( nId ); - while( !pIn->IsEof() ) - { - switch( nId ) - { - case SIReturn: - { - sal_uInt16 nRet,nParams; - rtl::OString aUId; - pRetStream->Read(nRet); - if ( pRetStream->GetNextType() == BinString ) - { - String aUStrId; // UniqueStringID Used for Mozilla Integration - pRetStream->Read( aUStrId ); - // FIXME: HELPID - #if 0 - aUId = rtl::OString( aUStrId ); - #endif - } - else - { - comm_UINT32 nUId; - pRetStream->Read( nUId ); // bei Sequence einfach die Sequence - // FIXME: HELPID - #if 0 - aUId = rtl::OString( nUId ); - #endif - } - pRetStream->Read(nParams); - - sal_uInt16 nNr1 = 0; - comm_UINT32 nLNr1 = 0; - String aString1; - sal_Bool bBool1 = sal_False; - SbxValueRef xValue1 = new SbxValue; - - if( nParams & PARAM_UINT16_1 ) - pRetStream->Read( nNr1 ); - if( nParams & PARAM_UINT32_1 ) - pRetStream->Read( nLNr1 ); - if( nParams & PARAM_STR_1 ) - { - pRetStream->Read( aString1 ); - ReplaceNumbers ( aString1 ); - } - else - aString1.Erase(); - if( nParams & PARAM_BOOL_1 ) - pRetStream->Read( bBool1 ); - if( nParams & PARAM_SBXVALUE_1 ) - pRetStream->Read( *xValue1 ); - switch (nRet) - { - case RET_Sequence: - { - // FIXME: HELPID - #if 0 - sal_uLong nUId = aUId.GetNum(); - if ( nSequence != nUId ) - { - bSequenceOK = sal_False; - ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR2(S_RETURN_SEQUENCE_MISSMATCH, String::CreateFromInt64(nUId), String::CreateFromInt64(nSequence)) ); - } - else - { - nClearSequence = nUId; - } - #endif - } - break; - case RET_Value: - if ( pImpl->pNextReturn ) - { - if ( aNextReturnId.equals( aUId ) ) - { - if( nParams & PARAM_UINT32_1 ) // FIXME this is to allow negative numbers, hoping that no large numbers are interpreted wrong. should have new PARAM_LONG_1 instead - { - if ( nLNr1 > 0x7fffffff ) - pImpl->pNextReturn->PutLong( long(nLNr1 - 0xffffffff) -1 ); - else - pImpl->pNextReturn->PutULong( nLNr1 ); - } - if( nParams & PARAM_UINT16_1 ) pImpl->pNextReturn->PutUShort( nNr1 ); - if( nParams & PARAM_STR_1 ) pImpl->pNextReturn->PutString( aString1 ); - if( nParams & PARAM_BOOL_1 ) pImpl->pNextReturn->PutBool( bBool1 ); - if( nParams & PARAM_SBXVALUE_1 ) // FIXME: allow generic datatype - { - SbxValues aValues( SbxDATE ); - xValue1->Get( aValues ); - pImpl->pNextReturn->Put( aValues ); - } - } - else - { - ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR0(S_RETURNED_VALUE_ID_MISSMATCH) ) - } - pImpl->pNextReturn = NULL; - } - else - { - ADD_ERROR(SbxERR_BAD_ACTION, GEN_RES_STR0(S_RETURNED_VALUE_NO_RECEIVER) ) - } - break; - case RET_WinInfo: - { - if ( !m_pReverseControls && !m_pReverseControlsSon ) - pReverseControlsKontext = NULL; - - ReadHidLstByNumber(); - SortControlsByNumber(); - - // Alle Slots nach Nummer Sortiert - if ( !m_pReverseSlots && m_pSIds ) - { - m_pReverseSlots = new CNames; - sal_uInt16 nWin; - const String aSl('/'); - for ( nWin = 0 ; nWin < m_pSIds->Count() ; nWin++ ) - { - ControlItemUId *pNewItem = new ControlItemUId(m_pSIds->GetObject(nWin)->pData->Kurzname,m_pSIds->GetObject(nWin)->pData->aUId); - AddToListByNr( m_pReverseSlots, pNewItem ); - } - } - - WinInfoRec *pWinInfo = new WinInfoRec; - // FIXME: HELPID - #if 0 - pWinInfo->aUId = aUId.GetText(); - #endif - pWinInfo->nRType = (sal_uInt16)nLNr1; // just sal_uLong for Transport, data is always USHORT - pWinInfo->aRName = aString1; - pWinInfo->bIsReset = bBool1; - pWinInfo->aKurzname.Erase(); - pWinInfo->aSlotname.Erase(); - - // eventuell den Kontext feststellen. Passiert nur beim ersten Eintrag nach reset - if ( !pReverseControlsKontext && m_pReverseControlsSon ) - { - sal_uInt16 nNr; - ControlItem *pNewItem = new ControlItemUId( String(), aUId ); - if ( m_pReverseControlsSon->Seek_Entry(pNewItem,&nNr) ) - { - pReverseControlsKontext = ((ControlItemUIdSon*)m_pReverseControlsSon->GetObject(nNr))->GetSons(); - pWinInfo->aKurzname = CUniString("*"); - } - else - pReverseControlsKontext = m_pReverseControls; - - delete pNewItem; - } - - // Reset. Mu� nach bestimmen des Kontext stehen, da sonst mit dem reset-record - // der Kontext falsch gesetzt wird. - if ( pWinInfo->bIsReset ) - pReverseControlsKontext = NULL; // Reihenfolge wichtig! - - - // Kurzname feststellen - if ( pReverseControlsKontext ) - { - sal_uInt16 nNr; - ControlItem *pNewItem = new ControlItemUId( String(), aUId ); - if ( pReverseControlsKontext->Seek_Entry(pNewItem,&nNr) ) - { - pWinInfo->aKurzname += pReverseControlsKontext->GetObject(nNr)->pData->Kurzname; - } - delete pNewItem; - } - - // Slotname feststellen - if ( m_pReverseSlots ) - { - sal_uInt16 nNr; - ControlItem *pNewItem = new ControlItemUId( String(), aUId ); - if ( m_pReverseSlots->Seek_Entry(pNewItem,&nNr) ) - pWinInfo->aSlotname = m_pReverseSlots->GetObject(nNr)->pData->Kurzname; - delete pNewItem; - } - - // Langname feststellen - // FIXME: HELPID - #if 0 - if ( aUId.HasString() ) - { // use the String ID since there is no LongName in hid.lst - pWinInfo->aLangname = aUId.GetStr(); - } - else - { - if ( m_pReverseUIds ) - { - sal_uInt16 nNr; - ControlItem *pNewItem = new ControlItemUId( String(), aUId ); - if ( m_pReverseUIds->Seek_Entry(pNewItem,&nNr) ) - pWinInfo->aLangname = m_pReverseUIds->GetObject(nNr)->pData->Kurzname; - delete pNewItem; - } - } - #endif - - aWinInfoHdl.Call( pWinInfo ); - - delete pWinInfo; - } - break; - case RET_ProfileInfo: - { - // FIXME: HELPID - #if 0 - sal_uLong nUId = aUId.GetNum(); - if ( nParams & PARAM_STR_1 ) - { - DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf")); - SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE ); - if( aStrm.IsOpen() ) - { - aString1.ConvertLineEnd(LINEEND_CRLF); - aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << ByteString( aString1, RTL_TEXTENCODING_UTF8 ).GetBuffer(); - aStrm.Close(); - } - } - if ( nParams & PARAM_UINT32_1 ) - { - switch ( nUId ) - { - case S_ProfileReset: // nLNr1 = Anzahl Borders - { - pImpl->nNumBorders = (sal_uInt16)nLNr1; // Borders are 0 to 4 - sal_uInt16 i; - for ( i=0 ; i<4 ; i++ ) - pImpl->naValBorders[i] = 0; - - for ( i=0 ; i<5 ; i++ ) - { - pImpl->naNumEntries[i] = 0; - pImpl->naRemoteTime[i] = 0; - pImpl->naLocalTime[i] = 0; - } - break; - } - case S_ProfileBorder1: // nLNr1 = Border1 in ms - case S_ProfileBorder2: // nLNr1 = Border2 in ms - case S_ProfileBorder3: // nLNr1 = Border3 in ms - case S_ProfileBorder4: // nLNr1 = Border4 in ms - { - pImpl->naValBorders[ nUId - S_ProfileBorder1 ] = nLNr1; - break; - } - case S_ProfileTime: // nLNr1 = remote Zeit des Befehls - { - sal_uInt16 i; - for ( i=0 ; inNumBorders && - pImpl->naValBorders[i] <= nLNr1 ; i++ ) {}; - - pImpl->naNumEntries[ i ]++; - pImpl->naRemoteTime[ i ] += nLNr1; - pImpl->naLocalTime[ i ] += Time::GetSystemTicks() - pImpl->LocalStarttime; - - #if OSL_DEBUG_LEVEL > 1 - if ( nLNr1 > (Time::GetSystemTicks() - pImpl->LocalStarttime) ) - { - String aLine = CUniString("Testtoolzeit(").Append(String::CreateFromInt64(Time::GetSystemTicks() - pImpl->LocalStarttime)).AppendAscii(") kleiner Officezeit(").Append(String::CreateFromInt64(nLNr1)).AppendAscii(")\n"); - DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf")); - SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE ); - if( aStrm.IsOpen() ) - { - aLine.ConvertLineEnd(LINEEND_CRLF); - aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << ByteString( aLine, RTL_TEXTENCODING_UTF8 ).GetBuffer(); - aStrm.Close(); - } - } - #endif - - break; - } - case S_ProfileDump: // Gibt die daten aus. - { - if ( pImpl->nNumBorders == 0 ) // Also keine alte R�ckmeldung vom Office - break; - DirEntry FilePath = pImpl->aLogFileBase + DirEntry(DirEntry(aLogFileName).GetBase().AppendAscii(".prf")); - SvFileStream aStrm( FilePath.GetFull(), STREAM_STD_WRITE ); - if( aStrm.IsOpen() ) - { - String aProfile; - sal_uInt16 i; - - aProfile += String().Expand(15); - for ( i=0 ; inNumBorders ; i++ ) - aProfile += (CUniString("< ").Append(String::CreateFromInt64(pImpl->naValBorders[i]))).Expand(20); - - aProfile += (CUniString(">= ").Append(TTFormat::ms2s(pImpl->naValBorders[pImpl->nNumBorders-1]))); - - aProfile += '\n'; - - aProfile += CUniString("Ereignisse").Expand(15); - for ( i=0 ; i<=pImpl->nNumBorders ; i++ ) - aProfile += TTFormat::ms2s(pImpl->naNumEntries[i]).Expand(20); - - aProfile += '\n'; - - aProfile += CUniString("Server Zeit").Expand(15); - for ( i=0 ; i<=pImpl->nNumBorders ; i++ ) - aProfile += TTFormat::ms2s(pImpl->naRemoteTime[i]).Expand(20); - - aProfile += '\n'; - - aProfile += CUniString("Testtool Zeit").Expand(15); - for ( i=0 ; i<=pImpl->nNumBorders ; i++ ) - aProfile += TTFormat::ms2s(pImpl->naLocalTime[i]).Expand(20); - - aProfile += '\n'; - - aProfile += CUniString("Overhead p.e.").Expand(15); - for ( i=0 ; i<=pImpl->nNumBorders ; i++ ) - { - if ( pImpl->naNumEntries[i] > 0 ) - aProfile += TTFormat::ms2s((pImpl->naLocalTime[i]-pImpl->naRemoteTime[i])/pImpl->naNumEntries[i]).Expand(20); - else - aProfile += CUniString( "??" ).Expand(20); - } - - aProfile += '\n'; - - aProfile.ConvertLineEnd(LINEEND_CRLF); - aStrm.Seek(STREAM_SEEK_TO_END); - aStrm << ByteString( aProfile, RTL_TEXTENCODING_UTF8 ).GetBuffer(); - aStrm.Close(); - } - break; - } - default: - OSL_TRACE("Unbekannter Sub Return Code bei Profile: %hu", nUId ); - break; - } - } - #endif - } - break; - case RET_DirectLoging: - { - // FIXME: HELPID - #if 0 - sal_uLong nUId = aUId.GetNum(); - switch ( nUId ) - { - case S_AssertError: - { - ADD_ASSERTION_LOG( aString1 ); - } - break; - case S_QAError: - { - ADD_QA_ERROR_LOG( aString1 ); - } - break; - default: - ; - } - #endif - } - break; - case RET_MacroRecorder: - { - SortControlsByNumber( sal_True ); - String aCommand,aControls,aControl,aULongNames,aULongName; - sal_Bool bWriteNewKontext = sal_False; - - aControls.Erase(); - // Kurzname feststellen - if ( m_pReverseControls ) - { - sal_uInt16 nNr; - ControlItem *pNewItem = new ControlItemUId( String(), aUId ); - if ( m_pReverseControls->Seek_Entry(pNewItem,&nNr) ) - aControls = m_pReverseControls->GetObject(nNr)->pData->Kurzname; - delete pNewItem; - } - if ( !aControls.Len() ) - { - aControls = String::CreateFromAscii("UnknownControl:UnknownControl"); - Sound::Beep( SOUND_WARNING ); - } - - aULongNames.Erase(); - if( (nParams & PARAM_UINT32_1) && (nNr1 & M_RET_NUM_CONTROL) ) - { - if ( m_pReverseControls ) - { - sal_uInt16 nNr; - // FIXME: HELPID - ControlItem *pNewItem = new ControlItemUId( String(), rtl::OString( /*nLNr1*/ ) ); - if ( m_pReverseControls->Seek_Entry(pNewItem,&nNr) ) - aULongNames = m_pReverseControls->GetObject(nNr)->pData->Kurzname; - delete pNewItem; - } - if ( !aULongNames.Len() ) - { - aULongNames = String::CreateFromAscii("Unknown:Unknown"); - Sound::Beep( SOUND_WARNING ); - } - - // now determin the best common kontext - sal_uInt16 i,j; - sal_Bool bFoundUlongName = sal_False, bFoundControl = sal_False; - // check for current kontext - for ( i = 0 ; !bFoundUlongName && i < aULongNames.GetTokenCount('/') ; i++ ) - bFoundUlongName = aLastRecordedKontext.Equals( aULongNames.GetToken(i,'/').GetToken( 0,':') ); - - for ( j = 0 ; !bFoundControl && j < aControls.GetTokenCount('/') ; j++ ) - bFoundControl = aLastRecordedKontext.Equals( aControls.GetToken(j,'/').GetToken( 0,':') ); - - if ( bFoundUlongName && bFoundControl ) - { - aULongName = aULongNames.GetToken(i-1,'/').GetToken( 1,':'); - aControl = aControls.GetToken(j-1,'/').GetToken( 1,':'); - } - else - { // see if we can find common kontext - sal_Bool bFound = sal_False; - - String aCurrentKontext; - for ( i = 0 ; !bFound && i < aULongNames.GetTokenCount('/') ; i++ ) - { - aCurrentKontext = aULongNames.GetToken(i,'/').GetToken( 0,':'); - - for ( j = 0 ; !bFound && j < aControls.GetTokenCount('/') ; j++ ) - { - if ( aCurrentKontext.Equals( aControls.GetToken(j,'/').GetToken( 0,':') ) ) - { - bFound = sal_True; - aULongName = aULongNames.GetToken(i,'/').GetToken( 1,':'); - aControl = aControls.GetToken(j,'/').GetToken( 1,':'); - aLastRecordedKontext = aCurrentKontext; - bWriteNewKontext = sal_True; - } - } - } - if ( !bFound ) - { - // check if both contain toplevel - bFoundUlongName = sal_False; - bFoundControl = sal_False; - for ( i = 0 ; !bFoundUlongName && i < aULongNames.GetTokenCount('/') ; i++ ) - bFoundUlongName = aULongNames.GetToken(i,'/').GetToken( 0,':').Equals( aULongNames.GetToken(i,'/').GetToken( 1,':') ); - - for ( j = 0 ; !bFoundControl && j < aControls.GetTokenCount('/') ; j++ ) - bFoundControl = aControls.GetToken(j,'/').GetToken( 0,':').Equals( aControls.GetToken(j,'/').GetToken( 1,':') ); - - if ( bFoundUlongName && bFoundControl ) - { - aULongName = aULongNames.GetToken(i-1,'/').GetToken( 1,':'); - aControl = aControls.GetToken(j-1,'/').GetToken( 1,':'); - if ( aLastRecordedKontext.Len() ) - { - aLastRecordedKontext.Erase(); - bWriteNewKontext = sal_True; - } - } - else - { - String aComment; - aComment = CUniString( "'could not Determin common kontext\n" ); - Sound::Beep( SOUND_WARNING ); - aWriteStringHdl.Call( &aComment ); - aULongName = aULongNames.GetToken(i,'/'); - aControl = aControls.GetToken(j,'/'); - } - } - } - - } - else - { // we only have a Control - sal_uInt16 i; - sal_Bool bFoundControl = sal_False; - // check for current kontext - for ( i = 0 ; !bFoundControl && i < aControls.GetTokenCount('/') ; i++ ) - bFoundControl = aLastRecordedKontext.Equals( aControls.GetToken(i,'/').GetToken( 0,':') ); - if ( bFoundControl ) - aControl = aControls.GetToken(i-1,'/').GetToken( 1,':'); - else - { - aLastRecordedKontext = aControls.GetToken(0,'/').GetToken( 0,':'); - bWriteNewKontext = sal_True; - aControl = aControls.GetToken(0,'/').GetToken( 1,':'); - } - - } - - - if ( bWriteNewKontext ) - { - String aKontextCommand = CUniString( "Kontext" ); - if ( aLastRecordedKontext.Len() ) - { - aKontextCommand.AppendAscii ( " \"" ); - aKontextCommand += aLastRecordedKontext; - aKontextCommand.AppendAscii ( "\"" ); - } - aKontextCommand.AppendAscii( "\n" ); - aWriteStringHdl.Call( &aKontextCommand ); - } - - aCommand = aControl; - - // Add Method name - String aMethod = GetMethodName( nNr1 & ~M_RET_NUM_CONTROL ); - aCommand += '.'; - aCommand += aMethod; - - sal_Bool bWasParam = sal_False; - - if( nParams & PARAM_STR_1 ) - { - bWasParam = sal_True; - aCommand.AppendAscii( " \"" ); - if ( nNr1 & M_KEY_STRING ) - { - sal_uInt16 nModify = 0; - sal_Bool bIsProsa = sal_False; - xub_StrLen i; - for ( i = 0; i < aString1.Len(); i++ ) - { - if ( ((sal_uInt16)aString1.GetChar(i)) == 1 ) // we have a spechial char - { - i++; - if ( !bIsProsa ) - { - aCommand.AppendAscii( "<" ); - bIsProsa = sal_True; - } - else - aCommand.AppendAscii( " " ); - - sal_uInt16 nKeyCode = (sal_uInt16)aString1.GetChar(i) & KEY_CODE; - sal_uInt16 nNewModify = (sal_uInt16)aString1.GetChar(i) & KEY_MODTYPE; - if ( nNewModify != nModify ) - { // generate modifiers - sal_uInt16 nChanged = ( nNewModify ^ nModify ); - if ( nChanged & KEY_SHIFT ) - { - aCommand += GetKeyName( KEY_SHIFT ); - aCommand.AppendAscii( " " ); - } - if ( nChanged & KEY_MOD1 ) - { - aCommand += GetKeyName( KEY_MOD1 ); - aCommand.AppendAscii( " " ); - } - if ( nChanged & KEY_MOD2 ) - { - aCommand += GetKeyName( KEY_MOD2 ); - aCommand.AppendAscii( " " ); - } - } - aCommand += GetKeyName( nKeyCode ); - nModify = nNewModify; - } - else - { - if ( bIsProsa ) - { - aCommand.AppendAscii( ">" ); - bIsProsa = sal_False; - } - aCommand += aString1.GetChar(i); - nModify = 0; - } - } - if ( bIsProsa ) - { - aCommand.AppendAscii( ">" ); - bIsProsa = sal_False; - } - } - else - { - aCommand += aString1; - } - aCommand.AppendAscii( "\"" ); - } - if( nParams & PARAM_UINT32_1 ) - { - if ( bWasParam ) - aCommand.AppendAscii( ", " ); - else - aCommand.AppendAscii( " " ); - bWasParam = sal_True; - if ( nNr1 & M_RET_NUM_CONTROL ) - { - aCommand.Append( aULongName ); - } - else - { - aCommand.Append( String::CreateFromInt64( nLNr1 ) ); - } - } - if( nParams & PARAM_BOOL_1 ) - { - if ( bWasParam ) - aCommand.AppendAscii( ", " ); - else - aCommand.AppendAscii( " " ); - bWasParam = sal_True; - if ( bBool1 ) - aCommand.AppendAscii( "true" ); - else - aCommand.AppendAscii( "false" ); - } - - aCommand.AppendAscii( "\n" ); - - aWriteStringHdl.Call( &aCommand ); - } - break; - default: - OSL_TRACE( "Unbekannter Return Code: %iu", nRet ); - break; - } - - break; - } - case SIReturnError: - { - String aString; - rtl::OString aUId; - if ( pRetStream->GetNextType() == BinString ) - { - String aUStrId; // UniqueStringID Used for Mozilla Integration - pRetStream->Read( aUStrId ); - // FIXME: HELPID - #if 0 - aUId = rtl::OString( aUStrId ); - #endif - } - else - { - comm_UINT32 nUId; - pRetStream->Read( nUId ); // bei Sequence einfach die Sequence - // FIXME: HELPID - #if 0 - aUId = rtl::OString( nUId ); - #endif - } - pRetStream->Read( aString ); - ReplaceNumbers (aString); - - String aShortName; - aShortName = pShortNames->GetName(aUId); - aShortName.AppendAscii( " : " ); - - String aTmpStr(aShortName); - aTmpStr += aString; - ADD_ERROR(SbxERR_BAD_ACTION, aTmpStr/*, nNr*/); - break; - } - default: - OSL_TRACE( "Unbekannter Request im Return Stream Nr: %iu", nId ); - break; - } - if( !pIn->IsEof() ) - pRetStream->Read( nId ); - else - { - OSL_FAIL( "truncated input stream" ); - } - - } - - delete pRetStream; - if ( bSequenceOK ) - { - nSequence++; - pShortNames->Invalidate( nClearSequence - KEEP_SEQUENCES ); - } - - bReturnOK = sal_True; - - return sal_True; -} // RetService::Request() - -String TestToolObj::GetMethodName( sal_uLong nMethodId ) -{ - sal_uInt16 nElement; - if ( !Controls::pClasses ) // Ist static, wird also nur einmal geladen - ReadFlatArray( Controls::arClasses, Controls::pClasses ); - if ( Controls::pClasses ) - { - // FIXME: HELPID - #if 0 - for ( nElement = 0 ; nElement < Controls::pClasses->Count() ; nElement++ ) - if ( Controls::pClasses->GetObject(nElement)->pData->aUId.Matches( nMethodId ) ) - return Controls::pClasses->GetObject(nElement)->pData->Kurzname; - #else - (void)nElement; - (void)nMethodId; - #endif - } - return String(); -} - -String TestToolObj::GetKeyName( sal_uInt16 nKeyCode ) -{ - sal_uInt16 nElement; - if ( !CmdStream::pKeyCodes ) // Ist static, wird also nur einmal geladen - ReadFlatArray( CmdStream::arKeyCodes, CmdStream::pKeyCodes ); - if ( CmdStream::pKeyCodes ) - { - // FIXME: HELPID - #if 0 - for ( nElement = 0 ; nElement < CmdStream::pKeyCodes->Count() ; nElement++ ) - if ( CmdStream::pKeyCodes->GetObject(nElement)->pData->aUId.Matches( nKeyCode ) ) - return CmdStream::pKeyCodes->GetObject(nElement)->pData->Kurzname; - #else - (void)nElement; - (void)nKeyCode; - #endif - } - return CUniString( "UnknownKeyCode" ); -} - -void TestToolObj::ReplaceNumbers(String &aText) -{ -static ControlDefLoad const arRes_Type [] = -#include "res_type.hxx" - - static CNames *pRTypes = NULL; - xub_StrLen nStart = STRING_NOTFOUND; - xub_StrLen nGleich = STRING_NOTFOUND; - xub_StrLen nEnd = STRING_NOTFOUND; - xub_StrLen nStartPos = 0; - sal_uLong nNumber; - String aType; - String aResult; - sal_Bool bFound; - - while ( (nStart = aText.Search(StartKenn,nStartPos)) != STRING_NOTFOUND && - (nGleich = aText.SearchAscii("=",nStart+StartKenn.Len())) != STRING_NOTFOUND && - (nEnd = aText.Search(EndKenn,nGleich+1)) != STRING_NOTFOUND) - { - aType = aText.Copy(nStart,nGleich-nStart); - nNumber = (sal_uLong)aText.Copy(nGleich+1,nEnd-nGleich-1).ToInt64(); - bFound = sal_False; - if ( aType.CompareTo(UIdKenn) == COMPARE_EQUAL ) - { - // FIXME: HELPID - aResult = pShortNames->GetName(rtl::OString(/*nNumber*/)); - bFound = sal_True; - } - if ( aType.CompareTo(MethodKenn ) == COMPARE_EQUAL ) - { - bFound = sal_True; - aResult = GetMethodName( nNumber ); - } - if ( aType.CompareTo(RcKenn ) == COMPARE_EQUAL ) - { - bFound = sal_True; - if ( !pRCommands ) // Ist static, wird also nur einmal geladen - ReadFlatArray( arR_Cmds, pRCommands ); - - sal_uInt16 nElement; - if ( pRCommands ) - { - // FIXME: HELPID - #if 0 - for ( nElement = 0 ; nElement < pRCommands->Count() ; nElement++ ) - if ( pRCommands->GetObject(nElement)->pData->aUId.Matches( nNumber ) ) - { - aResult = pRCommands->GetObject(nElement)->pData->Kurzname; - nElement = pRCommands->Count(); - } - #else - (void)nElement; - #endif - } - } - if ( aType.CompareTo(TypeKenn ) == COMPARE_EQUAL ) - { - bFound = sal_True; - if ( !pRTypes ) // Ist static, wird also nur einmal geladen - ReadFlatArray( arRes_Type, pRTypes ); - - sal_uInt16 nElement; - if ( pRTypes ) - { - // FIXME: HELPID - #if 0 - for ( nElement = 0 ; nElement < pRTypes->Count() ; nElement++ ) - if ( pRTypes->GetObject(nElement)->pData->aUId.Matches( nNumber ) ) - { - aResult = pRTypes->GetObject(nElement)->pData->Kurzname; - nElement = pRTypes->Count(); - } - #else - (void)nElement; - #endif - } - } - if ( aType.CompareTo(SlotKenn ) == COMPARE_EQUAL ) - { - // FIXME: HELPID - aResult = pShortNames->GetName(rtl::OString(/*nNumber*/)); - bFound = sal_True; - } - if ( aType.CompareTo(TabKenn ) == COMPARE_EQUAL ) - { - if ( nNumber > nStart ) - aResult.Fill( (sal_uInt16)nNumber - nStart +1 ); - else - aResult = CUniString(" "); - bFound = sal_True; - } - - nStartPos = nStart; - if ( bFound ) - { - aText.Erase(nStart,nEnd+EndKenn.Len()-nStart); - aText.Insert(aResult,nStart); - nStartPos = nStartPos + aResult.Len(); - } - else - nStartPos = nStartPos + StartKenn.Len(); - } -} - - -SbTextType TestToolObj::GetSymbolType( const String &rSymbol, sal_Bool bWasControl ) -{ - if ( rSymbol.CompareToAscii( "try" ) == COMPARE_EQUAL - || rSymbol.CompareToAscii( "catch" ) == COMPARE_EQUAL - || rSymbol.CompareToAscii( "endcatch" ) == COMPARE_EQUAL - || rSymbol.CompareToAscii( "testcase" ) == COMPARE_EQUAL - || rSymbol.CompareToAscii( "endcase" ) == COMPARE_EQUAL ) - { - return TT_KEYWORD; - } - - - ControlDef WhatName( rSymbol, rtl::OString() ); - - if ( bWasControl ) - { - if ( !Controls::pClasses ) // Ist static, wird also nur einmal geladen - ReadFlatArray( Controls::arClasses, Controls::pClasses ); - - if ( (Controls::pClasses && Controls::pClasses->Seek_Entry( &WhatName )) - || rSymbol.EqualsIgnoreCaseAscii( "ID" ) - || rSymbol.EqualsIgnoreCaseAscii( "Name" ) ) - return TT_METHOD; - else - return TT_NOMETHOD; - } - - // Die Controls durchsuchen - if ( m_pControls ) - { - sal_uInt16 nWin; - - for ( nWin = 0 ; nWin < m_pControls->Count() ; nWin++ ) - { - if ( ((ControlDef*)m_pControls->GetObject( nWin ))->SonSeek_Entry( &WhatName ) ) - return TT_CONTROL; - } - } - - // Die Slots durchsuchen - if ( m_pSIds && m_pSIds->Seek_Entry( &WhatName ) ) - return TT_SLOT; - - // Ist es ein RemoteCommand - if ( !pRCommands ) // Ist static, wird also nur einmal geladen - ReadFlatArray( arR_Cmds, pRCommands ); - if ( pRCommands && pRCommands->Seek_Entry( &WhatName ) ) - return TT_REMOTECMD; - - // Wenns sonst nix war, dann vielleicht ein Lokales Kommando - SbxVariable *pVar = SbxObject::Find( rSymbol, SbxCLASS_DONTCARE ); - if ( pVar && ( pVar->ISA(SbxMethod) || pVar->ISA(SbxProperty) ) ) - { - return TT_LOCALCMD; - } - - return SB_SYMBOL; // Alles was hier landet ist vom Typ SB_SYMBOL und bleibt es auch -} - - -#undef P_FEHLERLISTE -#define P_FEHLERLISTE TestToolObj::pFehlerListe - -Controls::Controls( String aCName ) -: SbxObject( aCName) -{ - pMethodVar = new SbxTransportMethod( SbxVARIANT ); - pMethodVar->SetName( CUniString("Dummy") ); - Insert( pMethodVar ); -} - - -Controls::~Controls() -{} - - -void Controls::ChangeListener( SbxObject* parent ) -{ - EndListening( pMethodVar->GetBroadcaster(), sal_True ); - parent->StartListening( pMethodVar->GetBroadcaster(), sal_True ); -} - -void Controls::SFX_NOTIFY( SfxBroadcaster&, const TypeId&, - const SfxHint&, const TypeId& ) -{} - - - -SbxVariable* Controls::Find( const String& aStr, SbxClassType aType) -{ - if ( !pClasses ) // Ist static, wird also nur einmal geladen - ReadFlatArray( arClasses, pClasses ); - - if ( GetUserData() == ID_ErrorDummy ) - { - pMethodVar->SetName(UniString(GetName()).AppendAscii(".").Append(aStr)); - pMethodVar->SetUserData( ID_ErrorDummy ); - return pMethodVar; - } - - - sal_uInt16 nElement; - ControlDef WhatName(aStr,rtl::OString()); - if (pClasses && pClasses->Seek_Entry(&WhatName,&nElement)) - { - pMethodVar->SetName(aStr); - // FIXME: HELPID - sal_uLong nUId = 0;//pClasses->GetObject(nElement)->pData->aUId.GetNum(); - pMethodVar->nValue = nUId; - - pMethodVar->SetUserData( GetUserData() ); - return pMethodVar; - } - else - { // mainly for ID and name - SbxVariableRef Old = SbxObject::Find(aStr, aType ); - if (Old) - return Old; - else if ( aStr.EqualsIgnoreCaseAscii("ID") ) - return NULL; // suppress generation of error in this case - } - ADD_ERROR(SbxERR_BAD_METHOD,GEN_RES_STR2(S_UNKNOWN_METHOD, GetName(), aStr)); - return NULL; -} - - -String TTFormat::ms2s( sal_uLong nMilliSeconds ) -{ - if ( nMilliSeconds < 100000 ) // 100 Sekunden - return String::CreateFromInt64( nMilliSeconds ); - if ( nMilliSeconds < 100000*60 ) // 100 Minuten - return String::CreateFromInt32( nMilliSeconds / 1000 ).AppendAscii("Sec"); - return String::CreateFromInt32( nMilliSeconds / 1000 / 60 ).AppendAscii("Min"); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/objtest.hxx b/automation/source/testtool/objtest.hxx deleted file mode 100644 index 53a933cfb..000000000 --- a/automation/source/testtool/objtest.hxx +++ /dev/null @@ -1,392 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OBJTEST_HXX -#define _OBJTEST_HXX - -#include - - -#include -#include -#include "cmdstrm.hxx" -#include -#include "httprequest.hxx" - -#include - -// #define ID_BeginBlock 1 -// #define ID_EndBlock 2 -#define ID_Kontext 3 -#define ID_GetError 4 -#define ID_ErrorDummy 5 // Intern zum Behandlen von Fehlenden Controls und Methoden -#define ID_RecordError 6 -#define ID_Start 7 -//#define ID_Kill 8 -//#define ID_Reset 9 -// #define ID_AppAbort 10 -#define ID_Dispatch 11 -#define ID_UNODispatch 12 -#define ID_Control 13 -#define ID_StartUse 14 -#define ID_Use 15 -#define ID_FinishUse 16 -#define ID_CaseLog 17 -#define ID_ExceptLog 18 -#define ID_PrintLog 19 -#define ID_WarnLog 20 -#define ID_ErrorLog 21 -#define ID_EnableQaErrors 22 -#define ID_QAErrorLog 23 -#define ID_MaybeAddErr 24 -#define ID_ClearError 25 -#define ID_GetNextCloseWindow 26 -#define ID_RemoteCommand 27 -#define ID_SaveIDs 28 -#define ID_AutoExecute 29 -#define ID_Execute 30 -#define ID_DialogHandler 31 -#define ID_GetUnoApp 32 -#define ID_GetIServer 33 -#define ID_RemoteCommandDelay 34 -#define ID_GetApplicationPath 35 -#define ID_GetCommonApplicationPath 36 -#define ID_MakeIniFileName 37 -#define ID_StringControl 38 -#define ID_Wait 39 -#define ID_GetErrorCount 40 -#define ID_GetWarningCount 41 -#define ID_GetQAErrorCount 42 -#define ID_GetUseFileWarningCount 43 -#define ID_GetErrorList 44 -#define ID_GetWarningList 45 -#define ID_GetQAErrorList 46 -#define ID_GetUseFileWarningList 47 -#define ID_GetTestCaseName 48 -#define ID_GetTestCaseFileName 49 -#define ID_GetTestCaseLineNr 50 -#define ID_StopOnSyntaxError 51 -#define ID_SetChildEnv 52 -#define ID_GetChildEnv 53 -#define ID_GetLinkDestination 54 -#define ID_GetRegistryValue 55 -#define ID_KillApp 56 -#define ID_HTTPSend 57 -#define ID_HTTPSetProxy 58 -#define ID_DoNothing 99 - -void ReadFlatArray( const ControlDefLoad arWas [], CNames *&pNames ); - -class ControlData -{ -public: - String Kurzname; - rtl::OString aUId; -}; - -DBG_NAMEEX( ControlItem ) -DBG_NAMEEX( ControlDef ) -class ControlItem -{ -private: - void InitData() { pData = new ControlData; } -public: - ControlData *pData; - - ControlItem( const char *Name, rtl::OString aUIdP ); - ControlItem( const String &Name, rtl::OString aUIdP ); - ControlItem( ControlData *pDataP ); - virtual ~ControlItem() { -DBG_DTOR(ControlItem,0); - delete pData; - } - virtual sal_Bool operator < (const ControlItem &rPar)=0; - virtual sal_Bool operator == (const ControlItem &rPar)=0; -}; - -SV_DECL_PTRARR_SORT_DEL(CNames, ControlItem*, 50, 10) - -#define MK_SON_ACCESS( ClassName )\ - sal_Bool SonInsert( const ClassName *pNewEntry ) { const ControlItem *pItem = pNewEntry; return pSons->Insert( pItem ); }\ - sal_Bool SonSeek_Entry( const ClassName *pSearchEntry, sal_uInt16 *nRes = NULL) { return pSons->Seek_Entry( pSearchEntry, nRes ); }\ - ClassName* SonGetObject( sal_uInt16 nNr ) { return (ClassName*)pSons->GetObject( nNr ); } - -class ControlSon -{ -protected: - CNames *pSons; // um sicherzustelle, da� nur S�hne des richtien Type reinkommen - -public: - ControlSon() : pSons( NULL ) {}; - ~ControlSon(); - - sal_uInt16 Son_Count() { return pSons->Count(); } - void Sons( CNames *pNewSons ) { pSons = pNewSons; } - CNames*& GetSons() { return pSons; } -}; - -class ControlItemSon : public ControlItem, public ControlSon -{ -public: - ControlItemSon(const char *Name, rtl::OString aUIdP ) - : ControlItem( Name, aUIdP ) {} - ControlItemSon(const String &Name, rtl::OString aUIdP ); -}; - -class ControlDef : public ControlItemSon -{ -public: - ControlDef(const char *Name, rtl::OString aUIdP ) - : ControlItemSon( Name, aUIdP ) {DBG_CTOR(ControlDef,0);} - ControlDef(const String &Name, rtl::OString aUIdP ); - ControlDef(const String &aOldName, const String &aNewName, ControlDef *pOriginal, sal_Bool bWithSons = sal_False ); - ~ControlDef() {DBG_DTOR(ControlDef,0);} - virtual sal_Bool operator < (const ControlItem &rPar); - virtual sal_Bool operator == (const ControlItem &rPar); - void Write( SvStream &aStream ); - MK_SON_ACCESS( ControlDef ) -}; - -class ControlItemUId : public ControlItem -{ -public: - ControlItemUId(String Name, rtl::OString aUIdP) - : ControlItem( Name, aUIdP){} - virtual sal_Bool operator < (const ControlItem &rPar); - virtual sal_Bool operator == (const ControlItem &rPar); -}; - -class ControlItemUIdSon : public ControlItemUId, public ControlSon -{ -public: - ControlItemUIdSon(String Name, rtl::OString aUIdP) : ControlItemUId( Name, aUIdP) {} - MK_SON_ACCESS( ControlItemUId ) -}; - -class ReverseName : public ControlItemUId -{ -public: - sal_uLong LastSequence; - - ReverseName(String Name, rtl::OString aUIdP, sal_uLong nSeq) : ControlItemUId( Name, aUIdP), LastSequence(nSeq) {} -}; - -class CRevNames: public CNames -{ -public: - void Insert( String aName, rtl::OString aUId, sal_uLong nSeq ); - String GetName( rtl::OString aUId ); - void Invalidate ( sal_uLong nSeq ); -}; - - -class SbxTransportMethod: public SbxMethod -{ -public: - SbxTransportMethod( SbxDataType ); - sal_uLong nValue; - String aUnoSlot; -}; -SV_DECL_IMPL_REF(SbxTransportMethod); - -class Controls: public SbxObject -{ -public: - Controls( String aCName ); - ~Controls(); - void ChangeListener( SbxObject* pParent ); - - void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& ); - virtual SbxVariable* Find( const String&, SbxClassType ); - SbxTransportMethodRef pMethodVar; // zum Transport von Find nach Notify - static CNames *pClasses; - static ControlDefLoad const arClasses []; -}; -SV_DECL_IMPL_REF(Controls); - -typedef std::map< String, String > Environment; - -class ImplTestToolObj -{ -public: - String ProgParam; // Parameter der zu Testenden APP; Gesetzt �ber Start - - DirEntry aFileBase; // Grundpfad f�r die *.sid und *.win Dateien (Aus Configdatei) - DirEntry aLogFileBase; // Grundpfad f�r die *.res Dateien (Aus Configdatei) - DirEntry aHIDDir; // Verzeichnis, in dem die hid.lst gesucht wird - - SbxTransportMethodRef pNextReturn; // Verweis auf die Var, die den Returnwert aufnimmt. - - ControlsRef pControlsObj; // Jeweiliges Objekt, an dem Methoden aufgerufen weden. - -#define VAR_POOL_SIZE 8 - SbxTransportMethodRef pMyVars[VAR_POOL_SIZE]; // Falls in Ausdr�cken mehrere verwendet werden - - Time aServerTimeout; - - -// Profiling Datenfelder - sal_uLong LocalStarttime; - sal_uInt16 nNumBorders; - sal_uLong naValBorders[4]; - sal_uLong naNumEntries[5]; - sal_uLong naRemoteTime[5]; - sal_uLong naLocalTime[5]; - - sal_uLong nMinRemoteCommandDelay; - sal_uLong nMaxRemoteCommandDelay; - sal_Bool bDoRemoteCommandDelay; - - sal_Bool bLnaguageExtensionLoaded; // Wurde �ber 'use' was geladen? F�r syntax highlighting - SfxBroadcaster *pTTSfxBroadcaster; - - sal_uLong nErrorCount; - sal_uLong nWarningCount; - sal_uLong nQAErrorCount; - sal_uLong nIncludeFileWarningCount; - - SbxDimArrayRef xErrorList; - SbxDimArrayRef xWarningList; - SbxDimArrayRef xQAErrorList; - SbxDimArrayRef xIncludeFileWarningList; - - sal_Bool bIsStart; // set tu sal_True while command Start is initiating the communication - - MyBasic* pMyBasic; - - String aTestCaseName; // holds name of current TestCase - String aTestCaseFileName; // holds FileName of current TestCase - sal_uInt16 nTestCaseLineNr; // holds Line of current TestCase - - sal_Bool bEnableQaErrors; // include QA errors in report - sal_Bool bDebugFindNoErrors; // suppress generating errors when find of variables is called for variable viewing purposes - - sal_Bool bStopOnSyntaxError; // catch syntax errors in testcases or not - - Environment *pChildEnv; // Environment Variables for child Process - - HttpRequest *pHttpRequest; // used for sending HTTP requests -}; - - -class TTFormat -{ -public: - static String ms2s( sal_uLong nMilliSeconds ); -}; - - -#define ADD_TO_LOG( aLogTypep, aMsgp, aFilenamep, nLinep, nCol1p, nCol2p, aRevisionp, pLogList )\ -{ \ - TTLogMsg *pLogMsg = new TTLogMsg(); \ - pLogMsg->aDebugData.aMsg = aMsgp; \ - pLogMsg->aLogFileName = (pImpl->aLogFileBase + DirEntry(aLogFileName)).GetFull(); \ - pLogMsg->aDebugData.aFilename = aFilenamep; \ - pLogMsg->aDebugData.nLine = nLinep; \ - pLogMsg->aDebugData.nCol1 = nCol1p; \ - pLogMsg->aDebugData.nCol2 = nCol2p; \ - pLogMsg->aDebugData.aLogType = aLogTypep; \ - aLogHdl.Call( pLogMsg ); \ - void* pDummyForWarningAboutNULL = pLogList; \ - if( pDummyForWarningAboutNULL ) \ - { \ - SbxDimArray* pLogArray = (SbxDimArray*)pLogList; \ - SbxVariable* pLogLine = new SbxVariable( SbxSTRING ); \ - String aCollect; \ - aCollect.Append( pLogMsg->aDebugData.aFilename ); \ - aCollect.AppendAscii( ";" ); \ - aCollect.Append( String::CreateFromInt32( nLinep ) ); \ - aCollect.AppendAscii( ";" ); \ - aCollect.Append( aRevisionp ); \ - aCollect.AppendAscii( ";" ); \ - aCollect.Append( pLogMsg->aDebugData.aMsg ); \ - pLogLine->PutString( aCollect ); \ - pLogArray->Insert( pLogLine, pLogArray->Count() ); \ - } \ - delete pLogMsg; \ -} \ - - -#define ADD_RUN_LOG() \ - ADD_TO_LOG(LOG_RUN, String(), String(), 0, 0, 0, String(), NULL) \ - -#define ADD_ERROR_LOG(aMsg, aFilename, nLine, nCol1, nCol2, aRevision) \ -{ \ - ADD_TO_LOG(LOG_ERROR, aMsg, aFilename, nLine, nCol1, nCol2, aRevision, &pImpl->xErrorList) \ - pImpl->nErrorCount++; \ -} - -#define ADD_CALL_STACK_LOG(aMsg, aFilename, nLine, nCol1, nCol2) \ - ADD_TO_LOG(LOG_CALL_STACK, aMsg, aFilename, nLine, nCol1, nCol2, String(), NULL) \ - - -#define ADD_AUTO_LOG(aLogType, aMsg, pLogList) \ -{ \ - if ( BasicRuntimeAccess::HasRuntime() ) \ - { \ - BasicRuntime aRun = BasicRuntimeAccess::GetRuntime(); \ - ADD_TO_LOG(aLogType, aMsg, aRun.GetModuleName(SbxNAME_SHORT_TYPES), \ - aRun.GetLine(), aRun.GetCol1(), aRun.GetCol2(), aRun.GetSourceRevision(), pLogList) \ - } \ - else \ - { \ - ADD_TO_LOG(aLogType, aMsg, UniString(), 0, 0, STRING_LEN, String(), pLogList) \ - } \ -} \ - -#define ADD_CASE_LOG(aMsg) \ - ADD_AUTO_LOG(LOG_TEST_CASE, aMsg, NULL) \ - -#define ADD_MESSAGE_LOG(aMsg) \ - ADD_AUTO_LOG(LOG_MESSAGE, aMsg, NULL) \ - -#define ADD_WARNING_LOG(aMsg) \ -{ \ - ADD_AUTO_LOG(LOG_WARNING, aMsg, &pImpl->xWarningList) \ - pImpl->nWarningCount++; \ -} - -#define ADD_WARNING_LOG2(aMsg, aFilename, nLine ) \ -{ \ - ADD_TO_LOG(LOG_WARNING, aMsg, aFilename, nLine, 0, STRING_LEN, String(), &pImpl->xWarningList) \ - pImpl->nWarningCount++; \ -} - -#define ADD_ASSERTION_LOG(aMsg) \ - ADD_AUTO_LOG(LOG_ASSERTION, aMsg, NULL) \ - -#define ADD_QA_ERROR_LOG(aMsg) \ - if ( pImpl->bEnableQaErrors ) \ - { \ - ADD_AUTO_LOG(LOG_QA_ERROR, aMsg, &pImpl->xQAErrorList) \ - pImpl->nQAErrorCount++; \ - } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/registry_win.cxx b/automation/source/testtool/registry_win.cxx deleted file mode 100644 index fc2e60232..000000000 --- a/automation/source/testtool/registry_win.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -//////////////////////////////////////////////////////////////////////////// -//// -//// Windows ONLY -//// -//////////////////////////////////////////////////////////////////////////// - - -#include "registry_win.hxx" -#include -#include -#include - - -String ReadRegistry( String aKey, String aValueName ) -{ - String aRet; - HKEY hBaseKey; - if ( aKey.GetToken( 0, '\\' ).EqualsIgnoreCaseAscii( "HKEY_CURRENT_USER" ) ) - hBaseKey = HKEY_CURRENT_USER; - else if ( aKey.GetToken( 0, '\\' ).EqualsIgnoreCaseAscii( "HKEY_LOCAL_MACHINE" ) ) - hBaseKey = HKEY_LOCAL_MACHINE; - else - { - return aRet; - } - - aKey.Erase( 0, aKey.Search( '\\' )+1 ); - - HKEY hRegKey; - - if ( RegOpenKeyW( hBaseKey, - reinterpret_cast(aKey.GetBuffer()), - &hRegKey ) == ERROR_SUCCESS ) - { - LONG lRet; - sal_Unicode PathW[_MAX_PATH ]; - DWORD lSize = SAL_N_ELEMENTS(PathW); - DWORD Type = REG_SZ; - - lRet = RegQueryValueExW(hRegKey, reinterpret_cast(aValueName.GetBuffer()), NULL, &Type, (LPBYTE)PathW, &lSize); - - if ((lRet == ERROR_SUCCESS) && (Type == REG_SZ)) - { - aRet = String( PathW ); - } - - RegCloseKey(hRegKey); - } - return aRet; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/registry_win.hxx b/automation/source/testtool/registry_win.hxx deleted file mode 100644 index 9174e0682..000000000 --- a/automation/source/testtool/registry_win.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include - -String ReadRegistry( String aKey, String aValueName ); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/sysdir_win.cxx b/automation/source/testtool/sysdir_win.cxx deleted file mode 100644 index 560a95e07..000000000 --- a/automation/source/testtool/sysdir_win.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - -//////////////////////////////////////////////////////////////////////////// -//// -//// Windows ONLY -//// -//////////////////////////////////////////////////////////////////////////// - - -#ifndef _SHOBJ_H -#if defined _MSC_VER -#pragma warning(push, 1) -#pragma warning(disable: 4917) -#endif -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif -#endif -// as we define it ourselves further down the line we remove it here -#ifdef IS_ERROR - #undef IS_ERROR -#endif - -#include -#include "sysdir_win.hxx" - - -//////// copied this from setup2\win\source\system\winos.cxx - -void _SHFree( void *pv ) -{ - IMalloc *pMalloc; - if( NOERROR == SHGetMalloc(&pMalloc) ) - { - pMalloc->Free( pv ); - pMalloc->Release(); - } -} - -#define ALLOC(type, n) ((type *) HeapAlloc(GetProcessHeap(), 0, sizeof(type) * n )) -#define FREE(p) HeapFree(GetProcessHeap(), 0, p) - -UniString _SHGetSpecialFolder( int nFolderID ) -{ - - LPITEMIDLIST pidl; - HRESULT hHdl = SHGetSpecialFolderLocation( NULL, nFolderID, &pidl ); - UniString aFolder; - - if( hHdl == NOERROR ) - { - WCHAR *lpFolderW; - lpFolderW = ALLOC( WCHAR, 16000 ); - - SHGetPathFromIDListW( pidl, lpFolderW ); - aFolder = UniString( reinterpret_cast(lpFolderW) ); - - FREE( lpFolderW ); - _SHFree( pidl ); - } - return aFolder; -} - - -/////////////// end of copy - - - -String _SHGetSpecialFolder_COMMON_APPDATA() -{ - return _SHGetSpecialFolder( CSIDL_COMMON_APPDATA ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/sysdir_win.hxx b/automation/source/testtool/sysdir_win.hxx deleted file mode 100644 index ceab5d359..000000000 --- a/automation/source/testtool/sysdir_win.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include - -String _SHGetSpecialFolder_COMMON_APPDATA(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx deleted file mode 100644 index 2fb509276..000000000 --- a/automation/source/testtool/tcommuni.cxx +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_automation.hxx" - - -#include -#include -#include -#include -#include - -#include - -#include "rcontrol.hxx" -#include "tcommuni.hxx" -#include - -CommunicationManagerClientViaSocketTT::CommunicationManagerClientViaSocketTT() -: CommunicationManagerClientViaSocket( sal_True ) -, aAppPath() -, aAppParams() -, pProcess( NULL ) -{ -} - - -sal_Bool CommunicationManagerClientViaSocketTT::StartCommunication() -{ - bApplicationStarted = sal_False; - return CommunicationManagerClientViaSocket::StartCommunication( ByteString( GetHostConfig(), RTL_TEXTENCODING_UTF8 ), GetTTPortConfig() ); -} - - -sal_Bool CommunicationManagerClientViaSocketTT::StartCommunication( String aApp, String aParams, Environment *pChildEnv ) -{ - aAppPath = aApp; - aAppParams = aParams; - aAppEnv = (*pChildEnv); - return StartCommunication(); -} - - -sal_Bool CommunicationManagerClientViaSocketTT::RetryConnect() -{ - if ( !bApplicationStarted ) - { - // Die App ist wohl nicht da. Starten wir sie mal. - if ( aAppPath.Len() ) - { - delete pProcess; - - pProcess = new Process(); - pProcess->SetImage( aAppPath, aAppParams, &aAppEnv ); - - sal_Bool bSucc = pProcess->Start(); - bApplicationStarted = sal_True; - - if ( bSucc ) - { - aFirstRetryCall = Time() + Time( 0, 1 ); // Max eine Minute Zeit - for ( int i = 10 ; i-- ; ) - GetpApp()->Reschedule(); - } - return bSucc; - } - return sal_False; - } - else - { - if ( aFirstRetryCall > Time() ) - { - Timer aWait; - aWait.SetTimeout( 500 ); // Max 500 mSec - aWait.Start(); - while ( aWait.IsActive() ) - GetpApp()->Yield(); - return sal_True; - } - else - return sal_False; - } -} - -sal_Bool CommunicationManagerClientViaSocketTT::KillApplication() -{ - if ( pProcess ) - return pProcess->Terminate(); - return sal_True; -} - -#define GETSET(aVar, KeyName, Dafault) \ - aVar = aConf.ReadKey(KeyName,"No Entry"); \ - if ( aVar.CompareTo("No Entry") == COMPARE_EQUAL ) \ - { \ - aVar = ByteString(Dafault); \ - aConf.WriteKey(KeyName, aVar); \ - } - - -String GetHostConfig() -{ - String aHostToTalk; - - for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("-host=") == COMPARE_EQUAL -#ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("/host=") == COMPARE_EQUAL -#endif - ) - return Application::GetCommandLineParam( i ).Copy(6); - } - - ByteString abHostToTalk; - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Communication"); - - GETSET( abHostToTalk, "Host", DEFAULT_HOST ); - return UniString( abHostToTalk, RTL_TEXTENCODING_UTF8 ); -} - - -sal_uLong GetTTPortConfig() -{ - String aPortToTalk; - - for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("-port=") == COMPARE_EQUAL -#ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,6).CompareIgnoreCaseToAscii("/port=") == COMPARE_EQUAL -#endif - ) - { - aPortToTalk = Application::GetCommandLineParam( i ).Copy(6); - return (sal_uLong)aPortToTalk.ToInt64(); - } - } - - ByteString abPortToTalk; - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Communication"); - - GETSET( abPortToTalk, "TTPort", - rtl::OString::valueOf(static_cast(TESTTOOL_DEFAULT_PORT)) ); - return (sal_uLong)abPortToTalk.ToInt64(); -} - - -sal_uLong GetUnoPortConfig() -{ - String aPortToTalk; - - for ( sal_uInt16 i = 0 ; i < Application::GetCommandLineParamCount() ; i++ ) - { - if ( Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("-unoport=") == COMPARE_EQUAL -#ifndef UNX - || Application::GetCommandLineParam( i ).Copy(0,9).CompareIgnoreCaseToAscii("/unoport=") == COMPARE_EQUAL -#endif - ) - { - aPortToTalk = Application::GetCommandLineParam( i ).Copy(6); - return (sal_uLong)aPortToTalk.ToInt64(); - } - } - - ByteString abPortToTalk; - Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); - aConf.SetGroup("Communication"); - - GETSET( abPortToTalk, "UnoPort", - rtl::OString::valueOf(static_cast(UNO_DEFAULT_PORT)) ); - return (sal_uLong)abPortToTalk.ToInt64(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/tcommuni.hxx b/automation/source/testtool/tcommuni.hxx deleted file mode 100644 index 6d3f9af6e..000000000 --- a/automation/source/testtool/tcommuni.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include -#include - -class Process; - -class CommunicationManagerClientViaSocketTT : public CommunicationManagerClientViaSocket -{ -public: - CommunicationManagerClientViaSocketTT(); - - using CommunicationManagerClientViaSocket::StartCommunication; - virtual sal_Bool StartCommunication(); - virtual sal_Bool StartCommunication( String aApp, String aParams, Environment *pChildEnv ); - - sal_Bool KillApplication(); - -protected: - virtual sal_Bool RetryConnect(); - sal_Bool bApplicationStarted; - Time aFirstRetryCall; - String aAppPath; - String aAppParams; - Environment aAppEnv; - Process *pProcess; -}; - - -String GetHostConfig(); -sal_uLong GetTTPortConfig(); -sal_uLong GetUnoPortConfig(); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/automation/source/testtool/testtool.ini b/automation/source/testtool/testtool.ini deleted file mode 100644 index 7b77654ee..000000000 --- a/automation/source/testtool/testtool.ini +++ /dev/null @@ -1,18 +0,0 @@ -[Bootstrap] -URE_BOOTSTRAP=${ORIGIN}/fundamentalbasis!INIFILESUFFIX! -OOO_BASE_DIR=${ORIGIN}/.. -BRAND_BASE_DIR=${OOO_BASE_DIR}/!BRANDPATH! -UserInstallation=${SYSUSERCONFIG}/.oootesttool - -[Misc] -CurrentProfile=_profile_Default - -[OOoProgramDir] -Type=Path - -[Crashreporter] -UseProxy=false -ProxyServer=none -ProxyPort=8080 -AllowContact=false -ReturnAddress= diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk deleted file mode 100644 index fbbe47454..000000000 --- a/automation/util/makefile.mk +++ /dev/null @@ -1,278 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=automation -TARGET=automation -TARGETTYPE=GUI - -# --- Settings --------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Allgemein --------------------------------------------------- - -LIB1TARGET=$(SLB)$/$(TARGET).lib -LIB1FILES= \ - $(SLB)$/server.lib \ - $(SLB)$/simplecm.lib \ - $(SLB)$/communi.lib - -# --- sts library --------------------------------------------------- - -SHL1TARGET= sts$(DLLPOSTFIX) -SHL1IMPLIB= ists - -SHL1STDLIBS= \ - $(BASICLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(SOTLIB) \ - $(SVLLIB) \ - $(SVTLIB) \ - $(SVTOOLLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(VCLLIB) \ - -.IF "$(GUI)"=="WNT" -SHL1STDLIBS+= \ - $(ADVAPI32LIB) \ - $(GDI32LIB) -.ENDIF - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1LIBS= $(SLB)$/$(TARGET).lib - -DEF1NAME =$(SHL1TARGET) -DEF1DEPN = \ - $(MISC)$/$(SHL1TARGET).flt - -DEFLIB1NAME =$(TARGET) -DEF1DES =TestToolServer - -# --- simple communication library (no vcl) --------------------------------------------------- - -SHL2TARGET= simplecm$(DLLPOSTFIX) -SHL2IMPLIB= isimplecm - -SHL2STDLIBS= \ - $(TOOLSLIB) \ - $(SALLIB) - - -SHL2DEF= $(MISC)$/$(SHL2TARGET).def -SHL2LIBS= $(SLB)$/simplecm.lib - -DEF2NAME =$(SHL2TARGET) -DEF2DEPN = \ - $(MISC)$/$(SHL2TARGET).flt - -DEFLIB2NAME =simplecm -DEF2DES =SimpleCommunication - -# --- communication library --------------------------------------------------- - -SHL3TARGET= communi$(DLLPOSTFIX) -SHL3IMPLIB= icommuni - -SHL3STDLIBS= \ - $(TOOLSLIB) \ - $(SVLLIB) \ - $(VCLLIB) \ - $(SALLIB) \ - $(SIMPLECMLIB) - - -.IF "$(GUI)"=="WNT" -SHL3STDLIBS+= \ - $(ADVAPI32LIB) \ - $(GDI32LIB) -.ENDIF - -SHL3DEF= $(MISC)$/$(SHL3TARGET).def -SHL3LIBS= $(SLB)$/communi.lib -SHL3DEPN=$(SHL2TARGETN) - -DEF3NAME =$(SHL3TARGET) -DEF3DEPN = \ - $(MISC)$/$(SHL3TARGET).flt - -DEFLIB3NAME =communi -DEF3DES =Communication - -# --- TESTTOOL IDE ------------------------------------------------------ - -APP1TARGET=testtool - -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") -APP1DEPN+=$(SHL2TARGETN) $(SHL3TARGETN) -.ELSE -APP1DEPN+=$(SHL2IMPLIBN) $(SHL3IMPLIBN) -.ENDIF -APP1STDLIBS= \ - $(APP3RDLIB) \ - $(SAMPLE3RDLIB) - -APP1STDLIBS+= \ - $(CPPUHELPERLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(SVTOOLLIB) \ - $(SVLLIB) \ - $(VCLLIB) \ - $(SALLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(BASICLIB) \ - $(SIMPLECMLIB) \ - $(COMMUNILIB) - -.IF "$(GUI)"=="UNX" -APP1STDLIBS+= \ - $(SALLIB) $(BASICLIB) -APP1STDLIBS+=$(CPPULIB) -.ENDIF -.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC" -APP1STDLIBS+=$(CPPULIB) -.ENDIF - -.IF "$(GUI)"=="WNT" -APP1STDLIBS += \ - $(SHELL32LIB) \ - $(ADVAPI32LIB) -.ENDIF # "$(GUI)"=="WNT" - - - -.IF "$(OS)" == "SOLARIS" -APP1STDLIBS+= -lXm -.ENDIF - -.IF "$(GUI)" == "UNX" -.IF "$(OS)" == "LINUX" -APP1STDLIBS+= -lXext -lX11 -lSM -lICE -.ENDIF -.IF "$(OS)"=="MACOSX" -APP1STDLIBS+= -lapp -lsample -.ENDIF -.ENDIF - - - -APP1LIBS=\ - $(LB)$/testtool.lib - -APP1OBJS= $(OBJ)$/testbasi.obj \ - $(OBJ)$/cmdbasestream.obj \ - $(OBJ)$/svcommstream.obj - -# --- TESTTOOL MINIAPP ------------------------------------------------------ -# ressources are linked here - -RESLIB1NAME=tma -RESLIB1SRSFILES= \ - $(SRS)$/miniapp.srs - -APP3TARGET=miniapp -APP3STDLIBS= \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(AUTOMATIONLIB) \ - $(SALLIB) \ - $(TOOLSLIB) \ - $(SVTOOLLIB) \ - $(VCLLIB) - -.IF "$(GUI)"=="UNX" -APP3STDLIBS+= \ - $(SALLIB) -.ENDIF -# $(AUTOMATIONLIB) is build in SHL1TARGET -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") -APP3DEPN=$(SHL1TARGETN) -.ELSE -APP3DEPN=$(SHL1IMPLIBN) -.ENDIF - -APP3LIBS= \ - $(LB)$/miniapp.lib - -.IF "$(GUI)" != "UNX" -.IF "$(COM)" != "GCC" -# win16 braucht ein appobj -APP3OBJS= $(OBJ)$/testapp.obj -.ENDIF -.ENDIF - -# --- Targets ----------------------------------------------------------- - -.INCLUDE : target.mk - -# --- Basic-Filter-Datei --- - -$(MISC)$/$(SHL1TARGET).flt: makefile.mk - @echo ------------------------------ - @echo Making: $@ - @echo WEP > $@ - @echo LIBMAIN >> $@ - @echo LibMain >> $@ - @echo Sbi >> $@ - @echo exception >> $@ - @echo bad_alloc >> $@ - @echo __CT >> $@ - -$(MISC)$/$(SHL2TARGET).flt: makefile.mk - @echo ------------------------------ - @echo Making: $@ - @echo WEP > $@ - @echo LIBMAIN >> $@ - @echo LibMain >> $@ - @echo Sbi >> $@ - @echo exception >> $@ - @echo bad_alloc >> $@ - @echo __CT >> $@ - -$(MISC)$/$(SHL3TARGET).flt: makefile.mk - @echo ------------------------------ - @echo Making: $@ - @echo WEP > $@ - @echo LIBMAIN >> $@ - @echo LibMain >> $@ - @echo Sbi >> $@ - @echo exception >> $@ - @echo bad_alloc >> $@ - @echo __CT >> $@ - - -# ------------------------------------------------------------------------ - diff --git a/automation/util/manually_added_ids.hid b/automation/util/manually_added_ids.hid deleted file mode 100644 index 7372dc0d9..000000000 --- a/automation/util/manually_added_ids.hid +++ /dev/null @@ -1,8 +0,0 @@ - -MSC_Super_ID 123456 -MSC_Super_ID2 1234567 -MSC_Super_ID3 12345678 - -FontWork1TBO 40026 -FontWork2TBO 40027 - diff --git a/basctl/AllLangResTarget_basctl.mk b/basctl/AllLangResTarget_basctl.mk deleted file mode 100644 index ed9c4d5a0..000000000 --- a/basctl/AllLangResTarget_basctl.mk +++ /dev/null @@ -1,57 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_AllLangResTarget_AllLangResTarget,basctl)) - -$(eval $(call gb_AllLangResTarget_add_srs,basctl,\ - basctl/res \ -)) - -$(eval $(call gb_SrsTarget_SrsTarget,basctl/res)) - -$(eval $(call gb_SrsTarget_set_include,basctl/res,\ - -I$(realpath $(SRCDIR)/basctl/inc) \ - -I$(realpath $(SRCDIR)/basctl/source/inc) \ - -I$(realpath $(SRCDIR)/basctl/source/basicide) \ - -I$(realpath $(SRCDIR)/basctl/source/dlged) \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_SrsTarget_add_files,basctl/res,\ - basctl/source/basicide/basicprint.src \ - basctl/source/basicide/basidesh.src \ - basctl/source/basicide/brkdlg.src \ - basctl/source/basicide/macrodlg.src \ - basctl/source/basicide/moduldlg.src \ - basctl/source/basicide/moptions.src \ - basctl/source/basicide/objdlg.src \ - basctl/source/dlged/dlgresid.src \ - basctl/source/dlged/managelang.src \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk deleted file mode 100644 index 61ea991e1..000000000 --- a/basctl/Library_basctl.mk +++ /dev/null @@ -1,135 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Library_Library,basctl)) - -$(eval $(call gb_Library_add_precompiled_header,basctl,$(SRCDIR)/basctl/inc/pch/precompiled_basctl)) -$(eval $(call gb_Library_add_precompiled_header,basctl,$(SRCDIR)/basctl/source/basicide/ide_pch)) - -$(eval $(call gb_Library_set_componentfile,basctl,basctl/util/basctl)) - -$(eval $(call gb_Library_set_include,basctl,\ - -I$(realpath $(SRCDIR)/basctl/inc) \ - -I$(realpath $(SRCDIR)/basctl/inc/pch) \ - -I$(realpath $(SRCDIR)/basctl/sdi) \ - -I$(realpath $(SRCDIR)/basctl/source/inc) \ - $$(INCLUDE) \ - -I$(WORKDIR)/SdiTarget/basctl/sdi \ -)) - -$(eval $(call gb_Library_add_api,basctl,\ - udkapi \ - offapi \ -)) - -$(eval $(call gb_Library_add_linked_libs,basctl,\ - comphelper \ - cppu \ - cppuhelper \ - editeng \ - fwe \ - sal \ - sb \ - sfx \ - sot \ - svl \ - svt \ - svx \ - svxcore \ - tk \ - tl \ - utl \ - ucbhelper \ - vcl \ - xcr \ - $(gb_STDLIBS) \ -)) - -$(eval $(call gb_Library_add_exception_objects,basctl,\ - basctl/source/accessibility/accessibledialogcontrolshape \ - basctl/source/accessibility/accessibledialogwindow \ - basctl/source/basicide/basdoc \ - basctl/source/basicide/basicbox \ - basctl/source/basicide/basicrenderable \ - basctl/source/basicide/baside2b \ - basctl/source/basicide/baside2 \ - basctl/source/basicide/baside3 \ - basctl/source/basicide/basidectrlr \ - basctl/source/basicide/basides1 \ - basctl/source/basicide/basides2 \ - basctl/source/basicide/basides3 \ - basctl/source/basicide/basidesh \ - basctl/source/basicide/basobj2 \ - basctl/source/basicide/basobj3 \ - basctl/source/basicide/bastype2 \ - basctl/source/basicide/bastype3 \ - basctl/source/basicide/bastypes \ - basctl/source/basicide/brkdlg \ - basctl/source/basicide/doceventnotifier \ - basctl/source/basicide/docsignature \ - basctl/source/basicide/documentenumeration \ - basctl/source/basicide/iderdll \ - basctl/source/basicide/localizationmgr \ - basctl/source/basicide/macrodlg \ - basctl/source/basicide/moduldl2 \ - basctl/source/basicide/moduldlg \ - basctl/source/basicide/objdlg \ - basctl/source/basicide/register \ - basctl/source/basicide/scriptdocument \ - basctl/source/basicide/tbxctl \ - basctl/source/basicide/unomodel \ - basctl/source/dlged/dlgedclip \ - basctl/source/dlged/dlged \ - basctl/source/dlged/dlgedfac \ - basctl/source/dlged/dlgedfunc \ - basctl/source/dlged/dlgedlist \ - basctl/source/dlged/dlgedmod \ - basctl/source/dlged/dlgedobj \ - basctl/source/dlged/dlgedpage \ - basctl/source/dlged/dlgedview \ - basctl/source/dlged/managelang \ - basctl/source/dlged/propbrw \ -)) - -$(eval $(call gb_Library_add_sdi_headers,basctl,basctl/sdi/basslots)) - -$(eval $(call gb_SdiTarget_SdiTarget,basctl/sdi/basslots,basctl/sdi/baside)) - -$(eval $(call gb_SdiTarget_set_include,basctl/sdi/basslots,\ - $$(INCLUDE) \ -)) - -ifeq ($(OS),WNT) -$(eval $(call gb_Library_add_linked_libs,basctl,\ - advapi32 \ - gdi32 \ - shell32 \ -)) -endif - -# vim: set noet sw=4 ts=4: diff --git a/basctl/Makefile b/basctl/Makefile deleted file mode 100644 index 3abf1ae8b..000000000 --- a/basctl/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# 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 -# -# 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/basctl/Module_basctl.mk b/basctl/Module_basctl.mk deleted file mode 100644 index 57ab3293f..000000000 --- a/basctl/Module_basctl.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Module_Module,basctl)) - -$(eval $(call gb_Module_add_targets,basctl,\ - AllLangResTarget_basctl \ - Library_basctl \ - Package_xml \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/basctl/Package_xml.mk b/basctl/Package_xml.mk deleted file mode 100644 index c20b7a87e..000000000 --- a/basctl/Package_xml.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# 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 -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -$(eval $(call gb_Package_Package,basctl_xml,$(SRCDIR)/basctl)) - -$(eval $(call gb_Package_add_file,basctl_xml,xml/basctl.xml,util/basctl.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/menubar/menubar.xml,uiconfig/basicide/menubar/menubar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/statusbar/statusbar.xml,uiconfig/basicide/statusbar/statusbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/dialogbar.xml,uiconfig/basicide/toolbar/dialogbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/findbar.xml,uiconfig/basicide/toolbar/findbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/fullscreenbar.xml,uiconfig/basicide/toolbar/fullscreenbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/insertcontrolsbar.xml,uiconfig/basicide/toolbar/insertcontrolsbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/macrobar.xml,uiconfig/basicide/toolbar/macrobar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/standardbar.xml,uiconfig/basicide/toolbar/standardbar.xml)) -$(eval $(call gb_Package_add_file,basctl_xml,xml/uiconfig/modules/BasicIDE/toolbar/translationbar.xml,uiconfig/basicide/toolbar/translationbar.xml)) - -# vim: set noet sw=4 ts=4: diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc deleted file mode 100644 index 0c85ead14..000000000 --- a/basctl/inc/basidesh.hrc +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASIDESH_HRC -#define _BASIDESH_HRC - -#ifndef _SVX_SVXIDS_HRC -#include -#endif - -// Resource-ID's... -#ifndef _SVX_NOIDERESIDS - -#define RID_BASICIDE_OBJECTBAR ( RID_BASICIDE_START + 0 ) -#define RID_BASICMENU ( RID_BASICIDE_START + 1 ) -#define RID_BASICPLUGINMENU ( RID_BASICIDE_START + 2 ) -#define RID_EDT_WATCHEDIT ( RID_BASICIDE_START + 4 ) -#define RID_ICO_MDIWINDOW ( RID_BASICIDE_START + 5 ) -#define RID_POPUP_BRKDLG ( RID_BASICIDE_START + 10 ) -#define RID_POPUP_BRKPROPS ( RID_BASICIDE_START + 11 ) -#define RID_POPUP_TABBAR ( RID_BASICIDE_START + 12 ) -#define RID_TD_ORGANIZE ( RID_BASICIDE_START + 36 ) -#define RID_TP_MODULS ( RID_BASICIDE_START + 37 ) -#define RID_TP_LIBS ( RID_BASICIDE_START + 38 ) -#define RID_TP_DLGS ( RID_BASICIDE_START + 39 ) -#define RID_DLG_LIBS ( RID_BASICIDE_START + 40 ) -#define RID_DLG_NEWLIB ( RID_BASICIDE_START + 42 ) -#define RID_DLG_EXPORT ( RID_BASICIDE_START + 43 ) -#define RID_POPUP_DLGED ( RID_BASICIDE_START + 62 ) -#define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 ) - -#define RID_IMGBTN_REMOVEWATCH ( RID_BASICIDE_START + 8 ) -#define RID_IMG_INSTALLATION ( RID_BASICIDE_START + 20 ) -#define RID_IMG_DOCUMENT ( RID_BASICIDE_START + 22 ) -#define RID_IMG_MODLIB ( RID_BASICIDE_START + 24 ) -#define RID_IMG_MODLIBNOTLOADED ( RID_BASICIDE_START + 26 ) -#define RID_IMG_MODULE ( RID_BASICIDE_START + 28 ) -#define RID_IMG_MACRO ( RID_BASICIDE_START + 30 ) -#define RID_IMG_DLGLIB ( RID_BASICIDE_START + 32 ) -#define RID_IMG_DLGLIBNOTLOADED ( RID_BASICIDE_START + 34 ) -#define RID_IMG_DIALOG ( RID_BASICIDE_START + 36 ) -#define RID_IMG_LOCKED ( RID_BASICIDE_START + 41 ) -#define RID_IMGLST_LAYOUT ( RID_BASICIDE_START + 49 ) - -#define RID_STR_SEARCHALLMODULES ( RID_BASICIDE_START + 1 ) -#define RID_STR_SEARCHFROMSTART ( RID_BASICIDE_START + 2 ) -#define RID_STR_NOMODULE ( RID_BASICIDE_START + 3 ) -#define RID_STR_FILTER_ALLFILES ( RID_BASICIDE_START + 4 ) -// free -#define RID_STR_CANNOTCLOSE ( RID_BASICIDE_START + 13 ) -#define RID_STR_IDENAME ( RID_BASICIDE_START + 14 ) -#define RID_STR_INITIDE ( RID_BASICIDE_START + 15 ) -#define RID_STR_STACKNAME ( RID_BASICIDE_START + 16 ) -#define RID_STR_WATCHNAME ( RID_BASICIDE_START + 17 ) -#define RID_STR_REMOVEWATCH ( RID_BASICIDE_START + 18 ) -#define RID_STR_CANNOTRUNMACRO ( RID_BASICIDE_START + 19 ) -#define RID_STR_OPEN ( RID_BASICIDE_START + 20 ) -#define RID_STR_SAVE ( RID_BASICIDE_START + 21 ) -#define RID_STR_RUNTIMEERROR ( RID_BASICIDE_START + 22 ) -#define RID_STR_COMPILEERROR ( RID_BASICIDE_START + 23 ) -#define RID_STR_STDDIALOGNAME ( RID_BASICIDE_START + 24 ) -#define RID_STR_STDMACRONAME ( RID_BASICIDE_START + 25 ) -#define RID_STR_STDJAVAFUNCTIONNAME ( RID_BASICIDE_START + 26 ) -#define RID_STR_STDMODULENAME ( RID_BASICIDE_START + 27 ) -#define RID_STR_ALL ( RID_BASICIDE_START + 28 ) -#define RID_STR_CLOSE ( RID_BASICIDE_START + 29 ) -#define RID_STR_PAGE ( RID_BASICIDE_START + 30 ) -#define RID_STR_BADSBXNAME ( RID_BASICIDE_START + 31 ) -#define RID_STR_STDLIBNAME ( RID_BASICIDE_START + 32 ) -#define RID_STR_ERROROPENSTORAGE ( RID_BASICIDE_START + 33 ) -#define RID_STR_NOLIBINSTORAGE ( RID_BASICIDE_START + 34 ) -#define RID_STR_SBXNAMEALLREADYUSED ( RID_BASICIDE_START + 35 ) -#define RID_STR_SIGNED ( RID_BASICIDE_START + 36 ) -#define RID_STR_WATCHVARIABLE ( RID_BASICIDE_START + 37 ) -#define RID_STR_WATCHVALUE ( RID_BASICIDE_START + 38 ) -#define RID_STR_WATCHTYPE ( RID_BASICIDE_START + 39 ) -// free -#define RID_STR_REPLACESTDLIB ( RID_BASICIDE_START + 41 ) -#define RID_STR_SBXNAMEALLREADYUSED2 ( RID_BASICIDE_START + 42 ) -#define RID_STR_SEARCHNOTFOUND ( RID_BASICIDE_START + 43 ) -#define RID_STR_SEARCHREPLACES ( RID_BASICIDE_START + 44 ) -#define RID_STR_CANNOTCHANGENAMESTDLIB ( RID_BASICIDE_START + 45 ) -#define RID_STR_CANNOTCHANGENAMEREFLIB ( RID_BASICIDE_START + 46 ) -#define RID_STR_CANNOTUNLOADSTDLIB ( RID_BASICIDE_START + 47 ) -#define RID_STR_GENERATESOURCE ( RID_BASICIDE_START + 48 ) -#define RID_STR_REFNOTPOSSIBLE ( RID_BASICIDE_START + 49 ) -#define RID_STR_FILEEXISTS ( RID_BASICIDE_START + 50 ) -// free -#define RID_STR_ERROROPENLIB ( RID_BASICIDE_START + 55 ) -#define RID_STR_STDJAVAMODULENAME ( RID_BASICIDE_START + 56 ) -#define RID_STR_NEWLIB ( RID_BASICIDE_START + 57 ) -#define RID_STR_NEWMOD ( RID_BASICIDE_START + 58 ) -#define RID_STR_NEWDLG ( RID_BASICIDE_START + 59 ) -#define RID_STR_LIBNAMETOLONG ( RID_BASICIDE_START + 60 ) -#define RID_STR_ERRORCHOOSEMACRO ( RID_BASICIDE_START + 61 ) -// free -#define RID_STR_LIBISREADONLY ( RID_BASICIDE_START + 63 ) -#define RID_STR_REPLACELIB ( RID_BASICIDE_START + 64 ) -// free -#define RID_STR_IMPORTNOTPOSSIBLE ( RID_BASICIDE_START + 67 ) -#define RID_STR_NOIMPORT ( RID_BASICIDE_START + 68 ) -#define RID_STR_ENTERPASSWORD ( RID_BASICIDE_START + 69 ) -// free -#define RID_STR_NEWMETH ( RID_BASICIDE_START + 71 ) -#define RID_STR_USERMACROS ( RID_BASICIDE_START + 72 ) -#define RID_STR_USERDIALOGS ( RID_BASICIDE_START + 73 ) -#define RID_STR_USERMACROSDIALOGS ( RID_BASICIDE_START + 74 ) -#define RID_STR_SHAREMACROS ( RID_BASICIDE_START + 75 ) -#define RID_STR_SHAREDIALOGS ( RID_BASICIDE_START + 76 ) -#define RID_STR_SHAREMACROSDIALOGS ( RID_BASICIDE_START + 77 ) -// free -#define RID_STR_QUERYREPLACEMACRO ( RID_BASICIDE_START + 80 ) -#define RID_STR_FILENAME ( RID_BASICIDE_START + 81 ) -#define RID_STR_APPENDLIBS ( RID_BASICIDE_START + 82 ) -#define RID_STR_QUERYDELMACRO ( RID_BASICIDE_START + 83 ) -#define RID_STR_QUERYDELDIALOG ( RID_BASICIDE_START + 84 ) -#define RID_STR_QUERYDELLIB ( RID_BASICIDE_START + 85 ) -#define RID_STR_QUERYDELLIBREF ( RID_BASICIDE_START + 86 ) -#define RID_STR_QUERYDELMODULE ( RID_BASICIDE_START + 87 ) -#define RID_STR_BASIC ( RID_BASICIDE_START + 88 ) -#define RID_STR_DOC ( RID_BASICIDE_START + 89 ) -#define RID_STR_MACRONAMEREQ ( RID_BASICIDE_START + 90 ) -#define RID_STR_WILLSTOPPRG ( RID_BASICIDE_START + 91 ) -#define RID_STR_STACK ( RID_BASICIDE_START + 92 ) -#define RID_STR_OBJNOTFOUND ( RID_BASICIDE_START + 93 ) -#define RID_STR_COULDNTREAD ( RID_BASICIDE_START + 94 ) -#define RID_STR_COULDNTWRITE ( RID_BASICIDE_START + 95 ) -#define RID_STR_WRONGPASSWORD ( RID_BASICIDE_START + 96 ) -#define RID_STR_LINE ( RID_BASICIDE_START + 97 ) -#define RID_STR_COLUMN ( RID_BASICIDE_START + 98 ) -#define RID_STR_SOURCETOBIG ( RID_BASICIDE_START + 99 ) -#define RID_STR_EXPORTPACKAGE ( RID_BASICIDE_START + 100 ) -#define RID_STR_EXPORTBASIC ( RID_BASICIDE_START + 101 ) -#define RID_STR_PACKAGE_BUNDLE ( RID_BASICIDE_START + 102 ) - -#define RID_STR_DLGIMP_CLASH_RENAME ( RID_BASICIDE_START + 110 ) -#define RID_STR_DLGIMP_CLASH_REPLACE ( RID_BASICIDE_START + 111 ) -#define RID_STR_DLGIMP_CLASH_TITLE ( RID_BASICIDE_START + 112 ) -#define RID_STR_DLGIMP_CLASH_TEXT ( RID_BASICIDE_START + 113 ) -#define RID_STR_DLGIMP_MISMATCH_ADD ( RID_BASICIDE_START + 114 ) -#define RID_STR_DLGIMP_MISMATCH_OMIT ( RID_BASICIDE_START + 115 ) -#define RID_STR_DLGIMP_MISMATCH_TITLE ( RID_BASICIDE_START + 116 ) -#define RID_STR_DLGIMP_MISMATCH_TEXT ( RID_BASICIDE_START + 117 ) -#define RID_STR_DOCUMENT_OBJECTS ( RID_BASICIDE_START + 118 ) -#define RID_STR_USERFORMS ( RID_BASICIDE_START + 119 ) -#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 120 ) -#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 121 ) - -#endif // _SVX_NOIDERESIDS - -#endif // _BASIDESH_HRC diff --git a/basctl/inc/helpid.hrc b/basctl/inc/helpid.hrc deleted file mode 100644 index 64341f504..000000000 --- a/basctl/inc/helpid.hrc +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASCTL_HELPID_HRC -#define _BASCTL_HELPID_HRC - -#define HID_BASICIDE_TOOLBOX "BASCTL_HID_BASICIDE_TOOLBOX" -#define HID_BASICIDE_OBJECTS "BASCTL_HID_BASICIDE_OBJECTS" -#define HID_MACRO_OPTIONS "BASCTL_HID_MACRO_OPTIONS" -#define HID_BASICIDE_BRKPNTS "BASCTL_HID_BASICIDE_BRKPNTS" -#define HID_BASICIDE_MODULS "BASCTL_HID_BASICIDE_MODULS" -#define HID_BASICIDE_LIBS_TP "BASCTL_HID_BASICIDE_LIBS_TP" -#define HID_BASICIDE_LIBS_DLG "BASCTL_HID_BASICIDE_LIBS_DLG" -#define HID_BASICIDE_CONTROLS "BASCTL_HID_BASICIDE_CONTROLS" -#define HID_BASICIDE_MACROS "BASCTL_HID_BASICIDE_MACROS" -#define HID_BASICIDE_LIBS "BASCTL_HID_BASICIDE_LIBS" -#define HID_BASICIDE_ORG_TC "BASCTL_HID_BASICIDE_ORG_TC" - -#define HID_BASICIDE_MODULES_TREE "BASCTL_HID_BASICIDE_MODULES_TREE" -#define HID_BASICIDE_LIBS_TREE "BASCTL_HID_BASICIDE_LIBS_TREE" -#define HID_BASICIDE_LIBSDLG_TREE "BASCTL_HID_BASICIDE_LIBSDLG_TREE" -#define HID_BASICIDE_OBJECTCAT "BASCTL_HID_BASICIDE_OBJECTCAT" - -#define HID_BASICIDE_PROP_BROWSER "BASCTL_HID_BASICIDE_PROP_BROWSER" - -#define HID_BASICIDE_PROP_BROWSER_LBOX "BASCTL_HID_BASICIDE_PROP_BROWSER_LBOX" - -#define HID_BASICIDE_OBJCAT_SHOW "BASCTL_HID_BASICIDE_OBJCAT_SHOW" -#define HID_BASICIDE_OBJCAT_PROPS "BASCTL_HID_BASICIDE_OBJCAT_PROPS" -#define HID_BASICIDE_OBJCAT_HELP "BASCTL_HID_BASICIDE_OBJCAT_HELP" - -#define HID_BASICIDE_BRKDLG "BASCTL_HID_BASICIDE_BRKDLG" -#define HID_BASICIDE_ACTIV "BASCTL_HID_BASICIDE_ACTIV" -#define HID_BASICIDE_BRKPROPS "BASCTL_HID_BASICIDE_BRKPROPS" -#define HID_BASICIDE_REMOVEWATCH "BASCTL_HID_BASICIDE_REMOVEWATCH" -#define HID_BASICIDE_GOTOALL "BASCTL_HID_BASICIDE_GOTOALL" - -#define HID_BASICIDE_MODULWINDOW "BASCTL_HID_BASICIDE_MODULWINDOW" -#define HID_BASICIDE_DIALOGWINDOW "BASCTL_HID_BASICIDE_DIALOGWINDOW" - -#define HID_BASICIDE_EDITORWINDOW "BASCTL_HID_BASICIDE_EDITORWINDOW" -#define HID_BASICIDE_BREAKPOINTWINDOW "BASCTL_HID_BASICIDE_BREAKPOINTWINDOW" -#define HID_BASICIDE_WATCHWINDOW "BASCTL_HID_BASICIDE_WATCHWINDOW" -#define HID_BASICIDE_STACKWINDOW "BASCTL_HID_BASICIDE_STACKWINDOW" -#define HID_BASICIDE_TABBAR "BASCTL_HID_BASICIDE_TABBAR" -#define HID_BASICIDE_WATCHWINDOW_EDIT "BASCTL_HID_BASICIDE_WATCHWINDOW_EDIT" -#define HID_BASICIDE_WATCHWINDOW_LIST "BASCTL_HID_BASICIDE_WATCHWINDOW_LIST" -#define HID_BASICIDE_STACKWINDOW_LIST "BASCTL_HID_BASICIDE_STACKWINDOW_LIST" - -#define HID_BASICIDE_MANAGE_LANGUAGE "BASCTL_HID_BASICIDE_MANAGE_LANGUAGE" -#define HID_BASICIDE_SETDEFAULT_LANGUAGE "BASCTL_HID_BASICIDE_SETDEFAULT_LANGUAGE" -#define HID_BASICIDE_ADDNEW_LANGUAGE "BASCTL_HID_BASICIDE_ADDNEW_LANGUAGE" -#define HID_BASICIDE_ADDNEW_CONTROL "BASCTL_HID_BASICIDE_ADDNEW_CONTROL" - -#endif - diff --git a/basctl/inc/iderdll.hxx b/basctl/inc/iderdll.hxx deleted file mode 100644 index fcebc6ac4..000000000 --- a/basctl/inc/iderdll.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _IDERDLL_HXX -#define _IDERDLL_HXX - -class BasicIDEShell; -class BasicIDEData; - -class BasicIDEDLL -{ - friend class BasicIDEShell; - - BasicIDEShell* pShell; - BasicIDEData* pExtraData; - -public: - BasicIDEDLL(); - ~BasicIDEDLL(); - - BasicIDEShell* GetShell() const { return pShell; } - BasicIDEData* GetExtraData(); - static void Init(); - static BasicIDEDLL* GetDLL(); -}; - -#define IDE_DLL() BasicIDEDLL::GetDLL() - -#endif //_IDERDLL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/inc/pch/precompiled_basctl.cxx b/basctl/inc/pch/precompiled_basctl.cxx deleted file mode 100644 index 89ca1ce47..000000000 --- a/basctl/inc/pch/precompiled_basctl.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_basctl.hxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/inc/pch/precompiled_basctl.hxx b/basctl/inc/pch/precompiled_basctl.hxx deleted file mode 100644 index 5c6963724..000000000 --- a/basctl/inc/pch/precompiled_basctl.hxx +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:30.436716 - -#ifdef PRECOMPILED_HEADERS -#include "com/sun/star/accessibility/AccessibleEventId.hpp" -#include "com/sun/star/accessibility/AccessibleRole.hpp" -#include "com/sun/star/accessibility/AccessibleStateType.hpp" -#include "com/sun/star/awt/XDialog.hpp" -#include "com/sun/star/beans/PropertyValue.hpp" -#include "com/sun/star/beans/XPropertySet.hpp" -#include "com/sun/star/beans/Property.hpp" -#include "com/sun/star/container/XNameContainer.hpp" -#include "com/sun/star/document/MacroExecMode.hpp" -#include "com/sun/star/frame/XDispatchProvider.hpp" -#include "com/sun/star/frame/XLayoutManager.hpp" -#include "com/sun/star/resource/XStringResourcePersistence.hpp" -#include "com/sun/star/script/XLibraryContainer.hpp" -#include "com/sun/star/script/XLibraryContainerPassword.hpp" -#include "com/sun/star/script/XLibraryContainer2.hpp" -#include "com/sun/star/task/XStatusIndicator.hpp" -#include "com/sun/star/task/XStatusIndicatorFactory.hpp" -#include "com/sun/star/ui/dialogs/XFilePicker.hpp" -#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp" -#include "com/sun/star/ui/dialogs/XFilterManager.hpp" -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp" -#include "com/sun/star/util/XCloneable.hpp" - -#include "comphelper/types.hxx" -#include "comphelper/processfactory.hxx" - -#include "toolkit/awt/vclxfont.hxx" -#include "toolkit/helper/externallock.hxx" -#include "toolkit/helper/convert.hxx" -#include "toolkit/helper/vclunohelper.hxx" - -#include "tools/debug.hxx" -#include "tools/diagnose_ex.h" -#include "tools/urlobj.hxx" - -#include "vcl/wrkwin.hxx" -#include "vcl/msgbox.hxx" -#include "vcl/menu.hxx" -#include "vcl/status.hxx" -#include "vcl/sound.hxx" -#include "vcl/svapp.hxx" -#include "vcl/scrbar.hxx" - -#include "svl/svarray.hxx" -#include "svl/itempool.hxx" -#include "svl/itemset.hxx" -#include "svl/aeitem.hxx" -#include "svl/stritem.hxx" -#include "svl/whiter.hxx" -#include "svtools/langtab.hxx" -#include "svtools/texteng.hxx" -#include "svtools/textview.hxx" -#include "svtools/xtextedt.hxx" -#include "svtools/txtattr.hxx" -#include "svtools/textwindowpeer.hxx" -#include "svl/urihelper.hxx" - -#define _BASIC_TEXTPORTIONS -#include "basic/sbdef.hxx" -#include "basic/sbstar.hxx" -#include "basic/sbmeth.hxx" -#include "basic/sbmod.hxx" -#include "basic/basmgr.hxx" -#include "basic/sbuno.hxx" -#include "basic/basrdll.hxx" -#include "basic/sbx.hxx" - -#include "sfx2/app.hxx" -#include "sfx2/objface.hxx" -#include "sfx2/printer.hxx" -#include "sfx2/viewsh.hxx" -#include "sfx2/event.hxx" -#include "sfx2/bindings.hxx" -#include "sfx2/request.hxx" -#include "sfx2/childwin.hxx" -#include "sfx2/viewfrm.hxx" -#include "sfx2/objsh.hxx" -#include "sfx2/genlink.hxx" -#include "sfx2/dispatch.hxx" -#include "sfx2/minfitem.hxx" -#include "sfx2/dinfdlg.hxx" -#include "sfx2/progress.hxx" -#include "sfx2/docfile.hxx" -#include "sfx2/docfac.hxx" - - -#define ITEMID_FONT 0 -#define ITEMID_POSTURE 0 -#define ITEMID_WEIGHT 0 -#define ITEMID_SHADOWED 0 -#define ITEMID_CONTOUR 0 -#define ITEMID_CROSSEDOUT 0 -#define ITEMID_UNDERLINE 0 -#define ITEMID_FONTHEIGHT 0 -#define ITEMID_COLOR 0 -#define ITEMID_ADJUST 0 -#define ITEMID_LINESPACING 0 -#define ITEMID_TABSTOP 0 -#define ITEMID_LRSPACE 0 -#define ITEMID_ULSPACE 0 -#define ITEMID_SEARCH 0 -#define ITEMID_SEARCH 0 -#define ITEMID_SIZE 0 -#define ITEMID_FONTLIST 0 -#define ITEMID_AUTOKERN 0 -#define ITEMID_WORDLINEMODE 0 -#define ITEMID_PROPSIZE 0 -#define ITEMID_CHARSETCOLOR 0 -#define ITEMID_KERNING 0 -#define ITEMID_CASEMAP 0 -#define ITEMID_ESCAPEMENT 0 -#define ITEMID_LANGUAGE 0 -#define ITEMID_NOLINEBREAK 0 -#define ITEMID_NOHYPHENHERE 0 -#define ITEMID_BLINK 0 -#define ITEMID_PAPERBIN 0 -#define ITEMID_PRINT 0 -#define ITEMID_OPAQUE 0 -#define ITEMID_PROTECT 0 -#define ITEMID_SHADOW 0 -#define ITEMID_BOX 0 -#define ITEMID_BOXINFO 0 -#define ITEMID_FMTBREAK 0 -#define ITEMID_FMTKEEP 0 -#define ITEMID_LINE 0 -#define ITEMID_BRUSH 0 - -#include "svl/srchitem.hxx" -#include "editeng/flstitem.hxx" -#include "editeng/fontitem.hxx" -#include "editeng/postitem.hxx" -#include "editeng/wghtitem.hxx" -#include "editeng/fhgtitem.hxx" -#include "editeng/fwdtitem.hxx" -#include "editeng/udlnitem.hxx" -#include "editeng/crsditem.hxx" -#include "editeng/shdditem.hxx" -#include "editeng/akrnitem.hxx" -#include "editeng/wrlmitem.hxx" -#include "editeng/cntritem.hxx" -#include "editeng/prszitem.hxx" -#include "editeng/colritem.hxx" -#include "editeng/cscoitem.hxx" -#include "editeng/kernitem.hxx" - -#include "editeng/cmapitem.hxx" -#include "editeng/escpitem.hxx" -#include "editeng/langitem.hxx" -#include "editeng/nlbkitem.hxx" -#include "editeng/nhypitem.hxx" -#include "editeng/lcolitem.hxx" -#include "editeng/blnkitem.hxx" - -#include "editeng/pbinitem.hxx" -#include "editeng/sizeitem.hxx" -#include "editeng/lrspitem.hxx" -#include "editeng/ulspitem.hxx" -#include "editeng/prntitem.hxx" -#include "editeng/opaqitem.hxx" -#include "editeng/protitem.hxx" -#include "editeng/shaditem.hxx" -#include "editeng/boxitem.hxx" -#include "editeng/brkitem.hxx" -#include "editeng/keepitem.hxx" -#include "editeng/bolnitem.hxx" -#include "editeng/brshitem.hxx" -#include "svx/xmlsecctrl.hxx" -#include "editeng/unolingu.hxx" - -#include "xmlscript/xmldlg_imexp.hxx" - -#include "unotools/charclass.hxx" -#include "unotools/accessiblestatesethelper.hxx" -#include "unotools/accessiblerelationsethelper.hxx" -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/prj/build.lst b/basctl/prj/build.lst deleted file mode 100644 index a92b34691..000000000 --- a/basctl/prj/build.lst +++ /dev/null @@ -1,3 +0,0 @@ -bc basctl : LIBXSLT:libxslt TRANSLATIONS:translations svx NULL -bc basctl usr1 - all bc_mkout NULL -bc basctl\prj nmake - all bc_prj NULL diff --git a/basctl/prj/d.lst b/basctl/prj/d.lst deleted file mode 100644 index e69de29bb..000000000 diff --git a/basctl/prj/makefile.mk b/basctl/prj/makefile.mk deleted file mode 100644 index d30ff8a47..000000000 --- a/basctl/prj/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# 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/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi deleted file mode 100644 index e127b67a3..000000000 --- a/basctl/sdi/baside.sdi +++ /dev/null @@ -1,475 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -interface BasicIDEView -[ - uuid = "D88DF7A2-EE63-11d0-89CA-008029E4B0B1"; -] -{ -} - -shell BasicIDEShell -{ - import BasicIDEView [Automation]; - - // ======================================================== - // Current, je nach aktuellem Fenster: - // ======================================================== - SID_BASICIDE_HIDECURPAGE - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_BASICIDE_DELETECURRENT - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_BASICIDE_RENAMECURRENT - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_SELECTALL - [ - ExecMethod = ExecuteCurrent; - ] - - SID_CUT - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_COPY - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_PASTE - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_UNDO - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_REDO - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_DELETE - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_BACKSPACE - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_SEARCH_OPTIONS - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - SID_SEARCH_ITEM - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - FID_SEARCH_NOW - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - FID_SEARCH_OFF - [ - ExecMethod = ExecuteCurrent; - StateMethod = GetState; - ] - - // ======================================================== - // Global: Egal, welches Fenster gerade aktiv ist: - // ======================================================== - SID_BASICIDE_LIBSELECTOR - [ - StateMethod = GetState; - ] - - SID_BASICIDE_LIBSELECTED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_LIBLOADED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_LIBREMOVED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_SBXDELETED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_SBXINSERTED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_SBXRENAMED - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_SHOWSBX - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_NEWWINDOW - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_DOCINFO - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_SAVEDOC - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_SIGNATURE - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_SAVEASDOC - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - // Ab hier normal... - SID_BASICIDE_CHOOSEMACRO - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_MODULEDLG - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_OBJCAT - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_CREATEMACRO - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_EDITMACRO - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_NAMECHANGEDONTAB - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_STOREMODULESOURCE - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_STOREALLMODULESOURCES - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_UPDATEMODULESOURCE - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_UPDATEALLMODULESOURCES - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICSTOP - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_NEWMODULE - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_NEWJAVAMODULE - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_NEWDIALOG - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_SHOW_PROPERTYBROWSER - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_SHOWWINDOW - [ - ExecMethod = ExecuteGlobal; - ] - - SID_BASICIDE_MANAGE_LANG - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - SID_BASICIDE_CURRENT_LANG - [ - ExecMethod = ExecuteGlobal; - StateMethod = GetState; - ] - - // ======================================================== - // Nur, wenn BasicFenster oben - // ======================================================== - SID_BASICRUN - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICCOMPILE - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICLOAD - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICSAVEAS - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_MATCHGROUP - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICSTEPINTO - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICSTEPOVER - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICSTEPOUT - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_TOGGLEBRKPNT - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_MANAGEBRKPNTS - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_TOGGLEBRKPNTENABLED - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_ADDWATCH - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_REMOVEWATCH - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - SID_BASICIDE_BRKPNTSCHANGED - [ - ExecMethod = ExecuteBasic; - StateMethod = GetState; - ] - - // ======================================================== - // Nur, wenn Dialogfenster oben - // ======================================================== - SID_CHOOSE_CONTROLS - [ - ExecMethod = ExecuteDialog; - StateMethod = GetState; - ] - - SID_EXPORT_DIALOG - [ - ExecMethod = ExecuteDialog; - StateMethod = GetState; - ] - - SID_IMPORT_DIALOG - [ - ExecMethod = ExecuteDialog; - StateMethod = GetState; - ] - - SID_DIALOG_TESTMODE - [ - ExecMethod = ExecuteDialog; - StateMethod = GetState; - ] - - SID_BASICIDE_STAT_POS - [ - StateMethod = GetState; - ] - - SID_BASICIDE_STAT_DATE - [ - StateMethod = GetState; - ] - - SID_BASICIDE_STAT_TITLE - [ - StateMethod = GetState; - ] - - SID_DOC_MODIFIED - [ - StateMethod = GetState; - ] - - SID_ATTR_INSERT - [ - StateMethod = GetState; - ] - - SID_ATTR_SIZE - [ - StateMethod = GetState; - ] -} - -interface BasicIDEDocument -[ - uuid = "D88DF7A1-EE63-11d0-89CA-008029E4B0B1"; -] -{ -} - -shell BasicDocShell -{ - import BasicIDEDocument [Automation]; -} - diff --git a/basctl/sdi/basslots.hrc b/basctl/sdi/basslots.hrc deleted file mode 100644 index 30f719725..000000000 --- a/basctl/sdi/basslots.hrc +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include diff --git a/basctl/sdi/basslots.sdi b/basctl/sdi/basslots.sdi deleted file mode 100644 index b8f387d9b..000000000 --- a/basctl/sdi/basslots.sdi +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -module -"6706E0E7-FB05-101B-804c-04021c007002" -"6806E0E7-FB05-101B-804c-04021c007002" -BasicIDE -[ -HelpText( "BasicIDE" ) -SlotIdFile( "basslots.hrc" ) -] -{ - //========================================================================= - include "sfx2/sfxitems.sdi" - include "sfx2/sfx.sdi" - include "svx/svxitems.sdi" - include "svx/xoitems.sdi" - include "svx/svx.sdi" - - include "baside.sdi" - -} - diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx deleted file mode 100644 index 8c7fdcfa3..000000000 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ /dev/null @@ -1,621 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// ----------------------------------------------------------------------------- -// class AccessibleDialogControlShape -// ----------------------------------------------------------------------------- - -AccessibleDialogControlShape::AccessibleDialogControlShape( DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj ) - :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) - ,m_pDialogWindow( pDialogWindow ) - ,m_pDlgEdObj( pDlgEdObj ) -{ - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - - if ( m_pDlgEdObj ) - m_xControlModel = Reference< XPropertySet >( m_pDlgEdObj->GetUnoControlModel(), UNO_QUERY ); - - if ( m_xControlModel.is() ) - m_xControlModel->addPropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) ); - - m_bFocused = IsFocused(); - m_bSelected = IsSelected(); - m_aBounds = GetBounds(); -} - -// ----------------------------------------------------------------------------- - -AccessibleDialogControlShape::~AccessibleDialogControlShape() -{ - if ( m_xControlModel.is() ) - m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) ); - - delete m_pExternalLock; - m_pExternalLock = NULL; -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogControlShape::IsFocused() -{ - sal_Bool bFocused = sal_False; - if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView && pSdrView->IsObjMarked( m_pDlgEdObj ) && pSdrView->GetMarkedObjectList().GetMarkCount() == 1 ) - bFocused = sal_True; - } - - return bFocused; -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogControlShape::IsSelected() -{ - sal_Bool bSelected = sal_False; - if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - bSelected = pSdrView->IsObjMarked( m_pDlgEdObj ); - } - - return bSelected; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::SetFocused( sal_Bool bFocused ) -{ - if ( m_bFocused != bFocused ) - { - Any aOldValue, aNewValue; - if ( m_bFocused ) - aOldValue <<= AccessibleStateType::FOCUSED; - else - aNewValue <<= AccessibleStateType::FOCUSED; - m_bFocused = bFocused; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::SetSelected( sal_Bool bSelected ) -{ - if ( m_bSelected != bSelected ) - { - Any aOldValue, aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - -awt::Rectangle AccessibleDialogControlShape::GetBounds() -{ - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pDlgEdObj ) - { - // get the bounding box of the shape in logic units - Rectangle aRect = m_pDlgEdObj->GetSnapRect(); - - if ( m_pDialogWindow ) - { - // transform coordinates relative to the parent - MapMode aMap = m_pDialogWindow->GetMapMode(); - Point aOrg = aMap.GetOrigin(); - aRect.Move( aOrg.X(), aOrg.Y() ); - - // convert logic units to pixel - aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) ); - - // clip the shape's bounding box with the bounding box of its parent - Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); - aRect = aRect.GetIntersection( aParentRect ); - aBounds = AWTRectangle( aRect ); - } - } - - return aBounds; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::SetBounds( const awt::Rectangle& aBounds ) -{ - if ( m_aBounds.X != aBounds.X || m_aBounds.Y != aBounds.Y || m_aBounds.Width != aBounds.Width || m_aBounds.Height != aBounds.Height ) - { - m_aBounds = aBounds; - NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); - } -} - -// ----------------------------------------------------------------------------- - -Window* AccessibleDialogControlShape::GetWindow() const -{ - Window* pWindow = NULL; - if ( m_pDlgEdObj ) - { - Reference< awt::XControl > xControl( m_pDlgEdObj->GetControl(), UNO_QUERY ); - if ( xControl.is() ) - pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); - } - - return pWindow; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogControlShape::GetModelStringProperty( const sal_Char* pPropertyName ) -{ - ::rtl::OUString sReturn; - - try - { - if ( m_xControlModel.is() ) - { - ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( pPropertyName ) ); - Reference< XPropertySetInfo > xInfo = m_xControlModel->getPropertySetInfo(); - if ( xInfo.is() && xInfo->hasPropertyByName( sPropertyName ) ) - m_xControlModel->getPropertyValue( sPropertyName ) >>= sReturn; - } - } - catch ( const Exception& ) - { - OSL_FAIL( "AccessibleDialogControlShape::GetModelStringProperty: caught an exception!" ); - } - - return sReturn; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - rStateSet.AddState( AccessibleStateType::ENABLED ); - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - rStateSet.AddState( AccessibleStateType::SHOWING ); - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( IsFocused() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - - if ( IsSelected() ) - rStateSet.AddState( AccessibleStateType::SELECTED ); - - rStateSet.AddState( AccessibleStateType::RESIZABLE ); -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle AccessibleDialogControlShape::implGetBounds() throw (RuntimeException) -{ - return GetBounds(); -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( AccessibleDialogControlShape, AccessibleExtendedComponentHelper_BASE, AccessibleDialogControlShape_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleDialogControlShape, AccessibleExtendedComponentHelper_BASE, AccessibleDialogControlShape_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::disposing() -{ - AccessibleExtendedComponentHelper_BASE::disposing(); - - m_pDialogWindow = NULL; - m_pDlgEdObj = NULL; - - if ( m_xControlModel.is() ) - m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) ); - m_xControlModel.clear(); -} - -// ----------------------------------------------------------------------------- -// XEventListener -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::disposing( const lang::EventObject& ) throw (RuntimeException) -{ - if ( m_xControlModel.is() ) - m_xControlModel->removePropertyChangeListener( ::rtl::OUString(), static_cast< beans::XPropertyChangeListener* >( this ) ); - m_xControlModel.clear(); -} - -// ----------------------------------------------------------------------------- -// XPropertyChangeListener -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::propertyChange( const beans::PropertyChangeEvent& rEvent ) throw (RuntimeException) -{ - if ( rEvent.PropertyName == DLGED_PROP_NAME ) - { - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, rEvent.OldValue, rEvent.NewValue ); - } - else if ( rEvent.PropertyName == DLGED_PROP_POSITIONX || - rEvent.PropertyName == DLGED_PROP_POSITIONY || - rEvent.PropertyName == DLGED_PROP_WIDTH || - rEvent.PropertyName == DLGED_PROP_HEIGHT ) - { - SetBounds( GetBounds() ); - } - else if ( rEvent.PropertyName == DLGED_PROP_BACKGROUNDCOLOR || - rEvent.PropertyName == DLGED_PROP_TEXTCOLOR || - rEvent.PropertyName == DLGED_PROP_TEXTLINECOLOR ) - { - NotifyAccessibleEvent( AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any() ); - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogControlShape::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basctl.AccessibleShape" )); -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogControlShape::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > AccessibleDialogControlShape::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AccessibleShape" )); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- - -Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleContext( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return this; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogControlShape::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogControlShape::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogControlShape::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pDialogWindow ) - xParent = m_pDialogWindow->GetAccessible(); - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogControlShape::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - Reference< XAccessible > xParent( getAccessibleParent() ); - if ( xParent.is() ) - { - Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); - if ( xParentContext.is() ) - { - for ( sal_Int32 i = 0, nCount = xParentContext->getAccessibleChildCount(); i < nCount; ++i ) - { - Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) ); - if ( xChild.is() ) - { - Reference< XAccessibleContext > xChildContext = xChild->getAccessibleContext(); - if ( xChildContext == (XAccessibleContext*)this ) - { - nIndexInParent = i; - break; - } - } - } - } - } - - return nIndexInParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 AccessibleDialogControlShape::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::SHAPE; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogControlShape::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetModelStringProperty( "HelpText" ); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogControlShape::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return GetModelStringProperty( "Name" ); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > AccessibleDialogControlShape::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleStateSet > AccessibleDialogControlShape::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale AccessibleDialogControlShape::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogControlShape::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Reference< XAccessible >(); -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogControlShape::grabFocus( ) throw (RuntimeException) -{ - // no focus for shapes -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogControlShape::getForeground( ) throw (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 AccessibleDialogControlShape::getBackground( ) throw (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 -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), 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 AccessibleDialogControlShape::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogControlShape::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText; - Window* pWindow = GetWindow(); - if ( pWindow ) - sText = pWindow->GetQuickHelpText(); - - return sText; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx deleted file mode 100644 index 70677e4ef..000000000 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ /dev/null @@ -1,1126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - -DBG_NAME( AccessibleDialogWindow ) - - -// ----------------------------------------------------------------------------- -// class ChildDescriptor -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::ChildDescriptor::ChildDescriptor( DlgEdObj* _pDlgEdObj ) - :pDlgEdObj( _pDlgEdObj ) - ,rxAccessible( 0 ) -{ -} - -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::ChildDescriptor::~ChildDescriptor() -{ -} - -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::ChildDescriptor::ChildDescriptor( const ChildDescriptor& rDesc ) - :pDlgEdObj( rDesc.pDlgEdObj ) - ,rxAccessible( rDesc.rxAccessible ) -{ -} - -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::ChildDescriptor& AccessibleDialogWindow::ChildDescriptor::operator=( const ChildDescriptor& rDesc ) -{ - pDlgEdObj = rDesc.pDlgEdObj; - rxAccessible = rDesc.rxAccessible; - - return *this; -} - -// ----------------------------------------------------------------------------- - -bool AccessibleDialogWindow::ChildDescriptor::operator==( const ChildDescriptor& rDesc ) -{ - bool bRet = false; - if ( pDlgEdObj == rDesc.pDlgEdObj ) - bRet = true; - - return bRet; -} - -// ----------------------------------------------------------------------------- - -bool AccessibleDialogWindow::ChildDescriptor::operator<( const ChildDescriptor& rDesc ) const -{ - bool bRet = false; - if ( pDlgEdObj && rDesc.pDlgEdObj && pDlgEdObj->GetOrdNum() < rDesc.pDlgEdObj->GetOrdNum() ) - bRet = true; - - return bRet; -} - -// ----------------------------------------------------------------------------- -// class AccessibleDialogWindow -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::AccessibleDialogWindow( DialogWindow* pDialogWindow ) - :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) - ,m_pDialogWindow( pDialogWindow ) -{ - DBG_CTOR( AccessibleDialogWindow, NULL ); - m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); - - if ( m_pDialogWindow ) - { - SdrPage* pSdrPage = m_pDialogWindow->GetPage(); - if ( pSdrPage ) - { - sal_uLong nCount = pSdrPage->GetObjCount(); - - for ( sal_uLong i = 0; i < nCount; ++i ) - { - SdrObject* pObj = pSdrPage->GetObj( i ); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) - { - ChildDescriptor aDesc( pDlgEdObj ); - if ( IsChildVisible( aDesc ) ) - m_aAccessibleChildren.push_back( aDesc ); - } - } - } - - m_pDialogWindow->AddEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) ); - - m_pDlgEditor = m_pDialogWindow->GetEditor(); - if ( m_pDlgEditor ) - StartListening( *m_pDlgEditor ); - - m_pDlgEdModel = m_pDialogWindow->GetModel(); - if ( m_pDlgEdModel ) - StartListening( *m_pDlgEdModel ); - } -} - -// ----------------------------------------------------------------------------- - -AccessibleDialogWindow::~AccessibleDialogWindow() -{ - DBG_DTOR( AccessibleDialogWindow, NULL ); - if ( m_pDialogWindow ) - m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) ); - - if ( m_pDlgEditor ) - EndListening( *m_pDlgEditor ); - - if ( m_pDlgEdModel ) - EndListening( *m_pDlgEdModel ); - - delete m_pExternalLock; - m_pExternalLock = NULL; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::UpdateFocused() -{ - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetFocused( pShape->IsFocused() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::UpdateSelected() -{ - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetSelected( pShape->IsSelected() ); - } - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::UpdateBounds() -{ - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible ); - if ( xChild.is() ) - { - AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() ); - if ( pShape ) - pShape->SetBounds( pShape->GetBounds() ); - } - } -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc ) -{ - sal_Bool bVisible = sal_False; - - if ( m_pDialogWindow ) - { - // first check, if the shape is in a visible layer - SdrModel* pSdrModel = m_pDialogWindow->GetModel(); - if ( pSdrModel ) - { - SdrLayerAdmin& rLayerAdmin = pSdrModel->GetLayerAdmin(); - DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj; - if ( pDlgEdObj ) - { - SdrLayerID nLayerId = pDlgEdObj->GetLayer(); - const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId ); - if ( pSdrLayer ) - { - String aLayerName = pSdrLayer->GetName(); - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView && pSdrView->IsLayerVisible( aLayerName ) ) - { - // get the bounding box of the shape in logic units - Rectangle aRect = pDlgEdObj->GetSnapRect(); - - // transform coordinates relative to the parent - MapMode aMap = m_pDialogWindow->GetMapMode(); - Point aOrg = aMap.GetOrigin(); - aRect.Move( aOrg.X(), aOrg.Y() ); - - // convert logic units to pixel - aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) ); - - // check, if the shape's bounding box intersects with the bounding box of its parent - Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); - if ( aParentRect.IsOver( aRect ) ) - bVisible = sal_True; - } - } - } - } - } - - return bVisible; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::InsertChild( const ChildDescriptor& rDesc ) -{ - // check, if object is already in child list - AccessibleChildren::iterator aIter = ::std::find( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end(), rDesc ); - - // if not found, insert in child list - if ( aIter == m_aAccessibleChildren.end() ) - { - // insert entry in child list - m_aAccessibleChildren.push_back( rDesc ); - - // get the accessible of the inserted child - Reference< XAccessible > xChild( getAccessibleChild( m_aAccessibleChildren.size() - 1 ) ); - - // sort child list - SortChildren(); - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc ) -{ - // find object in child list - AccessibleChildren::iterator aIter = ::std::find( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end(), rDesc ); - - // if found, remove from child list - if ( aIter != m_aAccessibleChildren.end() ) - { - // get the accessible of the removed child - Reference< XAccessible > xChild( aIter->rxAccessible ); - - // remove entry from child list - m_aAccessibleChildren.erase( aIter ); - - // send accessible child event - if ( xChild.is() ) - { - Any aOldValue, aNewValue; - aOldValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::UpdateChild( const ChildDescriptor& rDesc ) -{ - if ( IsChildVisible( rDesc ) ) - { - // if the object is not in the child list, insert child - InsertChild( rDesc ); - } - else - { - // if the object is in the child list, remove child - RemoveChild( rDesc ); - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::UpdateChildren() -{ - if ( m_pDialogWindow ) - { - SdrPage* pSdrPage = m_pDialogWindow->GetPage(); - if ( pSdrPage ) - { - for ( sal_uLong i = 0, nCount = pSdrPage->GetObjCount(); i < nCount; ++i ) - { - SdrObject* pObj = pSdrPage->GetObj( i ); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) - UpdateChild( ChildDescriptor( pDlgEdObj ) ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::SortChildren() -{ - // sort child list - ::std::sort( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end() ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( AccessibleDialogWindow, WindowEventListener, VclSimpleEvent*, pEvent ) -{ - DBG_CHKTHIS( AccessibleDialogWindow, 0 ); - DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "AccessibleDialogWindow::WindowEventListener: unknown window event!" ); - - if ( pEvent && pEvent->ISA( VclWindowEvent ) ) - { - DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!" ); - if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) - { - ProcessWindowEvent( *(VclWindowEvent*)pEvent ); - } - } - - return 0; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - Any aOldValue, aNewValue; - - switch ( rVclWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_ENABLED: - { - aNewValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_DISABLED: - { - aOldValue <<= AccessibleStateType::ENABLED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_ACTIVATE: - { - aNewValue <<= AccessibleStateType::ACTIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_DEACTIVATE: - { - aOldValue <<= AccessibleStateType::ACTIVE; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_GETFOCUS: - { - aNewValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_LOSEFOCUS: - { - aOldValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_SHOW: - { - aNewValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_HIDE: - { - aOldValue <<= AccessibleStateType::SHOWING; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } - break; - case VCLEVENT_WINDOW_RESIZE: - { - NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, aOldValue, aNewValue ); - UpdateChildren(); - UpdateBounds(); - } - break; - case VCLEVENT_OBJECT_DYING: - { - if ( m_pDialogWindow ) - { - m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) ); - m_pDialogWindow = NULL; - - if ( m_pDlgEditor ) - EndListening( *m_pDlgEditor ); - m_pDlgEditor = NULL; - - if ( m_pDlgEdModel ) - EndListening( *m_pDlgEdModel ); - m_pDlgEdModel = NULL; - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } - } - break; - default: - { - } - break; - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - if ( m_pDialogWindow ) - { - if ( m_pDialogWindow->IsEnabled() ) - rStateSet.AddState( AccessibleStateType::ENABLED ); - - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - if ( m_pDialogWindow->HasFocus() ) - rStateSet.AddState( AccessibleStateType::FOCUSED ); - - rStateSet.AddState( AccessibleStateType::VISIBLE ); - - if ( m_pDialogWindow->IsVisible() ) - rStateSet.AddState( AccessibleStateType::SHOWING ); - - rStateSet.AddState( AccessibleStateType::OPAQUE ); - - rStateSet.AddState( AccessibleStateType::RESIZABLE ); - } -} - -// ----------------------------------------------------------------------------- -// OCommonAccessibleComponent -// ----------------------------------------------------------------------------- - -awt::Rectangle AccessibleDialogWindow::implGetBounds() throw (RuntimeException) -{ - awt::Rectangle aBounds; - if ( m_pDialogWindow ) - aBounds = AWTRectangle( Rectangle( m_pDialogWindow->GetPosPixel(), m_pDialogWindow->GetSizePixel() ) ); - - return aBounds; -} - -// ----------------------------------------------------------------------------- -// SfxListener -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( rHint.ISA( SdrHint ) ) - { - SdrHint* pSdrHint = (SdrHint*)&rHint; - switch ( pSdrHint->GetKind() ) - { - case HINT_OBJINSERTED: - { - SdrObject* pObj = (SdrObject*)pSdrHint->GetObject(); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) - { - ChildDescriptor aDesc( pDlgEdObj ); - if ( IsChildVisible( aDesc ) ) - InsertChild( aDesc ); - } - } - break; - case HINT_OBJREMOVED: - { - SdrObject* pObj = (SdrObject*)pSdrHint->GetObject(); - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) - RemoveChild( ChildDescriptor( pDlgEdObj ) ); - } - break; - default: ; - } - } - else if ( rHint.ISA( DlgEdHint ) ) - { - DlgEdHint* pDlgEdHint = (DlgEdHint*)&rHint; - switch ( pDlgEdHint->GetKind() ) - { - case DLGED_HINT_WINDOWSCROLLED: - { - UpdateChildren(); - UpdateBounds(); - } - break; - case DLGED_HINT_LAYERCHANGED: - { - DlgEdObj* pDlgEdObj = pDlgEdHint->GetObject(); - if ( pDlgEdObj ) - UpdateChild( ChildDescriptor( pDlgEdObj ) ); - } - break; - case DLGED_HINT_OBJORDERCHANGED: - { - SortChildren(); - } - break; - case DLGED_HINT_SELECTIONCHANGED: - { - UpdateFocused(); - UpdateSelected(); - } - break; - default: ; - } - } -} - -// ----------------------------------------------------------------------------- -// XInterface -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XINTERFACE2( AccessibleDialogWindow, AccessibleExtendedComponentHelper_BASE, AccessibleDialogWindow_BASE ) - -// ----------------------------------------------------------------------------- -// XTypeProvider -// ----------------------------------------------------------------------------- - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleDialogWindow, AccessibleExtendedComponentHelper_BASE, AccessibleDialogWindow_BASE ) - -// ----------------------------------------------------------------------------- -// XComponent -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::disposing() -{ - AccessibleExtendedComponentHelper_BASE::disposing(); - - if ( m_pDialogWindow ) - { - m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) ); - m_pDialogWindow = NULL; - - if ( m_pDlgEditor ) - EndListening( *m_pDlgEditor ); - m_pDlgEditor = NULL; - - if ( m_pDlgEdModel ) - EndListening( *m_pDlgEdModel ); - m_pDlgEdModel = NULL; - - // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } - m_aAccessibleChildren.clear(); - } -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogWindow::getImplementationName() throw (RuntimeException) -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basctl.AccessibleWindow" )); -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogWindow::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -// ----------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames(1); - aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleWindow" )); - return aNames; -} - -// ----------------------------------------------------------------------------- -// XAccessible -// ----------------------------------------------------------------------------- - -Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return this; -} - -// ----------------------------------------------------------------------------- -// XAccessibleContext -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return m_aAccessibleChildren.size(); -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild = m_aAccessibleChildren[i].rxAccessible; - if ( !xChild.is() ) - { - if ( m_pDialogWindow ) - { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[i].pDlgEdObj; - if ( pDlgEdObj ) - { - xChild = new AccessibleDialogControlShape( m_pDialogWindow, pDlgEdObj ); - - // insert into child list - m_aAccessibleChildren[i].rxAccessible = xChild; - } - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogWindow::getAccessibleParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pDialogWindow ) - { - Window* pParent = m_pDialogWindow->GetAccessibleParentWindow(); - if ( pParent ) - xParent = pParent->GetAccessible(); - } - - return xParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogWindow::getAccessibleIndexInParent( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nIndexInParent = -1; - if ( m_pDialogWindow ) - { - Window* pParent = m_pDialogWindow->GetAccessibleParentWindow(); - if ( pParent ) - { - for ( sal_uInt16 i = 0, nCount = pParent->GetAccessibleChildWindowCount(); i < nCount; ++i ) - { - Window* pChild = pParent->GetAccessibleChildWindow( i ); - if ( pChild == static_cast< Window* >( m_pDialogWindow ) ) - { - nIndexInParent = i; - break; - } - } - } - } - - return nIndexInParent; -} - -// ----------------------------------------------------------------------------- - -sal_Int16 AccessibleDialogWindow::getAccessibleRole( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return AccessibleRole::PANEL; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogWindow::getAccessibleDescription( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sDescription; - if ( m_pDialogWindow ) - sDescription = m_pDialogWindow->GetAccessibleDescription(); - - return sDescription; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogWindow::getAccessibleName( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sName; - if ( m_pDialogWindow ) - sName = m_pDialogWindow->GetAccessibleName(); - - return sName; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleRelationSet > AccessibleDialogWindow::getAccessibleRelationSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessibleStateSet > AccessibleDialogWindow::getAccessibleStateSet( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - -// ----------------------------------------------------------------------------- - -Locale AccessibleDialogWindow::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLocale(); -} - -// ----------------------------------------------------------------------------- -// XAccessibleComponent -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xAcc = getAccessibleChild( i ); - if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); - if ( xComp.is() ) - { - Rectangle aRect = VCLRectangle( xComp->getBounds() ); - Point aPos = VCLPoint( rPoint ); - if ( aRect.IsInside( aPos ) ) - { - xChild = xAcc; - break; - } - } - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::grabFocus( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( m_pDialogWindow ) - m_pDialogWindow->GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogWindow::getForeground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pDialogWindow ) - { - if ( m_pDialogWindow->IsControlForeground() ) - nColor = m_pDialogWindow->GetControlForeground().GetColor(); - else - { - Font aFont; - if ( m_pDialogWindow->IsControlFont() ) - aFont = m_pDialogWindow->GetControlFont(); - else - aFont = m_pDialogWindow->GetFont(); - nColor = aFont.GetColor().GetColor(); - } - } - - return nColor; -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogWindow::getBackground( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nColor = 0; - if ( m_pDialogWindow ) - { - if ( m_pDialogWindow->IsControlBackground() ) - nColor = m_pDialogWindow->GetControlBackground().GetColor(); - else - nColor = m_pDialogWindow->GetBackground().GetColor().GetColor(); - } - - return nColor; -} - -// ----------------------------------------------------------------------------- -// XAccessibleExtendedComponent -// ----------------------------------------------------------------------------- - -Reference< awt::XFont > AccessibleDialogWindow::getFont( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - if ( m_pDialogWindow ) - { - Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - Font aFont; - if ( m_pDialogWindow->IsControlFont() ) - aFont = m_pDialogWindow->GetControlFont(); - else - aFont = m_pDialogWindow->GetFont(); - VCLXFont* pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev.get(), aFont ); - xFont = pVCLXFont; - } - } - - return xFont; -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogWindow::getTitledBorderText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - return ::rtl::OUString(); -} - -// ----------------------------------------------------------------------------- - -::rtl::OUString AccessibleDialogWindow::getToolTipText( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - ::rtl::OUString sText; - if ( m_pDialogWindow ) - sText = m_pDialogWindow->GetQuickHelpText(); - - return sText; -} - -// ----------------------------------------------------------------------------- -// XAccessibleSelection -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - if ( m_pDialogWindow ) - { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - { - SdrPageView* pPgView = pSdrView->GetSdrPageView(); - if ( pPgView ) - pSdrView->MarkObj( pDlgEdObj, pPgView ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - sal_Bool bSelected = sal_False; - if ( m_pDialogWindow ) - { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - bSelected = pSdrView->IsObjMarked( pDlgEdObj ); - } - } - - return bSelected; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::clearAccessibleSelection( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - pSdrView->UnmarkAll(); - } -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::selectAllAccessibleChildren( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( m_pDialogWindow ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - pSdrView->MarkAll(); - } -} - -// ----------------------------------------------------------------------------- - -sal_Int32 AccessibleDialogWindow::getSelectedAccessibleChildCount( ) throw (RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - sal_Int32 nRet = 0; - - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - if ( isAccessibleChildSelected( i ) ) - ++nRet; - } - - return nRet; -} - -// ----------------------------------------------------------------------------- - -Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) - { - if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = getAccessibleChild( i ); - break; - } - } - - return xChild; -} - -// ----------------------------------------------------------------------------- - -void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ - OExternalLockGuard aGuard( this ); - - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - if ( m_pDialogWindow ) - { - DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj; - if ( pDlgEdObj ) - { - SdrView* pSdrView = m_pDialogWindow->GetView(); - if ( pSdrView ) - { - SdrPageView* pPgView = pSdrView->GetSdrPageView(); - if ( pPgView ) - pSdrView->MarkObj( pDlgEdObj, pPgView, sal_True ); - } - } - } -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx deleted file mode 100644 index 96f00abba..000000000 --- a/basctl/source/basicide/basdoc.cxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include -#include - -#define GLOBALOVERFLOW2 - -#include -#include -#include - -#include - -#include - -#define BasicDocShell -#include - -#include "basicmod.hxx" -#include "unomodel.hxx" - -TYPEINIT1(BasicDocShell, SfxObjectShell); -DBG_NAME(BasicDocShell); - -SFX_IMPL_OBJECTFACTORY( BasicDocShell, SvGlobalName(), SFXOBJECTSHELL_STD_NORMAL, "sbasic" ) - -SFX_IMPL_INTERFACE( BasicDocShell, SfxObjectShell, IDEResId( 0 ) ) -{ - SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR ) ); -} - -BasicDocShell::BasicDocShell() - :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) -{ - pPrinter = 0; - SetPool( &SFX_APP()->GetPool() ); - SetBaseModel( new SIDEModel(this) ); -} - -BasicDocShell::~BasicDocShell() -{ - delete pPrinter; -} - -SfxPrinter* BasicDocShell::GetPrinter( sal_Bool bCreate ) -{ - if ( !pPrinter && bCreate ) - pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) ); - - return pPrinter; -} - -void BasicDocShell::SetPrinter( SfxPrinter* pPr ) -{ - if ( pPr != pPrinter ) - { - delete pPrinter; - pPrinter = pPr; - } -} - -void BasicDocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const -{ - (void)bTemplate; - DBG_ASSERT( bTemplate == sal_False, "No template for Basic" ); -} - -void BasicDocShell::Draw( OutputDevice *, const JobSetup &, sal_uInt16 ) -{} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx deleted file mode 100644 index 843e2e41c..000000000 --- a/basctl/source/basicide/basdoc.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASDOC_HXX -#define _BASDOC_HXX - -#include -#include -#include - -class SfxPrinter; - -class BasicDocShell: public SfxObjectShell -{ - SfxPrinter* pPrinter; - -protected: - virtual void Draw( OutputDevice *, const JobSetup & rSetup, - sal_uInt16 nAspect = ASPECT_CONTENT ); - virtual void FillClass( SvGlobalName * pClassName, - sal_uInt32 * pFormat, - String * pAppName, - String * pFullTypeName, - String * pShortTypeName, - sal_Int32 nVersion, - sal_Bool bTemplate = sal_False ) const; - -public: - TYPEINFO(); - - using SotObject::GetInterface; - SFX_DECL_OBJECTFACTORY(); - SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_DOCSH ) - BasicDocShell(); - ~BasicDocShell(); - - SfxPrinter* GetPrinter( sal_Bool bCreate ); - void SetPrinter( SfxPrinter* pPrinter ); -}; - -#endif // _BASDOC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx deleted file mode 100644 index e73671b25..000000000 --- a/basctl/source/basicide/basicbox.cxx +++ /dev/null @@ -1,546 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - - -#include -#include -#include - -#include -#include -#include -#include -#include "bastype2.hxx" -#include "basdoc.hxx" - -#include "localizationmgr.hxx" -#include "managelang.hxx" -#include "dlgresid.hrc" -#include - -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - -SFX_IMPL_TOOLBOX_CONTROL( LibBoxControl, SfxStringItem ); - -LibBoxControl::LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - : SfxToolBoxControl( nSlotId, nId, rTbx ) -{ -} - - - -LibBoxControl::~LibBoxControl() -{ -} - - - -void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) -{ - BasicLibBox* pBox = (BasicLibBox*) GetToolBox().GetItemWindow( GetId() ); - - DBG_ASSERT( pBox, "Box not found" ); - if ( !pBox ) - return; - - if ( eState != SFX_ITEM_AVAILABLE ) - pBox->Disable(); - else - { - pBox->Enable(); - - if ( pState->ISA(SfxStringItem) ) - pBox->Update( (const SfxStringItem*)pState ); - else - pBox->Update( NULL ); - } -} - - - -Window* LibBoxControl::CreateItemWindow( Window *pParent ) -{ - return new BasicLibBox( pParent, m_xFrame ); -} - -//============================================================================= -//= DocListenerBox -//============================================================================= - -DocListenerBox::DocListenerBox( Window* pParent ) - :ListBox( pParent, WinBits( WB_BORDER | WB_DROPDOWN ) ) - ,m_aNotifier( *this ) -{ -} - -DocListenerBox::~DocListenerBox() -{ - m_aNotifier.dispose(); -} - -void DocListenerBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) -{ - FillBox(); -} - -void DocListenerBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) -{ - FillBox(); -} - -void DocListenerBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void DocListenerBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void DocListenerBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void DocListenerBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) -{ - FillBox(); -} - -void DocListenerBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ ) -{ - FillBox(); -} - -void DocListenerBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void DocListenerBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -//============================================================================= -//= BasicLibBox -//============================================================================= -BasicLibBox::BasicLibBox( Window* pParent, const uno::Reference< frame::XFrame >& rFrame ) : - DocListenerBox( pParent ), - m_xFrame( rFrame ) -{ - FillBox(); - bIgnoreSelect = sal_True; // Select von 0 noch nicht weiterleiten - bFillBox = sal_True; - SelectEntryPos( 0 ); - aCurText = GetEntry( 0 ); - SetSizePixel( Size( 250, 200 ) ); - bIgnoreSelect = sal_False; -} - - - -BasicLibBox::~BasicLibBox() -{ - ClearBox(); -} - -void BasicLibBox::Update( const SfxStringItem* pItem ) -{ - // Immer auf dem laufenden sein... -// if ( !pItem || !pItem->GetValue().Len() ) - FillBox(); - - if ( pItem ) - { - aCurText = pItem->GetValue(); - if ( aCurText.Len() == 0 ) - aCurText = String( IDEResId( RID_STR_ALL ) ); - } - - if ( GetSelectEntry() != aCurText ) - SelectEntry( aCurText ); -} - -void BasicLibBox::ReleaseFocus() -{ - SfxViewShell* pCurSh = SfxViewShell::Current(); - DBG_ASSERT( pCurSh, "Current ViewShell not found!" ); - - if ( pCurSh ) - { - Window* pShellWin = pCurSh->GetWindow(); - if ( !pShellWin ) // sonst werde ich ihn nicht los - pShellWin = Application::GetDefDialogParent(); - - pShellWin->GrabFocus(); - } -} - -void BasicLibBox::FillBox() -{ - SetUpdateMode( sal_False ); - bIgnoreSelect = sal_True; - - aCurText = GetSelectEntry(); - - SelectEntryPos( 0 ); - ClearBox(); - - // create list box entries - sal_uInt16 nPos = InsertEntry( String( IDEResId( RID_STR_ALL ) ), LISTBOX_APPEND ); - SetEntryData( nPos, new BasicLibEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_UNKNOWN, String() ) ); - InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); - InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); - - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) ); - for ( ScriptDocuments::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - InsertEntries( *doc, LIBRARY_LOCATION_DOCUMENT ); - } - - SetUpdateMode( sal_True ); - - SelectEntry( aCurText ); - if ( !GetSelectEntryCount() ) - { - SelectEntryPos( GetEntryCount() ); // gibst es nicht => leer? - aCurText = GetSelectEntry(); - } - bIgnoreSelect = sal_False; -} - -void BasicLibBox::InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - // get a sorted list of library names - Sequence< ::rtl::OUString > aLibNames = rDocument.getLibraryNames(); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; ++i ) - { - String aLibName = pLibNames[ i ]; - if ( eLocation == rDocument.getLibraryLocation( aLibName ) ) - { - String aName( rDocument.getTitle( eLocation ) ); - String aEntryText( CreateMgrAndLibStr( aName, aLibName ) ); - sal_uInt16 nPos = InsertEntry( aEntryText, LISTBOX_APPEND ); - SetEntryData( nPos, new BasicLibEntry( rDocument, eLocation, aLibName ) ); - } - } -} - -long BasicLibBox::PreNotify( NotifyEvent& rNEvt ) -{ - long nDone = 0; - if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - KeyEvent aKeyEvt = *rNEvt.GetKeyEvent(); - sal_uInt16 nKeyCode = aKeyEvt.GetKeyCode().GetCode(); - switch( nKeyCode ) - { - case KEY_RETURN: - { - NotifyIDE(); - nDone = 1; - } - break; - - case KEY_ESCAPE: - { - SelectEntry( aCurText ); - ReleaseFocus(); - nDone = 1; - } - break; - } - } - else if( rNEvt.GetType() == EVENT_GETFOCUS ) - { - if ( bFillBox ) - { - FillBox(); - bFillBox = sal_False; - } - } - else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) - { - if ( !HasChildPathFocus( sal_True ) ) - { - bIgnoreSelect = sal_True; - bFillBox = sal_True; - } - } - - return nDone ? nDone : ListBox::PreNotify( rNEvt ); -} - -void BasicLibBox::Select() -{ - if ( !IsTravelSelect() ) - { - if ( !bIgnoreSelect ) - NotifyIDE(); - else - SelectEntry( aCurText ); // Seit 306... (Select nach Escape) - } -} - -void BasicLibBox::NotifyIDE() -{ - sal_uInt16 nSelPos = GetSelectEntryPos(); - BasicLibEntry* pEntry = (BasicLibEntry*)GetEntryData( nSelPos ); - if ( pEntry ) - { - ScriptDocument aDocument( pEntry->GetDocument() ); - SfxUsrAnyItem aDocumentItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, uno::makeAny( aDocument.getDocumentOrNull() ) ); - String aLibName = pEntry->GetLibName(); - SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, - SFX_CALLMODE_SYNCHRON, &aDocumentItem, &aLibNameItem, 0L ); - } - } - ReleaseFocus(); -} - -void BasicLibBox::ClearBox() -{ - sal_uInt16 nCount = GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - BasicLibEntry* pEntry = (BasicLibEntry*)GetEntryData( i ); - delete pEntry; - } - ListBox::Clear(); -} - -// class LanguageBoxControl ---------------------------------------------- - -SFX_IMPL_TOOLBOX_CONTROL( LanguageBoxControl, SfxStringItem ); - -LanguageBoxControl::LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - : SfxToolBoxControl( nSlotId, nId, rTbx ) -{ -} - -LanguageBoxControl::~LanguageBoxControl() -{ -} - -void LanguageBoxControl::StateChanged( sal_uInt16 _nID, SfxItemState _eState, const SfxPoolItem* _pItem ) -{ - (void)_nID; - - BasicLanguageBox* pBox = (BasicLanguageBox*)( GetToolBox().GetItemWindow( GetId() ) ); - - if ( pBox ) - { - if ( _eState != SFX_ITEM_AVAILABLE ) - pBox->Disable(); - else - { - pBox->Enable(); - if ( _pItem->ISA(SfxStringItem) ) - pBox->Update( (const SfxStringItem*)_pItem ); - else - pBox->Update( NULL ); - } - } -} - -Window* LanguageBoxControl::CreateItemWindow( Window *pParent ) -{ - return new BasicLanguageBox( pParent ); -} - -// class BasicLanguageBox ------------------------------------------------ - -BasicLanguageBox::BasicLanguageBox( Window* pParent ) : - - DocListenerBox( pParent ), - - m_sNotLocalizedStr( IDEResId( RID_STR_TRANSLATION_NOTLOCALIZED ) ), - m_sDefaultLanguageStr( IDEResId( RID_STR_TRANSLATION_DEFAULT ) ), - - m_bIgnoreSelect( false ) - -{ - SetSizePixel( Size( 210, 200 ) ); - - FillBox(); -} - -BasicLanguageBox::~BasicLanguageBox() -{ - ClearBox(); -} - -void BasicLanguageBox::FillBox() -{ - SetUpdateMode( sal_False ); - m_bIgnoreSelect = true; - m_sCurrentText = GetSelectEntry(); - ClearBox(); - - LocalizationMgr* pCurMgr = IDE_DLL()->GetShell()->GetCurLocalizationMgr(); - if ( pCurMgr->isLibraryLocalized() ) - { - Enable(); - SvtLanguageTable aLangTable; - Locale aDefaultLocale = pCurMgr->getStringResourceManager()->getDefaultLocale(); - Locale aCurrentLocale = pCurMgr->getStringResourceManager()->getCurrentLocale(); - Sequence< Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 i, nCount = aLocaleSeq.getLength(); - sal_uInt16 nSelPos = LISTBOX_ENTRY_NOTFOUND; - for ( i = 0; i < nCount; ++i ) - { - bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] ); - bool bIsCurrent = localesAreEqual( aCurrentLocale, pLocale[i] ); - LanguageType eLangType = SvxLocaleToLanguage( pLocale[i] ); - String sLanguage = aLangTable.GetString( eLangType ); - if ( bIsDefault ) - { - sLanguage += ' '; - sLanguage += m_sDefaultLanguageStr; - } - sal_uInt16 nPos = InsertEntry( sLanguage ); - SetEntryData( nPos, new LanguageEntry( sLanguage, pLocale[i], bIsDefault ) ); - - if ( bIsCurrent ) - nSelPos = nPos; - } - - if ( nSelPos != LISTBOX_ENTRY_NOTFOUND ) - { - SelectEntryPos( nSelPos ); - m_sCurrentText = GetSelectEntry(); - } - } - else - { - InsertEntry( m_sNotLocalizedStr ); - SelectEntryPos(0); - Disable(); - } - - SetUpdateMode( sal_True ); - m_bIgnoreSelect = false; -} - -void BasicLanguageBox::ClearBox() -{ - sal_uInt16 nCount = GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - LanguageEntry* pEntry = (LanguageEntry*)GetEntryData(i); - delete pEntry; - } - ListBox::Clear(); -} - -void BasicLanguageBox::SetLanguage() -{ - LanguageEntry* pEntry = (LanguageEntry*)GetEntryData( GetSelectEntryPos() ); - if ( pEntry ) - IDE_DLL()->GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale( pEntry->m_aLocale ); -} - -void BasicLanguageBox::Select() -{ - if ( !m_bIgnoreSelect ) - SetLanguage(); - else - SelectEntry( m_sCurrentText ); // Select after Escape -} - -long BasicLanguageBox::PreNotify( NotifyEvent& rNEvt ) -{ - long nDone = 0; - if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - sal_uInt16 nKeyCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); - switch( nKeyCode ) - { - case KEY_RETURN: - { - SetLanguage(); - nDone = 1; - } - break; - - case KEY_ESCAPE: - { - SelectEntry( m_sCurrentText ); - nDone = 1; - } - break; - } - } - else if( rNEvt.GetType() == EVENT_GETFOCUS ) - { - } - else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) - { - } - - return nDone ? nDone : ListBox::PreNotify( rNEvt ); -} - -void BasicLanguageBox::Update( const SfxStringItem* pItem ) -{ - FillBox(); - - if ( pItem && pItem->GetValue().Len() > 0 ) - { - m_sCurrentText = pItem->GetValue(); - if ( GetSelectEntry() != m_sCurrentText ) - SelectEntry( m_sCurrentText ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx deleted file mode 100644 index 1e27c1c19..000000000 --- a/basctl/source/basicide/basicbox.hxx +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// -#ifndef _BASICBOX_HXX -#define _BASICBOX_HXX - -#include "doceventnotifier.hxx" -#include -#include -#include -#include - - -class LibBoxControl: public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - - LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - ~LibBoxControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ); - virtual Window* CreateItemWindow( Window *pParent ); -}; - -/** base class for list boxes which need to update their content according to the list - of open documents -*/ -class DocListenerBox :public ListBox - ,public ::basctl::DocumentEventListener -{ -protected: - DocListenerBox( Window* pParent ); - ~DocListenerBox(); - -protected: - virtual void FillBox() = 0; - -private: - // DocumentEventListener - virtual void onDocumentCreated( const ScriptDocument& _rDocument ); - virtual void onDocumentOpened( const ScriptDocument& _rDocument ); - virtual void onDocumentSave( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ); - virtual void onDocumentClosed( const ScriptDocument& _rDocument ); - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ); - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); - -private: - ::basctl::DocumentEventNotifier m_aNotifier; -}; - -// - -class BasicLibBox : public DocListenerBox -{ -private: - String aCurText; - sal_Bool bIgnoreSelect; - sal_Bool bFillBox; - com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - - void ReleaseFocus(); - void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ); - - void ClearBox(); - void NotifyIDE(); - - // DocListenerBox - virtual void FillBox(); - -protected: - virtual void Select(); - virtual long PreNotify( NotifyEvent& rNEvt ); - -public: - BasicLibBox( Window* pParent, - const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ~BasicLibBox(); - - using Window::Update; - void Update( const SfxStringItem* pItem ); -}; - -class LanguageBoxControl: public SfxToolBoxControl -{ -public: - SFX_DECL_TOOLBOX_CONTROL(); - - LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - ~LanguageBoxControl(); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); - virtual Window* CreateItemWindow( Window *pParent ); -}; - -class BasicLanguageBox : public DocListenerBox -{ -private: - String m_sNotLocalizedStr; - String m_sDefaultLanguageStr; - String m_sCurrentText; - - bool m_bIgnoreSelect; - - void ClearBox(); - void SetLanguage(); - - // DocListenerBox - virtual void FillBox(); - -protected: - virtual void Select(); - virtual long PreNotify( NotifyEvent& rNEvt ); - -public: - BasicLanguageBox( Window* pParent ); - ~BasicLanguageBox(); - - using Window::Update; - void Update( const SfxStringItem* pItem ); -}; - -#endif // _BASICBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicmod.hxx b/basctl/source/basicide/basicmod.hxx deleted file mode 100644 index 2c244443f..000000000 --- a/basctl/source/basicide/basicmod.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef BASICMOD_HXX -#define BASICMOD_HXX - -#include -#include - -class BasicIDEModule : public SfxModule -{ -public: - BasicIDEModule( ResMgr *pMgr, SfxObjectFactory *pObjFact) : - SfxModule( pMgr, sal_False, pObjFact, NULL ) - {} -}; - - -#define BASIC_MOD() ( *(BasicIDEModule**) GetAppData(SHL_IDE) ) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicprint.src b/basctl/source/basicide/basicprint.src deleted file mode 100644 index caa5241c5..000000000 --- a/basctl/source/basicide/basicprint.src +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -StringArray RID_PRINTDLG_STRLIST -{ - ItemList [en-US] = - { - < "Print range"; >; - < "All ~Pages"; >; - < "Pa~ges"; >; - }; -}; diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx deleted file mode 100644 index b157a7254..000000000 --- a/basctl/source/basicide/basicrenderable.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_basctl.hxx" - -#include "basicrenderable.hxx" -#include "bastypes.hxx" -#include "basidesh.hrc" - -#include "com/sun/star/awt/XDevice.hpp" -#include "toolkit/awt/vclxdevice.hxx" -#include "vcl/print.hxx" -#include "tools/multisel.hxx" -#include "tools/resary.hxx" - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace basicide; - -BasicRenderable::BasicRenderable( IDEBaseWindow* pWin ) -: cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >( maMutex ) -, mpWindow( pWin ) -{ - ResStringArray aStrings( IDEResId( RID_PRINTDLG_STRLIST ) ); - DBG_ASSERT( aStrings.Count() >= 3, "resource incomplete" ); - if( aStrings.Count() < 3 ) // bad resource ? - return; - - m_aUIProperties.realloc( 3 ); - - // create Subgroup for print range - vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; - aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); - aPrintRangeOpt.mbInternalOnly = sal_True; - m_aUIProperties[0].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 0 ) ), - rtl::OUString(), - aPrintRangeOpt - ); - - // create a choice for the range to print - rtl::OUString aPrintContentName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ); - Sequence< rtl::OUString > aChoices( 2 ); - Sequence< rtl::OUString > aHelpIds( 2 ); - aChoices[0] = aStrings.GetString( 1 ); - aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) ); - aChoices[1] = aStrings.GetString( 2 ); - aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) ); - m_aUIProperties[1].Value = getChoiceControlOpt( rtl::OUString(), - aHelpIds, - aPrintContentName, - aChoices, - 0 ); - - // create a an Edit dependent on "Pages" selected - vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintContentName, 1, sal_True ); - m_aUIProperties[2].Value = getEditControlOpt( rtl::OUString(), - rtl::OUString(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), - rtl::OUString(), - aPageRangeOpt - ); -} - -BasicRenderable::~BasicRenderable() -{ -} - -Printer* BasicRenderable::getPrinter() -{ - Printer* pPrinter = NULL; - Any aValue( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); - Reference xRenderDevice; - - if( aValue >>= xRenderDevice ) - { - VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice); - OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; - pPrinter = dynamic_cast(pOut); - } - return pPrinter; -} - -sal_Int32 SAL_CALL BasicRenderable::getRendererCount ( - const Any&, const Sequence& i_xOptions - ) throw (lang::IllegalArgumentException, RuntimeException) -{ - processProperties( i_xOptions ); - - sal_Int32 nCount = 0; - if( mpWindow ) - { - Printer* pPrinter = getPrinter(); - if( pPrinter ) - { - nCount = mpWindow->countPages( pPrinter ); - sal_Int64 nContent = getIntValue( "PrintContent", -1 ); - if( nContent == 1 ) - { - rtl::OUString aPageRange( getStringValue( "PageRange" ) ); - MultiSelection aSel( aPageRange ); - long nSelCount = aSel.GetSelectCount(); - if( nSelCount >= 0 && nSelCount < nCount ) - nCount = nSelCount; - } - } - else - throw lang::IllegalArgumentException(); - } - - return nCount; -} - -Sequence SAL_CALL BasicRenderable::getRenderer ( - sal_Int32, const Any&, const Sequence& i_xOptions - ) throw (lang::IllegalArgumentException, RuntimeException) -{ - processProperties( i_xOptions ); - - Sequence< beans::PropertyValue > aVals; - // insert page size here - Printer* pPrinter = getPrinter(); - // no renderdevice is legal; the first call is to get our print ui options - if( pPrinter ) - { - Size aPageSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - - aVals.realloc( 1 ); - aVals[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); - awt::Size aSize; - aSize.Width = aPageSize.Width(); - aSize.Height = aPageSize.Height(); - aVals[0].Value <<= aSize; - } - - appendPrintUIOptions( aVals ); - - return aVals; -} - -void SAL_CALL BasicRenderable::render ( - sal_Int32 nRenderer, const Any&, - const Sequence& i_xOptions - ) throw (lang::IllegalArgumentException, RuntimeException) -{ - processProperties( i_xOptions ); - - if( mpWindow ) - { - Printer* pPrinter = getPrinter(); - if( pPrinter ) - { - sal_Int64 nContent = getIntValue( "PrintContent", -1 ); - if( nContent == 1 ) - { - rtl::OUString aPageRange( getStringValue( "PageRange" ) ); - MultiSelection aSel( aPageRange ); - long nSelect = aSel.FirstSelected(); - while( nSelect != long(SFX_ENDOFSELECTION) && nRenderer-- ) - nSelect = aSel.NextSelected(); - if( nSelect != long(SFX_ENDOFSELECTION) ) - mpWindow->printPage( sal_Int32(nSelect-1), pPrinter ); - } - else - mpWindow->printPage( nRenderer, pPrinter ); - } - else - throw lang::IllegalArgumentException(); - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx deleted file mode 100644 index baa5eba87..000000000 --- a/basctl/source/basicide/basicrenderable.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASICRENDERABLE_HXX -#define _BASICRENDERABLE_HXX - -#include "com/sun/star/view/XRenderable.hpp" -#include "cppuhelper/compbase1.hxx" - -#include "vcl/print.hxx" - -class IDEBaseWindow; - -namespace basicide -{ -class BasicRenderable : - public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >, - public vcl::PrinterOptionsHelper -{ - IDEBaseWindow* mpWindow; - osl::Mutex maMutex; - - Printer* getPrinter(); -public: - BasicRenderable( IDEBaseWindow* pWin ); - virtual ~BasicRenderable(); - - // XRenderable - virtual sal_Int32 SAL_CALL getRendererCount ( - const com::sun::star::uno::Any& aSelection, - const com::sun::star::uno::Sequence& xOptions) - throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException); - - virtual com::sun::star::uno::Sequence SAL_CALL getRenderer ( - sal_Int32 nRenderer, - const com::sun::star::uno::Any& rSelection, - const com::sun::star::uno::Sequence& rxOptions) - throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL render ( - sal_Int32 nRenderer, - const com::sun::star::uno::Any& rSelection, - const com::sun::star::uno::Sequence& rxOptions) - throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException); - -}; - -} // namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx deleted file mode 100644 index 2ee4e33d7..000000000 --- a/basctl/source/basicide/baside2.cxx +++ /dev/null @@ -1,1739 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -#define SPLIT_MARGIN 5 -#define SPLIT_HEIGHT 2 - -#define LMARGPRN 1700 -#define RMARGPRN 900 -#define TMARGPRN 2000 -#define BMARGPRN 1000 -#define BORDERPRN 300 - -#define APPWAIT_START 100 - -#define VALIDWINDOW 0x1234 - -#if defined(OW) || defined(MTF) -#define FILTERMASK_ALL "*" -#else -#define FILTERMASK_ALL "*.*" -#endif - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ui::dialogs; -using namespace utl; -using namespace comphelper; - - -DBG_NAME( ModulWindow ) - -TYPEINIT1( ModulWindow , IDEBaseWindow ); - -void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const String& rTitle, bool bOutput ) -{ - short nLeftMargin = LMARGPRN; - Size aSz = pPrinter->GetOutputSize(); - short nBorder = BORDERPRN; - - const Color aOldLineColor( pPrinter->GetLineColor() ); - const Color aOldFillColor( pPrinter->GetFillColor() ); - const Font aOldFont( pPrinter->GetFont() ); - - pPrinter->SetLineColor( Color( COL_BLACK ) ); - pPrinter->SetFillColor(); - - Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetAlign( ALIGN_BOTTOM ); - pPrinter->SetFont( aFont ); - - long nFontHeight = pPrinter->GetTextHeight(); - - // 1.Border => Strich, 2+3 Border = Freiraum. - long nYTop = TMARGPRN-3*nBorder-nFontHeight; - - long nXLeft = nLeftMargin-nBorder; - long nXRight = aSz.Width()-RMARGPRN+nBorder; - - if( bOutput ) - pPrinter->DrawRect( Rectangle( - Point( nXLeft, nYTop ), - Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) ); - - - long nY = TMARGPRN-2*nBorder; - Point aPos( nLeftMargin, nY ); - if( bOutput ) - pPrinter->DrawText( aPos, rTitle ); - if ( nPages != 1 ) - { - aFont.SetWeight( WEIGHT_NORMAL ); - pPrinter->SetFont( aFont ); - String aPageStr( RTL_CONSTASCII_USTRINGPARAM( " [" ) ); - aPageStr += String( IDEResId( RID_STR_PAGE ) ); - aPageStr += ' '; - aPageStr += String::CreateFromInt32( nCurPage ); - aPageStr += ']'; - aPos.X() += pPrinter->GetTextWidth( rTitle ); - if( bOutput ) - pPrinter->DrawText( aPos, aPageStr ); - } - - - nY = TMARGPRN-nBorder; - - if( bOutput ) - pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); - - pPrinter->SetFont( aOldFont ); - pPrinter->SetFillColor( aOldFillColor ); - pPrinter->SetLineColor( aOldLineColor ); -} - -void lcl_ConvertTabsToSpaces( String& rLine ) -{ - if ( rLine.Len() ) - { - sal_uInt16 nPos = 0; - sal_uInt16 nMax = rLine.Len(); - while ( nPos < nMax ) - { - if ( rLine.GetChar( nPos ) == '\t' ) - { - // Nicht 4 Blanks, sondern an 4er TabPos: - String aBlanker; - aBlanker.Fill( ( 4 - ( nPos % 4 ) ), ' ' ); - rLine.Erase( nPos, 1 ); - rLine.Insert( aBlanker, nPos ); - nMax = rLine.Len(); - } - nPos++; // Nicht optimal, falls Tab, aber auch nicht verkehrt... - } - } -} - - -ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, String aLibName, - String aName, ::rtl::OUString& aModule ) - :IDEBaseWindow( pParent, rDocument, aLibName, aName ) - ,aXEditorWindow( this ) - ,m_aModule( aModule ) -{ - DBG_CTOR( ModulWindow, 0 ); - nValid = VALIDWINDOW; - pLayout = pParent; - aXEditorWindow.Show(); - - SetBackground(); -} - -SbModuleRef ModulWindow::XModule() -{ - // ModuleWindows can now be created as a result of the - // modules getting created via the api. This is a result of an - // elementInserted event from the BasicLibrary container. - // However the SbModule is also created from a different listener to - // the same event ( in basmgr ) Therefore it is possible when we look - // for xModule it may not yet be available, here we keep tring to access - // the module until such time as it exists - - if ( !xModule.Is() ) - { - BasicManager* pBasMgr = GetDocument().getBasicManager(); - if ( pBasMgr ) - { - StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() ); - if ( pBasic ) - { - xBasic = pBasic; - xModule = (SbModule*)pBasic->FindModule( GetName() ); - } - } - } - return xModule; -} - -ModulWindow::~ModulWindow() -{ - DBG_DTOR( ModulWindow, 0 ); - nValid = 0; - - StarBASIC::Stop(); -} - - -void ModulWindow::GetFocus() -{ - if ( nValid != VALIDWINDOW ) - return; - DBG_CHKTHIS( ModulWindow, 0 ); - aXEditorWindow.GetEdtWindow().GrabFocus(); - // Basisklasse nicht rufen, weil Focus jetzt woanders... -} - -void ModulWindow::DoInit() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - // Wird beim Umschalten der Fenster gerufen... - if ( GetVScrollBar() ) - GetVScrollBar()->Hide(); - GetHScrollBar()->Show(); - GetEditorWindow().InitScrollBars(); -} - - -void ModulWindow::Paint( const Rectangle& ) -{ -} - -void ModulWindow::Resize() -{ - aXEditorWindow.SetPosSizePixel( Point( 0, 0 ), - Size( GetOutputSizePixel() ) ); -} - - -// "Import" von baside4.cxx -void CreateEngineForBasic( StarBASIC* pBasic ); - -void ModulWindow::CheckCompileBasic() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - if ( XModule().Is() ) - { - // Zur Laufzeit wird niemals compiliert! - sal_Bool bRunning = StarBASIC::IsRunning(); - sal_Bool bModified = ( !xModule->IsCompiled() || - ( GetEditEngine() && GetEditEngine()->IsModified() ) ); - - if ( !bRunning && bModified ) - { - sal_Bool bDone = sal_False; - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); - - if( bModified ) - { - AssertValidEditEngine(); - GetEditorWindow().SetSourceInBasic( sal_False ); - } - - sal_Bool bWasModified = GetBasic()->IsModified(); - - bDone = GetBasic()->Compile( xModule ); - if ( !bWasModified ) - GetBasic()->SetModified( sal_False ); - - if ( bDone ) - { - GetBreakPoints().SetBreakPointsInBasic( xModule ); - } - - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); - - aStatus.bError = !bDone; - aStatus.bIsRunning = sal_False; - } - } -} - -sal_Bool ModulWindow::BasicExecute() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - // #116444# check security settings before macro execution - ScriptDocument aDocument( GetDocument() ); - if ( aDocument.isDocument() ) - { - if ( !aDocument.allowMacros() ) - { - WarningBox( this, WB_OK, String( IDEResId( RID_STR_CANNOTRUNMACRO ) ) ).Execute(); - return sal_False; - } - } - - CheckCompileBasic(); - - if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError ) - { - if ( GetBreakPoints().size() ) - aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK; - - if ( !aStatus.bIsRunning ) - { - DBG_ASSERT( xModule.Is(), "Kein Modul!" ); - AddStatus( BASWIN_RUNNINGBASIC ); - sal_uInt16 nStart, nEnd, nCurMethodStart = 0; - TextSelection aSel = GetEditView()->GetSelection(); - // Init cursor to top - nCurMethodStart = ( aSel.GetStart().GetPara() + 1 ); - SbMethod* pMethod = 0; - // erstes Macro, sonst blind "Main" (ExtSearch?) - for ( sal_uInt16 nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ ) - { - SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro ); - DBG_ASSERT( pM, "Method?" ); - pM->GetLineRange( nStart, nEnd ); - if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd ) - { - // matched a method to the cursor position - pMethod = pM; - break; - } - } - if ( !pMethod ) - { - // If not in a method then prompt the user - return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), sal_False, rtl::OUString() ).getLength() > 0 ) ? sal_True : sal_False; - } - if ( pMethod ) - { - pMethod->SetDebugFlags( aStatus.nBasicFlags ); - BasicDLL::SetDebugMode( sal_True ); - BasicIDE::RunMethod( pMethod ); - BasicDLL::SetDebugMode( sal_False ); - // Falls waehrend Interactive=sal_False abgebrochen - BasicDLL::EnableBreak( sal_True ); - } - ClearStatus( BASWIN_RUNNINGBASIC ); - } - else - aStatus.bIsRunning = sal_False; // Abbruch von Reschedule() - } - - sal_Bool bDone = !aStatus.bError; - - return bDone; -} - -sal_Bool ModulWindow::CompileBasic() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - CheckCompileBasic(); - - sal_Bool bIsCompiled = sal_False; - if ( XModule().Is() ) - bIsCompiled = xModule->IsCompiled(); - - return bIsCompiled; -} - -sal_Bool ModulWindow::BasicRun() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - aStatus.nBasicFlags = 0; - sal_Bool bDone = BasicExecute(); - return bDone; -} - -sal_Bool ModulWindow::BasicStepOver() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - aStatus.nBasicFlags = SbDEBUG_STEPINTO | SbDEBUG_STEPOVER; - sal_Bool bDone = BasicExecute(); - return bDone; -} - - -sal_Bool ModulWindow::BasicStepInto() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - aStatus.nBasicFlags = SbDEBUG_STEPINTO; - sal_Bool bDone = BasicExecute(); - return bDone; -} - -sal_Bool ModulWindow::BasicStepOut() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - aStatus.nBasicFlags = SbDEBUG_STEPOUT; - sal_Bool bDone = BasicExecute(); - return bDone; -} - - - -void ModulWindow::BasicStop() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - GetBasic()->Stop(); - aStatus.bIsRunning = sal_False; -} - -sal_Bool ModulWindow::LoadBasic() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - sal_Bool bDone = sal_False; - - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - - if ( aCurPath.Len() ) - xFP->setDisplayDirectory ( aCurPath ); - - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) ); - xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); - xFltMgr->setCurrentFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) ); - - if( xFP->execute() == RET_OK ) - { - Sequence< ::rtl::OUString > aPaths = xFP->getFiles(); - aCurPath = aPaths[0]; - SfxMedium aMedium( aCurPath, STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE, sal_True ); - SvStream* pStream = aMedium.GetInStream(); - if ( pStream ) - { - AssertValidEditEngine(); - sal_uLong nLines = CalcLineCount( *pStream ); - // nLines*4: ReadText/Formatting/Highlighting/Formatting - GetEditorWindow().CreateProgress( String( IDEResId( RID_STR_GENERATESOURCE ) ), nLines*4 ); - GetEditEngine()->SetUpdateMode( sal_False ); - GetEditView()->Read( *pStream ); - GetEditEngine()->SetUpdateMode( sal_True ); - GetEditorWindow().Update(); // Es wurde bei UpdateMode = sal_True nur Invalidiert - GetEditorWindow().ForceSyntaxTimeout(); - GetEditorWindow().DestroyProgress(); - sal_uLong nError = aMedium.GetError(); - if ( nError ) - ErrorHandler::HandleError( nError ); - else - bDone = sal_True; - } - else - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTREAD ) ) ).Execute(); - } - return bDone; -} - - -sal_Bool ModulWindow::SaveBasicSource() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - sal_Bool bDone = sal_False; - - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - - Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); - xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False); - Any aValue; - aValue <<= (sal_Bool) sal_True; - xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue); - - if ( aCurPath.Len() ) - xFP->setDisplayDirectory ( aCurPath ); - - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) ); - xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); - xFltMgr->setCurrentFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) ); - - if( xFP->execute() == RET_OK ) - { - Sequence< ::rtl::OUString > aPaths = xFP->getFiles(); - aCurPath = aPaths[0]; - SfxMedium aMedium( aCurPath, STREAM_WRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC, sal_True, sal_False ); - SvStream* pStream = aMedium.GetOutStream(); - if ( pStream ) - { - EnterWait(); - AssertValidEditEngine(); - GetEditEngine()->Write( *pStream ); - aMedium.Commit(); - LeaveWait(); - sal_uLong nError = aMedium.GetError(); - if ( nError ) - ErrorHandler::HandleError( nError ); - else - bDone = sal_True; - } - else - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTWRITE) ) ).Execute(); - } - - return bDone; -} - -sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName ); - -sal_Bool ModulWindow::ImportDialog() -{ - const ScriptDocument& rDocument = GetDocument(); - String aLibName = GetLibName(); - sal_Bool bRet = implImportDialog( this, aCurPath, rDocument, aLibName ); - return bRet; -} - -sal_Bool ModulWindow::ToggleBreakPoint( sal_uLong nLine ) -{ - DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - - sal_Bool bNewBreakPoint = sal_False; - - if ( XModule().Is() ) - { - CheckCompileBasic(); - if ( aStatus.bError ) - { - Sound::Beep(); - return sal_False; - } - - BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nLine ); - if ( pBrk ) // entfernen - { - xModule->ClearBP( (sal_uInt16)nLine ); - delete GetBreakPoints().remove( pBrk ); - } - else // einen erzeugen - { - if ( xModule->SetBP( (sal_uInt16)nLine) ) - { - GetBreakPoints().InsertSorted( new BreakPoint( nLine ) ); - bNewBreakPoint = sal_True; - if ( StarBASIC::IsRunning() ) - { - for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ ) - { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod ); - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); - } - } - } - - if ( !bNewBreakPoint ) - Sound::Beep(); - } - } - - return bNewBreakPoint; -} - -void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk ) -{ - DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - - if ( XModule().Is() ) - { - CheckCompileBasic(); - - if ( rBrk.bEnabled ) - xModule->SetBP( (sal_uInt16)rBrk.nLine ); - else - xModule->ClearBP( (sal_uInt16)rBrk.nLine ); - } -} - - -sal_Bool ModulWindow::BasicToggleBreakPoint() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - AssertValidEditEngine(); - - TextSelection aSel = GetEditView()->GetSelection(); - aSel.GetStart().GetPara()++; // Basic-Zeilen beginnen bei 1! - aSel.GetEnd().GetPara()++; - - sal_Bool bNewBreakPoint = sal_False; - - for ( sal_uLong nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); nLine++ ) - { - if ( ToggleBreakPoint( nLine ) ) - bNewBreakPoint = sal_True; - } - - aXEditorWindow.GetBrkWindow().Invalidate(); - return bNewBreakPoint; -} - - -void ModulWindow::BasicToggleBreakPointEnabled() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - AssertValidEditEngine(); - - ExtTextView* pView = GetEditView(); - if ( pView ) - { - TextSelection aSel = pView->GetSelection(); - BreakPointList& rList = GetBreakPoints(); - - for ( sal_uLong nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine ) - { - BreakPoint* pBrk = rList.FindBreakPoint( nLine ); - if ( pBrk ) - { - pBrk->bEnabled = pBrk->bEnabled ? sal_False : sal_True; - UpdateBreakPoint( *pBrk ); - } - } - - GetBreakPointWindow().Invalidate(); - } -} - - -void ModulWindow::ManageBreakPoints() -{ - BreakPointWindow& rBrkWin = GetBreakPointWindow(); - BreakPointDialog aBrkDlg( &rBrkWin, GetBreakPoints() ); - aBrkDlg.Execute(); - rBrkWin.Invalidate(); -} - - -IMPL_LINK( ModulWindow, BasicErrorHdl, StarBASIC *, pBasic ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - GoOnTop(); - - // ReturnWert: BOOL - // FALSE: Abbrechen - // TRUE: Weiter.... - String aErrorText( pBasic->GetErrorText() ); - sal_uInt16 nErrorLine = pBasic->GetLine() - 1; - sal_uInt16 nErrCol1 = pBasic->GetCol1(); - sal_uInt16 nErrCol2 = pBasic->GetCol2(); - if ( nErrCol2 != 0xFFFF ) - nErrCol2++; - - AssertValidEditEngine(); - GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, nErrCol1 ), TextPaM( nErrorLine, nErrCol2 ) ) ); - - String aErrorTextPrefix; - if( pBasic->IsCompilerError() ) - { - aErrorTextPrefix = String( IDEResId( RID_STR_COMPILEERROR ) ); - } - else - { - aErrorTextPrefix = String( IDEResId( RID_STR_RUNTIMEERROR ) ); - aErrorTextPrefix += StarBASIC::GetVBErrorCode( pBasic->GetErrorCode() ); - aErrorTextPrefix += ' '; - pLayout->GetStackWindow().UpdateCalls(); - } - // Wenn anderes Basic, dan sollte die IDE versuchen, da richtige - // Modul anzuzeigen... - sal_Bool bMarkError = ( pBasic == GetBasic() ) ? sal_True : sal_False; - if ( bMarkError ) - aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine, sal_True ); - - // #i47002# - Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this ); - - ErrorHandler::HandleError( StarBASIC::GetErrorCode() ); - - // #i47002# - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( !pWindow ) - return sal_False; - - if ( bMarkError ) - aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER ); - return sal_False; -} - -long ModulWindow::BasicBreakHdl( StarBASIC* pBasic ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - // #i69280 Required in Window despite normal usage in next command! - (void)pBasic; - - // ReturnWert: sal_uInt16 => siehe SB-Debug-Flags - sal_uInt16 nErrorLine = pBasic->GetLine(); - - // Gibt es hier einen BreakPoint? - BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nErrorLine ); - if ( pBrk ) - { - pBrk->nHitCount++; - if ( pBrk->nHitCount < pBrk->nStopAfter && GetBasic()->IsBreak() ) - return aStatus.nBasicFlags; // weiterlaufen... - } - - nErrorLine--; // EditEngine begint bei 0, Basic bei 1 - // Alleine schon damit gescrollt wird... - AssertValidEditEngine(); - GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) ); - aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine ); - - pLayout->GetWatchWindow().UpdateWatches(); - pLayout->GetStackWindow().UpdateCalls(); - - aStatus.bIsInReschedule = sal_True; - aStatus.bIsRunning = sal_True; - - AddStatus( BASWIN_INRESCHEDULE ); - - BasicIDE::InvalidateDebuggerSlots(); - - while( aStatus.bIsRunning ) - Application::Yield(); - - aStatus.bIsInReschedule = sal_False; - aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER ); - - ClearStatus( BASWIN_INRESCHEDULE ); - - return aStatus.nBasicFlags; -} - -void ModulWindow::BasicAddWatch() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - String aWatchStr; - sal_Bool bInserted = sal_False; - AssertValidEditEngine(); - sal_Bool bAdd = sal_True; - if ( !GetEditView()->HasSelection() ) - { - TextPaM aWordStart; - String aWord = GetEditEngine()->GetWord( GetEditView()->GetSelection().GetEnd(), &aWordStart ); - if ( aWord.Len() ) - { - TextSelection aSel( aWordStart ); - sal_uInt16& rIndex = aSel.GetEnd().GetIndex(); - rIndex = rIndex + aWord.Len(); - GetEditView()->SetSelection( aSel ); - bAdd = sal_True; - } - } - if ( bAdd ) - { - TextSelection aSel = GetEditView()->GetSelection(); - if ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() ) - { - aWatchStr = GetEditView()->GetSelected(); - pLayout->GetWatchWindow().AddWatch( aWatchStr ); - pLayout->GetWatchWindow().UpdateWatches(); - bInserted = sal_True; - } - } - - if ( !bInserted ) - Sound::Beep(); -} - - - -void ModulWindow::BasicRemoveWatch() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - sal_Bool bRemoved = pLayout->GetWatchWindow().RemoveSelectedWatch(); - - if ( !bRemoved ) - Sound::Beep(); -} - - -void ModulWindow::EditMacro( const String& rMacroName ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - - if ( XModule().Is() ) - { - CheckCompileBasic(); - - if ( !aStatus.bError ) - { - sal_uInt16 nStart, nEnd; - SbMethod* pMethod = (SbMethod*)xModule->Find( rMacroName, SbxCLASS_METHOD ); - if ( pMethod ) - { - pMethod->GetLineRange( nStart, nEnd ); - if ( nStart ) - { - // Basic beginnt bei 1 - nStart--; - nEnd--; - } - TextSelection aSel( TextPaM( nStart, 0 ), TextPaM( nStart, 0 ) ); - AssertValidEditEngine(); - TextView * pView = GetEditView(); - // ggf. hinscrollen, so dass erste Zeile oben... - long nVisHeight = GetOutputSizePixel().Height(); - if ( (long)pView->GetTextEngine()->GetTextHeight() > nVisHeight ) - { - long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight; - long nOldStartY = pView->GetStartDocPos().Y(); - long nNewStartY = nStart * pView->GetTextEngine()->GetCharHeight(); - nNewStartY = Min( nNewStartY, nMaxY ); - pView->Scroll( 0, -(nNewStartY-nOldStartY) ); - pView->ShowCursor( sal_False, sal_True ); - GetEditVScrollBar().SetThumbPos( pView->GetStartDocPos().Y() ); - } - pView->SetSelection( aSel ); - pView->ShowCursor(); - pView->GetWindow()->GrabFocus(); - } - } - } -} - - -void ModulWindow::StoreData() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - // StoreData wird gerufen, wenn der BasicManager zerstoert oder - // dieses Fenster beendet wird. - // => Keine Unterbrechungen erwuenscht! - // Und bei SAVE, wenn AppBasic... - GetEditorWindow().SetSourceInBasic( sal_True ); -} - -sal_Bool ModulWindow::CanClose() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - return sal_True; -} - - -sal_Bool ModulWindow::AllowUndo() -{ - return GetEditorWindow().CanModify(); -} - - -void ModulWindow::UpdateData() -{ - DBG_CHKTHIS( ModulWindow, 0 ); - DBG_ASSERT( XModule().Is(), "Kein Modul!" ); - // UpdateData wird gerufen, wenn sich der Source von aussen - // geaendert hat. - // => Keine Unterbrechungen erwuenscht! - - if ( XModule().Is() ) - { - SetModule( xModule->GetSource32() ); - - if ( GetEditView() ) - { - TextSelection aSel = GetEditView()->GetSelection(); - setTextEngineText( GetEditEngine(), xModule->GetSource32() ); - GetEditView()->SetSelection( aSel ); - GetEditEngine()->SetModified( sal_False ); - BasicIDE::MarkDocumentModified( GetDocument() ); - } - } -} - -sal_Int32 ModulWindow::countPages( Printer* pPrinter ) -{ - return FormatAndPrint( pPrinter, -1 ); -} - -void ModulWindow::printPage( sal_Int32 nPage, Printer* pPrinter ) -{ - FormatAndPrint( pPrinter, nPage ); -} - -/* implementation note: this is totally inefficient for the XRenderable interface - usage since the whole "document" will be format for every page. Should this ever - become a problem we should - - format only once for every new printer - - keep an index list for each page which is the starting paragraph -*/ -sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - - AssertValidEditEngine(); - - MapMode eOldMapMode( pPrinter->GetMapMode() ); - Font aOldFont( pPrinter->GetFont() ); - - Font aFont( GetEditEngine()->GetFont() ); - aFont.SetAlign( ALIGN_BOTTOM ); - aFont.SetTransparent( sal_True ); - aFont.SetSize( Size( 0, 360 ) ); - pPrinter->SetFont( aFont ); - pPrinter->SetMapMode( MAP_100TH_MM ); - - String aTitle( CreateQualifiedName() ); - - sal_uInt16 nLineHeight = (sal_uInt16) pPrinter->GetTextHeight(); // etwas mehr. - sal_uInt16 nParaSpace = 10; - - Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (LMARGPRN+RMARGPRN); - aPaperSz.Height() -= (TMARGPRN+BMARGPRN); - - // nLinepPage stimmt nicht, wenn Zeilen umgebrochen werden muessen... - sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight); - sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( 'X' ) ); - sal_uLong nParas = GetEditEngine()->GetParagraphCount(); - - sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 ); - sal_uInt16 nCurPage = 1; - - // Header drucken... - lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 ); - Point aPos( LMARGPRN, TMARGPRN ); - for ( sal_uLong nPara = 0; nPara < nParas; nPara++ ) - { - String aLine( GetEditEngine()->GetText( nPara ) ); - lcl_ConvertTabsToSpaces( aLine ); - sal_uInt16 nLines = aLine.Len()/nCharspLine+1; - for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) - { - String aTmpLine( aLine, nLine*nCharspLine, nCharspLine ); - aPos.Y() += nLineHeight; - if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) ) - { - nCurPage++; - lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage ); - aPos = Point( LMARGPRN, TMARGPRN+nLineHeight ); - } - if( nCurPage-1 == nPrintPage ) - pPrinter->DrawText( aPos, aTmpLine ); - } - aPos.Y() += nParaSpace; - } - - pPrinter->SetFont( aOldFont ); - pPrinter->SetMapMode( eOldMapMode ); - - return sal_Int32(nCurPage); -} - - -void ModulWindow::ExecuteCommand( SfxRequest& rReq ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - AssertValidEditEngine(); - sal_uInt16 nSlot = rReq.GetSlot(); - switch ( nSlot ) - { - case SID_DELETE: - { - KeyEvent aFakeDelete( 0, KEY_DELETE ); - GetEditView()->KeyInput( aFakeDelete ); - break; - } - case SID_SELECTALL: - GetEditView()->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); - break; - case SID_BASICRUN: - { - BasicRun(); - } - break; - case SID_BASICCOMPILE: - { - CompileBasic(); - } - break; - case SID_BASICSTEPOVER: - { - BasicStepOver(); - } - break; - case SID_BASICSTEPINTO: - { - BasicStepInto(); - } - break; - case SID_BASICSTEPOUT: - { - BasicStepOut(); - } - break; - case SID_BASICLOAD: - { - LoadBasic(); - } - break; - case SID_BASICSAVEAS: - { - SaveBasicSource(); - } - break; - case SID_IMPORT_DIALOG: - { - ImportDialog(); - } - break; - case SID_BASICIDE_MATCHGROUP: - { - if ( !GetEditView()->MatchGroup() ) - Sound::Beep(); - } - break; - case SID_BASICIDE_TOGGLEBRKPNT: - { - BasicToggleBreakPoint(); - } - break; - case SID_BASICIDE_MANAGEBRKPNTS: - { - ManageBreakPoints(); - } - break; - case SID_BASICIDE_TOGGLEBRKPNTENABLED: - { - BasicToggleBreakPointEnabled(); - } - break; - case SID_BASICIDE_ADDWATCH: - { - BasicAddWatch(); - } - break; - case SID_BASICIDE_REMOVEWATCH: - { - BasicRemoveWatch(); - } - break; - case SID_CUT: - { - if ( !IsReadOnly() ) - { - GetEditView()->Cut(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - } - break; - case SID_COPY: - { - GetEditView()->Copy(); - } - break; - case SID_PASTE: - { - if ( !IsReadOnly() ) - { - GetEditView()->Paste(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - } - break; - case SID_BASICIDE_BRKPNTSCHANGED: - { - GetBreakPointWindow().Invalidate(); - } - break; - } -} - - - -void ModulWindow::GetState( SfxItemSet &rSet ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - SfxWhichIter aIter(rSet); - for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() ) - { - switch ( nWh ) - { - // allgemeine Items: - case SID_CUT: - { - if ( !GetEditView() || !GetEditView()->HasSelection() ) - rSet.DisableItem( nWh ); - - if ( IsReadOnly() ) - rSet.DisableItem( nWh ); - } - break; - case SID_COPY: - { - if ( !GetEditView() || !GetEditView()->HasSelection() ) - rSet.DisableItem( nWh ); - } - break; - case SID_PASTE: - { - if ( !IsPasteAllowed() ) - rSet.DisableItem( nWh ); - - if ( IsReadOnly() ) - rSet.DisableItem( nWh ); - } - break; - case SID_BASICIDE_STAT_POS: - { - TextView* pView = GetEditView(); - if ( pView ) - { - TextSelection aSel = pView->GetSelection(); - String aPos( IDEResId( RID_STR_LINE ) ); - aPos += ' '; - aPos += String::CreateFromInt32( aSel.GetEnd().GetPara()+1 ); - aPos += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - aPos += String( IDEResId( RID_STR_COLUMN ) ); - aPos += ' '; - aPos += String::CreateFromInt32( aSel.GetEnd().GetIndex()+1 ); - SfxStringItem aItem( SID_BASICIDE_STAT_POS, aPos ); - rSet.Put( aItem ); - } - } - break; - case SID_ATTR_INSERT: - { - TextView* pView = GetEditView(); - if ( pView ) - { - SfxBoolItem aItem( SID_ATTR_INSERT, pView->IsInsertMode() ); - rSet.Put( aItem ); - } - } - break; - } - } -} - - -void ModulWindow::DoScroll( ScrollBar* pCurScrollBar ) -{ - DBG_CHKTHIS( ModulWindow, 0 ); - if ( ( pCurScrollBar == GetHScrollBar() ) && GetEditView() ) - { - // Nicht mit dem Wert Scrollen, sondern lieber die Thumb-Pos fuer die - // VisArea verwenden: - long nDiff = GetEditView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos(); - GetEditView()->Scroll( nDiff, 0 ); - GetEditView()->ShowCursor( sal_False, sal_True ); - pCurScrollBar->SetThumbPos( GetEditView()->GetStartDocPos().X() ); - - } -} - - -sal_Bool ModulWindow::IsModified() -{ - return GetEditEngine() ? GetEditEngine()->IsModified() : sal_False; -} - - - -void ModulWindow::GoOnTop() -{ - IDE_DLL()->GetShell()->GetViewFrame()->ToTop(); -} - -String ModulWindow::GetSbModuleName() -{ - String aModuleName; - if ( XModule().Is() ) - aModuleName = xModule->GetName(); - return aModuleName; -} - - - -String ModulWindow::GetTitle() -{ - return GetSbModuleName(); -} - - - -void ModulWindow::FrameWindowMoved() -{ -} - - - -void ModulWindow::ShowCursor( sal_Bool bOn ) -{ - if ( GetEditEngine() ) - { - TextView* pView = GetEditEngine()->GetActiveView(); - if ( pView ) - { - if ( bOn ) - pView->ShowCursor(); - else - pView->HideCursor(); - } - } -} - - -Window* ModulWindow::GetLayoutWindow() -{ - return pLayout; -} - -void ModulWindow::AssertValidEditEngine() -{ - if ( !GetEditEngine() ) - GetEditorWindow().CreateEditEngine(); -} - -void ModulWindow::Deactivating() -{ - if ( GetEditView() ) - GetEditView()->EraseVirtualDevice(); -} - -sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, sal_Bool bFromStart ) -{ - // Mann koennte fuer das blinde Alle-Ersetzen auch auf - // Syntaxhighlighting/Formatierung verzichten... - AssertValidEditEngine(); - ExtTextView* pView = GetEditView(); - TextSelection aSel; - if ( bFromStart ) - { - aSel = pView->GetSelection(); - if ( !rSearchItem.GetBackward() ) - pView->SetSelection( TextSelection() ); - else - pView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); - } - - sal_Bool bForward = !rSearchItem.GetBackward(); - sal_uInt16 nFound = 0; - if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) || - ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) ) - { - nFound = pView->Search( rSearchItem.GetSearchOptions() , bForward ); - } - else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) || - ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) ) - { - if ( !IsReadOnly() ) - { - sal_Bool bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL; - nFound = pView->Replace( rSearchItem.GetSearchOptions() , bAll , bForward ); - } - } - - if ( bFromStart && !nFound ) - pView->SetSelection( aSel ); - - return nFound; -} - -::svl::IUndoManager* ModulWindow::GetUndoManager() -{ - if ( GetEditEngine() ) - return &GetEditEngine()->GetUndoManager(); - return NULL; -} - -sal_uInt16 ModulWindow::GetSearchOptions() -{ - sal_uInt16 nOptions = SEARCH_OPTIONS_SEARCH | - SEARCH_OPTIONS_WHOLE_WORDS | - SEARCH_OPTIONS_BACKWARDS | - SEARCH_OPTIONS_REG_EXP | - SEARCH_OPTIONS_EXACT | - SEARCH_OPTIONS_SELECTION | - SEARCH_OPTIONS_SIMILARITY; - - if ( !IsReadOnly() ) - { - nOptions |= SEARCH_OPTIONS_REPLACE; - nOptions |= SEARCH_OPTIONS_REPLACE_ALL; - } - - return nOptions; -} - -void ModulWindow::BasicStarted() -{ - if ( XModule().Is() ) - { - aStatus.bIsRunning = sal_True; - BreakPointList& rList = GetBreakPoints(); - if ( rList.size() ) - { - rList.ResetHitCount(); - rList.SetBreakPointsInBasic( xModule ); - for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ ) - { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod ); - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK ); - } - } - } -} - -void ModulWindow::BasicStopped() -{ - aStatus.bIsRunning = sal_False; - GetBreakPointWindow().SetMarkerPos( MARKER_NOMARKER ); -} - -BasicEntryDescriptor ModulWindow::CreateEntryDescriptor() -{ - ScriptDocument aDocument( GetDocument() ); - String aLibName( GetLibName() ); - LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - String aModName( GetName() ); - String aLibSubName; - if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() ) - { - switch( xModule->GetModuleType() ) - { - case script::ModuleType::DOCUMENT: - { - aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ); - uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); - if( xLib.is() ) - { - String sObjName; - ModuleInfoHelper::getObjectName( xLib, aModName, sObjName ); - if( sObjName.Len() ) - { - aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); - } - } - break; - } - case script::ModuleType::FORM: - aLibSubName = String( IDEResId( RID_STR_USERFORMS ) ); - break; - case script::ModuleType::NORMAL: - aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) ); - break; - case script::ModuleType::CLASS: - aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) ); - break; - } - } - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE ); -} - -void ModulWindow::SetReadOnly( sal_Bool b ) -{ - if ( GetEditView() ) - GetEditView()->SetReadOnly( b ); -} - -sal_Bool ModulWindow::IsReadOnly() -{ - sal_Bool bReadOnly = sal_False; - - if ( GetEditView() ) - bReadOnly = GetEditView()->IsReadOnly(); - - return bReadOnly; -} - -sal_Bool ModulWindow::IsPasteAllowed() -{ - sal_Bool bPaste = sal_False; - - // get clipboard - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard(); - if ( xClipboard.is() ) - { - // get clipboard content - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents(); - Application::AcquireSolarMutex( nRef ); - if ( xTransf.is() ) - { - datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - if ( xTransf->isDataFlavorSupported( aFlavor ) ) - { - bPaste = sal_True; - } - } - } - - return bPaste; -} - -ModulWindowLayout::ModulWindowLayout( Window* pParent ) : - Window( pParent, WB_CLIPCHILDREN ), - aVSplitter( this, WinBits( WB_VSCROLL ) ), - aHSplitter( this, WinBits( WB_HSCROLL ) ), - aWatchWindow( this ), - aStackWindow( this ), - bVSplitted(sal_False), - bHSplitted(sal_False), - m_pModulWindow(0), - m_aImagesNormal(IDEResId(RID_IMGLST_LAYOUT)) -{ - SetBackground(GetSettings().GetStyleSettings().GetWindowColor()); - - aVSplitter.SetSplitHdl( LINK( this, ModulWindowLayout, SplitHdl ) ); - aHSplitter.SetSplitHdl( LINK( this, ModulWindowLayout, SplitHdl ) ); - aVSplitter.Show(); - aHSplitter.Show(); - - aWatchWindow.Show(); - aStackWindow.Show(); - - Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor()); - m_aSyntaxColors[TT_UNKNOWN] = aColor; - m_aSyntaxColors[TT_WHITESPACE] = aColor; - m_aSyntaxColors[TT_EOL] = aColor; - m_aColorConfig.AddListener(this); - m_aSyntaxColors[TT_IDENTIFIER] - = Color(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER).nColor); - m_aSyntaxColors[TT_NUMBER] - = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor); - m_aSyntaxColors[TT_STRING] - = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor); - m_aSyntaxColors[TT_COMMENT] - = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT).nColor); - m_aSyntaxColors[TT_ERROR] - = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor); - m_aSyntaxColors[TT_OPERATOR] - = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR).nColor); - m_aSyntaxColors[TT_KEYWORDS] - = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD).nColor); - - Font aFont( GetFont() ); - Size aSz( aFont.GetSize() ); - aSz.Height() *= 3; - aSz.Height() /= 2; - aFont.SetSize( aSz ); - aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetColor(GetSettings().GetStyleSettings().GetWindowTextColor()); - SetFont( aFont ); -} - -ModulWindowLayout::~ModulWindowLayout() -{ - m_aColorConfig.RemoveListener(this); -} - -void ModulWindowLayout::Resize() -{ - // ScrollBars, etc. passiert in BasicIDEShell:Adjust... - ArrangeWindows(); -} - -void ModulWindowLayout::Paint( const Rectangle& ) -{ - DrawText( Point(), String( IDEResId( RID_STR_NOMODULE ) ) ); -} - - -void ModulWindowLayout::ArrangeWindows() -{ - Size aSz = GetOutputSizePixel(); - - // prueffen, ob der Splitter in einem gueltigen Bereich liegt... - long nMinPos = SPLIT_MARGIN; - long nMaxPos = aSz.Height() - SPLIT_MARGIN; - - long nVSplitPos = aVSplitter.GetSplitPosPixel(); - long nHSplitPos = aHSplitter.GetSplitPosPixel(); - if ( !bVSplitted ) - { - // Wenn noch nie gesplitted wurde, Verhaeltniss = 3 : 4 - nVSplitPos = aSz.Height() * 3 / 4; - aVSplitter.SetSplitPosPixel( nVSplitPos ); - } - if ( !bHSplitted ) - { - // Wenn noch nie gesplitted wurde, Verhaeltniss = 2 : 3 - nHSplitPos = aSz.Width() * 2 / 3; - aHSplitter.SetSplitPosPixel( nHSplitPos ); - } - if ( ( nVSplitPos < nMinPos ) || ( nVSplitPos > nMaxPos ) ) - nVSplitPos = ( nVSplitPos < nMinPos ) ? 0 : ( aSz.Height() - SPLIT_HEIGHT ); - - Size aXEWSz; - aXEWSz.Width() = aSz.Width(); - aXEWSz.Height() = nVSplitPos + 1; - if ( m_pModulWindow ) - { - DBG_CHKOBJ( m_pModulWindow, ModulWindow, 0 ); - m_pModulWindow->SetPosSizePixel( Point( 0, 0 ), aXEWSz ); - } - - aVSplitter.SetDragRectPixel( Rectangle( Point( 0, 0 ), Size( aSz.Width(), aSz.Height() ) ) ); - aVSplitter.SetPosPixel( Point( 0, nVSplitPos ) ); - aVSplitter.SetSizePixel( Size( aSz.Width(), SPLIT_HEIGHT ) ); - - aHSplitter.SetDragRectPixel( Rectangle( Point( 0, nVSplitPos+SPLIT_HEIGHT ), Size( aSz.Width(), aSz.Height() - nVSplitPos - SPLIT_HEIGHT ) ) ); - aHSplitter.SetPosPixel( Point( nHSplitPos, nVSplitPos ) ); - aHSplitter.SetSizePixel( Size( SPLIT_HEIGHT, aSz.Height() - nVSplitPos ) ); - - Size aWWSz; - Point aWWPos( 0, nVSplitPos+SPLIT_HEIGHT ); - aWWSz.Width() = nHSplitPos; - aWWSz.Height() = aSz.Height() - aWWPos.Y(); - if ( !aWatchWindow.IsFloatingMode() ) - aWatchWindow.SetPosSizePixel( aWWPos, aWWSz ); - - Size aSWSz; - Point aSWPos( nHSplitPos+SPLIT_HEIGHT, nVSplitPos+SPLIT_HEIGHT ); - aSWSz.Width() = aSz.Width() - aSWPos.X(); - aSWSz.Height() = aSz.Height() - aSWPos.Y(); - if ( !aStackWindow.IsFloatingMode() ) - aStackWindow.SetPosSizePixel( aSWPos, aSWSz ); - - if ( aStackWindow.IsFloatingMode() && aWatchWindow.IsFloatingMode() ) - aHSplitter.Hide(); - else - aHSplitter.Show(); - - long nHDoubleClickSplitPosX = aSz.Width()-aHSplitter.GetSizePixel().Width(); - if ( aHSplitter.GetSplitPosPixel() < nHDoubleClickSplitPosX ) - aHSplitter.SetLastSplitPosPixel( nHDoubleClickSplitPosX ); - - - long nHDoubleClickSplitPosY = aSz.Height()-aVSplitter.GetSizePixel().Height(); - if ( aVSplitter.GetSplitPosPixel() < nHDoubleClickSplitPosY ) - aVSplitter.SetLastSplitPosPixel( nHDoubleClickSplitPosY ); -} - -IMPL_LINK( ModulWindowLayout, SplitHdl, Splitter *, pSplitter ) -{ - if ( pSplitter == &aVSplitter ) - bVSplitted = sal_True; - else - bHSplitted = sal_True; - - ArrangeWindows(); - return 0; -} - -sal_Bool ModulWindowLayout::IsToBeDocked( DockingWindow* pDockingWindow, const Point& rPos, Rectangle& rRect ) -{ - // prueffen, ob als Dock oder als Child: - // TRUE: Floating - // FALSE: Child - Point aPosInMe = ScreenToOutputPixel( rPos ); - Size aSz = GetOutputSizePixel(); - if ( ( aPosInMe.X() > 0 ) && ( aPosInMe.X() < aSz.Width() ) && - ( aPosInMe.Y() > 0 ) && ( aPosInMe.Y() < aSz.Height() ) ) - { - long nVSplitPos = aVSplitter.GetSplitPosPixel(); - long nHSplitPos = aHSplitter.GetSplitPosPixel(); - if ( pDockingWindow == &aWatchWindow ) - { - if ( ( aPosInMe.Y() > nVSplitPos ) && ( aPosInMe.X() < nHSplitPos ) ) - { - rRect.SetSize( Size( nHSplitPos, aSz.Height() - nVSplitPos ) ); - rRect.SetPos( OutputToScreenPixel( Point( 0, nVSplitPos ) ) ); - return sal_True; - } - } - if ( pDockingWindow == &aStackWindow ) - { - if ( ( aPosInMe.Y() > nVSplitPos ) && ( aPosInMe.X() > nHSplitPos ) ) - { - rRect.SetSize( Size( aSz.Width() - nHSplitPos, aSz.Height() - nVSplitPos ) ); - rRect.SetPos( OutputToScreenPixel( Point( nHSplitPos, nVSplitPos ) ) ); - return sal_True; - } - } - } - return sal_False; -} - -void ModulWindowLayout::DockaWindow( DockingWindow* pDockingWindow ) -{ - if ( pDockingWindow == &aWatchWindow ) - { - // evtl. Sonderbehandlung... - ArrangeWindows(); - } - else if ( pDockingWindow == &aStackWindow ) - { - // evtl. Sonderbehandlung... - ArrangeWindows(); - } -#if OSL_DEBUG_LEVEL > 0 - else - OSL_FAIL( "Wer will sich denn hier andocken ?" ); -#endif -} - -void ModulWindowLayout::SetModulWindow( ModulWindow* pModWin ) -{ - m_pModulWindow = pModWin; - ArrangeWindows(); -} - -// virtual -void ModulWindowLayout::DataChanged(DataChangedEvent const & rDCEvt) -{ - Window::DataChanged(rDCEvt); - if (rDCEvt.GetType() == DATACHANGED_SETTINGS - && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0) - { - bool bInvalidate = false; - Color aColor(GetSettings().GetStyleSettings().GetWindowColor()); - if (aColor - != rDCEvt.GetOldSettings()->GetStyleSettings().GetWindowColor()) - { - SetBackground(Wallpaper(aColor)); - bInvalidate = true; - } - aColor = GetSettings().GetStyleSettings().GetWindowTextColor(); - if (aColor != rDCEvt.GetOldSettings()-> - GetStyleSettings().GetWindowTextColor()) - { - Font aFont(GetFont()); - aFont.SetColor(aColor); - SetFont(aFont); - bInvalidate = true; - } - if (bInvalidate) - Invalidate(); - aColor = GetSettings().GetStyleSettings().GetFieldTextColor(); - if (aColor != m_aSyntaxColors[TT_UNKNOWN]) - { - m_aSyntaxColors[TT_UNKNOWN] = aColor; - m_aSyntaxColors[TT_WHITESPACE] = aColor; - m_aSyntaxColors[TT_EOL] = aColor; - updateSyntaxHighlighting(); - } - } -} - -// virtual -void ModulWindowLayout::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) -{ - { - Color aColor(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER). - nColor); - bool bChanged = aColor != m_aSyntaxColors[TT_IDENTIFIER]; - m_aSyntaxColors[TT_IDENTIFIER] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_NUMBER]) - bChanged = true; - m_aSyntaxColors[TT_NUMBER] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_STRING]) - bChanged = true; - m_aSyntaxColors[TT_STRING] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT). - nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_COMMENT]) - bChanged = true; - m_aSyntaxColors[TT_COMMENT] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_ERROR]) - bChanged = true; - m_aSyntaxColors[TT_ERROR] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR). - nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_OPERATOR]) - bChanged = true; - m_aSyntaxColors[TT_OPERATOR] = aColor; - aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD). - nColor); - if (bChanged || aColor != m_aSyntaxColors[TT_KEYWORDS]) - bChanged = true; - m_aSyntaxColors[TT_KEYWORDS] = aColor; - if (bChanged) - updateSyntaxHighlighting(); - } -} - -void ModulWindowLayout::updateSyntaxHighlighting() -{ - if (m_pModulWindow != 0) - { - EditorWindow & rEditor = m_pModulWindow->GetEditorWindow(); - sal_uLong nCount = rEditor.GetEditEngine()->GetParagraphCount(); - for (sal_uLong i = 0; i < nCount; ++i) - rEditor.DoDelayedSyntaxHighlight(i); - } -} - -Image ModulWindowLayout::getImage(sal_uInt16 nId) const -{ - return m_aImagesNormal.GetImage(nId); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside2.hrc b/basctl/source/basicide/baside2.hrc deleted file mode 100644 index 0da8274cc..000000000 --- a/basctl/source/basicide/baside2.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASIDE2_HRC -#define _BASIDE2_HRC - -#include - -// Diese Dateien enthaelt nur die lokalen ID's. - -// RID_POPUP_BRKPROPS -#define RID_BRKPROPS 1 -#define RID_ACTIV 2 - -// RID_POPUP_BRKDLG -#define RID_BRKDLG 1 - -// RID_POPUP_TABBAR -#define RID_INSERT 1 - -// ModulWindowLayout -#define IMGID_BRKENABLED ( SID_BASICIDE_IMAGESTART + 20 ) -#define IMGID_BRKDISABLED ( SID_BASICIDE_IMAGESTART + 21 ) -#define IMGID_STEPMARKER ( SID_BASICIDE_IMAGESTART + 22 ) -#define IMGID_ERRORMARKER ( SID_BASICIDE_IMAGESTART + 23 ) - -#endif // _BASIDE2_HRC diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx deleted file mode 100644 index a41bb3e0c..000000000 --- a/basctl/source/basicide/baside2.hxx +++ /dev/null @@ -1,476 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASIDE2_HXX -#define _BASIDE2_HXX - -#include - -#include -#include -#include - -class ExtTextEngine; -class ExtTextView; -class SvxSearchItem; -#include -#include - -#include -#include -#include -#include "svl/lstner.hxx" -#include - -#include -#include - -DBG_NAMEEX( ModulWindow ) - -#define MARKER_NOMARKER 0xFFFF - -namespace utl -{ - class SourceViewConfig; -} - -// #108672 Helper functions to get/set text in TextEngine -// using the stream interface (get/setText() only supports -// tools Strings limited to 64K). -::rtl::OUString getTextEngineText( ExtTextEngine* pEngine ); -void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr ); - -class ProgressInfo : public SfxProgress -{ -private: - sal_uLong nCurState; - -public: - - inline ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange ); - inline void StepProgress(); -}; - -inline ProgressInfo::ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange ) - : SfxProgress( pObjSh, rText, nRange ) -{ - nCurState = 0; -} - -inline void ProgressInfo::StepProgress() -{ - SetState( ++nCurState ); -} - - -namespace svt { -class SourceViewConfig; -} - -class EditorWindow : public Window, public SfxListener, public utl::ConfigurationListener -{ -private: - ExtTextView* pEditView; - ExtTextEngine* pEditEngine; - - utl::SourceViewConfig* pSourceViewConfig; - - long nCurTextWidth; - - SyntaxHighlighter aHighlighter; - Timer aSyntaxIdleTimer; - Table aSyntaxLineTable; - DECL_LINK( SyntaxTimerHdl, Timer * ); - ProgressInfo* pProgress; - ModulWindow* pModulWindow; - - virtual void DataChanged(DataChangedEvent const & rDCEvt); - - using Window::Notify; - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - void ImpDoHighlight( sal_uLong nLineOff ); - void ImplSetFont(); - - sal_Bool bHighlightning; - sal_Bool bDoSyntaxHighlight; - sal_Bool bDelayHighlight; - - virtual - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > - GetComponentInterface(sal_Bool bCreate = sal_True); - -protected: - virtual void Paint( const Rectangle& ); - virtual void Resize(); - virtual void KeyInput( const KeyEvent& rKeyEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void LoseFocus(); - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); - - void DoSyntaxHighlight( sal_uLong nPara ); - String GetWordAtCursor(); - sal_Bool ImpCanModify(); - -public: - EditorWindow( Window* pParent ); - ~EditorWindow(); - - ExtTextEngine* GetEditEngine() const { return (ExtTextEngine*)pEditEngine; } - ExtTextView* GetEditView() const { return pEditView; } - ProgressInfo* GetProgress() const { return pProgress; } - - void CreateProgress( const String& rText, sal_uLong nRange ); - void DestroyProgress(); - - void ParagraphInsertedDeleted( sal_uLong nNewPara, sal_Bool bInserted ); - void DoDelayedSyntaxHighlight( sal_uLong nPara ); - - void CreateEditEngine(); - void SetScrollBarRanges(); - void InitScrollBars(); - void SetModulWindow( ModulWindow* pWin ) - { pModulWindow = pWin; } - - void ForceSyntaxTimeout(); - sal_Bool SetSourceInBasic( sal_Bool bQuiet = sal_True ); - - sal_Bool CanModify() { return ImpCanModify(); } -}; - - -class BreakPointWindow : public Window -{ -private: - long nCurYOffset; - sal_uInt16 nMarkerPos; - BreakPointList aBreakPointList; - ModulWindow* pModulWindow; - sal_Bool bErrorMarker; - - virtual void DataChanged(DataChangedEvent const & rDCEvt); - - void setBackgroundColor(Color aColor); - -protected: - virtual void Paint( const Rectangle& ); - virtual void Resize(); - BreakPoint* FindBreakPoint( const Point& rMousePos ); - void ShowMarker( sal_Bool bShow ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Command( const CommandEvent& rCEvt ); - - sal_Bool SyncYOffset(); - -public: - BreakPointWindow( Window* pParent ); - ~BreakPointWindow(); - - void SetModulWindow( ModulWindow* pWin ) - { pModulWindow = pWin; } - - void SetMarkerPos( sal_uInt16 nLine, sal_Bool bErrorMarker = sal_False ); - - void DoScroll( long nHorzScroll, long nVertScroll ); - long& GetCurYOffset() { return nCurYOffset; } - BreakPointList& GetBreakPoints() { return aBreakPointList; } -}; - - -class WatchTreeListBox : public SvHeaderTabListBox -{ - String aEditingRes; - -protected: - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel ); - virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ); - - sal_Bool ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& rResult ); - SbxBase* ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArrayElement ); - -public: - WatchTreeListBox( Window* pParent, WinBits nWinBits ); - ~WatchTreeListBox(); - - void RequestingChilds( SvLBoxEntry * pParent ); - void UpdateWatches( bool bBasicStopped = false ); - - using SvTabListBox::SetTabs; - virtual void SetTabs(); -}; - - - -class WatchWindow : public BasicDockingWindow -{ -private: - String aWatchStr; - ExtendedEdit aXEdit; - ImageButton aRemoveWatchButton; - WatchTreeListBox aTreeListBox; - HeaderBar aHeaderBar; - -protected: - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - - DECL_LINK( ButtonHdl, ImageButton * ); - DECL_LINK( TreeListHdl, SvTreeListBox * ); - DECL_LINK( implEndDragHdl, HeaderBar * ); - DECL_LINK( EditAccHdl, Accelerator * ); - - -public: - WatchWindow( Window* pParent ); - ~WatchWindow(); - - void AddWatch( const String& rVName ); - sal_Bool RemoveSelectedWatch(); - void UpdateWatches( bool bBasicStopped = false ); - - WatchTreeListBox& GetWatchTreeListBox() { return aTreeListBox; } -}; - - -class StackWindow : public BasicDockingWindow -{ -private: - SvTreeListBox aTreeListBox; - String aStackStr; - -protected: - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - DECL_LINK( ButtonHdl, ImageButton * ); - -public: - StackWindow( Window* pParent ); - ~StackWindow(); - - void UpdateCalls(); -}; - - -class ComplexEditorWindow : public Window -{ -private: - BreakPointWindow aBrkWindow; - EditorWindow aEdtWindow; - ScrollBar aEWVScrollBar; - - virtual void DataChanged(DataChangedEvent const & rDCEvt); - -protected: - virtual void Resize(); - DECL_LINK( ScrollHdl, ScrollBar * ); - -public: - ComplexEditorWindow( ModulWindow* pParent ); - - BreakPointWindow& GetBrkWindow() { return aBrkWindow; } - EditorWindow& GetEdtWindow() { return aEdtWindow; } - ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; } -}; - - -#define SYNTAX_COLOR_MAX 5 - -class ModulWindow: public IDEBaseWindow -{ - friend class BasicIDEShell; - -private: - StarBASICRef xBasic; - short nValid; - ComplexEditorWindow aXEditorWindow; - BasicStatus aStatus; - SbModuleRef xModule; - ModulWindowLayout* pLayout; - String aCurPath; - ::rtl::OUString m_aModule; - - DECL_LINK( BasicErrorHdl, StarBASIC * ); - long BasicBreakHdl( StarBASIC* pBasic ); - - void CheckCompileBasic(); - sal_Bool BasicExecute(); - - void GoOnTop(); - void AssertValidEditEngine(); - - sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 ); - SbModuleRef XModule(); -protected: - virtual void Resize(); - virtual void GetFocus(); - virtual void Paint( const Rectangle& ); - virtual void Deactivating(); - virtual void DoInit(); - virtual void DoScroll( ScrollBar* pCurScrollBar ); - -public: - TYPEINFO(); - - ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, String aLibName, - String aName, ::rtl::OUString& aModule ); - - ~ModulWindow(); - - virtual void ExecuteCommand( SfxRequest& rReq ); - virtual void GetState( SfxItemSet& ); - virtual void StoreData(); - virtual void UpdateData(); - virtual sal_Bool CanClose(); - // return number of pages to be printed - virtual sal_Int32 countPages( Printer* pPrinter ); - // print page - virtual void printPage( sal_Int32 nPage, Printer* pPrinter ); - virtual String GetTitle(); - virtual BasicEntryDescriptor CreateEntryDescriptor(); - virtual sal_Bool AllowUndo(); - virtual void SetReadOnly( sal_Bool bReadOnly ); - virtual sal_Bool IsReadOnly(); - - StarBASIC* GetBasic() { XModule(); return xBasic; } - - SbModule* GetSbModule() { return xModule; } - void SetSbModule( SbModule* pModule ) { xModule = pModule; } - String GetSbModuleName(); - - sal_Bool CompileBasic(); - sal_Bool BasicRun(); - sal_Bool BasicStepOver(); - sal_Bool BasicStepInto(); - sal_Bool BasicStepOut(); - void BasicStop(); - sal_Bool BasicToggleBreakPoint(); - void BasicToggleBreakPointEnabled(); - void ManageBreakPoints(); - void UpdateBreakPoint( const BreakPoint& rBrk ); - void BasicAddWatch(); - void BasicRemoveWatch(); - - sal_Bool LoadBasic(); - sal_Bool SaveBasicSource(); - sal_Bool ImportDialog(); - - void EditMacro( const String& rMacroName ); - - sal_Bool ToggleBreakPoint( sal_uLong nLine ); - - BasicStatus& GetBasicStatus() { return aStatus; } - - virtual sal_Bool IsModified(); - virtual sal_Bool IsPasteAllowed(); - - void FrameWindowMoved(); - void ShowCursor( sal_Bool bOn ); - - virtual sal_uInt16 GetSearchOptions(); - sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem, sal_Bool bFromStart = sal_False ); - - virtual Window* GetLayoutWindow(); - - EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); } - BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); } - ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); } - ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); } - ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); } - BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); } - ModulWindowLayout* GetLayout() const { return pLayout; } - - virtual void BasicStarted(); - virtual void BasicStopped(); - - virtual ::svl::IUndoManager* - GetUndoManager(); - - const ::rtl::OUString& GetModule() const { return m_aModule; } - void SetModule( const ::rtl::OUString& aModule ) { m_aModule = aModule; } -}; - -class ModulWindowLayout: public Window, public utl::ConfigurationListener -{ -private: - - Splitter aVSplitter; - Splitter aHSplitter; - - WatchWindow aWatchWindow; - StackWindow aStackWindow; - - sal_Bool bVSplitted; - sal_Bool bHSplitted; - - ModulWindow * m_pModulWindow; - - Color m_aSyntaxColors[TT_KEYWORDS + 1]; - svtools::ColorConfig m_aColorConfig; - - ImageList m_aImagesNormal; - - virtual void DataChanged(DataChangedEvent const & rDCEvt); - - virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); - - void updateSyntaxHighlighting(); - - DECL_LINK( SplitHdl, Splitter * ); - - void ArrangeWindows(); - -protected: - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - -public: - ModulWindowLayout( Window* pParent ); - ~ModulWindowLayout(); - - void DockaWindow( DockingWindow* pDockingWin ); - sal_Bool IsToBeDocked( DockingWindow* pDockingWin, const Point& rPos, Rectangle& rRect ); - - void SetModulWindow( ModulWindow* pModWin ); - ModulWindow* GetModulWindow() const { return m_pModulWindow; } - - WatchWindow& GetWatchWindow() { return aWatchWindow; } - StackWindow& GetStackWindow() { return aStackWindow; } - - Image getImage(sal_uInt16 nId) const; - - inline Color const & getSyntaxColor(TokenTypes eType) const - { return m_aSyntaxColors[eType]; } -}; - -#endif // _BASIDE2_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx deleted file mode 100644 index fde0fc984..000000000 --- a/basctl/source/basicide/baside2b.cxx +++ /dev/null @@ -1,2266 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include -#define _BASIC_TEXTPORTIONS -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow -long nHeaderBarHeight; - -#define SCROLL_LINE 12 -#define SCROLL_PAGE 60 -#define DWBORDER 3 - -static const char cSuffixes[] = "%&!#@$"; - -MapUnit eEditMapUnit = MAP_100TH_MM; - - -/** - * Helper functions to get/set text in TextEngine using - * the stream interface. - * - * get/setText() only supports tools Strings limited to 64K). - */ -::rtl::OUString getTextEngineText( ExtTextEngine* pEngine ) -{ - SvMemoryStream aMemStream; - aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 ); - aMemStream.SetLineDelimiter( LINEEND_LF ); - pEngine->Write( aMemStream ); - sal_uLong nSize = aMemStream.Tell(); - ::rtl::OUString aText( (const sal_Char*)aMemStream.GetData(), - nSize, RTL_TEXTENCODING_UTF8 ); - return aText; -} - -void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr ) -{ - pEngine->SetText( String() ); - ::rtl::OString aUTF8Str = ::rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ); - SvMemoryStream aMemStream( (void*)aUTF8Str.getStr(), aUTF8Str.getLength(), - STREAM_READ | STREAM_SEEK_TO_BEGIN ); - aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 ); - aMemStream.SetLineDelimiter( LINEEND_LF ); - pEngine->Read( aMemStream ); -} - -void lcl_DrawIDEWindowFrame( DockingWindow* pWin ) -{ - if ( pWin->IsFloatingMode() ) - return; - - Size aSz = pWin->GetOutputSizePixel(); - const Color aOldLineColor( pWin->GetLineColor() ); - pWin->SetLineColor( Color( COL_WHITE ) ); - // White line on top - pWin->DrawLine( Point( 0, 0 ), Point( aSz.Width(), 0 ) ); - // Black line at bottom - pWin->SetLineColor( Color( COL_BLACK ) ); - pWin->DrawLine( Point( 0, aSz.Height() - 1 ), - Point( aSz.Width(), aSz.Height() - 1 ) ); - pWin->SetLineColor( aOldLineColor ); -} - -void lcl_SeparateNameAndIndex( const String& rVName, String& rVar, String& rIndex ) -{ - rVar = rVName; - rIndex.Erase(); - sal_uInt16 nIndexStart = rVar.Search( '(' ); - if ( nIndexStart != STRING_NOTFOUND ) - { - sal_uInt16 nIndexEnd = rVar.Search( ')', nIndexStart ); - if ( nIndexStart != STRING_NOTFOUND ) - { - rIndex = rVar.Copy( nIndexStart+1, nIndexEnd-nIndexStart-1 ); - rVar.Erase( nIndexStart ); - rVar.EraseTrailingChars(); - rIndex.EraseLeadingChars(); - rIndex.EraseTrailingChars(); - } - } - - if ( rVar.Len() ) - { - sal_uInt16 nLastChar = rVar.Len()-1; - if ( strchr( cSuffixes, rVar.GetChar( nLastChar ) ) ) - rVar.Erase( nLastChar, 1 ); - } - if ( rIndex.Len() ) - { - sal_uInt16 nLastChar = rIndex.Len()-1; - if ( strchr( cSuffixes, rIndex.GetChar( nLastChar ) ) ) - rIndex.Erase( nLastChar, 1 ); - } -} - - -EditorWindow::EditorWindow( Window* pParent ) : - Window( pParent, WB_BORDER ) -{ - bDoSyntaxHighlight = sal_True; - bDelayHighlight = sal_True; - pModulWindow = 0; - pEditView = 0; - pEditEngine = 0; - pSourceViewConfig = new utl::SourceViewConfig; - bHighlightning = sal_False; - pProgress = 0; - nCurTextWidth = 0; - SetBackground( - Wallpaper(GetSettings().GetStyleSettings().GetFieldColor())); - SetPointer( Pointer( POINTER_TEXT ) ); - - SetHelpId( HID_BASICIDE_EDITORWINDOW ); - pSourceViewConfig->AddListener(this); -} - - - -EditorWindow::~EditorWindow() -{ - pSourceViewConfig->RemoveListener(this); - delete pSourceViewConfig; - - aSyntaxIdleTimer.Stop(); - - if ( pEditEngine ) - { - EndListening( *pEditEngine ); - pEditEngine->RemoveView( pEditView ); - delete pEditView; - delete pEditEngine; - } -} - -String EditorWindow::GetWordAtCursor() -{ - String aWord; - - if ( pEditView ) - { - TextEngine* pTextEngine = pEditView->GetTextEngine(); - if ( pTextEngine ) - { - // check first, if the cursor is at a help URL - const TextSelection& rSelection = pEditView->GetSelection(); - const TextPaM& rSelStart = rSelection.GetStart(); - const TextPaM& rSelEnd = rSelection.GetEnd(); - String aText = pTextEngine->GetText( rSelEnd.GetPara() ); - CharClass aClass( ::comphelper::getProcessServiceFactory() , Application::GetSettings().GetLocale() ); - xub_StrLen nSelStart = static_cast< xub_StrLen >( rSelStart.GetIndex() ); - xub_StrLen nSelEnd = static_cast< xub_StrLen >( rSelEnd.GetIndex() ); - xub_StrLen nLength = static_cast< xub_StrLen >( aText.Len() ); - xub_StrLen nStart = 0; - xub_StrLen nEnd = nLength; - while ( nStart < nLength ) - { - String aURL( URIHelper::FindFirstURLInText( aText, nStart, nEnd, aClass ) ); - INetURLObject aURLObj( aURL ); - if ( aURLObj.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP - && nSelStart >= nStart && nSelStart <= nEnd && nSelEnd >= nStart && nSelEnd <= nEnd ) - { - aWord = aURL; - break; - } - nStart = nEnd; - nEnd = nLength; - } - - // Not the selected range, but at the CursorPosition, - // if a word is partially selected. - if ( !aWord.Len() ) - aWord = pTextEngine->GetWord( rSelEnd ); - - // Can be empty when full word selected, as Cursor behing it - if ( !aWord.Len() && pEditView->HasSelection() ) - aWord = pTextEngine->GetWord( rSelStart ); - } - } - - return aWord; -} - -void EditorWindow::RequestHelp( const HelpEvent& rHEvt ) -{ - sal_Bool bDone = sal_False; - - // Should have been activated at some point - if ( pEditEngine ) - { - if ( rHEvt.GetMode() & HELPMODE_CONTEXT ) - { - String aKeyword = GetWordAtCursor(); - Application::GetHelp()->SearchKeyword( aKeyword ); - bDone = sal_True; - } - else if ( rHEvt.GetMode() & HELPMODE_QUICK ) - { - String aHelpText; - Point aTopLeft; - if ( StarBASIC::IsRunning() ) - { - Point aWindowPos = rHEvt.GetMousePosPixel(); - aWindowPos = ScreenToOutputPixel( aWindowPos ); - Point aDocPos = GetEditView()->GetDocPos( aWindowPos ); - TextPaM aCursor = GetEditView()->GetTextEngine()->GetPaM( aDocPos, sal_False ); - TextPaM aStartOfWord; - String aWord = GetEditView()->GetTextEngine()->GetWord( aCursor, &aStartOfWord ); - if ( aWord.Len() && !ByteString( aWord, RTL_TEXTENCODING_UTF8 ).IsNumericAscii() ) - { - sal_uInt16 nLastChar =aWord.Len()-1; - if ( strchr( cSuffixes, aWord.GetChar( nLastChar ) ) ) - aWord.Erase( nLastChar, 1 ); - SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord ); - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) - { - SbxVariable* pVar = (SbxVariable*)pSBX; - SbxDataType eType = pVar->GetType(); - if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT ) - // Kann zu Absturz, z.B. bei Selections-Objekt fuehren - // Type == Object heisst nicht, dass pVar == Object! - ; // aHelpText = ((SbxObject*)pVar)->GetClassName(); - else if ( eType & SbxARRAY ) - ; // aHelpText = "{...}"; - else if ( (sal_uInt8)eType != (sal_uInt8)SbxEMPTY ) - { - aHelpText = pVar->GetName(); - if ( !aHelpText.Len() ) // Bei Uebergabeparametern wird der Name nicht kopiert - aHelpText = aWord; - aHelpText += '='; - aHelpText += pVar->GetString(); - } - } - if ( aHelpText.Len() ) - { - aTopLeft = GetEditView()->GetTextEngine()->PaMtoEditCursor( aStartOfWord ).BottomLeft(); - aTopLeft = GetEditView()->GetWindowPos( aTopLeft ); - aTopLeft.X() += 5; - aTopLeft.Y() += 5; - aTopLeft = OutputToScreenPixel( aTopLeft ); - } - } - } - Help::ShowQuickHelp( this, Rectangle( aTopLeft, Size( 1, 1 ) ), aHelpText, QUICKHELP_TOP|QUICKHELP_LEFT); - bDone = sal_True; - } - } - - if ( !bDone ) - Window::RequestHelp( rHEvt ); -} - - -void EditorWindow::Resize() -{ - // ScrollBars, etc. happens in Adjust... - if ( pEditView ) - { - long nVisY = pEditView->GetStartDocPos().Y(); - - pEditView->ShowCursor(); - Size aOutSz( GetOutputSizePixel() ); - long nMaxVisAreaStart = pEditView->GetTextEngine()->GetTextHeight() - aOutSz.Height(); - if ( nMaxVisAreaStart < 0 ) - nMaxVisAreaStart = 0; - if ( pEditView->GetStartDocPos().Y() > nMaxVisAreaStart ) - { - Point aStartDocPos( pEditView->GetStartDocPos() ); - aStartDocPos.Y() = nMaxVisAreaStart; - pEditView->SetStartDocPos( aStartDocPos ); - pEditView->ShowCursor(); - pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y(); - } - InitScrollBars(); - if ( nVisY != pEditView->GetStartDocPos().Y() ) - Invalidate(); - } -} - - -void EditorWindow::MouseMove( const MouseEvent &rEvt ) -{ - if ( pEditView ) - pEditView->MouseMove( rEvt ); -} - - -void EditorWindow::MouseButtonUp( const MouseEvent &rEvt ) -{ - if ( pEditView ) - { - pEditView->MouseButtonUp( rEvt ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_STAT_POS ); - } -} - -void EditorWindow::MouseButtonDown( const MouseEvent &rEvt ) -{ - GrabFocus(); - if ( pEditView ) - { - pEditView->MouseButtonDown( rEvt ); - } -} - -void EditorWindow::Command( const CommandEvent& rCEvt ) -{ - if ( pEditView ) - { - pEditView->Command( rCEvt ); - if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) || - ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) || - ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) ) - { - HandleScrollCommand( rCEvt, pModulWindow->GetHScrollBar(), &pModulWindow->GetEditVScrollBar() ); - } - } -} - -sal_Bool EditorWindow::ImpCanModify() -{ - sal_Bool bCanModify = sal_True; - if ( StarBASIC::IsRunning() ) - { - // If in Trace-mode, abort the trace or refuse input - // Remove markers in the modules in Notify at Basic::Stoped - if ( QueryBox( 0, WB_OK_CANCEL, String( IDEResId( RID_STR_WILLSTOPPRG ) ) ).Execute() == RET_OK ) - { - pModulWindow->GetBasicStatus().bIsRunning = sal_False; - BasicIDE::StopBasic(); - } - else - bCanModify = sal_False; - } - return bCanModify; -} - -void EditorWindow::KeyInput( const KeyEvent& rKEvt ) -{ - if ( !pEditView ) // Happens in Win95 - return; - -#if OSL_DEBUG_LEVEL > 1 - Range aRange = pModulWindow->GetHScrollBar()->GetRange(); (void)aRange; - long nVisSz = pModulWindow->GetHScrollBar()->GetVisibleSize(); (void)nVisSz; - long nPapSz = pModulWindow->GetHScrollBar()->GetPageSize(); (void)nPapSz; - long nLinSz = pModulWindow->GetHScrollBar()->GetLineSize(); (void)nLinSz; - long nThumb = pModulWindow->GetHScrollBar()->GetThumbPos(); (void)nThumb; -#endif - sal_Bool bWasModified = pEditEngine->IsModified(); - // see if there is an accelerator to be processed first - sal_Bool bDone = SfxViewShell::Current()->KeyInput( rKEvt ); - - if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) ) - { - if ( ( rKEvt.GetKeyCode().GetCode() == KEY_Y ) && rKEvt.GetKeyCode().IsMod1() ) - bDone = sal_True; // CTRL-Y schlucken, damit kein Vorlagenkatalog - else - { - if ( ( rKEvt.GetKeyCode().GetCode() == KEY_TAB ) && !rKEvt.GetKeyCode().IsMod1() && - !rKEvt.GetKeyCode().IsMod2() && !GetEditView()->IsReadOnly() ) - { - TextSelection aSel( pEditView->GetSelection() ); - if ( aSel.GetStart().GetPara() != aSel.GetEnd().GetPara() ) - { - bDelayHighlight = sal_False; - if ( !rKEvt.GetKeyCode().IsShift() ) - pEditView->IndentBlock(); - else - pEditView->UnindentBlock(); - bDelayHighlight = sal_True; - bDone = sal_True; - } - } - if ( !bDone ) - bDone = pEditView->KeyInput( rKEvt ); - } - } - if ( !bDone ) - { - Window::KeyInput( rKEvt ); - } - else - { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICIDE_STAT_POS ); - if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) - pBindings->Update( SID_BASICIDE_STAT_POS ); - if ( !bWasModified && pEditEngine->IsModified() ) - { - pBindings->Invalidate( SID_SAVEDOC ); - pBindings->Invalidate( SID_DOC_MODIFIED ); - pBindings->Invalidate( SID_UNDO ); - } - if ( rKEvt.GetKeyCode().GetCode() == KEY_INSERT ) - pBindings->Invalidate( SID_ATTR_INSERT ); - } - } -} - -void EditorWindow::Paint( const Rectangle& rRect ) -{ - if ( !pEditEngine ) // We need it now at latest - CreateEditEngine(); - - pEditView->Paint( rRect ); -} - -void EditorWindow::LoseFocus() -{ - SetSourceInBasic(); - Window::LoseFocus(); -} - -sal_Bool EditorWindow::SetSourceInBasic( sal_Bool bQuiet ) -{ - (void)bQuiet; - - sal_Bool bChanged = sal_False; - if ( pEditEngine && pEditEngine->IsModified() - && !GetEditView()->IsReadOnly() ) // Added for #i60626, otherwise - // any read only bug in the text engine could lead to a crash later - { - if ( !StarBASIC::IsRunning() ) // Not at runtime! - { - ::rtl::OUString aModule = getTextEngineText( pEditEngine ); - - // update module in basic -#ifdef DBG_UTIL - SbModule* pModule = pModulWindow->GetSbModule(); -#endif - DBG_ASSERT(pModule, "EditorWindow::SetSourceInBasic: No Module found!"); - - // update module in module window - pModulWindow->SetModule( aModule ); - - // update module in library - ScriptDocument aDocument( pModulWindow->GetDocument() ); - String aLibName = pModulWindow->GetLibName(); - String aName = pModulWindow->GetName(); - OSL_VERIFY( aDocument.updateModule( aLibName, aName, aModule ) ); - - pEditEngine->SetModified( sal_False ); - BasicIDE::MarkDocumentModified( aDocument ); - bChanged = sal_True; - } - } - return bChanged; -} - - -// Returns the position of the last character of any of the following -// EOL char combinations: CR, CR/LF, LF, return -1 if no EOL is found -sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex ) -{ - sal_Int32 iRetPos = -1; - - sal_Int32 iLF = rStr.indexOf( LINE_SEP, fromIndex ); - if( iLF != -1 ) - { - iRetPos = iLF; - } - else - { - iRetPos = rStr.indexOf( LINE_SEP_CR, fromIndex ); - } - return iRetPos; -} - - -void EditorWindow::CreateEditEngine() -{ - if ( pEditEngine ) - return; - - pEditEngine = new ExtTextEngine; - pEditView = new ExtTextView( pEditEngine, this ); - pEditView->SetAutoIndentMode( sal_True ); - pEditEngine->SetUpdateMode( sal_False ); - pEditEngine->InsertView( pEditView ); - - ImplSetFont(); - - aSyntaxIdleTimer.SetTimeout( 200 ); - aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) ); - - aHighlighter.initialize( HIGHLIGHT_BASIC ); - - sal_Bool bWasDoSyntaxHighlight = bDoSyntaxHighlight; - bDoSyntaxHighlight = sal_False; // Bei grossen Texten zu langsam... - ::rtl::OUString aOUSource( pModulWindow->GetModule() ); - sal_Int32 nLines = 0; - sal_Int32 nIndex = -1; - do - { - nLines++; - nIndex = searchEOL( aOUSource, nIndex+1 ); - } - while ( nIndex >= 0 ); - - // nLines*4: SetText+Formatting+DoHighlight+Formatting - // 1 Formatting koennte eingespart werden, aber dann wartet man - // bei einem langen Sourcecode noch laenger auf den Text... - pProgress = new ProgressInfo( IDE_DLL()->GetShell()->GetViewFrame()->GetObjectShell(), String( IDEResId( RID_STR_GENERATESOURCE ) ), nLines*4 ); - setTextEngineText( pEditEngine, aOUSource ); - - pEditView->SetStartDocPos( Point( 0, 0 ) ); - pEditView->SetSelection( TextSelection() ); - pModulWindow->GetBreakPointWindow().GetCurYOffset() = 0; - pEditEngine->SetUpdateMode( sal_True ); - Update(); // Es wurde bei UpdateMode = sal_True nur Invalidiert - - // Die anderen Fenster auch, damit keine halben Sachen auf dem Bildschirm! - pModulWindow->GetLayout()->GetWatchWindow().Update(); - pModulWindow->GetLayout()->GetStackWindow().Update(); - pModulWindow->GetBreakPointWindow().Update(); - - pEditView->ShowCursor( sal_True, sal_True ); - - StartListening( *pEditEngine ); - - // Das Syntax-Highlightning legt ein rel. groesse VDev an. - aSyntaxIdleTimer.Stop(); - bDoSyntaxHighlight = bWasDoSyntaxHighlight; - - - for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) - aSyntaxLineTable.Insert( nLine, (void*)(sal_uInt16)1 ); - ForceSyntaxTimeout(); - - DELETEZ( pProgress ); - - pEditView->EraseVirtualDevice(); - pEditEngine->SetModified( sal_False ); - pEditEngine->EnableUndo( sal_True ); - - InitScrollBars(); - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_STAT_POS ); - - DBG_ASSERT( pModulWindow->GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" ); - - // set readonly mode for readonly libraries - ScriptDocument aDocument( pModulWindow->GetDocument() ); - ::rtl::OUString aOULibName( pModulWindow->GetLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) - { - pModulWindow->SetReadOnly( sal_True ); - } - - if ( aDocument.isDocument() && aDocument.isReadOnly() ) - pModulWindow->SetReadOnly( sal_True ); -} - -// virtual -void EditorWindow::DataChanged(DataChangedEvent const & rDCEvt) -{ - Window::DataChanged(rDCEvt); - if (rDCEvt.GetType() == DATACHANGED_SETTINGS - && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0) - { - Color aColor(GetSettings().GetStyleSettings().GetFieldColor()); - if (aColor - != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor()) - { - SetBackground(Wallpaper(aColor)); - Invalidate(); - } - if (pEditEngine != 0) - { - aColor = GetSettings().GetStyleSettings().GetFieldTextColor(); - if (aColor != rDCEvt.GetOldSettings()-> - GetStyleSettings().GetFieldTextColor()) - { - Font aFont(pEditEngine->GetFont()); - aFont.SetColor(aColor); - pEditEngine->SetFont(aFont); - } - } - } -} - -void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) -{ - if ( rHint.ISA( TextHint ) ) - { - const TextHint& rTextHint = (const TextHint&)rHint; - if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED ) - { - if ( pModulWindow->GetHScrollBar() ) - pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() ); - pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() ); - pModulWindow->GetBreakPointWindow().DoScroll - ( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() ); - } - else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) - { - if ( pEditView->GetStartDocPos().Y() ) - { - long nOutHeight = GetOutputSizePixel().Height(); - long nTextHeight = pEditEngine->GetTextHeight(); - if ( nTextHeight < nOutHeight ) - pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() ); - } - - SetScrollBarRanges(); - } - else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED ) - { - if ( pModulWindow->GetHScrollBar() ) - { - sal_uLong nWidth = pEditEngine->CalcTextWidth(); - if ( (long)nWidth != nCurTextWidth ) - { - nCurTextWidth = nWidth; - pModulWindow->GetHScrollBar()->SetRange( Range( 0, (long)nCurTextWidth-1) ); - pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() ); - } - } - long nPrevTextWidth = nCurTextWidth; - nCurTextWidth = pEditEngine->CalcTextWidth(); - if ( nCurTextWidth != nPrevTextWidth ) - SetScrollBarRanges(); - } - else if( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) - { - ParagraphInsertedDeleted( rTextHint.GetValue(), sal_True ); - DoDelayedSyntaxHighlight( rTextHint.GetValue() ); - } - else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) - { - ParagraphInsertedDeleted( rTextHint.GetValue(), sal_False ); - } - else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) - { - DoDelayedSyntaxHighlight( rTextHint.GetValue() ); - } - } -} - -void EditorWindow::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) -{ - ImplSetFont(); -} - -void EditorWindow::SetScrollBarRanges() -{ - // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events. - if ( !pEditEngine ) - return; - - if ( pModulWindow->GetHScrollBar() ) - pModulWindow->GetHScrollBar()->SetRange( Range( 0, nCurTextWidth-1 ) ); - - pModulWindow->GetEditVScrollBar().SetRange( Range( 0, pEditEngine->GetTextHeight()-1 ) ); -} - -void EditorWindow::InitScrollBars() -{ - if ( !pEditEngine ) - return; - - SetScrollBarRanges(); - Size aOutSz( GetOutputSizePixel() ); - pModulWindow->GetEditVScrollBar().SetVisibleSize( aOutSz.Height() ); - pModulWindow->GetEditVScrollBar().SetPageSize( aOutSz.Height() * 8 / 10 ); - pModulWindow->GetEditVScrollBar().SetLineSize( GetTextHeight() ); - pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() ); - pModulWindow->GetEditVScrollBar().Show(); - - if ( pModulWindow->GetHScrollBar() ) - { - pModulWindow->GetHScrollBar()->SetVisibleSize( aOutSz.Width() ); - pModulWindow->GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 ); - pModulWindow->GetHScrollBar()->SetLineSize( GetTextWidth( 'x' ) ); - pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() ); - pModulWindow->GetHScrollBar()->Show(); - } -} - -void EditorWindow::ImpDoHighlight( sal_uLong nLine ) -{ - if ( bDoSyntaxHighlight ) - { - String aLine( pEditEngine->GetText( nLine ) ); - Range aChanges = aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); - if ( aChanges.Len() ) - { - for ( long n = aChanges.Min() + 1; n <= aChanges.Max(); n++ ) - aSyntaxLineTable.Insert( n, (void*)(sal_uLong)1 ); - aSyntaxIdleTimer.Start(); - } - - sal_Bool bWasModified = pEditEngine->IsModified(); - pEditEngine->RemoveAttribs( nLine, sal_True ); - HighlightPortions aPortions; - aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - - for ( size_t i = 0; i < aPortions.size(); i++ ) - { - HighlightPortion& r = aPortions[i]; - const Color& rColor = ((ModulWindowLayout*)pModulWindow->GetLayoutWindow())->getSyntaxColor(r.tokenType); - pEditEngine->SetAttrib( TextAttribFontColor( rColor ), nLine, r.nBegin, r.nEnd, sal_True ); - } - - // Das Highlighten soll kein Modify setzen - pEditEngine->SetModified( bWasModified ); - } -} - -void EditorWindow::ImplSetFont() -{ - if ( pSourceViewConfig ) - { - String sFontName = pSourceViewConfig->GetFontName(); - if ( !sFontName.Len() ) - { - Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) ); - sFontName = aTmpFont.GetName(); - } - Size aFontSize( 0, pSourceViewConfig->GetFontHeight() ); - Font aFont( sFontName, aFontSize ); - aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() ); - SetPointFont( aFont ); - aFont = GetFont(); - - if ( pModulWindow ) - pModulWindow->GetBreakPointWindow().SetFont( aFont ); - - if ( pEditEngine ) - { - sal_Bool bModified = pEditEngine->IsModified(); - pEditEngine->SetFont( aFont ); - pEditEngine->SetModified( bModified ); - } - } -} - -void EditorWindow::DoSyntaxHighlight( sal_uLong nPara ) -{ - // Durch das DelayedSyntaxHighlight kann es passieren, - // dass die Zeile nicht mehr existiert! - if ( nPara < pEditEngine->GetParagraphCount() ) - { - // leider weis ich nicht, ob genau diese Zeile Modified() ... - if ( pProgress ) - pProgress->StepProgress(); - ImpDoHighlight( nPara ); - } -} - -void EditorWindow::DoDelayedSyntaxHighlight( sal_uLong nPara ) -{ - // Zeile wird nur in 'Liste' aufgenommen, im TimerHdl abgearbeitet. - // => Nicht Absaetze manipulieren, waehrend EditEngine formatiert. - if ( pProgress ) - pProgress->StepProgress(); - - if ( !bHighlightning && bDoSyntaxHighlight ) - { - if ( bDelayHighlight ) - { - aSyntaxLineTable.Insert( nPara, (void*)(sal_uLong)1 ); - aSyntaxIdleTimer.Start(); - } - else - DoSyntaxHighlight( nPara ); - } -} - -IMPL_LINK( EditorWindow, SyntaxTimerHdl, Timer *, EMPTYARG ) -{ - DBG_ASSERT( pEditView, "Noch keine View, aber Syntax-Highlight ?!" ); - - sal_Bool bWasModified = pEditEngine->IsModified(); - // pEditEngine->SetUpdateMode( sal_False ); - - bHighlightning = sal_True; - sal_uInt16 nLine; - void* p = aSyntaxLineTable.First(); - while ( p ) - { - nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey(); - DoSyntaxHighlight( nLine ); - p = aSyntaxLineTable.Next(); - } - - // #i45572# - if ( pEditView ) - pEditView->ShowCursor( sal_False, sal_True ); - - pEditEngine->SetModified( bWasModified ); - - aSyntaxLineTable.Clear(); - bHighlightning = sal_False; - - return 0; -} - -void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted ) -{ - if ( pProgress ) - pProgress->StepProgress(); - - if ( !bInserted && ( nPara == TEXT_PARA_ALL ) ) - { - pModulWindow->GetBreakPoints().reset(); - pModulWindow->GetBreakPointWindow().Invalidate(); - aHighlighter.initialize( HIGHLIGHT_BASIC ); - } - else - { - // Brechpunkte Aktualisieren... - // keine Sonderbehandlung fuer EditEngine-CTOR ( Erste-Zeile-Problem ), - // da in diesem Moment noch keine BreakPoints. - // +1: Basic-Zeilen beginnen bei 1! - pModulWindow->GetBreakPoints().AdjustBreakPoints( (sal_uInt16)nPara+1, bInserted ); - - // Im BreakPointWindow invalidieren... - long nLineHeight = GetTextHeight(); - Size aSz = pModulWindow->GetBreakPointWindow().GetOutputSize(); - Rectangle aInvRec( Point( 0, 0 ), aSz ); - long nY = nPara*nLineHeight - pModulWindow->GetBreakPointWindow().GetCurYOffset(); - aInvRec.Top() = nY; - pModulWindow->GetBreakPointWindow().Invalidate( aInvRec ); - - if ( bDoSyntaxHighlight ) - { - String aDummy; - aHighlighter.notifyChange( nPara, bInserted ? 1 : (-1), &aDummy, 1 ); - } - } -} - -void EditorWindow::CreateProgress( const String& rText, sal_uLong nRange ) -{ - DBG_ASSERT( !pProgress, "ProgressInfo existiert schon" ); - pProgress = new ProgressInfo( IDE_DLL()->GetShell()->GetViewFrame()->GetObjectShell(), rText, nRange ); -} - -void EditorWindow::DestroyProgress() -{ - DELETEZ( pProgress ); -} - -void EditorWindow::ForceSyntaxTimeout() -{ - aSyntaxIdleTimer.Stop(); - ((Link&)aSyntaxIdleTimer.GetTimeoutHdl()).Call( &aSyntaxIdleTimer ); -} - - - -BreakPointWindow::BreakPointWindow( Window* pParent ) : - Window( pParent, WB_BORDER ) -{ - pModulWindow = 0; - nCurYOffset = 0; - setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor()); - nMarkerPos = MARKER_NOMARKER; - - // nCurYOffset merken und nicht von EditEngine holen. - // Falls in EditEngine autom. gescrollt wurde, wuesste ich sonst nicht, - // wo ich gerade stehe. - - SetHelpId( HID_BASICIDE_BREAKPOINTWINDOW ); -} - - - -BreakPointWindow::~BreakPointWindow() -{ -} - - - -void BreakPointWindow::Resize() -{ -/// Invalidate(); -} - - - -void BreakPointWindow::Paint( const Rectangle& ) -{ - if ( SyncYOffset() ) - return; - - Size aOutSz( GetOutputSize() ); - long nLineHeight = GetTextHeight(); - - Image aBrk1(((ModulWindowLayout *) pModulWindow->GetLayoutWindow())-> - getImage(IMGID_BRKENABLED)); - Image aBrk0(((ModulWindowLayout *) pModulWindow->GetLayoutWindow())-> - getImage(IMGID_BRKDISABLED)); - Size aBmpSz( aBrk1.GetSizePixel() ); - aBmpSz = PixelToLogic( aBmpSz ); - Point aBmpOff( 0, 0 ); - aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2; - aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2; - - for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i ) - { - BreakPoint* pBrk = GetBreakPoints().at( i ); - size_t nLine = pBrk->nLine-1; - size_t nY = nLine*nLineHeight - nCurYOffset; - DrawImage( Point( 0, nY ) + aBmpOff, pBrk->bEnabled ? aBrk1 : aBrk0 ); - } - ShowMarker( sal_True ); -} - - - -void BreakPointWindow::DoScroll( long nHorzScroll, long nVertScroll ) -{ - nCurYOffset -= nVertScroll; - Window::Scroll( nHorzScroll, nVertScroll ); -} - - - -void BreakPointWindow::SetMarkerPos( sal_uInt16 nLine, sal_Bool bError ) -{ - if ( SyncYOffset() ) - Update(); - - ShowMarker( sal_False ); // Alten wegzeichen... - nMarkerPos = nLine; - bErrorMarker = bError; - ShowMarker( sal_True ); // Neuen zeichnen... -} - -void BreakPointWindow::ShowMarker( sal_Bool bShow ) -{ - if ( nMarkerPos == MARKER_NOMARKER ) - return; - - Size aOutSz( GetOutputSize() ); - long nLineHeight = GetTextHeight(); - - Image aMarker(((ModulWindowLayout*)pModulWindow->GetLayoutWindow())-> - getImage(bErrorMarker - ? IMGID_ERRORMARKER : IMGID_STEPMARKER)); - - Size aMarkerSz( aMarker.GetSizePixel() ); - aMarkerSz = PixelToLogic( aMarkerSz ); - Point aMarkerOff( 0, 0 ); - aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2; - aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2; - - sal_uLong nY = nMarkerPos*nLineHeight - nCurYOffset; - Point aPos( 0, nY ); - aPos += aMarkerOff; - if ( bShow ) - DrawImage( aPos, aMarker ); - else - Invalidate( Rectangle( aPos, aMarkerSz ) ); -} - - - - -BreakPoint* BreakPointWindow::FindBreakPoint( const Point& rMousePos ) -{ - size_t nLineHeight = GetTextHeight(); - size_t nYPos = rMousePos.Y() + nCurYOffset; - - for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i ) - { - BreakPoint* pBrk = GetBreakPoints().at( i ); - size_t nLine = pBrk->nLine-1; - size_t nY = nLine*nLineHeight; - if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) ) - return pBrk; - } - return 0; -} - -void BreakPointWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if ( rMEvt.GetClicks() == 2 ) - { - Point aMousePos( PixelToLogic( rMEvt.GetPosPixel() ) ); - long nLineHeight = GetTextHeight(); - long nYPos = aMousePos.Y() + nCurYOffset; - long nLine = nYPos / nLineHeight + 1; - pModulWindow->ToggleBreakPoint( (sal_uLong)nLine ); - // vielleicht mal etwas genauer... - Invalidate(); - } -} - - - -void BreakPointWindow::Command( const CommandEvent& rCEvt ) -{ - if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) - { - Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) ); - Point aEventPos( PixelToLogic( aPos ) ); - BreakPoint* pBrk = rCEvt.IsMouseEvent() ? FindBreakPoint( aEventPos ) : 0; - if ( pBrk ) - { - // prueffen, ob Brechpunkt enabled.... - PopupMenu aBrkPropMenu( IDEResId( RID_POPUP_BRKPROPS ) ); - aBrkPropMenu.CheckItem( RID_ACTIV, pBrk->bEnabled ); - switch ( aBrkPropMenu.Execute( this, aPos ) ) - { - case RID_ACTIV: - { - pBrk->bEnabled = pBrk->bEnabled ? sal_False : sal_True; - pModulWindow->UpdateBreakPoint( *pBrk ); - Invalidate(); - } - break; - case RID_BRKPROPS: - { - BreakPointDialog aBrkDlg( this, GetBreakPoints() ); - aBrkDlg.SetCurrentBreakPoint( pBrk ); - aBrkDlg.Execute(); - Invalidate(); - } - break; - } - } - else - { - PopupMenu aBrkListMenu( IDEResId( RID_POPUP_BRKDLG ) ); - switch ( aBrkListMenu.Execute( this, aPos ) ) - { - case RID_BRKDLG: - { - BreakPointDialog aBrkDlg( this, GetBreakPoints() ); - aBrkDlg.Execute(); - Invalidate(); - } - break; - } - } - } -} - -sal_Bool BreakPointWindow::SyncYOffset() -{ - TextView* pView = pModulWindow->GetEditView(); - if ( pView ) - { - long nViewYOffset = pView->GetStartDocPos().Y(); - if ( nCurYOffset != nViewYOffset ) - { - nCurYOffset = nViewYOffset; - Invalidate(); - return sal_True; - } - } - return sal_False; -} - -// virtual -void BreakPointWindow::DataChanged(DataChangedEvent const & rDCEvt) -{ - Window::DataChanged(rDCEvt); - if (rDCEvt.GetType() == DATACHANGED_SETTINGS - && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0) - { - Color aColor(GetSettings().GetStyleSettings().GetFieldColor()); - if (aColor - != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor()) - { - setBackgroundColor(aColor); - Invalidate(); - } - } -} - -void BreakPointWindow::setBackgroundColor(Color aColor) -{ - SetBackground(Wallpaper(aColor)); -} - - -const sal_uInt16 ITEM_ID_VARIABLE = 1; -const sal_uInt16 ITEM_ID_VALUE = 2; -const sal_uInt16 ITEM_ID_TYPE = 3; - -WatchWindow::WatchWindow( Window* pParent ) : - BasicDockingWindow( pParent ), - aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ), - aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ), - aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ), - aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP - | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ), - aHeaderBar( this, WB_BUTTONSTYLE | WB_BORDER ) -{ - aXEdit.SetAccessibleName(String(IDEResId( RID_STR_WATCHNAME))); - aTreeListBox.SetAccessibleName(String(IDEResId(RID_STR_WATCHNAME))); - - nVirtToolBoxHeight = aXEdit.GetSizePixel().Height() + 7; - nHeaderBarHeight = 16; - - aTreeListBox.SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST); - aTreeListBox.EnableInplaceEditing( sal_True ); - aTreeListBox.SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) ); - aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) ); - aTreeListBox.SetHighlightRange( 1, 5 ); - - Point aPnt( DWBORDER, nVirtToolBoxHeight + 1 ); - aHeaderBar.SetPosPixel( aPnt ); - aHeaderBar.SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) ); - - long nVarTabWidth = 220; - long nValueTabWidth = 100; - long nTypeTabWidth = 1250; - aHeaderBar.InsertItem( ITEM_ID_VARIABLE, String( IDEResId( RID_STR_WATCHVARIABLE ) ), nVarTabWidth ); - aHeaderBar.InsertItem( ITEM_ID_VALUE, String( IDEResId( RID_STR_WATCHVALUE ) ), nValueTabWidth ); - aHeaderBar.InsertItem( ITEM_ID_TYPE, String( IDEResId( RID_STR_WATCHTYPE ) ), nTypeTabWidth ); - - long tabs[ 4 ]; - tabs[ 0 ] = 3; // two tabs - tabs[ 1 ] = 0; - tabs[ 2 ] = nVarTabWidth; - tabs[ 3 ] = nVarTabWidth + nValueTabWidth; - aTreeListBox.SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL ); - aTreeListBox.InitHeaderBar( &aHeaderBar ); - - aTreeListBox.SetNodeDefaultImages( ); - - aHeaderBar.Show(); - - aRemoveWatchButton.Disable(); - - aTreeListBox.Show(); - - long nTextLen = GetTextWidth( aWatchStr ) + DWBORDER; - aXEdit.SetPosPixel( Point( nTextLen, 3 ) ); - aXEdit.SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) ); - aXEdit.GetAccelerator().InsertItem( 1, KeyCode( KEY_RETURN ) ); - aXEdit.GetAccelerator().InsertItem( 2, KeyCode( KEY_ESCAPE ) ); - aXEdit.Show(); - - aRemoveWatchButton.SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) ); - aRemoveWatchButton.SetPosPixel( Point( nTextLen + aXEdit.GetSizePixel().Width() + 4, 2 ) ); - Size aSz( aRemoveWatchButton.GetModeImage().GetSizePixel() ); - aSz.Width() += 6; - aSz.Height() += 6; - aRemoveWatchButton.SetSizePixel( aSz ); - aRemoveWatchButton.Show(); - - SetText( String( IDEResId( RID_STR_WATCHNAME ) ) ); - - SetHelpId( HID_BASICIDE_WATCHWINDOW ); - - // make watch window keyboard accessible - GetSystemWindow()->GetTaskPaneList()->AddWindow( this ); -} - - - -WatchWindow::~WatchWindow() -{ - GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); -} - - - -void WatchWindow::Paint( const Rectangle& ) -{ - DrawText( Point( DWBORDER, 7 ), aWatchStr ); - lcl_DrawIDEWindowFrame( this ); -} - - - -void WatchWindow::Resize() -{ - Size aSz = GetOutputSizePixel(); - Size aBoxSz( aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER ); - - if ( aBoxSz.Width() < 4 ) // < 4, weil noch Border... - aBoxSz.Width() = 0; - if ( aBoxSz.Height() < 4 ) - aBoxSz.Height() = 0; - - aBoxSz.Height() -= nHeaderBarHeight; - aTreeListBox.SetSizePixel( aBoxSz ); - aTreeListBox.GetHScroll()->SetPageSize( aTreeListBox.GetHScroll()->GetVisibleSize() ); - - aBoxSz.Height() = nHeaderBarHeight; - aHeaderBar.SetSizePixel( aBoxSz ); - - Invalidate(); //Wegen DrawLine im Paint... -} - -struct MemberList -{ - String* mpMemberNames; - int mnMemberCount; - - MemberList( void ) - : mpMemberNames( NULL ) - , mnMemberCount( 0 ) - {} - ~MemberList() - { - clear(); - } - - void clear( void ); - void allocList( int nCount ); -}; - -void MemberList::clear( void ) -{ - if( mnMemberCount ) - { - delete[] mpMemberNames; - mnMemberCount = 0; - } -} - -void MemberList::allocList( int nCount ) -{ - clear(); - if( nCount > 0 ) - { - mnMemberCount = nCount; - mpMemberNames = new String[ mnMemberCount ]; - } -} - -struct WatchItem -{ - String maName; - String maDisplayName; - SbxObjectRef mpObject; - MemberList maMemberList; - - SbxDimArrayRef mpArray; - int nDimLevel; // 0 = Root - int nDimCount; - short* pIndices; - - WatchItem* mpArrayParentItem; - - WatchItem( void ) - : nDimLevel( 0 ) - , nDimCount( 0 ) - , pIndices( NULL ) - , mpArrayParentItem( NULL ) - {} - ~WatchItem() - { clearWatchItem(); } - - void clearWatchItem( bool bIncludeArrayData=true ) - { - mpObject = NULL; - maMemberList.clear(); - if( bIncludeArrayData ) - { - mpArray = NULL; - nDimLevel = 0; - nDimCount = 0; - delete[] pIndices; - pIndices = NULL; - } - } - - WatchItem* GetRootItem( void ); - SbxDimArray* GetRootArray( void ); -}; - -WatchItem* WatchItem::GetRootItem( void ) -{ - WatchItem* pItem = mpArrayParentItem; - while( pItem ) - { - if( pItem->mpArray.Is() ) - break; - pItem = pItem->mpArrayParentItem; - } - return pItem; -} - -SbxDimArray* WatchItem::GetRootArray( void ) -{ - WatchItem* pRootItem = GetRootItem(); - SbxDimArray* pRet = NULL; - if( pRootItem ) - pRet = pRootItem->mpArray; - return pRet; -} - -void WatchWindow::AddWatch( const String& rVName ) -{ - WatchItem* pWatchItem = new WatchItem; - String aVar, aIndex; - lcl_SeparateNameAndIndex( rVName, aVar, aIndex ); - pWatchItem->maName = aVar; - - String aWatchStr_( aVar ); - aWatchStr_ += String( RTL_CONSTASCII_USTRINGPARAM( "\t\t" ) ); - SvLBoxEntry* pNewEntry = aTreeListBox.InsertEntry( aWatchStr_, 0, sal_True, LIST_APPEND ); - pNewEntry->SetUserData( pWatchItem ); - - aTreeListBox.Select( pNewEntry, sal_True ); - aTreeListBox.MakeVisible( pNewEntry ); - aRemoveWatchButton.Enable(); -} - -sal_Bool WatchWindow::RemoveSelectedWatch() -{ - SvLBoxEntry* pEntry = aTreeListBox.GetCurEntry(); - if ( pEntry ) - { - aTreeListBox.GetModel()->Remove( pEntry ); - pEntry = aTreeListBox.GetCurEntry(); - if ( pEntry ) - aXEdit.SetText( ((WatchItem*)pEntry->GetUserData())->maName ); - else - aXEdit.SetText( String() ); - if ( !aTreeListBox.GetEntryCount() ) - aRemoveWatchButton.Disable(); - return sal_True; - } - else - return sal_False; -} - - -IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton ) -{ - if ( pButton == &aRemoveWatchButton ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_REMOVEWATCH ); - } - } - return 0; -} -IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton ) - - - -IMPL_LINK_INLINE_START( WatchWindow, TreeListHdl, SvTreeListBox *, EMPTYARG ) -{ - SvLBoxEntry* pCurEntry = aTreeListBox.GetCurEntry(); - if ( pCurEntry && pCurEntry->GetUserData() ) - aXEdit.SetText( ((WatchItem*)pCurEntry->GetUserData())->maName ); - - return 0; -} -IMPL_LINK_INLINE_END( WatchWindow, TreeListHdl, SvTreeListBox *, EMPTYARG ) - - -IMPL_LINK_INLINE_START( WatchWindow, implEndDragHdl, HeaderBar *, pBar ) -{ - (void)pBar; - - const sal_Int32 TAB_WIDTH_MIN = 10; - sal_Int32 nMaxWidth = - aHeaderBar.GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN; - - sal_Int32 nVariableWith = aHeaderBar.GetItemSize( ITEM_ID_VARIABLE ); - if( nVariableWith < TAB_WIDTH_MIN ) - aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN ); - else if( nVariableWith > nMaxWidth ) - aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, nMaxWidth ); - - sal_Int32 nValueWith = aHeaderBar.GetItemSize( ITEM_ID_VALUE ); - if( nValueWith < TAB_WIDTH_MIN ) - aHeaderBar.SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN ); - else if( nValueWith > nMaxWidth ) - aHeaderBar.SetItemSize( ITEM_ID_VALUE, nMaxWidth ); - - if (aHeaderBar.GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN) - aHeaderBar.SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN ); - - sal_Int32 nPos = 0; - sal_uInt16 nTabs = aHeaderBar.GetItemCount(); - for( sal_uInt16 i = 1 ; i < nTabs ; ++i ) - { - nPos += aHeaderBar.GetItemSize( i ); - aTreeListBox.SetTab( i, nPos, MAP_PIXEL ); - } - return 0; -} -IMPL_LINK_INLINE_END( WatchWindow, implEndDragHdl, HeaderBar *, pBar ) - - -IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc ) -{ - switch ( pAcc->GetCurKeyCode().GetCode() ) - { - case KEY_RETURN: - { - String aCurText( aXEdit.GetText() ); - if ( aCurText.Len() ) - { - AddWatch( aCurText ); - aXEdit.SetSelection( Selection( 0, 0xFFFF ) ); - UpdateWatches(); - } - else - Sound::Beep(); - } - break; - case KEY_ESCAPE: - { - aXEdit.SetText( String() ); - } - break; - } - - return 0; -} - -void WatchWindow::UpdateWatches( bool bBasicStopped ) -{ - aTreeListBox.UpdateWatches( bBasicStopped ); -} - - -StackWindow::StackWindow( Window* pParent ) : - BasicDockingWindow( pParent ), - aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ), - aStackStr( IDEResId( RID_STR_STACK ) ) -{ - aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST); - aTreeListBox.SetAccessibleName(String( IDEResId(RID_STR_STACKNAME))); - aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) ); - aTreeListBox.SetHighlightRange(); - aTreeListBox.SetSelectionMode( NO_SELECTION ); - aTreeListBox.InsertEntry( String(), 0, sal_False, LIST_APPEND ); - aTreeListBox.Show(); - - SetText( String( IDEResId( RID_STR_STACKNAME ) ) ); - - SetHelpId( HID_BASICIDE_STACKWINDOW ); - - // make stack window keyboard accessible - GetSystemWindow()->GetTaskPaneList()->AddWindow( this ); -} - - - -StackWindow::~StackWindow() -{ - GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); -} - - - -void StackWindow::Paint( const Rectangle& ) -{ - DrawText( Point( DWBORDER, 7 ), aStackStr ); - lcl_DrawIDEWindowFrame( this ); -} - - - -void StackWindow::Resize() -{ - Size aSz = GetOutputSizePixel(); - Size aBoxSz( aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER ); - - if ( aBoxSz.Width() < 4 ) // < 4, weil noch Border... - aBoxSz.Width() = 0; - if ( aBoxSz.Height() < 4 ) - aBoxSz.Height() = 0; - - aTreeListBox.SetSizePixel( aBoxSz ); - - Invalidate(); //Wegen DrawLine im Paint... -} - - - -IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, /*pButton*/ ) -{ - return 0; -} -IMPL_LINK_INLINE_END( StackWindow, ButtonHdl, ImageButton *, pButton ) - - - -void StackWindow::UpdateCalls() -{ - aTreeListBox.SetUpdateMode( sal_False ); - aTreeListBox.Clear(); - - if ( StarBASIC::IsRunning() ) - { - SbxError eOld = SbxBase::GetError(); - aTreeListBox.SetSelectionMode( SINGLE_SELECTION ); - - sal_uInt16 nScope = 0; - SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope ); - while ( pMethod ) - { - String aEntry( String::CreateFromInt32(nScope )); - if ( aEntry.Len() < 2 ) - aEntry.Insert( ' ', 0 ); - aEntry += String( RTL_CONSTASCII_USTRINGPARAM( ": " ) ); - aEntry += pMethod->GetName(); - SbxArray* pParams = pMethod->GetParameters(); - SbxInfo* pInfo = pMethod->GetInfo(); - if ( pParams ) - { - aEntry += '('; - // 0 ist der Name der Sub... - for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ ) - { - SbxVariable* pVar = pParams->Get( nParam ); - DBG_ASSERT( pVar, "Parameter?!" ); - if ( pVar->GetName().Len() ) - aEntry += pVar->GetName(); - else if ( pInfo ) - { - const SbxParamInfo* pParam = pInfo->GetParam( nParam ); - if ( pParam ) - aEntry += pParam->aName; - } - aEntry += '='; - SbxDataType eType = pVar->GetType(); - if( eType & SbxARRAY ) - aEntry += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); - else if( eType != SbxOBJECT ) - aEntry += pVar->GetString(); - if ( nParam < ( pParams->Count() - 1 ) ) - aEntry += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - } - aEntry += ')'; - } - aTreeListBox.InsertEntry( aEntry, 0, sal_False, LIST_APPEND ); - nScope++; - pMethod = StarBASIC::GetActiveMethod( nScope ); - } - - SbxBase::ResetError(); - if( eOld != SbxERR_OK ) - SbxBase::SetError( eOld ); - } - else - { - aTreeListBox.SetSelectionMode( NO_SELECTION ); - aTreeListBox.InsertEntry( String(), 0, sal_False, LIST_APPEND ); - } - - aTreeListBox.SetUpdateMode( sal_True ); -} - - - - -ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : - Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ), - aBrkWindow( this ), - aEdtWindow( this ), - aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ) -{ - aEdtWindow.SetModulWindow( pParent ); - aBrkWindow.SetModulWindow( pParent ); - aEdtWindow.Show(); - aBrkWindow.Show(); - - aEWVScrollBar.SetLineSize( SCROLL_LINE ); - aEWVScrollBar.SetPageSize( SCROLL_PAGE ); - aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) ); - aEWVScrollBar.Show(); -} - - - -void ComplexEditorWindow::Resize() -{ - Size aOutSz = GetOutputSizePixel(); - Size aSz( aOutSz ); - aSz.Width() -= 2*DWBORDER; - aSz.Height() -= 2*DWBORDER; - long nBrkWidth = 20; - long nSBWidth = aEWVScrollBar.GetSizePixel().Width(); - - Size aBrkSz( Size( nBrkWidth, aSz.Height() ) ); - aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); - - Size aEWSz( Size( aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height() ) ); - aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()-1, DWBORDER ), aEWSz ); - - aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); -} - -IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) -{ - if ( aEdtWindow.GetEditView() ) - { - DBG_ASSERT( pCurScrollBar == &aEWVScrollBar, "Wer scrollt hier ?" ); - long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos(); - aEdtWindow.GetEditView()->Scroll( 0, nDiff ); - aBrkWindow.DoScroll( 0, nDiff ); - aEdtWindow.GetEditView()->ShowCursor( sal_False, sal_True ); - pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() ); - } - - return 0; -} - -void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt) -{ - Window::DataChanged(rDCEvt); - if (rDCEvt.GetType() == DATACHANGED_SETTINGS - && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0) - { - Color aColor(GetSettings().GetStyleSettings().GetFaceColor()); - if (aColor - != rDCEvt.GetOldSettings()->GetStyleSettings().GetFaceColor()) - { - SetBackground(Wallpaper(aColor)); - Invalidate(); - } - } -} - -uno::Reference< awt::XWindowPeer > -EditorWindow::GetComponentInterface(sal_Bool bCreate) -{ - uno::Reference< awt::XWindowPeer > xPeer( - Window::GetComponentInterface(false)); - if (!xPeer.is() && bCreate) - { - // Make sure edit engine and view are available: - if (!pEditEngine) - CreateEditEngine(); - - xPeer = new ::svt::TextWindowPeer(*GetEditView()); - SetComponentInterface(xPeer); - } - return xPeer; -} - -WatchTreeListBox::WatchTreeListBox( Window* pParent, WinBits nWinBits ) - : SvHeaderTabListBox( pParent, nWinBits ) -{} - -WatchTreeListBox::~WatchTreeListBox() -{ - // Destroy user data - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - delete (WatchItem*)pEntry->GetUserData(); - pEntry = Next( pEntry ); - } -} - -void WatchTreeListBox::SetTabs() -{ - SvHeaderTabListBox::SetTabs(); - sal_uInt16 nTabCount_ = aTabs.Count(); - for( sal_uInt16 i = 0 ; i < nTabCount_ ; i++ ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(i); - if( i == 2 ) - pTab->nFlags |= SV_LBOXTAB_EDITABLE; - else - pTab->nFlags &= ~SV_LBOXTAB_EDITABLE; - } -} - -void WatchTreeListBox::RequestingChilds( SvLBoxEntry * pParent ) -{ - if( !StarBASIC::IsRunning() ) - return; - - if( GetChildCount( pParent ) > 0 ) - return; - - SvLBoxEntry * pEntry = pParent; - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - - SbxDimArray* pArray = pItem->mpArray; - SbxDimArray* pRootArray = pItem->GetRootArray(); - bool bArrayIsRootArray = false; - if( !pArray && pRootArray ) - { - pArray = pRootArray; - bArrayIsRootArray = true; - } - - SbxObject* pObj = pItem->mpObject; - if( pObj ) - { - createAllObjectProperties( pObj ); - SbxArray* pProps = pObj->GetProperties(); - sal_uInt16 nPropCount = pProps->Count(); - pItem->maMemberList.allocList( nPropCount ); - - for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ ) - { - SbxVariable* pVar = pProps->Get( i ); - - String aName( pVar->GetName() ); - pItem->maMemberList.mpMemberNames[i] = aName; - SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aName, pEntry ); - WatchItem* pChildItem = new WatchItem(); - pChildItem->maName = aName; - pChildEntry->SetUserData( pChildItem ); - } - if( nPropCount > 0 ) - { - UpdateWatches(); - } - } - else if( pArray ) - { - sal_uInt16 nElementCount = 0; - - // Loop through indices of current level - int nParentLevel = bArrayIsRootArray ? pItem->nDimLevel : 0; - int nThisLevel = nParentLevel + 1; - sal_Int32 nMin, nMax; - pArray->GetDim32( nThisLevel, nMin, nMax ); - for( sal_Int32 i = nMin ; i <= nMax ; i++ ) - { - WatchItem* pChildItem = new WatchItem(); - - // Copy data and create name - String aBaseName( pItem->maName ); - pChildItem->maName = aBaseName; - - String aIndexStr = String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ); - pChildItem->mpArrayParentItem = pItem; - pChildItem->nDimLevel = nThisLevel; - pChildItem->nDimCount = pItem->nDimCount; - pChildItem->pIndices = new short[ pChildItem->nDimCount ]; - sal_uInt16 j; - for( j = 0 ; j < nParentLevel ; j++ ) - { - short n = pChildItem->pIndices[j] = pItem->pIndices[j]; - aIndexStr += String::CreateFromInt32( n ); - aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( "," ) ); - } - pChildItem->pIndices[ nParentLevel ] = sal::static_int_cast( i ); - aIndexStr += String::CreateFromInt32( i ); - aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); - - String aDisplayName; - WatchItem* pArrayRootItem = pChildItem->GetRootItem(); - if( pArrayRootItem && pArrayRootItem->mpArrayParentItem ) - aDisplayName = pItem->maDisplayName; - else - aDisplayName = aBaseName; - aDisplayName += aIndexStr; - pChildItem->maDisplayName = aDisplayName; - - SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aDisplayName, pEntry ); - nElementCount++; - pChildEntry->SetUserData( pChildItem ); - } - if( nElementCount > 0 ) - { - UpdateWatches(); - } - } -} - -SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArrayElement ) -{ - SbxBase* pSBX = NULL; - rbArrayElement = false; - - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - String aVName( pItem->maName ); - - SvLBoxEntry* pParentEntry = GetParent( pEntry ); - WatchItem* pParentItem = pParentEntry ? (WatchItem*)pParentEntry->GetUserData() : NULL; - if( pParentItem ) - { - SbxObject* pObj = pParentItem->mpObject; - SbxDimArray* pArray; - if( pObj ) - { - pSBX = pObj->Find( aVName, SbxCLASS_DONTCARE ); - - SbxVariable* pVar; - if ( pSBX && (pVar = PTR_CAST( SbxVariable, pSBX )) != NULL - && !pSBX->ISA( SbxMethod ) ) - { - // Force getting value - SbxValues aRes; - aRes.eType = SbxVOID; - pVar->Get( aRes ); - } - } - // Array? - else if( (pArray = pItem->GetRootArray()) != NULL ) - { - rbArrayElement = true; - if( pParentItem->nDimLevel + 1 == pParentItem->nDimCount ) - pSBX = pArray->Get( pItem->pIndices ); - } - } - else - { - pSBX = StarBASIC::FindSBXInCurrentScope( aVName ); - } - return pSBX; -} - -sal_Bool WatchTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) -{ - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - - sal_Bool bEdit = sal_False; - if ( StarBASIC::IsRunning() && StarBASIC::GetActiveMethod() && !SbxBase::IsError() ) - { - // No out of scope entries - bool bArrayElement; - SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement ); - if ( ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) || bArrayElement ) - { - // Accept no objects and only end nodes of arrays for editing - if( !pItem->mpObject && (pItem->mpArray == NULL || pItem->nDimLevel == pItem->nDimCount) ) - { - aEditingRes = SvHeaderTabListBox::GetEntryText( pEntry, ITEM_ID_VALUE-1 ); - aEditingRes.EraseLeadingChars(); - aEditingRes.EraseTrailingChars(); - bEdit = sal_True; - } - } - } - - if ( !bEdit ) - Sound::Beep(); - - return bEdit; -} - -sal_Bool WatchTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ) -{ - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - String aVName( pItem->maName ); - - String aResult = rNewText; - aResult.EraseLeadingChars(); - aResult.EraseTrailingChars(); - - sal_uInt16 nResultLen = aResult.Len(); - sal_Unicode cFirst = aResult.GetChar( 0 ); - sal_Unicode cLast = aResult.GetChar( nResultLen - 1 ); - if( cFirst == '\"' && cLast == '\"' ) - aResult = aResult.Copy( 1, nResultLen - 2 ); - - sal_Bool bResModified = ( aResult != aEditingRes ) ? sal_True : sal_False; - sal_Bool bError = sal_False; - if ( !aVName.Len() ) - { - bError = sal_True; - } - - sal_Bool bRet = sal_False; - - if ( bError ) - { - Sound::Beep(); - } - else if ( bResModified ) - { - bRet = ImplBasicEntryEdited( pEntry, aResult ); - } - - return bRet; -} - -sal_Bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& rResult ) -{ - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - String aVName( pItem->maName ); - - sal_Bool bError = sal_False; - String aResult( rResult ); - String aIndex; - bool bArrayElement; - SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement ); - - SbxBase* pToBeChanged = NULL; - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) - { - SbxVariable* pVar = (SbxVariable*)pSBX; - SbxDataType eType = pVar->GetType(); - if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT ) - bError = sal_True; - else if ( eType & SbxARRAY ) - bError = sal_True; - else - pToBeChanged = pSBX; - } - - if ( pToBeChanged ) - { - if ( pToBeChanged->ISA( SbxVariable ) ) - { - // Wenn der Typ variabel ist, macht die Konvertierung des SBX nichts, - // bei festem Typ wird der String konvertiert. - ((SbxVariable*)pToBeChanged)->PutStringExt( aResult ); - } - else - bError = sal_True; - } - - // Wenn jemand z.B. einen zu grossen Wert fuer ein Int eingegeben hat, - // folgt beim naechsten Step() ein Runtime-Error. - if ( SbxBase::IsError() ) - { - bError = sal_True; - SbxBase::ResetError(); - } - - if ( bError ) - Sound::Beep(); - - UpdateWatches(); - - // The text should never be taken/copied 1:1, - // as the UpdateWatches will be lost - return sal_False; -} - - -static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis ) -{ - pThis->Collapse( pParent ); - - SvLBoxTreeList* pModel = pThis->GetModel(); - SvLBoxEntry* pDeleteEntry; - while( (pDeleteEntry = pThis->SvTreeListBox::GetEntry( pParent, 0 )) != NULL ) - { - implCollapseModifiedObjectEntry( pDeleteEntry, pThis ); - - WatchItem* pItem = (WatchItem*)pDeleteEntry->GetUserData(); - delete pItem; - pModel->Remove( pDeleteEntry ); - } -} - -static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType ) -{ - String aRetStr = getBasicTypeName( eType ); - - SbxDimArray* pArray = pItem->mpArray; - if( !pArray ) - pArray = pItem->GetRootArray(); - if( pArray ) - { - int nDimLevel = pItem->nDimLevel; - int nDims = pItem->nDimCount; - if( nDimLevel < nDims ) - { - aRetStr += '('; - for( int i = nDimLevel ; i < nDims ; i++ ) - { - short nMin, nMax; - pArray->GetDim( sal::static_int_cast( i+1 ), nMin, nMax ); - aRetStr += String::CreateFromInt32( nMin ); - aRetStr += String( RTL_CONSTASCII_USTRINGPARAM( " to " ) ); - aRetStr += String::CreateFromInt32( nMax ); - if( i < nDims - 1 ) - aRetStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - } - aRetStr += ')'; - } - } - return aRetStr; -} - - -void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable ) -{ - if( bEnable ) - { - pEntry->SetFlags( - (pEntry->GetFlags() & - ~(SV_ENTRYFLAG_NO_NODEBMP | SV_ENTRYFLAG_HAD_CHILDREN)) - | SV_ENTRYFLAG_CHILDS_ON_DEMAND ); - } - else - { - pEntry->SetFlags( - (pEntry->GetFlags() & ~(SV_ENTRYFLAG_CHILDS_ON_DEMAND)) ); - } -} - -void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) -{ - SbMethod* pCurMethod = StarBASIC::GetActiveMethod(); - - SbxError eOld = SbxBase::GetError(); - setBasicWatchMode( true ); - - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - WatchItem* pItem = (WatchItem*)pEntry->GetUserData(); - String aVName( pItem->maName ); - DBG_ASSERT( aVName.Len(), "Var? - Must not be empty!" ); - String aWatchStr; - String aTypeStr; - if ( pCurMethod ) - { - bool bArrayElement; - SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement ); - - // Array? If no end node create type string - if( bArrayElement && pItem->nDimLevel < pItem->nDimCount ) - { - SbxDimArray* pRootArray = pItem->GetRootArray(); - SbxDataType eType = pRootArray->GetType(); - aTypeStr = implCreateTypeStringForDimArray( pItem, eType ); - implEnableChildren( pEntry, true ); - } - - bool bCollapse = false; - if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) - { - SbxVariable* pVar = (SbxVariable*)pSBX; - // extra treatment of arrays - SbxDataType eType = pVar->GetType(); - if ( eType & SbxARRAY ) - { - // Mehrdimensionale Arrays beruecksichtigen! - SbxBase* pBase = pVar->GetObject(); - if ( pBase && pBase->ISA( SbxDimArray ) ) - { - SbxDimArray* pNewArray = (SbxDimArray*)pBase; - SbxDimArray* pOldArray = pItem->mpArray; - - bool bArrayChanged = false; - if( pNewArray != NULL && pOldArray != NULL ) - { - // Compare Array dimensions to see if array has changed - // Can be a copy, so comparing pointers does not work - sal_uInt16 nOldDims = pOldArray->GetDims(); - sal_uInt16 nNewDims = pNewArray->GetDims(); - if( nOldDims != nNewDims ) - { - bArrayChanged = true; - } - else - { - for( int i = 0 ; i < nOldDims ; i++ ) - { - short nOldMin, nOldMax; - short nNewMin, nNewMax; - - pOldArray->GetDim( sal::static_int_cast( i+1 ), nOldMin, nOldMax ); - pNewArray->GetDim( sal::static_int_cast( i+1 ), nNewMin, nNewMax ); - if( nOldMin != nNewMin || nOldMax != nNewMax ) - { - bArrayChanged = true; - break; - } - } - } - } - else if( pNewArray == NULL || pOldArray == NULL ) - bArrayChanged = true; - - if( pNewArray ) - implEnableChildren( pEntry, true ); - - // #i37227 Clear always and replace array - if( pNewArray != pOldArray ) - { - pItem->clearWatchItem( false ); - if( pNewArray ) - { - implEnableChildren( pEntry, true ); - - pItem->mpArray = pNewArray; - sal_uInt16 nDims = pNewArray->GetDims(); - pItem->nDimLevel = 0; - pItem->nDimCount = nDims; - } - } - if( bArrayChanged && pOldArray != NULL ) - bCollapse = true; - - aTypeStr = implCreateTypeStringForDimArray( pItem, eType ); - } - else - aWatchStr += String( RTL_CONSTASCII_USTRINGPARAM( "" ) ); - } - else if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT ) - { - SbxObject* pObj = NULL; - SbxBase* pBase = pVar->GetObject(); - if( pBase && pBase->ISA( SbxObject ) ) - pObj = (SbxObject*)pBase; - - if( pObj ) - { - // Check if member list has changed - bool bObjChanged = false; - if( pItem->mpObject != NULL && pItem->maMemberList.mpMemberNames != NULL ) - { - SbxArray* pProps = pObj->GetProperties(); - sal_uInt16 nPropCount = pProps->Count(); - for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ ) - { - SbxVariable* pVar_ = pProps->Get( i ); - String aName( pVar_->GetName() ); - if( pItem->maMemberList.mpMemberNames[i] != aName ) - { - bObjChanged = true; - break; - } - } - if( bObjChanged ) - bCollapse = true; - } - - pItem->mpObject = pObj; - implEnableChildren( pEntry, true ); - aTypeStr = getBasicObjectTypeName( pObj ); - } - else - { - aWatchStr = String( RTL_CONSTASCII_USTRINGPARAM( "Null" ) ); - if( pItem->mpObject != NULL ) - { - bCollapse = true; - pItem->clearWatchItem( false ); - - implEnableChildren( pEntry, false ); - } - } - } - else - { - if( pItem->mpObject != NULL ) - { - bCollapse = true; - pItem->clearWatchItem( false ); - - implEnableChildren( pEntry, false ); - } - - bool bString = ((sal_uInt8)eType == (sal_uInt8)SbxSTRING); - String aStrStr( RTL_CONSTASCII_USTRINGPARAM( "\"" ) ); - if( bString ) - aWatchStr += aStrStr; - aWatchStr += pVar->GetString(); - if( bString ) - aWatchStr += aStrStr; - } - if( !aTypeStr.Len() ) - { - if( !pVar->IsFixed() ) - aTypeStr = String( RTL_CONSTASCII_USTRINGPARAM( "Variant/" ) ); - aTypeStr += getBasicTypeName( pVar->GetType() ); - } - } - else if( !bArrayElement ) - aWatchStr += String( RTL_CONSTASCII_USTRINGPARAM( "" ) ); - - if( bCollapse ) - implCollapseModifiedObjectEntry( pEntry, this ); - - } - else if( bBasicStopped ) - { - if( pItem->mpObject || pItem->mpArray ) - { - implCollapseModifiedObjectEntry( pEntry, this ); - pItem->mpObject = NULL; - } - } - - SvHeaderTabListBox::SetEntryText( aWatchStr, pEntry, ITEM_ID_VALUE-1 ); - SvHeaderTabListBox::SetEntryText( aTypeStr, pEntry, ITEM_ID_TYPE-1 ); - - pEntry = Next( pEntry ); - } - - // Force redraw - Invalidate(); - - SbxBase::ResetError(); - if( eOld != SbxERR_OK ) - SbxBase::SetError( eOld ); - setBasicWatchMode( false ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx deleted file mode 100644 index 03d264a1a..000000000 --- a/basctl/source/basicide/baside3.cxx +++ /dev/null @@ -1,1393 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#define _SDR_NOITEMS -#define _SDR_NOTOUCH -#define _SDR_NOTRANSFORM -#define _SDR_NOOBJECTS -#define _SDR_NOVIEWMARKER -#define _SDR_NODRAGMETHODS -#define _SDR_NOXOUTDEV - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::resource; -using namespace ::com::sun::star::ui::dialogs; - -#if defined(UNX) -#define FILTERMASK_ALL "*" -#else -#define FILTERMASK_ALL "*.*" -#endif - -DBG_NAME( DialogWindow ) - -TYPEINIT1( DialogWindow, IDEBaseWindow ); - -DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName, - const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xDialogModel ) - :IDEBaseWindow( pParent, rDocument, aLibName, aName ) - ,pUndoMgr(NULL) -{ - InitSettings( sal_True, sal_True, sal_True ); - - pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - pEditor->SetWindow( this ); - pEditor->SetDialog( xDialogModel ); - - // Undo einrichten - pUndoMgr = new SfxUndoManager; - - Link aDummyLink; - aOldNotifyUndoActionHdl = pEditor->GetModel()->GetNotifyUndoActionHdl(); - pEditor->GetModel()->SetNotifyUndoActionHdl( - LINK(this, DialogWindow, NotifyUndoActionHdl)); - - SetHelpId( HID_BASICIDE_DIALOGWINDOW ); - - // set readonly mode for readonly libraries - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) - SetReadOnly( sal_True ); - - if ( rDocument.isDocument() && rDocument.isReadOnly() ) - SetReadOnly( sal_True ); -} - -DialogWindow::~DialogWindow() -{ - delete pEditor; - delete pUndoMgr; -} - -void DialogWindow::LoseFocus() -{ - if ( IsModified() ) - StoreData(); - - Window::LoseFocus(); -} - - - -void DialogWindow::Paint( const Rectangle& rRect ) -{ - pEditor->Paint( rRect ); -} - - - -void DialogWindow::Resize() -{ - if ( GetHScrollBar() && GetVScrollBar() ) { - pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() ); - } -} - - - -void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt ) -{ - pEditor->MouseButtonDown( rMEvt ); - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); -} - - - -void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt ) -{ - pEditor->MouseButtonUp( rMEvt ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if( (pEditor->GetMode() == DLGED_INSERT) && !pEditor->IsCreateOK() ) - { - pEditor->SetMode( DLGED_SELECT ); - if ( pBindings ) - pBindings->Invalidate( SID_CHOOSE_CONTROLS ); - } - if ( pBindings ) - { - pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); - pBindings->Invalidate( SID_DOC_MODIFIED ); - pBindings->Invalidate( SID_SAVEDOC ); - } -} - - - -void DialogWindow::MouseMove( const MouseEvent& rMEvt ) -{ - pEditor->MouseMove( rMEvt ); -} - - - -void DialogWindow::KeyInput( const KeyEvent& rKEvt ) -{ - if( rKEvt.GetKeyCode() == KEY_BACKSPACE ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BACKSPACE ); - } - } - else - { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if( pBindings && rKEvt.GetKeyCode() == KEY_TAB ) - pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); - - if( !pEditor->KeyInput( rKEvt ) ) - { - if( !SfxViewShell::Current()->KeyInput( rKEvt ) ) - Window::KeyInput( rKEvt ); - } - } -} - -void DialogWindow::Command( const CommandEvent& rCEvt ) -{ - if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) || - ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) || - ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) ) - { - HandleScrollCommand( rCEvt, GetHScrollBar(), GetVScrollBar() ); - } - else if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - { - SdrView* pView = GetView(); - if( !rCEvt.IsMouseEvent() && pView->AreObjectsMarked() ) - { - Rectangle aMarkedRect( pView->GetMarkedRect() ); - Point MarkedCenter( aMarkedRect.Center() ); - Point PosPixel( LogicToPixel( MarkedCenter ) ); - pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED), this, &PosPixel ); - } - else - { - pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED) ); - } - - } - } - else - IDEBaseWindow::Command( rCEvt ); -} - - - - -IMPL_LINK( DialogWindow, NotifyUndoActionHdl, SfxUndoAction *, pUndoAction ) -{ - (void)pUndoAction; - - return 0; -} - - - -void DialogWindow::DoInit() -{ - GetHScrollBar()->Show(); - GetVScrollBar()->Show(); - pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() ); -} - - - -void DialogWindow::DoScroll( ScrollBar* pCurScrollBar ) -{ - pEditor->DoScroll( pCurScrollBar ); -} - -void DialogWindow::GetState( SfxItemSet& rSet ) -{ - SfxWhichIter aIter(rSet); - for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() ) - { - switch ( nWh ) - { - case SID_PASTE: - { - if ( !IsPasteAllowed() ) - rSet.DisableItem( nWh ); - - if ( IsReadOnly() ) - rSet.DisableItem( nWh ); - } - break; - case SID_COPY: - { - // any object selected? - if ( !pEditor->GetView()->AreObjectsMarked() ) - rSet.DisableItem( nWh ); - } - break; - case SID_CUT: - case SID_DELETE: - case SID_BACKSPACE: - { - // any object selected? - if ( !pEditor->GetView()->AreObjectsMarked() ) - rSet.DisableItem( nWh ); - - if ( IsReadOnly() ) - rSet.DisableItem( nWh ); - } - break; - case SID_REDO: - { - if ( !pUndoMgr->GetUndoActionCount() ) - rSet.DisableItem( nWh ); - } - break; - - // Nur Dialogfenster: - case SID_DIALOG_TESTMODE: - { - // ist die IDE noch aktiv? - if( IDE_DLL()->GetShell()->GetFrame() ) - { - rSet.Put( SfxBoolItem( SID_DIALOG_TESTMODE, - (pEditor->GetMode() == DLGED_TEST) ? sal_True : sal_False) ); - } - else - rSet.Put( SfxBoolItem( SID_DIALOG_TESTMODE,sal_False )); - } - break; - - case SID_CHOOSE_CONTROLS: - { - if ( IsReadOnly() ) - { - rSet.DisableItem( nWh ); - } - else - { - SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS ); - if ( GetEditor()->GetMode() == DLGED_SELECT ) - aItem.SetValue( SVX_SNAP_SELECT ); - else - { - sal_uInt16 nObj; - switch( pEditor->GetInsertObj() ) - { - case OBJ_DLG_PUSHBUTTON: nObj = SVX_SNAP_PUSHBUTTON; break; - case OBJ_DLG_RADIOBUTTON: nObj = SVX_SNAP_RADIOBUTTON; break; - case OBJ_DLG_CHECKBOX: nObj = SVX_SNAP_CHECKBOX; break; - case OBJ_DLG_LISTBOX: nObj = SVX_SNAP_LISTBOX; break; - case OBJ_DLG_COMBOBOX: nObj = SVX_SNAP_COMBOBOX; break; - case OBJ_DLG_GROUPBOX: nObj = SVX_SNAP_GROUPBOX; break; - case OBJ_DLG_EDIT: nObj = SVX_SNAP_EDIT; break; - case OBJ_DLG_FIXEDTEXT: nObj = SVX_SNAP_FIXEDTEXT; break; - case OBJ_DLG_IMAGECONTROL: nObj = SVX_SNAP_IMAGECONTROL; break; - case OBJ_DLG_PROGRESSBAR: nObj = SVX_SNAP_PROGRESSBAR; break; - case OBJ_DLG_HSCROLLBAR: nObj = SVX_SNAP_HSCROLLBAR; break; - case OBJ_DLG_VSCROLLBAR: nObj = SVX_SNAP_VSCROLLBAR; break; - case OBJ_DLG_HFIXEDLINE: nObj = SVX_SNAP_HFIXEDLINE; break; - case OBJ_DLG_VFIXEDLINE: nObj = SVX_SNAP_VFIXEDLINE; break; - case OBJ_DLG_DATEFIELD: nObj = SVX_SNAP_DATEFIELD; break; - case OBJ_DLG_TIMEFIELD: nObj = SVX_SNAP_TIMEFIELD; break; - case OBJ_DLG_NUMERICFIELD: nObj = SVX_SNAP_NUMERICFIELD; break; - case OBJ_DLG_CURRENCYFIELD: nObj = SVX_SNAP_CURRENCYFIELD; break; - case OBJ_DLG_FORMATTEDFIELD: nObj = SVX_SNAP_FORMATTEDFIELD; break; - case OBJ_DLG_PATTERNFIELD: nObj = SVX_SNAP_PATTERNFIELD; break; - case OBJ_DLG_FILECONTROL: nObj = SVX_SNAP_FILECONTROL; break; - case OBJ_DLG_TREECONTROL: nObj = SVX_SNAP_TREECONTROL; break; - default: nObj = 0; - } -#ifdef DBG_UTIL - if( !nObj ) - { - DBG_WARNING( "SID_CHOOSE_CONTROLS: Unbekannt!" ); - } -#endif - aItem.SetValue( nObj ); - } - - rSet.Put( aItem ); - } - } - break; - - case SID_SHOW_PROPERTYBROWSER: - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView()->AreObjectsMarked() ) - rSet.DisableItem( nWh ); - - if ( IsReadOnly() ) - rSet.DisableItem( nWh ); - } - break; - } - } -} - - - -void DialogWindow::ExecuteCommand( SfxRequest& rReq ) -{ - switch ( rReq.GetSlot() ) - { - case SID_CUT: - if ( !IsReadOnly() ) - { - GetEditor()->Cut(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - break; - case SID_DELETE: - if ( !IsReadOnly() ) - { - GetEditor()->Delete(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - break; - case SID_COPY: - GetEditor()->Copy(); - break; - case SID_PASTE: - if ( !IsReadOnly() ) - { - GetEditor()->Paste(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - break; - case SID_CHOOSE_CONTROLS: - { - const SfxItemSet* pArgs = rReq.GetArgs(); - DBG_ASSERT( pArgs, "Nix Args" ); - - const SfxAllEnumItem& rItem = (SfxAllEnumItem&)pArgs->Get( SID_CHOOSE_CONTROLS ); - switch( rItem.GetValue() ) - { - case SVX_SNAP_PUSHBUTTON: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PUSHBUTTON ); - } - break; - case SVX_SNAP_RADIOBUTTON: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_RADIOBUTTON ); - } - break; - case SVX_SNAP_CHECKBOX: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_CHECKBOX); - } - break; - case SVX_SNAP_LISTBOX: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_LISTBOX ); - } - break; - case SVX_SNAP_COMBOBOX: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_COMBOBOX ); - } - break; - case SVX_SNAP_GROUPBOX: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_GROUPBOX ); - } - break; - case SVX_SNAP_EDIT: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_EDIT ); - } - break; - case SVX_SNAP_FIXEDTEXT: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FIXEDTEXT ); - } - break; - case SVX_SNAP_IMAGECONTROL: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_IMAGECONTROL ); - } - break; - case SVX_SNAP_PROGRESSBAR: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PROGRESSBAR ); - } - break; - case SVX_SNAP_HSCROLLBAR: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_HSCROLLBAR ); - } - break; - case SVX_SNAP_VSCROLLBAR: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_VSCROLLBAR ); - } - break; - case SVX_SNAP_HFIXEDLINE: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_HFIXEDLINE ); - } - break; - case SVX_SNAP_VFIXEDLINE: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_VFIXEDLINE ); - } - break; - case SVX_SNAP_DATEFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_DATEFIELD ); - } - break; - case SVX_SNAP_TIMEFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_TIMEFIELD ); - } - break; - case SVX_SNAP_NUMERICFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_NUMERICFIELD ); - } - break; - case SVX_SNAP_CURRENCYFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_CURRENCYFIELD ); - } - break; - case SVX_SNAP_FORMATTEDFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD ); - } - break; - case SVX_SNAP_PATTERNFIELD: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_PATTERNFIELD ); - } - break; - case SVX_SNAP_FILECONTROL: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_FILECONTROL ); - } - break; - case SVX_SNAP_TREECONTROL: - { - GetEditor()->SetMode( DLGED_INSERT ); - GetEditor()->SetInsertObj( OBJ_DLG_TREECONTROL ); - } - break; - - case SVX_SNAP_SELECT: - { - GetEditor()->SetMode( DLGED_SELECT ); - } - break; - } - - if ( rReq.GetModifier() & KEY_MOD1 ) - { - if ( GetEditor()->GetMode() == DLGED_INSERT ) - GetEditor()->CreateDefaultObject(); - } - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - } - break; - - case SID_DIALOG_TESTMODE: - { - DlgEdMode eOldMode = GetEditor()->GetMode(); - GetEditor()->SetMode( DLGED_TEST ); - GetEditor()->SetMode( eOldMode ); - rReq.Done(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DIALOG_TESTMODE ); - return; - } - case SID_EXPORT_DIALOG: - SaveDialog(); - break; - - case SID_IMPORT_DIALOG: - ImportDialog(); - break; - } - - rReq.Done(); -} - -Reference< container::XNameContainer > DialogWindow::GetDialog() const -{ - return pEditor->GetDialog(); -} - -sal_Bool DialogWindow::RenameDialog( const String& rNewName ) -{ - if ( !BasicIDE::RenameDialog( this, GetDocument(), GetLibName(), GetName(), rNewName ) ) - return sal_False; - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_DOC_MODIFIED ); - - return sal_True; -} - -void DialogWindow::DisableBrowser() -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL; - if( pChildWin ) - ((PropBrw*)(pChildWin->GetWindow()))->Update( NULL ); -} - -void DialogWindow::UpdateBrowser() -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL; - if( pChildWin ) - ((PropBrw*)(pChildWin->GetWindow()))->Update( pIDEShell ); -} - -static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )); - -sal_Bool DialogWindow::SaveDialog() -{ - DBG_CHKTHIS( DialogWindow, 0 ); - sal_Bool bDone = sal_False; - - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - - Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); - xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False); - Any aValue; - aValue <<= (sal_Bool) sal_True; - xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue); - - if ( aCurPath.Len() ) - xFP->setDisplayDirectory ( aCurPath ); - - xFP->setDefaultName( ::rtl::OUString( GetName() ) ); - - String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) ); - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) ); - xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); - xFltMgr->setCurrentFilter( aDialogStr ); - - if( xFP->execute() == RET_OK ) - { - Sequence< ::rtl::OUString > aPaths = xFP->getFiles(); - aCurPath = aPaths[0]; - - // export dialog model to xml - Reference< container::XNameContainer > xDialogModel = GetDialog(); - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() ); - Reference< XInputStream > xInput( xISP->createInputStream() ); - - Reference< XSimpleFileAccess > xSFI( xMSF->createInstance - ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY ); - - Reference< XOutputStream > xOutput; - try - { - if( xSFI->exists( aCurPath ) ) - xSFI->kill( aCurPath ); - xOutput = xSFI->openFileWrite( aCurPath ); - } - catch( Exception& ) - {} - - if( xOutput.is() ) - { - Sequence< sal_Int8 > bytes; - sal_Int32 nRead = xInput->readBytes( bytes, xInput->available() ); - for (;;) - { - if( nRead ) - xOutput->writeBytes( bytes ); - - nRead = xInput->readBytes( bytes, 1024 ); - if (! nRead) - break; - } - bDone = true; - - // With resource? - Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY ); - Reference< resource::XStringResourceResolver > xStringResourceResolver; - if( xDialogModelPropSet.is() ) - { - try - { - Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName ); - aResourceResolver >>= xStringResourceResolver; - } - catch( beans::UnknownPropertyException& ) - {} - } - - bool bResource = false; - if( xStringResourceResolver.is() ) - { - Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - if( nLocaleCount > 0 ) - bResource = true; - } - - if( bResource ) - { - INetURLObject aURLObj( aCurPath ); - aURLObj.removeExtension(); - ::rtl::OUString aDialogName( aURLObj.getName() ); - aURLObj.removeSegment(); - ::rtl::OUString aURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - sal_Bool bReadOnly = sal_False; - ::rtl::OUString aComment( RTL_CONSTASCII_USTRINGPARAM( "# " )); - aComment += aDialogName; - aComment += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " strings" )); - Reference< task::XInteractionHandler > xDummyHandler; - - // Remove old properties files in case of overwriting Dialog files - if( xSFI->isFolder( aURL ) ) - { - Sequence< ::rtl::OUString > aContentSeq = xSFI->getFolderContents( aURL, false ); - - ::rtl::OUString aDialogName_( aDialogName ); - aDialogName_ += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_" )); - sal_Int32 nCount = aContentSeq.getLength(); - const ::rtl::OUString* pFiles = aContentSeq.getConstArray(); - for( int i = 0 ; i < nCount ; i++ ) - { - ::rtl::OUString aCompleteName = pFiles[i]; - rtl::OUString aPureName; - rtl::OUString aExtension; - sal_Int32 iDot = aCompleteName.lastIndexOf( '.' ); - sal_Int32 iSlash = aCompleteName.lastIndexOf( '/' ); - if( iDot != -1 ) - { - sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0; - aPureName = aCompleteName.copy( iCopyFrom, iDot-iCopyFrom ); - aExtension = aCompleteName.copy( iDot + 1 ); - } - - if( aExtension.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "properties" ) ) || - aExtension.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "default" ) ) ) - { - if( aPureName.indexOf( aDialogName_ ) == 0 ) - { - try - { - xSFI->kill( aCompleteName ); - } - catch( uno::Exception& ) - {} - } - } - } - } - - Reference< XStringResourceWithLocation > xStringResourceWithLocation = - StringResourceWithLocation::create( xContext, aURL, bReadOnly, - xStringResourceResolver->getDefaultLocale(), aDialogName, aComment, xDummyHandler ); - - // Add locales - Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales(); - const lang::Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const lang::Locale& rLocale = pLocales[ iLocale ]; - xStringResourceWithLocation->newLocale( rLocale ); - } - - Reference< XStringResourceManager > xTargetStringResourceManager( xStringResourceWithLocation, uno::UNO_QUERY ); - - LocalizationMgr::copyResourceForDialog( xDialogModel, - xStringResourceResolver, xTargetStringResourceManager ); - - xStringResourceWithLocation->store(); - } - } - else - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTWRITE) ) ).Execute(); - } - - return bDone; -} - -extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, - const ::com::sun::star::lang::Locale& rLocaleRight ); - -std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq - ( Sequence< lang::Locale > aFirstSeq, Sequence< lang::Locale > aSecondSeq ) -{ - std::vector< lang::Locale > avRet; - - const lang::Locale* pFirst = aFirstSeq.getConstArray(); - const lang::Locale* pSecond = aSecondSeq.getConstArray(); - sal_Int32 nFirstCount = aFirstSeq.getLength(); - sal_Int32 nSecondCount = aSecondSeq.getLength(); - - for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ ) - { - const lang::Locale& rFirstLocale = pFirst[ iFirst ]; - - bool bAlsoContainedInSecondSeq = false; - for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ ) - { - const lang::Locale& rSecondLocale = pSecond[ iSecond ]; - - bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale ); - if( bMatch ) - { - bAlsoContainedInSecondSeq = true; - break; - } - } - - if( !bAlsoContainedInSecondSeq ) - avRet.push_back( rFirstLocale ); - } - - return avRet; -} - - -class NameClashQueryBox : public MessBox -{ -public: - NameClashQueryBox( Window* pParent, - const XubString& rTitle, const XubString& rMessage ); -}; - -NameClashQueryBox::NameClashQueryBox( Window* pParent, - const XubString& rTitle, const XubString& rMessage ) - : MessBox( pParent, 0, rTitle, rMessage ) -{ - if ( rTitle.Len() ) - SetText( rTitle ); - - maMessText = rMessage; - - AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_RENAME ) ), RET_YES, - BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON ); - AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_REPLACE ) ), RET_NO, 0 ); - AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON ); - - SetImage( QueryBox::GetStandardImage() ); -} - - -class LanguageMismatchQueryBox : public MessBox -{ -public: - LanguageMismatchQueryBox( Window* pParent, - const XubString& rTitle, const XubString& rMessage ); -}; - -LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent, - const XubString& rTitle, const XubString& rMessage ) - : MessBox( pParent, 0, rTitle, rMessage ) -{ - if ( rTitle.Len() ) - SetText( rTitle ); - - maMessText = rMessage; - AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_ADD ) ), RET_YES, - BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON ); - AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_OMIT ) ), RET_NO, 0 ); - AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON ); - AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 4 ); - - SetImage( QueryBox::GetStandardImage() ); -} - -sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName ) -{ - sal_Bool bDone = sal_False; - - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - - Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY); - xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False); - Any aValue; - aValue <<= (sal_Bool) sal_True; - xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue); - - String aCurPath( rCurPath ); - if ( aCurPath.Len() ) - xFP->setDisplayDirectory ( aCurPath ); - - String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) ); - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) ); - xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) ); - xFltMgr->setCurrentFilter( aDialogStr ); - - if( xFP->execute() == RET_OK ) - { - Sequence< ::rtl::OUString > aPaths = xFP->getFiles(); - aCurPath = aPaths[0]; - - ::rtl::OUString aBasePath; - ::rtl::OUString aOUCurPath( aCurPath ); - sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' ); - if( iSlash != -1 ) - aBasePath = aOUCurPath.copy( 0, iSlash + 1 ); - - try - { - // create dialog model - Reference< container::XNameContainer > xDialogModel( xMSF->createInstance - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW ); - - Reference< XSimpleFileAccess > xSFI( xMSF->createInstance - ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY_THROW ); - - Reference< XInputStream > xInput; - if( xSFI->exists( aCurPath ) ) - xInput = xSFI->openFileRead( aCurPath ); - - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - - String aXmlDlgName; - Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY ); - if( xDialogModelPropSet.is() ) - { - try - { - Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME ); - ::rtl::OUString aOUXmlDialogName; - aXmlDialogNameAny >>= aOUXmlDialogName; - aXmlDlgName = aOUXmlDialogName; - } - catch( beans::UnknownPropertyException& ) - {} - } - bool bValidName = (aXmlDlgName.Len() != 0); - OSL_ASSERT( bValidName ); - if( !bValidName ) - return bDone; - - bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName ); - - String aNewDlgName = aXmlDlgName; - enum NameClashMode - { - NO_CLASH, - CLASH_OVERWRITE_DIALOG, - CLASH_RENAME_DIALOG, - }; - NameClashMode eNameClashMode = NO_CLASH; - if( bDialogAlreadyExists ) - { - String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_CLASH_TITLE ) ); - String aQueryBoxText( IDEResId( RID_STR_DLGIMP_CLASH_TEXT ) ); - aQueryBoxText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "$(ARG1)" ) ), aXmlDlgName ); - - NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); - sal_uInt16 nRet = aQueryBox.Execute(); - if( RET_YES == nRet ) - { - // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox - eNameClashMode = CLASH_RENAME_DIALOG; - - aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName ); - } - else if( RET_NO == nRet ) - { - // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox - eNameClashMode = CLASH_OVERWRITE_DIALOG; - } - else if( RET_CANCEL == nRet ) - { - return bDone; - } - } - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if( pIDEShell == NULL ) - { - OSL_ASSERT( pIDEShell != NULL ); - return bDone; - } - - // Resource? - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - Reference< task::XInteractionHandler > xDummyHandler; - bool bReadOnly = true; - Reference< XStringResourceWithLocation > xImportStringResource = - StringResourceWithLocation::create( xContext, aBasePath, bReadOnly, - aLocale, aXmlDlgName, ::rtl::OUString(), xDummyHandler ); - - Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales(); - sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength(); - - Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) ); - Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - sal_Int32 nLibLocaleCount = 0; - Sequence< lang::Locale > aLibLocaleSeq; - if( xLibStringResourceManager.is() ) - { - aLibLocaleSeq = xLibStringResourceManager->getLocales(); - nLibLocaleCount = aLibLocaleSeq.getLength(); - } - - // Check language matches - std::vector< lang::Locale > aOnlyInImportLanguages = - implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq ); - int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size(); - - // For now: Keep languages from lib - bool bLibLocalized = (nLibLocaleCount > 0); - bool bImportLocalized = (nImportLocaleCount > 0); - - bool bAddDialogLanguagesToLib = false; - if( nOnlyInImportLanguageCount > 0 ) - { - String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_MISMATCH_TITLE ) ); - String aQueryBoxText( IDEResId( RID_STR_DLGIMP_MISMATCH_TEXT ) ); - LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); - sal_uInt16 nRet = aQueryBox.Execute(); - if( RET_YES == nRet ) - { - // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox - bAddDialogLanguagesToLib = true; - } - // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox - // -> nothing to do here - //else if( RET_NO == nRet ) - //{ - //} - else if( RET_CANCEL == nRet ) - { - return bDone; - } - } - - if( bImportLocalized ) - { - bool bCopyResourcesForDialog = true; - if( bAddDialogLanguagesToLib ) - { - LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr(); - - lang::Locale aFirstLocale; - aFirstLocale = aOnlyInImportLanguages[0]; - if( nOnlyInImportLanguageCount > 1 ) - { - // Check if import default belongs to only import languages and use it then - lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale(); - lang::Locale aTmpLocale; - for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i ) - { - aTmpLocale = aOnlyInImportLanguages[i]; - if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) ) - { - aFirstLocale = aImportDefaultLocale; - break; - } - } - } - - Sequence< lang::Locale > aFirstLocaleSeq( 1 ); - aFirstLocaleSeq[0] = aFirstLocale; - pCurMgr->handleAddLocales( aFirstLocaleSeq ); - - if( nOnlyInImportLanguageCount > 1 ) - { - Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 ); - lang::Locale aTmpLocale; - int iSeq = 0; - for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i ) - { - aTmpLocale = aOnlyInImportLanguages[i]; - if( !localesAreEqual( aFirstLocale, aTmpLocale ) ) - aRemainingLocaleSeq[iSeq++] = aTmpLocale; - } - pCurMgr->handleAddLocales( aRemainingLocaleSeq ); - } - } - else if( !bLibLocalized ) - { - Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY ); - LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager ); - bCopyResourcesForDialog = false; - } - - if( bCopyResourcesForDialog ) - { - Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY ); - LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName, - xLibStringResourceManager, xImportStringResourceResolver ); - } - } - else if( bLibLocalized ) - { - LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager ); - } - - - LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel ); - - if( eNameClashMode == CLASH_OVERWRITE_DIALOG ) - { - if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) ) - { - IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, sal_False, sal_True ); - if( pDlgWin != NULL ) - pIDEShell->RemoveWindow( pDlgWin, sal_True ); - BasicIDE::MarkDocumentModified( rDocument ); - } - else - { - // TODO: Assertion? - return bDone; - } - } - - if( eNameClashMode == CLASH_RENAME_DIALOG ) - { - bool bRenamed = false; - if( xDialogModelPropSet.is() ) - { - try - { - Any aXmlDialogNameAny; - aXmlDialogNameAny <<= ::rtl::OUString( aNewDlgName ); - xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny ); - bRenamed = true; - } - catch( beans::UnknownPropertyException& ) - {} - } - - - if( bRenamed ) - { - LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel ); - } - else - { - // TODO: Assertion? - return bDone; - } - } - - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP ); - if( bSuccess ) - { - DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName ); - pIDEShell->SetCurWindow( pNewDlgWin, sal_True ); - } - - bDone = sal_True; - } - catch( Exception& ) - {} - } - - return bDone; -} - -sal_Bool DialogWindow::ImportDialog() -{ - DBG_CHKTHIS( DialogWindow, 0 ); - - const ScriptDocument& rDocument = GetDocument(); - String aLibName = GetLibName(); - sal_Bool bRet = implImportDialog( this, aCurPath, rDocument, aLibName ); - return bRet; -} - -DlgEdModel* DialogWindow::GetModel() const -{ - return pEditor ? pEditor->GetModel() : NULL; -} - -DlgEdPage* DialogWindow::GetPage() const -{ - return pEditor ? pEditor->GetPage() : NULL; -} - -DlgEdView* DialogWindow::GetView() const -{ - return pEditor ? pEditor->GetView() : NULL; -} - -sal_Bool DialogWindow::IsModified() -{ - return pEditor->IsModified(); -} - -::svl::IUndoManager* DialogWindow::GetUndoManager() -{ - return pUndoMgr; -} - -String DialogWindow::GetTitle() -{ - return GetName(); -} - -BasicEntryDescriptor DialogWindow::CreateEntryDescriptor() -{ - ScriptDocument aDocument( GetDocument() ); - String aLibName( GetLibName() ); - String aLibSubName; - LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG ); -} - -void DialogWindow::SetReadOnly( sal_Bool b ) -{ - if ( pEditor ) - { - if ( b ) - pEditor->SetMode( DLGED_READONLY ); - else - pEditor->SetMode( DLGED_SELECT ); - } -} - -sal_Bool DialogWindow::IsReadOnly() -{ - sal_Bool bReadOnly = sal_False; - - if ( pEditor && pEditor->GetMode() == DLGED_READONLY ) - bReadOnly = sal_True; - - return bReadOnly; -} - -sal_Bool DialogWindow::IsPasteAllowed() -{ - return pEditor ? pEditor->IsPasteAllowed() : sal_False; -} - -void DialogWindow::StoreData() -{ - if ( IsModified() ) - { - try - { - Reference< container::XNameContainer > xLib = GetDocument().getLibrary( E_DIALOGS, GetLibName(), true ); - - if( xLib.is() ) - { - Reference< container::XNameContainer > xDialogModel = pEditor->GetDialog(); - - if( xDialogModel.is() ) - { - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() ); - xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) ); - } - } - } - catch ( uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - BasicIDE::MarkDocumentModified( GetDocument() ); - pEditor->ClearModifyFlag(); - } -} - -void DialogWindow::Deactivating() -{ - if ( IsModified() ) - BasicIDE::MarkDocumentModified( GetDocument() ); -} - -sal_Int32 DialogWindow::countPages( Printer* pPrinter ) -{ - return pEditor->countPages( pPrinter ); -} - -void DialogWindow::printPage( sal_Int32 nPage, Printer* pPrinter ) -{ - pEditor->printPage( nPage, pPrinter, CreateQualifiedName() ); -} - -void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if( (rDCEvt.GetType()==DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - InitSettings( sal_True, sal_True, sal_True ); - Invalidate(); - } - else - IDEBaseWindow::DataChanged( rDCEvt ); -} - -void DialogWindow::InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bBackground) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if( bFont ) - { - Font aFont; - aFont = rStyleSettings.GetFieldFont(); - SetPointFont( aFont ); - } - - if( bForeground || bFont ) - { - SetTextColor( rStyleSettings.GetFieldTextColor() ); - SetTextFillColor(); - } - - if( bBackground ) - SetBackground( rStyleSettings.GetFieldColor() ); -} - -::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > DialogWindow::CreateAccessible() -{ - return (::com::sun::star::accessibility::XAccessible*) new AccessibleDialogWindow( this ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basidectrlr.cxx b/basctl/source/basicide/basidectrlr.cxx deleted file mode 100644 index 9b32530c1..000000000 --- a/basctl/source/basicide/basidectrlr.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include -#include -#include -#include - -#include - -#include - - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; - - -#define PROPERTY_ID_ICONID 1 -#define PROPERTY_ICONID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) ) - - -//---------------------------------------------------------------------------- - -BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell ) - :OPropertyContainer( m_aBHelper ) - ,SfxBaseController( pViewShell ) - ,m_nIconId( ICON_MACROLIBRARY ) -{ - registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) ); -} - -//---------------------------------------------------------------------------- - -BasicIDEController::~BasicIDEController() -{ -} - -// XInterface -//---------------------------------------------------------------------------- - -Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException) -{ - Any aReturn = SfxBaseController::queryInterface( rType ); - if ( !aReturn.hasValue() ) - aReturn = OPropertyContainer::queryInterface( rType ); - - return aReturn; -} - -//---------------------------------------------------------------------------- - -void SAL_CALL BasicIDEController::acquire() throw() -{ - SfxBaseController::acquire(); -} - -//---------------------------------------------------------------------------- - -void SAL_CALL BasicIDEController::release() throw() -{ - SfxBaseController::release(); -} - - -// XTypeProvider ( ::SfxBaseController ) -//---------------------------------------------------------------------------- - -Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException) -{ - Sequence< Type > aTypes = ::comphelper::concatSequences( - SfxBaseController::getTypes(), - OPropertyContainer::getTypes() - ); - - return aTypes; -} - -//---------------------------------------------------------------------------- - -Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException) -{ - static ::cppu::OImplementationId * pId = 0; - if ( !pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pId ) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} - -// XPropertySet -//---------------------------------------------------------------------------- - -Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException) -{ - Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -// OPropertySetHelper -//---------------------------------------------------------------------------- - -::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper() -{ - return *getArrayHelper(); -} - -// OPropertyArrayUsageHelper -//---------------------------------------------------------------------------- - -::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const -{ - Sequence< Property > aProps; - describeProperties( aProps ); - return new ::cppu::OPropertyArrayHelper( aProps ); -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx deleted file mode 100644 index a82a8bbb5..000000000 --- a/basctl/source/basicide/basides1.cxx +++ /dev/null @@ -1,1399 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "docsignature.hxx" - -#define GLOBALOVERFLOW2 -#include -#define _SVSTDARR_STRINGS -#include -#include - -#define _SOLAR__PRIVATE 1 - -// #define _SVX_NOIDERESIDS - -#define SI_NOCONTROL -#define SI_NOSBXCONTROLS -#define SI_NOITEMS -#define SI_NODRW -#define _VCTRLS_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; - -class SvxSearchItem; - -// Egal was, einfach ans aktuelle Fenster: -void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) -{ - if ( !pCurWin ) - return; - - switch ( rReq.GetSlot() ) - { - case SID_BASICIDE_HIDECURPAGE: - { - pCurWin->StoreData(); - RemoveWindow( pCurWin, sal_False ); - } - break; - case SID_BASICIDE_DELETECURRENT: - { - ScriptDocument aDocument( pCurWin->GetDocument() ); - String aLibName = pCurWin->GetLibName(); - String aName = pCurWin->GetName(); - - if ( pCurWin->ISA( ModulWindow ) ) - { - // module - if ( QueryDelModule( aName, pCurWin ) ) - { - if ( aDocument.removeModule( aLibName, aName ) ) - { - BasicIDE::MarkDocumentModified( aDocument ); - } - } - } - else - { - // dialog - if ( QueryDelDialog( aName, pCurWin ) ) - { - if ( BasicIDE::RemoveDialog( aDocument, aLibName, aName ) ) - { - RemoveWindow( pCurWin, sal_True ); - BasicIDE::MarkDocumentModified( aDocument ); - } - } - } - } - break; - case SID_BASICIDE_RENAMECURRENT: - { - pTabBar->StartEditMode( pTabBar->GetCurPageId() ); - } - break; - case FID_SEARCH_NOW: - { - if ( pCurWin->ISA( ModulWindow ) ) - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SfxItemSet* pArgs = rReq.GetArgs(); - // Leider kenne ich die ID nicht: - sal_uInt16 nWhich = pArgs->GetWhichByPos( 0 ); - DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" ); - const SfxPoolItem& rItem = pArgs->Get( nWhich ); - DBG_ASSERT( rItem.ISA( SvxSearchItem ), "Kein Searchitem!" ); - if ( rItem.ISA( SvxSearchItem ) ) - { - // Item wegen der Einstellungen merken... - IDE_DLL()->GetExtraData()->SetSearchItem( (const SvxSearchItem&)rItem ); - sal_uInt16 nFound = 0; - sal_Bool bCanceled = sal_False; - if ( ((const SvxSearchItem&)rItem).GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) - { - sal_uInt16 nActModWindows = 0; - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin ) - { - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - nActModWindows++; - pWin = aIDEWindowTable.Next(); - } - - if ( ( nActModWindows <= 1 ) || ( !((const SvxSearchItem&)rItem).GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) ) - { - pWin = aIDEWindowTable.First(); - while ( pWin ) - { - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - nFound = nFound + ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); - pWin = aIDEWindowTable.Next(); - } - } - else - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); - - IDEResId nId( RID_STR_SEARCHREPLACES ); - String aReplStr( nId ); - aReplStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), String::CreateFromInt32( nFound ) ); - InfoBox( pCurWin, aReplStr ).Execute(); - } - else - { - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem ); - if ( !nFound && !((const SvxSearchItem&)rItem).GetSelection() ) - { - // Andere Module durchsuchen... - sal_Bool bChangeCurWindow = sal_False; - aIDEWindowTable.Seek( pCurWin ); - // Erstmal beim naechsten Anfangen, ggf. spaeter von vorne - IDEBaseWindow* pWin = aIDEWindowTable.Next(); - sal_Bool bSearchedFromStart = sal_False; - while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) ) - { - if ( !pWin ) - { - SfxViewFrame* pViewFrame = GetViewFrame(); - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL; - Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL; - QueryBox aQuery( pParent, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHFROMSTART ) ) ); - if ( aQuery.Execute() == RET_YES ) - { - pWin = aIDEWindowTable.First(); - bSearchedFromStart = sal_True; - } - else - bCanceled = sal_True; - } - - if ( pWin && !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - { - if ( pWin != pCurWin ) - { - // Groesse einstellen, damit die View - // gleich richtig justiert werden kann. - if ( pCurWin ) - pWin->SetSizePixel( pCurWin->GetSizePixel() ); - nFound = ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True ); - } - if ( nFound ) - { - bChangeCurWindow = sal_True; - break; - } - } - if ( pWin && ( pWin != pCurWin ) ) - pWin = aIDEWindowTable.Next(); - else - pWin = 0; // Dann sind wir durch... - } - if ( !nFound && bSearchedFromStart ) // Aktuelles von vorne... - nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True ); - if ( bChangeCurWindow ) - SetCurWindow( pWin, sal_True ); - } - if ( !nFound && !bCanceled ) - InfoBox( pCurWin, String( IDEResId( RID_STR_SEARCHNOTFOUND ) ) ).Execute(); - } - - rReq.Done(); - } - } - } - break; - case FID_SEARCH_OFF: - { - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - pCurWin->GrabFocus(); - } - break; - case SID_UNDO: - case SID_REDO: - { - if ( GetUndoManager() && pCurWin->AllowUndo() ) - { - GetViewFrame()->ExecuteSlot( rReq ); - } - } - break; - default: - { - pCurWin->ExecuteCommand( rReq ); - } - } -} - -// Egal, wer oben, Einfluss auf die Shell: -void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) -{ - sal_uInt16 nSlot = rReq.GetSlot(); - switch ( nSlot ) - { - case SID_BASICSTOP: - { - // Evtl. nicht einfach anhalten, falls auf Brechpunkt! - if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) - ((ModulWindow*)pCurWin)->BasicStop(); - BasicIDE::StopBasic(); - } - break; - - case SID_SAVEDOC: - { - if ( pCurWin ) - { - // Daten ins BASIC zurueckschreiben - StoreAllWindowData(); - - // document basic - ScriptDocument aDocument( pCurWin->GetDocument() ); - if ( aDocument.isDocument() ) - { - uno::Reference< task::XStatusIndicator > xStatusIndicator; - - SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False ); - if ( pStatusIndicatorItem ) - OSL_VERIFY( pStatusIndicatorItem->GetValue() >>= xStatusIndicator ); - else - { - // get statusindicator - SfxViewFrame *pFrame_ = GetFrame(); - if ( pFrame_ ) - { - uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame_->GetFrame().GetFrameInterface(), - uno::UNO_QUERY ); - if( xStatFactory.is() ) - xStatusIndicator = xStatFactory->createStatusIndicator(); - } - - if ( xStatusIndicator.is() ) - rReq.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) ) ); - } - - aDocument.saveDocument( xStatusIndicator ); - } - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_DOC_MODIFIED ); - pBindings->Invalidate( SID_SAVEDOC ); - pBindings->Invalidate( SID_SIGNATURE ); - } - } - } - break; - case SID_SIGNATURE: - { - if ( pCurWin ) - { - ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() ); - if ( aSignature.supportsSignatures() ) - { - aSignature.signScriptingContent(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_SIGNATURE ); - } - } - } - break; - - case SID_BASICIDE_MODULEDLG: - { - if ( rReq.GetArgs() ) - { - const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); - BasicIDE::Organize( rTabId.GetValue() ); - } - else - BasicIDE::Organize( 0 ); - } - break; - case SID_BASICIDE_CHOOSEMACRO: - { - BasicIDE::ChooseMacro( NULL, sal_False, ::rtl::OUString() ); - } - break; - case SID_BASICIDE_CREATEMACRO: - case SID_BASICIDE_EDITMACRO: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ); - BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager(); - DBG_ASSERT( pBasMgr, "Nichts selektiert im Basic-Baum ?" ); - - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - - StartListening( *pBasMgr, sal_True /* Nur einmal anmelden */ ); - String aLibName( rInfo.GetLib() ); - if ( !aLibName.Len() ) - aLibName = String::CreateFromAscii( "Standard" ); - StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); - if ( !pBasic ) - { - // load module and dialog library (if not loaded) - aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName ); - aDocument.loadLibraryIfExists( E_DIALOGS, aLibName ); - - // get Basic - pBasic = pBasMgr->GetLib( aLibName ); - } - DBG_ASSERT( pBasic, "Kein Basic!" ); - - SetCurLib( aDocument, aLibName ); - - if ( rReq.GetSlot() == SID_BASICIDE_CREATEMACRO ) - { - SbModule* pModule = pBasic->FindModule( rInfo.GetModule() ); - if ( !pModule ) - { - if ( rInfo.GetModule().Len() || !pBasic->GetModules()->Count() ) - { - String aModName = rInfo.GetModule(); - - ::rtl::OUString sModuleCode; - if ( aDocument.createModule( aLibName, aModName, sal_False, sModuleCode ) ) - pModule = pBasic->FindModule( aModName ); - } - else - pModule = (SbModule*) pBasic->GetModules()->Get(0); - } - DBG_ASSERT( pModule, "Kein Modul!" ); - if ( !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) ) - BasicIDE::CreateMacro( pModule, rInfo.GetMethod() ); - } - SfxViewFrame* pViewFrame = GetViewFrame(); - if ( pViewFrame ) - pViewFrame->ToTop(); - ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), sal_True ); - DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" ); - SetCurWindow( pWin, sal_True ); - pWin->EditMacro( rInfo.GetMethod() ); - } - break; - case SID_BASICIDE_OBJCAT: - { - ShowObjectDialog( sal_True, sal_True ); - } - break; - case SID_BASICIDE_NAMECHANGEDONTAB: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); - const SfxStringItem &rModName = (const SfxStringItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME ); - IDEBaseWindow* pWin = aIDEWindowTable.Get( rTabId.GetValue() ); - DBG_ASSERT( pWin, "Window nicht im Liste, aber in TabBar ?" ); - if ( pWin ) - { - String aNewName( rModName.GetValue() ); - String aOldName( pWin->GetName() ); - if ( aNewName != aOldName ) - { - bool bRenameOk = false; - if ( pWin->IsA( TYPE( ModulWindow ) ) ) - { - ModulWindow* pModWin = (ModulWindow*)pWin; - String aLibName = ( pModWin->GetLibName() ); - ScriptDocument aDocument( pWin->GetDocument() ); - - if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) - { - bRenameOk = true; - // Because we listen for container events for script - // modules, rename will delete the 'old' window - // pWin has been invalidated, restore now - pWin = FindBasWin( aDocument, aLibName, aNewName, sal_True ); - } - - } - else if ( pWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDlgWin = (DialogWindow*)pWin; - bRenameOk = pDlgWin->RenameDialog( aNewName ); - } - if ( bRenameOk ) - { - BasicIDE::MarkDocumentModified( pWin->GetDocument() ); - } - else - { - // set old name in TabWriter - sal_uInt16 nId = (sal_uInt16)aIDEWindowTable.GetKey( pWin ); - DBG_ASSERT( nId, "No entry in Tabbar!" ); - if ( nId ) - pTabBar->SetPageText( nId, aOldName ); - } - } - - // set focus to current window - pWin->GrabFocus(); - } - } - break; - case SID_BASICIDE_STOREMODULESOURCE: - case SID_BASICIDE_UPDATEMODULESOURCE: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO ); - BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager(); - DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" ); - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), sal_False, sal_True ); - if ( pWin ) - { - if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE ) - pWin->StoreData(); - else - pWin->UpdateData(); - } - } - break; - case SID_BASICIDE_STOREALLMODULESOURCES: - case SID_BASICIDE_UPDATEALLMODULESOURCES: - { - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin ) - { - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) ) - { - if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES ) - pWin->StoreData(); - else - pWin->UpdateData(); - } - pWin = aIDEWindowTable.Next(); - } - } - break; - case SID_BASICIDE_LIBSELECTED: - case SID_BASICIDE_LIBREMOVED: - case SID_BASICIDE_LIBLOADED: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SfxUsrAnyItem& rShellItem = (const SfxUsrAnyItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL ); - uno::Reference< frame::XModel > xModel( rShellItem.GetValue(), UNO_QUERY ); - ScriptDocument aDocument( xModel.is() ? ScriptDocument( xModel ) : ScriptDocument::getApplicationScriptDocument() ); - const SfxStringItem& rLibNameItem = (const SfxStringItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME ); - String aLibName( rLibNameItem.GetValue() ); - - if ( nSlot == SID_BASICIDE_LIBSELECTED ) - { - // load module and dialog library (if not loaded) - aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName ); - aDocument.loadLibraryIfExists( E_DIALOGS, aLibName ); - - // check password, if library is password protected and not verified - sal_Bool bOK = sal_True; - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) - { - String aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); - } - } - - if ( bOK ) - { - SetCurLib( aDocument, aLibName, true, false ); - } - else - { - // alten Wert einstellen... - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, sal_True, sal_False ); - } - } - else if ( nSlot == SID_BASICIDE_LIBREMOVED ) - { - if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) - { - RemoveWindows( aDocument, aLibName, sal_True ); - if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) - { - m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); - m_aCurLibName = String(); - // Kein UpdateWindows! - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); - } - } - } - else // Loaded... - UpdateWindows(); - } - break; - case SID_BASICIDE_NEWMODULE: - { - ModulWindow* pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, String() ); - DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" ); - SetCurWindow( pWin, sal_True ); - } - break; - case SID_BASICIDE_NEWDIALOG: - { - DialogWindow* pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, String() ); - DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" ); - SetCurWindow( pWin, sal_True ); - } - break; - case SID_BASICIDE_SBXRENAMED: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - } - break; - case SID_BASICIDE_SBXINSERTED: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); - ScriptDocument aDocument( rSbxItem.GetDocument() ); - String aLibName( rSbxItem.GetLibName() ); - String aName( rSbxItem.GetName() ); - if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) - { - if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) - FindBasWin( aDocument, aLibName, aName, sal_True ); - else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) - FindDlgWin( aDocument, aLibName, aName, sal_True ); - } - } - break; - case SID_BASICIDE_SBXDELETED: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); - ScriptDocument aDocument( rSbxItem.GetDocument() ); - IDEBaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), sal_True ); - if ( pWin ) - RemoveWindow( pWin, sal_True ); - } - break; - case SID_BASICIDE_SHOWSBX: - { - DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); - const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); - ScriptDocument aDocument( rSbxItem.GetDocument() ); - String aLibName( rSbxItem.GetLibName() ); - String aName( rSbxItem.GetName() ); - SetCurLib( aDocument, aLibName ); - IDEBaseWindow* pWin = 0; - if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) - { - pWin = FindDlgWin( aDocument, aLibName, aName, sal_True ); - } - else if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) - { - pWin = FindBasWin( aDocument, aLibName, aName, sal_True ); - } - else if ( rSbxItem.GetType() == BASICIDE_TYPE_METHOD ) - { - pWin = FindBasWin( aDocument, aLibName, aName, sal_True ); - ((ModulWindow*)pWin)->EditMacro( rSbxItem.GetMethodName() ); - } - DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" ); - SetCurWindow( pWin, sal_True ); - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); - } - break; - case SID_SHOW_PROPERTYBROWSER: - { - GetViewFrame()->ChildWindowExecute( rReq ); - rReq.Done(); - } - break; - case SID_BASICIDE_SHOWWINDOW: - { - ::std::auto_ptr< ScriptDocument > pDocument; - - SFX_REQUEST_ARG( rReq, pDocumentItem, SfxStringItem, SID_BASICIDE_ARG_DOCUMENT, sal_False ); - if ( pDocumentItem ) - { - String sDocumentCaption = pDocumentItem->GetValue(); - if ( sDocumentCaption.Len() ) - pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) ); - } - - SFX_REQUEST_ARG( rReq, pDocModelItem, SfxUsrAnyItem, SID_BASICIDE_ARG_DOCUMENT_MODEL, sal_False ); - if ( !pDocument.get() && pDocModelItem ) - { - uno::Reference< frame::XModel > xModel( pDocModelItem->GetValue(), UNO_QUERY ); - if ( xModel.is() ) - pDocument.reset( new ScriptDocument( xModel ) ); - } - - if ( !pDocument.get() ) - break; - - SFX_REQUEST_ARG( rReq, pLibNameItem, SfxStringItem, SID_BASICIDE_ARG_LIBNAME, sal_False ); - if ( !pLibNameItem ) - break; - - String aLibName( pLibNameItem->GetValue() ); - pDocument->loadLibraryIfExists( E_SCRIPTS, aLibName ); - SetCurLib( *pDocument, aLibName ); - SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_BASICIDE_ARG_NAME, sal_False ); - if ( pNameItem ) - { - String aName( pNameItem->GetValue() ); - String aModType( String::CreateFromAscii( "Module" ) ); - String aDlgType( String::CreateFromAscii( "Dialog" ) ); - String aType( aModType ); - SFX_REQUEST_ARG( rReq, pTypeItem, SfxStringItem, SID_BASICIDE_ARG_TYPE, sal_False ); - if ( pTypeItem ) - aType = pTypeItem->GetValue(); - - IDEBaseWindow* pWin = 0; - if ( aType == aModType ) - pWin = FindBasWin( *pDocument, aLibName, aName, sal_False ); - else if ( aType == aDlgType ) - pWin = FindDlgWin( *pDocument, aLibName, aName, sal_False ); - - if ( pWin ) - { - SetCurWindow( pWin, sal_True ); - if ( pTabBar ) - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); - - if ( pWin->ISA( ModulWindow ) ) - { - ModulWindow* pModWin = (ModulWindow*)pWin; - SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, sal_False ); - if ( pLineItem ) - { - pModWin->AssertValidEditEngine(); - TextView* pTextView = pModWin->GetEditView(); - if ( pTextView ) - { - TextEngine* pTextEngine = pTextView->GetTextEngine(); - if ( pTextEngine ) - { - sal_uInt32 nLine = pLineItem->GetValue(); - sal_uInt32 nLineCount = 0; - for ( sal_uInt32 i = 0, nCount = pTextEngine->GetParagraphCount(); i < nCount; ++i ) - nLineCount += pTextEngine->GetLineCount( i ); - if ( nLine > nLineCount ) - nLine = nLineCount; - if ( nLine > 0 ) - --nLine; - - // scroll window and set selection - long nVisHeight = pModWin->GetOutputSizePixel().Height(); - long nTextHeight = pTextEngine->GetTextHeight(); - if ( nTextHeight > nVisHeight ) - { - long nMaxY = nTextHeight - nVisHeight; - long nOldY = pTextView->GetStartDocPos().Y(); - long nNewY = nLine * pTextEngine->GetCharHeight() - nVisHeight / 2; - nNewY = ::std::min( nNewY, nMaxY ); - pTextView->Scroll( 0, -( nNewY - nOldY ) ); - pTextView->ShowCursor( sal_False, sal_True ); - pModWin->GetEditVScrollBar().SetThumbPos( pTextView->GetStartDocPos().Y() ); - } - sal_uInt16 nCol1 = 0, nCol2 = 0; - SFX_REQUEST_ARG( rReq, pCol1Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN1, sal_False ); - if ( pCol1Item ) - { - nCol1 = pCol1Item->GetValue(); - if ( nCol1 > 0 ) - --nCol1; - nCol2 = nCol1; - } - SFX_REQUEST_ARG( rReq, pCol2Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN2, sal_False ); - if ( pCol2Item ) - { - nCol2 = pCol2Item->GetValue(); - if ( nCol2 > 0 ) - --nCol2; - } - TextSelection aSel( TextPaM( nLine, nCol1 ), TextPaM( nLine, nCol2 ) ); - pTextView->SetSelection( aSel ); - pTextView->ShowCursor(); - Window* pWindow_ = pTextView->GetWindow(); - if ( pWindow_ ) - pWindow_->GrabFocus(); - } - } - } - } - } - } - rReq.Done(); - } - break; - - case SID_BASICIDE_MANAGE_LANG: - { - ManageLanguageDialog aDlg( GetCurWindow(), GetCurLocalizationMgr() ); - aDlg.Execute(); - rReq.Done(); - } - break; - } -} - -void BasicIDEShell::GetState(SfxItemSet &rSet) -{ - SfxWhichIter aIter(rSet); - for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() ) - { - switch ( nWh ) - { - case SID_DOCINFO: - { - rSet.DisableItem( nWh ); - } - break; - case SID_SAVEDOC: - { - sal_Bool bDisable = sal_False; - - if ( pCurWin ) - { - if ( !pCurWin->IsModified() ) - { - ScriptDocument aDocument( pCurWin->GetDocument() ); - bDisable = ( !aDocument.isAlive() ) - || ( aDocument.isDocument() ? !aDocument.isDocumentModified() : !IsAppBasicModified() ); - } - } - else - { - bDisable = sal_True; - } - - if ( bDisable ) - rSet.DisableItem( nWh ); - } - break; - case SID_NEWWINDOW: - case SID_SAVEASDOC: - { - rSet.DisableItem( nWh ); - } - break; - case SID_SIGNATURE: - { - sal_uInt16 nState = 0; - if ( pCurWin ) - { - ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() ); - nState = aSignature.getScriptingSignatureState(); - } - rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) ); - } - break; - case SID_BASICIDE_MODULEDLG: - { - if ( StarBASIC::IsRunning() ) - rSet.DisableItem( nWh ); - } - break; - case SID_BASICIDE_CHOOSEMACRO: - case SID_BASICIDE_OBJCAT: - case SID_BASICIDE_SHOWSBX: - case SID_BASICIDE_CREATEMACRO: - case SID_BASICIDE_EDITMACRO: - case SID_BASICIDE_NAMECHANGEDONTAB: - { - ; - } - break; - - case SID_BASICIDE_ADDWATCH: - case SID_BASICIDE_REMOVEWATCH: - case SID_BASICLOAD: - case SID_BASICSAVEAS: - case SID_BASICIDE_MATCHGROUP: - { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) - rSet.DisableItem( nWh ); - else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) ) - rSet.DisableItem( nWh ); - } - break; - case SID_BASICRUN: - case SID_BASICSTEPINTO: - case SID_BASICSTEPOVER: - case SID_BASICSTEPOUT: - case SID_BASICIDE_TOGGLEBRKPNT: - case SID_BASICIDE_MANAGEBRKPNTS: - { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) - rSet.DisableItem( nWh ); - else if ( StarBASIC::IsRunning() && !((ModulWindow*)pCurWin)->GetBasicStatus().bIsInReschedule ) - rSet.DisableItem( nWh ); - } - break; - case SID_BASICCOMPILE: - { - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) || StarBASIC::IsRunning() ) - rSet.DisableItem( nWh ); - } - break; - case SID_BASICSTOP: - { - // Stop immermoeglich, wenn irgendein Basic lauft... - if ( !StarBASIC::IsRunning() ) - rSet.DisableItem( nWh ); - } - break; - case SID_CHOOSE_CONTROLS: - case SID_DIALOG_TESTMODE: - { - if( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) ) - rSet.DisableItem( nWh ); - } - break; - case SID_SHOW_FORMS: - case SID_SHOW_HIDDEN: - { - rSet.DisableItem( nWh ); - } - break; - case SID_SEARCH_OPTIONS: - { - sal_uInt16 nOptions = 0; - if( pCurWin ) - nOptions = pCurWin->GetSearchOptions(); - rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOptions ) ); - } - break; - case SID_BASICIDE_LIBSELECTOR: - { - String aName; - if ( m_aCurLibName.Len() ) - { - LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName ); - aName = CreateMgrAndLibStr( m_aCurDocument.getTitle( eLocation ), m_aCurLibName ); - } - SfxStringItem aItem( SID_BASICIDE_LIBSELECTOR, aName ); - rSet.Put( aItem ); - } - break; - case SID_SEARCH_ITEM: - { - String aSelected = GetSelectionText( sal_True ); - SvxSearchItem& rItem = IDE_DLL()->GetExtraData()->GetSearchItem(); - rItem.SetSearchString( aSelected ); - rSet.Put( rItem ); - } - break; - case SID_BASICIDE_STAT_DATE: - { - String aDate; - aDate = String( RTL_CONSTASCII_USTRINGPARAM( "Datum?!" ) ); - SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate ); - rSet.Put( aItem ); - } - break; - case SID_DOC_MODIFIED: - { - String aModifiedMarker; - sal_Bool bModified = sal_False; - - if ( pCurWin ) - { - if ( pCurWin->IsModified() ) - bModified = sal_True; - else - { - ScriptDocument aDocument( pCurWin->GetDocument() ); - bModified = aDocument.isDocument() ? aDocument.isDocumentModified() : IsAppBasicModified(); - } - } - - if ( bModified ) - aModifiedMarker = '*'; - - SfxStringItem aItem( SID_DOC_MODIFIED, aModifiedMarker ); - rSet.Put( aItem ); - } - break; - case SID_BASICIDE_STAT_TITLE: - { - if ( pCurWin ) - { - String aTitle = pCurWin->CreateQualifiedName(); - SfxStringItem aItem( SID_BASICIDE_STAT_TITLE, aTitle ); - rSet.Put( aItem ); - } - } - break; - // Werden vom Controller ausgewertet: - case SID_ATTR_SIZE: - case SID_ATTR_INSERT: - break; - case SID_UNDO: - case SID_REDO: - { - if( GetUndoManager() ) // sonst rekursives GetState - GetViewFrame()->GetSlotState( nWh, NULL, &rSet ); - } - break; - case SID_SHOW_PROPERTYBROWSER: - { - if ( GetViewFrame()->KnowsChildWindow( nWh ) ) - rSet.Put( SfxBoolItem( nWh, GetViewFrame()->HasChildWindow( nWh ) ) ); - else - rSet.DisableItem( nWh ); - } - break; - - case SID_BASICIDE_CURRENT_LANG: - { - if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 ) - rSet.DisableItem( nWh ); - else - { - String aItemStr; - LocalizationMgr* pCurMgr = GetCurLocalizationMgr(); - if ( pCurMgr->isLibraryLocalized() ) - { - Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales(); - const lang::Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 i, nCount = aLocaleSeq.getLength(); - - // Force different results for any combination of locales and default locale - ::rtl::OUString aLangStr; - for ( i = 0; i <= nCount; ++i ) - { - lang::Locale aLocale; - if( i < nCount ) - aLocale = pLocale[i]; - else - aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale(); - - aLangStr += aLocale.Language; - aLangStr += aLocale.Country; - aLangStr += aLocale.Variant; - } - aItemStr = aLangStr; - } - rSet.Put( SfxStringItem( nWh, aItemStr ) ); - } - } - break; - - case SID_BASICIDE_MANAGE_LANG: - { - if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 ) - rSet.DisableItem( nWh ); - } - break; - } - } - if ( pCurWin ) - pCurWin->GetState( rSet ); -} - -sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature ) -{ - sal_Bool bResult = sal_False; - - if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER ) - { - // fade out (in) property browser in module (dialog) windows - if ( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) && !pCurWin->IsReadOnly() ) - bResult = sal_True; - } - - return bResult; -} - -void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar, sal_Bool bRememberAsCurrent ) -{ - // Es muss ein EditWindow am Sfx gesetzt sein, sonst kommt kein - // Resize, also stehen die Controls auf den Wiese... - // Sieht dann sowieso besser aus, wenn das Modul-Layout angezeigt wird... - if ( !pNewWin && ( GetWindow() != pModulLayout ) ) - { - pModulLayout->Show(); - AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() ); - SetWindow( pModulLayout ); - EnableScrollbars( sal_False ); - aVScrollBar.Hide(); - } - - if ( pNewWin != pCurWin ) - { - IDEBaseWindow* pPrevCurWin = pCurWin; - pCurWin = pNewWin; - if ( pPrevCurWin ) - { - pPrevCurWin->Hide(); - pPrevCurWin->Deactivating(); -// pPrevCurWin->GetLayoutWindow()->Hide(); - if( pPrevCurWin->IsA( TYPE( DialogWindow ) ) ) - { - ((DialogWindow*)pPrevCurWin)->DisableBrowser(); - } - else - { - pModulLayout->SetModulWindow( NULL ); - } - } - if ( pCurWin ) - { - AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() ); - if( pCurWin->IsA( TYPE( ModulWindow ) ) ) - { - GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); - pModulLayout->SetModulWindow( (ModulWindow*)pCurWin ); - pModulLayout->Show(); - } - else - { - pModulLayout->Hide(); - GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_DIALOGWINDOW ); - } - - if ( bRememberAsCurrent ) - { - BasicIDEData* pData = IDE_DLL()->GetExtraData(); - if ( pData ) - { - sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow ) ) ? BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG; - LibInfoItem* pLibInfoItem = new LibInfoItem( pCurWin->GetDocument(), pCurWin->GetLibName(), pCurWin->GetName(), nCurrentType ); - pData->GetLibInfos().InsertInfo( pLibInfoItem ); - } - } - - if ( GetViewFrame()->GetWindow().IsVisible() ) // sonst macht es spaeter der SFX - pCurWin->Show(); - - pCurWin->Init(); - - if ( !IDE_DLL()->GetExtraData()->ShellInCriticalSection() ) - { - Window* pFrameWindow = &GetViewFrame()->GetWindow(); - Window* pFocusWindow = Application::GetFocusWindow(); - while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) ) - pFocusWindow = pFocusWindow->GetParent(); - if ( pFocusWindow ) // Focus in BasicIDE - pNewWin->GrabFocus(); - } - if( pCurWin->IsA( TYPE( DialogWindow ) ) ) - ((DialogWindow*)pCurWin)->UpdateBrowser(); - } - if ( bUpdateTabBar ) - { - sal_uLong nKey = aIDEWindowTable.GetKey( pCurWin ); - if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) ) - pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // wurde neu eingeblendet - pTabBar->SetCurPageId( (sal_uInt16)nKey ); - } - if ( pCurWin && pCurWin->IsSuspended() ) // Wenn das Fenster im Fehlerfall angezeigt wird... - pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED ); - if ( pCurWin ) - { - SetWindow( pCurWin ); - if ( pCurWin->GetDocument().isDocument() ) - SfxObjectShell::SetCurrentComponent( pCurWin->GetDocument().getDocument() ); - } - else - { - SetWindow( pModulLayout ); - GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW ); - SfxObjectShell::SetCurrentComponent( NULL ); - } - SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 ); - InvalidateBasicIDESlots(); - EnableScrollbars( pCurWin ? sal_True : sal_False ); - - if ( m_pCurLocalizationMgr ) - m_pCurLocalizationMgr->handleTranslationbar(); - - ManageToolbars(); - - // fade out (in) property browser in module (dialog) windows - UIFeatureChanged(); - } -} - -void BasicIDEShell::ManageToolbars() -{ - static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )); - static ::rtl::OUString aMacroBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/macrobar" )); - static ::rtl::OUString aDialogBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/dialogbar" )); - static ::rtl::OUString aInsertControlsBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" )); - (void)aInsertControlsBarResName; - - if( !pCurWin ) - return; - - Reference< beans::XPropertySet > xFrameProps - ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); - if ( xFrameProps.is() ) - { - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName ); - a >>= xLayoutManager; - if ( xLayoutManager.is() ) - { - xLayoutManager->lock(); - if( pCurWin->IsA( TYPE( DialogWindow ) ) ) - { - xLayoutManager->destroyElement( aMacroBarResName ); - - xLayoutManager->requestElement( aDialogBarResName ); - xLayoutManager->requestElement( aInsertControlsBarResName ); - } - else - { - xLayoutManager->destroyElement( aDialogBarResName ); - xLayoutManager->destroyElement( aInsertControlsBarResName ); - - xLayoutManager->requestElement( aMacroBarResName ); - } - xLayoutManager->unlock(); - } - } -} - -IDEBaseWindow* BasicIDEShell::FindApplicationWindow() -{ - return FindWindow( ScriptDocument::getApplicationScriptDocument() ); -} - -IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const String& rLibName, const String& rName, sal_uInt16 nType, sal_Bool bFindSuspended ) -{ - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin ) - { - if ( !pWin->IsSuspended() || bFindSuspended ) - { - if ( !rLibName.Len() || !rName.Len() || nType == BASICIDE_TYPE_UNKNOWN ) - { - // return any non-suspended window - return pWin; - } - else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName && - ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) || - ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) ) - { - return pWin; - } - } - pWin = aIDEWindowTable.Next(); - } - return 0; -} - -long BasicIDEShell::CallBasicErrorHdl( StarBASIC* pBasic ) -{ - long nRet = 0; - ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); - if ( pModWin ) - nRet = pModWin->BasicErrorHdl( pBasic ); - return nRet; -} - -long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic ) -{ - long nRet = 0; - ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); - if ( pModWin ) - { - sal_Bool bAppWindowDisabled, bDispatcherLocked; - sal_uInt16 nWaitCount; - SfxUInt16Item *pSWActionCount, *pSWLockViewCount; - BasicIDE::BasicStopped( &bAppWindowDisabled, &bDispatcherLocked, - &nWaitCount, &pSWActionCount, &pSWLockViewCount ); - - nRet = pModWin->BasicBreakHdl( pBasic ); - - if ( StarBASIC::IsRunning() ) // Falls abgebrochen... - { - if ( bAppWindowDisabled ) - Application::GetDefDialogParent()->Enable( sal_False ); - - if ( nWaitCount ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - for ( sal_uInt16 n = 0; n < nWaitCount; n++ ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); - } - } - } - return nRet; -} - -ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) -{ - SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false ); - - SbModule* pActiveModule = StarBASIC::GetActiveModule(); - SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule); - if( pClassModuleObject != NULL ) - pActiveModule = pClassModuleObject->getClassModule(); - - DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" ); - if ( pActiveModule ) - { - ModulWindow* pWin = 0; - SbxObject* pParent = pActiveModule->GetParent(); - DBG_ASSERT( pParent && pParent->ISA( StarBASIC ), "Kein BASIC!" ); - StarBASIC* pLib = static_cast< StarBASIC* >( pParent ); - if ( pLib ) - { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pLib ); - if ( pBasMgr ) - { - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - String aLibName = pLib->GetName(); - pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), sal_True ); - DBG_ASSERT( pWin, "Error/Step-Hdl: Fenster wurde nicht erzeugt/gefunden!" ); - SetCurLib( aDocument, aLibName ); - SetCurWindow( pWin, sal_True ); - } - } - BasicManager* pBasicMgr = BasicIDE::FindBasicManager( pBasic ); - if ( pBasicMgr ) - StartListening( *pBasicMgr, sal_True /* Nur einmal anmelden */ ); - return pWin; - } - return 0; -} - -void BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) -{ - // Nicht wenn minimiert, weil dann bei Restore der Text verschoben ist. - if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 ) - return; - - Size aSz( rSize ); - Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() ); - aSz.Height() -= aScrollBarBoxSz.Height(); - - Size aOutSz( aSz ); - aSz.Width() -= aScrollBarBoxSz.Width(); - aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) ); - aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) ); - if ( bTabBarSplitted ) - { - // SplitSize ist beim Resize 0 ! - long nSplitPos = pTabBar->GetSizePixel().Width(); - if ( nSplitPos > aSz.Width() ) - nSplitPos = aSz.Width(); - pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) ); - long nScrlStart = rPos.X() + nSplitPos; - aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) ); - aHScrollBar.Update(); - } - else - { - aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) ); - pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) ); - } - - Window* pEdtWin = pCurWin ? pCurWin->GetLayoutWindow() : pModulLayout; - if ( pEdtWin ) - { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) - pEdtWin->SetPosSizePixel( rPos, aSz ); // Ohne ScrollBar - else - pEdtWin->SetPosSizePixel( rPos, aOutSz ); - } -} - -Reference< XModel > BasicIDEShell::GetCurrentDocument() const -{ - Reference< XModel > xDocument; - if ( pCurWin && pCurWin->GetDocument().isDocument() ) - xDocument = pCurWin->GetDocument().getDocument(); - return xDocument; -} - -void BasicIDEShell::Activate( sal_Bool bMDI ) -{ - SfxViewShell::Activate( bMDI ); - - if ( bMDI ) - { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) - ((DialogWindow*)pCurWin)->UpdateBrowser(); - - ShowObjectDialog( sal_True, sal_False ); - } -} - -void BasicIDEShell::Deactivate( sal_Bool bMDI ) -{ - // bMDI sal_True heisst, dass ein anderes MDI aktiviert wurde, bei einem - // Deactivate durch eine MessageBox ist bMDI FALSE - if ( bMDI ) - { - if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pXDlgWin = (DialogWindow*)pCurWin; - pXDlgWin->DisableBrowser(); - if( pXDlgWin->IsModified() ) - BasicIDE::MarkDocumentModified( pXDlgWin->GetDocument() ); - } - - // CanClose pruefen, damit auch beim deaktivieren der BasicIDE geprueft wird, - // ob in einem Modul der Sourcecode zu gross ist... - for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() ) - { - if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) ) - SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false ); - SetCurWindow( pWin, sal_True ); - break; - } - } - - ShowObjectDialog( sal_False, sal_False ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx deleted file mode 100644 index a2e0a85e1..000000000 --- a/basctl/source/basicide/basides2.cxx +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "docsignature.hxx" - -#define SI_NOCONTROL -#define SI_NOSBXCONTROLS - -#include -#include -#include "basicrenderable.hxx" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -namespace css = ::com::sun::star; - -IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG ) -{ - ShowObjectDialog( sal_False, sal_True ); - return 0; -} -IMPL_LINK_INLINE_END( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG ) - -Reference< view::XRenderable > BasicIDEShell::GetRenderable() -{ - return Reference< view::XRenderable >( new basicide::BasicRenderable( pCurWin ) ); -} - -sal_Bool BasicIDEShell::HasSelection( sal_Bool /* bText */ ) const -{ - sal_Bool bSel = sal_False; - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - { - TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView(); - if ( pEditView && pEditView->HasSelection() ) - bSel = sal_True; - } - return bSel; -} - -String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord ) -{ - String aText; - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - { - TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView(); - if ( pEditView ) - { - if ( bWholeWord && !pEditView->HasSelection() ) - { - aText = pEditView->GetTextEngine()->GetWord( pEditView->GetSelection().GetEnd() ); - } - else - { - TextSelection aSel = pEditView->GetSelection(); - if ( !bWholeWord || ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() ) ) - aText = pEditView->GetSelected(); - } - } - } - return aText; -} - -SfxPrinter* BasicIDEShell::GetPrinter( sal_Bool bCreate ) -{ - if ( pCurWin ) // && pCurWin->ISA( ModulWindow ) ) - { - BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell(); - DBG_ASSERT( pDocShell, "DocShell ?!" ); - return pDocShell->GetPrinter( bCreate ); - } - return 0; -} - -sal_uInt16 BasicIDEShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool ) -{ - (void)nDiffFlags; - BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell(); - DBG_ASSERT( pDocShell, "DocShell ?!" ); - pDocShell->SetPrinter( pNewPrinter ); - return 0; -} - -void BasicIDEShell::SetMDITitle() -{ - String aTitle; - - if ( m_aCurLibName.Len() ) - { - LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName ); - aTitle = m_aCurDocument.getTitle( eLocation ); - aTitle += '.'; - aTitle += m_aCurLibName; - } - else - { - aTitle = String( IDEResId( RID_STR_ALL ) ); - } - - ::basctl::DocumentSignature aCurSignature( m_aCurDocument ); - if ( aCurSignature.getScriptingSignatureState() == SIGNATURESTATE_SIGNATURES_OK ) - { - aTitle += String::CreateFromAscii( " " ); - aTitle += String( IDEResId( RID_STR_SIGNED ) ); - aTitle += String::CreateFromAscii( " " ); - } - - SfxViewFrame* pViewFrame = GetViewFrame(); - if ( pViewFrame ) - { - SfxObjectShell* pShell = pViewFrame->GetObjectShell(); - if ( pShell && aTitle != pShell->GetTitle( SFX_TITLE_CAPTION ) ) - { - pShell->SetTitle( aTitle ); - pShell->SetModified( sal_False ); - } - - css::uno::Reference< css::frame::XController > xController = GetController (); - css::uno::Reference< css::frame::XTitle > xTitle (xController, css::uno::UNO_QUERY); - if (xTitle.is ()) - xTitle->setTitle (aTitle); - } -} - -void BasicIDEShell::DestroyModulWindowLayout() -{ - delete pModulLayout; - pModulLayout = 0; -} - - -void BasicIDEShell::UpdateModulWindowLayout( bool bBasicStopped ) -{ - if ( pModulLayout ) - { - pModulLayout->GetStackWindow().UpdateCalls(); - pModulLayout->GetWatchWindow().UpdateWatches( bBasicStopped ); - } -} - -void BasicIDEShell::CreateModulWindowLayout() -{ - pModulLayout = new ModulWindowLayout( &GetViewFrame()->GetWindow() ); -} - -ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName ) -{ - bCreatingWindow = sal_True; - - sal_uLong nKey = 0; - ModulWindow* pWin = 0; - - String aLibName( rLibName ); - String aModName( rModName ); - - if ( !aLibName.Len() ) - aLibName = String::CreateFromAscii( "Standard" ); - - uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); - - if ( !aModName.Len() ) - aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); - - // Vielleicht gibt es ein suspendiertes? - pWin = FindBasWin( rDocument, aLibName, aModName, sal_False, sal_True ); - - if ( !pWin ) - { - ::rtl::OUString aModule; - bool bSuccess = false; - if ( rDocument.hasModule( aLibName, aModName ) ) - bSuccess = rDocument.getModule( aLibName, aModName, aModule ); - else - bSuccess = rDocument.createModule( aLibName, aModName, sal_True, aModule ); - - if ( bSuccess ) - { - pWin = FindBasWin( rDocument, aLibName, aModName, sal_False, sal_True ); - if( !pWin ) - { - // new module window - pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule ); - nKey = InsertWindowInTable( pWin ); - } - else // we've gotten called recursively ( via listener from createModule above ), get outta here - return pWin; - } - } - else - { - pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED ); - IDEBaseWindow* pTmp = aIDEWindowTable.First(); - while ( pTmp && !nKey ) - { - if ( pTmp == pWin ) - nKey = aIDEWindowTable.GetCurKey(); - pTmp = aIDEWindowTable.Next(); - } - DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); - } - if( nKey && xLib.is() && rDocument.isInVBAMode() ) - { - // display a nice friendly name in the ObjectModule tab, - // combining the objectname and module name, e.g. Sheet1 ( Financials ) - String sObjName; - ModuleInfoHelper::getObjectName( xLib, rModName, sObjName ); - if( sObjName.Len() ) - { - aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); - } - } - pTabBar->InsertPage( (sal_uInt16)nKey, aModName ); - pTabBar->Sort(); - pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); - if ( !pCurWin ) - SetCurWindow( pWin, sal_False, sal_False ); - - bCreatingWindow = sal_False; - return pWin; -} - -ModulWindow* BasicIDEShell::FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended ) -{ - ModulWindow* pModWin = 0; - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin && !pModWin ) - { - if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( ModulWindow ) ) ) - { - if ( !rLibName.Len() ) // nur irgendeins finden... - pModWin = (ModulWindow*)pWin; - else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rModName ) - pModWin = (ModulWindow*)pWin; - } - pWin = aIDEWindowTable.Next(); - } - if ( !pModWin && bCreateIfNotExist ) - pModWin = CreateBasWin( rDocument, rLibName, rModName ); - - return pModWin; -} - -void BasicIDEShell::Move() -{ - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - ((ModulWindow*)pCurWin)->FrameWindowMoved(); -} - -void BasicIDEShell::ShowCursor( bool bOn ) -{ - if ( pCurWin && pCurWin->ISA( ModulWindow ) ) - ((ModulWindow*)pCurWin)->ShowCursor( bOn ); -} - -// Hack for #101048 -sal_Int32 getBasicIDEShellCount( void ); - -// Nur wenn Basicfenster oben: -void BasicIDEShell::ExecuteBasic( SfxRequest& rReq ) -{ - if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) ) - return; - - pCurWin->ExecuteCommand( rReq ); - sal_Int32 nCount = getBasicIDEShellCount(); - if( nCount ) - CheckWindows(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx deleted file mode 100644 index dc518e40f..000000000 --- a/basctl/source/basicide/basides3.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#define SI_NOCONTROL -#define SI_NOSBXCONTROLS - -#include -#include - - -#define _SOLAR__PRIVATE 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::io; - - -DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ) -{ - bCreatingWindow = sal_True; - - sal_uLong nKey = 0; - DialogWindow* pWin = 0; - String aLibName( rLibName ); - String aDlgName( rDlgName ); - - if ( !aLibName.Len() ) - aLibName = String::CreateFromAscii( "Standard" ); - - rDocument.getOrCreateLibrary( E_DIALOGS, aLibName ); - - if ( !aDlgName.Len() ) - aDlgName = rDocument.createObjectName( E_DIALOGS, aLibName ); - - // Vielleicht gibt es ein suspendiertes? - pWin = FindDlgWin( rDocument, aLibName, aDlgName, sal_False, sal_True ); - - if ( !pWin ) - { - try - { - Reference< io::XInputStreamProvider > xISP; - if ( rDocument.hasDialog( aLibName, aDlgName ) ) - rDocument.getDialog( aLibName, aDlgName, xISP ); - else - rDocument.createDialog( aLibName, aDlgName, xISP ); - - if ( xISP.is() ) - { - // create dialog model - Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - Reference< container::XNameContainer > xDialogModel( xMSF->createInstance - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY ); - Reference< XInputStream > xInput( xISP->createInputStream() ); - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); - LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel ); - - // new dialog window - pWin = new DialogWindow( &GetViewFrame()->GetWindow(), rDocument, aLibName, aDlgName, xDialogModel ); - nKey = InsertWindowInTable( pWin ); - } - } - catch ( uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - else - { - pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED ); - IDEBaseWindow* pTmp = aIDEWindowTable.First(); - while ( pTmp && !nKey ) - { - if ( pTmp == pWin ) - nKey = aIDEWindowTable.GetCurKey(); - pTmp = aIDEWindowTable.Next(); - } - DBG_ASSERT( nKey, "CreateDlgWin: Kein Key - Fenster nicht gefunden!" ); - } - - if( pWin ) - { - pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); - pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName ); - pTabBar->Sort(); - if ( !pCurWin ) - SetCurWindow( pWin, sal_False, sal_False ); - } - - bCreatingWindow = sal_False; - return pWin; -} - -DialogWindow* BasicIDEShell::FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended ) -{ - DialogWindow* pDlgWin = 0; - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin && !pDlgWin ) - { - if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( DialogWindow ) ) ) - { - if ( !rLibName.Len() ) // nur irgendeins finden... - pDlgWin = (DialogWindow*)pWin; - else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rDlgName ) - pDlgWin = (DialogWindow*)pWin; - } - pWin = aIDEWindowTable.Next(); - } - if ( !pDlgWin && bCreateIfNotExist ) - pDlgWin = CreateDlgWin( rDocument, rLibName, rDlgName ); - - return pDlgWin; -} - -SdrView* BasicIDEShell::GetCurDlgView() const -{ - if ( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) ) - return NULL; - - DialogWindow* pWin = (DialogWindow*)pCurWin; - return pWin->GetView(); -} - -// Nur wenn Dialogfenster oben: -void BasicIDEShell::ExecuteDialog( SfxRequest& rReq ) -{ - if ( pCurWin && ( pCurWin->IsA( TYPE( DialogWindow) ) || - (rReq.GetSlot() == SID_IMPORT_DIALOG &&pCurWin->IsA( TYPE( ModulWindow) ) ) ) ) - { - pCurWin->ExecuteCommand( rReq ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx deleted file mode 100644 index 7c90d17e1..000000000 --- a/basctl/source/basicide/basidesh.cxx +++ /dev/null @@ -1,1053 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -// CLOOKS: -//#define _MENUBTN_HXX -#define _SPIN_HXX -#define _PRVWIN_HXX -//#define _FIELD_HXX *** -//#define _TAB_HXX *** -#define _DIALOGS_HXX -#define _SVRTF_HXX -#define _ISETBRW_HXX -#define _VCTRLS_HXX -#define SI_NOCONTROL -#define SI_NOSBXCONTROLS - -#define ITEMID_SIZE 0 - -// Falls ohne PCH's: -#include - - -#define _SOLAR__PRIVATE 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BasicIDEShell -#define SFX_TYPEMAP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; -using ::rtl::OUString; - -static const rtl::OUString sStandardLibName( RTL_CONSTASCII_USTRINGPARAM("Standard")); - -typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE; - -class ContainerListenerImpl : public ContainerListenerBASE -{ - BasicIDEShell* mpShell; -public: - - ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {} - - ~ContainerListenerImpl() - { - } - - void addContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName ) - { - try - { - uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, sal_False ), uno::UNO_QUERY ); - if ( xContainer.is() ) - { - uno::Reference< container::XContainerListener > xContainerListener( this ); - xContainer->addContainerListener( xContainerListener ); - } - } - catch( uno::Exception& ) {} - } - void removeContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName ) - { - try - { - uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, sal_False ), uno::UNO_QUERY ); - if ( xContainer.is() ) - { - uno::Reference< container::XContainerListener > xContainerListener( this ); - xContainer->removeContainerListener( xContainerListener ); - } - } - catch( uno::Exception& ) {} - } - - // XEventListener - virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {} - - // XContainerListener - virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException ) - { - rtl::OUString sModuleName; - if( mpShell && ( Event.Accessor >>= sModuleName ) ) - mpShell->FindBasWin( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, sal_True, sal_False ); - } - virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { } - virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException ) - { - rtl::OUString sModuleName; - if( mpShell && ( Event.Accessor >>= sModuleName ) ) - { - IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, sal_True ); - if( pWin ) - mpShell->RemoveWindow( pWin, sal_True, sal_True ); - } - } - -}; - -TYPEINIT1( BasicIDEShell, SfxViewShell ); - -SFX_IMPL_NAMED_VIEWFACTORY( BasicIDEShell, "Default" ) -{ - SFX_VIEW_REGISTRATION( BasicDocShell ); -} - - -SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) -{ - SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); - SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_SHOW_PROPERTYBROWSER, BASICIDE_UI_FEATURE_SHOW_BROWSER); - SFX_POPUPMENU_REGISTRATION( IDEResId( RID_POPUP_DLGED ) ); -} - - - -#define IDE_VIEWSHELL_FLAGS SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW - - -static sal_Int32 GnBasicIDEShellCount; -sal_Int32 getBasicIDEShellCount( void ) - { return GnBasicIDEShellCount; } - -BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : - SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ), - m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ), - aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ), - aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ), - aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ), - m_bAppBasicModified( sal_False ), - m_aNotifier( *this ) -{ - m_xLibListener = new ContainerListenerImpl( this ); - Init(); - GnBasicIDEShellCount++; -} - - - -void BasicIDEShell::Init() -{ - TbxControls::RegisterControl( SID_CHOOSE_CONTROLS ); - SvxPosSizeStatusBarControl::RegisterControl(); - SvxInsertStatusBarControl::RegisterControl(); - XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE ); - SvxSimpleUndoRedoController::RegisterControl( SID_UNDO ); - SvxSimpleUndoRedoController::RegisterControl( SID_REDO ); - - SvxSearchDialogWrapper::RegisterChildWindow( sal_False ); - - IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_True; - - SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BasicIDE" ) ) ); - SetHelpId( SVX_INTERFACE_BASIDE_VIEWSH ); - - LibBoxControl::RegisterControl( SID_BASICIDE_LIBSELECTOR ); - LanguageBoxControl::RegisterControl( SID_BASICIDE_CURRENT_LANG ); - - CreateModulWindowLayout(); - - GetViewFrame()->GetWindow().SetBackground(); - - pCurWin = 0; - m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); - pObjectCatalog = 0; - bCreatingWindow = sal_False; - - m_pCurLocalizationMgr = NULL; - - pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); - pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); - bTabBarSplitted = sal_False; - - nCurKey = 100; - InitScrollBars(); - InitTabBar(); - - SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), false, false ); - - if ( IDE_DLL() && IDE_DLL()->pShell == NULL ) - IDE_DLL()->pShell = this; - - IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_False; - - // It's enough to create the controller ... - // It will be public by using magic :-) - new BasicIDEController( this ); - - // Force updating the title ! Because it must be set to the controller - // it has to be called directly after creating those controller. - SetMDITitle (); - - UpdateWindows(); -} - -BasicIDEShell::~BasicIDEShell() -{ - m_aNotifier.dispose(); - - if ( IDE_DLL() && IDE_DLL()->pShell == this ) - IDE_DLL()->pShell = NULL; - - // Damit bei einem Basic-Fehler beim Speichern die Shell nicht sofort - // wieder hoch kommt: - IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_True; - - SetWindow( 0 ); - SetCurWindow( 0 ); - - // Alle Fenster zerstoeren: - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin ) - { - // Kein Store, passiert bereits, wenn die BasicManager zerstoert werden. - delete pWin; - pWin = aIDEWindowTable.Next(); - } - - aIDEWindowTable.Clear(); - delete pTabBar; - delete pObjectCatalog; - DestroyModulWindowLayout(); - - ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() ); - // Destroy all ContainerListeners for Basic Container. - if ( pListener ) - pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); - - IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_False; - - GnBasicIDEShellCount--; -} - -void BasicIDEShell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateWindows(); -} - -void BasicIDEShell::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateWindows(); -} - -void BasicIDEShell::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) -{ - StoreAllWindowData(); -} - -void BasicIDEShell::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) -{ - // #i115671: Update SID_SAVEDOC after saving is completed - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_SAVEDOC ); -} - -void BasicIDEShell::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) -{ - StoreAllWindowData(); -} - -void BasicIDEShell::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument ) -{ - if ( !_rDocument.isValid() ) - return; - - bool bSetCurWindow = false; - bool bSetCurLib = ( _rDocument == m_aCurDocument ); - - // remove all windows which belong to this document - for ( sal_uLong nWin = aIDEWindowTable.Count(); nWin; ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin ); - if ( pWin->IsDocument( _rDocument ) ) - { - if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) ) - { - pWin->AddStatus( BASWIN_TOBEKILLED ); - pWin->Hide(); - StarBASIC::Stop(); - // there's no notify - pWin->BasicStopped(); - } - else - { - pWin->StoreData(); - if ( pWin == pCurWin ) - bSetCurWindow = true; - RemoveWindow( pWin, sal_True, sal_False ); - } - } - } - - // remove lib info - BasicIDEData* pData = IDE_DLL()->GetExtraData(); - if ( pData ) - pData->GetLibInfos().RemoveInfoFor( _rDocument ); - - if ( bSetCurLib ) - SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), true, false ); - else if ( bSetCurWindow ) - SetCurWindow( FindApplicationWindow(), sal_True ); -} - -void BasicIDEShell::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) -{ - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, sal_True, sal_False ); - SetMDITitle(); -} - -void BasicIDEShell::onDocumentModeChanged( const ScriptDocument& _rDocument ) -{ - for ( sal_uLong nWin = aIDEWindowTable.Count(); nWin; ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin ); - if ( pWin->IsDocument( _rDocument ) && _rDocument.isDocument() ) - pWin->SetReadOnly( _rDocument.isReadOnly() ); - } -} - -void BasicIDEShell::StoreAllWindowData( sal_Bool bPersistent ) -{ - for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - DBG_ASSERT( pWin, "PrepareClose: NULL-Pointer in Table?" ); - if ( !pWin->IsSuspended() ) - pWin->StoreData(); - } - - if ( bPersistent ) - { - SFX_APP()->SaveBasicAndDialogContainer(); - SetAppBasicModified( sal_False ); - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_SAVEDOC ); - pBindings->Update( SID_SAVEDOC ); - } - } -} - - -sal_uInt16 BasicIDEShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) -{ - (void)bForBrowsing; - - // da es nach Drucken etc. (DocInfo) modifiziert ist, hier resetten - GetViewFrame()->GetObjectShell()->SetModified(sal_False); - - if ( StarBASIC::IsRunning() ) - { - if( bUI ) - { - String aErrorStr( IDEResId( RID_STR_CANNOTCLOSE ) ); - Window *pParent = &GetViewFrame()->GetWindow(); - InfoBox( pParent, aErrorStr ).Execute(); - } - return sal_False; - } - else - { - sal_Bool bCanClose = sal_True; - for ( sal_uLong nWin = 0; bCanClose && ( nWin < aIDEWindowTable.Count() ); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - if ( !pWin->CanClose() ) - { - if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) ) - SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false ); - SetCurWindow( pWin, sal_True ); - bCanClose = sal_False; - } - } - - if ( bCanClose ) - StoreAllWindowData( sal_False ); // Nicht auf Platte schreiben, das passiert am Ende automatisch - - return bCanClose; - } -} - -void BasicIDEShell::InitScrollBars() -{ - aVScrollBar.SetLineSize( 300 ); - aVScrollBar.SetPageSize( 2000 ); - aHScrollBar.SetLineSize( 300 ); - aHScrollBar.SetPageSize( 2000 ); - aHScrollBar.Enable(); - aVScrollBar.Enable(); - aVScrollBar.Show(); - aHScrollBar.Show(); - aScrollBarBox.Show(); -} - - - -void BasicIDEShell::InitTabBar() -{ - pTabBar->Enable(); - pTabBar->Show(); - pTabBar->SetSelectHdl( LINK( this, BasicIDEShell, TabBarHdl ) ); -} - - -Size BasicIDEShell::GetOptimalSizePixel() const -{ - return Size( 400, 300 ); -} - - - -void BasicIDEShell::OuterResizePixel( const Point &rPos, const Size &rSize ) -{ - // Adjust fliegt irgendwann raus... - AdjustPosSizePixel( rPos, rSize ); -} - - -IMPL_LINK_INLINE_START( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar ) -{ - (void)pTBar; - bTabBarSplitted = sal_True; - ArrangeTabBar(); - - return 0; -} -IMPL_LINK_INLINE_END( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar ) - - - -IMPL_LINK( BasicIDEShell, TabBarHdl, TabBar *, pCurTabBar ) -{ - sal_uInt16 nCurId = pCurTabBar->GetCurPageId(); - IDEBaseWindow* pWin = aIDEWindowTable.Get( nCurId ); - DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" ); - SetCurWindow( pWin ); - - return 0; -} - - - -sal_Bool BasicIDEShell::NextPage( sal_Bool bPrev ) -{ - sal_Bool bRet = sal_False; - sal_uInt16 nPos = pTabBar->GetPagePos( pTabBar->GetCurPageId() ); - - if ( bPrev ) - --nPos; - else - ++nPos; - - if ( nPos < pTabBar->GetPageCount() ) - { - IDEBaseWindow* pWin = aIDEWindowTable.Get( pTabBar->GetPageId( nPos ) ); - SetCurWindow( pWin, sal_True ); - bRet = sal_True; - } - - return bRet; -} - - - -void BasicIDEShell::ArrangeTabBar() -{ - Size aSz( GetViewFrame()->GetWindow().GetOutputSizePixel() ); - long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1; - long nPos = pTabBar->GetSplitSize(); - if ( nPos <= nBoxPos ) - { - Point aPnt( pTabBar->GetPosPixel() ); - long nH = aHScrollBar.GetSizePixel().Height(); - pTabBar->SetPosSizePixel( aPnt, Size( nPos, nH ) ); - long nScrlStart = aPnt.X() + nPos; - aHScrollBar.SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) ); - aHScrollBar.Update(); - } -} - - - -::svl::IUndoManager* BasicIDEShell::GetUndoManager() -{ - ::svl::IUndoManager* pMgr = NULL; - if( pCurWin ) - pMgr = pCurWin->GetUndoManager(); - - return pMgr; -} - - - -void BasicIDEShell::ShowObjectDialog( sal_Bool bShow, sal_Bool bCreateOrDestroy ) -{ - if ( bShow ) - { - if ( !pObjectCatalog && bCreateOrDestroy ) - { - pObjectCatalog = new ObjectCatalog( &GetViewFrame()->GetWindow() ); - // Position wird in BasicIDEData gemerkt und vom Dlg eingestellt - if ( pObjectCatalog ) - { - pObjectCatalog->SetCancelHdl( LINK( this, BasicIDEShell, ObjectDialogCancelHdl ) ); - BasicEntryDescriptor aDesc; - IDEBaseWindow* pCurWin_ = GetCurWindow(); - if ( pCurWin_ ) - aDesc = pCurWin_->CreateEntryDescriptor(); - pObjectCatalog->SetCurrentEntry( aDesc ); - } - } - - // Die allerletzten Aenderungen... - if ( pCurWin ) - pCurWin->StoreData(); - - if ( pObjectCatalog ) - { - pObjectCatalog->UpdateEntries(); - pObjectCatalog->Show(); - } - } - else if ( pObjectCatalog ) - { - pObjectCatalog->Hide(); - if ( bCreateOrDestroy ) - { - // Wegen OS/2-Focus-Problem pObjectCatalog vorm delete auf NULL - ObjectCatalog* pTemp = pObjectCatalog; - pObjectCatalog = 0; - delete pTemp; - } - } -} - - - -void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, - const SfxHint& rHint, const TypeId& ) -{ - if ( IDE_DLL()->GetShell() ) - { - if ( rHint.IsA( TYPE( SfxSimpleHint ) ) ) - { - switch ( ((SfxSimpleHint&)rHint).GetId() ) - { - case SFX_HINT_DYING: - { - EndListening( rBC, sal_True /* Alle abmelden */ ); - if ( pObjectCatalog ) - pObjectCatalog->UpdateEntries(); - } - break; - } - - if ( rHint.IsA( TYPE( SbxHint ) ) ) - { - SbxHint& rSbxHint = (SbxHint&)rHint; - sal_uLong nHintId = rSbxHint.GetId(); - if ( ( nHintId == SBX_HINT_BASICSTART ) || - ( nHintId == SBX_HINT_BASICSTOP ) ) - { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICRUN ); - pBindings->Update( SID_BASICRUN ); - pBindings->Invalidate( SID_BASICCOMPILE ); - pBindings->Update( SID_BASICCOMPILE ); - pBindings->Invalidate( SID_BASICSTEPOVER ); - pBindings->Update( SID_BASICSTEPOVER ); - pBindings->Invalidate( SID_BASICSTEPINTO ); - pBindings->Update( SID_BASICSTEPINTO ); - pBindings->Invalidate( SID_BASICSTEPOUT ); - pBindings->Update( SID_BASICSTEPOUT ); - pBindings->Invalidate( SID_BASICSTOP ); - pBindings->Update( SID_BASICSTOP ); - pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS ); - pBindings->Update( SID_BASICIDE_MANAGEBRKPNTS ); - pBindings->Invalidate( SID_BASICIDE_MODULEDLG ); - pBindings->Update( SID_BASICIDE_MODULEDLG ); - pBindings->Invalidate( SID_BASICLOAD ); - pBindings->Update( SID_BASICLOAD ); - } - - if ( nHintId == SBX_HINT_BASICSTOP ) - { - // Nicht nur bei Error/Break oder explizitem anhalten, - // falls durch einen Programmierfehler das Update abgeschaltet ist. - BasicIDE::BasicStopped(); - UpdateModulWindowLayout( true ); // Leer machen... - if( m_pCurLocalizationMgr ) - m_pCurLocalizationMgr->handleBasicStopped(); - } - else if( m_pCurLocalizationMgr ) - { - m_pCurLocalizationMgr->handleBasicStarted(); - } - - IDEBaseWindow* pWin = aIDEWindowTable.First(); - while ( pWin ) - { - if ( nHintId == SBX_HINT_BASICSTART ) - pWin->BasicStarted(); - else - pWin->BasicStopped(); - pWin = aIDEWindowTable.Next(); - } - } - } - } - } -} - - - -void BasicIDEShell::CheckWindows() -{ - sal_Bool bSetCurWindow = sal_False; - for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - if ( pWin->GetStatus() & BASWIN_TOBEKILLED ) - { - pWin->StoreData(); - if ( pWin == pCurWin ) - bSetCurWindow = sal_True; - RemoveWindow( pWin, sal_True, sal_False ); - nWin--; - } - } - if ( bSetCurWindow ) - SetCurWindow( FindApplicationWindow(), sal_True ); -} - - - -void BasicIDEShell::RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, sal_Bool bDestroy ) -{ - sal_Bool bChangeCurWindow = pCurWin ? sal_False : sal_True; - for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName ) - { - if ( pWin == pCurWin ) - bChangeCurWindow = sal_True; - pWin->StoreData(); - RemoveWindow( pWin, bDestroy, sal_False ); - nWin--; - } - } - if ( bChangeCurWindow ) - SetCurWindow( FindApplicationWindow(), sal_True ); -} - - - -void BasicIDEShell::UpdateWindows() -{ - // Alle Fenster, die nicht angezeigt werden duerfen, entfernen - sal_Bool bChangeCurWindow = pCurWin ? sal_False : sal_True; - if ( m_aCurLibName.Len() ) - { - for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ ) - { - IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin ); - if ( !pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) - { - if ( pWin == pCurWin ) - bChangeCurWindow = sal_True; - pWin->StoreData(); - // Die Abfrage auf RUNNING verhindert den Absturz, wenn in Reschedule. - // Fenster bleibt erstmal stehen, spaeter sowieso mal umstellen, - // dass Fenster nur als Hidden markiert werden und nicht - // geloescht. - if ( !(pWin->GetStatus() & ( BASWIN_TOBEKILLED | BASWIN_RUNNINGBASIC | BASWIN_SUSPENDED ) ) ) - { - RemoveWindow( pWin, sal_False, sal_False ); - nWin--; - } - } - } - } - - if ( bCreatingWindow ) - return; - - IDEBaseWindow* pNextActiveWindow = 0; - - // Alle anzuzeigenden Fenster anzeigen - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) ); - for ( ScriptDocuments::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - StartListening( *doc->getBasicManager(), sal_True /* Nur einmal anmelden */ ); - - // libraries - Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - { - String aLibName = pLibNames[ i ]; - - if ( !m_aCurLibName.Len() || ( *doc == m_aCurDocument && aLibName == m_aCurLibName ) ) - { - // check, if library is password protected and not verified - sal_Bool bProtected = sal_False; - Reference< script::XLibraryContainer > xModLibContainer( doc->getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) - { - bProtected = sal_True; - } - } - - if ( !bProtected ) - { - LibInfoItem* pLibInfoItem = 0; - BasicIDEData* pData = IDE_DLL()->GetExtraData(); - if ( pData ) - pLibInfoItem = pData->GetLibInfos().GetInfo( LibInfoKey( *doc, aLibName ) ); - - // modules - if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) - { - StarBASIC* pLib = doc->getBasicManager()->GetLib( aLibName ); - if ( pLib ) - ImplStartListening( pLib ); - - try - { - Sequence< ::rtl::OUString > aModNames( doc->getObjectNames( E_SCRIPTS, aLibName ) ); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nModCount ; j++ ) - { - String aModName = pModNames[ j ]; - ModulWindow* pWin = FindBasWin( *doc, aLibName, aModName, sal_False ); - if ( !pWin ) - pWin = CreateBasWin( *doc, aLibName, aModName ); - if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName && - pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_MODULE ) - { - pNextActiveWindow = (IDEBaseWindow*)pWin; - } - } - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - // dialogs - Reference< script::XLibraryContainer > xDlgLibContainer( doc->getLibraryContainer( E_DIALOGS ) ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) ) - { - try - { - Sequence< ::rtl::OUString > aDlgNames = doc->getObjectNames( E_DIALOGS, aLibName ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ ) - { - String aDlgName = pDlgNames[ j ]; - // this find only looks for non-suspended windows; - // suspended windows are handled in CreateDlgWin - DialogWindow* pWin = FindDlgWin( *doc, aLibName, aDlgName, sal_False ); - if ( !pWin ) - pWin = CreateDlgWin( *doc, aLibName, aDlgName ); - if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName && - pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_DIALOG ) - { - pNextActiveWindow = (IDEBaseWindow*)pWin; - } - } - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - } - } - } - - if ( bChangeCurWindow ) - { - if ( !pNextActiveWindow ) - pNextActiveWindow = FindApplicationWindow(); - SetCurWindow( pNextActiveWindow, sal_True ); - } -} - -void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, sal_Bool bDestroy, sal_Bool bAllowChangeCurWindow ) -{ - DBG_ASSERT( pWindow_, "Kann keinen NULL-Pointer loeschen!" ); - sal_uLong nKey = aIDEWindowTable.GetKey( pWindow_ ); - pTabBar->RemovePage( (sal_uInt16)nKey ); - aIDEWindowTable.Remove( nKey ); - if ( pWindow_ == pCurWin ) - { - if ( bAllowChangeCurWindow ) - SetCurWindow( FindApplicationWindow(), sal_True ); - else - SetCurWindow( NULL, sal_False ); - } - if ( bDestroy ) - { - if ( !( pWindow_->GetStatus() & BASWIN_INRESCHEDULE ) ) - { - delete pWindow_; - } - else - { - pWindow_->AddStatus( BASWIN_TOBEKILLED ); - pWindow_->Hide(); - // In normal mode stop basic in windows to be deleted - // In VBA stop basic only if the running script is trying to delete - // its parent module - bool bStop = true; - if ( pWindow_->GetDocument().isInVBAMode() ) - { - SbModule* pMod = StarBASIC::GetActiveModule(); - if ( !pMod || ( pMod && ( pMod->GetName() != pWindow_->GetName() ) ) ) - bStop = false; - } - if ( bStop ) - { - StarBASIC::Stop(); - // Es kommt kein Notify... - pWindow_->BasicStopped(); - } - aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen - } - } - else - { - pWindow_->Hide(); - pWindow_->AddStatus( BASWIN_SUSPENDED ); - pWindow_->Deactivating(); - aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen - } - -} - - - -sal_uInt16 BasicIDEShell::InsertWindowInTable( IDEBaseWindow* pNewWin ) -{ - // Eigentlich prueffen, - nCurKey++; - aIDEWindowTable.Insert( nCurKey, pNewWin ); - return nCurKey; -} - - - -void BasicIDEShell::InvalidateBasicIDESlots() -{ - // Nur die, die eine optische Auswirkung haben... - - if ( IDE_DLL()->GetShell() ) - { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_UNDO ); - pBindings->Invalidate( SID_REDO ); - pBindings->Invalidate( SID_SAVEDOC ); - pBindings->Invalidate( SID_SIGNATURE ); - pBindings->Invalidate( SID_BASICIDE_CHOOSEMACRO ); - pBindings->Invalidate( SID_BASICIDE_MODULEDLG ); - pBindings->Invalidate( SID_BASICIDE_OBJCAT ); - pBindings->Invalidate( SID_BASICSTOP ); - pBindings->Invalidate( SID_BASICRUN ); - pBindings->Invalidate( SID_BASICCOMPILE ); - pBindings->Invalidate( SID_BASICLOAD ); - pBindings->Invalidate( SID_BASICSAVEAS ); - pBindings->Invalidate( SID_BASICIDE_MATCHGROUP ); - pBindings->Invalidate( SID_BASICSTEPINTO ); - pBindings->Invalidate( SID_BASICSTEPOVER ); - pBindings->Invalidate( SID_BASICSTEPOUT ); - pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS ); - pBindings->Invalidate( SID_BASICIDE_ADDWATCH ); - pBindings->Invalidate( SID_BASICIDE_REMOVEWATCH ); - pBindings->Invalidate( SID_CHOOSE_CONTROLS ); - pBindings->Invalidate( SID_PRINTDOC ); - pBindings->Invalidate( SID_PRINTDOCDIRECT ); - pBindings->Invalidate( SID_SETUPPRINTER ); - pBindings->Invalidate( SID_DIALOG_TESTMODE ); - - pBindings->Invalidate( SID_DOC_MODIFIED ); - pBindings->Invalidate( SID_BASICIDE_STAT_TITLE ); - pBindings->Invalidate( SID_BASICIDE_STAT_POS ); - pBindings->Invalidate( SID_ATTR_INSERT ); - pBindings->Invalidate( SID_ATTR_SIZE ); - } - } -} - -void BasicIDEShell::EnableScrollbars( sal_Bool bEnable ) -{ - if ( bEnable ) - { - aHScrollBar.Enable(); - aVScrollBar.Enable(); - } - else - { - aHScrollBar.Disable(); - aVScrollBar.Disable(); - } -} - -void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows, bool bCheck ) -{ - if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) ) - { - ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() ); - - m_aCurDocument = rDocument; - m_aCurLibName = aLibName; - - if ( pListener ) - { - pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); - pListener->addContainerListener( m_aCurDocument, aLibName ); - } - - if ( bUpdateWindows ) - UpdateWindows(); - - SetMDITitle(); - - SetCurLibForLocalization( rDocument, aLibName ); - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - pBindings->Invalidate( SID_BASICIDE_MANAGE_LANG ); - } - } -} - -void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName ) -{ - // Create LocalizationMgr - delete m_pCurLocalizationMgr; - Reference< resource::XStringResourceManager > xStringResourceManager; - try - { - if( aLibName.Len() ) - { - Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) ); - xStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - } - } - catch ( container::NoSuchElementException& ) - {} - m_pCurLocalizationMgr = new LocalizationMgr - ( this, rDocument, aLibName, xStringResourceManager ); - - m_pCurLocalizationMgr->handleTranslationbar(); -} - -void BasicIDEShell::ImplStartListening( StarBASIC* pBasic ) -{ - StartListening( pBasic->GetBroadcaster(), sal_True /* Nur einmal anmelden */ ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src deleted file mode 100644 index babb05aab..000000000 --- a/basctl/source/basicide/basidesh.src +++ /dev/null @@ -1,638 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#ifndef _GLOBLMN_HRC -#include -#endif -#include "dlgresid.hrc" -#include -#include - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - -String RID_STR_IDENAME -{ - Text = "BasicIDE" ; -}; -String RID_STR_FILTER_ALLFILES -{ - Text [ en-US ] = "" ; -}; -String RID_STR_NOMODULE -{ - Text [ en-US ] = "< No Module >" ; -}; -String RID_STR_WRONGPASSWORD -{ - Text [ en-US ] = "Incorrect Password" ; -}; -String RID_STR_OPEN -{ - Text [ en-US ] = "Load" ; -}; -String RID_STR_SAVE -{ - Text [ en-US ] = "Save" ; -}; -String RID_STR_SOURCETOBIG -{ - Text [ en-US ] = "The source text is too large and can be neither compiled nor saved.\nDelete some of the comments or transfer some methods into another module." ; -}; -String RID_STR_ERROROPENSTORAGE -{ - Text [ en-US ] = "Error opening file" ; -}; -String RID_STR_ERROROPENLIB -{ - Text [ en-US ] = "Error loading library" ; -}; -String RID_STR_NOLIBINSTORAGE -{ - Text [ en-US ] = "The file does not contain any BASIC libraries" ; -}; -String RID_STR_BADSBXNAME -{ - Text [ en-US ] = "Invalid Name" ; -}; -String RID_STR_LIBNAMETOLONG -{ - Text [ en-US ] = "A library name can have up to 30 characters."; -}; -String RID_STR_ERRORCHOOSEMACRO -{ - Text [ en-US ] = "Macros from other documents are not accessible."; -}; -String RID_STR_LIBISREADONLY -{ - Text [ en-US ] = "This library is read-only."; -}; -String RID_STR_REPLACELIB -{ - Text [ en-US ] = "'XX' cannot be replaced."; -}; -String RID_STR_IMPORTNOTPOSSIBLE -{ - Text [ en-US ] = "'XX' cannot be added."; -}; -String RID_STR_NOIMPORT -{ - Text [ en-US ] = "'XX' was not added."; -}; -String RID_STR_ENTERPASSWORD -{ - Text [ en-US ] = "Enter password for 'XX'"; -}; -String RID_STR_SBXNAMEALLREADYUSED -{ - Text [ en-US ] = "Name already exists" ; -}; -String RID_STR_SIGNED -{ - Text [ en-US ] = "(Signed)" ; -}; -String RID_STR_SBXNAMEALLREADYUSED2 -{ - Text [ en-US ] = "Object with same name already exists" ; -}; -String RID_STR_FILEEXISTS -{ - Text [ en-US ] = "The 'XX' file already exists" ; -}; -String RID_STR_CANNOTRUNMACRO -{ - Text [ en-US ] = "For security reasons, you cannot run this macro.\n\nFor more information, check the security settings." ; -}; -String RID_STR_COMPILEERROR -{ - Text [ en-US ] = "Compile Error: " ; -}; -String RID_STR_RUNTIMEERROR -{ - Text [ en-US ] = "Runtime Error: #" ; -}; -String RID_STR_SEARCHNOTFOUND -{ - Text [ en-US ] = "Search key not found" ; -}; -String RID_STR_SEARCHFROMSTART -{ - Text [ en-US ] = "Search to last module complete. Continue at first module?" ; -}; -String RID_STR_SEARCHREPLACES -{ - Text [ en-US ] = "Search key replaced XX times" ; -}; -String RID_STR_COULDNTREAD -{ - Text [ en-US ] = "The file could not be read" ; -}; -String RID_STR_COULDNTWRITE -{ - Text [ en-US ] = "The file could not be saved" ; -}; -String RID_STR_CANNOTCHANGENAMESTDLIB -{ - Text [ en-US ] = "The name of the default library cannot be changed." ; -}; -String RID_STR_CANNOTCHANGENAMEREFLIB -{ - Text [ en-US ] = "The name of a referenced library cannot be changed." ; -}; -String RID_STR_CANNOTUNLOADSTDLIB -{ - Text [ en-US ] = "The default library cannot be deactivated" ; -}; -String RID_STR_GENERATESOURCE -{ - Text [ en-US ] = "Generating source" ; -}; -String RID_STR_FILENAME -{ - Text [ en-US ] = "File name:" ; -}; -String RID_STR_APPENDLIBS -{ - Text [ en-US ] = "Import Libraries" ; -}; -String RID_STR_QUERYDELMACRO -{ - Text [ en-US ] = "Do you want to delete the macro XX?" ; -}; -String RID_STR_QUERYDELDIALOG -{ - Text [ en-US ] = "Do you want to delete the XX dialog?" ; -}; -String RID_STR_QUERYDELLIB -{ - Text [ en-US ] = "Do you want to delete the XX library?" ; -}; -String RID_STR_QUERYDELLIBREF -{ - Text [ en-US ] = "Do you want to delete the reference to the XX library?" ; -}; -String RID_STR_QUERYDELMODULE -{ - Text [ en-US ] = "Do you want to delete the XX module?" ; -}; -String RID_STR_OBJNOTFOUND -{ - Text [ en-US ] = "Object or method not found" ; -}; -String RID_STR_BASIC -{ - Text [ en-US ] = "BASIC" ; -}; -String RID_STR_LINE -{ - // Abkuerzung fuer 'Zeile' - Text [ en-US ] = "Ln" ; -}; -String RID_STR_COLUMN -{ - // Abkuerzung fuer 'Spalte' - Text [ en-US ] = "Col" ; -}; -String RID_STR_DOC -{ - Text [ en-US ] = "Document" ; -}; -String RID_BASICIDE_OBJECTBAR -{ - Text [ en-US ] = "Macro Bar" ; -}; -String RID_STR_CANNOTCLOSE -{ - Text [ en-US ] = "The window cannot be closed while BASIC is running." ; -}; -String RID_STR_REPLACESTDLIB -{ - Text [ en-US ] = "The default library cannot be replaced." ; -}; -String RID_STR_REFNOTPOSSIBLE -{ - Text [ en-US ] = "Reference to 'XX' not possible." ; -}; -String RID_STR_WATCHNAME -{ - Text [ en-US ] = "Watch" ; -}; -String RID_STR_WATCHVARIABLE -{ - Text [ en-US ] = "Variable" ; -}; -String RID_STR_WATCHVALUE -{ - Text [ en-US ] = "Value" ; -}; -String RID_STR_WATCHTYPE -{ - Text [ en-US ] = "Type" ; -}; -String RID_STR_STACKNAME -{ - Text [ en-US ] = "Call Stack" ; -}; -String RID_STR_INITIDE -{ - Text [ en-US ] = "BASIC Initialization" ; -}; -String RID_STR_STDMODULENAME -{ - Text [ en-US ] = "Module" ; -}; -String RID_STR_STDDIALOGNAME -{ - Text [ en-US ] = "Dialog" ; -}; -String RID_STR_STDLIBNAME -{ - Text [ en-US ] = "Library" ; -}; -String RID_STR_NEWLIB -{ - Text [ en-US ] = "New Library" ; -}; -String RID_STR_NEWMOD -{ - Text [ en-US ] = "New Module" ; -}; -String RID_STR_NEWDLG -{ - Text [ en-US ] = "New Dialog" ; -}; -String RID_STR_ALL -{ - Text [ en-US ] = "All" ; -}; -String RID_STR_PAGE -{ - Text [ en-US ] = "Page" ; -}; -String RID_STR_MACRONAMEREQ -{ - Text [ en-US ] = "A name must be entered." ; -}; -String RID_STR_WILLSTOPPRG -{ - Text [ en-US ] = "You will have to restart the program after this edit.\nContinue?" ; -}; -String RID_STR_SEARCHALLMODULES -{ - Text [ en-US ] = "Do you want to replace the text in all active modules?" ; -}; -Edit RID_EDT_WATCHEDIT -{ - HelpId = HID_BASICIDE_WATCHWINDOW_EDIT ; - Border = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 80 , 12 ) ; -}; -ImageButton RID_IMGBTN_REMOVEWATCH -{ - HelpId = HID_BASICIDE_REMOVEWATCH ; - SmallStyle = TRUE ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "baswatr.bmp" ; }; - MASKCOLOR - }; - QuickHelpText [ en-US ] = "Remove Watch" ; -}; - -String RID_STR_REMOVEWATCH -{ - Text [ en-US ] = "Watch:" ; -}; - -String RID_STR_STACK -{ - Text [ en-US ] = "Calls: " ; -}; - -String RID_STR_USERMACROS -{ - Text [ en-US ] = "My Macros" ; -}; - -String RID_STR_USERDIALOGS -{ - Text [ en-US ] = "My Dialogs" ; -}; - -String RID_STR_USERMACROSDIALOGS -{ - Text [ en-US ] = "My Macros & Dialogs" ; -}; - -String RID_STR_SHAREMACROS -{ - Text [ en-US ] = "%PRODUCTNAME Macros" ; -}; - -String RID_STR_SHAREDIALOGS -{ - Text [ en-US ] = "%PRODUCTNAME Dialogs" ; -}; - -String RID_STR_SHAREMACROSDIALOGS -{ - Text [ en-US ] = "%PRODUCTNAME Macros & Dialogs" ; -}; - -Menu RID_POPUP_BRKPROPS -{ - Text [ en-US ] = "Properties" ; - DefaultItemId = RID_BRKPROPS ; - ItemList = - { - MenuItem - { - Identifier = RID_ACTIV ; - HelpId = HID_BASICIDE_ACTIV ; - Text [ en-US ] = "Active" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = RID_BRKPROPS ; - HelpId = HID_BASICIDE_BRKPROPS ; - Text [ en-US ] = "Properties..." ; - }; - }; -}; - -Menu RID_POPUP_BRKDLG -{ - Text [ en-US ] = "Manage Breakpoints" ; - ItemList = - { - MenuItem - { - Identifier = RID_BRKDLG ; - HelpId = HID_BASICIDE_BRKDLG ; - Text [ en-US ] = "Manage Breakpoints..." ; - }; - }; -}; - -Menu RID_POPUP_TABBAR -{ - DefaultItemId = SID_BASICIDE_HIDECURPAGE ; - ItemList = - { - MenuItem - { - Identifier = RID_INSERT ; - Text [ en-US ] = "Insert" ; - Submenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = SID_BASICIDE_NEWMODULE ; - HelpId = CMD_SID_BASICIDE_NEWMODULE ; - Text [ en-US ] = "BASIC Module" ; - }; - MenuItem - { - Identifier = SID_BASICIDE_NEWDIALOG ; - HelpId = CMD_SID_BASICIDE_NEWDIALOG ; - Text [ en-US ] = "BASIC Dialog" ; - }; - }; - }; - }; - MenuItem - { - Identifier = SID_BASICIDE_DELETECURRENT ; - HelpId = CMD_SID_BASICIDE_DELETECURRENT ; - Text [ en-US ] = "Delete" ; - }; - MenuItem - { - Identifier = SID_BASICIDE_RENAMECURRENT ; - HelpId = CMD_SID_BASICIDE_RENAMECURRENT ; - Text [ en-US ] = "Rename" ; - }; - MenuItem - { - Identifier = SID_BASICIDE_HIDECURPAGE ; - HelpId = CMD_SID_BASICIDE_HIDECURPAGE ; - Text [ en-US ] = "Hide" ; - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = SID_BASICIDE_MODULEDLG ; - HelpId = CMD_SID_BASICIDE_MODULEDLG ; - Text [ en-US ] = "Modules..." ; - }; - }; -}; - -Menu RID_POPUP_DLGED -{ - DefaultItemId = SID_SHOW_PROPERTYBROWSER ; - ItemList = - { - MenuItem - { - Identifier = SID_SHOW_PROPERTYBROWSER ; - HelpId = CMD_SID_SHOW_PROPERTYBROWSER ; - Text [ en-US ] = "Properties..."; - }; - }; -}; - -ImageList RID_IMGLST_LAYOUT -{ - Prefix = "im"; - MASKCOLOR - IdList = - { - IMGID_BRKENABLED ; - IMGID_BRKDISABLED ; - IMGID_STEPMARKER ; - IMGID_ERRORMARKER ; - }; -}; -Image RID_IMG_LOCKED -{ - ImageBitmap = Bitmap { File = "locked.bmp" ; }; - MASKCOLOR -}; - -Image RID_IMG_INSTALLATION -{ - ImageBitmap = Bitmap { File = "harddisk_16.png"; }; - MASKCOLOR -}; -Image RID_IMG_DOCUMENT -{ - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR -}; -Image RID_IMG_MODLIB -{ - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR -}; -Image RID_IMG_MODLIBNOTLOADED -{ - ImageBitmap = Bitmap { File = "im30827.png"; }; - MASKCOLOR -}; -Image RID_IMG_MODULE -{ - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR -}; -Image RID_IMG_MACRO -{ - ImageBitmap = Bitmap { File = "im30822.png"; }; - MASKCOLOR -}; -Image RID_IMG_DLGLIB -{ - ImageBitmap = Bitmap { File = "dialogfolder_16.png"; }; - MASKCOLOR -}; -Image RID_IMG_DLGLIBNOTLOADED -{ - ImageBitmap = Bitmap { File = "dialogfoldernot_16.png"; }; - MASKCOLOR -}; -Image RID_IMG_DIALOG -{ - ImageBitmap = Bitmap { File = "im30823.png"; }; - MASKCOLOR -}; -String RID_STR_QUERYREPLACEMACRO -{ - Text [ en-US ] = "Do you want to overwrite the XX macro?" ; -}; - -String RID_STR_TRANSLATION_NOTLOCALIZED -{ - Text [ en-US ] = "" ; -}; - -String RID_STR_TRANSLATION_DEFAULT -{ - Text [ en-US ] = "[Default Language]" ; -}; - -String RID_STR_DOCUMENT_OBJECTS -{ - Text [ en-US ] = "Document Objects" ; -}; - -String RID_STR_USERFORMS -{ - Text [ en-US ] = "Forms" ; -}; - -String RID_STR_NORMAL_MODULES -{ - Text [ en-US ] = "Modules" ; -}; - -String RID_STR_CLASS_MODULES -{ - Text [ en-US ] = "Class Modules" ; -}; - -String RID_STR_DLGIMP_CLASH_RENAME -{ - Text [ en-US ] = "Rename" ; -}; - -String RID_STR_DLGIMP_CLASH_REPLACE -{ - Text [ en-US ] = "Replace" ; -}; - -String RID_STR_DLGIMP_CLASH_TITLE -{ - Text [ en-US ] = "Dialog Import - Name already used" ; -}; - -String RID_STR_DLGIMP_CLASH_TEXT -{ - Text [ en-US ] = "The library already contains a dialog with the name:\n\n$(ARG1)\n\nRename dialog to keep current dialog or replace existing dialog.\n " ; -}; - -String RID_STR_DLGIMP_MISMATCH_ADD -{ - Text [ en-US ] = "Add" ; -}; - -String RID_STR_DLGIMP_MISMATCH_OMIT -{ - Text [ en-US ] = "Omit" ; -}; - -String RID_STR_DLGIMP_MISMATCH_TITLE -{ - Text [ en-US ] = "Dialog Import - Language Mismatch" ; -}; - -String RID_STR_DLGIMP_MISMATCH_TEXT -{ - Text [ en-US ] = "The dialog to be imported supports other languages than the target library.\n\nAdd these languages to the library to keep additional language resources provided by the dialog or omit them to stay with the current library languages.\n\nNote: For languages not supported by the dialog the resources of the dialog's default language will be used.\n " ; -}; - - -#define MN_EDIT 20 -#define MN_VIEW 21 -#define MN_EXTRA 22 -#define MN_WIN 30 -#define MN_HELP 31 -#define MN_TEMPLATES 11 - -#define MN_PLEDIT 20 -#define MN_PLVIEW 21 -#define MN_PLEXTRA 22 -#define MN_PLWIN 30 -#define MN_PLHELP 31 -#define MN_PLTEMPLATES 11 - -/* - -The application menu bar resource has become obsolete. You can now find the menu bar definition at: -/basicide/menubar/menubar.xml. - -*/ diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx deleted file mode 100644 index 0b37c7b65..000000000 --- a/basctl/source/basicide/basobj2.cxx +++ /dev/null @@ -1,458 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include "basobj.hxx" -#include "iderdll.hxx" -#include "iderdll2.hxx" -#include "iderid.hxx" -#include "macrodlg.hxx" -#include "moduldlg.hxx" -#include "basidesh.hxx" -#include "basidesh.hrc" -#include "baside2.hxx" -#include "basicmod.hxx" -#include "basdoc.hxx" - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; - - -//---------------------------------------------------------------------------- - -extern "C" { - SAL_DLLPUBLIC_EXPORT rtl_uString* basicide_choose_macro( void* pOnlyInDocument_AsXModel, sal_Bool bChooseOnly, rtl_uString* pMacroDesc ) - { - ::rtl::OUString aMacroDesc( pMacroDesc ); - Reference< frame::XModel > aDocument( static_cast< frame::XModel* >( pOnlyInDocument_AsXModel ) ); - ::rtl::OUString aScriptURL = BasicIDE::ChooseMacro( aDocument, bChooseOnly, aMacroDesc ); - rtl_uString* pScriptURL = aScriptURL.pData; - rtl_uString_acquire( pScriptURL ); - - return pScriptURL; - } - SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer( sal_Int16 nTabId ) - { - OSL_TRACE("in basicide_macro_organizer"); - BasicIDE::Organize( nTabId ); - } -} - -namespace BasicIDE -{ -//---------------------------------------------------------------------------- - -void Organize( sal_Int16 tabId ) -{ - BasicIDEDLL::Init(); - - BasicEntryDescriptor aDesc; - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow(); - if ( pCurWin ) - aDesc = pCurWin->CreateEntryDescriptor(); - } - - Window* pParent = Application::GetDefDialogParent(); - OrganizeDialog* pDlg = new OrganizeDialog( pParent, tabId, aDesc ); - pDlg->Execute(); - delete pDlg; -} - -//---------------------------------------------------------------------------- - -sal_Bool IsValidSbxName( const String& rName ) -{ - for ( sal_uInt16 nChar = 0; nChar < rName.Len(); nChar++ ) - { - sal_Bool bValid = ( ( rName.GetChar(nChar) >= 'A' && rName.GetChar(nChar) <= 'Z' ) || - ( rName.GetChar(nChar) >= 'a' && rName.GetChar(nChar) <= 'z' ) || - ( rName.GetChar(nChar) >= '0' && rName.GetChar(nChar) <= '9' && nChar ) || - ( rName.GetChar(nChar) == '_' ) ); - if ( !bValid ) - return sal_False; - } - return sal_True; -} - -static sal_Bool StringCompareLessThan( const String& rStr1, const String& rStr2 ) -{ - return (rStr1.CompareIgnoreCaseToAscii( rStr2 ) == COMPARE_LESS); -} - -//---------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > GetMergedLibraryNames( const Reference< script::XLibraryContainer >& xModLibContainer, const Reference< script::XLibraryContainer >& xDlgLibContainer ) -{ - // create a sorted list of module library names - ::std::vector aModLibList; - if ( xModLibContainer.is() ) - { - Sequence< ::rtl::OUString > aModLibNames = xModLibContainer->getElementNames(); - sal_Int32 nModLibCount = aModLibNames.getLength(); - const ::rtl::OUString* pModLibNames = aModLibNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nModLibCount ; i++ ) - aModLibList.push_back( pModLibNames[ i ] ); - ::std::sort( aModLibList.begin() , aModLibList.end() , StringCompareLessThan ); - } - - // create a sorted list of dialog library names - ::std::vector aDlgLibList; - if ( xDlgLibContainer.is() ) - { - Sequence< ::rtl::OUString > aDlgLibNames = xDlgLibContainer->getElementNames(); - sal_Int32 nDlgLibCount = aDlgLibNames.getLength(); - const ::rtl::OUString* pDlgLibNames = aDlgLibNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nDlgLibCount ; i++ ) - aDlgLibList.push_back( pDlgLibNames[ i ] ); - ::std::sort( aDlgLibList.begin() , aDlgLibList.end() , StringCompareLessThan ); - } - - // merge both lists - ::std::vector aLibList( aModLibList.size() + aDlgLibList.size() ); - ::std::merge( aModLibList.begin(), aModLibList.end(), aDlgLibList.begin(), aDlgLibList.end(), aLibList.begin(), StringCompareLessThan ); - ::std::vector::iterator aIterEnd = ::std::unique( aLibList.begin(), aLibList.end() ); // move unique elements to the front - aLibList.erase( aIterEnd, aLibList.end() ); // remove duplicates - - // copy to sequence - sal_Int32 nLibCount = aLibList.size(); - Sequence< ::rtl::OUString > aSeqLibNames( nLibCount ); - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - aSeqLibNames.getArray()[ i ] = aLibList[ i ]; - - return aSeqLibNames; -} - -//---------------------------------------------------------------------------- - -bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const String& rLibName, const String& rOldName, const String& rNewName ) -{ - if ( !rDocument.hasModule( rLibName, rOldName ) ) - { - OSL_FAIL( "BasicIDE::RenameModule: old module name is invalid!" ); - return false; - } - - if ( rDocument.hasModule( rLibName, rNewName ) ) - { - ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ); - aError.Execute(); - return false; - } - - // #i74440 - if ( rNewName.Len() == 0 ) - { - ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ); - aError.Execute(); - return false; - } - - if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) ) - return false; - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, sal_True ); - if ( pWin ) - { - // set new name in window - pWin->SetName( rNewName ); - - // set new module in module window - ModulWindow* pModWin = (ModulWindow*)pWin; - pModWin->SetSbModule( (SbModule*)pModWin->GetBasic()->FindModule( rNewName ) ); - - // update tabwriter - sal_uInt16 nId = (sal_uInt16)(pIDEShell->GetIDEWindowTable()).GetKey( pWin ); - DBG_ASSERT( nId, "No entry in Tabbar!" ); - if ( nId ) - { - BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar(); - pTabBar->SetPageText( nId, rNewName ); - pTabBar->Sort(); - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); - } - } - } - return true; -} - - -//---------------------------------------------------------------------------- - -namespace -{ - struct MacroExecutionData - { - ScriptDocument aDocument; - SbMethodRef xMethod; - - MacroExecutionData() - :aDocument( ScriptDocument::NoDocument ) - ,xMethod( NULL ) - { - } - }; - - class MacroExecution - { - public: - DECL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData* ); - }; - - - IMPL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData*, i_pData ) - { - (void)pThis; - ENSURE_OR_RETURN( i_pData, "wrong MacroExecutionData", 0L ); - // take ownership of the data - ::std::auto_ptr< MacroExecutionData > pData( i_pData ); - - DBG_ASSERT( pData->xMethod->GetParent()->GetFlags() & SBX_EXTSEARCH, "Kein EXTSEARCH!" ); - - // in case this is a document-local macro, try to protect the document's Undo Manager from - // flawed scripts - ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard; - if ( pData->aDocument.isDocument() ) - pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) ); - - BasicIDE::RunMethod( pData->xMethod ); - - return 1L; - } -} - -//---------------------------------------------------------------------------- - -::rtl::OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc ) -{ - (void)rMacroDesc; - - BasicIDEDLL::Init(); - - IDE_DLL()->GetExtraData()->ChoosingMacro() = sal_True; - - String aScriptURL; - sal_Bool bError = sal_False; - SbMethod* pMethod = NULL; - - ::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, sal_True ) ); - if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() ) - pChooser->SetMode( MACROCHOOSER_CHOOSEONLY ); - - if ( !bChooseOnly && rxLimitToDocument.is() ) - // Hack! - pChooser->SetMode( MACROCHOOSER_RECORDING ); - - short nRetValue = pChooser->Execute(); - - IDE_DLL()->GetExtraData()->ChoosingMacro() = sal_False; - - switch ( nRetValue ) - { - case MACRO_OK_RUN: - { - pMethod = pChooser->GetMacro(); - if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING ) - pMethod = pChooser->CreateMacro(); - - if ( !pMethod ) - break; - - SbModule* pModule = pMethod->GetModule(); - ENSURE_OR_BREAK( pModule, "BasicIDE::ChooseMacro: No Module found!" ); - - StarBASIC* pBasic = (StarBASIC*)pModule->GetParent(); - ENSURE_OR_BREAK( pBasic, "BasicIDE::ChooseMacro: No Basic found!" ); - - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - ENSURE_OR_BREAK( pBasMgr, "BasicIDE::ChooseMacro: No BasicManager found!" ); - - // name - String aName; - aName += pBasic->GetName(); - aName += '.'; - aName += pModule->GetName(); - aName += '.'; - aName += pMethod->GetName(); - - // language - String aLanguage = String::CreateFromAscii("Basic"); - - // location - String aLocation; - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - if ( aDocument.isDocument() ) - { - // document basic - aLocation = String::CreateFromAscii("document"); - - if ( rxLimitToDocument.is() ) - { - uno::Reference< frame::XModel > xLimitToDocument( rxLimitToDocument ); - - uno::Reference< document::XEmbeddedScripts > xScripts( rxLimitToDocument, UNO_QUERY ); - if ( !xScripts.is() ) - { // the document itself does not support embedding scripts - uno::Reference< document::XScriptInvocationContext > xContext( rxLimitToDocument, UNO_QUERY ); - if ( xContext.is() ) - xScripts = xContext->getScriptContainer(); - if ( xScripts.is() ) - { // but it is able to refer to a document which actually does support this - xLimitToDocument.set( xScripts, UNO_QUERY ); - if ( !xLimitToDocument.is() ) - { - OSL_ENSURE( false, "BasicIDE::ChooseMacro: a script container which is no document!?" ); - xLimitToDocument = rxLimitToDocument; - } - } - } - - if ( xLimitToDocument != aDocument.getDocument() ) - { - // error - bError = sal_True; - ErrorBox( NULL, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_ERRORCHOOSEMACRO ) ) ).Execute(); - } - } - } - else - { - // application basic - aLocation = String::CreateFromAscii("application"); - } - - // script URL - if ( !bError ) - { - aScriptURL = String::CreateFromAscii("vnd.sun.star.script:"); - aScriptURL += aName; - aScriptURL += String::CreateFromAscii("?language="); - aScriptURL += aLanguage; - aScriptURL += String::CreateFromAscii("&location="); - aScriptURL += aLocation; - } - - if ( !rxLimitToDocument.is() ) - { - MacroExecutionData* pExecData = new MacroExecutionData; - pExecData->aDocument = aDocument; - pExecData->xMethod = pMethod; // keep alive until the event has been processed - Application::PostUserEvent( STATIC_LINK( NULL, MacroExecution, ExecuteMacroEvent ), pExecData ); - } - } - break; - } - - return aScriptURL; -} - -//---------------------------------------------------------------------------- - -Sequence< ::rtl::OUString > GetMethodNames( const ScriptDocument& rDocument, const String& rLibName, const String& rModName ) - throw(NoSuchElementException ) -{ - Sequence< ::rtl::OUString > aSeqMethods; - - // get module - ::rtl::OUString aOUSource; - if ( rDocument.getModule( rLibName, rModName, aOUSource ) ) - { - SbModuleRef xModule = new SbModule( rModName ); - xModule->SetSource32( aOUSource ); - sal_uInt16 nCount = xModule->GetMethods()->Count(); - sal_uInt16 nRealCount = nCount; - for ( sal_uInt16 i = 0; i < nCount; i++ ) - { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); - if( pMethod->IsHidden() ) - --nRealCount; - } - aSeqMethods.realloc( nRealCount ); - - sal_uInt16 iTarget = 0; - for ( sal_uInt16 i = 0 ; i < nCount; ++i ) - { - SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); - if( pMethod->IsHidden() ) - continue; - DBG_ASSERT( pMethod, "Method not found! (NULL)" ); - aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName(); - } - } - - return aSeqMethods; -} - -//---------------------------------------------------------------------------- - -sal_Bool HasMethod( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, const String& rMethName ) -{ - sal_Bool bHasMethod = sal_False; - - ::rtl::OUString aOUSource; - if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) ) - { - SbModuleRef xModule = new SbModule( rModName ); - xModule->SetSource32( aOUSource ); - SbxArray* pMethods = xModule->GetMethods(); - if ( pMethods ) - { - SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD ); - if ( pMethod && !pMethod->IsHidden() ) - bHasMethod = sal_True; - } - } - - return bHasMethod; -} -} //namespace BasicIDE -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx deleted file mode 100644 index 76f45d5a6..000000000 --- a/basctl/source/basicide/basobj3.cxx +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "dlged.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; - - -//---------------------------------------------------------------------------- - -extern "C" { - SAL_DLLPUBLIC_EXPORT long basicide_handle_basic_error( void* pPtr ) - { - return BasicIDE::HandleBasicError( (StarBASIC*)pPtr ); - } -} - -namespace BasicIDE -{ -//---------------------------------------------------------------------------- - -SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ) -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } - - if ( pModule->GetMethods()->Find( rMacroName, SbxCLASS_METHOD ) ) - return 0; - - String aMacroName( rMacroName ); - if ( aMacroName.Len() == 0 ) - { - if ( !pModule->GetMethods()->Count() ) - aMacroName = String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) ); - else - { - sal_Bool bValid = sal_False; - String aStdMacroText( RTL_CONSTASCII_USTRINGPARAM( "Macro" ) ); - sal_uInt16 nMacro = 1; - while ( !bValid ) - { - aMacroName = aStdMacroText; - aMacroName += String::CreateFromInt32( nMacro ); - // Pruefen, ob vorhanden... - bValid = pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ) ? sal_False : sal_True; - nMacro++; - } - } - } - - ::rtl::OUString aOUSource( pModule->GetSource32() ); - - // Nicht zu viele Leerzeilen erzeugen... - sal_Int32 nSourceLen = aOUSource.getLength(); - if ( nSourceLen > 2 ) - { - const sal_Unicode* pStr = aOUSource.getStr(); - if ( pStr[ nSourceLen - 1 ] != LINE_SEP ) - aOUSource += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\n" ) ); - else if ( pStr[ nSourceLen - 2 ] != LINE_SEP ) - aOUSource += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ) ); - else if ( pStr[ nSourceLen - 3 ] == LINE_SEP ) - aOUSource = aOUSource.copy( 0, nSourceLen-1 ); - } - - ::rtl::OUString aSubStr; - aSubStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Sub " ) ); - aSubStr += aMacroName; - aSubStr += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\nEnd Sub" ) ); - - aOUSource += aSubStr; - - // update module in library - ScriptDocument aDocument( ScriptDocument::NoDocument ); - SbxObject* pParent = pModule->GetParent(); - StarBASIC* pBasic = PTR_CAST(StarBASIC,pParent); - DBG_ASSERT(pBasic, "BasicIDE::CreateMacro: No Basic found!"); - if ( pBasic ) - { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - DBG_ASSERT(pBasMgr, "BasicIDE::CreateMacro: No BasicManager found!"); - if ( pBasMgr ) - { - aDocument = ScriptDocument::getDocumentForBasicManager( pBasMgr ); - OSL_ENSURE( aDocument.isValid(), "BasicIDE::CreateMacro: no document for the given BasicManager!" ); - if ( aDocument.isValid() ) - { - String aLibName = pBasic->GetName(); - String aModName = pModule->GetName(); - OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aOUSource ) ); - } - } - } - - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ); - - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_UPDATEALLMODULESOURCES ); - } - - if ( aDocument.isAlive() ) - BasicIDE::MarkDocumentModified( aDocument ); - - return pMethod; -} - -//---------------------------------------------------------------------------- - -bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const String& rLibName, const String& rOldName, const String& rNewName ) - throw(ElementExistException, NoSuchElementException) -{ - if ( !rDocument.hasDialog( rLibName, rOldName ) ) - { - OSL_FAIL( "BasicIDE::RenameDialog: old module name is invalid!" ); - return false; - } - - if ( rDocument.hasDialog( rLibName, rNewName ) ) - { - ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ); - aError.Execute(); - return false; - } - - // #i74440 - if ( rNewName.Len() == 0 ) - { - ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ); - aError.Execute(); - return false; - } - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - IDEBaseWindow* pWin = pIDEShell ? pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_DIALOG, sal_False ) : NULL; - Reference< XNameContainer > xExistingDialog; - if ( pWin ) - xExistingDialog = ((DialogWindow*)pWin)->GetEditor()->GetDialog(); - - if ( xExistingDialog.is() ) - LocalizationMgr::renameStringResourceIDs( rDocument, rLibName, rNewName, xExistingDialog ); - - if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) ) - return false; - - if ( pWin ) - { - // set new name in window - pWin->SetName( rNewName ); - - // update property browser - ((DialogWindow*)pWin)->UpdateBrowser(); - - // update tabwriter - sal_uInt16 nId = (sal_uInt16)(pIDEShell->GetIDEWindowTable()).GetKey( pWin ); - DBG_ASSERT( nId, "No entry in Tabbar!" ); - if ( nId ) - { - BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar(); - pTabBar->SetPageText( nId, rNewName ); - pTabBar->Sort(); - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); - } - } - return true; -} - -//---------------------------------------------------------------------------- - -bool RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ) -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - DialogWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, rLibName, rDlgName, sal_False ); - if( pDlgWin ) - { - Reference< container::XNameContainer > xDialogModel = pDlgWin->GetDialog(); - LocalizationMgr::removeResourceForDialog( rDocument, rLibName, rDlgName, xDialogModel ); - } - } - - return rDocument.removeDialog( rLibName, rDlgName ); -} - -//---------------------------------------------------------------------------- - -StarBASIC* FindBasic( const SbxVariable* pVar ) -{ - const SbxVariable* pSbx = pVar; - while ( pSbx && !pSbx->ISA( StarBASIC ) ) - pSbx = pSbx->GetParent(); - - DBG_ASSERT( !pSbx || pSbx->ISA( StarBASIC ), "Find Basic: Kein Basic!" ); - return (StarBASIC*)pSbx; -} - -//---------------------------------------------------------------------------- - -BasicManager* FindBasicManager( StarBASIC* pLib ) -{ - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) ); - for ( ScriptDocuments::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - BasicManager* pBasicMgr = doc->getBasicManager(); - OSL_ENSURE( pBasicMgr, "BasicIDE::FindBasicManager: no basic manager for the document!" ); - if ( !pBasicMgr ) - continue; - - Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - { - StarBASIC* pL = pBasicMgr->GetLib( pLibNames[ i ] ); - if ( pL == pLib ) - return pBasicMgr; - } - } - return NULL; -} - -//---------------------------------------------------------------------------- - -void MarkDocumentModified( const ScriptDocument& rDocument ) -{ - // Muss ja nicht aus einem Document kommen... - if ( rDocument.isApplication() ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - pIDEShell->SetAppBasicModified(); - } - else - { - rDocument.setDocumentModified(); - } - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_SIGNATURE ); - pBindings->Invalidate( SID_SAVEDOC ); - pBindings->Update( SID_SAVEDOC ); - } - - // Objectcatalog updaten... - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - ObjectCatalog* pObjCatalog = pIDEShell ? pIDEShell->GetObjectCatalog() : 0; - if ( pObjCatalog ) - pObjCatalog->UpdateEntries(); -} - -//---------------------------------------------------------------------------- - -void RunMethod( SbMethod* pMethod ) -{ - SbxValues aRes; - aRes.eType = SbxVOID; - pMethod->Get( aRes ); -} - -//---------------------------------------------------------------------------- - -void StopBasic() -{ - StarBASIC::Stop(); - BasicIDEShell* pShell = IDE_DLL()->GetShell(); - if ( pShell ) - { - IDEWindowTable& rWindows = pShell->GetIDEWindowTable(); - IDEBaseWindow* pWin = rWindows.First(); - while ( pWin ) - { - // BasicStopped von Hand rufen, da das Stop-Notify ggf. sonst nicht - // durchkommen kann. - pWin->BasicStopped(); - pWin = rWindows.Next(); - } - } - BasicIDE::BasicStopped(); -} - -//---------------------------------------------------------------------------- - -void BasicStopped( sal_Bool* pbAppWindowDisabled, - sal_Bool* pbDispatcherLocked, sal_uInt16* pnWaitCount, - SfxUInt16Item** ppSWActionCount, SfxUInt16Item** ppSWLockViewCount ) -{ - // Nach einem Error oder dem expliziten abbrechen des Basics muessen - // ggf. einige Locks entfernt werden... - - if ( pbAppWindowDisabled ) - *pbAppWindowDisabled = sal_False; - if ( pbDispatcherLocked ) - *pbDispatcherLocked = sal_False; - if ( pnWaitCount ) - *pnWaitCount = 0; - if ( ppSWActionCount ) - *ppSWActionCount = 0; - if ( ppSWLockViewCount ) - *ppSWLockViewCount = 0; - - // AppWait ? - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if( pIDEShell ) - { - sal_uInt16 nWait = 0; - while ( pIDEShell->GetViewFrame()->GetWindow().IsWait() ) - { - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); - nWait++; - } - if ( pnWaitCount ) - *pnWaitCount = nWait; - } - - Window* pDefParent = Application::GetDefDialogParent(); - if ( pDefParent && !pDefParent->IsEnabled() ) - { - pDefParent->Enable( sal_True ); - if ( pbAppWindowDisabled ) - *pbAppWindowDisabled = sal_True; - } - -} - -//---------------------------------------------------------------------------- - -void InvalidateDebuggerSlots() -{ - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICSTOP ); - pBindings->Update( SID_BASICSTOP ); - pBindings->Invalidate( SID_BASICRUN ); - pBindings->Update( SID_BASICRUN ); - pBindings->Invalidate( SID_BASICCOMPILE ); - pBindings->Update( SID_BASICCOMPILE ); - pBindings->Invalidate( SID_BASICSTEPOVER ); - pBindings->Update( SID_BASICSTEPOVER ); - pBindings->Invalidate( SID_BASICSTEPINTO ); - pBindings->Update( SID_BASICSTEPINTO ); - pBindings->Invalidate( SID_BASICSTEPOUT ); - pBindings->Update( SID_BASICSTEPOUT ); - pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT ); - pBindings->Invalidate( SID_BASICIDE_STAT_POS ); - pBindings->Update( SID_BASICIDE_STAT_POS ); - } -} - -//---------------------------------------------------------------------------- - -long HandleBasicError( StarBASIC* pBasic ) -{ - BasicIDEDLL::Init(); - BasicIDE::BasicStopped(); - - // no error output during macro choosing - if ( IDE_DLL()->GetExtraData()->ChoosingMacro() ) - return 1; - if ( IDE_DLL()->GetExtraData()->ShellInCriticalSection() ) - return 2; - - long nRet = 0; - BasicIDEShell* pIDEShell = 0; - if ( SvtModuleOptions().IsBasicIDE() ) - { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - if ( pBasMgr ) - { - sal_Bool bProtected = sal_False; - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - OSL_ENSURE( aDocument.isValid(), "BasicIDE::HandleBasicError: no document for the given BasicManager!" ); - if ( aDocument.isValid() ) - { - ::rtl::OUString aOULibName( pBasic->GetName() ); - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - bProtected = sal_True; - } - } - } - - if ( !bProtected ) - { - pIDEShell = IDE_DLL()->GetShell(); - if ( !pIDEShell ) - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - pIDEShell = IDE_DLL()->GetShell(); - } - } - } - } - - if ( pIDEShell ) - nRet = pIDEShell->CallBasicErrorHdl( pBasic ); - else - ErrorHandler::HandleError( StarBASIC::GetErrorCode() ); - - return nRet; -} - -//---------------------------------------------------------------------------- - -SfxBindings* GetBindingsPtr() -{ - SfxBindings* pBindings = NULL; - - SfxViewFrame* pFrame = NULL; - BasicIDEDLL* pIDEDLL = IDE_DLL(); - if ( pIDEDLL && pIDEDLL->GetShell() ) - { - pFrame = pIDEDLL->GetShell()->GetViewFrame(); - } - else - { - SfxViewFrame* pView = SfxViewFrame::GetFirst(); - while ( pView ) - { - SfxObjectShell* pObjShell = pView->GetObjectShell(); - if ( pObjShell && pObjShell->ISA( BasicDocShell ) ) - { - pFrame = pView; - break; - } - pView = SfxViewFrame::GetNext( *pView ); - } - } - if ( pFrame != NULL ) - pBindings = &pFrame->GetBindings(); - - return pBindings; -} - -} //namespace BasicIDE - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx deleted file mode 100644 index 7ecf56fff..000000000 --- a/basctl/source/basicide/bastype2.cxx +++ /dev/null @@ -1,880 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include "vcl/bitmap.hxx" - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; - -void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName ) -{ - try - { - uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); - if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) - { - script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); - uno::Any aObject( aModuleInfo.ModuleObject ); - uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY ); - if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Worksheet" )) ) ) - { - uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY ); - if( xNamed.is() ) - rObjName = xNamed->getName(); - } - } - } - catch( uno::Exception& ) - { - } -} - -sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName ) -{ - sal_Int32 nType = script::ModuleType::NORMAL; - uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); - if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) - { - script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); - nType = aModuleInfo.ModuleType; - } - return nType; -} - -BasicEntry::~BasicEntry() -{ -} - -BasicDocumentEntry::BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType ) - :BasicEntry( eType ) - ,m_aDocument( rDocument ) - ,m_eLocation( eLocation ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicDocumentEntry::BasicDocumentEntry: illegal document!" ); -} - -BasicDocumentEntry::~BasicDocumentEntry() -{ -} - -BasicLibEntry::BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, BasicEntryType eType ) - :BasicDocumentEntry( rDocument, eLocation, eType ) - ,m_aLibName( rLibName ) -{ -} - -BasicLibEntry::~BasicLibEntry() -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor() - :m_aDocument( ScriptDocument::getApplicationScriptDocument() ) - ,m_eLocation( LIBRARY_LOCATION_UNKNOWN ) - ,m_eType( OBJ_TYPE_UNKNOWN ) -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType ) - :m_aDocument( rDocument ) - ,m_eLocation( eLocation ) - ,m_aLibName( rLibName ) - ,m_aLibSubName( rLibSubName ) - ,m_aName( rName ) - ,m_eType( eType ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" ); -} - -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType ) - :m_aDocument( rDocument ) - ,m_eLocation( eLocation ) - ,m_aLibName( rLibName ) - ,m_aLibSubName( rLibSubName ) - ,m_aName( rName ) - ,m_aMethodName( rMethodName ) - ,m_eType( eType ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" ); -} - -BasicEntryDescriptor::~BasicEntryDescriptor() -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ) - :m_aDocument( rDesc.m_aDocument ) - ,m_eLocation( rDesc.m_eLocation ) - ,m_aLibName( rDesc.m_aLibName ) - ,m_aLibSubName( rDesc.m_aLibSubName ) - ,m_aName( rDesc.m_aName ) - ,m_aMethodName( rDesc.m_aMethodName ) - ,m_eType( rDesc.m_eType ) -{ -} - -BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescriptor& rDesc ) -{ - m_aDocument = rDesc.m_aDocument; - m_eLocation = rDesc.m_eLocation; - m_aLibName = rDesc.m_aLibName; - m_aLibSubName = rDesc.m_aLibSubName; - m_aName = rDesc.m_aName; - m_aMethodName = rDesc.m_aMethodName; - m_eType = rDesc.m_eType; - - return *this; -} - -bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const -{ - return m_aDocument == rDesc.m_aDocument && - m_eLocation == rDesc.m_eLocation && - m_aLibName == rDesc.m_aLibName && - m_aLibSubName == rDesc.m_aLibSubName && - m_aName == rDesc.m_aName && - m_aMethodName == rDesc.m_aMethodName && - m_eType == rDesc.m_eType; -} - -BasicTreeListBox::BasicTreeListBox( Window* pParent, const ResId& rRes ) : - SvTreeListBox( pParent, IDEResId( sal::static_int_cast( rRes.GetId() ) ) ), - m_aNotifier( *this ) -{ - SetNodeDefaultImages(); - SetSelectionMode( SINGLE_SELECTION ); - nMode = 0xFF; // Alles -} - - - -BasicTreeListBox::~BasicTreeListBox() -{ - m_aNotifier.dispose(); - - // UserDaten zerstoeren - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - delete (BasicEntry*)pEntry->GetUserData(); - pEntry = Next( pEntry ); - } -} - -void BasicTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - OSL_ENSURE( rDocument.isAlive(), "BasicTreeListBox::ScanEntry: illegal document!" ); - if ( !rDocument.isAlive() ) - return; - - // can be called multiple times for updating! - - // eigentlich prueffen, ob Basic bereits im Baum ?! - SetUpdateMode( sal_False ); - - // level 1: BasicManager (application, document, ...) - SvLBoxEntry* pDocumentRootEntry = FindRootEntry( rDocument, eLocation ); - if ( pDocumentRootEntry && IsExpanded( pDocumentRootEntry ) ) - ImpCreateLibEntries( pDocumentRootEntry, rDocument, eLocation ); - if ( !pDocumentRootEntry ) - { - String aRootName( GetRootEntryName( rDocument, eLocation ) ); - Image aImage; - GetRootEntryBitmaps( rDocument, aImage ); - pDocumentRootEntry = AddEntry( - aRootName, - aImage, - 0, true, - std::auto_ptr< BasicEntry >( new BasicDocumentEntry( rDocument, eLocation ) ) ); - } - - SetUpdateMode( sal_True ); -} - -void BasicTreeListBox::ImpCreateLibEntries( SvLBoxEntry* pDocumentRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - // get a sorted list of library names - Sequence< ::rtl::OUString > aLibNames( rDocument.getLibraryNames() ); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - { - String aLibName = pLibNames[ i ]; - - if ( eLocation == rDocument.getLibraryLocation( aLibName ) ) - { - // check, if the module library is loaded - sal_Bool bModLibLoaded = sal_False; - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) ) - bModLibLoaded = sal_True; - - // check, if the dialog library is loaded - sal_Bool bDlgLibLoaded = sal_False; - Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - bDlgLibLoaded = sal_True; - - sal_Bool bLoaded = bModLibLoaded || bDlgLibLoaded; - - // if only one of the libraries is loaded, load also the other - if ( bLoaded ) - { - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - xModLibContainer->loadLibrary( aOULibName ); - - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - xDlgLibContainer->loadLibrary( aOULibName ); - } - - // create tree list box entry - sal_uInt16 nId; - if ( ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ) ) - nId = bLoaded ? RID_IMG_DLGLIB : RID_IMG_DLGLIBNOTLOADED; - else - nId = bLoaded ? RID_IMG_MODLIB : RID_IMG_MODLIBNOTLOADED; - SvLBoxEntry* pLibRootEntry = FindEntry( pDocumentRootEntry, aLibName, OBJ_TYPE_LIBRARY ); - if ( pLibRootEntry ) - { - SetEntryBitmaps( pLibRootEntry, Image( IDEResId( nId ) ) ); - if ( IsExpanded( pLibRootEntry ) ) - ImpCreateLibSubEntries( pLibRootEntry, rDocument, aLibName ); - } - else - { - pLibRootEntry = AddEntry( - aLibName, - Image( IDEResId( nId ) ), - pDocumentRootEntry, true, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) ); - } - } - } -} - -void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ) -{ - ::rtl::OUString aOULibName( rLibName ); - - // modules - if ( nMode & BROWSEMODE_MODULES ) - { - Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) ); - - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - try - { - if( rDocument.isInVBAMode() ) - ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName ); - else - { - // get a sorted list of module names - Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) - { - String aModName = pModNames[ i ]; - SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE ); - if ( !pModuleEntry ) - pModuleEntry = AddEntry( - aModName, - Image( IDEResId( RID_IMG_MODULE ) ), - pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - - // methods - if ( nMode & BROWSEMODE_SUBS ) - { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) - { - String aName = pNames[ j ]; - SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); - if ( !pEntry ) - pEntry = AddEntry( - aName, - Image( IDEResId( RID_IMG_MACRO ) ), - pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); - } - } - } - } - } - catch ( const container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - // dialogs - if ( nMode & BROWSEMODE_DIALOGS ) - { - Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) ); - - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - { - try - { - // get a sorted list of dialog names - Sequence< ::rtl::OUString > aDlgNames( rDocument.getObjectNames( E_DIALOGS, rLibName ) ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) - { - String aDlgName = pDlgNames[ i ]; - SvLBoxEntry* pDialogEntry = FindEntry( pLibRootEntry, aDlgName, OBJ_TYPE_DIALOG ); - if ( !pDialogEntry ) - pDialogEntry = AddEntry( - aDlgName, - Image( IDEResId( RID_IMG_DIALOG ) ), - pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) ); - } - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } -} - -void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ) -{ - - ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries; - aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ); - aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) ); - aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) ); - aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) ); - - ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter; - for( iter = aEntries.begin(); iter != aEntries.end(); ++iter ) - { - BasicEntryType eType = iter->first; - ::rtl::OUString aEntryName = iter->second; - SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType ); - if( pLibSubRootEntry ) - { - SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ) ); - if ( IsExpanded( pLibSubRootEntry ) ) - ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName ); - } - else - { - pLibSubRootEntry = AddEntry( - aEntryName, - Image( IDEResId( RID_IMG_MODLIB ) ), - pLibRootEntry, true, - std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) ); - } - } -} - -void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName ) -{ - uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName ); - if( !xLib.is() ) - return; - - try - { - // get a sorted list of module names - Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); - - BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) ); - BasicEntryType eCurrentType( aDesc.GetType() ); - - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) - { - String aModName = pModNames[ i ]; - BasicEntryType eType = OBJ_TYPE_UNKNOWN; - switch( ModuleInfoHelper::getModuleType( xLib, aModName ) ) - { - case script::ModuleType::DOCUMENT: - eType = OBJ_TYPE_DOCUMENT_OBJECTS; - break; - case script::ModuleType::FORM: - eType = OBJ_TYPE_USERFORMS; - break; - case script::ModuleType::NORMAL: - eType = OBJ_TYPE_NORMAL_MODULES; - break; - case script::ModuleType::CLASS: - eType = OBJ_TYPE_CLASS_MODULES; - break; - } - if( eType != eCurrentType ) - continue; - - // display a nice friendly name in the ObjectModule tab, - // combining the objectname and module name, e.g. Sheet1 ( Financials ) - String aEntryName( aModName ); - if( eType == OBJ_TYPE_DOCUMENT_OBJECTS ) - { - String sObjName; - ModuleInfoHelper::getObjectName( xLib, aModName, sObjName ); - if( sObjName.Len() ) - { - aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); - } - } - SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE ); - if ( !pModuleEntry ) - pModuleEntry = AddEntry( - aEntryName, - Image( IDEResId( RID_IMG_MODULE ) ), - pLibSubRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - - // methods - if ( nMode & BROWSEMODE_SUBS ) - { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) - { - String aName = pNames[ j ]; - SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); - if ( !pEntry ) - pEntry = AddEntry( - aName, - Image( IDEResId( RID_IMG_MACRO ) ), - pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); - } - } - } - } - catch ( const container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText ) -{ - sal_uLong nRootPos = 0; - SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos ); - while ( pEntry ) - { - if ( GetEntryText( pEntry ) == rText ) - return pEntry; - - pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos ); - } - return 0; -} - -void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateEntries(); -} - -void BasicTreeListBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateEntries(); -} - -void BasicTreeListBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicTreeListBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicTreeListBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateEntries(); -} - -void BasicTreeListBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ ) -{ - UpdateEntries(); -} - -void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicTreeListBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) -{ - // not interested in -} - -void BasicTreeListBox::UpdateEntries() -{ - BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) ); - - // Erstmal die vorhandenen Eintraege auf existens pruefen: - SvLBoxEntry* pLastValid = 0; - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - if ( IsValidEntry( pEntry ) ) - pLastValid = pEntry; - else - { - delete (BasicEntry*)pEntry->GetUserData(); - GetModel()->Remove( pEntry ); - } - pEntry = pLastValid ? Next( pLastValid ) : First(); - } - - // Jetzt ueber die Basics rennen und in die Zweige eintragen - ScanAllEntries(); - - SetCurrentEntry( aCurDesc ); -} - -SvLBoxEntry* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource ) -{ - SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource ); - BasicEntry* pUser = (BasicEntry*)pSource->GetUserData(); - - DBG_ASSERT( pUser, "User-Daten?!" ); - DBG_ASSERT( pUser->GetType() != OBJ_TYPE_DOCUMENT, "BasicTreeListBox::CloneEntry: document?!" ); - - BasicEntry* pNewUser = new BasicEntry( *pUser ); - pNew->SetUserData( pNewUser ); - return pNew; -} - -SvLBoxEntry* BasicTreeListBox::FindEntry( SvLBoxEntry* pParent, const String& rText, BasicEntryType eType ) -{ - sal_uLong nRootPos = 0; - SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos ); - while ( pEntry ) - { - BasicEntry* pBasicEntry = (BasicEntry*)pEntry->GetUserData(); - DBG_ASSERT( pBasicEntry, "FindEntry: Kein BasicEntry ?!" ); - if ( ( pBasicEntry->GetType() == eType ) && ( GetEntryText( pEntry ) == rText ) ) - return pEntry; - - pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos ); - } - return 0; -} - -long BasicTreeListBox::ExpandingHdl() -{ - // Expanding oder Collaps? - sal_Bool bOK = sal_True; - if ( GetModel()->GetDepth( GetHdlEntry() ) == 1 ) - { - SvLBoxEntry* pCurEntry = GetCurEntry(); - BasicEntryDescriptor aDesc( GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::ExpandingHdl: no document, or document is dead!" ); - if ( aDocument.isAlive() ) - { - String aLibName( aDesc.GetLibName() ); - String aLibSubName( aDesc.GetLibSubName() ); - String aName( aDesc.GetName() ); - String aMethodName( aDesc.GetMethodName() ); - - if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() ) - { - // check password, if library is password protected and not verified - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - String aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); - } - } - } - } - } - return bOK; -} - -sal_Bool BasicTreeListBox::IsEntryProtected( SvLBoxEntry* pEntry ) -{ - sal_Bool bProtected = sal_False; - if ( pEntry && ( GetModel()->GetDepth( pEntry ) == 1 ) ) - { - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::IsEntryProtected: no document, or document is dead!" ); - if ( aDocument.isAlive() ) - { - ::rtl::OUString aOULibName( aDesc.GetLibName() ); - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - bProtected = sal_True; - } - } - } - } - return bProtected; -} - -SvLBoxEntry* BasicTreeListBox::AddEntry( - const String& rText, - const Image& rImage, - SvLBoxEntry* pParent, - bool bChildrenOnDemand, - std::auto_ptr< BasicEntry > aUserData -) -{ - SvLBoxEntry* p = InsertEntry( - rText, rImage, rImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release() ); // XXX possible leak - return p; -} - -void BasicTreeListBox::SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ) -{ - SetExpandedEntryBmp( pEntry, rImage ); - SetCollapsedEntryBmp( pEntry, rImage ); -} - -LibraryType BasicTreeListBox::GetLibraryType() const -{ - LibraryType eType = LIBRARY_TYPE_ALL; - if ( ( nMode & BROWSEMODE_MODULES ) && !( nMode & BROWSEMODE_DIALOGS ) ) - eType = LIBRARY_TYPE_MODULE; - else if ( !( nMode & BROWSEMODE_MODULES ) && ( nMode & BROWSEMODE_DIALOGS ) ) - eType = LIBRARY_TYPE_DIALOG; - return eType; -} - -String BasicTreeListBox::GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const -{ - return rDocument.getTitle( eLocation, GetLibraryType() ); -} - -void BasicTreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ) -{ - OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::GetRootEntryBitmaps: illegal document!" ); - if ( !rDocument.isValid() ) - return; - - if ( rDocument.isDocument() ) - { - ::rtl::OUString sFactoryURL; - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager; - if ( aContext.createComponent( "com.sun.star.frame.ModuleManager", xModuleManager ) ) - { - try - { - ::rtl::OUString sModule( xModuleManager->identify( rDocument.getDocument() ) ); - Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY ); - if ( xModuleConfig.is() ) - { - Sequence< beans::PropertyValue > aModuleDescr; - xModuleConfig->getByName( sModule ) >>= aModuleDescr; - sal_Int32 nCount = aModuleDescr.getLength(); - const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray(); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - if ( pModuleDescr[ i ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "ooSetupFactoryEmptyDocumentURL" ) ) ) - { - pModuleDescr[ i ].Value >>= sFactoryURL; - break; - } - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - if ( sFactoryURL.getLength() ) - { - rImage = SvFileInformationManager::GetFileImage( INetURLObject( sFactoryURL ), sal_False ); - } - else - { - // default icon - rImage = Image( IDEResId( RID_IMG_DOCUMENT ) ); - } - } - else - { - rImage = Image( IDEResId( RID_IMG_INSTALLATION ) ); - } -} - -void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) -{ - SvLBoxEntry* pCurEntry = 0; - BasicEntryDescriptor aDesc( rDesc ); - if ( aDesc.GetType() == OBJ_TYPE_UNKNOWN ) - { - aDesc = BasicEntryDescriptor( - ScriptDocument::getApplicationScriptDocument(), - LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ), - String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN ); - } - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" ); - LibraryLocation eLocation( aDesc.GetLocation() ); - SvLBoxEntry* pRootEntry = FindRootEntry( aDocument, eLocation ); - if ( pRootEntry ) - { - pCurEntry = pRootEntry; - String aLibName( aDesc.GetLibName() ); - if ( aLibName.Len() ) - { - Expand( pRootEntry ); - SvLBoxEntry* pLibEntry = FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY ); - if ( pLibEntry ) - { - pCurEntry = pLibEntry; - String aLibSubName( aDesc.GetLibSubName() ); - if( aLibSubName.Len() ) - { - Expand( pLibEntry ); - SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName ); - if( pLibSubEntry ) - { - pCurEntry = pLibSubEntry; - } - } - String aName( aDesc.GetName() ); - if ( aName.Len() ) - { - Expand( pCurEntry ); - BasicEntryType eType = OBJ_TYPE_MODULE; - if ( aDesc.GetType() == OBJ_TYPE_DIALOG ) - eType = OBJ_TYPE_DIALOG; - SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType ); - if ( pEntry ) - { - pCurEntry = pEntry; - String aMethodName( aDesc.GetMethodName() ); - if ( aMethodName.Len() ) - { - Expand( pEntry ); - SvLBoxEntry* pSubEntry = FindEntry( pEntry, aMethodName, OBJ_TYPE_METHOD ); - if ( pSubEntry ) - { - pCurEntry = pSubEntry; - } - else - { - pSubEntry = FirstChild( pEntry ); - if ( pSubEntry ) - pCurEntry = pSubEntry; - } - } - } - else - { - pEntry = FirstChild( pLibEntry ); - if ( pEntry ) - pCurEntry = pEntry; - } - } - } - else - { - pLibEntry = FirstChild( pRootEntry ); - if ( pLibEntry ) - pCurEntry = pLibEntry; - } - } - } - else - { - pRootEntry = First(); - if ( pRootEntry ) - pCurEntry = pRootEntry; - } - - SetCurEntry( pCurEntry ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx deleted file mode 100644 index 04b566f34..000000000 --- a/basctl/source/basicide/bastype2.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASTYPE2_HXX -#define _BASTYPE2_HXX - -#include "doceventnotifier.hxx" - -#include -#include "tools/solar.h" - -#define _SVICNVW_HXX -#include -#include -#include -#include -#include "basobj.hxx" - -enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES }; - -#define BROWSEMODE_MODULES 0x01 -#define BROWSEMODE_SUBS 0x02 -#define BROWSEMODE_DIALOGS 0x04 - -class SbMethod; -class SbxObject; -class SbModule; -class SvLBoxEntry; -class SbxVariable; -class String; - - -class BasicEntry -{ -private: - BasicEntryType m_eType; - -public: - BasicEntry( BasicEntryType eType ) { m_eType = eType; } - BasicEntry( const BasicEntry& r ) { m_eType = r.m_eType; } - virtual ~BasicEntry(); - - BasicEntryType GetType() const { return m_eType; } -}; - -class BasicDocumentEntry : public BasicEntry -{ -private: - ScriptDocument m_aDocument; - LibraryLocation m_eLocation; - -public: - BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType = OBJ_TYPE_DOCUMENT ); - virtual ~BasicDocumentEntry(); - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - LibraryLocation GetLocation() const { return m_eLocation; } -}; - -class BasicLibEntry : public BasicDocumentEntry -{ -private: - String m_aLibName; - -public: - BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, BasicEntryType eType = OBJ_TYPE_LIBRARY ); - virtual ~BasicLibEntry(); - - const String& GetLibName() const { return m_aLibName; } -}; - -class BasicEntryDescriptor -{ - ScriptDocument m_aDocument; - LibraryLocation m_eLocation; - String m_aLibName; - String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules - String m_aName; - String m_aMethodName; - BasicEntryType m_eType; - -public: - BasicEntryDescriptor(); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType ); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType ); - virtual ~BasicEntryDescriptor(); - - BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ); - BasicEntryDescriptor& operator=( const BasicEntryDescriptor& rDesc ); - bool operator==( const BasicEntryDescriptor& rDesc ) const; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - - LibraryLocation GetLocation() const { return m_eLocation; } - void SetLocation( LibraryLocation eLocation ) { m_eLocation = eLocation; } - - const String& GetLibName() const { return m_aLibName; } - void SetLibName( const String& aLibName ) { m_aLibName = aLibName; } - - const String& GetLibSubName() const { return m_aLibSubName; } - void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; } - - const String& GetName() const { return m_aName; } - void SetName( const String& aName ) { m_aName = aName; } - - const String& GetMethodName() const { return m_aMethodName; } - void SetMethodName( const String& aMethodName ) { m_aMethodName = aMethodName; } - - BasicEntryType GetType() const { return m_eType; } - void SetType( BasicEntryType eType ) { m_eType = eType; } -}; - - -/**************************************** - Zuordnung von Typen und Pointern in BasicEntrys: - - OBJ_TYPE_DOCUMENT BasicDocumentEntry - OBJ_TYPE_LIBRARY BasicEntry - OBJ_TYPE_MODULE BasicEntry - OBJ_TYPE_DIALOG BasicEntry - OBJ_TYPE_METHOD BasicEntry - -******************************************/ - -class BasicTreeListBox :public SvTreeListBox - ,public ::basctl::DocumentEventListener -{ -private: - sal_uInt16 nMode; - ::basctl::DocumentEventNotifier m_aNotifier; - - void SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ); - -protected: - virtual void RequestingChilds( SvLBoxEntry* pParent ); - virtual void ExpandedHdl(); - virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource ); - virtual long ExpandingHdl(); - - void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation ); - void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ); - void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName ); - void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName ); - SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText ); - - // DocumentEventListener - virtual void onDocumentCreated( const ScriptDocument& _rDocument ); - virtual void onDocumentOpened( const ScriptDocument& _rDocument ); - virtual void onDocumentSave( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ); - virtual void onDocumentClosed( const ScriptDocument& _rDocument ); - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ); - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); - -public: - BasicTreeListBox( Window* pParent, const ResId& rRes ); - ~BasicTreeListBox(); - - void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); - void ScanAllEntries(); - void UpdateEntries(); - - sal_Bool IsEntryProtected( SvLBoxEntry* pEntry ); - - void SetMode( sal_uInt16 nM ) { nMode = nM; } - sal_uInt16 GetMode() const { return nMode; } - - SbModule* FindModule( SvLBoxEntry* pEntry ); - SbxVariable* FindVariable( SvLBoxEntry* pEntry ); - SvLBoxEntry* FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); - SvLBoxEntry* FindEntry( SvLBoxEntry* pParent, const String& rText, BasicEntryType eType ); - - BasicEntryDescriptor GetEntryDescriptor( SvLBoxEntry* pEntry ); - - sal_uInt16 ConvertType( BasicEntryType eType ); - bool IsValidEntry( SvLBoxEntry* pEntry ); - - SvLBoxEntry* AddEntry( const String& rText, const Image& rImage, - SvLBoxEntry* pParent, bool bChildrenOnDemand, - std::auto_ptr< BasicEntry > aUserData ); - - String GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const; - void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ); - - void SetCurrentEntry( BasicEntryDescriptor& rDesc ); - -private: - LibraryType GetLibraryType() const; -}; - -#endif // _BASTYPE2_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx deleted file mode 100644 index 8567753fe..000000000 --- a/basctl/source/basicide/bastype3.cxx +++ /dev/null @@ -1,507 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include - -#define _SI_NOSBXCONTROLS - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; - - -typedef std::deque< SvLBoxEntry* > EntryArray; - - -void BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry ) -{ - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::RequestingChilds: invalid document!" ); - if ( !aDocument.isAlive() ) - return; - - LibraryLocation eLocation( aDesc.GetLocation() ); - BasicEntryType eType( aDesc.GetType() ); - - if ( eType == OBJ_TYPE_DOCUMENT ) - { - ImpCreateLibEntries( pEntry, aDocument, eLocation ); - } - else if ( eType == OBJ_TYPE_LIBRARY ) - { - String aLibName( aDesc.GetLibName() ); - ::rtl::OUString aOULibName( aLibName ); - - // check password - sal_Bool bOK = sal_True; - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - String aPassword; - bOK = QueryPassword( xModLibContainer, aLibName, aPassword ); - } - } - - if ( bOK ) - { - // load module library - sal_Bool bModLibLoaded = sal_False; - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - if ( !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - EnterWait(); - xModLibContainer->loadLibrary( aOULibName ); - LeaveWait(); - } - bModLibLoaded = xModLibContainer->isLibraryLoaded( aOULibName ); - } - - // load dialog library - sal_Bool bDlgLibLoaded = sal_False; - Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) - { - if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - { - EnterWait(); - xDlgLibContainer->loadLibrary( aOULibName ); - LeaveWait(); - } - bDlgLibLoaded = xDlgLibContainer->isLibraryLoaded( aOULibName ); - } - - if ( bModLibLoaded || bDlgLibLoaded ) - { - // create the sub entries - ImpCreateLibSubEntries( pEntry, aDocument, aLibName ); - - // exchange image - bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ); - Image aImage( IDEResId( bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB ) ); - SetEntryBitmaps( pEntry, aImage ); - } - else - { - OSL_FAIL( "BasicTreeListBox::RequestingChilds: Error loading library!" ); - } - } - } - else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS - || eType == OBJ_TYPE_USERFORMS - || eType == OBJ_TYPE_NORMAL_MODULES - || eType == OBJ_TYPE_CLASS_MODULES ) - { - String aLibName( aDesc.GetLibName() ); - ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName ); - } - else { - OSL_FAIL( "BasicTreeListBox::RequestingChilds: Unknown Type!" ); - } -} - -void BasicTreeListBox::ExpandedHdl() -{ - SvLBoxEntry* pEntry = GetHdlEntry(); - DBG_ASSERT( pEntry, "Was wurde zugeklappt?" ); - // Die OnDemand erzeugten Childs loeschen, - // SubChilds werden automatisch geloescht. - if ( !IsExpanded( pEntry ) && pEntry->HasChildsOnDemand() ) - { - SvLBoxEntry* pChild = FirstChild( pEntry ); - while ( pChild ) - { - GetModel()->Remove( pChild ); // Ruft auch den DTOR - pChild = FirstChild( pEntry ); - } - } -} - -void BasicTreeListBox::ScanAllEntries() -{ - ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); - ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); - - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) ); - for ( ScriptDocuments::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - if ( doc->isAlive() ) - ScanEntry( *doc, LIBRARY_LOCATION_DOCUMENT ); - } -} - -SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) -{ - if ( !pEntry ) - return 0; - - String aLib, aModOrObj, aSubOrPropOrSObj, aPropOrSubInSObj; - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - EntryArray aEntries; - - while ( pEntry ) - { - sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); - switch ( nDepth ) - { - case 4: - case 3: - case 2: - case 1: - { - aEntries.push_front( pEntry ); - } - break; - case 0: - { - aDocument = ((BasicDocumentEntry*)pEntry->GetUserData())->GetDocument(); - } - break; - } - pEntry = GetParent( pEntry ); - } - - SbxVariable* pVar = 0; - bool bDocumentObjects = false; - if ( !aEntries.empty() ) - { - for ( size_t n = 0; n < aEntries.size(); n++ ) - { - SvLBoxEntry* pLE = aEntries[n]; - DBG_ASSERT( pLE, "Can not find entry in array" ); - BasicEntry* pBE = (BasicEntry*)pLE->GetUserData(); - DBG_ASSERT( pBE, "The data in the entry not found!" ); - String aName( GetEntryText( pLE ) ); - - switch ( pBE->GetType() ) - { - case OBJ_TYPE_LIBRARY: - { - BasicManager* pBasMgr = aDocument.getBasicManager(); - if ( pBasMgr ) - pVar = pBasMgr->GetLib( aName ); - } - break; - case OBJ_TYPE_MODULE: - { - DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" ); - // extract the module name from the string like "Sheet1 (Example1)" - if( bDocumentObjects ) - { - sal_uInt16 nIndex = 0; - aName = aName.GetToken( 0, ' ', nIndex ); - } - pVar = ((StarBASIC*)pVar)->FindModule( aName ); - } - break; - case OBJ_TYPE_METHOD: - { - DBG_ASSERT( pVar && ( (pVar->IsA( TYPE(SbModule) )) || (pVar->IsA( TYPE(SbxObject) )) ), "FindVariable: Ungueltiges Modul/Objekt" ); - pVar = ((SbxObject*)pVar)->GetMethods()->Find( aName, SbxCLASS_METHOD ); - } - break; - case OBJ_TYPE_DIALOG: - { - // sbx dialogs removed - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - bDocumentObjects = true; - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - // skip, to find the child entry. - continue; - } - default: - { - OSL_FAIL( "FindVariable: Unbekannter Typ!" ); - pVar = 0; - } - break; - } - if ( !pVar ) - break; - } - } - - return pVar; -} - -BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) -{ - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN; - String aLibName; - String aLibSubName; - String aName; - String aMethodName; - BasicEntryType eType = OBJ_TYPE_UNKNOWN; - - if ( !pEntry ) - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); - - EntryArray aEntries; - - while ( pEntry ) - { - sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); - switch ( nDepth ) - { - case 4: - case 3: - case 2: - case 1: - { - aEntries.push_front( pEntry ); - } - break; - case 0: - { - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pEntry->GetUserData(); - if ( pBasicDocumentEntry ) - { - aDocument = pBasicDocumentEntry->GetDocument(); - eLocation = pBasicDocumentEntry->GetLocation(); - eType = OBJ_TYPE_DOCUMENT; - } - } - break; - } - pEntry = GetParent( pEntry ); - } - - if ( !aEntries.empty() ) - { - for ( size_t n = 0; n < aEntries.size(); n++ ) - { - SvLBoxEntry* pLE = aEntries[n]; - DBG_ASSERT( pLE, "Entrie im Array nicht gefunden" ); - BasicEntry* pBE = (BasicEntry*)pLE->GetUserData(); - DBG_ASSERT( pBE, "Keine Daten im Eintrag gefunden!" ); - - switch ( pBE->GetType() ) - { - case OBJ_TYPE_LIBRARY: - { - aLibName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_MODULE: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_METHOD: - { - aMethodName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DIALOG: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - aLibSubName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - default: - { - OSL_FAIL( "GetEntryDescriptor: Unbekannter Typ!" ); - eType = OBJ_TYPE_UNKNOWN; - } - break; - } - - if ( eType == OBJ_TYPE_UNKNOWN ) - break; - } - } - - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); -} - -sal_uInt16 BasicTreeListBox::ConvertType( BasicEntryType eType ) -{ - sal_uInt16 nType = OBJ_TYPE_UNKNOWN; - - switch ( eType ) - { - case OBJ_TYPE_DOCUMENT: - { - nType = BASICIDE_TYPE_SHELL; - } - break; - case OBJ_TYPE_LIBRARY: - { - nType = BASICIDE_TYPE_LIBRARY; - } - break; - case OBJ_TYPE_MODULE: - { - nType = BASICIDE_TYPE_MODULE; - } - break; - case OBJ_TYPE_DIALOG: - { - nType = BASICIDE_TYPE_DIALOG; - } - break; - case OBJ_TYPE_METHOD: - { - nType = BASICIDE_TYPE_METHOD; - } - break; - default: ; - } - - return nType; -} - -bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) -{ - bool bIsValid = false; - - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - LibraryLocation eLocation( aDesc.GetLocation() ); - String aLibName( aDesc.GetLibName() ); - String aName( aDesc.GetName() ); - String aMethodName( aDesc.GetMethodName() ); - BasicEntryType eType( aDesc.GetType() ); - - switch ( eType ) - { - case OBJ_TYPE_DOCUMENT: - { - bIsValid = aDocument.isAlive() - && ( aDocument.isApplication() - || GetRootEntryName( aDocument, eLocation ) == GetEntryText( pEntry ) - ); - } - break; - case OBJ_TYPE_LIBRARY: - { - bIsValid = aDocument.hasLibrary( E_SCRIPTS, aLibName ) || aDocument.hasLibrary( E_DIALOGS, aLibName ); - } - break; - case OBJ_TYPE_MODULE: - { - bIsValid = aDocument.hasModule( aLibName, aName ); - } - break; - case OBJ_TYPE_DIALOG: - { - bIsValid = aDocument.hasDialog( aLibName, aName ); - } - break; - case OBJ_TYPE_METHOD: - { - bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName ); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - bIsValid = true; - } - break; - default: ; - } - - return bIsValid; -} - -SbModule* BasicTreeListBox::FindModule( SvLBoxEntry* pEntry ) -{ - SbxVariable* pVar = FindVariable( pEntry ); - if ( pVar && pVar->IsA( TYPE(SbModule ) ) ) - return (SbModule*)pVar; - return 0; -} - -SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::FindRootEntry: invalid document!" ); - sal_uLong nRootPos = 0; - SvLBoxEntry* pRootEntry = GetEntry( nRootPos ); - while ( pRootEntry ) - { - DBG_ASSERT( (((BasicEntry*)pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT ), "Kein Shelleintrag?" ); - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pRootEntry->GetUserData(); - if ( pBasicDocumentEntry && ( pBasicDocumentEntry->GetDocument() == rDocument ) && pBasicDocumentEntry->GetLocation() == eLocation ) - return pRootEntry; - pRootEntry = GetEntry( ++nRootPos ); - } - return 0; -} - -String CreateMgrAndLibStr( const String& rMgrName, const String& rLibName ) -{ - String aName( '[' ); - aName += rMgrName; - aName += String( RTL_CONSTASCII_USTRINGPARAM( "]." ) ); - aName += rLibName; - return aName; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype3.hxx b/basctl/source/basicide/bastype3.hxx deleted file mode 100644 index 016c4ee48..000000000 --- a/basctl/source/basicide/bastype3.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASTYPE3_HXX -#define _BASTYPE3_HXX - -#include - -#include - -#include - -class EditorWindow; - -#ifndef NO_SPECIALEDIT - -class ExtendedEdit : public Edit -{ -private: - Accelerator aAcc; - Link aAccHdl; - Link aGotFocusHdl; - Link aLoseFocusHdl; - -protected: - DECL_LINK( EditAccHdl, Accelerator * ); - DECL_LINK( ImplGetFocusHdl, Control* ); - DECL_LINK( ImplLoseFocusHdl, Control* ); - -public: - ExtendedEdit( Window* pParent, IDEResId nRes ); - - void SetAccHdl( const Link& rLink ) { aAccHdl = rLink; } - void SetLoseFocusHdl( const Link& rLink ) { aLoseFocusHdl = rLink; } - void SetGotFocusHdl( const Link& rLink ) { aGotFocusHdl = rLink; } - Accelerator& GetAccelerator() { return aAcc; } -}; - -#endif //NO_SPECIALEDIT - -#endif // _BASTYPE3_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype4.hxx b/basctl/source/basicide/bastype4.hxx deleted file mode 100644 index be49835fb..000000000 --- a/basctl/source/basicide/bastype4.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASTYPE4_HXX -#define _BASTYPE4_HXX - - -#include - -class EditEngine; -class EditView; - -class ExtendedTabBar : public TabBar -{ - EditEngine* pEditEngine; - EditView* pEditView; - sal_Bool bIsInKeyInput; -#if _SOLAR__PRIVATE - void ImpCheckEditEngine( sal_Bool bKeepNewText ); -#endif -protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void LoseFocus(); - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Paint( const Rectangle& ); - - virtual sal_Bool StartRenamingTab( sal_uInt16 nCurId ); - virtual sal_Bool AllowRenamingTab( sal_uInt16 nCurId, const String& rNewName ); - virtual void TabRenamed( sal_uInt16 nCurId, const String& rNewName ); - -public: - ExtendedTabBar( Window* pParent, WinBits nStyle ); - ~ExtendedTabBar(); - - void RenameSelectedTab(); - sal_Bool IsInEditMode() const { return pEditEngine ? sal_True : sal_False; } - void StopEditMode( sal_Bool bKeepCurText = sal_False ); -}; - -#endif //_BASTYPE4_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx deleted file mode 100644 index b7562d058..000000000 --- a/basctl/source/basicide/bastypes.cxx +++ /dev/null @@ -1,1054 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include -#include - -#include - - -#include -#include -#include -#include -#include -#include // Leider brauche ich teilweise pModulWindow... -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star; - -using ::std::vector; - -DBG_NAME( IDEBaseWindow ) - -const char* pRegName = "BasicIDETabBar"; - -TYPEINIT0( IDEBaseWindow ) -TYPEINIT1( SbxItem, SfxPoolItem ); - -IDEBaseWindow::IDEBaseWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName ) - :Window( pParent, WinBits( WB_3DLOOK ) ) - ,m_aDocument( rDocument ) - ,m_aLibName( aLibName ) - ,m_aName( aName ) -{ - DBG_CTOR( IDEBaseWindow, 0 ); - pShellHScrollBar = 0; - pShellVScrollBar = 0; - nStatus = 0; -} - - - -IDEBaseWindow::~IDEBaseWindow() -{ - DBG_DTOR( IDEBaseWindow, 0 ); - if ( pShellVScrollBar ) - pShellVScrollBar->SetScrollHdl( Link() ); - if ( pShellHScrollBar ) - pShellHScrollBar->SetScrollHdl( Link() ); -} - - - -void IDEBaseWindow::Init() -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); - if ( pShellVScrollBar ) - pShellVScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) ); - if ( pShellHScrollBar ) - pShellHScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) ); - DoInit(); // virtuell... -} - - - -void IDEBaseWindow::DoInit() -{ -} - - - -void IDEBaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ) -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); - pShellHScrollBar = pHScroll; - pShellVScrollBar = pVScroll; -// Init(); // macht kein Sinn, fuehrt zu flackern, fuehr zu Fehlern... -} - - - -IMPL_LINK_INLINE_START( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); - DoScroll( pCurScrollBar ); - return 0; -} -IMPL_LINK_INLINE_END( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) - - - -void IDEBaseWindow::ExecuteCommand( SfxRequest& ) -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); -} - - - -void IDEBaseWindow::GetState( SfxItemSet& ) -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); -} - - -long IDEBaseWindow::Notify( NotifyEvent& rNEvt ) -{ - long nDone = 0; - - if ( rNEvt.GetType() == EVENT_KEYINPUT ) - { - KeyEvent aKEvt = *rNEvt.GetKeyEvent(); - KeyCode aCode = aKEvt.GetKeyCode(); - sal_uInt16 nCode = aCode.GetCode(); - - switch ( nCode ) - { - case KEY_PAGEUP: - case KEY_PAGEDOWN: - { - if ( aCode.IsMod1() ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - pIDEShell->NextPage( nCode == KEY_PAGEUP ); - - nDone = 1; - } - } - break; - } - } - - return nDone ? nDone : Window::Notify( rNEvt ); -} - - -void IDEBaseWindow::DoScroll( ScrollBar* ) -{ - DBG_CHKTHIS( IDEBaseWindow, 0 ); -} - - -void IDEBaseWindow::StoreData() -{ -} - -sal_Bool IDEBaseWindow::CanClose() -{ - return sal_True; -} - -sal_Bool IDEBaseWindow::AllowUndo() -{ - return sal_True; -} - - - -void IDEBaseWindow::UpdateData() -{ -} - - -String IDEBaseWindow::GetTitle() -{ - return String(); -} - - - -String IDEBaseWindow::CreateQualifiedName() -{ - String aName; - if ( m_aLibName.Len() ) - { - LibraryLocation eLocation = m_aDocument.getLibraryLocation( m_aLibName ); - aName = m_aDocument.getTitle( eLocation ); - aName += '.'; - aName += m_aLibName; - aName += '.'; - aName += GetTitle(); - } - - return aName; -} - -void IDEBaseWindow::SetReadOnly( sal_Bool ) -{ -} - -sal_Bool IDEBaseWindow::IsReadOnly() -{ - return sal_False; -} - -void IDEBaseWindow::BasicStarted() -{ -} - -void IDEBaseWindow::BasicStopped() -{ -} - -sal_Bool IDEBaseWindow::IsModified() -{ - return sal_True; -} - -sal_Bool IDEBaseWindow::IsPasteAllowed() -{ - return sal_False; -} - -Window* IDEBaseWindow::GetLayoutWindow() -{ - return this; -} - -::svl::IUndoManager* IDEBaseWindow::GetUndoManager() -{ - return NULL; -} - -BreakPointList::BreakPointList() -{} - -BreakPointList::BreakPointList(BreakPointList const & rList) -{ - for (size_t i = 0; i < rList.size(); ++i) - maBreakPoints.push_back( new BreakPoint(*rList.at( i ) ) ); -} - -BreakPointList::~BreakPointList() -{ - reset(); -} - -void BreakPointList::reset() -{ - for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i ) - delete maBreakPoints[ i ]; - maBreakPoints.clear(); -} - -void BreakPointList::transfer(BreakPointList & rList) -{ - reset(); - for (size_t i = 0; i < rList.size(); ++i) - maBreakPoints.push_back( rList.at( i ) ); - rList.reset(); -} - -void BreakPointList::InsertSorted( BreakPoint* pNewBrk ) -{ - for ( vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i ) - { - if ( pNewBrk->nLine <= (*i)->nLine ) - { - DBG_ASSERT( ( (*i)->nLine != pNewBrk->nLine ) || pNewBrk->bTemp, "BreakPoint existiert schon!" ); - maBreakPoints.insert( i, pNewBrk ); - return; - } - } - // Keine Einfuegeposition gefunden => LIST_APPEND - maBreakPoints.push_back( pNewBrk ); -} - -void BreakPointList::SetBreakPointsInBasic( SbModule* pModule ) -{ - pModule->ClearAllBP(); - - for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i ) - { - BreakPoint* pBrk = maBreakPoints[ i ]; - if ( pBrk->bEnabled ) - pModule->SetBP( (sal_uInt16)pBrk->nLine ); - } -} - -BreakPoint* BreakPointList::FindBreakPoint( size_t nLine ) -{ - for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i ) - { - BreakPoint* pBrk = maBreakPoints[ i ]; - if ( pBrk->nLine == nLine ) - return pBrk; - } - return NULL; -} - -void BreakPointList::AdjustBreakPoints( size_t nLine, bool bInserted ) -{ - for ( size_t i = 0; i < maBreakPoints.size(); ) - { - BreakPoint* pBrk = maBreakPoints[ i ]; - bool bDelBrk = false; - if ( pBrk->nLine == nLine ) - { - if ( bInserted ) - pBrk->nLine++; - else - bDelBrk = true; - } - else if ( pBrk->nLine > nLine ) - { - if ( bInserted ) - pBrk->nLine++; - else - pBrk->nLine--; - } - - if ( bDelBrk ) - { - delete remove( pBrk ); - } - else - { - ++i; - } - } -} - -void BreakPointList::ResetHitCount() -{ - for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i ) - { - BreakPoint* pBrk = maBreakPoints[ i ]; - pBrk->nHitCount = 0; - } -} - -size_t BreakPointList::size() const -{ - return maBreakPoints.size(); -} - -BreakPoint* BreakPointList::at( size_t i ) -{ - if ( i < maBreakPoints.size() ) - return maBreakPoints[ i ]; - else - return NULL; -} - -const BreakPoint* BreakPointList::at( size_t i ) const -{ - return maBreakPoints[ i ]; -} - -BreakPoint* BreakPointList::remove( BreakPoint* ptr ) -{ - for ( vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i ) - { - if ( ptr == *i ) - { - maBreakPoints.erase( i ); - return ptr; - } - } - return NULL; -} - -void BreakPointList::push_back( BreakPoint* item ) -{ - maBreakPoints.push_back( item ); -} - -void BreakPointList::clear() -{ - maBreakPoints.clear(); -} - - -void IDEBaseWindow::Deactivating() -{ -} - -sal_uInt16 IDEBaseWindow::GetSearchOptions() -{ - return 0; -} - - -BasicDockingWindow::BasicDockingWindow( Window* pParent ) : - DockingWindow( pParent, WB_BORDER | WB_3DLOOK | WB_DOCKABLE | WB_MOVEABLE | - WB_SIZEABLE | WB_ROLLABLE | - WB_DOCKABLE | WB_CLIPCHILDREN ) -{ -} - - - -sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) -{ - ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent(); - Rectangle aTmpRec( rRect ); - sal_Bool bDock = IsDockingPrevented() ? sal_False : pLayout->IsToBeDocked( this, rPos, aTmpRec ); - if ( bDock ) - { - rRect.SetSize( aTmpRec.GetSize() ); - } - else // Alte Groesse einstellen - { - if ( !aFloatingPosAndSize.IsEmpty() ) - rRect.SetSize( aFloatingPosAndSize.GetSize() ); - } - return !bDock; // bFloat -} - - - -void BasicDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) -{ - if ( bFloatMode ) - DockingWindow::EndDocking( rRect, bFloatMode ); - else - { - SetFloatingMode( sal_False ); - ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent(); - pLayout->DockaWindow( this ); - } -} - - - -void BasicDockingWindow::ToggleFloatingMode() -{ - ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent(); - if ( IsFloatingMode() ) - { - if ( !aFloatingPosAndSize.IsEmpty() ) - SetPosSizePixel( GetParent()->ScreenToOutputPixel( aFloatingPosAndSize.TopLeft() ), - aFloatingPosAndSize.GetSize() ); - } - pLayout->DockaWindow( this ); -} - - - -sal_Bool BasicDockingWindow::PrepareToggleFloatingMode() -{ - if ( IsFloatingMode() ) - { - // Position und Groesse auf dem Desktop merken... - aFloatingPosAndSize.SetPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) ); - aFloatingPosAndSize.SetSize( GetSizePixel() ); - } - return sal_True; -} - - - -void BasicDockingWindow::StartDocking() -{ - // Position und Groesse auf dem Desktop merken... - if ( IsFloatingMode() ) - { - aFloatingPosAndSize.SetPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) ); - aFloatingPosAndSize.SetSize( GetSizePixel() ); - } -} - - - -ExtendedEdit::ExtendedEdit( Window* pParent, IDEResId nRes ) : - Edit( pParent, nRes ) -{ - aAcc.SetSelectHdl( LINK( this, ExtendedEdit, EditAccHdl ) ); - Control::SetGetFocusHdl( LINK( this, ExtendedEdit, ImplGetFocusHdl ) ); - Control::SetLoseFocusHdl( LINK( this, ExtendedEdit, ImplLoseFocusHdl ) ); -} - -IMPL_LINK( ExtendedEdit, ImplGetFocusHdl, Control*, EMPTYARG ) -{ - Application::InsertAccel( &aAcc ); - aLoseFocusHdl.Call( this ); - return 0; -} - - -IMPL_LINK( ExtendedEdit, ImplLoseFocusHdl, Control*, EMPTYARG ) -{ - Application::RemoveAccel( &aAcc ); - return 0; -} - - -IMPL_LINK_INLINE_START( ExtendedEdit, EditAccHdl, Accelerator *, pAcc ) -{ - aAccHdl.Call( pAcc ); - return 0; -} -IMPL_LINK_INLINE_END( ExtendedEdit, EditAccHdl, Accelerator *, pAcc ) - - - -struct TabBarDDInfo -{ - sal_uLong npTabBar; - sal_uInt16 nPage; - - TabBarDDInfo() { npTabBar = 0; nPage = 0; } - TabBarDDInfo( sal_uLong _npTabBar, sal_uInt16 _nPage ) { npTabBar = _npTabBar; nPage = _nPage; } -}; - - -BasicIDETabBar::BasicIDETabBar( Window* pParent ) : - TabBar( pParent, WinBits( WB_3DLOOK | WB_SCROLL | WB_BORDER | WB_SIZEABLE | WB_DRAG ) ) -{ - EnableEditMode( sal_True ); - - SetHelpId( HID_BASICIDE_TABBAR ); -} - -void BasicIDETabBar::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) && !IsInEditMode() ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_MODULEDLG ); - } - } - else - { - TabBar::MouseButtonDown( rMEvt ); - } -} - -void BasicIDETabBar::Command( const CommandEvent& rCEvt ) -{ - if ( ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) && !IsInEditMode() ) - { - Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) ); - if ( rCEvt.IsMouseEvent() ) // Richtige Tab selektieren - { - Point aP = PixelToLogic( aPos ); - MouseEvent aMouseEvent( aP, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT ); - TabBar::MouseButtonDown( aMouseEvent ); - } - - PopupMenu aPopup( IDEResId( RID_POPUP_TABBAR ) ); - if ( GetPageCount() == 0 ) - { - aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False ); - aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False ); - aPopup.EnableItem( SID_BASICIDE_HIDECURPAGE, sal_False ); - } - - if ( StarBASIC::IsRunning() ) - { - aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false); - aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, false); - aPopup.EnableItem(SID_BASICIDE_MODULEDLG, false); - } - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - ScriptDocument aDocument( pIDEShell->GetCurDocument() ); - ::rtl::OUString aOULibName( pIDEShell->GetCurLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) - { - aPopup.EnableItem( aPopup.GetItemId( 0 ), sal_False ); - aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False ); - aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False ); - aPopup.RemoveDisabledEntries(); - } - if ( aDocument.isInVBAMode() ) - { - // disable to delete or remove object modules in IDE - BasicManager* pBasMgr = aDocument.getBasicManager(); - if ( pBasMgr ) - { - StarBASIC* pBasic = pBasMgr->GetLib( aOULibName ); - if( pBasic ) - { - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() ); - if( pWin && pWin->ISA( ModulWindow ) ) - { - SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() ); - if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) ) - { - aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False ); - aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False ); - } - } - } - } - } - } - - - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - pDispatcher->Execute( aPopup.Execute( this, aPos ) ); - } -} - -long BasicIDETabBar::AllowRenaming() -{ - sal_Bool bValid = BasicIDE::IsValidSbxName( GetEditText() ); - - if ( !bValid ) - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - - return bValid ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO; -} - - -void BasicIDETabBar::EndRenaming() -{ - if ( !IsEditModeCanceled() ) - { - SfxUInt16Item aID( SID_BASICIDE_ARG_TABID, GetEditPageId() ); - SfxStringItem aNewName( SID_BASICIDE_ARG_MODULENAME, GetEditText() ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_NAMECHANGEDONTAB, - SFX_CALLMODE_SYNCHRON, &aID, &aNewName, 0L ); - } - } -} - - -void BasicIDETabBar::Sort() -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - TabBarSortHelper aTabBarSortHelper; - ::std::vector aModuleList; - ::std::vector aDialogList; - sal_uInt16 nPageCount = GetPageCount(); - sal_uInt16 i; - - // create module and dialog lists for sorting - for ( i = 0; i < nPageCount; i++) - { - sal_uInt16 nId = GetPageId( i ); - aTabBarSortHelper.nPageId = nId; - aTabBarSortHelper.aPageText = GetPageText( nId ); - IDEBaseWindow* pWin = aIDEWindowTable.Get( nId ); - - if ( pWin->IsA( TYPE( ModulWindow ) ) ) - { - aModuleList.push_back( aTabBarSortHelper ); - } - else if ( pWin->IsA( TYPE( DialogWindow ) ) ) - { - aDialogList.push_back( aTabBarSortHelper ); - } - } - - // sort module and dialog lists by page text - ::std::sort( aModuleList.begin() , aModuleList.end() ); - ::std::sort( aDialogList.begin() , aDialogList.end() ); - - - sal_uInt16 nModules = sal::static_int_cast( aModuleList.size() ); - sal_uInt16 nDialogs = sal::static_int_cast( aDialogList.size() ); - - // move module pages to new positions - for (i = 0; i < nModules; i++) - { - MovePage( aModuleList[i].nPageId , i ); - } - - // move dialog pages to new positions - for (i = 0; i < nDialogs; i++) - { - MovePage( aDialogList[i].nPageId , nModules + i ); - } - } -} - -void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, sal_Bool bEraseTrailingEmptyLines ) -{ - sal_Int32 nStartPos = 0; - sal_Int32 nLine = 0; - while ( nLine < nStartLine ) - { - nStartPos = searchEOL( rStr, nStartPos ); - if( nStartPos == -1 ) - break; - nStartPos++; // nicht das \n. - nLine++; - } - - DBG_ASSERTWARNING( nStartPos != -1, "CutLines: Startzeile nicht gefunden!" ); - - if ( nStartPos != -1 ) - { - sal_Int32 nEndPos = nStartPos; - - for ( sal_Int32 i = 0; i < nLines; i++ ) - nEndPos = searchEOL( rStr, nEndPos+1 ); - - if ( nEndPos == -1 ) // kann bei letzter Zeile passieren - nEndPos = rStr.getLength(); - else - nEndPos++; - - ::rtl::OUString aEndStr = rStr.copy( nEndPos ); - rStr = rStr.copy( 0, nStartPos ); - rStr += aEndStr; - } - if ( bEraseTrailingEmptyLines ) - { - sal_Int32 n = nStartPos; - sal_Int32 nLen = rStr.getLength(); - while ( ( n < nLen ) && ( rStr.getStr()[ n ] == LINE_SEP || - rStr.getStr()[ n ] == LINE_SEP_CR ) ) - { - n++; - } - - if ( n > nStartPos ) - { - ::rtl::OUString aEndStr = rStr.copy( n ); - rStr = rStr.copy( 0, nStartPos ); - rStr += aEndStr; - } - } -} - -sal_uLong CalcLineCount( SvStream& rStream ) -{ - sal_uLong nLFs = 0; - sal_uLong nCRs = 0; - char c; - - rStream.Seek( 0 ); - rStream >> c; - while ( !rStream.IsEof() ) - { - if ( c == '\n' ) - nLFs++; - else if ( c == '\r' ) - nCRs++; - rStream >> c; - } - - rStream.Seek( 0 ); - if ( nLFs > nCRs ) - return nLFs; - return nCRs; -} - -LibInfoKey::LibInfoKey( const ScriptDocument& rDocument, const String& rLibName ) - :m_aDocument( rDocument ) - ,m_aLibName( rLibName ) -{ -} - -LibInfoKey::~LibInfoKey() -{ -} - -LibInfoKey::LibInfoKey( const LibInfoKey& rKey ) - :m_aDocument( rKey.m_aDocument ) - ,m_aLibName( rKey.m_aLibName ) -{ -} - -LibInfoKey& LibInfoKey::operator=( const LibInfoKey& rKey ) -{ - m_aDocument = rKey.m_aDocument; - m_aLibName = rKey.m_aLibName; - return *this; -} - -bool LibInfoKey::operator==( const LibInfoKey& rKey ) const -{ - bool bRet = false; - if ( m_aDocument == rKey.m_aDocument && m_aLibName == rKey.m_aLibName ) - bRet = true; - return bRet; -} - -LibInfoItem::LibInfoItem( const ScriptDocument& rDocument, const String& rLibName, const String& rCurrentName, sal_uInt16 nCurrentType ) - :m_aDocument( rDocument ) - ,m_aLibName( rLibName ) - ,m_aCurrentName( rCurrentName ) - ,m_nCurrentType( nCurrentType ) -{ -} - -LibInfoItem::~LibInfoItem() -{ -} - -LibInfoItem::LibInfoItem( const LibInfoItem& rItem ) - :m_aDocument( rItem.m_aDocument ) - ,m_aLibName( rItem.m_aLibName ) - ,m_aCurrentName( rItem.m_aCurrentName ) - ,m_nCurrentType( rItem.m_nCurrentType ) -{ -} - -LibInfoItem& LibInfoItem::operator=( const LibInfoItem& rItem ) -{ - m_aDocument = rItem.m_aDocument; - m_aLibName = rItem.m_aLibName; - m_aCurrentName = rItem.m_aCurrentName; - m_nCurrentType = rItem.m_nCurrentType; - - return *this; -} - -LibInfos::LibInfos() -{ -} - -LibInfos::~LibInfos() -{ - LibInfoMap::iterator end = m_aLibInfoMap.end(); - for ( LibInfoMap::iterator it = m_aLibInfoMap.begin(); it != end; ++it ) - delete it->second; - m_aLibInfoMap.clear(); -} - -void LibInfos::InsertInfo( LibInfoItem* pItem ) -{ - LibInfoKey aKey( pItem->GetDocument(), pItem->GetLibName() ); - LibInfoMap::iterator it = m_aLibInfoMap.find( aKey ); - if ( it != m_aLibInfoMap.end() ) - { - LibInfoItem* pI = it->second; - m_aLibInfoMap.erase( it ); - delete pI; - } - m_aLibInfoMap.insert( LibInfoMap::value_type( aKey, pItem ) ); -} - -void LibInfos::RemoveInfoFor( const ScriptDocument& _rDocument ) -{ - for ( LibInfoMap::iterator it = m_aLibInfoMap.begin(); - it != m_aLibInfoMap.end(); - ) - { - if ( it->first.GetDocument() != _rDocument ) - { - ++it; - continue; - } - - LibInfoItem* pItem = it->second; - - LibInfoMap::iterator next_it = it; ++next_it; - m_aLibInfoMap.erase( it ); - it = next_it; - - delete pItem; - } -} - -LibInfoItem* LibInfos::GetInfo( const LibInfoKey& rKey ) -{ - LibInfoItem* pItem = 0; - LibInfoMap::iterator it = m_aLibInfoMap.find( rKey ); - if ( it != m_aLibInfoMap.end() ) - pItem = it->second; - return pItem; -} - -SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const String& aLibName, const String& aName, sal_uInt16 nType ) - :SfxPoolItem( nWhich_ ) - ,m_aDocument(rDocument) - ,m_aLibName(aLibName) - ,m_aName(aName) - ,m_nType(nType) -{ -} - -SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const String& aLibName, const String& aName, const String& aMethodName, sal_uInt16 nType ) - :SfxPoolItem( nWhich_ ) - ,m_aDocument(rDocument) - ,m_aLibName(aLibName) - ,m_aName(aName) - ,m_aMethodName(aMethodName) - ,m_nType(nType) -{ -} - -SbxItem::SbxItem(const SbxItem& rCopy) - :SfxPoolItem( rCopy ) - ,m_aDocument( rCopy.m_aDocument ) -{ - m_aLibName = rCopy.m_aLibName; - m_aName = rCopy.m_aName; - m_aMethodName = rCopy.m_aMethodName; - m_nType = rCopy.m_nType; -} - -int SbxItem::operator==( const SfxPoolItem& rCmp) const -{ - DBG_ASSERT( rCmp.ISA( SbxItem ), "==: Kein SbxItem!" ); - return ( SfxPoolItem::operator==( rCmp ) && ( m_aDocument == ((const SbxItem&)rCmp).m_aDocument ) - && ( m_aLibName == ((const SbxItem&)rCmp).m_aLibName ) - && ( m_aName == ((const SbxItem&)rCmp).m_aName ) - && ( m_aMethodName == ((const SbxItem&)rCmp).m_aMethodName ) - && ( m_nType == ((const SbxItem&)rCmp).m_nType ) ); -} - -SfxPoolItem *SbxItem::Clone( SfxItemPool* ) const -{ - return new SbxItem(*this); -} - -sal_Bool QueryDel( const String& rName, const ResId& rId, Window* pParent ) -{ - String aQuery( rId ); - String aName( rName ); - aName += '\''; - aName.Insert( '\'', 0 ); - aQuery.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aName ); - QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_YES, aQuery ); - if ( aQueryBox.Execute() == RET_YES ) - return sal_True; - return sal_False; -} - -sal_Bool QueryDelMacro( const String& rName, Window* pParent ) -{ - return QueryDel( rName, IDEResId( RID_STR_QUERYDELMACRO ), pParent ); -} - -sal_Bool QueryReplaceMacro( const String& rName, Window* pParent ) -{ - return QueryDel( rName, IDEResId( RID_STR_QUERYREPLACEMACRO ), pParent ); -} - -sal_Bool QueryDelDialog( const String& rName, Window* pParent ) -{ - return QueryDel( rName, IDEResId( RID_STR_QUERYDELDIALOG ), pParent ); -} - -sal_Bool QueryDelLib( const String& rName, sal_Bool bRef, Window* pParent ) -{ - return QueryDel( rName, IDEResId( bRef ? RID_STR_QUERYDELLIBREF : RID_STR_QUERYDELLIB ), pParent ); -} - -sal_Bool QueryDelModule( const String& rName, Window* pParent ) -{ - return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent ); -} - -sal_Bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, sal_Bool bRepeat, sal_Bool bNewTitle ) -{ - sal_Bool bOK = sal_False; - sal_uInt16 nRet = 0; - - do - { - // password dialog - SfxPasswordDialog* pDlg = new SfxPasswordDialog( Application::GetDefDialogParent() ); - pDlg->SetMinLen( 1 ); - - // set new title - if ( bNewTitle ) - { - String aTitle( IDEResId( RID_STR_ENTERPASSWORD ) ); - aTitle.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), rLibName ); - pDlg->SetText( aTitle ); - } - - // execute dialog - nRet = pDlg->Execute(); - - // verify password - if ( nRet == RET_OK ) - { - ::rtl::OUString aOULibName( rLibName ); - if ( xLibContainer.is() && xLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - rPassword = pDlg->GetPassword(); - ::rtl::OUString aOUPassword( rPassword ); - bOK = xPasswd->verifyLibraryPassword( aOULibName, aOUPassword ); - - if ( !bOK ) - { - ErrorBox aErrorBox( Application::GetDefDialogParent(), WB_OK, String( IDEResId( RID_STR_WRONGPASSWORD ) ) ); - aErrorBox.Execute(); - } - } - } - } - - delete pDlg; - } - while ( bRepeat && !bOK && nRet == RET_OK ); - - return bOK; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx deleted file mode 100644 index 7b25f3124..000000000 --- a/basctl/source/basicide/brkdlg.cxx +++ /dev/null @@ -1,274 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include - -#define _SVX_NOIDERESIDS -#include -#include -#include -#include -#include -#include -#include - -// FIXME Why does BreakPointDialog allow only sal_uInt16 for break-point line -// numbers, whereas BreakPoint supports sal_uLong? - -bool lcl_ParseText( String aText, size_t& rLineNr ) -{ - // aText should look like "# n" where - // n > 0 && n < std::numeric_limits< sal_uInt16 >::max(). - // All spaces are ignored, so there can even be spaces within the - // number n. (Maybe it would be better to ignore all whitespace instead - // of just spaces.) - aText.EraseAllChars(' '); - sal_Unicode cFirst = aText.GetChar(0); - if (cFirst != '#' && !(cFirst >= '0' && cFirst <= '9')) - return false; - if (cFirst == '#') - aText.Erase(0, 1); - // XXX Assumes that sal_uInt16 is contained within sal_Int32: - sal_Int32 n = aText.ToInt32(); - if ( n <= 0 ) - return false; - rLineNr = static_cast< size_t >(n); - return true; -} - -BreakPointDialog::BreakPointDialog( Window* pParent, BreakPointList& rBrkPntList ) : - ModalDialog( pParent, IDEResId( RID_BASICIDE_BREAKPOINTDLG ) ), - aComboBox( this, IDEResId( RID_CB_BRKPOINTS ) ), - aOKButton( this, IDEResId( RID_PB_OK ) ), - aCancelButton( this, IDEResId( RID_PB_CANCEL ) ), - aNewButton( this, IDEResId( RID_PB_NEW ) ), - aDelButton( this, IDEResId( RID_PB_DEL ) ), - aCheckBox( this, IDEResId( RID_CHKB_ACTIVE ) ), - aBrkText( this, IDEResId( RID_FT_BRKPOINTS ) ), - aPassText( this, IDEResId( RID_FT_PASS ) ), - aNumericField( this, IDEResId( RID_FLD_PASS ) ), - m_rOriginalBreakPointList(rBrkPntList), - m_aModifiedBreakPointList(rBrkPntList) -{ - FreeResource(); - - aComboBox.SetUpdateMode( sal_False ); - for ( size_t i = 0, n = m_aModifiedBreakPointList.size(); i < n; ++i ) - { - BreakPoint* pBrk = m_aModifiedBreakPointList.at( i ); - String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); - aEntryStr += String::CreateFromInt32( pBrk->nLine ); - aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND ); - } - aComboBox.SetUpdateMode( sal_True ); - - aOKButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) ); - aNewButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) ); - aDelButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) ); - - aCheckBox.SetClickHdl( LINK( this, BreakPointDialog, CheckBoxHdl ) ); - aComboBox.SetSelectHdl( LINK( this, BreakPointDialog, ComboBoxHighlightHdl ) ); - aComboBox.SetModifyHdl( LINK( this, BreakPointDialog, EditModifyHdl ) ); - aComboBox.GrabFocus(); - - aNumericField.SetMin( 0 ); - aNumericField.SetMax( 0x7FFFFFFF ); - aNumericField.SetSpinSize( 1 ); - aNumericField.SetStrictFormat( sal_True ); - aNumericField.SetModifyHdl( LINK( this, BreakPointDialog, EditModifyHdl ) ); - - aComboBox.SetText( aComboBox.GetEntry( 0 ) ); - UpdateFields( m_aModifiedBreakPointList.at( 0 ) ); - - CheckButtons(); -} - -void BreakPointDialog::SetCurrentBreakPoint( BreakPoint* pBrk ) -{ - String aStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); - aStr += String::CreateFromInt32( pBrk->nLine ); - aComboBox.SetText( aStr ); - UpdateFields( pBrk ); -} - -void BreakPointDialog::CheckButtons() -{ - // "New" button is enabled if the combo box edit contains a valid line - // number that is not already present in the combo box list; otherwise - // "OK" and "Delete" buttons are enabled: - size_t nLine; - if (lcl_ParseText(aComboBox.GetText(), nLine) - && m_aModifiedBreakPointList.FindBreakPoint(nLine) == 0) - { - aNewButton.Enable(); - aOKButton.Disable(); - aDelButton.Disable(); - } - else - { - aNewButton.Disable(); - aOKButton.Enable(); - aDelButton.Enable(); - } -} - -IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) -{ - BreakPoint* pBrk = GetSelectedBreakPoint(); - if ( pBrk ) - pBrk->bEnabled = pChkBx->IsChecked(); - - return 0; -} -IMPL_LINK_INLINE_END( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) - - - -IMPL_LINK( BreakPointDialog, ComboBoxHighlightHdl, ComboBox *, pBox ) -{ - aNewButton.Disable(); - aOKButton.Enable(); - aDelButton.Enable(); - - sal_uInt16 nEntry = pBox->GetEntryPos( pBox->GetText() ); - BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry ); - DBG_ASSERT( pBrk, "Kein passender Breakpoint zur Liste ?" ); - UpdateFields( pBrk ); - - return 0; -} - - - -IMPL_LINK( BreakPointDialog, EditModifyHdl, Edit *, pEdit ) -{ - if ( pEdit == &aComboBox ) - CheckButtons(); - else if ( pEdit == &aNumericField ) - { - BreakPoint* pBrk = GetSelectedBreakPoint(); - if ( pBrk ) - pBrk->nStopAfter = pEdit->GetText().ToInt32(); - } - return 0; -} - - - -IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) -{ - if ( pButton == &aOKButton ) - { - m_rOriginalBreakPointList.transfer(m_aModifiedBreakPointList); - EndDialog( 1 ); - } - else if ( pButton == &aNewButton ) - { - // Checkbox beruecksichtigen! - String aText( aComboBox.GetText() ); - size_t nLine; - bool bValid = lcl_ParseText( aText, nLine ); - if ( bValid ) - { - BreakPoint* pBrk = new BreakPoint( nLine ); - pBrk->bEnabled = aCheckBox.IsChecked(); - pBrk->nStopAfter = (size_t) aNumericField.GetValue(); - m_aModifiedBreakPointList.InsertSorted( pBrk ); - String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); - aEntryStr += String::CreateFromInt32( pBrk->nLine ); - aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED ); - } - } - else - { - aComboBox.SetText( aText ); - aComboBox.GrabFocus(); - Sound::Beep(); - } - CheckButtons(); - } - else if ( pButton == &aDelButton ) - { - size_t nEntry = aComboBox.GetEntryPos( aComboBox.GetText() ); - BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry ); - if ( pBrk ) - { - delete m_aModifiedBreakPointList.remove( pBrk ); - aComboBox.RemoveEntry( nEntry ); - if ( nEntry && !( nEntry < aComboBox.GetEntryCount() ) ) - nEntry--; - aComboBox.SetText( aComboBox.GetEntry( nEntry ) ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED ); - } - } - CheckButtons(); - } - - return 0; -} - - - -void BreakPointDialog::UpdateFields( BreakPoint* pBrk ) -{ - if ( pBrk ) - { - aCheckBox.Check( pBrk->bEnabled ); - aNumericField.SetValue( pBrk->nStopAfter ); - } -} - - - -BreakPoint* BreakPointDialog::GetSelectedBreakPoint() -{ - size_t nEntry = aComboBox.GetEntryPos( aComboBox.GetText() ); - BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry ); - return pBrk; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/brkdlg.hrc b/basctl/source/basicide/brkdlg.hrc deleted file mode 100644 index 1f313374f..000000000 --- a/basctl/source/basicide/brkdlg.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRKDLG_HRC -#define _BRKDLG_HRC - -#include - -#define RID_BASICIDE_BREAKPOINTDLG ( RID_BASICIDE_START + 80 ) - -#define RID_CB_BRKPOINTS 2 -#define RID_PB_OK 3 -#define RID_PB_CANCEL 4 -#define RID_PB_NEW 5 -#define RID_PB_DEL 6 -#define RID_CHKB_ACTIVE 7 -#define RID_FT_PASS 8 -#define RID_FT_BRKPOINTS 9 -#define RID_FLD_PASS 10 - -#endif // _BRKDLG_HRC - diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx deleted file mode 100644 index 5513b416f..000000000 --- a/basctl/source/basicide/brkdlg.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BRKDLG_HXX -#define _BRKDLG_HXX - -#include -#include -#include - -#include -#include -#include - -class BreakPointDialog : public ModalDialog -{ -private: - ComboBox aComboBox; - OKButton aOKButton; - CancelButton aCancelButton; - PushButton aNewButton; - PushButton aDelButton; -// PushButton aShowButton; - CheckBox aCheckBox; - FixedText aBrkText; - FixedText aPassText; - NumericField aNumericField; - - BreakPointList & m_rOriginalBreakPointList; - BreakPointList m_aModifiedBreakPointList; - -protected: - void CheckButtons(); - DECL_LINK( CheckBoxHdl, CheckBox * ); - DECL_LINK( ComboBoxHighlightHdl, ComboBox * ); - DECL_LINK( EditModifyHdl, Edit * ); - DECL_LINK( ButtonHdl, Button * ); - void UpdateFields( BreakPoint* pBrk ); - BreakPoint* GetSelectedBreakPoint(); - - -public: - BreakPointDialog( Window* pParent, BreakPointList& rBrkList ); - - void SetCurrentBreakPoint( BreakPoint* pBrk ); -}; - -#endif // _BRKDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/brkdlg.src b/basctl/source/basicide/brkdlg.src deleted file mode 100644 index 3f08bb23f..000000000 --- a/basctl/source/basicide/brkdlg.src +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "helpid.hrc" -#include -ModalDialog RID_BASICIDE_BREAKPOINTDLG -{ - HelpId = "basctl:RID_BASICIDE_BREAKPOINTDLG" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 116 ) ; - Moveable = TRUE ; - // Closeable = TRUE; - ComboBox RID_CB_BRKPOINTS - { - HelpID = "basctl:ComboBox:RID_BASICIDE_BREAKPOINTDLG:RID_CB_BRKPOINTS"; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 110 , 70 ) ; - TabStop = TRUE ; - }; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEW - { - HelpID = "basctl:PushButton:RID_BASICIDE_BREAKPOINTDLG:RID_PB_NEW"; - Pos = MAP_APPFONT ( 122 , 57 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "New" ; - }; - PushButton RID_PB_DEL - { - HelpID = "basctl:PushButton:RID_BASICIDE_BREAKPOINTDLG:RID_PB_DEL"; - Pos = MAP_APPFONT ( 122 , 74 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Delete" ; - }; - CheckBox RID_CHKB_ACTIVE - { - HelpID = "basctl:CheckBox:RID_BASICIDE_BREAKPOINTDLG:RID_CHKB_ACTIVE"; - Pos = MAP_APPFONT ( 6 , 87 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Active" ; - }; - FixedText RID_FT_PASS - { - Pos = MAP_APPFONT ( 6 , 102 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "Pass Count:" ; - }; - FixedText RID_FT_BRKPOINTS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110, 10 ) ; - Text [ en-US ] = "Breakpoints" ; - }; - NumericField RID_FLD_PASS - { - HelpID = "basctl:NumericField:RID_BASICIDE_BREAKPOINTDLG:RID_FLD_PASS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 81 , 100 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - }; - Text [ en-US ] = "Manage Breakpoints" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx deleted file mode 100644 index 64b41dc48..000000000 --- a/basctl/source/basicide/doceventnotifier.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "doceventnotifier.hxx" -#include "scriptdocument.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -#include - -#include -#include - -#include -#include - -#include -#include - -//........................................................................ -namespace basctl -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::document::XEventBroadcaster; - using ::com::sun::star::document::XEventListener; - using ::com::sun::star::document::EventObject; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::frame::XModel; - using ::com::sun::star::uno::UNO_QUERY; - /** === end UNO using === **/ - namespace csslang = ::com::sun::star::lang; - - //==================================================================== - //= DocumentEventNotifier_Impl - //==================================================================== - typedef ::cppu::WeakComponentImplHelper1 < XEventListener - > DocumentEventNotifier_Impl_Base; - - enum ListenerAction - { - RegisterListener, - RemoveListener - }; - - /** impl class for DocumentEventNotifier - */ - class DocumentEventNotifier_Impl :public ::boost::noncopyable - ,public ::cppu::BaseMutex - ,public DocumentEventNotifier_Impl_Base - { - public: - DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ); - - // document::XEventListener - virtual void SAL_CALL notifyEvent( const EventObject& Event ) throw (RuntimeException); - - // lang::XEventListener - virtual void SAL_CALL disposing( const csslang::EventObject& Event ) throw (RuntimeException); - - // ComponentHelper - virtual void SAL_CALL disposing(); - - protected: - ~DocumentEventNotifier_Impl(); - - private: - /// determines whether the instance is already disposed - bool impl_isDisposed_nothrow() const { return m_pListener == NULL; } - - /// disposes the instance - void impl_dispose_nothrow(); - - /// registers or revokes the instance as listener at the global event broadcaster - void impl_listenerAction_nothrow( ListenerAction _eAction ); - - private: - DocumentEventListener* m_pListener; - Reference< XModel > m_xModel; - }; - - //-------------------------------------------------------------------- - DocumentEventNotifier_Impl::DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ) - :DocumentEventNotifier_Impl_Base( m_aMutex ) - ,m_pListener( &_rListener ) - ,m_xModel( _rxDocument ) - { - osl_incrementInterlockedCount( &m_refCount ); - impl_listenerAction_nothrow( RegisterListener ); - osl_decrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - DocumentEventNotifier_Impl::~DocumentEventNotifier_Impl() - { - if ( !impl_isDisposed_nothrow() ) - { - acquire(); - dispose(); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException) - { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - - OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier_Impl::notifyEvent: disposed, but still getting events?" ); - if ( impl_isDisposed_nothrow() ) - return; - - Reference< XModel > xDocument( _rEvent.Source, UNO_QUERY ); - OSL_ENSURE( xDocument.is(), "DocumentEventNotifier_Impl::notifyEvent: illegal source document!" ); - if ( !xDocument.is() ) - return; - - struct EventEntry - { - const sal_Char* pEventName; - void (DocumentEventListener::*listenerMethod)( const ScriptDocument& _rDocument ); - }; - EventEntry aEvents[] = { - { "OnNew", &DocumentEventListener::onDocumentCreated }, - { "OnLoad", &DocumentEventListener::onDocumentOpened }, - { "OnSave", &DocumentEventListener::onDocumentSave }, - { "OnSaveDone", &DocumentEventListener::onDocumentSaveDone }, - { "OnSaveAs", &DocumentEventListener::onDocumentSaveAs }, - { "OnSaveAsDone", &DocumentEventListener::onDocumentSaveAsDone }, - { "OnUnload", &DocumentEventListener::onDocumentClosed }, - { "OnTitleChanged", &DocumentEventListener::onDocumentTitleChanged }, - { "OnModeChanged", &DocumentEventListener::onDocumentModeChanged } - }; - - for ( size_t i=0; i < SAL_N_ELEMENTS( aEvents ); ++i ) - { - if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) ) - continue; - - ScriptDocument aDocument( xDocument ); - { - // the listener implementations usually require the SolarMutex, so lock it here. - // But ensure the proper order of locking the solar and the own mutex - aGuard.clear(); - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard2( m_aMutex ); - - if ( impl_isDisposed_nothrow() ) - // somebody took the chance to dispose us -> bail out - return; - - (m_pListener->*aEvents[i].listenerMethod)( aDocument ); - } - break; - } - } - - //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !impl_isDisposed_nothrow() ) - impl_dispose_nothrow(); - } - - //-------------------------------------------------------------------- - void SAL_CALL DocumentEventNotifier_Impl::disposing() - { - impl_listenerAction_nothrow( RemoveListener ); - impl_dispose_nothrow(); - } - - //-------------------------------------------------------------------- - void DocumentEventNotifier_Impl::impl_dispose_nothrow() - { - m_pListener = NULL; - m_xModel.clear(); - } - - //-------------------------------------------------------------------- - void DocumentEventNotifier_Impl::impl_listenerAction_nothrow( ListenerAction _eAction ) - { - try - { - Reference< XEventBroadcaster > xBroadcaster; - if ( m_xModel.is() ) - xBroadcaster.set( m_xModel, UNO_QUERY_THROW ); - else - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - xBroadcaster.set( - aContext.createComponent( "com.sun.star.frame.GlobalEventBroadcaster" ), - UNO_QUERY_THROW ); - } - - void ( SAL_CALL XEventBroadcaster::*listenerAction )( const Reference< XEventListener >& ) = - ( _eAction == RegisterListener ) ? &XEventBroadcaster::addEventListener : &XEventBroadcaster::removeEventListener; - (xBroadcaster.get()->*listenerAction)( this ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //==================================================================== - //= DocumentEventNotifier - //==================================================================== - //-------------------------------------------------------------------- - DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument ) - :m_pImpl( new DocumentEventNotifier_Impl( _rListener, _rxDocument ) ) - { - } - - //-------------------------------------------------------------------- - DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener ) - :m_pImpl( new DocumentEventNotifier_Impl( _rListener, Reference< XModel >() ) ) - { - } - - //-------------------------------------------------------------------- - DocumentEventNotifier::~DocumentEventNotifier() - { - } - - //-------------------------------------------------------------------- - void DocumentEventNotifier::dispose() - { - m_pImpl->dispose(); - } - - //==================================================================== - //= DocumentEventListener - //==================================================================== - DocumentEventListener::~DocumentEventListener() - { - } - -//........................................................................ -} // namespace basctl -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx deleted file mode 100644 index 07c258cc3..000000000 --- a/basctl/source/basicide/docsignature.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "docsignature.hxx" -#include "scriptdocument.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -//........................................................................ -namespace basctl -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::frame::XModel; - /** === end UNO using === **/ - - //==================================================================== - //= DocumentSignature_Data - //==================================================================== - struct DocumentSignature_Data - { - SfxObjectShell* pShell; - - DocumentSignature_Data() : pShell( NULL ) { } - }; - - //==================================================================== - //= DocumentSignature - //==================================================================== - //-------------------------------------------------------------------- - DocumentSignature::DocumentSignature( const ScriptDocument& _rDocument ) - :m_pData( new DocumentSignature_Data ) - { - if ( _rDocument.isDocument() ) - { - Reference< XModel > xDocument( _rDocument.getDocument() ); - // find object shell for document - SfxObjectShell* pShell = SfxObjectShell::GetFirst(); - while ( pShell ) - { - if ( pShell->GetModel() == xDocument ) - break; - pShell = SfxObjectShell::GetNext( *pShell ); - } - m_pData->pShell = pShell; - } - } - - //-------------------------------------------------------------------- - DocumentSignature::~DocumentSignature() - { - } - - //-------------------------------------------------------------------- - bool DocumentSignature::supportsSignatures() const - { - return ( m_pData->pShell != NULL ); - } - - //-------------------------------------------------------------------- - void DocumentSignature::signScriptingContent() const - { - OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" ); - if ( m_pData->pShell ) - m_pData->pShell->SignScriptingContent(); - } - - //-------------------------------------------------------------------- - sal_uInt16 DocumentSignature::getScriptingSignatureState() const - { - if ( m_pData->pShell ) - return m_pData->pShell->GetScriptingSignatureState(); - return SIGNATURESTATE_NOSIGNATURES; - } - -//........................................................................ -} // namespace basctl -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/documentenumeration.cxx b/basctl/source/basicide/documentenumeration.cxx deleted file mode 100644 index dc1d108d9..000000000 --- a/basctl/source/basicide/documentenumeration.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "documentenumeration.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -//........................................................................ -namespace basctl { namespace docs { -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::frame::XDesktop; - using ::com::sun::star::container::XEnumerationAccess; - using ::com::sun::star::container::XEnumeration; - using ::com::sun::star::uno::Any; - using ::com::sun::star::frame::XModel; - using ::com::sun::star::frame::XFramesSupplier; - using ::com::sun::star::frame::XFrames; - using ::com::sun::star::frame::XController; - using ::com::sun::star::frame::XModel2; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::frame::XFrame; - /** === end UNO using === **/ - namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; - - //==================================================================== - //= DocumentEnumeration_Data - //==================================================================== - struct DocumentEnumeration_Data - { - ::comphelper::ComponentContext aContext; - const IDocumentDescriptorFilter* pFilter; - - DocumentEnumeration_Data( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter ) - :aContext( _rContext ) - ,pFilter( _pFilter ) - { - } - }; - - //==================================================================== - //= DocumentEnumeration - //==================================================================== - //-------------------------------------------------------------------- - DocumentEnumeration::DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter ) - :m_pData( new DocumentEnumeration_Data( _rContext, _pFilter ) ) - { - } - - //-------------------------------------------------------------------- - DocumentEnumeration::~DocumentEnumeration() - { - } - - //-------------------------------------------------------------------- - namespace - { - //................................................................ - void lcl_getDocumentControllers_nothrow( DocumentDescriptor& _io_rDocDesc ) - { - OSL_PRECOND( _io_rDocDesc.xModel.is(), "lcl_getDocumentControllers_nothrow: illegal model!" ); - - _io_rDocDesc.aControllers.clear(); - try - { - Reference< XModel2 > xModel2( _io_rDocDesc.xModel, UNO_QUERY ); - if ( xModel2.is() ) - { - Reference< XEnumeration > xEnum( xModel2->getControllers(), UNO_SET_THROW ); - while ( xEnum->hasMoreElements() ) - { - Reference< XController > xController( xEnum->nextElement(), UNO_QUERY_THROW ); - _io_rDocDesc.aControllers.push_back( xController ); - } - } - else if ( _io_rDocDesc.xModel.is() ) - _io_rDocDesc.aControllers.push_back( _io_rDocDesc.xModel->getCurrentController() ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //................................................................ - void lcl_getDocuments_nothrow( const Sequence< Reference< XFrame > >& _rFrames, Documents& _out_rDocuments, - const IDocumentDescriptorFilter* _pFilter ) - { - // ensure we don't encounter some models multiple times - ::std::set< Reference< XModel >, ::comphelper::OInterfaceCompare< XModel > > aEncounteredModels; - - for ( const Reference< XFrame >* pFrame = _rFrames.getConstArray(); - pFrame != _rFrames.getConstArray() + _rFrames.getLength(); - ++pFrame - ) - { - try - { - OSL_ENSURE( pFrame->is(), "lcl_getDocuments_nothrow: illegal frame!" ); - if ( !pFrame->is() ) - continue; - Reference< XController > xController( (*pFrame)->getController() ); - if ( !xController.is() ) - continue; - - Reference< XModel > xModel( xController->getModel() ); - if ( !xModel.is() ) - // though it's legal for a controller to not have a model, we're not interested in - // those - continue; - - if ( aEncounteredModels.find( xModel ) != aEncounteredModels.end() ) - // there might be multiple frames for the same model - // handle it only once - continue; - aEncounteredModels.insert( xModel ); - - // create a DocumentDescriptor - DocumentDescriptor aDescriptor; - aDescriptor.xModel = xModel; - lcl_getDocumentControllers_nothrow( aDescriptor ); - - // consult filter, if there is one - if ( _pFilter && !_pFilter->includeDocument( aDescriptor ) ) - continue; - - _out_rDocuments.push_back( aDescriptor ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - } - - //-------------------------------------------------------------------- - void DocumentEnumeration::getDocuments( Documents& _out_rDocuments ) const - { - _out_rDocuments.clear(); - - try - { - const Reference< XDesktop > xDesktop( m_pData->aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - const Reference< XFramesSupplier > xSuppFrames( xDesktop, UNO_QUERY_THROW ); - const Reference< XFrames > xFrames( xSuppFrames->getFrames(), UNO_SET_THROW ); - const Sequence< Reference< XFrame > > aFrames( xFrames->queryFrames( FrameSearchFlag::ALL ) ); - - lcl_getDocuments_nothrow( aFrames, _out_rDocuments, m_pData->pFilter ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//........................................................................ -} } // namespace basctl::docs -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/documentenumeration.hxx b/basctl/source/basicide/documentenumeration.hxx deleted file mode 100644 index a0767ac1f..000000000 --- a/basctl/source/basicide/documentenumeration.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BASCTL_DOCUMENTENUMERATION_HXX -#define BASCTL_DOCUMENTENUMERATION_HXX - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -#include - -#include -#include - -//........................................................................ -namespace basctl { namespace docs { -//........................................................................ - - typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > Model; - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > > Controllers; - - struct DocumentDescriptor - { - Model xModel; - Controllers aControllers; - }; - - typedef ::std::vector< DocumentDescriptor > Documents; - - //==================================================================== - //= IDocumentDescriptorFilter - //==================================================================== - /// allows pre-filtering when enumerating document descriptors - class SAL_NO_VTABLE IDocumentDescriptorFilter - { - public: - virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0; - }; - - //==================================================================== - //= DocumentEnumeration - //==================================================================== - struct DocumentEnumeration_Data; - /** is a helper class for enumerating documents in OOo - - If you need a list of all open documents in OOo, this is little bit of - a hassle: You need to iterate though all components at the desktop, which - might or might not be documents. - - Additionally, you need to examine the existing documents' frames - for sub frames, which might contain sub documents (e.g. embedded objects - edited out-place). - - DocumentEnumeration relieves you from this hassle. - */ - class DocumentEnumeration - { - public: - DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter = NULL ); - ~DocumentEnumeration(); - - /** retrieves a list of all currently known documents in the application - - @param _out_rDocuments - output parameter taking the collected document information - @ - */ - void getDocuments( - Documents& _out_rDocuments - ) const; - - private: - ::std::auto_ptr< DocumentEnumeration_Data > m_pData; - }; - -//........................................................................ -} } // namespace basctl::docs -//........................................................................ - -#endif // BASCTL_DOCUMENTENUMERATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/ide_pch.cxx b/basctl/source/basicide/ide_pch.cxx deleted file mode 100644 index 3a80c6552..000000000 --- a/basctl/source/basicide/ide_pch.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/ide_pch.hxx b/basctl/source/basicide/ide_pch.hxx deleted file mode 100644 index 0c14f7ea1..000000000 --- a/basctl/source/basicide/ide_pch.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#define ITEMID_SEARCH 0 -#define ITEMID_SIZE 0 - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define _BASIC_TEXTPORTIONS -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx deleted file mode 100644 index e231b2844..000000000 --- a/basctl/source/basicide/iderdll.cxx +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include - - -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define ITEMID_SEARCH 0 -#include -#include - -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -static BasicIDEDLL* pBasicIDEDLL = 0; - -BasicIDEDLL* BasicIDEDLL::GetDLL() -{ - return pBasicIDEDLL; -} - -IDEResId::IDEResId( sal_uInt16 nId ): - ResId( nId, *(*(BasicIDEModule**)GetAppData(SHL_IDE))->GetResMgr() ) -{ -} - -BasicIDEDLL::BasicIDEDLL() -{ - pBasicIDEDLL = this; - pShell = 0; - pExtraData = 0; - - GetExtraData(); // damit GlobalErrorHdl gesetzt wird. -} - -BasicIDEDLL::~BasicIDEDLL() -{ - delete pExtraData; - *(BasicIDEDLL**)GetAppData(SHL_IDE) = NULL; -} - -void BasicIDEDLL::Init() -{ - if ( pBasicIDEDLL ) - return; - - SfxObjectFactory* pFact = &BasicDocShell::Factory(); - (void)pFact; - - ResMgr* pMgr = ResMgr::CreateResMgr( - "basctl", Application::GetSettings().GetUILocale() ); - - BASIC_MOD() = new BasicIDEModule( pMgr, &BasicDocShell::Factory() ); - - new BasicIDEDLL; - SfxModule* pMod = BASIC_MOD(); - - SfxObjectFactory& rFactory = BasicDocShell::Factory(); - rFactory.SetDocumentServiceName( String::CreateFromAscii( "com.sun.star.script.BasicIDE" ) ); - - BasicDocShell::RegisterInterface( pMod ); - BasicIDEShell::RegisterFactory( SVX_INTERFACE_BASIDE_VIEWSH ); - BasicIDEShell::RegisterInterface( pMod ); - - PropBrwMgr::RegisterChildWindow(); -} - -BasicIDEData* BasicIDEDLL::GetExtraData() -{ - if ( !pExtraData ) - pExtraData = new BasicIDEData; - return pExtraData; -} - -BasicIDEData::BasicIDEData() : aObjCatPos( INVPOSITION, INVPOSITION ) -{ - nBasicDialogCount = 0; - bChoosingMacro = sal_False; - bShellInCriticalSection = sal_False; - pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM ); - - StarBASIC::SetGlobalBreakHdl( LINK( this, BasicIDEData, GlobalBasicBreakHdl ) ); - - pAccelerator = 0; -} - -BasicIDEData::~BasicIDEData() -{ - // ErrorHdl zuruecksetzen ist zwar sauberer, aber diese Instanz wird - // sowieso sehr spaet, nach dem letzten Basic, zerstoert. - // Durch den Aufruf werden dann aber wieder AppDaten erzeugt und nicht - // mehr zerstoert => MLK's beim Purify -// StarBASIC::SetGlobalErrorHdl( Link() ); -// StarBASIC::SetGlobalBreakHdl( Link() ); -// StarBASIC::setGlobalStarScriptListener( XEngineListenerRef() ); - - delete pSearchItem; - //delete pAccelerator; -} - -SvxSearchItem& BasicIDEData::GetSearchItem() const -{ - return *pSearchItem; -} - -void BasicIDEData::SetSearchItem( const SvxSearchItem& rItem ) -{ - delete pSearchItem; - pSearchItem = (SvxSearchItem*)rItem.Clone(); -} - -IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) -{ - long nRet = 0; - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - if ( pBasMgr ) - { - // Hier lande ich zweimal, wenn Step into protected Basic - // => schlecht, wenn Passwortabfrage 2x, ausserdem sieht man in - // dem PasswordDlg nicht, fuer welche Lib... - // => An dieser Stelle keine Passwort-Abfrage starten - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - OSL_ENSURE( aDocument.isValid(), "BasicIDEData::GlobalBasicBreakHdl: no document for the basic manager!" ); - if ( aDocument.isValid() ) - { - ::rtl::OUString aOULibName( pBasic->GetName() ); - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - // Ein Step-Out muesste mich aus den geschuetzten Bereich befoerdern... - nRet = SbDEBUG_STEPOUT; - } - else - { - nRet = pIDEShell->CallBasicBreakHdl( pBasic ); - } - } - } - } - } - - return nRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/iderdll2.hxx b/basctl/source/basicide/iderdll2.hxx deleted file mode 100644 index 3ed3ee642..000000000 --- a/basctl/source/basicide/iderdll2.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _IDERDLL2_HXX -#define _IDERDLL2_HXX - -class StarBASIC; -class SvxSearchItem; -class Accelerator; - -#include -#include -#include - -#include -#include - -#define INVPOSITION 0x7fff - -class BasicIDEData -{ -private: - Accelerator* pAccelerator; - SvxSearchItem* pSearchItem; - - LibInfos aLibInfos; - - BasicEntryDescriptor m_aLastEntryDesc; - - Point aObjCatPos; - Size aObjCatSize; - - String aAddLibPath; - String aAddLibFilter; - - sal_uInt16 nBasicDialogCount; - - sal_Bool OLD_bRelMacroRecording; - sal_Bool bChoosingMacro; - sal_Bool bShellInCriticalSection; - -protected: - DECL_LINK( GlobalBasicBreakHdl, StarBASIC * ); - -public: - BasicIDEData(); - ~BasicIDEData(); - - LibInfos& GetLibInfos() { return aLibInfos; } - - BasicEntryDescriptor& GetLastEntryDescriptor() { return m_aLastEntryDesc; } - void SetLastEntryDescriptor( BasicEntryDescriptor& rDesc ) { m_aLastEntryDesc = rDesc; } - - sal_Bool& ChoosingMacro() { return bChoosingMacro; } - sal_Bool& ShellInCriticalSection() { return bShellInCriticalSection; } - - sal_uInt16 GetBasicDialogCount() const { return nBasicDialogCount; } - void IncBasicDialogCount() { nBasicDialogCount++; } - void DecBasicDialogCount() { nBasicDialogCount--; } - - SvxSearchItem& GetSearchItem() const; - void SetSearchItem( const SvxSearchItem& rItem ); - - void SetObjectCatalogPos( const Point& rPnt ) - { aObjCatPos = rPnt; } - const Point& GetObjectCatalogPos() const - { return aObjCatPos; } - - void SetObjectCatalogSize( const Size& rSize ) - { aObjCatSize = rSize; } - const Size& GetObjectCatalogSize() const - { return aObjCatSize; } - - const String& GetAddLibPath() const { return aAddLibPath; } - void SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; } - - const String& GetAddLibFilter() const { return aAddLibFilter; } - void SetAddLibFilter( const String& rFilter ) { aAddLibFilter = rFilter; } -}; - - -#endif //_IDERDLL2_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/idetemp.hxx b/basctl/source/basicide/idetemp.hxx deleted file mode 100644 index 2d8d826bd..000000000 --- a/basctl/source/basicide/idetemp.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _IDETEMP_HXX -#define _IDETEMP_HXX - - -enum SvxChooseControlEnum -{ - SVX_SNAP_PUSHBUTTON, - SVX_SNAP_CHECKBOX, - SVX_SNAP_RADIOBUTTON, - SVX_SNAP_SPINBUTTON, - SVX_SNAP_FIXEDTEXT, - SVX_SNAP_GROUPBOX, - SVX_SNAP_LISTBOX, - SVX_SNAP_COMBOBOX, - SVX_SNAP_EDIT, - SVX_SNAP_HSCROLLBAR, - SVX_SNAP_VSCROLLBAR, - SVX_SNAP_PREVIEW, - SVX_SNAP_SELECT, - SVX_SNAP_URLBUTTON, - SVX_SNAP_NOTHING, - SVX_SNAP_IMAGECONTROL, - SVX_SNAP_PROGRESSBAR, - SVX_SNAP_HFIXEDLINE, - SVX_SNAP_VFIXEDLINE, - SVX_SNAP_DATEFIELD, - SVX_SNAP_TIMEFIELD, - SVX_SNAP_NUMERICFIELD, - SVX_SNAP_CURRENCYFIELD, - SVX_SNAP_FORMATTEDFIELD, - SVX_SNAP_PATTERNFIELD, - SVX_SNAP_FILECONTROL, - SVX_SNAP_TREECONTROL -}; - -#define SvxChooseControlItem SfxAllEnumItem - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx deleted file mode 100644 index 499de7996..000000000 --- a/basctl/source/basicide/localizationmgr.cxx +++ /dev/null @@ -1,1180 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_basctl.hxx" -#include - -#include -#include -#include -#include -#include "dlged.hxx" - -#include -#include -#include - -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::resource; - -static ::rtl::OUString aDot( RTL_CONSTASCII_USTRINGPARAM( "." )); -static ::rtl::OUString aEsc( RTL_CONSTASCII_USTRINGPARAM( "&" )); -static ::rtl::OUString aSemi( RTL_CONSTASCII_USTRINGPARAM( ";" )); - - -LocalizationMgr::LocalizationMgr( BasicIDEShell* pIDEShell, - const ScriptDocument& rDocument, String aLibName, - const Reference< XStringResourceManager >& xStringResourceManager ) - : m_xStringResourceManager( xStringResourceManager ) - , m_pIDEShell( pIDEShell ) - , m_aDocument( rDocument ) - , m_aLibName( aLibName ) -{ -} - -bool LocalizationMgr::isLibraryLocalized( void ) -{ - bool bRet = false; - if( m_xStringResourceManager.is() ) - { - Sequence< Locale > aLocaleSeq = m_xStringResourceManager->getLocales(); - bRet = ( aLocaleSeq.getLength() > 0 ); - } - return bRet; -} - -void LocalizationMgr::handleTranslationbar( void ) -{ - static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )); - static ::rtl::OUString aToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/translationbar" )); - - Reference< beans::XPropertySet > xFrameProps - ( m_pIDEShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); - if ( xFrameProps.is() ) - { - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName ); - a >>= xLayoutManager; - if ( xLayoutManager.is() ) - { - if ( !isLibraryLocalized() ) - { - xLayoutManager->destroyElement( aToolBarResName ); - } - else - { - xLayoutManager->createElement( aToolBarResName ); - xLayoutManager->requestElement( aToolBarResName ); - } - } - } -} - - -// TODO: -> export from toolkit - -struct LanguageDependentProp -{ - const char* pPropName; - sal_Int32 nPropNameLength; -}; - -static LanguageDependentProp aLanguageDependentProp[] = -{ - { "Text", 4 }, - { "Label", 5 }, - { "Title", 5 }, - { "HelpText", 8 }, - { "CurrencySymbol", 14 }, - { "StringItemList", 14 }, - { 0, 0 } -}; - -bool isLanguageDependentProperty( ::rtl::OUString aName ) -{ - bool bRet = false; - - LanguageDependentProp* pLangDepProp = aLanguageDependentProp; - while( pLangDepProp->pPropName != 0 ) - { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) - { - bRet = true; - break; - } - pLangDepProp++; - } - return bRet; -} - - -void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode ) -{ - Sequence< ::rtl::OUString > aDlgNames = m_aDocument.getObjectNames( E_DIALOGS, m_aLibName ); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray(); - - Reference< XStringResourceResolver > xDummyStringResolver; - for( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) - { - String aDlgName = pDlgNames[ i ]; - DialogWindow* pWin = m_pIDEShell->FindDlgWin( m_aDocument, m_aLibName, aDlgName, sal_False ); - if( pWin && pWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDialogWin = static_cast< DialogWindow* >( pWin ); - Reference< container::XNameContainer > xDialog = pDialogWin->GetDialog(); - if( xDialog.is() ) - { - // Handle dialog itself as control - Any aDialogCtrl; - aDialogCtrl <<= xDialog; - implHandleControlResourceProperties( aDialogCtrl, aDlgName, - ::rtl::OUString(), m_xStringResourceManager, xDummyStringResolver, eMode ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialog->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 j = 0 ; j < nCtrls ; ++j ) - { - ::rtl::OUString aCtrlName( pNames[j] ); - Any aCtrl = xDialog->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDlgName, - aCtrlName, m_xStringResourceManager, xDummyStringResolver, eMode ); - } - } - } - } -} - - -::rtl::OUString implCreatePureResourceId - ( const ::rtl::OUString& aDialogName, const ::rtl::OUString& aCtrlName, - const ::rtl::OUString& aPropName, - Reference< XStringResourceManager > xStringResourceManager ) -{ - sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId(); - ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId ); - aPureIdStr += aDot; - aPureIdStr += aDialogName; - aPureIdStr += aDot; - if( aCtrlName.getLength() ) - { - aPureIdStr += aCtrlName; - aPureIdStr += aDot; - } - aPureIdStr += aPropName; - return aPureIdStr; -} - -extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, - const ::com::sun::star::lang::Locale& rLocaleRight ); - -// Works on xStringResourceManager's current language for SET_IDS/RESET_IDS, -// anyway only one language should exist when calling this method then, -// either the first one for mode SET_IDS or the last one for mode RESET_IDS -sal_Int32 LocalizationMgr::implHandleControlResourceProperties - ( Any aControlAny, const ::rtl::OUString& aDialogName, const ::rtl::OUString& aCtrlName, - Reference< XStringResourceManager > xStringResourceManager, - Reference< XStringResourceResolver > xSourceStringResolver, HandleResourceMode eMode ) -{ - sal_Int32 nChangedCount = 0; - - Reference< XPropertySet > xPropertySet; - aControlAny >>= xPropertySet; - if( xPropertySet.is() ) - { - Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - if( nLocaleCount == 0 ) - return 0; - - Reference< XPropertySetInfo > xPropertySetInfo = xPropertySet->getPropertySetInfo(); - if( xPropertySetInfo.is() ) - { - // get sequence of control properties - Sequence< Property > aPropSeq = xPropertySetInfo->getProperties(); - const Property* pProps = aPropSeq.getConstArray(); - sal_Int32 nCtrlProps = aPropSeq.getLength(); - - // create a map of tab indices and control names, sorted by tab index - for( sal_Int32 j = 0 ; j < nCtrlProps ; ++j ) - { - const Property& rProp = pProps[j]; - ::rtl::OUString aPropName = rProp.Name; - TypeClass eType = rProp.Type.getTypeClass(); - bool bLanguageDependentProperty = - (eType == TypeClass_STRING || eType == TypeClass_SEQUENCE) - && isLanguageDependentProperty( aPropName ); - if( !bLanguageDependentProperty ) - continue; - - if( eType == TypeClass_STRING ) - { - Any aPropAny = xPropertySet->getPropertyValue( aPropName ); - ::rtl::OUString aPropStr; - aPropAny >>= aPropStr; - - // Replace string by id, add id+string to StringResource - if( eMode == SET_IDS ) - { - bool bEscAlreadyExisting = (aPropStr.getLength() && aPropStr.getStr()[0] == '&' ); - if( bEscAlreadyExisting ) - continue; - - ::rtl::OUString aPureIdStr = implCreatePureResourceId - ( aDialogName, aCtrlName, aPropName, xStringResourceManager ); - - // Set Id for all locales - const Locale* pLocales = aLocaleSeq.getConstArray(); - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale ); - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - // TODO?: Change here and in toolkit - (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Replace id by string from StringResource - else if( eMode == RESET_IDS ) - { - if( aPropStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aPropStr.copy( 1 ); - ::rtl::OUString aNewPropStr = aPropStr; - try - { - aNewPropStr = xStringResourceManager->resolveString( aPureIdStr ); - } - catch(MissingResourceException&) - { - } - aPropAny <<= aNewPropStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - } - // Remove Id for all locales - else if( eMode == REMOVE_IDS_FROM_RESOURCE ) - { - if( aPropStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aPropStr.copy( 1 ); - - const Locale* pLocales = aLocaleSeq.getConstArray(); - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - try - { - xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale ); - } - catch(MissingResourceException&) - { - } - } - } - } - // Rename resource id - else if( eMode == RENAME_DIALOG_IDS || eMode == RENAME_CONTROL_IDS ) - { - ::rtl::OUString aSourceIdStr = aPropStr; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - ::rtl::OUString aPureIdStr = implCreatePureResourceId - ( aDialogName, aCtrlName, aPropName, xStringResourceManager ); - - // Set new Id and remove old one for all locales - const Locale* pLocales = aLocaleSeq.getConstArray(); - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - ::rtl::OUString aResStr; - try - { - aResStr = xStringResourceManager->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - xStringResourceManager->removeIdForLocale( aPureSourceIdStr, rLocale ); - xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale ); - } - catch(MissingResourceException&) - {} - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - // TODO?: Change here and in toolkit - (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Replace string by string from source StringResourceResolver - else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() ) - { - ::rtl::OUString aSourceIdStr = aPropStr; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - ::rtl::OUString aPureIdStr = implCreatePureResourceId - ( aDialogName, aCtrlName, aPropName, xStringResourceManager ); - - const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); - - // Set Id for all locales - const Locale* pLocales = aLocaleSeq.getConstArray(); - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - ::rtl::OUString aResStr; - try - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - } - catch(MissingResourceException&) - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rDefaultLocale ); - } - xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale ); - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - // TODO?: Change here and in toolkit - (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Copy string from source to target resource - else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) - { - ::rtl::OUString aSourceIdStr = aPropStr; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); - - // Copy Id for all locales - const Locale* pLocales = aLocaleSeq.getConstArray(); - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - ::rtl::OUString aResStr; - try - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - } - catch(MissingResourceException&) - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rDefaultLocale ); - } - xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale ); - } - } - nChangedCount++; - } - - // Listbox / Combobox - else if( eType == TypeClass_SEQUENCE ) - { - Any aPropAny = xPropertySet->getPropertyValue( aPropName ); - Sequence< ::rtl::OUString > aPropStrings; - aPropAny >>= aPropStrings; - - const ::rtl::OUString* pPropStrings = aPropStrings.getConstArray(); - sal_Int32 nPropStringCount = aPropStrings.getLength(); - if( nPropStringCount == 0 ) - continue; - - // Replace string by id, add id+string to StringResource - if( eMode == SET_IDS ) - { - Sequence< ::rtl::OUString > aIdStrings; - aIdStrings.realloc( nPropStringCount ); - ::rtl::OUString* pIdStrings = aIdStrings.getArray(); - - ::rtl::OUString aIdStrBase = aDot; - aIdStrBase += aCtrlName; - aIdStrBase += aDot; - aIdStrBase += aPropName; - - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aPropStr = pPropStrings[i]; - bool bEscAlreadyExisting = (aPropStr.getLength() && aPropStr.getStr()[0] == '&' ); - if( bEscAlreadyExisting ) - { - pIdStrings[i] = aPropStr; - continue; - } - - sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId(); - ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId ); - aPureIdStr += aIdStrBase; - - // Set Id for all locales - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const Locale& rLocale = pLocales[ iLocale ]; - xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale ); - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - pIdStrings[i] = aPropIdStr; - } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Replace id by string from StringResource - else if( eMode == RESET_IDS ) - { - Sequence< ::rtl::OUString > aNewPropStrings; - aNewPropStrings.realloc( nPropStringCount ); - ::rtl::OUString* pNewPropStrings = aNewPropStrings.getArray(); - - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aIdStr = pPropStrings[i]; - ::rtl::OUString aNewPropStr = aIdStr; - if( aIdStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aIdStr.copy( 1 ); - try - { - aNewPropStr = xStringResourceManager->resolveString( aPureIdStr ); - } - catch(MissingResourceException&) - { - } - } - pNewPropStrings[i] = aNewPropStr; - } - aPropAny <<= aNewPropStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Remove Id for all locales - else if( eMode == REMOVE_IDS_FROM_RESOURCE ) - { - Sequence< ::rtl::OUString > aNewPropStrings; - aNewPropStrings.realloc( nPropStringCount ); - - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aIdStr = pPropStrings[i]; - if( aIdStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aIdStr.copy( 1 ); - - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const Locale& rLocale = pLocales[iLocale]; - try - { - xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale ); - } - catch(MissingResourceException&) - { - } - } - } - } - } - // Rename resource id - else if( eMode == RENAME_CONTROL_IDS ) - { - Sequence< ::rtl::OUString > aIdStrings; - aIdStrings.realloc( nPropStringCount ); - ::rtl::OUString* pIdStrings = aIdStrings.getArray(); - - ::rtl::OUString aIdStrBase = aDot; - aIdStrBase += aCtrlName; - aIdStrBase += aDot; - aIdStrBase += aPropName; - - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aSourceIdStr = pPropStrings[i]; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId(); - ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId ); - aPureIdStr += aIdStrBase; - - // Set Id for all locales - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const Locale& rLocale = pLocales[ iLocale ]; - - ::rtl::OUString aResStr; - try - { - aResStr = xStringResourceManager->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - xStringResourceManager->removeIdForLocale( aPureSourceIdStr, rLocale ); - xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale ); - } - catch(MissingResourceException&) - {} - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - pIdStrings[i] = aPropIdStr; - } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Replace string by string from source StringResourceResolver - else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() ) - { - Sequence< ::rtl::OUString > aIdStrings; - aIdStrings.realloc( nPropStringCount ); - ::rtl::OUString* pIdStrings = aIdStrings.getArray(); - - ::rtl::OUString aIdStrBase = aDot; - aIdStrBase += aCtrlName; - aIdStrBase += aDot; - aIdStrBase += aPropName; - - const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); - - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aSourceIdStr = pPropStrings[i]; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId(); - ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId ); - aPureIdStr += aIdStrBase; - - // Set Id for all locales - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const Locale& rLocale = pLocales[ iLocale ]; - - ::rtl::OUString aResStr; - try - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - } - catch(MissingResourceException&) - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rDefaultLocale ); - } - xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale ); - } - - ::rtl::OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; - pIdStrings[i] = aPropIdStr; - } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); - } - // Copy string from source to target resource - else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) - { - const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale(); - - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 i; - for ( i = 0; i < nPropStringCount; ++i ) - { - ::rtl::OUString aSourceIdStr = pPropStrings[i]; - ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 ); - - // Set Id for all locales - for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ ) - { - const Locale& rLocale = pLocales[ iLocale ]; - - ::rtl::OUString aResStr; - try - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rLocale ); - } - catch(MissingResourceException&) - { - aResStr = xSourceStringResolver->resolveStringForLocale - ( aPureSourceIdStr, rDefaultLocale ); - } - xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale ); - } - } - } - nChangedCount++; - } - } - } - } - return nChangedCount; -} - - -void LocalizationMgr::handleAddLocales( Sequence< Locale > aLocaleSeq ) -{ - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - - if( isLibraryLocalized() ) - { - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - m_xStringResourceManager->newLocale( rLocale ); - } - } - else - { - DBG_ASSERT( nLocaleCount==1, "LocalizationMgr::handleAddLocales(): Only one first locale allowed" ); - - const Locale& rLocale = pLocales[ 0 ]; - m_xStringResourceManager->newLocale( rLocale ); - enableResourceForAllLibraryDialogs(); - } - - BasicIDE::MarkDocumentModified( m_aDocument ); - - // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - - handleTranslationbar(); -} - - -void LocalizationMgr::handleRemoveLocales( Sequence< Locale > aLocaleSeq ) -{ - const Locale* pLocales = aLocaleSeq.getConstArray(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - bool bConsistant = true; - bool bModified = false; - - for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ ) - { - const Locale& rLocale = pLocales[ i ]; - bool bRemove = true; - - // Check if last locale - Sequence< Locale > aResLocaleSeq = m_xStringResourceManager->getLocales(); - if( aResLocaleSeq.getLength() == 1 ) - { - const Locale& rLastResLocale = aResLocaleSeq.getConstArray()[ 0 ]; - if( localesAreEqual( rLocale, rLastResLocale ) ) - { - disableResourceForAllLibraryDialogs(); - } - else - { - // Inconsistancy, keep last locale - bConsistant = false; - bRemove = false; - } - } - - if( bRemove ) - { - try - { - m_xStringResourceManager->removeLocale( rLocale ); - bModified = true; - } - catch(IllegalArgumentException&) - { - bConsistant = false; - } - } - } - if( bModified ) - { - BasicIDE::MarkDocumentModified( m_aDocument ); - - // update slots - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - pBindings->Invalidate( SID_BASICIDE_MANAGE_LANG ); - } - - handleTranslationbar(); - } - - DBG_ASSERT( bConsistant, - "LocalizationMgr::handleRemoveLocales(): sequence contains unsupported locales" ); - (void)bConsistant; -} - -void LocalizationMgr::handleSetDefaultLocale( Locale aLocale ) -{ - if( m_xStringResourceManager.is() ) - { - try - { - m_xStringResourceManager->setDefaultLocale( aLocale ); - } - catch(IllegalArgumentException&) - { - OSL_FAIL( "LocalizationMgr::handleSetDefaultLocale: Invalid locale" ); - } - - // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - } -} - -void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale ) -{ - if( m_xStringResourceManager.is() ) - { - try - { - m_xStringResourceManager->setCurrentLocale( aLocale, false ); - } - catch(IllegalArgumentException&) - { - OSL_FAIL( "LocalizationMgr::handleSetCurrentLocale: Invalid locale" ); - } - - // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - - IDEBaseWindow* pCurWin = m_pIDEShell->GetCurWindow(); - if ( pCurWin && !pCurWin->IsSuspended() && pCurWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDlgWin = (DialogWindow*)pCurWin; - DlgEditor* pWinEditor = pDlgWin->GetEditor(); - if( pWinEditor ) - pWinEditor->UpdatePropertyBrowserDelayed(); - } - } -} - -void LocalizationMgr::handleBasicStarted( void ) -{ - if( m_xStringResourceManager.is() ) - m_aLocaleBeforeBasicStart = m_xStringResourceManager->getCurrentLocale(); -} - -void LocalizationMgr::handleBasicStopped( void ) -{ - try - { - if( m_xStringResourceManager.is() ) - m_xStringResourceManager->setCurrentLocale( m_aLocaleBeforeBasicStart, true ); - } - catch(IllegalArgumentException&) - { - } -} - - -DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor ) -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - IDEBaseWindow* pWin = aIDEWindowTable.First(); - DialogWindow* pFoundDlgWin = NULL; - while( pWin ) - { - if ( !pWin->IsSuspended() && pWin->IsA( TYPE( DialogWindow ) ) ) - { - DialogWindow* pDlgWin = (DialogWindow*)pWin; - DlgEditor* pWinEditor = pDlgWin->GetEditor(); - if( pWinEditor == pEditor ) - { - pFoundDlgWin = pDlgWin; - break; - } - } - pWin = aIDEWindowTable.Next(); - } - return pFoundDlgWin; -} - - -void LocalizationMgr::setControlResourceIDsForNewEditorObject( DlgEditor* pEditor, - Any aControlAny, const ::rtl::OUString& aCtrlName ) -{ - // Get library for DlgEditor - DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor ); - if( !pDlgWin ) - return; - ScriptDocument aDocument( pDlgWin->GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::setControlResourceIDsForNewEditorObject: invalid document!" ); - if ( !aDocument.isValid() ) - return; - const String& rLibName = pDlgWin->GetLibName(); - Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - - // Set resource property - if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 ) - return; - - ::rtl::OUString aDialogName = pDlgWin->GetName(); - Reference< XStringResourceResolver > xDummyStringResolver; - sal_Int32 nChangedCount = implHandleControlResourceProperties - ( aControlAny, aDialogName, aCtrlName, xStringResourceManager, - xDummyStringResolver, SET_IDS ); - - if( nChangedCount ) - BasicIDE::MarkDocumentModified( aDocument ); -} - -void LocalizationMgr::renameControlResourceIDsForEditorObject( DlgEditor* pEditor, - ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aNewCtrlName ) -{ - // Get library for DlgEditor - DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor ); - if( !pDlgWin ) - return; - ScriptDocument aDocument( pDlgWin->GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::renameControlResourceIDsForEditorObject: invalid document!" ); - if ( !aDocument.isValid() ) - return; - const String& rLibName = pDlgWin->GetLibName(); - Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - - // Set resource property - if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 ) - return; - - ::rtl::OUString aDialogName = pDlgWin->GetName(); - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties - ( aControlAny, aDialogName, aNewCtrlName, xStringResourceManager, - xDummyStringResolver, RENAME_CONTROL_IDS ); -} - - -void LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( DlgEditor* pEditor, - Any aControlAny, const ::rtl::OUString& aCtrlName ) -{ - // Get library for DlgEditor - DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor ); - if( !pDlgWin ) - return; - ScriptDocument aDocument( pDlgWin->GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject: invalid document!" ); - if ( !aDocument.isValid() ) - return; - const String& rLibName = pDlgWin->GetLibName(); - Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - - ::rtl::OUString aDialogName = pDlgWin->GetName(); - Reference< XStringResourceResolver > xDummyStringResolver; - sal_Int32 nChangedCount = implHandleControlResourceProperties - ( aControlAny, aDialogName, aCtrlName, xStringResourceManager, - xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE ); - - if( nChangedCount ) - BasicIDE::MarkDocumentModified( aDocument ); -} - -void LocalizationMgr::setStringResourceAtDialog( const ScriptDocument& rDocument, const String& aLibName, - const String& aDlgName, Reference< container::XNameContainer > xDialogModel ) -{ - static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )); - - // Get library - Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - - // Set resource property - if( xStringResourceManager.is() ) - { - // Not very elegant as dialog may or may not be localized yet - // TODO: Find better place, where dialog is created - if( xStringResourceManager->getLocales().getLength() > 0 ) - { - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties( aDialogCtrl, aDlgName, - ::rtl::OUString(), xStringResourceManager, - xDummyStringResolver, SET_IDS ); - } - - Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); - Any aStringResourceManagerAny; - aStringResourceManagerAny <<= xStringResourceManager; - xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny ); - } -} - -void LocalizationMgr::renameStringResourceIDs( const ScriptDocument& rDocument, const String& aLibName, - const String& aDlgName, Reference< container::XNameContainer > xDialogModel ) -{ - // Get library - Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - if( !xStringResourceManager.is() ) - return; - - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties( aDialogCtrl, aDlgName, - ::rtl::OUString(), xStringResourceManager, - xDummyStringResolver, RENAME_DIALOG_IDS ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDlgName, - aCtrlName, xStringResourceManager, - xDummyStringResolver, RENAME_DIALOG_IDS ); - } -} - -void LocalizationMgr::removeResourceForDialog( const ScriptDocument& rDocument, const String& aLibName, - const String& aDlgName, Reference< container::XNameContainer > xDialogModel ) -{ - // Get library - Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - if( !xStringResourceManager.is() ) - return; - - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties( aDialogCtrl, aDlgName, - ::rtl::OUString(), xStringResourceManager, - xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDlgName, - aCtrlName, xStringResourceManager, - xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE ); - } -} - -void LocalizationMgr::resetResourceForDialog( Reference< container::XNameContainer > xDialogModel, - Reference< XStringResourceManager > xStringResourceManager ) -{ - if( !xStringResourceManager.is() ) - return; - - // Dialog as control - ::rtl::OUString aDummyName; - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties( aDialogCtrl, aDummyName, - aDummyName, xStringResourceManager, xDummyStringResolver, RESET_IDS ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDummyName, - aCtrlName, xStringResourceManager, xDummyStringResolver, RESET_IDS ); - } -} - -void LocalizationMgr::setResourceIDsForDialog( Reference< container::XNameContainer > xDialogModel, - Reference< XStringResourceManager > xStringResourceManager ) -{ - if( !xStringResourceManager.is() ) - return; - - // Dialog as control - ::rtl::OUString aDummyName; - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - Reference< XStringResourceResolver > xDummyStringResolver; - implHandleControlResourceProperties( aDialogCtrl, aDummyName, - aDummyName, xStringResourceManager, xDummyStringResolver, SET_IDS ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDummyName, - aCtrlName, xStringResourceManager, xDummyStringResolver, SET_IDS ); - } -} - -void LocalizationMgr::copyResourcesForPastedEditorObject( DlgEditor* pEditor, - Any aControlAny, const ::rtl::OUString& aCtrlName, - Reference< XStringResourceResolver > xSourceStringResolver ) -{ - // Get library for DlgEditor - DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor ); - if( !pDlgWin ) - return; - ScriptDocument aDocument( pDlgWin->GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::copyResourcesForPastedEditorObject: invalid document!" ); - if ( !aDocument.isValid() ) - return; - const String& rLibName = pDlgWin->GetLibName(); - Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) ); - Reference< XStringResourceManager > xStringResourceManager = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - - // Set resource property - if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 ) - return; - - ::rtl::OUString aDialogName = pDlgWin->GetName(); - implHandleControlResourceProperties - ( aControlAny, aDialogName, aCtrlName, xStringResourceManager, - xSourceStringResolver, MOVE_RESOURCES ); -} - -void LocalizationMgr::copyResourceForDroppedDialog( Reference< container::XNameContainer > xDialogModel, - const ::rtl::OUString& aDialogName, Reference< XStringResourceManager > xStringResourceManager, - Reference< XStringResourceResolver > xSourceStringResolver ) -{ - if( !xStringResourceManager.is() ) - return; - - // Dialog as control - ::rtl::OUString aDummyName; - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - implHandleControlResourceProperties( aDialogCtrl, aDialogName, - aDummyName, xStringResourceManager, xSourceStringResolver, MOVE_RESOURCES ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDialogName, - aCtrlName, xStringResourceManager, xSourceStringResolver, MOVE_RESOURCES ); - } -} - -void LocalizationMgr::copyResourceForDialog( - const Reference< container::XNameContainer >& xDialogModel, - const Reference< XStringResourceResolver >& xSourceStringResolver, - const Reference< XStringResourceManager >& xTargetStringResourceManager ) -{ - if( !xDialogModel.is() || !xSourceStringResolver.is() || !xTargetStringResourceManager.is() ) - return; - - ::rtl::OUString aDummyName; - Any aDialogCtrl; - aDialogCtrl <<= xDialogModel; - implHandleControlResourceProperties - ( aDialogCtrl, aDummyName, aDummyName, xTargetStringResourceManager, - xSourceStringResolver, COPY_RESOURCES ); - - // Handle all controls - Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - for( sal_Int32 i = 0 ; i < nCtrls ; ++i ) - { - ::rtl::OUString aCtrlName( pNames[i] ); - Any aCtrl = xDialogModel->getByName( aCtrlName ); - implHandleControlResourceProperties( aCtrl, aDummyName, aDummyName, - xTargetStringResourceManager, xSourceStringResolver, COPY_RESOURCES ); - } -} - -Reference< XStringResourceManager > LocalizationMgr::getStringResourceFromDialogLibrary - ( Reference< container::XNameContainer > xDialogLib ) -{ - Reference< XStringResourceManager > xStringResourceManager; - if( xDialogLib.is() ) - { - Reference< resource::XStringResourceSupplier > xStringResourceSupplier( xDialogLib, UNO_QUERY ); - if( xStringResourceSupplier.is() ) - { - Reference< resource::XStringResourceResolver > - xStringResourceResolver = xStringResourceSupplier->getStringResource(); - - xStringResourceManager = - Reference< resource::XStringResourceManager >( xStringResourceResolver, UNO_QUERY ); - } - } - return xStringResourceManager; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx deleted file mode 100644 index b2a11d1c9..000000000 --- a/basctl/source/basicide/macrodlg.cxx +++ /dev/null @@ -1,910 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include - - -#include -#include -#include -#include -#include // ID's fuer Imagese -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include -using ::std::map; -using ::std::pair; - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -MacroChooser::MacroChooser( Window* pParnt, sal_Bool bCreateEntries ) : - SfxModalDialog( pParnt, IDEResId( RID_MACROCHOOSER ) ), - aMacroNameTxt( this, IDEResId( RID_TXT_MACRONAME ) ), - aMacroNameEdit( this, IDEResId( RID_ED_MACRONAME ) ), - aMacroFromTxT( this, IDEResId( RID_TXT_MACROFROM ) ), - aMacrosSaveInTxt( this, IDEResId( RID_TXT_SAVEMACRO ) ), - aBasicBox( this, IDEResId( RID_CTRL_LIB ) ), - aMacrosInTxt( this, IDEResId( RID_TXT_MACROSIN ) ), - aMacroBox( this, IDEResId( RID_CTRL_MACRO ) ), - aRunButton( this, IDEResId( RID_PB_RUN ) ), - aCloseButton( this, IDEResId( RID_PB_CLOSE ) ), - aAssignButton( this, IDEResId( RID_PB_ASSIGN ) ), - aEditButton( this, IDEResId( RID_PB_EDIT ) ), - aNewDelButton( this, IDEResId( RID_PB_DEL ) ), - aOrganizeButton( this, IDEResId( RID_PB_ORG ) ), - aHelpButton( this, IDEResId( RID_PB_HELP ) ), - aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) ), - aNewModButton( this, IDEResId( RID_PB_NEWMOD ) ) -{ - FreeResource(); - - nMode = MACROCHOOSER_ALL; - bNewDelIsDel = sal_True; - - // Der Sfx fragt den BasicManager nicht, ob modified - // => Speichern anschmeissen, wenn Aenderung, aber kein Sprung in - // die BasicIDE. - bForceStoreBasic = sal_False; - - aMacrosInTxtBaseStr = aMacrosInTxt.GetText(); - - aMacroBox.SetSelectionMode( SINGLE_SELECTION ); - aMacroBox.SetHighlightRange(); // ueber ganze Breite selektieren - - aRunButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aCloseButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aAssignButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aEditButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aNewDelButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aOrganizeButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - - // Buttons only for MACROCHOOSER_RECORDING - aNewLibButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aNewModButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) ); - aNewLibButton.Hide(); // default - aNewModButton.Hide(); // default - aMacrosSaveInTxt.Hide(); // default - - aMacrosInTxt.SetStyle( WB_NOMULTILINE | WB_PATHELLIPSIS ); - - aMacroNameEdit.SetModifyHdl( LINK( this, MacroChooser, EditModifyHdl ) ); - - aBasicBox.SetSelectHdl( LINK( this, MacroChooser, BasicSelectHdl ) ); - - aMacroBox.SetDoubleClickHdl( LINK( this, MacroChooser, MacroDoubleClickHdl ) ); - aMacroBox.SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) ); - - aBasicBox.SetMode( BROWSEMODE_MODULES ); - aBasicBox.SetStyle( WB_TABSTOP | WB_BORDER | - WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } - - if ( bCreateEntries ) - aBasicBox.ScanAllEntries(); -} - -MacroChooser::~MacroChooser() -{ - if ( bForceStoreBasic ) - SFX_APP()->SaveBasicAndDialogContainer(); -} - -void MacroChooser::StoreMacroDescription() -{ - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) ); - String aMethodName; - SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); - if ( pEntry ) - aMethodName = aMacroBox.GetEntryText( pEntry ); - else - aMethodName = aMacroNameEdit.GetText(); - if ( aMethodName.Len() ) - { - aDesc.SetMethodName( aMethodName ); - aDesc.SetType( OBJ_TYPE_METHOD ); - } - - BasicIDEData* pData = IDE_DLL()->GetExtraData(); - if ( pData ) - pData->SetLastEntryDescriptor( aDesc ); -} - -void MacroChooser::RestoreMacroDescription() -{ - BasicEntryDescriptor aDesc; - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - { - IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow(); - if ( pCurWin ) - aDesc = pCurWin->CreateEntryDescriptor(); - } - else - { - BasicIDEData* pData = IDE_DLL()->GetExtraData(); - if ( pData ) - aDesc = pData->GetLastEntryDescriptor(); - } - - aBasicBox.SetCurrentEntry( aDesc ); - - String aLastMacro( aDesc.GetMethodName() ); - if ( aLastMacro.Len() ) - { - // find entry in macro box - SvLBoxEntry* pEntry = 0; - sal_uLong nPos = 0; - SvLBoxEntry* pE = aMacroBox.GetEntry( nPos ); - while ( pE ) - { - if ( aMacroBox.GetEntryText( pE ) == aLastMacro ) - { - pEntry = pE; - break; - } - pE = aMacroBox.GetEntry( ++nPos ); - } - - if ( pEntry ) - aMacroBox.SetCurEntry( pEntry ); - else - { - aMacroNameEdit.SetText( aLastMacro ); - aMacroNameEdit.SetSelection( Selection( 0, 0 ) ); - } - } -} - -short MacroChooser::Execute() -{ - RestoreMacroDescription(); - aRunButton.GrabFocus(); - - // #104198 Check if "wrong" document is active - SvLBoxEntry* pSelectedEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pSelectedEntry ) ); - const ScriptDocument& rSelectedDoc( aDesc.GetDocument() ); - - // App Basic is always ok, so only check if shell was found - if( rSelectedDoc.isDocument() && !rSelectedDoc.isActive() ) - { - // Search for the right entry - sal_uLong nRootPos = 0; - SvLBoxEntry* pRootEntry = aBasicBox.GetEntry( nRootPos ); - while( pRootEntry ) - { - BasicEntryDescriptor aCmpDesc( aBasicBox.GetEntryDescriptor( pRootEntry ) ); - const ScriptDocument& rCmpDoc( aCmpDesc.GetDocument() ); - if ( rCmpDoc.isDocument() && rCmpDoc.isActive() ) - { - SvLBoxEntry* pEntry = pRootEntry; - SvLBoxEntry* pLastValid = pEntry; - while ( pEntry ) - { - pLastValid = pEntry; - pEntry = aBasicBox.FirstChild( pEntry ); - } - if( pLastValid ) - aBasicBox.SetCurEntry( pLastValid ); - } - pRootEntry = aBasicBox.GetEntry( ++nRootPos ); - } - } - - CheckButtons(); - UpdateFields(); - - if ( StarBASIC::IsRunning() ) - aCloseButton.GrabFocus(); - - Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = ModalDialog::Execute(); - // #57314# Wenn die BasicIDE aktiviert wurde, dann nicht den DefModalDialogParent auf das inaktive Dokument zuruecksetzen. - if ( Application::GetDefDialogParent() == this ) - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; -} - - -void MacroChooser::EnableButton( Button& rButton, sal_Bool bEnable ) -{ - if ( bEnable ) - { - if ( nMode == MACROCHOOSER_CHOOSEONLY || nMode == MACROCHOOSER_RECORDING ) - { - // Nur der RunButton kann enabled werden - if ( &rButton == &aRunButton ) - rButton.Enable(); - else - rButton.Disable(); - } - else - rButton.Enable(); - } - else - rButton.Disable(); -} - - - - -SbMethod* MacroChooser::GetMacro() -{ - SbMethod* pMethod = 0; - SbModule* pModule = aBasicBox.FindModule( aBasicBox.GetCurEntry() ); - if ( pModule ) - { - SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); - if ( pEntry ) - { - String aMacroName( aMacroBox.GetEntryText( pEntry ) ); - pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ); - } - } - return pMethod; -} - - - -void MacroChooser::DeleteMacro() -{ - SbMethod* pMethod = GetMacro(); - DBG_ASSERT( pMethod, "DeleteMacro: Kein Macro !" ); - if ( pMethod && QueryDelMacro( pMethod->GetName(), this ) ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } - - // Aktuelles Doc als geaendert markieren: - StarBASIC* pBasic = BasicIDE::FindBasic( pMethod ); - DBG_ASSERT( pBasic, "Basic?!" ); - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - DBG_ASSERT( pBasMgr, "BasMgr?" ); - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - if ( aDocument.isDocument() ) // Muss ja nicht aus einem Document kommen... - { - aDocument.setDocumentModified(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_SAVEDOC ); - } - - SbModule* pModule = pMethod->GetModule(); - DBG_ASSERT( pModule, "DeleteMacro: Kein Modul?!" ); - ::rtl::OUString aSource( pModule->GetSource32() ); - sal_uInt16 nStart, nEnd; - pMethod->GetLineRange( nStart, nEnd ); - pModule->GetMethods()->Remove( pMethod ); - CutLines( aSource, nStart-1, nEnd-nStart+1, sal_True ); - pModule->SetSource32( aSource ); - - // update module in library - String aLibName = pBasic->GetName(); - String aModName = pModule->GetName(); - OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aSource ) ); - - SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); - DBG_ASSERT( pEntry, "DeleteMacro: Entry ?!" ); - aMacroBox.GetModel()->Remove( pEntry ); - bForceStoreBasic = sal_True; - } -} - -SbMethod* MacroChooser::CreateMacro() -{ - SbMethod* pMethod = 0; - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" ); - if ( !aDocument.isAlive() ) - return NULL; - - String aLibName( aDesc.GetLibName() ); - - if ( !aLibName.Len() ) - aLibName = String::CreateFromAscii( "Standard" ); - - aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); - - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - xModLibContainer->loadLibrary( aOULibName ); - Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - xDlgLibContainer->loadLibrary( aOULibName ); - - BasicManager* pBasMgr = aDocument.getBasicManager(); - StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( aLibName ) : 0; - if ( pBasic ) - { - SbModule* pModule = 0; - String aModName( aDesc.GetName() ); - if ( aModName.Len() ) - { - // extract the module name from the string like "Sheet1 (Example1)" - if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) - { - sal_uInt16 nIndex = 0; - aModName = aModName.GetToken( 0, ' ', nIndex ); - } - pModule = pBasic->FindModule( aModName ); - } - else if ( pBasic->GetModules()->Count() ) - pModule = (SbModule*)pBasic->GetModules()->Get( 0 ); - - if ( !pModule ) - { - pModule = createModImpl( static_cast( this ), - aDocument, aBasicBox, aLibName, aModName ); - } - - String aSubName = aMacroNameEdit.GetText(); - DBG_ASSERT( !pModule || !pModule->GetMethods()->Find( aSubName, SbxCLASS_METHOD ), "Macro existiert schon!" ); - pMethod = pModule ? BasicIDE::CreateMacro( pModule, aSubName ) : NULL; - } - - return pMethod; -} - -void MacroChooser::SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry ) -{ - // Durch das Highlight wird das Edit sonst platt gemacht: - - String aSaveText( aMacroNameEdit.GetText() ); - Selection aCurSel( aMacroNameEdit.GetSelection() ); - - rBox.SetCurEntry( pEntry ); - aMacroNameEdit.SetText( aSaveText ); - aMacroNameEdit.SetSelection( aCurSel ); -} - -void MacroChooser::CheckButtons() -{ - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - SvLBoxEntry* pMacroEntry = aMacroBox.FirstSelected(); - SbMethod* pMethod = GetMacro(); - - // check, if corresponding libraries are readonly - sal_Bool bReadOnly = sal_False; - sal_uInt16 nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0; - if ( nDepth == 1 || nDepth == 2 ) - { - ScriptDocument aDocument( aDesc.GetDocument() ); - ::rtl::OUString aOULibName( aDesc.GetLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) - { - bReadOnly = sal_True; - } - } - - if ( nMode != MACROCHOOSER_RECORDING ) - { - // Run... - sal_Bool bEnable = pMethod ? sal_True : sal_False; - if ( ( nMode != MACROCHOOSER_CHOOSEONLY ) && StarBASIC::IsRunning() ) - bEnable = sal_False; - EnableButton( aRunButton, bEnable ); - } - - // Organisieren immer moeglich ? - - // Assign... - EnableButton( aAssignButton, pMethod ? sal_True : sal_False ); - - // Edit... - EnableButton( aEditButton, pMacroEntry ? sal_True : sal_False ); - - // aOrganizeButton - EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL )); - - // aNewDelButton.... - bool bProtected = aBasicBox.IsEntryProtected( pCurEntry ); - bool bShare = ( aDesc.GetLocation() == LIBRARY_LOCATION_SHARE ); - EnableButton( aNewDelButton, - !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !bProtected && !bReadOnly && !bShare ); - sal_Bool bPrev = bNewDelIsDel; - bNewDelIsDel = pMethod ? sal_True : sal_False; - if ( ( bPrev != bNewDelIsDel ) && ( nMode == MACROCHOOSER_ALL ) ) - { - String aBtnText( bNewDelIsDel ? IDEResId( RID_STR_BTNDEL) : IDEResId( RID_STR_BTNNEW ) ); - aNewDelButton.SetText( aBtnText ); - } - - if ( nMode == MACROCHOOSER_RECORDING ) - { - // save button - if ( !bProtected && !bReadOnly && !bShare ) - aRunButton.Enable(); - else - aRunButton.Disable(); - - // new library button - if ( !bShare ) - aNewLibButton.Enable(); - else - aNewLibButton.Disable(); - - // new module button - if ( !bProtected && !bReadOnly && !bShare ) - aNewModButton.Enable(); - else - aNewModButton.Disable(); - } -} - - - -IMPL_LINK_INLINE_START( MacroChooser, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) -{ - StoreMacroDescription(); - if ( nMode == MACROCHOOSER_RECORDING ) - { - SbMethod* pMethod = GetMacro(); - if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) ) - return 0; - } - - EndDialog( MACRO_OK_RUN ); - return 0; -} -IMPL_LINK_INLINE_END( MacroChooser, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) - -IMPL_LINK( MacroChooser, MacroSelectHdl, SvTreeListBox *, pBox ) -{ - // Wird auch gerufen, wenn Deselektiert! - // 2 Funktionsaufrufe in jedem SelectHdl, nur weil Olli - // keinen separatren DeselctHdl einfuehren wollte: - // Also: Feststellen, ob Select oder Deselect: - if ( pBox->IsSelected( pBox->GetHdlEntry() ) ) - { - UpdateFields(); - CheckButtons(); - } - return 0; -} - -IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox ) -{ - static String aSpaceStr = String::CreateFromAscii(" "); - - // Wird auch gerufen, wenn Deselektiert! - // 2 Funktionsaufrufe in jedem SelectHdl, nur weil Olli - // keinen separatren DeselctHdl einfuehren wollte: - // Also: Feststellen, ob Select oder Deselect: - if ( !pBox->IsSelected( pBox->GetHdlEntry() ) ) - return 0; - - SbModule* pModule = aBasicBox.FindModule( aBasicBox.GetCurEntry() ); - - aMacroBox.Clear(); - if ( pModule ) - { - String aStr = aMacrosInTxtBaseStr; - aStr += aSpaceStr; - aStr += pModule->GetName(); - - aMacrosInTxt.SetText( aStr ); - - // Die Macros sollen in der Reihenfolge angezeigt werden, - // wie sie im Modul stehen. - - map< sal_uInt16, SbMethod* > aMacros; - size_t nMacroCount = pModule->GetMethods()->Count(); - for ( size_t iMeth = 0; iMeth < nMacroCount; iMeth++ ) - { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( iMeth ); - if( pMethod->IsHidden() ) - continue; - DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); - // Eventuell weiter vorne ? - sal_uInt16 nStart, nEnd; - pMethod->GetLineRange( nStart, nEnd ); - aMacros.insert( map< sal_uInt16, SbMethod*>::value_type( nStart, pMethod ) ); - } - - aMacroBox.SetUpdateMode( sal_False ); - for ( map< sal_uInt16, SbMethod* >::iterator it = aMacros.begin(); it != aMacros.end(); ++it ) - aMacroBox.InsertEntry( (*it).second->GetName() ); - aMacroBox.SetUpdateMode( sal_True ); - - if ( aMacroBox.GetEntryCount() ) - { - SvLBoxEntry* pEntry = aMacroBox.GetEntry( 0 ); - DBG_ASSERT( pEntry, "Entry ?!" ); - aMacroBox.SetCurEntry( pEntry ); - } - } - - UpdateFields(); - CheckButtons(); - return 0; -} - - - -IMPL_LINK( MacroChooser, EditModifyHdl, Edit *, pEdit ) -{ - (void)pEdit; - - // Das Modul, in dem bei Neu das Macro landet, selektieren, - // wenn BasicManager oder Lib selektiert. - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - if ( pCurEntry ) - { - sal_uInt16 nDepth = aBasicBox.GetModel()->GetDepth( pCurEntry ); - if ( ( nDepth == 1 ) && ( aBasicBox.IsEntryProtected( pCurEntry ) ) ) - { - // Dann auf die entsprechende Std-Lib stellen... - SvLBoxEntry* pManagerEntry = aBasicBox.GetModel()->GetParent( pCurEntry ); - pCurEntry = aBasicBox.GetModel()->FirstChild( pManagerEntry ); - } - if ( nDepth < 2 ) - { - SvLBoxEntry* pNewEntry = pCurEntry; - while ( pCurEntry && ( nDepth < 2 ) ) - { - pCurEntry = aBasicBox.FirstChild( pCurEntry ); - if ( pCurEntry ) - { - pNewEntry = pCurEntry; - nDepth = aBasicBox.GetModel()->GetDepth( pCurEntry ); - } - } - SaveSetCurEntry( aBasicBox, pNewEntry ); - } - if ( aMacroBox.GetEntryCount() ) - { - String aEdtText( aMacroNameEdit.GetText() ); - sal_Bool bFound = sal_False; - for ( sal_uInt16 n = 0; n < aMacroBox.GetEntryCount(); n++ ) - { - SvLBoxEntry* pEntry = aMacroBox.GetEntry( n ); - DBG_ASSERT( pEntry, "Entry ?!" ); - if ( aMacroBox.GetEntryText( pEntry ).CompareIgnoreCaseToAscii( aEdtText ) == COMPARE_EQUAL ) - { - SaveSetCurEntry( aMacroBox, pEntry ); - bFound = sal_True; - break; - } - } - if ( !bFound ) - { - SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); - // Wenn es den Eintrag gibt ->Select ->Desription... - if ( pEntry ) - aMacroBox.Select( pEntry, sal_False ); - } - } - } - - CheckButtons(); - return 0; -} - - - -IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) -{ - // ausser bei New/Record wird die Description durch LoseFocus uebernommen. - if ( pButton == &aRunButton ) - { - StoreMacroDescription(); - - // #116444# check security settings before macro execution - if ( nMode == MACROCHOOSER_ALL ) - { - SbMethod* pMethod = GetMacro(); - SbModule* pModule = pMethod ? pMethod->GetModule() : NULL; - StarBASIC* pBasic = pModule ? (StarBASIC*)pModule->GetParent() : NULL; - BasicManager* pBasMgr = pBasic ? BasicIDE::FindBasicManager( pBasic ) : NULL; - if ( pBasMgr ) - { - ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - if ( aDocument.isDocument() && !aDocument.allowMacros() ) - { - WarningBox( this, WB_OK, String( IDEResId( RID_STR_CANNOTRUNMACRO ) ) ).Execute(); - return 0; - } - } - } - else if ( nMode == MACROCHOOSER_RECORDING ) - { - sal_Bool bValid = BasicIDE::IsValidSbxName( aMacroNameEdit.GetText() ); - if ( !bValid ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) ); - aMacroNameEdit.GrabFocus(); - return 0; - } - - SbMethod* pMethod = GetMacro(); - if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) ) - return 0; - } - - EndDialog( MACRO_OK_RUN ); - } - else if ( pButton == &aCloseButton ) - { - StoreMacroDescription(); - EndDialog( MACRO_CLOSE ); - } - else if ( ( pButton == &aEditButton ) || ( pButton == &aNewDelButton ) ) - { - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); - if ( !aDocument.isAlive() ) - return 0; - BasicManager* pBasMgr = aDocument.getBasicManager(); - String aLib( aDesc.GetLibName() ); - String aMod( aDesc.GetName() ); - // extract the module name from the string like "Sheet1 (Example1)" - if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) - { - sal_uInt16 nIndex = 0; - aMod = aMod.GetToken( 0, ' ', nIndex ); - } - String aSub( aDesc.GetMethodName() ); - SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() ); - if ( pButton == &aEditButton ) - { - SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); - if ( pEntry ) - aInfoItem.SetMethod( aMacroBox.GetEntryText( pEntry ) ); - StoreMacroDescription(); - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); - EndDialog( MACRO_EDIT ); - } - else - { - if ( bNewDelIsDel ) - { - DeleteMacro(); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_UPDATEMODULESOURCE, - SFX_CALLMODE_SYNCHRON, &aInfoItem, 0L ); - } - CheckButtons(); - UpdateFields(); - //if ( aMacroBox.GetCurEntry() ) // OV-Bug ? - // aMacroBox.Select( aMacroBox.GetCurEntry() ); - } - else - { - sal_Bool bValid = BasicIDE::IsValidSbxName( aMacroNameEdit.GetText() ); - if ( !bValid ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) ); - aMacroNameEdit.GrabFocus(); - return 1; - } - SbMethod* pMethod = CreateMacro(); - if ( pMethod ) - { - aInfoItem.SetMethod( pMethod->GetName() ); - aInfoItem.SetModule( pMethod->GetModule()->GetName() ); - aInfoItem.SetLib( pMethod->GetModule()->GetParent()->GetName() ); - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); - StoreMacroDescription(); - EndDialog( MACRO_NEW ); - } - } - } - } - - else if ( pButton == &aAssignButton ) - { - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); - if ( !aDocument.isAlive() ) - return 0; - BasicManager* pBasMgr = aDocument.getBasicManager(); - String aLib( aDesc.GetLibName() ); - String aMod( aDesc.GetName() ); - String aSub( aMacroNameEdit.GetText() ); - SbMethod* pMethod = GetMacro(); - DBG_ASSERT( pBasMgr, "BasMgr?" ); - DBG_ASSERT( pMethod, "Method?" ); - String aComment( GetInfo( pMethod ) ); - SfxMacroInfoItem aItem( SID_MACROINFO, pBasMgr, aLib, aMod, aSub, aComment ); - SfxAllItemSet Args( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_CONFIG, SFX_CALLMODE_SYNCHRON, Args ); - aRequest.AppendItem( aItem ); - SFX_APP()->ExecuteSlot( aRequest ); - } - else if ( pButton == &aNewLibButton ) - { - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - createLibImpl( static_cast( this ), aDocument, NULL, &aBasicBox ); - } - else if ( pButton == &aNewModButton ) - { - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - String aLibName( aDesc.GetLibName() ); - String aModName; - createModImpl( static_cast( this ), aDocument, - aBasicBox, aLibName, aModName, true ); - } - else if ( pButton == &aOrganizeButton ) - { - StoreMacroDescription(); - - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) ); - OrganizeDialog* pDlg = new OrganizeDialog( this, 0, aDesc ); - sal_uInt16 nRet = pDlg->Execute(); - delete pDlg; - - if ( nRet ) // Nicht einfach nur geschlossen - { - EndDialog( MACRO_EDIT ); - return 0; - } - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell && pIDEShell->IsAppBasicModified() ) - bForceStoreBasic = sal_True; - - aBasicBox.UpdateEntries(); - } - return 0; -} - - - -void MacroChooser::UpdateFields() -{ - SvLBoxEntry* pMacroEntry = aMacroBox.GetCurEntry(); - String aEmptyStr; - - aMacroNameEdit.SetText( aEmptyStr ); - if ( pMacroEntry ) - aMacroNameEdit.SetText( aMacroBox.GetEntryText( pMacroEntry ) ); -} - -void MacroChooser::SetMode( sal_uInt16 nM ) -{ - nMode = nM; - if ( nMode == MACROCHOOSER_ALL ) - { - aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) ); - EnableButton( aNewDelButton, sal_True ); - EnableButton( aOrganizeButton, sal_True ); - } - else if ( nMode == MACROCHOOSER_CHOOSEONLY ) - { - aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) ); - EnableButton( aNewDelButton, sal_False ); - EnableButton( aOrganizeButton, sal_False ); - } - else if ( nMode == MACROCHOOSER_RECORDING ) - { - aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) ); - EnableButton( aNewDelButton, sal_False ); - EnableButton( aOrganizeButton, sal_False ); - - aAssignButton.Hide(); - aEditButton.Hide(); - aNewDelButton.Hide(); - aOrganizeButton.Hide(); - aMacroFromTxT.Hide(); - - aNewLibButton.Show(); - aNewModButton.Show(); - aMacrosSaveInTxt.Show(); - - Point aHelpPos = aHelpButton.GetPosPixel(); - Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) ); - aHelpPosLogic.Y() -= 34; - aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) ); - aHelpButton.SetPosPixel( aHelpPos ); - } - CheckButtons(); -} - -String MacroChooser::GetInfo( SbxVariable* pVar ) -{ - String aComment; - SbxInfoRef xInfo = pVar->GetInfo(); - if ( xInfo.Is() ) - aComment = xInfo->GetComment(); - return aComment; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/macrodlg.hrc b/basctl/source/basicide/macrodlg.hrc deleted file mode 100644 index e209ae060..000000000 --- a/basctl/source/basicide/macrodlg.hrc +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MACRODLG_HRC -#define _MACRODLG_HRC - -#include - -#define RID_MACROCHOOSER ( RID_BASICIDE_START + 50 ) -#define RID_STR_BTNDEL ( RID_BASICIDE_START + 51 ) -#define RID_STR_BTNNEW ( RID_BASICIDE_START + 52 ) -#define RID_STR_CHOOSE ( RID_BASICIDE_START + 53 ) -#define RID_STR_RUN ( RID_BASICIDE_START + 54 ) -#define RID_STR_RECORD ( RID_BASICIDE_START + 56 ) - -#define RID_CTRL_MACRO 1 -#define RID_CTRL_LIB 2 -#define RID_TXT_MACRONAME 3 -#define RID_TXT_MACROFROM 4 -#define RID_ED_MACRONAME 5 -#define RID_TXT_DESCRIPTION 6 -#define RID_PB_RUN 8 -#define RID_PB_CLOSE 9 -#define RID_PB_EDIT 10 -#define RID_PB_ORG 11 -#define RID_PB_DEL 12 -#define RID_PB_ASSIGN 13 -#define RID_PB_HELP 15 -#define RID_ML_DESCRIPTION 16 -#define RID_TXT_MACROSIN 17 -#define RID_TXT_SAVEMACRO 18 -#define RID_PB_NEWLIB 19 -#define RID_PB_NEWMOD 20 - -#endif // _MACRODLG_HRC - diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx deleted file mode 100644 index 3934dca52..000000000 --- a/basctl/source/basicide/macrodlg.hxx +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// -#ifndef _MACRODLG_HXX -#define _MACRODLG_HXX - -#include - -#include -#include -#include -#include - -#include - -#define MACRO_CLOSE 10 -#define MACRO_OK_RUN 11 -#define MACRO_NEW 12 -#define MACRO_EDIT 14 -#define MACRO_ORGANIZE 15 -#define MACRO_ASSIGN 16 - -#define MACROCHOOSER_ALL 1 -#define MACROCHOOSER_CHOOSEONLY 2 -#define MACROCHOOSER_RECORDING 3 - -class BasicManager; - -class MacroChooser : public SfxModalDialog -{ -private: - FixedText aMacroNameTxt; - Edit aMacroNameEdit; - FixedText aMacroFromTxT; - FixedText aMacrosSaveInTxt; - BasicTreeListBox aBasicBox; - FixedText aMacrosInTxt; - String aMacrosInTxtBaseStr; - SvTreeListBox aMacroBox; - - PushButton aRunButton; - CancelButton aCloseButton; - PushButton aAssignButton; - PushButton aEditButton; - PushButton aNewDelButton; - PushButton aOrganizeButton; - HelpButton aHelpButton; - PushButton aNewLibButton; - PushButton aNewModButton; - - sal_Bool bNewDelIsDel; - sal_Bool bForceStoreBasic; - - sal_uInt16 nMode; - - DECL_LINK( MacroSelectHdl, SvTreeListBox * ); - DECL_LINK( MacroDoubleClickHdl, SvTreeListBox * ); - DECL_LINK( BasicSelectHdl, SvTreeListBox * ); - DECL_LINK( EditModifyHdl, Edit * ); - DECL_LINK( ButtonHdl, Button * ); - - void CheckButtons(); - void SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry ); - void UpdateFields(); - - void EnableButton( Button& rButton, sal_Bool bEnable ); - - String GetInfo( SbxVariable* pVar ); - - void StoreMacroDescription(); - void RestoreMacroDescription(); - -public: - MacroChooser( Window* pParent, sal_Bool bCreateEntries = sal_True ); - ~MacroChooser(); - - SbMethod* GetMacro(); - void DeleteMacro(); - SbMethod* CreateMacro(); - - virtual short Execute(); - - void SetMode( sal_uInt16 nMode ); - sal_uInt16 GetMode() const { return nMode; } -}; - -#endif // _MACRODLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/macrodlg.src b/basctl/source/basicide/macrodlg.src deleted file mode 100644 index 5201da429..000000000 --- a/basctl/source/basicide/macrodlg.src +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -ModalDialog RID_MACROCHOOSER -{ - HelpId = "basctl:ModalDialog:RID_MACROCHOOSER" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 287 , 165 ) ; - Text [ en-US ] = "%PRODUCTNAME Basic Macros" ; - Moveable = TRUE ; - // Closeable = TRUE; - - FixedText RID_TXT_MACROSIN - { - Pos = MAP_APPFONT ( 122 , 30 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "Existing macros ~in:"; - }; - Control RID_CTRL_MACRO - { - HelpID = HID_BASICIDE_MACROS ; - Border = TRUE ; - Pos = MAP_APPFONT ( 122 , 41 ) ; - Size = MAP_APPFONT ( 100 , 117 ) ; - // Size = MAP_APPFONT ( 100 , 117 ) ; - TabStop = TRUE ; - }; - Control RID_CTRL_LIB - { - HelpID = HID_BASICIDE_LIBS ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 41 ) ; - Size = MAP_APPFONT ( 110 , 117 ) ; - TabStop = TRUE ; - }; - FixedText RID_TXT_MACRONAME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Macro name" ; - }; - Edit RID_ED_MACRONAME - { - HelpID = "basctl:Edit:RID_MACROCHOOSER:RID_ED_MACRONAME"; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 110 , 12 ) ; - TabStop = TRUE ; - }; - FixedText RID_TXT_MACROFROM - { - Pos = MAP_APPFONT ( 6 , 30 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "Macro ~from" ; - }; - FixedText RID_TXT_SAVEMACRO - { - Pos = MAP_APPFONT ( 6 , 30 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "Save m~acro in"; - }; - - FixedText RID_TXT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 117 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "De~scription" ; - }; - PushButton RID_PB_RUN - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_RUN"; - Pos = MAP_APPFONT ( 231 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - Text [ en-US ] = "R~un" ; - TabStop = TRUE ; - }; - CancelButton RID_PB_CLOSE - { - Pos = MAP_APPFONT ( 231 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Close"; - }; - - PushButton RID_PB_ASSIGN - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_ASSIGN"; - Pos = MAP_APPFONT ( 231 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Assign..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_EDIT - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_EDIT"; - Size = MAP_APPFONT ( 50 , 14 ) ; - Pos = MAP_APPFONT ( 231 , 77 ) ; - Text [ en-US ] = "~Edit" ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEWLIB - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_NEWLIB"; - Pos = MAP_APPFONT ( 231 , 60 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "New ~Library"; - }; - PushButton RID_PB_NEWMOD - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_NEWMOD"; - Size = MAP_APPFONT ( 50 , 14 ) ; - Pos = MAP_APPFONT ( 231 , 77 ) ; - Text [ en-US ] = "New M~odule"; - }; - PushButton RID_PB_DEL - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_DEL"; - Pos = MAP_APPFONT ( 231 , 94 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - }; - PushButton RID_PB_ORG - { - HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_ORG"; - Pos = MAP_APPFONT ( 231 , 114 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Organizer..." ; - }; - HelpButton RID_PB_HELP - { - Pos = MAP_APPFONT ( 231 , 131 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - MultiLineEdit RID_ML_DESCRIPTION - { - HelpID = "basctl:MultiLineEdit:RID_MACROCHOOSER:RID_ML_DESCRIPTION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 131 ) ; - Size = MAP_APPFONT ( 216 , 28 ) ; - TabStop = TRUE ; - VScroll = TRUE ; - IgnoreTab = TRUE ; - }; -}; -String RID_STR_STDMACRONAME -{ - Text [ en-US ] = "Macro" ; -}; -String RID_STR_BTNDEL -{ - Text [ en-US ] = "~Delete" ; -}; -String RID_STR_BTNNEW -{ - Text [ en-US ] = "~New" ; -}; -String RID_STR_CLOSE -{ - Text [ en-US ] = "Close" ; -}; -String RID_STR_CHOOSE -{ - Text [ en-US ] = "Choose" ; -}; -String RID_STR_RUN -{ - Text [ en-US ] = "Run" ; -}; - -String RID_STR_RECORD -{ - Text [ en-US ] = "~Save" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx deleted file mode 100644 index f1759d633..000000000 --- a/basctl/source/basicide/moduldl2.cxx +++ /dev/null @@ -1,1706 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#define GLOBALOVERFLOW - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rtl/uri.hxx" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include -#include "com/sun/star/packages/manifest/XManifestWriter.hpp" -#include -#include - -#include -#include - -using namespace ::comphelper; -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::ucb; -using namespace ::com::sun::star::ui::dialogs; - - -typedef ::cppu::WeakImplHelper1< task::XInteractionHandler > HandlerImpl_BASE; - -class DummyInteractionHandler : public HandlerImpl_BASE -{ - Reference< task::XInteractionHandler > m_xHandler; -public: - DummyInteractionHandler( const Reference< task::XInteractionHandler >& xHandler ) : m_xHandler( xHandler ){} - - virtual void SAL_CALL handle( const Reference< task::XInteractionRequest >& rRequest ) throw (::com::sun::star::uno::RuntimeException) - { - if ( m_xHandler.is() ) - { - script::ModuleSizeExceededRequest aModSizeException; - if ( rRequest->getRequest() >>= aModSizeException ) - m_xHandler->handle( rRequest ); - } - } -}; - -//---------------------------------------------------------------------------- -// BasicLibUserData -//---------------------------------------------------------------------------- -class BasicLibUserData -{ -private: - ScriptDocument m_aDocument; - -public: - BasicLibUserData( const ScriptDocument& rDocument ) : m_aDocument( rDocument ) { } - virtual ~BasicLibUserData() {}; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } -}; - - -//---------------------------------------------------------------------------- -// BasicLibLBoxString -//---------------------------------------------------------------------------- - -class BasicLibLBoxString : public SvLBoxString -{ -public: - BasicLibLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) : - SvLBoxString( pEntry, nFlags, rTxt ) {} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); -}; - -//---------------------------------------------------------------------------- - -void BasicLibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry ) -{ - // Change text color if library is read only: - bool bReadOnly = false; - if (pEntry && pEntry->GetUserData()) - { - ScriptDocument aDocument( - static_cast< BasicLibUserData * >(pEntry->GetUserData())-> - GetDocument() ); - - rtl::OUString aLibName( - static_cast< SvLBoxString * >(pEntry->GetItem(1))->GetText()); - Reference< script::XLibraryContainer2 > xModLibContainer( - aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY); - Reference< script::XLibraryContainer2 > xDlgLibContainer( - aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY); - bReadOnly - = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) - && xModLibContainer->isLibraryReadOnly(aLibName)) - || (xDlgLibContainer.is() && xDlgLibContainer->hasByName(aLibName) - && xDlgLibContainer->isLibraryReadOnly(aLibName)); - } - if (bReadOnly) - rDev.DrawCtrlText(rPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE); - else - rDev.DrawText(rPos, GetText()); -} - - -//---------------------------------------------------------------------------- -// BasicCheckBox -//---------------------------------------------------------------------------- - -BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId ) - :SvTabListBox( pParent, rResId ) - ,m_aDocument( ScriptDocument::getApplicationScriptDocument() ) -{ - nMode = LIBMODE_MANAGER; - long aTabs_[] = { 1, 12 }; // Mindestens einen braucht die TabPos... - // 12 wegen der Checkbox - SetTabs( aTabs_ ); - Init(); -} - -//---------------------------------------------------------------------------- - -BasicCheckBox::~BasicCheckBox() -{ - delete pCheckButton; - - // delete user data - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - delete (BasicLibUserData*)pEntry->GetUserData(); - pEntry = Next( pEntry ); - } -} - -//---------------------------------------------------------------------------- - -void BasicCheckBox::Init() -{ - pCheckButton = new SvLBoxButtonData(this); - - if ( nMode == LIBMODE_CHOOSER ) - EnableCheckButton( pCheckButton ); - else - EnableCheckButton( 0 ); - - SetHighlightRange(); -} - -//---------------------------------------------------------------------------- - -void BasicCheckBox::SetMode( sal_uInt16 n ) -{ - nMode = n; - - if ( nMode == LIBMODE_CHOOSER ) - EnableCheckButton( pCheckButton ); - else - EnableCheckButton( 0 ); -} - -//---------------------------------------------------------------------------- - -SvLBoxEntry* BasicCheckBox::DoInsertEntry( const String& rStr, sal_uLong nPos ) -{ - return SvTabListBox::InsertEntryToColumn( rStr, nPos, 0 ); -} - -//---------------------------------------------------------------------------- - -SvLBoxEntry* BasicCheckBox::FindEntry( const String& rName ) -{ - sal_uLong nCount = GetEntryCount(); - for ( sal_uLong i = 0; i < nCount; i++ ) - { - SvLBoxEntry* pEntry = GetEntry( i ); - DBG_ASSERT( pEntry, "pEntry?!" ); - if ( rName.CompareIgnoreCaseToAscii( GetEntryText( pEntry, 0 ) ) == COMPARE_EQUAL ) - return pEntry; - } - return 0; -} - -//---------------------------------------------------------------------------- - -void BasicCheckBox::CheckEntryPos( sal_uLong nPos, sal_Bool bCheck ) -{ - if ( nPos < GetEntryCount() ) - { - SvLBoxEntry* pEntry = GetEntry( nPos ); - - if ( bCheck != GetCheckButtonState( pEntry ) ) - SetCheckButtonState( pEntry, - bCheck - ? SvButtonState(SV_BUTTON_CHECKED) - : SvButtonState(SV_BUTTON_UNCHECKED) ); - } -} - -//---------------------------------------------------------------------------- - -sal_Bool BasicCheckBox::IsChecked( sal_uLong nPos ) const -{ - if ( nPos < GetEntryCount() ) - return (GetCheckButtonState( GetEntry( nPos ) ) == SV_BUTTON_CHECKED); - return sal_False; -} - -//---------------------------------------------------------------------------- - -void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind ) -{ - SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); - - if ( nMode == LIBMODE_MANAGER ) - { - // initialize all columns with own string class (column 0 == bitmap) - sal_uInt16 nCount = pEntry->ItemCount(); - for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol ) - { - SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol ); - BasicLibLBoxString* pStr = new BasicLibLBoxString( pEntry, 0, pCol->GetText() ); - pEntry->ReplaceItem( pStr, nCol ); - } - } -} - -//---------------------------------------------------------------------------- - -sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) -{ - if ( nMode != LIBMODE_MANAGER ) - return sal_False; - - DBG_ASSERT( pEntry, "Kein Eintrag?" ); - - // check, if Standard library - String aLibName = GetEntryText( pEntry, 0 ); - if ( aLibName.EqualsIgnoreCaseAscii( "Standard" ) ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_CANNOTCHANGENAMESTDLIB ) ) ).Execute(); - return sal_False; - } - - // check, if library is readonly - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBISREADONLY ) ) ).Execute(); - return sal_False; - } - - // i24094: Password verification necessary for renaming - sal_Bool bOK = sal_True; - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - // check password - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - String aPassword; - Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY ); - bOK = QueryPassword( xModLibContainer1, aLibName, aPassword ); - } - if ( !bOK ) - return sal_False; - } - - // TODO: check if library is reference/link - - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool BasicCheckBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ) -{ - sal_Bool bValid = ( rNewText.Len() <= 30 ) && BasicIDE::IsValidSbxName( rNewText ); - String aCurText( GetEntryText( pEntry, 0 ) ); - if ( bValid && ( aCurText != rNewText ) ) - { - try - { - ::rtl::OUString aOUOldName( aCurText ); - ::rtl::OUString aOUNewName( rNewText ); - - Reference< script::XLibraryContainer2 > xModLibContainer( m_aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xModLibContainer.is() ) - { - xModLibContainer->renameLibrary( aOUOldName, aOUNewName ); - } - - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( xDlgLibContainer.is() ) - { - xDlgLibContainer->renameLibrary( aOUOldName, aOUNewName ); - } - - BasicIDE::MarkDocumentModified( m_aDocument ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - { - pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); - pBindings->Update( SID_BASICIDE_LIBSELECTOR ); - } - } - catch ( container::ElementExistException& ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) ) ).Execute(); - return sal_False; - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - return sal_False; - } - } - - if ( !bValid ) - { - if ( rNewText.Len() > 30 ) - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBNAMETOLONG ) ) ).Execute(); - else - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - } - - return bValid; -} - -//---------------------------------------------------------------------------- -// NewObjectDialog -//---------------------------------------------------------------------------- - -IMPL_LINK(NewObjectDialog, OkButtonHandler, Button *, EMPTYARG) -{ - if (BasicIDE::IsValidSbxName(aEdit.GetText())) - EndDialog(1); - else - { - ErrorBox(this, WB_OK | WB_DEF_OK, - String(IDEResId(RID_STR_BADSBXNAME))).Execute(); - aEdit.GrabFocus(); - } - return 0; -} - -NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode, - bool bCheckName) - : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ), - aText( this, IDEResId( RID_FT_NEWLIB ) ), - aEdit( this, IDEResId( RID_ED_LIBNAME ) ), - aOKButton( this, IDEResId( RID_PB_OK ) ), - aCancelButton( this, IDEResId( RID_PB_CANCEL ) ) -{ - FreeResource(); - aEdit.GrabFocus(); - - if ( nMode == NEWOBJECTMODE_LIB ) - { - SetText( String( IDEResId( RID_STR_NEWLIB ) ) ); - } - else if ( nMode == NEWOBJECTMODE_MOD ) - { - SetText( String( IDEResId( RID_STR_NEWMOD ) ) ); - } - else if ( nMode == NEWOBJECTMODE_METH ) - { - SetText( String( IDEResId( RID_STR_NEWMETH ) ) ); - } - else - { - SetText( String( IDEResId( RID_STR_NEWDLG ) ) ); - } - - if (bCheckName) - aOKButton.SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler)); -} - -//---------------------------------------------------------------------------- - -NewObjectDialog::~NewObjectDialog() -{ -} - -//---------------------------------------------------------------------------- -// ExportDialog -//---------------------------------------------------------------------------- - -IMPL_LINK(ExportDialog, OkButtonHandler, Button *, EMPTYARG) -{ - mbExportAsPackage = maExportAsPackageButton.IsChecked(); - EndDialog(1); - return 0; -} - -ExportDialog::ExportDialog( Window * pParent ) - : ModalDialog( pParent, IDEResId( RID_DLG_EXPORT ) ), - maExportAsPackageButton( this, IDEResId( RB_EXPORTASPACKAGE ) ), - maExportAsBasicButton( this, IDEResId( RB_EXPORTASBASIC ) ), - maOKButton( this, IDEResId( RID_PB_OK ) ), - maCancelButton( this, IDEResId( RID_PB_CANCEL ) ) -{ - FreeResource(); - maExportAsPackageButton.Check(); - maOKButton.SetClickHdl(LINK(this, ExportDialog, OkButtonHandler)); -} - -//---------------------------------------------------------------------------- - -ExportDialog::~ExportDialog() -{ -} - -//---------------------------------------------------------------------------- -// LibPage -//---------------------------------------------------------------------------- - -LibPage::LibPage( Window * pParent ) - :TabPage( pParent, IDEResId( RID_TP_LIBS ) ) - ,aBasicsText( this, IDEResId( RID_STR_BASICS ) ) - ,aBasicsBox( this, IDEResId( RID_LB_BASICS ) ) - ,aLibText( this, IDEResId( RID_STR_LIB ) ) - ,aLibBox( this, IDEResId( RID_TRLBOX ) ) - ,aEditButton( this, IDEResId( RID_PB_EDIT ) ) - ,aCloseButton( this, IDEResId( RID_PB_CLOSE ) ) - ,aPasswordButton( this, IDEResId( RID_PB_PASSWORD ) ) - ,aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) ) - ,aInsertLibButton( this, IDEResId( RID_PB_APPEND ) ) - ,aExportButton( this, IDEResId( RID_PB_EXPORT ) ) - ,aDelButton( this, IDEResId( RID_PB_DELETE ) ) - ,m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ) - ,m_eCurLocation( LIBRARY_LOCATION_UNKNOWN ) -{ - FreeResource(); - pTabDlg = 0; - - aEditButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aNewLibButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aPasswordButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aExportButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aInsertLibButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aDelButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aCloseButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) ); - aLibBox.SetSelectHdl( LINK( this, LibPage, TreeListHighlightHdl ) ); - - aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) ); - - aLibBox.SetMode( LIBMODE_MANAGER ); - aLibBox.EnableInplaceEditing( sal_True ); - aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP ); - aCloseButton.GrabFocus(); - - long aTabs[] = { 2, 30, 120 }; - aLibBox.SetTabs( aTabs, MAP_PIXEL ); - - FillListBox(); - aBasicsBox.SelectEntryPos( 0 ); - SetCurLib(); - - CheckButtons(); -} - -//---------------------------------------------------------------------------- - -LibPage::~LibPage() -{ - sal_uInt16 nCount = aBasicsBox.GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( i ); - delete pEntry; - } -} - -//---------------------------------------------------------------------------- - -void LibPage::CheckButtons() -{ - SvLBoxEntry* pCur = aLibBox.GetCurEntry(); - if ( pCur ) - { - String aLibName = aLibBox.GetEntryText( pCur, 0 ); - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - - if ( m_eCurLocation == LIBRARY_LOCATION_SHARE ) - { - aPasswordButton.Disable(); - aNewLibButton.Disable(); - aInsertLibButton.Disable(); - aDelButton.Disable(); - } - else if ( aLibName.EqualsIgnoreCaseAscii( "Standard" ) ) - { - aPasswordButton.Disable(); - aNewLibButton.Enable(); - aInsertLibButton.Enable(); - aExportButton.Disable(); - aDelButton.Disable(); - if ( !aLibBox.HasFocus() ) - aCloseButton.GrabFocus(); - } - else if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) - { - aPasswordButton.Disable(); - aNewLibButton.Enable(); - aInsertLibButton.Enable(); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) ) - aDelButton.Disable(); - else - aDelButton.Enable(); - } - else - { - if ( xModLibContainer.is() && !xModLibContainer->hasByName( aOULibName ) ) - aPasswordButton.Disable(); - else - aPasswordButton.Enable(); - - aNewLibButton.Enable(); - aInsertLibButton.Enable(); - aExportButton.Enable(); - aDelButton.Enable(); - } - } -} - -//---------------------------------------------------------------------------- - -void LibPage::ActivatePage() -{ - SetCurLib(); -} - -//---------------------------------------------------------------------------- - - -void LibPage::DeactivatePage() -{ -} - -//---------------------------------------------------------------------------- - - -IMPL_LINK_INLINE_START( LibPage, TreeListHighlightHdl, SvTreeListBox *, pBox ) -{ - if ( pBox->IsSelected( pBox->GetHdlEntry() ) ) - CheckButtons(); - return 0; -} -IMPL_LINK_INLINE_END( LibPage, TreeListHighlightHdl, SvTreeListBox *, pBox ) - -//---------------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( LibPage, BasicSelectHdl, ListBox *, pBox ) -{ - (void)pBox; - SetCurLib(); - CheckButtons(); - return 0; -} -IMPL_LINK_INLINE_END( LibPage, BasicSelectHdl, ListBox *, pBox ) - -//---------------------------------------------------------------------------- - -IMPL_LINK( LibPage, ButtonHdl, Button *, pButton ) -{ - if ( pButton == &aEditButton ) - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - - SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( m_aCurDocument.getDocumentOrNull() ) ); - SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry(); - DBG_ASSERT( pCurEntry, "Entry?!" ); - String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); - SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, - SFX_CALLMODE_ASYNCHRON, &aDocItem, &aLibNameItem, 0L ); - } - EndTabDialog( 1 ); - return 0; - } - else if ( pButton == &aNewLibButton ) - NewLib(); - else if ( pButton == &aInsertLibButton ) - InsertLib(); - else if ( pButton == &aExportButton ) - Export(); - else if ( pButton == &aDelButton ) - DeleteCurrent(); - else if ( pButton == &aCloseButton ) - { - EndTabDialog( 0 ); - return 0; - } - else if ( pButton == &aPasswordButton ) - { - SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry(); - String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); - ::rtl::OUString aOULibName( aLibName ); - - // load module library (if not loaded) - Reference< script::XLibraryContainer > xModLibContainer = m_aCurDocument.getLibraryContainer( E_SCRIPTS ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); - xModLibContainer->loadLibrary( aOULibName ); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); - } - - // load dialog library (if not loaded) - Reference< script::XLibraryContainer > xDlgLibContainer = m_aCurDocument.getLibraryContainer( E_DIALOGS ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); - xDlgLibContainer->loadLibrary( aOULibName ); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); - } - - // check, if library is password protected - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() ) - { - sal_Bool bProtected = xPasswd->isLibraryPasswordProtected( aOULibName ); - - // change password dialog - SvxPasswordDialog* pDlg = new SvxPasswordDialog( this, sal_True, !bProtected ); - pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) ); - - if ( pDlg->Execute() == RET_OK ) - { - sal_Bool bNewProtected = xPasswd->isLibraryPasswordProtected( aOULibName ); - - if ( bNewProtected != bProtected ) - { - sal_uLong nPos = (sal_uLong)aLibBox.GetModel()->GetAbsPos( pCurEntry ); - aLibBox.GetModel()->Remove( pCurEntry ); - ImpInsertLibEntry( aLibName, nPos ); - aLibBox.SetCurEntry( aLibBox.GetEntry( nPos ) ); - } - - BasicIDE::MarkDocumentModified( m_aCurDocument ); - } - delete pDlg; - } - } - } - CheckButtons(); - return 0; -} - -//---------------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg ) -{ - long nRet = 0; - - SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry(); - ::rtl::OUString aOULibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); - Reference< script::XLibraryContainerPassword > xPasswd( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - - if ( xPasswd.is() ) - { - try - { - ::rtl::OUString aOUOldPassword( pDlg->GetOldPassword() ); - ::rtl::OUString aOUNewPassword( pDlg->GetNewPassword() ); - xPasswd->changeLibraryPassword( aOULibName, aOUOldPassword, aOUNewPassword ); - nRet = 1; - } - catch (...) - { - } - } - - return nRet; -} -IMPL_LINK_INLINE_END( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg ) - -//---------------------------------------------------------------------------- - -void LibPage::NewLib() -{ - createLibImpl( static_cast( this ), m_aCurDocument, &aLibBox, NULL); -} - -//---------------------------------------------------------------------------- - -void LibPage::InsertLib() -{ - // file open dialog - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - xFP->setTitle( String( IDEResId( RID_STR_APPENDLIBS ) ) ); - - // filter - ::rtl::OUString aTitle = String( IDEResId( RID_STR_BASIC ) ); - ::rtl::OUString aFilter; - aFilter = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.sbl;*.xlc;*.xlb" ) ); // library files - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdw;*.sxw;*.odt" ) ); // text - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.vor;*.stw;*.ott" ) ); // text template - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sgl;*.sxg;*.odm" ) ); // master document - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.oth" ) ); // html document template - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdc;*.sxc;*.ods" ) ); // spreadsheet - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.stc;*.ots" ) ); // spreadsheet template - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sda;*.sxd;*.odg" ) ); // drawing - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.std;*.otg" ) ); // drawing template - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdd;*.sxi;*.odp" ) ); // presentation - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sti;*.otp" ) ); // presentation template - aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sxm;*.odf" ) ); // formula - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aTitle, aFilter ); - - // set display directory and filter - String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() ); - if ( aPath.Len() ) - { - xFP->setDisplayDirectory( aPath ); - } - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } - - String aLastFilter( IDE_DLL()->GetExtraData()->GetAddLibFilter() ); - if ( aLastFilter.Len() ) - { - xFltMgr->setCurrentFilter( aLastFilter ); - } - else - { - xFltMgr->setCurrentFilter( String( IDEResId( RID_STR_BASIC ) ) ); - } - - if ( xFP->execute() == RET_OK ) - { - IDE_DLL()->GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); - IDE_DLL()->GetExtraData()->SetAddLibFilter( xFltMgr->getCurrentFilter() ); - - // library containers for import - Reference< script::XLibraryContainer2 > xModLibContImport; - Reference< script::XLibraryContainer2 > xDlgLibContImport; - - // file URLs - Sequence< ::rtl::OUString > aFiles = xFP->getFiles(); - INetURLObject aURLObj( aFiles[0] ); - INetURLObject aModURLObj( aURLObj ); - INetURLObject aDlgURLObj( aURLObj ); - - String aBase = aURLObj.getBase(); - String aModBase = String::CreateFromAscii( "script" ); - String aDlgBase = String::CreateFromAscii( "dialog" ); - - if ( aBase == aModBase || aBase == aDlgBase ) - { - aModURLObj.setBase( aModBase ); - aDlgURLObj.setBase( aDlgBase ); - } - - if ( xMSF.is() ) - { - Reference< XSimpleFileAccess > xSFA( xMSF->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY ); - - if ( xSFA.is() ) - { - ::rtl::OUString aModURL( aModURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( xSFA->exists( aModURL ) ) - { - Sequence aSeqModURL(1); - aSeqModURL[0] <<= aModURL; - xModLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ) ), aSeqModURL ), UNO_QUERY ); - } - - ::rtl::OUString aDlgURL( aDlgURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( xSFA->exists( aDlgURL ) ) - { - Sequence aSeqDlgURL(1); - aSeqDlgURL[0] <<= aDlgURL; - xDlgLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentDialogLibraryContainer" ) ), aSeqDlgURL ), UNO_QUERY ); - } - } - } - - if ( xModLibContImport.is() || xDlgLibContImport.is() ) - { - LibDialog* pLibDlg = 0; - - Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY ); - Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY ); - Sequence< ::rtl::OUString > aLibNames = BasicIDE::GetMergedLibraryNames( xModLibContImp, xDlgLibContImp ); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - { - // library import dialog - if ( !pLibDlg ) - { - pLibDlg = new LibDialog( this ); - pLibDlg->SetStorageName( aURLObj.getName() ); - pLibDlg->GetLibBox().SetMode( LIBMODE_CHOOSER ); - } - - // libbox entries - String aLibName( pLibNames[ i ] ); - String aOULibName( aLibName ); - if ( !( ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) && xModLibContImport->isLibraryLink( aOULibName ) ) || - ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aOULibName ) && xDlgLibContImport->isLibraryLink( aOULibName ) ) ) ) - { - SvLBoxEntry* pEntry = pLibDlg->GetLibBox().DoInsertEntry( aLibName ); - sal_uInt16 nPos = (sal_uInt16) pLibDlg->GetLibBox().GetModel()->GetAbsPos( pEntry ); - pLibDlg->GetLibBox().CheckEntryPos( nPos, sal_True); - } - } - - if ( !pLibDlg ) - InfoBox( this, String( IDEResId( RID_STR_NOLIBINSTORAGE ) ) ).Execute(); - else - { - sal_Bool bChanges = sal_False; - String aExtension( aURLObj.getExtension() ); - String aLibExtension( String::CreateFromAscii( "xlb" ) ); - String aContExtension( String::CreateFromAscii( "xlc" ) ); - - // disable reference checkbox for documents and sbls - if ( aExtension != aLibExtension && aExtension != aContExtension ) - pLibDlg->EnableReference( sal_False ); - - if ( pLibDlg->Execute() ) - { - sal_uLong nNewPos = aLibBox.GetEntryCount(); - sal_Bool bRemove = sal_False; - sal_Bool bReplace = pLibDlg->IsReplace(); - sal_Bool bReference = pLibDlg->IsReference(); - for ( sal_uInt16 nLib = 0; nLib < pLibDlg->GetLibBox().GetEntryCount(); nLib++ ) - { - if ( pLibDlg->GetLibBox().IsChecked( nLib ) ) - { - SvLBoxEntry* pEntry = pLibDlg->GetLibBox().GetEntry( nLib ); - DBG_ASSERT( pEntry, "Entry?!" ); - String aLibName( pLibDlg->GetLibBox().GetEntryText( pEntry, 0 ) ); - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - - // check, if the library is already existing - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) ) - { - if ( bReplace ) - { - // check, if the library is the Standard library - if ( aLibName.EqualsAscii( "Standard" ) ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_REPLACESTDLIB ) ) ).Execute(); - continue; - } - - // check, if the library is readonly and not a link - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) ) - { - String aErrStr( IDEResId( RID_STR_REPLACELIB ) ); - aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName ); - aErrStr += '\n'; - aErrStr += String( IDEResId( RID_STR_LIBISREADONLY ) ); - ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); - continue; - } - - // remove existing libraries - bRemove = sal_True; - } - else - { - String aErrStr; - if ( bReference ) - aErrStr = String( IDEResId( RID_STR_REFNOTPOSSIBLE ) ); - else - aErrStr = String( IDEResId( RID_STR_IMPORTNOTPOSSIBLE ) ); - aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName ); - aErrStr += '\n'; - aErrStr += String( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) ); - ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); - continue; - } - } - - // check, if the library is password protected - sal_Bool bOK = sal_False; - String aPassword; - if ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) && !bReference ) - { - bOK = QueryPassword( xModLibContImp, aLibName, aPassword, sal_True, sal_True ); - - if ( !bOK ) - { - String aErrStr( IDEResId( RID_STR_NOIMPORT ) ); - aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName ); - ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute(); - continue; - } - } - } - - // remove existing libraries - if ( bRemove ) - { - // remove listbox entry - SvLBoxEntry* pEntry_ = aLibBox.FindEntry( aLibName ); - if ( pEntry_ ) - aLibBox.SvTreeListBox::GetModel()->Remove( pEntry_ ); - - // remove module library - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - xModLibContainer->removeLibrary( aOULibName ); - - // remove dialog library - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) - xDlgLibContainer->removeLibrary( aOULibName ); - } - - // copy module library - if ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) && xModLibContainer.is() && !xModLibContainer->hasByName( aOULibName ) ) - { - Reference< container::XNameContainer > xModLib; - if ( bReference ) - { - // storage URL - INetURLObject aModStorageURLObj( aModURLObj ); - if ( aExtension == aContExtension ) - { - sal_Int32 nCount = aModStorageURLObj.getSegmentCount(); - aModStorageURLObj.insertName( aLibName, false, nCount-1 ); - aModStorageURLObj.setExtension( aLibExtension ); - aModStorageURLObj.setFinalSlash(); - } - ::rtl::OUString aModStorageURL( aModStorageURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - - // create library link - xModLib = Reference< container::XNameContainer >( xModLibContainer->createLibraryLink( aOULibName, aModStorageURL, sal_True ), UNO_QUERY); - } - else - { - // create library - xModLib = xModLibContainer->createLibrary( aOULibName ); - if ( xModLib.is() ) - { - // get import library - Reference< container::XNameContainer > xModLibImport; - Any aElement = xModLibContImport->getByName( aOULibName ); - aElement >>= xModLibImport; - - if ( xModLibImport.is() ) - { - // load library - if ( !xModLibContImport->isLibraryLoaded( aOULibName ) ) - xModLibContImport->loadLibrary( aOULibName ); - - // copy all modules - Sequence< ::rtl::OUString > aModNames = xModLibImport->getElementNames(); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) - { - ::rtl::OUString aOUModName( pModNames[ i ] ); - Any aElement_ = xModLibImport->getByName( aOUModName ); - xModLib->insertByName( aOUModName, aElement_ ); - } - - // set password - if ( bOK ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() ) - { - try - { - ::rtl::OUString aOUPassword( aPassword ); - xPasswd->changeLibraryPassword( aOULibName, ::rtl::OUString(), aOUPassword ); - } - catch (...) - { - } - } - } - } - } - } - } - - // copy dialog library - if ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aOULibName ) && xDlgLibContainer.is() && !xDlgLibContainer->hasByName( aOULibName ) ) - { - Reference< container::XNameContainer > xDlgLib; - if ( bReference ) - { - // storage URL - INetURLObject aDlgStorageURLObj( aDlgURLObj ); - if ( aExtension == aContExtension ) - { - sal_Int32 nCount = aDlgStorageURLObj.getSegmentCount(); - aDlgStorageURLObj.insertName( aLibName, false, nCount - 1 ); - aDlgStorageURLObj.setExtension( aLibExtension ); - aDlgStorageURLObj.setFinalSlash(); - } - ::rtl::OUString aDlgStorageURL( aDlgStorageURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - - // create library link - xDlgLib = Reference< container::XNameContainer >( xDlgLibContainer->createLibraryLink( aOULibName, aDlgStorageURL, sal_True ), UNO_QUERY); - } - else - { - // create library - xDlgLib = xDlgLibContainer->createLibrary( aOULibName ); - if ( xDlgLib.is() ) - { - // get import library - Reference< container::XNameContainer > xDlgLibImport; - Any aElement = xDlgLibContImport->getByName( aOULibName ); - aElement >>= xDlgLibImport; - - if ( xDlgLibImport.is() ) - { - // load library - if ( !xDlgLibContImport->isLibraryLoaded( aOULibName ) ) - xDlgLibContImport->loadLibrary( aOULibName ); - - // copy all dialogs - Sequence< ::rtl::OUString > aDlgNames = xDlgLibImport->getElementNames(); - sal_Int32 nDlgCount = aDlgNames.getLength(); - const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) - { - ::rtl::OUString aOUDlgName( pDlgNames[ i ] ); - Any aElement_ = xDlgLibImport->getByName( aOUDlgName ); - xDlgLib->insertByName( aOUDlgName, aElement_ ); - } - } - } - } - } - - // insert listbox entry - ImpInsertLibEntry( aLibName, aLibBox.GetEntryCount() ); - bChanges = sal_True; - } - } - - SvLBoxEntry* pFirstNew = aLibBox.GetEntry( nNewPos ); - if ( pFirstNew ) - aLibBox.SetCurEntry( pFirstNew ); - } - - delete pLibDlg; - if ( bChanges ) - BasicIDE::MarkDocumentModified( m_aCurDocument ); - } - } - } -} - -//---------------------------------------------------------------------------- - -void LibPage::Export( void ) -{ - SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry(); - String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); - - // Password verification - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - sal_Bool bOK = sal_True; - - // check password - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - String aPassword; - Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY ); - bOK = QueryPassword( xModLibContainer1, aLibName, aPassword ); - } - if ( !bOK ) - return; - } - - - Window* pWin = static_cast( this ); - std::auto_ptr< ExportDialog > xNewDlg( new ExportDialog( pWin ) ); - - if ( xNewDlg->Execute() == RET_OK ) - { - try - { - if( xNewDlg->isExportAsPackage() ) - ExportAsPackage( aLibName ); - else - ExportAsBasic( aLibName ); - } - catch( util::VetoException& ) // user cancled operation - { - } - } -} - -void LibPage::implExportLib( const String& aLibName, const String& aTargetURL, - const Reference< task::XInteractionHandler >& Handler ) -{ - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainerExport > xModLibContainerExport - ( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainerExport > xDlgLibContainerExport - ( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( xModLibContainerExport.is() ) - xModLibContainerExport->exportLibrary( aOULibName, aTargetURL, Handler ); - - if ( xDlgLibContainerExport.is() ) - xDlgLibContainerExport->exportLibrary( aOULibName, aTargetURL, Handler ); -} - - -//=========================================================================== -// Implementation XCommandEnvironment - -typedef cppu::WeakImplHelper1< XCommandEnvironment > LibCommandEnvironmentHelper; - -class OLibCommandEnvironment : public LibCommandEnvironmentHelper -{ - Reference< task::XInteractionHandler > mxInteraction; - -public: - OLibCommandEnvironment( Reference< task::XInteractionHandler > xInteraction ) - : mxInteraction( xInteraction ) - {} - - // Methods - virtual Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler() - throw(RuntimeException); - virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() - throw(RuntimeException); -}; - -Reference< task::XInteractionHandler > OLibCommandEnvironment::getInteractionHandler() - throw(RuntimeException) -{ - return mxInteraction; -} - -Reference< XProgressHandler > OLibCommandEnvironment::getProgressHandler() - throw(RuntimeException) -{ - Reference< XProgressHandler > xRet; - return xRet; -} - - - -void LibPage::ExportAsPackage( const String& aLibName ) -{ - // file open dialog - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< task::XInteractionHandler > xHandler; - Reference< XSimpleFileAccess > xSFA; - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY ); - - xSFA = Reference< XSimpleFileAccess > ( xMSF->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY ); - if( !xSFA.is() ) - { - OSL_FAIL( "No simpleFileAccess" ); - return; - } - - Sequence aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } - xFP->setTitle( String( IDEResId( RID_STR_EXPORTPACKAGE ) ) ); - - // filter - ::rtl::OUString aTitle = String( IDEResId( RID_STR_PACKAGE_BUNDLE ) ); - ::rtl::OUString aFilter; - aFilter = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.oxt" ) ); // library files - Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( aTitle, aFilter ); - - // set display directory and filter - String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() ); - if ( aPath.Len() ) - { - xFP->setDisplayDirectory( aPath ); - } - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } - xFltMgr->setCurrentFilter( aTitle ); - - if ( xFP->execute() == RET_OK ) - { - IDE_DLL()->GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); - - Sequence< ::rtl::OUString > aFiles = xFP->getFiles(); - INetURLObject aURL( aFiles[0] ); - if( !aURL.getExtension().getLength() ) - aURL.setExtension( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "oxt" ) ) ); - - ::rtl::OUString aPackageURL( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - String aTmpPath = SvtPathOptions().GetTempPath(); - INetURLObject aInetObj( aTmpPath ); - aInetObj.insertName( aLibName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); - OUString aSourcePath = aInetObj.GetMainURL( INetURLObject::NO_DECODE ); - if( xSFA->exists( aSourcePath ) ) - xSFA->kill( aSourcePath ); - Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) ); - implExportLib( aLibName, aTmpPath, xDummyHandler ); - - Reference< XCommandEnvironment > xCmdEnv = - static_cast( new OLibCommandEnvironment( xHandler ) ); - - ::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv ); - - ::rtl::OUStringBuffer buf; - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip://") ); - buf.append( ::rtl::Uri::encode( aPackageURL, - rtl_UriCharClassRegName, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ); - buf.append( static_cast('/') ); - OUString destFolder( buf.makeStringAndClear() ); - - if( xSFA->exists( aPackageURL ) ) - xSFA->kill( aPackageURL ); - - ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv ); - destFolderContent.transferContent( - sourceContent, ::ucbhelper::InsertOperation_COPY, - OUString(), NameClash::OVERWRITE ); - - INetURLObject aMetaInfInetObj( aTmpPath ); - aMetaInfInetObj.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ), - sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); - OUString aMetaInfFolder = aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE ); - if( xSFA->exists( aMetaInfFolder ) ) - xSFA->kill( aMetaInfFolder ); - xSFA->createFolder( aMetaInfFolder ); - - ::std::vector< Sequence > manifest; - const OUString strMediaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); - const OUString strFullPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FullPath" ) ); - const OUString strBasicMediaType = ::rtl::OUString - ( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.basic-library" ) ); - - Sequence attribs( 2 ); - beans::PropertyValue * pattribs = attribs.getArray(); - pattribs[ 0 ].Name = strFullPath; - OUString fullPath = aLibName; - fullPath += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/") ); - pattribs[ 0 ].Value <<= fullPath; - pattribs[ 1 ].Name = strMediaType; - pattribs[ 1 ].Value <<= strBasicMediaType; - manifest.push_back( attribs ); - - // write into pipe: - Reference xManifestWriter( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.packages.manifest.ManifestWriter") ), UNO_QUERY ); - Reference xPipe( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.io.Pipe") ), UNO_QUERY ); - xManifestWriter->writeManifestSequence( - xPipe, Sequence< Sequence >( - &manifest[ 0 ], manifest.size() ) ); - - aMetaInfInetObj.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) ), - sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL ); - - // write buffered pipe data to content: - ::ucbhelper::Content manifestContent( aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE ), xCmdEnv ); - manifestContent.writeStream( Reference( xPipe, UNO_QUERY_THROW ), true ); - - ::ucbhelper::Content MetaInfContent( aMetaInfFolder, xCmdEnv ); - destFolderContent.transferContent( - MetaInfContent, ::ucbhelper::InsertOperation_COPY, - OUString(), NameClash::OVERWRITE ); - - if( xSFA->exists( aSourcePath ) ) - xSFA->kill( aSourcePath ); - if( xSFA->exists( aMetaInfFolder ) ) - xSFA->kill( aMetaInfFolder ); - } -} - -void LibPage::ExportAsBasic( const String& aLibName ) -{ - // Folder picker - Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XFolderPicker > xFolderPicker; - Reference< task::XInteractionHandler > xHandler; - if( xMSF.is() ) - { - xFolderPicker = Reference< XFolderPicker >( xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); - - xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY ); - } - - if( xFolderPicker.is() ) - { - xFolderPicker->setTitle( String( IDEResId( RID_STR_EXPORTBASIC ) ) ); - - // set display directory and filter - String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() ); - if( !aPath.Len() ) - aPath = SvtPathOptions().GetWorkPath(); - - // INetURLObject aURL(m_sSavePath, INET_PROT_FILE); - xFolderPicker->setDisplayDirectory( aPath ); - short nRet = xFolderPicker->execute(); - if( nRet == RET_OK ) - { - String aTargetURL = xFolderPicker->getDirectory(); - IDE_DLL()->GetExtraData()->SetAddLibPath( aTargetURL ); - - Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) ); - implExportLib( aLibName, aTargetURL, xDummyHandler ); - } - } -} - -//---------------------------------------------------------------------------- - -void LibPage::DeleteCurrent() -{ - SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry(); - String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); - - // check, if library is link - sal_Bool bIsLibraryLink = sal_False; - ::rtl::OUString aOULibName( aLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLink( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLink( aOULibName ) ) ) - { - bIsLibraryLink = sal_True; - } - - if ( QueryDelLib( aLibName, bIsLibraryLink, this ) ) - { - // inform BasicIDE - SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( m_aCurDocument.getDocumentOrNull() ) ); - SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_LIBREMOVED, - SFX_CALLMODE_SYNCHRON, &aDocItem, &aLibNameItem, 0L ); - } - - // remove library from module and dialog library containers - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - xModLibContainer->removeLibrary( aOULibName ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) - xDlgLibContainer->removeLibrary( aOULibName ); - - ((SvLBox&)aLibBox).GetModel()->Remove( pCurEntry ); - BasicIDE::MarkDocumentModified( m_aCurDocument ); - } -} - -//---------------------------------------------------------------------------- - -void LibPage::EndTabDialog( sal_uInt16 nRet ) -{ - DBG_ASSERT( pTabDlg, "TabDlg nicht gesetzt!" ); - if ( pTabDlg ) - pTabDlg->EndDialog( nRet ); -} - -//---------------------------------------------------------------------------- - -void LibPage::FillListBox() -{ - InsertListBoxEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); - InsertListBoxEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); - - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) ); - for ( ScriptDocuments::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - InsertListBoxEntry( *doc, LIBRARY_LOCATION_DOCUMENT ); - } -} - -//---------------------------------------------------------------------------- - -void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - String aEntryText( rDocument.getTitle( eLocation ) ); - sal_uInt16 nPos = aBasicsBox.InsertEntry( aEntryText, LISTBOX_APPEND ); - aBasicsBox.SetEntryData( nPos, new BasicDocumentEntry( rDocument, eLocation ) ); -} - -//---------------------------------------------------------------------------- - -void LibPage::SetCurLib() -{ - sal_uInt16 nSelPos = aBasicsBox.GetSelectEntryPos(); - BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( nSelPos ); - if ( pEntry ) - { - ScriptDocument aDocument( pEntry->GetDocument() ); - DBG_ASSERT( aDocument.isAlive(), "LibPage::SetCurLib: no document, or document is dead!" ); - if ( !aDocument.isAlive() ) - return; - LibraryLocation eLocation = pEntry->GetLocation(); - if ( aDocument != m_aCurDocument || eLocation != m_eCurLocation ) - { - m_aCurDocument = aDocument; - m_eCurLocation = eLocation; - aLibBox.SetDocument( aDocument ); - aLibBox.Clear(); - - // get a sorted list of library names - Sequence< ::rtl::OUString > aLibNames = aDocument.getLibraryNames(); - sal_Int32 nLibCount = aLibNames.getLength(); - const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); - - for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) - { - String aLibName( pLibNames[ i ] ); - if ( eLocation == aDocument.getLibraryLocation( aLibName ) ) - ImpInsertLibEntry( aLibName, i ); - } - - SvLBoxEntry* pEntry_ = aLibBox.FindEntry( String::CreateFromAscii( "Standard" ) ); - if ( !pEntry_ ) - pEntry_ = aLibBox.GetEntry( 0 ); - aLibBox.SetCurEntry( pEntry_ ); - } - } -} - -//---------------------------------------------------------------------------- - -SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, sal_uLong nPos ) -{ - // check, if library is password protected - sal_Bool bProtected = sal_False; - ::rtl::OUString aOULibName( rLibName ); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() ) - { - bProtected = xPasswd->isLibraryPasswordProtected( aOULibName ); - } - } - - SvLBoxEntry* pNewEntry = aLibBox.DoInsertEntry( rLibName, nPos ); - pNewEntry->SetUserData( new BasicLibUserData( m_aCurDocument ) ); - - if (bProtected) - { - Image aImage(IDEResId(RID_IMG_LOCKED)); - aLibBox.SetExpandedEntryBmp(pNewEntry, aImage); - aLibBox.SetCollapsedEntryBmp(pNewEntry, aImage); - } - - // check, if library is link - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLink( aOULibName ) ) - { - String aLinkURL = xModLibContainer->getLibraryLinkURL( aOULibName ); - aLibBox.SetEntryText( aLinkURL, pNewEntry, 1 ); - } - - return pNewEntry; -} - -//---------------------------------------------------------------------------- - -// Helper function -void createLibImpl( Window* pWin, const ScriptDocument& rDocument, - BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox ) -{ - OSL_ENSURE( rDocument.isAlive(), "createLibImpl: invalid document!" ); - if ( !rDocument.isAlive() ) - return; - - // create library name - String aLibName; - String aLibStdName( String( RTL_CONSTASCII_USTRINGPARAM( "Library" ) ) ); - //String aLibStdName( IDEResId( RID_STR_STDLIBNAME ) ); - sal_Bool bValid = sal_False; - sal_uInt16 i = 1; - while ( !bValid ) - { - aLibName = aLibStdName; - aLibName += String::CreateFromInt32( i ); - if ( !rDocument.hasLibrary( E_SCRIPTS, aLibName ) && !rDocument.hasLibrary( E_DIALOGS, aLibName ) ) - bValid = sal_True; - i++; - } - - std::auto_ptr< NewObjectDialog > xNewDlg( new NewObjectDialog( pWin, NEWOBJECTMODE_LIB ) ); - xNewDlg->SetObjectName( aLibName ); - - if ( xNewDlg->Execute() ) - { - if ( xNewDlg->GetObjectName().Len() ) - aLibName = xNewDlg->GetObjectName(); - - if ( aLibName.Len() > 30 ) - { - ErrorBox( pWin, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBNAMETOLONG ) ) ).Execute(); - } - else if ( !BasicIDE::IsValidSbxName( aLibName ) ) - { - ErrorBox( pWin, WB_OK | WB_DEF_OK, - String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - } - else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) ) - { - ErrorBox( pWin, WB_OK | WB_DEF_OK, - String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute(); - } - else - { - try - { - // create module and dialog library - Reference< container::XNameContainer > xModLib( rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ) ); - Reference< container::XNameContainer > xDlgLib( rDocument.getOrCreateLibrary( E_DIALOGS, aLibName ) ); - - if( pLibBox ) - { - SvLBoxEntry* pEntry = pLibBox->DoInsertEntry( aLibName ); - pEntry->SetUserData( new BasicLibUserData( rDocument ) ); - pLibBox->SetCurEntry( pEntry ); - } - - // create a module - String aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); - ::rtl::OUString sModuleCode; - if ( !rDocument.createModule( aLibName, aModName, sal_True, sModuleCode ) ) - throw Exception(); - - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - - if( pBasicBox ) - { - SvLBoxEntry* pEntry = pBasicBox->GetCurEntry(); - SvLBoxEntry* pRootEntry = NULL; - while( pEntry ) - { - pRootEntry = pEntry; - pEntry = pBasicBox->GetParent( pEntry ); - } - - sal_uInt16 nMode = pBasicBox->GetMode(); - bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ); - sal_uInt16 nId = bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB; - SvLBoxEntry* pNewLibEntry = pBasicBox->AddEntry( - aLibName, - Image( IDEResId( nId ) ), - pRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) ); - DBG_ASSERT( pNewLibEntry, "InsertEntry fehlgeschlagen!" ); - - if( pNewLibEntry ) - { - SvLBoxEntry* pEntry_ = pBasicBox->AddEntry( - aModName, - Image( IDEResId( RID_IMG_MODULE ) ), - pNewLibEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - DBG_ASSERT( pEntry_, "InsertEntry fehlgeschlagen!" ); - pBasicBox->SetCurEntry( pEntry_ ); - pBasicBox->Select( pBasicBox->GetCurEntry() ); // OV-Bug?! - } - } - } - catch ( uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx deleted file mode 100644 index 977c6dea0..000000000 --- a/basctl/source/basicide/moduldlg.cxx +++ /dev/null @@ -1,1067 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "localizationmgr.hxx" -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::resource; - - -ExtBasicTreeListBox::ExtBasicTreeListBox( Window* pParent, const ResId& rRes ) - : BasicTreeListBox( pParent, rRes ) -{ -} - - - -ExtBasicTreeListBox::~ExtBasicTreeListBox() -{ -} - -sal_Bool ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) -{ - sal_Bool bRet = sal_False; - - if ( pEntry ) - { - sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); - if ( nDepth >= 2 ) - { - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - ::rtl::OUString aOULibName( aDesc.GetLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) ) - { - // allow editing only for libraries, which are not readonly - bRet = sal_True; - } - } - } - - return bRet; -} - -sal_Bool ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ) -{ - sal_Bool bValid = BasicIDE::IsValidSbxName( rNewText ); - if ( !bValid ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); - return sal_False; - } - - String aCurText( GetEntryText( pEntry ) ); - if ( aCurText == rNewText ) - // nothing to do - return sal_True; - - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "ExtBasicTreeListBox::EditedEntry: no document!" ); - if ( !aDocument.isValid() ) - return sal_False; - String aLibName( aDesc.GetLibName() ); - BasicEntryType eType( aDesc.GetType() ); - - bool bSuccess = ( eType == OBJ_TYPE_MODULE ) - ? BasicIDE::RenameModule( this, aDocument, aLibName, aCurText, rNewText ) - : BasicIDE::RenameDialog( this, aDocument, aLibName, aCurText, rNewText ); - - if ( !bSuccess ) - return sal_False; - - BasicIDE::MarkDocumentModified( aDocument ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, rNewText, ConvertType( eType ) ); - pDispatcher->Execute( SID_BASICIDE_SBXRENAMED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - - // OV-Bug?! - SetEntryText( pEntry, rNewText ); - SetCurEntry( pEntry ); - SetCurEntry( pEntry ); - Select( pEntry, sal_False ); - Select( pEntry ); // damit Handler gerufen wird => Edit updaten - - return sal_True; -} - - -DragDropMode ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry ) -{ - DragDropMode nMode_ = SV_DRAGDROP_NONE; - - if ( pEntry ) - { - sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); - if ( nDepth >= 2 ) - { - nMode_ = SV_DRAGDROP_CTRL_COPY; - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - ::rtl::OUString aOULibName( aDesc.GetLibName() ); - // allow MOVE mode only for libraries, which are not readonly - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) ) - { - // Only allow copy for localized libraries - bool bAllowMove = true; - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) - { - // Get StringResourceManager - Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, aOULibName, sal_True ) ); - Reference< XStringResourceManager > xSourceMgr = - LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib ); - if( xSourceMgr.is() ) - bAllowMove = ( xSourceMgr->getLocales().getLength() == 0 ); - } - if( bAllowMove ) - nMode_ |= SV_DRAGDROP_CTRL_MOVE; - } - } - } - - return nMode_; -} - - -sal_Bool ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) -{ - // don't drop on a BasicManager (nDepth == 0) - sal_uInt16 nDepth = pEntry ? GetModel()->GetDepth( pEntry ) : 0; - sal_Bool bValid = nDepth ? sal_True : sal_False; - - // don't drop in the same library - SvLBoxEntry* pSelected = FirstSelected(); - if ( ( nDepth == 1 ) && ( pEntry == GetParent( pSelected ) ) ) - bValid = sal_False; - else if ( ( nDepth == 2 ) && ( GetParent( pEntry ) == GetParent( pSelected ) ) ) - bValid = sal_False; - - // don't drop on a library, which is not loaded, readonly or password protected - // or which already has a module/dialog with this name - if ( bValid && ( nDepth > 0 ) ) - { - // get source module/dialog name - BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) ); - String aSourceName( aSourceDesc.GetName() ); - BasicEntryType eSourceType( aSourceDesc.GetType() ); - - // get target shell and target library name - BasicEntryDescriptor aDestDesc( GetEntryDescriptor( pEntry ) ); - const ScriptDocument& rDestDoc( aDestDesc.GetDocument() ); - String aDestLibName( aDestDesc.GetLibName() ); - ::rtl::OUString aOUDestLibName( aDestLibName ); - - // check if module library is not loaded, readonly or password protected - Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOUDestLibName ) ) - { - if ( !xModLibContainer->isLibraryLoaded( aOUDestLibName ) ) - bValid = sal_False; - - if ( xModLibContainer->isLibraryReadOnly( aOUDestLibName ) ) - bValid = sal_False; - - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOUDestLibName ) && !xPasswd->isLibraryPasswordVerified( aOUDestLibName ) ) - bValid = sal_False; - } - - // check if dialog library is not loaded or readonly - Reference< script::XLibraryContainer2 > xDlgLibContainer( rDestDoc.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOUDestLibName ) ) - { - if ( !xDlgLibContainer->isLibraryLoaded( aOUDestLibName ) ) - bValid = sal_False; - - if ( xDlgLibContainer->isLibraryReadOnly( aOUDestLibName ) ) - bValid = sal_False; - } - - // check, if module/dialog with this name is already existing in target library - if ( ( eSourceType == OBJ_TYPE_MODULE && rDestDoc.hasModule( aDestLibName, aSourceName ) ) || - ( eSourceType == OBJ_TYPE_DIALOG && rDestDoc.hasDialog( aDestLibName, aSourceName ) ) ) - { - bValid = sal_False; - } - } - - return bValid; -} - - -sal_Bool ExtBasicTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return NotifyCopyingMoving( pTarget, pEntry, - rpNewParent, rNewChildPos, sal_True ); -} - - -sal_Bool ExtBasicTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ -// return sal_False; // Wie kopiere ich ein SBX ?! - return NotifyCopyingMoving( pTarget, pEntry, - rpNewParent, rNewChildPos, sal_False ); -} - - -void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >& io_xISP, - const ScriptDocument& rSourceDoc, const String& rSourceLibName, const ScriptDocument& rDestDoc, - const String& rDestLibName, const String& rDlgName ) -{ - if ( !io_xISP.is() ) - return; - - // Get StringResourceManager - Reference< container::XNameContainer > xSourceDialogLib( rSourceDoc.getLibrary( E_DIALOGS, rSourceLibName, sal_True ) ); - Reference< XStringResourceManager > xSourceMgr = - LocalizationMgr::getStringResourceFromDialogLibrary( xSourceDialogLib ); - if( !xSourceMgr.is() ) - return; - bool bSourceLocalized = ( xSourceMgr->getLocales().getLength() > 0 ); - - Reference< container::XNameContainer > xDestDialogLib( rDestDoc.getLibrary( E_DIALOGS, rDestLibName, sal_True ) ); - Reference< XStringResourceManager > xDestMgr = - LocalizationMgr::getStringResourceFromDialogLibrary( xDestDialogLib ); - if( !xDestMgr.is() ) - return; - bool bDestLocalized = ( xDestMgr->getLocales().getLength() > 0 ); - - if( !bSourceLocalized && !bDestLocalized ) - return; - - // create dialog model - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY ); - Reference< io::XInputStream > xInput( io_xISP->createInputStream() ); - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() ); - - if( xDialogModel.is() ) - { - if( bSourceLocalized && bDestLocalized ) - { - Reference< resource::XStringResourceResolver > xSourceStringResolver( xSourceMgr, UNO_QUERY ); - LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceStringResolver ); - } - else if( bSourceLocalized ) - { - LocalizationMgr::resetResourceForDialog( xDialogModel, xSourceMgr ); - } - else if( bDestLocalized ) - { - LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr ); - } - io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() ); - } -} - - -sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove ) -{ - (void)pEntry; - DBG_ASSERT( pEntry, "Kein Eintrag?" ); // Hier ASS ok, sollte nicht mit - DBG_ASSERT( pTarget, "Kein Ziel?" ); // NULL (ganz vorne) erreicht werden - sal_uInt16 nDepth = GetModel()->GetDepth( pTarget ); - DBG_ASSERT( nDepth, "Tiefe?" ); - if ( nDepth == 1 ) - { - // Target = Basic => Modul/Dialog unter das Basic haengen... - rpNewParent = pTarget; - rNewChildPos = 0; - } - else if ( nDepth >= 2 ) - { - // Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen... - rpNewParent = GetParent( pTarget ); - rNewChildPos = GetModel()->GetRelPos( pTarget ) + 1; - } - - // get target shell and target library name - BasicEntryDescriptor aDestDesc( GetEntryDescriptor( rpNewParent ) ); - const ScriptDocument& rDestDoc( aDestDesc.GetDocument() ); - String aDestLibName( aDestDesc.GetLibName() ); - - // get source shell, library name and module/dialog name - BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( FirstSelected() ) ); - const ScriptDocument rSourceDoc( aSourceDesc.GetDocument() ); - String aSourceLibName( aSourceDesc.GetLibName() ); - String aSourceName( aSourceDesc.GetName() ); - BasicEntryType eType( aSourceDesc.GetType() ); - - // get dispatcher - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - - if ( bMove ) // move - { - // remove source module/dialog window - if ( rSourceDoc != rDestDoc || aSourceLibName != aDestLibName ) - { - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rSourceDoc, aSourceLibName, aSourceName, ConvertType( eType ) ); - pDispatcher->Execute( SID_BASICIDE_SBXDELETED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - - try - { - if ( eType == OBJ_TYPE_MODULE ) // module - { - // get module - ::rtl::OUString aModule; - if ( rSourceDoc.getModule( aSourceLibName, aSourceName, aModule ) ) - { - // remove module from source library - if ( rSourceDoc.removeModule( aSourceLibName, aSourceName ) ) - { - BasicIDE::MarkDocumentModified( rSourceDoc ); - - // insert module into target library - if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); - } - } - } - else if ( eType == OBJ_TYPE_DIALOG ) // dialog - { - // get dialog - Reference< io::XInputStreamProvider > xISP; - if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) ) - { - BasicIDEShell::CopyDialogResources( xISP, rSourceDoc, - aSourceLibName, rDestDoc, aDestLibName, aSourceName ); - - // remove dialog from source library - if ( BasicIDE::RemoveDialog( rSourceDoc, aSourceLibName, aSourceName ) ) - { - BasicIDE::MarkDocumentModified( rSourceDoc ); - - // insert dialog into target library - if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); - } - } - } - } - catch ( uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - else // copy - { - try - { - if ( eType == OBJ_TYPE_MODULE ) // module - { - // get module - ::rtl::OUString aModule; - if ( rSourceDoc.getModule( aSourceLibName, aSourceName, aModule ) ) - { - // insert module into target library - if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); - } - } - else if ( eType == OBJ_TYPE_DIALOG ) // dialog - { - // get dialog - Reference< io::XInputStreamProvider > xISP; - if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) ) - { - BasicIDEShell::CopyDialogResources( xISP, rSourceDoc, - aSourceLibName, rDestDoc, aDestLibName, aSourceName ); - - // insert dialog into target library - if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); - } - } - } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - // create target module/dialog window - if ( rSourceDoc != rDestDoc || aSourceLibName != aDestLibName ) - { - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDestDoc, aDestLibName, aSourceName, ConvertType( eType ) ); - pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - - return 2; // Aufklappen... -} - -OrganizeDialog::OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc ) - :TabDialog( pParent, IDEResId( RID_TD_ORGANIZE ) ) - ,aTabCtrl( this, IDEResId( RID_TC_ORGANIZE ) ) - ,m_aCurEntry( rDesc ) -{ - FreeResource(); - aTabCtrl.SetActivatePageHdl( LINK( this, OrganizeDialog, ActivatePageHdl ) ); - if( tabId == 0 ) - { - aTabCtrl.SetCurPageId( RID_TP_MOD ); - } - else if ( tabId == 1 ) - { - aTabCtrl.SetCurPageId( RID_TP_DLG ); - } - else - { - aTabCtrl.SetCurPageId( RID_TP_LIB ); - } - - ActivatePageHdl( &aTabCtrl ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } -} - -OrganizeDialog::~OrganizeDialog() -{ - for ( sal_uInt16 i = 0; i < aTabCtrl.GetPageCount(); i++ ) - delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) ); -}; - -short OrganizeDialog::Execute() -{ - Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = TabDialog::Execute(); - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; -} - - -IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl ) -{ - sal_uInt16 nId = pTabCtrl->GetCurPageId(); - // Wenn TabPage noch nicht erzeugt wurde, dann erzeugen - if ( !pTabCtrl->GetTabPage( nId ) ) - { - TabPage* pNewTabPage = 0; - switch ( nId ) - { - case RID_TP_MOD: - { - pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_MODULS ), BROWSEMODE_MODULES ); - ((ObjectPage*)pNewTabPage)->SetTabDlg( this ); - ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry ); - } - break; - case RID_TP_DLG: - { - pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_DLGS ), BROWSEMODE_DIALOGS ); - ((ObjectPage*)pNewTabPage)->SetTabDlg( this ); - ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry ); - } - break; - case RID_TP_LIB: - { - pNewTabPage = new LibPage( pTabCtrl ); - ((LibPage*)pNewTabPage)->SetTabDlg( this ); - } - break; - default: OSL_FAIL( "PageHdl: Unbekannte ID!" ); - } - DBG_ASSERT( pNewTabPage, "Keine Page!" ); - pTabCtrl->SetTabPage( nId, pNewTabPage ); - } - return 0; -} - -ObjectPage::ObjectPage( Window * pParent, const ResId& rResId, sal_uInt16 nMode ) : - TabPage( pParent, rResId ), - aLibText( this, IDEResId( RID_STR_LIB ) ), - aBasicBox( this, IDEResId( RID_TRLBOX ) ), - aEditButton( this, IDEResId( RID_PB_EDIT ) ), - aCloseButton( this, IDEResId( RID_PB_CLOSE ) ), - aNewModButton( this, IDEResId( RID_PB_NEWMOD ) ), - aNewDlgButton( this, IDEResId( RID_PB_NEWDLG ) ), - aDelButton( this, IDEResId( RID_PB_DELETE ) ) -{ - FreeResource(); - pTabDlg = 0; - - aEditButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); - aDelButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); - aCloseButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); - aBasicBox.SetSelectHdl( LINK( this, ObjectPage, BasicBoxHighlightHdl ) ); - - if( nMode & BROWSEMODE_MODULES ) - { - aNewModButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); - aNewDlgButton.Hide(); - } - else if ( nMode & BROWSEMODE_DIALOGS ) - { - aNewDlgButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) ); - aNewModButton.Hide(); - } - - aBasicBox.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY ); - aBasicBox.EnableInplaceEditing( sal_True ); - aBasicBox.SetMode( nMode ); - aBasicBox.SetStyle( WB_BORDER | WB_TABSTOP | - WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); - aBasicBox.ScanAllEntries(); - - aEditButton.GrabFocus(); - CheckButtons(); -} - -void ObjectPage::SetCurrentEntry( BasicEntryDescriptor& rDesc ) -{ - aBasicBox.SetCurrentEntry( rDesc ); -} - -void ObjectPage::ActivatePage() -{ - aBasicBox.UpdateEntries(); -} - -void ObjectPage::DeactivatePage() -{ -} - -void ObjectPage::CheckButtons() -{ - // enable/disable edit button - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - ::rtl::OUString aOULibName( aDesc.GetLibName() ); - String aLibSubName( aDesc.GetLibSubName() ); - sal_Bool bVBAEnabled = aDocument.isInVBAMode(); - sal_uInt16 nMode = aBasicBox.GetMode(); - - sal_uInt16 nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0; - if ( nDepth >= 2 ) - { - if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) ) - aEditButton.Disable(); - else - aEditButton.Enable(); - } - else - aEditButton.Disable(); - - // enable/disable new module/dialog buttons - LibraryLocation eLocation( aDesc.GetLocation() ); - sal_Bool bReadOnly = sal_False; - if ( nDepth > 0 ) - { - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); - if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || - ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) - { - bReadOnly = sal_True; - } - } - if ( bReadOnly || eLocation == LIBRARY_LOCATION_SHARE ) - { - aNewModButton.Disable(); - aNewDlgButton.Disable(); - } - else - { - aNewModButton.Enable(); - aNewDlgButton.Enable(); - } - - // enable/disable delete button - if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE ) - { - if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) ) - aDelButton.Disable(); - else - aDelButton.Enable(); - } - else - aDelButton.Disable(); -} - -IMPL_LINK( ObjectPage, BasicBoxHighlightHdl, BasicTreeListBox *, pBox ) -{ - if ( !pBox->IsSelected( pBox->GetHdlEntry() ) ) - return 0; - - CheckButtons(); - return 0; -} - -IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton ) -{ - if ( pButton == &aEditButton ) - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - DBG_ASSERT( pCurEntry, "Entry?!" ); - if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 ) - { - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - if ( pDispatcher ) - { - String aModName( aDesc.GetName() ); - // extract the module name from the string like "Sheet1 (Example1)" - if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) - { - sal_uInt16 nIndex = 0; - aModName = aModName.GetToken( 0, ' ', nIndex ); - } - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), - aModName, aBasicBox.ConvertType( aDesc.GetType() ) ); - pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - else // Nur Lib selektiert - { - DBG_ASSERT( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 1, "Kein LibEntry?!" ); - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - SvLBoxEntry* pParentEntry = aBasicBox.GetParent( pCurEntry ); - if ( pParentEntry ) - { - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pParentEntry->GetUserData(); - if ( pBasicDocumentEntry ) - aDocument = pBasicDocumentEntry->GetDocument(); - } - SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( aDocument.getDocumentOrNull() ) ); - String aLibName( aBasicBox.GetEntryText( pCurEntry ) ); - SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - if ( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, SFX_CALLMODE_ASYNCHRON, &aDocItem, &aLibNameItem, 0L ); - } - } - EndTabDialog( 1 ); - } - else if ( pButton == &aNewModButton ) - NewModule(); - else if ( pButton == &aNewDlgButton ) - NewDialog(); - else if ( pButton == &aDelButton ) - DeleteCurrent(); - else if ( pButton == &aCloseButton ) - EndTabDialog( 0 ); - - return 0; -} - -bool ObjectPage::GetSelection( ScriptDocument& rDocument, String& rLibName ) -{ - bool bRet = false; - - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - rDocument = aDesc.GetDocument(); - rLibName = aDesc.GetLibName(); - if ( !rLibName.Len() ) - rLibName = String::CreateFromAscii( "Standard" ); - - DBG_ASSERT( rDocument.isAlive(), "ObjectPage::GetSelection: no or dead ScriptDocument in the selection!" ); - if ( !rDocument.isAlive() ) - return false; - - // check if the module library is loaded - sal_Bool bOK = sal_True; - ::rtl::OUString aOULibName( rLibName ); - Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - // check password - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - String aPassword; - bOK = QueryPassword( xModLibContainer, rLibName, aPassword ); - } - - // load library - if ( bOK ) - xModLibContainer->loadLibrary( aOULibName ); - } - - // check if the dialog library is loaded - Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - { - // load library - if ( bOK ) - xDlgLibContainer->loadLibrary( aOULibName ); - } - - if ( bOK ) - bRet = true; - - return bRet; -} - -void ObjectPage::NewModule() -{ - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - String aLibName; - - if ( GetSelection( aDocument, aLibName ) ) - { - String aModName; - createModImpl( static_cast( this ), aDocument, - aBasicBox, aLibName, aModName, true ); - } -} - -void ObjectPage::NewDialog() -{ - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - String aLibName; - - if ( GetSelection( aDocument, aLibName ) ) - { - aDocument.getOrCreateLibrary( E_DIALOGS, aLibName ); - - std::auto_ptr< NewObjectDialog > xNewDlg( - new NewObjectDialog(this, NEWOBJECTMODE_DLG, true)); - xNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) ); - - if (xNewDlg->Execute() != 0) - { - String aDlgName( xNewDlg->GetObjectName() ); - if (aDlgName.Len() == 0) - aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName); - - if ( aDocument.hasDialog( aLibName, aDlgName ) ) - { - ErrorBox( this, WB_OK | WB_DEF_OK, - String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute(); - } - else - { - Reference< io::XInputStreamProvider > xISP; - if ( !aDocument.createDialog( aLibName, aDlgName, xISP ) ) - return; - - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aDlgName, BASICIDE_TYPE_DIALOG ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - SvLBoxEntry* pRootEntry = aBasicBox.FindRootEntry( aDocument, eLocation ); - if ( pRootEntry ) - { - if ( !aBasicBox.IsExpanded( pRootEntry ) ) - aBasicBox.Expand( pRootEntry ); - SvLBoxEntry* pLibEntry = aBasicBox.FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY ); - DBG_ASSERT( pLibEntry, "Libeintrag nicht gefunden!" ); - if ( pLibEntry ) - { - if ( !aBasicBox.IsExpanded( pLibEntry ) ) - aBasicBox.Expand( pLibEntry ); - SvLBoxEntry* pEntry = aBasicBox.FindEntry( pLibEntry, aDlgName, OBJ_TYPE_DIALOG ); - if ( !pEntry ) - { - pEntry = aBasicBox.AddEntry( - aDlgName, - Image( IDEResId( RID_IMG_DIALOG ) ), - pLibEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) ); - DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" ); - } - aBasicBox.SetCurEntry( pEntry ); - aBasicBox.Select( aBasicBox.GetCurEntry() ); // OV-Bug?! - } - } - } - } - } -} - -void ObjectPage::DeleteCurrent() -{ - SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - DBG_ASSERT( pCurEntry, "Kein aktueller Eintrag!" ); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" ); - if ( !aDocument.isAlive() ) - return; - String aLibName( aDesc.GetLibName() ); - String aName( aDesc.GetName() ); - BasicEntryType eType( aDesc.GetType() ); - - if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule( aName, this ) ) || - ( eType == OBJ_TYPE_DIALOG && QueryDelDialog( aName, this ) ) ) - { - aBasicBox.GetModel()->Remove( pCurEntry ); - if ( aBasicBox.GetCurEntry() ) // OV-Bug ? - aBasicBox.Select( aBasicBox.GetCurEntry() ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aName, aBasicBox.ConvertType( eType ) ); - pDispatcher->Execute( SID_BASICIDE_SBXDELETED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - - try - { - bool bSuccess = false; - if ( eType == OBJ_TYPE_MODULE ) - bSuccess = aDocument.removeModule( aLibName, aName ); - else if ( eType == OBJ_TYPE_DIALOG ) - bSuccess = BasicIDE::RemoveDialog( aDocument, aLibName, aName ); - - if ( bSuccess ) - BasicIDE::MarkDocumentModified( aDocument ); - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } -} - - - -void ObjectPage::EndTabDialog( sal_uInt16 nRet ) -{ - DBG_ASSERT( pTabDlg, "TabDlg nicht gesetzt!" ); - if ( pTabDlg ) - pTabDlg->EndDialog( nRet ); -} - - -LibDialog::LibDialog( Window* pParent ) - : ModalDialog( pParent, IDEResId( RID_DLG_LIBS ) ), - aOKButton( this, IDEResId( RID_PB_OK ) ), - aCancelButton( this, IDEResId( RID_PB_CANCEL ) ), - aStorageName( this, IDEResId( RID_FT_STORAGENAME ) ), - aLibBox( this, IDEResId( RID_CTRL_LIBS ) ), - aFixedLine( this, IDEResId( RID_FL_OPTIONS ) ), - aReferenceBox( this, IDEResId( RID_CB_REF ) ), - aReplaceBox( this, IDEResId( RID_CB_REPL ) ) -{ - SetText( String( IDEResId( RID_STR_APPENDLIBS ) ) ); - FreeResource(); -} - - -LibDialog::~LibDialog() -{ -} - -void LibDialog::SetStorageName( const String& rName ) -{ - String aName( IDEResId( RID_STR_FILENAME ) ); - aName += rName; - aStorageName.SetText( aName ); -} - -// Helper function -SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, - BasicTreeListBox& rBasicBox, const String& rLibName, String aModName, bool bMain ) -{ - OSL_ENSURE( rDocument.isAlive(), "createModImpl: invalid document!" ); - if ( !rDocument.isAlive() ) - return NULL; - - SbModule* pModule = NULL; - - String aLibName( rLibName ); - if ( !aLibName.Len() ) - aLibName = String::CreateFromAscii( "Standard" ); - rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ); - if ( !aModName.Len() ) - aModName = rDocument.createObjectName( E_SCRIPTS, aLibName ); - - std::auto_ptr< NewObjectDialog > xNewDlg( - new NewObjectDialog( pWin, NEWOBJECTMODE_MOD, true ) ); - xNewDlg->SetObjectName( aModName ); - - if (xNewDlg->Execute() != 0) - { - if ( xNewDlg->GetObjectName().Len() ) - aModName = xNewDlg->GetObjectName(); - - try - { - ::rtl::OUString sModuleCode; - // the module has existed - if( rDocument.hasModule( aLibName, aModName ) ) - return NULL; - rDocument.createModule( aLibName, aModName, bMain, sModuleCode ); - BasicManager* pBasMgr = rDocument.getBasicManager(); - StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0; - if ( pBasic ) - pModule = pBasic->FindModule( aModName ); - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - LibraryLocation eLocation = rDocument.getLibraryLocation( aLibName ); - SvLBoxEntry* pRootEntry = rBasicBox.FindRootEntry( rDocument, eLocation ); - if ( pRootEntry ) - { - if ( !rBasicBox.IsExpanded( pRootEntry ) ) - rBasicBox.Expand( pRootEntry ); - SvLBoxEntry* pLibEntry = rBasicBox.FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY ); - DBG_ASSERT( pLibEntry, "Libeintrag nicht gefunden!" ); - if ( pLibEntry ) - { - if ( !rBasicBox.IsExpanded( pLibEntry ) ) - rBasicBox.Expand( pLibEntry ); - SvLBoxEntry* pSubRootEntry = pLibEntry; - if( pBasic && rDocument.isInVBAMode() ) - { - // add the new module in the "Modules" entry - SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES ); - if( pLibSubEntry ) - { - if( !rBasicBox.IsExpanded( pLibSubEntry ) ) - rBasicBox.Expand( pLibSubEntry ); - pSubRootEntry = pLibSubEntry; - } - } - - SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE ); - if ( !pEntry ) - { - pEntry = rBasicBox.AddEntry( - aModName, - Image( IDEResId( RID_IMG_MODULE ) ), - pSubRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" ); - } - rBasicBox.SetCurEntry( pEntry ); - rBasicBox.Select( rBasicBox.GetCurEntry() ); // OV-Bug?! - } - } - } - catch ( container::ElementExistException& ) - { - ErrorBox( pWin, WB_OK | WB_DEF_OK, - String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute(); - } - catch ( container::NoSuchElementException& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return pModule; -} - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldlg.hrc b/basctl/source/basicide/moduldlg.hrc deleted file mode 100644 index 1504b3bd1..000000000 --- a/basctl/source/basicide/moduldlg.hrc +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MODULDLG_HRC -#define _MODULDLG_HRC - -#include - -#define RID_STR_LIB 1 -#define RID_TRLBOX 2 -// free -#define RID_PB_EDIT 4 -#define RID_PB_CLOSE 5 -#define RID_PB_NEWMOD 6 -#define RID_PB_NEWDLG 7 -#define RID_PB_DELETE 8 -#define RID_PB_NEWLIB 9 -#define RID_PB_APPEND 10 -#define RID_PB_PASSWORD 11 -#define RID_LB_BASICS 12 -#define RID_STR_BASICS 13 - -#define RID_PB_EXPORT 14 -#define RID_PB_EXPORT_PACKAGE 15 - -#define RID_TP_MOD 20 -#define RID_TP_LIB 21 -#define RID_TP_DLG 22 - -#define RID_TC_ORGANIZE 30 - -#define RID_PB_OK 31 -#define RID_PB_CANCEL 32 -#define RID_CTRL_LIBS 33 -#define RID_FL_OPTIONS 34 -#define RID_CB_REF 35 -#define RID_CB_REPL 36 -#define RID_FT_STORAGENAME 38 - -#define RID_FT_NEWLIB 40 -#define RID_ED_LIBNAME 41 -#define RB_EXPORTASPACKAGE 42 -#define RB_EXPORTASBASIC 43 - -#endif // _MODULDLG_HRC diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx deleted file mode 100644 index cef66b226..000000000 --- a/basctl/source/basicide/moduldlg.hxx +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MODULDLG_HXX -#define _MODULDLG_HXX - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include "com/sun/star/task/XInteractionHandler.hpp" - -#include -#include - -class StarBASIC; - - -#define NEWOBJECTMODE_LIB 1 -#define NEWOBJECTMODE_MOD 2 -#define NEWOBJECTMODE_DLG 3 -#define NEWOBJECTMODE_METH 4 - -class NewObjectDialog : public ModalDialog -{ -private: - FixedText aText; - Edit aEdit; - OKButton aOKButton; - CancelButton aCancelButton; - - DECL_LINK(OkButtonHandler, Button *); - -public: - NewObjectDialog(Window * pParent, sal_uInt16 nMode, bool bCheckName = false); - ~NewObjectDialog(); - - String GetObjectName() const { return aEdit.GetText(); } - void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );} -}; - -class ExportDialog : public ModalDialog -{ -private: - RadioButton maExportAsPackageButton; - RadioButton maExportAsBasicButton; - OKButton maOKButton; - CancelButton maCancelButton; - - sal_Bool mbExportAsPackage; - - DECL_LINK(OkButtonHandler, Button *); - -public: - ExportDialog( Window * pParent ); - ~ExportDialog(); - - sal_Bool isExportAsPackage( void ) { return mbExportAsPackage; } -}; - - -class ExtBasicTreeListBox : public BasicTreeListBox -{ -protected: - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel ); - virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ); - - virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvLBoxEntry* pEntry ); - virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* pEntry ); - - virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ); - virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ); - sal_Bool NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove ); - -public: - ExtBasicTreeListBox( Window* pParent, const ResId& rRes ); - ~ExtBasicTreeListBox(); -}; - -#define LIBMODE_CHOOSER 1 -#define LIBMODE_MANAGER 2 - -class BasicCheckBox : public SvTabListBox -{ -private: - sal_uInt16 nMode; - SvLBoxButtonData* pCheckButton; - ScriptDocument m_aDocument; - void Init(); - -public: - BasicCheckBox( Window* pParent, const ResId& rResId ); - ~BasicCheckBox(); - - SvLBoxEntry* DoInsertEntry( const String& rStr, sal_uLong nPos = LISTBOX_APPEND ); - SvLBoxEntry* FindEntry( const String& rName ); - - void CheckEntryPos( sal_uLong nPos, sal_Bool bCheck = sal_True ); - sal_Bool IsChecked( sal_uLong nPos ) const; - - virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind ); - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel ); - virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText ); - - void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - - void SetMode( sal_uInt16 n ); - sal_uInt16 GetMode() const { return nMode; } -}; - -class LibDialog: public ModalDialog -{ -private: - OKButton aOKButton; - CancelButton aCancelButton; - FixedText aStorageName; - BasicCheckBox aLibBox; - FixedLine aFixedLine; - CheckBox aReferenceBox; - CheckBox aReplaceBox; - -public: - LibDialog( Window* pParent ); - ~LibDialog(); - - void SetStorageName( const String& rName ); - - BasicCheckBox& GetLibBox() { return aLibBox; } - sal_Bool IsReference() const { return aReferenceBox.IsChecked(); } - sal_Bool IsReplace() const { return aReplaceBox.IsChecked(); } - - void EnableReference( sal_Bool b ) { aReferenceBox.Enable( b ); } - void EnableReplace( sal_Bool b ) { aReplaceBox.Enable( b ); } -}; - - -class OrganizeDialog : public TabDialog -{ -private: - TabControl aTabCtrl; - BasicEntryDescriptor m_aCurEntry; - -public: - OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc ); - ~OrganizeDialog(); - - virtual short Execute(); - - DECL_LINK( ActivatePageHdl, TabControl * ); -}; - -class ObjectPage: public TabPage -{ -protected: - FixedText aLibText; - ExtBasicTreeListBox aBasicBox; - PushButton aEditButton; - CancelButton aCloseButton; - PushButton aNewModButton; - PushButton aNewDlgButton; - PushButton aDelButton; - - DECL_LINK( BasicBoxHighlightHdl, BasicTreeListBox * ); - DECL_LINK( ButtonHdl, Button * ); - void CheckButtons(); - bool GetSelection( ScriptDocument& rDocument, String& rLibName ); - void DeleteCurrent(); - void NewModule(); - void NewDialog(); - void EndTabDialog( sal_uInt16 nRet ); - - TabDialog* pTabDlg; - - virtual void ActivatePage(); - virtual void DeactivatePage(); - -public: - ObjectPage( Window* pParent, const ResId& rResId, sal_uInt16 nMode ); - - void SetCurrentEntry( BasicEntryDescriptor& rDesc ); - void SetTabDlg( TabDialog* p ) { pTabDlg = p;} -}; - - -class SvxPasswordDialog; - -class LibPage: public TabPage -{ -protected: - FixedText aBasicsText; - ListBox aBasicsBox; - FixedText aLibText; - BasicCheckBox aLibBox; - PushButton aEditButton; - CancelButton aCloseButton; - PushButton aPasswordButton; - PushButton aNewLibButton; - PushButton aInsertLibButton; - PushButton aExportButton; - PushButton aDelButton; - - ScriptDocument m_aCurDocument; - LibraryLocation m_eCurLocation; - - DECL_LINK( TreeListHighlightHdl, SvTreeListBox * ); - DECL_LINK( BasicSelectHdl, ListBox * ); - DECL_LINK( ButtonHdl, Button * ); - DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * ); - void CheckButtons(); - void DeleteCurrent(); - void NewLib(); - void InsertLib(); - void implExportLib( const String& aLibName, const String& aTargetURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ); - void Export(); - void ExportAsPackage( const String& aLibName ); - void ExportAsBasic( const String& aLibName ); - void EndTabDialog( sal_uInt16 nRet ); - void FillListBox(); - void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); - void SetCurLib(); - SvLBoxEntry* ImpInsertLibEntry( const String& rLibName, sal_uLong nPos ); - virtual void ActivatePage(); - virtual void DeactivatePage(); - - TabDialog* pTabDlg; - -public: - LibPage( Window* pParent ); - virtual ~LibPage(); - - void SetTabDlg( TabDialog* p ) { pTabDlg = p;} -}; - -// Helper functions -SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, - BasicTreeListBox& rBasicBox, const String& rLibName, String aModName, bool bMain = false ); -void createLibImpl( Window* pWin, const ScriptDocument& rDocument, - BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox ); - -#endif // _MODULDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldlg.src b/basctl/source/basicide/moduldlg.src deleted file mode 100644 index a00f13646..000000000 --- a/basctl/source/basicide/moduldlg.src +++ /dev/null @@ -1,427 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "helpid.hrc" -#include -#include -TabDialog RID_TD_ORGANIZE -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text[ en-US ] = "%PRODUCTNAME Basic Macro Organizer"; - Moveable = TRUE ; - Closeable = TRUE ; - // Da Cancel-Button auf TabPage, nicht auf Dialog! - TabControl RID_TC_ORGANIZE - { - // HelpID = HID_BASICIDE_ORG_TC; - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_TP_MOD ; - Text [ en-US ] = "Modules" ; - }; - PageItem - { - Identifier = RID_TP_DLG ; - Text [ en-US ] = "Dialogs" ; - }; - PageItem - { - Identifier = RID_TP_LIB ; - Text [ en-US ] = "Libraries" ; - }; - }; - }; -}; -TabPage RID_TP_MODULS -{ - HelpId = "basctl:TabPage:RID_TP_MODULS" ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 210 , 140 ) ; - FixedText RID_STR_LIB - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - Text [ en-US ] = "M~odule" ; - }; - Control RID_TRLBOX - { - HelpId = HID_BASICIDE_MODULES_TREE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 130 , 117 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - PushButton RID_PB_EDIT - { - HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_EDIT"; - Text [ en-US ] = "~Edit"; - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CLOSE - { - Text [ en-US ] = "Close"; - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEWMOD - { - HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_NEWMOD"; - Pos = MAP_APPFONT ( 144 , 103 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~New..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEWDLG - { - HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_NEWDLG"; - Pos = MAP_APPFONT ( 144 , 103 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~New..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_DELETE - { - HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_DELETE"; - Pos = MAP_APPFONT ( 144 , 120 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - }; -}; -TabPage RID_TP_DLGS -{ - HelpID = "basctl:TabPage:RID_TP_DLGS"; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 210 , 140 ) ; - FixedText RID_STR_LIB - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - Text [ en-US ] = "Dialog" ; - }; - Control RID_TRLBOX - { - HelpId = HID_BASICIDE_MODULES_TREE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 130 , 117 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - PushButton RID_PB_EDIT - { - HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_EDIT"; - Text [ en-US ] = "~Edit"; - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CLOSE - { - Text[ en-US ] = "Close"; - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEWMOD - { - HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_NEWMOD"; - Pos = MAP_APPFONT ( 144 , 103 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~New..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_NEWDLG - { - HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_NEWDLG"; - Pos = MAP_APPFONT ( 144 , 103 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~New..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_DELETE - { - HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_DELETE"; - Pos = MAP_APPFONT ( 144 , 120 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - }; -}; -TabPage RID_TP_LIBS -{ - HelpId = "basctl:TabPage:RID_TP_LIBS" ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 210 , 140 ) ; - FixedText RID_STR_BASICS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - Text [ en-US ] = "L~ocation"; - }; - ListBox RID_LB_BASICS - { - HelpID = "basctl:ListBox:RID_TP_LIBS:RID_LB_BASICS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 130 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText RID_STR_LIB - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 130 , 10 ) ; - Text [ en-US ] = "~Library" ; - }; - Control RID_TRLBOX - { - HelpID = HID_BASICIDE_LIBS_TREE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 47 ) ; - Size = MAP_APPFONT ( 130 , 87 ) ; - TabStop = TRUE ; - }; - - PushButton RID_PB_EDIT - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_EDIT"; - Text [ en-US ] = "~Edit"; - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CLOSE - { - Text [ en-US ] = "Close"; - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - PushButton RID_PB_PASSWORD - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_PASSWORD"; - Pos = MAP_APPFONT ( 144 , 43 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Password..." ; - TabStop = TRUE ; - }; - - PushButton RID_PB_NEWLIB - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_NEWLIB"; - Pos = MAP_APPFONT ( 144 , 69 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~New..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_APPEND - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_APPEND"; - Pos = MAP_APPFONT ( 144 , 86 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Import..." ; - }; - PushButton RID_PB_EXPORT - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_EXPORT"; - Pos = MAP_APPFONT ( 144 , 103 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "E~xport..." ; - TabStop = TRUE ; - }; - PushButton RID_PB_DELETE - { - HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_DELETE"; - Pos = MAP_APPFONT ( 144 , 120 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Delete" ; - TabStop = TRUE ; - }; -}; -ModalDialog RID_DLG_LIBS -{ - HelpId = "basctl:ModalDialog:RID_DLG_LIBS" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 132 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( 112 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( 112 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText RID_FT_STORAGENAME - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - Control RID_CTRL_LIBS - { - HelpID = HID_BASICIDE_LIBSDLG_TREE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 100 , 67 ) ; - TabStop = TRUE ; - }; - FixedLine RID_FL_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 89 ) ; - Size = MAP_APPFONT ( 156 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - CheckBox RID_CB_REF - { - HelpID = "basctl:CheckBox:RID_DLG_LIBS:RID_CB_REF"; - Pos = MAP_APPFONT ( 12 , 100 ) ; - Size = MAP_APPFONT ( 146 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Insert as reference (read-only)" ; - }; - CheckBox RID_CB_REPL - { - HelpID = "basctl:CheckBox:RID_DLG_LIBS:RID_CB_REPL"; - Pos = MAP_APPFONT ( 12 , 113 ) ; - Size = MAP_APPFONT ( 146 , 10 ) ; - Text [ en-US ] = "Replace existing libraries" ; - }; -}; -ModalDialog RID_DLG_NEWLIB -{ - HelpID = "basctl:ModalDialog:RID_DLG_NEWLIB"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 160 , 55 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( 104 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( 104 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText RID_FT_NEWLIB - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Name:" ; - }; - Edit RID_ED_LIBNAME - { - HelpID = "basctl:Edit:RID_DLG_NEWLIB:RID_ED_LIBNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 92 , 12 ) ; - TabStop = TRUE ; - }; -}; - -ModalDialog RID_DLG_EXPORT -{ - HelpID = "basctl:ModalDialog:RID_DLG_EXPORT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 115 , 55 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Export Basic library"; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( 6 , 35 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( 59 , 35 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - RadioButton RB_EXPORTASPACKAGE - { - HelpID = "basctl:RadioButton:RID_DLG_EXPORT:RB_EXPORTASPACKAGE"; - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 103, 10 ); - Group = TRUE; - Text [ en-US ] = "Export as ~extension"; - TabStop = TRUE ; - }; - RadioButton RB_EXPORTASBASIC - { - HelpID = "basctl:RadioButton:RID_DLG_EXPORT:RB_EXPORTASBASIC"; - Pos = MAP_APPFONT( 6, 19 ); - Size = MAP_APPFONT( 103, 10 ); - //Group = TRUE; - Text [ en-US ] = "Export as BASIC library"; - }; -}; - -String RID_STR_EXPORTPACKAGE -{ - Text [ en-US ] = "Export library as extension"; -}; - -String RID_STR_EXPORTBASIC -{ - Text [ en-US ] = "Export as BASIC library"; -}; - -String RID_STR_PACKAGE_BUNDLE -{ - Text [ en-US ] = "Extension"; -}; - diff --git a/basctl/source/basicide/moptions.hrc b/basctl/source/basicide/moptions.hrc deleted file mode 100644 index b57cbdedd..000000000 --- a/basctl/source/basicide/moptions.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MOPTIONS_HRC -#define _MOPTIONS_HRC - -#include - -#define RID_MACROOPTIONS ( RID_BASICIDE_START + 55 ) - -#define RID_FT_SBXNAME 2 -#define RID_PB_OK 3 -#define RID_PB_CANCEL 4 -#define RID_PB_HELP 5 -#define RID_FT_DESCR 6 -#define RID_ME_DESCR 7 -#define RID_FL_HELP 8 -#define RID_FT_HELPID 9 -#define RID_NF_HELPID 10 -#define RID_FT_HELPNAME 11 -#define RID_ED_HELPNAME 12 - -#endif // _MOPTIONS_HRC - diff --git a/basctl/source/basicide/moptions.src b/basctl/source/basicide/moptions.src deleted file mode 100644 index e300d4f73..000000000 --- a/basctl/source/basicide/moptions.src +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "helpid.hrc" -#include -ModalDialog RID_MACROOPTIONS -{ - HelpId = "basctl:ModalDialog:RID_MACROOPTIONS" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 224 , 121 ) ; - Text [ en-US ] = "Description" ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedText RID_FT_SBXNAME - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - }; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( 168 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( 168 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton RID_PB_HELP - { - Pos = MAP_APPFONT ( 168 , 53 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText RID_FT_DESCR - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 69 , 10 ) ; - Text [ en-US ] = "Description" ; - }; - MultiLineEdit RID_ME_DESCR - { - HelpID = "basctl:MultiLineEdit:RID_MACROOPTIONS:RID_ME_DESCR"; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 154 , 36 ) ; - TabStop = TRUE ; - VScroll = TRUE ; - IgnoreTab = TRUE ; - }; - FixedLine RID_FL_HELP - { - Pos = MAP_APPFONT ( 6 , 73 ) ; - Size = MAP_APPFONT ( 212 , 8 ) ; - Text [ en-US ] = "Help information" ; - }; - FixedText RID_FT_HELPID - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 9 , 83 ) ; - Size = MAP_APPFONT ( 80 , 10 ) ; - Text [ en-US ] = "Help ID" ; - }; - NumericField RID_NF_HELPID - { - HelpID = "basctl:NumericField:RID_MACROOPTIONS:RID_NF_HELPID"; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 95 , 83 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; - TabStop = TRUE ; - Minimum = 0 ; - Maximum = 0xFFFFFFFF ; - }; - FixedText RID_FT_HELPNAME - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 9 , 99 ) ; - Size = MAP_APPFONT ( 80 , 10 ) ; - Text [ en-US ] = "Help file name" ; - }; - Edit RID_ED_HELPNAME - { - HelpID = "basctl:Edit:RID_MACROOPTIONS:RID_ED_HELPNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 95 , 99 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; - TabStop = TRUE ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx deleted file mode 100644 index 39aa894fc..000000000 --- a/basctl/source/basicide/objdlg.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -ObjectTreeListBox::ObjectTreeListBox( Window* pParent, const ResId& rRes ) - : BasicTreeListBox( pParent, rRes ) -{ -} - -ObjectTreeListBox::~ObjectTreeListBox() -{ -} - -void ObjectTreeListBox::Command( const CommandEvent& ) -{ -} - -void ObjectTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) -{ - BasicTreeListBox::MouseButtonDown( rMEvt ); - - if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) ) - { - BasicEntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) ); - - if ( aDesc.GetType() == OBJ_TYPE_METHOD ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(), - aDesc.GetMethodName(), ConvertType( aDesc.GetType() ) ); - pDispatcher->Execute( SID_BASICIDE_SHOWSBX, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - } -} - - - -ObjectCatalog::ObjectCatalog( Window * pParent ) - :FloatingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) ) - ,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) ) - ,aToolBox(this, IDEResId(RID_TB_TOOLBOX)) - ,aMacroDescr( this, IDEResId( RID_FT_MACRODESCR ) ) -{ - FreeResource(); - - aToolBox.SetOutStyle( TOOLBOX_STYLE_FLAT ); - aToolBox.SetSizePixel( aToolBox.CalcWindowSizePixel() ); - aToolBox.SetSelectHdl( LINK( this, ObjectCatalog, ToolBoxHdl ) ); - - aMacroTreeList.SetStyle( WB_BORDER | WB_TABSTOP | - WB_HASLINES | WB_HASLINESATROOT | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HSCROLL ); - - aMacroTreeList.SetSelectHdl( LINK( this, ObjectCatalog, TreeListHighlightHdl ) ); - aMacroTreeList.SetAccessibleName(String(IDEResId(RID_STR_TLB_MACROS))); - aMacroTreeList.ScanAllEntries(); - aMacroTreeList.GrabFocus(); - - CheckButtons(); - - Point aPos = IDE_DLL()->GetExtraData()->GetObjectCatalogPos(); - Size aSize = IDE_DLL()->GetExtraData()->GetObjectCatalogSize(); - if ( aPos.X() == INVPOSITION ) - { - // Zentriert nach AppWin: - Window* pWin = GetParent(); - aPos = pWin->OutputToScreenPixel( Point( 0, 0 ) ); - Size aAppWinSz = pWin->GetSizePixel(); - Size aDlgWinSz = GetSizePixel(); - aPos.X() += aAppWinSz.Width() / 2; - aPos.X() -= aDlgWinSz.Width() / 2; - aPos.Y() += aAppWinSz.Height() / 2; - aPos.Y() -= aDlgWinSz.Height() / 2; - } - SetPosPixel( aPos ); - if ( aSize.Width() ) - SetOutputSizePixel( aSize ); - - Resize(); // damit der Resize-Handler die Controls anordnet - - // make object catalog keyboard accessible - pParent->GetSystemWindow()->GetTaskPaneList()->AddWindow( this ); -} - -ObjectCatalog::~ObjectCatalog() -{ - GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this ); -} - -void ObjectCatalog::Move() -{ - IDE_DLL()->GetExtraData()->SetObjectCatalogPos( GetPosPixel() ); -} - -sal_Bool ObjectCatalog::Close() -{ - aCancelHdl.Call( this ); - return sal_True; -} - -void ObjectCatalog::Resize() -{ - Size aOutSz = GetOutputSizePixel(); - IDE_DLL()->GetExtraData()->SetObjectCatalogSize( aOutSz ); - - Point aTreePos = aMacroTreeList.GetPosPixel(); - Size aDescrSz = aMacroDescr.GetSizePixel(); - - Size aTreeSz; - long nCtrlWidth = aOutSz.Width() - 2*aTreePos.X(); - aTreeSz.Width() = nCtrlWidth; - aTreeSz.Height() = aOutSz.Height() - aTreePos.Y() - - 2*aTreePos.X() - aDescrSz.Height(); - - if ( aTreeSz.Height() > 0 ) - { - aMacroTreeList.SetSizePixel( aTreeSz ); - - Point aDescrPos( aTreePos.X(), aTreePos.Y()+aTreeSz.Height()+aTreePos.X() ); - - aMacroDescr.SetPosSizePixel( aDescrPos, Size( nCtrlWidth, aDescrSz.Height() ) ); - - String aDesc = aMacroDescr.GetText(); - aMacroDescr.SetText(String()); - aMacroDescr.SetText(aDesc); - } - - // Die Buttons oben bleiben immer unveraendert stehen... -} - -IMPL_LINK( ObjectCatalog, ToolBoxHdl, ToolBox*, pToolBox ) -{ - sal_uInt16 nCurItem = pToolBox->GetCurItemId(); - switch ( nCurItem ) - { - case TBITEM_SHOW: - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); - SFX_APP()->ExecuteSlot( aRequest ); - - SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry(); - DBG_ASSERT( pCurEntry, "Entry?!" ); - BasicEntryDescriptor aDesc( aMacroTreeList.GetEntryDescriptor( pCurEntry ) ); - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( aDesc.GetType() == OBJ_TYPE_MODULE || - aDesc.GetType() == OBJ_TYPE_DIALOG || - aDesc.GetType() == OBJ_TYPE_METHOD ) - { - if( pDispatcher ) - { - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(), - aDesc.GetMethodName(), aMacroTreeList.ConvertType( aDesc.GetType() ) ); - pDispatcher->Execute( SID_BASICIDE_SHOWSBX, - SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } - } - else - { - ErrorBox( this, WB_OK, String( IDEResId( RID_STR_OBJNOTFOUND ) ) ).Execute(); - aMacroTreeList.GetModel()->Remove( pCurEntry ); - CheckButtons(); - } - } - break; - } - - return 0; -} - - - -void ObjectCatalog::CheckButtons() -{ - SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry(); - BasicEntryType eType = pCurEntry ? ((BasicEntry*)pCurEntry->GetUserData())->GetType() : OBJ_TYPE_UNKNOWN; - if ( eType == OBJ_TYPE_DIALOG || eType == OBJ_TYPE_MODULE || eType == OBJ_TYPE_METHOD ) - aToolBox.EnableItem( TBITEM_SHOW, sal_True ); - else - aToolBox.EnableItem( TBITEM_SHOW, sal_False ); -} - - - -IMPL_LINK_INLINE_START( ObjectCatalog, TreeListHighlightHdl, SvTreeListBox *, pBox ) -{ - if ( pBox->IsSelected( pBox->GetHdlEntry() ) ) - UpdateFields(); - return 0; -} -IMPL_LINK_INLINE_END( ObjectCatalog, TreeListHighlightHdl, SvTreeListBox *, pBox ) - - -void ObjectCatalog::UpdateFields() -{ - SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry(); - if ( pCurEntry ) - { - CheckButtons(); - aMacroDescr.SetText( String() ); - SbxVariable* pVar = aMacroTreeList.FindVariable( pCurEntry ); - if ( pVar ) - { - SbxInfoRef xInfo = pVar->GetInfo(); - if ( xInfo.Is() ) - aMacroDescr.SetText( xInfo->GetComment() ); - } - } -} - - -void ObjectCatalog::UpdateEntries() -{ - aMacroTreeList.UpdateEntries(); -} - -void ObjectCatalog::SetCurrentEntry( BasicEntryDescriptor& rDesc ) -{ - aMacroTreeList.SetCurrentEntry( rDesc ); -} - -ObjectCatalogToolBox_Impl::ObjectCatalogToolBox_Impl( - Window * pParent, ResId const & rResId) - : ToolBox(pParent, rResId) - , m_aImagesNormal(GetImageList()) -{ - setImages(); -} - -// virtual -void ObjectCatalogToolBox_Impl::DataChanged(DataChangedEvent const & rDCEvt) -{ - ToolBox::DataChanged(rDCEvt); - if ((rDCEvt.GetType() == DATACHANGED_SETTINGS - || rDCEvt.GetType() == DATACHANGED_DISPLAY) - && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0) - setImages(); -} - -void ObjectCatalogToolBox_Impl::setImages() -{ - SetImageList(m_aImagesNormal); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/objdlg.hrc b/basctl/source/basicide/objdlg.hrc deleted file mode 100644 index 4ecc73f8e..000000000 --- a/basctl/source/basicide/objdlg.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OBJDLG_HRC -#define _OBJDLG_HRC - -#include - -#define RID_BASICIDE_OBJCAT ( RID_BASICIDE_START + 70 ) -#define RID_FT_MACRODESCR 8 -#define RID_TLB_MACROS 10 -#define RID_TB_TOOLBOX 11 - -#define TBITEM_SHOW 1 - -#define RID_STR_TLB_MACROS ( RID_BASICIDE_START + 71 ) - -#endif // _OBJDLG_HXX diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx deleted file mode 100644 index 343d89083..000000000 --- a/basctl/source/basicide/objdlg.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OBJDLG_HXX -#define _OBJDLG_HXX - -#include -#include -#include -#include -#include "vcl/image.hxx" - -#include - -class StarBASIC; - -class ObjectTreeListBox : public BasicTreeListBox -{ -private: - - virtual void Command( const CommandEvent& rCEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - -public: - ObjectTreeListBox( Window* pParent, const ResId& rRes ); - ~ObjectTreeListBox(); -}; - -class ObjectCatalogToolBox_Impl: public ToolBox -{ -public: - ObjectCatalogToolBox_Impl(Window * pParent, ResId const & rResId); - -private: - virtual void DataChanged(DataChangedEvent const & rDCEvt); - - void setImages(); - - ImageList m_aImagesNormal; -}; - -class ObjectCatalog : public FloatingWindow -{ -private: - ObjectTreeListBox aMacroTreeList; - ObjectCatalogToolBox_Impl aToolBox; - FixedText aMacroDescr; - Link aCancelHdl; - -protected: - DECL_LINK( ToolBoxHdl, ToolBox* ); - void CheckButtons(); - DECL_LINK( TreeListHighlightHdl, SvTreeListBox * ); - void UpdateFields(); - virtual void Move(); - virtual sal_Bool Close(); - virtual void Resize(); - -public: - ObjectCatalog( Window * pParent ); - virtual ~ObjectCatalog(); - - void UpdateEntries(); - void SetCurrentEntry( BasicEntryDescriptor& rDesc ); - - void SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; } -}; - -#endif //_OBJDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/objdlg.src b/basctl/source/basicide/objdlg.src deleted file mode 100644 index 45cc031cc..000000000 --- a/basctl/source/basicide/objdlg.src +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - -FloatingWindow RID_BASICIDE_OBJCAT -{ - HelpID = "basctl:FloatingWindow:RID_BASICIDE_OBJCAT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 191 , 179 ) ; - Text [ en-US ] = "Objects" ; - Closeable = TRUE ; - Moveable = TRUE ; - Sizeable = TRUE ; - Zoomable = TRUE ; - Hide = TRUE ; - ClipChildren = TRUE ; - Control RID_TLB_MACROS - { - HelpId = HID_BASICIDE_OBJECTCAT ; - Border = TRUE ; - Pos = MAP_APPFONT ( 3 , 24 ) ; - Size = MAP_APPFONT ( 185 , 126 ) ; - TabStop = TRUE ; - }; - ToolBox RID_TB_TOOLBOX - { - HelpId = HID_BASICIDE_OBJECTS ; - SVLook = TRUE ; - Align = BOXALIGN_TOP ; - Pos = MAP_APPFONT ( 4 , 6 ) ; - ItemImageList = ImageList - { - Prefix = "im"; - MASKCOLOR - IdList = - { - TBITEM_SHOW ; - }; - }; - ItemList = - { - ToolBoxItem - { - Identifier = TBITEM_SHOW ; - HelpId = HID_BASICIDE_OBJCAT_SHOW ; - Text [ en-US ] = "Show" ; - }; - }; - }; - FixedText RID_FT_MACRODESCR - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( 3 , 156 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; - }; -}; - -String RID_STR_TLB_MACROS -{ - Text [ en-US ] = "Objects Tree"; -}; - diff --git a/basctl/source/basicide/register.cxx b/basctl/source/basicide/register.cxx deleted file mode 100644 index 82f417dee..000000000 --- a/basctl/source/basicide/register.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include -#include -#include -#include - -#include - -#include "unomodel.hxx" - -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - - -extern "C" { - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, - void* pServiceManager, - void* pRegistryKey ) -{ - (void)pRegistryKey; - - // Set default return value for this operation - if it failed. - void* pReturn = NULL ; - - if ( - ( pImplementationName != NULL ) && - ( pServiceManager != NULL ) - ) - { - // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory ; - Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - - if( SIDEModel::getImplementationName_Static().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createSingleFactory( xServiceManager, - SIDEModel::getImplementationName_Static(), - SIDEModel_createInstance, - SIDEModel::getSupportedServiceNames_Static() ); - } - - // Factory is valid - service was found. - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - // Return with result of this operation. - return pReturn ; -} -} // extern "C" - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx deleted file mode 100644 index fd06e7b71..000000000 --- a/basctl/source/basicide/scriptdocument.cxx +++ /dev/null @@ -1,1604 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "scriptdocument.hxx" -#include "basobj.hxx" -#include "basidesh.hrc" -#include "iderid.hxx" -#include "dlgeddef.hxx" -#include "localizationmgr.hxx" -#include "doceventnotifier.hxx" -#include "documentenumeration.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#include - -#include - -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include - -#include -#include - -#include -#include -#include - - -namespace basctl -{ - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::frame::XModel; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::script::XLibraryContainer; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::container::XNameContainer; - using ::com::sun::star::container::NoSuchElementException; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::task::XStatusIndicator; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::script::XLibraryContainer2; - using ::com::sun::star::lang::XMultiServiceFactory; - using ::com::sun::star::uri::XUriReferenceFactory; - using ::com::sun::star::uri::XUriReference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::util::XMacroExpander; - using ::com::sun::star::io::XInputStreamProvider; - using ::com::sun::star::uno::Any; - using ::com::sun::star::io::XInputStream; - using ::com::sun::star::frame::XStorable; - using ::com::sun::star::util::XModifiable; - using ::com::sun::star::frame::XController; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::util::URL; - using ::com::sun::star::frame::XDispatchProvider; - using ::com::sun::star::frame::XDispatch; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::frame::XDesktop; - using ::com::sun::star::container::XEnumerationAccess; - using ::com::sun::star::container::XEnumeration; - using ::com::sun::star::frame::XModel2; - using ::com::sun::star::awt::XWindow2; - using ::com::sun::star::document::XEventListener; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::document::XEventBroadcaster; - using ::com::sun::star::document::XEmbeddedScripts; - using ::com::sun::star::script::ModuleInfo; - using ::com::sun::star::script::vba::XVBACompatibility; - using ::com::sun::star::script::vba::XVBAModuleInfo; - /** === end UNO using === **/ - namespace MacroExecMode = ::com::sun::star::document::MacroExecMode; - namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; - - //==================================================================== - //= helper - //==================================================================== - namespace - { - static bool StringCompareLessThan( const String& lhs, const String& rhs ) - { - return ( lhs.CompareIgnoreCaseToAscii( rhs ) == COMPARE_LESS ); - } - - class FilterDocuments : public docs::IDocumentDescriptorFilter - { - public: - FilterDocuments( bool _bFilterInvisible ) : m_bFilterInvisible( _bFilterInvisible ) { } - - virtual bool includeDocument( const docs::DocumentDescriptor& _rDocument ) const; - - private: - bool impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const; - - private: - bool m_bFilterInvisible; - }; - - bool FilterDocuments::impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const - { - try - { - for ( docs::Controllers::const_iterator controller = _rDocument.aControllers.begin(); - controller != _rDocument.aControllers.end(); - ++controller - ) - { - Reference< XFrame > xFrame( (*controller)->getFrame(), UNO_SET_THROW ); - Reference< XWindow2 > xContainer( xFrame->getContainerWindow(), UNO_QUERY_THROW ); - if ( xContainer->isVisible() ) - return true; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - bool FilterDocuments::includeDocument( const docs::DocumentDescriptor& _rDocument ) const - { - Reference< XEmbeddedScripts > xScripts( _rDocument.xModel, UNO_QUERY ); - if ( !xScripts.is() ) - return false; - if ( !m_bFilterInvisible || impl_isDocumentVisible_nothrow( _rDocument ) ) - return true; - return false; - } - - void lcl_getAllModels_throw( docs::Documents& _out_rModels, bool _bVisibleOnly ) - { - _out_rModels.clear(); - - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - FilterDocuments aFilter( _bVisibleOnly ); - docs::DocumentEnumeration aEnum( aContext, &aFilter ); - - aEnum.getDocuments( _out_rModels ); - } - } - - class ScriptDocument_Impl : public DocumentEventListener - { - private: - bool m_bIsApplication; - bool m_bValid; - bool m_bDocumentClosed; - Reference< XModel > m_xDocument; - Reference< XModifiable > m_xDocModify; - Reference< XEmbeddedScripts > m_xScriptAccess; - ::std::auto_ptr< DocumentEventNotifier > - m_pDocListener; - - public: - ScriptDocument_Impl( ); - ScriptDocument_Impl( const Reference< XModel >& _rxDocument ); - ~ScriptDocument_Impl(); - - /** determines whether the instance refers to a valid "document" with script and - dialog libraries - */ - inline bool isValid() const { return m_bValid; } - /** determines whether the instance refers to a non-closed document - */ - inline bool isAlive() const { return m_bValid ? ( m_bIsApplication ? true : !m_bDocumentClosed ) : false; } - /// determines whether the "document" refers to the application in real - inline bool isApplication() const { return m_bValid && m_bIsApplication; } - /// determines whether the document refers to a real document (instead of the application) - inline bool isDocument() const { return m_bValid && !m_bIsApplication; } - - /** invalidates the instance - */ - void invalidate(); - - const Reference< XModel >& - getDocumentRef() const { return m_xDocument; } - - /// returns a library container belonging to the document - Reference< XLibraryContainer > - getLibraryContainer( LibraryContainerType _eType ) const; - - /// determines whether a given library is part of the shared installation - bool isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType ); - - /** returns the current frame of the document - - To be called for documents only, not for the application. - - If is returned, an assertion will be raised in non-product builds. - */ - bool getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const; - - // versions with the same signature/semantics as in ScriptDocument itself - bool isReadOnly() const; - bool isInVBAMode() const; - BasicManager* - getBasicManager() const; - Reference< XModel > - getDocument() const; - void setDocumentModified() const; - bool isDocumentModified() const; - bool saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const; - - ::rtl::OUString - getTitle() const; - ::rtl::OUString - getURL() const; - - bool allowMacros() const; - - Reference< XNameContainer > - getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const - SAL_THROW((NoSuchElementException)); - bool hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - Reference< XNameContainer > - getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - - void loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ); - - bool removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ); - bool hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const; - bool getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog ); - bool renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ); - bool createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const; - bool insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rObjectName, const ::rtl::OUString& _rModName, const Any& _rElement ) const; - bool updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const; - bool createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const; - - protected: - // DocumentEventListener - virtual void onDocumentCreated( const ScriptDocument& _rDocument ); - virtual void onDocumentOpened( const ScriptDocument& _rDocument ); - virtual void onDocumentSave( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ); - virtual void onDocumentClosed( const ScriptDocument& _rDocument ); - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ); - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); - - private: - bool impl_initDocument_nothrow( const Reference< XModel >& _rxModel ); - }; - - //==================================================================== - //= ScriptDocument_Impl - implementation - //==================================================================== - ScriptDocument_Impl::ScriptDocument_Impl() - :m_bIsApplication( true ) - ,m_bValid( true ) - ,m_bDocumentClosed( false ) - { - } - - ScriptDocument_Impl::ScriptDocument_Impl( const Reference< XModel >& _rxDocument ) - :m_bIsApplication( false ) - ,m_bValid( false ) - ,m_bDocumentClosed( false ) - { - if ( _rxDocument.is() ) - { - if ( impl_initDocument_nothrow( _rxDocument ) ) - { - } - } - } - - ScriptDocument_Impl::~ScriptDocument_Impl() - { - invalidate(); - } - - void ScriptDocument_Impl::invalidate() - { - m_bIsApplication = false; - m_bValid = false; - m_bDocumentClosed = false; - - m_xDocument.clear(); - m_xDocModify.clear(); - m_xScriptAccess.clear(); - - if ( m_pDocListener.get() ) - m_pDocListener->dispose(); - } - - bool ScriptDocument_Impl::impl_initDocument_nothrow( const Reference< XModel >& _rxModel ) - { - try - { - m_xDocument.set ( _rxModel, UNO_SET_THROW ); - m_xDocModify.set ( _rxModel, UNO_QUERY_THROW ); - m_xScriptAccess.set ( _rxModel, UNO_QUERY ); - - m_bValid = m_xScriptAccess.is(); - - if ( m_bValid ) - m_pDocListener.reset( new DocumentEventNotifier( *this, _rxModel ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - m_bValid = false; - } - - if ( !m_bValid ) - { - invalidate(); - } - - return m_bValid; - } - - Reference< XLibraryContainer > ScriptDocument_Impl::getLibraryContainer( LibraryContainerType _eType ) const - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibraryContainer: invalid!" ); - - Reference< XLibraryContainer > xContainer; - if ( !isValid() ) - return xContainer; - - try - { - if ( isApplication() ) - xContainer.set( _eType == E_SCRIPTS ? SFX_APP()->GetBasicContainer() : SFX_APP()->GetDialogContainer(), UNO_QUERY_THROW ); - else - { - xContainer.set( - _eType == E_SCRIPTS ? m_xScriptAccess->getBasicLibraries() : m_xScriptAccess->getDialogLibraries(), - UNO_QUERY_THROW ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xContainer; - } - - bool ScriptDocument_Impl::isReadOnly() const - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::isReadOnly: invalid state!" ); - OSL_ENSURE( !isApplication(), "ScriptDocument_Impl::isReadOnly: not allowed to be called for the application!" ); - - bool bIsReadOnly = true; - if ( isValid() && !isApplication() ) - { - try - { - // note that XStorable is required by the OfficeDocument service - Reference< XStorable > xDocStorable( m_xDocument, UNO_QUERY_THROW ); - bIsReadOnly = xDocStorable->isReadonly(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return bIsReadOnly; - } - - bool ScriptDocument_Impl::isInVBAMode() const - { - bool bResult = false; - if ( !isApplication() ) - { - Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - if ( xVBACompat.is() ) - bResult = xVBACompat->getVBACompatibilityMode(); - } - return bResult; - } - - - BasicManager* ScriptDocument_Impl::getBasicManager() const - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getBasicManager: invalid state!" ); - if ( !isValid() ) - return NULL; - - if ( isApplication() ) - return SFX_APP()->GetBasicManager(); - - return ::basic::BasicManagerRepository::getDocumentBasicManager( m_xDocument ); - } - - - Reference< XModel > ScriptDocument_Impl::getDocument() const - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getDocument: invalid state!" ); - OSL_ENSURE( isDocument(), "ScriptDocument_Impl::getDocument: for documents only!" ); - if ( !isValid() || !isDocument() ) - return NULL; - - return m_xDocument; - } - - - Reference< XNameContainer > ScriptDocument_Impl::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const - SAL_THROW((NoSuchElementException)) - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibrary: invalid state!" ); - - Reference< XNameContainer > xContainer; - try - { - Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType ); - if ( isValid() ) - { - if ( xLibContainer.is() ) - xContainer.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW ); - } - - if ( !xContainer.is() ) - throw NoSuchElementException(); - - // load library - if ( _bLoadLibrary && !xLibContainer->isLibraryLoaded( _rLibName ) ) - xLibContainer->loadLibrary( _rLibName ); - } - catch( const NoSuchElementException& ) - { - throw; // allowed to leave - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return xContainer; - } - - - bool ScriptDocument_Impl::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - bool bHas = false; - try - { - Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType ); - bHas = xLibContainer.is() && xLibContainer->hasByName( _rLibName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return bHas; - } - - - Reference< XNameContainer > ScriptDocument_Impl::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - Reference< XNameContainer > xLibrary; - try - { - Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW ); - if ( xLibContainer->hasByName( _rLibName ) ) - xLibrary.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW ); - else - xLibrary.set( xLibContainer->createLibrary( _rLibName ), UNO_QUERY_THROW ); - - if ( !xLibContainer->isLibraryLoaded( _rLibName ) ) - xLibContainer->loadLibrary( _rLibName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xLibrary; - } - - - void ScriptDocument_Impl::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ) - { - try - { - Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ) ); - if ( xLibContainer.is() && xLibContainer->hasByName( _rLibrary ) && !xLibContainer->isLibraryLoaded( _rLibrary ) ) - xLibContainer->loadLibrary( _rLibrary ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - - bool ScriptDocument_Impl::removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::removeModuleOrDialog: invalid!" ); - if ( isValid() ) - { - try - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ) ); - if ( xLib.is() ) - { - xLib->removeByName( _rModuleName ); - return true; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return false; - } - - - bool ScriptDocument_Impl::hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::hasModuleOrDialog: invalid!" ); - if ( !isValid() ) - return false; - - try - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ) ); - if ( xLib.is() ) - return xLib->hasByName( _rModName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - - bool ScriptDocument_Impl::getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog ) - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getModuleOrDialog: invalid!" ); - if ( !isValid() ) - return false; - - _out_rModuleOrDialog.clear(); - try - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ), UNO_QUERY_THROW ); - if ( xLib->hasByName( _rObjectName ) ) - { - _out_rModuleOrDialog = xLib->getByName( _rObjectName ); - return true; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - - bool ScriptDocument_Impl::renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, - const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ) - { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::renameModuleOrDialog: invalid!" ); - if ( !isValid() ) - return false; - - try - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ), UNO_QUERY_THROW ); - - // get element - Any aElement( xLib->getByName( _rOldName ) ); - - // remove element from container - xLib->removeByName( _rOldName ); - - // if it's a dialog, import and export, to reflect the new name - if ( _eType == E_DIALOGS ) - { - // create dialog model - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XNameContainer > xDialogModel; - if ( _rxExistingDialogModel.is() ) - xDialogModel = _rxExistingDialogModel; - else - if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) ) - return false; - - // import dialog model - Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW ); - if ( !_rxExistingDialogModel.is() ) - { - Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW ); - ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); - } - - // set new name as property - Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW ); - xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) ); - - // export dialog model - xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); - aElement <<= xISP; - } - - // insert element by new name in container - if ( _eType == E_SCRIPTS ) - { - Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY ); - if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) ) - { - ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName ); - xVBAModuleInfo->removeModuleInfo( _rOldName ); - xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo ); - } - } - xLib->insertByName( _rNewName, aElement ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - - bool ScriptDocument_Impl::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const - { - _out_rNewModuleCode = ::rtl::OUString(); - try - { - Reference< XNameContainer > xLib( getLibrary( E_SCRIPTS, _rLibName, sal_True ) ); - if ( !xLib.is() || xLib->hasByName( _rModName ) ) - return false; - - // create new module - _out_rNewModuleCode = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "REM ***** BASIC *****\n\n" ) ); - if ( _bCreateMain ) - _out_rNewModuleCode += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Sub Main\n\nEnd Sub\n" ) ); - - // insert module into library - xLib->insertByName( _rModName, makeAny( _out_rNewModuleCode ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return false; - } - - return true; - } - - - bool ScriptDocument_Impl::insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, const Any& _rElement ) const - { - try - { - Reference< XNameContainer > xLib( getOrCreateLibrary( _eType, _rLibName ), UNO_QUERY_THROW ); - if ( xLib->hasByName( _rObjectName ) ) - return false; - - xLib->insertByName( _rObjectName, _rElement ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - - bool ScriptDocument_Impl::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const - { - try - { - Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW ); - if ( !xLib->hasByName( _rModName ) ) - return false; - xLib->replaceByName( _rModName, makeAny( _rModuleCode ) ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - - bool ScriptDocument_Impl::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const - { - try - { - Reference< XNameContainer > xLib( getLibrary( E_DIALOGS, _rLibName, sal_True ), UNO_QUERY_THROW ); - - // create dialog - _out_rDialogProvider.clear(); - if ( xLib->hasByName( _rDialogName ) ) - return false; - - // create new dialog model - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XNameContainer > xDialogModel; - if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) ) - return false; - - // set name property - Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW ); - xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) ); - - // export dialog model - _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() ); - - // insert dialog into library - xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return _out_rDialogProvider.is(); - } - - - void ScriptDocument_Impl::setDocumentModified() const - { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::setDocumentModified: only to be called for real documents!" ); - if ( isValid() && isDocument() ) - { - try - { - m_xDocModify->setModified( sal_True ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - - bool ScriptDocument_Impl::isDocumentModified() const - { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::isDocumentModified: only to be called for real documents!" ); - bool bIsModified = false; - if ( isValid() && isDocument() ) - { - try - { - bIsModified = m_xDocModify->isModified(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return bIsModified; - } - - - bool ScriptDocument_Impl::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const - { - Reference< XFrame > xFrame; - if ( !getCurrentFrame( xFrame ) ) - return false; - - Sequence< PropertyValue > aArgs; - if ( _rxStatusIndicator.is() ) - { - aArgs.realloc(1); - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ); - aArgs[0].Value <<= _rxStatusIndicator; - } - - try - { - URL aURL; - aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Save" ) ); - aURL.Main = aURL.Complete; - aURL.Protocol = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) ); - aURL.Path = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Save" ) ); - - Reference< XDispatchProvider > xDispProv( xFrame, UNO_QUERY_THROW ); - Reference< XDispatch > xDispatch( - xDispProv->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), FrameSearchFlag::AUTO ), - UNO_SET_THROW ); - - xDispatch->dispatch( aURL, aArgs ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return false; - } - - return true; - } - - - ::rtl::OUString ScriptDocument_Impl::getTitle() const - { - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getTitle: for documents only!" ); - - ::rtl::OUString sTitle; - if ( isValid() && isDocument() ) - { - sTitle = ::comphelper::DocumentInfo::getDocumentTitle( m_xDocument ); - } - return sTitle; - } - - - ::rtl::OUString ScriptDocument_Impl::getURL() const - { - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getURL: for documents only!" ); - - ::rtl::OUString sURL; - if ( isValid() && isDocument() ) - { - try - { - sURL = m_xDocument->getURL(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return sURL; - } - - - bool ScriptDocument_Impl::allowMacros() const - { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::allowMacros: for documents only!" ); - bool bAllow = false; - if ( isValid() && isDocument() ) - { - try - { - bAllow = m_xScriptAccess->getAllowMacroExecution(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return bAllow; - } - - - bool ScriptDocument_Impl::getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const - { - _out_rxFrame.clear(); - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getCurrentFrame: documents only!" ); - if ( !isValid() || !isDocument() ) - return false; - - try - { - Reference< XModel > xDocument( m_xDocument, UNO_SET_THROW ); - Reference< XController > xController( xDocument->getCurrentController(), UNO_SET_THROW ); - _out_rxFrame.set( xController->getFrame(), UNO_SET_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return _out_rxFrame.is(); - } - - - bool ScriptDocument_Impl::isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType ) - { - bool bIsShared = false; - try - { - Reference< XLibraryContainer2 > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW ); - - if ( !xLibContainer->hasByName( _rLibName ) || !xLibContainer->isLibraryLink( _rLibName ) ) - return false; - ::rtl::OUString aFileURL; - Reference< XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XUriReferenceFactory > xUriFac; - if ( xMSF.is() ) - { - xUriFac.set( - xMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" ) ) ), - UNO_QUERY_THROW ); - } - - ::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( _rLibName ) ); - Reference< XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY_THROW ); - - ::rtl::OUString aScheme = xUriRef->getScheme(); - if ( aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) - { - aFileURL = aLinkURL; - } - else if ( aScheme.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.pkg" ) ) - { - ::rtl::OUString aAuthority = xUriRef->getAuthority(); - if ( aAuthority.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.expand:" ) ) ) - { - ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) ); - aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - Reference< XComponentContext > xContext; - Reference< XPropertySet > xProps( xMSF, UNO_QUERY_THROW ); - xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW ); - Reference< XMacroExpander > xMacroExpander( - xContext->getValueByName( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ), - UNO_QUERY_THROW ); - aFileURL = xMacroExpander->expandMacros( aDecodedURL ); - } - } - - if ( aFileURL.getLength() ) - { - ::osl::DirectoryItem aFileItem; - ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); - OSL_VERIFY( ::osl::DirectoryItem::get( aFileURL, aFileItem ) == ::osl::FileBase::E_None ); - OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ); - ::rtl::OUString aCanonicalFileURL( aFileStatus.getFileURL() ); - - ::rtl::OUString aSearchURL1( RTL_CONSTASCII_USTRINGPARAM( "share/basic" ) ); - ::rtl::OUString aSearchURL2( RTL_CONSTASCII_USTRINGPARAM( "share/uno_packages" ) ); - ::rtl::OUString aSearchURL3( RTL_CONSTASCII_USTRINGPARAM( "share/extensions" ) ); - if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || - aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 || - aCanonicalFileURL.indexOf( aSearchURL3 ) != -1 ) - bIsShared = true; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return bIsShared; - } - - - void ScriptDocument_Impl::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentClosed( const ScriptDocument& _rDocument ) - { - DBG_TESTSOLARMUTEX(); - OSL_PRECOND( isValid(), "ScriptDocument_Impl::onDocumentClosed: should not be listening if I'm not valid!" ); - - bool bMyDocument = m_xDocument == _rDocument.getDocument(); - OSL_PRECOND( bMyDocument, "ScriptDocument_Impl::onDocumentClosed: didn't want to know *this*!" ); - if ( bMyDocument ) - { - m_bDocumentClosed = true; - } - } - - - void ScriptDocument_Impl::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - void ScriptDocument_Impl::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) - { - // not interested in - } - - //==================================================================== - //= ScriptDocument - //==================================================================== - ScriptDocument::ScriptDocument() - :m_pImpl( new ScriptDocument_Impl() ) - { - } - - - ScriptDocument::ScriptDocument( ScriptDocument::SpecialDocument _eType ) - :m_pImpl( new ScriptDocument_Impl( Reference< XModel >() ) ) - { - OSL_ENSURE( _eType == NoDocument, "ScriptDocument::ScriptDocument: unknown SpecialDocument type!" ); - (void)_eType; - } - - - ScriptDocument::ScriptDocument( const Reference< XModel >& _rxDocument ) - :m_pImpl( new ScriptDocument_Impl( _rxDocument ) ) - { - OSL_ENSURE( _rxDocument.is(), "ScriptDocument::ScriptDocument: document must not be NULL!" ); - // a NULL document results in an uninitialized instance, and for this - // purpose, there is a dedicated constructor - } - - - ScriptDocument::ScriptDocument( const ScriptDocument& _rSource ) - :m_pImpl( _rSource.m_pImpl ) - { - } - - - ScriptDocument::~ScriptDocument() - { - } - - - const ScriptDocument& ScriptDocument::getApplicationScriptDocument() - { - static ScriptDocument s_aApplicationScripts; - return s_aApplicationScripts; - } - - - ScriptDocument ScriptDocument::getDocumentForBasicManager( const BasicManager* _pManager ) - { - if ( _pManager == SFX_APP()->GetBasicManager() ) - return getApplicationScriptDocument(); - - docs::Documents aDocuments; - lcl_getAllModels_throw( aDocuments, false ); - - for ( docs::Documents::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - const BasicManager* pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( doc->xModel ); - if ( ( pDocBasicManager != SFX_APP()->GetBasicManager() ) - && ( pDocBasicManager == _pManager ) - ) - { - return ScriptDocument( doc->xModel ); - } - } - - OSL_FAIL( "ScriptDocument::getDocumentForBasicManager: did not find a document for this manager!" ); - return ScriptDocument( NoDocument ); - } - - - ScriptDocument ScriptDocument::getDocumentWithURLOrCaption( const ::rtl::OUString& _rUrlOrCaption ) - { - ScriptDocument aDocument( getApplicationScriptDocument() ); - if ( _rUrlOrCaption.getLength() == 0 ) - return aDocument; - - docs::Documents aDocuments; - lcl_getAllModels_throw( aDocuments, false ); - - for ( docs::Documents::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - const ScriptDocument aCheck = ScriptDocument( doc->xModel ); - if ( _rUrlOrCaption == aCheck.getTitle() - || _rUrlOrCaption == aCheck.getURL() - ) - { - aDocument = aCheck; - break; - } - } - - return aDocument; - } - - - namespace - { - struct DocumentTitleLess : public ::std::binary_function< ScriptDocument, ScriptDocument, bool > - { - DocumentTitleLess( const CollatorWrapper& _rCollator ) - :m_aCollator( _rCollator ) - { - } - - bool operator()( const ScriptDocument& _lhs, const ScriptDocument& _rhs ) const - { - return m_aCollator.compareString( _lhs.getTitle(), _rhs.getTitle() ) < 0; - } - private: - const CollatorWrapper m_aCollator; - }; - } - - - ScriptDocuments ScriptDocument::getAllScriptDocuments( ScriptDocument::ScriptDocumentList _eListType ) - { - ScriptDocuments aScriptDocs; - - // include application? - if ( _eListType == AllWithApplication ) - aScriptDocs.push_back( getApplicationScriptDocument() ); - - // obtain documents - try - { - docs::Documents aDocuments; - lcl_getAllModels_throw( aDocuments, true /* exclude invisible */ ); - - for ( docs::Documents::const_iterator doc = aDocuments.begin(); - doc != aDocuments.end(); - ++doc - ) - { - // exclude documents without script/library containers - ScriptDocument aDoc( doc->xModel ); - if ( !aDoc.isValid() ) - continue; - - aScriptDocs.push_back( aDoc ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - // sort document list by doc title? - if ( _eListType == DocumentsSorted ) - { - CollatorWrapper aCollator( ::comphelper::getProcessServiceFactory() ); - aCollator.loadDefaultCollator( SvtSysLocale().GetLocaleData().getLocale(), 0 ); - ::std::sort( aScriptDocs.begin(), aScriptDocs.end(), DocumentTitleLess( aCollator ) ); - } - - return aScriptDocs; - } - - - bool ScriptDocument::operator==( const ScriptDocument& _rhs ) const - { - return m_pImpl->getDocumentRef() == _rhs.m_pImpl->getDocumentRef(); - } - - - sal_Int32 ScriptDocument::hashCode() const - { - return sal::static_int_cast(reinterpret_cast< sal_IntPtr >( m_pImpl->getDocumentRef().get() )); - } - - - bool ScriptDocument::isValid() const - { - return m_pImpl->isValid(); - } - - - bool ScriptDocument::isAlive() const - { - return m_pImpl->isAlive(); - } - - - Reference< XLibraryContainer > ScriptDocument::getLibraryContainer( LibraryContainerType _eType ) const - { - return m_pImpl->getLibraryContainer( _eType ); - } - - - Reference< XNameContainer > ScriptDocument::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const - SAL_THROW((NoSuchElementException)) - { - return m_pImpl->getLibrary( _eType, _rLibName, _bLoadLibrary ); - } - - - bool ScriptDocument::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - return m_pImpl->hasLibrary( _eType, _rLibName ); - } - - - Reference< XNameContainer > ScriptDocument::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - return m_pImpl->getOrCreateLibrary( _eType, _rLibName ); - } - - - void ScriptDocument::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ) - { - m_pImpl->loadLibraryIfExists( _eType, _rLibrary ); - } - - - Sequence< ::rtl::OUString > ScriptDocument::getObjectNames( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - Sequence< ::rtl::OUString > aModuleNames; - - try - { - if ( hasLibrary( _eType, _rLibName ) ) - { - Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, false ) ); - if ( xLib.is() ) - aModuleNames = xLib->getElementNames(); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - // sort - ::std::sort( aModuleNames.getArray() , aModuleNames.getArray() + aModuleNames.getLength() , StringCompareLessThan ); - - return aModuleNames; - } - - - ::rtl::OUString ScriptDocument::createObjectName( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const - { - ::rtl::OUString aObjectName; - - ::rtl::OUString aBaseName = _eType == E_SCRIPTS - ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) ) - : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dialog" ) ); - - Sequence< ::rtl::OUString > aUsedNames( getObjectNames( _eType, _rLibName ) ); - ::std::set< ::rtl::OUString > aUsedNamesCheck; - ::std::copy( aUsedNames.getConstArray(), aUsedNames.getConstArray() + aUsedNames.getLength(), - ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aUsedNamesCheck, aUsedNamesCheck.begin() ) ); - - bool bValid = false; - sal_uInt16 i = 1; - while ( !bValid ) - { - aObjectName = aBaseName; - aObjectName += String::CreateFromInt32( i ); - - if ( aUsedNamesCheck.find( aObjectName ) == aUsedNamesCheck.end() ) - bValid = sal_True; - - ++i; - } - - return aObjectName; - } - - - Sequence< ::rtl::OUString > ScriptDocument::getLibraryNames() const - { - return BasicIDE::GetMergedLibraryNames( getLibraryContainer( E_SCRIPTS ), getLibraryContainer( E_DIALOGS ) ); - } - - - bool ScriptDocument::isReadOnly() const - { - return m_pImpl->isReadOnly(); - } - - - bool ScriptDocument::isApplication() const - { - return m_pImpl->isApplication(); - } - - bool ScriptDocument::isInVBAMode() const - { - return m_pImpl->isInVBAMode(); - } - - - BasicManager* ScriptDocument::getBasicManager() const - { - return m_pImpl->getBasicManager(); - } - - - Reference< XModel > ScriptDocument::getDocument() const - { - return m_pImpl->getDocument(); - } - - - Reference< XModel > ScriptDocument::getDocumentOrNull() const - { - if ( isDocument() ) - return m_pImpl->getDocument(); - return NULL; - } - - - bool ScriptDocument::removeModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) const - { - return m_pImpl->removeModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName ); - } - - - bool ScriptDocument::hasModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) const - { - return m_pImpl->hasModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName ); - } - - - bool ScriptDocument::getModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, ::rtl::OUString& _out_rModuleSource ) const - { - Any aCode; - if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) ) - return false; - OSL_VERIFY( aCode >>= _out_rModuleSource ); - return true; - } - - - bool ScriptDocument::renameModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName ) const - { - return m_pImpl->renameModuleOrDialog( E_SCRIPTS, _rLibName, _rOldName, _rNewName, NULL ); - } - - - bool ScriptDocument::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const - { - if ( !m_pImpl->createModule( _rLibName, _rModName, _bCreateMain, _out_rNewModuleCode ) ) - return false; - - // doc shell modified - BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? - return true; - } - - - bool ScriptDocument::insertModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const - { - return m_pImpl->insertModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, makeAny( _rModuleCode ) ); - } - - - bool ScriptDocument::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const - { - return m_pImpl->updateModule( _rLibName, _rModName, _rModuleCode ); - } - - - bool ScriptDocument::removeDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const - { - return m_pImpl->removeModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName ); - } - - - bool ScriptDocument::hasDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const - { - return m_pImpl->hasModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName ); - } - - - bool ScriptDocument::getDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const - { - Any aCode; - if ( !m_pImpl->getModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, aCode ) ) - return false; - OSL_VERIFY( aCode >>= _out_rDialogProvider ); - return _out_rDialogProvider.is(); - } - - - bool ScriptDocument::renameDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ) const - { - return m_pImpl->renameModuleOrDialog( E_DIALOGS, _rLibName, _rOldName, _rNewName, _rxExistingDialogModel ); - } - - - bool ScriptDocument::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const - { - if ( !m_pImpl->createDialog( _rLibName, _rDialogName, _out_rDialogProvider ) ) - return false; - - BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? - return true; - } - - - bool ScriptDocument::insertDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, const Reference< XInputStreamProvider >& _rxDialogProvider ) const - { - return m_pImpl->insertModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, makeAny( _rxDialogProvider ) ); - } - - - void ScriptDocument::setDocumentModified() const - { - m_pImpl->setDocumentModified(); - } - - - bool ScriptDocument::isDocumentModified() const - { - return m_pImpl->isDocumentModified(); - } - - - bool ScriptDocument::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const - { - return m_pImpl->saveDocument( _rxStatusIndicator ); - } - - - LibraryLocation ScriptDocument::getLibraryLocation( const ::rtl::OUString& _rLibName ) const - { - LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN; - if ( _rLibName.getLength() ) - { - if ( isDocument() ) - { - eLocation = LIBRARY_LOCATION_DOCUMENT; - } - else - { - if ( ( hasLibrary( E_SCRIPTS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_SCRIPTS ) ) - || ( hasLibrary( E_DIALOGS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_DIALOGS ) ) - ) - { - eLocation = LIBRARY_LOCATION_USER; - } - else - { - eLocation = LIBRARY_LOCATION_SHARE; - } - } - } - - return eLocation; - } - - - ::rtl::OUString ScriptDocument::getTitle( LibraryLocation _eLocation, LibraryType _eType ) const - { - ::rtl::OUString aTitle; - - switch ( _eLocation ) - { - case LIBRARY_LOCATION_USER: - { - switch ( _eType ) - { - case LIBRARY_TYPE_MODULE: aTitle = String( IDEResId( RID_STR_USERMACROS ) ); break; - case LIBRARY_TYPE_DIALOG: aTitle = String( IDEResId( RID_STR_USERDIALOGS ) ); break; - case LIBRARY_TYPE_ALL: aTitle = String( IDEResId( RID_STR_USERMACROSDIALOGS ) ); break; - default: - break; - } - break; - case LIBRARY_LOCATION_SHARE: - { - switch ( _eType ) - { - case LIBRARY_TYPE_MODULE: aTitle = String( IDEResId( RID_STR_SHAREMACROS ) ); break; - case LIBRARY_TYPE_DIALOG: aTitle = String( IDEResId( RID_STR_SHAREDIALOGS ) ); break; - case LIBRARY_TYPE_ALL: aTitle = String( IDEResId( RID_STR_SHAREMACROSDIALOGS ) ); break; - default: - break; - } - } - break; - case LIBRARY_LOCATION_DOCUMENT: - aTitle = getTitle(); - break; - default: - break; - } - } - - return aTitle; - } - - - ::rtl::OUString ScriptDocument::getTitle() const - { - return m_pImpl->getTitle(); - } - - - ::rtl::OUString ScriptDocument::getURL() const - { - return m_pImpl->getURL(); - } - - - bool ScriptDocument::isActive() const - { - bool bIsActive( false ); - try - { - Reference< XFrame > xFrame; - if ( m_pImpl->getCurrentFrame( xFrame ) ) - bIsActive = xFrame->isActive(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return bIsActive; - } - - - bool ScriptDocument::allowMacros() const - { - return m_pImpl->allowMacros(); - } - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx deleted file mode 100644 index a2a0c03c1..000000000 --- a/basctl/source/basicide/tbxctl.cxx +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include - - -#define _BASIDE_POPUPWINDOWTBX -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; - - -static ::rtl::OUString aSubToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" ) ); - -SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem ) - -/************************************************************************* -|* -|* Klasse fuer Toolbox -|* -\************************************************************************/ - -TbxControls::TbxControls( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - nLastSlot = USHRT_MAX; - - rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); - rTbx.Invalidate(); -} - -/************************************************************************* -|* -|* Wenn man ein PopupWindow erzeugen will -|* -\************************************************************************/ -SfxPopupWindowType TbxControls::GetPopupWindowType() const -{ - if( nLastSlot == USHRT_MAX ) - return(SFX_POPUPWINDOW_ONCLICK); - return(SFX_POPUPWINDOW_ONTIMEOUT); -} - -void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) -{ - if( pState ) - { - SfxAllEnumItem* pItem = PTR_CAST(SfxAllEnumItem, pState); - if( pItem ) - { - sal_uInt16 nLastEnum = pItem->GetValue(); - sal_uInt16 nTemp = 0; - switch( nLastEnum ) - { - case SVX_SNAP_PUSHBUTTON: nTemp = SID_INSERT_PUSHBUTTON; break; - case SVX_SNAP_CHECKBOX: nTemp = SID_INSERT_CHECKBOX; break; - case SVX_SNAP_RADIOBUTTON: nTemp = SID_INSERT_RADIOBUTTON; break; - case SVX_SNAP_SPINBUTTON: nTemp = SID_INSERT_SPINBUTTON; break; - case SVX_SNAP_FIXEDTEXT: nTemp = SID_INSERT_FIXEDTEXT; break; - case SVX_SNAP_GROUPBOX: nTemp = SID_INSERT_GROUPBOX; break; - case SVX_SNAP_LISTBOX: nTemp = SID_INSERT_LISTBOX; break; - case SVX_SNAP_COMBOBOX: nTemp = SID_INSERT_COMBOBOX; break; - case SVX_SNAP_EDIT: nTemp = SID_INSERT_EDIT; break; - case SVX_SNAP_HSCROLLBAR: nTemp = SID_INSERT_HSCROLLBAR; break; - case SVX_SNAP_VSCROLLBAR: nTemp = SID_INSERT_VSCROLLBAR; break; - case SVX_SNAP_PREVIEW: nTemp = SID_INSERT_PREVIEW; break; - case SVX_SNAP_URLBUTTON: nTemp = SID_INSERT_URLBUTTON; break; - case SVX_SNAP_IMAGECONTROL: nTemp = SID_INSERT_IMAGECONTROL; break; - case SVX_SNAP_PROGRESSBAR: nTemp = SID_INSERT_PROGRESSBAR; break; - case SVX_SNAP_HFIXEDLINE: nTemp = SID_INSERT_HFIXEDLINE; break; - case SVX_SNAP_VFIXEDLINE: nTemp = SID_INSERT_VFIXEDLINE; break; - case SVX_SNAP_DATEFIELD: nTemp = SID_INSERT_DATEFIELD; break; - case SVX_SNAP_TIMEFIELD: nTemp = SID_INSERT_TIMEFIELD; break; - case SVX_SNAP_NUMERICFIELD: nTemp = SID_INSERT_NUMERICFIELD; break; - case SVX_SNAP_CURRENCYFIELD: nTemp = SID_INSERT_CURRENCYFIELD; break; - case SVX_SNAP_FORMATTEDFIELD: nTemp = SID_INSERT_FORMATTEDFIELD; break; - case SVX_SNAP_PATTERNFIELD: nTemp = SID_INSERT_PATTERNFIELD; break; - case SVX_SNAP_FILECONTROL: nTemp = SID_INSERT_FILECONTROL; break; - case SVX_SNAP_TREECONTROL: nTemp = SID_INSERT_TREECONTROL; break; - } - if( nTemp ) - { - rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); - aSlotURL += rtl::OUString::valueOf( sal_Int32( nTemp )); - Image aImage = GetImage( m_xFrame, - aSlotURL, - hasBigImages() - ); - ToolBox& rBox = GetToolBox(); - rBox.SetItemImage(GetId(), aImage); - nLastSlot = nLastEnum; - } - } - } - SfxToolBoxControl::StateChanged( nSID, eState,pState ); -} - -void TbxControls::Select( sal_uInt16 nModifier ) -{ - (void)nModifier; - SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS, nLastSlot ); - SfxViewFrame* pCurFrame = SfxViewFrame::Current(); - DBG_ASSERT( pCurFrame != NULL, "No current view frame!" ); - SfxDispatcher* pDispatcher = pCurFrame ? pCurFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_CHOOSE_CONTROLS, SFX_CALLMODE_SYNCHRON, &aItem, 0L ); - } -} - -/************************************************************************* -|* -|* Hier wird das Fenster erzeugt -|* Lage der Toolbox mit GetToolBox() abfragbar -|* rItemRect sind die Screen-Koordinaten -|* -\************************************************************************/ -SfxPopupWindow* TbxControls::CreatePopupWindow() -{ - if ( GetSlotId() == SID_CHOOSE_CONTROLS ) - createAndPositionSubToolBar( aSubToolBarResName ); - - return(0); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/tbxctl.hrc b/basctl/source/basicide/tbxctl.hrc deleted file mode 100644 index ea4a1e471..000000000 --- a/basctl/source/basicide/tbxctl.hrc +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#define RID_TBXCONTROLS ( RID_BASICIDE_START + 65 ) -#define RID_TOOLBOX ( RID_BASICIDE_START + 66 ) diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx deleted file mode 100644 index 92115d652..000000000 --- a/basctl/source/basicide/tbxctl.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASIDE_TBXCTL_HXX -#define _BASIDE_TBXCTL_HXX - -#include -#include - -//------------------- -// class TbxControls -//------------------- -class TbxControls : public SfxToolBoxControl -{ -private: - - struct StateChangedInfo - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - bool bDisabled; - }; - - sal_uInt16 nLastSlot; - -protected: - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ); -public: - SFX_DECL_TOOLBOX_CONTROL(); - - TbxControls(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - ~TbxControls() {} - - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); - - using SfxToolBoxControl::Select; - void Select( sal_uInt16 nModifier ); -}; - - -#endif // _BASIDE_TBXCTL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx deleted file mode 100644 index 76b3057b6..000000000 --- a/basctl/source/basicide/unomodel.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "unomodel.hxx" -#include -#include - -#include -#include - -#include -#include - -using ::rtl::OUString; -using namespace ::cppu; -using namespace ::std; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; - -SIDEModel::SIDEModel( SfxObjectShell *pObjSh ) -: SfxBaseModel(pObjSh) -{ -} - -SIDEModel::~SIDEModel() -{ -} - -uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface ( rType, - // OWeakObject interfaces - static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ), - static_cast< XWeak* > ( this ), - static_cast< XServiceInfo* > ( this ) ); - if (!aRet.hasValue()) - aRet = SfxBaseModel::queryInterface ( rType ); - return aRet; -} - -void SAL_CALL SIDEModel::acquire() throw() -{ - SolarMutexGuard aGuard; - OWeakObject::acquire(); -} - -void SAL_CALL SIDEModel::release() throw() -{ - SolarMutexGuard aGuard; - OWeakObject::release(); -} - -uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) throw(uno::RuntimeException) -{ - uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); - sal_Int32 nLen = aTypes.getLength(); - aTypes.realloc(nLen + 1); - uno::Type* pTypes = aTypes.getArray(); - pTypes[nLen++] = ::getCppuType((Reference*)0); - - return aTypes; -} - -OUString SIDEModel::getImplementationName(void) throw( uno::RuntimeException ) -{ - return getImplementationName_Static(); -} - -::rtl::OUString SIDEModel::getImplementationName_Static() -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basic.BasicIDE" )); -} - -sal_Bool SIDEModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) -{ - return rServiceName == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" )); -} -uno::Sequence< OUString > SIDEModel::getSupportedServiceNames(void) throw( uno::RuntimeException ) -{ - return getSupportedServiceNames_Static(); -} - -uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static(void) -{ - uno::Sequence< OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" )); - return aRet; -} - -uno::Reference< uno::XInterface > SAL_CALL SIDEModel_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception ) -{ - SolarMutexGuard aGuard; - BasicIDEDLL::Init(); - SfxObjectShell* pShell = new BasicDocShell(); - return uno::Reference< uno::XInterface >( pShell->GetModel() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.hxx b/basctl/source/basicide/unomodel.hxx deleted file mode 100644 index 45333df93..000000000 --- a/basctl/source/basicide/unomodel.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef UNOMODEL_HXX -#define UNOMODEL_HXX - -#include -#include -#include - -//----------------------------------------------------------------------------- -class SIDEModel : public SfxBaseModel, - public com::sun::star::lang::XServiceInfo -{ -public: - SIDEModel( SfxObjectShell *pObjSh = 0 ); - virtual ~SIDEModel(); - - //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); - - //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) - 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(void) - throw( ::com::sun::star::uno::RuntimeException ); - - static ::com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static(); - static ::rtl::OUString getImplementationName_Static(); -}; - -com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SIDEModel_createInstance( - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr ) - throw( com::sun::star::uno::Exception ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx deleted file mode 100644 index 8b4e95a2c..000000000 --- a/basctl/source/dlged/dlged.cxx +++ /dev/null @@ -1,1361 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include "dlged.hxx" -#include "dlgedfunc.hxx" -#include "dlgedfac.hxx" -#include -#include "dlgedpage.hxx" -#include "dlgedview.hxx" -#include "dlgedobj.hxx" -#include "dlgedclip.hxx" -#include -#include "propbrw.hxx" -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// #i74769# -#include - -using namespace comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::io; -using ::rtl::OUString; - -static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )); -static ::rtl::OUString aDecorationPropName( RTL_CONSTASCII_USTRINGPARAM( "Decoration" )); -static ::rtl::OUString aTitlePropName( RTL_CONSTASCII_USTRINGPARAM( "Title" )); - - -//============================================================================ -// DlgEdHint -//============================================================================ - -TYPEINIT1( DlgEdHint, SfxHint ); - -DlgEdHint::DlgEdHint( DlgEdHintKind eHint ) - :eHintKind( eHint ) -{ -} - - -DlgEdHint::DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ) - :eHintKind( eHint ) - ,pDlgEdObj( pObj ) -{ -} - - -DlgEdHint::~DlgEdHint() -{ -} - - -//============================================================================ -// DlgEditor -//============================================================================ - -void DlgEditor::ShowDialog() -{ - uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - - // create a dialog - uno::Reference< awt::XControl > xDlg( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialog" ) ) ), uno::UNO_QUERY ); - - // clone the dialog model - uno::Reference< util::XCloneable > xC( m_xUnoControlDialogModel, uno::UNO_QUERY ); - uno::Reference< util::XCloneable > xNew = xC->createClone(); - uno::Reference< awt::XControlModel > xDlgMod( xNew, uno::UNO_QUERY ); - - uno::Reference< beans::XPropertySet > xSrcDlgModPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY ); - uno::Reference< beans::XPropertySet > xNewDlgModPropSet( xDlgMod, uno::UNO_QUERY ); - if( xNewDlgModPropSet.is() ) - { - if( xSrcDlgModPropSet.is() ) - { - try - { - Any aResourceResolver = xSrcDlgModPropSet->getPropertyValue( aResourceResolverPropName ); - xNewDlgModPropSet->setPropertyValue( aResourceResolverPropName, aResourceResolver ); - } - catch( UnknownPropertyException& ) - { - OSL_FAIL( "DlgEditor::ShowDialog(): No ResourceResolver property" ); - } - } - - // Disable decoration - bool bDecoration = true; - try - { - Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName ); - aDecorationAny >>= bDecoration; - if( !bDecoration ) - { - xNewDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) ); - xNewDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) ); - } - } - catch( UnknownPropertyException& ) - {} - } - - // set the model - xDlg->setModel( xDlgMod ); - - // create a peer - uno::Reference< awt::XToolkit> xToolkit( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.ExtToolkit" ) ) ), uno::UNO_QUERY ); - xDlg->createPeer( xToolkit, pWindow->GetComponentInterface() ); - - uno::Reference< awt::XDialog > xD( xDlg, uno::UNO_QUERY ); - xD->execute(); - - uno::Reference< lang::XComponent > xComponent(xDlg, uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); -} - - -sal_Bool DlgEditor::UnmarkDialog() -{ - SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0); - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - - sal_Bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj ); - - if( bWasMarked ) - pDlgEdView->MarkObj( pDlgObj, pPgView, sal_True ); - - return bWasMarked; -} - - -sal_Bool DlgEditor::RemarkDialog() -{ - SdrObject* pDlgObj = pDlgEdModel->GetPage(0)->GetObj(0); - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - - sal_Bool bWasMarked = pDlgEdView->IsObjMarked( pDlgObj ); - - if( !bWasMarked ) - pDlgEdView->MarkObj( pDlgObj, pPgView, sal_False ); - - return bWasMarked; -} - - -DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ) - :pHScroll(NULL) - ,pVScroll(NULL) - ,pDlgEdModel(NULL) - ,pDlgEdPage(NULL) - ,pDlgEdView(NULL) - ,pDlgEdForm(NULL) - ,m_xUnoControlDialogModel(NULL) - ,m_ClipboardDataFlavors(1) - ,m_ClipboardDataFlavorsResource(2) - ,pObjFac(NULL) - ,pWindow(NULL) - ,pFunc(NULL) - ,eMode( DLGED_SELECT ) - ,eActObj( OBJ_DLG_PUSHBUTTON ) - ,bFirstDraw(sal_False) - ,aGridSize( 100, 100 ) // 100TH_MM - ,bGridVisible(sal_False) - ,bGridSnap(sal_True) - ,bCreateOK(sal_True) - ,bDialogModelChanged(sal_False) - ,mnPaintGuard(0) - ,m_xDocument( xModel ) -{ - pDlgEdModel = new DlgEdModel(); - pDlgEdModel->GetItemPool().FreezeIdRanges(); - pDlgEdModel->SetScaleUnit( MAP_100TH_MM ); - - SdrLayerAdmin& rAdmin = pDlgEdModel->GetLayerAdmin(); - rAdmin.NewLayer( rAdmin.GetControlLayerName() ); - rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ) ); - - pDlgEdPage = new DlgEdPage( *pDlgEdModel ); - pDlgEdModel->InsertPage( pDlgEdPage ); - - pObjFac = new DlgEdFactory(); - - pFunc = new DlgEdFuncSelect( this ); - - // set clipboard data flavors - m_ClipboardDataFlavors[0].MimeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.xml.dialog" )); - m_ClipboardDataFlavors[0].HumanPresentableName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dialog 6.0" )); - m_ClipboardDataFlavors[0].DataType = ::getCppuType( (const Sequence< sal_Int8 >*) 0 ); - - m_ClipboardDataFlavorsResource[0] = m_ClipboardDataFlavors[0]; - m_ClipboardDataFlavorsResource[1].MimeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.xml.dialogwithresource" )); - m_ClipboardDataFlavorsResource[1].HumanPresentableName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dialog 8.0" )); - m_ClipboardDataFlavorsResource[1].DataType = ::getCppuType( (const Sequence< sal_Int8 >*) 0 ); - - aPaintTimer.SetTimeout( 1 ); - aPaintTimer.SetTimeoutHdl( LINK( this, DlgEditor, PaintTimeout ) ); - - aMarkTimer.SetTimeout( 100 ); - aMarkTimer.SetTimeoutHdl( LINK( this, DlgEditor, MarkTimeout ) ); -} - - -DlgEditor::~DlgEditor() -{ - aPaintTimer.Stop(); - aMarkTimer.Stop(); - - ::comphelper::disposeComponent( m_xControlContainer ); - - delete pObjFac; - delete pFunc; - delete pDlgEdView; - delete pDlgEdModel; -} - - -Reference< awt::XControlContainer > DlgEditor::GetWindowControlContainer() -{ - if ( !m_xControlContainer.is() && pWindow ) - m_xControlContainer = VCLUnoHelper::CreateControlContainer( pWindow ); - return m_xControlContainer; -} - - -void DlgEditor::SetWindow( Window* pWindow_ ) -{ - DlgEditor::pWindow = pWindow_; - pWindow_->SetMapMode( MapMode( MAP_100TH_MM ) ); - pDlgEdPage->SetSize( pWindow_->PixelToLogic( Size( DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN ) ) ); - - pDlgEdView = new DlgEdView( pDlgEdModel, pWindow_, this ); - pDlgEdView->ShowSdrPage(pDlgEdView->GetModel()->GetPage(0)); - pDlgEdView->SetLayerVisible( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), sal_False ); - pDlgEdView->SetMoveSnapOnlyTopLeft( sal_True ); - pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), pDlgEdPage->GetSize() ) ); - - pDlgEdView->SetGridCoarse( aGridSize ); - pDlgEdView->SetSnapGridWidth(Fraction(aGridSize.Width(), 1), Fraction(aGridSize.Height(), 1)); - pDlgEdView->SetGridSnap( bGridSnap ); - pDlgEdView->SetGridVisible( bGridVisible ); - pDlgEdView->SetDragStripes( sal_False ); - - pDlgEdView->SetDesignMode( sal_True ); - - ::comphelper::disposeComponent( m_xControlContainer ); -} - - -void DlgEditor::SetScrollBars( ScrollBar* pHS, ScrollBar* pVS ) -{ - pHScroll = pHS; - pVScroll = pVS; - - InitScrollBars(); -} - - -void DlgEditor::InitScrollBars() -{ - DBG_ASSERT( pHScroll, "DlgEditor::InitScrollBars: no horizontal scroll bar!" ); - DBG_ASSERT( pVScroll, "DlgEditor::InitScrollBars: no vertical scroll bar!" ); - if ( !pHScroll || !pVScroll ) - return; - - Size aOutSize = pWindow->GetOutputSize(); - Size aPgSize = pDlgEdPage->GetSize(); - - pHScroll->SetRange( Range( 0, aPgSize.Width() )); - pVScroll->SetRange( Range( 0, aPgSize.Height() )); - pHScroll->SetVisibleSize( (sal_uLong)aOutSize.Width() ); - pVScroll->SetVisibleSize( (sal_uLong)aOutSize.Height() ); - - pHScroll->SetLineSize( aOutSize.Width() / 10 ); - pVScroll->SetLineSize( aOutSize.Height() / 10 ); - pHScroll->SetPageSize( aOutSize.Width() / 2 ); - pVScroll->SetPageSize( aOutSize.Height() / 2 ); - - DoScroll( pHScroll ); - DoScroll( pVScroll ); -} - - -void DlgEditor::DoScroll( ScrollBar* ) -{ - if( !pHScroll || !pVScroll ) - return; - - MapMode aMap = pWindow->GetMapMode(); - Point aOrg = aMap.GetOrigin(); - - Size aScrollPos( pHScroll->GetThumbPos(), pVScroll->GetThumbPos() ); - aScrollPos = pWindow->LogicToPixel( aScrollPos ); - aScrollPos = pWindow->PixelToLogic( aScrollPos ); - - long nX = aScrollPos.Width() + aOrg.X(); - long nY = aScrollPos.Height() + aOrg.Y(); - - if( !nX && !nY ) - return; - - pWindow->Update(); - - // #i31562# - // When scrolling, someone was rescuing the Wallpaper and forced the window scroll to - // be done without background refresh. I do not know why, but that causes the repaint - // problems. Taking that out. - // Wallpaper aOldBackground = pWindow->GetBackground(); - // pWindow->SetBackground(); - - // #i74769# children should be scrolled - pWindow->Scroll( -nX, -nY, SCROLL_CHILDREN); - aMap.SetOrigin( Point( -aScrollPos.Width(), -aScrollPos.Height() ) ); - pWindow->SetMapMode( aMap ); - pWindow->Update(); - - DlgEdHint aHint( DLGED_HINT_WINDOWSCROLLED ); - Broadcast( aHint ); -} - - -void DlgEditor::UpdateScrollBars() -{ - MapMode aMap = pWindow->GetMapMode(); - Point aOrg = aMap.GetOrigin(); - - if ( pHScroll ) - pHScroll->SetThumbPos( -aOrg.X() ); - - if ( pVScroll ) - pVScroll->SetThumbPos( -aOrg.Y() ); -} - - -void DlgEditor::SetDialog( uno::Reference< container::XNameContainer > xUnoControlDialogModel ) -{ - // set dialog model - m_xUnoControlDialogModel = xUnoControlDialogModel; - - // create dialog form - pDlgEdForm = new DlgEdForm(); - uno::Reference< awt::XControlModel > xDlgMod( m_xUnoControlDialogModel , uno::UNO_QUERY ); - pDlgEdForm->SetUnoControlModel(xDlgMod); - pDlgEdForm->SetDlgEditor( this ); - ((DlgEdPage*)pDlgEdModel->GetPage(0))->SetDlgEdForm( pDlgEdForm ); - pDlgEdModel->GetPage(0)->InsertObject( pDlgEdForm ); - AdjustPageSize(); - pDlgEdForm->SetRectFromProps(); - pDlgEdForm->UpdateTabIndices(); // for backward compatibility - pDlgEdForm->StartListening(); - - // create controls - Reference< ::com::sun::star::container::XNameAccess > xNameAcc( m_xUnoControlDialogModel, UNO_QUERY ); - if ( xNameAcc.is() ) - { - // get sequence of control names - Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - - // create a map of tab indices and control names, sorted by tab index - IndexToNameMap aIndexToNameMap; - for ( sal_Int32 i = 0; i < nCtrls; ++i ) - { - // get name - ::rtl::OUString aName( pNames[i] ); - - // get tab index - sal_Int16 nTabIndex = -1; - Any aCtrl = xNameAcc->getByName( aName ); - Reference< ::com::sun::star::beans::XPropertySet > xPSet; - aCtrl >>= xPSet; - if ( xPSet.is() ) - xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex; - - // insert into map - aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) ); - } - - // create controls and insert them into drawing page - for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt ) - { - Any aCtrl = xNameAcc->getByName( aIt->second ); - Reference< ::com::sun::star::awt::XControlModel > xCtrlModel; - aCtrl >>= xCtrlModel; - DlgEdObj* pCtrlObj = new DlgEdObj(); - pCtrlObj->SetUnoControlModel( xCtrlModel ); - pCtrlObj->SetDlgEdForm( pDlgEdForm ); - pDlgEdForm->AddChild( pCtrlObj ); - pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj ); - pCtrlObj->SetRectFromProps(); - pCtrlObj->UpdateStep(); - pCtrlObj->StartListening(); - } - } - - bFirstDraw = sal_True; - - pDlgEdModel->SetChanged( sal_False ); -} - -void DlgEditor::ResetDialog( void ) -{ - DlgEdForm* pOldDlgEdForm = pDlgEdForm; - DlgEdPage* pPage = (DlgEdPage*)pDlgEdModel->GetPage(0); - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - sal_Bool bWasMarked = pDlgEdView->IsObjMarked( pOldDlgEdForm ); - pDlgEdView->UnmarkAll(); - pPage->Clear(); - pPage->SetDlgEdForm( NULL ); - SetDialog( m_xUnoControlDialogModel ); - if( bWasMarked ) - pDlgEdView->MarkObj( pDlgEdForm, pPgView, sal_False ); -} - - -Reference< util::XNumberFormatsSupplier > const & DlgEditor::GetNumberFormatsSupplier() -{ - if ( !m_xSupplier.is() ) - { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference< util::XNumberFormatsSupplier > xSupplier( xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier") ) ), UNO_QUERY ); - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !m_xSupplier.is() ) - { - m_xSupplier = xSupplier; - } - } - return m_xSupplier; -} - - -void DlgEditor::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( pWindow ) - pWindow->GrabFocus(); - pFunc->MouseButtonDown( rMEvt ); -} - - -void DlgEditor::MouseButtonUp( const MouseEvent& rMEvt ) -{ - sal_Bool bRet = pFunc->MouseButtonUp( rMEvt ); - - if( (eMode == DLGED_INSERT) ) - bCreateOK = bRet; -} - - -void DlgEditor::MouseMove( const MouseEvent& rMEvt ) -{ - pFunc->MouseMove( rMEvt ); -} - - -sal_Bool DlgEditor::KeyInput( const KeyEvent& rKEvt ) -{ - return pFunc->KeyInput( rKEvt ); -} - - -void DlgEditor::Paint( const Rectangle& rRect ) -{ - aPaintRect = rRect; - PaintTimeout( &aPaintTimer ); -} - - -IMPL_LINK( DlgEditor, PaintTimeout, Timer *, EMPTYARG ) -{ - if( !pDlgEdView ) - return 0; - - mnPaintGuard++; - - Size aMacSize; - if( bFirstDraw && - pWindow->IsVisible() && - (pWindow->GetOutputSize() != aMacSize) ) - { - bFirstDraw = sal_False; - - // get property set - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet(pDlgEdForm->GetUnoControlModel(), ::com::sun::star::uno::UNO_QUERY); - - if ( xPSet.is() ) - { - // get dialog size from properties - sal_Int32 nWidth = 0, nHeight = 0; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight; - - if ( nWidth == 0 && nHeight == 0 ) - { - Size aSize = pWindow->PixelToLogic( Size( 400, 300 ) ); - - // align with grid - Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY())); - aSize.Width() -= aSize.Width() % aGridSize_.Width(); - aSize.Height() -= aSize.Height() % aGridSize_.Height(); - - Point aPos; - Size aOutSize = pWindow->GetOutputSize(); - aPos.X() = (aOutSize.Width()>>1) - (aSize.Width()>>1); - aPos.Y() = (aOutSize.Height()>>1) - (aSize.Height()>>1); - - // align with grid - aPos.X() -= aPos.X() % aGridSize_.Width(); - aPos.Y() -= aPos.Y() % aGridSize_.Height(); - - // don't put in the corner - Point aMinPos = pWindow->PixelToLogic( Point( 30, 20 ) ); - if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) ) - { - aPos = aMinPos; - aPos.X() -= aPos.X() % aGridSize_.Width(); - aPos.Y() -= aPos.Y() % aGridSize_.Height(); - } - - // set dialog position and size - pDlgEdForm->SetSnapRect( Rectangle( aPos, aSize ) ); - pDlgEdForm->EndListening(sal_False); - pDlgEdForm->SetPropsFromRect(); - pDlgEdForm->GetDlgEditor()->SetDialogModelChanged(sal_True); - pDlgEdForm->StartListening(); - - // set position and size of controls - sal_uLong nObjCount; - if ( pDlgEdPage && ( ( nObjCount = pDlgEdPage->GetObjCount() ) > 0 ) ) - { - for ( sal_uLong i = 0 ; i < nObjCount ; i++ ) - { - SdrObject* pObj = pDlgEdPage->GetObj(i); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) - pDlgEdObj->SetRectFromProps(); - } - } - } - } - } - - // repaint, get PageView and prepare Region - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - const Region aPaintRectRegion(aPaintRect); - - - // #i74769# - SdrPaintWindow* pTargetPaintWindow = 0; - - // mark repaint start - if(pPgView) - { - pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(pWindow, aPaintRectRegion); - OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)"); - } - - // draw background self using wallpaper - // #i79128# ...and use correct OutDev for that - if(pTargetPaintWindow) - { - OutputDevice& rTargetOutDev = pTargetPaintWindow->GetTargetOutputDevice(); - rTargetOutDev.DrawWallpaper(aPaintRect, Wallpaper(Color(COL_WHITE))); - } - - // do paint (unbuffered) and mark repaint end - if(pPgView) - { - // paint of control layer is done in EndDrawLayers anyway... - pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true); - } - - mnPaintGuard--; - - DBG_ASSERT(pWindow,"Window not set"); - return 0; -} - - -IMPL_LINK( DlgEditor, MarkTimeout, Timer *, EMPTYARG ) -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SHOW_PROPERTYBROWSER ) : NULL; - if ( !pChildWin ) - return 0L; - - ((PropBrw*)(pChildWin->GetWindow()))->Update( pIDEShell ); - - return 1; -} - - -void DlgEditor::SetMode( DlgEdMode eNewMode ) -{ - if ( eNewMode != eMode ) - { - delete pFunc; - - if ( eNewMode == DLGED_INSERT ) - pFunc = new DlgEdFuncInsert( this ); - else - pFunc = new DlgEdFuncSelect( this ); - - if ( eNewMode == DLGED_READONLY ) - pDlgEdModel->SetReadOnly( sal_True ); - else - pDlgEdModel->SetReadOnly( sal_False ); - } - - if ( eNewMode == DLGED_TEST ) - ShowDialog(); - - eMode = eNewMode; -} - - -void DlgEditor::SetInsertObj( sal_uInt16 eObj ) -{ - eActObj = eObj; - - if( pDlgEdView ) - pDlgEdView->SetCurrentObj( eActObj, DlgInventor ); -} - - -sal_uInt16 DlgEditor::GetInsertObj() const -{ - return eActObj; -} - - -void DlgEditor::CreateDefaultObject() -{ - // create object by factory - SdrObject* pObj = SdrObjFactory::MakeNewObject( pDlgEdView->GetCurrentObjInventor(), pDlgEdView->GetCurrentObjIdentifier(), pDlgEdPage ); - - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj ); - if ( pDlgEdObj ) - { - // set position and size - Size aSize = pWindow->PixelToLogic( Size( 96, 24 ) ); - Point aPoint = (pDlgEdForm->GetSnapRect()).Center(); - aPoint.X() -= aSize.Width() / 2; - aPoint.Y() -= aSize.Height() / 2; - pDlgEdObj->SetSnapRect( Rectangle( aPoint, aSize ) ); - - // set default property values - pDlgEdObj->SetDefaults(); - - // insert object into drawing page - SdrPageView* pPageView = pDlgEdView->GetSdrPageView(); - pDlgEdView->InsertObjectAtView( pDlgEdObj, *pPageView); - - // start listening - pDlgEdObj->StartListening(); - } -} - - -void DlgEditor::Cut() -{ - Copy(); - Delete(); -} - - -void implCopyStreamToByteSequence( Reference< XInputStream > xStream, - Sequence< sal_Int8 >& bytes ) -{ - sal_Int32 nRead = xStream->readBytes( bytes, xStream->available() ); - for (;;) - { - Sequence< sal_Int8 > readBytes; - nRead = xStream->readBytes( readBytes, 1024 ); - if (! nRead) - break; - - sal_Int32 nPos = bytes.getLength(); - bytes.realloc( nPos + nRead ); - ::rtl_copyMemory( bytes.getArray() + nPos, readBytes.getConstArray(), (sal_uInt32)nRead ); - } -} - -void DlgEditor::Copy() -{ - if( !pDlgEdView->AreObjectsMarked() ) - return; - - // stop all drawing actions - pDlgEdView->BrkAction(); - - // create an empty clipboard dialog model - Reference< util::XCloneable > xClone( m_xUnoControlDialogModel, UNO_QUERY ); - Reference< util::XCloneable > xNewClone = xClone->createClone(); - Reference< container::XNameContainer > xClipDialogModel( xNewClone, UNO_QUERY ); - - Reference< container::XNameAccess > xNAcc( xClipDialogModel, UNO_QUERY ); - if ( xNAcc.is() ) - { - Sequence< OUString > aNames = xNAcc->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_uInt32 nCtrls = aNames.getLength(); - - for ( sal_uInt32 n = 0; n < nCtrls; n++ ) - { - xClipDialogModel->removeByName( pNames[n] ); - } - } - - // insert control models of marked objects into clipboard dialog model - sal_uLong nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount(); - for( sal_uLong i = 0; i < nMark; i++ ) - { - SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj(); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - - if (pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) - { - ::rtl::OUString aName; - Reference< beans::XPropertySet > xMarkPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY); - if (xMarkPSet.is()) - { - xMarkPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName; - } - - Reference< container::XNameAccess > xNameAcc(m_xUnoControlDialogModel, UNO_QUERY ); - if ( xNameAcc.is() && xNameAcc->hasByName(aName) ) - { - Any aCtrl = xNameAcc->getByName( aName ); - - // clone control model - Reference< util::XCloneable > xCtrl; - aCtrl >>= xCtrl; - Reference< util::XCloneable > xNewCtrl = xCtrl->createClone(); - Any aNewCtrl; - aNewCtrl <<= xNewCtrl; - - if (xClipDialogModel.is()) - xClipDialogModel->insertByName( aName , aNewCtrl ); - } - } - } - - // export clipboard dialog model to xml - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument ); - Reference< XInputStream > xStream( xISP->createInputStream() ); - Sequence< sal_Int8 > DialogModelBytes; - implCopyStreamToByteSequence( xStream, DialogModelBytes ); - xStream->closeInput(); - - // set clipboard content - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); - if ( xClipboard.is() ) - { - // With resource? - uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY ); - uno::Reference< resource::XStringResourcePersistence > xStringResourcePersistence; - if( xDialogModelPropSet.is() ) - { - try - { - Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName ); - aResourceResolver >>= xStringResourcePersistence; - } - catch( UnknownPropertyException& ) - {} - } - - DlgEdTransferableImpl* pTrans = NULL; - if( xStringResourcePersistence.is() ) - { - // With resource, support old and new format - - // Export xClipDialogModel another time with ids replaced by current language string - uno::Reference< resource::XStringResourceManager > - xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY ); - LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager ); - Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument ); - Reference< XInputStream > xStream2( xISP2->createInputStream() ); - Sequence< sal_Int8 > NoResourceDialogModelBytes; - implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes ); - xStream2->closeInput(); - - // Old format contains dialog with replaced ids - Sequence< Any > aSeqData(2); - Any aNoResourceDialogModelBytesAny; - aNoResourceDialogModelBytesAny <<= NoResourceDialogModelBytes; - aSeqData[0] = aNoResourceDialogModelBytesAny; - - // New format contains dialog and resource - Sequence< sal_Int8 > aResData = xStringResourcePersistence->exportBinary(); - - // Create sequence for combined dialog and resource - sal_Int32 nDialogDataLen = DialogModelBytes.getLength(); - sal_Int32 nResDataLen = aResData.getLength(); - - // Combined data = 4 Bytes 32Bit Offset to begin of resource data, lowest byte first - // + nDialogDataLen bytes dialog data + nResDataLen resource data - sal_Int32 nTotalLen = 4 + nDialogDataLen + nResDataLen; - sal_Int32 nResOffset = 4 + nDialogDataLen; - Sequence< sal_Int8 > aCombinedData( nTotalLen ); - sal_Int8* pCombinedData = aCombinedData.getArray(); - - // Write offset - sal_Int32 n = nResOffset; - for( sal_Int16 i = 0 ; i < 4 ; i++ ) - { - pCombinedData[i] = sal_Int8( n & 0xff ); - n >>= 8; - } - ::rtl_copyMemory( pCombinedData + 4, DialogModelBytes.getConstArray(), nDialogDataLen ); - ::rtl_copyMemory( pCombinedData + nResOffset, aResData.getConstArray(), nResDataLen ); - - Any aCombinedDataAny; - aCombinedDataAny <<= aCombinedData; - aSeqData[1] = aCombinedDataAny; - - pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, aSeqData ); - } - else - { - // No resource, support only old format - Sequence< Any > aSeqData(1); - Any aDialogModelBytesAny; - aDialogModelBytesAny <<= DialogModelBytes; - aSeqData[0] = aDialogModelBytesAny; - pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , aSeqData ); - } - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - xClipboard->setContents( pTrans , pTrans ); - Application::AcquireSolarMutex( nRef ); - } -} - - -void DlgEditor::Paste() -{ - // stop all drawing actions - pDlgEdView->BrkAction(); - - // unmark all objects - pDlgEdView->UnmarkAll(); - - // get clipboard - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); - if ( xClipboard.is() ) - { - // get clipboard content - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents(); - Application::AcquireSolarMutex( nRef ); - if ( xTransf.is() ) - { - // Is target dialog (library) localized? - uno::Reference< beans::XPropertySet > xDialogModelPropSet( m_xUnoControlDialogModel, uno::UNO_QUERY ); - uno::Reference< resource::XStringResourceManager > xStringResourceManager; - if( xDialogModelPropSet.is() ) - { - try - { - Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName ); - aResourceResolver >>= xStringResourceManager; - } - catch( UnknownPropertyException& ) - {} - } - bool bLocalized = false; - if( xStringResourceManager.is() ) - bLocalized = ( xStringResourceManager->getLocales().getLength() > 0 ); - - if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) ) - { - // create clipboard dialog model from xml - Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - Reference< container::XNameContainer > xClipDialogModel( xMSF->createInstance - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), - uno::UNO_QUERY ); - - bool bSourceIsLocalized = false; - Sequence< sal_Int8 > DialogModelBytes; - Sequence< sal_Int8 > aResData; - if( bLocalized && xTransf->isDataFlavorSupported( m_ClipboardDataFlavorsResource[1] ) ) - { - bSourceIsLocalized = true; - - Any aCombinedDataAny = xTransf->getTransferData( m_ClipboardDataFlavorsResource[1] ); - Sequence< sal_Int8 > aCombinedData; - aCombinedDataAny >>= aCombinedData; - const sal_Int8* pCombinedData = aCombinedData.getConstArray(); - - sal_Int32 nTotalLen = aCombinedData.getLength(); - - // Reading offset - sal_Int32 nResOffset = 0; - sal_Int32 nFactor = 1; - for( sal_Int16 i = 0; i < 4; i++ ) - { - nResOffset += nFactor * sal_uInt8( pCombinedData[i] ); - nFactor *= 256; - } - - sal_Int32 nResDataLen = nTotalLen - nResOffset; - sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4; - - DialogModelBytes.realloc( nDialogDataLen ); - ::rtl_copyMemory( DialogModelBytes.getArray(), pCombinedData + 4, nDialogDataLen ); - - aResData.realloc( nResDataLen ); - ::rtl_copyMemory( aResData.getArray(), pCombinedData + nResOffset, nResDataLen ); - } - else - { - Any aAny = xTransf->getTransferData( m_ClipboardDataFlavors[0] ); - aAny >>= DialogModelBytes; - } - - if ( xClipDialogModel.is() ) - { - Reference< XComponentContext > xContext; - Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY ); - OSL_ASSERT( xProps.is() ); - OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); - ::xmlscript::importDialogModel( ::xmlscript::createInputStream( rtl::ByteSequence(DialogModelBytes.getArray(), DialogModelBytes.getLength()) ) , xClipDialogModel, xContext, m_xDocument ); - } - - // get control models from clipboard dialog model - Reference< ::com::sun::star::container::XNameAccess > xNameAcc( xClipDialogModel, UNO_QUERY ); - if ( xNameAcc.is() ) - { - Sequence< OUString > aNames = xNameAcc->getElementNames(); - const OUString* pNames = aNames.getConstArray(); - sal_uInt32 nCtrls = aNames.getLength(); - - Reference< resource::XStringResourcePersistence > xStringResourcePersistence; - if( nCtrls > 0 && bSourceIsLocalized ) - { - Reference< lang::XMultiServiceFactory > xSMgr = getProcessServiceFactory(); - xStringResourcePersistence = Reference< resource::XStringResourcePersistence >( xSMgr->createInstance - ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.resource.StringResource" )) ), UNO_QUERY ); - if( xStringResourcePersistence.is() ) - xStringResourcePersistence->importBinary( aResData ); - } - for( sal_uInt32 n = 0; n < nCtrls; n++ ) - { - Any aA = xNameAcc->getByName( pNames[n] ); - Reference< ::com::sun::star::awt::XControlModel > xCM; - aA >>= xCM; - - // clone the control model - Reference< util::XCloneable > xClone( xCM, uno::UNO_QUERY ); - Reference< awt::XControlModel > xCtrlModel( xClone->createClone(), uno::UNO_QUERY ); - - DlgEdObj* pCtrlObj = new DlgEdObj(); - pCtrlObj->SetDlgEdForm(pDlgEdForm); // set parent form - pDlgEdForm->AddChild(pCtrlObj); // add child to parent form - pCtrlObj->SetUnoControlModel( xCtrlModel ); // set control model - - // set new name - ::rtl::OUString aOUniqueName( pCtrlObj->GetUniqueName() ); - Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY ); - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); - - // set tabindex - Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY ); - Sequence< OUString > aNames_ = xNA->getElementNames(); - Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames_.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - - if( bLocalized ) - { - Any aControlAny; - aControlAny <<= xCtrlModel; - if( bSourceIsLocalized && xStringResourcePersistence.is() ) - { - Reference< resource::XStringResourceResolver > - xSourceStringResolver( xStringResourcePersistence, UNO_QUERY ); - LocalizationMgr::copyResourcesForPastedEditorObject( this, - aControlAny, aOUniqueName, xSourceStringResolver ); - } - else - { - LocalizationMgr::setControlResourceIDsForNewEditorObject - ( this, aControlAny, aOUniqueName ); - } - } - - // insert control model in editor dialog model - Any aCtrlModel; - aCtrlModel <<= xCtrlModel; - m_xUnoControlDialogModel->insertByName( aOUniqueName , aCtrlModel ); - - // insert object into drawing page - pDlgEdModel->GetPage(0)->InsertObject( pCtrlObj ); - pCtrlObj->SetRectFromProps(); - pCtrlObj->UpdateStep(); - pDlgEdForm->UpdateTabOrderAndGroups(); - pCtrlObj->StartListening(); // start listening - - // mark object - SdrPageView* pPgView = pDlgEdView->GetSdrPageView(); - pDlgEdView->MarkObj( pCtrlObj, pPgView, sal_False, sal_True); - } - - // center marked objects in dialog editor form - Point aMarkCenter = (pDlgEdView->GetMarkedObjRect()).Center(); - Point aFormCenter = (pDlgEdForm->GetSnapRect()).Center(); - Point aPoint = aFormCenter - aMarkCenter; - Size aSize( aPoint.X() , aPoint.Y() ); - pDlgEdView->MoveMarkedObj( aSize ); // update of control model properties (position + size) in NbcMove - pDlgEdView->MarkListHasChanged(); - - // dialog model changed - SetDialogModelChanged(sal_True); - } - } - } - } -} - - -void DlgEditor::Delete() -{ - if( !pDlgEdView->AreObjectsMarked() ) - return; - - // remove control models of marked objects from dialog model - sal_uLong nMark = pDlgEdView->GetMarkedObjectList().GetMarkCount(); - - for( sal_uLong i = 0; i < nMark; i++ ) - { - SdrObject* pObj = pDlgEdView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj(); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) - { - // get name from property - ::rtl::OUString aName; - uno::Reference< beans::XPropertySet > xPSet(pDlgEdObj->GetUnoControlModel(), uno::UNO_QUERY); - if (xPSet.is()) - { - xPSet->getPropertyValue( DLGED_PROP_NAME ) >>= aName; - } - - // remove control from dialog model - Reference< ::com::sun::star::container::XNameAccess > xNameAcc(pDlgEdObj->GetDlgEdForm()->GetUnoControlModel(), UNO_QUERY ); - if ( xNameAcc.is() && xNameAcc->hasByName(aName) ) - { - Reference< ::com::sun::star::container::XNameContainer > xCont(xNameAcc, UNO_QUERY ); - if ( xCont.is() ) - { - if( xCont->hasByName( aName ) ) - { - Any aAny = xCont->getByName( aName ); - LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( this, aAny, aName ); - } - xCont->removeByName( aName ); - } - } - - // remove child from parent form - pDlgEdForm->RemoveChild( pDlgEdObj ); - } - } - - // update tab indices - pDlgEdForm->UpdateTabIndices(); - - pDlgEdView->BrkAction(); - - sal_Bool bDlgMarked = UnmarkDialog(); - pDlgEdView->DeleteMarked(); - if( bDlgMarked ) - RemarkDialog(); -} - - -sal_Bool DlgEditor::IsPasteAllowed() -{ - sal_Bool bPaste = sal_False; - - // get clipboard - Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard(); - if ( xClipboard.is() ) - { - // get clipboard content - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents(); - Application::AcquireSolarMutex( nRef ); - if ( xTransf.is() ) - { - if ( xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] ) ) - { - bPaste = sal_True; - } - } - } - - return bPaste; -} - - -void DlgEditor::ShowProperties() -{ - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) ) - pViewFrame->ToggleChildWindow( SID_SHOW_PROPERTYBROWSER ); -} - - -void DlgEditor::UpdatePropertyBrowserDelayed() -{ - aMarkTimer.Start(); -} - - -sal_Bool DlgEditor::IsModified() const -{ - return pDlgEdModel->IsChanged() || bDialogModelChanged; -} - - -void DlgEditor::ClearModifyFlag() -{ - pDlgEdModel->SetChanged( sal_False ); - bDialogModelChanged = sal_False; -} - - -#define LMARGPRN 1700 -#define RMARGPRN 900 -#define TMARGPRN 2000 -#define BMARGPRN 1000 -#define BORDERPRN 300 - - -void lcl_PrintHeader( Printer* pPrinter, const String& rTitle ) // not working yet -{ - pPrinter->Push(); - - short nLeftMargin = LMARGPRN; - Size aSz = pPrinter->GetOutputSize(); - short nBorder = BORDERPRN; - - pPrinter->SetLineColor( COL_BLACK ); - pPrinter->SetFillColor(); - - Font aFont( pPrinter->GetFont() ); - aFont.SetWeight( WEIGHT_BOLD ); - aFont.SetAlign( ALIGN_BOTTOM ); - pPrinter->SetFont( aFont ); - - long nFontHeight = pPrinter->GetTextHeight(); - - // 1.Border => Strich, 2+3 Border = Freiraum. - long nYTop = TMARGPRN-3*nBorder-nFontHeight; - - long nXLeft = nLeftMargin-nBorder; - long nXRight = aSz.Width()-RMARGPRN+nBorder; - - pPrinter->DrawRect( Rectangle( - Point( nXLeft, nYTop ), - Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) ); - - long nY = TMARGPRN-2*nBorder; - Point aPos( nLeftMargin, nY ); - pPrinter->DrawText( aPos, rTitle ); - - nY = TMARGPRN-nBorder; - - pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) ); - - pPrinter->Pop(); -} - - -sal_Int32 DlgEditor::countPages( Printer* ) -{ - return 1; -} - -void DlgEditor::printPage( sal_Int32 nPage, Printer* pPrinter, const String& rTitle ) -{ - if( nPage == 0 ) - Print( pPrinter, rTitle ); -} - - -void DlgEditor::Print( Printer* pPrinter, const String& rTitle ) // not working yet -{ - if( pDlgEdView ) - { - MapMode aOldMap( pPrinter->GetMapMode()); - Font aOldFont( pPrinter->GetFont() ); - - MapMode aMap( MAP_100TH_MM ); - pPrinter->SetMapMode( aMap ); - Font aFont; - aFont.SetAlign( ALIGN_BOTTOM ); - aFont.SetSize( Size( 0, 360 )); - pPrinter->SetFont( aFont ); - - Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.Width() -= (LMARGPRN+RMARGPRN); - aPaperSz.Height() -= (TMARGPRN+BMARGPRN); - - lcl_PrintHeader( pPrinter, rTitle ); - - Bitmap aDlg; - Size aBmpSz( pPrinter->PixelToLogic( aDlg.GetSizePixel() ) ); - double nPaperSzWidth = aPaperSz.Width(); - double nPaperSzHeight = aPaperSz.Height(); - double nBmpSzWidth = aBmpSz.Width(); - double nBmpSzHeight = aBmpSz.Height(); - double nScaleX = (nPaperSzWidth / nBmpSzWidth ); - double nScaleY = (nPaperSzHeight / nBmpSzHeight ); - - Size aOutputSz; - if( nBmpSzHeight * nScaleX <= nPaperSzHeight ) - { - aOutputSz.Width() = (long)(((double)nBmpSzWidth) * nScaleX); - aOutputSz.Height() = (long)(((double)nBmpSzHeight) * nScaleX); - } - else - { - aOutputSz.Width() = (long)(((double)nBmpSzWidth) * nScaleY); - aOutputSz.Height() = (long)(((double)nBmpSzHeight) * nScaleY); - } - - Point aPosOffs( - (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2), - (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2)); - - aPosOffs.X() += LMARGPRN; - aPosOffs.Y() += TMARGPRN; - - pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg ); - - pPrinter->SetMapMode( aOldMap ); - pPrinter->SetFont( aOldFont ); - } -} - - -bool DlgEditor::AdjustPageSize() -{ - bool bAdjustedPageSize = false; - Reference< beans::XPropertySet > xPSet( m_xUnoControlDialogModel, UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nFormXIn = 0, nFormYIn = 0, nFormWidthIn = 0, nFormHeightIn = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormXIn; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormYIn; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidthIn; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeightIn; - - sal_Int32 nFormX, nFormY, nFormWidth, nFormHeight; - if ( pDlgEdForm && pDlgEdForm->TransformFormToSdrCoordinates( nFormXIn, nFormYIn, nFormWidthIn, nFormHeightIn, nFormX, nFormY, nFormWidth, nFormHeight ) ) - { - Size aPageSizeDelta( 400, 300 ); - DBG_ASSERT( pWindow, "DlgEditor::AdjustPageSize: no window!" ); - if ( pWindow ) - aPageSizeDelta = pWindow->PixelToLogic( aPageSizeDelta, MapMode( MAP_100TH_MM ) ); - - sal_Int32 nNewPageWidth = nFormX + nFormWidth + aPageSizeDelta.Width(); - sal_Int32 nNewPageHeight = nFormY + nFormHeight + aPageSizeDelta.Height(); - - Size aPageSizeMin( DLGED_PAGE_WIDTH_MIN, DLGED_PAGE_HEIGHT_MIN ); - DBG_ASSERT( pWindow, "DlgEditor::AdjustPageSize: no window!" ); - if ( pWindow ) - aPageSizeMin = pWindow->PixelToLogic( aPageSizeMin, MapMode( MAP_100TH_MM ) ); - sal_Int32 nPageWidthMin = aPageSizeMin.Width(); - sal_Int32 nPageHeightMin = aPageSizeMin.Height(); - - if ( nNewPageWidth < nPageWidthMin ) - nNewPageWidth = nPageWidthMin; - - if ( nNewPageHeight < nPageHeightMin ) - nNewPageHeight = nPageHeightMin; - - if ( pDlgEdPage ) - { - Size aPageSize = pDlgEdPage->GetSize(); - if ( nNewPageWidth != aPageSize.Width() || nNewPageHeight != aPageSize.Height() ) - { - Size aNewPageSize( nNewPageWidth, nNewPageHeight ); - pDlgEdPage->SetSize( aNewPageSize ); - DBG_ASSERT( pDlgEdView, "DlgEditor::AdjustPageSize: no view!" ); - if ( pDlgEdView ) - pDlgEdView->SetWorkArea( Rectangle( Point( 0, 0 ), aNewPageSize ) ); - bAdjustedPageSize = true; - } - } - } - } - - return bAdjustedPageSize; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedclip.cxx b/basctl/source/dlged/dlgedclip.cxx deleted file mode 100644 index 06285b11f..000000000 --- a/basctl/source/dlged/dlgedclip.cxx +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include "dlgedclip.hxx" -#include -#include -#include -#include -#include - - -using namespace comphelper; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::datatransfer; -using namespace ::com::sun::star::datatransfer::clipboard; - - -//---------------------------------------------------------------------------- - -DlgEdTransferableImpl::DlgEdTransferableImpl( const Sequence< DataFlavor >& aSeqFlavors, const Sequence< Any >& aSeqData ) -{ - m_SeqFlavors = aSeqFlavors; - m_SeqData = aSeqData; -} - -//---------------------------------------------------------------------------- - -DlgEdTransferableImpl::~DlgEdTransferableImpl() -{ -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdTransferableImpl::compareDataFlavors( const DataFlavor& lFlavor, const DataFlavor& rFlavor ) -{ - sal_Bool bRet = sal_False; - - // compare mime content types - Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory(); - Reference< datatransfer::XMimeContentTypeFactory > - xMCntTypeFactory( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" ) ) ), UNO_QUERY ); - - if ( xMCntTypeFactory.is( ) ) - { - // compare full media types - Reference< datatransfer::XMimeContentType > xLType = xMCntTypeFactory->createMimeContentType( lFlavor.MimeType ); - Reference< datatransfer::XMimeContentType > xRType = xMCntTypeFactory->createMimeContentType( rFlavor.MimeType ); - - ::rtl::OUString aLFullMediaType = xLType->getFullMediaType(); - ::rtl::OUString aRFullMediaType = xRType->getFullMediaType(); - - bRet = aLFullMediaType.equalsIgnoreAsciiCase( aRFullMediaType ); - } - - return bRet; -} - -// XTransferable -//---------------------------------------------------------------------------- - -Any SAL_CALL DlgEdTransferableImpl::getTransferData( const DataFlavor& rFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException) -{ - const SolarMutexGuard aGuard; - - if ( !isDataFlavorSupported( rFlavor ) ) - throw UnsupportedFlavorException(); - - Any aData; - - for ( sal_Int32 i = 0; i < m_SeqFlavors.getLength(); i++ ) - { - if ( compareDataFlavors( m_SeqFlavors[i] , rFlavor ) ) - { - aData = m_SeqData[i]; - break; - } - } - - return aData; -} - -//---------------------------------------------------------------------------- - -Sequence< DataFlavor > SAL_CALL DlgEdTransferableImpl::getTransferDataFlavors( ) throw(RuntimeException) -{ - const SolarMutexGuard aGuard; - - return m_SeqFlavors; -} - -//---------------------------------------------------------------------------- - -sal_Bool SAL_CALL DlgEdTransferableImpl::isDataFlavorSupported( const DataFlavor& rFlavor ) throw(RuntimeException) -{ - const SolarMutexGuard aGuard; - - sal_Bool bRet = sal_False; - - for ( sal_Int32 i = 0; i < m_SeqFlavors.getLength(); i++ ) - { - if ( compareDataFlavors( m_SeqFlavors[i] , rFlavor ) ) - { - bRet = sal_True; - break; - } - } - - return bRet; -} - -// XClipboardOwner -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdTransferableImpl::lostOwnership( const Reference< XClipboard >&, const Reference< XTransferable >& ) throw(RuntimeException) -{ - const SolarMutexGuard aGuard; - - m_SeqFlavors = Sequence< DataFlavor >(); - m_SeqData = Sequence< Any >(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx deleted file mode 100644 index 9cc6a1257..000000000 --- a/basctl/source/dlged/dlgedfac.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include "dlgedfac.hxx" -#include "dlgedobj.hxx" -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; - - -DlgEdFactory::DlgEdFactory() -{ - SdrObjFactory::InsertMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) ); -} - - -DlgEdFactory::~DlgEdFactory() -{ - SdrObjFactory::RemoveMakeObjectHdl( LINK(this, DlgEdFactory, MakeObject) ); -} - - -IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory ) -{ - static sal_Bool bNeedsInit = sal_True; - static uno::Reference< lang::XMultiServiceFactory > xDialogSFact; - - if( bNeedsInit ) - { - uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference< container::XNameContainer > xC( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), uno::UNO_QUERY ); - if( xC.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xModFact( xC, uno::UNO_QUERY ); - xDialogSFact = xModFact; - } - bNeedsInit = sal_False; - } - - if( (pObjFactory->nInventor == DlgInventor) && - (pObjFactory->nIdentifier >= OBJ_DLG_PUSHBUTTON) && - (pObjFactory->nIdentifier <= OBJ_DLG_TREECONTROL) ) - { - switch( pObjFactory->nIdentifier ) - { - case OBJ_DLG_PUSHBUTTON: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" )) , xDialogSFact ); - break; - case OBJ_DLG_RADIOBUTTON: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" )) , xDialogSFact ); - break; - case OBJ_DLG_CHECKBOX: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" )) , xDialogSFact ); - break; - case OBJ_DLG_LISTBOX: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" )) , xDialogSFact ); - break; - case OBJ_DLG_COMBOBOX: - { - DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" )) , xDialogSFact ); - pObjFactory->pNewObj = pNew; - try - { - uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY); - if (xPSet.is()) - { - sal_Bool bB = sal_True; - xPSet->setPropertyValue( DLGED_PROP_DROPDOWN, uno::Any(&bB,::getBooleanCppuType())); - } - } - catch(...) - { - } - } break; - case OBJ_DLG_GROUPBOX: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" )) , xDialogSFact ); - break; - case OBJ_DLG_EDIT: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" )) , xDialogSFact ); - break; - case OBJ_DLG_FIXEDTEXT: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" )) , xDialogSFact ); - break; - case OBJ_DLG_IMAGECONTROL: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" )) , xDialogSFact ); - break; - case OBJ_DLG_PROGRESSBAR: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" )) , xDialogSFact ); - break; - case OBJ_DLG_HSCROLLBAR: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" )) , xDialogSFact ); - break; - case OBJ_DLG_VSCROLLBAR: - { - DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" )) , xDialogSFact ); - pObjFactory->pNewObj = pNew; - // set vertical orientation - try - { - uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY); - if (xPSet.is()) - { - uno::Any aValue; - aValue <<= (sal_Int32) ::com::sun::star::awt::ScrollBarOrientation::VERTICAL; - xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue ); - } - } - catch(...) - { - } - } break; - case OBJ_DLG_HFIXEDLINE: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" )) , xDialogSFact ); - break; - case OBJ_DLG_VFIXEDLINE: - { - DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" )) , xDialogSFact ); - pObjFactory->pNewObj = pNew; - // set vertical orientation - try - { - uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY); - if (xPSet.is()) - { - uno::Any aValue; - aValue <<= (sal_Int32) 1; - xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue ); - } - } - catch(...) - { - } - } break; - case OBJ_DLG_DATEFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDateFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_TIMEFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlTimeFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_NUMERICFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlNumericFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_CURRENCYFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCurrencyFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_FORMATTEDFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFormattedFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_PATTERNFIELD: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlPatternFieldModel" )) , xDialogSFact ); - break; - case OBJ_DLG_FILECONTROL: - pObjFactory->pNewObj = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFileControlModel" )) , xDialogSFact ); - break; - case OBJ_DLG_TREECONTROL: - DlgEdObj* pNew = new DlgEdObj( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.TreeControlModel" )) , xDialogSFact ); - pObjFactory->pNewObj = pNew; - break; - } - } - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx deleted file mode 100644 index ad9e38e81..000000000 --- a/basctl/source/dlged/dlgedfunc.cxx +++ /dev/null @@ -1,621 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include -#include -#include "dlgedfunc.hxx" -#include "dlged.hxx" -#include "dlgedview.hxx" -#include - - -//---------------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( DlgEdFunc, ScrollTimeout, Timer *, pTimer ) -{ - (void)pTimer; - Window* pWindow = pParent->GetWindow(); - Point aPos = pWindow->ScreenToOutputPixel( pWindow->GetPointerPosPixel() ); - aPos = pWindow->PixelToLogic( aPos ); - ForceScroll( aPos ); - return 0; -} -IMPL_LINK_INLINE_END( DlgEdFunc, ScrollTimeout, Timer *, pTimer ) - -//---------------------------------------------------------------------------- - -void DlgEdFunc::ForceScroll( const Point& rPos ) -{ - aScrollTimer.Stop(); - - Window* pWindow = pParent->GetWindow(); - - static Point aDefPoint; - Rectangle aOutRect( aDefPoint, pWindow->GetOutputSizePixel() ); - aOutRect = pWindow->PixelToLogic( aOutRect ); - - ScrollBar* pHScroll = pParent->GetHScroll(); - ScrollBar* pVScroll = pParent->GetVScroll(); - long nDeltaX = pHScroll->GetLineSize(); - long nDeltaY = pVScroll->GetLineSize(); - - if( !aOutRect.IsInside( rPos ) ) - { - if( rPos.X() < aOutRect.Left() ) - nDeltaX = -nDeltaX; - else - if( rPos.X() <= aOutRect.Right() ) - nDeltaX = 0; - - if( rPos.Y() < aOutRect.Top() ) - nDeltaY = -nDeltaY; - else - if( rPos.Y() <= aOutRect.Bottom() ) - nDeltaY = 0; - - if( nDeltaX ) - pHScroll->SetThumbPos( pHScroll->GetThumbPos() + nDeltaX ); - if( nDeltaY ) - pVScroll->SetThumbPos( pVScroll->GetThumbPos() + nDeltaY ); - - if( nDeltaX ) - pParent->DoScroll( pHScroll ); - if( nDeltaY ) - pParent->DoScroll( pVScroll ); - } - - aScrollTimer.Start(); -} - -//---------------------------------------------------------------------------- - -DlgEdFunc::DlgEdFunc( DlgEditor* pParent_ ) -{ - DlgEdFunc::pParent = pParent_; - aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) ); - aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL ); -} - -//---------------------------------------------------------------------------- - -DlgEdFunc::~DlgEdFunc() -{ -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFunc::MouseButtonDown( const MouseEvent& ) -{ - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFunc::MouseButtonUp( const MouseEvent& ) -{ - aScrollTimer.Stop(); - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFunc::MouseMove( const MouseEvent& ) -{ - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt ) -{ - sal_Bool bReturn = sal_False; - - SdrView* pView = pParent->GetView(); - Window* pWindow = pParent->GetWindow(); - - KeyCode aCode = rKEvt.GetKeyCode(); - sal_uInt16 nCode = aCode.GetCode(); - - switch ( nCode ) - { - case KEY_ESCAPE: - { - if ( pView->IsAction() ) - { - pView->BrkAction(); - bReturn = sal_True; - } - else if ( pView->AreObjectsMarked() ) - { - const SdrHdlList& rHdlList = pView->GetHdlList(); - SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if ( pHdl ) - ((SdrHdlList&)rHdlList).ResetFocusHdl(); - else - pView->UnmarkAll(); - - bReturn = sal_True; - } - } - break; - case KEY_TAB: - { - if ( !aCode.IsMod1() && !aCode.IsMod2() ) - { - // mark next object - if ( !pView->MarkNextObj( !aCode.IsShift() ) ) - { - // if no next object, mark first/last - pView->UnmarkAllObj(); - pView->MarkNextObj( !aCode.IsShift() ); - } - - if ( pView->AreObjectsMarked() ) - pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow ); - - bReturn = sal_True; - } - else if ( aCode.IsMod1() ) - { - // selected handle - const SdrHdlList& rHdlList = pView->GetHdlList(); - ((SdrHdlList&)rHdlList).TravelFocusHdl( !aCode.IsShift() ); - - // guarantee visibility of focused handle - SdrHdl* pHdl = rHdlList.GetFocusHdl(); - if ( pHdl ) - { - Point aHdlPosition( pHdl->GetPos() ); - Rectangle aVisRect( aHdlPosition - Point( 100, 100 ), Size( 200, 200 ) ); - pView->MakeVisible( aVisRect, *pWindow ); - } - - bReturn = sal_True; - } - } - break; - case KEY_UP: - case KEY_DOWN: - case KEY_LEFT: - case KEY_RIGHT: - { - long nX = 0; - long nY = 0; - - if ( nCode == KEY_UP ) - { - // scroll up - nX = 0; - nY = -1; - } - else if ( nCode == KEY_DOWN ) - { - // scroll down - nX = 0; - nY = 1; - } - else if ( nCode == KEY_LEFT ) - { - // scroll left - nX = -1; - nY = 0; - } - else if ( nCode == KEY_RIGHT ) - { - // scroll right - nX = 1; - nY = 0; - } - - if ( pView->AreObjectsMarked() && !aCode.IsMod1() ) - { - if ( aCode.IsMod2() ) - { - // move in 1 pixel distance - Size aPixelSize = pWindow ? pWindow->PixelToLogic( Size( 1, 1 ) ) : Size( 100, 100 ); - nX *= aPixelSize.Width(); - nY *= aPixelSize.Height(); - } - else - { - // move in 1 mm distance - nX *= 100; - nY *= 100; - } - - const SdrHdlList& rHdlList = pView->GetHdlList(); - SdrHdl* pHdl = rHdlList.GetFocusHdl(); - - if ( pHdl == 0 ) - { - // no handle selected - if ( pView->IsMoveAllowed() ) - { - // restrict movement to work area - const Rectangle& rWorkArea = pView->GetWorkArea(); - - if ( !rWorkArea.IsEmpty() ) - { - Rectangle aMarkRect( pView->GetMarkedObjRect() ); - aMarkRect.Move( nX, nY ); - - if ( !rWorkArea.IsInside( aMarkRect ) ) - { - if ( aMarkRect.Left() < rWorkArea.Left() ) - nX += rWorkArea.Left() - aMarkRect.Left(); - - if ( aMarkRect.Right() > rWorkArea.Right() ) - nX -= aMarkRect.Right() - rWorkArea.Right(); - - if ( aMarkRect.Top() < rWorkArea.Top() ) - nY += rWorkArea.Top() - aMarkRect.Top(); - - if ( aMarkRect.Bottom() > rWorkArea.Bottom() ) - nY -= aMarkRect.Bottom() - rWorkArea.Bottom(); - } - } - - if ( nX != 0 || nY != 0 ) - { - pView->MoveAllMarked( Size( nX, nY ) ); - pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow ); - } - } - } - else - { - // move the handle - if ( pHdl && ( nX || nY ) ) - { - Point aStartPoint( pHdl->GetPos() ); - Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) ); - const SdrDragStat& rDragStat = pView->GetDragStat(); - - // start dragging - pView->BegDragObj( aStartPoint, 0, pHdl, 0 ); - - if ( pView->IsDragObj() ) - { - bool bWasNoSnap = rDragStat.IsNoSnap(); - sal_Bool bWasSnapEnabled = pView->IsSnapEnabled(); - - // switch snapping off - if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap( sal_True ); - if ( bWasSnapEnabled ) - pView->SetSnapEnabled( sal_False ); - - pView->MovAction( aEndPoint ); - pView->EndDragObj(); - - // restore snap - if ( !bWasNoSnap ) - ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap ); - if ( bWasSnapEnabled ) - pView->SetSnapEnabled( bWasSnapEnabled ); - } - - // make moved handle visible - Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) ); - pView->MakeVisible( aVisRect, *pWindow ); - } - } - } - else - { - // scroll page - ScrollBar* pScrollBar = ( nX != 0 ) ? pParent->GetHScroll() : pParent->GetVScroll(); - if ( pScrollBar ) - { - long nRangeMin = pScrollBar->GetRangeMin(); - long nRangeMax = pScrollBar->GetRangeMax(); - long nThumbPos = pScrollBar->GetThumbPos() + ( ( nX != 0 ) ? nX : nY ) * pScrollBar->GetLineSize(); - if ( nThumbPos < nRangeMin ) - nThumbPos = nRangeMin; - if ( nThumbPos > nRangeMax ) - nThumbPos = nRangeMax; - pScrollBar->SetThumbPos( nThumbPos ); - pParent->DoScroll( pScrollBar ); - } - } - - bReturn = sal_True; - } - break; - default: - { - } - break; - } - - if ( bReturn ) - pWindow->ReleaseMouse(); - - return bReturn; -} - -//---------------------------------------------------------------------------- - -DlgEdFuncInsert::DlgEdFuncInsert( DlgEditor* pParent_ ) : - DlgEdFunc( pParent_ ) -{ - pParent_->GetView()->SetCreateMode( sal_True ); -} - -//---------------------------------------------------------------------------- - -DlgEdFuncInsert::~DlgEdFuncInsert() -{ - pParent->GetView()->SetEditMode( sal_True ); -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( !rMEvt.IsLeft() ) - return sal_True; - - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - Point aPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - - pWindow->CaptureMouse(); - - if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) - { - SdrHdl* pHdl = pView->PickHandle(aPos); - - // if selected object was hit, drag object - if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) ) - pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog); - else if ( pView->AreObjectsMarked() ) - pView->UnmarkAll(); - - // if no action, create object - if ( !pView->IsAction() ) - pView->BegCreateObj(aPos); - } - else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) - { - // if object was hit, show property browser - if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DLGED_READONLY ) - pParent->ShowProperties(); - } - - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt ) -{ - DlgEdFunc::MouseButtonUp( rMEvt ); - - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - pWindow->ReleaseMouse(); - - // object creation active? - if ( pView->IsCreateObj() ) - { - pView->EndCreateObj(SDRCREATE_FORCEEND); - - if ( !pView->AreObjectsMarked() ) - { - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - pView->MarkObj(aPos, nHitLog); - } - - if( pView->AreObjectsMarked() ) - return sal_True; - else - return sal_False; - } - else - { - if ( pView->IsDragObj() ) - pView->EndDragObj( rMEvt.IsMod1() ); - return sal_True; - } -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt ) -{ - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - - if ( pView->IsAction() ) - { - ForceScroll(aPos); - pView->MovAction(aPos); - } - - pWindow->SetPointer( pView->GetPreferedPointer( aPos, pWindow, nHitLog ) ); - - return sal_True; -} - -//---------------------------------------------------------------------------- - -DlgEdFuncSelect::DlgEdFuncSelect( DlgEditor* pParent_ ) : - DlgEdFunc( pParent_ ), - bMarkAction(sal_False) -{ -} - -//---------------------------------------------------------------------------- - -DlgEdFuncSelect::~DlgEdFuncSelect() -{ -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt ) -{ - // get view from parent - SdrView* pView = pParent->GetView(); - Window* pWindow = pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - Point aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); - - if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 ) - { - SdrHdl* pHdl = pView->PickHandle(aMDPos); - SdrObject* pObj; - SdrPageView* pPV; - - // hit selected object? - if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos, nHitLog) ) - { - pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); - } - else - { - // if not multi selection, unmark all - if ( !rMEvt.IsShift() ) - pView->UnmarkAll(); - else - { - if( pView->PickObj( aMDPos, nHitLog, pObj, pPV ) ) - { - //if( pObj->ISA( DlgEdForm ) ) - // pView->UnmarkAll(); - //else - // pParent->UnmarkDialog(); - } - } - - if ( pView->MarkObj(aMDPos, nHitLog) ) - { - // drag object - pHdl=pView->PickHandle(aMDPos); - pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog); - } - else - { - // select object - pView->BegMarkObj(aMDPos); - bMarkAction = sal_True; - } - } - } - else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) - { - // if object was hit, show property browser - if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DLGED_READONLY ) - pParent->ShowProperties(); - } - - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt ) -{ - DlgEdFunc::MouseButtonUp( rMEvt ); - - // get view from parent - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - - if ( rMEvt.IsLeft() ) - { - if ( pView->IsDragObj() ) - { - // object was dragged - pView->EndDragObj( rMEvt.IsMod1() ); - pView->ForceMarkedToAnotherPage(); - } - else - if (pView->IsAction() ) - { - pView->EndAction(); - } - } - - bMarkAction = sal_False; - - pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) ); - pWindow->ReleaseMouse(); - - return sal_True; -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt ) -{ - SdrView* pView = pParent->GetView(); - Window* pWindow= pParent->GetWindow(); - pView->SetActualWin( pWindow ); - - Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() ); - - if ( pView->IsAction() ) - { - Point aPix(rMEvt.GetPosPixel()); - Point aPnt_(pWindow->PixelToLogic(aPix)); - - ForceScroll(aPnt_); - pView->MovAction(aPnt_); - } - - pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) ); - - return sal_True; -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedlist.cxx b/basctl/source/dlged/dlgedlist.cxx deleted file mode 100644 index e49277d3c..000000000 --- a/basctl/source/dlged/dlgedlist.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" -#include "dlgedlist.hxx" -#include "dlgedobj.hxx" - -//============================================================================ -// DlgEdPropListenerImpl -//============================================================================ - -//---------------------------------------------------------------------------- - -DlgEdPropListenerImpl::DlgEdPropListenerImpl(DlgEdObj* pObj) - :pDlgEdObj(pObj) -{ -} - -//---------------------------------------------------------------------------- - -DlgEdPropListenerImpl::~DlgEdPropListenerImpl() -{ -} - -// XEventListener -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdPropListenerImpl::disposing( const ::com::sun::star::lang::EventObject& ) throw( ::com::sun::star::uno::RuntimeException) -{ -} - -// XPropertyChangeListener -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdPropListenerImpl::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException) -{ - pDlgEdObj->_propertyChange( evt ); -} - -//---------------------------------------------------------------------------- - -//============================================================================ -// DlgEdEvtContListenerImpl -//============================================================================ - -//---------------------------------------------------------------------------- - -DlgEdEvtContListenerImpl::DlgEdEvtContListenerImpl(DlgEdObj* pObj) - :pDlgEdObj(pObj) -{ -} - -//---------------------------------------------------------------------------- - -DlgEdEvtContListenerImpl::~DlgEdEvtContListenerImpl() -{ -} - -// XEventListener -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdEvtContListenerImpl::disposing( const ::com::sun::star::lang::EventObject& ) throw( ::com::sun::star::uno::RuntimeException) -{ -} - -// XContainerListener -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdEvtContListenerImpl::elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) -{ - pDlgEdObj->_elementInserted( Event ); -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdEvtContListenerImpl::elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) -{ - pDlgEdObj->_elementReplaced( Event ); -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdEvtContListenerImpl::elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw(::com::sun::star::uno::RuntimeException) -{ - pDlgEdObj->_elementRemoved( Event ); -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedmod.cxx b/basctl/source/dlged/dlgedmod.cxx deleted file mode 100644 index 3afcd86d7..000000000 --- a/basctl/source/dlged/dlgedmod.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include "dlgedmod.hxx" -#include "dlgedpage.hxx" -#include - - -DBG_NAME(DlgEdModel) - -TYPEINIT1(DlgEdModel,SdrModel); - -//---------------------------------------------------------------------------- - -DlgEdModel::DlgEdModel() - :SdrModel(NULL, NULL) -{ - DBG_CTOR(DlgEdModel,0); -} - -//---------------------------------------------------------------------------- - -DlgEdModel::~DlgEdModel() -{ - DBG_DTOR(DlgEdModel,0); -} - -//---------------------------------------------------------------------------- - -SdrPage* DlgEdModel::AllocPage(bool bMasterPage) -{ - DBG_CHKTHIS(DlgEdModel, 0); - return new DlgEdPage(*this, bMasterPage); -} - -//---------------------------------------------------------------------------- - -void DlgEdModel::DlgEdModelChanged(bool bChanged ) -{ - SetChanged( bChanged ); -} - -//---------------------------------------------------------------------------- - -Window* DlgEdModel::GetCurDocViewWin() -{ - return 0; -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx deleted file mode 100644 index 52adc033f..000000000 --- a/basctl/source/dlged/dlgedobj.cxx +++ /dev/null @@ -1,1887 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include -#include -#include "dlgedobj.hxx" -#include "dlged.hxx" -#include "dlgedmod.hxx" -#include "dlgedpage.hxx" -#include "dlgedview.hxx" -#include "dlgedlist.hxx" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::script; -using ::rtl::OUString; - - -TYPEINIT1(DlgEdObj, SdrUnoObj); -DBG_NAME(DlgEdObj); - -//---------------------------------------------------------------------------- - -DlgEdObj::DlgEdObj() - :SdrUnoObj(String(), sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm( NULL ) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - -DlgEdObj::DlgEdObj(const ::rtl::OUString& rModelName, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac) - :SdrUnoObj(rModelName, rxSFac, sal_False) - ,bIsListening(sal_False) - ,pDlgEdForm( NULL ) -{ - DBG_CTOR(DlgEdObj, NULL); -} - -//---------------------------------------------------------------------------- - -DlgEdObj::~DlgEdObj() -{ - DBG_DTOR(DlgEdObj, NULL); - - if ( isListening() ) - EndListening(); -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::SetPage(SdrPage* _pNewPage) -{ - // now set the page - SdrUnoObj::SetPage(_pNewPage); -} - -//---------------------------------------------------------------------------- - -namespace -{ - /** returns the DlgEdForm which the given DlgEdObj belongs to - (which might in fact be the object itself) - - Failure to obtain the form will be reported with an assertion in the non-product - version. - */ - bool lcl_getDlgEdForm( DlgEdObj* _pObject, DlgEdForm*& _out_pDlgEdForm ) - { - _out_pDlgEdForm = dynamic_cast< DlgEdForm* >( _pObject ); - if ( !_out_pDlgEdForm ) - _out_pDlgEdForm = _pObject->GetDlgEdForm(); - DBG_ASSERT( _out_pDlgEdForm, "lcl_getDlgEdForm: no form!" ); - return ( _out_pDlgEdForm != NULL ); - } -} - -//---------------------------------------------------------------------------- - -uno::Reference< awt::XControl > DlgEdObj::GetControl() const -{ - const DlgEdForm* pForm = GetDlgEdForm(); - const DlgEditor* pEditor = pForm ? pForm->GetDlgEditor() : NULL; - SdrView* pView = pEditor ? pEditor->GetView() : NULL; - Window* pWindow = pEditor ? pEditor->GetWindow() : NULL; - OSL_ENSURE( ( pView && pWindow ) || !pForm, "DlgEdObj::GetControl: no view or no window!" ); - - uno::Reference< awt::XControl > xControl; - if ( pView && pWindow ) - xControl = GetUnoControl( *pView, *pWindow ); - - return xControl; -} - -//---------------------------------------------------------------------------- - -bool DlgEdObj::TransformSdrToControlCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ) -{ - // input position and size - Size aPos( nXIn, nYIn ); - Size aSize( nWidthIn, nHeightIn ); - - // form position - DlgEdForm* pForm = NULL; - if ( !lcl_getDlgEdForm( this, pForm ) ) - return false; - Rectangle aFormRect = pForm->GetSnapRect(); - Size aFormPos( aFormRect.Left(), aFormRect.Top() ); - - // convert 100th_mm to pixel - OutputDevice* pDevice = Application::GetDefaultDevice(); - DBG_ASSERT( pDevice, "DlgEdObj::TransformSdrToControlCoordinates: missing default device!" ); - if ( !pDevice ) - return false; - aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_100TH_MM ) ); - aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) ); - aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_100TH_MM ) ); - - // subtract form position - aPos.Width() -= aFormPos.Width(); - aPos.Height() -= aFormPos.Height(); - - // take window borders into account - Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); - DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" ); - if ( !xPSetForm.is() ) - return false; - bool bDecoration = true; - xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration; - if( bDecoration ) - { - awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aPos.Width() -= aDeviceInfo.LeftInset; - aPos.Height() -= aDeviceInfo.TopInset; - } - - // convert pixel to logic units - aPos = pDevice->PixelToLogic( aPos, MAP_APPFONT ); - aSize = pDevice->PixelToLogic( aSize, MAP_APPFONT ); - - // set out parameters - nXOut = aPos.Width(); - nYOut = aPos.Height(); - nWidthOut = aSize.Width(); - nHeightOut = aSize.Height(); - - return true; -} - -//---------------------------------------------------------------------------- - -bool DlgEdObj::TransformSdrToFormCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ) -{ - // input position and size - Size aPos( nXIn, nYIn ); - Size aSize( nWidthIn, nHeightIn ); - - // convert 100th_mm to pixel - OutputDevice* pDevice = Application::GetDefaultDevice(); - DBG_ASSERT( pDevice, "DlgEdObj::TransformSdrToFormCoordinates: missing default device!" ); - if ( !pDevice ) - return false; - aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_100TH_MM ) ); - aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) ); - - // take window borders into account - DlgEdForm* pForm = NULL; - if ( !lcl_getDlgEdForm( this, pForm ) ) - return false; - - // take window borders into account - Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); - DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" ); - if ( !xPSetForm.is() ) - return false; - bool bDecoration = true; - xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration; - if( bDecoration ) - { - awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; - aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; - } - // convert pixel to logic units - aPos = pDevice->PixelToLogic( aPos, MAP_APPFONT ); - aSize = pDevice->PixelToLogic( aSize, MAP_APPFONT ); - - // set out parameters - nXOut = aPos.Width(); - nYOut = aPos.Height(); - nWidthOut = aSize.Width(); - nHeightOut = aSize.Height(); - - return true; -} - -//---------------------------------------------------------------------------- - -bool DlgEdObj::TransformControlToSdrCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ) -{ - // input position and size - Size aPos( nXIn, nYIn ); - Size aSize( nWidthIn, nHeightIn ); - - // form position - DlgEdForm* pForm = NULL; - if ( !lcl_getDlgEdForm( this, pForm ) ) - return false; - - Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); - DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformControlToSdrCoordinates: no form property set!" ); - if ( !xPSetForm.is() ) - return false; - sal_Int32 nFormX = 0, nFormY = 0, nFormWidth, nFormHeight; - xPSetForm->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nFormX; - xPSetForm->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nFormY; - xPSetForm->getPropertyValue( DLGED_PROP_WIDTH ) >>= nFormWidth; - xPSetForm->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nFormHeight; - Size aFormPos( nFormX, nFormY ); - - // convert logic units to pixel - OutputDevice* pDevice = Application::GetDefaultDevice(); - DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" ); - if ( !pDevice ) - return false; - aPos = pDevice->LogicToPixel( aPos, MAP_APPFONT ); - aSize = pDevice->LogicToPixel( aSize, MAP_APPFONT ); - aFormPos = pDevice->LogicToPixel( aFormPos, MAP_APPFONT ); - - // add form position - aPos.Width() += aFormPos.Width(); - aPos.Height() += aFormPos.Height(); - - // take window borders into account - bool bDecoration = true; - xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration; - if( bDecoration ) - { - awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aPos.Width() += aDeviceInfo.LeftInset; - aPos.Height() += aDeviceInfo.TopInset; - } - - // convert pixel to 100th_mm - aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_100TH_MM ) ); - aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_100TH_MM ) ); - - // set out parameters - nXOut = aPos.Width(); - nYOut = aPos.Height(); - nWidthOut = aSize.Width(); - nHeightOut = aSize.Height(); - - return true; -} - -//---------------------------------------------------------------------------- - -bool DlgEdObj::TransformFormToSdrCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ) -{ - // input position and size - Size aPos( nXIn, nYIn ); - Size aSize( nWidthIn, nHeightIn ); - - // convert logic units to pixel - OutputDevice* pDevice = Application::GetDefaultDevice(); - DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" ); - if ( !pDevice ) - return false; - - // take window borders into account - DlgEdForm* pForm = NULL; - if ( !lcl_getDlgEdForm( this, pForm ) ) - return false; - - aPos = pDevice->LogicToPixel( aPos, MAP_APPFONT ); - aSize = pDevice->LogicToPixel( aSize, MAP_APPFONT ); - - // take window borders into account - Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); - DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" ); - if ( !xPSetForm.is() ) - return false; - bool bDecoration = true; - xPSetForm->getPropertyValue( DLGED_PROP_DECORATION ) >>= bDecoration; - if( bDecoration ) - { - awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aSize.Width() += aDeviceInfo.LeftInset + aDeviceInfo.RightInset; - aSize.Height() += aDeviceInfo.TopInset + aDeviceInfo.BottomInset; - } - - // convert pixel to 100th_mm - aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_100TH_MM ) ); - aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_100TH_MM ) ); - - // set out parameters - nXOut = aPos.Width(); - nYOut = aPos.Height(); - nWidthOut = aSize.Width(); - nHeightOut = aSize.Height(); - - return true; -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::SetRectFromProps() -{ - // get control position and size from properties - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nXIn = 0, nYIn = 0, nWidthIn = 0, nHeightIn = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nXIn; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nYIn; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidthIn; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeightIn; - - // transform coordinates - sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut; - if ( TransformControlToSdrCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) ) - { - // set rectangle position and size - Point aPoint( nXOut, nYOut ); - Size aSize( nWidthOut, nHeightOut ); - SetSnapRect( Rectangle( aPoint, aSize ) ); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::SetPropsFromRect() -{ - // get control position and size from rectangle - Rectangle aRect_ = GetSnapRect(); - sal_Int32 nXIn = aRect_.Left(); - sal_Int32 nYIn = aRect_.Top(); - sal_Int32 nWidthIn = aRect_.GetWidth(); - sal_Int32 nHeightIn = aRect_.GetHeight(); - - // transform coordinates - sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut; - if ( TransformSdrToControlCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) ) - { - // set properties - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - Any aValue; - aValue <<= nXOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - aValue <<= nYOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - aValue <<= nWidthOut; - xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue ); - aValue <<= nHeightOut; - xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue ); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) -{ - DlgEdPage* pPage_ = 0; - if ( pDlgEdForm ) - { - DlgEditor* pEditor = pDlgEdForm->GetDlgEditor(); - if ( pEditor ) - pPage_ = pEditor->GetPage(); - } - DBG_ASSERT( pPage_, "DlgEdObj::PositionAndSizeChange: no page!" ); - if ( pPage_ ) - { - sal_Int32 nPageXIn = 0; - sal_Int32 nPageYIn = 0; - Size aPageSize = pPage_->GetSize(); - sal_Int32 nPageWidthIn = aPageSize.Width(); - sal_Int32 nPageHeightIn = aPageSize.Height(); - sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight; - if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) - { - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight; - - sal_Int32 nValue = 0; - evt.NewValue >>= nValue; - sal_Int32 nNewValue = nValue; - - if ( evt.PropertyName == DLGED_PROP_POSITIONX ) - { - if ( nNewValue + nWidth > nPageX + nPageWidth ) - nNewValue = nPageX + nPageWidth - nWidth; - if ( nNewValue < nPageX ) - nNewValue = nPageX; - } - else if ( evt.PropertyName == DLGED_PROP_POSITIONY ) - { - if ( nNewValue + nHeight > nPageY + nPageHeight ) - nNewValue = nPageY + nPageHeight - nHeight; - if ( nNewValue < nPageY ) - nNewValue = nPageY; - } - else if ( evt.PropertyName == DLGED_PROP_WIDTH ) - { - if ( nX + nNewValue > nPageX + nPageWidth ) - nNewValue = nPageX + nPageWidth - nX; - if ( nNewValue < 1 ) - nNewValue = 1; - } - else if ( evt.PropertyName == DLGED_PROP_HEIGHT ) - { - if ( nY + nNewValue > nPageY + nPageHeight ) - nNewValue = nPageY + nPageHeight - nY; - if ( nNewValue < 1 ) - nNewValue = 1; - } - - if ( nNewValue != nValue ) - { - Any aNewValue; - aNewValue <<= nNewValue; - EndListening( sal_False ); - xPSet->setPropertyValue( evt.PropertyName, aNewValue ); - StartListening(); - } - } - } - } - - SetRectFromProps(); -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdObj::NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException) -{ - // get old name - ::rtl::OUString aOldName; - evt.OldValue >>= aOldName; - - // get new name - ::rtl::OUString aNewName; - evt.NewValue >>= aNewName; - - if ( !aNewName.equals(aOldName) ) - { - Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), UNO_QUERY); - if ( xNameAcc.is() && xNameAcc->hasByName(aOldName) ) - { - if ( !xNameAcc->hasByName(aNewName) && aNewName.getLength() != 0 ) - { - // remove the control by the old name and insert the control by the new name in the container - Reference< container::XNameContainer > xCont(xNameAcc, UNO_QUERY ); - if ( xCont.is() ) - { - Reference< awt::XControlModel > xCtrl(GetUnoControlModel(), UNO_QUERY); - Any aAny; - aAny <<= xCtrl; - xCont->removeByName( aOldName ); - xCont->insertByName( aNewName , aAny ); - - DlgEditor* pEditor; - if ( ISA(DlgEdForm) ) - pEditor = ((DlgEdForm*)this)->GetDlgEditor(); - else - pEditor = GetDlgEdForm()->GetDlgEditor(); - LocalizationMgr::renameControlResourceIDsForEditorObject( pEditor, aAny, aNewName ); - } - } - else - { - // set old name property - EndListening(sal_False); - Reference< beans::XPropertySet > xPSet(GetUnoControlModel(), UNO_QUERY); - Any aName; - aName <<= aOldName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aName ); - StartListening(); - } - } - } -} - -//---------------------------------------------------------------------------- - -sal_Int32 DlgEdObj::GetStep() const -{ - // get step property - sal_Int32 nStep = 0; - uno::Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), uno::UNO_QUERY ); - if (xPSet.is()) - { - xPSet->getPropertyValue( DLGED_PROP_STEP ) >>= nStep; - } - return nStep; -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::UpdateStep() -{ - sal_Int32 nCurStep = GetDlgEdForm()->GetStep(); - sal_Int32 nStep = GetStep(); - - SdrLayerAdmin& rLayerAdmin = GetModel()->GetLayerAdmin(); - SdrLayerID nHiddenLayerId = rLayerAdmin.GetLayerID( String( RTL_CONSTASCII_USTRINGPARAM( "HiddenLayer" ) ), sal_False ); - SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName(), sal_False ); - - if( nCurStep ) - { - if ( nStep && (nStep != nCurStep) ) - { - SetLayer( nHiddenLayerId ); - } - else - { - SetLayer( nControlLayerId ); - } - } - else - { - SetLayer( nControlLayerId ); - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt ) throw (RuntimeException) -{ - DlgEdForm* pForm = GetDlgEdForm(); - if ( pForm ) - { - // stop listening with all children - ::std::vector aChildList = pForm->GetChilds(); - ::std::vector::iterator aIter; - for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter ) - { - (*aIter)->EndListening( sal_False ); - } - - Reference< container::XNameAccess > xNameAcc( pForm->GetUnoControlModel() , UNO_QUERY ); - if ( xNameAcc.is() ) - { - // get sequence of control names - Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - sal_Int16 i; - - // create a map of tab indices and control names, sorted by tab index - IndexToNameMap aIndexToNameMap; - for ( i = 0; i < nCtrls; ++i ) - { - // get control name - ::rtl::OUString aName( pNames[i] ); - - // get tab index - sal_Int16 nTabIndex = -1; - Any aCtrl = xNameAcc->getByName( aName ); - Reference< beans::XPropertySet > xPSet; - aCtrl >>= xPSet; - if ( xPSet.is() && xPSet == Reference< beans::XPropertySet >( evt.Source, UNO_QUERY ) ) - evt.OldValue >>= nTabIndex; - else if ( xPSet.is() ) - xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex; - - // insert into map - aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) ); - } - - // create a helper list of control names, sorted by tab index - ::std::vector< ::rtl::OUString > aNameList( aIndexToNameMap.size() ); - ::std::transform( - aIndexToNameMap.begin(), aIndexToNameMap.end(), - aNameList.begin(), - ::o3tl::select2nd< IndexToNameMap::value_type >( ) - ); - - // check tab index - sal_Int16 nOldTabIndex = 0; - evt.OldValue >>= nOldTabIndex; - sal_Int16 nNewTabIndex = 0; - evt.NewValue >>= nNewTabIndex; - if ( nNewTabIndex < 0 ) - nNewTabIndex = 0; - else if ( nNewTabIndex > nCtrls - 1 ) - nNewTabIndex = sal::static_int_cast( nCtrls - 1 ); - - // reorder helper list - ::rtl::OUString aCtrlName = aNameList[nOldTabIndex]; - aNameList.erase( aNameList.begin() + nOldTabIndex ); - aNameList.insert( aNameList.begin() + nNewTabIndex , aCtrlName ); - - // set new tab indices - for ( i = 0; i < nCtrls; ++i ) - { - Any aCtrl = xNameAcc->getByName( aNameList[i] ); - Reference< beans::XPropertySet > xPSet; - aCtrl >>= xPSet; - if ( xPSet.is() ) - { - Any aTabIndex; - aTabIndex <<= (sal_Int16) i; - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - } - } - - // reorder objects in drawing page - GetModel()->GetPage(0)->SetObjectOrdNum( nOldTabIndex + 1, nNewTabIndex + 1 ); - - // #110559# - pForm->UpdateTabOrderAndGroups(); - } - - // start listening with all children - for ( aIter = aChildList.begin() ; aIter != aChildList.end() ; ++aIter ) - { - (*aIter)->StartListening(); - } - } -} - -//---------------------------------------------------------------------------- - -sal_Bool DlgEdObj::supportsService( const sal_Char* _pServiceName ) const -{ - sal_Bool bSupports = sal_False; - - Reference< lang::XServiceInfo > xServiceInfo( GetUnoControlModel() , UNO_QUERY ); - // TODO: cache xServiceInfo as member? - if ( xServiceInfo.is() ) - bSupports = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii( _pServiceName ) ); - - return bSupports; -} - -//---------------------------------------------------------------------------- - -::rtl::OUString DlgEdObj::GetDefaultName() const -{ - sal_uInt16 nResId = 0; - ::rtl::OUString aDefaultName; - if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" ) ) - { - nResId = RID_STR_CLASS_DIALOG; - } - else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) ) - { - nResId = RID_STR_CLASS_BUTTON; - } - else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) ) - { - nResId = RID_STR_CLASS_RADIOBUTTON; - } - else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) ) - { - nResId = RID_STR_CLASS_CHECKBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) ) - { - nResId = RID_STR_CLASS_LISTBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) ) - { - nResId = RID_STR_CLASS_COMBOBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) ) - { - nResId = RID_STR_CLASS_GROUPBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" ) ) - { - nResId = RID_STR_CLASS_EDIT; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) ) - { - nResId = RID_STR_CLASS_FIXEDTEXT; - } - else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) ) - { - nResId = RID_STR_CLASS_IMAGECONTROL; - } - else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) ) - { - nResId = RID_STR_CLASS_PROGRESSBAR; - } - else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) ) - { - nResId = RID_STR_CLASS_SCROLLBAR; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) ) - { - nResId = RID_STR_CLASS_FIXEDLINE; - } - else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) ) - { - nResId = RID_STR_CLASS_DATEFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) ) - { - nResId = RID_STR_CLASS_TIMEFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) ) - { - nResId = RID_STR_CLASS_NUMERICFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) ) - { - nResId = RID_STR_CLASS_CURRENCYFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) ) - { - nResId = RID_STR_CLASS_FORMATTEDFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) ) - { - nResId = RID_STR_CLASS_PATTERNFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) ) - { - nResId = RID_STR_CLASS_FILECONTROL; - } - else if ( supportsService( "com.sun.star.awt.tree.TreeControlModel" ) ) - { - nResId = RID_STR_CLASS_TREECONTROL; - } - - else - { - nResId = RID_STR_CLASS_CONTROL; - } - - if (nResId) - { - aDefaultName = ::rtl::OUString( String(IDEResId(nResId)) ); - } - - return aDefaultName; -} - -//---------------------------------------------------------------------------- - -::rtl::OUString DlgEdObj::GetUniqueName() const -{ - ::rtl::OUString aUniqueName; - uno::Reference< container::XNameAccess > xNameAcc((GetDlgEdForm()->GetUnoControlModel()), uno::UNO_QUERY); - - if ( xNameAcc.is() ) - { - sal_Int32 n = 0; - ::rtl::OUString aDefaultName = GetDefaultName(); - - do - { - aUniqueName = aDefaultName + ::rtl::OUString::valueOf(++n); - } while (xNameAcc->hasByName(aUniqueName)); - } - - return aUniqueName; -} - -//---------------------------------------------------------------------------- - -sal_uInt32 DlgEdObj::GetObjInventor() const -{ - return DlgInventor; -} - -//---------------------------------------------------------------------------- - -sal_uInt16 DlgEdObj::GetObjIdentifier() const -{ - if ( supportsService( "com.sun.star.awt.UnoControlDialogModel" )) - { - return OBJ_DLG_DIALOG; - } - else if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" )) - { - return OBJ_DLG_PUSHBUTTON; - } - else if ( supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" )) - { - return OBJ_DLG_RADIOBUTTON; - } - else if ( supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" )) - { - return OBJ_DLG_CHECKBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlListBoxModel" )) - { - return OBJ_DLG_LISTBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlComboBoxModel" )) - { - return OBJ_DLG_COMBOBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" )) - { - return OBJ_DLG_GROUPBOX; - } - else if ( supportsService( "com.sun.star.awt.UnoControlEditModel" )) - { - return OBJ_DLG_EDIT; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFixedTextModel" )) - { - return OBJ_DLG_FIXEDTEXT; - } - else if ( supportsService( "com.sun.star.awt.UnoControlImageControlModel" )) - { - return OBJ_DLG_IMAGECONTROL; - } - else if ( supportsService( "com.sun.star.awt.UnoControlProgressBarModel" )) - { - return OBJ_DLG_PROGRESSBAR; - } - else if ( supportsService( "com.sun.star.awt.UnoControlScrollBarModel" )) - { - return OBJ_DLG_HSCROLLBAR; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFixedLineModel" )) - { - return OBJ_DLG_HFIXEDLINE; - } - else if ( supportsService( "com.sun.star.awt.UnoControlDateFieldModel" )) - { - return OBJ_DLG_DATEFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" )) - { - return OBJ_DLG_TIMEFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" )) - { - return OBJ_DLG_NUMERICFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" )) - { - return OBJ_DLG_CURRENCYFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" )) - { - return OBJ_DLG_FORMATTEDFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" )) - { - return OBJ_DLG_PATTERNFIELD; - } - else if ( supportsService( "com.sun.star.awt.UnoControlFileControlModel" )) - { - return OBJ_DLG_FILECONTROL; - } - else if ( supportsService( "com.sun.star.awt.tree.TreeControlModel" )) - { - return OBJ_DLG_TREECONTROL; - } - else - { - return OBJ_DLG_CONTROL; - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::clonedFrom(const DlgEdObj* _pSource) -{ - // set parent form - pDlgEdForm = _pSource->pDlgEdForm; - - // add child to parent form - pDlgEdForm->AddChild( this ); - - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - // set new name - ::rtl::OUString aOUniqueName( GetUniqueName() ); - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); - - Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY ); - if ( xCont.is() ) - { - // set tabindex - Sequence< OUString > aNames = xCont->getElementNames(); - Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - - // insert control model in dialog model - Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY ); - Any aCtrl; - aCtrl <<= xCtrl; - xCont->insertByName( aOUniqueName , aCtrl ); - - // #110559# - pDlgEdForm->UpdateTabOrderAndGroups(); - } - } - - // start listening - StartListening(); -} - -//---------------------------------------------------------------------------- - -DlgEdObj* DlgEdObj::Clone() const -{ - DlgEdObj* pDlgEdObj = CloneHelper< DlgEdObj >(); - DBG_ASSERT( pDlgEdObj != NULL, "DlgEdObj::Clone: invalid clone!" ); - if ( pDlgEdObj ) - pDlgEdObj->clonedFrom( this ); - - return pDlgEdObj; -} - -//---------------------------------------------------------------------------- - -SdrObject* DlgEdObj::getFullDragClone() const -{ - // no need to really add the clone for dragging, it's a temporary - // object - SdrObject* pObj = new SdrUnoObj(String()); - *pObj = *((const SdrUnoObj*)this); - - return pObj; -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::NbcMove( const Size& rSize ) -{ - SdrUnoObj::NbcMove( rSize ); - - // stop listening - EndListening(sal_False); - - // set geometry properties - SetPropsFromRect(); - - // start listening - StartListening(); - - // dialog model changed - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True); -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract) -{ - SdrUnoObj::NbcResize( rRef, xFract, yFract ); - - // stop listening - EndListening(sal_False); - - // set geometry properties - SetPropsFromRect(); - - // start listening - StartListening(); - - // dialog model changed - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True); -} - -//---------------------------------------------------------------------------- - -bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) -{ - bool bResult = SdrUnoObj::EndCreate(rStat, eCmd); - - SetDefaults(); - StartListening(); - - return bResult; -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::SetDefaults() -{ - // set parent form - pDlgEdForm = ((DlgEdPage*)GetPage())->GetDlgEdForm(); - - if ( pDlgEdForm ) - { - // add child to parent form - pDlgEdForm->AddChild( this ); - - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - // get unique name - ::rtl::OUString aOUniqueName( GetUniqueName() ); - - // set name property - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); - - // set labels - if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) || - supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) || - supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) || - supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) || - supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) ) - { - xPSet->setPropertyValue( DLGED_PROP_LABEL, aUniqueName ); - } - - // set number formats supplier for formatted field - if ( supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) ) - { - Reference< util::XNumberFormatsSupplier > xSupplier = GetDlgEdForm()->GetDlgEditor()->GetNumberFormatsSupplier(); - if ( xSupplier.is() ) - { - Any aSupplier; - aSupplier <<= xSupplier; - xPSet->setPropertyValue( DLGED_PROP_FORMATSSUPPLIER, aSupplier ); - } - } - - // set geometry properties - SetPropsFromRect(); - - Reference< container::XNameContainer > xCont( GetDlgEdForm()->GetUnoControlModel() , UNO_QUERY ); - if ( xCont.is() ) - { - // set tabindex - Sequence< OUString > aNames = xCont->getElementNames(); - uno::Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - - // set step - Reference< beans::XPropertySet > xPSetForm( xCont, UNO_QUERY ); - if ( xPSetForm.is() ) - { - Any aStep = xPSetForm->getPropertyValue( DLGED_PROP_STEP ); - xPSet->setPropertyValue( DLGED_PROP_STEP, aStep ); - } - - // insert control model in dialog model - Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY ); - Any aAny; - aAny <<= xCtrl; - xCont->insertByName( aOUniqueName , aAny ); - - DlgEditor* pEditor; - if ( ISA(DlgEdForm) ) - pEditor = ((DlgEdForm*)this)->GetDlgEditor(); - else - pEditor = GetDlgEdForm()->GetDlgEditor(); - LocalizationMgr::setControlResourceIDsForNewEditorObject( pEditor, aAny, aOUniqueName ); - - // #110559# - pDlgEdForm->UpdateTabOrderAndGroups(); - } - } - - // dialog model changed - pDlgEdForm->GetDlgEditor()->SetDialogModelChanged( sal_True ); - } -} - -//---------------------------------------------------------------------------- - -IMPL_LINK(DlgEdObj, OnCreate, void*, EMPTYTAG) -{ - (void)EMPTYTAG; - /* - if (pTempView) - pTempView->ObjectCreated(this); - */ - return 0; -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::StartListening() -{ - DBG_ASSERT(!isListening(), "DlgEdObj::StartListening: already listening!"); - - if (!isListening()) - { - bIsListening = sal_True; - - // XPropertyChangeListener - Reference< XPropertySet > xControlModel( GetUnoControlModel() , UNO_QUERY ); - if (!m_xPropertyChangeListener.is() && xControlModel.is()) - { - // create listener - m_xPropertyChangeListener = static_cast< ::com::sun::star::beans::XPropertyChangeListener*>( new DlgEdPropListenerImpl( (DlgEdObj*)this ) ); - - // register listener to properties - xControlModel->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener ); - } - - // XContainerListener - Reference< XScriptEventsSupplier > xEventsSupplier( GetUnoControlModel() , UNO_QUERY ); - if( !m_xContainerListener.is() && xEventsSupplier.is() ) - { - // create listener - m_xContainerListener = static_cast< ::com::sun::star::container::XContainerListener*>( new DlgEdEvtContListenerImpl( (DlgEdObj*)this ) ); - - // register listener to script event container - Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents(); - DBG_ASSERT(xEventCont.is(), "DlgEdObj::StartListening: control model has no script event container!"); - Reference< XContainer > xCont( xEventCont , UNO_QUERY ); - if (xCont.is()) - xCont->addContainerListener( m_xContainerListener ); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::EndListening(sal_Bool bRemoveListener) -{ - DBG_ASSERT(isListening(), "DlgEdObj::EndListening: not listening currently!"); - - if (isListening()) - { - bIsListening = sal_False; - - if (bRemoveListener) - { - // XPropertyChangeListener - Reference< XPropertySet > xControlModel(GetUnoControlModel(), UNO_QUERY); - if ( m_xPropertyChangeListener.is() && xControlModel.is() ) - { - // remove listener - xControlModel->removePropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener ); - } - m_xPropertyChangeListener.clear(); - - // XContainerListener - Reference< XScriptEventsSupplier > xEventsSupplier( GetUnoControlModel() , UNO_QUERY ); - if( m_xContainerListener.is() && xEventsSupplier.is() ) - { - // remove listener - Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents(); - DBG_ASSERT(xEventCont.is(), "DlgEdObj::EndListening: control model has no script event container!"); - Reference< XContainer > xCont( xEventCont , UNO_QUERY ); - if (xCont.is()) - xCont->removeContainerListener( m_xContainerListener ); - } - m_xContainerListener.clear(); - } - } -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdObj::_propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException) -{ - if (isListening()) - { - DlgEdForm* pRealDlgEdForm = dynamic_cast< DlgEdForm* >(this); - if( pRealDlgEdForm == 0 ) - pRealDlgEdForm = GetDlgEdForm(); - - DlgEditor* pDlgEditor = pRealDlgEdForm ? pRealDlgEdForm->GetDlgEditor() : 0; - - if( !pDlgEditor || pDlgEditor->isInPaint() ) - return; - - // dialog model changed - pDlgEditor->SetDialogModelChanged(sal_True); - - // update position and size - if ( evt.PropertyName == DLGED_PROP_POSITIONX || evt.PropertyName == DLGED_PROP_POSITIONY || - evt.PropertyName == DLGED_PROP_WIDTH || evt.PropertyName == DLGED_PROP_HEIGHT || - evt.PropertyName == DLGED_PROP_DECORATION ) - { - PositionAndSizeChange( evt ); - - if ( evt.PropertyName == DLGED_PROP_DECORATION ) - { - if ( ISA(DlgEdForm) ) - ((DlgEdForm*)this)->GetDlgEditor()->ResetDialog(); - else - GetDlgEdForm()->GetDlgEditor()->ResetDialog(); - } - } - // change name of control in dialog model - else if ( evt.PropertyName == DLGED_PROP_NAME ) - { - if ( !ISA(DlgEdForm) ) - { - NameChange(evt); - } - } - // update step - else if ( evt.PropertyName == DLGED_PROP_STEP ) - { - UpdateStep(); - } - // change tabindex - else if ( evt.PropertyName == DLGED_PROP_TABINDEX ) - { - if ( !ISA(DlgEdForm) ) - { - TabIndexChange(evt); - } - } - } -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdObj::_elementInserted(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException) -{ - if (isListening()) - { - // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - } -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdObj::_elementReplaced(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException) -{ - if (isListening()) - { - // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - } -} - -//---------------------------------------------------------------------------- - -void SAL_CALL DlgEdObj::_elementRemoved(const ::com::sun::star::container::ContainerEvent& ) throw(::com::sun::star::uno::RuntimeException) -{ - if (isListening()) - { - // dialog model changed - if ( ISA(DlgEdForm) ) - { - ((DlgEdForm*)this)->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - else - { - GetDlgEdForm()->GetDlgEditor()->SetDialogModelChanged(sal_True); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdObj::SetLayer(SdrLayerID nLayer) -{ - SdrLayerID nOldLayer = GetLayer(); - - if ( nLayer != nOldLayer ) - { - SdrUnoObj::SetLayer( nLayer ); - - DlgEdHint aHint( DLGED_HINT_LAYERCHANGED, this ); - GetDlgEdForm()->GetDlgEditor()->Broadcast( aHint ); - } -} - -//---------------------------------------------------------------------------- - -TYPEINIT1(DlgEdForm, DlgEdObj); -DBG_NAME(DlgEdForm); - -//---------------------------------------------------------------------------- - -DlgEdForm::DlgEdForm() - :DlgEdObj() -{ - DBG_CTOR(DlgEdForm, NULL); -} - -//---------------------------------------------------------------------------- - -DlgEdForm::~DlgEdForm() -{ - DBG_DTOR(DlgEdForm, NULL); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::SetDlgEditor( DlgEditor* pEditor ) -{ - pDlgEditor = pEditor; - ImplInvalidateDeviceInfo(); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::ImplInvalidateDeviceInfo() -{ - mpDeviceInfo.reset(); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::SetRectFromProps() -{ - // get form position and size from properties - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nXIn = 0, nYIn = 0, nWidthIn = 0, nHeightIn = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nXIn; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nYIn; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidthIn; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeightIn; - - // transform coordinates - sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut; - if ( TransformFormToSdrCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) ) - { - // set rectangle position and size - Point aPoint( nXOut, nYOut ); - Size aSize( nWidthOut, nHeightOut ); - SetSnapRect( Rectangle( aPoint, aSize ) ); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::SetPropsFromRect() -{ - // get form position and size from rectangle - Rectangle aRect_ = GetSnapRect(); - sal_Int32 nXIn = aRect_.Left(); - sal_Int32 nYIn = aRect_.Top(); - sal_Int32 nWidthIn = aRect_.GetWidth(); - sal_Int32 nHeightIn = aRect_.GetHeight(); - - // transform coordinates - sal_Int32 nXOut, nYOut, nWidthOut, nHeightOut; - if ( TransformSdrToFormCoordinates( nXIn, nYIn, nWidthIn, nHeightIn, nXOut, nYOut, nWidthOut, nHeightOut ) ) - { - // set properties - Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - Any aValue; - aValue <<= nXOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - aValue <<= nYOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - aValue <<= nWidthOut; - xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue ); - aValue <<= nHeightOut; - xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue ); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::AddChild( DlgEdObj* pDlgEdObj ) -{ - pChilds.push_back( pDlgEdObj ); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::RemoveChild( DlgEdObj* pDlgEdObj ) -{ - pChilds.erase( ::std::find( pChilds.begin() , pChilds.end() , pDlgEdObj ) ); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) -{ - DlgEditor* pEditor = GetDlgEditor(); - DBG_ASSERT( pEditor, "DlgEdForm::PositionAndSizeChange: no dialog editor!" ); - if ( pEditor ) - { - DlgEdPage* pPage_ = pEditor->GetPage(); - DBG_ASSERT( pPage_, "DlgEdForm::PositionAndSizeChange: no page!" ); - if ( pPage_ ) - { - sal_Int32 nPageXIn = 0; - sal_Int32 nPageYIn = 0; - Size aPageSize = pPage_->GetSize(); - sal_Int32 nPageWidthIn = aPageSize.Width(); - sal_Int32 nPageHeightIn = aPageSize.Height(); - sal_Int32 nPageX, nPageY, nPageWidth, nPageHeight; - if ( TransformSdrToFormCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) - { - Reference< beans::XPropertySet > xPSetForm( GetUnoControlModel(), UNO_QUERY ); - if ( xPSetForm.is() ) - { - sal_Int32 nValue = 0; - evt.NewValue >>= nValue; - sal_Int32 nNewValue = nValue; - - if ( evt.PropertyName == DLGED_PROP_POSITIONX ) - { - if ( nNewValue < nPageX ) - nNewValue = nPageX; - } - else if ( evt.PropertyName == DLGED_PROP_POSITIONY ) - { - if ( nNewValue < nPageY ) - nNewValue = nPageY; - } - else if ( evt.PropertyName == DLGED_PROP_WIDTH ) - { - if ( nNewValue < 1 ) - nNewValue = 1; - } - else if ( evt.PropertyName == DLGED_PROP_HEIGHT ) - { - if ( nNewValue < 1 ) - nNewValue = 1; - } - - if ( nNewValue != nValue ) - { - Any aNewValue; - aNewValue <<= nNewValue; - EndListening( sal_False ); - xPSetForm->setPropertyValue( evt.PropertyName, aNewValue ); - StartListening(); - } - } - } - - bool bAdjustedPageSize = pEditor->AdjustPageSize(); - SetRectFromProps(); - ::std::vector< DlgEdObj* >::iterator aIter; - ::std::vector< DlgEdObj* > aChildList = ((DlgEdForm*)this)->GetChilds(); - - if ( bAdjustedPageSize ) - { - pEditor->InitScrollBars(); - aPageSize = pPage_->GetSize(); - nPageWidthIn = aPageSize.Width(); - nPageHeightIn = aPageSize.Height(); - if ( TransformSdrToControlCoordinates( nPageXIn, nPageYIn, nPageWidthIn, nPageHeightIn, nPageX, nPageY, nPageWidth, nPageHeight ) ) - { - for ( aIter = aChildList.begin(); aIter != aChildList.end(); aIter++ ) - { - Reference< beans::XPropertySet > xPSet( (*aIter)->GetUnoControlModel(), UNO_QUERY ); - if ( xPSet.is() ) - { - sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0; - xPSet->getPropertyValue( DLGED_PROP_POSITIONX ) >>= nX; - xPSet->getPropertyValue( DLGED_PROP_POSITIONY ) >>= nY; - xPSet->getPropertyValue( DLGED_PROP_WIDTH ) >>= nWidth; - xPSet->getPropertyValue( DLGED_PROP_HEIGHT ) >>= nHeight; - - sal_Int32 nNewX = nX; - if ( nX + nWidth > nPageX + nPageWidth ) - { - nNewX = nPageX + nPageWidth - nWidth; - if ( nNewX < nPageX ) - nNewX = nPageX; - } - if ( nNewX != nX ) - { - Any aValue; - aValue <<= nNewX; - EndListening( sal_False ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - StartListening(); - } - - sal_Int32 nNewY = nY; - if ( nY + nHeight > nPageY + nPageHeight ) - { - nNewY = nPageY + nPageHeight - nHeight; - if ( nNewY < nPageY ) - nNewY = nPageY; - } - if ( nNewY != nY ) - { - Any aValue; - aValue <<= nNewY; - EndListening( sal_False ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - StartListening(); - } - } - } - } - } - - for ( aIter = aChildList.begin(); aIter != aChildList.end(); aIter++ ) - { - (*aIter)->SetRectFromProps(); - } - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::UpdateStep() -{ - sal_uLong nObjCount; - SdrPage* pSdrPage = GetPage(); - - if ( pSdrPage && ( ( nObjCount = pSdrPage->GetObjCount() ) > 0 ) ) - { - for ( sal_uLong i = 0 ; i < nObjCount ; i++ ) - { - SdrObject* pObj = pSdrPage->GetObj(i); - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pObj); - if ( pDlgEdObj && !pDlgEdObj->ISA(DlgEdForm) ) - pDlgEdObj->UpdateStep(); - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::UpdateTabIndices() -{ - // stop listening with all children - ::std::vector::iterator aIter; - for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; ++aIter ) - { - (*aIter)->EndListening( sal_False ); - } - - Reference< ::com::sun::star::container::XNameAccess > xNameAcc( GetUnoControlModel() , UNO_QUERY ); - if ( xNameAcc.is() ) - { - // get sequence of control names - Sequence< ::rtl::OUString > aNames = xNameAcc->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - sal_Int32 nCtrls = aNames.getLength(); - - // create a map of tab indices and control names, sorted by tab index - IndexToNameMap aIndexToNameMap; - for ( sal_Int16 i = 0; i < nCtrls; ++i ) - { - // get name - ::rtl::OUString aName( pNames[i] ); - - // get tab index - sal_Int16 nTabIndex = -1; - Any aCtrl = xNameAcc->getByName( aName ); - Reference< ::com::sun::star::beans::XPropertySet > xPSet; - aCtrl >>= xPSet; - if ( xPSet.is() ) - xPSet->getPropertyValue( DLGED_PROP_TABINDEX ) >>= nTabIndex; - - // insert into map - aIndexToNameMap.insert( IndexToNameMap::value_type( nTabIndex, aName ) ); - } - - // set new tab indices - sal_Int16 nNewTabIndex = 0; - for ( IndexToNameMap::iterator aIt = aIndexToNameMap.begin(); aIt != aIndexToNameMap.end(); ++aIt ) - { - Any aCtrl = xNameAcc->getByName( aIt->second ); - Reference< beans::XPropertySet > xPSet; - aCtrl >>= xPSet; - if ( xPSet.is() ) - { - Any aTabIndex; - aTabIndex <<= (sal_Int16) nNewTabIndex++; - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); - } - } - - // #110559# - UpdateTabOrderAndGroups(); - } - - // start listening with all children - for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; ++aIter ) - { - (*aIter)->StartListening(); - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::UpdateTabOrder() -{ - // #110559# - // When the tabindex of a control model changes, the dialog control is - // notified about those changes. Due to #109067# (bad performance of - // dialog editor) the dialog control doesn't activate the tab order - // in design mode. When the dialog editor has reordered all - // tabindices, this method allows to activate the taborder afterwards. - - Reference< awt::XUnoControlContainer > xCont( GetControl(), UNO_QUERY ); - if ( xCont.is() ) - { - Sequence< Reference< awt::XTabController > > aSeqTabCtrls = xCont->getTabControllers(); - const Reference< awt::XTabController >* pTabCtrls = aSeqTabCtrls.getConstArray(); - sal_Int32 nCount = aSeqTabCtrls.getLength(); - for ( sal_Int32 i = 0; i < nCount; ++i ) - pTabCtrls[i]->activateTabOrder(); - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::UpdateGroups() -{ - // #110559# - // The grouping of radio buttons in a dialog is done by vcl. - // In the dialog editor we have two views (=controls) for one - // radio button model. One control is owned by the dialog control, - // but not visible in design mode. The other control is owned by - // the drawing layer object. Whereas the grouping of the first - // control is done by vcl, the grouping of the control in the - // drawing layer has to be done here. - - Reference< awt::XTabControllerModel > xTabModel( GetUnoControlModel() , UNO_QUERY ); - if ( xTabModel.is() ) - { - // create a global list of controls that belong to the dialog - ::std::vector aChildList = GetChilds(); - sal_uInt32 nSize = aChildList.size(); - Sequence< Reference< awt::XControl > > aSeqControls( nSize ); - for ( sal_uInt32 i = 0; i < nSize; ++i ) - aSeqControls.getArray()[i] = Reference< awt::XControl >( aChildList[i]->GetControl(), UNO_QUERY ); - - sal_Int32 nGroupCount = xTabModel->getGroupCount(); - for ( sal_Int32 nGroup = 0; nGroup < nGroupCount; ++nGroup ) - { - // get a list of control models that belong to this group - ::rtl::OUString aName; - Sequence< Reference< awt::XControlModel > > aSeqModels; - xTabModel->getGroup( nGroup, aSeqModels, aName ); - const Reference< awt::XControlModel >* pModels = aSeqModels.getConstArray(); - sal_Int32 nModelCount = aSeqModels.getLength(); - - // create a list of peers that belong to this group - Sequence< Reference< awt::XWindow > > aSeqPeers( nModelCount ); - for ( sal_Int32 nModel = 0; nModel < nModelCount; ++nModel ) - { - // for each control model find the corresponding control in the global list - const Reference< awt::XControl >* pControls = aSeqControls.getConstArray(); - sal_Int32 nControlCount = aSeqControls.getLength(); - for ( sal_Int32 nControl = 0; nControl < nControlCount; ++nControl ) - { - const Reference< awt::XControl > xCtrl( pControls[nControl] ); - if ( xCtrl.is() ) - { - Reference< awt::XControlModel > xCtrlModel( xCtrl->getModel() ); - if ( (awt::XControlModel*)xCtrlModel.get() == (awt::XControlModel*)pModels[nModel].get() ) - { - // get the control peer and insert into the list of peers - aSeqPeers.getArray()[ nModel ] = Reference< awt::XWindow >( xCtrl->getPeer(), UNO_QUERY ); - break; - } - } - } - } - - // set the group at the dialog peer - Reference< awt::XControl > xDlg( GetControl(), UNO_QUERY ); - if ( xDlg.is() ) - { - Reference< awt::XVclContainerPeer > xDlgPeer( xDlg->getPeer(), UNO_QUERY ); - if ( xDlgPeer.is() ) - xDlgPeer->setGroup( aSeqPeers ); - } - } - } -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::UpdateTabOrderAndGroups() -{ - UpdateTabOrder(); - UpdateGroups(); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::NbcMove( const Size& rSize ) -{ - SdrUnoObj::NbcMove( rSize ); - - // set geometry properties of form - EndListening(sal_False); - SetPropsFromRect(); - StartListening(); - - // set geometry properties of all childs - ::std::vector::iterator aIter; - for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; aIter++ ) - { - (*aIter)->EndListening(sal_False); - (*aIter)->SetPropsFromRect(); - (*aIter)->StartListening(); - } - - // dialog model changed - GetDlgEditor()->SetDialogModelChanged(sal_True); -} - -//---------------------------------------------------------------------------- - -void DlgEdForm::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract) -{ - SdrUnoObj::NbcResize( rRef, xFract, yFract ); - - // set geometry properties of form - EndListening(sal_False); - SetPropsFromRect(); - StartListening(); - - // set geometry properties of all childs - ::std::vector::iterator aIter; - for ( aIter = pChilds.begin() ; aIter != pChilds.end() ; aIter++ ) - { - (*aIter)->EndListening(sal_False); - (*aIter)->SetPropsFromRect(); - (*aIter)->StartListening(); - } - - // dialog model changed - GetDlgEditor()->SetDialogModelChanged(sal_True); -} - -//---------------------------------------------------------------------------- - -bool DlgEdForm::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) -{ - bool bResult = SdrUnoObj::EndCreate(rStat, eCmd); - - // stop listening - EndListening(sal_False); - - // set geometry properties - SetPropsFromRect(); - - // dialog model changed - GetDlgEditor()->SetDialogModelChanged(sal_True); - - // start listening - StartListening(); - - return bResult; -} - -//---------------------------------------------------------------------------- - -awt::DeviceInfo DlgEdForm::getDeviceInfo() const -{ - awt::DeviceInfo aDeviceInfo; - - DlgEditor* pEditor = GetDlgEditor(); - DBG_ASSERT( pEditor, "DlgEdForm::getDeviceInfo: no editor associated with the form object!" ); - if ( !pEditor ) - return aDeviceInfo; - - Window* pWindow = pEditor->GetWindow(); - DBG_ASSERT( pWindow, "DlgEdForm::getDeviceInfo: no window associated with the editor!" ); - if ( !pWindow ) - return aDeviceInfo; - - // obtain an XControl - ::utl::SharedUNOComponent< awt::XControl > xDialogControl; // ensures auto-disposal, if needed - xDialogControl.reset( GetControl(), ::utl::SharedUNOComponent< awt::XControl >::NoTakeOwnership ); - if ( !xDialogControl.is() ) - { - // don't create a temporary control all the time, this method here is called - // way too often. Instead, use a cached DeviceInfo. - // #i74065# - if ( !!mpDeviceInfo ) - return *mpDeviceInfo; - - Reference< awt::XControlContainer > xEditorControlContainer( pEditor->GetWindowControlContainer() ); - xDialogControl.reset( - GetTemporaryControlForWindow( *pWindow, xEditorControlContainer ), - ::utl::SharedUNOComponent< awt::XControl >::TakeOwnership ); - } - - Reference< awt::XDevice > xDialogDevice; - if ( xDialogControl.is() ) - xDialogDevice.set( xDialogControl->getPeer(), UNO_QUERY ); - DBG_ASSERT( xDialogDevice.is(), "DlgEdForm::getDeviceInfo: no device!" ); - if ( xDialogDevice.is() ) - aDeviceInfo = xDialogDevice->getInfo(); - - mpDeviceInfo.reset( aDeviceInfo ); - - return aDeviceInfo; -} - -//---------------------------------------------------------------------------- - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedpage.cxx b/basctl/source/dlged/dlgedpage.cxx deleted file mode 100644 index 3bacb0eb2..000000000 --- a/basctl/source/dlged/dlgedpage.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include "dlgedpage.hxx" -#include "dlged.hxx" -#include "dlgedmod.hxx" -#include "dlgedobj.hxx" - - -TYPEINIT1( DlgEdPage, SdrPage ); - -//---------------------------------------------------------------------------- - -DlgEdPage::DlgEdPage( DlgEdModel& rModel, bool bMasterPage ) - :SdrPage( rModel, bMasterPage ) -{ -} - -//---------------------------------------------------------------------------- - -DlgEdPage::DlgEdPage( const DlgEdPage& rPage ) - :SdrPage( rPage ) -{ - pDlgEdForm = rPage.pDlgEdForm; -} - -//---------------------------------------------------------------------------- - -DlgEdPage::~DlgEdPage() -{ - Clear(); -} - -//---------------------------------------------------------------------------- - -SdrPage* DlgEdPage::Clone() const -{ - return new DlgEdPage( *this ); -} - -//---------------------------------------------------------------------------- - -SdrObject* DlgEdPage::SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum) -{ - SdrObject* pObj = SdrPage::SetObjectOrdNum( nOldObjNum, nNewObjNum ); - - DlgEdHint aHint( DLGED_HINT_OBJORDERCHANGED ); - if ( pDlgEdForm ) - { - DlgEditor* pDlgEditor = pDlgEdForm->GetDlgEditor(); - if ( pDlgEditor ) - pDlgEditor->Broadcast( aHint ); - } - - return pObj; -} - -//---------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx deleted file mode 100644 index eed522548..000000000 --- a/basctl/source/dlged/dlgedview.cxx +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - - -#include "dlgedview.hxx" -#include "dlged.hxx" -#include - -#include -#include - -#include -#include -#include "dlgedobj.hxx" - -TYPEINIT1( DlgEdView, SdrView ); - -//---------------------------------------------------------------------------- - -DlgEdView::DlgEdView( SdrModel* pModel, OutputDevice* pOut, DlgEditor* pEditor ) - :SdrView( pModel, pOut ) - ,pDlgEditor( pEditor ) -{ - // #114898# - SetBufferedOutputAllowed(true); - SetBufferedOverlayAllowed(true); -} - -//---------------------------------------------------------------------------- - -DlgEdView::~DlgEdView() -{ -} - -//---------------------------------------------------------------------------- - -void DlgEdView::MarkListHasChanged() -{ - SdrView::MarkListHasChanged(); - - DlgEdHint aHint( DLGED_HINT_SELECTIONCHANGED ); - if ( pDlgEditor ) - { - pDlgEditor->Broadcast( aHint ); - pDlgEditor->UpdatePropertyBrowserDelayed(); - } -} - -//---------------------------------------------------------------------------- - -void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) -{ - // visible area - MapMode aMap( rWin.GetMapMode() ); - Point aOrg( aMap.GetOrigin() ); - Size aVisSize( rWin.GetOutputSize() ); - Rectangle RectTmp( Point(-aOrg.X(),-aOrg.Y()), aVisSize ); - Rectangle aVisRect( RectTmp ); - - // check, if rectangle is inside visible area - if ( !aVisRect.IsInside( rRect ) ) - { - // calculate scroll distance; the rectangle must be inside the visible area - sal_Int32 nScrollX = 0, nScrollY = 0; - - sal_Int32 nVisLeft = aVisRect.Left(); - sal_Int32 nVisRight = aVisRect.Right(); - sal_Int32 nVisTop = aVisRect.Top(); - sal_Int32 nVisBottom = aVisRect.Bottom(); - - sal_Int32 nDeltaX = pDlgEditor->GetHScroll()->GetLineSize(); - sal_Int32 nDeltaY = pDlgEditor->GetVScroll()->GetLineSize(); - - while ( rRect.Right() > nVisRight + nScrollX ) - nScrollX += nDeltaX; - - while ( rRect.Left() < nVisLeft + nScrollX ) - nScrollX -= nDeltaX; - - while ( rRect.Bottom() > nVisBottom + nScrollY ) - nScrollY += nDeltaY; - - while ( rRect.Top() < nVisTop + nScrollY ) - nScrollY -= nDeltaY; - - // don't scroll beyond the page size - Size aPageSize = pDlgEditor->GetPage()->GetSize(); - sal_Int32 nPageWidth = aPageSize.Width(); - sal_Int32 nPageHeight = aPageSize.Height(); - - if ( nVisRight + nScrollX > nPageWidth ) - nScrollX = nPageWidth - nVisRight; - - if ( nVisLeft + nScrollX < 0 ) - nScrollX = -nVisLeft; - - if ( nVisBottom + nScrollY > nPageHeight ) - nScrollY = nPageHeight - nVisBottom; - - if ( nVisTop + nScrollY < 0 ) - nScrollY = -nVisTop; - - // scroll window - rWin.Update(); - rWin.Scroll( -nScrollX, -nScrollY ); - aMap.SetOrigin( Point( aOrg.X() - nScrollX, aOrg.Y() - nScrollY ) ); - rWin.SetMapMode( aMap ); - rWin.Update(); - rWin.Invalidate(); - - // update scroll bars - if ( pDlgEditor ) - pDlgEditor->UpdateScrollBars(); - - DlgEdHint aHint( DLGED_HINT_WINDOWSCROLLED ); - if ( pDlgEditor ) - pDlgEditor->Broadcast( aHint ); - } -} - -//---------------------------------------------------------------------------- - -SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt16 nTol) -{ - DlgEdObj* pDlgEdObj = dynamic_cast< DlgEdObj* >(pRetval); - - if(pDlgEdObj) - { - bool bExcludeInner(false); - - if(0 != dynamic_cast< DlgEdForm* >(pRetval)) - { - // from DlgEdForm::CheckHit; exclude inner for DlgEdForm - bExcludeInner = true; - } - else if(pDlgEdObj->supportsService("com.sun.star.awt.UnoControlGroupBoxModel")) - { - // from DlgEdObj::CheckHit; exclude inner for group shapes - bExcludeInner = true; - } - - if(bExcludeInner) - { - // use direct model data; it's a DlgEdObj, so GetLastBoundRect() - // will access aOutRect directly - const Rectangle aOuterRectangle(pDlgEdObj->GetLastBoundRect()); - - if(!aOuterRectangle.IsEmpty() - && RECT_EMPTY != aOuterRectangle.Right() - && RECT_EMPTY != aOuterRectangle.Bottom()) - { - basegfx::B2DRange aOuterRange( - aOuterRectangle.Left(), aOuterRectangle.Top(), - aOuterRectangle.Right(), aOuterRectangle.Bottom()); - - if(nTol) - { - aOuterRange.grow(-1.0 * nTol); - } - - if(aOuterRange.isInside(basegfx::B2DPoint(rPnt.X(), rPnt.Y()))) - { - pRetval = 0; - } - } - } - } - - return pRetval; -} - -SdrObject* DlgEdView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const -{ - // call parent - SdrObject* pRetval = SdrView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay); - - if(pRetval) - { - // check hitted object locally - pRetval = impLocalHitCorrection(pRetval, rPnt, nTol); - } - - return pRetval; -} - -//---------------------------------------------------------------------------- -// eof - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgresid.src b/basctl/source/dlged/dlgresid.src deleted file mode 100644 index 4512dc752..000000000 --- a/basctl/source/dlged/dlgresid.src +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgresid.hrc" - -// Dialog Controls --------------------------------------------------------------- - -String RID_STR_CLASS_CONTROL -{ - Text = "Control" ; -}; -String RID_STR_CLASS_DIALOG -{ - Text = "Dialog" ; -}; -String RID_STR_CLASS_BUTTON -{ - Text = "CommandButton" ; -}; -String RID_STR_CLASS_RADIOBUTTON -{ - Text = "OptionButton" ; -}; -String RID_STR_CLASS_CHECKBOX -{ - Text = "CheckBox" ; -}; -String RID_STR_CLASS_LISTBOX -{ - Text = "ListBox" ; -}; -String RID_STR_CLASS_COMBOBOX -{ - Text = "ComboBox" ; -}; -String RID_STR_CLASS_GROUPBOX -{ - Text = "FrameControl" ; -}; -String RID_STR_CLASS_EDIT -{ - Text = "TextField" ; -}; -String RID_STR_CLASS_FIXEDTEXT -{ - Text = "Label" ; -}; -String RID_STR_CLASS_IMAGECONTROL -{ - Text = "ImageControl" ; -}; -String RID_STR_CLASS_PROGRESSBAR -{ - Text = "ProgressBar" ; -}; -String RID_STR_CLASS_SCROLLBAR -{ - Text = "ScrollBar" ; -}; -String RID_STR_CLASS_FIXEDLINE -{ - Text = "FixedLine" ; -}; -String RID_STR_CLASS_DATEFIELD -{ - Text = "DateField" ; -}; -String RID_STR_CLASS_TIMEFIELD -{ - Text = "TimeField" ; -}; -String RID_STR_CLASS_NUMERICFIELD -{ - Text = "NumericField" ; -}; -String RID_STR_CLASS_CURRENCYFIELD -{ - Text = "CurrencyField" ; -}; -String RID_STR_CLASS_FORMATTEDFIELD -{ - Text = "FormattedField" ; -}; -String RID_STR_CLASS_PATTERNFIELD -{ - Text = "PatternField" ; -}; -String RID_STR_CLASS_FILECONTROL -{ - Text = "FileControl" ; -}; -String RID_STR_CLASS_TREECONTROL -{ - Text = "TreeControl" ; -}; - - -// Property Browser Headline ---------------------------------------------------------------- - -String RID_STR_BRWTITLE_PROPERTIES -{ - Text [ en-US ] = "Properties: "; -}; -String RID_STR_BRWTITLE_NO_PROPERTIES -{ - Text [ en-US ] = "No Control marked"; -}; -String RID_STR_BRWTITLE_MULTISELECT -{ - Text [ en-US ] = "Multiselection"; -}; - -// ----------------------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx deleted file mode 100644 index f5548632b..000000000 --- a/basctl/source/dlged/managelang.cxx +++ /dev/null @@ -1,427 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include "managelang.hxx" -#include "iderid.hxx" -#include "localizationmgr.hxx" -#include "iderdll.hxx" -#include "basidesh.hxx" -#include "basobj.hxx" - -#include "managelang.hrc" -#include "dlgresid.hrc" -#include "helpid.hrc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -using namespace ::com::sun::star::i18n; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::resource; -using namespace ::com::sun::star::uno; - -bool localesAreEqual( const Locale& rLocaleLeft, const Locale& rLocaleRight ) -{ - bool bRet = ( rLocaleLeft.Language.equals( rLocaleRight.Language ) && - rLocaleLeft.Country.equals( rLocaleRight.Country ) && - rLocaleLeft.Variant.equals( rLocaleRight.Variant ) ); - return bRet; -} - -namespace { - long getLongestWordWidth( const String& rText, const Window& rWin ) - { - long nWidth = 0; - Reference< XBreakIterator > xBreakIter( vcl::unohelper::CreateBreakIterator() ); - sal_Int32 nStartPos = 0; - const Locale aLocale = Application::GetSettings().GetUILocale(); - Boundary aBoundary = xBreakIter->getWordBoundary( - rText, nStartPos, aLocale, WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); - - while ( aBoundary.startPos != aBoundary.endPos ) - { - nStartPos = aBoundary.endPos; - String sWord( rText.Copy( - (sal_uInt16)aBoundary.startPos, - (sal_uInt16)aBoundary.endPos - (sal_uInt16)aBoundary.startPos ) ); - long nTemp = rWin.GetCtrlTextWidth( sWord ); - if ( nTemp > nWidth ) - nWidth = nTemp; - aBoundary = xBreakIter->nextWord( - rText, nStartPos, aLocale, WordType::ANYWORD_IGNOREWHITESPACES ); - } - - return nWidth; - } -} - -ManageLanguageDialog::ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : - - ModalDialog( pParent, IDEResId( RID_DLG_MANAGE_LANGUAGE ) ), - - m_aLanguageFT ( this, IDEResId( FT_LANGUAGE ) ), - m_aLanguageLB ( this, IDEResId( LB_LANGUAGE ) ), - m_aAddPB ( this, IDEResId( PB_ADD_LANG ) ), - m_aDeletePB ( this, IDEResId( PB_DEL_LANG ) ), - m_aMakeDefPB ( this, IDEResId( PB_MAKE_DEFAULT ) ), - m_aInfoFT ( this, IDEResId( FT_INFO ) ), - m_aBtnLine ( this, IDEResId( FL_BUTTONS ) ), - m_aHelpBtn ( this, IDEResId( PB_HELP ) ), - m_aCloseBtn ( this, IDEResId( PB_CLOSE ) ), - m_pLocalizationMgr ( _pLMgr ), - m_sDefLangStr ( IDEResId( STR_DEF_LANG ) ), - m_sDeleteStr ( IDEResId( STR_DELETE ) ), - m_sCreateLangStr ( IDEResId( STR_CREATE_LANG ) ) - -{ - FreeResource(); - - Init(); - FillLanguageBox(); - SelectHdl( NULL ); -} - -ManageLanguageDialog::~ManageLanguageDialog() -{ - ClearLanguageBox(); -} - -void ManageLanguageDialog::Init() -{ - // get current IDE - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - String sLibName = pIDEShell->GetCurLibName(); - // set dialog title with library name - String sText = GetText(); - sText.SearchAndReplace( String::CreateFromAscii("$1"), sLibName ); - SetText( sText ); - // set handler - m_aAddPB.SetClickHdl( LINK( this, ManageLanguageDialog, AddHdl ) ); - m_aDeletePB.SetClickHdl( LINK( this, ManageLanguageDialog, DeleteHdl ) ); - m_aMakeDefPB.SetClickHdl( LINK( this, ManageLanguageDialog, MakeDefHdl ) ); - m_aLanguageLB.SetSelectHdl( LINK( this, ManageLanguageDialog, SelectHdl ) ); - - m_aLanguageLB.EnableMultiSelection( sal_True ); - CalcInfoSize(); -} - -void ManageLanguageDialog::CalcInfoSize() -{ - String sInfoStr = m_aInfoFT.GetText(); - long nInfoWidth = m_aInfoFT.GetSizePixel().Width(); - long nLongWord = getLongestWordWidth( sInfoStr, m_aInfoFT ); - long nTxtWidth = m_aInfoFT.GetCtrlTextWidth( sInfoStr ) + nLongWord; - long nLines = ( nTxtWidth / nInfoWidth ) + 1; - if ( nLines > INFO_LINES_COUNT ) - { - Size aFTSize = m_aLanguageFT.GetSizePixel(); - Size aSize = m_aInfoFT.GetSizePixel(); - long nNewHeight = aFTSize.Height() * nLines; - long nDelta = nNewHeight - aSize.Height(); - aSize.Height() = nNewHeight; - m_aInfoFT.SetSizePixel( aSize ); - - aSize = m_aLanguageLB.GetSizePixel(); - aSize.Height() -= nDelta; - m_aLanguageLB.SetSizePixel( aSize ); - - Point aNewPos = m_aInfoFT.GetPosPixel(); - aNewPos.Y() -= nDelta; - m_aInfoFT.SetPosPixel( aNewPos ); - aNewPos = m_aMakeDefPB.GetPosPixel(); - aNewPos.Y() -= nDelta; - m_aMakeDefPB.SetPosPixel( aNewPos ); - } -} - -void ManageLanguageDialog::FillLanguageBox() -{ - DBG_ASSERT( m_pLocalizationMgr, "ManageLanguageDialog::FillLanguageBox(): no localization manager" ); - - if ( m_pLocalizationMgr->isLibraryLocalized() ) - { - SvtLanguageTable aLangTable; - Locale aDefaultLocale = m_pLocalizationMgr->getStringResourceManager()->getDefaultLocale(); - Sequence< Locale > aLocaleSeq = m_pLocalizationMgr->getStringResourceManager()->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 i, nCount = aLocaleSeq.getLength(); - for ( i = 0; i < nCount; ++i ) - { - bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] ); - LanguageType eLangType = SvxLocaleToLanguage( pLocale[i] ); - String sLanguage = aLangTable.GetString( eLangType ); - if ( bIsDefault ) - { - sLanguage += ' '; - sLanguage += m_sDefLangStr; - } - sal_uInt16 nPos = m_aLanguageLB.InsertEntry( sLanguage ); - m_aLanguageLB.SetEntryData( nPos, new LanguageEntry( sLanguage, pLocale[i], bIsDefault ) ); - } - } - else - m_aLanguageLB.InsertEntry( m_sCreateLangStr ); -} - -void ManageLanguageDialog::ClearLanguageBox() -{ - sal_uInt16 i, nCount = m_aLanguageLB.GetEntryCount(); - for ( i = 0; i < nCount; ++i ) - { - LanguageEntry* pEntry = (LanguageEntry*)( m_aLanguageLB.GetEntryData(i) ); - if ( pEntry ) - delete pEntry; - } - m_aLanguageLB.Clear(); -} - -IMPL_LINK( ManageLanguageDialog, AddHdl, Button *, EMPTYARG ) -{ - SetDefaultLanguageDialog aDlg( this, m_pLocalizationMgr ); - if ( RET_OK == aDlg.Execute() ) - { - // add new locales - Sequence< Locale > aLocaleSeq = aDlg.GetLocales(); - m_pLocalizationMgr->handleAddLocales( aLocaleSeq ); - // update listbox - ClearLanguageBox(); - FillLanguageBox(); - - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) - pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - } - return 1; -} - -IMPL_LINK( ManageLanguageDialog, DeleteHdl, Button *, EMPTYARG ) -{ - QueryBox aQBox( this, IDEResId( RID_QRYBOX_LANGUAGE ) ); - aQBox.SetButtonText( RET_OK, m_sDeleteStr ); - if ( aQBox.Execute() == RET_OK ) - { - sal_uInt16 i, nCount = m_aLanguageLB.GetSelectEntryCount(); - sal_uInt16 nPos = m_aLanguageLB.GetSelectEntryPos(); - // remove locales - Sequence< Locale > aLocaleSeq( nCount ); - for ( i = 0; i < nCount; ++i ) - { - sal_uInt16 nSelPos = m_aLanguageLB.GetSelectEntryPos(i); - LanguageEntry* pEntry = (LanguageEntry*)( m_aLanguageLB.GetEntryData( nSelPos ) ); - if ( pEntry ) - aLocaleSeq[i] = pEntry->m_aLocale; - } - m_pLocalizationMgr->handleRemoveLocales( aLocaleSeq ); - // update listbox - ClearLanguageBox(); - FillLanguageBox(); - // reset selection - nCount = m_aLanguageLB.GetEntryCount(); - if ( nCount <= nPos ) - nPos = nCount - 1; - m_aLanguageLB.SelectEntryPos( nPos ); - SelectHdl( NULL ); - } - return 1; -} - -IMPL_LINK( ManageLanguageDialog, MakeDefHdl, Button *, EMPTYARG ) -{ - sal_uInt16 nPos = m_aLanguageLB.GetSelectEntryPos(); - LanguageEntry* pSelectEntry = (LanguageEntry*)( m_aLanguageLB.GetEntryData( nPos ) ); - if ( pSelectEntry && !pSelectEntry->m_bIsDefault ) - { - // set new default entry - m_pLocalizationMgr->handleSetDefaultLocale( pSelectEntry->m_aLocale ); - // update Listbox - ClearLanguageBox(); - FillLanguageBox(); - // reset selection - m_aLanguageLB.SelectEntryPos( nPos ); - SelectHdl( NULL ); - } - - return 1; -} - -IMPL_LINK( ManageLanguageDialog, SelectHdl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nCount = m_aLanguageLB.GetEntryCount(); - bool bEmpty = ( !nCount || - m_aLanguageLB.GetEntryPos( m_sCreateLangStr ) != LISTBOX_ENTRY_NOTFOUND ); - bool bSelect = ( m_aLanguageLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); - bool bEnable = ( !bEmpty && bSelect != false ); - - m_aDeletePB.Enable( bEnable != false ); - m_aMakeDefPB.Enable( bEnable != false && nCount > 1 && m_aLanguageLB.GetSelectEntryCount() == 1 ); - - return 1; -} - -// class SetDefaultLanguageDialog ----------------------------------------------- - -SetDefaultLanguageDialog::SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ) : - - ModalDialog( pParent, IDEResId( RID_DLG_SETDEF_LANGUAGE ) ), - - m_aLanguageFT ( this, IDEResId( FT_DEF_LANGUAGE ) ), - m_pLanguageLB ( new SvxLanguageBox( this, IDEResId( LB_DEF_LANGUAGE ) ) ), - m_pCheckLangLB ( NULL ), - m_aInfoFT ( this, IDEResId( FT_DEF_INFO ) ), - m_aBtnLine ( this, IDEResId( FL_DEF_BUTTONS ) ), - m_aOKBtn ( this, IDEResId( PB_DEF_OK ) ), - m_aCancelBtn ( this, IDEResId( PB_DEF_CANCEL ) ), - m_aHelpBtn ( this, IDEResId( PB_DEF_HELP ) ), - - m_pLocalizationMgr( _pLMgr ) - -{ - if ( m_pLocalizationMgr->isLibraryLocalized() ) - { - // change to "Add Interface Language" mode - SetHelpId( HID_BASICIDE_ADDNEW_LANGUAGE ); - m_pCheckLangLB = new SvxCheckListBox( this, IDEResId( LB_ADD_LANGUAGE ) ); - SetText( String( IDEResId( STR_ADDLANG_TITLE ) ) ); - m_aLanguageFT.SetText( String( IDEResId( STR_ADDLANG_LABEL ) ) ); - m_aInfoFT.SetText( String( IDEResId( STR_ADDLANG_INFO ) ) ); - } - - FreeResource(); - - FillLanguageBox(); - CalcInfoSize(); -} - -SetDefaultLanguageDialog::~SetDefaultLanguageDialog() -{ - delete m_pLanguageLB; - delete m_pCheckLangLB; -} - -void SetDefaultLanguageDialog::FillLanguageBox() -{ - // fill list with all languages - m_pLanguageLB->SetLanguageList( LANG_LIST_ALL, sal_False ); - // remove the already localized languages - Sequence< Locale > aLocaleSeq = m_pLocalizationMgr->getStringResourceManager()->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 i, nCount = aLocaleSeq.getLength(); - for ( i = 0; i < nCount; ++i ) - m_pLanguageLB->RemoveLanguage( SvxLocaleToLanguage( pLocale[i] ) ); - - // fill checklistbox if not in default mode - if ( m_pLocalizationMgr->isLibraryLocalized() ) - { - sal_uInt16 j, nCount_ = m_pLanguageLB->GetEntryCount(); - for ( j = 0; j < nCount_; ++j ) - { - m_pCheckLangLB->InsertEntry( - m_pLanguageLB->GetEntry(j), LISTBOX_APPEND, m_pLanguageLB->GetEntryData(j) ); - } - delete m_pLanguageLB; - m_pLanguageLB = NULL; - } - else - // preselect current UI language - m_pLanguageLB->SelectLanguage( Application::GetSettings().GetUILanguage() ); -} - -void SetDefaultLanguageDialog::CalcInfoSize() -{ - String sInfoStr = m_aInfoFT.GetText(); - long nInfoWidth = m_aInfoFT.GetSizePixel().Width(); - long nLongWord = getLongestWordWidth( sInfoStr, m_aInfoFT ); - long nTxtWidth = m_aInfoFT.GetCtrlTextWidth( sInfoStr ) + nLongWord; - long nLines = ( nTxtWidth / nInfoWidth ) + 1; - if ( nLines > INFO_LINES_COUNT ) - { - Size aFTSize = m_aLanguageFT.GetSizePixel(); - Size aSize = m_aInfoFT.GetSizePixel(); - long nNewHeight = aFTSize.Height() * nLines; - long nDelta = nNewHeight - aSize.Height(); - aSize.Height() = nNewHeight; - m_aInfoFT.SetSizePixel( aSize ); - - Window* pWin = ( m_pLanguageLB != NULL ) ? dynamic_cast< Window* >( m_pLanguageLB ) - : dynamic_cast< Window* >( m_pCheckLangLB ); - aSize = pWin->GetSizePixel(); - aSize.Height() -= nDelta; - pWin->SetSizePixel( aSize ); - - Point aNewPos = m_aInfoFT.GetPosPixel(); - aNewPos.Y() -= nDelta; - m_aInfoFT.SetPosPixel( aNewPos ); - } -} - -Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const -{ - bool bNotLocalized = !m_pLocalizationMgr->isLibraryLocalized(); - sal_Int32 nSize = bNotLocalized ? 1 : m_pCheckLangLB->GetCheckedEntryCount(); - Sequence< Locale > aLocaleSeq( nSize ); - if ( bNotLocalized ) - { - Locale aLocale; - SvxLanguageToLocale( aLocale, m_pLanguageLB->GetSelectLanguage() ); - aLocaleSeq[0] = aLocale; - } - else - { - sal_uInt16 i, nCount = static_cast< sal_uInt16 >( m_pCheckLangLB->GetEntryCount() ); - sal_Int32 j = 0; - for ( i = 0; i < nCount; ++i ) - { - if ( m_pCheckLangLB->IsChecked(i) ) - { - LanguageType eType = LanguageType( (sal_uLong)m_pCheckLangLB->GetEntryData(i) ); - Locale aLocale; - SvxLanguageToLocale( aLocale, eType ); - aLocaleSeq[j++] = aLocale; - } - } - DBG_ASSERT( nSize == j, "SetDefaultLanguageDialog::GetLocales(): invalid indexes" ); - } - return aLocaleSeq; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/managelang.hrc b/basctl/source/dlged/managelang.hrc deleted file mode 100644 index 6abb2ae3b..000000000 --- a/basctl/source/dlged/managelang.hrc +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_MANAGELANG_HRC -#define _BASCTL_MANAGELANG_HRC - -// Include ----------------------------------------------------------------------- - -#include - -// Dialog Control Id's ----------------------------------------------------------- - -#define FT_LANGUAGE 1 -#define LB_LANGUAGE 2 -#define PB_ADD_LANG 3 -#define PB_DEL_LANG 4 -#define PB_MAKE_DEFAULT 5 -#define FT_INFO 6 -#define FL_BUTTONS 7 -#define PB_HELP 8 -#define PB_CLOSE 9 -#define STR_DEF_LANG 10 -#define STR_DELETE 11 -#define STR_CREATE_LANG 12 - -#define FT_DEF_LANGUAGE 1 -#define LB_DEF_LANGUAGE 2 -#define LB_ADD_LANGUAGE 3 -#define FT_DEF_INFO 4 -#define FL_DEF_BUTTONS 5 -#define PB_DEF_OK 6 -#define PB_DEF_CANCEL 7 -#define PB_DEF_HELP 8 -#define STR_ADDLANG_TITLE 9 -#define STR_ADDLANG_LABEL 10 -#define STR_ADDLANG_INFO 11 - -// Metrics ----------------------------------------------------------------------- - -#define MANAGE_DLG_WIDTH 240 -#define MANAGE_DLG_HEIGHT 180 -#define INFO_LINES_COUNT 3 - -#define MANAGE_COL1 RSC_SP_DLG_INNERBORDER_LEFT -#define MANAGE_COL2 (MANAGE_DLG_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT - 2*RSC_CD_PUSHBUTTON_WIDTH - RSC_SP_CTRL_X) -#define MANAGE_COL3 (MANAGE_COL2 + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_CTRL_X) - -#define MANAGE_ROW1 RSC_SP_DLG_INNERBORDER_TOP -#define MANAGE_ROW2 (MANAGE_ROW1 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y) -#define MANAGE_ROW3 (MANAGE_ROW2 + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y) - -#define MANAGE_ROW7 (MANAGE_DLG_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT) -#define MANAGE_ROW6 (MANAGE_ROW7 - RSC_SP_FLGR_SPACE_Y - RSC_CD_FIXEDLINE_HEIGHT) -#define MANAGE_ROW5 (MANAGE_ROW6 - RSC_SP_FLGR_SPACE_Y - INFO_LINES_COUNT*RSC_CD_FIXEDTEXT_HEIGHT) -#define MANAGE_ROW4 (MANAGE_ROW5 - RSC_SP_CTRL_GROUP_Y - RSC_CD_PUSHBUTTON_HEIGHT) -#define MANAGE_ROW4A (MANAGE_ROW4 + RSC_CD_PUSHBUTTON_HEIGHT) - -#define MANAGE_LB_WIDTH (MANAGE_COL3 - RSC_SP_CTRL_X - RSC_SP_DLG_INNERBORDER_LEFT) -#define MANAGE_LB_HEIGHT (MANAGE_ROW4A - MANAGE_ROW2) - -#define SETDEF_DLG_WIDTH 180 -#define SETDEF_DLG_HEIGHT 165 - -#define SETDEF_COL1 RSC_SP_DLG_INNERBORDER_LEFT -#define SETDEF_COL2 (SETDEF_DLG_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT - 3*RSC_CD_PUSHBUTTON_WIDTH - RSC_SP_CTRL_GROUP_X - RSC_SP_CTRL_X) -#define SETDEF_COL3 (SETDEF_COL2 + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_CTRL_GROUP_X) -#define SETDEF_COL4 (SETDEF_COL3 + RSC_CD_PUSHBUTTON_WIDTH + RSC_SP_CTRL_X) -#define SETDEF_COL4A (SETDEF_COL4 + RSC_CD_PUSHBUTTON_WIDTH) - -#define SETDEF_ROW1 RSC_SP_DLG_INNERBORDER_TOP -#define SETDEF_ROW2 (SETDEF_ROW1 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y) - -#define SETDEF_ROW5 (SETDEF_DLG_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT) -#define SETDEF_ROW4 (SETDEF_ROW5 - RSC_SP_FLGR_SPACE_Y - RSC_CD_FIXEDLINE_HEIGHT) -#define SETDEF_ROW3 (SETDEF_ROW4 - RSC_SP_FLGR_SPACE_Y - INFO_LINES_COUNT*RSC_CD_FIXEDTEXT_HEIGHT) -#define SETDEF_ROW3A (SETDEF_ROW3 - RSC_SP_CTRL_GROUP_Y) - -#define SETDEF_LB_WIDTH (SETDEF_COL4A - SETDEF_COL1) -#define SETDEF_LB_HEIGHT (SETDEF_ROW3A - SETDEF_ROW2) - -#endif // _BASCTL_MANAGELANG_HRC - diff --git a/basctl/source/dlged/managelang.src b/basctl/source/dlged/managelang.src deleted file mode 100644 index 822502ff9..000000000 --- a/basctl/source/dlged/managelang.src +++ /dev/null @@ -1,237 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgresid.hrc" -#include "managelang.hrc" -#include "helpid.hrc" - -ModalDialog RID_DLG_MANAGE_LANGUAGE -{ - HelpId = HID_BASICIDE_MANAGE_LANGUAGE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( MANAGE_DLG_WIDTH , MANAGE_DLG_HEIGHT ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Manage User Interface Languages [$1]" ; - FixedText FT_LANGUAGE - { - Pos = MAP_APPFONT ( MANAGE_COL1 , MANAGE_ROW1 ) ; - Size = MAP_APPFONT ( MANAGE_LB_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Present Languages" ; - }; - ListBox LB_LANGUAGE - { - HelpID = "basctl:ListBox:RID_DLG_MANAGE_LANGUAGE:LB_LANGUAGE"; - Pos = MAP_APPFONT ( MANAGE_COL1 , MANAGE_ROW2 ) ; - Size = MAP_APPFONT ( MANAGE_LB_WIDTH , MANAGE_LB_HEIGHT ) ; - Border = TRUE; - AutoHScroll = TRUE ; - }; - PushButton PB_ADD_LANG - { - HelpID = "basctl:PushButton:RID_DLG_MANAGE_LANGUAGE:PB_ADD_LANG"; - Pos = MAP_APPFONT ( MANAGE_COL3 , MANAGE_ROW2 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "Add..." ; - }; - PushButton PB_DEL_LANG - { - HelpID = "basctl:PushButton:RID_DLG_MANAGE_LANGUAGE:PB_DEL_LANG"; - Pos = MAP_APPFONT ( MANAGE_COL3 , MANAGE_ROW3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "Delete" ; - }; - PushButton PB_MAKE_DEFAULT - { - HelpID = "basctl:PushButton:RID_DLG_MANAGE_LANGUAGE:PB_MAKE_DEFAULT"; - Pos = MAP_APPFONT ( MANAGE_COL3 , MANAGE_ROW4 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "Default" ; - }; - FixedText FT_INFO - { - Pos = MAP_APPFONT ( MANAGE_COL1 , MANAGE_ROW5 ) ; - Size = MAP_APPFONT ( MANAGE_DLG_WIDTH - 2*RSC_SP_FLGR_INNERBORDER_LEFT, INFO_LINES_COUNT*RSC_CD_FIXEDTEXT_HEIGHT ) ; - WordBreak = TRUE ; - Text [ en-US ] = "The default language is used if no localization for a user interface locale is present. Furthermore all strings from the default language are copied to resources of newly added languages." ; - }; - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT ( 0 , MANAGE_ROW6 ) ; - Size = MAP_APPFONT ( MANAGE_DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( MANAGE_COL2 , MANAGE_ROW7 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - OKButton PB_CLOSE - { - Pos = MAP_APPFONT ( MANAGE_COL3 , MANAGE_ROW7 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "~Close" ; - }; - String STR_DEF_LANG - { - Text [ en-US ] = "[Default Language]" ; - }; - String STR_DELETE - { - Text [ en-US ] = "~Delete" ; - }; - String STR_CREATE_LANG - { - Text [ en-US ] = "" ; - }; -}; - -QueryBox RID_QRYBOX_LANGUAGE -{ - Title [ en-US ] = "Delete Language Resources" ; - Message [ en-US ] = "You are about to delete the resources for the selected language(s). All user interface strings for this language(s) will be deleted.\n\nDo you want to delete the resources of the selected language(s)?"; - BUTTONS = WB_OK_CANCEL ; - DEFBUTTON = WB_DEF_CANCEL ; -}; - -ModalDialog RID_DLG_SETDEF_LANGUAGE -{ - HelpId = HID_BASICIDE_SETDEFAULT_LANGUAGE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( SETDEF_DLG_WIDTH , SETDEF_DLG_HEIGHT ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Set Default User Interface Language" ; - FixedText FT_DEF_LANGUAGE - { - Pos = MAP_APPFONT ( SETDEF_COL1 , SETDEF_ROW1 ) ; - Size = MAP_APPFONT ( SETDEF_LB_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Default language" ; - }; - ListBox LB_DEF_LANGUAGE - { - HelpID = "basctl:ListBox:RID_DLG_SETDEF_LANGUAGE:LB_DEF_LANGUAGE"; - Pos = MAP_APPFONT ( SETDEF_COL1 , SETDEF_ROW2 ) ; - Size = MAP_APPFONT ( SETDEF_LB_WIDTH , SETDEF_LB_HEIGHT ) ; - Border = TRUE; - AutoHScroll = TRUE ; - }; - Control LB_ADD_LANGUAGE - { - HelpId = HID_BASICIDE_ADDNEW_CONTROL ; - Pos = MAP_APPFONT ( SETDEF_COL1 , SETDEF_ROW2 ) ; - Size = MAP_APPFONT ( SETDEF_LB_WIDTH , SETDEF_LB_HEIGHT ) ; - }; - FixedText FT_DEF_INFO - { - Pos = MAP_APPFONT ( SETDEF_COL1 , SETDEF_ROW3 ) ; - Size = MAP_APPFONT ( SETDEF_LB_WIDTH, INFO_LINES_COUNT*RSC_CD_FIXEDTEXT_HEIGHT ) ; - WordBreak = TRUE ; - Text [ en-US ] = "Select a language to define the default user interface language. All currently present strings will be assigned to the resources created for the selected language." ; - }; - FixedLine FL_DEF_BUTTONS - { - Pos = MAP_APPFONT ( 0 , SETDEF_ROW4 ) ; - Size = MAP_APPFONT ( SETDEF_DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ) ; - }; - OKButton PB_DEF_OK - { - Pos = MAP_APPFONT ( SETDEF_COL2 , SETDEF_ROW5 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_DEF_CANCEL - { - Pos = MAP_APPFONT ( SETDEF_COL3 , SETDEF_ROW5 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - HelpButton PB_DEF_HELP - { - Pos = MAP_APPFONT ( SETDEF_COL4 , SETDEF_ROW5 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - String STR_ADDLANG_TITLE - { - Text [ en-US ] = "Add User Interface Languages" ; - }; - String STR_ADDLANG_LABEL - { - Text [ en-US ] = "Available Languages" ; - }; - String STR_ADDLANG_INFO - { - Text [ en-US ] = "Select languages to be added. Resources for these languages will be created in the library. Strings of the current default user interface language will be copied to these new resources by default." ; - }; -}; - -// ----------------------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx deleted file mode 100644 index a43a2528b..000000000 --- a/basctl/source/dlged/propbrw.cxx +++ /dev/null @@ -1,596 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_basctl.hxx" - -#include -#include "propbrw.hxx" -#include "dlgedobj.hxx" - -#include "basidesh.hxx" -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::comphelper; - - -SFX_IMPL_FLOATINGWINDOW(PropBrwMgr, SID_SHOW_PROPERTYBROWSER) - - -PropBrwMgr::PropBrwMgr( Window* _pParent, sal_uInt16 nId, - SfxBindings *pBindings, SfxChildWinInfo* pInfo) - :SfxChildWindow( _pParent, nId ) -{ - // set current selection - SfxViewShell* pShell = SfxViewShell::Current(); - pWindow = new PropBrw( - ::comphelper::getProcessServiceFactory(), - pBindings, - this, - _pParent, - pShell ? pShell->GetCurrentDocument() : Reference< XModel >() - ); - - eChildAlignment = SFX_ALIGN_NOALIGNMENT; - ((SfxFloatingWindow*)pWindow)->Initialize( pInfo ); - - ((PropBrw*)pWindow)->Update( pShell ); -} - - -void PropBrw::Update( const SfxViewShell* _pShell ) -{ - const BasicIDEShell* pBasicIDEShell = dynamic_cast< const BasicIDEShell* >( _pShell ); - OSL_ENSURE( pBasicIDEShell || !_pShell, "PropBrw::Update: invalid shell!" ); - if ( pBasicIDEShell ) - { - ImplUpdate( pBasicIDEShell->GetCurrentDocument(), pBasicIDEShell->GetCurDlgView() ); - } - else if ( _pShell ) - { - ImplUpdate( NULL, _pShell->GetDrawView() ); - } - else - { - ImplUpdate( NULL, NULL ); - } -} - - -const long STD_WIN_SIZE_X = 300; -const long STD_WIN_SIZE_Y = 350; - -const long STD_MIN_SIZE_X = 250; -const long STD_MIN_SIZE_Y = 250; - -const long STD_WIN_POS_X = 50; -const long STD_WIN_POS_Y = 50; -const long WIN_BORDER = 2; -const long MIN_WIN_SIZE_X = 50; -const long MIN_WIN_SIZE_Y = 50; - - -DBG_NAME(PropBrw) - - -PropBrw::PropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBindings* _pBindings, PropBrwMgr* _pMgr, Window* _pParent, - const Reference< XModel >& _rxContextDocument ) - :SfxFloatingWindow( _pBindings, _pMgr, _pParent, WinBits( WB_STDMODELESS | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE ) ) - ,m_bInitialStateChange(sal_True) - ,m_xORB(_xORB) - ,m_xContextDocument( _rxContextDocument ) - ,pView( NULL ) -{ - DBG_CTOR(PropBrw,NULL); - - Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); - SetMinOutputSizePixel(Size(STD_MIN_SIZE_X,STD_MIN_SIZE_Y)); - SetOutputSizePixel(aPropWinSize); - - try - { - // create a frame wrapper for myself - m_xMeAsFrame = Reference< XFrame >(m_xORB->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Frame" ))), UNO_QUERY); - if (m_xMeAsFrame.is()) - { - m_xMeAsFrame->initialize( VCLUnoHelper::GetInterface ( this ) ); - m_xMeAsFrame->setName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "form property browser" ))); // change name! - } - } - catch (Exception&) - { - OSL_FAIL("PropBrw::PropBrw: could not create/initialize my frame!"); - m_xMeAsFrame.clear(); - } - - ImplReCreateController(); -} - - -void PropBrw::ImplReCreateController() -{ - OSL_PRECOND( m_xMeAsFrame.is(), "PropBrw::ImplCreateController: no frame for myself!" ); - if ( !m_xMeAsFrame.is() ) - return; - - if ( m_xBrowserController.is() ) - ImplDestroyController(); - - try - { - Reference< XPropertySet > xFactoryProperties( m_xORB, UNO_QUERY_THROW ); - Reference< XComponentContext > xOwnContext( - xFactoryProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), - UNO_QUERY_THROW ); - - // a ComponentContext for the - ::cppu::ContextEntry_Init aHandlerContextInfo[] = - { - ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface ( this ) ) ), - ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ), makeAny( m_xContextDocument ) ) - }; - Reference< XComponentContext > xInspectorContext( - ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), xOwnContext ) ); - - // create a property browser controller - Reference< XMultiComponentFactory > xFactory( xInspectorContext->getServiceManager(), UNO_QUERY_THROW ); - static const ::rtl::OUString s_sControllerServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.PropertyBrowserController" )); - m_xBrowserController = Reference< XPropertySet >( - xFactory->createInstanceWithContext( s_sControllerServiceName, xInspectorContext ), UNO_QUERY - ); - if ( !m_xBrowserController.is() ) - { - ShowServiceNotAvailableError( GetParent(), s_sControllerServiceName, sal_True ); - } - else - { - Reference< XController > xAsXController( m_xBrowserController, UNO_QUERY ); - DBG_ASSERT(xAsXController.is(), "PropBrw::PropBrw: invalid controller object!"); - if (!xAsXController.is()) - { - ::comphelper::disposeComponent(m_xBrowserController); - m_xBrowserController.clear(); - } - else - { - xAsXController->attachFrame(m_xMeAsFrame); - m_xBrowserComponentWindow = m_xMeAsFrame->getComponentWindow(); - DBG_ASSERT(m_xBrowserComponentWindow.is(), "PropBrw::PropBrw: attached the controller, but have no component window!"); - } - } - - Point aPropWinPos = Point( WIN_BORDER, WIN_BORDER ); - Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); - aPropWinSize.Width() -= (2*WIN_BORDER); - aPropWinSize.Height() -= (2*WIN_BORDER); - - if ( m_xBrowserComponentWindow.is() ) - { - m_xBrowserComponentWindow->setPosSize(aPropWinPos.X(), aPropWinPos.Y(), aPropWinSize.Width(), aPropWinSize.Height(), - ::com::sun::star::awt::PosSize::WIDTH | ::com::sun::star::awt::PosSize::HEIGHT | - ::com::sun::star::awt::PosSize::X | ::com::sun::star::awt::PosSize::Y); - m_xBrowserComponentWindow->setVisible(sal_True); - } - } - catch (Exception&) - { - OSL_FAIL("PropBrw::PropBrw: could not create/initialize the browser controller!"); - try - { - ::comphelper::disposeComponent(m_xBrowserController); - ::comphelper::disposeComponent(m_xBrowserComponentWindow); - } - catch(Exception&) - { - } - - m_xBrowserController.clear(); - m_xBrowserComponentWindow.clear(); - } - - Resize(); -} - - -PropBrw::~PropBrw() -{ - if ( m_xBrowserController.is() ) - ImplDestroyController(); - - DBG_DTOR(PropBrw,NULL); -} - - -void PropBrw::ImplDestroyController() -{ - implSetNewObject( Reference< XPropertySet >() ); - - if ( m_xMeAsFrame.is() ) - m_xMeAsFrame->setComponent( NULL, NULL ); - - Reference< XController > xAsXController( m_xBrowserController, UNO_QUERY ); - if ( xAsXController.is() ) - xAsXController->attachFrame( NULL ); - - try - { - ::comphelper::disposeComponent( m_xBrowserController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - m_xBrowserController.clear(); -} - - -sal_Bool PropBrw::Close() -{ - ImplDestroyController(); - - if( IsRollUp() ) - RollDown(); - - sal_Bool bClose = SfxFloatingWindow::Close(); - - return bClose; -} - - -Sequence< Reference< XInterface > > - PropBrw::CreateMultiSelectionSequence( const SdrMarkList& _rMarkList ) -{ - Sequence< Reference< XInterface > > aSeq; - InterfaceArray aInterfaces; - - sal_uInt32 nMarkCount = _rMarkList.GetMarkCount(); - for( sal_uInt32 i = 0 ; i < nMarkCount ; i++ ) - { - SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); - - SdrObjListIter* pGroupIterator = NULL; - if (pCurrent->IsGroupObject()) - { - pGroupIterator = new SdrObjListIter(*pCurrent->GetSubList()); - pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; - } - - while (pCurrent) - { - DlgEdObj* pDlgEdObj = PTR_CAST(DlgEdObj, pCurrent); - if (pDlgEdObj) - { - Reference< XInterface > xControlInterface(pDlgEdObj->GetUnoControlModel(), UNO_QUERY); - if (xControlInterface.is()) - aInterfaces.push_back(xControlInterface); - } - - // next element - pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : NULL; - } - if (pGroupIterator) - delete pGroupIterator; - } - - sal_Int32 nCount = aInterfaces.size(); - aSeq.realloc( nCount ); - Reference< XInterface >* pInterfaces = aSeq.getArray(); - for( sal_Int32 i = 0 ; i < nCount ; i++ ) - pInterfaces[i] = aInterfaces[i]; - - return aSeq; -} - - -void PropBrw::implSetNewObjectSequence - ( const Sequence< Reference< XInterface > >& _rObjectSeq ) -{ - Reference< inspection::XObjectInspector > xObjectInspector(m_xBrowserController, UNO_QUERY); - if ( xObjectInspector.is() ) - { - xObjectInspector->inspect( _rObjectSeq ); - - ::rtl::OUString aText = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_PROPERTIES))); - aText += ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_MULTISELECT))); - SetText( aText ); - } -} - - -void PropBrw::implSetNewObject( const Reference< XPropertySet >& _rxObject ) -{ - if ( m_xBrowserController.is() ) - { - m_xBrowserController->setPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IntrospectedObject" )), - makeAny( _rxObject ) - ); - - // set the new title according to the selected object - SetText( GetHeadlineName( _rxObject ) ); - } -} - - -::rtl::OUString PropBrw::GetHeadlineName( const Reference< XPropertySet >& _rxObject ) -{ - ::rtl::OUString aName; - Reference< lang::XServiceInfo > xServiceInfo( _rxObject, UNO_QUERY ); - - if (xServiceInfo.is()) // single selection - { - sal_uInt16 nResId = 0; - aName = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_PROPERTIES))); - - if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ) ) - { - nResId = RID_STR_CLASS_DIALOG; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ) ) - { - nResId = RID_STR_CLASS_BUTTON; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" ) ) ) ) - { - nResId = RID_STR_CLASS_RADIOBUTTON; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" ) ) ) ) - { - nResId = RID_STR_CLASS_CHECKBOX; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" ) ) ) ) - { - nResId = RID_STR_CLASS_LISTBOX; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" ) ) ) ) - { - nResId = RID_STR_CLASS_COMBOBOX; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" ) ) ) ) - { - nResId = RID_STR_CLASS_GROUPBOX; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ) ) ) ) - { - nResId = RID_STR_CLASS_EDIT; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" ) ) ) ) - { - nResId = RID_STR_CLASS_FIXEDTEXT; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" ) ) ) ) - { - nResId = RID_STR_CLASS_IMAGECONTROL; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" ) ) ) ) - { - nResId = RID_STR_CLASS_PROGRESSBAR; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" ) ) ) ) - { - nResId = RID_STR_CLASS_SCROLLBAR; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" ) ) ) ) - { - nResId = RID_STR_CLASS_FIXEDLINE; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDateFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_DATEFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlTimeFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_TIMEFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlNumericFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_NUMERICFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_CURRENCYFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFormattedFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_FORMATTEDFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlPatternFieldModel" ) ) ) ) - { - nResId = RID_STR_CLASS_PATTERNFIELD; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFileControlModel" ) ) ) ) - { - nResId = RID_STR_CLASS_FILECONTROL; - } - else if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.TreeControlModel" ) ) ) ) - { - nResId = RID_STR_CLASS_TREECONTROL; - } - else - { - nResId = RID_STR_CLASS_CONTROL; - } - - if (nResId) - { - aName += ::rtl::OUString( String(IDEResId(nResId)) ); - } - } - else if (!_rxObject.is()) // no properties - { - aName = ::rtl::OUString(String(IDEResId(RID_STR_BRWTITLE_NO_PROPERTIES))); - } - - return aName; -} - - -void PropBrw::FillInfo( SfxChildWinInfo& rInfo ) const -{ - rInfo.bVisible = sal_False; -} - - -void PropBrw::Resize() -{ - SfxFloatingWindow::Resize(); - - // adjust size - Size aSize_ = GetOutputSizePixel(); - Size aPropWinSize( aSize_ ); - aPropWinSize.Width() -= (2*WIN_BORDER); - aPropWinSize.Height() -= (2*WIN_BORDER); - - if (m_xBrowserComponentWindow.is()) - { - m_xBrowserComponentWindow->setPosSize(0, 0, aPropWinSize.Width(), aPropWinSize.Height(), - ::com::sun::star::awt::PosSize::WIDTH | ::com::sun::star::awt::PosSize::HEIGHT); - } -} - - -void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView* pNewView ) -{ - Reference< XModel > xContextDocument( _rxContextDocument ); - - // if we should simply "empty" ourself, assume the context document didn't change - if ( !pNewView ) - { - OSL_ENSURE( !_rxContextDocument.is(), "PropBrw::ImplUpdate: no view, but a document?!" ); - xContextDocument = m_xContextDocument; - } - - if ( xContextDocument != m_xContextDocument ) - { - m_xContextDocument = xContextDocument; - ImplReCreateController(); - } - - try - { - if ( pView ) - { - EndListening( *(pView->GetModel()) ); - pView = NULL; - } - - if ( !pNewView ) - return; - - pView = pNewView; - - // set focus on initialization - if ( m_bInitialStateChange ) - { - if ( m_xBrowserComponentWindow.is() ) - m_xBrowserComponentWindow->setFocus(); - m_bInitialStateChange = sal_False; - } - - const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); - sal_uInt32 nMarkCount = rMarkList.GetMarkCount(); - - if ( nMarkCount == 0 ) - { - EndListening( *(pView->GetModel()) ); - pView = NULL; - implSetNewObject( NULL ); - return; - } - - Reference< XPropertySet > xNewObject; - Sequence< Reference< XInterface > > aNewObjects; - if ( nMarkCount == 1 ) - { - DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, rMarkList.GetMark(0)->GetMarkedSdrObj() ); - if ( pDlgEdObj ) - { - if ( pDlgEdObj->IsGroupObject() ) // group object - aNewObjects = CreateMultiSelectionSequence( rMarkList ); - else // single selection - xNewObject = xNewObject.query( pDlgEdObj->GetUnoControlModel() ); - } - } - else if ( nMarkCount > 1 ) // multiple selection - { - aNewObjects = CreateMultiSelectionSequence( rMarkList ); - } - - if ( aNewObjects.getLength() ) - implSetNewObjectSequence( aNewObjects ); - else - implSetNewObject( xNewObject ); - - StartListening( *(pView->GetModel()) ); - } - catch ( const PropertyVetoException& ) { /* silence */ } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx deleted file mode 100644 index fca313610..000000000 --- a/basctl/source/inc/accessibledialogcontrolshape.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ -#define _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ - -#include -#include -#include -#include -#include -#include - -#include - -class Window; -class DialogWindow; -class DlgEdObj; -class VCLExternalSolarLock; - -namespace utl { -class AccessibleStateSetHelper; -} - - -// ---------------------------------------------------- -// class AccessibleDialogControlShape -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; - -typedef ::cppu::ImplHelper3< - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::beans::XPropertyChangeListener > AccessibleDialogControlShape_BASE; - -class AccessibleDialogControlShape : public AccessibleExtendedComponentHelper_BASE, - public AccessibleDialogControlShape_BASE -{ - friend class AccessibleDialogWindow; - -private: - VCLExternalSolarLock* m_pExternalLock; - DialogWindow* m_pDialogWindow; - DlgEdObj* m_pDlgEdObj; - sal_Bool m_bFocused; - sal_Bool m_bSelected; - - ::com::sun::star::awt::Rectangle m_aBounds; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xControlModel; - -protected: - sal_Bool IsFocused(); - sal_Bool IsSelected(); - - void SetFocused( sal_Bool bFocused ); - void SetSelected( sal_Bool bSelected ); - - ::com::sun::star::awt::Rectangle GetBounds(); - void SetBounds( const ::com::sun::star::awt::Rectangle& aBounds ); - - Window* GetWindow() const; - - ::rtl::OUString GetModelStringProperty( const sal_Char* pPropertyName ); - - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - AccessibleDialogControlShape( DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj ); - virtual ~AccessibleDialogControlShape(); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw (::com::sun::star::uno::RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); -}; - - -#endif // _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx deleted file mode 100644 index c5ed48faf..000000000 --- a/basctl/source/inc/accessibledialogwindow.hxx +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ -#define _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ - -#include -#include -#include -#include -#include -#include -#include - -#include - -class DialogWindow; -class DlgEditor; -class DlgEdModel; -class DlgEdObj; -class VCLExternalSolarLock; -class VclSimpleEvent; -class VclWindowEvent; - -namespace utl { -class AccessibleStateSetHelper; -} - - -// ---------------------------------------------------- -// class AccessibleDialogWindow -// ---------------------------------------------------- - -typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; - -typedef ::cppu::ImplHelper3 < - ::com::sun::star::accessibility::XAccessible, - ::com::sun::star::accessibility::XAccessibleSelection, - ::com::sun::star::lang::XServiceInfo > AccessibleDialogWindow_BASE; - -class AccessibleDialogWindow : public AccessibleExtendedComponentHelper_BASE, - public AccessibleDialogWindow_BASE, - public SfxListener -{ -private: - - class ChildDescriptor - { - public: - DlgEdObj* pDlgEdObj; - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > rxAccessible; - - ChildDescriptor( DlgEdObj* _pDlgEdObj ); - ~ChildDescriptor(); - - ChildDescriptor( const ChildDescriptor& rDesc ); - ChildDescriptor& operator=( const ChildDescriptor& rDesc ); - - bool operator==( const ChildDescriptor& rDesc ); - bool operator<( const ChildDescriptor& rDesc ) const; - }; - - typedef ::std::vector< ChildDescriptor > AccessibleChildren; - - AccessibleChildren m_aAccessibleChildren; - VCLExternalSolarLock* m_pExternalLock; - DialogWindow* m_pDialogWindow; - DlgEditor* m_pDlgEditor; - DlgEdModel* m_pDlgEdModel; - -protected: - void UpdateFocused(); - void UpdateSelected(); - void UpdateBounds(); - - sal_Bool IsChildVisible( const ChildDescriptor& rDesc ); - - void InsertChild( const ChildDescriptor& rDesc ); - void RemoveChild( const ChildDescriptor& rDesc ); - void UpdateChild( const ChildDescriptor& rDesc ); - void UpdateChildren(); - void SortChildren(); - - DECL_LINK( WindowEventListener, VclSimpleEvent* ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - -public: - AccessibleDialogWindow( DialogWindow* pDialogWindow ); - ~AccessibleDialogWindow(); - - // SfxListener - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XAccessible - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); - - // XAccessibleComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleExtendedComponent - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); - - // XAccessibleSelection - virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); -}; - - -#endif // _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx deleted file mode 100644 index 2add8fd32..000000000 --- a/basctl/source/inc/baside3.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASIDE3_HXX -#define _BASIDE3_HXX - -#include -#include -#include -#include -#include -#include - -#include - -class Printer; -class StarBASIC; -class SfxItemSet; -class DlgEditor; -class DlgEdModel; -class DlgEdPage; -class DlgEdView; -class SfxUndoManager; - -class DialogWindow: public IDEBaseWindow -{ -private: - DlgEditor* pEditor; - SfxUndoManager* pUndoMgr; - Link aOldNotifyUndoActionHdl; - String aCurPath; - -protected: - virtual void Paint( const Rectangle& ); - virtual void Resize(); - - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void LoseFocus(); - - DECL_LINK( NotifyUndoActionHdl, SfxUndoAction * ); - virtual void DoInit(); - virtual void DoScroll( ScrollBar* pCurScrollBar ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - void InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bBackground); - -public: - TYPEINFO(); - DialogWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName, - const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xDialogModel ); - DialogWindow( DialogWindow* pCurView ); // never implemented - ~DialogWindow(); - - virtual void ExecuteCommand( SfxRequest& rReq ); - virtual void GetState( SfxItemSet& ); - DlgEditor* GetEditor() const { return pEditor; } - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const; - DlgEdModel* GetModel() const; - DlgEdPage* GetPage() const; - DlgEdView* GetView() const; - sal_Bool RenameDialog( const String& rNewName ); - void DisableBrowser(); - void UpdateBrowser(); - sal_Bool SaveDialog(); - sal_Bool ImportDialog(); - - virtual String GetTitle(); - virtual BasicEntryDescriptor CreateEntryDescriptor(); - virtual void SetReadOnly( sal_Bool bReadOnly ); - virtual sal_Bool IsReadOnly(); - - virtual void StoreData(); - virtual sal_Bool IsModified(); - virtual sal_Bool IsPasteAllowed(); - - virtual ::svl::IUndoManager* - GetUndoManager(); - // return number of pages to be printed - virtual sal_Int32 countPages( Printer* pPrinter ); - // print page - virtual void printPage( sal_Int32 nPage, Printer* pPrinter ); - virtual void Deactivating(); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); -}; - -#endif // _BASIDE3_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basidectrlr.hxx b/basctl/source/inc/basidectrlr.hxx deleted file mode 100644 index 172afbfb9..000000000 --- a/basctl/source/inc/basidectrlr.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_BASICIDECTRLR_HXX -#define _BASCTL_BASICIDECTRLR_HXX - -#include -#include -#include -#include - - -class BasicIDEShell; - - -class BasicIDEController :public comphelper::OMutexAndBroadcastHelper - ,public ::comphelper::OPropertyContainer - ,public ::comphelper::OPropertyArrayUsageHelper< BasicIDEController > - ,public SfxBaseController -{ -private: - // properties - sal_Int32 m_nIconId; - -public: - BasicIDEController( BasicIDEShell* pViewShell ); - virtual ~BasicIDEController(); - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XTypeProvider ( ::SfxBaseController ) - 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 ); - - // 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(); - -protected: - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; -}; - -#endif // _BASCTL_BASICIDECTRLR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx deleted file mode 100644 index b7efbac1e..000000000 --- a/basctl/source/inc/basidesh.hxx +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASIDESH_HXX -#define _BASIDESH_HXX - -#include "sbxitem.hxx" - -#include "scriptdocument.hxx" -#include "doceventnotifier.hxx" -#include -#include -#include -#include -#include -#include - -#include - -#include - -//---------------------------------------------------------------------------- - -const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001; - -//---------------------------------------------------------------------------- - -class ModulWindow; -class ModulWindowLayout; -class DialogWindow; -class SdrView; -class ObjectCatalog; -class BasicIDETabBar; -class TabBar; -class IDEBaseWindow; -class SbxObject; -class SbModule; -class StarBASIC; -class LocalizationMgr; -struct BasicIDEShell_Impl; - -#if _SOLAR__PRIVATE -DECLARE_TABLE( IDEWindowTable, IDEBaseWindow* ) -#else -typedef Table IDEWindowTable; -#endif - -namespace BasicIDE -{ - bool RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ); -} - -class BasicIDEShell :public SfxViewShell - ,public ::basctl::DocumentEventListener -{ -friend class JavaDebuggingListenerImpl; -friend class LocalizationMgr; -friend sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName ); -friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ); - - ObjectCatalog* pObjectCatalog; - - IDEWindowTable aIDEWindowTable; - sal_uInt16 nCurKey; - IDEBaseWindow* pCurWin; - ScriptDocument m_aCurDocument; - String m_aCurLibName; - LocalizationMgr* m_pCurLocalizationMgr; - - ScrollBar aHScrollBar; - ScrollBar aVScrollBar; - ScrollBarBox aScrollBarBox; - BasicIDETabBar* pTabBar; - sal_Bool bTabBarSplitted; - sal_Bool bCreatingWindow; - ModulWindowLayout* pModulLayout; - sal_Bool m_bAppBasicModified; - ::basctl::DocumentEventNotifier - m_aNotifier; -friend class ContainerListenerImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener; - -#if _SOLAR__PRIVATE - void Init(); - void InitTabBar(); - void InitScrollBars(); - void CheckWindows(); - void RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, sal_Bool bDestroy ); - void UpdateWindows(); - void ShowObjectDialog( sal_Bool bShow, sal_Bool bCreateOrDestroy ); - void InvalidateBasicIDESlots(); - void StoreAllWindowData( sal_Bool bPersistent = sal_True ); - void SetMDITitle(); - void EnableScrollbars( sal_Bool bEnable ); - void SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows = true , bool bCheck = true ); - void SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName ); - - void ImplStartListening( StarBASIC* pBasic ); - - DECL_LINK( TabBarHdl, TabBar* ); - DECL_LINK( ObjectDialogCancelHdl, ObjectCatalog * ); - DECL_LINK( TabBarSplitHdl, TabBar * ); -#endif - -protected: - virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); - virtual void OuterResizePixel( const Point &rPos, const Size &rSize ); - virtual Size GetOptimalSizePixel() const; - sal_uInt16 InsertWindowInTable( IDEBaseWindow* pNewWin ); - virtual sal_uInt16 PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ); - - void SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar = sal_False, sal_Bool bRememberAsCurrent = sal_True ); - void ManageToolbars(); - void RemoveWindow( IDEBaseWindow* pWindow, sal_Bool bDestroy, sal_Bool bAllowChangeCurWindow = sal_True ); - void ArrangeTabBar(); - - ModulWindow* CreateBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName ); - DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ); - - ModulWindow* FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended = sal_False ); - ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic ); - - virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, - const SfxHint& rHint, const TypeId& rHintType ); - - virtual void Activate(sal_Bool bMDI); - virtual void Deactivate(sal_Bool bMDI); - - virtual void Move(); - virtual void ShowCursor( bool bOn = true ); - - void CreateModulWindowLayout(); - void DestroyModulWindowLayout(); - void UpdateModulWindowLayout( bool bBasicStopped ); - - // DocumentEventListener - virtual void onDocumentCreated( const ScriptDocument& _rDocument ); - virtual void onDocumentOpened( const ScriptDocument& _rDocument ); - virtual void onDocumentSave( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ); - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ); - virtual void onDocumentClosed( const ScriptDocument& _rDocument ); - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ); - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); - -public: - TYPEINFO(); - SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH ) - SFX_DECL_VIEWFACTORY(BasicIDEShell); - - BasicIDEShell( SfxViewFrame *pFrame, SfxViewShell *pOldSh ); - ~BasicIDEShell(); - - IDEBaseWindow* GetCurWindow() const { return pCurWin; } - const ScriptDocument& - GetCurDocument() const { return m_aCurDocument; } - const String& GetCurLibName() const { return m_aCurLibName; } - ObjectCatalog* GetObjectCatalog() const { return pObjectCatalog; } - LocalizationMgr* GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } - - ScrollBar& GetHScrollBar() { return aHScrollBar; } - ScrollBar& GetVScrollBar() { return aVScrollBar; } - ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; } - TabBar* GetTabBar() { return (TabBar*)pTabBar; } - IDEWindowTable& GetIDEWindowTable() { return aIDEWindowTable; } - - SdrView* GetCurDlgView() const; - - ::svl::IUndoManager* - GetUndoManager(); - - virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable(); - - // virtual sal_uInt16 Print( SfxProgress &rProgress, sal_Bool bIsAPI, PrintDialog *pPrintDialog = 0 ); - virtual SfxPrinter* GetPrinter( sal_Bool bCreate ); - virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); - virtual String GetSelectionText( sal_Bool bCompleteWords ); - virtual sal_Bool HasSelection( sal_Bool bText ) const; - - void GetState( SfxItemSet& ); - void ExecuteGlobal( SfxRequest& rReq ); - void ExecuteCurrent( SfxRequest& rReq ); - void ExecuteBasic( SfxRequest& rReq ); - void ExecuteDialog( SfxRequest& rReq ); - - virtual sal_Bool HasUIFeature( sal_uInt32 nFeature ); - - long CallBasicErrorHdl( StarBASIC* pBasic ); - long CallBasicBreakHdl( StarBASIC* pBasic ); - - ModulWindowLayout* GetLayoutWindow() const { return pModulLayout; } - - IDEBaseWindow* FindWindow( const ScriptDocument& rDocument, const String& rLibName = String(), const String& rName = String(), sal_uInt16 nType = BASICIDE_TYPE_UNKNOWN, sal_Bool bFindSuspended = sal_False ); - DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended = sal_False ); - IDEBaseWindow* FindApplicationWindow(); - sal_Bool NextPage( sal_Bool bPrev = sal_False ); - - sal_Bool IsAppBasicModified() const { return m_bAppBasicModified; } - void SetAppBasicModified( sal_Bool bModified = sal_True ) { m_bAppBasicModified = bModified; } - - // For Dialog Drag&Drop in Dialog Organizer - static void CopyDialogResources( - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP, - const ScriptDocument& rSourceDoc, const String& rSourceLibName, const ScriptDocument& rDestDoc, - const String& rDestLibName, const String& rDlgName ); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - GetCurrentDocument() const; - -}; - -#endif // _BASIDESH_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx deleted file mode 100644 index 50381d017..000000000 --- a/basctl/source/inc/basobj.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASOBJ_HXX -#define _BASOBJ_HXX - -#include "scriptdocument.hxx" -#include -#include - -#include -#include -#include - -class SfxMacro; -class SbMethod; -class SbModule; -class SbxObject; -class SbxVariable; -class StarBASIC; -class BasicManager; -class SfxUInt16Item; -class SfxBindings; -class Window; -struct BasicIDE_Impl; - -namespace BasicIDE -{ - void Organize( sal_Int16 tabId ); - - - // Hilfsmethoden fuer den allg. Gebrauch: - SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ); - void RunMethod( SbMethod* pMethod ); - - StarBASIC* FindBasic( const SbxVariable* pVar ); - void StopBasic(); - long HandleBasicError( StarBASIC* pBasic ); - void BasicStopped( sal_Bool* pbAppWindowDisabled = 0, sal_Bool* pbDispatcherLocked = 0, sal_uInt16* pnWaitCount = 0, - SfxUInt16Item** ppSWActionCount = 0, SfxUInt16Item** ppSWLockViewCount = 0 ); - - sal_Bool IsValidSbxName( const String& rName ); - - BasicManager* FindBasicManager( StarBASIC* pLib ); - - SfxBindings* GetBindingsPtr(); - - void InvalidateDebuggerSlots(); - - // libraries - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetMergedLibraryNames( - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xModLibContainer, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xDlgLibContainer ); - - // new methods for modules - - ::rtl::OUString GetModule( - const ScriptDocument& rDocument, const String& rLibName, const String& rModName ) - throw( ::com::sun::star::container::NoSuchElementException ); - - /** renames a module - - Will show an error message when renaming fails because the new name is already used. - */ - bool RenameModule( - Window* pErrorParent, const ScriptDocument& rDocument, - const String& rLibName, const String& rOldName, const String& rNewName ); - - // new methods for macros - - ::rtl::OUString ChooseMacro( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxLimitToDocument, - sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc ); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetMethodNames( - const ScriptDocument& rDocument, const String& rLibName, const String& rModName ) - throw( ::com::sun::star::container::NoSuchElementException ); - - sal_Bool HasMethod( - const ScriptDocument& rDocument, const String& rLibName, const String& rModName, const String& rMethName ); - - // new methods for dialogs - - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider > GetDialog( - const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ) - throw( ::com::sun::star::container::NoSuchElementException ); - - /** renames a dialog - - Will show an error message when renaming fails because the new name is already used. - */ - bool RenameDialog( - Window* pErrorParent, const ScriptDocument& rDocument, const String& rLibName, const String& rOldName, const String& rNewName ) - throw( ::com::sun::star::container::ElementExistException, ::com::sun::star::container::NoSuchElementException ); - - bool RemoveDialog( - const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ); - - void MarkDocumentModified( const ScriptDocument& rDocument ); -} - -#endif // _BASOBJ_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx deleted file mode 100644 index 4dc9638e2..000000000 --- a/basctl/source/inc/bastypes.hxx +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BASTYPES_HXX -#define _BASTYPES_HXX - -#include - -#include "scriptdocument.hxx" - -class ModulWindow; -class SfxRequest; -class SvTreeListBox; -class SvLBoxEntry; -class ScrollBar; -class SbModule; -class BasicManager; -class SfxItemSet; -#include -#include -#include - -#include - -#include - -#include -#include - -#include -#include - -#define LINE_SEP_CR 0x0D -#define LINE_SEP 0x0A - -// Implementation: baside2b.cxx -sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex ); - - -// Bedeutung von bToBeKilled: -// Wenn in Reschedule-Schleife, darf ich das Fenster nicht zerstoeren. -// Es muss erst aus der Reschedule-Schleife Fallen, um sich dann -// selbst zu zerstoeren. -// Geht so leider nicht: Destroying Window with living Child! - - -struct BasicStatus -{ - sal_Bool bIsRunning : 1; - sal_Bool bError : 1; - sal_Bool bIsInReschedule : 1; - sal_uInt16 nBasicFlags; - - BasicStatus() { - bIsRunning = sal_False; bError = sal_False; - nBasicFlags = 0; bIsInReschedule = sal_False; } -}; - -struct BreakPoint -{ - bool bEnabled; - bool bTemp; - size_t nLine; - size_t nStopAfter; - size_t nHitCount; - - BreakPoint( size_t nL ) { nLine = nL; nStopAfter = 0; nHitCount = 0; bEnabled = true; bTemp = false; } -}; - -class BasicDockingWindow : public DockingWindow -{ - Rectangle aFloatingPosAndSize; - -protected: - virtual sal_Bool Docking( const Point& rPos, Rectangle& rRect ); - virtual void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ); - virtual void ToggleFloatingMode(); - virtual sal_Bool PrepareToggleFloatingMode(); - virtual void StartDocking(); - -public: - BasicDockingWindow( Window* pParent ); -}; - -class BreakPointList -{ -private: - void operator =(BreakPointList); // not implemented - ::std::vector< BreakPoint* > maBreakPoints; - -public: - BreakPointList(); - - BreakPointList(BreakPointList const & rList); - - ~BreakPointList(); - - void reset(); - - void transfer(BreakPointList & rList); - - void InsertSorted( BreakPoint* pBrk ); - BreakPoint* FindBreakPoint( size_t nLine ); - void AdjustBreakPoints( size_t nLine, bool bInserted ); - void SetBreakPointsInBasic( SbModule* pModule ); - void ResetHitCount(); - - size_t size() const; - BreakPoint* at( size_t i ); - const BreakPoint* at( size_t i ) const; - BreakPoint* remove( BreakPoint* ptr ); - void push_back( BreakPoint* item ); - void clear(); -}; - -// helper class for sorting TabBar -class TabBarSortHelper -{ -public: - sal_uInt16 nPageId; - String aPageText; - - bool operator<(const TabBarSortHelper& rComp) const { return (aPageText.CompareIgnoreCaseToAscii( rComp.aPageText ) == COMPARE_LESS); } -}; - -class BasicIDETabBar : public TabBar -{ -protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Command( const CommandEvent& rCEvt ); - - virtual long AllowRenaming(); - virtual void EndRenaming(); - -public: - BasicIDETabBar( Window* pParent ); - - void Sort(); -}; - -#define BASWIN_OK 0x00 -#define BASWIN_RUNNINGBASIC 0x01 -#define BASWIN_TOBEKILLED 0x02 -#define BASWIN_SUSPENDED 0x04 -#define BASWIN_INRESCHEDULE 0x08 - -class Printer; -class BasicEntryDescriptor; - -namespace svl -{ - class IUndoManager; -} - -class IDEBaseWindow : public Window -{ -private: - ScrollBar* pShellHScrollBar; - ScrollBar* pShellVScrollBar; - - DECL_LINK( ScrollHdl, ScrollBar * ); - sal_uInt8 nStatus; - - ScriptDocument m_aDocument; - String m_aLibName; - String m_aName; - -protected: - virtual void DoScroll( ScrollBar* pCurScrollBar ); - -public: - TYPEINFO(); - IDEBaseWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName ); - virtual ~IDEBaseWindow(); - - void Init(); - virtual void DoInit(); - virtual void Deactivating(); - void GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); - - ScrollBar* GetHScrollBar() const { return pShellHScrollBar; } - ScrollBar* GetVScrollBar() const { return pShellVScrollBar; } - - virtual void ExecuteCommand( SfxRequest& rReq ); - virtual void GetState( SfxItemSet& ); - virtual long Notify( NotifyEvent& rNEvt ); - - virtual void StoreData(); - virtual void UpdateData(); - virtual sal_Bool CanClose(); - - // return number of pages to be printed - virtual sal_Int32 countPages( Printer* pPrinter ) = 0; - // print page - virtual void printPage( sal_Int32 nPage, Printer* pPrinter ) = 0; - - virtual String GetTitle(); - String CreateQualifiedName(); - virtual BasicEntryDescriptor CreateEntryDescriptor() = 0; - - virtual sal_Bool IsModified(); - virtual sal_Bool IsPasteAllowed(); - - virtual sal_Bool AllowUndo(); - - virtual void SetReadOnly( sal_Bool bReadOnly ); - virtual sal_Bool IsReadOnly(); - - sal_uInt8 GetStatus() { return nStatus; } - void SetStatus( sal_uInt8 n ) { nStatus = n; } - void AddStatus( sal_uInt8 n ) { nStatus = nStatus | n; } - void ClearStatus( sal_uInt8 n ) { nStatus = nStatus & ~n; } - - virtual Window* GetLayoutWindow(); - - virtual ::svl::IUndoManager* - GetUndoManager(); - - virtual sal_uInt16 GetSearchOptions(); - - virtual void BasicStarted(); - virtual void BasicStopped(); - - sal_Bool IsSuspended() const - { return ( nStatus & BASWIN_SUSPENDED ) ? sal_True : sal_False; } - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - bool IsDocument( const ScriptDocument& rDocument ) const { return rDocument == m_aDocument; } - const String& GetLibName() const { return m_aLibName; } - void SetLibName( const String& aLibName ) { m_aLibName = aLibName; } - const String& GetName() const { return m_aName; } - void SetName( const String& aName ) { m_aName = aName; } -}; - -class LibInfoKey -{ -private: - ScriptDocument m_aDocument; - String m_aLibName; - -public: - LibInfoKey( const ScriptDocument& rDocument, const String& rLibName ); - ~LibInfoKey(); - - LibInfoKey( const LibInfoKey& rKey ); - LibInfoKey& operator=( const LibInfoKey& rKey ); - - bool operator==( const LibInfoKey& rKey ) const; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - const String& GetLibName() const { return m_aLibName; } -}; - -class LibInfoItem -{ -private: - ScriptDocument m_aDocument; - String m_aLibName; - String m_aCurrentName; - sal_uInt16 m_nCurrentType; - -public: - LibInfoItem( const ScriptDocument& rDocument, const String& rLibName, const String& rCurrentName, sal_uInt16 nCurrentType ); - ~LibInfoItem(); - - LibInfoItem( const LibInfoItem& rItem ); - LibInfoItem& operator=( const LibInfoItem& rItem ); - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - const String& GetLibName() const { return m_aLibName; } - const String& GetCurrentName() const { return m_aCurrentName; } - sal_uInt16 GetCurrentType() const { return m_nCurrentType; } -}; - -class LibInfos -{ -private: - - struct LibInfoKeyHash - { - size_t operator()( const LibInfoKey& rKey ) const - { - size_t nHash = (size_t) rKey.GetDocument().hashCode(); - nHash += (size_t) ::rtl::OUString( rKey.GetLibName() ).hashCode(); - return nHash; - } - }; - - typedef ::boost::unordered_map< LibInfoKey, LibInfoItem*, LibInfoKeyHash, ::std::equal_to< LibInfoKey > > LibInfoMap; - LibInfoMap m_aLibInfoMap; - -public: - LibInfos(); - ~LibInfos(); - - void InsertInfo( LibInfoItem* pItem ); - void RemoveInfoFor( const ScriptDocument& _rDocument ); - - LibInfoItem* GetInfo( const LibInfoKey& rKey ); -}; - -void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, sal_Bool bEraseTrailingEmptyLines = sal_False ); -String CreateMgrAndLibStr( const String& rMgrName, const String& rLibName ); -sal_uLong CalcLineCount( SvStream& rStream ); - -sal_Bool QueryReplaceMacro( const String& rName, Window* pParent = 0 ); -sal_Bool QueryDelMacro( const String& rName, Window* pParent = 0 ); -sal_Bool QueryDelDialog( const String& rName, Window* pParent = 0 ); -sal_Bool QueryDelModule( const String& rName, Window* pParent = 0 ); -sal_Bool QueryDelLib( const String& rName, sal_Bool bRef = sal_False, Window* pParent = 0 ); -sal_Bool QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, sal_Bool bRepeat = sal_False, sal_Bool bNewTitle = sal_False ); - -class ModuleInfoHelper -{ -ModuleInfoHelper(); -ModuleInfoHelper(const ModuleInfoHelper&); -ModuleInfoHelper& operator = (const ModuleInfoHelper&); -public: - static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName, String& rObjName ); - static sal_Int32 getModuleType( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const String& rModName ); -}; -#endif // _BASTYPES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx deleted file mode 100644 index ea76d105e..000000000 --- a/basctl/source/inc/dlged.hxx +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGED_HXX -#define _BASCTL_DLGED_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DLGED_PAGE_WIDTH_MIN 1280 -#define DLGED_PAGE_HEIGHT_MIN 1024 - - -//============================================================================ -// DlgEdHint -//============================================================================ - -enum DlgEdHintKind -{ - DLGED_HINT_UNKNOWN, - DLGED_HINT_WINDOWSCROLLED, - DLGED_HINT_LAYERCHANGED, - DLGED_HINT_OBJORDERCHANGED, - DLGED_HINT_SELECTIONCHANGED -}; - -class DlgEdObj; - -class DlgEdHint: public SfxHint -{ -private: - DlgEdHintKind eHintKind; - DlgEdObj* pDlgEdObj; - -public: - TYPEINFO(); - DlgEdHint( DlgEdHintKind eHint ); - DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ); - virtual ~DlgEdHint(); - - DlgEdHintKind GetKind() const { return eHintKind; } - DlgEdObj* GetObject() const { return pDlgEdObj; } -}; - - -//============================================================================ -// DlgEditor -//============================================================================ - -enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY }; - -class ScrollBar; -class DlgEdModel; -class DlgEdPage; -class DlgEdView; -class DlgEdForm; -class DlgEdFactory; -class DlgEdFunc; -class Printer; -class KeyEvent; -class MouseEvent; -class Timer; -class Window; - -class DlgEditor: public SfxBroadcaster -{ -private: - DECL_LINK( PaintTimeout, Timer * ); - DECL_LINK( MarkTimeout, Timer * ); - - void Print( Printer* pPrinter, const String& rTitle ); - -protected: - ScrollBar* pHScroll; - ScrollBar* pVScroll; - DlgEdModel* pDlgEdModel; - DlgEdPage* pDlgEdPage; - DlgEdView* pDlgEdView; - DlgEdForm* pDlgEdForm; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; - ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors; - ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier; - DlgEdFactory* pObjFac; - Window* pWindow; - DlgEdFunc* pFunc; - DlgEdMode eMode; - sal_uInt16 eActObj; - sal_Bool bFirstDraw; - Size aGridSize; - sal_Bool bGridVisible; - sal_Bool bGridSnap; - sal_Bool bCreateOK; - Timer aPaintTimer; - Rectangle aPaintRect; - sal_Bool bDialogModelChanged; - Timer aMarkTimer; - long mnPaintGuard; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument; - - DlgEditor(); // not implemented -public: - DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); - ~DlgEditor(); - - void SetWindow( Window* pWindow ); - Window* GetWindow() const { return pWindow; } - - /** returns the control container associated with our window - @see GetWindow - @see SetWindow - */ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - GetWindowControlContainer(); - - void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } - DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } - - void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); - void InitScrollBars(); - ScrollBar* GetHScroll() const { return pHScroll; } - ScrollBar* GetVScroll() const { return pVScroll; } - void DoScroll( ScrollBar* pActScroll ); - void UpdateScrollBars(); - - void SetDialog( ::com::sun::star::uno::Reference< - ::com::sun::star::container::XNameContainer > xUnoControlDialogModel ); - void ResetDialog( void ); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const - {return m_xUnoControlDialogModel;} - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier(); - - DlgEdModel* GetModel() const { return pDlgEdModel; } - DlgEdView* GetView() const { return pDlgEdView; } - DlgEdPage* GetPage() const { return pDlgEdPage; } - - void ShowDialog(); - - sal_Bool UnmarkDialog(); - sal_Bool RemarkDialog(); - - void SetDialogModelChanged( sal_Bool bChanged = sal_True ) { bDialogModelChanged = bChanged; } - sal_Bool IsDialogModelChanged() const { return bDialogModelChanged; } - - sal_Bool IsModified() const; - void ClearModifyFlag(); - - void MouseButtonDown( const MouseEvent& rMEvt ); - void MouseButtonUp( const MouseEvent& rMEvt ); - void MouseMove( const MouseEvent& rMEvt ); - void Paint( const Rectangle& rRect ); - sal_Bool KeyInput( const KeyEvent& rKEvt ); - - void SetMode( DlgEdMode eMode ); - void SetInsertObj( sal_uInt16 eObj ); - sal_uInt16 GetInsertObj() const; - void CreateDefaultObject(); - DlgEdMode GetMode() const { return eMode; } - sal_Bool IsCreateOK() const { return bCreateOK; } - - void Cut(); - void Copy(); - void Paste(); - void Delete(); - sal_Bool IsPasteAllowed(); - - void ShowProperties(); - void UpdatePropertyBrowserDelayed(); - - sal_Int32 countPages( Printer* pPrinter ); - void printPage( sal_Int32 nPage, Printer* pPrinter, const String& ); - - bool AdjustPageSize(); - - bool isInPaint() const { return mnPaintGuard > 0; } -}; - -#endif //_BASCTL_DLGED_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedclip.hxx b/basctl/source/inc/dlgedclip.hxx deleted file mode 100644 index 24b2f93d4..000000000 --- a/basctl/source/inc/dlgedclip.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDCLIP_HXX -#define _BASCTL_DLGEDCLIP_HXX - -#include -#include -#include -#include - - -//============================================================================ -// DlgEdTransferableImpl -//============================================================================ - -typedef ::cppu::WeakImplHelper2< ::com::sun::star::datatransfer::XTransferable, ::com::sun::star::datatransfer::clipboard::XClipboardOwner > DlgEdTransferableHelper; - -class DlgEdTransferableImpl : public DlgEdTransferableHelper -{ -private: - ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_SeqFlavors; - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_SeqData; - -protected: - virtual sal_Bool compareDataFlavors( const ::com::sun::star::datatransfer::DataFlavor& lFlavor, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - -public: - DlgEdTransferableImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& aSeqFlavors, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aSeqData ); - virtual ~DlgEdTransferableImpl(); - - // XTransferable - virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) throw(::com::sun::star::uno::RuntimeException); - - // XClipboardOwner - virtual void SAL_CALL lostOwnership( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& xClipboard, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw(::com::sun::star::uno::RuntimeException); -}; - -#endif // _BASCTL_DLGEDCLIP_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgeddef.hxx b/basctl/source/inc/dlgeddef.hxx deleted file mode 100644 index 31ca5b109..000000000 --- a/basctl/source/inc/dlgeddef.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDDEF_HXX -#define _BASCTL_DLGEDDEF_HXX - -#include - - -const sal_uInt32 DlgInventor = sal_uInt32('D')*0x00000001+ - sal_uInt32('L')*0x00000100+ - sal_uInt32('G')*0x00010000+ - sal_uInt32('1')*0x01000000; - - -#define OBJ_DLG_CONTROL ((sal_uInt16) 1) -#define OBJ_DLG_DIALOG ((sal_uInt16) 2) -#define OBJ_DLG_PUSHBUTTON ((sal_uInt16) 3) -#define OBJ_DLG_RADIOBUTTON ((sal_uInt16) 4) -#define OBJ_DLG_CHECKBOX ((sal_uInt16) 5) -#define OBJ_DLG_LISTBOX ((sal_uInt16) 6) -#define OBJ_DLG_COMBOBOX ((sal_uInt16) 7) -#define OBJ_DLG_GROUPBOX ((sal_uInt16) 8) -#define OBJ_DLG_EDIT ((sal_uInt16) 9) -#define OBJ_DLG_FIXEDTEXT ((sal_uInt16)10) -#define OBJ_DLG_IMAGECONTROL ((sal_uInt16)11) -#define OBJ_DLG_PROGRESSBAR ((sal_uInt16)12) -#define OBJ_DLG_HSCROLLBAR ((sal_uInt16)13) -#define OBJ_DLG_VSCROLLBAR ((sal_uInt16)14) -#define OBJ_DLG_HFIXEDLINE ((sal_uInt16)15) -#define OBJ_DLG_VFIXEDLINE ((sal_uInt16)16) -#define OBJ_DLG_DATEFIELD ((sal_uInt16)17) -#define OBJ_DLG_TIMEFIELD ((sal_uInt16)18) -#define OBJ_DLG_NUMERICFIELD ((sal_uInt16)19) -#define OBJ_DLG_CURRENCYFIELD ((sal_uInt16)20) -#define OBJ_DLG_FORMATTEDFIELD ((sal_uInt16)21) -#define OBJ_DLG_PATTERNFIELD ((sal_uInt16)22) -#define OBJ_DLG_FILECONTROL ((sal_uInt16)23) -#define OBJ_DLG_TREECONTROL ((sal_uInt16)24) - -// control properties -#define DLGED_PROP_BACKGROUNDCOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BackgroundColor" ) ) -#define DLGED_PROP_DROPDOWN ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) ) -#define DLGED_PROP_FORMATSSUPPLIER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormatsSupplier" ) ) -#define DLGED_PROP_HEIGHT ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) -#define DLGED_PROP_LABEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) -#define DLGED_PROP_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) -#define DLGED_PROP_ORIENTATION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Orientation" ) ) -#define DLGED_PROP_POSITIONX ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) -#define DLGED_PROP_POSITIONY ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) -#define DLGED_PROP_STEP ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Step" ) ) -#define DLGED_PROP_TABINDEX ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) ) -#define DLGED_PROP_TEXTCOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) -#define DLGED_PROP_TEXTLINECOLOR ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextLineColor" ) ) -#define DLGED_PROP_WIDTH ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) -#define DLGED_PROP_DECORATION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Decoration" ) ) - - -#endif // _BASCTL_DLGEDDEF_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedfac.hxx b/basctl/source/inc/dlgedfac.hxx deleted file mode 100644 index 742d171db..000000000 --- a/basctl/source/inc/dlgedfac.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _BASCTL_DLGEDFAC_HXX -#define _BASCTL_DLGEDFAC_HXX - -#include - - -//============================================================================ -// DlgEdFactory -//============================================================================ - -class DlgEdFactory -{ -public: - DlgEdFactory(); - ~DlgEdFactory(); - - DECL_LINK( MakeObject, SdrObjFactory * ); -}; - -#endif // _BASCTL_DLGEDFAC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedfunc.hxx b/basctl/source/inc/dlgedfunc.hxx deleted file mode 100644 index f75901b18..000000000 --- a/basctl/source/inc/dlgedfunc.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDFUNC_HXX -#define _BASCTL_DLGEDFUNC_HXX - -#include - -class DlgEditor; -class Timer; -class MouseEvent; -class Point; - -//============================================================================ -// DlgEdFunc -//============================================================================ - -class DlgEdFunc /* : public LinkHdl */ -{ -protected: - DlgEditor* pParent; - Timer aScrollTimer; - - DECL_LINK( ScrollTimeout, Timer * ); - void ForceScroll( const Point& rPos ); - -public: - DlgEdFunc( DlgEditor* pParent ); - virtual ~DlgEdFunc(); - - virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt ); - virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt ); - virtual sal_Bool MouseMove( const MouseEvent& rMEvt ); - virtual sal_Bool KeyInput( const KeyEvent& rKEvt ); -}; - -//============================================================================ -// DlgEdFuncInsert -//============================================================================ - -class DlgEdFuncInsert : public DlgEdFunc -{ -public: - DlgEdFuncInsert( DlgEditor* pParent ); - ~DlgEdFuncInsert(); - - virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt ); - virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt ); - virtual sal_Bool MouseMove( const MouseEvent& rMEvt ); -}; - -//============================================================================ -// DlgEdFuncSelect -//============================================================================ - -class DlgEdFuncSelect : public DlgEdFunc -{ -protected: - sal_Bool bMarkAction; - -public: - DlgEdFuncSelect( DlgEditor* pParent ); - ~DlgEdFuncSelect(); - - virtual sal_Bool MouseButtonDown( const MouseEvent& rMEvt ); - virtual sal_Bool MouseButtonUp( const MouseEvent& rMEvt ); - virtual sal_Bool MouseMove( const MouseEvent& rMEvt ); -}; - - -#endif //_BASCTL_DLGEDFUNC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedlist.hxx b/basctl/source/inc/dlgedlist.hxx deleted file mode 100644 index ced0cfdc1..000000000 --- a/basctl/source/inc/dlgedlist.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDLIST_HXX -#define _BASCTL_DLGEDLIST_HXX - -#include -#include -#include - -class DlgEdObj; - -//============================================================================ -// DlgEdPropListenerImpl -//============================================================================ - -typedef ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener > PropertyChangeListenerHelper; - -class DlgEdPropListenerImpl: public PropertyChangeListenerHelper -{ -private: - DlgEdObj* pDlgEdObj; - -public: - DlgEdPropListenerImpl(DlgEdObj* pObj); - virtual ~DlgEdPropListenerImpl(); - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 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); - -}; - -//============================================================================ -// DlgEdEvtContListenerImpl -//============================================================================ - -typedef ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener > ContainerListenerHelper; - -class DlgEdEvtContListenerImpl: public ContainerListenerHelper -{ -private: - DlgEdObj* pDlgEdObj; - -public: - DlgEdEvtContListenerImpl(DlgEdObj* pObj); - virtual ~DlgEdEvtContListenerImpl(); - - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 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 elementReplaced( 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); -}; - -#endif // _BASCTL_DLGEDLIST_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedmod.hxx b/basctl/source/inc/dlgedmod.hxx deleted file mode 100644 index e010e07b0..000000000 --- a/basctl/source/inc/dlgedmod.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _BASCTL_DLGEDMOD_HXX -#define _BASCTL_DLGEDMOD_HXX - -#include - - -//============================================================================ -// DlgEdModel -//============================================================================ - -class DlgEdPage; -class Window; -class SfxObjectShell; - -class DlgEdModel : public SdrModel -{ - friend class DlgEdPage; - -private: - DlgEdModel( const DlgEdModel& ); // not implemented - void operator=(const DlgEdModel& rSrcModel); // not implemented - -public: - TYPEINFO(); - - DlgEdModel(); - virtual ~DlgEdModel(); - - virtual void DlgEdModelChanged( bool bChanged = true ); - - virtual SdrPage* AllocPage(bool bMasterPage); - - virtual Window* GetCurDocViewWin(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx deleted file mode 100644 index 8cf86eb02..000000000 --- a/basctl/source/inc/dlgedobj.hxx +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDOBJ_HXX -#define _BASCTL_DLGEDOBJ_HXX - -#include -#include -#include -#include - -#include -#include - -#include - -typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap; - - -class DlgEdForm; -class DlgEditor; - -//============================================================================ -// DlgEdObj -//============================================================================ - -class DlgEdObj: public SdrUnoObj -{ - friend class DlgEditor; - friend class DlgEdFactory; - friend class DlgEdPropListenerImpl; - friend class DlgEdForm; - -private: - sal_Bool bIsListening; - DlgEdForm* pDlgEdForm; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener> m_xPropertyChangeListener; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener> m_xContainerListener; - -protected: - DlgEdObj(); - DlgEdObj(const ::rtl::OUString& rModelName, - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSFac); - - virtual void NbcMove( const Size& rSize ); - virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); - virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); - - DECL_LINK(OnCreate, void* ); - - using SfxListener::StartListening; - void StartListening(); - using SfxListener::EndListening; - void EndListening(sal_Bool bRemoveListener = sal_True); - sal_Bool isListening() const { return bIsListening; } - - virtual bool TransformSdrToControlCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); - virtual bool TransformSdrToFormCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); - virtual bool TransformControlToSdrCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); - virtual bool TransformFormToSdrCoordinates( - sal_Int32 nXIn, sal_Int32 nYIn, sal_Int32 nWidthIn, sal_Int32 nHeightIn, - sal_Int32& nXOut, sal_Int32& nYOut, sal_Int32& nWidthOut, sal_Int32& nHeightOut ); - -public: - TYPEINFO(); - - virtual ~DlgEdObj(); - virtual void SetPage(SdrPage* pNewPage); - - virtual void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } - virtual DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } - - virtual sal_uInt32 GetObjInventor() const; - virtual sal_uInt16 GetObjIdentifier() const; - - virtual DlgEdObj* Clone() const; // not working yet - virtual void clonedFrom(const DlgEdObj* _pSource); // not working yet - - // FullDrag support - virtual SdrObject* getFullDragClone() const; - - virtual sal_Bool supportsService( const sal_Char* _pServiceName ) const; - virtual ::rtl::OUString GetDefaultName() const; - virtual ::rtl::OUString GetUniqueName() const; - - virtual sal_Int32 GetStep() const; - virtual void UpdateStep(); - - virtual void SetDefaults(); - virtual void SetRectFromProps(); - virtual void SetPropsFromRect(); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > GetControl() const; - - virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); - virtual void SAL_CALL NameChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL TabIndexChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException); - - // PropertyChangeListener - virtual void SAL_CALL _propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); - - // ContainerListener - virtual void SAL_CALL _elementInserted( 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); - virtual void SAL_CALL _elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); - - virtual void SetLayer(SdrLayerID nLayer); -}; - - -//============================================================================ -// DlgEdForm -//============================================================================ - -class DlgEdForm: public DlgEdObj -{ - friend class DlgEditor; - friend class DlgEdFactory; - -private: - DlgEditor* pDlgEditor; - ::std::vector pChilds; - - mutable ::boost::optional< ::com::sun::star::awt::DeviceInfo > mpDeviceInfo; - - -protected: - DlgEdForm(); - - virtual void NbcMove( const Size& rSize ); - virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact); - virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); - -public: - TYPEINFO(); - - virtual ~DlgEdForm(); - - virtual void SetDlgEditor( DlgEditor* pEditor ); - virtual DlgEditor* GetDlgEditor() const { return pDlgEditor; } - - virtual void AddChild( DlgEdObj* pDlgEdObj ); - virtual void RemoveChild( DlgEdObj* pDlgEdObj ); - virtual ::std::vector GetChilds() const { return pChilds; } - - virtual void UpdateStep(); - - virtual void SetRectFromProps(); - virtual void SetPropsFromRect(); - - virtual void PositionAndSizeChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ); - - virtual void UpdateTabIndices(); - virtual void UpdateTabOrder(); - virtual void UpdateGroups(); - virtual void UpdateTabOrderAndGroups(); - - ::com::sun::star::awt::DeviceInfo getDeviceInfo() const; - -private: - void ImplInvalidateDeviceInfo(); -}; - -#endif // _BASCTL_DLGEDOBJ_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx deleted file mode 100644 index 41ccab2f4..000000000 --- a/basctl/source/inc/dlgedpage.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGEDPAGE_HXX -#define _BASCTL_DLGEDPAGE_HXX - -#include "svx/svdpage.hxx" - -//============================================================================ -// DlgEdPage -//============================================================================ - -class DlgEdModel; -class DlgEdForm; - -class DlgEdPage : public SdrPage -{ -private: - DlgEdForm* pDlgEdForm; - -public: - TYPEINFO(); - - DlgEdPage( DlgEdModel& rModel, bool bMasterPage = false ); - DlgEdPage( const DlgEdPage& ); - virtual ~DlgEdPage(); - - using SdrPage::Clone; - virtual SdrPage* Clone() const; - - void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } - DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } - - virtual SdrObject* SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum); -}; - -#endif //_BASCTL_DLGEDPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx deleted file mode 100644 index 24bf0681d..000000000 --- a/basctl/source/inc/dlgedview.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _BASCTL_DLGEDVIEW_HXX -#define _BASCTL_DLGEDVIEW_HXX - -#include - -class DlgEditor; - -//============================================================================ -// DlgEdView -//============================================================================ - -class DlgEdView : public SdrView -{ -private: - DlgEditor* pDlgEditor; - -public: - TYPEINFO(); - - DlgEdView( SdrModel* pModel, OutputDevice* pOut, DlgEditor* pEditor ); - virtual ~DlgEdView(); - - virtual void MarkListHasChanged(); - virtual void MakeVisible( const Rectangle& rRect, Window& rWin ); - -protected: - // overloaded to handle HitTest for some objects special - using SdrView::CheckSingleSdrObjectHit; - virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const; -}; - -#endif //_BASCTL_DLGEDVIEW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgresid.hrc b/basctl/source/inc/dlgresid.hrc deleted file mode 100644 index 64e9893c9..000000000 --- a/basctl/source/inc/dlgresid.hrc +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_DLGRESID_HRC -#define _BASCTL_DLGRESID_HRC - -// include ----------------------------------------------------------- - -#include - -// Dialog Control Id's ----------------------------------------------------------- - -#define RID_STR_CLASS_CONTROL ( RID_DLG_START + 0 ) -#define RID_STR_CLASS_DIALOG ( RID_DLG_START + 1 ) -#define RID_STR_CLASS_BUTTON ( RID_DLG_START + 2 ) -#define RID_STR_CLASS_RADIOBUTTON ( RID_DLG_START + 3 ) -#define RID_STR_CLASS_CHECKBOX ( RID_DLG_START + 4 ) -#define RID_STR_CLASS_LISTBOX ( RID_DLG_START + 5 ) -#define RID_STR_CLASS_COMBOBOX ( RID_DLG_START + 6 ) -#define RID_STR_CLASS_GROUPBOX ( RID_DLG_START + 7 ) -#define RID_STR_CLASS_EDIT ( RID_DLG_START + 8 ) -#define RID_STR_CLASS_FIXEDTEXT ( RID_DLG_START + 9 ) -#define RID_STR_CLASS_IMAGECONTROL ( RID_DLG_START + 10 ) -#define RID_STR_CLASS_PROGRESSBAR ( RID_DLG_START + 11 ) -#define RID_STR_CLASS_SCROLLBAR ( RID_DLG_START + 12 ) -#define RID_STR_CLASS_FIXEDLINE ( RID_DLG_START + 13 ) -#define RID_STR_CLASS_DATEFIELD ( RID_DLG_START + 14 ) -#define RID_STR_CLASS_TIMEFIELD ( RID_DLG_START + 15 ) -#define RID_STR_CLASS_NUMERICFIELD ( RID_DLG_START + 16 ) -#define RID_STR_CLASS_CURRENCYFIELD ( RID_DLG_START + 17 ) -#define RID_STR_CLASS_FORMATTEDFIELD ( RID_DLG_START + 18 ) -#define RID_STR_CLASS_PATTERNFIELD ( RID_DLG_START + 19 ) -#define RID_STR_CLASS_FILECONTROL ( RID_DLG_START + 20 ) -#define RID_STR_TRANSLATION_NOTLOCALIZED ( RID_DLG_START + 21 ) -#define RID_STR_TRANSLATION_DEFAULT ( RID_DLG_START + 22 ) -#define RID_STR_CLASS_TREECONTROL ( RID_DLG_START + 23 ) -// Property Browser Headline Id's ----------------------------------------------------------- - -#define RID_STR_BRWTITLE_PROPERTIES ( RID_DLG_START + 60 ) -#define RID_STR_BRWTITLE_NO_PROPERTIES ( RID_DLG_START + 61 ) -#define RID_STR_BRWTITLE_MULTISELECT ( RID_DLG_START + 62 ) - -// Manage Language Dialogs - -#define RID_DLG_MANAGE_LANGUAGE ( RID_DLG_START + 70 ) -#define RID_QRYBOX_LANGUAGE ( RID_DLG_START + 71 ) -#define RID_DLG_SETDEF_LANGUAGE ( RID_DLG_START + 72 ) -#define RID_DLG_ADD_LANGUAGE ( RID_DLG_START + 73 ) - -// ----------------------------------------------------------------------- - -#endif // _BASCTL_DLGRESID_HRC - diff --git a/basctl/source/inc/doceventnotifier.hxx b/basctl/source/inc/doceventnotifier.hxx deleted file mode 100644 index b991a1224..000000000 --- a/basctl/source/inc/doceventnotifier.hxx +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BASCTL_DOCEVENTNOTIFIER_HXX -#define BASCTL_DOCEVENTNOTIFIER_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -#include - -//........................................................................ -namespace basctl -{ -//........................................................................ - - class ScriptDocument; - - //==================================================================== - //= DocumentEventListener - //==================================================================== - class SAL_NO_VTABLE DocumentEventListener : ::boost::noncopyable - { - public: - virtual void onDocumentCreated( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentOpened( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentSave( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentSaveDone( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentSaveAs( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentClosed( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument ) = 0; - virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ) = 0; - - virtual ~DocumentEventListener(); - }; - - //==================================================================== - //= DocumentEventNotifier - //==================================================================== - class DocumentEventNotifier_Impl; - /** allows registering at the GlobalEventBroadcaster for global document events - */ - class DocumentEventNotifier - { - public: - /** create a notifier instance which notifies about events of all documents in the whole application - */ - DocumentEventNotifier( DocumentEventListener& _rListener ); - - /** creates a notifier instance which notifies about events at a single document - */ - DocumentEventNotifier( DocumentEventListener& _rListener, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument ); - - ~DocumentEventNotifier(); - - public: - void dispose(); - - private: - ::rtl::Reference< DocumentEventNotifier_Impl > m_pImpl; - }; - -//........................................................................ -} // namespace basctl -//........................................................................ - -#endif // BASCTL_DOCEVENTNOTIFIER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/docsignature.hxx b/basctl/source/inc/docsignature.hxx deleted file mode 100644 index 3b8d01c16..000000000 --- a/basctl/source/inc/docsignature.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef BASCTL_DOCSIGNATURE_HXX -#define BASCTL_DOCSIGNATURE_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace basctl -{ -//........................................................................ - - class ScriptDocument; - //==================================================================== - //= DocumentSignature - //==================================================================== - struct DocumentSignature_Data; - /// encapsulates (actions on) the signature/state of a document - class DocumentSignature - { - public: - /** creates a DocumentSignature instance for the given document - - If the given ScriptDocument instance refers to the application, or to a document - which does not support being signed, the DocumentSignature instance is invalid afterwards. - */ - DocumentSignature( const ScriptDocument& _rDocument ); - ~DocumentSignature(); - - /** determines whether the instance is valid - - An instance is valid if and only if it has been constructed with a document - which supports signatures. - */ - bool supportsSignatures() const; - - /** signs the scripting content inside the document - - @precond - isValid returns - */ - void signScriptingContent() const; - - /** retrieves the state of the signature of the scripting content inside the document - - If the instance is not valid, then SIGNATURESTATE_NOSIGNATURES is returned. - */ - sal_uInt16 getScriptingSignatureState() const; - - private: - DocumentSignature(); // not implemented - - private: - ::std::auto_ptr< DocumentSignature_Data > m_pData; - }; - -//........................................................................ -} // namespace basctl -//........................................................................ - -#endif // BASCTL_DOCSIGNATURE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/iderid.hxx b/basctl/source/inc/iderid.hxx deleted file mode 100644 index 5746360bd..000000000 --- a/basctl/source/inc/iderid.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _IDERID_HXX -#define _IDERID_HXX - -#include - -class IDEResId: public ResId -{ -public: - IDEResId( sal_uInt16 nId ); -}; - - -#endif //_IDERID_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/localizationmgr.hxx b/basctl/source/inc/localizationmgr.hxx deleted file mode 100644 index e3e3f3e71..000000000 --- a/basctl/source/inc/localizationmgr.hxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _LOCALIZATIONMGR_HXX -#define _LOCALIZATIONMGR_HXX - -#include -#include - -#include "scriptdocument.hxx" - -class BasicIDEShell; -class DlgEditor; - -class LocalizationMgr -{ - ::com::sun::star::uno::Reference - < ::com::sun::star::resource::XStringResourceManager > m_xStringResourceManager; - - BasicIDEShell* m_pIDEShell; - - ScriptDocument m_aDocument; - String m_aLibName; - - ::com::sun::star::lang::Locale m_aLocaleBeforeBasicStart; - - enum HandleResourceMode - { - SET_IDS, - RESET_IDS, - RENAME_DIALOG_IDS, - RENAME_CONTROL_IDS, - REMOVE_IDS_FROM_RESOURCE, - MOVE_RESOURCES, - COPY_RESOURCES - }; - static sal_Int32 implHandleControlResourceProperties( ::com::sun::star::uno::Any aControlAny, - const ::rtl::OUString& aDialogName, const ::rtl::OUString& aCtrlName, - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > - xStringResourceManager, ::com::sun::star::uno::Reference< ::com::sun::star::resource:: - XStringResourceResolver > xSourceStringResolver, HandleResourceMode eMode ); - - void enableResourceForAllLibraryDialogs( void ) - { - implEnableDisableResourceForAllLibraryDialogs( SET_IDS ); - } - void disableResourceForAllLibraryDialogs( void ) - { - implEnableDisableResourceForAllLibraryDialogs( RESET_IDS ); - } - void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode ); - -public: - LocalizationMgr( BasicIDEShell* pIDEShell, const ScriptDocument& rDocument, String aLibName, - const ::com::sun::star::uno::Reference - < ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager ); - ::com::sun::star::uno::Reference - < ::com::sun::star::resource::XStringResourceManager >getStringResourceManager( void ) - { - return m_xStringResourceManager; - } - - bool isLibraryLocalized( void ); - - void handleTranslationbar( void ); - - void handleAddLocales( ::com::sun::star::uno::Sequence - < ::com::sun::star::lang::Locale > aLocaleSeq ); - - void handleRemoveLocales( ::com::sun::star::uno::Sequence - < ::com::sun::star::lang::Locale > aLocaleSeq ); - - void handleSetDefaultLocale( ::com::sun::star::lang::Locale aLocale ); - - void handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale ); - - void handleBasicStarted( void ); - - void handleBasicStopped( void ); - - static void setControlResourceIDsForNewEditorObject( DlgEditor* pEditor, - ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aCtrlName ); - - static void renameControlResourceIDsForEditorObject( DlgEditor* pEditor, - ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aNewCtrlName ); - - static void deleteControlResourceIDsForDeletedEditorObject( DlgEditor* pEditor, - ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aCtrlName ); - - static void setStringResourceAtDialog( const ScriptDocument& rDocument, const String& aLibName, const String& aDlgName, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel ); - - static void renameStringResourceIDs( const ScriptDocument& rDocument, const String& aLibName, const String& aDlgName, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel ); - - static void removeResourceForDialog( const ScriptDocument& rDocument, const String& aLibName, const String& aDlgName, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel ); - - static ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > - getStringResourceFromDialogLibrary( ::com::sun::star::uno::Reference - < ::com::sun::star::container::XNameContainer > xDialogLib ); - - // Clipboard / Drag & Drop - static void resetResourceForDialog( - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel, - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager ); - - static void setResourceIDsForDialog( - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel, - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager ); - - static void copyResourcesForPastedEditorObject( DlgEditor* pEditor, - ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aCtrlName, - ::com::sun::star::uno::Reference< ::com::sun::star::resource:: - XStringResourceResolver > xSourceStringResolver ); - - static void copyResourceForDroppedDialog( - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xDialogModel, - const ::rtl::OUString& aDialogName, - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager > xStringResourceManager, - ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > xSourceStringResolver ); - - static void copyResourceForDialog( - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xDialogModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::resource:: - XStringResourceResolver >& xSourceStringResolver, - const ::com::sun::star::uno::Reference< ::com::sun::star::resource:: - XStringResourceManager >& xTargetStringResourceManager ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx deleted file mode 100644 index a10a56008..000000000 --- a/basctl/source/inc/managelang.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_MANAGELANG_HXX -#define _BASCTL_MANAGELANG_HXX - -#include -#include -#include -#include -#include -#include - -class LocalizationMgr; - -struct LanguageEntry -{ - String m_sLanguage; - ::com::sun::star::lang::Locale m_aLocale; - bool m_bIsDefault; - - LanguageEntry( const String& _rLanguage, - const ::com::sun::star::lang::Locale& _rLocale, - bool _bIsDefault ) : - m_sLanguage( _rLanguage ), - m_aLocale( _rLocale ), - m_bIsDefault( _bIsDefault ) {} -}; - -extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, - const ::com::sun::star::lang::Locale& rLocaleRight ); - -class ManageLanguageDialog : public ModalDialog -{ -private: - FixedText m_aLanguageFT; - ListBox m_aLanguageLB; - PushButton m_aAddPB; - PushButton m_aDeletePB; - PushButton m_aMakeDefPB; - FixedText m_aInfoFT; - - FixedLine m_aBtnLine; - HelpButton m_aHelpBtn; - OKButton m_aCloseBtn; - - LocalizationMgr* m_pLocalizationMgr; - - String m_sDefLangStr; - String m_sDeleteStr; - String m_sCreateLangStr; - - void Init(); - void CalcInfoSize(); - void FillLanguageBox(); - void ClearLanguageBox(); - - DECL_LINK( AddHdl, Button * ); - DECL_LINK( DeleteHdl, Button * ); - DECL_LINK( MakeDefHdl, Button * ); - DECL_LINK( SelectHdl, ListBox * ); - -public: - ManageLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); - ~ManageLanguageDialog(); -}; - -class SetDefaultLanguageDialog : public ModalDialog -{ -private: - FixedText m_aLanguageFT; - SvxLanguageBox* m_pLanguageLB; - SvxCheckListBox* m_pCheckLangLB; - FixedText m_aInfoFT; - - FixedLine m_aBtnLine; - OKButton m_aOKBtn; - CancelButton m_aCancelBtn; - HelpButton m_aHelpBtn; - - bool m_bIsDefaultMode; - LocalizationMgr* m_pLocalizationMgr; - - void FillLanguageBox(); - void CalcInfoSize(); - -public: - SetDefaultLanguageDialog( Window* pParent, LocalizationMgr* _pLMgr ); - ~SetDefaultLanguageDialog(); - - ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const; -}; - -#endif //_BASCTL_MANAGELANG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx deleted file mode 100644 index 9d869abe0..000000000 --- a/basctl/source/inc/propbrw.hxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BASCTL_PROPBRW_HXX -#define _BASCTL_PROPBRW_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//============================================================================ -// PropBrwMgr -//============================================================================ - -class PropBrwMgr : public SfxChildWindow -{ -public: - PropBrwMgr(Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo); - SFX_DECL_CHILDWINDOW(PropBrwMgr); -}; - -//============================================================================ -// PropBrw -//============================================================================ - -class SfxBindings; -class SdrView; - -class PropBrw : public SfxFloatingWindow , public SfxListener, public SfxBroadcaster -{ -private: - sal_Bool m_bInitialStateChange; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - m_xMeAsFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xBrowserController; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > - m_xBrowserComponentWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - m_xContextDocument; - -protected: - SdrView* pView; - virtual void Resize(); - virtual void FillInfo( SfxChildWinInfo& rInfo ) const; - virtual sal_Bool Close(); - - DECLARE_STL_VECTOR(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>, InterfaceArray); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > - CreateMultiSelectionSequence( const SdrMarkList& _rMarkList ); - void implSetNewObjectSequence( const ::com::sun::star::uno::Sequence - < ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rObjectSeq ); - - void implSetNewObject( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject); - - ::rtl::OUString GetHeadlineName( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject); - -public: - PropBrw( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, - SfxBindings *pBindings, - PropBrwMgr* pMgr, - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - virtual ~PropBrw(); - using Window::Update; - // note: changing the Context document to an instance other than the one given in the ctor is not supported - // currently - void Update( const SfxViewShell* _pShell ); - SdrView* GetCurView() const { return pView; } - -private: - void ImplUpdate( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument, SdrView* pView ); - void ImplDestroyController(); - void ImplReCreateController(); -}; - -#endif // _BASCTL_PROPBRW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx deleted file mode 100644 index 4a09f4db4..000000000 --- a/basctl/source/inc/sbxitem.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SBXITEM_HXX -#define _SBXITEM_HXX - -#include "scriptdocument.hxx" -#include - -const sal_uInt16 BASICIDE_TYPE_UNKNOWN = 0; -const sal_uInt16 BASICIDE_TYPE_SHELL = 1; -const sal_uInt16 BASICIDE_TYPE_LIBRARY = 2; -const sal_uInt16 BASICIDE_TYPE_MODULE = 3; -const sal_uInt16 BASICIDE_TYPE_DIALOG = 4; -const sal_uInt16 BASICIDE_TYPE_METHOD = 5; - - -class SbxItem : public SfxPoolItem -{ - ScriptDocument m_aDocument; - String m_aLibName; - String m_aName; - String m_aMethodName; - sal_uInt16 m_nType; - -public: - TYPEINFO(); - SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const String& aLibName, const String& aName, sal_uInt16 nType ); - SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const String& aLibName, const String& aName, const String& aMethodName, sal_uInt16 nType ); - SbxItem( const SbxItem& ); - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual int operator==( const SfxPoolItem& ) const; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - - const String& GetLibName() const { return m_aLibName; } - void SetLibName( const String& aLibName ) { m_aLibName = aLibName; } - - const String& GetName() const { return m_aName; } - void SetName( const String& aName ) { m_aName = aName; } - - const String& GetMethodName() const { return m_aMethodName; } - void SetMethodName( const String& aMethodName ) { m_aMethodName = aMethodName; } - - sal_uInt16 GetType() const { return m_nType; } - void SetType( sal_uInt16 nType ) { m_nType = nType; } -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx deleted file mode 100644 index f5ea8a060..000000000 --- a/basctl/source/inc/scriptdocument.hxx +++ /dev/null @@ -1,540 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SCRIPTDOCUMENT_HXX -#define SCRIPTDOCUMENT_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include - -class BasicManager; -class SfxListener; - -//........................................................................ -namespace basctl -{ -//........................................................................ - - //==================================================================== - //= LibraryContainerType - //==================================================================== - enum LibraryContainerType - { - E_SCRIPTS, - E_DIALOGS - }; - - enum LibraryLocation - { - LIBRARY_LOCATION_UNKNOWN, - LIBRARY_LOCATION_USER, - LIBRARY_LOCATION_SHARE, - LIBRARY_LOCATION_DOCUMENT - }; - - enum LibraryType - { - LIBRARY_TYPE_UNKNOWN, - LIBRARY_TYPE_MODULE, - LIBRARY_TYPE_DIALOG, - LIBRARY_TYPE_ALL - }; - - //==================================================================== - //= ScriptDocument - //==================================================================== - class ScriptDocument_Impl; - - class ScriptDocument; - typedef ::std::vector< ScriptDocument > ScriptDocuments; - - /** encapsulates a document which contains Basic scripts and dialogs - */ - class ScriptDocument - { - private: - ::boost::shared_ptr< ScriptDocument_Impl > m_pImpl; - - private: - /** creates a ScriptDocument instance which operates on the application-wide - scripts and dialogs - */ - ScriptDocument(); - - public: - enum SpecialDocument { NoDocument }; - /** creates a ScriptDocument instance which does refers to neither the application-wide, - nor a specific real document's scripts. - - This constructor might come handy when you need some kind of uninitialized - ScriptDocument, which you do not want to operate on (yet), but initialize later - by assignment. - - isValid will return for a ScriptDocument constructed - this way. - */ - explicit ScriptDocument( SpecialDocument _eType ); - - /** creates a ScriptDocument instance which refers to a document given as - XModel - - @param _rxDocument - the document. Must not be . - */ - explicit ScriptDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument ); - - /// copy constructor - ScriptDocument( const ScriptDocument& _rSource ); - - /// destructor - ~ScriptDocument(); - - /** returns a reference to a shared ScriptDocument instance which - operates on the application-wide scripts and dialogs - */ - static const ScriptDocument& - getApplicationScriptDocument(); - - /** returns a (newly created) ScriptDocument instance for the document to - which a given BasicManager belongs - - If the basic manager is the application's basic manager, then the (shared) - ScriptDocument instance which is responsible for the application is returned. - - @see getApplicationScriptDocument - */ - static ScriptDocument - getDocumentForBasicManager( const BasicManager* _pManager ); - - /** returns a (newly created) ScriptDocument instance for the document - with a given caption or URL - - If there is no document with the given caption, then the (shared) - ScriptDocument instance which is responsible for the application is returned. - - @see getApplicationScriptDocument - */ - static ScriptDocument - getDocumentWithURLOrCaption( const ::rtl::OUString& _rUrlOrCaption ); - - /** operation mode for getAllScriptDocuments - */ - enum ScriptDocumentList - { - /** all ScriptDocuments, including the dedicated one which represents - the application-wide scripts/dialogs. - */ - AllWithApplication, - /** real documents only - */ - DocumentsOnly, - /** real documents only, sorted lexicographically by their title (using the sys locale's default - collator) - */ - DocumentsSorted - }; - - /** returns the set of ScriptDocument instances, one for each open document which - contains Basic/Dialog containers; plus an additional instance for - the application, if desired - - Documents which are not visible - i.e. do not have a visible frame. - - @param _bIncludingApplication - if the application-wide scripts/dialogs should also be represented - by a ScriptDocument - */ - static ScriptDocuments - getAllScriptDocuments( ScriptDocumentList _eListType ); - - // comparison - bool operator==( const ScriptDocument& _rhs ) const; - inline bool operator!=( const ScriptDocument& _rhs ) const { return !( *this == _rhs ); } - - /// retrieves a (pretty simple) hash code for the document - sal_Int32 hashCode() const; - - /** determines whether the document is actually able to contain Basic/Dialog libraries - - Note that validity does not automatically imply the document can be used for active - work. Instead, it is possible the document is closed already (or being closed currently). - In this case, isValid will return , but isAlive will return . - - @return - if the instance refers to a document which contains Basic/Dialog libraries, - or the application as a whole, otherwise. - - @see isAlive - */ - bool isValid() const; - - /** determines whether the document instance is alive - - If the instance is not valid, is returned. - - If the instance refers to a real document, which is already closed, or just being closed, - the method returns . - - If the instance refers to the application, is returned. - - @see isValid - */ - bool isAlive() const; - - bool isInVBAMode() const; - /// returns the BasicManager associated with this instance - BasicManager* - getBasicManager() const; - - /** returns the UNO component representing the document which the instance operates on - - Must not be used when the instance operates on the application-wide - Basic/Dialog libraries. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - getDocument() const; - - /** returns the UNO component representing the document which the instance operates on - - May be used when the instance operates on the application-wide - Basic/Dialog libraries, in this case it returns . - */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - getDocumentOrNull() const; - - /** returns the Basic or Dialog library container of the document - - If the document is not valid, is returned. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer > - getLibraryContainer( LibraryContainerType _eType ) const; - - /** determines whether there exists a library of the given type, with the given name - */ - bool hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - - /** returns a script or dialog library given by name - - @param _eType - the type of library to load - @param _rLibName - the name of the script library - @param _bLoadLibrary - if and only if the library should be loaded. - - @throws NoSuchElementException - if there is no script library with the given name - */ - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const - SAL_THROW((::com::sun::star::container::NoSuchElementException)); - - /** creates a script or dialog library in the document, or returns an existing one - - If _rLibName denotes an existing library which does not need to be created, - then this library will automatically be loaded, and then returned. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > - getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - - /** returns the names of the modules in a given script or dialog library of the document - */ - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getObjectNames( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - - /** retrieves a name for a newly to be created module or dialog - */ - ::rtl::OUString - createObjectName( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const; - - /** loads a script or dialog library given by name, if there is such a library - */ - void loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ); - - /// retrieves the (combined) names of all script and dialog libraries - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getLibraryNames() const; - - /** removes a given script module from the document - - @return - if and only if the removal was successful. When is returned, - this will reported as assertion in a non-product build. - */ - bool removeModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) const; - - /** creates a module with the given name in the given library - @param _rLibName - the library name - @param _rModName - the name of the to-be-created module - @param _bCreateMain - determines whether or not a function Main should be created - @param _out_rNewModuleCode - the source code of the newly created module - @return - if and only if the creation was successful - */ - bool createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const; - - /** inserts a given piece as code as module - @param _rLibName - the name of the library to insert the module into. If a library with this name does - not yet exist, it will be created. - @param _rModName - the name of the module to insert the code as. Must denote a name which is not yet - used in the module library. - @param _rModuleCode - the code of the new module - @return - if and only if the insertion was successful. - */ - bool insertModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const; - - /** updates a given module with new code - @param _rLibName - the name of the library the modules lives in. Must denote an existing module library. - @param _rModName - the name of the module to update. Must denote an existing module in the given library. - @param _rModuleCode - the new module code. - @return - if and only if the insertion was successful. - */ - bool updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const; - - /// determines whether a module with the given name exists in the given library - bool hasModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const; - - /** retrieves a module's source - @param _rLibName - the library name where the module is located - @param _rModName - the module name - @param _out_rModuleSource - takes the module's source upon successful return - @return - if and only if the code could be successfully retrieved, otherwise - */ - bool getModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, ::rtl::OUString& _rModuleSource ) const; - - /** renames a module - @param _rLibName - the library where the module lives in. Must denote an existing library. - @param _rOldName - the old module name. Must denote an existing module. - @param _rNewName - the new module name - @return - if and only if renaming was successful. - */ - bool renameModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName ) const; - - /** removes a given dialog from the document - - @return - if and only if the removal was successful. When is returned, - this will reported as assertion in a non-product build. - */ - bool removeDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const; - - /// determines whether a dialog with the given name exists in the given library - bool hasDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const; - - /** retrieves a dialog - @param _rLibName - the library name where the module is located - @param _rDialogName - the dialog's name - @param _out_rDialogSource - takes the provider for the dialog's desription, upon successful return - @return - if and only if the dialog could be successfully retrieved, otherwise - */ - bool getDialog( - const ::rtl::OUString& _rLibName, - const ::rtl::OUString& _rDialogName, - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& _out_rDialogProvider - ) const; - - /** renames a dialog - @param _rLibName - the library where the dialog lives in. Must denote an existing library. - @param _rOldName - the old dialog name. Must denote an existing dialog. - @param _rNewName - the new dialog name - @param _rxExistingDialogModel - the existing model of the dialog, if already loaded in the IDE - @return - if and only if renaming was successful. - */ - bool renameDialog( - const ::rtl::OUString& _rLibName, - const ::rtl::OUString& _rOldName, - const ::rtl::OUString& _rNewName, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& _rxExistingDialogModel - ) const; - - /** create a dialog - @param _rLibName - the library name where the module is located - @param _rDialogName - the dialog's name - @param _out_rDialogSource - takes the provider for the dialog's desription, upon successful return - @return - if and only if the dialog could be successfully retrieved, otherwise - */ - bool createDialog( - const ::rtl::OUString& _rLibName, - const ::rtl::OUString& _rDialogName, - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& _out_rDialogProvider - ) const; - - /** inserts a given dialog into a given library - - @param _rLibName - the name of the library to insert the dialog into. If a library with this name does - not yet exist, it will be created. - @param _rModName - the name of the dialog to insert. Must denote a name which is not yet - used in the dialog library. - @param _rDialogProvider - the provider of the dialog's description - @return - if and only if the insertion was successful. - */ - bool insertDialog( - const ::rtl::OUString& _rLibName, - const ::rtl::OUString& _rDialogName, - const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& _rDialogProvider - ) const; - - /** determines whether the document is read-only - - cannot be called if the document operates on the application-wide scripts - */ - bool isReadOnly() const; - - /** determines whether the ScriptDocument instance operates on the whole application, - as opposed to a real document - */ - bool isApplication() const; - - /** determines whether the ScriptDocument instance operates on a real document, - as opposed to the whole application - */ - bool isDocument() const { return isValid() && !isApplication(); } - - /** marks the document as modified - @precond - the instance operates on a real document, not on the application - @see isDocument - */ - void setDocumentModified() const; - - /** determines whether the document is modified - @precond - the instance operates on a real document, not on the application - @see isDocument - */ - bool isDocumentModified() const; - - /** saves the document, if the instance refers to a real document - @precond - isApplication returns - */ - bool saveDocument( - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >& _rxStatusIndicator - ) const; - - /// returns the location of a library given by name - LibraryLocation - getLibraryLocation( const ::rtl::OUString& _rLibName ) const; - - /// returns the title for the document - ::rtl::OUString - getTitle( LibraryLocation _eLocation, LibraryType _eType = LIBRARY_TYPE_ALL ) const; - - /** returns the title of the document - - to be used for valid documents only - */ - ::rtl::OUString - getTitle() const; - - /** returns the URL of the document - - to be used for valid documents only - */ - ::rtl::OUString - getURL() const; - - /** determines whether the document is currently the one-and-only application-wide active document - */ - bool isActive() const; - - /** determines whether macro execution for this document is allowed - - only to be called for real documents (->isDocument) - */ - bool allowMacros() const; - }; - -//........................................................................ -} // namespace basctl -//........................................................................ - -// convenience ... better would be all classes in the project are in -// the same namespace ... -using ::basctl::ScriptDocument; -using ::basctl::ScriptDocuments; -using ::basctl::E_SCRIPTS; -using ::basctl::E_DIALOGS; -using ::basctl::LibraryLocation; -using ::basctl::LIBRARY_LOCATION_UNKNOWN; -using ::basctl::LIBRARY_LOCATION_USER; -using ::basctl::LIBRARY_LOCATION_SHARE; -using ::basctl::LIBRARY_LOCATION_DOCUMENT; -using ::basctl::LibraryType; -using ::basctl::LIBRARY_TYPE_UNKNOWN; -using ::basctl::LIBRARY_TYPE_MODULE; -using ::basctl::LIBRARY_TYPE_DIALOG; -using ::basctl::LIBRARY_TYPE_ALL; - -#endif // SCRIPTDOCUMENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/svheader.hxx b/basctl/source/inc/svheader.hxx deleted file mode 100644 index 6cd1ebf66..000000000 --- a/basctl/source/inc/svheader.hxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVHEADER_HXX -#define _SVHEADER_HXX - - -// SV -#define _COLDLG_HXX -#define _CONFIG_HXX -#define _CURSOR_HXX -#define _FONTDLG_HXX -#define _PRVWIN_HXX -//#define _SELENG_HXX -#define _VIRTDEV_HXX - -// Wenn Brkdlg ohne PCH: -// #define _SPIN_HXX -// #define _FIELD_HXX - -// SVTOOLS -#define _CTRLBOX_HXX -#define _EXTATTR_HXX -#define _CTRLTOOL_HXX -#define _CTRLBOX_HXX -#define _STDMENU_HXX -#define _VALUESET_HXX -#define _RULER_HXX -#define _SCRWIN_HXX - -// SFX -#define _SFXAPPWIN_HXX -#define _SFX_RESMGR_HXX -#define _SFX_PRNMON_HXX -#define _INTRO_HXX -#define _SFXMSGDESCR_HXX -#define _SFXMSGPOOL_HXX -// #define _PASSWD_HXX -#define _SFXMNUMGR_HXX - -// SFXDLG -// #define _SFXTABDLG_HXX -// #define _SFX_DINFDLG_HXX -#define _SFX_MGETEMPL_HXX -#define _SFX_STYLEDLG_HXX -#define _SFX_TPLPITEM_HXX -#define _NEWSTYLE_HXX -#define _SFXDOCTEMPL_HXX -#define _SFXDOCTDLG_HXX -#define _SFX_TEMPLDLG_HXX -#define _SFXNEW_HXX - -// SFXDOC -// #define _SFXDOCINF_HXX -//#define _SFX_DOCFILT_HXX -#define _SFX_IPFRM_HXX -#define _SFX_INTERNO_HXX - -// SVCONTNR -#define _SVICNVW_HXX - -#define _SBSTDOBJ1_HXX -#define _SBXMSTRM_HXX - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml deleted file mode 100644 index 6a97e5471..000000000 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/uiconfig/basicide/statusbar/statusbar.xml b/basctl/uiconfig/basicide/statusbar/statusbar.xml deleted file mode 100644 index 37766aeb5..000000000 --- a/basctl/uiconfig/basicide/statusbar/statusbar.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/basctl/uiconfig/basicide/toolbar/dialogbar.xml b/basctl/uiconfig/basicide/toolbar/dialogbar.xml deleted file mode 100644 index 91b9a925f..000000000 --- a/basctl/uiconfig/basicide/toolbar/dialogbar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/basctl/uiconfig/basicide/toolbar/findbar.xml b/basctl/uiconfig/basicide/toolbar/findbar.xml deleted file mode 100644 index 49e483e17..000000000 --- a/basctl/uiconfig/basicide/toolbar/findbar.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/basctl/uiconfig/basicide/toolbar/fullscreenbar.xml b/basctl/uiconfig/basicide/toolbar/fullscreenbar.xml deleted file mode 100644 index 5aecdda4f..000000000 --- a/basctl/uiconfig/basicide/toolbar/fullscreenbar.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/basctl/uiconfig/basicide/toolbar/insertcontrolsbar.xml b/basctl/uiconfig/basicide/toolbar/insertcontrolsbar.xml deleted file mode 100644 index fe0edf689..000000000 --- a/basctl/uiconfig/basicide/toolbar/insertcontrolsbar.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/uiconfig/basicide/toolbar/macrobar.xml b/basctl/uiconfig/basicide/toolbar/macrobar.xml deleted file mode 100644 index 6e22bff09..000000000 --- a/basctl/uiconfig/basicide/toolbar/macrobar.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/basctl/uiconfig/basicide/toolbar/standardbar.xml b/basctl/uiconfig/basicide/toolbar/standardbar.xml deleted file mode 100644 index 44a35f862..000000000 --- a/basctl/uiconfig/basicide/toolbar/standardbar.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/basctl/uiconfig/basicide/toolbar/translationbar.xml b/basctl/uiconfig/basicide/toolbar/translationbar.xml deleted file mode 100644 index 0402e9ba3..000000000 --- a/basctl/uiconfig/basicide/toolbar/translationbar.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/basctl/util/basctl.component b/basctl/util/basctl.component deleted file mode 100644 index f101deaf2..000000000 --- a/basctl/util/basctl.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/basctl/util/basctl.xml b/basctl/util/basctl.xml deleted file mode 100644 index ab9a324e3..000000000 --- a/basctl/util/basctl.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - basctl - - Thomas Benisch - com.sun.star.comp.basctl.AccessibleWindow - specifies accessibility support for a window. - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.awt.AccessibleWindow - - - Thomas Benisch - com.sun.star.comp.basctl.AccessibleShape - specifies accessibility support for a shape. - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.drawing.AccessibleShape - - diff --git a/bean/com/sun/star/beans/ContainerFactory.java b/bean/com/sun/star/beans/ContainerFactory.java deleted file mode 100644 index 8d42c67ad..000000000 --- a/bean/com/sun/star/beans/ContainerFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import java.awt.Container; - -/** - * This interface reprecents an AWT container factory. - * - * @see OfficeBean - * @deprecated - */ - -public interface ContainerFactory -{ - /** - * Creates an AWT container. - * - * @return An AWT container. - */ - Container createContainer(); -} diff --git a/bean/com/sun/star/beans/JavaWindowPeerFake.java b/bean/com/sun/star/beans/JavaWindowPeerFake.java deleted file mode 100644 index 54ca0c1d8..000000000 --- a/bean/com/sun/star/beans/JavaWindowPeerFake.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import com.sun.star.awt.*; - -/**

Class to pass the system window handle to the OpenOffice.org toolkit.

- * @deprecated - */ -/* package */ class JavaWindowPeerFake - implements XSystemDependentWindowPeer, XWindowPeer -{ - - protected long hWindow; - protected int localSystemType; - - /** Create the faked window peer. - * @param _hWindow the system handle to the window. - * @param _systemType specifies the system type. - */ - public JavaWindowPeerFake(long _hWindow, int _systemType) - { - hWindow = _hWindow; - localSystemType = _systemType; - } - - /**

Implementation of XSystemDependentWindowPeer (that's all we really need)

- * This method is called back from the OpenOffice.org toolkit to retrieve the system data. - */ - public Object getWindowHandle(/*IN*/byte[] ProcessId, /*IN*/short SystemType) - throws com.sun.star.uno.RuntimeException - { - - if (SystemType == localSystemType) { - return new Integer((int)hWindow); - } - else return null; - } - - /** not really neaded. - */ - public XToolkit getToolkit() - throws com.sun.star.uno.RuntimeException - { - return null; - } - - /** not really neaded. - */ - public void setPointer(/*IN*/XPointer Pointer) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void setBackground(/*IN*/int Color) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void invalidate(/*IN*/short Flags) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void invalidateRect(/*IN*/com.sun.star.awt.Rectangle Rect, /*IN*/short Flags) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void dispose() - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void addEventListener(/*IN*/com.sun.star.lang.XEventListener xListener) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void removeEventListener(/*IN*/com.sun.star.lang.XEventListener aListener) - throws com.sun.star.uno.RuntimeException - { - } -} - diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java deleted file mode 100644 index cb2d61f0f..000000000 --- a/bean/com/sun/star/beans/LocalOfficeConnection.java +++ /dev/null @@ -1,617 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import java.awt.Container; -import java.io.File; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XEventListener; -import com.sun.star.bridge.XUnoUrlResolver; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lib.uno.helper.UnoUrl; -import com.sun.star.lib.util.NativeLibraryLoader; - -/** - * This class reprecents a connection to the local office application. - * @deprecated - */ -public class LocalOfficeConnection - implements OfficeConnection -{ - public static final String OFFICE_APP_NAME = "soffice"; - public static final String OFFICE_LIB_NAME = "officebean"; - public static final String OFFICE_ID_SUFFIX = "_Office"; - - private Process mProcess; - private ContainerFactory mContainerFactory; - private XComponentContext mContext; - - private String mURL; - private String mProgramPath; - private String mConnType; - private String mPipe; - private String mPort; - private String mProtocol; - private String mInitialObject; - - private List mComponents = new Vector(); - - /** - * Constructor. - * Sets up paths to the office application and native libraries if - * values are available in OFFICE_PROP_FILE in the user - * home directory.
- * "com.sun.star.beans.path" - the office application directory;
- * "com.sun.star.beans.libpath" - native libraries directory. - */ - public LocalOfficeConnection() - { - // init member vars - try - { - setUnoUrl( "uno:pipe,name=" + getPipeName() + ";urp;StarOffice.ServiceManager" ); - } - catch ( java.net.MalformedURLException e ) - {} - - // load libofficebean.so/officebean.dll - String aSharedLibName = getProgramPath() + java.io.File.separator + - System.mapLibraryName(OFFICE_LIB_NAME); - System.load( aSharedLibName ); - } - - /** - * Sets a connection URL. - * This implementation accepts a UNO URL with following format:
- *
-     * url    := uno:localoffice[,<params>];urp;StarOffice.ServiceManager
-     * params := <path>[,<pipe>]
-     * path   := path=<pathv>
-     * pipe   := pipe=<pipev>
-     * pathv  := platform_specific_path_to_the_local_office_distribution
-     * pipev  := local_office_connection_pipe_name
-     * 
- * - * @param url This is UNO URL which discribes the type of a connection. - */ - public void setUnoUrl(String url) - throws java.net.MalformedURLException - { - mURL = null; - - String prefix = "uno:localoffice"; - if ( url.startsWith(prefix) ) - parseUnoUrlWithOfficePath( url, prefix ); - else - { - try - { - UnoUrl aURL = UnoUrl.parseUnoUrl( url ); - mProgramPath = null; - mConnType = aURL.getConnection(); - mPipe = (String) aURL.getConnectionParameters().get( "pipe" ); - mPort = (String) aURL.getConnectionParameters().get( "port" ); - mProtocol = aURL.getProtocol(); - mInitialObject = aURL.getRootOid(); - } - catch ( com.sun.star.lang.IllegalArgumentException eIll ) - { - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - } - } - mURL = url; - } - - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - public void setContainerFactory(ContainerFactory containerFactory) - { - mContainerFactory = containerFactory; - } - - /** - * Retrives the UNO component context. - * Establishes a connection if necessary and initialises the - * UNO service manager if it has not already been initialised. - * This method can return null if it fails to connect - * to the office application. - * - * @return The office UNO component context. - */ - public XComponentContext getComponentContext() - { - if ( mContext == null ) - mContext = connect(); - return mContext; - } - - /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * @param container This is an AWT container. - * @return The office window instance. - */ - public OfficeWindow createOfficeWindow(Container container) - { - return new LocalOfficeWindow(this); - } - - /** - * Closes the connection. - */ - public void dispose() - { - Iterator itr = mComponents.iterator(); - while (itr.hasNext() == true) { - // ignore runtime exceptions in dispose - try { ((XEventListener)itr.next()).disposing(null); } - catch ( RuntimeException aExc ) {} - } - mComponents.clear(); - - mContainerFactory = null; - mContext = null; - } - - /** - * Adds an event listener to the object. - * - * @param listener is a listener object. - */ - public void addEventListener(XEventListener listener) - { - mComponents.add(listener); - } - - /** - * Removes an event listener from the listener list. - * - * @param listener is a listener object. - */ - public void removeEventListener(XEventListener listener) - { - mComponents.remove(listener); - } - - /** - * Establishes the connection to the office. - */ - private XComponentContext connect() - { - try - { - // create default local component context - XComponentContext xLocalContext = - com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null); - - // initial serviceManager - XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); - - // create a urlresolver - Object urlResolver = xLocalServiceManager.createInstanceWithContext( - "com.sun.star.bridge.UnoUrlResolver", xLocalContext ); - - // query for the XUnoUrlResolver interface - XUnoUrlResolver xUrlResolver = - (XUnoUrlResolver) UnoRuntime.queryInterface( XUnoUrlResolver.class, urlResolver ); - - // try to connect to soffice - Object aInitialObject = null; - try - { - aInitialObject = xUrlResolver.resolve( mURL ); - } - catch( com.sun.star.connection.NoConnectException e ) - { - // launch soffice - OfficeService aSOffice = new OfficeService(); - aSOffice.startupService(); - - // wait until soffice is started - long nMaxMillis = System.currentTimeMillis() + 1000*aSOffice.getStartupTime(); - while ( aInitialObject == null ) - { - try - { - // try to connect to soffice - Thread.currentThread().sleep( 500 ); - aInitialObject = xUrlResolver.resolve( mURL ); - } - catch( com.sun.star.connection.NoConnectException aEx ) - { - // soffice did not start in time - if ( System.currentTimeMillis() > nMaxMillis ) - throw aEx; - - } - } - } - finally - { - } - - // XComponentContext - if( null != aInitialObject ) - { - XPropertySet xPropertySet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, aInitialObject); - Object xContext = xPropertySet.getPropertyValue("DefaultContext"); - XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface( - XComponentContext.class, xContext); - return xComponentContext; - } - } - catch( com.sun.star.connection.NoConnectException e ) - { - System.out.println( "Couldn't connect to remote server" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.connection.ConnectionSetupException e ) - { - System.out.println( "Couldn't access necessary local resource to establish the interprocess connection" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - System.out.println( "uno-url is syntactical illegal ( " + mURL + " )" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.uno.RuntimeException e ) - { - System.out.println( "--- RuntimeException:" ); - System.out.println( e.getMessage() ); - e.printStackTrace(); - System.out.println( "--- end." ); - throw e; - } - catch( java.lang.Exception e ) - { - System.out.println( "java.lang.Exception: " ); - System.out.println( e ); - e.printStackTrace(); - System.out.println( "--- end." ); - throw new com.sun.star.uno.RuntimeException( e.toString() ); - } - - return null; - } - - /** - * Retrives a path to the office program folder. - * - * @return The path to the office program folder. - */ - private String getProgramPath() - { - if (mProgramPath == null) - { - // determine name of executable soffice - String aExec = OFFICE_APP_NAME; // default for UNIX - String aOS = System.getProperty("os.name"); - - // running on Windows? - if (aOS.startsWith("Windows")) - aExec = OFFICE_APP_NAME + ".exe"; - - // add other non-UNIX operating systems here - // ... - - // find soffice executable relative to this class's class loader: - File path = NativeLibraryLoader.getResource( - this.getClass().getClassLoader(), aExec); - if (path != null) { - mProgramPath = path.getParent(); - } - - // default is "" - if ( mProgramPath == null ) - mProgramPath = ""; - } - return mProgramPath; - } - - /** - * Parses a connection URL. - * This method accepts a UNO URL with following format:
- *
-     * url    := uno:localoffice[,<params>];urp;StarOffice.NamingService
-     * params := <path>[,<pipe>]
-     * path   := path=<pathv>
-     * pipe   := pipe=<pipev>
-     * pathv  := platform_specific_path_to_the_local_office_distribution
-     * pipev  := local_office_connection_pipe_name
-     * 
- * - *

Examples

- *
    - *
  • "uno:localoffice,pipe=xyz_Office,path=/opt/openoffice11/program;urp;StarOffice.ServiceManager"; - *
  • "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; - *
- * - * @param url This is UNO URL which describes the type of a connection. - * @exception java.net.MalformedURLException when inappropreate URL was - * provided. - */ - private void parseUnoUrlWithOfficePath(String url, String prefix) - throws java.net.MalformedURLException - { - // Extruct parameters. - int idx = url.indexOf(";urp;StarOffice.NamingService"); - if (idx < 0) - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - String params = url.substring(prefix.length(), idx + 1); - - // Parse parameters. - String name = null; - String path = null; - String pipe = null; - char ch; - int state = 0; - StringBuffer buffer = new StringBuffer(); - for(idx = 0; idx < params.length(); idx += 1) { - ch = params.charAt(idx); - switch (state) { - case 0: // initial state - switch(ch) { - case ',': - buffer.delete(0, buffer.length()); - state = 1; - break; - - case ';': - state = 7; - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 1; - break; - } - break; - - case 1: // parameter name - switch(ch) { - case ' ': - case '=': - name = buffer.toString(); - state = (ch == ' ')? 2: 3; - break; - - case ',': - case ';': - state = -6; // error: invalid name - break; - - default: - buffer.append(ch); - break; - } - break; - - case 2: // equal between the name and the value - switch(ch) { - case '=': - state = 3; - break; - - case ' ': - break; - - default: - state = -1; // error: missing '=' - break; - } - break; - - case 3: // value leading spaces - switch(ch) { - case ' ': - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 4; - break; - } - break; - - case 4: // value - switch(ch) { - case ' ': - case ',': - case ';': - idx -= 1; // put back the last read character - state = 5; - if (name.equals("path")) { - if (path == null) - path = buffer.toString(); - else - state = -3; // error: more then one 'path' - } else if (name.equals("pipe")) { - if (pipe == null) - pipe = buffer.toString(); - else - state = -4; // error: more then one 'pipe' - } else - state = -2; // error: unknown parameter - buffer.delete(0, buffer.length()); - break; - - default: - buffer.append(ch); - break; - } - break; - - case 5: // a delimeter after the value - switch(ch) { - case ' ': - break; - - case ',': - state = 6; - break; - - case ';': - state = 7; - break; - - default: - state = -5; // error: ' ' inside the value - break; - } - break; - - case 6: // leading spaces before next parameter name - switch(ch) { - case ' ': - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 1; - break; - } - break; - - default: - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - } - } - if (state != 7) - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - - // Set up the connection parameters. - if (path != null) - mProgramPath = path; - if (pipe != null) - mPipe = pipe; - } - - /* replaces each substring aSearch in aString by aReplace. - - StringBuffer.replaceAll() is not avaialable in Java 1.3.x. - */ - private static String replaceAll(String aString, String aSearch, String aReplace ) - { - StringBuffer aBuffer = new StringBuffer(aString); - - int nPos = aString.length(); - int nOfs = aSearch.length(); - - while ( ( nPos = aString.lastIndexOf( aSearch, nPos - 1 ) ) > -1 ) - aBuffer.replace( nPos, nPos+nOfs, aReplace ); - - return aBuffer.toString(); - } - - - /** creates a unique pipe name. - */ - static String getPipeName() - { - // turn user name into a URL and file system safe name (% chars will not work) - String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX; - aPipeName = replaceAll( aPipeName, "_", "%B7" ); - return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "\\+", "%20" ), "%", "_" ); - } - - /** - * @para This is an implementation of the native office service. - * @deprecated - */ - private class OfficeService - implements NativeService - { - /** - * Retrive the office service identifier. - * - * @return The identifier of the office service. - */ - public String getIdentifier() - { - if ( mPipe == null) - return getPipeName(); - else - return mPipe; - } - - /** - * Starts the office process. - */ - public void startupService() - throws java.io.IOException - { - // create call with arguments - String[] cmdArray = new String[4]; - cmdArray[0] = (new File(getProgramPath(), OFFICE_APP_NAME)).getPath(); - cmdArray[1] = "-nologo"; - cmdArray[2] = "-nodefault"; - if ( mConnType.equals( "pipe" ) ) - cmdArray[3] = "-accept=pipe,name=" + getIdentifier() + ";" + - mProtocol + ";" + mInitialObject; - else if ( mConnType.equals( "socket" ) ) - cmdArray[3] = "-accept=socket,port=" + mPort + ";urp"; - else - throw new java.io.IOException( "not connection specified" ); - - // start process - mProcess = Runtime.getRuntime().exec(cmdArray); - if ( mProcess == null ) - throw new RuntimeException( "cannot start soffice: " + cmdArray ); - } - - /** - * Retrives the ammount of time to wait for the startup. - * - * @return The ammount of time to wait in seconds(?). - */ - public int getStartupTime() - { - return 60; - } - } -} diff --git a/bean/com/sun/star/beans/LocalOfficeWindow.java b/bean/com/sun/star/beans/LocalOfficeWindow.java deleted file mode 100644 index d66066645..000000000 --- a/bean/com/sun/star/beans/LocalOfficeWindow.java +++ /dev/null @@ -1,309 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import java.awt.Component; - -import com.sun.star.lang.EventObject; -import com.sun.star.lang.SystemDependent; -import com.sun.star.lang.XEventListener; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.awt.Rectangle; -import com.sun.star.awt.XWindow; -import com.sun.star.awt.XWindowPeer; -import com.sun.star.awt.XVclWindowPeer; -import com.sun.star.awt.XToolkit; -import com.sun.star.awt.WindowDescriptor; -import com.sun.star.awt.WindowAttribute; -import com.sun.star.awt.WindowClass; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; - -/** - * This class represents a local office window. - * @deprecated - */ -public class LocalOfficeWindow - extends java.awt.Canvas - implements OfficeWindow, XEventListener -{ - private transient OfficeConnection mConnection; - private transient XWindowPeer mParentProxy; - private transient XWindowPeer mWindow; - private boolean bPeer = false; - - /** - * Construnctor. - * - * @param connection The office connection object the window - * belongs to. - */ - /* package */ LocalOfficeWindow(OfficeConnection connection) - { - mConnection = connection; - mConnection.addEventListener((XEventListener)this); - } - - /** - * Retrives an AWT component object associated with the OfficeWindow. - * - * @return The AWT component object associated with the OfficeWindow. - */ - public Component getAWTComponent() - { - return this; - } - - /** - * Retrives an UNO XWindowPeer object associated with the OfficeWindow. - * - * @return The UNO XWindowPeer object associated with the OfficeWindow. - */ - public XWindowPeer getUNOWindowPeer() - { - if (mWindow == null) - createUNOWindowPeer(); - return mWindow; - } - - /** - * Receives a notification about the connection has been closed. - * This method has to set the connection to null. - * - * @source The event object. - */ - public void disposing(EventObject source) - { - // the window will be disposed by the framework - mWindow = null; - mConnection = null; - } - - /** - * Returns an AWT toolkit. - */ - private XToolkit queryAWTToolkit() - throws com.sun.star.uno.Exception - { - // Create a UNO toolkit. - XMultiComponentFactory compfactory; - XComponentContext xContext = mConnection.getComponentContext(); - if ( xContext != null ) - { - compfactory = mConnection.getComponentContext().getServiceManager(); - XMultiServiceFactory factory; - factory = (XMultiServiceFactory)UnoRuntime.queryInterface( - XMultiServiceFactory.class, compfactory); - Object object = factory.createInstance( "com.sun.star.awt.Toolkit"); - return (XToolkit)UnoRuntime.queryInterface(XToolkit.class, object); - } - else - return null; - } - - /// called when system parent is available, reparents the bean window - private void aquireSystemWindow() - { - if ( !bPeer ) - { - // set real parent - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface( - XVclWindowPeer.class, mWindow); - xVclWindowPeer.setProperty( "PluginParent", new Long(getNativeWindow()) ); - bPeer = true; - - // show document window - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( true ); - } - } - - /// called when system parent is about to die, reparents the bean window - private void releaseSystemWindow() - { - if ( bPeer ) - { - // hide document window - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( false ); - - // set null parent - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface( - XVclWindowPeer.class, mWindow); - xVclWindowPeer.setProperty( "PluginParent", new Long(0) ); - bPeer = false; - } - } - - /// callback handler to get to know when we become visible - //@deprecated - class ComponentEventHandler - extends java.awt.event.ComponentAdapter - { - public void componentHidden( java.awt.event.ComponentEvent e) - { - // only when we become invisible, we might lose our system window - CallWatchThread aCallWatchThread = new CallWatchThread( 500 ); - setVisible(false); - try { aCallWatchThread.cancel(); } - catch ( java.lang.InterruptedException aExc ) - {} // ignore - } - - public void componentShown( java.awt.event.ComponentEvent e) - { - // only when we become visible, we get a system window - aquireSystemWindow(); - } - } - - /// Overriding java.awt.Component.setVisible() due to Java bug (no showing event). - public void setVisible( boolean b ) - { - super.setVisible(b); - - // Java-Bug: componentShown() is never called :-( - // is still at least in Java 1.4.1_02 - if ( b ) - aquireSystemWindow(); - else - releaseSystemWindow(); - } - - /** Factory method for a UNO AWT toolkit window as a child of this Java window. - * - */ - private XWindowPeer createUNOWindowPeer() - { - try - { - // get this windows native window type - int type = getNativeWindowSystemType(); - - // Java AWT windows only have a system window when showing. - XWindowPeer parentPeer; - if ( isShowing() ) - { - // create direct parent relationship - //setVisible( true ); - parentPeer = new JavaWindowPeerFake( getNativeWindow(), type); - bPeer = true; - } - else - { - // no parent yet - parentPeer = null; - bPeer = false; - } - - // create native window (mWindow) - Rectangle aRect = new Rectangle( 0, 0, 20, 20 ); - WindowDescriptor desc = new WindowDescriptor(); - desc.Type = WindowClass.TOP; - desc.Parent = parentPeer; - desc.Bounds = aRect; - desc.WindowServiceName = "workwindow"; - desc.WindowAttributes = (type == SystemDependent.SYSTEM_WIN32) - ? WindowAttribute.SHOW : 0; - mWindow = queryAWTToolkit().createWindow(desc); - - // to get notified when we become visible - addComponentListener( new ComponentEventHandler() ); - - // set initial visibility - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( bPeer ); - } - catch (com.sun.star.uno.Exception exp) { - } - - return mWindow; - } - - /** - * Retrives a platform dependant system window identifier. - * - * @return The system window identifier. - */ - private native long getNativeWindow(); - - /** - * Retrives a platform dependant system window type. - * - * @return The system window type. - */ - private native int getNativeWindowSystemType(); - - //--------------------------------------------------------------------------- - /** Helper class to watch calls into OOo with a timeout. - * @deprecated - */ - class CallWatchThread extends Thread - { - Thread aWatchedThread; - long nTimeout; - - CallWatchThread( long nTimeout ) - { - this.aWatchedThread = Thread.currentThread(); - this.nTimeout = nTimeout; - start(); - } - - void cancel() - throws java.lang.InterruptedException - { - Thread aThread = aWatchedThread; - aWatchedThread = null; - stop(); - - if ( aThread.interrupted() ) - throw new InterruptedException(); - } - - public void run() - { - while ( aWatchedThread != null ) - { - try { sleep( nTimeout ); } - catch ( java.lang.InterruptedException aExc ) - {} - - //synchronized - { - if ( aWatchedThread != null ) - { - aWatchedThread.interrupt(); - } - } - } - } - }; - -} diff --git a/bean/com/sun/star/beans/NativeConnection.java b/bean/com/sun/star/beans/NativeConnection.java deleted file mode 100644 index 786ffce4e..000000000 --- a/bean/com/sun/star/beans/NativeConnection.java +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import com.sun.star.connection.XConnection; -/* @deprecated - */ -/* package */ class NativeConnection - implements XConnection -{ - public native void connect(NativeService aNativeService) - throws com.sun.star.io.IOException; - - public native int read(/*OUT*/byte[][] aReadBytes, /*IN*/int nBytesToRead) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void write(/*IN*/byte[] aData) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void flush() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void close() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public synchronized String getDescription() - throws com.sun.star.uno.RuntimeException - { - return Description; - } - - private long NativeHandle; - private String Description; -} diff --git a/bean/com/sun/star/beans/NativeService.java b/bean/com/sun/star/beans/NativeService.java deleted file mode 100644 index 3a808b978..000000000 --- a/bean/com/sun/star/beans/NativeService.java +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -/* @deprecated - */ -/* package */ interface NativeService { - public String getIdentifier(); - public void startupService() throws java.io.IOException; - public int getStartupTime(); -} diff --git a/bean/com/sun/star/beans/OfficeConnection.java b/bean/com/sun/star/beans/OfficeConnection.java deleted file mode 100644 index 438f42277..000000000 --- a/bean/com/sun/star/beans/OfficeConnection.java +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import java.awt.Container; - -import com.sun.star.lang.XComponent; -import com.sun.star.uno.XComponentContext; - -/** - * This abstract class reprecents a connection to the office - * application. - * @deprecated - */ -public interface OfficeConnection - extends XComponent -{ - /** - * Sets a connection URL. - * - * @param url This is UNO URL which describes the type of a connection. - */ - void setUnoUrl(String url) - throws java.net.MalformedURLException; - - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - void setContainerFactory(ContainerFactory containerFactory); - - /** - * Retrives the UNO component context. - * Establishes a connection if necessary and initialises the - * UNO service manager if it has not already been initialised. - * - * @return The office UNO component context. - */ - XComponentContext getComponentContext(); - - /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * This method does not add add the office window to its container. - * - * @param container This is an AWT container. - * @return The office window instance. - */ - OfficeWindow createOfficeWindow(Container container); -} diff --git a/bean/com/sun/star/beans/OfficeWindow.java b/bean/com/sun/star/beans/OfficeWindow.java deleted file mode 100644 index f3efaedad..000000000 --- a/bean/com/sun/star/beans/OfficeWindow.java +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.beans; - -import java.awt.Component; - -import com.sun.star.awt.XWindowPeer; - -/** - * The concreate implementation of the OfficeWindow extends an - * approperate type of visual component (java.awt.Canvas for local - * and java.awt.Container for remote). - * @deprecated - */ -public interface OfficeWindow -{ - /** - * Retrives an AWT component object associated with the OfficeWindow. - * - * @return The AWT component object associated with the OfficeWindow. - */ - Component getAWTComponent(); - - /** - * Retrives an UNO XWindowPeer object associated with the OfficeWindow. - * - * @return The UNO XWindowPeer object associated with the OfficeWindow. - */ - XWindowPeer getUNOWindowPeer(); -} diff --git a/bean/com/sun/star/beans/makefile.mk b/bean/com/sun/star/beans/makefile.mk deleted file mode 100644 index 9fd82df51..000000000 --- a/bean/com/sun/star/beans/makefile.mk +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/..$/.. -PRJNAME = beans -TARGET = com_sun_star_beans -PACKAGE = com$/sun$/star$/beans - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk -.IF "$(L10N_framework)"=="" -.IF "$(OS)"=="MACOSX" - -dummy: - @echo "Nothing to build for OS $(OS)" - -.ELSE # "$(OS)"=="MACOSX" - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar - -# --- Sources -------------------------------------------------------- - -JAVAFILES= \ - ContainerFactory.java \ - JavaWindowPeerFake.java \ - LocalOfficeConnection.java \ - LocalOfficeWindow.java \ - NativeConnection.java \ - NativeService.java \ - OfficeConnection.java \ - OfficeWindow.java - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -.ENDIF - -# --- Targets ------------------------------------------------------ -.ENDIF # L10N_framework - -.INCLUDE : target.mk diff --git a/bean/com/sun/star/comp/beans/CallWatchThread.java b/bean/com/sun/star/comp/beans/CallWatchThread.java deleted file mode 100644 index b25868d21..000000000 --- a/bean/com/sun/star/comp/beans/CallWatchThread.java +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - - -//--------------------------------------------------------------------------- -/** Helper class to watch calls into OOo with a timeout. - */ -//Do not add the thread instances to a threadgroup. When testing the bean in -//an applet it turned out the the ThreadGroup was in an inconsistent state -//after navigating off the site that contains the applet and back to it. -//That was tested with a Sun JRE 1.4.2_06 -public class CallWatchThread extends Thread -{ - private static boolean DEBUG = false; - - private Thread aWatchedThread; - private String aTag; - private boolean bAlive; - private long nTimeout; - - public CallWatchThread(long nTimeout) - { - this(nTimeout, ""); - } - - public CallWatchThread( long nTimeout, String aTag ) - { - super(aTag); - this.aWatchedThread = Thread.currentThread(); - this.nTimeout = nTimeout; - - this.aTag = aTag; - setDaemon( true ); - dbgPrint( "CallWatchThread(" + this + ").start(" + aTag + ")" ); - start(); - } - - public void cancel() - throws java.lang.InterruptedException - { - dbgPrint( "CallWatchThread(" + this + ".cancel(" + aTag + ")" ); - if ( aWatchedThread != null && aWatchedThread != Thread.currentThread() ) - throw new RuntimeException( "wrong thread" ); - aWatchedThread = null; - if ( interrupted() ) - throw new InterruptedException(); - } - - public synchronized void restart() - throws java.lang.InterruptedException - { - dbgPrint( "CallWatchThread(" + this + ".restart(" + aTag + ")" ); - if ( aWatchedThread != null && aWatchedThread != Thread.currentThread() ) - throw new RuntimeException( "wrong thread" ); - bAlive = true; - if ( interrupted() ) - throw new InterruptedException(); - notify(); - } - - public void run() - { - dbgPrint( "CallWatchThread(" + this + ".run(" + aTag + ") ***** STARTED *****" ); - long n = 0; - while ( aWatchedThread != null ) - { - dbgPrint( "CallWatchThread(" + this + ").run(" + aTag + ") running #" + ++n ); - synchronized(this) - { - bAlive = false; - try - { - wait( nTimeout ); - } - catch ( java.lang.InterruptedException aExc ) - { - bAlive = false; - } - - // watched thread seems to be dead (not answering)? - if ( !bAlive && aWatchedThread != null ) - { - dbgPrint( "CallWatchThread(" + this + ").run(" + aTag + ") interrupting" ); - aWatchedThread.interrupt(); - aWatchedThread = null; - } - } - } - - dbgPrint( "CallWatchThread(" + this + ").run(" + aTag + ") terminated" ); - } - - private void dbgPrint( String aMessage ) - { - if (DEBUG) - System.err.println( "OOoBean: " + aMessage ); - } -} - - - - diff --git a/bean/com/sun/star/comp/beans/ContainerFactory.java b/bean/com/sun/star/comp/beans/ContainerFactory.java deleted file mode 100644 index f622ee329..000000000 --- a/bean/com/sun/star/comp/beans/ContainerFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import java.awt.Container; - -/** - * This interface reprecents an AWT container factory. - * - * @deprecated - * - */ - -public interface ContainerFactory -{ - /** - * Creates an AWT container. - * - * @return An AWT container. - */ - Container createContainer(); -} diff --git a/bean/com/sun/star/comp/beans/Controller.java b/bean/com/sun/star/comp/beans/Controller.java deleted file mode 100644 index 22e055630..000000000 --- a/bean/com/sun/star/comp/beans/Controller.java +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.UnoRuntime; - -/** Wrapper class for a com.sun.star.frame.XController. - * - * @since OOo 2.0.0 - */ -public class Controller - extends Wrapper - implements - com.sun.star.frame.XController -{ - private com.sun.star.frame.XController xController; - private com.sun.star.frame.XDispatchProvider xDispatchProvider; - - Controller( com.sun.star.frame.XController xController ) - { - super( xController ); - this.xController = xController; - xDispatchProvider = (com.sun.star.frame.XDispatchProvider) - UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class, - xController ); - } - - //============================================================== - // com.sun.star.frame.XController - //-------------------------------------------------------------- - - public void attachFrame( /*IN*/ com.sun.star.frame.XFrame xFrame ) - { - xController.attachFrame( xFrame ); - } - - public boolean attachModel( /*IN*/ com.sun.star.frame.XModel xModel ) - { - return xController.attachModel( xModel ); - } - - public boolean suspend( /*IN*/boolean bSuspend ) - { - return xController.suspend( bSuspend ); - } - - public java.lang.Object getViewData( ) - { - return xController.getViewData(); - } - - public void restoreViewData( /*IN*/java.lang.Object aData ) - { - xController.restoreViewData( aData ); - } - - public com.sun.star.frame.XModel getModel( ) - { - return xController.getModel(); - } - - public com.sun.star.frame.XFrame getFrame( ) - { - return xController.getFrame(); - } - - //============================================================== - // com.sun.star.frame.XDispatchProvider - //-------------------------------------------------------------- - - public com.sun.star.frame.XDispatch queryDispatch( - /*IN*/ com.sun.star.util.URL aURL, - /*IN*/ String aTargetFrameName, - /*IN*/ int nSearchFlags ) - { - return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags ); - } - - public com.sun.star.frame.XDispatch[] queryDispatches( - /*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests ) - { - return xDispatchProvider.queryDispatches( aRequests ); - } -} - diff --git a/bean/com/sun/star/comp/beans/Frame.java b/bean/com/sun/star/comp/beans/Frame.java deleted file mode 100644 index 28f95bd80..000000000 --- a/bean/com/sun/star/comp/beans/Frame.java +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.UnoRuntime; - -/** Wrapper class for a com.sun.star.frame.XFrame. - * - * @since OOo 2.0.0 - */ -public class Frame - extends Wrapper - implements - com.sun.star.frame.XFrame, - com.sun.star.frame.XDispatchProvider, - com.sun.star.frame.XDispatchProviderInterception -{ - private com.sun.star.frame.XFrame xFrame; - private com.sun.star.frame.XDispatchProvider xDispatchProvider; - private com.sun.star.frame.XDispatchProviderInterception xDispatchProviderInterception; - - public Frame( com.sun.star.frame.XFrame xFrame ) - { - super( xFrame ); - this.xFrame = xFrame; - xDispatchProvider = (com.sun.star.frame.XDispatchProvider) - UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class, - xFrame ); - xDispatchProviderInterception = (com.sun.star.frame.XDispatchProviderInterception) - UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProviderInterception.class, - xFrame ); - } - - //============================================================== - // com.sun.star.frame.XFrame - //-------------------------------------------------------------- - - public void initialize( /*IN*/com.sun.star.awt.XWindow xWindow ) - { - xFrame.initialize( xWindow ); - } - - public com.sun.star.awt.XWindow getContainerWindow( ) - { - return xFrame.getContainerWindow(); - } - - public void setCreator( /*IN*/ com.sun.star.frame.XFramesSupplier xCreator ) - { - xFrame.setCreator( xCreator ); - } - - public com.sun.star.frame.XFramesSupplier getCreator( ) - { - return xFrame.getCreator(); - } - - public String getName( ) - { - return xFrame.getName(); - } - - public void setName( /*IN*/ String aName ) - { - xFrame.setName( aName ); - } - - public com.sun.star.frame.XFrame findFrame( /*IN*/String aTargetFrameName, /*IN*/int nSearchFlags ) - { - return xFrame.findFrame( aTargetFrameName, nSearchFlags ); - } - - public boolean isTop( ) - { - return xFrame.isTop(); - } - - public void activate( ) - { - xFrame.activate(); - } - - public void deactivate( ) - { - xFrame.deactivate(); - } - - public boolean isActive( ) - { - return xFrame.isActive(); - } - - public boolean setComponent( /*IN*/com.sun.star.awt.XWindow xComponentWindow, /*IN*/ com.sun.star.frame.XController xController ) - { - return xFrame.setComponent( xComponentWindow, xController ); - } - - public com.sun.star.awt.XWindow getComponentWindow( ) - { - return xFrame.getComponentWindow(); - } - - public com.sun.star.frame.XController getController( ) - { - return xFrame.getController(); - } - - public void contextChanged( ) - { - xFrame.contextChanged(); - } - - public void addFrameActionListener( /*IN*/ com.sun.star.frame.XFrameActionListener xListener ) - { - xFrame.addFrameActionListener( xListener ); - } - - public void removeFrameActionListener( /*IN*/ com.sun.star.frame.XFrameActionListener xListener ) - { - xFrame.removeFrameActionListener( xListener ); - } - - //============================================================== - // com.sun.star.frame.XDispatchProvider - //-------------------------------------------------------------- - - public com.sun.star.frame.XDispatch queryDispatch( - /*IN*/ com.sun.star.util.URL aURL, - /*IN*/ String aTargetFrameName, - /*IN*/ int nSearchFlags ) - { - return xDispatchProvider.queryDispatch( aURL, aTargetFrameName, nSearchFlags ); - } - - public com.sun.star.frame.XDispatch[] queryDispatches( - /*IN*/ com.sun.star.frame.DispatchDescriptor[] aRequests ) - { - return xDispatchProvider.queryDispatches( aRequests ); - } - - //============================================================== - // com.sun.star.frame.XDispatchProviderInterception - //-------------------------------------------------------------- - - public void registerDispatchProviderInterceptor( - /*IN*/ com.sun.star.frame.XDispatchProviderInterceptor xInterceptor ) - { - xDispatchProviderInterception.registerDispatchProviderInterceptor( xInterceptor ); - } - - public void releaseDispatchProviderInterceptor( - /*IN*/ com.sun.star.frame.XDispatchProviderInterceptor xInterceptor ) - { - xDispatchProviderInterception.releaseDispatchProviderInterceptor( xInterceptor ); - } -}; - diff --git a/bean/com/sun/star/comp/beans/HasConnectionException.java b/bean/com/sun/star/comp/beans/HasConnectionException.java deleted file mode 100644 index d78b23cb7..000000000 --- a/bean/com/sun/star/comp/beans/HasConnectionException.java +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/** This exception is thrown when a method is called which - is only defined for not already having an established - connection. - - @since OOo 2.0.0 - */ -public class HasConnectionException extends Exception -{ -}; - - diff --git a/bean/com/sun/star/comp/beans/InvalidArgumentException.java b/bean/com/sun/star/comp/beans/InvalidArgumentException.java deleted file mode 100644 index 03e9eea8b..000000000 --- a/bean/com/sun/star/comp/beans/InvalidArgumentException.java +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/** indicates an invalid argument in a function call. - * - * @deprecated - */ -public class InvalidArgumentException extends Exception -{ -}; - - diff --git a/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java b/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java deleted file mode 100644 index 82ae588a3..000000000 --- a/bean/com/sun/star/comp/beans/JavaWindowPeerFake.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.*; -import com.sun.star.awt.*; - -/**

Class to pass the system window handle to the OpenOffice.org toolkit.

- * - * @since OOo 2.0.0 - */ -/* package */ class JavaWindowPeerFake - implements XSystemDependentWindowPeer, XWindowPeer -{ - protected int localSystemType; - protected Any wrappedHandle; - - /** Create the faked window peer. - * @param _hWindow the system handle to the window. - * @param _systemType specifies the system type. - */ - public JavaWindowPeerFake(Any _hWindow, int _systemType) - { - localSystemType = _systemType; - wrappedHandle = _hWindow; - } - - /**

Implementation of XSystemDependentWindowPeer (that's all we really need)

- * This method is called back from the OpenOffice.org toolkit to retrieve the system data. - */ - public Object getWindowHandle(/*IN*/byte[] ProcessId, /*IN*/short SystemType) - throws com.sun.star.uno.RuntimeException - { - if (SystemType == localSystemType) { - return wrappedHandle; - } - else return null; - } - - /** not really neaded. - */ - public XToolkit getToolkit() - throws com.sun.star.uno.RuntimeException - { - return null; - } - - /** not really neaded. - */ - public void setPointer(/*IN*/XPointer Pointer) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void setBackground(/*IN*/int Color) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void invalidate(/*IN*/short Flags) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void invalidateRect(/*IN*/com.sun.star.awt.Rectangle Rect, /*IN*/short Flags) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void dispose() - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void addEventListener(/*IN*/com.sun.star.lang.XEventListener xListener) - throws com.sun.star.uno.RuntimeException - { - } - - /** not really neaded. - */ - public void removeEventListener(/*IN*/com.sun.star.lang.XEventListener aListener) - throws com.sun.star.uno.RuntimeException - { - } -} - diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java deleted file mode 100644 index d398cf7c2..000000000 --- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java +++ /dev/null @@ -1,834 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import java.awt.Container; -import java.io.File; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XEventListener; -import com.sun.star.connection.XConnection; -import com.sun.star.connection.XConnector; -import com.sun.star.bridge.XBridge; -import com.sun.star.bridge.XBridgeFactory; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.Exception; -import com.sun.star.lib.uno.helper.UnoUrl; -import com.sun.star.lib.util.NativeLibraryLoader; - -/** - * This class reprecents a connection to the local office application. - * - * @since OOo 2.0.0 - */ -public class LocalOfficeConnection - implements OfficeConnection -{ - public static final String OFFICE_APP_NAME = "soffice"; - public static final String OFFICE_LIB_NAME = "officebean"; - public static final String OFFICE_ID_SUFFIX = "_Office"; - - private static String mProgramPath; - - private Process mProcess; - private ContainerFactory mContainerFactory; - private XComponentContext mContext; - private XBridge mBridge; - - private String mURL; - private String mConnType; - private String mPipe; - private String mPort; - private String mProtocol; - private String mInitialObject; - - private List mComponents = new Vector(); - - private static long m_nBridgeCounter = 0; - //------------------------------------------------------------------------- - static - { - // preload shared libraries whichs import lips are linked to officebean - if ( System.getProperty( "os.name" ).startsWith( "Windows" ) ) - { - try - { - NativeLibraryLoader.loadLibrary(LocalOfficeConnection.class.getClassLoader(), "msvcr70"); - } - catch (Throwable e) - { - // loading twice would fail - System.err.println( "cannot find msvcr70" ); - } - - try - { - NativeLibraryLoader.loadLibrary(LocalOfficeConnection.class.getClassLoader(), "msvcr71"); - } - catch (Throwable e) - { - // loading twice would fail - System.err.println( "cannot find msvcr71" ); - } - - try - { - NativeLibraryLoader.loadLibrary(LocalOfficeConnection.class.getClassLoader(), "uwinapi"); - } - catch (Throwable e) - { - // loading twice would fail - System.err.println( "cannot find uwinapi" ); - } - - try - { - NativeLibraryLoader.loadLibrary(LocalOfficeConnection.class.getClassLoader(), "jawt"); - } - catch (Throwable e) - { - // loading twice would fail - System.err.println( "cannot find jawt" ); - } - } - - // load shared library for JNI code - NativeLibraryLoader.loadLibrary( LocalOfficeConnection.class.getClassLoader(), "officebean" ); - } - - //------------------------------------------------------------------------- - // debugging method - private void dbgPrint( String aMessage ) - { - System.err.println( aMessage ); - } - - /** - * Constructor. - * Sets up paths to the office application and native libraries if - * values are available in OFFICE_PROP_FILE in the user - * home directory.
- * "com.sun.star.beans.path" - the office application directory;
- * "com.sun.star.beans.libpath" - native libraries directory. - */ - public LocalOfficeConnection() - { - // init member vars - try - { - setUnoUrl( "uno:pipe,name=" + getPipeName() + ";urp;StarOffice.ServiceManager" ); - } - catch ( java.net.MalformedURLException e ) - {} - } - - /** - * protected Constructor - * Initialise a LocalOfficeConnection with an already running office. - * This C'Tor is only used in complex tests at the moment. - * @param xContext - */ - protected LocalOfficeConnection(com.sun.star.uno.XComponentContext xContext) - { - this.mContext = xContext; - } - - /** - * Sets a connection URL. - * This implementation accepts a UNO URL with following format:
- *
-     * url    := uno:localoffice[,<params>];urp;StarOffice.ServiceManager
-     * params := <path>[,<pipe>]
-     * path   := path=<pathv>
-     * pipe   := pipe=<pipev>
-     * pathv  := platform_specific_path_to_the_local_office_distribution
-     * pipev  := local_office_connection_pipe_name
-     * 
- * - * @param url This is UNO URL which discribes the type of a connection. - */ - public void setUnoUrl(String url) - throws java.net.MalformedURLException - { - mURL = null; - - String prefix = "uno:localoffice"; - if ( url.startsWith(prefix) ) - parseUnoUrlWithOfficePath( url, prefix ); - else - { - try - { - UnoUrl aURL = UnoUrl.parseUnoUrl( url ); - mProgramPath = null; - mConnType = aURL.getConnection(); - mPipe = (String) aURL.getConnectionParameters().get( "pipe" ); - mPort = (String) aURL.getConnectionParameters().get( "port" ); - mProtocol = aURL.getProtocol(); - mInitialObject = aURL.getRootOid(); - } - catch ( com.sun.star.lang.IllegalArgumentException eIll ) - { - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - } - } - mURL = url; - } - - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - public void setContainerFactory(ContainerFactory containerFactory) - { - mContainerFactory = containerFactory; - } - - /** - * Retrives the UNO component context. - * Establishes a connection if necessary and initialises the - * UNO service manager if it has not already been initialised. - * This method can return null if it fails to connect - * to the office application. - * - * @return The office UNO component context. - */ - synchronized public XComponentContext getComponentContext() - { - if ( mContext == null ) - mContext = connect(); - return mContext; - } - - /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * @param container This is an AWT container. - * @return The office window instance. - */ - public OfficeWindow createOfficeWindow(Container container) - { - return new LocalOfficeWindow(this); - } - - /** - * Closes the connection. - */ - public void dispose() - { - Iterator itr = mComponents.iterator(); - while (itr.hasNext() == true) { - // ignore runtime exceptions in dispose - try { ((XEventListener)itr.next()).disposing(null); } - catch ( RuntimeException aExc ) {} - } - mComponents.clear(); - - //Terminate the bridge. It turned out that this is necessary for the bean - //to work properly when displayed in an applet within Internet Explorer. - //When navigating off the page which is showing the applet and then going - //back to it, then the Java remote bridge is damaged. That is the Java threads - //do not work properly anymore. Therefore when Applet.stop is called the connection - //to the office including the bridge needs to be terminated. - if (mBridge != null) - { - XComponent comp = (XComponent)UnoRuntime.queryInterface( - XComponent.class, mBridge); - if (comp != null) - comp.dispose(); - else - System.err.println("LocalOfficeConnection: could not dispose bridge!"); - - mBridge = null; - } - - mContainerFactory = null; - mContext = null; - } - - /** - * Adds an event listener to the object. - * - * @param listener is a listener object. - */ - public void addEventListener(XEventListener listener) - { - mComponents.add(listener); - } - - /** - * Removes an event listener from the listener list. - * - * @param listener is a listener object. - */ - public void removeEventListener(XEventListener listener) - { - mComponents.remove(listener); - } - - /** - * Establishes the connection to the office. - */ - private XComponentContext connect() - { - try - { - // create default local component context - XComponentContext xLocalContext = - com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null); - - // initial serviceManager - XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); - - // try to connect to soffice - Object aInitialObject = null; - try - { - aInitialObject = resolve(xLocalContext, mURL); - } - catch( com.sun.star.connection.NoConnectException e ) - { - // launch soffice - OfficeService aSOffice = new OfficeService(); - aSOffice.startupService(); - - // wait until soffice is started - long nMaxMillis = System.currentTimeMillis() + 1000*aSOffice.getStartupTime(); - while ( aInitialObject == null ) - { - try - { - // try to connect to soffice - Thread.currentThread().sleep( 500 ); - aInitialObject = resolve(xLocalContext, mURL); - } - catch( com.sun.star.connection.NoConnectException aEx ) - { - // soffice did not start in time - if ( System.currentTimeMillis() > nMaxMillis ) - throw aEx; - - } - } - } - finally - { - } - - // XComponentContext - if( null != aInitialObject ) - { - XPropertySet xPropertySet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, aInitialObject); - Object xContext = xPropertySet.getPropertyValue("DefaultContext"); - XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface( - XComponentContext.class, xContext); - return xComponentContext; - } - } - catch( com.sun.star.connection.NoConnectException e ) - { - System.out.println( "Couldn't connect to remote server" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.connection.ConnectionSetupException e ) - { - System.out.println( "Couldn't access necessary local resource to establish the interprocess connection" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - System.out.println( "uno-url is syntactical illegal ( " + mURL + " )" ); - System.out.println( e.getMessage() ); - } - catch( com.sun.star.uno.RuntimeException e ) - { - System.out.println( "--- RuntimeException:" ); - System.out.println( e.getMessage() ); - e.printStackTrace(); - System.out.println( "--- end." ); - throw e; - } - catch( java.lang.Exception e ) - { - System.out.println( "java.lang.Exception: " ); - System.out.println( e ); - e.printStackTrace(); - System.out.println( "--- end." ); - throw new com.sun.star.uno.RuntimeException( e.toString() ); - } - - return null; - } - - - //The function is copied and adapted from the UrlResolver.resolve. - //We cannot use the URLResolver because we need access to the bridge which has - //to be disposed when Applet.stop is called. - private Object resolve(XComponentContext xLocalContext, String dcp) - throws com.sun.star.connection.NoConnectException, - com.sun.star.connection.ConnectionSetupException, - com.sun.star.lang.IllegalArgumentException - { - String conDcp = null; - String protDcp = null; - String rootOid = null; - - if(dcp.indexOf(';') == -1) {// use old style - conDcp = dcp; - protDcp = "iiop"; - rootOid = "classic_uno"; - } - else { // new style - int index = dcp.indexOf(':'); - String url = dcp.substring(0, index).trim(); - dcp = dcp.substring(index + 1).trim(); - - index = dcp.indexOf(';'); - conDcp = dcp.substring(0, index).trim(); - dcp = dcp.substring(index + 1).trim(); - - index = dcp.indexOf(';'); - protDcp = dcp.substring(0, index).trim(); - dcp = dcp.substring(index + 1).trim(); - - rootOid = dcp.trim().trim(); - } - - Object rootObject = null; - XBridgeFactory xBridgeFactory= null; - - XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); - try { - xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface( - XBridgeFactory.class, - xLocalServiceManager.createInstanceWithContext( - "com.sun.star.bridge.BridgeFactory", xLocalContext)); - } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); - } - synchronized(this) { - if(mBridge == null) { - Object connector= null; - try { - connector = xLocalServiceManager.createInstanceWithContext( - "com.sun.star.connection.Connector", xLocalContext); - } catch (com.sun.star.uno.Exception e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); - } - XConnector connector_xConnector = (XConnector)UnoRuntime.queryInterface(XConnector.class, connector); - // connect to the server - XConnection xConnection = connector_xConnector.connect(conDcp); - // create the bridge name. This should not be necessary if we pass an - //empty string as bridge name into createBridge. Then we should always get - //a new bridge. This does not work because of (i51323). Therefore we - //create unique bridge names for the current process. - String sBridgeName = "OOoBean_private_bridge_" + String.valueOf(m_nBridgeCounter++); - try { - mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null); - } catch (com.sun.star.bridge.BridgeExistsException e) { - throw new com.sun.star.uno.RuntimeException(e.getMessage()); - } - } - rootObject = mBridge.getInstance(rootOid); - return rootObject; - } - } - - - /** - * Retrives a path to the office program folder. - * - * @return The path to the office program folder. - */ - static private String getProgramPath() - { - if (mProgramPath == null) - { - // determine name of executable soffice - String aExec = OFFICE_APP_NAME; // default for UNIX - String aOS = System.getProperty("os.name"); - - // running on Windows? - if (aOS.startsWith("Windows")) - aExec = OFFICE_APP_NAME + ".exe"; - - // add other non-UNIX operating systems here - // ... - - // find soffice executable relative to this class's class loader: - File path = NativeLibraryLoader.getResource( - LocalOfficeConnection.class.getClassLoader(), aExec); - if (path != null) - mProgramPath = path.getParent(); - - // default is "" - if ( mProgramPath == null ) - mProgramPath = ""; - } - return mProgramPath; - } - - /** - * Parses a connection URL. - * This method accepts a UNO URL with following format:
- *
-     * url    := uno:localoffice[,<params>];urp;StarOffice.NamingService
-     * params := <path>[,<pipe>]
-     * path   := path=<pathv>
-     * pipe   := pipe=<pipev>
-     * pathv  := platform_specific_path_to_the_local_office_distribution
-     * pipev  := local_office_connection_pipe_name
-     * 
- * - *

Examples

- *
    - *
  • "uno:localoffice,pipe=xyz_Office,path=/opt/openoffice11/program;urp;StarOffice.ServiceManager"; - *
  • "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; - *
- * - * @param url This is UNO URL which describes the type of a connection. - * @exception java.net.MalformedURLException when inappropreate URL was - * provided. - */ - private void parseUnoUrlWithOfficePath(String url, String prefix) - throws java.net.MalformedURLException - { - // Extruct parameters. - int idx = url.indexOf(";urp;StarOffice.NamingService"); - if (idx < 0) - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - String params = url.substring(prefix.length(), idx + 1); - - // Parse parameters. - String name = null; - String path = null; - String pipe = null; - char ch; - int state = 0; - StringBuffer buffer = new StringBuffer(); - for(idx = 0; idx < params.length(); idx += 1) { - ch = params.charAt(idx); - switch (state) { - case 0: // initial state - switch(ch) { - case ',': - buffer.delete(0, buffer.length()); - state = 1; - break; - - case ';': - state = 7; - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 1; - break; - } - break; - - case 1: // parameter name - switch(ch) { - case ' ': - case '=': - name = buffer.toString(); - state = (ch == ' ')? 2: 3; - break; - - case ',': - case ';': - state = -6; // error: invalid name - break; - - default: - buffer.append(ch); - break; - } - break; - - case 2: // equal between the name and the value - switch(ch) { - case '=': - state = 3; - break; - - case ' ': - break; - - default: - state = -1; // error: missing '=' - break; - } - break; - - case 3: // value leading spaces - switch(ch) { - case ' ': - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 4; - break; - } - break; - - case 4: // value - switch(ch) { - case ' ': - case ',': - case ';': - idx -= 1; // put back the last read character - state = 5; - if (name.equals("path")) { - if (path == null) - path = buffer.toString(); - else - state = -3; // error: more then one 'path' - } else if (name.equals("pipe")) { - if (pipe == null) - pipe = buffer.toString(); - else - state = -4; // error: more then one 'pipe' - } else - state = -2; // error: unknown parameter - buffer.delete(0, buffer.length()); - break; - - default: - buffer.append(ch); - break; - } - break; - - case 5: // a delimeter after the value - switch(ch) { - case ' ': - break; - - case ',': - state = 6; - break; - - case ';': - state = 7; - break; - - default: - state = -5; // error: ' ' inside the value - break; - } - break; - - case 6: // leading spaces before next parameter name - switch(ch) { - case ' ': - break; - - default: - buffer.delete(0, buffer.length()); - buffer.append(ch); - state = 1; - break; - } - break; - - default: - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - } - } - if (state != 7) - throw new java.net.MalformedURLException( - "Invalid UNO connection URL."); - - // Set up the connection parameters. - if (path != null) - mProgramPath = path; - if (pipe != null) - mPipe = pipe; - } - - /* replaces each substring aSearch in aString by aReplace. - - StringBuffer.replaceAll() is not avaialable in Java 1.3.x. - */ - private static String replaceAll(String aString, String aSearch, String aReplace ) - { - StringBuffer aBuffer = new StringBuffer(aString); - - int nPos = aString.length(); - int nOfs = aSearch.length(); - - while ( ( nPos = aString.lastIndexOf( aSearch, nPos - 1 ) ) > -1 ) - aBuffer.replace( nPos, nPos+nOfs, aReplace ); - - return aBuffer.toString(); - } - - - /** creates a unique pipe name. - */ - static String getPipeName() - { - // turn user name into a URL and file system safe name (% chars will not work) - String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX; - aPipeName = replaceAll( aPipeName, "_", "%B7" ); - return replaceAll( replaceAll( java.net.URLEncoder.encode(aPipeName), "+", "%20" ), "%", "_" ); - } - - /** - * @para This is an implementation of the native office service. - */ - private class OfficeService - implements NativeService - { - /** - * Retrive the office service identifier. - * - * @return The identifier of the office service. - */ - public String getIdentifier() - { - if ( mPipe == null) - return getPipeName(); - else - return mPipe; - } - - /** - * Starts the office process. - */ - public void startupService() - throws java.io.IOException - { - int nSizeCmdArray = 4; - String sOption = null; - //examine if user specified command-line options in system properties. - //We may offer later a more sophisticated way of providing options if - //the need arises. Currently this is intended to ease the pain during - //development with pre-release builds of OOo where one wants to start - //OOo with the -norestore options. The value of the property is simple - //passed on to the Runtime.exec call. - try { - sOption = System.getProperty("com.sun.star.officebean.Options"); - if (sOption != null) - nSizeCmdArray ++; - } catch (java.lang.SecurityException e) - { - e.printStackTrace(); - } - // create call with arguments - String[] cmdArray = new String[nSizeCmdArray]; - - // read UNO_PATH environment variable to get path to soffice binary - String unoPath = System.getenv("UNO_PATH"); - if (unoPath == null) - throw new java.io.IOException( "UNO_PATH environment variable is not set (required system path to the office program directory)" ); - -// cmdArray[0] = (new File(getProgramPath(), OFFICE_APP_NAME)).getPath(); - cmdArray[0] = (new File(unoPath, OFFICE_APP_NAME)).getPath(); - cmdArray[1] = "-nologo"; - cmdArray[2] = "-nodefault"; - if ( mConnType.equals( "pipe" ) ) - cmdArray[3] = "-accept=pipe,name=" + getIdentifier() + ";" + - mProtocol + ";" + mInitialObject; - else if ( mConnType.equals( "socket" ) ) - cmdArray[3] = "-accept=socket,port=" + mPort + ";urp"; - else - throw new java.io.IOException( "not connection specified" ); - - if (sOption != null) - cmdArray[4] = sOption; - - // start process - mProcess = Runtime.getRuntime().exec(cmdArray); - if ( mProcess == null ) - throw new RuntimeException( "cannot start soffice: " + cmdArray ); - new StreamProcessor(mProcess.getInputStream(), System.out); - new StreamProcessor(mProcess.getErrorStream(), System.err); - } - - /** - * Retrives the ammount of time to wait for the startup. - * - * @return The ammount of time to wait in seconds(?). - */ - public int getStartupTime() - { - return 60; - } - } - - - - class StreamProcessor extends Thread - { - java.io.InputStream m_in; - java.io.PrintStream m_print; - - public StreamProcessor(final java.io.InputStream in, final java.io.PrintStream out) - { - m_in = in; - m_print = out; - start(); - } - - public void run() { - java.io.BufferedReader r = new java.io.BufferedReader( - new java.io.InputStreamReader(m_in) ); - try { - for ( ; ; ) { - String s = r.readLine(); - if ( s == null ) { - break; - } - m_print.println(s); - } - } catch ( java.io.IOException e ) { - e.printStackTrace( System.err ); - } - } - } - -} diff --git a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java b/bean/com/sun/star/comp/beans/LocalOfficeWindow.java deleted file mode 100644 index b99f83c0c..000000000 --- a/bean/com/sun/star/comp/beans/LocalOfficeWindow.java +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import java.awt.Component; - -import com.sun.star.lang.EventObject; -import com.sun.star.lang.SystemDependent; -import com.sun.star.lang.XEventListener; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.awt.Rectangle; -import com.sun.star.awt.XWindow; -import com.sun.star.awt.XWindowPeer; -import com.sun.star.awt.XVclWindowPeer; -import com.sun.star.awt.XToolkit; -import com.sun.star.awt.WindowDescriptor; -import com.sun.star.awt.WindowAttribute; -import com.sun.star.awt.WindowClass; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Any; -import com.sun.star.uno.Type; -import com.sun.star.beans.NamedValue; - -/** - * This class represents a local office window. - * - * @since OOo 2.0.0 - */ -public class LocalOfficeWindow - extends java.awt.Canvas - implements OfficeWindow, XEventListener -{ - private transient OfficeConnection mConnection; - private transient XWindowPeer mParentProxy; - private transient XWindowPeer mWindow; - private boolean bPeer = false; - - /** - * Construnctor. - * - * @param connection The office connection object the window - * belongs to. - */ - protected LocalOfficeWindow(OfficeConnection connection) - { - mConnection = connection; - mConnection.addEventListener((XEventListener)this); - } - - /** - * Retrives an AWT component object associated with the OfficeWindow. - * - * @return The AWT component object associated with the OfficeWindow. - */ - public Component getAWTComponent() - { - return this; - } - - /** - * Retrives an UNO XWindowPeer object associated with the OfficeWindow. - * - * @return The UNO XWindowPeer object associated with the OfficeWindow. - */ - public XWindowPeer getUNOWindowPeer() - { - if (mWindow == null) - createUNOWindowPeer(); - return mWindow; - } - - /** - * Receives a notification about the connection has been closed. - * This method has to set the connection to null. - * - * @source The event object. - */ - public void disposing(EventObject source) - { - // the window will be disposed by the framework - mWindow = null; - mConnection = null; - } - - /** - * Returns an AWT toolkit. - */ - private XToolkit queryAWTToolkit() - throws com.sun.star.uno.Exception - { - // Create a UNO toolkit. - XMultiComponentFactory compfactory; - XComponentContext xContext = mConnection.getComponentContext(); - if ( xContext != null ) - { - compfactory = mConnection.getComponentContext().getServiceManager(); - XMultiServiceFactory factory; - factory = (XMultiServiceFactory)UnoRuntime.queryInterface( - XMultiServiceFactory.class, compfactory); - Object object = factory.createInstance( "com.sun.star.awt.Toolkit"); - return (XToolkit)UnoRuntime.queryInterface(XToolkit.class, object); - } - else - return null; - } - - /// called when system parent is available, reparents the bean window - private synchronized void aquireSystemWindow() - { - if ( !bPeer ) - { - // set real parent - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface( - XVclWindowPeer.class, mWindow); - - xVclWindowPeer.setProperty( "PluginParent", getWrappedWindowHandle()); - bPeer = true; - // show document window - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( true ); - } - } - - /// called when system parent is about to die, reparents the bean window - private synchronized void releaseSystemWindow() - { - if ( bPeer ) - { - // hide document window - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( false ); - - // set null parent - XVclWindowPeer xVclWindowPeer = (XVclWindowPeer)UnoRuntime.queryInterface( - XVclWindowPeer.class, mWindow); - xVclWindowPeer.setProperty( "PluginParent", new Long(0) ); - bPeer = false; - } - } - - - /// Overriding java.awt.Component.setVisible() due to Java bug (no showing event). - public void setVisible( boolean b ) - { - super.setVisible(b); - - // Java-Bug: componentShown() is never called :-( - // is still at least in Java 1.4.1_02 - if ( b ) - aquireSystemWindow(); - else - releaseSystemWindow(); - } - - /** Factory method for a UNO AWT toolkit window as a child of this Java window. - * - */ - private synchronized XWindowPeer createUNOWindowPeer() - { - try - { - // get this windows native window type - int type = getNativeWindowSystemType(); - - // Java AWT windows only have a system window when showing. - XWindowPeer parentPeer; - if ( isShowing() ) - { - // create direct parent relationship - //setVisible( true ); - parentPeer = new JavaWindowPeerFake(getWrappedWindowHandle(), type); - bPeer = true; - } - else - { - // no parent yet - parentPeer = null; - bPeer = false; - } - - // create native window (mWindow) - Rectangle aRect = new Rectangle( 0, 0, 20, 20 ); - WindowDescriptor desc = new WindowDescriptor(); - desc.Type = WindowClass.TOP; - desc.Parent = parentPeer; - desc.Bounds = aRect; - desc.WindowServiceName = "workwindow"; - desc.WindowAttributes = (type == SystemDependent.SYSTEM_WIN32) - ? WindowAttribute.SHOW : 0; - mWindow = queryAWTToolkit().createWindow(desc); - - - // set initial visibility - XWindow aWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, mWindow); - aWindow.setVisible( bPeer ); - } - catch (com.sun.star.uno.Exception exp) { - } - - return mWindow; - } - /** We make sure that the office window is notified that the parent - * will be removed. - */ - public void removeNotify() - { - try { - releaseSystemWindow(); - } catch (java.lang.Exception e) { - System.err.println("LocaleOfficeWindow.removeNotify: Exception in releaseSystemWindow."); - System.err.println(e.getMessage()); - e.printStackTrace(System.err); - } - super.removeNotify(); - } - - /** - * Retrives a platform dependant system window identifier. - * - * @return The system window identifier. - */ - private native long getNativeWindow(); - - /** - * Retrives a platform dependant system window type. - * - * @return The system window type. - */ - private native int getNativeWindowSystemType(); - - /** - Returns an Any containing a sequences of com.sun.star.beans.NamedValue. One NamedValue - contains the name "WINDOW" and the value is a Long representing the window handle. - The second NamedValue has the name "XEMBED" and the value is true, when the XEmbed - protocol shall be used fore embedding the native Window. - */ - protected Any getWrappedWindowHandle() - { - - NamedValue window = new NamedValue( - "WINDOW", new Any(new Type(Long.class), new Long(getNativeWindow()))); - NamedValue xembed = new NamedValue( - "XEMBED", new Any(new Type(Boolean.class), new Boolean(false))); - - if (getNativeWindowSystemType() == SystemDependent.SYSTEM_XWINDOW ) - { - String vendor = System.getProperty("java.vendor"); - if (vendor.equals("Sun Microsystems Inc.") - && Boolean.valueOf(System.getProperty("sun.awt.xembedserver")).booleanValue()) - { - xembed = new NamedValue( - "XEMBED", - new Any(new Type(Boolean.class), new Boolean(true))); - } - } - return new Any( - new Type("[]com.sun.star.beans.NamedValue"), - new NamedValue[] {window, xembed}); - } - -} diff --git a/bean/com/sun/star/comp/beans/NativeConnection.java b/bean/com/sun/star/comp/beans/NativeConnection.java deleted file mode 100644 index d418d81f9..000000000 --- a/bean/com/sun/star/comp/beans/NativeConnection.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.connection.XConnection; - -/* Connection to a locally running OOo instance. - * - * @deprecated. - */ -/* package */ class NativeConnection - implements XConnection -{ - public native void connect(NativeService aNativeService) - throws com.sun.star.io.IOException; - - public native int read(/*OUT*/byte[][] aReadBytes, /*IN*/int nBytesToRead) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void write(/*IN*/byte[] aData) - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void flush() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public native void close() - throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException; - - public synchronized String getDescription() - throws com.sun.star.uno.RuntimeException - { - return Description; - } - - private long NativeHandle; - private String Description; -} diff --git a/bean/com/sun/star/comp/beans/NativeService.java b/bean/com/sun/star/comp/beans/NativeService.java deleted file mode 100644 index b8faec55e..000000000 --- a/bean/com/sun/star/comp/beans/NativeService.java +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/* - * @deprecated - */ -/* package */ interface NativeService { - public String getIdentifier(); - public void startupService() throws java.io.IOException; - public int getStartupTime(); -} diff --git a/bean/com/sun/star/comp/beans/NoConnectionException.java b/bean/com/sun/star/comp/beans/NoConnectionException.java deleted file mode 100644 index c62c003d9..000000000 --- a/bean/com/sun/star/comp/beans/NoConnectionException.java +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/** This exception is called when a method is called which - needs an established connection but no connection is - established yet or anymore. - - @since OOo 2.0.0 - */ -public class NoConnectionException extends Exception -{ -}; - - diff --git a/bean/com/sun/star/comp/beans/NoDocumentException.java b/bean/com/sun/star/comp/beans/NoDocumentException.java deleted file mode 100644 index cc73453bf..000000000 --- a/bean/com/sun/star/comp/beans/NoDocumentException.java +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/** indicates that an operation needed a document, but no document was loaded. - - @since OOo 2.0.0 - */ -public class NoDocumentException extends Exception -{ -}; - - diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java deleted file mode 100644 index a9f79228b..000000000 --- a/bean/com/sun/star/comp/beans/OOoBean.java +++ /dev/null @@ -1,1518 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.UnoRuntime; - -// @requirement FUNC.PERF.LRN/0.6 -// @requirement FUNC.PERF.LOC/0.6 -// @requirement FUNC.PERF.FIX/0.6 -/** This is the basic JavaBean for all OOo application modules. - - @requirement FUNC.RES.OTH/0.2 - No other resources are needed yet. - - @since OOo 2.0.0 - */ -public class OOoBean - - // @requirement FUNC.BEAN.VIEW/0.4 - extends java.awt.Container - - implements - // @requirement FUNC.PER/0.2 - java.io.Externalizable -{ - // timeout values (milli secs) - int nOOoStartTimeOut = 60000; - int nOOoCallTimeOut = 3000; - int nOOoCheckCycle = 1000; - - // This member contains the connection to an OOo instance if established. - private transient OfficeConnection iConnection; - private transient EventListener xConnectionListener; - - // @requirement FUNC.BEAN.VIEW/0.4 - // @requirement FUNC.BEAN.EDIT/0.4 - // This member contains the OOo window - // if a connection is established. - // It is a child of the OOoBean canvas. - private OfficeWindow xFrameWindow; - - // application environment - private transient com.sun.star.lang.XMultiServiceFactory xServiceFactory; - private transient com.sun.star.frame.XDesktop xDesktop; - - // document and frame - private transient Frame aFrame; - private transient Controller aController; - private transient OfficeDocument aDocument; - - // slot command execution environment - private transient com.sun.star.frame.XDispatchProvider xDispatcher; - private transient com.sun.star.util.XURLTransformer xURLTransformer; - - // properties - private boolean bIgnoreVisibility = false; // to show even if already visible - private boolean bMenuBarVisible = true; - private boolean bStandardBarVisible = true; - private boolean bToolBarVisible = true; - private boolean bStatusBarVisible = true; - - - // debugging method - private void dbgPrint( String aMessage ) - { - // System.err.println( "OOoBean: " + aMessage ); - } - - // @requirement FUNC.PER/0.2 - /** @internal - * @deprecated - */ - public void writeExternal( java.io.ObjectOutput aObjOut ) - { - // TBD - } - - // @requirement FUNC.PER/0.2 - /** @internal - * @deprecated - */ - public void readExternal( java.io.ObjectInput aObjIn ) - { - // TBD - } - - /** Generic constructor of the OOoBean. - - Neither a connection is established nor any document loaded. - */ - public OOoBean() - {} - - // @requirement FUNC.CON.MULT/0.3 - /** Constructor for an OOoBean which uses a specific office connection. - - The connection must be established but no document is loaded. - - @throws NoConnectionException - if the connection is not established. - - @deprecated Clients could use the getOOoConnection to obtain an OfficeConnection - and use it as argument in a constructor for another OOoBean instance. Calling - the dispose method of the OfficeConnection or the OOoBean's stopOOoConnection - method would make all instances of OOoBean stop working. - */ - public OOoBean( OfficeConnection iConnection ) - throws NoConnectionException - { - try { setOOoConnection( iConnection ); } - catch ( HasConnectionException aExc ) - { /* impossible here */ } - } - - /** Sets the timeout for methods which launch OOo in milli seconds. - - This method does not need a connection to an OOo instance. - */ - public void setOOoStartTimeOut( int nMilliSecs ) - { - nOOoStartTimeOut = nMilliSecs; - } - - /** Sets the timeout for normal OOO methods calls in milli seconds. - - This method does not need a connection to an OOo instance. - */ - public void setOOoCallTimeOut( int nMilliSecs ) - { - nOOoCallTimeOut = nMilliSecs; - } - - /** Sets the period length in milli seconds to check the OOo connection. - - This method does not need a connection to an OOo instance. - */ - public void setOOoCheckCycle( int nMilliSecs ) - { - nOOoCheckCycle = nMilliSecs; - } - - /** Sets the a connection to an OOo instance. - - @internal - */ - private synchronized void setOOoConnection( OfficeConnection iNewConnection ) - throws HasConnectionException, NoConnectionException - { - // the connection cannot be exchanged - if ( iConnection != null ) - throw new HasConnectionException(); - - // is there a real connection, not just the proxy? - com.sun.star.uno.XComponentContext xComponentContext = null; - try { xComponentContext = iNewConnection.getComponentContext(); } - catch ( java.lang.Throwable aExc ) - { throw new NoConnectionException(); } - if ( xComponentContext == null ) - throw new NoConnectionException(); - - // set the connection - iConnection = iNewConnection; - - // get notified when connection dies - if ( xConnectionListener != null ) - xConnectionListener.end(); - xConnectionListener = this.new EventListener("setOOoConnection"); - } - - // @requirement FUNC.CON.STRT/0.4 - /** Starts a connection to an OOo instance which is lauched if not running. - - @throws HasConnectionException - if a connection was already established. - - @throws NoConnectionException - if the specified connection cannot be established - */ - public void startOOoConnection( String aConnectionURL ) - throws java.net.MalformedURLException, - HasConnectionException, - NoConnectionException - { - // create a new connection from the given connection URL - LocalOfficeConnection aConnection = new LocalOfficeConnection(); - aConnection.setUnoUrl( aConnectionURL ); - setOOoConnection( aConnection ); - } - - // @requirement FUNC.CON.CHK/0.7 - /** Returns true if this OOoBean is connected to an OOo instance, - false otherwise. - - @deprecated This method is not useful in a multithreaded environment. Then - all threads accessing the instance would have to be synchronized in order to - make is method work. It is better - to call OOoBean's methods and be prepared to catch a NoConnectionException. - */ - public boolean isOOoConnected() - { - return iConnection != null; - } - - // @requirement FUNC.CON.STOP/0.4 - /** Disconnects from the connected OOo instance. - - If there was no connection yet or anymore, this method can be called - anyway. - - When the OOoBean is displayed in an applet by a web browser, then this - method must be called from within java.applet.Applet.stop. - */ - public synchronized void stopOOoConnection() - { - // clear OOo document, frame etc. - clear(); - - // cut the connection - OfficeConnection iExConnection = iConnection; - if ( iConnection != null ) - { - if ( xConnectionListener != null ) - { - xConnectionListener.end(); - } - iConnection = null; - iExConnection.dispose(); - } - - } - - // @requirement FUNC.CON.STOP/0.4 (via XComponent.dispose()) - // @requirement FUNC.CON.NTFY/0.4 (via XComponent.addEventListener()) - /** Returns the a connection to an OOo instance. - - If no connection exists, a default connection will be created. An OfficeConnection - can be used to register listeners of type com.sun.star.lang.EventListener, - which are notified when the connection to the - office dies. One should not call the dispose method, because this may result - in receiving com.sun.star.lang.DisposedExceptions when calling - {@link #stopOOoConnection stopOOoConnection} or other API methods. If other instances share the - same connection then they will stop function properly, because they loose their - connection as well. The recommended way to end the connection is - calling {@link #stopOOoConnection stopOOoConnection}. - - @throws NoConnectionException - if no connection can be established - - */ - public synchronized OfficeConnection getOOoConnection() - throws NoConnectionException - { - if ( iConnection == null ) - { - try { setOOoConnection( new LocalOfficeConnection() ); } - catch ( HasConnectionException aExc ) - { /* impossible here */ } - } - if ( iConnection.getComponentContext() == null ) - throw new NoConnectionException(); - return iConnection; - } - - /** Returns the service factory used by this OOoBean instance. - - @throws NoConnectionException - if no connection is established and no default connection can be established. - */ - public synchronized com.sun.star.lang.XMultiServiceFactory getMultiServiceFactory() - throws NoConnectionException - { - if ( xServiceFactory == null ) - { - // avoid concurrent access from multiple threads - final OfficeConnection iConn = getOOoConnection(); - - Thread aConnectorThread = new Thread() { - public void run() - { - com.sun.star.lang.XMultiComponentFactory aFactory = - iConn.getComponentContext().getServiceManager(); - xServiceFactory = (com.sun.star.lang.XMultiServiceFactory) - UnoRuntime.queryInterface( - com.sun.star.lang.XMultiServiceFactory.class, aFactory ); - } - }; - aConnectorThread.start(); - try { aConnectorThread.join(nOOoStartTimeOut); } - catch ( java.lang.InterruptedException aExc ) - { throw new NoConnectionException(); } - if ( xServiceFactory == null ) - throw new NoConnectionException(); - } - - return xServiceFactory; - } - - /** Returns the XDesktop interface of the OOo instance used by this OOoBean. - - @throws NoConnectionException - if no connection is established and no default connection can be established. - */ - public synchronized com.sun.star.frame.XDesktop getOOoDesktop() - throws NoConnectionException - { - if ( xDesktop == null ) - { - try - { - Object aObject = getMultiServiceFactory().createInstance( "com.sun.star.frame.Desktop"); - xDesktop = (com.sun.star.frame.XDesktop) UnoRuntime.queryInterface( - com.sun.star.frame.XDesktop.class, aObject ); - } - catch ( com.sun.star.uno.Exception aExc ) - {} // TBD: what if no connection exists? - } - - return xDesktop; - } - - /** Resets this bean to an empty document. - - If a document is loaded and the content modified, - the changes are dismissed. Otherwise nothing happens. - - This method is intended to be overridden in derived classes. - This implementation simply calls clear. - - @param bClearStateToo - Not only the document content but also the state of the bean, - like visibility of child components is cleared. - - @deprecated There is currently no way to dismiss changes, except for loading - of the unchanged initial document. Furthermore it is unclear how derived classes - handle this and what exactly their state is (e.g. what members make up their state). - Calling this method on a derived class requires knowledge about their implementation. - Therefore a deriving class should declare their own clearDocument if needed. Clients - should call the clearDocument of the deriving class or {@link #clear} which discards - the currently displayed document. - */ - public synchronized void clearDocument( boolean bClearStateToo ) - throws - com.sun.star.util.CloseVetoException, - NoConnectionException - { - // TBD - clear(); - } - - /** Resets the OOoBean to an empty status. - - Any loaded document is unloaded, no matter whether it is modified or not. - After calling this method, the OOoBean has no office document and no frame - anymore. The connection will stay, though. - - This method works with or without an established connection. - */ - public synchronized void clear() - { - dbgPrint( "clear()" ); - - try - { - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "clear" ); - //By closing the frame we avoid that dialogs are displayed, for example when - //the document is modified. - com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable) - UnoRuntime.queryInterface( com.sun.star.util.XCloseable.class, aFrame ); - if ( xCloseable != null ) - { - try - { - xCloseable.close(true); - } - catch (com.sun.star.util.CloseVetoException exc) - { // a print job may be running - } - } - - aDocument = null; - xDispatcher = null; - aFrame = null; - - // clear xFrameWindow - if ( xFrameWindow != null ) - { - try { releaseSystemWindow(); } - catch ( NoConnectionException aExc ) - {} // ignore - catch ( SystemWindowException aExc ) - {} // ignore - remove( xFrameWindow.getAWTComponent() ); - xFrameWindow = null; - } - - // clear xURTTransformer - if ( xURLTransformer != null ) - { - try - { - com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent) - UnoRuntime.queryInterface( - com.sun.star.lang.XComponent.class, xURLTransformer ); - if ( xComp != null ) - xComp.dispose(); - } - catch ( java.lang.Throwable aExc ) - {} // ignore - xURLTransformer = null; - } - - xDesktop = null; - xServiceFactory = null; - - aCallWatchThread.cancel(); - } - catch ( java.lang.InterruptedException aExc ) - { /* can be ignored */ } - } - - // @requirement FUNC.PAR.LWP/0.4 - /** This method causes the office window to be displayed. - - If no document is loaded and the instance is added to a Java container that - is showing, then this method needs not to be called. If later one of the methods - {@link #loadFromURL loadFromURL}, {@link #loadFromStream loadFromStream1}, - or {@link #loadFromByteArray loadFromByteArray} - is called, then the document is automatically displayed. - - Should one of the load methods have been called before the Java container - was showing, then this method needs to be called after the container window - was made visible (java.lang.Component.setVisible(true)). -

- Another scenario is that a OOoBean contains a document and is removed - from a Java container and later added again. Then aquireSystemWindow needs - to be called after the container window is displayed. - - @throws SystemWindowException - if no system window can be aquired. - - @throws NoConnectionException - if the connection is not established. - */ - public synchronized void aquireSystemWindow() - throws - SystemWindowException, - - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException - { - if ( iConnection == null ) - throw new NoConnectionException(); - if ( !isShowing() ) - throw new SystemWindowException(); - - if ( xFrameWindow != null ) - xFrameWindow.getAWTComponent().setVisible(true); - doLayout(); - } - - // @requirement FUNC.PAR.RWL/0.4 - // @estimation 16h - /** This method must be called when the OOoBean before the - sytem window may be released by it's parent AWT/Swing component. - - This is the case when java.awt.Component.isDisplayable() returns - true. This is definitely the case when the OOoBean is removed - from it's parent container. - - @throws SystemWindowException - if system window is not aquired. - - @throws NoConnectionException - if the connection is not established. - - @deprecated When Component.removeNotify of the parent window of the actual - office window is called, then the actions are performed for which this method - needed to be called previously. - */ - public synchronized void releaseSystemWindow() - throws - SystemWindowException, - - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException - { - if ( iConnection == null ) - throw new NoConnectionException(); - - try { xFrameWindow.getAWTComponent().setVisible(false); } - catch ( com.sun.star.lang.DisposedException aExc ) - { throw new NoConnectionException(); } - } - - // @requirement FUNC.BEAN.LOAD/0.4 - // @requirement FUNC.CON.AUTO/0.3 - /** Loads the bean from the given URL. - - If a document is already loaded and the content modified, - the changes are dismissed. - - If no connection exists, a default connection is established. - - @throws IllegalArgumentException - if either of the arguments is out of the specified range. - - @throws java.io.IOException - if an IO error occurs reading the ressource specified by the URL. - - @throws com.sun.star.lang.NoConnectionException - if no connection can be established. - - @throws com.sun.star.util.CloseVetoException - if the currently displayed document cannot be closed because it is - still be used, for example it is printed. - */ - public void loadFromURL( - final String aURL, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - com.sun.star.util.CloseVetoException - { - dbgPrint( "loadFromURL()" ); - // try loading - try - { - boolean bLoaded = false; - while ( !bLoaded ) - { - // watch loading in a thread with a timeout (if OOo hangs) - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoStartTimeOut, "loadFromURL" ); - - try - { - // get window from OOo on demand - if ( xFrameWindow == null ) - { - // Establish the connection by request of the ServiceFactory. - getMultiServiceFactory(); - - // remove existing child windows - removeAll(); - - // Create the OfficeWindow. - xFrameWindow = getOOoConnection().createOfficeWindow(OOoBean.this); - add( xFrameWindow.getAWTComponent() ); - } - - // create the document frame from UNO window. - if ( aFrame == null ) - { - // create the frame - com.sun.star.awt.XWindow xWindow = - (com.sun.star.awt.XWindow) UnoRuntime.queryInterface( - com.sun.star.awt.XWindow.class, xFrameWindow.getUNOWindowPeer()); - Object xFrame = xServiceFactory.createInstance( "com.sun.star.frame.Frame"); - aFrame = new Frame( (com.sun.star.frame.XFrame)UnoRuntime.queryInterface( - com.sun.star.frame.XFrame.class, xFrame ) ); - aFrame.initialize( xWindow ); - aFrame.setName( aFrame.toString() ); - - // register the frame at the desktop - com.sun.star.frame.XFrames xFrames = - ( (com.sun.star.frame.XFramesSupplier)UnoRuntime.queryInterface( - com.sun.star.frame.XFramesSupplier.class, getOOoDesktop() ) ).getFrames(); - xFrames.append( aFrame ); - } - - // Initializes the slot command execution environment. - xURLTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( - com.sun.star.util.XURLTransformer.class, - xServiceFactory.createInstance( "com.sun.star.util.URLTransformer") ); - - try - { - xDispatcher = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class, aFrame); - } - catch (Exception e) - { - /*ignore!*/ - } - - // get XComponentLoader from frame - com.sun.star.frame.XComponentLoader xLoader = (com.sun.star.frame.XComponentLoader) - UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, aFrame ); - if ( xLoader == null ) - { - throw new java.lang.RuntimeException( - "com.sun.star.frame.Frame(" + aFrame + - ") without com.sun.star.frame.XComponentLoader" ); - } - - // Avoid Dialog 'Document changed' while reloading - if ( aDocument != null ) - { - try { - aDocument.setModified(false); - } catch (com.sun.star.beans.PropertyVetoException ep) { - //it dosn't make sense to throw the exception here. The interface does not - //offer a way to add/remove respective listeners. - } catch (com.sun.star.lang.DisposedException ed) { - // can be disposed if user closed document via UI - } - - com.sun.star.frame.XController xOldController = null; - if ( aFrame != null ) - xOldController = aFrame.getController(); - - try - { - - if ( aFrame != null && xOldController != null ) - if (xOldController.suspend(true) == false) - throw new com.sun.star.util.CloseVetoException( - "Dokument is still being used and cannot be closed.", this); - - } - catch (java.lang.IllegalStateException exp) - {} - } - - // load the document. - com.sun.star.beans.PropertyValue aArgs[] = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "MacroExecutionMode", -1, - new Short( com.sun.star.document.MacroExecMode.USE_CONFIG ), - com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - //String fn = aFRame.getName(); - - com.sun.star.lang.XComponent xComponent = xLoader.loadComponentFromURL( - aURL, /*aFrame.getName()*/"_self", 0, aArgs ); - - // nothing loaded? - if ( xComponent == null && aDocument != null ) - { - // reactivate old document - if ( aFrame != null && aFrame.getController() != null ) - aFrame.getController().suspend(false); - aDocument.setModified(true); - - // throw exception - throw new java.io.IOException( - "Can not load a document: \"" + aURL + "\""); - } - // mDocumentURL = aURL; TBD: still needed? - - // Get document's XModifiable interface if any. - aDocument = new OfficeDocument( - (com.sun.star.frame.XModel) UnoRuntime.queryInterface( - com.sun.star.frame.XModel.class, xComponent ) ); - bLoaded = true; - } - catch ( NoConnectionException aExc ) - { - // stop, clear and retry - stopOOoConnection(); - } - catch ( com.sun.star.lang.DisposedException aExc ) - { - // stop, clear and retry - stopOOoConnection(); - } - catch ( com.sun.star.uno.Exception aExc ) - { - // TDB: handling failure in createInstance - aExc.printStackTrace(); - throw new java.io.IOException(); - } - - aCallWatchThread.cancel(); - if ( xServiceFactory == null ) - throw new NoConnectionException(); - } - if ( iConnection == null ) - { - throw new NoConnectionException(); - } - - applyToolVisibilities(); - } - catch ( java.lang.InterruptedException aExc ) - { - throw new NoConnectionException(); - } - } - - /** Loads a document from a Java stream. - - See loadFromURL() for further information. - */ - public void loadFromStream( - final java.io.InputStream iInStream, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - com.sun.star.util.CloseVetoException - { - // wrap Java stream into UNO stream - /* - com.sun.star.io.XInputStream xStream = - new com.sun.star.lib.uno.adapter.InputStreamToXInputStreamAdapter( - iInStream ); - */ - // copy stream.... - - int s = 4096; - int r=0 ,n = 0; - byte[] buffer = new byte[s]; - byte[] newBuffer = null; - while ((r = iInStream.read(buffer, n, buffer.length-n))>0) { - n += r; - if (iInStream.available() > buffer.length - n) { - newBuffer = new byte[buffer.length*2]; - System.arraycopy(buffer, 0, newBuffer, 0, n); - buffer = newBuffer; - } - } - if (buffer.length != n) { - newBuffer = new byte[n]; - System.arraycopy(buffer, 0, newBuffer, 0, n); - buffer = newBuffer; - } - com.sun.star.io.XInputStream xStream = - new com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter(buffer); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal load method - loadFromURL( "private:stream", aExtendedArguments ); - } - - /** Loads a document from a byte array. - - See loadFromURL() for further information. - */ - public void loadFromByteArray( - final byte aInBuffer[], - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - com.sun.star.util.CloseVetoException - { - // wrap byte arrray into UNO stream - com.sun.star.io.XInputStream xStream = - new com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter( - aInBuffer ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "InputStream", -1, xStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal load method - loadFromURL( "private:stream", aExtendedArguments ); - } - - /** Stores a document to the given URL. -

- Due due a bug (50651) calling this method may cause the office to crash, - when at the same time the office writes a backup of the document. This bug - also affects {@link #storeToByteArray storeToByteArray} and - {@link #storeToStream storeToStream}. The workaround - is to start the office with the option -norestore, which disables the automatic - backup and recovery mechanism. OOoBean offers currently no supported way of providing - startup options for OOo. But it is possible to set a Java property when starting - Java, which is examined by OOoBean: -

-            java -Dcom.sun.star.officebean.Options=-norestore  ...
-        
- It is planned to offer a way of specifying startup options in a future version. - The property can be used until then. When using this property only one option - can be provided. - - @throws IllegalArgumentException - if either of the arguments is out of the specified range. - - @throws java.io.IOException - if an IO error occurs reading the ressource specified by the URL. - - @throws com.sun.star.lang.NoConnectionException - if no connection is established. - - @throws NoDocumentException - if no document is loaded - */ - public void storeToURL( - final String aURL, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException, - NoDocumentException - { - // no document available? - if ( aDocument == null ) - throw new NoDocumentException(); - - try - { - // start runtime timeout - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "storeToURL" ); - - // store the document - try { aDocument.storeToURL( aURL, aArguments ); } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - - // end runtime timeout - aCallWatchThread.cancel(); - } - catch ( java.lang.InterruptedException aExc ) - { throw new NoConnectionException(); } - } - - /** Stores a document to a stream. - - See {@link #storeToURL storeToURL} for further information. - @see #storeToURL storeToURL - */ - public java.io.OutputStream storeToStream( - java.io.OutputStream aOutStream, - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - NoDocumentException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException - - { - // wrap Java stream into UNO stream - com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter aStream = - new com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter( - aOutStream ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal store method - storeToURL( "private:stream", aExtendedArguments ); - - // get byte array from document stream - try { aStream.closeOutput(); } - catch ( com.sun.star.io.NotConnectedException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.BufferSizeExceededException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - return aOutStream; - } - - /** Stores a document to a byte array. - - See {@link #storeToURL storeToURL} for further information. - @see #storeToURL storeToURL - */ - public byte[] storeToByteArray( - byte aOutBuffer[], - final com.sun.star.beans.PropertyValue aArguments[] ) - throws - // @requirement FUNC.CON.LOST/0.2 - NoConnectionException, - NoDocumentException, - java.io.IOException, - com.sun.star.lang.IllegalArgumentException - { - // wrap byte arrray into UNO stream - com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter aStream = - new com.sun.star.lib.uno.adapter.XOutputStreamToByteArrayAdapter( - aOutBuffer ); - - // add stream to arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - addArgument( aArguments, new com.sun.star.beans.PropertyValue( - "OutputStream", -1, aStream, com.sun.star.beans.PropertyState.DIRECT_VALUE ) ); - - // call normal store method - storeToURL( "private:stream", aExtendedArguments ); - - // get byte array from document stream - try { aStream.closeOutput(); } - catch ( com.sun.star.io.NotConnectedException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.BufferSizeExceededException aExc ) - { /* TDB */ } - catch ( com.sun.star.io.IOException aExc ) - { throw new java.io.IOException(); } - return aStream.getBuffer(); - } - - // @requirement FUNC.BEAN.PROG/0.5 - // @requirement API.SIM.SEAP/0.2 - /** returns the Frame - of the bean. - - @returns - a Java class which implements all interfaces which the service - Frame implements. - Thus, methods can be called directly without queryInterface. - This feature might be implemented by UNO or explicitely coded. - - @throws NoConnectionException - if the connection is not established. - - @throws NotDocumentException - if no document is loaded an thus no frame is available. - */ - public Frame getFrame() - - throws - NoConnectionException // @requirement FUNC.CON.LOST/0.2 - { - if ( iConnection == null ) - throw new NoConnectionException(); - return aFrame; - } - - // @requirement FUNC.BEAN.PROG/0.5 - // @requirement API.SIM.SEAP/0.2 - /** returns the of the bean. - - @returns - a Java class which implements all interfaces which the service - Controller implements. - Thus, methods can be called directly without queryInterface. - This feature might be implemented by UNO or explicitely coded. - - @throws NoConnectionException - if the connection is not established. - */ - public Controller getController() - - // @requirement FUNC.CON.LOST/0.2 - throws NoConnectionException - { - if ( iConnection == null ) - throw new NoConnectionException(); - if ( aController == null ) - aController = new Controller( aFrame.getController() ); - return aController; - } - - // @requirement FUNC.BEAN.PROG/0.5 - // @requirement FUNC.BEAN.STOR/0.4 - // @requirement FUNC.BEAN.PRNT/0.4 - // @requirement API.SIM.SEAP/0.2 - /** returns the - of the bean. - - @returns - a Java class which implements all interfaces which the service - OfficeDocument - implements. - Thus, methods can be called directly without queryInterface. - This feature might be implemented by UNO or explicitely coded. - - @throws NoConnectionException - if the connection is not established. - */ - public OfficeDocument getDocument() - - // @requirement FUNC.CON.LOST/0.2 - throws NoConnectionException - { - if ( iConnection == null ) - throw new NoConnectionException(); - return aDocument; - } - - /** Sets visibility of all tool bars known by this OOoBean version. - - Initially all tool bars are visible. By hiding all tool bars - utilizing this method, it is possible to turn just a subset of - tool bars on afterwards, no matter whether all available tool - bars are known or not. -

- If an older OOoBean instance is used with a newer OOo instance, - some tool bars might not be affected by this method. -

- If no connection is established or no document is loaded, - the setting is memorized until a document is loaded. Same - is valid when the connection dies within this function call. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. For example: -

-com.sun.star.beans.XPropertySet xPropSet = 
-  (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(
-    com.sun.star.beans.XPropertySet.class, aFrame );
-com.sun.star.frame.XLayoutManager xLayoutManager = 
-  (com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface(
-    com.sun.star.frame.XLayoutManager.class, 
-    xPropSet.getPropertyValue( "LayoutManager" ) );
-xLayoutManager.showElement("private:resource/menubar/menubar");
-        
- */ - public void setAllBarsVisible( boolean bVisible ) - { - bIgnoreVisibility = true; - setMenuBarVisible( bVisible ); - setStandardBarVisible( bVisible ); - setToolBarVisible( bVisible ); - setStatusBarVisible( bVisible ); - bIgnoreVisibility = false; - } - - //-------------------------------------------------------------------------- - /** Applies all tool visiblities to the real thing. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible setAllBarsVisible}. - */ - protected void applyToolVisibilities() - throws - java.lang.InterruptedException - { - bIgnoreVisibility = true; - setMenuBarVisible( bMenuBarVisible ); - setStandardBarVisible( bStandardBarVisible ); - setToolBarVisible( bToolBarVisible ); - setStatusBarVisible( bStatusBarVisible ); - bIgnoreVisibility = false; - } - - /** Helper method to set tool bar visibilty. - - @param bnewValue - If false, the tool bar is disabled, - If true, the tool bar is visible. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - protected boolean setToolVisible( String aProperty, String aResourceURL, - boolean bOldValue, boolean bNewValue ) - - throws - java.lang.InterruptedException - { - // start runtime timeout - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "setToolVisible" ); - - // Does a frame exist? - if ( aFrame != null ) - { - if ( bIgnoreVisibility || bOldValue != bNewValue ) - { - try - { - com.sun.star.beans.XPropertySet xPropSet = - (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface( - com.sun.star.beans.XPropertySet.class, aFrame ); - com.sun.star.frame.XLayoutManager xLayoutManager = - (com.sun.star.frame.XLayoutManager) UnoRuntime.queryInterface( - com.sun.star.frame.XLayoutManager.class, - xPropSet.getPropertyValue( "LayoutManager" ) ); - if ( bNewValue ) - xLayoutManager.showElement( aResourceURL ); - else - xLayoutManager.hideElement( aResourceURL ); - } - catch ( com.sun.star.beans.UnknownPropertyException aExc ) - { - throw new RuntimeException( "not layout manager found" ); - } - catch ( com.sun.star.lang.WrappedTargetException aExc ) - { - throw new RuntimeException( "not layout manager found" ); - } - - // notify change - firePropertyChange( aProperty, new Boolean(bOldValue), new Boolean(bNewValue) ); - } - } - - // end runtime timeout - aCallWatchThread.cancel(); - - // the new value will be stored by caller - return bNewValue; - } - - /** Sets the visibility of the menu bar. - - Initially the menu bar is visible. -

- If not connected or no document loaded, the value is stored - and automatically applied to the document after it is loaded. - Same is valid when the connection dies within this function call. - - @param bVisible - If false, the menu bar is disabled, - If true, the menu bar is visible. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public void setMenuBarVisible(boolean bVisible) - { - try - { - bMenuBarVisible = setToolVisible( "MenuBarVisible", - "private:resource/menubar/menubar", bMenuBarVisible, bVisible ); - } - catch ( java.lang.InterruptedException aExc ) - { - bMenuBarVisible = bVisible; - } - } - - /** Returns the visibility of the menu bar. - - This method works independently from a connetion or loaded document. - If no connection is established or no document is loaded, - this method just returns a memorized status. - - @return - True if the menu bar is visible, - false if the menu bar is hidden. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public boolean isMenuBarVisible() - { - return bMenuBarVisible; - } - - /** Sets the main function bar visibilty. - - Initially the standard bar is visible. - - If not connected or no document loaded, the value is stored - and automatically applied to the document after it is loaded. - Same is valid when the connection dies within this function call. - - @param bVisible - If false, the main function bar is disabled, - If true, the main function bar is visible. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public void setStandardBarVisible(boolean bVisible) - { - try - { - bStandardBarVisible = setToolVisible( "StandardBarVisible", - "private:resource/toolbar/standardbar", bStandardBarVisible, bVisible ); - } - catch ( java.lang.InterruptedException aExc ) - { - bMenuBarVisible = bVisible; - } - } - - /** Returns the visibility of the main function bar. - - This method works independently from a connetion or loaded document. - If no connection is established or no document is loaded, - this method just returns a memorized status. - - @return - True if the main function bar is visible, - false if the main function bar is hidden. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public boolean isStandardBarVisible() - { - return bStandardBarVisible; - } - - /** Sets the tool function bar visibilty. - - Initially the tool bar is visible. - - If not connected or no document loaded, the value is stored - and automatically applied to the document after it is loaded. - Same is valid when the connection dies within this function call. - - @param bVisible - If false, the tool function bar is disabled, - If true, the tool function bar is visible. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public void setToolBarVisible(boolean bVisible) - { - try - { - bToolBarVisible = setToolVisible( "ToolBarVisible", - "private:resource/toolbar/toolbar", bToolBarVisible, bVisible ); - } - catch ( java.lang.InterruptedException aExc ) - { - bMenuBarVisible = bVisible; - } - } - - /** Returns the visibility of the tool function bar. - - This method works independently from a connetion or loaded document. - If no connection is established or no document is loaded, - this method just returns a memorized status. - - @return - True if the tool function bar is visible, - false if the tool function bar is hidden. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public boolean isToolBarVisible() - { - return bToolBarVisible; - } - - /** Sets the status function bar visibilty. - - Initially the status bar is visible. - - If not connected or no document loaded, the value is stored - and automatically applied to the document after it is loaded. - Same is valid when the connection dies within this function call. - - @param bVisible - If false, the status function bar is disabled, - If true, the status function bar is visible. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public void setStatusBarVisible(boolean bVisible) - { - try - { - bStatusBarVisible = setToolVisible( "StatusBarVisible", - "private:resource/statusbar/statusbar", bStatusBarVisible, bVisible ); - } - catch ( java.lang.InterruptedException aExc ) - { - bMenuBarVisible = bVisible; - } - } - - /** Returns the visibility of the status function bar. - - This method works independently from a connetion or loaded document. - If no connection is established or no document is loaded, - this method just returns a memorized status. - - @return - True if the status function bar is visible, - false if the status function bar is hidden. - - @deprecated Clients should use the service com.sun.star.frame.LayoutManager, - which can be obtained from a frame, to control toolbars. See also - {@link #setAllBarsVisible}. - */ - public boolean isStatusBarVisible() - { - return bStatusBarVisible; - } - - //=========================================================================== - // Helper Methods / Internal Methods - //--------------------------------------------------------------------------- - - // general instance intializer - { - setLayout(new java.awt.BorderLayout()); - } - - /** - @deprecated - */ - public void paint( java.awt.Graphics aGraphics ) - { - } - - /** Adds a single argument to an array of arguments. - - If the argument by its name is already in aArguments - it is exchanged and aArguments is returned. -

- If the argument by its name is not yet in aArguments, - a new array is created, aArgument added and the new - array returned. - */ - protected com.sun.star.beans.PropertyValue[] addArgument( - com.sun.star.beans.PropertyValue aArguments[], - final com.sun.star.beans.PropertyValue aArgument ) - { - // get number of current arguments - int nNumArgs = 0; - if ( aArguments != null ) - nNumArgs = aArguments.length; - - // is new argument already set? - for ( int n = 0; n < nNumArgs; ++n ) - { - if ( aArguments[n].Name == aArgument.Name ) - { - // substitute this argument - aArguments[n] = aArgument; - - // return current array - return aArguments; - } - } - - // create extended arguments - com.sun.star.beans.PropertyValue[] aExtendedArguments = - new com.sun.star.beans.PropertyValue[ nNumArgs + 1 ]; - - // copy current arguments - for ( int n = 0; n < nNumArgs; ++n ) - aExtendedArguments[n] = aArguments[n]; - - // add new argument - aExtendedArguments[ nNumArgs ] = aArgument; - - // return new arguments - return aExtendedArguments; - } - - //=========================================================================== - // Helper Classes - //--------------------------------------------------------------------------- - - /** Helper class to listen on the connection to learn when it dies. - - @internal - */ - private class EventListener - extends Thread - implements - com.sun.star.lang.XEventListener, - com.sun.star.frame.XTerminateListener - { - String aTag; - - EventListener( String aTag ) - throws NoConnectionException - { - // init members - this.aTag = aTag; - - // listen on a dying connection - iConnection.addEventListener( this ); - - // listen on a terminating OOo - getOOoDesktop().addTerminateListener( this ); - - // start this thread as a daemon - setDaemon( true ); - start(); - } - - public void end() - { - // do not listen on a dying connection anymore - try { - iConnection.removeEventListener( this ); - } - catch ( Throwable aExc ) {}; - - // do not listen on a terminating OOo anymore - try { - getOOoDesktop().removeTerminateListener( this ); - } - catch ( Throwable aExc ) {}; - - // stop thread - this.interrupt(); - } - - /// gets called when the connection dies - public void disposing( /*IN*/ com.sun.star.lang.EventObject Source ) - { - // empty the OOoBean and cut the connection - stopOOoConnection(); - } - - /// gets called when the user wants to terminate OOo - public void queryTermination( /*IN*/ com.sun.star.lang.EventObject Event ) - throws com.sun.star.frame.TerminationVetoException - { - // disallow termination of OOo while a OOoBean exists - throw new com.sun.star.frame.TerminationVetoException(); - } - - /// gets called when OOo terminates - public void notifyTermination( /*IN*/ com.sun.star.lang.EventObject Event ) - { - // empty the OOoBean and cut the connection - stopOOoConnection(); - } - - /// watching the connection - public void run() - { - dbgPrint( "EventListener(" + aTag + ").run()" ); - - // remote call might hang => watch try - CallWatchThread aCallWatchThread = - new CallWatchThread( nOOoCallTimeOut, "EventListener(" + aTag + ")" ); - - // continue to trying to connect the OOo instance - long n = 0; - while ( isInterrupted() == false - && iConnection != null - && iConnection.getComponentContext() != null ) - { - dbgPrint( "EventListener(" + aTag + ").running() #" + ++n ); - - // still alive? - com.sun.star.lang.XMultiComponentFactory xServiceManager = null; - try - { - // an arbitrary (but cheap) call into OOo - xServiceManager = iConnection.getComponentContext().getServiceManager(); - - // call successfully performed, restart watch for next loop - try - { - aCallWatchThread.restart(); - } - catch ( java.lang.InterruptedException aExc ) - { - // ignore late interrupt - } - } - catch ( java.lang.RuntimeException aExc ) - { - // hung - OfficeConnection iDeadConn = iConnection; - iConnection = null; - iDeadConn.dispose(); - } - - // sleep - try { - sleep(nOOoCheckCycle); - } - catch ( java.lang.InterruptedException aExc ) - { - dbgPrint("EventListener(" + aTag + ") interupted."); - //thread can be ended by EvendListener.end(); - break; - } - } - } - } - -} - - - diff --git a/bean/com/sun/star/comp/beans/OfficeConnection.java b/bean/com/sun/star/comp/beans/OfficeConnection.java deleted file mode 100644 index 85f480b9d..000000000 --- a/bean/com/sun/star/comp/beans/OfficeConnection.java +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import java.awt.Container; - -import com.sun.star.lang.XComponent; -import com.sun.star.uno.XComponentContext; - -/** - * This abstract class reprecents a connection to the office - * application. - - @deprecated - */ -public interface OfficeConnection - extends XComponent -{ - /** - * Sets a connection URL. - * - * @param url This is UNO URL which describes the type of a connection. - */ - void setUnoUrl(String url) - throws java.net.MalformedURLException; - - /** - * Sets an AWT container catory. - * - * @param containerFactory This is a application provided AWT container - * factory. - */ - void setContainerFactory(ContainerFactory containerFactory); - - /** - * Retrives the UNO component context. - * Establishes a connection if necessary and initialises the - * UNO service manager if it has not already been initialised. - * - * @return The office UNO component context. - */ - XComponentContext getComponentContext(); - - /** - * Creates an office window. - * The window is either a sub-class of java.awt.Canvas (local) or - * java.awt.Container (RVP). - * - * This method does not add add the office window to its container. - * - * @param container This is an AWT container. - * @return The office window instance. - */ - OfficeWindow createOfficeWindow(Container container); -} diff --git a/bean/com/sun/star/comp/beans/OfficeDocument.java b/bean/com/sun/star/comp/beans/OfficeDocument.java deleted file mode 100644 index 41676d1fd..000000000 --- a/bean/com/sun/star/comp/beans/OfficeDocument.java +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.UnoRuntime; - -//========================================================================== -/** Wrapper class for service OfficeDocument which emulates the upcoming - mode of automatic runtime Java classes to get rid of the need for - queryInterface. - - See further information on the wrapping and compatibility limitations - in the base class Wrapper. - - @since OOo 2.0.0 - */ -public class OfficeDocument extends Wrapper - implements - com.sun.star.frame.XModel, - com.sun.star.util.XModifiable, - com.sun.star.frame.XStorable, - com.sun.star.view.XPrintable -{ - private com.sun.star.frame.XModel xModel; - private com.sun.star.util.XModifiable xModifiable; - private com.sun.star.view.XPrintable xPrintable; - private com.sun.star.frame.XStorable xStorable; - - public OfficeDocument( com.sun.star.frame.XModel xModel ) - { - super( xModel ); - - this.xModel = xModel; - this.xModifiable = (com.sun.star.util.XModifiable) - UnoRuntime.queryInterface( - com.sun.star.util.XModifiable.class, xModel ); - this.xPrintable = (com.sun.star.view.XPrintable) - UnoRuntime.queryInterface( - com.sun.star.view.XPrintable.class, xModel ); - this.xStorable = (com.sun.star.frame.XStorable) - UnoRuntime.queryInterface( - com.sun.star.frame.XStorable.class, xModel ); - } - - //========================================================== - // com.sun.star.frame.XModel - //---------------------------------------------------------- - - public boolean attachResource( /*IN*/String aURL, - /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) - { - return xModel.attachResource( aURL, aArguments ); - } - - public String getURL( ) - { - return xModel.getURL(); - } - - public com.sun.star.beans.PropertyValue[] getArgs( ) - { - return xModel.getArgs(); - } - - public void connectController( - /*IN*/ com.sun.star.frame.XController xController ) - { - xModel.connectController( xController ); - } - - public void disconnectController( - /*IN*/ com.sun.star.frame.XController xController ) - { - xModel.disconnectController( xController ); - } - - public void lockControllers( ) - { - xModel.lockControllers(); - } - - public void unlockControllers( ) - { - xModel.unlockControllers(); - } - - public boolean hasControllersLocked( ) - { - return xModel.hasControllersLocked(); - } - - public com.sun.star.frame.XController getCurrentController( ) - { - return xModel.getCurrentController(); - } - - public void setCurrentController( - /*IN*/ com.sun.star.frame.XController xController ) - throws com.sun.star.container.NoSuchElementException - { - xModel.setCurrentController( xController ); - } - - public java.lang.Object getCurrentSelection( ) - { - return xModel.getCurrentSelection(); - } - - //========================================================== - // com.sun.star.util.XModifyBroadcaster - //---------------------------------------------------------- - - public void addModifyListener( - /*IN*/ com.sun.star.util.XModifyListener xListener ) - { - xModifiable.addModifyListener( xListener ); - } - - public void removeModifyListener( - /*IN*/ com.sun.star.util.XModifyListener xListener ) - { - xModifiable.removeModifyListener( xListener ); - } - - //========================================================== - // com.sun.star.util.XModifiable - //---------------------------------------------------------- - - public boolean isModified( ) - { - return xModifiable.isModified(); - } - - public void setModified( /*IN*/boolean bModified ) - throws com.sun.star.beans.PropertyVetoException - { - xModifiable.setModified( bModified ); - } - - //========================================================== - // com.sun.star.view.XPrintable - //---------------------------------------------------------- - - public com.sun.star.beans.PropertyValue[] getPrinter( ) - { - return xPrintable.getPrinter(); - } - - public void setPrinter( /*IN*/ com.sun.star.beans.PropertyValue[] aPrinter ) - throws com.sun.star.lang.IllegalArgumentException - { - xPrintable.setPrinter( aPrinter ); - } - - public void print( /*IN*/ com.sun.star.beans.PropertyValue[] xOptions ) - throws com.sun.star.lang.IllegalArgumentException - { - xPrintable.print( xOptions ); - } - - //========================================================== - // com.sun.star.frame.XStorable - //---------------------------------------------------------- - - public boolean hasLocation( ) - { - return xStorable.hasLocation(); - } - - public String getLocation( ) - { - return xStorable.getLocation(); - } - - public boolean isReadonly( ) - { - return xStorable.isReadonly(); - } - - public void store( ) - throws com.sun.star.io.IOException - { - xStorable.store(); - } - - public void storeAsURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments ) - throws com.sun.star.io.IOException - { - xStorable.storeAsURL( aURL, aArguments ); - } - - public void storeToURL( /*IN*/ String aURL, /*IN*/ com.sun.star.beans.PropertyValue[] aArguments ) - throws com.sun.star.io.IOException - { - xStorable.storeToURL( aURL, aArguments ); - } - -}; - - - diff --git a/bean/com/sun/star/comp/beans/OfficeWindow.java b/bean/com/sun/star/comp/beans/OfficeWindow.java deleted file mode 100644 index 455fe66ca..000000000 --- a/bean/com/sun/star/comp/beans/OfficeWindow.java +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import java.awt.Component; - -import com.sun.star.awt.XWindowPeer; - -/** - * The concreate implementation of the OfficeWindow extends an - * approperate type of visual component (java.awt.Canvas for local - * and java.awt.Container for remote). - - @deprecated - */ -public interface OfficeWindow -{ - /** - * Retrives an AWT component object associated with the OfficeWindow. - * - * @return The AWT component object associated with the OfficeWindow. - */ - Component getAWTComponent(); - - /** - * Retrives an UNO XWindowPeer object associated with the OfficeWindow. - * - * @return The UNO XWindowPeer object associated with the OfficeWindow. - */ - XWindowPeer getUNOWindowPeer(); -} diff --git a/bean/com/sun/star/comp/beans/SystemWindowException.java b/bean/com/sun/star/comp/beans/SystemWindowException.java deleted file mode 100644 index 3748418a8..000000000 --- a/bean/com/sun/star/comp/beans/SystemWindowException.java +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -/** indicates that an operation needed a system window, - but no system window was aquired yet. - - @see com.sun.star.comp.beans.OOoBean.aquireSystemWindow - - @since OOo 2.0.0 -*/ -public class SystemWindowException extends Exception -{ -}; - - diff --git a/bean/com/sun/star/comp/beans/Wrapper.java b/bean/com/sun/star/comp/beans/Wrapper.java deleted file mode 100644 index 824a81266..000000000 --- a/bean/com/sun/star/comp/beans/Wrapper.java +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package com.sun.star.comp.beans; - -import com.sun.star.uno.UnoRuntime; - -//========================================================================== -/** Wrapper base class for UNO services which emulates the upcoming - mode of automatic runtime Java classes to get rid of the need for - queryInterface. - - Because its not worth the efford to create a runtime generated wrapper - for this purpose, as it might be for OOo 2.0, you still have to use - UnoRuntime.queryInterface() for interfaces which are optional or come - from a subclass. But for non optional interfaces you can already - directly call their methods. - - This wrapper will only work for UNO objects via a bridge, not for - direct Java objects. - - @since OOo 2.0.0 - */ -class Wrapper - implements - com.sun.star.lib.uno.Proxy, - // see the comment in com.sun.star.lib.uno.bridges.java_remote - // .java_remote_bridge.mapInterfaceTo for the consequences of this - // hack - com.sun.star.uno.IQueryInterface, - com.sun.star.lang.XComponent -{ - private com.sun.star.uno.IQueryInterface xQueryInterface; - private com.sun.star.lang.XComponent xComponent; - - public Wrapper( com.sun.star.uno.XInterface xProxy ) - { - xQueryInterface = (com.sun.star.uno.IQueryInterface) xProxy; - xComponent = (com.sun.star.lang.XComponent) - UnoRuntime.queryInterface( - com.sun.star.lang.XComponent.class, xProxy ); - } - - //============================================================== - // com.sun.star.uno.IQueryInterface - //-------------------------------------------------------------- - - public String getOid() - { - return xQueryInterface.getOid(); - } - - public boolean isSame( Object aObject ) - { - return xQueryInterface.isSame( aObject ); - } - - public Object queryInterface( com.sun.star.uno.Type aType ) - { -//System.err.println( "Wrapper::queryInterface(" + aType + ")" ); - return xQueryInterface.queryInterface( aType ); - } - - //============================================================== - // com.sun.star.lang.XComponent - //-------------------------------------------------------------- - - public void dispose( ) - { - xComponent.dispose(); - } - - public void addEventListener( /*IN*/ com.sun.star.lang.XEventListener xListener ) - { - xComponent.addEventListener( xListener ); - } - - public void removeEventListener( /*IN*/ com.sun.star.lang.XEventListener xListener ) - { - xComponent.removeEventListener( xListener ); - } -}; - - diff --git a/bean/com/sun/star/comp/beans/makefile.mk b/bean/com/sun/star/comp/beans/makefile.mk deleted file mode 100644 index 31781d6f0..000000000 --- a/bean/com/sun/star/comp/beans/makefile.mk +++ /dev/null @@ -1,75 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/..$/..$/.. -PRJNAME = beans -TARGET = com_sun_star_comp_beans -PACKAGE = com$/sun$/star$/comp$/beans - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk -.IF "$(L10N_framework)"=="" -.IF "$(OS)"=="MACOSX" - -dummy: - @echo "Nothing to build for OS $(OS)" - -.ELSE # "$(OS)"=="MACOSX" - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar - -# --- Sources -------------------------------------------------------- - -JAVAFILES= \ - ContainerFactory.java \ - Controller.java \ - Frame.java \ - HasConnectionException.java \ - InvalidArgumentException.java \ - JavaWindowPeerFake.java \ - LocalOfficeConnection.java \ - LocalOfficeWindow.java \ - NativeConnection.java \ - NativeService.java \ - NoConnectionException.java \ - NoDocumentException.java \ - OfficeConnection.java \ - OfficeDocument.java \ - OfficeWindow.java \ - OOoBean.java \ - SystemWindowException.java \ - Wrapper.java \ - CallWatchThread.java - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -.ENDIF - -# --- Targets ------------------------------------------------------ -.ENDIF # L10N_framework - -.INCLUDE : target.mk diff --git a/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c b/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c deleted file mode 100644 index 21facbb71..000000000 --- a/bean/native/unix/com_sun_star_beans_LocalOfficeWindow.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include "jni.h" - -// Workaround for problematic IBM JDK 1.6.0 on ppc -#ifndef _JNI_IMPORT_OR_EXPORT_ -#define _JNI_IMPORT_OR_EXPORT_ -#endif - -#include "jawt_md.h" -#include "jawt.h" - -/*#include "../inc/com_sun_star_comp_beans_LocalOfficeWindow.h"*/ - -#if defined assert -#undef assert -#endif - -#define assert(X) if (!X) { (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), "assertion failed"); return;} - - -#define SYSTEM_WIN32 1 -#define SYSTEM_WIN16 2 -#define SYSTEM_JAVA 3 -#define SYSTEM_MAC 5 -#define SYSTEM_XWINDOW 6 - -JNIEXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this); - -/*****************************************************************************/ -/* - * Class: com_sun_star_comp_beans_LocalOfficeWindow - * Method: getNativeWindowSystemType - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindowSystemType - (JNIEnv * env, jobject obj_this) -{ - (void) env; /* avoid warning about unused parameter */ - (void) obj_this; /* avoid warning about unused parameter */ - return (SYSTEM_XWINDOW); -} - - -/*****************************************************************************/ -/* - * Class: com_sun_star_beans_LocalOfficeWindow - * Method: getNativeWindow - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this) -{ - (void) env; /* avoid warning about unused parameter */ - (void) obj_this; /* avoid warning about unused parameter */ - return Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow(env, obj_this); -} - - - - - - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c deleted file mode 100644 index 3458fcec1..000000000 --- a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include "jni.h" - -// Workaround for problematic IBM JDK 1.6.0 on ppc -#ifndef _JNI_IMPORT_OR_EXPORT_ -#define _JNI_IMPORT_OR_EXPORT_ -#endif - -#include "jawt_md.h" -#include "jawt.h" - - -#define SYSTEM_WIN32 1 -#define SYSTEM_WIN16 2 -#define SYSTEM_JAVA 3 -#define SYSTEM_MAC 5 -#define SYSTEM_XWINDOW 6 - - -/* type must be something like java/lang/RuntimeException - */ -static void ThrowException(JNIEnv * env, char const * type, char const * msg) { - jclass c; - (*env)->ExceptionClear(env); - c = (*env)->FindClass(env, type); - if (c == NULL) { - (*env)->ExceptionClear(env); - (*env)->FatalError( - env, "JNI FindClass failed"); - } - if ((*env)->ThrowNew(env, c, msg) != 0) { - (*env)->ExceptionClear(env); - (*env)->FatalError(env, "JNI ThrowNew failed"); - } -} - -/*****************************************************************************/ -/* - * Class: com_sun_star_comp_beans_LocalOfficeWindow - * Method: getNativeWindowSystemType - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindowSystemType - (JNIEnv * env, jobject obj_this) -{ - (void) env; /* avoid warning about unused parameter */ - (void) obj_this; /* avoid warning about unused parameter */ - return (SYSTEM_XWINDOW); -} - - -/*****************************************************************************/ -/* - * Class: com_sun_star_beans_LocalOfficeWindow - * Method: getNativeWindow - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this) -{ - jboolean result; - jint lock; - - JAWT awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_X11DrawingSurfaceInfo* dsi_x11; - - Drawable drawable; - - /* Get the AWT */ - awt.version = JAWT_VERSION_1_3; - result = JAWT_GetAWT(env, &awt); - if (result == JNI_FALSE) - ThrowException(env, "java/lang/RuntimeException", "JAWT_GetAWT failed"); - - /* Get the drawing surface */ - if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL) - return 0L; - - /* Lock the drawing surface */ - lock = ds->Lock(ds); - if ( (lock & JAWT_LOCK_ERROR) != 0) - ThrowException(env, "java/lang/RuntimeException", - "Could not get AWT drawing surface."); - - /* Get the drawing surface info */ - dsi = ds->GetDrawingSurfaceInfo(ds); - - /* Get the platform-specific drawing info */ - dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo; - - drawable = dsi_x11->drawable; - - /* Free the drawing surface info */ - ds->FreeDrawingSurfaceInfo(dsi); - /* Unlock the drawing surface */ - ds->Unlock(ds); - /* Free the drawing surface */ - awt.FreeDrawingSurface(ds); - - return ((jlong)drawable); -} - - - - - - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bean/native/unix/makefile.mk b/bean/native/unix/makefile.mk deleted file mode 100644 index e3ff996a6..000000000 --- a/bean/native/unix/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -PRJ=..$/.. - -PRJNAME=beans -TARGET=officebean -ENABLE_EXCEPTIONS=TRUE -NO_DEFAULT_STL=TRUE -NO_BSYMBOLIC=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(SOLAR_JAVA)"=="" || "$(OS)"=="MACOSX" -nojava: - @echo "Not building odk/source/OOSupport because Java has been disabled" -.ENDIF -.IF "$(OS)"=="MACOSX" -dummy: - @echo "Nothing to build for OS $(OS)" -.ENDIF - -SLOFILES = \ - $(SLO)$/com_sun_star_comp_beans_LocalOfficeWindow.obj \ - $(SLO)$/com_sun_star_beans_LocalOfficeWindow.obj - -SHL1TARGET=$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SOLARLIB+=$(JAVALIB) -SHL1STDLIBS=$(AWTLIB) -SHL1NOCHECK=TRUE - -.IF "$(OS)" == "LINUX" -SHL1STDLIBS+=-lstdc++ -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c b/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c deleted file mode 100644 index ea3761239..000000000 --- a/bean/native/win32/com_sun_star_beans_LocalOfficeWindow.c +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif - -#include "jawt.h" - -#if defined assert -#undef assert -#endif - -#define assert(X) if (!X) { (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), "assertion failed"); return 0L;} - - -#define SYSTEM_WIN32 1 -#define SYSTEM_WIN16 2 -#define SYSTEM_JAVA 3 -#define SYSTEM_MAC 5 -#define SYSTEM_XWINDOW 6 - -#define OLD_PROC_KEY "oldwindowproc" - -static LRESULT APIENTRY OpenOfficeWndProc( HWND , UINT , WPARAM , LPARAM ); - -JNIEXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this); - -/*****************************************************************************/ -/* - * Class: com_sun_star_beans_LocalOfficeWindow - * Method: getNativeWindowSystemType - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindowSystemType - (JNIEnv * env, jobject obj_this) -{ - (void) env; // unused - (void) obj_this; // unused - return (SYSTEM_WIN32); -} - - -/*****************************************************************************/ -/* - * Class: com_sun_star_beans_LocalOfficeWindow - * Method: getNativeWindow - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this) -{ - return Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow( env, obj_this ); -} - - - - - - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c deleted file mode 100644 index 3707566b9..000000000 --- a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif - -#include -#define JAWT_GetAWT hidden_JAWT_GetAWT -#include "jawt.h" -#undef JAWT_GetAWT - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -/* When cross-compiling to Windows we don't have any Windows JDK - * available. Copying this short snippet from win32/jawt_md.h can - * surely not be against its license. The intent is to enable - * interoperation with real Oracle Java after all. We leave out the - * informative comments that might have "artistic merit" and be more - * copyrightable. Use this also for native Windows compilation for - * simplicity. - */ -typedef struct jawt_Win32DrawingSurfaceInfo { - union { - HWND hwnd; - HBITMAP hbitmap; - void* pbits; - }; - HDC hdc; - HPALETTE hpalette; -} JAWT_Win32DrawingSurfaceInfo; - -extern __declspec(dllimport) unsigned char __stdcall JAWT_GetAWT(JNIEnv *, JAWT *); -#if defined _MSC_VER -#pragma warning(pop) -#endif - -#define SYSTEM_WIN32 1 -#define SYSTEM_WIN16 2 -#define SYSTEM_JAVA 3 -#define SYSTEM_MAC 5 -#define SYSTEM_XWINDOW 6 - -#define OLD_PROC_KEY "oldwindowproc" - -static LRESULT APIENTRY OpenOfficeWndProc( HWND , UINT , WPARAM , LPARAM ); - - - -/* type must be something like java/lang/RuntimeException - */ -static void ThrowException(JNIEnv * env, char const * type, char const * msg) { - jclass c; - (*env)->ExceptionClear(env); - c = (*env)->FindClass(env, type); - if (c == NULL) { - (*env)->ExceptionClear(env); - (*env)->FatalError( - env, "JNI FindClass failed"); - } - if ((*env)->ThrowNew(env, c, msg) != 0) { - (*env)->ExceptionClear(env); - (*env)->FatalError(env, "JNI ThrowNew failed"); - } -} - - -/*****************************************************************************/ -/* - * Class: com_sun_star_comp_beans_LocalOfficeWindow - * Method: getNativeWindowSystemType - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindowSystemType - (JNIEnv * env, jobject obj_this) -{ - (void) env; // unused - (void) obj_this; // unused - return (SYSTEM_WIN32); -} - - -/*****************************************************************************/ -/* - * Class: com_sun_star_comp_beans_LocalOfficeWindow - * Method: getNativeWindow - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow - (JNIEnv * env, jobject obj_this) -{ - jboolean result; - jint lock; - - JAWT awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_Win32DrawingSurfaceInfo* dsi_win; - HDC hdc; - HWND hWnd; - LONG hFuncPtr; - - /* Get the AWT */ - awt.version = JAWT_VERSION_1_3; - result = JAWT_GetAWT(env, &awt); - if (result == JNI_FALSE) - ThrowException(env, "java/lang/RuntimeException", "JAWT_GetAWT failed"); - - /* Get the drawing surface */ - if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL) - return 0L; - - /* Lock the drawing surface */ - lock = ds->Lock(ds); - if ( (lock & JAWT_LOCK_ERROR) != 0) - ThrowException(env, "java/lang/RuntimeException", - "Could not get AWT drawing surface."); - - /* Get the drawing surface info */ - dsi = ds->GetDrawingSurfaceInfo(ds); - - /* Get the platform-specific drawing info */ - dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; - - hdc = dsi_win->hdc; - - hWnd = dsi_win->hwnd; - - /* Free the drawing surface info */ - ds->FreeDrawingSurfaceInfo(dsi); - /* Unlock the drawing surface */ - ds->Unlock(ds); - /* Free the drawing surface */ - awt.FreeDrawingSurface(ds); - - /* Register own window procedure - Do it one times only! Otherwhise - multiple instances will be registered - and calls on such construct produce - a stack overflow. - */ - if (GetProp( hWnd, OLD_PROC_KEY )==0) - { - hFuncPtr = SetWindowLongPtr( hWnd, GWLP_WNDPROC, (LONG_PTR)OpenOfficeWndProc ); - SetProp( hWnd, OLD_PROC_KEY, (HANDLE)hFuncPtr ); - } - - return ((jlong)hWnd); -} - - -static LRESULT APIENTRY OpenOfficeWndProc( - HWND hWnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch(uMsg) - { - case WM_PARENTNOTIFY: { - if (wParam == WM_CREATE) { - RECT rect; - HWND hChild = (HWND) lParam; - - GetClientRect(hWnd, &rect); - - SetWindowPos(hChild, - NULL, - rect.left, - rect.top, - rect.right - rect.left, - rect.bottom - rect.top, - SWP_NOZORDER); - } - break; - } - case WM_SIZE: { - WORD newHeight = HIWORD(lParam); - WORD newWidth = LOWORD(lParam); - HWND hChild = GetWindow(hWnd, GW_CHILD); - - if (hChild != NULL) { - SetWindowPos(hChild, NULL, 0, 0, newWidth, newHeight, SWP_NOZORDER); - } - break; - } - } - -#if defined _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4152) /* function/data pointer conversion: */ -#endif - return CallWindowProc(GetProp(hWnd, OLD_PROC_KEY), - hWnd, uMsg, wParam, lParam); -#if defined _MSC_VER -#pragma warning(pop) -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bean/native/win32/makefile.mk b/bean/native/win32/makefile.mk deleted file mode 100644 index e29cffa49..000000000 --- a/bean/native/win32/makefile.mk +++ /dev/null @@ -1,38 +0,0 @@ -PRJ=..$/.. - -PRJNAME=odk -TARGET=officebean -ENABLE_EXCEPTIONS=TRUE -NO_DEFAULT_STL=TRUE -NO_BSYMBOLIC=TRUE -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(SOLAR_JAVA)" != "" - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/com_sun_star_comp_beans_LocalOfficeWindow.obj \ - $(SLO)$/com_sun_star_beans_LocalOfficeWindow.obj - -SHL1TARGET=$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SOLARLIB+=$(JAVALIB) -SHL1STDLIBS=$(AWTLIB) $(SALLIB) - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= $(TARGET).dxp -DEF1DES=officebean - -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/bean/native/win32/officebean.dxp b/bean/native/win32/officebean.dxp deleted file mode 100644 index 9a01b090f..000000000 --- a/bean/native/win32/officebean.dxp +++ /dev/null @@ -1,4 +0,0 @@ -Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindowSystemType -Java_com_sun_star_comp_beans_LocalOfficeWindow_getNativeWindow -Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindowSystemType -Java_com_sun_star_beans_LocalOfficeWindow_getNativeWindow \ No newline at end of file diff --git a/bean/prj/build.lst b/bean/prj/build.lst deleted file mode 100644 index 91d443344..000000000 --- a/bean/prj/build.lst +++ /dev/null @@ -1,10 +0,0 @@ -ob bean : javaunohelper jurt ridljar unoil offapi udkapi NULL -ob bean\com\sun\star\comp\beans nmake - all ob_beanjava NULL -ob bean\com\sun\star\beans nmake - all ob_legacybeanjava ob_beanjava NULL -ob bean\native\win32 nmake - n ob_beanwin32 NULL -ob bean\native\unix nmake - u ob_beanunix NULL -ob bean\util nmake - all ob_util ob_beanjava ob_legacybeanjava ob_beanwin32.n ob_beanunix.u NULL - -# complex tests compileable but fail at runtime -# ob bean\qa\complex\bean nmake - all ob_qa_complex ob_util NULL - diff --git a/bean/prj/d.lst b/bean/prj/d.lst deleted file mode 100644 index f3154b68b..000000000 --- a/bean/prj/d.lst +++ /dev/null @@ -1,5 +0,0 @@ -..\%__SRC%\class\officebean.jar %_DEST%\bin\officebean.jar - -..\%__SRC%\bin\officebean.dll %_DEST%\bin\officebean.dll -..\%__SRC%\lib\libofficebean.so %_DEST%\lib\libofficebean.so -..\%__SRC%\lib\*officebean.dylib %_DEST%\lib\*officebean.dylib diff --git a/bean/qa/complex/bean/OOoBeanTest.java b/bean/qa/complex/bean/OOoBeanTest.java deleted file mode 100644 index 1a4b81cbd..000000000 --- a/bean/qa/complex/bean/OOoBeanTest.java +++ /dev/null @@ -1,737 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.bean; - - -// import complexlib.ComplexTestCase; -import com.sun.star.lang.XMultiServiceFactory; -import java.awt.event.*; -import java.awt.event.KeyEvent; -import com.sun.star.comp.beans.OOoBean; -import com.sun.star.uno.UnoRuntime; - -import java.awt.*; - -// import org.junit.After; -import org.junit.AfterClass; -// import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; -import static org.junit.Assert.*; - -class PrivateLocalOfficeConnection extends com.sun.star.comp.beans.LocalOfficeConnection -{ - public PrivateLocalOfficeConnection(com.sun.star.uno.XComponentContext xContext) - { - super(xContext); - } -} - -public class OOoBeanTest -{ - -// public String[] getTestMethodNames() -// { -// // TODO think about trigger of sub-tests from outside -// return new String[] -// { -// "test1", -// "test2", -// "test3", -// "test4", -// "test5", -// "test6", -// "test6a", -// "test7", -// "test8" -// }; -// } - - /** For X-Windows we need to prolong the time between painting windows. Because - it takes longer than on Windows. - */ - private int getSleepTime(int time) - { - int ret = time; - if (isWindows() == false) - { - return time * 5; - } - return time; - } - - /** If it cannot be determined if we run on Windows then we assume - that we do not. - */ - private boolean isWindows() - { - boolean ret = false; - String os = System.getProperty("os.name"); - if (os != null) - { - os = os.trim(); - if (os.toLowerCase().indexOf("win") == 0) - { - ret = true; - } - } - return ret; - } - - private String getText(OOoBean bean) throws Exception - { - com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)bean.getDocument(); - com.sun.star.text.XTextDocument myDoc = - UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); - com.sun.star.text.XText xText = myDoc.getText(); - return xText.getString(); - } - - /** 1.Create a Java frame - * 2.Add OOoBean (no document loaded yet) - * 3.Show frame - * 4.Load document - * @throws Exception - */ - @Test public void test1() throws Exception - { - WriterFrame f = null; - try - { - f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext()); - f.setText("OOoBean test."); - Thread.sleep(1000); - } - finally - { - if (f != null) - { - f.dispose(); - } - } - } - - /** Sizing, painting - * @throws Exception - */ - @Test public void test2() throws Exception - { - WriterFrame f = null; - ScreenComparer capturer = null; - try - { - f = new WriterFrame(100, 100, 500,500, false, connection.getComponentContext()); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Client are of Java frame does not match the UNO window."); - } - capturer = new ScreenComparer(100, 100, 500, 500); - - //Minimize Window and back - f.goToStart(); - f.pageDown(); - Thread.sleep(1000); - for (int i = 0; i < 3; i++) - { - capturer.reset(); - capturer.grabOne(f.getClientArea()); - f.setExtendedState(Frame.ICONIFIED); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame was iconified."); - } - f.setExtendedState(Frame.NORMAL); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame size set back to normal after it was iconified."); - } - capturer.grabTwo(f.getClientArea()); - if (capturer.compare() == false) - { - fail("Painting error: Minimize (iconify) frame and back to normal size."); - capturer.writeImages(); - } - } - - //Maximize Window and back to normal - for (int i = 0; i < 3; i++) - { - capturer.reset(); - capturer.grabOne(f.getClientArea()); - f.setExtendedState(Frame.MAXIMIZED_BOTH); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame maximized."); - } - f.setExtendedState(Frame.NORMAL); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame set from maximized to normal."); - } - capturer.grabTwo(f.getClientArea()); - if (capturer.compare() == false) - { - fail("Painting error: Maximize frame and back to normal size"); - capturer.writeImages(); - } - } - - //move Window top left - capturer.reset(); - capturer.grabOne(f.getClientArea()); - Rectangle oldPosition = f.getBounds(); - f.setBounds(0, 0, oldPosition.width, oldPosition.height); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame moved."); - } - - capturer.grabTwo(f.getClientArea()); - if (capturer.compare() == false) - { - fail("Painting error: Move frame to a different position."); - capturer.writeImages(); - } - - //move Window down - Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); - int maxY = dim.height - f.getBounds().height; - - int curY = 0; - while (curY < maxY) - { - capturer.reset(); - capturer.grabOne(f.getClientArea()); - oldPosition = f.getBounds(); - f.setBounds(0, curY, oldPosition.width, oldPosition.height); - capturer.grabTwo(f.getClientArea()); - if (capturer.compare() == false) - { - fail("Painting error: Move frame to a different position."); - capturer.writeImages(); - } - curY+= 50; - Thread.sleep(getSleepTime(200)); - } - - //obscure the window and make it visible again - - oldPosition = f.getBounds(); - - Rectangle pos = new Rectangle(oldPosition.x - 50, oldPosition.y - 50, - oldPosition.width, oldPosition.height); - Frame coverFrame = new Frame(); - coverFrame.setBounds(pos); - capturer.reset(); - capturer.grabOne(f.getClientArea()); - - for (int i = 0; i < 3; i++) - { - coverFrame.setVisible(true); - Thread.sleep(getSleepTime(200)); - f.toFront(); - Thread.sleep(getSleepTime(200)); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error: Frame moved from back to front."); - } - - capturer.grabTwo(f.getClientArea()); - if (capturer.compare() == false) - { - fail("Painting error: Move frame to back and to front."); - capturer.writeImages(); - } - } - - coverFrame.dispose(); - } - finally - { - if (f != null) - { - f.dispose(); - } - } - } - - /** - 1. Create a OOoBean - 2. Load a document - 3. Create Frame (do not show yet) - 4. Add OOoBean to Frame - 5. Show Frame - * @throws Exception - */ - @Test public void test3() throws Exception - { - WriterFrame f = null; - try - { - f = new WriterFrame(100, 100, 500, 300, true, connection.getComponentContext()); - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error."); - } - - } - finally - { - if (f != null) - { - f.dispose(); - } - } - } - - /** Test repeated OOoBean.aquireSystemWindow and OOoBean.releaseSystemWindow - * calls. - * @throws Exception - */ - @Test public void test4() throws Exception - { - WriterFrame f = null; - try - { - f = new WriterFrame(100, 100, 500, 300, false, connection.getComponentContext()); - OOoBean b = f.getBean(); - for (int i = 0; i < 100; i++) - { - b.releaseSystemWindow(); - b.aquireSystemWindow(); - } - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error."); - } - } - finally - { - if (f != null) - { - f.dispose(); - } - if (isWindows() == false) - { - Thread.sleep(10000); - } - } - } - - /** Adding and removing the bean to a Java frame multiple times. - * Test painting and sizing. - * @throws Exception - */ - @Test public void test5() throws Exception - { - WriterFrame f = null; - try - { - f = new WriterFrame(100, 100, 500, 400, false, connection.getComponentContext()); - f.goToStart(); - f.pageDown(); - Thread.sleep(1000); - - ScreenComparer capturer = new ScreenComparer(100,100,500,400); - capturer.grabOne(); - for (int i = 0; i < 100; i++) - { - f.removeOOoBean(); - f.addOOoBean(); - } - - f.goToStart(); - f.pageDown(); - Thread.sleep(getSleepTime(200)); - capturer.grabTwo(); - - if (capturer.compare() == false) - { - fail("Painting error: adding and removing OOoBean " + - "repeatedly to java.lang.Frame."); - capturer.writeImages(); - } - - if (f.checkUnoFramePosition() == false) - { - fail("Sizing error."); - } - - } - finally - { - if (f != null) - { - f.dispose(); - } - if (isWindows() == false) - { - Thread.sleep(10000); - } - } - } - - - /** Test focus (i49454). After repeatedly adding and removing the bean to a window - * it should still be possible to enter text in the window. This does not - * work all the time on Windows. This is probably a timing problem. When using - * Thread.sleep (position #1) then it should work. - * @throws Exception - */ - @Test public void test6() throws Exception - { - for (int j = 0; j < 10; j++) - { - final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - java.awt.Frame frame = null; - bean.setOOoCallTimeOut(10000); - try { - frame = new java.awt.Frame("OpenOffice.org Demo"); - frame.add(bean, BorderLayout.CENTER); - frame.pack(); - frame.setSize(600,300); - frame.show(); - bean.loadFromURL("private:factory/swriter", null); - // #1 - Thread.sleep(1000); - - StringBuffer buf = new StringBuffer(1000); - for (int i = 0; i < 1; i++) - { -// Thread.sleep(1000); - bean.releaseSystemWindow(); - frame.remove(bean); -// frame.validate(); -// Thread.sleep(1000); - frame.add(bean, BorderLayout.CENTER); - bean.aquireSystemWindow(); -// frame.validate(); - } - - if (isWindows() == false) - { - Thread.sleep(5000); - } - - Robot roby = new Robot(); - roby.keyPress(KeyEvent.VK_H); - roby.keyRelease(KeyEvent.VK_H); - buf.append("h"); - - String s = getText(bean); - if ( ! s.equals(buf.toString())) - { - fail("Focus error: After removing and adding the bean, the" + - "office window does not receive keyboard input.\n" + - "Try typing in the window, you've got 30s!!! This " + - "test may not work with Linux/Solaris"); - Thread.sleep(30000); - break; - } - else - { - Thread.sleep(2000); - } - - } finally { - bean.stopOOoConnection(); - frame.dispose(); - } - } - } - - /** Tests focus problem just like test6, but the implementation is a little - * different. The bean is added and removed from withing the event dispatch - * thread. Using Thread.sleep at various points (#1, #2, #3) seems to workaround - * the problem. - * @throws Exception - */ - @Test public void test6a() throws Exception - { - for (int j = 0; j < 50; j++) - { - final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - final java.awt.Frame frame = new Frame("Openoffice.org"); - bean.setOOoCallTimeOut(10000); - - try { - frame.add(bean, BorderLayout.CENTER); - frame.pack(); - frame.setSize(600,400); - frame.show(); - bean.loadFromURL("private:factory/swriter", null); - frame.validate(); - // #1 - Thread.sleep(1000); - StringBuffer buf = new StringBuffer(1000); - int i = 0; - - for (; i < 1; i++) - { - EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue(); - q.invokeAndWait( new Runnable() { - public void run() { - try { - - bean.releaseSystemWindow(); - frame.remove(bean); - frame.validate(); - - } catch (Exception e) { - e.printStackTrace(); - } - - } - }); - // #2 - Thread.sleep(1000); - q.invokeAndWait( new Runnable() { - public void run() { - try { - - frame.add(bean, BorderLayout.CENTER); - bean.aquireSystemWindow(); - frame.validate(); - } catch (Exception e) { - e.printStackTrace(); - } - } - }); - - // #3 - Thread.sleep(1000); - } - - if (isWindows() == false) - { - Thread.sleep(5000); - } - - Robot roby = new Robot(); - roby.mouseMove(300, 200); - roby.waitForIdle(); - roby.mousePress(InputEvent.BUTTON1_MASK); - roby.waitForIdle(); - roby.mouseRelease(InputEvent.BUTTON1_MASK); - roby.waitForIdle(); - roby.keyPress(KeyEvent.VK_H); - roby.waitForIdle(); - roby.keyRelease(KeyEvent.VK_H); - roby.waitForIdle(); - - buf.append("h"); - Thread.sleep(1000); - String s = getText(bean); - System.out.println(" getText: " + s); - if ( ! s.equals(buf.toString())) - { - roby.mousePress(InputEvent.BUTTON1_MASK); - roby.waitForIdle(); - roby.mouseRelease(InputEvent.BUTTON1_MASK); - roby.waitForIdle(); - roby.keyPress(KeyEvent.VK_H); - roby.waitForIdle(); - roby.keyRelease(KeyEvent.VK_H); - roby.waitForIdle(); - - String sH = "h"; - Thread.sleep(1000); - String s2 = getText(bean); - - if ( ! sH.equals(s2)) - { - fail("Focus error: After removing and adding the bean, the" + - "office window does not receive keyboard input.\n" + - "Try typing in the window, you've got 30s!!! This " + - "test may not work with Linux/Solaris"); - System.out.println("j: " + j + " i: " + i); - Thread.sleep(30000); - break; - } - } - else - { - // Thread.sleep(2000); - } - - } finally { - bean.stopOOoConnection(); - frame.dispose(); - } - } - } - - /** Repeatedly loading a document in one and the same OOoBean instance. - * @throws Exception - */ - @Test public void test7() throws Exception - { - WriterFrame f = null; - try - { - f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext()); - String text = "OOoBean test."; - - for (int i = 0; i < 10; i++) - { - f.getBean().clear(); - f.getBean().loadFromURL("private:factory/swriter", null); - f.setText(text); - f.goToStart(); - f.validate(); - - if (text.equals(f.getText()) == false) - { - fail("Repeated loading of a document failed."); - } - Thread.sleep(1000); - } - } - finally - { - if (f != null) - { - f.dispose(); - } - } - } - - /** Using multiple instances of OOoBean at the same time - * @throws Exception - */ - - @Test public void test8() throws Exception - { - OOoBean bean1 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - BeanPanel bp1 = new BeanPanel(bean1); - OOoBean bean2 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - BeanPanel bp2 = new BeanPanel(bean2); - OOoBean bean3 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - BeanPanel bp3 = new BeanPanel(bean3); - OOoBean bean4 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); - BeanPanel bp4 = new BeanPanel(bean4); - - try - { - Frame f = new Frame("OOoBean example with several instances"); - f.setLayout(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 0.5; - - c.insets = new Insets(0, 0, 0, 10); - c.gridx = 0; - c.gridy = 0; - f.add(bp1, c); - - c.gridx = 1; - c.insets = new Insets(0, 0, 0, 0); - f.add(bp2, c); - - c.gridx = 0; - c.gridy = 1; - c.insets = new Insets(10, 0, 0, 10); - f.add(bp3, c); - - c.gridx = 1; - c.gridy = 1; - c.insets = new Insets(10, 0, 0, 0); - f.add(bp4, c); - - f.pack(); - f.setBounds(0, 0, 1000, 600); - f.setVisible(true); - try { - bean1.loadFromURL("private:factory/swriter", null); - bean2.loadFromURL("private:factory/swriter", null); - bean3.loadFromURL("private:factory/swriter", null); - bean4.loadFromURL("private:factory/swriter", null); - } catch( Exception e) - { - e.printStackTrace(); - } - f.validate(); - - Thread.sleep(10000); - } - finally - { - bean1.stopOOoConnection(); - bean2.stopOOoConnection(); - bean3.stopOOoConnection(); - bean4.stopOOoConnection(); - } - } - - class BeanPanel extends Panel - { - public BeanPanel(OOoBean b) - { - setLayout(new BorderLayout()); - add(b, BorderLayout.CENTER); - } - public Dimension getPreferredSize() - { - Container c = getParent(); - return new Dimension(200, 200); - } - } - - - - - private XMultiServiceFactory getMSF() - { - final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); - return xMSF1; - } - - // setup and close connections - @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/bean/qa/complex/bean/ScreenComparer.java b/bean/qa/complex/bean/ScreenComparer.java deleted file mode 100644 index d4796b964..000000000 --- a/bean/qa/complex/bean/ScreenComparer.java +++ /dev/null @@ -1,249 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.bean; - - -// import complexlib.ComplexTestCase; -import java.io.File; -import java.awt.Rectangle; -// import java.awt.BorderLayout; -import java.awt.image.BufferedImage; -import java.awt.image.PixelGrabber; -// import java.awt.event.*; -// import java.awt.Frame; -import javax.imageio.ImageIO; -// import javax.imageio.stream.FileImageOutputStream; - - - -class ScreenComparer -{ - Rectangle m_rect; - BufferedImage m_img1; - BufferedImage m_img2; - BufferedImage m_imgDiff; - - int m_diffColor; - public ScreenComparer(int x, int y, int width, int height) - { - this(new Rectangle(x, y, width, height)); - } - - public ScreenComparer(Rectangle location) - { - m_rect = location; - int red = 0xff; - int alpha = 0xff; - m_diffColor = (alpha << 24); - m_diffColor = m_diffColor | (red << 16); - } - - public ScreenComparer() - { - this(new Rectangle(0, 0, 0, 0)); - } - - public void reset() - { - m_rect = null; - m_img1 = null; - m_img2 = null; - m_imgDiff = null; - } - - public Rectangle getLocation() - { - return m_rect; - } - public void grabOne() throws Exception - { - grabOne(m_rect); - } - - public void grabOne(Rectangle r) throws Exception - { - java.awt.Robot robot = new java.awt.Robot(); - m_img1 = robot.createScreenCapture(r); - } - - public void grabTwo() throws Exception - { - grabTwo(m_rect); - } - - public void grabTwo(Rectangle r) throws Exception - { - java.awt.Robot robot = new java.awt.Robot(); - m_img2 = robot.createScreenCapture(r); - } - - public boolean compare() throws Exception - { - if (m_img1 == null || m_img2 == null) - { - throw new Exception("Only one image captured!"); - } - boolean ret = true; - int w1 = m_img1.getWidth(); - int h1 = m_img1.getHeight(); - int w2 = m_img2.getWidth(); - int h2 = m_img2.getHeight(); - - if (w1 != w2 || h1 != h2) - { - System.out.println("### 1\n"); - //Different size. Create an image that holds both images. - int w = w1 > w2 ? w1 : w2; - int h = h1 > h2 ? h1 : h2; - m_imgDiff = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); - for (int y = 0; y < h; y ++) - { - for (int x = 0; x < w; x++) - { - boolean bOutOfRange = false; - int pixel1 = 0; - int pixel2 = 0; - //get the pixel for m_img1 - if (x < w1 && y < h1) - { - pixel1 = m_img1.getRGB(x, y); - } - else - { - bOutOfRange = true; - } - - if (x < w2 && y < h2) - { - pixel2 = m_img2.getRGB(x, y); - } - else - { - bOutOfRange = true; - } - - if (bOutOfRange || pixel1 != pixel2) - { - m_imgDiff.setRGB(x, y, m_diffColor); - } - else - { - m_imgDiff.setRGB(x, y, pixel1); - } - - } - } - return false; - } - - //Images have same dimension - int[] pixels1 = new int[w1 * h1]; - PixelGrabber pg = new PixelGrabber( - m_img1.getSource(), 0, 0, w1, h1, pixels1, 0, w1); - pg.grabPixels(); - - int[] pixels2 = new int[w2 * h2]; - PixelGrabber pg2 = new PixelGrabber( - m_img2.getSource(), 0, 0, w2, h2, pixels2, 0, w2); - pg2.grabPixels(); - - m_imgDiff = new BufferedImage(w1, h1, BufferedImage.TYPE_INT_ARGB); - - //First check if the the images differ. - int lenAr = pixels1.length; - int index = 0; - for (index = 0; index < lenAr; index++) - { - if (pixels1[index] != pixels2[index]) - { - break; - } - } - - //If the images are different, then create the diff image - if (index < lenAr) - { - for (int y = 0; y < h1; y++) - { - for (int x = 0; x < w1; x++) - { - int offset = y * w1 + x; - if (pixels1[offset] != pixels2[offset]) - { - ret = ret && false; - m_imgDiff.setRGB(x, y, m_diffColor); - } - else - { - m_imgDiff.setRGB(x, y, pixels1[offset]); - } - } - } - } - return ret; - } - - /** Writes Images to a location. The - * directory is determined by the java property OOoBean.Images - * - */ - public void writeImages() throws Exception - { - String imgLocation = System.getProperty("OOoBean.Images", ""); - File file_tmp = File.createTempFile("OOoBean", "", new File(imgLocation)); - File file1 = new File(file_tmp.getPath()+".png"); - file_tmp.delete(); - if (m_img1 != null) - { - ImageIO.write(m_img1, "png", file1); - System.out.println("\nCompared images:"); - System.out.println("1. " + file1.getPath()); - } - file1= null; - file_tmp= null; - file_tmp = File.createTempFile("OOoBean", "", new File(imgLocation)); - file1 = new File(file_tmp.getPath()+".png"); - file_tmp.delete(); - if (m_img2 != null) - { - ImageIO.write(m_img2, "png", file1); - System.out.println("2. " + file1.getPath()); - } - file1= null; - file_tmp= null; - file_tmp = File.createTempFile("OOoBean", "_diff", new File(imgLocation)); - file1 = new File(file_tmp.getPath()+".png"); - file_tmp.delete(); - if (m_imgDiff != null) - { - ImageIO.write(m_imgDiff, "png", file1); - System.out.println("Diff image: " + file1.getPath() + "\n"); - } - } - -} - diff --git a/bean/qa/complex/bean/WriterFrame.java b/bean/qa/complex/bean/WriterFrame.java deleted file mode 100644 index 711e74bf0..000000000 --- a/bean/qa/complex/bean/WriterFrame.java +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.bean; - - -// import com.sun.star.comp.beans.LocalOfficeConnection; -import com.sun.star.uno.XComponentContext; -import java.awt.Rectangle; -import java.awt.Insets; -import java.awt.BorderLayout; -import com.sun.star.comp.beans.OOoBean; -import com.sun.star.uno.UnoRuntime; - - - -class WriterFrame extends java.awt.Frame -{ - com.sun.star.comp.beans.OOoBean m_bean; - final static String m_sDocURL = "private:factory/swriter"; - - /** - @param loadBeforeVisible - the OOoBean is added to the frame before it is displayable. Then the Java Frame does - not have a native window peer yet. - */ - public WriterFrame(int x, int y, int width, int height, boolean loadBeforeVisible, XComponentContext _xConn) throws Exception - { - - try - { - if (loadBeforeVisible == false) - { - m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn)); - add(m_bean, BorderLayout.CENTER); - pack(); - setBounds(x, y, width, height); - setVisible(true); - m_bean.loadFromURL(m_sDocURL, null); - validate(); - } - else - { - m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn)); - m_bean.loadFromURL(m_sDocURL, null); - add(m_bean, BorderLayout.CENTER); - pack(); - setBounds(x, y, width, height); - setVisible(true); - m_bean.aquireSystemWindow(); - } - } - catch (Exception e) - { - System.out.println("Exception caught: " + e.getMessage()); - } - } - - public WriterFrame() throws Exception - { - this(0, 0, 800, 400, false, null); - } - - public void setText(String s) throws Exception - { - com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument(); - com.sun.star.text.XTextDocument myDoc = - UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); - com.sun.star.text.XText xText = myDoc.getText(); - com.sun.star.text.XTextCursor xTCursor = xText.createTextCursor(); - //inserting some Text - xText.insertString( xTCursor, s, false ); - } - - public String getText() throws Exception - { - com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument(); - com.sun.star.text.XTextDocument myDoc = - UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); - com.sun.star.text.XText xText = myDoc.getText(); - return xText.getString(); - } - - @Override - public void dispose() { - m_bean.stopOOoConnection(); - setVisible(false); - super.dispose(); - } - - OOoBean getBean() - { - return m_bean; - } - - /** Makes sure the document is displayed at the beginning. - * This is important for comparing screenshots. - */ - public void goToStart() throws Exception - { - com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)m_bean.getDocument(); - com.sun.star.frame.XController xController = xModel.getCurrentController(); - - com.sun.star.text.XTextViewCursorSupplier xVCSupplier = - UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController); - - com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( ); - xTViewCursor.gotoStart(false); - } - - - public void pageDown() throws Exception - { - com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)m_bean.getDocument(); - com.sun.star.frame.XController xController = xModel.getCurrentController(); - - com.sun.star.text.XTextViewCursorSupplier xVCSupplier = - UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController); - com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( ); - com.sun.star.view.XScreenCursor xScreenCursor = - UnoRuntime.queryInterface(com.sun.star.view.XScreenCursor.class, xTViewCursor); - xScreenCursor.screenDown(); - } - - public Rectangle getClientArea() - { - - Insets i = getInsets(); - Rectangle r = getBounds(); - Rectangle rc = new Rectangle(r.x + i.left, r.y + i.top, - r.width - i.left - i.right, - r.height - i.top - i.bottom); - return rc; - } - - public Rectangle getUnoFramePosition() throws Exception - { - com.sun.star.awt.XWindow win = m_bean.getFrame().getContainerWindow(); - com.sun.star.awt.Rectangle rect = win.getPosSize(); - return new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); - } - - /** After resizing the Java frame, the UNO window shall be resized - * as well, which is checked by this method. - */ - public boolean checkUnoFramePosition() throws Exception - { - Rectangle client = getClientArea(); - Rectangle unoWin = getUnoFramePosition(); - - if (client.x != unoWin.x - || client.y != unoWin.y - || client.width != unoWin.width - || client.height != unoWin.height) - { - System.out.println("\nPosition of client are of Java frame does not match the postion" + - "of the UNO window. These are the values of Java frame, followed by" + - "the UNO window: "); - System.out.println(client); - System.out.println(unoWin); - System.out.println(""); - return false; - } - - return true; - } - - public void removeOOoBean() throws Exception - { - //OOoBean.releaseSystemWindow need not be called because - //LocalOfficeWindow overrides removeNotify. - //However because of bt4745222 which was fixed in 1.4.2_04, - //this is very very slow. The workaround is use releaseSystemWindow - //beforehand. - m_bean.releaseSystemWindow(); - remove(m_bean); - } - - public void addOOoBean() throws Exception - { - add(m_bean, BorderLayout.CENTER); - m_bean.aquireSystemWindow(); - validate(); - } - -} - diff --git a/bean/qa/complex/bean/makefile.mk b/bean/qa/complex/bean/makefile.mk deleted file mode 100644 index 9a21e52ac..000000000 --- a/bean/qa/complex/bean/makefile.mk +++ /dev/null @@ -1,134 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = bean -TARGET = qa_complex_bean - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/bean - -# here store only Files which contain a @Test -JAVATESTFILES = \ - OOoBeanTest.java - -# put here all other files -JAVAFILES = $(JAVATESTFILES) \ - ScreenComparer.java \ - WriterFrame.java - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar officebean.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) - -# Sample how to debug -# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y - -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END - -# -# -# -# -# PRJ := ..$/.. -# PRJNAME := bean -# TARGET := test_bean -# PACKAGE = complex -# -# .INCLUDE: settings.mk -# -# #----- compile .java files ----------------------------------------- -# -# JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -# JAVAFILES = OOoBeanTest.java ScreenComparer.java WriterFrame.java -# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -# -# #----- make a jar from compiled files ------------------------------ -# -# MAXLINELENGTH = 100000 -# -# JARCLASSDIRS = $(PACKAGE) -# JARTARGET = $(TARGET).jar -# JARCOMPRESS = TRUE -# -# # --- Parameters for the test -------------------------------------- -# -# # test base is java complex -# CT_TESTBASE = -TestBase java_complex -# -# # test looks something like the.full.package.TestName -# CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) -# -# # start the runner application -# CT_APP = org.openoffice.Runner -# -# CT_NOOFFICE = -NoOffice -# -# -# OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR)) -# -# OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSDIR) -# -# OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore -DOOoBean.Images=$(MISC) -# -# -# .INCLUDE: target.mk -# -# ALLTAR : RUNINSTRUCTIONS -# -# # --- Targets ------------------------------------------------------ -# -# #The OOoBean uses the classpath to find the office installation. -# #Therefore we must use the jar files from the office. -# RUN: -# java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) -# run: RUN -# -# rund: -# java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) -# -# -# -# RUNINSTRUCTIONS : -# @echo . -# @echo ########################### N O T E ###################################### -# @echo . -# @echo "To run the test you have to provide the office location." -# @echo Example: -# @echo dmake run office="d:/myOffice" -# @echo . -# diff --git a/bean/test/Test.java b/bean/test/Test.java deleted file mode 100644 index 84578f9f7..000000000 --- a/bean/test/Test.java +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package test; - - -import java.io.*; -import java.awt.*; -import java.awt.event.*; -import com.sun.star.comp.beans.OOoBean; -import com.sun.star.uno.UnoRuntime; - - -import java.awt.*; - -public class Test -{ - - public static void main(String [] args) - { - try { - Frame f = new Frame(); - final OOoBean b = new OOoBean(); - f.add(b, BorderLayout.CENTER); - f.pack(); - f.setSize(500, 400); - f.setVisible(true); - b.loadFromURL("private:factory/swriter", null); - f.validate(); - - f.addWindowListener(new WindowAdapter() { - public void windowClosing( java.awt.event.WindowEvent e){ - b.stopOOoConnection(); - System.exit(0); - - }}); - } - catch (Exception e) - { - e.printStackTrace(); - } - } -} - - diff --git a/bean/test/applet/oooapplet/OOoViewer.java b/bean/test/applet/oooapplet/OOoViewer.java deleted file mode 100644 index ba516c78b..000000000 --- a/bean/test/applet/oooapplet/OOoViewer.java +++ /dev/null @@ -1,208 +0,0 @@ -//************************************************************************* -// - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -//************************************************************************* -package oooapplet; - -import java.lang.reflect.Method; -import java.lang.reflect.Array; -import java.net.*; -import java.io.*; -import java.awt.*; -import java.awt.event.*; -import com.sun.star.comp.beans.*; -import java.applet.Applet; -import java.awt.Graphics; -import java.util.*; - -public class OOoViewer extends Applet { - - private OOoBean oBean; - - static private CustomURLClassLoader m_loader; - - Object m_objBean; - - public void init() { - try { - if (m_loader == null) { - String s = getParameter("office"); - System.out.println("sun.awt.noxembed: " + System.getProperty("sun.awt.noxembed")); - System.setProperty("sun.awt.xembedserver", "true"); - - File f = new File(s); - URL url = f.toURI().toURL(); - String officeURL = url.toString(); - URL[] arURL = new URL[] { - new URL(officeURL + "/program/classes/officebean.jar"), - new URL(officeURL + "/program/classes/jurt.jar"), - new URL(officeURL + "/program/classes/ridl.jar"), - new URL(officeURL + "/program/classes/unoil.jar"), - new URL(officeURL + "/program/classes/java_uno.jar"), - new URL(officeURL + "/program/classes/juh.jar") - }; - m_loader = new CustomURLClassLoader(arURL); - File fileProg = new File(s + "/program"); - m_loader.addResourcePath(fileProg.toURI().toURL()); - } - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } - - public void start() { - try { - Class beanClass = m_loader.loadClass("com.sun.star.comp.beans.OOoBean"); - m_objBean = beanClass.newInstance(); - setLayout(new BorderLayout()); - add((java.awt.Container)m_objBean, BorderLayout.CENTER); - setVisible(true); - //this does not work here. Why? -// Class arPropValClass = m_loader.loadClass("[Lcom.sun.star.beans.PropertyValue;"); - Object arProp = Array.newInstance( - m_loader.loadClass("com.sun.star.beans.PropertyValue"), 1); - Class clazz = arProp.getClass(); - - Method methLoad = beanClass.getMethod( - "loadFromURL", new Class[] { - String.class, arProp.getClass() }); - - methLoad.invoke(m_objBean, new Object[] {"private:factory/swriter", null}); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (ClassCastException e) { - e.printStackTrace(); - } catch (java.lang.reflect.InvocationTargetException e) { - e.printStackTrace(); - } catch (java.lang.NoSuchMethodException e) { - e.printStackTrace(); } - - - - validate(); - } - - public void stop() { - try { - Method methStop = m_objBean.getClass().getMethod( - "stopOOoConnection", new Class[0]); - methStop.invoke(m_objBean, null); - } catch (java.lang.NoSuchMethodException e) { - e.printStackTrace(); - } catch (java.lang.IllegalAccessException e) { - e.printStackTrace(); - } - catch (java.lang.reflect.InvocationTargetException e) { - e.printStackTrace(); - } - - } - - public void destroy() { - } - - public void paint(Graphics g) { - } -} - - -final class CustomURLClassLoader extends URLClassLoader { - - private Vector resourcePaths; - - public CustomURLClassLoader( URL[] urls ) { - super( urls ); - } - - protected Class findClass( String name ) throws ClassNotFoundException { - // This is only called via this.loadClass -> super.loadClass -> - // this.findClass, after this.loadClass has already called - // super.findClass, so no need to call super.findClass again: - throw new ClassNotFoundException( name ); -// return super.findClass(name); - } - - - - protected Class loadClass( String name, boolean resolve ) - throws ClassNotFoundException - { - Class c = findLoadedClass( name ); - if ( c == null ) { - try { - c = super.findClass( name ); - } catch ( ClassNotFoundException e ) { - return super.loadClass( name, resolve ); - } catch ( SecurityException e ) { - // A SecurityException "Prohibited package name: java.lang" - // may occur when the user added the JVM's rt.jar to the - // java.class.path: - return super.loadClass( name, resolve ); - } - } - if ( resolve ) { - resolveClass( c ); - } - return c; - } - - public void addResourcePath(URL rurl) { - if (resourcePaths == null) resourcePaths = new Vector(); - resourcePaths.add(rurl); - } - - public URL getResource(String name) { - if (resourcePaths == null) return null; - - URL result = super.getResource(name); - if (result != null) { - return result; - } - - URL u = null; - URI uri = null; - for (Enumeration e = resourcePaths.elements(); e.hasMoreElements();) { - u = (URL)e.nextElement(); - if (u.getProtocol().startsWith("file")){ - try { - File f1 = new File(u.getPath()); - File f2 = new File(f1, name); - if (f2.exists()) { - return new URL(f2.toURI().toASCIIString()); - } - } catch (MalformedURLException e1) { - System.err.println("malformed url: "+e1.getMessage()); - continue; - } - } - } - return null; - } - -} diff --git a/bean/test/applet/oooapplet/bean.policy b/bean/test/applet/oooapplet/bean.policy deleted file mode 100644 index 5eb633d12..000000000 --- a/bean/test/applet/oooapplet/bean.policy +++ /dev/null @@ -1,16 +0,0 @@ -/* AUTOMATICALLY GENERATED ON Fri Aug 04 13:38:37 CEST 2006*/ -/* DO NOT EDIT */ -/*We could also use more accurate permissions here, but then we would need */ -/*to generate this file because of the paths here. */ -/*grant { */ -/* permission java.lang.RuntimePermission "loadLibrary.*"; */ -/* permission java.io.FilePermission "C:\\Program Files\\OpenOffice.org 2.0\\program\\*", "read"; */ -/* permission java.io.FilePermission "C:\\Program Files\\OpenOffice.org 2.0\\program\\classes\\*", "read"; */ -/* permission java.util.PropertyPermission "*", "read"; */ -/*}; */ - -grant { - permission java.security.AllPermission; - permission java.lang.RuntimePermission "queuePrintJob"; -}; - diff --git a/bean/test/applet/oooapplet/example.html b/bean/test/applet/oooapplet/example.html deleted file mode 100644 index 036684e24..000000000 --- a/bean/test/applet/oooapplet/example.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -

OOoBean used by applet

-
- -
- - - - - \ No newline at end of file diff --git a/bean/test/applet/oooapplet/makefile.mk b/bean/test/applet/oooapplet/makefile.mk deleted file mode 100644 index 79a58cd3a..000000000 --- a/bean/test/applet/oooapplet/makefile.mk +++ /dev/null @@ -1,88 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ := ..$/..$/.. -PRJNAME := bean -TARGET := oooapplet -PACKAGE = oooapplet - -.INCLUDE: settings.mk - -#----- compile .java files ----------------------------------------- - -JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar -JAVAFILES = OOoViewer.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - - -JARCLASSDIRS = \ - oooapplet - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -#----- make a jar from compiled files ------------------------------ - - -.INCLUDE: target.mk - - -ALLTAR : \ - COPY_FILES \ - RUNINSTRUCTIONS - - -COPY_FILES: example.html - $(GNUCOPY) -p $< $(CLASSDIR) -# --- Targets ------------------------------------------------------ - - -.IF "$(GUI)"=="WNT" -RUN: - firefox "$(CLASSDIR)$/example.html?$(office)" -.ELSE -TESTURL="file:///$(PWD)$/$(CLASSDIR)$/example.html?$(office)" -RUN: - firefox ${TESTURL:s/\///} -.ENDIF - -run: RUN - - - -RUNINSTRUCTIONS : - @echo . - @echo ########################### N O T E ###################################### - @echo . - @echo "Add to the java runtime settings for applets in the control panel these lines:" - @echo "-Djava.security.policy=$(PWD)$/bean.policy" - @echo "To run the test you have to provide the office location." - @echo Example: - @echo dmake run office="d:\\myOffice" - @echo . - - diff --git a/bean/test/makefile.mk b/bean/test/makefile.mk deleted file mode 100644 index afc553c49..000000000 --- a/bean/test/makefile.mk +++ /dev/null @@ -1,76 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ := .. -PRJNAME := bean -TARGET := test -PACKAGE = test - -.INCLUDE: settings.mk - -#----- compile .java files ----------------------------------------- - -JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar -JAVAFILES = Test.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR)) -OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(PATH_SEPERATOR)$(CLASSDIR) - -OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore - - -.INCLUDE: target.mk - -ALLTAR : RUNINSTRUCTIONS - -# --- Targets ------------------------------------------------------ - -#The OOoBean uses the classpath to find the office installation. -#Therefore we must use the jar files from the office. -RUN: - java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(PACKAGE).Test -run: RUN - -rund: - java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(PACKAGE).Test - - - -RUNINSTRUCTIONS : - @echo . - @echo ########################### N O T E ###################################### - @echo . - @echo "To run the test you have to provide the office location." - @echo Example: - @echo dmake run office="d:/myOffice" - @echo . - diff --git a/bean/util/delzip b/bean/util/delzip deleted file mode 100644 index e69de29bb..000000000 diff --git a/bean/util/makefile.mk b/bean/util/makefile.mk deleted file mode 100644 index b463b3461..000000000 --- a/bean/util/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = .. -PRJNAME = bean -TARGET = officebean - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.IF "$(L10N_framework)"=="" -JARCLASSDIRS = \ - com$/sun$/star$/comp$/beans \ - com$/sun$/star$/beans - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# Special work necessary for building java reference with javadoc. -# The source of puplic APIs must be delivered and used later in the -# odk module. -ZIP1TARGET=$(TARGET)_src -ZIP1FLAGS=-u -r -ZIP1DIR=$(PRJ) -ZIP1LIST=com -x "*makefile.mk" - -# --- Targets ------------------------------------------------------ -.ENDIF # L10N_framework - -.INCLUDE : target.mk - - diff --git a/crashrep/prj/build.lst b/crashrep/prj/build.lst deleted file mode 100644 index caf9515f8..000000000 --- a/crashrep/prj/build.lst +++ /dev/null @@ -1,5 +0,0 @@ -cr crashrep : TRANSLATIONS:translations sal sysui shell NULL -cr crashrep usr1 - all cr_mkout NULL -cr crashrep\source\all nmake - all cr_sresource NULL -cr crashrep\source\unx nmake - u cr_sunx NULL -cr crashrep\source\win32 nmake - n cr_swin32 cr_sresource NULL diff --git a/crashrep/prj/d.lst b/crashrep/prj/d.lst deleted file mode 100644 index 3ca113bb2..000000000 --- a/crashrep/prj/d.lst +++ /dev/null @@ -1,3 +0,0 @@ -..\%__SRC%\bin\soreport.exe %_DEST%\bin\crashrep.exe -..\%__SRC%\bin\soreport.exe.manifest %_DEST%\bin\crashrep.exe.manifest -..\%__SRC%\bin\crashrep %_DEST%\bin\crashrep diff --git a/crashrep/source/all/crashrep.ulf b/crashrep/source/all/crashrep.ulf deleted file mode 100644 index 2de175391..000000000 --- a/crashrep/source/all/crashrep.ulf +++ /dev/null @@ -1,220 +0,0 @@ -[%WELCOME_CAPTION%] -en-US = "%PRODUCTNAME% %PRODUCTVERSION% Error Report" - - -[%WELCOME_HEADER%] -en-US = "Welcome to the %PRODUCTNAME% %PRODUCTVERSION% Error Report" - - -[%WELCOME_BODY1%] -en-US = "This error report tool gathers information about how %PRODUCTNAME% is working and sends it to Oracle to help improve future versions.\n\n" - - -[%WELCOME_BODY2%] -en-US = "It's easy - just send the report without any further effort on your part by clicking 'Send' in the next dialog, or you can briefly describe how the error occurred and then click 'Send'. If you want to see the report, click the 'Show Report' button. No data will be sent if you click 'Do Not Send'.\n\n" - - -[%WELCOME_BODY3%] -en-US = "Customer Privacy\nThe information gathered is limited to data concerning the state of %PRODUCTNAME% %PRODUCTVERSION% when the error occurred. Other information about passwords or document contents is not collected.\n\nThe information will only be used to improve the quality of %PRODUCTNAME% and will not be shared with third parties.\nFor more information on Oracle's privacy policy, visit\n" - - -[%PRIVACY_URL%] -en-US = "http://www.oracle.com/html/services-privacy-policy.html" - - -[%NEXT_BUTTON%] -en-US = "~Next >>" - - -[%CANCEL_BUTTON%] -en-US = "Cancel" - - -[%OK_BUTTON%] -en-US = "OK" - - -[%REPORT_CAPTION%] -en-US = "%PRODUCTNAME% %PRODUCTVERSION% Error Report" - - -[%REPORT_HEADER%] -en-US = "An error occurred while running %PRODUCTNAME% %PRODUCTVERSION%" - - -[%REPORT_BODY%] -en-US = "The %PRODUCTNAME% %PRODUCTVERSION% Error Report has gathered information that could help Oracle improve %PRODUCTNAME%.\nIn the spaces below, you can enter a title for your crash report and describe the action you were trying to carry out when the error occurred. Then click 'Send'.\n" - - -[%ENTER_TITLE%] -en-US = "Which type of document (e.g. presentation) were you using when the error occurred?" - - -[%ALLOW_CONTACT%] -en-US = "~I allow Oracle to contact me regarding this report." - - -[%ENTER_EMAIL%] -en-US = "Please enter your e-mail address." - - -[%ENTER_DESCRIPTION%] -en-US = "~How were you using %PRODUCTNAME% when the error occurred ?" - - -[%BACK_BUTTON%] -en-US = " << ~Back" - - -[%SEND_BUTTON%] -en-US = "S~end" - - -[%DONOT_SEND_BUTTON%] -en-US = "Do ~Not Send" - - -[%SHOW_REPORT_BUTTON%] -en-US = "Show ~Report..." - - -[%SAVE_REPORT_BUTTON%] -en-US = "~Save Report..." - - -[%SAVE_REPORT_TITLE%] -en-US = "Save Report to" - - -[%ERROR_MSG_SIMPLE_MAPI%] -en-US = "The error report could not be sent because the default e-mail program does not support MAPI.\n Please use a MAPI-compatible e-mail program." - - -[%ERROR_MSG_DISK_FULL%] -en-US = "The error report could not be temporarily saved and could therefore not be sent." - - - -[%ERROR_MSG_SENDMAIL%] -en-US = "The error report could not be sent because 'sendmail' could not be started.\nPlease check the 'sendmail' settings." - - -[%ERROR_MSG_PROXY%] -en-US = "The error report could not be sent. Please check the proxy settings under 'Options' in the Error Report Tool." - - -[%ERROR_MSG_NOCONNECT%] -en-US = "The error report could not be sent because there is no Internet connection. Please check your Internet settings." - - -[%OPTIONS_BUTTON%] -en-US = "~Options..." - - -[%OPTIONS_TITLE%] -en-US = "Options" - - -[%PROXY_SETTINGS_HEADER%] -en-US = "Proxy settings" - - -[%PROXY_SETTINGS_SYSTEM%] -en-US = "Use ~system settings" - - -[%PROXY_SETTINGS_DIRECT%] -en-US = "Use ~direct connection to the Internet" - - -[%PROXY_SETTINGS_MANUAL%] -en-US = "Use ~manual settings" - - -[%PROXY_SETTINGS_ADDRESS%] -en-US = "HT~TP Proxy" - - -[%PROXY_SETTINGS_PORT%] -en-US = "~Port" - - -[%PROXY_SETTINGS_DESCRIPTION%] -en-US = "The %PRODUCTNAME% Error Report tool needs to be connected to the Internet to be able to send error reports.\n\nCompanies often use proxy servers in conjunction with a firewall to protect the network.\n\nIf this applies to your situation, you have to specify the address and port for the server." - - -[%SENDING_REPORT_HEADER%] -en-US = "Sending Error Report" - - -[%SENDING_REPORT_STATUS%] -en-US = "Status: Sending error report" - - -[%SENDING_REPORT_STATUS_FINISHED%] -en-US = "Status: The error report has been sent successfully." - - -[%ERROR_MSG_NOEMAILADDRESS%] -en-US = "You have marked the option 'I allow Oracle to contact me regarding this report.'\nPlease enter your e-mail address." - - -[%MSG_CMDLINE_USAGE%] -en-US = "Usage:" - - -[%MSG_PARAM_PROCESSID%] -en-US = "-p " - - -[%MSG_PARAM_PROCESSID_DESCRIPTION%] -en-US = "Assigns the %PRODUCTNAME% process ID (PID) to the Error Report Tool" - - -[%MSG_PARAM_HELP_DESCRIPTION%] -en-US = "Shows this help text.\nDetailed information can be found in the Setup Guide." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/crashrep/source/all/makefile.mk b/crashrep/source/all/makefile.mk deleted file mode 100644 index 1e66e40a0..000000000 --- a/crashrep/source/all/makefile.mk +++ /dev/null @@ -1,49 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=crashrep -TARGET=crash_res - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -ULFFILES = \ - crashrep.ulf - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -.IF "$(WITH_LANG)"!="" -ALLTAR : $(foreach,i,$(ULFFILES) $(COMMONMISC)$/$(TARGET)$/$i) -.ENDIF # "$(WITH_LANG)"!="" - diff --git a/crashrep/source/unx/main.cxx b/crashrep/source/unx/main.cxx deleted file mode 100644 index 3fb76dea4..000000000 --- a/crashrep/source/unx/main.cxx +++ /dev/null @@ -1,1121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include -#include -#include <_version.h> -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#if defined (LINUX) || (FREEBSD) -#include -#endif - -typedef int SOCKET; - -#define closesocket close -#define SOCKET_ERROR -1 - -#ifdef SOLARIS -const char *basename( const char *filename ) -{ - const char *pSlash = strrchr( filename, '/' ); - - return pSlash ? pSlash + 1 : pSlash; -} -#endif - -using namespace std; - -static bool g_bNoUI = false; -static bool g_bSendReport = false; -static bool g_bLoadReport = false; - -static bool g_bDebugMode = false; -static int g_signal = 0; - -static string g_strProductKey; -static string g_strReportServer; -static unsigned short g_uReportPort = 80; -static string g_buildid; -static string g_strDefaultLanguage; -static string g_strXMLFileName; -static string g_strPStackFileName; -static string g_strChecksumFileName; -static string g_strProgramDir; - -static char g_szStackFile[L_tmpnam] = ""; -static char g_szDescriptionFile[2048] = ""; -static char g_szReportFile[2048] = ""; - -#define SO_CRASHREPORT_MAIL "so-report@sun.com" -#define PSTACK_CMD "pstack %d" - -#ifdef LINUX -#define PMAP_CMD "cat /proc/%d/maps" -#else -#define PMAP_CMD "pmap %d" -#endif - -#define REPORT_SERVER (g_strReportServer.c_str()) -#define REPORT_PORT g_uReportPort - -static string getprogramdir() -{ - return g_strProgramDir; -} - -static const char *getlocale() -{ - const char * locale = getenv( "LC_ALL" ); - - if( NULL == locale ) - locale = getenv( "LC_CTYPE" ); - - if( NULL == locale ) - locale = getenv( "LANG" ); - - if( NULL == locale ) - locale = "C"; - - return locale; -} - -static const char *get_home_dir() -{ - struct passwd *ppwd = getpwuid( getuid() ); - - return ppwd ? (ppwd->pw_dir ? ppwd->pw_dir : "/") : "/"; -} - -static string trim_string( const string& rString ) -{ - string temp = rString; - - while ( temp.length() && (temp[0] == ' ' || temp[0] == '\t') ) - temp.erase( 0, 1 ); - - string::size_type len = temp.length(); - - while ( len && (temp[len-1] == ' ' || temp[len-1] == '\t') ) - { - temp.erase( len - 1, 1 ); - len = temp.length(); - } - - return temp; -} - -static string xml_encode( const string &rString ) -{ - string temp = rString; - string::size_type pos = 0; - - // First replace all occurrences of '&' because it may occur in further - // encoded chardters too - - for( pos = 0; (pos = temp.find( '&', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, "&" ); - - for( pos = 0; (pos = temp.find( '<', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, "<" ); - - for( pos = 0; (pos = temp.find( '>', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, ">" ); - - return temp; -} - -static size_t fcopy( FILE *fpout, FILE *fpin ) -{ - char buffer[1024]; - size_t nBytes; - size_t nBytesWritten = 0; - - while ( 0 != (nBytes = fread( buffer, 1, sizeof(buffer), fpin )) ) - { - nBytesWritten += fwrite( buffer, 1, nBytes, fpout ); - } - - return nBytesWritten; -} - -/* - writes the report to a temp-file - from which it can be reviewed and sent -*/ - -bool write_report( const boost::unordered_map< string, string >& rSettings ) -{ - FILE *fp = fopen( tmpnam( g_szReportFile ), "w" ); - const char *pszUserType = getenv( "STAROFFICE_USERTYPE" ); - - fprintf( fp, - "\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "\n" - "\n" - "\n" - , - pszUserType ? xml_encode( pszUserType ).c_str() : "", - xml_encode(rSettings.find( "CONTACT" )->second).c_str(), - xml_encode(rSettings.find( "EMAIL" )->second).c_str(), - xml_encode(rSettings.find( "TITLE" )->second).c_str(), - g_buildid.length() ? xml_encode( g_buildid ).c_str() : "unknown", - _INPATH, - g_strDefaultLanguage.c_str(), - g_signal, - g_strProductKey.length() ? xml_encode(g_strProductKey).c_str() : "unknown", - xml_encode(getprogramdir()).c_str() - ); - - struct utsname info; - - memset( &info, 0, sizeof(info) ); - uname( &info ); - - fprintf( fp, - "\n" - "\n" - , - xml_encode( info.sysname ).c_str(), - xml_encode( info.version ).c_str(), - xml_encode( info.release ).c_str(), - xml_encode( getlocale() ).c_str() - ); - fprintf( fp, "\n", xml_encode( info.machine ).c_str() ); - fprintf( fp, "\n" ); - - FILE *fpxml = fopen( g_strXMLFileName.c_str(), "r" ); - if ( fpxml ) - { - fcopy( fp, fpxml ); - fclose( fpxml ); - } - - FILE *fpchk = fopen( g_strChecksumFileName.c_str(), "r" ); - if ( fpchk ) - { - fcopy( fp, fpchk ); - fclose( fpchk ); - } - - fprintf( fp, "\n" ); - - fclose( fp ); - - return true; -} - - -bool write_description( const boost::unordered_map< string, string >& rSettings ) -{ - bool bSuccess = false; - FILE *fp = fopen( tmpnam( g_szDescriptionFile ), "w" ); - - if ( fp ) - { - bSuccess = true; - fprintf( fp, "\xEF\xBB\xBF" ); - fprintf( fp, "%s\n", rSettings.find( "DESCRIPTION" )->second.c_str() ); - fclose( fp ); - } - - return bSuccess; -} - -#if 0 -// unused -static void printSettings( const boost::unordered_map& rSettings ) -{ - printf( "Settings:\n" ); - for( boost::unordered_map::const_iterator it = rSettings.begin(); it != rSettings.end(); ++it ) - { - printf( "%s=\"%s\"\n", it->first.c_str(), it->second.c_str() ); - } -} -#endif - -bool save_crash_report( const string& rFileName, const boost::unordered_map< string, string >& /*rSettings*/ ) -{ - bool bSuccess = false; - FILE *fpout = fopen( rFileName.c_str(), "w" ); - - if ( fpout ) - { - FILE *fpin = fopen( g_szStackFile, "r" ); - - if ( fpin ) - { - char buf[1024]; - - while (fgets(buf, sizeof(buf), fpin) != NULL) - { - fputs(buf, fpout); - } - - bSuccess = true; - - fclose ( fpin ); - } - - fclose( fpout ); - } - - return bSuccess; -} - -bool SendHTTPRequest( - FILE *fp, - const char *pszServer, - unsigned short uPort = 80, - const char *pszProxyServer = NULL, - unsigned short uProxyPort = 8080 ) -{ - bool success = false; - - struct hostent *hp; - - if ( pszProxyServer ) - hp = gethostbyname( pszProxyServer ); - else - hp = gethostbyname( pszServer ); - - if ( hp ) - { - SOCKET s = socket( AF_INET, SOCK_STREAM, 0 ); - - if ( s ) - { - struct sockaddr_in address; - - memcpy(&(address.sin_addr.s_addr), *(hp->h_addr_list),sizeof(struct in_addr)); - address.sin_family = AF_INET; - - if ( pszProxyServer ) - address.sin_port = ntohs( uProxyPort ); - else - address.sin_port = ntohs( uPort ); - - if ( 0 == connect( s, (struct sockaddr *)&address, sizeof(struct sockaddr_in)) ) - { - fseek( fp, 0, SEEK_END ); - size_t length = ftell( fp ); - fseek( fp, 0, SEEK_SET ); - - char buffer[2048]; - - if ( pszProxyServer ) - sprintf( buffer, - "POST http://%s:%d/soap/servlet/rpcrouter HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: %d\r\n" - "SOAPAction: \"\"\r\n\r\n", - pszServer, - uPort, - static_cast(length) - ); - else - sprintf( buffer, - "POST /soap/servlet/rpcrouter HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: %d\r\n" - "SOAPAction: \"\"\r\n\r\n", - static_cast(length) - ); - - if ( g_bDebugMode ) - { - printf( "*** Sending HTTP request ***\n\n" ); - printf( "%s", buffer ); - } - - if ( SOCKET_ERROR != send( s, buffer, strlen(buffer), 0 ) ) - { - size_t nBytes; - - do - { - nBytes = fread( buffer, 1, sizeof(buffer), fp ); - - if ( nBytes ) - { - if ( g_bDebugMode ) - fwrite( buffer, 1, nBytes, stdout ); - success = SOCKET_ERROR != send( s, buffer, nBytes, 0 ); - } - } while( nBytes && success ); - - if ( success ) - { - if ( g_bDebugMode ) - printf( "*** Receiving HTTP response ***\n\n" ); - - memset( buffer, 0, sizeof(buffer) ); - success = SOCKET_ERROR != recv( s, buffer, sizeof(buffer), 0 ); - if ( success ) - { - char szHTTPSignature[sizeof(buffer)] = ""; - unsigned uHTTPReturnCode = 0; - - sscanf( buffer, "%s %d ", szHTTPSignature, &uHTTPReturnCode ); - success = uHTTPReturnCode == 200; - } - if ( g_bDebugMode ) - do - { - printf( "%s", buffer ); - memset( buffer, 0, sizeof(buffer) ); - } while ( 0 < recv( s, buffer, sizeof(buffer), 0 ) ); - } - } - - } - - closesocket( s ); - } - } - - return success; -} - -static void WriteSOAPRequest( FILE *fp ) -{ - fprintf( fp, - "\n" - "\n" - "\n" - ); - - fprintf( fp, "\n" ); - fprintf( fp, "This is an autogenerated crash report mail.\n" ); - fprintf( fp, "\n" ); - - FILE *fpin = fopen( g_szReportFile, "r" ); - if ( fpin ) - { - fprintf( fp, - "\n" - "reportmail.xml\n" - "\n" ); - fclose( fpin ); - } - - fpin = fopen( g_szDescriptionFile, "r" ); - if ( fpin ) - { - fprintf( fp, - "\n" - "description.txt\n" - "\n" ); - fclose( fpin ); - }; - - fpin = fopen( g_szStackFile, "r" ); - if ( fpin ) - { - fprintf( fp, - "\n" - "stack.txt\n" - "\n" ); - fclose( fpin ); - }; - - fprintf( fp, - "\n" - "\n" - "\n" - "\n" - ); -} - -struct RequestParams -{ - FILE *fpin; - const char *pServer; - const char *pProxyServer; -}; - - -bool send_crash_report( const boost::unordered_map< string, string >& rSettings ) -{ - if ( 0 == strcasecmp( rSettings.find( "CONTACT" )->second.c_str(), "true" ) && - !trim_string(rSettings.find( "EMAIL" )->second).length() ) - { - return false; - } - - char *endptr = NULL; - - const char *pProxyServer = rSettings.find( "SERVER" )->second.c_str(); - unsigned short uProxyPort = (unsigned short)strtoul( rSettings.find( "PORT" )->second.c_str(), &endptr, 10 ); - - bool bUseProxy = !strcasecmp( "true", rSettings.find( "USEPROXY" )->second.c_str() ); - - - write_description( rSettings ); - write_report( rSettings ); - - bool bSuccess = false; - - FILE *fptemp = tmpfile(); - if ( fptemp ) - { - WriteSOAPRequest( fptemp ); - fseek( fptemp, 0, SEEK_SET ); - - bSuccess = SendHTTPRequest( - fptemp, - REPORT_SERVER, REPORT_PORT, - bUseProxy ? pProxyServer : NULL, - uProxyPort ? uProxyPort : 8080 - ); - - fclose( fptemp ); - - } - - unlink( g_szDescriptionFile ); - unlink( g_szReportFile ); - - return bSuccess; -} - - -static bool append_file( const char *filename, string& rString ) -{ - char buf[1024]; - bool bSuccess = false; - - FILE *fp = fopen( filename, "r" ); - if ( fp ) - { - while (fgets(buf, sizeof(buf), fp) != NULL) - { - rString.append( buf ); - } - fclose( fp ); - bSuccess = true; - } - - return bSuccess; -} - -string crash_get_details( const boost::unordered_map< string, string >& rSettings ) -{ - string aRet; - - write_description( rSettings ); - write_report( rSettings ); - - aRet.append( rSettings.find( "TITLE" )->second.c_str() ); - aRet.append( "\n\n" ); - append_file( g_szDescriptionFile, aRet ); - aRet.append( "\n\n-------\n\n" ); - append_file( g_szReportFile, aRet ); - aRet.append( "\n\n-------\n\n" ); - append_file( g_szStackFile, aRet ); - - unlink( g_szDescriptionFile ); - unlink( g_szReportFile ); - - return aRet; -} - - -// ensure validity of program relative paths -static void setup_program_dir( const char* progname ) -{ - char szCanonicProgPath[PATH_MAX]; - - - if ( realpath( progname, szCanonicProgPath ) ) - { - string aDir = szCanonicProgPath; - - size_t pos = aDir.rfind( '/' ); - // FIXME: search PATH if necessary - assert( pos != string::npos ); - - g_strProgramDir = aDir.substr( 0, pos + 1 ); - aDir.erase( pos ); - chdir( aDir.c_str() ); - } -} - -//************************************************************************* - -static long setup_commandline_arguments( int argc, char** argv, int *pSignal ) -{ - long pid = 0; - int signal = 0; - - for ( int n = 1; n < argc; n++ ) - { - if ( 0 == strcmp( argv[n], "-p" ) ) - { - if ( ++n < argc ) - pid = strtol( argv[n], NULL, 0 ); - } - else if ( 0 == strcmp( argv[n], "-s" ) ) - { - if ( ++n < argc ) - signal = strtol( argv[n], NULL, 0 ); - } - else if ( 0 == strcmp( argv[n], "-debug" ) ) - { - g_bDebugMode = true; - } - else if ( 0 == strcmp( argv[n], "-xml" ) ) - { - if ( ++n < argc ) - g_strXMLFileName = argv[n]; - } - else if ( 0 == strcmp( argv[n], "-stack" ) ) - { - if ( ++n < argc ) - g_strPStackFileName = argv[n]; - } - else if ( 0 == strcmp( argv[n], "-chksum" ) ) - { - if ( ++n < argc ) - g_strChecksumFileName = argv[n]; - } - else if ( 0 == strcmp( argv[n], "-noui" ) ) - { - g_bNoUI = true; - } - else if ( 0 == strcmp( argv[n], "-send" ) ) - { - g_bSendReport = true; - } - else if ( 0 == strcmp( argv[n], "-load" ) ) - { - g_bLoadReport = true; - } - else if ( argv[n] && strlen(argv[n]) ) - { - printf( - "\n%s crash_report %s\n\n" \ - "/?, -h[elp] %s\n\n" \ - "%-20s %s\n\n", - "%MSG_CMDLINE_USAGE%", - "%MSG_PARAM_PROCESSID%", - "%MSG_PARAM_HELP_DESCRIPTION%", - "%MSG_PARAM_PROCESSID%", - "%MSG_PARAM_PROCESSID_DESCRIPTION%" - ); - break; - } - } - - *pSignal = signal; - - return pid; -} - -//************************************************************************* - -static bool read_line( FILE *fp, string& rLine ) -{ - char szBuffer[1024]; - bool bSuccess = false; - bool bEOL = false; - string line; - - - while ( !bEOL && fgets( szBuffer, sizeof(szBuffer), fp ) ) - { - int len = strlen(szBuffer); - - bSuccess = true; - - while ( len && szBuffer[len - 1] == '\n' ) - { - szBuffer[--len] = 0; - bEOL = true; - } - - line.append( szBuffer ); - } - - rLine = line; - return bSuccess; -} - -static string get_script_string( const char *pFileName, const char *pKeyName ) -{ - FILE *fp = fopen( pFileName, "r" ); - string retValue; - - if ( fp ) - { - string line; - string section; - - while ( read_line( fp, line ) ) - { - line = trim_string( line ); - - - string::size_type iEqualSign = line.find( '=', 0 ); - - if ( iEqualSign != string::npos ) - { - string keyname = line.substr( 0, iEqualSign ); - keyname = trim_string( keyname ); - - string value = line.substr( iEqualSign + 1, string::npos ); - value = trim_string( value ); - - if ( value.length() && '\"' == value[0] ) - { - value.erase( 0, 1 ); - - string::size_type iQuotes = value.find( '"', 0 ); - - if ( iQuotes != string::npos ) - value.erase( iQuotes ); - } - - if ( 0 == strcasecmp( keyname.c_str(), pKeyName ) ) - { - retValue = value; - break; - } - } - } - - fclose( fp ); - } - - return retValue; -} - -static string get_profile_string( const char *pFileName, const char *pSectionName, const char *pKeyName, const char *pDefault = NULL ) -{ - FILE *fp = fopen( pFileName, "r" ); - string retValue = pDefault ? pDefault : ""; - - if ( fp ) - { - string line; - string section; - - while ( read_line( fp, line ) ) - { - line = trim_string( line ); - - if ( line.length() && line[0] == '[' ) - { - line.erase( 0, 1 ); - string::size_type end = line.find( ']', 0 ); - - if ( string::npos != end ) - section = trim_string( line.substr( 0, end ) ); - } - else - { - - string::size_type iEqualSign = line.find( '=', 0 ); - - if ( iEqualSign != string::npos ) - { - string keyname = line.substr( 0, iEqualSign ); - keyname = trim_string( keyname ); - - string value = line.substr( iEqualSign + 1, string::npos ); - value = trim_string( value ); - - if ( - 0 == strcasecmp( section.c_str(), pSectionName ) && - 0 == strcasecmp( keyname.c_str(), pKeyName ) - ) - { - retValue = value; - break; - } - } - } - } - - fclose( fp ); - } - - return retValue; -} - -static string get_environment_string( const char *pEnvName ) -{ - const char *pEnvValue = getenv( pEnvName ); - - if ( pEnvValue ) - return pEnvValue; - else - return ""; -} - -static string read_from_file( const string& rFileName ) -{ - string content; - FILE *fp = fopen( rFileName.c_str(), "r" ); - - if ( fp ) - { - char buffer[256 + 1]; - size_t nBytesRead; - - while( 0 != ( nBytesRead = fread( buffer, 1, sizeof(buffer) - 1, fp ) ) ) - { - buffer[nBytesRead] = 0; - content += buffer; - } - - fclose( fp ); - } - - return content; -} - -#define RCFILE ".crash_reportrc" -#define XMLFILE ".crash_report_frames" -#define CHKFILE ".crash_report_checksum" -#define LCKFILE ".crash_report_unsent" -#define PRVFILE ".crash_report_preview" - -static void load_crash_data() -{ - g_strXMLFileName = get_home_dir(); - g_strXMLFileName += "/"; - g_strXMLFileName += string(XMLFILE); - - g_strChecksumFileName = get_home_dir(); - g_strChecksumFileName += "/"; - g_strChecksumFileName += string(CHKFILE); -} - -static bool write_crash_data() -{ - bool success = true; - string sFile = get_home_dir(); - - sFile += "/"; - sFile += string(XMLFILE); - - FILE *fp = fopen( sFile.c_str(), "w" ); - - if ( fp ) - { - FILE *fpin = fopen( g_strXMLFileName.c_str(), "r" ); - - if ( fpin ) - { - fcopy( fp, fpin ); - fclose( fpin ); - } - - fclose( fp ); - } - - sFile = get_home_dir(); - - sFile += "/"; - sFile += string(CHKFILE); - - fp = fopen( sFile.c_str(), "w" ); - - if ( fp ) - { - FILE *fpin = fopen( g_strChecksumFileName.c_str(), "r" ); - - if ( fpin ) - { - fcopy( fp, fpin ); - fclose( fpin ); - } - - fclose( fp ); - } - - sFile = get_home_dir(); - - sFile += "/"; - sFile += string(LCKFILE); - - fp = fopen( sFile.c_str(), "w" ); - - if ( fp ) - { - fprintf( fp, "Unsent\n" ); - fclose( fp ); - } - - return success; -} - -#if 0 -// unused -static bool write_settings( const boost::unordered_map< string, string >& rSettings ) -{ - bool success = false; - string sRCFile = get_home_dir(); - - sRCFile += "/"; - sRCFile += string(RCFILE); - - FILE *fp = fopen( sRCFile.c_str(), "w" ); - - if ( fp ) - { - fprintf( fp, "[Options]\n" ); - fprintf( fp, "UseProxy=%s\n", rSettings.find( "USEPROXY" )->second.c_str() ); - fprintf( fp, "ProxyServer=%s\n", rSettings.find( "SERVER" )->second.c_str() ); - fprintf( fp, "ProxyPort=%s\n", rSettings.find( "PORT" )->second.c_str() ); - fprintf( fp, "ReturnAddress=%s\n", rSettings.find( "EMAIL" )->second.c_str() ); - fprintf( fp, "AllowContact=%s\n", rSettings.find( "CONTACT" )->second.c_str() ); - fclose( fp ); - } - - return success; -} -#endif - -static void read_settings( boost::unordered_map< string, string >& rSettings ) -{ - string sRCFile = get_home_dir(); - - sRCFile += "/"; - sRCFile += string(RCFILE); - - rSettings[ "EMAIL" ] = get_profile_string( sRCFile.c_str(), "Options", "ReturnAddress" ); - rSettings[ "SERVER" ] = get_profile_string( sRCFile.c_str(), "Options", "ProxyServer" ); - rSettings[ "PORT" ] = get_profile_string( sRCFile.c_str(), "Options", "ProxyPort" ); - rSettings[ "USEPROXY" ] = get_profile_string( sRCFile.c_str(), "Options", "UseProxy" ); - rSettings[ "CONTACT" ] = get_profile_string( sRCFile.c_str(), "Options", "AllowContact" ); - rSettings[ "DESCRIPTION" ] = ""; - rSettings[ "TITLE" ] = ""; -} - -static void read_settings_from_environment( boost::unordered_map< string, string >& rSettings ) -{ - string strEnv; - - strEnv = get_environment_string( "ERRORREPORT_RETURNADDRESS" ); - if ( strEnv.length() ) - { - rSettings[ "EMAIL" ] = strEnv; - if ( !(rSettings.find( "CONTACT" )->second).length() ) - rSettings[ "CONTACT" ] = "true"; - } - else if ( !(rSettings.find( "CONTACT" )->second).length() ) - rSettings[ "CONTACT" ] = "false"; - - - strEnv = get_environment_string( "ERRORREPORT_HTTPPROXYSERVER" ); - if ( strEnv.length() ) - rSettings[ "SERVER" ] = strEnv; - - strEnv = get_environment_string( "ERRORREPORT_HTTPPROXYPORT" ); - if ( strEnv.length() ) - rSettings[ "PORT" ] = strEnv; - - strEnv = get_environment_string( "ERRORREPORT_HTTPCONNECTIONTYPE" ); - if ( strEnv.length() ) - rSettings[ "USEPROXY" ] = 0 == strcasecmp( strEnv.c_str(), "MANUALPROXY" ) ? "true" : "false"; - - strEnv = get_environment_string( "ERRORREPORT_BODYFILE" ); - if ( strEnv.length() ) - rSettings[ "DESCRIPTION" ] = read_from_file( strEnv ); - - strEnv = get_environment_string( "ERRORREPORT_SUBJECT" ); - if ( strEnv.length() ) - rSettings[ "TITLE" ] = strEnv; -} - -static bool setup_version() -{ - if ( !getenv( "PRODUCTNAME" ) ) - { - string productkey = get_profile_string( "bootstraprc", "Bootstrap", "ProductKey" ); - - g_strProductKey = productkey; - - if ( productkey.length() ) - { - static string productname; - static string productversion; - string::size_type iSpace = productkey.find( ' ', 0 ); - - if ( string::npos != iSpace ) - { - productname = productkey.substr( 0, iSpace ); - productversion = productkey.substr( iSpace + 1, string::npos ); - } - else - productname = productkey; - - productname.insert( 0, "PRODUCTNAME=" ); - putenv( (char *)productname.c_str() ); - - productversion.insert( 0, "PRODUCTVERSION=" ); - putenv( (char *)productversion.c_str() ); - } - } - - g_buildid = get_profile_string( "versionrc", "Version", "BuildId" ); - g_strDefaultLanguage = get_script_string( "instdb.ins", "DefaultLanguage" ); - - g_strReportServer = get_profile_string( "bootstraprc", "ErrorReport", "ErrorReportServer" ); - - string strReportPort = get_profile_string( "bootstraprc", "ErrorReport", "ErrorReportPort", "80" ); - char *endptr = NULL; - unsigned short uReportPort = (unsigned short)strtoul( strReportPort.c_str(), &endptr, 10 ); - g_uReportPort = uReportPort ? uReportPort : 80; - - return 0 != g_strReportServer.length(); -} - -#if 0 -// Use gconftool-2 to determine if gnome accessiblity is enabled -// unused -static bool get_accessibility_state() -{ - bool bAccessible = false; - FILE *fin = popen( "gconftool-2 -g /desktop/gnome/interface/accessibility", "r"); - - if ( fin ) - { - char buffer[sizeof("true")]; - - bAccessible = fgets( buffer, sizeof(buffer), fin ) && 0 == strcmp( buffer, "true" ); - - pclose( fin ); - } - - return bAccessible; -} -#endif - -int main( int argc, char** argv ) -{ - freopen( "/dev/null", "w", stderr ); - - setup_program_dir( argv[0] ); - - // Don't start if accessiblity is enabled or report server is not given - - if ( setup_version() ) - { - /*long pid =*/ setup_commandline_arguments( argc, argv, &g_signal ); - - if ( g_bLoadReport ) - { - load_crash_data(); - } - - if ( g_bSendReport ) - { - boost::unordered_map< string, string > aDialogSettings; - - read_settings( aDialogSettings ); - read_settings_from_environment( aDialogSettings ); - - send_crash_report( aDialogSettings ); - } - else - { - boost::unordered_map< string, string > aDialogSettings; - - read_settings( aDialogSettings ); - read_settings_from_environment( aDialogSettings ); - - write_crash_data(); - write_report( aDialogSettings ); - - string sPreviewFile = get_home_dir(); - sPreviewFile += "/"; - sPreviewFile += string(PRVFILE); - - FILE *fpout = fopen( sPreviewFile.c_str(), "w+" ); - if ( fpout ) - { - FILE *fpin = fopen( g_szReportFile, "r" ); - if ( fpin ) - { - fcopy( fpout, fpin ); - fclose( fpin ); - } - fclose( fpout ); - } - - unlink( g_szReportFile ); - } - - if ( g_bLoadReport ) - { - unlink( g_strXMLFileName.c_str() ); - unlink( g_strChecksumFileName.c_str() ); - } - - unlink( g_szStackFile ); - - return 0; - } - - return -1; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/crashrep/source/unx/makefile.mk b/crashrep/source/unx/makefile.mk deleted file mode 100755 index d0d04ff58..000000000 --- a/crashrep/source/unx/makefile.mk +++ /dev/null @@ -1,75 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=crashrep -TARGET=crashrep -TARGETTYPE=CUI - -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO -LIBSALCPPRT=$(0) - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -# Only build crash reporter if either a product build with debug info -# or a non-pro build is done. - -.IF "$(ENABLE_CRASHDUMP)" != "" || "$(PRODUCT)" == "" - -SOLARLIB!:=$(SOLARLIB:s/jre/jnore/) - -OBJFILES=\ - $(OBJ)$/main.obj - -APP1NOSAL=TRUE -APP1TARGET=$(TARGET) -APP1OBJS=$(OBJFILES) -APP1RPATH=BRAND - -.IF "$(OS)" != "FREEBSD" && "$(OS)" != "MACOSX" && "$(OS)"!="NETBSD" && \ - "$(OS)" != "DRAGONFLY" -APP1STDLIBS+=-ldl -lnsl -.ENDIF -.IF "$(OS)" == "SOLARIS" -APP1STDLIBS+=-lsocket -.ENDIF - -.ENDIF # "$(ENABLE_CRASHDUMP)" != "" || "$(PRODUCT)" == "" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -$(OBJ)$/main.obj: $(INCCOM)$/_version.h - -# Building crash_report diff --git a/crashrep/source/win32/base64.cpp b/crashrep/source/win32/base64.cpp deleted file mode 100644 index 15fdc0c39..000000000 --- a/crashrep/source/win32/base64.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "base64.h" - -static const char base64_tab[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -extern "C" size_t base64_encode( FILE *fin, FILE *fout ) -{ - size_t nLineLength = 0; - size_t nBytesWritten = 0; - - size_t nBytes = 0; - - do - { - unsigned char in_buffer[3]; - - memset( in_buffer, 0, sizeof(in_buffer) ); - nBytes = fread( in_buffer, 1, sizeof(in_buffer), fin ); - - if ( nBytes ) - { - unsigned long value = - ((unsigned long)in_buffer[0]) << 16 | - ((unsigned long)in_buffer[1]) << 8 | - ((unsigned long)in_buffer[2]) << 0; - - unsigned char out_buffer[4]; - - memset( out_buffer, '=', sizeof(out_buffer) ); - - out_buffer[0] = base64_tab[(value >> 18) & 0x3F]; - out_buffer[1] = base64_tab[(value >> 12) & 0x3F]; - - if ( nBytes > 1 ) - { - out_buffer[2] = base64_tab[(value >> 6) & 0x3F]; - if ( nBytes > 2 ) - out_buffer[3] = base64_tab[(value >> 0) & 0x3F]; - } - - if ( nLineLength >= 76 ) - { - fputs( "\n", fout ); - nLineLength = 0; - } - - nBytesWritten += fwrite( out_buffer, 1, sizeof(out_buffer), fout ); - nLineLength += sizeof(out_buffer); - } - } while ( nBytes ); - - return nBytesWritten; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/crashrep/source/win32/base64.h b/crashrep/source/win32/base64.h deleted file mode 100644 index 7133d40af..000000000 --- a/crashrep/source/win32/base64.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __BASE64_H -#define __BASE64_H - -#ifndef _INC_STDIO -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -size_t base64_encode( FILE *fin, FILE *fout ); - -#ifdef __cplusplus -} -#endif - -#endif /* __BASE64_H */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/crashrep/source/win32/ctrylnglist.txt b/crashrep/source/win32/ctrylnglist.txt deleted file mode 100755 index ec2196e4d..000000000 --- a/crashrep/source/win32/ctrylnglist.txt +++ /dev/null @@ -1,29 +0,0 @@ -1 LANG_ENGLISH SUBLANG_ENGLISH_US -3 LANG_PORTUGUESE SUBLANG_PORTUGUESE -4 LANG_GERMAN SUBLANG_GERMAN -7 LANG_RUSSIAN SUBLANG_DEFAULT -30 LANG_GREEK SUBLANG_DEFAULT -31 LANG_DUTCH SUBLANG_DUTCH -33 LANG_FRENCH SUBLANG_FRENCH -34 LANG_SPANISH SUBLANG_SPANISH -35 LANG_FINNISH SUBLANG_DEFAULT -36 LANG_HUNGARIAN SUBLANG_DEFAULT -39 LANG_ITALIAN SUBLANG_ITALIAN -42 LANG_CZECH SUBLANG_DEFAULT -43 LANG_SLOVAK SUBLANG_DEFAULT -44 LANG_ENGLISH SUBLANG_ENGLISH_UK -45 LANG_DANISH SUBLANG_DEFAULT -46 LANG_SWEDISH SUBLANG_SWEDISH -47 LANG_NORWEGIAN SUBLANG_NORWEGIAN_BOKMAL -48 LANG_POLISH SUBLANG_DEFAULT -49 LANG_GERMAN SUBLANG_DEFAULT -55 LANG_PORTUGUESE SUBLANG_PORTUGUESE_BRAZILIAN -81 LANG_JAPANESE SUBLANG_DEFAULT -82 LANG_KOREAN SUBLANG_KOREAN -86 LANG_CHINESE SUBLANG_CHINESE_SIMPLIFIED -88 LANG_CHINESE SUBLANG_CHINESE_TRADITIONAL -90 LANG_TURKISH SUBLANG_DEFAULT -96 LANG_ARABIC SUBLANG_DEFAULT -97 LANG_HEBREW SUBLANG_DEFAULT -37 LANG_CATALAN SUBLANG_DEFAULT -66 LANG_THAI SUBLANG_DEFAULT diff --git a/crashrep/source/win32/makefile.mk b/crashrep/source/win32/makefile.mk deleted file mode 100644 index 21c0ab390..000000000 --- a/crashrep/source/win32/makefile.mk +++ /dev/null @@ -1,88 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=crashrep -TARGET=soreport -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -TARGETTYPE=GUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Resources ---------------------------------------------------- - -RCFILES=$(RES)$/$(TARGET).rc - -# --- Files -------------------------------------------------------- - -OBJFILES=\ - $(OBJ)$/soreport.obj\ - $(OBJ)$/base64.obj - -.IF "$(WITH_LANG)"!="" -ULFDIR:=$(COMMONMISC)$/crash_res -.ELSE # "$(WITH_LANG)"!="" -ULFDIR:=..$/all -.ENDIF # "$(WITH_LANG)"!="" -LNGFILES=$(ULFDIR)$/crashrep.ulf - -APP1OBJS=$(OBJFILES) - -APP1NOSAL=TRUE - -APP1TARGET=$(TARGET) -APP1RPATH=BRAND - -STDLIB1=\ - $(SALLIB)\ - $(GDI32LIB)\ - $(COMCTL32LIB)\ - $(COMDLG32LIB)\ - $(ADVAPI32LIB)\ - $(WS2_32LIB)\ - $(SHELL32LIB)\ - $(DBGHELPLIB)\ - psapi.lib - -APP1NOSVRES=$(RES)$/$(TARGET).res - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -$(OBJ)$/soreport.obj: $(INCCOM)$/_version.h - -# Generate the native Windows resource file -# using lngconvex.exe - -$(RCFILES) : $(LNGFILES) makefile.mk rcfooter.txt rcheader.txt rctemplate.txt ctrylnglist.txt - $(LNGCONVEX) -ulf $(ULFDIR)$/crashrep.ulf -rc $(RES)$/$(TARGET).rc -rct rctemplate.txt -rch rcheader.txt -rcf rcfooter.txt - diff --git a/crashrep/source/win32/rcfooter.txt b/crashrep/source/win32/rcfooter.txt deleted file mode 100755 index 43c268ca9..000000000 --- a/crashrep/source/win32/rcfooter.txt +++ /dev/null @@ -1 +0,0 @@ -// Footer \ No newline at end of file diff --git a/crashrep/source/win32/rcheader.txt b/crashrep/source/win32/rcheader.txt deleted file mode 100755 index 22821e5f9..000000000 --- a/crashrep/source/win32/rcheader.txt +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* -# - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -#*************************************************************************/ - -// Header -#include "resource.h" -#if defined(_MSC_VER) && (_MSC_VER < 1500) -#include "winres.h" -#else -#define WINVER 0x0500 -#include -#define LB_ADDSTRING (WM_USER+1) -#define CB_ADDSTRING (WM_USER+3) -#define IDC_STATIC (-1) -#endif - -#define VER_FIRSTYEAR 2003 - -#include "version.hrc" - -#ifdef FONTSIZE -#undef FONTSIZE -#endif -#define LANG_KOREAN 82 -#define LANG_CHINESE 86 -#define LANG_JAPANESE 81 -#define PLACEHOLDER LANGUAGE - -// ----------------------------------------------------------------------- -// version information -// ----------------------------------------------------------------------- - -VS_VERSION_INFO versioninfo - fileversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT - productversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT - fileflagsmask 0x3F - fileflags -#if defined(DEBUG) - VS_FF_DEBUG | -#endif -#ifdef VER_PREL - VS_FF_PRERELEASE | -#endif - 0 - fileos VOS_NT_WINDOWS32 - filetype VFT_APP - { - block "StringFileInfo" - { - block "040904E4" - { - // International StringTable - value "CompanyName", "OpenOffice.org\0" - value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" - value "FileVersion", PPS(VER_LEVEL) "\0" - value "ProductVersion", PPS(VER_LEVEL) "\0" - value "OriginalFilename", "SOREPORT.EXE\0" - value "InternalName", "CrashReport\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" - } - } - - block "VarFileInfo" - { - value "Translation", 0x0409, 1252 - } - } - - diff --git a/crashrep/source/win32/rctemplate.txt b/crashrep/source/win32/rctemplate.txt deleted file mode 100755 index 8c0eebaa7..000000000 --- a/crashrep/source/win32/rctemplate.txt +++ /dev/null @@ -1,192 +0,0 @@ - -#ifdef FONTSIZE -#undef FONTSIZE -#endif - -//#if ( %PLACEHOLDER% == LANG_KOREAN ) || ( %PLACEHOLDER% == LANG_CHINESE ) || ( %PLACEHOLDER% == LANG_JAPANESE ) -//#define FONTSIZE 9 -//#define LANG_CJK -//#else -//#define FONTSIZE 8 -//#endif - -#define FONTSIZE 9 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_WELCOME_PAGE DIALOGEX 0, 41, 327, 195 -STYLE DS_SETFONT | DS_CONTROL | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 0, 0, 0x0 -#endif -BEGIN - CONTROL "",IDC_RICHEDIT21,"RICHEDIT20W",TCS_RAGGEDRIGHT | ES_READONLY | - TCS_MULTISELECT | WS_VSCROLL,7,7,313,151 -END - -IDD_REPORT_PAGE DIALOGEX 0, 41, 327, 195 -STYLE DS_SETFONT | DS_CONTROL | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 0, 0, 0x0 -#endif -BEGIN - LTEXT "1",IDC_REPORT_INTRO,7,7,313,48 - LTEXT "2",IDC_ENTER_TITLE,7,58,320,8 - EDITTEXT IDC_EDIT_TITLE,7,68,235,14,ES_AUTOHSCROLL - LTEXT "3",IDC_ENTER_DESCRIPTION,7,86,320,8 - EDITTEXT IDC_EDIT_DESCRIPTION,7,97,235,49,ES_MULTILINE | - ES_WANTRETURN | WS_VSCROLL - CONTROL "4",IDC_ALLOW_CONTACT,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,7,148,303,10 - LTEXT "4a",IDC_LABEL_EMAIL,18,162,226, - 8 - EDITTEXT IDC_EDIT_EMAIL,17,173,224,14,ES_AUTOHSCROLL - PUSHBUTTON "5",IDC_SHOW_REPORT,249,97,74,14 - PUSHBUTTON "6",IDC_OPTIONS,249,115,74,14 - PUSHBUTTON "7",IDC_SAVE_REPORT,249,134,74,14 -END - -IDD_DIALOG_FRAME DIALOGEX 0, 0, 331, 265 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | - DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "1" -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 400, 0, 0x1 -#endif -BEGIN - LTEXT "",IDC_STATIC,0,0,331,40 - CONTROL "",IDC_HEADER,"RICHEDIT20W",TCS_VERTICAL | TCS_MULTISELECT | ES_READONLY, - 7,7,316,33 - PUSHBUTTON "1",IDBACK,125,244,60,14 - PUSHBUTTON "2",IDNEXT,194,244,60,14 - PUSHBUTTON "3",IDFINISH,194,244,60,14 - PUSHBUTTON "4",IDCANCEL,263,244,60,14 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,40,331,1 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,0,237,331,1 -END - -IDD_PREVIEW_FRAME DIALOGEX 0, 0, 251, 185 -STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | - DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | - WS_SIZEBOX -CAPTION "1" -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 400, 0, 0x1 -#endif -BEGIN - CONTROL "",IDC_EDIT_PREVIEW,"RICHEDIT20W",ES_MULTILINE | - ES_AUTOVSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | WS_HSCROLL | - TCS_MULTISELECT | ES_READONLY | TCS_RAGGEDRIGHT | - WS_BORDER - , - 7,7,237,150 - DEFPUSHBUTTON "4",IDOK,193,164,50,14 -END - - -IDD_OPTIONS_FRAME DIALOGEX 0, 0, 295, 182 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | - WS_SYSMENU -CAPTION "1" -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 400, 0, 0x1 -#endif -BEGIN - GROUPBOX "1",IDC_PROXY_SETTINGS,7,7,222,92 - CONTROL "2",IDC_RADIO_SYSTEM,"Button",BS_AUTORADIOBUTTON,15,27, - 208,10 - CONTROL "3",IDC_RADIO_DIRECT,"Button",BS_AUTORADIOBUTTON,15,39, - 208,10 - CONTROL "4",IDC_RADIO_MANUAL,"Button",BS_AUTORADIOBUTTON,15,51, - 208,10 - LTEXT "5",IDC_LABEL_PROXYSERVER,27,64,148,8 - EDITTEXT IDC_EDIT_PROXYSERVER,27,76,148,14,ES_AUTOHSCROLL - LTEXT ":",IDC_STATIC,178,78,8,8 - LTEXT "6",IDC_LABEL_PROXYPORT,184,64,40,8 - EDITTEXT IDC_EDIT_PROXYPORT,184,76,40,14,ES_AUTOHSCROLL | - ES_NUMBER - DEFPUSHBUTTON "7",IDOK,238,7,50,14 - PUSHBUTTON "8",IDCANCEL,238,26,50,14 - CONTROL "",IDC_PROXY_DESCRIPTION,"RichEdit20W",ES_MULTILINE | - ES_READONLY | WS_VSCROLL,7,106,281,69 -END - -IDD_SENDING_STATUS DIALOGEX 0, 0, 216, 73 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | - WS_SYSMENU -CAPTION "1" -#ifndef LANG_CJK -FONT FONTSIZE, "MS Shell Dlg", 400, 0, 0x1 -#endif -BEGIN - PUSHBUTTON "2",IDCANCEL,159,52,50,14 - LTEXT "3",IDC_SENDING_REPORT_STATUS,7,7,202,34 -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_WELCOME_CAPTION %WELCOME_CAPTION% - IDS_WELCOME_HEADER %WELCOME_HEADER% - IDS_WELCOME_BODY1 %WELCOME_BODY1% - IDS_WELCOME_BODY2 %WELCOME_BODY2% - IDS_WELCOME_BODY3 %WELCOME_BODY3% - IDS_PRIVACY_URL %PRIVACY_URL% - IDS_NEXT_BUTTON %NEXT_BUTTON% - IDS_CANCEL_BUTTON %CANCEL_BUTTON% - IDS_OK_BUTTON %OK_BUTTON% -END - -STRINGTABLE -BEGIN - IDS_REPORT_CAPTION %REPORT_CAPTION% - IDS_REPORT_HEADER %REPORT_HEADER% - IDS_REPORT_INTRO %REPORT_BODY% - IDS_ENTER_TITLE %ENTER_TITLE% - IDS_ALLOW_CONTACT %ALLOW_CONTACT% - IDS_ENTER_DESCRIPTION %ENTER_DESCRIPTION% - IDS_BACK_BUTTON %BACK_BUTTON% - IDS_SEND_BUTTON %SEND_BUTTON% - IDS_DONOT_SEND_BUTTON %DONOT_SEND_BUTTON% - IDS_SHOW_REPORT_BUTTON %SHOW_REPORT_BUTTON% - IDS_SAVE_REPORT_BUTTON %SAVE_REPORT_BUTTON% - IDS_OPTIONS_BUTTON %OPTIONS_BUTTON% - IDS_LABEL_EMAIL %ENTER_EMAIL% -END - -STRINGTABLE -BEGIN - IDS_ERROR_MSG_SIMPLE_MAPI %ERROR_MSG_SIMPLE_MAPI% - IDS_ERROR_MSG_DISK_FULL %ERROR_MSG_DISK_FULL% - IDS_ERROR_MSG_PROXY %ERROR_MSG_PROXY% - IDS_ERROR_MSG_NOCONNECT %ERROR_MSG_NOCONNECT% - IDS_ERROR_MSG_NOEMAILADDRESS %ERROR_MSG_NOEMAILADDRESS% - IDS_SENDING_REPORT_HEADER %SENDING_REPORT_HEADER% - IDS_SENDING_REPORT_STATUS %SENDING_REPORT_STATUS% - IDS_SENDING_REPORT_STATUS_FINISHED %SENDING_REPORT_STATUS_FINISHED% - IDS_MSG_CMDLINE_USAGE %MSG_CMDLINE_USAGE% - IDS_MSG_PARAM_PROCESSID %MSG_PARAM_PROCESSID% - IDS_MSG_PARAM_PROCESSID_DESCRIPTION %MSG_PARAM_PROCESSID_DESCRIPTION% - IDS_MSG_PARAM_HELP_DESCRIPTION %MSG_PARAM_HELP_DESCRIPTION% -END - -STRINGTABLE -BEGIN - IDS_OPTIONS_CAPTION %OPTIONS_TITLE% - IDS_PROXY_SETTINGS_HEADER %PROXY_SETTINGS_HEADER% - IDS_PROXY_SYSTEM %PROXY_SETTINGS_SYSTEM% - IDS_PROXY_DIRECT %PROXY_SETTINGS_DIRECT% - IDS_PROXY_MANUAL %PROXY_SETTINGS_MANUAL% - IDS_LABEL_PROXYSERVER %PROXY_SETTINGS_ADDRESS% - IDS_LABEL_PROXYPORT %PROXY_SETTINGS_PORT% - IDS_PROXY_DESCRIPTION %PROXY_SETTINGS_DESCRIPTION% -END diff --git a/crashrep/source/win32/resource.h b/crashrep/source/win32/resource.h deleted file mode 100644 index c870e2578..000000000 --- a/crashrep/source/win32/resource.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by soreport.rc -// -#define IDD_DIALOG_FRAME 101 -#define IDS_WELCOME_CAPTION 102 -#define IDS_WELCOME_HEADER 103 -#define IDS_WELCOME_BODY1 104 -#define IDS_PRIVACY_URL 105 -#define IDS_NEXT_BUTTON 106 -#define IDD_WELCOME_PAGE 107 -#define IDS_CANCEL_BUTTON 107 -#define IDD_REPORT_PAGE 108 -#define IDS_REPORT_CAPTION 108 -#define IDS_REPORT_HEADER 109 -#define IDS_DESCRIPTION 110 -#define IDS_REPORT_INTRO 110 -#define IDS_ENTER_TITLE 111 -#define IDS_ALLOW_CONTACT 112 -#define IDS_ENTER_DESCRIPTION 113 -#define IDS_BACK_BUTTON 114 -#define IDS_SEND_BUTTON 115 -#define IDS_DONOT_SEND_BUTTON 116 -#define IDS_SHOW_REPORT_BUTTON 117 -#define IDS_SAVE_REPORT_BUTTON 118 -#define IDD_PREVIEW_FRAME 119 -#define IDS_ERROR_MSG_SIMPLE_MAPI 120 -#define IDS_ERROR_MSG_DISK_FULL 121 -#define IDS_OK_BUTTON 122 -#define IDS_OPTIONS_BUTTON 123 -#define IDS_LABEL_EMAIL 124 -#define IDD_OPTIONS_FRAME 125 -#define IDS_OPTIONS_CAPTION 126 -#define IDS_PROXY_SETTINGS_HEADER 127 -#define IDS_PROXY_SYSTEM 128 -#define IDS_PROXY_DIRECT 129 -#define IDS_PROXY_MANUAL 130 -#define IDS_LABEL_PROXYSERVER 131 -#define IDS_LABEL_PROXYPORT 132 -#define IDS_PROXY_DESCRIPTION 133 -#define IDS_ERROR_MSG_PROXY 134 -#define IDS_ERROR_MSG_NOCONNECT 135 -#define IDS_SENDING_REPORT_HEADER 136 -#define IDS_SENDING_REPORT_STATUS 137 -#define IDS_SENDING_REPORT_STATUS_FINISHED 138 -#define IDD_SENDING_STATUS 139 -#define IDS_WELCOME_BODY2 140 -#define IDS_WELCOME_BODY3 141 -#define IDS_ERROR_MSG_NOEMAILADDRESS 142 -#define IDS_MSG_CMDLINE_USAGE 143 -#define IDS_MSG_PARAM_PROCESSID 144 -#define IDS_MSG_PARAM_PROCESSID_DESCRIPTION 145 -#define IDS_MSG_PARAM_HELP_DESCRIPTION 146 -#define IDC_RICHEDIT_HEADER 1005 -#define IDC_RICHEDIT21 1006 -#define IDC_ALLOW_CONTACT 1007 -#define IDC_EDIT_TITLE 1008 -#define IDC_EDIT_DESCRIPTION 1009 -#define IDC_SHOW_REPORT 1010 -#define IDC_SAVE_REPORT 1011 -#define IDNEXT 1012 -#define IDBACK 1014 -#define IDC_REPORT_INTRO 1015 -#define IDC_ENTER_TITLE 1016 -#define IDFINISH 1016 -#define IDC_ENTER_DESCRIPTION 1017 -#define IDC_EDIT3 1018 -#define IDC_HEADER 1019 -#define IDC_STATICBK 1020 -#define IDC_EDIT_PREVIEW 1021 -#define IDC_EDIT_EMAIL 1022 -#define IDC_OPTIONS 1023 -#define IDC_PROXY_SETTINGS 1024 -#define IDC_RADIO_SYSTEM 1025 -#define IDC_RADIO_DIRECT 1026 -#define IDC_RADIO_MANUAL 1027 -#define IDC_LABEL_PROXYSERVER 1028 -#define IDC_LABEL_PROXYPORT 1029 -#define IDC_EDIT_PROXYSERVER 1030 -#define IDC_EDIT_PROXYPORT 1031 -#define IDC_LABEL_EMAIL 1032 -#define IDC_PROXY_DESCRIPTION 1033 -#define IDC_SENDING_REPORT_STATUS 1034 -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 147 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1035 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/crashrep/source/win32/soreport.cpp b/crashrep/source/win32/soreport.cpp deleted file mode 100644 index b5d4c7834..000000000 --- a/crashrep/source/win32/soreport.cpp +++ /dev/null @@ -1,2982 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define UNICODE -#define WIN32_LEAN_AND_MEAN -#if defined _MSC_VER -#pragma warning(push, 1) -#pragma warning(disable:4917) -#endif -#include -#include - -#include -#include -#include -#include - -#include -#include - -#define _UNICODE -#include - -#define _RICHEDIT_VER 0x0200 -#include - -#if defined _MSC_VER -#pragma warning(pop) -#endif - -#if _RICHEDIT_VER >= 0x0200 -#define RICHEDIT TEXT("riched20.dll") -#else -#define RICHEDIT TEXT("riched32.dll") -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include <_version.h> - -#include "resource.h" -#include "base64.h" - -#define FORMATBUFSIZE (8*1024) -#define MAX_TEXT_BUFFER (32*1024-1) -#define MAX_HOSTNAME (1024) - -#ifdef __MINGW32__ -#include -#else -#include -#endif - -#ifdef _UNICODE -#define tstring wstring -#else -#define tstring string -#endif - -using namespace ::std; - - -wstring g_wstrProductKey; -string g_strDefaultLanguage; -FILE *g_fpStackFile = NULL; -FILE *g_fpChecksumFile = NULL; -DWORD g_dwExceptionCode = 0; - -CHAR g_szReportServerA[MAX_HOSTNAME] = ""; -USHORT g_uReportPort = 80; - -TCHAR g_szBuildId[256] = TEXT(""); - -TCHAR g_szDumpFileName[MAX_PATH] = TEXT(""); - -CHAR g_szDumpFileNameA[MAX_PATH] = ""; -CHAR g_szCommentFileNameA[MAX_PATH] = ""; -CHAR g_szReportFileNameA[MAX_PATH] = ""; - - -bool g_bNoUserInterface = false; -bool g_bSendReport = false; -bool g_bLoadReport = false; - -#define REPORT_SERVER g_szReportServerA -#define REPORT_PORT g_uReportPort - - -//*************************************************************************** -// tmpfile from msvcrt creates the temporary file in the root of the current -// volume and can fail. - -static FILE *_xfopen( const _TCHAR *file, const _TCHAR *mode ) -{ -#ifdef UNICODE - if ( (LONG)GetVersion() < 0 ) - { - char afile[MAX_PATH]; - char amode[16]; - - WideCharToMultiByte( CP_ACP, 0, file, -1, afile, MAX_PATH, NULL, NULL ); - WideCharToMultiByte( CP_ACP, 0, mode, -1, amode, 16, NULL, NULL ); - - - return fopen( afile, amode ); - } - else -#endif - return _tfopen( file, mode ); -} - - -static FILE *_tmpfile(void) -{ - FILE *fp = NULL; - - TCHAR szTempPath[MAX_PATH]; - - if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) ) - { - TCHAR szFileName[MAX_PATH]; - - if ( GetTempFileName( szTempPath, TEXT("CRT"), 0, szFileName ) ) - { - HANDLE hFile = CreateFile( - szFileName, - GENERIC_READ | GENERIC_WRITE, - 0, NULL, - OPEN_EXISTING, - FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_NORMAL, - NULL ); - - if ( IsValidHandle( hFile ) ) - { - int fd = _open_osfhandle( (int)hFile, 0 ); - - fp = _fdopen( fd, "w+b" ); - } - } - } - - return fp; -} -//*************************************************************************** - -static BOOL GetCrashDataPath( LPTSTR szBuffer ) -{ - ::rtl::OUString ustrValue(RTL_CONSTASCII_USTRINGPARAM("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}")); - ::rtl::Bootstrap::expandMacros( ustrValue ); - - if ( ustrValue.getLength() ) - { - ustrValue += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/crashdata")); - - ::osl::FileBase::RC result = ::osl::Directory::createPath( ustrValue ); - - if ( ::osl::FileBase::E_None == result || ::osl::FileBase::E_EXIST == result ) - { - ::rtl::OUString ustrPath; - - result = ::osl::FileBase::getSystemPathFromFileURL( ustrValue, ustrPath ); - if ( ::osl::FileBase::E_None == result ) - { - _tcsncpy( szBuffer, reinterpret_cast(ustrPath.getStr()), MAX_PATH ); - return TRUE; - } - } - } - - return FALSE; -} - - -static FILE *_open_reportfile( LPCTSTR lpExt, LPCTSTR lpMode ) -{ - FILE *fp = NULL; - TCHAR szAppDataPath[MAX_PATH] = _T(""); - - if ( GetCrashDataPath( szAppDataPath ) ) - { - _tcscat( szAppDataPath, _T("\\crashdat") ); - _tcscat( szAppDataPath, lpExt ); - - fp = _xfopen( szAppDataPath, lpMode ); - } - - return fp; -} - -//*************************************************************************** - -struct CrashReportParams -{ - BOOL fAllowContact; - tstring sEmail; - tstring sTitle; - tstring sComment; - ULONG uInternetConnection; - tstring sProxyServer; - tstring sProxyPort; - - CrashReportParams(); - - void WriteToRegistry(); - void ReadFromRegistry(); - void ReadFromEnvironment(); -}; - -bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams ); -BOOL WriteCommentFile( LPCTSTR lpComment ); - -//*************************************************************************** - -LONG RegReadValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPVOID lpData, DWORD cbData ) -{ - HKEY hKey = NULL; - LONG lResult; - - lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey ); - - if ( ERROR_SUCCESS == lResult ) - { - lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)lpData, &cbData ); - RegCloseKey( hKey ); - } - - return lResult; -} - -//*************************************************************************** - -LONG RegWriteValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData ) -{ - HKEY hKey = NULL; - LONG lResult; - - lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL ); - - if ( ERROR_SUCCESS == lResult ) - { - lResult = RegSetValueEx( hKey, lpValueName, NULL, dwType, (CONST BYTE *)lpData, cbData ); - RegCloseKey( hKey ); - } - - return lResult; -} - -//*************************************************************************** - -CrashReportParams::CrashReportParams() -{ - fAllowContact = FALSE; - sTitle = TEXT(""); - sComment = TEXT(""); - sEmail = TEXT(""); - uInternetConnection = 0; - sProxyServer = TEXT(""); - sProxyPort = TEXT(""); -} - -//*************************************************************************** - -void CrashReportParams::ReadFromRegistry() -{ - TCHAR szBuffer[2048]; - - if ( ERROR_SUCCESS == RegReadValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPProxyServer"), - szBuffer, - sizeof(szBuffer) ) ) - sProxyServer = szBuffer; - - DWORD dwProxyPort; - - if ( ERROR_SUCCESS == RegReadValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPProxyPort"), - &dwProxyPort, - sizeof(dwProxyPort) ) ) - { - _stprintf( szBuffer, TEXT("%d"), dwProxyPort ); - sProxyPort = szBuffer; - } - - if ( ERROR_SUCCESS == RegReadValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("ReturnAddress"), - szBuffer, - sizeof(szBuffer) ) ) - sEmail = szBuffer; - - RegReadValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("AllowContact"), - &fAllowContact, - sizeof(fAllowContact) ); - - RegReadValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPConnection"), - &uInternetConnection, - sizeof(uInternetConnection) ); -} - -//*************************************************************************** - -void CrashReportParams::WriteToRegistry() -{ - RegWriteValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPProxyServer"), REG_SZ, - sProxyServer.c_str(), - sizeof(TCHAR) * (sProxyServer.length() + 1) ); - - LPTSTR endptr = NULL; - DWORD dwProxyPort = _tcstoul( sProxyPort.c_str(), &endptr, 10 ); - - RegWriteValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPProxyPort"), REG_DWORD, - &dwProxyPort, - sizeof(DWORD) ); - - RegWriteValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("AllowContact"), REG_DWORD, - &fAllowContact, - sizeof(DWORD) ); - - - RegWriteValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("HTTPConnection"), REG_DWORD, - &uInternetConnection, - sizeof(DWORD) ); - - RegWriteValue( - HKEY_CURRENT_USER, - TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"), - TEXT("ReturnAddress"), REG_SZ, - sEmail.c_str(), - sizeof(TCHAR) * (sEmail.length() + 1) ); -} - -//*************************************************************************** - -void CrashReportParams::ReadFromEnvironment() -{ - TCHAR szBuffer[2048]; - - DWORD dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYSERVER"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - sProxyServer = szBuffer; - - dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPPROXYPORT"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - sProxyPort = szBuffer; - - dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_RETURNADDRESS"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - { - sEmail = szBuffer; - // fAllowContact = TRUE; - } - - dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_HTTPCONNECTIONTYPE"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - { - if ( 0 == _tcsicmp( szBuffer, _T("DIRECT") ) ) - uInternetConnection = 1; - else if ( 0 == _tcsicmp( szBuffer, _T("MANUALPROXY") ) ) - uInternetConnection = 2; - else if ( 0 == _tcsicmp( szBuffer, _T("SYSTEMDEFAULT") ) ) - uInternetConnection = 0; - } - - dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - sTitle = szBuffer; - - - dwResult = GetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - if ( dwResult && dwResult < SAL_N_ELEMENTS(szBuffer) ) - { - FILE *fp = _xfopen( szBuffer, _T("rb") ); - - if ( fp ) - { - CHAR aUTF8Buffer[256]; - size_t nBytesRead; - - sComment = TEXT(""); - - while ( 0 != (nBytesRead = fread( aUTF8Buffer, sizeof(aUTF8Buffer[0]), SAL_N_ELEMENTS(aUTF8Buffer), fp )) ) - { - TCHAR aBuffer[256+1]; - - DWORD dwCharacters = MultiByteToWideChar( CP_UTF8, 0, aUTF8Buffer, nBytesRead, aBuffer, SAL_N_ELEMENTS(aBuffer) - 1 ); - aBuffer[dwCharacters] = 0; - sComment += aBuffer; - } - - fclose( fp ); - } - } -} - -//*************************************************************************** - -typedef BOOL (WINAPI *MiniDumpWriteDump_PROC)( - IN HANDLE hProcess, - IN DWORD ProcessId, - IN HANDLE hFile, - IN MINIDUMP_TYPE DumpType, - IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL - IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL - IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL - ); - -//*************************************************************************** - -static BOOL WINAPI InitRichEdit() -{ - return (NULL != LoadLibrary( RICHEDIT )); -} - -//*************************************************************************** - -static BOOL WINAPI DeinitRichEdit() -{ - return FreeLibrary( GetModuleHandle( RICHEDIT ) ); -} - -//*************************************************************************** - -static string trim_string( const string& rString ) -{ - string temp = rString; - - while ( temp.length() && temp[0] == ' ' || temp[0] == '\t' ) - temp.erase( 0, 1 ); - - string::size_type len = temp.length(); - - while ( len && temp[len-1] == ' ' || temp[len-1] == '\t' ) - { - temp.erase( len - 1, 1 ); - len = temp.length(); - } - - return temp; -} - -//*************************************************************************** - -static int LoadAndFormatString( HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax ) -{ - TCHAR szBuffer[FORMATBUFSIZE]; - TCHAR szBuffer2[FORMATBUFSIZE]; - - LoadString( hInstance, uID, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - - LPCTSTR src; - LPTSTR dest; - for ( dest = szBuffer2, src = szBuffer; *src; src++, dest++ ) - { - switch ( *src ) - { - case '~': - *dest = '&'; - break; - case '\\': - switch ( *(++src) ) - { - case 'n': - *dest = '\n'; - break; - case 'r': - *dest = '\r'; - break; - default: - *dest = *src; - break; - } - break; - default: - *dest = *src; - break; - } - } - - *dest = *src; - - return ExpandEnvironmentStrings( szBuffer2, lpBuffer, nBufferMax ); -} - - -//*************************************************************************** - -static string wstring2utf8( const wstring &rString ) -{ - int nBufSize = WideCharToMultiByte( CP_UTF8, 0, rString.c_str(), -1, NULL, 0, NULL, FALSE ); - - LPSTR pBuffer = (LPSTR)alloca( nBufSize ); - - WideCharToMultiByte( CP_UTF8, 0, rString.c_str(), -1, pBuffer, nBufSize, NULL, FALSE ); - - return string( pBuffer ); -} - -//*************************************************************************** - -static string xml_encode( const string &rString ) -{ - string temp = rString; - string::size_type pos = 0; - - // First replace all occurrences of '&' because it may occur in further - // encoded chardters too - - for( pos = 0; (pos = temp.find( '&', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, "&" ); - - for( pos = 0; (pos = temp.find( '<', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, "<" ); - - for( pos = 0; (pos = temp.find( '>', pos )) != string::npos; pos += 4 ) - temp.replace( pos, 1, ">" ); - - return temp; -} - -//*************************************************************************** - -static size_t fcopy( FILE *fpin, FILE *fpout ) -{ - char buffer[1024]; - size_t nBytes; - size_t nBytesWritten = 0; - - if ( fpin && fpout ) - { - while ( 0 != (nBytes = fread( buffer, 1, sizeof(buffer), fpin )) ) - { - nBytesWritten += fwrite( buffer, 1, nBytes, fpout ); - } - } - - return nBytesWritten; -} - -//*************************************************************************** - -static string GetModuleDirectory( HMODULE hModule ) -{ - TCHAR szModuleName[MAX_PATH] = TEXT(""); - TCHAR szDrive[_MAX_DRIVE]; - TCHAR szDir[_MAX_DIR]; - TCHAR szFName[_MAX_FNAME]; - TCHAR szExt[_MAX_EXT]; - - if ( GetModuleFileName( hModule, szModuleName, MAX_PATH ) ) - { - _tsplitpath( szModuleName, szDrive, szDir, szFName, szExt ); - _tmakepath( szModuleName, szDrive, szDir, _T(""), _T("") ); - } - - CHAR szModuleNameUTF8[MAX_PATH] = ""; - - WideCharToMultiByte( CP_UTF8, 0, szModuleName, -1, szModuleNameUTF8, SAL_N_ELEMENTS(szModuleNameUTF8), NULL, NULL ); - return string( szModuleNameUTF8 ); -} - -//*************************************************************************** - -string GetFileDirectory( const string& rFilePath ) -{ - string aDir = rFilePath; - size_t pos = aDir.rfind( '\\' ); - - if ( string::npos != pos ) - aDir.erase( pos + 1 ); - else - aDir = ""; - - return aDir; -} - -//*************************************************************************** - -string GetFileName( const string& rFilePath ) -{ - string aName = rFilePath; - size_t pos = aName.rfind( '\\' ); - - if ( string::npos != pos ) - return aName.substr( pos + 1 ); - else - return aName; -} - -//*************************************************************************** - -BOOL WriteReportFile( CrashReportParams *pParams ) -{ - BOOL fSuccess = FALSE; - TCHAR szTempPath[MAX_PATH]; - - if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) ) - { - TCHAR szFileName[MAX_PATH]; - - if ( GetTempFileName( szTempPath, TEXT("RPM"), 0, szFileName ) ) - { - HANDLE hFile = CreateFile( szFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( hFile ) - { - int fd = _open_osfhandle( (LONG)hFile, _O_TEXT ); - FILE *fp = _fdopen( fd, "w+t" ); - CHAR szTitle[1024] = ""; - CHAR szBuildId[1024] = ""; - CHAR szEmail[1024] = ""; - const char *pszUserType = getenv( "STAROFFICE_USERTYPE" ); - - WideCharToMultiByte( CP_UTF8, 0, pParams->sTitle.c_str(), -1, szTitle, sizeof(szTitle), NULL, NULL ); - WideCharToMultiByte( CP_UTF8, 0, g_szBuildId, -1, szBuildId, sizeof(szBuildId), NULL, NULL ); - WideCharToMultiByte( CP_UTF8, 0, pParams->sEmail.c_str(), -1, szEmail, sizeof(szEmail), NULL, NULL ); - - fprintf( fp, - "\n" - "\n" - "\n" - "\n", - pszUserType ? pszUserType : "", - pParams->fAllowContact ? "true" : "false", - pParams->fAllowContact ? xml_encode(szEmail).c_str() : "" - ); - - fprintf( fp, - "%s\n", - xml_encode(szTitle).c_str() ); - - fprintf( fp, - "\n" - "\n" - "\n" - - "\n", - szBuildId, - _INPATH, - xml_encode(g_strDefaultLanguage).c_str(), - xml_encode(GetModuleDirectory( NULL )).c_str(), - g_dwExceptionCode, - xml_encode(wstring2utf8(g_wstrProductKey)).c_str() - ); - - OSVERSIONINFO VersionInfo; - - ZeroMemory( &VersionInfo, sizeof(VersionInfo) ); - VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo ); - - GetVersionEx( &VersionInfo ); - - fprintf( fp, - "\n" - "\n" - , - VER_PLATFORM_WIN32_NT == VersionInfo.dwPlatformId ? "Windows NT" : "Windows", - VersionInfo.dwMajorVersion, VersionInfo.dwMinorVersion, - VersionInfo.dwBuildNumber, - GetUserDefaultLangID() - - ); - fprintf( fp, "\n" ); - fprintf( fp, "\n" ); - - fseek( g_fpStackFile, 0, SEEK_SET ); - fcopy( g_fpStackFile, fp ); - - fseek( g_fpChecksumFile, 0, SEEK_SET ); - fcopy( g_fpChecksumFile, fp ); - - fprintf( fp, "\n" ); - - fclose( fp ); - - fSuccess = TRUE; - - WideCharToMultiByte( CP_ACP, 0, szFileName, -1, g_szReportFileNameA, MAX_PATH, NULL, NULL ); - } - - if ( !fSuccess ) - DeleteFile( szFileName ); - } - } - - return fSuccess; -} - -//*************************************************************************** - -static BOOL SaveDumpFile( HWND hwndOwner ) -{ - OPENFILENAME ofn; - TCHAR szFileName[MAX_PATH] = TEXT(""); - - ZeroMemory( &ofn, sizeof(ofn) ); - ofn.lStructSize = sizeof(ofn); - - ofn.hwndOwner = hwndOwner; - ofn.lpstrFilter = TEXT("*.dmp\0*.dmp\0*.*\0*.*\0"); - ofn.lpstrFile = szFileName; - ofn.nMaxFile = MAX_PATH; - ofn.Flags = OFN_ENABLESIZING | OFN_LONGNAMES | OFN_OVERWRITEPROMPT; - ofn.lpstrDefExt = TEXT("dmp"); - - if ( GetSaveFileName( &ofn ) ) - { - return CopyFile( g_szDumpFileName, szFileName, FALSE ); - } - - - return FALSE; -} - -//*************************************************************************** - -static BOOL ScreenToClientRect( HWND hwnd, LPRECT lprc ) -{ - return ScreenToClient( hwnd, (LPPOINT)&lprc->left ) && ScreenToClient( hwnd, (LPPOINT)&lprc->right ); -} - -static BOOL SetWindowRect( HWND hwnd, const RECT *lprc, BOOL fRepaint ) -{ - return MoveWindow( hwnd, lprc->left, lprc->top, lprc->right - lprc->left, lprc->bottom - lprc->top, fRepaint ); -} - -#define GM_LOX 0x01 -#define GM_HIX 0x02 -#define GM_LOY 0x04 -#define GM_HIY 0x08 - -static BOOL SetGrowMode( HWND hwnd, DWORD dwGrowMode ) -{ - return SetProp( hwnd, TEXT("GrowMode"), (HANDLE)dwGrowMode ); -} - -static DWORD GetGrowMode( HWND hwnd ) -{ - return (DWORD)GetProp( hwnd, TEXT("GrowMode") ); -} - -static BOOL GrowWindow( HWND hwnd, LONG dxClient, LONG dyClient, BOOL fRepaint ) -{ - DWORD dwGrowMode = GetGrowMode( hwnd ); - RECT rc; - - GetWindowRect( hwnd, &rc ); - - if ( dwGrowMode & GM_LOX ) - rc.left += dxClient; - if ( dwGrowMode & GM_HIX ) - rc.right += dxClient; - if ( dwGrowMode & GM_LOY ) - rc.top += dyClient; - if ( dwGrowMode & GM_HIY ) - rc.bottom += dyClient; - - ScreenToClientRect( GetParent( hwnd ), &rc ); - SetWindowRect( hwnd, &rc, fRepaint ); - - return TRUE; -} - -BOOL CALLBACK GrowChildWindows( - HWND hwnd, // handle to child window - LPARAM lParam // application-defined value -) -{ - LONG cx = (SHORT)LOWORD( lParam ); - LONG cy = (SHORT)HIWORD( lParam ); - - GrowWindow( hwnd, cx, cy, TRUE ); - - return TRUE; -} - -/* -BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam) -{ - HFONT aFont = *((HFONT*) lParam); - HDC hDC = GetDC( hwndChild ); - SelectObject( hDC, aFont ); - ReleaseDC( hwndChild, hDC ); - return TRUE; -} - -void ApplySystemFont( HWND hwndDlg ) -{ - NONCLIENTMETRICSA aNonClientMetrics; - aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); - if ( SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) - { - HFONT aSysFont = CreateFontIndirectA( &aNonClientMetrics.lfMessageFont ); - EnumChildWindows(hwndDlg, EnumChildProc, (LPARAM) &aSysFont); - } -} -*/ - -BOOL CALLBACK PreviewDialogProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam - ) -{ - static RECT rcClient; - - switch ( uMsg ) - { - case WM_SIZE: - { - LONG cx = LOWORD( lParam ); - LONG cy = HIWORD( lParam ); - LONG dxClient, dyClient; - - dxClient = cx - rcClient.right; - dyClient = cy - rcClient.bottom; - - EnumChildWindows( hwndDlg, GrowChildWindows, MAKELONG( (SHORT)dxClient, (SHORT)dyClient) ); - - GetClientRect( hwndDlg, &rcClient ); - } - break; - case WM_INITDIALOG: - { - GetClientRect( hwndDlg, &rcClient ); - SetGrowMode( GetDlgItem(hwndDlg, IDC_EDIT_PREVIEW), GM_HIX | GM_HIY ); - SetGrowMode( GetDlgItem(hwndDlg, IDOK), GM_LOX | GM_HIX | GM_LOY | GM_HIY ); - - CrashReportParams *pParams = (CrashReportParams *)lParam; - - TCHAR szBuffer[256] = TEXT(""); - HINSTANCE hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE ); - HWND hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT ); - - GetWindowText( hwndParent, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( hwndDlg, szBuffer ); - - LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDOK), szBuffer ); - - basic_string aString; - - aString.append( pParams->sTitle ); - aString.append( _T("\r\n\r\n") ); - aString.append( pParams->sComment ); - aString.append( _T("\r\n---------- report ----------\r\n") ); - - FILE *fp = fopen( g_szReportFileNameA, "r" ); - - if ( fp ) - { - char buf[1024]; - - while ( fgets( buf, SAL_N_ELEMENTS(buf), fp ) != NULL ) - { - WCHAR bufW[1024]; - - MultiByteToWideChar( CP_UTF8, 0, buf, -1, bufW, SAL_N_ELEMENTS(bufW) ); - - aString.append( bufW ); - } - - fclose( fp ); - } - - aString.append( _T("\r\n---------- stack ----------\r\n") ); - - fp = fopen( g_szDumpFileNameA, "rb" ); - - if ( fp ) - { - unsigned char buf[16]; - int count; - - do - { - int i; - - count = fread( buf, sizeof(buf[0]), SAL_N_ELEMENTS(buf), fp ); - - for ( i = 0; i < count; i++ ) - { - TCHAR output[16]; - - _sntprintf( output, SAL_N_ELEMENTS(output), _T("%02X\x20"), buf[i] ); - aString.append( output ); - } - for ( ; i < SAL_N_ELEMENTS(buf); i++ ) - { - aString.append( _T("\x20\x20\x20") ); - } - - for ( i = 0; i < count; i++ ) - { - TCHAR output[2]; - - if ( (int)buf[i] >= 0x20 && (int)buf[i] <= 0x7F ) - output[0] = (TCHAR)buf[i]; - else - output[0] = '.'; - output[1] = 0; - aString.append( output ); - } - - aString.append( _T("\r\n") ); - - } while ( count ); - - fclose( fp ); - } - - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_PREVIEW), aString.c_str() ); - - - SetWindowFont( GetDlgItem(hwndDlg, IDC_EDIT_PREVIEW), GetStockObject( SYSTEM_FIXED_FONT ), TRUE ); - } - return TRUE; - case WM_COMMAND: - switch ( LOWORD(wParam) ) - { - case IDOK: - case IDCANCEL: - EndDialog( hwndDlg, wParam ); - return TRUE; - } - break; - default: - break; - } - - return FALSE; -} -//*************************************************************************** - -static void PreviewReport( HWND hwndParent, CrashReportParams *pParams ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE ); - - WriteReportFile( pParams ); - - DialogBoxParam( - hInstance, - MAKEINTRESOURCE(IDD_PREVIEW_FRAME), - hwndParent, - PreviewDialogProc, - (LPARAM)pParams - ); - - DeleteFileA( g_szReportFileNameA ); -} -//*************************************************************************** -void UpdateOptionsDialogControls( HWND hwndDlg ) -{ - if ( Button_GetCheck( GetDlgItem(hwndDlg, IDC_RADIO_MANUAL) ) & BST_CHECKED ) - { - EnableWindow( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), TRUE ); - EnableWindow( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), TRUE ); - } - else - { - EnableWindow( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), FALSE ); - EnableWindow( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), FALSE ); - } -} - -//*************************************************************************** - -BOOL CALLBACK OptionsDialogProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam - ) -{ - static CrashReportParams *pParams; - - switch ( uMsg ) - { - case WM_INITDIALOG: - { - TCHAR szBuffer[1024] = TEXT(""); - HINSTANCE hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE ); - //HWND hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT ); - - pParams = (CrashReportParams *)lParam; - - LoadAndFormatString( hInstance, IDS_OPTIONS_CAPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( hwndDlg, szBuffer ); - - LoadAndFormatString( hInstance, IDS_PROXY_SETTINGS_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_PROXY_SETTINGS), szBuffer ); - - LoadAndFormatString( hInstance, IDS_PROXY_SYSTEM, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_SYSTEM), szBuffer ); - - LoadAndFormatString( hInstance, IDS_PROXY_DIRECT, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_DIRECT), szBuffer ); - - LoadAndFormatString( hInstance, IDS_PROXY_MANUAL, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_RADIO_MANUAL), szBuffer ); - - LoadAndFormatString( hInstance, IDS_LABEL_PROXYSERVER, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_LABEL_PROXYSERVER), szBuffer ); - - LoadAndFormatString( hInstance, IDS_LABEL_PROXYPORT, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_LABEL_PROXYPORT), szBuffer ); - - LoadAndFormatString( hInstance, IDS_OK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDOK), szBuffer ); - - LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer ); - - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), pParams->sProxyServer.c_str() ); - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), pParams->sProxyPort.c_str() ); - - Button_SetCheck( GetDlgItem(hwndDlg, IDC_RADIO_SYSTEM + pParams->uInternetConnection), BST_CHECKED ); - - SendMessage( - GetDlgItem(hwndDlg, IDC_PROXY_DESCRIPTION), - EM_SETBKGNDCOLOR, - (WPARAM)FALSE, - GetSysColor( COLOR_3DFACE ) ); - LoadAndFormatString( hInstance, IDS_PROXY_DESCRIPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Edit_SetText( GetDlgItem(hwndDlg, IDC_PROXY_DESCRIPTION), szBuffer ); - - UpdateOptionsDialogControls( hwndDlg ); - } - return TRUE; - case WM_COMMAND: - switch ( LOWORD(wParam) ) - { - case IDC_RADIO_SYSTEM: - case IDC_RADIO_DIRECT: - case IDC_RADIO_MANUAL: - if ( BN_CLICKED == HIWORD(wParam) ) - UpdateOptionsDialogControls( hwndDlg ); - break; - case IDOK: - { - TCHAR szBuffer[1024]; - - Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYSERVER), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sProxyServer = szBuffer; - - Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_PROXYPORT), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sProxyPort = szBuffer; - - if ( Button_GetCheck( GetDlgItem(hwndDlg, IDC_RADIO_DIRECT) ) & BST_CHECKED ) - pParams->uInternetConnection = 1; - else if ( Button_GetCheck( GetDlgItem(hwndDlg, IDC_RADIO_MANUAL) ) & BST_CHECKED ) - pParams->uInternetConnection = 2; - else - pParams->uInternetConnection = 0; - } - case IDCANCEL: - EndDialog( hwndDlg, wParam ); - return TRUE; - } - break; - default: - break; - } - - return FALSE; -} - -//*************************************************************************** - -static void OptionsDialog( HWND hwndParent, CrashReportParams *pParams ) -{ - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE ); - - if ( IDOK == DialogBoxParam( - hInstance, - MAKEINTRESOURCE(IDD_OPTIONS_FRAME), - hwndParent, - OptionsDialogProc, - (LPARAM)pParams - ) ) - pParams->WriteToRegistry(); - -} -//*************************************************************************** - -void UpdateReportDialogControls( HWND hwndDlg ) -{ - EnableWindow( - GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), - Button_GetCheck(GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT)) & BST_CHECKED ? TRUE : FALSE ); - EnableWindow( - GetDlgItem(hwndDlg, IDC_LABEL_EMAIL), - Button_GetCheck(GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT)) & BST_CHECKED ? TRUE : FALSE ); -} - -//*************************************************************************** - -BOOL CALLBACK ReportDialogProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM - ) -{ - switch ( uMsg ) - { - case WM_INITDIALOG: - { - CrashReportParams *pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA ); - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE ); - TCHAR szBuffer[FORMATBUFSIZE]; - - LoadAndFormatString( hInstance, IDS_REPORT_INTRO, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_REPORT_INTRO), szBuffer ); - - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT3), szBuffer ); - - LoadAndFormatString( hInstance, IDS_ENTER_TITLE, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_ENTER_TITLE), szBuffer ); - - LoadAndFormatString( hInstance, IDS_ENTER_DESCRIPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_ENTER_DESCRIPTION), szBuffer ); - - LoadAndFormatString( hInstance, IDS_SHOW_REPORT_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_SHOW_REPORT), szBuffer ); - - LoadAndFormatString( hInstance, IDS_SAVE_REPORT_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_SAVE_REPORT), szBuffer ); - - const char *pszUserType = getenv( "STAROFFICE_USERTYPE" ); - if ( pszUserType ) - ShowWindow( GetDlgItem(hwndDlg, IDC_SAVE_REPORT), SW_SHOW ); - else - ShowWindow( GetDlgItem(hwndDlg, IDC_SAVE_REPORT), SW_HIDE ); - - LoadAndFormatString( hInstance, IDS_OPTIONS_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_OPTIONS), szBuffer ); - - LoadAndFormatString( hInstance, IDS_ALLOW_CONTACT, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT), szBuffer ); - Button_SetCheck( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT), pParams->fAllowContact ? BST_CHECKED : BST_UNCHECKED ); - - LoadAndFormatString( hInstance, IDS_LABEL_EMAIL, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDC_LABEL_EMAIL), szBuffer ); - - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), pParams->sEmail.c_str() ); - - UpdateReportDialogControls( hwndDlg ); - } - return TRUE; - case WM_SHOWWINDOW: - if ( (BOOL)wParam ) - { - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE ); - CrashReportParams *pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA ); - TCHAR szBuffer[FORMATBUFSIZE]; - - LoadAndFormatString( hInstance, IDS_REPORT_CAPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( GetParent(hwndDlg), szBuffer ); - - LoadAndFormatString( hInstance, IDS_REPORT_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( GetDlgItem(GetParent(hwndDlg), IDC_HEADER), szBuffer ); - - LoadAndFormatString( hInstance, IDS_DONOT_SEND_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(GetParent(hwndDlg), IDCANCEL), szBuffer ); - - - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDBACK), TRUE ); - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDFINISH), TRUE ); - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDNEXT), FALSE ); - - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_TITLE), pParams->sTitle.c_str() ); - Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_DESCRIPTION), pParams->sComment.c_str() ); - - /* - SetWindowLong( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWL_STYLE, - GetWindowLong( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWL_STYLE) | BS_DEFPUSHBUTTON ); - SetWindowLong( GetDlgItem(GetParent(hwndDlg),IDBACK), GWL_STYLE, - GetWindowLong( GetDlgItem(GetParent(hwndDlg),IDBACK), GWL_STYLE) &~ BS_DEFPUSHBUTTON ); - */ - SetFocus( GetDlgItem(hwndDlg,IDC_EDIT_TITLE) ); - } - break; - case WM_COMMAND: - switch ( LOWORD(wParam) ) - { - case IDC_SHOW_REPORT: - { - TCHAR szBuffer[32767]; - - CrashReportParams *pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA ); - - pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT) ) ? TRUE : FALSE; - - Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_TITLE), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sTitle = szBuffer; - - Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_DESCRIPTION), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sComment = szBuffer; - - Edit_GetText( GetDlgItem(hwndDlg, IDC_EDIT_EMAIL), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sEmail = szBuffer; - - PreviewReport( GetParent(hwndDlg), pParams ); - } - return TRUE; - case IDC_SAVE_REPORT: - SaveDumpFile( GetParent(hwndDlg) ); - return TRUE; - case IDC_OPTIONS: - { - CrashReportParams *pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA ); - OptionsDialog( GetParent(hwndDlg), pParams ); - } - return TRUE; - case IDC_ALLOW_CONTACT: - if ( BN_CLICKED == HIWORD(wParam) ) - UpdateReportDialogControls( hwndDlg ); - return TRUE; - } - break; - default: - break; - } - - return FALSE; -} -//*************************************************************************** - -BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) -{ - switch ( uMsg ) - { - case WM_INITDIALOG: - { - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE ); - HWND hwndRichEdit = GetDlgItem(hwndDlg, IDC_RICHEDIT21); - TCHAR szBuffer[FORMATBUFSIZE]; - TCHAR szBuffer2[FORMATBUFSIZE]; - TCHAR szURL[256]; - TCHAR szCaption[256]; - - SendMessage( - hwndRichEdit, - EM_SETBKGNDCOLOR, - (WPARAM)FALSE, - GetSysColor( COLOR_3DFACE ) ); - - SendMessage( hwndRichEdit, EM_SETEVENTMASK, 0, ENM_LINK ); - SendMessage( hwndRichEdit, EM_AUTOURLDETECT, TRUE, 0 ); - - LoadAndFormatString( hInstance, IDS_WELCOME_BODY1, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - LoadAndFormatString( hInstance, IDS_WELCOME_BODY2, szBuffer2, SAL_N_ELEMENTS(szBuffer2) ); - _tcsncat( szBuffer, szBuffer2, SAL_N_ELEMENTS(szBuffer) ); - LoadAndFormatString( hInstance, IDS_WELCOME_BODY3, szBuffer2, SAL_N_ELEMENTS(szBuffer2) ); - _tcsncat( szBuffer, szBuffer2, SAL_N_ELEMENTS(szBuffer) ); - LoadString( hInstance, IDS_PRIVACY_URL, szURL, SAL_N_ELEMENTS(szURL) ); - _tcsncat( szBuffer, szURL, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( hwndRichEdit, szBuffer ); - - LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szCaption, SAL_N_ELEMENTS(szCaption) ); - SetWindowText( GetParent(hwndDlg), szCaption ); - - } - return TRUE; - case WM_SHOWWINDOW: - if ( (BOOL)wParam ) - { - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE ); - TCHAR szBuffer[FORMATBUFSIZE]; - - LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( GetParent(hwndDlg), szBuffer ); - - LoadAndFormatString( hInstance, IDS_WELCOME_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( GetDlgItem(GetParent(hwndDlg), IDC_HEADER), szBuffer ); - - LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(GetParent(hwndDlg), IDCANCEL), szBuffer ); - - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDBACK), FALSE ); - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDFINISH), FALSE ); - ShowWindow( GetDlgItem(GetParent(hwndDlg),IDNEXT), TRUE ); - - SetFocus( GetDlgItem(GetParent(hwndDlg),IDNEXT) ); - } - break; - case WM_NOTIFY: - { - LPNMHDR pnmh = (LPNMHDR)lParam; - - if ( pnmh->idFrom == IDC_RICHEDIT21 && pnmh->code == EN_LINK ) - { - ENLINK *plink = (ENLINK*)lParam; - - if ( plink->msg == WM_LBUTTONUP ) - { - TCHAR szBuffer[256]; - TEXTRANGE range; - - range.chrg = plink->chrg; - range.lpstrText = szBuffer; - - SendMessage( pnmh->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&range ); - - ShellExecute( hwndDlg, NULL, szBuffer, NULL, NULL, SW_SHOWDEFAULT ); - } - - } - } - break; - default: - break; - } - - return FALSE; -} -//*************************************************************************** - -BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) -{ - static HWND hwndPages[2] = { NULL }; - static int iActualPage = 0; - - switch ( uMsg ) - { - case WM_INITDIALOG: - { - HINSTANCE hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE ); - TCHAR szBuffer[FORMATBUFSIZE]; - - SetWindowLong( hwndDlg, GWL_USERDATA, (LONG)lParam ); - hwndPages[0] = CreateDialog( - hInstance, - MAKEINTRESOURCE(IDD_WELCOME_PAGE), - hwndDlg, - WelcomeDialogProc ); - - hwndPages[1] = CreateDialog( - hInstance, - MAKEINTRESOURCE(IDD_REPORT_PAGE), - hwndDlg, - ReportDialogProc ); - - CHARFORMAT chfmt; - - chfmt.cbSize = sizeof(chfmt); - chfmt.dwMask = CFM_BOLD; - chfmt.dwEffects = CFE_BOLD; - - SendMessage( - GetDlgItem(hwndDlg, IDC_HEADER), - EM_SETCHARFORMAT, - SCF_ALL, - (LPARAM)&chfmt ); - - LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer ); - - LoadAndFormatString( hInstance, IDS_NEXT_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDNEXT), szBuffer ); - - LoadAndFormatString( hInstance, IDS_SEND_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDFINISH), szBuffer ); - - LoadAndFormatString( hInstance, IDS_BACK_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDBACK), szBuffer ); - - ShowWindow( hwndPages[1], SW_HIDE ); - ShowWindow( hwndPages[0], SW_SHOW ); - - // Let Crash Reporter window stay on top of all other windows - SetWindowPos( hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); - } - return FALSE; - case WM_CTLCOLORSTATIC: - return (BOOL)CreateSolidBrush(GetSysColor(COLOR_WINDOW)); - case WM_COMMAND: - switch ( LOWORD(wParam) ) - { - case IDBACK: - if ( iActualPage > 0 ) - { - ShowWindow( hwndPages[iActualPage], SW_HIDE ); - ShowWindow( hwndPages[--iActualPage], SW_SHOW ); - } - return TRUE; - case IDNEXT: - if ( iActualPage < SAL_N_ELEMENTS(hwndPages) - 1 ) - { - ShowWindow( hwndPages[iActualPage], SW_HIDE ); - ShowWindow( hwndPages[++iActualPage], SW_SHOW ); - } - return TRUE; - case IDFINISH: - { - TCHAR szBuffer[32767]; - CrashReportParams *pParams = (CrashReportParams*)GetWindowLong( hwndDlg, GWL_USERDATA ); - - pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndPages[1], IDC_ALLOW_CONTACT) ) ? TRUE : FALSE; - - Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_TITLE), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sTitle = szBuffer; - - Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_DESCRIPTION), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sComment = szBuffer; - - Edit_GetText( GetDlgItem(hwndPages[1], IDC_EDIT_EMAIL), szBuffer, SAL_N_ELEMENTS(szBuffer) ); - pParams->sEmail = szBuffer; - - if ( pParams->fAllowContact && !pParams->sEmail.length() ) - { - TCHAR szMessage[MAX_TEXT_BUFFER]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_NOEMAILADDRESS, szMessage, SAL_N_ELEMENTS(szMessage) ); - - MessageBox( hwndDlg, szMessage, NULL, MB_ICONERROR | MB_OK ); - break; // Don't end the dialog - } - else - { - pParams->WriteToRegistry(); - - WriteCommentFile( pParams->sComment.c_str() ); - WriteReportFile( pParams ); - - if ( !SendCrashReport( hwndDlg, *pParams ) ) - break; // Don't end the dialog - } - } - // Fallthrough !!! - case IDCANCEL: - EndDialog( hwndDlg, wParam ); - return TRUE; - } - break; - default: - break; - } - - return FALSE; -} - - - -//***************************************************************************** -//* Generate MD5 checksum -//***************************************************************************** - -#define MAGIC_DESCRIPTION_FILLER 'x' -#define MAGIC_DESCRIPTION_COUNT 80 - -static void repatch_soffice_exe( void *pBuffer, size_t nBufSize ) -{ - wchar_t DescriptionBuffer[MAGIC_DESCRIPTION_COUNT]; - - memset( DescriptionBuffer, 0, sizeof(DescriptionBuffer) ); - wcsncpy( DescriptionBuffer, g_wstrProductKey.c_str(), SAL_N_ELEMENTS(DescriptionBuffer) - 1 ); - - bool bPatched = false; - - do - { - void *pFound = memchr( pBuffer, ((char *)DescriptionBuffer)[0], nBufSize ); - - if ( pFound ) - { - size_t distance = (char *)pFound - (char *)pBuffer; - - if ( nBufSize >= distance ) - { - nBufSize -= distance; - - if ( nBufSize >= sizeof(DescriptionBuffer) && - 0 == memcmp( pFound, DescriptionBuffer, sizeof(DescriptionBuffer) ) ) - { - for ( int i = 0; i < 80; i++ ) - { - ((wchar_t *)pFound)[i] = MAGIC_DESCRIPTION_FILLER; - } - bPatched = true; - } - else - { - pBuffer = (void *)(((char *)pFound) + 1); - nBufSize--; - } - } - else - nBufSize = 0; - } - else - nBufSize = 0; - } while ( !bPatched && nBufSize ); -} - -// Normalize executable/library images to prevent different MD5 checksums due -// to a different PE header date/checksum (this doesn't affect the code/data -// sections of a executable/library. Please see tools/source/bootstrp/md5.cxx -// where the same method is also used. The tool so_checksum creates the MD5 -// checksums during build time. You have to make sure that both methods use the -// same algorithm otherwise there could be problems with stack reports. -static void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) -{ - const int OFFSET_PE_OFFSET = 0x3c; - const int OFFSET_COFF_TIMEDATESTAMP = 4; - const int PE_SIGNATURE_SIZE = 4; - const int COFFHEADER_SIZE = 20; - const int OFFSET_PE_OPTIONALHEADER_CHECKSUM = 64; - - // Check the header part of the file buffer - if (buffer[0] == 'M' && buffer[1] == 'Z') - { - unsigned long PEHeaderOffset = (long)buffer[OFFSET_PE_OFFSET]; - if (PEHeaderOffset < nBufferSize-4) - { - if ( buffer[PEHeaderOffset] == 'P' && - buffer[PEHeaderOffset+1] == 'E' && - buffer[PEHeaderOffset+2] == 0 && - buffer[PEHeaderOffset+3] == 0 ) - { - PEHeaderOffset += PE_SIGNATURE_SIZE; - if (PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP < nBufferSize-4) - { - // Set timedatestamp and checksum fields to a normalized - // value to enforce the same MD5 checksum for identical - // Windows executables/libraries. - buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP] = 0; - buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+1] = 0; - buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+2] = 0; - buffer[PEHeaderOffset+OFFSET_COFF_TIMEDATESTAMP+3] = 0; - } - - if (PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM < nBufferSize-4) - { - // Set checksum to a normalized value - buffer[PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM] = 0; - buffer[PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM+1] = 0; - buffer[PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM+2] = 0; - buffer[PEHeaderOffset+COFFHEADER_SIZE+OFFSET_PE_OPTIONALHEADER_CHECKSUM+3] = 0; - } - } - } - } -} - -static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum, sal_uInt32 nChecksumLen ) -{ - const int MINIMAL_FILESIZE = 512; - - sal_uInt32 nBytesProcessed = 0; - - FILE *fp = fopen( filename, "rb" ); - - if ( fp ) - { - long nFileSize; - - if ( 0 == fseek( fp, 0, SEEK_END ) && -1 != (nFileSize = ftell(fp)) ) - { - rewind( fp ); - - sal_uInt8 *pBuffer = new sal_uInt8[nFileSize]; - size_t nBytesRead = fread( pBuffer, 1, nFileSize, fp ); - - if ( sal::static_int_cast(nBytesRead) == nFileSize ) - { - if ( 0 == stricmp( GetFileName(filename).c_str(), "soffice.bin" ) ) - repatch_soffice_exe( pBuffer, nBytesRead ); - else if ( nFileSize > MINIMAL_FILESIZE ) - normalize_pe_image( pBuffer, nBytesRead ); - - rtlDigestError error = rtl_digest_MD5 ( - pBuffer, nBytesRead, - pChecksum, nChecksumLen ); - - if ( rtl_Digest_E_None == error ) - nBytesProcessed = nBytesRead; - } - - delete[] pBuffer; - } - - fclose( fp ); - - } - - return nBytesProcessed; -} - -#if 0 -static sal_uInt32 calc_md5_checksum( const char *filename, sal_uInt8 *pChecksum, sal_uInt32 nChecksumLen ) -{ - sal_uInt32 nBytesProcessed = 0; - - FILE *fp = fopen( filename, "rb" ); - - if ( fp ) - { - rtlDigest digest = rtl_digest_createMD5(); - - if ( digest ) - { - size_t nBytesRead; - sal_uInt8 buffer[4096]; - rtlDigestError error = rtl_Digest_E_None; - - while ( rtl_Digest_E_None == error && - 0 != (nBytesRead = fread( buffer, 1, sizeof(buffer), fp )) ) - { - error = rtl_digest_updateMD5( digest, buffer, nBytesRead ); - nBytesProcessed += nBytesRead; - } - - if ( rtl_Digest_E_None == error ) - { - error = rtl_digest_getMD5( digest, pChecksum, nChecksumLen ); - } - - if ( rtl_Digest_E_None != error ) - nBytesProcessed = 0; - - rtl_digest_destroyMD5( digest ); - } - - fclose( fp ); - } - - return nBytesProcessed; -} - -#endif -//*************************************************************************** - -static bool WriteStackFile( FILE *fout, boost::unordered_map< string, string >& rLibraries, DWORD dwProcessId, PEXCEPTION_POINTERS pExceptionPointers ) -{ - bool fSuccess = false; - - if ( fout && dwProcessId && pExceptionPointers ) - { - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId ); - - if ( IsValidHandle(hProcess) ) - { - EXCEPTION_POINTERS aExceptionPointers; - CONTEXT aContextRecord; - - ReadProcessMemory( - hProcess, - pExceptionPointers, - &aExceptionPointers, - sizeof(aExceptionPointers), - NULL ); - - ReadProcessMemory( - hProcess, - aExceptionPointers.ContextRecord, - &aContextRecord, - sizeof(aContextRecord), - NULL ); - - STACKFRAME frame; - - ZeroMemory( &frame, sizeof(frame) ); - frame.AddrPC.Offset = aContextRecord.Eip; - frame.AddrPC.Mode = AddrModeFlat; - frame.AddrFrame.Offset = aContextRecord.Ebp; - frame.AddrFrame.Mode = AddrModeFlat; - - BOOL bSuccess; - int frameNum = 0; - - SymInitialize( hProcess, NULL, TRUE ); - - fprintf( fout, "\n" ); - - do - { - fSuccess = true; - - bSuccess = StackWalk( IMAGE_FILE_MACHINE_I386, - hProcess, - NULL, - &frame, - &aContextRecord, - (PREAD_PROCESS_MEMORY_ROUTINE)ReadProcessMemory, - SymFunctionTableAccess, - SymGetModuleBase, - NULL ); - - if ( bSuccess ) - { - // Note: ImageHelp ANSI functions do not have an A postfix while - // Unicode versions have a W postfix. There's no macro - // that depends on define UNICODE - - IMAGEHLP_MODULE moduleInfo; - - ZeroMemory( &moduleInfo, sizeof(moduleInfo) ); - moduleInfo.SizeOfStruct = sizeof(moduleInfo); - - if ( SymGetModuleInfo( hProcess, frame.AddrPC.Offset, &moduleInfo ) ) - { - rLibraries[ GetFileName( moduleInfo.LoadedImageName ).c_str() ] = moduleInfo.LoadedImageName; - - DWORD dwRelOffset = 0; - BYTE symbolBuffer[sizeof(IMAGEHLP_SYMBOL) + 256 ]; - PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL)symbolBuffer; - - ZeroMemory( symbolBuffer, sizeof(symbolBuffer) ); - pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL); - pSymbol->MaxNameLength = 256; - - if ( SymGetSymFromAddr( hProcess, frame.AddrPC.Offset, &dwRelOffset, pSymbol ) ) - fprintf( fout, "\n", - frameNum, - frame.AddrPC.Offset, - frame.AddrPC.Offset - moduleInfo.BaseOfImage, - xml_encode(pSymbol->Name).c_str(), - frame.AddrPC.Offset - pSymbol->Address, - xml_encode(GetFileName( moduleInfo.LoadedImageName )).c_str(), - xml_encode( GetFileDirectory( moduleInfo.LoadedImageName )).c_str() - ); - else - fprintf( fout, "\n", - frameNum, - frame.AddrPC.Offset, - frame.AddrPC.Offset - moduleInfo.BaseOfImage, - xml_encode(GetFileName( moduleInfo.LoadedImageName )).c_str(), - xml_encode(GetFileDirectory( moduleInfo.LoadedImageName )).c_str() - ); - } - else - fprintf( fout, "\n", - frameNum, - frame.AddrPC.Offset - ); - - frameNum++; - } - - } while ( bSuccess ); - - fprintf( fout, "\n" ); - - SymCleanup( hProcess ); - - CloseHandle( hProcess ); - } - - } - - return fSuccess; -} - -bool WriteChecksumFile( FILE *fchksum, const boost::unordered_map< string, string >& rLibraries ) -{ - bool success = false; - - if ( fchksum && rLibraries.size() ) - { - fprintf( fchksum, "\n" ); - - boost::unordered_map< string, string >::const_iterator iter; - - for ( iter = rLibraries.begin(); iter != rLibraries.end(); ++iter ) - { - sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5]; - sal_uInt32 nBytesProcessed = calc_md5_checksum( - iter->second.c_str(), - checksum, sizeof(checksum) ); - - if ( nBytesProcessed ) - { - fprintf( fchksum, "\n", - nBytesProcessed, - GetFileName( iter->first ).c_str() ); - } - } - - fprintf( fchksum, "\n" ); - - success = true; - } - - return success; -} - -//*************************************************************************** - -BOOL FindDumpFile() -{ - TCHAR szFileName[MAX_PATH]; - - if ( GetCrashDataPath( szFileName ) ) - { - _tcscat( szFileName, _T("\\crashdat.dmp") ); - - HANDLE hFile = CreateFile( - szFileName, - GENERIC_READ, - 0, NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( hFile ) - { - CloseHandle( hFile ); - - WideCharToMultiByte( CP_ACP, 0, szFileName, -1, g_szDumpFileNameA, MAX_PATH, NULL, NULL ); - _tcscpy( g_szDumpFileName, szFileName ); - - return TRUE; - } - } - - return FALSE; -} - -BOOL WriteDumpFile( DWORD dwProcessId, PEXCEPTION_POINTERS pExceptionPointers, DWORD dwThreadId ) -{ - BOOL fSuccess = FALSE; - PMINIDUMP_EXCEPTION_INFORMATION lpExceptionParam = NULL; - MINIDUMP_EXCEPTION_INFORMATION ExceptionParam; - - HMODULE hDbgHelp = LoadLibrary( _T("DBGHELP.DLL" ) ); - MiniDumpWriteDump_PROC pMiniDumpWriteDump = NULL; - - if ( hDbgHelp ) - { - pMiniDumpWriteDump = (MiniDumpWriteDump_PROC)GetProcAddress( hDbgHelp, "MiniDumpWriteDump" ); - - if ( !pMiniDumpWriteDump ) - { - FreeLibrary( hDbgHelp ); - return false; - } - } - - if ( !pMiniDumpWriteDump ) - return false; - - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwProcessId ); - - if ( IsValidHandle(hProcess) ) - { - TCHAR szTempPath[MAX_PATH]; - -// if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) ) - if ( GetCrashDataPath( szTempPath ) ) - { - TCHAR szFileName[MAX_PATH]; - -// if ( GetTempFileName( szTempPath, TEXT("DMP"), 0, szFileName ) ) - _tcscpy( szFileName, szTempPath ); - _tcscat( szFileName, _T("\\crashdat.dmp") ); - { - HANDLE hFile = CreateFile( - szFileName, - GENERIC_READ | GENERIC_WRITE, - 0, NULL, -// OPEN_EXISTING, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( hFile ) - { - if ( pExceptionPointers && dwThreadId ) - { - ExceptionParam.ThreadId = dwThreadId; - ExceptionParam.ExceptionPointers = pExceptionPointers; - ExceptionParam.ClientPointers = TRUE; - - EXCEPTION_POINTERS aExceptionPointers; - EXCEPTION_RECORD aExceptionRecord; - - ReadProcessMemory( - hProcess, - pExceptionPointers, - &aExceptionPointers, - sizeof(aExceptionPointers), - NULL ); - - - ReadProcessMemory( - hProcess, - aExceptionPointers.ExceptionRecord, - &aExceptionRecord, - sizeof(aExceptionRecord), - NULL ); - - g_dwExceptionCode = aExceptionRecord.ExceptionCode; - - lpExceptionParam = &ExceptionParam; - } - - fSuccess = pMiniDumpWriteDump( hProcess, dwProcessId, hFile, MiniDumpNormal, lpExceptionParam, NULL, NULL ); - - CloseHandle( hFile ); - - WideCharToMultiByte( CP_ACP, 0, szFileName, -1, g_szDumpFileNameA, MAX_PATH, NULL, NULL ); - _tcscpy( g_szDumpFileName, szFileName ); - } - - if ( !fSuccess ) - DeleteFile( szFileName ); - } - } - - CloseHandle( hProcess ); - } - - FreeLibrary( hDbgHelp ); - - return fSuccess; -} - -//*************************************************************************** - -static DWORD FindProcessForImage( LPCTSTR lpImagePath ) -{ - DWORD dwProcessId = 0; - DWORD aProcesses[1024]; - DWORD dwSize = 0; - TCHAR szShortImagePath[MAX_PATH]; - - if ( GetShortPathName( lpImagePath, szShortImagePath, SAL_N_ELEMENTS(szShortImagePath) ) && - EnumProcesses( aProcesses, sizeof(aProcesses), &dwSize ) ) - { - unsigned nProcesses = dwSize / sizeof(aProcesses[0]); - - for ( unsigned i = 0; !dwProcessId && i < nProcesses; i++ ) - { - HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i] ); - - if ( IsValidHandle(hProcess) ) - { - TCHAR szModulePath[MAX_PATH+1]; - - if ( GetModuleFileNameEx( hProcess, NULL, szModulePath, MAX_PATH ) ) - { - TCHAR szShortModulePath[MAX_PATH]; - - if ( GetShortPathName( szModulePath, szShortModulePath, SAL_N_ELEMENTS(szShortModulePath) ) ) - { - if ( 0 == _tcsicmp( szShortModulePath, szShortImagePath ) ) - dwProcessId = aProcesses[i]; - } - } - - CloseHandle( hProcess ); - } - } - } - - return dwProcessId; -} -//*************************************************************************** - -static bool ParseCommandArgs( LPDWORD pdwProcessId, PEXCEPTION_POINTERS* ppException, LPDWORD pdwThreadId ) -{ - int argc = __argc; -#ifdef __MINGW32__ -#ifdef _UNICODE - TCHAR **argv = reinterpret_cast(alloca((argc+1)*sizeof(WCHAR*))); - int *sizes = reinterpret_cast(alloca(argc*sizeof(int))); - int argsize=0; - char **ptr; - int i; - ptr=__argv; - for (i = 0; i < argc; ++i) - { - sizes[i]=MultiByteToWideChar(CP_ACP, 0, *ptr, -1, NULL, 0); - argsize+=sizes[i]+1; - ++ptr; - } - ++argsize; - TCHAR *args = reinterpret_cast(alloca(argsize*sizeof(WCHAR))); - ptr=__argv; - TCHAR *cptr=args; - for (i = 0; i < argc; ++i) - { - argv[i]=cptr; - MultiByteToWideChar( CP_ACP, 0, *ptr, -1, cptr, sizes[i] ); - ++ptr; - cptr+=sizes[i]; - *cptr=0; - ++cptr; - } - argv[i]=cptr; - *cptr=0; -#else - TCHAR **argv = __argv; -#endif -#else - TCHAR **argv = __targv; -#endif - bool bSuccess = true; - - for ( int argn = 1; bSuccess && argn < argc; argn++ ) - { - if ( 0 == _tcsicmp( argv[argn], _T("-h") ) || - 0 == _tcsicmp( argv[argn], _T("/h") ) || - 0 == _tcsicmp( argv[argn], _T("-?") ) || - 0 == _tcsicmp( argv[argn], _T("/?") ) || - 0 == _tcsicmp( argv[argn], _T("/help") ) || - 0 == _tcsicmp( argv[argn], _T("-help") ) || - 0 == _tcsicmp( argv[argn], _T("--help") ) - ) - { - HINSTANCE hInstance = GetModuleHandle(NULL); - TCHAR szUsage[FORMATBUFSIZE]; - TCHAR szProcess[FORMATBUFSIZE]; - TCHAR szProcessDescription[FORMATBUFSIZE]; - TCHAR szHelpDescription[FORMATBUFSIZE]; - - LoadAndFormatString( hInstance, IDS_MSG_CMDLINE_USAGE, szUsage, SAL_N_ELEMENTS(szUsage) ); - LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID, szProcess, SAL_N_ELEMENTS(szProcess) ); - LoadAndFormatString( hInstance, IDS_MSG_PARAM_PROCESSID_DESCRIPTION, szProcessDescription, SAL_N_ELEMENTS(szProcessDescription) ); - LoadAndFormatString( hInstance, IDS_MSG_PARAM_HELP_DESCRIPTION, szHelpDescription, SAL_N_ELEMENTS(szHelpDescription) ); - - _tprintf( - TEXT("\n%s: crashrep %s\n\n") - TEXT("/?, -h[elp] %s\n\n") - TEXT("%-20s %s\n\n"), - szUsage, szProcess, szHelpDescription, szProcess, szProcessDescription - ); - - return true; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-p") ) || - 0 == _tcsicmp( argv[argn], _T("/p") ) ) - { - if ( ++argn < argc ) - *pdwProcessId = _tcstoul( argv[argn], NULL, 0 ); - else - bSuccess = false; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-excp") ) || - 0 == _tcsicmp( argv[argn], _T("/excp") ) ) - { - if ( ++argn < argc ) - *ppException = (PEXCEPTION_POINTERS)_tcstoul( argv[argn], NULL, 0 ); - else - bSuccess = false; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-t") ) || - 0 == _tcsicmp( argv[argn], _T("/t") ) ) - { - if ( ++argn < argc ) - *pdwThreadId = _tcstoul( argv[argn], NULL, 0 ); - else - bSuccess = false; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-noui") ) || - 0 == _tcsicmp( argv[argn], _T("/noui") ) ) - { - g_bNoUserInterface = true; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-send") ) || - 0 == _tcsicmp( argv[argn], _T("/send") ) ) - { - g_bSendReport = true; - } - else if ( 0 == _tcsicmp( argv[argn], _T("-load") ) || - 0 == _tcsicmp( argv[argn], _T("/load") ) ) - { - g_bLoadReport = true; - } - else // treat parameter as image path - { - TCHAR szImagePath[MAX_PATH]; - LPTSTR lpImageName; - - if ( GetFullPathName( argv[argn], MAX_PATH, szImagePath, &lpImageName ) ) - { - DWORD dwProcessId = FindProcessForImage( szImagePath ); - - if ( dwProcessId ) - *pdwProcessId = dwProcessId; - else - bSuccess = false; - } - } - } - - if ( !*pdwProcessId && !g_bLoadReport ) - { - TCHAR szImagePath[MAX_PATH]; - LPTSTR lpImageName; - - if ( GetFullPathName( TEXT("soffice.exe"), MAX_PATH, szImagePath, &lpImageName ) ) - { - DWORD dwProcessId = FindProcessForImage( szImagePath ); - - if ( dwProcessId ) - *pdwProcessId = dwProcessId; - else - bSuccess = false; - } - } - - return bSuccess; -} - -//*************************************************************************** - -BOOL WriteCommentFile( LPCTSTR lpComment ) -{ - BOOL fSuccess = FALSE; - TCHAR szTempPath[MAX_PATH]; - - if ( GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath ) ) - { - TCHAR szFileName[MAX_PATH]; - - if ( GetTempFileName( szTempPath, TEXT("CMT"), 0, szFileName ) ) - { - HANDLE hFile = CreateFile( szFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - - if ( hFile ) - { - DWORD dwBytesWritten; - - int needed = WideCharToMultiByte( CP_UTF8, 0, lpComment, -1, NULL, 0, NULL, NULL ); - if ( needed ) - { - char *lpCommentUTF8 = (char *)alloca( needed ); - WideCharToMultiByte( CP_UTF8, 0, lpComment, -1, lpCommentUTF8, needed, NULL, NULL ); - fSuccess = WriteFile( hFile, lpCommentUTF8, strlen(lpCommentUTF8), &dwBytesWritten, NULL ); - } - else - fSuccess = TRUE; - - - CloseHandle( hFile ); - - WideCharToMultiByte( CP_ACP, 0, szFileName, -1, g_szCommentFileNameA, MAX_PATH, NULL, NULL ); - } - - if ( !fSuccess ) - DeleteFile( szFileName ); - } - } - - return fSuccess; -} - -//*************************************************************************** - -static int _tsetenv( const _TCHAR *lpVar, const _TCHAR *lpValue ) -{ - if ( !lpValue ) - lpValue = _T(""); - - _TCHAR *envstr = (TCHAR *)alloca( (_tcslen( lpVar ) + _tcslen( lpValue ) + 2) * sizeof(_TCHAR) ); - - _tcscpy( envstr, lpVar ); - _tcscat( envstr, _T("=") ); - _tcscat( envstr, lpValue ); - - return _tputenv( envstr ); -} - -static bool read_line( FILE *fp, string& rLine ) -{ - char szBuffer[1024]; - bool bSuccess = false; - bool bEOL = false; - string line; - - - while ( !bEOL && fgets( szBuffer, sizeof(szBuffer), fp ) ) - { - int len = strlen(szBuffer); - - bSuccess = true; - - while ( len && szBuffer[len - 1] == '\n' ) - { - szBuffer[--len] = 0; - bEOL = true; - } - - line.append( szBuffer ); - } - - rLine = line; - return bSuccess; -} - -static string get_script_string( const char *pFileName, const char *pKeyName ) -{ - FILE *fp = fopen( pFileName, "rt" ); - string retValue; - - if ( fp ) - { - string line; - string section; - - while ( read_line( fp, line ) ) - { - line = trim_string( line ); - - - string::size_type iEqualSign = line.find( '=', 0 ); - - if ( iEqualSign != string::npos ) - { - string keyname = line.substr( 0, iEqualSign ); - keyname = trim_string( keyname ); - - string value = line.substr( sal::static_int_cast(iEqualSign + 1) ); - value = trim_string( value ); - - if ( value.length() && '\"' == value[0] ) - { - value.erase( 0, 1 ); - - string::size_type iQuotes = value.find( '"', 0 ); - - if ( iQuotes != string::npos ) - value.erase( iQuotes ); - } - - if ( 0 == stricmp( keyname.c_str(), pKeyName ) ) - { - retValue = value; - break; - } - } - } - - fclose( fp ); - } - - return retValue; -} - -static bool ReadBootstrapParams( CrashReportParams &rParams ) -{ - TCHAR szBuffer[256] = TEXT(""); - TCHAR szModuleName[MAX_PATH]; - TCHAR szModuleVersionName[MAX_PATH]; - TCHAR szDrive[_MAX_DRIVE]; - TCHAR szDir[_MAX_DIR]; - TCHAR szFName[_MAX_FNAME]; - TCHAR szExt[_MAX_EXT]; - TCHAR szReportServer[MAX_HOSTNAME]; - TCHAR szReportPort[256]; - bool bSuccess = false; - - GetModuleFileName( NULL, szModuleName, MAX_PATH ); - _tsplitpath( szModuleName, szDrive, szDir, szFName, szExt ); - _tmakepath( szModuleName, szDrive, szDir, _T("bootstrap"), _T(".ini") ); - _tmakepath( szModuleVersionName, szDrive, szDir, _T("version"), _T(".ini") ); - - if ( - GetPrivateProfileString( - TEXT("Bootstrap"), - TEXT("ProductKey"), - TEXT("OpenOffice.org"), - szBuffer, - SAL_N_ELEMENTS(szBuffer), - szModuleName ) - ) - { - TCHAR *pVersion = _tcschr( szBuffer, ' ' ); - - g_wstrProductKey = szBuffer; - - if ( pVersion ) - { - *pVersion = 0; - pVersion++; - } - else - pVersion = TEXT(""); - - if ( !_tgetenv( _T("PRODUCTNAME") ) ) - { - _tsetenv( TEXT("PRODUCTNAME"), szBuffer ); - } - if ( !_tgetenv( _T("PRODUCTVERSION") ) ) - _tsetenv( TEXT("PRODUCTVERSION"), pVersion ); - } - - GetPrivateProfileString( - TEXT("Version"), - TEXT("buildid"), - TEXT("unknown"), - g_szBuildId, SAL_N_ELEMENTS(g_szBuildId), - szModuleVersionName ); - - g_strDefaultLanguage = get_script_string( "instdb.inf", "DefaultLanguage" ); - - if ( GetPrivateProfileString( - TEXT("ErrorReport"), - TEXT("ErrorReportPort"), - TEXT("80"), - szReportPort, SAL_N_ELEMENTS(szReportPort), - szModuleName - ) ) - { - TCHAR *endptr = NULL; - - unsigned short uReportPort = (unsigned short)_tcstoul( szReportPort, &endptr, 10 ); - if ( uReportPort ) - g_uReportPort = uReportPort; - } - - if ( GetPrivateProfileString( - TEXT("ErrorReport"), - TEXT("ErrorReportServer"), - TEXT(""), - szReportServer, SAL_N_ELEMENTS(szReportServer), - szModuleName - ) ) - { - bSuccess = 0 != WideCharToMultiByte( CP_ACP, 0, szReportServer, -1, g_szReportServerA, SAL_N_ELEMENTS(g_szReportServerA), NULL, NULL ); - } - - LPCTSTR lpEnvString; - - if ( 0 != (lpEnvString = _tgetenv( _T("ERRORREPORT_PROXYSERVER") )) ) - rParams.sProxyServer = lpEnvString; - - if ( 0 != (lpEnvString = _tgetenv( _T("ERRORREPORT_PROXYPORT") )) ) - rParams.sProxyPort = lpEnvString; - - if ( 0 != (lpEnvString = _tgetenv( _T("ERRORREPORT_SENDERADDRESS") )) ) - rParams.sEmail = lpEnvString; - - return bSuccess; -} - -//*************************************************************************** - -bool SendHTTPRequest( - FILE *fp, - const char *pszServer, - unsigned short uPort = 80, - const char *pszProxyServer = NULL, - unsigned short uProxyPort = 8080 ) -{ - bool success = false; - - struct hostent *hp; - - if ( pszProxyServer ) - hp = gethostbyname( pszProxyServer ); - else - hp = gethostbyname( pszServer ); - - if ( hp ) - { - SOCKET s = socket( AF_INET, SOCK_STREAM, 0 ); - - if ( s ) - { - struct sockaddr_in address; - - memcpy(&(address.sin_addr.s_addr), *(hp->h_addr_list),sizeof(struct in_addr)); - address.sin_family = AF_INET; - - if ( pszProxyServer ) - address.sin_port = ntohs( uProxyPort ); - else - address.sin_port = ntohs( uPort ); - - if ( 0 == connect( s, (struct sockaddr *)&address, sizeof(struct sockaddr_in)) ) - { - fseek( fp, 0, SEEK_END ); - size_t length = ftell( fp ); - fseek( fp, 0, SEEK_SET ); - - char buffer[2048]; - - if ( pszProxyServer ) - sprintf( buffer, - "POST http://%s:%d/soap/servlet/rpcrouter HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: %d\r\n" - "SOAPAction: \"\"\r\n\r\n", - pszServer, - uPort, - length - ); - else - sprintf( buffer, - "POST /soap/servlet/rpcrouter HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: %d\r\n" - "SOAPAction: \"\"\r\n\r\n", - length - ); - - if ( SOCKET_ERROR != send( s, buffer, strlen(buffer), 0 ) ) - { - size_t nBytes; - - do - { - nBytes = fread( buffer, 1, sizeof(buffer), fp ); - - if ( nBytes ) - success = SOCKET_ERROR != send( s, buffer, nBytes, 0 ); - } while( nBytes && success ); - - if ( success ) - { - memset( buffer, 0, sizeof(buffer) ); - success = SOCKET_ERROR != recv( s, buffer, sizeof(buffer), 0 ); - if ( success ) - { - char szHTTPSignature[sizeof(buffer)] = ""; - unsigned uHTTPReturnCode = 0; - - sscanf( buffer, "%s %d ", szHTTPSignature, &uHTTPReturnCode ); - success = uHTTPReturnCode == 200; - } - } - } - - } - - closesocket( s ); - } - } - - return success; -} - -//*************************************************************************** - -static void WriteSOAPRequest( FILE *fp ) -{ - fprintf( fp, - "\n" - "\n" - "\n" - ); - - fprintf( fp, "\n" ); - fprintf( fp, "This is an autogenerated crash report mail.\n" ); - fprintf( fp, "\n" ); - - FILE *fpin = fopen( g_szReportFileNameA, "r" ); - if ( fpin ) - { - fprintf( fp, - "\n" - "reportmail.xml\n" - "\n" ); - fclose( fpin ); - } - - fpin = fopen( g_szCommentFileNameA, "r" ); - if ( fpin ) - { - fprintf( fp, - "\n" - "description.txt\n" - "\n" ); - fclose( fpin ); - }; - - - fpin = fopen( g_szDumpFileNameA, "rb" ); - if ( fpin ) - { - FILE *fptemp = _tmpfile(); - - if ( fptemp ) - { - if ( base64_encode( fpin, fptemp ) ) - { - fseek( fptemp, 0, SEEK_SET ); - fprintf( fp, - "\n" - "user.dmp\n" - "" ); - fcopy( fptemp, fp ); - fprintf( fp, "\n" ); - } - fclose( fptemp ); - } - fclose( fpin ); - } - - fprintf( fp, - "\n" - "\n" - "\n" - "\n" - ); -} - -//*************************************************************************** - -struct RequestParams -{ - bool success; - FILE *fpin; - const char *lpServer; - unsigned short uPort; - const char *lpProxyServer; - unsigned short uProxyPort; - HWND hwndStatus; -}; - -void _cdecl SendingThread( void *lpArgs ) -{ - RequestParams *pParams = (RequestParams *)lpArgs; - - pParams->success = SendHTTPRequest( pParams->fpin, pParams->lpServer, pParams->uPort, pParams->lpProxyServer, pParams->uProxyPort ); - - PostMessage( pParams->hwndStatus, WM_COMMAND, IDOK, 0 ); -} - -//*************************************************************************** - -BOOL CALLBACK SendingStatusDialogProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam - ) -{ - static RequestParams *pRequest = NULL; - static HANDLE hSendingThread = NULL; - - switch ( uMsg ) - { - case WM_INITDIALOG: - { - TCHAR szBuffer[1024] = TEXT(""); - HINSTANCE hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE ); - //HWND hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT ); - - pRequest = (RequestParams *)lParam; - - LoadAndFormatString( hInstance, IDS_SENDING_REPORT_HEADER, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - SetWindowText( hwndDlg, szBuffer ); - - LoadAndFormatString( hInstance, IDS_SENDING_REPORT_STATUS, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Static_SetText( GetDlgItem(hwndDlg, IDC_SENDING_REPORT_STATUS), szBuffer ); - - LoadAndFormatString( hInstance, IDS_CANCEL_BUTTON, szBuffer, SAL_N_ELEMENTS(szBuffer) ); - Button_SetText( GetDlgItem(hwndDlg, IDCANCEL), szBuffer ); - - pRequest->hwndStatus = hwndDlg; - - hSendingThread = (HANDLE)_beginthread( SendingThread, 0, pRequest ); - } - return TRUE; - case WM_COMMAND: - switch ( LOWORD(wParam) ) - { - case IDCANCEL: - TerminateThread( hSendingThread, 0 ); - case IDOK: - WaitForSingleObject( hSendingThread, INFINITE ); - CloseHandle( hSendingThread ); - EndDialog( hwndDlg, wParam ); - return TRUE; - } - break; - default: - break; - } - - return FALSE; -} - -//*************************************************************************** - -bool SendCrashReport( HWND hwndParent, const CrashReportParams &rParams ) -{ - bool success = false; - char szProxyServer[1024] = ""; - unsigned short uProxyPort = 8080; - TCHAR *endptr = NULL; - - switch ( rParams.uInternetConnection ) - { - case 2: - { - WideCharToMultiByte( - CP_ACP, 0, rParams.sProxyServer.c_str(), -1, - szProxyServer, sizeof(szProxyServer), NULL, NULL ); - uProxyPort = (unsigned short)_tcstoul( rParams.sProxyPort.c_str(), &endptr, 10 ); - } - break; - case 0: - { - DWORD dwProxyEnable = 0; - - RegReadValue( HKEY_CURRENT_USER, - TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), - TEXT("ProxyEnable"), - &dwProxyEnable, - sizeof(dwProxyEnable) ); - - if ( dwProxyEnable ) - { - TCHAR tszProxyServers[1024] = TEXT(""); - - if ( ERROR_SUCCESS == RegReadValue( HKEY_CURRENT_USER, - TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), TEXT("ProxyServer"), - tszProxyServers, - sizeof(tszProxyServers) ) ) - { - TCHAR *lpHttpStart = _tcsstr( tszProxyServers, TEXT("http=") ); - - if ( lpHttpStart ) - lpHttpStart += 5; - else - lpHttpStart = tszProxyServers; - - TCHAR *lpHttpEnd = _tcschr( lpHttpStart, ';' ); - - if ( lpHttpEnd ) - *lpHttpEnd = 0; - - char szHTTPProxyServer[1024] = ""; - WideCharToMultiByte( CP_ACP, 0, lpHttpStart, -1, szHTTPProxyServer, sizeof(szHTTPProxyServer), NULL, NULL ); - - char *lpColon = strchr( szHTTPProxyServer, ':' ); - - if ( lpColon ) - { - char *endptr = NULL; - - *lpColon = 0; - uProxyPort = (unsigned short)strtoul( lpColon + 1, &endptr, 10 ); - } - else - uProxyPort = 8080; - - strcpy( szProxyServer, szHTTPProxyServer ); - - } - } - } - break; - default: - case 1: - break; - } - - FILE *fptemp = _tmpfile(); - if ( fptemp ) - { - RequestParams request; - - request.success = false; - request.fpin = fptemp; - request.lpServer = REPORT_SERVER; - request.uPort = REPORT_PORT; - request.lpProxyServer = szProxyServer[0] ? szProxyServer : NULL; - request.uProxyPort = uProxyPort; - request.hwndStatus = NULL; - - WriteSOAPRequest( fptemp ); - fseek( fptemp, 0, SEEK_SET ); - - if ( hwndParent ) - { - int retid = DialogBoxParam( - GetModuleHandle(NULL), - MAKEINTRESOURCE(IDD_SENDING_STATUS), - hwndParent, - SendingStatusDialogProc, - (LPARAM)&request - ); - - success = request.success; - - if ( IDOK == retid ) - { - if ( !success ) - { - TCHAR szMessage[1024]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, SAL_N_ELEMENTS(szMessage) ); - - MessageBox( hwndParent, szMessage, NULL, MB_ICONERROR | MB_OK ); - } - else - { - TCHAR szMessage[1024]; - TCHAR szTitle[1024]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_STATUS_FINISHED, szMessage, SAL_N_ELEMENTS(szMessage) ); - LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_HEADER, szTitle, SAL_N_ELEMENTS(szTitle) ); - - MessageBox( hwndParent, szMessage, szTitle, MB_ICONINFORMATION | MB_OK ); - } - } - - } - else - { - HANDLE hSendingThread = (HANDLE)_beginthread( SendingThread, 0, (void *)&request ); - - WaitForSingleObject( hSendingThread, INFINITE ); - - success = request.success; - if ( !success ) - { - TCHAR szMessage[1024]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_PROXY, szMessage, SAL_N_ELEMENTS(szMessage) ); - _ftprintf( stderr, _T("ERROR: %s\n"), szMessage ); - } - else - { - TCHAR szMessage[1024]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_SENDING_REPORT_STATUS_FINISHED, szMessage, SAL_N_ELEMENTS(szMessage) ); - - _ftprintf( stderr, _T("SUCCESS: %s\n"), szMessage ); - } - } - fclose( fptemp ); - } - else - { - TCHAR szMessage[1024]; - - LoadAndFormatString( GetModuleHandle(NULL), IDS_ERROR_MSG_DISK_FULL, szMessage, SAL_N_ELEMENTS(szMessage) ); - - if ( hwndParent ) - MessageBox( hwndParent, szMessage, NULL, MB_ICONERROR | MB_OK ); - else - _ftprintf( stderr, _T("ERROR: %s\n"), szMessage ); - } - - return success; -} - -//*************************************************************************** - -#ifdef __MINGW32__ -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR /*lpCmdLine*/, int ) -#else -int WINAPI _tWinMain( HINSTANCE hInstance, HINSTANCE, LPTSTR /*lpCmdLine*/, int ) -#endif -{ - int exitcode = -1; - int argc = __argc; - -#ifdef __MINGW32__ - char **argv = __argv; -#else -#ifdef _UNICODE - char **argv = new char *[argc + 1]; - - for ( int argn = 0; argn < argc; argn++ ) - { - int nBytes = WideCharToMultiByte( CP_ACP, 0, __targv[argn], -1, NULL, 0, NULL, NULL ); - argv[argn] = new char[nBytes]; - WideCharToMultiByte( CP_ACP, 0, __targv[argn], -1, argv[argn], nBytes, NULL, NULL ); - } - argv[argc] = NULL; -#else - char **argv = __targv; -#endif -#endif - - osl_setCommandArgs( argc, argv ); - - PEXCEPTION_POINTERS pExceptionPointers = NULL; - DWORD dwProcessId = 0; - DWORD dwThreadId = 0; - - WSADATA wsaData; - WORD wVersionRequested; - - wVersionRequested = MAKEWORD(1, 1); - WSAStartup(wVersionRequested, &wsaData); - - CrashReportParams Params; - - Params.ReadFromRegistry(); - Params.ReadFromEnvironment(); - - if ( ReadBootstrapParams( Params ) && - ParseCommandArgs( &dwProcessId, &pExceptionPointers, &dwThreadId ) ) - { - bool bGotDumpFile; - - if ( g_bLoadReport ) - bGotDumpFile = FindDumpFile(); - else - bGotDumpFile = WriteDumpFile( dwProcessId, pExceptionPointers, dwThreadId ); - - if( bGotDumpFile ) - { - boost::unordered_map< string, string > aLibraries; - - if ( g_bLoadReport ) - { - g_fpStackFile = _open_reportfile( _T(".stk"), _T("rb") ); - g_fpChecksumFile = _open_reportfile( _T(".chk"), _T("rb") ); - } - else - { - if ( g_bSendReport ) - { - g_fpStackFile = _tmpfile(); - g_fpChecksumFile = _tmpfile(); - } - else - { - g_fpStackFile = _open_reportfile( _T(".stk"), _T("w+b") ); - g_fpChecksumFile = _open_reportfile( _T(".chk"), _T("w+b") ); - - FILE *fpUnsent = _open_reportfile( _T(".lck"), _T("w+b") ); - if ( fpUnsent ) - { - fprintf( fpUnsent, "Unsent\r\n" ); - fclose( fpUnsent ); - } - } - - WriteStackFile( g_fpStackFile, aLibraries, dwProcessId, pExceptionPointers ); - WriteChecksumFile( g_fpChecksumFile, aLibraries ); - WriteReportFile( &Params ); - - FILE *fpPreview = _open_reportfile( _T(".prv"), _T("w+b") ); - - if ( fpPreview ) - { - FILE *fp = fopen( g_szReportFileNameA, "rb" ); - if ( fp ) - { - fcopy( fp, fpPreview ); - fclose( fp ); - } - fclose( fpPreview ); - } - } - - if ( g_bSendReport ) - { - InitCommonControls(); - - // Actually this should never be true anymore - if ( !g_bNoUserInterface && InitRichEdit() ) - { - - INT_PTR result = DialogBoxParam( hInstance, MAKEINTRESOURCE(IDD_DIALOG_FRAME), NULL, DialogProc, (LPARAM)&Params ); - - if ( result > 0 ) - { - exitcode = 0; - } - DeinitRichEdit(); - } - else - { - WriteCommentFile( Params.sComment.c_str() ); - WriteReportFile( &Params ); - if ( SendCrashReport( NULL, Params ) ) - exitcode = 0; - } - - - if ( g_szReportFileNameA[0] ) - DeleteFileA( g_szReportFileNameA ); - - if ( g_szCommentFileNameA[0] ) - DeleteFileA( g_szCommentFileNameA ); - } - else - { - if ( g_szReportFileNameA[0] ) - DeleteFileA( g_szReportFileNameA ); - exitcode = 0; - } - - if ( g_szDumpFileNameA[0] && g_bSendReport ) - DeleteFileA( g_szDumpFileNameA ); - - if ( g_fpStackFile ) - fclose( g_fpStackFile ); - - if ( g_fpChecksumFile ) - fclose( g_fpChecksumFile ); - } - } - - - return exitcode; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk deleted file mode 100644 index b0ac2f591..000000000 --- a/cui/AllLangResTarget_cui.mk +++ /dev/null @@ -1,135 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_AllLangResTarget_AllLangResTarget,cui)) - -$(eval $(call gb_AllLangResTarget_set_reslocation,cui,svx)) - -$(eval $(call gb_AllLangResTarget_add_srs,cui,\ - cui/res \ -)) - -$(eval $(call gb_SrsTarget_SrsTarget,cui/res)) - -$(eval $(call gb_SrsTarget_set_include,cui/res,\ - $$(INCLUDE) \ - -I$(realpath $(SRCDIR)/cui/source/inc) \ - -I$(OUTDIR)/inc \ -)) - -$(eval $(call gb_SrsTarget_add_files,cui/res,\ - cui/source/customize/acccfg.src \ - cui/source/customize/cfg.src \ - cui/source/customize/eventdlg.src \ - cui/source/customize/macropg.src \ - cui/source/customize/selector.src \ - cui/source/dialogs/about.src \ - cui/source/dialogs/charmap.src \ - cui/source/dialogs/colorpicker.src \ - cui/source/dialogs/commonlingui.src \ - cui/source/dialogs/cuiimapdlg.src \ - cui/source/dialogs/dlgname.src \ - cui/source/dialogs/fmsearch.src \ - cui/source/dialogs/gallery.src \ - cui/source/dialogs/grfflt.src \ - cui/source/dialogs/hangulhanjadlg.src \ - cui/source/dialogs/hlmarkwn.src \ - cui/source/dialogs/hyperdlg.src \ - cui/source/dialogs/hyphen.src \ - cui/source/dialogs/iconcdlg.src \ - cui/source/dialogs/insrc.src \ - cui/source/dialogs/multipat.src \ - cui/source/dialogs/newtabledlg.src \ - cui/source/dialogs/passwdomdlg.src \ - cui/source/dialogs/postdlg.src \ - cui/source/dialogs/scriptdlg.src \ - cui/source/dialogs/sdrcelldlg.src \ - cui/source/dialogs/showcols.src \ - cui/source/dialogs/SpellDialog.src \ - cui/source/dialogs/splitcelldlg.src \ - cui/source/dialogs/srchxtra.src \ - cui/source/dialogs/svuidlg.src \ - cui/source/dialogs/tbxform.src \ - cui/source/dialogs/thesdlg.src \ - cui/source/dialogs/zoom.src \ - cui/source/options/connpooloptions.src \ - cui/source/options/dbregister.src \ - cui/source/options/doclinkdialog.src \ - cui/source/options/fontsubs.src \ - cui/source/options/internationaloptions.src \ - cui/source/options/optaccessibility.src \ - cui/source/options/optasian.src \ - cui/source/options/optchart.src \ - cui/source/options/optcolor.src \ - cui/source/options/optctl.src \ - cui/source/options/optdict.src \ - cui/source/options/optfltr.src \ - cui/source/options/optgdlg.src \ - cui/source/options/optgenrl.src \ - cui/source/options/opthtml.src \ - cui/source/options/optimprove.src \ - cui/source/options/optinet2.src \ - cui/source/options/optjava.src \ - cui/source/options/optjsearch.src \ - cui/source/options/optlingu.src \ - cui/source/options/optmemory.src \ - cui/source/options/optpath.src \ - cui/source/options/optsave.src \ - cui/source/options/optupdt.src \ - cui/source/options/readonlyimage.src \ - cui/source/options/securityoptions.src \ - cui/source/options/treeopt.src \ - cui/source/options/webconninfo.src \ - cui/source/tabpages/align.src \ - cui/source/tabpages/autocdlg.src \ - cui/source/tabpages/backgrnd.src \ - cui/source/tabpages/bbdlg.src \ - cui/source/tabpages/border.src \ - cui/source/tabpages/chardlg.src \ - cui/source/tabpages/connect.src \ - cui/source/tabpages/dstribut.src \ - cui/source/tabpages/frmdirlbox.src \ - cui/source/tabpages/grfpage.src \ - cui/source/tabpages/labdlg.src \ - cui/source/tabpages/macroass.src \ - cui/source/tabpages/measure.src \ - cui/source/tabpages/numfmt.src \ - cui/source/tabpages/numpages.src \ - cui/source/tabpages/page.src \ - cui/source/tabpages/paragrph.src \ - cui/source/tabpages/strings.src \ - cui/source/tabpages/swpossizetabpage.src \ - cui/source/tabpages/tabarea.src \ - cui/source/tabpages/tabline.src \ - cui/source/tabpages/tabstpge.src \ - cui/source/tabpages/textanim.src \ - cui/source/tabpages/textattr.src \ - cui/source/tabpages/transfrm.src \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk deleted file mode 100644 index 51f2b46b7..000000000 --- a/cui/Library_cui.mk +++ /dev/null @@ -1,224 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_Library_Library,cui)) - -$(eval $(call gb_Library_set_componentfile,cui,cui/util/cui)) - -$(eval $(call gb_Library_add_precompiled_header,cui,$(SRCDIR)/cui/inc/pch/precompiled_cui)) - -$(eval $(call gb_Library_set_include,cui,\ - $$(INCLUDE) \ - -I$(realpath $(SRCDIR)/cui/source/inc) \ - -I$(OUTDIR)/inc \ -)) - -$(eval $(call gb_Library_add_defs,cui,\ - $(if $(filter TRUE,$(ENABLE_GTK)),-DENABLE_GTK) \ - $(if $(filter TRUE,$(ENABLE_KDE)),-DENABLE_KDE) \ - $(if $(filter TRUE,$(ENABLE_KDE4)),-DENABLE_KDE4) \ -)) - -$(eval $(call gb_Library_add_api,cui,\ - offapi \ - udkapi \ -)) - -# .IF "$(ENABLE_LAYOUT)" == "TRUE" -# CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc -# .ENDIF # ENABLE_LAYOUT == TRUE - -$(eval $(call gb_Library_add_linked_libs,cui,\ - avmedia \ - basegfx \ - comphelper \ - cppu \ - cppuhelper \ - editeng \ - i18nisolang1 \ - jvmfwk \ - lng \ - sal \ - sax \ - sb \ - sfx \ - sot \ - svl \ - svt \ - svxcore \ - svx \ - tk \ - tl \ - ucbhelper \ - utl \ - vcl \ - $(gb_STDLIBS) \ -)) - -$(eval $(call gb_Library_use_externals,cui,\ - icuuc \ -)) - -ifeq ($(GUI),WNT) -$(eval $(call gb_Library_add_linked_libs,cui,\ - advapi32 \ - shlwapi \ -)) -endif - -$(eval $(call gb_Library_add_exception_objects,cui,\ - cui/source/customize/acccfg \ - cui/source/customize/cfg \ - cui/source/customize/cfgutil \ - cui/source/customize/eventdlg \ - cui/source/customize/macropg \ - cui/source/customize/selector \ - cui/source/dialogs/about \ - cui/source/dialogs/colorpicker \ - cui/source/dialogs/commonlingui \ - cui/source/dialogs/cuicharmap \ - cui/source/dialogs/cuifmsearch \ - cui/source/dialogs/cuigaldlg \ - cui/source/dialogs/cuigrfflt \ - cui/source/dialogs/cuihyperdlg \ - cui/source/dialogs/cuiimapwnd \ - cui/source/dialogs/cuitbxform \ - cui/source/dialogs/dlgname \ - cui/source/dialogs/hangulhanjadlg \ - cui/source/dialogs/hldocntp \ - cui/source/dialogs/hldoctp \ - cui/source/dialogs/hlinettp \ - cui/source/dialogs/hlmailtp \ - cui/source/dialogs/hlmarkwn \ - cui/source/dialogs/hltpbase \ - cui/source/dialogs/hyphen \ - cui/source/dialogs/iconcdlg \ - cui/source/dialogs/insdlg \ - cui/source/dialogs/insrc \ - cui/source/dialogs/linkdlg \ - cui/source/dialogs/multifil \ - cui/source/dialogs/multipat \ - cui/source/dialogs/newtabledlg \ - cui/source/dialogs/passwdomdlg \ - cui/source/dialogs/pastedlg \ - cui/source/dialogs/plfilter \ - cui/source/dialogs/postdlg \ - cui/source/dialogs/scriptdlg \ - cui/source/dialogs/sdrcelldlg \ - cui/source/dialogs/showcols \ - cui/source/dialogs/SpellAttrib \ - cui/source/dialogs/SpellDialog \ - cui/source/dialogs/splitcelldlg \ - cui/source/dialogs/srchxtra \ - cui/source/dialogs/thesdlg \ - cui/source/dialogs/zoom \ - cui/source/factory/cuiexp \ - cui/source/factory/cuiresmgr \ - cui/source/factory/dlgfact \ - cui/source/factory/init \ - cui/source/options/cfgchart \ - cui/source/options/connpoolconfig \ - cui/source/options/connpooloptions \ - cui/source/options/connpoolsettings \ - cui/source/options/cuisrchdlg \ - cui/source/options/dbregister \ - cui/source/options/dbregisterednamesconfig \ - cui/source/options/dbregistersettings \ - cui/source/options/doclinkdialog \ - cui/source/options/fontsubs \ - cui/source/options/internationaloptions \ - cui/source/options/optaccessibility \ - cui/source/options/optasian \ - cui/source/options/optchart \ - cui/source/options/optcolor \ - cui/source/options/optctl \ - cui/source/options/optdict \ - cui/source/options/optfltr \ - cui/source/options/optgdlg \ - cui/source/options/optgenrl \ - cui/source/options/optHeaderTabListbox \ - cui/source/options/opthtml \ - cui/source/options/optimprove2 \ - cui/source/options/optimprove \ - cui/source/options/optinet2 \ - cui/source/options/optjava \ - cui/source/options/optjsearch \ - cui/source/options/optlingu \ - cui/source/options/optmemory \ - cui/source/options/optpath \ - cui/source/options/optsave \ - cui/source/options/optupdt \ - cui/source/options/radiobtnbox \ - cui/source/options/readonlyimage \ - cui/source/options/sdbcdriverenum \ - cui/source/options/securityoptions \ - cui/source/options/treeopt \ - cui/source/options/webconninfo \ - cui/source/tabpages/align \ - cui/source/tabpages/autocdlg \ - cui/source/tabpages/backgrnd \ - cui/source/tabpages/bbdlg \ - cui/source/tabpages/borderconn \ - cui/source/tabpages/border \ - cui/source/tabpages/chardlg \ - cui/source/tabpages/connect \ - cui/source/tabpages/dstribut \ - cui/source/tabpages/grfpage \ - cui/source/tabpages/labdlg \ - cui/source/tabpages/macroass \ - cui/source/tabpages/measure \ - cui/source/tabpages/numfmt \ - cui/source/tabpages/numpages \ - cui/source/tabpages/page \ - cui/source/tabpages/paragrph \ - cui/source/tabpages/swpossizetabpage \ - cui/source/tabpages/tabarea \ - cui/source/tabpages/tabline \ - cui/source/tabpages/tabstpge \ - cui/source/tabpages/textanim \ - cui/source/tabpages/textattr \ - cui/source/tabpages/tparea \ - cui/source/tabpages/tpbitmap \ - cui/source/tabpages/tpcolor \ - cui/source/tabpages/tpgradnt \ - cui/source/tabpages/tphatch \ - cui/source/tabpages/tpline \ - cui/source/tabpages/tplnedef \ - cui/source/tabpages/tplneend \ - cui/source/tabpages/tpshadow \ - cui/source/tabpages/transfrm \ - cui/source/uno/services \ -)) - -ifeq ($(GUI),WNT) -$(eval $(call gb_Library_add_exception_objects,cui,\ - cui/source/dialogs/winpluginlib \ -)) -endif - -# vim: set noet sw=4 ts=4: diff --git a/cui/Makefile b/cui/Makefile deleted file mode 100644 index 8d7111991..000000000 --- a/cui/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# 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/cui/Module_cui.mk b/cui/Module_cui.mk deleted file mode 100644 index 1644c79dc..000000000 --- a/cui/Module_cui.mk +++ /dev/null @@ -1,36 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_Module_Module,cui)) - -$(eval $(call gb_Module_add_targets,cui,\ - AllLangResTarget_cui \ - Library_cui \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/cui/prj/build.lst b/cui/prj/build.lst deleted file mode 100644 index 958e6cabf..000000000 --- a/cui/prj/build.lst +++ /dev/null @@ -1,3 +0,0 @@ -cu cui : svx sax NULL -cu cui usr1 - all cui_mkout NULL -cu cui\prj nmake - all cui_prj NULL diff --git a/cui/prj/d.lst b/cui/prj/d.lst deleted file mode 100644 index e69de29bb..000000000 diff --git a/cui/prj/makefile.mk b/cui/prj/makefile.mk deleted file mode 100755 index e312a7cca..000000000 --- a/cui/prj/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# 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/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx deleted file mode 100644 index fa46fb429..000000000 --- a/cui/source/customize/acccfg.cxx +++ /dev/null @@ -1,1578 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//----------------------------------------------- -// include own files - -#include "acccfg.hxx" -#include "cfgutil.hxx" -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "cuires.hrc" -#include "acccfg.hrc" - -#include // SID_CHARMAP, SID_ATTR_SPECIALCHAR - -//----------------------------------------------- -// include interface declarations -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -//----------------------------------------------- -// include other projects -#include -#include -#include -#include -#include -#include -#include -#include - -//----------------------------------------------- -// namespaces - -#ifdef css - #error "ambigous praeprozessor directive for css ..." -#else - namespace css = ::com::sun::star; -#endif - -using namespace com::sun::star; - -//----------------------------------------------- -// definitions - -//----------------------------------------------- -static ::rtl::OUString SERVICE_STORAGEFACTORY (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory" )); -static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" )); -static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" )); -static ::rtl::OUString SERVICE_MODULEMANAGER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager" )); -static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" )); -static ::rtl::OUString SERVICE_MODULEUICONFIGSUPPLIER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")); -static ::rtl::OUString SERVICE_UICMDDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription" )); - -static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )); -static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" )); -static ::rtl::OUString CMDPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("Name" )); - -static ::rtl::OUString FOLDERNAME_UICONFIG (RTL_CONSTASCII_USTRINGPARAM("Configurations2" )); - -static ::rtl::OUString MEDIATYPE_PROPNAME (RTL_CONSTASCII_USTRINGPARAM("MediaType" )); -static ::rtl::OUString MEDIATYPE_UICONFIG (RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.xml.ui.configuration" )); - -//----------------------------------------------- -static sal_uInt16 KEYCODE_ARRAY[] = -{ - KEY_F1 , - KEY_F2 , - KEY_F3 , - KEY_F4 , - KEY_F5 , - KEY_F6 , - KEY_F7 , - KEY_F8 , - KEY_F9 , - KEY_F10 , - KEY_F11 , - KEY_F12 , - KEY_F13 , - KEY_F14 , - KEY_F15 , - KEY_F16 , - - KEY_DOWN , - KEY_UP , - KEY_LEFT , - KEY_RIGHT , - KEY_HOME , - KEY_END , - KEY_PAGEUP , - KEY_PAGEDOWN , - KEY_RETURN , - KEY_ESCAPE , - KEY_BACKSPACE, - KEY_INSERT , - KEY_DELETE , - - KEY_OPEN , - KEY_CUT , - KEY_COPY , - KEY_PASTE , - KEY_UNDO , - KEY_REPEAT , - KEY_FIND , - KEY_PROPERTIES , - KEY_FRONT , - KEY_CONTEXTMENU , - KEY_MENU , - KEY_HELP , - - KEY_F1 | KEY_SHIFT, - KEY_F2 | KEY_SHIFT, - KEY_F3 | KEY_SHIFT, - KEY_F4 | KEY_SHIFT, - KEY_F5 | KEY_SHIFT, - KEY_F6 | KEY_SHIFT, - KEY_F7 | KEY_SHIFT, - KEY_F8 | KEY_SHIFT, - KEY_F9 | KEY_SHIFT, - KEY_F10 | KEY_SHIFT, - KEY_F11 | KEY_SHIFT, - KEY_F12 | KEY_SHIFT, - KEY_F13 | KEY_SHIFT, - KEY_F14 | KEY_SHIFT, - KEY_F15 | KEY_SHIFT, - KEY_F16 | KEY_SHIFT, - - KEY_DOWN | KEY_SHIFT, - KEY_UP | KEY_SHIFT, - KEY_LEFT | KEY_SHIFT, - KEY_RIGHT | KEY_SHIFT, - KEY_HOME | KEY_SHIFT, - KEY_END | KEY_SHIFT, - KEY_PAGEUP | KEY_SHIFT, - KEY_PAGEDOWN | KEY_SHIFT, - KEY_RETURN | KEY_SHIFT, - KEY_SPACE | KEY_SHIFT, - KEY_ESCAPE | KEY_SHIFT, - KEY_BACKSPACE | KEY_SHIFT, - KEY_INSERT | KEY_SHIFT, - KEY_DELETE | KEY_SHIFT, - - KEY_0 | KEY_MOD1 , - KEY_1 | KEY_MOD1 , - KEY_2 | KEY_MOD1 , - KEY_3 | KEY_MOD1 , - KEY_4 | KEY_MOD1 , - KEY_5 | KEY_MOD1 , - KEY_6 | KEY_MOD1 , - KEY_7 | KEY_MOD1 , - KEY_8 | KEY_MOD1 , - KEY_9 | KEY_MOD1 , - KEY_A | KEY_MOD1 , - KEY_B | KEY_MOD1 , - KEY_C | KEY_MOD1 , - KEY_D | KEY_MOD1 , - KEY_E | KEY_MOD1 , - KEY_F | KEY_MOD1 , - KEY_G | KEY_MOD1 , - KEY_H | KEY_MOD1 , - KEY_I | KEY_MOD1 , - KEY_J | KEY_MOD1 , - KEY_K | KEY_MOD1 , - KEY_L | KEY_MOD1 , - KEY_M | KEY_MOD1 , - KEY_N | KEY_MOD1 , - KEY_O | KEY_MOD1 , - KEY_P | KEY_MOD1 , - KEY_Q | KEY_MOD1 , - KEY_R | KEY_MOD1 , - KEY_S | KEY_MOD1 , - KEY_T | KEY_MOD1 , - KEY_U | KEY_MOD1 , - KEY_V | KEY_MOD1 , - KEY_W | KEY_MOD1 , - KEY_X | KEY_MOD1 , - KEY_Y | KEY_MOD1 , - KEY_Z | KEY_MOD1 , - KEY_SEMICOLON | KEY_MOD1 , - KEY_BRACKETLEFT | KEY_MOD1 , - KEY_BRACKETRIGHT | KEY_MOD1, - - KEY_F1 | KEY_MOD1 , - KEY_F2 | KEY_MOD1 , - KEY_F3 | KEY_MOD1 , - KEY_F4 | KEY_MOD1 , - KEY_F5 | KEY_MOD1 , - KEY_F6 | KEY_MOD1 , - KEY_F7 | KEY_MOD1 , - KEY_F8 | KEY_MOD1 , - KEY_F9 | KEY_MOD1 , - KEY_F10 | KEY_MOD1 , - KEY_F11 | KEY_MOD1 , - KEY_F12 | KEY_MOD1 , - KEY_F13 | KEY_MOD1 , - KEY_F14 | KEY_MOD1 , - KEY_F15 | KEY_MOD1 , - KEY_F16 | KEY_MOD1 , - - KEY_DOWN | KEY_MOD1 , - KEY_UP | KEY_MOD1 , - KEY_LEFT | KEY_MOD1 , - KEY_RIGHT | KEY_MOD1 , - KEY_HOME | KEY_MOD1 , - KEY_END | KEY_MOD1 , - KEY_PAGEUP | KEY_MOD1 , - KEY_PAGEDOWN | KEY_MOD1 , - KEY_RETURN | KEY_MOD1 , - KEY_SPACE | KEY_MOD1 , - KEY_BACKSPACE | KEY_MOD1 , - KEY_INSERT | KEY_MOD1 , - KEY_DELETE | KEY_MOD1 , - - KEY_ADD | KEY_MOD1 , - KEY_SUBTRACT | KEY_MOD1 , - KEY_MULTIPLY | KEY_MOD1 , - KEY_DIVIDE | KEY_MOD1 , - - KEY_0 | KEY_SHIFT | KEY_MOD1, - KEY_1 | KEY_SHIFT | KEY_MOD1, - KEY_2 | KEY_SHIFT | KEY_MOD1, - KEY_3 | KEY_SHIFT | KEY_MOD1, - KEY_4 | KEY_SHIFT | KEY_MOD1, - KEY_5 | KEY_SHIFT | KEY_MOD1, - KEY_6 | KEY_SHIFT | KEY_MOD1, - KEY_7 | KEY_SHIFT | KEY_MOD1, - KEY_8 | KEY_SHIFT | KEY_MOD1, - KEY_9 | KEY_SHIFT | KEY_MOD1, - KEY_A | KEY_SHIFT | KEY_MOD1, - KEY_B | KEY_SHIFT | KEY_MOD1, - KEY_C | KEY_SHIFT | KEY_MOD1, - KEY_D | KEY_SHIFT | KEY_MOD1, - KEY_E | KEY_SHIFT | KEY_MOD1, - KEY_F | KEY_SHIFT | KEY_MOD1, - KEY_G | KEY_SHIFT | KEY_MOD1, - KEY_H | KEY_SHIFT | KEY_MOD1, - KEY_I | KEY_SHIFT | KEY_MOD1, - KEY_J | KEY_SHIFT | KEY_MOD1, - KEY_K | KEY_SHIFT | KEY_MOD1, - KEY_L | KEY_SHIFT | KEY_MOD1, - KEY_M | KEY_SHIFT | KEY_MOD1, - KEY_N | KEY_SHIFT | KEY_MOD1, - KEY_O | KEY_SHIFT | KEY_MOD1, - KEY_P | KEY_SHIFT | KEY_MOD1, - KEY_Q | KEY_SHIFT | KEY_MOD1, - KEY_R | KEY_SHIFT | KEY_MOD1, - KEY_S | KEY_SHIFT | KEY_MOD1, - KEY_T | KEY_SHIFT | KEY_MOD1, - KEY_U | KEY_SHIFT | KEY_MOD1, - KEY_V | KEY_SHIFT | KEY_MOD1, - KEY_W | KEY_SHIFT | KEY_MOD1, - KEY_X | KEY_SHIFT | KEY_MOD1, - KEY_Y | KEY_SHIFT | KEY_MOD1, - KEY_Z | KEY_SHIFT | KEY_MOD1, - KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 , - KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 , - KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1, - - KEY_F1 | KEY_SHIFT | KEY_MOD1, - KEY_F2 | KEY_SHIFT | KEY_MOD1, - KEY_F3 | KEY_SHIFT | KEY_MOD1, - KEY_F4 | KEY_SHIFT | KEY_MOD1, - KEY_F5 | KEY_SHIFT | KEY_MOD1, - KEY_F6 | KEY_SHIFT | KEY_MOD1, - KEY_F7 | KEY_SHIFT | KEY_MOD1, - KEY_F8 | KEY_SHIFT | KEY_MOD1, - KEY_F9 | KEY_SHIFT | KEY_MOD1, - KEY_F10 | KEY_SHIFT | KEY_MOD1, - KEY_F11 | KEY_SHIFT | KEY_MOD1, - KEY_F12 | KEY_SHIFT | KEY_MOD1, - KEY_F13 | KEY_SHIFT | KEY_MOD1, - KEY_F14 | KEY_SHIFT | KEY_MOD1, - KEY_F15 | KEY_SHIFT | KEY_MOD1, - KEY_F16 | KEY_SHIFT | KEY_MOD1, - - KEY_DOWN | KEY_SHIFT | KEY_MOD1, - KEY_UP | KEY_SHIFT | KEY_MOD1, - KEY_LEFT | KEY_SHIFT | KEY_MOD1, - KEY_RIGHT | KEY_SHIFT | KEY_MOD1, - KEY_HOME | KEY_SHIFT | KEY_MOD1, - KEY_END | KEY_SHIFT | KEY_MOD1, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD1, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1, - KEY_RETURN | KEY_SHIFT | KEY_MOD1, - KEY_SPACE | KEY_SHIFT | KEY_MOD1, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1, - KEY_INSERT | KEY_SHIFT | KEY_MOD1, - KEY_DELETE | KEY_SHIFT | KEY_MOD1, - - KEY_0 | KEY_MOD2 , - KEY_1 | KEY_MOD2 , - KEY_2 | KEY_MOD2 , - KEY_3 | KEY_MOD2 , - KEY_4 | KEY_MOD2 , - KEY_5 | KEY_MOD2 , - KEY_6 | KEY_MOD2 , - KEY_7 | KEY_MOD2 , - KEY_8 | KEY_MOD2 , - KEY_9 | KEY_MOD2 , - KEY_A | KEY_MOD2 , - KEY_B | KEY_MOD2 , - KEY_C | KEY_MOD2 , - KEY_D | KEY_MOD2 , - KEY_E | KEY_MOD2 , - KEY_F | KEY_MOD2 , - KEY_G | KEY_MOD2 , - KEY_H | KEY_MOD2 , - KEY_I | KEY_MOD2 , - KEY_J | KEY_MOD2 , - KEY_K | KEY_MOD2 , - KEY_L | KEY_MOD2 , - KEY_M | KEY_MOD2 , - KEY_N | KEY_MOD2 , - KEY_O | KEY_MOD2 , - KEY_P | KEY_MOD2 , - KEY_Q | KEY_MOD2 , - KEY_R | KEY_MOD2 , - KEY_S | KEY_MOD2 , - KEY_T | KEY_MOD2 , - KEY_U | KEY_MOD2 , - KEY_V | KEY_MOD2 , - KEY_W | KEY_MOD2 , - KEY_X | KEY_MOD2 , - KEY_Y | KEY_MOD2 , - KEY_Z | KEY_MOD2 , - KEY_SEMICOLON | KEY_MOD2 , - KEY_BRACKETLEFT | KEY_MOD2 , - KEY_BRACKETRIGHT | KEY_MOD2, - - KEY_F1 | KEY_MOD2 , - KEY_F2 | KEY_MOD2 , - KEY_F3 | KEY_MOD2 , - KEY_F4 | KEY_MOD2 , - KEY_F5 | KEY_MOD2 , - KEY_F6 | KEY_MOD2 , - KEY_F7 | KEY_MOD2 , - KEY_F8 | KEY_MOD2 , - KEY_F9 | KEY_MOD2 , - KEY_F10 | KEY_MOD2 , - KEY_F11 | KEY_MOD2 , - KEY_F12 | KEY_MOD2 , - KEY_F13 | KEY_MOD2 , - KEY_F14 | KEY_MOD2 , - KEY_F15 | KEY_MOD2 , - KEY_F16 | KEY_MOD2 , - - KEY_DOWN | KEY_MOD2 , - KEY_UP | KEY_MOD2 , - KEY_LEFT | KEY_MOD2 , - KEY_RIGHT | KEY_MOD2 , - KEY_HOME | KEY_MOD2 , - KEY_END | KEY_MOD2 , - KEY_PAGEUP | KEY_MOD2 , - KEY_PAGEDOWN | KEY_MOD2 , - KEY_RETURN | KEY_MOD2 , - KEY_SPACE | KEY_MOD2 , - KEY_BACKSPACE | KEY_MOD2 , - KEY_INSERT | KEY_MOD2 , - KEY_DELETE | KEY_MOD2 , - - KEY_0 | KEY_SHIFT | KEY_MOD2, - KEY_1 | KEY_SHIFT | KEY_MOD2, - KEY_2 | KEY_SHIFT | KEY_MOD2, - KEY_3 | KEY_SHIFT | KEY_MOD2, - KEY_4 | KEY_SHIFT | KEY_MOD2, - KEY_5 | KEY_SHIFT | KEY_MOD2, - KEY_6 | KEY_SHIFT | KEY_MOD2, - KEY_7 | KEY_SHIFT | KEY_MOD2, - KEY_8 | KEY_SHIFT | KEY_MOD2, - KEY_9 | KEY_SHIFT | KEY_MOD2, - KEY_A | KEY_SHIFT | KEY_MOD2, - KEY_B | KEY_SHIFT | KEY_MOD2, - KEY_C | KEY_SHIFT | KEY_MOD2, - KEY_D | KEY_SHIFT | KEY_MOD2, - KEY_E | KEY_SHIFT | KEY_MOD2, - KEY_F | KEY_SHIFT | KEY_MOD2, - KEY_G | KEY_SHIFT | KEY_MOD2, - KEY_H | KEY_SHIFT | KEY_MOD2, - KEY_I | KEY_SHIFT | KEY_MOD2, - KEY_J | KEY_SHIFT | KEY_MOD2, - KEY_K | KEY_SHIFT | KEY_MOD2, - KEY_L | KEY_SHIFT | KEY_MOD2, - KEY_M | KEY_SHIFT | KEY_MOD2, - KEY_N | KEY_SHIFT | KEY_MOD2, - KEY_O | KEY_SHIFT | KEY_MOD2, - KEY_P | KEY_SHIFT | KEY_MOD2, - KEY_Q | KEY_SHIFT | KEY_MOD2, - KEY_R | KEY_SHIFT | KEY_MOD2, - KEY_S | KEY_SHIFT | KEY_MOD2, - KEY_T | KEY_SHIFT | KEY_MOD2, - KEY_U | KEY_SHIFT | KEY_MOD2, - KEY_V | KEY_SHIFT | KEY_MOD2, - KEY_W | KEY_SHIFT | KEY_MOD2, - KEY_X | KEY_SHIFT | KEY_MOD2, - KEY_Y | KEY_SHIFT | KEY_MOD2, - KEY_Z | KEY_SHIFT | KEY_MOD2, - KEY_SEMICOLON | KEY_SHIFT | KEY_MOD2 , - KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD2 , - KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD2, - - KEY_F1 | KEY_SHIFT | KEY_MOD2, - KEY_F2 | KEY_SHIFT | KEY_MOD2, - KEY_F3 | KEY_SHIFT | KEY_MOD2, - KEY_F4 | KEY_SHIFT | KEY_MOD2, - KEY_F5 | KEY_SHIFT | KEY_MOD2, - KEY_F6 | KEY_SHIFT | KEY_MOD2, - KEY_F7 | KEY_SHIFT | KEY_MOD2, - KEY_F8 | KEY_SHIFT | KEY_MOD2, - KEY_F9 | KEY_SHIFT | KEY_MOD2, - KEY_F10 | KEY_SHIFT | KEY_MOD2, - KEY_F11 | KEY_SHIFT | KEY_MOD2, - KEY_F12 | KEY_SHIFT | KEY_MOD2, - KEY_F13 | KEY_SHIFT | KEY_MOD2, - KEY_F14 | KEY_SHIFT | KEY_MOD2, - KEY_F15 | KEY_SHIFT | KEY_MOD2, - KEY_F16 | KEY_SHIFT | KEY_MOD2, - - KEY_DOWN | KEY_SHIFT | KEY_MOD2, - KEY_UP | KEY_SHIFT | KEY_MOD2, - KEY_LEFT | KEY_SHIFT | KEY_MOD2, - KEY_RIGHT | KEY_SHIFT | KEY_MOD2, - KEY_HOME | KEY_SHIFT | KEY_MOD2, - KEY_END | KEY_SHIFT | KEY_MOD2, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD2, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD2, - KEY_RETURN | KEY_SHIFT | KEY_MOD2, - KEY_SPACE | KEY_SHIFT | KEY_MOD2, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD2, - KEY_INSERT | KEY_SHIFT | KEY_MOD2, - KEY_DELETE | KEY_SHIFT | KEY_MOD2, - - KEY_0 | KEY_MOD1 | KEY_MOD2 , - KEY_1 | KEY_MOD1 | KEY_MOD2 , - KEY_2 | KEY_MOD1 | KEY_MOD2 , - KEY_3 | KEY_MOD1 | KEY_MOD2 , - KEY_4 | KEY_MOD1 | KEY_MOD2 , - KEY_5 | KEY_MOD1 | KEY_MOD2 , - KEY_6 | KEY_MOD1 | KEY_MOD2 , - KEY_7 | KEY_MOD1 | KEY_MOD2 , - KEY_8 | KEY_MOD1 | KEY_MOD2 , - KEY_9 | KEY_MOD1 | KEY_MOD2 , - KEY_A | KEY_MOD1 | KEY_MOD2 , - KEY_B | KEY_MOD1 | KEY_MOD2 , - KEY_C | KEY_MOD1 | KEY_MOD2 , - KEY_D | KEY_MOD1 | KEY_MOD2 , - KEY_E | KEY_MOD1 | KEY_MOD2 , - KEY_F | KEY_MOD1 | KEY_MOD2 , - KEY_G | KEY_MOD1 | KEY_MOD2 , - KEY_H | KEY_MOD1 | KEY_MOD2 , - KEY_I | KEY_MOD1 | KEY_MOD2 , - KEY_J | KEY_MOD1 | KEY_MOD2 , - KEY_K | KEY_MOD1 | KEY_MOD2 , - KEY_L | KEY_MOD1 | KEY_MOD2 , - KEY_M | KEY_MOD1 | KEY_MOD2 , - KEY_N | KEY_MOD1 | KEY_MOD2 , - KEY_O | KEY_MOD1 | KEY_MOD2 , - KEY_P | KEY_MOD1 | KEY_MOD2 , - KEY_Q | KEY_MOD1 | KEY_MOD2 , - KEY_R | KEY_MOD1 | KEY_MOD2 , - KEY_S | KEY_MOD1 | KEY_MOD2 , - KEY_T | KEY_MOD1 | KEY_MOD2 , - KEY_U | KEY_MOD1 | KEY_MOD2 , - KEY_V | KEY_MOD1 | KEY_MOD2 , - KEY_W | KEY_MOD1 | KEY_MOD2 , - KEY_X | KEY_MOD1 | KEY_MOD2 , - KEY_Y | KEY_MOD1 | KEY_MOD2 , - KEY_Z | KEY_MOD1 | KEY_MOD2 , - - KEY_F1 | KEY_MOD1 | KEY_MOD2 , - KEY_F2 | KEY_MOD1 | KEY_MOD2 , - KEY_F3 | KEY_MOD1 | KEY_MOD2 , - KEY_F4 | KEY_MOD1 | KEY_MOD2 , - KEY_F5 | KEY_MOD1 | KEY_MOD2 , - KEY_F6 | KEY_MOD1 | KEY_MOD2 , - KEY_F7 | KEY_MOD1 | KEY_MOD2 , - KEY_F8 | KEY_MOD1 | KEY_MOD2 , - KEY_F9 | KEY_MOD1 | KEY_MOD2 , - KEY_F10 | KEY_MOD1 | KEY_MOD2 , - KEY_F11 | KEY_MOD1 | KEY_MOD2 , - KEY_F12 | KEY_MOD1 | KEY_MOD2 , - KEY_F13 | KEY_MOD1 | KEY_MOD2 , - KEY_F14 | KEY_MOD1 | KEY_MOD2 , - KEY_F15 | KEY_MOD1 | KEY_MOD2 , - KEY_F16 | KEY_MOD1 | KEY_MOD2 , - - KEY_DOWN | KEY_MOD1 | KEY_MOD2 , - KEY_UP | KEY_MOD1 | KEY_MOD2 , - KEY_LEFT | KEY_MOD1 | KEY_MOD2 , - KEY_RIGHT | KEY_MOD1 | KEY_MOD2 , - KEY_HOME | KEY_MOD1 | KEY_MOD2 , - KEY_END | KEY_MOD1 | KEY_MOD2 , - KEY_PAGEUP | KEY_MOD1 | KEY_MOD2 , - KEY_PAGEDOWN | KEY_MOD1 | KEY_MOD2 , - KEY_RETURN | KEY_MOD1 | KEY_MOD2 , - KEY_SPACE | KEY_MOD1 | KEY_MOD2 , - KEY_BACKSPACE | KEY_MOD1 | KEY_MOD2 , - KEY_INSERT | KEY_MOD1 | KEY_MOD2 , - KEY_DELETE | KEY_MOD1 | KEY_MOD2 , - - KEY_0 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_A | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_B | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_C | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_D | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_E | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_G | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_H | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_I | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_J | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_K | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_L | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_M | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_N | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_O | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_P | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Q | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_R | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_S | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_T | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_U | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_V | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_W | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_X | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - - KEY_F1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F10 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F11 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F12 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F13 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F14 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F15 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_F16 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - - KEY_DOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_UP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_LEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_RIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_HOME | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_END | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_PAGEUP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_RETURN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_SPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_INSERT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, - KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2 -}; - -static sal_uInt16 KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY); - -//----------------------------------------------- -// seems to be needed to layout the list box, which shows all -// assignable shortcuts -static long AccCfgTabs[] = -{ - 2, // Number of Tabs - 0, - 120 // Function -}; - -//----------------------------------------------- -class SfxAccCfgLBoxString_Impl : public SvLBoxString -{ - public: - SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - sal_uInt16 nFlags, - const String& sText ); - - virtual ~SfxAccCfgLBoxString_Impl(); - - virtual void Paint(const Point& aPos , - SvLBox& rDevice, - sal_uInt16 nFlags , - SvLBoxEntry* pEntry ); -}; - -//----------------------------------------------- -SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, - sal_uInt16 nFlags, - const String& sText ) - : SvLBoxString(pEntry, nFlags, sText) -{ -} - -//----------------------------------------------- -SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() -{ -} - -//----------------------------------------------- -void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos , - SvLBox& rDevice, - sal_uInt16 /*nFlags*/, - SvLBoxEntry* pEntry ) -{ - - if (!pEntry) - return; - - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (!pUserData) - return; - - if (pUserData->m_bIsConfigurable) - rDevice.DrawText(aPos, GetText()); - else - rDevice.DrawCtrlText(aPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE); - -} - -//----------------------------------------------- -void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry , - const XubString& sText , - const Image& aImage1, - const Image& aImage2, - SvLBoxButtonKind eButtonKind) -{ - SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind); -} - -//----------------------------------------------- -/** select the entry, which match the current key input ... excepting - keys, which are used for the dialog itself. - */ -void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey) -{ - KeyCode aCode1 = aKey.GetKeyCode(); - sal_uInt16 nCode1 = aCode1.GetCode(); - sal_uInt16 nMod1 = aCode1.GetModifier(); - - // is it related to our list box ? - if ( - (nCode1 != KEY_DOWN ) && - (nCode1 != KEY_UP ) && - (nCode1 != KEY_LEFT ) && - (nCode1 != KEY_RIGHT ) && - (nCode1 != KEY_PAGEUP ) && - (nCode1 != KEY_PAGEDOWN) - ) - { - SvLBoxEntry* pEntry = First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - { - sal_uInt16 nCode2 = pUserData->m_aKey.GetCode(); - sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier(); - if ( - (nCode1 == nCode2) && - (nMod1 == nMod2 ) - ) - { - Select (pEntry); - MakeVisible(pEntry); - return; - } - } - pEntry = Next(pEntry); - } - } - - // no - handle it as normal dialog input - SvTabListBox::KeyInput(aKey); -} - -//----------------------------------------------- -SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxItemSet& aSet ) - : SfxTabPage (pParent, CUI_RES(RID_SVXPAGE_KEYBOARD), aSet) - , m_pMacroInfoItem () - , m_pStringItem () - , m_pFontItem () - , m_pFileDlg (NULL) - , aEntriesBox (this , this, CUI_RES(BOX_ACC_ENTRIES )) - , aKeyboardGroup (this , CUI_RES(GRP_ACC_KEYBOARD )) - , aOfficeButton (this , CUI_RES(RB_OFFICE )) - , aModuleButton (this , CUI_RES(RB_MODULE )) - , aChangeButton (this , CUI_RES(BTN_ACC_CHANGE )) - , aRemoveButton (this , CUI_RES(BTN_ACC_REMOVE )) - , aGroupText (this , CUI_RES(TXT_ACC_GROUP )) - , pGroupLBox(new SfxConfigGroupListBox_Impl( this, CUI_RES(BOX_ACC_GROUP), SFX_SLOT_ACCELCONFIG )) - , aFunctionText (this , CUI_RES(TXT_ACC_FUNCTION )) - , pFunctionBox(new SfxConfigFunctionListBox_Impl( this, CUI_RES( BOX_ACC_FUNCTION ))) - , aKeyText (this , CUI_RES(TXT_ACC_KEY )) - , aKeyBox (this , CUI_RES(BOX_ACC_KEY )) - , aFunctionsGroup (this , CUI_RES(GRP_ACC_FUNCTIONS )) - , aLoadButton (this , CUI_RES(BTN_LOAD )) - , aSaveButton (this , CUI_RES(BTN_SAVE )) - , aResetButton (this , CUI_RES(BTN_RESET )) - , aLoadAccelConfigStr ( CUI_RES( STR_LOADACCELCONFIG ) ) - , aSaveAccelConfigStr ( CUI_RES( STR_SAVEACCELCONFIG ) ) - , aFilterCfgStr ( CUI_RES( STR_FILTERNAME_CFG ) ) - , m_bStylesInfoInitialized(sal_False) - , m_xGlobal () - , m_xModule () - , m_xAct () -{ - FreeResource(); - - aFilterAllStr = String( SfxResId( STR_SFX_FILTERNAME_ALL ) ); - -// install handler functions - aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl )); - aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl )); - aEntriesBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - aKeyBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); - aLoadButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load )); - aSaveButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save )); - aResetButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default )); - aOfficeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); - aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); - - // initialize Entriesbox - aEntriesBox.SetStyle(aEntriesBox.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); - aEntriesBox.SetSelectionMode(SINGLE_SELECTION); - aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT); - aEntriesBox.Resize(); // OS: Hack for right selection - aEntriesBox.SetSpaceBetweenEntries(0); - aEntriesBox.SetDragDropMode(0); - - // detect max keyname width - long nMaxWidth = 0; - for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i ) - { - long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() ); - if ( nTmp > nMaxWidth ) - nMaxWidth = nTmp; - } - // recalc second tab - long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width(); - nNewTab = nNewTab + 5; // additional space - aEntriesBox.SetTab( 1, nNewTab ); - - // initialize GroupBox - pGroupLBox->SetFunctionListBox(pFunctionBox); - - // initialize KeyBox - aKeyBox.SetStyle(aKeyBox.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); -} - -//----------------------------------------------- -SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage() -{ - // free memory - remove all dynamic user data - SvLBoxEntry* pEntry = aEntriesBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - delete pUserData; - pEntry = aEntriesBox.Next(pEntry); - } - - pEntry = aKeyBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - delete pUserData; - pEntry = aKeyBox.Next(pEntry); - } - - aEntriesBox.Clear(); - aKeyBox.Clear(); - - delete m_pFileDlg; - delete pGroupLBox; - delete pFunctionBox; -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::InitAccCfg() -{ - // already initialized ? - if (m_xSMGR.is()) - return; // yes -> do nothing - - try - { - // no - initialize this instance - m_xSMGR = ::utl::getProcessServiceFactory(); - - m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW); - - // get the current active frame, which should be our "parent" - // for this session - m_xFrame = GetFrame(); - if ( !m_xFrame.is() ) - { - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW); - m_xFrame = xDesktop->getActiveFrame(); - } - - // identify module - css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW); - m_sModuleLongName = xModuleManager->identify(m_xFrame); - ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName)); - m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString()); - m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString()); - - // get global accelerator configuration - m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW); - - // get module accelerator configuration - css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(m_xSMGR->createInstance(SERVICE_MODULEUICONFIGSUPPLIER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName); - m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { m_xSMGR.clear(); } -} - -//----------------------------------------------- -/** Initialize text columns with own class to enable custom painting - This is needed as we have to paint disabled entries by ourself. No support for that in the - original SvTabListBox! - */ -void SfxAcceleratorConfigPage::CreateCustomItems( SvLBoxEntry* pEntry, - const String& sCol1 , - const String& sCol2 ) -{ - SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1); - pEntry->ReplaceItem(pStringItem, 1); - - pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2); - pEntry->ReplaceItem(pStringItem, 2); -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) -{ - if (!xAccMgr.is()) - return; - - if (!m_bStylesInfoInitialized) - { - css::uno::Reference< css::frame::XController > xController; - css::uno::Reference< css::frame::XModel > xModel; - if (m_xFrame.is()) - xController = m_xFrame->getController(); - if (xController.is()) - xModel = xController->getModel(); - - m_aStylesInfo.setModel(xModel); - pFunctionBox->SetStylesInfo(&m_aStylesInfo); - pGroupLBox->SetStylesInfo(&m_aStylesInfo); - m_bStylesInfoInitialized = sal_True; - } - - // Insert all editable accelerators into list box. It is possible - // that some accelerators are not mapped on the current system/keyboard - // but we don't want to lose these mappings. - sal_uInt16 c1 = KEYCODE_ARRAY_SIZE; - sal_uInt16 i1 = 0; - sal_uInt16 nListPos = 0; - for (i1=0; i1SetUserData(pEntry); - } - - // Assign all commands to its shortcuts - reading the accelerator config. - css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents(); - sal_Int32 c2 = lKeys.getLength(); - sal_Int32 i2 = 0; - sal_uInt16 nCol = aEntriesBox.TabCount()-1; - - for (i2=0; i2getCommandByKeyEvent(aAWTKey); - String sLabel = GetLabel4Command(sCommand); - KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey); - sal_uInt16 nPos = MapKeyCodeToPos(aKeyCode); - - if (nPos == LISTBOX_ENTRY_NOTFOUND) - continue; - - aEntriesBox.SetEntryText(sLabel, nPos, nCol); - - SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos); - TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData(); - - pEntry->m_bIsConfigurable = sal_True; - pEntry->m_sCommand = sCommand; - CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), sLabel); - } - - // Map the VCL hardcoded key codes and mark them as not changeable - sal_uLong c3 = Application::GetReservedKeyCodeCount(); - sal_uLong i3 = 0; - for (i3=0; i3GetUserData(); - - pEntry->m_bIsConfigurable = sal_False; - CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), String()); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) -{ - if (!xAccMgr.is()) - return; - - // Go through the list from the bottom to the top ... - // because logical accelerator must be preferred instead of - // physical ones! - SvLBoxEntry* pEntry = aEntriesBox.First(); - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - ::rtl::OUString sCommand ; - css::awt::KeyEvent aAWTKey ; - - if (pUserData) - { - sCommand = pUserData->m_sCommand; - aAWTKey = ::svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey); - } - - try - { - if (sCommand.getLength()) - xAccMgr->setKeyEvent(aAWTKey, sCommand); - else - xAccMgr->removeKeyEvent(aAWTKey); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - pEntry = aEntriesBox.Next(pEntry); - } -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::ResetConfig() -{ - aEntriesBox.Clear(); -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG ) -{ - // ask for filename, where we should load the new config data from - StartFileDialog( WB_OPEN | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG ) -{ - StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aSaveAccelConfigStr ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG) -{ - css::uno::Reference< css::form::XReset > xReset(m_xAct, css::uno::UNO_QUERY); - if (xReset.is()) - xReset->reset(); - - aEntriesBox.SetUpdateMode(sal_False); - ResetConfig(); - Init(m_xAct); - aEntriesBox.SetUpdateMode(sal_True); - aEntriesBox.Invalidate(); - aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) -{ - sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - String sNewCommand = pFunctionBox->GetCurCommand(); - String sLabel = pFunctionBox->GetCurLabel(); - if (!sLabel.Len()) - sLabel = GetLabel4Command(sNewCommand); - - pEntry->m_sCommand = sNewCommand; - sal_uInt16 nCol = aEntriesBox.TabCount() - 1; - aEntriesBox.SetEntryText(sLabel, nPos, nCol); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG ) -{ - // get selected entry - sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - - // remove function name from selected entry - sal_uInt16 nCol = aEntriesBox.TabCount() - 1; - aEntriesBox.SetEntryText( String(), nPos, nCol ); - pEntry->m_sCommand = ::rtl::OUString(); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) -{ - // disable help - Help::ShowBalloon( this, Point(), String() ); - if ( pListBox == &aEntriesBox ) - { - sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); - - aRemoveButton.Enable( sal_False ); - aChangeButton.Enable( sal_False ); - - if (pEntry->m_bIsConfigurable) - { - if (pEntry->isConfigured()) - aRemoveButton.Enable( sal_True ); - aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); - } - } - else if ( pListBox == pGroupLBox ) - { - pGroupLBox->GroupSelected(); - if ( !pFunctionBox->FirstSelected() ) - aChangeButton.Enable( sal_False ); - } - else if ( pListBox == pFunctionBox ) - { - aRemoveButton.Enable( sal_False ); - aChangeButton.Enable( sal_False ); - - // #i36994 First selected can return zero! - SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected(); - if ( pLBEntry != 0 ) - { - sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( pLBEntry ); - TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); - ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); - - if (pEntry->m_bIsConfigurable) - { - if (pEntry->isConfigured()) - aRemoveButton.Enable( sal_True ); - aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); - } - - // update key box - aKeyBox.Clear(); - SvLBoxEntry* pIt = aEntriesBox.First(); - while ( pIt ) - { - TAccInfo* pUserData = (TAccInfo*)pIt->GetUserData(); - if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand ) - { - TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey); - SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, sal_True, LIST_APPEND ); - pE1->SetUserData(pU1); - pE1->EnableChildsOnDemand( sal_False ); - } - pIt = aEntriesBox.Next(pIt); - } - } - } - else - { - // goto selected "key" entry of the key box - SvLBoxEntry* pE2 = 0; - TAccInfo* pU2 = 0; - sal_uInt16 nP2 = LISTBOX_ENTRY_NOTFOUND; - SvLBoxEntry* pE3 = 0; - - pE2 = aKeyBox.FirstSelected(); - if (pE2) - pU2 = (TAccInfo*)pE2->GetUserData(); - if (pU2) - nP2 = MapKeyCodeToPos(pU2->m_aKey); - if (nP2 != LISTBOX_ENTRY_NOTFOUND) - pE3 = aEntriesBox.GetEntry( 0, nP2 ); - if (pE3) - { - aEntriesBox.Select( pE3 ); - aEntriesBox.MakeVisible( pE3 ); - } - } - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG ) -{ - css::uno::Reference< css::ui::XAcceleratorConfiguration > xOld = m_xAct; - - if (aOfficeButton.IsChecked()) - m_xAct = m_xGlobal; - else if (aModuleButton.IsChecked()) - m_xAct = m_xModule; - - // nothing changed? => do nothing! - if ( m_xAct.is() && ( xOld == m_xAct ) ) - return 0; - - aEntriesBox.SetUpdateMode( sal_False ); - ResetConfig(); - Init(m_xAct); - aEntriesBox.SetUpdateMode( sal_True ); - aEntriesBox.Invalidate(); - - pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName); - - // pb: #133213# do not select NULL entries - SvLBoxEntry* pEntry = aEntriesBox.GetEntry( 0, 0 ); - if ( pEntry ) - aEntriesBox.Select( pEntry ); - pEntry = pGroupLBox->GetEntry( 0, 0 ); - if ( pEntry ) - pGroupLBox->Select( pEntry ); - - ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); - return 1L; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG ) -{ - DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); - - ::rtl::OUString sCfgName; - if ( ERRCODE_NONE == m_pFileDlg->GetError() ) - sCfgName = m_pFileDlg->GetPath(); - - if ( !sCfgName.getLength() ) - return 0; - - GetTabDialog()->EnterWait(); - - css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; - css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used! - - try - { - // first check if URL points to a document already loaded - xDoc = SearchForAlreadyLoadedDoc(sCfgName); - if (xDoc.is()) - { - // Get ui config manager. There should always be one at the model. - css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); - xCfgMgr = xCfgSupplier->getUIConfigurationManager(); - } - else - { - // URL doesn't point to a loaded document, try to access it as a single storage - // dont forget to release the storage afterwards! - css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sCfgName; - lArgs[1] <<= css::embed::ElementModes::READ; - - xRootStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ); - if (xUIConfig.is()) - { - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xCfgMgrStore->setStorage(xUIConfig); - } - } - - if (xCfgMgr.is()) - { - // open the configuration and update our UI - css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); - - aEntriesBox.SetUpdateMode(sal_False); - ResetConfig(); - Init(xTempAccMgr); - aEntriesBox.SetUpdateMode(sal_True); - aEntriesBox.Invalidate(); - aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); - - } - - // dont forget to close the new opened storage! - // We are the owner of it. - if (xRootStorage.is()) - { - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - GetTabDialog()->LeaveWait(); - - return 0; -} - -//----------------------------------------------- -IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG ) -{ - DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); - - ::rtl::OUString sCfgName; - if ( ERRCODE_NONE == m_pFileDlg->GetError() ) - sCfgName = m_pFileDlg->GetPath(); - - if ( !sCfgName.getLength() ) - return 0; - - GetTabDialog()->EnterWait(); - - css::uno::Reference< css::frame::XModel > xDoc ; - css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; - css::uno::Reference< css::embed::XStorage > xRootStorage; - - try - { - // first check if URL points to a document already loaded - xDoc = SearchForAlreadyLoadedDoc(sCfgName); - if (xDoc.is()) - { - // get config manager, force creation if there was none before - css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); - xCfgMgr = xCfgSupplier->getUIConfigurationManager(); - } - else - { - // URL doesn't point to a loaded document, try to access it as a single storage - css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sCfgName; - lArgs[1] <<= css::embed::ElementModes::WRITE; - - xRootStorage = css::uno::Reference< css::embed::XStorage >( - xStorageFactory->createInstanceWithArguments(lArgs), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::embed::XStorage > xUIConfig( - xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::WRITE), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet > xUIConfigProps( - xUIConfig, - css::uno::UNO_QUERY_THROW); - - // set the correct media type if the storage was new created - ::rtl::OUString sMediaType; - xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType; - if (!sMediaType.getLength()) - xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG)); - - xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW); - xUICfgStore->setStorage(xUIConfig); - } - - if (xCfgMgr.is()) - { - // get the target configuration access and update with all shortcuts - // which are set currently at the UI ! - // Dont copy the m_xAct content to it ... because m_xAct will be updated - // from the UI on pressing the button "OK" only. And inbetween it's not up to date ! - css::uno::Reference< css::ui::XAcceleratorConfiguration > xTargetAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); - Apply(xTargetAccMgr); - - // commit (order is important!) - css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit1(xTargetAccMgr, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit2(xCfgMgr , css::uno::UNO_QUERY_THROW); - xCommit1->store(); - xCommit2->store(); - - if (xRootStorage.is()) - { - // Commit root storage - css::uno::Reference< css::embed::XTransactedObject > xCommit3(xRootStorage, css::uno::UNO_QUERY_THROW); - xCommit3->commit(); - } - } - - if (xRootStorage.is()) - { - css::uno::Reference< css::lang::XComponent > xComponent; - xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - GetTabDialog()->LeaveWait(); - - return 0; -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle ) -{ - bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS ); - short nDialogType = bSave ? css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE - : css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE; - if ( m_pFileDlg ) - delete m_pFileDlg; - m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 ); - - m_pFileDlg->SetTitle( rTitle ); - m_pFileDlg->AddFilter( aFilterAllStr, DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL ) ); - m_pFileDlg->AddFilter( aFilterCfgStr, DEFINE_CONST_UNICODE( "*.cfg" ) ); - - Link aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl ) - : LINK( this, SfxAcceleratorConfigPage, LoadHdl ); - m_pFileDlg->StartExecuteModal( aDlgClosedLink ); -} - -//----------------------------------------------- -sal_Bool SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) -{ - Apply(m_xAct); - try - { - m_xAct->store(); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { return sal_False; } - - return sal_True; -} - -//----------------------------------------------- -void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) -{ - // open accelerator configs - // Note: It initialize some other members too, which are needed here ... - // e.g. m_sModuleUIName! - InitAccCfg(); - - // change te description of the radio button, which switch to the module - // dependend accelerator configuration - String sButtonText = aModuleButton.GetText(); - sButtonText.SearchAndReplace(String::CreateFromAscii("$(MODULE)"), m_sModuleUIName); - aModuleButton.SetText(sButtonText); - - if (m_xModule.is()) - aModuleButton.Check(); - else - { - aModuleButton.Hide(); - aOfficeButton.Check(); - } - - RadioHdl(0); - - const SfxPoolItem* pMacroItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, sal_True, &pMacroItem ) ) - { - m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem ); - pGroupLBox->SelectMacro( m_pMacroInfoItem ); - } - else - { - const SfxPoolItem* pStringItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, sal_True, &pStringItem ) ) - m_pStringItem = PTR_CAST( SfxStringItem, pStringItem ); - - const SfxPoolItem* pFontItem=0; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, sal_True, &pFontItem ) ) - m_pFontItem = PTR_CAST( SfxStringItem, pFontItem ); - } -} - -//----------------------------------------------- -sal_uInt16 SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const -{ - sal_uInt16 nCode1 = aKey.GetCode()+aKey.GetModifier(); - SvLBoxEntry* pEntry = aEntriesBox.First(); - sal_uInt16 i = 0; - - while (pEntry) - { - TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); - if (pUserData) - { - sal_uInt16 nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier(); - if (nCode1 == nCode2) - return i; - } - pEntry = aEntriesBox.Next(pEntry); - ++i; - } - - return LISTBOX_ENTRY_NOTFOUND; -} - -//----------------------------------------------- -String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand) -{ - try - { - // check global command configuration first - css::uno::Reference< css::container::XNameAccess > xModuleConf; - m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf; - if (xModuleConf.is()) - { - ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand)); - String sLabel = String(lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, ::rtl::OUString())); - if (sLabel.Len()) - return sLabel; - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - // may be it's a style URL .. they must be handled special - SfxStyleInfo_Impl aStyle; - aStyle.sCommand = sCommand; - if (m_aStylesInfo.parseStyleCommand(aStyle)) - { - m_aStylesInfo.getLabel4Style(aStyle); - return aStyle.sLabel; - } - else - { - String aRet( String::CreateFromAscii("Symbols: ") ); - xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string="); - if ( nPos == 0 ) - { - aRet += String( sCommand, 34, sCommand.Len()-34 ); - return aRet; - } - } - - return sCommand; -} - -SfxTabPage* SfxAcceleratorConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SfxAcceleratorConfigPage( pParent, rAttrSet ); -} - -//----------------------------------------------- -css::uno::Reference< css::frame::XModel > SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const String& /*sName*/) -{ - return css::uno::Reference< css::frame::XModel >(); -} - -SvxShortcutAssignDlg::SvxShortcutAssignDlg( Window* pParent, const uno::Reference< frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) - : SfxSingleTabDialog( pParent, rSet, 0 ) -{ - SfxTabPage* pPage = SfxAcceleratorConfigPage::Create( this, rSet ); - pPage->SetFrame( rxDocumentFrame ); - SetTabPage( pPage ); - -} - -SvxShortcutAssignDlg::~SvxShortcutAssignDlg() -{ -} - - -// .uno:InsertSymbol?Symbols:string=bla - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/acccfg.hrc b/cui/source/customize/acccfg.hrc deleted file mode 100644 index eaa39b11e..000000000 --- a/cui/source/customize/acccfg.hrc +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define GRP_FUNCTIONS 22 -#define BTN_ACC_OK 1 -#define BTN_ACC_CANCEL 2 -#define BTN_ACC_CHANGE 3 -#define BTN_ACC_REMOVE 4 -#define BOX_ACC_ENTRIES 5 -#define TXT_ACC_DESCRIPTIONTEXT 6 -#define TXT_ACC_DESCRIPTIONINFO 7 -#define GRP_ACC_KEYBOARD 8 -#define TXT_ACC_GROUP 9 -#define BOX_ACC_GROUP 10 -#define TXT_ACC_FUNCTION 11 -#define BOX_ACC_FUNCTION 12 -#define TXT_ACC_KEY 13 -#define BOX_ACC_KEY 14 -#define GRP_ACC_FUNCTIONS 15 -#define BTN_RESET 20 -#define BTN_LOAD 40 -#define BTN_SAVE 41 -#define RB_OFFICE 44 -#define RB_MODULE 45 -#define STR_LOADACCELCONFIG 46 -#define STR_SAVEACCELCONFIG 47 - -#define IMG_HARDDISK 48 -#define STR_PRODMACROS 50 -#define STR_MYMACROS 51 -#define IMG_LIB 52 -#define IMG_MACRO 54 -#define IMG_DOC 56 -#define STR_GROUP_STYLES 58 -#define STR_PDF_EXPORT_SEND 59 -#define STR_RECHECK_DOCUMENT 60 -#define IMG_INFO 61 - // FREE -#define BMP_COLLAPSED 63 -#define BMP_EXPANDED 64 -#define STR_BASICMACROS 67 -#define STR_DLG_MACROS 68 -#define STR_HUMAN_APPNAME 69 -#define STR_FILTERNAME_CFG 70 diff --git a/cui/source/customize/acccfg.src b/cui/source/customize/acccfg.src deleted file mode 100644 index 874ac854f..000000000 --- a/cui/source/customize/acccfg.src +++ /dev/null @@ -1,270 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "cuires.hrc" -#include "acccfg.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -#define PUSHBUTTON_TEXT_SAVE \ - Text [ en-US ] = "~Save..." ; \ - -#define PUSHBUTTON_TEXT_RESET \ - Text [ en-US ] = "R~eset" ; \ - -#define PUSHBUTTON_TEXT_LOAD \ - Text [ en-US ] = "~Load..." ; \ - -#define PUSHBUTTON_TEXT_REMOVE \ - Text [ en-US ] = "~Delete" ; \ - -#define PUSHBUTTON_TEXT_CHANGE \ - Text [ en-US ] = "~Modify" ; \ - -#define PUSHBUTTON_TEXT_NEW \ - Text [ en-US ] = "~New" ; \ - -#define FIXEDTEXT_TEXT_GROUP \ - Text [ en-US ] = "~Category" ; \ - -#define FIXEDTEXT_TEXT_FUNCTION \ - Text [ en-US ] = "Function" ; \ - -#define GROUPBOX_TEXT_FUNCTIONS \ - Text [ en-US ] = "Functions" ; \ - - // TP_CONFIG_ACCEL ------------------------------------------------------- -TabPage RID_SVXPAGE_KEYBOARD -{ - HelpId = HID_CONFIG_ACCEL ; - Hide = TRUE ; - Size = MAP_APPFONT ( 273 , 258 ) ; - RadioButton RB_OFFICE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_KEYBOARD:RB_OFFICE"; - Pos = MAP_APPFONT ( 192 , 6 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text = "%PRODUCTNAME" ; - }; - RadioButton RB_MODULE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_KEYBOARD:RB_MODULE"; - Pos = MAP_APPFONT ( 192 , 19 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text = "$(MODULE)" ; - }; - PushButton BTN_ACC_CHANGE - { - HelpID = "cui:PushButton:RID_SVXPAGE_KEYBOARD:BTN_ACC_CHANGE"; - Pos = MAP_APPFONT ( 192 , 35 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - PUSHBUTTON_TEXT_CHANGE - }; - PushButton BTN_ACC_REMOVE - { - HelpID = "cui:PushButton:RID_SVXPAGE_KEYBOARD:BTN_ACC_REMOVE"; - Pos = MAP_APPFONT ( 192 , 52 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_REMOVE - }; - FixedLine GRP_ACC_KEYBOARD - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Shortcut keys"; - }; - Control BOX_ACC_ENTRIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 174 , 120 ) ; - TabStop = TRUE ; - Group = TRUE ; - HelpId = HID_ACCELCONFIG_LISTBOX ; - }; - FixedLine GRP_ACC_FUNCTIONS - { - Pos = MAP_APPFONT ( 6 , 140 ) ; - Size = MAP_APPFONT ( 258 , 8 ) ; - Group = TRUE ; - GROUPBOX_TEXT_FUNCTIONS - }; - FixedText TXT_ACC_GROUP - { - Pos = MAP_APPFONT ( 12 , 151 ) ; - Size = MAP_APPFONT ( 78 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - FIXEDTEXT_TEXT_GROUP - }; - Control BOX_ACC_GROUP - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 161 ) ; - Size = MAP_APPFONT ( 78 , 91 ) ; - TabStop = TRUE ; - HelpId = HID_CONFIGGROUP_ACC_LISTBOX ; - }; - FixedText TXT_ACC_FUNCTION - { - Pos = MAP_APPFONT ( 93 , 151 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Left = TRUE ; - FIXEDTEXT_TEXT_FUNCTION - }; - Control BOX_ACC_FUNCTION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 93 , 161 ) ; - Size = MAP_APPFONT ( 88 , 91 ) ; - TabStop = TRUE ; - HelpId = HID_CONFIGFUNCTION_ACC_LISTBOX ; - }; - FixedText TXT_ACC_KEY - { - Pos = MAP_APPFONT ( 184 , 151 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "~Keys" ; - Left = TRUE ; - }; - Control BOX_ACC_KEY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 184 , 161 ) ; - Size = MAP_APPFONT ( 80 , 91 ) ; - TabStop = TRUE ; - }; - PushButton BTN_LOAD - { - HelpID = "cui:PushButton:RID_SVXPAGE_KEYBOARD:BTN_LOAD"; - Pos = MAP_APPFONT ( 192 , 86 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_LOAD - }; - PushButton BTN_SAVE - { - HelpID = "cui:PushButton:RID_SVXPAGE_KEYBOARD:BTN_SAVE"; - Pos = MAP_APPFONT ( 192 , 103 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_SAVE - }; - PushButton BTN_RESET - { - HelpID = "cui:PushButton:RID_SVXPAGE_KEYBOARD:BTN_RESET"; - Pos = MAP_APPFONT ( 192 , 120 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Group = TRUE ; - PUSHBUTTON_TEXT_RESET - }; - String STR_LOADACCELCONFIG - { - Text [ en-US ] = "Load Keyboard Configuration" ; - }; - String STR_SAVEACCELCONFIG - { - Text [ en-US ] = "Save Keyboard Configuration" ; - }; - String STR_FILTERNAME_CFG - { - Text [ en-US ] = "Configuration" ; - }; -}; - -Resource RID_SVXPAGE_CONFIGGROUPBOX -{ - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - String STR_BASICMACROS - { - Text [ en-US ] = "BASIC Macros" ; - }; - String STR_DLG_MACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros" ; - }; - String STR_HUMAN_APPNAME - { - TEXT = "%PRODUCTNAME" ; - }; - String STR_GROUP_STYLES - { - Text [ en-US ] = "Styles" ; - }; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_DOC - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - Image BMP_COLLAPSED - { - ImageBitmap = Bitmap - { - File = "plus.bmp" ; - }; - }; - Image BMP_EXPANDED - { - ImageBitmap = Bitmap - { - File = "minus.bmp" ; - }; - }; -}; - - // ********************************************************************** EOF diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx deleted file mode 100644 index 0375964f6..000000000 --- a/cui/source/customize/cfg.cxx +++ /dev/null @@ -1,5755 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "cfg.hrc" -#include "helpid.hrc" - -#include "acccfg.hxx" -#include "cfg.hxx" -#include "eventdlg.hxx" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include -#include -#include -#include -#include - -#include "dlgname.hxx" - -#define PRTSTR(x) rtl::OUStringToOString(x, RTL_TEXTENCODING_ASCII_US).pData->buffer - -#define ENTRY_HEIGHT 16 - -static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; -static const char ITEM_DESCRIPTOR_LABEL[] = "Label"; -static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; -static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; -static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible"; -static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL"; -static const char ITEM_DESCRIPTOR_UINAME[] = "UIName"; - -static const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar"; -static const char ITEM_TOOLBAR_URL[] = "private:resource/toolbar/"; - -static const char CUSTOM_TOOLBAR_STR[] = "custom_toolbar_"; -static const char CUSTOM_MENU_STR[] = "vnd.openoffice.org:CustomMenu"; - -static const char pSeparatorStr[] = - "----------------------------------"; -static const char pMenuSeparatorStr[] = " | "; - -#ifdef _MSC_VER -#pragma warning (disable:4355) -#endif - -using rtl::OUString; -namespace css = com::sun::star; -namespace uno = com::sun::star::uno; -namespace frame = com::sun::star::frame; -namespace lang = com::sun::star::lang; -namespace container = com::sun::star::container; -namespace beans = com::sun::star::beans; -namespace graphic = com::sun::star::graphic; - -#if OSL_DEBUG_LEVEL > 1 - -void printPropertySet( - const OUString& prefix, - const uno::Reference< beans::XPropertySet >& xPropSet ) -{ - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = - xPropSet->getPropertySetInfo(); - - uno::Sequence< beans::Property > aPropDetails = - xPropSetInfo->getProperties(); - - OSL_TRACE("printPropertySet: %d properties", aPropDetails.getLength()); - - for ( sal_Int32 i = 0; i < aPropDetails.getLength(); ++i ) - { - OUString tmp; - sal_Int32 ival; - - uno::Any a = xPropSet->getPropertyValue( aPropDetails[i].Name ); - - if ( a >>= tmp ) - { - OSL_TRACE("%s: Got property: %s = %s", - PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(tmp)); - } - else if ( ( a >>= ival ) ) - { - OSL_TRACE("%s: Got property: %s = %d", - PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(tmp)); - } - else - { - OSL_TRACE("%s: Got property: %s of type %s", - PRTSTR(prefix), PRTSTR(aPropDetails[i].Name), PRTSTR(a.getValueTypeName())); - } - } -} - -void printProperties( - const OUString& prefix, - const uno::Sequence< beans::PropertyValue >& aProp ) -{ - for ( sal_Int32 i = 0; i < aProp.getLength(); ++i ) - { - OUString tmp; - - aProp[i].Value >>= tmp; - - OSL_TRACE("%s: Got property: %s = %s", - PRTSTR(prefix), PRTSTR(aProp[i].Name), PRTSTR(tmp)); - } -} - -void printEntries(SvxEntries* entries) -{ - SvxEntries::const_iterator iter = entries->begin(); - - for ( ; iter != entries->end(); ++iter ) - { - SvxConfigEntry* entry = *iter; - - OSL_TRACE("printEntries: %s", PRTSTR(entry->GetName())); - } -} - -#endif - -OUString -stripHotKey( const OUString& str ) -{ - sal_Int32 index = str.indexOf( '~' ); - if ( index == -1 ) - { - return str; - } - else - { - return str.replaceAt( index, 1, OUString() ); - } -} - -OUString replaceSaveInName( - const OUString& rMessage, - const OUString& rSaveInName ) -{ - OUString name; - OUString placeholder(RTL_CONSTASCII_USTRINGPARAM( "%SAVE IN SELECTION%" )); - - sal_Int32 pos = rMessage.indexOf( placeholder ); - - if ( pos != -1 ) - { - name = rMessage.replaceAt( - pos, placeholder.getLength(), rSaveInName ); - } - - return name; -} - -OUString -replaceSixteen( const OUString& str, sal_Int32 nReplacement ) -{ - OUString result( str ); - OUString sixteen = OUString::valueOf( (sal_Int32)16 ); - OUString expected = OUString::valueOf( nReplacement ); - - sal_Int32 len = sixteen.getLength(); - sal_Int32 index = result.indexOf( sixteen ); - - while ( index != -1 ) - { - result = result.replaceAt( index, len, expected ); - index = result.indexOf( sixteen, index ); - } - - return result; -} - -OUString -generateCustomName( - const OUString& prefix, - SvxEntries* entries, - sal_Int32 suffix = 1 ) -{ - // find and replace the %n placeholder in the prefix string - OUString name; - OUString placeholder(RTL_CONSTASCII_USTRINGPARAM( "%n" )); - - sal_Int32 pos = prefix.indexOf( - OUString(RTL_CONSTASCII_USTRINGPARAM( "%n" )) ); - - if ( pos != -1 ) - { - name = prefix.replaceAt( - pos, placeholder.getLength(), OUString::valueOf( suffix ) ); - } - else - { - // no placeholder found so just append the suffix - name = prefix + OUString::valueOf( suffix ); - } - - // now check is there is an already existing entry with this name - SvxEntries::const_iterator iter = entries->begin(); - - SvxConfigEntry* pEntry; - while ( iter != entries->end() ) - { - pEntry = *iter; - - if ( name.equals( pEntry->GetName() ) ) - { - break; - } - ++iter; - } - - if ( iter != entries->end() ) - { - // name already exists so try the next number up - return generateCustomName( prefix, entries, ++suffix ); - } - - return name; -} - -sal_uInt32 generateRandomValue() -{ - srand( unsigned( time( NULL ) )); - return sal_uInt32( rand() ); -} - -OUString -generateCustomURL( - SvxEntries* entries ) -{ - OUString url = OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )); - url += OUString(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_TOOLBAR_STR )); - - // use a random number to minimize possible clash with existing custom toolbars - url += OUString::valueOf( sal_Int64( generateRandomValue() ), 16 ); - - // now check is there is an already existing entry with this url - SvxEntries::const_iterator iter = entries->begin(); - - SvxConfigEntry* pEntry; - while ( iter != entries->end() ) - { - pEntry = *iter; - - if ( url.equals( pEntry->GetCommand() ) ) - { - break; - } - ++iter; - } - - if ( iter != entries->end() ) - { - // url already exists so try the next number up - return generateCustomURL( entries ); - } - - return url; -} - -OUString -generateCustomMenuURL( - SvxEntries* entries, - sal_Int32 suffix = 1 ) -{ - OUString url(RTL_CONSTASCII_USTRINGPARAM( CUSTOM_MENU_STR )); - url += OUString::valueOf( suffix ); - - // now check is there is an already existing entry with this url - SvxEntries::const_iterator iter = entries->begin(); - - SvxConfigEntry* pEntry; - while ( iter != entries->end() ) - { - pEntry = *iter; - - if ( url.equals( pEntry->GetCommand() ) ) - { - break; - } - ++iter; - } - - if ( iter != entries->end() ) - { - // url already exists so try the next number up - return generateCustomMenuURL( entries, ++suffix ); - } - - return url; -} - -static sal_Int16 theImageType = - css::ui::ImageType::COLOR_NORMAL | - css::ui::ImageType::SIZE_DEFAULT; - -void InitImageType() -{ - theImageType = - css::ui::ImageType::COLOR_NORMAL | - css::ui::ImageType::SIZE_DEFAULT; - - if ( SvtMiscOptions().AreCurrentSymbolsLarge() ) - { - theImageType |= css::ui::ImageType::SIZE_LARGE; - } -} - -sal_Int16 GetImageType() -{ - return theImageType; -} - -void RemoveEntry( SvxEntries* pEntries, SvxConfigEntry* pChildEntry ) -{ - SvxEntries::iterator iter = pEntries->begin(); - - while ( iter != pEntries->end() ) - { - if ( pChildEntry == *iter ) - { - pEntries->erase( iter ); - break; - } - ++iter; - } -} - -bool -SvxConfigPage::CanConfig( const OUString& aModuleId ) -{ - OSL_TRACE("SupportsDocumentConfig: %s", PRTSTR(aModuleId)); - - if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.script.BasicIDE" ) ) - || aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.frame.Bibliography" ) ) - ) - { - return sal_False; - } - return sal_True; -} - -OUString GetModuleName( const OUString& aModuleId ) -{ - if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) || - aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.GlobalDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Writer")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Writer/Web")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Draw")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Impress")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Calc")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.script.BasicIDE" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Basic")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.formula.FormulaProperties" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Math")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sdb.RelationDesign" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Relation Design")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sdb.QueryDesign" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Query Design")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sdb.TableDesign" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Table Design")); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sdb.DataSourceBrowser" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Data Source Browser" )); - else if ( aModuleId.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sdb.DatabaseDocument" ) ) ) - return OUString(RTL_CONSTASCII_USTRINGPARAM("Database" )); - - return ::rtl::OUString(); -} - -OUString GetUIModuleName( const OUString& aModuleId, const uno::Reference< css::frame::XModuleManager >& rModuleManager ) -{ - OUString aModuleUIName; - - if ( rModuleManager.is() ) - { - uno::Reference< css::container::XNameAccess > xNameAccess( rModuleManager, uno::UNO_QUERY ); - if ( xNameAccess.is() ) - { - try - { - uno::Any a = xNameAccess->getByName( aModuleId ); - uno::Sequence< beans::PropertyValue > aSeq; - - if ( a >>= aSeq ) - { - OUString aUIName; - for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i ) - { - if ( aSeq[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ooSetupFactoryUIName" ) )) - { - aSeq[i].Value >>= aModuleUIName; - break; - } - } - } - } - catch ( uno::RuntimeException& e ) - { - throw e; - } - catch ( uno::Exception& ) - { - } - } - } - - if ( aModuleUIName.getLength() == 0 ) - aModuleUIName = GetModuleName( aModuleId ); - - return aModuleUIName; -} - -bool GetMenuItemData( - const uno::Reference< container::XIndexAccess >& rItemContainer, - sal_Int32 nIndex, - OUString& rCommandURL, - OUString& rLabel, - sal_uInt16& rType, - uno::Reference< container::XIndexAccess >& rSubMenu ) -{ - try - { - uno::Sequence< beans::PropertyValue > aProp; - if ( rItemContainer->getByIndex( nIndex ) >>= aProp ) - { - for ( sal_Int32 i = 0; i < aProp.getLength(); ++i ) - { - if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL )) - { - aProp[i].Value >>= rCommandURL; - } - else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_CONTAINER )) - { - aProp[i].Value >>= rSubMenu; - } - else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL )) - { - aProp[i].Value >>= rLabel; - } - else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE )) - { - aProp[i].Value >>= rType; - } - } - - return sal_True; - } - } - catch ( ::com::sun::star::lang::IndexOutOfBoundsException& ) - { - } - - return sal_False; -} - -bool GetToolbarItemData( - const uno::Reference< container::XIndexAccess >& rItemContainer, - sal_Int32 nIndex, - OUString& rCommandURL, - OUString& rLabel, - sal_uInt16& rType, - sal_Bool& rIsVisible, - sal_Int32& rStyle, - uno::Reference< container::XIndexAccess >& rSubMenu ) -{ - try - { - uno::Sequence< beans::PropertyValue > aProp; - if ( rItemContainer->getByIndex( nIndex ) >>= aProp ) - { - for ( sal_Int32 i = 0; i < aProp.getLength(); ++i ) - { - if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL )) - { - aProp[i].Value >>= rCommandURL; - } - if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE )) - { - aProp[i].Value >>= rStyle; - } - else if (aProp[i].Name.equalsAscii(ITEM_DESCRIPTOR_CONTAINER)) - { - aProp[i].Value >>= rSubMenu; - } - else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL )) - { - aProp[i].Value >>= rLabel; - } - else if ( aProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE )) - { - aProp[i].Value >>= rType; - } - else if (aProp[i].Name.equalsAscii(ITEM_DESCRIPTOR_ISVISIBLE)) - { - aProp[i].Value >>= rIsVisible; - } - } - - return sal_True; - } - } - catch ( ::com::sun::star::lang::IndexOutOfBoundsException& ) - { - } - - return sal_False; -} - -uno::Sequence< beans::PropertyValue > -ConvertSvxConfigEntry( - const uno::Reference< container::XNameAccess >& xCommandToLabelMap, - const SvxConfigEntry* pEntry ) -{ - static const OUString aDescriptorCommandURL ( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) ); - - static const OUString aDescriptorType( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) ); - - static const OUString aDescriptorLabel( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) ); - - static const OUString aDescriptorContainer( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) ); - - uno::Sequence< beans::PropertyValue > aPropSeq( 3 ); - - aPropSeq[0].Name = aDescriptorCommandURL; - aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() ); - - aPropSeq[1].Name = aDescriptorType; - aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; - - // If the name has not been changed and the name is the same as - // in the default command to label map then the label can be stored - // as an empty string. - // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; - if ( pEntry->HasChangedName() == sal_False && pEntry->GetCommand().getLength() ) - { - sal_Bool isDefaultName = sal_False; - try - { - uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) ); - uno::Sequence< beans::PropertyValue > tmpPropSeq; - if ( a >>= tmpPropSeq ) - { - for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) - { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) - { - OUString tmpLabel; - tmpPropSeq[i].Value >>= tmpLabel; - - if ( tmpLabel.equals( pEntry->GetName() ) ) - { - isDefaultName = sal_True; - } - - break; - } - } - } - } - catch ( container::NoSuchElementException& ) - { - // isDefaultName is left as FALSE - } - - if ( isDefaultName ) - { - aPropSeq[2].Value <<= rtl::OUString(); - } - else - { - aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() ); - } - } - else - { - aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() ); - } - - return aPropSeq; -} - -uno::Sequence< beans::PropertyValue > -ConvertToolbarEntry( - const uno::Reference< container::XNameAccess >& xCommandToLabelMap, - const SvxConfigEntry* pEntry ) -{ - static const OUString aDescriptorCommandURL ( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_COMMANDURL ) ); - - static const OUString aDescriptorType( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) ); - - static const OUString aDescriptorLabel( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_LABEL ) ); - - static const OUString aDescriptorContainer( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) ); - - static const OUString aIsVisible( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_ISVISIBLE ) ); - - uno::Sequence< beans::PropertyValue > aPropSeq( 4 ); - - aPropSeq[0].Name = aDescriptorCommandURL; - aPropSeq[0].Value <<= rtl::OUString( pEntry->GetCommand() ); - - aPropSeq[1].Name = aDescriptorType; - aPropSeq[1].Value <<= css::ui::ItemType::DEFAULT; - - // If the name has not been changed and the name is the same as - // in the default command to label map then the label can be stored - // as an empty string. - // It will be initialised again later using the command to label map. - aPropSeq[2].Name = aDescriptorLabel; - if ( pEntry->HasChangedName() == sal_False && pEntry->GetCommand().getLength() ) - { - sal_Bool isDefaultName = sal_False; - try - { - uno::Any a( xCommandToLabelMap->getByName( pEntry->GetCommand() ) ); - uno::Sequence< beans::PropertyValue > tmpPropSeq; - if ( a >>= tmpPropSeq ) - { - for ( sal_Int32 i = 0; i < tmpPropSeq.getLength(); ++i ) - { - if ( tmpPropSeq[i].Name.equals( aDescriptorLabel ) ) - { - OUString tmpLabel; - tmpPropSeq[i].Value >>= tmpLabel; - - if ( tmpLabel.equals( pEntry->GetName() ) ) - { - isDefaultName = sal_True; - } - - break; - } - } - } - } - catch ( container::NoSuchElementException& ) - { - // isDefaultName is left as FALSE - } - - if ( isDefaultName ) - { - aPropSeq[2].Value <<= rtl::OUString(); - } - else - { - aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() ); - } - } - else - { - aPropSeq[2].Value <<= rtl::OUString( pEntry->GetName() ); - } - - aPropSeq[3].Name = aIsVisible; - aPropSeq[3].Value <<= pEntry->IsVisible(); - - return aPropSeq; -} - -SfxTabPage *CreateSvxMenuConfigPage( Window *pParent, const SfxItemSet& rSet ) -{ - return new SvxMenuConfigPage( pParent, rSet ); -} - -SfxTabPage *CreateKeyboardConfigPage( Window *pParent, const SfxItemSet& rSet ) -{ - return new SfxAcceleratorConfigPage( pParent, rSet ); -} - -SfxTabPage *CreateSvxToolbarConfigPage( Window *pParent, const SfxItemSet& rSet ) -{ - return new SvxToolbarConfigPage( pParent, rSet ); -} - -SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet ) -{ - return new SvxEventConfigPage( pParent, rSet, SvxEventConfigPage::EarlyInit() ); -} - -sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame ) -{ - static ::rtl::OUString SERVICENAME_MODULEMANAGER (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.ModuleManager") ); - static ::rtl::OUString SERVICENAME_DESKTOP (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.Desktop" ) ); - static ::rtl::OUString MODULEID_STARTMODULE (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.frame.StartModule" ) ); - - try - { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XModuleManager > xMM (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); - - if (xMM.is() && xFrame.is()) - { - ::rtl::OUString sModuleId = xMM->identify(xFrame); - if ( - ( sModuleId.getLength() ) && - (!sModuleId.equals(MODULEID_STARTMODULE)) - ) - return sal_True; - } - } - catch(const css::uno::Exception&) - {} - - return sal_False; -} - -/****************************************************************************** - * - * SvxConfigDialog is the configuration dialog which is brought up from the - * Tools menu. It includes tabs for customizing menus, toolbars, events and - * key bindings. - * - *****************************************************************************/ -SvxConfigDialog::SvxConfigDialog( - Window * pParent, const SfxItemSet* pSet_ ) - : - SfxTabDialog( pParent, - CUI_RES( RID_SVXDLG_CUSTOMIZE ), pSet_ ) -{ - FreeResource(); - - InitImageType(); - - AddTabPage( RID_SVXPAGE_MENUS, CreateSvxMenuConfigPage, NULL ); - AddTabPage( RID_SVXPAGE_KEYBOARD, CreateKeyboardConfigPage, NULL ); - AddTabPage( RID_SVXPAGE_TOOLBARS, CreateSvxToolbarConfigPage, NULL ); - AddTabPage( RID_SVXPAGE_EVENTS, CreateSvxEventConfigPage, NULL ); - - const SfxPoolItem* pItem = - pSet_->GetItem( pSet_->GetPool()->GetWhich( SID_CONFIG ) ); - - if ( pItem ) - { - OUString text = ((const SfxStringItem*)pItem)->GetValue(); - - if (text.indexOf(OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_TOOLBAR_URL))) == 0) - { - SetCurPageId( RID_SVXPAGE_TOOLBARS ); - } - } -} - -void SvxConfigDialog::SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame) -{ - m_xFrame = xFrame; - - if (!impl_showKeyConfigTabPage( xFrame )) - RemoveTabPage( RID_SVXPAGE_KEYBOARD ); -} - -SvxConfigDialog::~SvxConfigDialog() -{ -} - -short SvxConfigDialog::Ok() -{ - return SfxTabDialog::Ok(); -} - -void SvxConfigDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) -{ - (void)rPage; - - switch ( nId ) - { - case RID_SVXPAGE_MENUS: - case RID_SVXPAGE_TOOLBARS: - case RID_SVXPAGE_KEYBOARD: - { - rPage.SetFrame(m_xFrame); - } - break; - case RID_SVXPAGE_EVENTS: - { - dynamic_cast< SvxEventConfigPage& >( rPage ).LateInit( m_xFrame ); - }; - break; - default: - break; - } -} - -/****************************************************************************** - * - * The SaveInData class is used to hold data for entries in the Save In - * ListBox controls in the menu and toolbar tabs - * - ******************************************************************************/ - -// Initialize static variable which holds default XImageManager -uno::Reference< css::ui::XImageManager>* SaveInData::xDefaultImgMgr = NULL; - -SaveInData::SaveInData( - const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr, - const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr, - const OUString& aModuleId, - bool isDocConfig ) - : - bModified( sal_False ), - bDocConfig( isDocConfig ), - bReadOnly( sal_False ), - m_xCfgMgr( xCfgMgr ), - m_xParentCfgMgr( xParentCfgMgr ) -{ - uno::Reference< beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - - xProps->getPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) - >>= m_xComponentContext; - - m_aSeparatorSeq.realloc( 1 ); - m_aSeparatorSeq[0].Name = OUString( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_TYPE ) ); - m_aSeparatorSeq[0].Value <<= css::ui::ItemType::SEPARATOR_LINE; - - if ( bDocConfig ) - { - uno::Reference< css::ui::XUIConfigurationPersistence > - xDocPersistence( GetConfigManager(), uno::UNO_QUERY ); - - bReadOnly = xDocPersistence->isReadOnly(); - } - - m_xServiceManager = uno::Reference< lang::XMultiServiceFactory >( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - - uno::Reference< container::XNameAccess > xNameAccess( - m_xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.UICommandDescription" ) ) ), - uno::UNO_QUERY ); - - if ( xNameAccess.is() ) - xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap; - - if ( !m_xImgMgr.is() ) - { - m_xImgMgr = uno::Reference< css::ui::XImageManager >( - GetConfigManager()->getImageManager(), uno::UNO_QUERY ); - } - - if ( !IsDocConfig() ) - { - // If this is not a document configuration then it is the settings - // for the module (writer, calc, impress etc.) Use this as the default - // XImageManager instance - xDefaultImgMgr = &m_xImgMgr; - } - else - { - // If this is a document configuration then use the module image manager - // as default. - if ( m_xParentCfgMgr.is() ) - { - m_xParentImgMgr = uno::Reference< css::ui::XImageManager >( - m_xParentCfgMgr->getImageManager(), uno::UNO_QUERY ); - xDefaultImgMgr = &m_xParentImgMgr; - } - } -} - -uno::Reference< graphic::XGraphic > GetGraphic( - const uno::Reference< css::ui::XImageManager >& xImageManager, - const OUString& rCommandURL ) -{ - uno::Reference< graphic::XGraphic > result; - - if ( xImageManager.is() ) - { - // TODO handle large graphics - uno::Sequence< uno::Reference< graphic::XGraphic > > aGraphicSeq; - - uno::Sequence< OUString > aImageCmdSeq( 1 ); - aImageCmdSeq[0] = rCommandURL; - - try - { - aGraphicSeq = - xImageManager->getImages( GetImageType(), aImageCmdSeq ); - - if ( aGraphicSeq.getLength() > 0 ) - { - result = aGraphicSeq[0]; - } - } - catch ( uno::Exception& ) - { - // will return empty XGraphic - } - } - - return result; -} - -Image SaveInData::GetImage( const OUString& rCommandURL ) -{ - Image aImage; - - uno::Reference< graphic::XGraphic > xGraphic = - GetGraphic( m_xImgMgr, rCommandURL ); - - if ( xGraphic.is() ) - { - aImage = Image( xGraphic ); - } - else if ( xDefaultImgMgr != NULL && (*xDefaultImgMgr).is() ) - { - xGraphic = GetGraphic( (*xDefaultImgMgr), rCommandURL ); - - if ( xGraphic.is() ) - { - aImage = Image( xGraphic ); - } - } - - return aImage; -} - -bool SaveInData::PersistChanges( - const uno::Reference< uno::XInterface >& xManager ) -{ - bool result = sal_True; - - try - { - if ( xManager.is() && !IsReadOnly() ) - { - uno::Reference< css::ui::XUIConfigurationPersistence > - xConfigPersistence( xManager, uno::UNO_QUERY ); - - if ( xConfigPersistence->isModified() ) - { - xConfigPersistence->store(); - } - } - } - catch ( com::sun::star::io::IOException& ) - { - result = sal_False; - } - - return result; -} - -/****************************************************************************** - * - * The MenuSaveInData class extends SaveInData and provides menu specific - * load and store functionality. - * - ******************************************************************************/ - -// Initialize static variable which holds default Menu data -MenuSaveInData* MenuSaveInData::pDefaultData = NULL; - -MenuSaveInData::MenuSaveInData( - const uno::Reference< css::ui::XUIConfigurationManager >& cfgmgr, - const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr, - const OUString& aModuleId, - bool isDocConfig ) - : - SaveInData( cfgmgr, xParentCfgMgr, aModuleId, isDocConfig ), - m_aMenuResourceURL( - RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) ), - m_aDescriptorContainer( - RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) ), - pRootEntry( 0 ) -{ - try - { - OUString url( RTL_CONSTASCII_USTRINGPARAM( ITEM_MENUBAR_URL ) ); - m_xMenuSettings = GetConfigManager()->getSettings( url, sal_False ); - } - catch ( container::NoSuchElementException& ) - { - // will use menu settings for the module - } - - // If this is not a document configuration then it is the settings - // for the module (writer, calc, impress etc.). These settings should - // be set as the default to be used for SaveIn locations that do not - // have custom settings - if ( !IsDocConfig() ) - { - SetDefaultData( this ); - } -} - -MenuSaveInData::~MenuSaveInData() -{ - if ( pRootEntry != NULL ) - { - delete pRootEntry; - } -} - -SvxEntries* -MenuSaveInData::GetEntries() -{ - if ( pRootEntry == NULL ) - { - pRootEntry = new SvxConfigEntry( - String::CreateFromAscii("MainMenus"), String(), sal_True ); - - if ( m_xMenuSettings.is() ) - { - LoadSubMenus( m_xMenuSettings, String(), pRootEntry ); - } - else if ( GetDefaultData() != NULL ) - { - // If the doc has no config settings use module config settings - LoadSubMenus( GetDefaultData()->m_xMenuSettings, String(), pRootEntry ); - } - } - - return pRootEntry->GetEntries(); -} - -void -MenuSaveInData::SetEntries( SvxEntries* pNewEntries ) -{ - // delete old menu hierarchy first - if ( pRootEntry != NULL ) - { - delete pRootEntry->GetEntries(); - } - - // now set new menu hierarchy - pRootEntry->SetEntries( pNewEntries ); -} - -bool MenuSaveInData::LoadSubMenus( - const uno::Reference< container::XIndexAccess >& xMenuSettings, - const OUString& rBaseTitle, - SvxConfigEntry* pParentData ) -{ - SvxEntries* pEntries = pParentData->GetEntries(); - - // Don't access non existing menu configuration! - if ( !xMenuSettings.is() ) - return true; - - for ( sal_Int32 nIndex = 0; nIndex < xMenuSettings->getCount(); ++nIndex ) - { - uno::Reference< container::XIndexAccess > xSubMenu; - OUString aCommandURL; - OUString aLabel; - bool bIsUserDefined = sal_True; - - sal_uInt16 nType( css::ui::ItemType::DEFAULT ); - - bool bItem = GetMenuItemData( xMenuSettings, nIndex, - aCommandURL, aLabel, nType, xSubMenu ); - - if ( bItem ) - { - if ( nType == css::ui::ItemType::DEFAULT ) - { - uno::Any a; - try - { - a = m_xCommandToLabelMap->getByName( aCommandURL ); - bIsUserDefined = sal_False; - } - catch ( container::NoSuchElementException& ) - { - bIsUserDefined = sal_True; - } - - // If custom label not set retrieve it from the command - // to info service - if ( aLabel.equals( OUString() ) ) - { - uno::Sequence< beans::PropertyValue > aPropSeq; - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); ++i ) - { - if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) ) - { - aPropSeq[i].Value >>= aLabel; - break; - } - } - } - } - - if ( xSubMenu.is() ) - { - // popup menu - SvxConfigEntry* pEntry = new SvxConfigEntry( - aLabel, aCommandURL, sal_True ); - - pEntry->SetUserDefined( bIsUserDefined ); - - pEntries->push_back( pEntry ); - - OUString subMenuTitle( rBaseTitle ); - - if ( subMenuTitle.getLength() != 0 ) - { - subMenuTitle += - OUString::createFromAscii(pMenuSeparatorStr); - } - else - { - pEntry->SetMain( sal_True ); - } - - subMenuTitle += stripHotKey( aLabel ); - - LoadSubMenus( xSubMenu, subMenuTitle, pEntry ); - } - else - { - SvxConfigEntry* pEntry = new SvxConfigEntry( - aLabel, aCommandURL, sal_False ); - pEntry->SetUserDefined( bIsUserDefined ); - pEntries->push_back( pEntry ); - } - } - else - { - SvxConfigEntry* pEntry = new SvxConfigEntry; - pEntry->SetUserDefined( bIsUserDefined ); - pEntries->push_back( pEntry ); - } - } - } - return true; -} - -bool MenuSaveInData::Apply() -{ - bool result = sal_False; - - if ( IsModified() ) - { - // Apply new menu bar structure to our settings container - m_xMenuSettings = uno::Reference< container::XIndexAccess >( - GetConfigManager()->createSettings(), uno::UNO_QUERY ); - - uno::Reference< container::XIndexContainer > xIndexContainer ( - m_xMenuSettings, uno::UNO_QUERY ); - - uno::Reference< lang::XSingleComponentFactory > xFactory ( - m_xMenuSettings, uno::UNO_QUERY ); - - Apply( pRootEntry, xIndexContainer, xFactory, NULL ); - - try - { - if ( GetConfigManager()->hasSettings( m_aMenuResourceURL ) ) - { - GetConfigManager()->replaceSettings( - m_aMenuResourceURL, m_xMenuSettings ); - } - else - { - GetConfigManager()->insertSettings( - m_aMenuResourceURL, m_xMenuSettings ); - } - } - catch ( container::NoSuchElementException& ) - { - OSL_TRACE("caught container::NoSuchElementException saving settings"); - } - catch ( com::sun::star::io::IOException& ) - { - OSL_TRACE("caught IOException saving settings"); - } - catch ( com::sun::star::uno::Exception& ) - { - OSL_TRACE("caught some other exception saving settings"); - } - - SetModified( sal_False ); - - result = PersistChanges( GetConfigManager() ); - } - - return result; -} - -void MenuSaveInData::Apply( - SvxConfigEntry* pRootEntry_, - uno::Reference< container::XIndexContainer >& rMenuBar, - uno::Reference< lang::XSingleComponentFactory >& rFactory, - SvLBoxEntry *pParentEntry ) -{ - (void)pRootEntry_; - (void)pParentEntry; - - SvxEntries::const_iterator iter = GetEntries()->begin(); - SvxEntries::const_iterator end = GetEntries()->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntryData = *iter; - - uno::Sequence< beans::PropertyValue > aPropValueSeq = - ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntryData ); - - uno::Reference< container::XIndexContainer > xSubMenuBar( - rFactory->createInstanceWithContext( m_xComponentContext ), - uno::UNO_QUERY ); - - sal_Int32 nIndex = aPropValueSeq.getLength(); - aPropValueSeq.realloc( nIndex + 1 ); - aPropValueSeq[nIndex].Name = m_aDescriptorContainer; - aPropValueSeq[nIndex].Value <<= xSubMenuBar; - rMenuBar->insertByIndex( - rMenuBar->getCount(), uno::makeAny( aPropValueSeq )); - ApplyMenu( xSubMenuBar, rFactory, pEntryData ); - } -} - -void MenuSaveInData::ApplyMenu( - uno::Reference< container::XIndexContainer >& rMenuBar, - uno::Reference< lang::XSingleComponentFactory >& rFactory, - SvxConfigEntry* pMenuData ) -{ - SvxEntries::const_iterator iter = pMenuData->GetEntries()->begin(); - SvxEntries::const_iterator end = pMenuData->GetEntries()->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntry = *iter; - - if ( pEntry->IsPopup() ) - { - uno::Sequence< beans::PropertyValue > aPropValueSeq = - ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry ); - - uno::Reference< container::XIndexContainer > xSubMenuBar( - rFactory->createInstanceWithContext( m_xComponentContext ), - uno::UNO_QUERY ); - - sal_Int32 nIndex = aPropValueSeq.getLength(); - aPropValueSeq.realloc( nIndex + 1 ); - aPropValueSeq[nIndex].Name = m_aDescriptorContainer; - aPropValueSeq[nIndex].Value <<= xSubMenuBar; - - rMenuBar->insertByIndex( - rMenuBar->getCount(), uno::makeAny( aPropValueSeq )); - - ApplyMenu( xSubMenuBar, rFactory, pEntry ); - } - else if ( pEntry->IsSeparator() ) - { - rMenuBar->insertByIndex( - rMenuBar->getCount(), uno::makeAny( m_aSeparatorSeq )); - } - else - { - uno::Sequence< beans::PropertyValue > aPropValueSeq = - ConvertSvxConfigEntry( m_xCommandToLabelMap, pEntry ); - rMenuBar->insertByIndex( - rMenuBar->getCount(), uno::makeAny( aPropValueSeq )); - } - } -} - -void -MenuSaveInData::Reset() -{ - GetConfigManager()->reset(); - - delete pRootEntry; - pRootEntry = NULL; - - try - { - m_xMenuSettings = GetConfigManager()->getSettings( - m_aMenuResourceURL, sal_False ); - } - catch ( container::NoSuchElementException& ) - { - // will use default settings - } -} - -class PopupPainter : public SvLBoxString -{ -public: - PopupPainter( SvLBoxEntry* pEntry, const String& rStr ) - : SvLBoxString( pEntry, 0, rStr ) - { } - - ~PopupPainter() { } - - void Paint( const Point& rPos, SvLBox& rOutDev, - sal_uInt16 nViewDataEntryFlags, SvLBoxEntry* pEntry ) - { - SvLBoxString::Paint( rPos, rOutDev, nViewDataEntryFlags, pEntry ); - - Color aOldFillColor = rOutDev.GetFillColor(); - - SvTreeListBox* pTreeBox = static_cast< SvTreeListBox* >( &rOutDev ); - long nX = pTreeBox->GetSizePixel().Width(); - - ScrollBar* pVScroll = pTreeBox->GetVScroll(); - if ( pVScroll->IsVisible() ) - { - nX -= pVScroll->GetSizePixel().Width(); - } - - SvViewDataItem* pItem = rOutDev.GetViewDataItem( pEntry, this ); - nX -= pItem->aSize.Height(); - - long nSize = pItem->aSize.Height() / 2; - long nHalfSize = nSize / 2; - long nY = rPos.Y() + nHalfSize; - - if ( aOldFillColor == COL_WHITE ) - { - rOutDev.SetFillColor( Color( COL_BLACK ) ); - } - else - { - rOutDev.SetFillColor( Color( COL_WHITE ) ); - } - - long n = 0; - while ( n <= nHalfSize ) - { - rOutDev.DrawRect( Rectangle( nX+n, nY+n, nX+n, nY+nSize-n ) ); - ++n; - } - - rOutDev.SetFillColor( aOldFillColor ); - } -}; - -/****************************************************************************** - * - * SvxMenuEntriesListBox is the listbox in which the menu items for a - * particular menu are shown. We have a custom listbox because we need - * to add drag'n'drop support from the Macro Selector and within the - * listbox - * - *****************************************************************************/ -SvxMenuEntriesListBox::SvxMenuEntriesListBox( - Window* pParent, const ResId& rResId) - : SvTreeListBox( pParent, rResId ) - , pPage( (SvxMenuConfigPage*) pParent ) - , m_bIsInternalDrag( sal_False ) -{ - SetStyle( - GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HIDESELECTION ); - - SetSpaceBetweenEntries( 3 ); - SetEntryHeight( ENTRY_HEIGHT ); - - SetHighlightRange(); - SetSelectionMode(SINGLE_SELECTION); - - SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | - SV_DRAGDROP_APP_COPY | - SV_DRAGDROP_ENABLE_TOP | - SV_DRAGDROP_APP_DROP); -} - -SvxMenuEntriesListBox::~SvxMenuEntriesListBox() -{ - // do nothing -} - -// drag and drop support -DragDropMode SvxMenuEntriesListBox::NotifyStartDrag( - TransferDataContainer& aTransferDataContainer, SvLBoxEntry* pEntry ) -{ - (void)aTransferDataContainer; - (void)pEntry; - - m_bIsInternalDrag = sal_True; - return GetDragDropMode(); -} - -void SvxMenuEntriesListBox::DragFinished( sal_Int8 nDropAction ) -{ - (void)nDropAction; - m_bIsInternalDrag = sal_False; -} - -sal_Int8 SvxMenuEntriesListBox::AcceptDrop( const AcceptDropEvent& rEvt ) -{ - if ( m_bIsInternalDrag ) - { - // internal copy isn't allowed! - if ( rEvt.mnAction == DND_ACTION_COPY ) - return DND_ACTION_NONE; - else - return SvTreeListBox::AcceptDrop( rEvt ); - } - - // Always do COPY instead of MOVE if D&D comes from outside! - AcceptDropEvent aNewAcceptDropEvent( rEvt ); - aNewAcceptDropEvent.mnAction = DND_ACTION_COPY; - return SvTreeListBox::AcceptDrop( aNewAcceptDropEvent ); -} - -sal_Bool SvxMenuEntriesListBox::NotifyAcceptDrop( SvLBoxEntry* ) -{ - return sal_True; -} - -sal_Bool SvxMenuEntriesListBox::NotifyMoving( - SvLBoxEntry* pTarget, SvLBoxEntry* pSource, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos) -{ - // only try to do a move if we are dragging within the list box - if ( m_bIsInternalDrag ) - { - if ( pPage->MoveEntryData( pSource, pTarget ) == sal_True ) - { - SvTreeListBox::NotifyMoving( - pTarget, pSource, rpNewParent, rNewChildPos ); - return sal_True; - } - else - { - return sal_False; - } - } - else - { - return NotifyCopying( pTarget, pSource, rpNewParent, rNewChildPos ); - } -} - -sal_Bool SvxMenuEntriesListBox::NotifyCopying( - SvLBoxEntry* pTarget, SvLBoxEntry* pSource, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos) -{ - (void)pSource; - (void)rpNewParent; - (void)rNewChildPos; - - if ( !m_bIsInternalDrag ) - { - // if the target is NULL then add function to the start of the list - pPage->AddFunction( pTarget, pTarget == NULL ); - - // AddFunction already adds the listbox entry so return FALSE - // to stop another listbox entry being added - return sal_False; - } - - // Copying is only allowed from external controls, not within the listbox - return sal_False; -} - -void SvxMenuEntriesListBox::KeyInput( const KeyEvent& rKeyEvent ) -{ - KeyCode keycode = rKeyEvent.GetKeyCode(); - - // support DELETE for removing the current entry - if ( keycode == KEY_DELETE ) - { - pPage->DeleteSelectedContent(); - } - // support CTRL+UP and CTRL+DOWN for moving selected entries - else if ( keycode.GetCode() == KEY_UP && keycode.IsMod1() ) - { - pPage->MoveEntry( sal_True ); - } - else if ( keycode.GetCode() == KEY_DOWN && keycode.IsMod1() ) - { - pPage->MoveEntry( sal_False ); - } - else - { - // pass on to superclass - SvTreeListBox::KeyInput( rKeyEvent ); - } -} - -// class SvxDescriptionEdit ---------------------------------------------- - -SvxDescriptionEdit::SvxDescriptionEdit( Window* pParent, const ResId& _rId ) : - - ExtMultiLineEdit( pParent, _rId ) - -{ - // calculate the available space for help text - m_aRealRect = Rectangle( Point(), GetSizePixel() ); - if ( GetVScrollBar() ) - m_aRealRect.Right() -= ( GetVScrollBar()->GetSizePixel().Width() + 4 ); - - SetLeftMargin(2); - SetBorderStyle( WINDOW_BORDER_MONO ); -} - -// ----------------------------------------------------------------------- - -void SvxDescriptionEdit::SetNewText( const String& _rText ) -{ - String sTemp( _rText ); - sal_Bool bShow = sal_False; - if ( sTemp.Len() > 0 ) - { - // detect if a scrollbar is necessary - Rectangle aRect = GetTextRect( m_aRealRect, sTemp, TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); - bShow = ( aRect.Bottom() > m_aRealRect.Bottom() ); - } - - if ( GetVScrollBar() ) - GetVScrollBar()->Show( bShow ); - - if ( bShow ) - sTemp += '\n'; - - SetText( sTemp ); -} - -/****************************************************************************** - * - * SvxConfigPage is the abstract base class on which the Menu and Toolbar - * configuration tabpages are based. It includes methods which are common to - * both tabpages to add, delete, move and rename items etc. - * - *****************************************************************************/ -SvxConfigPage::SvxConfigPage( - Window *pParent, const SfxItemSet& rSet ) - : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_MENUS ), rSet ), - bInitialised( sal_False ), - pCurrentSaveInData( 0 ), - aTopLevelSeparator( this, CUI_RES( GRP_MENUS ) ), - aTopLevelLabel( this, CUI_RES( FT_MENUS ) ), - aTopLevelListBox( this, CUI_RES( LB_MENUS ) ), - aNewTopLevelButton( this, CUI_RES( BTN_NEW ) ), - aModifyTopLevelButton( this, CUI_RES( BTN_CHANGE ) ), - aContentsSeparator( this, CUI_RES( GRP_MENU_SEPARATOR ) ), - aContentsLabel( this, CUI_RES( GRP_MENU_ENTRIES ) ), - aContentsListBox( 0 ), - aAddCommandsButton( this, CUI_RES( BTN_ADD_COMMANDS ) ), - aModifyCommandButton( this, CUI_RES( BTN_CHANGE_ENTRY ) ), - aMoveUpButton( this, CUI_RES( BTN_UP ) ), - aMoveDownButton( this, CUI_RES( BTN_DOWN ) ), - aSaveInText( this, CUI_RES( TXT_SAVEIN ) ), - aSaveInListBox( this, CUI_RES( LB_SAVEIN ) ), - aDescriptionLabel( this, CUI_RES( FT_DESCRIPTION ) ), - aDescriptionField( this, CUI_RES( ED_DESCRIPTION ) ), - pSelectorDlg( 0 ) -{ - aDescriptionField.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() ); - aDescriptionField.SetAutoScroll( sal_True ); - aDescriptionField.EnableCursor( sal_False ); - - aMoveUpButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_UP))); - aMoveDownButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_DOWN))); - aMoveUpButton.SetAccessibleRelationMemberOf(&aContentsSeparator); - aMoveDownButton.SetAccessibleRelationMemberOf(&aContentsSeparator); - aNewTopLevelButton.SetAccessibleRelationMemberOf(&aTopLevelSeparator); - aModifyTopLevelButton.SetAccessibleRelationMemberOf(&aTopLevelSeparator); - aAddCommandsButton.SetAccessibleRelationMemberOf(&aContentsSeparator); - aModifyCommandButton.SetAccessibleRelationMemberOf(&aContentsSeparator); -} - -SvxConfigPage::~SvxConfigPage() -{ -} - -void SvxConfigPage::Reset( const SfxItemSet& ) -{ - // If we haven't initialised our XMultiServiceFactory reference - // then Reset is being called at the opening of the dialog. - // - // Load menu configuration data for the module of the currently - // selected document, for the currently selected document, and for - // all other open documents of the same module type - if ( !bInitialised ) - { - sal_uInt16 nPos = 0; - uno::Reference < css::ui::XUIConfigurationManager > xCfgMgr; - uno::Reference < css::ui::XUIConfigurationManager > xDocCfgMgr; - - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - - m_xFrame = GetFrame(); - OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame ); - - // replace %MODULENAME in the label with the correct module name - uno::Reference< css::frame::XModuleManager > xModuleManager( - xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ) ) ), - uno::UNO_QUERY_THROW ); - OUString aModuleName = GetUIModuleName( aModuleId, xModuleManager ); - - OUString title = aTopLevelSeparator.GetText(); - OUString aSearchString(RTL_CONSTASCII_USTRINGPARAM( "%MODULENAME" )); - sal_Int32 index = title.indexOf( aSearchString ); - - if ( index != -1 ) - { - title = title.replaceAt( - index, aSearchString.getLength(), aModuleName ); - aTopLevelSeparator.SetText( title ); - } - - uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > - xModuleCfgSupplier( xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))), - uno::UNO_QUERY ); - - // Set up data for module specific menus - SaveInData* pModuleData = NULL; - - try - { - xCfgMgr = - xModuleCfgSupplier->getUIConfigurationManager( aModuleId ); - - pModuleData = CreateSaveInData( xCfgMgr, - uno::Reference< css::ui::XUIConfigurationManager >(), - aModuleId, - sal_False ); - } - catch ( container::NoSuchElementException& ) - { - } - - if ( pModuleData != NULL ) - { - OUString label; - utl::ConfigManager::GetDirectConfigProperty( - utl::ConfigManager::PRODUCTNAME ) >>= label; - label += OUString(RTL_CONSTASCII_USTRINGPARAM( " " )); - label += aModuleName; - - nPos = aSaveInListBox.InsertEntry( label ); - aSaveInListBox.SetEntryData( nPos, pModuleData ); - } - - // try to retrieve the document based ui configuration manager - OUString aTitle; - uno::Reference< frame::XController > xController = - m_xFrame->getController(); - if ( CanConfig( aModuleId ) && xController.is() ) - { - uno::Reference< frame::XModel > xModel( xController->getModel() ); - if ( xModel.is() ) - { - uno::Reference< css::ui::XUIConfigurationManagerSupplier > - xCfgSupplier( xModel, uno::UNO_QUERY ); - - if ( xCfgSupplier.is() ) - { - xDocCfgMgr = xCfgSupplier->getUIConfigurationManager(); - } - aTitle = ::comphelper::DocumentInfo::getDocumentTitle( xModel ); - } - } - - SaveInData* pDocData = NULL; - if ( xDocCfgMgr.is() ) - { - pDocData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, sal_True ); - - if ( !pDocData->IsReadOnly() ) - { - nPos = aSaveInListBox.InsertEntry( aTitle ); - aSaveInListBox.SetEntryData( nPos, pDocData ); - } - } - - // if an item to select has been passed in (eg. the ResourceURL for a - // toolbar) then try to select the SaveInData entry that has that item - bool bURLToSelectFound = sal_False; - if ( m_aURLToSelect.getLength() != 0 ) - { - if ( pDocData != NULL && pDocData->HasURL( m_aURLToSelect ) ) - { - aSaveInListBox.SelectEntryPos( nPos, sal_True ); - pCurrentSaveInData = pDocData; - bURLToSelectFound = sal_True; - } - else if ( pModuleData->HasURL( m_aURLToSelect ) ) - { - aSaveInListBox.SelectEntryPos( 0, sal_True ); - pCurrentSaveInData = pModuleData; - bURLToSelectFound = sal_True; - } - } - - if ( bURLToSelectFound == sal_False ) - { - // if the document has menu configuration settings select it - // it the SaveIn listbox, otherwise select the module data - if ( pDocData != NULL && pDocData->HasSettings() ) - { - aSaveInListBox.SelectEntryPos( nPos, sal_True ); - pCurrentSaveInData = pDocData; - } - else - { - aSaveInListBox.SelectEntryPos( 0, sal_True ); - pCurrentSaveInData = pModuleData; - } - } - -#ifdef DBG_UTIL - DBG_ASSERT( pCurrentSaveInData, "SvxConfigPage::Reset(): no SaveInData" ); -#endif - - if ( CanConfig( aModuleId ) ) - { - // Load configuration for other open documents which have - // same module type - uno::Sequence< uno::Reference< frame::XFrame > > aFrameList; - try - { - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.Desktop" ) ) ), - uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XFrames > xFrames = - xFramesSupplier->getFrames(); - - aFrameList = xFrames->queryFrames( - frame::FrameSearchFlag::ALL & ~frame::FrameSearchFlag::SELF ); - - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - for ( sal_Int32 i = 0; i < aFrameList.getLength(); ++i ) - { - SaveInData* pData = NULL; - uno::Reference < frame::XFrame > xf = aFrameList[i]; - - if ( xf.is() && xf != m_xFrame ) - { - OUString aCheckId; - try{ - aCheckId = xModuleManager->identify( xf ); - } catch(const uno::Exception&) - { aCheckId = ::rtl::OUString(); } - - if ( aModuleId.equals( aCheckId ) ) - { - // try to get the document based ui configuration manager - OUString aTitle2; - uno::Reference< frame::XController > xController_ = - xf->getController(); - - if ( xController_.is() ) - { - uno::Reference< frame::XModel > xModel( - xController_->getModel() ); - - if ( xModel.is() ) - { - uno::Reference< - css::ui::XUIConfigurationManagerSupplier > - xCfgSupplier( xModel, uno::UNO_QUERY ); - - if ( xCfgSupplier.is() ) - { - xDocCfgMgr = - xCfgSupplier->getUIConfigurationManager(); - } - aTitle2 = ::comphelper::DocumentInfo::getDocumentTitle( xModel ); - } - } - - if ( xDocCfgMgr.is() ) - { - pData = CreateSaveInData( xDocCfgMgr, xCfgMgr, aModuleId, sal_True ); - - if ( pData && !pData->IsReadOnly() ) - { - nPos = aSaveInListBox.InsertEntry( aTitle2 ); - aSaveInListBox.SetEntryData( nPos, pData ); - } - } - } - } - } - } - - aSaveInListBox.SetSelectHdl( - LINK( this, SvxConfigPage, SelectSaveInLocation ) ); - - bInitialised = sal_True; - - Init(); - } - else - { - if ( QueryReset() == RET_YES ) - { - // Reset menu configuration for currently selected SaveInData - GetSaveInData()->Reset(); - - Init(); - } - } -} - -::rtl::OUString SvxConfigPage::GetFrameWithDefaultAndIdentify( uno::Reference< frame::XFrame >& _inout_rxFrame ) -{ - ::rtl::OUString sModuleID; - try - { - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.Desktop" ) ) ), - uno::UNO_QUERY_THROW ); - - if ( !_inout_rxFrame.is() ) - _inout_rxFrame = xFramesSupplier->getActiveFrame(); - - if ( !_inout_rxFrame.is() ) - { - uno::Reference< frame::XDesktop > xDesktop( xFramesSupplier, uno::UNO_QUERY_THROW ); - _inout_rxFrame = xDesktop->getCurrentFrame(); - } - - if ( !_inout_rxFrame.is() && SfxViewFrame::Current() ) - _inout_rxFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); - - if ( !_inout_rxFrame.is() ) - { - DBG_ERRORFILE( "SvxConfigPage::GetFrameWithDefaultAndIdentify(): no frame found!" ); - return sModuleID; - } - - uno::Reference< css::frame::XModuleManager > xModuleManager( - xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ) ) ), - uno::UNO_QUERY_THROW ); - - try - { - sModuleID = xModuleManager->identify( _inout_rxFrame ); - } - catch ( const frame::UnknownModuleException& ) - { - } - - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return sModuleID; -} - -sal_Bool SvxConfigPage::FillItemSet( SfxItemSet& ) -{ - bool result = sal_False; - - for ( sal_uInt16 i = 0 ; i < aSaveInListBox.GetEntryCount(); ++i ) - { - SaveInData* pData = - (SaveInData*) aSaveInListBox.GetEntryData( i ); - - result = pData->Apply(); - } - return result; -} - -void SvxConfigPage::PositionContentsListBox() -{ - if ( aContentsListBox == NULL ) - { - return; - } - - Point p, newp; - Size s, news; - long x, y, width, height; - - // x and width is same as aTopLevelListBox - x = aTopLevelListBox.GetPosPixel().X(); - width = aTopLevelListBox.GetSizePixel().Width(); - - // y is same as aAddCommandsButton - y = aAddCommandsButton.GetPosPixel().Y(); - - // get gap between aAddCommandsButton and aContentsSeparator - p = aContentsSeparator.GetPosPixel(); - s = aContentsSeparator.GetSizePixel(); - long gap = y - ( p.Y() + s.Height() ); - - height = aSaveInListBox.GetPosPixel().Y() - y - gap; - - aContentsListBox->SetPosPixel( Point( x, y ) ); - aContentsListBox->SetSizePixel( Size( width, height ) ); -} - -IMPL_LINK( SvxConfigPage, SelectSaveInLocation, ListBox *, pBox ) -{ - (void)pBox; - - pCurrentSaveInData = (SaveInData*) aSaveInListBox.GetEntryData( - aSaveInListBox.GetSelectEntryPos()); - - Init(); - return 1; -} - -void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry* pToSelect ) -{ - sal_uInt16 nSelectionPos = aTopLevelListBox.GetSelectEntryPos(); - aTopLevelListBox.Clear(); - - if ( GetSaveInData() && GetSaveInData()->GetEntries() ) - { - SvxEntries::const_iterator iter = GetSaveInData()->GetEntries()->begin(); - SvxEntries::const_iterator end = GetSaveInData()->GetEntries()->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntryData = *iter; - sal_uInt16 nPos = aTopLevelListBox.InsertEntry( stripHotKey( pEntryData->GetName() ) ); - aTopLevelListBox.SetEntryData( nPos, pEntryData ); - - if ( pEntryData == pToSelect ) - nSelectionPos = nPos; - - AddSubMenusToUI( stripHotKey( pEntryData->GetName() ), pEntryData ); - } - } -#ifdef DBG_UTIL - else - { - DBG_ASSERT( GetSaveInData(), "SvxConfigPage::ReloadTopLevelListBox(): no SaveInData" ); - DBG_ASSERT( GetSaveInData()->GetEntries() , - "SvxConfigPage::ReloadTopLevelListBox(): no SaveInData entries" ); - } -#endif - - nSelectionPos = nSelectionPos < aTopLevelListBox.GetEntryCount() ? - nSelectionPos : aTopLevelListBox.GetEntryCount() - 1; - - aTopLevelListBox.SelectEntryPos( nSelectionPos, sal_True ); - aTopLevelListBox.GetSelectHdl().Call( this ); -} - -void SvxConfigPage::AddSubMenusToUI( - const String& rBaseTitle, SvxConfigEntry* pParentData ) -{ - SvxEntries::const_iterator iter = pParentData->GetEntries()->begin(); - SvxEntries::const_iterator end = pParentData->GetEntries()->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntryData = *iter; - - if ( pEntryData->IsPopup() ) - { - OUString subMenuTitle( rBaseTitle ); - subMenuTitle += OUString::createFromAscii( pMenuSeparatorStr ); - subMenuTitle += stripHotKey( pEntryData->GetName() ); - - sal_uInt16 nPos = aTopLevelListBox.InsertEntry( subMenuTitle ); - aTopLevelListBox.SetEntryData( nPos, pEntryData ); - - AddSubMenusToUI( subMenuTitle, pEntryData ); - } - } -} - -SvxEntries* SvxConfigPage::FindParentForChild( - SvxEntries* pRootEntries, SvxConfigEntry* pChildData ) -{ - SvxEntries::const_iterator iter = pRootEntries->begin(); - SvxEntries::const_iterator end = pRootEntries->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntryData = *iter; - - if ( pEntryData == pChildData ) - { - return pRootEntries; - } - else if ( pEntryData->IsPopup() ) - { - SvxEntries* result = - FindParentForChild( pEntryData->GetEntries(), pChildData ); - - if ( result != NULL ) - { - return result; - } - } - } - return NULL; -} - -SvLBoxEntry* SvxConfigPage::AddFunction( - SvLBoxEntry* pTarget, bool bFront, bool bAllowDuplicates ) -{ - String aDisplayName = pSelectorDlg->GetSelectedDisplayName(); - String aHelpText = pSelectorDlg->GetSelectedHelpText(); - String aURL = pSelectorDlg->GetScriptURL(); - - if ( !aURL.Len() ) - { - return NULL; - } - - SvxConfigEntry* pNewEntryData = - new SvxConfigEntry( aDisplayName, aURL, sal_False ); - pNewEntryData->SetUserDefined( sal_True ); - - // check that this function is not already in the menu - SvxConfigEntry* pParent = GetTopLevelSelection(); - - SvxEntries::const_iterator iter = pParent->GetEntries()->begin(); - SvxEntries::const_iterator end = pParent->GetEntries()->end(); - - if ( !bAllowDuplicates ) - { - while ( iter != end ) - { - SvxConfigEntry *pCurEntry = *iter; - - if ( pCurEntry->GetCommand() == pNewEntryData->GetCommand() ) - { - // asynchronous error message, because of MsgBoxes - PostUserEvent( - LINK( this, SvxConfigPage, AsyncInfoMsg ) ); - return NULL; - } - - ++iter; - } - } - - return InsertEntry( pNewEntryData, pTarget, bFront ); -} - -SvLBoxEntry* SvxConfigPage::InsertEntry( - SvxConfigEntry* pNewEntryData, - SvLBoxEntry* pTarget, - bool bFront ) -{ - // Grab the entries list for the currently selected menu - SvxEntries* pEntries = GetTopLevelSelection()->GetEntries(); - - SvLBoxEntry* pNewEntry = NULL; - SvLBoxEntry* pCurEntry = - pTarget != NULL ? pTarget : aContentsListBox->GetCurEntry(); - - if ( bFront ) - { - pEntries->insert( pEntries->begin(), pNewEntryData ); - pNewEntry = InsertEntryIntoUI( pNewEntryData, 0 ); - } - else if ( pCurEntry == NULL || pCurEntry == aContentsListBox->Last() ) - { - pEntries->push_back( pNewEntryData ); - pNewEntry = InsertEntryIntoUI( pNewEntryData ); - } - else - { - SvxConfigEntry* pEntryData = - (SvxConfigEntry*) pCurEntry->GetUserData(); - - SvxEntries::iterator iter = pEntries->begin(); - SvxEntries::const_iterator end = pEntries->end(); - - // Advance the iterator to the data for currently selected entry - sal_uInt16 nPos = 0; - while (*iter != pEntryData && ++iter != end) - { - ++nPos; - } - - // Now step past it to the entry after the currently selected one - ++iter; - ++nPos; - - // Now add the new entry to the UI and to the parent's list - if ( iter != end ) - { - pEntries->insert( iter, pNewEntryData ); - pNewEntry = InsertEntryIntoUI( pNewEntryData, nPos ); - } - } - - if ( pNewEntry != NULL ) - { - aContentsListBox->Select( pNewEntry ); - aContentsListBox->MakeVisible( pNewEntry ); - - GetSaveInData()->SetModified( sal_True ); - } - - return pNewEntry; -} - -SvLBoxEntry* SvxConfigPage::InsertEntryIntoUI( - SvxConfigEntry* pNewEntryData, sal_uLong nPos ) -{ - SvLBoxEntry* pNewEntry = NULL; - - if (pNewEntryData->IsSeparator()) - { - pNewEntry = aContentsListBox->InsertEntry( - String::CreateFromAscii( pSeparatorStr ), - 0, sal_False, nPos, pNewEntryData ); - } - else - { - OUString aName = stripHotKey( pNewEntryData->GetName() ); - - Image aImage = GetSaveInData()->GetImage( - pNewEntryData->GetCommand()); - - if ( !!aImage ) - { - pNewEntry = aContentsListBox->InsertEntry( - aName, aImage, aImage, 0, sal_False, nPos, pNewEntryData ); - } - else - { - pNewEntry = aContentsListBox->InsertEntry( - aName, 0, sal_False, nPos, pNewEntryData ); - } - - if ( pNewEntryData->IsPopup() || - pNewEntryData->GetStyle() & css::ui::ItemStyle::DROP_DOWN ) - { - // add new popup painter, it gets destructed by the entry - pNewEntry->ReplaceItem( - new PopupPainter( pNewEntry, aName ), - pNewEntry->ItemCount() - 1 ); - } - } - - return pNewEntry; -} - -IMPL_LINK( SvxConfigPage, AsyncInfoMsg, String*, pMsg ) -{ - (void)pMsg; - - // Asynchronous msg because of D&D - InfoBox( this, CUI_RES( - IBX_MNUCFG_ALREADY_INCLUDED ) ).Execute(); - - return 0; -} - -IMPL_LINK( SvxConfigPage, MoveHdl, Button *, pButton ) -{ - MoveEntry( pButton == &aMoveUpButton ); - return 0; -} - -void SvxConfigPage::MoveEntry( bool bMoveUp ) -{ - SvLBoxEntry *pSourceEntry = aContentsListBox->FirstSelected(); - SvLBoxEntry *pTargetEntry = NULL; - SvLBoxEntry *pToSelect = NULL; - - if ( !pSourceEntry ) - { - return; - } - - if ( bMoveUp ) - { - // Move Up is just a Move Down with the source and target reversed - pTargetEntry = pSourceEntry; - pSourceEntry = aContentsListBox->PrevSibling( pTargetEntry ); - pToSelect = pTargetEntry; - } - else - { - pTargetEntry = aContentsListBox->NextSibling( pSourceEntry ); - pToSelect = pSourceEntry; - } - - if ( MoveEntryData( pSourceEntry, pTargetEntry ) ) - { - aContentsListBox->GetModel()->Move( pSourceEntry, pTargetEntry ); - aContentsListBox->Select( pToSelect ); - aContentsListBox->MakeVisible( pToSelect ); - - UpdateButtonStates(); - } -} - -bool SvxConfigPage::MoveEntryData( - SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry ) -{ - //modified by shizhoubo for issue53677 - if ( NULL == pSourceEntry || NULL == pTargetEntry ) - { - return sal_False; - } - - // Grab the entries list for the currently selected menu - SvxEntries* pEntries = GetTopLevelSelection()->GetEntries(); - - SvxConfigEntry* pSourceData = - (SvxConfigEntry*) pSourceEntry->GetUserData(); - - if ( pTargetEntry == NULL ) - { - RemoveEntry( pEntries, pSourceData ); - pEntries->insert( - pEntries->begin(), pSourceData ); - - GetSaveInData()->SetModified( sal_True ); - - return sal_True; - } - else - { - SvxConfigEntry* pTargetData = - (SvxConfigEntry*) pTargetEntry->GetUserData(); - - if ( pSourceData != NULL && pTargetData != NULL ) - { - // remove the source entry from our list - RemoveEntry( pEntries, pSourceData ); - - SvxEntries::iterator iter = pEntries->begin(); - SvxEntries::const_iterator end = pEntries->end(); - - // advance the iterator to the position of the target entry - while (*iter != pTargetData && ++iter != end) ; - - // insert the source entry at the position after the target - pEntries->insert( ++iter, pSourceData ); - - GetSaveInData()->SetModified( sal_True ); - - return sal_True; - } - } - - return sal_False; -} - -SvxMenuConfigPage::SvxMenuConfigPage( - Window *pParent, const SfxItemSet& rSet ) - : - SvxConfigPage( pParent, rSet ) -{ - aContentsListBox = new SvxMenuEntriesListBox( this, CUI_RES( BOX_ENTRIES ) ); - FreeResource(); - - PositionContentsListBox(); - aContentsListBox->SetZOrder( &aAddCommandsButton, WINDOW_ZORDER_BEFOR ); - - aTopLevelListBox.SetSelectHdl( - LINK( this, SvxMenuConfigPage, SelectMenu ) ); - - aContentsListBox->SetSelectHdl( - LINK( this, SvxMenuConfigPage, SelectMenuEntry ) ); - - aMoveUpButton.SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) ); - aMoveDownButton.SetClickHdl ( LINK( this, SvxConfigPage, MoveHdl) ); - - aNewTopLevelButton.SetClickHdl ( - LINK( this, SvxMenuConfigPage, NewMenuHdl ) ); - - aAddCommandsButton.SetClickHdl ( - LINK( this, SvxMenuConfigPage, AddCommandsHdl ) ); - - PopupMenu* pMenu = new PopupMenu( CUI_RES( MODIFY_MENU ) ); - pMenu->SetMenuFlags( - pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); - - aModifyTopLevelButton.SetPopupMenu( pMenu ); - aModifyTopLevelButton.SetSelectHdl( - LINK( this, SvxMenuConfigPage, MenuSelectHdl ) ); - - PopupMenu* pEntry = new PopupMenu( CUI_RES( MODIFY_ENTRY ) ); - pEntry->SetMenuFlags( - pEntry->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); - - aModifyCommandButton.SetPopupMenu( pEntry ); - aModifyCommandButton.SetSelectHdl( - LINK( this, SvxMenuConfigPage, EntrySelectHdl ) ); -} - -// Populates the Menu combo box -void SvxMenuConfigPage::Init() -{ - // ensure that the UI is cleared before populating it - aTopLevelListBox.Clear(); - aContentsListBox->Clear(); - - ReloadTopLevelListBox(); - - aTopLevelListBox.SelectEntryPos(0, sal_True); - aTopLevelListBox.GetSelectHdl().Call(this); -} - -SvxMenuConfigPage::~SvxMenuConfigPage() -{ - for ( sal_uInt16 i = 0 ; i < aSaveInListBox.GetEntryCount(); ++i ) - { - MenuSaveInData* pData = - (MenuSaveInData*) aSaveInListBox.GetEntryData( i ); - - delete pData; - } - - if ( pSelectorDlg != NULL ) - { - delete pSelectorDlg; - } - - delete aContentsListBox; -} - -IMPL_LINK( SvxMenuConfigPage, SelectMenuEntry, Control *, pBox ) -{ - (void)pBox; - - UpdateButtonStates(); - - return 1; -} - -void SvxMenuConfigPage::UpdateButtonStates() -{ - PopupMenu* pPopup = aModifyCommandButton.GetPopupMenu(); - - // Disable Up and Down buttons depending on current selection - SvLBoxEntry* selection = aContentsListBox->GetCurEntry(); - - if ( aContentsListBox->GetEntryCount() == 0 || selection == NULL ) - { - aMoveUpButton.Enable( sal_False ); - aMoveDownButton.Enable( sal_False ); - - pPopup->EnableItem( ID_BEGIN_GROUP, sal_True ); - pPopup->EnableItem( ID_RENAME, sal_False ); - pPopup->EnableItem( ID_DELETE, sal_False ); - - aDescriptionField.Clear(); - - return; - } - - SvLBoxEntry* first = aContentsListBox->First(); - SvLBoxEntry* last = aContentsListBox->Last(); - - aMoveUpButton.Enable( selection != first ); - aMoveDownButton.Enable( selection != last ); - - SvxConfigEntry* pEntryData = - (SvxConfigEntry*) selection->GetUserData(); - - if ( pEntryData->IsSeparator() ) - { - pPopup->EnableItem( ID_DELETE, sal_True ); - pPopup->EnableItem( ID_BEGIN_GROUP, sal_False ); - pPopup->EnableItem( ID_RENAME, sal_False ); - - aDescriptionField.Clear(); - } - else - { - pPopup->EnableItem( ID_BEGIN_GROUP, sal_True ); - pPopup->EnableItem( ID_DELETE, sal_True ); - pPopup->EnableItem( ID_RENAME, sal_True ); - - aDescriptionField.SetNewText( pEntryData->GetHelpText() ); - } -} - -void SvxMenuConfigPage::DeleteSelectedTopLevel() -{ - SvxConfigEntry* pMenuData = GetTopLevelSelection(); - - SvxEntries* pParentEntries = - FindParentForChild( GetSaveInData()->GetEntries(), pMenuData ); - - RemoveEntry( pParentEntries, pMenuData ); - delete pMenuData; - - ReloadTopLevelListBox(); - - GetSaveInData()->SetModified( sal_True ); -} - -bool SvxMenuConfigPage::DeleteSelectedContent() -{ - SvLBoxEntry *pActEntry = aContentsListBox->FirstSelected(); - - if ( pActEntry != NULL ) - { - // get currently selected menu entry - SvxConfigEntry* pMenuEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - // get currently selected menu - SvxConfigEntry* pMenu = GetTopLevelSelection(); - - // remove menu entry from the list for this menu - RemoveEntry( pMenu->GetEntries(), pMenuEntry ); - - // remove menu entry from UI - aContentsListBox->GetModel()->Remove( pActEntry ); - - // if this is a submenu entry, redraw the menus list box - if ( pMenuEntry->IsPopup() ) - { - ReloadTopLevelListBox(); - } - - // delete data for menu entry - delete pMenuEntry; - - GetSaveInData()->SetModified( sal_True ); - - return sal_True; - } - return sal_False; -} - -short SvxMenuConfigPage::QueryReset() -{ - String msg = - String( CUI_RES( RID_SVXSTR_CONFIRM_MENU_RESET ) ); - - String saveInName = aSaveInListBox.GetEntry( - aSaveInListBox.GetSelectEntryPos() ); - - OUString label = replaceSaveInName( msg, saveInName ); - - QueryBox qbox( this, WB_YES_NO, label ); - - return qbox.Execute(); -} - -IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox ) -{ - (void)pBox; - - aContentsListBox->Clear(); - - SvxConfigEntry* pMenuData = GetTopLevelSelection(); - - PopupMenu* pPopup = aModifyTopLevelButton.GetPopupMenu(); - if ( pMenuData ) - { - pPopup->EnableItem( ID_DELETE, pMenuData->IsDeletable() ); - pPopup->EnableItem( ID_RENAME, pMenuData->IsRenamable() ); - pPopup->EnableItem( ID_MOVE, pMenuData->IsMovable() ); - - SvxEntries* pEntries = pMenuData->GetEntries(); - SvxEntries::const_iterator iter = pEntries->begin(); - - for ( ; iter != pEntries->end(); ++iter ) - { - SvxConfigEntry* pEntry = *iter; - InsertEntryIntoUI( pEntry ); - } - } - - UpdateButtonStates(); - - return 0; -} - -IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton ) -{ - switch( pButton->GetCurItemId() ) - { - case ID_DELETE: - { - DeleteSelectedTopLevel(); - break; - } - case ID_RENAME: - { - SvxConfigEntry* pMenuData = GetTopLevelSelection(); - - String aNewName( stripHotKey( pMenuData->GetName() ) ); - String aDesc = CUI_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME ); - - SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) ); - - bool ret = pNameDialog->Execute(); - - if ( ret == RET_OK ) { - pNameDialog->GetName( aNewName ); - pMenuData->SetName( aNewName ); - - ReloadTopLevelListBox(); - - GetSaveInData()->SetModified( sal_True ); - } - - // #i68101# Memory leak (!) - delete pNameDialog; - - break; - } - case ID_MOVE: - { - SvxConfigEntry* pMenuData = GetTopLevelSelection(); - - SvxMainMenuOrganizerDialog* pDialog = - new SvxMainMenuOrganizerDialog( this, - GetSaveInData()->GetEntries(), pMenuData ); - - bool ret = pDialog->Execute(); - - if ( ret == RET_OK ) - { - GetSaveInData()->SetEntries( pDialog->GetEntries() ); - - ReloadTopLevelListBox( pDialog->GetSelectedEntry() ); - - GetSaveInData()->SetModified( sal_True ); - } - - delete pDialog; - - break; - } - default: - return sal_False; - } - return sal_True; -} - -IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton ) -{ - switch( pButton->GetCurItemId() ) - { - case ID_ADD_SUBMENU: - { - String aNewName; - String aDesc = CUI_RESSSTR( RID_SVXSTR_SUBMENU_NAME ); - - SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) ); - - bool ret = pNameDialog->Execute(); - - if ( ret == RET_OK ) { - pNameDialog->GetName(aNewName); - - SvxConfigEntry* pNewEntryData = - new SvxConfigEntry( aNewName, aNewName, sal_True ); - pNewEntryData->SetUserDefined( sal_True ); - - InsertEntry( pNewEntryData ); - - ReloadTopLevelListBox(); - - GetSaveInData()->SetModified( sal_True ); - } - - delete pNameDialog; - - break; - } - case ID_BEGIN_GROUP: - { - SvxConfigEntry* pNewEntryData = new SvxConfigEntry; - pNewEntryData->SetUserDefined( sal_True ); - InsertEntry( pNewEntryData ); - - break; - } - case ID_DELETE: - { - DeleteSelectedContent(); - break; - } - case ID_RENAME: - { - SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry(); - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - String aNewName( stripHotKey( pEntry->GetName() ) ); - String aDesc = CUI_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME ); - - SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_MENU_ITEM ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_MENU ) ); - - bool ret = pNameDialog->Execute(); - - if ( ret == RET_OK ) { - pNameDialog->GetName(aNewName); - - pEntry->SetName( aNewName ); - aContentsListBox->SetEntryText( pActEntry, aNewName ); - - GetSaveInData()->SetModified( sal_True ); - } - - delete pNameDialog; - - break; - } - default: - { - return sal_False; - } - } - - if ( GetSaveInData()->IsModified() ) - { - UpdateButtonStates(); - } - - return sal_True; -} - -IMPL_LINK( SvxMenuConfigPage, AddFunctionHdl, - SvxScriptSelectorDialog *, pDialog ) -{ - (void)pDialog; - - AddFunction(); - - return 0; -} - -IMPL_LINK( SvxMenuConfigPage, NewMenuHdl, Button *, pButton ) -{ - (void)pButton; - - SvxMainMenuOrganizerDialog* pDialog = - new SvxMainMenuOrganizerDialog( 0, - GetSaveInData()->GetEntries(), NULL, sal_True ); - - bool ret = pDialog->Execute(); - - if ( ret == RET_OK ) - { - GetSaveInData()->SetEntries( pDialog->GetEntries() ); - ReloadTopLevelListBox( pDialog->GetSelectedEntry() ); - GetSaveInData()->SetModified( sal_True ); - } - - delete pDialog; - - return 0; -} - -IMPL_LINK( SvxMenuConfigPage, AddCommandsHdl, Button *, pButton ) -{ - (void)pButton; - - if ( pSelectorDlg == NULL ) - { - // Create Script Selector which also shows builtin commands - pSelectorDlg = new SvxScriptSelectorDialog( this, sal_True, m_xFrame ); - - pSelectorDlg->SetAddHdl( - LINK( this, SvxMenuConfigPage, AddFunctionHdl ) ); - - pSelectorDlg->SetDialogDescription( String( - CUI_RES( RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION ) ) ); - } - - // Position the Script Selector over the Add button so it is - // beside the menu contents list and does not obscure it - pSelectorDlg->SetPosPixel( aAddCommandsButton.GetPosPixel() ); - - pSelectorDlg->SetImageProvider( - static_cast< ImageProvider* >( GetSaveInData() ) ); - - pSelectorDlg->Show(); - return 1; -} - -SaveInData* SvxMenuConfigPage::CreateSaveInData( - const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr, - const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr, - const OUString& aModuleId, - bool bDocConfig ) -{ - return static_cast< SaveInData* >( - new MenuSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig )); -} - -SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog( - Window* pParent, SvxEntries* entries, - SvxConfigEntry* selection, bool bCreateMenu ) - : - ModalDialog( pParent, CUI_RES( MD_MENU_ORGANISER ) ), - aMenuNameText( this, CUI_RES( TXT_MENU_NAME ) ), - aMenuNameEdit( this, CUI_RES( EDIT_MENU_NAME ) ), - aMenuListText( this, CUI_RES( TXT_MENU ) ), - aMenuListBox( this, CUI_RES( BOX_MAIN_MENUS ) ), - aMoveUpButton( this, CUI_RES( BTN_MENU_UP ) ), - aMoveDownButton( this, CUI_RES( BTN_MENU_DOWN ) ), - aOKButton( this, CUI_RES( BTN_MENU_ADD ) ), - aCloseButton( this, CUI_RES( BTN_MENU_CLOSE ) ), - aHelpButton( this, CUI_RES( BTN_MENU_HELP ) ), - bModified( sal_False ) -{ - FreeResource(); - - // Copy the entries list passed in - if ( entries != NULL ) - { - SvxConfigEntry* pEntry; - SvLBoxEntry* pLBEntry; - - pEntries = new SvxEntries(); - SvxEntries::const_iterator iter = entries->begin(); - - while ( iter != entries->end() ) - { - pEntry = *iter; - pLBEntry = - aMenuListBox.InsertEntry( stripHotKey( pEntry->GetName() ) ); - pLBEntry->SetUserData( pEntry ); - pEntries->push_back( pEntry ); - - if ( pEntry == selection ) - { - aMenuListBox.Select( pLBEntry ); - } - ++iter; - } - } - - if ( bCreateMenu ) - { - // Generate custom name for new menu - String prefix = - String( CUI_RES( RID_SVXSTR_NEW_MENU ) ); - - OUString newname = generateCustomName( prefix, entries ); - OUString newurl = generateCustomMenuURL( pEntries ); - - SvxConfigEntry* pNewEntryData = - new SvxConfigEntry( newname, newurl, sal_True ); - pNewEntryData->SetUserDefined( sal_True ); - pNewEntryData->SetMain( sal_True ); - - pNewMenuEntry = - aMenuListBox.InsertEntry( stripHotKey( pNewEntryData->GetName() ) ); - aMenuListBox.Select( pNewMenuEntry ); - - pNewMenuEntry->SetUserData( pNewEntryData ); - - pEntries->push_back( pNewEntryData ); - - aMenuNameEdit.SetText( newname ); - aMenuNameEdit.SetModifyHdl( - LINK( this, SvxMainMenuOrganizerDialog, ModifyHdl ) ); - } - else - { - Point p, newp; - Size s, news; - - // get offset to bottom of name textfield from top of dialog - p = aMenuNameEdit.GetPosPixel(); - s = aMenuNameEdit.GetSizePixel(); - long offset = p.Y() + s.Height(); - - // reposition menu list and label - aMenuListText.SetPosPixel( aMenuNameText.GetPosPixel() ); - aMenuListBox.SetPosPixel( aMenuNameEdit.GetPosPixel() ); - - // reposition up and down buttons - p = aMoveUpButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - offset ); - aMoveUpButton.SetPosPixel( newp ); - - p = aMoveDownButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - offset ); - aMoveDownButton.SetPosPixel( newp ); - - // change size of dialog - s = GetSizePixel(); - news = Size( s.Width(), s.Height() - offset ); - SetSizePixel( news ); - - // hide name label and textfield - aMenuNameText.Hide(); - aMenuNameEdit.Hide(); - - // change the title - SetText( CUI_RES( RID_SVXSTR_MOVE_MENU ) ); - } - - aMenuListBox.SetSelectHdl( - LINK( this, SvxMainMenuOrganizerDialog, SelectHdl ) ); - - aMoveUpButton.SetClickHdl ( - LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) ); - aMoveDownButton.SetClickHdl ( - LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) ); - - aMoveUpButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_UP))); - aMoveDownButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_DOWN))); -} - -IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit) -{ - (void)pEdit; - - // if the Edit control is empty do not change the name - if ( aMenuNameEdit.GetText().Equals( String() ) ) - { - return 0; - } - - SvxConfigEntry* pNewEntryData = - (SvxConfigEntry*) pNewMenuEntry->GetUserData(); - - pNewEntryData->SetName( aMenuNameEdit.GetText() ); - - aMenuListBox.SetEntryText( pNewMenuEntry, pNewEntryData->GetName() ); - - return 0; -} - -SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog() -{ -} - -IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl ) -{ - (void)pCtrl; - UpdateButtonStates(); - return 1; -} - -void SvxMainMenuOrganizerDialog::UpdateButtonStates() -{ - // Disable Up and Down buttons depending on current selection - SvLBoxEntry* selection = aMenuListBox.GetCurEntry(); - SvLBoxEntry* first = aMenuListBox.First(); - SvLBoxEntry* last = aMenuListBox.Last(); - - aMoveUpButton.Enable( selection != first ); - aMoveDownButton.Enable( selection != last ); -} - -IMPL_LINK( SvxMainMenuOrganizerDialog, MoveHdl, Button *, pButton ) -{ - SvLBoxEntry *pSourceEntry = aMenuListBox.FirstSelected(); - SvLBoxEntry *pTargetEntry = NULL; - - if ( !pSourceEntry ) - { - return 0; - } - - if ( pButton == &aMoveDownButton ) - { - pTargetEntry = aMenuListBox.NextSibling( pSourceEntry ); - } - else if ( pButton == &aMoveUpButton ) - { - // Move Up is just a Move Down with the source and target reversed - pTargetEntry = pSourceEntry; - pSourceEntry = aMenuListBox.PrevSibling( pTargetEntry ); - } - - if ( pSourceEntry != NULL && pTargetEntry != NULL ) - { - SvxConfigEntry* pSourceData = - (SvxConfigEntry*) pSourceEntry->GetUserData(); - SvxConfigEntry* pTargetData = - (SvxConfigEntry*) pTargetEntry->GetUserData(); - - SvxEntries::iterator iter1 = GetEntries()->begin(); - SvxEntries::iterator iter2 = GetEntries()->begin(); - SvxEntries::const_iterator end = GetEntries()->end(); - - // Advance the iterators to the positions of the source and target - while (*iter1 != pSourceData && ++iter1 != end) ; - while (*iter2 != pTargetData && ++iter2 != end) ; - - // Now swap the entries in the menu list and in the UI - if ( iter1 != end && iter2 != end ) - { - std::swap( *iter1, *iter2 ); - aMenuListBox.GetModel()->Move( pSourceEntry, pTargetEntry ); - aMenuListBox.MakeVisible( pSourceEntry ); - - bModified = sal_True; - } - } - - if ( bModified ) - { - UpdateButtonStates(); - } - - return 0; -} - -SvxEntries* SvxMainMenuOrganizerDialog::GetEntries() -{ - return pEntries; -} - -SvxConfigEntry* SvxMainMenuOrganizerDialog::GetSelectedEntry() -{ - return (SvxConfigEntry*)aMenuListBox.FirstSelected()->GetUserData(); -} - -const OUString& -SvxConfigEntry::GetHelpText() -{ - if ( aHelpText.getLength() == 0 ) - { - if ( aCommand.getLength() ) - { - aHelpText = Application::GetHelp()->GetHelpText( aCommand, NULL ); - } - } - - return aHelpText; -} - -SvxConfigEntry::SvxConfigEntry( const OUString& rDisplayName, - const OUString& rCommandURL, bool bPopup, bool bParentData ) - : nId( 1 ) - , aLabel(rDisplayName) - , aCommand(rCommandURL) - , bPopUp(bPopup) - , bStrEdited( sal_False ) - , bIsUserDefined( sal_False ) - , bIsMain( sal_False ) - , bIsParentData( bParentData ) - , bIsVisible( sal_True ) - , nStyle( 0 ) - , pEntries( 0 ) -{ - if (bPopUp) - { - pEntries = new SvxEntries(); - } -} - -SvxConfigEntry::~SvxConfigEntry() -{ - if ( pEntries != NULL ) - { - SvxEntries::const_iterator iter = pEntries->begin(); - - for ( ; iter != pEntries->end(); ++iter ) - { - delete *iter; - } - delete pEntries; - } -} - -bool SvxConfigEntry::IsMovable() -{ - if ( IsPopup() && !IsMain() ) - { - return sal_False; - } - return sal_True; -} - -bool SvxConfigEntry::IsDeletable() -{ - if ( IsMain() && !IsUserDefined() ) - { - return sal_False; - } - return sal_True; -} - -bool SvxConfigEntry::IsRenamable() -{ - if ( IsMain() && !IsUserDefined() ) - { - return sal_False; - } - return sal_True; -} - -SvxToolbarConfigPage::SvxToolbarConfigPage( - Window *pParent, const SfxItemSet& rSet ) - : - SvxConfigPage( pParent, rSet ) -{ - SetHelpId( HID_SVX_CONFIG_TOOLBAR ); - - aContentsListBox = new SvxToolbarEntriesListBox(this, CUI_RES(BOX_ENTRIES)); - FreeResource(); - PositionContentsListBox(); - aContentsListBox->SetZOrder( &aAddCommandsButton, WINDOW_ZORDER_BEFOR ); - - aContentsListBox->SetHelpId( HID_SVX_CONFIG_TOOLBAR_CONTENTS ); - aNewTopLevelButton.SetHelpId( HID_SVX_NEW_TOOLBAR ); - aModifyTopLevelButton.SetHelpId( HID_SVX_MODIFY_TOOLBAR ); - aAddCommandsButton.SetHelpId( HID_SVX_NEW_TOOLBAR_ITEM ); - aModifyCommandButton.SetHelpId( HID_SVX_MODIFY_TOOLBAR_ITEM ); - aSaveInListBox.SetHelpId( HID_SVX_SAVE_IN ); - - aTopLevelSeparator.SetText( - CUI_RES ( RID_SVXSTR_PRODUCTNAME_TOOLBARS ) ); - - aTopLevelLabel.SetText( CUI_RES( RID_SVXSTR_TOOLBAR ) ); - aModifyTopLevelButton.SetText( CUI_RES( RID_SVXSTR_TOOLBAR ) ); - aContentsSeparator.SetText( CUI_RES( RID_SVXSTR_TOOLBAR_CONTENT ) ); - aContentsLabel.SetText( CUI_RES( RID_SVXSTR_COMMANDS ) ); - - aTopLevelListBox.SetSelectHdl( - LINK( this, SvxToolbarConfigPage, SelectToolbar ) ); - aContentsListBox->SetSelectHdl( - LINK( this, SvxToolbarConfigPage, SelectToolbarEntry ) ); - - aNewTopLevelButton.SetClickHdl ( - LINK( this, SvxToolbarConfigPage, NewToolbarHdl ) ); - - aAddCommandsButton.SetClickHdl ( - LINK( this, SvxToolbarConfigPage, AddCommandsHdl ) ); - - aMoveUpButton.SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) ); - aMoveDownButton.SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) ); - // Always enable Up and Down buttons - // added for issue i53677 by shizhoubo - aMoveDownButton.Enable( sal_True ); - aMoveUpButton.Enable( sal_True ); - - PopupMenu* pMenu = new PopupMenu( CUI_RES( MODIFY_TOOLBAR ) ); - pMenu->SetMenuFlags( - pMenu->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); - - aModifyTopLevelButton.SetPopupMenu( pMenu ); - aModifyTopLevelButton.SetSelectHdl( - LINK( this, SvxToolbarConfigPage, ToolbarSelectHdl ) ); - - PopupMenu* pEntry = new PopupMenu( - CUI_RES( MODIFY_TOOLBAR_CONTENT ) ); - pEntry->SetMenuFlags( - pEntry->GetMenuFlags() | MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES ); - - aModifyCommandButton.SetPopupMenu( pEntry ); - aModifyCommandButton.SetSelectHdl( - LINK( this, SvxToolbarConfigPage, EntrySelectHdl ) ); - - // default toolbar to select is standardbar unless a different one - // has been passed in - m_aURLToSelect = OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )); - m_aURLToSelect += OUString(RTL_CONSTASCII_USTRINGPARAM( "standardbar" )); - - const SfxPoolItem* pItem = - rSet.GetItem( rSet.GetPool()->GetWhich( SID_CONFIG ) ); - - if ( pItem ) - { - OUString text = ((const SfxStringItem*)pItem)->GetValue(); - if (text.indexOf(OUString(RTL_CONSTASCII_USTRINGPARAM(ITEM_TOOLBAR_URL))) == 0) - { - m_aURLToSelect = text.copy( 0 ); - } - } - - long nTxtW = aTopLevelLabel.GetCtrlTextWidth( aTopLevelLabel.GetText() ); - long nCtrlW = aTopLevelLabel.GetSizePixel().Width(); - if ( nTxtW >= nCtrlW ) - { - long nDelta = Max( (long)10, nTxtW - nCtrlW ); - Size aNewSz = aTopLevelLabel.GetSizePixel(); - aNewSz.Width() += nDelta; - aTopLevelLabel.SetSizePixel( aNewSz ); - aNewSz = aTopLevelListBox.GetSizePixel(); - aNewSz.Width() -= nDelta; - Point aNewPt = aTopLevelListBox.GetPosPixel(); - aNewPt.X() += nDelta; - aTopLevelListBox.SetPosSizePixel( aNewPt, aNewSz ); - } -} - -SvxToolbarConfigPage::~SvxToolbarConfigPage() -{ - for ( sal_uInt16 i = 0 ; i < aSaveInListBox.GetEntryCount(); ++i ) - { - ToolbarSaveInData* pData = - (ToolbarSaveInData*) aSaveInListBox.GetEntryData( i ); - - delete pData; - } - - if ( pSelectorDlg != NULL ) - { - delete pSelectorDlg; - } - - - delete aContentsListBox; -} - -void SvxToolbarConfigPage::DeleteSelectedTopLevel() -{ - sal_uInt16 nSelectionPos = aTopLevelListBox.GetSelectEntryPos(); - ToolbarSaveInData* pSaveInData = (ToolbarSaveInData*) GetSaveInData(); - pSaveInData->RemoveToolbar( GetTopLevelSelection() ); - - if ( aTopLevelListBox.GetEntryCount() > 1 ) - { - // select next entry after the one being deleted - // selection position is indexed from 0 so need to - // subtract one from the entry count - if ( nSelectionPos != aTopLevelListBox.GetEntryCount() - 1 ) - { - aTopLevelListBox.SelectEntryPos( nSelectionPos + 1, sal_True ); - } - else - { - aTopLevelListBox.SelectEntryPos( nSelectionPos - 1, sal_True ); - } - aTopLevelListBox.GetSelectHdl().Call( this ); - - // and now remove the entry - aTopLevelListBox.RemoveEntry( nSelectionPos ); - } - else - { - ReloadTopLevelListBox(); - } -} - -bool SvxToolbarConfigPage::DeleteSelectedContent() -{ - SvLBoxEntry *pActEntry = aContentsListBox->FirstSelected(); - - if ( pActEntry != NULL ) - { - // get currently selected entry - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - SvxConfigEntry* pToolbar = GetTopLevelSelection(); - - // remove entry from the list for this toolbar - RemoveEntry( pToolbar->GetEntries(), pEntry ); - - // remove toolbar entry from UI - aContentsListBox->GetModel()->Remove( pActEntry ); - - // delete data for toolbar entry - delete pEntry; - - (( ToolbarSaveInData* ) GetSaveInData())->ApplyToolbar( pToolbar ); - UpdateButtonStates(); - - // if this is the last entry in the toolbar and it is a user - // defined toolbar pop up a dialog asking the user if they - // want to delete the toolbar - if ( aContentsListBox->GetEntryCount() == 0 && - GetTopLevelSelection()->IsDeletable() ) - { - QueryBox qbox( this, - CUI_RES( QBX_CONFIRM_DELETE_TOOLBAR ) ); - - if ( qbox.Execute() == RET_YES ) - { - DeleteSelectedTopLevel(); - } - } - - return sal_True; - } - - return sal_False; -} - -IMPL_LINK( SvxToolbarConfigPage, MoveHdl, Button *, pButton ) -{ - MoveEntry( pButton == &aMoveUpButton ); - return 0; -} - -void SvxToolbarConfigPage::MoveEntry( bool bMoveUp ) -{ - SvxConfigPage::MoveEntry( bMoveUp ); - - // Apply change to currently selected toolbar - SvxConfigEntry* pToolbar = GetTopLevelSelection(); - if ( pToolbar ) - ((ToolbarSaveInData*)GetSaveInData())->ApplyToolbar( pToolbar ); - else - { - DBG_ERRORFILE( "SvxToolbarConfigPage::MoveEntry(): no entry" ); - UpdateButtonStates(); - } -} - -IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton ) -{ - sal_uInt16 nSelectionPos = aTopLevelListBox.GetSelectEntryPos(); - - SvxConfigEntry* pToolbar = - (SvxConfigEntry*)aTopLevelListBox.GetEntryData( nSelectionPos ); - - ToolbarSaveInData* pSaveInData = (ToolbarSaveInData*) GetSaveInData(); - - switch( pButton->GetCurItemId() ) - { - case ID_DELETE: - { - DeleteSelectedTopLevel(); - UpdateButtonStates(); - break; - } - case ID_RENAME: - { - String aNewName( stripHotKey( pToolbar->GetName() ) ); - String aDesc = CUI_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME ); - - SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) ); - - bool ret = pNameDialog->Execute(); - - if ( ret == RET_OK ) - { - pNameDialog->GetName(aNewName); - - pToolbar->SetName( aNewName ); - pSaveInData->ApplyToolbar( pToolbar ); - - // have to use remove and insert to change the name - aTopLevelListBox.RemoveEntry( nSelectionPos ); - nSelectionPos = - aTopLevelListBox.InsertEntry( aNewName, nSelectionPos ); - aTopLevelListBox.SetEntryData( nSelectionPos, pToolbar ); - aTopLevelListBox.SelectEntryPos( nSelectionPos ); - } - - delete pNameDialog; - - break; - } - case ID_DEFAULT_STYLE: - { - QueryBox qbox( this, - CUI_RES( QBX_CONFIRM_RESTORE_DEFAULT ) ); - - if ( qbox.Execute() == RET_YES ) - { - ToolbarSaveInData* pSaveInData_ = - (ToolbarSaveInData*) GetSaveInData(); - - pSaveInData_->RestoreToolbar( pToolbar ); - - aTopLevelListBox.GetSelectHdl().Call( this ); - } - - break; - } - case ID_ICONS_ONLY: - { - pToolbar->SetStyle( 0 ); - pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 0 ); - - aTopLevelListBox.GetSelectHdl().Call( this ); - - break; - } - case ID_TEXT_ONLY: - { - pToolbar->SetStyle( 1 ); - pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 1 ); - - aTopLevelListBox.GetSelectHdl().Call( this ); - - break; - } - case ID_ICONS_AND_TEXT: - { - pToolbar->SetStyle( 2 ); - pSaveInData->SetSystemStyle( m_xFrame, pToolbar->GetCommand(), 2 ); - - aTopLevelListBox.GetSelectHdl().Call( this ); - - break; - } - } - return 1; -} - -IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton ) -{ - bool bNeedsApply = sal_False; - - // get currently selected toolbar - SvxConfigEntry* pToolbar = GetTopLevelSelection(); - - switch( pButton->GetCurItemId() ) - { - case ID_RENAME: - { - SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry(); - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - String aNewName( stripHotKey( pEntry->GetName() ) ); - String aDesc = CUI_RESSSTR( RID_SVXSTR_LABEL_NEW_NAME ); - - SvxNameDialog* pNameDialog = new SvxNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_RENAME_TOOLBAR ) ); - - bool ret = pNameDialog->Execute(); - - if ( ret == RET_OK ) { - pNameDialog->GetName(aNewName); - - pEntry->SetName( aNewName ); - aContentsListBox->SetEntryText( pActEntry, aNewName ); - - bNeedsApply = sal_True; - } - - delete pNameDialog; - break; - } - case ID_DEFAULT_COMMAND: - { - SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry(); - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - sal_uInt16 nSelectionPos = 0; - - // find position of entry within the list - for ( sal_uInt16 i = 0; i < aContentsListBox->GetEntryCount(); ++i ) - { - if ( aContentsListBox->GetEntry( 0, i ) == pActEntry ) - { - nSelectionPos = i; - break; - } - } - - ToolbarSaveInData* pSaveInData = - (ToolbarSaveInData*) GetSaveInData(); - - OUString aSystemName = - pSaveInData->GetSystemUIName( pEntry->GetCommand() ); - - if ( !pEntry->GetName().equals( aSystemName ) ) - { - pEntry->SetName( aSystemName ); - aContentsListBox->SetEntryText( - pActEntry, stripHotKey( aSystemName ) ); - bNeedsApply = sal_True; - } - - uno::Sequence< OUString > aURLSeq( 1 ); - aURLSeq[ 0 ] = pEntry->GetCommand(); - - try - { - GetSaveInData()->GetImageManager()->removeImages( - GetImageType(), aURLSeq ); - - // reset backup in entry - pEntry->SetBackupGraphic( - uno::Reference< graphic::XGraphic >() ); - - GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); - - aContentsListBox->GetModel()->Remove( pActEntry ); - - SvLBoxEntry* pNewLBEntry = - InsertEntryIntoUI( pEntry, nSelectionPos ); - - aContentsListBox->SetCheckButtonState( pNewLBEntry, - pEntry->IsVisible() ? - SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - - aContentsListBox->Select( pNewLBEntry ); - aContentsListBox->MakeVisible( pNewLBEntry ); - - bNeedsApply = sal_True; - } - catch ( uno::Exception& ) - { - OSL_TRACE("Error restoring image"); - } - break; - } - case ID_BEGIN_GROUP: - { - SvxConfigEntry* pNewEntryData = new SvxConfigEntry; - pNewEntryData->SetUserDefined( sal_True ); - - SvLBoxEntry* pNewLBEntry = InsertEntry( pNewEntryData ); - - aContentsListBox->SetCheckButtonState( - pNewLBEntry, SV_BUTTON_TRISTATE ); - - bNeedsApply = sal_True; - break; - } - case ID_DELETE: - { - DeleteSelectedContent(); - break; - } - case ID_ICON_ONLY: - { - break; - } - case ID_TEXT_ONLY: - { - break; - } - case ID_ICON_AND_TEXT: - { - break; - } - case ID_CHANGE_SYMBOL: - { - SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry(); - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - sal_uInt16 nSelectionPos = 0; - - // find position of entry within the list - for ( sal_uInt16 i = 0; i < aContentsListBox->GetEntryCount(); ++i ) - { - if ( aContentsListBox->GetEntry( 0, i ) == pActEntry ) - { - nSelectionPos = i; - break; - } - } - - SvxIconSelectorDialog* pIconDialog = - new SvxIconSelectorDialog( 0, - GetSaveInData()->GetImageManager(), - GetSaveInData()->GetParentImageManager() ); - - bool ret = pIconDialog->Execute(); - - if ( ret == RET_OK ) - { - uno::Reference< graphic::XGraphic > newgraphic = - pIconDialog->GetSelectedIcon(); - - if ( newgraphic.is() ) - { - uno::Sequence< uno::Reference< graphic::XGraphic > > - aGraphicSeq( 1 ); - - uno::Sequence< OUString > aURLSeq( 1 ); - aURLSeq[ 0 ] = pEntry->GetCommand(); - - if ( !pEntry->GetBackupGraphic().is() ) - { - uno::Reference< graphic::XGraphic > backup; - backup = GetGraphic( - GetSaveInData()->GetImageManager(), aURLSeq[ 0 ] ); - - if ( backup.is() ) - { - pEntry->SetBackupGraphic( backup ); - } - } - - aGraphicSeq[ 0 ] = newgraphic; - try - { - GetSaveInData()->GetImageManager()->replaceImages( - GetImageType(), aURLSeq, aGraphicSeq ); - - Image aImage( newgraphic ); - - aContentsListBox->GetModel()->Remove( pActEntry ); - SvLBoxEntry* pNewLBEntry = - InsertEntryIntoUI( pEntry, nSelectionPos ); - - aContentsListBox->SetCheckButtonState( pNewLBEntry, - pEntry->IsVisible() ? - SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - - aContentsListBox->Select( pNewLBEntry ); - aContentsListBox->MakeVisible( pNewLBEntry ); - - GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); - } - catch ( uno::Exception& ) - { - OSL_TRACE("Error replacing image"); - } - } - } - - delete pIconDialog; - - break; - } - case ID_RESET_SYMBOL: - { - SvLBoxEntry* pActEntry = aContentsListBox->GetCurEntry(); - SvxConfigEntry* pEntry = - (SvxConfigEntry*) pActEntry->GetUserData(); - - sal_uInt16 nSelectionPos = 0; - - // find position of entry within the list - for ( sal_uInt16 i = 0; i < aContentsListBox->GetEntryCount(); ++i ) - { - if ( aContentsListBox->GetEntry( 0, i ) == pActEntry ) - { - nSelectionPos = i; - break; - } - } - - uno::Reference< graphic::XGraphic > backup = - pEntry->GetBackupGraphic(); - - uno::Sequence< uno::Reference< graphic::XGraphic > > - aGraphicSeq( 1 ); - aGraphicSeq[ 0 ] = backup; - - uno::Sequence< OUString > aURLSeq( 1 ); - aURLSeq[ 0 ] = pEntry->GetCommand(); - - try - { - GetSaveInData()->GetImageManager()->replaceImages( - GetImageType(), aURLSeq, aGraphicSeq ); - - Image aImage( backup ); - aContentsListBox->GetModel()->Remove( pActEntry ); - - SvLBoxEntry* pNewLBEntry = - InsertEntryIntoUI( pEntry, nSelectionPos ); - - aContentsListBox->SetCheckButtonState( pNewLBEntry, - pEntry->IsVisible() ? - SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - - aContentsListBox->Select( pNewLBEntry ); - aContentsListBox->MakeVisible( pNewLBEntry ); - - // reset backup in entry - pEntry->SetBackupGraphic( - uno::Reference< graphic::XGraphic >() ); - - GetSaveInData()->PersistChanges( - GetSaveInData()->GetImageManager() ); - } - catch ( uno::Exception& ) - { - OSL_TRACE("Error resetting image"); - } - break; - } - } - - if ( bNeedsApply == sal_True ) - { - (( ToolbarSaveInData* ) GetSaveInData())->ApplyToolbar( pToolbar ); - UpdateButtonStates(); - } - - return 1; -} - -void SvxToolbarConfigPage::Init() -{ - // ensure that the UI is cleared before populating it - aTopLevelListBox.Clear(); - aContentsListBox->Clear(); - - ReloadTopLevelListBox(); - - sal_uInt16 nPos = 0; - if ( m_aURLToSelect.getLength() != 0 ) - { - for ( sal_uInt16 i = 0 ; i < aTopLevelListBox.GetEntryCount(); ++i ) - { - SvxConfigEntry* pData = - (SvxConfigEntry*) aTopLevelListBox.GetEntryData( i ); - - if ( pData->GetCommand().equals( m_aURLToSelect ) ) - { - nPos = i; - break; - } - } - - // in future select the default toolbar: Standard - m_aURLToSelect = OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_TOOLBAR_URL )); - m_aURLToSelect += OUString(RTL_CONSTASCII_USTRINGPARAM( "standardbar" )); - } - - aTopLevelListBox.SelectEntryPos(nPos, sal_True); - aTopLevelListBox.GetSelectHdl().Call(this); -} - -SaveInData* SvxToolbarConfigPage::CreateSaveInData( - const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr, - const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr, - const OUString& aModuleId, - bool bDocConfig ) -{ - return static_cast< SaveInData* >( - new ToolbarSaveInData( xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig )); -} - -ToolbarSaveInData::ToolbarSaveInData( - const uno::Reference < css::ui::XUIConfigurationManager >& xCfgMgr, - const uno::Reference < css::ui::XUIConfigurationManager >& xParentCfgMgr, - const OUString& aModuleId, - bool docConfig ) : - - SaveInData ( xCfgMgr, xParentCfgMgr, aModuleId, docConfig ), - pRootEntry ( NULL ), - m_aDescriptorContainer ( RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_CONTAINER ) ) - -{ - // Initialize the m_xPersistentWindowState variable which is used - // to get the default properties of system toolbars such as name - uno::Reference< container::XNameAccess > xPWSS( - m_xServiceManager->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ui.WindowStateConfiguration" ) ) ), - uno::UNO_QUERY ); - - if ( xPWSS.is() ) - xPWSS->getByName( aModuleId ) >>= m_xPersistentWindowState; -} - -ToolbarSaveInData::~ToolbarSaveInData() -{ - delete pRootEntry; -} - -void ToolbarSaveInData::SetSystemStyle( - uno::Reference< frame::XFrame > xFrame, - const OUString& rResourceURL, - sal_Int32 nStyle ) -{ - // change the style using the API - SetSystemStyle( rResourceURL, nStyle ); - - // this code is a temporary hack as the UI is not updating after - // changing the toolbar style via the API - uno::Reference< css::frame::XLayoutManager > xLayoutManager; - Window *window = NULL; - - uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY ); - if ( xPropSet.is() ) - { - uno::Any a = xPropSet->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ); - a >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - { - uno::Reference< css::ui::XUIElement > xUIElement = - xLayoutManager->getElement( rResourceURL ); - - // check reference before we call getRealInterface. The layout manager - // can only provide references for elements that have been created - // before. It's possible that the current element is not available. - uno::Reference< com::sun::star::awt::XWindow > xWindow; - if ( xUIElement.is() ) - xWindow = uno::Reference< com::sun::star::awt::XWindow >( - xUIElement->getRealInterface(), uno::UNO_QUERY ); - - window = VCLUnoHelper::GetWindow( xWindow ); - } - - if ( window != NULL && window->GetType() == WINDOW_TOOLBOX ) - { - ToolBox* toolbox = (ToolBox*)window; - - if ( nStyle == 0 ) - { - toolbox->SetButtonType( BUTTON_SYMBOL ); - } - else if ( nStyle == 1 ) - { - toolbox->SetButtonType( BUTTON_TEXT ); - } - if ( nStyle == 2 ) - { - toolbox->SetButtonType( BUTTON_SYMBOLTEXT ); - } - } -} - -void ToolbarSaveInData::SetSystemStyle( - const OUString& rResourceURL, - sal_Int32 nStyle ) -{ - if ( rResourceURL.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM( "private" )) ) == 0 && - m_xPersistentWindowState.is() && - m_xPersistentWindowState->hasByName( rResourceURL ) ) - { - try - { - uno::Sequence< beans::PropertyValue > aProps; - - uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) ); - - if ( a >>= aProps ) - { - for ( sal_Int32 i = 0; i < aProps.getLength(); ++i ) - { - if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE) ) - { - aProps[ i ].Value = uno::makeAny( nStyle ); - break; - } - } - } - - uno::Reference< container::XNameReplace > - xNameReplace( m_xPersistentWindowState, uno::UNO_QUERY ); - - xNameReplace->replaceByName( rResourceURL, uno::makeAny( aProps ) ); - } - catch ( uno::Exception& ) - { - // do nothing, a default value is returned - OSL_TRACE("Exception setting toolbar style"); - } - } -} - -sal_Int32 ToolbarSaveInData::GetSystemStyle( const OUString& rResourceURL ) -{ - sal_Int32 result = 0; - - if ( rResourceURL.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM( "private" )) ) == 0 && - m_xPersistentWindowState.is() && - m_xPersistentWindowState->hasByName( rResourceURL ) ) - { - try - { - uno::Sequence< beans::PropertyValue > aProps; - uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) ); - - if ( a >>= aProps ) - { - for ( sal_Int32 i = 0; i < aProps.getLength(); ++i ) - { - if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE) ) - { - aProps[i].Value >>= result; - break; - } - } - } - } - catch ( uno::Exception& ) - { - // do nothing, a default value is returned - } - } - - return result; -} - -OUString ToolbarSaveInData::GetSystemUIName( const OUString& rResourceURL ) -{ - OUString result; - - if ( rResourceURL.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM( "private" )) ) == 0 && - m_xPersistentWindowState.is() && - m_xPersistentWindowState->hasByName( rResourceURL ) ) - { - try - { - uno::Sequence< beans::PropertyValue > aProps; - uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) ); - - if ( a >>= aProps ) - { - for ( sal_Int32 i = 0; i < aProps.getLength(); ++i ) - { - if ( aProps[ i ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) ) - { - aProps[ i ].Value >>= result; - } - } - } - } - catch ( uno::Exception& ) - { - // do nothing, an empty UIName will be returned - } - } - - if ( rResourceURL.indexOf( OUString(RTL_CONSTASCII_USTRINGPARAM( ".uno" )) ) == 0 && - m_xCommandToLabelMap.is() && - m_xCommandToLabelMap->hasByName( rResourceURL ) ) - { - uno::Any a; - try - { - a = m_xCommandToLabelMap->getByName( rResourceURL ); - - uno::Sequence< beans::PropertyValue > aPropSeq; - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); ++i ) - { - if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) ) - { - aPropSeq[i].Value >>= result; - } - } - } - } - catch ( uno::Exception& ) - { - // not a system command name - } - } - - return result; -} - -bool EntrySort( SvxConfigEntry* a, SvxConfigEntry* b ) -{ - return a->GetName().compareTo( b->GetName() ) < 0; -} - -SvxEntries* ToolbarSaveInData::GetEntries() -{ - typedef ::boost::unordered_map< ::rtl::OUString, - bool, - ::rtl::OUStringHash, - ::std::equal_to< ::rtl::OUString > > ToolbarInfo; - - ToolbarInfo aToolbarInfo; - - if ( pRootEntry == NULL ) - { - - pRootEntry = new SvxConfigEntry( - String::CreateFromAscii("MainToolbars"), String(), sal_True ); - - uno::Sequence< uno::Sequence < beans::PropertyValue > > info = - GetConfigManager()->getUIElementsInfo( - css::ui::UIElementType::TOOLBAR ); - - for ( sal_Int32 i = 0; i < info.getLength(); ++i ) - { - uno::Sequence< beans::PropertyValue > props = info[ i ]; - - OUString url; - OUString systemname; - OUString uiname; - - for ( sal_Int32 j = 0; j < props.getLength(); ++j ) - { - if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_RESOURCEURL) ) - { - props[ j ].Value >>= url; - systemname = url.copy( url.lastIndexOf( '/' ) + 1 ); - } - else if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) ) - { - props[ j ].Value >>= uiname; - } - } - - try - { - uno::Reference< container::XIndexAccess > xToolbarSettings = - GetConfigManager()->getSettings( url, sal_False ); - - if ( uiname.getLength() == 0 ) - { - // try to get the name from m_xPersistentWindowState - uiname = GetSystemUIName( url ); - - if ( uiname.getLength() == 0 ) - { - uiname = systemname; - } - } - - SvxConfigEntry* pEntry = new SvxConfigEntry( - uiname, url, sal_True ); - - pEntry->SetMain( sal_True ); - pEntry->SetStyle( GetSystemStyle( url ) ); - - - // insert into boost::unordered_map to filter duplicates from the parent - aToolbarInfo.insert( ToolbarInfo::value_type( systemname, true )); - - OUString custom(RTL_CONSTASCII_USTRINGPARAM(CUSTOM_TOOLBAR_STR)); - if ( systemname.indexOf( custom ) == 0 ) - { - pEntry->SetUserDefined( sal_True ); - } - else - { - pEntry->SetUserDefined( sal_False ); - } - - pRootEntry->GetEntries()->push_back( pEntry ); - - LoadToolbar( xToolbarSettings, pEntry ); - } - catch ( container::NoSuchElementException& ) - { - // TODO, handle resourceURL with no settings - } - } - - uno::Reference< css::ui::XUIConfigurationManager > xParentCfgMgr = GetParentConfigManager(); - if ( xParentCfgMgr.is() ) - { - // Retrieve also the parent toolbars to make it possible - // to configure module toolbars and save them into the document - // config manager. - uno::Sequence< uno::Sequence < beans::PropertyValue > > info_ = - xParentCfgMgr->getUIElementsInfo( - css::ui::UIElementType::TOOLBAR ); - - for ( sal_Int32 i = 0; i < info_.getLength(); ++i ) - { - uno::Sequence< beans::PropertyValue > props = info_[ i ]; - - OUString url; - OUString systemname; - OUString uiname; - - for ( sal_Int32 j = 0; j < props.getLength(); ++j ) - { - if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_RESOURCEURL) ) - { - props[ j ].Value >>= url; - systemname = url.copy( url.lastIndexOf( '/' ) + 1 ); - } - else if ( props[ j ].Name.equalsAscii( ITEM_DESCRIPTOR_UINAME) ) - { - props[ j ].Value >>= uiname; - } - } - - // custom toolbars of the parent are not visible in the document layer - OUString custom(RTL_CONSTASCII_USTRINGPARAM(CUSTOM_TOOLBAR_STR)); - if ( systemname.indexOf( custom ) == 0 ) - continue; - - // check if toolbar is already in the document layer - ToolbarInfo::const_iterator pIter = aToolbarInfo.find( systemname ); - if ( pIter == aToolbarInfo.end() ) - { - aToolbarInfo.insert( ToolbarInfo::value_type( systemname, true )); - - try - { - uno::Reference< container::XIndexAccess > xToolbarSettings = - xParentCfgMgr->getSettings( url, sal_False ); - - if ( uiname.getLength() == 0 ) - { - // try to get the name from m_xPersistentWindowState - uiname = GetSystemUIName( url ); - - if ( uiname.getLength() == 0 ) - { - uiname = systemname; - } - } - - SvxConfigEntry* pEntry = new SvxConfigEntry( - uiname, url, sal_True, sal_True ); - - pEntry->SetMain( sal_True ); - pEntry->SetStyle( GetSystemStyle( url ) ); - - if ( systemname.indexOf( custom ) == 0 ) - { - pEntry->SetUserDefined( sal_True ); - } - else - { - pEntry->SetUserDefined( sal_False ); - } - - pRootEntry->GetEntries()->push_back( pEntry ); - - LoadToolbar( xToolbarSettings, pEntry ); - } - catch ( container::NoSuchElementException& ) - { - // TODO, handle resourceURL with no settings - } - } - } - } - - std::sort( GetEntries()->begin(), GetEntries()->end(), EntrySort ); - } - - return pRootEntry->GetEntries(); -} - -void -ToolbarSaveInData::SetEntries( SvxEntries* pNewEntries ) -{ - // delete old menu hierarchy first - if ( pRootEntry != NULL && pRootEntry->GetEntries() != NULL ) - { - delete pRootEntry->GetEntries(); - } - - // now set new menu hierarchy - pRootEntry->SetEntries( pNewEntries ); -} - -bool -ToolbarSaveInData::HasURL( const OUString& rURL ) -{ - SvxEntries::const_iterator iter = GetEntries()->begin(); - SvxEntries::const_iterator end = GetEntries()->end(); - - while ( iter != end ) - { - SvxConfigEntry* pEntry = *iter; - - if ( pEntry->GetCommand().equals( rURL ) ) - { - if ( pEntry->IsParentData() ) - return sal_False; - else - return sal_True; - } - - ++iter; - } - return sal_False; -} - -bool ToolbarSaveInData::HasSettings() -{ - // return true if there is at least one toolbar entry - if ( GetEntries()->size() > 0 ) - { - return sal_True; - } - return sal_False; -} - -void ToolbarSaveInData::Reset() -{ - SvxEntries::const_iterator toolbars = GetEntries()->begin(); - SvxEntries::const_iterator end = GetEntries()->end(); - - // reset each toolbar by calling removeSettings for it's toolbar URL - for ( ; toolbars != end; ++toolbars ) - { - SvxConfigEntry* pToolbar = *toolbars; - - try - { - OUString url = pToolbar->GetCommand(); - GetConfigManager()->removeSettings( url ); - } - catch ( uno::Exception& ) - { - // error occurred removing the settings - // TODO - add error dialog in future? - } - } - - // persist changes to toolbar storage - PersistChanges( GetConfigManager() ); - - // now delete the root SvxConfigEntry the next call to GetEntries() - // causes it to be reinitialised - delete pRootEntry; - pRootEntry = NULL; - - // reset all icons to default - try - { - GetImageManager()->reset(); - PersistChanges( GetImageManager() ); - } - catch ( uno::Exception& ) - { - OSL_TRACE("Error resetting all icons when resetting toolbars"); - } -} - -bool ToolbarSaveInData::Apply() -{ - // toolbar changes are instantly applied - return sal_False; -} - -void ToolbarSaveInData::ApplyToolbar( - uno::Reference< container::XIndexContainer >& rToolbarBar, - uno::Reference< lang::XSingleComponentFactory >& rFactory, - SvxConfigEntry* pToolbarData ) -{ - SvxEntries::const_iterator iter = pToolbarData->GetEntries()->begin(); - SvxEntries::const_iterator end = pToolbarData->GetEntries()->end(); - - for ( ; iter != end; ++iter ) - { - SvxConfigEntry* pEntry = *iter; - - if ( pEntry->IsPopup() ) - { - uno::Sequence< beans::PropertyValue > aPropValueSeq = - ConvertToolbarEntry( m_xCommandToLabelMap, pEntry ); - - uno::Reference< container::XIndexContainer > xSubMenuBar( - rFactory->createInstanceWithContext( m_xComponentContext ), - uno::UNO_QUERY ); - - sal_Int32 nIndex = aPropValueSeq.getLength(); - aPropValueSeq.realloc( nIndex + 1 ); - aPropValueSeq[nIndex].Name = m_aDescriptorContainer; - aPropValueSeq[nIndex].Value <<= xSubMenuBar; - rToolbarBar->insertByIndex( - rToolbarBar->getCount(), uno::makeAny( aPropValueSeq )); - - ApplyToolbar( xSubMenuBar, rFactory, pEntry ); - } - else if ( pEntry->IsSeparator() ) - { - rToolbarBar->insertByIndex( - rToolbarBar->getCount(), uno::makeAny( m_aSeparatorSeq )); - } - else - { - uno::Sequence< beans::PropertyValue > aPropValueSeq = - ConvertToolbarEntry( m_xCommandToLabelMap, pEntry ); - - rToolbarBar->insertByIndex( - rToolbarBar->getCount(), uno::makeAny( aPropValueSeq )); - } - } -} - -void ToolbarSaveInData::ApplyToolbar( SvxConfigEntry* pToolbar ) -{ - // Apply new toolbar structure to our settings container - uno::Reference< container::XIndexAccess > xSettings( - GetConfigManager()->createSettings(), uno::UNO_QUERY ); - - uno::Reference< container::XIndexContainer > xIndexContainer ( - xSettings, uno::UNO_QUERY ); - - uno::Reference< lang::XSingleComponentFactory > xFactory ( - xSettings, uno::UNO_QUERY ); - - ApplyToolbar( xIndexContainer, xFactory, pToolbar ); - - uno::Reference< beans::XPropertySet > xProps( - xSettings, uno::UNO_QUERY ); - - if ( pToolbar->IsUserDefined() ) - { - xProps->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_UINAME )), - uno::makeAny( OUString( pToolbar->GetName() ) ) ); - } - - try - { - if ( GetConfigManager()->hasSettings( pToolbar->GetCommand() ) ) - { - GetConfigManager()->replaceSettings( - pToolbar->GetCommand(), xSettings ); - } - else - { - GetConfigManager()->insertSettings( - pToolbar->GetCommand(), xSettings ); - if ( pToolbar->IsParentData() ) - pToolbar->SetParentData( false ); - } - } - catch ( container::NoSuchElementException& ) - { - OSL_TRACE("caught container::NoSuchElementException saving settings"); - } - catch ( com::sun::star::io::IOException& ) - { - OSL_TRACE("caught IOException saving settings"); - } - catch ( com::sun::star::uno::Exception& ) - { - OSL_TRACE("caught some other exception saving settings"); - } - - PersistChanges( GetConfigManager() ); -} - -void ToolbarSaveInData::CreateToolbar( SvxConfigEntry* pToolbar ) -{ - // show the new toolbar in the UI also - uno::Reference< container::XIndexAccess > - xSettings( GetConfigManager()->createSettings(), uno::UNO_QUERY ); - - uno::Reference< container::XIndexContainer > - xIndexContainer ( xSettings, uno::UNO_QUERY ); - - uno::Reference< beans::XPropertySet > - xPropertySet( xSettings, uno::UNO_QUERY ); - - xPropertySet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM( ITEM_DESCRIPTOR_UINAME )), - uno::makeAny( pToolbar->GetName() ) ); - - try - { - GetConfigManager()->insertSettings( pToolbar->GetCommand(), xSettings ); - } - catch ( container::ElementExistException& ) - { - OSL_TRACE("caught ElementExistsException saving settings"); - } - catch ( com::sun::star::lang::IllegalArgumentException& ) - { - OSL_TRACE("caught IOException saving settings"); - } - catch ( com::sun::star::lang::IllegalAccessException& ) - { - OSL_TRACE("caught IOException saving settings"); - } - catch ( com::sun::star::uno::Exception& ) - { - OSL_TRACE("caught some other exception saving settings"); - } - - GetEntries()->push_back( pToolbar ); - - PersistChanges( GetConfigManager() ); -} - -void ToolbarSaveInData::RemoveToolbar( SvxConfigEntry* pToolbar ) -{ - try - { - OUString url = pToolbar->GetCommand(); - GetConfigManager()->removeSettings( url ); - RemoveEntry( GetEntries(), pToolbar ); - delete pToolbar; - - PersistChanges( GetConfigManager() ); - - // remove the persistent window state data - css::uno::Reference< css::container::XNameContainer > xNameContainer( - m_xPersistentWindowState, css::uno::UNO_QUERY_THROW ); - - xNameContainer->removeByName( url ); - } - catch ( uno::Exception& ) - { - // error occurred removing the settings - } -} - -void ToolbarSaveInData::RestoreToolbar( SvxConfigEntry* pToolbar ) -{ - OUString url = pToolbar->GetCommand(); - - // Restore of toolbar is done by removing it from - // it's configuration manager and then getting it again - bool bParentToolbar = pToolbar->IsParentData(); - - // Cannot restore parent toolbar - if ( bParentToolbar ) - return; - - try - { - GetConfigManager()->removeSettings( url ); - pToolbar->GetEntries()->clear(); - PersistChanges( GetConfigManager() ); - } - catch ( uno::Exception& ) - { - // if an error occurs removing the settings then just return - return; - } - - // Now reload the toolbar settings - try - { - uno::Reference< container::XIndexAccess > xToolbarSettings; - if ( IsDocConfig() ) - { - xToolbarSettings = GetParentConfigManager()->getSettings( url, sal_False ); - pToolbar->SetParentData( true ); - } - else - xToolbarSettings = GetConfigManager()->getSettings( url, sal_False ); - - LoadToolbar( xToolbarSettings, pToolbar ); - - // After reloading, ensure that the icon is reset of each entry - // in the toolbar - SvxEntries::const_iterator iter = pToolbar->GetEntries()->begin(); - uno::Sequence< OUString > aURLSeq( 1 ); - for ( ; iter != pToolbar->GetEntries()->end(); ++iter ) - { - SvxConfigEntry* pEntry = *iter; - aURLSeq[ 0 ] = pEntry->GetCommand(); - - try - { - GetImageManager()->removeImages( GetImageType(), aURLSeq ); - } - catch ( uno::Exception& ) - { - OSL_TRACE("Error restoring icon when resetting toolbar"); - } - } - PersistChanges( GetImageManager() ); - } - catch ( container::NoSuchElementException& ) - { - // cannot find the resource URL after removing it - // so no entry will appear in the toolbar list - } -} - -bool ToolbarSaveInData::LoadToolbar( - const uno::Reference< container::XIndexAccess >& xToolbarSettings, - SvxConfigEntry* pParentData ) -{ - SvxEntries* pEntries = pParentData->GetEntries(); - - for ( sal_Int32 nIndex = 0; nIndex < xToolbarSettings->getCount(); ++nIndex ) - { - uno::Reference< container::XIndexAccess > xSubMenu; - OUString aCommandURL; - OUString aLabel; - bool bIsUserDefined = sal_True; - sal_Bool bIsVisible; - sal_Int32 nStyle; - - sal_uInt16 nType( css::ui::ItemType::DEFAULT ); - - bool bItem = GetToolbarItemData( xToolbarSettings, nIndex, aCommandURL, - aLabel, nType, bIsVisible, nStyle, xSubMenu ); - - if ( bItem ) - { - if ( nType == css::ui::ItemType::DEFAULT ) - { - uno::Any a; - try - { - a = m_xCommandToLabelMap->getByName( aCommandURL ); - bIsUserDefined = sal_False; - } - catch ( container::NoSuchElementException& ) - { - bIsUserDefined = sal_True; - } - - // If custom label not set retrieve it from the command - // to info service - if ( aLabel.equals( OUString() ) ) - { - uno::Sequence< beans::PropertyValue > aPropSeq; - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); ++i ) - { - if ( aPropSeq[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ) ) - { - aPropSeq[i].Value >>= aLabel; - break; - } - } - } - } - - if ( xSubMenu.is() ) - { - SvxConfigEntry* pEntry = new SvxConfigEntry( - aLabel, aCommandURL, sal_True ); - - pEntry->SetUserDefined( bIsUserDefined ); - pEntry->SetVisible( bIsVisible ); - - pEntries->push_back( pEntry ); - - LoadToolbar( xSubMenu, pEntry ); - } - else - { - SvxConfigEntry* pEntry = new SvxConfigEntry( - aLabel, aCommandURL, sal_False ); - pEntry->SetUserDefined( bIsUserDefined ); - pEntry->SetVisible( bIsVisible ); - pEntry->SetStyle( nStyle ); - pEntries->push_back( pEntry ); - } - } - else - { - SvxConfigEntry* pEntry = new SvxConfigEntry; - pEntry->SetUserDefined( bIsUserDefined ); - pEntries->push_back( pEntry ); - } - } - } - - return true; -} - -IMPL_LINK( SvxToolbarConfigPage, SelectToolbarEntry, Control *, pBox ) -{ - (void)pBox; - UpdateButtonStates(); - return 1; -} - -void SvxToolbarConfigPage::UpdateButtonStates() -{ - PopupMenu* pPopup = aModifyCommandButton.GetPopupMenu(); - pPopup->EnableItem( ID_RENAME, sal_False ); - pPopup->EnableItem( ID_DELETE, sal_False ); - pPopup->EnableItem( ID_BEGIN_GROUP, sal_False ); - pPopup->EnableItem( ID_DEFAULT_COMMAND, sal_False ); - pPopup->EnableItem( ID_ICON_ONLY, sal_False ); - pPopup->EnableItem( ID_ICON_AND_TEXT, sal_False ); - pPopup->EnableItem( ID_TEXT_ONLY, sal_False ); - pPopup->EnableItem( ID_CHANGE_SYMBOL, sal_False ); - pPopup->EnableItem( ID_RESET_SYMBOL, sal_False ); - - aDescriptionField.Clear(); - - SvLBoxEntry* selection = aContentsListBox->GetCurEntry(); - if ( aContentsListBox->GetEntryCount() == 0 || selection == NULL ) - { - return; - } - - SvxConfigEntry* pEntryData = (SvxConfigEntry*) selection->GetUserData(); - if ( pEntryData->IsSeparator() ) - pPopup->EnableItem( ID_DELETE, sal_True ); - else - { - pPopup->EnableItem( ID_BEGIN_GROUP, sal_True ); - pPopup->EnableItem( ID_DELETE, sal_True ); - pPopup->EnableItem( ID_RENAME, sal_True ); - pPopup->EnableItem( ID_ICON_ONLY, sal_True ); - pPopup->EnableItem( ID_ICON_AND_TEXT, sal_True ); - pPopup->EnableItem( ID_TEXT_ONLY, sal_True ); - pPopup->EnableItem( ID_CHANGE_SYMBOL, sal_True ); - - if ( !pEntryData->IsUserDefined() ) - pPopup->EnableItem( ID_DEFAULT_COMMAND, sal_True ); - - if ( pEntryData->IsIconModified() ) - pPopup->EnableItem( ID_RESET_SYMBOL, sal_True ); - - aDescriptionField.SetNewText( pEntryData->GetHelpText() ); - } -} - -short SvxToolbarConfigPage::QueryReset() -{ - String msg = - String( CUI_RES( RID_SVXSTR_CONFIRM_TOOLBAR_RESET ) ); - - String saveInName = aSaveInListBox.GetEntry( - aSaveInListBox.GetSelectEntryPos() ); - - OUString label = replaceSaveInName( msg, saveInName ); - - QueryBox qbox( this, WB_YES_NO, label ); - - return qbox.Execute(); -} - -IMPL_LINK( SvxToolbarConfigPage, SelectToolbar, ListBox *, pBox ) -{ - (void)pBox; - - aContentsListBox->Clear(); - - SvxConfigEntry* pToolbar = GetTopLevelSelection(); - if ( pToolbar == NULL ) - { - aModifyTopLevelButton.Enable( sal_False ); - aModifyCommandButton.Enable( sal_False ); - aAddCommandsButton.Enable( sal_False ); - - return 0; - } - - aModifyTopLevelButton.Enable( sal_True ); - aModifyCommandButton.Enable( sal_True ); - aAddCommandsButton.Enable( sal_True ); - - PopupMenu* pPopup = aModifyTopLevelButton.GetPopupMenu(); - - pPopup->EnableItem( ID_DELETE, pToolbar->IsDeletable() ); - pPopup->EnableItem( ID_RENAME, pToolbar->IsRenamable() ); - pPopup->EnableItem( ID_DEFAULT_STYLE, !pToolbar->IsRenamable() ); - - switch( pToolbar->GetStyle() ) - { - case 0: - { - pPopup->CheckItem( ID_ICONS_ONLY ); - break; - } - case 1: - { - pPopup->CheckItem( ID_TEXT_ONLY ); - break; - } - case 2: - { - pPopup->CheckItem( ID_ICONS_AND_TEXT ); - break; - } - } - - SvxEntries* pEntries = pToolbar->GetEntries(); - SvxEntries::const_iterator iter = pEntries->begin(); - - for ( ; iter != pEntries->end(); ++iter ) - { - SvxConfigEntry* pEntry = *iter; - - SvLBoxEntry* pNewLBEntry = InsertEntryIntoUI( pEntry ); - - if (pEntry->IsBinding()) - { - aContentsListBox->SetCheckButtonState( pNewLBEntry, - pEntry->IsVisible() ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - } - else - { - aContentsListBox->SetCheckButtonState( - pNewLBEntry, SV_BUTTON_TRISTATE ); - } - } - - UpdateButtonStates(); - - return 0; -} - -IMPL_LINK( SvxToolbarConfigPage, NewToolbarHdl, Button *, pButton ) -{ - (void)pButton; - - String prefix = - String( CUI_RES( RID_SVXSTR_NEW_TOOLBAR ) ); - - OUString aNewName = - generateCustomName( prefix, GetSaveInData()->GetEntries() ); - - OUString aNewURL = - generateCustomURL( GetSaveInData()->GetEntries() ); - - SvxNewToolbarDialog* pNameDialog = new SvxNewToolbarDialog( 0, aNewName ); - - sal_uInt16 nInsertPos; - for ( sal_uInt16 i = 0 ; i < aSaveInListBox.GetEntryCount(); ++i ) - { - SaveInData* pData = - (SaveInData*) aSaveInListBox.GetEntryData( i ); - - nInsertPos = pNameDialog->aSaveInListBox.InsertEntry( - aSaveInListBox.GetEntry( i ) ); - - pNameDialog->aSaveInListBox.SetEntryData( nInsertPos, pData ); - } - - pNameDialog->aSaveInListBox.SelectEntryPos( - aSaveInListBox.GetSelectEntryPos(), sal_True ); - - bool ret = pNameDialog->Execute(); - if ( ret == RET_OK ) - { - pNameDialog->GetName( aNewName ); - - nInsertPos = pNameDialog->aSaveInListBox.GetSelectEntryPos(); - - ToolbarSaveInData* pData = (ToolbarSaveInData*) - pNameDialog->aSaveInListBox.GetEntryData( nInsertPos ); - - if ( GetSaveInData() != pData ) - { - aSaveInListBox.SelectEntryPos( nInsertPos, sal_True ); - aSaveInListBox.GetSelectHdl().Call(this); - } - - SvxConfigEntry* pToolbar = - new SvxConfigEntry( aNewName, aNewURL, sal_True ); - - pToolbar->SetUserDefined( sal_True ); - pToolbar->SetMain( sal_True ); - - pData->CreateToolbar( pToolbar ); - - nInsertPos = aTopLevelListBox.InsertEntry( pToolbar->GetName() ); - aTopLevelListBox.SetEntryData( nInsertPos, pToolbar ); - aTopLevelListBox.SelectEntryPos( nInsertPos, sal_True ); - aTopLevelListBox.GetSelectHdl().Call(this); - - pData->SetModified( sal_True ); - } - - delete pNameDialog; - - return 0; -} - -IMPL_LINK( SvxToolbarConfigPage, AddCommandsHdl, Button *, pButton ) -{ - (void)pButton; - - if ( pSelectorDlg == NULL ) - { - // Create Script Selector which shows slot commands - pSelectorDlg = new SvxScriptSelectorDialog( this, sal_True, m_xFrame ); - - // Position the Script Selector over the Add button so it is - // beside the menu contents list and does not obscure it - pSelectorDlg->SetPosPixel( aAddCommandsButton.GetPosPixel() ); - - pSelectorDlg->SetAddHdl( - LINK( this, SvxToolbarConfigPage, AddFunctionHdl ) ); - } - - pSelectorDlg->SetImageProvider( - static_cast< ImageProvider* >( GetSaveInData() ) ); - - pSelectorDlg->Show(); - return 1; -} - -IMPL_LINK( SvxToolbarConfigPage, AddFunctionHdl, - SvxScriptSelectorDialog *, pDialog ) -{ - (void)pDialog; - - AddFunction(); - - return 0; -} - -SvLBoxEntry* SvxToolbarConfigPage::AddFunction( - SvLBoxEntry* pTarget, bool bFront, bool bAllowDuplicates ) -{ - SvLBoxEntry* pNewLBEntry = - SvxConfigPage::AddFunction( pTarget, bFront, bAllowDuplicates ); - - SvxConfigEntry* pEntry = (SvxConfigEntry*) pNewLBEntry->GetUserData(); - - if ( pEntry->IsBinding() ) - { - pEntry->SetVisible( sal_True ); - aContentsListBox->SetCheckButtonState( - pNewLBEntry, SV_BUTTON_CHECKED ); - } - else - { - aContentsListBox->SetCheckButtonState( - pNewLBEntry, SV_BUTTON_TRISTATE ); - } - - // get currently selected toolbar and apply change - SvxConfigEntry* pToolbar = GetTopLevelSelection(); - - if ( pToolbar != NULL ) - { - ( ( ToolbarSaveInData* ) GetSaveInData() )->ApplyToolbar( pToolbar ); - } - - return pNewLBEntry; -} - -// ----------------------------------------------------------------------- - -SvxToolbarEntriesListBox::SvxToolbarEntriesListBox( - Window* pParent, const ResId& aResId ) - : - SvxMenuEntriesListBox( pParent, aResId ), - pPage( ( SvxToolbarConfigPage* ) pParent ) -{ - m_pButtonData = new SvLBoxButtonData( this ); - BuildCheckBoxButtonImages( m_pButtonData ); - EnableCheckButton( m_pButtonData ); -} - -// -------------------------------------------------------- - -SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox() -{ - delete m_pButtonData; -} - -// -------------------------------------------------------- - -void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData ) -{ - // Build checkbox images according to the current application - // settings. This is necessary to be able to have correct colors - // in all color modes, like high contrast. - const AllSettings& rSettings = Application::GetSettings(); - - VirtualDevice aDev; - Size aSize( 26, 20 ); - - aDev.SetOutputSizePixel( aSize ); - - Image aImage = GetSizedImage( aDev, aSize, - CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT )); - - // Fill button data struct with new images - pData->aBmps[SV_BMP_UNCHECKED] = aImage; - pData->aBmps[SV_BMP_CHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )); - pData->aBmps[SV_BMP_HICHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )); - pData->aBmps[SV_BMP_HIUNCHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)); - pData->aBmps[SV_BMP_TRISTATE] = GetSizedImage( aDev, aSize, Image() ); // Use tristate bitmaps to have no checkbox for separator entries - pData->aBmps[SV_BMP_HITRISTATE] = GetSizedImage( aDev, aSize, Image() ); - - // Get image size - m_aCheckBoxImageSizePixel = aImage.GetSizePixel(); -} - -Image SvxToolbarEntriesListBox::GetSizedImage( - VirtualDevice& aDev, const Size& aNewSize, const Image& aImage ) -{ - // Create new checkbox images for treelistbox. They must have a - // decent width to have a clear column for the visibility checkbox. - - // Standard transparent color is light magenta as is won't be - // used for other things - Color aFillColor( COL_LIGHTMAGENTA ); - - // Position image at the center of (width-2),(height) rectangle. - // We need 2 pixels to have a bigger border to the next button image - sal_uInt16 nPosX = std::max( (sal_uInt16) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (sal_uInt16) 0 ); - sal_uInt16 nPosY = std::max( (sal_uInt16) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (sal_uInt16) 0 ); - Point aPos( nPosX > 0 ? nPosX : 0, nPosY > 0 ? nPosY : 0 ); - aDev.SetFillColor( aFillColor ); - aDev.SetLineColor( aFillColor ); - aDev.DrawRect( Rectangle( Point(), aNewSize )); - aDev.DrawImage( aPos, aImage ); - - // Draw separator line 2 pixels left from the right border - Color aLineColor = GetDisplayBackground().GetColor().IsDark() ? Color( COL_WHITE ) : Color( COL_BLACK ); - aDev.SetLineColor( aLineColor ); - aDev.DrawLine( Point( aNewSize.Width()-3, 0 ), Point( aNewSize.Width()-3, aNewSize.Height()-1 )); - - // Create new image that uses the fillcolor as transparent - return Image( aDev.GetBitmap( Point(), aNewSize ), aFillColor ); -} - -void SvxToolbarEntriesListBox::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SvTreeListBox::DataChanged( rDCEvt ); - - if (( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && - ( rDCEvt.GetFlags() & SETTINGS_STYLE )) - { - BuildCheckBoxButtonImages( m_pButtonData ); - Invalidate(); - } -} - -// -------------------------------------------------------- - -void SvxToolbarEntriesListBox::ChangeVisibility( SvLBoxEntry* pEntry ) -{ - if ( pEntry != NULL ) - { - SvxConfigEntry* pEntryData = - (SvxConfigEntry*) pEntry->GetUserData(); - - if ( pEntryData->IsBinding() ) - { - pEntryData->SetVisible( !pEntryData->IsVisible() ); - - SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection(); - - ToolbarSaveInData* pToolbarSaveInData = ( ToolbarSaveInData* ) - pPage->GetSaveInData(); - - pToolbarSaveInData->ApplyToolbar( pToolbar ); - - SetCheckButtonState( pEntry, pEntryData->IsVisible() ? - SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - } - } -} - -void SvxToolbarEntriesListBox::CheckButtonHdl() -{ - ChangeVisibility( GetHdlEntry() ); -} - -void SvxToolbarEntriesListBox::KeyInput( const KeyEvent& rKeyEvent ) -{ - // space key will change visibility of toolbar items - if ( rKeyEvent.GetKeyCode() == KEY_SPACE ) - { - ChangeVisibility( GetCurEntry() ); - } - else - { - // pass on to superclass - SvxMenuEntriesListBox::KeyInput( rKeyEvent ); - } -} - -sal_Bool SvxToolbarEntriesListBox::NotifyMoving( - SvLBoxEntry* pTarget, SvLBoxEntry* pSource, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos) -{ - bool result = SvxMenuEntriesListBox::NotifyMoving( - pTarget, pSource, rpNewParent, rNewChildPos ); - - if ( result == sal_True ) - { - // Instant Apply changes to UI - SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection(); - if ( pToolbar != NULL ) - { - ToolbarSaveInData* pSaveInData = - ( ToolbarSaveInData*) pPage->GetSaveInData(); - pSaveInData->ApplyToolbar( pToolbar ); - } - } - - return result; -} - -sal_Bool SvxToolbarEntriesListBox::NotifyCopying( - SvLBoxEntry* pTarget, - SvLBoxEntry* pSource, - SvLBoxEntry*& rpNewParent, - sal_uLong& rNewChildPos) -{ - (void)pSource; - (void)rpNewParent; - (void)rNewChildPos; - - if ( !m_bIsInternalDrag ) - { - // if the target is NULL then add function to the start of the list - ((SvxToolbarConfigPage*)pPage)->AddFunction( pTarget, pTarget == NULL ); - - // Instant Apply changes to UI - SvxConfigEntry* pToolbar = pPage->GetTopLevelSelection(); - if ( pToolbar != NULL ) - { - ToolbarSaveInData* pSaveInData = - ( ToolbarSaveInData*) pPage->GetSaveInData(); - pSaveInData->ApplyToolbar( pToolbar ); - } - - // AddFunction already adds the listbox entry so return FALSE - // to stop another listbox entry being added - return sal_False; - } - - // Copying is only allowed from external controls, not within the listbox - return sal_False; -} - -SvxNewToolbarDialog::SvxNewToolbarDialog( - Window* pWindow, const String& rName ) - : - ModalDialog ( pWindow, CUI_RES( MD_NEW_TOOLBAR ) ), - aFtDescription ( this, CUI_RES( FT_NAME ) ), - aEdtName ( this, CUI_RES( EDT_STRING ) ), - aSaveInText ( this, CUI_RES( TXT_SAVEIN ) ), - aBtnOK ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aBtnHelp ( this, CUI_RES( BTN_HELP ) ), - aSaveInListBox ( this, CUI_RES( LB_SAVEIN ) ) -{ - FreeResource(); - - aEdtName.SetText( rName ); - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxNewToolbarDialog, ModifyHdl)); -} - -IMPL_LINK(SvxNewToolbarDialog, ModifyHdl, Edit*, pEdit) -{ - (void)pEdit; - - if(aCheckNameHdl.IsSet()) - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); - - return 0; -} - -/******************************************************************************* -* -* The SvxIconSelectorDialog class -* -*******************************************************************************/ -SvxIconSelectorDialog::SvxIconSelectorDialog( Window *pWindow, - const uno::Reference< css::ui::XImageManager >& rXImageManager, - const uno::Reference< css::ui::XImageManager >& rXParentImageManager ) - : - ModalDialog ( pWindow, CUI_RES( MD_ICONSELECTOR ) ), - aFtDescription ( this, CUI_RES( FT_SYMBOLS ) ), - aTbSymbol ( this, CUI_RES( TB_SYMBOLS ) ), - aFtNote ( this, CUI_RES( FT_NOTE ) ), - aBtnOK ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aBtnHelp ( this, CUI_RES( BTN_HELP ) ), - aBtnImport ( this, CUI_RES( BTN_IMPORT ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aFlSeparator ( this, CUI_RES( FL_SEPARATOR ) ), - m_nNextId ( 0 ), - m_xImageManager ( rXImageManager ), - m_xParentImageManager( rXParentImageManager ) -{ - FreeResource(); - - typedef ::boost::unordered_map< ::rtl::OUString, - bool, - ::rtl::OUStringHash, - ::std::equal_to< ::rtl::OUString > > ImageInfo; - - aTbSymbol.SetPageScroll( sal_True ); - - bool bLargeIcons = GetImageType() & css::ui::ImageType::SIZE_LARGE; - m_nExpectedSize = bLargeIcons ? 26 : 16; - - if ( m_nExpectedSize != 16 ) - { - aFtNote.SetText( replaceSixteen( aFtNote.GetText(), m_nExpectedSize ) ); - } - - uno::Reference< lang::XMultiServiceFactory > xServiceManager = - ::comphelper::getProcessServiceFactory(); - - if ( xServiceManager.is() ) - { - m_xGraphProvider = uno::Reference< graphic::XGraphicProvider >( - xServiceManager->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider" ) ) ), - uno::UNO_QUERY ); - } - - if ( !m_xGraphProvider.is() ) - { - aBtnImport.Enable( sal_False ); - } - - uno::Reference< beans::XPropertySet > xPropSet( - xServiceManager->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSettings" ) ) ), - uno::UNO_QUERY ); - - uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfig" ) ) ); - - ::rtl::OUString aDirectory; - - aAny >>= aDirectory; - - sal_Int32 aCount = aDirectory.getLength(); - - if ( aCount > 0 ) - { - sal_Unicode aChar = aDirectory[ aCount-1 ]; - if ( aChar != '/') - { - aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ); - } - } - else - { - aBtnImport.Enable( sal_False ); - } - - aDirectory += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "soffice.cfg/import" ) ); - - uno::Reference< lang::XSingleServiceFactory > xStorageFactory( - xServiceManager->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.FileSystemStorageFactory" ) ) ), - uno::UNO_QUERY ); - - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[ 0 ] <<= aDirectory; - aArgs[ 1 ] <<= com::sun::star::embed::ElementModes::READWRITE; - - uno::Reference< com::sun::star::embed::XStorage > xStorage( - xStorageFactory->createInstanceWithArguments( aArgs ), uno::UNO_QUERY ); - - uno::Sequence< uno::Any > aProp( 2 ); - beans::PropertyValue aPropValue; - - aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ) ); - aPropValue.Value <<= xStorage; - aProp[ 0 ] <<= aPropValue; - - aPropValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) ); - aPropValue.Value <<= com::sun::star::embed::ElementModes::READWRITE; - aProp[ 1 ] <<= aPropValue; - - m_xImportedImageManager = uno::Reference< com::sun::star::ui::XImageManager >( - xServiceManager->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ImageManager" ) ), aProp ), - uno::UNO_QUERY ); - - ImageInfo mImageInfo; - uno::Sequence< OUString > names; - if ( m_xImportedImageManager.is() ) - { - names = m_xImportedImageManager->getAllImageNames( GetImageType() ); - for ( sal_Int32 n = 0; n < names.getLength(); ++n ) - mImageInfo.insert( ImageInfo::value_type( names[n], false )); - } - sal_uInt16 nId = 1; - ImageInfo::const_iterator pConstIter = mImageInfo.begin(); - uno::Sequence< OUString > name( 1 ); - while ( pConstIter != mImageInfo.end() ) - { - name[ 0 ] = pConstIter->first; - uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( GetImageType(), name ); - if ( graphics.getLength() > 0 ) - { - Image img = Image( graphics[ 0 ] ); - aTbSymbol.InsertItem( nId, img, pConstIter->first ); - - graphics[ 0 ]->acquire(); - - aTbSymbol.SetItemData( - nId, static_cast< void * > ( graphics[ 0 ].get() ) ); - - ++nId; - } - ++pConstIter; - } - - ImageInfo aImageInfo; - - if ( m_xParentImageManager.is() ) - { - names = m_xParentImageManager->getAllImageNames( GetImageType() ); - for ( sal_Int32 n = 0; n < names.getLength(); ++n ) - aImageInfo.insert( ImageInfo::value_type( names[n], false )); - } - - names = m_xImageManager->getAllImageNames( GetImageType() ); - for ( sal_Int32 n = 0; n < names.getLength(); ++n ) - { - ImageInfo::iterator pIter = aImageInfo.find( names[n] ); - if ( pIter != aImageInfo.end() ) - pIter->second = true; - else - aImageInfo.insert( ImageInfo::value_type( names[n], true )); - } - - // large growth factor, expecting many entries - pConstIter = aImageInfo.begin(); - while ( pConstIter != aImageInfo.end() ) - { - name[ 0 ] = pConstIter->first; - - uno::Sequence< uno::Reference< graphic::XGraphic> > graphics; - try - { - if ( pConstIter->second ) - graphics = m_xImageManager->getImages( GetImageType(), name ); - else - graphics = m_xParentImageManager->getImages( GetImageType(), name ); - } - catch ( uno::Exception& ) - { - // can't get sequence for this name so it will not be - // added to the list - } - - if ( graphics.getLength() > 0 ) - { - Image img = Image( graphics[ 0 ] ); - aTbSymbol.InsertItem( nId, img, pConstIter->first ); - - uno::Reference< graphic::XGraphic > xGraphic = graphics[ 0 ]; - - if ( xGraphic.is() ) - xGraphic->acquire(); - - aTbSymbol.SetItemData( - nId, static_cast< void * > ( xGraphic.get() ) ); - - ++nId; - } - - ++pConstIter; - } - - aBtnDelete.Enable( sal_False ); - aTbSymbol.SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) ); - aBtnImport.SetClickHdl( LINK(this, SvxIconSelectorDialog, ImportHdl) ); - aBtnDelete.SetClickHdl( LINK(this, SvxIconSelectorDialog, DeleteHdl) ); - - m_nNextId = aTbSymbol.GetItemCount()+1; -} - -SvxIconSelectorDialog::~SvxIconSelectorDialog() -{ - sal_uInt16 nCount = aTbSymbol.GetItemCount(); - - for (sal_uInt16 n = 0; n < nCount; ++n ) - { - sal_uInt16 nId = aTbSymbol.GetItemId(n); - - uno::XInterface* xi = static_cast< uno::XInterface* >( - aTbSymbol.GetItemData( nId ) ); - - if ( xi != NULL ) - { - xi->release(); - } - } -} - -uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon() -{ - uno::Reference< graphic::XGraphic > result; - - sal_uInt16 nId; - for ( sal_uInt16 n = 0; n < aTbSymbol.GetItemCount(); ++n ) - { - nId = aTbSymbol.GetItemId( n ); - if ( aTbSymbol.IsItemChecked( nId ) ) - { - result = uno::Reference< graphic::XGraphic >( - reinterpret_cast< graphic::XGraphic* >( - aTbSymbol.GetItemData( nId ) ) ); - } - } - - return result; -} - -IMPL_LINK( SvxIconSelectorDialog, SelectHdl, ToolBox *, pToolBox ) -{ - (void)pToolBox; - - sal_uInt16 nCount = aTbSymbol.GetItemCount(); - - for (sal_uInt16 n = 0; n < nCount; ++n ) - { - sal_uInt16 nId = aTbSymbol.GetItemId( n ); - - if ( aTbSymbol.IsItemChecked( nId ) ) - { - aTbSymbol.CheckItem( nId, sal_False ); - } - } - - sal_uInt16 nId = aTbSymbol.GetCurItemId(); - aTbSymbol.CheckItem( nId ); - - ::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId ); - if ( m_xImportedImageManager->hasImage( GetImageType(), aSelImageText ) ) - { - aBtnDelete.Enable( sal_True ); - } - else - { - aBtnDelete.Enable( sal_False ); - } - - return 0; -} - -IMPL_LINK( SvxIconSelectorDialog, ImportHdl, PushButton *, pButton ) -{ - (void)pButton; - - sfx2::FileDialogHelper aImportDialog( - css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, - SFXWB_GRAPHIC | SFXWB_MULTISELECTION ); - - // disable the link checkbox in the dialog - uno::Reference< css::ui::dialogs::XFilePickerControlAccess > - xController( aImportDialog.GetFilePicker(), uno::UNO_QUERY); - if ( xController.is() ) - { - xController->enableControl( - css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, - sal_False); - } - - aImportDialog.SetCurrentFilter( - String::CreateFromAscii( "PNG - Portable Network Graphic" ) ); - - if ( ERRCODE_NONE == aImportDialog.Execute() ) - { - uno::Sequence< OUString > paths = aImportDialog.GetMPath(); - ImportGraphics ( paths ); - } - - return 0; -} - -IMPL_LINK( SvxIconSelectorDialog, DeleteHdl, PushButton *, pButton ) -{ - (void)pButton; - - OUString message = String( CUI_RES( RID_SVXSTR_DELETE_ICON_CONFIRM ) ); - bool ret = WarningBox( this, WinBits(WB_OK_CANCEL), message ).Execute(); - - if ( ret == RET_OK ) - { - sal_uInt16 nCount = aTbSymbol.GetItemCount(); - - for (sal_uInt16 n = 0; n < nCount; ++n ) - { - sal_uInt16 nId = aTbSymbol.GetItemId( n ); - - if ( aTbSymbol.IsItemChecked( nId ) ) - { - ::rtl::OUString aSelImageText = aTbSymbol.GetItemText( nId ); - uno::Sequence< OUString > URLs(1); - URLs[0] = aSelImageText; - aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) ); - m_xImportedImageManager->removeImages( GetImageType(), URLs ); - uno::Reference< css::ui::XUIConfigurationPersistence > - xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY ); - if ( xConfigPersistence.is() && xConfigPersistence->isModified() ) - { - xConfigPersistence->store(); - } - break; - } - } - } - return 0; -} - -bool SvxIconSelectorDialog::ReplaceGraphicItem( - const ::rtl::OUString& aURL ) -{ - uno::Sequence< OUString > URLs(1); - uno::Sequence< uno::Reference > aImportGraph( 1 ); - uno::Reference< css::ui::XUIConfigurationPersistence > - xConfigPer( m_xImportedImageManager, uno::UNO_QUERY ); - - uno::Reference< graphic::XGraphic > xGraphic; - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") ); - aMediaProps[0].Value <<= aURL; - - com::sun::star::awt::Size aSize; - bool bOK = sal_False; - try - { - xGraphic = m_xGraphProvider->queryGraphic( aMediaProps ); - - uno::Reference< beans::XPropertySet > props = - m_xGraphProvider->queryGraphicDescriptor( aMediaProps ); - uno::Any a = props->getPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("SizePixel")) ); - a >>= aSize; - if (0 == aSize.Width || 0 == aSize.Height) - return sal_False; - else - bOK = sal_True; - } - catch ( uno::Exception& ) - { - return false; - } - - bool bResult( false ); - sal_uInt16 nCount = aTbSymbol.GetItemCount(); - for (sal_uInt16 n = 0; n < nCount; ++n ) - { - sal_uInt16 nId = aTbSymbol.GetItemId( n ); - - if ( OUString( aTbSymbol.GetItemText( nId ) ) == aURL ) - { - try - { - // replace/insert image with provided URL - aTbSymbol.RemoveItem( aTbSymbol.GetItemPos( nId ) ); - aMediaProps[0].Value <<= aURL; - - Image aImage( xGraphic ); - if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) ) - { - BitmapEx aBitmap = aImage.GetBitmapEx(); - BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize); - aImage = Image( aBitmapex); - } - aTbSymbol.InsertItem( nId,aImage, aURL, 0, 0 ); //modify - - xGraphic = aImage.GetXGraphic(); - - URLs[0] = aURL; - aImportGraph[ 0 ] = xGraphic; - m_xImportedImageManager->replaceImages( GetImageType(), URLs, aImportGraph ); - xConfigPer->store(); - - bResult = true; - break; - } - catch ( ::com::sun::star::uno::Exception& ) - { - break; - } - } - } - - return bResult; -} - -void SvxIconSelectorDialog::ImportGraphics( - const uno::Sequence< OUString >& rPaths ) -{ - uno::Sequence< OUString > rejected( rPaths.getLength() ); - sal_Int32 rejectedCount = 0; - - sal_uInt16 ret = 0; - sal_Int32 aIndex; - OUString aIconName; - uno::Sequence< OUString > URLs(1); - uno::Sequence< uno::Reference > aImportGraph( 1 ); - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") ); - uno::Reference< css::ui::XUIConfigurationPersistence > - xConfigPer( m_xImportedImageManager, uno::UNO_QUERY ); - - if ( rPaths.getLength() == 1 ) - { - if ( m_xImportedImageManager->hasImage( GetImageType(), rPaths[0] ) ) - { - aIndex = rPaths[0].lastIndexOf( '/' ); - aIconName = rPaths[0].copy( aIndex+1 ); - ret = SvxIconReplacementDialog( this, aIconName ).ShowDialog(); - if ( ret == 2 ) - { - ReplaceGraphicItem( rPaths[0] ); - } - } - else - { - if ( ImportGraphic( rPaths[0] ) == sal_False ) - { - rejected[0] = rPaths[0]; - rejectedCount = 1; - } - } - } - else - { - ::rtl::OUString aSourcePath( rPaths[0] ); - if ( rPaths[0].lastIndexOf( '/' ) != rPaths[0].getLength() -1 ) - aSourcePath = rPaths[0] + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/" ) ); - - for ( sal_Int32 i = 1; i < rPaths.getLength(); ++i ) - { - ::rtl::OUString aPath = aSourcePath + rPaths[i]; - if ( m_xImportedImageManager->hasImage( GetImageType(), aPath ) ) - { - aIndex = rPaths[i].lastIndexOf( '/' ); - aIconName = rPaths[i].copy( aIndex+1 ); - ret = SvxIconReplacementDialog( this, aIconName, sal_True ).ShowDialog(); - if ( ret == 2 ) - { - ReplaceGraphicItem( aPath ); - } - else if ( ret == 5 ) - { - for ( sal_Int32 k = i; k < rPaths.getLength(); ++k ) - { - aPath = aSourcePath + rPaths[k]; - bool bHasReplaced = ReplaceGraphicItem( aPath ); - - if ( !bHasReplaced ) - { - bool result = ImportGraphic( aPath ); - if ( result == sal_False ) - { - rejected[ rejectedCount ] = rPaths[i]; - ++rejectedCount; - } - } - } - break; - } - } - else - { - bool result = ImportGraphic( aSourcePath + rPaths[i] ); - if ( result == sal_False ) - { - rejected[ rejectedCount ] = rPaths[i]; - ++rejectedCount; - } - } - } - } - - if ( rejectedCount != 0 ) - { - OUString message; - OUString newLine(RTL_CONSTASCII_USTRINGPARAM("\n")); - OUString fPath; - if (rejectedCount > 1) - fPath = rPaths[0].copy(8) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/" ) ); - for ( sal_Int32 i = 0; i < rejectedCount; ++i ) - { - message += fPath + rejected[i]; - message += newLine; - } - - SvxIconChangeDialog aDialog(this, message); - aDialog.Execute(); - } -} - -bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL ) -{ - bool result = sal_False; - - sal_uInt16 nId = m_nNextId; - ++m_nNextId; - - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") ); - - uno::Reference< graphic::XGraphic > xGraphic; - com::sun::star::awt::Size aSize; - bool bOK = sal_True; - aMediaProps[0].Value <<= aURL; - try - { - uno::Reference< beans::XPropertySet > props = - m_xGraphProvider->queryGraphicDescriptor( aMediaProps ); - - uno::Any a = props->getPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("SizePixel")) ); - - xGraphic = m_xGraphProvider->queryGraphic( aMediaProps ); - if ( xGraphic.is() ) - { - a >>= aSize; - if ( 0 == aSize.Width || 0 == aSize.Height ) - bOK = sal_False; - - Image aImage( xGraphic ); - - if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) ) - { - BitmapEx aBitmap = aImage.GetBitmapEx(); - BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize); - aImage = Image( aBitmapex); - } - if ( bOK && !!aImage ) - { - aTbSymbol.InsertItem( nId, aImage, aURL, 0, 0 ); - - xGraphic = aImage.GetXGraphic(); - xGraphic->acquire(); - - aTbSymbol.SetItemData( - nId, static_cast< void * > ( xGraphic.get() ) ); - uno::Sequence< OUString > aImportURL( 1 ); - aImportURL[ 0 ] = aURL; - uno::Sequence< uno::Reference > aImportGraph( 1 ); - aImportGraph[ 0 ] = xGraphic; - m_xImportedImageManager->insertImages( GetImageType(), aImportURL, aImportGraph ); - uno::Reference< css::ui::XUIConfigurationPersistence > - xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY ); - - if ( xConfigPersistence.is() && xConfigPersistence->isModified() ) - { - xConfigPersistence->store(); - } - - result = sal_True; - } - else - { - OSL_TRACE("could not create Image from XGraphic"); - } - } - else - { - OSL_TRACE("could not get query XGraphic"); - } - } - catch( uno::Exception& e ) - { - OSL_TRACE("Caught exception importing XGraphic: %s", PRTSTR(e.Message)); - } - return result; -} - -/******************************************************************************* -* -* The SvxIconReplacementDialog class -* -*******************************************************************************/ -SvxIconReplacementDialog :: SvxIconReplacementDialog( - Window *pWindow, const rtl::OUString& aMessage, bool /*bYestoAll*/ ) - : -MessBox( pWindow, WB_DEF_YES, String( CUI_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ), String( CUI_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) ) - -{ - SetImage( WarningBox::GetStandardImage() ); - SetMessText( ReplaceIconName( aMessage ) ); - RemoveButton( 1 ); - AddButton( BUTTON_YES, 2, 0 ); - AddButton( String( CUI_RES( RID_SVXSTR_YESTOALL ) ), 5, 0 ); - AddButton( BUTTON_NO, 3, 0 ); - AddButton( BUTTON_CANCEL, 4, 0 ); -} - -SvxIconReplacementDialog :: SvxIconReplacementDialog( - Window *pWindow, const rtl::OUString& aMessage ) - : -MessBox( pWindow, WB_YES_NO_CANCEL, String( CUI_RES( RID_SVXSTR_REPLACE_ICON_CONFIRM ) ), String( CUI_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ) ) -{ - SetImage( WarningBox::GetStandardImage() ); - SetMessText( ReplaceIconName( aMessage )); -} - -rtl::OUString SvxIconReplacementDialog :: ReplaceIconName( const OUString& rMessage ) -{ - rtl::OUString name; - rtl::OUString message = String( CUI_RES( RID_SVXSTR_REPLACE_ICON_WARNING ) ); - rtl::OUString placeholder(RTL_CONSTASCII_USTRINGPARAM( "%ICONNAME" )); - sal_Int32 pos = message.indexOf( placeholder ); - if ( pos != -1 ) - { - name = message.replaceAt( - pos, placeholder.getLength(), rMessage ); - } - return name; -} - -sal_uInt16 SvxIconReplacementDialog :: ShowDialog() -{ - this->Execute(); - return ( this->GetCurButtonId() ); -} -/******************************************************************************* -* -* The SvxIconChangeDialog class added for issue83555 -* -*******************************************************************************/ -SvxIconChangeDialog::SvxIconChangeDialog( - Window *pWindow, const rtl::OUString& aMessage) - : - ModalDialog ( pWindow, CUI_RES( MD_ICONCHANGE ) ), - aFImageInfo (this, CUI_RES( FI_INFO ) ), - aBtnOK (this, CUI_RES(MD_BTN_OK)), - aDescriptionLabel (this, CUI_RES(FTCHGE_DESCRIPTION)), - aLineEditDescription (this, CUI_RES(EDT_ADDR)) -{ - FreeResource(); - aFImageInfo.SetImage(InfoBox::GetStandardImage()); - aLineEditDescription.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() ); - aLineEditDescription.SetAutoScroll( sal_True ); - aLineEditDescription.EnableCursor( sal_False ); - aLineEditDescription.SetText(aMessage); -} - -BitmapEx SvxIconSelectorDialog::AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize) -{ - Point aEmptyPoint(0,0); - double imgposX = 0; - double imgposY = 0; - BitmapEx aRet = aBitmap; - double imgOldWidth = aRet.GetSizePixel().Width(); - double imgOldHeight =aRet.GetSizePixel().Height(); - - Size aScaledSize; - if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize) - { - sal_Int32 imgNewWidth = 0; - sal_Int32 imgNewHeight = 0; - - if (imgOldWidth >= imgOldHeight) - { - imgNewWidth = aStandardSize; - imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5); - imgposX = 0; - imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5; - } - else - { - imgNewHeight = aStandardSize; - imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5); - imgposY = 0; - imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5; - } - - aScaledSize = Size( imgNewWidth, imgNewHeight ); - aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE ); - } - else - { - imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5; - imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5; - } - - Size aStdSize( aStandardSize, aStandardSize ); - Rectangle aRect(aEmptyPoint, aStdSize ); - - VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); - aVirDevice.SetOutputSizePixel( aStdSize ); - aVirDevice.SetFillColor( COL_TRANSPARENT ); - aVirDevice.SetLineColor( COL_TRANSPARENT ); - - //draw a rect into virDevice - aVirDevice.DrawRect( aRect ); - Point aPointPixel( (long)imgposX, (long)imgposY ); - aVirDevice.DrawBitmapEx( aPointPixel, aRet ); - aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize ); - - return aRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/cfg.hrc b/cui/source/customize/cfg.hrc deleted file mode 100644 index adda4f458..000000000 --- a/cui/source/customize/cfg.hrc +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define CFG_OFFSET 300 - -#define GRP_MENUS (9 + CFG_OFFSET) -#define FT_MENUS (10 + CFG_OFFSET) -#define LB_MENUS (11 + CFG_OFFSET) -#define BTN_NEW (12 + CFG_OFFSET) -#define BTN_CHANGE (14 + CFG_OFFSET) -#define GRP_MENU_SEPARATOR (15 + CFG_OFFSET) -#define GRP_MENU_ENTRIES (16 + CFG_OFFSET) -#define BOX_ENTRIES (17 + CFG_OFFSET) -#define BTN_CHANGE_ENTRY (18 + CFG_OFFSET) -#define BTN_UP (19 + CFG_OFFSET) -#define BTN_DOWN (20 + CFG_OFFSET) -#define FT_DESCRIPTION (22 + CFG_OFFSET) -#define TXT_SAVEIN (23 + CFG_OFFSET) -#define LB_SAVEIN (24 + CFG_OFFSET) -#define ED_DESCRIPTION (25 + CFG_OFFSET) -#define BTN_ADD_COMMANDS (26 + CFG_OFFSET) - -#define MODIFY_MENU (40 + CFG_OFFSET) -#define MODIFY_ENTRY (41 + CFG_OFFSET) -#define ID_RENAME (42 + CFG_OFFSET) -#define ID_MOVE (43 + CFG_OFFSET) -#define ID_DELETE (44 + CFG_OFFSET) -#define ID_ADD_SUBMENU (45 + CFG_OFFSET) -#define ID_BEGIN_GROUP (46 + CFG_OFFSET) -#define ID_DEFAULT_STYLE (47 + CFG_OFFSET) -#define ID_ICONS_ONLY (48 + CFG_OFFSET) -#define ID_ICONS_AND_TEXT (49 + CFG_OFFSET) -#define ID_ICON_ONLY (50 + CFG_OFFSET) -#define ID_ICON_AND_TEXT (51 + CFG_OFFSET) -#define ID_TEXT_ONLY (52 + CFG_OFFSET) -#define ID_CHANGE_SYMBOL (53 + CFG_OFFSET) -#define ID_RESET_SYMBOL (54 + CFG_OFFSET) -#define ID_DEFAULT_COMMAND (55 + CFG_OFFSET) - -#define MODIFY_TOOLBAR (60 + CFG_OFFSET) -#define MODIFY_TOOLBAR_CONTENT (61 + CFG_OFFSET) - -#define IBX_MNUCFG_ALREADY_INCLUDED (63 + CFG_OFFSET) -#define QBX_CONFIRM_RESET (64 + CFG_OFFSET) -#define QBX_CONFIRM_DELETE_MENU (65 + CFG_OFFSET) -#define QBX_CONFIRM_RESTORE_DEFAULT (66 + CFG_OFFSET) -#define QBX_CONFIRM_DELETE_TOOLBAR (67 + CFG_OFFSET) - -#define MD_MENU_ORGANISER (79 + CFG_OFFSET) -#define TXT_MENU (80 + CFG_OFFSET) -#define BOX_MAIN_MENUS (81 + CFG_OFFSET) -#define BTN_MENU_UP (82 + CFG_OFFSET) -#define BTN_MENU_DOWN (83 + CFG_OFFSET) -#define BTN_MENU_ADD (84 + CFG_OFFSET) -#define BTN_MENU_CLOSE (85 + CFG_OFFSET) -#define BTN_MENU_HELP (86 + CFG_OFFSET) -#define TXT_MENU_NAME (87 + CFG_OFFSET) -#define EDIT_MENU_NAME (88 + CFG_OFFSET) - -#define MD_ICONSELECTOR (90 + CFG_OFFSET) -#define FT_SYMBOLS (91 + CFG_OFFSET) -#define TB_SYMBOLS (92 + CFG_OFFSET) -#define FT_NOTE (93 + CFG_OFFSET) -#define BTN_IMPORT (97 + CFG_OFFSET) -#define IMAGE_BTN_COLOR (98 + CFG_OFFSET) - -#define MD_NEW_TOOLBAR (101 + CFG_OFFSET) -#define EDT_STRING (102 + CFG_OFFSET) -#define BTN_OK (103 + CFG_OFFSET) -#define BTN_CANCEL (104 + CFG_OFFSET) -#define BTN_HELP (105 + CFG_OFFSET) -#define FT_NAME (106 + CFG_OFFSET) - -#define FL_SEPARATOR (108 + CFG_OFFSET) -#define BTN_DELETE (109 + CFG_OFFSET) -//added for issue83555 -#define MD_ICONCHANGE (119 + CFG_OFFSET) -#define FTCHGE_DESCRIPTION (120 + CFG_OFFSET) -#define EDT_ADDR (121 + CFG_OFFSET) -#define MD_BTN_OK (122 + CFG_OFFSET) -#define FI_INFO (123 + CFG_OFFSET) - -//IAccessibility2 Implementation 2009----- -#define BUTTON_STR_UP (130 + CFG_OFFSET) -#define BUTTON_STR_DOWN (131 + CFG_OFFSET) -//-----IAccessibility2 Implementation 2009 diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src deleted file mode 100644 index ab205b62f..000000000 --- a/cui/source/customize/cfg.src +++ /dev/null @@ -1,899 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include "cfg.hrc" -#include "helpid.hrc" - -TabDialog RID_SVXDLG_CUSTOMIZE -{ - OutputSize = TRUE ; - Text [ de ] = "Anpassen" ; - Text [ en-US ] = "Customize" ; - Moveable = TRUE ; - SvLook = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_MENUS ; - Text [ de ] = "Menüs" ; - Text [ en-US ] = "Menus" ; - PageResID = 300 ; - }; - PageItem - { - Identifier = RID_SVXPAGE_KEYBOARD ; - Text [ de ] = "Tastatur" ; - Text [ en-US ] = "Keyboard" ; - PageResID = 301 ; - }; - PageItem - { - Identifier = RID_SVXPAGE_TOOLBARS ; - Text [ de ] = "Symbolleisten" ; - Text [ en-US ] = "Toolbars" ; - PageResID = 302 ; - }; - PageItem - { - Identifier = RID_SVXPAGE_EVENTS ; - Text [ de ] = "Ereignisse" ; - Text [ en-US ] = "Events" ; - PageResID = 303 ; - }; - }; - }; -}; - -#define TEXT_MENU \ - Text [ de ] = "Menü" ; \ - Text [ en-US ] = "Menu" ;\ - -#define TEXT_BEGIN_GROUP \ - Text [ de ] = "Gruppe beginnen" ; \ - Text [ en-US ] = "Begin a Group" ;\ - -#define TEXT_RENAME \ - Text [ de ] = "Umbenennen..." ; \ - Text [ en-US ] = "Rename..." ;\ - -#define TEXT_DELETE \ - Text [ de ] = "Entfernen..." ; \ - Text [ en-US ] = "Delete..." ;\ - -#define TEXT_DELETE_NODOTS \ - Text [ de ] = "Entfernen" ; \ - Text [ en-US ] = "Delete" ;\ - -#define TEXT_MOVE \ - Text [ de ] = "Verschieben..." ; \ - Text [ en-US ] = "Move..." ;\ - -#define TEXT_DEFAULT_STYLE \ - Text [ de ] = "Standard Einstellungen herstellen" ; \ - Text [ en-US ] = "Restore Default Settings" ;\ - -#define TEXT_DEFAULT_COMMAND \ - Text [ de ] = "Standardbefehl ~wiederherstellen" ; \ - Text [ en-US ] = "Restore Default Command" ;\ - -#define TEXT_TEXT_ONLY \ - Text [ de ] = "Nur Text" ; \ - Text [ en-US ] = "Text only" ;\ - -#define TEXT_TOOLBAR_NAME \ - Text [ de ] = "Name der Symbolleiste" ; \ - Text [ en-US ] = "Toolbar Name" ;\ - -#define TEXT_SAVE_IN \ - Text [ de ] = "Speichern in" ; \ - Text [ en-US ] = "Save In" ;\ - -TabPage RID_SVXPAGE_MENUS -{ - Hide = TRUE ; - Size = MAP_APPFONT ( 273 , 258 ) ; - HelpId = HID_SVX_CONFIG_MENU ; - FixedLine GRP_MENUS - { - Pos = MAP_APPFONT ( 6 , 11 ) ; - Size = MAP_APPFONT ( 261 , 8 ) ; - Text [ de ] = "%PRODUCTNAME %MODULENAME Menüs" ; - Text [ en-US ] = "%PRODUCTNAME %MODULENAME Menus" ; - }; - FixedText FT_MENUS - { - Pos = MAP_APPFONT ( 9 , 24 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - TEXT_MENU - }; - ListBox LB_MENUS - { - HelpID = "cui:ListBox:RID_SVXPAGE_MENUS:LB_MENUS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 64 , 22 ) ; - Size = MAP_APPFONT ( 108 , 108 ) ; - DropDown = TRUE ; - }; - PushButton BTN_NEW - { - HelpID = "cui:PushButton:RID_SVXPAGE_MENUS:BTN_NEW"; - Pos = MAP_APPFONT ( 192 , 22 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Text [ de ] = "Neu..." ; - Text [ en-US ] = "New..." ; - }; - MenuButton BTN_CHANGE - { - HelpID = "cui:MenuButton:RID_SVXPAGE_MENUS:BTN_CHANGE"; - Pos = MAP_APPFONT ( 192 , 39 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - TEXT_MENU - }; - FixedLine GRP_MENU_SEPARATOR - { - Pos = MAP_APPFONT ( 6 , 56 ) ; - Size = MAP_APPFONT ( 261 , 8 ) ; - Text [ de ] = "Menüinhalt" ; - Text [ en-US ] = "Menu Content" ; - }; - FixedText GRP_MENU_ENTRIES - { - Pos = MAP_APPFONT ( 9 , 67 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Group = TRUE ; - Text [ de ] = "Einträge" ; - Text [ en-US ] = "Entries" ; - }; - Control BOX_ENTRIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 64 , 67 ) ; - Size = MAP_APPFONT ( 108 , 115 ) ; - TabStop = TRUE ; - HelpId = HID_SVX_CONFIG_MENU_CONTENTS ; - }; - PushButton BTN_ADD_COMMANDS - { - HelpID = "cui:PushButton:RID_SVXPAGE_MENUS:BTN_ADD_COMMANDS"; - Pos = MAP_APPFONT ( 192 , 67 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Text [ de ] = "Hinzufügen..." ; - Text [ en-US ] = "Add..." ; - }; - MenuButton BTN_CHANGE_ENTRY - { - HelpID = "cui:MenuButton:RID_SVXPAGE_MENUS:BTN_CHANGE_ENTRY"; - Pos = MAP_APPFONT ( 192 , 84 ) ; - Size = MAP_APPFONT ( 75 , 14 ) ; - TabStop = TRUE ; - Text [ de ] = "Ändern" ; - Text [ en-US ] = "Modify" ; - }; - ImageButton BTN_UP - { - HelpID = "cui:ImageButton:RID_SVXPAGE_MENUS:BTN_UP"; - Pos = MAP_APPFONT ( 175 , 102 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_UP ; - Disable = TRUE ; - }; - ImageButton BTN_DOWN - { - HelpID = "cui:ImageButton:RID_SVXPAGE_MENUS:BTN_DOWN"; - Pos = MAP_APPFONT ( 175 , 119 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_DOWN ; - Disable = TRUE ; - }; - FixedText TXT_SAVEIN - { - Pos = MAP_APPFONT ( 9 , 190 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Group = TRUE ; - TEXT_SAVE_IN - }; - ListBox LB_SAVEIN - { - HelpID = "cui:ListBox:RID_SVXPAGE_MENUS:LB_SAVEIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 64 , 188 ) ; - Size = MAP_APPFONT ( 108 , 53 ) ; - DropDown = TRUE ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 205 ) ; - Size = MAP_APPFONT ( 261 , 8 ) ; - Text [ de ] = "Beschreibung" ; - Text [ en-US ] = "Description" ; - }; - MultiLineEdit ED_DESCRIPTION - { - HelpID = "cui:MultiLineEdit:RID_SVXPAGE_MENUS:ED_DESCRIPTION"; - Pos = MAP_APPFONT ( 6 , 216 ) ; - Size = MAP_APPFONT ( 261 , 36 ) ; - Border = TRUE; - VScroll = TRUE; - IgnoreTab = TRUE; - ReadOnly = TRUE; - }; -}; - -Menu MODIFY_MENU -{ - ItemList = - { - MenuItem - { - Identifier = ID_MOVE ; - TEXT_MOVE - }; - MenuItem - { - Identifier = ID_RENAME ; - TEXT_RENAME - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_DELETE ; - TEXT_DELETE - }; - }; -}; - -Menu MODIFY_ENTRY -{ - ItemList = - { - MenuItem - { - Identifier = ID_ADD_SUBMENU ; - Text [ de ] = "Untermenü einfügen..." ; - Text [ en-US ] = "Add Submenu..." ; - }; - MenuItem - { - Identifier = ID_BEGIN_GROUP ; - TEXT_BEGIN_GROUP - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_RENAME ; - TEXT_RENAME - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_DELETE ; - TEXT_DELETE_NODOTS - }; - }; -}; - -Menu MODIFY_TOOLBAR -{ - ItemList = - { - MenuItem - { - Identifier = ID_RENAME ; - TEXT_RENAME - }; - MenuItem - { - Identifier = ID_DELETE ; - TEXT_DELETE_NODOTS - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_DEFAULT_STYLE ; - TEXT_DEFAULT_STYLE - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_ICONS_ONLY ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - Text [ de ] = "Nur Symbole" ; - Text [ en-US ] = "Icons Only" ; - }; - MenuItem - { - Identifier = ID_TEXT_ONLY ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - TEXT_TEXT_ONLY - }; - MenuItem - { - Identifier = ID_ICONS_AND_TEXT ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - Text [ de ] = "Symbole & Text" ; - Text [ en-US ] = "Icons & Text" ; - }; - }; -}; - -Menu MODIFY_TOOLBAR_CONTENT -{ - ItemList = - { - MenuItem - { - Identifier = ID_RENAME ; - TEXT_RENAME - }; - MenuItem - { - Identifier = ID_DELETE ; - TEXT_DELETE_NODOTS - }; - MenuItem - { - Identifier = ID_DEFAULT_COMMAND ; - TEXT_DEFAULT_COMMAND - }; - MenuItem - { - Separator = TRUE ; - }; - MenuItem - { - Identifier = ID_BEGIN_GROUP ; - TEXT_BEGIN_GROUP - }; - MenuItem - { - Separator = TRUE ; - }; - /* - MenuItem - { - Identifier = ID_ICON_ONLY ; - Text [ de ] = "Nur Symbol" ; - Text [ en-US ] = "Icon Only" ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - }; - MenuItem - { - Identifier = ID_TEXT_ONLY ; - Text [ de ] = "Nur Text" ; - Text [ en-US ] = "Text Only" ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - }; - MenuItem - { - Identifier = ID_ICON_AND_TEXT ; - Text [ de ] = "Symbol & Text" ; - Text [ en-US ] = "Icon & Text" ; - RadioCheck = TRUE ; - AutoCheck = TRUE ; - }; - MenuItem - { - Separator = TRUE ; - }; - */ - MenuItem - { - Identifier = ID_CHANGE_SYMBOL ; - Text [ de ] = "Symbol austauschen..." ; - Text [ en-US ] = "Change Icon..." ; - }; - MenuItem - { - Identifier = ID_RESET_SYMBOL ; - Text [ de ] = "Symbol zurücksetzen" ; - Text [ en-US ] = "Reset Icon" ; - }; - }; -}; - -/* %n will be replaced at runtime by a number starting with 1 and increasing as necessary */ -String RID_SVXSTR_NEW_MENU -{ - Text [ de ] = "Neues Menü %n"; - Text [ en-US ] = "New Menu %n"; -}; - -/* %n will be replaced at runtime by a number starting with 1 and increasing as necessary */ -String RID_SVXSTR_NEW_TOOLBAR -{ - Text [ de ] = "Neue Symbolleiste %n"; - Text [ en-US ] = "New Toolbar %n"; -}; - -String RID_SVXSTR_MOVE_MENU -{ - Text [ de ] = "Menü verschieben"; - Text [ en-US ] = "Move Menu"; -}; - -String RID_SVXSTR_ADD_SUBMENU -{ - Text [ de ] = "Untermenü hinzufügen"; - Text [ en-US ] = "Add Submenu"; -}; - -String RID_SVXSTR_SUBMENU_NAME -{ - Text [ de ] = "Name des Untermenüs"; - Text [ en-US ] = "Submenu name"; -}; - -String RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION -{ - Text [ de ] = "Um Befehle einem menu hinzuzufügen, wählen Sie zuerst eine Kategorie und dann den Befehl. Alternativ ziehen Sie den Befehl in die Befehlsliste auf der Registerseite 'Menüs' im Dialog 'Anpassen'."; - Text [ en-US ] = "To add a command to a menu, select the category and then the command. You can also drag the command to the Commands list of the Menus tab page in the Customize dialog."; -}; - -ModalDialog MD_MENU_ORGANISER -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 172 , 154 ) ; - Text [ de ] = "Neues Menü" ; - Text [ en-US ] = "New Menu" ; - SvLook = TRUE ; - Moveable = TRUE ; - HelpId = HID_SVX_CONFIG_MENU_ORGANIZER; - FixedText TXT_MENU_NAME - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 93 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ de ] = "Menüname" ; - Text [ en-US ] = "Menu name" ; - }; - Edit EDIT_MENU_NAME - { - HelpID = "cui:Edit:MD_MENU_ORGANISER:EDIT_MENU_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 93 , 12 ) ; - TabStop = TRUE ; - }; - FixedText TXT_MENU - { - Pos = MAP_APPFONT ( 6 , 37 ) ; - Size = MAP_APPFONT ( 93 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ de ] = "Menüposition" ; - Text [ en-US ] = "Menu position" ; - }; - Control BOX_MAIN_MENUS - { - HelpId = HID_SVX_CONFIG_MENU_LISTBOX ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 93 , 100 ) ; - TabStop = TRUE ; - }; - ImageButton BTN_MENU_UP - { - HelpID = "cui:ImageButton:MD_MENU_ORGANISER:BTN_MENU_UP"; - Pos = MAP_APPFONT ( 102 , 80 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_UP ; - }; - ImageButton BTN_MENU_DOWN - { - HelpID = "cui:ImageButton:MD_MENU_ORGANISER:BTN_MENU_DOWN"; - Pos = MAP_APPFONT ( 102 , 97 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TabStop = TRUE ; - Symbol = IMAGEBUTTON_ARROW_DOWN ; - }; - OKButton BTN_MENU_ADD - { - DefButton = TRUE; - Pos = MAP_APPFONT ( 119 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - CancelButton BTN_MENU_CLOSE - { - Pos = MAP_APPFONT ( 119 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_MENU_HELP - { - Pos = MAP_APPFONT ( 119 , 40 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -// MD_NEW_TOOLBAR ------------------------------------------------- -ModalDialog MD_NEW_TOOLBAR -{ - HelpID = "cui:ModalDialog:MD_NEW_TOOLBAR"; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 165 , 63 ) ; - Text [ de ] = "Name" ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 98 , 8 ) ; - TEXT_TOOLBAR_NAME - WordBreak = TRUE ; - }; - Edit EDT_STRING - { - HelpID = "cui:Edit:MD_NEW_TOOLBAR:EDT_STRING"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 97 , 12 ) ; - TabStop = TRUE ; - }; - FixedText TXT_SAVEIN - { - Pos = MAP_APPFONT ( 6 , 35 ) ; - Size = MAP_APPFONT ( 98 , 8 ) ; - Group = TRUE ; - TEXT_SAVE_IN - }; - ListBox LB_SAVEIN - { - HelpID = "cui:ListBox:MD_NEW_TOOLBAR:LB_SAVEIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 97 , 53 ) ; - DropDown = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 109 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 109 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 109 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -#ifndef IMAGE_STDBTN_COLOR -#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } -#endif - -ModalDialog MD_ICONSELECTOR -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 240 , 152 ) ; - Text [ de ] = "Symbole Austauschen" ; - Text [ en-US ] = "Change Icon" ; - Moveable = TRUE ; - HelpId = HID_SVX_CONFIG_ICON_SELECTOR; - FixedText FT_SYMBOLS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 172 , 8 ) ; - Text [ de ] = "Symbole" ; - Text [ en-US ] = "Icons" ; - }; - ToolBox TB_SYMBOLS - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 160 , 80 ) ; - Scroll = TRUE ; - LineSpacing = TRUE ; - Customize = FALSE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 60 , 130 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 120 , 130 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 180 , 130 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_IMPORT - { - HelpID = "cui:PushButton:MD_ICONSELECTOR:BTN_IMPORT"; - Pos = MAP_APPFONT ( 184 , 7 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ de ] = "Importieren..." ; - Text[ en-US ] = "Import..."; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:MD_ICONSELECTOR:BTN_DELETE"; - Pos = MAP_APPFONT ( 184 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Delete..."; - }; - FixedText FT_NOTE - { - Pos = MAP_APPFONT ( 12 , 95 ) ; - Size = MAP_APPFONT ( 200 , 24 ) ; - Text [ de ] = "Hinweis:\nBitte beachten Sie das für einen erfolgreichen Import die Symbole eine Größe von 16x16 Pixel haben müssen." ; - Text [ en-US ] = "Note:\nThe size of an icon should be 16x16 pixel to achieve best quality. Different sized icons will be scaled automatically." ; - Left = TRUE ; - WordBreak = TRUE; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 0, 120 ); - Size = MAP_APPFONT ( 240, 8 ); - }; - Color IMAGE_BTN_COLOR - { - Red = 0xC000 ; - Green = 0xC000 ; - Blue = 0xC000 ; - }; -}; -//added for issue83555 -ModalDialog MD_ICONCHANGE -{ - HelpID = "cui:ModalDialog:MD_ICONCHANGE"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 200 , 150 ) ; - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION" ; - Moveable = TRUE ; - FixedImage FI_INFO - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 24 , 24 ) ; - Fixed = Image - { - - }; - }; - FixedText FTCHGE_DESCRIPTION - { - Pos = MAP_APPFONT ( 30 ,15 ) ; - Size = MAP_APPFONT ( 200 , 50 ) ; - Text [ en-US ] = "The files listed below could not be imported.\nThe file format could not be interpreted." ; - }; - - MultiLineEdit EDT_ADDR - { - HelpID = "cui:MultiLineEdit:MD_ICONCHANGE:EDT_ADDR"; - Pos = MAP_APPFONT ( 30 , 38) ; - Size = MAP_APPFONT ( 140 , 83 ) ; - Border = TRUE; - // VScroll = TRUE; - IgnoreTab = TRUE; - ReadOnly = TRUE; - }; - OKButton MD_BTN_OK - { - Pos = MAP_APPFONT ( 68 , 131 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - -}; - -// Strings --------------------------------------------------------------- -String RID_SVXSTR_IMPORT_ICON_ERROR -{ - Text [ de ] = "Die aufgelisteten Dateien konnten nicht importiert werden. Die Symbole entsprechen nicht der Größe von 16x16 Pixel." ; - Text [ en-US ] = "The files listed below could not be imported. The file format could not be interpreted." ; -}; - -String RID_SVXSTR_DELETE_ICON_CONFIRM //added for issue73355 -{ - Text [ en-US ] = "Are you sure to delete the image?" ; -}; - -String RID_SVXSTR_REPLACE_ICON_WARNING //added for issue73355 -{ - Text [ en-US ] = "The icon %ICONNAME is already contained in the image list.\nWould you like to replace the existing icon?"; -}; - -String RID_SVXSTR_REPLACE_ICON_CONFIRM //added for issue73355 -{ - Text [ en-US ] = "Confirm Icon Replacement"; -}; - -String RID_SVXSTR_YESTOALL //added for issue73355 -{ - Text [ en-US ] = "Yes to All"; -}; - -String RID_SVXSTR_PRODUCTNAME_TOOLBARS -{ - Text [ de ] = "%PRODUCTNAME %MODULENAME Symbolleisten" ; - Text [ en-US ] = "%PRODUCTNAME %MODULENAME Toolbars" ; -}; - -String RID_SVXSTR_TOOLBAR -{ - Text [ de ] = "Symbolleiste" ; - Text [ en-US ] = "Toolbar" ; -}; - -String RID_SVXSTR_TOOLBAR_CONTENT -{ - Text [ de ] = "Symbolleisteninhalt" ; - Text [ en-US ] = "Toolbar Content" ; -}; - -String RID_SVXSTR_COMMANDS -{ - Text [ de ] = "Befehle" ; - Text [ en-US ] = "Commands" ; -}; - -String RID_SVXSTR_COMMAND -{ - Text [ de ] = "Befehl" ; - Text [ en-US ] = "Command" ; -}; - -String RID_SVXSTR_TOOLBAR_NAME -{ - TEXT_TOOLBAR_NAME -}; - -/* %MENUNAME will be replaced at runtime by the name of the selected menu. */ -QueryBox QBX_CONFIRM_DELETE_MENU -{ - Message [ de ] = "Sind Sie sicher, dass Sie das Menü '%MENUNAME' löschen möchten?"; - Message [ en-US ] = "Are you sure you want to delete the '%MENUNAME' menu?"; - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; -}; - -QueryBox QBX_CONFIRM_DELETE_TOOLBAR -{ - Message [ de ] = "Die Symbolleiste beinhaltet keine Befehle mehr. Soll die Symbolleiste gelöscht werden?"; - Message [ en-US ] = "There are no more commands on the toolbar. Do you want to delete the toolbar?"; - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; -}; - -/* Translators: Do not translate %SAVE IN SELECTION% It is a placeholder and will be - replaced at runtime by the name of the selected application or document. -*/ -QueryBox QBX_CONFIRM_RESET -{ - Message [ de ] = "Die Menükonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?"; - Message [ en-US ] = "The menu configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?"; - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; -}; - -/* Translators: Do not translate %SAVE IN SELECTION% It is a placeholder - and will be replaced at runtime by the name of the selected application - or document. -*/ -String RID_SVXSTR_CONFIRM_MENU_RESET -{ - Text [ de ] = "Die Menükonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?"; - Text [ en-US ] = "The menu configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?"; -}; - -String RID_SVXSTR_CONFIRM_TOOLBAR_RESET -{ - Text [ de ] = "Die Symbolleistenkonfiguration für %SAVE IN SELECTION% wird auf die Standardeinstellung zurückgesetzt. Möchten Sie fortfahren?"; - Text [ en-US ] = "The toolbar configuration for %SAVE IN SELECTION% will be reset to the factory settings. Do you want to continue?"; -}; - -QueryBox QBX_CONFIRM_RESTORE_DEFAULT -{ - Message [ de ] = "Alle Anpassungen die an dieser Symbolleiste vorgenommen wurden werden gelöscht. Möchten Sie diese Symbolleiste wirklich zurücksetzen?"; - Message [ en-US ] = "This will delete all changes previously made to this toolbar. Do you really want to reset the toolbar?"; - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; -}; - -InfoBox IBX_MNUCFG_ALREADY_INCLUDED -{ - Message [ de ] = "Die Funktion ist bereits in diesem Popup enthalten." ; - Message [ en-US ] = "Function is already included in this popup." ; -}; - -String RID_SVXSTR_LABEL_NEW_NAME -{ - Text [ de ] = "~Neuer Name"; - Text [ en-US ] = "~New name"; -}; - -String RID_SVXSTR_RENAME_MENU -{ - Text [ de ] = "Menü umbenennen"; - Text [ en-US ] = "Rename Menu"; -}; - -String RID_SVXSTR_RENAME_TOOLBAR -{ - Text [ de ] = "Symbolleiste umbenennen"; - Text [ en-US ] = "Rename Toolbar"; -}; - -String BUTTON_STR_UP -{ - Text [ en-US ] = "Up"; -}; -String BUTTON_STR_DOWN -{ - Text [ en-US ] = "Down"; -}; - diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx deleted file mode 100644 index a1203254a..000000000 --- a/cui/source/customize/cfgutil.cxx +++ /dev/null @@ -1,1261 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cfgutil.hxx" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "acccfg.hrc" -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include "cuires.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include "dialmgr.hxx" -#include - -#define _SVSTDARR_STRINGSDTOR -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::script; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; -namespace css = ::com::sun::star; - -static ::rtl::OUString SERVICE_UICATEGORYDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UICategoryDescription") ); -static ::rtl::OUString SERVICE_UICMDDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription") ); - -SfxStylesInfo_Impl::SfxStylesInfo_Impl() -{} - -void SfxStylesInfo_Impl::setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel) -{ - m_xDoc = xModel; -} - -static ::rtl::OUString FAMILY_CHARACTERSTYLE (RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); -static ::rtl::OUString FAMILY_PARAGRAPHSTYLE (RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); -static ::rtl::OUString FAMILY_FRAMESTYLE (RTL_CONSTASCII_USTRINGPARAM("FrameStyles" ) ); -static ::rtl::OUString FAMILY_PAGESTYLE (RTL_CONSTASCII_USTRINGPARAM("PageStyles" ) ); -static ::rtl::OUString FAMILY_NUMBERINGSTYLE (RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ); - -static ::rtl::OUString CMDURL_SPART (RTL_CONSTASCII_USTRINGPARAM(".uno:StyleApply?Style:string=") ); -static ::rtl::OUString CMDURL_FPART2 (RTL_CONSTASCII_USTRINGPARAM("&FamilyName:string=") ); - -static ::rtl::OUString CMDURL_STYLEPROT_ONLY (RTL_CONSTASCII_USTRINGPARAM(".uno:StyleApply?") ); -static ::rtl::OUString CMDURL_SPART_ONLY (RTL_CONSTASCII_USTRINGPARAM("Style:string=") ); -static ::rtl::OUString CMDURL_FPART_ONLY (RTL_CONSTASCII_USTRINGPARAM("FamilyName:string=") ); - -static ::rtl::OUString STYLEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("DisplayName") ); - -::rtl::OUString SfxStylesInfo_Impl::generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle) -{ - ::rtl::OUStringBuffer sCommand(1024); - sCommand.append(CMDURL_SPART ); - sCommand.append(sStyle ); - sCommand.append(CMDURL_FPART2); - sCommand.append(sFamily ); - return sCommand.makeStringAndClear(); -} - -sal_Bool SfxStylesInfo_Impl::parseStyleCommand(SfxStyleInfo_Impl& aStyle) -{ - static sal_Int32 LEN_STYLEPROT = CMDURL_STYLEPROT_ONLY.getLength(); - static sal_Int32 LEN_SPART = CMDURL_SPART_ONLY.getLength(); - static sal_Int32 LEN_FPART = CMDURL_FPART_ONLY.getLength(); - - if (aStyle.sCommand.indexOf(CMDURL_STYLEPROT_ONLY, 0) != 0) - return sal_False; - - aStyle.sFamily = ::rtl::OUString(); - aStyle.sStyle = ::rtl::OUString(); - - sal_Int32 nCmdLen = aStyle.sCommand.getLength(); - ::rtl::OUString sCmdArgs = aStyle.sCommand.copy(LEN_STYLEPROT, nCmdLen-LEN_STYLEPROT); - sal_Int32 i = sCmdArgs.indexOf('&'); - if (i<0) - return sal_False; - - ::rtl::OUString sArg = sCmdArgs.copy(0, i); - if (sArg.indexOf(CMDURL_SPART_ONLY) == 0) - aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART); - else - if (sArg.indexOf(CMDURL_FPART_ONLY) == 0) - aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART); - - sArg = sCmdArgs.copy(i+1, sCmdArgs.getLength()-i-1); - if (sArg.indexOf(CMDURL_SPART_ONLY) == 0) - aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART); - else - if (sArg.indexOf(CMDURL_FPART_ONLY) == 0) - aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART); - - if (aStyle.sFamily.getLength() && aStyle.sStyle.getLength()) - return sal_True; - - return sal_False; -} - -void SfxStylesInfo_Impl::getLabel4Style(SfxStyleInfo_Impl& aStyle) -{ - try - { - css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY); - - css::uno::Reference< css::container::XNameAccess > xFamilies; - if (xModel.is()) - xFamilies = xModel->getStyleFamilies(); - - css::uno::Reference< css::container::XNameAccess > xStyleSet; - if (xFamilies.is()) - xFamilies->getByName(aStyle.sFamily) >>= xStyleSet; - - css::uno::Reference< css::beans::XPropertySet > xStyle; - if (xStyleSet.is()) - xStyleSet->getByName(aStyle.sStyle) >>= xStyle; - - aStyle.sLabel = ::rtl::OUString(); - if (xStyle.is()) - xStyle->getPropertyValue(STYLEPROP_UINAME) >>= aStyle.sLabel; - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { aStyle.sLabel = ::rtl::OUString(); } - - if (!aStyle.sLabel.getLength()) - { - aStyle.sLabel = aStyle.sCommand; - } -} - -::std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyleFamilies() -{ - // Its an optional interface! - css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY); - if (!xModel.is()) - return ::std::vector< SfxStyleInfo_Impl >(); - - css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies(); - css::uno::Sequence< ::rtl::OUString > lFamilyNames = xCont->getElementNames(); - ::std::vector< SfxStyleInfo_Impl > lFamilies; - sal_Int32 c = lFamilyNames.getLength(); - sal_Int32 i = 0; - for(i=0; i xFamilyInfo; - xCont->getByName(aFamilyInfo.sFamily) >>= xFamilyInfo; - if (!xFamilyInfo.is()) - { - // TODO_AS currently there is no support for an UIName property .. use internal family name instead - aFamilyInfo.sLabel = aFamilyInfo.sFamily; - } - else - xFamilyInfo->getPropertyValue(STYLEPROP_UINAME) >>= aFamilyInfo.sLabel; - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { return ::std::vector< SfxStyleInfo_Impl >(); } - - lFamilies.push_back(aFamilyInfo); - } - - return lFamilies; -} - -::std::vector< SfxStyleInfo_Impl > SfxStylesInfo_Impl::getStyles(const ::rtl::OUString& sFamily) -{ - static ::rtl::OUString PROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("DisplayName") ); - - css::uno::Sequence< ::rtl::OUString > lStyleNames; - css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(m_xDoc, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameAccess > xFamilies = xModel->getStyleFamilies(); - css::uno::Reference< css::container::XNameAccess > xStyleSet; - try - { - xFamilies->getByName(sFamily) >>= xStyleSet; - lStyleNames = xStyleSet->getElementNames(); - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { return ::std::vector< SfxStyleInfo_Impl >(); } - - ::std::vector< SfxStyleInfo_Impl > lStyles; - sal_Int32 c = lStyleNames.getLength(); - sal_Int32 i = 0; - for (i=0; i xStyle; - xStyleSet->getByName(aStyleInfo.sStyle) >>= xStyle; - if (!xStyle.is()) - continue; - xStyle->getPropertyValue(PROP_UINAME) >>= aStyleInfo.sLabel; - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { continue; } - - lStyles.push_back(aStyleInfo); - } - return lStyles; -} -SV_IMPL_PTRARR(SfxGroupInfoArr_Impl, SfxGroupInfoPtr); -SfxConfigFunctionListBox_Impl::SfxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId) - : SvTreeListBox( pParent, rResId ) - , pCurEntry( 0 ) - , pStylesInfo( 0 ) -{ - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); - GetModel()->SetSortMode( SortAscending ); - - // Timer for the BallonHelp - aTimer.SetTimeout( 200 ); - aTimer.SetTimeoutHdl( - LINK( this, SfxConfigFunctionListBox_Impl, TimerHdl ) ); -} - -SfxConfigFunctionListBox_Impl::~SfxConfigFunctionListBox_Impl() -{ - ClearAll(); -} - -void SfxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& ) -{ -} - -IMPL_LINK( SfxConfigFunctionListBox_Impl, TimerHdl, Timer*, pTimer) -/* Beschreibung - Timer-Handler f"ur die Einblendung eines Hilfetextes. Wenn nach Ablauf des Timers - der Mauszeiger immer noch auf dem aktuell selektierten Eintrag steht, wird der - Helptext des Entries als Balloon-Help eingeblendet. -*/ -{ - (void)pTimer; // unused - return 0L; -} - -void SfxConfigFunctionListBox_Impl::ClearAll() -/* Beschreibung - L"oscht alle Eintr"age in der FunctionListBox, alle UserDaten und alle evtl. - vorhandenen MacroInfos. -*/ -{ - sal_uInt16 nCount = aArr.Count(); - for ( sal_uInt16 i=0; inKind == SFX_CFGFUNCTION_SCRIPT ) - { - String* pScriptURI = (String*)pData->pObject; - delete pScriptURI; - } - - if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER - ) - { - XInterface* xi = static_cast(pData->pObject); - if (xi != NULL) - { - xi->release(); - } - } - - delete pData; - } - - aArr.Remove( 0, nCount ); - Clear(); -} - -String SfxConfigFunctionListBox_Impl::GetSelectedScriptURI() -{ - SvLBoxEntry *pEntry = FirstSelected(); - if ( pEntry ) - { - SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if ( pData && ( pData->nKind == SFX_CFGFUNCTION_SCRIPT ) ) - return *(String*)pData->pObject; - } - return String(); -} - -String SfxConfigFunctionListBox_Impl::GetCurCommand() -{ - SvLBoxEntry *pEntry = FirstSelected(); - if (!pEntry) - return String(); - SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if (!pData) - return String(); - return pData->sCommand; -} - -String SfxConfigFunctionListBox_Impl::GetCurLabel() -{ - SvLBoxEntry *pEntry = FirstSelected(); - if (!pEntry) - return String(); - SfxGroupInfo_Impl *pData = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if (!pData) - return String(); - if (pData->sLabel.Len()) - return pData->sLabel; - return pData->sCommand; -} - -void SfxConfigFunctionListBox_Impl::FunctionSelected() -/* Beschreibung - Setzt die Balloonhelp zur"uck, da diese immer den Helptext des selektierten - Entry anzeigen soll. -*/ -{ -} - -void SfxConfigFunctionListBox_Impl::SetStylesInfo(SfxStylesInfo_Impl* pStyles) -{ - pStylesInfo = pStyles; -} - -struct SvxConfigGroupBoxResource_Impl : public Resource -{ - Image m_hdImage; - Image m_libImage; - Image m_macImage; - Image m_docImage; - ::rtl::OUString m_sMyMacros; - ::rtl::OUString m_sProdMacros; - String m_sMacros; - String m_sDlgMacros; - String m_aHumanAppName; - String m_aStrGroupStyles; - Image m_collapsedImage; - Image m_expandedImage; - - SvxConfigGroupBoxResource_Impl(); -}; - -SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() : - Resource(CUI_RES(RID_SVXPAGE_CONFIGGROUPBOX)), - m_hdImage(CUI_RES(IMG_HARDDISK)), - m_libImage(CUI_RES(IMG_LIB)), - m_macImage(CUI_RES(IMG_MACRO)), - m_docImage(CUI_RES(IMG_DOC)), - m_sMyMacros(String(CUI_RES(STR_MYMACROS))), - m_sProdMacros(String(CUI_RES(STR_PRODMACROS))), - m_sMacros(String(CUI_RES(STR_BASICMACROS))), - m_sDlgMacros(String(CUI_RES(STR_DLG_MACROS))), - m_aHumanAppName(String(CUI_RES(STR_HUMAN_APPNAME))), - m_aStrGroupStyles(String(CUI_RES(STR_GROUP_STYLES))), - m_collapsedImage(CUI_RES(BMP_COLLAPSED)), - m_expandedImage(CUI_RES(BMP_EXPANDED)) -{ - FreeResource(); -} - -SfxConfigGroupListBox_Impl::SfxConfigGroupListBox_Impl( - Window* pParent, const ResId& rResId, sal_uLong nConfigMode ) - : SvTreeListBox( pParent, rResId ) - , pImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(0), nMode( nConfigMode ), pStylesInfo(0) -{ - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); - SetNodeBitmaps( pImp->m_collapsedImage, pImp->m_expandedImage ); -} - - -SfxConfigGroupListBox_Impl::~SfxConfigGroupListBox_Impl() -{ - ClearAll(); -} - -void SfxConfigGroupListBox_Impl::ClearAll() -{ - sal_uInt16 nCount = aArr.Count(); - for ( sal_uInt16 i=0; inKind == SFX_CFGGROUP_SCRIPTCONTAINER - ) - { - XInterface* xi = static_cast(pData->pObject); - if (xi != NULL) - { - xi->release(); - } - } - delete pData; - } - - aArr.Remove( 0, nCount ); - Clear(); -} - -void SfxConfigGroupListBox_Impl::SetStylesInfo(SfxStylesInfo_Impl* pStyles) -{ - pStylesInfo = pStyles; -} - -String SfxConfigGroupListBox_Impl::GetGroup() -/* Beschreibung - Gibt den Namen der selektierten Funktionsgruppe bzw. des selektierten - Basics zur"uck. -*/ -{ - SvLBoxEntry *pEntry = FirstSelected(); - while ( pEntry ) - { - SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - if ( pInfo->nKind == SFX_CFGGROUP_FUNCTION ) - return GetEntryText( pEntry ); - - pEntry = GetParent( pEntry ); - } - - return String(); -} - -//----------------------------------------------- -void SfxConfigGroupListBox_Impl::InitModule() -{ - try - { - css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider(m_xFrame, css::uno::UNO_QUERY_THROW); - css::uno::Sequence< sal_Int16 > lGroups = xProvider->getSupportedCommandGroups(); - sal_Int32 c1 = lGroups.getLength(); - sal_Int32 i1 = 0; - - for (i1=0; i1getByName(sGroupID) >>= sGroupName; - if (!sGroupName.getLength()) - continue; - } - catch(const css::container::NoSuchElementException&) - { continue; } - - SvLBoxEntry* pEntry = InsertEntry(sGroupName, NULL); - SfxGroupInfo_Impl* pInfo = new SfxGroupInfo_Impl(SFX_CFGGROUP_FUNCTION, rGroupID); - pEntry->SetUserData(pInfo); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} -} - -//----------------------------------------------- -void SfxConfigGroupListBox_Impl::InitBasic() -{ -} - -//----------------------------------------------- -void SfxConfigGroupListBox_Impl::InitStyles() -{ -} - -//----------------------------------------------- -namespace -{ - //........................................... - /** examines a component whether it supports XEmbeddedScripts, or provides access to such a - component by implementing XScriptInvocationContext. - @return - the model which supports the embedded scripts, or if it cannot find such a - model - */ - static Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent ) - { - Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY ); - if ( !xScripts.is() ) - { - Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY ); - if ( xContext.is() ) - xScripts.set( xContext->getScriptContainer(), UNO_QUERY ); - } - - return Reference< XModel >( xScripts, UNO_QUERY ); - } - - //........................................... - static Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame ) - { - Reference< XModel > xDocument; - - // examine our associated frame - try - { - OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" ); - if ( _rxFrame.is() ) - { - // first try the model in the frame - Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW ); - xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() ); - - if ( !xDocument.is() ) - { - // if there is no suitable document in the frame, try the controller - xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() ); - } - } - } - catch( const Exception& ) - { - } - - return xDocument; - } -} - -//----------------------------------------------- -void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xFrame , - const ::rtl::OUString& sModuleLongName) -{ - SetUpdateMode(sal_False); - ClearAll(); // Remove all old entries from treelist box - - m_xFrame = xFrame; - if ( xSMGR.is()) - { - m_xSMGR = xSMGR; - m_sModuleLongName = sModuleLongName; - - m_xGlobalCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICATEGORYDESCRIPTION), css::uno::UNO_QUERY_THROW); - m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName) , css::uno::UNO_QUERY_THROW); - m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION) , css::uno::UNO_QUERY_THROW); - - InitModule(); - InitBasic(); - InitStyles(); - } - - OSL_TRACE("** ** About to initialise SF Scripts"); - // Add Scripting Framework entries - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext > xCtx; - try - { - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xCtx.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); - Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory") ) ), UNO_QUERY_THROW ); - rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); - } - catch( Exception& e ) - { - OSL_TRACE(" Caught some exception whilst retrieving browse nodes from factory... Exception: %s", - ::rtl::OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - // TODO exception handling - } - - - if ( rootNode.is() ) - { - if ( nMode ) - { - //We call acquire on the XBrowseNode so that it does not - //get autodestructed and become invalid when accessed later. - rootNode->acquire(); - - SfxGroupInfo_Impl *pInfo = - new SfxGroupInfo_Impl( SFX_CFGGROUP_SCRIPTCONTAINER, 0, - static_cast(rootNode.get())); - - String aTitle(pImp->m_sDlgMacros); - SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); - pNewEntry->SetUserData( pInfo ); - pNewEntry->EnableChildsOnDemand( sal_True ); - aArr.Insert( pInfo, aArr.Count() ); - } - else - { - //We are only showing scripts not slot APIs so skip - //Root node and show location nodes - try { - if ( rootNode->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > children = - rootNode->getChildNodes(); - sal_Bool bIsRootNode = sal_False; - - ::rtl::OUString user( RTL_CONSTASCII_USTRINGPARAM("user") ); - ::rtl::OUString share( RTL_CONSTASCII_USTRINGPARAM("share") ); - if ( rootNode->getName().equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Root") ) ) ) - { - bIsRootNode = sal_True; - } - - //To mimic current starbasic behaviour we - //need to make sure that only the current document - //is displayed in the config tree. Tests below - //set the bDisplay flag to FALSE if the current - //node is a first level child of the Root and is NOT - //either the current document, user or share - ::rtl::OUString currentDocTitle; - Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) ); - if ( xDocument.is() ) - { - currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument ); - } - - for ( sal_Int32 n = 0; n < children.getLength(); ++n ) - { - Reference< browse::XBrowseNode >& theChild = children[n]; - sal_Bool bDisplay = sal_True; - ::rtl::OUString uiName = theChild->getName(); - if ( bIsRootNode ) - { - if ( ! ((theChild->getName().equals( user ) || theChild->getName().equals( share ) || - theChild->getName().equals( currentDocTitle ) ) ) ) - { - bDisplay=sal_False; - } - else - { - if ( uiName.equals( user ) ) - { - uiName = pImp->m_sMyMacros; - } - else if ( uiName.equals( share ) ) - { - uiName = pImp->m_sProdMacros; - } - } - } - if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay ) - { -// We call acquire on the XBrowseNode so that it does not -// get autodestructed and become invalid when accessed later. - theChild->acquire(); - - SfxGroupInfo_Impl* pInfo = - new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, - 0, static_cast( theChild.get())); - - Image aImage = GetImage( theChild, xCtx, bIsRootNode ); - SvLBoxEntry* pNewEntry = - InsertEntry( uiName, NULL); - SetExpandedEntryBmp( pNewEntry, aImage ); - SetCollapsedEntryBmp( pNewEntry, aImage ); - - pNewEntry->SetUserData( pInfo ); - aArr.Insert( pInfo, aArr.Count() ); - - if ( children[n]->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > grandchildren = - children[n]->getChildNodes(); - - for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m ) - { - if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER ) - { - pNewEntry->EnableChildsOnDemand( sal_True ); - m = grandchildren.getLength(); - } - } - } - } - } - } - } - catch (RuntimeException&) { - // do nothing, the entry will not be displayed in the UI - } - } - } - - // add styles - if ( m_xSMGR.is() ) - { - String sStyle( pImp->m_aStrGroupStyles ); - SvLBoxEntry *pEntry = InsertEntry( sStyle, 0 ); - SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data - aArr.Insert( pInfo, aArr.Count() ); - pEntry->SetUserData( pInfo ); - pEntry->EnableChildsOnDemand( sal_True ); - } - - MakeVisible( GetEntry( 0,0 ) ); - SetUpdateMode( sal_True ); -} -Image SfxConfigGroupListBox_Impl::GetImage( - Reference< browse::XBrowseNode > node, - Reference< XComponentContext > xCtx, - bool bIsRootNode -) -{ - Image aImage; - if ( bIsRootNode ) - { - ::rtl::OUString user( RTL_CONSTASCII_USTRINGPARAM("user") ); - ::rtl::OUString share( RTL_CONSTASCII_USTRINGPARAM("share") ); - if (node->getName().equals( user ) || node->getName().equals(share ) ) - { - aImage = pImp->m_hdImage; - } - else - { - ::rtl::OUString factoryURL; - ::rtl::OUString nodeName = node->getName(); - Reference xDocumentModel = getDocumentModel(xCtx, nodeName ); - if ( xDocumentModel.is() ) - { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( - xCtx->getServiceManager() - ->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("" // xxx todo - "com.sun.star.frame.ModuleManager") ), - xCtx ), - UNO_QUERY_THROW ); - Reference xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); - // get the long name of the document: - ::rtl::OUString appModule( xModuleManager->identify( - xDocumentModel ) ); - Sequence moduleDescr; - Any aAny = xModuleConfig->getByName(appModule); - if( sal_True != ( aAny >>= moduleDescr ) ) - { - throw RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SFTreeListBox::Init: failed to get PropertyValue") ), Reference< XInterface >()); - } - beans::PropertyValue const * pmoduleDescr = - moduleDescr.getConstArray(); - for ( sal_Int32 pos = moduleDescr.getLength(); pos--; ) - { - if (pmoduleDescr[ pos ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "ooSetupFactoryEmptyDocumentURL") )) - { - pmoduleDescr[ pos ].Value >>= factoryURL; - OSL_TRACE("factory url for doc images is %s", - ::rtl::OUStringToOString( factoryURL , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - break; - } - } - } - if( factoryURL.getLength() > 0 ) - { - aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL), false ); - } - else - { - aImage = pImp->m_docImage; - } - } - } - else - { - if( node->getType() == browse::BrowseNodeTypes::SCRIPT ) - aImage = pImp->m_macImage; - else - aImage = pImp->m_libImage; - } - return aImage; -} - -Reference< XInterface > -SfxConfigGroupListBox_Impl::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName ) -{ - Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), xCtx ), - UNO_QUERY ); - - Reference< container::XEnumerationAccess > componentsAccess = - desktop->getComponents(); - Reference< container::XEnumeration > components = - componentsAccess->createEnumeration(); - while (components->hasMoreElements()) - { - Reference< frame::XModel > model( - components->nextElement(), UNO_QUERY ); - if ( model.is() ) - { - ::rtl::OUString sTdocUrl = - ::comphelper::DocumentInfo::getDocumentTitle( model ); - if( sTdocUrl.equals( docName ) ) - { - xModel = model; - break; - } - } - } - return xModel; -} - -//----------------------------------------------- -::rtl::OUString SfxConfigGroupListBox_Impl::MapCommand2UIName(const ::rtl::OUString& sCommand) -{ - ::rtl::OUString sUIName; - try - { - css::uno::Reference< css::container::XNameAccess > xModuleConf; - m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf; - if (xModuleConf.is()) - { - ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand)); - sUIName = lProps.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ), ::rtl::OUString()); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(css::uno::Exception&) - { sUIName = ::rtl::OUString(); } - - // fallback for missing UINames !? - if (!sUIName.getLength()) - { - sUIName = sCommand; - } - - return sUIName; -} - -//----------------------------------------------- -void SfxConfigGroupListBox_Impl::GroupSelected() -/* Beschreibung - Eine Funktionsgruppe oder eine Basicmodul wurde selektiert. Alle Funktionen bzw. - Macros werden in der Functionlistbox anzeigt. -*/ -{ - SvLBoxEntry *pEntry = FirstSelected(); - SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - pFunctionListBox->SetUpdateMode(sal_False); - pFunctionListBox->ClearAll(); - if ( pInfo->nKind != SFX_CFGGROUP_FUNCTION && - pInfo->nKind != SFX_CFGGROUP_SCRIPTCONTAINER && - pInfo->nKind != SFX_CFGGROUP_STYLES ) - { - pFunctionListBox->SetUpdateMode(sal_True); - return; - } - - switch ( pInfo->nKind ) - { - case SFX_CFGGROUP_FUNCTION : - { - sal_uInt16 nGroup = pInfo->nUniqueID; - css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::frame::DispatchInformation > lCommands = xProvider->getConfigurableDispatchInformation(nGroup); - sal_Int32 c = lCommands.getLength(); - sal_Int32 i = 0; - - for (i=0; iInsertEntry(sUIName, NULL); - SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl(SFX_CFGFUNCTION_SLOT, 0); - pGrpInfo->sCommand = rInfo.Command; - pGrpInfo->sLabel = sUIName; - pFuncEntry->SetUserData(pGrpInfo); - } - - break; - } - - case SFX_CFGGROUP_SCRIPTCONTAINER: - { - if ( !GetChildCount( pEntry ) ) - { - Reference< browse::XBrowseNode > rootNode( - reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ; - - try { - if ( rootNode->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > children = - rootNode->getChildNodes(); - - for ( sal_Int32 n = 0; n < children.getLength(); ++n ) - { - if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT) - { - ::rtl::OUString uri; - - Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY ); - if (!xPropSet.is()) - { - continue; - } - - Any value = - xPropSet->getPropertyValue( String::CreateFromAscii( "URI" ) ); - value >>= uri; - - String* pScriptURI = new String( uri ); - SfxGroupInfo_Impl* pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGFUNCTION_SCRIPT, 0, pScriptURI ); - - Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False ); - SvLBoxEntry* pNewEntry = - pFunctionListBox->InsertEntry( children[n]->getName(), NULL ); - pFunctionListBox->SetExpandedEntryBmp( pNewEntry, aImage ); - pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage ); - - pGrpInfo->sCommand = uri; - pGrpInfo->sLabel = children[n]->getName(); - pNewEntry->SetUserData( pGrpInfo ); - - pFunctionListBox->aArr.Insert( - pGrpInfo, pFunctionListBox->aArr.Count() ); - - } - } - } - } - catch (RuntimeException&) { - // do nothing, the entry will not be displayed in the UI - } - } - break; - } - - case SFX_CFGGROUP_STYLES : - { - SfxStyleInfo_Impl* pFamily = (SfxStyleInfo_Impl*)(pInfo->pObject); - if (pFamily) - { - const ::std::vector< SfxStyleInfo_Impl > lStyles = pStylesInfo->getStyles(pFamily->sFamily); - ::std::vector< SfxStyleInfo_Impl >::const_iterator pIt; - for ( pIt = lStyles.begin(); - pIt != lStyles.end() ; - ++pIt ) - { - SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt); - SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL ); - SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pStyle ); - pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() ); - pGrpInfo->sCommand = pStyle->sCommand; - pGrpInfo->sLabel = pStyle->sLabel; - pFuncEntry->SetUserData( pGrpInfo ); - } - } - break; - } - - default: - return; - } - - if ( pFunctionListBox->GetEntryCount() ) - pFunctionListBox->Select( pFunctionListBox->GetEntry( 0, 0 ) ); - - pFunctionListBox->SetUpdateMode(sal_True); -} - -sal_Bool SfxConfigGroupListBox_Impl::Expand( SvLBoxEntry* pParent ) -{ - sal_Bool bRet = SvTreeListBox::Expand( pParent ); - if ( bRet ) - { - // Wieviele Entries k"onnen angezeigt werden ? - sal_uLong nEntries = GetOutputSizePixel().Height() / GetEntryHeight(); - - // Wieviele Kinder sollen angezeigt werden ? - sal_uLong nChildCount = GetVisibleChildCount( pParent ); - - // Passen alle Kinder und der parent gleichzeitig in die View ? - if ( nChildCount+1 > nEntries ) - { - // Wenn nicht, wenigstens parent ganz nach oben schieben - MakeVisible( pParent, sal_True ); - } - else - { - // An welcher relativen ViewPosition steht der aufzuklappende parent - SvLBoxEntry *pEntry = GetFirstEntryInView(); - sal_uLong nParentPos = 0; - while ( pEntry && pEntry != pParent ) - { - ++nParentPos; - pEntry = GetNextEntryInView( pEntry ); - } - - // Ist unter dem parent noch genug Platz f"ur alle Kinder ? - if ( nParentPos + nChildCount + 1 > nEntries ) - ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) ); - } - } - - return bRet; -} - -void SfxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) -/* Beschreibung - Ein Basic oder eine Bibliothek werden ge"offnet -*/ -{ - SfxGroupInfo_Impl *pInfo = (SfxGroupInfo_Impl*) pEntry->GetUserData(); - pInfo->bWasOpened = sal_True; - switch ( pInfo->nKind ) - { - case SFX_CFGGROUP_SCRIPTCONTAINER: - { - if ( !GetChildCount( pEntry ) ) - { - Reference< browse::XBrowseNode > rootNode( - reinterpret_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ; - - try { - if ( rootNode->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > children = - rootNode->getChildNodes(); - sal_Bool bIsRootNode = sal_False; - - ::rtl::OUString user( RTL_CONSTASCII_USTRINGPARAM("user") ); - ::rtl::OUString share( RTL_CONSTASCII_USTRINGPARAM("share" )); - if ( rootNode->getName().equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Root") ) ) ) - { - bIsRootNode = sal_True; - } - - /* To mimic current starbasic behaviour we - need to make sure that only the current document - is displayed in the config tree. Tests below - set the bDisplay flag to sal_False if the current - node is a first level child of the Root and is NOT - either the current document, user or share */ - ::rtl::OUString currentDocTitle; - Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) ); - if ( xDocument.is() ) - { - currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument ); - } - - sal_Int32 nLen = children.getLength(); - for ( sal_Int32 n = 0; n < nLen; ++n ) - { - Reference< browse::XBrowseNode >& theChild = children[n]; - ::rtl::OUString aName( theChild->getName() ); - sal_Bool bDisplay = sal_True; - if ( bIsRootNode ) - { - if ( !( (aName.equals(user) || aName.equals(share) || aName.equals(currentDocTitle) ) ) ) - bDisplay=sal_False; - } - if ( children[n].is() && children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay ) - { - - /* - We call acquire on the XBrowseNode so that it does not - get autodestructed and become invalid when accessed later. - */ - theChild->acquire(); - - SfxGroupInfo_Impl* pGrpInfo = - new SfxGroupInfo_Impl(SFX_CFGGROUP_SCRIPTCONTAINER, - 0, static_cast( theChild.get())); - - Image aImage = GetImage( theChild, Reference< XComponentContext >(), sal_False ); - SvLBoxEntry* pNewEntry = - InsertEntry( theChild->getName(), pEntry ); - SetExpandedEntryBmp( pNewEntry, aImage ); - SetCollapsedEntryBmp(pNewEntry, aImage ); - - pNewEntry->SetUserData( pGrpInfo ); - aArr.Insert( pGrpInfo, aArr.Count() ); - - if ( children[n]->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > grandchildren = - children[n]->getChildNodes(); - - for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m ) - { - if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER ) - { - pNewEntry->EnableChildsOnDemand( sal_True ); - m = grandchildren.getLength(); - } - } - } - } - } - } - } - catch (RuntimeException&) { - // do nothing, the entry will not be displayed in the UI - } - } - break; - } - - case SFX_CFGGROUP_STYLES: - { - if ( !GetChildCount( pEntry ) ) - { - const ::std::vector< SfxStyleInfo_Impl > lStyleFamilies = pStylesInfo->getStyleFamilies(); - ::std::vector< SfxStyleInfo_Impl >::const_iterator pIt; - for ( pIt = lStyleFamilies.begin(); - pIt != lStyleFamilies.end() ; - ++pIt ) - { - SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt); - SvLBoxEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry ); - SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pFamily ); - aArr.Insert( pGrpInfo, aArr.Count() ); - pStyleEntry->SetUserData( pGrpInfo ); - pStyleEntry->EnableChildsOnDemand( sal_False ); - } - } - break; - } - - default: - OSL_FAIL( "Falscher Gruppentyp!" ); - break; - } -} - -void SfxConfigGroupListBox_Impl::SelectMacro( const SfxMacroInfoItem *pItem ) -{ - SelectMacro( pItem->GetBasicManager()->GetName(), - pItem->GetQualifiedName() ); -} - -void SfxConfigGroupListBox_Impl::SelectMacro( const String& rBasic, - const String& rMacro ) -{ - String aBasicName( rBasic ); - aBasicName += ' '; - aBasicName += pImp->m_sMacros; - String aLib, aModule, aMethod; - sal_uInt16 nCount = rMacro.GetTokenCount('.'); - aMethod = rMacro.GetToken( nCount-1, '.' ); - if ( nCount > 2 ) - { - aLib = rMacro.GetToken( 0, '.' ); - aModule = rMacro.GetToken( nCount-2, '.' ); - } - - SvLBoxEntry *pEntry = FirstChild(0); - while ( pEntry ) - { - String aEntryBas = GetEntryText( pEntry ); - if ( aEntryBas == aBasicName ) - { - Expand( pEntry ); - SvLBoxEntry *pLib = FirstChild( pEntry ); - while ( pLib ) - { - String aEntryLib = GetEntryText( pLib ); - if ( aEntryLib == aLib ) - { - Expand( pLib ); - SvLBoxEntry *pMod = FirstChild( pLib ); - while ( pMod ) - { - String aEntryMod = GetEntryText( pMod ); - if ( aEntryMod == aModule ) - { - Expand( pMod ); - MakeVisible( pMod ); - Select( pMod ); - SvLBoxEntry *pMethod = pFunctionListBox->First(); - while ( pMethod ) - { - String aEntryMethod = GetEntryText( pMethod ); - if ( aEntryMethod == aMethod ) - { - pFunctionListBox->Select( pMethod ); - pFunctionListBox->MakeVisible( pMethod ); - return; - } - pMethod = pFunctionListBox->Next( pMethod ); - } - } - pMod = NextSibling( pMod ); - } - } - pLib = NextSibling( pLib ); - } - } - pEntry = NextSibling( pEntry ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx deleted file mode 100644 index 07d1287e5..000000000 --- a/cui/source/customize/eventdlg.cxx +++ /dev/null @@ -1,242 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include *************************************************************** -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "eventdlg.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "headertablistbox.hxx" -#include "macropg_impl.hxx" - -#include -#include -#include "eventdlg.hrc" -#include "helpid.hrc" -#include "selector.hxx" -#include "cfg.hxx" - - -using ::rtl::OUString; -using namespace ::com::sun::star; -// ----------------------------------------------------------------------- - -SvxEventConfigPage::SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, SvxEventConfigPage::EarlyInit ) : - - _SvxMacroTabPage( pParent, CUI_RES(RID_SVXPAGE_EVENTS), rSet ), - aSaveInText( this, CUI_RES( TXT_SAVEIN ) ), - aSaveInListBox( this, CUI_RES( LB_SAVEIN ) ), - bAppConfig ( sal_True ) -{ - mpImpl->pStrEvent = new String( CUI_RES( STR_EVENT )); - mpImpl->pAssignedMacro = new String( CUI_RES( STR_ASSMACRO )); - mpImpl->pEventLB = new _HeaderTabListBox( this, CUI_RES( LB_EVENT )); - mpImpl->pAssignFT = new FixedText( this, CUI_RES( FT_ASSIGN )); - mpImpl->pAssignPB = new PushButton( this, CUI_RES( PB_ASSIGN )); - mpImpl->pDeletePB = new PushButton( this, CUI_RES( PB_DELETE )); - mpImpl->pMacroImg = new Image( CUI_RES( IMG_MACRO) ); - mpImpl->pComponentImg = new Image( CUI_RES( IMG_COMPONENT) ); - - FreeResource(); - - // must be done after FreeResource is called - InitResources(); - - mpImpl->pEventLB->GetListBox().SetHelpId( HID_SVX_MACRO_LB_EVENT ); - - aSaveInListBox.SetSelectHdl( LINK( this, SvxEventConfigPage, - SelectHdl_Impl ) ); - - uno::Reference< document::XEventsSupplier > xSupplier; - - xSupplier = uno::Reference< document::XEventsSupplier > ( - ::comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.GlobalEventBroadcaster" )) ), - uno::UNO_QUERY ); - - sal_uInt16 nPos(0); - if ( xSupplier.is() ) - { - m_xAppEvents = xSupplier->getEvents(); - OUString label; - utl::ConfigManager::GetDirectConfigProperty( - utl::ConfigManager::PRODUCTNAME ) >>= label; - nPos = aSaveInListBox.InsertEntry( label ); - aSaveInListBox.SetEntryData( nPos, new bool(true) ); - aSaveInListBox.SelectEntryPos( nPos, sal_True ); - } -} - -// ----------------------------------------------------------------------- -void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFrame ) -{ - SetFrame( _rxFrame ); - ImplInitDocument(); - - InitAndSetHandler( m_xAppEvents, m_xDocumentEvents, m_xDocumentModifiable ); - - SelectHdl_Impl( NULL ); -} - -// ----------------------------------------------------------------------- - -SvxEventConfigPage::~SvxEventConfigPage() -{ - //DF Do I need to delete bools? -} - -// ----------------------------------------------------------------------- - -void SvxEventConfigPage::ImplInitDocument() -{ - uno::Reference< frame::XFrame > xFrame( GetFrame() ); - OUString aModuleId = SvxConfigPage::GetFrameWithDefaultAndIdentify( xFrame ); - if ( !xFrame.is() ) - return; - - try - { - uno::Reference< frame::XModel > xModel; - if ( !SvxConfigPage::CanConfig( aModuleId ) ) - return; - - uno::Reference< frame::XController > xController = - xFrame->getController(); - - if ( xController.is() ) - { - xModel = xController->getModel(); - } - - if ( !xModel.is() ) - return; - - uno::Reference< document::XEventsSupplier > xSupplier( xModel, uno::UNO_QUERY ); - - if ( xSupplier.is() ) - { - m_xDocumentEvents = xSupplier->getEvents(); - m_xDocumentModifiable = m_xDocumentModifiable.query( xModel ); - - OUString aTitle = ::comphelper::DocumentInfo::getDocumentTitle( xModel ); - sal_uInt16 nPos = aSaveInListBox.InsertEntry( aTitle ); - - aSaveInListBox.SetEntryData( nPos, new bool(false) ); - aSaveInListBox.SelectEntryPos( nPos, sal_True ); - - bAppConfig = false; - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxEventConfigPage, SelectHdl_Impl, ListBox *, pBox ) -{ - (void)pBox; - - bool* bApp = (bool*) aSaveInListBox.GetEntryData( - aSaveInListBox.GetSelectEntryPos()); - - mpImpl->pEventLB->SetUpdateMode( sal_False ); - bAppConfig = *bApp; - if ( *bApp ) - { - SetReadOnly( sal_False ); - _SvxMacroTabPage::DisplayAppEvents( true ); - } - else - { - bool isReadonly = sal_False; - - uno::Reference< frame::XFramesSupplier > xFramesSupplier( - ::comphelper::getProcessServiceFactory()->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY ); - - uno::Reference< frame::XFrame > xFrame = - xFramesSupplier->getActiveFrame(); - - if ( xFrame.is() ) - { - uno::Reference< frame::XController > xController = - xFrame->getController(); - - if ( xController.is() ) - { - uno::Reference< frame::XStorable > xStorable( - xController->getModel(), uno::UNO_QUERY ); - isReadonly = xStorable->isReadonly(); - } - } - - SetReadOnly( isReadonly ); - _SvxMacroTabPage::DisplayAppEvents( false ); - } - - mpImpl->pEventLB->SetUpdateMode( sal_True ); - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxEventConfigPage::FillItemSet( SfxItemSet& rSet ) -{ - return _SvxMacroTabPage::FillItemSet( rSet ); -} - -// ----------------------------------------------------------------------- - -void SvxEventConfigPage::Reset( const SfxItemSet& ) -{ - _SvxMacroTabPage::Reset(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/eventdlg.hrc b/cui/source/customize/eventdlg.hrc deleted file mode 100644 index b75c04776..000000000 --- a/cui/source/customize/eventdlg.hrc +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* StarView ressource header file */ - - ////DF temp to figure out what's needed from these -//DF #include "sfx.hrc" -#include -#include "macropg.hrc" - -#define TXT_SAVEIN 10 -#define LB_SAVEIN 11 - -#define MB_CONFIG 17 -#define CB_WARNING 18 -#define CB_WARNING_ALWAYS 19 -#define GB_SAFETY 20 -#define ID_APP 21 -#define ID_DOC 22 diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx deleted file mode 100644 index 316364845..000000000 --- a/cui/source/customize/eventdlg.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EVENTDLG_HXX -#define _EVENTDLG_HXX - -#include - -#include -#include -#include "macropg.hxx" - -#include - -class Menu; -class SfxMacroInfoItem; -class SvxMacroItem; - -class SvxEventConfigPage : public _SvxMacroTabPage -{ - FixedText aSaveInText; - ListBox aSaveInListBox; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocumentEvents; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xDocumentModifiable; - - sal_Bool bAppConfig; - - DECL_LINK( SelectHdl_Impl, ListBox* ); - - // Forbidden and not implemented. - SvxEventConfigPage (const SvxEventConfigPage &); - SvxEventConfigPage & operator= (const SvxEventConfigPage &); - -public: - /// this is only to let callers know that there is a LateInit which *must* be called - struct EarlyInit { }; - SvxEventConfigPage( Window *pParent, const SfxItemSet& rSet, EarlyInit ); - ~SvxEventConfigPage(); - - void LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); - -protected: - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet& ); - using _SvxMacroTabPage::Reset; - -private: - void ImplInitDocument(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/eventdlg.src b/cui/source/customize/eventdlg.src deleted file mode 100644 index 835ed82b4..000000000 --- a/cui/source/customize/eventdlg.src +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "helpid.hrc" -#include "eventdlg.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - - // TP_CONFIG_EVENT ------------------------------------------------------- -TabPage RID_SVXPAGE_EVENTS -{ - HelpId = HID_SVX_CONFIG_EVENT ; - OutputSize = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 272 , 258 ) ; - String STR_EVENT - { - Text [ en-US ] = "Event" ; - }; - String STR_ASSMACRO - { - Text [ en-US ] = "Assigned Action" ; - }; - Control LB_EVENT - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 205 , 229 ) ; - TabStop = TRUE ; - HelpID = HID_SVX_MACRO_LB_EVENT ; - }; - FixedText TXT_SAVEIN - { - Pos = MAP_APPFONT ( 6 , 240 ) ; - Size = MAP_APPFONT ( 55 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Save In" ; - }; - ListBox LB_SAVEIN - { - HelpID = "cui:ListBox:RID_SVXPAGE_EVENTS:LB_SAVEIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 54 , 238 ) ; - Size = MAP_APPFONT ( 132 , 53 ) ; - DropDown = TRUE ; - }; - FixedText FT_ASSIGN - { - Pos = MAP_APPFONT ( 217, ROW0 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Assign:" ; - }; - PushButton PB_ASSIGN - { - HelpID = "cui:PushButton:RID_SVXPAGE_EVENTS:PB_ASSIGN"; - Pos = MAP_APPFONT ( 217 , ROW0A ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "M~acro..." ; - }; - PushButton PB_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_EVENTS:PB_DELETE"; - Pos = MAP_APPFONT ( 217 , ROW0A+RSC_CD_PUSHBUTTON_HEIGHT+12 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "~Remove" ; - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "id018.png"; }; - MASKCOLOR - }; - Image IMG_COMPONENT - { - ImageBitmap = Bitmap { File = "component_16.png"; }; - MASKCOLOR - }; -}; diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx deleted file mode 100644 index 944d6d0cb..000000000 --- a/cui/source/customize/macropg.cxx +++ /dev/null @@ -1,1027 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include "macropg.hxx" -#include -#define _SVSTDARR_STRINGSDTOR -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "selector.hxx" -#include "cfg.hxx" -#include "macropg.hrc" -#include "helpid.hrc" -#include -#include "headertablistbox.hxx" -#include "macropg_impl.hxx" -#include // RID_SVXPAGE_MACROASSIGN -#include - -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -static ::rtl::OUString aVndSunStarUNO( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.UNO:") ); -static ::rtl::OUString aVndSunStarScript( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:") ); - -_SvxMacroTabPage_Impl::_SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ) : - pAssignFT( NULL ), - pAssignPB( NULL ), - pAssignComponentPB( NULL ), - pDeletePB( NULL ), - pMacroImg( NULL ), - pComponentImg( NULL ), - pStrEvent( NULL ), - pAssignedMacro( NULL ), - pEventLB( NULL ), - bReadOnly( sal_False ), - bIDEDialogMode( sal_False ) -{ - const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == rAttrSet.GetItemState( SID_ATTR_MACROITEM, sal_False, &pItem ) ) - bIDEDialogMode = ((const SfxBoolItem*)pItem)->GetValue(); -} - -_SvxMacroTabPage_Impl::~_SvxMacroTabPage_Impl() -{ - delete pAssignFT; - delete pAssignPB; - delete pAssignComponentPB; - delete pDeletePB; - delete pMacroImg; - delete pComponentImg; - delete pStrEvent; - delete pAssignedMacro; - delete pEventLB; -} - -// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert -static long nTabs[] = - { - 2, // Number of Tabs - 0, 90 - }; - -#define TAB_WIDTH_MIN 10 - -// IDs for items in HeaderBar of EventLB -#define ITEMID_EVENT 1 -#define ITMEID_ASSMACRO 2 - - -#define LB_EVENTS_ITEMPOS 1 -#define LB_MACROS_ITEMPOS 2 - - -IMPL_LINK( _HeaderTabListBox, HeaderEndDrag_Impl, HeaderBar*, pBar ) -{ - DBG_ASSERT( pBar == &maHeaderBar, "*_HeaderTabListBox::HeaderEndDrag_Impl: something is wrong here..." ); - (void)pBar; - - if( !maHeaderBar.GetCurItemId() ) - return 0; - - if( !maHeaderBar.IsItemMode() ) - { - Size aSz; - sal_uInt16 _nTabs = maHeaderBar.GetItemCount(); - long nWidth = maHeaderBar.GetItemSize( ITEMID_EVENT ); - long nBarWidth = maHeaderBar.GetSizePixel().Width(); - - if( nWidth < TAB_WIDTH_MIN ) - maHeaderBar.SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN ); - else if( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN ) - maHeaderBar.SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN ); - - { - long _nWidth, nTmpSz = 0; - for( sal_uInt16 i = 1 ; i < _nTabs ; ++i ) - { - _nWidth = maHeaderBar.GetItemSize( i ); - aSz.Width() = _nWidth + nTmpSz; - nTmpSz += _nWidth; - maListBox.SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT ); - } - } - } - return 1; -} - -long _HeaderTabListBox::Notify( NotifyEvent& rNEvt ) -{ - long nRet = Control::Notify( rNEvt ); - - if( rNEvt.GetType() == EVENT_GETFOCUS ) - { - if ( rNEvt.GetWindow() != &maListBox ) - maListBox.GrabFocus(); - } - - return nRet; -} - -_HeaderTabListBox::_HeaderTabListBox( Window* pParent, const ResId& rId ) : - Control( pParent, rId ), - maListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ), - maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) -{ - maListBox.SetHelpId( HID_MACRO_HEADERTABLISTBOX ); -} - -_HeaderTabListBox::~_HeaderTabListBox() -{ -} - -void _HeaderTabListBox::ConnectElements( void ) -{ - // calc pos and size of header bar - Point aPnt( 0, 0 ); - Size aSize( maHeaderBar.CalcWindowSizePixel() ); - Size aCtrlSize( GetOutputSizePixel() ); - aSize.Width() = aCtrlSize.Width(); - maHeaderBar.SetPosSizePixel( aPnt, aSize ); - - // calc pos and size of ListBox - aPnt.Y() += aSize.Height(); - aSize.Height() = aCtrlSize.Height() - aSize.Height(); - maListBox.SetPosSizePixel( aPnt, aSize ); - - // set handler - maHeaderBar.SetEndDragHdl( LINK( this, _HeaderTabListBox, HeaderEndDrag_Impl ) ); - - maListBox.InitHeaderBar( &maHeaderBar ); -} - -void _HeaderTabListBox::Show( sal_Bool bVisible, sal_uInt16 nFlags ) -{ - maListBox.Show( bVisible, nFlags ); - maHeaderBar.Show( bVisible, nFlags ); -} - -void _HeaderTabListBox::Enable( bool bEnable, bool bChild ) -{ - maListBox.Enable( bEnable, bChild ); - maHeaderBar.Enable( bEnable, bChild ); -} - -// assign button ("Add Command") is enabled only if it is not read only -// delete button ("Remove Command") is enabled if a current binding exists -// and it is not read only -void _SvxMacroTabPage::EnableButtons() -{ - const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); - if ( pE ) - { - SvLBoxString* pEventMacro = (SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS ); - mpImpl->pDeletePB->Enable( 0 != pEventMacro && !mpImpl->bReadOnly ); - - mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly ); - if( mpImpl->pAssignComponentPB ) - mpImpl->pAssignComponentPB->Enable( !mpImpl->bReadOnly ); - } -} - -_SvxMacroTabPage::_SvxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet ) - : SfxTabPage( pParent, rResId, rAttrSet ), - m_xAppEvents(0), - m_xDocEvents(0), - bReadOnly(false), - bDocModified(false), - bAppEvents(false), - bInitialized(false) -{ - mpImpl = new _SvxMacroTabPage_Impl( rAttrSet ); -} - -_SvxMacroTabPage::~_SvxMacroTabPage() -{ - // need to delete the user data - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.GetEntry( 0 ); - while( pE ) - { - ::rtl::OUString* pEventName = (::rtl::OUString*)pE->GetUserData(); - delete pEventName; - pE->SetUserData((void*)0); - pE = rListBox.NextSibling( pE ); - } - DELETEZ( mpImpl ); -} -// ----------------------------------------------------------------------------- -void _SvxMacroTabPage::InitResources() -{ - // Note: the order here controls the order in which the events are displayed in the UI! - - // the event name to UI string mappings for App Events - aDisplayNames.push_back( EventDisplayName( "OnStartApp", RID_SVXSTR_EVENT_STARTAPP ) ); - aDisplayNames.push_back( EventDisplayName( "OnCloseApp", RID_SVXSTR_EVENT_CLOSEAPP ) ); - aDisplayNames.push_back( EventDisplayName( "OnCreate", RID_SVXSTR_EVENT_CREATEDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnNew", RID_SVXSTR_EVENT_NEWDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnLoadFinished", RID_SVXSTR_EVENT_LOADDOCFINISHED ) ); - aDisplayNames.push_back( EventDisplayName( "OnLoad", RID_SVXSTR_EVENT_OPENDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnPrepareUnload", RID_SVXSTR_EVENT_PREPARECLOSEDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnUnload", RID_SVXSTR_EVENT_CLOSEDOC ) ) ; - aDisplayNames.push_back( EventDisplayName( "OnViewCreated", RID_SVXSTR_EVENT_VIEWCREATED ) ); - aDisplayNames.push_back( EventDisplayName( "OnPrepareViewClosing", RID_SVXSTR_EVENT_PREPARECLOSEVIEW ) ); - aDisplayNames.push_back( EventDisplayName( "OnViewClosed", RID_SVXSTR_EVENT_CLOSEVIEW ) ) ; - aDisplayNames.push_back( EventDisplayName( "OnFocus", RID_SVXSTR_EVENT_ACTIVATEDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnUnfocus", RID_SVXSTR_EVENT_DEACTIVATEDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnSave", RID_SVXSTR_EVENT_SAVEDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnSaveDone", RID_SVXSTR_EVENT_SAVEDOCDONE ) ); - aDisplayNames.push_back( EventDisplayName( "OnSaveFailed", RID_SVXSTR_EVENT_SAVEDOCFAILED ) ); - aDisplayNames.push_back( EventDisplayName( "OnSaveAs", RID_SVXSTR_EVENT_SAVEASDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnSaveAsDone", RID_SVXSTR_EVENT_SAVEASDOCDONE ) ); - aDisplayNames.push_back( EventDisplayName( "OnSaveAsFailed", RID_SVXSTR_EVENT_SAVEASDOCFAILED ) ); - aDisplayNames.push_back( EventDisplayName( "OnCopyTo", RID_SVXSTR_EVENT_COPYTODOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnCopyToDone", RID_SVXSTR_EVENT_COPYTODOCDONE ) ); - aDisplayNames.push_back( EventDisplayName( "OnCopyToFailed", RID_SVXSTR_EVENT_COPYTODOCFAILED ) ); - aDisplayNames.push_back( EventDisplayName( "OnPrint", RID_SVXSTR_EVENT_PRINTDOC ) ); - aDisplayNames.push_back( EventDisplayName( "OnModifyChanged", RID_SVXSTR_EVENT_MODIFYCHANGED ) ); - aDisplayNames.push_back( EventDisplayName( "OnTitleChanged", RID_SVXSTR_EVENT_TITLECHANGED ) ); - - // application specific events - aDisplayNames.push_back( EventDisplayName( "OnMailMerge", RID_SVXSTR_EVENT_MAILMERGE ) ); - aDisplayNames.push_back( EventDisplayName( "OnMailMergeFinished", RID_SVXSTR_EVENT_MAILMERGE_END ) ); - aDisplayNames.push_back( EventDisplayName( "OnFieldMerge", RID_SVXSTR_EVENT_FIELDMERGE ) ); - aDisplayNames.push_back( EventDisplayName( "OnFieldMergeFinished", RID_SVXSTR_EVENT_FIELDMERGE_FINISHED ) ); - aDisplayNames.push_back( EventDisplayName( "OnPageCountChange", RID_SVXSTR_EVENT_PAGECOUNTCHANGE ) ); - aDisplayNames.push_back( EventDisplayName( "OnSubComponentOpened", RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED ) ); - aDisplayNames.push_back( EventDisplayName( "OnSubComponentClosed", RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED ) ); - aDisplayNames.push_back( EventDisplayName( "OnSelect", RID_SVXSTR_EVENT_SELECTIONCHANGED ) ); - aDisplayNames.push_back( EventDisplayName( "OnDoubleClick", RID_SVXSTR_EVENT_DOUBLECLICK ) ); - aDisplayNames.push_back( EventDisplayName( "OnRightClick", RID_SVXSTR_EVENT_RIGHTCLICK ) ); - aDisplayNames.push_back( EventDisplayName( "OnCalculate", RID_SVXSTR_EVENT_CALCULATE ) ); - aDisplayNames.push_back( EventDisplayName( "OnChange", RID_SVXSTR_EVENT_CONTENTCHANGED ) ); - - // the event name to UI string mappings for forms & dialogs - // - aDisplayNames.push_back( EventDisplayName( "approveAction", RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED ) ); - aDisplayNames.push_back( EventDisplayName( "actionPerformed", RID_SVXSTR_EVENT_ACTIONPERFORMED ) ); - aDisplayNames.push_back( EventDisplayName( "changed", RID_SVXSTR_EVENT_CHANGED ) ); - aDisplayNames.push_back( EventDisplayName( "textChanged", RID_SVXSTR_EVENT_TEXTCHANGED ) ); - aDisplayNames.push_back( EventDisplayName( "itemStateChanged", RID_SVXSTR_EVENT_ITEMSTATECHANGED ) ); - aDisplayNames.push_back( EventDisplayName( "focusGained", RID_SVXSTR_EVENT_FOCUSGAINED ) ); - aDisplayNames.push_back( EventDisplayName( "focusLost", RID_SVXSTR_EVENT_FOCUSLOST ) ); - aDisplayNames.push_back( EventDisplayName( "keyPressed", RID_SVXSTR_EVENT_KEYTYPED ) ); - aDisplayNames.push_back( EventDisplayName( "keyReleased", RID_SVXSTR_EVENT_KEYUP ) ); - aDisplayNames.push_back( EventDisplayName( "mouseEntered", RID_SVXSTR_EVENT_MOUSEENTERED ) ); - aDisplayNames.push_back( EventDisplayName( "mouseDragged", RID_SVXSTR_EVENT_MOUSEDRAGGED ) ); - aDisplayNames.push_back( EventDisplayName( "mouseMoved", RID_SVXSTR_EVENT_MOUSEMOVED ) ); - aDisplayNames.push_back( EventDisplayName( "mousePressed", RID_SVXSTR_EVENT_MOUSEPRESSED ) ); - aDisplayNames.push_back( EventDisplayName( "mouseReleased", RID_SVXSTR_EVENT_MOUSERELEASED ) ); - aDisplayNames.push_back( EventDisplayName( "mouseExited", RID_SVXSTR_EVENT_MOUSEEXITED ) ); - aDisplayNames.push_back( EventDisplayName( "approveReset", RID_SVXSTR_EVENT_APPROVERESETTED ) ); - aDisplayNames.push_back( EventDisplayName( "resetted", RID_SVXSTR_EVENT_RESETTED ) ); - aDisplayNames.push_back( EventDisplayName( "approveSubmit", RID_SVXSTR_EVENT_SUBMITTED ) ); - aDisplayNames.push_back( EventDisplayName( "approveUpdate", RID_SVXSTR_EVENT_BEFOREUPDATE ) ); - aDisplayNames.push_back( EventDisplayName( "updated", RID_SVXSTR_EVENT_AFTERUPDATE ) ); - aDisplayNames.push_back( EventDisplayName( "loaded", RID_SVXSTR_EVENT_LOADED ) ); - aDisplayNames.push_back( EventDisplayName( "reloading", RID_SVXSTR_EVENT_RELOADING ) ); - aDisplayNames.push_back( EventDisplayName( "reloaded", RID_SVXSTR_EVENT_RELOADED ) ); - aDisplayNames.push_back( EventDisplayName( "unloading", RID_SVXSTR_EVENT_UNLOADING ) ); - aDisplayNames.push_back( EventDisplayName( "unloaded", RID_SVXSTR_EVENT_UNLOADED ) ); - aDisplayNames.push_back( EventDisplayName( "confirmDelete", RID_SVXSTR_EVENT_CONFIRMDELETE ) ); - aDisplayNames.push_back( EventDisplayName( "approveRowChange", RID_SVXSTR_EVENT_APPROVEROWCHANGE ) ); - aDisplayNames.push_back( EventDisplayName( "rowChanged", RID_SVXSTR_EVENT_ROWCHANGE ) ); - aDisplayNames.push_back( EventDisplayName( "approveCursorMove", RID_SVXSTR_EVENT_POSITIONING ) ); - aDisplayNames.push_back( EventDisplayName( "cursorMoved", RID_SVXSTR_EVENT_POSITIONED ) ); - aDisplayNames.push_back( EventDisplayName( "approveParameter", RID_SVXSTR_EVENT_APPROVEPARAMETER ) ); - aDisplayNames.push_back( EventDisplayName( "errorOccurred", RID_SVXSTR_EVENT_ERROROCCURRED ) ); - aDisplayNames.push_back( EventDisplayName( "adjustmentValueChanged", RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED ) ); -} - -// the following method is called when the user clicks OK -// We use the contents of the hashes to replace the settings -sal_Bool _SvxMacroTabPage::FillItemSet( SfxItemSet& /*rSet*/ ) -{ - try - { - ::rtl::OUString eventName; - if( m_xAppEvents.is() ) - { - EventsHash::iterator h_itEnd = m_appEventsHash.end(); - EventsHash::iterator h_it = m_appEventsHash.begin(); - for ( ; h_it != h_itEnd; ++h_it ) - { - eventName = h_it->first; - try - { - m_xAppEvents->replaceByName( eventName, GetPropsByName( eventName, m_appEventsHash ) ); - } - catch (const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - if( m_xDocEvents.is() && bDocModified ) - { - EventsHash::iterator h_itEnd = m_docEventsHash.end(); - EventsHash::iterator h_it = m_docEventsHash.begin(); - for ( ; h_it != h_itEnd; ++h_it ) - { - eventName = h_it->first; - try - { - m_xDocEvents->replaceByName( eventName, GetPropsByName( eventName, m_docEventsHash ) ); - } - catch (const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - // if we have a valid XModifiable (in the case of doc events) - // call setModified(true) - // in principle this should not be necessary (see issue ??) - if(m_xModifiable.is()) - { - m_xModifiable->setModified( sal_True ); - } - } - } - catch (const Exception&) - { - } - // what is the return value about?? - return sal_False; -} - -// the following method clears the bindings in the hashes for both doc & app -void _SvxMacroTabPage::Reset() -{ - // called once in creation - don't reset the data this time - if(!bInitialized) - { - bInitialized = true; - return; - } - - try - { - ::rtl::OUString sEmpty; - if( m_xAppEvents.is() ) - { - EventsHash::iterator h_itEnd = m_appEventsHash.end(); - EventsHash::iterator h_it = m_appEventsHash.begin(); - for ( ; h_it != h_itEnd; ++h_it ) - { - h_it->second.second = sEmpty; - } - } - if( m_xDocEvents.is() && bDocModified ) - { - EventsHash::iterator h_itEnd = m_docEventsHash.end(); - EventsHash::iterator h_it = m_docEventsHash.begin(); - for ( ; h_it != h_itEnd; ++h_it ) - { - h_it->second.second = sEmpty; - } - // if we have a valid XModifiable (in the case of doc events) - // call setModified(true) - if(m_xModifiable.is()) - { - m_xModifiable->setModified( sal_True ); - } - } - } - catch (const Exception&) - { - } - DisplayAppEvents(bAppEvents); -} - -void _SvxMacroTabPage::SetReadOnly( sal_Bool bSet ) -{ - mpImpl->bReadOnly = bSet; -} - -sal_Bool _SvxMacroTabPage::IsReadOnly() const -{ - return mpImpl->bReadOnly; -} - - -class IconLBoxString : public SvLBoxString -{ - Image* m_pMacroImg; - Image* m_pComponentImg; - int m_nxImageOffset; - - public: - IconLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& sText, - Image* pMacroImg, Image* pComponentImg ); - virtual void Paint(const Point& aPos, SvLBox& aDevice, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); -}; - - -IconLBoxString::IconLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& sText, - Image* pMacroImg, Image* pComponentImg ) - : SvLBoxString( pEntry, nFlags, sText ) - , m_pMacroImg( pMacroImg ) - , m_pComponentImg( pComponentImg ) -{ - m_nxImageOffset = 20; -} - -//=============================================== -void IconLBoxString::Paint( const Point& aPos, SvLBox& aDevice, - sal_uInt16 /*nFlags*/, SvLBoxEntry* /*pEntry*/ ) -{ - String aTxt( GetText() ); - if( aTxt.Len() ) - { - ::rtl::OUString aURL( aTxt ); - sal_Int32 nIndex = aURL.indexOf( aVndSunStarUNO ); - bool bUNO = nIndex == 0; - - const Image* pImg = bUNO ? m_pComponentImg : m_pMacroImg; - aDevice.DrawImage( aPos, *pImg ); - - ::rtl::OUString aPureMethod; - if( bUNO ) - { - sal_Int32 nBegin = aVndSunStarUNO.getLength(); - aPureMethod = aURL.copy( nBegin ); - } - else - { - sal_Int32 nBegin = aVndSunStarScript.getLength(); - aPureMethod = aURL.copy( nBegin ); - aPureMethod = aPureMethod.copy( 0, aPureMethod.indexOf( '?' ) ); - } - - Point aPnt(aPos); - aPnt.X() += m_nxImageOffset; - aDevice.DrawText( aPnt, aPureMethod ); - } -} - - -// displays the app events if appEvents=true, otherwise displays the doc events -void _SvxMacroTabPage::DisplayAppEvents( bool appEvents) -{ - bAppEvents = appEvents; - - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - mpImpl->pEventLB->SetUpdateMode( sal_False ); - rListBox.Clear(); - SvLBoxEntry* pE = rListBox.GetEntry( 0 ); - EventsHash* eventsHash; - Reference< container::XNameReplace> nameReplace; - if(bAppEvents) - { - eventsHash = &m_appEventsHash; - nameReplace = m_xAppEvents; - } - else - { - eventsHash = &m_docEventsHash; - nameReplace = m_xDocEvents; - } - // have to use the original XNameReplace since the hash iterators do - // not guarantee the order in which the elements are returned - if(!nameReplace.is()) - { - return; - } - - Sequence< ::rtl::OUString > eventNames = nameReplace->getElementNames(); - ::std::set< ::rtl::OUString > aEventNamesCache; - ::std::copy( - eventNames.getConstArray(), - eventNames.getConstArray() + eventNames.getLength(), - ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aEventNamesCache, aEventNamesCache.end() ) - ); - - for ( EventDisplayNames::const_iterator displayableEvent = aDisplayNames.begin(); - displayableEvent != aDisplayNames.end(); - ++displayableEvent - ) - { - ::rtl::OUString sEventName( ::rtl::OUString::createFromAscii( displayableEvent->pAsciiEventName ) ); - if ( !nameReplace->hasByName( sEventName ) ) - continue; - - EventsHash::iterator h_it = eventsHash->find( sEventName ); - if( h_it == eventsHash->end() ) - { - OSL_FAIL( "_SvxMacroTabPage::DisplayAppEvents: something's suspicious here!" ); - continue; - } - - ::rtl::OUString eventURL = h_it->second.second; - String displayName( CUI_RES( displayableEvent->nEventResourceID ) ); - - displayName += '\t'; - SvLBoxEntry* _pE = rListBox.InsertEntry( displayName ); - ::rtl::OUString* pEventName = new ::rtl::OUString( sEventName ); - _pE->SetUserData( (void*)pEventName ); - String sNew( eventURL ); - _pE->ReplaceItem( new IconLBoxString( _pE, 0, sNew, - mpImpl->pMacroImg, mpImpl->pComponentImg ), LB_MACROS_ITEMPOS ); - rListBox.GetModel()->InvalidateEntry( _pE ); - rListBox.Select( _pE ); - rListBox.MakeVisible( _pE ); - } - - pE = rListBox.GetEntry(0); - if( pE ) - { - rListBox.Select( pE ); - rListBox.MakeVisible( pE ); - } - - rListBox.SetUpdateMode( sal_True ); - EnableButtons(); -} - -// select event handler on the listbox -IMPL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) -{ - _SvxMacroTabPage_Impl* pImpl = pThis->mpImpl; - SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.FirstSelected(); - sal_uLong nPos; - - if( !pE || LISTBOX_ENTRY_NOTFOUND == - ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - return 0; - } - - pThis->EnableButtons(); - return 0; -} - -IMPL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) -{ - return GenericHandler_Impl( pThis, pBtn ); -} - -IMPL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox *, EMPTYARG ) -{ - return GenericHandler_Impl( pThis, NULL ); -} - -// handler for double click on the listbox, and for the assign/delete buttons -long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn ) -{ - _SvxMacroTabPage_Impl* pImpl = pThis->mpImpl; - SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.FirstSelected(); - sal_uLong nPos; - if( !pE || LISTBOX_ENTRY_NOTFOUND == - ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - return 0; - } - - const sal_Bool bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); - - ::rtl::OUString* pEventName = (::rtl::OUString*)pE->GetUserData(); - - ::rtl::OUString sEventURL; - ::rtl::OUString sEventType; - if(pThis->bAppEvents) - { - EventsHash::iterator h_it = pThis->m_appEventsHash.find( *pEventName ); - if(h_it != pThis->m_appEventsHash.end() ) - { - sEventType = h_it->second.first; - sEventURL = h_it->second.second; - } - } - else - { - EventsHash::iterator h_it = pThis->m_docEventsHash.find( *pEventName ); - if(h_it != pThis->m_docEventsHash.end() ) - { - sEventType = h_it->second.first; - sEventURL = h_it->second.second; - } - } - - bool bDoubleClick = (pBtn == NULL); - bool bUNOAssigned = (sEventURL.indexOf( aVndSunStarUNO ) == 0); - if( pBtn == pImpl->pDeletePB ) - { - // delete pressed - sEventType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Script") ); - sEventURL = ::rtl::OUString(); - if(!pThis->bAppEvents) - pThis->bDocModified = true; - } - else if ( ( ( pBtn != NULL ) - && ( pBtn == pImpl->pAssignComponentPB ) - ) - || ( bDoubleClick - && bUNOAssigned - ) - ) - { - AssignComponentDialog* pAssignDlg = new AssignComponentDialog( pThis, sEventURL ); - - short ret = pAssignDlg->Execute(); - if( ret ) - { - sEventType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNO")); - sEventURL = pAssignDlg->getURL(); - if(!pThis->bAppEvents) - pThis->bDocModified = true; - } - delete pAssignDlg; - } - else if( bAssEnabled ) - { - // assign pressed - SvxScriptSelectorDialog* pDlg = new SvxScriptSelectorDialog( pThis, sal_False, pThis->GetFrame() ); - if( pDlg ) - { - short ret = pDlg->Execute(); - if ( ret ) - { - sEventType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Script")); - sEventURL = pDlg->GetScriptURL(); - if(!pThis->bAppEvents) - pThis->bDocModified = true; - } - } - } - - // update the hashes - if(pThis->bAppEvents) - { - EventsHash::iterator h_it = pThis->m_appEventsHash.find( *pEventName ); - h_it->second.first = sEventType; - h_it->second.second = sEventURL; - } - else - { - EventsHash::iterator h_it = pThis->m_docEventsHash.find( *pEventName ); - h_it->second.first = sEventType; - h_it->second.second = sEventURL; - } - - // update the listbox entry - pImpl->pEventLB->SetUpdateMode( sal_False ); - pE->ReplaceItem( new IconLBoxString( pE, 0, sEventURL, - pImpl->pMacroImg, pImpl->pComponentImg ), LB_MACROS_ITEMPOS ); - - rListBox.GetModel()->InvalidateEntry( pE ); - rListBox.Select( pE ); - rListBox.MakeVisible( pE ); - rListBox.SetUpdateMode( sal_True ); - - pThis->EnableButtons(); - return 0; -} - -// pass in the XNameReplace. -// can remove the 3rd arg once issue ?? is fixed -void _SvxMacroTabPage::InitAndSetHandler( Reference< container::XNameReplace> xAppEvents, Reference< container::XNameReplace> xDocEvents, Reference< util::XModifiable > xModifiable ) -{ - m_xAppEvents = xAppEvents; - m_xDocEvents = xDocEvents; - m_xModifiable = xModifiable; - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - HeaderBar& rHeaderBar = mpImpl->pEventLB->GetHeaderBar(); - Link aLnk(STATIC_LINK(this, _SvxMacroTabPage, AssignDeleteHdl_Impl )); - mpImpl->pDeletePB->SetClickHdl( aLnk ); - mpImpl->pAssignPB->SetClickHdl( aLnk ); - if( mpImpl->pAssignComponentPB ) - mpImpl->pAssignComponentPB->SetClickHdl( aLnk ); - rListBox.SetDoubleClickHdl( STATIC_LINK(this, _SvxMacroTabPage, DoubleClickHdl_Impl ) ); - - rListBox.SetSelectHdl( STATIC_LINK( this, _SvxMacroTabPage, SelectEvent_Impl )); - - rListBox.SetSelectionMode( SINGLE_SELECTION ); - rListBox.SetTabs( &nTabs[0], MAP_APPFONT ); - Size aSize( nTabs[ 2 ], 0 ); - rHeaderBar.InsertItem( ITEMID_EVENT, *mpImpl->pStrEvent, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); - aSize.Width() = 1764; // don't know what, so 42^2 is best to use... - rHeaderBar.InsertItem( ITMEID_ASSMACRO, *mpImpl->pAssignedMacro, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); - rListBox.SetSpaceBetweenEntries( 0 ); - - mpImpl->pEventLB->Show(); - mpImpl->pEventLB->ConnectElements(); - - long nMinLineHeight = mpImpl->pMacroImg->GetSizePixel().Height() + 2; - if( nMinLineHeight > mpImpl->pEventLB->GetListBox().GetEntryHeight() ) - mpImpl->pEventLB->GetListBox().SetEntryHeight( - sal::static_int_cast< short >(nMinLineHeight) ); - - mpImpl->pEventLB->Enable( sal_True ); - - if(!m_xAppEvents.is()) - { - return; - } - Sequence< ::rtl::OUString > eventNames = m_xAppEvents->getElementNames(); - sal_Int32 nEventCount = eventNames.getLength(); - for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent ) - { - //need exception handling here - try - { - m_appEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xAppEvents->getByName( eventNames[nEvent] ) ); - } - catch (const Exception&) - { - } - } - if(m_xDocEvents.is()) - { - eventNames = m_xDocEvents->getElementNames(); - nEventCount = eventNames.getLength(); - for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent ) - { - try - { - m_docEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xDocEvents->getByName( eventNames[nEvent] ) ); - } - catch (const Exception&) - { - } - } - } -} - -// returns the two props EventType & Script for a given event name -Any _SvxMacroTabPage::GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash ) -{ - const ::std::pair< ::rtl::OUString, ::rtl::OUString >& rAssignedEvent( eventsHash[ eventName ] ); - - Any aReturn; - ::comphelper::NamedValueCollection aProps; - if ( rAssignedEvent.first.getLength() && rAssignedEvent.second.getLength() ) - { - aProps.put( "EventType", rAssignedEvent.first ); - aProps.put( "Script", rAssignedEvent.second ); - } - aReturn <<= aProps.getPropertyValues(); - - return aReturn; -} - -// converts the Any returned by GetByName into a pair which can be stored in -// the EventHash -::std::pair< ::rtl::OUString, ::rtl::OUString > _SvxMacroTabPage::GetPairFromAny( Any aAny ) -{ - Sequence< beans::PropertyValue > props; - ::rtl::OUString type, url; - if( sal_True == ( aAny >>= props ) ) - { - ::comphelper::NamedValueCollection aProps( props ); - type = aProps.getOrDefault( "EventType", type ); - url = aProps.getOrDefault( "Script", url ); - } - return ::std::make_pair( type, url ); -} - -SvxMacroTabPage::SvxMacroTabPage( Window* pParent, const Reference< frame::XFrame >& _rxDocumentFrame, const SfxItemSet& rSet, Reference< container::XNameReplace > xNameReplace, sal_uInt16 nSelectedIndex ) - : _SvxMacroTabPage( pParent, CUI_RES( RID_SVXPAGE_MACROASSIGN ), rSet ) -{ - mpImpl->pStrEvent = new String( CUI_RES( STR_EVENT ) ); - mpImpl->pAssignedMacro = new String( CUI_RES( STR_ASSMACRO ) ); - mpImpl->pEventLB = new _HeaderTabListBox( this, CUI_RES( LB_EVENT ) ); - mpImpl->pAssignFT = new FixedText( this, CUI_RES( FT_ASSIGN ) ); - mpImpl->pAssignPB = new PushButton( this, CUI_RES( PB_ASSIGN ) ); - mpImpl->pDeletePB = new PushButton( this, CUI_RES( PB_DELETE ) ); - mpImpl->pAssignComponentPB = new PushButton( this, CUI_RES( PB_ASSIGN_COMPONENT ) ); - mpImpl->pMacroImg = new Image( CUI_RES(IMG_MACRO) ); - mpImpl->pComponentImg = new Image( CUI_RES(IMG_COMPONENT) ); - - FreeResource(); - - SetFrame( _rxDocumentFrame ); - - if( !mpImpl->bIDEDialogMode ) - { - Point aPosAssign = mpImpl->pAssignPB->GetPosPixel(); - Point aPosComp = mpImpl->pAssignComponentPB->GetPosPixel(); - - Point aPosDelete = mpImpl->pDeletePB->GetPosPixel(); - long nYDiff = aPosComp.Y() - aPosAssign.Y(); - aPosDelete.Y() -= nYDiff; - mpImpl->pDeletePB->SetPosPixel( aPosDelete ); - - mpImpl->pAssignComponentPB->Hide(); - mpImpl->pAssignComponentPB->Disable(); - } - - // must be done after FreeResource is called - InitResources(); - - mpImpl->pEventLB->GetListBox().SetHelpId( HID_SVX_MACRO_LB_EVENT ); - - InitAndSetHandler( xNameReplace, Reference< container::XNameReplace>(0), Reference< util::XModifiable >(0)); - DisplayAppEvents(true); - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.GetEntry( (sal_uLong)nSelectedIndex ); - if( pE ) - rListBox.Select(pE); -} - -SvxMacroTabPage::~SvxMacroTabPage() -{ -} - -SvxMacroAssignDlg::SvxMacroAssignDlg( Window* pParent, const Reference< frame::XFrame >& _rxDocumentFrame, const SfxItemSet& rSet, - const Reference< container::XNameReplace >& xNameReplace, sal_uInt16 nSelectedIndex ) - : SvxMacroAssignSingleTabDialog( pParent, rSet, 0 ) -{ - SetTabPage( new SvxMacroTabPage( this, _rxDocumentFrame, rSet, xNameReplace, nSelectedIndex ) ); -} - -SvxMacroAssignDlg::~SvxMacroAssignDlg() -{ -} - - -//=============================================== - -IMPL_LINK(AssignComponentDialog, ButtonHandler, Button *, EMPTYARG) -{ - ::rtl::OUString aMethodName = maMethodEdit.GetText(); - maURL = ::rtl::OUString(); - if( aMethodName.getLength() ) - { - maURL = aVndSunStarUNO; - maURL += aMethodName; - } - EndDialog(1); - return 0; -} - -AssignComponentDialog::AssignComponentDialog( Window * pParent, const ::rtl::OUString& rURL ) - : ModalDialog( pParent, CUI_RES( RID_SVXDLG_ASSIGNCOMPONENT ) ) - , maMethodLabel( this, CUI_RES( FT_METHOD ) ) - , maMethodEdit( this, CUI_RES( EDIT_METHOD ) ) - , maOKButton( this, CUI_RES( RID_PB_OK ) ) - , maCancelButton( this, CUI_RES( RID_PB_CANCEL ) ) - , maHelpButton( this, CUI_RES( RID_PB_HELP ) ) - , maURL( rURL ) -{ - FreeResource(); - maOKButton.SetClickHdl(LINK(this, AssignComponentDialog, ButtonHandler)); - - ::rtl::OUString aMethodName; - if( maURL.getLength() ) - { - sal_Int32 nIndex = maURL.indexOf( aVndSunStarUNO ); - if( nIndex == 0 ) - { - sal_Int32 nBegin = aVndSunStarUNO.getLength(); - aMethodName = maURL.copy( nBegin ); - } - } - maMethodEdit.SetText( aMethodName, Selection( 0, SELECTION_MAX ) ); -} - -AssignComponentDialog::~AssignComponentDialog() -{ -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton ) -{ - (void)pButton; //unused - pPage->FillItemSet( *pOutSet ); - EndDialog( RET_OK ); - return 0; -} - -// ----------------------------------------------------------------------- - -SvxMacroAssignSingleTabDialog::SvxMacroAssignSingleTabDialog - ( Window *pParent, const SfxItemSet& rSet, sal_uInt16 nUniqueId ) : - SfxModalDialog( pParent, nUniqueId, WinBits( WB_STDMODAL | WB_3DLOOK ) ), - pFixedLine ( 0 ), - pOKBtn ( 0 ), - pCancelBtn ( 0 ), - pHelpBtn ( 0 ), - pPage ( 0 ), - pOptions ( &rSet ), - pOutSet ( 0 ) -{} - - -// ----------------------------------------------------------------------- - -SvxMacroAssignSingleTabDialog::~SvxMacroAssignSingleTabDialog() -{ - delete pFixedLine; - delete pOKBtn; - delete pCancelBtn; - delete pHelpBtn; - delete pPage; -} - -// ----------------------------------------------------------------------- - -// According to SfxSingleTabDialog -void SvxMacroAssignSingleTabDialog::SetTabPage( SfxTabPage* pTabPage ) -{ - pFixedLine = new FixedLine( this ); - - pOKBtn = new OKButton( this, WB_DEFBUTTON ); - pOKBtn->SetClickHdl( LINK( this, SvxMacroAssignSingleTabDialog, OKHdl_Impl ) ); - - pCancelBtn = new CancelButton( this ); - pHelpBtn = new HelpButton( this ); - - pPage = pTabPage; - - if ( pPage ) - { - String sUserData; - pPage->SetUserData( sUserData ); - pPage->Reset( *pOptions ); - pPage->Show(); - - // Set dialog's and buttons' size and position according to tabpage size - long nSpaceX = LogicToPixel( Size( 6, 0 ), MAP_APPFONT ).Width(); - long nSpaceY = LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height(); - long nHalfSpaceX = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width(); - long nHalfSpaceY = LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height(); - - pPage->SetPosPixel( Point() ); - Size aTabpageSize( pPage->GetSizePixel() ); - Size aDialogSize( aTabpageSize ); - Size aButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); - long nButtonWidth = aButtonSize.Width(); - long nButtonHeight = aButtonSize.Height(); - - Size aFixedLineSize( aTabpageSize ); - long nFixedLineHeight = LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height(); - aFixedLineSize.Height() = nFixedLineHeight; - - aDialogSize.Height() += nFixedLineHeight + nButtonHeight + nSpaceY + nHalfSpaceY; - SetOutputSizePixel( aDialogSize ); - - long nButtonPosY = aTabpageSize.Height() + nFixedLineHeight + nHalfSpaceY; - long nHelpButtonPosX = nSpaceX; - pHelpBtn->SetPosSizePixel( Point( nHelpButtonPosX, nButtonPosY), aButtonSize ); - pHelpBtn->Show(); - - long nCancelButtonPosX = aDialogSize.Width() - nButtonWidth - nSpaceX + 1; - pCancelBtn->SetPosSizePixel( Point( nCancelButtonPosX, nButtonPosY), aButtonSize ); - pCancelBtn->Show(); - - long nOkButtonPosX = nCancelButtonPosX - nButtonWidth - nHalfSpaceX; - pOKBtn->SetPosSizePixel( Point( nOkButtonPosX, nButtonPosY), aButtonSize ); - pOKBtn->Show(); - - long nFixedLinePosY = aTabpageSize.Height(); - pFixedLine->SetPosSizePixel( Point( 0, nFixedLinePosY), aFixedLineSize ); - pFixedLine->Show(); - - // Get text from TabPage - SetText( pPage->GetText() ); - - // Get IDs from TabPage - SetHelpId( pPage->GetHelpId() ); - SetUniqueId( pPage->GetUniqueId() ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/macropg.hrc b/cui/source/customize/macropg.hrc deleted file mode 100644 index f1245c0a6..000000000 --- a/cui/source/customize/macropg.hrc +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MACROPG_HRC -#define _MACROPG_HRC - -#ifndef _SVT_CONTROLDIMS_HRC_ -#include -#endif - -#define LB_EVENT 1 -#define PB_ASSIGN 2 -#define PB_DELETE 3 -#define STR_EVENT 4 -#define STR_ASSMACRO 5 -#define FT_ASSIGN 6 -#define PB_ASSIGN_COMPONENT 7 - -// Starting new IDs with 30 as eventdlg.hrc also includes this file -#define IMG_MACRO 30 -#define IMG_COMPONENT 31 - -#define RID_PB_OK 41 -#define RID_PB_CANCEL 42 -#define RID_PB_HELP 43 -#define FT_METHOD 44 -#define EDIT_METHOD 45 - - -// COL0<---------------WIDTH_1_2--------------->COL3<->COL4<----WIDTH4---->COL5 -// <--WIDTH1-->COL1<-SPACE1->COL2<--WIDTH2-> - -#define WIDTH_TP 260 // of whole tabpage -#define COL5 (WIDTH_TP-RSC_SP_DLG_INNERBORDER_RIGHT) -#define COL4 (COL5-RSC_CD_PUSHBUTTON_WIDTH) -#define COL3 (COL4-RSC_SP_CTRL_X) -#define COL0 (RSC_SP_TBPG_INNERBORDER_LEFT) -#define WIDTH1_2 (COL3-COL0) // width of upper listbox -#define SPACE1 4 // space between lower listboxes -#define WIDTH1 ((WIDTH1_2-SPACE1)/2) // width of lower left listbox -#define WIDTH2 (WIDTH1_2-WIDTH1-SPACE1) // width of lower right listbox -#define COL1 (COL0+WIDTH1) -#define COL2 (COL1+SPACE1) - -#define HEIGHT0 158 // of upper listbox -#define HEIGHT_TP (HEIGHT0+6) // of whole tabpage -#define ROW0 6 // more than RSC_SP_FLGR_INNERBORDER_TOP cause of bad design -#define ROW0A (ROW0+RSC_CD_FIXEDTEXT_HEIGHT+SPACE1) -#define ROW1 (ROW0A+RSC_CD_PUSHBUTTON_HEIGHT) // Assign button -#define ROW2 (ROW1+RSC_SP_CTRL_GROUP_Y) -#define ROW3 (ROW2+RSC_CD_PUSHBUTTON_HEIGHT) // Assign component button -#define ROW4 (ROW3+RSC_SP_CTRL_GROUP_Y) -#define ROW5_REMOVE (ROW4+RSC_SP_CTRL_GROUP_Y) // Remove button -#define ROW5 (ROW4+RSC_CD_DROPDOWN_HEIGHT) // script type listbox (hidden) -#define ROW6 (ROW0+HEIGHT0) -#define ROW7 (ROW6+RSC_SP_CTRL_Y) -#define HEIGHT_EXTRA7 (RSC_CD_FIXEDTEXT_HEIGHT) // additional height for FT_LABEL4LB_MACROS -#define ROW7A (ROW7+HEIGHT_EXTRA7) -#define ROW8 (ROW7+RSC_CD_FIXEDTEXT_HEIGHT+HEIGHT_EXTRA7)// label for lower listboxes (2 lines!) -#define ROW9 (HEIGHT_TP-RSC_SP_TBPG_INNERBORDER_BOTTOM) -#define HEIGHT8 (ROW9-ROW8) // of lower listboxes - -#define COMP_EDIT_WIDTH 100 -#define COMP_DIST_Y 6 -#define COMP_WIDTH (COMP_EDIT_WIDTH+RSC_CD_PUSHBUTTON_WIDTH+3*COMP_DIST_Y) -#define COMP_COL0 COMP_DIST_Y -#define COMP_COL1 (COMP_COL0+COMP_EDIT_WIDTH+COMP_DIST_Y) -#define COMP_ROW0 6 -#define COMP_ROW1 (COMP_ROW0+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_GROUP_Y) -#define COMP_ROW2 (COMP_ROW1+RSC_CD_PUSHBUTTON_HEIGHT+2*RSC_SP_CTRL_GROUP_Y) -#define COMP_ROWEDIT (COMP_ROW0+RSC_CD_FIXEDTEXT_HEIGHT+2) -#define COMP_HEIGHT (COMP_ROW2+RSC_CD_PUSHBUTTON_HEIGHT+2*RSC_SP_CTRL_GROUP_Y) - -#endif - diff --git a/cui/source/customize/macropg.src b/cui/source/customize/macropg.src deleted file mode 100644 index bb4a17f9f..000000000 --- a/cui/source/customize/macropg.src +++ /dev/null @@ -1,480 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "macropg.hrc" -#include -#include "helpid.hrc" -#include - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -TabPage RID_SVXPAGE_MACROASSIGN -{ - HelpID = "cui:TabPage:RID_SVXPAGE_MACROASSIGN" ; - Hide = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( WIDTH_TP , HEIGHT_TP ) ; - Text [ en-US ] = "Assign action" ; - String STR_EVENT - { - Text [ en-US ] = "Event" ; - }; - String STR_ASSMACRO - { - Text [ en-US ] = "Assigned Action" ; - }; - Control LB_EVENT - { - Border = TRUE ; - TabStop = TRUE; - Pos = MAP_APPFONT ( COL0 , ROW0 ) ; - Size = MAP_APPFONT ( WIDTH1_2 , HEIGHT0 ) ; - HelpID = HID_SVX_MACRO_LB_EVENT ; - }; - FixedText FT_ASSIGN - { - Pos = MAP_APPFONT ( COL4 , ROW0 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Assign:" ; - }; - PushButton PB_ASSIGN - { - HelpID = "cui:PushButton:RID_SVXPAGE_MACROASSIGN:PB_ASSIGN"; - Pos = MAP_APPFONT ( COL4 , ROW0A ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "M~acro..." ; - Disable = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_ASSIGN_COMPONENT - { - HelpID = "cui:PushButton:RID_SVXPAGE_MACROASSIGN:PB_ASSIGN_COMPONENT"; - Pos = MAP_APPFONT ( COL4 , ROW2 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Disable = TRUE ; - TabStop = TRUE ; - Text [ en-US ] = "Com~ponent..." ; - }; - PushButton PB_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_MACROASSIGN:PB_DELETE"; - Pos = MAP_APPFONT ( COL4 , ROW5_REMOVE ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "~Remove" ; - Disable = TRUE ; - TabStop = TRUE ; - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "id018.png"; }; - MASKCOLOR - }; - Image IMG_COMPONENT - { - ImageBitmap = Bitmap { File = "component_16.png"; }; - MASKCOLOR - }; -}; - -ModalDialog RID_SVXDLG_ASSIGNCOMPONENT -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_ASSIGNCOMPONENT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( COMP_WIDTH , COMP_HEIGHT ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Assign Component"; - OKButton RID_PB_OK - { - Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW0 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton RID_PB_CANCEL - { - Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW1 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - HelpButton RID_PB_HELP - { - Pos = MAP_APPFONT ( COMP_COL1 , COMP_ROW2 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - }; - FixedText FT_METHOD - { - Pos = MAP_APPFONT ( COMP_COL0 , ROW0 ) ; - Size = MAP_APPFONT ( COMP_EDIT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Component method name" ; - }; - Edit EDIT_METHOD - { - HelpID = "cui:Edit:RID_SVXDLG_ASSIGNCOMPONENT:EDIT_METHOD"; - Border = TRUE ; - Pos = MAP_APPFONT ( COMP_COL0 , COMP_ROWEDIT ) ; - Size = MAP_APPFONT ( COMP_EDIT_WIDTH , RSC_CD_TEXTBOX_HEIGHT ) ; - TabStop = TRUE ; - }; -}; - - -//DF -String RID_SVXSTR_EVENT_STARTAPP -{ - Text [ en-US ] = "Start Application" ; -}; - -String RID_SVXSTR_EVENT_CLOSEAPP -{ - Text [ en-US ] = "Close Application" ; -}; - -String RID_SVXSTR_EVENT_NEWDOC -{ - Text [ en-US ] = "New Document" ; -}; - -String RID_SVXSTR_EVENT_CLOSEDOC -{ - Text [ en-US ] = "Document closed" ; -}; - -String RID_SVXSTR_EVENT_PREPARECLOSEDOC -{ - Text [ en-US ] = "Document is going to be closed" ; -}; - -String RID_SVXSTR_EVENT_OPENDOC -{ - Text [ en-US ] = "Open Document" ; -}; - -String RID_SVXSTR_EVENT_SAVEDOC -{ - Text [ en-US ] = "Save Document" ; -}; - -String RID_SVXSTR_EVENT_SAVEASDOC -{ - Text [ en-US ] = "Save Document As" ; -}; - -String RID_SVXSTR_EVENT_SAVEDOCDONE -{ - Text [ en-US ] = "Document has been saved" ; -}; - -String RID_SVXSTR_EVENT_SAVEASDOCDONE -{ - Text [ en-US ] = "Document has been saved as" ; -}; - -String RID_SVXSTR_EVENT_ACTIVATEDOC -{ - Text [ en-US ] = "Activate Document" ; -}; - -String RID_SVXSTR_EVENT_DEACTIVATEDOC -{ - Text [ en-US ] = "Deactivate Document" ; -}; - -String RID_SVXSTR_EVENT_PRINTDOC -{ - Text [ en-US ] = "Print Document" ; -}; - -String RID_SVXSTR_EVENT_MODIFYCHANGED -{ - Text [ en-US ] = "'Modified' status was changed" ; -}; -String RID_SVXSTR_EVENT_MAILMERGE -{ - Text [ en-US ] = "Printing of form letters started" ; -}; -String RID_SVXSTR_EVENT_MAILMERGE_END -{ - Text [ en-US ] = "Printing of form letters finished" ; -}; -String RID_SVXSTR_EVENT_FIELDMERGE -{ - Text [ en-US ] = "Merging of form fields started" ; -}; -String RID_SVXSTR_EVENT_FIELDMERGE_FINISHED -{ - Text [ en-US ] = "Merging of form fields finished" ; -}; -String RID_SVXSTR_EVENT_PAGECOUNTCHANGE -{ - Text [ en-US ] = "Changing the page count" ; -}; -String RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED -{ - Text [ en-US ] = "Loaded a sub component" ; -}; -String RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED -{ - Text [ en-US ] = "Closed a sub component" ; -}; -String RID_SVXSTR_EVENT_APPROVEPARAMETER -{ - Text [ en-US ] = "Fill parameters" ; -}; -String RID_SVXSTR_EVENT_ACTIONPERFORMED -{ - Text [ en-US ] = "Execute action" ; -}; -String RID_SVXSTR_EVENT_AFTERUPDATE -{ - Text [ en-US ] = "After updating" ; -}; -String RID_SVXSTR_EVENT_BEFOREUPDATE -{ - Text [ en-US ] = "Before updating" ; -}; -String RID_SVXSTR_EVENT_APPROVEROWCHANGE -{ - Text [ en-US ] = "Before record action" ; -}; -String RID_SVXSTR_EVENT_ROWCHANGE -{ - Text [ en-US ] = "After record action" ; -}; -String RID_SVXSTR_EVENT_CONFIRMDELETE -{ - Text [ en-US ] = "Confirm deletion" ; -}; -String RID_SVXSTR_EVENT_ERROROCCURRED -{ - Text [ en-US ] = "Error occurred" ; -}; -String RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED -{ - Text [ en-US ] = "While adjusting"; -}; -String RID_SVXSTR_EVENT_FOCUSGAINED -{ - Text [ en-US ] = "When receiving focus" ; -}; -String RID_SVXSTR_EVENT_FOCUSLOST -{ - Text [ en-US ] = "When losing focus" ; -}; -String RID_SVXSTR_EVENT_ITEMSTATECHANGED -{ - Text [ en-US ] = "Item status changed" ; -}; -String RID_SVXSTR_EVENT_KEYTYPED -{ - Text [ en-US ] = "Key pressed" ; -}; -String RID_SVXSTR_EVENT_KEYUP -{ - Text [ en-US ] = "Key released" ; -}; -String RID_SVXSTR_EVENT_LOADED -{ - Text [ en-US ] = "When loading" ; -}; -String RID_SVXSTR_EVENT_RELOADING -{ - Text [ en-US ] = "Before reloading" ; -}; -String RID_SVXSTR_EVENT_RELOADED -{ - Text [ en-US ] = "When reloading" ; -}; -String RID_SVXSTR_EVENT_MOUSEDRAGGED -{ - Text [ en-US ] = "Mouse moved while key pressed" ; -}; -String RID_SVXSTR_EVENT_MOUSEENTERED -{ - Text [ en-US ] = "Mouse inside" ; -}; -String RID_SVXSTR_EVENT_MOUSEEXITED -{ - Text [ en-US ] = "Mouse outside" ; -}; -String RID_SVXSTR_EVENT_MOUSEMOVED -{ - Text [ en-US ] = "Mouse moved" ; -}; -String RID_SVXSTR_EVENT_MOUSEPRESSED -{ - Text [ en-US ] = "Mouse button pressed" ; -}; -String RID_SVXSTR_EVENT_MOUSERELEASED -{ - Text [ en-US ] = "Mouse button released" ; -}; -String RID_SVXSTR_EVENT_POSITIONING -{ - Text [ en-US ] = "Before record change" ; -}; -String RID_SVXSTR_EVENT_POSITIONED -{ - Text [ en-US ] = "After record change" ; -}; -String RID_SVXSTR_EVENT_RESETTED -{ - Text [ en-US ] = "After resetting" ; -}; -String RID_SVXSTR_EVENT_APPROVERESETTED -{ - Text [ en-US ] = "Prior to reset" ; -}; -String RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED -{ - Text [ en-US ] = "Approve action" ; -}; -String RID_SVXSTR_EVENT_SUBMITTED -{ - Text [ en-US ] = "Before submitting" ; -}; -String RID_SVXSTR_EVENT_TEXTCHANGED -{ - Text [ en-US ] = "Text modified" ; -}; -String RID_SVXSTR_EVENT_UNLOADING -{ - Text [ en-US ] = "Before unloading" ; -}; -String RID_SVXSTR_EVENT_UNLOADED -{ - Text [ en-US ] = "When unloading" ; -}; -String RID_SVXSTR_EVENT_CHANGED -{ - Text [ en-US ] = "Changed" ; -}; - -String RID_SVXSTR_EVENT_CREATEDOC -{ - Text [ en-US ] = "Document created" ; -}; - -String RID_SVXSTR_EVENT_LOADDOCFINISHED -{ - Text [ en-US ] = "Document loading finished" ; -}; - -String RID_SVXSTR_EVENT_SAVEDOCFAILED -{ - Text [ en-US ] = "Saving of document failed" ; -}; - -String RID_SVXSTR_EVENT_SAVEASDOCFAILED -{ - Text [ en-US ] = "'Save as' has failed" ; -}; - -String RID_SVXSTR_EVENT_COPYTODOC -{ - Text [ en-US ] = "Storing or exporting copy of document" ; -}; - -String RID_SVXSTR_EVENT_COPYTODOCDONE -{ - Text [ en-US ] = "Document copy has been created" ; -}; - -String RID_SVXSTR_EVENT_COPYTODOCFAILED -{ - Text [ en-US ] = "Creating of document copy failed" ; -}; - -String RID_SVXSTR_EVENT_VIEWCREATED -{ - Text [ en-US ] = "View created" ; -}; - -String RID_SVXSTR_EVENT_PREPARECLOSEVIEW -{ - Text [ en-US ] = "View is going to be closed" ; -}; - -String RID_SVXSTR_EVENT_CLOSEVIEW -{ - Text [ en-US ] = "View closed" ; -}; - -String RID_SVXSTR_EVENT_TITLECHANGED -{ - Text [ en-US ] = "Document title changed" ; -}; - -String RID_SVXSTR_EVENT_MODECHANGED -{ - Text [ en-US ] = "Document mode changed" ; -}; - -String RID_SVXSTR_EVENT_VISAREACHANGED -{ - Text [ en-US ] = "Visible area changed" ; -}; - -String RID_SVXSTR_EVENT_STORAGECHANGED -{ - Text [ en-US ] = "Document has got a new storage" ; -}; - -String RID_SVXSTR_EVENT_LAYOUT_FINISHED -{ - Text [ en-US ] = "Document layout finished" ; -}; - -String RID_SVXSTR_EVENT_SELECTIONCHANGED -{ - Text [ en-US ] = "Selection changed" ; -}; - -String RID_SVXSTR_EVENT_DOUBLECLICK -{ - Text [ en-US ] = "Double click" ; -}; - -String RID_SVXSTR_EVENT_RIGHTCLICK -{ - Text [ en-US ] = "Right click" ; -}; - -String RID_SVXSTR_EVENT_CALCULATE -{ - Text [ en-US ] = "Formulas calculated" ; -}; - -String RID_SVXSTR_EVENT_CONTENTCHANGED -{ - Text [ en-US ] = "Content changed" ; -}; - diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx deleted file mode 100644 index 52ffc9a21..000000000 --- a/cui/source/customize/macropg_impl.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MACROPG_IMPL_HXX -#define _MACROPG_IMPL_HXX - -class _SvxMacroTabPage_Impl -{ -public: - _SvxMacroTabPage_Impl( const SfxItemSet& rAttrSet ); - ~_SvxMacroTabPage_Impl(); - - FixedText* pAssignFT; - PushButton* pAssignPB; - PushButton* pAssignComponentPB; - PushButton* pDeletePB; - Image* pMacroImg; - Image* pComponentImg; - String* pStrEvent; - String* pAssignedMacro; - _HeaderTabListBox* pEventLB; - sal_Bool bReadOnly; - sal_Bool bIDEDialogMode; -}; - -class AssignComponentDialog : public ModalDialog -{ -private: - FixedText maMethodLabel; - Edit maMethodEdit; - OKButton maOKButton; - CancelButton maCancelButton; - HelpButton maHelpButton; - - ::rtl::OUString maURL; - - DECL_LINK(ButtonHandler, Button *); - -public: - AssignComponentDialog( Window * pParent, const ::rtl::OUString& rURL ); - ~AssignComponentDialog(); - - ::rtl::OUString getURL( void ) const - { return maURL; } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx deleted file mode 100644 index 81e0eeec8..000000000 --- a/cui/source/customize/selector.cxx +++ /dev/null @@ -1,1175 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include "selector.hxx" -#include -#include "selector.hrc" -#include // for RID_SVXIMG_... -#include // for RID_SVXIMG_... -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using ::rtl::OUString; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::script; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::container; - -#define _SVSTDARR_STRINGSDTOR -#include -#include -#include -#include - -SV_IMPL_PTRARR(SvxGroupInfoArr_Impl, SvxGroupInfoPtr); - -/* - * The implementations of SvxConfigFunctionListBox_Impl and - * SvxConfigGroupListBox_Impl are copied from sfx2/source/dialog/cfg.cxx - */ -SvxConfigFunctionListBox_Impl::SvxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId) - : SvTreeListBox( pParent, rResId ) - , pCurEntry( 0 ) - , m_pDraggingEntry( 0 ) -{ - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); - GetModel()->SetSortMode( SortAscending ); - - // Timer for the BallonHelp - aTimer.SetTimeout( 200 ); - aTimer.SetTimeoutHdl( - LINK( this, SvxConfigFunctionListBox_Impl, TimerHdl ) ); -} - -SvxConfigFunctionListBox_Impl::~SvxConfigFunctionListBox_Impl() -{ - ClearAll(); -} - -SvLBoxEntry* SvxConfigFunctionListBox_Impl::GetLastSelectedEntry() -{ - if ( m_pDraggingEntry != NULL ) - { - return m_pDraggingEntry; - } - else - { - return FirstSelected(); - } -} - -void SvxConfigFunctionListBox_Impl::MouseMove( const MouseEvent& rMEvt ) -{ - Point aMousePos = rMEvt.GetPosPixel(); - pCurEntry = GetCurEntry(); - - if ( pCurEntry && GetEntry( aMousePos ) == pCurEntry ) - aTimer.Start(); - else - { - Help::ShowBalloon( this, aMousePos, String() ); - aTimer.Stop(); - } -} - - -IMPL_LINK( SvxConfigFunctionListBox_Impl, TimerHdl, Timer*, EMPTYARG) -{ - aTimer.Stop(); - Point aMousePos = GetPointerPosPixel(); - SvLBoxEntry *pEntry = GetCurEntry(); - if ( pEntry && GetEntry( aMousePos ) == pEntry && pCurEntry == pEntry ) - Help::ShowBalloon( this, OutputToScreenPixel( aMousePos ), GetHelpText( pEntry ) ); - return 0L; -} - -void SvxConfigFunctionListBox_Impl::ClearAll() -{ - sal_uInt16 nCount = aArr.Count(); - for ( sal_uInt16 i=0; iGetUserData(): 0; - - if ( pInfo ) - { - if ( pInfo->nKind == SVX_CFGFUNCTION_SLOT ) - { - OUString aCmdURL( pInfo->sURL ); - - OUString aHelpText = Application::GetHelp()->GetHelpText( aCmdURL, this ); - - return aHelpText; - } - else if ( pInfo->nKind == SVX_CFGFUNCTION_SCRIPT ) - { - return pInfo->sHelpText; - } - } - - return String(); -} - -void SvxConfigFunctionListBox_Impl::FunctionSelected() -{ - Help::ShowBalloon( this, Point(), String() ); -} - -// drag and drop support -DragDropMode SvxConfigFunctionListBox_Impl::NotifyStartDrag( - TransferDataContainer& /*aTransferDataContainer*/, SvLBoxEntry* pEntry ) -{ - m_pDraggingEntry = pEntry; - return GetDragDropMode(); -} - -void SvxConfigFunctionListBox_Impl::DragFinished( sal_Int8 /*nDropAction*/ ) -{ - m_pDraggingEntry = NULL; -} - -sal_Int8 -SvxConfigFunctionListBox_Impl::AcceptDrop( const AcceptDropEvent& /*rEvt*/ ) -{ - return DND_ACTION_NONE; -} - -SvxConfigGroupListBox_Impl::SvxConfigGroupListBox_Impl( - Window* pParent, const ResId& rResId, - bool _bShowSlots, const Reference< frame::XFrame >& xFrame ) - : SvTreeListBox( pParent, rResId ) - , m_bShowSlots( _bShowSlots ), - m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())), - m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())), - m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())), - m_docImage(ResId(IMG_DOC,*rResId.GetResMgr())), - m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))), - m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr()))) -{ - FreeResource(); - - if ( xFrame != NULL ) - { - m_xFrame.set( xFrame ); - } - - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ); - - ImageList aNavigatorImages( SVX_RES( RID_SVXIMGLIST_FMEXPL ) ); - - SetNodeBitmaps( - aNavigatorImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ), - aNavigatorImages.GetImage( RID_SVXIMG_EXPANDEDNODE ) - ); -} - - -SvxConfigGroupListBox_Impl::~SvxConfigGroupListBox_Impl() -{ - ClearAll(); -} - -void SvxConfigGroupListBox_Impl::ClearAll() -{ - sal_uInt16 nCount = aArr.Count(); - for ( sal_uInt16 i=0; i if it cannot find such a - model - */ - static Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent ) - { - Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY ); - if ( !xScripts.is() ) - { - Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY ); - if ( xContext.is() ) - xScripts.set( xContext->getScriptContainer(), UNO_QUERY ); - } - - return Reference< XModel >( xScripts, UNO_QUERY ); - } - - //........................................... - static Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame ) - { - Reference< XModel > xDocument; - - // examine our associated frame - try - { - OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" ); - if ( _rxFrame.is() ) - { - // first try the model in the frame - Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW ); - xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() ); - - if ( !xDocument.is() ) - { - // if there is no suitable document in the frame, try the controller - xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() ); - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return xDocument; - } -} - -void SvxConfigGroupListBox_Impl::fillScriptList( const Reference< browse::XBrowseNode >& _rxRootNode, SvLBoxEntry* _pParentEntry, bool _bCheapChildsOnDemand ) -{ - OSL_PRECOND( _rxRootNode.is(), "SvxConfigGroupListBox_Impl::fillScriptList: invalid root node!" ); - if ( !_rxRootNode.is() ) - return; - - try - { - if ( _rxRootNode->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > children = - _rxRootNode->getChildNodes(); - - sal_Bool bIsRootNode = _rxRootNode->getName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Root")); - - /* To mimic current starbasic behaviour we - need to make sure that only the current document - is displayed in the config tree. Tests below - set the bDisplay flag to sal_False if the current - node is a first level child of the Root and is NOT - either the current document, user or share */ - OUString sCurrentDocTitle; - Reference< XModel > xWorkingDocument = lcl_getScriptableDocument_nothrow( m_xFrame ); - if ( xWorkingDocument.is() ) - { - sCurrentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xWorkingDocument ); - } - - for ( long n = 0; n < children.getLength(); ++n ) - { - Reference< browse::XBrowseNode >& theChild = children[n]; - //#139111# some crash reports show that it might be unset - if ( !theChild.is() ) - continue; - ::rtl::OUString sUIName = theChild->getName(); - sal_Bool bDisplay = sal_True; - - if ( bIsRootNode - || ( m_bShowSlots && _pParentEntry && ( GetModel()->GetDepth( _pParentEntry ) == 0 ) ) - // if we show slots (as in the customize dialog) - // then the user & share are added at depth=1 - ) - { - if ( sUIName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "user" ) ) ) - { - sUIName = m_sMyMacros; - bIsRootNode = sal_True; - } - else if ( sUIName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "share" ) ) ) - { - sUIName = m_sProdMacros; - bIsRootNode = sal_True; - } - else if ( !sUIName.equals( sCurrentDocTitle ) ) - { - bDisplay = sal_False; - } - } - - if ( !bDisplay ) - continue; - - if ( children[n]->getType() == browse::BrowseNodeTypes::SCRIPT ) - continue; - - SvLBoxEntry* pNewEntry = InsertEntry( sUIName, _pParentEntry ); - - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Image aImage = GetImage( theChild, aContext.getUNOContext(), bIsRootNode ); - SetExpandedEntryBmp( pNewEntry, aImage ); - SetCollapsedEntryBmp( pNewEntry, aImage ); - - SvxGroupInfo_Impl* pInfo = - new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, theChild ); - pNewEntry->SetUserData( pInfo ); - aArr.Insert( pInfo, aArr.Count() ); - - if ( _bCheapChildsOnDemand ) - { - /* i30923 - Would be nice if there was a better - * way to determine if a basic lib had children - * without having to ask for them (which forces - * the library to be loaded */ - pNewEntry->EnableChildsOnDemand( sal_True ); - } - else - { - // if there are granchildren we're interested in, display the '+' before - // the entry, but do not yet expand - Sequence< Reference< browse::XBrowseNode > > grandchildren = - children[n]->getChildNodes(); - - for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m ) - { - if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER ) - { - pNewEntry->EnableChildsOnDemand( sal_True ); - break; - } - } - } - } - } - } - catch (const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -void SvxConfigGroupListBox_Impl::Init() -{ - SetUpdateMode(sal_False); - ClearAll(); - - Reference< XComponentContext > xContext; - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - - xContext.set( xProps->getPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), - UNO_QUERY ); - - // are we showing builtin commands? - if ( m_bShowSlots && xContext.is() && m_xFrame.is() ) - { - Reference< lang::XMultiComponentFactory > xMCF = - xContext->getServiceManager(); - - Reference< frame::XDispatchInformationProvider > xDIP( - m_xFrame, UNO_QUERY ); - - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( xMCF->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" )), - xContext ), - UNO_QUERY ); - - OUString aModuleId; - try{ - aModuleId = xModuleManager->identify( m_xFrame ); - }catch(const uno::Exception&) - { aModuleId = ::rtl::OUString(); } - - Reference< container::XNameAccess > xNameAccess( - xMCF->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.UICommandDescription" )), - xContext ), - UNO_QUERY ); - - if ( xNameAccess.is() ) - { - xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands; - } - - Reference< container::XNameAccess > xAllCategories( - xMCF->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ui.UICategoryDescription" )), - xContext ), - UNO_QUERY ); - - Reference< container::XNameAccess > xModuleCategories; - if ( xAllCategories.is() ) - { - if ( aModuleId.getLength() != 0 ) - { - try - { - xModuleCategories = Reference< container::XNameAccess >( - xAllCategories->getByName( aModuleId ), UNO_QUERY ); - } - catch ( container::NoSuchElementException& ) - { - } - } - - if ( !xModuleCategories.is() ) - { - xModuleCategories = xAllCategories; - } - } - - if ( xModuleCategories.is() ) - { - Sequence< sal_Int16 > gids = - xDIP->getSupportedCommandGroups(); - - for ( sal_Int32 i = 0; i < gids.getLength(); ++i ) - { - Sequence< frame::DispatchInformation > commands; - try - { - commands = - xDIP->getConfigurableDispatchInformation( gids[i] ); - } - catch ( container::NoSuchElementException& ) - { - continue; - } - - if ( commands.getLength() == 0 ) - { - continue; - } - - sal_Int32 gid = gids[i]; - OUString idx = OUString::valueOf( gid ); - OUString group = idx; - try - { - xModuleCategories->getByName( idx ) >>= group; - } - catch ( container::NoSuchElementException& ) - { - } - - SvLBoxEntry *pEntry = InsertEntry( group, NULL ); - - SvxGroupInfo_Impl *pInfo = - new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] ); - aArr.Insert( pInfo, aArr.Count() ); - - pEntry->SetUserData( pInfo ); - } - } - } - - if ( xContext.is() ) - { - // Add Scripting Framework entries - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext> xCtx; - - try - { - Reference < beans::XPropertySet > _xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - xCtx.set( _xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY_THROW ); - Reference< browse::XBrowseNodeFactory > xFac( xCtx->getValueByName( - OUString(RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.script.browse.theBrowseNodeFactory")) ), UNO_QUERY_THROW ); - rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - if ( rootNode.is() ) - { - if ( m_bShowSlots ) - { - SvxGroupInfo_Impl *pInfo = - new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode ); - - String aTitle = - String( CUI_RES( STR_SELECTOR_MACROS ) ); - - SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL ); - pNewEntry->SetUserData( pInfo ); - pNewEntry->EnableChildsOnDemand( sal_True ); - aArr.Insert( pInfo, aArr.Count() ); - } - else - { - fillScriptList( rootNode, NULL, false ); - } - } - } - MakeVisible( GetEntry( 0,0 ) ); - SetUpdateMode( sal_True ); -} - -Image SvxConfigGroupListBox_Impl::GetImage( - Reference< browse::XBrowseNode > node, - Reference< XComponentContext > xCtx, - bool bIsRootNode -) -{ - Image aImage; - if ( bIsRootNode ) - { - if ( node->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "user" ) ) || node->getName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "share" ) ) ) - { - aImage = m_hdImage; - } - else - { - OUString factoryURL; - OUString nodeName = node->getName(); - Reference xDocumentModel = getDocumentModel(xCtx, nodeName ); - if ( xDocumentModel.is() ) - { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( - xCtx->getServiceManager() - ->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")), - xCtx ), - UNO_QUERY_THROW ); - Reference xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); - // get the long name of the document: - OUString appModule( xModuleManager->identify( - xDocumentModel ) ); - Sequence moduleDescr; - Any aAny = xModuleConfig->getByName(appModule); - if( sal_True != ( aAny >>= moduleDescr ) ) - { - throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("SFTreeListBox::Init: failed to get PropertyValue")), Reference< XInterface >()); - } - beans::PropertyValue const * pmoduleDescr = - moduleDescr.getConstArray(); - for ( sal_Int32 pos = moduleDescr.getLength(); pos--; ) - { - if (pmoduleDescr[ pos ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "ooSetupFactoryEmptyDocumentURL") )) - { - pmoduleDescr[ pos ].Value >>= factoryURL; - break; - } - } - } - if( factoryURL.getLength() > 0 ) - { - aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL), false ); - } - else - { - aImage = m_docImage; - } - } - } - else - { - if( node->getType() == browse::BrowseNodeTypes::SCRIPT ) - aImage = m_macImage; - else - aImage = m_libImage; - } - return aImage; -} - -Reference< XInterface > -SvxConfigGroupListBox_Impl::getDocumentModel( - Reference< XComponentContext >& xCtx, OUString& docName ) -{ - Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")), xCtx ), - UNO_QUERY ); - - Reference< container::XEnumerationAccess > componentsAccess = - desktop->getComponents(); - Reference< container::XEnumeration > components = - componentsAccess->createEnumeration(); - while (components->hasMoreElements()) - { - Reference< frame::XModel > model( - components->nextElement(), UNO_QUERY ); - if ( model.is() ) - { - OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model ); - if( sTdocUrl.equals( docName ) ) - { - xModel = model; - break; - } - } - } - return xModel; -} - -void SvxConfigGroupListBox_Impl::GroupSelected() -{ - SvLBoxEntry *pEntry = FirstSelected(); - SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData(); - pFunctionListBox->SetUpdateMode(sal_False); - pFunctionListBox->ClearAll(); - if ( pInfo->nKind != SVX_CFGGROUP_FUNCTION && - pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER ) - { - pFunctionListBox->SetUpdateMode(sal_True); - return; - } - - switch ( pInfo->nKind ) - { - case SVX_CFGGROUP_FUNCTION : - { - SvLBoxEntry *_pEntry = FirstSelected(); - if ( _pEntry != NULL ) - { - SvxGroupInfo_Impl *_pInfo = - (SvxGroupInfo_Impl*) _pEntry->GetUserData(); - - Reference< frame::XDispatchInformationProvider > xDIP( - m_xFrame, UNO_QUERY ); - - Sequence< frame::DispatchInformation > commands; - try - { - commands = xDIP->getConfigurableDispatchInformation( - _pInfo->nOrd ); - } - catch ( container::NoSuchElementException& ) - { - } - - for ( sal_Int32 i = 0; i < commands.getLength(); ++i ) - { - if ( commands[i].Command.getLength() == 0 ) - { - continue; - } - - Image aImage; - - OUString aCmdURL( commands[i].Command ); - - if ( m_pImageProvider ) - { - aImage = m_pImageProvider->GetImage( aCmdURL ); - } - - OUString aLabel; - try - { - Any a = m_xModuleCommands->getByName( aCmdURL ); - Sequence< beans::PropertyValue > aPropSeq; - - if ( a >>= aPropSeq ) - { - for ( sal_Int32 k = 0; k < aPropSeq.getLength(); ++k ) - { - if ( aPropSeq[k].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) ) ) - { - aPropSeq[k].Value >>= aLabel; - break; - } - } - } - } - catch ( container::NoSuchElementException& ) - { - } - - if ( aLabel.getLength() == 0 ) - { - aLabel = commands[i].Command; - } - - SvLBoxEntry* pFuncEntry = NULL; - if ( !!aImage ) - { - pFuncEntry = pFunctionListBox->InsertEntry( - aLabel, aImage, aImage ); - } - else - { - pFuncEntry = pFunctionListBox->InsertEntry( - aLabel, NULL ); - } - - SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl( - SVX_CFGFUNCTION_SLOT, 123, aCmdURL, ::rtl::OUString() ); - - pFunctionListBox->aArr.Insert( - _pGroupInfo, pFunctionListBox->aArr.Count() ); - - pFuncEntry->SetUserData( _pGroupInfo ); - } - } - break; - } - - case SVX_CFGGROUP_SCRIPTCONTAINER: - { - Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode ); - - try { - if ( rootNode->hasChildNodes() ) - { - Sequence< Reference< browse::XBrowseNode > > children = - rootNode->getChildNodes(); - - for ( long n = 0; n < children.getLength(); ++n ) - { - if (!children[n].is()) - continue; - if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT) - { - OUString uri; - OUString description; - - Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY ); - if (!xPropSet.is()) - { - continue; - } - - Any value = - xPropSet->getPropertyValue( String::CreateFromAscii( "URI" ) ); - value >>= uri; - - try - { - value = xPropSet->getPropertyValue( - String::CreateFromAscii( "Description" ) ); - value >>= description; - } - catch (Exception &) { - // do nothing, the description will be empty - } - - SvxGroupInfo_Impl* _pGroupInfo = - new SvxGroupInfo_Impl( - SVX_CFGFUNCTION_SCRIPT, 123, uri, description ); - - Image aImage = GetImage( children[n], Reference< XComponentContext >(), sal_False ); - SvLBoxEntry* pNewEntry = - pFunctionListBox->InsertEntry( children[n]->getName(), NULL ); - pFunctionListBox->SetExpandedEntryBmp( pNewEntry, aImage ); - pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage ); - - pNewEntry->SetUserData( _pGroupInfo ); - - pFunctionListBox->aArr.Insert( - _pGroupInfo, pFunctionListBox->aArr.Count() ); - - } - } - } - } - catch (const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - break; - } - - default: - { - return; - } - } - - if ( pFunctionListBox->GetEntryCount() ) - pFunctionListBox->Select( pFunctionListBox->GetEntry( 0, 0 ) ); - - pFunctionListBox->SetUpdateMode(sal_True); -} - -sal_Bool SvxConfigGroupListBox_Impl::Expand( SvLBoxEntry* pParent ) -{ - sal_Bool bRet = SvTreeListBox::Expand( pParent ); - if ( bRet ) - { - // Wieviele Entries k"onnen angezeigt werden ? - sal_uLong nEntries = GetOutputSizePixel().Height() / GetEntryHeight(); - - // Wieviele Kinder sollen angezeigt werden ? - sal_uLong nChildCount = GetVisibleChildCount( pParent ); - - // Passen alle Kinder und der parent gleichzeitig in die View ? - if ( nChildCount+1 > nEntries ) - { - // Wenn nicht, wenigstens parent ganz nach oben schieben - MakeVisible( pParent, sal_True ); - } - else - { - // An welcher relativen ViewPosition steht der aufzuklappende parent - SvLBoxEntry *pEntry = GetFirstEntryInView(); - sal_uLong nParentPos = 0; - while ( pEntry && pEntry != pParent ) - { - ++nParentPos; - pEntry = GetNextEntryInView( pEntry ); - } - - // Ist unter dem parent noch genug Platz f"ur alle Kinder ? - if ( nParentPos + nChildCount + 1 > nEntries ) - ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) ); - } - } - - return bRet; -} - -void SvxConfigGroupListBox_Impl::RequestingChilds( SvLBoxEntry *pEntry ) -{ - SvxGroupInfo_Impl *pInfo = (SvxGroupInfo_Impl*) pEntry->GetUserData(); - pInfo->bWasOpened = sal_True; - switch ( pInfo->nKind ) - { - case SVX_CFGGROUP_SCRIPTCONTAINER: - { - if ( !GetChildCount( pEntry ) ) - { - Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode ) ; - fillScriptList( rootNode, pEntry, true /* i30923 */ ); - } - break; - } - - default: - OSL_FAIL( "Falscher Gruppentyp!" ); - break; - } -} - -/* - * Implementation of SvxScriptSelectorDialog - * - * This dialog is used for selecting Slot API commands - * and Scripting Framework Scripts. - */ - -SvxScriptSelectorDialog::SvxScriptSelectorDialog( - Window* pParent, sal_Bool bShowSlots, const Reference< frame::XFrame >& xFrame ) - : - ModelessDialog( pParent, CUI_RES( RID_DLG_SCRIPTSELECTOR ) ), - aDialogDescription( this, CUI_RES( TXT_SELECTOR_DIALOG_DESCRIPTION ) ), - aGroupText( this, CUI_RES( TXT_SELECTOR_CATEGORIES ) ), - aCategories( this, CUI_RES( BOX_SELECTOR_CATEGORIES ), bShowSlots, xFrame ), - aFunctionText( this, CUI_RES( TXT_SELECTOR_COMMANDS ) ), - aCommands( this, CUI_RES( BOX_SELECTOR_COMMANDS ) ), - aOKButton( this, CUI_RES( BTN_SELECTOR_OK ) ), - aCancelButton( this, CUI_RES( BTN_SELECTOR_CANCEL ) ), - aHelpButton( this, CUI_RES( BTN_SELECTOR_HELP ) ), - aDescription( this, CUI_RES( GRP_SELECTOR_DESCRIPTION ) ), - aDescriptionText( this, CUI_RES( TXT_SELECTOR_DESCRIPTION ) ), - m_bShowSlots( bShowSlots ) -{ - - ResMgr& rMgr = CUI_MGR(); - - // If we are showing Slot API commands update labels in the UI, and - // enable drag'n'drop - if ( m_bShowSlots ) - { - aGroupText.SetText( String( ResId( STR_SELECTOR_CATEGORIES, rMgr ) ) ); - aOKButton.SetText( String( ResId( STR_SELECTOR_ADD, rMgr ) ) ); - aCancelButton.SetText( String( ResId( STR_SELECTOR_CLOSE, rMgr ) ) ); - aFunctionText.SetText( String( ResId( STR_SELECTOR_COMMANDS, rMgr ) ) ); - SetDialogDescription( - String( ResId( STR_SELECTOR_ADD_COMMANDS_DESCRIPTION, rMgr ) ) ); - SetText( String( ResId( STR_SELECTOR_ADD_COMMANDS, rMgr ) ) ); - - aCommands.SetDragDropMode( SV_DRAGDROP_APP_COPY ); - } - - ResizeControls(); - - aCategories.SetFunctionListBox( &aCommands ); - aCategories.Init(); - - aCategories.SetSelectHdl( - LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); - aCommands.SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) ); - aCommands.SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) ); - - aOKButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); - aCancelButton.SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) ); - - UpdateUI(); - FreeResource(); -} - -void SvxScriptSelectorDialog::ResizeControls() -{ - Point p, newp; - Size s, news; - long gap; - - sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | - TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK; - - // get dimensions of dialog instructions control - p = aDialogDescription.GetPosPixel(); - s = aDialogDescription.GetSizePixel(); - - // get dimensions occupied by text in the control - Rectangle rect = - GetTextRect( Rectangle( p, s ), aDialogDescription.GetText(), style ); - news = rect.GetSize(); - - // the gap is the difference between the control height and its text height - gap = s.Height() - news.Height(); - - // resize the dialog instructions control - news = Size( s.Width(), s.Height() - gap ); - aDialogDescription.SetSizePixel( news ); - - // resize other controls to fill the gap - p = aGroupText.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aGroupText.SetPosPixel( newp ); - - p = aCategories.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCategories.SetPosPixel( newp ); - s = aCategories.GetSizePixel(); - news = Size( s.Width(), s.Height() + gap ); - aCategories.SetSizePixel( news ); - - p = aFunctionText.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aFunctionText.SetPosPixel( newp ); - - p = aCommands.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCommands.SetPosPixel( newp ); - s = aCommands.GetSizePixel(); - news = Size( s.Width(), s.Height() + gap ); - aCommands.SetSizePixel( news ); - - p = aOKButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aOKButton.SetPosPixel( newp ); - - p = aCancelButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aCancelButton.SetPosPixel( newp ); - - p = aHelpButton.GetPosPixel(); - newp = Point( p.X(), p.Y() - gap ); - aHelpButton.SetPosPixel( newp ); -} - -SvxScriptSelectorDialog::~SvxScriptSelectorDialog() -{ -} - -IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl ) -{ - if ( pCtrl == &aCategories ) - { - aCategories.GroupSelected(); - } - else if ( pCtrl == &aCommands ) - { - aCommands.FunctionSelected(); - } - UpdateUI(); - return 0; -} - -IMPL_LINK( SvxScriptSelectorDialog, FunctionDoubleClickHdl, Control*, pCtrl ) -{ - (void)pCtrl; - if ( aOKButton.IsEnabled() ) - return ClickHdl( &aOKButton ); - return 0; -} - -// Check if command is selected and enable the OK button accordingly -// Grab the help text for this id if available and update the description field -void -SvxScriptSelectorDialog::UpdateUI() -{ - OUString url = GetScriptURL(); - if ( url != NULL && url.getLength() != 0 ) - { - String rMessage = - aCommands.GetHelpText( aCommands.FirstSelected() ); - aDescriptionText.SetText( rMessage ); - - aOKButton.Enable( sal_True ); - } - else - { - aDescriptionText.SetText( String() ); - aOKButton.Enable( sal_False ); - } -} - -IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton ) -{ - if ( pButton == &aCancelButton ) - { - // If we are displaying Slot API commands then the dialog is being - // run from Tools/Configure and we should not close it, just hide it - if ( m_bShowSlots == sal_False ) - { - EndDialog( RET_CANCEL ); - } - else - { - Hide(); - } - } - else if ( pButton == &aOKButton ) - { - GetAddHdl().Call( this ); - - // If we are displaying Slot API commands then this the dialog is being - // run from Tools/Configure and we should not close it - if ( m_bShowSlots == sal_False ) - { - EndDialog( RET_OK ); - } - else - { - // Select the next entry in the list if possible - SvLBoxEntry* current = aCommands.FirstSelected(); - SvLBoxEntry* next = aCommands.NextSibling( current ); - - if ( next != NULL ) - { - aCommands.Select( next ); - } - } - } - - return 0; -} - -void -SvxScriptSelectorDialog::SetRunLabel() -{ - aOKButton.SetText( String( CUI_RES( STR_SELECTOR_RUN ) ) ); -} - -void -SvxScriptSelectorDialog::SetDialogDescription( const String& rDescription ) -{ - aDialogDescription.SetText( rDescription ); -} - -String -SvxScriptSelectorDialog::GetScriptURL() const -{ - OUString result; - - SvLBoxEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->aCommands.GetLastSelectedEntry(); - if ( pEntry ) - { - SvxGroupInfo_Impl *pData = (SvxGroupInfo_Impl*) pEntry->GetUserData(); - if ( ( pData->nKind == SVX_CFGFUNCTION_SLOT ) - || ( pData->nKind == SVX_CFGFUNCTION_SCRIPT ) - ) - { - result = pData->sURL; - } - } - - return result; -} - -String -SvxScriptSelectorDialog::GetSelectedDisplayName() -{ - return aCommands.GetEntryText( aCommands.GetLastSelectedEntry() ); -} - -String -SvxScriptSelectorDialog::GetSelectedHelpText() -{ - return aCommands.GetHelpText( aCommands.GetLastSelectedEntry() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/selector.hrc b/cui/source/customize/selector.hrc deleted file mode 100644 index a8dee0cc1..000000000 --- a/cui/source/customize/selector.hrc +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define TXT_SELECTOR_DIALOG_DESCRIPTION 1 -#define TXT_SELECTOR_CATEGORIES 2 -#define BOX_SELECTOR_CATEGORIES 3 -#define TXT_SELECTOR_COMMANDS 4 -#define BOX_SELECTOR_COMMANDS 5 -#define BTN_SELECTOR_OK 6 -#define BTN_SELECTOR_CANCEL 7 -#define BTN_SELECTOR_HELP 8 -#define GRP_SELECTOR_DESCRIPTION 9 -#define TXT_SELECTOR_DESCRIPTION 10 - -#define IMG_HARDDISK 1 -#define IMG_LIB 3 -#define IMG_MACRO 5 -#define IMG_DOC 7 - -#define STR_SELECTOR_ADD 310 -#define STR_SELECTOR_CLOSE 311 -#define STR_SELECTOR_COMMANDS 312 -#define STR_SELECTOR_ADD_COMMANDS 313 -#define STR_SELECTOR_ADD_COMMANDS_DESCRIPTION 314 -#define STR_SELECTOR_MACROS 315 -#define STR_SELECTOR_CATEGORIES 316 -#define STR_BASICMACROS 317 -#define STR_SELECTOR_RUN 318 -#define STR_MYMACROS 319 -#define STR_PRODMACROS 320 diff --git a/cui/source/customize/selector.src b/cui/source/customize/selector.src deleted file mode 100644 index 34e7a7726..000000000 --- a/cui/source/customize/selector.src +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "helpid.hrc" -#include -#include "selector.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -#define FIXEDTEXT_DIALOG_DESCRIPTION \ -Text [ en-US ] = "Select the library that contains the macro you want. Then select the macro under 'Macro name'." ;\ - -String STR_SELECTOR_ADD_COMMANDS -{ - TEXT [ en-US ] = "Add Commands" ; -}; - -String STR_SELECTOR_MACROS -{ - Text [ en-US ] = "%PRODUCTNAME Macros" ; -}; - -String STR_SELECTOR_CATEGORIES -{ - Text [ en-US ] = "~Category" ; -}; - -String STR_SELECTOR_COMMANDS -{ - Text [ en-US ] = "Commands" ; -}; - -String STR_SELECTOR_ADD -{ - TEXT [ en-US ] = "Add" ; -}; - -String STR_SELECTOR_RUN -{ - TEXT [ en-US ] = "Run" ; - -}; - -String STR_SELECTOR_CLOSE -{ - TEXT [ en-US ] = "Close" ; - -}; - -String STR_SELECTOR_ADD_COMMANDS_DESCRIPTION -{ - TEXT [ en-US ] = "To add a command to a toolbar, select the category and then the command. Then drag the command to the Commands list of the Toolbars tab page in the Customize dialog."; -}; - -String STR_BASICMACROS -{ - Text [ en-US ] = "BASIC Macros" ; -}; - - -ModelessDialog RID_DLG_SCRIPTSELECTOR -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 256 , 233 ) ; - Text [ en-US ] = "Macro Selector" ; - HelpId = HID_SELECTOR_DIALOG; - SvLook = TRUE ; - Moveable = TRUE ; - Hide = TRUE; - FixedText TXT_SELECTOR_DIALOG_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 190 , 48 ) ; - Group = TRUE ; - Left = TRUE ; - WordBreak = TRUE ; - FIXEDTEXT_DIALOG_DESCRIPTION - }; - FixedText TXT_SELECTOR_CATEGORIES - { - Pos = MAP_APPFONT ( 6 , 62 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Group = TRUE ; - Left = TRUE ; - Text [ en-US ] = "Library" ; - }; - Control BOX_SELECTOR_CATEGORIES - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 73 ) ; - Size = MAP_APPFONT ( 83 , 89 ) ; - TabStop = TRUE; - HelpId = HID_SELECTOR_CATEGORIES; - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_DOC - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - }; - FixedText TXT_SELECTOR_COMMANDS - { - Pos = MAP_APPFONT ( 101 , 62 ) ; - Size = MAP_APPFONT ( 93 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Macro name" ; - }; - Control BOX_SELECTOR_COMMANDS - { - Border = TRUE ; - Pos = MAP_APPFONT ( 101 , 73 ) ; - Size = MAP_APPFONT ( 93 , 89 ) ; - TabStop = TRUE; - HelpId = HID_SELECTOR_COMMANDS; - }; - OKButton BTN_SELECTOR_OK - { - Pos = MAP_APPFONT ( 200 , 73 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton BTN_SELECTOR_CANCEL - { - Pos = MAP_APPFONT ( 200 , 90 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_SELECTOR_HELP - { - Pos = MAP_APPFONT ( 200 , 107 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedLine GRP_SELECTOR_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 224 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Description" ; - }; - FixedText TXT_SELECTOR_DESCRIPTION - { - Pos = MAP_APPFONT ( 12 , 179 ) ; - Size = MAP_APPFONT ( 224 , 48 ) ; - WordBreak = TRUE ; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/SpellAttrib.cxx b/cui/source/dialogs/SpellAttrib.cxx deleted file mode 100644 index 34dd071e5..000000000 --- a/cui/source/dialogs/SpellAttrib.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -using namespace svx; -using namespace com::sun::star::linguistic2; -using namespace com::sun::star::uno; - - -//----------------------------------------------------------------------- -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorDescription& rDesc ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rDesc ) -{ -} - - -//----------------------------------------------------------------------- -SpellErrorAttrib::SpellErrorAttrib( const SpellErrorAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_ERROR), - m_aSpellErrorDescription( rAttr.m_aSpellErrorDescription ) -{ -} - -//----------------------------------------------------------------------- -SpellErrorAttrib::~SpellErrorAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellErrorAttrib::SetFont( Font& ) const -{ - //this attribute doesn't have a visual effect -} - -//----------------------------------------------------------------------- -TextAttrib* SpellErrorAttrib::Clone() const -{ - return new SpellErrorAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellErrorAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aSpellErrorDescription == static_cast(rAttr).m_aSpellErrorDescription; -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::SpellLanguageAttrib(LanguageType eLang) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(eLang) -{ -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_LANGUAGE), - m_eLanguage(rAttr.m_eLanguage) -{ -} - -//----------------------------------------------------------------------- -SpellLanguageAttrib::~SpellLanguageAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellLanguageAttrib::SetFont( Font& ) const -{ - //no visual effect -} - -//----------------------------------------------------------------------- -TextAttrib* SpellLanguageAttrib::Clone() const -{ - return new SpellLanguageAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellLanguageAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_eLanguage == static_cast(rAttr).m_eLanguage; -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::SpellBackgroundAttrib(const Color& rCol) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rCol) -{ -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ) : - TextAttrib(TEXTATTR_SPELL_BACKGROUND), - m_aBackgroundColor(rAttr.m_aBackgroundColor) -{ -} - -//----------------------------------------------------------------------- -SpellBackgroundAttrib::~SpellBackgroundAttrib() -{ -} - -//----------------------------------------------------------------------- -void SpellBackgroundAttrib::SetFont( Font& rFont ) const -{ - rFont.SetFillColor(m_aBackgroundColor); -} - -//----------------------------------------------------------------------- -TextAttrib* SpellBackgroundAttrib::Clone() const -{ - return new SpellBackgroundAttrib(*this); -} - -//----------------------------------------------------------------------- -int SpellBackgroundAttrib::operator==( const TextAttrib& rAttr ) const -{ - return Which() == rAttr.Which() && - m_aBackgroundColor == static_cast(rAttr).m_aBackgroundColor; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx deleted file mode 100644 index 04a9bfbe0..000000000 --- a/cui/source/dialogs/SpellAttrib.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SPELL_ATTRIB -#define _SVX_SPELL_ATTRIB - -#include -#include -#include -#include -#include -#include -#include - -#define TEXTATTR_SPELL_ERROR (TEXTATTR_USER_START + 1) -#define TEXTATTR_SPELL_LANGUAGE (TEXTATTR_USER_START + 2) -#define TEXTATTR_SPELL_BACKGROUND (TEXTATTR_USER_START + 3) - -namespace svx{ -struct SpellErrorDescription -{ - bool bIsGrammarError; - ::rtl::OUString sErrorText; - ::rtl::OUString sDialogTitle; - ::rtl::OUString sExplanation; - ::com::sun::star::lang::Locale aLocale; - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker; - ::rtl::OUString sServiceName; //service name of GrammarChecker/SpellChecker - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSuggestions; - ::rtl::OUString sRuleId; - - SpellErrorDescription() : - bIsGrammarError( false ){} - - SpellErrorDescription( bool bGrammar, - const ::rtl::OUString& rText, - const ::com::sun::star::lang::Locale& rLocale, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSuggestions, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > rxGrammarChecker, - const ::rtl::OUString& rServiceName, - const ::rtl::OUString* pDialogTitle = 0, - const ::rtl::OUString* pExplanation = 0, - const ::rtl::OUString* pRuleId = 0 ) : - bIsGrammarError( bGrammar ), - sErrorText( rText ), - aLocale( rLocale ), - xGrammarChecker( rxGrammarChecker ), - sServiceName( rServiceName ), - aSuggestions( rSuggestions ) - { - if( pDialogTitle ) - sDialogTitle = *pDialogTitle; - if( pExplanation ) - sExplanation = *pExplanation; - if( pRuleId ) - sRuleId = *pRuleId; - }; - - int operator==( const SpellErrorDescription& rDesc ) const - { - return bIsGrammarError == rDesc.bIsGrammarError && - sErrorText.equals( rDesc.sErrorText ) && - aLocale.Language.equals( rDesc.aLocale.Language ) && - aLocale.Country.equals( rDesc.aLocale.Country ) && - aLocale.Variant.equals( rDesc.aLocale.Variant ) && - aSuggestions == rDesc.aSuggestions && - xGrammarChecker == rDesc.xGrammarChecker && - sDialogTitle.equals( rDesc.sDialogTitle ) && - sExplanation.equals( rDesc.sExplanation ) && - sRuleId == rDesc.sRuleId; - } -}; - -//------------------------------------------------- -class SpellErrorAttrib : public TextAttrib -{ -public: - -private: - SpellErrorDescription m_aSpellErrorDescription; - - //not accessible - SpellErrorAttrib(); -public: - SpellErrorAttrib( const SpellErrorDescription& ); - SpellErrorAttrib( const SpellErrorAttrib& rAttr ); - ~SpellErrorAttrib(); - - const SpellErrorDescription& GetErrorDescription() const { return m_aSpellErrorDescription; } - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; - -//------------------------------------------------- -class SpellLanguageAttrib : public TextAttrib -{ - LanguageType m_eLanguage; - - //not accessible - SpellLanguageAttrib(); - -public: - SpellLanguageAttrib(LanguageType eLanguage); - SpellLanguageAttrib( const SpellLanguageAttrib& rAttr ); - ~SpellLanguageAttrib(); - - LanguageType GetLanguage() const {return m_eLanguage;} - void SetLanguage(LanguageType eLang) - {m_eLanguage = eLang;} - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; - -//------------------------------------------------- -class SpellBackgroundAttrib : public TextAttrib -{ - Color m_aBackgroundColor; - - //not accessible - SpellBackgroundAttrib(); - -public: - SpellBackgroundAttrib(const Color& rCol); - SpellBackgroundAttrib( const SpellBackgroundAttrib& rAttr ); - ~SpellBackgroundAttrib(); - - const Color& GetColor() const { return m_aBackgroundColor;} - void SetColor( const Color& rNewCol ){m_aBackgroundColor = rNewCol;} - - - virtual void SetFont( Font& rFont ) const; - virtual TextAttrib* Clone() const; - virtual int operator==( const TextAttrib& rAttr ) const; -}; -}//namespace svx -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx deleted file mode 100644 index 85fb0c5cb..000000000 --- a/cui/source/dialogs/SpellDialog.cxx +++ /dev/null @@ -1,2091 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "SpellDialog.hrc" -#include -#include -#include -#include "SpellDialog.hxx" -#include -#include "optlingu.hxx" -#include -#include -#include "treeopt.hxx" -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::linguistic2; - -using ::rtl::OUString; - -#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) -// struct SpellDialog_Impl --------------------------------------------- - -struct SpellDialog_Impl -{ - Sequence< Reference< XDictionary > > aDics; -}; -// ----------------------------------------------------------------------- - -#define SPELLUNDO_START 200 - -#define SPELLUNDO_CHANGE_LANGUAGE (SPELLUNDO_START + 1) -#define SPELLUNDO_CHANGE_TEXTENGINE (SPELLUNDO_START + 2) -#define SPELLUNDO_CHANGE_NEXTERROR (SPELLUNDO_START + 3) -#define SPELLUNDO_CHANGE_ADD_TO_DICTIONARY (SPELLUNDO_START + 4) -#define SPELLUNDO_CHANGE_GROUP (SPELLUNDO_START + 5) //undo list -#define SPELLUNDO_MOVE_ERROREND (SPELLUNDO_START + 6) -#define SPELLUNDO_UNDO_EDIT_MODE (SPELLUNDO_START + 7) -#define SPELLUNDO_ADD_IGNORE_RULE (SPELLUNDO_START + 8) - -namespace svx{ -class SpellUndoAction_Impl : public SfxUndoAction -{ - sal_uInt16 m_nId; - const Link& m_rActionLink; - //undo of button enabling - bool m_bEnableChangePB; - bool m_bEnableChangeAllPB; - //undo of MarkNextError - used in change and change all, ignore and ignore all - long m_nNewErrorStart; - long m_nNewErrorEnd; - long m_nOldErrorStart; - long m_nOldErrorEnd; - bool m_bIsErrorLanguageSelected; - ::rtl::OUString m_sRuleId; - //undo of AddToDictionary - Reference m_xDictionary; - ::rtl::OUString m_sAddedWord; - //move end of error - ::ChangeMarkedWord() - long m_nOffset; - -public: - SpellUndoAction_Impl(sal_uInt16 nId, const Link& rActionLink) : - m_nId(nId), - m_rActionLink( rActionLink), - m_bEnableChangePB(false), - m_bEnableChangeAllPB(false), - m_nNewErrorStart(-1), - m_nNewErrorEnd(-1), - m_nOldErrorStart(-1), - m_nOldErrorEnd(-1), - m_bIsErrorLanguageSelected(false), - m_nOffset(0) - {} - - ~SpellUndoAction_Impl(); - - virtual void Undo(); - virtual sal_uInt16 GetId() const; - - void SetEnableChangePB(){m_bEnableChangePB = true;} - bool IsEnableChangePB(){return m_bEnableChangePB;} - - void SetEnableChangeAllPB(){m_bEnableChangeAllPB = true;} - bool IsEnableChangeAllPB(){return m_bEnableChangeAllPB;} - - void SetErrorMove(long nNewStart, long nNewEnd, long nOldStart, long nOldEnd) - { - m_nNewErrorStart = nNewStart; - m_nNewErrorEnd = nNewEnd; - m_nOldErrorStart = nOldStart; - m_nOldErrorEnd = nOldEnd; - } - long GetNewErrorStart() { return m_nNewErrorStart;} - long GetNewErrorEnd() { return m_nNewErrorEnd;} - long GetOldErrorStart() { return m_nOldErrorStart;} - long GetOldErrorEnd() { return m_nOldErrorEnd;} - - void SetErrorLanguageSelected(bool bSet){ m_bIsErrorLanguageSelected = bSet;} - bool IsErrorLanguageSelected() const {return m_bIsErrorLanguageSelected;} - - void SetDictionary(Reference xDict) { m_xDictionary = xDict; } - Reference GetDictionary() const {return m_xDictionary;} - void SetAddedWord(const ::rtl::OUString& rWord) {m_sAddedWord = rWord;} - const ::rtl::OUString& GetAddedWord() const { return m_sAddedWord;} - - void SetOffset(long nSet) {m_nOffset = nSet;} - long GetOffset() const {return m_nOffset;} - - void SetErrorType( const ::rtl::OUString& rId ) { m_sRuleId = rId; } - const ::rtl::OUString& GetErrorType() const { return m_sRuleId; } - -}; -}//namespace svx -using namespace ::svx; - -//----------------------------------------------------------------------- -SpellUndoAction_Impl::~SpellUndoAction_Impl() -{ -} - -//----------------------------------------------------------------------- -void SpellUndoAction_Impl::Undo() -{ - m_rActionLink.Call(this); -} - -//----------------------------------------------------------------------- -sal_uInt16 SpellUndoAction_Impl::GetId()const -{ - return m_nId; -} - -// class SvxSpellCheckDialog --------------------------------------------- - -SpellDialog::SpellDialog( - SpellDialogChildWindow* pChildWindow, - Window * pParent, - SfxBindings* _pBindings) - : SfxModelessDialog (_pBindings, - pChildWindow, - pParent, - CUI_RES(RID_SVXDLG_SPELLCHECK)), - - aVendorImageFI ( this , CUI_RES( IMG_VENDOR ) ), - aLanguageFT ( this, CUI_RES( FT_LANGUAGE ) ), - aLanguageLB ( this, CUI_RES( LB_LANGUAGE ) ), - aNotInDictFT ( this, CUI_RES( FT_NOTINDICT ) ), - aSentenceED ( this, CUI_RES( ED_NEWWORD ) ), - aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ), - aSuggestionLB ( this, CUI_RES( LB_SUGGESTION ) ), - - aIgnorePB ( this, CUI_RES( PB_IGNORE ) ), - aIgnoreAllPB ( this, CUI_RES( PB_IGNOREALL ) ), - aIgnoreRulePB ( this, CUI_RES( PB_IGNORERULE ) ), - aAddToDictMB ( this, CUI_RES( MB_ADDTODICT ) ), - - aChangePB ( this, CUI_RES( PB_CHANGE ) ), - aChangeAllPB ( this, CUI_RES( PB_CHANGEALL ) ), - aExplainPB ( this, CUI_RES( PB_EXPLAIN) ), - aAutoCorrPB ( this, CUI_RES( PB_AUTOCORR ) ), - - aCheckGrammarCB ( this, CUI_RES( CB_CHECK_GRAMMAR ) ), - - aHelpPB ( this, CUI_RES( PB_HELP ) ), - aOptionsPB ( this, CUI_RES( PB_OPTIONS ) ), - aUndoPB ( this, CUI_RES( PB_UNDO ) ), - aClosePB ( this, CUI_RES( PB_CLOSE ) ), - aBackgroundGB ( this, CUI_RES( GB_BACKGROUND ) ), - - aVendorImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), - - aResumeST ( CUI_RES(ST_RESUME )), - aIgnoreOnceST ( aIgnorePB.GetText()), - aNoSuggestionsST( CUI_RES(ST_NOSUGGESTIONS)), - m_sTitleSpelling ( CUI_RES( ST_SPELLING ) ), - m_sTitleSpellingGrammar ( CUI_RES( ST_SPELLING_AND_GRAMMAR ) ), - m_sTitleSpellingGrammarVendor ( CUI_RES( ST_SPELLING_AND_GRAMMAR_VENDORNAME ) ), - aDialogUndoLink( LINK (this, SpellDialog, DialogUndoHdl)), - bModified( false ), - bFocusLocked( true ), - rParent ( *pChildWindow ), - nOldLang ( LANGUAGE_NONE ) -{ - FreeResource(); - xSpell = LinguMgr::GetSpellChecker(); - pImpl = new SpellDialog_Impl; - - //HelpIds - aClosePB. SetHelpId(HID_SPLDLG_BUTTON_CLOSE ); - aIgnorePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORE ); - aIgnoreAllPB. SetHelpId(HID_SPLDLG_BUTTON_IGNOREALL); - aIgnoreRulePB. SetHelpId(HID_SPLDLG_BUTTON_IGNORERULE); - aChangePB. SetHelpId(HID_SPLDLG_BUTTON_CHANGE ); - aChangeAllPB. SetHelpId(HID_SPLDLG_BUTTON_CHANGEALL); - aExplainPB. SetHelpId(HID_SPLDLG_BUTTON_EXPLAIN ); - Init_Impl(); - - // disable controls if service is missing - if (!xSpell.is()) - Enable( sal_False ); - - Application::PostUserEvent( STATIC_LINK( - this, SpellDialog, InitHdl ) ); -} - -// ----------------------------------------------------------------------- - -SpellDialog::~SpellDialog() -{ - // save possibly modified user-dictionaries - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - { - linguistic::SaveDictionaries( xDicList ); - } - - delete aAddToDictMB.GetPopupMenu(); - delete pImpl; -} - -// ----------------------------------------------------------------------- - -void SpellDialog::Init_Impl() -{ - // Handler initialisieren - aClosePB.SetClickHdl(LINK( this, SpellDialog, CancelHdl ) ); - aChangePB.SetClickHdl(LINK( this, SpellDialog, ChangeHdl ) ); - aChangeAllPB.SetClickHdl(LINK( this, SpellDialog, ChangeAllHdl ) ); - aIgnorePB.SetClickHdl(LINK( this, SpellDialog, IgnoreHdl ) ); - aIgnoreAllPB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) ); - aIgnoreRulePB.SetClickHdl(LINK( this, SpellDialog, IgnoreAllHdl ) ); - aUndoPB.SetClickHdl(LINK( this, SpellDialog, UndoHdl ) ); - - aAutoCorrPB.SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) ); - aCheckGrammarCB.SetClickHdl( LINK( this, SpellDialog, CheckGrammarHdl )); - aOptionsPB .SetClickHdl( LINK( this, SpellDialog, ExtClickHdl ) ); - - aSuggestionLB.SetDoubleClickHdl( LINK( this, SpellDialog, ChangeHdl ) ); - - aSentenceED.SetModifyHdl(LINK ( this, SpellDialog, ModifyHdl) ); - aAddToDictMB.SetSelectHdl(LINK ( this, SpellDialog, AddToDictionaryHdl ) ); - aLanguageLB.SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) ); - - // initialize language ListBox - aLanguageLB.SetLanguageList( LANG_LIST_SPELL_USED, sal_False, sal_False, sal_True ); - - // get current language - UpdateBoxes_Impl(); - - // fill dictionary PopupMenu - InitUserDicts(); - - aSentenceED.ClearModifyFlag(); - SvxGetChangeAllList()->clear(); -} - -// ----------------------------------------------------------------------- - -void SpellDialog::UpdateBoxes_Impl() -{ - sal_Int32 i; - aSuggestionLB.Clear(); - - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - - LanguageType nAltLanguage = LANGUAGE_NONE; - Sequence< ::rtl::OUString > aNewWords; - bool bIsGrammarError = false; - if( pSpellErrorDescription ) - { - nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale ); - aNewWords = pSpellErrorDescription->aSuggestions; - bIsGrammarError = pSpellErrorDescription->bIsGrammarError; - aExplainPB.SetExplanation(pSpellErrorDescription->sExplanation ); - } - if( pSpellErrorDescription && pSpellErrorDescription->sDialogTitle.getLength() ) - { - // use this function to apply the correct image to be used... - SetTitle_Impl( nAltLanguage ); - // then change the title to the one to be actually used - SetText( pSpellErrorDescription->sDialogTitle ); - } - else - SetTitle_Impl( nAltLanguage ); - SetSelectedLang_Impl( nAltLanguage ); - - // Alternativen eintragen - const ::rtl::OUString *pNewWords = aNewWords.getConstArray(); - const sal_Int32 nSize = aNewWords.getLength(); - for ( i = 0; i < nSize; ++i ) - { - String aTmp( pNewWords[i] ); - if ( LISTBOX_ENTRY_NOTFOUND == aSuggestionLB.GetEntryPos( aTmp ) ) - { - aSuggestionLB.InsertEntry( aTmp ); - aSuggestionLB.SetEntryFlags(aSuggestionLB.GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE); - } - } - if(!nSize) - aSuggestionLB.InsertEntry( aNoSuggestionsST ); - aAutoCorrPB.Enable( nSize > 0 ); - - aSuggestionFT.Enable(nSize > 0); - aSuggestionLB.Enable(nSize > 0); - if( nSize ) - { - aSuggestionLB.SelectEntryPos(0); - } - aChangePB.Enable( nSize > 0); - aChangeAllPB.Enable(nSize > 0); - bool bShowChangeAll = !bIsGrammarError; - aChangeAllPB.Show( bShowChangeAll ); - aExplainPB.Show( !bShowChangeAll ); - aLanguageLB.Enable( bShowChangeAll ); - aIgnoreAllPB.Show( bShowChangeAll ); - aAddToDictMB.Show( bShowChangeAll ); - aIgnoreRulePB.Show( !bShowChangeAll ); - aIgnoreRulePB.Enable(pSpellErrorDescription && pSpellErrorDescription->sRuleId.getLength()); - aExplainPB.Enable( aExplainPB.HasExplanation() ); - aAutoCorrPB.Show( bShowChangeAll && rParent.HasAutoCorrection() ); - -} -// ----------------------------------------------------------------------- - -void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrentError ) -{ - //initially or after the last error of a sentence MarkNextError will fail - //then GetNextSentence() has to be called followed again by MarkNextError() - //MarkNextError is not initally called if the UndoEdit mode is active - bool bNextSentence = false; - if((!aSentenceED.IsUndoEditMode() && aSentenceED.MarkNextError( bIgnoreCurrentError )) || - true == ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, aSentenceED.IsUndoEditMode()) && aSentenceED.MarkNextError( false ))) - { - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription ) - { - UpdateBoxes_Impl(); - Control* aControls[] = - { - &aNotInDictFT, - &aSentenceED, - &aLanguageFT, - 0 - }; - sal_Int32 nIdx = 0; - do - { - aControls[nIdx]->Enable(sal_True); - } - while(aControls[++nIdx]); - - } - if( bNextSentence ) - { - //remove undo if a new sentence is active - aSentenceED.ResetUndo(); - aUndoPB.Enable(sal_False); - } - } -} -/* Initialize, asynchronous to prevent virtial calls - from a constructor - */ -IMPL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog *, EMPTYARG ) -{ - pThis->SetUpdateMode( sal_False ); - //show or hide AutoCorrect depending on the modules abilities - pThis->aAutoCorrPB.Show(pThis->rParent.HasAutoCorrection()); - pThis->SpellContinue_Impl(); - pThis->aSentenceED.ResetUndo(); - pThis->aUndoPB.Enable(sal_False); - - pThis->LockFocusChanges(true); - if( pThis->aChangePB.IsEnabled() ) - pThis->aChangePB.GrabFocus(); - else if( pThis->aIgnorePB.IsEnabled() ) - pThis->aIgnorePB.GrabFocus(); - else if( pThis->aClosePB.IsEnabled() ) - pThis->aClosePB.GrabFocus(); - pThis->LockFocusChanges(false); - //show grammar CheckBox depending on the modules abilities - bool bHasGrammarChecking = pThis->rParent.HasGrammarChecking(); - pThis->aCheckGrammarCB.Show( bHasGrammarChecking ); - if( !bHasGrammarChecking ) - { - //resize the dialog to hide the hidden area of the CheckBox - Size aBackSize = pThis->aBackgroundGB.GetSizePixel(); - sal_Int32 nDiff = pThis->aBackgroundGB.GetPosPixel().Y() + aBackSize.Height() - - pThis->aCheckGrammarCB.GetPosPixel().Y(); - aBackSize.Height() -= nDiff; - pThis->aBackgroundGB.SetSizePixel(aBackSize); - Button* aButtons[] = { &pThis->aHelpPB, &pThis->aOptionsPB, &pThis->aUndoPB, &pThis->aClosePB, 0 }; - sal_Int32 nButton = 0; - while( aButtons[nButton]) - { - Point aPos = aButtons[nButton]->GetPosPixel(); - aPos.Y() -= nDiff; - aButtons[nButton]->SetPosPixel(aPos); - ++nButton; - } - Size aDlgSize = pThis->GetSizePixel(); - aDlgSize.Height() -= nDiff; - pThis->SetSizePixel( aDlgSize ); - } - else - { - if( SvtLinguConfig().HasVendorImages( "SpellAndGrammarDialogImage" ) ) - { - pThis->aVendorImageFI.Show(); - Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); - Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); - if( aImageSize.Height() ) - { - aVendorSize.Height() = aImageSize.Height(); - if(aVendorSize.Width() < aImageSize.Width()) - aVendorSize.Width() = aImageSize.Width(); - pThis->aVendorImageFI.SetSizePixel( aVendorSize ); - } - sal_Int32 nDiff = aVendorSize.Height(); - pThis->aVendorImageFI.SetSizePixel(aVendorSize); - Control* aControls[] = { - &pThis->aLanguageFT, - &pThis->aLanguageLB, - &pThis->aNotInDictFT, - &pThis->aSentenceED, - &pThis->aSuggestionFT, - &pThis->aSuggestionLB, - &pThis->aIgnorePB, - &pThis->aIgnoreAllPB, - &pThis->aIgnoreRulePB, - &pThis->aAddToDictMB, - &pThis->aChangePB, - &pThis->aChangeAllPB, - &pThis->aExplainPB, - &pThis->aAutoCorrPB, - &pThis->aCheckGrammarCB, - &pThis->aHelpPB, - &pThis->aOptionsPB, - &pThis->aUndoPB, - &pThis->aClosePB, - &pThis->aBackgroundGB, - 0 - }; - sal_Int32 nControl = 0; - while( aControls[nControl]) - { - Point aPos = aControls[nControl]->GetPosPixel(); - aPos.Y() += nDiff; - aControls[nControl]->SetPosPixel(aPos); - ++nControl; - } - Size aDlgSize = pThis->GetSizePixel(); - aDlgSize.Height() += nDiff; - pThis->SetSizePixel( aDlgSize ); - pThis->Invalidate(); - } - } - pThis->aCheckGrammarCB.Check( pThis->rParent.IsGrammarChecking() ); - pThis->SetUpdateMode( sal_True ); - pThis->Show(); - return 0; -}; - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ExtClickHdl, Button *, pBtn ) -{ - if (&aOptionsPB == pBtn) - StartSpellOptDlg_Impl(); - else if(&aAutoCorrPB == pBtn) - { - //get the currently selected wrong word - String sCurrentErrorText = aSentenceED.GetErrorText(); - //get the wrong word from the XSpellAlternative - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription ) - { - String sWrong(pSpellErrorDescription->sErrorText); - //if the word has not been edited in the MultiLineEdit then - //the current suggestion should be used - //if it's not the 'no suggestions' entry - if(sWrong == sCurrentErrorText && - aSuggestionLB.IsEnabled() && aSuggestionLB.GetSelectEntryCount() > 0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - { - sCurrentErrorText = aSuggestionLB.GetSelectEntry(); - } - if(sWrong != sCurrentErrorText) - { - SvxPrepareAutoCorrect( sWrong, sCurrentErrorText ); - LanguageType eLang = GetSelectedLang_Impl(); - rParent.AddAutoCorrection( sWrong, sCurrentErrorText, eLang ); - } - } - } - return 0; -} -// ----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, CheckGrammarHdl, CheckBox*, pBox ) -{ - rParent.SetGrammarChecking( pBox->IsChecked() ); - Impl_Restore(); - return 0; -} - -void SpellDialog::StartSpellOptDlg_Impl() -{ - sal_uInt16 aSpellInfos[] = - { - SID_ATTR_SPELL,SID_ATTR_SPELL, - SID_SPELL_MODIFIED, SID_SPELL_MODIFIED, - SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK, - 0 - }; - SfxItemSet aSet( SFX_APP()->GetPool(), aSpellInfos); - aSet.Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL )); - SfxSingleTabDialog* pDlg = - new SfxSingleTabDialog( this, aSet, RID_SFXPAGE_LINGU ); - SfxTabPage* pPage = SvxLinguTabPage::Create( pDlg, aSet ); - ( (SvxLinguTabPage*)pPage )->HideGroups( GROUP_MODULES ); - pDlg->SetTabPage( pPage ); - if(RET_OK == pDlg->Execute()) - { - - // Benutzerb"ucher anzeigen - InitUserDicts(); - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - if(pOutSet) - OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet); - } - delete pDlg; - -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ChangeHdl, Button *, EMPTYARG ) -{ - if(aSentenceED.IsUndoEditMode()) - { - SpellContinue_Impl(); - } - else - { - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - String aString = aSentenceED.GetErrorText(); - //dots are sometimes part of the spelled word but they are not necessarily part of the replacement - bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.'; - if(aSuggestionLB.IsEnabled() && - aSuggestionLB.GetSelectEntryCount()>0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - aString = aSuggestionLB.GetSelectEntry(); - if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.')) - aString += '.'; - - aSentenceED.ChangeMarkedWord(aString, GetSelectedLang_Impl()); - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd(); - } - if(!aChangePB.IsEnabled()) - aIgnorePB.GrabFocus(); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, ChangeAllHdl, Button *, EMPTYARG ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - // change the current word first - String aString = aSentenceED.GetErrorText(); - if(aSuggestionLB.IsEnabled() && - aSuggestionLB.GetSelectEntryCount()>0 && - aNoSuggestionsST != aSuggestionLB.GetSelectEntry()) - aString = aSuggestionLB.GetSelectEntry(); - - LanguageType eLang = GetSelectedLang_Impl(); - - // add new word to ChangeAll list - String aOldWord( aSentenceED.GetErrorText() ); - SvxPrepareAutoCorrect( aOldWord, aString ); - Reference aXDictionary( SvxGetChangeAllList(), UNO_QUERY ); - sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary, - aOldWord , sal_True, - aString, eLang ); - - if(nAdded == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(aXDictionary); - pAction->SetAddedWord(aOldWord); - aSentenceED.AddUndoAction(pAction); - } - - aSentenceED.ChangeMarkedWord(aString, eLang); - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd(); - return 1; -} -// ----------------------------------------------------------------------- - -IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - // add word to IgnoreAll list - Reference< XDictionary > aXDictionary( SvxGetIgnoreAllList(), UNO_QUERY ); - //in case the error has been changed manually it has to be restored - aSentenceED.RestoreCurrentError(); - if( pButton == &aIgnoreRulePB ) - { - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - try - { - if( pSpellErrorDescription && pSpellErrorDescription->xGrammarChecker.is() ) - { - pSpellErrorDescription->xGrammarChecker->ignoreRule( pSpellErrorDescription->sRuleId, - pSpellErrorDescription->aLocale ); - } - } - catch( const uno::Exception& ) - { - } - } - else - { - String sErrorText(aSentenceED.GetErrorText()); - sal_uInt8 nAdded = linguistic::AddEntryToDic( aXDictionary, - sErrorText, sal_False, - ::rtl::OUString(), LANGUAGE_NONE ); - if(nAdded == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary(aXDictionary); - pAction->SetAddedWord(sErrorText); - aSentenceED.AddUndoAction(pAction); - } - } - - SpellContinue_Impl(); - bModified = false; - aSentenceED.UndoActionEnd(); - return 1; -} - -//----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, UndoHdl, Button*, EMPTYARG ) -{ - aSentenceED.Undo(); - if(!aSentenceED.GetUndoActionCount()) - aUndoPB.Enable(sal_False); - return 0; -} - -//----------------------------------------------------------------------- -IMPL_LINK( SpellDialog, DialogUndoHdl, SpellUndoAction_Impl*, pAction ) -{ - switch(pAction->GetId()) - { - case SPELLUNDO_CHANGE_TEXTENGINE: - { - if(pAction->IsEnableChangePB()) - aChangePB.Enable(sal_False); - if(pAction->IsEnableChangeAllPB()) - aChangeAllPB.Enable(sal_False); - } - break; - case SPELLUNDO_CHANGE_NEXTERROR: - { - aSentenceED.MoveErrorMarkTo((sal_uInt16)pAction->GetOldErrorStart(), (sal_uInt16)pAction->GetOldErrorEnd(), false); - if(pAction->IsErrorLanguageSelected()) - { - UpdateBoxes_Impl(); - } - } - break; - case SPELLUNDO_CHANGE_ADD_TO_DICTIONARY: - { - if(pAction->GetDictionary().is()) - pAction->GetDictionary()->remove(pAction->GetAddedWord()); - } - break; - case SPELLUNDO_MOVE_ERROREND : - { - if(pAction->GetOffset() != 0) - aSentenceED.MoveErrorEnd(pAction->GetOffset()); - } - break; - case SPELLUNDO_UNDO_EDIT_MODE : - { - //refill the dialog with the currently spelled sentence - throw away all changes - SpellContinue_Impl(true); - } - break; - case SPELLUNDO_ADD_IGNORE_RULE: - //undo of ignored rules is not supported - break; - } - - return 0; -} -// ----------------------------------------------------------------------- -void SpellDialog::Impl_Restore() -{ - //clear the "ChangeAllList" - SvxGetChangeAllList()->clear(); - //get a new sentence - aSentenceED.SetText(rtl::OUString()); - aSentenceED.ResetModified(); - SpellContinue_Impl(); - aIgnorePB.SetText(aIgnoreOnceST); -} - -IMPL_LINK( SpellDialog, IgnoreHdl, Button *, EMPTYARG ) -{ - if(aIgnorePB.GetText() == aResumeST) - { - Impl_Restore(); - } - else - { - //in case the error has been changed manually it has to be restored, - // since the users choice now was to ignore the error - aSentenceED.RestoreCurrentError(); - - // the word is being ignored - SpellContinue_Impl( false, true ); - } - return 1; -} - -// ----------------------------------------------------------------------- - -sal_Bool SpellDialog::Close() -{ - GetBindings().GetDispatcher()-> - Execute(rParent.GetType(), - SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD); - return sal_True; -} -// ----------------------------------------------------------------------- - -void SpellDialog::SetSelectedLang_Impl( LanguageType nLang ) -{ - aLanguageLB.SelectLanguage( nLang ); -} - -// ----------------------------------------------------------------------- - -LanguageType SpellDialog::GetSelectedLang_Impl() const -{ - sal_Int16 nLang = aLanguageLB.GetSelectLanguage(); - return nLang; -} - -//------------------------------------------------- -IMPL_LINK(SpellDialog, LanguageSelectHdl, SvxLanguageBox*, pBox) -{ - //if currently an error is selected then search for alternatives for - //this word and fill the alternatives ListBox accordingly - String sError = aSentenceED.GetErrorText(); - aSuggestionLB.Clear(); - if(sError.Len()) - { - LanguageType eLanguage = pBox->GetSelectLanguage(); - Reference xAlt = xSpell->spell( sError, eLanguage, - Sequence< PropertyValue >() ); - if( xAlt.is() ) - aSentenceED.SetAlternatives( xAlt ); - else - { - aSentenceED.ChangeMarkedWord( sError, eLanguage ); - SpellContinue_Impl(); - } - - aSentenceED.AddUndoAction(new SpellUndoAction_Impl(SPELLUNDO_CHANGE_LANGUAGE, aDialogUndoLink)); - } - SpellDialog::UpdateBoxes_Impl(); - return 0; -} -// ----------------------------------------------------------------------- - -void SpellDialog::SetLanguage( sal_uInt16 nLang ) - -/* [Beschreibung] - - wenn die Sprache im Thesaurus umgestellt wurde, - muss auch hier die Sprache umgestellt werden. -*/ - -{ - SetTitle_Impl( nLang ); - - // den richtigen Eintrag finden, da sortiert - aLanguageLB.SelectLanguage( nLang ); -} - -static Image lcl_GetImageFromPngUrl( const ::rtl::OUString &rFileUrl ) -{ - Image aRes; - ::rtl::OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - Graphic aGraphic; - const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} -void SpellDialog::SetTitle_Impl(LanguageType nLang) -{ - String sTitle( m_sTitleSpelling ); - if( rParent.HasGrammarChecking() ) - { - String sVendor; - const SpellErrorDescription* pSpellErrorDescription = aSentenceED.GetAlternatives(); - if( pSpellErrorDescription && pSpellErrorDescription->sServiceName.getLength() ) - { - ::rtl::OUString sSuggestionImageUrl = - SvtLinguConfig().GetSpellAndGrammarDialogImage( pSpellErrorDescription->sServiceName ); - aVendorImageFI.SetImage( lcl_GetImageFromPngUrl( sSuggestionImageUrl ) ); - uno::Reference< lang::XServiceDisplayName > xDisplayName( pSpellErrorDescription->xGrammarChecker, uno::UNO_QUERY ); - if( xDisplayName.is() ) - sVendor = xDisplayName->getServiceDisplayName( pSpellErrorDescription->aLocale ); - } - else - { - aVendorImageFI.SetImage( aVendorImage ); - } - - if( sVendor.Len() ) - { - sTitle = m_sTitleSpellingGrammarVendor; - sTitle.SearchAndReplaceAscii( "$VendorName", sVendor ); - } - else - { - sTitle = m_sTitleSpellingGrammar; - } - } - sTitle.SearchAndReplaceAscii( "$LANGUAGE ($LOCATION)", SvtLanguageTable::GetLanguageString(nLang) ); - SetText( sTitle ); -} - -void SpellDialog::InitUserDicts() -{ - const LanguageType nLang = aLanguageLB.GetSelectLanguage(); - - const Reference< XDictionary > *pDic = 0; - - // get list of dictionaries - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - { - // add active, positive dictionary to dic-list (if not already done). - // This is to ensure that there is at least on dictionary to which - // words could be added. - Reference< XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) ); - if (xDic.is()) - xDic->setActive( sal_True ); - - pImpl->aDics = xDicList->getDictionaries(); - } - - SvtLinguConfig aCfg; - - // list suitable dictionaries - bool bEnable = false; - const sal_Int32 nSize = pImpl->aDics.getLength(); - pDic = pImpl->aDics.getConstArray(); - delete aAddToDictMB.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); - sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0 - for (sal_Int32 i = 0; i < nSize; ++i) - { - uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); - if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp) - continue; - - uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY ); - LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() ); - if( xDicTmp->isActive() - && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE - && (nLang == nActLanguage || LANGUAGE_NONE == nActLanguage ) - && (!xStor.is() || !xStor->isReadonly()) ) - { - pMenu->InsertItem( nItemId, xDicTmp->getName() ); - bEnable = sal_True; - - uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); - if (xSvcInfo.is()) - { - OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( - xSvcInfo->getImplementationName()) ); - if (aDictionaryImageUrl.getLength() > 0) - { - Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); - pMenu->SetItemImage( nItemId, aImage ); - } - } - - ++nItemId; - } - } - aAddToDictMB.SetPopupMenu(pMenu); - aAddToDictMB.Enable( bEnable ); -} - -//----------------------------------------------------------------------- -IMPL_LINK(SpellDialog, AddToDictionaryHdl, MenuButton*, pButton ) -{ - aSentenceED.UndoActionStart( SPELLUNDO_CHANGE_GROUP ); - - //GetErrorText() returns the current error even if the text is already - //manually changed - const String aNewWord= aSentenceED.GetErrorText(); - - sal_uInt16 nItemId = pButton->GetCurItemId(); - PopupMenu *pMenu = pButton->GetPopupMenu(); - String aDicName ( pMenu->GetItemText( nItemId ) ); - - uno::Reference< linguistic2::XDictionary > xDic; - uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - xDic = xDicList->getDictionaryByName( aDicName ); - - sal_Int16 nAddRes = DIC_ERR_UNKNOWN; - if (xDic.is()) - { - nAddRes = linguistic::AddEntryToDic( xDic, aNewWord, sal_False, OUString(), LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (nAddRes == DIC_ERR_NONE) - { - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_ADD_TO_DICTIONARY, aDialogUndoLink); - pAction->SetDictionary( xDic ); - pAction->SetAddedWord( aNewWord ); - aSentenceED.AddUndoAction( pAction ); - } - // failed because there is already an entry? - if (DIC_ERR_NONE != nAddRes && xDic->getEntry( aNewWord ).is()) - nAddRes = DIC_ERR_NONE; - } - if (DIC_ERR_NONE != nAddRes) - { - SvxDicError( this, nAddRes ); - return 0; // Nicht weitermachen - } - - // go on - SpellContinue_Impl(); - aSentenceED.UndoActionEnd(); - return 0; -} - -//----------------------------------------------------------------------- -IMPL_LINK(SpellDialog, ModifyHdl, SentenceEditWindow_Impl*, pEd) -{ - if (&aSentenceED == pEd) - { - bModified = true; - aSuggestionLB.SetNoSelection(); - aSuggestionLB.Disable(); - String sNewText( aSentenceED.GetText() ); - aAutoCorrPB.Enable( sNewText != aSentenceED.GetText() ); - SpellUndoAction_Impl* pSpellAction = new SpellUndoAction_Impl(SPELLUNDO_CHANGE_TEXTENGINE, aDialogUndoLink); - if(!aChangeAllPB.IsEnabled()) - { - aChangeAllPB.Enable(); - pSpellAction->SetEnableChangeAllPB(); - } - if(!aChangePB.IsEnabled()) - { - aChangePB.Enable(); - pSpellAction->SetEnableChangePB(); - } - aSentenceED.AddUndoAction(pSpellAction); - } - return 0; -}; - -//----------------------------------------------------------------------- -IMPL_LINK(SpellDialog, CancelHdl, Button *, EMPTYARG ) -{ - //apply changes and ignored text parts first - if there are any - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), false); - Close(); - return 0; -} - -//----------------------------------------------------------------------- -void SpellDialog::Paint( const Rectangle& rRect ) -{ - ModelessDialog::Paint(rRect ); - Rectangle aRect(aBackgroundGB.GetPosPixel(), aBackgroundGB.GetSizePixel()); - DecorationView aDecoView( this ); - aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL); -} - -//----------------------------------------------------------------------- -long SpellDialog::Notify( NotifyEvent& rNEvt ) -{ - /* #i38338# - * FIXME: LoseFocus and GetFocus are signals from vcl that - * a window actually got/lost the focus, it never should be - * forwarded from another window, that is simply wrong. - * FIXME: overloading the virtual methods GetFocus and LoseFocus - * in SpellDialogChildWindow by making them pure is at least questionable. - * The only sensible thing would be to call the new Method differently, - * e.g. DialogGot/LostFocus or so. - */ - if( IsVisible() && !bFocusLocked ) - { - if( rNEvt.GetType() == EVENT_GETFOCUS ) - { - //notify the child window of the focus change - rParent.GetFocus(); - } - else if( rNEvt.GetType() == EVENT_LOSEFOCUS ) - { - //notify the child window of the focus change - rParent.LoseFocus(); - } - } - return SfxModelessDialog::Notify(rNEvt); -} - -//------------------------------------------------- -void SpellDialog::InvalidateDialog() -{ - if( bFocusLocked ) - return; - aIgnorePB.SetText(aResumeST); - Window* aDisableArr[] = - { - &aNotInDictFT, - &aSentenceED, - &aSuggestionFT, - &aSuggestionLB, - &aLanguageFT, - &aLanguageLB, - &aIgnoreAllPB, - &aIgnoreRulePB, - &aAddToDictMB, - &aChangePB, - &aChangeAllPB, - &aAutoCorrPB, - &aUndoPB, - 0 - }; - sal_Int16 i = 0; - while(aDisableArr[i]) - { - aDisableArr[i]->Enable(sal_False); - i++; - } - SfxModelessDialog::Deactivate(); -} - -//----------------------------------------------------------------------- -bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck) -{ - bool bRet = false; - if(!bUseSavedSentence) - { - //apply changes and ignored text parts - rParent.ApplyChangedSentence(aSentenceED.CreateSpellPortions(true), bRecheck); - } - aSentenceED.ResetIgnoreErrorsAt(); - aSentenceED.ResetModified(); - SpellPortions aSentence = bUseSavedSentence ? m_aSavedSentence : rParent.GetNextWrongSentence( bRecheck ); - if(!bUseSavedSentence) - m_aSavedSentence = aSentence; - bool bHasReplaced = false; - while(aSentence.size()) - { - //apply all changes that are already part of the "ChangeAllList" - //returns true if the list still contains errors after the changes have been applied - - if(!ApplyChangeAllList_Impl(aSentence, bHasReplaced)) - { - rParent.ApplyChangedSentence(aSentence, bRecheck); - aSentence = rParent.GetNextWrongSentence( bRecheck ); - } - else - break; - } - - if(aSentence.size()) - { - SpellPortions::iterator aStart = aSentence.begin(); - rtl::OUString sText; - while(aStart != aSentence.end()) - { - // hidden text has to be ignored - if(!aStart->bIsHidden) - sText += aStart->sText; - ++aStart; - } - aSentenceED.SetText(sText); - aStart = aSentence.begin(); - sal_Int32 nStartPosition = 0; - sal_Int32 nEndPosition = 0; - - while(aStart != aSentence.end()) - { - // hidden text has to be ignored - if(!aStart->bIsHidden) - { - nEndPosition += aStart->sText.getLength(); - if(aStart->xAlternatives.is()) - { - uno::Reference< container::XNamed > xNamed( aStart->xAlternatives, uno::UNO_QUERY ); - ::rtl::OUString sServiceName; - if( xNamed.is() ) - sServiceName = xNamed->getName(); - SpellErrorDescription aDesc( false, aStart->xAlternatives->getWord(), - aStart->xAlternatives->getLocale(), aStart->xAlternatives->getAlternatives(), 0, sServiceName); - aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - } - else if(aStart->bIsGrammarError ) - { - uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY ); - SpellErrorDescription aDesc( true, - aStart->sText, - SvxCreateLocale( aStart->eLanguage ), - aStart->aGrammarError.aSuggestions, - aStart->xGrammarChecker, - xInfo->getImplementationName(), - &aStart->sDialogTitle, - &aStart->aGrammarError.aFullComment, - &aStart->aGrammarError.aRuleIdentifier ); - aSentenceED.SetAttrib( SpellErrorAttrib(aDesc), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - } - if(aStart->bIsField) - aSentenceED.SetAttrib( SpellBackgroundAttrib(COL_LIGHTGRAY), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - aSentenceED.SetAttrib( SpellLanguageAttrib(aStart->eLanguage), 0, (sal_uInt16) nStartPosition, (sal_uInt16) nEndPosition ); - nStartPosition = nEndPosition; - } - ++aStart; - } - //the edit field needs to be modified to apply the change from the ApplyChangeAllList - if(!bHasReplaced) - aSentenceED.ClearModifyFlag(); - aSentenceED.ResetUndo(); - aUndoPB.Enable(sal_False); - bRet = nStartPosition > 0; - } - return bRet; -} -/*------------------------------------------------------------------------- - replace errrors that have a replacement in the ChangeAllList - returns false if the result doesn't contain errors after the replacement - -----------------------------------------------------------------------*/ -bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasReplaced) -{ - bHasReplaced = false; - bool bRet = true; - SpellPortions::iterator aStart = rSentence.begin(); - Reference xChangeAll( SvxGetChangeAllList(), UNO_QUERY ); - if(!xChangeAll->getCount()) - return bRet; - bRet = false; - while(aStart != rSentence.end()) - { - if(aStart->xAlternatives.is()) - { - Reference xEntry = xChangeAll->getEntry( aStart->sText ); - if(xEntry.is()) - { - aStart->sText = xEntry->getReplacementText(); - aStart->xAlternatives = 0; - bHasReplaced = true; - } - else - bRet = true; - } - else if( aStart->bIsGrammarError ) - bRet = true; - ++aStart; - } - return bRet; -} - -//----------------------------------------------------------------------- -SentenceEditWindow_Impl::SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ) : - MultiLineEdit( pParent, rResId ), - m_nErrorStart(0), - m_nErrorEnd(0), - m_bIsUndoEditMode(false) -{ - DisableSelectionOnFocus(); -} - -//----------------------------------------------------------------------- -SentenceEditWindow_Impl::~SentenceEditWindow_Impl() -{ -} -/*------------------------------------------------------------------------- - The selection before inputting a key may have a range or not - and it may be inside or outside of field or error attributes. - A range may include the attribute partially, completely or together - with surrounding text. It may also contain more than one attribute - or no attribute at all. - Depending on this starting conditions some actions are necessary: - Attempts to delete a field are only allowed if the selection is the same - as the field's selection. Otherwise the field has to be selected and the key - input action has to be skipped. - Input of text at the start of the field requires the field attribute to be - corrected - it is not allowed to grow. - - In case of errors the appending of text should grow the error attribute because - that is what the user usually wants to do. - - Backspace at the start of the attribute requires to find out if a field ends - directly in front of the cursor position. In case of a field this attribute has to be - selected otherwise the key input method is allowed. - - All changes outside of the error attributes switch the dialog mode to a "Undo edit" state that - removes all visible attributes and switches off further attribute checks. - Undo in this restarts the dialog with a current sentence newly presented. - All changes to the sentence are undone including the ones before the "Undo edit state" has been reached - - We end up with 9 types of selection - 1 (LEFT_NO) - no range, start of attribute - can also be 3 at the same time - 2 (INSIDE_NO) - no range, inside of attribute - 3 (RIGHT_NO) - no range, end of attribute - can also be 1 at the same time - 4 (FULL) - range, same as attribute - 5 (INSIDE_YES) - range, inside of the attribute - 6 (BRACE)- range, from outside of the attribute to the inside or - including the complete attribute and something outside, - maybe more than one attribute - 7 (OUTSIDE_NO) - no range, not at an attribute - 8 (OUTSIDE_YES) - range, completely outside of all attributes - - What has to be done depending on the attribute type involved - possible actions: UE - Undo edit mode - CO - Continue, no additional action is required - FS - Field has to be completely selected - EX - The attribute has to be expanded to include the added text - - 1 - backspace delete any other - UE on field FS on error CO on field FS on error CO - - 2 - on field FS on error C - 3 - backspace delete any other - on field FS on error CO UE on field UE on error EX - - if 1 and 3 happen to apply both then backspace and other handling is 1 delete is 3 - - 4 - on field UE and on error CO - 5 - on field FS and on error CO - 6 - on field FS and on error UE - 7 - UE - 8 - UE - -----------------------------------------------------------------------*/ -#define INVALID 0 -#define LEFT_NO 1 -#define INSIDE_NO 2 -#define RIGHT_NO 3 -#define FULL 4 -#define INSIDE_YES 5 -#define BRACE 6 -#define OUTSIDE_NO 7 -#define OUTSIDE_YES 8 - -#define ACTION_UNDOEDIT 0 -#define ACTION_CONTINUE 1 -#define ACTION_SELECTFIELD 2 -#define ACTION_EXPAND 3 - -long SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - bool bChange = false; - const TextCharAttrib* pErrorAttrib = 0; - if(rNEvt.GetType() == EVENT_KEYINPUT) - { - const KeyEvent& rKeyEvt = *rNEvt.GetKeyEvent(); - bChange = TextEngine::DoesKeyChangeText( rKeyEvt ); - if(bChange && !IsUndoEditMode() && - rKeyEvt.GetKeyCode().GetCode() != KEY_TAB) - { - TextEngine* pTextEngine = GetTextEngine(); - TextView* pTextView = pTextEngine->GetActiveView(); - const TextSelection& rCurrentSelection = pTextView->GetSelection(); - //determine if the selection contains a field - bool bHasField = false; - bool bHasError = false; - bool bHasFieldLeft = false; - bool bHasErrorLeft = false; - - bool bHasRange = rCurrentSelection.HasRange(); - sal_uInt8 nSelectionType = 0; // invalid type! - - TextPaM aCursor(rCurrentSelection.GetStart()); - const TextCharAttrib* pBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - const TextCharAttrib* pErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - const TextCharAttrib* pBackAttrLeft = 0; - const TextCharAttrib* pErrorAttrLeft = 0; - - bHasField = pBackAttr != 0 && (bHasRange || pBackAttr->GetEnd() > aCursor.GetIndex()); - bHasError = pErrorAttr != 0 && (bHasRange || pErrorAttr->GetEnd() > aCursor.GetIndex()); - if(bHasRange) - { - if(pBackAttr && - pBackAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() && - pBackAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex()) - { - nSelectionType = FULL; - } - else if(pErrorAttr && - pErrorAttr->GetStart() <= rCurrentSelection.GetStart().GetIndex() && - pErrorAttr->GetEnd() >= rCurrentSelection.GetEnd().GetIndex()) - { - nSelectionType = INSIDE_YES; - } - else - { - nSelectionType = bHasField||bHasError ? BRACE : OUTSIDE_NO; - while(aCursor.GetIndex() < rCurrentSelection.GetEnd().GetIndex()) - { - ++aCursor.GetIndex(); - const TextCharAttrib* pIntBackAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - const TextCharAttrib* pIntErrorAttr = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - //if any attr has been found then BRACE - if(pIntBackAttr || pIntErrorAttr) - nSelectionType = BRACE; - //the field has to be selected - if(pIntBackAttr && !pBackAttr) - pBackAttr = pIntBackAttr; - bHasField |= pIntBackAttr != 0; - } - } - } - else - { - //no range selection: then 1 2 3 and 8 are possible - const TextCharAttrib* pCurAttr = pBackAttr ? pBackAttr : pErrorAttr; - if(pCurAttr) - { - nSelectionType = pCurAttr->GetStart() == rCurrentSelection.GetStart().GetIndex() ? - LEFT_NO : pCurAttr->GetEnd() == rCurrentSelection.GetEnd().GetIndex() ? RIGHT_NO : INSIDE_NO; - } - else - nSelectionType = OUTSIDE_NO; - - bHasFieldLeft = pBackAttr && pBackAttr->GetEnd() == aCursor.GetIndex(); - if(bHasFieldLeft) - { - pBackAttrLeft = pBackAttr; - pBackAttr = 0; - } - bHasErrorLeft = pErrorAttr && pErrorAttr->GetEnd() == aCursor.GetIndex(); - if(bHasErrorLeft) - { - pErrorAttrLeft = pErrorAttr; - pErrorAttr = 0; - } - - //check previous position if this exists - //that is a redundant in the case the the attribute found above already is on the left cursor side - //but it's o.k. for two errors/fields side by side - if(aCursor.GetIndex()) - { - --aCursor.GetIndex(); - pBackAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_BACKGROUND ); - pErrorAttrLeft = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR ); - bHasFieldLeft = pBackAttrLeft !=0; - bHasErrorLeft = pErrorAttrLeft != 0; - ++aCursor.GetIndex(); - } - } - //Here we have to determine if the error found is the one currently active - bool bIsErrorActive = (pErrorAttr && pErrorAttr->GetStart() == m_nErrorStart) || - (pErrorAttrLeft && pErrorAttrLeft->GetStart() == m_nErrorStart); - - DBG_ASSERT(nSelectionType != INVALID, "selection type not set!"); - - const KeyCode& rKeyCode = rKeyEvt.GetKeyCode(); - bool bDelete = rKeyCode.GetCode() == KEY_DELETE; - bool bBackspace = rKeyCode.GetCode() == KEY_BACKSPACE; - - sal_Int8 nAction = ACTION_CONTINUE; - switch(nSelectionType) - { -// 1 - backspace delete any other -// UE on field FS on error CO on field FS on error CO - case LEFT_NO : - if(bBackspace) - { - nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_UNDOEDIT; - //to force the use of pBackAttrLeft - pBackAttr = 0; - } - else if(bDelete) - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE; - else - nAction = bHasError && !aCursor.GetIndex() ? ACTION_CONTINUE : - bHasError ? ACTION_EXPAND : bHasErrorLeft ? ACTION_CONTINUE : ACTION_UNDOEDIT; - break; -// 2 - on field FS on error C - case INSIDE_NO : - nAction = bHasField ? ACTION_SELECTFIELD : - bIsErrorActive ? ACTION_CONTINUE : ACTION_UNDOEDIT; - break; -// 3 - backspace delete any other -// on field FS on error CO UE on field UE on error EX - case RIGHT_NO : - if(bBackspace) - nAction = bHasFieldLeft ? ACTION_SELECTFIELD : ACTION_CONTINUE; - else if(bDelete) - nAction = bHasFieldLeft && bHasError ? ACTION_CONTINUE : ACTION_UNDOEDIT; - else - nAction = bHasFieldLeft && bHasError ? ACTION_EXPAND : - bHasError ? ACTION_CONTINUE : bHasErrorLeft ? ACTION_EXPAND :ACTION_UNDOEDIT; - break; -// 4 - on field UE and on error CO - case FULL : - nAction = bHasField ? ACTION_UNDOEDIT : ACTION_CONTINUE; - break; -// 5 - on field FS and on error CO - case INSIDE_YES : - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_CONTINUE; - break; -// 6 - on field FS and on error UE - case BRACE : - nAction = bHasField ? ACTION_SELECTFIELD : ACTION_UNDOEDIT;; - break; -// 7 - UE -// 8 - UE - case OUTSIDE_NO : - case OUTSIDE_YES: - nAction = ACTION_UNDOEDIT; - break; - } - //save the current paragraph - sal_uInt16 nCurrentLen = GetText().Len(); - if(nAction != ACTION_SELECTFIELD) - pTextView->GetWindow()->KeyInput(rKeyEvt); - else - { - const TextCharAttrib* pCharAttr = pBackAttr ? pBackAttr : pBackAttrLeft; - if(pCharAttr) - { - TextPaM aStart(0, pCharAttr->GetStart()); - TextPaM aEnd(0, pCharAttr->GetEnd()); - TextSelection aNewSel(aStart, aEnd); - pTextView->SetSelection( aNewSel); - } - } - if(nAction == ACTION_EXPAND) - { - DBG_ASSERT(pErrorAttrLeft || pErrorAttr, "where is the error"); - //text has been added on the right and only the 'error attribute has to be corrected - if(pErrorAttrLeft) - { - TextAttrib* pNewError = NULL; - sal_uInt16 nStart = pErrorAttrLeft->GetStart(); - sal_uInt16 nEnd = pErrorAttrLeft->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pErrorAttrLeft ); - SetAttrib( *pNewError, 0, nStart, ++nEnd ); - //only active errors move the mark - if(bIsErrorActive) - { - bool bGrammar = static_cast(*pNewError).GetErrorDescription().bIsGrammarError; - MoveErrorMarkTo(nStart, nEnd, bGrammar); - } - delete pNewError; - } - //text has been added on the left then the error attribute has to be expanded and the - //field attribute on the right - if any - has to be contracted - else if(pErrorAttr) - { - //determine the change - sal_uInt16 nAddedChars = GetText().Len() - nCurrentLen; - - TextAttrib* pNewError = NULL; - sal_uInt16 nStart = pErrorAttr->GetStart(); - sal_uInt16 nEnd = pErrorAttr->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pErrorAttr ); - nStart = nStart - (sal_uInt16)nAddedChars; - SetAttrib( *pNewError, 0, nStart - nAddedChars, nEnd ); - //only if the error is active the mark is moved here - if(bIsErrorActive) - { - bool bGrammar = static_cast(*pNewError).GetErrorDescription().bIsGrammarError; - MoveErrorMarkTo(nStart, nEnd, bGrammar); - } - delete pNewError; - - if(pBackAttrLeft) - { - TextAttrib* pNewBack = NULL; - sal_uInt16 _nStart = pBackAttrLeft->GetStart(); - sal_uInt16 _nEnd = pBackAttrLeft->GetEnd(); - pTextEngine->RemoveAttrib( 0, *pBackAttrLeft ); - SetAttrib( *pNewBack, 0, _nStart, _nEnd - nAddedChars); - delete pNewBack; - } - } - } - else if(nAction == ACTION_UNDOEDIT) - { - SetUndoEditMode(true); - } - //make sure the error positions are correct after text changes - //the old attribute may have been deleted - //all changes inside of the current error leave the error attribute at the current - //start position - if(!IsUndoEditMode() && bIsErrorActive) - { - const TextCharAttrib* pFontColor = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_FONTCOLOR ); - pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); - if(pFontColor && pErrorAttrib ) - { - m_nErrorStart = pFontColor->GetStart(); - m_nErrorEnd = pFontColor->GetEnd(); - if(pErrorAttrib->GetStart() != m_nErrorStart || pErrorAttrib->GetEnd() != m_nErrorEnd) - { - TextAttrib* pNewError = NULL; - pTextEngine->RemoveAttrib( 0, *pErrorAttr ); - SetAttrib( *pNewError, 0, m_nErrorStart, m_nErrorEnd ); - delete pNewError; - } - } - } - //this is not a modification anymore - if(nAction != ACTION_SELECTFIELD && !m_bIsUndoEditMode) - CallModifyLink(); - } - else - bChange = false; - } - long nRet = bChange ? 1 : MultiLineEdit::PreNotify(rNEvt); - return nRet; -} - -//----------------------------------------------------------------------- -bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError ) -{ - if (bIgnoreCurrentError) - m_aIgnoreErrorsAt.insert( m_nErrorStart ); - ExtTextEngine* pTextEngine = GetTextEngine(); - sal_uInt16 nTextLen = pTextEngine->GetTextLen(0); - if(m_nErrorEnd >= nTextLen - 1) - return false; - //if it's not already modified the modified flag has to be reset at the and of the marking - bool bModified = IsModified(); - bool bRet = false; - const sal_uInt16 nOldErrorStart = m_nErrorStart; - const sal_uInt16 nOldErrorEnd = m_nErrorEnd; - - //create a cursor behind the end of the last error - //- or at 0 at the start of the sentence - TextPaM aCursor(0, m_nErrorEnd ? m_nErrorEnd + 1 : 0); - //search for SpellErrorAttrib - - const TextCharAttrib* pNextError = 0; - //iterate over the text and search for the next error that maybe has - //to be replace by a ChangeAllList replacement - bool bGrammarError = false; - while(aCursor.GetIndex() < nTextLen) - { - while(aCursor.GetIndex() < nTextLen && - 0 == (pNextError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR))) - { - ++aCursor.GetIndex(); - } - // maybe the error found here is already in the ChangeAllList and has to be replaced - - Reference xChangeAll( SvxGetChangeAllList(), UNO_QUERY ); - Reference xEntry; - - const SpellErrorDescription* pSpellErrorDescription = 0; - if(pNextError) - { - pSpellErrorDescription = &static_cast(pNextError->GetAttr()).GetErrorDescription(); - bGrammarError = pSpellErrorDescription->bIsGrammarError; - } - if(xChangeAll->getCount() && pSpellErrorDescription && - (xEntry = xChangeAll->getEntry( pSpellErrorDescription->sErrorText )).is()) - { - m_nErrorStart = pNextError->GetStart(); - m_nErrorEnd = pNextError->GetEnd(); - ChangeMarkedWord(xEntry->getReplacementText(), - SvxLocaleToLanguage( pSpellErrorDescription->aLocale )); - aCursor.GetIndex() = aCursor.GetIndex() + (sal_uInt16)(xEntry->getReplacementText().getLength()); - } - else - break; - } - - //if an attrib has been found search for the end of the error string - if(aCursor.GetIndex() < nTextLen) - { - m_nErrorStart = aCursor.GetIndex(); - m_nErrorEnd = pNextError->GetEnd(); - MoveErrorMarkTo(m_nErrorStart, m_nErrorEnd, bGrammarError); - bRet = true; - //add an undo action - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_CHANGE_NEXTERROR, GetSpellDialog()->aDialogUndoLink); - pAction->SetErrorMove(m_nErrorStart, m_nErrorEnd, nOldErrorStart, nOldErrorEnd); - const SpellErrorAttrib* pOldAttrib = static_cast( - pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR )); - pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() && - SvxLocaleToLanguage( pOldAttrib->GetErrorDescription().aLocale) == - GetSpellDialog()->aLanguageLB.GetSelectLanguage()); - AddUndoAction(pAction); - } - else - m_nErrorStart = m_nErrorEnd = nTextLen; - if( !bModified ) - ClearModifyFlag(); - SpellDialog* pSpellDialog = GetSpellDialog(); - pSpellDialog->aIgnorePB.Enable(bRet); - pSpellDialog->aIgnoreAllPB.Enable(bRet); - pSpellDialog->aAutoCorrPB.Enable(bRet); - pSpellDialog->aAddToDictMB.Enable(bRet); - return bRet; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::MoveErrorMarkTo(sal_uInt16 nStart, sal_uInt16 nEnd, bool bGrammarError) -{ - TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTCOLOR, sal_True ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT, sal_True ); - pTextEngine->SetAttrib( TextAttribFontWeight(WEIGHT_BOLD), 0, nStart, nEnd ); - pTextEngine->SetAttrib( TextAttribFontColor(bGrammarError ? COL_LIGHTBLUE : COL_LIGHTRED), 0, nStart, nEnd ); - m_nErrorStart = nStart; - m_nErrorEnd = nEnd; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage) -{ - //calculate length changes - long nDiffLen = rNewWord.Len() - m_nErrorEnd + m_nErrorStart; - TextSelection aSel(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd)); - //Remove spell errror attribute - ExtTextEngine* pTextEngine = GetTextEngine(); - pTextEngine->UndoActionStart(); - const TextCharAttrib* pErrorAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_ERROR ); - DBG_ASSERT(pErrorAttrib, "no error attribute found"); - const SpellErrorDescription* pSpellErrorDescription = 0; - if(pErrorAttrib) - { - pTextEngine->RemoveAttrib(0, *pErrorAttrib); - pSpellErrorDescription = &static_cast(pErrorAttrib->GetAttr()).GetErrorDescription(); - } - const TextCharAttrib* pBackAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorStart), TEXTATTR_SPELL_BACKGROUND ); - pTextEngine->ReplaceText( aSel, rNewWord ); - - if(!m_nErrorStart) - { - //attributes following an error at the start of the text are not moved but expanded from the - //text engine - this is done to keep full-paragraph-attributes - //in the current case that handling is not desired - const TextCharAttrib* pLangAttrib = - pTextEngine->FindCharAttrib( - TextPaM(0, m_nErrorEnd), TEXTATTR_SPELL_LANGUAGE ); - sal_uInt16 nTextLen = pTextEngine->GetTextLen( 0 ); - if(pLangAttrib && !pLangAttrib->GetStart() && pLangAttrib->GetEnd() == - nTextLen) - { - SpellLanguageAttrib aNewLangAttrib( static_cast(pLangAttrib->GetAttr()).GetLanguage()); - pTextEngine->RemoveAttrib(0, *pLangAttrib); - pTextEngine->SetAttrib( aNewLangAttrib, 0, (sal_uInt16)(m_nErrorEnd + nDiffLen) , nTextLen ); - } - } - // undo expanded attributes! - if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen) - { - TextAttrib* pNewBackground = NULL; - sal_uInt16 nStart = pBackAttrib->GetStart(); - pTextEngine->RemoveAttrib(0, *pBackAttrib); - pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart); - delete pNewBackground; - } - pTextEngine->SetModified(sal_True); - - //adjust end position - long nEndTemp = m_nErrorEnd; - nEndTemp += nDiffLen; - m_nErrorEnd = (sal_uInt16)nEndTemp; - - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_MOVE_ERROREND, GetSpellDialog()->aDialogUndoLink); - pAction->SetOffset(nDiffLen); - AddUndoAction(pAction); - if(pSpellErrorDescription) - SetAttrib( SpellErrorAttrib(*pSpellErrorDescription), 0, m_nErrorStart, m_nErrorEnd ); - SetAttrib( SpellLanguageAttrib(eLanguage), 0, m_nErrorStart, m_nErrorEnd ); - pTextEngine->UndoActionEnd(); -} - -//------------------------------------------------- -String SentenceEditWindow_Impl::GetErrorText() const -{ - return GetTextEngine()->GetText(TextSelection(TextPaM(0, m_nErrorStart), TextPaM(0, m_nErrorEnd) )); -} - -//----------------------------------------------------------------------- -const SpellErrorDescription* SentenceEditWindow_Impl::GetAlternatives() -{ - TextPaM aCursor(0, m_nErrorStart); - const SpellErrorAttrib* pAttrib = static_cast( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)); - return pAttrib ? &pAttrib->GetErrorDescription() : 0; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::RestoreCurrentError() -{ - TextPaM aCursor(0, m_nErrorStart); - const SpellErrorAttrib* pAttrib = static_cast( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)); - if( pAttrib ) - { - const SpellErrorDescription& rDesc = pAttrib->GetErrorDescription(); - if( !rDesc.sErrorText.equals( GetErrorText() ) ) - ChangeMarkedWord(rDesc.sErrorText, SvxLocaleToLanguage( rDesc.aLocale )); - } -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetAlternatives( Reference< XSpellAlternatives> xAlt ) -{ - TextPaM aCursor(0, m_nErrorStart); - DBG_ASSERT(static_cast( - GetTextEngine()->FindAttrib( aCursor, TEXTATTR_SPELL_ERROR)), "no error set?"); - - ::rtl::OUString aWord; - lang::Locale aLocale; - uno::Sequence< ::rtl::OUString > aAlts; - ::rtl::OUString sServiceName; - if (xAlt.is()) - { - aWord = xAlt->getWord(); - aLocale = xAlt->getLocale(); - aAlts = xAlt->getAlternatives(); - uno::Reference< container::XNamed > xNamed( xAlt, uno::UNO_QUERY ); - if (xNamed.is()) - sServiceName = xNamed->getName(); - } - SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, 0, sServiceName); - GetTextEngine()->SetAttrib( SpellErrorAttrib(aDesc), 0, m_nErrorStart, m_nErrorEnd ); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ) -{ - GetTextEngine()->SetAttrib(rAttr, nPara, nStart, nEnd); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetText( const String& rStr ) -{ - m_nErrorStart = m_nErrorEnd = 0; - GetTextEngine()->SetText(rStr); -} - -//----------------------------------------------------------------------- -struct LanguagePosition_Impl -{ - sal_uInt16 nPosition; - LanguageType eLanguage; - - LanguagePosition_Impl(sal_uInt16 nPos, LanguageType eLang) : - nPosition(nPos), - eLanguage(eLang) - {} -}; -typedef std::vector LanguagePositions_Impl; - -void lcl_InsertBreakPosition_Impl( - LanguagePositions_Impl& rBreakPositions, sal_uInt16 nInsert, LanguageType eLanguage) -{ - LanguagePositions_Impl::iterator aStart = rBreakPositions.begin(); - while(aStart != rBreakPositions.end()) - { - if(aStart->nPosition == nInsert) - { - //the language of following starts has to overwrite - //the one of previous ends - aStart->eLanguage = eLanguage; - return; - } - else if(aStart->nPosition > nInsert) - { - - rBreakPositions.insert(aStart, LanguagePosition_Impl(nInsert, eLanguage)); - return; - } - else - ++aStart; - } - rBreakPositions.push_back(LanguagePosition_Impl(nInsert, eLanguage)); -} -/*------------------------------------------------------------------------- - Returns the text in spell portions. Each portion contains text with an - equal language and attribute. The spell alternatives are empty. - -----------------------------------------------------------------------*/ -svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnoreFlag ) const -{ - svx::SpellPortions aRet; - ExtTextEngine* pTextEngine = GetTextEngine(); - const sal_uInt16 nTextLen = pTextEngine->GetTextLen(0); - if(nTextLen) - { - TextPaM aCursor(0, 0); - LanguagePositions_Impl aBreakPositions; - const TextCharAttrib* pLastLang = 0; - const TextCharAttrib* pLastError = 0; - LanguageType eLang = LANGUAGE_DONTKNOW; - const TextCharAttrib* pError = 0; - while(aCursor.GetIndex() < nTextLen) - { - const TextCharAttrib* pLang = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_LANGUAGE); - if(pLang && pLang != pLastLang) - { - eLang = static_cast(pLang->GetAttr()).GetLanguage(); - lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetStart(), eLang); - lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->GetEnd(), eLang); - pLastLang = pLang; - } - pError = pTextEngine->FindCharAttrib( aCursor, TEXTATTR_SPELL_ERROR); - if(pError && pLastError != pError) - { - lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetStart(), eLang); - lcl_InsertBreakPosition_Impl(aBreakPositions, pError->GetEnd(), eLang); - pLastError = pError; - - } - aCursor.GetIndex()++; - } - - if(nTextLen && aBreakPositions.empty()) - { - //if all content has been overwritten the attributes may have been removed, too - svx::SpellPortion aPortion1; - aPortion1.eLanguage = GetSpellDialog()->GetSelectedLang_Impl(); - aPortion1.sText = pTextEngine->GetText( - TextSelection(TextPaM(0, 0), TextPaM(0, nTextLen))); - - aRet.push_back(aPortion1); - - } - else if(!aBreakPositions.empty()) - { - LanguagePositions_Impl::iterator aStart = aBreakPositions.begin(); - //start should always be Null - eLang = aStart->eLanguage; - sal_uInt16 nStart = aStart->nPosition; - DBG_ASSERT(!nStart, "invalid start position - language attribute missing?"); - ++aStart; - - while(aStart != aBreakPositions.end()) - { - svx::SpellPortion aPortion1; - aPortion1.eLanguage = eLang; - aPortion1.sText = pTextEngine->GetText( - TextSelection(TextPaM(0, nStart), TextPaM(0, aStart->nPosition))); - bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end(); - if( bSetIgnoreFlag && bIsIgnoreError ) - { - aPortion1.bIgnoreThisError = true; - } - aRet.push_back(aPortion1); - nStart = aStart->nPosition; - eLang = aStart->eLanguage; - ++aStart; - } - } - - // quick partly fix of #i71318. Correct fix needs to patch the TextEngine itself... - // this one will only prevent text from disappearing. It may to not have the - // correct language and will probably not spell checked... - sal_uLong nPara = pTextEngine->GetParagraphCount(); - if (nPara > 1) - { - String aLeftOverText; - for (sal_uLong i = 1; i < nPara; ++i) - { - aLeftOverText.AppendAscii( "\x0a" ); // the manual line break... - aLeftOverText += pTextEngine->GetText(i); - } - if (pError) - { // we need to add a new portion containing the left-over text - svx::SpellPortion aPortion2; - aPortion2.eLanguage = eLang; - aPortion2.sText = aLeftOverText; - aRet.push_back( aPortion2 ); - } - else - { // we just need to append the left-over text to the last portion (which had no errors) - aRet[ aRet.size() - 1 ].sText += aLeftOverText; - } - } - } - return aRet; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::Undo() -{ - ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - DBG_ASSERT(GetUndoActionCount(), "no undo actions available" ); - if(!GetUndoActionCount()) - return; - bool bSaveUndoEdit = IsUndoEditMode(); - sal_uInt16 nId; - //if the undo edit mode is active then undo all changes until the UNDO_EDIT_MODE action has been found - do - { - nId = rUndoMgr.GetUndoActionId(); - rUndoMgr.Undo(); - }while(bSaveUndoEdit && SPELLUNDO_UNDO_EDIT_MODE != nId && GetUndoActionCount()); - - if(bSaveUndoEdit || SPELLUNDO_CHANGE_GROUP == nId) - GetSpellDialog()->UpdateBoxes_Impl(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::ResetUndo() -{ - GetTextEngine()->ResetUndo(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg ) -{ - ::svl::IUndoManager& rUndoMgr = GetTextEngine()->GetUndoManager(); - rUndoMgr.AddUndoAction(pAction, bTryMerg); - GetSpellDialog()->aUndoPB.Enable(); -} - -//----------------------------------------------------------------------- -sal_uInt16 SentenceEditWindow_Impl::GetUndoActionCount() -{ - return GetTextEngine()->GetUndoManager().GetUndoActionCount(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::UndoActionStart( sal_uInt16 nId ) -{ - GetTextEngine()->UndoActionStart(nId); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::UndoActionEnd() -{ - GetTextEngine()->UndoActionEnd(); -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::MoveErrorEnd(long nOffset) -{ - if(nOffset > 0) - m_nErrorEnd = m_nErrorEnd - (sal_uInt16)nOffset; - else - m_nErrorEnd = m_nErrorEnd -(sal_uInt16)- nOffset; -} - -//----------------------------------------------------------------------- -void SentenceEditWindow_Impl::SetUndoEditMode(bool bSet) -{ - DBG_ASSERT(!bSet || m_bIsUndoEditMode != bSet, "SetUndoEditMode with equal values?"); - m_bIsUndoEditMode = bSet; - //disable all buttons except the Change - SpellDialog* pSpellDialog = GetSpellDialog(); - Control* aControls[] = - { - &pSpellDialog->aChangeAllPB, - &pSpellDialog->aExplainPB, - &pSpellDialog->aIgnoreAllPB, - &pSpellDialog->aIgnoreRulePB, - &pSpellDialog->aIgnorePB, - &pSpellDialog->aSuggestionLB, - &pSpellDialog->aSuggestionFT, - &pSpellDialog->aLanguageFT, - &pSpellDialog->aLanguageLB, - &pSpellDialog->aAddToDictMB, - &pSpellDialog->aAutoCorrPB, - 0 - }; - sal_Int32 nIdx = 0; - do - { - aControls[nIdx]->Enable(sal_False); - } - while(aControls[++nIdx]); - - //remove error marks - TextEngine* pTextEngine = GetTextEngine(); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTCOLOR, sal_True ); - pTextEngine->RemoveAttribs( 0, (sal_uInt16)TEXTATTR_FONTWEIGHT, sal_True ); - - //put the appropriate action on the Undo-stack - SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl( - SPELLUNDO_UNDO_EDIT_MODE, GetSpellDialog()->aDialogUndoLink); - AddUndoAction(pAction); - pSpellDialog->aChangePB.Enable(); -} - -//----------------------------------------------------------------------- -ExplainButton::~ExplainButton() -{ -} - -//----------------------------------------------------------------------- -void ExplainButton::RequestHelp( const HelpEvent& ) -{ - Help::ShowBalloon( this, GetPosPixel(), m_sExplanation ); -} - -void ExplainButton::Click() -{ - RequestHelp( HelpEvent() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/SpellDialog.hrc b/cui/source/dialogs/SpellDialog.hrc deleted file mode 100644 index d51ec1e82..000000000 --- a/cui/source/dialogs/SpellDialog.hrc +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FT_SUGGESTION 31 -#define LB_SUGGESTION 32 -#define FT_NOTINDICT 33 -#define ED_NEWWORD 34 -#define FT_LANGUAGE 35 -#define LB_LANGUAGE 36 -#define PB_IGNORE 37 -#define PB_IGNOREALL 38 -#define MB_ADDTODICT 39 -#define PB_CHANGE 40 -#define PB_CHANGEALL 41 -#define PB_AUTOCORR 42 -#define GB_BACKGROUND 43 -#define PB_OPTIONS 44 -#define PB_HELP 45 -#define PB_UNDO 46 -#define PB_CLOSE 47 -#define ST_NOSUGGESTIONS 48 -#define ST_RESUME 50 -#define ST_SPELLING 51 -#define ST_SPELLING_AND_GRAMMAR 52 -#define ST_SPELLING_AND_GRAMMAR_VENDORNAME 53 -#define CB_CHECK_GRAMMAR 54 -#define PB_EXPLAIN 55 -#define IMG_VENDOR 56 -#define IMG_DEFAULT_VENDOR 57 -#define PB_IGNORERULE 59 diff --git a/cui/source/dialogs/SpellDialog.src b/cui/source/dialogs/SpellDialog.src deleted file mode 100644 index 663b156b4..000000000 --- a/cui/source/dialogs/SpellDialog.src +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include "SpellDialog.hrc" - // pragma ---------------------------------------------------------------- - -// RID_SVXDLG_SPELLCHECK ------------------------------------------------- - -#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } - -ModelessDialog RID_SVXDLG_SPELLCHECK -{ - HelpId = HID_SPELLCHECK ; - Size = MAP_APPFONT( 270, 188 ); - OutputSize = TRUE; - Closeable = TRUE ; - SVLook = TRUE; - Hide = TRUE; - Text [ en-US ] = "Spellcheck: " ; - - Moveable = TRUE ; - - FixedImage IMG_VENDOR - { - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 270, 21 ) ; - Hide = TRUE; - }; - - FixedText FT_LANGUAGE - { - Pos = MAP_APPFONT( 6, 8 ); - Size = MAP_APPFONT( 100, 8 ); - Text [ en-US ] = "Text languag~e" ; - }; - ListBox LB_LANGUAGE - { - HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_LANGUAGE"; - Pos = MAP_APPFONT( 110, 6 ); - Size = MAP_APPFONT( 93, 55 ); - Border = TRUE; - Sort = TRUE; - DropDown = TRUE; - }; - FixedText FT_NOTINDICT - { - Pos = MAP_APPFONT( 6, 26 ); - Size = MAP_APPFONT( 120, 8 ); - Text [ en-US ] = "~Not in dictionary" ; - }; - - MultiLineEdit ED_NEWWORD - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_SPELLCHECK:ED_NEWWORD"; - Pos = MAP_APPFONT( 6, 37 ); - Size = MAP_APPFONT( 197, 48 ); - Border = TRUE; - VScroll = TRUE; - IgnoreTab = TRUE; - }; - - FixedText FT_SUGGESTION - { - Pos = MAP_APPFONT( 6, 88 ); - Size = MAP_APPFONT( 120, 8 ); - Text [ en-US ] = "~Suggestions" ; - }; - ListBox LB_SUGGESTION - { - HelpID = "cui:ListBox:RID_SVXDLG_SPELLCHECK:LB_SUGGESTION"; - Pos = MAP_APPFONT( 6, 99 ); - Size = MAP_APPFONT( 197, 48 ); - Border = TRUE; - }; - - CheckBox CB_CHECK_GRAMMAR - { - HelpID = "cui:CheckBox:RID_SVXDLG_SPELLCHECK:CB_CHECK_GRAMMAR"; - Pos = MAP_APPFONT( 6, 153 ); - Size = MAP_APPFONT( 100, 10 ); - Text [ en-US ] = "Check ~grammar" ; - Hide = TRUE; - }; - - PushButton PB_IGNORE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORE"; - Pos = MAP_APPFONT( 209, 37 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore Once" ; - }; - - PushButton PB_IGNOREALL - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNOREALL"; - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore All" ; - }; - PushButton PB_IGNORERULE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_IGNORERULE"; - Pos = MAP_APPFONT( 209, 54 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "I~gnore Rule" ; - Hide = TRUE; - }; - MenuButton MB_ADDTODICT - { - HelpID = "cui:MenuButton:RID_SVXDLG_SPELLCHECK:MB_ADDTODICT"; - Pos = MAP_APPFONT( 209, 71 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Add" ; - }; - - PushButton PB_CHANGE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGE"; - Pos = MAP_APPFONT( 209, 99 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Change" ; - DefButton = TRUE ; - }; - - PushButton PB_CHANGEALL - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CHANGEALL"; - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Change A~ll" ; - }; - PushButton PB_EXPLAIN - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_EXPLAIN"; - Pos = MAP_APPFONT( 209, 117 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE; - Text [ en-US ] = "~Explain..." ; - }; - PushButton PB_AUTOCORR - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_AUTOCORR"; - Pos = MAP_APPFONT( 209, 134 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "AutoCor~rect" ; - }; - GroupBox GB_BACKGROUND - { - Pos = MAP_APPFONT( 1, 21 ); - Size = MAP_APPFONT( 268, 146 ); - Hide=TRUE; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT( 6, 170 ); - Size = MAP_APPFONT( 55, 14 ); - }; - PushButton PB_OPTIONS - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_OPTIONS"; - Pos = MAP_APPFONT( 87, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "O~ptions..." ; - }; - PushButton PB_UNDO - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_UNDO"; - Pos = MAP_APPFONT( 148, 170 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Undo" ; - }; - - PushButton PB_CLOSE - { - HelpID = "cui:PushButton:RID_SVXDLG_SPELLCHECK:PB_CLOSE"; - Pos = MAP_APPFONT ( 209 , 170 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Cl~ose" ; - }; - String ST_RESUME - { - Text[ en-US ] = "Resu~me"; - }; - String ST_NOSUGGESTIONS - { - Text [en-US] = "(no suggestions)"; - }; - String ST_SPELLING - { - Text[ en-US ] = "Spelling: $LANGUAGE ($LOCATION)"; - }; - String ST_SPELLING_AND_GRAMMAR - { - Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION)"; - }; - String ST_SPELLING_AND_GRAMMAR_VENDORNAME - { - Text[ en-US ] = "Spelling and Grammar: $LANGUAGE ($LOCATION) [$VendorName]"; - }; - Image IMG_DEFAULT_VENDOR - { - ImageBitmap = Bitmap { File = "vendor01.png"; }; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx deleted file mode 100644 index 0b478a708..000000000 --- a/cui/source/dialogs/about.cxx +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "com/sun/star/system/SystemShellExecuteFlags.hpp" -#include "com/sun/star/system/XSystemShellExecute.hpp" -#include -#include "comphelper/anytostring.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "cppuhelper/bootstrap.hxx" - -#include -#include -#include "about.hxx" -#include "about.hrc" -#include -#include -#include - -using namespace ::com::sun::star; - -// defines --------------------------------------------------------------- - -#define SCROLL_OFFSET 1 -#define SPACE_OFFSET 5 -#define SCROLL_TIMER 30 - -/** loads the application logo as used in the about dialog and impress slideshow pause screen */ -Image SfxApplication::GetApplicationLogo() -{ - BitmapEx aBitmap; - Application::LoadBrandBitmap ("about", aBitmap); - return Image( aBitmap ); -} - -/* get good version information */ -static String -GetBuildId() -{ - rtl::OUString sDefault; - rtl::OUString sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); - if (!sBuildId.isEmpty() && sBuildId.getLength() > 50) - { - rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t")); - sal_Int32 nIndex = 0; - do - { - rtl::OUString aToken = sBuildId.getToken( 0, '-', nIndex ); - if (!aToken.isEmpty()) - { - aBuffer.append(aToken); - if (nIndex >= 0) - { - if (nIndex % 5) - aBuffer.append(static_cast('-')); - else - aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\t")); - } - } - } - while ( nIndex >= 0 ); - sBuildId = aBuffer.makeStringAndClear(); - } - - OSL_ENSURE( sBuildId.getLength() > 0, "No BUILDID in bootstrap file" ); - return sBuildId; -} - -AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : - - SfxModalDialog ( pParent, rId ), - - aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), - aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), - aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), - aInfoLink ( this, ResId( ABOUT_FTXT_LINK, *rId.GetResMgr() ) ), - aVersionTextStr(ResId(ABOUT_STR_VERSION, *rId.GetResMgr())), - m_aVendorTextStr(ResId(ABOUT_STR_VENDOR, *rId.GetResMgr())), - m_aOracleCopyrightTextStr(ResId(ABOUT_STR_COPYRIGHT_ORACLE_DERIVED, *rId.GetResMgr())), - m_aAcknowledgementTextStr(ResId(ABOUT_STR_ACKNOWLEDGEMENT, *rId.GetResMgr())), - m_aLinkStr(ResId( ABOUT_STR_LINK, *rId.GetResMgr())), - m_sBuildStr(ResId(ABOUT_STR_BUILD, *rId.GetResMgr())) -{ - rtl::OUString sProduct; - utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; - - // load image from module path - aAppLogo = SfxApplication::GetApplicationLogo(); - - // Transparent Font - Font aFont = GetFont(); - aFont.SetTransparent( sal_True ); - SetFont( aFont ); - - // if necessary more info - String sVersion = aVersionTextStr; - sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); - sVersion += '\n'; - sVersion += m_sBuildStr; - sVersion += ' '; - sVersion += GetBuildId(); -#ifdef BUILD_VER_STRING - String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); - sVersion += '\n'; - sVersion += aBuildString; -#endif - aVersionText.SetText( sVersion ); - - // set for background and text the correct system color - const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - Color aWhiteCol( rSettings.GetWindowColor() ); - Wallpaper aWall( aWhiteCol ); - SetBackground( aWall ); - Font aNewFont( aCopyrightText.GetFont() ); - aNewFont.SetTransparent( sal_True ); - - aVersionText.SetFont( aNewFont ); - aCopyrightText.SetFont( aNewFont ); - - aVersionText.SetBackground(); - aCopyrightText.SetBackground(); - aInfoLink.SetURL(m_aLinkStr); - aInfoLink.SetBackground(); - aInfoLink.SetClickHdl( LINK( this, AboutDialog, HandleHyperlink ) ); - - Color aTextColor( rSettings.GetWindowTextColor() ); - aVersionText.SetControlForeground( aTextColor ); - aCopyrightText.SetControlForeground( aTextColor ); - - rtl::OUStringBuffer sText(m_aVendorTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sal_uInt32 nCopyrightId = sProduct.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("LibreOffice" )) ? - ABOUT_STR_COPYRIGHT : ABOUT_STR_COPYRIGHT_DERIVED; - String aProductCopyrightTextStr(ResId(nCopyrightId, *rId.GetResMgr())); - sText.append(aProductCopyrightTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sText.append(m_aOracleCopyrightTextStr); - sText.appendAscii(RTL_CONSTASCII_STRINGPARAM("\n\n")); - sText.append(m_aAcknowledgementTextStr); - aCopyrightText.SetText(sText.makeStringAndClear()); - - // determine size and position of the dialog & elements - Size aAppLogoSiz = aAppLogo.GetSizePixel(); - - // analyze size of the aVersionText widget - // character size - Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - // preferred Version widget size - long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); - long nDlgMargin = a6Size.Width() * 2; - long nCtrlMargin = a6Size.Height() * 2; - - aVersionText.SetSizePixel(Size(800, 600)); - Size aVersionTextSize = aVersionText.CalcMinimumSize(); - aVersionTextSize.Width() += nDlgMargin; - - Size aOutSiz = GetOutputSizePixel(); - aOutSiz.Width() = aAppLogoSiz.Width(); - - if (aOutSiz.Width() < aVersionTextSize.Width()) - aOutSiz.Width() = aVersionTextSize.Width(); - - if (aOutSiz.Width() < 300) - aOutSiz.Width() = 300; - - //round up to nearest even - aOutSiz.Width() += aOutSiz.Width() & 1; - - long nTextWidth = (aOutSiz.Width() - nDlgMargin); - - // finally set the aVersionText widget position and size - Size aVTSize = aVersionText.GetSizePixel(); - aVTSize.Width() = nTextWidth; - aVersionText.SetSizePixel(aVTSize); - aVTSize = aVersionText.CalcMinimumSize(); - Point aVTPnt; - aVTPnt.X() = ( aOutSiz.Width() - aVTSize.Width() ) / 2; - aVTPnt.Y() = nY; - aVersionText.SetPosSizePixel( aVTPnt, aVTSize ); - - nY += aVTSize.Height() + nCtrlMargin; - - // Multiline edit with Copyright-Text - // preferred Version widget size - aCopyrightText.SetSizePixel(Size(nTextWidth,600)); - Size aCTSize = aCopyrightText.CalcMinimumSize(); - aCTSize.Width()= nTextWidth; - Point aCTPnt; - aCTPnt.X() = ( aOutSiz.Width() - aCTSize.Width() ) / 2; - aCTPnt.Y() = nY; - aCopyrightText.SetPosSizePixel( aCTPnt, aCTSize ); - - nY += aCTSize.Height() + nCtrlMargin; - - // FixedHyperlink with more info link - Size aLTSize = aInfoLink.CalcMinimumSize(); - Point aLTPnt; - aLTPnt.X() = ( aOutSiz.Width() - aLTSize.Width() ) / 2; - aLTPnt.Y() = nY; - aInfoLink.SetPosSizePixel( aLTPnt, aLTSize ); - - nY += aLTSize.Height() + nCtrlMargin; - - // OK-Button-Position (at the bottom and centered) - Size aOKSiz = aOKButton.GetSizePixel(); - Point aOKPnt; - aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; - aOKPnt.Y() = nY; - aOKButton.SetPosPixel( aOKPnt ); - - nY += aOKSiz.Height() + nCtrlMargin; - - aOutSiz.Height() = nY; - - // Change the size of the dialog - SetOutputSizePixel( aOutSiz ); - - FreeResource(); - - // explicit Help-Id - SetHelpId( CMD_SID_ABOUT ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) -{ - rtl::OUString sURL=pHyperlink->GetURL(); - rtl::OUString sTitle=GetText(); - - if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty - return 1; - try - { - uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); - xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); - } - catch ( uno::Exception& ) - { - uno::Any exc( ::cppu::getCaughtException() ); - rtl::OUString msg( ::comphelper::anyToString( exc ) ); - const SolarMutexGuard guard; - ErrorBox aErrorBox( NULL, WB_OK, msg ); - aErrorBox.SetText( sTitle ); - aErrorBox.Execute(); - } - - return 1; -} - -void AboutDialog::Paint( const Rectangle& rRect ) -{ - SetClipRegion( rRect ); - Point aPos( 0, 0 ); - DrawImage( aPos, aAppLogo ); -} - -sal_Bool AboutDialog::Close() -{ - EndDialog( RET_OK ); - return sal_False; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/about.hrc b/cui/source/dialogs/about.hrc deleted file mode 100644 index 37c04993b..000000000 --- a/cui/source/dialogs/about.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#define ABOUT_BTN_OK 1 -#define ABOUT_FTXT_VERSION 2 -#define ABOUT_FTXT_COPYRIGHT 3 -#define ABOUT_FTXT_LINK 4 -#define ABOUT_STR_BUILD 5 -#define ABOUT_STR_VERSION 6 -#define ABOUT_STR_VENDOR 7 -#define ABOUT_STR_COPYRIGHT 8 -#define ABOUT_STR_COPYRIGHT_DERIVED 9 -#define ABOUT_STR_COPYRIGHT_ORACLE_DERIVED 10 -#define ABOUT_STR_ACKNOWLEDGEMENT 11 -#define ABOUT_STR_LINK 12 diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src deleted file mode 100644 index 9cf835a4d..000000000 --- a/cui/source/dialogs/about.src +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "about.hrc" - -ModalDialog RID_DEFAULTABOUT -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 245 , 280 ) ; - Moveable = TRUE ; - SVLook = TRUE ; - OKButton ABOUT_BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 174 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - MultiLineEdit ABOUT_FTXT_VERSION - { - Border = FALSE ; - Pos = MAP_APPFONT ( 54 , 6 ) ; - Size = MAP_APPFONT ( 118 , 16 ) ; - IgnoreTab = TRUE ; - ReadOnly = TRUE ; - AutoVScroll = TRUE ; - }; - MultiLineEdit ABOUT_FTXT_COPYRIGHT - { - Border = FALSE ; - Pos = MAP_APPFONT ( 54 , 25 ) ; - Size = MAP_APPFONT ( 168 , 71 ) ; - IgnoreTab = TRUE ; - ReadOnly = TRUE ; - AutoVScroll = TRUE ; - LEFT = FALSE ; - CENTER = TRUE ; - RIGHT = FALSE ; - }; - FixedText ABOUT_FTXT_LINK - { - NoLabel = TRUE; - TabStop = TRUE; - Text [ en-US ] = "Contributor credits"; - Pos = MAP_APPFONT ( 54 , 100 ) ; - Size = MAP_APPFONT ( 168 , 10 ) ; - }; - String ABOUT_STR_VERSION - { - Text[ en-US ] = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION"; - }; - String ABOUT_STR_VENDOR - { - Text[ en-US ] = "This product was supplied by %OOOVENDOR."; - }; - String ABOUT_STR_COPYRIGHT - { - Text[ en-US ] = "LibreOffice is copyright © 2000, 2011 LibreOffice contributors and/or their affiliates. All rights reserved."; - }; - String ABOUT_STR_COPYRIGHT_DERIVED - { - Text[ en-US ] = "%PRODUCTNAME is derived from LibreOffice. LibreOffice is copyright © 2000, 2011 LibreOffice contributors and/or their affiliates. All rights reserved."; - }; - String ABOUT_STR_COPYRIGHT_ORACLE_DERIVED - { - Text[ en-US ] = "LibreOffice is derived from OpenOffice.org. OpenOffice.org is copyright © 2000, 2011 Oracle and/or its affiliates. All rights reserved."; - }; - String ABOUT_STR_ACKNOWLEDGEMENT - { - Text[ en-US ] = "%OOOVENDOR acknowledges all community members, please find more info at the link below:"; - }; - String ABOUT_STR_LINK - { - Text[ en-US ] = "http://www.libreoffice.org/credits.html"; - }; - String ABOUT_STR_BUILD - { - Text[ en-US ] = "Build ID:"; - }; -}; diff --git a/cui/source/dialogs/charmap.hrc b/cui/source/dialogs/charmap.hrc deleted file mode 100644 index 644ea47b3..000000000 --- a/cui/source/dialogs/charmap.hrc +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CHARMAP_HRC -#define _SVX_CHARMAP_HRC - -// defines ------------------------------------------------------------------ - -#define CT_SHOWSET 10 -#define FT_FONT 11 -#define LB_FONT 12 -#define CT_SHOWTEXT 13 -#define FT_SYMBOLE 14 -#define CT_SHOWCHAR 15 -#define FT_CHARCODE 16 -#define BTN_CHAR_OK 17 -#define BTN_CHAR_CANCEL 18 -#define BTN_CHAR_HELP 19 -#define BTN_DELETE 20 -#define FT_SUBSET 30 -#define LB_SUBSET 31 -#define ED_SHORTCUT 32 -#define BT_ASSIGN 33 -#define FT_ASSIGN 34 -#define CT_ASSIGN 35 - -#endif - diff --git a/cui/source/dialogs/charmap.src b/cui/source/dialogs/charmap.src deleted file mode 100644 index c59c7381a..000000000 --- a/cui/source/dialogs/charmap.src +++ /dev/null @@ -1,140 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- - -#include -#include "charmap.hrc" -#include "helpid.hrc" -#include // for RID_SVXDLG_CHARMAP - - // RID_SVXDLG_CHARMAP ---------------------------------------------------- -ModalDialog RID_SVXDLG_CHARMAP -{ - HelpId = CMD_SID_CHARMAP ; - SvLook = TRUE ; - Text [ en-US ] = "Special Characters"; - Size = MAP_APPFONT ( 297 , 153 ) ; - OutputSize = TRUE ; - Moveable = TRUE ; - Control CT_SHOWSET - { - HelpId = HID_CHARMAP_CTL_SHOWSET ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 230 , 112 ) ; - TabStop = TRUE ; - Group = TRUE ; - }; - FixedText FT_FONT - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 33 , 8 ) ; - Text [ en-US ] = "~Font" ; - Left = TRUE ; - Group = TRUE ; - }; - ListBox LB_FONT - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_FONT"; - Pos = MAP_APPFONT ( 42 , 6 ) ; - Size = MAP_APPFONT ( 70 , 58 ) ; - Sort = TRUE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SUBSET - { - Pos = MAP_APPFONT ( 118 , 8 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Subset"; - }; - ListBox LB_SUBSET - { - HelpID = "cui:ListBox:RID_SVXDLG_CHARMAP:LB_SUBSET"; - Pos = MAP_APPFONT ( 161 , 6 ) ; - Size = MAP_APPFONT ( 63 , 68 ) ; - Sort = FALSE ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_SYMBOLE - { - Pos = MAP_APPFONT ( 6 , 140 ) ; - Size = MAP_APPFONT ( 38 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Characters:"; - }; - Control CT_SHOWTEXT - { - HelpId = HID_CHARMAP_CTL_SHOWTEXT ; - Pos = MAP_APPFONT ( 46 , 137 ) ; - Size = MAP_APPFONT ( 244 , 16 ) ; - Group = TRUE ; - }; - Control CT_SHOWCHAR - { - HelpId = HID_CHARMAP_CTL_SHOWCHAR ; - Pos = MAP_APPFONT ( 241 , 79 ) ; - Size = MAP_APPFONT ( 50 , 44 ) ; - Group = TRUE ; - }; - FixedText FT_CHARCODE - { - Pos = MAP_APPFONT ( 241 , 126 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Center = TRUE ; - }; - OKButton BTN_CHAR_OK - { - Pos = MAP_APPFONT ( 242 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CHAR_CANCEL - { - Pos = MAP_APPFONT ( 242 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_CHAR_HELP - { - Pos = MAP_APPFONT ( 242 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXDLG_CHARMAP:BTN_DELETE"; - Pos = MAP_APPFONT ( 242 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete"; - }; -}; - -// ********************************************************************** EOF diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx deleted file mode 100644 index 3f3110de5..000000000 --- a/cui/source/dialogs/colorpicker.cxx +++ /dev/null @@ -1,1659 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include - -#include "dialmgr.hxx" -#include "colorpicker.hrc" - -#include - -using rtl::OUString; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::beans; -using namespace ::basegfx; - -namespace cui -{ - -const sal_uInt16 COLORMODE_RGB = 0x10; -const sal_uInt16 COLORMODE_HSV = 0x20; -const sal_uInt16 COLORMODE_CMYK = 0x40; - -const sal_uInt16 COLORCOMP_RED = 0x10; -const sal_uInt16 COLORCOMP_GREEN = 0x11; -const sal_uInt16 COLORCOMP_BLUE = 0x12; - -const sal_uInt16 COLORCOMP_HUE = 0x20; -const sal_uInt16 COLORCOMP_SAT = 0x21; -const sal_uInt16 COLORCOMP_BRI = 0x22; - -const sal_uInt16 COLORCOMP_CYAN = 0x40; -const sal_uInt16 COLORCOMP_YELLOW = 0x41; -const sal_uInt16 COLORCOMP_MAGENTA = 0x42; -const sal_uInt16 COLORCOMP_KEY = 0x43; - -// color space conversion helpers - -static void RGBtoHSV( double dR, double dG, double dB, double& dH, double& dS, double& dV ) -{ - BColor result = tools::rgb2hsv( BColor( dR, dG, dB ) ); - - dH = result.getX(); - dS = result.getY(); - dV = result.getZ(); -} - -static void HSVtoRGB(double dH, double dS, double dV, double& dR, double& dG, double& dB ) -{ - BColor result = tools::hsv2rgb( BColor( dH, dS, dV ) ); - - dR = result.getRed(); - dG = result.getGreen(); - dB = result.getBlue(); -} - -// ----------------------------------------------------------------------- - -// CMYK values from 0 to 1 -static void CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey, double& dR, double& dG, double& dB ) -{ - fCyan = (fCyan * ( 1.0 - fKey )) + fKey; - fMagenta = (fMagenta * ( 1.0 - fKey )) + fKey; - fYellow = (fYellow * ( 1.0 - fKey )) + fKey; - - dR = std::max( std::min( ( 1.0 - fCyan ), 1.0), 0.0 ); - dG = std::max( std::min( ( 1.0 - fMagenta ), 1.0), 0.0 ); - dB = std::max( std::min( ( 1.0 - fYellow ), 1.0), 0.0 ); -} - -// ----------------------------------------------------------------------- - -// CMY results from 0 to 1 -static void RGBtoCMYK( double dR, double dG, double dB, double& fCyan, double& fMagenta, double& fYellow, double& fKey ) -{ - fCyan = 1 - dR; - fMagenta = 1 - dG; - fYellow = 1 - dB; - - //CMYK and CMY values from 0 to 1 - fKey = 1.0; - if( fCyan < fKey ) fKey = fCyan; - if( fMagenta < fKey ) fKey = fMagenta; - if( fYellow < fKey ) fKey = fYellow; - - if( fKey >= 1.0 ) - { - //Black - fCyan = 0.0; - fMagenta = 0.0; - fYellow = 0.0; - } - else - { - fCyan = ( fCyan - fKey ) / ( 1.0 - fKey ); - fMagenta = ( fMagenta - fKey ) / ( 1.0 - fKey ); - fYellow = ( fYellow - fKey ) / ( 1.0 - fKey ); - } -} - -// ==================================================================== - -class HexColorControl : public Edit -{ -public: - HexColorControl( Window* pParent, const ResId& rResId ); - - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual void Paste(); - - void SetColor( sal_Int32 nColor ); - sal_Int32 GetColor(); - -private: - bool ImplProcessKeyInput( const KeyEvent& rKEv ); -}; - -HexColorControl::HexColorControl( Window* pParent, const ResId& rResId ) -: Edit( pParent, rResId ) -{ - SetMaxTextLen( 6 ); -} - -// ----------------------------------------------------------------------- - -void HexColorControl::SetColor( sal_Int32 nColor ) -{ - ::rtl::OUStringBuffer aBuffer; - sax::Converter::convertColor( aBuffer, nColor ); - SetText( aBuffer.makeStringAndClear().copy(1) ); -} - -// ----------------------------------------------------------------------- - -sal_Int32 HexColorControl::GetColor() -{ - sal_Int32 nColor = -1; - - OUString aStr( RTL_CONSTASCII_USTRINGPARAM( "#" ) ); - aStr += GetText(); - sal_Int32 nLen = aStr.getLength(); - if( nLen < 7 ) - { - static const sal_Char* pNullStr = "000000"; - aStr += OUString::createFromAscii( &pNullStr[nLen-1] ); - } - - sax::Converter::convertColor( nColor, aStr ); - - if( nColor == -1 ) - SetControlBackground( Color( COL_RED ) ); - else - SetControlBackground(); - - return nColor; -} - -// ----------------------------------------------------------------------- - -long HexColorControl::PreNotify( NotifyEvent& rNEvt ) -{ - if ( (rNEvt.GetType() == EVENT_KEYINPUT) && !rNEvt.GetKeyEvent()->GetKeyCode().IsMod2() ) - { - if ( ImplProcessKeyInput( *rNEvt.GetKeyEvent() ) ) - return 1; - } - - return Edit::PreNotify( rNEvt ); -} - -// ----------------------------------------------------------------------- - -void HexColorControl::Paste() -{ - ::com::sun::star::uno::Reference aClipboard(GetClipboard()); - if ( aClipboard.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj; - - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - - try - { - xDataObj = aClipboard->getContents(); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - - Application::AcquireSolarMutex( nRef ); - - if ( xDataObj.is() ) - { - ::com::sun::star::datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - try - { - ::com::sun::star::uno::Any aData = xDataObj->getTransferData( aFlavor ); - ::rtl::OUString aText; - aData >>= aText; - - if( aText.getLength() && aText.matchAsciiL( "#", 1, 0 ) ) - aText = aText.copy(1); - - if( aText.getLength() > 6 ) - aText = aText.copy( 0, 6 ); - - SetText( aText ); - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - } - } -} - -// ----------------------------------------------------------------------- - -bool HexColorControl::ImplProcessKeyInput( const KeyEvent& rKEv ) -{ - const KeyCode& rKeyCode = rKEv.GetKeyCode(); - - if( rKeyCode.GetGroup() == KEYGROUP_ALPHA && !rKeyCode.IsMod1() && !rKeyCode.IsMod2() ) - { - if( (rKeyCode.GetCode() < KEY_A) || (rKeyCode.GetCode() > KEY_F) ) - return true; - } - else if( rKeyCode.GetGroup() == KEYGROUP_NUM ) - { - if( rKeyCode.IsShift() ) - return true; - } - return false; -} - -// ==================================================================== - -class ColorPreviewControl : public Control -{ -public: - ColorPreviewControl( Window* pParent, const ResId& rResId ); - - virtual void Paint( const Rectangle& rRect ); - - void SetColor( const Color& rColor ); -private: - Color maColor; -}; - -// ----------------------------------------------------------------------- - -ColorPreviewControl::ColorPreviewControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - -// ----------------------------------------------------------------------- - -void ColorPreviewControl::SetColor( const Color& rCol ) -{ - if( rCol != maColor ) - { - maColor = rCol; - SetFillColor( maColor ); - SetLineColor( maColor ); - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void ColorPreviewControl::Paint( const Rectangle& rRect ) -{ - DrawRect( rRect ); -} - -// ==================================================================== - -enum ColorMode { HUE, SATURATION, BRIGHTNESS, RED, GREEN, BLUE }; -const ColorMode DefaultMode = HUE; - -class ColorFieldControl : public Control -{ -public: - ColorFieldControl( Window* pParent, const ResId& rResId ); - ~ColorFieldControl(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); - - void UpdateBitmap(); - void ShowPosition( const Point& rPos, bool bUpdate ); - void UpdatePosition(); - void Modify(); - - void SetValues( Color aColor, ColorMode eMode, double x, double y ); - double GetX(); - double GetY(); - - void KeyMove( int dx, int dy ); - - void SetModifyHdl( Link& rLink ) { maModifyHdl = rLink; } - -private: - Link maModifyHdl; - ColorMode meMode; - Color maColor; - double mdX; - double mdY; - Point maPosition; - Bitmap* mpBitmap; - std::vector< sal_uInt8 > maRGB_Horiz; - std::vector< sal_uInt16 > maGrad_Horiz; - std::vector< sal_uInt16 > maPercent_Horiz; - std::vector< sal_uInt8 > maRGB_Vert; - std::vector< sal_uInt16 > maPercent_Vert; - bool mbInit; -}; - -// ----------------------------------------------------------------------- - -ColorFieldControl::ColorFieldControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -, meMode( DefaultMode ) -, mdX( -1.0 ) -, mdY( -1.0 ) -, mpBitmap( 0 ) -, mbInit( false ) -{ - SetControlBackground(); -} - -// ----------------------------------------------------------------------- - -ColorFieldControl::~ColorFieldControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::UpdateBitmap() -{ - const Size aSize( GetOutputSizePixel() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - const sal_Int32 nWidth = aSize.Width(); - const sal_Int32 nHeight = aSize.Height(); - - if( !mpBitmap ) - { - mpBitmap = new Bitmap( aSize, 24 ); - - maRGB_Horiz.resize( nWidth ); - maGrad_Horiz.resize( nWidth ); - maPercent_Horiz.resize( nWidth ); - - sal_uInt8* pRGB = &(*maRGB_Horiz.begin()); - sal_uInt16* pGrad = &(*maGrad_Horiz.begin()); - sal_uInt16* pPercent = &(*maPercent_Horiz.begin()); - - for( sal_Int32 x = 0; x < nWidth; x++ ) - { - *pRGB++ = static_cast< sal_uInt8 >( (x * 256) / nWidth ); - *pGrad++ = static_cast< sal_uInt16 >( (x * 359) / nWidth ); - *pPercent++ = static_cast< sal_uInt16 >( (x * 100) / nWidth ); - } - - maRGB_Vert.resize( nHeight ); - maPercent_Vert.resize( nHeight ); - - pRGB = &(*maRGB_Vert.begin()); - pPercent = &(*maPercent_Vert.begin()); - - sal_Int32 y = nHeight; - while( y-- ) - { - *pRGB++ = static_cast< sal_uInt8 >( (y * 256) / nHeight ); - *pPercent++ = static_cast< sal_uInt16 >( (y * 100) / nHeight ); - } - } - - sal_uInt8* pRGB_Horiz = &(*maRGB_Horiz.begin()); - sal_uInt16* pGrad_Horiz = &(*maGrad_Horiz.begin()); - sal_uInt16* pPercent_Horiz = &(*maPercent_Horiz.begin()); - sal_uInt8* pRGB_Vert = &(*maRGB_Vert.begin()); - sal_uInt16* pPercent_Vert = &(*maPercent_Vert.begin()); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - if( pWriteAccess ) - { - BitmapColor aBitmapColor( maColor ); - - sal_uInt16 nHue, nSat, nBri; - maColor.RGBtoHSB( nHue, nSat, nBri ); - - // this has been unlooped for performance reason, please do not merge back! - - sal_uInt16 y = nHeight,x; - - switch( meMode ) - { - case HUE: - while( y-- ) - { - nBri = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nSat = pPercent_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case SATURATION: - while( y-- ) - { - nBri = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case BRIGHTNESS: - while( y-- ) - { - nSat = pPercent_Vert[y]; - x = nWidth; - while( x-- ) - { - nHue = pGrad_Horiz[x]; - pWriteAccess->SetPixel( y, x, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - } - break; - case RED: - while( y-- ) - { - aBitmapColor.SetGreen( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetBlue( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - case GREEN: - while( y-- ) - { - aBitmapColor.SetRed( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetBlue( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - case BLUE: - while( y-- ) - { - aBitmapColor.SetGreen( pRGB_Vert[y] ); - x = nWidth; - while( x-- ) - { - aBitmapColor.SetRed( pRGB_Horiz[x] ); - pWriteAccess->SetPixel( y, x, aBitmapColor ); - } - } - break; - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::ShowPosition( const Point& rPos, bool bUpdate ) -{ - if( !mpBitmap ) - { - UpdateBitmap(); - Invalidate(); - } - - const Size aSize( mpBitmap->GetSizePixel() ); - - long nX = rPos.X(); - long nY = rPos.Y(); - if( nX < 0L ) - nX = 0L; - else if( nX >= aSize.Width() ) - nX = aSize.Width() - 1L; - - if( nY < 0L ) - nY= 0L; - else if( nY >= aSize.Height() ) - nY = aSize.Height() - 1L; - - Point aPos = maPosition; - maPosition.X() = nX - 5; - maPosition.Y() = nY - 5; - Invalidate( Rectangle( aPos, Size( 11, 11) ) ); - Invalidate( Rectangle( maPosition, Size( 11, 11) ) ); - - if( bUpdate ) - { - mdX = (double)nX / (double)(aSize.Width()-1); - mdY = (double)(aSize.Height()-1-nY) / (double)(aSize.Height()-1); - - BitmapReadAccess* pReadAccess = mpBitmap->AcquireReadAccess(); - if( pReadAccess != NULL ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = pReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( pReadAccess ); - pReadAccess = NULL; - } - } -} -// ----------------------------------------------------------------------- - -void ColorFieldControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ShowPosition( rMEvt.GetPosPixel(), true ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorFieldControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - CaptureMouse(); - ShowPosition( rMEvt.GetPosPixel(), true ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorFieldControl::MouseButtonUp( const MouseEvent& ) -{ - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::KeyMove( int dx, int dy ) -{ - Size aSize( GetOutputSizePixel() ); - Point aPos(static_cast(mdX * aSize.Width()), static_cast((1.0 - mdY) * aSize.Height())); - aPos.X() += dx; - aPos.Y() += dy; - if( aPos.X() < 0 ) - aPos.X() += aSize.Width(); - else if( aPos.X() >= aSize.Width() ) - aPos.X() -= aSize.Width(); - - if( aPos.Y() < 0 ) - aPos.Y() += aSize.Height(); - else if( aPos.Y() >= aSize.Height() ) - aPos.Y() -= aSize.Height(); - - ShowPosition( aPos, true ); - Modify(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::KeyInput( const KeyEvent& rKEvt ) -{ - bool bShift = rKEvt.GetKeyCode().IsShift(); - bool bCtrl = rKEvt.GetKeyCode().IsMod1(); - bool bAlt = rKEvt.GetKeyCode().IsMod2(); - - if ( !bAlt && !bShift ) - { - switch( rKEvt.GetKeyCode().GetCode() ) - { - case KEY_DOWN: KeyMove( 0, bCtrl ? 5 : 1 ); return; - case KEY_UP: KeyMove( 0, bCtrl ? -5 : -1 ); return; - case KEY_LEFT: KeyMove( bCtrl ? -5 : -1, 0 ); return; - case KEY_RIGHT: KeyMove( bCtrl ? 5 : 1, 0 ); return; - } - } - Control::KeyInput( rKEvt ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Paint( const Rectangle& rRect ) -{ - if( !mpBitmap ) - UpdateBitmap(); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - DrawBitmap( rRect.TopLeft(), rRect.GetSize(), rRect.TopLeft(), rRect.GetSize(), aOutputBitmap ); - - // draw circle around current color - if( maColor.IsDark() ) - SetLineColor( COL_WHITE ); - else - SetLineColor( COL_BLACK ); - - SetFillColor(); - - DrawEllipse( Rectangle( maPosition, Size( 11, 11) ) ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Resize() -{ - UpdateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y ) -{ - bool bUpdateBitmap = (maColor!= aColor) || (meMode != eMode); - if( bUpdateBitmap || (mdX != x) || (mdY != y) ) - { - maColor = aColor; - meMode = eMode; - mdX = x; - mdY = y; - - if( bUpdateBitmap ) - UpdateBitmap(); - UpdatePosition(); - if( bUpdateBitmap ) - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -double ColorFieldControl::GetX() -{ - return mdX; -} - -// ----------------------------------------------------------------------- - -double ColorFieldControl::GetY() -{ - return mdY; -} - -// ----------------------------------------------------------------------- - -void ColorFieldControl::UpdatePosition() -{ - Size aSize( GetOutputSizePixel() ); - ShowPosition( Point(static_cast(mdX * aSize.Width()), static_cast((1.0 - mdY) * aSize.Height())), false ); -} - -// ==================================================================== - -class ColorSliderControl : public Control -{ -public: - ColorSliderControl( Window* pParent, const ResId& rResId ); - ~ColorSliderControl(); - - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); - - void UpdateBitmap(); - void ChangePosition( long nY ); - void Modify(); - - void SetValue( const Color& rColor, ColorMode eMode, double dValue ); - double GetValue() const { return mdValue; } - - void KeyMove( int dy ); - - void SetModifyHdl( Link& rLink ) { maModifyHdl = rLink; } - - sal_Int16 GetLevel() const { return mnLevel; } - -private: - Link maModifyHdl; - Color maColor; - ColorMode meMode; - Bitmap* mpBitmap; - sal_Int16 mnLevel; - double mdValue; -}; - -// ----------------------------------------------------------------------- - -ColorSliderControl::ColorSliderControl( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ) -, meMode( DefaultMode ) -, mpBitmap( 0 ) -, mnLevel( 0 ) -, mdValue( -1.0 ) -{ - SetControlBackground(); -} - -// ----------------------------------------------------------------------- - -ColorSliderControl::~ColorSliderControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::UpdateBitmap() -{ - Size aSize( 1, GetOutputSizePixel().Height() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - if( !mpBitmap ) - mpBitmap = new Bitmap( aSize, 24 ); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - - if( pWriteAccess ) - { - const long nY = aSize.Height()-1; - - BitmapColor aBitmapColor( maColor ); - - sal_uInt16 nHue, nSat, nBri; - maColor.RGBtoHSB( nHue, nSat, nBri ); - - // this has been unlooped for performance reason, please do not merge back! - - switch( meMode ) - { - case HUE: - nSat = 100; - nBri = 100; - for( long y = 0; y <= nY; y++ ) - { - nHue = static_cast< sal_uInt16 >( (359 * y) / nY ); - aBitmapColor = BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case SATURATION: - nBri = std::max( (sal_uInt16)32, nBri ); - for( long y = 0; y <= nY; y++ ) - { - nSat = static_cast< sal_uInt16 >( (100 * y) / nY ); - pWriteAccess->SetPixel( nY-y, 0, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - break; - - case BRIGHTNESS: - for( long y = 0; y <= nY; y++ ) - { - nBri = static_cast< sal_uInt16 >( (100 * y) / nY ); - pWriteAccess->SetPixel( nY-y, 0, BitmapColor( Color( Color::HSBtoRGB( nHue, nSat, nBri ) ) ) ); - } - break; - - case RED: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetRed( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case GREEN: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetGreen( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - - case BLUE: - for( long y = 0; y <= nY; y++ ) - { - aBitmapColor.SetBlue( sal_uInt8( ((long)255 * y) / nY ) ); - pWriteAccess->SetPixel( nY-y, 0, aBitmapColor ); - } - break; - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::ChangePosition( long nY ) -{ - const long nHeight = GetOutputSizePixel().Height() - 1; - - if( nY < 0L ) - nY = 0; - else if( nY > nHeight ) - nY = nHeight; - - mnLevel = nY; - mdValue = ((double)(nHeight - nY)) / (double)nHeight; -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ChangePosition( rMEvt.GetPosPixel().Y() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorSliderControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - CaptureMouse(); - ChangePosition( rMEvt.GetPosPixel().Y() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void ColorSliderControl::MouseButtonUp( const MouseEvent& ) -{ - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::KeyMove( int dy ) -{ - ChangePosition( mnLevel + dy ); - Modify(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::KeyInput( const KeyEvent& rKEvt ) -{ - if ( !rKEvt.GetKeyCode().IsMod2() && !rKEvt.GetKeyCode().IsShift() ) - { - switch( rKEvt.GetKeyCode().GetCode() ) - { - case KEY_DOWN: KeyMove( rKEvt.GetKeyCode().IsMod1() ? 5 : 1 ); return; - case KEY_UP: KeyMove( rKEvt.GetKeyCode().IsMod1() ? -5 : -1 ); return; - } - } - - Control::KeyInput( rKEvt ); -} -// ----------------------------------------------------------------------- - -void ColorSliderControl::Paint( const Rectangle& /*rRect*/ ) -{ - if( !mpBitmap ) - UpdateBitmap(); - - const Size aSize( GetOutputSizePixel() ); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - Point aPos; - int x = aSize.Width(); - while( x-- ) - { - DrawBitmap( aPos, aOutputBitmap ); - aPos.X() += 1; - } -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::Resize() -{ - UpdateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void ColorSliderControl::SetValue( const Color& rColor, ColorMode eMode, double dValue ) -{ - bool bUpdateBitmap = (rColor != maColor) || (eMode != meMode); - if( bUpdateBitmap || (mdValue != dValue)) - { - maColor = rColor; - mdValue = dValue; - mnLevel = static_cast((1.0-dValue) * GetOutputSizePixel().Height()); - meMode = eMode; - if( bUpdateBitmap ) - UpdateBitmap(); - Invalidate(); - } -} - -// ==================================================================== - -const sal_uInt16 UPDATE_RGB = 0x01; -const sal_uInt16 UPDATE_CMYK = 0x02; -const sal_uInt16 UPDATE_HSB = 0x04; -const sal_uInt16 UPDATE_COLORCHOOSER = 0x08; -const sal_uInt16 UPDATE_COLORSLIDER = 0x10; -const sal_uInt16 UPDATE_HEX = 0x20; -const sal_uInt16 UPDATE_ALL = 0xff; - -class ColorPickerDialog : public ModalDialog -{ -public: - ColorPickerDialog( Window* pParent, sal_Int32 nColor, sal_Int16 nMode ); - - void update_color( sal_uInt16 n = UPDATE_ALL ); - - DECL_LINK( ColorModifyHdl, void * ); - DECL_LINK( ModeModifyHdl, void * ); - - sal_Int32 GetColor() const; - - void setColorComponent( sal_uInt16 nComp, double dValue ); - -private: - Color maPreviousColor; - sal_Int16 mnDialogMode; - ColorMode meMode; - - double mdRed, mdGreen, mdBlue; - double mdHue, mdSat, mdBri; - double mdCyan, mdMagenta, mdYellow, mdKey; - -private: - ColorFieldControl maColorField; - ColorSliderControl maColorSlider; - ColorPreviewControl maColorPreview; - ColorPreviewControl maColorPrevious; - - FixedImage maFISliderLeft; - FixedImage maFISliderRight; - Image maSliderImage; - -#if 0 - ImageButton maBtnPicker; -#endif - - FixedLine maFLRGB; - - RadioButton maRBRed; - RadioButton maRBGreen; - RadioButton maRBBlue; - RadioButton maRBHue; - RadioButton maRBSaturation; - RadioButton maRBBrightness; - - FixedText maFTRed; - MetricField maMFRed; - FixedText maFTGreen; - MetricField maMFGreen; - FixedText maFTBlue; - MetricField maMFBlue; - FixedText maFTHex; - HexColorControl maEDHex; - - FixedLine maFLHSB; - FixedText maFTHue; - MetricField maMFHue; - FixedText maFTSaturation; - MetricField maMFSaturation; - FixedText maFTBrightness; - MetricField maMFBrightness; - - FixedLine maFLCMYK; - FixedText maFTCyan; - MetricField maMFCyan; - FixedText maFTMagenta; - MetricField maMFMagenta; - FixedText maFTYellow; - MetricField maMFYellow; - FixedText maFTKey; - MetricField maMFKey; - - FixedLine maFLBottmLine; - HelpButton maBTNHelp; - OKButton maBTNOk; - CancelButton maBTNCancel; -}; - -// -------------------------------------------------------------------- - -ColorPickerDialog::ColorPickerDialog( Window* pParent, sal_Int32 nColor, sal_Int16 nMode ) -: ModalDialog( pParent, CUI_RES( RID_CUI_DIALOG_COLORPICKER ) ) -, maPreviousColor( nColor ) -, mnDialogMode( nMode ) -, meMode( DefaultMode ) -, maColorField( this, CUI_RES( CT_COLORFIELD ) ) -, maColorSlider( this, CUI_RES( CT_COLORSLIDER ) ) -, maColorPreview( this, CUI_RES( CT_PREVIEW ) ) -, maColorPrevious( this, CUI_RES( CT_PREVIOUS ) ) -, maFISliderLeft( this, CUI_RES( CT_LEFT_SLIDER ) ) -, maFISliderRight( this, CUI_RES( CT_RIGHT_SLIDER ) ) -, maSliderImage( CUI_RES( CT_SLIDERIMG ) ) -#if 0 -, maBtnPicker( this, CUI_RES( PB_PICKER ) ) -#endif -, maFLRGB( this, CUI_RES( FL_RGB ) ) -, maRBRed( this, CUI_RES( CT_RED ) ) -, maRBGreen( this, CUI_RES( CT_GREEN ) ) -, maRBBlue( this, CUI_RES( CT_BLUE ) ) -, maRBHue( this, CUI_RES( CT_HUE ) ) -, maRBSaturation( this, CUI_RES( CT_SATURATION ) ) -, maRBBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maFTRed( this, CUI_RES( CT_RED ) ) -, maMFRed( this, CUI_RES( CT_RED ) ) -, maFTGreen( this, CUI_RES( CT_GREEN ) ) -, maMFGreen( this, CUI_RES( CT_GREEN ) ) -, maFTBlue( this, CUI_RES( CT_BLUE ) ) -, maMFBlue( this, CUI_RES( CT_BLUE ) ) -, maFTHex( this, CUI_RES( CT_HEX ) ) -, maEDHex( this, CUI_RES( CT_HEX ) ) -, maFLHSB( this, CUI_RES( FL_HSB ) ) -, maFTHue( this, CUI_RES( CT_HUE ) ) -, maMFHue( this, CUI_RES( CT_HUE ) ) -, maFTSaturation( this, CUI_RES( CT_SATURATION ) ) -, maMFSaturation( this, CUI_RES( CT_SATURATION ) ) -, maFTBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maMFBrightness( this, CUI_RES( CT_BRIGHTNESS ) ) -, maFLCMYK( this, CUI_RES( FL_CMYK ) ) -, maFTCyan( this, CUI_RES( CT_CYAN ) ) -, maMFCyan( this, CUI_RES( CT_CYAN ) ) -, maFTMagenta( this, CUI_RES( CT_MAGENTA ) ) -, maMFMagenta( this, CUI_RES( CT_MAGENTA ) ) -, maFTYellow( this, CUI_RES( CT_YELLOW ) ) -, maMFYellow( this, CUI_RES( CT_YELLOW ) ) -, maFTKey( this, CUI_RES( CT_KEY ) ) -, maMFKey( this, CUI_RES( CT_KEY ) ) - -, maFLBottmLine( this, CUI_RES( FT_BOTTOMLINE ) ) -, maBTNHelp( this, CUI_RES( BTN_HELP ) ) -, maBTNOk( this, CUI_RES( BTN_OK ) ) -, maBTNCancel( this, CUI_RES( BTN_CANCEL ) ) -{ - FreeResource(); - - String sUnitText; - sUnitText.Append( ' ' ); - sUnitText.Append( (sal_Unicode) 0xb0 ); - - maMFHue.SetCustomUnitText( sUnitText ); - - Link aLink( LINK( this, ColorPickerDialog, ColorModifyHdl ) ); - maColorField.SetModifyHdl( aLink ); - maColorSlider.SetModifyHdl( aLink ); - - maMFRed.SetModifyHdl( aLink ); - maMFGreen.SetModifyHdl( aLink ); - maMFBlue.SetModifyHdl( aLink ); - - maMFCyan.SetModifyHdl( aLink ); - maMFMagenta.SetModifyHdl( aLink ); - maMFYellow.SetModifyHdl( aLink ); - maMFKey.SetModifyHdl( aLink ); - - maMFHue.SetModifyHdl( aLink ); - maMFSaturation.SetModifyHdl( aLink ); - maMFBrightness.SetModifyHdl( aLink ); - - maEDHex.SetModifyHdl( aLink ); - - aLink = LINK( this, ColorPickerDialog, ModeModifyHdl ); - maRBRed.SetToggleHdl( aLink ); - maRBGreen.SetToggleHdl( aLink ); - maRBBlue.SetToggleHdl( aLink ); - maRBHue.SetToggleHdl( aLink ); - maRBSaturation.SetToggleHdl( aLink ); - maRBBrightness.SetToggleHdl( aLink ); - - Image aSliderImage( maSliderImage ); - - maFISliderLeft.SetImage( aSliderImage ); - - BitmapEx aTmpBmp( maSliderImage.GetBitmapEx() ); - aTmpBmp.Mirror( BMP_MIRROR_HORZ ); - maFISliderRight.SetImage( Image( aTmpBmp ) ); - - Size aSize( maSliderImage.GetSizePixel() ); - maFISliderLeft.SetSizePixel( aSize ); - maFISliderRight.SetSizePixel( aSize ); - - Point aPos( maColorSlider.GetPosPixel() ); - - aPos.X() -= aSize.Width(); - aPos.Y() -= aSize.Height() / 2; - maFISliderLeft.SetPosPixel( aPos ); - - aPos.X() += aSize.Width() + maColorSlider.GetSizePixel().Width(); - maFISliderRight.SetPosPixel( aPos ); - - Color aColor( nColor ); - - // modify - if( mnDialogMode == 2 ) - { - maColorPreview.SetSizePixel( maColorPrevious.GetSizePixel() ); - maColorPrevious.SetColor( aColor ); - maColorPrevious.Show( true ); - } - - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetGreen()) / 255.0; - mdBlue = ((double)aColor.GetBlue()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - - update_color(); -} - -// -------------------------------------------------------------------- - -static int toInt( double dValue, double dRange ) -{ - return static_cast< int >( std::floor((dValue * dRange) + 0.5 ) ); -} - -sal_Int32 ColorPickerDialog::GetColor() const -{ - return Color( toInt(mdRed,255.0), toInt(mdGreen,255.0), toInt(mdBlue,255.0) ).GetColor(); -} - -void ColorPickerDialog::update_color( sal_uInt16 n ) -{ - sal_uInt8 nRed = toInt(mdRed,255.0); - sal_uInt8 nGreen = toInt(mdGreen,255.0); - sal_uInt8 nBlue = toInt(mdBlue,255.0); - - Color aColor( nRed, nGreen, nBlue ); - - if( n & UPDATE_RGB ) // update RGB - { - maMFRed.SetValue( nRed ); - maMFGreen.SetValue( nGreen ); - maMFBlue.SetValue( nBlue ); - } - - if( n & UPDATE_CMYK ) // update CMYK - { - maMFCyan.SetValue( toInt( mdCyan, 100.0 ) ); - maMFMagenta.SetValue( toInt( mdMagenta, 100.0 ) ); - maMFYellow.SetValue( toInt( mdYellow, 100.0 ) ); - maMFKey.SetValue( toInt( mdKey, 100.0 ) ); - } - - if( n & UPDATE_HSB ) // update HSB - { - maMFHue.SetValue( toInt( mdHue, 1.0 ) ); - maMFSaturation.SetValue( toInt( mdSat, 100.0 ) ); - maMFBrightness.SetValue( toInt( mdBri, 100.0 ) ); - } - - if( n & UPDATE_COLORCHOOSER ) // update Color Chooser 1 - { - switch( meMode ) - { - case HUE: maColorField.SetValues( aColor, meMode, mdSat, mdBri ); break; - case SATURATION: maColorField.SetValues( aColor, meMode, mdHue / 360.0, mdBri ); break; - case BRIGHTNESS: maColorField.SetValues( aColor, meMode, mdHue / 360.0, mdSat ); break; - case RED: maColorField.SetValues( aColor, meMode, mdBlue, mdGreen ); break; - case GREEN: maColorField.SetValues( aColor, meMode, mdBlue, mdRed ); break; - case BLUE: maColorField.SetValues( aColor, meMode, mdRed, mdGreen ); break; - } - } - - if( n & UPDATE_COLORSLIDER ) // update Color Chooser 2 - { - switch( meMode ) - { - case HUE: maColorSlider.SetValue( aColor, meMode, mdHue / 360.0 ); break; - case SATURATION: maColorSlider.SetValue( aColor, meMode, mdSat ); break; - case BRIGHTNESS: maColorSlider.SetValue( aColor, meMode, mdBri ); break; - case RED: maColorSlider.SetValue( aColor, meMode, mdRed ); break; - case GREEN: maColorSlider.SetValue( aColor, meMode, mdGreen ); break; - case BLUE: maColorSlider.SetValue( aColor, meMode, mdBlue ); break; - } - } - - if( n & UPDATE_HEX ) // update hex - { - maEDHex.SetColor( aColor.GetColor() ); - } - - { - Point aPos( 0, maColorSlider.GetLevel() + maColorSlider.GetPosPixel().Y() - 1 ); - - aPos.X() = maFISliderLeft.GetPosPixel().X(); - if( aPos != maFISliderLeft.GetPosPixel() ) - { - maFISliderLeft.SetPosPixel( aPos ); - - aPos.X() = maFISliderRight.GetPosPixel().X(); - maFISliderRight.SetPosPixel( aPos ); - } - } - - maColorPreview.SetColor( aColor ); -} - -// -------------------------------------------------------------------- - -IMPL_LINK( ColorPickerDialog, ColorModifyHdl, void *, p ) -{ - sal_uInt16 n = 0; - - if( p == &maColorField ) - { - double x = maColorField.GetX(); - double y = maColorField.GetY(); - - switch( meMode ) - { - case HUE: mdSat = x; setColorComponent( COLORCOMP_BRI, y ); break; - case SATURATION: mdHue = x * 360.0; setColorComponent( COLORCOMP_BRI, y ); break; - case BRIGHTNESS: mdHue = x * 360.0; setColorComponent( COLORCOMP_SAT, y ); break; - case RED: mdBlue = x; setColorComponent( COLORCOMP_GREEN, y ); break; - case GREEN: mdBlue = x; setColorComponent( COLORCOMP_RED, y ); break; - case BLUE: mdRed = x; setColorComponent( COLORCOMP_GREEN, y ); break; - } - - n = UPDATE_ALL&~(UPDATE_COLORCHOOSER); - } - else if( p == &maColorSlider ) - { - double dValue = maColorSlider.GetValue(); - switch( meMode ) - { - case HUE: setColorComponent( COLORCOMP_HUE, dValue * 360.0 ); break; - case SATURATION: setColorComponent( COLORCOMP_SAT, dValue ); break; - case BRIGHTNESS: setColorComponent( COLORCOMP_BRI, dValue ); break; - case RED: setColorComponent( COLORCOMP_RED, dValue ); break; - case GREEN: setColorComponent( COLORCOMP_GREEN, dValue ); break; - case BLUE: setColorComponent( COLORCOMP_BLUE, dValue ); break; - } - - n = UPDATE_ALL&~(UPDATE_COLORSLIDER); - } - else if( p == &maMFRed ) - { - setColorComponent( COLORCOMP_RED, ((double)maMFRed.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFGreen ) - { - setColorComponent( COLORCOMP_GREEN, ((double)maMFGreen.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFBlue ) - { - setColorComponent( COLORCOMP_BLUE, ((double)maMFBlue.GetValue()) / 255.0 ); - n = UPDATE_ALL&~(UPDATE_RGB); - } - else if( p == &maMFHue ) - { - setColorComponent( COLORCOMP_HUE, (double)maMFHue.GetValue() ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFSaturation ) - { - setColorComponent( COLORCOMP_SAT, ((double)maMFSaturation.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFBrightness ) - { - setColorComponent( COLORCOMP_BRI, ((double)maMFBrightness.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_HSB); - } - else if( p == &maMFCyan ) - { - setColorComponent( COLORCOMP_CYAN, ((double)maMFCyan.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFMagenta ) - { - setColorComponent( COLORCOMP_MAGENTA, ((double)maMFMagenta.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFYellow ) - { - setColorComponent( COLORCOMP_YELLOW, ((double)maMFYellow.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maMFKey ) - { - setColorComponent( COLORCOMP_KEY, ((double)maMFKey.GetValue()) / 100.0 ); - n = UPDATE_ALL&~(UPDATE_CMYK); - } - else if( p == &maEDHex ) - { - sal_Int32 nColor = maEDHex.GetColor(); - - if( nColor != -1 ) - { - Color aColor( nColor ); - - if( aColor != GetColor() ) - { - mdRed = ((double)aColor.GetRed()) / 255.0; - mdGreen = ((double)aColor.GetRed()) / 255.0; - mdBlue = ((double)aColor.GetRed()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - n = UPDATE_ALL&~(UPDATE_HEX); - } - } - } - - if( n ) - update_color( n ); - - return 0; -} - -// -------------------------------------------------------------------- - -IMPL_LINK( ColorPickerDialog, ModeModifyHdl, void *, EMPTYARG ) -{ - ColorMode eMode = HUE; - - if( maRBRed.IsChecked() ) - { - eMode = RED; - } - else if( maRBGreen.IsChecked() ) - { - eMode = GREEN; - } - else if( maRBBlue.IsChecked() ) - { - eMode = BLUE; - } - else if( maRBSaturation.IsChecked() ) - { - eMode = SATURATION; - } - else if( maRBBrightness.IsChecked() ) - { - eMode = BRIGHTNESS; - } - - if( meMode != eMode ) - { - meMode = eMode; - update_color( UPDATE_COLORCHOOSER | UPDATE_COLORSLIDER ); - } - - return 0; -} - -// -------------------------------------------------------------------- - -void ColorPickerDialog::setColorComponent( sal_uInt16 nComp, double dValue ) -{ - switch( nComp ) - { - case COLORCOMP_RED: mdRed = dValue; break; - case COLORCOMP_GREEN: mdGreen = dValue; break; - case COLORCOMP_BLUE: mdBlue = dValue; break; - case COLORCOMP_HUE: mdHue = dValue; break; - case COLORCOMP_SAT: mdSat = dValue; break; - case COLORCOMP_BRI: mdBri = dValue; break; - case COLORCOMP_CYAN: mdCyan = dValue; break; - case COLORCOMP_YELLOW: mdYellow = dValue; break; - case COLORCOMP_MAGENTA: mdMagenta = dValue; break; - case COLORCOMP_KEY: mdKey = dValue; break; - } - - if( nComp & COLORMODE_RGB ) - { - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - } - else if( nComp & COLORMODE_HSV ) - { - HSVtoRGB( mdHue, mdSat, mdBri, mdRed, mdGreen, mdBlue ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - } - else - { - CMYKtoRGB( mdCyan, mdMagenta, mdYellow, mdKey, mdRed, mdGreen, mdBlue ); - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - } -} - -// -------------------------------------------------------------------- - -typedef ::cppu::WeakComponentImplHelper4< XServiceInfo, XExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; - -class ColorPicker : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses. - public ColorPickerBase -{ -public: - ColorPicker( Reference< XComponentContext > const & xContext ); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); - - // XInitialization - 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); - - // XPropertyAccess - virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) throw (RuntimeException); - virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException); - - // XExecutableDialog - virtual void SAL_CALL setTitle( const OUString& aTitle ) throw (RuntimeException); - virtual sal_Int16 SAL_CALL execute( ) throw (RuntimeException); - -private: - Reference< XComponentContext > mxContext; - OUString msTitle; - const OUString msColorKey; - const OUString msModeKey; - sal_Int32 mnColor; - sal_Int16 mnMode; - Reference< ::com::sun::star::awt::XWindow > mxParent; -}; - -// -------------------------------------------------------------------- - -OUString SAL_CALL ColorPicker_getImplementationName() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.cui.ColorPicker" ) ); -} - -// -------------------------------------------------------------------- - -Reference< XInterface > SAL_CALL ColorPicker_createInstance( Reference< XComponentContext > const & xContext ) SAL_THROW( (Exception) ) -{ - return static_cast( new ColorPicker( xContext ) ); -} - -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( RuntimeException ) -{ - Sequence< OUString > seq(1); - seq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.ColorPicker" ) ); - return seq; -} - -// -------------------------------------------------------------------- - -ColorPicker::ColorPicker( Reference< XComponentContext > const & xContext ) -: ColorPickerBase( m_aMutex ) -, mxContext( xContext ) -, msColorKey( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ) -, msModeKey( RTL_CONSTASCII_USTRINGPARAM( "Mode" ) ) -, mnColor( 0 ) -, mnMode( 0 ) -{ -} - -// -------------------------------------------------------------------- - -// XInitialization -void SAL_CALL ColorPicker::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) -{ - if( aArguments.getLength() == 1 ) - { - aArguments[0] >>= mxParent; - } -} - -// -------------------------------------------------------------------- - -// XInitialization -OUString SAL_CALL ColorPicker::getImplementationName( ) throw (RuntimeException) -{ - return ColorPicker_getImplementationName(); -} - -// -------------------------------------------------------------------- - -sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) throw (RuntimeException) -{ - return sServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.ui.dialogs.ColorPicker" ) ); -} - -// -------------------------------------------------------------------- - -Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( ) throw (RuntimeException) -{ - return ColorPicker_getSupportedServiceNames(); -} - -// -------------------------------------------------------------------- - -// XPropertyAccess -Sequence< PropertyValue > SAL_CALL ColorPicker::getPropertyValues( ) throw (RuntimeException) -{ - Sequence< PropertyValue > props(1); - props[0].Name = msColorKey; - props[0].Value <<= mnColor; - return props; -} - -// -------------------------------------------------------------------- - -void SAL_CALL ColorPicker::setPropertyValues( const Sequence< PropertyValue >& aProps ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) -{ - for( sal_Int32 n = 0; n < aProps.getLength(); n++ ) - { - if( aProps[n].Name.equals( msColorKey ) ) - { - aProps[n].Value >>= mnColor; - } - else if( aProps[n].Name.equals( msModeKey ) ) - { - aProps[n].Value >>= mnMode; - } - } -} - -// -------------------------------------------------------------------- - -// XExecutableDialog -void SAL_CALL ColorPicker::setTitle( const OUString& sTitle ) throw (RuntimeException) -{ - msTitle = sTitle; -} - -// -------------------------------------------------------------------- - -sal_Int16 SAL_CALL ColorPicker::execute( ) throw (RuntimeException) -{ - ColorPickerDialog aDlg( VCLUnoHelper::GetWindow( mxParent ), mnColor, mnMode ); - sal_Int16 ret = aDlg.Execute(); - if( ret ) - mnColor = aDlg.GetColor(); - - return ret; -} - -// -------------------------------------------------------------------- - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/colorpicker.hrc b/cui/source/dialogs/colorpicker.hrc deleted file mode 100644 index 0c40686dd..000000000 --- a/cui/source/dialogs/colorpicker.hrc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef _CUI_COLORPICKER_HRC_ -#define _CUI_COLORPICKER_HRC_ - -#include - - -#define FT_BOTTOMLINE 1 -#define BTN_OK 2 -#define BTN_CANCEL 3 -#define BTN_HELP 4 - -#define CT_COLORFIELD 5 -#define CT_COLORSLIDER 6 -#define CT_PREVIEW 7 -#define CT_PREVIOUS 8 - -#define FL_RGB 9 -#define CT_RED 10 -#define CT_GREEN 11 -#define CT_BLUE 12 -#define CT_HEX 13 - -#define FL_HSB 14 -#define CT_HUE 15 -#define CT_SATURATION 16 -#define CT_BRIGHTNESS 17 - -#define FL_CMYK 18 -#define CT_CYAN 19 -#define CT_MAGENTA 20 -#define CT_YELLOW 21 -#define CT_KEY 22 - -#define PB_PICKER 23 - -#define CT_LEFT_SLIDER 24 -#define CT_RIGHT_SLIDER 25 - -#define CT_SLIDERIMG 26 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/colorpicker.src b/cui/source/dialogs/colorpicker.src deleted file mode 100644 index b444f7442..000000000 --- a/cui/source/dialogs/colorpicker.src +++ /dev/null @@ -1,492 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "colorpicker.hrc" - -#define DLG_WIDTH 295 -#define DLG_HEIGHT 216 - -#define BUTTON_WIDTH 50 -#define BUTTON_HEIGHT 14 - -#define METRIC_WIDTH 30 -#define METRIC_HEIGHT 12 - -#define RADIO_WIDTH 8 -#define RADIO_HEIGHT 8 - -#define LABEL_WIDTH 50 -#define LABEL_HEIGHT 10 - -#define SLIDER_WIDTH 22 -#define PREVIEW_HEIGHT 16 - -#define LINE_WIDTH (3 + RADIO_WIDTH + 2 + LABEL_WIDTH + 3 + METRIC_WIDTH + 3) -#define LINE_HEIGHT 8 - -#define CONTROL_AREA_X (DLG_WIDTH - LINE_WIDTH - 6) -#define CONTROL_AREA_X_RADIO (CONTROL_AREA_X + 3) -#define CONTROL_AREA_X_LABEL (CONTROL_AREA_X + 3 + RADIO_WIDTH + 2) -#define CONTROL_AREA_X_METRIC (CONTROL_AREA_X + 3 + RADIO_WIDTH + 2 + LABEL_WIDTH + 3) - -#define CHOOSER_SIZE (CONTROL_AREA_X - 6 - SLIDER_WIDTH - 2 - 2 ) - -#define BOTTOMLINE_Y (DLG_HEIGHT - 3 - 3 - 8 - 14) -#define BUTTON_LINE_Y (BOTTOMLINE_Y + 8 + 3) - -#define RGB_Y1 (6 + LINE_HEIGHT + 1) -#define RGB_Y2 (RGB_Y1 + METRIC_HEIGHT + 2) -#define RGB_Y3 (RGB_Y2 + METRIC_HEIGHT + 2) -#define RGB_Y4 (RGB_Y3 + METRIC_HEIGHT + 4) -#define HSB_Y0 (RGB_Y4 + METRIC_HEIGHT + 1) -#define HSB_Y1 (HSB_Y0 + LINE_HEIGHT + 2) -#define HSB_Y2 (HSB_Y1 + METRIC_HEIGHT + 2) -#define HSB_Y3 (HSB_Y2 + METRIC_HEIGHT + 2) -#define CMYK_Y0 (HSB_Y3 + METRIC_HEIGHT + 1) -#define CMYK_Y1 (CMYK_Y0 + LINE_HEIGHT + 1) -#define CMYK_Y2 (CMYK_Y1 + METRIC_HEIGHT + 2) -#define CMYK_Y3 (CMYK_Y2 + METRIC_HEIGHT + 2) -#define CMYK_Y4 (CMYK_Y3 + METRIC_HEIGHT + 2) - - - -ModalDialog RID_CUI_DIALOG_COLORPICKER -{ - HelpID = "cui:ModalDialog:ColorPicker"; - - OutputSize = TRUE ; - SvLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ; - - Text [ en-US ] = "Color Picker" ; - - Control CT_COLORFIELD - { - HelpID = "cui:Control:ColorPicker:ColorField"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE , CHOOSER_SIZE ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - Control CT_COLORSLIDER - { - HelpID = "cui:Control:ColorPicker:ColorSlider"; - Pos = MAP_APPFONT ( CONTROL_AREA_X - 2 - SLIDER_WIDTH + 4 , 6 ) ; - Size = MAP_APPFONT ( SLIDER_WIDTH - 8 , CHOOSER_SIZE ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - Control CT_PREVIEW - { - HelpID = "cui:Control:ColorPicker:ColorPreview"; - Pos = MAP_APPFONT ( 6 , 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE , PREVIEW_HEIGHT ) ; - Border = FALSE; - }; - - Control CT_PREVIOUS - { - HelpID = "cui:Control:ColorPicker:ColorPrevious"; - Pos = MAP_APPFONT ( 6 + (CHOOSER_SIZE/2), 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT ( CHOOSER_SIZE/2 , PREVIEW_HEIGHT ) ; - Border = FALSE; - Hide = TRUE; - }; - - FixedImage CT_LEFT_SLIDER - { - }; - - FixedImage CT_RIGHT_SLIDER - { - }; - - Image CT_SLIDERIMG - { - ImageBitmap = Bitmap { File = "colorslider.png" ; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - }; - -#if 0 - ImageButton PB_PICKER - { - HelpID = "cui:ImageButton:ColorPicker:Picker"; - Pos = MAP_APPFONT ( CONTROL_AREA_X - 2 - SLIDER_WIDTH + 4, 6 + CHOOSER_SIZE + 3 ) ; - Size = MAP_APPFONT( SLIDER_WIDTH - 8, PREVIEW_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Pick a color from the document" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "pipette.png" ; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ; - }; - }; -#endif - - FixedLine FL_RGB - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , 6 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "RGB" ; - }; - - RadioButton CT_RED - { - HelpID = "cui:RadioButton:ColorPicker:Red"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y1+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - Group = TRUE; - }; - - RadioButton CT_GREEN - { - HelpID = "cui:RadioButton:ColorPicker:Green"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y2+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_BLUE - { - HelpID = "cui:RadioButton:ColorPicker:Blue"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , RGB_Y3+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_HUE - { - HelpID = "cui:RadioButton:ColorPicker:Hue"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y1+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - Check = TRUE ; - }; - - RadioButton CT_SATURATION - { - HelpID = "cui:RadioButton:ColorPicker:Saturation"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y2+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - RadioButton CT_BRIGHTNESS - { - HelpID = "cui:RadioButton:ColorPicker:Brightness"; - Pos = MAP_APPFONT ( CONTROL_AREA_X_RADIO , HSB_Y3+2 ) ; - Size = MAP_APPFONT ( RADIO_WIDTH , RADIO_HEIGHT ) ; - }; - - FixedText CT_RED - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Red" ; - }; - - MetricField CT_RED - { - HelpID = "cui:MetricField:ColorPicker:Red"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_GREEN - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Green" ; - }; - - MetricField CT_GREEN - { - HelpID = "cui:MetricField:ColorPicker:Green"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_BLUE - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Blue" ; - }; - - MetricField CT_BLUE - { - HelpID = "cui:MetricField:ColorPicker:Blue"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - - FixedText CT_HEX - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , RGB_Y4+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "Hex ~#" ; - }; - - Edit CT_HEX - { - HelpID = "cui:MetricField:ColorPicker:Hex"; - Border = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , RGB_Y4 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - }; - -// ------------------------------------------------------------------------- -// HSB -// ------------------------------------------------------------------------- - - FixedLine FL_HSB - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , HSB_Y0 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "HSB" ; - }; - - FixedText CT_HUE - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "H~ue" ; - }; - - MetricField CT_HUE - { - HelpID = "cui:MetricField:ColorPicker:Hue"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 360 ; - Last = 360 ; - Unit = FUNIT_CUSTOM ; - }; - - FixedText CT_SATURATION - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Saturation" ; - }; - - MetricField CT_SATURATION - { - HelpID = "cui:MetricField:ColorPicker:Saturation"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_BRIGHTNESS - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , HSB_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "Bright~ness" ; - }; - - MetricField CT_BRIGHTNESS - { - HelpID = "cui:MetricField:ColorPicker:Brightness"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , HSB_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - -// ------------------------------------------------------------------------- -// CMYK -// ------------------------------------------------------------------------- - - FixedLine FL_CMYK - { - Pos = MAP_APPFONT ( CONTROL_AREA_X , CMYK_Y0 ) ; - Size = MAP_APPFONT ( LINE_WIDTH , LINE_HEIGHT ) ; - Text [ en-US ] = "CMYK" ; - }; - - FixedText CT_CYAN - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y1+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Cyan" ; - }; - - MetricField CT_CYAN - { - HelpID = "cui:MetricField:ColorPicker:Cyan"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y1 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_MAGENTA - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y2+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Magenta" ; - }; - - MetricField CT_MAGENTA - { - HelpID = "cui:MetricField:ColorPicker:Magenta"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y2 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_YELLOW - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y3+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Yellow" ; - }; - - MetricField CT_YELLOW - { - HelpID = "cui:MetricField:ColorPicker:Yellow"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y3 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - FixedText CT_KEY - { - Pos = MAP_APPFONT ( CONTROL_AREA_X_LABEL , CMYK_Y4+1 ) ; - Size = MAP_APPFONT ( LABEL_WIDTH , LABEL_HEIGHT ) ; - Text [ en-US ] = "~Key" ; - }; - - MetricField CT_KEY - { - HelpID = "cui:MetricField:ColorPicker:Key"; - Border = TRUE ; - Pos = MAP_APPFONT ( CONTROL_AREA_X_METRIC , CMYK_Y4 ) ; - Size = MAP_APPFONT ( METRIC_WIDTH , METRIC_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - - // ------------------------------------------------------ - // bottom buttons - // ------------------------------------------------------ - - FixedLine FT_BOTTOMLINE - { - Pos = MAP_APPFONT ( 0 , BOTTOMLINE_Y ) ; - Size = MAP_APPFONT ( DLG_WIDTH , 8 ) ; - }; - - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 3 , BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( DLG_WIDTH - 3 - BUTTON_WIDTH - 3 - BUTTON_WIDTH, BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( DLG_WIDTH - 3 - BUTTON_WIDTH, BUTTON_LINE_Y ) ; - Size = MAP_APPFONT ( BUTTON_WIDTH , BUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.cxx b/cui/source/dialogs/commonlingui.cxx deleted file mode 100644 index 1ab3edec3..000000000 --- a/cui/source/dialogs/commonlingui.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "commonlingui.hxx" - -#include -#include -#include -#include - -#include "hangulhanjadlg.hrc" - -//============================================================================= -// SvxClickInfoCtr -//============================================================================= - -//----------------------------------------------------------------------------- -SvxClickInfoCtr::SvxClickInfoCtr( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ), - aFixedInfo( this) -{ - aFixedInfo.SetSizePixel(GetOutputSizePixel()); - aFixedInfo.Show(); -} - -//----------------------------------------------------------------------------- -void SvxClickInfoCtr::MouseButtonDown( const MouseEvent& ) -{ - aActivateLink.Call(this); -} - -//----------------------------------------------------------------------------- -long SvxClickInfoCtr::PreNotify( NotifyEvent& rNEvt ) -{ - if(rNEvt.GetType()==EVENT_GETFOCUS || rNEvt.GetType()==EVENT_MOUSEBUTTONDOWN) - { - aActivateLink.Call(this); - } - - return Control::PreNotify(rNEvt); -} - -//----------------------------------------------------------------------------- -void SvxClickInfoCtr::SetText( const XubString& rStr ) -{ - aFixedInfo.SetText(rStr ); -} - -//----------------------------------------------------------------------------- -XubString SvxClickInfoCtr::GetText() const -{ - return aFixedInfo.GetText(); -} - -//----------------------------------------------------------------------------- -SvxClickInfoCtr::~SvxClickInfoCtr() -{ -} - -//============================================================================= -// SvxCommonLinguisticControl -//============================================================================= -//----------------------------------------------------------------------------- -SvxCommonLinguisticControl::SvxCommonLinguisticControl( ModalDialog* _pParent ) - :Window( _pParent, CUI_RES( RID_SVX_WND_COMMON_LINGU ) ) - ,aWordText ( this, CUI_RES( FT_WORD ) ) - ,aAktWord ( this, CUI_RES( FT_AKTWORD ) ) - ,aNewWord ( this, CUI_RES( FT_NEWWORD ) ) - ,aNewWordED ( this, CUI_RES( ED_NEWWORD ) ) - ,aSuggestionFT ( this, CUI_RES( FT_SUGGESTION ) ) - ,aIgnoreBtn ( this, CUI_RES( BTN_IGNORE ) ) - ,aIgnoreAllBtn ( this, CUI_RES( BTN_IGNOREALL ) ) - ,aChangeBtn ( this, CUI_RES( BTN_CHANGE ) ) - ,aChangeAllBtn ( this, CUI_RES( BTN_CHANGEALL ) ) - ,aOptionsBtn ( this, CUI_RES( BTN_OPTIONS ) ) - ,aStatusText ( this, CUI_RES( FT_STATUS ) ) - ,aHelpBtn ( this, CUI_RES( BTN_SPL_HELP ) ) - ,aCancelBtn ( this, CUI_RES( BTN_SPL_CANCEL ) ) - ,aAuditBox ( this, CUI_RES( GB_AUDIT ) ) -{ - FreeResource(); - aAktWord.SetAccessibleName(aWordText.GetText()); - SetPosSizePixel( Point( 0, 0 ), _pParent->GetOutputSizePixel() ); - Show(); -} - -// ----------------------------------------------------------------------- -PushButton* SvxCommonLinguisticControl::implGetButton( ButtonType _eType ) const -{ - const PushButton* pButton = NULL; - switch ( _eType ) - { - case eClose: pButton = &aCancelBtn; break; - case eIgnore: pButton = &aIgnoreBtn; break; - case eIgnoreAll: pButton = &aIgnoreAllBtn; break; - case eChange: pButton = &aChangeBtn; break; - case eChangeAll: pButton = &aChangeAllBtn; break; - case eOptions: pButton = &aOptionsBtn; break; - } - return const_cast< PushButton* >( pButton ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::SetButtonHandler( ButtonType _eType, const Link& _rHandler ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->SetClickHdl( _rHandler ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::EnableButton( ButtonType _eType, sal_Bool _bEnable ) -{ - Button* pButton = GetButton( _eType ); - if ( pButton ) - pButton->Enable( _bEnable ); -} - -// ----------------------------------------------------------------------- -void SvxCommonLinguisticControl::InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ) -{ - Window* pInsertAfter = NULL; // will be the last window of our own "undividable" group, after which we insert the foreign group - switch ( _eInsertAfter ) - { - case eLeftRightWords : pInsertAfter = &aNewWordED; break; - case eSuggestionLabel : pInsertAfter = &aSuggestionFT; break; - case eActionButtons : pInsertAfter = &aChangeAllBtn; break; - case eDialogButtons : pInsertAfter = &aCancelBtn; break; - } - - // now loop through the remaining windows of the foreign group - Window* pInsertBehind = pInsertAfter; - Window* pInsert = &_rFirstGroupWindow; - - // some strange thing below: asking a window for WINDOW_NEXT or WINDOW_PREV does not take into - // account the border window, _but_ SetZOrder _does_!. Thus, when advancing through a chain - // of windows, we need to work with the border windows (WINDOW_BORDER), instead of simply - // asking for WINDOW_NEXT. - - Window* pLoopEnd = _rLastGroupWindow.GetWindow( WINDOW_BORDER ); - while ( pInsert && ( pInsertBehind != pLoopEnd ) ) - { - // we'll destroy the NEXT relation immediately, so remember the next window - DBG_ASSERT( pInsert->GetWindow( WINDOW_BORDER ), "SvxCommonLinguisticControl::InsertControlGroup: border window is expected to be non NULL!" ); - Window* pNextInsert = pInsert->GetWindow( WINDOW_BORDER )->GetWindow( WINDOW_NEXT ); - // knit - pInsert->SetZOrder( pInsertBehind, WINDOW_ZORDER_BEHIND ); - // advance - pInsertBehind = pInsert; - pInsert = pNextInsert; - } - DBG_ASSERT( pInsertBehind == pLoopEnd, "SvxCommonLinguisticControl::InsertControlGroup: controls do not form a group!" ); - // if we did not reach pLoopEnd, then we did not reach _rLastGroupWindow in the loop, then - // (FirstWindow, LastWindow) was no valid control group -} - -//----------------------------------------------------------------------------- -void SvxCommonLinguisticControl::Paint( const Rectangle& rRect ) -{ - Window::Paint(rRect ); - - DecorationView aDecoView( this ); - - Rectangle aRect( aAuditBox.GetPosPixel(), aAuditBox.GetSizePixel() ); - aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL ); -} - -//----------------------------------------------------------------------------- -void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY ) -{ - Size aSize; - Point aPos; - - // the controls which need to be resized - { - Window* pResize[] = - { - this, &aAuditBox, &aStatusText - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pResize ); ++i ) - { - aSize = pResize[i]->GetSizePixel( ); - pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) ); - } - } - - // the controls which stick to the bottom of the window - { - Window* pMoveDown[] = - { - &aStatusText, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveDown ); ++i ) - { - aPos = pMoveDown[i]->GetPosPixel(); - aPos.Y() += _nY; - pMoveDown[i]->SetPosPixel( aPos ); - } - } - - // the controls which stick to the right - { - Window* pMoveRight[] = - { - &aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn - }; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveRight ); ++i ) - { - aPos = pMoveRight[i]->GetPosPixel(); - aPos.X() += _nX; - pMoveRight[i]->SetPosPixel( aPos ); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.hxx b/cui/source/dialogs/commonlingui.hxx deleted file mode 100644 index 64e199705..000000000 --- a/cui/source/dialogs/commonlingui.hxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_COMMON_LINGUI_HXX -#define SVX_COMMON_LINGUI_HXX - -#include -#include -#include -#include -#include -#include -#include - -//============================================================================= -// SvxClickInfoCtr -//============================================================================= - -class SvxClickInfoCtr: public Control -{ -private: - FixedInfo aFixedInfo; - Link aActivateLink; - -public: - SvxClickInfoCtr( Window* pParent, const ResId& rResId ); - ~SvxClickInfoCtr(); - - virtual void SetText( const XubString& rStr ); - virtual XubString GetText() const; - - void SetActivateHdl( const Link& rLink ) { aActivateLink = rLink; } - const Link& GetActivateHdl() const { return aActivateLink; } - -protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual long PreNotify( NotifyEvent& rNEvt ); - -}; - -//============================================================================= -// SvxCommonLinguisticControl -//============================================================================= -class SvxCommonLinguisticControl : public Window -{ -public: - enum ButtonType - { - eClose, - eIgnore, - eIgnoreAll, - eChange, - eChangeAll, - eOptions - }; - -protected: - FixedText aWordText; - SvxClickInfoCtr aAktWord; - - FixedText aNewWord; - Edit aNewWordED; - - FixedText aSuggestionFT; - - PushButton aIgnoreBtn; - PushButton aIgnoreAllBtn; - PushButton aChangeBtn; - PushButton aChangeAllBtn; - PushButton aOptionsBtn; - - FixedInfo aStatusText; - HelpButton aHelpBtn; - CancelButton aCancelBtn; - - GroupBox aAuditBox; - -protected: - virtual void Paint( const Rectangle& rRect ); - -private: - PushButton* implGetButton( ButtonType _eType ) const; - -public: - SvxCommonLinguisticControl( ModalDialog* _pParent ); - - // handlers - inline void SetResetWordHdl( const Link& _rLink ) { aAktWord.SetActivateHdl( _rLink ); } - inline const Link& GetResetWordHdl() const { return aAktWord.GetActivateHdl(); } - - void SetButtonHandler( ButtonType _eType, const Link& _rHandler ); - void EnableButton( ButtonType _eType, sal_Bool _bEnable ); - - inline PushButton* GetButton( ButtonType _eType ) { return implGetButton( _eType ); } - inline const PushButton* GetButton( ButtonType _eType ) const { return implGetButton( _eType ); } - - // users of this class may want to insert own controls in some places, where the ordinary - // Z-Order determined by construction time is not sufficient - // Use the following methods for this - enum ControlGroup // control groups in this window which cannot be devided (e.g. are adjacent in the Z order) - { - eLeftRightWords, // the controls for the two words (original and suggestion), including the labels - eSuggestionLabel, // the label for the suggestion - eActionButtons, // the group of "ignore(all)" / "change(all)" buttons - eDialogButtons // the group of dialog control buttons (help and close) - }; - void InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter ); - - /** enlarges the window - - Some controls "stick" to the borders: The group of change/ignore buttons, for instance, sticks - to the right, the dictionary list as well as the close/help buttons stick to the bottom of the - window. - */ - void Enlarge( sal_Int32 _nX, sal_Int32 _nY ); - - // control access methods - inline void SetCurrentText( const String& _rText ) { aAktWord.SetText( _rText ); } - inline String GetCurrentText( ) const { return aAktWord.GetText(); } - - inline void SetStatusText( const String& _rText ) { aStatusText.SetText( _rText ); } - inline String GetStatusText( ) const { return aStatusText.GetText(); } - - inline Edit& GetWordInputControl() { return aNewWordED; } - inline const Edit& GetWordInputControl() const { return aNewWordED; } - - // returns the location (upper-left corner) of the group of action buttons - inline Point GetActionButtonsLocation( ) const { return aIgnoreBtn.GetPosPixel(); } -}; - - - -#endif // SVX_COMMON_LINGUI_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/commonlingui.src b/cui/source/dialogs/commonlingui.src deleted file mode 100644 index 148cd89b9..000000000 --- a/cui/source/dialogs/commonlingui.src +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include "hangulhanjadlg.hrc" - -Window RID_SVX_WND_COMMON_LINGU -{ - DialogControl = TRUE; // we want to tab out of this - Hide = TRUE; - - FixedText FT_WORD - { - Pos = MAP_APPFONT( 6, 9 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "Origi~nal"; - }; - Control FT_AKTWORD - { - HelpId=HID_SPELLDLG_SETWORD; - Pos = MAP_APPFONT( 51, 9 ); - Size = MAP_APPFONT( 164, 10 ); - Border =FALSE; - TabStop = TRUE; - }; - - FixedText FT_NEWWORD - { - Pos = MAP_APPFONT( 6, 25 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Word" ; - }; - - Edit ED_NEWWORD - { - Pos = MAP_APPFONT( 51, 24 ); - Size = MAP_APPFONT( 137, 12 ); - Border = TRUE; - }; - - FixedText FT_SUGGESTION - { - Pos = MAP_APPFONT( 6, 48 ); - Size = MAP_APPFONT( 42, 10 ); - Text [ en-US ] = "~Suggestions" ; - }; - - PushButton BTN_IGNORE - { - Pos = MAP_APPFONT( 224, 6 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Ignore" ; - }; - - PushButton BTN_IGNOREALL - { - Pos = MAP_APPFONT( 224, 22 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always I~gnore" ; - }; - - PushButton BTN_CHANGE - { - Pos = MAP_APPFONT( 224, 40 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "~Replace" ; - DefButton = TRUE ; - }; - - PushButton BTN_CHANGEALL - { - Pos = MAP_APPFONT( 224, 56 ); - Size = MAP_APPFONT( 55, 14 ); - Text [ en-US ] = "Always R~eplace" ; - }; - - PushButton BTN_OPTIONS - { - Pos = MAP_APPFONT( 224, 129 ); - Size = MAP_APPFONT( 55, 14 ); - Hide = TRUE ; - Text [ en-US ] = "Options..." ; - }; - - FixedText FT_STATUS - { - Pos = MAP_APPFONT( 6, 155 ); - Size = MAP_APPFONT( 130, 10 ); - }; - - GroupBox GB_AUDIT - { - Pos = MAP_APPFONT( 1, 1 ); - Size = MAP_APPFONT( 283, 148 ); - Hide=TRUE; - }; - - HelpButton BTN_SPL_HELP - { - Pos = MAP_APPFONT( 160, 153 ); - Size = MAP_APPFONT( 55, 14 ); - }; - - CancelButton BTN_SPL_CANCEL - { - Pos = MAP_APPFONT ( 224 , 153 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Close" ; - }; -}; diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx deleted file mode 100644 index 777851cce..000000000 --- a/cui/source/dialogs/cuicharmap.cxx +++ /dev/null @@ -1,581 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include - -#define _CUI_CHARMAP_CXX_ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include "cuicharmap.hxx" -#include -#include -#include -#include -#include "charmap.hrc" -#include "macroass.hxx" - -// class SvxCharacterMap ================================================= - -SvxCharacterMap::SvxCharacterMap( Window* pParent, sal_Bool bOne, const SfxItemSet* pSet ) : - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_CHARMAP ) ), - mpCharMapData( 0 ) -{ - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, FN_PARAM_1, sal_False ); - if ( pItem ) - bOne = pItem->GetValue(); - - mpCharMapData = new SvxCharMapData( this, bOne, &CUI_MGR() ); - - SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, sal_False ); - if ( pCharItem ) - SetChar( pCharItem->GetValue() ); - - SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, sal_False ); - if ( pDisableItem && pDisableItem->GetValue() ) - DisableFontSelection(); - - SFX_ITEMSET_ARG( pSet, pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); - SFX_ITEMSET_ARG( pSet, pFontNameItem, SfxStringItem, SID_FONT_NAME, sal_False ); - if ( pFontItem ) - { - Font aFont( pFontItem->GetFamilyName(), pFontItem->GetStyleName(), GetCharFont().GetSize() ); - aFont.SetCharSet( pFontItem->GetCharSet() ); - aFont.SetPitch( pFontItem->GetPitch() ); - SetCharFont( aFont ); - } - else if ( pFontNameItem ) - { - Font aFont( GetCharFont() ); - aFont.SetName( pFontNameItem->GetValue() ); - SetCharFont( aFont ); - } - - FreeResource(); - CreateOutputItemSet( pSet ? *pSet->GetPool() : SFX_APP()->GetPool() ); -} - -// ----------------------------------------------------------------------- - -SvxCharacterMap::~SvxCharacterMap() -{ - delete mpCharMapData; -} - -// ----------------------------------------------------------------------- - -const Font& SvxCharacterMap::GetCharFont() const -{ - return mpCharMapData->aFont; -} - -// ----------------------------------------------------------------------- - -void SvxCharacterMap::SetChar( sal_UCS4 c ) -{ - mpCharMapData->aShowSet.SelectCharacter( c ); -} - -// ----------------------------------------------------------------------- - -sal_UCS4 SvxCharacterMap::GetChar() const -{ - return mpCharMapData->aShowSet.GetSelectCharacter(); -} - -// ----------------------------------------------------------------------- - -String SvxCharacterMap::GetCharacters() const -{ - return mpCharMapData->aShowText.GetText(); -} - - -// ----------------------------------------------------------------------- - -void SvxCharacterMap::DisableFontSelection() -{ - mpCharMapData->aFontText.Disable(); - mpCharMapData->aFontLB.Disable(); -} - -void SvxCharacterMap::SetCharFont( const Font& rFont ) -{ - mpCharMapData->SetCharFont( rFont ); -} - -short SvxCharacterMap::Execute() -{ - short nResult = SfxModalDialog::Execute(); - if ( nResult == RET_OK ) - { - SfxItemSet* pSet = GetItemSet(); - if ( pSet ) - { - const SfxItemPool* pPool = pSet->GetPool(); - const Font& rFont( GetCharFont() ); - pSet->Put( SfxStringItem( pPool->GetWhich(SID_CHARMAP), GetCharacters() ) ); - pSet->Put( SvxFontItem( rFont.GetFamily(), rFont.GetName(), - rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), pPool->GetWhich(SID_ATTR_CHAR_FONT) ) ); - pSet->Put( SfxStringItem( pPool->GetWhich(SID_FONT_NAME), rFont.GetName() ) ); - pSet->Put( SfxInt32Item( pPool->GetWhich(SID_ATTR_CHAR), GetChar() ) ); - } - } - - return nResult; -} - - -// class SvxShowText ===================================================== - -SvxShowText::SvxShowText( Window* pParent, const ResId& rResId, sal_Bool bCenter ) -: Control( pParent, rResId ), - mbCenter( bCenter) -{} - -// ----------------------------------------------------------------------- - -void SvxShowText::Paint( const Rectangle& ) -{ - Color aTextCol = GetTextColor(); - - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - const Color aWindowTextColor( rStyleSettings.GetDialogTextColor() ); - SetTextColor( aWindowTextColor ); - - const String aText = GetText(); - const Size aSize = GetOutputSizePixel(); - Point aPoint( 2, mnY ); - - // adjust position using ink boundary if possible - Rectangle aBoundRect; - if( !GetTextBoundRect( aBoundRect, aText ) || aBoundRect.IsEmpty() ) - aPoint.X() = (aSize.Width() - GetTextWidth( aText )) / 2; - else - { - // adjust position before it gets out of bounds - aBoundRect += aPoint; - - // shift back vertically if needed - int nYLDelta = aBoundRect.Top(); - int nYHDelta = aSize.Height() - aBoundRect.Bottom(); - if( nYLDelta <= 0 ) - aPoint.Y() -= nYLDelta - 1; - else if( nYHDelta <= 0 ) - aPoint.Y() += nYHDelta - 1; - - if( mbCenter ) - { - // move glyph to middle of cell - aPoint.X() = -aBoundRect.Left() - + (aSize.Width() - aBoundRect.GetWidth()) / 2; - } - else - { - // shift back horizontally if needed - int nXLDelta = aBoundRect.Left(); - int nXHDelta = aSize.Width() - aBoundRect.Right(); - if( nXLDelta <= 0 ) - aPoint.X() -= nXLDelta - 1; - else if( nXHDelta <= 0 ) - aPoint.X() += nXHDelta - 1; - } - } - - DrawText( aPoint, aText ); - SetTextColor( aTextCol ); -} - -// ----------------------------------------------------------------------- - -void SvxShowText::SetFont( const Font& rFont ) -{ - long nWinHeight = GetOutputSizePixel().Height(); - Font aFont = rFont; - aFont.SetWeight( WEIGHT_NORMAL ); - aFont.SetAlign( ALIGN_TOP ); - aFont.SetSize( PixelToLogic( Size( 0, nWinHeight/2 ) ) ); - aFont.SetTransparent( sal_True ); - Control::SetFont( aFont ); - mnY = ( nWinHeight - GetTextHeight() ) / 2; - - Invalidate(); -} - -// ----------------------------------------------------------------------- - -void SvxShowText::SetText( const String& rText ) -{ - Control::SetText( rText ); - Invalidate(); -} - -// ----------------------------------------------------------------------- - -SvxShowText::~SvxShowText() -{} - -// class SvxCharacterMap ================================================= - -SvxCharMapData::SvxCharMapData( SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* pResContext ) -: mpDialog( pDialog ), - aShowSet ( pDialog, ResId( CT_SHOWSET, *pResContext ) ), - aShowText ( pDialog, ResId( CT_SHOWTEXT, *pResContext ) ), - aOKBtn ( pDialog, ResId( BTN_CHAR_OK, *pResContext ) ), - aCancelBtn ( pDialog, ResId( BTN_CHAR_CANCEL, *pResContext ) ), - aHelpBtn ( pDialog, ResId( BTN_CHAR_HELP, *pResContext ) ), - aDeleteBtn ( pDialog, ResId( BTN_DELETE, *pResContext ) ), - aFontText ( pDialog, ResId( FT_FONT, *pResContext ) ), - aFontLB ( pDialog, ResId( LB_FONT, *pResContext ) ), - aSubsetText ( pDialog, ResId( FT_SUBSET, *pResContext ) ), - aSubsetLB ( pDialog, ResId( LB_SUBSET, *pResContext ) ), - aSymbolText ( pDialog, ResId( FT_SYMBOLE, *pResContext ) ), - aShowChar ( pDialog, ResId( CT_SHOWCHAR, *pResContext ), sal_True ), - aCharCodeText ( pDialog, ResId( FT_CHARCODE, *pResContext ) ), - bOne( bOne_ ), - pSubsetMap( NULL ) -{ - aFont = pDialog->GetFont(); - aFont.SetTransparent( sal_True ); - aFont.SetFamily( FAMILY_DONTKNOW ); - aFont.SetPitch( PITCH_DONTKNOW ); - aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); - - if ( bOne ) - { - Size aDlgSize = pDialog->GetSizePixel(); - pDialog->SetSizePixel( Size( aDlgSize.Width(), - aDlgSize.Height()-aShowText.GetSizePixel().Height() ) ); - aSymbolText.Hide(); - aShowText.Hide(); - aDeleteBtn.Hide(); - } - - String aDefStr( aFont.GetName() ); - String aLastName; - int nCount = mpDialog->GetDevFontCount(); - for ( int i = 0; i < nCount; i++ ) - { - String aFontName( mpDialog->GetDevFont( i ).GetName() ); - if ( aFontName != aLastName ) - { - aLastName = aFontName; - sal_uInt16 nPos = aFontLB.InsertEntry( aFontName ); - aFontLB.SetEntryData( nPos, (void*)(sal_uLong)i ); - } - } - // the font may not be in the list => - // try to find a font name token in list and select found font, - // else select topmost entry - bool bFound = (aFontLB.GetEntryPos( aDefStr ) == LISTBOX_ENTRY_NOTFOUND ); - if( !bFound ) - { - for ( xub_StrLen i = 0; i < aDefStr.GetTokenCount(); ++i ) - { - String aToken = aDefStr.GetToken(i); - if ( aFontLB.GetEntryPos( aToken ) != LISTBOX_ENTRY_NOTFOUND ) - { - aDefStr = aToken; - bFound = sal_True; - break; - } - } - } - - if ( bFound ) - aFontLB.SelectEntry( aDefStr ); - else if ( aFontLB.GetEntryCount() ) - aFontLB.SelectEntryPos(0); - FontSelectHdl( &aFontLB ); - - aOKBtn.SetClickHdl( LINK( this, SvxCharMapData, OKHdl ) ); - aFontLB.SetSelectHdl( LINK( this, SvxCharMapData, FontSelectHdl ) ); - aSubsetLB.SetSelectHdl( LINK( this, SvxCharMapData, SubsetSelectHdl ) ); - aShowSet.SetDoubleClickHdl( LINK( this, SvxCharMapData, CharDoubleClickHdl ) ); - aShowSet.SetSelectHdl( LINK( this, SvxCharMapData, CharSelectHdl ) ); - aShowSet.SetHighlightHdl( LINK( this, SvxCharMapData, CharHighlightHdl ) ); - aShowSet.SetPreSelectHdl( LINK( this, SvxCharMapData, CharPreSelectHdl ) ); - aDeleteBtn.SetClickHdl( LINK( this, SvxCharMapData, DeleteHdl ) ); - - if( SvxShowCharSet::getSelectedChar() == ' ') - aOKBtn.Disable(); - else - aOKBtn.Enable(); - - // left align aShowText field - int nLeftEdge = aSymbolText.GetPosPixel().X(); - nLeftEdge += aSymbolText.GetTextWidth( aSymbolText.GetText() ); - aShowText.SetPosPixel( Point( nLeftEdge+4, aShowText.GetPosPixel().Y() ) ); -} - -// ----------------------------------------------------------------------- - -void SvxCharMapData::SetCharFont( const Font& rFont ) -{ - // first get the underlying info in order to get font names - // like "Times New Roman;Times" resolved - Font aTmp( mpDialog->GetFontMetric( rFont ) ); - - if ( aFontLB.GetEntryPos( aTmp.GetName() ) == LISTBOX_ENTRY_NOTFOUND ) - return; - - aFontLB.SelectEntry( aTmp.GetName() ); - aFont = aTmp; - FontSelectHdl( &aFontLB ); - - // for compatibility reasons - mpDialog->ModalDialog::SetFont( aFont ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, OKHdl, OKButton *, EMPTYARG ) -{ - String aStr = aShowText.GetText(); - - if ( !aStr.Len() ) - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - // using the new UCS4 constructor - rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aOUStr ); - } - mpDialog->EndDialog( sal_True ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, FontSelectHdl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aFontLB.GetSelectEntryPos(), - nFont = (sal_uInt16)(sal_uLong)aFontLB.GetEntryData( nPos ); - aFont = mpDialog->GetDevFont( nFont ); - aFont.SetWeight( WEIGHT_DONTKNOW ); - aFont.SetItalic( ITALIC_NONE ); - aFont.SetWidthType( WIDTH_DONTKNOW ); - aFont.SetPitch( PITCH_DONTKNOW ); - aFont.SetFamily( FAMILY_DONTKNOW ); - - // notify children using this font - aShowSet.SetFont( aFont ); - aShowChar.SetFont( aFont ); - aShowText.SetFont( aFont ); - - // right align some fields to aShowSet - int nRightEdge = aShowSet.GetPosPixel().X() + aShowSet.GetOutputSizePixel().Width(); - Size aNewSize = aSubsetLB.GetOutputSizePixel(); - aNewSize.setWidth( nRightEdge - aSubsetLB.GetPosPixel().X() ); - aSubsetLB.SetOutputSizePixel( aNewSize ); - - // setup unicode subset listbar with font specific subsets, - // hide unicode subset listbar for symbol fonts - // TODO: get info from the Font once it provides it - if( pSubsetMap) - delete pSubsetMap; - pSubsetMap = NULL; - - sal_Bool bNeedSubset = (aFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL); - if( bNeedSubset ) - { - FontCharMap aFontCharMap; - aShowSet.GetFontCharMap( aFontCharMap ); - pSubsetMap = new SubsetMap( &aFontCharMap ); - - // update subset listbox for new font's unicode subsets - aSubsetLB.Clear(); - // TODO: is it worth to improve the stupid linear search? - bool bFirst = true; - const Subset* s; - while( NULL != (s = pSubsetMap->GetNextSubset( bFirst )) ) - { - sal_uInt16 nPos_ = aSubsetLB.InsertEntry( s->GetName() ); - aSubsetLB.SetEntryData( nPos_, (void*)s ); - // NOTE: subset must live at least as long as the selected font - if( bFirst ) - aSubsetLB.SelectEntryPos( nPos_ ); - bFirst = false; - } - if( aSubsetLB.GetEntryCount() <= 1 ) - bNeedSubset = sal_False; - } - - aSubsetText.Show( bNeedSubset); - aSubsetLB.Show( bNeedSubset); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, SubsetSelectHdl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aSubsetLB.GetSelectEntryPos(); - const Subset* pSubset = reinterpret_cast (aSubsetLB.GetEntryData(nPos)); - if( pSubset ) - { - sal_UCS4 cFirst = pSubset->GetRangeMin(); - aShowSet.SelectCharacter( cFirst ); - } - aSubsetLB.SelectEntryPos( nPos ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharDoubleClickHdl, Control *, EMPTYARG ) -{ - mpDialog->EndDialog( sal_True ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharSelectHdl, Control *, EMPTYARG ) -{ - if ( !bOne ) - { - String aText = aShowText.GetText(); - - if ( aText.Len() == CHARMAP_MAXLEN ) - Sound::Beep( SOUND_WARNING ); - else - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - // using the new UCS4 constructor - rtl::OUString aOUStr( &cChar, 1 ); - aShowText.SetText( aText + aOUStr ); - } - - } - aOKBtn.Enable(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharHighlightHdl, Control *, EMPTYARG ) -{ - String aText; - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - sal_Bool bSelect = (cChar > 0); - - // show char sample - if ( bSelect ) - { - // using the new UCS4 constructor - aText = rtl::OUString( &cChar, 1 ); - - const Subset* pSubset = NULL; - if( pSubsetMap ) - pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); - if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); - else - aSubsetLB.SetNoSelection(); - } - aShowChar.SetText( aText ); - aShowChar.Update(); - - // show char code - if ( bSelect ) - { - char aBuf[32]; - snprintf( aBuf, sizeof(aBuf), "U+%04X", static_cast(cChar) ); - if( cChar < 0x0100 ) - snprintf( aBuf+6, sizeof(aBuf)-6, " (%u)", static_cast(cChar) ); - aText = String::CreateFromAscii( aBuf ); - } - aCharCodeText.SetText( aText ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, CharPreSelectHdl, Control *, EMPTYARG ) -{ - // adjust subset selection - if( pSubsetMap ) - { - sal_UCS4 cChar = aShowSet.GetSelectCharacter(); - const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar ); - if( pSubset ) - aSubsetLB.SelectEntry( pSubset->GetName() ); - } - - aOKBtn.Enable(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharMapData, DeleteHdl, PushButton *, EMPTYARG ) -{ - aShowText.SetText( String() ); - aOKBtn.Disable(); - return 0; -} - -IMPL_LINK( SvxCharMapData, AssignHdl, PushButton *, EMPTYARG ) -{ - SfxAllItemSet aSet( SfxObjectShell::Current()->GetPool() ); - aSet.Put( SfxStringItem( SID_CHARMAP, String::CreateFromAscii("test") ) ); - SfxModalDialog* pDlg = new SfxMacroAssignDlg( mpDialog, com::sun::star::uno::Reference < com::sun::star::frame::XFrame >(), aSet ); - if ( pDlg && pDlg->Execute() == RET_OK ) - { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pOutSet->GetItemState( SID_CHARMAP, sal_False, &pItem ) ) - { - // show assigned shortcut - } - } - - delete pDlg; - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx deleted file mode 100644 index 4d9c7e772..000000000 --- a/cui/source/dialogs/cuifmsearch.cxx +++ /dev/null @@ -1,963 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "fmsearch.hrc" -#include "cuifmsearch.hxx" -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::i18n; -using namespace ::svxform; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::util; - -#define MAX_HISTORY_ENTRIES 50 - -//------------------------------------------------------------------------ -void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor ) -{ - // init the engine - DBG_ASSERT( m_pSearchEngine, "FmSearchDialog::initCommon: have no engine!" ); - m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress)); - - // some layout changes according to available CJK options - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsJapaneseFindEnabled()) - { - sal_Int32 nUpper = m_cbApprox.GetPosPixel().Y(); - sal_Int32 nDifference = m_aSoundsLikeCJKSettings.GetPosPixel().Y() - nUpper; - - // hide the options for the japanese search - Control* pFieldsToMove[] = { &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint }; - implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flOptions); - - m_aSoundsLikeCJK.Hide(); - m_aSoundsLikeCJKSettings.Hide(); - } - - if (!aCJKOptions.IsCJKFontEnabled()) - { - m_aHalfFullFormsCJK.Hide(); - - // never ignore the width (ignoring is expensive) if the option is not available at all - m_pSearchEngine->SetIgnoreWidthCJK( sal_False ); - } - - // some initial record texts - m_ftRecord.SetText( String::CreateFromInt32( _rxCursor->getRow() ) ); - m_pbClose.SetHelpText(String()); -} - -//------------------------------------------------------------------------ -FmSearchDialog::FmSearchDialog(Window* pParent, const UniString& sInitialText, const ::std::vector< String >& _rContexts, sal_Int16 nInitialContext, - const Link& lnkContextSupplier) - :ModalDialog(pParent, CUI_RES(RID_SVXDLG_SEARCHFORM)) - ,m_flSearchFor (this, CUI_RES(FL_SEARCHFOR)) - ,m_rbSearchForText (this, CUI_RES(RB_SEARCHFORTEXT)) - ,m_rbSearchForNull (this, CUI_RES(RB_SEARCHFORNULL)) - ,m_rbSearchForNotNull (this, CUI_RES(RB_SEARCHFORNOTNULL)) - ,m_cmbSearchText (this, CUI_RES(CMB_SEARCHTEXT)) - ,m_flWhere (this, CUI_RES(FL_WHERE)) - ,m_ftForm (this, CUI_RES(FT_FORM)) - ,m_lbForm (this, CUI_RES(LB_FORM)) - ,m_rbAllFields (this, CUI_RES(RB_ALLFIELDS)) - ,m_rbSingleField (this, CUI_RES(RB_SINGLEFIELD)) - ,m_lbField (this, CUI_RES(LB_FIELD)) - ,m_flOptions (this, CUI_RES(FL_OPTIONS)) - ,m_ftPosition (this, CUI_RES(FT_POSITION)) - ,m_lbPosition (this, CUI_RES(LB_POSITION)) - ,m_cbUseFormat (this, CUI_RES(CB_USEFORMATTER)) - ,m_cbCase (this, CUI_RES(CB_CASE)) - ,m_cbBackwards (this, CUI_RES(CB_BACKWARD)) - ,m_cbStartOver (this, CUI_RES(CB_STARTOVER)) - ,m_cbWildCard (this, CUI_RES(CB_WILDCARD)) - ,m_cbRegular (this, CUI_RES(CB_REGULAR)) - ,m_cbApprox (this, CUI_RES(CB_APPROX)) - ,m_pbApproxSettings (this, CUI_RES(PB_APPROXSETTINGS)) - ,m_aHalfFullFormsCJK (this, CUI_RES(CB_HALFFULLFORMS)) - ,m_aSoundsLikeCJK (this, CUI_RES(CB_SOUNDSLIKECJK)) - ,m_aSoundsLikeCJKSettings (this, CUI_RES(PB_SOUNDSLIKESETTINGS)) - ,m_flState (this, CUI_RES(FL_STATE)) - ,m_ftRecordLabel (this, CUI_RES(FT_RECORDLABEL)) - ,m_ftRecord (this, CUI_RES(FT_RECORD)) - ,m_ftHint (this, CUI_RES(FT_HINT)) - ,m_pbSearchAgain (this, CUI_RES(PB_SEARCH)) - ,m_pbClose (this, CUI_RES(1)) - ,m_pbHelp (this, CUI_RES(1)) - ,m_sSearch ( m_pbSearchAgain.GetText() ) - ,m_sCancel ( Button::GetStandardText( BUTTON_CANCEL ) ) - ,m_pPreSearchFocus( NULL ) - ,m_lnkContextSupplier(lnkContextSupplier) - ,m_pConfig( NULL ) -{ - DBG_ASSERT(m_lnkContextSupplier.IsSet(), "FmSearchDialog::FmSearchDialog : have no ContextSupplier !"); - - // erst mal die Informationen fuer den initialen Kontext - FmSearchContext fmscInitial; - fmscInitial.nContext = nInitialContext; - m_lnkContextSupplier.Call(&fmscInitial); - DBG_ASSERT(fmscInitial.xCursor.is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); - DBG_ASSERT(fmscInitial.strUsedFields.GetTokenCount(';') == (xub_StrLen)fmscInitial.arrFields.size(), - "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplied !"); -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - for (sal_Int32 i=0; i<(sal_Int32)fmscInitial.arrFields.size(); ++i) - DBG_ASSERT(fmscInitial.arrFields.at(i).is(), "FmSearchDialog::FmSearchDialog : invalid data supplied by ContextSupplier !"); -#endif // (OSL_DEBUG_LEVEL > 1) || DBG_UTIL - - for ( ::std::vector< String >::const_iterator context = _rContexts.begin(); - context != _rContexts.end(); - ++context - ) - { - m_arrContextFields.push_back(String()); - m_lbForm.InsertEntry(*context); - } - m_lbForm.SelectEntryPos(nInitialContext); - - m_lbForm.SetSelectHdl(LINK(this, FmSearchDialog, OnContextSelection)); - - if (m_arrContextFields.size() == 1) - { // remove the context selection listbox and rearrange the controls accordingly - sal_Int32 nUpper = m_lbForm.GetPosPixel().Y(); - sal_Int32 nDifference = m_rbAllFields.GetPosPixel().Y() - nUpper; - - // move all controls below the affected ones up - Control* pFieldsToMove[] = { &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition, - &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox, - &m_pbApproxSettings, &m_aHalfFullFormsCJK, &m_aSoundsLikeCJK, &m_aSoundsLikeCJKSettings, - &m_flState, &m_ftRecordLabel, &m_ftRecord, &m_ftHint }; - - implMoveControls(pFieldsToMove, SAL_N_ELEMENTS(pFieldsToMove), nDifference, &m_flWhere); - - Point pt = m_rbAllFields.GetPosPixel(); - pt.X() = m_ftForm.GetPosPixel().X(); - m_rbAllFields.SetPosPixel( pt ); - pt = m_rbSingleField.GetPosPixel(); - pt.X() = m_ftForm.GetPosPixel().X(); - m_rbSingleField.SetPosPixel( pt ); - - // hide dispensable controls - m_ftForm.Hide(); - m_lbForm.Hide(); - } - - m_pSearchEngine = new FmSearchEngine( - ::comphelper::getProcessServiceFactory(), fmscInitial.xCursor, fmscInitial.strUsedFields, fmscInitial.arrFields, SM_ALLOWSCHEDULE ); - initCommon( fmscInitial.xCursor ); - - if (fmscInitial.sFieldDisplayNames.Len() != 0) - { // use the display names if supplied - DBG_ASSERT(fmscInitial.sFieldDisplayNames.GetTokenCount() == fmscInitial.strUsedFields.GetTokenCount(), - "FmSearchDialog::FmSearchDialog : invalid initial context description !"); - Init(fmscInitial.sFieldDisplayNames, sInitialText); - } - else - Init(fmscInitial.strUsedFields, sInitialText); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::implMoveControls( - Control** _ppControls, - sal_Int32 _nControls, - sal_Int32 _nUp, - Control* /*_pToResize*/) -{ - for (sal_Int32 i=0; i<_nControls; ++i) - { - Point pt = _ppControls[i]->GetPosPixel(); - pt.Y() -= _nUp; - _ppControls[i]->SetPosPixel(pt); - } - - // resize myself - Size sz = GetSizePixel(); - sz.Height() -= _nUp; - SetSizePixel(sz); -} - -//------------------------------------------------------------------------ -FmSearchDialog::~FmSearchDialog() -{ - if (m_aDelayedPaint.IsActive()) - m_aDelayedPaint.Stop(); - - SaveParams(); - - if (m_pConfig) - { - delete m_pConfig; - m_pConfig = NULL; - } - - delete m_pSearchEngine; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::Init(const UniString& strVisibleFields, const UniString& sInitialText) -{ - //the initialization of all the Controls - m_rbSearchForText.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSearchForNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSearchForNotNull.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - - m_rbAllFields.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - m_rbSingleField.SetClickHdl(LINK(this, FmSearchDialog, OnClickedFieldRadios)); - - m_pbSearchAgain.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSearchAgain)); - m_pbApproxSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings)); - m_aSoundsLikeCJKSettings.SetClickHdl(LINK(this, FmSearchDialog, OnClickedSpecialSettings)); - - m_lbPosition.SetSelectHdl(LINK(this, FmSearchDialog, OnPositionSelected)); - m_lbField.SetSelectHdl(LINK(this, FmSearchDialog, OnFieldSelected)); - - m_cmbSearchText.SetModifyHdl(LINK(this, FmSearchDialog, OnSearchTextModified)); - m_cmbSearchText.EnableAutocomplete(sal_False); - - m_cbUseFormat.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbBackwards.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbStartOver.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbCase.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbWildCard.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbRegular.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_cbApprox.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_aHalfFullFormsCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - m_aSoundsLikeCJK.SetToggleHdl(LINK(this, FmSearchDialog, OnCheckBoxToggled)); - - // fill the listboxes - // method of field comparison - sal_uInt16 nResIds[] = { - RID_STR_SEARCH_ANYWHERE, - RID_STR_SEARCH_BEGINNING, - RID_STR_SEARCH_END, - RID_STR_SEARCH_WHOLE - }; - for ( size_t i=0; iRebuildUsedFields(m_lbField.GetSelectEntryPos()); - } - else - { - m_lbField.Disable(); - m_pSearchEngine->RebuildUsedFields(-1); - } - - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnClickedSearchAgain, Button*, EMPTYARG) -{ - if (m_pbClose.IsEnabled()) - { // der Button hat die Funktion 'Suchen' - UniString strThisRoundText = m_cmbSearchText.GetText(); - // zur History dazu - m_cmbSearchText.RemoveEntry(strThisRoundText); - m_cmbSearchText.InsertEntry(strThisRoundText, 0); - // das Remove/Insert stellt a) sicher, dass der UniString nicht zweimal auftaucht, b), dass die zuletzt gesuchten Strings am - // Anfang stehen - // und die Listenlaenge beschraenken - while (m_cmbSearchText.GetEntryCount() > MAX_HISTORY_ENTRIES) - m_cmbSearchText.RemoveEntry(m_cmbSearchText.GetEntryCount()-1); - - // den 'Ueberlauf'-Hint rausnehmen - m_ftHint.SetText(UniString()); - m_ftHint.Invalidate(); - - if (m_cbStartOver.IsChecked()) - { - m_cbStartOver.Check(sal_False); - EnableSearchUI(sal_False); - if (m_rbSearchForText.IsChecked()) - m_pSearchEngine->StartOver(strThisRoundText); - else - m_pSearchEngine->StartOverSpecial(m_rbSearchForNull.IsChecked()); - } - else - { - EnableSearchUI(sal_False); - if (m_rbSearchForText.IsChecked()) - m_pSearchEngine->SearchNext(strThisRoundText); - else - m_pSearchEngine->SearchNextSpecial(m_rbSearchForNull.IsChecked()); - } - } - else - { // der Button hat die Fukntion 'Abbrechen' - DBG_ASSERT(m_pSearchEngine->GetSearchMode() != SM_BRUTE, "FmSearchDialog, OnClickedSearchAgain : falscher Modus !"); - // der CancelButton wird normalerweise nur disabled, wenn ich in einem Thread oder mit Reschedule arbeite - m_pSearchEngine->CancelSearch(); - // mein ProgressHandler wird gerufen, wenn es wirklich zu Ende ist, das hier war nur eine Anforderung - } - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnClickedSpecialSettings, Button*, pButton ) -{ - if (&m_pbApproxSettings == pButton) - { - AbstractSvxSearchSimilarityDialog* pDlg = NULL; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - pDlg = pFact->CreateSvxSearchSimilarityDialog( this, m_pSearchEngine->GetLevRelaxed(), m_pSearchEngine->GetLevOther(), - m_pSearchEngine->GetLevShorter(), m_pSearchEngine->GetLevLonger() ); - DBG_ASSERT( pDlg, "FmSearchDialog, OnClickedSpecialSettings: could not load the dialog!" ); - - if ( pDlg && pDlg->Execute() == RET_OK ) - { - m_pSearchEngine->SetLevRelaxed( pDlg->IsRelaxed() ); - m_pSearchEngine->SetLevOther( pDlg->GetOther() ); - m_pSearchEngine->SetLevShorter(pDlg->GetShorter() ); - m_pSearchEngine->SetLevLonger( pDlg->GetLonger() ); - } - delete pDlg; - } - else if (&m_aSoundsLikeCJKSettings == pButton) - { - SfxItemSet aSet( SFX_APP()->GetPool() ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( this, aSet, m_pSearchEngine->GetTransliterationFlags() ); - DBG_ASSERT(aDlg, "Dialogdiet fail!"); - aDlg->Execute(); - - - sal_Int32 nFlags = aDlg->GetTransliterationFlags(); - m_pSearchEngine->SetTransliterationFlags(nFlags); - - m_cbCase.Check(m_pSearchEngine->GetCaseSensitive()); - OnCheckBoxToggled( &m_cbCase ); - m_aHalfFullFormsCJK.Check( !m_pSearchEngine->GetIgnoreWidthCJK() ); - OnCheckBoxToggled( &m_aHalfFullFormsCJK ); - delete aDlg; - } - } - - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnSearchTextModified, ComboBox*, EMPTYARG) -{ - if ((m_cmbSearchText.GetText().Len() != 0) || !m_rbSearchForText.IsChecked()) - m_pbSearchAgain.Enable(); - else - m_pbSearchAgain.Disable(); - - m_pSearchEngine->InvalidatePreviousLoc(); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnPositionSelected, ListBox*, pBox) -{ - (void) pBox; // avoid warning - DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnMethodSelected : unerwartet : nicht genau ein Eintrag selektiert !"); - - m_pSearchEngine->SetPosition(m_lbPosition.GetSelectEntryPos()); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnFieldSelected, ListBox*, pBox) -{ - (void) pBox; // avoid warning - DBG_ASSERT(pBox->GetSelectEntryCount() == 1, "FmSearchDialog::OnFieldSelected : unerwartet : nicht genau ein Eintrag selektiert !"); - - m_pSearchEngine->RebuildUsedFields(m_rbAllFields.IsChecked() ? -1 : (sal_Int16)m_lbField.GetSelectEntryPos()); - // ruft auch m_pSearchEngine->InvalidatePreviousLoc auf - - sal_Int32 nCurrentContext = m_lbForm.GetSelectEntryPos(); - if (nCurrentContext != LISTBOX_ENTRY_NOTFOUND) - m_arrContextFields[nCurrentContext] = UniString(m_lbField.GetSelectEntry()); - return 0; -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, CheckBox*, pBox) -{ - sal_Bool bChecked = pBox->IsChecked(); - - // Formatter oder case -> an die Engine weiterreichen - if (pBox == &m_cbUseFormat) - m_pSearchEngine->SetFormatterUsing(bChecked); - else if (pBox == &m_cbCase) - m_pSearchEngine->SetCaseSensitive(bChecked); - // Richtung -> weiterreichen und Checkbox-Text fuer StartOver neu setzen - else if (pBox == &m_cbBackwards) - { - m_cbStartOver.SetText( String( CUI_RES( bChecked ? RID_STR_FROM_BOTTOM : RID_STR_FROM_TOP ) ) ); - m_pSearchEngine->SetDirection(!bChecked); - } - // Aehnlichkeitssuche oder regulaerer Ausdruck - else if ((pBox == &m_cbApprox) || (pBox == &m_cbRegular) || (pBox == &m_cbWildCard)) - { - // die beiden jeweils anderen Boxes disablen oder enablen - CheckBox* pBoxes[] = { &m_cbWildCard, &m_cbRegular, &m_cbApprox }; - for (sal_uInt32 i=0; i< SAL_N_ELEMENTS(pBoxes); ++i) - { - if (pBoxes[i] != pBox) - { - if (bChecked) - pBoxes[i]->Disable(); - else - pBoxes[i]->Enable(); - } - } - - // an die Engine weiterreichen - m_pSearchEngine->SetWildcard(m_cbWildCard.IsEnabled() ? m_cbWildCard.IsChecked() : sal_False); - m_pSearchEngine->SetRegular(m_cbRegular.IsEnabled() ? m_cbRegular.IsChecked() : sal_False); - m_pSearchEngine->SetLevenshtein(m_cbApprox.IsEnabled() ? m_cbApprox.IsChecked() : sal_False); - // (Boxes, die disabled sind, muessen als sal_False an die Engine gehen) - - // die Position-Listbox anpassen (ist bei Wildcard-Suche nicht erlaubt) - if (pBox == &m_cbWildCard) - { - if (bChecked) - { - m_ftPosition.Disable(); - m_lbPosition.Disable(); - } - else - { - m_ftPosition.Enable(); - m_lbPosition.Enable(); - } - } - - // und den Button fuer die Aehnlichkeitssuche - if (pBox == &m_cbApprox) - { - if (bChecked) - m_pbApproxSettings.Enable(); - else - m_pbApproxSettings.Disable(); - } - } - else if (pBox == &m_aHalfFullFormsCJK) - { - // forward to the search engine - m_pSearchEngine->SetIgnoreWidthCJK( !bChecked ); - } - else if (pBox == &m_aSoundsLikeCJK) - { - m_aSoundsLikeCJKSettings.Enable(bChecked); - - // two other buttons which depend on this one - sal_Bool bEnable = ( m_rbSearchForText.IsChecked() - && !m_aSoundsLikeCJK.IsChecked() - ) - || !SvtCJKOptions().IsJapaneseFindEnabled(); - m_cbCase.Enable(bEnable); - m_aHalfFullFormsCJK.Enable(bEnable); - - // forward to the search engine - m_pSearchEngine->SetTransliteration( bChecked ); - } - - return 0; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::InitContext(sal_Int16 nContext) -{ - FmSearchContext fmscContext; - fmscContext.nContext = nContext; - -#ifdef DBG_UTIL - sal_uInt32 nResult = -#endif - m_lnkContextSupplier.Call(&fmscContext); - DBG_ASSERT(nResult > 0, "FmSearchDialog::InitContext : ContextSupplier didn't give me any controls !"); - - // packen wir zuerst die Feld-Namen in die entsprechende Listbox - m_lbField.Clear(); - - if (fmscContext.sFieldDisplayNames.Len() != 0) - { - // use the display names if supplied - DBG_ASSERT(fmscContext.sFieldDisplayNames.GetTokenCount() == fmscContext.strUsedFields.GetTokenCount(), - "FmSearchDialog::InitContext : invalid context description supplied !"); - for (xub_StrLen i=0; i 1)) - m_lbField.GrabFocus(); - } - - // dann geben wir der Engine Bescheid - m_pSearchEngine->SwitchToContext(fmscContext.xCursor, fmscContext.strUsedFields, fmscContext.arrFields, - m_rbAllFields.IsChecked() ? -1 : 0); - - // und die Position des neuen Cursors anzeigen - m_ftRecord.SetText(String::CreateFromInt32(fmscContext.xCursor->getRow())); -} - -//------------------------------------------------------------------------ -IMPL_LINK( FmSearchDialog, OnContextSelection, ListBox*, pBox) -{ - InitContext(pBox->GetSelectEntryPos()); - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableSearchUI(sal_Bool bEnable) -{ - // wenn die Controls disabled werden sollen, schalte ich mal eben kurz ihr Paint aus und verzoegert wieder an - if (!bEnable) - EnableControlPaint(sal_False); - else - { // beim Enablen teste ich, ob der Timer fuer das delayed paint aktiv ist und stoppe ihn wenn noetig - if (m_aDelayedPaint.IsActive()) - m_aDelayedPaint.Stop(); - } - // (das ganze geht unten noch weiter) - // diese kleine Verrenkung fuehrt hoffentlich dazu, dass es nicht flackert, wenn man die SearchUI schnell hintereinander - // aus- und wieder einschaltet (wie das bei einem kurzen Suchvorgang zwangslaeufig der Fall ist) - - if ( !bEnable ) - { - // if one of my children has the focus, remember it - Window* pFocusWindow = Application::GetFocusWindow( ); - if ( pFocusWindow && IsChild( pFocusWindow ) ) - m_pPreSearchFocus = pFocusWindow; - else - m_pPreSearchFocus = NULL; - } - - // der Suchen-Button hat einen Doppelfunktion, seinen Text entsprechend anpassen - String sButtonText( bEnable ? m_sSearch : m_sCancel ); - m_pbSearchAgain.SetText( sButtonText ); - - // jetzt Controls en- oder disablen - if (m_pSearchEngine->GetSearchMode() != SM_BRUTE) - { - m_flSearchFor.Enable (bEnable); - m_rbSearchForText.Enable (bEnable); - m_rbSearchForNull.Enable (bEnable); - m_rbSearchForNotNull.Enable (bEnable); - m_flWhere.Enable (bEnable); - m_ftForm.Enable (bEnable); - m_lbForm.Enable (bEnable); - m_rbAllFields.Enable (bEnable); - m_rbSingleField.Enable (bEnable); - m_lbField.Enable (bEnable && m_rbSingleField.IsChecked()); - m_flOptions.Enable (bEnable); - m_cbBackwards.Enable (bEnable); - m_cbStartOver.Enable (bEnable); - m_pbClose.Enable (bEnable); - EnableSearchForDependees (bEnable); - - if ( !bEnable ) - { // this means we're preparing for starting a search - // In this case, EnableSearchForDependees disabled the search button - // But as we're about to use it for cancelling the search, we really need to enable it, again - m_pbSearchAgain.Enable( sal_True ); - } - } - - // und den Rest fuer das delayed paint - if (!bEnable) - m_aDelayedPaint.Start(); - else - EnableControlPaint(sal_True); - - if ( bEnable ) - { // restore focus - if ( m_pPreSearchFocus ) - { - m_pPreSearchFocus->GrabFocus(); - if ( WINDOW_EDIT == m_pPreSearchFocus->GetType() ) - { - Edit* pEdit = static_cast< Edit* >( m_pPreSearchFocus ); - pEdit->SetSelection( Selection( 0, pEdit->GetText().Len() ) ); - } - } - m_pPreSearchFocus = NULL; - } - -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableSearchForDependees(sal_Bool bEnable) -{ - sal_Bool bSearchingForText = m_rbSearchForText.IsChecked(); - m_pbSearchAgain.Enable(bEnable && (!bSearchingForText || (m_cmbSearchText.GetText().Len() != 0))); - - bEnable = bEnable && bSearchingForText; - - sal_Bool bEnableRedundants = !m_aSoundsLikeCJK.IsChecked() || !SvtCJKOptions().IsJapaneseFindEnabled(); - - m_cmbSearchText.Enable (bEnable); - m_ftPosition.Enable (bEnable && !m_cbWildCard.IsChecked()); - m_cbWildCard.Enable (bEnable && !m_cbRegular.IsChecked() && !m_cbApprox.IsChecked()); - m_cbRegular.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbApprox.IsChecked()); - m_cbApprox.Enable (bEnable && !m_cbWildCard.IsChecked() && !m_cbRegular.IsChecked()); - m_pbApproxSettings.Enable (bEnable && m_cbApprox.IsChecked()); - m_aHalfFullFormsCJK.Enable (bEnable && bEnableRedundants); - m_aSoundsLikeCJK.Enable (bEnable); - m_aSoundsLikeCJKSettings.Enable (bEnable && m_aSoundsLikeCJK.IsChecked()); - m_lbPosition.Enable (bEnable && !m_cbWildCard.IsChecked()); - m_cbUseFormat.Enable (bEnable); - m_cbCase.Enable (bEnable && bEnableRedundants); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::EnableControlPaint(sal_Bool bEnable) -{ - Control* pAffectedControls[] = { &m_flSearchFor, &m_rbSearchForText, &m_cmbSearchText, &m_rbSearchForNull, &m_rbSearchForNotNull, - &m_rbSearchForText, &m_flWhere, &m_rbAllFields, &m_rbSingleField, &m_lbField, &m_flOptions, &m_ftPosition, &m_lbPosition, - &m_cbUseFormat, &m_cbCase, &m_cbBackwards, &m_cbStartOver, &m_cbWildCard, &m_cbRegular, &m_cbApprox, &m_pbApproxSettings, - &m_pbSearchAgain, &m_pbClose }; - - if (!bEnable) - for (sal_uInt32 i=0; iSetUpdateMode(bEnable); - pAffectedControls[i]->EnablePaint(bEnable); - } - else - for (sal_uInt32 i=0; iEnablePaint(bEnable); - pAffectedControls[i]->SetUpdateMode(bEnable); - } -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnDelayedPaint, void*, EMPTYARG) -{ - EnableControlPaint(sal_True); - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos) -{ - FmFoundRecordInformation friInfo; - friInfo.nContext = m_lbForm.GetSelectEntryPos(); - // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal - friInfo.aPosition = aCursorPos; - if (m_rbAllFields.IsChecked()) - friInfo.nFieldPos = nFieldPos; - else - friInfo.nFieldPos = m_lbField.GetSelectEntryPos(); - // das setzt natuerlich voraus, dass ich wirklich in dem Feld gesucht habe, dass in der Listbox ausgewaehlt ist, - // genau das wird auch in RebuildUsedFields sichergestellt - - // dem Handler Bescheid sagen - m_lnkFoundHandler.Call(&friInfo); - - // und wieder Focus auf mich - m_cmbSearchText.GrabFocus(); -} - -//------------------------------------------------------------------------ -IMPL_LINK(FmSearchDialog, OnSearchProgress, FmSearchProgress*, pProgress) -{ - SolarMutexGuard aGuard; - // diese eine Methode Thread-sicher machen (das ist ein Overkill, die ganze restliche Applikation dafuer zu blockieren, - // aber im Augenblick haben wir kein anderes Sicherheitskonpzept) - - switch (pProgress->aSearchState) - { - case FmSearchProgress::STATE_PROGRESS: - if (pProgress->bOverflow) - { - String sHint( CUI_RES( m_cbBackwards.IsChecked() ? RID_STR_OVERFLOW_BACKWARD : RID_STR_OVERFLOW_FORWARD ) ); - m_ftHint.SetText( sHint ); - m_ftHint.Invalidate(); - } - - m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord)); - m_ftRecord.Invalidate(); - break; - - case FmSearchProgress::STATE_PROGRESS_COUNTING: - m_ftHint.SetText(CUI_RESSTR(RID_STR_SEARCH_COUNTING)); - m_ftHint.Invalidate(); - - m_ftRecord.SetText(String::CreateFromInt32(pProgress->nCurrentRecord)); - m_ftRecord.Invalidate(); - break; - - case FmSearchProgress::STATE_SUCCESSFULL: - OnFound(pProgress->aBookmark, (sal_Int16)pProgress->nFieldIndex); - EnableSearchUI(sal_True); - break; - - case FmSearchProgress::STATE_ERROR: - case FmSearchProgress::STATE_NOTHINGFOUND: - { - sal_uInt16 nErrorId = (FmSearchProgress::STATE_ERROR == pProgress->aSearchState) - ? RID_SVXERR_SEARCH_GENERAL_ERROR - : RID_SVXERR_SEARCH_NORECORD; - ErrorBox(this, CUI_RES(nErrorId)).Execute(); - } - // NO break ! - case FmSearchProgress::STATE_CANCELED: - EnableSearchUI(sal_True); - if (m_lnkCanceledNotFoundHdl.IsSet()) - { - FmFoundRecordInformation friInfo; - friInfo.nContext = m_lbForm.GetSelectEntryPos(); - // wenn ich keine Suche in Kontexten mache, steht hier was ungueltiges drin, aber dann ist es auch egal - friInfo.aPosition = pProgress->aBookmark; - m_lnkCanceledNotFoundHdl.Call(&friInfo); - } - break; - } - - m_ftRecord.SetText(String::CreateFromInt32(1 + pProgress->nCurrentRecord)); - - return 0L; -} - -//------------------------------------------------------------------------ -void FmSearchDialog::LoadParams() -{ - FmSearchParams aParams(m_pConfig->getParams()); - - const ::rtl::OUString* pHistory = aParams.aHistory.getConstArray(); - const ::rtl::OUString* pHistoryEnd = pHistory + aParams.aHistory.getLength(); - for (; pHistory != pHistoryEnd; ++pHistory) - m_cmbSearchText.InsertEntry( *pHistory ); - - // die Einstellungen nehme ich an meinen UI-Elementen vor und rufe dann einfach den entsprechenden Change-Handler auf, - // dadurch werden die Daten an die SearchEngine weitergereicht und alle abhaengigen Enstellungen vorgenommen - - // aktuelles Feld - sal_uInt16 nInitialField = m_lbField.GetEntryPos( String( aParams.sSingleSearchField ) ); - if (nInitialField == COMBOBOX_ENTRY_NOTFOUND) - nInitialField = 0; - m_lbField.SelectEntryPos(nInitialField); - LINK(this, FmSearchDialog, OnFieldSelected).Call(&m_lbField); - // alle/einzelnes Feld (NACH dem Selektieren des Feldes, da OnClickedFieldRadios dort einen gueltigen Eintrag erwartet) - if (aParams.bAllFields) - { - m_rbSingleField.Check(sal_False); - m_rbAllFields.Check(sal_True); - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbAllFields); - // OnClickedFieldRadios ruft auch um RebuildUsedFields - } - else - { - m_rbAllFields.Check(sal_False); - m_rbSingleField.Check(sal_True); - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSingleField); - } - - // Position im Feld - m_lbPosition.SelectEntryPos(aParams.nPosition); - LINK(this, FmSearchDialog, OnPositionSelected).Call(&m_lbPosition); - - // Feld-Formatierung/Case-Sensitivitaet/Richtung - m_cbUseFormat.Check(aParams.bUseFormatter); - m_cbCase.Check( aParams.isCaseSensitive() ); - m_cbBackwards.Check(aParams.bBackwards); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbUseFormat); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbCase); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbBackwards); - - m_aHalfFullFormsCJK.Check( !aParams.isIgnoreWidthCJK( ) ); // BEWARE: this checkbox has a inverse semantics! - m_aSoundsLikeCJK.Check( aParams.bSoundsLikeCJK ); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aHalfFullFormsCJK); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_aSoundsLikeCJK); - - // die drei Checkboxen fuer spezielle Sucharten - // erst mal alle ruecksetzen - m_cbWildCard.Check(sal_False); - m_cbRegular.Check(sal_False); - m_cbApprox.Check(sal_False); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbWildCard); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbRegular); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(&m_cbApprox); - - // dann die richtige setzen - CheckBox* pToCheck = NULL; - if (aParams.bWildcard) - pToCheck = &m_cbWildCard; - if (aParams.bRegular) - pToCheck = &m_cbRegular; - if (aParams.bApproxSearch) - pToCheck = &m_cbApprox; - if (aParams.bSoundsLikeCJK) - pToCheck = &m_aSoundsLikeCJK; - if (pToCheck) - { - pToCheck->Check(sal_True); - LINK(this, FmSearchDialog, OnCheckBoxToggled).Call(pToCheck); - } - - // die Levenshtein-Parameter direkt an der SearchEngine setzen - m_pSearchEngine->SetLevRelaxed(aParams.bLevRelaxed); - m_pSearchEngine->SetLevOther(aParams.nLevOther); - m_pSearchEngine->SetLevShorter(aParams.nLevShorter); - m_pSearchEngine->SetLevLonger(aParams.nLevLonger); - - m_pSearchEngine->SetTransliterationFlags( aParams.getTransliterationFlags( ) ); - - m_rbSearchForText.Check(sal_False); - m_rbSearchForNull.Check(sal_False); - m_rbSearchForNotNull.Check(sal_False); - switch (aParams.nSearchForType) - { - case 1: m_rbSearchForNull.Check(sal_True); break; - case 2: m_rbSearchForNotNull.Check(sal_True); break; - default: m_rbSearchForText.Check(sal_True); break; - } - LINK(this, FmSearchDialog, OnClickedFieldRadios).Call(&m_rbSearchForText); -} - -//------------------------------------------------------------------------ -void FmSearchDialog::SaveParams() const -{ - if (!m_pConfig) - return; - - FmSearchParams aCurrentSettings; - - aCurrentSettings.aHistory.realloc( m_cmbSearchText.GetEntryCount() ); - ::rtl::OUString* pHistory = aCurrentSettings.aHistory.getArray(); - for (sal_uInt16 i=0; iGetPosition(); - aCurrentSettings.bUseFormatter = m_pSearchEngine->GetFormatterUsing(); - aCurrentSettings.setCaseSensitive ( m_pSearchEngine->GetCaseSensitive() ); - aCurrentSettings.bBackwards = !m_pSearchEngine->GetDirection(); - aCurrentSettings.bWildcard = m_pSearchEngine->GetWildcard(); - aCurrentSettings.bRegular = m_pSearchEngine->GetRegular(); - aCurrentSettings.bApproxSearch = m_pSearchEngine->GetLevenshtein(); - aCurrentSettings.bLevRelaxed = m_pSearchEngine->GetLevRelaxed(); - aCurrentSettings.nLevOther = m_pSearchEngine->GetLevOther(); - aCurrentSettings.nLevShorter = m_pSearchEngine->GetLevShorter(); - aCurrentSettings.nLevLonger = m_pSearchEngine->GetLevLonger(); - - aCurrentSettings.bSoundsLikeCJK = m_pSearchEngine->GetTransliteration(); - aCurrentSettings.setTransliterationFlags ( m_pSearchEngine->GetTransliterationFlags() ); - - if (m_rbSearchForNull.IsChecked()) - aCurrentSettings.nSearchForType = 1; - else if (m_rbSearchForNotNull.IsChecked()) - aCurrentSettings.nSearchForType = 2; - else - aCurrentSettings.nSearchForType = 0; - - m_pConfig->setParams( aCurrentSettings ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx deleted file mode 100644 index c09912899..000000000 --- a/cui/source/dialogs/cuigaldlg.cxx +++ /dev/null @@ -1,1300 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuigaldlg.hxx" -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dialmgr.hxx" -#include "gallery.hrc" -#include -#include - - -// -------------- -// - Namespaces - -// -------------- - -using namespace ::ucbhelper; -using namespace ::rtl; -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - - -// ----------- -// - Defines - -// ----------- - -#define MAXPATH 1024 - -// ---------------- -// - SearchThread - -// ---------------- - -SearchThread::SearchThread( SearchProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - const INetURLObject& rStartURL ) : - mpProgress ( pProgess ), - mpBrowser ( pBrowser ), - maStartURL ( rStartURL ) -{ -} - -// ------------------------------------------------------------------------ - -SearchThread::~SearchThread() -{ -} - -// ------------------------------------------------------------------------ - -void SAL_CALL SearchThread::run() -{ - const String aFileType( mpBrowser->aCbbFileType.GetText() ); - - if( aFileType.Len() ) - { - const sal_uInt16 nFileNumber = mpBrowser->aCbbFileType.GetEntryPos( aFileType ); - sal_uInt16 nBeginFormat, nEndFormat; - ::std::vector< String > aFormats; - - if( !nFileNumber || ( nFileNumber >= mpBrowser->aCbbFileType.GetEntryCount() ) ) - { - nBeginFormat = 1; - nEndFormat = mpBrowser->aCbbFileType.GetEntryCount() - 1; - } - else - nBeginFormat = nEndFormat = nFileNumber; - - for( sal_uInt16 i = nBeginFormat; i <= nEndFormat; ++i ) - aFormats.push_back( mpBrowser->aFilterEntryList[ i ]->aFilterName.ToLowerAscii() ); - - ImplSearch( maStartURL, aFormats, mpBrowser->bSearchRecursive ); - } -} - -// ------------------------------------------------------------------------ - -void SAL_CALL SearchThread::onTerminated() -{ - Application::PostUserEvent( LINK( mpProgress, SearchProgress, CleanUpHdl ) ); -} - -// ------------------------------------------------------------------------ - -void SearchThread::ImplSearch( const INetURLObject& rStartURL, - const ::std::vector< String >& rFormats, - sal_Bool bRecursive ) -{ - { - SolarMutexGuard aGuard; - - mpProgress->SetDirectory( rStartURL ); - mpProgress->Sync(); - } - - try - { - ::com::sun::star::uno::Reference< XCommandEnvironment > xEnv; - Content aCnt( rStartURL.GetMainURL( INetURLObject::NO_DECODE ), xEnv ); - Sequence< OUString > aProps( 2 ); - - aProps.getArray()[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( "IsFolder" )); - aProps.getArray()[ 1 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( "IsDocument" )); - ::com::sun::star::uno::Reference< XResultSet > xResultSet( - aCnt.createCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS ) ); - - if( xResultSet.is() ) - { - ::com::sun::star::uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY_THROW ); - ::com::sun::star::uno::Reference< XRow > xRow( xResultSet, UNO_QUERY_THROW ); - - while( xResultSet->next() && schedule() ) - { - INetURLObject aFoundURL( xContentAccess->queryContentIdentifierString() ); - DBG_ASSERT( aFoundURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - sal_Bool bFolder = xRow->getBoolean( 1 ); // property "IsFolder" - if ( xRow->wasNull() ) - bFolder = sal_False; - - if( bRecursive && bFolder ) - ImplSearch( aFoundURL, rFormats, sal_True ); - else - { - sal_Bool bDocument = xRow->getBoolean( 2 ); // property "IsDocument" - if ( xRow->wasNull() ) - bDocument = sal_False; - - if( bDocument ) - { - GraphicDescriptor aDesc( aFoundURL ); - String aFileName; - - if( ( aDesc.Detect() && - ::std::find( rFormats.begin(), - rFormats.end(), - aDesc.GetImportFormatShortName( - aDesc.GetFileFormat() ).ToLowerAscii() ) - != rFormats.end() ) || - ::std::find( rFormats.begin(), - rFormats.end(), - String(aFoundURL.GetExtension().toAsciiLowerCase()) ) - != rFormats.end() ) - { - SolarMutexGuard aGuard; - - mpBrowser->aFoundList.push_back( - new String( aFoundURL.GetMainURL( INetURLObject::NO_DECODE ) ) - ); - mpBrowser->aLbxFound.InsertEntry( - GetReducedString( aFoundURL, 50 ), - (sal_uInt16) mpBrowser->aFoundList.size() - 1 ); - } - } - } - } - } - } - catch (const ContentCreationException&) - { - } - catch (const ::com::sun::star::uno::RuntimeException&) - { - } - catch (const ::com::sun::star::uno::Exception&) - { - } -} - -// ------------------ -// - SearchProgress - -// ------------------ - -SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL ) : - ModalDialog ( pParent, CUI_RES(RID_SVXDLG_GALLERY_SEARCH_PROGRESS ) ), - aFtSearchDir ( this, CUI_RES( FT_SEARCH_DIR ) ), - aFLSearchDir ( this, CUI_RES( FL_SEARCH_DIR ) ), - aFtSearchType ( this, CUI_RES( FT_SEARCH_TYPE ) ), - aFLSearchType ( this, CUI_RES( FL_SEARCH_TYPE ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maSearchThread ( this, (TPGalleryThemeProperties*) pParent, rStartURL ) -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, SearchProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - -void SearchProgress::Terminate() -{ - maSearchThread.terminate(); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( SearchProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - Terminate(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( SearchProgress, CleanUpHdl, void*, EMPTYARG ) -{ - EndDialog( RET_OK ); - delete this; - return 0L; -} - -// ------------------------------------------------------------------------ - -short SearchProgress::Execute() -{ - OSL_FAIL( "SearchProgress cannot be executed via Dialog::Execute!\n" - "It creates a thread that will call back to VCL apartment => deadlock!\n" - "Use Dialog::StartExecuteModal to execute the dialog!" ); - return RET_CANCEL; -} - -// ------------------------------------------------------------------------ - -void SearchProgress::StartExecuteModal( const Link& rEndDialogHdl ) -{ - maSearchThread.create(); - ModalDialog::StartExecuteModal( rEndDialogHdl ); -} - -// -------------- -// - TakeThread - -// -------------- - -TakeThread::TakeThread( - TakeProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - TokenList_impl& rTakenList -) : - mpProgress ( pProgess ), - mpBrowser ( pBrowser ), - mrTakenList ( rTakenList ) -{ -} - -// ------------------------------------------------------------------------ - -TakeThread::~TakeThread() -{ -} - -// ------------------------------------------------------------------------ - -void SAL_CALL TakeThread::run() -{ - String aName; - INetURLObject aURL; - sal_uInt16 nEntries; - GalleryTheme* pThm = mpBrowser->GetXChgData()->pTheme; - sal_uInt16 nPos; - GalleryProgress* pStatusProgress; - - { - SolarMutexGuard aGuard; - pStatusProgress = new GalleryProgress; - nEntries = mpBrowser->bTakeAll ? mpBrowser->aLbxFound.GetEntryCount() : mpBrowser->aLbxFound.GetSelectEntryCount(); - pThm->LockBroadcaster(); - } - - for( sal_uInt16 i = 0; i < nEntries && schedule(); i++ ) - { - // kompletten Filenamen aus FoundList holen - if( mpBrowser->bTakeAll ) - aURL = INetURLObject( *mpBrowser->aFoundList[ nPos = i ] ); - else - aURL = INetURLObject(*mpBrowser->aFoundList[ nPos = mpBrowser->aLbxFound.GetSelectEntryPos( i ) ]); - - // Position in Taken-Liste uebernehmen - mrTakenList.push_back( (sal_uLong)nPos ); - - { - SolarMutexGuard aGuard; - - mpProgress->SetFile( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - pStatusProgress->Update( i, nEntries - 1 ); - mpProgress->Sync(); - pThm->InsertURL( aURL ); - } - } - - { - SolarMutexGuard aGuard; - - pThm->UnlockBroadcaster(); - delete pStatusProgress; - } -} - -// ------------------------------------------------------------------------ - -void SAL_CALL TakeThread::onTerminated() -{ - Application::PostUserEvent( LINK( mpProgress, TakeProgress, CleanUpHdl ) ); -} - -// ---------------- -// - TakeProgress - -// ---------------- - -TakeProgress::TakeProgress( Window* pWindow ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_GALLERY_TAKE_PROGRESS ) ), - aFtTakeFile ( this, CUI_RES( FT_TAKE_FILE ) ), - aFLTakeProgress( this, CUI_RES( FL_TAKE_PROGRESS ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maTakeThread ( this, (TPGalleryThemeProperties*) pWindow, maTakenList ) - -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, TakeProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - - -void TakeProgress::Terminate() -{ - maTakeThread.terminate(); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TakeProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - Terminate(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TakeProgress, CleanUpHdl, void*, EMPTYARG ) -{ - TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent(); - ::std::vector > aRemoveEntries( mpBrowser->aFoundList.size(), false ); - ::std::vector< String > aRemainingVector; - sal_uInt32 i, nCount; - - GetParent()->EnterWait(); - mpBrowser->aLbxFound.SetUpdateMode( sal_False ); - mpBrowser->aLbxFound.SetNoSelection(); - - // mark all taken positions in aRemoveEntries - for( i = 0, nCount = maTakenList.size(); i < nCount; ++i ) - aRemoveEntries[ maTakenList[ i ] ] = true; - maTakenList.clear(); - - // refill found list - for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) - if( !aRemoveEntries[ i ] ) - aRemainingVector.push_back( *mpBrowser->aFoundList[ i ] ); - - for ( i = 0, nCount = mpBrowser->aFoundList.size(); i < nCount; ++i ) - delete mpBrowser->aFoundList[ i ]; - mpBrowser->aFoundList.clear(); - - for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i ) - mpBrowser->aFoundList.push_back( new String( aRemainingVector[ i ] ) ); - - aRemainingVector.clear(); - - // refill list box - for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i ) - if( !aRemoveEntries[ i ] ) - aRemainingVector.push_back( mpBrowser->aLbxFound.GetEntry( (sal_uInt16) i ) ); - - mpBrowser->aLbxFound.Clear(); - - for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i ) - mpBrowser->aLbxFound.InsertEntry( aRemainingVector[ i ] ); - - aRemainingVector.clear(); - - mpBrowser->aLbxFound.SetUpdateMode( sal_True ); - mpBrowser->SelectFoundHdl( NULL ); - GetParent()->LeaveWait(); - - EndDialog( RET_OK ); - delete this; - return 0L; -} - -// ------------------------------------------------------------------------ - -short TakeProgress::Execute() -{ - OSL_FAIL( "TakeProgress cannot be executed via Dialog::Execute!\n" - "It creates a thread that will call back to VCL apartment => deadlock!\n" - "Use Dialog::StartExecuteModal to execute the dialog!" ); - return RET_CANCEL; -} - -// ------------------------------------------------------------------------ - -void TakeProgress::StartExecuteModal( const Link& rEndDialogHdl ) -{ - maTakeThread.create(); - ModalDialog::StartExecuteModal( rEndDialogHdl ); -} - -// --------------------- -// - ActualizeProgress - -// --------------------- - -ActualizeProgress::ActualizeProgress( Window* pWindow, GalleryTheme* pThm ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS ) ), - aFtActualizeFile ( this, CUI_RES( FT_ACTUALIZE_FILE ) ), - aFLActualizeProgress ( this, CUI_RES( FL_ACTUALIZE_PROGRESS ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - pTheme ( pThm ) -{ - FreeResource(); - aBtnCancel.SetClickHdl( LINK( this, ActualizeProgress, ClickCancelBtn ) ); -} - -// ------------------------------------------------------------------------ - -short ActualizeProgress::Execute() -{ - short nRet; - - pTimer = new Timer; - - if ( pTimer ) - { - pTimer->SetTimeoutHdl( LINK( this, ActualizeProgress, TimeoutHdl ) ); - pTimer->SetTimeout( 500 ); - pTimer->Start(); - } - - nRet = ModalDialog::Execute(); - - return nRet; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, ClickCancelBtn, void*, EMPTYARG ) -{ - pTheme->AbortActualize(); - EndDialog( RET_OK ); - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, TimeoutHdl, Timer*, _pTimer ) -{ - if ( _pTimer ) - { - _pTimer->Stop(); - delete _pTimer; - } - - pTheme->Actualize( LINK( this, ActualizeProgress, ActualizeHdl ), &aStatusProgress ); - ClickCancelBtn( NULL ); - - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( ActualizeProgress, ActualizeHdl, INetURLObject*, pURL ) -{ - for( long i = 0; i < 128; i++ ) - Application::Reschedule(); - - Flush(); - Sync(); - - if( pURL ) - { - aFtActualizeFile.SetText( GetReducedString( *pURL, 30 ) ); - aFtActualizeFile.Flush(); - aFtActualizeFile.Sync(); - } - - return 0; -} - -// --------------- -// - TitleDialog - -// --------------- - -TitleDialog::TitleDialog( Window* pParent, const String& rOldTitle ) : - ModalDialog ( pParent, CUI_RES( RID_SVXDLG_GALLERY_TITLE ) ), - maOk ( this, CUI_RES( BTN_OK ) ), - maCancel ( this, CUI_RES( BTN_CANCEL ) ), - maHelp ( this, CUI_RES( BTN_HELP ) ), - maFL ( this, CUI_RES( FL_TITLE ) ), - maEdit ( this, CUI_RES( EDT_TITLE ) ) -{ - FreeResource(); - maEdit.SetText( rOldTitle ); - maEdit.GrabFocus(); -} - -// ------------------- -// - GalleryIdDialog - -// ------------------- - -GalleryIdDialog::GalleryIdDialog( Window* pParent, GalleryTheme* _pThm ) : - ModalDialog ( pParent, CUI_RES( RID_SVXDLG_GALLERY_THEMEID ) ), - aBtnOk ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aFLId ( this, CUI_RES( FL_ID ) ), - aLbResName ( this, CUI_RES( LB_RESNAME ) ), - pThm ( _pThm ) -{ - FreeResource(); - - aLbResName.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( "!!! No Id !!!" ) ) ); - - GalleryTheme::InsertAllThemes( aLbResName ); - - aLbResName.SelectEntryPos( (sal_uInt16) pThm->GetId() ); - aLbResName.GrabFocus(); - - aBtnOk.SetClickHdl( LINK( this, GalleryIdDialog, ClickOkHdl ) ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GalleryIdDialog, ClickOkHdl, void*, EMPTYARG ) -{ - Gallery* pGal = pThm->GetParent(); - const sal_uLong nId = GetId(); - sal_Bool bDifferentThemeExists = sal_False; - - for( sal_uLong i = 0, nCount = pGal->GetThemeCount(); i < nCount && !bDifferentThemeExists; i++ ) - { - const GalleryThemeEntry* pInfo = pGal->GetThemeInfo( i ); - - if( ( pInfo->GetId() == nId ) && ( pInfo->GetThemeName() != pThm->GetName() ) ) - { - String aStr( CUI_RES( RID_SVXSTR_GALLERY_ID_EXISTS ) ); - - aStr += String( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); - aStr += pInfo->GetThemeName(); - aStr += ')'; - - InfoBox aBox( this, aStr ); - aBox.Execute(); - aLbResName.GrabFocus(); - bDifferentThemeExists = sal_True; - } - } - - if( !bDifferentThemeExists ) - EndDialog( RET_OK ); - - return 0L; -} - - -// -------------------------- -// - GalleryThemeProperties - -// -------------------------- - -GalleryThemeProperties::GalleryThemeProperties( Window* pParent, ExchangeData* _pData, SfxItemSet* pItemSet ) : - SfxTabDialog ( pParent, CUI_RES( RID_SVXTABDLG_GALLERYTHEME ), pItemSet ), - pData ( _pData ) -{ - FreeResource(); - - AddTabPage( RID_SVXTABPAGE_GALLERY_GENERAL, TPGalleryThemeGeneral::Create, 0 ); - AddTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES, TPGalleryThemeProperties::Create, 0 ); - - if( pData->pTheme->IsReadOnly() ) - RemoveTabPage( RID_SVXTABPAGE_GALLERYTHEME_FILES ); - - String aText( GetText() ); - - aText += pData->pTheme->GetName(); - - if( pData->pTheme->IsReadOnly() ) - aText += String( CUI_RES( RID_SVXSTR_GALLERY_READONLY ) ); - - SetText( aText ); -} - -// ------------------------------------------------------------------------ - -void GalleryThemeProperties::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - if( RID_SVXTABPAGE_GALLERY_GENERAL == nId ) - ( (TPGalleryThemeGeneral&) rPage ).SetXChgData( pData ); - else - ( (TPGalleryThemeProperties&) rPage ).SetXChgData( pData ); -} - -// ------------------------- -// - TPGalleryThemeGeneral - -// ------------------------- - -TPGalleryThemeGeneral::TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage ( pParent, CUI_RES( RID_SVXTABPAGE_GALLERY_GENERAL ), rSet ), - aFiMSImage ( this, CUI_RES( FI_MS_IMAGE ) ), - aEdtMSName ( this, CUI_RES( EDT_MS_NAME ) ), - aFlMSGeneralFirst ( this, CUI_RES( FL_MS_GENERAL_FIRST ) ), - aFtMSType ( this, CUI_RES( FT_MS_TYPE ) ), - aFtMSShowType ( this, CUI_RES( FT_MS_SHOW_TYPE ) ), - aFtMSPath ( this, CUI_RES( FT_MS_PATH ) ), - aFtMSShowPath ( this, CUI_RES( FT_MS_SHOW_PATH ) ), - aFtMSContent ( this, CUI_RES( FT_MS_CONTENT ) ), - aFtMSShowContent ( this, CUI_RES( FT_MS_SHOW_CONTENT ) ), - aFlMSGeneralSecond ( this, CUI_RES( FL_MS_GENERAL_SECOND ) ), - aFtMSChangeDate ( this, CUI_RES( FT_MS_CHANGEDATE ) ), - aFtMSShowChangeDate ( this, CUI_RES( FT_MS_SHOW_CHANGEDATE ) ) -{ - FreeResource(); - - String aAccName(SVX_RES(RID_SVXSTR_GALLERY_THEMENAME)); - aEdtMSName.SetAccessibleName(aAccName); - aFiMSImage.SetAccessibleName(aAccName); - aEdtMSName.SetAccessibleRelationLabeledBy( &aFiMSImage ); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData ) -{ - pData = _pData; - - GalleryTheme* pThm = pData->pTheme; - String aOutStr( String::CreateFromInt32( pThm->GetObjectCount() ) ); - String aObjStr( CUI_RES( RID_SVXSTR_GALLERYPROPS_OBJECT ) ); - String aAccess; - String aType( SVX_RES( RID_SVXSTR_GALLERYPROPS_GALTHEME ) ); - sal_Bool bReadOnly = pThm->IsReadOnly() && !pThm->IsImported(); - - aEdtMSName.SetHelpId( HID_GALLERY_EDIT_MSNAME ); - aEdtMSName.SetText( pThm->GetName() ); - aEdtMSName.SetReadOnly( bReadOnly ); - - if( bReadOnly ) - aEdtMSName.Disable(); - else - aEdtMSName.Enable(); - - if( pThm->IsReadOnly() ) - aType += String( CUI_RES( RID_SVXSTR_GALLERY_READONLY ) ); - - aFtMSShowType.SetText( aType ); - aFtMSShowPath.SetText( pThm->GetSdgURL().GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - - // Ein- oder Mehrzahl? - if ( 1 == pThm->GetObjectCount() ) - aObjStr = aObjStr.GetToken( 0 ); - else - aObjStr = aObjStr.GetToken( 1 ); - - aOutStr += ' '; - aOutStr += aObjStr; - - aFtMSShowContent.SetText( aOutStr ); - - // get locale wrapper (singleton) - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& aLocaleData = aSysLocale.GetLocaleData(); - - // ChangeDate/Time - aAccess = aLocaleData.getDate( pData->aThemeChangeDate ); - aAccess += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); - aAccess += aLocaleData.getTime( pData->aThemeChangeTime ); - aFtMSShowChangeDate.SetText( aAccess ); - - // Image setzen - sal_uInt16 nId; - - if( pThm->IsImported() ) - nId = RID_SVXBMP_THEME_IMPORTED_BIG; - else if( pThm->IsReadOnly() ) - nId = RID_SVXBMP_THEME_READONLY_BIG; - else if( pThm->IsDefault() ) - nId = RID_SVXBMP_THEME_DEFAULT_BIG; - else - nId = RID_SVXBMP_THEME_NORMAL_BIG; - - aFiMSImage.SetImage( Image( Bitmap( CUI_RES( nId ) ), COL_LIGHTMAGENTA ) ); -} - -// ------------------------------------------------------------------------ - -sal_Bool TPGalleryThemeGeneral::FillItemSet( SfxItemSet& /*rSet*/ ) -{ - pData->aEditedTitle = aEdtMSName.GetText(); - return sal_True; -} - -// ------------------------------------------------------------------------ - -SfxTabPage* TPGalleryThemeGeneral::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new TPGalleryThemeGeneral( pParent, rSet ); -} - -// ---------------------------- -// - TPGalleryThemeProperties - -// ---------------------------- - -TPGalleryThemeProperties::TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet ) : - SfxTabPage ( pWindow, CUI_RES( RID_SVXTABPAGE_GALLERYTHEME_FILES ), rSet ), - aFtFileType ( this, CUI_RES(FT_FILETYPE ) ), - aCbbFileType ( this, CUI_RES(CBB_FILETYPE ) ), - aLbxFound ( this, CUI_RES(LBX_FOUND ) ), - aBtnSearch ( this, CUI_RES(BTN_SEARCH ) ), - aBtnTake ( this, CUI_RES(BTN_TAKE ) ), - aBtnTakeAll ( this, CUI_RES(BTN_TAKEALL ) ), - aCbxPreview ( this, CUI_RES(CBX_PREVIEW ) ), - aWndPreview ( this, CUI_RES( WND_BRSPRV ) ), - nCurFilterPos (0), - nFirstExtFilterPos (0), - bEntriesFound (sal_False), - bInputAllowed (sal_True), - bSearchRecursive (sal_False), - xDialogListener ( new ::svt::DialogClosedListener() ) -{ - FreeResource(); - - xDialogListener->SetDialogClosedLink( LINK( this, TPGalleryThemeProperties, DialogClosedHdl ) ); - aLbxFound.SetAccessibleName(String(SVX_RES(RID_SVXSTR_GALLERY_FILESFOUND))); - aWndPreview.SetAccessibleName(aCbxPreview.GetText()); - aLbxFound.SetAccessibleRelationLabeledBy(&aLbxFound); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData ) -{ - pData = _pData; - - aPreviewTimer.SetTimeoutHdl( LINK( this, TPGalleryThemeProperties, PreviewTimerHdl ) ); - aPreviewTimer.SetTimeout( 500 ); - aBtnSearch.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickSearchHdl)); - aBtnTake.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeHdl)); - aBtnTakeAll.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickTakeAllHdl)); - aCbxPreview.SetClickHdl(LINK(this, TPGalleryThemeProperties, ClickPreviewHdl)); - aCbbFileType.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFileTypeHdl)); - aCbbFileType.EnableDDAutoWidth( sal_False ); - aLbxFound.SetDoubleClickHdl(LINK(this, TPGalleryThemeProperties, DClickFoundHdl)); - aLbxFound.SetSelectHdl(LINK(this, TPGalleryThemeProperties, SelectFoundHdl)); - aLbxFound.InsertEntry(String(CUI_RES(RID_SVXSTR_GALLERY_NOFILES))); - aLbxFound.Show(); - - FillFilterList(); - - aBtnTake.Enable(); - aBtnTakeAll.Disable(); - aCbxPreview.Disable(); -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::StartSearchFiles( const String& _rFolderURL, short _nDlgResult ) -{ - if ( RET_OK == _nDlgResult ) - { - aURL = INetURLObject( _rFolderURL ); - bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls - SearchFiles(); - } - - nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); -} - -// ------------------------------------------------------------------------ - -TPGalleryThemeProperties::~TPGalleryThemeProperties() -{ - xMediaPlayer.clear(); - xDialogListener.clear(); - - for ( size_t i = 0, n = aFoundList.size(); i < n; ++i ) - delete aFoundList[ i ]; - - for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) { - delete aFilterEntryList[ i ]; - } -} - -// ------------------------------------------------------------------------ - -SfxTabPage* TPGalleryThemeProperties::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new TPGalleryThemeProperties( pParent, rSet ); -} - -// ------------------------------------------------------------------------ - -::rtl::OUString TPGalleryThemeProperties::addExtension( const ::rtl::OUString& _rDisplayText, const ::rtl::OUString& _rExtension ) -{ - ::rtl::OUString sAllFilter( RTL_CONSTASCII_USTRINGPARAM( "(*.*)" ) ); - ::rtl::OUString sOpenBracket( RTL_CONSTASCII_USTRINGPARAM( " (" ) ); - ::rtl::OUString sCloseBracket( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); - ::rtl::OUString sRet = _rDisplayText; - - if ( sRet.indexOf( sAllFilter ) == -1 ) - { - String sExt = _rExtension; - sRet += sOpenBracket; - sRet += sExt; - sRet += sCloseBracket; - } - return sRet; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::FillFilterList() -{ - GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter(); - String aExt; - String aName; - FilterEntry* pFilterEntry; - FilterEntry* pTestEntry; - sal_uInt16 i, nKeyCount; - sal_Bool bInList; - - // graphic filters - for( i = 0, nKeyCount = rFilter.GetImportFormatCount(); i < nKeyCount; i++ ) - { - aExt = rFilter.GetImportFormatShortName( i ); - aName = rFilter.GetImportFormatName( i ); - size_t entryIndex = 0; - pTestEntry = aFilterEntryList.empty() ? NULL : aFilterEntryList[ entryIndex ]; - bInList = sal_False; - - String aExtensions; - int j = 0; - String sWildcard; - while( sal_True ) - { - sWildcard = rFilter.GetImportWildcard( i, j++ ); - if ( !sWildcard.Len() ) - break; - if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode(';'); - aExtensions += sWildcard; - } - } - aName = addExtension( aName, aExtensions ); - - while( pTestEntry ) - { - if ( pTestEntry->aFilterName == aExt ) - { - bInList = sal_True; - break; - } - pTestEntry = ( ++entryIndex < aFilterEntryList.size() ) - ? aFilterEntryList[ entryIndex ] : NULL; - } - if ( !bInList ) - { - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = aExt; - size_t pos = aCbbFileType.InsertEntry( aName ); - if ( pos < aFilterEntryList.size() ) { - aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - } - } - - // media filters - static const ::rtl::OUString aWildcard( RTL_CONSTASCII_USTRINGPARAM( "*." ) ); - ::avmedia::FilterNameVector aFilters; - const ::rtl::OUString aSeparator( RTL_CONSTASCII_USTRINGPARAM( ";" ) ); - ::rtl::OUString aAllTypes; - - ::avmedia::MediaWindow::getMediaFilters( aFilters ); - - for( unsigned long l = 0; l < aFilters.size(); ++l ) - { - for( sal_Int32 nIndex = 0; nIndex >= 0; ) - { - ::rtl::OUString aFilterWildcard( aWildcard ); - - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = aFilters[ l ].second.getToken( 0, ';', nIndex ); - nFirstExtFilterPos = aCbbFileType.InsertEntry( - addExtension( - aFilters[ l ].first, - aFilterWildcard += pFilterEntry->aFilterName - ) - ); - if ( nFirstExtFilterPos < aFilterEntryList.size() ) { - aFilterEntryList.insert( - aFilterEntryList.begin() + nFirstExtFilterPos, - pFilterEntry - ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - } - } - - // 'All' filters - String aExtensions; - - // graphic filters - for ( i = 0; i < nKeyCount; ++i ) - { - int j = 0; - String sWildcard; - while( sal_True ) - { - sWildcard = rFilter.GetImportWildcard( i, j++ ); - if ( !sWildcard.Len() ) - break; - if ( aExtensions.Search( sWildcard ) == STRING_NOTFOUND ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode( ';' ); - - aExtensions += sWildcard; - } - } - } - - // media filters - for( unsigned long k = 0; k < aFilters.size(); ++k ) - { - for( sal_Int32 nIndex = 0; nIndex >= 0; ) - { - if ( aExtensions.Len() ) - aExtensions += sal_Unicode( ';' ); - ( aExtensions += String( aWildcard ) ) += String( aFilters[ k ].second.getToken( 0, ';', nIndex ) ); - } - } - -#if defined(WNT) - if ( aExtensions.Len() > 240 ) - aExtensions = DEFINE_CONST_UNICODE( "*.*" ); -#endif - - pFilterEntry = new FilterEntry; - pFilterEntry->aFilterName = String( CUI_RES( RID_SVXSTR_GALLERY_ALLFILES ) ); - pFilterEntry->aFilterName = addExtension( pFilterEntry->aFilterName, aExtensions ); - size_t pos = aCbbFileType.InsertEntry( pFilterEntry->aFilterName, 0 ); - if ( pos < aFilterEntryList.size() ) { - aFilterEntryList.insert( aFilterEntryList.begin() + pos, pFilterEntry ); - } else { - aFilterEntryList.push_back( pFilterEntry ); - } - aCbbFileType.SetText( pFilterEntry->aFilterName ); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, SelectFileTypeHdl, void *, EMPTYARG ) -{ - String aText( aCbbFileType.GetText() ); - - if( bInputAllowed && ( aLastFilterName != aText ) ) - { - aLastFilterName = aText; - - if( QueryBox( this, WB_YES_NO, String( CUI_RES( RID_SVXSTR_GALLERY_SEARCH ) ) ).Execute() == RET_YES ) - SearchFiles(); - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::SearchFiles() -{ - SearchProgress* pProgress = new SearchProgress( this, aURL ); - - for ( size_t i = 0, n = aFoundList.size(); i < n; ++i ) - delete aFoundList[ i ]; - aFoundList.clear(); - - aLbxFound.Clear(); - - pProgress->SetFileType( aCbbFileType.GetText() ); - pProgress->SetDirectory( rtl::OUString() ); - pProgress->Update(); - - pProgress->StartExecuteModal( LINK( this, TPGalleryThemeProperties, EndSearchProgressHdl ) ); -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickCloseBrowserHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - aPreviewTimer.Stop(); - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickSearchHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - try - { - // setup folder picker - ::com::sun::star::uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >( - xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ))), UNO_QUERY ); - - if ( xFolderPicker.is() ) - { - String aDlgPathName( SvtPathOptions().GetGraphicPath() ); - xFolderPicker->setDisplayDirectory(aDlgPathName); - - aPreviewTimer.Stop(); - - ::com::sun::star::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else - { - if( xFolderPicker->execute() == RET_OK ) - { - aURL = INetURLObject( xFolderPicker->getDirectory() ); - bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls - SearchFiles(); - } - - nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); - } - } - } - } - catch (const IllegalArgumentException&) - { - OSL_FAIL( "Folder picker failed with illegal arguments" ); - } - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::TakeFiles() -{ - if( aLbxFound.GetSelectEntryCount() || ( bTakeAll && bEntriesFound ) ) - { - TakeProgress* pTakeProgress = new TakeProgress( this ); - pTakeProgress->Update(); - - pTakeProgress->StartExecuteModal( - Link() /* no postprocessing needed, pTakeProgress - will be deleted in TakeProgress::CleanupHdl */ ); - } -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickPreviewHdl, void *, EMPTYARG ) -{ - if ( bInputAllowed ) - { - aPreviewTimer.Stop(); - aPreviewString.Erase(); - - if( !aCbxPreview.IsChecked() ) - { - xMediaPlayer.clear(); - aWndPreview.SetGraphic( Graphic() ); - aWndPreview.Invalidate(); - } - else - DoPreview(); - } - - return 0; -} - -// ------------------------------------------------------------------------ - -void TPGalleryThemeProperties::DoPreview() -{ - String aString( aLbxFound.GetSelectEntry() ); - - if( aString != aPreviewString ) - { - INetURLObject _aURL( *aFoundList[ aLbxFound.GetEntryPos( aString ) ] ); - bInputAllowed = sal_False; - - if ( !aWndPreview.SetGraphic( _aURL ) ) - { - GetParent()->LeaveWait(); - ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH ); - GetParent()->EnterWait(); - } - else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) - { - xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - if( xMediaPlayer.is() ) - xMediaPlayer->start(); - } - - bInputAllowed = sal_True; - aPreviewString = aString; - } -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickTakeHdl, void*, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - - if( !aLbxFound.GetSelectEntryCount() || !bEntriesFound ) - { - SvxOpenGraphicDialog aDlg(String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ) ); - aDlg.EnableLink(sal_False); - aDlg.AsLink(sal_False); - - if( !aDlg.Execute() ) - pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) ); - } - else - { - bTakeAll = sal_False; - TakeFiles(); - } - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, ClickTakeAllHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - bTakeAll = sal_True; - TakeFiles(); - } - - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, SelectFoundHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - sal_Bool bPreviewPossible = sal_False; - - aPreviewTimer.Stop(); - - if( bEntriesFound ) - { - if( aLbxFound.GetSelectEntryCount() == 1 ) - { - aCbxPreview.Enable(); - bPreviewPossible = sal_True; - } - else - aCbxPreview.Disable(); - - if( aFoundList.size() ) - aBtnTakeAll.Enable(); - else - aBtnTakeAll.Disable(); - } - - if( bPreviewPossible && aCbxPreview.IsChecked() ) - aPreviewTimer.Start(); - } - - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, DClickFoundHdl, void *, EMPTYARG ) -{ - if( bInputAllowed ) - { - aPreviewTimer.Stop(); - - return (aLbxFound.GetSelectEntryCount() == 1 && bEntriesFound) ? - ClickTakeHdl(NULL) : 0; - } - else - return 0; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, PreviewTimerHdl, void *, EMPTYARG ) -{ - aPreviewTimer.Stop(); - DoPreview(); - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, EndSearchProgressHdl, SearchProgress *, EMPTYARG ) -{ - if( aFoundList.size() ) - { - aLbxFound.SelectEntryPos( 0 ); - aBtnTakeAll.Enable(); - aCbxPreview.Enable(); - bEntriesFound = sal_True; - } - else - { - aLbxFound.InsertEntry( String( CUI_RES( RID_SVXSTR_GALLERY_NOFILES ) ) ); - aBtnTakeAll.Disable(); - aCbxPreview.Disable(); - bEntriesFound = sal_False; - } - return 0L; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( TPGalleryThemeProperties, DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent*, pEvt ) -{ - DBG_ASSERT( xFolderPicker.is() == sal_True, "TPGalleryThemeProperties::DialogClosedHdl(): no folder picker" ); - - String sURL = String( xFolderPicker->getDirectory() ); - StartSearchFiles( sURL, pEvt->DialogResult ); - - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuigrfflt.cxx b/cui/source/dialogs/cuigrfflt.cxx deleted file mode 100644 index e1855d567..000000000 --- a/cui/source/dialogs/cuigrfflt.cxx +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "cuigrfflt.hxx" -#include "grfflt.hrc" -#include -#include // RID_SVX_GRFFILTER_DLG_... - -// -------------------------------------- -// - GraphicFilterDialog::PreviewWindow - -// -------------------------------------- - -GraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) : - Control( pParent, rResId ) -{ -} - -// ----------------------------------------------------------------------------- - -GraphicFilterDialog::PreviewWindow::~PreviewWindow() -{ -} - -// ----------------------------------------------------------------------------- - -void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect ) -{ - Control::Paint( rRect ); - - const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) ); - const Size aOutSize( GetOutputSizePixel() ); - const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1, - ( aOutSize.Height() - aGrfSize.Height() ) >> 1 ); - - if( maGraphic.IsAnimated() ) - maGraphic.StartAnimation( this , aGrfPos, aGrfSize ); - else - maGraphic.Draw( this, aGrfPos, aGrfSize ); -} - -// ----------------------------------------------------------------------------- - -void GraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic ) -{ - maGraphic = rGraphic; - - if( maGraphic.IsAnimated() || maGraphic.IsTransparent() ) - Invalidate(); - else - Paint( Rectangle( Point(), GetOutputSizePixel() ) ); -} - -// ----------------------- -// - GraphicFilterDialog - -// ----------------------- - -GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) : - ModalDialog ( pParent, rResId ), - maModifyHdl ( LINK( this, GraphicFilterDialog, ImplModifyHdl ) ), - mfScaleX ( 0.0 ), - mfScaleY ( 0.0 ), - maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ), - maPreview ( this, CUI_RES( CTL_PREVIEW ) ), - maBtnOK ( this, CUI_RES( BTN_OK ) ), - maBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - maBtnHelp ( this, CUI_RES( BTN_HELP ) ), - maFlParameter ( this, CUI_RES( FL_PARAMETER ) ) -{ - const Size aPreviewSize( maPreview.GetOutputSizePixel() ); - Size aGrfSize( maSizePixel ); - - if( rGraphic.GetType() == GRAPHIC_BITMAP && - aPreviewSize.Width() && aPreviewSize.Height() && - aGrfSize.Width() && aGrfSize.Height() ) - { - const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height(); - const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height(); - - if( fGrfWH < fPreWH ) - { - aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH ); - aGrfSize.Height()= aPreviewSize.Height(); - } - else - { - aGrfSize.Width() = aPreviewSize.Width(); - aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH); - } - - mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width(); - mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height(); - - if( !rGraphic.IsAnimated() ) - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Scale( aGrfSize, BMP_SCALE_INTERPOLATE ) ) - maGraphic = aBmpEx; - } - } - - maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) ); - maTimer.SetTimeout( 100 ); - ImplModifyHdl( NULL ); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterDialog::~GraphicFilterDialog() -{ -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer*, EMPTYARG ) -{ - maTimer.Stop(); - maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) ); - - return 0; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( GraphicFilterDialog, ImplModifyHdl, void*, EMPTYARG ) -{ - if( maGraphic.GetType() == GRAPHIC_BITMAP ) - { - maTimer.Stop(); - maTimer.Start(); - } - - return 0; -} - -// ---------------- -// - FilterMosaic - -// ---------------- - -GraphicFilterMosaic::GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges ) : - GraphicFilterDialog( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_MOSAIC ), rGraphic ), - maFtWidth ( this, CUI_RES( DLG_FILTERMOSAIC_FT_WIDTH ) ), - maMtrWidth ( this, CUI_RES( DLG_FILTERMOSAIC_MTR_WIDTH ) ), - maFtHeight ( this, CUI_RES( DLG_FILTERMOSAIC_FT_HEIGHT ) ), - maMtrHeight ( this, CUI_RES( DLG_FILTERMOSAIC_MTR_HEIGHT ) ), - maCbxEdges ( this, CUI_RES( DLG_FILTERMOSAIC_CBX_EDGES ) ) -{ - FreeResource(); - - maMtrWidth.SetValue( nTileWidth ); - maMtrWidth.SetLast( GetGraphicSizePixel().Width() ); - maMtrWidth.SetModifyHdl( GetModifyHdl() ); - - maMtrHeight.SetValue( nTileHeight ); - maMtrHeight.SetLast( GetGraphicSizePixel().Height() ); - maMtrHeight.SetModifyHdl( GetModifyHdl() ); - - maCbxEdges.Check( bEnhanceEdges ); - maCbxEdges.SetToggleHdl( GetModifyHdl() ); - - maMtrWidth.GrabFocus(); - - maFtWidth.SetAccessibleRelationMemberOf(&maFlParameter); - maMtrWidth.SetAccessibleRelationMemberOf(&maFlParameter); - maFtHeight.SetAccessibleRelationMemberOf(&maFlParameter); - maMtrHeight.SetAccessibleRelationMemberOf(&maFlParameter); - maCbxEdges.SetAccessibleRelationMemberOf(&maFlParameter); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterMosaic::~GraphicFilterMosaic() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic, - double fScaleX, double fScaleY ) -{ - Graphic aRet; - const Size aSize( Max( FRound( GetTileWidth() * fScaleX ), 1L ), - Max( FRound( GetTileHeight() * fScaleY ), 1L ) ); - BmpFilterParam aParam( aSize ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_MOSAIC, &aParam ) ) - { - if( IsEnhanceEdges() ) - aAnim.Filter( BMP_FILTER_SHARPEN ); - - aRet = aAnim; - } - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_MOSAIC, &aParam ) ) - { - if( IsEnhanceEdges() ) - aBmpEx.Filter( BMP_FILTER_SHARPEN ); - - aRet = aBmpEx; - } - } - - return aRet; -} - -// ------------------ -// - GraphicFilterSolarize - -// ------------------ - -GraphicFilterSolarize::GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic, - sal_uInt8 cGreyThreshold, sal_Bool bInvert ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SOLARIZE ), rGraphic ), - maFtThreshold ( this, CUI_RES( DLG_FILTERSOLARIZE_FT_THRESHOLD ) ), - maMtrThreshold ( this, CUI_RES( DLG_FILTERSOLARIZE_MTR_THRESHOLD ) ), - maCbxInvert ( this, CUI_RES( DLG_FILTERSOLARIZE_CBX_INVERT ) ) -{ - FreeResource(); - - maMtrThreshold.SetValue( FRound( cGreyThreshold / 2.55 ) ); - maMtrThreshold.SetModifyHdl( GetModifyHdl() ); - - maCbxInvert.Check( bInvert ); - maCbxInvert.SetToggleHdl( GetModifyHdl() ); - - maMtrThreshold.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterSolarize::~GraphicFilterSolarize() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - BmpFilterParam aParam( GetGreyThreshold() ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_SOLARIZE, &aParam ) ) - { - if( IsInvert() ) - aAnim.Invert(); - - aRet = aAnim; - } - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_SOLARIZE, &aParam ) ) - { - if( IsInvert() ) - aBmpEx.Invert(); - - aRet = aBmpEx; - } - } - - return aRet; -} - -// ---------------------- -// - GraphicFilterSepia - -// ---------------------- - -GraphicFilterSepia::GraphicFilterSepia( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nSepiaPercent ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_SEPIA ), rGraphic ), - maFtSepia ( this, CUI_RES( DLG_FILTERSEPIA_FT_SEPIA ) ), - maMtrSepia ( this, CUI_RES( DLG_FILTERSEPIA_MTR_SEPIA ) ) -{ - FreeResource(); - - maMtrSepia.SetValue( nSepiaPercent ); - maMtrSepia.SetModifyHdl( GetModifyHdl() ); - - maMtrSepia.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterSepia::~GraphicFilterSepia() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - BmpFilterParam aParam( GetSepiaPercent() ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_SEPIA, &aParam ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_SEPIA, &aParam ) ) - aRet = aBmpEx; - } - - return aRet; -} - -// ----------------------- -// - GraphicFilterPoster - -// ----------------------- - -GraphicFilterPoster::GraphicFilterPoster( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nPosterCount ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_POSTER ), rGraphic ), - maFtPoster ( this, CUI_RES( DLG_FILTERPOSTER_FT_POSTER ) ), - maNumPoster ( this, CUI_RES( DLG_FILTERPOSTER_NUM_POSTER ) ) -{ - FreeResource(); - - maNumPoster.SetFirst( 2 ); - maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() ); - maNumPoster.SetValue( nPosterCount ); - maNumPoster.SetModifyHdl( GetModifyHdl() ); - maNumPoster.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterPoster::~GraphicFilterPoster() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - const sal_uInt16 nPosterCount = GetPosterColorCount(); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) ) - aRet = aBmpEx; - } - - return aRet; -} - -// ----------------------- -// - GraphicFilterEmboss - -// ----------------------- - -void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt ) -{ - const RECT_POINT eOldRP = GetActualRP(); - - SvxRectCtl::MouseButtonDown( rEvt ); - - if( GetActualRP() != eOldRP ) - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource ) : - GraphicFilterDialog ( pParent, CUI_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ), - maFtLight ( this, CUI_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ), - maCtlLight ( this, CUI_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource ) -{ - FreeResource(); - - maCtlLight.SetModifyHdl( GetModifyHdl() ); - maCtlLight.GrabFocus(); -} - -// ----------------------------------------------------------------------------- - -GraphicFilterEmboss::~GraphicFilterEmboss() -{ -} - -// ----------------------------------------------------------------------------- - -Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic, - double /*fScaleX*/, double /*fScaleY*/ ) -{ - Graphic aRet; - sal_uInt16 nAzim, nElev; - - switch( maCtlLight.GetActualRP() ) - { - default: OSL_FAIL("svx::GraphicFilterEmboss::GetFilteredGraphic(), unknown Reference Point!" ); - case( RP_LT ): nAzim = 4500, nElev = 4500; break; - case( RP_MT ): nAzim = 9000, nElev = 4500; break; - case( RP_RT ): nAzim = 13500, nElev = 4500; break; - case( RP_LM ): nAzim = 0, nElev = 4500; break; - case( RP_MM ): nAzim = 0, nElev = 9000; break; - case( RP_RM ): nAzim = 18000, nElev = 4500; break; - case( RP_LB ): nAzim = 31500, nElev = 4500; break; - case( RP_MB ): nAzim = 27000, nElev = 4500; break; - case( RP_RB ): nAzim = 22500, nElev = 4500; break; - } - - BmpFilterParam aParam( nAzim, nElev ); - - if( rGraphic.IsAnimated() ) - { - Animation aAnim( rGraphic.GetAnimation() ); - - if( aAnim.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) ) - aRet = aAnim; - } - else - { - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - - if( aBmpEx.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) ) - aRet = aBmpEx; - } - - return aRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx deleted file mode 100644 index 1e15f89f5..000000000 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include "cuihyperdlg.hxx" -#include "hlinettp.hxx" -#include "hlmailtp.hxx" -#include "hldoctp.hxx" -#include "hldocntp.hxx" -#include "hyperdlg.hrc" -#include // SID_READONLY_MODE - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::frame::XFrame; - -//######################################################################## -//# # -//# Childwindow-Wrapper-Class # -//# # -//######################################################################## - -SvxHlinkCtrl::SvxHlinkCtrl( sal_uInt16 _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg ) -: SfxControllerItem ( _nId, rBindings ) - ,aOnlineForwarder ( SID_INTERNET_ONLINE , *this ) - ,aRdOnlyForwarder ( SID_READONLY_MODE, *this ) -{ - pParent = pDlg; -} - -void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) -{ - if ( eState == SFX_ITEM_AVAILABLE ) - { - switch ( nSID ) - { - case SID_INTERNET_ONLINE : - { - pParent->EnableInetBrowse( !( (SfxBoolItem*)pState)->GetValue() ); - } - break; - case SID_HYPERLINK_GETLINK : - { - pParent->SetPage ( (SvxHyperlinkItem*)pState); - } - break; - case SID_READONLY_MODE : - { - pParent->SetReadOnlyMode( ( (SfxBoolItem*)pState)->GetValue() == sal_True ); - } - break; - } - } -} - - - -// ----------------------------------------------------------------------- - - - -//######################################################################## -//# # -//# Hyperlink - Dialog # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings) -: IconChoiceDialog( pParent, CUI_RES ( RID_SVXDLG_NEWHYPERLINK ) ), - maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ), - mpBindings ( pBindings ), - mbReadOnly ( sal_False ), - mbIsHTMLDoc ( sal_False ) -{ - SetUniqueId( HID_HYPERLINK_DIALOG ); - mbGrabFocus = sal_True; - // insert pages - Image aImage; - String aStrTitle; - SvxIconChoiceCtrlEntry* pEntry = NULL; - - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, SvxHyperlinkInternetTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLMAILTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, SvxHyperlinkMailTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, SvxHyperlinkDocTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) ); - aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP ); - aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP ) ); - pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, SvxHyperlinkNewDocTp::Create ); - pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) ); - - // create itemset for tabpages - mpItemSet = new SfxItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK, - SID_HYPERLINK_SETLINK ); - - SvxHyperlinkItem aItem; - mpItemSet->Put (aItem, SID_HYPERLINK_GETLINK); - - SetInputSet (mpItemSet); - - // Init Dialog - Start (sal_False); - - pBindings->Update( SID_READONLY_MODE ); - - // set OK/Cancel - button - GetOKButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_APPLYBUT) ); - GetCancelButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_CLOSEBUT) ); - - GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) ); - GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) ); -} - -SvxHpLinkDlg::~SvxHpLinkDlg () -{ - // delete config item, so the base class (IconChoiceDialog) can not load it on the next start - SvtViewOptions aViewOpt( E_TABDIALOG, String::CreateFromInt32( SID_HYPERLINK_DIALOG ) ); - aViewOpt.Delete(); - - delete mpItemSet; -} - -/************************************************************************* -|* -|* Close Dialog-Window -|* -|************************************************************************/ - -sal_Bool SvxHpLinkDlg::Close() -{ - GetDispatcher()->Execute( SID_HYPERLINK_DIALOG, - SFX_CALLMODE_ASYNCHRON | - SFX_CALLMODE_RECORD); - return sal_True; -} - -/************************************************************************* -|* -|* When extrawindow is visible and its never moved by user, then move that -|* window, too. -|* -|************************************************************************/ - -void SvxHpLinkDlg::Move() -{ - SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* ) - GetTabPage ( GetCurPageId() ); - - if( pCurrentPage->IsMarkWndVisible () ) - { - // Pos&Size of this dialog-window - Point aDlgPos ( GetPosPixel () ); - Size aDlgSize ( GetSizePixel () ); - - // Size of Office-Main-Window - Size aWindowSize( SFX_APP()->GetTopWindow()->GetSizePixel() ); - - // Size of Extrawindow - Size aExtraWndSize( pCurrentPage->GetSizeExtraWnd() ); - - sal_Bool bDoInvalid ; - if( aDlgPos.X()+(1.02*aDlgSize.Width())+aExtraWndSize.Width() > aWindowSize.Width() ) - { - if( aDlgPos.X() - ( 0.02*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 ) - { - // Pos Extrawindow anywhere - bDoInvalid = pCurrentPage->MoveToExtraWnd( Point( 1, long(1.1*aDlgPos.Y()) ), sal_True ); - } - else - { - // Pos Extrawindow on the left side of Dialog - bDoInvalid = pCurrentPage->MoveToExtraWnd( aDlgPos - - Point( long(0.02*aDlgSize.Width()), 0 ) - - Point( aExtraWndSize.Width(), 0 ) ); - } - } - else - { - // Pos Extrawindow on the right side of Dialog - bDoInvalid = pCurrentPage->MoveToExtraWnd ( aDlgPos + Point( long(1.02*aDlgSize.Width()), 0 ) ); - } - - if ( bDoInvalid ) - Invalidate(INVALIDATE_BACKGROUND); - } - - Window::Move(); -} - -/************************************************************************* -|* -|* Click on Apply-button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHpLinkDlg, ClickApplyHdl_Impl, void *, EMPTYARG ) -{ - SfxItemSet aItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK, - SID_HYPERLINK_SETLINK ); - - SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*) - GetTabPage ( GetCurPageId() ); - - if ( pCurrentPage->AskApply() ) - { - pCurrentPage->FillItemSet( aItemSet ); - - SvxHyperlinkItem *aItem = (SvxHyperlinkItem *) - aItemSet.GetItem (SID_HYPERLINK_SETLINK); - - String aStrEmpty; - if ( aItem->GetURL() != aStrEmpty ) - GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON | - SFX_CALLMODE_RECORD, aItem, 0L); - - ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply(); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Close-button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHpLinkDlg, ClickCloseHdl_Impl, void *, EMPTYARG ) -{ - Close(); - - return( 0L ); -} - -/************************************************************************* -|* -|* Set Page -|* -|************************************************************************/ - -sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem ) -{ - sal_uInt16 nPageId = RID_SVXPAGE_HYPERLINK_INTERNET; - - String aStrURL ( pItem->GetURL() ); - INetURLObject aURL ( aStrURL ); - INetProtocol eProtocolTyp = aURL.GetProtocol(); - - switch ( eProtocolTyp ) - { - case INET_PROT_HTTP : - case INET_PROT_FTP : - nPageId = RID_SVXPAGE_HYPERLINK_INTERNET; - break; - case INET_PROT_FILE : - case INET_PROT_POP3 : - case INET_PROT_IMAP : - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - break; - case INET_PROT_MAILTO : - case INET_PROT_NEWS : - nPageId = RID_SVXPAGE_HYPERLINK_MAIL; - break; - default : - sal_Char const sNewsSrvScheme[] = "news://"; - // TODO news:// is nonsense - - if ( aStrURL.SearchAscii( sNewsSrvScheme ) == 0 ) - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - else - { - sal_Char const sHash[] = "#"; - if( aStrURL.SearchAscii( sHash ) == 0 ) - nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; - else - { - eProtocolTyp = INET_PROT_NOT_VALID; - nPageId = GetCurPageId(); - } - } - break; - } - - ShowPage (nPageId); - - SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)GetTabPage( nPageId ); - - mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) ? true : false; - - SfxItemSet& aPageSet = (SfxItemSet&)GetTabPage (nPageId)->GetItemSet (); - aPageSet.Put ( *pItem ); - - pCurrentPage->Reset( aPageSet ); - if ( mbGrabFocus ) - { - pCurrentPage->SetInitFocus(); // #92535# grab the focus only once at initialization - mbGrabFocus = sal_False; - } - return nPageId; -} - -/************************************************************************* -|* -|* Enable/Disable to browse targets in a html-doc -|* -|************************************************************************/ - -void SvxHpLinkDlg::EnableInetBrowse( sal_Bool bEnable ) -{ - SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* ) - GetTabPage ( GetCurPageId() ); - pCurrentPage->SetOnlineMode( bEnable ); -} - -/************************************************************************* -|* -|* Enable/Disable ReadOnly mode -|* -|************************************************************************/ - -void SvxHpLinkDlg::SetReadOnlyMode( sal_Bool bRdOnly ) -{ - mbReadOnly = bRdOnly; - if ( bRdOnly ) - GetOKButton().Disable(); - else - GetOKButton().Enable(); -} - -/************************************************************************* -|* -|* late-initialization of newly created pages -|* -|************************************************************************/ - -void SvxHpLinkDlg::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& rPage ) -{ - SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage ); - Reference< XFrame > xDocumentFrame; - if ( mpBindings ) - xDocumentFrame = mpBindings->GetActiveFrame(); - OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" ); - rHyperlinkPage.SetDocumentFrame( xDocumentFrame ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuiimapdlg.hrc b/cui/source/dialogs/cuiimapdlg.hrc deleted file mode 100644 index 8635f1baf..000000000 --- a/cui/source/dialogs/cuiimapdlg.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -// ImapDlg-Dialoge - -#define FT_URLDESCRIPTION 1 -#define FT_URL1 2 -#define FT_TARGET 3 -#define FT_NAME 4 -#define FT_DESCRIPTION 5 -#define EDT_URLDESCRIPTION 1 -#define EDT_URL 2 -#define EDT_NAME 3 -#define EDT_DESCRIPTION 4 -#define BTN_HELP1 1 -#define BTN_OK1 2 -#define BTN_CANCEL1 3 -#define FL_URL 1 -#define CBB_TARGETS 1 diff --git a/cui/source/dialogs/cuiimapdlg.src b/cui/source/dialogs/cuiimapdlg.src deleted file mode 100644 index 95ed0f483..000000000 --- a/cui/source/dialogs/cuiimapdlg.src +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "cuiimapdlg.hrc" - // pragma ---------------------------------------------------------------- - -ModalDialog RID_SVXDLG_IMAPURL -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_IMAPURL"; - SVLook = TRUE ; - OutputSize = TRUE ; - Closeable = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 214 , 188 ) ; - Text [ en-US ] = "Properties" ; - - FixedText FT_URL1 - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~URL" ; - }; - Edit EDT_URL - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_URL"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - - FixedText FT_TARGET - { - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CBB_TARGETS - { - HelpID = "cui:ComboBox:RID_SVXDLG_IMAPURL:CBB_TARGETS"; - Border = TRUE ; - Sort = TRUE ; - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 101 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - HScroll = TRUE ; - }; - - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 6 , 59 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~Name" ; - }; - Edit EDT_NAME - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_NAME"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 70 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - - FixedText FT_URLDESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 85 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "Alternative ~text" ; - }; - - Edit EDT_URLDESCRIPTION - { - HelpID = "cui:Edit:RID_SVXDLG_IMAPURL:EDT_URLDESCRIPTION"; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 96 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 111 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "~Description" ; - }; - - MultiLineEdit EDT_DESCRIPTION - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_IMAPURL:EDT_DESCRIPTION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 122 ) ; - Size = MAP_APPFONT ( 202 , 34 ) ; - TabStop = TRUE ; - IgnoreTab = TRUE; - VScroll = TRUE; - }; - - FixedLine FL_URL - { - Pos = MAP_APPFONT ( 0 , 160 ) ; - Size = MAP_APPFONT ( 214 , 4 ) ; - }; - - // Buttons - HelpButton BTN_HELP1 - { - Pos = MAP_APPFONT ( 6, 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - OKButton BTN_OK1 - { - TabStop = TRUE ; - DefButton = TRUE ; - Pos = MAP_APPFONT ( 107 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - - CancelButton BTN_CANCEL1 - { - TabStop = TRUE ; - Pos = MAP_APPFONT ( 160 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx deleted file mode 100644 index 2d4516387..000000000 --- a/cui/source/dialogs/cuiimapwnd.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#define _ANIMATION -#include "macroass.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define TRANSCOL Color( COL_WHITE ) - -/************************************************************************* -|* -|* URLDlg -|* -\************************************************************************/ - -URLDlg::URLDlg( Window* pWindow, const String& rURL, const String& rAlternativeText, const String& rDescription, const String& rTarget, const String& rName, TargetList& rTargetList ) -: ModalDialog( pWindow, CUI_RES( RID_SVXDLG_IMAPURL ) ) -, maFtURL( this, CUI_RES( FT_URL1 ) ) -, maEdtURL( this, CUI_RES( EDT_URL ) ) -, maFtTarget( this, CUI_RES( FT_TARGET ) ) -, maCbbTargets( this, CUI_RES( CBB_TARGETS ) ) -, maFtName( this, CUI_RES( FT_NAME ) ) -, maEdtName( this, CUI_RES( EDT_NAME ) ) -, maFtAlternativeText( this, CUI_RES( FT_URLDESCRIPTION ) ) -, maEdtAlternativeText( this, CUI_RES( EDT_URLDESCRIPTION ) ) -, maFtDescription( this, CUI_RES( FT_DESCRIPTION ) ) -, maEdtDescription( this, CUI_RES( EDT_DESCRIPTION ) ) -, maFlURL( this, CUI_RES( FL_URL ) ) -, maBtnHelp( this, CUI_RES( BTN_HELP1 ) ) -, maBtnOk( this, CUI_RES( BTN_OK1 ) ) -, maBtnCancel( this, CUI_RES( BTN_CANCEL1 ) ) -{ - FreeResource(); - - maEdtURL.SetText( rURL ); - maEdtAlternativeText.SetText( rAlternativeText ); - maEdtDescription.SetText( rDescription ); - maEdtName.SetText( rName ); - - for( size_t i = 0, n = rTargetList.size(); i < n; ++i ) - maCbbTargets.InsertEntry( *rTargetList[ i ] ); - - if( !rTarget.Len() ) - maCbbTargets.SetText( String::CreateFromAscii( "_self" ) ); - else - maCbbTargets.SetText( rTarget ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/cuitbxform.cxx b/cui/source/dialogs/cuitbxform.cxx deleted file mode 100644 index 2e14b9752..000000000 --- a/cui/source/dialogs/cuitbxform.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuitbxform.hxx" -#include -#include -#include "fmsearch.hrc" - -//======================================================================== -// class FmInputRecordNoDialog -//======================================================================== - -FmInputRecordNoDialog::FmInputRecordNoDialog(Window * pParent) - :ModalDialog( pParent, CUI_RES(RID_SVX_DLG_INPUTRECORDNO)) - ,m_aLabel(this, CUI_RES(1)) - ,m_aRecordNo(this, CUI_RES(1)) - ,m_aOk(this, CUI_RES(1)) - ,m_aCancel(this, CUI_RES(1)) -{ - m_aRecordNo.SetMin(1); - m_aRecordNo.SetMax(0x7FFFFFFF); - m_aRecordNo.SetStrictFormat(sal_True); - m_aRecordNo.SetDecimalDigits(0); - - FreeResource(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx deleted file mode 100644 index 96262a840..000000000 --- a/cui/source/dialogs/dlgname.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include - -#include - -#include "dlgname.hxx" -#include "defdlgname.hxx" -#include "dlgname.hrc" -#include - -#define MAX_DESCRIPTION_LINES ((long)5) - -/************************************************************************* -|* -|* Dialog zum Editieren eines Namens -|* -\************************************************************************/ - -SvxNameDialog::SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_NAME ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aEdtName ( this, CUI_RES( EDT_STRING ) ), - aBtnOK ( this, CUI_RES( BTN_OK ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aBtnHelp ( this, CUI_RES( BTN_HELP ) ) -{ - FreeResource(); - - aFtDescription.SetText( rDesc ); - aEdtName.SetText( rName ); - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl)); - - // dynamic height of the description field - Size aSize = aFtDescription.GetSizePixel(); - long nTxtWidth = aFtDescription.GetCtrlTextWidth( rDesc ); - if ( nTxtWidth > aSize.Width() ) - { - long nLines = Min( ( nTxtWidth / aSize.Width() + 1 ), MAX_DESCRIPTION_LINES ); - long nHeight = aSize.Height(); - aSize.Height() = nHeight * nLines; - aFtDescription.SetSizePixel( aSize ); - Point aPnt = aEdtName.GetPosPixel(); - aPnt.Y() += ( aSize.Height() - nHeight ); - aEdtName.SetPosPixel( aPnt ); - } -} - -IMPL_LINK(SvxNameDialog, ModifyHdl, Edit*, EMPTYARG) -{ - if(aCheckNameHdl.IsSet()) - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); - return 0; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Name -// plus uniqueness-callback-linkHandler - -SvxObjectNameDialog::SvxObjectNameDialog( - Window* pWindow, - const String& rName) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_NAME)), - aFtName(this, CUI_RES(NTD_FT_NAME)), - aEdtName(this, CUI_RES(NTD_EDT_NAME)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_A)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) -{ - FreeResource(); - - // set name - aEdtName.SetText(rName); - - // activate name - aEdtName.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); - ModifyHdl(&aEdtName); - aEdtName.SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl)); -} - -IMPL_LINK(SvxObjectNameDialog, ModifyHdl, Edit*, EMPTYARG) -{ - if(aCheckNameHdl.IsSet()) - { - aBtnOK.Enable(aCheckNameHdl.Call(this) > 0); - } - - return 0; -} - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Title and Description - -SvxObjectTitleDescDialog::SvxObjectTitleDescDialog( - Window* pWindow, - const String& rTitle, - const String& rDescription) -: ModalDialog(pWindow, CUI_RES(RID_SVXDLG_OBJECT_TITLE_DESC)), - aFtTitle(this, CUI_RES(NTD_FT_TITLE)), - aEdtTitle(this, CUI_RES(NTD_EDT_TITLE)), - aFtDescription(this, CUI_RES(NTD_FT_DESC)), - aEdtDescription(this, CUI_RES(NTD_EDT_DESC)), - aFlSeparator(this, CUI_RES(FL_SEPARATOR_B)), - aBtnHelp(this, CUI_RES(BTN_HELP)), - aBtnOK(this, CUI_RES(BTN_OK)), - aBtnCancel(this, CUI_RES(BTN_CANCEL)) -{ - FreeResource(); - - // set title & desc - aEdtTitle.SetText(rTitle); - aEdtDescription.SetText(rDescription); - - // activate title - aEdtTitle.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX)); -} - -/////////////////////////////////////////////////////////////////////////////////////////////// - -/************************************************************************* -|* -|* Dialog zum Abbrechen, Speichern oder Hinzufuegen -|* -\************************************************************************/ - -SvxMessDialog::SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg ) : - ModalDialog ( pWindow, CUI_RES( RID_SVXDLG_MESSBOX ) ), - aFtDescription ( this, CUI_RES( FT_DESCRIPTION ) ), - aBtn1 ( this, CUI_RES( BTN_1 ) ), - aBtn2 ( this, CUI_RES( BTN_2 ) ), - aBtnCancel ( this, CUI_RES( BTN_CANCEL ) ), - aFtImage ( this ) -{ - FreeResource(); - - if( pImg ) - { - pImage = new Image( *pImg ); - aFtImage.SetImage( *pImage ); - aFtImage.SetStyle( ( aFtImage.GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK ); - aFtImage.SetPosSizePixel( LogicToPixel( Point( 3, 6 ), MAP_APPFONT ), - aFtImage.GetImage().GetSizePixel() ); - aFtImage.Show(); - } - - SetText( rText ); - aFtDescription.SetText( rDesc ); - - aBtn1.SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) ); - aBtn2.SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) ); -} - -SvxMessDialog::~SvxMessDialog() -{ - if( pImage ) - delete pImage; -} - -/*************************************************************************/ - -IMPL_LINK_INLINE_START( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) -{ - EndDialog( RET_BTN_1 ); - return 0; -} -IMPL_LINK_INLINE_END( SvxMessDialog, Button1Hdl, Button *, EMPTYARG ) - -/*************************************************************************/ - -IMPL_LINK_INLINE_START( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) -{ - EndDialog( RET_BTN_2 ); - return 0; -} -IMPL_LINK_INLINE_END( SvxMessDialog, Button2Hdl, Button *, EMPTYARG ) - -/*************************************************************************/ - -void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ) -{ - switch ( nBtnId ) - { - case MESS_BTN_1: - aBtn1.SetText( rNewTxt ); - break; - - case MESS_BTN_2: - aBtn2.SetText( rNewTxt ); - break; - - default: - OSL_FAIL( "Falsche Button-Nummer!!!" ); - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/dlgname.hrc b/cui/source/dialogs/dlgname.hrc deleted file mode 100644 index be0f2ad84..000000000 --- a/cui/source/dialogs/dlgname.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define EDT_STRING 1 -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FT_DESCRIPTION 1 -#define BTN_1 1 -#define BTN_2 2 - -// #i68101# -#define NTD_FT_NAME 2 -#define NTD_EDT_NAME 2 -#define NTD_FT_TITLE 3 -#define NTD_EDT_TITLE 3 -#define NTD_FT_DESC 4 -#define NTD_EDT_DESC 4 -#define FL_SEPARATOR_A 1 -#define FL_SEPARATOR_B 2 - -// eof diff --git a/cui/source/dialogs/dlgname.src b/cui/source/dialogs/dlgname.src deleted file mode 100644 index 65f5fff65..000000000 --- a/cui/source/dialogs/dlgname.src +++ /dev/null @@ -1,250 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include ------------------------------------------------------------------ - -#include -#include "helpid.hrc" -#include "dlgname.hrc" - -// RID_SVXDLG_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_NAME -{ - HelpId = HID_DLG_NAME ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 63 ) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - WordBreak = TRUE ; - }; - Edit EDT_STRING - { - HelpID = "cui:Edit:RID_SVXDLG_NAME:EDT_STRING"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 112 , 12 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 124 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 124 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 124 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECT_NAME ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_NAME -{ - HelpId = HID_DLG_OBJECT_NAME; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 54 + 2) ; - Text [ en-US ] = "Name" ; - Moveable = TRUE ; - - // name - FixedText NTD_FT_NAME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - Text [ en-US ] = "~Name"; - }; - Edit NTD_EDT_NAME - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_NAME:NTD_EDT_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // divider - FixedLine FL_SEPARATOR_A - { - Pos = MAP_APPFONT ( 0 , 39 - 6 - 2 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 39 - 3 + 3) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// #i68101# -// RID_SVXDLG_OBJECTTITLE_DESC ---------------------------------------------------------- - -ModalDialog RID_SVXDLG_OBJECT_TITLE_DESC -{ - HelpId = HID_DLG_OBJECT_TITLE_DESC; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 180 , 78 + 27 ) ; - Text [ en-US ] = "Description" ; - Moveable = TRUE ; - - // title - FixedText NTD_FT_TITLE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Title"; - }; - Edit NTD_EDT_TITLE - { - HelpID = "cui:Edit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_TITLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 168 , 12 ) ; - TabStop = TRUE ; - }; - - // description - FixedText NTD_FT_DESC - { - Pos = MAP_APPFONT ( 6 , 30 ) ; - Size = MAP_APPFONT ( 168 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Description"; - }; - MultiLineEdit NTD_EDT_DESC - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_OBJECT_TITLE_DESC:NTD_EDT_DESC"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 41 ) ; - Size = MAP_APPFONT ( 168 , (12 * 3) - 2 ) ; - TabStop = TRUE ; - IgnoreTab = TRUE; - VScroll = TRUE; - }; - - // divider - FixedLine FL_SEPARATOR_B - { - Pos = MAP_APPFONT ( 0 , 41 + 39 ) ; - Size = MAP_APPFONT ( 180 , 8 ) ; - }; - - // Buttons - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6, 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 - (50 + 50 + 6), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174 - (50), 41 + 39 + 3 + 5) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -// RID_SVXDLG_MESSBOX ------------------------------------------------------- - -ModalDialog RID_SVXDLG_MESSBOX -{ - HelpId = HID_DLG_MESSBOX ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 212 , 64 ) ; - Text = "" ; - Moveable = TRUE ; - PushButton BTN_1 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_1"; - Pos = MAP_APPFONT ( 25 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton BTN_2 - { - HelpID = "cui:PushButton:RID_SVXDLG_MESSBOX:BTN_2"; - Pos = MAP_APPFONT ( 78 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 131 , 44 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_DESCRIPTION - { - Pos = MAP_APPFONT ( 28 , 6 ) ; - Size = MAP_APPFONT ( 200 , 35 ) ; - WordBreak = TRUE ; - }; -}; - // ********************************************************************** EOF diff --git a/cui/source/dialogs/fmsearch.hrc b/cui/source/dialogs/fmsearch.hrc deleted file mode 100644 index 16936f81f..000000000 --- a/cui/source/dialogs/fmsearch.hrc +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _FMSEARCH_HRC -#define _FMSEARCH_HRC - -#include "svl/solar.hrc" - -#define RID_SVX_DLG_INPUTRECORDNO (RID_FORMS_START + 10) -#define RID_SVX_DLG_SHOWGRIDCOLUMNS (RID_FORMS_START + 11) -#define RID_SVXDLG_SEARCHFORM (RID_FORMS_START + 7) -#define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85) -#define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86) -#define RID_STR_SEARCH_END (RID_FORMS_START + 87) -#define RID_STR_SEARCH_WHOLE (RID_FORMS_START + 88) -#define RID_STR_FROM_TOP (RID_FORMS_START + 74) -#define RID_STR_FROM_BOTTOM (RID_FORMS_START + 75) -#define RID_SVXERR_SEARCH_NORECORD (RID_FORMS_START + 8) -#define RID_SVXERR_SEARCH_GENERAL_ERROR (RID_FORMS_START + 9) -#define RID_STR_OVERFLOW_FORWARD (RID_FORMS_START + 34) -#define RID_STR_OVERFLOW_BACKWARD (RID_FORMS_START + 35) -#define RID_STR_SEARCH_COUNTING (RID_FORMS_START + 76) - -#define FT_SEARCHTEXT 1 -#define FT_FORM 2 -#define FT_POSITION 3 -#define FT_RECORDLABEL 4 -#define FT_RECORD 5 -#define FT_HINT 6 - - -#define CMB_SEARCHTEXT 1 - -#define RB_ALLFIELDS 1 -#define RB_SINGLEFIELD 2 -#define RB_SEARCHFORTEXT 3 -#define RB_SEARCHFORNULL 4 -#define RB_SEARCHFORNOTNULL 5 - -#define LB_FORM 1 -#define LB_FIELD 2 -#define LB_POSITION 3 - -#define PB_APPROXSETTINGS 1 -#define PB_SEARCH 2 -#define PB_SOUNDSLIKESETTINGS 3 - -#define FL_SEARCHFOR 1 -#define FL_WHERE 2 -#define FL_OPTIONS 3 -#define FL_STATE 4 - -#define CB_USEFORMATTER 1 -#define CB_BACKWARD 2 -#define CB_STARTOVER 3 -#define CB_CASE 4 -#define CB_WILDCARD 5 -#define CB_REGULAR 6 -#define CB_APPROX 7 -#define CB_HALFFULLFORMS 8 -#define CB_SOUNDSLIKECJK 9 - -#endif // _FMSEARCH_HRC diff --git a/cui/source/dialogs/fmsearch.src b/cui/source/dialogs/fmsearch.src deleted file mode 100644 index 62bae4533..000000000 --- a/cui/source/dialogs/fmsearch.src +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "fmsearch.hrc" -#include "helpid.hrc" - -ModalDialog RID_SVXDLG_SEARCHFORM -{ - OutputSize = TRUE; - SVLook = TRUE; - Size = MAP_APPFONT( 300, 253 ); - Text [ en-US ] = "Record Search"; - Moveable = TRUE; - HelpId = HID_FM_DLG_SEARCH; - - FixedLine FL_SEARCHFOR - { - Pos = MAP_APPFONT( 6, 8 ); - Size = MAP_APPFONT( 232, 8 ); - Text [ en-US ] = "Search for"; - }; - RadioButton RB_SEARCHFORTEXT - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORTEXT"; - Pos = MAP_APPFONT( 12, 23 ); - Size = MAP_APPFONT( 50, 10 ); - Group = TRUE; - Text [ en-US ] = "~Text"; - }; - RadioButton RB_SEARCHFORNULL - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORNULL"; - Pos = MAP_APPFONT( 12, 36 ); - Size = MAP_APPFONT( 207, 10 ); - Text [ en-US ] = "Field content is ~NULL"; - }; - RadioButton RB_SEARCHFORNOTNULL - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SEARCHFORNOTNULL"; - Pos = MAP_APPFONT( 12, 49 ); - Size = MAP_APPFONT( 207, 10 ); - Text [ en-US ] = "Field content is not NU~LL"; - }; - ComboBox CMB_SEARCHTEXT - { - Border = TRUE; - Pos = MAP_APPFONT( 65, 20 ); - Size = MAP_APPFONT( 154, 80 ); - DropDown = TRUE; - TabStop = TRUE; - HelpId = HID_SEARCH_TEXT; - }; - - FixedLine FL_WHERE - { - Pos = MAP_APPFONT( 6, 65 ); - Size = MAP_APPFONT( 232, 8 ); - Text [ en-US ] = "Where to search"; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT( 12, 77 ); - Size = MAP_APPFONT( 87, 10 ); - Text [ en-US ] = "Form"; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXDLG_SEARCHFORM:LB_FORM"; - Border = TRUE; - Pos = MAP_APPFONT( 110, 76 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - }; - RadioButton RB_ALLFIELDS - { - Pos = MAP_APPFONT( 24, 91 ); - Size = MAP_APPFONT( 75, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_ALLFIELDS; - Text [ en-US ] = "All Fields"; - }; - RadioButton RB_SINGLEFIELD - { - HelpID = "cui:RadioButton:RID_SVXDLG_SEARCHFORM:RB_SINGLEFIELD"; - Pos = MAP_APPFONT( 24, 106 ); - Size = MAP_APPFONT( 75, 10 ); - Text [ en-US ] = "Single field"; - }; - ListBox LB_FIELD - { - Border = TRUE; - Pos = MAP_APPFONT( 110, 105 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - HelpId = HID_SEARCH_FIELDSELECTION; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT( 6, 126 ); - Size = MAP_APPFONT( 288, 8 ); - Text [ en-US ] = "Settings"; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT( 12, 138 ); - Size = MAP_APPFONT( 87, 8 ); - Text [ en-US ] = "Position"; - }; - ListBox LB_POSITION - { - Border = TRUE; - Pos = MAP_APPFONT( 110, 136 ); - Size = MAP_APPFONT( 109, 60 ); - TabStop = TRUE; - DropDown = TRUE; - HelpId = HID_SEARCH_POSITION; - }; - CheckBox CB_USEFORMATTER - { - Pos = MAP_APPFONT( 12, 158 ); - Size = MAP_APPFONT( 90, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_FORMATTER; - Text [ en-US ] = "Apply field format"; - }; - CheckBox CB_CASE - { - Pos = MAP_APPFONT( 12, 171 ); - Size = MAP_APPFONT( 90, 20 ); - TabStop = TRUE; - WordBreak = TRUE; - HelpId = HID_SEARCH_CASE; - Text [ en-US ] = "Match case"; - }; - CheckBox CB_BACKWARD - { - Pos = MAP_APPFONT( 105, 158 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_BACKWARD; - Text [ en-US ] = "Search backwards"; - }; - CheckBox CB_STARTOVER - { - Pos = MAP_APPFONT( 105, 171 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_STARTOVER; - Text [ en-US ] = "From Beginning"; - }; - CheckBox CB_WILDCARD - { - Pos = MAP_APPFONT( 190, 158 ); - Size = MAP_APPFONT( 100, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_WILDCARD; - Text [ en-US ] = "Wildcard expression"; - }; - CheckBox CB_REGULAR - { - Pos = MAP_APPFONT( 190, 171 ); - Size = MAP_APPFONT( 100, 10 ); - TabStop = TRUE; - HelpId = HID_SEARCH_REGULAR; - Text [ en-US ] = "Regular expression"; - }; - CheckBox CB_APPROX - { - Pos = MAP_APPFONT( 190, 184 ); - Size = MAP_APPFONT( 84, 20 ); - TabStop = TRUE; - WordBreak = TRUE; - HelpId = HID_SEARCH_APPROX; - Text [ en-US ] = "Similarity Search"; - }; - PushButton PB_APPROXSETTINGS - { - Pos = MAP_APPFONT( 275, 182 ); - Size = MAP_APPFONT( 14, 14 ); - TabStop = TRUE ; - HelpId = HID_SEARCH_APPROXSETTINGS; - Text [ en-US ] = "..."; - }; - CheckBox CB_HALFFULLFORMS - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHFORM:CB_HALFFULLFORMS"; - Pos = MAP_APPFONT( 105, 209 ); - Size = MAP_APPFONT( 85, 10 ); - TabStop = TRUE ; - Text [ en-US ] = "Match character width" ; - }; - CheckBox CB_SOUNDSLIKECJK - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHFORM:CB_SOUNDSLIKECJK"; - Pos = MAP_APPFONT( 190, 209 ); - Size = MAP_APPFONT( 84, 10 ); - TabStop = TRUE ; - Text [ en-US ] = "Sounds like (Japanese)"; - }; - PushButton PB_SOUNDSLIKESETTINGS - { - HelpID = "cui:PushButton:RID_SVXDLG_SEARCHFORM:PB_SOUNDSLIKESETTINGS"; - Pos = MAP_APPFONT( 275, 207 ); - Size = MAP_APPFONT( 14, 14 ); - TabStop = TRUE ; - Text [ en-US ] = "..." ; - }; - FixedLine FL_STATE - { - Pos = MAP_APPFONT( 6, 222 ); - Size = MAP_APPFONT( 288, 8 ); - Text [ en-US ] = "State"; - }; - FixedText FT_RECORDLABEL - { - Pos = MAP_APPFONT( 12, 232 ); - Size = MAP_APPFONT( 45, 10 ); - Text [ en-US ] = "Record :"; - }; - FixedText FT_RECORD - { - Pos = MAP_APPFONT( 60, 232 ); - Size = MAP_APPFONT( 30, 10 ); - UniqueId = UID_SEARCH_RECORDSTATUS; - }; - FixedText FT_HINT - { - Pos = MAP_APPFONT( 99, 232 ); - Size = MAP_APPFONT( 190, 10 ); - }; - PushButton PB_SEARCH - { - Pos = MAP_APPFONT( 244, 6 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE; - HelpId = HID_SEARCH_BTN_SEARCH; - Text [ en-US ] = "Search"; - }; - CancelButton 1 - { - Pos = MAP_APPFONT( 244, 26 ); - Size = MAP_APPFONT( 50, 14 ); - HelpId = HID_SEARCH_BTN_CLOSE; - TabStop = TRUE; - Text [ en-US ] = "~Close"; - }; - HelpButton 1 - { - Pos = MAP_APPFONT( 244, 46 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - Text [ en-US ] = "~Help"; - }; -}; - -String RID_STR_SEARCH_ANYWHERE -{ - Text [ en-US ] = "anywhere in the field"; -}; - -String RID_STR_SEARCH_BEGINNING -{ - Text [ en-US ] = "beginning of field"; -}; - -String RID_STR_SEARCH_END -{ - Text [ en-US ] = "end of field"; -}; - -String RID_STR_SEARCH_WHOLE -{ - Text [ en-US ] = "entire field"; -}; - -String RID_STR_FROM_TOP -{ - Text [ en-US ] = "From top"; -}; -String RID_STR_FROM_BOTTOM -{ - Text [ en-US ] = "From bottom"; -}; - -ErrorBox RID_SVXERR_SEARCH_NORECORD -{ - Buttons = WB_OK; - Message [ en-US ] = "No records corresponding to your data found."; -}; - -ErrorBox RID_SVXERR_SEARCH_GENERAL_ERROR -{ - Buttons = WB_OK; - Message [ en-US ] = "An unknown error occurred. The search could not be finished."; -}; - -String RID_STR_OVERFLOW_FORWARD -{ - Text [ en-US ] = "Overflow, search continued at the beginning"; -}; - -String RID_STR_OVERFLOW_BACKWARD -{ - Text [ en-US ] = "Overflow, search continued at the end"; -}; - -String RID_STR_SEARCH_COUNTING -{ - Text [ en-US ] = "counting records"; -}; diff --git a/cui/source/dialogs/gallery.src b/cui/source/dialogs/gallery.src deleted file mode 100644 index ec7ee3d13..000000000 --- a/cui/source/dialogs/gallery.src +++ /dev/null @@ -1,486 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "helpid.hrc" -#include "gallery.hrc" -#include - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -TabDialog RID_SVXTABDLG_GALLERY -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Properties of " ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERY_GENERAL ; - Text [ en-US ] = "General" ; - }; - }; - }; -}; - -/******************************************************************************/ - -TabDialog RID_SVXTABDLG_GALLERYTHEME -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Properties of " ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERY_GENERAL ; - Text [ en-US ] = "General" ; - }; - PageItem - { - Identifier = RID_SVXTABPAGE_GALLERYTHEME_FILES ; - Text [ en-US ] = "Files" ; - }; - }; - }; -}; - -/******************************************************************************/ - -TabPage RID_SVXTABPAGE_GALLERY_GENERAL -{ - HelpId = HID_GALLERY_PROPERTIES_GENERAL; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedImage FI_MS_IMAGE - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 20 , 20 ) ; - }; - Edit EDT_MS_NAME - { - HelpID = "cui:Edit:RID_SVXTABPAGE_GALLERY_GENERAL:EDT_MS_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 10 ) ; - Size = MAP_APPFONT ( 194 , 12 ) ; - }; - FixedLine FL_MS_GENERAL_FIRST - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 248 , 1 ) ; - }; - FixedText FT_MS_TYPE - { - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Type:" ; - }; - FixedText FT_MS_SHOW_TYPE - { - Pos = MAP_APPFONT ( 60 , 43 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedText FT_MS_PATH - { - Pos = MAP_APPFONT ( 6 , 57 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Location:" ; - }; - FixedText FT_MS_SHOW_PATH - { - Pos = MAP_APPFONT ( 60 , 57 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedText FT_MS_CONTENT - { - Pos = MAP_APPFONT ( 6 , 71 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Contents:" ; - }; - FixedText FT_MS_SHOW_CONTENT - { - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; - FixedLine FL_MS_GENERAL_SECOND - { - Pos = MAP_APPFONT ( 6 , 91 ) ; - Size = MAP_APPFONT ( 248 , 1 ) ; - }; - FixedText FT_MS_CHANGEDATE - { - Pos = MAP_APPFONT ( 6 , 98 ) ; - Size = MAP_APPFONT ( 51 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Modified:" ; - }; - FixedText FT_MS_SHOW_CHANGEDATE - { - Pos = MAP_APPFONT ( 60 , 98 ) ; - Size = MAP_APPFONT ( 194 , 10 ) ; - }; -}; - -/******************************************************************************/ - -TabPage RID_SVXTABPAGE_GALLERYTHEME_FILES -{ - HelpId = HID_GALLERY_BROWSER ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedText FT_FILETYPE - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 48 , 10 ) ; - Text [ en-US ] = "~File type" ; - }; - ComboBox CBB_FILETYPE - { - HelpID = "cui:ComboBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:CBB_FILETYPE"; - Pos = MAP_APPFONT ( 57 , 6 ) ; - Size = MAP_APPFONT ( 121 , 69 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoSize = TRUE; - AutoHScroll = TRUE ; - }; - MultiListBox LBX_FOUND - { - HelpID = "cui:MultiListBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:LBX_FOUND"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 23 ) ; - Size = MAP_APPFONT ( 172 , 156 ) ; - TabStop = TRUE ; - SimpleMode = TRUE ; - }; - PushButton BTN_SEARCH - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_SEARCH"; - Pos = MAP_APPFONT ( 184 , 6 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Find Files..." ; - }; - PushButton BTN_TAKE - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_TAKE"; - Pos = MAP_APPFONT ( 184 , 24 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Add" ; - }; - PushButton BTN_TAKEALL - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_TAKEALL"; - Pos = MAP_APPFONT ( 184 , 42 ) ; - Size = MAP_APPFONT ( 70 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "A~dd All" ; - }; - CheckBox CBX_PREVIEW - { - HelpID = "cui:CheckBox:RID_SVXTABPAGE_GALLERYTHEME_FILES:CBX_PREVIEW"; - Pos = MAP_APPFONT ( 184 , 76 ) ; - Size = MAP_APPFONT ( 70 , 12 ) ; - Text [ en-US ] = "Pr~eview" ; - }; - Window WND_BRSPRV - { - Border = TRUE ; - Pos = MAP_APPFONT ( 184 , 91 ) ; - Size = MAP_APPFONT ( 70 , 88 ) ; - }; - PushButton BTN_MADDIN1 - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_MADDIN1"; - Pos = MAP_APPFONT ( 220 , 63 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Maddin1" ; - }; - PushButton BTN_MADDIN2 - { - HelpID = "cui:PushButton:RID_SVXTABPAGE_GALLERYTHEME_FILES:BTN_MADDIN2"; - Pos = MAP_APPFONT ( 220 , 80 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Maddin2" ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_TITLE -{ - HelpId = HID_GALLERY_TITLE; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 63 ) ; - Text [ en-US ] = "Enter Title" ; - Moveable = TRUE ; - - OkButton BTN_OK - { - DefButton = TRUE ; - Pos = MAP_APPFONT ( 112 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 112 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 112 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - FixedLine FL_TITLE - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Title" ; - }; - Edit EDT_TITLE - { - HelpId = HID_GALLERY_TITLE_EDIT; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 18 ) ; - Size = MAP_APPFONT ( 88, 12 ) ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_SEARCH_PROGRESS -{ - HelpId = HID_GALLERY_SEARCH ; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 86 ) ; - Text [ en-US ] = "Find" ; - Moveable = TRUE ; - FixedLine FL_SEARCH_DIR - { - Pos = MAP_APPFONT ( 6 , 33 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "Directory" ; - }; - FixedText FT_SEARCH_DIR - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 66 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_SEARCH_TYPE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File type" ; - }; - FixedText FT_SEARCH_TYPE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_TAKE_PROGRESS -{ - HelpId = HID_GALLERY_APPLY ; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 56 ) ; - Text [ en-US ] = "Apply" ; - Moveable = TRUE ; - FixedLine FL_TAKE_PROGRESS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File" ; - }; - FixedText FT_TAKE_FILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 36 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -/******************************************************************************/ - -ModalDialog RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS -{ - HelpId = HID_GALLERY_ACTUALIZE; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 124 , 56 ) ; - Text [ en-US ] = "Update" ; - Moveable = TRUE ; - FixedLine FL_ACTUALIZE_PROGRESS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "File" ; - }; - FixedText FT_ACTUALIZE_FILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 37 , 36 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - -ModalDialog RID_SVXDLG_GALLERY_THEMEID -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_GALLERY_THEMEID"; - OutputSize = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 180 , 63 ) ; - Text [ en-US ] = "Theme ID" ; - Moveable = TRUE ; - OkButton BTN_OK - { - Pos = MAP_APPFONT ( 124 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 124 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine FL_ID - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "ID"; - }; - ListBox LB_RESNAME - { - HelpID = "cui:ListBox:RID_SVXDLG_GALLERY_THEMEID:LB_RESNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - HScroll = TRUE ; - VScroll = TRUE ; - }; -}; - -String RID_SVXSTR_GALLERY_NOFILES -{ - Text [ en-US ] = "" ; -}; -String RID_SVXSTR_GALLERY_SEARCH -{ - Text [ en-US ] = "Do you want to update the file list?" ; -}; -String RID_SVXSTR_GALLERYPROPS_OBJECT -{ - Text [ en-US ] = "Object;Objects" ; -}; -String RID_SVXSTR_GALLERY_READONLY -{ - Text [ en-US ] = " (read-only)" ; -}; -String RID_SVXSTR_GALLERY_ALLFILES -{ - Text [ en-US ] = "" ; -}; -String RID_SVXSTR_GALLERY_ID_EXISTS -{ - Text [ en-US ] = "This ID already exists..." ; -}; - -/******************************************************************************/ - -Bitmap RID_SVXBMP_THEME_NORMAL_BIG -{ - File = "galnorl.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_IMPORTED_BIG -{ - File = "galimpl.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_READONLY_BIG -{ - File = "galrdol.bmp" ; -}; - -Bitmap RID_SVXBMP_THEME_DEFAULT_BIG -{ - File = "galdefl.bmp" ; -}; - - diff --git a/cui/source/dialogs/grfflt.hrc b/cui/source/dialogs/grfflt.hrc deleted file mode 100644 index eaafe3818..000000000 --- a/cui/source/dialogs/grfflt.hrc +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_DLGFLT_HRC -#define _SVX_DLGFLT_HRC - -// ---------- -// - Common - -// ---------- - -#define BTN_OK 101 -#define BTN_CANCEL 102 -#define BTN_HELP 103 -#define CTL_PREVIEW 105 -#define FL_PARAMETER 106 - -// -------------------- -// - DLG_FILTERMOSAIC - -// -------------------- - -#define DLG_FILTERMOSAIC_FT_WIDTH 1 -#define DLG_FILTERMOSAIC_MTR_WIDTH 2 -#define DLG_FILTERMOSAIC_FT_HEIGHT 3 -#define DLG_FILTERMOSAIC_MTR_HEIGHT 4 -#define DLG_FILTERMOSAIC_CBX_EDGES 5 - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -#define DLG_FILTERSOLARIZE_FT_THRESHOLD 1 -#define DLG_FILTERSOLARIZE_MTR_THRESHOLD 2 -#define DLG_FILTERSOLARIZE_CBX_INVERT 3 - -// ------------------- -// - DLG_FILTERSEPIA - -// ------------------- - -#define DLG_FILTERSEPIA_FT_SEPIA 1 -#define DLG_FILTERSEPIA_MTR_SEPIA 2 - -// -------------------- -// - DLG_FILTERPOSTER - -// -------------------- - -#define DLG_FILTERPOSTER_FT_POSTER 1 -#define DLG_FILTERPOSTER_NUM_POSTER 2 - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -#define DLG_FILTEREMBOSS_FT_LIGHT 1 -#define DLG_FILTEREMBOSS_CTL_LIGHT 2 - -#endif diff --git a/cui/source/dialogs/grfflt.src b/cui/source/dialogs/grfflt.src deleted file mode 100644 index c7dc35fa8..000000000 --- a/cui/source/dialogs/grfflt.src +++ /dev/null @@ -1,430 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "helpid.hrc" -#include "grfflt.hrc" -#include - -// -------------------- -// - DLG_FILTERMOSAIC - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_MOSAIC -{ - HelpID = CMD_SID_GRFFILTER_MOSAIC; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Mosaic" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y0 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERMOSAIC_FT_WIDTH - { - Pos = MAP_APPFONT ( 12, MA_Y0 ) ; - Size = MAP_APPFONT ( 77, 10 ) ; - Text [ en-US ] = "~Width" ; - }; -#define MA_Y1 MA_Y0 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERMOSAIC_MTR_WIDTH - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_MTR_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y1 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 999 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " Pixel" ; - First = 1 ; - Last = 999 ; - SpinSize = 1 ; - }; -#define MA_Y2 MA_Y1 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - FixedText DLG_FILTERMOSAIC_FT_HEIGHT - { - Pos = MAP_APPFONT ( 12, MA_Y2 ) ; - Size = MAP_APPFONT ( 77, 10 ) ; - Text [ en-US ] = "H~eight" ; - }; -#define MA_Y3 MA_Y2 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERMOSAIC_MTR_HEIGHT - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_MTR_HEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12, MA_Y3 ) ; - Size = MAP_APPFONT ( 35, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 999 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " Pixel" ; - First = 1 ; - Last = 999 ; - SpinSize = 1 ; - }; -#define MA_Y4 MA_Y3 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_Y - CheckBox DLG_FILTERMOSAIC_CBX_EDGES - { - HelpID = "cui:CheckBox:RID_SVX_GRFFILTER_DLG_MOSAIC:DLG_FILTERMOSAIC_CBX_EDGES"; - Pos = MAP_APPFONT ( 12, MA_Y4 ) ; - Size = MAP_APPFONT ( 91, 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "E~nhance edges" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_SOLARIZE -{ - HelpID = CMD_SID_GRFFILTER_SOLARIZE; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Solarization" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y5 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERSOLARIZE_FT_THRESHOLD - { - Pos = MAP_APPFONT ( 12, MA_Y5 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Threshold ~value" ; - }; -#define MA_Y6 MA_Y5 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERSOLARIZE_MTR_THRESHOLD - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_SOLARIZE:DLG_FILTERSOLARIZE_MTR_THRESHOLD"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y6 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 1 ; - }; -#define MA_Y7 MA_Y6 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - CheckBox DLG_FILTERSOLARIZE_CBX_INVERT - { - HelpID = "cui:CheckBox:RID_SVX_GRFFILTER_DLG_SOLARIZE:DLG_FILTERSOLARIZE_CBX_INVERT"; - Pos = MAP_APPFONT ( 12, 46 ) ; - Size = MAP_APPFONT ( 77, 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Invert" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// ---------------------- -// - DLG_FILTERSOLARIZE - -// ---------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_SEPIA -{ - HelpID = CMD_SID_GRFFILTER_SEPIA; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Aging" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y8 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERSEPIA_FT_SEPIA - { - Pos = MAP_APPFONT ( 12 , MA_Y8 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Aging degree" ; - }; -#define MA_Y9 MA_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - MetricField DLG_FILTERSEPIA_MTR_SEPIA - { - HelpID = "cui:MetricField:RID_SVX_GRFFILTER_DLG_SEPIA:DLG_FILTERSEPIA_MTR_SEPIA"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y9 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 1 ; - Last = 100 ; - SpinSize = 1 ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// -------------------- -// - DLG_FILTERPOSTER - -// -------------------- - -ModalDialog RID_SVX_GRFFILTER_DLG_POSTER -{ - HelpID = CMD_SID_GRFFILTER_POSTER; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Posterize" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y10 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTERPOSTER_FT_POSTER - { - Pos = MAP_APPFONT ( 12 , MA_Y10 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Poster colors" ; - }; -#define MA_Y11 MA_Y10 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - NumericField DLG_FILTERPOSTER_NUM_POSTER - { - HelpID = "cui:NumericField:RID_SVX_GRFFILTER_DLG_POSTER:DLG_FILTERPOSTER_NUM_POSTER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y11 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 64 ; - StrictFormat = TRUE ; - First = 2 ; - Last = 64 ; - SpinSize = 1 ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; - -// -------------------- -// - DLG_FILTEREMBOSS - -// -------------------- - -TabPage RID_SVX_GRFFILTER_DLG_EMBOSS_TAB -{ - HelpID = "cui:TabPage:RID_SVX_GRFFILTER_DLG_EMBOSS_TAB"; - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 0, 0 ) ; -}; - -ModalDialog RID_SVX_GRFFILTER_DLG_EMBOSS -{ - HelpID = CMD_SID_GRFFILTER_EMBOSS; - OutputSize = TRUE ; - Moveable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 250, 100 ) ; - - Text [ en-US ] = "Relief" ; - - FixedLine FL_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 182, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Parameters"; - }; - Control CTL_PREVIEW - { - Pos = MAP_APPFONT ( 104 , 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 81, 73 ) ; - }; -#define MA_Y12 3 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - FixedText DLG_FILTEREMBOSS_FT_LIGHT - { - Pos = MAP_APPFONT ( 12 , MA_Y12 ) ; - Size = MAP_APPFONT ( 77 , 10 ) ; - Text [ en-US ] = "Light source" ; - }; -#define MA_Y13 MA_Y12 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y - Control DLG_FILTEREMBOSS_CTL_LIGHT - { - HelpID = HID_GRFFILTER_EMBOSS_LIGHT ; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , MA_Y13 ) ; - Size = MAP_APPFONT ( 77 , 60 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 194, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 194, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 194, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx deleted file mode 100644 index 375302920..000000000 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ /dev/null @@ -1,1883 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hangulhanjadlg.hxx" -#include "hangulhanjadlg.hrc" -#include "commonlingui.hxx" -#include - -#include -#include "helpid.hrc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define HHC editeng::HangulHanjaConversion -#define LINE_CNT static_cast< sal_uInt16 >(2) - -//............................................................................. -namespace svx -{ -//............................................................................. - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::linguistic2; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; - using ::rtl::OUString; - - //------------------------------------------------------------------------- - namespace - { - class FontSwitch - { - private: - OutputDevice& m_rDev; - - public: - inline FontSwitch( OutputDevice& _rDev, const Font& _rTemporaryFont ) - :m_rDev( _rDev ) - { - m_rDev.Push( PUSH_FONT ); - m_rDev.SetFont( _rTemporaryFont ); - } - inline ~FontSwitch( ) - { - m_rDev.Pop( ); - } - }; - } - - //========================================================================= - //= PseudoRubyText - //========================================================================= - /** a class which allows to draw two texts in a pseudo-ruby way (which basically - means one text above or below the other, and a little bit smaller) - */ - class PseudoRubyText - { - public: - enum RubyPosition - { - eAbove, eBelow - }; - - protected: - const String m_sPrimaryText; - const String m_sSecondaryText; - const RubyPosition m_ePosition; - - public: - PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition ); - - public: - void Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, - Rectangle* _pPrimaryLocation = NULL, Rectangle* _pSecondaryLocation = NULL, - ::vcl::ControlLayoutData* _pLayoutData = NULL ); - }; - - //------------------------------------------------------------------------- - PseudoRubyText::PseudoRubyText( const String& _rPrimary, const String& _rSecondary, const RubyPosition _ePosition ) - :m_sPrimaryText( _rPrimary ) - ,m_sSecondaryText( _rSecondary ) - ,m_ePosition( _ePosition ) - { - } - - //------------------------------------------------------------------------- - void PseudoRubyText::Paint( OutputDevice& _rDevice, const Rectangle& _rRect, sal_uInt16 _nTextStyle, - Rectangle* _pPrimaryLocation, Rectangle* _pSecondaryLocation, ::vcl::ControlLayoutData* _pLayoutData ) - { - bool bLayoutOnly = NULL != _pLayoutData; - MetricVector* pTextMetrics = bLayoutOnly ? &_pLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayoutOnly ? &_pLayoutData->m_aDisplayText : NULL; - - Size aPlaygroundSize( _rRect.GetSize() ); - - // the font for the secondary text: - Font aSmallerFont( _rDevice.GetFont() ); - // heuristic: 80% of the original size - aSmallerFont.SetHeight( (long)( 0.8 * aSmallerFont.GetHeight() ) ); - - // let's calculate the size of our two texts - Rectangle aPrimaryRect = _rDevice.GetTextRect( _rRect, m_sPrimaryText, _nTextStyle ); - Rectangle aSecondaryRect; - { - FontSwitch aFontRestore( _rDevice, aSmallerFont ); - aSecondaryRect = _rDevice.GetTextRect( _rRect, m_sSecondaryText, _nTextStyle ); - } - - // position these rectangles properly - // x-axis: - sal_Int32 nCombinedWidth = ::std::max( aSecondaryRect.GetWidth(), aPrimaryRect.GetWidth() ); - // the rectangle where both texts will reside is as high as possible, and as wide as the - // widest of both text rects - aPrimaryRect.Left() = aSecondaryRect.Left() = _rRect.Left(); - aPrimaryRect.Right() = aSecondaryRect.Right() = _rRect.Left() + nCombinedWidth; - if ( TEXT_DRAW_RIGHT & _nTextStyle ) - { - // move the rectangles to the right - aPrimaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 ); - aSecondaryRect.Move( aPlaygroundSize.Width() - nCombinedWidth, 0 ); - } - else if ( TEXT_DRAW_CENTER & _nTextStyle ) - { - // center the rectangles - aPrimaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 ); - aSecondaryRect.Move( ( aPlaygroundSize.Width() - nCombinedWidth ) / 2, 0 ); - } - - // y-axis: - sal_Int32 nCombinedHeight = aPrimaryRect.GetHeight() + aSecondaryRect.GetHeight(); - // align to the top, for the moment - aPrimaryRect.Move( 0, _rRect.Top() - aPrimaryRect.Top() ); - aSecondaryRect.Move( 0, aPrimaryRect.Top() + aPrimaryRect.GetHeight() - aSecondaryRect.Top() ); - if ( TEXT_DRAW_BOTTOM & _nTextStyle ) - { - // move the rects to the bottom - aPrimaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight ); - aSecondaryRect.Move( 0, aPlaygroundSize.Height() - nCombinedHeight ); - } - else if ( TEXT_DRAW_VCENTER & _nTextStyle ) - { - // move the rects to the bottom - aPrimaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 ); - aSecondaryRect.Move( 0, ( aPlaygroundSize.Height() - nCombinedHeight ) / 2 ); - } - - // 'til here, everything we did assumes that the secondary text is painted _below_ the primary - // text. If this isn't the case, we need to correct the rectangles - if ( eAbove == m_ePosition ) - { - sal_Int32 nVertDistance = aSecondaryRect.Top() - aPrimaryRect.Top(); - aSecondaryRect.Move( 0, -nVertDistance ); - aPrimaryRect.Move( 0, nCombinedHeight - nVertDistance ); - } - - // now draw the texts - // as we already calculated the precise rectangles for the texts, we don't want to - // use the alignment flags given - within it's rect, every text is centered - sal_uInt16 nDrawTextStyle( _nTextStyle ); - nDrawTextStyle &= ~( TEXT_DRAW_RIGHT | TEXT_DRAW_LEFT | TEXT_DRAW_BOTTOM | TEXT_DRAW_TOP ); - nDrawTextStyle |= TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER; - - _rDevice.DrawText( aPrimaryRect, m_sPrimaryText, nDrawTextStyle, pTextMetrics, pDisplayText ); - { - FontSwitch aFontRestore( _rDevice, aSmallerFont ); - _rDevice.DrawText( aSecondaryRect, m_sSecondaryText, nDrawTextStyle, pTextMetrics, pDisplayText ); - } - - // outta here - if ( _pPrimaryLocation ) - *_pPrimaryLocation = aPrimaryRect; - if ( _pSecondaryLocation ) - *_pSecondaryLocation = aSecondaryRect; - } - - //========================================================================= - //= RubyRadioButton - //========================================================================= - class RubyRadioButton :public RadioButton - ,protected PseudoRubyText - { - using svx::PseudoRubyText::Paint; - - public: - RubyRadioButton( - Window* _pParent, - const ResId& _rId, // the text in the resource will be taken as primary text - const String& _rSecondary, // this will be the secondary text which will be printed somewhat smaller - const PseudoRubyText::RubyPosition _ePosition ); - - protected: - virtual void Paint( const Rectangle& _rRect ); - }; - - //------------------------------------------------------------------------- - RubyRadioButton::RubyRadioButton( Window* _pParent, const ResId& _rId, - const String& _rSecondary, const PseudoRubyText::RubyPosition _ePosition ) - :RadioButton( _pParent, _rId ) - ,PseudoRubyText( RadioButton::GetText(), _rSecondary, _ePosition ) - { - } - - //------------------------------------------------------------------------- - void RubyRadioButton::Paint( const Rectangle& ) - { - HideFocus(); - - // calculate the size of the radio image - we're to paint our text _after_ this image - DBG_ASSERT( !GetModeRadioImage(), "RubyRadioButton::Paint: images not supported!" ); - Size aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel(); - aImageSize.Width() = CalcZoom( aImageSize.Width() ); - aImageSize.Height() = CalcZoom( aImageSize.Height() ); - - Rectangle aOverallRect( Point( 0, 0 ), GetOutputSizePixel() ); - aOverallRect.Left() += aImageSize.Width() + 4; // 4 is the separator between the image and the text - // inflate the rect a little bit (because the VCL radio button does the same) - Rectangle aTextRect( aOverallRect ); - ++aTextRect.Left(); --aTextRect.Right(); - ++aTextRect.Top(); --aTextRect.Bottom(); - - // calculate the text flags for the painting - sal_uInt16 nTextStyle = TEXT_DRAW_MNEMONIC; - WinBits nStyle = GetStyle( ); - - // the horizontal alignment - if ( nStyle & WB_RIGHT ) - nTextStyle |= TEXT_DRAW_RIGHT; - else if ( nStyle & WB_CENTER ) - nTextStyle |= TEXT_DRAW_CENTER; - else - nTextStyle |= TEXT_DRAW_LEFT; - // the vertical alignment - if ( nStyle & WB_BOTTOM ) - nTextStyle |= TEXT_DRAW_BOTTOM; - else if ( nStyle & WB_VCENTER ) - nTextStyle |= TEXT_DRAW_VCENTER; - else - nTextStyle |= TEXT_DRAW_TOP; - // mnemonics - if ( 0 == ( nStyle & WB_NOLABEL ) ) - nTextStyle |= TEXT_DRAW_MNEMONIC; - - // paint the ruby text - Rectangle aPrimaryTextLocation, aSecondaryTextLocation; - PseudoRubyText::Paint( *this, aTextRect, nTextStyle, &aPrimaryTextLocation, &aSecondaryTextLocation ); - - // the focus rectangle is to be painted around both texts - Rectangle aCombinedRect( aPrimaryTextLocation ); - aCombinedRect.Union( aSecondaryTextLocation ); - SetFocusRect( aCombinedRect ); - - // let the base class paint the radio button - // for this, give it the proper location to paint the image (vertically centered, relative to our text) - Rectangle aImageLocation( Point( 0, 0 ), aImageSize ); - sal_Int32 nTextHeight = aSecondaryTextLocation.Bottom() - aPrimaryTextLocation.Top(); - aImageLocation.Top() = aPrimaryTextLocation.Top() + ( nTextHeight - aImageSize.Height() ) / 2; - aImageLocation.Bottom() = aImageLocation.Top() + aImageSize.Height(); - SetStateRect( aImageLocation ); - DrawRadioButtonState( ); - - // mouse clicks should be recognized in a rect which is one pixel larger in each direction, plus - // includes the image - aCombinedRect.Left() = aImageLocation.Left(); ++aCombinedRect.Right(); - --aCombinedRect.Top(); ++aCombinedRect.Bottom(); - SetMouseRect( aCombinedRect ); - - // paint the focus rect, if necessary - if ( HasFocus() ) - ShowFocus( aTextRect ); - } - - //========================================================================= - //= SuggestionSet - //========================================================================= - //------------------------------------------------------------------------- - - SuggestionSet::SuggestionSet( Window* pParent ) - : ValueSet( pParent, pParent->GetStyle() | WB_BORDER ) - - { - } - - SuggestionSet::~SuggestionSet() - { - ClearSet(); - } - - void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt ) - { - OutputDevice* pDev = rUDEvt.GetDevice(); - Rectangle aRect = rUDEvt.GetRect(); - sal_uInt16 nItemId = rUDEvt.GetItemId(); - - String sText = *static_cast< String* >( GetItemData( nItemId ) ); - pDev->DrawText( aRect, sText, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER ); - } - - void SuggestionSet::ClearSet() - { - sal_uInt16 i, nCount = GetItemCount(); - for ( i = 0; i < nCount; ++i ) - delete static_cast< String* >( GetItemData(i) ); - Clear(); - } - - //========================================================================= - //= SuggestionDisplay - //========================================================================= - //------------------------------------------------------------------------- - - SuggestionDisplay::SuggestionDisplay( Window* pParent, const ResId& rResId ) - : Control( pParent, rResId ) - , m_bDisplayListBox(true) - , m_aValueSet(this) - , m_aListBox(this,GetStyle() | WB_BORDER ) - , m_bInSelectionUpdate(false) - { - m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); - m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) ); - - m_aValueSet.SetLineCount( LINE_CNT ); - m_aValueSet.SetStyle( m_aValueSet.GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL ); - m_aValueSet.SetBorderStyle( WINDOW_BORDER_MONO ); - String aOneCharacter(RTL_CONSTASCII_USTRINGPARAM("AU")); - long nItemWidth = 2*GetTextWidth( aOneCharacter ); - m_aValueSet.SetItemWidth( nItemWidth ); - - Point aPos(0,0); - Size aSize(GetSizePixel()); - m_aValueSet.SetSizePixel(aSize); - m_aListBox.SetSizePixel(aSize); - - implUpdateDisplay(); - } - - SuggestionDisplay::~SuggestionDisplay() - { - } - - void SuggestionDisplay::implUpdateDisplay() - { - bool bShowBox = IsVisible() && m_bDisplayListBox; - bool bShowSet = IsVisible() && !m_bDisplayListBox; - - m_aListBox.Show(bShowBox); - m_aValueSet.Show(bShowSet); - } - - void SuggestionDisplay::StateChanged( StateChangedType nStateChange ) - { - if( STATE_CHANGE_VISIBLE == nStateChange ) - implUpdateDisplay(); - } - - Control& SuggestionDisplay::implGetCurrentControl() - { - if( m_bDisplayListBox ) - return m_aListBox; - return m_aValueSet; - } - - void SuggestionDisplay::KeyInput( const KeyEvent& rKEvt ) - { - implGetCurrentControl().KeyInput( rKEvt ); - } - void SuggestionDisplay::KeyUp( const KeyEvent& rKEvt ) - { - implGetCurrentControl().KeyUp( rKEvt ); - } - void SuggestionDisplay::Activate() - { - implGetCurrentControl().Activate(); - } - void SuggestionDisplay::Deactivate() - { - implGetCurrentControl().Deactivate(); - } - void SuggestionDisplay::GetFocus() - { - implGetCurrentControl().GetFocus(); - } - void SuggestionDisplay::LoseFocus() - { - implGetCurrentControl().LoseFocus(); - } - void SuggestionDisplay::Command( const CommandEvent& rCEvt ) - { - implGetCurrentControl().Command( rCEvt ); - } - - void SuggestionDisplay::DisplayListBox( bool bDisplayListBox ) - { - if( m_bDisplayListBox != bDisplayListBox ) - { - Control& rOldControl = implGetCurrentControl(); - sal_Bool bHasFocus = rOldControl.HasFocus(); - - m_bDisplayListBox = bDisplayListBox; - - if( bHasFocus ) - { - Control& rNewControl = implGetCurrentControl(); - rNewControl.GrabFocus(); - } - - implUpdateDisplay(); - } - } - - IMPL_LINK( SuggestionDisplay, SelectSuggestionHdl, Control*, pControl ) - { - if( m_bInSelectionUpdate ) - return 0L; - - m_bInSelectionUpdate = true; - if(pControl==&m_aListBox) - { - sal_uInt16 nPos = m_aListBox.GetSelectEntryPos(); - m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning) - } - else - { - sal_uInt16 nPos = m_aValueSet.GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning) - m_aListBox.SelectEntryPos( nPos ); - } - m_bInSelectionUpdate = false; - m_aSelectLink.Call(this); - return 0L; - } - - void SuggestionDisplay::SetSelectHdl( const Link& rLink ) - { - m_aSelectLink = rLink; - } - void SuggestionDisplay::Clear() - { - m_aListBox.Clear(); - m_aValueSet.Clear(); - } - void SuggestionDisplay::InsertEntry( const XubString& rStr ) - { - sal_uInt16 nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning) - m_aValueSet.InsertItem( nItemId ); - String* pItemData = new String(rStr); - m_aValueSet.SetItemData( nItemId, pItemData ); - } - void SuggestionDisplay::SelectEntryPos( sal_uInt16 nPos ) - { - m_aListBox.SelectEntryPos( nPos ); - m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning) - } - sal_uInt16 SuggestionDisplay::GetEntryCount() const - { - return m_aListBox.GetEntryCount(); - } - XubString SuggestionDisplay::GetEntry( sal_uInt16 nPos ) const - { - return m_aListBox.GetEntry( nPos ); - } - XubString SuggestionDisplay::GetSelectEntry() const - { - return m_aListBox.GetSelectEntry(); - } - void SuggestionDisplay::SetHelpIds() - { - this->SetHelpId( HID_HANGULDLG_SUGGESTIONS ); - m_aValueSet.SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID ); - m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST ); - } - - //========================================================================= - //= HangulHanjaConversionDialog - //========================================================================= - //------------------------------------------------------------------------- - HangulHanjaConversionDialog::HangulHanjaConversionDialog( Window* _pParent, HHC::ConversionDirection _ePrimaryDirection ) - :ModalDialog( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA ) ) - ,m_pPlayground( new SvxCommonLinguisticControl( this ) ) - ,m_aFind ( m_pPlayground.get(), CUI_RES( PB_FIND ) ) - ,m_aSuggestions ( m_pPlayground.get(), CUI_RES( CTL_SUGGESTIONS ) ) - ,m_aFormat ( m_pPlayground.get(), CUI_RES( FT_FORMAT ) ) - ,m_aSimpleConversion( m_pPlayground.get(), CUI_RES( RB_SIMPLE_CONVERSION ) ) - ,m_aHangulBracketed ( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BRACKETED ) ) - ,m_aHanjaBracketed ( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BRACKETED ) ) - ,m_aConversion ( m_pPlayground.get(), CUI_RES( FT_CONVERSION ) ) - ,m_aHangulOnly ( m_pPlayground.get(), CUI_RES( CB_HANGUL_ONLY ) ) - ,m_aHanjaOnly ( m_pPlayground.get(), CUI_RES( CB_HANJA_ONLY ) ) - ,m_aReplaceByChar ( m_pPlayground.get(), CUI_RES( CB_REPLACE_BY_CHARACTER ) ) - ,m_pIgnoreNonPrimary( NULL ) - ,m_bDocumentMode( true ) - { - // special creation of the 4 pseudo-ruby radio buttons - String sSecondaryHangul( CUI_RES( STR_HANGUL ) ); - String sSecondaryHanja( CUI_RES( STR_HANJA ) ); - m_pHanjaAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_ABOVE ), sSecondaryHanja, PseudoRubyText::eAbove ) ); - m_pHanjaBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANGUL_HANJA_BELOW ), sSecondaryHanja, PseudoRubyText::eBelow ) ); - m_pHangulAbove.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_ABOVE ), sSecondaryHangul, PseudoRubyText::eAbove ) ); - m_pHangulBelow.reset( new RubyRadioButton( m_pPlayground.get(), CUI_RES( RB_HANJA_HANGUL_BELOW ), sSecondaryHangul, PseudoRubyText::eBelow ) ); - - // since these 4 buttons are not created within the other members, they have a wrong initial Z-Order - // correct this - m_pHanjaAbove->SetZOrder( &m_aHanjaBracketed, WINDOW_ZORDER_BEHIND ); - m_pHanjaBelow->SetZOrder( m_pHanjaAbove.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulAbove->SetZOrder( m_pHanjaBelow.get(), WINDOW_ZORDER_BEHIND ); - m_pHangulBelow->SetZOrder( m_pHangulAbove.get(), WINDOW_ZORDER_BEHIND ); - - // VCL automatically sets the WB_GROUP bit, if the previous sibling (at the moment of creation) - // is no radion button - m_pHanjaAbove->SetStyle( m_pHanjaAbove->GetStyle() & ~WB_GROUP ); - - // the "Find" button and the word input control may not have the proper distance/extensions - // -> correct this - Point aDistance = LogicToPixel( Point( 3, 0 ), MAP_APPFONT ); - sal_Int32 nTooLargeByPixels = - // right margin of the word input control - ( m_pPlayground->GetWordInputControl().GetPosPixel().X() - + m_pPlayground->GetWordInputControl().GetSizePixel().Width() - ) - // minus left margin of the find button - - m_aFind.GetPosPixel().X() - // plus desired distance between the both - + aDistance.X(); - // make the word input control smaller - Size aSize = m_pPlayground->GetWordInputControl().GetSizePixel(); - aSize.Width() -= nTooLargeByPixels; - m_pPlayground->GetWordInputControl().SetSizePixel( aSize ); - - // additionall, the playground is not wide enough (in it's default size) - sal_Int32 nEnlargeWidth = 0; - { - FixedText aBottomAnchor( m_pPlayground.get(), CUI_RES( FT_RESIZE_ANCHOR ) ); - Point aAnchorPos = aBottomAnchor.GetPosPixel(); - - nEnlargeWidth = aAnchorPos.X() - m_pPlayground->GetActionButtonsLocation().X(); - } - m_pPlayground->Enlarge( nEnlargeWidth, 0 ); - - // insert our controls into the z-order of the playground - m_pPlayground->InsertControlGroup( m_aFind, m_aFind, SvxCommonLinguisticControl::eLeftRightWords ); - m_pPlayground->InsertControlGroup( m_aSuggestions, m_aHanjaOnly, SvxCommonLinguisticControl::eSuggestionLabel ); - m_pPlayground->InsertControlGroup( m_aReplaceByChar, m_aReplaceByChar, SvxCommonLinguisticControl::eActionButtons ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eClose, LINK( this, HangulHanjaConversionDialog, OnClose ) ); - m_pPlayground->GetWordInputControl().SetModifyHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionModified ) ); - m_aSuggestions.SetSelectHdl( LINK( this, HangulHanjaConversionDialog, OnSuggestionSelected ) ); - - m_aReplaceByChar.SetClickHdl( LINK( this, HangulHanjaConversionDialog, ClickByCharacterHdl ) ); - - m_aHangulOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - m_aHanjaOnly.SetClickHdl( LINK( this, HangulHanjaConversionDialog, OnConversionDirectionClicked ) ); - - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eOptions, - LINK( this, HangulHanjaConversionDialog, OnOption ) ); - m_pPlayground->GetButton( SvxCommonLinguisticControl::eOptions )->Show(); - - if ( editeng::HangulHanjaConversion::eHangulToHanja == _ePrimaryDirection ) - { - m_pIgnoreNonPrimary = &m_aHangulOnly; - } - else - { - m_pIgnoreNonPrimary = &m_aHanjaOnly; - } - - // initial focus - FocusSuggestion( ); - - // initial control values - m_aSimpleConversion.Check(); - - m_pPlayground->GetButton(SvxCommonLinguisticControl::eClose )->SetHelpId(HID_HANGULDLG_BUTTON_CLOSE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnore )->SetHelpId(HID_HANGULDLG_BUTTON_IGNORE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eIgnoreAll )->SetHelpId(HID_HANGULDLG_BUTTON_IGNOREALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChange )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGE ); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eChangeAll )->SetHelpId(HID_HANGULDLG_BUTTON_CHANGEALL); - m_pPlayground->GetButton(SvxCommonLinguisticControl::eOptions )->SetHelpId(HID_HANGULDLG_BUTTON_OPTIONS ); - m_pPlayground->GetWordInputControl().SetHelpId(HID_HANGULDLG_EDIT_NEWWORD); - - FreeResource(); - - m_aSuggestions.SetHelpIds(); - } - - //------------------------------------------------------------------------- - HangulHanjaConversionDialog::~HangulHanjaConversionDialog( ) - { - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions ) - { - m_aSuggestions.Clear(); - - const ::rtl::OUString* pSuggestions = _rSuggestions.getConstArray(); - const ::rtl::OUString* pSuggestionsEnd = _rSuggestions.getConstArray() + _rSuggestions.getLength(); - while ( pSuggestions != pSuggestionsEnd ) - m_aSuggestions.InsertEntry( *pSuggestions++ ); - - // select the first suggestion, and fill in the suggestion edit field - String sFirstSuggestion; - if ( m_aSuggestions.GetEntryCount() ) - { - sFirstSuggestion = m_aSuggestions.GetEntry( 0 ); - m_aSuggestions.SelectEntryPos( 0 ); - } - m_pPlayground->GetWordInputControl().SetText( sFirstSuggestion ); - m_pPlayground->GetWordInputControl().SaveValue(); - OnSuggestionModified( &m_pPlayground->GetWordInputControl() ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetOptionsChangedHdl( const Link& _rHdl ) - { - m_aOptionsChangedLink = _rHdl; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetIgnoreHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnore, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetIgnoreAllHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eIgnoreAll, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetChangeHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChange, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetChangeAllHdl( const Link& _rHdl ) - { - m_pPlayground->SetButtonHandler( SvxCommonLinguisticControl::eChangeAll, _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetFindHdl( const Link& _rHdl ) - { - m_aFind.SetClickHdl( _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionFormatChangedHdl( const Link& _rHdl ) - { - m_aSimpleConversion.SetClickHdl( _rHdl ); - m_aHangulBracketed.SetClickHdl( _rHdl ); - m_aHanjaBracketed.SetClickHdl( _rHdl ); - m_pHanjaAbove->SetClickHdl( _rHdl ); - m_pHanjaBelow->SetClickHdl( _rHdl ); - m_pHangulAbove->SetClickHdl( _rHdl ); - m_pHangulBelow->SetClickHdl( _rHdl ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetClickByCharacterHdl( const Link& _rHdl ) - { - m_aClickByCharacterLink = _rHdl; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionSelected, void*, EMPTYARG ) - { - m_pPlayground->GetWordInputControl().SetText( m_aSuggestions.GetSelectEntry() ); - OnSuggestionModified( NULL ); - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnSuggestionModified, void*, EMPTYARG ) - { - m_aFind.Enable( m_pPlayground->GetWordInputControl().GetSavedValue() != m_pPlayground->GetWordInputControl().GetText() ); - - bool bSameLen = m_pPlayground->GetWordInputControl().GetText().Len() == m_pPlayground->GetCurrentText().Len(); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChange, m_bDocumentMode && bSameLen ); - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eChangeAll, m_bDocumentMode && bSameLen ); - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, ClickByCharacterHdl, CheckBox *, pBox ) - { - m_aClickByCharacterLink.Call(pBox); - - bool bByCharacter = pBox->IsChecked(); - m_aSuggestions.DisplayListBox( !bByCharacter ); - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnConversionDirectionClicked, CheckBox *, pBox ) - { - CheckBox *pOtherBox = 0; - if (pBox == &m_aHangulOnly) - pOtherBox = &m_aHanjaOnly; - else if (pBox == &m_aHanjaOnly) - pOtherBox = &m_aHangulOnly; - if (pBox && pOtherBox) - { - sal_Bool bBoxChecked = pBox->IsChecked(); - if (bBoxChecked) - pOtherBox->Check( sal_False ); - pOtherBox->Enable( !bBoxChecked ); - } - - return 0L; - } - - //------------------------------------------------------------------------- - IMPL_LINK( HangulHanjaConversionDialog, OnClose, void*, EMPTYARG ) - { - Close(); - return 0L; - } - - IMPL_LINK( HangulHanjaConversionDialog, OnOption, void*, EMPTYARG ) - { - HangulHanjaOptionsDialog aOptDlg( this ); - aOptDlg.Execute(); - m_aOptionsChangedLink.Call(this); - return 0L; - } - - //------------------------------------------------------------------------- - String HangulHanjaConversionDialog::GetCurrentString( ) const - { - return m_pPlayground->GetCurrentText( ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::FocusSuggestion( ) - { - m_pPlayground->GetWordInputControl().GrabFocus(); - } - - //------------------------------------------------------------------------- - namespace - { - void lcl_modifyWindowStyle( Window* _pWin, WinBits _nSet, WinBits _nReset ) - { - DBG_ASSERT( 0 == ( _nSet & _nReset ), "lcl_modifyWindowStyle: set _and_ reset the same bit?" ); - if ( _pWin ) - _pWin->SetStyle( ( _pWin->GetStyle() | _nSet ) & ~_nReset ); - } - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetCurrentString( const String& _rNewString, - const Sequence< ::rtl::OUString >& _rSuggestions, bool _bOriginatesFromDocument ) - { - m_pPlayground->SetCurrentText( _rNewString ); - - bool bOldDocumentMode = m_bDocumentMode; - m_bDocumentMode = _bOriginatesFromDocument; // before FillSuggestions! - FillSuggestions( _rSuggestions ); - - m_pPlayground->EnableButton( SvxCommonLinguisticControl::eIgnoreAll, m_bDocumentMode ); - // all other buttons have been implicitly enabled or disabled during filling in the suggestions - - // switch the def button depending if we're working for document text - if ( bOldDocumentMode != m_bDocumentMode ) - { - Window* pOldDefButton = NULL; - Window* pNewDefButton = NULL; - if ( m_bDocumentMode ) - { - pOldDefButton = &m_aFind; - pNewDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); - } - else - { - pOldDefButton = m_pPlayground->GetButton( SvxCommonLinguisticControl::eChange ); - pNewDefButton = &m_aFind; - } - - DBG_ASSERT( WB_DEFBUTTON == ( pOldDefButton->GetStyle( ) & WB_DEFBUTTON ), - "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (1)!" ); - DBG_ASSERT( 0 == ( pNewDefButton->GetStyle( ) & WB_DEFBUTTON ), - "HangulHanjaConversionDialog::SetCurrentString: wrong previous default button (2)!" ); - - lcl_modifyWindowStyle( pOldDefButton, 0, WB_DEFBUTTON ); - lcl_modifyWindowStyle( pNewDefButton, WB_DEFBUTTON, 0 ); - - // give the focus to the new def button temporarily - VCL is somewhat peculiar - // in recognizing a new default button - sal_uInt32 nSaveFocusId = Window::SaveFocus(); - pNewDefButton->GrabFocus(); - Window::EndSaveFocus( nSaveFocusId ); - } - } - - //------------------------------------------------------------------------- - String HangulHanjaConversionDialog::GetCurrentSuggestion( ) const - { - return m_pPlayground->GetWordInputControl().GetText(); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetByCharacter( sal_Bool _bByCharacter ) - { - m_aReplaceByChar.Check( _bByCharacter ); - m_aSuggestions.DisplayListBox( !_bByCharacter ); - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionDirectionState( - sal_Bool _bTryBothDirections, - HHC::ConversionDirection _ePrimaryConversionDirection ) - { - // default state: try both direction - m_aHangulOnly.Check( sal_False ); - m_aHangulOnly.Enable( sal_True ); - m_aHanjaOnly.Check( sal_False ); - m_aHanjaOnly.Enable( sal_True ); - - if (!_bTryBothDirections) - { - CheckBox *pBox = _ePrimaryConversionDirection == HHC::eHangulToHanja? - &m_aHangulOnly : &m_aHanjaOnly; - pBox->Check( sal_True ); - OnConversionDirectionClicked( pBox ); - } - } - - //------------------------------------------------------------------------- - sal_Bool HangulHanjaConversionDialog::GetUseBothDirections( ) const - { - return !m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked(); - } - - //------------------------------------------------------------------------- - HHC::ConversionDirection HangulHanjaConversionDialog::GetDirection( - HHC::ConversionDirection eDefaultDirection ) const - { - HHC::ConversionDirection eDirection = eDefaultDirection; - if (m_aHangulOnly.IsChecked() && !m_aHanjaOnly.IsChecked()) - eDirection = HHC::eHangulToHanja; - else if (!m_aHangulOnly.IsChecked() && m_aHanjaOnly.IsChecked()) - eDirection = HHC::eHanjaToHangul; - return eDirection; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::SetConversionFormat( HHC::ConversionFormat _eType ) - { - switch ( _eType ) - { - case HHC::eSimpleConversion: m_aSimpleConversion.Check(); break; - case HHC::eHangulBracketed: m_aHangulBracketed.Check(); break; - case HHC::eHanjaBracketed: m_aHanjaBracketed.Check(); break; - case HHC::eRubyHanjaAbove: m_pHanjaAbove->Check(); break; - case HHC::eRubyHanjaBelow: m_pHanjaBelow->Check(); break; - case HHC::eRubyHangulAbove: m_pHangulAbove->Check(); break; - case HHC::eRubyHangulBelow: m_pHangulBelow->Check(); break; - default: - OSL_FAIL( "HangulHanjaConversionDialog::SetConversionFormat: unknown type!" ); - } - } - - //------------------------------------------------------------------------- - HHC::ConversionFormat HangulHanjaConversionDialog::GetConversionFormat( ) const - { - if ( m_aSimpleConversion.IsChecked() ) - return HHC::eSimpleConversion; - if ( m_aHangulBracketed.IsChecked() ) - return HHC::eHangulBracketed; - if ( m_aHanjaBracketed.IsChecked() ) - return HHC::eHanjaBracketed; - if ( m_pHanjaAbove->IsChecked() ) - return HHC::eRubyHanjaAbove; - if ( m_pHanjaBelow->IsChecked() ) - return HHC::eRubyHanjaBelow; - if ( m_pHangulAbove->IsChecked() ) - return HHC::eRubyHangulAbove; - if ( m_pHangulBelow->IsChecked() ) - return HHC::eRubyHangulBelow; - - OSL_FAIL( "HangulHanjaConversionDialog::GetConversionFormat: no radio checked?" ); - return HHC::eSimpleConversion; - } - - //------------------------------------------------------------------------- - void HangulHanjaConversionDialog::EnableRubySupport( sal_Bool bVal ) - { - m_pHanjaAbove->Enable( bVal ); - m_pHanjaBelow->Enable( bVal ); - m_pHangulAbove->Enable( bVal ); - m_pHangulBelow->Enable( bVal ); - } - - - //========================================================================= - //= HangulHanjaOptionsDialog - //========================================================================= - //------------------------------------------------------------------------- - - void HangulHanjaOptionsDialog::Init( void ) - { - if( !m_xConversionDictionaryList.is() ) - { - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - m_xConversionDictionaryList = Reference< XConversionDictionaryList >( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.ConversionDictionaryList")) ), - UNO_QUERY ); - } - } - - m_aDictList.clear(); - m_aDictsLB.Clear(); - - if( m_xConversionDictionaryList.is() ) - { - Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer(); - Reference< XNameAccess > xNameAccess = Reference< XNameAccess >( xNameCont, UNO_QUERY ); - if( xNameAccess.is() ) - { - Sequence< ::rtl::OUString > aDictNames( xNameAccess->getElementNames() ); - - const ::rtl::OUString* pDic = aDictNames.getConstArray(); - sal_Int32 nCount = aDictNames.getLength(); - - sal_Int32 i; - for( i = 0 ; i < nCount ; ++i ) - { - Any aAny( xNameAccess->getByName( pDic[ i ] ) ); - Reference< XConversionDictionary > xDic; - if( ( aAny >>= xDic ) && xDic.is() ) - { - if( LANGUAGE_KOREAN == SvxLocaleToLanguage( xDic->getLocale() ) ) - { - m_aDictList.push_back( xDic ); - AddDict( xDic->getName(), xDic->isActive() ); - } - } - } - } - } - } - - IMPL_LINK( HangulHanjaOptionsDialog, OkHdl, void*, EMPTYARG ) - { - sal_uInt32 nCnt = m_aDictList.size(); - sal_uInt32 n = 0; - sal_uInt32 nActiveDics = 0; - Sequence< OUString > aActiveDics; - - aActiveDics.realloc( nCnt ); - OUString* pActActiveDic = aActiveDics.getArray(); - - while( nCnt ) - { - Reference< XConversionDictionary > xDict = m_aDictList[ n ]; - SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::GetEntry( n ); - - DBG_ASSERT( xDict.is(), "-HangulHanjaOptionsDialog::OkHdl(): someone is evaporated..." ); - DBG_ASSERT( pEntry, "-HangulHanjaOptionsDialog::OkHdl(): no one there in list?" ); - - bool bActive = m_aDictsLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED; - xDict->setActive( bActive ); - Reference< util::XFlushable > xFlush( xDict, uno::UNO_QUERY ); - if( xFlush.is() ) - xFlush->flush(); - - if( bActive ) - { - pActActiveDic[ nActiveDics ] = xDict->getName(); - ++nActiveDics; - } - - ++n; - --nCnt; - } - - // save configuration - aActiveDics.realloc( nActiveDics ); - Any aTmp; - SvtLinguConfig aLngCfg; - aTmp <<= aActiveDics; - aLngCfg.SetProperty( UPH_ACTIVE_CONVERSION_DICTIONARIES, aTmp ); - - aTmp <<= bool( m_aIgnorepostCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD, aTmp ); - - aTmp <<= bool( m_aShowrecentlyfirstCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, aTmp ); - - aTmp <<= bool( m_aAutoreplaceuniqueCB.IsChecked() ); - aLngCfg.SetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES, aTmp ); - - EndDialog( RET_OK ); - return 0; - } - - IMPL_LINK( HangulHanjaOptionsDialog, DictsLB_SelectHdl, void*, EMPTYARG ) - { - bool bSel = m_aDictsLB.FirstSelected() != NULL; - - m_aEditPB.Enable( bSel ); - m_aDeletePB.Enable( bSel ); - - return 0; - } - - IMPL_LINK( HangulHanjaOptionsDialog, NewDictHdl, void*, EMPTYARG ) - { - String aName; - HangulHanjaNewDictDialog aNewDlg( this ); - aNewDlg.Execute(); - if( aNewDlg.GetName( aName ) ) - { - if( m_xConversionDictionaryList.is() ) - { - try - { - Reference< XConversionDictionary > xDic = - m_xConversionDictionaryList->addNewDictionary( aName, SvxCreateLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA ); - - if( xDic.is() ) - { - //adapt local caches: - m_aDictList.push_back( xDic ); - AddDict( xDic->getName(), xDic->isActive() ); - } - } - catch( const ElementExistException& ) - { - } - catch( const NoSupportException& ) - { - } - } - } - - return 0L; - } - - IMPL_LINK( HangulHanjaOptionsDialog, EditDictHdl, void*, EMPTYARG ) - { - SvLBoxEntry* pEntry = m_aDictsLB.FirstSelected(); - DBG_ASSERT( pEntry, "+HangulHanjaEditDictDialog::EditDictHdl(): call of edit should not be possible with no selection!" ); - if( pEntry ) - { - HangulHanjaEditDictDialog aEdDlg( this, m_aDictList, m_aDictsLB.GetSelectEntryPos() ); - aEdDlg.Execute(); - } - return 0L; - } - - IMPL_LINK( HangulHanjaOptionsDialog, DeleteDictHdl, void*, EMPTYARG ) - { - sal_uInt16 nSelPos = m_aDictsLB.GetSelectEntryPos(); - if( nSelPos != LISTBOX_ENTRY_NOTFOUND ) - { - Reference< XConversionDictionary > xDic( m_aDictList[ nSelPos ] ); - if( m_xConversionDictionaryList.is() && xDic.is() ) - { - Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer(); - if( xNameCont.is() ) - { - try - { - xNameCont->removeByName( xDic->getName() ); - - //adapt local caches: - HHDictList::iterator aIter(m_aDictList.begin()); - m_aDictList.erase(aIter+nSelPos ); - m_aDictsLB.RemoveEntry( nSelPos ); - } - catch( const ElementExistException& ) - { - } - catch( const NoSupportException& ) - { - } - } - } - } - - return 0L; - } - - HangulHanjaOptionsDialog::HangulHanjaOptionsDialog( Window* _pParent ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_OPT ) ) - ,m_aUserdefdictFT ( this, CUI_RES( FT_USERDEFDICT ) ) - ,m_aDictsLB ( this, CUI_RES( LB_DICTS ) ) - ,m_aOptionsFL ( this, CUI_RES( FL_OPTIONS ) ) - ,m_aIgnorepostCB ( this, CUI_RES( CB_IGNOREPOST ) ) - ,m_aShowrecentlyfirstCB ( this, CUI_RES( CB_SHOWRECENTLYFIRST ) ) - ,m_aAutoreplaceuniqueCB ( this, CUI_RES( CB_AUTOREPLACEUNIQUE ) ) - ,m_aNewPB ( this, CUI_RES( PB_HHO_NEW ) ) - ,m_aEditPB ( this, CUI_RES( PB_HHO_EDIT ) ) - ,m_aDeletePB ( this, CUI_RES( PB_HHO_DELETE ) ) - ,m_aOkPB ( this, CUI_RES( PB_HHO_OK ) ) - ,m_aCancelPB ( this, CUI_RES( PB_HHO_CANCEL ) ) - ,m_aHelpPB ( this, CUI_RES( PB_HHO_HELP ) ) - - ,m_pCheckButtonData ( NULL ) - ,m_xConversionDictionaryList( NULL ) - { - m_aDictsLB.SetStyle( m_aDictsLB.GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); - m_aDictsLB.SetSelectionMode( SINGLE_SELECTION ); - m_aDictsLB.SetHighlightRange(); - m_aDictsLB.SetSelectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) ); - m_aDictsLB.SetDeselectHdl( LINK( this, HangulHanjaOptionsDialog, DictsLB_SelectHdl ) ); - - m_aOkPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, OkHdl ) ); - m_aNewPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, NewDictHdl ) ); - m_aEditPB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, EditDictHdl ) ); - m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaOptionsDialog, DeleteDictHdl ) ); - - FreeResource(); - - SvtLinguConfig aLngCfg; - Any aTmp; - bool bVal = bool(); - aTmp = aLngCfg.GetProperty( UPH_IS_IGNORE_POST_POSITIONAL_WORD ); - if( aTmp >>= bVal ) - m_aIgnorepostCB.Check( bVal ); - - aTmp = aLngCfg.GetProperty( UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST ); - if( aTmp >>= bVal ) - m_aShowrecentlyfirstCB.Check( bVal ); - - aTmp = aLngCfg.GetProperty( UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES ); - if( aTmp >>= bVal ) - m_aAutoreplaceuniqueCB.Check( bVal ); - - Init(); - } - - HangulHanjaOptionsDialog::~HangulHanjaOptionsDialog() - { - SvLBoxEntry* pEntry = m_aDictsLB.First(); - String* pDel; - while( pEntry ) - { - pDel = ( String* ) pEntry->GetUserData(); - if( pDel ) - delete pDel; - pEntry = m_aDictsLB.Next( pEntry ); - } - - if( m_pCheckButtonData ) - delete m_pCheckButtonData; - } - - void HangulHanjaOptionsDialog::AddDict( const String& _rName, bool _bChecked ) - { - SvLBoxEntry* pEntry = m_aDictsLB.SvTreeListBox::InsertEntry( _rName ); - m_aDictsLB.SetCheckButtonState( pEntry, _bChecked? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData( new String( _rName ) ); - } - - //========================================================================= - //= HangulHanjaNewDictDialog - //========================================================================= - //------------------------------------------------------------------------- - - IMPL_LINK( HangulHanjaNewDictDialog, OKHdl, void*, EMPTYARG ) - { - String aName( m_aDictNameED.GetText() ); - - aName.EraseTrailingChars(); - m_bEntered = aName.Len() > 0; - if( m_bEntered ) - m_aDictNameED.SetText( aName ); // do this in case of trailing chars have been deleted - - EndDialog( RET_OK ); - return 0; - } - - IMPL_LINK( HangulHanjaNewDictDialog, ModifyHdl, void*, EMPTYARG ) - { - String aName( m_aDictNameED.GetText() ); - - aName.EraseTrailingChars(); - m_aOkBtn.Enable( aName.Len() > 0 ); - - return 0; - } - - HangulHanjaNewDictDialog::HangulHanjaNewDictDialog( Window* _pParent ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_NEWDICT ) ) - ,m_aNewDictFL ( this, CUI_RES( FL_NEWDICT ) ) - ,m_aDictNameFT ( this, CUI_RES( FT_DICTNAME ) ) - ,m_aDictNameED ( this, CUI_RES( ED_DICTNAME ) ) - ,m_aOkBtn ( this, CUI_RES( PB_NEWDICT_OK ) ) - ,m_aCancelBtn ( this, CUI_RES( PB_NEWDICT_ESC ) ) - ,m_aHelpBtn ( this, CUI_RES( PB_NEWDICT_HLP ) ) - - ,m_bEntered ( false ) - { - m_aOkBtn.SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) ); - - m_aDictNameED.SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) ); - - FreeResource(); - } - - HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog() - { - } - - bool HangulHanjaNewDictDialog::GetName( String& _rRetName ) const - { - if( m_bEntered ) - { - _rRetName = m_aDictNameED.GetText(); - _rRetName.EraseTrailingChars(); - } - - return m_bEntered; - } - - //========================================================================= - //= HangulHanjaEditDictDialog - //========================================================================= - //------------------------------------------------------------------------- - - class SuggestionList - { - private: - protected: - sal_uInt16 m_nSize; - String** m_ppElements; - sal_uInt16 m_nNumOfEntries; - sal_uInt16 m_nAct; - - const String* _Next( void ); - public: - SuggestionList( sal_uInt16 _nNumOfElements ); - virtual ~SuggestionList(); - - bool Set( const String& _rElement, sal_uInt16 _nNumOfElement ); - bool Reset( sal_uInt16 _nNumOfElement ); - const String* Get( sal_uInt16 _nNumOfElement ) const; - void Clear( void ); - - const String* First( void ); - const String* Next( void ); - - inline sal_uInt16 GetCount( void ) const; - }; - - inline sal_uInt16 SuggestionList::GetCount( void ) const - { - return m_nNumOfEntries; - } - - SuggestionList::SuggestionList( sal_uInt16 _nNumOfElements ) - { - if( !_nNumOfElements ) - _nNumOfElements = 1; - - m_nSize = _nNumOfElements; - - m_ppElements = new String*[ m_nSize ]; - m_nAct = m_nNumOfEntries = 0; - - String** ppNull = m_ppElements; - sal_uInt16 n = _nNumOfElements; - while( n ) - { - *ppNull = NULL; - ++ppNull; - --n; - } - } - - SuggestionList::~SuggestionList() - { - Clear(); - } - - bool SuggestionList::Set( const String& _rElement, sal_uInt16 _nNumOfElement ) - { - bool bRet = _nNumOfElement < m_nSize; - if( bRet ) - { - String** ppElem = m_ppElements + _nNumOfElement; - if( *ppElem ) - **ppElem = _rElement; - else - { - *ppElem = new String( _rElement ); - ++m_nNumOfEntries; - } - } - - return bRet; - } - - bool SuggestionList::Reset( sal_uInt16 _nNumOfElement ) - { - bool bRet = _nNumOfElement < m_nSize; - if( bRet ) - { - String** ppElem = m_ppElements + _nNumOfElement; - if( *ppElem ) - { - delete *ppElem; - *ppElem = NULL; - --m_nNumOfEntries; - } - } - - return bRet; - } - - const String* SuggestionList::Get( sal_uInt16 _nNumOfElement ) const - { - const String* pRet; - - if( _nNumOfElement < m_nSize ) - pRet = m_ppElements[ _nNumOfElement ]; - else - pRet = NULL; - - return pRet; - } - - void SuggestionList::Clear( void ) - { - if( m_nNumOfEntries ) - { - String** ppDel = m_ppElements; - sal_uInt16 nCnt = m_nSize; - while( nCnt ) - { - if( *ppDel ) - { - delete *ppDel; - *ppDel = NULL; - } - - ++ppDel; - --nCnt; - } - - m_nNumOfEntries = m_nAct = 0; - } - } - - const String* SuggestionList::_Next( void ) - { - const String* pRet = NULL; - while( m_nAct < m_nSize && !pRet ) - { - pRet = m_ppElements[ m_nAct ]; - if( !pRet ) - ++m_nAct; - } - - return pRet; - } - - const String* SuggestionList::First( void ) - { - m_nAct = 0; - return _Next(); - } - - const String* SuggestionList::Next( void ) - { - const String* pRet; - - if( m_nAct < m_nNumOfEntries ) - { - ++m_nAct; - pRet = _Next(); - } - else - pRet = NULL; - - return pRet; - } - - - bool SuggestionEdit::ShouldScroll( bool _bUp ) const - { - bool bRet = false; - - if( _bUp ) - { - if( !m_pPrev ) - bRet = m_rScrollBar.GetThumbPos() > m_rScrollBar.GetRangeMin(); - } - else - { - if( !m_pNext ) - bRet = m_rScrollBar.GetThumbPos() < ( m_rScrollBar.GetRangeMax() - 4 ); - } - - return bRet; - } - - void SuggestionEdit::DoJump( bool _bUp ) - { - const Link& rLoseFocusHdl = GetLoseFocusHdl(); - if( rLoseFocusHdl.IsSet() ) - rLoseFocusHdl.Call( this ); - m_rScrollBar.SetThumbPos( m_rScrollBar.GetThumbPos() + ( _bUp? -1 : 1 ) ); - - ( static_cast< HangulHanjaEditDictDialog* >( GetParent() ) )->UpdateScrollbar(); - } - - SuggestionEdit::SuggestionEdit( Window* pParent, const ResId& rResId, - ScrollBar& _rScrollBar, SuggestionEdit* _pPrev, SuggestionEdit* _pNext ) - :Edit( pParent, rResId ) - ,m_pPrev( _pPrev ) - ,m_pNext( _pNext ) - ,m_rScrollBar( _rScrollBar ) - { - } - - SuggestionEdit::~SuggestionEdit() - { - } - - long SuggestionEdit::PreNotify( NotifyEvent& rNEvt ) - { - long nHandled = 0; - if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - const KeyCode& rKeyCode = pKEvt->GetKeyCode(); - sal_uInt16 nMod = rKeyCode.GetModifier(); - sal_uInt16 nCode = rKeyCode.GetCode(); - if( nCode == KEY_TAB && ( !nMod || KEY_SHIFT == nMod ) ) - { - bool bUp = KEY_SHIFT == nMod; - if( ShouldScroll( bUp ) ) - { - DoJump( bUp ); - SetSelection( Selection( 0, SELECTION_MAX ) ); - // Tab-travel doesn't really happen, so emulate it by setting a selection manually - nHandled = 1; - } - } - else if( KEY_UP == nCode || KEY_DOWN == nCode ) - { - bool bUp = KEY_UP == nCode; - if( ShouldScroll( bUp ) ) - { - DoJump( bUp ); - nHandled = 1; - } - else if( bUp ) - { - if( m_pPrev ) - { - m_pPrev->GrabFocus(); - nHandled = 1; - } - } - else if( m_pNext ) - { - m_pNext->GrabFocus(); - nHandled = 1; - } - } - } - - if( !nHandled ) - nHandled = Edit::PreNotify( rNEvt ); - return nHandled; - } - - - namespace - { - bool GetConversions( Reference< XConversionDictionary > _xDict, - const OUString& _rOrg, - Sequence< OUString >& _rEntries ) - { - bool bRet = false; - if( _xDict.is() && _rOrg.getLength() ) - { - try - { - _rEntries = _xDict->getConversions( _rOrg, - 0, - _rOrg.getLength(), - ConversionDirection_FROM_LEFT, - ::com::sun::star::i18n::TextConversionOption::NONE ); - bRet = _rEntries.getLength() > 0; - } - catch( const IllegalArgumentException& ) - { - } - } - - return bRet; - } - } - - - IMPL_LINK( HangulHanjaEditDictDialog, ScrollHdl, void*, EMPTYARG ) - { - UpdateScrollbar(); - - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, OriginalModifyHdl, void*, EMPTYARG ) - { - m_bModifiedOriginal = true; - m_aOriginal = m_aOriginalLB.GetText(); - m_aOriginal.EraseTrailingChars(); - - UpdateSuggestions(); - UpdateButtonStates(); - - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl1, Edit*, pEdit ) - { - EditModify( pEdit, 0 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl2, Edit*, pEdit ) - { - EditModify( pEdit, 1 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl3, Edit*, pEdit ) - { - EditModify( pEdit, 2 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, EditModifyHdl4, Edit*, pEdit ) - { - EditModify( pEdit, 3 ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, BookLBSelectHdl, void*, EMPTYARG ) - { - InitEditDictDialog( m_aBookLB.GetSelectEntryPos() ); - return 0; - } - - IMPL_LINK( HangulHanjaEditDictDialog, NewPBPushHdl, void*, EMPTYARG ) - { - DBG_ASSERT( m_pSuggestions, "-HangulHanjaEditDictDialog::NewPBPushHdl(): no suggestions... search in hell..." ); - Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ]; - if( xDict.is() && m_pSuggestions ) - { - //delete old entry - bool bRemovedSomething = DeleteEntryFromDictionary( m_aOriginal, xDict ); - - OUString aLeft( m_aOriginal ); - const String* pRight = m_pSuggestions->First(); - bool bAddedSomething = false; - while( pRight ) - { - try - { - //add new entry - xDict->addEntry( aLeft, *pRight ); - bAddedSomething = true; - } - catch( const IllegalArgumentException& ) - { - } - catch( const ElementExistException& ) - { - } - - pRight = m_pSuggestions->Next(); - } - - if(bAddedSomething||bRemovedSomething) - InitEditDictDialog( m_nCurrentDict ); - } - else - { - DBG_WARNING( "+HangulHanjaEditDictDialog::NewPBPushHdl(): dictionary faded away..." ); - } - return 0; - } - - bool HangulHanjaEditDictDialog::DeleteEntryFromDictionary( const OUString&, const Reference< XConversionDictionary >& xDict ) - { - bool bRemovedSomething = false; - if( xDict.is() ) - { - OUString aOrg( m_aOriginal ); - Sequence< OUString > aEntries; - GetConversions( xDict, m_aOriginal, aEntries ); - - sal_uInt32 n = aEntries.getLength(); - OUString* pEntry = aEntries.getArray(); - while( n ) - { - try - { - xDict->removeEntry( aOrg, *pEntry ); - bRemovedSomething = true; - } - catch( const NoSuchElementException& ) - { // can not be... - } - - ++pEntry; - --n; - } - } - return bRemovedSomething; - } - - IMPL_LINK( HangulHanjaEditDictDialog, DeletePBPushHdl, void*, EMPTYARG ) - { - if( DeleteEntryFromDictionary( m_aOriginal, m_rDictList[ m_nCurrentDict ] ) ) - { - m_aOriginal.Erase(); - m_bModifiedOriginal = true; - InitEditDictDialog( m_nCurrentDict ); - } - return 0; - } - - void HangulHanjaEditDictDialog::InitEditDictDialog( sal_uInt32 _nSelDict ) - { - if( m_pSuggestions ) - m_pSuggestions->Clear(); - - if( m_nCurrentDict != _nSelDict ) - { - m_nCurrentDict = _nSelDict; - m_aOriginal.Erase(); - m_bModifiedOriginal = true; - } - - UpdateOriginalLB(); - - m_aOriginalLB.SetText( m_aOriginal.Len()? m_aOriginal : m_aEditHintText, Selection( 0, SELECTION_MAX ) ); - m_aOriginalLB.GrabFocus(); - - UpdateSuggestions(); - UpdateButtonStates(); - } - - void HangulHanjaEditDictDialog::UpdateOriginalLB( void ) - { - m_aOriginalLB.Clear(); - Reference< XConversionDictionary > xDict = m_rDictList[ m_nCurrentDict ]; - if( xDict.is() ) - { - Sequence< OUString > aEntries = xDict->getConversionEntries( ConversionDirection_FROM_LEFT ); - sal_uInt32 n = aEntries.getLength(); - OUString* pEntry = aEntries.getArray(); - while( n ) - { - m_aOriginalLB.InsertEntry( *pEntry ); - - ++pEntry; - --n; - } - } - else - { - DBG_WARNING( "+HangulHanjaEditDictDialog::UpdateOriginalLB(): dictionary faded away..." ); - } - } - - void HangulHanjaEditDictDialog::UpdateButtonStates() - { - bool bHaveValidOriginalString = m_aOriginal.Len() && m_aOriginal != m_aEditHintText; - bool bNew = bHaveValidOriginalString && m_pSuggestions && m_pSuggestions->GetCount() > 0; - bNew = bNew && (m_bModifiedSuggestions || m_bModifiedOriginal); - - m_aNewPB.Enable( bNew ); - m_aDeletePB.Enable( !m_bModifiedOriginal && bHaveValidOriginalString ); - } - - void HangulHanjaEditDictDialog::UpdateSuggestions( void ) - { - Sequence< OUString > aEntries; - bool bFound = GetConversions( m_rDictList[ m_nCurrentDict ], m_aOriginal, aEntries ); - if( bFound ) - { - m_bModifiedOriginal = false; - - if( m_pSuggestions ) - m_pSuggestions->Clear(); - - //fill found entries into boxes - sal_uInt32 nCnt = aEntries.getLength(); - if( nCnt ) - { - if( !m_pSuggestions ) - m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS ); - - const OUString* pSugg = aEntries.getConstArray(); - sal_uInt32 n = 0; - while( nCnt ) - { - m_pSuggestions->Set( pSugg[ n ], sal_uInt16( n ) ); - ++n; - --nCnt; - } - } - m_bModifiedSuggestions=false; - } - - m_aScrollSB.SetThumbPos( 0 ); - UpdateScrollbar(); // will force edits to be filled new - } - - void HangulHanjaEditDictDialog::SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum ) - { - String aStr; - if( m_pSuggestions ) - { - const String* p = m_pSuggestions->Get( _nEntryNum ); - if( p ) - aStr = *p; - } - - _rEdit.SetText( aStr ); - } - - void HangulHanjaEditDictDialog::EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset ) - { - m_bModifiedSuggestions = true; - - String aTxt( _pEdit->GetText() ); - sal_uInt16 nEntryNum = m_nTopPos + _nEntryOffset; - if( aTxt.Len() == 0 ) - { - //reset suggestion - if( m_pSuggestions ) - m_pSuggestions->Reset( nEntryNum ); - } - else - { - //set suggestion - if( !m_pSuggestions ) - m_pSuggestions = new SuggestionList( MAXNUM_SUGGESTIONS ); - m_pSuggestions->Set( aTxt, nEntryNum ); - } - - UpdateButtonStates(); - } - - HangulHanjaEditDictDialog::HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict ) - :ModalDialog ( _pParent, CUI_RES( RID_SVX_MDLG_HANGULHANJA_EDIT ) ) - ,m_aEditHintText ( CUI_RES( STR_EDITHINT ) ) - ,m_rDictList ( _rDictList ) - ,m_nCurrentDict ( 0xFFFFFFFF ) - ,m_pSuggestions ( NULL ) - ,m_aBookFT ( this, CUI_RES( FT_BOOK ) ) - ,m_aBookLB ( this, CUI_RES( LB_BOOK ) ) - ,m_aOriginalFT ( this, CUI_RES( FT_ORIGINAL ) ) - ,m_aOriginalLB ( this, CUI_RES( LB_ORIGINAL ) ) - ,m_aSuggestionsFT ( this, CUI_RES( FT_SUGGESTIONS ) ) - ,m_aEdit1 ( this, CUI_RES( ED_1 ), m_aScrollSB, NULL, &m_aEdit2 ) - ,m_aEdit2 ( this, CUI_RES( ED_2 ), m_aScrollSB, &m_aEdit1, &m_aEdit3 ) - ,m_aEdit3 ( this, CUI_RES( ED_3 ), m_aScrollSB, &m_aEdit2, &m_aEdit4 ) - ,m_aEdit4 ( this, CUI_RES( ED_4 ), m_aScrollSB, &m_aEdit3, NULL ) - ,m_aScrollSB ( this, CUI_RES( SB_SCROLL ) ) - ,m_aNewPB ( this, CUI_RES( PB_HHE_NEW ) ) - ,m_aDeletePB ( this, CUI_RES( PB_HHE_DELETE ) ) - ,m_aHelpPB ( this, CUI_RES( PB_HHE_HELP ) ) - ,m_aClosePB ( this, CUI_RES( PB_HHE_CLOSE ) ) - ,m_nTopPos ( 0 ) - ,m_bModifiedSuggestions ( false ) - ,m_bModifiedOriginal ( false ) - { - m_aOriginalLB.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, OriginalModifyHdl ) ); - - m_aNewPB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, NewPBPushHdl ) ); - m_aNewPB.Enable( false ); - - m_aDeletePB.SetClickHdl( LINK( this, HangulHanjaEditDictDialog, DeletePBPushHdl ) ); - - m_aDeletePB.Enable( false ); - - #if( MAXNUM_SUGGESTIONS <= 4 ) - #error number of suggestions should not under-run the value of 5 - #endif - - Link aScrLk( LINK( this, HangulHanjaEditDictDialog, ScrollHdl ) ); - m_aScrollSB.SetScrollHdl( aScrLk ); - m_aScrollSB.SetEndScrollHdl( aScrLk ); - m_aScrollSB.SetRangeMin( 0 ); - m_aScrollSB.SetRangeMax( MAXNUM_SUGGESTIONS ); - m_aScrollSB.SetPageSize( 4 ); // because we have 4 edits / page - m_aScrollSB.SetVisibleSize( 4 ); - - m_aEdit1.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl1 ) ); - m_aEdit2.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl2 ) ); - m_aEdit3.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl3 ) ); - m_aEdit4.SetModifyHdl( LINK( this, HangulHanjaEditDictDialog, EditModifyHdl4 ) ); - - m_aBookLB.SetSelectHdl( LINK( this, HangulHanjaEditDictDialog, BookLBSelectHdl ) ); - sal_uInt32 nDictCnt = m_rDictList.size(); - for( sal_uInt32 n = 0 ; n < nDictCnt ; ++n ) - { - Reference< XConversionDictionary > xDic( m_rDictList[n] ); - String aName; - if(xDic.is()) - aName = xDic->getName(); - m_aBookLB.InsertEntry( aName ); - } - m_aBookLB.SelectEntryPos( sal_uInt16( _nSelDict ) ); - - FreeResource(); - - InitEditDictDialog( _nSelDict ); - } - - HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog() - { - if( m_pSuggestions ) - delete m_pSuggestions; - } - - void HangulHanjaEditDictDialog::UpdateScrollbar( void ) - { - sal_uInt16 nPos = sal_uInt16( m_aScrollSB.GetThumbPos() ); - m_nTopPos = nPos; - - SetEditText( m_aEdit1, nPos++ ); - SetEditText( m_aEdit2, nPos++ ); - SetEditText( m_aEdit3, nPos++ ); - SetEditText( m_aEdit4, nPos ); - } - -//............................................................................. -} // namespace svx -//............................................................................. - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hangulhanjadlg.hrc b/cui/source/dialogs/hangulhanjadlg.hrc deleted file mode 100644 index d8ad70b21..000000000 --- a/cui/source/dialogs/hangulhanjadlg.hrc +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_HANGUL_HANJA_DLG_HRC -#define SVX_HANGUL_HANJA_DLG_HRC - -#ifndef _SVT_CONTROLDIMS_HRC_ -#include -#endif - -// PushButton -#define PB_FIND 1 - -// Control -#define CTL_SUGGESTIONS 1 - -// FixedText -#define FT_FORMAT 1 -#define FT_RESIZE_ANCHOR 2 -#define FT_CONVERSION 3 - -// RadioButton -#define RB_SIMPLE_CONVERSION 1 -#define RB_HANJA_HANGUL_BRACKETED 2 -#define RB_HANGUL_HANJA_BRACKETED 3 -#define RB_HANGUL_HANJA_ABOVE 4 -#define RB_HANGUL_HANJA_BELOW 5 -#define RB_HANJA_HANGUL_ABOVE 6 -#define RB_HANJA_HANGUL_BELOW 7 - -// CheckBox -#define CB_REPLACE_BY_CHARACTER 1 -#define CB_HANGUL_ONLY 2 -#define CB_HANJA_ONLY 3 - -// String -#define STR_HANGUL 1 -#define STR_HANJA 2 - -#define FT_WORD 10 -#define FT_AKTWORD 11 -#define FT_NEWWORD 12 -#define GB_AUDIT 13 -#define BTN_IGNORE 14 -#define BTN_IGNOREALL 15 -#define BTN_CHANGE 16 -#define BTN_CHANGEALL 17 -#define FT_STATUS 18 -#define BTN_SPL_CANCEL 19 -#define BTN_SPL_HELP 20 -#define ED_NEWWORD 21 -#define FT_SUGGESTION 22 - - - -// Hangul / Hanja Options Dialog - -#define FT_USERDEFDICT 1 -#define FL_OPTIONS 2 -#define BTN_OPTIONS 10 - -#define LB_DICTS 1 - -#define CB_IGNOREPOST 1 -#define CB_SHOWRECENTLYFIRST 3 -#define CB_AUTOREPLACEUNIQUE 4 - -#define PB_HHO_NEW 1 -#define PB_HHO_EDIT 2 -#define PB_HHO_DELETE 3 -#define PB_HHO_OK 4 -#define PB_HHO_CANCEL 5 -#define PB_HHO_HELP 6 - -// metrics - -#define HHO_DLGWIDTH 287 -#define HHx_DLGHIGHT 175 -#define HHO_COL_1 RSC_SP_DLG_INNERBORDER_LEFT -#define HHO_COL_1a (HHO_COL_1+3) -#define HHO_COL_6 (HHO_DLGWIDTH-6) -#define HHO_COL_5 (HHO_COL_6-50) -#define HHO_COL_4 (HHO_COL_5-12) -#define HHO_COL_3 (HHO_COL_4-50) -#define HHO_COL_2 (HHO_COL_3-6) - -#define HHO_ROW_1 RSC_SP_DLG_INNERBORDER_TOP -#define HHO_ROW_2 (HHO_ROW_1+8+2) -#define HHO_ROW_3 (HHO_ROW_2+14) -#define HHO_ROW_4 (HHO_ROW_3+2) -#define HHO_ROW_5 (HHO_ROW_4+14) -#define HHO_ROW_6 (HHO_ROW_5+2) -#define HHO_ROW_7 (HHO_ROW_6+14) -#define HHO_ROW_8 (HHO_ROW_7+4) -#define HHO_ROW_9 (HHO_ROW_8+8+4) -#define HHO_ROW_11 (HHO_ROW_9+8+4) -#define HHO_ROW_12 (HHO_ROW_11+8+4) - -#define HHO_ROW_a1 HHO_ROW_1 -#define HHO_ROW_a2 (HHO_ROW_a1+14) -#define HHO_ROW_a3 (HHO_ROW_a2+2) -#define HHO_ROW_a4 (HHO_ROW_a3+14) -#define HHO_ROW_a5 (HHO_ROW_a4+4) -#define HHO_ROW_a6 (HHO_ROW_a5+14) - - -// Hangul / Hanja New Dictonary Dialog -#define FL_NEWDICT 1 - -#define FT_DICTNAME 1 - -#define ED_DICTNAME 1 - -#define PB_NEWDICT_OK 1 -#define PB_NEWDICT_ESC 2 -#define PB_NEWDICT_HLP 3 - - -// Hangul Hanja Edit Custom Dictionary Dialog -#define MAXNUM_SUGGESTIONS 50 - -#define STR_EDITHINT 1 - -#define FT_BOOK 1 -#define FT_ORIGINAL 2 -#define FT_SUGGESTIONS 3 - -#define LB_BOOK 1 -#define LB_ORIGINAL 2 - -#define PB_HHE_NEW 1 -#define PB_HHE_DELETE 2 -#define PB_HHE_HELP 3 -#define PB_HHE_CLOSE 4 - -#define SB_SCROLL 1 - -#define ED_1 1 -#define ED_2 2 -#define ED_3 3 -#define ED_4 4 - -// metrics - -#define RSC_CD_VSCRLWIDTH 8 // vertical scroll bar width -#define HHE_DLGWIDTH HHO_DLGWIDTH -#define HHE_COL_1 RSC_SP_DLG_INNERBORDER_LEFT -#define HHE_COL_6 (HHE_DLGWIDTH-RSC_SP_DLG_INNERBORDER_RIGHT) -#define HHE_COL_5 (HHE_COL_6-RSC_CD_PUSHBUTTON_WIDTH) -#define HHE_COL_4 (HHE_COL_5-6) -#define HHE_COL_3_2 (HHE_COL_4-RSC_CD_VSCRLWIDTH) -#define HHE_COL_3_1 (HHE_COL_3_2-RSC_SP_CTRL_GROUP_X) -#define HHE_COL_3_0 (HHE_COL_3_2-RSC_CD_PUSHBUTTON_WIDTH) -#define HHE_COL_2 (HHE_COL_1+50) -#define HHE_COL_3 (HHE_COL_2+1) - -#define HHE_ROW_1 RSC_SP_DLG_INNERBORDER_TOP -#define HHE_ROW_2 (HHE_ROW_1+2) -#define HHE_ROW_3 (HHE_ROW_2+12) -#define HHE_ROW_4 (HHE_ROW_3+12) -#define HHE_ROW_5 (HHE_ROW_4+8+2) -#define HHE_ROW_6 (HHE_ROW_5+12) -#define HHE_ROW_7 (HHE_ROW_6+2) -#define HHE_ROW_8 (HHE_ROW_7+2) -#define HHE_ROW_9 (HHE_ROW_6+12) -#define HHE_ROW_10 (HHE_ROW_8+RSC_SP_CTRL_GROUP_Y) -#define HHE_ROW_11 (HHE_ROW_10+8+2) -#define HHE_ROW_12 (HHE_ROW_11+4*12) -#define HHE_ROW_14 (HHx_DLGHIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM) -#define HHE_ROW_13 (HHE_ROW_14-RSC_CD_PUSHBUTTON_HEIGHT) -#define HHE_ROW_a1 (HHE_ROW_5) -#define HHE_ROW_a3 (HHE_ROW_a1+RSC_CD_PUSHBUTTON_HEIGHT+2) - -#endif // SVX_HANGUL_HANJA_DLG_HRC diff --git a/cui/source/dialogs/hangulhanjadlg.src b/cui/source/dialogs/hangulhanjadlg.src deleted file mode 100644 index c7c7172de..000000000 --- a/cui/source/dialogs/hangulhanjadlg.src +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include "helpid.hrc" - -#ifndef SVX_HANGUL_HANJA_DLG_HRC -#include "hangulhanjadlg.hrc" -#endif - -ModalDialog RID_SVX_MDLG_HANGULHANJA -{ - HelpId = HID_DIALOG_HANGULHANJA; - Size = MAP_APPFONT( 302, 175 ); - OutputSize = TRUE; - Closeable = TRUE ; - Moveable = TRUE ; - SVLook = TRUE; - - Text [ en-US ] = "Hangul/Hanja Conversion"; - - PushButton PB_FIND - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA:PB_FIND"; - Pos = MAP_APPFONT( 207, 23 ); - Size = MAP_APPFONT( 30, 14 ); - - Text [ en-US ] = "~Find"; - }; - - Control CTL_SUGGESTIONS - { - Pos = MAP_APPFONT( 51, 46 ); - Size = MAP_APPFONT( 186, 30 ); - TabStop = TRUE ; - }; - - FixedText FT_FORMAT - { - Pos = MAP_APPFONT( 6, 81 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Format"; - }; - - RadioButton RB_SIMPLE_CONVERSION - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_SIMPLE_CONVERSION"; - Pos = MAP_APPFONT( 51, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Group = TRUE; - - Text [ en-US ] = "~Hangul/Hanja"; - }; - - RadioButton RB_HANJA_HANGUL_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BRACKETED"; - Pos = MAP_APPFONT( 114, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hanja (Han~gul)"; - }; - - RadioButton RB_HANGUL_HANJA_BRACKETED - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BRACKETED"; - Pos = MAP_APPFONT( 177, 81 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hang~ul (Hanja)"; - }; - - RadioButton RB_HANGUL_HANJA_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_ABOVE"; - Pos = MAP_APPFONT( 51, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hangu~l"; - }; - - RadioButton RB_HANGUL_HANJA_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANGUL_HANJA_BELOW"; - Pos = MAP_APPFONT( 114, 95 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Hang~ul"; - }; - - RadioButton RB_HANJA_HANGUL_ABOVE - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_ABOVE"; - Pos = MAP_APPFONT( 56, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Han~ja"; - }; - - RadioButton RB_HANJA_HANGUL_BELOW - { - HelpID = "cui:RadioButton:RID_SVX_MDLG_HANGULHANJA:RB_HANJA_HANGUL_BELOW"; - Pos = MAP_APPFONT( 114, 114 ); - Size = MAP_APPFONT( 60, 16 ); - - // this is the _primary_ text - Text [ en-US ] = "Ha~nja"; - }; - - FixedText FT_CONVERSION - { - Pos = MAP_APPFONT( 6, 134 ); - Size = MAP_APPFONT( 42, 8 ); - - Text [ en-US ] = "Conversion"; - }; - - CheckBox CB_HANGUL_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANGUL_ONLY"; - Pos = MAP_APPFONT( 51, 134 ); - Size = MAP_APPFONT( 60, 8 ); - - Text [ en-US ] = "Hangul ~only"; - }; - - CheckBox CB_HANJA_ONLY - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_HANJA_ONLY"; - Pos = MAP_APPFONT( 114, 134 ); - Size = MAP_APPFONT( 55, 8 ); - - Text [ en-US ] = "Hanja onl~y"; - }; - - // this element is only for determining where our radio button group ends (in both directions) - FixedText FT_RESIZE_ANCHOR - { - Pos = MAP_APPFONT( 241, 133 ); - }; - - CheckBox CB_REPLACE_BY_CHARACTER - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA:CB_REPLACE_BY_CHARACTER"; - Pos = MAP_APPFONT( 241, 81 ); - Size = MAP_APPFONT( 55, 24 ); - - WordBreak = TRUE; - - Text [ en-US ] = "Replace b~y character"; - }; - - String STR_HANGUL - { - Text [ en-US ] = "Hangul"; - }; - - String STR_HANJA - { - Text [ en-US ] = "Hanja"; - }; -}; - -ModalDialog RID_SVX_MDLG_HANGULHANJA_OPT -{ - OutputSize = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - HelpId = HID_HANGULHANJA_OPT_DLG; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( HHO_DLGWIDTH , HHx_DLGHIGHT ) ; - Text [ en-US ] = "Hangul/Hanja Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedText FT_USERDEFDICT - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_1 ) ; - Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1, 8 ) ; - Text[ en-US ] = "User-defined dictionaries"; - }; - Control LB_DICTS - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_2 ) ; - Size = MAP_APPFONT ( HHO_COL_2 - HHO_COL_1 , HHO_ROW_7 - HHO_ROW_2 ) ; - HelpId = HID_HANGULHANJA_OPT_DICTS_LB; - TabStop = TRUE; - Border = TRUE; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( HHO_COL_1 , HHO_ROW_8 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_1, 8 ) ; - Text[ en-US ] = "Options"; - }; - CheckBox CB_IGNOREPOST - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_IGNOREPOST"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_9 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text[ en-US ] = "Ignore post-positional word"; - }; - CheckBox CB_SHOWRECENTLYFIRST - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_SHOWRECENTLYFIRST"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_11 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text [ en-US ] = "Show recently used entries first"; - }; - CheckBox CB_AUTOREPLACEUNIQUE - { - HelpID = "cui:CheckBox:RID_SVX_MDLG_HANGULHANJA_OPT:CB_AUTOREPLACEUNIQUE"; - Pos = MAP_APPFONT ( HHO_COL_1a, HHO_ROW_12 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_1a , 12 ) ; - Text [ en-US ] = "Replace all unique entries automatically"; - }; - PushButton PB_HHO_NEW - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_NEW"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_2 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "New..."; - }; - PushButton PB_HHO_EDIT - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_EDIT"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_4 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "Edit..."; - }; - PushButton PB_HHO_DELETE - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_OPT:PB_HHO_DELETE"; - Pos = MAP_APPFONT ( HHO_COL_3 , HHO_ROW_6 ) ; - Size = MAP_APPFONT ( HHO_COL_4 - HHO_COL_3 , 14 ) ; - Text [ en-US ] = "Delete"; - }; - OKButton PB_HHO_OK - { - DefButton = TRUE; - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a1 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - CancelButton PB_HHO_CANCEL - { - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a3 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - HelpButton PB_HHO_HELP - { - Pos = MAP_APPFONT ( HHO_COL_5 , HHO_ROW_a5 ) ; - Size = MAP_APPFONT ( HHO_COL_6 - HHO_COL_5 , 14 ) ; - }; - -}; - - -ModalDialog RID_SVX_MDLG_HANGULHANJA_NEWDICT -{ - HelpId = HID_HANGULHANJA_NEWDICT_DLG; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 213 , 66 ) ; - Moveable = TRUE ; - - Text [ en-US ] = "New Dictionary" ; - - FixedLine FL_NEWDICT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 145 , 8 ) ; - Text [ en-US ] = "Dictionary" ; - }; - FixedText FT_DICTNAME - { - Pos = MAP_APPFONT ( 11 , 15 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "~Name" ; - }; - Edit ED_DICTNAME - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_NEWDICT:ED_DICTNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 14 ) ; - Size = MAP_APPFONT ( 90 , 12 ) ; - MaxTextLength = 32 ; - }; - OKButton PB_NEWDICT_OK - { - Pos = MAP_APPFONT ( 157 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_NEWDICT_ESC - { - Pos = MAP_APPFONT ( 157 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_NEWDICT_HLP - { - Pos = MAP_APPFONT ( 157 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - - -ModalDialog RID_SVX_MDLG_HANGULHANJA_EDIT -{ - OutputSize = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - HelpId = HID_HANGULHANJA_EDIT_DLG; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( HHE_DLGWIDTH , HHx_DLGHIGHT ) ; - Text [ en-US ] = "Edit Custom Dictionary" ; - Moveable = TRUE ; - Closeable = TRUE ; - - String STR_EDITHINT - { - Text [ en-US ] = "[Enter text here]"; - }; - FixedText FT_BOOK - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_2 ) ; - Size = MAP_APPFONT ( HHE_COL_2 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Book"; - }; - ListBox LB_BOOK - { - HelpID = "cui:ListBox:RID_SVX_MDLG_HANGULHANJA_EDIT:LB_BOOK"; - Pos = MAP_APPFONT ( HHE_COL_3 , HHE_ROW_1 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_3 , 60 ) ; - DropDown = TRUE; - Border = TRUE; - }; - FixedText FT_ORIGINAL - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_4 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Original"; - }; - ComboBox LB_ORIGINAL - { - HelpID = "cui:ComboBox:RID_SVX_MDLG_HANGULHANJA_EDIT:LB_ORIGINAL"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_5 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1 , 60 ) ; - DropDown = TRUE; - Border = TRUE; - }; - FixedText FT_SUGGESTIONS - { - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_10 ) ; - Size = MAP_APPFONT ( HHE_COL_4 - HHE_COL_1, 8 ) ; - Text [ en-US ] = "Suggestions (max. 8)"; - }; - Edit ED_1 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_1"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_2 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_2"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 12 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_3 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_3"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 24 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - Edit ED_4 - { - HelpID = "cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_4"; - Pos = MAP_APPFONT ( HHE_COL_1 , HHE_ROW_11 + 36 ) ; - Size = MAP_APPFONT ( HHE_COL_3_1 - HHE_COL_1 , 12 ) ; - Hide = False; - Border = TRUE; - }; - ScrollBar SB_SCROLL - { - Pos = MAP_APPFONT ( HHE_COL_3_2 , HHE_ROW_11 ) ; - Size = MAP_APPFONT ( RSC_CD_VSCRLWIDTH , HHE_ROW_12 - HHE_ROW_11 ) ; // height = 48 - VScroll = TRUE ; - Drag = TRUE ; - }; - PushButton PB_HHE_NEW - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_NEW"; - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a1 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "New"; - }; - PushButton PB_HHE_DELETE - { - HelpID = "cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_DELETE"; - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_a3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Delete"; - }; - HelpButton PB_HHE_HELP - { - Pos = MAP_APPFONT ( HHE_COL_3_0 , HHE_ROW_13 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - }; - CancelButton PB_HHE_CLOSE - { - Pos = MAP_APPFONT ( HHE_COL_5 , HHE_ROW_13 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Close"; - }; -}; - - - diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx deleted file mode 100644 index 212416c64..000000000 --- a/cui/source/dialogs/hldocntp.cxx +++ /dev/null @@ -1,485 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hldocntp.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hyperdlg.hrc" -#include -#include -#include -#include - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - -using namespace ::rtl; -using namespace ::com::sun::star; - -/************************************************************************* -|* -|* Data-struct for documenttypes in listbox -|* -|************************************************************************/ - -struct DocumentTypeData -{ - String aStrURL; - String aStrExt; - DocumentTypeData (String aURL, String aExt) : aStrURL(aURL), aStrExt(aExt) - {} -}; - -sal_Bool SvxHyperlinkNewDocTp::ImplGetURLObject( const String& rPath, const String& rBase, INetURLObject& aURLObject ) const -{ - sal_Bool bIsValidURL = rPath.Len() != 0; - if ( bIsValidURL ) - { - aURLObject.SetURL( rPath ); - if ( aURLObject.GetProtocol() == INET_PROT_NOT_VALID ) // test if the source is already a valid url - { // if not we have to create a url from a physical file name - bool wasAbs; - INetURLObject base(rBase); - base.setFinalSlash(); - aURLObject = base.smartRel2Abs( - rPath, wasAbs, true, INetURLObject::ENCODE_ALL, - RTL_TEXTENCODING_UTF8, true); - } - bIsValidURL = aURLObject.GetProtocol() != INET_PROT_NOT_VALID; - if ( bIsValidURL ) - { - String aBase( aURLObject.getName( INetURLObject::LAST_SEGMENT, sal_False ) ); - if ( ( aBase.Len() == 0 ) || ( aBase.GetChar( 0 ) == '.' ) ) - bIsValidURL = sal_False; - } - if ( bIsValidURL ) - { - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - aURLObject.SetExtension( ((DocumentTypeData*)maLbDocTypes.GetEntryData( nPos ))->aStrExt ); - } - - } - return bIsValidURL; -} - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( Window *pParent, const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT ), rItemSet ), - maGrpNewDoc ( this, CUI_RES (GRP_NEWDOCUMENT) ), - maRbtEditNow ( this, CUI_RES (RB_EDITNOW) ), - maRbtEditLater ( this, CUI_RES (RB_EDITLATER) ), - maFtPath ( this, CUI_RES (FT_PATH_NEWDOC) ), - maCbbPath ( this, INET_PROT_FILE ), - maBtCreate ( this, CUI_RES (BTN_CREATE) ), - maFtDocTypes ( this, CUI_RES (FT_DOCUMENT_TYPES) ), - maLbDocTypes ( this, CUI_RES (LB_DOCUMENT_TYPES) ) -{ - // Set HC bitmaps and disable display of bitmap names. - maBtCreate.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - SetExchangeSupport (); - - maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2 , 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbPath.Show(); - maCbbPath.SetBaseURL(SvtPathOptions().GetWorkPath()); - - // set defaults - maRbtEditNow.Check(); - - maBtCreate.SetClickHdl ( LINK ( this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl ) ); - - maBtCreate.SetAccessibleRelationMemberOf( &maGrpNewDoc ); - maBtCreate.SetAccessibleRelationLabeledBy( &maFtPath ); - - FillDocumentList (); -} - -SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp () -{ - for ( sal_uInt16 n=0; n > - aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( E_NEWMENU ) ); - - sal_uInt32 i, nCount = aDynamicMenuEntries.getLength(); - for ( i = 0; i < nCount; i++ ) - { - uno::Sequence< beans::PropertyValue >& rDynamicMenuEntry = aDynamicMenuEntries[ i ]; - - rtl::OUString aDocumentUrl, aTitle, aImageId, aTargetName; - - for ( int e = 0; e < rDynamicMenuEntry.getLength(); e++ ) - { - if ( rDynamicMenuEntry[ e ].Name == DYNAMICMENU_PROPERTYNAME_URL ) - rDynamicMenuEntry[ e ].Value >>= aDocumentUrl; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TITLE ) - rDynamicMenuEntry[e].Value >>= aTitle; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ) - rDynamicMenuEntry[e].Value >>= aImageId; - else if ( rDynamicMenuEntry[e].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME ) - rDynamicMenuEntry[e].Value >>= aTargetName; - } - //#i96822# business cards, labels and database should not be inserted here - if( aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21051" ) ) || - aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/swriter?slot=21052" )) || - aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "private:factory/sdatabase?Interactive" ))) - continue; - - // Insert into listbox - if ( aDocumentUrl.getLength() ) - { - if ( aDocumentUrl.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:factory/simpress?slot=6686" ) ) ) // SJ: #106216# do not start - aDocumentUrl = String( RTL_CONSTASCII_USTRINGPARAM( "private:factory/simpress" ) ); // the AutoPilot for impress - - // insert private-url and default-extension as user-data - const SfxFilter* pFilter = SfxFilter::GetDefaultFilterFromFactory( aDocumentUrl ); - if ( pFilter ) - { - // insert doc-name and image - String aTitleName( aTitle ); - aTitleName.Erase( aTitleName.Search( (sal_Unicode)'~' ), 1 ); - - sal_Int16 nPos = maLbDocTypes.InsertEntry ( aTitleName ); - String aStrDefExt( pFilter->GetDefaultExtension () ); - DocumentTypeData *pTypeData = new DocumentTypeData ( aDocumentUrl, aStrDefExt.Copy( 2, aStrDefExt.Len() ) ); - maLbDocTypes.SetEntryData ( nPos, pTypeData ); - } - } - } - maLbDocTypes.SelectEntryPos ( 0 ); - - LeaveWait(); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkNewDocTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - // get data from dialog-controls - aStrURL = maCbbPath.GetText(); - INetURLObject aURL; - if ( ImplGetURLObject( aStrURL, maCbbPath.GetBaseURL(), aURL ) ) - { - aStrURL = aURL.GetMainURL( INetURLObject::NO_DECODE ); - } - - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkNewDocTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkNewDocTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkNewDocTp::SetInitFocus() -{ - maCbbPath.GrabFocus(); -} - -/************************************************************************* -|* -|* Ask page whether an insert is possible -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkNewDocTp::AskApply() -{ - INetURLObject aINetURLObject; - sal_Bool bRet = ImplGetURLObject( maCbbPath.GetText(), maCbbPath.GetBaseURL(), aINetURLObject ); - if ( !bRet ) - { - WarningBox aWarning( this, WB_OK, CUI_RESSTR(RID_SVXSTR_HYPDLG_NOVALIDFILENAME) ); - aWarning.Execute(); - } - return bRet; -} - -/************************************************************************* -|* -|* Any action to do after apply-button is pressed -|* -\************************************************************************/ - -void SvxHyperlinkNewDocTp::DoApply () -{ - EnterWait(); - - // get data from dialog-controls - String aStrNewName = maCbbPath.GetText(); - - if ( aStrNewName == aEmptyStr ) - aStrNewName = maStrInitURL; - - /////////////////////////////////////////////////////// - // create a real URL-String - - INetURLObject aURL; - if ( ImplGetURLObject( aStrNewName, maCbbPath.GetBaseURL(), aURL ) ) - { - - /////////////////////////////////////////////////////// - // create Document - - aStrNewName = aURL.GetURLPath( INetURLObject::NO_DECODE ); - SfxViewFrame *pViewFrame = NULL; - try - { - bool bCreate = true; - - // check if file exists, warn before we overwrite it - { - com::sun::star::uno::Reference < com::sun::star::task::XInteractionHandler > xHandler; - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, xHandler ); - - sal_Bool bOk = pIStm && ( pIStm->GetError() == 0); - - if( pIStm ) - delete pIStm; - - if( bOk ) - { - WarningBox aWarning( this, WB_YES_NO, CUI_RESSTR(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE) ); - bCreate = aWarning.Execute() == BUTTON_YES; - } - } - - if( bCreate ) - { - // current document - SfxViewFrame* pCurrentDocFrame = SfxViewFrame::Current(); - - if ( aStrNewName != aEmptyStr ) - { - // get private-url - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - if( nPos == LISTBOX_ENTRY_NOTFOUND ) - nPos=0; - String aStrDocName ( ( ( DocumentTypeData* ) - maLbDocTypes.GetEntryData( nPos ) )->aStrURL ); - - // create items - SfxStringItem aName( SID_FILE_NAME, aStrDocName ); - SfxStringItem aReferer( SID_REFERER, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) ); - SfxStringItem aFrame( SID_TARGETNAME, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_blank" ) ) ); - - String aStrFlags ( sal_Unicode('S') ); - if ( maRbtEditLater.IsChecked() ) - { - aStrFlags += sal_Unicode('H'); - } - SfxStringItem aFlags (SID_OPTIONS, aStrFlags); - - // open url - const SfxPoolItem* pReturn = GetDispatcher()->Execute( SID_OPENDOC, - SFX_CALLMODE_SYNCHRON, - &aName, &aFlags, - &aFrame, &aReferer, 0L ); - - // save new doc - const SfxViewFrameItem *pItem = PTR_CAST( SfxViewFrameItem, pReturn ); // SJ: pReturn is NULL if the Hyperlink - if ( pItem ) // creation is cancelled #106216# - { - pViewFrame = pItem->GetFrame(); - if (pViewFrame) - { - SfxStringItem aNewName( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - pViewFrame->GetDispatcher()->Execute( SID_SAVEASDOC, - SFX_CALLMODE_SYNCHRON, - &aNewName, 0L ); - - } - } - } - - if ( maRbtEditNow.IsChecked() && pCurrentDocFrame ) - { - pCurrentDocFrame->ToTop(); - } - } - } - catch (const uno::Exception&) - { - } - - if ( pViewFrame && maRbtEditLater.IsChecked() ) - { - SfxObjectShell* pObjShell = pViewFrame->GetObjectShell(); - pObjShell->DoClose(); - } - } - - LeaveWait(); -} - -/************************************************************************* -|* -|* Click on imagebutton : new -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkNewDocTp, ClickNewHdl_Impl, void *, EMPTYARG ) -{ - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - uno::Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); - - String aStrURL; - String aTempStrURL( maCbbPath.GetText() ); - utl::LocalFileHelper::ConvertSystemPathToURL( aTempStrURL, maCbbPath.GetBaseURL(), aStrURL ); - - String aStrPath = aStrURL; - sal_Bool bZeroPath = ( aStrPath.Len() == 0 ); - sal_Bool bHandleFileName = bZeroPath; // when path has length of 0, then the rest should always be handled - // as file name, otherwise we do not yet know - - if( bZeroPath ) - aStrPath = SvtPathOptions().GetWorkPath(); - else if( !::utl::UCBContentHelper::IsFolder( aStrURL ) ) - bHandleFileName = sal_True; - - xFolderPicker->setDisplayDirectory( aStrPath ); - DisableClose( sal_True ); - sal_Int16 nResult = xFolderPicker->execute(); - DisableClose( sal_False ); - if( ExecutableDialogResults::OK == nResult ) - { - sal_Char const sSlash[] = "/"; - - INetURLObject aURL( aStrURL, INET_PROT_FILE ); - String aStrName; - if( bHandleFileName ) - aStrName = bZeroPath? aTempStrURL : String(aURL.getName()); - - maCbbPath.SetBaseURL( xFolderPicker->getDirectory() ); - String aStrTmp( xFolderPicker->getDirectory() ); - - if( aStrTmp.GetChar( aStrTmp.Len() - 1 ) != sSlash[0] ) - aStrTmp.AppendAscii( sSlash ); - - // append old file name - if( bHandleFileName ) - aStrTmp += aStrName; - - INetURLObject aNewURL( aStrTmp ); - - if( aStrName.Len() > 0 && aNewURL.getExtension().getLength() > 0 && - maLbDocTypes.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - // get private-url - sal_uInt16 nPos = maLbDocTypes.GetSelectEntryPos(); - aNewURL.setExtension( ( ( DocumentTypeData* ) maLbDocTypes.GetEntryData( nPos ) )->aStrExt ); - } - - if( aNewURL.GetProtocol() == INET_PROT_FILE ) - { - utl::LocalFileHelper::ConvertURLToSystemPath( aNewURL.GetMainURL( INetURLObject::NO_DECODE ), aStrTmp ); - } - else - { - aStrTmp = aNewURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - } - - maCbbPath.SetText ( aStrTmp ); - } - return( 0L ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx deleted file mode 100644 index dfa73b4e3..000000000 --- a/cui/source/dialogs/hldoctp.cxx +++ /dev/null @@ -1,376 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cuihyperdlg.hxx" -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#include "hldoctp.hxx" -#include "hyperdlg.hrc" -#include "hlmarkwn_def.hxx" - -sal_Char const sHash[] = "#"; -sal_Char const sFileScheme[] = INET_FILE_SCHEME; -sal_Char const sNewsSRVScheme[] = "news://"; - // TODO news:// is nonsense -sal_Char const sHTTPScheme[] = INET_HTTP_SCHEME; - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkDocTp::SvxHyperlinkDocTp ( Window *pParent, const SfxItemSet& rItemSet) - : SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_DOCUMENT ), rItemSet ), - maGrpDocument ( this, CUI_RES (GRP_DOCUMENT) ), - maFtPath ( this, CUI_RES (FT_PATH_DOC) ), - maCbbPath ( this, INET_PROT_FILE ), - maBtFileopen ( this, CUI_RES (BTN_FILEOPEN) ), - maGrpTarget ( this, CUI_RES (GRP_TARGET) ), - maFtTarget ( this, CUI_RES (FT_TARGET_DOC) ), - maEdTarget ( this, CUI_RES (ED_TARGET_DOC) ), - maFtURL ( this, CUI_RES (FT_URL) ), - maFtFullURL ( this, CUI_RES (FT_FULL_URL) ), - maBtBrowse ( this, CUI_RES (BTN_BROWSE) ), - mbMarkWndOpen ( sal_False ) -{ - // Disable display of bitmap names. - maBtBrowse.EnableTextDisplay (sal_False); - maBtFileopen.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbPath.SetPosSizePixel ( LogicToPixel( Point( COL_2, 15 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbPath.Show(); - String aFileScheme( INET_FILE_SCHEME, RTL_TEXTENCODING_ASCII_US ); - maCbbPath.SetBaseURL(aFileScheme); - maCbbPath.SetHelpId( HID_HYPERDLG_DOC_PATH ); - - SetExchangeSupport (); - - // overload handlers - maBtFileopen.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickFileopenHdl_Impl ) ); - maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickTargetHdl_Impl ) ); - maCbbPath.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedPathHdl_Impl ) ); - maEdTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedTargetHdl_Impl ) ); - - maCbbPath.SetLoseFocusHdl( LINK ( this, SvxHyperlinkDocTp, LostFocusPathHdl_Impl ) ); - - maBtBrowse.SetAccessibleRelationMemberOf( &maGrpTarget ); - maBtBrowse.SetAccessibleRelationLabeledBy( &maFtTarget ); - maBtFileopen.SetAccessibleRelationMemberOf( &maGrpDocument ); - maBtFileopen.SetAccessibleRelationLabeledBy( &maFtPath ); - maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) ); -} - -SvxHyperlinkDocTp::~SvxHyperlinkDocTp () -{ -} - -/************************************************************************* -|* -|* Fill all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::FillDlgFields ( String& aStrURL ) -{ - INetURLObject aURL ( aStrURL ); - - String aStrMark; - xub_StrLen nPos = aStrURL.SearchAscii( sHash ); - // path - maCbbPath.SetText ( aStrURL.Copy( 0, ( nPos == STRING_NOTFOUND ? aStrURL.Len() : nPos ) ) ); - - // set target in document at editfield - if ( nPos != STRING_NOTFOUND && nPosSetError( LERR_NOERROR ); - - EnterWait(); - - if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) - mpMarkWnd->RefreshTree ( aEmptyStr ); - else - mpMarkWnd->RefreshTree ( maStrURL ); - - LeaveWait(); - } - else - mpMarkWnd->SetError( LERR_DOCNOTOPEN ); - - ShowMarkWnd (); - - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of combobox "Path" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ModifiedPathHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - maTimer.SetTimeout( 2500 ); - maTimer.Start(); - - maFtFullURL.SetText( maStrURL ); - - return( 0L ); -} - -/************************************************************************* -|* -|* If path-field was modify, to browse the new doc after timeout -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, EMPTYARG ) -{ - if ( IsMarkWndVisible() && ( GetPathType( maStrURL )==Type_ExistsFile || - maStrURL == aEmptyStr || - maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) ) - { - EnterWait(); - - if ( maStrURL.EqualsIgnoreCaseAscii( sFileScheme ) ) - mpMarkWnd->RefreshTree ( aEmptyStr ); - else - mpMarkWnd->RefreshTree ( maStrURL ); - - LeaveWait(); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of editfield "Target" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - if ( IsMarkWndVisible() ) - mpMarkWnd->SelectEntry ( maEdTarget.GetText() ); - - maFtFullURL.SetText( maStrURL ); - - return( 0L ); -} - -/************************************************************************* -|* -|* editfield "Target" lost focus -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkDocTp, LostFocusPathHdl_Impl, void *, EMPTYARG ) -{ - maStrURL = GetCurrentURL(); - - maFtFullURL.SetText( maStrURL ); - - return (0L); -} - -/************************************************************************* -|* -|* Get String from Bookmark-Wnd -|* -|************************************************************************/ - -void SvxHyperlinkDocTp::SetMarkStr ( String& aStrMark ) -{ - maEdTarget.SetText ( aStrMark ); - - ModifiedTargetHdl_Impl ( NULL ); -} - -/************************************************************************* -|* -|* retrieve kind of pathstr -|* -|************************************************************************/ - -SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( String& aStrPath ) -{ - INetURLObject aURL( aStrPath, INET_PROT_FILE ); - - if( aURL.HasError() ) - return Type_Invalid; - else - return Type_ExistsFile; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx deleted file mode 100644 index 4926b6699..000000000 --- a/cui/source/dialogs/hlinettp.cxx +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include "hlinettp.hxx" -#include "hyperdlg.hrc" -#include "hlmarkwn_def.hxx" - -sal_Char const sAnonymous[] = "anonymous"; -sal_Char const sHTTPScheme[] = INET_HTTP_SCHEME; -sal_Char const sHTTPSScheme[] = INET_HTTPS_SCHEME; -sal_Char const sFTPScheme[] = INET_FTP_SCHEME; - -/************************************************************************* -|* -|* Constructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( Window *pParent, - const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_INTERNET ), - rItemSet ) , - maGrpLinkTyp ( this, CUI_RES (GRP_LINKTYPE) ), - maRbtLinktypInternet ( this, CUI_RES (RB_LINKTYP_INTERNET) ), - maRbtLinktypFTP ( this, CUI_RES (RB_LINKTYP_FTP) ), - maFtTarget ( this, CUI_RES (FT_TARGET_HTML) ), - maCbbTarget ( this, INET_PROT_HTTP ), - maBtBrowse ( this, CUI_RES (BTN_BROWSE) ), - maFtLogin ( this, CUI_RES (FT_LOGIN) ), - maEdLogin ( this, CUI_RES (ED_LOGIN) ), - maBtTarget ( this, CUI_RES (BTN_TARGET) ), - maFtPassword ( this, CUI_RES (FT_PASSWD) ), - maEdPassword ( this, CUI_RES (ED_PASSWD) ), - maCbAnonymous ( this, CUI_RES (CBX_ANONYMOUS) ), - mbMarkWndOpen ( sal_False ) -{ - // Disable display of bitmap names. - maBtBrowse.EnableTextDisplay (sal_False); - maBtTarget.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbTarget.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - maCbbTarget.Show(); - maCbbTarget.SetHelpId( HID_HYPERDLG_INET_PATH ); - - SetExchangeSupport (); - - /////////////////////////////////////// - // set defaults - maRbtLinktypInternet.Check (); - maFtLogin.Show( sal_False ); - maFtPassword.Show( sal_False ); - maEdLogin.Show( sal_False ); - maEdPassword.Show( sal_False ); - maCbAnonymous.Show( sal_False ); - maBtTarget.Enable( sal_False ); - maBtBrowse.Enable( sal_True ); - - /////////////////////////////////////// - // overload handlers - Link aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) ); - maRbtLinktypInternet.SetClickHdl( aLink ); - maRbtLinktypFTP.SetClickHdl ( aLink ); - maCbAnonymous.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) ); - maBtBrowse.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickBrowseHdl_Impl ) ); - maBtTarget.SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickTargetHdl_Impl ) ); - maEdLogin.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) ); - maCbbTarget.SetLoseFocusHdl ( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) ); - maCbbTarget.SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) ); - maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) ); - - maFtTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maCbbTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtTarget.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtTarget.SetAccessibleRelationLabeledBy( &maFtTarget ); - maBtBrowse.SetAccessibleRelationMemberOf( &maGrpLinkTyp ); - maBtBrowse.SetAccessibleRelationLabeledBy( &maFtTarget ); -} - -SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp () -{ -} - -/************************************************************************* -|* -|* Fill the all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL ) -{ - INetURLObject aURL( aStrURL ); - String aStrScheme = GetSchemeFromURL( aStrURL ); - - // set additional controls for FTP: Username / Password - if ( aStrScheme.SearchAscii( sFTPScheme ) == 0 ) - { - if ( String(aURL.GetUser()).ToLowerAscii().SearchAscii ( sAnonymous ) == 0 ) - setAnonymousFTPUser(); - else - setFTPUser(aURL.GetUser(), aURL.GetPass()); - - //do not show password and user in url - if(aURL.GetUser().getLength()!=0 || aURL.GetPass().getLength()!=0 ) - aURL.SetUserAndPass(aEmptyStr,aEmptyStr); - } - - // set URL-field - // Show the scheme, #72740 - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - maCbbTarget.SetText( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); - else - maCbbTarget.SetText( aStrURL ); // #77696# - - SetScheme( aStrScheme ); -} - -void SvxHyperlinkInternetTp::setAnonymousFTPUser() -{ - maEdLogin.SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM ( sAnonymous ) ) ); - SvAddressParser aAddress( SvtUserOptions().GetEmail() ); - maEdPassword.SetText( aAddress.Count() ? aAddress.GetEmailAddress(0) : String() ); - - maFtLogin.Disable (); - maFtPassword.Disable (); - maEdLogin.Disable (); - maEdPassword.Disable (); - maCbAnonymous.Check(); -} - -void SvxHyperlinkInternetTp::setFTPUser(const String& rUser, const String& rPassword) -{ - maEdLogin.SetText ( rUser ); - maEdPassword.SetText ( rPassword ); - - maFtLogin.Enable (); - maFtPassword.Enable (); - maEdLogin.Enable (); - maEdPassword.Enable (); - maCbAnonymous.Check(sal_False); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrURL = CreateAbsoluteURL(); - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -String SvxHyperlinkInternetTp::CreateAbsoluteURL() const -{ - String aStrURL = maCbbTarget.GetText(); - String aScheme = GetSchemeFromURL(aStrURL); - - INetURLObject aURL(aStrURL); - - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - aURL.SetSmartProtocol( GetSmartProtocolFromButtons() ); - aURL.SetSmartURL(aStrURL); - } - - // username and password for ftp-url - if( aURL.GetProtocol() == INET_PROT_FTP && maEdLogin.GetText().Len()!=0 ) - aURL.SetUserAndPass ( maEdLogin.GetText(), maEdPassword.GetText() ); - - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - else //#105788# always create a URL even if it is not valid - return aStrURL; -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkInternetTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkInternetTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetInitFocus() -{ - maCbbTarget.GrabFocus(); -} - -/************************************************************************* -|* -|* Contents of editfield "Target" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromURL( maCbbTarget.GetText() ); - if(aScheme.Len()!=0) - SetScheme( aScheme ); - - // start timer - maTimer.SetTimeout( 2500 ); - maTimer.Start(); - - return( 0L ); -} - -/************************************************************************* -|* -|* If target-field was modify, to browse the new doc after timeout -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, EMPTYARG ) -{ - RefreshMarkWindow(); - return( 0L ); -} - -/************************************************************************* -|* -|* Contents of editfield "Login" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, void *, EMPTYARG ) -{ - String aStrLogin ( maEdLogin.GetText() ); - if ( aStrLogin.EqualsIgnoreCaseAscii( sAnonymous ) ) - { - maCbAnonymous.Check(); - ClickAnonymousHdl_Impl(NULL); - } - - return( 0L ); -} - -/************************************************************************* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) -{ - //if aScheme is empty or unknown the default beaviour is like it where HTTP - - sal_Bool bFTP = aScheme.SearchAscii( sFTPScheme ) == 0; - sal_Bool bInternet = !(bFTP); - - //update protocol button selection: - maRbtLinktypFTP.Check(bFTP); - maRbtLinktypInternet.Check(bInternet); - - //update target: - RemoveImproperProtocol(aScheme); - maCbbTarget.SetSmartProtocol( GetSmartProtocolFromButtons() ); - - //show/hide special fields for FTP: - maFtLogin.Show( bFTP ); - maFtPassword.Show( bFTP ); - maEdLogin.Show( bFTP ); - maEdPassword.Show( bFTP ); - maCbAnonymous.Show( bFTP ); - - //update 'link target in document'-window and opening-button - if( aScheme.SearchAscii( sHTTPScheme ) == 0 || aScheme.Len() == 0 ) - { - maBtTarget.Enable(); - if ( mbMarkWndOpen ) - ShowMarkWnd (); - } - else - { - //disable for https and ftp - maBtTarget.Disable(); - if ( mbMarkWndOpen ) - HideMarkWnd (); - } -} - -/************************************************************************* -|* -|* Remove protocol if it does not fit to the current button selection -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::RemoveImproperProtocol(const String& aProperScheme) -{ - String aStrURL ( maCbbTarget.GetText() ); - if ( aStrURL != aEmptyStr ) - { - String aStrScheme = GetSchemeFromURL( aStrURL ); - if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme ) - { - aStrURL.Erase ( 0, aStrScheme.Len() ); - maCbbTarget.SetText ( aStrURL ); - } - } -} - -String SvxHyperlinkInternetTp::GetSchemeFromButtons() const -{ - if( maRbtLinktypFTP.IsChecked() ) - { - return String::CreateFromAscii( INET_FTP_SCHEME ); - } - return String::CreateFromAscii( INET_HTTP_SCHEME ); -} - -INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const -{ - if( maRbtLinktypFTP.IsChecked() ) - { - return INET_PROT_FTP; - } - return INET_PROT_HTTP; -} - -/************************************************************************* -|* -|* Click on Radiobutton : Internet or FTP -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, void*, EMPTYARG ) -{ - String aScheme = GetSchemeFromButtons(); - SetScheme( aScheme ); - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Checkbox : Anonymous user -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, void *, EMPTYARG ) -{ - // disable login-editfields if checked - if ( maCbAnonymous.IsChecked() ) - { - if ( maEdLogin.GetText().ToLowerAscii().SearchAscii ( sAnonymous ) == 0 ) - { - maStrOldUser = aEmptyStr; - maStrOldPassword = aEmptyStr; - } - else - { - maStrOldUser = maEdLogin.GetText(); - maStrOldPassword = maEdPassword.GetText(); - } - - setAnonymousFTPUser(); - } - else - setFTPUser(maStrOldUser, maStrOldPassword); - - return( 0L ); -} - -/************************************************************************* -|* -|* Combobox Target lost the focus -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, void *, EMPTYARG ) -{ - RefreshMarkWindow(); - return (0L); -} - -/************************************************************************* -|* -|* Click on imagebutton : Browse -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickBrowseHdl_Impl, void *, EMPTYARG ) -{ - ///////////////////////////////////////////////// - // Open URL if available - - SfxStringItem aName( SID_FILE_NAME, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "http://" ) ) ); - SfxStringItem aRefererItem( SID_REFERER, UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "private:user" ) ) ); - SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_True ); - SfxBoolItem aSilent( SID_SILENT, sal_True ); - SfxBoolItem aReadOnly( SID_DOC_READONLY, sal_True ); - - SfxBoolItem aBrowse( SID_BROWSE, sal_True ); - - const SfxPoolItem *ppItems[] = { &aName, &aNewView, &aSilent, &aReadOnly, &aRefererItem, &aBrowse, NULL }; - (((SvxHpLinkDlg*)mpDialog)->GetBindings())->Execute( SID_OPENDOC, ppItems, 0, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on imagebutton : Target -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkInternetTp, ClickTargetHdl_Impl, void *, EMPTYARG ) -{ - RefreshMarkWindow(); - ShowMarkWnd (); - mbMarkWndOpen = IsMarkWndVisible (); - - return( 0L ); -} - -void SvxHyperlinkInternetTp::RefreshMarkWindow() -{ - if ( maRbtLinktypInternet.IsChecked() && IsMarkWndVisible() ) - { - EnterWait(); - String aStrURL( CreateAbsoluteURL() ); - if ( aStrURL != aEmptyStr ) - mpMarkWnd->RefreshTree ( aStrURL ); - else - mpMarkWnd->SetError( LERR_DOCNOTOPEN ); - LeaveWait(); - } - -} - -/************************************************************************* -|* -|* Get String from Bookmark-Wnd -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetMarkStr ( String& aStrMark ) -{ - String aStrURL ( maCbbTarget.GetText() ); - - const sal_Unicode sUHash = '#'; - xub_StrLen nPos = aStrURL.SearchBackward( sUHash ); - - if( nPos != STRING_NOTFOUND ) - aStrURL.Erase ( nPos ); - - aStrURL += sUHash; - aStrURL += aStrMark; - - maCbbTarget.SetText ( aStrURL ); -} - -/************************************************************************* -|* -|* Enable Browse-Button in subject to the office is in onlinemode -|* -|************************************************************************/ - -void SvxHyperlinkInternetTp::SetOnlineMode( sal_Bool /*bEnable*/ ) -{ - // State of target-button in subject to the current url-string - // ( Can't display any targets in an document, if there is no - // valid url to a document ) - String aStrCurrentTarget( maCbbTarget.GetText() ); - aStrCurrentTarget.EraseTrailingChars(); - - if( aStrCurrentTarget == aEmptyStr || - aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPScheme ) || - aStrCurrentTarget.EqualsIgnoreCaseAscii( sHTTPSScheme ) ) - maBtTarget.Enable( sal_False ); - else - maBtTarget.Enable( sal_True ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx deleted file mode 100644 index 09f064938..000000000 --- a/cui/source/dialogs/hlmailtp.cxx +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "hlmailtp.hxx" -#include "hyperdlg.hrc" - -using namespace ::rtl; -using namespace ::com::sun::star; - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperlinkMailTp::SvxHyperlinkMailTp ( Window *pParent, const SfxItemSet& rItemSet) -: SvxHyperlinkTabPageBase ( pParent, CUI_RES( RID_SVXPAGE_HYPERLINK_MAIL ), - rItemSet ), - maGrpMailNews ( this, CUI_RES (GRP_MAILNEWS) ), - maRbtMail ( this, CUI_RES (RB_LINKTYP_MAIL) ), - maRbtNews ( this, CUI_RES (RB_LINKTYP_NEWS) ), - maFtReceiver ( this, CUI_RES (FT_RECEIVER) ), - maCbbReceiver ( this, INET_PROT_MAILTO ), - maBtAdrBook ( this, CUI_RES (BTN_ADRESSBOOK) ), - maFtSubject ( this, CUI_RES (FT_SUBJECT) ), - maEdSubject ( this, CUI_RES (ED_SUBJECT) ) -{ - // Disable display of bitmap names. - maBtAdrBook.EnableTextDisplay (sal_False); - - InitStdControls(); - FreeResource(); - - // Init URL-Box (pos&size, Open-Handler) - maCbbReceiver.SetPosSizePixel ( LogicToPixel( Point( COL_2, 25 ), MAP_APPFONT ), - LogicToPixel( Size ( 176 - COL_DIFF, 60), MAP_APPFONT ) ); - - maCbbReceiver.Show(); - maCbbReceiver.SetHelpId( HID_HYPERDLG_MAIL_PATH ); - - SetExchangeSupport (); - - // set defaults - maRbtMail.Check (); - - // overload handlers - maRbtMail.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) ); - maRbtNews.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, Click_SmartProtocol_Impl ) ); - maBtAdrBook.SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) ); - maCbbReceiver.SetModifyHdl ( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) ); - - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - maBtAdrBook.Hide(); - - maBtAdrBook.SetAccessibleRelationMemberOf( &maGrpMailNews ); - maBtAdrBook.SetAccessibleRelationLabeledBy( &maFtReceiver ); -} - -SvxHyperlinkMailTp::~SvxHyperlinkMailTp () -{ -} - -/************************************************************************* -|* -|* Fill the all dialog-controls except controls in groupbox "more..." -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::FillDlgFields ( String& aStrURL ) -{ - const sal_Char sMailtoScheme[] = INET_MAILTO_SCHEME; - - INetURLObject aURL( aStrURL ); - String aStrScheme = GetSchemeFromURL( aStrURL ); - - // set URL-field and additional controls - String aStrURLc ( aStrURL ); - // set additional controls for EMail: - if ( aStrScheme.SearchAscii( sMailtoScheme ) == 0 ) - { - // Find mail-subject - String aStrSubject, aStrTmp ( aStrURLc ); - - const sal_Char sSubject[] = "subject"; - xub_StrLen nPos = aStrTmp.ToLowerAscii().SearchAscii( sSubject, 0 ); - nPos = aStrTmp.Search( sal_Unicode( '=' ), nPos ); - - if ( nPos != STRING_NOTFOUND ) - aStrSubject = aStrURLc.Copy( nPos+1, aStrURLc.Len() ); - - nPos = aStrURLc.Search ( sal_Unicode( '?' ), 0); - - aStrURLc = aStrURLc.Copy( 0, ( nPos == STRING_NOTFOUND ? - aStrURLc.Len() : nPos ) ); - - maEdSubject.SetText ( aStrSubject ); - } - else - { - maEdSubject.SetText (aEmptyStr); - } - - maCbbReceiver.SetText ( aStrURLc ); - - SetScheme( aStrScheme ); -} - -/************************************************************************* -|* -|* retrieve and prepare data from dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrURL = CreateAbsoluteURL(); - GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); -} - -String SvxHyperlinkMailTp::CreateAbsoluteURL() const -{ - String aStrURL = maCbbReceiver.GetText(); - INetURLObject aURL(aStrURL); - - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - aURL.SetSmartProtocol( GetSmartProtocolFromButtons() ); - aURL.SetSmartURL(aStrURL); - } - - // subject for EMail-url - if( aURL.GetProtocol() == INET_PROT_MAILTO ) - { - if ( maEdSubject.GetText() != aEmptyStr ) - { - String aQuery = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "subject=" ) ); - aQuery.Append( maEdSubject.GetText() ); - aURL.SetParam(aQuery); - } - } - - if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - return aURL.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); - else //#105788# always create a URL even if it is not valid - return aStrURL; -} - -/************************************************************************* -|* -|* static method to create Tabpage -|* -|************************************************************************/ - -IconChoicePage* SvxHyperlinkMailTp::Create( Window* pWindow, const SfxItemSet& rItemSet ) -{ - return( new SvxHyperlinkMailTp( pWindow, rItemSet ) ); -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::SetInitFocus() -{ - maCbbReceiver.GrabFocus(); -} - -/************************************************************************* -|************************************************************************/ - -void SvxHyperlinkMailTp::SetScheme( const String& aScheme ) -{ - //if aScheme is empty or unknown the default beaviour is like it where MAIL - const sal_Char sNewsScheme[] = INET_NEWS_SCHEME; - - sal_Bool bMail = aScheme.SearchAscii( sNewsScheme ) != 0; - - //update protocol button selection: - maRbtMail.Check(bMail); - maRbtNews.Check(!bMail); - - //update target: - RemoveImproperProtocol(aScheme); - maCbbReceiver.SetSmartProtocol( GetSmartProtocolFromButtons() ); - - //show/hide special fields for MAIL: - maFtSubject.Enable(bMail); - maEdSubject.Enable(bMail); -} - -/************************************************************************* -|* -|* Remove protocol if it does not fit to the current button selection -|* -|************************************************************************/ - -void SvxHyperlinkMailTp::RemoveImproperProtocol(const String& aProperScheme) -{ - String aStrURL ( maCbbReceiver.GetText() ); - if ( aStrURL != aEmptyStr ) - { - String aStrScheme = GetSchemeFromURL( aStrURL ); - if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme ) - { - aStrURL.Erase ( 0, aStrScheme.Len() ); - maCbbReceiver.SetText ( aStrURL ); - } - } -} - -String SvxHyperlinkMailTp::GetSchemeFromButtons() const -{ - if( maRbtNews.IsChecked() ) - { - return String::CreateFromAscii( INET_NEWS_SCHEME ); - } - return String::CreateFromAscii( INET_MAILTO_SCHEME ); -} - -INetProtocol SvxHyperlinkMailTp::GetSmartProtocolFromButtons() const -{ - if( maRbtNews.IsChecked() ) - { - return INET_PROT_NEWS; - } - return INET_PROT_MAILTO; -} - -/************************************************************************* -|* -|* Click on radiobutton : Type EMail -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, Click_SmartProtocol_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromButtons(); - SetScheme( aScheme ); - return( 0L ); -} - -/************************************************************************* -|* -|* Contens of editfield "receiver" modified -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, void *, EMPTYARG ) -{ - String aScheme = GetSchemeFromURL( maCbbReceiver.GetText() ); - if(aScheme.Len()!=0) - SetScheme( aScheme ); - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on imagebutton : addressbook -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, void *, EMPTYARG ) -{ - SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - if( pViewFrame ) - { - SfxItemPool &rPool = pViewFrame->GetPool(); - SfxRequest aReq(SID_VIEW_DATA_SOURCE_BROWSER, 0, rPool); - pViewFrame->ExecuteSlot( aReq, sal_True ); - } - - - return( 0L ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx deleted file mode 100644 index 27845339b..000000000 --- a/cui/source/dialogs/hlmarkwn.cxx +++ /dev/null @@ -1,521 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include - -// UNO-Stuff -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include "hlmarkwn.hrc" -#include "hlmarkwn.hxx" -#include "hltpbase.hxx" - -using namespace ::com::sun::star; -using namespace ::rtl; - -/************************************************************************* -|* -|* Userdata-struct for tree-entries -|* -|************************************************************************/ - -struct TargetData -{ - OUString aUStrLinkname; - sal_Bool bIsTarget; - - TargetData ( OUString aUStrLName, sal_Bool bTarget ) - : bIsTarget ( bTarget ) - { - if ( bIsTarget ) - aUStrLinkname = aUStrLName; - } -}; - - -//######################################################################## -//# # -//# Tree-Window # -//# # -//######################################################################## - -SvxHlmarkTreeLBox::SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId ) -: SvTreeListBox ( pParent, rResId ), - mpParentWnd ( (SvxHlinkDlgMarkWnd*) pParent ) -{ - SetNodeDefaultImages(); -} - -void SvxHlmarkTreeLBox::Paint( const Rectangle& rRect ) -{ - if( mpParentWnd->mnError == LERR_NOERROR ) - { - SvTreeListBox::Paint(rRect); - } - else - { - Erase(); - - Rectangle aDrawRect( Point( 0, 0 ), GetSizePixel() ); - - String aStrMessage; - - switch( mpParentWnd->mnError ) - { - case LERR_NOENTRIES : - aStrMessage = CUI_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES ); - break; - case LERR_DOCNOTOPEN : - aStrMessage = CUI_RESSTR( RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN ); - break; - } - - DrawText( aDrawRect, aStrMessage, TEXT_DRAW_LEFT | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - } - -} - -//######################################################################## -//# # -//# Window-Class # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent ) -: ModalDialog( (Window*)pParent, CUI_RES ( RID_SVXFLOAT_HYPERLINK_MARKWND ) ), - maBtApply( this, CUI_RES (BT_APPLY) ), - maBtClose( this, CUI_RES (BT_CLOSE) ), - maLbTree ( this, CUI_RES (TLB_MARK) ), - mbUserMoved ( sal_False ), - mbFirst ( sal_True ), - mpParent ( pParent ), - mnError ( LERR_NOERROR ) -{ - FreeResource(); - - maBtApply.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) ); - maBtClose.SetClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl ) ); - maLbTree.SetDoubleClickHdl ( LINK ( this, SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl ) ); - - // Tree-ListBox mit Linien versehen - maLbTree.SetStyle( maLbTree.GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | - WB_HASBUTTONS | //WB_HASLINESATROOT | - WB_HSCROLL | WB_HASBUTTONSATROOT ); - - maLbTree.SetAccessibleName(String(CUI_RES(STR_MARK_TREE))); - -} - -SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd() -{ - ClearTree(); -} - -/************************************************************************* -|* -|* Set an errorstatus -|* -|************************************************************************/ - -sal_uInt16 SvxHlinkDlgMarkWnd::SetError( sal_uInt16 nError) -{ - sal_uInt16 nOldError = mnError; - mnError = nError; - - if( mnError != LERR_NOERROR ) - ClearTree(); - - maLbTree.Invalidate(); - - return nOldError; -} - -/************************************************************************* -|* -|* Move window -|* -|************************************************************************/ - -sal_Bool SvxHlinkDlgMarkWnd::MoveTo ( Point aNewPos ) -{ - if ( !mbUserMoved ) - { - sal_Bool bOldStatus = mbUserMoved; - SetPosPixel ( aNewPos ); - mbUserMoved = bOldStatus; - } - - return mbUserMoved; -} - -void SvxHlinkDlgMarkWnd::Move () -{ - Window::Move(); - - if ( IsReallyVisible() ) - mbUserMoved = sal_True; -} - -sal_Bool SvxHlinkDlgMarkWnd::ConnectToDialog( sal_Bool bDoit ) -{ - sal_Bool bOldStatus = mbUserMoved; - - mbUserMoved = !bDoit; - - return bOldStatus; -} - -/************************************************************************* -|* -|* Interface to refresh tree -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::RefreshTree ( String aStrURL ) -{ - String aEmptyStr; - OUString aUStrURL; - - EnterWait(); - - ClearTree(); - - xub_StrLen nPos = aStrURL.Search ( sal_Unicode('#') ); - - if( nPos != 0 ) - aUStrURL = ::rtl::OUString( aStrURL ); - - if( !RefreshFromDoc ( aUStrURL ) ) - maLbTree.Invalidate(); - - if ( nPos != STRING_NOTFOUND ) - { - String aStrMark = aStrURL.Copy ( nPos+1 ); - SelectEntry ( aStrMark ); - } - - LeaveWait(); - - maStrLastURL = aStrURL; -} - -/************************************************************************* -|* -|* get links from document -|* -|************************************************************************/ - -sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL ) -{ - mnError = LERR_NOERROR; - - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY ); - if( xDesktop.is() ) - { - uno::Reference< lang::XComponent > xComp; - - if( aURL.getLength() ) - { - // load from url - uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY ); - if( xLoader.is() ) - { - try - { - uno::Sequence< beans::PropertyValue > aArg(1); - aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" )); - aArg.getArray()[0].Value <<= (sal_Bool) sal_True; - xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg ); - } - catch( const io::IOException& ) - { - - } - catch( const lang::IllegalArgumentException& ) - { - - } - } - } - else - { - // the component with user focus ( current document ) - xComp = xDesktop->getCurrentComponent(); - } - - if( xComp.is() ) - { - uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY ); - - if( xLTS.is() ) - { - if( FillTree( xLTS->getLinks() ) == 0 ) - mnError = LERR_NOENTRIES; - } - else - mnError = LERR_DOCNOTOPEN; - - if ( aURL.getLength() ) - xComp->dispose(); - } - else - { - if( aURL.getLength() ) - mnError=LERR_DOCNOTOPEN; - } - } - } - return (mnError==0); -} -/************************************************************************* -|* -|* Fill Tree-Control -|* -|************************************************************************/ - -int SvxHlinkDlgMarkWnd::FillTree( uno::Reference< container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry ) -{ - int nEntries=0; - const uno::Sequence< OUString > aNames( xLinks->getElementNames() ); - const sal_uLong nLinks = aNames.getLength(); - const OUString* pNames = aNames.getConstArray(); - - Color aMaskColor( COL_LIGHTMAGENTA ); - const OUString aProp_LinkDisplayName( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayName" ) ); - const OUString aProp_LinkTarget( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.LinkTarget" ) ); - const OUString aProp_LinkDisplayBitmap( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayBitmap" ) ); - for( sal_uLong i = 0; i < nLinks; i++ ) - { - uno::Any aAny; - OUString aLink( *pNames++ ); - - sal_Bool bError = sal_False; - try - { - aAny = xLinks->getByName( aLink ); - } - catch(const uno::Exception&) - { - // if the name of the target was invalid (like empty headings) - // no object can be provided - bError = sal_True; - } - if(bError) - continue; - - uno::Reference< beans::XPropertySet > xTarget; - - if( aAny >>= xTarget ) - { - try - { - // get name to display - aAny = xTarget->getPropertyValue( aProp_LinkDisplayName ); - OUString aDisplayName; - aAny >>= aDisplayName; - String aStrDisplayname ( aDisplayName ); - - // is it a target ? - uno::Reference< lang::XServiceInfo > xSI( xTarget, uno::UNO_QUERY ); - sal_Bool bIsTarget = xSI->supportsService( aProp_LinkTarget ); - - // create userdata - TargetData *pData = new TargetData ( aLink, bIsTarget ); - - SvLBoxEntry* pEntry; - - try - { - // get bitmap for the tree-entry - uno::Reference< awt::XBitmap > aXBitmap( xTarget->getPropertyValue( aProp_LinkDisplayBitmap ), uno::UNO_QUERY ); - if( aXBitmap.is() ) - { - Image aBmp( VCLUnoHelper::GetBitmap( aXBitmap ).GetBitmap(), aMaskColor ); - // insert Displayname into treelist with bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - aBmp, aBmp, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - else - { - // insert Displayname into treelist without bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - } - catch(const com::sun::star::uno::Exception&) - { - // insert Displayname into treelist without bitmaps - pEntry = maLbTree.InsertEntry ( aStrDisplayname, - pParentEntry, - sal_False, LIST_APPEND, - (void*)pData ); - nEntries++; - } - - uno::Reference< document::XLinkTargetSupplier > xLTS( xTarget, uno::UNO_QUERY ); - if( xLTS.is() ) - nEntries += FillTree( xLTS->getLinks(), pEntry ); - } - catch(const com::sun::star::uno::Exception&) - { - } - } - } - - return nEntries; -} - -/************************************************************************* -|* -|* Clear Tree -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::ClearTree() -{ - SvLBoxEntry* pEntry = maLbTree.First(); - - while ( pEntry ) - { - TargetData* pUserData = ( TargetData * ) pEntry->GetUserData(); - delete pUserData; - - pEntry = maLbTree.Next( pEntry ); - } - - maLbTree.Clear(); -} - -/************************************************************************* -|* -|* Find Entry for Strng -|* -|************************************************************************/ - -SvLBoxEntry* SvxHlinkDlgMarkWnd::FindEntry ( String aStrName ) -{ - sal_Bool bFound=sal_False; - SvLBoxEntry* pEntry = maLbTree.First(); - - while ( pEntry && !bFound ) - { - TargetData* pUserData = ( TargetData * ) pEntry->GetUserData (); - if ( aStrName == String( pUserData->aUStrLinkname ) ) - bFound = sal_True; - else - pEntry = maLbTree.Next( pEntry ); - } - - return pEntry; -} - -/************************************************************************* -|* -|* Select Entry -|* -|************************************************************************/ - -void SvxHlinkDlgMarkWnd::SelectEntry ( String aStrMark ) -{ - SvLBoxEntry* pEntry = FindEntry ( aStrMark ); - if ( pEntry ) - { - maLbTree.Select ( pEntry ); - maLbTree.MakeVisible ( pEntry ); - } -} - -/************************************************************************* -|* -|* Click on Apply-Button / Doubleclick on item in tree -|* -|************************************************************************/ - -IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, void *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = maLbTree.GetCurEntry(); - - if ( pEntry ) - { - TargetData *pData = ( TargetData * )pEntry->GetUserData(); - - if ( pData->bIsTarget ) - { - String aStrMark ( pData->aUStrLinkname ); - mpParent->SetMarkStr ( aStrMark ); - } - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Click on Close-Button -|* -|************************************************************************/ - -IMPL_LINK ( SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, void *, EMPTYARG ) -{ - Close(); - - return( 0L ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hlmarkwn.hrc b/cui/source/dialogs/hlmarkwn.hrc deleted file mode 100644 index 53614b36f..000000000 --- a/cui/source/dialogs/hlmarkwn.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define BT_APPLY 1 -#define BT_CLOSE 2 -#define TLB_MARK 3 -// IAccessibility2 implementation 2009. ------ -#define STR_MARK_TREE 5000 -// ------ IAccessibility2 implementation 2009. - diff --git a/cui/source/dialogs/hlmarkwn.src b/cui/source/dialogs/hlmarkwn.src deleted file mode 100644 index 8f901a429..000000000 --- a/cui/source/dialogs/hlmarkwn.src +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "helpid.hrc" -#include "hlmarkwn.hrc" - -ModalDialog RID_SVXFLOAT_HYPERLINK_MARKWND -{ - HelpID = HID_HYPERLINK_MARKWND; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ;//????? - Sizeable = FALSE ; - Border = TRUE ; - Hide = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 109 , 185 ) ; - Text [ en-US ] = "Target in Document" ; - PushButton BT_APPLY - { - HelpId = HID_HYPERLINK_MARKWND_APPLY; - Pos = MAP_APPFONT ( 3 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "Apply" ; - }; - PushButton BT_CLOSE - { - HelpId = HID_HYPERLINK_MARKWND_CLOSE; - Pos = MAP_APPFONT ( 56 , 168 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Close" ; - }; - Control TLB_MARK - { - HelpId = HID_HYPERLINK_MARKWND_TREE; - Border = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 103 , 162 ) ; - TabStop = TRUE ; - }; -}; - -String RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES -{ - Text [ en-US ] = "Targets do not exist in the document." ; -}; - -String RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN -{ - Text [ en-US ] = "Couldn't open the document." ; -}; - -String STR_MARK_TREE -{ - Text [ en-US ] = "Mark Tree" ; -}; - diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx deleted file mode 100644 index 963bb2aea..000000000 --- a/cui/source/dialogs/hltpbase.cxx +++ /dev/null @@ -1,739 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "hyperdlg.hrc" -#include "cuihyperdlg.hxx" -#include "hltpbase.hxx" -#include "macroass.hxx" -#include -#include - -using namespace ::ucbhelper; - -//######################################################################## -//# # -//# ComboBox-Control, which is filled with all current framenames # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxFramesComboBox::SvxFramesComboBox ( Window* pParent, const ResId& rResId, - SfxDispatcher* pDispatch ) -: ComboBox (pParent, rResId) -{ - TargetList* pList = new TargetList; - SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; - SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetTopFrame() : 0; - if ( pFrame ) - { - pFrame->GetTargetList(*pList); - if( !pList->empty() ) - { - size_t nCount = pList->size(); - size_t i; - for ( i = 0; i < nCount; i++ ) - { - InsertEntry( *pList->at( i ) ); - } - for ( i = nCount; i; ) - { - delete pList->at( --i ); - } - } - delete pList; - } -} - -SvxFramesComboBox::~SvxFramesComboBox () -{ -} -//######################################################################## -//# # -//# ComboBox-Control for URL's with History and Autocompletion # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Contructor / Destructor -|* -|************************************************************************/ - -SvxHyperURLBox::SvxHyperURLBox( Window* pParent, INetProtocol eSmart, sal_Bool bAddresses ) -: SvtURLBox ( pParent, eSmart ), - DropTargetHelper ( this ), - mbAccessAddress (bAddresses) -{ -} - -sal_Int8 SvxHyperURLBox::AcceptDrop( const AcceptDropEvent& /* rEvt */ ) -{ - return( IsDropFormatSupported( FORMAT_STRING ) ? DND_ACTION_COPY : DND_ACTION_NONE ); -} - -sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt ) -{ - TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); - String aString; - sal_Int8 nRet = DND_ACTION_NONE; - - if( aDataHelper.GetString( FORMAT_STRING, aString ) ) - { - SetText( aString ); - nRet = DND_ACTION_COPY; - } - - return nRet; -} - -void SvxHyperURLBox::Select() -{ - SvtURLBox::Select(); -} -void SvxHyperURLBox::Modify() -{ - SvtURLBox::Modify(); -} -long SvxHyperURLBox::Notify( NotifyEvent& rNEvt ) -{ - return SvtURLBox::Notify( rNEvt ); -} -long SvxHyperURLBox::PreNotify( NotifyEvent& rNEvt ) -{ - return SvtURLBox::PreNotify( rNEvt ); -} - -//######################################################################## -//# # -//# Hyperlink-Dialog: Tabpages-Baseclass # -//# # -//######################################################################## - -/************************************************************************* -|* -|* Con/Destructor, Initialize -|* -\************************************************************************/ - -SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( Window *pParent, - const ResId &rResId, - const SfxItemSet& rItemSet ) -: IconChoicePage ( pParent, rResId, rItemSet ), - mpGrpMore ( NULL ), - mpFtFrame ( NULL ), - mpCbbFrame ( NULL ), - mpFtForm ( NULL ), - mpLbForm ( NULL ), - mpFtIndication ( NULL ), - mpEdIndication ( NULL ), - mpFtText ( NULL ), - mpEdText ( NULL ), - mpBtScript ( NULL ), - mbIsCloseDisabled ( sal_False ), - mpDialog ( pParent ), - mbStdControlsInit ( sal_False ), - aEmptyStr() -{ - // create bookmark-window - mpMarkWnd = new SvxHlinkDlgMarkWnd ( this ); -} - -SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase () -{ - maTimer.Stop(); - - if ( mbStdControlsInit ) - { - delete mpGrpMore; - delete mpFtFrame; - delete mpCbbFrame; - delete mpFtForm; - delete mpLbForm; - delete mpFtIndication; - delete mpEdIndication; - delete mpFtText; - delete mpEdText ; - delete mpBtScript; - } - - delete mpMarkWnd; -} - -void SvxHyperlinkTabPageBase::ActivatePage() -{ - TabPage::ActivatePage(); -} - -void SvxHyperlinkTabPageBase::DeactivatePage() -{ - TabPage::DeactivatePage(); -} - -sal_Bool SvxHyperlinkTabPageBase::QueryClose() -{ - return !mbIsCloseDisabled; -} - -void SvxHyperlinkTabPageBase::InitStdControls () -{ - if ( !mbStdControlsInit ) - { - mpGrpMore = new FixedLine ( this, ResId (GRP_MORE, *m_pResMgr) ); - mpFtFrame = new FixedText ( this, ResId (FT_FRAME, *m_pResMgr) ); - mpCbbFrame = new SvxFramesComboBox ( this, ResId (CB_FRAME, *m_pResMgr), GetDispatcher() ); - mpFtForm = new FixedText ( this, ResId (FT_FORM, *m_pResMgr) ); - mpLbForm = new ListBox ( this, ResId (LB_FORM, *m_pResMgr) ); - mpFtIndication= new FixedText ( this, ResId (FT_INDICATION, *m_pResMgr) ); - mpEdIndication= new Edit ( this, ResId (ED_INDICATION, *m_pResMgr) ); - mpFtText = new FixedText ( this, ResId (FT_TEXT, *m_pResMgr) ); - mpEdText = new Edit ( this, ResId (ED_TEXT, *m_pResMgr) ); - mpBtScript = new ImageButton ( this, ResId (BTN_SCRIPT, *m_pResMgr) ); - - mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) ); - mpBtScript->EnableTextDisplay (sal_False); - - mpBtScript->SetAccessibleRelationMemberOf( mpGrpMore ); - mpBtScript->SetAccessibleRelationLabeledBy( mpFtForm ); - } - - mbStdControlsInit = sal_True; -} - -/************************************************************************* -|* -|* Move Extra-Window -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::MoveToExtraWnd( Point aNewPos, sal_Bool bDisConnectDlg ) -{ - sal_Bool bReturn = mpMarkWnd->MoveTo ( aNewPos ); - - if( bDisConnectDlg ) - mpMarkWnd->ConnectToDialog( sal_False ); - - return ( !bReturn && IsMarkWndVisible() ); -} - -/************************************************************************* -|* -|* Show Extra-Window -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::ShowMarkWnd () -{ - ( ( Window* ) mpMarkWnd )->Show(); - - // Size of dialog-window in screen pixels - Rectangle aDlgRect( mpDialog->GetWindowExtentsRelative( NULL ) ); - Point aDlgPos ( aDlgRect.TopLeft() ); - Size aDlgSize ( mpDialog->GetSizePixel () ); - - // Absolute size of the screen - Rectangle aScreen( mpDialog->GetDesktopRectPixel() ); - - // Size of Extrawindow - Size aExtraWndSize( mpMarkWnd->GetSizePixel () ); - - // mpMarkWnd is a child of mpDialog, so coordinates for positioning must be relative to mpDialog - if( aDlgPos.X()+(1.05*aDlgSize.Width())+aExtraWndSize.Width() > aScreen.Right() ) - { - if( aDlgPos.X() - ( 0.05*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 ) - { - // Pos Extrawindow anywhere - MoveToExtraWnd( Point(10,10) ); // very unlikely - mpMarkWnd->ConnectToDialog( sal_False ); - } - else - { - // Pos Extrawindow on the left side of Dialog - MoveToExtraWnd( Point(0,0) - Point( long(0.05*aDlgSize.Width()), 0 ) - Point( aExtraWndSize.Width(), 0 ) ); - } - } - else - { - // Pos Extrawindow on the right side of Dialog - MoveToExtraWnd ( Point( long(1.05*aDlgSize.getWidth()), 0 ) ); - } - - // Set size of Extra-Window - mpMarkWnd->SetSizePixel( Size( aExtraWndSize.Width(), aDlgSize.Height() ) ); -} - -/************************************************************************* -|* -|* Fill Dialogfields -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem ) -{ - // Frame - sal_uInt16 nPos = mpCbbFrame->GetEntryPos ( pHyperlinkItem->GetTargetFrame() ); - if ( nPos != LISTBOX_ENTRY_NOTFOUND) - mpCbbFrame->SetText ( pHyperlinkItem->GetTargetFrame() ); - - // Form - String aStrFormText = CUI_RESSTR( RID_SVXSTR_HYPERDLG_FROM_TEXT ); - String aStrFormButton = CUI_RESSTR( RID_SVXSTR_HYPERDLG_FORM_BUTTON ); - - if( pHyperlinkItem->GetInsertMode() & HLINK_HTMLMODE ) - { - mpLbForm->Clear(); - mpLbForm->InsertEntry( aStrFormText ); - mpLbForm->SelectEntryPos ( 0 ); - } - else - { - mpLbForm->Clear(); - mpLbForm->InsertEntry( aStrFormText ); - mpLbForm->InsertEntry( aStrFormButton ); - mpLbForm->SelectEntryPos ( pHyperlinkItem->GetInsertMode() == HLINK_BUTTON ? 1 : 0 ); - } - - // URL - mpEdIndication->SetText ( pHyperlinkItem->GetName() ); - - // Name - mpEdText->SetText ( pHyperlinkItem->GetIntName() ); - - // Script-button - if ( !pHyperlinkItem->GetMacroEvents() ) - mpBtScript->Disable(); - else - mpBtScript->Enable(); -} - -/************************************************************************* -|* -|* Any action to do after apply-button is pressed -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::DoApply () -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* Ask page whether an insert is possible -|* -\************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::AskApply () -{ - // default-implementation - return sal_True; -} - -/************************************************************************* -|* -|* This method would be called from bookmark-window to set new mark-string -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::SetMarkStr ( String& /*aStrMark*/ ) -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* This method will be called from the dialog-class if the state off -|* the online-mode has changed. -|* -\************************************************************************/ - -void SvxHyperlinkTabPageBase::SetOnlineMode( sal_Bool /*bEnable*/ ) -{ - // default-implemtation : do nothing -} - -/************************************************************************* -|* -|* Set initial focus -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::SetInitFocus() -{ - GrabFocus(); -} - -/************************************************************************* -|* -|* Ask dialog whether the curretn doc is a HTML-doc -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::IsHTMLDoc() const -{ - return ((SvxHpLinkDlg*)mpDialog)->IsHTMLDoc(); -} - -/************************************************************************* -|* -|* retrieve dispatcher -|* -|************************************************************************/ - -SfxDispatcher* SvxHyperlinkTabPageBase::GetDispatcher() const -{ - return ((SvxHpLinkDlg*)mpDialog)->GetDispatcher(); -} - -/************************************************************************* -|* -|* Click on imagebutton : Script -|* -|************************************************************************/ - -IMPL_LINK ( SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, void *, EMPTYARG ) -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem->GetMacroEvents() ) - { - // get macros from itemset - const SvxMacroTableDtor* pMacroTbl = pHyperlinkItem->GetMacroTbl(); - SvxMacroItem aItem ( GetWhich(SID_ATTR_MACROITEM) ); - if( pMacroTbl ) - aItem.SetMacroTable( *pMacroTbl ); - - // create empty itemset for macro-dlg - SfxItemSet* pItemSet = new SfxItemSet(SFX_APP()->GetPool(), - SID_ATTR_MACROITEM, - SID_ATTR_MACROITEM ); - pItemSet->Put ( aItem, SID_ATTR_MACROITEM ); - - /* disable HyperLinkDlg for input while the MacroAssignDlg is working - because if no JAVA is installed an error box occurs and then it is possible - to close the HyperLinkDlg before its child (MacroAssignDlg) -> GPF - */ - sal_Bool bIsInputEnabled = GetParent()->IsInputEnabled(); - if ( bIsInputEnabled ) - GetParent()->EnableInput( sal_False ); - SfxMacroAssignDlg aDlg( this, mxDocumentFrame, *pItemSet ); - - // add events - SfxMacroTabPage *pMacroPage = (SfxMacroTabPage*) aDlg.GetTabPage(); - - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOVER_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT1) ), - SFX_EVENT_MOUSEOVER_OBJECT ); - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSECLICK_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT2) ), - SFX_EVENT_MOUSECLICK_OBJECT); - if ( pHyperlinkItem->GetMacroEvents() & HYPERDLG_EVENT_MOUSEOUT_OBJECT ) - pMacroPage->AddEvent( String( CUI_RESSTR(RID_SVXSTR_HYPDLG_MACROACT3) ), - SFX_EVENT_MOUSEOUT_OBJECT); - - if ( bIsInputEnabled ) - GetParent()->EnableInput( sal_True ); - // execute dlg - DisableClose( sal_True ); - short nRet = aDlg.Execute(); - DisableClose( sal_False ); - if ( RET_OK == nRet ) - { - const SfxItemSet* pOutSet = aDlg.GetOutputItemSet(); - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, sal_False, &pItem )) - { - pHyperlinkItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() ); - } - } - delete pItemSet; - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Get Macro-Infos -|* -|************************************************************************/ - -sal_uInt16 SvxHyperlinkTabPageBase::GetMacroEvents() -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - return pHyperlinkItem->GetMacroEvents(); -} - -SvxMacroTableDtor* SvxHyperlinkTabPageBase::GetMacroTable() -{ - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - GetItemSet().GetItem (SID_HYPERLINK_GETLINK); - - return ( (SvxMacroTableDtor*)pHyperlinkItem->GetMacroTbl() ); -} - -/************************************************************************* -|* -|* Does the given file exists ? -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::FileExists( const INetURLObject& rURL ) -{ - sal_Bool bRet = sal_False; - - if( rURL.GetFull().getLength() > 0 ) - { - try - { - Content aCnt( rURL.GetMainURL( INetURLObject::NO_DECODE ), ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - ::rtl::OUString aTitle; - - aCnt.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) ) >>= aTitle; - bRet = ( aTitle.getLength() > 0 ); - } - catch( ... ) - { - OSL_FAIL( "FileExists: ucb error" ); - } - } - - return bRet; -} - -/************************************************************************* -|* -|* try to detect the current protocol that is used in aStrURL -|* -|************************************************************************/ - -String SvxHyperlinkTabPageBase::GetSchemeFromURL( String aStrURL ) -{ - String aStrScheme; - - INetURLObject aURL( aStrURL ); - INetProtocol aProtocol = aURL.GetProtocol(); - - // #77696# - // our new INetUrlObject now has the ability - // to detect if an Url is valid or not :-( - if ( aProtocol == INET_PROT_NOT_VALID ) - { - if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTP_SCHEME, 0, 7 ) ) - { - aStrScheme = String::CreateFromAscii( INET_HTTP_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_HTTPS_SCHEME, 0, 8 ) ) - { - aStrScheme = String::CreateFromAscii( INET_HTTPS_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_FTP_SCHEME, 0, 6 ) ) - { - aStrScheme = String::CreateFromAscii( INET_FTP_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_MAILTO_SCHEME, 0, 7 ) ) - { - aStrScheme = String::CreateFromAscii( INET_MAILTO_SCHEME ); - } - else if ( aStrURL.EqualsIgnoreCaseAscii( INET_NEWS_SCHEME, 0, 5 ) ) - { - aStrScheme = String::CreateFromAscii( INET_NEWS_SCHEME ); - } - } - else - aStrScheme = INetURLObject::GetScheme( aProtocol ); - return aStrScheme; -} - - -void SvxHyperlinkTabPageBase::GetDataFromCommonFields( String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) -{ - aStrIntName = mpEdText->GetText(); - aStrName = mpEdIndication->GetText(); - aStrFrame = mpCbbFrame->GetText(); - eMode = (SvxLinkInsertMode) (mpLbForm->GetSelectEntryPos()+1); - if( IsHTMLDoc() ) - eMode = (SvxLinkInsertMode) ( sal_uInt16(eMode) | HLINK_HTMLMODE ); -} - -/************************************************************************* -|* -|* reset dialog-fields -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet) -{ - /////////////////////////////////////// - // Set dialog-fields from create-itemset - maStrInitURL = aEmptyStr; - - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - rItemSet.GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem ) - { - // set dialog-fields - FillStandardDlgFields (pHyperlinkItem); - - // set all other fields - FillDlgFields ( (String&)pHyperlinkItem->GetURL() ); - - // Store initial URL - maStrInitURL = pHyperlinkItem->GetURL(); - } -} - -/************************************************************************* -|* -|* Fill output-ItemSet -|* -|************************************************************************/ - -sal_Bool SvxHyperlinkTabPageBase::FillItemSet( SfxItemSet& rOut) -{ - String aStrURL, aStrName, aStrIntName, aStrFrame; - SvxLinkInsertMode eMode; - - GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode); - if ( !aStrName.Len() ) //automatically create a visible name if the link is created without name - aStrName = CreateUiNameFromURL(aStrURL); - - sal_uInt16 nEvents = GetMacroEvents(); - SvxMacroTableDtor* pTable = GetMacroTable(); - - SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK, aStrName, aStrURL, aStrFrame, - aStrIntName, eMode, nEvents, pTable ); - rOut.Put (aItem); - - return sal_True; -} - -String SvxHyperlinkTabPageBase::CreateUiNameFromURL( const String& aStrURL ) -{ - String aStrUiURL; - INetURLObject aURLObj( aStrURL ); - - switch(aURLObj.GetProtocol()) - { - case INET_PROT_FILE: - utl::LocalFileHelper::ConvertURLToSystemPath( aURLObj.GetMainURL(INetURLObject::NO_DECODE), aStrUiURL ); - break; - case INET_PROT_FTP : - { - //remove password from name - INetURLObject aTmpURL(aURLObj); - aTmpURL.SetPass(aEmptyStr); - aStrUiURL = aTmpURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - } - break; - default : - { - aStrUiURL = aURLObj.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS); - } - } - if(!aStrUiURL.Len()) - return aStrURL; - return aStrUiURL; -} - -/************************************************************************* -|* -|* Activate / Deactivate Tabpage -|* -|************************************************************************/ - -void SvxHyperlinkTabPageBase::ActivatePage( const SfxItemSet& rItemSet ) -{ - /////////////////////////////////////// - // Set dialog-fields from input-itemset - SvxHyperlinkItem *pHyperlinkItem = (SvxHyperlinkItem *) - rItemSet.GetItem (SID_HYPERLINK_GETLINK); - - if ( pHyperlinkItem ) - { - // standard-fields - FillStandardDlgFields (pHyperlinkItem); - } - - // show mark-window if it was open before - if ( ShouldOpenMarkWnd () ) - ShowMarkWnd (); -} - -int SvxHyperlinkTabPageBase::DeactivatePage( SfxItemSet* _pSet) -{ - // hide mark-wnd - SetMarkWndShouldOpen( IsMarkWndVisible () ); - HideMarkWnd (); - - // retrieve data of dialog - String aStrURL, aStrName, aStrIntName, aStrFrame; - SvxLinkInsertMode eMode; - - GetCurentItemData ( aStrURL, aStrName, aStrIntName, aStrFrame, eMode); - - sal_uInt16 nEvents = GetMacroEvents(); - SvxMacroTableDtor* pTable = GetMacroTable(); - - if( _pSet ) - { - SvxHyperlinkItem aItem( SID_HYPERLINK_GETLINK, aStrName, aStrURL, aStrFrame, - aStrIntName, eMode, nEvents, pTable ); - _pSet->Put( aItem ); - } - - return( LEAVE_PAGE ); -} - -sal_Bool SvxHyperlinkTabPageBase::ShouldOpenMarkWnd() -{ - return sal_False; -} - -void SvxHyperlinkTabPageBase::SetMarkWndShouldOpen(sal_Bool) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hyperdlg.hrc b/cui/source/dialogs/hyperdlg.hrc deleted file mode 100644 index 7c2c08109..000000000 --- a/cui/source/dialogs/hyperdlg.hrc +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* Tabpage : Hyperlink - Internet */ - -#define GRP_LINKTYPE 1 -#define RB_LINKTYP_INTERNET 2 -#define RB_LINKTYP_FTP 3 -#define FT_TARGET_HTML 5 -#define CB_TARGET_HTML 6 -#define FT_LOGIN 7 -#define ED_LOGIN 8 -#define FT_PASSWD 9 -#define ED_PASSWD 10 -#define CBX_ANONYMOUS 11 -#define BTN_BROWSE 12 -#define BTN_TARGET 13 - -/* Tabpage : Hyperlink - Mail & News */ - -#define GRP_MAILNEWS 1 -#define RB_LINKTYP_MAIL 2 -#define RB_LINKTYP_NEWS 3 -#define FT_RECEIVER 4 -#define CB_RECEIVER 5 -#define FT_SUBJECT 6 -#define ED_SUBJECT 7 -#define BTN_ADRESSBOOK 8 - -/* Tabpage : Hyperlink - Document */ - -#define GRP_DOCUMENT 1 -#define FT_PATH_DOC 2 -#define CB_PATH_DOC 3 -#define BTN_FILEOPEN 4 -#define GRP_TARGET 5 -#define FT_TARGET_DOC 6 -#define ED_TARGET_DOC 7 -#define FT_URL 8 -#define FT_FULL_URL 9 - -/* Tabpage : Hyperlink - New document */ - -#define GRP_NEWDOCUMENT 1 -#define RB_EDITNOW 2 -#define RB_EDITLATER 3 -#define FT_PATH_NEWDOC 4 -#define ED_PATH_NEWDOC 5 -#define FT_DOCUMENT_TYPES 6 -#define LB_DOCUMENT_TYPES 7 -#define BTN_CREATE 8 - -/* Tabpage-section : Hyperlink - more justifications */ - -#define GRP_MORE 30 -#define FT_FRAME 31 -#define CB_FRAME 32 -#define FT_FORM 33 -#define LB_FORM 34 -#define FT_INDICATION 35 -#define ED_INDICATION 36 -#define FT_TEXT 37 -#define ED_TEXT 38 -#define BTN_SCRIPT 39 - -#define COL_OLD 54 -#define COL_2 63 -#define COL_DIFF (COL_2 - COL_OLD) diff --git a/cui/source/dialogs/hyperdlg.src b/cui/source/dialogs/hyperdlg.src deleted file mode 100644 index d52257bc2..000000000 --- a/cui/source/dialogs/hyperdlg.src +++ /dev/null @@ -1,830 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "helpid.hrc" -#include "hyperdlg.hrc" - -#define MASKCOLOR MaskColor = Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; }; -#define HYPERDLG_IMGBUTTON_HEIGHT RSC_CD_PUSHBUTTON_HEIGHT+2 - -/************************************************************************* -| -| Tabpage : Internet -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_INTERNET -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_INTERNET; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_LINKTYPE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Hyperlink type" ; - }; - RadioButton RB_LINKTYP_INTERNET - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_INTERNET:RB_LINKTYP_INTERNET"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 57, 10 ); - Text [ en-US ] = "~Web"; - }; - RadioButton RB_LINKTYP_FTP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_INTERNET:RB_LINKTYP_FTP"; - Pos = MAP_APPFONT( 114 + COL_DIFF, 13 ); - Size = MAP_APPFONT( 56 - COL_DIFF, 10 ); - Text [ en-US ] = "~FTP"; - }; - FixedText FT_TARGET_HTML - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF, 8 ) ; - Text [ en-US ] = "Tar~get" ; - }; - FixedText FT_LOGIN - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Login name" ; - }; - Edit ED_LOGIN - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_LOGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ; - }; - FixedText FT_PASSWD - { - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Password" ; - }; - Edit ED_PASSWD - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_PASSWD"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 59 ) ; - Size = MAP_APPFONT ( 80 - COL_DIFF , 12 ) ; - PassWord = TRUE ; - }; - CheckBox CBX_ANONYMOUS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_HYPERLINK_INTERNET:CBX_ANONYMOUS"; - Pos = MAP_APPFONT ( COL_2 , 75 ) ; - Size = MAP_APPFONT ( 89 - COL_DIFF , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Anonymous ~user" ; - }; - ImageButton BTN_BROWSE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_INTERNET:BTN_BROWSE"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - Text [ en-US ] = "WWW Browser"; - - QuickHelpText [ en-US ] = "Open web browser, copy an URL, and paste it to Target field" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "browse.bmp" ; }; - MASKCOLOR - }; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_INTERNET:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 8 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_INTERNET:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_INTERNET:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_INTERNET:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : Mail & News -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_MAIL -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_MAIL; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_MAILNEWS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Mail & news" ; - }; - RadioButton RB_LINKTYP_MAIL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_MAIL:RB_LINKTYP_MAIL"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 56 - COL_DIFF, 10 ); - Text [ en-US ] = "~E-mail"; - }; - RadioButton RB_LINKTYP_NEWS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_MAIL:RB_LINKTYP_NEWS"; - Pos = MAP_APPFONT( 113, 13 ); - Size = MAP_APPFONT( 56, 10 ); - Text [ en-US ] = "~News"; - }; - FixedText FT_RECEIVER - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Re~ceiver" ; - }; - FixedText FT_SUBJECT - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Subject" ; - }; - Edit ED_SUBJECT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_SUBJECT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_ADRESSBOOK - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_MAIL:BTN_ADRESSBOOK"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "adrbook.bmp" ; }; - MASKCOLOR - }; - - Text [ en-US ] = "Data Sources..."; - QuickHelpText [ en-US ] = "Data Sources..." ; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_MAIL:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_MAIL:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_MAIL:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_MAIL:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : Documents -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_DOCUMENT -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_DOCUMENT; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_DOCUMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Document" ; - }; - FixedText FT_PATH_DOC - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~Path" ; - }; - ImageButton BTN_FILEOPEN - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_FILEOPEN"; - Pos = MAP_APPFONT ( 235, 14 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Open File" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "fileopen.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Open File"; - }; - FixedLine GRP_TARGET - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Target in document" ; - }; - FixedText FT_TARGET_DOC - { - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Targ~et" ; - }; - Edit ED_TARGET_DOC - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_TARGET_DOC"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 52 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 12 , 70 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "URL" ; - }; - FixedText FT_FULL_URL - { - Pos = MAP_APPFONT ( COL_2 , 70 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - Text [ en-US ] = "Test text" ; - }; - ImageButton BTN_BROWSE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_BROWSE"; - Pos = MAP_APPFONT ( 235, 51 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Target in Document" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "target.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Target in Document"; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_DOCUMENT:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_DOCUMENT:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_DOCUMENT:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_DOCUMENT:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage : New Documents -| -*************************************************************************/ - -TabPage RID_SVXPAGE_HYPERLINK_NEWDOCUMENT -{ - Hide = TRUE ; - HelpID = HID_HYPERLINK_NEWDOCUMENT; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 162 ) ; - Text [ en-US ] = "Hyperlink" ; - - FixedLine GRP_NEWDOCUMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "New document" ; - }; - RadioButton RB_EDITNOW - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:RB_EDITNOW"; - Pos = MAP_APPFONT( COL_2, 13 ); - Size = MAP_APPFONT( 85 - COL_DIFF, 10 ); - Text [ en-US ] = "Edit ~now"; - }; - RadioButton RB_EDITLATER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:RB_EDITLATER"; - Pos = MAP_APPFONT( 142, 13 ); - Size = MAP_APPFONT( 84, 10 ); - Text [ en-US ] = "Edit ~later"; - }; - FixedText FT_PATH_NEWDOC - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "~File" ; - }; - Edit ED_PATH_NEWDOC - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_PATH_NEWDOC"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 25 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 12 ) ; - }; - FixedText FT_DOCUMENT_TYPES - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "File ~type" ; - }; - ListBox LB_DOCUMENT_TYPES - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:LB_DOCUMENT_TYPES"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 42 ) ; - Size = MAP_APPFONT ( 176 - COL_DIFF , 40 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - }; - ImageButton BTN_CREATE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:BTN_CREATE"; - Pos = MAP_APPFONT ( 235, 24 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - - QuickHelpText [ en-US ] = "Select Path" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "newdoc.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Select Path"; - }; - - FixedLine GRP_MORE - { - Pos = MAP_APPFONT ( 6 , 92 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Further settings" ; - }; - FixedText FT_FRAME - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "F~rame" ; - }; - ComboBox CB_FRAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:CB_FRAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 104 ) ; - Size = MAP_APPFONT ( 66 - COL_DIFF , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - FixedText FT_FORM - { - Pos = MAP_APPFONT ( 126 , 105 ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "F~orm" ; - }; - ListBox LB_FORM - { - HelpID = "cui:ListBox:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:LB_FORM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 160 , 104 ) ; - Size = MAP_APPFONT ( 70 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - StringList [ en-US ] = - { - < "Text" ; Default ; > ; - < "Button" ; Default ; > ; - }; - }; - FixedText FT_INDICATION - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "Te~xt" ; - }; - Edit ED_INDICATION - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_INDICATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 122 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - FixedText FT_TEXT - { - Pos = MAP_APPFONT ( 12 , 140 ) ; - Size = MAP_APPFONT ( 39 + COL_DIFF , 8 ) ; - Text [ en-US ] = "N~ame" ; - }; - Edit ED_TEXT - { - HelpID = "cui:Edit:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:ED_TEXT"; - Border = TRUE ; - Pos = MAP_APPFONT ( COL_2 , 139 ) ; - Size = MAP_APPFONT ( 194 - COL_DIFF , 12 ) ; - }; - ImageButton BTN_SCRIPT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HYPERLINK_NEWDOCUMENT:BTN_SCRIPT"; - Pos = MAP_APPFONT ( 235, 103-1 ) ; - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_HEIGHT, HYPERDLG_IMGBUTTON_HEIGHT ); - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Events" ; - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "script.bmp" ; }; - MASKCOLOR - }; - Text [ en-US ] = "Events"; - }; -}; - -/************************************************************************* -| -| Tabpage-Dialog : Hyperlinks -| -*************************************************************************/ -ModalDialog RID_SVXDLG_NEWHYPERLINK -{ - HelpID = CMD_SID_HYPERLINK_DIALOG; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 325 , 185 ) ; - Text [ en-US ] = "Hyperlink" ; - Moveable = TRUE ; -}; - -/************************************************************************* -| -| Tabpage-Dialog : Hyperlinks -| -*************************************************************************/ - -String RID_SVXSTR_HYPDLG_APPLYBUT -{ - Text [ en-US ] = "Apply" ; -}; -String RID_SVXSTR_HYPDLG_CLOSEBUT -{ - Text [ en-US ] = "Close" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT1 -{ - Text [ en-US ] = "Mouse over object" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT2 -{ - Text [ en-US ] = "Trigger hyperlink" ; -}; -String RID_SVXSTR_HYPDLG_MACROACT3 -{ - Text [ en-US ] = "Mouse leaves object" ; -}; - -String RID_SVXSTR_HYPDLG_NOVALIDFILENAME -{ - Text [ en-US ] = "Please type in a valid file name." ; -}; - -String RID_SVXSTR_HYPERDLG_HLINETTP -{ - Text [ en-US ] = "Internet" ; -}; -String RID_SVXSTR_HYPERDLG_HLINETTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to a Web page or FTP server connection." ; -}; - -String RID_SVXSTR_HYPERDLG_HLMAILTP -{ - Text [ en-US ] = "Mail & News" ; -}; -String RID_SVXSTR_HYPERDLG_HLMAILTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to an e-mail address or newsgroup." ; -}; - -String RID_SVXSTR_HYPERDLG_HLDOCTP -{ - Text [ en-US ] = "Document" ; -}; -String RID_SVXSTR_HYPERDLG_HLDOCTP_HELP -{ - Text [ en-US ] = "This is where you create a hyperlink to an existing document or a target within a document." ; -}; - -String RID_SVXSTR_HYPERDLG_HLDOCNTP -{ - Text [ en-US ] = "New Document" ; -}; -String RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP -{ - Text [ en-US ] = "This is where you create a new document to which the new link points." ; -}; - -String RID_SVXSTR_HYPERDLG_FORM_BUTTON -{ - Text [ en-US ] = "Button" ; -}; - -String RID_SVXSTR_HYPERDLG_FROM_TEXT -{ - Text [ en-US ] = "Text" ; -}; - -String RID_SVXSTR_HYPERDLG_QUERYOVERWRITE -{ - Text [ en-US ] = "The file already exists. Overwrite?" ; -}; - -Image RID_SVXBMP_HLINETTP -{ - ImageBitmap = Bitmap { File = "hlinettp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLMAILTP -{ - ImageBitmap = Bitmap { File = "hlmailtp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLDOCTP -{ - ImageBitmap = Bitmap { File = "hldoctp.bmp" ; }; - MASKCOLOR -}; - -Image RID_SVXBMP_HLDOCNTP -{ - ImageBitmap = Bitmap { File = "hldocntp.bmp" ; }; - MASKCOLOR -}; diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx deleted file mode 100644 index c9c5c2d82..000000000 --- a/cui/source/dialogs/hyphen.cxx +++ /dev/null @@ -1,653 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "hyphen.hxx" -#include "hyphen.hrc" -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star; - - -#define HYPH_POS_CHAR '=' -#define CONTINUE_HYPH USHRT_MAX - -#define CUR_HYPH_POS_CHAR '-' - - -// class HyphenEdit_Impl ------------------------------------------------------- - -class HyphenEdit_Impl : public Edit -{ -public: - HyphenEdit_Impl( Window* pParent, const ResId& rResId ); - -protected: - virtual void KeyInput( const KeyEvent &rKEvt ); -}; - - -HyphenEdit_Impl::HyphenEdit_Impl( Window* pParent, const ResId& rResId ) : - Edit( pParent, rResId ) -{ -} - - -void HyphenEdit_Impl::KeyInput( const KeyEvent& rKEvt ) -{ - sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); - - switch ( nCode ) - { - case KEY_LEFT: - ( (SvxHyphenWordDialog*)GetParent() )->SelLeft(); - break; - - case KEY_RIGHT: - ( (SvxHyphenWordDialog*)GetParent() )->SelRight(); - break; - - case KEY_TAB: - case KEY_ESCAPE: - case KEY_RETURN: - Edit::KeyInput(rKEvt); - break; - default: - Control::KeyInput( rKEvt ); // An den Dialog weiterleiten - break; - } -} - - -// struct SvxHyphenWordDialog_Impl --------------------------------------------- - -struct SvxHyphenWordDialog_Impl -{ - SvxHyphenWordDialog * m_pDialog; - - FixedText aWordFT; - HyphenEdit_Impl aWordEdit; - ImageButton aLeftBtn; - ImageButton aRightBtn; - OKButton aOkBtn; - PushButton aContBtn; - PushButton aDelBtn; - FixedLine aFLBottom; - HelpButton aHelpBtn; - PushButton aHyphAll; - CancelButton aCancelBtn; - String aLabel; - SvxSpellWrapper* pHyphWrapper; - uno::Reference< linguistic2::XHyphenator > xHyphenator; - uno::Reference< linguistic2::XPossibleHyphens > xPossHyph; - String aEditWord; // aEditWord and aWordEdit.GetText() differ only by the character for the current selected hyphenation position - String aActWord; // actual word to be hyphenated - LanguageType nActLanguage; // and its language - sal_uInt16 nMaxHyphenationPos; // right most valid hyphenation pos - sal_uInt16 nHyphPos; - sal_uInt16 nOldPos; - sal_Int32 nHyphenationPositionsOffset; - sal_Bool bBusy; - - - void EnableLRBtn_Impl(); - String EraseUnusableHyphens_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > &rxPossHyph, sal_uInt16 nMaxHyphenationPos ); - - void InitControls_Impl(); - void ContinueHyph_Impl( sal_uInt16 nInsPos = 0 ); - sal_uInt16 GetHyphIndex_Impl(); - void SelLeft_Impl(); - void SelRight_Impl(); - - DECL_LINK( Left_Impl, Button* ); - DECL_LINK( Right_Impl, Button* ); - DECL_LINK( CutHdl_Impl, Button* ); - DECL_LINK( ContinueHdl_Impl, Button* ); - DECL_LINK( DeleteHdl_Impl, Button* ); - DECL_LINK( HyphenateAllHdl_Impl, Button* ); - DECL_LINK( CancelHdl_Impl, Button* ); - DECL_LINK( GetFocusHdl_Impl, Edit* ); - - - SvxHyphenWordDialog_Impl( - SvxHyphenWordDialog * pDialog, - const String &rWord, - LanguageType nLang, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ); - ~SvxHyphenWordDialog_Impl(); -}; - - -SvxHyphenWordDialog_Impl::SvxHyphenWordDialog_Impl( - SvxHyphenWordDialog * pDialog, - const String &rWord, - LanguageType nLang, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - - m_pDialog ( pDialog ), - aWordFT ( pDialog, CUI_RES( FT_WORD ) ), - aWordEdit ( pDialog, CUI_RES( ED_WORD ) ), - aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), - aRightBtn ( pDialog, CUI_RES( BTN_RIGHT ) ), - aOkBtn ( pDialog, CUI_RES( BTN_HYPH_CUT ) ), - aContBtn ( pDialog, CUI_RES( BTN_HYPH_CONTINUE ) ), - aDelBtn ( pDialog, CUI_RES( BTN_HYPH_DELETE ) ), - aFLBottom ( pDialog, CUI_RES( FL_BOTTOM ) ), - aHelpBtn ( pDialog, CUI_RES( BTN_HYPH_HELP ) ), - aHyphAll ( pDialog, CUI_RES( BTN_HYPH_ALL ) ), - aCancelBtn ( pDialog, CUI_RES( BTN_HYPH_CANCEL ) ), - aLabel ( pDialog->GetText() ), - pHyphWrapper ( NULL ), - xHyphenator ( NULL ), - xPossHyph ( NULL ), - aActWord ( ), - nActLanguage ( LANGUAGE_NONE ), - nMaxHyphenationPos ( 0 ), - nHyphPos ( 0 ), - nOldPos ( 0 ), - nHyphenationPositionsOffset( 0 ), - bBusy ( sal_False ) -{ - aActWord = rWord; - nActLanguage = nLang; - xHyphenator = xHyphen; - pHyphWrapper = pWrapper; - - uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper ? - pHyphWrapper->GetLast() : NULL, uno::UNO_QUERY ); - DBG_ASSERT( xHyphWord.is(), "hyphenation result missing" ); - if (xHyphWord.is()) - { - DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" ); - DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" ); - nMaxHyphenationPos = xHyphWord->getHyphenationPos(); - } - - InitControls_Impl(); - aWordEdit.GrabFocus(); - - aLeftBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Left_Impl ) ); - aRightBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, Right_Impl ) ); - aOkBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CutHdl_Impl ) ); - aContBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, ContinueHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, DeleteHdl_Impl ) ); - aHyphAll.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl ) ); - aCancelBtn.SetClickHdl( LINK( this, SvxHyphenWordDialog_Impl, CancelHdl_Impl ) ); - aWordEdit.SetGetFocusHdl( LINK( this, SvxHyphenWordDialog_Impl, GetFocusHdl_Impl ) ); -} - - -SvxHyphenWordDialog_Impl::~SvxHyphenWordDialog_Impl() -{ -} - - -void SvxHyphenWordDialog_Impl::EnableLRBtn_Impl() -{ - String aTxt( aEditWord ); - xub_StrLen nLen = aTxt.Len(); - xub_StrLen i; - - aRightBtn.Disable(); - for ( i = nOldPos + 2; i < nLen; ++i ) - { - if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) - { - aRightBtn.Enable(); - break; - } - } - - DBG_ASSERT(nOldPos < aTxt.Len(), "nOldPos out of range"); - if (nOldPos >= aTxt.Len()) - nOldPos = aTxt.Len() - 1; - aLeftBtn.Disable(); - for ( i = nOldPos; i-- > 0; ) - { - if ( aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR ) ) - { - aLeftBtn.Enable(); - break; - } - } -} - - -String SvxHyphenWordDialog_Impl::EraseUnusableHyphens_Impl( - uno::Reference< linguistic2::XPossibleHyphens > &rxPossHyph, - sal_uInt16 _nMaxHyphenationPos ) -{ - // returns a String showing only those hyphen positions which will result - // in a line break if hyphenation is done there - // 1) we will need to discard all hyphenation positions at th end that - // will not result in a line break where the text to the left still fits - // on the line. - // 2) since as from OOo 3.2 '-' are part of a word an thus text like - // 'multi-line-editor' is regarded as single word we also need to discard those - // hyphenation positions to the left of the rightmost '-' that is still left of - // the rightmost valid hyphenation position according to 1) - // - // Example: - // If the possible hyphenation position in 'multi-line-editor' are to eb marked - // by '=' then the text will look like this 'mul=ti-line-ed=it=or'. - // If now the first line is only large enough for 'multi-line-edi' we need to discard - // the last possible hyphnation point because of 1). The the right most valid - // hyphenation position is "ed=itor". The first '-' left of this position is - // "line-ed", thus because of 2) we now need to discard all possible hyphneation - // positions to the left of that as well. Thus in the end leaving us with just - // 'multi-line-ed=itor' as return value for this function. (Just one valid hyphenation - // position for the user too choose from. However ALL the '-' characters in the word - // will ALWAYS be valid implicit hyphenation positions for the core to choose from! - // And thus even if this word is skipped in the hyphenation dialog it will still be broken - // right after 'multi-line-' (actually it might already be broken up that way before - // the hyphenation dialog is called!). - // Thus rule 2) just eliminates those positions which will not be used by the core at all - // even if the user were to select one of them. - - String aTxt; - DBG_ASSERT(rxPossHyph.is(), "missing possible hyphens"); - if (rxPossHyph.is()) - { - DBG_ASSERT( aActWord == String( rxPossHyph->getWord() ), "word mismatch" ); - - aTxt = String( rxPossHyph->getPossibleHyphens() ); - - nHyphenationPositionsOffset = 0; - uno::Sequence< sal_Int16 > aHyphenationPositions( - rxPossHyph->getHyphenationPositions() ); - sal_Int32 nLen = aHyphenationPositions.getLength(); - const sal_Int16 *pHyphenationPos = aHyphenationPositions.getConstArray(); - - // find position nIdx after which all hyphen positions are unusable - xub_StrLen nIdx = STRING_NOTFOUND; - xub_StrLen nPos = 0, nPos1 = 0, nPos2 = 0; - if (nLen) - { - xub_StrLen nStart = 0; - for (sal_Int32 i = 0; i < nLen; ++i) - { - if (pHyphenationPos[i] > _nMaxHyphenationPos) - break; - else - { - // find corresponding hyphen pos in string - nPos = aTxt.Search( sal_Unicode( HYPH_POS_CHAR ), nStart ); - - if (nStart == STRING_NOTFOUND) - break; - else - { - nIdx = nPos; - nStart = nPos + 1; - } - } - } - } - DBG_ASSERT(nIdx != STRING_NOTFOUND, "no usable hyphenation position"); - - // 1) remove all not usable hyphenation positions from the end of the string - nPos = nIdx == STRING_NOTFOUND ? 0 : nIdx + 1; - nPos1 = nPos; //save for later use in 2) below - const String aTmp( sal_Unicode( HYPH_POS_CHAR ) ); - const String aEmpty; - while (nPos != STRING_NOTFOUND) - nPos = aTxt.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); - - // 2) remove all hyphenation positions from the start that are not considered by the core - const String aSearchRange( aTxt.Copy( 0, nPos1 ) ); - nPos2 = aSearchRange.SearchBackward( '-' ); // the '-' position the core will use by default - if (nPos2 != STRING_NOTFOUND) - { - String aLeft( aSearchRange.Copy( 0, nPos2 ) ); - nPos = 0; - while (nPos != STRING_NOTFOUND) - { - nPos = aLeft.SearchAndReplace( aTmp, aEmpty, nPos + 1 ); - if (nPos != STRING_NOTFOUND) - ++nHyphenationPositionsOffset; - } - aTxt.Replace( 0, nPos2, aLeft ); - } - } - return aTxt; -} - - -void SvxHyphenWordDialog_Impl::InitControls_Impl() -{ - xPossHyph = NULL; - if (xHyphenator.is()) - { - lang::Locale aLocale( SvxCreateLocale(nActLanguage) ); - xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale, - uno::Sequence< beans::PropertyValue >() ); - if (xPossHyph.is()) - aEditWord = EraseUnusableHyphens_Impl( xPossHyph, nMaxHyphenationPos ); - } - aWordEdit.SetText( aEditWord ); - - nOldPos = aEditWord.Len(); - SelLeft_Impl(); - EnableLRBtn_Impl(); -} - - -void SvxHyphenWordDialog_Impl::ContinueHyph_Impl( sal_uInt16 nInsPos ) -{ - if ( nInsPos != CONTINUE_HYPH && xPossHyph.is()) - { - if (nInsPos) - { - String aTmp( aEditWord ); - DBG_ASSERT(nInsPos <= aTmp.Len() - 2, "wrong hyphen position"); - - sal_Int16 nIdxPos = -1; - for (sal_uInt16 i = 0; i <= nInsPos; ++i) - { - if (HYPH_POS_CHAR == aTmp.GetChar( i )) - nIdxPos++; - } - // take the possible hyphenation positions that got removed from the - // start of the wor dinot account: - nIdxPos += nHyphenationPositionsOffset; - - uno::Sequence< sal_Int16 > aSeq = xPossHyph->getHyphenationPositions(); - sal_Int32 nLen = aSeq.getLength(); - DBG_ASSERT(nLen, "empty sequence"); - DBG_ASSERT(0 <= nIdxPos && nIdxPos < nLen, "index out of range"); - if (nLen && 0 <= nIdxPos && nIdxPos < nLen) - { - nInsPos = aSeq.getConstArray()[ nIdxPos ]; - pHyphWrapper->InsertHyphen( nInsPos ); - } - } - else - { - //! calling with 0 as argument will remove hyphens! - pHyphWrapper->InsertHyphen( nInsPos ); - } - } - - if ( pHyphWrapper->FindSpellError() ) - { - uno::Reference< linguistic2::XHyphenatedWord > xHyphWord( pHyphWrapper->GetLast(), uno::UNO_QUERY ); - - // adapt actual word and language to new found hyphenation result - if(xHyphWord.is()) - { - aActWord = String( xHyphWord->getWord() ); - nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() ); - nMaxHyphenationPos = xHyphWord->getHyphenationPos(); - InitControls_Impl(); - m_pDialog->SetWindowTitle( nActLanguage ); - } - } - else - m_pDialog->EndDialog( RET_OK ); -} - - -sal_uInt16 SvxHyphenWordDialog_Impl::GetHyphIndex_Impl() -{ - sal_uInt16 nPos = 0; - String aTxt( aWordEdit.GetText() ); - - for ( sal_uInt16 i=0 ; i < aTxt.Len(); ++i ) - { - sal_Unicode cChar = aTxt.GetChar( i ); - if ( cChar == CUR_HYPH_POS_CHAR ) - break; - if ( cChar != HYPH_POS_CHAR ) - nPos++; - } - return nPos; -} - - -void SvxHyphenWordDialog_Impl::SelLeft_Impl() -{ - DBG_ASSERT( nOldPos > 0, "invalid hyphenation position" ); - if (nOldPos > 0) - { - String aTxt( aEditWord ); - for ( xub_StrLen i = nOldPos - 1; i > 0; --i) - { - DBG_ASSERT(i <= aTxt.Len(), "index out of range"); - if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) - { - aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); - - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); - } -} - - -void SvxHyphenWordDialog_Impl::SelRight_Impl() -{ - String aTxt( aEditWord ); - for ( xub_StrLen i = nOldPos + 1; i < aTxt.Len(); ++i ) - { - if (aTxt.GetChar( i ) == sal_Unicode( HYPH_POS_CHAR )) - { - aTxt.SetChar( i, sal_Unicode( CUR_HYPH_POS_CHAR ) ); - - nOldPos = i; - aWordEdit.SetText( aTxt ); - aWordEdit.GrabFocus(); - aWordEdit.SetSelection( Selection( i, i + 1 ) ); - break; - } - } - nHyphPos = GetHyphIndex_Impl(); - EnableLRBtn_Impl(); -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, CutHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl( /*nHyphPos*/nOldPos ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, HyphenateAllHdl_Impl, Button *, EMPTYARG /*pButton*/ ) -{ - if( !bBusy ) - { - try - { - uno::Reference< beans::XPropertySet > xProp( SvxGetLinguPropertySet() ); - const rtl::OUString aName( RTL_CONSTASCII_USTRINGPARAM( "IsHyphAuto" ) ); - uno::Any aAny; - - aAny <<= sal_True; - xProp->setPropertyValue( aName, aAny ); - - bBusy = sal_True; - ContinueHyph_Impl( /*nHyphPos*/nOldPos ); - bBusy = sal_False; - - aAny <<= sal_False; - xProp->setPropertyValue( aName, aAny ); - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "Hyphenate All failed" ); - } - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, DeleteHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, ContinueHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - ContinueHyph_Impl( CONTINUE_HYPH ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, CancelHdl_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - pHyphWrapper->SpellEnd(); - m_pDialog->EndDialog( RET_CANCEL ); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, Left_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - SelLeft_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, Right_Impl, Button *, EMPTYARG ) -{ - if( !bBusy ) - { - bBusy = sal_True; - SelRight_Impl(); - bBusy = sal_False; - } - return 0; -} - - -IMPL_LINK( SvxHyphenWordDialog_Impl, GetFocusHdl_Impl, Edit *, EMPTYARG ) -{ - aWordEdit.SetSelection( Selection( nOldPos, nOldPos + 1 ) ); - return 0; -} - - -// class SvxHyphenWordDialog --------------------------------------------- - -SvxHyphenWordDialog::SvxHyphenWordDialog( - const String &rWord, LanguageType nLang, - Window* pParent, - uno::Reference< linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_HYPHENATE ) ) -{ - m_pImpl = std::auto_ptr< SvxHyphenWordDialog_Impl >( - new SvxHyphenWordDialog_Impl( this, rWord, nLang, xHyphen, pWrapper ) ); - - FreeResource(); - - SetWindowTitle( nLang ); - - // disable controls if service is not available - if (!m_pImpl->xHyphenator.is()) - Enable( sal_False ); -} - - -SvxHyphenWordDialog::~SvxHyphenWordDialog() -{ -} - - -void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang ) -{ - String aLangStr( SvtLanguageTable::GetLanguageString( nLang ) ); - String aTmp( m_pImpl->aLabel ); - aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - aTmp.Append( aLangStr ); - aTmp.Append( sal_Unicode( ')' ) ); - SetText( aTmp ); -} - - -void SvxHyphenWordDialog::SelLeft() -{ - m_pImpl->SelRight_Impl(); -} - - -void SvxHyphenWordDialog::SelRight() -{ - m_pImpl->SelLeft_Impl(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/hyphen.hrc b/cui/source/dialogs/hyphen.hrc deleted file mode 100644 index ba195caeb..000000000 --- a/cui/source/dialogs/hyphen.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_HYPHEN_HRC -#define _SVX_HYPHEN_HRC - -// defines ------------------------------------------------------------------ - -#define ED_WORD 10 -#define BTN_LEFT 11 -#define BTN_RIGHT 12 -#define FT_WORD 13 -#define FL_BOTTOM 14 - -#define BTN_HYPH_CONTINUE 20 -#define BTN_HYPH_DELETE 21 -#define BTN_HYPH_CUT 22 -#define BTN_HYPH_CANCEL 23 -#define BTN_HYPH_HELP 24 -#define BTN_HYPH_ALL 25 - -#endif - diff --git a/cui/source/dialogs/hyphen.src b/cui/source/dialogs/hyphen.src deleted file mode 100644 index a34a3d862..000000000 --- a/cui/source/dialogs/hyphen.src +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "cuires.hrc" -#include "hyphen.hrc" - -String RID_SVXSTR_HMERR_CHECKINSTALL -{ - Text [ en-US ] = "is not available for spellchecking\nPlease check your installation and install the desired language\n" ; -}; - - // RID_SVXDLG_HYPHENATE -------------------------------------------------- -ModalDialog RID_SVXDLG_HYPHENATE -{ - HelpId = HID_HYPHENATE ; - Size = MAP_APPFONT ( 200 , 111 ) ; - OutputSize = TRUE ; - SvLook = TRUE ; - Text [ en-US ] = "Hyphenation" ; - Moveable = TRUE ; - - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 5 , 5 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~Word" ; - }; - Edit ED_WORD - { - HelpID = "cui:Edit:RID_SVXDLG_HYPHENATE:ED_WORD"; - BORDER = TRUE ; - Pos = MAP_APPFONT ( 5 , 17 ) ; - Size = MAP_APPFONT ( 132 , 12 ) ; - TABSTOP = TRUE ; - LEFT = TRUE ; - }; - ImageButton BTN_LEFT - { - HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_LEFT"; - Pos = MAP_APPFONT ( 56 , 33 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - SYMBOL = IMAGEBUTTON_ARROW_LEFT ; - }; - ImageButton BTN_RIGHT - { - HelpID = "cui:ImageButton:RID_SVXDLG_HYPHENATE:BTN_RIGHT"; - Pos = MAP_APPFONT ( 75 , 33 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - Symbol = IMAGEBUTTON_ARROW_RIGHT ; - }; - OKButton BTN_HYPH_CUT - { - Pos = MAP_APPFONT ( 144 , 17 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "H~yphenate" ; - TABSTOP = TRUE ; - DEFBUTTON = TRUE ; - }; - PushButton BTN_HYPH_CONTINUE - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_CONTINUE"; - Pos = MAP_APPFONT ( 144 , 35 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Skip" ; - TABSTOP = TRUE ; - }; - PushButton BTN_HYPH_DELETE - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_DELETE"; - Pos = MAP_APPFONT ( 144 , 52 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Remove" ; - TABSTOP = TRUE ; - }; - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 0 , 81 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - }; - HelpButton BTN_HYPH_HELP - { - Pos = MAP_APPFONT ( 5 , 93 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TABSTOP = TRUE ; - }; - PushButton BTN_HYPH_ALL - { - HelpID = "cui:PushButton:RID_SVXDLG_HYPHENATE:BTN_HYPH_ALL"; - Pos = MAP_APPFONT ( 63 , 93 ) ; - Size = MAP_APPFONT ( 74 , 14 ) ; - Text [ en-US ] = "Hyphenate ~All" ; - TABSTOP = TRUE ; - }; - CancelButton BTN_HYPH_CANCEL - { - Pos = MAP_APPFONT ( 144 , 93 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Close"; - TABSTOP = TRUE ; - }; -}; diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx deleted file mode 100644 index f5846d340..000000000 --- a/cui/source/dialogs/iconcdlg.cxx +++ /dev/null @@ -1,1266 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#define _SVSTDARR_USHORTS -#include -#include - -#include "iconcdlg.hxx" - -#include "helpid.hrc" -#include -#include -#include -#include -#include - -using ::std::vector; - -int SAL_CALL IconcDlgCmpUS_Impl( const void* p1, const void* p2 ) -{ - return *(sal_uInt16*)p1 - *(sal_uInt16*)p2; -} - -// some stuff for easier changes for SvtViewOptions -static const sal_Char* pViewOptDataName = "dialog data"; -#define VIEWOPT_DATANAME ::rtl::OUString::createFromAscii( pViewOptDataName ) - -static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData ) -{ - rOpt.SetUserItem( VIEWOPT_DATANAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( rData ) ) ); -} - -static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) -{ - ::com::sun::star::uno::Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) ); - ::rtl::OUString aUserData; - aAny >>= aUserData; - - return String( aUserData ); -} - - -//##################################################################### -// -// Class IconChoicePage -// -//##################################################################### - -/********************************************************************** -| -| Ctor / Dtor -| -\**********************************************************************/ - -IconChoicePage::IconChoicePage( Window *pParent, const ResId &rResId, - const SfxItemSet &rAttrSet ) -: TabPage ( pParent, rResId ), - pSet ( &rAttrSet ), - bHasExchangeSupport ( sal_False ), - pDialog ( NULL ), - bStandard ( sal_False ) -{ - SetStyle ( GetStyle() | WB_DIALOGCONTROL | WB_HIDE ); -} - -// ----------------------------------------------------------------------- - -IconChoicePage::~IconChoicePage() -{ -} - -/********************************************************************** -| -| Activate / Deaktivate -| -\**********************************************************************/ - -void IconChoicePage::ActivatePage( const SfxItemSet& ) -{ -} - -// ----------------------------------------------------------------------- - -int IconChoicePage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} - -/********************************************************************** -| -| ... -| -\**********************************************************************/ - -void IconChoicePage::FillUserData() -{ -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoicePage::IsReadOnly() const -{ - return sal_False; -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoicePage::QueryClose() -{ - return sal_True; -} - -/********************************************************************** -| -| window-methods -| -\**********************************************************************/ - -void IconChoicePage::ImplInitSettings() -{ - Window* pParent = GetParent(); - if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() ) - { - EnableChildTransparentMode( sal_True ); - SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - SetPaintTransparent( sal_True ); - SetBackground(); - } - else - { - EnableChildTransparentMode( sal_False ); - SetParentClipMode( 0 ); - SetPaintTransparent( sal_False ); - - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( pParent->GetBackground() ); - } -} - -// ----------------------------------------------------------------------- - -void IconChoicePage::StateChanged( StateChangedType nType ) -{ - Window::StateChanged( nType ); - - if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - { - ImplInitSettings(); - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - ImplInitSettings(); - Invalidate(); - } -} - -//##################################################################### -// -// Class IconChoiceDialog -// -//##################################################################### - -/********************************************************************** -| -| Ctor / Dtor -| -\**********************************************************************/ - -IconChoiceDialog::IconChoiceDialog ( Window* pParent, const ResId &rResId, - const EIconChoicePos ePos, - const SfxItemSet *pItemSet ) -: ModalDialog ( pParent, rResId ), - meChoicePos ( ePos ), - maIconCtrl ( this, WB_3DLOOK | WB_ICON | WB_BORDER | - WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | - WB_NODRAGSELECTION | WB_TABSTOP ), - mnCurrentPageId ( USHRT_MAX ), - - aOKBtn ( this, WB_DEFBUTTON ), - aCancelBtn ( this, WB_DEFBUTTON ), - aHelpBtn ( this ), - aResetBtn ( this ), - pSet ( pItemSet ), - pOutSet ( NULL ), - pExampleSet ( NULL ), - pRanges ( NULL ), - nResId ( rResId.GetId() ), - - bHideResetBtn ( sal_False ), - bModal ( sal_False ), - bInOK ( sal_False ), - bModified ( sal_False ), - bItemsReset ( sal_False ) -{ - - maIconCtrl.SetStyle (WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN ); - SetCtrlPos ( meChoicePos ); - maIconCtrl.SetClickHdl ( LINK ( this, IconChoiceDialog , ChosePageHdl_Impl ) ); - maIconCtrl.Show(); - maIconCtrl.SetChoiceWithCursor ( sal_True ); - maIconCtrl.SetSelectionMode( SINGLE_SELECTION ); - maIconCtrl.SetHelpId( HID_ICCDIALOG_CHOICECTRL ); - - // ItemSet - if ( pSet ) - { - pExampleSet = new SfxItemSet( *pSet ); - pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - } - - // Buttons - aOKBtn.SetClickHdl ( LINK( this, IconChoiceDialog, OkHdl ) ); - aOKBtn.SetHelpId( HID_ICCDIALOG_OK_BTN ); - aCancelBtn.SetHelpId( HID_ICCDIALOG_CANCEL_BTN ); - aResetBtn.SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) ); - aResetBtn.SetText( CUI_RESSTR(RID_SVXSTR_ICONCHOICEDLG_RESETBUT) ); - aResetBtn.SetHelpId( HID_ICCDIALOG_RESET_BTN ); - aOKBtn.Show(); - aCancelBtn.Show(); - aHelpBtn.Show(); - aResetBtn.Show(); - - SetPosSizeCtrls ( sal_True ); -} - -// ----------------------------------------------------------------------- - -IconChoiceDialog ::~IconChoiceDialog () -{ - // save configuration at INI-Manager - // and remove pages - SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); - aTabDlgOpt.SetWindowState(::rtl::OStringToOUString(GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)), RTL_TEXTENCODING_ASCII_US)); - aTabDlgOpt.SetPageID( mnCurrentPageId ); - - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[ i ]; - - if ( pData->pPage ) - { - pData->pPage->FillUserData(); - String aPageData(pData->pPage->GetUserData()); - if ( aPageData.Len() ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - - SetViewOptUserItem( aTabPageOpt, aPageData ); - } - - if ( pData->bOnDemand ) - delete (SfxItemSet*)&pData->pPage->GetItemSet(); - delete pData->pPage; - } - delete pData; - } - - // remove Userdata from Icons - for ( sal_uLong i=0; i < maIconCtrl.GetEntryCount(); i++) - { - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.GetEntry ( i ); - sal_uInt16* pUserData = (sal_uInt16*) pEntry->GetUserData(); - delete pUserData; - } - - // - if ( pRanges ) - delete pRanges; - if ( pOutSet ) - delete pOutSet; -} - -/********************************************************************** -| -| add new page -| -\**********************************************************************/ - -SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( - sal_uInt16 nId, - const String& rIconText, - const Image& rChoiceIcon, - CreatePage pCreateFunc /* != 0 */, - GetPageRanges pRangesFunc /* darf 0 sein */, - sal_Bool bItemsOnDemand, - sal_uLong /*nPos*/ -) -{ - IconChoicePageData* pData = new IconChoicePageData ( nId, pCreateFunc, - pRangesFunc, - bItemsOnDemand ); - maPageList.push_back( pData ); - - pData->fnGetRanges = pRangesFunc; - pData->bOnDemand = bItemsOnDemand; - - sal_uInt16 *pId = new sal_uInt16 ( nId ); - SvxIconChoiceCtrlEntry* pEntry = maIconCtrl.InsertEntry( rIconText, rChoiceIcon ); - pEntry->SetUserData ( (void*) pId ); - return pEntry; -} - -/********************************************************************** -| -| remove page -| -\**********************************************************************/ - -void IconChoiceDialog::RemoveTabPage( sal_uInt16 nId ) -{ - IconChoicePageData* pData = GetPageData ( nId ); - - // remove page from list - if ( pData ) - { - for ( vector< IconChoicePageData* >::iterator i = maPageList.begin(); i < maPageList.end(); ++i ) - { - if ( *i == pData ) - { - maPageList.erase( i ); - break; - } - } - - // save settings - if ( pData->pPage ) - { - pData->pPage->FillUserData(); - String aPageData(pData->pPage->GetUserData()); - if ( aPageData.Len() ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - - SetViewOptUserItem( aTabPageOpt, aPageData ); - } - } - - if ( pData->bOnDemand ) - delete ( SfxItemSet * )&( pData->pPage->GetItemSet() ); - - delete pData->pPage; - delete pData; - } - - // remove Icon - bool bFound = false; - for ( sal_uLong i=0; iGetUserData(); - - if ( *pUserData == nId ) - { - delete pUserData; - maIconCtrl.RemoveEntry ( pEntry ); - bFound = true; - } - } - - // was it the current page ? - if ( nId == mnCurrentPageId ) - { - mnCurrentPageId = maPageList.front()->nId; - } - - Invalidate (); -} - -/********************************************************************** -| -| Paint-method -| -\**********************************************************************/ - -void IconChoiceDialog::Paint( const Rectangle& rRect ) -{ - Dialog::Paint ( rRect ); - - for ( size_t i = 0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - - if ( pData->nId == mnCurrentPageId ) - { - ShowPageImpl ( pData ); - } - else - { - HidePageImpl ( pData ); - } - } -} - -EIconChoicePos IconChoiceDialog::SetCtrlPos( const EIconChoicePos& rPos ) -{ - WinBits aWinBits = maIconCtrl.GetStyle (); - - switch ( meChoicePos ) - { - case PosLeft : - aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL; - aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL; - break; - case PosRight : - aWinBits &= ~WB_ALIGN_TOP & ~WB_NOVSCROLL; - aWinBits |= WB_ALIGN_LEFT | WB_NOHSCROLL; - break; - case PosTop : - aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL; - aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL; - break; - case PosBottom : - aWinBits &= ~WB_ALIGN_LEFT & ~WB_NOHSCROLL; - aWinBits |= WB_ALIGN_TOP | WB_NOVSCROLL; - break; - }; - maIconCtrl.SetStyle ( aWinBits ); - - SetPosSizeCtrls(); - - - EIconChoicePos eOldPos = meChoicePos; - meChoicePos = rPos; - - return eOldPos; -} - -/********************************************************************** -| -| Show / Hide page or button -| -\**********************************************************************/ - -void IconChoiceDialog::ShowPageImpl ( IconChoicePageData* pData ) -{ - if ( pData->pPage ) - pData->pPage->Show(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::HidePageImpl ( IconChoicePageData* pData ) -{ - if ( pData->pPage ) - pData->pPage->Hide(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::RemoveResetButton() -{ - aResetBtn.Hide(); - bHideResetBtn = true; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::ShowPage( sal_uInt16 nId ) -{ - bool bInvalidate = GetCurPageId() != nId; - SetCurPageId( nId ); - ActivatePageImpl( ); - if(bInvalidate) - Invalidate(); -} - -/********************************************************************** -| -| Resize Dialog -| -\**********************************************************************/ - -#define ICONCTRL_WIDTH_PIXEL 110 -#define ICONCTRL_HEIGHT_PIXEL 75 -#define MINSIZE_BUTTON_WIDTH 70 -#define MINSIZE_BUTTON_HEIGHT 22 - -void IconChoiceDialog::Resize() -{ - Dialog::Resize (); - - if ( IsReallyVisible() ) - { - SetPosSizeCtrls (); - } -} - -void IconChoiceDialog::SetPosSizeCtrls ( sal_Bool bInit ) -{ - const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); - Size aOutSize ( GetOutputSizePixel() ); - - //////////////////////////////////////// - // Button-Defaults - // - Size aDefaultButtonSize = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); - - // Reset-Button - Size aResetButtonSize ( bInit ? aDefaultButtonSize : - aResetBtn.GetSizePixel () ); - - //////////////////////////////////////// - // IconChoiceCtrl resizen & positionieren - // - SvtTabAppearanceCfg aCfg; - const long nDefaultWidth = (aCfg.GetScaleFactor() * ICONCTRL_WIDTH_PIXEL) / 100; - const long nDefaultHeight = (aCfg.GetScaleFactor() * ICONCTRL_HEIGHT_PIXEL) / 100; - - Size aNewIconCtrlSize ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - Point aIconCtrlPos; - switch ( meChoicePos ) - { - case PosLeft : - aIconCtrlPos = aCtrlOffset; - aNewIconCtrlSize = Size ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - break; - case PosRight : - aIconCtrlPos = Point ( aOutSize.Width() - nDefaultWidth - - aCtrlOffset.X(), aCtrlOffset.X() ); - aNewIconCtrlSize = Size ( nDefaultWidth, - aOutSize.Height()-(2*aCtrlOffset.X()) ); - break; - case PosTop : - aIconCtrlPos = aCtrlOffset; - aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()), - nDefaultHeight ); - break; - case PosBottom : - aIconCtrlPos = Point ( aCtrlOffset.X(), aOutSize.Height() - - aResetButtonSize.Height() - (2*aCtrlOffset.X()) - - nDefaultHeight ); - aNewIconCtrlSize = Size ( aOutSize.Width()-(2*aCtrlOffset.X()), - nDefaultHeight ); - break; - }; - maIconCtrl.SetPosSizePixel ( aIconCtrlPos, aNewIconCtrlSize ); - maIconCtrl.ArrangeIcons(); - - //////////////////////////////////////// - // Pages resizen & positionieren - // - for ( size_t i = 0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - - Point aNewPagePos; - Size aNewPageSize; - switch ( meChoicePos ) - { - case PosLeft : - aNewPagePos = Point ( aNewIconCtrlSize.Width() + (2*CTRLS_OFFSET), - CTRLS_OFFSET ); - aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() - - (3*CTRLS_OFFSET), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*CTRLS_OFFSET) ); - break; - case PosRight : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - aNewIconCtrlSize.Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosTop : - aNewPagePos = Point ( aCtrlOffset.X(), aNewIconCtrlSize.Height() + - (2*aCtrlOffset.X()) ); - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) ); - break; - case PosBottom : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - aNewIconCtrlSize.Height() - (4*aCtrlOffset.X()) ); - break; - }; - - if ( pData->pPage ) - pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize ); - } - - //////////////////////////////////////// - // Buttons positionieren - // - sal_uLong nXOffset=0; - if ( meChoicePos == PosRight ) - nXOffset = aNewIconCtrlSize.Width()+(2*aCtrlOffset.X()); - - aResetBtn.SetPosSizePixel ( Point( aOutSize.Width() - nXOffset - - aResetButtonSize.Width()-aCtrlOffset.X(), - aOutSize.Height()-aResetButtonSize.Height()- - aCtrlOffset.X() ), - aResetButtonSize ); - // Help-Button - Size aHelpButtonSize ( bInit ? aDefaultButtonSize : - aHelpBtn.GetSizePixel () ); - aHelpBtn.SetPosSizePixel ( Point( aOutSize.Width()-aResetButtonSize.Width()- - aHelpButtonSize.Width()- nXOffset - - (2*aCtrlOffset.X()), - aOutSize.Height()-aHelpButtonSize.Height()- - aCtrlOffset.X() ), - aHelpButtonSize ); - // Cancel-Button - Size aCancelButtonSize ( bInit ? aDefaultButtonSize : - aCancelBtn.GetSizePixel () ); - aCancelBtn.SetPosSizePixel ( Point( aOutSize.Width()-aCancelButtonSize.Width()- - aResetButtonSize.Width()-aHelpButtonSize.Width()- - (3*aCtrlOffset.X()) - nXOffset, - aOutSize.Height()-aCancelButtonSize.Height()- - aCtrlOffset.X() ), - aCancelButtonSize ); - // OK-Button - Size aOKButtonSize ( bInit ? aDefaultButtonSize : aOKBtn.GetSizePixel () ); - aOKBtn.SetPosSizePixel ( Point( aOutSize.Width()-aOKButtonSize.Width()- - aCancelButtonSize.Width()-aResetButtonSize.Width()- - aHelpButtonSize.Width()-(4*aCtrlOffset.X())- nXOffset, - aOutSize.Height()-aOKButtonSize.Height()-aCtrlOffset.X() ), - aOKButtonSize ); - - Invalidate(); -} - -void IconChoiceDialog::SetPosSizePages ( sal_uInt16 nId ) -{ - const Point aCtrlOffset ( LogicToPixel( Point( CTRLS_OFFSET, CTRLS_OFFSET ), MAP_APPFONT ) ); - IconChoicePageData* pData = GetPageData ( nId ); - - if ( pData->pPage ) - { - Size aOutSize ( GetOutputSizePixel() ); - Size aIconCtrlSize ( maIconCtrl.GetSizePixel() ); - - Point aNewPagePos; - Size aNewPageSize; - switch ( meChoicePos ) - { - case PosLeft : - aNewPagePos = Point ( aIconCtrlSize.Width() + (2*aCtrlOffset.X()), - aCtrlOffset.X() ); - aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosRight : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - maIconCtrl.GetSizePixel().Width() - - (3*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - (3*aCtrlOffset.X()) ); - break; - case PosTop : - aNewPagePos = Point ( aCtrlOffset.X(), aIconCtrlSize.Height() + - (2*aCtrlOffset.X()) ); - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) ); - break; - case PosBottom : - aNewPagePos = aCtrlOffset; - aNewPageSize = Size ( aOutSize.Width() - (2*aCtrlOffset.X()), - aOutSize.Height() - aOKBtn.GetSizePixel().Height() - - maIconCtrl.GetSizePixel().Height() - (4*aCtrlOffset.X()) ); - break; - }; - - pData->pPage->SetPosSizePixel ( aNewPagePos, aNewPageSize ); - } -} - -/********************************************************************** -| -| select a page -| -\**********************************************************************/ - -IMPL_LINK ( IconChoiceDialog , ChosePageHdl_Impl, void *, EMPTYARG ) -{ - sal_uLong nPos; - - SvxIconChoiceCtrlEntry *pEntry = maIconCtrl.GetSelectedEntry ( nPos ); - if ( !pEntry ) - pEntry = maIconCtrl.GetCursor( ); - - sal_uInt16 *pId = (sal_uInt16*)pEntry->GetUserData (); - - if( *pId != mnCurrentPageId ) - { - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - if ( pData->pPage ) - DeActivatePageImpl(); - - SetCurPageId ( *pId ); - - ActivatePageImpl(); - Invalidate(); - } - - return 0L; -} - -/********************************************************************** -| -| Button-handler -| -\**********************************************************************/ - -IMPL_LINK( IconChoiceDialog, OkHdl, Button *, EMPTYARG ) -{ - bInOK = sal_True; - - if ( OK_Impl() ) - { - if ( bModal ) - EndDialog( Ok() ); - else - { - Ok(); - Close(); - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( IconChoiceDialog, ResetHdl, Button *, EMPTYARG ) -{ - ResetPageImpl (); - - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - DBG_ASSERT( pData, "Id nicht bekannt" ); - - if ( pData->bOnDemand ) - { - // CSet auf AIS hat hier Probleme, daher getrennt - const SfxItemSet* _pSet = &( pData->pPage->GetItemSet() ); - pData->pPage->Reset( *(SfxItemSet*)_pSet ); - } - else - pData->pPage->Reset( *pSet ); - - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( IconChoiceDialog, CancelHdl, Button*, EMPTYARG ) -{ - Close(); - - return 0; -} - -/********************************************************************** -| -| call page -| -\**********************************************************************/ - -void IconChoiceDialog::ActivatePageImpl () -{ - DBG_ASSERT( !maPageList.empty(), "keine Pages angemeldet" ); - IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); - DBG_ASSERT( pData, "Id nicht bekannt" ); - bool bReadOnly = false; - if ( pData ) - { - if ( !pData->pPage ) - { - const SfxItemSet* pTmpSet = 0; - - if ( pSet ) - { - if ( bItemsReset && pSet->GetParent() ) - pTmpSet = pSet->GetParent(); - else - pTmpSet = pSet; - } - - if ( pTmpSet && !pData->bOnDemand ) - pData->pPage = (pData->fnCreatePage)( this, *pTmpSet ); - else - pData->pPage = (pData->fnCreatePage)( this, *CreateInputItemSet( mnCurrentPageId ) ); - - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pData->nId ) ); - pData->pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) ); - SetPosSizePages ( pData->nId ); - - if ( pData->bOnDemand ) - pData->pPage->Reset( (SfxItemSet &)pData->pPage->GetItemSet() ); - else - pData->pPage->Reset( *pSet ); - - PageCreated( mnCurrentPageId, *pData->pPage ); - } - else if ( pData->bRefresh ) - { - pData->pPage->Reset( *pSet ); - } - - pData->bRefresh = sal_False; - - if ( pExampleSet ) - pData->pPage->ActivatePage( *pExampleSet ); - SetHelpId( pData->pPage->GetHelpId() ); - bReadOnly = pData->pPage->IsReadOnly(); - } - - - if ( bReadOnly || bHideResetBtn ) - aResetBtn.Hide(); - else - aResetBtn.Show(); - -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoiceDialog::DeActivatePageImpl () -{ - IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); - - int nRet = IconChoicePage::LEAVE_PAGE; - - if ( pData ) - { - IconChoicePage * pPage = pData->pPage; - - if ( !pExampleSet && pPage->HasExchangeSupport() && pSet ) - pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pSet ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pPage->HasExchangeSupport() ) - nRet = pPage->DeactivatePage( &aTmp ); - - if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE && - aTmp.Count() ) - { - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - } - else - { - if ( pPage->HasExchangeSupport() ) //!!! - { - if ( !pExampleSet ) - { - SfxItemPool* pPool = pPage->GetItemSet().GetPool(); - pExampleSet = - new SfxItemSet( *pPool, GetInputRanges( *pPool ) ); - } - nRet = pPage->DeactivatePage( pExampleSet ); - } - else - nRet = pPage->DeactivatePage( NULL ); - } - - if ( nRet & IconChoicePage::REFRESH_SET ) - { - pSet = GetRefreshedSet(); - DBG_ASSERT( pSet, "GetRefreshedSet() liefert NULL" ); - // alle Pages als neu zu initialsieren flaggen - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pObj = maPageList[ i ]; - if ( pObj->pPage != pPage ) // eigene Page nicht mehr refreshen - pObj->bRefresh = sal_True; - else - pObj->bRefresh = sal_False; - } - } - } - - if ( nRet & IconChoicePage::LEAVE_PAGE ) - return sal_True; - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::ResetPageImpl () -{ - IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); - - DBG_ASSERT( pData, "Id nicht bekannt" ); - - if ( pData->bOnDemand ) - { - // CSet auf AIS hat hier Probleme, daher getrennt - const SfxItemSet* _pSet = &pData->pPage->GetItemSet(); - pData->pPage->Reset( *(SfxItemSet*)_pSet ); - } - else - pData->pPage->Reset( *pSet ); -} - -/********************************************************************** -| -| handling itemsets -| -\**********************************************************************/ - -const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& rPool ) -{ - if ( pSet ) - { - DBG_ERRORFILE( "Set bereits vorhanden!" ); - return pSet->GetRanges(); - } - - if ( pRanges ) - return pRanges; - SvUShorts aUS( 16, 16 ); - - size_t nCount = maPageList.size(); - for ( size_t i = 0; i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[ i ]; - if ( pData->fnGetRanges ) - { - const sal_uInt16* pTmpRanges = (pData->fnGetRanges)(); - const sal_uInt16* pIter = pTmpRanges; - - sal_uInt16 nLen; - for( nLen = 0; *pIter; ++nLen, ++pIter ) - ; - aUS.Insert( pTmpRanges, nLen, aUS.Count() ); - } - } - - // remove double Id's -#ifndef TF_POOLABLE - if ( rPool.HasMap() ) -#endif - { - nCount = aUS.Count(); - for ( size_t i = 0; i < nCount; ++i ) - aUS[i] = rPool.GetWhich( aUS[i] ); - } - - // sortieren - if ( aUS.Count() > 1 ) - { -#if defined __SUNPRO_CC -#pragma disable_warn -#endif - qsort( (void*)aUS.GetData(), aUS.Count(), sizeof(sal_uInt16), IconcDlgCmpUS_Impl ); -#if defined __SUNPRO_CC -#pragma enable_warn -#endif - } - - pRanges = new sal_uInt16[aUS.Count() + 1]; - memcpy(pRanges, aUS.GetData(), sizeof(sal_uInt16) * aUS.Count()); - pRanges[aUS.Count()] = 0; - - return pRanges; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet ) -{ - bool bSet = ( pSet != NULL ); - - pSet = pInSet; - - if ( !bSet && !pExampleSet && !pOutSet ) - { - pExampleSet = new SfxItemSet( *pSet ); - pOutSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ); - } -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& /*rPage*/ ) -{ - // not interested in -} - -// ----------------------------------------------------------------------- - -SfxItemSet* IconChoiceDialog::CreateInputItemSet( sal_uInt16 ) -{ - DBG_WARNINGFILE( "CreateInputItemSet nicht implementiert" ); - - return 0; -} - -/********************************************************************** -| -| start dialog -| -\**********************************************************************/ - -short IconChoiceDialog::Execute() -{ - if ( maPageList.empty() ) - return RET_CANCEL; - - Start_Impl(); - - return Dialog::Execute(); -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::Start( sal_Bool bShow ) -{ - - aCancelBtn.SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) ); - bModal = sal_False; - - Start_Impl(); - - if ( bShow ) - Window::Show(); - -} - -// ----------------------------------------------------------------------- - -sal_Bool IconChoiceDialog::QueryClose() -{ - sal_Bool bRet = sal_True; - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = maPageList[i ]; - if ( pData->pPage && !pData->pPage->QueryClose() ) - { - bRet = sal_False; - break; - } - } - return bRet; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::Start_Impl() -{ - Point aPos; - sal_uInt16 nActPage; - - if ( mnCurrentPageId == 0 || mnCurrentPageId == USHRT_MAX ) - nActPage = maPageList.front()->nId; - else - nActPage = mnCurrentPageId; - - // Konfiguration vorhanden? - SvtViewOptions aTabDlgOpt( E_TABDIALOG, String::CreateFromInt32( nResId ) ); - - if ( aTabDlgOpt.Exists() ) - { - // ggf. Position aus Konfig - SetWindowState(rtl::OUStringToOString(aTabDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US)); - - // initiale TabPage aus Programm/Hilfe/Konfig - nActPage = (sal_uInt16)aTabDlgOpt.GetPageID(); - - if ( USHRT_MAX != mnCurrentPageId ) - nActPage = mnCurrentPageId; - - if ( GetPageData ( nActPage ) == NULL ) - nActPage = maPageList.front()->nId; - } - else if ( USHRT_MAX != mnCurrentPageId && GetPageData ( mnCurrentPageId ) != NULL ) - nActPage = mnCurrentPageId; - - mnCurrentPageId = nActPage; - - FocusOnIcon( mnCurrentPageId ); - - ActivatePageImpl(); -} - -// ----------------------------------------------------------------------- - -const SfxItemSet* IconChoiceDialog::GetRefreshedSet() -{ - DBG_ERRORFILE( "GetRefreshedSet nicht implementiert" ); - return 0; -} - -/********************************************************************** -| -| tool-methods -| -\**********************************************************************/ - -IconChoicePageData* IconChoiceDialog::GetPageData ( sal_uInt16 nId ) -{ - IconChoicePageData *pRet = NULL; - for ( size_t i=0; i < maPageList.size(); i++ ) - { - IconChoicePageData* pData = maPageList[ i ]; - if ( pData->nId == nId ) - { - pRet = pData; - break; - } - } - return pRet; -} - -/********************************************************************** -| -| OK-Status -| -\**********************************************************************/ - -sal_Bool IconChoiceDialog::OK_Impl() -{ - IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage; - - bool bEnd = !pPage; - if ( pPage ) - { - int nRet = IconChoicePage::LEAVE_PAGE; - if ( pSet ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - sal_Bool bRet = sal_False; - - if ( pPage->HasExchangeSupport() ) - nRet = pPage->DeactivatePage( &aTmp ); - - if ( ( IconChoicePage::LEAVE_PAGE & nRet ) == IconChoicePage::LEAVE_PAGE - && aTmp.Count() ) - { - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - else if ( bRet ) - bModified |= sal_True; - } - else - nRet = pPage->DeactivatePage( NULL ); - bEnd = nRet; - } - - return bEnd; -} - -// ----------------------------------------------------------------------- - -short IconChoiceDialog::Ok() -{ - bInOK = sal_True; - - if ( !pOutSet ) - { - if ( !pExampleSet && pSet ) - pOutSet = pSet->Clone( sal_False ); // ohne Items - else if ( pExampleSet ) - pOutSet = new SfxItemSet( *pExampleSet ); - } - sal_Bool _bModified = sal_False; - - for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i ) - { - IconChoicePageData* pData = GetPageData ( i ); - - IconChoicePage* pPage = pData->pPage; - - if ( pPage ) - { - if ( pData->bOnDemand ) - { - SfxItemSet& rSet = (SfxItemSet&)pPage->GetItemSet(); - rSet.ClearItem(); - _bModified |= pPage->FillItemSet( rSet ); - } - else if ( pSet && !pPage->HasExchangeSupport() ) - { - SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() ); - - if ( pPage->FillItemSet( aTmp ) ) - { - _bModified |= sal_True; - pExampleSet->Put( aTmp ); - pOutSet->Put( aTmp ); - } - } - } - } - - if ( _bModified || ( pOutSet && pOutSet->Count() > 0 ) ) - _bModified |= sal_True; - - return _bModified ? RET_OK : RET_CANCEL; -} - -// ----------------------------------------------------------------------- - -void IconChoiceDialog::FocusOnIcon( sal_uInt16 nId ) -{ - // set focus to icon for the current visible page - for ( sal_uInt16 i=0; iGetUserData(); - - if ( pUserData && *pUserData == nId ) - { - maIconCtrl.SetCursor( pEntry ); - break; - } - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/iconcdlg.src b/cui/source/dialogs/iconcdlg.src deleted file mode 100644 index 6bcca8ba2..000000000 --- a/cui/source/dialogs/iconcdlg.src +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -String RID_SVXSTR_ICONCHOICEDLG_RESETBUT -{ - Text [ en-US ] = "~Back" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx deleted file mode 100644 index a9eb0dcd4..000000000 --- a/cui/source/dialogs/insdlg.cxx +++ /dev/null @@ -1,1050 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "insdlg.hxx" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "svuidlg.hrc" - -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::ui::dialogs; -using ::rtl::OUString; - -#define _SVSTDARR_STRINGSDTOR -#include - - -static String impl_getSvtResString( sal_uInt32 nId ) -{ - String aRet; - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); - if( pMgr ) - { - aRet = String( ResId( nId, *pMgr ) ); - delete pMgr; - } - return aRet; -} - -sal_Bool InsertObjectDialog_Impl::IsCreateNew() const -{ - return sal_False; -} - -uno::Reference< io::XInputStream > InsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* /*pGraphicMediaType*/ ) -{ - return uno::Reference< io::XInputStream >(); -} - -InsertObjectDialog_Impl::InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) - : ModalDialog( pParent, rResId ) - , m_xStorage( xStorage ) - , aCnt( m_xStorage ) -{ -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvInsertOleDlg, DoubleClickHdl, ListBox *, EMPTYARG ) -{ - EndDialog( RET_OK ); - return 0; -} -IMPL_LINK_INLINE_END( SvInsertOleDlg, DoubleClickHdl, ListBox *, pListBox ) - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvInsertOleDlg, BrowseHdl, PushButton *, EMPTYARG ) -{ - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add filter - try - { - xFilterMgr->appendFilter( - OUString(), - OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) - ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - INetURLObject aObj( aPathSeq[0] ); - aEdFilepath.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvInsertOleDlg, RadioHdl, RadioButton *, EMPTYARG ) -{ - if ( aRbNewObject.IsChecked() ) - { - aLbObjecttype.Show(); - aEdFilepath.Hide(); - aBtnFilepath.Hide(); - aCbFilelink.Hide(); - aGbObject.SetText( _aOldStr ); - } - else - { - aCbFilelink.Show(); - aLbObjecttype.Hide(); - aEdFilepath.Show(); - aBtnFilepath.Show(); - aCbFilelink.Show(); - aGbObject.SetText( aStrFile ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -void SvInsertOleDlg::SelectDefault() -{ - aLbObjecttype.SelectEntryPos( 0 ); -} - -// ----------------------------------------------------------------------- -SvInsertOleDlg::SvInsertOleDlg -( - Window* pParent, - const Reference < embed::XStorage >& xStorage, - const SvObjectServerList* pServers -) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OLEOBJECT ), xStorage ), - aRbNewObject( this, CUI_RES( RB_NEW_OBJECT ) ), - aRbObjectFromfile( this, CUI_RES( RB_OBJECT_FROMFILE ) ), - aGbObject( this, CUI_RES( GB_OBJECT ) ), - aLbObjecttype( this, CUI_RES( LB_OBJECTTYPE ) ), - aEdFilepath( this, CUI_RES( ED_FILEPATH ) ), - aBtnFilepath( this, CUI_RES( BTN_FILEPATH ) ), - aCbFilelink( this, CUI_RES( CB_FILELINK ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aStrFile( CUI_RES( STR_FILE ) ), - m_pServers( pServers ) -{ - FreeResource(); - _aOldStr = aGbObject.GetText(); - aLbObjecttype.SetDoubleClickHdl( LINK( this, SvInsertOleDlg, DoubleClickHdl ) ); - aBtnFilepath.SetClickHdl( LINK( this, SvInsertOleDlg, BrowseHdl ) ); - Link aLink( LINK( this, SvInsertOleDlg, RadioHdl ) ); - aRbNewObject.SetClickHdl( aLink ); - aRbObjectFromfile.SetClickHdl( aLink ); - aRbNewObject.Check( sal_True ); - RadioHdl( NULL ); - aBtnFilepath.SetAccessibleRelationMemberOf(&aGbObject); -} - -short SvInsertOleDlg::Execute() -{ - short nRet = RET_OK; - SvObjectServerList aObjS; - if ( !m_pServers ) - { - // if no list was provided, take the complete one - aObjS.FillInsertObjects(); - m_pServers = &aObjS; - } - - // fill listbox and select default - ListBox& rBox = GetObjectTypes(); - rBox.SetUpdateMode( sal_False ); - for ( sal_uLong i = 0; i < m_pServers->Count(); i++ ) - rBox.InsertEntry( (*m_pServers)[i].GetHumanName() ); - rBox.SetUpdateMode( sal_True ); - SelectDefault(); - ::rtl::OUString aName; - - DBG_ASSERT( m_xStorage.is(), "No storage!"); - if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK ) - { - String aFileName; - sal_Bool bLink = sal_False; - sal_Bool bCreateNew = IsCreateNew(); - if ( bCreateNew ) - { - // create and insert new embedded object - String aServerName = rBox.GetSelectEntry(); - const SvObjectServer* pS = m_pServers->Get( aServerName ); - if ( pS ) - { - if( pS->GetClassName() == SvGlobalName( SO3_OUT_CLASSID ) ) - { - try - { - uno::Reference < embed::XInsertObjectDialog > xDialogCreator( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ), - uno::UNO_QUERY ); - - if ( xDialogCreator.is() ) - { - aName = aCnt.CreateUniqueObjectName(); - embed::InsertedObjectInfo aNewInf = xDialogCreator->createInstanceByDialog( - m_xStorage, - aName, - uno::Sequence < beans::PropertyValue >() ); - - OSL_ENSURE( aNewInf.Object.is(), "The object must be created or an exception must be thrown!" ); - m_xObj = aNewInf.Object; - for ( sal_Int32 nInd = 0; nInd < aNewInf.Options.getLength(); nInd++ ) - if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Icon" ) ) ) ) - { - aNewInf.Options[nInd].Value >>= m_aIconMetaFile; - } - else if ( aNewInf.Options[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconFormat" ) ) ) ) - { - datatransfer::DataFlavor aFlavor; - if ( aNewInf.Options[nInd].Value >>= aFlavor ) - m_aIconMediaType = aFlavor.MimeType; - } - - } - } - catch( ucb::CommandAbortedException& ) - { - // the user has pressed cancel - } - catch( uno::Exception& ) - { - // TODO: Error handling - } - } - else - { - // create object with desired ClassId - m_xObj = aCnt.CreateEmbeddedObject( pS->GetClassName().GetByteSequence(), aName ); - } - - if ( !m_xObj.is() ) - { - if( aFileName.Len() ) // from OLE Dialog - { - // Objekt konnte nicht aus Datei erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) ); - aErr.SearchAndReplace( String( '%' ), aFileName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - else - { - // Objekt konnte nicht erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE ) ); - aErr.SearchAndReplace( String( '%' ), aServerName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - } - } - else - { - aFileName = GetFilePath(); - INetURLObject aURL; - aURL.SetSmartProtocol( INET_PROT_FILE ); - aURL.SetSmartURL( aFileName ); - aFileName = aURL.GetMainURL( INetURLObject::NO_DECODE ); - bLink = IsLinked(); - - if ( aFileName.Len() ) - { - // create MediaDescriptor for file to create object from - uno::Sequence < beans::PropertyValue > aMedium( 2 ); - aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); - aMedium[0].Value <<= ::rtl::OUString( aFileName ); - - uno::Reference< task::XInteractionHandler > xInteraction; - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - xInteraction = uno::Reference< task::XInteractionHandler >( - xFactory->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - uno::UNO_QUERY_THROW ); - - if ( xInteraction.is() ) - { - aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); - aMedium[1].Value <<= xInteraction; - } - else - { - OSL_FAIL( "Can not get InteractionHandler!\n" ); - aMedium.realloc( 1 ); - } - - // create object from media descriptor - if ( bLink ) - m_xObj = aCnt.InsertEmbeddedLink( aMedium, aName ); - else - m_xObj = aCnt.InsertEmbeddedObject( aMedium, aName ); - } - - if ( !m_xObj.is() ) - { - // Objekt konnte nicht aus Datei erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_FROM_FILE ) ); - aErr.SearchAndReplace( String( '%' ), aFileName ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - } - - m_pServers = 0; - return nRet; -} - -uno::Reference< io::XInputStream > SvInsertOleDlg::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ) -{ - if ( m_aIconMetaFile.getLength() ) - { - if ( pGraphicMediaType ) - *pGraphicMediaType = m_aIconMediaType; - - return uno::Reference< io::XInputStream >( new ::comphelper::SequenceInputStream( m_aIconMetaFile ) ); - } - - return uno::Reference< io::XInputStream >(); -} - -IMPL_LINK( SvInsertPlugInDialog, BrowseHdl, PushButton *, EMPTYARG ) -{ - Sequence< OUString > aFilterNames, aFilterTypes; - void fillNetscapePluginFilters( Sequence< OUString >& rNames, Sequence< OUString >& rTypes ); - fillNetscapePluginFilters( aFilterNames, aFilterTypes ); - - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add the filters - try - { - const OUString* pNames = aFilterNames.getConstArray(); - const OUString* pTypes = aFilterTypes.getConstArray(); - for( int i = 0; i < aFilterNames.getLength(); i++ ) - xFilterMgr->appendFilter( pNames[i], pTypes[i] ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - INetURLObject aObj( aPathSeq[0] ); - aEdFileurl.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -SvInsertPlugInDialog::SvInsertPlugInDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_PLUGIN ), xStorage ), - aGbFileurl( this, CUI_RES( GB_FILEURL ) ), - aEdFileurl( this, CUI_RES( ED_FILEURL ) ), - aBtnFileurl( this, CUI_RES( BTN_FILEURL ) ), - aGbPluginsOptions( this, CUI_RES( GB_PLUGINS_OPTIONS ) ), - aEdPluginsOptions( this, CUI_RES( ED_PLUGINS_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - FreeResource(); - aBtnFileurl.SetClickHdl( LINK( this, SvInsertPlugInDialog, BrowseHdl ) ); -} - -SvInsertPlugInDialog::~SvInsertPlugInDialog() -{ - delete m_pURL; -} - -// ----------------------------------------------------------------------- - -static void Plugin_ImplFillCommandSequence( const String& aCommands, uno::Sequence< beans::PropertyValue >& aCommandSequence ) -{ - sal_uInt16 nEaten; - SvCommandList aLst; - aLst.AppendCommands( aCommands, &nEaten ); - - const size_t nCount = aLst.size(); - aCommandSequence.realloc( nCount ); - for( size_t nIndex = 0; nIndex < nCount; nIndex++ ) - { - aCommandSequence[nIndex].Name = aLst[ nIndex ].GetCommand(); - aCommandSequence[nIndex].Handle = -1; - aCommandSequence[nIndex].Value = makeAny( OUString( aLst[ nIndex ].GetArgument() ) ); - aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE; - } -} - -short SvInsertPlugInDialog::Execute() -{ - short nRet = RET_OK; - m_aCommands.Erase(); - DBG_ASSERT( m_xStorage.is(), "No storage!"); - if ( m_xStorage.is() && ( nRet = Dialog::Execute() ) == RET_OK ) - { - if ( !m_pURL ) - m_pURL = new INetURLObject(); - else - *m_pURL = INetURLObject(); - - m_aCommands = GetPlugInOptions(); - String aURL = GetPlugInFile(); - - // URL can be a valid and absolute URL or a system file name - m_pURL->SetSmartProtocol( INET_PROT_FILE ); - if ( !aURL.Len() || m_pURL->SetSmartURL( aURL ) ) - { - // create a plugin object - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_PLUGIN_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - } - - if ( m_xObj.is() ) - { - // set properties from dialog - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - uno::Reference < beans::XPropertySet > xSet( m_xObj->getComponent(), uno::UNO_QUERY ); - if ( xSet.is() ) - { - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginURL") ), - makeAny( ::rtl::OUString( m_pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) ); - uno::Sequence< beans::PropertyValue > aCommandSequence; - Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PluginCommands") ), makeAny( aCommandSequence ) ); - } - } - else - { - // PlugIn konnte nicht erzeugt werden - // global Resource from svtools (former so3 resource) - String aErr( impl_getSvtResString( STR_ERROR_OBJNOCREATE_PLUGIN ) ); - aErr.SearchAndReplace( String( '%' ), aURL ); - ErrorBox( this, WB_3DLOOK | WB_OK, aErr ).Execute(); - } - } - - return nRet; -} - -// class SvInsertAppletDlg ----------------------------------------------- - -IMPL_LINK( SvInsertAppletDialog, BrowseHdl, PushButton *, EMPTYARG ) -{ - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - Reference< XFilePicker > xFilePicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ), UNO_QUERY ); - DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); - - Reference< XInitialization > xInit( xFilePicker, UNO_QUERY ); - Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY ); - if( xInit.is() && xFilePicker.is() && xFilterMgr.is() ) - { - Sequence< Any > aServiceType( 1 ); - aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE; - xInit->initialize( aServiceType ); - - // add filter - try - { - xFilterMgr->appendFilter( - OUString( RTL_CONSTASCII_USTRINGPARAM( "Applet" ) ), - OUString( RTL_CONSTASCII_USTRINGPARAM( "*.class" ) ) - ); - } - catch( IllegalArgumentException& ) - { - DBG_ASSERT( 0, "caught IllegalArgumentException when registering filter\n" ); - } - - if( xFilePicker->execute() == ExecutableDialogResults::OK ) - { - Sequence< OUString > aPathSeq( xFilePicker->getFiles() ); - - INetURLObject aObj( aPathSeq[0] ); - aEdClassfile.SetText( aObj.getName() ); - aObj.removeSegment(); - aEdClasslocation.SetText( aObj.PathToFileName() ); - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - -SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), xStorage ), - aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ), - aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ), - aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ), - aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ), - aBtnClass( this, CUI_RES( BTN_CLASS ) ), - aGbClass( this, CUI_RES( GB_CLASS ) ), - aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ), - aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - FreeResource(); - aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) ); -} - -SvInsertAppletDialog::SvInsertAppletDialog( Window* pParent, const uno::Reference < embed::XEmbeddedObject >& xObj ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_APPLET ), uno::Reference < embed::XStorage >() ), - aFtClassfile( this, CUI_RES( FT_CLASSFILE ) ), - aEdClassfile( this, CUI_RES( ED_CLASSFILE ) ), - aFtClasslocation( this, CUI_RES( FT_CLASSLOCATION ) ), - aEdClasslocation( this, CUI_RES( ED_CLASSLOCATION ) ), - aBtnClass( this, CUI_RES( BTN_CLASS ) ), - aGbClass( this, CUI_RES( GB_CLASS ) ), - aEdAppletOptions( this, CUI_RES( ED_APPLET_OPTIONS ) ), - aGbAppletOptions( this, CUI_RES( GB_APPLET_OPTIONS ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - m_pURL(0) -{ - m_xObj = xObj; - FreeResource(); - aBtnClass.SetClickHdl( LINK( this, SvInsertAppletDialog, BrowseHdl ) ); -} - - -SvInsertAppletDialog::~SvInsertAppletDialog() -{ - delete m_pURL; -} - -short SvInsertAppletDialog::Execute() -{ - short nRet = RET_OK; - m_aClass.Erase(); - m_aCommands.Erase(); - - sal_Bool bOK = sal_False; - uno::Reference < beans::XPropertySet > xSet; - if ( m_xObj.is() ) - { - try - { - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - ::rtl::OUString aStr; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCode") ) ); - if ( aAny >>= aStr ) - SetClass( aStr ); - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCodeBase") ) ); - if ( aAny >>= aStr ) - SetClassLocation( aStr ); - uno::Sequence< beans::PropertyValue > aCommands; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCommands") ) ); - if ( aAny >>= aCommands ) - { - SvCommandList aList; - aList.FillFromSequence( aCommands ); - SetAppletOptions( aList.GetCommands() ); - } - - String aText( CUI_RES( STR_EDIT_APPLET ) ); - SetText( aText ); - bOK = sal_True; - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No Applet!" ); - } - } - else - { - DBG_ASSERT( m_xStorage.is(), "No storage!"); - bOK = m_xStorage.is(); - } - - if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK ) - { - if ( !m_xObj.is() ) - { - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_APPLET_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - } - - if ( m_xObj.is() ) - { - try - { - sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE; - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - String aClassLocation = GetClassLocation(); - - // Hack, aFileName wird auch fuer Class benutzt - m_aClass = GetClass(); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCode") ), makeAny( ::rtl::OUString( m_aClass ) ) ); - - ::rtl::OUString tmp = aClassLocation; - ::osl::File::getFileURLFromSystemPath(tmp, tmp); - aClassLocation = tmp; - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCodeBase") ), makeAny( tmp ) ); - m_aCommands = GetAppletOptions(); - - uno::Sequence< beans::PropertyValue > aCommandSequence; - Plugin_ImplFillCommandSequence( m_aCommands, aCommandSequence ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AppletCommands") ), makeAny( aCommandSequence ) ); - - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE ); - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No Applet!" ); - } - } - } - - return nRet; -} - -SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), xStorage ) - , aFTName ( this, CUI_RES( FT_FRAMENAME ) ) - , aEDName ( this, CUI_RES( ED_FRAMENAME ) ) - , aFTURL ( this, CUI_RES( FT_URL ) ) - , aEDURL ( this, CUI_RES( ED_URL ) ) - , aBTOpen ( this, CUI_RES(BT_FILEOPEN ) ) - - , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) ) - , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) ) - , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) ) - , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) ) - , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) ) - , aFLFrameBorder( this, CUI_RES( GB_BORDER ) ) - , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) ) - , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) ) - , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) ) - , aFLMargin( this, CUI_RES( GB_MARGIN ) ) - , aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) ) - , aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) ) - , aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) ) - , aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) ) - , aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aOKButton1( this, CUI_RES( 1 ) ) - , aCancelButton1( this, CUI_RES( 1 ) ) - , aHelpButton1( this, CUI_RES( 1 ) ) -{ - FreeResource(); - - aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT); - aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT); - - Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) ); - aCBMarginWidthDefault.SetClickHdl( aLink ); - aCBMarginHeightDefault.SetClickHdl( aLink ); - - aCBMarginWidthDefault.Check(); - aCBMarginHeightDefault.Check(); - aRBScrollingAuto.Check(); - aRBFrameBorderOn.Check(); - - aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) ); -} - -SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog( Window *pParent, const uno::Reference < embed::XEmbeddedObject >& xObj ) - : InsertObjectDialog_Impl( pParent, CUI_RES( MD_INSERT_OBJECT_IFRAME ), uno::Reference < embed::XStorage >() ) - , aFTName ( this, CUI_RES( FT_FRAMENAME ) ) - , aEDName ( this, CUI_RES( ED_FRAMENAME ) ) - , aFTURL ( this, CUI_RES( FT_URL ) ) - , aEDURL ( this, CUI_RES( ED_URL ) ) - , aBTOpen ( this, CUI_RES(BT_FILEOPEN ) ) - - , aFLScrolling ( this, CUI_RES( GB_SCROLLING ) ) - , aRBScrollingOn ( this, CUI_RES( RB_SCROLLINGON ) ) - , aRBScrollingOff ( this, CUI_RES( RB_SCROLLINGOFF ) ) - , aRBScrollingAuto ( this, CUI_RES( RB_SCROLLINGAUTO ) ) - - , aFLSepLeft( this, CUI_RES( FL_SEP_LEFT ) ) - , aFLFrameBorder( this, CUI_RES( GB_BORDER ) ) - , aRBFrameBorderOn ( this, CUI_RES( RB_FRMBORDER_ON ) ) - , aRBFrameBorderOff ( this, CUI_RES( RB_FRMBORDER_OFF ) ) - - , aFLSepRight( this, CUI_RES( FL_SEP_RIGHT ) ) - , aFLMargin( this, CUI_RES( GB_MARGIN ) ) - , aFTMarginWidth ( this, CUI_RES( FT_MARGINWIDTH ) ) - , aNMMarginWidth ( this, CUI_RES( NM_MARGINWIDTH ) ) - , aCBMarginWidthDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aFTMarginHeight ( this, CUI_RES( FT_MARGINHEIGHT ) ) - , aNMMarginHeight ( this, CUI_RES( NM_MARGINHEIGHT ) ) - , aCBMarginHeightDefault( this, CUI_RES( CB_MARGINHEIGHTDEFAULT ) ) - , aOKButton1( this, CUI_RES( 1 ) ) - , aCancelButton1( this, CUI_RES( 1 ) ) - , aHelpButton1( this, CUI_RES( 1 ) ) -{ - FreeResource(); - - m_xObj = xObj; - - aFLSepLeft.SetStyle(aFLSepLeft.GetStyle()|WB_VERT); - aFLSepRight.SetStyle(aFLSepRight.GetStyle()|WB_VERT); - - Link aLink( STATIC_LINK( this, SfxInsertFloatingFrameDialog, CheckHdl ) ); - aCBMarginWidthDefault.SetClickHdl( aLink ); - aCBMarginHeightDefault.SetClickHdl( aLink ); - - aCBMarginWidthDefault.Check(); - aCBMarginHeightDefault.Check(); - aRBScrollingAuto.Check(); - aRBFrameBorderOn.Check(); - - aBTOpen.SetClickHdl( STATIC_LINK( this, SfxInsertFloatingFrameDialog, OpenHdl ) ); -} - -short SfxInsertFloatingFrameDialog::Execute() -{ - short nRet = RET_OK; - sal_Bool bOK = sal_False; - uno::Reference < beans::XPropertySet > xSet; - if ( m_xObj.is() ) - { - try - { - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - ::rtl::OUString aStr; - uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL") ) ); - if ( aAny >>= aStr ) - aEDURL.SetText( aStr ); - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName") ) ); - if ( aAny >>= aStr ) - aEDName.SetText( aStr ); - - sal_Int32 nSize = SIZE_NOT_SET; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth") ) ); - aAny >>= nSize; - - if ( nSize == SIZE_NOT_SET ) - { - aCBMarginWidthDefault.Check( sal_True ); - aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) ); - aFTMarginWidth.Enable( sal_False ); - aNMMarginWidth.Enable( sal_False ); - } - else - aNMMarginWidth.SetText( String::CreateFromInt32( nSize ) ); - - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight") ) ); - aAny >>= nSize; - - if ( nSize == SIZE_NOT_SET ) - { - aCBMarginHeightDefault.Check( sal_True ); - aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) ); - aFTMarginHeight.Enable( sal_False ); - aNMMarginHeight.Enable( sal_False ); - } - else - aNMMarginHeight.SetText( String::CreateFromInt32( nSize ) ); - - sal_Bool bScrollOn = sal_False; - sal_Bool bScrollOff = sal_False; - sal_Bool bScrollAuto = sal_False; - - sal_Bool bSet = sal_False; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll") ) ); - aAny >>= bSet; - if ( !bSet ) - { - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode") ) ); - aAny >>= bSet; - bScrollOn = bSet; - bScrollOff = !bSet; - } - else - bScrollAuto = sal_True; - - aRBScrollingOn.Check( bScrollOn ); - aRBScrollingOff.Check( bScrollOff ); - aRBScrollingAuto.Check( bScrollAuto ); - - bSet = sal_False; - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoBorder") ) ); - aAny >>= bSet; - if ( !bSet ) - { - aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder") ) ); - aAny >>= bSet; - aRBFrameBorderOn.Check( bSet ); - aRBFrameBorderOff.Check( !bSet ); - } - - SetUpdateMode( sal_True ); - bOK = sal_True; - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No IFrame!" ); - } - } - else - { - DBG_ASSERT( m_xStorage.is(), "No storage!"); - bOK = m_xStorage.is(); - } - - if ( bOK && ( nRet = Dialog::Execute() ) == RET_OK ) - { - ::rtl::OUString aURL; - if ( aEDURL.GetText().Len() ) - { - // URL can be a valid and absolute URL or a system file name - INetURLObject aObj; - aObj.SetSmartProtocol( INET_PROT_FILE ); - if ( aObj.SetSmartURL( aEDURL.GetText() ) ) - aURL = aObj.GetMainURL( INetURLObject::NO_DECODE ); - } - - if ( !m_xObj.is() && aURL.getLength() ) - { - // create the object - ::rtl::OUString aName; - SvGlobalName aClassId( SO3_IFRAME_CLASSID ); - m_xObj = aCnt.CreateEmbeddedObject( aClassId.GetByteSequence(), aName ); - if ( m_xObj->getCurrentState() == embed::EmbedStates::LOADED ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - xSet = uno::Reference < beans::XPropertySet >( m_xObj->getComponent(), uno::UNO_QUERY ); - } - - if ( m_xObj.is() ) - { - try - { - sal_Bool bIPActive = m_xObj->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE; - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::RUNNING ); - - ::rtl::OUString aName = aEDName.GetText(); - ScrollingMode eScroll = ScrollingNo; - if ( aRBScrollingOn.IsChecked() ) - eScroll = ScrollingYes; - if ( aRBScrollingOff.IsChecked() ) - eScroll = ScrollingNo; - if ( aRBScrollingAuto.IsChecked() ) - eScroll = ScrollingAuto; - - sal_Bool bHasBorder = aRBFrameBorderOn.IsChecked(); - - long lMarginWidth; - if ( !aCBMarginWidthDefault.IsChecked() ) - lMarginWidth = (long) aNMMarginWidth.GetText().ToInt32(); - else - lMarginWidth = SIZE_NOT_SET; - - long lMarginHeight; - if ( !aCBMarginHeightDefault.IsChecked() ) - lMarginHeight = (long) aNMMarginHeight.GetText().ToInt32(); - else - lMarginHeight = SIZE_NOT_SET; - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameURL") ), makeAny( aURL ) ); - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName") ), makeAny( aName ) ); - - if ( eScroll == ScrollingAuto ) - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsAutoScroll") ), - makeAny( sal_True ) ); - else - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsScrollingMode") ), - makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameIsBorder") ), - makeAny( bHasBorder ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginWidth") ), - makeAny( sal_Int32( lMarginWidth ) ) ); - - xSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameMarginHeight") ), - makeAny( sal_Int32( lMarginHeight ) ) ); - - if ( bIPActive ) - m_xObj->changeState( embed::EmbedStates::INPLACE_ACTIVE ); - } - catch ( uno::Exception& ) - { - OSL_FAIL( "No IFrame!" ); - } - } - } - - return nRet; -} - -//------------------------------------------------------------------------------ - -IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox*, pCB ) -{ - if ( pCB == &pThis->aCBMarginWidthDefault ) - { - if ( pCB->IsChecked() ) - pThis->aNMMarginWidth.SetText( String::CreateFromInt32( DEFAULT_MARGIN_WIDTH ) ); - pThis->aFTMarginWidth.Enable( !pCB->IsChecked() ); - pThis->aNMMarginWidth.Enable( !pCB->IsChecked() ); - } - - if ( pCB == &pThis->aCBMarginHeightDefault ) - { - if ( pCB->IsChecked() ) - pThis->aNMMarginHeight.SetText( String::CreateFromInt32( DEFAULT_MARGIN_HEIGHT ) ); - pThis->aFTMarginHeight.Enable( !pCB->IsChecked() ); - pThis->aNMMarginHeight.Enable( !pCB->IsChecked() ); - } - - return 0L; -} - -//------------------------------------------------------------------------------ - -IMPL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton*, EMPTYARG ) -{ - Window* pOldParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( pThis ); - - // create the file dialog - sfx2::FileDialogHelper aFileDlg( WB_OPEN | SFXWB_PASSWORD, String() ); - - // set the title - aFileDlg.SetTitle( OUString( String( CUI_RES( MD_INSERT_OBJECT_IFRAME ) ) ) ); - - // show the dialog - if ( aFileDlg.Execute() == ERRCODE_NONE ) - pThis->aEDURL.SetText( - INetURLObject( aFileDlg.GetPath() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) ); - - Application::SetDefDialogParent( pOldParent ); - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/insrc.cxx b/cui/source/dialogs/insrc.cxx deleted file mode 100644 index d514ef431..000000000 --- a/cui/source/dialogs/insrc.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include "insrc.hxx" -#include "insrc.hrc" - -bool SvxInsRowColDlg::isInsertBefore() const -{ - return !aAfterBtn.IsChecked(); -} - -sal_uInt16 SvxInsRowColDlg::getInsertCount() const -{ - return static_cast< sal_uInt16 >( aCountEdit.GetValue() ); -} - -SvxInsRowColDlg::SvxInsRowColDlg(Window* pParent, bool bCol, const rtl::OString& sHelpId ) - : ModalDialog( pParent, CUI_RES(DLG_INS_ROW_COL) ), - aCount( this, CUI_RES( FT_COUNT ) ), - aCountEdit( this, CUI_RES( ED_COUNT ) ), - aInsFL( this, CUI_RES( FL_INS ) ), - aBeforeBtn( this, CUI_RES( CB_POS_BEFORE ) ), - aAfterBtn( this, CUI_RES( CB_POS_AFTER ) ), - aPosFL( this, CUI_RES( FL_POS ) ), - aRow(CUI_RES(STR_ROW)), - aCol(CUI_RES(STR_COL)), - aOKBtn( this, CUI_RES( BT_OK ) ), - aCancelBtn( this, CUI_RES( BT_CANCEL ) ), - aHelpBtn( this, CUI_RES( BT_HELP ) ), - bColumn( bCol ) -{ - FreeResource(); - String aTmp( GetText() ); - if( bColumn ) - { - aTmp += aCol; - } - else - { - aTmp += aRow; - } - SetText( aTmp ); - SetHelpId( sHelpId ); -} - -short SvxInsRowColDlg::Execute(void) -{ - return ModalDialog::Execute(); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/insrc.hrc b/cui/source/dialogs/insrc.hrc deleted file mode 100644 index 0c780df36..000000000 --- a/cui/source/dialogs/insrc.hrc +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FT_COUNT 1 -#define ED_COUNT 2 -#define FL_INS 3 - -#define CB_POS_BEFORE 10 -#define CB_POS_AFTER 11 -#define FL_POS 12 - -#define STR_ROW 20 -#define STR_COL 21 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 diff --git a/cui/source/dialogs/insrc.src b/cui/source/dialogs/insrc.src deleted file mode 100644 index 4ba5ebf1e..000000000 --- a/cui/source/dialogs/insrc.src +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include -#include "insrc.hrc" - -ModalDialog DLG_INS_ROW_COL -{ - HelpID = "cui:ModalDialog:DLG_INS_ROW_COL"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 136 , 84 ) ; - Text [ en-US ] = "Insert" ; - Moveable = TRUE ; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 80 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 80 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 80 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - RadioButton CB_POS_BEFORE - { - HelpID = "cui:RadioButton:DLG_INS_ROW_COL:CB_POS_BEFORE"; - Pos = MAP_APPFONT ( 12 , 49 ) ; - Size = MAP_APPFONT ( 56 , 10 ) ; - Text [ en-US ] = "~Before" ; - TabStop = TRUE ; - }; - RadioButton CB_POS_AFTER - { - HelpID = "cui:RadioButton:DLG_INS_ROW_COL:CB_POS_AFTER"; - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 56 , 10 ) ; - Text [ en-US ] = "A~fter" ; - TabStop = TRUE ; - Check = TRUE ; - }; - NumericField ED_COUNT - { - HelpID = "cui:NumericField:DLG_INS_ROW_COL:ED_COUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 44 , 14 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 99 ; - Value = 1 ; - First = 1 ; - Last = 5 ; - }; - FixedLine FL_INS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 68 , 8 ) ; - Text [ en-US ] = "Insert" ; - }; - FixedLine FL_POS - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 68 , 8 ) ; - Text [ en-US ] = "Position"; - }; - FixedText FT_COUNT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "~Number" ; - Left = TRUE ; - }; - String STR_ROW - { - Text [ en-US ] = " Rows" ; - }; - String STR_COL - { - Text [ en-US ] = " Columns" ; - }; -}; diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx deleted file mode 100644 index 22bd58b02..000000000 --- a/cui/source/dialogs/linkdlg.cxx +++ /dev/null @@ -1,702 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "helpid.hrc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#define _SVSTDARR_USHORTS -#include - -#define MAX_FILENAME 18 -#define MAX_LINKNAME 18 -#define MAX_TYPENAME 15 -#define MAX_UPDATENAME 10 - -#define FILEOBJECT ( OBJECT_CLIENT_FILE & ~OBJECT_CLIENT_SO ) - -using namespace sfx2; - -SV_DECL_IMPL_REF_LIST(SvBaseLink,SvBaseLink*) - -// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert -static long nTabs[] = - { 4, // Number of Tabs - 0, 77, 144, 209 - }; - - -SvBaseLinksDlg::SvBaseLinksDlg( Window * pParent, LinkManager* pMgr, sal_Bool bHtml ) - : ModalDialog( pParent, CUI_RES( MD_UPDATE_BASELINKS ) ), - aFtFiles( this, CUI_RES( FT_FILES ) ), - aFtLinks( this, CUI_RES( FT_LINKS ) ), - aFtType( this, CUI_RES( FT_TYPE ) ), - aFtStatus( this, CUI_RES( FT_STATUS ) ), - aTbLinks( this, CUI_RES(TB_LINKS ) ), - aFtFiles2( this, CUI_RES( FT_FILES2 ) ), - aFtFullFileName( this, CUI_RES( FT_FULL_FILE_NAME ) ), - aFtSource2( this, CUI_RES( FT_SOURCE2 ) ), - aFtFullSourceName( this, CUI_RES( FT_FULL_SOURCE_NAME ) ), - aFtType2( this, CUI_RES( FT_TYPE2 ) ), - aFtFullTypeName( this, CUI_RES( FT_FULL_TYPE_NAME ) ), - aFtUpdate( this, CUI_RES( FT_UPDATE ) ), - aRbAutomatic( this, CUI_RES( RB_AUTOMATIC ) ), - aRbManual( this, CUI_RES( RB_MANUAL ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aPbUpdateNow( this, CUI_RES( PB_UPDATE_NOW ) ), - aPbOpenSource( this, CUI_RES( PB_OPEN_SOURCE ) ), - aPbChangeSource( this, CUI_RES( PB_CHANGE_SOURCE ) ), - aPbBreakLink( this, CUI_RES( PB_BREAK_LINK ) ), - aStrAutolink( CUI_RES( STR_AUTOLINK ) ), - aStrManuallink( CUI_RES( STR_MANUALLINK ) ), - aStrBrokenlink( CUI_RES( STR_BROKENLINK ) ), - aStrGraphiclink( CUI_RES( STR_GRAPHICLINK ) ), - aStrButtonclose( CUI_RES( STR_BUTTONCLOSE ) ), - aStrCloselinkmsg( CUI_RES( STR_CLOSELINKMSG ) ), - aStrCloselinkmsgMulti( CUI_RES( STR_CLOSELINKMSG_MULTI ) ), - aStrWaitinglink( CUI_RES( STR_WAITINGLINK ) ), - pLinkMgr( NULL ), - bHtmlMode(bHtml) -{ - FreeResource(); - - aTbLinks.SetHelpId(HID_LINKDLG_TABLB); - aTbLinks.SetSelectionMode( MULTIPLE_SELECTION ); - aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT ); - aTbLinks.Resize(); // OS: Hack fuer richtige Selektion - - // UpdateTimer fuer DDE-/Grf-Links, auf die gewarted wird - aUpdateTimer.SetTimeoutHdl( LINK( this, SvBaseLinksDlg, UpdateWaitingHdl ) ); - aUpdateTimer.SetTimeout( 1000 ); - //IAccessibility2 Implementation 2009----- - // Set the ZOrder, and accessible name to the dialog's title - aTbLinks.SetZOrder(0, WINDOW_ZORDER_FIRST); - aTbLinks.SetAccessibleName(this->GetText()); - aTbLinks.SetAccessibleRelationLabeledBy(&aFtFiles); - //-----IAccessibility2 Implementation 2009 - - OpenSource().Hide(); - - Links().SetSelectHdl( LINK( this, SvBaseLinksDlg, LinksSelectHdl ) ); - Links().SetDoubleClickHdl( LINK( this, SvBaseLinksDlg, LinksDoubleClickHdl ) ); - Automatic().SetClickHdl( LINK( this, SvBaseLinksDlg, AutomaticClickHdl ) ); - Manual().SetClickHdl( LINK( this, SvBaseLinksDlg, ManualClickHdl ) ); - UpdateNow().SetClickHdl( LINK( this, SvBaseLinksDlg, UpdateNowClickHdl ) ); - ChangeSource().SetClickHdl( LINK( this, SvBaseLinksDlg, ChangeSourceClickHdl ) ); - if(!bHtmlMode) - BreakLink().SetClickHdl( LINK( this, SvBaseLinksDlg, BreakLinkClickHdl ) ); - else - BreakLink().Hide(); - - SetManager( pMgr ); -} - -SvBaseLinksDlg::~SvBaseLinksDlg() -{ -} - -/************************************************************************* -|* SvBaseLinksDlg::Handler() -*************************************************************************/ -IMPL_LINK( SvBaseLinksDlg, LinksSelectHdl, SvTabListBox *, pSvTabListBox ) -{ - sal_uInt16 nSelectionCount = pSvTabListBox ? - (sal_uInt16)pSvTabListBox->GetSelectionCount() : 0; - if(nSelectionCount > 1) - { - //bei Mehrfachselektion ggf. alte Eintraege deselektieren - SvLBoxEntry* pEntry = 0; - SvBaseLink* pLink = 0; - pEntry = pSvTabListBox->GetHdlEntry(); - pLink = (SvBaseLink*)pEntry->GetUserData(); - sal_uInt16 nObjectType = pLink->GetObjType(); - if((OBJECT_CLIENT_FILE & nObjectType) != OBJECT_CLIENT_FILE) - { - pSvTabListBox->SelectAll(sal_False); - pSvTabListBox->Select(pEntry); - nSelectionCount = 1; - } - else - { - for( sal_uInt16 i = 0; i < nSelectionCount; i++) - { - pEntry = i == 0 ? pSvTabListBox->FirstSelected() : - pSvTabListBox->NextSelected(pEntry); - DBG_ASSERT(pEntry, "Wo ist der Entry?"); - pLink = (SvBaseLink*)pEntry->GetUserData(); - DBG_ASSERT(pLink, "Wo ist der Link?"); - if( (OBJECT_CLIENT_FILE & pLink->GetObjType()) != OBJECT_CLIENT_FILE ) - pSvTabListBox->Select( pEntry, sal_False ); - - } - } - - UpdateNow().Enable(); - - Automatic().Disable(); - Manual().Check(); - Manual().Disable(); - } - else - { - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( !pLink ) - return 0; - - UpdateNow().Enable(); - - String sType, sLink; - String *pLinkNm = &sLink, *pFilter = 0; - - if( FILEOBJECT & pLink->GetObjType() ) - { - Automatic().Disable(); - Manual().Check(); - Manual().Disable(); - if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) - pLinkNm = 0, pFilter = &sLink; - } - else - { - Automatic().Enable(); - Manual().Enable(); - - if( LINKUPDATE_ALWAYS == pLink->GetUpdateMode() ) - Automatic().Check(); - else - Manual().Check(); - } - - String aFileName; - pLinkMgr->GetDisplayNames( pLink, &sType, &aFileName, pLinkNm, pFilter ); - aFileName = INetURLObject::decode(aFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); - FileName().SetText( aFileName ); - SourceName().SetText( sLink ); - TypeName().SetText( sType ); - } - return 0; -} - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox ) -{ - (void)pSvTabListBox; - - ChangeSourceClickHdl( 0 ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, LinksDoubleClickHdl, SvTabListBox *, pSvTabListBox ) - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton ) -{ - (void)pRadioButton; - - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && - LINKUPDATE_ALWAYS != pLink->GetUpdateMode() ) - SetType( *pLink, nPos, LINKUPDATE_ALWAYS ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, AutomaticClickHdl, RadioButton *, pRadioButton ) - -IMPL_LINK_INLINE_START( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton ) -{ - (void)pRadioButton; - - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if( pLink && !( FILEOBJECT & pLink->GetObjType() ) && - LINKUPDATE_ONCALL != pLink->GetUpdateMode()) - SetType( *pLink, nPos, LINKUPDATE_ONCALL ); - return 0; -} -IMPL_LINK_INLINE_END( SvBaseLinksDlg, ManualClickHdl, RadioButton *, pRadioButton ) - -IMPL_LINK( SvBaseLinksDlg, UpdateNowClickHdl, PushButton *, EMPTYARG ) -{ - SvTabListBox& rListBox = Links(); - sal_uInt16 nSelCnt = (sal_uInt16)rListBox.GetSelectionCount(); - if( 255 < nSelCnt ) - nSelCnt = 255; - - std::vector< SvBaseLink* > aLnkArr; - std::vector< sal_uInt16 > aPosArr; - - SvLBoxEntry* pE = rListBox.FirstSelected(); - while( pE ) - { - sal_uInt16 nFndPos = (sal_uInt16)rListBox.GetModel()->GetAbsPos( pE ); - if( LISTBOX_ENTRY_NOTFOUND != nFndPos ) - { - aLnkArr.push_back( static_cast< SvBaseLink* >( pE->GetUserData() ) ); - aPosArr.push_back( nFndPos ); - } - pE = rListBox.NextSelected( pE ); - } - - if( !aLnkArr.empty() ) - { - for( sal_uInt16 n = 0; n < aLnkArr.size(); ++n ) - { - SvBaseLinkRef xLink = aLnkArr[ n ]; - - // suche erstmal im Array nach dem Eintrag - for( sal_uInt16 i = 0; i < pLinkMgr->GetLinks().Count(); ++i ) - if( &xLink == *pLinkMgr->GetLinks()[ i ] ) - { - xLink->SetUseCache( sal_False ); - SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() ); - xLink->SetUseCache( sal_True ); - break; - } - } - - // falls jemand der Meinung ist, seine Links auszutauschen (SD) - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - - - if( 0 == (pE = rListBox.GetEntry( aPosArr[ 0 ] )) || - pE->GetUserData() != aLnkArr[ 0 ] ) - { - // suche mal den Link - pE = rListBox.First(); - while( pE ) - { - if( pE->GetUserData() == aLnkArr[ 0 ] ) - break; - pE = rListBox.Next( pE ); - } - - if( !pE ) - pE = rListBox.FirstSelected(); - } - - if( pE ) - { - SvLBoxEntry* pSelEntry = rListBox.FirstSelected(); - if( pE != pSelEntry ) - rListBox.Select( pSelEntry, sal_False ); - rListBox.Select( pE ); - rListBox.MakeVisible( pE ); - } - - pNewMgr->CloseCachedComps(); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, ChangeSourceClickHdl, PushButton *, pPushButton ) -{ - (void)pPushButton; - - sal_uInt16 nSelectionCount = (sal_uInt16)Links().GetSelectionCount(); - if(nSelectionCount > 1) - { - PathDialog aPathDlg( this ); - String sType, sFile, sLinkName; - String sFilter; - SvLBoxEntry* pEntry = Links().FirstSelected(); - SvBaseLink* pLink = (SvBaseLink*)pEntry->GetUserData(); - pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, 0, 0 ); - INetURLObject aUrl(sFile); - if(aUrl.GetProtocol() == INET_PROT_FILE) - { - rtl::OUString sOldPath(aUrl.PathToFileName()); - sal_Int32 nLen = aUrl.GetName().getLength(); - sOldPath = sOldPath.copy(0, sOldPath.getLength() - nLen); - aPathDlg.SetPath(sOldPath); - } - if(aPathDlg.Execute() == RET_OK) - { - String aPath = aPathDlg.GetPath(); - - for( sal_uInt16 i = 0; i < nSelectionCount; i++) - { - pEntry = i==0 ? - Links().FirstSelected() : - Links().NextSelected( pEntry ); - DBG_ASSERT(pEntry,"Wo ist der Entry"); - pLink = (SvBaseLink*)pEntry->GetUserData(); - DBG_ASSERT(pLink,"Wo ist der Link"); - pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, &sLinkName, &sFilter ); - INetURLObject aUrl_(sFile); - INetURLObject aUrl2(aPath, INET_PROT_FILE); - aUrl2.insertName( aUrl_.getName() ); - String sNewLinkName; - MakeLnkName( sNewLinkName, 0 , - aUrl2.GetMainURL(INetURLObject::DECODE_TO_IURI), sLinkName, &sFilter); - pLink->SetLinkSourceName( sNewLinkName ); - pLink->Update(); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - } - } - else - { - sal_uInt16 nPos; - SvBaseLink* pLink = GetSelEntry( &nPos ); - if ( pLink && (pLink->GetLinkSourceName().Len() != 0) ) - pLink->Edit( this, LINK( this, SvBaseLinksDlg, EndEditHdl ) ); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, BreakLinkClickHdl, PushButton *, pPushButton ) -{ - (void)pPushButton; - - sal_Bool bModified = sal_False; - if(Links().GetSelectionCount() <= 1) - { - sal_uInt16 nPos; - SvBaseLinkRef xLink = GetSelEntry( &nPos ); - if( !xLink.Is() ) - return 0; - - QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, Closelinkmsg() ); - - if( RET_YES == aBox.Execute() ) - { - Links().GetModel()->Remove( Links().GetEntry( nPos ) ); - - // falls Object noch vorhanden, dann das schliessen - sal_Bool bNewLnkMgr = OBJECT_CLIENT_FILE == xLink->GetObjType(); - - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); - - // falls einer vergessen hat sich auszutragen - if( xLink.Is() ) - pLinkMgr->Remove( &xLink ); - - if( bNewLnkMgr ) - { - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - - SvLBoxEntry* pEntry = Links().GetEntry( nPos ? --nPos : 0 ); - if( pEntry ) - Links().SetCurEntry( pEntry ); - } - bModified = sal_True; - } - } - else - { - QueryBox aBox( this, WB_YES_NO | WB_DEF_YES, CloselinkmsgMulti() ); - - if( RET_YES == aBox.Execute() ) - { - - SvBaseLinkMemberList aLinkList; - SvLBoxEntry* pEntry = Links().FirstSelected(); - while ( pEntry ) - { - void * pUD = pEntry->GetUserData(); - if( pUD ) - aLinkList.Append( (SvBaseLink*)pUD ); - pEntry = Links().NextSelected(pEntry); - } - Links().RemoveSelection(); - for( sal_uLong i = 0; i < aLinkList.Count(); i++ ) - { - SvBaseLinkRef xLink = aLinkList.GetObject( i ); - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); - - // falls einer vergessen hat sich auszutragen - pLinkMgr->Remove( &xLink ); - bModified = sal_True; - } - //Danach alle selektierten Eintraege entfernen - } - } - if(bModified) - { - if( !Links().GetEntryCount() ) - { - // Der letzte macht das Licht aus - Automatic().Disable(); - Manual().Disable(); - UpdateNow().Disable(); - ChangeSource().Disable(); - BreakLink().Disable(); - - String aEmpty; - SourceName().SetText( aEmpty ); - TypeName().SetText( aEmpty ); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - } - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, pTimer ) -{ - (void)pTimer; - - Links().SetUpdateMode(sal_False); - for( sal_uLong nPos = Links().GetEntryCount(); nPos; ) - { - SvLBoxEntry* pBox = Links().GetEntry( --nPos ); - SvBaseLinkRef xLink( (SvBaseLink*)pBox->GetUserData() ); - if( xLink.Is() ) - { - String sCur( ImplGetStateStr( *xLink ) ), - sOld( Links().GetEntryText( pBox, 3 ) ); - if( sCur != sOld ) - Links().SetEntryText( sCur, pBox, 3 ); - } - } - Links().SetUpdateMode(sal_True); - return 0; -} - -IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink*, _pLink ) -{ - sal_uInt16 nPos; - GetSelEntry( &nPos ); - - if( _pLink && _pLink->WasLastEditOK() ) - { - // StarImpress/Draw tauschen die LinkObjecte selbst aus! - // also suche den Link im Manager, wenn der nicht mehr existiert, - // dann setze fuelle die Liste komplett neu. Ansonsten braucht - // nur der editierte Linkt aktualisiert werden. - sal_Bool bLinkFnd = sal_False; - for( sal_uInt16 n = pLinkMgr->GetLinks().Count(); n; ) - if( _pLink == &(*pLinkMgr->GetLinks()[ --n ]) ) - { - bLinkFnd = sal_True; - break; - } - - if( bLinkFnd ) - { - Links().SetUpdateMode(sal_False); - Links().GetModel()->Remove( Links().GetEntry( nPos ) ); - SvLBoxEntry* pToUnselect = Links().FirstSelected(); - InsertEntry( *_pLink, nPos, sal_True ); - if(pToUnselect) - Links().Select(pToUnselect, sal_False); - Links().SetUpdateMode(sal_True); - } - else - { - LinkManager* pNewMgr = pLinkMgr; - pLinkMgr = 0; - SetManager( pNewMgr ); - } - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); - } - return 0; -} - -String SvBaseLinksDlg::ImplGetStateStr( const SvBaseLink& rLnk ) -{ - String sRet; - if( !rLnk.GetObj() ) - sRet = Brokenlink(); - else if( rLnk.GetObj()->IsPending() ) - { - sRet = Waitinglink(); - StartUpdateTimer(); - } - else if( LINKUPDATE_ALWAYS == rLnk.GetUpdateMode() ) - sRet = Autolink(); - else - sRet = Manuallink(); - - return sRet; -} - -void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr ) -{ - if( pLinkMgr == pNewMgr ) - return; - - if( pNewMgr ) - // Update muss vor Clear gestoppt werden - Links().SetUpdateMode( sal_False ); - - Links().Clear(); - pLinkMgr = pNewMgr; - - if( pLinkMgr ) - { - SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks(); - for( sal_uInt16 n = 0; n < rLnks.Count(); ++n ) - { - SvBaseLinkRef* pLinkRef = rLnks[ n ]; - if( !pLinkRef->Is() ) - { - rLnks.Remove( n, 1 ); - --n; - continue; - } - if( (*pLinkRef)->IsVisible() ) - InsertEntry( **pLinkRef ); - } - - if( rLnks.Count() ) - { - SvLBoxEntry* pEntry = Links().GetEntry( 0 ); - Links().SetCurEntry( pEntry ); - Links().Select( pEntry ); - LinksSelectHdl( 0 ); - } - Links().SetUpdateMode( sal_True ); - Links().Invalidate(); - } -} - - -void SvBaseLinksDlg::InsertEntry( const SvBaseLink& rLink, sal_uInt16 nPos, sal_Bool bSelect ) -{ - String aEntry, sFileNm, sLinkNm, sTypeNm, sFilter; - - pLinkMgr->GetDisplayNames( (SvBaseLink*)&rLink, &sTypeNm, &sFileNm, &sLinkNm, &sFilter ); - - // GetTab(0) gibt die Position der von der TabListBox automatisch eingefuegten - // Bitmap. Die Breite der ersten Textspalte ergibt sich deshalb aus Tab(2)-Tab(1) - long nWidthPixel = Links().GetLogicTab( 2 ) - Links().GetLogicTab( 1 ); - nWidthPixel -= SV_TAB_BORDER; - XubString aTxt = Links().GetEllipsisString( sFileNm, nWidthPixel, TEXT_DRAW_PATHELLIPSIS ); - INetURLObject aPath( sFileNm, INET_PROT_FILE ); - String aFileName = aPath.getName(); - aFileName = INetURLObject::decode(aFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); - - if( aFileName.Len() > aTxt.Len() ) - aTxt = aFileName; - else if( aTxt.Search( aFileName, aTxt.Len() - aFileName.Len() ) == STRING_NOTFOUND ) - // filename not in string - aTxt = aFileName; - - aEntry = aTxt; - aEntry += '\t'; - if( OBJECT_CLIENT_GRF == rLink.GetObjType() ) - aEntry += sFilter; - else - aEntry += sLinkNm; - aEntry += '\t'; - aEntry += sTypeNm; - aEntry += '\t'; - aEntry += ImplGetStateStr( rLink ); - - SvLBoxEntry * pE = Links().InsertEntryToColumn( aEntry, nPos ); - pE->SetUserData( (void*)&rLink ); - if(bSelect) - Links().Select(pE); -} - -SvBaseLink* SvBaseLinksDlg::GetSelEntry( sal_uInt16* pPos ) -{ - SvLBoxEntry* pE = Links().FirstSelected(); - sal_uInt16 nPos; - if( pE && LISTBOX_ENTRY_NOTFOUND != - ( nPos = (sal_uInt16)Links().GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - - if( pPos ) - *pPos = nPos; - return (SvBaseLink*)pE->GetUserData(); - } - return 0; -} - -void SvBaseLinksDlg::SetType( SvBaseLink& rLink, - sal_uInt16 nSelPos, - sal_uInt16 nType ) -{ - rLink.SetUpdateMode( nType ); - rLink.Update(); - SvLBoxEntry* pBox = Links().GetEntry( nSelPos ); - Links().SetEntryText( ImplGetStateStr( rLink ), pBox, 3 ); - if( pLinkMgr->GetPersist() ) - pLinkMgr->GetPersist()->SetModified(); -} - -void SvBaseLinksDlg::SetActLink( SvBaseLink * pLink ) -{ - if( pLinkMgr ) - { - const SvBaseLinks& rLnks = pLinkMgr->GetLinks(); - sal_uInt16 nSelect = 0; - for( sal_uInt16 n = 0; n < rLnks.Count(); ++n ) - { - SvBaseLinkRef* pLinkRef = rLnks[ n ]; - // #109573# only visible links have been inserted into the TreeListBox, - // invisible ones have to be skipped here - if( (*pLinkRef)->IsVisible() ) - { - if( pLink == *pLinkRef ) - { - Links().Select( Links().GetEntry( nSelect ) ); - LinksSelectHdl( 0 ); - return ; - } - nSelect++; - } - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multifil.cxx b/cui/source/dialogs/multifil.cxx deleted file mode 100644 index cc76430f7..000000000 --- a/cui/source/dialogs/multifil.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include - -#include - -#include "multipat.hxx" -#include "multifil.hxx" -#include - -#include "multipat.hrc" -#include - -// #97807# ------------- -#include -#include - -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -using namespace com::sun::star::ucb; -using namespace com::sun::star::uno; - -// class SvxMultiFileDialog ---------------------------------------------- - -IMPL_LINK( SvxMultiFileDialog, AddHdl_Impl, PushButton *, pBtn ) -{ - sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); - - if ( IsClassPathMode() ) - { - aDlg.SetTitle( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE ) ); - aDlg.AddFilter( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") ); - } - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - // #97807# URL content comparison of entries ----------- - INetURLObject aFile( aDlg.GetPath() ); - String sInsFile = aFile.getFSysPath( INetURLObject::FSYS_DETECT ); - ::ucbhelper::Content aContent( aFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() ); - Reference< XContent > xContent = aContent.get(); - OSL_ENSURE( xContent.is(), "AddHdl_Impl: invalid content interface!" ); - Reference< XContentIdentifier > xID = xContent->getIdentifier(); - OSL_ENSURE( xID.is(), "AddHdl_Impl: invalid ID interface!" ); - // ensure the content of files are valid - - sal_uInt16 nCount = aPathLB.GetEntryCount(); - sal_Bool bDuplicated = sal_False; - try - { - if( nCount > 0 ) // start comparison - { - sal_uInt16 i; - ::ucbhelper::Content & VContent = aContent; // temporary Content reference - Reference< XContent > xVContent; - Reference< XContentIdentifier > xVID; - for( i = 0; i < nCount; i++ ) - { - String sVFile = aPathLB.GetEntry( i ); - std::map< String, ::ucbhelper::Content >::iterator aCur = aFileContentMap.find( sVFile ); - if( aCur == aFileContentMap.end() ) // look for File Content in aFileContentMap, but not find it. - { - INetURLObject aVFile( sVFile, INetURLObject::FSYS_DETECT ); - aFileContentMap[sVFile] = ::ucbhelper::Content( aVFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() ); - VContent = aFileContentMap.find( sVFile )->second; - } - else - VContent = aCur->second; - xVContent = VContent.get(); - OSL_ENSURE( xVContent.is(), "AddHdl_Impl: invalid content interface!" ); - xVID = xVContent->getIdentifier(); - OSL_ENSURE( xVID.is(), "AddHdl_Impl: invalid ID interface!" ); - if ( xID.is() && xVID.is() ) - { - // get a generic content provider - ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); - Reference< XContentProvider > xProvider; - if ( pBroker ) - xProvider = pBroker->getContentProviderInterface(); - if ( xProvider.is() ) - { - if ( 0 == xProvider->compareContentIds( xID, xVID ) ) - { - bDuplicated = sal_True; - break; - } - } - } - } - } // end of if the entries are more than zero. - } // end of try(} - catch( const Exception& ) // catch every exception of comparison - { - OSL_FAIL( "AddHdl_Impl: caught an unexpected exception!" ); - } - - if ( bDuplicated ) // #97807# -------------------- - { - String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsFile ); - InfoBox( pBtn, sMsg ).Execute(); - } - else - { - sal_uInt16 nPos = aPathLB.InsertEntry( sInsFile, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*) new String( sInsFile ) ); - } - - } // end of if ( aDlg.Execute() == ERRCODE_NONE ) - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiFileDialog, DelHdl_Impl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nPos = aPathLB.GetSelectEntryPos(); - aPathLB.RemoveEntry( nPos ); - sal_uInt16 nCnt = aPathLB.GetEntryCount(); - - if ( nCnt ) - { - nCnt--; - - if ( nPos > nCnt ) - nPos = nCnt; - aPathLB.SelectEntryPos( nPos ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -SvxMultiFileDialog::SvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed ) : - - SvxMultiPathDialog( pParent, bEmptyAllowed ) - -{ - aAddBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, AddHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxMultiFileDialog, DelHdl_Impl ) ); - SetText( CUI_RES( RID_SVXSTR_FILE_TITLE ) ); - aPathFL.SetText( CUI_RES( RID_SVXSTR_FILE_HEADLINE ) ); - aDelBtn.Enable(); -} - -// ----------------------------------------------------------------------- - -SvxMultiFileDialog::~SvxMultiFileDialog() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx deleted file mode 100644 index 025d6d31e..000000000 --- a/cui/source/dialogs/multipat.cxx +++ /dev/null @@ -1,363 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include - -#include "multipat.hxx" -#include - -#include "multipat.hrc" -#include -#include -#include -#include -#include - -#include -#include - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - -// struct MultiPath_Impl ------------------------------------------------- - -struct MultiPath_Impl -{ - sal_Bool bEmptyAllowed; - sal_Bool bIsClassPathMode; - bool bIsRadioButtonMode; - - MultiPath_Impl( sal_Bool bAllowed ) : - bEmptyAllowed( bAllowed ), bIsClassPathMode( sal_False ), bIsRadioButtonMode( false ) {} -}; - -// class SvxMultiPathDialog ---------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, SelectHdl_Impl, void *, EMPTYARG ) -{ - sal_uLong nCount = pImpl->bIsRadioButtonMode ? aRadioLB.GetEntryCount() : aPathLB.GetEntryCount(); - bool bIsSelected = pImpl->bIsRadioButtonMode - ? aRadioLB.FirstSelected() != NULL - : aPathLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND; - sal_Bool bEnable = ( pImpl->bEmptyAllowed || nCount > 1 ); - aDelBtn.Enable( bEnable && bIsSelected ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, CheckHdl_Impl, svx::SvxRadioButtonListBox *, pBox ) -{ - SvLBoxEntry* pEntry = - pBox ? pBox->GetEntry( pBox->GetCurMousePoint() ) : aRadioLB.FirstSelected(); - if ( pEntry ) - aRadioLB.HandleEntryChecked( pEntry ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, AddHdl_Impl, PushButton *, EMPTYARG ) -{ - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); - - if ( xFolderPicker->execute() == ExecutableDialogResults::OK ) - { - INetURLObject aPath( xFolderPicker->getDirectory() ); - aPath.removeFinalSlash(); - String aURL = aPath.GetMainURL( INetURLObject::NO_DECODE ); - String sInsPath; - ::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, sInsPath ); - - if ( pImpl->bIsRadioButtonMode ) - { - sal_uLong nPos = aRadioLB.GetEntryPos( sInsPath, 1 ); - if ( 0xffffffff == nPos ) //See svtools/source/contnr/svtabbx.cxx SvTabListBox::GetEntryPos - { - String sNewEntry( '\t' ); - sNewEntry += sInsPath; - SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sNewEntry ); - String* pData = new String( aURL ); - pEntry->SetUserData( pData ); - } - else - { - String sMsg( CUI_RES( RID_MULTIPATH_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsPath ); - InfoBox( this, sMsg ).Execute(); - } - } - else - { - if ( LISTBOX_ENTRY_NOTFOUND != aPathLB.GetEntryPos( sInsPath ) ) - { - String sMsg( CUI_RES( RID_MULTIPATH_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sInsPath ); - InfoBox( this, sMsg ).Execute(); - } - else - { - sal_uInt16 nPos = aPathLB.InsertEntry( sInsPath, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*)new String( aURL ) ); - } - } - SelectHdl_Impl( NULL ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxMultiPathDialog, DelHdl_Impl, PushButton *, EMPTYARG ) -{ - if ( pImpl->bIsRadioButtonMode ) - { - SvLBoxEntry* pEntry = aRadioLB.FirstSelected(); - delete (String*)pEntry->GetUserData(); - bool bChecked = aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED; - sal_uLong nPos = aRadioLB.GetEntryPos( pEntry ); - aRadioLB.RemoveEntry( pEntry ); - sal_uLong nCnt = aRadioLB.GetEntryCount(); - if ( nCnt ) - { - nCnt--; - if ( nPos > nCnt ) - nPos = nCnt; - pEntry = aRadioLB.GetEntry( nPos ); - if ( bChecked ) - { - aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - aRadioLB.HandleEntryChecked( pEntry ); - } - else - aRadioLB.Select( pEntry ); - } - } - else - { - sal_uInt16 nPos = aPathLB.GetSelectEntryPos(); - aPathLB.RemoveEntry( nPos ); - sal_uInt16 nCnt = aPathLB.GetEntryCount(); - - if ( nCnt ) - { - nCnt--; - - if ( nPos > nCnt ) - nPos = nCnt; - aPathLB.SelectEntryPos( nPos ); - } - } - SelectHdl_Impl( NULL ); - return 0; -} - -// ----------------------------------------------------------------------- - -SvxMultiPathDialog::SvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_MULTIPATH ) ), - - aPathFL ( this, CUI_RES( FL_MULTIPATH) ), - aPathLB ( this, CUI_RES( LB_MULTIPATH ) ), - m_aRadioLBContainer(this, CUI_RES(LB_RADIOBUTTON)), - aRadioLB(m_aRadioLBContainer), - aRadioFT ( this, CUI_RES( FT_RADIOBUTTON ) ), - aAddBtn ( this, CUI_RES( BTN_ADD_MULTIPATH ) ), - aDelBtn ( this, CUI_RES( BTN_DEL_MULTIPATH ) ), - aOKBtn ( this, CUI_RES( BTN_MULTIPATH_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_MULTIPATH_CANCEL ) ), - aHelpButton ( this, CUI_RES( BTN_MULTIPATH_HELP ) ), - pImpl ( new MultiPath_Impl( bEmptyAllowed ) ) - -{ - static long aStaticTabs[]= { 2, 0, 12 }; - aRadioLB.SvxSimpleTable::SetTabs( aStaticTabs ); - String sHeader( CUI_RES( STR_HEADER_PATHS ) ); - aRadioLB.SetQuickHelpText( sHeader ); - sHeader.Insert( '\t', 0 ); - aRadioLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT ); - - FreeResource(); - - aPathLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) ); - aRadioLB.SetSelectHdl( LINK( this, SvxMultiPathDialog, SelectHdl_Impl ) ); - aRadioLB.SetCheckButtonHdl( LINK( this, SvxMultiPathDialog, CheckHdl_Impl ) ); - aAddBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, AddHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this, SvxMultiPathDialog, DelHdl_Impl ) ); - - SelectHdl_Impl( NULL ); - - aAddBtn.SetAccessibleRelationMemberOf(&aPathLB); - aDelBtn.SetAccessibleRelationMemberOf(&aPathLB); -} - -// ----------------------------------------------------------------------- - -SvxMultiPathDialog::~SvxMultiPathDialog() -{ - sal_uInt16 nPos = aPathLB.GetEntryCount(); - while ( nPos-- ) - delete (String*)aPathLB.GetEntryData(nPos); - nPos = (sal_uInt16)aRadioLB.GetEntryCount(); - while ( nPos-- ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry( nPos ); - delete (String*)pEntry->GetUserData(); - } - delete pImpl; -} - -// ----------------------------------------------------------------------- - -String SvxMultiPathDialog::GetPath() const -{ - String sNewPath; - sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER; - - if ( pImpl->bIsRadioButtonMode ) - { - String sWritable; - for ( sal_uInt16 i = 0; i < aRadioLB.GetEntryCount(); ++i ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry(i); - if ( aRadioLB.GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) - sWritable = *(String*)pEntry->GetUserData(); - else - { - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += *(String*)pEntry->GetUserData(); - } - } - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += sWritable; - } - else - { - for ( sal_uInt16 i = 0; i < aPathLB.GetEntryCount(); ++i ) - { - if ( sNewPath.Len() > 0 ) - sNewPath += cDelim; - sNewPath += *(String*)aPathLB.GetEntryData(i); - } - } - return sNewPath; -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::SetPath( const String& rPath ) -{ - sal_Unicode cDelim = pImpl->bIsClassPathMode ? CLASSPATH_DELIMITER : SVT_SEARCHPATH_DELIMITER; - sal_uInt16 nPos, nCount = rPath.GetTokenCount( cDelim ); - - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - String sPath = rPath.GetToken( i, cDelim ); - String sSystemPath; - sal_Bool bIsSystemPath = - ::utl::LocalFileHelper::ConvertURLToSystemPath( sPath, sSystemPath ); - - if ( pImpl->bIsRadioButtonMode ) - { - String sEntry( '\t' ); - sEntry += (bIsSystemPath ? sSystemPath : sPath); - SvLBoxEntry* pEntry = aRadioLB.InsertEntry( sEntry ); - String* pURL = new String( sPath ); - pEntry->SetUserData( pURL ); - } - else - { - if ( bIsSystemPath ) - nPos = aPathLB.InsertEntry( sSystemPath, LISTBOX_APPEND ); - else - nPos = aPathLB.InsertEntry( sPath, LISTBOX_APPEND ); - aPathLB.SetEntryData( nPos, (void*)new String( sPath ) ); - } - } - - if ( pImpl->bIsRadioButtonMode && nCount > 0 ) - { - SvLBoxEntry* pEntry = aRadioLB.GetEntry( nCount - 1 ); - if ( pEntry ) - { - aRadioLB.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - aRadioLB.HandleEntryChecked( pEntry ); - } - } - - SelectHdl_Impl( NULL ); -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::SetClassPathMode() -{ - pImpl->bIsClassPathMode = sal_True; - SetText( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE )); - aPathFL.SetText( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxMultiPathDialog::IsClassPathMode() const -{ - return pImpl->bIsClassPathMode; -} - -// ----------------------------------------------------------------------- - -void SvxMultiPathDialog::EnableRadioButtonMode() -{ - pImpl->bIsRadioButtonMode = true; - - aPathFL.Hide(); - aPathLB.Hide(); - - aRadioLB.ShowTable(); - aRadioFT.Show(); - - Point aNewPos = aAddBtn.GetPosPixel(); - long nDelta = aNewPos.Y() - aRadioLB.GetPosPixel().Y(); - aNewPos.Y() -= nDelta; - aAddBtn.SetPosPixel( aNewPos ); - aNewPos = aDelBtn.GetPosPixel(); - aNewPos.Y() -= nDelta; - aDelBtn.SetPosPixel( aNewPos ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/multipat.hrc b/cui/source/dialogs/multipat.hrc deleted file mode 100644 index 8d9a19fbe..000000000 --- a/cui/source/dialogs/multipat.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_MULTIPAT_HRC -#define _SVX_MULTIPAT_HRC - -// defines --------------------------------------------------------------- - -#define FL_MULTIPATH 10 -#define LB_MULTIPATH 11 -#define LB_RADIOBUTTON 12 -#define FT_RADIOBUTTON 13 -#define BTN_ADD_MULTIPATH 14 -#define BTN_DEL_MULTIPATH 15 -#define BTN_MULTIPATH_OK 16 -#define BTN_MULTIPATH_CANCEL 17 -#define BTN_MULTIPATH_HELP 18 -#define STR_HEADER_PATHS 19 - -#endif - diff --git a/cui/source/dialogs/multipat.src b/cui/source/dialogs/multipat.src deleted file mode 100644 index ffcd7020a..000000000 --- a/cui/source/dialogs/multipat.src +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "multipat.hrc" -#include "helpid.hrc" -#include - -// RID_SVXDLG_MULTIPATH -------------------------------------------------- - -ModalDialog RID_SVXDLG_MULTIPATH -{ - HelpId = HID_MULTIPATH ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 120 ) ; - Text [ en-US ] = "Select Paths" ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedLine FL_MULTIPATH - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Paths" ; - }; - ListBox LB_MULTIPATH - { - HelpID = "cui:ListBox:RID_SVXDLG_MULTIPATH:LB_MULTIPATH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 189 , 80 ) ; - AutoHScroll = TRUE ; - }; - Control LB_RADIOBUTTON - { - HelpId = HID_OPTIONS_MULTIPATH_LIST ; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 195 , 77 ) ; - }; - FixedText FT_RADIOBUTTON - { - Hide = TRUE ; - NoLabel = TRUE ; - Pos = MAP_APPFONT ( 6 , 86 ); - Size = MAP_APPFONT ( 195 , 8 ); - Text [ en-US ] = "Mark the default path for new files."; - }; - PushButton BTN_ADD_MULTIPATH - { - HelpID = "cui:PushButton:RID_SVXDLG_MULTIPATH:BTN_ADD_MULTIPATH"; - Pos = MAP_APPFONT ( 204 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - }; - PushButton BTN_DEL_MULTIPATH - { - HelpID = "cui:PushButton:RID_SVXDLG_MULTIPATH:BTN_DEL_MULTIPATH"; - Pos = MAP_APPFONT ( 204 , 31 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - }; - OKButton BTN_MULTIPATH_OK - { - Pos = MAP_APPFONT ( 95 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton BTN_MULTIPATH_CANCEL - { - Pos = MAP_APPFONT ( 148 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_MULTIPATH_HELP - { - Pos = MAP_APPFONT ( 204 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String STR_HEADER_PATHS - { - Text [ en-US ] = "Path list" ; - }; -}; -String RID_MULTIPATH_DBL_ERR -{ - Text [ en-US ] = "The path %1 already exists." ; -}; -String RID_SVXSTR_FILE_TITLE -{ - Text [ en-US ] = "Select files" ; -}; -String RID_SVXSTR_FILE_HEADLINE -{ - Text [ en-US ] = "Files" ; -}; -String RID_SVXSTR_ARCHIVE_TITLE -{ - Text [ en-US ] = "Select Archives" ; -}; -String RID_SVXSTR_ARCHIVE_HEADLINE -{ - Text [ en-US ] = "Archives" ; -}; -String RID_SVXSTR_MULTIFILE_DBL_ERR -{ - Text [ en-US ] = "The file %1 already exists." ; -}; diff --git a/cui/source/dialogs/newtabledlg.cxx b/cui/source/dialogs/newtabledlg.cxx deleted file mode 100644 index b387b4f87..000000000 --- a/cui/source/dialogs/newtabledlg.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "cuires.hrc" -#include "dialmgr.hxx" -#include "newtabledlg.hxx" -#include "newtabledlg.hrc" - -SvxNewTableDialog::SvxNewTableDialog( Window* pParent ) -: ModalDialog( pParent, CUI_RES( RID_SVX_NEWTABLE_DLG ) ) -, maFtColumns( this, CUI_RES( FT_COLUMNS ) ) -, maNumColumns( this, CUI_RES( NF_COLUMNS ) ) -, maFtRows( this, CUI_RES( FT_ROWS ) ) -, maNumRows( this, CUI_RES( NF_ROWS ) ) -, maFlSep( this, CUI_RES( FL_SEP ) ) -, maHelpButton( this, CUI_RES( BTN_HELP ) ) -, maOkButton( this, CUI_RES( BTN_OK ) ) -, maCancelButton( this, CUI_RES( BTN_CANCEL ) ) -{ - maNumRows.SetValue(2); - maNumColumns.SetValue(5); - FreeResource(); -} - -short SvxNewTableDialog::Execute(void) -{ - return ModalDialog::Execute(); -} - -void SvxNewTableDialog::Apply(void) -{ -} - -sal_Int32 SvxNewTableDialog::getRows() const -{ - return sal::static_int_cast< sal_Int32 >( maNumRows.GetValue() ); -} - -sal_Int32 SvxNewTableDialog::getColumns() const -{ - return sal::static_int_cast< sal_Int32 >( maNumColumns.GetValue() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/newtabledlg.hrc b/cui/source/dialogs/newtabledlg.hrc deleted file mode 100644 index b75c16a86..000000000 --- a/cui/source/dialogs/newtabledlg.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FT_COLUMNS 1 -#define NF_COLUMNS 2 -#define FT_ROWS 3 -#define NF_ROWS 4 -#define FL_SEP 5 -#define BTN_HELP 6 -#define BTN_OK 7 -#define BTN_CANCEL 8 diff --git a/cui/source/dialogs/newtabledlg.src b/cui/source/dialogs/newtabledlg.src deleted file mode 100644 index fb87f2567..000000000 --- a/cui/source/dialogs/newtabledlg.src +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "newtabledlg.hrc" -#include "cuires.hrc" - -ModalDialog RID_SVX_NEWTABLE_DLG -{ - HelpID = "cui:ModalDialog:RID_SVX_NEWTABLE_DLG"; - OutputSize = TRUE; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 181 , 6+15+15+15+14+6 ) ; - Text [ en-US ] = "Insert Table" ; - - FixedText FT_COLUMNS - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Number of columns:" ; - }; - NumericField NF_COLUMNS - { - HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_COLUMNS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 6 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 75 ; - SpinSize = 1 ; - StrictFormat = TRUE ; - }; - FixedText FT_ROWS - { - Pos = MAP_APPFONT ( 6 , 8+15 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Number of rows:" ; - }; - NumericField NF_ROWS - { - HelpID = "cui:NumericField:RID_SVX_NEWTABLE_DLG:NF_ROWS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 80 , 6+15 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 75 ; - SpinSize = 1 ; - StrictFormat = TRUE ; - }; - FixedLine FL_SEP - { - Pos = MAP_APPFONT ( 0 , 6+15+15 ) ; - Size = MAP_APPFONT ( 181 , 12 ) ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 6 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 69 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 125 , 6+15+15+15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx deleted file mode 100644 index 1634739b0..000000000 --- a/cui/source/dialogs/passwdomdlg.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "passwdomdlg.hrc" -#include "passwdomdlg.hxx" - -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////// - -class PasswordReenterEdit_Impl : public Edit -{ - String m_aDefaultTxt; - - // disallow use of copy c-tor and assignment operator - PasswordReenterEdit_Impl( const PasswordReenterEdit_Impl & ); - PasswordReenterEdit_Impl & operator = ( const PasswordReenterEdit_Impl & ); - -public: - PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ); - virtual ~PasswordReenterEdit_Impl(); - - // Edit - virtual void Paint( const Rectangle& rRect ); -}; - - -PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) : - Edit( pParent, rResId ) -{ -} - - -PasswordReenterEdit_Impl::~PasswordReenterEdit_Impl() -{ -} - - -void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect ) -{ - if (GetText().Len() == 0) - { - Push( PUSH_TEXTCOLOR ); - SetTextColor( Color( COL_GRAY ) ); - DrawText( Point(), m_aDefaultTxt ); - - Pop(); - } - else - Edit::Paint( rRect ); -} - - -////////////////////////////////////////////////////////////////////// - -struct PasswordToOpenModifyDialog_Impl -{ - PasswordToOpenModifyDialog * m_pParent; - - FixedLine m_aFileEncryptionFL; - FixedText m_aPasswdToOpenFT; - Edit m_aPasswdToOpenED; - FixedText m_aReenterPasswdToOpenFT; - PasswordReenterEdit_Impl m_aReenterPasswdToOpenED; - FixedText m_aPasswdNoteFT; - FixedLine m_aButtonsFL; - MoreButton m_aMoreFewerOptionsBTN; - OKButton m_aOk; - CancelButton m_aCancel; - FixedLine m_aFileSharingOptionsFL; - CheckBox m_aOpenReadonlyCB; - FixedText m_aPasswdToModifyFT; - Edit m_aPasswdToModifyED; - FixedText m_aReenterPasswdToModifyFT; - PasswordReenterEdit_Impl m_aReenterPasswdToModifyED; - - String m_aOneMismatch; - String m_aTwoMismatch; - String m_aInvalidStateForOkButton; - String m_aInvalidStateForOkButton_v2; - - bool m_bIsPasswordToModify; - - - DECL_LINK( OkBtnClickHdl, OKButton * ); - - PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent, - sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); - ~PasswordToOpenModifyDialog_Impl(); -}; - - -PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( - PasswordToOpenModifyDialog * pParent, - sal_uInt16 nMinPasswdLen, - sal_uInt16 nMaxPasswdLen, - bool bIsPasswordToModify ) : - m_pParent( pParent ), - m_aFileEncryptionFL ( pParent, CUI_RES( FL_FILE_ENCRYPTION ) ), - m_aPasswdToOpenFT ( pParent, CUI_RES( FT_PASSWD_TO_OPEN ) ), - m_aPasswdToOpenED ( pParent, CUI_RES( ED_PASSWD_TO_OPEN ) ), - m_aReenterPasswdToOpenFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_OPEN ) ), - m_aReenterPasswdToOpenED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_OPEN ) ), - m_aPasswdNoteFT ( pParent, CUI_RES( FT_PASSWD_NOTE ) ), - m_aButtonsFL ( pParent, CUI_RES( FL_BUTTONS ) ), - m_aMoreFewerOptionsBTN ( pParent, CUI_RES( BTN_MORE_FEWER_OPTIONS ) ), - m_aOk ( pParent, CUI_RES( BTN_OK ) ), - m_aCancel ( pParent, CUI_RES( BTN_CANCEL ) ), - m_aFileSharingOptionsFL ( pParent, CUI_RES( FL_FILE_SHARING_OPTIONS ) ), - m_aOpenReadonlyCB ( pParent, CUI_RES( CB_OPEN_READONLY ) ), - m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ), - m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ), - m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ), - m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ), - m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ), - m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ), - m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ), - m_aInvalidStateForOkButton_v2( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON_V2 ) ), - m_bIsPasswordToModify( bIsPasswordToModify ) -{ - m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) ); - m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) ); - - m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) ); - - if (nMaxPasswdLen) - { - m_aPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); - m_aReenterPasswdToOpenED.SetMaxTextLen( nMaxPasswdLen ); - m_aPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); - m_aReenterPasswdToModifyED.SetMaxTextLen( nMaxPasswdLen ); - } - - (void) nMinPasswdLen; // currently not supported - - m_aPasswdToOpenED.GrabFocus(); - - m_aMoreFewerOptionsBTN.Enable( bIsPasswordToModify ); - if (!bIsPasswordToModify) - m_aMoreFewerOptionsBTN.Hide( sal_True ); -} - - -PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl() -{ -} - -IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ ) -{ - bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() && - m_aPasswdToOpenED.GetText().Len() == 0 && - m_aPasswdToModifyED.GetText().Len() == 0; - if (bInvalidState) - { - ErrorBox aErrorBox( m_pParent, WB_OK, - m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2 ); - aErrorBox.Execute(); - } - else // check for mismatched passwords... - { - const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); - const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); - const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); - if (nMismatch > 0) - { - ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch ); - aErrorBox.Execute(); - - Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED; - PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED; - String aEmpty; - if (nMismatch == 1) - { - rEdit.SetText( aEmpty ); - rRepeatEdit.SetText( aEmpty ); - } - else if (nMismatch == 2) - { - m_aPasswdToOpenED.SetText( aEmpty ); - m_aReenterPasswdToOpenED.SetText( aEmpty ); - m_aPasswdToModifyED.SetText( aEmpty ); - m_aReenterPasswdToModifyED.SetText( aEmpty ); - } - rEdit.GrabFocus(); - } - else - { - m_pParent->EndDialog( RET_OK ); - } - } - - return 0; -} - -////////////////////////////////////////////////////////////////////// - - -PasswordToOpenModifyDialog::PasswordToOpenModifyDialog( - Window * pParent, - sal_uInt16 nMinPasswdLen, - sal_uInt16 nMaxPasswdLen, - bool bIsPasswordToModify ) : - SfxModalDialog( pParent, CUI_RES( RID_DLG_PASSWORD_TO_OPEN_MODIFY ) ) -{ - m_pImpl = std::auto_ptr< PasswordToOpenModifyDialog_Impl >( - new PasswordToOpenModifyDialog_Impl( this, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ) ); - - FreeResource(); -} - - -PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog() -{ -} - - -String PasswordToOpenModifyDialog::GetPasswordToOpen() const -{ - const bool bPasswdOk = - m_pImpl->m_aPasswdToOpenED.GetText().Len() > 0 && - m_pImpl->m_aPasswdToOpenED.GetText() == m_pImpl->m_aReenterPasswdToOpenED.GetText(); - return bPasswdOk ? m_pImpl->m_aPasswdToOpenED.GetText() : String(); -} - - -String PasswordToOpenModifyDialog::GetPasswordToModify() const -{ - const bool bPasswdOk = - m_pImpl->m_aPasswdToModifyED.GetText().Len() > 0 && - m_pImpl->m_aPasswdToModifyED.GetText() == m_pImpl->m_aReenterPasswdToModifyED.GetText(); - return bPasswdOk ? m_pImpl->m_aPasswdToModifyED.GetText() : String(); -} - - -bool PasswordToOpenModifyDialog::IsRecommendToOpenReadonly() const -{ - return m_pImpl->m_aOpenReadonlyCB.IsChecked(); -} - - -////////////////////////////////////////////////////////////////////// - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc deleted file mode 100755 index bdbbcdc5a..000000000 --- a/cui/source/dialogs/passwdomdlg.hrc +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_PASSWDOMDLG_HRC_ -#define _CUI_PASSWDOMDLG_HRC_ - -#define FL_FILE_ENCRYPTION 10 -#define FT_PASSWD_TO_OPEN 11 -#define ED_PASSWD_TO_OPEN 12 -#define FT_REENTER_PASSWD_TO_OPEN 13 -#define ED_REENTER_PASSWD_TO_OPEN 14 -#define IMG_PASSWD_MATCH 15 -#define IMG_PASSWD_MATCH_HC 16 -#define FT_PASSWD_NOTE 17 -#define FL_BUTTONS 18 -#define BTN_MORE_FEWER_OPTIONS 19 -#define BTN_OK 20 -#define BTN_CANCEL 21 -#define FL_FILE_SHARING_OPTIONS 22 -#define FT_PASSWD_TO_MODIFY 23 -#define ED_PASSWD_TO_MODIFY 24 -#define FT_REENTER_PASSWD_TO_MODIFY 25 -#define ED_REENTER_PASSWD_TO_MODIFY 26 -#define FI_PASSWD_TO_OPEN_MATCH 27 -#define FI_PASSWD_TO_MODIFY_MATCH 28 -#define CB_OPEN_READONLY 29 - -#define STR_MORE_OPTIONS 51 -#define STR_FEWER_OPTIONS 52 -#define STR_PASSWD_MUST_BE_CONFIRMED 53 -#define STR_ONE_PASSWORD_MISMATCH 54 -#define STR_TWO_PASSWORDS_MISMATCH 55 -#define STR_INVALID_STATE_FOR_OK_BUTTON 56 -#define STR_INVALID_STATE_FOR_OK_BUTTON_V2 57 - -#endif diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src deleted file mode 100644 index 532284f7b..000000000 --- a/cui/source/dialogs/passwdomdlg.src +++ /dev/null @@ -1,203 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include -#include "passwdomdlg.hrc" -#include "helpid.hrc" - - -ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY -{ - Size = MAP_APPFONT( 171, 150 ); - Text [ en-US ] = "Set Password"; - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY; - Border = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - - FixedLine FL_FILE_ENCRYPTION - { - Pos = MAP_APPFONT( 3, 3 ); - Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File encryption password"; - }; - - FixedText FT_PASSWD_TO_OPEN - { - Pos = MAP_APPFONT( 6, 17 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "~Enter password to open"; - WordBreak = TRUE; - }; - - Edit ED_PASSWD_TO_OPEN - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN; - Pos = MAP_APPFONT( 6, 28 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_REENTER_PASSWD_TO_OPEN - { - Pos = MAP_APPFONT( 6, 45 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Confirm password"; - WordBreak = TRUE; - }; - - Edit ED_REENTER_PASSWD_TO_OPEN - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN; - Pos = MAP_APPFONT( 6, 56 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_PASSWD_NOTE - { - Pos = MAP_APPFONT( 6, 80 ); - Size = MAP_APPFONT( 159, 4*8 ); // some extra space for translation in other languages - Text [ en-US ] = "Note: After a password has been set, the document will only open with "\ - "the password. Should you lose the password, there will be no way to "\ - "recover the document. Please also note that this password is case-sensitive."; - WordBreak = TRUE; - }; - - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT( 0, 117 ); - Size = MAP_APPFONT( 171, 8 ); - }; - - MoreButton BTN_MORE_FEWER_OPTIONS - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE; - Pos = MAP_APPFONT( 6 , 130 ) ; - Size = MAP_APPFONT( 50 , 14 ) ; - Delta = 92 ; - MapUnit = MAP_APPFONT ; - State = FALSE ; - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT( 62, 130 ); - Size = MAP_APPFONT( 50, 14 ); - DefButton = TRUE ; - }; - - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT( 115, 130 ); - Size = MAP_APPFONT( 50, 14 ); - }; - - FixedLine FL_FILE_SHARING_OPTIONS - { - Pos = MAP_APPFONT( 3, 154 ); - Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File sharing password"; - }; - - CheckBox CB_OPEN_READONLY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY; - Pos = MAP_APPFONT( 6, 170 ); - Size = MAP_APPFONT( 159, 8 ); - - Text [ en-US ] = "Open file read-only"; - }; - - FixedText FT_PASSWD_TO_MODIFY - { - Pos = MAP_APPFONT( 6, 186 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Enter password to allow editing"; - WordBreak = TRUE; - }; - - Edit ED_PASSWD_TO_MODIFY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY; - Pos = MAP_APPFONT( 6, 196 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - FixedText FT_REENTER_PASSWD_TO_MODIFY - { - Pos = MAP_APPFONT( 6, 214 ); - Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Confirm password"; - WordBreak = TRUE; - }; - - Edit ED_REENTER_PASSWD_TO_MODIFY - { - HelpId = HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY; - Pos = MAP_APPFONT( 6, 224 ); - Size = MAP_APPFONT( 159, 12 ); - Border = TRUE ; - PassWord = TRUE ; - }; - - String STR_PASSWD_MUST_BE_CONFIRMED - { - Text [ en-US ] = "Password must be confirmed" ; - }; - - String STR_MORE_OPTIONS - { - Text [ en-US ] = "More ~Options" ; - }; - - String STR_FEWER_OPTIONS - { - Text [ en-US ] = "Fewer ~Options" ; - }; - - String STR_ONE_PASSWORD_MISMATCH - { - Text [ en-US ] = "The confirmation password did not match the password. Set the password again by entering the same password in both boxes." ; - }; - - String STR_TWO_PASSWORDS_MISMATCH - { - Text [ en-US ] = "The confirmation passwords did not match the original passwords. Set the passwords again." ; - }; - - String STR_INVALID_STATE_FOR_OK_BUTTON - { - Text [ en-US ] = "Please enter a password to open or to modify, or check the open read-only option to continue." ; - }; -}; diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx deleted file mode 100644 index c96c3f6ec..000000000 --- a/cui/source/dialogs/pastedlg.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "svuidlg.hrc" -#include -#include -#include -#include - -#include - -SvPasteObjectDialog::SvPasteObjectDialog( Window* pParent ) - - : ModalDialog( pParent, CUI_RES( MD_PASTE_OBJECT ) ), - aFtSource( this, CUI_RES( FT_SOURCE ) ), - aFtObjectSource( this, CUI_RES( FT_OBJECT_SOURCE ) ), - aRbPaste( this, CUI_RES( RB_PASTE ) ), - aRbPasteLink( this, CUI_RES( RB_PASTE_LINK ) ), - aCbDisplayAsIcon( this, CUI_RES( CB_DISPLAY_AS_ICON ) ), - aPbChangeIcon( this, CUI_RES( PB_CHANGE_ICON ) ), - aFlChoice( this, CUI_RES( FL_CHOICE ) ), - aLbInsertList( this, CUI_RES( LB_INSERT_LIST ) ), - aOKButton1( this, CUI_RES( 1 ) ), - aCancelButton1( this, CUI_RES( 1 ) ), - aHelpButton1( this, CUI_RES( 1 ) ), - aSObject( CUI_RES( S_OBJECT ) ) -{ - FreeResource(); - SetHelpId( HID_PASTE_DLG ); - SetUniqueId( HID_PASTE_DLG ); - - Font aFont = aFtObjectSource.GetFont(); - aFont.SetWeight( WEIGHT_LIGHT ); - aFtObjectSource.SetFont( aFont ); - aOKButton1.Disable(); - - ObjectLB().SetSelectHdl( LINK( this, SvPasteObjectDialog, SelectHdl ) ); - ObjectLB().SetDoubleClickHdl( LINK( this, SvPasteObjectDialog, DoubleClickHdl ) ); - SetDefault(); - - aLbInsertList.SetAccessibleName(aFlChoice.GetText()); -} - -void SvPasteObjectDialog::SelectObject() -{ - if ( aLbInsertList.GetEntryCount() && - !aRbPaste.IsVisible() && !aRbPasteLink.IsVisible() ) - { - aLbInsertList.SelectEntryPos(0); - SelectHdl( &aLbInsertList ); - } -} - -IMPL_LINK( SvPasteObjectDialog, SelectHdl, ListBox *, pListBox ) -{ - (void)pListBox; - - if ( !aOKButton1.IsEnabled() ) - aOKButton1.Enable(); - return 0; -} - -IMPL_LINK_INLINE_START( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox ) -{ - (void)pListBox; - - EndDialog( RET_OK ); - return 0; -} -IMPL_LINK_INLINE_END( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox ) - -void SvPasteObjectDialog::SetDefault() -{ - bLink = sal_False; - nAspect = (sal_uInt16)::com::sun::star::embed::Aspects::MSOLE_CONTENT; -} - -SvPasteObjectDialog::~SvPasteObjectDialog() -{ - void * pStr = aSupplementTable.First(); - while( pStr ) - { - delete (String *)pStr; - pStr = aSupplementTable.Next(); - } -} - -/************************************************************************* -|* SvPasteObjectDialog::Insert() -*************************************************************************/ -void SvPasteObjectDialog::Insert( SotFormatStringId nFormat, const String& rFormatName ) -{ - String * pStr = new String( rFormatName ); - if( !aSupplementTable.Insert( nFormat, pStr ) ) - delete pStr; -} - -sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper, - const DataFlavorExVector* pFormats, - const TransferableObjectDescriptor* ) -{ - //TODO/LATER: why is the Descriptor never used?! - TransferableObjectDescriptor aDesc; - if( rHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) ) - ((TransferableDataHelper&)rHelper).GetTransferableObjectDescriptor( - SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc ); - if ( !pFormats ) - pFormats = &rHelper.GetDataFlavorExVector(); - - //Dialogbox erzeugen und fuellen - String aSourceName, aTypeName; - sal_uLong nSelFormat = 0; - SvGlobalName aEmptyNm; - - ObjectLB().SetUpdateMode( sal_False ); - - DataFlavorExVector::iterator aIter( ((DataFlavorExVector&)*pFormats).begin() ), - aEnd( ((DataFlavorExVector&)*pFormats).end() ); - while( aIter != aEnd ) - { - ::com::sun::star::datatransfer::DataFlavor aFlavor( *aIter ); - SotFormatStringId nFormat = (*aIter++).mnSotId; - - String* pName = (String*) aSupplementTable.Get( nFormat ); - String aName; - - // if there is an "Embed Source" or and "Embedded Object" on the - // Clipboard we read the Description and the Source of this object - // from an accompanied "Object Descriptor" format on the clipboard - // Remember: these formats mostly appear together on the clipboard - if ( !pName ) - { - SvPasteObjectHelper::GetEmbeddedName(rHelper,aName,aSourceName,nFormat); - if ( aName.Len() ) - pName = &aName; - } - - - if( pName ) - { - aName = *pName; - - if( SOT_FORMATSTR_ID_EMBED_SOURCE == nFormat ) - { - if( aDesc.maClassName != aEmptyNm ) { - aSourceName = aDesc.maDisplayName; - - if( aDesc.maClassName == aObjClassName ) - aName = aObjName; - else - aName = aTypeName = aDesc.maTypeName; - } - } - else if( SOT_FORMATSTR_ID_LINK_SOURCE == nFormat ) - { - PasteLink().Enable(); - continue; - } - else if( !aName.Len() ) - aName = SvPasteObjectHelper::GetSotFormatUIName( nFormat ); - - if( LISTBOX_ENTRY_NOTFOUND == ObjectLB().GetEntryPos( aName ) ) - ObjectLB().SetEntryData( - ObjectLB().InsertEntry( aName ), (void*) nFormat ); - } - } - - if( !aTypeName.Len() && !aSourceName.Len() ) - { - if( aDesc.maClassName != aEmptyNm ) - { - aSourceName = aDesc.maDisplayName; - aTypeName = aDesc.maTypeName; - } - - if( !aTypeName.Len() && !aSourceName.Len() ) - { - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); - ResMgr* pMgr = ResMgr::CreateResMgr( "svt", aLocale ); - // global resource from svtools (former so3 resource) - if( pMgr ) - aSourceName = String( ResId( STR_UNKNOWN_SOURCE, *pMgr ) ); - delete pMgr; - } - } - - ObjectLB().SetUpdateMode( sal_True ); - SelectObject(); - - if( aSourceName.Len() ) - { - if( aTypeName.Len() ) - aTypeName += '\n'; - - aTypeName += aSourceName; - aTypeName.ConvertLineEnd(); - } - - ObjectSource().SetText( aTypeName ); - - SetDefault(); - - if( Dialog::Execute() == RET_OK ) - { - bLink = PasteLink().IsChecked(); - - if( AsIconBox().IsChecked() ) - nAspect = (sal_uInt16)com::sun::star::embed::Aspects::MSOLE_ICON; - - nSelFormat = (sal_uLong)ObjectLB().GetEntryData( ObjectLB().GetSelectEntryPos() ); - } - - return nSelFormat; -} - -void SvPasteObjectDialog::SetObjName( const SvGlobalName & rClass, const String & rObjName ) -{ - aObjClassName = rClass; - aObjName = rObjName; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/plfilter.cxx b/cui/source/dialogs/plfilter.cxx deleted file mode 100644 index 407a0c29d..000000000 --- a/cui/source/dialogs/plfilter.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include -#include - -#include -#include -#include - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::plugin; - -struct ltstr -{ - bool operator()( const String& s1, const String& s2 ) const - { - return ( s1.CompareTo( s2 ) == COMPARE_LESS ); - } -}; - -typedef set< String, ltstr > StrSet; -typedef map< String, StrSet, ltstr > FilterMap; - - -//================================================================================================== -void fillNetscapePluginFilters( Sequence< rtl::OUString >& rPluginNames, Sequence< rtl::OUString >& rPluginTypes ) -{ - Reference< XMultiServiceFactory > xMan( ::utl::getProcessServiceFactory() ); - Reference< XPluginManager > xPMgr( xMan->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginManager") ) ), UNO_QUERY ); - - if ( xPMgr.is() ) - { - FilterMap aMap; - - // mimetypes zusammenfassen: eine description, mehrere extensions - - Sequence aDescriptions( xPMgr->getPluginDescriptions() ); - const PluginDescription * pDescriptions = aDescriptions.getConstArray(); - for ( sal_uInt32 nPos = aDescriptions.getLength(); nPos--; ) - { - const PluginDescription & rDescr = pDescriptions[nPos]; - - StrSet& rTypes = aMap[ rDescr.Description ]; - String aExtension( rDescr.Extension ); - - for ( sal_uInt16 nCnt = aExtension.GetTokenCount( ';' ); nCnt--; ) - { - // no default plugins anymore - String aExt( aExtension.GetToken( nCnt, ';' ) ); - if ( aExt.CompareToAscii( "*.*" ) != COMPARE_EQUAL ) - rTypes.insert( aExt ); - } - } - - rPluginNames = Sequence< rtl::OUString >( aMap.size() ); - rPluginTypes = Sequence< rtl::OUString >( aMap.size() ); - rtl::OUString* pPluginNames = rPluginNames.getArray(); - rtl::OUString* pPluginTypes = rPluginTypes.getArray(); - int nIndex = 0; - for ( FilterMap::iterator iPos = aMap.begin(); iPos != aMap.end(); ++iPos ) - { - String aText( (*iPos).first ); - String aType; - StrSet& rTypes = (*iPos).second; - StrSet::iterator i = rTypes.begin(); - while ( i != rTypes.end() ) - { - aType += (*i); - ++i; - if ( i != rTypes.end() ) - aType += ';'; - } - - if ( aType.Len() ) - { - aText += String::CreateFromAscii( " (" ); - aText += aType; - aText += ')'; - pPluginNames[nIndex] = aText; - pPluginTypes[nIndex] = aType; - nIndex++; - } - } - rPluginNames.realloc( nIndex ); - rPluginTypes.realloc( nIndex ); - } - else - ShowServiceNotAvailableError( NULL, - String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.plugin.PluginManager" ) ), sal_True ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx deleted file mode 100644 index 7c152bcdd..000000000 --- a/cui/source/dialogs/postdlg.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // SID_ATTR_... -#include // RID_SVXDLG_POSTIT - -#define _SVX_POSTDLG_CXX - -#include -#include "postdlg.hrc" -#include -#include "postdlg.hxx" -#include - -#include "helpid.hrc" - -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_POSTIT_AUTHOR, - SID_ATTR_POSTIT_TEXT, - 0 -}; - -// class SvxPostItDialog ------------------------------------------------- - -SvxPostItDialog::SvxPostItDialog( Window* pParent, - const SfxItemSet& rCoreSet, - sal_Bool bPrevNext, - sal_Bool bRedline ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_POSTIT ) ), - - aPostItFL ( this, CUI_RES( FL_POSTIT ) ), - aLastEditLabelFT( this, CUI_RES( FT_LASTEDITLABEL ) ), - aLastEditFT ( this, CUI_RES( FT_LASTEDIT ) ), - aEditFT ( this, CUI_RES( FT_EDIT ) ), - aEditED ( this, CUI_RES( ED_EDIT ) ), - aAuthorFT ( this, CUI_RES( FT_AUTHOR) ), - aAuthorBtn ( this, CUI_RES( BTN_AUTHOR ) ), - aOKBtn ( this, CUI_RES( BTN_POST_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_POST_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_POST_HELP ) ), - aPrevBtn ( this, CUI_RES( BTN_PREV ) ), - aNextBtn ( this, CUI_RES( BTN_NEXT ) ), - - rSet ( rCoreSet ), - pOutSet ( 0 ) - -{ - if (bRedline) // HelpIDs fuer Redlining - { - SetHelpId(HID_REDLINING_DLG); - aEditED.SetHelpId(HID_REDLINING_EDIT); - aPrevBtn.SetHelpId(HID_REDLINING_PREV); - aNextBtn.SetHelpId(HID_REDLINING_NEXT); - } - - aPrevBtn.SetClickHdl( LINK( this, SvxPostItDialog, PrevHdl ) ); - aNextBtn.SetClickHdl( LINK( this, SvxPostItDialog, NextHdl ) ); - aAuthorBtn.SetClickHdl( LINK( this, SvxPostItDialog, Stamp ) ); - aOKBtn.SetClickHdl( LINK( this, SvxPostItDialog, OKHdl ) ); - - Font aFont( aEditED.GetFont() ); - aFont.SetWeight( WEIGHT_LIGHT ); - aEditED.SetFont( aFont ); - - sal_Bool bNew = sal_True; - sal_uInt16 nWhich = 0; - - if ( !bPrevNext ) - { - aPrevBtn.Hide(); - aNextBtn.Hide(); - } - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ); - String aAuthorStr, aDateStr, aTextStr; - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - bNew = sal_False; - const SvxPostItAuthorItem& rAuthor = - (const SvxPostItAuthorItem&)rSet.Get( nWhich ); - aAuthorStr = rAuthor.GetValue(); - } - else - aAuthorStr = SvtUserOptions().GetID(); - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ); - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - const SvxPostItDateItem& rDate = - (const SvxPostItDateItem&)rSet.Get( nWhich ); - aDateStr = rDate.GetValue(); - } - else - { - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - aDateStr = aLocaleWrapper.getDate( Date() ); - } - - nWhich = rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ); - - if ( rSet.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - const SvxPostItTextItem& rText = - (const SvxPostItTextItem&)rSet.Get( nWhich ); - aTextStr = rText.GetValue(); - } - - ShowLastAuthor(aAuthorStr, aDateStr); - aEditED.SetText( aTextStr.ConvertLineEnd() ); - - if ( !bNew ) - SetText( CUI_RESSTR( STR_NOTIZ_EDIT ) ); - else - // neu anlegen - SetText( CUI_RESSTR( STR_NOTIZ_INSERT ) ); - - FreeResource(); - - aEditED.SetAccessibleRelationLabeledBy(&aEditFT); - aEditED.SetAccessibleRelationMemberOf(&aPostItFL); - aAuthorBtn.SetAccessibleRelationMemberOf(&aPostItFL); -} - -// ----------------------------------------------------------------------- - -SvxPostItDialog::~SvxPostItDialog() -{ - delete pOutSet; - pOutSet = 0; -} - -// ----------------------------------------------------------------------- - -void SvxPostItDialog::ShowLastAuthor(const String& rAuthor, const String& rDate) -{ - String sTxt( rAuthor ); - sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - sTxt += rDate; - aLastEditFT.SetText( sTxt ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxPostItDialog::GetRanges() -{ - return pRanges; -} - -// ----------------------------------------------------------------------- - -void SvxPostItDialog::EnableTravel(sal_Bool bNext, sal_Bool bPrev) -{ - aPrevBtn.Enable(bPrev); - aNextBtn.Enable(bNext); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPostItDialog, PrevHdl, Button *, EMPTYARG ) -{ - aPrevHdlLink.Call( this ); - return 0; -} -IMPL_LINK_INLINE_END( SvxPostItDialog, PrevHdl, Button *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPostItDialog, NextHdl, Button *, EMPTYARG ) -{ - aNextHdlLink.Call( this ); - return 0; -} -IMPL_LINK_INLINE_END( SvxPostItDialog, NextHdl, Button *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPostItDialog, Stamp, Button *, EMPTYARG ) -{ - Date aDate; - Time aTime; - String aTmp( SvtUserOptions().GetID() ); - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - String aStr( aEditED.GetText() ); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) ); - - if ( aTmp.Len() > 0 ) - { - aStr += aTmp; - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - } - aStr += aLocaleWrapper.getDate(aDate); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); - aStr += aLocaleWrapper.getTime(aTime, sal_False, sal_False); - aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ----\n" ) ); - - - aEditED.SetText( aStr.ConvertLineEnd() ); - xub_StrLen nLen = aStr.Len(); - aEditED.GrabFocus(); - aEditED.SetSelection( Selection( nLen, nLen ) ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPostItDialog, OKHdl, Button *, EMPTYARG ) -{ - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - pOutSet = new SfxItemSet( rSet ); - pOutSet->Put( SvxPostItAuthorItem( SvtUserOptions().GetID(), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) ); - pOutSet->Put( SvxPostItDateItem( aLocaleWrapper.getDate( Date() ), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_DATE ) ) ); - pOutSet->Put( SvxPostItTextItem( aEditED.GetText(), - rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_TEXT ) ) ); - EndDialog( RET_OK ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/postdlg.hrc b/cui/source/dialogs/postdlg.hrc deleted file mode 100644 index e8d1ee737..000000000 --- a/cui/source/dialogs/postdlg.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_POSTDLG_HRC -#define _SVX_POSTDLG_HRC - -// defines ------------------------------------------------------------------ - -#define FT_LASTEDITLABEL 10 -#define FT_LASTEDIT 11 -#define FT_EDIT 12 -#define ED_EDIT 13 -#define FL_POSTIT 14 -#define BTN_PREV 15 -#define BTN_NEXT 16 -#define BTN_AUTHOR 17 -#define FT_AUTHOR 18 - -#define STR_NOTIZ_EDIT 20 -#define STR_NOTIZ_INSERT 21 - -#define BTN_POST_OK 30 -#define BTN_POST_CANCEL 31 -#define BTN_POST_HELP 32 - - -#endif diff --git a/cui/source/dialogs/postdlg.src b/cui/source/dialogs/postdlg.src deleted file mode 100644 index 4bfba6ec6..000000000 --- a/cui/source/dialogs/postdlg.src +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "postdlg.hrc" -#include "helpid.hrc" -#include // for RID_SVXDLG_POSTIT - - // RID_SVXDLG_POSTIT ----------------------------------------------------- -ModalDialog RID_SVXDLG_POSTIT -{ - HelpId = HID_POSTIT_DIALOG ; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 198 , 134 ) ; - Text [ en-US ] = "Note" ; - Moveable = TRUE ; - FixedText FT_LASTEDITLABEL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "Author" ; - Left = TRUE ; - }; - FixedText FT_LASTEDIT - { - Pos = MAP_APPFONT ( 48 , 14 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Left = TRUE ; - }; - FixedText FT_EDIT - { - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "~Text" ; - Left = TRUE ; - }; - MultiLineEdit ED_EDIT - { - HelpID = "cui:MultiLineEdit:RID_SVXDLG_POSTIT:ED_EDIT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 38 ) ; - Size = MAP_APPFONT ( 123 , 72 ) ; - Left = TRUE ; - VScroll = TRUE ; - HScroll = TRUE ; - IgnoreTab = TRUE ; - }; - FixedLine FL_POSTIT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 129 , 8 ) ; - Text [ en-US ] = "Contents" ; - }; - OKButton BTN_POST_OK - { - Pos = MAP_APPFONT ( 141 , 6 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_POST_CANCEL - { - Pos = MAP_APPFONT ( 141 , 23 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - HelpButton BTN_POST_HELP - { - Pos = MAP_APPFONT ( 141 , 40 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - ImageButton BTN_PREV - { - HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_PREV"; - Pos = MAP_APPFONT ( 141 , 60 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_LEFT ; - }; - ImageButton BTN_NEXT - { - HelpID = "cui:ImageButton:RID_SVXDLG_POSTIT:BTN_NEXT"; - Pos = MAP_APPFONT ( 167 , 60 ) ; - Size = MAP_APPFONT ( 24 , 14 ) ; - Symbol = IMAGEBUTTON_ARROW_RIGHT ; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT ( 12 , 116 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Insert"; - }; - PushButton BTN_AUTHOR - { - HelpID = "cui:PushButton:RID_SVXDLG_POSTIT:BTN_AUTHOR"; - Pos = MAP_APPFONT ( 75 , 114 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Author" ; - }; - // lokale Strings - String STR_NOTIZ_EDIT - { - Text [ en-US ] = "Edit Note" ; - }; - String STR_NOTIZ_INSERT - { - Text [ en-US ] = "Insert note" ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx deleted file mode 100644 index 182e5bb02..000000000 --- a/cui/source/dialogs/scriptdlg.cxx +++ /dev/null @@ -1,1575 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/********************************************************************** - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include -#include -#include -#include - -#include -#include "scriptdlg.hrc" -#include "scriptdlg.hxx" -#include -#include "selector.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::script; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; - -void ShowErrorDialog( const Any& aException ) -{ - SvxScriptErrorDialog* pDlg = new SvxScriptErrorDialog( NULL, aException ); - pDlg->Execute(); - delete pDlg; -} - -SFTreeListBox::SFTreeListBox( Window* pParent, const ResId& rResId ) : - SvTreeListBox( pParent, ResId( rResId.GetId(),*rResId.GetResMgr() ) ), - m_hdImage(ResId(IMG_HARDDISK,*rResId.GetResMgr())), - m_libImage(ResId(IMG_LIB,*rResId.GetResMgr())), - m_macImage(ResId(IMG_MACRO,*rResId.GetResMgr())), - m_docImage(ResId(IMG_DOCUMENT,*rResId.GetResMgr())), - m_sMyMacros(String(ResId(STR_MYMACROS,*rResId.GetResMgr()))), - m_sProdMacros(String(ResId(STR_PRODMACROS,*rResId.GetResMgr()))) -{ - FreeResource(); - SetSelectionMode( SINGLE_SELECTION ); - - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | - WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HIDESELECTION | - WB_HASLINES | WB_HASLINESATROOT ); - SetNodeDefaultImages(); - - nMode = 0xFF; // Alles -} - -SFTreeListBox::~SFTreeListBox() -{ - deleteAllTree(); -} - -void SFTreeListBox::delUserData( SvLBoxEntry* pEntry ) -{ - if ( pEntry ) - { - - String text = GetEntryText( pEntry ); - SFEntry* pUserData = (SFEntry*)pEntry->GetUserData(); - if ( pUserData ) - { - delete pUserData; - // TBD seem to get a Select event on node that is remove ( below ) - // so need to be able to detect that this node is not to be - // processed in order to do this, setting userData to NULL ( must - // be a better way to do this ) - pUserData = 0; - pEntry->SetUserData( pUserData ); - } - } -} - -void SFTreeListBox::deleteTree( SvLBoxEntry* pEntry ) -{ - - delUserData( pEntry ); - pEntry = FirstChild( pEntry ); - while ( pEntry ) - { - SvLBoxEntry* pNextEntry = NextSibling( pEntry ); - deleteTree( pEntry ); - GetModel()->Remove( pEntry ); - pEntry = pNextEntry; - } -} - -void SFTreeListBox::deleteAllTree() -{ - SvLBoxEntry* pEntry = GetEntry( 0 ); - - // TBD - below is a candidate for a destroyAllTrees method - if ( pEntry ) - { - while ( pEntry ) - { - String text = GetEntryText( pEntry ); - SvLBoxEntry* pNextEntry = NextSibling( pEntry ) ; - deleteTree( pEntry ); - GetModel()->Remove( pEntry ); - pEntry = pNextEntry; - } - } -} - -void SFTreeListBox::Init( const ::rtl::OUString& language ) -{ - SetUpdateMode( sal_False ); - - deleteAllTree(); - - Reference< browse::XBrowseNode > rootNode; - Reference< XComponentContext > xCtx; - - Sequence< Reference< browse::XBrowseNode > > children; - - ::rtl::OUString userStr( RTL_CONSTASCII_USTRINGPARAM("user") ); - ::rtl::OUString shareStr( RTL_CONSTASCII_USTRINGPARAM("share") ); - - ::rtl::OUString singleton( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.script.browse.theBrowseNodeFactory" ) ); - - try - { - Reference < beans::XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - - xCtx.set( xProps->getPropertyValue( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("DefaultContext" ))), UNO_QUERY_THROW ); - - Reference< browse::XBrowseNodeFactory > xFac( - xCtx->getValueByName( singleton ), UNO_QUERY_THROW ); - - rootNode.set( xFac->createView( - browse::BrowseNodeFactoryViewTypes::MACROORGANIZER ) ); - - if ( rootNode.is() && rootNode->hasChildNodes() == sal_True ) - { - children = rootNode->getChildNodes(); - } - } - catch( Exception& e ) - { - OSL_TRACE("Exception getting root browse node from factory: %s", - ::rtl::OUStringToOString( - e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - // TODO exception handling - } - - Reference xDocumentModel; - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - bool app = false; - ::rtl::OUString uiName = children[ n ]->getName(); - ::rtl::OUString factoryURL; - if ( uiName.equals( userStr ) || uiName.equals( shareStr ) ) - { - app = true; - if ( uiName.equals( userStr ) ) - { - uiName = m_sMyMacros; - } - else - { - uiName = m_sProdMacros; - } - } - else - { - xDocumentModel.set(getDocumentModel(xCtx, uiName ), UNO_QUERY); - - if ( xDocumentModel.is() ) - { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( xCtx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager") ), xCtx ), - UNO_QUERY_THROW ); - - Reference xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); - // get the long name of the document: - Sequence moduleDescr; - try{ - ::rtl::OUString appModule = xModuleManager->identify( xDocumentModel ); - xModuleConfig->getByName(appModule) >>= moduleDescr; - } catch(const uno::Exception&) - {} - - beans::PropertyValue const * pmoduleDescr = - moduleDescr.getConstArray(); - for ( sal_Int32 pos = moduleDescr.getLength(); pos--; ) - { - if (pmoduleDescr[ pos ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - "ooSetupFactoryEmptyDocumentURL") )) - { - pmoduleDescr[ pos ].Value >>= factoryURL; - break; - } - } - } - } - - ::rtl::OUString lang( language ); - Reference< browse::XBrowseNode > langEntries = - getLangNodeFromRootNode( children[ n ], lang ); - - insertEntry( uiName, app ? IMG_HARDDISK : IMG_DOCUMENT, - 0, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SFROOT, langEntries, xDocumentModel )), factoryURL ); - } - - SetUpdateMode( sal_True ); -} - -Reference< XInterface > -SFTreeListBox::getDocumentModel( Reference< XComponentContext >& xCtx, ::rtl::OUString& docName ) -{ - Reference< XInterface > xModel; - Reference< lang::XMultiComponentFactory > mcf = - xCtx->getServiceManager(); - Reference< frame::XDesktop > desktop ( - mcf->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ), xCtx ), - UNO_QUERY ); - - Reference< container::XEnumerationAccess > componentsAccess = - desktop->getComponents(); - Reference< container::XEnumeration > components = - componentsAccess->createEnumeration(); - while (components->hasMoreElements()) - { - Reference< frame::XModel > model( - components->nextElement(), UNO_QUERY ); - if ( model.is() ) - { - ::rtl::OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model ); - if( sTdocUrl.equals( docName ) ) - { - xModel = model; - break; - } - } - } - return xModel; -} - -Reference< browse::XBrowseNode > -SFTreeListBox::getLangNodeFromRootNode( Reference< browse::XBrowseNode >& rootNode, ::rtl::OUString& language ) -{ - Reference< browse::XBrowseNode > langNode; - - try - { - Sequence < Reference< browse::XBrowseNode > > children = rootNode->getChildNodes(); - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - if ( children[ n ]->getName().equals( language ) ) - { - langNode = children[ n ]; - break; - } - } - } - catch ( Exception& ) - { - // if getChildNodes() throws an exception we just return - // the empty Reference - } - return langNode; -} - -void SFTreeListBox:: RequestSubEntries( SvLBoxEntry* pRootEntry, Reference< ::com::sun::star::script::browse::XBrowseNode >& node, - Reference< XModel >& model ) -{ - if (! node.is() ) - { - return; - } - - Sequence< Reference< browse::XBrowseNode > > children; - try - { - children = node->getChildNodes(); - } - catch ( Exception& ) - { - // if we catch an exception in getChildNodes then no entries are added - } - - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - ::rtl::OUString name( children[ n ]->getName() ); - if ( children[ n ]->getType() != browse::BrowseNodeTypes::SCRIPT) - { - insertEntry( name, IMG_LIB, pRootEntry, true, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, children[ n ],model ))); - } - else - { - if ( children[ n ]->getType() == browse::BrowseNodeTypes::SCRIPT ) - { - insertEntry( name, IMG_MACRO, pRootEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, children[ n ],model ))); - - } - } - } -} - -long SFTreeListBox::ExpandingHdl() -{ - return sal_True; -} - -void SFTreeListBox::ExpandAllTrees() -{ -} - -SvLBoxEntry * SFTreeListBox::insertEntry( - String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent, - bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData, ::rtl::OUString factoryURL ) -{ - SvLBoxEntry * p; - if( nBitmap == IMG_DOCUMENT && factoryURL.getLength() > 0 ) - { - Image aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL), false ); - p = InsertEntry( - rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release()); // XXX possible leak - } - else - { - p = insertEntry( rText, nBitmap, pParent, bChildrenOnDemand, aUserData ); - } - return p; -} - -SvLBoxEntry * SFTreeListBox::insertEntry( - String const & rText, sal_uInt16 nBitmap, SvLBoxEntry * pParent, - bool bChildrenOnDemand, std::auto_ptr< SFEntry > aUserData ) -{ - Image aImage; - if( nBitmap == IMG_HARDDISK ) - { - aImage = m_hdImage; - } - else if( nBitmap == IMG_LIB ) - { - aImage = m_libImage; - } - else if( nBitmap == IMG_MACRO ) - { - aImage = m_macImage; - } - else if( nBitmap == IMG_DOCUMENT ) - { - aImage = m_docImage; - } - SvLBoxEntry * p = InsertEntry( - rText, aImage, aImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release()); // XXX possible leak - return p; -} - -void SFTreeListBox::RequestingChilds( SvLBoxEntry* pEntry ) -{ - SFEntry* userData = 0; - if ( !pEntry ) - { - return; - } - userData = (SFEntry*)pEntry->GetUserData(); - - Reference< browse::XBrowseNode > node; - Reference< XModel > model; - if ( userData && !userData->isLoaded() ) - { - node = userData->GetNode(); - model = userData->GetModel(); - RequestSubEntries( pEntry, node, model ); - userData->setLoaded(); - } -} - -void SFTreeListBox::ExpandedHdl() -{ -} - -// ---------------------------------------------------------------------------- -// InputDialog ------------------------------------------------------------ -// ---------------------------------------------------------------------------- -InputDialog::InputDialog(Window * pParent, sal_uInt16 nMode ) - : ModalDialog( pParent, CUI_RES( RID_DLG_NEWLIB ) ), - aText( this, CUI_RES( FT_NEWLIB ) ), - aEdit( this, CUI_RES( ED_LIBNAME ) ), - aOKButton( this, CUI_RES( PB_OK ) ), - aCancelButton( this, CUI_RES( PB_CANCEL ) ) -{ - aEdit.GrabFocus(); - if ( nMode == INPUTMODE_NEWLIB ) - { - SetText( String( CUI_RES( STR_NEWLIB ) ) ); - } - else if ( nMode == INPUTMODE_NEWMACRO ) - { - SetText( String( CUI_RES( STR_NEWMACRO ) ) ); - aText.SetText( String( CUI_RES( STR_FT_NEWMACRO ) ) ); - } - else if ( nMode == INPUTMODE_RENAME ) - { - SetText( String( CUI_RES( STR_RENAME ) ) ); - aText.SetText( String( CUI_RES( STR_FT_RENAME ) ) ); - } - FreeResource(); - - // some resizing so that the text fits - Point point, newPoint; - Size siz, newSiz; - long gap; - - sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | - TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK; - - // get dimensions of dialog instructions control - point = aText.GetPosPixel(); - siz = aText.GetSizePixel(); - - // get dimensions occupied by text in the control - Rectangle rect = - GetTextRect( Rectangle( point, siz ), aText.GetText(), style ); - newSiz = rect.GetSize(); - - // the gap is the difference between the text width and its control width - gap = siz.Height() - newSiz.Height(); - - //resize the text field - newSiz = Size( siz.Width(), siz.Height() - gap ); - aText.SetSizePixel( newSiz ); - - //move the OK & cancel buttons - point = aEdit.GetPosPixel(); - newPoint = Point( point.X(), point.Y() - gap ); - aEdit.SetPosPixel( newPoint ); - -} - -InputDialog::~InputDialog() -{ -} -// ---------------------------------------------------------------------------- -// ScriptOrgDialog ------------------------------------------------------------ -// ---------------------------------------------------------------------------- -SvxScriptOrgDialog::SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language ) - : SfxModalDialog( pParent, CUI_RES( RID_DLG_SCRIPTORGANIZER ) ), - aScriptsTxt( this, CUI_RES( SF_TXT_SCRIPTS ) ), - aScriptsBox( this, CUI_RES( SF_CTRL_SCRIPTSBOX ) ), - aRunButton( this, CUI_RES( SF_PB_RUN ) ), - aCloseButton( this, CUI_RES( SF_PB_CLOSE ) ), - aCreateButton( this, CUI_RES( SF_PB_CREATE ) ), - aEditButton( this, CUI_RES( SF_PB_EDIT ) ), - aRenameButton(this, CUI_RES( SF_PB_RENAME ) ), - aDelButton( this, CUI_RES( SF_PB_DEL ) ), - aHelpButton( this, CUI_RES( SF_PB_HELP ) ), - m_sLanguage( language ), - m_delErrStr( CUI_RES( RID_SVXSTR_DELFAILED ) ), - m_delErrTitleStr( CUI_RES( RID_SVXSTR_DELFAILED_TITLE ) ), - m_delQueryStr( CUI_RES( RID_SVXSTR_DELQUERY ) ), - m_delQueryTitleStr( CUI_RES( RID_SVXSTR_DELQUERY_TITLE ) ) , - m_createErrStr( CUI_RES ( RID_SVXSTR_CREATEFAILED ) ), - m_createDupStr( CUI_RES ( RID_SVXSTR_CREATEFAILEDDUP ) ), - m_createErrTitleStr( CUI_RES( RID_SVXSTR_CREATEFAILED_TITLE ) ), - m_renameErrStr( CUI_RES ( RID_SVXSTR_RENAMEFAILED ) ), - m_renameErrTitleStr( CUI_RES( RID_SVXSTR_RENAMEFAILED_TITLE ) ) -{ - - // must be a neater way to deal with the strings than as above - // append the language to the dialog title - String winTitle( GetText() ); - winTitle.SearchAndReplace( String::CreateFromAscii( "%MACROLANG" ), language.pData->buffer ); - SetText( winTitle ); - - aScriptsBox.SetSelectHdl( LINK( this, SvxScriptOrgDialog, ScriptSelectHdl ) ); - aRunButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aCloseButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aRenameButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aEditButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aDelButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - aCreateButton.SetClickHdl( LINK( this, SvxScriptOrgDialog, ButtonHdl ) ); - - aRunButton.Disable(); - aRenameButton.Disable(); - aEditButton.Disable(); - aDelButton.Disable(); - aCreateButton.Disable(); - - aScriptsBox.Init( m_sLanguage ); - RestorePreviousSelection(); - FreeResource(); -} - -SvxScriptOrgDialog::~SvxScriptOrgDialog() -{ - // clear the SelectHdl so that it isn't called during the dtor - aScriptsBox.SetSelectHdl( Link() ); -}; - -short SvxScriptOrgDialog::Execute() -{ - - SfxObjectShell *pDoc = SfxObjectShell::GetFirst(); - - // force load of MSPs for all documents - while ( pDoc ) - { - Reference< provider::XScriptProviderSupplier > xSPS = - Reference< provider::XScriptProviderSupplier > - ( pDoc->GetModel(), UNO_QUERY ); - if ( xSPS.is() ) - { - Reference< provider::XScriptProvider > ScriptProvider = - xSPS->getScriptProvider(); - } - - pDoc = SfxObjectShell::GetNext(*pDoc); - } - aScriptsBox.ExpandAllTrees(); - - Window* pPrevDlgParent = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - short nRet = ModalDialog::Execute(); - Application::SetDefDialogParent( pPrevDlgParent ); - return nRet; -} - -void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode >& node ) -{ - if ( node.is() ) - { - if ( node->getType() == browse::BrowseNodeTypes::SCRIPT) - { - aRunButton.Enable(); - } - else - { - aRunButton.Disable(); - } - Reference< beans::XPropertySet > xProps( node, UNO_QUERY ); - - if ( !xProps.is() ) - { - aEditButton.Disable(); - aDelButton.Disable(); - aCreateButton.Disable(); - aRunButton.Disable(); - return; - } - - ::rtl::OUString sName; - sName = String::CreateFromAscii("Editable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aEditButton.Enable(); - } - else - { - aEditButton.Disable(); - } - - sName = String::CreateFromAscii("Deletable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aDelButton.Enable(); - } - else - { - aDelButton.Disable(); - } - - sName = String::CreateFromAscii("Creatable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aCreateButton.Enable(); - } - else - { - aCreateButton.Disable(); - } - - sName = String::CreateFromAscii("Renamable") ; - - if ( getBoolProperty( xProps, sName ) ) - { - aRenameButton.Enable(); - } - else - { - aRenameButton.Disable(); - } - } - else - { - // no node info available, disable all configurable actions - aDelButton.Disable(); - aCreateButton.Disable(); - aEditButton.Disable(); - aRunButton.Disable(); - aRenameButton.Disable(); - } -} - -IMPL_LINK_INLINE_START( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) -{ - return 0; -} - -IMPL_LINK_INLINE_END( SvxScriptOrgDialog, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG ) - -IMPL_LINK( SvxScriptOrgDialog, ScriptSelectHdl, SvTreeListBox *, pBox ) -{ - if ( !pBox->IsSelected( pBox->GetHdlEntry() ) ) - { - return 0; - } - - SvLBoxEntry* pEntry = pBox->GetHdlEntry(); - - SFEntry* userData = 0; - if ( !pEntry ) - { - return 0; - } - userData = (SFEntry*)pEntry->GetUserData(); - - Reference< browse::XBrowseNode > node; - if ( userData ) - { - node = userData->GetNode(); - CheckButtons( node ); - } - - return 0; -} - -IMPL_LINK( SvxScriptOrgDialog, ButtonHdl, Button *, pButton ) -{ - if ( pButton == &aCloseButton ) - { - StoreCurrentSelection(); - EndDialog( 0 ); - } - if ( pButton == &aEditButton || - pButton == &aCreateButton || - pButton == &aDelButton || - pButton == &aRunButton || - pButton == &aRenameButton ) - - { - if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) ) - { - SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry(); - SFEntry* userData = 0; - if ( !pEntry ) - { - return 0; - } - userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - Reference< browse::XBrowseNode > node; - Reference< XModel > xModel; - - node = userData->GetNode(); - xModel = userData->GetModel(); - - if ( !node.is() ) - { - return 0; - } - - if ( pButton == &aRunButton ) - { - ::rtl::OUString tmpString; - Reference< beans::XPropertySet > xProp( node, UNO_QUERY ); - Reference< provider::XScriptProvider > mspNode; - if( !xProp.is() ) - { - return 0; - } - - if ( xModel.is() ) - { - Reference< XEmbeddedScripts > xEmbeddedScripts( xModel, UNO_QUERY); - if( !xEmbeddedScripts.is() ) - { - return 0; - } - - if (!xEmbeddedScripts->getAllowMacroExecution()) - { - // Please FIXME: Show a message box if AllowMacroExecution is false - return 0; - } - } - - - SvLBoxEntry* pParent = aScriptsBox.GetParent( pEntry ); - while ( pParent && !mspNode.is() ) - { - SFEntry* mspUserData = (SFEntry*)pParent->GetUserData(); - mspNode.set( mspUserData->GetNode() , UNO_QUERY ); - pParent = aScriptsBox.GetParent( pParent ); - } - xProp->getPropertyValue( String::CreateFromAscii("URI" ) ) >>= tmpString; - const String scriptURL( tmpString ); - - if ( mspNode.is() ) - { - try - { - Reference< provider::XScript > xScript( - mspNode->getScript( scriptURL ), UNO_QUERY_THROW ); - - const Sequence< Any > args(0); - Any aRet; - Sequence< sal_Int16 > outIndex; - Sequence< Any > outArgs( 0 ); - aRet = xScript->invoke( args, outIndex, outArgs ); - } - catch ( reflection::InvocationTargetException& ite ) - { - ::com::sun::star::uno::Any a = makeAny(ite); - ShowErrorDialog(a); - } - catch ( provider::ScriptFrameworkErrorException& ite ) - { - ::com::sun::star::uno::Any a = makeAny(ite); - ShowErrorDialog(a); - } - catch ( RuntimeException& re ) - { - ::com::sun::star::uno::Any a = makeAny(re); - ShowErrorDialog(a); - } - catch ( Exception& e ) - { - ::com::sun::star::uno::Any a = makeAny(e); - ShowErrorDialog(a); - } - } - StoreCurrentSelection(); - EndDialog( 0 ); - } - else if ( pButton == &aEditButton ) - { - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - if ( xInv.is() ) - { - StoreCurrentSelection(); - EndDialog( 0 ); - Sequence< Any > args(0); - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - // ISSUE need code to run script here - xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Editable" ) ), args, outIndex, outArgs ); - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to invoke %s", ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - - } - } - } - else if ( pButton == &aCreateButton ) - { - createEntry( pEntry ); - } - else if ( pButton == &aDelButton ) - { - deleteEntry( pEntry ); - } - else if ( pButton == &aRenameButton ) - { - renameEntry( pEntry ); - } - } - } - } - return 0; -} - -Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode( SvLBoxEntry* pEntry ) -{ - Reference< browse::XBrowseNode > node; - if ( pEntry ) - { - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - node = userData->GetNode(); - } - } - - return node; -} - -Reference< XModel > SvxScriptOrgDialog::getModel( SvLBoxEntry* pEntry ) -{ - Reference< XModel > model; - if ( pEntry ) - { - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData ) - { - model = userData->GetModel(); - } - } - - return model; -} - -void SvxScriptOrgDialog::createEntry( SvLBoxEntry* pEntry ) -{ - - Reference< browse::XBrowseNode > aChildNode; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - - if ( xInv.is() ) - { - ::rtl::OUString aNewName; - ::rtl::OUString aNewStdName; - sal_uInt16 nMode = INPUTMODE_NEWLIB; - if( aScriptsBox.GetModel()->GetDepth( pEntry ) == 0 ) - { - aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Library") ) ; - } - else - { - aNewStdName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Macro") ) ; - nMode = INPUTMODE_NEWMACRO; - } - //do we need L10N for this? ie somethng like: - //String aNewStdName( ResId( STR_STDMODULENAME ) ); - sal_Bool bValid = sal_False; - sal_uInt16 i = 1; - - Sequence< Reference< browse::XBrowseNode > > childNodes; - // no children => ok to create Parcel1 or Script1 without checking - try - { - if( node->hasChildNodes() == sal_False ) - { - aNewName = aNewStdName; - aNewName += String::CreateFromInt32( i ); - bValid = sal_True; - } - else - { - childNodes = node->getChildNodes(); - } - } - catch ( Exception& ) - { - // ignore, will continue on with empty sequence - } - - ::rtl::OUString extn; - while ( !bValid ) - { - aNewName = aNewStdName; - aNewName += String::CreateFromInt32( i ); - sal_Bool bFound = sal_False; - if(childNodes.getLength() > 0 ) - { - ::rtl::OUString nodeName = childNodes[0]->getName(); - sal_Int32 extnPos = nodeName.lastIndexOf( '.' ); - if(extnPos>0) - extn = nodeName.copy(extnPos); - } - for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) - { - if ( (aNewName+extn).equals( childNodes[index]->getName() ) ) - { - bFound = sal_True; - break; - } - } - if( bFound ) - { - i++; - } - else - { - bValid = sal_True; - } - } - - std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast(this), nMode ) ); - xNewDlg->SetObjectName( aNewName ); - - do - { - if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() ) - { - ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName(); - bValid = sal_True; - for( sal_Int32 index = 0; index < childNodes.getLength(); index++ ) - { - if ( (aUserSuppliedName+extn).equals( childNodes[index]->getName() ) ) - { - bValid = sal_False; - String aError( m_createErrStr ); - aError.Append( m_createDupStr ); - ErrorBox aErrorBox( static_cast(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_createErrTitleStr ); - aErrorBox.Execute(); - xNewDlg->SetObjectName( aNewName ); - break; - } - } - if( bValid ) - aNewName = aUserSuppliedName; - } - else - { - // user hit cancel or hit OK with nothing in the editbox - - return; - } - } - while ( !bValid ); - - // open up parent node (which ensures it's loaded) - aScriptsBox.RequestingChilds( pEntry ); - - Sequence< Any > args( 1 ); - args[ 0 ] <<= aNewName; - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Creatable") ), args, outIndex, outArgs ); - Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY ); - aChildNode = newNode; - - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to Create %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - if ( aChildNode.is() ) - { - String aChildName = aChildNode->getName(); - SvLBoxEntry* pNewEntry = NULL; - - - ::rtl::OUString name( aChildName ); - Reference xDocumentModel = getModel( pEntry ); - - // ISSUE do we need to remove all entries for parent - // to achieve sort? Just need to determine position - // SvTreeListBox::InsertEntry can take position arg - // -- Basic doesn't do this on create. - // Suppose we could avoid this too. -> created nodes are - // not in alphabetical order - if ( aChildNode->getType() == browse::BrowseNodeTypes::SCRIPT ) - { - pNewEntry = aScriptsBox.insertEntry( aChildName, - IMG_MACRO, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_METHOD, aChildNode,xDocumentModel ) ) ); - - } - else - { - pNewEntry = aScriptsBox.insertEntry( aChildName, - IMG_LIB, pEntry, false, std::auto_ptr< SFEntry >(new SFEntry( OBJTYPE_SCRIPTCONTAINER, aChildNode,xDocumentModel ) ) ); - // If the Parent is not loaded then set to - // loaded, this will prevent RequestingChilds ( called - // from vcl via RequestingChilds ) from - // creating new ( duplicate ) children - SFEntry* userData = (SFEntry*)pEntry->GetUserData(); - if ( userData && !userData->isLoaded() ) - { - userData->setLoaded(); - } - } - aScriptsBox.SetCurEntry( pNewEntry ); - aScriptsBox.Select( aScriptsBox.GetCurEntry() ); - - } - else - { - //ISSUE L10N & message from exception? - String aError( m_createErrStr ); - ErrorBox aErrorBox( static_cast(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_createErrTitleStr ); - aErrorBox.Execute(); - } -} - -void SvxScriptOrgDialog::renameEntry( SvLBoxEntry* pEntry ) -{ - - Reference< browse::XBrowseNode > aChildNode; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - - if ( xInv.is() ) - { - ::rtl::OUString aNewName = node->getName(); - sal_Int32 extnPos = aNewName.lastIndexOf( '.' ); - ::rtl::OUString extn; - if(extnPos>0) - { - extn = aNewName.copy(extnPos); - aNewName = aNewName.copy(0,extnPos); - } - sal_uInt16 nMode = INPUTMODE_RENAME; - - std::auto_ptr< InputDialog > xNewDlg( new InputDialog( static_cast(this), nMode ) ); - xNewDlg->SetObjectName( aNewName ); - - sal_Bool bValid; - do - { - if ( xNewDlg->Execute() && xNewDlg->GetObjectName().Len() ) - { - ::rtl::OUString aUserSuppliedName = xNewDlg->GetObjectName(); - bValid = sal_True; - if( bValid ) - aNewName = aUserSuppliedName; - } - else - { - // user hit cancel or hit OK with nothing in the editbox - return; - } - } - while ( !bValid ); - - Sequence< Any > args( 1 ); - args[ 0 ] <<= aNewName; - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Renamable") ), args, outIndex, outArgs ); - Reference< browse::XBrowseNode > newNode( aResult, UNO_QUERY ); - aChildNode = newNode; - - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to Rename %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - if ( aChildNode.is() ) - { - aScriptsBox.SetEntryText( pEntry, aChildNode->getName() ); - aScriptsBox.SetCurEntry( pEntry ); - aScriptsBox.Select( aScriptsBox.GetCurEntry() ); - - } - else - { - //ISSUE L10N & message from exception? - String aError( m_renameErrStr ); - ErrorBox aErrorBox( static_cast(this), WB_OK | RET_OK, aError ); - aErrorBox.SetText( m_renameErrTitleStr ); - aErrorBox.Execute(); - } -} -void SvxScriptOrgDialog::deleteEntry( SvLBoxEntry* pEntry ) -{ - sal_Bool result = sal_False; - Reference< browse::XBrowseNode > node = getBrowseNode( pEntry ); - // ISSUE L10N string & can we centre list? - String aQuery( m_delQueryStr ); - aQuery.Append( getListOfChildren( node, 0 ) ); - QueryBox aQueryBox( static_cast(this), WB_YES_NO | WB_DEF_YES, aQuery ); - aQueryBox.SetText( m_delQueryTitleStr ); - if ( aQueryBox.Execute() == RET_NO ) - { - return; - } - - Reference< script::XInvocation > xInv( node, UNO_QUERY ); - if ( xInv.is() ) - { - Sequence< Any > args( 0 ); - Sequence< Any > outArgs( 0 ); - Sequence< sal_Int16 > outIndex; - try - { - Any aResult; - aResult = xInv->invoke( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deletable") ), args, outIndex, outArgs ); - aResult >>= result; // or do we just assume true if no exception ? - } - catch( Exception& e ) - { - OSL_TRACE("Caught exception trying to delete %s", - ::rtl::OUStringToOString( - e.Message, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - - if ( result == sal_True ) - { - aScriptsBox.deleteTree( pEntry ); - aScriptsBox.GetModel()->Remove( pEntry ); - } - else - { - //ISSUE L10N & message from exception? - ErrorBox aErrorBox( static_cast(this), WB_OK | RET_OK, m_delErrStr ); - aErrorBox.SetText( m_delErrTitleStr ); - aErrorBox.Execute(); - } - -} - -sal_Bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet >& xProps, - ::rtl::OUString& propName ) -{ - sal_Bool result = false; - try - { - sal_Bool bTemp = sal_False; - xProps->getPropertyValue( propName ) >>= bTemp; - result = ( bTemp == sal_True ); - } - catch ( Exception& ) - { - return result; - } - return result; -} - -String SvxScriptOrgDialog::getListOfChildren( Reference< browse::XBrowseNode > node, int depth ) -{ - String result; - result.Append( String::CreateFromAscii( "\n" ) ); - for( int i=0;i<=depth;i++ ) - { - result.Append( String::CreateFromAscii( "\t" ) ); - } - result.Append( String( node->getName() ) ); - - try - { - if ( node->hasChildNodes() == sal_True ) - { - Sequence< Reference< browse::XBrowseNode > > children - = node->getChildNodes(); - for ( sal_Int32 n = 0; n < children.getLength(); n++ ) - { - result.Append( getListOfChildren( children[ n ] , depth+1 ) ); - } - } - } - catch ( Exception& ) - { - // ignore, will return an empty string - } - - return result; -} - -Selection_hash SvxScriptOrgDialog::m_lastSelection; - -void SvxScriptOrgDialog::StoreCurrentSelection() -{ - String aDescription; - if ( aScriptsBox.IsSelected( aScriptsBox.GetHdlEntry() ) ) - { - SvLBoxEntry* pEntry = aScriptsBox.GetHdlEntry(); - while( pEntry ) - { - aDescription.Insert( aScriptsBox.GetEntryText( pEntry ), 0 ); - pEntry = aScriptsBox.GetParent( pEntry ); - if ( pEntry ) - aDescription.Insert( ';', 0 ); - } - ::rtl::OUString sDesc( aDescription ); - m_lastSelection[ m_sLanguage ] = sDesc; - } -} - -void SvxScriptOrgDialog::RestorePreviousSelection() -{ - String aStoredEntry = String( m_lastSelection[ m_sLanguage ] ); - if( aStoredEntry.Len() <= 0 ) - return; - SvLBoxEntry* pEntry = 0; - sal_uInt16 nIndex = 0; - while ( nIndex != STRING_NOTFOUND ) - { - String aTmp( aStoredEntry.GetToken( 0, ';', nIndex ) ); - SvLBoxEntry* pTmpEntry = aScriptsBox.FirstChild( pEntry ); - ::rtl::OUString debugStr(aTmp); - while ( pTmpEntry ) - { - debugStr = ::rtl::OUString(aScriptsBox.GetEntryText( pTmpEntry )); - if ( aScriptsBox.GetEntryText( pTmpEntry ) == aTmp ) - { - pEntry = pTmpEntry; - break; - } - pTmpEntry = aScriptsBox.NextSibling( pTmpEntry ); - } - if ( !pTmpEntry ) - break; - aScriptsBox.RequestingChilds( pEntry ); - } - aScriptsBox.SetCurEntry( pEntry ); -} - -::rtl::OUString ReplaceString( - const ::rtl::OUString& source, - const ::rtl::OUString& token, - const ::rtl::OUString& value ) -{ - sal_Int32 pos = source.indexOf( token ); - - if ( pos != -1 && value.getLength() != 0 ) - { - return source.replaceAt( pos, token.getLength(), value ); - } - else - { - return source; - } -} - -::rtl::OUString FormatErrorString( - const ::rtl::OUString& unformatted, - const ::rtl::OUString& language, - const ::rtl::OUString& script, - const ::rtl::OUString& line, - const ::rtl::OUString& type, - const ::rtl::OUString& message ) -{ - ::rtl::OUString result = unformatted.copy( 0 ); - - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language ); - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%SCRIPTNAME") ), script ); - result = ReplaceString( - result, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LINENUMBER") ), line ); - - if ( type.getLength() != 0 ) - { - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") ); - result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_TYPE_LABEL))); - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ); - result += type; - } - - if ( message.getLength() != 0 ) - { - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\n") ); - result += ::rtl::OUString(String(CUI_RES(RID_SVXSTR_ERROR_MESSAGE_LABEL))); - result += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ); - result += message; - } - - return result; -} - -::rtl::OUString GetErrorMessage( - const provider::ScriptErrorRaisedException& eScriptError ) -{ - ::rtl::OUString unformatted = String( CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) ); - - ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - ::rtl::OUString language = unknown; - ::rtl::OUString script = unknown; - ::rtl::OUString line = unknown; - ::rtl::OUString type = ::rtl::OUString(); - ::rtl::OUString message = eScriptError.Message; - - if ( eScriptError.language.getLength() != 0 ) - { - language = eScriptError.language; - } - - if ( eScriptError.scriptName.getLength() != 0 ) - { - script = eScriptError.scriptName; - } - - if ( eScriptError.Message.getLength() != 0 ) - { - message = eScriptError.Message; - } - if ( eScriptError.lineNum != -1 ) - { - line = ::rtl::OUString::valueOf( eScriptError.lineNum ); - unformatted = String( - CUI_RES( RID_SVXSTR_ERROR_AT_LINE ) ); - } - else - { - unformatted = String( - CUI_RES( RID_SVXSTR_ERROR_RUNNING ) ); - } - - return FormatErrorString( - unformatted, language, script, line, type, message ); -} - -::rtl::OUString GetErrorMessage( - const provider::ScriptExceptionRaisedException& eScriptException ) -{ - ::rtl::OUString unformatted = - String( CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) ); - - ::rtl::OUString unknown( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - ::rtl::OUString language = unknown; - ::rtl::OUString script = unknown; - ::rtl::OUString line = unknown; - ::rtl::OUString type = unknown; - ::rtl::OUString message = eScriptException.Message; - - if ( eScriptException.language.getLength() != 0 ) - { - language = eScriptException.language; - } - if ( eScriptException.scriptName.getLength() != 0 ) - { - script = eScriptException.scriptName; - } - - if ( eScriptException.Message.getLength() != 0 ) - { - message = eScriptException.Message; - } - - if ( eScriptException.lineNum != -1 ) - { - line = ::rtl::OUString::valueOf( eScriptException.lineNum ); - unformatted = String( - CUI_RES( RID_SVXSTR_EXCEPTION_AT_LINE ) ); - } - else - { - unformatted = String( - CUI_RES( RID_SVXSTR_EXCEPTION_RUNNING ) ); - } - - if ( eScriptException.exceptionType.getLength() != 0 ) - { - type = eScriptException.exceptionType; - } - - return FormatErrorString( - unformatted, language, script, line, type, message ); - -} -::rtl::OUString GetErrorMessage( - const provider::ScriptFrameworkErrorException& sError ) -{ - ::rtl::OUString unformatted = String( - CUI_RES( RID_SVXSTR_FRAMEWORK_ERROR_RUNNING ) ); - - ::rtl::OUString language( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - - ::rtl::OUString script( RTL_CONSTASCII_USTRINGPARAM("UNKNOWN") ); - - ::rtl::OUString message; - - if ( sError.scriptName.getLength() > 0 ) - { - script = sError.scriptName; - } - if ( sError.language.getLength() > 0 ) - { - language = sError.language; - } - if ( sError.errorType == provider::ScriptFrameworkErrorType::NOTSUPPORTED ) - { - message = String( - CUI_RES( RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED ) ); - message = ReplaceString( - message, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%LANGUAGENAME") ), language ); - - } - else - { - message = sError.Message; - } - return FormatErrorString( - unformatted, language, script, ::rtl::OUString(), ::rtl::OUString(), message ); -} - -::rtl::OUString GetErrorMessage( const RuntimeException& re ) -{ - Type t = ::getCppuType( &re ); - ::rtl::OUString message = t.getTypeName(); - message += re.Message; - - return message; -} - -::rtl::OUString GetErrorMessage( const Exception& e ) -{ - Type t = ::getCppuType( &e ); - ::rtl::OUString message = t.getTypeName(); - message += e.Message; - - return message; -} - -::rtl::OUString GetErrorMessage( const com::sun::star::uno::Any& aException ) -{ - ::rtl::OUString exType; - if ( aException.getValueType() == - ::getCppuType( (const reflection::InvocationTargetException* ) NULL ) ) - { - reflection::InvocationTargetException ite; - aException >>= ite; - if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptErrorRaisedException* ) NULL ) ) - { - // Error raised by script - provider::ScriptErrorRaisedException scriptError; - ite.TargetException >>= scriptError; - return GetErrorMessage( scriptError ); - } - else if ( ite.TargetException.getValueType() == ::getCppuType( ( const provider::ScriptExceptionRaisedException* ) NULL ) ) - { - // Exception raised by script - provider::ScriptExceptionRaisedException scriptException; - ite.TargetException >>= scriptException; - return GetErrorMessage( scriptException ); - } - else - { - // Unknown error, shouldn't happen - // OSL_ASSERT(...) - } - - } - else if ( aException.getValueType() == ::getCppuType( ( const provider::ScriptFrameworkErrorException* ) NULL ) ) - { - // A Script Framework error has occurred - provider::ScriptFrameworkErrorException sfe; - aException >>= sfe; - return GetErrorMessage( sfe ); - - } - // unknown exception - Exception e; - RuntimeException rte; - if ( aException >>= rte ) - { - return GetErrorMessage( rte ); - } - - aException >>= e; - return GetErrorMessage( e ); - -} - -SvxScriptErrorDialog::SvxScriptErrorDialog( - Window* , ::com::sun::star::uno::Any aException ) - : m_sMessage() -{ - SolarMutexGuard aGuard; - m_sMessage = GetErrorMessage( aException ); -} - -SvxScriptErrorDialog::~SvxScriptErrorDialog() -{ -} - -short SvxScriptErrorDialog::Execute() -{ - // Show Error dialog asynchronously - // - // Pass a copy of the message to the ShowDialog method as the - // SvxScriptErrorDialog may be deleted before ShowDialog is called - Application::PostUserEvent( - LINK( this, SvxScriptErrorDialog, ShowDialog ), - new rtl::OUString( m_sMessage ) ); - - return 0; -} - -IMPL_LINK( SvxScriptErrorDialog, ShowDialog, ::rtl::OUString*, pMessage ) -{ - ::rtl::OUString message; - - if ( pMessage && pMessage->getLength() != 0 ) - { - message = *pMessage; - } - else - { - message = String( CUI_RES( RID_SVXSTR_ERROR_TITLE ) ); - } - - MessBox* pBox = new WarningBox( NULL, WB_OK, message ); - pBox->SetText( CUI_RES( RID_SVXSTR_ERROR_TITLE ) ); - pBox->Execute(); - - if ( pBox ) delete pBox; - if ( pMessage ) delete pMessage; - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/scriptdlg.hrc b/cui/source/dialogs/scriptdlg.hrc deleted file mode 100644 index 5b217bbe9..000000000 --- a/cui/source/dialogs/scriptdlg.hrc +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SCRIPTDLG_HRC -#define _SCRIPTDLG_HRC - -#include - -#define SCRIPTDLG_OFFSET 400 - -// ScriptOrgDialog -#define SF_TXT_SCRIPTS 1 -#define SF_CTRL_SCRIPTSBOX 2 -#define SF_PB_RUN 3 -#define SF_PB_CLOSE 4 -#define SF_PB_CREATE 5 -#define SF_PB_EDIT 6 -#define SF_PB_RENAME 7 -#define SF_PB_DEL 8 -#define SF_PB_HELP 9 - -#define IMG_HARDDISK 1 -#define IMG_LIB 3 -#define IMG_MACRO 5 -#define IMG_DOCUMENT 7 - -#define RID_IMGLST_OBJECTS ( RID_BASICIDE_START + 7 ) -#define RID_IMGLST_OBJECTS_HC (RID_BASICIDE_START + 13) - -// NewObjectDialog -#define FT_NEWLIB 10 -#define STR_FT_NEWMACRO 11 -#define STR_NEWLIB 12 -#define STR_NEWMACRO 13 -#define ED_LIBNAME 14 -#define PB_OK 15 -#define PB_CANCEL 16 -#define DLG_NEWLIB 17 -#define STR_FT_RENAME 18 -#define STR_RENAME 19 - -// Others -/* -Please be aware that these strings are global resources, don't use self-defined values! -You have to use the RID_SVXSTART macro do avoid ID clashes with other resource files. Sfx2 delivers -some of its own resource files to svx - where they are added to svx resource file!! -*/ - -#define STR_MYMACROS 32 -#define STR_PRODMACROS 33 - - -#endif // _SCRIPTDLG_HRC diff --git a/cui/source/dialogs/scriptdlg.src b/cui/source/dialogs/scriptdlg.src deleted file mode 100644 index 0c58be37e..000000000 --- a/cui/source/dialogs/scriptdlg.src +++ /dev/null @@ -1,294 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "scriptdlg.hrc" -#include "helpid.hrc" - -#define MASKCOLOR MaskColor = \ - Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -ModalDialog RID_DLG_SCRIPTORGANIZER -{ - OutputSize = TRUE ; - Size = MAP_APPFONT ( 210 , 165 ) ; - Moveable = TRUE ; - Text [ en-US ] = "%MACROLANG Macros"; - Closeable = TRUE ; - HelpId = HID_SCRIPTORG_DIALOG; - FixedText SF_TXT_SCRIPTS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Macros" ; - }; - - Control SF_CTRL_SCRIPTSBOX - { - HelpId = HID_SCRIPTSBOX ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 16 ) ; - Size = MAP_APPFONT ( 130 , 144 ) ; - TabStop = TRUE ; - Image IMG_HARDDISK - { - ImageBitmap = Bitmap { File = "harddisk_16.bmp" ; }; - MASKCOLOR - }; - Image IMG_LIB - { - ImageBitmap = Bitmap { File = "im30820.png"; }; - MASKCOLOR - }; - Image IMG_MACRO - { - ImageBitmap = Bitmap { File = "im30821.png"; }; - MASKCOLOR - }; - Image IMG_DOCUMENT - { - ImageBitmap = Bitmap { File = "im30826.png"; }; - MASKCOLOR - }; - String STR_MYMACROS - { - Text [ en-US ] = "My Macros"; - }; - String STR_PRODMACROS - { - Text [ en-US ] = "%PRODUCTNAME Macros"; - }; - }; - - PushButton SF_PB_RUN - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_RUN"; - Pos = MAP_APPFONT ( 144 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - DefButton = TRUE; - Text [ en-US ] = "R~un" ; - }; - CancelButton SF_PB_CLOSE - { - Pos = MAP_APPFONT ( 144 , 23 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Close" ; - }; - - PushButton SF_PB_CREATE - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_CREATE"; - Size = MAP_APPFONT ( 60 , 14 ) ; - Pos = MAP_APPFONT ( 144 , 60 ) ; - Text [ en-US ] = "~Create..." ; - TabStop = TRUE ; - }; - PushButton SF_PB_EDIT - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_EDIT"; - Size = MAP_APPFONT ( 60 , 14 ) ; - Pos = MAP_APPFONT ( 144 , 77 ) ; - Text [ en-US ] = "~Edit" ; - TabStop = TRUE ; - }; - PushButton SF_PB_RENAME - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_RENAME"; - Pos = MAP_APPFONT ( 144 , 94 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Rename..." ; - }; - PushButton SF_PB_DEL - { - HelpID = "cui:PushButton:RID_DLG_SCRIPTORGANIZER:SF_PB_DEL"; - Pos = MAP_APPFONT ( 144 , 114 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - HelpButton SF_PB_HELP - { - Pos = MAP_APPFONT ( 144 , 131 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - -}; -ModalDialog RID_DLG_NEWLIB -{ - HelpID = "cui:ModalDialog:RID_DLG_NEWLIB"; - Text [ en-US ] = "Create Library" ; - Size = MAP_APPFONT ( 160 , 50 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 104 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 104 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_NEWLIB - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 100 , 50 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "Enter the name for the new library." ; - }; - Edit ED_LIBNAME - { - HelpID = "cui:Edit:RID_DLG_NEWLIB:ED_LIBNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 59 ) ; - Size = MAP_APPFONT ( 92 , 12 ) ; - TabStop = TRUE ; - }; - String STR_NEWLIB - { - Text [ en-US ] = "Create Library" ; - }; - String STR_NEWMACRO - { - Text [ en-US ] = "Create Macro" ; - }; - String STR_FT_NEWMACRO - { - Text [ en-US ] = "Enter the name for the new macro." ; - }; - String STR_RENAME - { - Text [ en-US ] = "Rename" ; - }; - String STR_FT_RENAME - { - Text [ en-US ] = "Enter the new name for the selected object." ; - }; -}; -String RID_SVXSTR_DELQUERY -{ - Text [ en-US ] = "Do you want to delete the following object?"; -}; -String RID_SVXSTR_DELQUERY_TITLE -{ - Text [ en-US ] = "Confirm Deletion"; -}; -String RID_SVXSTR_DELFAILED -{ - Text [ en-US ] = "The selected object could not be deleted."; -}; -String RID_SVXSTR_DELFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to delete this object."; -}; -String RID_SVXSTR_DELFAILED_TITLE -{ - Text [ en-US ] = "Error Deleting Object"; -}; -String RID_SVXSTR_CREATEFAILED -{ - Text [ en-US ] = "The object could not be created."; -}; -String RID_SVXSTR_CREATEFAILEDDUP -{ - Text [ en-US ] = " Object with the same name already exists."; -}; -String RID_SVXSTR_CREATEFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to create this object."; -}; -String RID_SVXSTR_CREATEFAILED_TITLE -{ - Text [ en-US ] = "Error Creating Object"; -}; -String RID_SVXSTR_RENAMEFAILED -{ - Text [ en-US ] = "The object could not be renamed."; -}; -String RID_SVXSTR_RENAMEFAILEDPERM -{ - Text [ en-US ] = " You do not have permission to rename this object."; -}; -String RID_SVXSTR_RENAMEFAILED_TITLE -{ - Text [ en-US ] = "Error Renaming Object"; -}; - -String RID_SVXSTR_ERROR_TITLE -{ - Text [ en-US ] = "%PRODUCTNAME Error"; -}; - -String RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED -{ - Text [ en-US ] = "The scripting language %LANGUAGENAME is not supported."; -}; -String RID_SVXSTR_ERROR_RUNNING -{ - Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_EXCEPTION_RUNNING -{ - Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_ERROR_AT_LINE -{ - Text [ en-US ] = "An error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_EXCEPTION_AT_LINE -{ - Text [ en-US ] = "An exception occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_FRAMEWORK_ERROR_RUNNING -{ - Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME."; -}; - -String RID_SVXSTR_FRAMEWORK_ERROR_AT_LINE -{ - Text [ en-US ] = "A Scripting Framework error occurred while running the %LANGUAGENAME script %SCRIPTNAME at line: %LINENUMBER."; -}; - -String RID_SVXSTR_ERROR_TYPE_LABEL -{ - Text [ en-US ] = "Type:"; -}; - -String RID_SVXSTR_ERROR_MESSAGE_LABEL -{ - Text [ en-US ] = "Message:"; -}; diff --git a/cui/source/dialogs/sdrcelldlg.cxx b/cui/source/dialogs/sdrcelldlg.cxx deleted file mode 100644 index 39914e70f..000000000 --- a/cui/source/dialogs/sdrcelldlg.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "cuires.hrc" -#include "sdrcelldlg.hxx" -#include "dialmgr.hxx" -#include "cuitabarea.hxx" -#include "svx/svdmodel.hxx" -#include "border.hxx" -#include // RID_SVXPAGE_... - -SvxFormatCellsDialog::SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel ) -: SfxTabDialog ( pParent, CUI_RES( RID_SVX_FORMAT_CELLS_DLG ), pAttr ) -, mrOutAttrs ( *pAttr ) -, mpColorTab ( pModel->GetColorTable() ) -, mpGradientList ( pModel->GetGradientList() ) -, mpHatchingList ( pModel->GetHatchList() ) -, mpBitmapList ( pModel->GetBitmapList() ) - -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_CHAR_NAME ); - AddTabPage( RID_SVXPAGE_CHAR_EFFECTS ); - AddTabPage( RID_SVXPAGE_BORDER ); - AddTabPage( RID_SVXPAGE_AREA ); -} - -SvxFormatCellsDialog::~SvxFormatCellsDialog() -{ -} - -void SvxFormatCellsDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - switch( nId ) - { - case RID_SVXPAGE_AREA: - ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); - ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); - ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); - ( (SvxAreaTabPage&) rPage ).SetPageType( PT_AREA ); - ( (SvxAreaTabPage&) rPage ).SetDlgType( 1 ); - ( (SvxAreaTabPage&) rPage ).SetPos( 0 ); - ( (SvxAreaTabPage&) rPage ).Construct(); - ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs ); - - break; - - default: - SfxTabDialog::PageCreated( nId, rPage ); - break; - } -} - -void SvxFormatCellsDialog::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/sdrcelldlg.src b/cui/source/dialogs/sdrcelldlg.src deleted file mode 100644 index f608da587..000000000 --- a/cui/source/dialogs/sdrcelldlg.src +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -TabDialog RID_SVX_FORMAT_CELLS_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 289 , 176 ) ; - Text [ de ] = "Zellen formatieren" ; - Text [ en-US ] = "Format Cells" ; - Moveable = TRUE ; - Closeable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , 135 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_CHAR_NAME ; - PageResID = RID_SVXPAGE_CHAR_NAME ; - Text [ de ] = "Schrift" ; - Text [ en-US ] = "Font" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_EFFECTS ; - PageResID = RID_SVXPAGE_CHAR_EFFECTS ; - Text [ de ] = "Schrifteffekt" ; - Text [ en-US ] = "Font Effects" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_BORDER; - PageResID = RID_SVXPAGE_BORDER; - Text [ de ] = "Umrandung" ; - Text [ en-US ] = "Borders" ; - Text [ x-comment ] = " "; - }; - PageItem - { - Identifier = RID_SVXPAGE_AREA; - PageResID = RID_SVXPAGE_AREA; - Text [ de ] = "Hintergrund"; - Text [ en-US ] = "Background"; - Text [ x-comment ] = " "; - }; - }; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 6 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 60 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 114 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton 1 - { - Pos = MAP_APPFONT ( 169 , 151 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ de ] = "Zurück" ; - Text [ en-US ] = "Return" ; - TabStop = TRUE ; - Text [ x-comment ] = " "; - }; - Text [ x-comment ] = " "; -}; diff --git a/cui/source/dialogs/showcols.cxx b/cui/source/dialogs/showcols.cxx deleted file mode 100644 index 83938ff7a..000000000 --- a/cui/source/dialogs/showcols.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "showcols.hxx" -#include "fmsearch.hrc" - -#include -#include -#include -#include -#include -#include - -#define CUIFM_PROP_HIDDEN rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Hidden" ) ) -#define CUIFM_PROP_LABEL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ) - -//========================================================================== -// FmShowColsDialog -//========================================================================== -DBG_NAME(FmShowColsDialog) -//-------------------------------------------------------------------------- -FmShowColsDialog::FmShowColsDialog(Window* pParent) - :ModalDialog(pParent, CUI_RES(RID_SVX_DLG_SHOWGRIDCOLUMNS)) - ,m_aList(this, CUI_RES(1)) - ,m_aLabel(this, CUI_RES(1)) - ,m_aOK(this, CUI_RES(1)) - ,m_aCancel(this, CUI_RES(1)) -{ - DBG_CTOR(FmShowColsDialog,NULL); - m_aList.EnableMultiSelection(sal_True); - m_aOK.SetClickHdl( LINK( this, FmShowColsDialog, OnClickedOk ) ); - - FreeResource(); -} - -//-------------------------------------------------------------------------- -FmShowColsDialog::~FmShowColsDialog() -{ - DBG_DTOR(FmShowColsDialog,NULL); -} - -//-------------------------------------------------------------------------- -IMPL_LINK( FmShowColsDialog, OnClickedOk, Button*, EMPTYARG ) -{ - DBG_ASSERT(m_xColumns.is(), "FmShowColsDialog::OnClickedOk : you should call SetColumns before executing the dialog !"); - if (m_xColumns.is()) - { - ::com::sun::star::uno::Any aCol; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xCol; - for (sal_uInt16 i=0; igetByIndex(sal::static_int_cast(reinterpret_cast(m_aList.GetEntryData(m_aList.GetSelectEntryPos(i))))) >>= xCol; - if (xCol.is()) - { - try - { - xCol->setPropertyValue(CUIFM_PROP_HIDDEN, ::cppu::bool2any(sal_False)); - } - catch(...) - { - OSL_FAIL("FmShowColsDialog::OnClickedOk Exception occurred!"); - } - } - } - } - - EndDialog(RET_OK); - return 0L; -} - -//-------------------------------------------------------------------------- -void FmShowColsDialog::SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols) -{ - DBG_ASSERT(xCols.is(), "FmShowColsDialog::SetColumns : invalid columns !"); - if (!xCols.is()) - return; - m_xColumns = xCols.get(); - - m_aList.Clear(); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xCurCol; - String sCurName; - for (sal_uInt16 i=0; igetCount(); ++i) - { - sCurName.Erase(); - ::cppu::extractInterface(xCurCol, xCols->getByIndex(i)); - sal_Bool bIsHidden = sal_False; - try - { - ::com::sun::star::uno::Any aHidden = xCurCol->getPropertyValue(CUIFM_PROP_HIDDEN); - bIsHidden = ::comphelper::getBOOL(aHidden); - - ::rtl::OUString sName; - xCurCol->getPropertyValue(CUIFM_PROP_LABEL) >>= sName; - sCurName = sName; - } - catch(...) - { - OSL_FAIL("FmShowColsDialog::SetColumns Exception occurred!"); - } - - // if the col is hidden, put it into the list - if (bIsHidden) - m_aList.SetEntryData( m_aList.InsertEntry(sCurName), reinterpret_cast((sal_Int64)i) ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/showcols.src b/cui/source/dialogs/showcols.src deleted file mode 100644 index 98ae449e6..000000000 --- a/cui/source/dialogs/showcols.src +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "fmsearch.hrc" - -ModalDialog RID_SVX_DLG_SHOWGRIDCOLUMNS -{ - HelpID = "cui:ModalDialog:RID_SVX_DLG_SHOWGRIDCOLUMNS"; - OutputSize = TRUE; - SVLook = TRUE ; - Size = MAP_APPFONT( 200, 117 ); - Moveable = TRUE; - Closeable = TRUE; - - FixedText 1 - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 188, 30 ); - WordBreak = TRUE; - Text [ en-US ] = "The following columns are currently hidden. Please mark the fields you want to show and choose OK."; - }; - - ListBox 1 - { - HelpID = "cui:ListBox:RID_SVX_DLG_SHOWGRIDCOLUMNS:1"; - Border = TRUE; - Pos = MAP_APPFONT( 6, 39 ); - Size = MAP_APPFONT( 188, 55 ); - TabStop = TRUE; - DropDown = FALSE; - AutoHScroll = TRUE; - VScroll = TRUE; - }; - - OKButton 1 - { - Pos = MAP_APPFONT( 6, 97 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE ; - }; - - CancelButton 1 - { - Pos = MAP_APPFONT( 144, 97 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; - Text [ en-US ] = "Show columns"; -}; diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx deleted file mode 100644 index 8b408bf71..000000000 --- a/cui/source/dialogs/splitcelldlg.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include "dialmgr.hxx" -#include "splitcelldlg.hxx" -#include "cuires.hrc" -#include "splitcelldlg.hrc" - -SvxSplitTableDlg::SvxSplitTableDlg( Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal ) -: SvxStandardDialog(pParent, CUI_RES(RID_SVX_SPLITCELLDLG)) -, maCountFL(this, CUI_RES(FL_COUNT)) -, maCountLbl(this, CUI_RES(FT_COUNT)) -, maCountEdit(this, CUI_RES(ED_COUNT)) -, maDirFL(this, CUI_RES(FL_DIR)) -, maHorzBox(this, CUI_RES(RB_HORZ)) -, maVertBox(this, CUI_RES(RB_VERT)) -, maPropCB(this, CUI_RES(CB_PROP)) -, maOKBtn(this, CUI_RES(BT_OK)) -, maCancelBtn(this, CUI_RES(BT_CANCEL)) -, maHelpBtn( this, CUI_RES( BT_HELP ) ) -, mnMaxVertical( nMaxVertical ) -, mnMaxHorizontal( nMaxHorizontal ) -{ - FreeResource(); - maHorzBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - maPropCB.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - maVertBox.SetClickHdl( LINK( this, SvxSplitTableDlg, ClickHdl )); - - if( mnMaxVertical < 2 ) - maVertBox.Enable(sal_False); - - //exchange the meaning of horizontal and vertical for vertical text - if(bIsTableVertical) - { - Image aTmpImg(maHorzBox.GetModeRadioImage()); - String sTmp(maHorzBox.GetText()); - maHorzBox.SetText(maVertBox.GetText()); - maHorzBox.SetModeRadioImage(maVertBox.GetModeRadioImage()); - maVertBox.SetText(sTmp); - maVertBox.SetModeRadioImage(aTmpImg); - } -} - -SvxSplitTableDlg::~SvxSplitTableDlg() -{ -} - -IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton ) -{ - const bool bIsVert = pButton == &maVertBox ; - long nMax = bIsVert ? mnMaxVertical : mnMaxHorizontal; - maPropCB.Enable(!bIsVert); - maCountEdit.SetMax( nMax ); - return 0; -} - -bool SvxSplitTableDlg::IsHorizontal() const -{ - return maHorzBox.IsChecked(); -} - -bool SvxSplitTableDlg::IsProportional() const -{ - return maPropCB.IsChecked() && maHorzBox.IsChecked(); -} - -long SvxSplitTableDlg::GetCount() const -{ - return sal::static_int_cast( maCountEdit.GetValue() ); -} - -short SvxSplitTableDlg::Execute() -{ - return SvxStandardDialog::Execute(); -} - -void SvxSplitTableDlg::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/splitcelldlg.hrc b/cui/source/dialogs/splitcelldlg.hrc deleted file mode 100644 index c1db00201..000000000 --- a/cui/source/dialogs/splitcelldlg.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FT_COUNT 1 -#define ED_COUNT 2 -#define FL_COUNT 3 - -#define RB_HORZ 10 -#define CB_PROP 11 -#define RB_VERT 12 -#define FL_DIR 12 - -#define BT_OK 100 -#define BT_CANCEL 101 -#define BT_HELP 102 diff --git a/cui/source/dialogs/splitcelldlg.src b/cui/source/dialogs/splitcelldlg.src deleted file mode 100644 index 6fb9a990a..000000000 --- a/cui/source/dialogs/splitcelldlg.src +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "splitcelldlg.hrc" - -ModalDialog RID_SVX_SPLITCELLDLG -{ - HelpID = "cui:ModalDialog:RID_SVX_SPLITCELLDLG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 108 ) ; - Text [ en-US ] = "Split Cells" ; - Moveable = TRUE ; - - OKButton BT_OK - { - Pos = MAP_APPFONT ( 115 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 115 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 115 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedText FT_COUNT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 67 , 8 ) ; - Text [ en-US ] = "~Split cell into" ; - Left = TRUE ; - }; - NumericField ED_COUNT - { - HelpID = "cui:NumericField:RID_SVX_SPLITCELLDLG:ED_COUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 14 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 20 ; - First = 2 ; - Last = 5 ; - }; - FixedLine FL_COUNT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 103 , 8 ) ; - Text [ en-US ] = "Split" ; - }; - ImageRadioButton RB_HORZ - { - HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_HORZ"; - Pos = MAP_APPFONT ( 12 , 47 ) ; - Size = MAP_APPFONT ( 90 , 18 ) ; - Group = TRUE; - Text [ en-US ] = "H~orizontally" ; - RadioButtonImage = Image - { - ImageBitmap = Bitmap { File = "zetlhor2.bmp" ; }; - }; - TabStop = TRUE ; - Check = TRUE ; - }; - CheckBox CB_PROP - { - HelpID = "cui:CheckBox:RID_SVX_SPLITCELLDLG:CB_PROP"; - Pos = MAP_APPFONT ( 18 , 68 ) ; - Size = MAP_APPFONT ( 91 , 12 ) ; - Text [ en-US ] = "~Into equal proportions"; - }; - ImageRadioButton RB_VERT - { - HelpID = "cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_VERT"; - Pos = MAP_APPFONT ( 12 , 84 ) ; - Size = MAP_APPFONT ( 90 , 18 ) ; - Text [ en-US ] = "~Vertically" ; - RadioButtonImage = Image - { - ImageBitmap = Bitmap { File = "zetlver2.bmp" ; }; - }; - TabStop = TRUE ; - }; - FixedLine FL_DIR - { - Pos = MAP_APPFONT ( 6 , 36 ) ; - Size = MAP_APPFONT ( 103 , 8 ) ; - Text [ en-US ] = "Direction" ; - }; -}; diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx deleted file mode 100644 index b67fdadfc..000000000 --- a/cui/source/dialogs/srchxtra.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "srchxtra.hxx" -#include -#include -#include -#include -#include -#include -#include "srchxtra.hrc" -#include // RID_ATTR_BEGIN -#include // item resources -#include -#include "chardlg.hxx" -#include "paragrph.hxx" -#include -#include "backgrnd.hxx" -#include // RID_SVXPAGE_... -#include -#include - -// class SvxSearchFormatDialog ------------------------------------------- - -SvxSearchFormatDialog::SvxSearchFormatDialog( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHFORMAT ), &rSet ), - - pFontList( NULL ) - -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_CHAR_NAME, SvxCharNamePage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_EFFECTS, SvxCharEffectsPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_POSITION, SvxCharPositionPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_CHAR_TWOLINES, SvxCharTwoLinesPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_STD_PARAGRAPH, SvxStdParagraphTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_ALIGN_PARAGRAPH, SvxParaAlignTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_EXT_PARAGRAPH, SvxExtParagraphTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_PARA_ASIAN, SvxAsianTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 ); - - // remove asian tabpages if necessary - SvtCJKOptions aCJKOptions; - if ( !aCJKOptions.IsDoubleLinesEnabled() ) - RemoveTabPage( RID_SVXPAGE_CHAR_TWOLINES ); - if ( !aCJKOptions.IsAsianTypographyEnabled() ) - RemoveTabPage( RID_SVXPAGE_PARA_ASIAN ); -} - -// ----------------------------------------------------------------------- - -SvxSearchFormatDialog::~SvxSearchFormatDialog() -{ - delete pFontList; -} - -// ----------------------------------------------------------------------- - -void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) -{ - switch ( nId ) - { - case RID_SVXPAGE_CHAR_NAME: - { - const FontList* pAppFontList = 0; - SfxObjectShell* pSh = SfxObjectShell::Current(); - - if ( pSh ) - { - const SvxFontListItem* pFLItem = (const SvxFontListItem*) - pSh->GetItem( SID_ATTR_CHAR_FONTLIST ); - if ( pFLItem ) - pAppFontList = pFLItem->GetFontList(); - } - - const FontList* pList = pAppFontList; - - if ( !pList ) - { - if ( !pFontList ) - pFontList = new FontList( this ); - pList = pFontList; - } - - if ( pList ) - ( (SvxCharNamePage&)rPage ). - SetFontList( SvxFontListItem( pList, SID_ATTR_CHAR_FONTLIST ) ); - ( (SvxCharNamePage&)rPage ).EnableSearchMode(); - break; - } - - case RID_SVXPAGE_STD_PARAGRAPH: - ( (SvxStdParagraphTabPage&)rPage ).EnableAutoFirstLine(); - break; - - case RID_SVXPAGE_ALIGN_PARAGRAPH: - ( (SvxParaAlignTabPage&)rPage ).EnableJustifyExt(); - break; - case RID_SVXPAGE_BACKGROUND : - ( (SvxBackgroundTabPage&)rPage ).ShowParaControl(sal_True); - break; - } -} - -// class SvxSearchFormatDialog ------------------------------------------- - -SvxSearchAttributeDialog::SvxSearchAttributeDialog( Window* pParent, - SearchAttrItemList& rLst, - const sal_uInt16* pWhRanges ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHATTR ) ), - - aAttrFL ( this, CUI_RES( FL_ATTR ) ), - aAttrLB ( this, CUI_RES( LB_ATTR ) ), - aOKBtn ( this, CUI_RES( BTN_ATTR_OK ) ), - aEscBtn ( this, CUI_RES( BTN_ATTR_CANCEL ) ), - aHelpBtn( this, CUI_RES( BTN_ATTR_HELP ) ), - - rList( rLst ) - -{ - FreeResource(); - - aAttrLB.SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT ); - aAttrLB.GetModel()->SetSortMode( SortAscending ); - - aOKBtn.SetClickHdl( LINK( this, SvxSearchAttributeDialog, OKHdl ) ); - - SfxObjectShell* pSh = SfxObjectShell::Current(); - DBG_ASSERT( pSh, "No DocShell" ); - - ResStringArray aAttrNames( SVX_RES( RID_ATTR_NAMES ) ); - SfxItemPool& rPool = pSh->GetPool(); - SfxItemSet aSet( rPool, pWhRanges ); - SfxWhichIter aIter( aSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); - - while ( nWhich ) - { - sal_uInt16 nSlot = rPool.GetSlotId( nWhich ); - if ( nSlot >= SID_SVX_START ) - { - sal_Bool bChecked = sal_False, bFound = sal_False; - for ( sal_uInt16 i = 0; !bFound && i < rList.Count(); ++i ) - { - if ( nSlot == rList[i].nSlot ) - { - bFound = sal_True; - if ( IsInvalidItem( rList[i].pItem ) ) - bChecked = sal_True; - } - } - - // item resources are in svx - sal_uInt32 nId = aAttrNames.FindIndex( nSlot ); - SvLBoxEntry* pEntry = NULL; - if ( RESARRAY_INDEX_NOTFOUND != nId ) - pEntry = aAttrLB.SvTreeListBox::InsertEntry( aAttrNames.GetString(nId) ); - else - { - rtl::OStringBuffer sError( - RTL_CONSTASCII_STRINGPARAM("no resource for slot id\nslot = ")); - sError.append(static_cast(nSlot)); - DBG_ERRORFILE(sError.getStr()); - } - - if ( pEntry ) - { - aAttrLB.SetCheckButtonState( pEntry, bChecked ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData( (void*)(sal_uLong)nSlot ); - } - } - nWhich = aIter.NextWhich(); - } - - aAttrLB.SetHighlightRange(); - aAttrLB.SelectEntryPos( 0 ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchAttributeDialog, OKHdl, Button *, EMPTYARG ) -{ - SearchAttrItem aInvalidItem; - aInvalidItem.pItem = (SfxPoolItem*)-1; - - for ( sal_uInt16 i = 0; i < aAttrLB.GetEntryCount(); ++i ) - { - sal_uInt16 nSlot = (sal_uInt16)(sal_uLong)aAttrLB.GetEntryData(i); - sal_Bool bChecked = aAttrLB.IsChecked(i); - - sal_uInt16 j; - for ( j = rList.Count(); j; ) - { - SearchAttrItem& rItem = rList[ --j ]; - if( rItem.nSlot == nSlot ) - { - if( bChecked ) - { - if( !IsInvalidItem( rItem.pItem ) ) - delete rItem.pItem; - rItem.pItem = (SfxPoolItem*)-1; - } - else if( IsInvalidItem( rItem.pItem ) ) - rItem.pItem = 0; - j = 1; - break; - } - } - - if ( !j && bChecked ) - { - aInvalidItem.nSlot = nSlot; - rList.Insert( aInvalidItem ); - } - } - - // remove invalid items (pItem == NULL) - for ( sal_uInt16 n = rList.Count(); n; ) - if ( !rList[ --n ].pItem ) - rList.Remove( n ); - - EndDialog( RET_OK ); - return 0; -} - -// class SvxSearchSimilarityDialog --------------------------------------- - -SvxSearchSimilarityDialog::SvxSearchSimilarityDialog -( - Window* pParent, - sal_Bool bRelax, - sal_uInt16 nOther, - sal_uInt16 nShorter, - sal_uInt16 nLonger -) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_SEARCHSIMILARITY ) ), - - aFixedLine ( this, CUI_RES( FL_SIMILARITY ) ), - aOtherTxt ( this, CUI_RES( FT_OTHER ) ), - aOtherFld ( this, CUI_RES( NF_OTHER ) ), - aLongerTxt ( this, CUI_RES( FT_LONGER ) ), - aLongerFld ( this, CUI_RES( NF_LONGER ) ), - aShorterTxt ( this, CUI_RES( FT_SHORTER ) ), - aShorterFld ( this, CUI_RES( NF_SHORTER ) ), - aRelaxBox ( this, CUI_RES( CB_RELAX ) ), - - aOKBtn ( this, CUI_RES( BTN_ATTR_OK ) ), - aEscBtn ( this, CUI_RES( BTN_ATTR_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_ATTR_HELP ) ) - -{ - FreeResource(); - - aOtherFld.SetValue( nOther ); - aShorterFld.SetValue( nShorter ); - aLongerFld.SetValue( nLonger ); - aRelaxBox.Check( bRelax ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/srchxtra.hrc b/cui/source/dialogs/srchxtra.hrc deleted file mode 100644 index da89b470a..000000000 --- a/cui/source/dialogs/srchxtra.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SRCHXTRA_HRC -#define _SVX_SRCHXTRA_HRC - -// defines ------------------------------------------------------------------ - -#define BTN_ATTR_OK 10 -#define BTN_ATTR_CANCEL 11 -#define BTN_ATTR_HELP 12 -#define LB_ATTR 13 -#define FL_ATTR 14 - -#define CB_RELAX 15 -#define FT_OTHER 16 -#define NF_OTHER 17 -#define FT_SHORTER 18 -#define NF_SHORTER 19 -#define FT_LONGER 20 -#define NF_LONGER 21 -#define FL_SIMILARITY 22 - -#endif diff --git a/cui/source/dialogs/srchxtra.src b/cui/source/dialogs/srchxtra.src deleted file mode 100644 index 15d9ac703..000000000 --- a/cui/source/dialogs/srchxtra.src +++ /dev/null @@ -1,283 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include -#include "srchxtra.hrc" -#include - - // RID_SVXDLG_SEARCHFORMAT ----------------------------------------------- -TabDialog RID_SVXDLG_SEARCHFORMAT -{ - OutputSize = TRUE ; - SvLook = TRUE ; - Text [ en-US ] = "Text Format" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_CHAR_NAME ; - Text [ en-US ] = "Font" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_EFFECTS ; - Text [ en-US ] = "Font Effects" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_POSITION ; - Text [ en-US ] = "Position" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_CHAR_TWOLINES ; - Text [ en-US ] = "Asian Layout" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_STD_PARAGRAPH ; - Text [ en-US ] = "Indents & Spacing" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_ALIGN_PARAGRAPH ; - Text [ en-US ] = "Alignment" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_EXT_PARAGRAPH ; - Text [ en-US ] = "Text Flow" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_PARA_ASIAN; - Text [ en-US ] = "Asian Typography"; - }; - PageItem - { - Identifier = RID_SVXPAGE_BACKGROUND; - Text [ en-US ] = "Background" ; - }; - }; - }; -}; - // RID_SVXDLG_SEARCHATTRIBUTE -------------------------------------------- -ModalDialog RID_SVXDLG_SEARCHATTR -{ - HelpId = HID_SEARCHATTR ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 194 , 128 ) ; - Text [ en-US ] = "Attributes" ; - Moveable = TRUE ; - Control LB_ATTR - { - HelpId = HID_SEARCHATTR_CTL_ATTR ; - ClipChildren = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 120 , 108 ) ; - }; - FixedText FL_ATTR - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 124 , 8 ) ; - Text [ en-US ] = "~Options" ; - }; - OKButton BTN_ATTR_OK - { - Pos = MAP_APPFONT ( 136 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ATTR_CANCEL - { - Pos = MAP_APPFONT ( 136 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_ATTR_HELP - { - Pos = MAP_APPFONT ( 136 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - // RID_SVXDLG_SEARCHSIMILARITY ------------------------------------------- -ModalDialog RID_SVXDLG_SEARCHSIMILARITY -{ - HelpId = HID_SEARCHSIMILARITY ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 76 ) ; - Text [ en-US ] = "Similarity Search" ; - Moveable = TRUE ; - FixedText FT_OTHER - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Exchange characters" ; - }; - NumericField NF_OTHER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_OTHER"; - Pos = MAP_APPFONT ( 86 , 14 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - FixedText FT_LONGER - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Add characters" ; - }; - NumericField NF_LONGER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_LONGER"; - Pos = MAP_APPFONT ( 86 , 28 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - FixedText FT_SHORTER - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Remove characters" ; - }; - NumericField NF_SHORTER - { - HelpID = "cui:NumericField:RID_SVXDLG_SEARCHSIMILARITY:NF_SHORTER"; - Pos = MAP_APPFONT ( 86 , 44 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - First = 1 ; - Maximum = 30 ; - Last = 30 ; - Value = 1 ; - TabStop = TRUE ; - }; - CheckBox CB_RELAX - { - HelpID = "cui:CheckBox:RID_SVXDLG_SEARCHSIMILARITY:CB_RELAX"; - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - Text [ en-US ] = "~Combine" ; - TabStop = TRUE ; - }; - FixedLine FL_SIMILARITY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Settings" ; - }; - OKButton BTN_ATTR_OK - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ATTR_CANCEL - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_ATTR_HELP - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/dialogs/svuidlg.hrc b/cui/source/dialogs/svuidlg.hrc deleted file mode 100644 index 38b89df77..000000000 --- a/cui/source/dialogs/svuidlg.hrc +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -#define TB_LINKS 32014 - -// gemeinsame Id's -#define CB_DISPLAY_AS_ICON 12 -#define FI_DISPLAY 13 -#define PB_CHANGE_ICON 14 - -#define STR_AUTOLINK 32006 -#define STR_MANUALLINK 32007 -#define STR_BROKENLINK 32008 -#define STR_GRAPHICLINK 32009 -#define STR_BUTTONCLOSE 32010 -#define STR_CLOSELINKMSG 32011 -#define STR_CLOSELINKMSG_MULTI 32024 -#define STR_WAITINGLINK 32028 -#define STR_EDIT_APPLET 32029 - - -#define FL_CHOICE 15 -#define LB_INSERT_LIST 7 - -#define MD_PASTE_OBJECT 32001 -#define S_OBJECT 1 -#define RB_PASTE 20 -#define RB_PASTE_LINK 21 -#define FT_OBJECT_SOURCE 22 -#define FT_SOURCE 23 - -#define MD_UPDATE_BASELINKS 32002 -#define LB_LINKS 30 -#define FT_FILES 31 -#define FT_LINKS 32 -#define FT_TYPE 33 -#define FT_STATUS 34 -#define PB_UPDATE_NOW 35 -#define PB_OPEN_SOURCE 36 -#define PB_CHANGE_SOURCE 37 -#define PB_BREAK_LINK 38 -#define FT_SOURCE2 39 -#define FT_TYPE2 40 -#define FT_UPDATE 41 -#define RB_AUTOMATIC 42 -#define RB_MANUAL 43 -#define FT_FULL_SOURCE_NAME 44 -#define FT_FULL_TYPE_NAME 45 -#define GB_LINK 46 -#define FT_FILES2 47 -#define FT_FULL_FILE_NAME 48 - -#define MD_LINKEDIT 32004 -#define ED_FULL_SOURCE_NAME 1 - -#define ED_FILEPATH 10 -#define BTN_FILEPATH 11 -#define CB_FILELINK 12 - -#define MD_INSERT_OBJECT_PLUGIN 32008 -#define ED_FILEURL 10 -#define BTN_FILEURL 11 -#define GB_FILEURL 12 -#define ED_PLUGINS_OPTIONS 20 -#define GB_PLUGINS_OPTIONS 21 - -#define MD_INSERT_OBJECT_APPLET 32009 -#define FT_CLASSFILE 10 -#define ED_CLASSFILE 11 -#define FT_CLASSLOCATION 12 -#define ED_CLASSLOCATION 12 -#define BTN_CLASS 13 -#define GB_CLASS 14 -#define ED_APPLET_OPTIONS 20 -#define GB_APPLET_OPTIONS 21 - -#define MD_INSERT_OLEOBJECT 32010 -#define RB_NEW_OBJECT 10 -#define RB_OBJECT_FROMFILE 11 -#define LB_OBJECTTYPE 12 -#define GB_OBJECT 13 -#define STR_FILE 14 - -#define MD_INSERT_OBJECT_IFRAME 32011 -#define FT_FRAMENAME 3 -#define ED_FRAMENAME 4 -#define FT_URL 5 -#define ED_URL 6 -#define BT_FILEOPEN 7 -#define NM_MARGINHEIGHT 8 -#define FT_MARGINHEIGHT 9 -#define NM_MARGINWIDTH 10 -#define FT_MARGINWIDTH 11 -#define GB_MARGIN 12 -#define RB_SCROLLINGON 13 -#define RB_SCROLLINGOFF 14 -#define RB_SCROLLINGAUTO 15 -#define GB_SCROLLING 16 -#define GB_BORDER 17 -#define RB_FRMBORDER_ON 18 -#define RB_FRMBORDER_INHERIT 19 -#define RB_FRMBORDER_OFF 20 -#define CB_MARGINWIDTHDEFAULT 21 -#define CB_MARGINHEIGHTDEFAULT 22 -#define FL_SEP_LEFT 46 -#define FL_SEP_RIGHT 47 - diff --git a/cui/source/dialogs/svuidlg.src b/cui/source/dialogs/svuidlg.src deleted file mode 100644 index fa6b49be1..000000000 --- a/cui/source/dialogs/svuidlg.src +++ /dev/null @@ -1,741 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "svuidlg.hrc" - -ModalDialog MD_PASTE_OBJECT -{ - HelpID = "cui:ModalDialog:MD_PASTE_OBJECT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 282 , 135 ) ; // 12 under listbox - Text [ en-US ] = "Paste Special" ; - FixedText FT_SOURCE - { - Pos = MAP_APPFONT ( 6 , 11 ) ; - Size = MAP_APPFONT ( 30 , 10 ) ; - Text [ en-US ] = "Source:" ; - }; - FixedText FT_OBJECT_SOURCE - { - Pos = MAP_APPFONT ( 42 , 11 ) ; - Size = MAP_APPFONT ( 166 , 20 ) ; - WordBreak = TRUE ; - }; - RadioButton RB_PASTE - { - HelpID = "cui:RadioButton:MD_PASTE_OBJECT:RB_PASTE"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "~Insert as" ; - Check = TRUE ; - }; - RadioButton RB_PASTE_LINK - { - HelpID = "cui:RadioButton:MD_PASTE_OBJECT:RB_PASTE_LINK"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 78 , 48 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Link to" ; - }; - ListBox LB_INSERT_LIST - { - HelpID = "cui:ListBox:MD_PASTE_OBJECT:LB_INSERT_LIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 49 ) ; - Size = MAP_APPFONT ( 202 , 74 ) ; - }; - CheckBox CB_DISPLAY_AS_ICON - { - HelpID = "cui:CheckBox:MD_PASTE_OBJECT:CB_DISPLAY_AS_ICON"; - Hide = TRUE ; - Disable = TRUE ; - Pos = MAP_APPFONT ( 150 , 62 ) ; - Size = MAP_APPFONT ( 64 , 10 ) ; - Text [ en-US ] = "~As icon" ; - }; - PushButton PB_CHANGE_ICON - { - HelpID = "cui:PushButton:MD_PASTE_OBJECT:PB_CHANGE_ICON"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 150 , 111 ) ; - Size = MAP_APPFONT ( 64 , 14 ) ; - Text [ en-US ] = "~Other Icon..." ; - }; - FixedLine FL_CHOICE - { - Pos = MAP_APPFONT ( 6 , 38 ) ; - Size = MAP_APPFONT ( 214 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Selection" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 226 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 226 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 226 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String S_OBJECT - { - Text [ en-US ] = "Object" ; - }; -}; -ModalDialog MD_UPDATE_BASELINKS -{ - HelpID = "cui:ModalDialog:MD_UPDATE_BASELINKS"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 337 , 166 ) ; - Text [ en-US ] = "Edit Links" ; - Moveable = TRUE ; - FixedText FT_FILES - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "Source file" ; - }; - FixedText FT_LINKS - { - Pos = MAP_APPFONT ( 83 , 6 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Element:" ; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 150 , 6 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "Type" ; - }; - FixedText FT_STATUS - { - Pos = MAP_APPFONT ( 215 , 6 ) ; - Size = MAP_APPFONT ( 55 , 10 ) ; - Text [ en-US ] = "Status" ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 270 , 6 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Close" ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 270 , 26 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - PushButton PB_UPDATE_NOW - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_UPDATE_NOW"; - Pos = MAP_APPFONT ( 270 , 43 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Update" ; - }; - PushButton PB_OPEN_SOURCE - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_OPEN_SOURCE"; - Pos = MAP_APPFONT ( 270 , 60 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Open" ; - }; - PushButton PB_CHANGE_SOURCE - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_CHANGE_SOURCE"; - Pos = MAP_APPFONT ( 270 , 77 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - }; - PushButton PB_BREAK_LINK - { - HelpID = "cui:PushButton:MD_UPDATE_BASELINKS:PB_BREAK_LINK"; - Pos = MAP_APPFONT ( 270 , 94 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Break Link" ; - }; - FixedText FT_FILES2 - { - Pos = MAP_APPFONT ( 6 , 111 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Source file" ; - }; - FixedText FT_SOURCE2 - { - Pos = MAP_APPFONT ( 6 , 124 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Element:" ; - }; - FixedText FT_TYPE2 - { - Pos = MAP_APPFONT ( 6 , 137 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Type:" ; - }; - FixedText FT_UPDATE - { - Pos = MAP_APPFONT ( 6 , 150 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Update:" ; - }; - RadioButton RB_AUTOMATIC - { - HelpID = "cui:RadioButton:MD_UPDATE_BASELINKS:RB_AUTOMATIC"; - Pos = MAP_APPFONT ( 70 , 150 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Automatic" ; - }; - RadioButton RB_MANUAL - { - HelpID = "cui:RadioButton:MD_UPDATE_BASELINKS:RB_MANUAL"; - Pos = MAP_APPFONT ( 133 , 150 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "Ma~nual" ; - }; - FixedText FT_FULL_FILE_NAME - { - Pos = MAP_APPFONT ( 70 , 111 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - FixedText FT_FULL_SOURCE_NAME - { - Pos = MAP_APPFONT ( 70 , 124 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - FixedText FT_FULL_TYPE_NAME - { - Pos = MAP_APPFONT ( 70 , 137 ) ; - Size = MAP_APPFONT ( 225 , 10 ) ; - }; - String STR_AUTOLINK - { - Text [ en-US ] = "Automatic" ; - }; - String STR_MANUALLINK - { - Text [ en-US ] = "Manual" ; - }; - String STR_BROKENLINK - { - Text [ en-US ] = "Not available" ; - }; - String STR_GRAPHICLINK - { - Text [ en-US ] = "Graphic" ; - }; - String STR_BUTTONCLOSE - { - Text [ en-US ] = "~Close" ; - }; - String STR_CLOSELINKMSG - { - Text [ en-US ] = "Are you sure you want to remove the selected link?" ; - }; - String STR_CLOSELINKMSG_MULTI - { - Text [ en-US ] = "Are you sure you want to remove the selected link?" ; - }; - String STR_WAITINGLINK - { - Text [ en-US ] = "Waiting"; - }; -}; -ModalDialog MD_LINKEDIT -{ - HelpID = "cui:ModalDialog:MD_LINKEDIT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 222 , 58 ) ; - Text [ en-US ] = "Modify Link" ; - Moveable = TRUE ; - OKButton 1 - { - Pos = MAP_APPFONT ( 165 , 5 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 165 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedText FT_FULL_TYPE_NAME - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 5 , 5 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - }; - FixedText 2 - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 5 , 20 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "Exchange source:" ; - }; - Edit ED_FULL_SOURCE_NAME - { - HelpID = "cui:Edit:MD_LINKEDIT:ED_FULL_SOURCE_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 5 , 35 ) ; - Size = MAP_APPFONT ( 155 , 12 ) ; - Text [ en-US ] = "Edit" ; - }; -}; -ModalDialog MD_INSERT_OLEOBJECT -{ - HelpID = "cui:ModalDialog:MD_INSERT_OLEOBJECT"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 105 ) ; - Moveable = TRUE ; - RadioButton RB_NEW_OBJECT - { - HelpID = "cui:RadioButton:MD_INSERT_OLEOBJECT:RB_NEW_OBJECT"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - Text [ en-US ] = "~Create new" ; - }; - RadioButton RB_OBJECT_FROMFILE - { - HelpID = "cui:RadioButton:MD_INSERT_OLEOBJECT:RB_OBJECT_FROMFILE"; - Pos = MAP_APPFONT ( 90 , 6 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - Text [ en-US ] = "Create from ~file" ; - }; - ListBox LB_OBJECTTYPE - { - HelpID = "cui:ListBox:MD_INSERT_OLEOBJECT:LB_OBJECTTYPE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 204 , 60 ) ; - }; - Edit ED_FILEPATH - { - HelpID = "cui:Edit:MD_INSERT_OLEOBJECT:ED_FILEPATH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_FILEPATH - { - HelpID = "cui:PushButton:MD_INSERT_OLEOBJECT:BTN_FILEPATH"; - Pos = MAP_APPFONT ( 166 , 48 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Search..." ; - }; - CheckBox CB_FILELINK - { - HelpID = "cui:CheckBox:MD_INSERT_OLEOBJECT:CB_FILELINK"; - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 138 , 10 ) ; - Text [ en-US ] = "~Link to file" ; - }; - FixedLine GB_OBJECT - { - Pos = MAP_APPFONT ( 6 , 22 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Object type" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - TabStop = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - String STR_FILE - { - Text [ en-US ] = "File" ; - }; - Text [ en-US ] = "Insert OLE Object" ; -}; -ModalDialog MD_INSERT_OBJECT_PLUGIN -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_PLUGIN"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 123 ) ; - Moveable = TRUE ; - Edit ED_FILEURL - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_PLUGIN:ED_FILEURL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_FILEURL - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_PLUGIN:BTN_FILEURL"; - Pos = MAP_APPFONT ( 166 , 29 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Browse..." ; - }; - FixedLine GB_FILEURL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "File / URL" ; - }; - MultiLineEdit ED_PLUGINS_OPTIONS - { - HelpID = "cui:MultiLineEdit:MD_INSERT_OBJECT_PLUGIN:ED_PLUGINS_OPTIONS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 204 , 45 ) ; - VScroll = TRUE ; - IgnoreTab = TRUE; - }; - FixedLine GB_PLUGINS_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 55 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - Text [ en-US ] = "Insert Plug-in" ; -}; -ModalDialog MD_INSERT_OBJECT_APPLET -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_APPLET"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 284 , 164 ) ; - Moveable = TRUE ; - FixedText FT_CLASSFILE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 204 , 10 ) ; - Text [ en-US ] = "~Class" ; - }; - Edit ED_CLASSFILE - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_APPLET:ED_CLASSFILE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - FixedText FT_CLASSLOCATION - { - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 204 , 10 ) ; - Text [ en-US ] = "Class ~Location" ; - }; - Edit ED_CLASSLOCATION - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_APPLET:ED_CLASSLOCATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 204 , 12 ) ; - }; - PushButton BTN_CLASS - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_APPLET:BTN_CLASS"; - Pos = MAP_APPFONT ( 166 , 70 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Search..." ; - }; - FixedLine GB_CLASS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "File" ; - }; - MultiLineEdit ED_APPLET_OPTIONS - { - HelpID = "cui:MultiLineEdit:MD_INSERT_OBJECT_APPLET:ED_APPLET_OPTIONS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 204 , 45 ) ; - VScroll = TRUE ; - IgnoreTab = TRUE; - }; - FixedLine GB_APPLET_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 96 ) ; - Size = MAP_APPFONT ( 216 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 228 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 228 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 228 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - Text [ en-US ] = "Insert Applet" ; -}; -Control TB_LINKS -{ - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 21 ) ; - Size = MAP_APPFONT ( 257 , 87 ) ; - TabStop = TRUE ; - ClipChildren = TRUE ; -}; - -ModalDialog MD_INSERT_OBJECT_IFRAME -{ - HelpID = "cui:ModalDialog:MD_INSERT_OBJECT_IFRAME"; - Size = MAP_APPFONT ( 302 , 98 ) ; - Hide = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Floating Frame Properties" ; - OKButton 1 - { - Pos = MAP_APPFONT ( 246 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 246 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton 1 - { - Pos = MAP_APPFONT ( 246 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - FixedText FT_FRAMENAME - { - Pos = MAP_APPFONT ( 6 , 7 ) ; - Size = MAP_APPFONT ( 36 , 10 ) ; - Text [ en-US ] = "~Name" ; - }; - Edit ED_FRAMENAME - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_IFRAME:ED_FRAMENAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 45 , 6 ) ; - Size = MAP_APPFONT ( 178 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 6 , 25 ) ; - Size = MAP_APPFONT ( 36 , 10 ) ; - Text [ en-US ] = "~Contents" ; - }; - Edit ED_URL - { - HelpID = "cui:Edit:MD_INSERT_OBJECT_IFRAME:ED_URL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 45 , 24 ) ; - Size = MAP_APPFONT ( 178 , 12 ) ; - TabStop = TRUE ; - }; - PushButton BT_FILEOPEN - { - HelpID = "cui:PushButton:MD_INSERT_OBJECT_IFRAME:BT_FILEOPEN"; - Pos = MAP_APPFONT ( 226 , 24 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "~..." ; - TabStop = TRUE ; - }; - RadioButton RB_SCROLLINGON - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGON"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "~On" ; - }; - RadioButton RB_SCROLLINGOFF - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGOFF"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "O~ff" ; - }; - RadioButton RB_SCROLLINGAUTO - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_SCROLLINGAUTO"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 79 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - Text [ en-US ] = "Au~tomatic" ; - }; - FixedLine GB_SCROLLING - { - Pos = MAP_APPFONT ( 6 , 42 ) ; - Size = MAP_APPFONT ( 63 , 8 ) ; - Text [ en-US ] = "Scroll bar" ; - }; - RadioButton RB_FRMBORDER_ON - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_FRMBORDER_ON"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 81 , 53 ) ; - Size = MAP_APPFONT ( 42 , 10 ) ; - Text [ en-US ] = "On" ; - }; - RadioButton RB_FRMBORDER_OFF - { - HelpID = "cui:RadioButton:MD_INSERT_OBJECT_IFRAME:RB_FRMBORDER_OFF"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 81 , 66 ) ; - Size = MAP_APPFONT ( 42 , 10 ) ; - Text [ en-US ] = "Off" ; - }; - FixedLine FL_SEP_LEFT - { - Pos = MAP_APPFONT ( 70 , 51 ) ; - Size = MAP_APPFONT ( 4 , 38 ) ; - }; - FixedLine GB_BORDER - { - Pos = MAP_APPFONT ( 75 , 42 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Border" ; - }; - FixedText FT_MARGINWIDTH - { - Pos = MAP_APPFONT ( 136 , 56 ) ; - Size = MAP_APPFONT ( 28 , 10 ) ; - Text [ en-US ] = "~Width" ; - }; - NumericField NM_MARGINWIDTH - { - HelpID = "cui:NumericField:MD_INSERT_OBJECT_IFRAME:NM_MARGINWIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 167 , 54 ) ; - Size = MAP_APPFONT ( 20 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 99 ; - Last = 10 ; - SpinSize = 1 ; - }; - CheckBox CB_MARGINWIDTHDEFAULT - { - HelpID = "cui:CheckBox:MD_INSERT_OBJECT_IFRAME:CB_MARGINWIDTHDEFAULT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 190 , 56 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Default" ; - }; - FixedText FT_MARGINHEIGHT - { - Pos = MAP_APPFONT ( 136 , 74 ) ; - Size = MAP_APPFONT ( 28 , 10 ) ; - Text [ en-US ] = "H~eight" ; - }; - NumericField NM_MARGINHEIGHT - { - HelpID = "cui:NumericField:MD_INSERT_OBJECT_IFRAME:NM_MARGINHEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 167 , 72 ) ; - Size = MAP_APPFONT ( 20 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 99 ; - Last = 10 ; - SpinSize = 1 ; - }; - CheckBox CB_MARGINHEIGHTDEFAULT - { - HelpID = "cui:CheckBox:MD_INSERT_OBJECT_IFRAME:CB_MARGINHEIGHTDEFAULT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 190 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "Defa~ult" ; - }; - FixedLine FL_SEP_RIGHT - { - Pos = MAP_APPFONT ( 125 , 51 ) ; - Size = MAP_APPFONT ( 4 , 38 ) ; - }; - FixedLine GB_MARGIN - { - Pos = MAP_APPFONT ( 130 , 42 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Spacing to contents" ; - }; -}; - -String MD_INSERT_OBJECT_IFRAME -{ - Text [ en-US ] = "Select File for Floating Frame" ; -}; - -String STR_EDIT_APPLET -{ - Text [ en-US ] = "Edit Applet" ; -}; - diff --git a/cui/source/dialogs/tbxform.src b/cui/source/dialogs/tbxform.src deleted file mode 100644 index 8af5e3b0b..000000000 --- a/cui/source/dialogs/tbxform.src +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "fmsearch.hrc" - -ModalDialog RID_SVX_DLG_INPUTRECORDNO -{ - HelpID = "cui:ModalDialog:RID_SVX_DLG_INPUTRECORDNO"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 130 , 45 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Record Number"; - - FixedText 1 - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 70 , 12 ) ; - Text [ en-US ] = "go to record"; - }; - NumericField 1 - { - HelpID = "cui:NumericField:RID_SVX_DLG_INPUTRECORDNO:1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 6 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 6 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 74 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx deleted file mode 100644 index c74432556..000000000 --- a/cui/source/dialogs/thesdlg.cxx +++ /dev/null @@ -1,694 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "thesdlg.hrc" -#include "thesdlg.hxx" -#include "thesdlg_impl.hxx" -#include "cuires.hrc" -#include "dialmgr.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using ::rtl::OUString; - -#define A2S(x) String::CreateFromAscii( x ) - -// class LookUpComboBox_Impl -------------------------------------------------- - -LookUpComboBox_Impl::LookUpComboBox_Impl( - Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : - ComboBox (pParent, rResId), - m_rDialogImpl( rImpl ) -{ - m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); - m_aModifyTimer.SetTimeout( 500 ); - - EnableAutocomplete( sal_False ); -} - -LookUpComboBox_Impl::~LookUpComboBox_Impl() -{ -} - -void LookUpComboBox_Impl::Modify() -{ - m_aModifyTimer.Start(); -} - -IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) -{ - m_rDialogImpl.LookUp( GetText() ); - m_aModifyTimer.Stop(); - return 0; -} - -// class ReplaceEdit_Impl -------------------------------------------------- - -ReplaceEdit_Impl::ReplaceEdit_Impl( Window *pParent, const ResId &rResId ) - : Edit(pParent, rResId) - , m_pBtn(NULL) -{ -} - -ReplaceEdit_Impl::~ReplaceEdit_Impl() -{ -} - -void ReplaceEdit_Impl::Modify() -{ - if (m_pBtn) - m_pBtn->Enable( GetText().Len() > 0 ); -} - -void ReplaceEdit_Impl::SetText( const XubString& rStr ) -{ - Edit::SetText( rStr ); - Modify(); -} - -void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) -{ - Edit::SetText( rStr, rNewSelection ); - Modify(); -} - -// class ThesaurusAlternativesCtrl_Impl ---------------------------------- - -AlternativesString_Impl::AlternativesString_Impl( - ThesaurusAlternativesCtrl_Impl &rControl, - SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : - - SvLBoxString( pEntry, nFlags, rStr ), - m_rControlImpl( rControl ) -{ -} - -void AlternativesString_Impl::Paint( - const Point& rPos, - SvLBox& rDev, sal_uInt16, - SvLBoxEntry* pEntry ) -{ - AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); - Point aPos( rPos ); - Font aOldFont( rDev.GetFont()); - if (pData && pData->IsHeader()) - { - Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - rDev.SetFont( aFont ); - aPos.X() = 0; - } - else - aPos.X() += 5; - rDev.DrawText( aPos, GetText() ); - rDev.SetFont( aOldFont ); -} - -ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( - Window* pParent, - SvxThesaurusDialog_Impl &rImpl ) : - SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), - m_rDialogImpl( rImpl ) -{ - SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); - SetHighlightRange(); -} - -ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() -{ - ClearExtraData(); -} - -void ThesaurusAlternativesCtrl_Impl::ClearExtraData() -{ - UserDataMap_t aEmpty; - m_aUserData.swap( aEmpty ); -} - -void ThesaurusAlternativesCtrl_Impl::SetExtraData( - const SvLBoxEntry *pEntry, - const AlternativesExtraData &rData ) -{ - if (!pEntry) - return; - - UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); - if (aIt != m_aUserData.end()) - aIt->second = rData; - else - m_aUserData[ pEntry ] = rData; -} - -AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( - const SvLBoxEntry *pEntry ) -{ - AlternativesExtraData *pRes = NULL; - UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); - if (aIt != m_aUserData.end()) - pRes = &aIt->second; - return pRes; -} - -SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - String aText; - if (bIsHeader && nVal >= 0) - { - aText = String::CreateFromInt32( nVal ); - aText += A2S( ". " ); - } - pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column - aText += rText; - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash - pEntry->AddItem( new AlternativesString_Impl( *this, pEntry, 0, aText ) ); - - SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) ); - GetModel()->Insert( pEntry ); - - if (bIsHeader) - GetViewDataEntry( pEntry )->SetSelectable( false ); - - return pEntry; -} - -void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) -{ - const KeyCode& rKey = rKEvt.GetKeyCode(); - - if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) - GetParent()->KeyInput( rKEvt ); // parent will close dialog... - else if (rKey.GetCode() == KEY_SPACE) - m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry - else if (GetEntryCount()) - SvxCheckListBox::KeyInput( rKEvt ); -} - -void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) -{ - if (!m_rDialogImpl.m_bWordFound) - { - Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); - aTextSize = LogicToPixel( aTextSize ); - Point aPos; - aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; - aPos.Y() += GetSizePixel().Height() / 2; - aPos = PixelToLogic( aPos ); - DrawText( aPos, m_rDialogImpl.aErrStr ); - - } - else - SvxCheckListBox::Paint( rRect ); -} - -// struct SvxThesaurusDialog_Impl ---------------------------------------- - -SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : - m_pDialog ( pDialog ), - aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), - aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), - aWordText ( pDialog, CUI_RES( FT_WORD ) ), - aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), - m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), - m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), - aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), - aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), - aFL ( pDialog, CUI_RES( FL_VAR ) ), - aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), - aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), - aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), - aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), - aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), - aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), - xThesaurus ( NULL ), - aLookUpText (), - nLookUpLanguage ( LANGUAGE_NONE ), - m_bWordFound( false ) -{ - // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog - - aReplaceEdit.SetButton( &aReplaceBtn ); - - aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); - aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); - aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); - m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); - m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); - - Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); -} - -SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() -{ - delete aLangMBtn.GetPopupMenu(); -} - -uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( - OUString& rTerm, - const lang::Locale& rLocale, - const beans::PropertyValues& rProperties ) - throw(lang::IllegalArgumentException, uno::RuntimeException) -{ - uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( - xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); - - // text with '.' at the end? - if (0 == aMeanings.getLength() && rTerm.getLength() && - rTerm.getStr()[ rTerm.getLength() - 1 ] == '.') - { - // try again without trailing '.' chars. It may be a word at the - // end of a sentence and not an abbreviation... - String aTxt( rTerm ); - aTxt.EraseTrailingChars( '.' ); - aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); - if (aMeanings.getLength()) - { - rTerm = aTxt; - } - } - - return aMeanings; -} - -bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() -{ - lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); - uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( - aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); - const sal_Int32 nMeanings = aMeanings.getLength(); - const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); - - m_pAlternativesCT->SetUpdateMode( sal_False ); - - // clear old user data of control before creating new ones via AddEntry below - m_pAlternativesCT->ClearExtraData(); - - m_pAlternativesCT->Clear(); - for (sal_Int32 i = 0; i < nMeanings; ++i) - { - OUString rMeaningTxt = pMeanings[i]->getMeaning(); - uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); - const sal_Int32 nSynonyms = aSynonyms.getLength(); - const OUString *pSynonyms = aSynonyms.getConstArray(); - DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); - DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); - - m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); - for (sal_Int32 k = 0; k < nSynonyms; ++k) - m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); - } - - m_pAlternativesCT->SetUpdateMode( sal_True ); - - return nMeanings > 0; -} - -void SvxThesaurusDialog_Impl::LookUp( const String &rText ) -{ - if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same - aWordCB.SetText( rText ); - LookUp_Impl(); -} - -IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) -{ - if (pBtn && aLookUpHistory.size() >= 2) - { - aLookUpHistory.pop(); // remove current look up word from stack - aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word - aLookUpHistory.pop(); - LookUp_Impl(); - } - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) -{ - PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); - if (pMenu && pBtn) - { - sal_uInt16 nItem = pBtn->GetCurItemId(); - String aLangText( pMenu->GetItemText( nItem ) ); - LanguageType nLang = SvtLanguageTable().GetType( aLangText ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) - nLookUpLanguage = nLang; - m_pDialog->SetWindowTitle( nLang ); - UpdateVendorImage(); - LookUp_Impl(); - } - return 0; -} - -void SvxThesaurusDialog_Impl::LookUp_Impl() -{ - String aText( aWordCB.GetText() ); - - aLookUpText = OUString( aText ); - if (aLookUpText.getLength() > 0 && - (aLookUpHistory.empty() || aLookUpText != aLookUpHistory.top())) - aLookUpHistory.push( aLookUpText ); - - m_bWordFound = UpdateAlternativesBox_Impl(); - m_pAlternativesCT->Enable( m_bWordFound ); - - if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) - aWordCB.InsertEntry( aText ); - - aReplaceEdit.SetText( String() ); - aLeftBtn.Enable( aLookUpHistory.size() > 1 ); -} - -IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) -{ - if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys - { - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - String aStr( pBox->GetEntry( nPos ) ); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - aWordCB.SetText( aStr ); - LookUp_Impl(); - } - - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) -{ - SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; - if (pEntry) - { - AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); - String aStr; - if (pData && !pData->IsHeader()) - { - aStr = pData->GetText(); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - } - aReplaceEdit.SetText( aStr ); - } - return 0; -} - -IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) -{ - SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; - if (pEntry) - { - AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); - String aStr; - if (pData && !pData->IsHeader()) - { - aStr = pData->GetText(); - aStr = linguistic::GetThesaurusReplaceText( aStr ); - } - - aWordCB.SetText( aStr ); - if (aStr.Len() > 0) - LookUp_Impl(); - } - - //! workaround to set the selection since calling SelectEntryPos within - //! the double click handler does not work - Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); - return 0; -} - -IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) -{ - (void) pThis; - if (pBox && pBox->GetEntryCount() >= 2) - pBox->SelectEntryPos( 1 ); // pos 0 is a 'header' that is not selectable - return 0; -} - -//////////////////////////////////////////////////////////// - -static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) -{ - Image aRes; - - OUString aTmp; - osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); - - Graphic aGraphic; - const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); - if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) - { - aRes = Image( aGraphic.GetBitmapEx() ); - } - return aRes; -} - -static String lcl_GetThesImplName( const lang::Locale &rLocale ) -{ - String aRes; - - uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; - try - { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); - - DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); - if (xLngMgr.is()) - { - uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.Thesaurus")), rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - } - } - catch (uno::Exception &e) - { - (void) e; - DBG_ASSERT( 0, "failed to get thesaurus" ); - } - - return aRes; -} - -void SvxThesaurusDialog_Impl::UpdateVendorImage() -{ - m_pDialog->SetUpdateMode( sal_False ); - - SvtLinguConfig aCfg; - if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) - { - Image aImage; - String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); - OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName ) ); - if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) - aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); - else - aImage = aVendorDefaultImage; - aVendorImageFI.SetImage( aImage ); - } - - m_pDialog->SetUpdateMode( sal_True ); -} - -IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) -{ - pThis->m_pDialog->SetUpdateMode( sal_False ); - - SvtLinguConfig aCfg; - if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) - { - Image aImage( pThis->aVendorDefaultImage ); - pThis->aVendorImageFI.SetImage( aImage ); - pThis->aVendorImageFI.Show(); - - // move down visible controls according to the vendor images height - Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); - Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); - if (aImageSize.Height()) - { - aVendorSize.Height() = aImageSize.Height(); - if(aVendorSize.Width() < aImageSize.Width()) - aVendorSize.Width() = aImageSize.Width(); - pThis->aVendorImageFI.SetSizePixel( aVendorSize ); - } - const sal_Int32 nDiff = aVendorSize.Height(); - pThis->aVendorImageFI.SetSizePixel( aVendorSize ); - Control* aControls[] = { - &pThis->aLeftBtn, - &pThis->aWordText, - &pThis->aWordCB, - &pThis->m_aAlternativesText, - pThis->m_pAlternativesCT.get(), - &pThis->aReplaceText, - &pThis->aReplaceEdit, - &pThis->aFL, - &pThis->aHelpBtn, - &pThis->aLangMBtn, - &pThis->aReplaceBtn, - &pThis->aCancelBtn, - 0 - }; - sal_Int32 nControl = 0; - while (aControls[nControl]) - { - Point aPos = aControls[nControl]->GetPosPixel(); - aPos.Y() += nDiff; - aControls[nControl]->SetPosPixel(aPos); - ++nControl; - } - Size aDlgSize = pThis->m_pDialog->GetSizePixel(); - aDlgSize.Height() += nDiff; - pThis->m_pDialog->SetSizePixel( aDlgSize ); - pThis->m_pDialog->Invalidate(); - } - - pThis->UpdateVendorImage(); - pThis->m_pDialog->SetUpdateMode( sal_True ); - - return 0; -}; - -// class SvxThesaurusDialog ---------------------------------------------- - -SvxThesaurusDialog::SvxThesaurusDialog( - Window* pParent, - uno::Reference< linguistic2::XThesaurus > xThes, - const String &rWord, - LanguageType nLanguage ) : - - SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) -{ - m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); - - m_pImpl->xThesaurus = xThes; - m_pImpl->aLookUpText = OUString( rWord ); - m_pImpl->nLookUpLanguage = nLanguage; - if (rWord.Len() > 0) - m_pImpl->aLookUpHistory.push( rWord ); - - FreeResource(); - - OUString aTmp( rWord ); - linguistic::RemoveHyphens( aTmp ); - linguistic::ReplaceControlChars( aTmp ); - String aTmp2( aTmp ); - m_pImpl->aReplaceEdit.SetText( aTmp2 ); - m_pImpl->aWordCB.InsertEntry( aTmp2 ); - - m_pImpl->LookUp( aTmp2 ); - m_pImpl->m_pAlternativesCT->GrabFocus(); - m_pImpl->aLeftBtn.Enable( sal_False ); - - // fill language menu button list - SvtLanguageTable aLangTab; - uno::Sequence< lang::Locale > aLocales; - if (m_pImpl->xThesaurus.is()) - aLocales = m_pImpl->xThesaurus->getLocales(); - const sal_Int32 nLocales = aLocales.getLength(); - const lang::Locale *pLocales = aLocales.getConstArray(); - delete m_pImpl->aLangMBtn.GetPopupMenu(); - PopupMenu* pMenu = new PopupMenu; - pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); - std::vector< OUString > aLangVec; - for (sal_Int32 i = 0; i < nLocales; ++i ) - { - const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); - DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); - aLangVec.push_back( aLangTab.GetString( nLang ) ); - } - std::sort( aLangVec.begin(), aLangVec.end() ); - for (size_t i = 0; i < aLangVec.size(); ++i) - pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 - m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); - - SetWindowTitle( nLanguage ); - - // disable controls if service is missing - if (!m_pImpl->xThesaurus.is()) - Enable( sal_False ); -} - -SvxThesaurusDialog::~SvxThesaurusDialog() -{ -} - -void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) -{ - // Sprache anpassen - String aStr( GetText() ); - aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); - aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); - aStr += SvtLanguageTable().GetLanguageString( nLanguage ); - aStr.Append( sal_Unicode( ')' ) ); - SetText( aStr ); // set window title -} - -String SvxThesaurusDialog::GetWord() -{ - return m_pImpl->aReplaceEdit.GetText(); -} - -sal_uInt16 SvxThesaurusDialog::GetLanguage() const -{ - return m_pImpl->nLookUpLanguage; -} - -void SvxThesaurusDialog::Apply() -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/thesdlg.hrc b/cui/source/dialogs/thesdlg.hrc deleted file mode 100644 index 091838e64..000000000 --- a/cui/source/dialogs/thesdlg.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_THESDLG_HRC -#define _SVX_THESDLG_HRC - -// defines --------------------------------------------------------------- - -#define BTN_LEFT 9 -#define BTN_THES_OK 10 -#define BTN_THES_CANCEL 11 -#define MB_LANGUAGE 12 -#define BTN_THES_HELP 13 -#define FT_WORD 15 -#define CB_WORD 16 -#define FT_REPL 21 -#define ED_REPL 22 -#define FL_VAR 23 -#define FT_THES_ALTERNATIVES 24 -#define CT_THES_ALTERNATIVES 25 -#define IMG_VENDOR 26 -#define IMG_DEFAULT_VENDOR 27 - -#define STR_ERR_TEXTNOTFOUND 101 - -#endif diff --git a/cui/source/dialogs/thesdlg.src b/cui/source/dialogs/thesdlg.src deleted file mode 100644 index 67fdced0f..000000000 --- a/cui/source/dialogs/thesdlg.src +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "cuires.hrc" -#include "thesdlg.hrc" -#include "helpid.hrc" -#include // SID_THESAURUS - - - // RID_SVXDLG_THES ------------------------------------------------------- -ModalDialog RID_SVXDLG_THESAURUS -{ - HelpId = CMD_SID_THESAURUS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 235, 230 ) ; - Text [ en-US ] = "Thesaurus" ; - SvLook = TRUE ; - Moveable = TRUE ; - - FixedImage IMG_VENDOR - { - Pos = MAP_APPFONT ( 0, 0 ) ; - Size = MAP_APPFONT ( 235, 0 ) ; // correct size will be applied at runtime - Hide = TRUE; - }; - - ImageButton BTN_LEFT - { - HelpID = "cui:ImageButton:RID_SVXDLG_THESAURUS:BTN_LEFT"; - Pos = MAP_APPFONT ( 5 , 15 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - TABSTOP = TRUE ; - SYMBOL = IMAGEBUTTON_ARROW_LEFT ; - }; - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 24 , 5 ) ; - Size = MAP_APPFONT ( 143 , 8 ) ; - Text [ en-US ] = "~Current word" ; - LEFT = TRUE ; - }; - ComboBox CB_WORD - { - HelpID = "cui:ComboBox:RID_SVXDLG_THESAURUS:CB_WORD"; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 24 , 16 ) ; - Size = MAP_APPFONT ( 141 , 60 ) ; // have drop down space for several lines - }; - MenuButton MB_LANGUAGE - { - HelpID = "cui:MenuButton:RID_SVXDLG_THESAURUS:MB_LANGUAGE"; - Pos = MAP_APPFONT ( 170 , 16 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Language" ; - }; - - FixedText FT_THES_ALTERNATIVES - { - Pos = MAP_APPFONT ( 5 , 33 ) ; - Size = MAP_APPFONT ( 255 , 8 ) ; - Text [ en-US ] = "~Alternatives" ; - LEFT = TRUE ; - }; - Control CT_THES_ALTERNATIVES - { - HelpID = HID_CT_THES_ALTERNATIVES ; // also needed for automatic testing to find the control - Pos = MAP_APPFONT ( 5 , 45 ) ; - Size = MAP_APPFONT ( 225 , 121 ) ; - Border = TRUE; - TabStop = TRUE ; - }; - - FixedText FT_REPL - { - Pos = MAP_APPFONT ( 5 , 173 ) ; - Size = MAP_APPFONT ( 255 , 8 ) ; - Text [ en-US ] = "~Replace with" ; - LEFT = TRUE ; - }; - Edit ED_REPL - { - HelpID = "cui:Edit:RID_SVXDLG_THESAURUS:ED_REPL"; - BORDER = TRUE ; - Pos = MAP_APPFONT ( 5 , 184 ) ; - Size = MAP_APPFONT ( 225 , 12 ) ; - LEFT = TRUE ; - }; - FixedLine FL_VAR - { - Pos = MAP_APPFONT ( 0 , 200 ) ; - Size = MAP_APPFONT ( 235 , 8 ) ; - }; - - HelpButton BTN_THES_HELP - { - Pos = MAP_APPFONT ( 5 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - OkButton BTN_THES_OK - { - Pos = MAP_APPFONT ( 105 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Replace" ; - DefButton = TRUE ; - }; - CancelButton BTN_THES_CANCEL - { - Pos = MAP_APPFONT ( 170 , 210 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - }; - - String STR_ERR_TEXTNOTFOUND - { - Text [ en-US ] = "No alternatives found." ; - }; - - Image IMG_DEFAULT_VENDOR - { - ImageBitmap = Bitmap { File = "vendor01.png"; }; - }; -}; - diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx deleted file mode 100644 index a985b2e8c..000000000 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_THESDLG_IMPL_HXX -#define _SVX_THESDLG_IMPL_HXX - -#include "thesdlg.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -using namespace ::com::sun::star; -using ::rtl::OUString; - -class SvLBoxEntry; -class ThesaurusAlternativesCtrl_Impl; - - -// class LookUpComboBox_Impl -------------------------------------------------- - -class LookUpComboBox_Impl : public ComboBox -{ - Timer m_aModifyTimer; - Selection m_aSelection; - Button * m_pBtn; - SvxThesaurusDialog_Impl & m_rDialogImpl; - - // disable copy c-tor and assignment operator - LookUpComboBox_Impl( const LookUpComboBox_Impl & ); - LookUpComboBox_Impl & operator = ( const LookUpComboBox_Impl & ); - -public: - LookUpComboBox_Impl( Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ); - virtual ~LookUpComboBox_Impl(); - - DECL_LINK( ModifyTimer_Hdl, Timer * ); - - void SetButton( Button *pBtn ) { m_pBtn = pBtn; } - - // ComboBox - virtual void Modify(); -}; - -// class ReplaceEdit_Impl -------------------------------------------------- - -class ReplaceEdit_Impl : public Edit -{ - Button * m_pBtn; - - // disable copy c-tor and assignment operator - ReplaceEdit_Impl( const ReplaceEdit_Impl & ); - ReplaceEdit_Impl & operator = ( const ReplaceEdit_Impl & ); - -public: - ReplaceEdit_Impl( Window *pParent, const ResId &rResId ); - virtual ~ReplaceEdit_Impl(); - - void SetButton( Button *pBtn ) { m_pBtn = pBtn; } - - // Edit - virtual void Modify(); - virtual void SetText( const XubString& rStr ); - virtual void SetText( const XubString& rStr, const Selection& rNewSelection ); -}; - -// class ThesaurusAlternativesCtrl_Impl ---------------------------------- - -class AlternativesExtraData -{ - String sText; - bool bHeader; - -public: - AlternativesExtraData() : bHeader( false ) {} - AlternativesExtraData( const String &rText, bool bIsHeader ) : - sText(rText), - bHeader(bIsHeader) - { - } - - bool IsHeader() const { return bHeader; } - const String& GetText() const { return sText; } -}; - - -class AlternativesString_Impl : public SvLBoxString -{ - ThesaurusAlternativesCtrl_Impl & m_rControlImpl; -public: - - AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl, - SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ); - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry); -}; - - -class ThesaurusAlternativesCtrl_Impl : - public SvxCheckListBox -{ - SvxThesaurusDialog_Impl & m_rDialogImpl; - - typedef std::map< const SvLBoxEntry *, AlternativesExtraData > UserDataMap_t; - UserDataMap_t m_aUserData; - - // disable copy c-tor and assignment operator - ThesaurusAlternativesCtrl_Impl( const ThesaurusAlternativesCtrl_Impl & ); - ThesaurusAlternativesCtrl_Impl & operator = ( const ThesaurusAlternativesCtrl_Impl & ); - -public: - ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ); - virtual ~ThesaurusAlternativesCtrl_Impl(); - - - SvLBoxEntry * AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ); - - void ClearExtraData(); - void SetExtraData( const SvLBoxEntry *pEntry, const AlternativesExtraData &rData ); - AlternativesExtraData * GetExtraData( const SvLBoxEntry *pEntry ); - - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Paint( const Rectangle& rRect ); -}; - - -// struct SvxThesaurusDialog_Impl ---------------------------------------- - -struct SvxThesaurusDialog_Impl -{ - SvxThesaurusDialog * m_pDialog; - - FixedImage aVendorImageFI; - ImageButton aLeftBtn; - FixedText aWordText; - LookUpComboBox_Impl aWordCB; - FixedText m_aAlternativesText; - boost::shared_ptr< ThesaurusAlternativesCtrl_Impl > m_pAlternativesCT; - FixedText aReplaceText; - ReplaceEdit_Impl aReplaceEdit; - FixedLine aFL; - HelpButton aHelpBtn; - MenuButton aLangMBtn; - OKButton aReplaceBtn; - CancelButton aCancelBtn; - - String aErrStr; - Image aVendorDefaultImage; - - uno::Reference< linguistic2::XThesaurus > xThesaurus; - OUString aLookUpText; - LanguageType nLookUpLanguage; - std::stack< OUString > aLookUpHistory; - bool m_bWordFound; - - - // Handler - DECL_LINK( LeftBtnHdl_Impl, Button * ); - DECL_LINK( LanguageHdl_Impl, MenuButton * ); - DECL_LINK( LookUpHdl_Impl, Button * ); - DECL_LINK( WordSelectHdl_Impl, ComboBox * ); - DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * ); - DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * ); - - DECL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox * ); - DECL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl * ); - - - SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ); - ~SvxThesaurusDialog_Impl(); - - uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL - queryMeanings_Impl( ::rtl::OUString& rTerm, const lang::Locale& rLocale, const beans::PropertyValues& rProperties ) throw(lang::IllegalArgumentException, uno::RuntimeException); - - bool UpdateAlternativesBox_Impl(); - void UpdateVendorImage(); - void LookUp( const String &rText ); - void LookUp_Impl(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/winpluginlib.cxx b/cui/source/dialogs/winpluginlib.cxx deleted file mode 100644 index 40b6e4154..000000000 --- a/cui/source/dialogs/winpluginlib.cxx +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include -#if defined _MSC_VER -#pragma warning(pop) -#endif -#include -#include -#include - -#define SO_PATH_SIZE 4096 -#define MOZ_PLUGIN_DLL_NAME "npsopluginmi.dll" -extern "C" { -int lc_isInstalled(const char* realFilePath) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - char sSoPath[SO_PATH_SIZE]; - char sPluginPath[SO_PATH_SIZE]; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - if( ret == ERROR_FILE_NOT_FOUND) - return 1; - else - return -1; - } - ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ, &hStarOffice); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - if( ret == ERROR_FILE_NOT_FOUND) - return 1; - else - return -1; - } - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - DWORD dType = REG_SZ; - DWORD dSize = SO_PATH_SIZE; - ret = RegQueryValueEx (hStarOffice, "Path", NULL, &dType , (LPBYTE) sPluginPath, &dSize); - if(ret == ERROR_SUCCESS){ - if(strcmp(sPluginPath, sSoPath) == 0) - ret = 0; - else - ret = 1; - } - else - ret = -1; - } - else - ret = -1; - RegCloseKey(hStarOffice); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - return ret; -} - -int lc_uninstallPlugin(const char*) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - - ret = RegOpenKeyEx(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0", 0, KEY_READ|KEY_WRITE, &hStarOffice); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - if( ret == ERROR_FILE_NOT_FOUND) - return 0; - else - return -1; - } - RegCloseKey(hStarOffice); - ret = SHDeleteKey(hMozillaPlugins, "@sun.com/npsopluginmi;version=1.0"); - if(ret != ERROR_SUCCESS){ - ret = -1; - } - RegFlushKey(hMozillaPlugins); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - return ret; -} - -int lc_installPlugin(const char* realFilePath) -{ - HKEY hKeySoftware; - HKEY hMozillaPlugins; - HKEY hStarOffice; - char sSoPath[SO_PATH_SIZE]; - DWORD sState; - - LONG ret; - ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - ret = RegOpenKeyEx(HKEY_CURRENT_USER, "SOFTWARE", 0, KEY_READ|KEY_WRITE, &hKeySoftware); - if(ret != ERROR_SUCCESS){ - return -1; - } - } - ret = RegOpenKeyEx(hKeySoftware, "MozillaPlugins", 0, KEY_READ|KEY_WRITE, &hMozillaPlugins); - if(ret != ERROR_SUCCESS){ - RegCreateKeyEx(hKeySoftware, - "MozillaPlugins", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hMozillaPlugins, - &sState); - } - - ret = RegCreateKeyEx(hMozillaPlugins, - "@sun.com/npsopluginmi;version=1.0", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_WRITE, - NULL, - &hStarOffice, - &sState); - if(ret != ERROR_SUCCESS){ - RegCloseKey(hKeySoftware); - RegCloseKey(hMozillaPlugins); - return -1; - } - - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - - if((realFilePath == NULL) || (strlen(realFilePath) == 0) || (strlen(realFilePath) >= SO_PATH_SIZE)) - ret = -1; - else{ - sprintf(sSoPath,"%s", realFilePath); - ret = 0; - } - - // GetCurrentDirectory return the char number of the string - if(ret == 0){ - ret = RegSetValueEx( hStarOffice, "Path", 0, REG_SZ, (LPBYTE) sSoPath, strlen(sSoPath) + 1); - if(ret == ERROR_SUCCESS) - ret = 0; - else - ret = -1; - } - else - ret = -1; - RegFlushKey(hStarOffice); - RegFlushKey(hMozillaPlugins); - RegCloseKey(hStarOffice); - RegCloseKey(hMozillaPlugins); - RegCloseKey(hKeySoftware); - RegFlushKey(HKEY_LOCAL_MACHINE); - - return ret; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx deleted file mode 100644 index 92c544cea..000000000 --- a/cui/source/dialogs/zoom.cxx +++ /dev/null @@ -1,497 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -#define _SVX_ZOOM_CXX - -#include -#include "zoom.hrc" - -#include "zoom.hxx" -#include -#include -#include -#include -#include // RID_SVXDLG_ZOOM -#include - -#if ENABLE_LAYOUT -#undef CUI_RES -#define CUI_RES(x) #x -#undef SfxModalDialog -#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id ) -#endif /* ENABLE_LAYOUT */ - -// static ---------------------------------------------------------------- - -#define SPECIAL_FACTOR ((sal_uInt16)0xFFFF) - -// class SvxZoomDialog --------------------------------------------------- - -sal_uInt16 SvxZoomDialog::GetFactor() const -{ - if ( a100Btn.IsChecked() ) - return 100; - if ( aUserBtn.IsChecked() ) - return (sal_uInt16)aUserEdit.GetValue(); - else - return SPECIAL_FACTOR; -} - -// ----------------------------------------------------------------------- - -void SvxZoomDialog::SetFactor( sal_uInt16 nNewFactor, sal_uInt16 nBtnId ) -{ - 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::HideButton( sal_uInt16 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: - OSL_FAIL( "Falsche Button-Nummer!!!" ); - } -} - -// ----------------------------------------------------------------------- - -void SvxZoomDialog::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) -{ - DBG_ASSERT( nMin < nMax, "invalid limits" ); - aUserEdit.SetMin( nMin ); - aUserEdit.SetFirst( nMin ); - aUserEdit.SetMax( nMax ); - aUserEdit.SetLast( nMax ); -} - -// ----------------------------------------------------------------------- - -SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) : - - SfxModalDialog( pParent, CUI_RES( RID_SVXDLG_ZOOM ) ), - - aZoomFl ( this, CUI_RES( FL_ZOOM ) ), - aOptimalBtn ( this, CUI_RES( BTN_OPTIMAL ) ), - aWholePageBtn ( this, CUI_RES( BTN_WHOLE_PAGE ) ), - aPageWidthBtn ( this, CUI_RES( BTN_PAGE_WIDTH ) ), - a100Btn ( this, CUI_RES( BTN_100 ) ), - aUserBtn ( this, CUI_RES( BTN_USER ) ), - aUserEdit ( this, CUI_RES( ED_USER ) ), - - aViewLayoutFl ( this, CUI_RES( FL_VIEWLAYOUT ) ), - aAutomaticBtn ( this, CUI_RES( BTN_AUTOMATIC ) ), - aSingleBtn ( this, CUI_RES( BTN_SINGLE ) ), - aColumnsBtn ( this, CUI_RES( BTN_COLUMNS ) ), - aColumnsEdit ( this, CUI_RES( ED_COLUMNS ) ), - aBookModeChk ( this, CUI_RES( CHK_BOOK ) ), - - aBottomFl ( this, CUI_RES( FL_BOTTOM ) ), - aOKBtn ( this, CUI_RES( BTN_ZOOM_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_ZOOM_CANCEL ) ), - aHelpBtn ( this, CUI_RES( BTN_ZOOM_HELP ) ), - - rSet ( rCoreSet ), - pOutSet ( NULL ), - bModified ( sal_False ) - -{ -#if ENABLE_LAYOUT - SetHelpId (".uno: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 - sal_uInt16 nValue = 100; - sal_uInt16 nMin = 10; - sal_uInt16 nMax = 1000; - - // 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; - aUserEdit.SetMin( nMin ); - aUserEdit.SetFirst( nMin ); - aUserEdit.SetMax( nMax ); - aUserEdit.SetLast( nMax ); - aUserEdit.SetValue( nValue ); - - aUserEdit.SetAccessibleRelationLabeledBy( &aUserBtn ); - aUserEdit.SetAccessibleName(aUserBtn.GetText()); - aColumnsEdit.SetAccessibleRelationLabeledBy(&aColumnsBtn); - aColumnsEdit.SetAccessibleName(aColumnsBtn.GetText()); - aColumnsEdit.SetAccessibleRelationMemberOf(&aColumnsBtn); - aBookModeChk.SetAccessibleRelationLabeledBy(&aColumnsBtn); - aBookModeChk.SetAccessibleRelationMemberOf(&aColumnsBtn); - - const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); - - if ( rItem.ISA(SvxZoomItem) ) - { - const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem; - const sal_uInt16 nZoom = rZoomItem.GetValue(); - const SvxZoomType eType = rZoomItem.GetType(); - const sal_uInt16 nValSet = rZoomItem.GetValueSet(); - sal_uInt16 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 sal_uInt16 nZoom = ( (const SfxUInt16Item&)rItem ).GetValue(); - SetFactor( nZoom ); - } - - const SfxPoolItem* pViewLayoutItem = 0; - if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, sal_False, &pViewLayoutItem ) ) - { - const sal_uInt16 nColumns = static_cast(pViewLayoutItem)->GetValue(); - const bool bBookMode = static_cast(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(); - } - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxZoomDialog::~SvxZoomDialog() -{ - delete pOutSet; - pOutSet = 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn ) -{ - bModified |= sal_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 |= sal_True; - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn ) -{ - bModified |= sal_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 - { - OSL_FAIL( "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 |= sal_True; - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk ) -{ - if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() ) - return 0; - - bModified |= sal_True; - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn ) -{ - if ( bModified || &aOKBtn != pBtn ) - { - SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); - SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) ); - - if ( &aOKBtn == pBtn ) - { - sal_uInt16 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(aColumnsEdit.GetValue()) ); - aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() ); - } - } - else - { - OSL_FAIL( "Wrong Button" ); - return 0; - } - 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, - (sal_uInt16)aUserEdit.GetValue() ) ); - EndDialog( RET_OK ); - } - else - EndDialog( RET_CANCEL ); - return 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/dialogs/zoom.hrc b/cui/source/dialogs/zoom.hrc deleted file mode 100644 index dbb901f3e..000000000 --- a/cui/source/dialogs/zoom.hrc +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * 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/cui/source/dialogs/zoom.src b/cui/source/dialogs/zoom.src deleted file mode 100644 index 02448648a..000000000 --- a/cui/source/dialogs/zoom.src +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "zoom.hrc" -#include // for RID_SVXDLG_ZOOM -#include "helpid.hrc" - - // RID_SVXDLG_ZOOM ------------------------------------------------------- -ModalDialog RID_SVXDLG_ZOOM -{ - HelpId = CMD_SID_ATTR_ZOOM; - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 242 , 112 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Zoom & View Layout"; - FixedLine FL_ZOOM - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "Zoom factor"; - }; - RadioButton BTN_OPTIMAL - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_OPTIMAL"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "~Optimal" ; - }; - RadioButton BTN_WHOLE_PAGE - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_WHOLE_PAGE"; - Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "~Fit width and height" ; - }; - RadioButton BTN_PAGE_WIDTH - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_PAGE_WIDTH"; - Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 105, 10 ) ; - Text [ en-US ] = "Fit ~width" ; - }; - RadioButton BTN_100 - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_100"; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 105, 10 ) ; - Text = "~100 %" ; - }; - RadioButton BTN_USER - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_USER"; - Pos = MAP_APPFONT ( 12 , 67 ) ; - Size = MAP_APPFONT ( 72 , 10 ) ; - Text [ en-US ] = "~Variable" ; - }; - MetricField ED_USER - { - HelpID = "cui:MetricField:RID_SVXDLG_ZOOM:ED_USER"; - Pos = MAP_APPFONT ( 86 , 66 ) ; - Size = MAP_APPFONT ( 32 , 12 ) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 1 ; - }; - FixedLine FL_VIEWLAYOUT - { - Pos = MAP_APPFONT ( 124 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "View layout"; - }; - RadioButton BTN_AUTOMATIC - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_AUTOMATIC"; - Pos = MAP_APPFONT ( 130 , 14 ) ; - Size = MAP_APPFONT ( 106 , 10 ) ; - Text [ en-US ] = "~Automatic" ; - }; - RadioButton BTN_SINGLE - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_SINGLE"; - Pos = MAP_APPFONT ( 130, 27 ) ; - Size = MAP_APPFONT ( 106, 10 ) ; - Text [ en-US ] = "~Single page" ; - }; - RadioButton BTN_COLUMNS - { - HelpID = "cui:RadioButton:RID_SVXDLG_ZOOM:BTN_COLUMNS"; - Pos = MAP_APPFONT ( 130, 41 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "~Columns" ; - }; - MetricField ED_COLUMNS - { - HelpID = "cui:MetricField:RID_SVXDLG_ZOOM:ED_COLUMNS"; - Pos = MAP_APPFONT ( 209 , 40 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - SpinSize = 1 ; - Minimum = 1; - Maximum = 999; - }; - CheckBox CHK_BOOK - { - HelpID = "cui:CheckBox:RID_SVXDLG_ZOOM:CHK_BOOK"; - Pos = MAP_APPFONT ( 136 , 55 ) ; - Size = MAP_APPFONT ( 85 , 10 ) ; - Text [ en-US ] = "~Book mode" ; - }; - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 6 , 81 ) ; - Size = MAP_APPFONT ( 230 , 8 ) ; - }; - OKButton BTN_ZOOM_OK - { - Pos = MAP_APPFONT ( 77 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_ZOOM_CANCEL - { - Pos = MAP_APPFONT ( 130 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_ZOOM_HELP - { - Pos = MAP_APPFONT ( 186 , 92 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -// ********************************************************************** EOF diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx deleted file mode 100644 index bfa1b40e8..000000000 --- a/cui/source/factory/cuiexp.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgfact.hxx" -#include "sal/types.h" - -namespace cui -{ - static AbstractDialogFactory_Impl* pFactory=NULL; - AbstractDialogFactory_Impl* GetFactory() - { - if ( !pFactory ) - pFactory = new AbstractDialogFactory_Impl; - return pFactory; - } -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT VclAbstractDialogFactory* CreateDialogFactory() - { - return ::cui::GetFactory(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/cuiresmgr.cxx b/cui/source/factory/cuiresmgr.cxx deleted file mode 100644 index 8e3bc3140..000000000 --- a/cui/source/factory/cuiresmgr.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include - -// struct DialogsResMgr -------------------------------------------------- -ResMgr* CuiResMgr::GetResMgr() -{ - static ResMgr* pResMgr=0; - - if ( !pResMgr ) - { - pResMgr = ResMgr::CreateResMgr("cui", Application::GetSettings().GetUILocale()); - } - - return pResMgr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx deleted file mode 100644 index 315e5f155..000000000 --- a/cui/source/factory/dlgfact.cxx +++ /dev/null @@ -1,1977 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "align.hxx" //add for SvxAlignmentTabPage -#include "dlgfact.hxx" - -#include -#include -#include -#include -#include -#include -#include "numfmt.hxx" -#include "optimprove.hxx" -#include "splitcelldlg.hxx" -#include "gallery.hrc" -#include "dstribut.hxx" -#include "cuiimapwnd.hxx" -#include "hlmarkwn.hxx" -#include "cuicharmap.hxx" -#include "srchxtra.hxx" -#include "textanim.hxx" -#include "autocdlg.hxx" -#include "treeopt.hxx" -#include "internationaloptions.hxx" -#include "labdlg.hxx" -#include "hangulhanjadlg.hxx" //add for HangulHanjaConversionDialog -#include "showcols.hxx" //add for FmShowColsDialog -#include "zoom.hxx" //add for SvxZoomDialog -#include "cuigaldlg.hxx" //add for Gallery 6 Dialogs and 1 TabPage -#include "cuiimapwnd.hxx" //add for URLDlg -#include "hlmarkwn.hxx" //add for SvxHlinkDlgMarkWnd -#include "srchxtra.hxx" //add for SvxSearchFormatDialog -#include "transfrm.hxx" //add for SvxTransformTabDialog -#include "bbdlg.hxx" //add for SvxBorderBackgroundDlg -#include "cuisrchdlg.hxx" //add for SvxJSearchOptionsDialog -#include "cuitbxform.hxx" //add for FmInputRecordNoDialog -#include "optdict.hxx" //add for SvxNewDictionaryDialog -#include "dlgname.hxx" //add for SvxNameDialog & SvxMessDialog -#include "multipat.hxx" //add for SvxMultiPathDialog -#include "multifil.hxx" //add for SvxMultiFileDialog -#include "cuihyperdlg.hxx" //add for SvxHpLinkDlg -#include "cuifmsearch.hxx" //add for FmSearchDialog -#include "cuigrfflt.hxx" //add for GraphicFilterDialog -#include "cuitabarea.hxx" //add for SvxAreaTabDialog -#include "cuitabline.hxx" //add for SvxLineTabDialog -#include "measure.hxx" //add for SvxMeasureDialog -#include "connect.hxx" //add for SvxConnectionDialog -#include "dbregister.hxx" // add for DatabaseRegistrationDialog -#include "cuioptgenrl.hxx" //add for SvxGeneralTabPage -#include "optasian.hxx" -#include "insdlg.hxx" -#include "pastedlg.hxx" -#include "linkdlg.hxx" -#include "SpellDialog.hxx" -#include "cfg.hxx" //add for SvxConfigDialog -#include "numpages.hxx" // add for -#include "paragrph.hxx" //add for -#include "tabstpge.hxx" // add for -#include "textattr.hxx" // add for SvxTextAttrPage -#include "backgrnd.hxx" //add for SvxBackgroundTabPage -#include "border.hxx" //add for SvxBorderTabPage -#include "chardlg.hxx" //add for SvxCharNamePage,SvxCharEffectsPage,SvxCharPositionPage,SvxCharTwoLinesPage -#include "page.hxx" //add for SvxPageDescPage -#include "postdlg.hxx" //add for SvxPostItDialog -#include "grfpage.hxx" //add for SvxGrfCropPage -#include "scriptdlg.hxx" // for ScriptOrgDialog -#include "selector.hxx" // for SvxScriptSelectorDialog -#include "macropg.hxx" // for SvxMacroAssignDlg -#include "sdrcelldlg.hxx" -#include "newtabledlg.hxx" -#include "macroass.hxx" -#include "acccfg.hxx" -#include "insrc.hxx" -#include "passwdomdlg.hxx" -#include "hyphen.hxx" -#include "thesdlg.hxx" -#include "about.hxx" -#include "dialmgr.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::container; - -using ::com::sun::star::uno::Reference; - -using namespace svx; -// AbstractTabDialog implementations just forwards everything to the dialog -IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl) -IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl) -IMPL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxDistributeDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractHangulHanjaConversionDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl) -IMPL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl) - -AbstractSvxZoomDialog_Impl::~AbstractSvxZoomDialog_Impl() \ -{ - delete pDlg; -} -short AbstractSvxZoomDialog_Impl::Execute() -{ - return pDlg->Execute(); -} - -IMPL_ABSTDLG_BASE(AbstractSearchProgress_Impl); -IMPL_ABSTDLG_BASE(AbstractTakeProgress_Impl); -IMPL_ABSTDLG_BASE(AbstractTitleDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractScriptSelectorDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractURLDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxHlinkDlgMarkWnd_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl); - -// #i68101# -IMPL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl); - -IMPL_ABSTDLG_BASE(AbstractSvxMessDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxMultiFileDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractPasteDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractLinksDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSpellDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractSvxPostItDialog_Impl); -IMPL_ABSTDLG_BASE(AbstractPasswordToOpenModifyDialog_Impl); - -////////////////////////////////////////////////////////////////////////// -// VclAbstractDialog2_Impl -////////////////////////////////////////////////////////////////////////// - -// virtual -VclAbstractDialog2_Impl::~VclAbstractDialog2_Impl() -{ - delete m_pDlg; -} - -// virtual -void VclAbstractDialog2_Impl::StartExecuteModal( const Link& rEndDialogHdl ) -{ - m_aEndDlgHdl = rEndDialogHdl; - m_pDlg->StartExecuteModal( - LINK( this, VclAbstractDialog2_Impl, EndDialogHdl ) ); -} - -// virtual -long VclAbstractDialog2_Impl::GetResult() -{ - return m_pDlg->GetResult(); -} - -IMPL_LINK( VclAbstractDialog2_Impl, EndDialogHdl, Dialog*, pDlg ) -{ - if ( pDlg != m_pDlg ) - { - DBG_ERRORFILE( "VclAbstractDialog2_Impl::EndDialogHdl(): wrong dialog" ); - } - - m_aEndDlgHdl.Call( this ); - m_aEndDlgHdl = Link(); - - return 0L; -} - -////////////////////////////////////////////////////////////////////////// - -void AbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) -{ - pDlg->SetCurPageId( nId ); -} - -const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} - -const sal_uInt16* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) -{ - return pDlg->GetInputRanges( pItem ); -} - -void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) -{ - pDlg->SetInputSet( pInSet ); -} -//From class Window. -void AbstractTabDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -String AbstractTabDialog_Impl::GetText() const -{ - return pDlg->GetText(); -} - - -const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} - -void AbstractSfxDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} - -String AbstractSfxDialog_Impl::GetText() const -{ - return pDlg->GetText(); -} - -SvxDistributeHorizontal AbstractSvxDistributeDialog_Impl::GetDistributeHor()const -{ - return pDlg->GetDistributeHor(); -} -SvxDistributeVertical AbstractSvxDistributeDialog_Impl::GetDistributeVer()const -{ - return pDlg->GetDistributeVer(); -} - -void AbstractHangulHanjaConversionDialog_Impl::EndDialog(long nResult) -{ - pDlg->EndDialog(nResult); -} - -void AbstractHangulHanjaConversionDialog_Impl::EnableRubySupport( sal_Bool _bVal ) -{ - pDlg->EnableRubySupport(_bVal); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetByCharacter( sal_Bool _bByCharacter ) -{ - pDlg->SetByCharacter(_bByCharacter); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetConversionDirectionState( sal_Bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) -{ - pDlg->SetConversionDirectionState(_bTryBothDirections, _ePrimaryConversionDirection); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) -{ - pDlg->SetConversionFormat(_eType); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetOptionsChangedHdl( const Link& _rHdl ) -{ - pDlg->SetOptionsChangedHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetIgnoreHdl( const Link& _rHdl ) -{ - pDlg->SetIgnoreHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetIgnoreAllHdl( const Link& _rHdl ) -{ - pDlg->SetIgnoreAllHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetChangeHdl( const Link& _rHdl ) -{ - pDlg->SetChangeHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetChangeAllHdl( const Link& _rHdl ) -{ - pDlg->SetChangeAllHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetClickByCharacterHdl( const Link& _rHdl ) -{ - pDlg->SetClickByCharacterHdl(_rHdl ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetConversionFormatChangedHdl( const Link& _rHdl ) -{ - pDlg->SetConversionFormatChangedHdl(_rHdl ); -} -void AbstractHangulHanjaConversionDialog_Impl::SetFindHdl( const Link& _rHdl ) -{ - pDlg->SetFindHdl(_rHdl ); -} - -sal_Bool AbstractHangulHanjaConversionDialog_Impl::GetUseBothDirections( ) const -{ - return pDlg->GetUseBothDirections(); -} - -editeng::HangulHanjaConversion::ConversionDirection AbstractHangulHanjaConversionDialog_Impl::GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const -{ - return pDlg->GetDirection( _eDefaultDirection ); -} - -void AbstractHangulHanjaConversionDialog_Impl::SetCurrentString( - const String& _rNewString, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions, - bool _bOriginatesFromDocument - ) -{ - pDlg->SetCurrentString(_rNewString,_rSuggestions,_bOriginatesFromDocument); -} -String AbstractHangulHanjaConversionDialog_Impl::GetCurrentString( ) const -{ - return pDlg->GetCurrentString(); -} -editeng::HangulHanjaConversion::ConversionFormat AbstractHangulHanjaConversionDialog_Impl::GetConversionFormat( ) const -{ - return pDlg->GetConversionFormat(); -} - -void AbstractHangulHanjaConversionDialog_Impl::FocusSuggestion( ) -{ - pDlg->FocusSuggestion(); -} - -String AbstractHangulHanjaConversionDialog_Impl::GetCurrentSuggestion( ) const -{ - return pDlg->GetCurrentSuggestion(); -} - -String AbstractThesaurusDialog_Impl::GetWord() -{ - return pDlg->GetWord(); -}; - -sal_uInt16 AbstractThesaurusDialog_Impl::GetLanguage() const -{ - return pDlg->GetLanguage(); -}; - -Window* AbstractThesaurusDialog_Impl::GetWindow() -{ - return pDlg; -} - -void AbstractHyphenWordDialog_Impl::SelLeft() -{ - pDlg->SelLeft(); -} - -void AbstractHyphenWordDialog_Impl::SelRight() -{ - pDlg->SelRight(); -} - -Window* AbstractHyphenWordDialog_Impl::GetWindow() -{ - return pDlg; -} - -Reference < com::sun::star::embed::XEmbeddedObject > AbstractInsertObjectDialog_Impl::GetObject() -{ - return pDlg->GetObject(); -} - -sal_Bool AbstractInsertObjectDialog_Impl::IsCreateNew() -{ - return pDlg->IsCreateNew(); -} - -::Reference< ::com::sun::star::io::XInputStream > AbstractInsertObjectDialog_Impl::GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ) -{ - return pDlg->GetIconIfIconified( pGraphicMediaType ); -} - -void AbstractPasteDialog_Impl::Insert( SotFormatStringId nFormat, const String & rFormatName ) -{ - pDlg->Insert( nFormat, rFormatName ); -} - -void AbstractPasteDialog_Impl::SetObjName( const SvGlobalName & rClass, const String & rObjName ) -{ - pDlg->SetObjName( rClass, rObjName ); -} - -sal_uLong AbstractPasteDialog_Impl::GetFormat( const TransferableDataHelper& aHelper, - const DataFlavorExVector* pFormats, - const TransferableObjectDescriptor* pDesc ) -{ - return pDlg->GetFormat( aHelper, pFormats, pDesc ); -} - -void AbstractFmShowColsDialog_Impl::SetColumns(const ::Reference< ::com::sun::star::container::XIndexContainer>& xCols) -{ - pDlg->SetColumns(xCols); -} - -void AbstractSvxZoomDialog_Impl::SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ) -{ - pDlg->SetLimits( nMin, nMax ); -} - -void AbstractSvxZoomDialog_Impl::HideButton( sal_uInt16 nBtnId ) -{ - pDlg->HideButton( nBtnId ); -} - -const SfxItemSet* AbstractSvxZoomDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} - -void AbstractSpellDialog_Impl::SetLanguage( sal_uInt16 nLang ) -{ - pDlg->SetLanguage(nLang); -} - -sal_Bool AbstractSpellDialog_Impl::Close() -{ - return pDlg->Close(); -} - -void AbstractSpellDialog_Impl::Invalidate() -{ - pDlg->InvalidateDialog(); -} - -Window* AbstractSpellDialog_Impl::GetWindow() -{ - return pDlg; -} - -SfxBindings& AbstractSpellDialog_Impl::GetBindings() -{ - return pDlg->GetBindings(); -} - -void AbstractSearchProgress_Impl::Update() -{ - pDlg->Update(); -} - -void AbstractSearchProgress_Impl::Sync() -{ - pDlg-> Sync(); -} - -void AbstractSearchProgress_Impl::SetFileType( const String& rType ) -{ - pDlg->SetFileType( rType ); -} - -void AbstractSearchProgress_Impl::SetDirectory( const INetURLObject& rURL ) -{ - pDlg->SetDirectory( rURL ); -} -PLinkStub AbstractSearchProgress_Impl::GetLinkStubCleanUpHdl() -{ - return SearchProgress::LinkStubCleanUpHdl; -} - -void AbstractTakeProgress_Impl::Update() -{ - pDlg->Update(); -} - -void AbstractTakeProgress_Impl::Sync() -{ - pDlg-> Sync(); -} - -void AbstractTakeProgress_Impl::SetFile( const INetURLObject& rURL ) -{ - pDlg->SetFile( rURL ); -} - -PLinkStub AbstractTakeProgress_Impl::GetLinkStubCleanUpHdl() -{ - return TakeProgress::LinkStubCleanUpHdl; -} - -String AbstractTitleDialog_Impl::GetTitle() const -{ - return pDlg->GetTitle(); -} - -sal_uLong AbstractGalleryIdDialog_Impl::GetId() const -{ - return pDlg->GetId(); -} - -void VclAbstractRefreshableDialog_Impl::Update() -{ - pDlg->Update(); -} - -void VclAbstractRefreshableDialog_Impl::Sync() -{ - pDlg-> Sync(); -} - -String AbstractURLDlg_Impl::GetURL() const -{ - return pDlg->GetURL(); -} - -String AbstractURLDlg_Impl::GetAltText() const -{ - return pDlg->GetAltText(); -} - -String AbstractURLDlg_Impl::GetDesc() const -{ - return pDlg->GetDesc(); -} - -String AbstractURLDlg_Impl::GetTarget() const -{ - return pDlg->GetTarget(); -} - -String AbstractURLDlg_Impl::GetName() const -{ - return pDlg->GetName(); -} - -void AbstractSvxHlinkDlgMarkWnd_Impl::Hide( sal_uInt16 nFlags ) -{ - ((Window*)pDlg)->Hide( nFlags ); -} - -void AbstractSvxHlinkDlgMarkWnd_Impl::SetSizePixel( const Size& rNewSize ) -{ - pDlg->SetSizePixel( rNewSize ); -} - -Size AbstractSvxHlinkDlgMarkWnd_Impl::GetSizePixel() const -{ - return pDlg->GetSizePixel(); -} - -sal_Bool AbstractSvxHlinkDlgMarkWnd_Impl::IsVisible( ) const -{ - return (( Window* )pDlg)->IsVisible(); -} - -void AbstractSvxHlinkDlgMarkWnd_Impl::Invalidate( sal_uInt16 nFlags ) -{ - (( Window* )pDlg)->Invalidate(nFlags); -} - -sal_Bool AbstractSvxHlinkDlgMarkWnd_Impl::MoveTo( Point aNewPos )const -{ - return pDlg->MoveTo(aNewPos); -} - -sal_Bool AbstractSvxHlinkDlgMarkWnd_Impl::ConnectToDialog( sal_Bool bDoit )const -{ - return pDlg->ConnectToDialog(bDoit); -} - -void AbstractSvxHlinkDlgMarkWnd_Impl::RefreshTree ( String aStrURL ) -{ - pDlg->RefreshTree(aStrURL); -} - -void AbstractSvxHlinkDlgMarkWnd_Impl::SelectEntry ( String aStrMark ) -{ - pDlg->SelectEntry(aStrMark); -} - -sal_uInt16 AbstractSvxHlinkDlgMarkWnd_Impl::SetError( sal_uInt16 nError) -{ - return pDlg->SetError(nError); -} - -sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetOther() -{ - return pDlg->GetOther(); -} - -sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetShorter() -{ - return pDlg->GetShorter(); -} - -sal_uInt16 AbstractSvxSearchSimilarityDialog_Impl::GetLonger() -{ - return pDlg-> GetLonger(); -} - -sal_Bool AbstractSvxSearchSimilarityDialog_Impl::IsRelaxed() -{ - return pDlg-> IsRelaxed(); -} - -// AbstractSvxTransformTabDialog implementations just forwards everything to the dialog -void AbstractSvxTransformTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) -{ - pDlg->SetCurPageId( nId ); -} -const SfxItemSet* AbstractSvxTransformTabDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} -// -const sal_uInt16* AbstractSvxTransformTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) -{ - return pDlg->GetInputRanges( pItem ); -} -// -void AbstractSvxTransformTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) -{ - pDlg->SetInputSet( pInSet ); -} -//From class Window. -void AbstractSvxTransformTabDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -String AbstractSvxTransformTabDialog_Impl::GetText() const -{ - return pDlg->GetText(); -} -void AbstractSvxTransformTabDialog_Impl::SetValidateFramePosLink( const Link& rLink ) -{ - pDlg->SetValidateFramePosLink( rLink ); -} - -// AbstractSvxCaptionDialog implementations just forwards everything to the dialog -void AbstractSvxCaptionDialog_Impl::SetCurPageId( sal_uInt16 nId ) -{ - pDlg->SetCurPageId( nId ); -} -const SfxItemSet* AbstractSvxCaptionDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} -// -const sal_uInt16* AbstractSvxCaptionDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) -{ - return pDlg->GetInputRanges( pItem ); -} -// -void AbstractSvxCaptionDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) -{ - pDlg->SetInputSet( pInSet ); -} -//From class Window. -void AbstractSvxCaptionDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -String AbstractSvxCaptionDialog_Impl::GetText() const -{ - return pDlg->GetText(); -} -void AbstractSvxCaptionDialog_Impl::SetValidateFramePosLink( const Link& rLink ) -{ - pDlg->SetValidateFramePosLink( rLink ); -} - -sal_Int32 AbstractSvxJSearchOptionsDialog_Impl::GetTransliterationFlags() const -{ - return pDlg->GetTransliterationFlags(); -} - -void AbstractFmInputRecordNoDialog_Impl::SetValue(long nNew) -{ - pDlg->SetValue(nNew); -} - -long AbstractFmInputRecordNoDialog_Impl::GetValue() const -{ - return pDlg->GetValue(); -} - -::Reference< - ::com::sun::star::linguistic2::XDictionary > AbstractSvxNewDictionaryDialog_Impl::GetNewDictionary() -{ - return pDlg->GetNewDictionary(); -} - -void AbstractSvxNameDialog_Impl::GetName( String& rName ) -{ - pDlg->GetName( rName ); -} - -void AbstractSvxNameDialog_Impl::SetCheckNameHdl( const Link& rLink, bool bCheckImmediately ) -{ - aCheckNameHdl = rLink; - if( rLink.IsSet() ) - pDlg->SetCheckNameHdl( LINK(this, AbstractSvxNameDialog_Impl, CheckNameHdl), bCheckImmediately ); - else - pDlg->SetCheckNameHdl( Link(), bCheckImmediately ); -} -void AbstractSvxNameDialog_Impl::SetEditHelpId(const rtl::OString& aHelpId) -{ - pDlg->SetEditHelpId( aHelpId ); -} -void AbstractSvxNameDialog_Impl::SetHelpId( const rtl::OString& aHelpId ) -{ - pDlg->SetHelpId( aHelpId ); -} -void AbstractSvxNameDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -IMPL_LINK( AbstractSvxNameDialog_Impl, CheckNameHdl, Window*, EMPTYARG ) -{ - if( aCheckNameHdl.IsSet() ) - return aCheckNameHdl.Call(this); - return 0; -} - -void AbstractSvxObjectNameDialog_Impl::GetName(String& rName) -{ - pDlg->GetName(rName); -} - -void AbstractSvxObjectNameDialog_Impl::SetCheckNameHdl(const Link& rLink, bool bCheckImmediately) -{ - aCheckNameHdl = rLink; - - if(rLink.IsSet()) - { - pDlg->SetCheckNameHdl(LINK(this, AbstractSvxObjectNameDialog_Impl, CheckNameHdl), bCheckImmediately); - } - else - { - pDlg->SetCheckNameHdl(Link(), bCheckImmediately); - } -} - -IMPL_LINK(AbstractSvxObjectNameDialog_Impl, CheckNameHdl, Window*, EMPTYARG) -{ - if(aCheckNameHdl.IsSet()) - { - return aCheckNameHdl.Call(this); - } - - return 0; -} - -void AbstractSvxObjectTitleDescDialog_Impl::GetTitle(String& rTitle) -{ - pDlg->GetTitle(rTitle); -} - -void AbstractSvxObjectTitleDescDialog_Impl::GetDescription(String& rDescription) -{ - pDlg->GetDescription(rDescription); -} - -void AbstractSvxMessDialog_Impl::SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ) -{ - pDlg->SetButtonText( nBtnId, rNewTxt ); -} - -String AbstractSvxMultiPathDialog_Impl::GetPath() const -{ - return pDlg->GetPath(); -} - -void AbstractSvxMultiPathDialog_Impl::SetPath( const String& rPath ) -{ - pDlg->SetPath( rPath ); -} - -void AbstractSvxMultiPathDialog_Impl::EnableRadioButtonMode() -{ - pDlg->EnableRadioButtonMode(); -} - -void AbstractSvxMultiPathDialog_Impl::SetTitle( const String& rNewTitle ) -{ - pDlg->SetText( rNewTitle ); -} - -String AbstractSvxMultiFileDialog_Impl::GetPath() const -{ - return pDlg->GetPath(); -} - -void AbstractSvxMultiFileDialog_Impl::SetPath( const String& rPath ) -{ - pDlg->SetPath( rPath ); -} - -String AbstractSvxMultiFileDialog_Impl::GetFiles() const -{ - return pDlg->GetFiles(); -} - -void AbstractSvxMultiFileDialog_Impl::SetFiles( const String& rPath ) -{ - pDlg->SetFiles( rPath ); -} - -void AbstractSvxMultiFileDialog_Impl::SetClassPathMode() -{ - pDlg->SetClassPathMode(); -} - -void AbstractSvxMultiFileDialog_Impl::EnableRadioButtonMode() -{ - pDlg->EnableRadioButtonMode(); -} - -void AbstractSvxMultiFileDialog_Impl::SetTitle( const String& rNewTitle ) -{ - pDlg->SetText( rNewTitle ); -} - -void AbstractSvxMultiFileDialog_Impl::SetHelpId( const rtl::OString& aHelpId ) -{ - pDlg->SetHelpId( aHelpId ); -} - -Window * AbstractSvxHpLinkDlg_Impl::GetWindow() -{ - return (Window *)pDlg; -} - -sal_Bool AbstractSvxHpLinkDlg_Impl::QueryClose() -{ - return pDlg->QueryClose(); -} - - -void AbstractFmSearchDialog_Impl::SetFoundHandler(const Link& lnk) -{ - pDlg->SetFoundHandler(lnk); -} -void AbstractFmSearchDialog_Impl::SetCanceledNotFoundHdl(const Link& lnk) -{ - pDlg->SetCanceledNotFoundHdl(lnk); -} -void AbstractFmSearchDialog_Impl::SetActiveField(const String& strField) -{ - pDlg->SetActiveField(strField); -} - -Graphic AbstractGraphicFilterDialog_Impl::GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) -{ - return pDlg->GetFilteredGraphic( rGraphic, fScaleX, fScaleY ); -} - -// AbstractSvxAreaTabDialog implementations just forwards everything to the dialog -void AbstractSvxAreaTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) -{ - pDlg->SetCurPageId( nId ); -} - -const SfxItemSet* AbstractSvxAreaTabDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} - -const sal_uInt16* AbstractSvxAreaTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) -{ - return pDlg->GetInputRanges( pItem ); -} - -void AbstractSvxAreaTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) -{ - pDlg->SetInputSet( pInSet ); -} -//From class Window. -void AbstractSvxAreaTabDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -String AbstractSvxAreaTabDialog_Impl::GetText() const -{ - return pDlg->GetText(); -} - -void AbstractSvxAreaTabDialog_Impl::DontDeleteColorTable() -{ - return pDlg->DontDeleteColorTable(); -} - -void AbstractSvxPostItDialog_Impl::SetText( const XubString& rStr ) -{ - pDlg->SetText( rStr ); -} -const SfxItemSet* AbstractSvxPostItDialog_Impl::GetOutputItemSet() const -{ - return pDlg->GetOutputItemSet(); -} -void AbstractSvxPostItDialog_Impl::EnableTravel(sal_Bool bNext, sal_Bool bPrev) -{ - pDlg->EnableTravel( bNext, bPrev ); -} -String AbstractSvxPostItDialog_Impl::GetNote() -{ - return pDlg->GetNote(); -} -void AbstractSvxPostItDialog_Impl::SetNote(const String& rTxt) -{ - pDlg->SetNote( rTxt ); -} -void AbstractSvxPostItDialog_Impl::ShowLastAuthor(const String& rAuthor, const String& rDate) -{ - pDlg->ShowLastAuthor( rAuthor, rDate ); -} -void AbstractSvxPostItDialog_Impl::DontChangeAuthor() -{ - pDlg->DontChangeAuthor(); -} -void AbstractSvxPostItDialog_Impl::HideAuthor() -{ - pDlg->HideAuthor(); -} -void AbstractSvxPostItDialog_Impl::SetReadonlyPostIt(sal_Bool bDisable) -{ - pDlg->SetReadonlyPostIt( bDisable ); -} -sal_Bool AbstractSvxPostItDialog_Impl::IsOkEnabled() const -{ - return pDlg->IsOkEnabled(); -} -void AbstractSvxPostItDialog_Impl::SetNextHdl( const Link& rLink ) -{ - aNextHdl = rLink; - if( rLink.IsSet() ) - pDlg->SetNextHdl( LINK(this, AbstractSvxPostItDialog_Impl, NextHdl ) ); - else - pDlg->SetNextHdl( Link() ); -} -void AbstractSvxPostItDialog_Impl::SetPrevHdl( const Link& rLink ) -{ - aPrevHdl = rLink; - if( rLink.IsSet() ) - pDlg->SetPrevHdl( LINK(this, AbstractSvxPostItDialog_Impl, PrevHdl ) ); - else - pDlg->SetPrevHdl( Link() ); -} -IMPL_LINK( AbstractSvxPostItDialog_Impl, NextHdl, Window*, EMPTYARG ) -{ - if( aNextHdl.IsSet() ) - aNextHdl.Call(this); - return 0; -} -IMPL_LINK( AbstractSvxPostItDialog_Impl, PrevHdl, Window*, EMPTYARG ) -{ - if( aPrevHdl.IsSet() ) - aPrevHdl.Call(this); - return 0; -} -Window * AbstractSvxPostItDialog_Impl::GetWindow() -{ - return (Window *)pDlg; -} - -String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToOpen() const -{ - return pDlg->GetPasswordToOpen(); -} -String AbstractPasswordToOpenModifyDialog_Impl::GetPasswordToModify() const -{ - return pDlg->GetPasswordToModify(); -} -bool AbstractPasswordToOpenModifyDialog_Impl::IsRecommendToOpenReadonly() const -{ - return pDlg->IsRecommendToOpenReadonly(); -} - -// Create dialogs with simplest interface -VclAbstractDialog* AbstractDialogFactory_Impl::CreateVclDialog( Window* pParent, sal_uInt32 nResId ) -{ - Dialog* pDlg=NULL; - switch ( nResId ) - { - case RID_DEFAULTABOUT: - { - pDlg = new AboutDialog( pParent, CUI_RES( (sal_uInt16) nResId ) ); - break; - } - case SID_OPTIONS_TREEDIALOG : - case SID_OPTIONS_DATABASES : - case SID_LANGUAGE_OPTIONS : - { - bool bActivateLastSelection = false; - if (nResId == SID_OPTIONS_TREEDIALOG) - bActivateLastSelection = true; - Reference< frame::XFrame > xFrame; - OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, xFrame, bActivateLastSelection ); - if (nResId == SID_OPTIONS_DATABASES) - { - pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS); - } - else if (nResId == SID_LANGUAGE_OPTIONS) - { - //open the tab page "tools/options/languages" - pOptDlg->ActivatePage(OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE); - } - pDlg = pOptDlg; - } - break; - default: - break; - } - - if ( pDlg ) - return new VclAbstractDialog_Impl( pDlg ); - return 0; -} - -// dialogs that use SfxBindings -VclAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* /*pParent*/, const SfxBindings&, sal_uInt32 ) -{ - return 0; -} - -VclAbstractDialog* AbstractDialogFactory_Impl::CreateFrameDialog( - Window* pParent, const Reference< frame::XFrame >& rxFrame, - sal_uInt32 nResId, const String& rParameter ) -{ - Dialog* pDlg = NULL; - if ( SID_OPTIONS_TREEDIALOG == nResId || SID_OPTIONS_DATABASES == nResId ) - { - // only activate last page if we dont want to activate a special page - bool bActivateLastSelection = ( nResId != SID_OPTIONS_DATABASES && rParameter.Len() == 0 ); - OfaTreeOptionsDialog* pOptDlg = new OfaTreeOptionsDialog( pParent, rxFrame, bActivateLastSelection ); - if ( nResId == SID_OPTIONS_DATABASES ) - pOptDlg->ActivatePage(SID_SB_DBREGISTEROPTIONS); - else if ( rParameter.Len() > 0 ) - pOptDlg->ActivatePage( rParameter ); - pDlg = pOptDlg; - } - - if ( pDlg ) - return new VclAbstractDialog_Impl( pDlg ); - else - return NULL; -} - -// TabDialog outside the drawing layer -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nResId, - Window* pParent, - const SfxItemSet* pAttrSet, - SfxViewFrame* , - bool /*bEditFmt*/, - const String * ) -{ - SfxTabDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_OFA_AUTOCORR_DLG : - pDlg = new OfaAutoCorrDlg( pParent, pAttrSet ); - break; - case RID_SVXDLG_CUSTOMIZE : - pDlg = new SvxConfigDialog( pParent, pAttrSet ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractTabDialog_Impl( pDlg ); - return 0; -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabDialog( sal_uInt32 nResId, - Window* pParent, - const SfxItemSet* pAttrSet, - const Reference< frame::XFrame >& xViewFrame, - bool /*bEditFmt*/, - const String * ) -{ - SfxTabDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_OFA_AUTOCORR_DLG : - pDlg = new OfaAutoCorrDlg( pParent, pAttrSet ); - break; - case RID_SVXDLG_CUSTOMIZE : - { - SvxConfigDialog* pDlg1 = new SvxConfigDialog( pParent, pAttrSet ); - pDlg1->SetFrame(xViewFrame); - pDlg = (SfxTabDialog*)pDlg1; - } - break; - default: - break; - } - - if ( pDlg ) - return new AbstractTabDialog_Impl( pDlg ); - return 0; -} - -// TabDialog that use functionality of the drawing layer -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTextTabDialog( Window* pParent, - const SfxItemSet* pAttrSet, - SdrView* pView, - SdrModel* ) -{ - SfxTabDialog* pDlg = new SvxTextTabDialog( pParent, pAttrSet, pView ); - return new AbstractTabDialog_Impl( pDlg ); -} - -// TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog -AbstractSvxCaptionDialog* AbstractDialogFactory_Impl::CreateCaptionDialog( Window* pParent, - const SdrView* pView, - sal_uInt16 nAnchorTypes ) -{ - SvxCaptionTabDialog* pDlg = new SvxCaptionTabDialog( pParent, pView, nAnchorTypes ); - return new AbstractSvxCaptionDialog_Impl( pDlg ); -} - -AbstractSvxDistributeDialog* AbstractDialogFactory_Impl::CreateSvxDistributeDialog(Window* pParent, - const SfxItemSet& rAttr, - SvxDistributeHorizontal eHor , - SvxDistributeVertical eVer) -{ - SvxDistributeDialog* pDlg = new SvxDistributeDialog( pParent, rAttr, eHor, eVer); - return new AbstractSvxDistributeDialog_Impl( pDlg ); -} - -AbstractHangulHanjaConversionDialog* AbstractDialogFactory_Impl::CreateHangulHanjaConversionDialog(Window* pParent, - editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) -{ - HangulHanjaConversionDialog* pDlg = new HangulHanjaConversionDialog( pParent, _ePrimaryDirection); - return new AbstractHangulHanjaConversionDialog_Impl( pDlg ); -} - -AbstractThesaurusDialog* AbstractDialogFactory_Impl::CreateThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ) -{ - SvxThesaurusDialog* pDlg = new SvxThesaurusDialog( pParent, xThesaurus, rWord, nLanguage ); - return new AbstractThesaurusDialog_Impl( pDlg ); -} - -AbstractHyphenWordDialog* AbstractDialogFactory_Impl::CreateHyphenWordDialog( Window* pParent, - const String &rWord, LanguageType nLang, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ) -{ - SvxHyphenWordDialog* pDlg = new SvxHyphenWordDialog( rWord, nLang, pParent, xHyphen, pWrapper ); - return new AbstractHyphenWordDialog_Impl( pDlg ); -} - -AbstractFmShowColsDialog * AbstractDialogFactory_Impl::CreateFmShowColsDialog( Window* pParent ) -{ - FmShowColsDialog* pDlg = new FmShowColsDialog( pParent); - return new AbstractFmShowColsDialog_Impl( pDlg ); -} -AbstractSvxZoomDialog * AbstractDialogFactory_Impl::CreateSvxZoomDialog( Window* pParent, //add for SvxZoomDialog - const SfxItemSet& rCoreSet) -{ - SvxZoomDialog* pDlg = new SvxZoomDialog( pParent, rCoreSet); - return new AbstractSvxZoomDialog_Impl( pDlg ); -} - -AbstractSpellDialog * AbstractDialogFactory_Impl::CreateSvxSpellDialog( - Window* pParent, - SfxBindings* pBindings, - svx::SpellDialogChildWindow* pSpellChildWindow ) -{ - svx::SpellDialog* pDlg = new svx::SpellDialog(pSpellChildWindow, pParent, pBindings); - return new AbstractSpellDialog_Impl(pDlg); -} - -VclAbstractRefreshableDialog * AbstractDialogFactory_Impl::CreateActualizeProgressDialog( Window* pParent, GalleryTheme* pThm ) -{ - Dialog* pDlg = new ActualizeProgress( pParent, pThm); - return new VclAbstractRefreshableDialog_Impl( pDlg ); -} - -AbstractSearchProgress * AbstractDialogFactory_Impl::CreateSearchProgressDialog( Window* pParent, //add for SearchProgress - const INetURLObject& rStartURL ) -{ - SearchProgress* pDlg = new SearchProgress( pParent, rStartURL); - return new AbstractSearchProgress_Impl( pDlg ); -} - -AbstractTakeProgress * AbstractDialogFactory_Impl::CreateTakeProgressDialog( Window* pParent ) -{ - TakeProgress* pDlg = new TakeProgress( pParent ); - return new AbstractTakeProgress_Impl( pDlg ); -} - -VclAbstractDialog* -AbstractDialogFactory_Impl::CreateScriptErrorDialog( - Window* pParent, ::com::sun::star::uno::Any aException ) -{ - return new SvxScriptErrorDialog( pParent, aException ); -} - -AbstractScriptSelectorDialog* -AbstractDialogFactory_Impl::CreateScriptSelectorDialog( - Window* pParent, sal_Bool bShowSlots, const Reference< frame::XFrame >& _rxFrame ) -{ - SvxScriptSelectorDialog* pDlg = NULL; - - pDlg = new SvxScriptSelectorDialog( pParent, bShowSlots, _rxFrame ); - - if (pDlg) - { - return new AbstractScriptSelectorDialog_Impl( pDlg ); - } - return 0; -} - -String AbstractScriptSelectorDialog_Impl::GetScriptURL() const -{ - if (pDlg) - return pDlg->GetScriptURL(); - return String(); -} - -void AbstractScriptSelectorDialog_Impl::SetRunLabel() -{ - if (pDlg) - pDlg->SetRunLabel(); - return; -} - -VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( Window* pParent, //add for SvxScriptOrgDialog - const String& rLanguage) -{ - Dialog* pDlg=NULL; - - pDlg = new SvxScriptOrgDialog( pParent, rLanguage); - - if ( pDlg ) - return new VclAbstractDialog_Impl( pDlg ); - return 0; -} - -AbstractTitleDialog * AbstractDialogFactory_Impl::CreateTitleDialog( Window* pParent, //add for TitleDialog - const String& rOldText) -{ - TitleDialog* pDlg = new TitleDialog( pParent, rOldText); - return new AbstractTitleDialog_Impl( pDlg ); -} - -AbstractGalleryIdDialog * AbstractDialogFactory_Impl::CreateGalleryIdDialog( Window* pParent, //add for SvxZoomDialog - GalleryTheme* pThm ) -{ - GalleryIdDialog* pDlg = new GalleryIdDialog( pParent, pThm); - return new AbstractGalleryIdDialog_Impl( pDlg ); -} - -VclAbstractDialog2 * AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog( Window* pParent, //add for GalleryThemeProperties - ExchangeData* pData, - SfxItemSet* pItemSet) -{ - Dialog* pDlg = new GalleryThemeProperties( pParent, pData, pItemSet); - return new VclAbstractDialog2_Impl( pDlg ); -} - -AbstractURLDlg * AbstractDialogFactory_Impl::CreateURLDialog( Window* pParent, //add for URLDlg - const String& rURL, const String& rAltText, const String& rDescription, - const String& rTarget, const String& rName, - TargetList& rTargetList ) -{ - URLDlg* pDlg = new URLDlg( pParent, rURL, rAltText, rDescription, rTarget, rName, rTargetList); - return new AbstractURLDlg_Impl( pDlg ); -} - -AbstractSvxHlinkDlgMarkWnd* AbstractDialogFactory_Impl::CreateSvxHlinkDlgMarkWndDialog( SvxHyperlinkTabPageBase* pParent, sal_uInt32 nResId ) -{ - SvxHlinkDlgMarkWnd* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXFLOAT_HYPERLINK_MARKWND : - pDlg = new SvxHlinkDlgMarkWnd( pParent ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSvxHlinkDlgMarkWnd_Impl( pDlg ); - return 0; -} - -SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( sal_uInt32 nResId, - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& , - const SfxItemSet* pAttrSet ) -{ - SfxModalDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXDLG_CHARMAP : - pDlg = new SvxCharacterMap( pParent, sal_True, pAttrSet ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSfxDialog_Impl( pDlg ); - return 0; -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateTabItemDialog( Window* pParent, - const SfxItemSet& rSet, - sal_uInt32 nResId) -{ - SfxTabDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXDLG_SEARCHFORMAT : - pDlg = new SvxSearchFormatDialog( pParent, rSet ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractTabDialog_Impl( pDlg ); - return 0; -} - -VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxSearchAttributeDialog( Window* pParent, - SearchAttrItemList& rLst, - const sal_uInt16* pWhRanges ) -{ - Dialog* pDlg = new SvxSearchAttributeDialog( pParent, rLst, pWhRanges); - return new VclAbstractDialog_Impl( pDlg ); -} - -AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchSimilarityDialog( Window* pParent, - sal_Bool bRelax, - sal_uInt16 nOther, - sal_uInt16 nShorter, - sal_uInt16 nLonger) -{ - SvxSearchSimilarityDialog* pDlg = new SvxSearchSimilarityDialog( pParent, bRelax, nOther, nShorter, nLonger ); - if ( pDlg ) - return new AbstractSvxSearchSimilarityDialog_Impl( pDlg ); - return NULL; -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( Window* pParent, - const SfxItemSet& rCoreSet, - sal_Bool bEnableSelector) -{ - SfxTabDialog* pDlg = new SvxBorderBackgroundDlg( pParent, rCoreSet, bEnableSelector); - return new AbstractTabDialog_Impl( pDlg ); -} - -AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( Window* pParent, - const SfxItemSet* pAttr, - const SdrView* pView, - sal_uInt16 nAnchorTypes ) -{ - SvxTransformTabDialog* pDlg = new SvxTransformTabDialog( pParent, pAttr,pView, nAnchorTypes); - return new AbstractSvxTransformTabDialog_Impl( pDlg ); -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSchTransformTabDialog( Window* pParent, - const SfxItemSet* pAttr, - const SdrView* pSdrView, - sal_uInt32 nResId, - bool bSizeTabPage - ) -{ - SfxTabDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SCH_TransformTabDLG_SVXPAGE_ANGLE : - { - pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE); - pDlg->RemoveTabPage( RID_SVXPAGE_ANGLE ); - pDlg->RemoveTabPage( RID_SVXPAGE_SLANT ); - } - break; - case RID_SCH_TransformTabDLG_SVXPAGE_SLANT: - { - pDlg = new SvxTransformTabDialog( pParent, pAttr,pSdrView, bSizeTabPage ? SVX_OBJ_NOPROTECT : SVX_OBJ_NOPROTECT|SVX_OBJ_NORESIZE); - pDlg->RemoveTabPage( RID_SVXPAGE_SLANT ); - } - break; - default: - break; - } - - if ( pDlg ) - return new AbstractTabDialog_Impl( pDlg ); - return 0; -} - -AbstractSvxJSearchOptionsDialog * AbstractDialogFactory_Impl::CreateSvxJSearchOptionsDialog( Window* pParent, - const SfxItemSet& rOptionsSet, - sal_Int32 nInitialFlags) -{ - SvxJSearchOptionsDialog* pDlg = new SvxJSearchOptionsDialog( pParent, rOptionsSet, nInitialFlags ); - return new AbstractSvxJSearchOptionsDialog_Impl( pDlg ); -} - -AbstractFmInputRecordNoDialog * AbstractDialogFactory_Impl::CreateFmInputRecordNoDialog( Window* pParent ) -{ - FmInputRecordNoDialog* pDlg = new FmInputRecordNoDialog( pParent ); - return new AbstractFmInputRecordNoDialog_Impl( pDlg ); -} - -AbstractSvxNewDictionaryDialog * AbstractDialogFactory_Impl::CreateSvxNewDictionaryDialog( Window* pParent, - ::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl, - sal_uInt32 nResId ) -{ - SvxNewDictionaryDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SFXDLG_NEWDICT : - pDlg = new SvxNewDictionaryDialog( pParent, xSpl ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSvxNewDictionaryDialog_Impl( pDlg ); - return 0; -} - -VclAbstractDialog* AbstractDialogFactory_Impl::CreateSvxEditDictionaryDialog( Window* pParent, - const String& rName, - ::Reference< ::com::sun::star::linguistic2::XSpellChecker1> &xSpl, - sal_uInt32 nResId ) -{ - Dialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SFXDLG_EDITDICT : - pDlg = new SvxEditDictionaryDialog( pParent, rName, xSpl ); - break; - default: - break; - } - - if ( pDlg ) - return new VclAbstractDialog_Impl( pDlg ); - return 0; -} - -AbstractSvxNameDialog * AbstractDialogFactory_Impl::CreateSvxNameDialog( Window* pParent, - const String& rName, const String& rDesc ) -{ - SvxNameDialog* pDlg = new SvxNameDialog( pParent, rName, rDesc ); - return new AbstractSvxNameDialog_Impl( pDlg ); -} - -AbstractSvxObjectNameDialog* AbstractDialogFactory_Impl::CreateSvxObjectNameDialog(Window* pParent, const String& rName ) -{ - return new AbstractSvxObjectNameDialog_Impl(new SvxObjectNameDialog(pParent, rName)); -} - -AbstractSvxObjectTitleDescDialog* AbstractDialogFactory_Impl::CreateSvxObjectTitleDescDialog(Window* pParent, const String& rTitle, const String& rDescription) -{ - return new AbstractSvxObjectTitleDescDialog_Impl(new SvxObjectTitleDescDialog(pParent, rTitle, rDescription)); -} - -AbstractSvxMessDialog * AbstractDialogFactory_Impl::CreateSvxMessDialog( Window* pParent, sal_uInt32 nResId, - const String& rText, const String& rDesc, Image* pImg ) -{ - SvxMessDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXDLG_MESSBOX : - pDlg = new SvxMessDialog( pParent, rText, rDesc, pImg ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSvxMessDialog_Impl( pDlg ); - return 0; -} - -AbstractSvxMultiPathDialog * AbstractDialogFactory_Impl::CreateSvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed ) -{ - SvxMultiPathDialog* pDlg = new SvxMultiPathDialog( pParent, bEmptyAllowed ); - return new AbstractSvxMultiPathDialog_Impl( pDlg ); -} - -AbstractSvxMultiFileDialog * AbstractDialogFactory_Impl::CreateSvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed ) -{ - SvxMultiFileDialog* pDlg = new SvxMultiFileDialog( pParent, bEmptyAllowed ); - return new AbstractSvxMultiFileDialog_Impl( pDlg ); -} - -AbstractSvxHpLinkDlg * AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (Window* pParent, //add for SvxMultiFileDialog - SfxBindings* pBindings, - sal_uInt32 nResId) -{ - SvxHpLinkDlg* pDlg=NULL; - switch ( nResId ) - { - case SID_HYPERLINK_DIALOG : - pDlg = new SvxHpLinkDlg( pParent, pBindings ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSvxHpLinkDlg_Impl( pDlg ); - return 0; -} - -AbstractFmSearchDialog* AbstractDialogFactory_Impl::CreateFmSearchDialog(Window* pParent, //add for FmSearchDialog - const String& strInitialText, - const ::std::vector< String >& _rContexts, - sal_Int16 nInitialContext, - const Link& lnkContextSupplier) -{ - FmSearchDialog* pDlg = new FmSearchDialog( pParent, strInitialText, _rContexts, nInitialContext, lnkContextSupplier ); - if ( pDlg ) - return new AbstractFmSearchDialog_Impl( pDlg ); - return 0; -} - -AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss - const Graphic& rGraphic, - RECT_POINT eLightSource, - sal_uInt32) -{ - GraphicFilterDialog* pDlg = new GraphicFilterEmboss( pParent, rGraphic, eLightSource ); - return new AbstractGraphicFilterDialog_Impl( pDlg ); -} - -AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterPosterSepia (Window* pParent, - const Graphic& rGraphic, - sal_uInt16 nCount, - sal_uInt32 nResId) -{ - GraphicFilterDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVX_GRFFILTER_DLG_POSTER : - pDlg = new GraphicFilterPoster( pParent, rGraphic, nCount ); - break; - case RID_SVX_GRFFILTER_DLG_SEPIA : - pDlg = new GraphicFilterSepia( pParent, rGraphic, nCount ); - break; - - default: - break; - } - - if ( pDlg ) - return new AbstractGraphicFilterDialog_Impl( pDlg ); - return 0; -} - -AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize - const Graphic& rGraphic, - sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 ) -{ - GraphicFilterDialog* pDlg = new GraphicFilterSolarize( pParent, rGraphic, nGreyThreshold, bInvert ); - return new AbstractGraphicFilterDialog_Impl( pDlg ); -} - -AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic - const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges, - sal_uInt32 nResId) -{ - GraphicFilterDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVX_GRFFILTER_DLG_MOSAIC : - pDlg = new GraphicFilterMosaic( pParent, rGraphic, nTileWidth, nTileHeight, bEnhanceEdges ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractGraphicFilterDialog_Impl( pDlg ); - return 0; -} - -AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - const SdrView* pSdrView ) -{ - SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel,pSdrView ); - return new AbstractSvxAreaTabDialog_Impl( pDlg ); -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog - SdrModel* pModel, - const SdrObject* pObj , - sal_Bool bHasObj) -{ - SfxTabDialog* pDlg = new SvxLineTabDialog( pParent, pAttr, pModel,pObj,bHasObj ); - return new AbstractTabDialog_Impl( pDlg ); -} - -SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent, - const SfxItemSet& rAttr, - const Reference< XFrame >& _rxDocumentFrame, - sal_uInt32 nResId - ) -{ - SfxModalDialog* pDlg=NULL; - switch ( nResId ) - { - case SID_EVENTCONFIG : - pDlg = new SfxMacroAssignDlg( pParent, _rxDocumentFrame, rAttr ); - break; - case RID_SVXPAGE_MACROASSIGN : - pDlg = new SvxShortcutAssignDlg( pParent, _rxDocumentFrame, rAttr ); - break; - case RID_SVXDLG_CHARMAP : - pDlg = new SvxCharacterMap( pParent, sal_True, &rAttr ); - break; - default: - break; - } - - if ( pDlg ) - return new AbstractSfxDialog_Impl( pDlg ); - return 0; -} - -SfxAbstractDialog* AbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent, - const SfxItemSet& rAttr, - const SdrView* pView, - sal_uInt32 nResId - ) -{ - SfxSingleTabDialog* pDlg=NULL; - switch ( nResId ) - { - case RID_SVXPAGE_MEASURE : - pDlg = new SvxMeasureDialog( pParent, rAttr, pView ); - break; - case RID_SVXPAGE_CONNECTION : - pDlg = new SvxConnectionDialog( pParent, rAttr, pView ); - break; - case RID_SFXPAGE_DBREGISTER : - pDlg = new DatabaseRegistrationDialog( pParent, rAttr ); - break; - case RID_SVXPAGE_IMPROVEMENT : - { - String help_url; - SFX_ITEMSET_ARG( &rAttr, pItem, SfxStringItem, SID_CURRENT_URL, sal_False ); - if ( pItem ) - help_url = pItem->GetValue(); - pDlg = new SvxImprovementDialog( pParent, help_url); - } - default: - break; - } - - if ( pDlg ) - return new AbstractSfxDialog_Impl( pDlg ); - return 0; -} - -AbstractSvxPostItDialog* AbstractDialogFactory_Impl::CreateSvxPostItDialog( Window* pParent, - const SfxItemSet& rCoreSet, - sal_Bool bPrevNext, sal_Bool bRedline ) -{ - SvxPostItDialog* pDlg = new SvxPostItDialog( pParent, rCoreSet, bPrevNext, bRedline ); - return new AbstractSvxPostItDialog_Impl( pDlg ); -} - -class SvxMacroAssignDialog : public VclAbstractDialog -{ -public: - SvxMacroAssignDialog( Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode, - const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent ) - :m_aItems( SFX_APP()->GetPool(), SID_ATTR_MACROITEM, SID_ATTR_MACROITEM ) - { - m_aItems.Put( SfxBoolItem( SID_ATTR_MACROITEM, _bUnoDialogMode ) ); - m_pDialog.reset( new SvxMacroAssignDlg( _pParent, _rxDocumentFrame, m_aItems, _rxEvents, _nInitiallySelectedEvent ) ); - } - - virtual short Execute(); - virtual ~SvxMacroAssignDialog(); - -private: - SfxItemSet m_aItems; - ::std::auto_ptr< SvxMacroAssignDlg > m_pDialog; -}; - -short SvxMacroAssignDialog::Execute() -{ - return m_pDialog->Execute(); -} - -SvxMacroAssignDialog::~SvxMacroAssignDialog() -{ -} - -VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxMacroAssignDlg( - Window* _pParent, const Reference< XFrame >& _rxDocumentFrame, const bool _bUnoDialogMode, - const Reference< XNameReplace >& _rxEvents, const sal_uInt16 _nInitiallySelectedEvent ) -{ - return new SvxMacroAssignDialog( _pParent, _rxDocumentFrame, _bUnoDialogMode, _rxEvents, _nInitiallySelectedEvent ); -} - -// Factories for TabPages -CreateTabPage AbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nId ) -{ - switch ( nId ) - { - case RID_OFA_TP_INTERNATIONAL: - return ::offapp::InternationalOptionsPage::CreateSc; - case RID_OFA_TP_INTERNATIONAL_SD: - case RID_OFA_TP_INTERNATIONAL_IMPR: - return offapp::InternationalOptionsPage::CreateSd; - case RID_SVXPAGE_TEXTANIMATION : - return SvxTextAnimationPage::Create; - case RID_SVXTABPAGE_GALLERY_GENERAL : - return TPGalleryThemeGeneral::Create; - case RID_SVXPAGE_TRANSPARENCE : - return SvxTransparenceTabPage::Create; - case RID_SVXPAGE_AREA : - return SvxAreaTabPage::Create; - case RID_SVXPAGE_SHADOW : - return SvxShadowTabPage::Create; - case RID_SVXPAGE_LINE : - return SvxLineTabPage::Create; - case RID_SVXPAGE_CONNECTION : - return SvxConnectionPage::Create; - case RID_SVXPAGE_MEASURE : - return SvxMeasurePage::Create; - case RID_SFXPAGE_GENERAL : - return SvxGeneralTabPage::Create; - case RID_SVXPAGE_PICK_SINGLE_NUM : - return SvxSingleNumPickTabPage::Create; - case RID_SVXPAGE_PICK_BMP : - return SvxBitmapPickTabPage::Create; - case RID_SVXPAGE_PICK_BULLET : - return SvxBulletPickTabPage::Create; - case RID_SVXPAGE_NUM_OPTIONS : - return SvxNumOptionsTabPage::Create; - case RID_SVXPAGE_PICK_NUM : - return SvxNumPickTabPage::Create; - case RID_SVXPAGE_NUM_POSITION : - return SvxNumPositionTabPage::Create; - case RID_SVXPAGE_PARA_ASIAN : - return SvxAsianTabPage::Create; - case RID_SVXPAGE_EXT_PARAGRAPH : - return SvxExtParagraphTabPage::Create; - case RID_SVXPAGE_ALIGN_PARAGRAPH : - return SvxParaAlignTabPage::Create; - case RID_SVXPAGE_STD_PARAGRAPH : - return SvxStdParagraphTabPage::Create; - case RID_SVXPAGE_TABULATOR : - return SvxTabulatorTabPage::Create; - case RID_SVXPAGE_TEXTATTR : - return SvxTextAttrPage::Create; - case RID_SVXPAGE_ALIGNMENT : - return svx::AlignmentTabPage::Create; - case RID_SW_TP_BACKGROUND : - case RID_SVXPAGE_BACKGROUND : - return SvxBackgroundTabPage::Create; - case RID_SVXPAGE_BORDER : - return SvxBorderTabPage::Create; - case RID_SVXPAGE_CHAR_NAME : - return SvxCharNamePage::Create; - case RID_SVXPAGE_CHAR_EFFECTS : - return SvxCharEffectsPage::Create; - case RID_SVXPAGE_CHAR_POSITION : - return SvxCharPositionPage::Create; - case RID_SVXPAGE_CHAR_TWOLINES : - return SvxCharTwoLinesPage::Create; - case RID_SVXPAGE_NUMBERFORMAT : - return SvxNumberFormatTabPage::Create; - case RID_SVXPAGE_PAGE : - return SvxPageDescPage::Create; - case RID_SVXPAGE_GRFCROP : - return SvxGrfCropPage::Create; - case RID_SVXPAGE_MACROASSIGN : - return SfxMacroTabPage::Create; - default: - break; - } - - return 0; -} - -CreateSvxDistributePage AbstractDialogFactory_Impl::GetSvxDistributePageCreatorFunc() -{ - return SvxDistributePage::Create; -} - -DialogGetRanges AbstractDialogFactory_Impl::GetDialogGetRangesFunc( sal_uInt16 nId ) -{ - switch ( nId ) - { - case RID_SVXDLG_POSTIT: - return SvxPostItDialog::GetRanges; //add for SvxPostItDialog - default: - break; - } - - return 0; -} -GetTabPageRanges AbstractDialogFactory_Impl::GetTabPageRangesFunc( sal_uInt16 nId ) -{ - switch ( nId ) - { - case RID_SVXPAGE_TEXTANIMATION : - return SvxTextAnimationPage::GetRanges; - case RID_SVXPAGE_DISTRIBUTE: - return SvxDistributePage::GetRanges; - case RID_SVXPAGE_TRANSPARENCE : - return SvxTransparenceTabPage::GetRanges; - case RID_SVXPAGE_AREA : - return SvxAreaTabPage::GetRanges; - case RID_SVXPAGE_SHADOW : - return SvxShadowTabPage::GetRanges; - case RID_SVXPAGE_LINE : - return SvxLineTabPage::GetRanges; - case RID_SVXPAGE_CONNECTION : - return SvxConnectionPage::GetRanges; - case RID_SVXPAGE_MEASURE : - return SvxMeasurePage::GetRanges; - case RID_SVXPAGE_PARA_ASIAN : - return SvxAsianTabPage::GetRanges; - case RID_SVXPAGE_EXT_PARAGRAPH : - return SvxExtParagraphTabPage::GetRanges; - case RID_SVXPAGE_ALIGN_PARAGRAPH : - return SvxParaAlignTabPage::GetRanges; - case RID_SVXPAGE_STD_PARAGRAPH : - return SvxStdParagraphTabPage::GetRanges; - case RID_SVXPAGE_TABULATOR : - return SvxTabulatorTabPage::GetRanges; - case RID_SVXPAGE_TEXTATTR : - return SvxTextAttrPage::GetRanges; - case RID_SVXPAGE_ALIGNMENT : - return svx::AlignmentTabPage::GetRanges; - case RID_SW_TP_BACKGROUND : - case RID_SVXPAGE_BACKGROUND : - return SvxBackgroundTabPage::GetRanges; - case RID_SVXPAGE_BORDER : - return SvxBorderTabPage::GetRanges; - case RID_SVXPAGE_CHAR_NAME : - return SvxCharNamePage::GetRanges; - case RID_SVXPAGE_CHAR_EFFECTS : - return SvxCharEffectsPage::GetRanges; - case RID_SVXPAGE_CHAR_POSITION : - return SvxCharPositionPage::GetRanges; - case RID_SVXPAGE_CHAR_TWOLINES : - return SvxCharTwoLinesPage::GetRanges; - case RID_SVXPAGE_NUMBERFORMAT : - return SvxNumberFormatTabPage::GetRanges; - case RID_SVXPAGE_PAGE : - return SvxPageDescPage::GetRanges; - case RID_SVXPAGE_ASIAN_LAYOUT: - return SvxAsianLayoutPage::GetRanges; - default: - break; - } - - return 0; -} - -SfxAbstractInsertObjectDialog* AbstractDialogFactory_Impl::CreateInsertObjectDialog( Window* pParent, const rtl::OUString& rCommand, - const Reference < com::sun::star::embed::XStorage >& xStor, - const SvObjectServerList* pList ) -{ - InsertObjectDialog_Impl* pDlg=0; - if ( rCommand.equalsAscii(".uno:InsertObject" ) ) - pDlg = new SvInsertOleDlg( pParent, xStor, pList ); - else if ( rCommand.equalsAscii(".uno:InsertPlugin" ) ) - pDlg = new SvInsertPlugInDialog( pParent, xStor ); - else if ( rCommand.equalsAscii(".uno:InsertObjectFloatingFrame" ) ) - pDlg = new SfxInsertFloatingFrameDialog( pParent, xStor ); - - if ( pDlg ) - { - pDlg->SetHelpId( rtl::OString( rCommand, rCommand.getLength(), RTL_TEXTENCODING_UTF8 ) ); - return new AbstractInsertObjectDialog_Impl( pDlg ); - } - return 0; -} - -VclAbstractDialog* AbstractDialogFactory_Impl::CreateEditObjectDialog( Window* pParent, const rtl::OUString& rCommand, - const Reference < com::sun::star::embed::XEmbeddedObject >& xObj ) -{ - InsertObjectDialog_Impl* pDlg=0; - if ( rCommand.equalsAscii(".uno:InsertObjectFloatingFrame" ) ) - { - pDlg = new SfxInsertFloatingFrameDialog( pParent, xObj ); - pDlg->SetHelpId( rtl::OString( rCommand, rCommand.getLength(), RTL_TEXTENCODING_UTF8 ) ); - return new VclAbstractDialog_Impl( pDlg ); - } - return 0; -} - - - -SfxAbstractPasteDialog* AbstractDialogFactory_Impl::CreatePasteDialog( Window* pParent ) -{ - return new AbstractPasteDialog_Impl( new SvPasteObjectDialog( pParent ) ); -} - -SfxAbstractLinksDialog* AbstractDialogFactory_Impl::CreateLinksDialog( Window* pParent, sfx2::LinkManager* pMgr, sal_Bool bHTML, sfx2::SvBaseLink* p) -{ - SvBaseLinksDlg* pLinkDlg = new SvBaseLinksDlg( pParent, pMgr, bHTML ); - if ( p ) - pLinkDlg->SetActLink(p); - return new AbstractLinksDialog_Impl( pLinkDlg ); -} - -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* /*pObj*/ ) -{ - return new AbstractTabDialog_Impl( new SvxFormatCellsDialog( pParent, pAttr, pModel ) ); -} - -SvxAbstractSplittTableDialog* AbstractDialogFactory_Impl::CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal ) -{ - return new SvxSplitTableDlg( pParent, bIsTableVertical, nMaxVertical, nMaxHorizontal ); -} - -SvxAbstractNewTableDialog* AbstractDialogFactory_Impl::CreateSvxNewTableDialog( Window* pParent ) -{ - return new SvxNewTableDialog( pParent ); -} - -VclAbstractDialog* AbstractDialogFactory_Impl::CreateOptionsDialog( - Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& /*rApplicationContext*/ ) -{ - return new VclAbstractDialog_Impl( new OfaTreeOptionsDialog( pParent, rExtensionId ) ); -} - -SvxAbstractInsRowColDlg* AbstractDialogFactory_Impl::CreateSvxInsRowColDlg( Window* pParent, bool bCol, const rtl::OString& sHelpId ) -{ - return new SvxInsRowColDlg( pParent, bCol, sHelpId ); -} - -AbstractPasswordToOpenModifyDialog * AbstractDialogFactory_Impl::CreatePasswordToOpenModifyDialog( - Window * pParent, - sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) -{ - PasswordToOpenModifyDialog * pDlg = new PasswordToOpenModifyDialog( pParent, nMinPasswdLen, nMaxPasswdLen, bIsPasswordToModify ); - return new AbstractPasswordToOpenModifyDialog_Impl( pDlg ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx deleted file mode 100644 index fd8b4629b..000000000 --- a/cui/source/factory/dlgfact.hxx +++ /dev/null @@ -1,795 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_DLGFACT_HXX -#define _CUI_DLGFACT_HXX - -// include --------------------------------------------------------------- -#include -#include - -#include "tools/link.hxx" -#include - -class SfxTabDialog; -class SfxModalDialog; -class Dialog; -class SfxItemPool; -class FmShowColsDialog; -class SvxZoomDialog; -class FmInputRecordNoDialog; -class SvxJSearchOptionsDialog; -class FmFormShell; -class SvxNewDictionaryDialog; -class SvxNameDialog; - -// #i68101# -class SvxObjectNameDialog; -class SvxObjectTitleDescDialog; - -class SvxMessDialog; -class SvxMultiPathDialog; -class SvxMultiFileDialog; -class SvxHpLinkDlg; -class FmSearchDialog; -class Graphic; -class GraphicFilterDialog; -class SvxAreaTabDialog; -class InsertObjectDialog_Impl; -class SvPasteObjectDialog; -class SvBaseLinksDlg; -class SvxTransformTabDialog; -class SvxCaptionTabDialog; -class SvxThesaurusDialog; -class SvxHyphenWordDialog; - -namespace svx{ -class HangulHanjaConversionDialog; -} -using namespace svx; - -#define DECL_ABSTDLG_BASE(Class,DialogClass) \ - DialogClass* pDlg; \ -public: \ - Class( DialogClass* p) \ - : pDlg(p) \ - {} \ - virtual ~Class(); \ - virtual short Execute() ; - -#define IMPL_ABSTDLG_BASE(Class) \ -Class::~Class() \ -{ \ - delete pDlg; \ -} \ -short Class::Execute() \ -{ \ - return pDlg->Execute(); \ -} - -//for GalleryThemeProperties begin -class VclAbstractDialog2_Impl : public VclAbstractDialog2 -{ - Dialog* m_pDlg; - Link m_aEndDlgHdl; -public: - VclAbstractDialog2_Impl( Dialog* p ) : m_pDlg( p ) {} \ - virtual ~VclAbstractDialog2_Impl(); - virtual void StartExecuteModal( const Link& rEndDialogHdl ); - virtual long GetResult(); -private: - DECL_LINK( EndDialogHdl, Dialog* ); -}; -//for GalleryThemeProperties end - -class VclAbstractDialog_Impl : public VclAbstractDialog -{ - DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog) -}; - -//for ActualizeProgress begin -class VclAbstractRefreshableDialog_Impl : public VclAbstractRefreshableDialog -{ - DECL_ABSTDLG_BASE(VclAbstractRefreshableDialog_Impl,Dialog) - virtual void Update() ; - virtual void Sync() ; -}; -//for ActualizeProgress end - -class AbstractSfxDialog_Impl : public SfxAbstractDialog -{ - DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog) - virtual const SfxItemSet* GetOutputItemSet() const; - - //From class Window. - virtual void SetText( const XubString& rStr ); - virtual String GetText() const ; -}; - -class AbstractTabDialog_Impl : public SfxAbstractTabDialog -{ - DECL_ABSTDLG_BASE(AbstractTabDialog_Impl,SfxTabDialog) - virtual void SetCurPageId( sal_uInt16 nId ); - virtual const SfxItemSet* GetOutputItemSet() const; - virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); - virtual void SetInputSet( const SfxItemSet* pInSet ); - //From class Window. - virtual void SetText( const XubString& rStr ); - virtual String GetText() const; -}; - -//for SvxDistributeDialog begin -class SvxDistributeDialog; -class AbstractSvxDistributeDialog_Impl: public AbstractSvxDistributeDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxDistributeDialog_Impl,SvxDistributeDialog) -public: - virtual SvxDistributeHorizontal GetDistributeHor() const; - virtual SvxDistributeVertical GetDistributeVer() const; -}; -//for SvxDistributeDialog end - -// for HangulHanjaConversionDialog begin -class AbstractHangulHanjaConversionDialog_Impl: public AbstractHangulHanjaConversionDialog -{ - DECL_ABSTDLG_BASE(AbstractHangulHanjaConversionDialog_Impl,HangulHanjaConversionDialog) - virtual void EndDialog(long nResult = 0); - virtual void EnableRubySupport( sal_Bool _bVal ); - virtual void SetByCharacter( sal_Bool _bByCharacter ) ; - virtual void SetConversionDirectionState( sal_Bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ); - virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ); - virtual void SetOptionsChangedHdl( const Link& _rHdl ); - virtual void SetIgnoreHdl( const Link& _rHdl ); - virtual void SetIgnoreAllHdl( const Link& _rHdl ) ; - virtual void SetChangeHdl( const Link& _rHdl ) ; - virtual void SetChangeAllHdl( const Link& _rHdl ) ; - virtual void SetClickByCharacterHdl( const Link& _rHdl ) ; - virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) ; - virtual void SetFindHdl( const Link& _rHdl ); - virtual sal_Bool GetUseBothDirections( ) const; - virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const; - virtual void SetCurrentString( - const String& _rNewString, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions, - bool _bOriginatesFromDocument = true - ); - virtual String GetCurrentString( ) const ; - virtual editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const ; - virtual void FocusSuggestion( ); - virtual String GetCurrentSuggestion( ) const; -}; - -class AbstractThesaurusDialog_Impl : public AbstractThesaurusDialog -{ - DECL_ABSTDLG_BASE(AbstractThesaurusDialog_Impl,SvxThesaurusDialog) - virtual String GetWord(); - virtual sal_uInt16 GetLanguage() const; - virtual Window* GetWindow(); -}; - - -class AbstractHyphenWordDialog_Impl: public AbstractHyphenWordDialog -{ - DECL_ABSTDLG_BASE(AbstractHyphenWordDialog_Impl,SvxHyphenWordDialog) - virtual void SelLeft(); - virtual void SelRight(); - virtual Window* GetWindow(); -}; - -// for FmShowColsDialog begin -class FmShowColsDialog; -class AbstractFmShowColsDialog_Impl : public AbstractFmShowColsDialog -{ - DECL_ABSTDLG_BASE(AbstractFmShowColsDialog_Impl,FmShowColsDialog) - virtual void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols); -}; -//for FmShowColsDialog end - - -//for SvxZoomDialog begin -class SvxZoomDialog; -class AbstractSvxZoomDialog_Impl : public AbstractSvxZoomDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxZoomDialog_Impl,SvxZoomDialog) - virtual void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ); - virtual void HideButton( sal_uInt16 nBtnId ); - virtual const SfxItemSet* GetOutputItemSet() const ; - -}; -//for SvxZoomDialog end - -//for SvxSpellDialog begin -namespace svx{ class SpellDialog;} -class AbstractSpellDialog_Impl : public AbstractSpellDialog -{ - public: - DECL_ABSTDLG_BASE(AbstractSpellDialog_Impl, svx::SpellDialog) - virtual void SetLanguage( sal_uInt16 nLang ); - virtual sal_Bool Close(); - virtual void Invalidate(); - virtual Window* GetWindow(); - virtual SfxBindings& GetBindings(); -}; -//for SvxSpellDialog end -//for SearchProgress begin -class SearchProgress; -class AbstractSearchProgress_Impl : public AbstractSearchProgress -{ - DECL_ABSTDLG_BASE(AbstractSearchProgress_Impl,SearchProgress) - virtual void Update() ; - virtual void Sync() ; - virtual void SetFileType( const String& rType ) ; - virtual void SetDirectory( const INetURLObject& rURL ) ; - virtual PLinkStub GetLinkStubCleanUpHdl() ; - -}; -//for SearchProgress end - -//for TakeProgress begin -class TakeProgress; -class AbstractTakeProgress_Impl : public AbstractTakeProgress -{ - DECL_ABSTDLG_BASE(AbstractTakeProgress_Impl,TakeProgress) - virtual void Update() ; - virtual void Sync() ; - virtual void SetFile( const INetURLObject& rURL ) ; - virtual PLinkStub GetLinkStubCleanUpHdl() ; - -}; -//for TakeProgress end - -//for TitleDialog begin -class TitleDialog; -class AbstractTitleDialog_Impl : public AbstractTitleDialog -{ - DECL_ABSTDLG_BASE(AbstractTitleDialog_Impl,TitleDialog) - virtual String GetTitle() const ; - -}; -//for TitleDialog end - -//for SvxScriptSelectorDialog begin -class SvxScriptSelectorDialog; -class AbstractScriptSelectorDialog_Impl : public AbstractScriptSelectorDialog -{ - DECL_ABSTDLG_BASE( - AbstractScriptSelectorDialog_Impl, SvxScriptSelectorDialog) - - virtual String GetScriptURL() const; - - virtual void SetRunLabel(); -}; - -//for GalleryIdDialog begin -class GalleryIdDialog; -class AbstractGalleryIdDialog_Impl : public AbstractGalleryIdDialog -{ - DECL_ABSTDLG_BASE(AbstractGalleryIdDialog_Impl,GalleryIdDialog) - virtual sal_uLong GetId() const ; - -}; -//for GalleryIdDialog end - -//for URLDlg start -class URLDlg; -class AbstractURLDlg_Impl :public AbstractURLDlg -{ - DECL_ABSTDLG_BASE(AbstractURLDlg_Impl,URLDlg) - virtual String GetURL() const; - virtual String GetAltText() const; - virtual String GetDesc() const; - virtual String GetTarget() const; - virtual String GetName() const; -}; -//for URLDlg end - -//for SvxHlinkDlgMarkWnd begin -class SvxHlinkDlgMarkWnd; -class AbstractSvxHlinkDlgMarkWnd_Impl : public AbstractSvxHlinkDlgMarkWnd -{ - DECL_ABSTDLG_BASE(AbstractSvxHlinkDlgMarkWnd_Impl,SvxHlinkDlgMarkWnd) - virtual void Hide( sal_uInt16 nFlags = 0 ); - virtual sal_Bool IsVisible() const ; - virtual void Invalidate( sal_uInt16 nFlags = 0 ); - virtual void SetSizePixel( const Size& rNewSize ); - virtual Size GetSizePixel() const; - virtual sal_Bool MoveTo ( Point aNewPos )const; - virtual sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True )const; - virtual void RefreshTree ( String aStrURL ) ; - virtual void SelectEntry ( String aStrMark ); - virtual sal_uInt16 SetError( sal_uInt16 nError) ; - -}; -//for SvxHlinkDlgMarkWnd end - -//for SvxSearchSimilarityDialog begin -class SvxSearchSimilarityDialog; -class AbstractSvxSearchSimilarityDialog_Impl :public AbstractSvxSearchSimilarityDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxSearchSimilarityDialog_Impl,SvxSearchSimilarityDialog) - virtual sal_uInt16 GetOther(); - virtual sal_uInt16 GetShorter(); - virtual sal_uInt16 GetLonger(); - virtual sal_Bool IsRelaxed(); -}; -//for SvxSearchSimilarityDialog end - -//for SvxJSearchOptionsDialog end -class SvxJSearchOptionsDialog; -class AbstractSvxJSearchOptionsDialog_Impl :public AbstractSvxJSearchOptionsDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxJSearchOptionsDialog_Impl,SvxJSearchOptionsDialog) - virtual sal_Int32 GetTransliterationFlags() const; -}; -//for SvxJSearchOptionsDialog end - -class AbstractSvxTransformTabDialog_Impl : public AbstractSvxTransformTabDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxTransformTabDialog_Impl,SvxTransformTabDialog) - virtual void SetValidateFramePosLink( const Link& rLink ); - virtual void SetCurPageId( sal_uInt16 nId ); - virtual const SfxItemSet* GetOutputItemSet() const; - virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); - virtual void SetInputSet( const SfxItemSet* pInSet ); - virtual void SetText( const XubString& rStr ); - virtual String GetText() const; -}; -class AbstractSvxCaptionDialog_Impl : public AbstractSvxCaptionDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxCaptionDialog_Impl,SvxCaptionTabDialog) - virtual void SetValidateFramePosLink( const Link& rLink ); - virtual void SetCurPageId( sal_uInt16 nId ); - virtual const SfxItemSet* GetOutputItemSet() const; - virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); - virtual void SetInputSet( const SfxItemSet* pInSet ); - virtual void SetText( const XubString& rStr ); - virtual String GetText() const; -}; - -//for FmInputRecordNoDialog end -class FmInputRecordNoDialog; -class AbstractFmInputRecordNoDialog_Impl :public AbstractFmInputRecordNoDialog -{ - DECL_ABSTDLG_BASE(AbstractFmInputRecordNoDialog_Impl,FmInputRecordNoDialog) - virtual void SetValue(long nNew) ; - virtual long GetValue() const ; -}; -//for FmInputRecordNoDialog end - -//for SvxNewDictionaryDialog end -class SvxNewDictionaryDialog; -class AbstractSvxNewDictionaryDialog_Impl :public AbstractSvxNewDictionaryDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxNewDictionaryDialog_Impl,SvxNewDictionaryDialog) - virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetNewDictionary(); -}; -//for SvxNewDictionaryDialog end - -//for SvxNameDialog end -class SvxNameDialog; -class AbstractSvxNameDialog_Impl :public AbstractSvxNameDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxNameDialog_Impl,SvxNameDialog) - virtual void GetName( String& rName ) ; - virtual void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false ) ; - virtual void SetEditHelpId(const rtl::OString&) ; - //from class Window - virtual void SetHelpId( const rtl::OString& ) ; - virtual void SetText( const XubString& rStr ) ; -private: - Link aCheckNameHdl; - DECL_LINK( CheckNameHdl, Window*); -}; -//for SvxNameDialog end - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# - -// predefines -class SvxObjectNameDialog; -class SvxObjectTitleDescDialog; - -class AbstractSvxObjectNameDialog_Impl :public AbstractSvxObjectNameDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxObjectNameDialog_Impl, SvxObjectNameDialog) - virtual void GetName(String& rName) ; - virtual void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false); - -private: - Link aCheckNameHdl; - DECL_LINK(CheckNameHdl, Window*); -}; - -class AbstractSvxObjectTitleDescDialog_Impl :public AbstractSvxObjectTitleDescDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxObjectTitleDescDialog_Impl, SvxObjectTitleDescDialog) - virtual void GetTitle(String& rName); - virtual void GetDescription(String& rName); -}; - -/////////////////////////////////////////////////////////////////////////////////////////////// - -//for SvxMessDialog end -class SvxMessDialog; -class AbstractSvxMessDialog_Impl :public AbstractSvxMessDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxMessDialog_Impl,SvxMessDialog) - virtual void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ); -}; -//for SvxMessDialog end - -//for SvxMultiPathDialog end -class SvxMultiPathDialog; -class AbstractSvxMultiPathDialog_Impl :public AbstractSvxMultiPathDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxMultiPathDialog_Impl,SvxMultiPathDialog) - virtual String GetPath() const; - virtual void SetPath( const String& rPath ); - virtual void EnableRadioButtonMode(); - virtual void SetTitle( const String& rNewTitle ); -}; -//for SvxMultiPathDialog end - -//for SvxMultiFileDialog begin -class SvxMultiFileDialog; -class AbstractSvxMultiFileDialog_Impl :public AbstractSvxMultiFileDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxMultiFileDialog_Impl,SvxMultiFileDialog) - virtual String GetFiles() const ; - virtual void SetFiles( const String& rPath ) ; - //from SvxMultiPathDialog - virtual String GetPath() const; - virtual void SetPath( const String& rPath ); - virtual void SetClassPathMode(); - virtual void EnableRadioButtonMode(); - virtual void SetTitle( const String& rNewTitle ); - //From Class Window - virtual void SetHelpId( const rtl::OString& ) ; - -}; -//for SvxMultiFileDialog end - -//for SvxHpLinkDlg begin -class SvxHpLinkDlg; -class AbstractSvxHpLinkDlg_Impl :public AbstractSvxHpLinkDlg -{ - DECL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl,SvxHpLinkDlg) - virtual Window* GetWindow(); - virtual sal_Bool QueryClose(); -}; -//for SvxHpLinkDlg end - -//for FmSearchDialog begin -class FmSearchDialog; -class AbstractFmSearchDialog_Impl :public AbstractFmSearchDialog -{ - DECL_ABSTDLG_BASE(AbstractFmSearchDialog_Impl,FmSearchDialog) - virtual void SetFoundHandler(const Link& lnk) ; - virtual void SetCanceledNotFoundHdl(const Link& lnk); - virtual void SetActiveField(const String& strField); -}; -//for FmSearchDialog end - -//for GraphicFilterDialog begin -class GraphicFilterDialog; -class AbstractGraphicFilterDialog_Impl :public AbstractGraphicFilterDialog -{ - DECL_ABSTDLG_BASE(AbstractGraphicFilterDialog_Impl,GraphicFilterDialog) - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); -}; -//for GraphicFilterDialog end - -//add for SvxAreaTabDialog begin -class SvxAreaTabDialog; -class AbstractSvxAreaTabDialog_Impl :public AbstractSvxAreaTabDialog -{ - DECL_ABSTDLG_BASE(AbstractSvxAreaTabDialog_Impl,SvxAreaTabDialog) - virtual void SetCurPageId( sal_uInt16 nId ); - virtual const SfxItemSet* GetOutputItemSet() const; - virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ); - virtual void SetInputSet( const SfxItemSet* pInSet ); - //From class Window. - virtual void SetText( const XubString& rStr ); - virtual String GetText() const; - virtual void DontDeleteColorTable() ; -}; -//add for SvxAreaTabDialog end - -class AbstractInsertObjectDialog_Impl : public SfxAbstractInsertObjectDialog -{ - DECL_ABSTDLG_BASE(AbstractInsertObjectDialog_Impl, InsertObjectDialog_Impl) - virtual com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ); - virtual sal_Bool IsCreateNew(); -}; - -class AbstractPasteDialog_Impl : public SfxAbstractPasteDialog -{ -public: - DECL_ABSTDLG_BASE(AbstractPasteDialog_Impl, SvPasteObjectDialog ) - virtual void Insert( SotFormatStringId nFormat, const String & rFormatName ); - virtual void SetObjName( const SvGlobalName & rClass, const String & rObjName ); - virtual sal_uLong GetFormat( const TransferableDataHelper& aHelper, - const DataFlavorExVector* pFormats=0, - const TransferableObjectDescriptor* pDesc=0 ); -}; - -class AbstractLinksDialog_Impl : public SfxAbstractLinksDialog -{ -public: - DECL_ABSTDLG_BASE(AbstractLinksDialog_Impl, SvBaseLinksDlg ) -}; - - -//add for SvxPostItDialog begin -class SvxPostItDialog; -class AbstractSvxPostItDialog_Impl :public AbstractSvxPostItDialog -{ - DECL_ABSTDLG_BASE( AbstractSvxPostItDialog_Impl, SvxPostItDialog ) - virtual void SetText( const XubString& rStr ); //From class Window - virtual const SfxItemSet* GetOutputItemSet() const; - virtual void SetPrevHdl( const Link& rLink ) ; - virtual void SetNextHdl( const Link& rLink ) ; - virtual void EnableTravel(sal_Bool bNext, sal_Bool bPrev) ; - virtual String GetNote() ; - virtual void SetNote(const String& rTxt) ; - virtual void ShowLastAuthor(const String& rAuthor, const String& rDate) ; - virtual void DontChangeAuthor() ; - virtual void HideAuthor() ; - virtual void SetReadonlyPostIt(sal_Bool bDisable) ; - virtual sal_Bool IsOkEnabled() const ; - virtual Window * GetWindow(); -private: - Link aNextHdl; - Link aPrevHdl; - DECL_LINK( NextHdl, Window*); - DECL_LINK( PrevHdl, Window*); -}; -//add for SvxPostItDialog end - -//for PasswordToOpenModifyDialog begin -class PasswordToOpenModifyDialog; -class AbstractPasswordToOpenModifyDialog_Impl : public AbstractPasswordToOpenModifyDialog -{ - DECL_ABSTDLG_BASE( AbstractPasswordToOpenModifyDialog_Impl, PasswordToOpenModifyDialog ) - - virtual String GetPasswordToOpen() const; - virtual String GetPasswordToModify() const; - virtual bool IsRecommendToOpenReadonly() const; -}; -//for PasswordToOpenModifyDialog end - - -//------------------------------------------------------------------------ -//AbstractDialogFactory_Impl implementations -class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory -{ -public: - virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ); - virtual VclAbstractDialog* CreateSfxDialog( Window* pParent, const SfxBindings& rBindings, sal_uInt32 nResId ); - virtual SfxAbstractDialog* CreateSfxDialog( sal_uInt32 nResId, - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame, - const SfxItemSet* pAttrSet=0 ); - virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, - const SfxItemSet& rAttr, - const SdrView* pView, - sal_uInt32 nResId ); - virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog - const SfxItemSet& rAttr, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame, - sal_uInt32 nResId - ); - virtual VclAbstractDialog* CreateFrameDialog( Window* pParent, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rxFrame, sal_uInt32 nResId, const String& rParameter ); - virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId, - Window* pParent, - const SfxItemSet* pAttrSet, - SfxViewFrame* pViewFrame, - bool bEditFmt=false, - const String *pUserButtonText=0 ); - virtual SfxAbstractTabDialog* CreateTabDialog( sal_uInt32 nResId, - Window* pParent, - const SfxItemSet* pAttrSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xViewFrame, - bool bEditFmt=false, - const String *pUserButtonText=0 ); - virtual SfxAbstractTabDialog* CreateTextTabDialog( Window* pParent, - const SfxItemSet* pAttrSet, - SdrView* pView, - SdrModel* pModel=0 ); //add for SvxTextTabDialog - virtual SfxAbstractTabDialog* CreateTabItemDialog( Window* pParent, - const SfxItemSet& rSet, - sal_uInt32 nResId); - virtual AbstractSvxCaptionDialog* CreateCaptionDialog( Window* pParent, - const SdrView* pView, - sal_uInt16 nAnchorTypes = 0 ); - virtual AbstractSvxDistributeDialog* CreateSvxDistributeDialog(Window* pParent, - const SfxItemSet& rAttr, - SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone, - SvxDistributeVertical eVer = SvxDistributeVerticalNone); - virtual SfxAbstractInsertObjectDialog* CreateInsertObjectDialog( Window* pParent, const rtl::OUString& rCommmand, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStor, - const SvObjectServerList* pList = 0 ); - virtual VclAbstractDialog* CreateEditObjectDialog( Window* pParent, const rtl::OUString& rCommmand, - const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj ); - virtual SfxAbstractPasteDialog* CreatePasteDialog( Window* pParent ); - virtual SfxAbstractLinksDialog* CreateLinksDialog( Window* pParent, sfx2::LinkManager* pMgr, sal_Bool bHTML, sfx2::SvBaseLink* p=0 ); - - virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent, //add for HangulHanjaConversionDialog - editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ); - virtual AbstractThesaurusDialog* CreateThesaurusDialog( Window*, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, sal_Int16 nLanguage ); - - virtual AbstractHyphenWordDialog* CreateHyphenWordDialog( Window*, - const String &rWord, LanguageType nLang, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ); - - virtual AbstractFmShowColsDialog * CreateFmShowColsDialog( Window* pParent ); //add for FmShowColsDialog - virtual AbstractSvxZoomDialog * CreateSvxZoomDialog( Window* pParent, //add for SvxZoomDialog - const SfxItemSet& rCoreSet); - virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, //add for SvxBorderBackgroundDlg - const SfxItemSet& rCoreSet, - sal_Bool bEnableSelector = sal_False) ; - virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, //add for SvxTransformTabDialog - const SfxItemSet* pAttr, - const SdrView* pView, - sal_uInt16 nAnchorTypes = 0) ; - virtual SfxAbstractTabDialog* CreateSchTransformTabDialog( Window* pParent, //add for SchTransformTabDialog - const SfxItemSet* pAttr, - const SdrView* pSdrView, - sal_uInt32 nResId, - bool bSizeTabPage = false - ); - virtual AbstractSpellDialog * CreateSvxSpellDialog( - Window* pParent, - SfxBindings* pBindings, - svx::SpellDialogChildWindow* pSpellChildWindow ); - - virtual VclAbstractRefreshableDialog * CreateActualizeProgressDialog( Window* pParent, GalleryTheme* pThm ); - virtual AbstractSearchProgress * CreateSearchProgressDialog( Window* pParent, - const INetURLObject& rStartURL); - virtual AbstractTakeProgress * CreateTakeProgressDialog( Window* pParent ); - virtual AbstractTitleDialog * CreateTitleDialog( Window* pParent, //add for TitleDialog - const String& rOldText); - virtual AbstractGalleryIdDialog * CreateGalleryIdDialog( Window* pParent, //add for SvxZoomDialog - GalleryTheme* pThm); - virtual VclAbstractDialog2 * CreateGalleryThemePropertiesDialog( Window* pParent, //add for GalleryThemeProperties - ExchangeData* pData, - SfxItemSet* pItemSet); - virtual AbstractURLDlg * CreateURLDialog( Window* pParent, //add for URLDlg - const String& rURL, const String& rAltText, const String& rDescription, - const String& rTarget, const String& rName, - TargetList& rTargetList ); - virtual AbstractSvxHlinkDlgMarkWnd* CreateSvxHlinkDlgMarkWndDialog( SvxHyperlinkTabPageBase* pParent, sal_uInt32 nResId ); //add for SvxHlinkDlgMarkWnd - - virtual VclAbstractDialog* CreateSvxSearchAttributeDialog( Window* pParent, - SearchAttrItemList& rLst, - const sal_uInt16* pWhRanges); - virtual AbstractSvxSearchSimilarityDialog * CreateSvxSearchSimilarityDialog( Window* pParent, - sal_Bool bRelax, - sal_uInt16 nOther, - sal_uInt16 nShorter, - sal_uInt16 nLonger); //add for SvxSearchSimilarityDialog - virtual AbstractSvxJSearchOptionsDialog * CreateSvxJSearchOptionsDialog( Window* pParent, - const SfxItemSet& rOptionsSet, - sal_Int32 nInitialFlags); - virtual AbstractFmInputRecordNoDialog * CreateFmInputRecordNoDialog( Window* pParent ); - virtual AbstractSvxNewDictionaryDialog* CreateSvxNewDictionaryDialog( Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl, - sal_uInt32 nResId ); //add for SvxNewDictionaryDialog - virtual VclAbstractDialog * CreateSvxEditDictionaryDialog( Window* pParent, - const String& rName, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1> &xSpl, - sal_uInt32 nResId);//add for SvxEditDictionaryDialog - virtual AbstractSvxNameDialog * CreateSvxNameDialog( Window* pParent, - const String& rName, const String& rDesc ); - // #i68101# - virtual AbstractSvxObjectNameDialog* CreateSvxObjectNameDialog(Window* pParent, const String& rName ); - virtual AbstractSvxObjectTitleDescDialog* CreateSvxObjectTitleDescDialog(Window* pParent, const String& rTitle, const String& rDescription); - - virtual AbstractSvxMessDialog * CreateSvxMessDialog( Window* pParent, sal_uInt32 nResId, - const String& rText, const String& rDesc, - Image* pImg = NULL ); //add for SvxMessDialog - virtual AbstractSvxMultiPathDialog * CreateSvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ); //add for SvxMultiPathDialog - virtual AbstractSvxMultiFileDialog * CreateSvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ); //add for SvxMultiFileDialog - virtual AbstractSvxHpLinkDlg * CreateSvxHpLinkDlg (Window* pParent, //add for SvxHpLink - SfxBindings* pBindings, - sal_uInt32 nResId); - virtual AbstractFmSearchDialog* CreateFmSearchDialog(Window* pParent, //add for FmSearchDialog - const String& strInitialText, - const ::std::vector< String >& _rContexts, - sal_Int16 nInitialContext, - const Link& lnkContextSupplier); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterEmboss (Window* pParent, //add for GraphicFilterEmboss - const Graphic& rGraphic, - RECT_POINT eLightSource, sal_uInt32 nResId); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterPosterSepia (Window* pParent, //add for GraphicFilterPoster & GraphicFilterSepia - const Graphic& rGraphic, - sal_uInt16 nCount, - sal_uInt32 nResId); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterSolarize (Window* pParent, //add for GraphicFilterSolarize - const Graphic& rGraphic, - sal_uInt8 nGreyThreshold, sal_Bool bInvert, sal_uInt32 nResId); - virtual AbstractGraphicFilterDialog * CreateGraphicFilterMosaic (Window* pParent, //add for GraphicFilterMosaic - const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges, sal_uInt32 nResId); - virtual AbstractSvxAreaTabDialog* CreateSvxAreaTabDialog( Window* pParent,//add for SvxAreaTabDialog - const SfxItemSet* pAttr, - SdrModel* pModel, - const SdrView* pSdrView = NULL ); //add for SvxAreaTabDialog - virtual SfxAbstractTabDialog* CreateSvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, //add for SvxLineTabDialog - SdrModel* pModel, - const SdrObject* pObj = NULL, - sal_Bool bHasObj = sal_True ); - virtual AbstractSvxPostItDialog* CreateSvxPostItDialog( Window* pParent, //add for SvxPostItDialog - const SfxItemSet& rCoreSet, - sal_Bool bPrevNext = sal_False, sal_Bool bRedline = sal_False ); - - // For TabPage - virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ); - virtual CreateSvxDistributePage GetSvxDistributePageCreatorFunc(); - - virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ); - virtual DialogGetRanges GetDialogGetRangesFunc( sal_uInt16 nId ); //add for SvxPostItDialog - virtual VclAbstractDialog* CreateSvxScriptOrgDialog( Window* pParent, const String& rLanguage ); - - virtual AbstractScriptSelectorDialog* - CreateScriptSelectorDialog( - Window* pParent, - sal_Bool bShowSlots, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame - ); - - virtual VclAbstractDialog* CreateScriptErrorDialog( - Window* pParent, ::com::sun::star::uno::Any aException); - - virtual VclAbstractDialog* CreateSvxMacroAssignDlg( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame, - const bool _bUnoDialogMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& _rxEvents, - const sal_uInt16 _nInitiallySelectedEvent - ); - - virtual SfxAbstractTabDialog* CreateSvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj = NULL ); - - virtual SvxAbstractSplittTableDialog* CreateSvxSplittTableDialog( Window* pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal ); - - virtual SvxAbstractNewTableDialog* CreateSvxNewTableDialog( Window* pParent ) ; - - virtual VclAbstractDialog* CreateOptionsDialog( - Window* pParent, const rtl::OUString& rExtensionId, const rtl::OUString& rApplicationContext ); - - virtual SvxAbstractInsRowColDlg* CreateSvxInsRowColDlg( Window* pParent, bool bCol, const rtl::OString& sHelpId ); - - virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx deleted file mode 100644 index ac3753f57..000000000 --- a/cui/source/factory/init.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "cuicharmap.hxx" - -// ------------------------------------------------------------------------ -// hook to call special character dialog for edits -// caution: needs C-Linkage since dynamically loaded via symbol name -extern "C" -{ -SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, String& o_rResult) -{ - bool bRet = false; - SvxCharacterMap* aDlg = new SvxCharacterMap( i_pParent ); - aDlg->DisableFontSelection(); - aDlg->SetCharFont(i_rFont); - if ( aDlg->Execute() == RET_OK ) - { - o_rResult = aDlg->GetCharacters(); - bRet = true; - } - delete aDlg; - return bRet; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/ControlFocusHelper.hxx b/cui/source/inc/ControlFocusHelper.hxx deleted file mode 100644 index 70789226a..000000000 --- a/cui/source/inc/ControlFocusHelper.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_CONTROLL_FUCUS_HELPER_HXX -#define SVX_CONTROLL_FUCUS_HELPER_HXX - -#include - -// class SvxControlFocusHelper --------------------------------------------- - -class SvxControlFocusHelper : public Control -{ -private: - Control* m_pFocusCtrl; - -public: - SvxControlFocusHelper( Window* pParent, const ResId& rId ) : - Control( pParent, rId ), m_pFocusCtrl( NULL ) {} - - void SetFocusControl( Control* pCtrl ) { m_pFocusCtrl = pCtrl; } - - virtual long Notify( NotifyEvent& rNEvt ); -}; - -#endif // SVX_CONTROLL_FUCUS_HELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx deleted file mode 100644 index 085240ca0..000000000 --- a/cui/source/inc/SpellDialog.hxx +++ /dev/null @@ -1,264 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SPELLDDIALOG_HXX -#define _SVX_SPELLDDIALOG_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include - -#include - -class ScrollBar; -class TextEngine; -class ExtTextView; -namespace svx{ class SpellUndoAction_Impl;} - -// forward --------------------------------------------------------------- - -struct SpellDialog_Impl; - -namespace com{namespace sun{namespace star{ -namespace linguistic2{ - class XSpellChecker1; -}}}} -namespace svx{ -class SpellDialog; -struct SpellErrorDescription; -// ------------------------------------------------------------------ -class SentenceEditWindow_Impl : public MultiLineEdit -{ - using MultiLineEdit::SetText; - -private: - std::set< sal_uInt16 > m_aIgnoreErrorsAt; - sal_uInt16 m_nErrorStart; - sal_uInt16 m_nErrorEnd; - bool m_bIsUndoEditMode; - - Link m_aModifyLink; - - void CallModifyLink() {m_aModifyLink.Call(this);} - - SpellDialog* GetSpellDialog() const {return (SpellDialog*)GetParent();} -protected: - virtual long PreNotify( NotifyEvent& rNEvt ); - -public: - SentenceEditWindow_Impl( SpellDialog* pParent, const ResId& rResId ); - ~SentenceEditWindow_Impl(); - - void SetModifyHdl(const Link& rLink) { m_aModifyLink = rLink;} - - void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); - void SetText( const String& rStr ); - - bool MarkNextError( bool bIgnoreCurrentError ); - void ChangeMarkedWord(const String& rNewWord, LanguageType eLanguage); - void MoveErrorMarkTo(sal_uInt16 nErrorStart, sal_uInt16 nErrorEnd, bool bGrammar); - String GetErrorText() const; - void RestoreCurrentError(); - - void SetAlternatives( - com::sun::star::uno::Reference ); - - const SpellErrorDescription* GetAlternatives(); - - - void ResetModified() { GetTextEngine()->SetModified(sal_False); m_bIsUndoEditMode = false;} - sal_Bool IsModified() const { return GetTextEngine()->IsModified(); } - - bool IsUndoEditMode() const { return m_bIsUndoEditMode;} - void SetUndoEditMode(bool bSet); - - svx::SpellPortions CreateSpellPortions( bool bSetIgnoreFlag ) const; - - void ResetUndo(); - void Undo(); - void AddUndoAction( SfxUndoAction *pAction, sal_Bool bTryMerg=sal_False ); - sal_uInt16 GetUndoActionCount(); - void UndoActionStart( sal_uInt16 nId ); - void UndoActionEnd(); - - void MoveErrorEnd(long nOffset); - - void ResetIgnoreErrorsAt() { m_aIgnoreErrorsAt.clear(); } -}; - - -// class SvxSpellDialog --------------------------------------------- -class SpellDialogChildWindow; -class ExplainButton : public PushButton -{ - String m_sExplanation; - - virtual void RequestHelp( const HelpEvent& rHEvt ); - virtual void Click(); -public: - ExplainButton( Window* pParent, const ResId& rResId ) : PushButton( pParent, rResId ){} - ~ExplainButton(); - void SetExplanation( const String& rText ) {m_sExplanation = rText;} - bool HasExplanation() { return m_sExplanation.Len() > 0;} - -}; - -class SpellDialog : public SfxModelessDialog -{ - using Window::Invalidate; - - friend class SentenceEditWindow_Impl; -private: - - FixedImage aVendorImageFI; - - FixedText aLanguageFT; - SvxLanguageBox aLanguageLB; - - FixedText aNotInDictFT; - SentenceEditWindow_Impl aSentenceED; - - FixedText aSuggestionFT; - ListBox aSuggestionLB; - - PushButton aIgnorePB; - PushButton aIgnoreAllPB; - PushButton aIgnoreRulePB; - MenuButton aAddToDictMB; - - PushButton aChangePB; - PushButton aChangeAllPB; - ExplainButton aExplainPB; - PushButton aAutoCorrPB; - - CheckBox aCheckGrammarCB; - - HelpButton aHelpPB; - PushButton aOptionsPB; - PushButton aUndoPB; - PushButton aClosePB; - - GroupBox aBackgroundGB; - - Image aVendorImage; - - String aResumeST; - String aIgnoreOnceST; - String aNoSuggestionsST; - - const String m_sTitleSpelling; - const String m_sTitleSpellingGrammar; - const String m_sTitleSpellingGrammarVendor; - - Size aOldWordEDSize; - Link aDialogUndoLink; - - bool bModified; - bool bFocusLocked; - - svx::SpellDialogChildWindow& rParent; - svx::SpellPortions m_aSavedSentence; - - SpellDialog_Impl* pImpl; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; - LanguageType nOldLang; - - DECL_LINK( ChangeHdl, Button * ); - DECL_LINK( ChangeAllHdl, Button * ); - DECL_LINK( IgnoreAllHdl, Button * ); - DECL_LINK( IgnoreHdl, Button * ); - DECL_LINK( CheckGrammarHdl, CheckBox* ); - DECL_LINK( ExtClickHdl, Button * ); - DECL_LINK( CancelHdl, Button * ); - DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *); - DECL_LINK( UndoHdl, Button * ); - DECL_LINK( AddToDictionaryHdl, MenuButton* ); - DECL_LINK( LanguageSelectHdl, SvxLanguageBox* ); - DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* ); - - DECL_STATIC_LINK( SpellDialog, InitHdl, SpellDialog * ); - - void StartSpellOptDlg_Impl(); - void InitUserDicts(); - void UpdateBoxes_Impl(); - void Init_Impl(); - void SpellContinue_Impl(bool UseSavedSentence = false, bool bIgnoreCurrentError = false ); - void LockFocusChanges( bool bLock ) {bFocusLocked = bLock;} - void Impl_Restore(); - - void SetSelectedLang_Impl( LanguageType nLang ); - LanguageType GetSelectedLang_Impl() const; - - /** Retrieves the next sentence. - */ - bool GetNextSentence_Impl(bool bUseSavedSentence, bool bRechek /*for rechecking the current sentence*/); - /** Corrects all errors that have been selected to be changed always - */ - bool ApplyChangeAllList_Impl(SpellPortions& rSentence, bool& bHasReplaced); - void SetTitle_Impl(LanguageType nLang); - -protected: - virtual void Paint( const Rectangle& rRect ); - virtual long Notify( NotifyEvent& rNEvt ); - -public: - SpellDialog( - svx::SpellDialogChildWindow* pChildWindow, - Window * pParent, - SfxBindings* pBindings); - ~SpellDialog(); - - void SetLanguage( sal_uInt16 nLang ); - virtual sal_Bool Close(); - - void InvalidateDialog(); -}; -} //namespace svx - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/about.hxx b/cui/source/inc/about.hxx deleted file mode 100644 index 70aa098ca..000000000 --- a/cui/source/inc/about.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _ABOUT_HXX -#define _ABOUT_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include "svtools/fixedhyper.hxx" -#include // SfxModalDialog -#include - -typedef ::std::vector< Accelerator* > AccelList; - -// class AboutDialog ----------------------------------------------------- - -class AboutDialog : public SfxModalDialog -{ -private: - OKButton aOKButton; - Image aAppLogo; - - MultiLineEdit aVersionText; - MultiLineEdit aCopyrightText; - svt::FixedHyperlink aInfoLink; - - String aVersionData; - String aVersionTextStr; - String m_aVendorTextStr; - String m_aOracleCopyrightTextStr; - String m_aAcknowledgementTextStr; - String m_aLinkStr; - String m_sBuildStr; - -protected: - virtual sal_Bool Close(); - virtual void Paint( const Rectangle& rRect ); - -public: - AboutDialog( Window* pParent, const ResId& rId); - - DECL_LINK( HandleHyperlink, svt::FixedHyperlink * ); -}; - -#endif // #ifndef _ABOUT_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx deleted file mode 100644 index 51a28c645..000000000 --- a/cui/source/inc/acccfg.hxx +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _ACCCFG_HXX -#define _ACCCFG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVSTDARR_STRINGSDTOR -#include - -#include - -#include "cfgutil.hxx" - -// class SfxAcceleratorConfigListBox ************************************************* - -#define css ::com::sun::star - -class SfxMacroInfoItem; -class SfxConfigGroupListBox_Impl; -class SfxConfigFunctionListBox_Impl; -class SfxAcceleratorConfigPage; - -class SfxAccCfgTabListBox_Impl : public SvTabListBox -{ - SfxAcceleratorConfigPage* m_pAccelConfigPage; - - void KeyInput( const KeyEvent &rKEvt ); - -protected: - virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind ); - -public: - SfxAccCfgTabListBox_Impl( - SfxAcceleratorConfigPage* pAccelConfigPage, - Window *pParent, - const ResId &rResId ) : - SvTabListBox( pParent, rResId ), - m_pAccelConfigPage( pAccelConfigPage ) - {} - - void ReplaceEntry( sal_uInt16 nPos, const String &rStr ); -}; - -// class SfxAcceleratorConfigPage ---------------------------------------- - -struct TAccInfo -{ - public: - - TAccInfo( sal_Int32 nKeyPos , - sal_Int32 nListPos, - const KeyCode& aKey ) - : m_nKeyPos (nKeyPos ) - , m_nListPos (nListPos ) - , m_bIsConfigurable(sal_True ) - , m_sCommand ( ) - , m_aKey (aKey ) - // its important to set sal_True as default - - // because only fix entries will be disabled later ... - {} - - sal_Bool isConfigured() const - { - return (m_nKeyPos>-1 && m_nListPos>-1 && m_sCommand.getLength()); - } - - sal_Int32 m_nKeyPos; - sal_Int32 m_nListPos; - sal_Bool m_bIsConfigurable; - ::rtl::OUString m_sCommand; - KeyCode m_aKey; -}; - -namespace sfx2 -{ - class FileDialogHelper; -} - -class SfxAcceleratorConfigPage : public SfxTabPage -{ - friend class SfxAccCfgTabListBox_Impl; -private: - const SfxMacroInfoItem* m_pMacroInfoItem; - const SfxStringItem* m_pStringItem; - const SfxStringItem* m_pFontItem; - sfx2::FileDialogHelper* m_pFileDlg; - - SfxAccCfgTabListBox_Impl aEntriesBox; - FixedLine aKeyboardGroup; - RadioButton aOfficeButton; - RadioButton aModuleButton; - PushButton aChangeButton; - PushButton aRemoveButton; - FixedText aGroupText; - SfxConfigGroupListBox_Impl* pGroupLBox; - FixedText aFunctionText; - SfxConfigFunctionListBox_Impl* pFunctionBox; - FixedText aKeyText; - SvTreeListBox aKeyBox; - FixedLine aFunctionsGroup; - PushButton aLoadButton; - PushButton aSaveButton; - PushButton aResetButton; - String aLoadAccelConfigStr; - String aSaveAccelConfigStr; - String aFilterAllStr; - String aFilterCfgStr; - SfxStylesInfo_Impl m_aStylesInfo; - sal_Bool m_bStylesInfoInitialized; - - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobal; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModule; - css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xAct; - css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription; - css::uno::Reference< css::frame::XFrame > m_xFrame; - - ::rtl::OUString m_sModuleLongName; - ::rtl::OUString m_sModuleShortName; - ::rtl::OUString m_sModuleUIName; - - DECL_LINK( ChangeHdl, Button * ); - DECL_LINK( RemoveHdl, Button * ); - DECL_LINK( SelectHdl, Control * ); - DECL_LINK( Save, Button * ); - DECL_LINK( Load, Button * ); - DECL_LINK( Default, PushButton * ); - DECL_LINK( RadioHdl, RadioButton* ); - - DECL_LINK( LoadHdl, sfx2::FileDialogHelper* ); - DECL_LINK( SaveHdl, sfx2::FileDialogHelper* ); - - String GetLabel4Command(const String& sCommand); - void InitAccCfg(); - sal_uInt16 MapKeyCodeToPos( const KeyCode &rCode ) const; - css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const String& sName); - void StartFileDialog( WinBits nBits, const String& rTitle ); - - void Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr); - void ResetConfig(); - - void CreateCustomItems( SvLBoxEntry* pEntry, const String& aCol1, const String& aCol2 ); - -public: - SfxAcceleratorConfigPage( Window *pParent, const SfxItemSet& rItemSet ); - virtual ~SfxAcceleratorConfigPage(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet& ); - - void Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& pAccMgr); - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); -}; - - -class SfxAcceleratorConfigListBox : public ListBox -{ - void KeyInput( const KeyEvent &rKEvt ); - -public: - - SfxAcceleratorConfigListBox( Window *pParent, ResId &rResId ) : - ListBox( pParent, rResId ) {} - - void ReplaceEntry( sal_uInt16 nPos, const String &rStr ); - void ExpandEntry ( sal_uInt16 nPos, const String &rStr ); -}; - -class SvxShortcutAssignDlg : public SfxSingleTabDialog -{ -public: - SvxShortcutAssignDlg( - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, - const SfxItemSet& rSet ); - virtual ~SvxShortcutAssignDlg(); -}; - - - -#undef css - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx deleted file mode 100644 index 818fd38ce..000000000 --- a/cui/source/inc/align.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_ALIGN_HXX -#define _SVX_ALIGN_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace svx { - -// ============================================================================ - -class AlignmentTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - -public: - virtual ~AlignmentTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -private: - explicit AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreSet ); - - void InitVsRefEgde(); - void UpdateEnableControls(); - - bool HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const; - - DECL_LINK( UpdateEnableHdl, void* ); - -private: - FixedLine maFlAlignment; - FixedText maFtHorAlign; - ListBox maLbHorAlign; - FixedText maFtIndent; - MetricField maEdIndent; - FixedText maFtVerAlign; - ListBox maLbVerAlign; - - FixedLine maFlOrient; - DialControl maCtrlDial; - FixedText maFtRotate; - WrapField maNfRotate; - FixedText maFtRefEdge; - ValueSet maVsRefEdge; - TriStateBox maCbStacked; - TriStateBox maCbAsianMode; - OrientationHelper maOrientHlp; - - FixedLine maFlProperties; - TriStateBox maBtnWrap; - TriStateBox maBtnHyphen; - TriStateBox maBtnShrink; - FixedText maFtFrameDir; - FrameDirListBox maLbFrameDir; -}; - -// ============================================================================ - -} // namespace svx - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx deleted file mode 100644 index 61c2802eb..000000000 --- a/cui/source/inc/autocdlg.hxx +++ /dev/null @@ -1,522 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_AUTOCDLG_HXX -#define _OFA_AUTOCDLG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include - -class SvxAutoCorrect; -class CharClass; -class CollatorWrapper; -class SmartTagMgr; - -// class OfaAutoCorrDlg -------------------------------------------------- - -class OfaAutoCorrDlg : public SfxTabDialog -{ - FixedText aLanguageFT; - SvxLanguageBox aLanguageLB; - - DECL_LINK(SelectLanguageHdl, ListBox*); -public: - - OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet ); - - void EnableLanguage(sal_Bool bEnable) - { aLanguageFT.Enable(bEnable); - aLanguageLB.Enable(bEnable);} - -}; - -#ifdef _OFA_AUTOCDLG_CXX -#include -#include -#include -#include -#include - -class SvStringsISortDtor; - -// class OfaACorrCheckListBox ------------------------------------------ - -class OfaACorrCheckListBox : public SvxSimpleTable -{ - using SvxSimpleTable::SetTabs; - using SvTreeListBox::GetCheckButtonState; - using SvTreeListBox::SetCheckButtonState; - - protected: - virtual void SetTabs(); - virtual void HBarClick(); - virtual void KeyInput( const KeyEvent& rKEvt ); - - public: - OfaACorrCheckListBox(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER) - : SvxSimpleTable(rParent, nBits) - { - } - - inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); } - inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); } - inline sal_uLong GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); } - - sal_Bool IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0); - void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked); - SvButtonState GetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol ) const; - void SetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol, SvButtonState ); -}; - -// class OfaAutocorrOptionsPage ------------------------------------------ - - -class OfaAutocorrOptionsPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - SvxCheckListBox aCheckLB; - - String sInput; - String sDoubleCaps; - String sStartCap; - String sBoldUnderline; - String sURL; - String sNoDblSpaces; - String sDash; - String sNonBrkSpace; - String sFirst; - String sAccidentalCaps; - -public: - OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrOptionsPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - -}; - -// class OfaSwAutoFmtOptionsPage ---------------------------------------------------- - -class OfaSwAutoFmtOptionsPage : public SfxTabPage -{ - using TabPage::ActivatePage; - - SvxSimpleTableContainer m_aCheckLBContainer; - OfaACorrCheckListBox aCheckLB; - PushButton aEditPB; - FixedText aHeader1Expl; - FixedText aHeader2Expl; - - String sHeader1; - String sHeader2; - - String sDeleteEmptyPara; - String sUseReplaceTbl; - String sCptlSttWord; - String sCptlSttSent; - String sUserStyle; - String sBullet; - String sByInputBullet; - String sBoldUnder; - String sNoDblSpaces; - String sCorrectCapsLock; - String sDetectURL; - String sDash; - String sNonBrkSpace; - String sOrdinal; - String sRightMargin; - String sNum; - String sBorder; - String sTable; - String sReplaceTemplates; - String sDelSpaceAtSttEnd; - String sDelSpaceBetweenLines; - - String sMargin; - String sBulletChar; - String sByInputBulletChar; - - Font aBulletFont; - Font aByInputBulletFont; - sal_uInt16 nPercent; - - SvLBoxButtonData* pCheckButtonData; - - DECL_LINK(SelectHdl, OfaACorrCheckListBox*); - DECL_LINK(EditHdl, PushButton*); - SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol); - - - OfaSwAutoFmtOptionsPage( Window* pParent, - const SfxItemSet& rSet ); - ~OfaSwAutoFmtOptionsPage(); - - public: - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -// class AutoCorrEdit ---------------------------------------------------- - -class AutoCorrEdit : public Edit -{ - Link aActionLink; - sal_Bool bSpaces; - - public: - AutoCorrEdit(Window* pParent, const ResId& rResId) : - Edit(pParent, rResId), bSpaces(sal_False){} - - void SetActionHdl( const Link& rLink ) - { aActionLink = rLink;} - - void SetSpaces(sal_Bool bSet) - {bSpaces = bSet;} - - virtual void KeyInput( const KeyEvent& rKEvent ); -}; - -// class OfaAutocorrReplacePage ------------------------------------------ - -class DoubleStringArray; -typedef DoubleStringArray* DoubleStringArrayPtr; -DECLARE_TABLE(DoubleStringTable, DoubleStringArrayPtr) - -class OfaAutocorrReplacePage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - CheckBox aTextOnlyCB; - FixedText aShortFT; - AutoCorrEdit aShortED; - FixedText aReplaceFT; - AutoCorrEdit aReplaceED; - SvTabListBox aReplaceTLB; - PushButton aNewReplacePB; - PushButton aDeleteReplacePB; - - String sModify; - String sNew; - - SvStringsISortDtor* pFormatText; - DoubleStringTable aDoubleStringTable; - CollatorWrapper* pCompareClass; - CharClass* pCharClass; - LanguageType eLang; - - sal_Bool bHasSelectionText; - sal_Bool bFirstSelect:1; - sal_Bool bReplaceEditChanged:1; - sal_Bool bSWriter:1; - - DECL_LINK(SelectHdl, SvTabListBox*); - DECL_LINK(NewDelHdl, PushButton*); - DECL_LINK(ModifyHdl, Edit*); - - void RefillReplaceBox(sal_Bool bFromReset, //Box mit neuer Sprache fuellen - LanguageType eOldLanguage, - LanguageType eNewLanguage); - -public: - OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrReplacePage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - - void SetLanguage(LanguageType eSet); -}; - -// class OfaAutocorrExceptPage --------------------------------------------- - -struct StringsArrays; -typedef StringsArrays* StringsArraysPtr; -DECLARE_TABLE(StringsTable, StringsArraysPtr) - -class OfaAutocorrExceptPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aAbbrevFL; - AutoCorrEdit aAbbrevED; - ListBox aAbbrevLB; - PushButton aNewAbbrevPB; - PushButton aDelAbbrevPB; - CheckBox aAutoAbbrevCB; - - FixedLine aDoubleCapsFL; - AutoCorrEdit aDoubleCapsED; - ListBox aDoubleCapsLB; - PushButton aNewDoublePB; - PushButton aDelDoublePB; - CheckBox aAutoCapsCB; - - StringsTable aStringsTable; - CollatorWrapper* pCompareClass; - LanguageType eLang; - - DECL_LINK(NewDelHdl, PushButton*); - DECL_LINK(SelectHdl, ListBox*); - DECL_LINK(ModifyHdl, Edit*); - - void RefillReplaceBoxes(sal_Bool bFromReset, //Box filled with new language - LanguageType eOldLanguage, - LanguageType eNewLanguage); -public: - OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaAutocorrExceptPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - void SetLanguage(LanguageType eSet); - -}; - -// class OfaQuoteTabPage ------------------------------------------------- - -class OfaQuoteTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - // For anything but writer - SvxCheckListBox aCheckLB; - - // Just for writer - SvxSimpleTableContainer m_aSwCheckLBContainer; - OfaACorrCheckListBox aSwCheckLB; - String sHeader1; - String sHeader2; - - String sNonBrkSpace; - String sOrdinal; - - SvLBoxButtonData* pCheckButtonData; - - FixedLine aSingleFL; - CheckBox aSingleTypoCB; - FixedText aSglStartQuoteFT; - PushButton aSglStartQuotePB; - FixedText aSglStartExFT; - FixedText aSglEndQuoteFT; - PushButton aSglEndQuotePB; - FixedText aSglEndExFT; - PushButton aSglStandardPB; - - FixedLine aDoubleFL; - CheckBox aTypoCB; - FixedText aStartQuoteFT; - PushButton aStartQuotePB; - FixedText aDblStartExFT; - FixedText aEndQuoteFT; - PushButton aEndQuotePB; - FixedText aDblEndExFT; - PushButton aDblStandardPB; - - String sStartQuoteDlg; - String sEndQuoteDlg; - - String sStandard; - - - sal_UCS4 cSglStartQuote; - sal_UCS4 cSglEndQuote; - - sal_UCS4 cStartQuote; - sal_UCS4 cEndQuote; - - DECL_LINK( QuoteHdl, PushButton* ); - DECL_LINK( StdQuoteHdl, PushButton* ); - - String ChangeStringExt_Impl( sal_UCS4 ); - - SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol); - - OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ); -public: - ~OfaQuoteTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -// class OfaAutoCompleteTabPage --------------------------------------------- - -class OfaAutoCompleteTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - - class AutoCompleteMultiListBox : public MultiListBox - { - OfaAutoCompleteTabPage& rPage; - public: - AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg, - const ResId& rResId ) - : MultiListBox( &rPg, rResId ), rPage( rPg ) {} - - virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - CheckBox aCBActiv; //Enable word completion - CheckBox aCBAppendSpace;//Append space - CheckBox aCBAsTip; //Show as tip - - CheckBox aCBCollect;//Collect words - CheckBox aCBRemoveList;//...save the list for later use... - - FixedText aFTExpandKey; - ListBox aDCBExpandKey; - FixedText aFTMinWordlen; - NumericField aNFMinWordlen; - FixedText aFTMaxEntries; - NumericField aNFMaxEntries; - AutoCompleteMultiListBox aLBEntries; - PushButton aPBEntries; - SvStringsISortDtor* pAutoCmpltList; - sal_uInt16 nAutoCmpltListCnt; - - DECL_LINK( CheckHdl, CheckBox* ); - - OfaAutoCompleteTabPage( Window* pParent, - const SfxItemSet& rSet ); -public: - virtual ~OfaAutoCompleteTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); - - void CopyToClipboard() const; - DECL_LINK( DeleteHdl, PushButton* ); -}; - -// class OfaSmartTagOptionsTabPage --------------------------------------------- - -/** Smart tag options tab page - - This tab page is used to enable/disable smart tag types -*/ -class OfaSmartTagOptionsTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - -private: - - // controls - CheckBox m_aMainCB; - SvxCheckListBox m_aSmartTagTypesLB; - PushButton m_aPropertiesPB; - FixedText m_aTitleFT; - - // construction via Create() - OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); - - /** Inserts items into m_aSmartTagTypesLB - - Reads out the smart tag types supported by the SmartTagMgr and - inserts the associated strings into the list box. - */ - void FillListBox( const SmartTagMgr& rSmartTagMgr ); - - /** Clears the m_aSmartTagTypesLB - */ - void ClearListBox(); - - /** Handler for the check box - - Enables/disables all controls in the tab page (except from the - check box. - */ - DECL_LINK( CheckHdl, CheckBox* ); - - /** Handler for the push button - - Calls the displayPropertyPage function of the smart tag recognizer - associated with the currently selected smart tag type. - */ - DECL_LINK( ClickHdl, PushButton* ); - - /** Handler for the list box - - Enables/disables the properties push button if selection in the - smart tag types list box changes. - */ - DECL_LINK( SelectHdl, SvxCheckListBox* ); - -public: - - virtual ~OfaSmartTagOptionsTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void ActivatePage( const SfxItemSet& ); -}; - -#endif // _OFA_AUTOCDLG_CXX - -#endif // - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx deleted file mode 100644 index a16c21dc4..000000000 --- a/cui/source/inc/backgrnd.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BACKGRND_HXX -#define _SVX_BACKGRND_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -// class SvxBackgroundTabPage -------------------------------------------- -/* -{k:\svx\prototyp\dialog\backgrnd.bmp} - [Beschreibung] - Mit dieser TabPage kann eine Brush (z.B. fuer die Hintergrundfarbe eines - Rahmens) eingestellt werden. - [Items] - : ; -*/ - -//------------------------------------------------------------------------ -// forwards: - -class BackgroundPreviewImpl; -class SvxOpenGraphicDialog; -struct SvxBackgroundTable_Impl; -struct SvxBackgroundPara_Impl; -struct SvxBackgroundPage_Impl; -class SvxBrushItem; -//------------------------------------------------------------------------ - -class SvxBackgroundTabPage : public SvxTabPage -{ - using TabPage::DeactivatePage; -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void ShowSelector(); // Shift-ListBox activation - void ShowTblControl(); // for the Writer (cells/rows/tables) - void ShowParaControl(sal_Bool bCharOnly = sal_False); // for the Writer (paragraph/characters) - void EnableTransparency(sal_Bool bColor, sal_Bool bGraphic); - virtual void PageCreated (SfxAllItemSet aSet); -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -private: - SvxBackgroundTabPage( Window* pParent, const SfxItemSet& rCoreSet ); - ~SvxBackgroundTabPage(); - - FixedText aSelectTxt; - ListBox aLbSelect; - const String aStrBrowse; - const String aStrUnlinked; - FixedText aTblDesc; - ListBox aTblLBox; - ListBox aParaLBox; - Control aBorderWin; - ValueSet aBackgroundColorSet; - FixedLine aBackgroundColorBox; - BackgroundPreviewImpl* pPreviewWin1; - //color transparency - FixedText aColTransFT; - MetricField aColTransMF; - CheckBox aBtnPreview; - // Background Bitmap ---------------------------------- - FixedLine aGbFile; - PushButton aBtnBrowse; - CheckBox aBtnLink; - FixedLine aGbPosition; - RadioButton aBtnPosition; - RadioButton aBtnArea; - RadioButton aBtnTile; - SvxRectCtl aWndPosition; - FixedInfo aFtFile; - //transparency of graphics - FixedLine aGraphTransFL; - MetricField aGraphTransMF; - - BackgroundPreviewImpl* pPreviewWin2; - - // DDListBox for Writer ------------------------------- - //------------------------------------------------------ - Color aBgdColor; - sal_uInt16 nHtmlMode; - sal_Bool bAllowShowSelector : 1; - sal_Bool bIsGraphicValid : 1; - sal_Bool bLinkOnly : 1; - sal_Bool bResized : 1; - sal_Bool bColTransparency : 1; - sal_Bool bGraphTransparency : 1; - Graphic aBgdGraphic; - String aBgdGraphicPath; - String aBgdGraphicFilter; - - SvxBackgroundPage_Impl* pPageImpl; - SvxOpenGraphicDialog* pImportDlg; - - // Items for Sw-Table must be corrected - SvxBackgroundTable_Impl* pTableBck_Impl; - // also for the paragraph style - SvxBackgroundPara_Impl* pParaBck_Impl; - -#ifdef _SVX_BACKGRND_CXX - void FillColorValueSets_Impl(); - void ShowColorUI_Impl(); - void ShowBitmapUI_Impl(); - sal_Bool LoadLinkedGraphic_Impl(); - void RaiseLoadError_Impl(); - void SetGraphicPosition_Impl( SvxGraphicPosition ePos ); - SvxGraphicPosition GetGraphicPosition_Impl(); - void FillControls_Impl(const SvxBrushItem& rBgdAttr, - const String& rUserData); - sal_Bool FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, sal_uInt16 nSlot); - void ResetFromWallpaperItem( const SfxItemSet& rSet ); - - DECL_LINK( LoadTimerHdl_Impl, Timer* ); - DECL_LINK( SelectHdl_Impl, ListBox* ); - DECL_LINK( BrowseHdl_Impl, PushButton* ); - DECL_LINK( RadioClickHdl_Impl, RadioButton* ); - DECL_LINK( FileClickHdl_Impl, CheckBox* ); - DECL_LINK( BackgroundColorHdl_Impl, ValueSet* ); - DECL_LINK( TblDestinationHdl_Impl, ListBox* ); - DECL_LINK( ParaDestinationHdl_Impl, ListBox* ); -#endif -}; - -#endif // #ifndef _SVX_BACKGRND_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx deleted file mode 100644 index 6069c2833..000000000 --- a/cui/source/inc/bbdlg.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BBDLG_HXX -#define _SVX_BBDLG_HXX - -// include --------------------------------------------------------------- - -#include - -/*-------------------------------------------------------------------- - Beschreibung: Border Background Pages buendeln - --------------------------------------------------------------------*/ - -class SvxBorderBackgroundDlg: public SfxTabDialog -{ -public: - SvxBorderBackgroundDlg( Window *pParent, - const SfxItemSet& rCoreSet, - sal_Bool bEnableSelector = sal_False ); - - ~SvxBorderBackgroundDlg(); - -protected: - virtual void PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ); - -private: - sal_Bool bEnableBackgroundSelector; // for Border/Background -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx deleted file mode 100644 index b01f71aef..000000000 --- a/cui/source/inc/border.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BORDER_HXX -#define _SVX_BORDER_HXX - -// include --------------------------------------------------------------- - - -#include -#include -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -namespace editeng -{ - class SvxBorderLine; -} -class XColorTable; - -#include - -class SvxBorderTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - -public: - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rCoreAttrs ); - virtual void Reset( const SfxItemSet& ); - - void HideShadowControls(); - virtual void PageCreated (SfxAllItemSet aSet); -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -private: - SvxBorderTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ); - ~SvxBorderTabPage(); - - // Controls - FixedLine aFlBorder; - FixedText aDefaultFT; - ValueSet aWndPresets; - FixedText aUserDefFT; - svx::FrameSelector aFrameSel; - - FixedLine aFlSep1; - FixedLine aFlLine; - FixedText aStyleFT; - LineListBox aLbLineStyle; - FixedText aColorFT; - ColorListBox aLbLineColor; - FixedText aWidthFT; - MetricField aLineWidthMF; - - FixedLine aFlSep2; - FixedLine aDistanceFL; - FixedText aLeftFT; - MetricField aLeftMF; - FixedText aRightFT; - MetricField aRightMF; - FixedText aTopFT; - MetricField aTopMF; - FixedText aBottomFT; - MetricField aBottomMF; - CheckBox aSynchronizeCB; - - FixedLine aFlShadow; - FixedText aFtShadowPos; - ValueSet aWndShadows; - FixedText aFtShadowSize; - MetricField aEdShadowSize; - FixedText aFtShadowColor; - ColorListBox aLbShadowColor; - - //properties - "Merge with next paragraph" in Writer - FixedLine aPropertiesFL; - CheckBox aMergeWithNextCB; - // #i29550# - CheckBox aMergeAdjacentBordersCB; - - ImageList aShadowImgLstH; - ImageList aShadowImgLst; - ImageList aBorderImgLstH; - ImageList aBorderImgLst; - - long nMinValue; // minimum distance - int nSWMode; // table, textframe, paragraph - - bool mbHorEnabled; /// true = Inner horizontal border enabled. - bool mbVerEnabled; /// true = Inner vertical border enabled. - bool mbTLBREnabled; /// true = Top-left to bottom-right border enabled. - bool mbBLTREnabled; /// true = Bottom-left to top-right border enabled. - bool mbUseMarginItem; - - static sal_Bool bSync; - -#ifdef _SVX_BORDER_CXX - // Handler - DECL_LINK( SelStyleHdl_Impl, ListBox* pLb ); - DECL_LINK( SelColHdl_Impl, ListBox* pLb ); - DECL_LINK( SelPreHdl_Impl, void* ); - DECL_LINK( SelSdwHdl_Impl, void* ); - DECL_LINK( LinesChanged_Impl, void* ); - DECL_LINK( ModifyDistanceHdl_Impl, MetricField*); - DECL_LINK( ModifyWidthHdl_Impl, void*); - DECL_LINK( SyncHdl_Impl, CheckBox*); - - sal_uInt16 GetPresetImageId( sal_uInt16 nValueSetIdx ) const; - sal_uInt16 GetPresetStringId( sal_uInt16 nValueSetIdx ) const; - - void FillPresetVS(); - void FillShadowVS(); - void FillValueSets(); - - // Filler - void FillLineListBox_Impl(); - - // share for individual Frame-/Core-Line - void ResetFrameLine_Impl( svx::FrameBorderType eBorder, - const editeng::SvxBorderLine* pCurLine, - bool bValid ); -#endif -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx deleted file mode 100644 index 412d17b05..000000000 --- a/cui/source/inc/cfg.hxx +++ /dev/null @@ -1,820 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVXCFG_HXX -#define _SVXCFG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVSTDARR_USHORTS -#define _SVSTDARR_STRINGSDTOR -#include // SvUShorts -#include -#include -#include -#include - -#include "selector.hxx" - -class SvxConfigEntry; -class SvxConfigPage; -class SvxMenuConfigPage; -class SvxToolbarConfigPage; - -typedef std::vector< SvxConfigEntry* > SvxEntries; - -class SvxConfigDialog : public SfxTabDialog -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - -public: - SvxConfigDialog( Window*, const SfxItemSet* ); - ~SvxConfigDialog(); - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - virtual short Ok(); - - void SetFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame); -}; - -class SaveInData : public ImageProvider -{ -private: - - bool bModified; - - bool bDocConfig; - bool bReadOnly; - - ::com::sun::star::uno::Reference - < com::sun::star::ui::XUIConfigurationManager > m_xCfgMgr; - - ::com::sun::star::uno::Reference - < com::sun::star::ui::XUIConfigurationManager > m_xParentCfgMgr; - - ::com::sun::star::uno::Reference - < com::sun::star::ui::XImageManager > m_xImgMgr; - - ::com::sun::star::uno::Reference - < com::sun::star::ui::XImageManager > m_xParentImgMgr; - - static ::com::sun::star::uno::Reference - < com::sun::star::ui::XImageManager >* xDefaultImgMgr; - -public: - - SaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >& xCfgMgr, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >& xParentCfgMgr, - const rtl::OUString& aModuleId, - bool docConfig ); - - ~SaveInData() {} - - bool PersistChanges( - const com::sun::star::uno::Reference - < com::sun::star::uno::XInterface >& xManager ); - - void SetModified( bool bValue = sal_True ) { bModified = bValue; } - bool IsModified( ) { return bModified; } - - bool IsReadOnly( ) { return bReadOnly; } - bool IsDocConfig( ) { return bDocConfig; } - - ::com::sun::star::uno::Reference - < ::com::sun::star::ui::XUIConfigurationManager > - GetConfigManager() { return m_xCfgMgr; }; - - ::com::sun::star::uno::Reference - < ::com::sun::star::ui::XUIConfigurationManager > - GetParentConfigManager() { return m_xParentCfgMgr; }; - - ::com::sun::star::uno::Reference - < ::com::sun::star::ui::XImageManager > - GetImageManager() { return m_xImgMgr; }; - - ::com::sun::star::uno::Reference - < ::com::sun::star::ui::XImageManager > - GetParentImageManager() { return m_xParentImgMgr; }; - - ::com::sun::star::uno::Reference - < com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - - ::com::sun::star::uno::Reference - < com::sun::star::container::XNameAccess > m_xCommandToLabelMap; - - com::sun::star::uno::Reference - < com::sun::star::uno::XComponentContext > m_xComponentContext; - - com::sun::star::uno::Sequence - < com::sun::star::beans::PropertyValue > m_aSeparatorSeq; - - Image GetImage( const rtl::OUString& rCommandURL ); - - virtual bool HasURL( const rtl::OUString& aURL ) = 0; - virtual bool HasSettings() = 0; - virtual SvxEntries* GetEntries() = 0; - virtual void SetEntries( SvxEntries* ) = 0; - virtual void Reset() = 0; - virtual bool Apply() = 0; -}; - -class MenuSaveInData : public SaveInData -{ -private: - - rtl::OUString m_aMenuResourceURL; - rtl::OUString m_aDescriptorContainer; - - ::com::sun::star::uno::Reference - < com::sun::star::container::XIndexAccess > m_xMenuSettings; - - SvxConfigEntry* pRootEntry; - - // static holder of the default menu data - static MenuSaveInData* pDefaultData; - - static void SetDefaultData( MenuSaveInData* pData ) {pDefaultData = pData;} - static MenuSaveInData* GetDefaultData() { return pDefaultData; } - - void Apply( bool bDefault ); - - void Apply( - SvxConfigEntry* pRootEntry, - com::sun::star::uno::Reference< - com::sun::star::container::XIndexContainer >& rNewMenuBar, - com::sun::star::uno::Reference< - com::sun::star::lang::XSingleComponentFactory >& rFactory, - SvLBoxEntry *pParent = NULL ); - - void ApplyMenu( - com::sun::star::uno::Reference< - com::sun::star::container::XIndexContainer >& rNewMenuBar, - com::sun::star::uno::Reference< - com::sun::star::lang::XSingleComponentFactory >& rFactory, - SvxConfigEntry *pMenuData = NULL ); - - bool LoadSubMenus( - const ::com::sun::star::uno::Reference< - com::sun::star::container::XIndexAccess >& xMenuBarSettings, - const rtl::OUString& rBaseTitle, SvxConfigEntry* pParentData ); - -public: - - MenuSaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const rtl::OUString& aModuleId, - bool docConfig ); - - ~MenuSaveInData(); - - // methods inherited from SaveInData - SvxEntries* GetEntries(); - void SetEntries( SvxEntries* ); - bool HasURL( const rtl::OUString& URL ) { (void)URL; return sal_False; } - bool HasSettings() { return m_xMenuSettings.is(); } - void Reset(); - bool Apply(); -}; - -class SvxConfigEntry -{ -private: - - // common properties - sal_uInt16 nId; - ::rtl::OUString aHelpText; - ::rtl::OUString aLabel; - ::rtl::OUString aCommand; - ::rtl::OUString aHelpURL; - - bool bPopUp; - bool bStrEdited; - bool bIsUserDefined; - bool bIsMain; - bool bIsDeletable; - bool bIsMovable; - bool bIsParentData; - - // toolbar specific properties - bool bIsVisible; - sal_Int32 nStyle; - - ::com::sun::star::uno::Reference< - ::com::sun::star::graphic::XGraphic > xBackupGraphic; - - SvxEntries *pEntries; - -public: - - SvxConfigEntry( const ::rtl::OUString& rDisplayName, - const ::rtl::OUString& rCommandURL, - bool bPopup = sal_False, - bool bParentData = sal_False ); - - SvxConfigEntry() - : - nId( 0 ), - bPopUp( sal_False ), - bStrEdited( sal_False ), - bIsUserDefined( sal_False ), - bIsMain( sal_False ), - bIsParentData( sal_False ), - bIsVisible( sal_True ), - nStyle( 0 ), - pEntries( 0 ) - {} - - ~SvxConfigEntry(); - - const ::rtl::OUString& GetCommand() const { return aCommand; } - void SetCommand( const String& rCmd ) { aCommand = rCmd; } - - const ::rtl::OUString& GetName() const { return aLabel; } - void SetName( const String& rStr ) { aLabel = rStr; bStrEdited = sal_True; } - bool HasChangedName() const { return bStrEdited; } - - const ::rtl::OUString& GetHelpText() ; - void SetHelpText( const String& rStr ) { aHelpText = rStr; } - - const ::rtl::OUString& GetHelpURL() const { return aHelpURL; } - void SetHelpURL( const String& rStr ) { aHelpURL = rStr; } - - void SetPopup( bool bOn = sal_True ) { bPopUp = bOn; } - bool IsPopup() const { return bPopUp; } - - void SetUserDefined( bool bOn = sal_True ) { bIsUserDefined = bOn; } - bool IsUserDefined() const { return bIsUserDefined; } - - bool IsBinding() const { return !bPopUp; } - bool IsSeparator() const { return nId == 0; } - - SvxEntries* GetEntries() const { return pEntries; } - void SetEntries( SvxEntries* entries ) { pEntries = entries; } - bool HasEntries() const { return pEntries != NULL; } - - void SetMain( bool bValue = sal_True ) { bIsMain = bValue; } - bool IsMain() { return bIsMain; } - - void SetParentData( bool bValue = sal_True ) { bIsParentData = bValue; } - bool IsParentData() { return bIsParentData; } - - bool IsMovable(); - bool IsDeletable(); - bool IsRenamable(); - - void SetVisible( bool b ) { bIsVisible = b; } - bool IsVisible() const { return bIsVisible; } - - void SetBackupGraphic( - ::com::sun::star::uno::Reference< - ::com::sun::star::graphic::XGraphic > graphic ) - { xBackupGraphic = graphic; } - - ::com::sun::star::uno::Reference< - ::com::sun::star::graphic::XGraphic > - GetBackupGraphic() - { return xBackupGraphic; } - - bool IsIconModified() { return xBackupGraphic.is(); } - - sal_Int32 GetStyle() { return nStyle; } - void SetStyle( sal_Int32 style ) { nStyle = style; } -}; - -class SvxMenuEntriesListBox : public SvTreeListBox -{ -private: - SvxConfigPage* pPage; - -protected: - bool m_bIsInternalDrag; - -public: - SvxMenuEntriesListBox( Window*, const ResId& ); - ~SvxMenuEntriesListBox(); - - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - - virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* pEntry ); - - virtual sal_Bool NotifyMoving( SvLBoxEntry*, SvLBoxEntry*, - SvLBoxEntry*&, sal_uLong& ); - - virtual sal_Bool NotifyCopying( SvLBoxEntry*, SvLBoxEntry*, - SvLBoxEntry*&, sal_uLong&); - - virtual DragDropMode NotifyStartDrag( - TransferDataContainer&, SvLBoxEntry* ); - - virtual void DragFinished( sal_Int8 ); - - void KeyInput( const KeyEvent& rKeyEvent ); -}; - -class SvxDescriptionEdit : public ExtMultiLineEdit -{ -private: - Rectangle m_aRealRect; - -public: - SvxDescriptionEdit( Window* pParent, const ResId& _rId ); - inline ~SvxDescriptionEdit() {} - - void SetNewText( const String& _rText ); - inline void Clear() { SetNewText( String() ); } -}; - -class SvxConfigPage : public SfxTabPage -{ -private: - - bool bInitialised; - SaveInData* pCurrentSaveInData; - - DECL_LINK( SelectSaveInLocation, ListBox * ); - DECL_LINK( AsyncInfoMsg, String* ); - - bool SwapEntryData( SvLBoxEntry* pSourceEntry, SvLBoxEntry* pTargetEntry ); - void AlignControls(); - -protected: - - // the top section of the tab page where top level menus and toolbars - // are displayed in a listbox - FixedLine aTopLevelSeparator; - FixedText aTopLevelLabel; - ListBox aTopLevelListBox; - PushButton aNewTopLevelButton; - MenuButton aModifyTopLevelButton; - - // the contents section where the contents of the selected - // menu or toolbar are displayed - FixedLine aContentsSeparator; - FixedText aContentsLabel; - SvTreeListBox* aContentsListBox; - - PushButton aAddCommandsButton; - MenuButton aModifyCommandButton; - - ImageButton aMoveUpButton; - ImageButton aMoveDownButton; - - FixedText aSaveInText; - ListBox aSaveInListBox; - - FixedText aDescriptionLabel; - SvxDescriptionEdit aDescriptionField; - - SvxScriptSelectorDialog* pSelectorDlg; - - // the ResourceURL to select when opening the dialog - rtl::OUString m_aURLToSelect; - - ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XFrame > m_xFrame; - - SvxConfigPage( Window*, const SfxItemSet& ); - virtual ~SvxConfigPage(); - - DECL_LINK( MoveHdl, Button * ); - - virtual SaveInData* CreateSaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const rtl::OUString& aModuleId, - bool docConfig ) = 0; - - virtual void Init() = 0; - virtual void UpdateButtonStates() = 0; - virtual short QueryReset() = 0; - - void PositionContentsListBox(); - - SvLBoxEntry* InsertEntry( SvxConfigEntry* pNewEntryData, - SvLBoxEntry* pTarget = NULL, - bool bFront = sal_False ); - - void AddSubMenusToUI( const String& rBaseTitle, - SvxConfigEntry* pParentData ); - - SvLBoxEntry* InsertEntryIntoUI ( SvxConfigEntry* pNewEntryData, - sal_uLong nPos = LIST_APPEND ); - - SvxEntries* FindParentForChild( SvxEntries* pParentEntries, - SvxConfigEntry* pChildData ); - - void ReloadTopLevelListBox( SvxConfigEntry* pSelection = NULL ); - -public: - - static bool CanConfig( const ::rtl::OUString& rModuleId ); - - SaveInData* GetSaveInData() { return pCurrentSaveInData; } - - SvLBoxEntry* AddFunction( SvLBoxEntry* pTarget = NULL, - bool bFront = sal_False, - bool bAllowDuplicates = sal_False ); - - virtual void MoveEntry( bool bMoveUp ); - - bool MoveEntryData( SvLBoxEntry* pSourceEntry, - SvLBoxEntry* pTargetEntry ); - - sal_Bool FillItemSet( SfxItemSet& ); - void Reset( const SfxItemSet& ); - - virtual bool DeleteSelectedContent() = 0; - virtual void DeleteSelectedTopLevel() = 0; - - SvxConfigEntry* GetTopLevelSelection() - { - return (SvxConfigEntry*) aTopLevelListBox.GetEntryData( - aTopLevelListBox.GetSelectEntryPos() ); - } - - /** identifies the module in the given frame. If the frame is , a default - frame will be determined beforehand. - - If the given frame is , a default frame will be used: The method the active - frame of the desktop, then the current frame. If both are , - the SfxViewFrame::Current's XFrame is used. If this is , too, an empty string is returned. - - If the given frame is not , or an default frame could be successfully determined, then - the ModuleManager is asked for the module ID of the component in the frame. - */ - static ::rtl::OUString - GetFrameWithDefaultAndIdentify( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _inout_rxFrame ); -}; - -class SvxMenuConfigPage : public SvxConfigPage -{ -private: - - DECL_LINK( SelectMenu, ListBox * ); - DECL_LINK( SelectMenuEntry, Control * ); - DECL_LINK( NewMenuHdl, Button * ); - DECL_LINK( MenuSelectHdl, MenuButton * ); - DECL_LINK( EntrySelectHdl, MenuButton * ); - DECL_LINK( AddCommandsHdl, Button * ); - DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * ); - - void Init(); - void UpdateButtonStates(); - short QueryReset(); - bool DeleteSelectedContent(); - void DeleteSelectedTopLevel(); - -public: - SvxMenuConfigPage( Window *pParent, const SfxItemSet& rItemSet ); - ~SvxMenuConfigPage(); - - SaveInData* CreateSaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const rtl::OUString& aModuleId, - bool docConfig ); -}; - -class SvxMainMenuOrganizerDialog : public ModalDialog -{ - FixedText aMenuNameText; - Edit aMenuNameEdit; - FixedText aMenuListText; - SvTreeListBox aMenuListBox; - ImageButton aMoveUpButton; - ImageButton aMoveDownButton; - OKButton aOKButton; - CancelButton aCloseButton; - HelpButton aHelpButton; - - SvxEntries* pEntries; - SvLBoxEntry* pNewMenuEntry; - bool bModified; - - void UpdateButtonStates(); - - DECL_LINK( MoveHdl, Button * ); - DECL_LINK( ModifyHdl, Edit * ); - DECL_LINK( SelectHdl, Control* ); - -public: - SvxMainMenuOrganizerDialog ( - Window*, SvxEntries*, - SvxConfigEntry*, bool bCreateMenu = sal_False ); - - ~SvxMainMenuOrganizerDialog (); - - SvxEntries* GetEntries(); - void SetEntries( SvxEntries* ); - SvxConfigEntry* GetSelectedEntry(); -}; - -class SvxToolbarEntriesListBox : public SvxMenuEntriesListBox -{ - Size m_aCheckBoxImageSizePixel; - Link m_aChangedListener; - SvLBoxButtonData* m_pButtonData; - SvxConfigPage* pPage; - - void ChangeVisibility( SvLBoxEntry* pEntry ); - -protected: - - virtual void CheckButtonHdl(); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - void BuildCheckBoxButtonImages( SvLBoxButtonData* ); - Image GetSizedImage( - VirtualDevice& aDev, const Size& aNewSize, const Image& aImage ); - -public: - - SvxToolbarEntriesListBox( - Window* pParent, const ResId& ); - - ~SvxToolbarEntriesListBox(); - - void SetChangedListener( const Link& aChangedListener ) - { m_aChangedListener = aChangedListener; } - - const Link& GetChangedListener() const { return m_aChangedListener; } - - Size GetCheckBoxPixelSize() const - { return m_aCheckBoxImageSizePixel; } - - virtual sal_Bool NotifyMoving( - SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, sal_uLong& ); - - virtual sal_Bool NotifyCopying( - SvLBoxEntry*, SvLBoxEntry*, SvLBoxEntry*&, sal_uLong&); - - void KeyInput( const KeyEvent& rKeyEvent ); -}; - -class SvxToolbarConfigPage : public SvxConfigPage -{ -private: - - DECL_LINK( SelectToolbar, ListBox * ); - DECL_LINK( SelectToolbarEntry, Control * ); - DECL_LINK( ToolbarSelectHdl, MenuButton * ); - DECL_LINK( EntrySelectHdl, MenuButton * ); - DECL_LINK( NewToolbarHdl, Button * ); - DECL_LINK( AddCommandsHdl, Button * ); - DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * ); - DECL_LINK( MoveHdl, Button * ); - - void UpdateButtonStates(); - short QueryReset(); - void Init(); - bool DeleteSelectedContent(); - void DeleteSelectedTopLevel(); - -public: - SvxToolbarConfigPage( Window *pParent, const SfxItemSet& rItemSet ); - ~SvxToolbarConfigPage(); - - SvLBoxEntry* AddFunction( SvLBoxEntry* pTarget = NULL, - bool bFront = sal_False, - bool bAllowDuplicates = sal_True ); - - void MoveEntry( bool bMoveUp ); - - SaveInData* CreateSaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const rtl::OUString& aModuleId, - bool docConfig ); -}; - -class ToolbarSaveInData : public SaveInData -{ -private: - - SvxConfigEntry* pRootEntry; - rtl::OUString m_aDescriptorContainer; - - ::com::sun::star::uno::Reference - < com::sun::star::container::XNameAccess > m_xPersistentWindowState; - - bool LoadToolbar( - const ::com::sun::star::uno::Reference< - com::sun::star::container::XIndexAccess >& xToolBarSettings, - SvxConfigEntry* pParentData ); - - void ApplyToolbar( - com::sun::star::uno::Reference< - com::sun::star::container::XIndexContainer >& rNewToolbarBar, - com::sun::star::uno::Reference< - com::sun::star::lang::XSingleComponentFactory >& rFactory, - SvxConfigEntry *pToolbar = NULL ); - -public: - - ToolbarSaveInData( - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const ::com::sun::star::uno::Reference < - ::com::sun::star::ui::XUIConfigurationManager >&, - const rtl::OUString& aModuleId, - bool docConfig ); - - ~ToolbarSaveInData(); - - void CreateToolbar( SvxConfigEntry* pToolbar ); - void RestoreToolbar( SvxConfigEntry* pToolbar ); - void RemoveToolbar( SvxConfigEntry* pToolbar ); - void ApplyToolbar( SvxConfigEntry* pToolbar ); - - rtl::OUString GetSystemUIName( const rtl::OUString& rResourceURL ); - - sal_Int32 GetSystemStyle( const rtl::OUString& rResourceURL ); - - void SetSystemStyle( - const rtl::OUString& rResourceURL, sal_Int32 nStyle ); - - void SetSystemStyle( - ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XFrame > xFrame, - const rtl::OUString& rResourceURL, sal_Int32 nStyle ); - - SvxEntries* GetEntries(); - void SetEntries( SvxEntries* ); - bool HasSettings(); - bool HasURL( const rtl::OUString& rURL ); - void Reset(); - bool Apply(); -}; - -class SvxNewToolbarDialog : public ModalDialog -{ -private: - FixedText aFtDescription; - Edit aEdtName; - FixedText aSaveInText; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - Link aCheckNameHdl; - - DECL_LINK(ModifyHdl, Edit*); - -public: - SvxNewToolbarDialog( Window* pWindow, const String& rName ); - - ListBox aSaveInListBox; - - void GetName( rtl::OUString& rName ){rName = aEdtName.GetText();} - - void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false ) - { - aCheckNameHdl = rLink; - if ( bCheckImmediately ) - aBtnOK.Enable( rLink.Call( this ) > 0 ); - } - - void SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);} -}; - -class SvxIconSelectorDialog : public ModalDialog -{ -private: - FixedText aFtDescription; - ToolBox aTbSymbol; - FixedText aFtNote; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - PushButton aBtnImport; - PushButton aBtnDelete; - FixedLine aFlSeparator; - sal_uInt16 m_nNextId; - - sal_Int32 m_nExpectedSize; - - ::com::sun::star::uno::Reference< - ::com::sun::star::ui::XImageManager > m_xImageManager; - - ::com::sun::star::uno::Reference< - ::com::sun::star::ui::XImageManager > m_xParentImageManager; - - ::com::sun::star::uno::Reference< - ::com::sun::star::ui::XImageManager > m_xImportedImageManager; - - ::com::sun::star::uno::Reference< - ::com::sun::star::graphic::XGraphicProvider > m_xGraphProvider; - - bool ReplaceGraphicItem( const ::rtl::OUString& aURL ); - - bool ImportGraphic( const ::rtl::OUString& aURL ); - - void ImportGraphics( - const com::sun::star::uno::Sequence< rtl::OUString >& aURLs ); - - BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize); - -public: - - SvxIconSelectorDialog( - Window *pWindow, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ui::XImageManager >& rXImageManager, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ui::XImageManager >& rXParentImageManager - ); - - ~SvxIconSelectorDialog(); - - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > - GetSelectedIcon(); - - DECL_LINK( SelectHdl, ToolBox * ); - DECL_LINK( ImportHdl, PushButton * ); - DECL_LINK( DeleteHdl, PushButton * ); -}; - -class SvxIconReplacementDialog : public MessBox -{ -public: - SvxIconReplacementDialog( - Window *pWindow, - const rtl::OUString& aMessage, - bool aYestoAll); - - SvxIconReplacementDialog( - Window *pWindow, - const rtl::OUString& aMessage ); - - rtl::OUString ReplaceIconName( const rtl::OUString& ); - sal_uInt16 ShowDialog(); -}; -//added for issue83555 -class SvxIconChangeDialog : public ModalDialog -{ -private: - FixedImage aFImageInfo; - OKButton aBtnOK; - FixedText aDescriptionLabel; - SvxDescriptionEdit aLineEditDescription; -public: - SvxIconChangeDialog(Window *pWindow, const rtl::OUString& aMessage); -}; -#endif // _SVXCFG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx deleted file mode 100644 index 8f288447d..000000000 --- a/cui/source/inc/cfgutil.hxx +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CFGUTIL_HXX -#define _CFGUTIL_HXX - -#include -#include -#include - -#include -#include -#include -#include -#include - -#define _SVSTDARR_STRINGSDTOR -#include - -#include -#include -#include -#include - -class BasicManager; -class SfxSlotPool; -class SfxStringItem; -class SfxFontItem; -class SfxMacroInfoItem; -struct SfxStyleInfo_Impl; -struct SfxStylesInfo_Impl; - -#define css ::com::sun::star - -struct SfxStyleInfo_Impl -{ - ::rtl::OUString sFamily; - ::rtl::OUString sStyle; - ::rtl::OUString sCommand; - ::rtl::OUString sLabel; - - SfxStyleInfo_Impl() - {} - - SfxStyleInfo_Impl(const SfxStyleInfo_Impl& rCopy) - { - sFamily = rCopy.sFamily; - sStyle = rCopy.sStyle; - sCommand = rCopy.sCommand; - sLabel = rCopy.sLabel; - } -}; - -struct SfxStylesInfo_Impl -{ - private: - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDoc; - - public: - - SfxStylesInfo_Impl(); - void setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel); - - sal_Bool parseStyleCommand(SfxStyleInfo_Impl& aStyle); - void getLabel4Style(SfxStyleInfo_Impl& aStyle); - - ::std::vector< SfxStyleInfo_Impl > getStyleFamilies(); - ::std::vector< SfxStyleInfo_Impl > getStyles(const ::rtl::OUString& sFamily); - - static ::rtl::OUString generateCommand(const ::rtl::OUString& sFamily, const ::rtl::OUString& sStyle); -}; - -#define SFX_CFGGROUP_FUNCTION 1 -#define SFX_CFGFUNCTION_SLOT 2 -#define SFX_CFGGROUP_SCRIPTCONTAINER 3 -#define SFX_CFGFUNCTION_SCRIPT 4 -#define SFX_CFGGROUP_STYLES 5 - -struct SfxGroupInfo_Impl -{ - sal_uInt16 nKind; - sal_uInt16 nUniqueID; - void* pObject; - sal_Bool bWasOpened; - String sCommand; - String sLabel; - - SfxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, void* pObj = 0 ) : - nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(sal_False) {} -}; - -struct CuiMacroInfo -{ -}; - -typedef SfxGroupInfo_Impl* SfxGroupInfoPtr; -SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl, SfxGroupInfoPtr, 5, 5) - -class SfxConfigFunctionListBox_Impl : public SvTreeListBox -{ - friend class SfxConfigGroupListBox_Impl; - Timer aTimer; - SvLBoxEntry* pCurEntry; - SfxGroupInfoArr_Impl aArr; - SfxStylesInfo_Impl* pStylesInfo; - - DECL_LINK( TimerHdl, Timer* ); - virtual void MouseMove( const MouseEvent& rMEvt ); - -public: - SfxConfigFunctionListBox_Impl( Window*, const ResId& ); - ~SfxConfigFunctionListBox_Impl(); - - void ClearAll(); - using Window::GetHelpText; - String GetHelpText( SvLBoxEntry *pEntry ); - String GetCurCommand(); - String GetCurLabel(); - String GetSelectedScriptURI(); - void FunctionSelected(); - void SetStylesInfo(SfxStylesInfo_Impl* pStyles); -}; - -struct SvxConfigGroupBoxResource_Impl; -class SfxConfigGroupListBox_Impl : public SvTreeListBox -{ - SvxConfigGroupBoxResource_Impl* pImp; - SfxConfigFunctionListBox_Impl* pFunctionListBox; - SfxGroupInfoArr_Impl aArr; - sal_uLong nMode; - - ::rtl::OUString m_sModuleLongName; - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - css::uno::Reference< css::frame::XFrame > m_xFrame; - css::uno::Reference< css::container::XNameAccess > m_xGlobalCategoryInfo; - css::uno::Reference< css::container::XNameAccess > m_xModuleCategoryInfo; - css::uno::Reference< css::container::XNameAccess > m_xUICmdDescription; - - Image GetImage( - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx, - bool bIsRootNode - ); - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, - ::rtl::OUString& docName - ); - - - void InitModule(); - void InitBasic(); - void InitStyles(); - - ::rtl::OUString MapCommand2UIName(const ::rtl::OUString& sCommand); - - SfxStylesInfo_Impl* pStylesInfo; - -protected: - virtual void RequestingChilds( SvLBoxEntry *pEntry); - using SvListView::Expand; - virtual sal_Bool Expand( SvLBoxEntry* pParent ); - -public: - SfxConfigGroupListBox_Impl ( Window* pParent, - const ResId&, - sal_uLong nConfigMode = 0 ); - ~SfxConfigGroupListBox_Impl(); - void ClearAll(); - - void Init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - const css::uno::Reference< css::frame::XFrame >& xFrame , - const ::rtl::OUString& sModuleLongName); - void SetFunctionListBox( SfxConfigFunctionListBox_Impl *pBox ) - { pFunctionListBox = pBox; } - void Open( SvLBoxEntry*, sal_Bool ); - void GroupSelected(); - void SelectMacro( const SfxMacroInfoItem* ); - void SelectMacro( const String&, const String& ); - String GetGroup(); - void SetStylesInfo(SfxStylesInfo_Impl* pStyles); -}; - -#undef css - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx deleted file mode 100644 index ab9abba1e..000000000 --- a/cui/source/inc/chardlg.hxx +++ /dev/null @@ -1,391 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CHARDLG_HXX -#define _SVX_CHARDLG_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -class SvxFontListItem; -class FontList; - -// ----------------------------------------------------------------------- - -#define DISABLE_CASEMAP ((sal_uInt16)0x0001) -#define DISABLE_WORDLINE ((sal_uInt16)0x0002) -#define DISABLE_BLINK ((sal_uInt16)0x0004) -#define DISABLE_UNDERLINE_COLOR ((sal_uInt16)0x0008) - -#define DISABLE_LANGUAGE ((sal_uInt16)0x0010) -#define DISABLE_HIDE_LANGUAGE ((sal_uInt16)0x0020) - -// class SvxCharBasePage ------------------------------------------------- - -class SvxCharBasePage : public SfxTabPage -{ -protected: - SvxFontPrevWindow m_aPreviewWin; - FixedInfo m_aFontTypeFT; - - sal_Bool m_bPreviewBackgroundToCharacter; - - SvxCharBasePage( Window* pParent, const ResId& rResIdTabPage, const SfxItemSet&, - sal_uInt16 nResIdPrewievWin, sal_uInt16 nResIdFontTypeFT ); - virtual ~SvxCharBasePage(); - - void SetPrevFontWidthScale( const SfxItemSet& rSet ); - void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ); - - inline SvxFont& GetPreviewFont(); - inline SvxFont& GetPreviewCJKFont(); - inline SvxFont& GetPreviewCTLFont(); - -public: - using SfxTabPage::ActivatePage; - using SfxTabPage::DeactivatePage; - - virtual void ActivatePage( const SfxItemSet& rSet ); - -}; - -// class SvxCharNamePage ------------------------------------------------- - -struct SvxCharNamePage_Impl; - -class SvxCharNamePage : public SvxCharBasePage -{ - -private: - FixedLine* m_pWestLine; - FixedText* m_pWestFontNameFT; - FontNameBox* m_pWestFontNameLB; - FixedText* m_pWestFontStyleFT; - FontStyleBox* m_pWestFontStyleLB; - FixedText* m_pWestFontSizeFT; - FontSizeBox* m_pWestFontSizeLB; - FixedText* m_pWestFontLanguageFT; - SvxLanguageBox* m_pWestFontLanguageLB; - - FixedLine* m_pEastLine; - FixedText* m_pEastFontNameFT; - FontNameBox* m_pEastFontNameLB; - FixedText* m_pEastFontStyleFT; - FontStyleBox* m_pEastFontStyleLB; - FixedText* m_pEastFontSizeFT; - FontSizeBox* m_pEastFontSizeLB; - FixedText* m_pEastFontLanguageFT; - SvxLanguageBox* m_pEastFontLanguageLB; - - FixedLine* m_pCTLLine; - FixedText* m_pCTLFontNameFT; - FontNameBox* m_pCTLFontNameLB; - FixedText* m_pCTLFontStyleFT; - FontStyleBox* m_pCTLFontStyleLB; - FixedText* m_pCTLFontSizeFT; - FontSizeBox* m_pCTLFontSizeLB; - FixedText* m_pCTLFontLanguageFT; - SvxLanguageBox* m_pCTLFontLanguageLB; - - FixedLine* m_pColorFL; - FixedText* m_pColorFT; - ColorListBox* m_pColorLB; - - SvxCharNamePage_Impl* m_pImpl; - - SvxCharNamePage( Window* pParent, const SfxItemSet& rSet ); - - void Initialize(); - const FontList* GetFontList() const; - void UpdatePreview_Impl(); - void FillStyleBox_Impl( const FontNameBox* rBox ); - void FillSizeBox_Impl( const FontNameBox* rBox ); - - enum LanguageGroup - { - /** Language for western text. - */ - Western = 0, - - /** Language for asian text. - */ - Asian, - - /** Language for ctl text. - */ - Ctl - }; - - void Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp ); - sal_Bool FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp ); - void ResetColor_Impl( const SfxItemSet& rSet ); - - DECL_LINK( UpdateHdl_Impl, Timer* ); - DECL_LINK( FontModifyHdl_Impl, void* ); - DECL_LINK( ColorBoxSelectHdl_Impl, ColorListBox* ); - -public: - using SfxTabPage::ActivatePage; - using SfxTabPage::DeactivatePage; - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - ~SvxCharNamePage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual void Reset( const SfxItemSet& rSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - - void SetFontList( const SvxFontListItem& rItem ); - void EnableRelativeMode(); - void EnableSearchMode(); - // the writer uses SID_ATTR_BRUSH as font background - void SetPreviewBackgroundToCharacter(); - - void DisableControls( sal_uInt16 nDisable ); - virtual void PageCreated (SfxAllItemSet aSet); -}; - -// class SvxCharEffectsPage ---------------------------------------------- - -class SvxCharEffectsPage : public SvxCharBasePage -{ - -private: - FixedText m_aFontColorFT; - ColorListBox m_aFontColorLB; - - FixedText m_aEffectsFT; - SvxCheckListBox m_aEffectsLB; - - ListBox m_aEffects2LB; - - FixedText m_aReliefFT; - ListBox m_aReliefLB; - - TriStateBox m_aOutlineBtn; - TriStateBox m_aShadowBtn; - TriStateBox m_aBlinkingBtn; - TriStateBox m_aHiddenBtn; - - FixedLine m_aVerticalLine; - - FixedText m_aOverlineFT; - ListBox m_aOverlineLB; - FixedText m_aOverlineColorFT; - ColorListBox m_aOverlineColorLB; - - FixedText m_aStrikeoutFT; - ListBox m_aStrikeoutLB; - - FixedText m_aUnderlineFT; - ListBox m_aUnderlineLB; - FixedText m_aUnderlineColorFT; - ColorListBox m_aUnderlineColorLB; - - CheckBox m_aIndividualWordsBtn; - - FixedLine m_aAsianLine; - - FixedText m_aEmphasisFT; - ListBox m_aEmphasisLB; - - FixedText m_aPositionFT; - ListBox m_aPositionLB; - - sal_uInt16 m_nHtmlMode; - - String m_aTransparentColorName; - - SvxCharEffectsPage( Window* pParent, const SfxItemSet& rSet ); - - void Initialize(); - void UpdatePreview_Impl(); - void SetCaseMap_Impl( SvxCaseMap eCaseMap ); - void ResetColor_Impl( const SfxItemSet& rSet ); - sal_Bool FillItemSetColor_Impl( SfxItemSet& rSet ); - - DECL_LINK( SelectHdl_Impl, ListBox* ); - DECL_LINK( CbClickHdl_Impl, CheckBox* ); - DECL_LINK( TristClickHdl_Impl, TriStateBox* ); - DECL_LINK( UpdatePreview_Impl, ListBox* ); - DECL_LINK( ColorBoxSelectHdl_Impl, ColorListBox* ); - -public: - using SfxTabPage::DeactivatePage; - - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual void Reset( const SfxItemSet& rSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - - void DisableControls( sal_uInt16 nDisable ); - void EnableFlash(); - // the writer uses SID_ATTR_BRUSH as font background - void SetPreviewBackgroundToCharacter(); - virtual void PageCreated (SfxAllItemSet aSet); -}; - -// class SvxCharPositionPage --------------------------------------------- - -class SvxCharPositionPage : public SvxCharBasePage -{ - -private: - FixedLine m_aPositionLine; - RadioButton m_aHighPosBtn; - RadioButton m_aNormalPosBtn; - RadioButton m_aLowPosBtn; - FixedText m_aHighLowFT; - MetricField m_aHighLowEdit; - CheckBox m_aHighLowRB; - FixedText m_aFontSizeFT; - MetricField m_aFontSizeEdit; - FixedLine m_aRotationScalingFL; - FixedLine m_aScalingFL; - RadioButton m_a0degRB; - RadioButton m_a90degRB; - RadioButton m_a270degRB; - CheckBox m_aFitToLineCB; - FixedText m_aScaleWidthFT; - MetricField m_aScaleWidthMF; - - FixedLine m_aKerningLine; - ListBox m_aKerningLB; - FixedText m_aKerningFT; - MetricField m_aKerningEdit; - CheckBox m_aPairKerningBtn; - - short m_nSuperEsc; - short m_nSubEsc; - - sal_uInt16 m_nScaleWidthItemSetVal; - sal_uInt16 m_nScaleWidthInitialVal; - - sal_uInt8 m_nSuperProp; - sal_uInt8 m_nSubProp; - - SvxCharPositionPage( Window* pParent, const SfxItemSet& rSet ); - - void Initialize(); - void UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ); - void SetEscapement_Impl( sal_uInt16 nEsc ); - - DECL_LINK( PositionHdl_Impl, RadioButton* ); - DECL_LINK( RotationHdl_Impl, RadioButton* ); - DECL_LINK( FontModifyHdl_Impl, MetricField* ); - DECL_LINK( AutoPositionHdl_Impl, CheckBox* ); - DECL_LINK( FitToLineHdl_Impl, CheckBox* ); - DECL_LINK( KerningSelectHdl_Impl, ListBox* ); - DECL_LINK( KerningModifyHdl_Impl, MetricField* ); - DECL_LINK( PairKerningHdl_Impl, CheckBox* ); - DECL_LINK( LoseFocusHdl_Impl, MetricField* ); - DECL_LINK( ScaleWidthModifyHdl_Impl, MetricField* ); - -public: - using SfxTabPage::ActivatePage; - using SfxTabPage::DeactivatePage; - - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - virtual void ActivatePage( const SfxItemSet& rSet ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual void Reset( const SfxItemSet& rSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void FillUserData(); - // the writer uses SID_ATTR_BRUSH as font background - void SetPreviewBackgroundToCharacter(); - virtual void PageCreated (SfxAllItemSet aSet); -}; - -// class SvxCharTwoLinesPage --------------------------------------------- - -class SvxCharTwoLinesPage : public SvxCharBasePage -{ -private: - FixedLine m_aSwitchOnLine; - CheckBox m_aTwoLinesBtn; - - FixedLine m_aEncloseLine; - FixedText m_aStartBracketFT; - ListBox m_aStartBracketLB; - FixedText m_aEndBracketFT; - ListBox m_aEndBracketLB; - - sal_uInt16 m_nStartBracketPosition; - sal_uInt16 m_nEndBracketPosition; - - SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rSet ); - - void UpdatePreview_Impl(); - void Initialize(); - void SelectCharacter( ListBox* pBox ); - void SetBracket( sal_Unicode cBracket, sal_Bool bStart ); - - DECL_LINK( TwoLinesHdl_Impl, CheckBox* ); - DECL_LINK( CharacterMapHdl_Impl, ListBox* ); - -public: - using SfxTabPage::ActivatePage; - using SfxTabPage::DeactivatePage; - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual void Reset( const SfxItemSet& rSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - // the writer uses SID_ATTR_BRUSH as font background - void SetPreviewBackgroundToCharacter(); - virtual void PageCreated (SfxAllItemSet aSet); -}; - -#endif // #ifndef _SVX_CHARDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx deleted file mode 100644 index 14fd01a9f..000000000 --- a/cui/source/inc/connect.hxx +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CONNECT_HXX -#define _SVX_CONNECT_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - -class SdrView; - -/************************************************************************* -|* -|* Dialog zum Aendern von Konnektoren (Connectors) -|* -\************************************************************************/ - -class SvxConnectionPage : public SfxTabPage -{ -private: - FixedText aFtType; - ListBox aLbType; - - FixedLine aFlDelta; - FixedText aFtLine1; - MetricField aMtrFldLine1; - FixedText aFtLine2; - MetricField aMtrFldLine2; - FixedText aFtLine3; - MetricField aMtrFldLine3; - - FixedLine aFlDistance; - FixedText aFtHorz1; - MetricField aMtrFldHorz1; - FixedText aFtVert1; - MetricField aMtrFldVert1; - FixedText aFtHorz2; - MetricField aMtrFldHorz2; - FixedText aFtVert2; - MetricField aMtrFldVert2; - - SvxXConnectionPreview aCtlPreview; - - const SfxItemSet& rOutAttrs; - SfxItemSet aAttrSet; - const SdrView* pView; - SfxMapUnit eUnit; - -#ifdef _SVX_CONNECT_CXX - void FillTypeLB(); - - DECL_LINK( ChangeAttrHdl_Impl, void * ); -#endif - -public: - - SvxConnectionPage( Window* pWindow, const SfxItemSet& rInAttrs ); - ~SvxConnectionPage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { pView = pSdrView; } - virtual void PageCreated (SfxAllItemSet aSet); -}; - -/************************************************************************* -|* -|* Von SfxSingleTabDialog abgeleitet, um vom Control "uber virtuelle Methode -|* benachrichtigt werden zu k"onnen. -|* -\************************************************************************/ - -class SvxConnectionDialog : public SfxSingleTabDialog -{ -public: - SvxConnectionDialog( Window* pParent, const SfxItemSet& rAttr, - const SdrView* pView ); - ~SvxConnectionDialog(); -}; - -#endif // _SVX_CONNECT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx deleted file mode 100644 index d3d137327..000000000 --- a/cui/source/inc/cuicharmap.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_CHARMAP_HXX -#define _CUI_CHARMAP_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - -class SubsetMap; -class SvxCharMapData; - -// define ---------------------------------------------------------------- - -#define CHARMAP_MAXLEN 32 - -namespace svx -{ - struct SvxShowCharSetItem; - class SvxShowCharSetVirtualAcc; -} -// class SvxCharacterMap ------------------------------------------------- -// the main purpose of this dialog is to enable the use of characters -// that are not easily accesible from the keyboard - -// class SvxShowText ===================================================== - -class SvxShowText : public Control -{ -public: - SvxShowText( Window* pParent, - const ResId& rResId, - sal_Bool bCenter = sal_False ); - ~SvxShowText(); - - void SetFont( const Font& rFont ); - void SetText( const String& rText ); - -protected: - virtual void Paint( const Rectangle& ); - -private: - long mnY; - sal_Bool mbCenter; - -}; - -class SvxCharMapData -{ -public: - SvxCharMapData( class SfxModalDialog* pDialog, sal_Bool bOne_, ResMgr* pResContext ); - - void SetCharFont( const Font& rFont ); - -private: -friend class SvxCharacterMap; - SfxModalDialog* mpDialog; - - SvxShowCharSet aShowSet; - SvxShowText aShowText; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - PushButton aDeleteBtn; - FixedText aFontText; - ListBox aFontLB; - FixedText aSubsetText; - ListBox aSubsetLB; - FixedText aSymbolText; - SvxShowText aShowChar; - FixedText aCharCodeText; - Font aFont; - sal_Bool bOne; - const SubsetMap* pSubsetMap; - - DECL_LINK( OKHdl, OKButton* ); - DECL_LINK( FontSelectHdl, ListBox* ); - DECL_LINK( SubsetSelectHdl, ListBox* ); - DECL_LINK( CharDoubleClickHdl, Control* pControl ); - DECL_LINK( CharSelectHdl, Control* pControl ); - DECL_LINK( CharHighlightHdl, Control* pControl ); - DECL_LINK( CharPreSelectHdl, Control* pControl ); - DECL_LINK( DeleteHdl, PushButton* pBtn ); - DECL_LINK( AssignHdl, PushButton* pBtn ); -}; - -class SvxCharacterMap : public SfxModalDialog -{ -private: - SvxCharMapData* mpCharMapData; - -public: - SvxCharacterMap( Window* pParent, sal_Bool bOne=sal_True, const SfxItemSet* pSet=0 ); - ~SvxCharacterMap(); - - void DisableFontSelection(); - - const Font& GetCharFont() const; - void SetCharFont( const Font& rFont ); - - void SetChar( sal_UCS4 ); - sal_UCS4 GetChar() const; - - String GetCharacters() const; - - virtual short Execute(); -}; - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx deleted file mode 100644 index c273b8a70..000000000 --- a/cui/source/inc/cuifmsearch.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_FMSEARCH_HXX -#define _CUI_FMSEARCH_HXX - -#include - -#include - -#define _SVSTDARR_STRINGSDTOR -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace svxform { - class FmSearchConfigItem; -} - -// =================================================================================================== -// = class FmSearchDialog - Dialog for searching in Forms/Tables -// =================================================================================================== - -struct FmSearchProgress; - -class FmSearchEngine; - -class FmSearchDialog : public ModalDialog -{ - friend class FmSearchEngine; - - // my all Controls - FixedLine m_flSearchFor; - RadioButton m_rbSearchForText; - RadioButton m_rbSearchForNull; - RadioButton m_rbSearchForNotNull; - ComboBox m_cmbSearchText; - FixedLine m_flWhere; - FixedText m_ftForm; - ListBox m_lbForm; - RadioButton m_rbAllFields; - RadioButton m_rbSingleField; - ListBox m_lbField; - FixedLine m_flOptions; - FixedText m_ftPosition; - ListBox m_lbPosition; - CheckBox m_cbUseFormat; - CheckBox m_cbCase; - CheckBox m_cbBackwards; - CheckBox m_cbStartOver; - CheckBox m_cbWildCard; - CheckBox m_cbRegular; - CheckBox m_cbApprox; - PushButton m_pbApproxSettings; - CheckBox m_aHalfFullFormsCJK; - CheckBox m_aSoundsLikeCJK; - PushButton m_aSoundsLikeCJKSettings; - FixedLine m_flState; - FixedText m_ftRecordLabel; - FixedText m_ftRecord; - FixedText m_ftHint; - PushButton m_pbSearchAgain; - CancelButton m_pbClose; - HelpButton m_pbHelp; - String m_sSearch; - String m_sCancel; - - Window* m_pPreSearchFocus; - - Link m_lnkFoundHandler; // Handler for "found" - Link m_lnkCanceledNotFoundHdl; // Handler for Positioning the Cursors - - Link m_lnkContextSupplier; // for search in contexts - - // an Array, in dem ich mir fuer jeden Kontext das aktuell selektierte Feld merke - ::std::vector m_arrContextFields; - - // fuer die eigentliche Arbeit ... - FmSearchEngine* m_pSearchEngine; - - Timer m_aDelayedPaint; - // see EnableSearchUI - - ::svxform::FmSearchConfigItem* m_pConfig; -public: - /** hiermit kann in verschiedenen Saetzen von Feldern gesucht werden. Es gibt eine Reihe von Kontexten, deren Namen in - strContexts stehen (getrennt durch ';'), der Benutzer kann einen davon auswaehlen. - Wenn der Benutzer einen Kontext auswaehlt, wird lnkContextSupplier aufgerufen, er bekommt einen Zeiger auf eine - FmSearchContext-Struktur, die gefuellt werden muss. - Fuer die Suche gilt dann : - a) bei formatierter Suche wird der Iterator selber verwendet (wie beim ersten Constructor auch) - b) bei formatierter Suche wird NICHT der FormatKey an den Fields des Iterators verwendet, sondern die entsprechende - TextComponent wird gefragt (deshalb auch die Verwendung des originalen Iterator, durch dessen Move werden hoffentlich - die hinter den TextComponent-Interfaces stehenden Controls geupdatet) - c) bei nicht formatierter Suche wird ein Clone des Iterators verwendet (da ich hier die TextComponent-Interfaces nicht - fragen muss) - (natuerlich zwingend erforderlich : der String Nummer i in strUsedFields eines Kontexts muss mit dem Interface Nummer i - in arrFields des Kontexts korrespondieren) - */ - FmSearchDialog(Window* pParent, const String& strInitialText, const ::std::vector< String >& _rContexts, sal_Int16 nInitialContext, - const Link& lnkContextSupplier); - - virtual ~FmSearchDialog(); - - /** der Found-Handler bekommt im "gefunden"-Fall einen Zeiger auf eine FmFoundRecordInformation-Struktur - (dieser ist nur im Handler gueltig, wenn man sich also die Daten merken muss, nicht den Zeiger, sondern die - Struktur kopieren) - Dieser Handler MUSS gesetzt werden. - Ausserdem sollte beachtet werden, dass waehrend des Handlers der Suchdialog immer noch modal ist - */ - void SetFoundHandler(const Link& lnk) { m_lnkFoundHandler = lnk; } - /** - Wenn die Suche abgebrochen oder erfolglos beendet wurde, wird im Suchdialog immer der aktuelle Datensatz angezeigt - Damit das mit der eventuellen Anzeige des Aufrufers synchron geht, existiert dieser Handler (der nicht undbedingt gesetzt - werden muss). - Der dem Handler uebergebene Zeiger zeigt auf eine FmFoundRecordInformation-Struktur, bei der aPosition und eventuell - (bei Suche mit Kontexten) nContext gueltig sind. - */ - void SetCanceledNotFoundHdl(const Link& lnk) { m_lnkCanceledNotFoundHdl = lnk; } - - inline void SetActiveField(const String& strField); - -protected: - virtual sal_Bool Close(); - - void Init(const String& strVisibleFields, const String& strInitialText); - // nur von den Constructoren aus zu verwenden - - void OnFound(const ::com::sun::star::uno::Any& aCursorPos, sal_Int16 nFieldPos); - - void EnableSearchUI(sal_Bool bEnable); - // beim Suchen in einem eigenen Thread moechte ich natuerlich die UI zum Starten/Parameter-Setzen der Suche disablen - // Bei bEnable == sal_False wird fuer alle betroffenen Controls das Painten kurz aus- und mittels m_aDelayedPaint nach - // einer kurzen Weile wieder angeschaltet. Wenn inzwischen eine Anforderung mit bEnable==sal_True kommt, wird der Timer gestoppt - // und das Painten gleich wieder angeschaltet. Als Konsequenz dieses umstaendlichen Vorgehens ist kein Flackern zu sehen, - // wenn man schnell hintereinander aus- und wieder einschaltet. - - void EnableSearchForDependees(sal_Bool bEnable); - - void EnableControlPaint(sal_Bool bEnable); - // enabled (disabled) fuer alle wichtigen Controls ihr Paint - - void InitContext(sal_Int16 nContext); - - void LoadParams(); - void SaveParams() const; - -private: - // Handler for the Controls - DECL_LINK( OnClickedFieldRadios, Button* ); - DECL_LINK( OnClickedSearchAgain, Button* ); - DECL_LINK( OnClickedSpecialSettings, Button* ); - - DECL_LINK( OnSearchTextModified, ComboBox* ); - - DECL_LINK( OnPositionSelected, ListBox* ); - DECL_LINK( OnFieldSelected, ListBox* ); - - DECL_LINK( OnCheckBoxToggled, CheckBox* ); - - DECL_LINK( OnContextSelection, ListBox* ); - - // Such-Fortschritt - DECL_LINK( OnSearchProgress, FmSearchProgress* ); - - DECL_LINK( OnDelayedPaint, void* ); - // see EnableSearchUI - - void implMoveControls(Control** _ppControls, sal_Int32 _nControls, sal_Int32 _nUp, Control* _pToResize); - - void initCommon( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _rxCursor ); -}; - -inline void FmSearchDialog::SetActiveField(const String& strField) -{ - sal_uInt16 nInitialField = m_lbField.GetEntryPos(strField); - if (nInitialField == COMBOBOX_ENTRY_NOTFOUND) - nInitialField = 0; - m_lbField.SelectEntryPos(nInitialField); - LINK(this, FmSearchDialog, OnFieldSelected).Call(&m_lbField); -} - -#endif // _CUI_FMSEARCH_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx deleted file mode 100644 index 1009ce0e7..000000000 --- a/cui/source/inc/cuigaldlg.hxx +++ /dev/null @@ -1,383 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_GALDLG_HXX_ -#define _CUI_GALDLG_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ------------ -// - Forwards - -// ------------ - -class Gallery; -class GalleryTheme; -class SearchProgress; -class TakeProgress; -class TPGalleryThemeProperties; - -typedef ::std::vector< UniString* > StringList; -typedef ::std::vector< sal_uLong > TokenList_impl; - -// --------------- -// - FilterEntry - -// --------------- - -struct FilterEntry -{ - String aFilterName; -}; - -// ---------------- -// - SearchThread - -// ---------------- - -class SearchThread : public ::osl::Thread -{ -private: - - SearchProgress* mpProgress; - TPGalleryThemeProperties* mpBrowser; - INetURLObject maStartURL; - - void ImplSearch( const INetURLObject& rStartURL, - const ::std::vector< String >& rFormats, - sal_Bool bRecursive ); - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - -public: - - SearchThread( SearchProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - const INetURLObject& rStartURL ); - virtual ~SearchThread(); -}; - -// ------------------ -// - SearchProgress - -// ------------------ - -class SearchProgress : public ModalDialog -{ -private: - - FixedText aFtSearchDir; - FixedLine aFLSearchDir; - FixedText aFtSearchType; - FixedLine aFLSearchType; - CancelButton aBtnCancel; - SearchThread maSearchThread; - - DECL_LINK( ClickCancelBtn, void* ); - void Terminate(); - -public: - SearchProgress( Window* pParent, const INetURLObject& rStartURL ); - ~SearchProgress() {}; - - DECL_LINK( CleanUpHdl, void* ); - - virtual short Execute(); - virtual void StartExecuteModal( const Link& rEndDialogHdl ); - void SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); } - void SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); } -}; - -// -------------- -// - TakeThread - -// -------------- - -class TakeThread : public ::osl::Thread -{ -private: - - TakeProgress* mpProgress; - TPGalleryThemeProperties* mpBrowser; - TokenList_impl& mrTakenList; - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - -public: - - TakeThread( - TakeProgress* pProgess, - TPGalleryThemeProperties* pBrowser, - TokenList_impl& rTakenList - ); - virtual ~TakeThread(); -}; - -// ---------------- -// - TakeProgress - -// ---------------- - -class TakeProgress : public ModalDialog -{ -private: - - FixedText aFtTakeFile; - FixedLine aFLTakeProgress; - CancelButton aBtnCancel; - TakeThread maTakeThread; - TokenList_impl maTakenList; - - DECL_LINK( ClickCancelBtn, void* ); - void Terminate(); - -public: - - TakeProgress( Window* pWindow ); - ~TakeProgress() {}; - - DECL_LINK( CleanUpHdl, void* ); - - void SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); } - virtual short Execute(); - virtual void StartExecuteModal( const Link& rEndDialogHdl ); -}; - -// --------------------- -// - ActualizeProgress - -// --------------------- - -class ActualizeProgress : public ModalDialog -{ -private: - - FixedText aFtActualizeFile; - FixedLine aFLActualizeProgress; - CancelButton aBtnCancel; - Timer* pTimer; - GalleryTheme* pTheme; - GalleryProgress aStatusProgress; - - DECL_LINK( ClickCancelBtn, void* ); - DECL_LINK( TimeoutHdl, Timer* ); - DECL_LINK( ActualizeHdl, INetURLObject* pURL ); - -public: - ActualizeProgress( Window* pWindow, GalleryTheme* pThm ); - ~ActualizeProgress() {}; - - virtual short Execute(); -}; - -// --------------- -// - TitleDialog - -// --------------- - -class TitleDialog : public ModalDialog -{ -private: - - OKButton maOk; - CancelButton maCancel; - HelpButton maHelp; - FixedLine maFL; - Edit maEdit; - -public: - - TitleDialog( Window* pParent, const String& rOldText ); - String GetTitle() const { return maEdit.GetText(); } -}; - -// ------------------- -// - GalleryIdDialog - -// ------------------- - -class GalleryIdDialog : public ModalDialog -{ -private: - - OKButton aBtnOk; - CancelButton aBtnCancel; - FixedLine aFLId; - ListBox aLbResName; - GalleryTheme* pThm; - - DECL_LINK( ClickOkHdl, void* ); - DECL_LINK( ClickResNameHdl, void* ); - -public: - - GalleryIdDialog( Window* pParent, GalleryTheme* pThm ); - ~GalleryIdDialog() {} - - sal_uLong GetId() const { return aLbResName.GetSelectEntryPos(); } -}; - -// -------------------------- -// - GalleryThemeProperties - -// -------------------------- - -class GalleryThemeProperties : public SfxTabDialog -{ - ExchangeData* pData; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -public: - - GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet ); - ~GalleryThemeProperties() {} -}; - -// ------------------------- -// - TPGalleryThemeGeneral - -// ------------------------- - -class TPGalleryThemeGeneral : public SfxTabPage -{ -private: - - FixedImage aFiMSImage; - Edit aEdtMSName; - FixedLine aFlMSGeneralFirst; - FixedText aFtMSType; - FixedText aFtMSShowType; - FixedText aFtMSPath; - FixedText aFtMSShowPath; - FixedText aFtMSContent; - FixedText aFtMSShowContent; - FixedLine aFlMSGeneralSecond; - FixedText aFtMSChangeDate; - FixedText aFtMSShowChangeDate; - ExchangeData* pData; - - virtual void Reset( const SfxItemSet& ) {} - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - - -public: - - TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet ); - ~TPGalleryThemeGeneral() {} - - void SetXChgData( ExchangeData* pData ); - const ExchangeData* GetXChgData() const { return pData; } - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); -}; - -// ---------------------------- -// - TPGalleryThemeProperties - -// ---------------------------- -typedef ::std::vector< FilterEntry* > FilterEntryList_impl; - -class TPGalleryThemeProperties : public SfxTabPage -{ - friend class SearchThread; - friend class TakeProgress; - friend class TakeThread; - - FixedText aFtFileType; - ComboBox aCbbFileType; - MultiListBox aLbxFound; - PushButton aBtnSearch; - PushButton aBtnTake; - PushButton aBtnTakeAll; - CheckBox aCbxPreview; - GalleryPreview aWndPreview; - - ExchangeData* pData; - StringList aFoundList; - FilterEntryList_impl aFilterEntryList; - Timer aPreviewTimer; - String aLastFilterName; - String aPreviewString; - INetURLObject aURL; - sal_uInt16 nCurFilterPos; - sal_uInt16 nFirstExtFilterPos; - sal_Bool bEntriesFound; - sal_Bool bInputAllowed; - sal_Bool bTakeAll; - sal_Bool bSearchRecursive; - - ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; - ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; - - virtual void Reset( const SfxItemSet& /*rSet*/ ) {} - virtual sal_Bool FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; } - ::rtl::OUString addExtension( const ::rtl::OUString&, const ::rtl::OUString& ); - void FillFilterList(); - - void SearchFiles(); - void TakeFiles(); - void DoPreview(); - - DECL_LINK( ClickPreviewHdl, void* ); - DECL_LINK( ClickCloseBrowserHdl, void* ); - DECL_LINK( ClickSearchHdl, void* ); - DECL_LINK( ClickTakeHdl, void* ); - DECL_LINK( ClickTakeAllHdl, void* ); - DECL_LINK( SelectFoundHdl, void* ); - DECL_LINK( SelectThemeHdl, void* ); - DECL_LINK( SelectFileTypeHdl, void* ); - DECL_LINK( DClickFoundHdl, void* ); - DECL_LINK( PreviewTimerHdl, void* ); - DECL_LINK( EndSearchProgressHdl, SearchProgress* ); - DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* ); - -public: - TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet ); - ~TPGalleryThemeProperties(); - - void SetXChgData( ExchangeData* pData ); - const ExchangeData* GetXChgData() const { return pData; } - - void StartSearchFiles( const String& _rFolderURL, short _nDlgResult ); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); -}; - -#endif // _CUI_GALDLG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuigrfflt.hxx b/cui/source/inc/cuigrfflt.hxx deleted file mode 100644 index ceadd8323..000000000 --- a/cui/source/inc/cuigrfflt.hxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_GRFFLT_HXX -#define _CUI_GRFFLT_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ----------------------- -// - GraphicFilterDialog - -// ----------------------- - -class GraphicFilterDialog : public ModalDialog -{ -private: - - class PreviewWindow : public Control - { - private: - - GraphicObject maGraphic; - - virtual void Paint( const Rectangle& rRect ); - - public: - - PreviewWindow( Window* pParent, const ResId& rResId ); - ~PreviewWindow(); - - void SetGraphic( const Graphic& rGraphic ); - }; - -private: - - Timer maTimer; - Link maModifyHdl; - Graphic maGraphic; - double mfScaleX; - double mfScaleY; - Size maSizePixel; - - DECL_LINK( ImplPreviewTimeoutHdl, Timer* pTimer ); - DECL_LINK( ImplModifyHdl, void* p ); - -protected: - PreviewWindow maPreview; - OKButton maBtnOK; - CancelButton maBtnCancel; - HelpButton maBtnHelp; - FixedLine maFlParameter; - - const Link& GetModifyHdl() const { return maModifyHdl; } - const Size& GetGraphicSizePixel() const { return maSizePixel; } - -public: - - GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ); - ~GraphicFilterDialog(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ) = 0; -}; - -// ----------------------- -// - GraphicFilterMosaic - -// ----------------------- - -class GraphicFilterMosaic : public GraphicFilterDialog -{ -private: - - FixedText maFtWidth; - MetricField maMtrWidth; - FixedText maFtHeight; - MetricField maMtrHeight; - CheckBox maCbxEdges; - -public: - - GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges ); - ~GraphicFilterMosaic(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - long GetTileWidth() const { return static_cast(maMtrWidth.GetValue()); } - long GetTileHeight() const { return static_cast(maMtrHeight.GetValue()); } - sal_Bool IsEnhanceEdges() const { return maCbxEdges.IsChecked(); } -}; - -// ------------------------- -// - GraphicFilterSolarize - -// ------------------------- - -class GraphicFilterSolarize : public GraphicFilterDialog -{ -private: - - FixedText maFtThreshold; - MetricField maMtrThreshold; - CheckBox maCbxInvert; - -public: - - GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic, - sal_uInt8 nGreyThreshold, sal_Bool bInvert ); - ~GraphicFilterSolarize(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - sal_uInt8 GetGreyThreshold() const { return( (sal_uInt8) FRound( maMtrThreshold.GetValue() * 2.55 ) ); } - sal_Bool IsInvert() const { return maCbxInvert.IsChecked(); } -}; - -// ---------------------- -// - GraphicFilterSepia - -// ---------------------- - -class GraphicFilterSepia : public GraphicFilterDialog -{ -private: - - FixedText maFtSepia; - MetricField maMtrSepia; - -public: - - GraphicFilterSepia( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nSepiaPercent ); - ~GraphicFilterSepia(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - sal_uInt16 GetSepiaPercent() const - { return sal::static_int_cast< sal_uInt16 >(maMtrSepia.GetValue()); } -}; - -// ----------------------- -// - GraphicFilterPoster - -// ----------------------- - -class GraphicFilterPoster : public GraphicFilterDialog -{ -private: - - FixedText maFtPoster; - NumericField maNumPoster; - -public: - - GraphicFilterPoster( Window* pParent, const Graphic& rGraphic, - sal_uInt16 nPosterColorCount ); - ~GraphicFilterPoster(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - sal_uInt16 GetPosterColorCount() const { return( (sal_uInt16) maNumPoster.GetValue() ); } -}; - -// ----------------------- -// - GraphicFilterEmboss - -// ----------------------- - -class GraphicFilterEmboss : public GraphicFilterDialog -{ -private: - - class EmbossControl : public SvxRectCtl - { - private: - - Link maModifyHdl; - - virtual void MouseButtonDown( const MouseEvent& rEvt ); - - public: - - EmbossControl( Window* pParent, const ResId& rResId, RECT_POINT eRectPoint ) : - SvxRectCtl( pParent, rResId ) { SetActualRP( eRectPoint ); } - - void SetModifyHdl( const Link& rHdl ) { maModifyHdl = rHdl; } - }; - -private: - - FixedText maFtLight; - EmbossControl maCtlLight; - -public: - - GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic, - RECT_POINT eLightSource ); - ~GraphicFilterEmboss(); - - virtual Graphic GetFilteredGraphic( const Graphic& rGraphic, double fScaleX, double fScaleY ); - RECT_POINT GetLightSource() const { return maCtlLight.GetActualRP(); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx deleted file mode 100644 index 280d440ad..000000000 --- a/cui/source/inc/cuihyperdlg.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _CUI_TAB_HYPERLINK_HXX -#define _CUI_TAB_HYPERLINK_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -#include "iconcdlg.hxx" - -/************************************************************************* -|* -|* Hyperlink-Dialog -|* -\************************************************************************/ - -class SvxHpLinkDlg; -class SvxHlinkCtrl : public SfxControllerItem -{ -private : - SvxHpLinkDlg *pParent; - - SfxStatusForwarder aOnlineForwarder; - SfxStatusForwarder aRdOnlyForwarder; - -public : - SvxHlinkCtrl( sal_uInt16 nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg); - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ); -}; - - - -/************************************************************************* -|* -|* Hyperlink-Dialog -|* -\************************************************************************/ - -class SvxHpLinkDlg : public IconChoiceDialog -{ -private: - SvxHlinkCtrl maCtrl; // Controler - SfxBindings* mpBindings; - SfxItemSet* mpItemSet; - - sal_Bool mbDummy1 : 1; - sal_Bool mbDummy2 : 1; - sal_Bool mbDummy3 : 1; - sal_Bool mbDummy4 : 1; - sal_Bool mbDummy5 : 1; - sal_Bool mbGrabFocus : 1; - sal_Bool mbReadOnly : 1; - sal_Bool mbIsHTMLDoc : 1; - - void* mpDummy1; - void* mpDummy2; - - DECL_LINK (ClickApplyHdl_Impl, void * ); - DECL_LINK (ClickCloseHdl_Impl, void * ); - -protected: - virtual sal_Bool Close(); - virtual void Move(); - -public: - SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings ); - ~SvxHpLinkDlg (); - - virtual void PageCreated( sal_uInt16 nId, IconChoicePage& rPage ); - - sal_uInt16 SetPage( SvxHyperlinkItem* pItem ); - void EnableInetBrowse( sal_Bool bEnable = sal_True ); - void SetReadOnlyMode( sal_Bool bReadOnly = sal_False ); - inline sal_Bool IsHTMLDoc() const { return mbIsHTMLDoc; } - - inline SfxBindings* GetBindings() const { return mpBindings; }; - inline SfxDispatcher* GetDispatcher() const { return mpBindings->GetDispatcher(); } -}; - - -#endif // _CUI_TAB_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx deleted file mode 100644 index b12c86ce3..000000000 --- a/cui/source/inc/cuiimapwnd.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#ifndef _CUI_IMAPWND_HXX -#define _CUI_IMAPWND_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -class URLDlg : public ModalDialog -{ - FixedText maFtURL; - Edit maEdtURL; - FixedText maFtTarget; - ComboBox maCbbTargets; - FixedText maFtName; - Edit maEdtName; - FixedText maFtAlternativeText; - Edit maEdtAlternativeText; - FixedText maFtDescription; - MultiLineEdit maEdtDescription; - FixedLine maFlURL; - HelpButton maBtnHelp; - OKButton maBtnOk; - CancelButton maBtnCancel; - -public: - - URLDlg( Window* pWindow, - const String& rURL, const String& rAlternativeText, const String& rDescription, - const String& rTarget, const String& rName, - TargetList& rTargetList ); - - String GetURL() const { return maEdtURL.GetText(); } - String GetAltText() const { return maEdtAlternativeText.GetText(); } - String GetDesc() const { return maEdtDescription.GetText(); } - String GetTarget() const { return maCbbTargets.GetText(); } - String GetName() const { return maEdtName.GetText(); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx deleted file mode 100644 index ce50ba89e..000000000 --- a/cui/source/inc/cuioptgenrl.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CUIOPTGENRL_HXX -#define _SVX_CUIOPTGENRL_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -struct GeneralTabPage_Impl; - -#define SfxGeneralTabPage SvxGeneralTabPage -#define INDEX_NOTSET ((sal_Int16)-1) - -// class SvxUserEdit ----------------------------------------------------- - -class SvxUserEdit : public Edit -{ -private: - sal_Int16 m_nIndex; - FixedText* m_pLabel; - -public: - SvxUserEdit( Window* pParent, const ResId& rResId, - sal_Int16 nIndex = INDEX_NOTSET, FixedText* pLabel = NULL ) : - Edit( pParent, rResId, true ), m_nIndex( nIndex ), m_pLabel( pLabel ) {} - - inline void SetIndex( sal_Int16 nIndex ) { m_nIndex = nIndex; } - inline sal_Int16 GetIndex() const { return m_nIndex; } - inline void SetLabel( FixedText* pLabel ) { m_pLabel = pLabel; } - inline FixedText* GetLabel() const { return m_pLabel; } -}; - -// class SvxGeneralTabPage ----------------------------------------------- - -class SvxGeneralTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; -private: - FixedLine aAddrFrm; - FixedText aCompanyLbl; - SvxUserEdit aCompanyEdit; - FixedText aNameLbl; - FixedText aNameLblRuss; - FixedText aNameLblEastern; - SvxUserEdit aFirstName; - SvxUserEdit aFatherName; - SvxUserEdit aName; - SvxUserEdit aShortName; - FixedText aStreetLbl; - FixedText aStreetLblRuss; - SvxUserEdit aStreetEdit; - SvxUserEdit aApartmentNrEdit; - FixedText aCityLbl; - SvxUserEdit aPLZEdit; - SvxUserEdit aCityEdit; - SvxUserEdit aUsCityEdit; - SvxUserEdit aUsStateEdit; - SvxUserEdit aUsZipEdit; - FixedText aCountryLbl; - SvxUserEdit aCountryEdit; - FixedText aTitlePosLbl; - SvxUserEdit aTitleEdit; - SvxUserEdit aPositionEdit; - FixedText aPhoneLbl; - SvxUserEdit aTelPrivEdit; - SvxUserEdit aTelCompanyEdit; - FixedText aFaxMailLbl; - SvxUserEdit aFaxEdit; - SvxUserEdit aEmailEdit; - CheckBox aUseDataCB; - - GeneralTabPage_Impl* pImpl; - -#ifdef _SVX_OPTGENRL_CXX - DECL_LINK( ModifyHdl_Impl, Edit * ); - - sal_Bool GetAddress_Impl(); - void SetAddress_Impl(); -#endif - -protected: - virtual int DeactivatePage( SfxItemSet* pSet ); - -public: - SvxGeneralTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxGeneralTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif // #ifndef _SVX_CUIOPTGENRL_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc deleted file mode 100644 index 629e55a2c..000000000 --- a/cui/source/inc/cuires.hrc +++ /dev/null @@ -1,439 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_RESID_HRC -#define _CUI_REDID_HRC - -// include ------------------------------------------------------------------ - -#include -#include - -// Resource-Id's ------------------------------------------------------------ - -// Gallery -#define RID_CUI_GALLERY_START (RID_SVX_START + 360) -#define RID_CUI_GALLERY_END (RID_SVX_START + 410) - -// tab pages -// used in "dialogs" -#define RID_SVX_FORMAT_CELLS_DLG ( RID_SVX_START + 42 ) - -// used in "tabpages" -#define RID_SVXDLG_TEXT (RID_SVX_START + 183) -#define RID_SVXDLG_TRANSFORM (RID_SVX_START + 45) -#define RID_SVXDLG_LINE (RID_SVX_START + 50) -#define RID_SVXDLG_BBDLG (RID_SVX_START + 40) -#define RID_SVXDLG_CAPTION (RID_SVX_START + 151) -#define RID_SVXDLG_AREA (RID_SVX_START + 55) -#define RID_SVXSTRARY_PAPERSIZE_STD (RID_SVX_START + 142) -#define RID_SVXSTRARY_PAPERSIZE_DRAW (RID_SVX_START + 143) -#define RID_SVXSTR_TABLE_PRESET_NONE (RID_SVX_START + 969) -#define RID_SVXSTR_TABLE_PRESET_ONLYOUTER (RID_SVX_START + 970) -#define RID_SVXSTR_TABLE_PRESET_OUTERHORI (RID_SVX_START + 971) -#define RID_SVXSTR_TABLE_PRESET_OUTERALL (RID_SVX_START + 972) -#define RID_SVXSTR_TABLE_PRESET_OUTERINNER (RID_SVX_START + 973) -#define RID_SVXSTR_PARA_PRESET_DIAGONAL (RID_SVX_START + 974) -#define RID_SVXSTR_PARA_PRESET_ALL (RID_SVX_START + 975) -#define RID_SVXSTR_PARA_PRESET_LEFTRIGHT (RID_SVX_START + 976) -#define RID_SVXSTR_PARA_PRESET_TOPBOTTOM (RID_SVX_START + 977) -#define RID_SVXSTR_PARA_PRESET_ONLYLEFT (RID_SVX_START + 978) -#define RID_SVXSTR_SHADOW_STYLE_NONE (RID_SVX_START + 979) -#define RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT (RID_SVX_START + 980) -#define RID_SVXSTR_SHADOW_STYLE_TOPRIGHT (RID_SVX_START + 981) -#define RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT (RID_SVX_START + 982) -#define RID_SVXSTR_SHADOW_STYLE_TOPLEFT (RID_SVX_START + 983) -#define RID_SVXSTR_HOR_PRESET_ONLYHOR (RID_SVX_START + 1113) -#define RID_SVXSTR_VER_PRESET_ONLYVER (RID_SVX_START + 1114) -#define RID_SVXSTR_FRAMEDIR_LTR (RID_SVX_START + 960) -#define RID_SVXSTR_FRAMEDIR_RTL (RID_SVX_START + 961) -#define RID_SVXSTR_FRAMEDIR_SUPER (RID_SVX_START + 962) -#define RID_SVXSTR_PAGEDIR_LTR_HORI (RID_SVX_START + 965) -#define RID_SVXSTR_PAGEDIR_RTL_HORI (RID_SVX_START + 966) -#define RID_SVXSTR_PAGEDIR_RTL_VERT (RID_SVX_START + 967) -#define RID_SVXSTR_PAGEDIR_LTR_VERT (RID_SVX_START + 968) -#define RID_STR_EDIT_GRAPHIC (RID_SVX_START + 509) - -#define RID_SVXSTR_DESC_GRADIENT (RID_SVX_START + 163) -#define RID_SVXSTR_ASK_DEL_GRADIENT (RID_SVX_START + 165) -#define RID_SVXSTR_ASK_CHANGE_GRADIENT (RID_SVX_START + 166) -#define RID_SVXSTR_ASK_DEL_BITMAP (RID_SVX_START + 171) -#define RID_SVXSTR_ASK_CHANGE_BITMAP (RID_SVX_START + 172) -#define RID_SVXSTR_DESC_NEW_BITMAP (RID_SVX_START + 168) -#define RID_SVXSTR_DESC_EXT_BITMAP (RID_SVX_START + 169) -#define RID_SVXSTR_DESC_LINESTYLE (RID_SVX_START + 174) -#define RID_SVXSTR_ASK_DEL_LINESTYLE (RID_SVX_START + 176) -#define RID_SVXSTR_ASK_CHANGE_LINESTYLE (RID_SVX_START + 177) -#define RID_SVXSTR_DESC_HATCH (RID_SVX_START + 232) -#define RID_SVXSTR_ASK_DEL_HATCH (RID_SVX_START + 234) -#define RID_SVXSTR_ASK_CHANGE_HATCH (RID_SVX_START + 235) -#define RID_SVXSTR_CHANGE (RID_SVX_START + 181) -#define RID_SVXSTR_ADD (RID_SVX_START + 182) -#define RID_SVXSTR_DESC_COLOR (RID_SVX_START + 215) -#define RID_SVXSTR_ASK_DEL_COLOR (RID_SVX_START + 217) -#define RID_SVXSTR_ASK_CHANGE_COLOR (RID_SVX_START + 218) -#define RID_SVXSTR_TABLE (RID_SVX_START + 220) -#define RID_SVXSTR_WRITE_DATA_ERROR (RID_SVX_START + 229) -#define RID_SVXSTR_READ_DATA_ERROR (RID_SVX_START + 230) -#define RID_SVXSTR_WARN_TABLE_OVERWRITE (RID_SVX_START + 231) -#define RID_SVXSTR_ASK_CHANGE_LINEEND (RID_SVX_START + 184) -#define RID_SVXSTR_ASK_DEL_LINEEND (RID_SVX_START + 219) -#define RID_SVXSTR_DESC_LINEEND (RID_SVX_START + 238) -#define RID_SVXSTR_WARN_NAME_DUPLICATE (RID_SVX_START + 236) - -// autocor -#define RID_OFAPAGE_AUTOCOMPLETE_OPTIONS (RID_OFA_START + 119) -#define RID_OFAPAGE_AUTOCORR_OPTIONS (RID_OFA_START + 102) -#define RID_OFAPAGE_AUTOFMT_APPLY (RID_OFA_START + 110) -#define RID_OFAPAGE_AUTOCORR_REPLACE (RID_OFA_START + 103) -#define RID_OFAPAGE_AUTOCORR_EXCEPT (RID_OFA_START + 104) -#define RID_OFAPAGE_AUTOCORR_QUOTE (RID_OFA_START + 109) -#define RID_OFADLG_PRCNT_SET (RID_OFA_START + 111) - -// options -#define RID_SVXSTR_DIAGRAM_ROW (RID_SVX_START + 1162) -#define RID_OFAPAGE_CONNPOOLOPTIONS (RID_OFA_START + 122) -#define QUERY_DELETE_CONFIRM (RID_SVX_START + 1110) -#define RID_SVXPAGE_JSEARCH_OPTIONS (RID_SVX_START + 840) -#define DLG_DOCUMENTLINK (RID_OFA_START + 124) -#define STR_LINKEDDOC_DOESNOTEXIST (RID_SVX_START + 1111) -#define STR_LINKEDDOC_NO_SYSTEM_FILE (RID_SVX_START + 1169) -#define STR_NAME_CONFLICT (RID_SVX_START + 1112) -#define RID_SVX_FONT_SUBSTITUTION (RID_SVX_START + 18) - -// treeopt -#define RID_SVXPAGE_COLOR (RID_SVX_START + 60) -#define RID_SVXPAGE_SSO (RID_SVX_START + 251) -#define OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE ( RID_OFA_START + 256 ) -#define RID_OFADLG_OPTIONS_TREE_PAGES (RID_OFA_START + 116) -#define RID_OFADLG_OPTIONS_TREE (RID_OFA_START + 115) -#define RID_IMGLIST_TREEOPT (RID_OFA_START + 174) -#define RID_RIDER_SLL_SITE (RID_OFA_START + 100)//? -#define RID_RIDER_SLL_PERSONAL (RID_OFA_START + 101)//? -#define RID_OFADLG_OPTIONS_TREE_HINT (RID_OFA_START + 118)//? - -// options -#define RID_SVXDLG_WEBCONNECTION_INFO (RID_SVX_START + 301) -#define RID_SVXDLG_SECURITY_OPTIONS (RID_SVX_START + 300) -#define RID_SVXPAGE_ONLINEUPDATE (RID_SVX_START + 298) -#define OFA_TP_MEMORY (RID_OFA_START + 250) -#define RID_SVXPAGE_INET_SECURITY (RID_SVX_START + 200) -#define RID_SVXPAGE_INET_SEARCH (RID_SVX_START + 160) -#define RID_SVXPAGE_INET_PROXY (RID_SVX_START + 157) -#define RID_SVXPAGE_INET_MAIL (RID_SVX_START + 155) -#define RID_SVXPAGE_INET_MOZPLUGIN (RID_SVX_START + 2161) -#define RID_OFAPAGE_HTMLOPT (RID_OFA_START + 100) -#define OFA_TP_LANGUAGES (RID_OFA_START + 205) -#define OFA_TP_MISC (RID_OFA_START + 200) -#define OFA_TP_VIEW (RID_OFA_START + 202) -#define RID_OFAPAGE_MSFILTEROPT (RID_OFA_START + 120) -#define RID_OFAPAGE_MSFILTEROPT2 (RID_OFA_START + 121) -#define RID_OFAPAGE_SMARTTAG_OPTIONS (RID_OFA_START + 125) -#define RID_SVXPAGE_OPTIONS_CTL (RID_SVX_START + 252) -#define RID_SVXPAGE_OPTIONS_JAVA (RID_SVX_START + 253) -#define RID_SVXPAGE_ACCESSIBILITYCONFIG (RID_SVX_START + 250) -#define RID_SVXPAGE_ASIAN_LAYOUT (RID_SVX_START + 246) -#define RID_OPTPAGE_CHART_DEFCOLORS (RID_SVX_START + 299) -#define RID_OPTQB_COLOR_CHART_DELETE (RID_SVX_START + 296) -#define RID_OPTSTR_COLOR_CHART_DELETE (RID_SVX_START + 289) -#define RID_SVXPAGE_COLORCONFIG (RID_SVX_START + 249) -#define RID_SVXQB_DELETE_COLOR_CONFIG (RID_SVX_START + 324) -#define RID_SVXSTR_COLOR_CONFIG_SAVE1 (RID_SVX_START + 853) -#define RID_SVXSTR_COLOR_CONFIG_SAVE2 (RID_SVX_START + 854) -#define RID_SVXSTR_COLOR_CONFIG_DELETE (RID_SVX_START + 855) -#define RID_SVXSTR_OPT_DOUBLE_DICTS (RID_SVX_START + 320) -#define RID_SVX_MSGBOX_LANGUAGE_RESTART ( RID_SVX_START + 2 ) -#define RID_SVXERR_OPT_PROXYPORTS (RID_SVX_START + 224) -#define RID_SVXDLG_OPT_JAVASCRIPT_DISABLE (RID_SVX_START + 225) -#define RID_SVXDLG_JAVA_PARAMETER (RID_SVX_START + 254) -#define RID_SVXDLG_JAVA_CLASSPATH (RID_SVX_START + 255) -#define RID_SVXERR_JRE_NOT_RECOGNIZED (RID_SVX_START + 256) -#define RID_SVXERR_JRE_FAILED_VERSION (RID_SVX_START + 257) -#define RID_SVX_MSGBOX_JAVA_RESTART ( RID_SVX_START + 0 ) -#define RID_SVX_MSGBOX_JAVA_RESTART2 ( RID_SVX_START + 1 ) -#define RID_SVXDLG_LNG_ED_NUM_PREBREAK (RID_SVX_START + 830) -#define RID_SVXDLG_EDIT_MODULES (RID_SVX_START + 831) -#define RID_SVXSTR_PATH_NAME_START (RID_SVX_START + 1003) -#define RID_SVXDLG_FILTER_WARNING (RID_SVX_START + 248) -#define RID_SVXBMP_LOCK (RID_SVX_START + 118) -#define RID_SVXSTR_READONLY_CONFIG_TIP (RID_SVX_START + 1026) -#define RID_SVXQB_CHANGEDATA (RID_SVX_START + 214) //? -#define RID_SVXERR_OPT_DOUBLEPATHS (RID_SVX_START + 208) //? -#define RID_SVXSTR_KEY_AUTOCORRECT_DIR (RID_SVX_START + 1004) //? -#define RID_SVXSTR_KEY_DICTIONARY_PATH (RID_SVX_START + 1010)//? -#define RID_SVXSTR_KEY_LINGUISTIC_DIR (RID_SVX_START + 1016)//? -#define RID_SVXSTR_KEY_USERCONFIG_PATH (RID_SVX_START + 1023)//? -#define RID_SVXSTR_KEY_FILTER_PATH (RID_SVX_START + 1012)//? -#define RID_SVXSTR_KEY_ADDINS_PATH (RID_SVX_START + 1003)//? -#define RID_SVXSTR_KEY_FAVORITES_DIR (RID_SVX_START + 1011)//? -#define RID_SVXSTR_KEY_PLUGINS_PATH (RID_SVX_START + 1019)//? -#define RID_SVXSTR_KEY_TEMP_PATH (RID_SVX_START + 1021)//? -#define RID_SVXSTR_KEY_STORAGE_DIR (RID_SVX_START + 1020)//? -#define RID_SVXSTR_KEY_GALLERY_DIR (RID_SVX_START + 1013)//? -#define RID_SVXSTR_KEY_HELP_DIR (RID_SVX_START + 1015)//? -#define RID_SVXSTR_KEY_GLOSSARY_PATH (RID_SVX_START + 1005)//? -#define RID_SVXSTR_KEY_TEMPLATE_PATH (RID_SVX_START + 1022)//? -#define RID_SVXSTR_KEY_MODULES_PATH (RID_SVX_START + 1017)//? -#define RID_SVXSTR_KEY_BACKUP_PATH (RID_SVX_START + 1006)//? -#define RID_SVXSTR_KEY_PALETTE_PATH (RID_SVX_START + 1018)//? -#define RID_SVXSTR_KEY_CONFIG_DIR (RID_SVX_START + 1009)//? -#define RID_SVXSTR_KEY_WORK_PATH (RID_SVX_START + 1024)//? -#define RID_SVXSTR_KEY_GRAPHICS_PATH (RID_SVX_START + 1014)//? -#define RID_SVXSTR_KEY_BASIC_PATH (RID_SVX_START + 1007)//? -#define RID_SVXSTR_KEY_BITMAP_PATH (RID_SVX_START + 1008)//? -#define RID_SVXSTR_KEY_USERDICTIONARY_DIR (RID_SVX_START + 1025)//? - -// dialogs -#define RID_SVX_WND_COMMON_LINGU ( RID_SVX_START + 0 ) -#define RID_SVX_GRFFILTER_DLG_EMBOSS_TAB (RID_SVX_START + 337) -#define RID_SVXDLG_SEARCHATTR (RID_SVX_START + 22) -#define RID_SVXDLG_HYPHENATE (RID_SVX_START + 30) -#define RID_SVXDLG_THESAURUS (RID_SVX_START + 31) -#define RID_SVXDLG_THES_LANGUAGE (RID_SVX_START + 38) -#define RID_SVXSTR_HMERR_CHECKINSTALL (RID_SVX_START + 94) - -// hyperlink dialog -#define RID_SVXDLG_NEWHYPERLINK (RID_SVX_START + 227) -#define RID_SVXBMP_HLINETTP (RID_SVX_START + 556) -#define RID_SVXBMP_HLMAILTP (RID_SVX_START + 557) -#define RID_SVXBMP_HLDOCTP (RID_SVX_START + 558) -#define RID_SVXBMP_HLDOCNTP (RID_SVX_START + 559) -#define RID_SVXPAGE_HYPERLINK_INTERNET (RID_SVX_START + 228) -#define RID_SVXPAGE_HYPERLINK_MAIL (RID_SVX_START + 229) -#define RID_SVXPAGE_HYPERLINK_DOCUMENT (RID_SVX_START + 230) -#define RID_SVXPAGE_HYPERLINK_NEWDOCUMENT (RID_SVX_START + 231) -#define RID_SVXSTR_HYPERDLG_HLINETTP (RID_SVX_START + 581) -#define RID_SVXSTR_HYPERDLG_HLINETTP_HELP (RID_SVX_START + 582) -#define RID_SVXSTR_HYPERDLG_HLMAILTP (RID_SVX_START + 583) -#define RID_SVXSTR_HYPERDLG_HLMAILTP_HELP (RID_SVX_START + 584) -#define RID_SVXSTR_HYPERDLG_HLDOCTP (RID_SVX_START + 585) -#define RID_SVXSTR_HYPERDLG_HLDOCTP_HELP (RID_SVX_START + 586) -#define RID_SVXSTR_HYPERDLG_HLDOCNTP (RID_SVX_START + 587) -#define RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP (RID_SVX_START + 588) -#define RID_SVXSTR_HYPDLG_APPLYBUT (RID_SVX_START + 548) -#define RID_SVXSTR_HYPDLG_CLOSEBUT (RID_SVX_START + 549) -#define RID_SVXSTR_HYPDLG_NOVALIDFILENAME (RID_SVX_START + 553) -#define RID_SVXSTR_HYPERDLG_QUERYOVERWRITE (RID_SVX_START + 815) -#define RID_SVXSTR_HYPDLG_ERR_LERR_NOENTRIES (RID_SVX_START + 800) -#define RID_SVXSTR_HYPDLG_ERR_LERR_DOCNOTOPEN (RID_SVX_START + 801) -#define RID_SVXFLOAT_HYPERLINK_MARKWND (RID_SVX_START + 232) -#define RID_SVXSTR_HYPDLG_MACROACT1 (RID_SVX_START + 550) -#define RID_SVXSTR_HYPDLG_MACROACT2 (RID_SVX_START + 551) -#define RID_SVXSTR_HYPDLG_MACROACT3 (RID_SVX_START + 552) -#define RID_SVXSTR_HYPERDLG_FORM_BUTTON (RID_SVX_START + 813) -#define RID_SVXSTR_HYPERDLG_FROM_TEXT (RID_SVX_START + 814) - -// imap dialog -#define RID_SVX_IMAPDLG_START (RID_SVX_START + 100) -#define RID_SVXDLG_IMAPURL (RID_SVX_IMAPDLG_START + 2) - -// name dialog -#define RID_SVXDLG_NAME (RID_SVX_START + 62) -#define RID_SVXDLG_MESSBOX (RID_SVX_START + 63) -#define RID_SVXDLG_OBJECT_NAME (RID_SVX_START + 64) -#define RID_SVXDLG_OBJECT_TITLE_DESC (RID_SVX_START + 67) - -// hangulhanja -#define RID_SVX_MDLG_HANGULHANJA (RID_SVX_START + 1 ) -#define RID_SVX_MDLG_HANGULHANJA_OPT ( RID_SVX_START + 4 ) -#define RID_SVX_MDLG_HANGULHANJA_EDIT ( RID_SVX_START + 5 ) -#define RID_SVX_MDLG_HANGULHANJA_NEWDICT ( RID_SVX_START + 6 ) - -// icon choice -#define RID_SVXSTR_ICONCHOICEDLG_RESETBUT (RID_SVX_START + 580) - -// insert rows&cols -#define DLG_INS_ROW_COL (RID_SVX_START + 156) - -// SvxMultiFileDialog -#define RID_SVXSTR_FILE_TITLE (RID_SVX_START + 482) -#define RID_SVXSTR_FILE_HEADLINE (RID_SVX_START + 483) -#define RID_SVXSTR_ARCHIVE_TITLE (RID_SVX_START + 484) -#define RID_SVXSTR_ARCHIVE_HEADLINE (RID_SVX_START + 485) -#define RID_SVXSTR_MULTIFILE_DBL_ERR (RID_SVX_START + 486) - -// password to open/modify dialog -#define RID_DLG_PASSWORD_TO_OPEN_MODIFY (RID_SVX_START + 500) - -// multi path dialog -#define RID_SVXDLG_MULTIPATH (RID_SVX_START + 201) -#define RID_MULTIPATH_DBL_ERR (RID_SVX_START + 207) - -// new table dialog -#define RID_SVX_NEWTABLE_DLG ( RID_SVX_START + 44 ) - -// script organizer -#define RID_DLG_SCRIPTORGANIZER (RID_SVX_START + 258) -#define RID_DLG_NEWLIB (RID_SVX_START + 290) -#define RID_SVXSTR_DELQUERY (RID_SVX_START + 1027) -#define RID_SVXSTR_DELQUERY_TITLE (RID_SVX_START + 1028) -#define RID_SVXSTR_DELFAILED (RID_SVX_START + 1029) -#define RID_SVXSTR_DELFAILEDPERM (RID_SVX_START + 1030) -#define RID_SVXSTR_DELFAILED_TITLE (RID_SVX_START + 1031) -#define RID_SVXSTR_CREATEFAILED (RID_SVX_START + 1032) -#define RID_SVXSTR_CREATEFAILEDPERM (RID_SVX_START + 1033) -#define RID_SVXSTR_CREATEFAILEDDUP (RID_SVX_START + 1034) -#define RID_SVXSTR_CREATEFAILED_TITLE (RID_SVX_START + 1035) -#define RID_SVXSTR_RENAMEFAILED (RID_SVX_START + 1036) -#define RID_SVXSTR_RENAMEFAILEDPERM (RID_SVX_START + 1037) -#define RID_SVXSTR_RENAMEFAILED_TITLE (RID_SVX_START + 1038) -#define RID_SVXSTR_ERROR_TITLE (RID_SVX_START + 1100) -#define RID_SVXSTR_ERROR_LANG_NOT_SUPPORTED (RID_SVX_START + 1101) -#define RID_SVXSTR_ERROR_RUNNING (RID_SVX_START + 1102) -#define RID_SVXSTR_EXCEPTION_RUNNING (RID_SVX_START + 1103) -#define RID_SVXSTR_ERROR_AT_LINE (RID_SVX_START + 1104) -#define RID_SVXSTR_EXCEPTION_AT_LINE (RID_SVX_START + 1105) -#define RID_SVXSTR_FRAMEWORK_ERROR_RUNNING (RID_SVX_START + 1106) -#define RID_SVXSTR_FRAMEWORK_ERROR_AT_LINE (RID_SVX_START + 1107) -#define RID_SVXSTR_ERROR_TYPE_LABEL (RID_SVX_START + 1108) -#define RID_SVXSTR_ERROR_MESSAGE_LABEL (RID_SVX_START + 1109) - -// spell check dialog -#define RID_SVXDLG_SPELLCHECK (RID_SVX_START + 32) - -// split cells -#define RID_SVX_SPLITCELLDLG ( RID_SVX_START + 43 ) - -// searching -#define RID_SVXDLG_SEARCHSIMILARITY (RID_SVX_START + 23) - -// customize - -#define RID_SVXDLG_CUSTOMIZE (RID_SVX_START + 291) -#define RID_SVXPAGE_MENUS (RID_SVX_START + 292) -#define RID_SVXPAGE_KEYBOARD (RID_SVX_START + 293) -#define RID_SVXPAGE_TOOLBARS (RID_SVX_START + 294) -#define RID_SVXPAGE_EVENTS (RID_SVX_START + 295) -#define RID_SVXPAGE_CONFIGGROUPBOX (RID_SVX_START + 304) -#define RID_SVXDLG_ASSIGNCOMPONENT (RID_SVX_START + 297) -#define RID_DLG_SCRIPTSELECTOR (RID_SVX_START + 259) -#define RID_SVXSTR_NEW_MENU (RID_SVX_START + 1039) -#define RID_SVXSTR_NEW_TOOLBAR (RID_SVX_START + 1040) -#define RID_SVXSTR_MOVE_MENU (RID_SVX_START + 1041) -#define RID_SVXSTR_ADD_SUBMENU (RID_SVX_START + 1048) -#define RID_SVXSTR_SUBMENU_NAME (RID_SVX_START + 1049) -#define RID_SVXSTR_MENU_ADDCOMMANDS_DESCRIPTION (RID_SVX_START + 1050) -#define RID_SVXSTR_IMPORT_ICON_ERROR (RID_SVX_START + 1117) -#define RID_SVXSTR_DELETE_ICON_CONFIRM (RID_SVX_START + 1163) //added for issue73355 -#define RID_SVXSTR_REPLACE_ICON_WARNING (RID_SVX_START + 1164) //added for issue73355 -#define RID_SVXSTR_REPLACE_ICON_CONFIRM (RID_SVX_START + 1165) //added for issue73355 -#define RID_SVXSTR_YESTOALL (RID_SVX_START + 1166) //added for issue73355 -#define RID_SVXSTR_PRODUCTNAME_TOOLBARS (RID_SVX_START + 1042) -#define RID_SVXSTR_TOOLBAR (RID_SVX_START + 1043) -#define RID_SVXSTR_TOOLBAR_CONTENT (RID_SVX_START + 1044) -#define RID_SVXSTR_COMMANDS (RID_SVX_START + 1045) -#define RID_SVXSTR_COMMAND (RID_SVX_START + 1046) -#define RID_SVXSTR_TOOLBAR_NAME (RID_SVX_START + 1047) -#define RID_SVXSTR_CONFIRM_MENU_RESET (RID_SVX_START + 1115) -#define RID_SVXSTR_CONFIRM_TOOLBAR_RESET (RID_SVX_START + 1116) -#define RID_SVXSTR_LABEL_NEW_NAME (RID_SVX_START + 1135) -#define RID_SVXSTR_RENAME_MENU (RID_SVX_START + 1136) -#define RID_SVXSTR_RENAME_TOOLBAR (RID_SVX_START + 1137) -#define RID_SVXSTR_EVENT_STARTAPP (RID_SVX_START + 1051) -#define RID_SVXSTR_EVENT_CLOSEAPP (RID_SVX_START + 1052) -#define RID_SVXSTR_EVENT_NEWDOC (RID_SVX_START + 1053) -#define RID_SVXSTR_EVENT_CLOSEDOC (RID_SVX_START + 1054) -#define RID_SVXSTR_EVENT_PREPARECLOSEDOC (RID_SVX_START + 1055) -#define RID_SVXSTR_EVENT_OPENDOC (RID_SVX_START + 1056) -#define RID_SVXSTR_EVENT_SAVEDOC (RID_SVX_START + 1057) -#define RID_SVXSTR_EVENT_SAVEASDOC (RID_SVX_START + 1058) -#define RID_SVXSTR_EVENT_SAVEDOCDONE (RID_SVX_START + 1059) -#define RID_SVXSTR_EVENT_SAVEASDOCDONE (RID_SVX_START + 1060) -#define RID_SVXSTR_EVENT_ACTIVATEDOC (RID_SVX_START + 1061) -#define RID_SVXSTR_EVENT_DEACTIVATEDOC (RID_SVX_START + 1062) -#define RID_SVXSTR_EVENT_PRINTDOC (RID_SVX_START + 1063) -#define RID_SVXSTR_EVENT_MODIFYCHANGED (RID_SVX_START + 1064) -#define RID_SVXSTR_EVENT_MAILMERGE (RID_SVX_START + 1065) -#define RID_SVXSTR_EVENT_PAGECOUNTCHANGE (RID_SVX_START + 1066) -#define RID_SVXSTR_EVENT_APPROVEACTIONPERFORMED (RID_SVX_START + 1067) -#define RID_SVXSTR_EVENT_ACTIONPERFORMED (RID_SVX_START + 1068) -#define RID_SVXSTR_EVENT_CHANGED (RID_SVX_START + 1069) -#define RID_SVXSTR_EVENT_TEXTCHANGED (RID_SVX_START + 1070) -#define RID_SVXSTR_EVENT_ITEMSTATECHANGED (RID_SVX_START + 1071) -#define RID_SVXSTR_EVENT_FOCUSGAINED (RID_SVX_START + 1072) -#define RID_SVXSTR_EVENT_FOCUSLOST (RID_SVX_START + 1073) -#define RID_SVXSTR_EVENT_KEYTYPED (RID_SVX_START + 1074) -#define RID_SVXSTR_EVENT_KEYUP (RID_SVX_START + 1075) -#define RID_SVXSTR_EVENT_MOUSEENTERED (RID_SVX_START + 1076) -#define RID_SVXSTR_EVENT_MOUSEDRAGGED (RID_SVX_START + 1077) -#define RID_SVXSTR_EVENT_MOUSEMOVED (RID_SVX_START + 1078) -#define RID_SVXSTR_EVENT_MOUSEPRESSED (RID_SVX_START + 1079) -#define RID_SVXSTR_EVENT_MOUSERELEASED (RID_SVX_START + 1080) -#define RID_SVXSTR_EVENT_MOUSEEXITED (RID_SVX_START + 1081) -#define RID_SVXSTR_EVENT_APPROVERESETTED (RID_SVX_START + 1082) -#define RID_SVXSTR_EVENT_SUBMITTED (RID_SVX_START + 1083) -#define RID_SVXSTR_EVENT_BEFOREUPDATE (RID_SVX_START + 1084) -#define RID_SVXSTR_EVENT_AFTERUPDATE (RID_SVX_START + 1085) -#define RID_SVXSTR_EVENT_LOADED (RID_SVX_START + 1086) -#define RID_SVXSTR_EVENT_RELOADING (RID_SVX_START + 1087) -#define RID_SVXSTR_EVENT_RELOADED (RID_SVX_START + 1088) -#define RID_SVXSTR_EVENT_UNLOADING (RID_SVX_START + 1089) -#define RID_SVXSTR_EVENT_UNLOADED (RID_SVX_START + 1090) -#define RID_SVXSTR_EVENT_CONFIRMDELETE (RID_SVX_START + 1091) -#define RID_SVXSTR_EVENT_APPROVEROWCHANGE (RID_SVX_START + 1092) -#define RID_SVXSTR_EVENT_ROWCHANGE (RID_SVX_START + 1093) -#define RID_SVXSTR_EVENT_POSITIONING (RID_SVX_START + 1094) -#define RID_SVXSTR_EVENT_POSITIONED (RID_SVX_START + 1095) -#define RID_SVXSTR_EVENT_APPROVEPARAMETER (RID_SVX_START + 1096) -#define RID_SVXSTR_EVENT_ERROROCCURRED (RID_SVX_START + 1097) -#define RID_SVXSTR_EVENT_ADJUSTMENTVALUECHANGED (RID_SVX_START + 1098) -#define RID_SVXSTR_EVENT_RESETTED (RID_SVX_START + 1099) -#define RID_SVXSTR_EVENT_SUBCOMPONENT_OPENED (RID_SVX_START + 1170) -#define RID_SVXSTR_EVENT_SUBCOMPONENT_CLOSED (RID_SVX_START + 1171) -#define RID_SVXSTR_EVENT_CREATEDOC (RID_SVX_START + 1172) -#define RID_SVXSTR_EVENT_LOADDOCFINISHED (RID_SVX_START + 1173) -#define RID_SVXSTR_EVENT_SAVEDOCFAILED (RID_SVX_START + 1174) -#define RID_SVXSTR_EVENT_SAVEASDOCFAILED (RID_SVX_START + 1175) -#define RID_SVXSTR_EVENT_COPYTODOC (RID_SVX_START + 1176) -#define RID_SVXSTR_EVENT_COPYTODOCDONE (RID_SVX_START + 1177) -#define RID_SVXSTR_EVENT_COPYTODOCFAILED (RID_SVX_START + 1178) -#define RID_SVXSTR_EVENT_VIEWCREATED (RID_SVX_START + 1179) -#define RID_SVXSTR_EVENT_PREPARECLOSEVIEW (RID_SVX_START + 1180) -#define RID_SVXSTR_EVENT_CLOSEVIEW (RID_SVX_START + 1181) -#define RID_SVXSTR_EVENT_TITLECHANGED (RID_SVX_START + 1182) -#define RID_SVXSTR_EVENT_MODECHANGED (RID_SVX_START + 1183) -#define RID_SVXSTR_EVENT_VISAREACHANGED (RID_SVX_START + 1184) -#define RID_SVXSTR_EVENT_STORAGECHANGED (RID_SVX_START + 1185) -#define RID_SVXSTR_EVENT_MAILMERGE_END (RID_SVX_START + 1186) -#define RID_SVXSTR_EVENT_FIELDMERGE (RID_SVX_START + 1187) -#define RID_SVXSTR_EVENT_FIELDMERGE_FINISHED (RID_SVX_START + 1188) -#define RID_SVXSTR_EVENT_LAYOUT_FINISHED (RID_SVX_START + 1189) - -// For now, keep new IDs unique only within cui. -// Later, cui should perhaps get an own range of IDs. -#define RID_SVXSTR_EVENT_SELECTIONCHANGED (RID_SVX_START + 1190) -#define RID_SVXSTR_EVENT_DOUBLECLICK (RID_SVX_START + 1191) -#define RID_SVXSTR_EVENT_RIGHTCLICK (RID_SVX_START + 1192) -#define RID_SVXSTR_EVENT_CALCULATE (RID_SVX_START + 1193) -#define RID_SVXSTR_EVENT_CONTENTCHANGED (RID_SVX_START + 1194) - -#define RID_CUISTR_CONTROLS_CONTINUOUS (RID_SVX_START + 1195) -#define RID_CUISTR_CONTROLS_INVISIBLE (RID_SVX_START + 1196) -#define RID_CUISTR_CONTROLS_INSERTTABLE (RID_SVX_START + 1197) - -#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3) - -#endif diff --git a/cui/source/inc/cuisrchdlg.hxx b/cui/source/inc/cuisrchdlg.hxx deleted file mode 100644 index edc17551d..000000000 --- a/cui/source/inc/cuisrchdlg.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_SRCHDLG_HXX -#define _CUI_SRCHDLG_HXX - -// include --------------------------------------------------------------- - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define _SVSTDARR_STRINGSDTOR -#include -#include -#include - -class SvxJSearchOptionsPage; - -class SvxJSearchOptionsDialog : public SfxSingleTabDialog -{ - sal_Int32 nInitialTlFlags; - SvxJSearchOptionsPage *pPage; - - // disallow copy-constructor and assignment-operator for now - SvxJSearchOptionsDialog( const SvxJSearchOptionsDialog & ); - SvxJSearchOptionsDialog & operator == ( const SvxJSearchOptionsDialog & ); - -public: - SvxJSearchOptionsDialog( Window *pParent, - const SfxItemSet& rOptionsSet, - sal_Int32 nInitialFlags ); - virtual ~SvxJSearchOptionsDialog(); - - // Window - virtual void Activate(); - - sal_Int32 GetTransliterationFlags() const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx deleted file mode 100644 index 56fb993ac..000000000 --- a/cui/source/inc/cuitabarea.hxx +++ /dev/null @@ -1,789 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_TAB_AREA_HXX -#define _CUI_TAB_AREA_HXX - -// include --------------------------------------------------------------- - -#include - -/************************************************************************* -|* -|* Fl"achen-Tab-Dialog -|* -\************************************************************************/ - -class SvxAreaTabDialog : public SfxTabDialog -{ -private: - SdrModel* mpDrawModel; - - XColorTable* mpColorTab; - XColorTable* mpNewColorTab; - XGradientList* mpGradientList; - XGradientList* mpNewGradientList; - XHatchList* mpHatchingList; - XHatchList* mpNewHatchingList; - XBitmapList* mpBitmapList; - XBitmapList* mpNewBitmapList; - - const SfxItemSet& mrOutAttrs; - - ChangeType mnColorTableState; - ChangeType mnBitmapListState; - ChangeType mnGradientListState; - ChangeType mnHatchingListState; - - sal_uInt16 mnPageType; - sal_uInt16 mnDlgType; - sal_uInt16 mnPos; - sal_Bool mbAreaTP; - sal_Bool mbDeleteColorTable; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -protected: - virtual short Ok(); -#ifdef _SVX_TABAREA_CXX - DECL_LINK( CancelHdlImpl, void * ); - void SavePalettes(); -#endif - -public: - SvxAreaTabDialog( Window* pParent, - const SfxItemSet* pAttr, SdrModel* pModel, - const SdrView* pSdrView = NULL ); - ~SvxAreaTabDialog(); - - void SetNewColorTable( XColorTable* pColTab ) - { mpNewColorTab = pColTab; } - XColorTable* GetNewColorTable() const { return mpNewColorTab; } - const XColorTable* GetColorTable() const { return mpColorTab; } - - void SetNewGradientList( XGradientList* pGrdLst) - { mpNewGradientList = pGrdLst; } - XGradientList* GetNewGradientList() const - { return mpNewGradientList; } - const XGradientList* GetGradientList() const { return mpGradientList; } - - void SetNewHatchingList( XHatchList* pHtchLst) - { mpNewHatchingList = pHtchLst; } - XHatchList* GetNewHatchingList() const - { return mpNewHatchingList; } - const XHatchList* GetHatchingList() const { return mpHatchingList; } - - void SetNewBitmapList( XBitmapList* pBmpLst) - { mpNewBitmapList = pBmpLst; } - XBitmapList* GetNewBitmapList() const { return mpNewBitmapList; } - const XBitmapList* GetBitmapList() const { return mpBitmapList; } - - void DontDeleteColorTable() { mbDeleteColorTable = sal_False; } -}; - -/************************************************************************* -|* -|* Transparence-Tab-Page -|* -\************************************************************************/ - -class SvxTransparenceTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - const SfxItemSet& rOutAttrs; - RECT_POINT eRP; - - sal_uInt16 nPageType; - sal_uInt16 nDlgType; - - // main selection - FixedLine aFlProp; - RadioButton aRbtTransOff; - RadioButton aRbtTransLinear; - RadioButton aRbtTransGradient; - - // linear transparency - MetricField aMtrTransparent; - - // gradient transparency - FixedText aFtTrgrType; - ListBox aLbTrgrGradientType; - FixedText aFtTrgrCenterX; - MetricField aMtrTrgrCenterX; - FixedText aFtTrgrCenterY; - MetricField aMtrTrgrCenterY; - FixedText aFtTrgrAngle; - MetricField aMtrTrgrAngle; - FixedText aFtTrgrBorder; - MetricField aMtrTrgrBorder; - FixedText aFtTrgrStartValue; - MetricField aMtrTrgrStartValue; - FixedText aFtTrgrEndValue; - MetricField aMtrTrgrEndValue; - - // preview - SvxXRectPreview aCtlBitmapPreview; - SvxXRectPreview aCtlXRectPreview; - sal_Bool bBitmap; - - XOutdevItemPool* pXPool; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - -#ifdef _SVX_TPAREA_CXX - DECL_LINK(ClickTransOffHdl_Impl, void * ); - DECL_LINK(ClickTransLinearHdl_Impl, void * ); - DECL_LINK(ClickTransGradientHdl_Impl, void * ); - DECL_LINK(ModifyTransparentHdl_Impl, void*); - DECL_LINK(ChangeTrgrTypeHdl_Impl, void*); - DECL_LINK(ModifiedTrgrHdl_Impl, void*); -#endif - - void ActivateLinear(sal_Bool bActivate); - void ActivateGradient(sal_Bool bActivate); - void SetControlState_Impl(XGradientStyle eXGS); - - sal_Bool InitPreview ( const SfxItemSet& rSet ); - void InvalidatePreview (sal_Bool bEnable = sal_True ); - -public: - SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs); - void Construct(); - - static SfxTabPage* Create(Window*, const SfxItemSet&); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet(SfxItemSet&); - virtual void Reset(const SfxItemSet&); - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet* pSet); - virtual void PointChanged(Window* pWindow, RECT_POINT eRP); - - void SetPageType(sal_uInt16 nInType) { nPageType = nInType; } - void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; } - virtual void PageCreated (SfxAllItemSet aSet); -}; - -/************************************************************************* -|* -|* Fl"achen-Tab-Page -|* -\************************************************************************/ - -class SvxAreaTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlProp; - ListBox aTypeLB; - - ColorLB aLbColor; - GradientLB aLbGradient; - HatchingLB aLbHatching; - BitmapLB aLbBitmap; - SvxXRectPreview aCtlBitmapPreview; - - TriStateBox aTsbStepCount; - FixedLine aFlStepCount; - NumericField aNumFldStepCount; - - CheckBox aCbxHatchBckgrd; - ColorLB aLbHatchBckgrdColor; - - FixedLine aFlSize; - TriStateBox aTsbOriginal; - TriStateBox aTsbScale; - FixedText aFtXSize; - MetricField aMtrFldXSize; - FixedText aFtYSize; - MetricField aMtrFldYSize; - FixedLine aFlPosition; - SvxRectCtl aCtlPosition; - FixedText aFtXOffset; - MetricField aMtrFldXOffset; - FixedText aFtYOffset; - MetricField aMtrFldYOffset; - TriStateBox aTsbTile; - TriStateBox aTsbStretch; - FixedLine aFlOffset; - RadioButton aRbtRow; - RadioButton aRbtColumn; - MetricField aMtrFldOffset; - - SvxXRectPreview aCtlXRectPreview; - - const SfxItemSet& rOutAttrs; - RECT_POINT eRP; - - XColorTable* pColorTab; - XGradientList* pGradientList; - XHatchList* pHatchingList; - XBitmapList* pBitmapList; - - ChangeType* pnColorTableState; - ChangeType* pnBitmapListState; - ChangeType* pnGradientListState; - ChangeType* pnHatchingListState; - - sal_uInt16 nPageType; - sal_uInt16 nDlgType; - sal_uInt16 nPos; - - sal_Bool* pbAreaTP; - - XOutdevItemPool* pXPool; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - - SfxMapUnit ePoolUnit; - FieldUnit eFUnit; - -#ifdef _SVX_TPAREA_CXX - DECL_LINK( SelectDialogTypeHdl_Impl, ListBox * ); - DECL_LINK( ClickInvisibleHdl_Impl, void * ); - DECL_LINK( ClickColorHdl_Impl, void * ); - DECL_LINK( ModifyColorHdl_Impl, void * ); - DECL_LINK( ModifyHatchBckgrdColorHdl_Impl, void * ); - DECL_LINK( ClickGradientHdl_Impl, void * ); - DECL_LINK( ModifyGradientHdl_Impl, void * ); - DECL_LINK( ClickHatchingHdl_Impl, void * ); - DECL_LINK( ModifyHatchingHdl_Impl, void * ); - DECL_LINK( ToggleHatchBckgrdColorHdl_Impl, void * ); - DECL_LINK( ClickBitmapHdl_Impl, void * ); - DECL_LINK( ModifyBitmapHdl_Impl, void * ); - DECL_LINK( ModifyStepCountHdl_Impl, void * ); - DECL_LINK( ModifyTileHdl_Impl, void * ); - DECL_LINK( ClickScaleHdl_Impl, void * ); -#endif - -public: - SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetGradientList( XGradientList* pGrdLst) - { pGradientList = pGrdLst; } - void SetHatchingList( XHatchList* pHtchLst) - { pHatchingList = pHtchLst; } - void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; } - - void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } - void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } - void SetPos( sal_uInt16 nInPos ) { nPos = nInPos; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - virtual void PageCreated (SfxAllItemSet aSet); - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; } - void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; } - void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; } -}; - -/************************************************************************* -|* -|* Schatten-Tab-Page -|* -\************************************************************************/ - -class SvxShadowTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlProp; - TriStateBox aTsbShowShadow; - FixedText aFtPosition; - SvxRectCtl aCtlPosition; - FixedText aFtDistance; - MetricField aMtrDistance; - FixedText aFtShadowColor; - ColorLB aLbShadowColor; - FixedText aFtTransparent; - MetricField aMtrTransparent; - SvxXShadowPreview aCtlXRectPreview; - - const SfxItemSet& rOutAttrs; - RECT_POINT eRP; - - XColorTable* pColorTab; - ChangeType* pnColorTableState; - sal_uInt16 nPageType; - sal_uInt16 nDlgType; - sal_uInt16* pPos; - sal_Bool* pbAreaTP; - - sal_Bool bDisable; - - XOutdevItemPool* pXPool; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - SfxMapUnit ePoolUnit; - -#ifdef _SVX_TPSHADOW_CXX - DECL_LINK( ClickShadowHdl_Impl, void * ); - DECL_LINK( ModifyShadowHdl_Impl, void * ); -#endif - -public: - SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } - void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - virtual void PageCreated (SfxAllItemSet aSet); - void DisablePage( sal_Bool bIn ) { bDisable = bIn; } -}; - -/************************************************************************* -|* -|* Farbverlauf-Tab-Page -|* -\************************************************************************/ - -class SvxGradientTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlProp; - FixedText aFtType; - ListBox aLbGradientType; - FixedText aFtCenterX; - MetricField aMtrCenterX; - FixedText aFtCenterY; - MetricField aMtrCenterY; - FixedText aFtAngle; - MetricField aMtrAngle; - FixedText aFtBorder; - MetricField aMtrBorder; - FixedText aFtColorFrom; - ColorLB aLbColorFrom; - MetricField aMtrColorFrom; - FixedText aFtColorTo; - ColorLB aLbColorTo; - MetricField aMtrColorTo; - GradientLB aLbGradients; - SvxXRectPreview aCtlPreview; - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - - const SfxItemSet& rOutAttrs; - - XColorTable* pColorTab; - XGradientList* pGradientList; - - ChangeType* pnGradientListState; - ChangeType* pnColorTableState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPos; - sal_Bool* pbAreaTP; - - XOutdevItemPool* pXPool; - XFillStyleItem aXFStyleItem; - XFillGradientItem aXGradientItem; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - -#ifdef _SVX_TPGRADNT_CXX - DECL_LINK( ClickAddHdl_Impl, void * ); - DECL_LINK( ClickModifyHdl_Impl, void * ); - DECL_LINK( ClickDeleteHdl_Impl, void * ); - DECL_LINK( ChangeGradientHdl_Impl, void * ); - DECL_LINK( ModifiedHdl_Impl, void * ); - DECL_LINK( ClickLoadHdl_Impl, void * ); - DECL_LINK( ClickSaveHdl_Impl, void * ); - - long CheckChanges_Impl(); - void SetControlState_Impl( XGradientStyle eXGS ); -#endif - -public: - SvxGradientTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetGradientList( XGradientList* pGrdLst) - { pGradientList = pGrdLst; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPos( sal_uInt16* pInPos ) { pPos = pInPos; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - - void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } -}; - -/************************************************************************* -|* -|* Schraffuren-Tab-Page -|* -\************************************************************************/ - -class SvxHatchTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedText aFtDistance; - MetricField aMtrDistance; - FixedText aFtAngle; - MetricField aMtrAngle; - SvxRectCtl aCtlAngle; - FixedLine aFlProp; - FixedText aFtLineType; - ListBox aLbLineType; - FixedText aFtLineColor; - ColorLB aLbLineColor; - HatchingLB aLbHatchings; - SvxXRectPreview aCtlPreview; - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - - const SfxItemSet& rOutAttrs; - RECT_POINT eRP; - - XColorTable* pColorTab; - XHatchList* pHatchingList; - - ChangeType* pnHatchingListState; - ChangeType* pnColorTableState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPos; - sal_Bool* pbAreaTP; - - XOutdevItemPool* pXPool; - XFillStyleItem aXFStyleItem; - XFillHatchItem aXHatchItem; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - - SfxMapUnit ePoolUnit; - -#ifdef _SVX_TPHATCH_CXX - DECL_LINK( ChangeHatchHdl_Impl, void * ); - DECL_LINK( ModifiedHdl_Impl, void * ); - DECL_LINK( ClickAddHdl_Impl, void * ); - DECL_LINK( ClickModifyHdl_Impl, void * ); - DECL_LINK( ClickDeleteHdl_Impl, void * ); - DECL_LINK( ClickLoadHdl_Impl, void * ); - DECL_LINK( ClickSaveHdl_Impl, void * ); - - long CheckChanges_Impl(); -#endif - -public: - SvxHatchTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetHatchingList( XHatchList* pHtchLst) - { pHatchingList = pHtchLst; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPos( sal_uInt16* pInPos ) { pPos = pInPos; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - - void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -/************************************************************************* -|* -|* Bitmap-Tab-Page -|* -\************************************************************************/ - -class SvxBitmapTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - SvxPixelCtl aCtlPixel; - FixedText aFtPixelEdit; - FixedText aFtColor; - ColorLB aLbColor; - FixedText aFtBackgroundColor; - ColorLB aLbBackgroundColor; - FixedText aLbBitmapsHidden; - BitmapLB aLbBitmaps; - FixedLine aFlProp; - SvxXRectPreview aCtlPreview; - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnImport; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - - SvxBitmapCtl aBitmapCtl; - - const SfxItemSet& rOutAttrs; - - XColorTable* pColorTab; - XBitmapList* pBitmapList; - - ChangeType* pnBitmapListState; - ChangeType* pnColorTableState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPos; - sal_Bool* pbAreaTP; - - sal_Bool bBmpChanged; - - XOutdevItemPool* pXPool; - XFillStyleItem aXFStyleItem; - XFillBitmapItem aXBitmapItem; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - -#ifdef _SVX_TPBITMAP_CXX - DECL_LINK( ClickAddHdl_Impl, void * ); - DECL_LINK( ClickImportHdl_Impl, void * ); - DECL_LINK( ClickModifyHdl_Impl, void * ); - DECL_LINK( ClickDeleteHdl_Impl, void * ); - DECL_LINK( ChangeBitmapHdl_Impl, void * ); - DECL_LINK( ChangePixelColorHdl_Impl, void * ); - DECL_LINK( ChangeBackgrndColorHdl_Impl, void * ); - DECL_LINK( ClickLoadHdl_Impl, void * ); - DECL_LINK( ClickSaveHdl_Impl, void * ); - - long CheckChanges_Impl(); -#endif - -public: - SvxBitmapTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetBitmapList( XBitmapList* pBmpLst) { pBitmapList = pBmpLst; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPos( sal_uInt16* pInPos ) { pPos = pInPos; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - - void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - - /** Return a label that is associated with the given control. This - label is used to the determine the name for the control. - @param pLabeled - The control for which to return a label. - @return - Return a label control that provides a name for the specified - control. - */ - virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; -}; - -/************************************************************************* -|* -|* Farben-Tab-Page -|* -\************************************************************************/ - -class SvxColorTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlProp; - FixedText aFtName; - Edit aEdtName; - FixedText aFtColor; - ColorLB aLbColor; - - FixedText aTableNameFT; - ValueSet aValSetColorTable; - - SvxXRectPreview aCtlPreviewOld; - SvxXRectPreview aCtlPreviewNew; - - ListBox aLbColorModel; - FixedText aFtColorModel1; - MetricField aMtrFldColorModel1; - FixedText aFtColorModel2; - MetricField aMtrFldColorModel2; - FixedText aFtColorModel3; - MetricField aMtrFldColorModel3; - - FixedText aFtColorModel4; - MetricField aMtrFldColorModel4; - - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnWorkOn; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - - const SfxItemSet& rOutAttrs; - - XColorTable* pColorTab; - - ChangeType* pnColorTableState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPos; - sal_Bool* pbAreaTP; - sal_Bool bDeleteColorTable; - - XOutdevItemPool* pXPool; - XFillStyleItem aXFStyleItem; - XFillColorItem aXFillColorItem; - XFillAttrSetItem aXFillAttr; - SfxItemSet& rXFSet; - - ColorModel eCM; - - Color aAktuellColor; - -#ifdef _SVX_TPCOLOR_CXX - void ConvertColorValues (Color& rColor, ColorModel eModell); - void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK ); - void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey ); - sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor ); - sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent ); - - void FillValueSet_Impl( ValueSet& rVs ); - //----------------------------------------------------------------------------------------------------- - DECL_LINK( ClickAddHdl_Impl, void * ); // Button 'Hinzufuegen' - DECL_LINK( ClickModifyHdl_Impl, void * ); // Button 'Aendern' - DECL_LINK( ClickDeleteHdl_Impl, void * ); // Button 'loeschen' - DECL_LINK( ClickWorkOnHdl_Impl, void * ); // Button 'Bearbeiten' - - DECL_LINK( SelectColorLBHdl_Impl, void * ); // Farbe aus Listbox ausw�hlen - DECL_LINK( SelectValSetHdl_Impl, void * ); // Farbe aus Farbpalette (links) ausw�hlen - DECL_LINK( SelectColorModelHdl_Impl, void * ); // Auswahl Listbox 'Farbmodell' - long ChangeColorHdl_Impl( void* p ); - DECL_LINK( ModifiedHdl_Impl, void * ); // Inhalt der Farbwerte-Felder wurde ver�ndert - DECL_LINK( ClickLoadHdl_Impl, void * ); // Button 'Farbtabelle laden' - DECL_LINK( ClickSaveHdl_Impl, void * ); // Button 'Farbtabelle sichern' - - long CheckChanges_Impl(); -#endif - -public: - SvxColorTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPos( sal_uInt16* pInPos ) { pPos = pInPos; } - void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - - void SetDeleteColorTable( sal_Bool bIn ) { bDeleteColorTable = bIn; } - - virtual void FillUserData(); -}; - -#endif // _CUI_TAB_AREA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx deleted file mode 100644 index 3952b9f3a..000000000 --- a/cui/source/inc/cuitabline.hxx +++ /dev/null @@ -1,434 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_TAB_LINE_HXX -#define _CUI_TAB_LINE_HXX - -// include --------------------------------------------------------------- -#include - -#include -/************************************************************************* -|* -|* Transform-Tab-Dialog -|* -\************************************************************************/ - -class SvxLineTabDialog : public SfxTabDialog -{ -private: - SdrModel* pDrawModel; - const SdrObject* pObj; - - const SfxItemSet& rOutAttrs; - - XColorTable* pColorTab; - XColorTable* mpNewColorTab; - XDashList* pDashList; - XDashList* pNewDashList; - XLineEndList* pLineEndList; - XLineEndList* pNewLineEndList; - sal_Bool bObjSelected; - - ChangeType nLineEndListState; - ChangeType nDashListState; - ChangeType mnColorTableState; - - sal_uInt16 nPageType; - sal_uInt16 nDlgType; - sal_uInt16 nPosDashLb; - sal_uInt16 nPosLineEndLb; - sal_uInt16 mnPos; - sal_Bool mbAreaTP; - sal_Bool mbDeleteColorTable; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -protected: - virtual short Ok(); -#ifdef _SVX_TABLINE_CXX - DECL_LINK( CancelHdlImpl, void * ); - void SavePalettes(); -#endif - -public: - SvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr, - SdrModel* pModel, const SdrObject* pObj = NULL, - sal_Bool bHasObj = sal_True ); - ~SvxLineTabDialog(); - - void SetNewDashList( XDashList* pInLst) - { pNewDashList = pInLst; } - XDashList* GetNewDashList() const { return pNewDashList; } - const XDashList* GetDashList() const { return pDashList; } - - void SetNewLineEndList( XLineEndList* pInLst) - { pNewLineEndList = pInLst; } - XLineEndList* GetNewLineEndList() const { return pNewLineEndList; } - const XLineEndList* GetLineEndList() const { return pLineEndList; } - - void SetNewColorTable( XColorTable* pColTab ) { mpNewColorTab = pColTab; } - XColorTable* GetNewColorTable() const { return mpNewColorTab; } - const XColorTable* GetColorTable() const { return pColorTab; } -}; - -/************************************************************************* -|* -|* Linien-Tab-Page -|* -\************************************************************************/ - -class SvxBmpItemInfo; -typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList; - -class SvxLineTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; -private: - FixedLine aFlLine; - FixedText aFtLineStyle; - LineLB aLbLineStyle; - FixedText aFtColor; - ColorLB aLbColor; - FixedText aFtLineWidth; - MetricField aMtrLineWidth; - FixedText aFtTransparent; - MetricField aMtrTransparent; - FixedLine aFlLineEnds; - LineEndLB aLbStartStyle; - MetricField aMtrStartWidth; - TriStateBox aTsbCenterStart; - FixedText aFtLineEndsStyle; - LineEndLB aLbEndStyle; - FixedText aFtLineEndsWidth; - MetricField aMtrEndWidth; - TriStateBox aTsbCenterEnd; - CheckBox aCbxSynchronize; - FixedLine aFLSeparator; - SvxXLinePreview aCtlPreview; - - // #116827# - FixedLine maFLEdgeStyle; - FixedText maFTEdgeStyle; - LineEndLB maLBEdgeStyle; - - //#58425# Symbole auf einer Linie (z.B. StarChart) -> - SdrObjList* pSymbolList; //a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview. The list position is to be used cyclic. - bool bNewSize; - Graphic aAutoSymbolGraphic; //a graphic to be displayed in the preview in case that an automatic symbol is choosen - long nNumMenuGalleryItems; - long nSymbolType; - SfxItemSet* pSymbolAttr; //attributes for the shown symbols; only necessary if not equal to line properties - FixedLine aFlSymbol; - MenuButton aSymbolMB; - FixedText aSymbolWidthFT; - MetricField aSymbolWidthMF; - FixedText aSymbolHeightFT; - MetricField aSymbolHeightMF; - CheckBox aSymbolRatioCB; - std::vector aGrfNames; - SvxBmpItemInfoList aGrfBrushItems; - String sNumCharFmtName; - sal_Bool bLastWidthModified; - Size aSymbolLastSize; - Graphic aSymbolGraphic; - Size aSymbolSize; - sal_Bool bSymbols; - - const SfxItemSet& rOutAttrs; - RECT_POINT eRP; - sal_Bool bObjSelected; - - XOutdevItemPool* pXPool; - XLineStyleItem aXLStyle; - XLineWidthItem aXWidth; - XLineDashItem aXDash; - XLineColorItem aXColor; - XLineAttrSetItem aXLineAttr; - SfxItemSet& rXLSet; - - XColorTable* pColorTab; - XDashList* pDashList; - XLineEndList* pLineEndList; - - ChangeType* pnLineEndListState; - ChangeType* pnDashListState; - ChangeType* pnColorTableState; - sal_uInt16 nPageType; - sal_uInt16 nDlgType; - sal_uInt16* pPosDashLb; - sal_uInt16* pPosLineEndLb; - - SfxMapUnit ePoolUnit; - - // #63083# - sal_Int32 nActLineWidth; - - //Handler f�r Gallery-Popup-Menue-Button + Size - DECL_LINK( GraphicHdl_Impl, MenuButton * ); - DECL_LINK( MenuCreateHdl_Impl, MenuButton * ); - DECL_STATIC_LINK( SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* ); - DECL_LINK( SizeHdl_Impl, MetricField * ); - DECL_LINK( RatioHdl_Impl, CheckBox * ); - -#ifdef _SVX_TPLINE_CXX - DECL_LINK( ClickInvisibleHdl_Impl, void * ); - DECL_LINK( ChangeStartHdl_Impl, void * ); - DECL_LINK( ChangeEndHdl_Impl, void * ); - DECL_LINK( ChangePreviewHdl_Impl, void * ); - DECL_LINK( ChangeTransparentHdl_Impl, void * ); - - // #116827# - DECL_LINK( ChangeEdgeStyleHdl_Impl, void * ); - - sal_Bool FillXLSet_Impl(); -#endif - - void FillListboxes(); -public: - - void ShowSymbolControls(sal_Bool bOn); - - SvxLineTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - virtual ~SvxLineTabPage(); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet& ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - virtual void FillUserData(); - - void SetColorTable( XColorTable* pColTab ) { pColorTab = pColTab; } - void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; } - void SetLineEndList( XLineEndList* pLneEndLst) { pLineEndList = pLneEndLst; } - void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } - - void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } - void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } - void SetPosDashLb( sal_uInt16* pInPos ) { pPosDashLb = pInPos; } - void SetPosLineEndLb( sal_uInt16* pInPos ) { pPosLineEndLb = pInPos; } - - void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; } - void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } - - virtual void PageCreated (SfxAllItemSet aSet); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -/************************************************************************* -|* -|* Linien-Definitions-Tab-Page -|* -\************************************************************************/ - -class SvxLineDefTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; -private: - FixedLine aFlDefinition; - FixedText aFTLinestyle; - LineLB aLbLineStyles; - FixedText aFtType; - ListBox aLbType1; - ListBox aLbType2; - FixedText aFtNumber; - NumericField aNumFldNumber1; - NumericField aNumFldNumber2; - FixedText aFtLength; - MetricField aMtrLength1; - MetricField aMtrLength2; - FixedText aFtDistance; - MetricField aMtrDistance; - CheckBox aCbxSynchronize; - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - SvxXLinePreview aCtlPreview; - - const SfxItemSet& rOutAttrs; - XDash aDash; - sal_Bool bObjSelected; - - XOutdevItemPool* pXPool; - XLineStyleItem aXLStyle; - XLineWidthItem aXWidth; - XLineDashItem aXDash; - XLineColorItem aXColor; - XLineAttrSetItem aXLineAttr; - SfxItemSet& rXLSet; - - XDashList* pDashList; - - ChangeType* pnDashListState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPosDashLb; - - SfxMapUnit ePoolUnit; - FieldUnit eFUnit; - -#ifdef _SVX_TPLNEDEF_CXX - void FillDash_Impl(); - void FillDialog_Impl(); - - DECL_LINK( ClickAddHdl_Impl, void * ); - DECL_LINK( ClickModifyHdl_Impl, void * ); - DECL_LINK( ClickDeleteHdl_Impl, void * ); - DECL_LINK( SelectLinestyleHdl_Impl, void * ); - DECL_LINK( ChangePreviewHdl_Impl, void * ); - DECL_LINK( ChangeNumber1Hdl_Impl, void * ); - DECL_LINK( ChangeNumber2Hdl_Impl, void * ); - DECL_LINK( ClickLoadHdl_Impl, void * ); - DECL_LINK( ClickSaveHdl_Impl, void * ); - DECL_LINK( ChangeMetricHdl_Impl, void * ); - DECL_LINK( SelectTypeHdl_Impl, void * ); - - void CheckChanges_Impl(); -#endif - -public: - SvxLineDefTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - void SetDashList( XDashList* pDshLst ) { pDashList = pDshLst; } - void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPosDashLb( sal_uInt16* pInPos ) { pPosDashLb = pInPos; } - - void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; } - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -/************************************************************************* -|* -|* Linienenden-Definitions-Tab-Page -|* -\************************************************************************/ - -class SvxLineEndDefTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlTip; - FixedText aFTTitle; - Edit aEdtName; - FixedText aFTLineEndStyle; - LineEndLB aLbLineEnds; - PushButton aBtnAdd; - PushButton aBtnModify; - PushButton aBtnDelete; - ImageButton aBtnLoad; - ImageButton aBtnSave; - FixedInfo aFiTip; - SvxXLinePreview aCtlPreview; - - const SfxItemSet& rOutAttrs; - const SdrObject* pPolyObj; - sal_Bool bObjSelected; - - XOutdevItemPool* pXPool; - XLineStyleItem aXLStyle; - XLineWidthItem aXWidth; - XLineColorItem aXColor; - XLineAttrSetItem aXLineAttr; - SfxItemSet& rXLSet; - - XLineEndList* pLineEndList; - - ChangeType* pnLineEndListState; - sal_uInt16* pPageType; - sal_uInt16* pDlgType; - sal_uInt16* pPosLineEndLb; - -#ifdef _SVX_TPLNEEND_CXX - DECL_LINK( ClickAddHdl_Impl, void * ); - DECL_LINK( ClickModifyHdl_Impl, void * ); - DECL_LINK( ClickDeleteHdl_Impl, void * ); - DECL_LINK( ClickLoadHdl_Impl, void * ); - DECL_LINK( ClickSaveHdl_Impl, void * ); - DECL_LINK( SelectLineEndHdl_Impl, void * ); - long ChangePreviewHdl_Impl( void* p ); - - void CheckChanges_Impl(); -#endif - -public: - SvxLineEndDefTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - ~SvxLineEndDefTabPage(); - - void Construct(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - void SetLineEndList( XLineEndList* pInList ) { pLineEndList = pInList; } - void SetPolyObj( const SdrObject* pObj ) { pPolyObj = pObj; } - void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } - - void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } - void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } - void SetPosLineEndLb( sal_uInt16* pInPos ) { pPosLineEndLb = pInPos; } - - void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; } - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -#endif // _CUI_TAB_LINE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/cuitbxform.hxx b/cui/source/inc/cuitbxform.hxx deleted file mode 100644 index ff6381487..000000000 --- a/cui/source/inc/cuitbxform.hxx +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#ifndef _CUI_TBXFORM_HXX -#define _CUI_TBXFORM_HXX - -#include -#include -#include - -#include - -//======================================================================== - -class FmInputRecordNoDialog : public ModalDialog -{ -public: - FixedText m_aLabel; - NumericField m_aRecordNo; - OKButton m_aOk; - CancelButton m_aCancel; - -public: - FmInputRecordNoDialog(Window * pParent); - - void SetValue(long dNew) { m_aRecordNo.SetValue(dNew); } - long GetValue() const { return static_cast(m_aRecordNo.GetValue()); } -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx deleted file mode 100644 index af175113d..000000000 --- a/cui/source/inc/dbregister.hxx +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_DBREGISTER_HXX -#define SVX_DBREGISTER_HXX - -#include "optpath.hxx" -#include -#include -#include -#include "ControlFocusHelper.hxx" -#include - -class SvLBoxEntry; -namespace svx -{ - class OptHeaderTabListBox; -} -//........................................................................ -namespace svx -{ -//........................................................................ - - //==================================================================== - //= DbRegistrationOptionsPage - //==================================================================== - class DbRegistrationOptionsPage : public SfxTabPage - { - private: - FixedLine aStdBox; - FixedText aTypeText; - FixedText aPathText; - SvxControlFocusHelper aPathCtrl; - PushButton m_aNew; - PushButton m_aEdit; - PushButton m_aDelete; - - HeaderBar* pHeaderBar; - ::svx::OptHeaderTabListBox* pPathBox; - SvLBoxEntry* m_pCurEntry; - sal_uLong m_nOldCount; - sal_Bool m_bModified; - -#ifdef SVX_DBREGISTER_HXX - DECL_LINK( NewHdl, void * ); - DECL_LINK( EditHdl, void * ); - DECL_LINK( DeleteHdl, void * ); - - DECL_LINK( PathSelect_Impl, SvTabListBox* ); - - DECL_LINK( HeaderSelect_Impl, HeaderBar * ); - DECL_LINK( HeaderEndDrag_Impl, HeaderBar * ); - DECL_LINK( NameValidator, String*); - - - /** inserts a new entry in the tablistbox - @param _sName - The name of the entry. - @param _sLocation - The location of the file. - */ - void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly ); - - /** opens the LinkDialog to create a register pair - @param _sOldName - The old name of the entry may be empty. - @param _sOldLocation - The old location of the entry may be empty. - @param _pEntry - The entry to remove if the entry will be changed - */ - void openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry = NULL); - -#endif - - public: - DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~DbRegistrationOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); - }; - - //==================================================================== - //= RegistrationItemSetHolder - //==================================================================== - /** helper for DatabaseRegistrationDialog - - Necessary so that DatabaseRegistrationDialog is self-contained, i.e. always reflects - the current registration state. - */ - class RegistrationItemSetHolder - { - private: - SfxItemSet m_aRegistrationItems; - - protected: - RegistrationItemSetHolder( const SfxItemSet& _rMasterSet ); - ~RegistrationItemSetHolder(); - - protected: - const SfxItemSet& getRegistrationItems() const { return m_aRegistrationItems; } - }; - - //==================================================================== - //= DatabaseRegistrationDialog - //==================================================================== - class DatabaseRegistrationDialog :public RegistrationItemSetHolder - ,public SfxSingleTabDialog - { - public: - DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rAttr ); - ~DatabaseRegistrationDialog(); - - virtual short Execute(); - }; - -//........................................................................ -} // namespace svx -//........................................................................ - -#endif // SVX_DBREGISTER_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/defdlgname.hxx b/cui/source/inc/defdlgname.hxx deleted file mode 100644 index b1f318c4f..000000000 --- a/cui/source/inc/defdlgname.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_DEF_DLG_NAME_HXX -#define _SVX_DEF_DLG_NAME_HXX - -// define ---------------------------------------------------------------- - -#define MESS_BTN_1 ((sal_uInt16)0) -#define MESS_BTN_2 ((sal_uInt16)1) - -// const ----------------------------------------------------------------- - -const short RET_BTN_1 = 100; -const short RET_BTN_2 = 101; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/dialmgr.hxx b/cui/source/inc/dialmgr.hxx deleted file mode 100644 index 508138515..000000000 --- a/cui/source/inc/dialmgr.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_DIALMGR_HXX -#define _CUI_DIALMGR_HXX - -// include --------------------------------------------------------------- - -#include - -// forward --------------------------------------------------------------- - -#define CUI_MGR() (*CuiResMgr::GetResMgr()) -#define CUI_RES(i) ResId(i,CUI_MGR()) -#define CUI_RESSTR(i) UniString(ResId(i,CUI_MGR())) -#define CUI_RESSSTR(i) String(ResId(i,CUI_MGR())) - -class ResMgr; -struct CuiResMgr -{ - static ResMgr* GetResMgr(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx deleted file mode 100644 index 426266710..000000000 --- a/cui/source/inc/dlgname.hxx +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_DLG_NAME_HXX -#define _SVX_DLG_NAME_HXX - - -#include -#include -#include -#include - -// #i68101# -#include - -/************************************************************************* -|* -|* Dialog zum Editieren eines Namens -|* -\************************************************************************/ -class SvxNameDialog : public ModalDialog -{ -private: - FixedText aFtDescription; - Edit aEdtName; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - Link aCheckNameHdl; -#if _SOLAR__PRIVATE - DECL_LINK(ModifyHdl, Edit*); -#endif - -public: - SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc ); - - void GetName( String& rName ){rName = aEdtName.GetText();} - - /** add a callback Link that is called whenever the content of the edit - field is changed. The Link result determines wether the OK - Button is enabled (> 0) or disabled (== 0). - - @param rLink a Callback declared with DECL_LINK and implemented with - IMPL_LINK, that is executed on modification. - - @param bCheckImmediately If true, the Link is called directly after - setting it. It is recommended to set this flag to true to avoid - an inconsistent state if the initial String (given in the CTOR) - does not satisfy the check condition. - - @todo Remove the parameter bCheckImmediately and incorporate the 'true' - behaviour as default. - */ - void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false ) - { - aCheckNameHdl = rLink; - if ( bCheckImmediately ) - aBtnOK.Enable( rLink.Call( this ) > 0 ); - } - - void SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);} -}; - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Title and Description -// plus uniqueness-callback-linkHandler - -class SvxObjectNameDialog : public ModalDialog -{ -private: - // name - FixedText aFtName; - Edit aEdtName; - - // separator - FixedLine aFlSeparator; - - // buttons - HelpButton aBtnHelp; - OKButton aBtnOK; - CancelButton aBtnCancel; - - // callback link for name uniqueness - Link aCheckNameHdl; -#if _SOLAR__PRIVATE - DECL_LINK(ModifyHdl, Edit*); -#endif - -public: - // constructor - SvxObjectNameDialog(Window* pWindow, const String& rName); - - // data access - void GetName(String& rName) {rName = aEdtName.GetText(); } - - // set handler - void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false) - { - aCheckNameHdl = rLink; - - if(bCheckImmediately) - { - aBtnOK.Enable(rLink.Call(this) > 0); - } - } -}; - -/////////////////////////////////////////////////////////////////////////////////////////////// -// #i68101# -// Dialog for editing Object Title and Description - -class SvxObjectTitleDescDialog : public ModalDialog -{ -private: - // title - FixedText aFtTitle; - Edit aEdtTitle; - - // description - FixedText aFtDescription; - MultiLineEdit aEdtDescription; - - // separator - FixedLine aFlSeparator; - - // buttons - HelpButton aBtnHelp; - OKButton aBtnOK; - CancelButton aBtnCancel; - -public: - // constructor - SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc); - - // data access - void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); } - void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); } -}; - -/////////////////////////////////////////////////////////////////////////////////////////////// - -/************************************************************************* -|* -|* Dialog zum Abbrechen, Speichern oder Hinzufuegen -|* -\************************************************************************/ -class SvxMessDialog : public ModalDialog -{ -private: - FixedText aFtDescription; - PushButton aBtn1; - PushButton aBtn2; - CancelButton aBtnCancel; - FixedImage aFtImage; - Image* pImage; -#if _SOLAR__PRIVATE - DECL_LINK( Button1Hdl, Button * ); - DECL_LINK( Button2Hdl, Button * ); -#endif -public: - SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL ); - ~SvxMessDialog(); - - void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt ); -}; - - - -#endif // _SVX_DLG_NAME_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/dstribut.hxx b/cui/source/inc/dstribut.hxx deleted file mode 100644 index 66a1ce233..000000000 --- a/cui/source/inc/dstribut.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_DSTRIBUT_HXX -#define _SVX_DSTRIBUT_HXX - -#include -#include -#include -#include - -/************************************************************************* -|* -\************************************************************************/ - -class SvxDistributePage : public SvxTabPage -{ - SvxDistributeHorizontal meDistributeHor; - SvxDistributeVertical meDistributeVer; - - FixedLine maFlHorizontal ; - RadioButton maBtnHorNone ; - RadioButton maBtnHorLeft ; - RadioButton maBtnHorCenter ; - RadioButton maBtnHorDistance ; - RadioButton maBtnHorRight ; - FixedImage maHorLow ; - FixedImage maHorCenter ; - FixedImage maHorDistance ; - FixedImage maHorHigh ; - FixedLine maFlVertical ; - RadioButton maBtnVerNone ; - RadioButton maBtnVerTop ; - RadioButton maBtnVerCenter ; - RadioButton maBtnVerDistance ; - RadioButton maBtnVerBottom ; - FixedImage maVerLow ; - FixedImage maVerCenter ; - FixedImage maVerDistance ; - FixedImage maVerHigh ; - -public: - SvxDistributePage(Window* pWindow, const SfxItemSet& rInAttrs, - SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone, - SvxDistributeVertical eVer = SvxDistributeVerticalNone); - ~SvxDistributePage(); - - static SfxTabPage* Create(Window*, const SfxItemSet&, - SvxDistributeHorizontal eHor, SvxDistributeVertical eVer); - static sal_uInt16* GetRanges(); - virtual sal_Bool FillItemSet(SfxItemSet&); - virtual void Reset(const SfxItemSet&); - virtual void PointChanged(Window* pWindow, RECT_POINT eRP); - - SvxDistributeHorizontal GetDistributeHor() const { return meDistributeHor; } - SvxDistributeVertical GetDistributeVer() const { return meDistributeVer; } -}; - -/************************************************************************* -|* -\************************************************************************/ - -class SvxDistributeDialog : public SfxSingleTabDialog -{ - SvxDistributePage* mpPage; - -public: - SvxDistributeDialog(Window* pParent, const SfxItemSet& rAttr, - SvxDistributeHorizontal eHor = SvxDistributeHorizontalNone, - SvxDistributeVertical eVer = SvxDistributeVerticalNone); - ~SvxDistributeDialog(); - - SvxDistributeHorizontal GetDistributeHor() const { return mpPage->GetDistributeHor(); } - SvxDistributeVertical GetDistributeVer() const { return mpPage->GetDistributeVer(); } -}; - - -#endif // _SVX_DSTRIBUT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/gallery.hrc b/cui/source/inc/gallery.hrc deleted file mode 100644 index 651cdb375..000000000 --- a/cui/source/inc/gallery.hrc +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -// Gallery-TabDialoge/-TabPages -#define RID_SVXTABDLG_GALLERY (RID_CUI_GALLERY_START ) -#define RID_SVXTABDLG_GALLERYTHEME (RID_CUI_GALLERY_START + 2) -#define RID_SVXDLG_GALLERY_TITLE (RID_CUI_GALLERY_START + 82) - -#define RID_SVXTABPAGE_GALLERY_GENERAL (RID_CUI_GALLERY_START + 1) -#define RID_SVXTABPAGE_GALLERYTHEME_FILES (RID_CUI_GALLERY_START + 4) - -// Dialoge -#define RID_SVXDLG_GALLERY_SEARCH_PROGRESS (RID_CUI_GALLERY_START + 6) -#define RID_SVXDLG_GALLERY_TAKE_PROGRESS (RID_CUI_GALLERY_START + 7) -#define RID_SVXDLG_GALLERY_ACTUALIZE_PROGRESS (RID_CUI_GALLERY_START + 8) -#define RID_SVXDLG_GALLERY_THEMEID (RID_CUI_GALLERY_START + 9) - -// Gallery-Strings -#define RID_SVXSTR_GALLERY_NOFILES (RID_CUI_GALLERY_START + 12) -#define RID_SVXSTR_GALLERY_SEARCH (RID_CUI_GALLERY_START + 30) -#define RID_SVXSTR_GALLERYPROPS_OBJECT (RID_CUI_GALLERY_START + 39) -#define RID_SVXSTR_GALLERY_READONLY (RID_CUI_GALLERY_START + 43) -#define RID_SVXSTR_GALLERY_ALLFILES (RID_CUI_GALLERY_START + 44) -#define RID_SVXSTR_GALLERY_ID_EXISTS (RID_CUI_GALLERY_START + 81) - -// Images -#define RID_SVXBMP_THEME_NORMAL_BIG (RID_CUI_GALLERY_START + 49) -#define RID_SVXBMP_THEME_IMPORTED_BIG (RID_CUI_GALLERY_START + 51) -#define RID_SVXBMP_THEME_READONLY_BIG (RID_CUI_GALLERY_START + 53) -#define RID_SVXBMP_THEME_DEFAULT_BIG (RID_CUI_GALLERY_START + 55) - -// lokale Defines -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -#define LBX_FOUND 1 -#define BTN_TAKE 5 -#define BTN_SEARCH 4 -#define CBX_PREVIEW 3 -#define FT_FILETYPE 2 -#define CBB_FILETYPE 1 -#define FL_SEARCH_DIR 1 -#define FL_SEARCH_TYPE 2 -#define FT_SEARCH_DIR 1 -#define FT_SEARCH_TYPE 2 -#define FL_TAKE_PROGRESS 1 -#define FT_TAKE_FILE 1 -#define BTN_TAKEALL 1 -#define WND_BRSPRV 1 -#define BTN_MADDIN1 8 -#define BTN_MADDIN2 9 - -#define FL_ACTUALIZE_PROGRESS 1 -#define FT_ACTUALIZE_FILE 1 -#define FL_ID 1 -#define LB_RESNAME 1 -#define EDT_TITLE 20 -#define FL_TITLE 21 - -// Gallery-TabDialog -#define FI_MS_IMAGE 1 -#define EDT_MS_NAME 1 -#define FL_MS_GENERAL_FIRST 1 -#define FT_MS_TYPE 2 -#define FT_MS_SHOW_TYPE 3 -#define FT_MS_PATH 4 -#define FT_MS_SHOW_PATH 5 -#define FT_MS_CONTENT 6 -#define FT_MS_SHOW_CONTENT 7 -#define FL_MS_GENERAL_SECOND 2 -#define FT_MS_CHANGEDATE 10 -#define FT_MS_SHOW_CHANGEDATE 11 - - diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx deleted file mode 100644 index 2dad974a4..000000000 --- a/cui/source/inc/grfpage.hxx +++ /dev/null @@ -1,137 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_GRFPAGE_HXX -#define _SVX_GRFPAGE_HXX - -#include -#include -#include -#include -#include - - -class SvxGrfCropPage : public SfxTabPage -{ - using Window::CalcZoom; - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - class SvxCropExample : public Window - { - Size aFrameSize; - Point aTopLeft, aBottomRight; - Graphic aGrf; - - public: - SvxCropExample( Window* pPar, const ResId& rResId ); - - virtual void Paint( const Rectangle& rRect ); - - void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; } - void SetTop( long nVal ) { aTopLeft.X() = nVal; } - void SetBottom( long nVal ) { aBottomRight.X() = nVal; } - void SetLeft( long nVal ) { aTopLeft.Y() = nVal; } - void SetRight( long nVal) { aBottomRight.Y() = nVal; } - void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; } - void SetFrameSize( const Size& rSz ); - void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; } - const Graphic& GetGraphic() const { return aGrf; } - }; - - FixedLine aCropFL; - RadioButton aZoomConstRB; - RadioButton aSizeConstRB; - FixedText aLeftFT; - MetricField aLeftMF; - FixedText aRightFT; - MetricField aRightMF; - FixedText aTopFT; - MetricField aTopMF; - FixedText aBottomFT; - MetricField aBottomMF; - - FixedLine aZoomFL; - FixedText aWidthZoomFT; - MetricField aWidthZoomMF; - FixedText aHeightZoomFT; - MetricField aHeightZoomMF; - - FixedLine aSizeFL; - FixedText aWidthFT; - MetricField aWidthMF; - FixedText aHeightFT; - MetricField aHeightMF; - FixedText aOrigSizeFT; - PushButton aOrigSizePB; - - // Example - SvxCropExample aExampleWN; - - - Timer aTimer; - String aGraphicName; - Size aOrigSize; - Size aPageSize; - const MetricField* pLastCropField; - long nOldWidth; - long nOldHeight; - sal_Bool bReset; - sal_Bool bInitialized; - sal_Bool bSetOrigSize; - - - SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet ); - virtual ~SvxGrfCropPage(); - - DECL_LINK( ZoomHdl, MetricField * ); - DECL_LINK( SizeHdl, MetricField * ); - DECL_LINK( CropHdl, const MetricField * ); - DECL_LINK( CropLoseFocusHdl, MetricField * ); - DECL_LINK( CropModifyHdl, MetricField * ); - DECL_LINK( OrigSizeHdl, PushButton * ); - DECL_LINK( Timeout, Timer * ); - - void CalcZoom(); - void CalcMinMaxBorder(); - void GraphicHasChanged(sal_Bool bFound); - virtual void ActivatePage(const SfxItemSet& rSet); - - Size GetGrfOrigSize( const Graphic& ) const; -public: - static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet ); - - virtual sal_Bool FillItemSet( SfxItemSet &rSet ); - virtual void Reset( const SfxItemSet &rSet ); - virtual int DeactivatePage( SfxItemSet *pSet ); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx deleted file mode 100644 index 6d67efdd8..000000000 --- a/cui/source/inc/hangulhanjadlg.hxx +++ /dev/null @@ -1,350 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_HANGUL_HANJA_DLG_HXX -#define SVX_HANGUL_HANJA_DLG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include // for auto_ptr - -class SvxCommonLinguisticControl; -//............................................................................. -namespace svx -{ -//............................................................................. - - //========================================================================= - //= HangulHanjaConversionDialog - //========================================================================= - - class SuggestionSet : public ValueSet - { - public: - SuggestionSet( Window* pParent ); - virtual ~SuggestionSet(); - - virtual void UserDraw( const UserDrawEvent& rUDEvt ); - void ClearSet(); - }; - - class SuggestionDisplay : public Control - { - public: - SuggestionDisplay( Window* pParent, const ResId& rResId ); - virtual ~SuggestionDisplay(); - - void DisplayListBox( bool bDisplayListBox ); - - void SetSelectHdl( const Link& rLink ); - - void Clear(); - void InsertEntry( const XubString& rStr ); - void SelectEntryPos( sal_uInt16 nPos ); - - sal_uInt16 GetEntryCount() const; - - XubString GetEntry( sal_uInt16 nPos ) const; - XubString GetSelectEntry() const; - - virtual void StateChanged( StateChangedType nStateChange ); - - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void KeyUp( const KeyEvent& rKEvt ); - virtual void Activate(); - virtual void Deactivate(); - virtual void GetFocus(); - virtual void LoseFocus(); - virtual void Command( const CommandEvent& rCEvt ); - - DECL_LINK( SelectSuggestionHdl, Control* ); - - void SetHelpIds(); - - private: - void implUpdateDisplay(); - Control& implGetCurrentControl(); - - private: - bool m_bDisplayListBox;//otherwise ValueSet - SuggestionSet m_aValueSet; - ListBox m_aListBox; - - Link m_aSelectLink; - bool m_bInSelectionUpdate; - }; - - class HangulHanjaConversionDialog : public ModalDialog - { - private: - ::std::auto_ptr< SvxCommonLinguisticControl > - m_pPlayground; // order matters: before all other controls! - - PushButton m_aFind; - SuggestionDisplay m_aSuggestions; - FixedText m_aFormat; - RadioButton m_aSimpleConversion; - RadioButton m_aHangulBracketed; - RadioButton m_aHanjaBracketed; - ::std::auto_ptr< RadioButton > m_pHanjaAbove; - ::std::auto_ptr< RadioButton > m_pHanjaBelow; - ::std::auto_ptr< RadioButton > m_pHangulAbove; - ::std::auto_ptr< RadioButton > m_pHangulBelow; - FixedText m_aConversion; - CheckBox m_aHangulOnly; - CheckBox m_aHanjaOnly; - CheckBox m_aReplaceByChar; - - CheckBox* m_pIgnoreNonPrimary; - bool m_bDocumentMode; - // are we working for a document? This is normally true, but in case - // the user uses the "find" functionality, we switch to working - // with what the user entered, which then does not have any relation to - // the document anymore. Some functionality must be disabled then - - Link m_aOptionsChangedLink; - Link m_aClickByCharacterLink; - - public: - HangulHanjaConversionDialog( - Window* _pParent, - editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ); - ~HangulHanjaConversionDialog( ); - - public: - void SetOptionsChangedHdl( const Link& _rHdl ); - void SetIgnoreHdl( const Link& _rHdl ); - void SetIgnoreAllHdl( const Link& _rHdl ); - void SetChangeHdl( const Link& _rHdl ); - void SetChangeAllHdl( const Link& _rHdl ); - - void SetClickByCharacterHdl( const Link& _rHdl ); - void SetConversionFormatChangedHdl( const Link& _rHdl ); - void SetFindHdl( const Link& _rHdl ); - - String GetCurrentString( ) const; - void SetCurrentString( - const String& _rNewString, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions, - bool _bOriginatesFromDocument = true - ); - - void FocusSuggestion( ); - - // retrieves the current suggestion - String GetCurrentSuggestion( ) const; - - void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ); - editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const; - - void SetByCharacter( sal_Bool _bByCharacter ); - void SetConversionDirectionState( sal_Bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ); - - // should text which does not match the primary conversion direction be ignored? - sal_Bool GetUseBothDirections( ) const; - - // get current conversion direction to use - // (return argument if GetUseBothDirections is true) - editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection eDefaultDirection ) const; - - // enables or disbales the checkboxes for ruby formatted replacements - void EnableRubySupport( sal_Bool bVal ); - - private: - DECL_LINK( OnClose, void* ); - DECL_LINK( OnOption, void* ); - DECL_LINK( OnSuggestionModified, void* ); - DECL_LINK( OnSuggestionSelected, void* ); - DECL_LINK( OnConversionDirectionClicked, CheckBox* ); - DECL_LINK( ClickByCharacterHdl, CheckBox* ); - - // fill the suggestion list box with suggestions for the actual input - void FillSuggestions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rSuggestions ); - }; - - - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary > > HHDictList; - - class HangulHanjaOptionsDialog : public ModalDialog - { - private: - FixedText m_aUserdefdictFT; - SvxCheckListBox m_aDictsLB; - FixedLine m_aOptionsFL; - CheckBox m_aIgnorepostCB; - CheckBox m_aShowrecentlyfirstCB; - CheckBox m_aAutoreplaceuniqueCB; - PushButton m_aNewPB; - PushButton m_aEditPB; - PushButton m_aDeletePB; - OKButton m_aOkPB; - CancelButton m_aCancelPB; - HelpButton m_aHelpPB; - - SvLBoxButtonData* m_pCheckButtonData; - - HHDictList m_aDictList; - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionaryList > m_xConversionDictionaryList; - - DECL_LINK( OkHdl, void* ); - DECL_LINK( OnNew, void* ); - DECL_LINK( OnEdit, void* ); - DECL_LINK( OnDelete, void* ); - DECL_LINK( DictsLB_SelectHdl, void* ); - DECL_LINK( NewDictHdl, void* ); - DECL_LINK( EditDictHdl, void* ); - DECL_LINK( DeleteDictHdl, void* ); - - void Init( void ); // reads settings from core and init controls - public: - HangulHanjaOptionsDialog( Window* _pParent ); - virtual ~HangulHanjaOptionsDialog(); - - void AddDict( const String& _rName, bool _bChecked ); - }; - - - class HangulHanjaNewDictDialog : public ModalDialog - { - private: - FixedLine m_aNewDictFL; - FixedText m_aDictNameFT; - Edit m_aDictNameED; - OKButton m_aOkBtn; - CancelButton m_aCancelBtn; - HelpButton m_aHelpBtn; - - bool m_bEntered; - - DECL_LINK( OKHdl, void* ); - DECL_LINK( ModifyHdl, void* ); - protected: - public: - HangulHanjaNewDictDialog( Window* _pParent ); - virtual ~HangulHanjaNewDictDialog(); - - bool GetName( String& _rRetName ) const; - }; - - - class SuggestionList; - - class SuggestionEdit : public Edit - { - private: - SuggestionEdit* m_pPrev; - SuggestionEdit* m_pNext; - ScrollBar& m_rScrollBar; - - bool ShouldScroll( bool _bUp ) const; - void DoJump( bool _bUp ); - public: - SuggestionEdit( Window* pParent, const ResId& rResId, - ScrollBar& _rScrollBar, - SuggestionEdit* _pPrev, SuggestionEdit* _pNext ); - virtual ~SuggestionEdit(); - virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - - class HangulHanjaEditDictDialog : public ModalDialog - { - private: - const String m_aEditHintText; - HHDictList& m_rDictList; - sal_uInt32 m_nCurrentDict; - - String m_aOriginal; - SuggestionList* m_pSuggestions; - - FixedText m_aBookFT; - ListBox m_aBookLB; - FixedText m_aOriginalFT; - ComboBox m_aOriginalLB; - FixedText m_aSuggestionsFT; - SuggestionEdit m_aEdit1; - SuggestionEdit m_aEdit2; - SuggestionEdit m_aEdit3; - SuggestionEdit m_aEdit4; - ScrollBar m_aScrollSB; - PushButton m_aNewPB; - PushButton m_aDeletePB; - HelpButton m_aHelpPB; - CancelButton m_aClosePB; - - sal_uInt16 m_nTopPos; - bool m_bModifiedSuggestions; - bool m_bModifiedOriginal; - - DECL_LINK( OriginalModifyHdl, void* ); - DECL_LINK( ScrollHdl, void* ); - DECL_LINK( EditModifyHdl1, Edit* ); - DECL_LINK( EditModifyHdl2, Edit* ); - DECL_LINK( EditModifyHdl3, Edit* ); - DECL_LINK( EditModifyHdl4, Edit* ); - - DECL_LINK( BookLBSelectHdl, void* ); - DECL_LINK( NewPBPushHdl, void* ); - DECL_LINK( DeletePBPushHdl, void* ); - - void InitEditDictDialog( sal_uInt32 _nSelDict ); - void UpdateOriginalLB( void ); - void UpdateSuggestions( void ); - void UpdateButtonStates(); - - void SetEditText( Edit& _rEdit, sal_uInt16 _nEntryNum ); - void EditModify( Edit* _pEdit, sal_uInt8 _nEntryOffset ); - void EditFocusLost( Edit* _pEdit, sal_uInt8 _nEntryOffset ); - - bool DeleteEntryFromDictionary( const ::rtl::OUString& rEntry, const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XConversionDictionary >& xDict ); - - public: - HangulHanjaEditDictDialog( Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict ); - ~HangulHanjaEditDictDialog(); - - void UpdateScrollbar( void ); - }; - -//............................................................................. -} // namespace svx -//............................................................................. - -#endif // SVX_HANGUL_HANJA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/headertablistbox.hxx b/cui/source/inc/headertablistbox.hxx deleted file mode 100644 index 82c4e4b43..000000000 --- a/cui/source/inc/headertablistbox.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _HEADERTABLISTBOX_HXX -#define _HEADERTABLISTBOX_HXX - -#include -#include - - -class _HeaderTabListBox : public Control -{ -private: - SvHeaderTabListBox maListBox; - HeaderBar maHeaderBar; -protected: - DECL_LINK( HeaderEndDrag_Impl, HeaderBar* ); - virtual long Notify( NotifyEvent& rNEvt ); -public: - _HeaderTabListBox( Window* pParent, const ResId& rId ); - virtual ~_HeaderTabListBox(); - - inline SvHeaderTabListBox& GetListBox( void ); - inline HeaderBar& GetHeaderBar( void ); - - void ConnectElements( void ); - // should be called after all manipulations on elements are done - // calcs real sizes depending on sizes of this - void Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = 0 ); // same meaning as Windows::Show() - void Enable( bool bEnable = true, bool bChild = true ); // same meaning as Windows::Enable() -}; - -inline SvHeaderTabListBox& _HeaderTabListBox::GetListBox( void ) -{ - return maListBox; -} - -inline HeaderBar& _HeaderTabListBox::GetHeaderBar( void ) -{ - return maHeaderBar; -} - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc deleted file mode 100644 index 4c19514e1..000000000 --- a/cui/source/inc/helpid.hrc +++ /dev/null @@ -1,390 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_HELPID_HRC -#define _CUI_HELPID_HRC -// include --------------------------------------------------------------- - -#include -#include - -// Help-Ids -------------------------------------------------------------- - -#define HID_OPTIONS_COLOR "CUI_HID_OPTIONS_COLOR" -#define HID_OPTIONS_SAVE "CUI_HID_OPTIONS_SAVE" -#define HID_OPTIONS_PATH "CUI_HID_OPTIONS_PATH" -#define HID_OPTIONS_GENERAL "CUI_HID_OPTIONS_GENERAL" -#define HID_OPTIONS_LINGU "CUI_HID_OPTIONS_LINGU" -#define HID_OPTIONS_SPELL "CUI_HID_OPTIONS_SPELL" -#define HID_OPTIONS_DICT_NEW "CUI_HID_OPTIONS_DICT_NEW" -#define HID_OPTIONS_DICT_EDIT "CUI_HID_OPTIONS_DICT_EDIT" -#define HID_OPTIONS_INET "CUI_HID_OPTIONS_INET" -#define HID_OPTIONS_CHART_DEFCOLORS "CUI_HID_OPTIONS_CHART_DEFCOLORS" -#define HID_OPTIONS_CTL "CUI_HID_OPTIONS_CTL" -#define HID_OPTIONS_PROXY "CUI_HID_OPTIONS_PROXY" -#define HID_OPTIONS_SEARCH "CUI_HID_OPTIONS_SEARCH" -#define HID_OPTIONS_MAIL "CUI_HID_OPTIONS_MAIL" -#define HID_OPTIONS_ASIAN_LAYOUT "CUI_HID_OPTIONS_ASIAN_LAYOUT" -#define HID_CLB_EDIT_MODULES_DICS "CUI_HID_CLB_EDIT_MODULES_DICS" -#define HID_CLB_EDIT_MODULES_MODULES "CUI_HID_CLB_EDIT_MODULES_MODULES" -#define HID_CLB_LINGU_MODULES "CUI_HID_CLB_LINGU_MODULES" -#define HID_CLB_LINGU_OPTIONS "CUI_HID_CLB_LINGU_OPTIONS" -#define HID_EDIT_MODULES "CUI_HID_EDIT_MODULES" -#define HID_LNGDLG_NUM_PREBREAK "CUI_HID_LNGDLG_NUM_PREBREAK" -#define HID_OPTIONS_COLORCONFIG "CUI_HID_OPTIONS_COLORCONFIG" -#define HID_OPTIONS_COLORCONFIG_SAVE_SCHEME "CUI_HID_OPTIONS_COLORCONFIG_SAVE_SCHEME" -#define HID_OPTIONS_ACCESSIBILITYCONFIG "CUI_HID_OPTIONS_ACCESSIBILITYCONFIG" -#define HID_OPTIONS_COLORCONFIG_COLORLIST_WIN "CUI_HID_OPTIONS_COLORCONFIG_COLORLIST_WIN" -#define HID_OPTIONS_COLORCONFIG_NAME_SCHEME "CUI_HID_OPTIONS_COLORCONFIG_NAME_SCHEME" -#define HID_OPTIONS_PATHS_SELECTFOLDER "CUI_HID_OPTIONS_PATHS_SELECTFOLDER" -#define HID_OPTIONS_JAVA "CUI_HID_OPTIONS_JAVA" -#define HID_OPTIONS_JAVA_LIST "CUI_HID_OPTIONS_JAVA_LIST" -#define HID_OPTIONS_JAVA_PARAMETER "CUI_HID_OPTIONS_JAVA_PARAMETER" -#define HID_OPTIONS_JAVA_CLASSPATH "CUI_HID_OPTIONS_JAVA_CLASSPATH" -#define HID_SVXPAGE_JSEARCH_OPTIONS "CUI_HID_SVXPAGE_JSEARCH_OPTIONS" -#define HID_SVXDLG_FILTER_WARNING "CUI_HID_SVXDLG_FILTER_WARNING" -#define HID_SVX_OPTIONS_ONLINEUPDATE "CUI_HID_SVX_OPTIONS_ONLINEUPDATE" -#define HID_DLG_SECURITY_OPTIONS "CUI_HID_DLG_SECURITY_OPTIONS" -#define HID_OFADLG_OPTIONS_TREE "CUI_HID_OFADLG_OPTIONS_TREE" -#define HID_OFA_CONNPOOL_DRIVERLIST "CUI_HID_OFA_CONNPOOL_DRIVERLIST" -#define UID_OFA_CONNPOOL_DRIVERLIST_BACK "CUI_UID_OFA_CONNPOOL_DRIVERLIST_BACK" -#define HID_OFA_FONT_SUBST_CLB "CUI_HID_OFA_FONT_SUBST_CLB" -#define HID_OFA_TP_MISC "CUI_HID_OFA_TP_MISC" -#define HID_OFA_TP_VIEW "CUI_HID_OFA_TP_VIEW" -#define HID_OFA_TP_LANGUAGES "CUI_HID_OFA_TP_LANGUAGES" -#define HID_OFA_TP_MEMORY "CUI_HID_OFA_TP_MEMORY" -#define HID_DBPATH_CTL_PATH "CUI_HID_DBPATH_CTL_PATH" -#define HID_DBPATH_HEADERBAR "CUI_HID_DBPATH_HEADERBAR" -#define HID_OFAPAGE_SMARTTAG_OPTIONS "CUI_HID_OFAPAGE_SMARTTAG_OPTIONS" -#define HID_OFAPAGE_MSFLTR2_CLB "CUI_HID_OFAPAGE_MSFLTR2_CLB" -#define HID_OPTPATH_CTL_PATH "CUI_HID_OPTPATH_CTL_PATH" -#define HID_OFADLG_TREELISTBOX "CUI_HID_OFADLG_TREELISTBOX" -#define HID_DLG_WEBCONNECTION_INFO "CUI_HID_DLG_WEBCONNECTION_INFO" -#define HID_OPTIONS_DICT_EDIT_ENTRIES_LIST "CUI_HID_OPTIONS_DICT_EDIT_ENTRIES_LIST" -#define HID_OPTPATH_HEADERBAR "CUI_HID_OPTPATH_HEADERBAR" -#define HID_WARN_NAME_DUPLICATE "CUI_HID_WARN_NAME_DUPLICATE" -#define HID_COLORPAGE_LISTBOX_START "CUI_HID_COLORPAGE_LISTBOX_START" -#define HID_COLORPAGE_DOCCOLOR_LB "CUI_HID_COLORPAGE_DOCCOLOR_LB" -#define HID_COLORPAGE_DOCBOUNDARIES_LB "CUI_HID_COLORPAGE_DOCBOUNDARIES_LB" -#define HID_COLORPAGE_APPBACKGROUND_LB "CUI_HID_COLORPAGE_APPBACKGROUND_LB" -#define HID_COLORPAGE_OBJECTBOUNDARIES_LB "CUI_HID_COLORPAGE_OBJECTBOUNDARIES_LB" -#define HID_COLORPAGE_TABLEBOUNDARIES_LB "CUI_HID_COLORPAGE_TABLEBOUNDARIES_LB" -#define HID_COLORPAGE_FONTCOLOR_LB "CUI_HID_COLORPAGE_FONTCOLOR_LB" -#define HID_COLORPAGE_LINKS_LB "CUI_HID_COLORPAGE_LINKS_LB" -#define HID_COLORPAGE_LINKSVISITED_LB "CUI_HID_COLORPAGE_LINKSVISITED_LB" -#define HID_COLORPAGE_ANCHOR_LB "CUI_HID_COLORPAGE_ANCHOR_LB" -#define HID_COLORPAGE_SPELL_LB "CUI_HID_COLORPAGE_SPELL_LB" -#define HID_COLORPAGE_WRITERTEXTGRID_LB "CUI_HID_COLORPAGE_WRITERTEXTGRID_LB" -#define HID_COLORPAGE_WRITERFIELDSHADINGS_LB "CUI_HID_COLORPAGE_WRITERFIELDSHADINGS_LB" -#define HID_COLORPAGE_WRITERIDXSHADINGS_LB "CUI_HID_COLORPAGE_WRITERIDXSHADINGS_LB" -#define HID_COLORPAGE_WRITERDIRECTCURSOR_LB "CUI_HID_COLORPAGE_WRITERDIRECTCURSOR_LB" -#define HID_COLORPAGE_WRITERNOTESINDICATOR_LB "CUI_HID_COLORPAGE_WRITERNOTESINDICATOR_LB" -#define HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB "CUI_HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB" -#define HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB "CUI_HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB" -#define HID_COLORPAGE_WRITERPAGEBREAKS_LB "CUI_HID_COLORPAGE_WRITERPAGEBREAKS_LB" -#define HID_COLORPAGE_HTMLSGML_LB "CUI_HID_COLORPAGE_HTMLSGML_LB" -#define HID_COLORPAGE_HTMLCOMMENT_LB "CUI_HID_COLORPAGE_HTMLCOMMENT_LB" -#define HID_COLORPAGE_HTMLKEYWORD_LB "CUI_HID_COLORPAGE_HTMLKEYWORD_LB" -#define HID_COLORPAGE_HTMLUNKNOWN_LB "CUI_HID_COLORPAGE_HTMLUNKNOWN_LB" -#define HID_COLORPAGE_CALCGRID_LB "CUI_HID_COLORPAGE_CALCGRID_LB" -#define HID_COLORPAGE_CALCPAGEBREAK_LB "CUI_HID_COLORPAGE_CALCPAGEBREAK_LB" -#define HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB "CUI_HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB" -#define HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB "CUI_HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB" -#define HID_COLORPAGE_CALCDETECTIVE_LB "CUI_HID_COLORPAGE_CALCDETECTIVE_LB" -#define HID_COLORPAGE_CALCDETECTIVEERROR_LB "CUI_HID_COLORPAGE_CALCDETECTIVEERROR_LB" -#define HID_COLORPAGE_CALCREFERENCE_LB "CUI_HID_COLORPAGE_CALCREFERENCE_LB" -#define HID_COLORPAGE_CALCNOTESBACKGROUND_LB "CUI_HID_COLORPAGE_CALCNOTESBACKGROUND_LB" -#define HID_COLORPAGE_DRAWGRID_LB "CUI_HID_COLORPAGE_DRAWGRID_LB" -#define HID_COLORPAGE_DRAWDRAWING_LB "CUI_HID_COLORPAGE_DRAWDRAWING_LB" -#define HID_COLORPAGE_DRAWFILL_LB "CUI_HID_COLORPAGE_DRAWFILL_LB" -#define HID_COLORPAGE_BASICIDENTIFIER_LB "CUI_HID_COLORPAGE_BASICIDENTIFIER_LB" -#define HID_COLORPAGE_BASICCOMMENT_LB "CUI_HID_COLORPAGE_BASICCOMMENT_LB" -#define HID_COLORPAGE_BASICNUMBER_LB "CUI_HID_COLORPAGE_BASICNUMBER_LB" -#define HID_COLORPAGE_BASICSTRING_LB "CUI_HID_COLORPAGE_BASICSTRING_LB" -#define HID_COLORPAGE_BASICOPERATOR_LB "CUI_HID_COLORPAGE_BASICOPERATOR_LB" -#define HID_COLORPAGE_BASICKEYWORD_LB "CUI_HID_COLORPAGE_BASICKEYWORD_LB" -#define HID_COLORPAGE_BASICERROR_LB "CUI_HID_COLORPAGE_BASICERROR_LB" -#define HID_COLORPAGE_CHECKBOX_START "CUI_HID_COLORPAGE_CHECKBOX_START" -#define HID_COLORPAGE_DOCCOLOR_CB "CUI_HID_COLORPAGE_DOCCOLOR_CB" -#define HID_COLORPAGE_DOCBOUNDARIES_CB "CUI_HID_COLORPAGE_DOCBOUNDARIES_CB" -#define HID_COLORPAGE_APPBACKGROUND_CB "CUI_HID_COLORPAGE_APPBACKGROUND_CB" -#define HID_COLORPAGE_OBJECTBOUNDARIES_CB "CUI_HID_COLORPAGE_OBJECTBOUNDARIES_CB" -#define HID_COLORPAGE_TABLEBOUNDARIES_CB "CUI_HID_COLORPAGE_TABLEBOUNDARIES_CB" -#define HID_COLORPAGE_FONTCOLOR_CB "CUI_HID_COLORPAGE_FONTCOLOR_CB" -#define HID_COLORPAGE_LINKS_CB "CUI_HID_COLORPAGE_LINKS_CB" -#define HID_COLORPAGE_LINKSVISITED_CB "CUI_HID_COLORPAGE_LINKSVISITED_CB" -#define HID_COLORPAGE_ANCHOR_CB "CUI_HID_COLORPAGE_ANCHOR_CB" -#define HID_COLORPAGE_SPELL_CB "CUI_HID_COLORPAGE_SPELL_CB" -#define HID_COLORPAGE_WRITERTEXTGRID_CB "CUI_HID_COLORPAGE_WRITERTEXTGRID_CB" -#define HID_COLORPAGE_WRITERFIELDSHADINGS_CB "CUI_HID_COLORPAGE_WRITERFIELDSHADINGS_CB" -#define HID_COLORPAGE_WRITERIDXSHADINGS_CB "CUI_HID_COLORPAGE_WRITERIDXSHADINGS_CB" -#define HID_COLORPAGE_WRITERDIRECTCURSOR_CB "CUI_HID_COLORPAGE_WRITERDIRECTCURSOR_CB" -#define HID_COLORPAGE_WRITERNOTESINDICATOR_CB "CUI_HID_COLORPAGE_WRITERNOTESINDICATOR_CB" -#define HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB "CUI_HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB" -#define HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB "CUI_HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB" -#define HID_COLORPAGE_WRITERPAGEBREAKS_CB "CUI_HID_COLORPAGE_WRITERPAGEBREAKS_CB" -#define HID_COLORPAGE_HTMLSGML_CB "CUI_HID_COLORPAGE_HTMLSGML_CB" -#define HID_COLORPAGE_HTMLCOMMENT_CB "CUI_HID_COLORPAGE_HTMLCOMMENT_CB" -#define HID_COLORPAGE_HTMLKEYWORD_CB "CUI_HID_COLORPAGE_HTMLKEYWORD_CB" -#define HID_COLORPAGE_HTMLUNKNOWN_CB "CUI_HID_COLORPAGE_HTMLUNKNOWN_CB" -#define HID_COLORPAGE_CALCGRID_CB "CUI_HID_COLORPAGE_CALCGRID_CB" -#define HID_COLORPAGE_CALCPAGEBREAK_CB "CUI_HID_COLORPAGE_CALCPAGEBREAK_CB" -#define HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB "CUI_HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB" -#define HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB "CUI_HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB" -#define HID_COLORPAGE_CALCDETECTIVE_CB "CUI_HID_COLORPAGE_CALCDETECTIVE_CB" -#define HID_COLORPAGE_CALCDETECTIVEERROR_CB "CUI_HID_COLORPAGE_CALCDETECTIVEERROR_CB" -#define HID_COLORPAGE_CALCREFERENCE_CB "CUI_HID_COLORPAGE_CALCREFERENCE_CB" -#define HID_COLORPAGE_CALCNOTESBACKGROUND_CB "CUI_HID_COLORPAGE_CALCNOTESBACKGROUND_CB" -#define HID_COLORPAGE_DRAWGRID_CB "CUI_HID_COLORPAGE_DRAWGRID_CB" -#define HID_COLORPAGE_DRAWDRAWING_CB "CUI_HID_COLORPAGE_DRAWDRAWING_CB" -#define HID_COLORPAGE_DRAWFILL_CB "CUI_HID_COLORPAGE_DRAWFILL_CB" -#define HID_COLORPAGE_BASICIDENTIFIER_CB "CUI_HID_COLORPAGE_BASICIDENTIFIER_CB" -#define HID_COLORPAGE_BASICCOMMENT_CB "CUI_HID_COLORPAGE_BASICCOMMENT_CB" -#define HID_COLORPAGE_BASICNUMBER_CB "CUI_HID_COLORPAGE_BASICNUMBER_CB" -#define HID_COLORPAGE_BASICSTRING_CB "CUI_HID_COLORPAGE_BASICSTRING_CB" -#define HID_COLORPAGE_BASICOPERATOR_CB "CUI_HID_COLORPAGE_BASICOPERATOR_CB" -#define HID_COLORPAGE_BASICKEYWORD_CB "CUI_HID_COLORPAGE_BASICKEYWORD_CB" -#define HID_COLORPAGE_BASICERROR_CB "CUI_HID_COLORPAGE_BASICERROR_CB" -#define HID_NUMBERINGOPT_SEL_GRF_FROM_FILE "CUI_HID_NUMBERINGOPT_SEL_GRF_FROM_FILE" -#define HID_SVX_MACRO_LB_EVENT "CUI_HID_SVX_MACRO_LB_EVENT" -#define HID_SVX_CONFIG_EVENT "CUI_HID_SVX_CONFIG_EVENT" -#define HID_CONFIG_EVENT_OFFICE_BASED "CUI_HID_CONFIG_EVENT_OFFICE_BASED" -#define HID_CONFIG_EVENT_DOCUMENT_BASED "CUI_HID_CONFIG_EVENT_DOCUMENT_BASED" -#define HID_SELECTOR_DIALOG "CUI_HID_SELECTOR_DIALOG" -#define HID_SELECTOR_CATEGORIES "CUI_HID_SELECTOR_CATEGORIES" -#define HID_SVX_CONFIG_TOOLBAR "CUI_HID_SVX_CONFIG_TOOLBAR" -#define HID_SVX_CONFIG_TOOLBAR_CONTENTS "CUI_HID_SVX_CONFIG_TOOLBAR_CONTENTS" -#define HID_SELECTOR_COMMANDS "CUI_HID_SELECTOR_COMMANDS" -#define HID_GALLERY_EDIT_MSNAME "CUI_HID_GALLERY_EDIT_MSNAME" -#define HID_SVX_CONFIG_MENU "CUI_HID_SVX_CONFIG_MENU" -#define HID_SVX_CONFIG_MENU_CONTENTS "CUI_HID_SVX_CONFIG_MENU_CONTENTS" -#define HID_GALLERY_NEWTHEME_FINDFILES "CUI_HID_GALLERY_NEWTHEME_FINDFILES" -#define HID_GALLERY_NEWTHEME_ADDFILES "CUI_HID_GALLERY_NEWTHEME_ADDFILES" -#define HID_HANGULDLG_BUTTON_OPTIONS "CUI_HID_HANGULDLG_BUTTON_OPTIONS" -#define HID_HANGULDLG_BUTTON_CLOSE "CUI_HID_HANGULDLG_BUTTON_CLOSE" -#define HID_HANGULDLG_BUTTON_IGNORE "CUI_HID_HANGULDLG_BUTTON_IGNORE" -#define HID_HANGULDLG_BUTTON_IGNOREALL "CUI_HID_HANGULDLG_BUTTON_IGNOREALL" -#define HID_HANGULDLG_BUTTON_CHANGE "CUI_HID_HANGULDLG_BUTTON_CHANGE" -#define HID_HANGULDLG_BUTTON_CHANGEALL "CUI_HID_HANGULDLG_BUTTON_CHANGEALL" -#define HID_OFA_FONT_SUBSTITUTION "CUI_HID_OFA_FONT_SUBSTITUTION" -#define HID_HANGULDLG_EDIT_NEWWORD "CUI_HID_HANGULDLG_EDIT_NEWWORD" -#define HID_OFA_SUBST_APPLY "CUI_HID_OFA_SUBST_APPLY" -#define HID_OFA_SUBST_DELETE "CUI_HID_OFA_SUBST_DELETE" -#define HID_SPLDLG_BUTTON_CLOSE "CUI_HID_SPLDLG_BUTTON_CLOSE" -#define HID_SPLDLG_BUTTON_IGNORE "CUI_HID_SPLDLG_BUTTON_IGNORE" -#define HID_SPLDLG_BUTTON_IGNOREALL "CUI_HID_SPLDLG_BUTTON_IGNOREALL" -#define HID_SPLDLG_BUTTON_CHANGE "CUI_HID_SPLDLG_BUTTON_CHANGE" -#define HID_SPLDLG_BUTTON_CHANGEALL "CUI_HID_SPLDLG_BUTTON_CHANGEALL" -#define HID_SPLDLG_BUTTON_EXPLAIN "CUI_HID_SPLDLG_BUTTON_EXPLAIN" -#define HID_CHARMAP_CTL_SHOWSET "CUI_HID_CHARMAP_CTL_SHOWSET" -#define HID_CHARMAP_CTL_SHOWTEXT "CUI_HID_CHARMAP_CTL_SHOWTEXT" -#define HID_CHARMAP_CTL_SHOWCHAR "CUI_HID_CHARMAP_CTL_SHOWCHAR" -#define HID_DLG_NAME "CUI_HID_DLG_NAME" -#define HID_DLG_MESSBOX "CUI_HID_DLG_MESSBOX" -#define HID_HANGULDLG_SUGGESTIONS "CUI_HID_HANGULDLG_SUGGESTIONS" -#define HID_HANGULDLG_SUGGESTIONS_GRID "CUI_HID_HANGULDLG_SUGGESTIONS_GRID" -#define HID_HANGULDLG_SUGGESTIONS_LIST "CUI_HID_HANGULDLG_SUGGESTIONS_LIST" -#define HID_DLG_OBJECT_NAME "CUI_HID_DLG_OBJECT_NAME" -#define HID_DLG_OBJECT_TITLE_DESC "CUI_HID_DLG_OBJECT_TITLE_DESC" -#define HID_SVX_CONFIG_MENU_ORGANIZER "CUI_HID_SVX_CONFIG_MENU_ORGANIZER" -#define HID_SVX_CONFIG_ICON_SELECTOR "CUI_HID_SVX_CONFIG_ICON_SELECTOR" -#define HID_SVX_CONFIG_NAME_SUBMENU "CUI_HID_SVX_CONFIG_NAME_SUBMENU" -#define HID_SVX_CONFIG_RENAME_MENU "CUI_HID_SVX_CONFIG_RENAME_MENU" -#define HID_SVX_CONFIG_RENAME_MENU_ITEM "CUI_HID_SVX_CONFIG_RENAME_MENU_ITEM" -#define HID_SVX_CONFIG_RENAME_TOOLBAR "CUI_HID_SVX_CONFIG_RENAME_TOOLBAR" -#define HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM "CUI_HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM" -#define HID_SVX_NEW_TOOLBAR "CUI_HID_SVX_NEW_TOOLBAR" -#define HID_SVX_MODIFY_TOOLBAR "CUI_HID_SVX_MODIFY_TOOLBAR" -#define HID_SVX_NEW_TOOLBAR_ITEM "CUI_HID_SVX_NEW_TOOLBAR_ITEM" -#define HID_SVX_CONFIG_MENU_LISTBOX "CUI_HID_SVX_CONFIG_MENU_LISTBOX" -#define HID_SVX_MODIFY_TOOLBAR_ITEM "CUI_HID_SVX_MODIFY_TOOLBAR_ITEM" -#define HID_SVX_SAVE_IN "CUI_HID_SVX_SAVE_IN" -#define HID_OPTIONS_MULTIPATH_LIST "CUI_HID_OPTIONS_MULTIPATH_LIST" -#define HID_FM_DLG_SEARCH "CUI_HID_FM_DLG_SEARCH" -#define HID_SEARCH_TEXT "CUI_HID_SEARCH_TEXT" -#define HID_SEARCH_ALLFIELDS "CUI_HID_SEARCH_ALLFIELDS" -#define HID_GALLERY_PROPERTIES_GENERAL "CUI_HID_GALLERY_PROPERTIES_GENERAL" -#define HID_SEARCH_FIELDSELECTION "CUI_HID_SEARCH_FIELDSELECTION" -#define HID_SEARCH_POSITION "CUI_HID_SEARCH_POSITION" -#define HID_SEARCH_FORMATTER "CUI_HID_SEARCH_FORMATTER" -#define HID_SEARCH_CASE "CUI_HID_SEARCH_CASE" -#define HID_SEARCH_BACKWARD "CUI_HID_SEARCH_BACKWARD" -#define HID_SEARCH_STARTOVER "CUI_HID_SEARCH_STARTOVER" -#define HID_SEARCH_WILDCARD "CUI_HID_SEARCH_WILDCARD" -#define HID_SEARCH_REGULAR "CUI_HID_SEARCH_REGULAR" -#define HID_SEARCH_APPROX "CUI_HID_SEARCH_APPROX" -#define HID_SEARCH_APPROXSETTINGS "CUI_HID_SEARCH_APPROXSETTINGS" -#define HID_SEARCH_BTN_SEARCH "CUI_HID_SEARCH_BTN_SEARCH" -#define HID_SEARCH_BTN_CLOSE "CUI_HID_SEARCH_BTN_CLOSE" -#define HID_GALLERY_BROWSER "CUI_HID_GALLERY_BROWSER" -#define HID_GALLERY_SEARCH "CUI_HID_GALLERY_SEARCH" -#define HID_GALLERY_APPLY "CUI_HID_GALLERY_APPLY" -#define HID_SPLDLG_BUTTON_IGNORERULE "CUI_HID_SPLDLG_BUTTON_IGNORERULE" -#define HID_CONFIG_ACCEL "CUI_HID_CONFIG_ACCEL" -#define HID_ACCELCONFIG_LISTBOX "CUI_HID_ACCELCONFIG_LISTBOX" -#define HID_CONFIGGROUP_ACC_LISTBOX "CUI_HID_CONFIGGROUP_ACC_LISTBOX" -#define HID_CONFIGFUNCTION_ACC_LISTBOX "CUI_HID_CONFIGFUNCTION_ACC_LISTBOX" -#define HID_MACRO_LB_EVENT "CUI_HID_MACRO_LB_EVENT" -#define HID_MACRO_GROUP "CUI_HID_MACRO_GROUP" -#define HID_MACRO_MACROS "CUI_HID_MACRO_MACROS" -#define HID_DIALOG_HANGULHANJA "CUI_HID_DIALOG_HANGULHANJA" -#define HID_HANGULHANJA_OPT_DLG "CUI_HID_HANGULHANJA_OPT_DLG" -#define HID_HANGULHANJA_NEWDICT_DLG "CUI_HID_HANGULHANJA_NEWDICT_DLG" -#define HID_HANGULHANJA_EDIT_DLG "CUI_HID_HANGULHANJA_EDIT_DLG" -#define HID_HANGULHANJA_OPT_DICTS_LB "CUI_HID_HANGULHANJA_OPT_DICTS_LB" -#define HID_MULTIPATH "CUI_HID_MULTIPATH" -#define HID_SCRIPTORG_DIALOG "CUI_HID_SCRIPTORG_DIALOG" -#define HID_SCRIPTSBOX "CUI_HID_SCRIPTSBOX" -#define HID_SPELLCHECK "CUI_HID_SPELLCHECK" -#define HID_TPSIZE_CTRL "CUI_HID_TPSIZE_CTRL" -#define HID_TPROTATION_CTRL1 "CUI_HID_TPROTATION_CTRL1" -#define HID_TPROTATION_CTRL2 "CUI_HID_TPROTATION_CTRL2" -#define HID_TRANS_ANGLE "CUI_HID_TRANS_ANGLE" -#define HID_TPPOSITION_CTRL "CUI_HID_TPPOSITION_CTRL" -#define HID_NUMBERFORMAT_LB_FORMAT "CUI_HID_NUMBERFORMAT_LB_FORMAT" -#define HID_NUMBERFORMAT_WND_NUMBER_PREVIEW "CUI_HID_NUMBERFORMAT_WND_NUMBER_PREVIEW" -#define HID_TRANS_SLANT "CUI_HID_TRANS_SLANT" -#define HID_TPHATCH_CTRL "CUI_HID_TPHATCH_CTRL" -#define HID_SEARCHATTR_CTL_ATTR "CUI_HID_SEARCHATTR_CTL_ATTR" -#define HID_NUMBERFORMAT_TBI_INFO "CUI_HID_NUMBERFORMAT_TBI_INFO" -#define HID_SEARCHATTR "CUI_HID_SEARCHATTR" -#define HID_ALIGNMENT_CTR_DIAL "CUI_HID_ALIGNMENT_CTR_DIAL" -#define HID_ALIGNMENT_CTR_BORDER_LOCK "CUI_HID_ALIGNMENT_CTR_BORDER_LOCK" -#define HID_SEARCHSIMILARITY "CUI_HID_SEARCHSIMILARITY" -#define UID_SEARCH_RECORDSTATUS "CUI_UID_SEARCH_RECORDSTATUS" -#define HID_OFAPAGE_AUTOCORR_CLB "CUI_HID_OFAPAGE_AUTOCORR_CLB" -#define HID_AUTOCORR_LANGUAGE "CUI_HID_AUTOCORR_LANGUAGE" -#define HID_OFAPAGE_AUTOFORMAT_CLB "CUI_HID_OFAPAGE_AUTOFORMAT_CLB" -#define HID_TPCOLOR_RGB_1 "CUI_HID_TPCOLOR_RGB_1" -#define HID_TPCOLOR_RGB_2 "CUI_HID_TPCOLOR_RGB_2" -#define HID_TPCOLOR_RGB_3 "CUI_HID_TPCOLOR_RGB_3" -#define HID_TPCOLOR_CMYK_1 "CUI_HID_TPCOLOR_CMYK_1" -#define HID_TPCOLOR_CMYK_2 "CUI_HID_TPCOLOR_CMYK_2" -#define HID_TPCOLOR_CMYK_3 "CUI_HID_TPCOLOR_CMYK_3" -#define HID_ALIGNMENT "CUI_HID_ALIGNMENT" -#define HID_OFAPAGE_AUTOCORR_OPTIONS "CUI_HID_OFAPAGE_AUTOCORR_OPTIONS" -#define HID_OFAPAGE_AUTOFMT_OPTIONS "CUI_HID_OFAPAGE_AUTOFMT_OPTIONS" -#define HID_OFAPAGE_AUTOCORR_REPLACE "CUI_HID_OFAPAGE_AUTOCORR_REPLACE" -#define HID_OFACTL_AUTOCORR_REPLACE "CUI_HID_OFACTL_AUTOCORR_REPLACE" -#define HID_OFAPAGE_AUTOCORR_EXCEPT "CUI_HID_OFAPAGE_AUTOCORR_EXCEPT" -#define HID_OFAPAGE_AUTOCORR_QUOTE "CUI_HID_OFAPAGE_AUTOCORR_QUOTE" -#define HID_OFAPAGE_AUTOCOMPLETE_OPTIONS "CUI_HID_OFAPAGE_AUTOCOMPLETE_OPTIONS" -#define HID_BACKGROUND "CUI_HID_BACKGROUND" -#define HID_BACKGROUND_CTL_BGDCOLORSET "CUI_HID_BACKGROUND_CTL_BGDCOLORSET" -#define HID_BACKGROUND_CTL_POSITION "CUI_HID_BACKGROUND_CTL_POSITION" -#define HID_BORDER "CUI_HID_BORDER" -#define HID_BORDER_CTL_PRESETS "CUI_HID_BORDER_CTL_PRESETS" -#define HID_BORDER_CTL_SHADOWS "CUI_HID_BORDER_CTL_SHADOWS" -#define HID_PAGE_CONNECTION "CUI_HID_PAGE_CONNECTION" -#define HID_PAGE_CONNECTION_CTL_PREVIEW "CUI_HID_PAGE_CONNECTION_CTL_PREVIEW" -#define HID_PAGE_DISTRIBUTE "CUI_HID_PAGE_DISTRIBUTE" -#define HID_SVXPAGE_GRFCROP "CUI_HID_SVXPAGE_GRFCROP" -#define HID_CAPTION "CUI_HID_CAPTION" -#define HID_CAPTION_CTL_TYPE "CUI_HID_CAPTION_CTL_TYPE" -#define HID_PAGE_MEASURE "CUI_HID_PAGE_MEASURE" -#define HID_MEASURE_CTL_POSITION "CUI_HID_MEASURE_CTL_POSITION" -#define HID_NUMBERFORMAT "CUI_HID_NUMBERFORMAT" -#define HID_NUMBERFORMAT_TBI_ADD "CUI_HID_NUMBERFORMAT_TBI_ADD" -#define HID_NUMBERFORMAT_TBI_REMOVE "CUI_HID_NUMBERFORMAT_TBI_REMOVE" -#define HID_FORMAT_PAGE "CUI_HID_FORMAT_PAGE" -#define HID_REDLINING_DLG "CUI_HID_REDLINING_DLG" -#define HID_REDLINING_EDIT "CUI_HID_REDLINING_EDIT" -#define HID_REDLINING_PREV "CUI_HID_REDLINING_PREV" -#define HID_REDLINING_NEXT "CUI_HID_REDLINING_NEXT" -#define HID_FORMAT_PARAGRAPH_STD "CUI_HID_FORMAT_PARAGRAPH_STD" -#define HID_VALUESET_SINGLENUM "CUI_HID_VALUESET_SINGLENUM" -#define HID_VALUESET_BULLET "CUI_HID_VALUESET_BULLET" -#define HID_VALUESET_NUM "CUI_HID_VALUESET_NUM" -#define HID_VALUESET_NUMBMP "CUI_HID_VALUESET_NUMBMP" -#define HID_SVXPAGE_PICK_NUM "CUI_HID_SVXPAGE_PICK_NUM" -#define HID_SVXPAGE_PICK_SINGLE_NUM "CUI_HID_SVXPAGE_PICK_SINGLE_NUM" -#define HID_SVXPAGE_PICK_BMP "CUI_HID_SVXPAGE_PICK_BMP" -#define HID_SVXPAGE_PICK_BULLET "CUI_HID_SVXPAGE_PICK_BULLET" -#define HID_SVXPAGE_NUM_OPTIONS "CUI_HID_SVXPAGE_NUM_OPTIONS" -#define HID_SVXPAGE_NUM_POSITION "CUI_HID_SVXPAGE_NUM_POSITION" -#define HID_MEASURE_CTL_PREVIEW "CUI_HID_MEASURE_CTL_PREVIEW" -#define HID_FORMAT_PARAGRAPH_EXT "CUI_HID_FORMAT_PARAGRAPH_EXT" -#define HID_FORMAT_PARAGRAPH_ALIGN "CUI_HID_FORMAT_PARAGRAPH_ALIGN" -#define HID_SVXPAGE_PARA_ASIAN "CUI_HID_SVXPAGE_PARA_ASIAN" -#define HID_SVXPAGE_SWPOSSIZE "CUI_HID_SVXPAGE_SWPOSSIZE" -#define HID_AREA_TRANSPARENCE "CUI_HID_AREA_TRANSPARENCE" -#define HID_AREA_AREA "CUI_HID_AREA_AREA" -#define HID_AREA_SHADOW "CUI_HID_AREA_SHADOW" -#define HID_AREA_HATCH "CUI_HID_AREA_HATCH" -#define HID_AREA_BITMAP "CUI_HID_AREA_BITMAP" -#define HID_TPSHADOW_CTRL "CUI_HID_TPSHADOW_CTRL" -#define HID_AREA_GRADIENT "CUI_HID_AREA_GRADIENT" -#define HID_LINE_ENDDEF "CUI_HID_LINE_ENDDEF" -#define HID_LINE_LINE "CUI_HID_LINE_LINE" -#define HID_LINE_DEF "CUI_HID_LINE_DEF" -#define HID_SPELLDLG_SETWORD "CUI_HID_SPELLDLG_SETWORD" -#define HID_TABULATOR "CUI_HID_TABULATOR" -#define HID_PAGE_TEXTATTR "CUI_HID_PAGE_TEXTATTR" -#define HID_TEXTATTR_CTL_POSITION "CUI_HID_TEXTATTR_CTL_POSITION" -#define HID_TRANS_POSITION_SIZE "CUI_HID_TRANS_POSITION_SIZE" -#define HID_HYPHENATE "CUI_HID_HYPHENATE" -#define HID_SVXPAGE_CHAR_NAME "CUI_HID_SVXPAGE_CHAR_NAME" -#define HID_SVXPAGE_CHAR_EFFECTS "CUI_HID_SVXPAGE_CHAR_EFFECTS" -#define HID_SVXPAGE_CHAR_POSITION "CUI_HID_SVXPAGE_CHAR_POSITION" -#define HID_HYPERLINK_INTERNET "CUI_HID_HYPERLINK_INTERNET" -#define HID_HYPERLINK_MAIL "CUI_HID_HYPERLINK_MAIL" -#define HID_HYPERLINK_DOCUMENT "CUI_HID_HYPERLINK_DOCUMENT" -#define HID_HYPERLINK_NEWDOCUMENT "CUI_HID_HYPERLINK_NEWDOCUMENT" -#define HID_HYPERLINK_MARKWND "CUI_HID_HYPERLINK_MARKWND" -#define HID_ICCDIALOG_RESET_BTN "CUI_HID_ICCDIALOG_RESET_BTN" -#define HID_ICCDIALOG_CHOICECTRL "CUI_HID_ICCDIALOG_CHOICECTRL" -#define HID_HYPERDLG_INET_PATH "CUI_HID_HYPERDLG_INET_PATH" -#define HID_HYPERDLG_MAIL_PATH "CUI_HID_HYPERDLG_MAIL_PATH" -#define HID_HYPERDLG_DOC_PATH "CUI_HID_HYPERDLG_DOC_PATH" -#define HID_ICCDIALOG_OK_BTN "CUI_HID_ICCDIALOG_OK_BTN" -#define HID_ICCDIALOG_CANCEL_BTN "CUI_HID_ICCDIALOG_CANCEL_BTN" -#define HID_HYPERLINK_MARKWND_APPLY "CUI_HID_HYPERLINK_MARKWND_APPLY" -#define HID_HYPERLINK_MARKWND_CLOSE "CUI_HID_HYPERLINK_MARKWND_CLOSE" -#define HID_HYPERLINK_MARKWND_TREE "CUI_HID_HYPERLINK_MARKWND_TREE" -#define HID_SVXPAGE_CHAR_TWOLINES "CUI_HID_SVXPAGE_CHAR_TWOLINES" -#define HID_GRFFILTER_EMBOSS_LIGHT "CUI_HID_GRFFILTER_EMBOSS_LIGHT" -#define HID_PASTE_DLG "CUI_HID_PASTE_DLG" -#define HID_LINKDLG_TABLB "CUI_HID_LINKDLG_TABLB" -#define HID_MACRO_HEADERTABLISTBOX "CUI_HID_MACRO_HEADERTABLISTBOX" -#define HID_GALLERY_ENTER_TITLE "CUI_HID_GALLERY_ENTER_TITLE" -#define HID_GALLERY_TITLE_EDIT "CUI_HID_GALLERY_TITLE_EDIT" -#define HID_THES_LANGUAGE "CUI_HID_THES_LANGUAGE" -#define HID_OFAPAGE_QUOTE_SW_CLB "CUI_HID_OFAPAGE_QUOTE_SW_CLB" -#define HID_OFAPAGE_QUOTE_CLB "CUI_HID_OFAPAGE_QUOTE_CLB" -#define HID_POSTIT_DIALOG "CUI_HID_POSTIT_DIALOG" -#define HID_CT_THES_ALTERNATIVES "CUI_HID_CT_THES_ALTERNATIVES" - -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_OPEN" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_OPEN" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_MORE" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_FILE_READONLY" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY" -#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY" -#define HID_HYPERLINK_DIALOG "CUI_HID_HYPERLINK_DIALOG" - -#endif - diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx deleted file mode 100644 index 62ef7b189..000000000 --- a/cui/source/inc/hldocntp.hxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX -#define _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX - -#include "hltpbase.hxx" - -/************************************************************************* -|* -|* Tabpage : Hyperlink - New Document -|* -\************************************************************************/ - -class SvxHyperlinkNewDocTp : public SvxHyperlinkTabPageBase -{ -private: - FixedLine maGrpNewDoc; - RadioButton maRbtEditNow; - RadioButton maRbtEditLater; - FixedText maFtPath; - SvxHyperURLBox maCbbPath; - ImageButton maBtCreate; - FixedText maFtDocTypes; - ListBox maLbDocTypes; - - sal_Bool ImplGetURLObject( const String& rPath, const String& rBase, INetURLObject& aURLObject ) const; - void FillDocumentList (); - - DECL_LINK (ClickNewHdl_Impl , void * ); - - Image GetImage( sal_uInt16 nId ); - -protected: - void FillDlgFields ( String& aStrURL ); - void GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ); - -public: - SvxHyperlinkNewDocTp ( Window *pParent, const SfxItemSet& rItemSet); - ~SvxHyperlinkNewDocTp (); - - static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - - virtual sal_Bool AskApply (); - virtual void DoApply (); - - virtual void SetInitFocus(); -}; - - -#endif // _SVX_TABPAGE_DOCNEW_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx deleted file mode 100644 index 707325490..000000000 --- a/cui/source/inc/hldoctp.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABPAGE_DOC_HYPERLINK_HXX -#define _SVX_TABPAGE_DOC_HYPERLINK_HXX - -#include "hltpbase.hxx" - -/************************************************************************* -|* -|* Tabpage : Hyperlink - Document -|* -\************************************************************************/ - -class SvxHyperlinkDocTp : public SvxHyperlinkTabPageBase -{ -private: - FixedLine maGrpDocument; - FixedText maFtPath; - SvxHyperURLBox maCbbPath; - ImageButton maBtFileopen; - - FixedLine maGrpTarget; - FixedText maFtTarget; - Edit maEdTarget; - FixedText maFtURL; - FixedText maFtFullURL; - ImageButton maBtBrowse; - - String maStrURL; - - sal_Bool mbMarkWndOpen; - - DECL_LINK (ClickFileopenHdl_Impl , void * ); - DECL_LINK (ClickTargetHdl_Impl , void * ); - - DECL_LINK (ModifiedPathHdl_Impl , void * ); // Contens of combobox "Path" modified - DECL_LINK (ModifiedTargetHdl_Impl, void * ); // Contens of editfield "Target" modified - - DECL_LINK (LostFocusPathHdl_Impl, void * ); // Combobox "path" lost its focus - - DECL_LINK (TimeoutHdl_Impl , Timer * ); // Handler for timer -timeout - - enum EPathType { Type_Unknown, Type_Invalid, - Type_ExistsFile, Type_File, - Type_ExistsDir, Type_Dir }; - EPathType GetPathType ( String& aStrPath ); - -protected: - void FillDlgFields ( String& aStrURL ); - void GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ); - virtual sal_Bool ShouldOpenMarkWnd () {return mbMarkWndOpen;} - virtual void SetMarkWndShouldOpen (sal_Bool bOpen) {mbMarkWndOpen=bOpen;} - String GetCurrentURL (); - -public: - SvxHyperlinkDocTp ( Window *pParent, const SfxItemSet& rItemSet); - ~SvxHyperlinkDocTp (); - - static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - - virtual void SetMarkStr ( String& aStrMark ); - - virtual void SetInitFocus(); -}; - - -#endif // _SVX_TABPAGE_DOC_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx deleted file mode 100644 index f1888b3dc..000000000 --- a/cui/source/inc/hlinettp.hxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABPAGE_INET_HYPERLINK_HXX -#define _SVX_TABPAGE_INET_HYPERLINK_HXX - -#include -#include "cuihyperdlg.hxx" -#include "hltpbase.hxx" - -/************************************************************************* -|* -|* Tabpage : Hyperlink - Internet -|* -\************************************************************************/ - -class SvxHyperlinkInternetTp : public SvxHyperlinkTabPageBase -{ -private: - FixedLine maGrpLinkTyp; - RadioButton maRbtLinktypInternet; - RadioButton maRbtLinktypFTP; - FixedText maFtTarget; - SvxHyperURLBox maCbbTarget; - ImageButton maBtBrowse; - FixedText maFtLogin; - Edit maEdLogin; - ImageButton maBtTarget; - FixedText maFtPassword; - Edit maEdPassword; - CheckBox maCbAnonymous; - - String maStrOldUser; - String maStrOldPassword; - - sal_Bool mbMarkWndOpen; - - DECL_LINK (Click_SmartProtocol_Impl , void * ); // Radiobutton clicked: Type HTTP or FTP - DECL_LINK (ClickAnonymousHdl_Impl , void * ); // Checkbox : Anonymous User - DECL_LINK (ClickBrowseHdl_Impl , void * ); // Button : Browse - DECL_LINK (ClickTargetHdl_Impl , void * ); // Button : Target - DECL_LINK (ModifiedLoginHdl_Impl , void * ); // Contens of editfield "Login" modified - DECL_LINK (LostFocusTargetHdl_Impl , void * ); // Combobox "Target" lost its focus - DECL_LINK (ModifiedTargetHdl_Impl , void * ); // Contens of editfield "Target" modified - - DECL_LINK (TimeoutHdl_Impl , Timer * ); // Handler for timer -timeout - - - void SetScheme( const String& aScheme ); - void RemoveImproperProtocol(const String& aProperScheme); - String GetSchemeFromButtons() const; - INetProtocol GetSmartProtocolFromButtons() const; - - String CreateAbsoluteURL() const; - - void setAnonymousFTPUser(); - void setFTPUser(const String& rUser, const String& rPassword); - void RefreshMarkWindow(); - -protected: - virtual void FillDlgFields ( String& aStrURL ); - virtual void GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ); - virtual sal_Bool ShouldOpenMarkWnd () {return ( mbMarkWndOpen && maRbtLinktypInternet.IsChecked() );} - virtual void SetMarkWndShouldOpen (sal_Bool bOpen) {mbMarkWndOpen=bOpen;} - -public: - SvxHyperlinkInternetTp ( Window *pParent, const SfxItemSet& rItemSet); - ~SvxHyperlinkInternetTp (); - - static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - - virtual void SetMarkStr ( String& aStrMark ); - virtual void SetOnlineMode( sal_Bool bEnable ); - - virtual void SetInitFocus(); -}; - - -#endif // _SVX_TABPAGE_INET_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx deleted file mode 100644 index ea0bda235..000000000 --- a/cui/source/inc/hlmailtp.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABPAGE_MAIL_HYPERLINK_HXX -#define _SVX_TABPAGE_MAIL_HYPERLINK_HXX - -#include "hltpbase.hxx" - -/************************************************************************* -|* -|* Tabpage : Hyperlink - Mail & News -|* -\************************************************************************/ - -class SvxHyperlinkMailTp : public SvxHyperlinkTabPageBase -{ -private: - FixedLine maGrpMailNews; - RadioButton maRbtMail; - RadioButton maRbtNews; - FixedText maFtReceiver; - SvxHyperURLBox maCbbReceiver; - ImageButton maBtAdrBook; - FixedText maFtSubject; - Edit maEdSubject; - - DECL_LINK (Click_SmartProtocol_Impl, void * ); // Radiobutton clicked: Type EMAIl or News - DECL_LINK (ClickAdrBookHdl_Impl , void * ); // Button : Address book - DECL_LINK (ModifiedReceiverHdl_Impl, void * ); // Combobox "receiver" modified - - void SetScheme( const String& aScheme ); - void RemoveImproperProtocol(const String& aProperScheme); - String GetSchemeFromButtons() const; - INetProtocol GetSmartProtocolFromButtons() const; - - String CreateAbsoluteURL() const; - -protected: - virtual void FillDlgFields ( String& aStrURL ); - virtual void GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ); - -public: - SvxHyperlinkMailTp ( Window *pParent, const SfxItemSet& rItemSet); - ~SvxHyperlinkMailTp (); - - static IconChoicePage* Create( Window* pWindow, const SfxItemSet& rItemSet ); - - virtual void SetInitFocus(); -}; - - -#endif // _SVX_TABPAGE_MAIL_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx deleted file mode 100644 index c05b3e086..000000000 --- a/cui/source/inc/hlmarkwn.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_BKWND_HYPERLINK_HXX -#define _SVX_BKWND_HYPERLINK_HXX - -#include -#include -#include -#include - -#include "hlmarkwn_def.hxx" -class SvxHyperlinkTabPageBase; - -//######################################################################## -//# # -//# Tree-Window # -//# # -//######################################################################## - -class SvxHlinkDlgMarkWnd; - -class SvxHlmarkTreeLBox : public SvTreeListBox -{ -private: - SvxHlinkDlgMarkWnd* mpParentWnd; - -public: - SvxHlmarkTreeLBox( Window* pParent, const ResId& rResId ); - - virtual void Paint( const Rectangle& rRect ); -}; - -//######################################################################## -//# # -//# Window-Class # -//# # -//######################################################################## - -class SvxHlinkDlgMarkWnd : public ModalDialog //FloatingWindow -{ -private: - friend class SvxHlmarkTreeLBox; - - PushButton maBtApply; - PushButton maBtClose; - SvxHlmarkTreeLBox maLbTree; - - sal_Bool mbUserMoved; - sal_Bool mbFirst; - - SvxHyperlinkTabPageBase* mpParent; - - String maStrLastURL; - - sal_uInt16 mnError; - -protected: - sal_Bool RefreshFromDoc( ::rtl::OUString aURL ); - - SvLBoxEntry* FindEntry ( String aStrName ); - void ClearTree(); - int FillTree( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xLinks, SvLBoxEntry* pParentEntry =NULL ); - - virtual void Move (); - - DECL_LINK (ClickApplyHdl_Impl, void * ); - DECL_LINK (ClickCloseHdl_Impl, void * ); - -public: - SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent); - ~SvxHlinkDlgMarkWnd(); - - sal_Bool MoveTo ( Point aNewPos ); - void RefreshTree ( String aStrURL ); - void SelectEntry ( String aStrMark ); - - sal_Bool ConnectToDialog( sal_Bool bDoit = sal_True ); - - sal_uInt16 SetError( sal_uInt16 nError); -}; - - -#endif // _SVX_BKWND_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlmarkwn_def.hxx b/cui/source/inc/hlmarkwn_def.hxx deleted file mode 100644 index f44e6c12f..000000000 --- a/cui/source/inc/hlmarkwn_def.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_BKWND_HYPERLINK_DEF_HXX -#define _SVX_BKWND_HYPERLINK_DEF_HXX - -#define LERR_NOERROR 0 -#define LERR_NOENTRIES 1 -#define LERR_DOCNOTOPEN 2 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx deleted file mode 100644 index e90ba1495..000000000 --- a/cui/source/inc/hltpbase.hxx +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABBASE_HYPERLINK_HXX -#define _SVX_TABBASE_HYPERLINK_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "helpid.hrc" -#include - -#include "hlmarkwn.hxx" -#include "iconcdlg.hxx" - - -/************************************************************************* -|* -|* ComboBox-Control, wich is filled with all current framenames -|* -\************************************************************************/ - -class SvxFramesComboBox : public ComboBox -{ -public: - SvxFramesComboBox (Window* pParent, const ResId& rResId, SfxDispatcher* pDispatch); - ~SvxFramesComboBox (); -}; - -/************************************************************************* -|* -|* ComboBox-Control for URL's with History and Autocompletion -|* -\************************************************************************/ - -class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper -{ -private: - sal_Bool mbAccessAddress; - -protected: - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); - - virtual long Notify( NotifyEvent& rNEvt ); - virtual void Select(); - virtual void Modify(); - virtual long PreNotify( NotifyEvent& rNEvt ); - -public: - SvxHyperURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_FILE, sal_Bool bAddresses = sal_False ); - -}; - -/************************************************************************* -|* -|* Tabpage : Basisclass -|* -\************************************************************************/ - -class SvxHyperlinkTabPageBase : public IconChoicePage -{ -private: - FixedLine *mpGrpMore; - FixedText *mpFtFrame; - SvxFramesComboBox *mpCbbFrame; - FixedText *mpFtForm; - ListBox *mpLbForm; - FixedText *mpFtIndication; - Edit *mpEdIndication; - FixedText *mpFtText; - Edit *mpEdText; - ImageButton *mpBtScript; - - sal_Bool mbIsCloseDisabled; - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - mxDocumentFrame; - -protected: - Window* mpDialog; - - sal_Bool mbStdControlsInit; - - String maStrInitURL; - - Timer maTimer; - - SvxHlinkDlgMarkWnd* mpMarkWnd; - - void InitStdControls (); - virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem ); - virtual void FillDlgFields ( String& aStrURL ) = 0; - virtual void GetCurentItemData ( String& aStrURL, String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ) = 0; - virtual String CreateUiNameFromURL( const String& aStrURL ); - - void GetDataFromCommonFields( String& aStrName, - String& aStrIntName, String& aStrFrame, - SvxLinkInsertMode& eMode ); - - DECL_LINK (ClickScriptHdl_Impl, void * ); // Button : Script - - String aEmptyStr; - - sal_Bool FileExists( const INetURLObject& rURL ); - static String GetSchemeFromURL( String aStrURL ); - - inline void DisableClose( sal_Bool _bDisable ) { mbIsCloseDisabled = _bDisable; } - -public: - SvxHyperlinkTabPageBase ( - Window *pParent, - const ResId &rResId, - const SfxItemSet& rItemSet - ); - virtual ~SvxHyperlinkTabPageBase (); - - void SetDocumentFrame( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame ) - { - mxDocumentFrame = rxDocumentFrame; - } - - virtual sal_Bool AskApply (); - virtual void DoApply (); - virtual void SetOnlineMode( sal_Bool bEnable ); - virtual void SetInitFocus(); - virtual void SetMarkStr ( String& aStrMark ); - virtual void Reset( const SfxItemSet& ); - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void ActivatePage( const SfxItemSet& rItemSet ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - - sal_Bool IsMarkWndVisible () { return ((Window*)mpMarkWnd)->IsVisible(); } - Size GetSizeExtraWnd () { return ( mpMarkWnd->GetSizePixel() ); } - sal_Bool MoveToExtraWnd ( Point aNewPos, sal_Bool bDisConnectDlg = sal_False ); - - virtual void ActivatePage(); - virtual void DeactivatePage(); - virtual sal_Bool QueryClose(); - -protected: - virtual sal_Bool ShouldOpenMarkWnd(); - virtual void SetMarkWndShouldOpen(sal_Bool bOpen); - - void ShowMarkWnd (); - void HideMarkWnd () { ( ( Window* ) mpMarkWnd )->Hide(); } - void InvalidateMarkWnd () { ( ( Window* ) mpMarkWnd )->Invalidate(); } - - SfxDispatcher* GetDispatcher() const; - - sal_uInt16 GetMacroEvents(); - SvxMacroTableDtor* GetMacroTable(); - - sal_Bool IsHTMLDoc() const; -}; - -#endif // _SVX_TABBASE_HYPERLINK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx deleted file mode 100644 index 6bf036962..000000000 --- a/cui/source/inc/hyphen.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_HYPHEN_HXX -#define _SVX_HYPHEN_HXX - -// include --------------------------------------------------------------- - -#include - -#include -#include -#include -#include -#include - -// forward --------------------------------------------------------------- - -namespace com{namespace sun{namespace star{ -namespace linguistic2{ - class XHyphenator; - class XPossibleHyphens; -}}}} - -class SvxSpellWrapper; - -// class SvxHyphenWordDialog --------------------------------------------- - -struct SvxHyphenWordDialog_Impl; - -class SvxHyphenWordDialog : public SfxModalDialog -{ - std::auto_ptr< SvxHyphenWordDialog_Impl > m_pImpl; - -public: - SvxHyphenWordDialog( const String &rWord, LanguageType nLang, - Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen, - SvxSpellWrapper* pWrapper ); - virtual ~SvxHyphenWordDialog(); - - void SetWindowTitle( LanguageType nLang ); - void SelLeft(); - void SelRight(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx deleted file mode 100644 index 58e234bcc..000000000 --- a/cui/source/inc/iconcdlg.hxx +++ /dev/null @@ -1,269 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _ICCDLG_HXX -#define _ICCDLG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define CTRLS_OFFSET 3 -#define BUTTON_DISTANCE 8 -#define RET_USER 100 -#define RET_USER_CANCEL 101 - -// forward-declarations -struct IconChoicePageData; -class IconChoiceDialog; -class IconChoicePage; - -// Create-Function -typedef IconChoicePage* (*CreatePage)(Window *pParent, const SfxItemSet &rAttrSet); -typedef sal_uInt16* (*GetPageRanges)(); // liefert internationale Which-Wert - -// position of iconchoicectrl -enum EIconChoicePos { PosLeft, PosRight, PosTop, PosBottom }; - -/********************************************************************** -| -| Data-structure for pages in dialog -| -\**********************************************************************/ - -struct IconChoicePageData -{ - sal_uInt16 nId; // Die ID - CreatePage fnCreatePage; // Pointer auf die Factory - GetPageRanges fnGetRanges;// Pointer auf die Ranges-Funktion - IconChoicePage* pPage; // die TabPage selber - sal_Bool bOnDemand; // Flag: ItemSet onDemand - sal_Bool bRefresh; // Flag: Seite mu\s neu initialisiert werden - - // Konstruktor - IconChoicePageData( sal_uInt16 Id, CreatePage fnPage, GetPageRanges fnRanges, sal_Bool bDemand ) - : nId ( Id ), - fnCreatePage ( fnPage ), - fnGetRanges ( fnRanges ), - pPage ( NULL ), - bOnDemand ( bDemand ), - bRefresh ( sal_False ) - {} -}; - -/********************************************************************** -| -| IconChoicePage -| -\**********************************************************************/ - -class IconChoicePage : public TabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private : - const SfxItemSet* pSet; - String aUserString; - sal_Bool bHasExchangeSupport; - IconChoiceDialog* pDialog; - sal_Bool bStandard; - - void SetDialog( IconChoiceDialog* pNew ) { pDialog = pNew; } - IconChoiceDialog* GetDialog() const { return pDialog; } - - void SetInputSet( const SfxItemSet* pNew ) { pSet = pNew; } - - void ImplInitSettings(); - -protected : - IconChoicePage( Window *pParent, const ResId &, const SfxItemSet &rAttrSet ); - - sal_uInt16 GetSlot( sal_uInt16 nWhich ) const { return pSet->GetPool()->GetSlotId( nWhich ); } - sal_uInt16 GetWhich( sal_uInt16 nSlot ) const { return pSet->GetPool()->GetWhich( nSlot ); } - -public : - virtual ~IconChoicePage(); - - const SfxItemSet& GetItemSet() const { return *pSet; } - - virtual sal_Bool FillItemSet( SfxItemSet& ) = 0; - virtual void Reset( const SfxItemSet& ) = 0; - - sal_Bool HasExchangeSupport() const { return bHasExchangeSupport; } - void SetExchangeSupport( sal_Bool bNew = sal_True ) { bHasExchangeSupport = bNew; } - - enum { - KEEP_PAGE = 0x0000, // Fehlerbehandlung; Seite nicht wechseln - // 2. F"ullen eines ItemSets f"ur die Aktualilsierung - // "ubergeordneter Beispiele; dieser Pointer kann immer - // NULL sein!! - LEAVE_PAGE = 0x0001, - // Set aktualisieren und andere Page aktualisieren - REFRESH_SET = 0x0002 - }; - - virtual void ActivatePage( const SfxItemSet& ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - void SetUserData(const String& rString) { aUserString = rString; } - String GetUserData() { return aUserString; } - virtual void FillUserData(); - virtual sal_Bool IsReadOnly() const; - virtual sal_Bool QueryClose(); - - void StateChanged( StateChangedType nType ); - void DataChanged( const DataChangedEvent& rDCEvt ); -}; - -/********************************************************************** -| -| IconChoiceDialog -| -\**********************************************************************/ - -class IconChoiceDialog : public ModalDialog -{ -private : - friend class IconChoicePage; - - EIconChoicePos meChoicePos; // Position des IconChoiceCtrl's - ::std::vector< IconChoicePageData* > maPageList; // Liste von PageData-Pointer - - SvtIconChoiceCtrl maIconCtrl; // DAS IconChoice-Control - - sal_uInt16 mnCurrentPageId; // Id der aktuell sichtbaren Page - - // Buttons - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - PushButton aResetBtn; - - const SfxItemSet* pSet; - SfxItemSet* pOutSet; - SfxItemSet* pExampleSet; - sal_uInt16* pRanges; - - sal_uInt32 nResId; - - sal_Bool bHideResetBtn; - sal_Bool bModal; - sal_Bool bInOK; - sal_Bool bModified; - sal_Bool bItemsReset; - - DECL_LINK ( ChosePageHdl_Impl, void * ); - DECL_LINK ( OkHdl, Button * ); - DECL_LINK ( ResetHdl, Button * ); - DECL_LINK ( CancelHdl, Button * ); - - IconChoicePageData* GetPageData ( sal_uInt16 nId ); - void Start_Impl(); - sal_Bool OK_Impl(); - - void SetPosSizeCtrls ( sal_Bool bInit = sal_False ); - void SetPosSizePages ( sal_uInt16 nId ); - - void FocusOnIcon ( sal_uInt16 nId ); - -protected : - void ShowPageImpl ( IconChoicePageData* pData ); - void HidePageImpl ( IconChoicePageData* pData ); - - virtual void PageCreated( sal_uInt16 nId, IconChoicePage& rPage ); - virtual SfxItemSet* CreateInputItemSet( sal_uInt16 nId ); - inline SfxItemSet* GetInputSetImpl() { return (SfxItemSet*)pSet; } - inline IconChoicePage* GetTabPage( sal_uInt16 nPageId ) - { return ( GetPageData (nPageId)->pPage?GetPageData (nPageId)->pPage:NULL); } - const SfxItemSet* GetRefreshedSet(); - - void ActivatePageImpl (); - sal_Bool DeActivatePageImpl (); - void ResetPageImpl (); - - short Ok(); - -public : - - // im Ctor k�nnte auch die Position des IconChoiceCtrl's gesetzt werden. - - IconChoiceDialog ( Window* pParent, const ResId &rResId, - const EIconChoicePos ePos = PosLeft, const SfxItemSet * pItemSet = 0 ); - ~IconChoiceDialog (); - - /////////////////////////////////////////////////////////////////////////////////// - // virtuelle Methoden - // - virtual void Paint( const Rectangle& rRect ); - virtual void Resize(); - - /////////////////////////////////////////////////////////////////////////////////// - // Schnittstelle - // - - SvxIconChoiceCtrlEntry* AddTabPage( - sal_uInt16 nId, const String& rIconText, const Image& rChoiceIcon, - CreatePage pCreateFunc /* != NULL */, GetPageRanges pRangesFunc = NULL /* NULL allowed*/, - sal_Bool bItemsOnDemand = sal_False, sal_uLong nPos = LIST_APPEND ); - - void SetCurPageId( sal_uInt16 nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); } - sal_uInt16 GetCurPageId() const { return mnCurrentPageId; } - void ShowPage( sal_uInt16 nId ); - void RemoveTabPage( sal_uInt16 nId ); - void RemoveResetButton(); - - // liefert ggf. per Map konvertierte lokale Slots - const sal_uInt16* GetInputRanges( const SfxItemPool& ); - void SetInputSet( const SfxItemSet* pInSet ); - const SfxItemSet* GetOutputItemSet() const { return pOutSet; } - - const OKButton& GetOKButton() const { return aOKBtn; } - OKButton& GetOKButton() { return aOKBtn; } - const CancelButton& GetCancelButton() const { return aCancelBtn; } - CancelButton& GetCancelButton() { return aCancelBtn; } - const HelpButton& GetHelpButton() const { return aHelpBtn; } - HelpButton& GetHelpButton() { return aHelpBtn; } - - short Execute(); - void Start( sal_Bool bShow = sal_True ); - sal_Bool QueryClose(); - - const SfxItemSet* GetExampleSet() const { return pExampleSet; } - - EIconChoicePos SetCtrlPos ( const EIconChoicePos& rPos ); -}; - -#endif //_ICCDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx deleted file mode 100644 index fc812789c..000000000 --- a/cui/source/inc/insdlg.hxx +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_INSDLG_HXX -#define _SVX_INSDLG_HXX - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include // MultiLineEdit -#include - -class INetURLObject; - -class InsertObjectDialog_Impl : public ModalDialog -{ -protected: - com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > m_xObj; - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& m_xStorage; - comphelper::EmbeddedObjectContainer aCnt; - - InsertObjectDialog_Impl( Window * pParent, const ResId & rResId, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); -public: - com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetObject() - { return m_xObj; } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ); - virtual sal_Bool IsCreateNew() const; -}; - -class SvInsertOleDlg : public InsertObjectDialog_Impl -{ - RadioButton aRbNewObject; - RadioButton aRbObjectFromfile; - FixedLine aGbObject; - ListBox aLbObjecttype; - Edit aEdFilepath; - PushButton aBtnFilepath; - CheckBox aCbFilelink; - OKButton aOKButton1; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - String aStrFile; - String _aOldStr; - const SvObjectServerList* m_pServers; - - ::com::sun::star::uno::Sequence< sal_Int8 > m_aIconMetaFile; - ::rtl::OUString m_aIconMediaType; - - DECL_LINK( DoubleClickHdl, ListBox* ); - DECL_LINK( BrowseHdl, PushButton* ); - DECL_LINK( RadioHdl, RadioButton* ); - void SelectDefault(); - ListBox& GetObjectTypes() - { return aLbObjecttype; } - String GetFilePath() const { return aEdFilepath.GetText(); } - sal_Bool IsLinked() const { return aCbFilelink.IsChecked(); } - sal_Bool IsCreateNew() const { return aRbNewObject.IsChecked(); } - -public: - SvInsertOleDlg( Window* pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage, - const SvObjectServerList* pServers = NULL ); - virtual short Execute(); - - // get replacement for the iconified embedded object and the mediatype of the replacement - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetIconIfIconified( ::rtl::OUString* pGraphicMediaType ); -}; - -// class SvInsertPlugInDialog -------------------------------------------- - -class SvInsertPlugInDialog : public InsertObjectDialog_Impl -{ -private: - FixedLine aGbFileurl; - Edit aEdFileurl; - PushButton aBtnFileurl; - FixedLine aGbPluginsOptions; - MultiLineEdit aEdPluginsOptions; - OKButton aOKButton1; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - INetURLObject* m_pURL; - String m_aCommands; - - DECL_LINK( BrowseHdl, PushButton * ); - String GetPlugInFile() const { return aEdFileurl.GetText(); } - String GetPlugInOptions() const { return aEdPluginsOptions.GetText(); } - -public: - SvInsertPlugInDialog( Window* pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); - - ~SvInsertPlugInDialog(); - - virtual short Execute(); -}; - -// class SvInsertAppletDialog -------------------------------------------- - -class SvInsertAppletDialog : public InsertObjectDialog_Impl -{ -private: - FixedText aFtClassfile; - Edit aEdClassfile; - FixedText aFtClasslocation; - Edit aEdClasslocation; - PushButton aBtnClass; - FixedLine aGbClass; - MultiLineEdit aEdAppletOptions; - FixedLine aGbAppletOptions; - OKButton aOKButton1; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - INetURLObject* m_pURL; - String m_aClass; - String m_aCommands; - String GetClass() const { return aEdClassfile.GetText(); } - String GetClassLocation() const { return aEdClasslocation.GetText(); } - String GetAppletOptions() const { return aEdAppletOptions.GetText(); } - - void SetClass( const String &rClass ) { aEdClassfile.SetText(rClass); } - void SetClassLocation( const String &rLocation ) { aEdClasslocation.SetText(rLocation); } - void SetAppletOptions( const String &rOptions ) { aEdAppletOptions.SetText(rOptions); } - DECL_LINK( BrowseHdl, PushButton * ); - -public: - SvInsertAppletDialog( Window* pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); - SvInsertAppletDialog( Window* pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj ); - ~SvInsertAppletDialog(); - - virtual short Execute(); -}; - -class SfxInsertFloatingFrameDialog : public InsertObjectDialog_Impl -{ -private: - FixedText aFTName; - Edit aEDName; - FixedText aFTURL; - Edit aEDURL; - PushButton aBTOpen; - - FixedLine aFLScrolling; - RadioButton aRBScrollingOn; - RadioButton aRBScrollingOff; - RadioButton aRBScrollingAuto; - - - FixedLine aFLSepLeft; - FixedLine aFLFrameBorder; - RadioButton aRBFrameBorderOn; - RadioButton aRBFrameBorderOff; - - FixedLine aFLSepRight; - FixedLine aFLMargin; - FixedText aFTMarginWidth; - NumericField aNMMarginWidth; - CheckBox aCBMarginWidthDefault; - FixedText aFTMarginHeight; - NumericField aNMMarginHeight; - CheckBox aCBMarginHeightDefault; - - OKButton aOKButton1; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - - DECL_STATIC_LINK( SfxInsertFloatingFrameDialog, OpenHdl, PushButton* ); - DECL_STATIC_LINK( SfxInsertFloatingFrameDialog, CheckHdl, CheckBox* ); - -public: - SfxInsertFloatingFrameDialog( Window *pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage ); - SfxInsertFloatingFrameDialog( Window* pParent, - const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >& xObj ); - virtual short Execute(); -}; - -#endif // _SVX_INSDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/insrc.hxx b/cui/source/inc/insrc.hxx deleted file mode 100644 index bc4e4b3d4..000000000 --- a/cui/source/inc/insrc.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_INSRC_HXX -#define _SVX_INSRC_HXX - -#include - -#include -#include -#include -#include - -#include - -class SvxInsRowColDlg : public SvxAbstractInsRowColDlg, public ModalDialog -{ - FixedText aCount; - NumericField aCountEdit; - FixedLine aInsFL; - - RadioButton aBeforeBtn; - RadioButton aAfterBtn; - FixedLine aPosFL; - - String aRow; - String aCol; - - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - bool bColumn; - -public: - SvxInsRowColDlg( Window* pParent, bool bCol, const rtl::OString& sHelpId ); - - virtual short Execute(void); - - virtual bool isInsertBefore() const; - virtual sal_uInt16 getInsertCount() const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/internationaloptions.hxx b/cui/source/inc/internationaloptions.hxx deleted file mode 100644 index f2b9ee6ee..000000000 --- a/cui/source/inc/internationaloptions.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_INTERNATIONALOPTIONS_HXX_ -#define _OFFAPP_INTERNATIONALOPTIONS_HXX_ - -#include -#include - -namespace offapp -{ - class InternationalOptionsPage : public SfxTabPage - { - private: - struct IMPL; - IMPL* m_pImpl; - - protected: - InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& _rSet ); - virtual void Reset( const SfxItemSet& _rSet ); - - public: - virtual ~InternationalOptionsPage(); - - static SfxTabPage* CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet ); - static SfxTabPage* CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet ); - }; - -} // /namespace offapp - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx deleted file mode 100644 index d386791c9..000000000 --- a/cui/source/inc/labdlg.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_LABDLG_HXX -#define _SVX_LABDLG_HXX - -// include --------------------------------------------------------------- - - -#include -#include -#include -#include -#include -class SdrView; - -// class SvxCaptionTabPage ----------------------------------------------- - -const sal_uInt16 CAPTYPE_BITMAPS_COUNT = 3; - -class SvxCaptionTabPage : public SfxTabPage -{ -private: - ValueSet aCT_CAPTTYPE; - FixedText aFT_ABSTAND; - MetricField aMF_ABSTAND; - FixedText aFT_WINKEL; - ListBox aLB_WINKEL; - FixedText aFT_ANSATZ; - ListBox aLB_ANSATZ; - FixedText aFT_UM; - MetricField aMF_ANSATZ; - FixedText aFT_ANSATZ_REL; - ListBox aLB_ANSATZ_REL; - FixedText aFT_LAENGE; - MetricField aMF_LAENGE; - CheckBox aCB_LAENGE; - - Image* mpBmpCapTypes[CAPTYPE_BITMAPS_COUNT]; - - String aStrHorzList; - String aStrVertList; - - short nCaptionType; - sal_Bool bFixedAngle; - sal_Int32 nFixedAngle; - sal_Int32 nGap; - short nEscDir; - sal_Bool bEscRel; - sal_Int32 nEscAbs; - sal_Int32 nEscRel; - sal_Int32 nLineLen; - sal_Bool bFitLineLen; - - sal_uInt16 nAnsatzRelPos; - sal_uInt16 nAnsatzTypePos; - sal_uInt16 nWinkelTypePos; - -#ifdef _SVX_LABDLG_CXX - void SetupAnsatz_Impl( sal_uInt16 nType ); - void SetupType_Impl( sal_uInt16 nType ); - DECL_LINK( AnsatzSelectHdl_Impl, ListBox * ); - DECL_LINK( AnsatzRelSelectHdl_Impl, ListBox * ); - DECL_LINK( LineOptHdl_Impl, Button * ); - DECL_LINK( SelectCaptTypeHdl_Impl, void * ); -#endif - - const SfxItemSet& rOutAttrs; - const SdrView* pView; - -public: - SvxCaptionTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - virtual ~SvxCaptionTabPage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - void Construct(); - void SetView( const SdrView* pSdrView ) - { pView = pSdrView; } - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - void FillValueSet(); -}; - -// class SvxCaptionTabDialog --------------------------------------------- - -class SvxCaptionTabDialog : public SfxTabDialog -{ -private: - const SdrView* pView; - sal_uInt16 nAnchorCtrls; - - Link aValidateLink; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -public: - - SvxCaptionTabDialog(Window* pParent, const SdrView* pView, - sal_uInt16 nAnchorTypes = 0 ); - - ~SvxCaptionTabDialog(); - - //link for the Writer to validate positions - void SetValidateFramePosLink( const Link& rLink ); -}; - - -#endif //_SVX_LABDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx deleted file mode 100644 index 003677fd7..000000000 --- a/cui/source/inc/linkdlg.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _LINKDLG_HXX -#define _LINKDLG_HXX - -#include -#include -#include -#include -#include - -#include // MultiLineEdit -#include // MultiLineEdit - -/********************** SvUpdateLinksDialog ****************************** -*************************************************************************/ -namespace sfx2 -{ - class LinkManager; - class SvBaseLink; -} - -class SvBaseLinksDlg : public ModalDialog -{ - using Window::SetType; - - FixedText aFtFiles; - FixedText aFtLinks; - FixedText aFtType; - FixedText aFtStatus; - SvTabListBox aTbLinks; - FixedText aFtFiles2; - FixedText aFtFullFileName; - FixedText aFtSource2; - FixedText aFtFullSourceName; - FixedText aFtType2; - FixedText aFtFullTypeName; - FixedText aFtUpdate; - RadioButton aRbAutomatic; - RadioButton aRbManual; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - PushButton aPbUpdateNow; - PushButton aPbOpenSource; - PushButton aPbChangeSource; - PushButton aPbBreakLink; - String aStrAutolink; - String aStrManuallink; - String aStrBrokenlink; - String aStrGraphiclink; - String aStrButtonclose; - String aStrCloselinkmsg; - String aStrCloselinkmsgMulti; - String aStrWaitinglink; - sfx2::LinkManager* pLinkMgr; - sal_Bool bHtmlMode; - Timer aUpdateTimer; - -#if _SOLAR__PRIVATE - DECL_LINK( LinksSelectHdl, SvTabListBox * ); - DECL_LINK( LinksDoubleClickHdl, SvTabListBox * ); - DECL_LINK( AutomaticClickHdl, RadioButton * ); - DECL_LINK( ManualClickHdl, RadioButton * ); - DECL_LINK( UpdateNowClickHdl, PushButton * ); - DECL_LINK( OpenSourceClickHdl, PushButton * ); - DECL_LINK( ChangeSourceClickHdl, PushButton * ); - DECL_LINK( BreakLinkClickHdl, PushButton * ); - DECL_LINK( UpdateWaitingHdl, Timer * ); - DECL_LINK( EndEditHdl, sfx2::SvBaseLink* ); - sfx2::SvBaseLink* GetSelEntry( sal_uInt16* pPos ); - String ImplGetStateStr( const sfx2::SvBaseLink& ); - void SetType( sfx2::SvBaseLink& rLink, sal_uInt16 nPos, sal_uInt16 nType ); - void InsertEntry( const sfx2::SvBaseLink& rLink, sal_uInt16 nPos = LISTBOX_APPEND, sal_Bool bSelect = sal_False); -#endif - - void StartUpdateTimer() { aUpdateTimer.Start(); } - - SvTabListBox& Links() { return aTbLinks; } - FixedText& FileName() { return aFtFullFileName; } - FixedText& SourceName() { return aFtFullSourceName; } - FixedText& TypeName() { return aFtFullTypeName; } - RadioButton& Automatic() { return aRbAutomatic; } - RadioButton& Manual() { return aRbManual; } - PushButton& UpdateNow() { return aPbUpdateNow; } - PushButton& OpenSource() { return aPbOpenSource; } - PushButton& ChangeSource() { return aPbChangeSource; } - PushButton& BreakLink() { return aPbBreakLink; } - - String& Autolink() { return aStrAutolink; } - String& Manuallink() { return aStrManuallink; } - String& Brokenlink() { return aStrBrokenlink; } - String& Graphiclink() { return aStrGraphiclink; } - String& Buttonclose() { return aStrButtonclose; } - String& Closelinkmsg() { return aStrCloselinkmsg; } - String& CloselinkmsgMulti() { return aStrCloselinkmsgMulti; } - String& Waitinglink() { return aStrWaitinglink; } - void SetManager( sfx2::LinkManager* ); - -public: - SvBaseLinksDlg( Window * pParent, sfx2::LinkManager*, sal_Bool bHtml = sal_False ); - ~SvBaseLinksDlg(); - void SetActLink( sfx2::SvBaseLink * pLink ); -}; - -#endif // _LINKDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx deleted file mode 100644 index b31ec6dc0..000000000 --- a/cui/source/inc/macroass.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MACROASS_HXX -#define _MACROASS_HXX - -#include "sal/config.h" - -#include -#include -#include -#include -#include - -class _SfxMacroTabPage; -class SvStringsDtor; -class SvTabListBox; -class Edit; -class String; - -class SfxConfigGroupListBox_Impl; -class SfxConfigFunctionListBox_Impl; -class _HeaderTabListBox; -class _SfxMacroTabPage_Impl; - -class _SfxMacroTabPage : public SfxTabPage -{ - SvxMacroTableDtor aTbl; - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox * ); - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox * ); - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox * ); - - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, DoubleClickHdl_Impl, Control* ); - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton * ); - - DECL_DLLPRIVATE_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer* ); - -protected: - _SfxMacroTabPage_Impl* mpImpl; - - _SfxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet ); - - void InitAndSetHandler(); - void FillEvents(); - void FillMacroList(); - void EnableButtons(); - -public: - - virtual ~_SfxMacroTabPage(); - - void AddEvent( const String & rEventName, sal_uInt16 nEventId ); - - const SvxMacroTableDtor& GetMacroTbl() const; - void SetMacroTbl( const SvxMacroTableDtor& rTbl ); - void ClearMacroTbl(); - - virtual void ScriptChanged(); - virtual void PageCreated (SfxAllItemSet aSet); - - // --------- Erben aus der Basis ------------- - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - sal_Bool IsReadOnly() const; -}; - -inline const SvxMacroTableDtor& _SfxMacroTabPage::GetMacroTbl() const -{ - return aTbl; -} - -inline void _SfxMacroTabPage::SetMacroTbl( const SvxMacroTableDtor& rTbl ) -{ - aTbl = rTbl; -} - -inline void _SfxMacroTabPage::ClearMacroTbl() -{ - aTbl.DelDtor(); -} - -class SfxMacroTabPage : public _SfxMacroTabPage -{ -public: - SfxMacroTabPage( - Window* pParent, - const ResId& rId, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, - const SfxItemSet& rSet - ); - - // --------- Erben aus der Basis ------------- - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); -}; - -class SfxMacroAssignDlg : public SfxSingleTabDialog -{ -public: - SfxMacroAssignDlg( - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame, - const SfxItemSet& rSet ); - virtual ~SfxMacroAssignDlg(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx deleted file mode 100644 index f3827b21b..000000000 --- a/cui/source/inc/macropg.hxx +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MACROPG_HXX -#define _MACROPG_HXX - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< ::rtl::OUString, ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > EventsHash; - -struct EventDisplayName -{ - const sal_Char* pAsciiEventName; - sal_uInt16 nEventResourceID; - EventDisplayName() : pAsciiEventName( NULL ), nEventResourceID(0) { } - EventDisplayName( const sal_Char* _pAsciiName, const sal_uInt16 _nResId ) - : pAsciiEventName( _pAsciiName ) - , nEventResourceID( _nResId ) - { - } -}; -typedef ::std::vector< EventDisplayName > EventDisplayNames; - -class _SvxMacroTabPage; -class SvStringsDtor; -class SvTabListBox; -class Edit; -class String; - -class _HeaderTabListBox; -class _SvxMacroTabPage_Impl; - - -class _SvxMacroTabPage : public SfxTabPage -{ -#if _SOLAR__PRIVATE - DECL_STATIC_LINK( _SvxMacroTabPage, SelectEvent_Impl, SvTabListBox * ); - DECL_STATIC_LINK( _SvxMacroTabPage, AssignDeleteHdl_Impl, PushButton * ); - DECL_STATIC_LINK( _SvxMacroTabPage, DoubleClickHdl_Impl, SvTabListBox * ); - - static long GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton* pBtn ); - -#endif -protected: - _SvxMacroTabPage_Impl* mpImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xAppEvents; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xDocEvents; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > m_xModifiable; - EventsHash m_appEventsHash; - EventsHash m_docEventsHash; - bool bReadOnly, bDocModified, bAppEvents, bInitialized; - EventDisplayNames aDisplayNames; - - _SvxMacroTabPage( Window* pParent, const ResId& rId, const SfxItemSet& rItemSet ); - - void EnableButtons(); - ::com::sun::star::uno::Any GetPropsByName( const ::rtl::OUString& eventName, EventsHash& eventsHash ); - ::std::pair< ::rtl::OUString, ::rtl::OUString > GetPairFromAny( ::com::sun::star::uno::Any aAny ); - -public: - - virtual ~_SvxMacroTabPage(); - void InitResources(); - - void InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - - using SfxTabPage::Reset; - virtual void Reset(); - - void DisplayAppEvents( bool appEvents); - void SetReadOnly( sal_Bool bSet ); - sal_Bool IsReadOnly() const; -}; - -class SvxMacroTabPage : public _SvxMacroTabPage -{ -public: - SvxMacroTabPage( - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame, - const SfxItemSet& rSet, - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xNameReplace, - sal_uInt16 nSelectedIndex - ); - virtual ~SvxMacroTabPage(); -}; - -// class SvxMacroAssignDlg -------------------------------------------------- - -typedef sal_uInt16* (*GetTabPageRanges)(); // liefert internationale Which-Werte - -class SvxMacroAssignSingleTabDialog : public SfxModalDialog -{ -public: - SvxMacroAssignSingleTabDialog( Window* pParent, const SfxItemSet& rOptionsSet, sal_uInt16 nUniqueId ); - - virtual ~SvxMacroAssignSingleTabDialog(); - - void SetTabPage( SfxTabPage* pTabPage ); - -private: - SfxViewFrame* pFrame; - - FixedLine* pFixedLine; - - OKButton* pOKBtn; - CancelButton* pCancelBtn; - HelpButton* pHelpBtn; - - SfxTabPage* pPage; - const SfxItemSet* pOptions; - SfxItemSet* pOutSet; - -#if _SOLAR__PRIVATE - DECL_DLLPRIVATE_LINK( OKHdl_Impl, Button * ); -#endif -}; - - -class SvxMacroAssignDlg : public SvxMacroAssignSingleTabDialog -{ -public: - SvxMacroAssignDlg( - Window* pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxDocumentFrame, - const SfxItemSet& rSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace >& xNameReplace, - sal_uInt16 nSelectedIndex - ); - virtual ~SvxMacroAssignDlg(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx deleted file mode 100644 index 21fa6b9f5..000000000 --- a/cui/source/inc/measure.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_MEASURE_HXX -#define _SVX_MEASURE_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -class SdrView; - -/************************************************************************* -|* -|* Dialog zum "Andern von TextAttributen -|* -\************************************************************************/ - -class SvxMeasurePage : public SvxTabPage -{ -private: - - FixedLine aFlLine; - FixedText aFtLineDist; - MetricField aMtrFldLineDist; - FixedText aFtHelplineOverhang; - MetricField aMtrFldHelplineOverhang; - FixedText aFtHelplineDist; - MetricField aMtrFldHelplineDist; - FixedText aFtHelpline1Len; - MetricField aMtrFldHelpline1Len; - FixedText aFtHelpline2Len; - MetricField aMtrFldHelpline2Len; - TriStateBox aTsbBelowRefEdge; - FixedText aFtDecimalPlaces; - MetricField aMtrFldDecimalPlaces; - - FixedLine aFlLabel; - FixedText aFtPosition; - SvxRectCtl aCtlPosition; - TriStateBox aTsbAutoPosV; - TriStateBox aTsbAutoPosH; - TriStateBox aTsbShowUnit; - ListBox aLbUnit; - TriStateBox aTsbParallel; - - SvxXMeasurePreview aCtlPreview; - - FixedLine aFlVert; - - const SfxItemSet& rOutAttrs; - SfxItemSet aAttrSet; - const SdrView* pView; - SfxMapUnit eUnit; - - sal_Bool bPositionModified; - -#ifdef _SVX_MEASURE_CXX - void FillUnitLB(); - - DECL_LINK( ClickAutoPosHdl_Impl, void * ); - DECL_LINK( ChangeAttrHdl_Impl, void * ); -#endif - -public: - - SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs ); - ~SvxMeasurePage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { pView = pSdrView; } - virtual void PageCreated (SfxAllItemSet aSet); -}; - -/************************************************************************* -|* -|* Von SfxSingleTabDialog abgeleitet, um vom Control "uber virtuelle Methode -|* benachrichtigt werden zu k"onnen. -|* -\************************************************************************/ - -class SvxMeasureDialog : public SfxSingleTabDialog -{ -public: - SvxMeasureDialog( Window* pParent, const SfxItemSet& rAttr, - const SdrView* pView ); - ~SvxMeasureDialog(); -}; - - -#endif // _SVX_MEASURE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/multifil.hxx b/cui/source/inc/multifil.hxx deleted file mode 100644 index 80ec01cbf..000000000 --- a/cui/source/inc/multifil.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_MULTIFIL_HXX -#define _SVX_MULTIFIL_HXX - -// include --------------------------------------------------------------- - -#include "multipat.hxx" - -// #97807# ---------------------------------------------------- -#include -#include - -// class SvxMultiFileDialog ---------------------------------------------- - -class SvxMultiFileDialog : public SvxMultiPathDialog -{ -private: - // #97807# ------------------------------------- - std::map< String, ::ucbhelper::Content > aFileContentMap; - - DECL_LINK( AddHdl_Impl, PushButton * ); - DECL_LINK( DelHdl_Impl, PushButton * ); - -public: - SvxMultiFileDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ); - ~SvxMultiFileDialog(); - - String GetFiles() const { return SvxMultiPathDialog::GetPath(); } - void SetFiles( const String& rPath ) { SvxMultiPathDialog::SetPath(rPath); aDelBtn.Enable(); } -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx deleted file mode 100644 index de7f19b4f..000000000 --- a/cui/source/inc/multipat.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_MULTIPAT_HXX -#define _SVX_MULTIPAT_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include - -#include "radiobtnbox.hxx" - -// define ---------------------------------------------------------------- - -// different delimiter for Unix (:) and Windows (;) - -#ifdef UNX -#define CLASSPATH_DELIMITER ':' -#else -#define CLASSPATH_DELIMITER ';' -#endif - -// forward --------------------------------------------------------------- - -struct MultiPath_Impl; - -// class SvxMultiPathDialog ---------------------------------------------- - -class SvxMultiPathDialog : public ModalDialog -{ -protected: - FixedLine aPathFL; - ListBox aPathLB; - SvxSimpleTableContainer m_aRadioLBContainer; - svx::SvxRadioButtonListBox aRadioLB; - FixedText aRadioFT; - PushButton aAddBtn; - PushButton aDelBtn; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpButton; - - MultiPath_Impl* pImpl; - - DECL_LINK( AddHdl_Impl, PushButton * ); - DECL_LINK( DelHdl_Impl, PushButton * ); - DECL_LINK( SelectHdl_Impl, void * ); - DECL_LINK( CheckHdl_Impl, svx::SvxRadioButtonListBox * ); - -public: - SvxMultiPathDialog( Window* pParent, sal_Bool bEmptyAllowed = sal_False ); - ~SvxMultiPathDialog(); - - String GetPath() const; - void SetPath( const String& rPath ); - void SetClassPathMode(); - sal_Bool IsClassPathMode() const; - void EnableRadioButtonMode(); -}; - -#endif // #ifndef _SVX_MULTIPAT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/newtabledlg.hxx b/cui/source/inc/newtabledlg.hxx deleted file mode 100644 index 03afebbfd..000000000 --- a/cui/source/inc/newtabledlg.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_NEWTABLEDLG_HXX -#define _SVX_NEWTABLEDLG_HXX - -#include -#include -#include - -#include -#include - -class SvxNewTableDialog : public SvxAbstractNewTableDialog, public ModalDialog -{ -private: - FixedText maFtColumns; - NumericField maNumColumns; - FixedText maFtRows; - NumericField maNumRows; - - FixedLine maFlSep; - HelpButton maHelpButton; - OKButton maOkButton; - CancelButton maCancelButton; - -public: - SvxNewTableDialog( Window* pWindow ); - - virtual short Execute(void); - virtual void Apply(void); - - virtual sal_Int32 getRows() const; - virtual sal_Int32 getColumns() const; -}; - -#endif // _SVX_NEWTABLEDLG_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx deleted file mode 100644 index ead974718..000000000 --- a/cui/source/inc/numfmt.hxx +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_NUMFMT_HXX -#define _SVX_NUMFMT_HXX - -//------------------------------------------------------------------------ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//------------------------------------------------------------------------ - -class SvxNumberFormatShell; -class SvxNumberInfoItem; - -//------------------------------------------------------------------------ - -class SvxNumberPreviewImpl : public Window -{ -private: - String aPrevStr; - Color aPrevCol; - - void InitSettings( sal_Bool bForeground, sal_Bool bBackground ); - -protected: - virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -public: - SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ); - ~SvxNumberPreviewImpl(); - - void NotifyChange( const String& rPrevStr, const Color* pColor = NULL ); -}; - -// ----------------------------------------------------------------------- -#include -#include - -class SvxNumberFormatTabPage : public SfxTabPage -{ - using SfxTabPage::DeactivatePage; - -public: - ~SvxNumberFormatTabPage(); - -#if ENABLE_LAYOUT -# undef SfxTabPage -# define SfxTabPage ::SfxTabPage -#endif - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual int DeactivatePage ( SfxItemSet* pSet = NULL ); - - void SetInfoItem( const SvxNumberInfoItem& rItem ); - void SetNumberFormatList( const SvxNumberInfoItem& rItem ) - { SetInfoItem( rItem ); } - - void SetOkHdl( const Link& rOkHandler ); - void HideLanguage(sal_Bool nFlag=sal_True); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual void PageCreated (SfxAllItemSet aSet); -private: - SvxNumberFormatTabPage( Window* pParent, - const SfxItemSet& rCoreAttrs ); - FixedText aFtCategory; - ListBox aLbCategory; - FixedText aFtFormat; - ListBox aLbCurrency; - SvxFontListBox aLbFormat; - FixedText aFtLanguage; - SvxLanguageBox aLbLanguage; - CheckBox aCbSourceFormat; - SvxNumberPreviewImpl aWndPreview; - FixedLine aFlOptions; - FixedText aFtDecimals; - NumericField aEdDecimals; - CheckBox aBtnNegRed; - FixedText aFtLeadZeroes; - NumericField aEdLeadZeroes; - CheckBox aBtnThousand; - - FixedText aFtEdFormat; - Edit aEdFormat; - ImageButton aIbAdd; - ImageButton aIbInfo; - ImageButton aIbRemove; - - FixedText aFtComment; - Edit aEdComment; - Timer aResetWinTimer; - - - SvxNumberInfoItem* pNumItem; - SvxNumberFormatShell* pNumFmtShell; - sal_uLong nInitFormat; - Link fnOkHdl; - - sal_Bool bNumItemFlag; //Fuer Handling mit DocShell - sal_Bool bOneAreaFlag; - short nFixedCategory; - - long nCatHeight; - - long nCurFormatY; - long nCurFormatHeight; - long nStdFormatY; - long nStdFormatHeight; - LocalizedString sAutomaticEntry; - - Window* pLastActivWindow; - -#ifdef _SVX_NUMFMT_CXX - void Init_Impl(); - void FillCurrencyBox(); - void FillFormatListBox_Impl( SvxDelStrgs& rEntries ); - void UpdateOptions_Impl( sal_Bool bCheckCatChange ); - void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit ); - void DeleteEntryList_Impl( SvxDelStrgs& rEntries ); - void Obstructing(); - void EnableBySourceFormat_Impl(); - void SetCategory( sal_uInt16 nPos ); - String GetExpColorString( Color*& rpPreviewColor, const String& aFormatStr, short nTmpCatPos ); - void MakePreviewText( const String& rFormat ); - void ChangePreviewText( sal_uInt16 nPos ); - void AddAutomaticLanguage_Impl(LanguageType eAutoLang, sal_Bool bSelect); - // Handler - DECL_LINK( LostFocusHdl_Impl, Edit* pEd ); - DECL_LINK( DoubleClickHdl_Impl, SvxFontListBox* pLb ); - DECL_LINK( SelFormatHdl_Impl, void * ); - DECL_LINK( ClickHdl_Impl, ImageButton* pIB ); - DECL_LINK( EditHdl_Impl, Edit* pEdFormat ); - DECL_LINK( OptHdl_Impl, void * ); - DECL_LINK( TimeHdl_Impl, Timer * ); - -#endif -}; - -#include - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx deleted file mode 100644 index ed77d963a..000000000 --- a/cui/source/inc/numpages.hxx +++ /dev/null @@ -1,454 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_NUMPAGES_HXX -#define _SVX_NUMPAGES_HXX - -// include --------------------------------------------------------------- - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ----------------------------------------------------------------------- -class SvxNumRule; -class SvxBmpNumValueSet; -class SvxNumValueSet; -class ValueSet; -class SvxNumberingPreview; -class SvxBrushItem; - - -//------------------------------------------------ - -struct SvxNumSettings_Impl -{ - short nNumberType; - short nParentNumbering; - rtl::OUString sPrefix; - rtl::OUString sSuffix; - rtl::OUString sBulletChar; - rtl::OUString sBulletFont; - SvxNumSettings_Impl() : - nNumberType(0), - nParentNumbering(0) - {} -}; - -typedef SvxNumSettings_Impl* SvxNumSettings_ImplPtr; -SV_DECL_PTRARR_DEL(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr,8,4) - - -//------------------------------------------------ -class SvxSingleNumPickTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aValuesFL; - SvxNumValueSet* pExamplesVS; - SvxNumSettingsArr_Impl aNumSettingsArr; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - sal_uInt16 nActNumLvl; - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - - String sNumCharFmtName; - sal_uInt16 nNumItemId; - - protected: - DECL_LINK( NumSelectHdl_Impl, ValueSet*); - DECL_LINK( DoubleClickHdl_Impl, ValueSet* ); - - public: - SvxSingleNumPickTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxSingleNumPickTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;} -}; - - -//------------------------------------------------ - -class SvxBulletPickTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aValuesFL; - SvxNumValueSet* pExamplesVS; - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - sal_uInt16 nActNumLvl; - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - sal_uInt16 nNumItemId; - - String sBulletCharFmtName; - protected: - DECL_LINK(NumSelectHdl_Impl, ValueSet*); - DECL_LINK( DoubleClickHdl_Impl, ValueSet* ); - public: - SvxBulletPickTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxBulletPickTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void SetCharFmtName(const String& rName){sBulletCharFmtName = rName;} - virtual void PageCreated(SfxAllItemSet aSet); -}; - -/*-------------------------------------------------- - TabPage fuer vollstaendig Numerierung ---------------------------------------------------*/ -#define NUMTYPE_MEMBER 4 // Anzahl der Elemente des FormatStrings je Ebene -#define NUM_VALUSET_COUNT 16 -class SvxNumPickTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aValuesFL; - SvxNumValueSet* pExamplesVS; - String sNumCharFmtName; - String sBulletCharFmtName; - - SvxNumSettingsArr_Impl aNumSettingsArrays[NUM_VALUSET_COUNT]; // wird mit den fuenf Formaten initialisiert - - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - sal_uInt16 nActNumLvl; - sal_uInt16 nNumItemId; - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - - - protected: - DECL_LINK(NumSelectHdl_Impl, ValueSet*); - DECL_LINK( DoubleClickHdl_Impl, ValueSet* ); - - public: - SvxNumPickTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxNumPickTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void SetCharFmtNames(const String& rCharName, const String& rBulName) - { sNumCharFmtName = rCharName; - sBulletCharFmtName = rBulName;} - virtual void PageCreated(SfxAllItemSet aSet); -}; - - -//------------------------------------------------ -class SvxBitmapPickTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aValuesFL; - SvxBmpNumValueSet* pExamplesVS; - FixedText aErrorText; - CheckBox aLinkedCB; - - std::vector aGrfNames; - String sNumCharFmtName; - - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - sal_uInt16 nActNumLvl; - sal_uInt16 nNumItemId; - SfxMapUnit eCoreUnit; - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - - protected: - DECL_LINK( NumSelectHdl_Impl, ValueSet*); - DECL_LINK( DoubleClickHdl_Impl, ValueSet* ); - DECL_LINK( LinkBmpHdl_Impl, CheckBox* ); - - public: - SvxBitmapPickTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxBitmapPickTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void SetNumCharFmtName(const String& rName){sNumCharFmtName = rName;} -}; - -//------------------------------------------------ -class SvxNumOptionsTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aFormatFL; - FixedText aLevelFT; - MultiListBox aLevelLB; - - FixedText aFmtFT; - ListBox aFmtLB; - FixedText aPrefixFT; - Edit aPrefixED; - FixedText aSuffixFT; - Edit aSuffixED; - FixedText aCharFmtFT; - ListBox aCharFmtLB; - FixedText aBulColorFT; - ColorListBox aBulColLB; - FixedText aBulRelSizeFT; - MetricField aBulRelSizeMF; - FixedText aAllLevelFT; - NumericField aAllLevelNF; - FixedText aStartFT; - NumericField aStartED; - PushButton aBulletPB; - FixedText aAlignFT; - ListBox aAlignLB; - FixedText aBitmapFT; - MenuButton aBitmapMB; - FixedText aSizeFT; - MetricField aWidthMF; - FixedText aMultFT; - MetricField aHeightMF; - CheckBox aRatioCB; - FixedText aOrientFT; - ListBox aOrientLB; - - FixedLine aSameLevelFL; - CheckBox aSameLevelCB; - - String sNumCharFmtName; - String sBulletCharFmtName; - - Timer aInvalidateTimer; - - SvxNumberingPreview* pPreviewWIN; - - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - - Size aInitSize[SVX_MAX_NUM]; - - sal_Bool bLastWidthModified : 1; - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - sal_Bool bAutomaticCharStyles: 1; - sal_Bool bHTMLMode : 1; - sal_Bool bMenuButtonInitialized : 1; - - std::vector aGrfNames; - Font aActBulletFont; - String sBullet; - String sStartWith; - - sal_uInt8 nBullet; - sal_uInt16 nActNumLvl; - sal_uInt16 nNumItemId; - SfxMapUnit eCoreUnit; - - void InitControls(); - void SwitchNumberType( sal_uInt8 nType, sal_Bool bBmp = sal_False ); - void CheckForStartValue_Impl(sal_uInt16 nNumberingType); - - DECL_LINK( NumberTypeSelectHdl_Impl, ListBox * ); - DECL_LINK( LevelHdl_Impl, ListBox * ); - DECL_LINK( PopupActivateHdl_Impl, Menu * ); - DECL_LINK( GraphicHdl_Impl, MenuButton * ); - DECL_LINK( BulletHdl_Impl, Button * ); - DECL_LINK( SizeHdl_Impl, MetricField * ); - DECL_LINK( RatioHdl_Impl, CheckBox * ); - DECL_LINK( CharFmtHdl_Impl, ListBox * ); - DECL_LINK( EditModifyHdl_Impl, Edit * ); - DECL_LINK( AllLevelHdl_Impl, NumericField * ); - DECL_LINK( OrientHdl_Impl, ListBox * ); - DECL_LINK( SameLevelHdl_Impl, CheckBox * ); - DECL_LINK( BulColorHdl_Impl, ColorListBox* ); - DECL_LINK( BulRelSizeHdl_Impl, MetricField *); - DECL_LINK( PreviewInvalidateHdl_Impl, Timer* ); - - DECL_STATIC_LINK( SvxNumOptionsTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* ); - - public: - SvxNumOptionsTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxNumOptionsTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void SetCharFmts(const String& rNumName, const String& rBulletName ) - { - sNumCharFmtName = rNumName; - sBulletCharFmtName = rBulletName; - } - void SetMetric(FieldUnit eSet); - - ListBox& GetCharFmtListBox() {return aCharFmtLB;} - void SetModified(sal_Bool bRepaint = sal_True); - virtual void PageCreated(SfxAllItemSet aSet); -}; - -//------------------------------------------------ -class SvxNumPositionTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - FixedLine aPositionFL; - FixedText aLevelFT; - MultiListBox aLevelLB; - - // former set of controls shown for numbering rules containing list level - // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION - FixedText aDistBorderFT; - MetricField aDistBorderMF; - CheckBox aRelativeCB; - FixedText aIndentFT; - MetricField aIndentMF; - FixedText aDistNumFT; - MetricField aDistNumMF; - FixedText aAlignFT; - ListBox aAlignLB; - - // new set of controls shown for numbering rules containing list level - // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT - FixedText aLabelFollowedByFT; - ListBox aLabelFollowedByLB; - FixedText aListtabFT; - MetricField aListtabMF; - FixedText aAlign2FT; - ListBox aAlign2LB; - FixedText aAlignedAtFT; - MetricField aAlignedAtMF; - FixedText aIndentAtFT; - MetricField aIndentAtMF; - - PushButton aStandardPB; - -#if OSL_DEBUG_LEVEL > 1 - FixedText* pDebugFixedText; -#endif - SvxNumberingPreview* pPreviewWIN; - - SvxNumRule* pActNum; - SvxNumRule* pSaveNum; - - sal_uInt16 nActNumLvl; - sal_uInt16 nNumItemId; - SfxMapUnit eCoreUnit; - - sal_Bool bModified : 1; - sal_Bool bPreset : 1; - sal_Bool bInInintControl : 1; //Modify-Fehler umgehen, soll ab 391 behoben sein - bool bLabelAlignmentPosAndSpaceModeActive; - - void InitControls(); - - DECL_LINK( LevelHdl_Impl, ListBox * ); - DECL_LINK( EditModifyHdl_Impl, Edit*); - DECL_LINK( DistanceHdl_Impl, MetricField * ); - DECL_LINK( RelativeHdl_Impl, CheckBox * ); - DECL_LINK( StandardHdl_Impl, PushButton * ); - - void InitPosAndSpaceMode(); - void ShowControlsDependingOnPosAndSpaceMode(); - - DECL_LINK( LabelFollowedByHdl_Impl, ListBox* ); - DECL_LINK( ListtabPosHdl_Impl, MetricField* ); - DECL_LINK( AlignAtHdl_Impl, MetricField* ); - DECL_LINK( IndentAtHdl_Impl, MetricField* ); - -public: - SvxNumPositionTabPage(Window* pParent, - const SfxItemSet& rSet); - ~SvxNumPositionTabPage(); - - virtual void ActivatePage(const SfxItemSet& rSet); - virtual int DeactivatePage(SfxItemSet *pSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet); - - void SetMetric(FieldUnit eSet); - void SetModified(sal_Bool bRepaint = sal_True); - virtual void PageCreated(SfxAllItemSet aSet); -}; - -#endif - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx deleted file mode 100644 index 1a21ab193..000000000 --- a/cui/source/inc/optasian.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTASIAN_HXX -#define _SVX_OPTASIAN_HXX - -#include -#include -#include -#include -#include -#include -#include -struct SvxAsianLayoutPage_Impl; -class SvxAsianLayoutPage : public SfxTabPage -{ - FixedLine aKerningGB; - RadioButton aCharKerningRB; - RadioButton aCharPunctKerningRB; - - FixedLine aCharDistGB; - RadioButton aNoCompressionRB; - RadioButton aPunctCompressionRB; - RadioButton aPunctKanaCompressionRB; - - FixedLine aStartEndGB; - - FixedText aLanguageFT; - SvxLanguageBox aLanguageLB; - CheckBox aStandardCB; - - FixedText aStartFT; - Edit aStartED; - FixedText aEndFT; - Edit aEndED; - FixedText aHintFT; - - SvxAsianLayoutPage_Impl* pImpl; - - DECL_LINK(LanguageHdl, SvxLanguageBox*); - DECL_LINK(ChangeStandardHdl, CheckBox*); - DECL_LINK(ModifyHdl, Edit*); - - SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet ); -public: - - virtual ~SvxAsianLayoutPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - static sal_uInt16* GetRanges(); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx deleted file mode 100644 index 1197f4b1a..000000000 --- a/cui/source/inc/optdict.hxx +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTDICT_HXX -#define _SVX_OPTDICT_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -namespace com{namespace sun{namespace star{ -namespace linguistic2{ - class XDictionary; - class XSpellChecker1; - class XSpellChecker; -}}}} - -// forward --------------------------------------------------------------- - - -// class SvxNewDictionaryDialog ------------------------------------------ - -class SvxNewDictionaryDialog : public ModalDialog -{ -private: - FixedLine aNewDictBox; - FixedText aNameText; - Edit aNameEdit; - FixedText aLanguageText; - SvxLanguageBox aLanguageLB; - CheckBox aExceptBtn; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XDictionary > xNewDic; - -#ifdef _SVX_OPTDICT_CXX - DECL_LINK( OKHdl_Impl, Button * ); - DECL_LINK( ModifyHdl_Impl, Edit * ); -#endif - -public: - SvxNewDictionaryDialog( Window* pParent, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl ); - - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XDictionary > - GetNewDictionary() { return xNewDic; } -}; - -// class SvxDictEdit ---------------------------------------------------- - -class SvxDictEdit : public Edit -{ - Link aActionLink; - sal_Bool bSpaces; - - public: - SvxDictEdit(Window* pParent, const ResId& rResId) : - Edit(pParent, rResId), bSpaces(sal_False){} - - void SetActionHdl( const Link& rLink ) - { aActionLink = rLink;} - - void SetSpaces(sal_Bool bSet) - {bSpaces = bSet;} - - virtual void KeyInput( const KeyEvent& rKEvent ); -}; - -// class SvxEditDictionaryDialog ----------------------------------------- - -class SvxEditDictionaryDialog : public ModalDialog -{ -private: - - FixedText aBookFT; - ListBox aAllDictsLB; - FixedText aLangFT; - SvxLanguageBox aLangLB; - - FixedText aWordFT; - SvxDictEdit aWordED; - FixedText aReplaceFT; - SvxDictEdit aReplaceED; - SvTabListBox aWordsLB; - PushButton aNewReplacePB; - PushButton aDeletePB; - FixedLine aEditDictsBox; - - HelpButton aHelpBtn; - CancelButton aCloseBtn; - String sModify; - String sNew; - DecorationView aDecoView; - - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; - - short nOld; - long nWidth; - sal_Bool bFirstSelect; - sal_Bool bDoNothing; - sal_Bool bDicIsReadonly; - -#ifdef _SVX_OPTDICT_CXX - DECL_LINK( SelectBookHdl_Impl, ListBox * ); - DECL_LINK( SelectLangHdl_Impl, ListBox * ); - DECL_LINK(SelectHdl, SvTabListBox*); - DECL_LINK(NewDelHdl, PushButton*); - DECL_LINK(ModifyHdl, Edit*); - - - void ShowWords_Impl( sal_uInt16 nId ); - void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage ); - sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; } - void SetDicReadonly_Impl( ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XDictionary > &xDic ); - - void RemoveDictEntry(SvLBoxEntry* pEntry); - sal_uInt16 GetLBInsertPos(const String &rDicWord); - -#endif - -protected: - - virtual void Paint( const Rectangle& rRect ); - -public: - SvxEditDictionaryDialog( Window* pParent, - const String& rName, - ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSpellChecker1> &xSpl ); - ~SvxEditDictionaryDialog(); - - sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();} -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/optimprove.hxx b/cui/source/inc/optimprove.hxx deleted file mode 100644 index aee4c19cf..000000000 --- a/cui/source/inc/optimprove.hxx +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTIMPROVE_HXX -#define _SVX_OPTIMPROVE_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include - -// class SvxImprovementPage ---------------------------------------------- - -class SvxImprovementPage : public TabPage -{ -private: - FixedLine m_aImproveFL; - FixedText m_aInvitationFT; - RadioButton m_aYesRB; - RadioButton m_aNoRB; - FixedLine m_aDataFL; - FixedText m_aNumberOfReportsFT; - FixedText m_aNumberOfReportsValueFT; - FixedText m_aNumberOfActionsFT; - FixedText m_aNumberOfActionsValueFT; - PushButton m_aShowDataPB; - - String m_sInfo; - String m_sMoreInfo; - -public: - SvxImprovementPage( Window* pParent ); - ~SvxImprovementPage(); - - inline bool IsYesChecked() const { return m_aYesRB.IsChecked() != sal_False; } - - inline String GetPageText() const { return GetText(); } - inline String GetInvitationText() const { return m_aInvitationFT.GetText(); } - inline String GetYesButtonText() const { return m_aYesRB.GetText(); } - inline String GetNoButtonText() const { return m_aNoRB.GetText(); } - inline String GetInfoText() const { return m_sInfo; } - inline String GetTitleText() const { return m_aImproveFL.GetText(); } -}; - -class SvxImprovementOptionsPage : public SfxTabPage -{ -private: - FixedLine m_aImproveFL; - FixedText m_aInvitationFT; - RadioButton m_aYesRB; - RadioButton m_aNoRB; - svt::FixedHyperlinkImage m_aInfoFI; - FixedLine m_aDataFL; - FixedText m_aNumberOfReportsFT; - FixedText m_aNumberOfReportsValueFT; - FixedText m_aNumberOfActionsFT; - FixedText m_aNumberOfActionsValueFT; - PushButton m_aShowDataPB; - - String m_sInfo; - String m_sMoreInfo; - ::rtl::OUString m_sLogPath; - - SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ); - - DECL_LINK( HandleHyperlink, svt::FixedHyperlinkImage * ); - DECL_LINK( HandleShowData, PushButton * ); - -public: - virtual ~SvxImprovementOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -class SvxImprovementDialog : public SfxSingleTabDialog -{ -private: - SvxImprovementPage* m_pPage; - - DECL_LINK( HandleOK, OKButton * ); - DECL_LINK( HandleHyperlink, svt::FixedHyperlinkImage * ); - -public: - SvxImprovementDialog( Window* pParent, const String& rInfoURL ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx deleted file mode 100644 index 7e8b6b8cb..000000000 --- a/cui/source/inc/optlingu.hxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTLINGU_HXX -#define _SVX_OPTLINGU_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace com{namespace sun{namespace star{ -namespace beans{ - class XPropertySet; -} -namespace linguistic2{ - class XDictionary; - class XDictionaryList; - class XSpellChecker; -}}}} - -class SvLBoxEntry; -class SvxLinguData_Impl; - -// define ---------------------------------------------------------------- - -#define GROUP_MODULES ((sal_uInt16)0x0008) - -// forward --------------------------------------------------------------- - -class SvxEditModulesDlg : public ModalDialog -{ - FixedLine aModulesFL; - FixedText aLanguageFT; - SvxLanguageBox aLanguageLB; - - SvxCheckListBox aModulesCLB; - PushButton aPrioUpPB; - PushButton aPrioDownPB; - PushButton aBackPB; - svt::FixedHyperlink aMoreDictsLink; - - FixedLine aButtonsFL; - HelpButton aHelpPB; - OKButton aClosePB; - - String sSpell; - String sHyph; - String sThes; - String sGrammar; - - SvxLinguData_Impl* pDefaultLinguData; - SvxLinguData_Impl& rLinguData; - - SvLBoxButtonData* pCheckButtonData; - - SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol); - -#ifdef _SVX_OPTLINGU_CXX - DECL_LINK( SelectHdl_Impl, SvxCheckListBox * ); - DECL_LINK( UpDownHdl_Impl, PushButton * ); - DECL_LINK( ClickHdl_Impl, PushButton * ); - DECL_LINK( BackHdl_Impl, PushButton * ); - DECL_LINK( SelectHdlLB_Impl, ListBox * ); - DECL_LINK( LangSelectHdl_Impl, ListBox* ); - DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox * ); - DECL_LINK( OpenURLHdl_Impl, svt::FixedHyperlink* ); -#endif - -public: - SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData); - virtual ~SvxEditModulesDlg(); -}; - -// class SvxLinguTabPage ------------------------------------------------- - -class SvxLinguTabPage : public SfxTabPage -{ -private: - FixedLine aLinguisticFL; - FixedText aLinguModulesFT; - SvxCheckListBox aLinguModulesCLB; - PushButton aLinguModulesEditPB; - FixedText aLinguDicsFT; - SvxCheckListBox aLinguDicsCLB; - PushButton aLinguDicsNewPB; - PushButton aLinguDicsEditPB; - PushButton aLinguDicsDelPB; - FixedText aLinguOptionsFT; - SvxCheckListBox aLinguOptionsCLB; - PushButton aLinguOptionsEditPB; - svt::FixedHyperlink aMoreDictsLink; - - String sCapitalWords; - String sWordsWithDigits; - String sCapitalization; - String sSpellSpecial; - String sSpellAuto; - String sGrammarAuto; - String sNumMinWordlen; - String sNumPreBreak; - String sNumPostBreak; - String sHyphAuto; - String sHyphSpecial; - - com::sun::star::uno::Reference< - com::sun::star::beans::XPropertySet > xProp; - - com::sun::star::uno::Reference< - com::sun::star::linguistic2::XDictionaryList > xDicList; - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::linguistic2::XDictionary > > aDics; - - SvLBoxButtonData* pCheckButtonData; - - SvxLinguData_Impl* pLinguData; - - SvxLinguTabPage( Window* pParent, const SfxItemSet& rCoreSet ); - SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol); - - void AddDicBoxEntry( const com::sun::star::uno::Reference< com::sun::star::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx ); - sal_uLong GetDicUserData( const com::sun::star::uno::Reference< com::sun::star::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx ); - -#ifdef _SVX_OPTLINGU_CXX - DECL_LINK( SelectHdl_Impl, SvxCheckListBox * ); - DECL_LINK( ClickHdl_Impl, PushButton * ); - DECL_LINK( BoxDoubleClickHdl_Impl, SvTreeListBox * ); - DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox * ); - DECL_LINK( PostDblClickHdl_Impl, SvTreeListBox * ); - DECL_LINK( OpenURLHdl_Impl, svt::FixedHyperlink* ); - - void UpdateModulesBox_Impl(); - void UpdateDicBox_Impl(); -#endif - -public: - virtual ~SvxLinguTabPage(); - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void HideGroups( sal_uInt16 nGrp ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx deleted file mode 100644 index 141ff9b00..000000000 --- a/cui/source/inc/optpath.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTPATH_HXX -#define _SVX_OPTPATH_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include - -#ifdef _SVX_OPTPATH_CXX -#include -#else -class HeaderBar; -#endif -#include "ControlFocusHelper.hxx" - -#include -#include - -// forward --------------------------------------------------------------- - -class SvTabListBox; -namespace svx -{ - class OptHeaderTabListBox; -} -struct OptPath_Impl; -class SvxPathTabPage; - -// define ---------------------------------------------------------------- - -#define SfxPathTabPage SvxPathTabPage - -// class SvxPathTabPage -------------------------------------------------- - -class SvxPathTabPage : public SfxTabPage -{ -private: - FixedLine aStdBox; - FixedText aTypeText; - FixedText aPathText; - SvxControlFocusHelper aPathCtrl; - PushButton aStandardBtn; - PushButton aPathBtn; - - HeaderBar* pHeaderBar; - ::svx::OptHeaderTabListBox* pPathBox; - OptPath_Impl* pImpl; - - ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; - -#ifdef _SVX_OPTPATH_CXX - void ChangeCurrentEntry( const String& _rFolder ); - - DECL_LINK( PathHdl_Impl, PushButton * ); - DECL_LINK( StandardHdl_Impl, PushButton * ); - - DECL_LINK( PathSelect_Impl, svx::OptHeaderTabListBox * ); - DECL_LINK( HeaderSelect_Impl, HeaderBar * ); - DECL_LINK( HeaderEndDrag_Impl, HeaderBar * ); - - DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* ); - - void GetPathList( sal_uInt16 _nPathHandle, String& _rInternalPath, - String& _rUserPath, String& _rWritablePath, sal_Bool& _rReadOnly ); - void SetPathList( sal_uInt16 _nPathHandle, - const String& _rUserPath, const String& _rWritablePath ); -#endif - -public: - SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxPathTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx deleted file mode 100644 index 7ddd00a7b..000000000 --- a/cui/source/inc/page.hxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_PAGE_HXX -#define _SVX_PAGE_HXX - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// class SvxPageDescPage ------------------------------------------------- - -/* {k:\svx\prototyp\dialog\page.bmp} - - [Beschreibung] - TabPage zur Einstellung einer Seite (Groesse, Raender, ...) - - [Items] - : - : - : - : - : - : - : - : - : - - : - : - : - : - : - : - : - - : - : - : - : - : - : - : -*/ - -struct SvxPage_Impl; -typedef sal_uInt16 MarginPosition; - -class SvxPageDescPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - - // paper format - FixedLine aPaperSizeFl; - FixedText aPaperFormatText; - ListBox aPaperSizeBox; - - FixedText aPaperWidthText; - MetricField aPaperWidthEdit; - FixedText aPaperHeightText; - MetricField aPaperHeightEdit; - - FixedText aOrientationFT; - RadioButton aPortraitBtn; - RadioButton aLandscapeBtn; - - SvxPageWindow aBspWin; - - FixedText aTextFlowLbl; - svx::FrameDirectionListBox aTextFlowBox; - - FixedText aPaperTrayLbl; - ListBox aPaperTrayBox; - - // Margins - FixedLine aMarginFl; - FixedText aLeftMarginLbl; - MetricField aLeftMarginEdit; - FixedText aRightMarginLbl; - MetricField aRightMarginEdit; - FixedText aTopMarginLbl; - MetricField aTopMarginEdit; - FixedText aBottomMarginLbl; - MetricField aBottomMarginEdit; - - FixedLine aBottomSeparatorFl; - // layout settings - FixedLine aLayoutFL; - FixedText aPageText; - ListBox aLayoutBox; - FixedText aNumberFormatText; - ListBox aNumberFormatBox; - - - //Extras Calc - FixedText aTblAlignFT; - CheckBox aHorzBox; - CheckBox aVertBox; - - // Impress and Draw - CheckBox aAdaptBox; - - //Register Writer - CheckBox aRegisterCB; - FixedText aRegisterFT; - ListBox aRegisterLB; - - String sStandardRegister; - - String aInsideText; - String aOutsideText; - String aLeftText; - String aRightText; - String aPrintRangeQueryText; - - long nFirstLeftMargin; - long nFirstRightMargin; - long nFirstTopMargin; - long nFirstBottomMargin; - long nLastLeftMargin; - long nLastRightMargin; - long nLastTopMargin; - long nLastBottomMargin; - - Size aMaxSize; - sal_Bool bLandscape; - bool bBorderModified; - SvxModeType eMode; - Paper ePaperStart; - Paper ePaperEnd; - - SvxPage_Impl* pImpl; - -#ifdef _SVX_PAGE_CXX - void Init_Impl(); - DECL_LINK( LayoutHdl_Impl, ListBox* ); - DECL_LINK( PaperBinHdl_Impl, ListBox* ); - DECL_LINK( SwapOrientation_Impl, RadioButton* ); - void SwapFirstValues_Impl( bool bSet ); - DECL_LINK( BorderModify_Impl, MetricField* ); - void InitHeadFoot_Impl( const SfxItemSet& rSet ); - DECL_LINK( CenterHdl_Impl, CheckBox* ); - void UpdateExample_Impl( bool bResetbackground = false ); - - // Papiergroesse - DECL_LINK( PaperSizeSelect_Impl, ListBox* ); - DECL_LINK( PaperSizeModify_Impl, Edit* ); - - DECL_LINK( FrameDirectionModify_Impl, ListBox* ); - - // Hintergrund - void ResetBackground_Impl( const SfxItemSet& rSet ); - - // Grenzwerte - DECL_LINK( RangeHdl_Impl, Edit* ); - void CalcMargin_Impl(); - - // Registerhaltigkeit - DECL_LINK( RegisterModify, CheckBox * ); - - // page direction - /** Disables vertical page direction entries in the text flow listbox. */ - void DisableVerticalPageDir(); - - bool IsPrinterRangeOverflow( MetricField& rField, long nFirstMargin, - long nLastMargin, MarginPosition nPos ); - void CheckMarginEdits( bool _bClear ); - bool IsMarginOutOfRange(); -#endif - - SvxPageDescPage( Window* pParent, const SfxItemSet& rSet ); - -protected: - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rOutSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); - - virtual ~SvxPageDescPage(); - - void SetMode( SvxModeType eMType ) { eMode = eMType; } - void SetPaperFormatRanges( Paper eStart, Paper eEnd ) - { ePaperStart = eStart, ePaperEnd = eEnd; } - - void SetCollectionList(const std::vector &aList); - virtual void PageCreated (SfxAllItemSet aSet); -}; - -#endif // #ifndef _SVX_PAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx deleted file mode 100644 index ec92a369f..000000000 --- a/cui/source/inc/paragrph.hxx +++ /dev/null @@ -1,319 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_PARAGRPH_HXX -#define _SVX_PARAGRPH_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include // SvxRelativeField -#include // Preview -#include -#include -#include - -// forward --------------------------------------------------------------- - -class SvxLineSpacingItem; -class SvxParagraphControllerItem; - -// class SvxStdParagraphTabPage ------------------------------------------ - -/* {k:\svx\prototyp\dialog\parastd.bmp} - - [Beschreibung] - Mit dieser TabPage koennen Standard-Attribute eines Absatzes eingestellt - werden (Einzug, Abstand, Ausrichtung, Zeilenabstand). - - [Items] - - - - -*/ - -class SvxStdParagraphTabPage: public SfxTabPage -{ - using TabPage::DeactivatePage; - -private: - SvxStdParagraphTabPage( Window* pParent, const SfxItemSet& rSet ); - - FixedLine aIndentFrm; - // Einzug - FixedText aLeftLabel; - SvxRelativeField aLeftIndent; - - FixedText aRightLabel; - SvxRelativeField aRightIndent; - - FixedText aFLineLabel; - SvxRelativeField aFLineIndent; - CheckBox aAutoCB; - - FixedLine aDistFrm; - - // Abstaende - FixedText aTopLabel; - SvxRelativeField aTopDist; - FixedText aBottomLabel; - SvxRelativeField aBottomDist; - - // Zeilenabstand - FixedLine aLineDistFrm; - ListBox aLineDist; - FixedText aLineDistAtLabel; - MetricField aLineDistAtPercentBox; - MetricField aLineDistAtMetricBox; - String sAbsDist; - SvxParaPrevWindow aExampleWin; - - //Registerhaltigkeit - nur Writer - FixedLine aRegisterFL; - CheckBox aRegisterCB; - - Edit* pActLineDistFld; - long nAbst; - long nWidth; - long nMinFixDist; - sal_Bool bRelativeMode; - sal_Bool bNegativeIndents; - -#ifdef _SVX_PARAGRPH_CXX - void SetLineSpacing_Impl( const SvxLineSpacingItem& rAttr ); - void Init_Impl(); - void UpdateExample_Impl( sal_Bool bAll = sal_False ); - - DECL_LINK( LineDistHdl_Impl, ListBox* ); - DECL_LINK( ModifyHdl_Impl, SvxRelativeField* ); - DECL_LINK( AutoHdl_Impl, CheckBox* ); -#endif - -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - DECL_LINK( ELRLoseFocusHdl, Edit* ); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - - void SetPageWidth( sal_uInt16 nPageWidth ); - void EnableRelativeMode(); - void EnableRegisterMode(); - void EnableAutoFirstLine(); - void EnableAbsLineDist(long nMinTwip); - void EnableNegativeMode(); - virtual void PageCreated(SfxAllItemSet aSet); -}; - -// class SvxParaAlignTabPage ------------------------------------------------ - -class SvxParaAlignTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - - // Ausrichtung - FixedLine aAlignFrm; - RadioButton aLeft; - RadioButton aRight; - RadioButton aCenter; - RadioButton aJustify; - FixedText aLastLineFT; - ListBox aLastLineLB; - CheckBox aExpandCB; - - CheckBox aSnapToGridCB; - - //preview - SvxParaPrevWindow aExampleWin; - //vertical alignment - FixedLine aVertAlignFL; - - FixedText aVertAlignFT; - ListBox aVertAlignLB; - - FixedLine aPropertiesFL; - FixedText aTextDirectionFT; - svx::FrameDirectionListBox aTextDirectionLB; - -#ifdef _SVX_PARAGRPH_CXX - DECL_LINK( AlignHdl_Impl, RadioButton* ); - DECL_LINK( LastLineHdl_Impl, ListBox* ); - DECL_LINK( TextDirectionHdl_Impl, ListBox* ); - - void UpdateExample_Impl( sal_Bool bAll = sal_False ); -#endif - - SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~SvxParaAlignTabPage(); - -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void EnableJustifyExt(); - virtual void PageCreated(SfxAllItemSet aSet); -}; - -// class SvxExtParagraphTabPage ------------------------------------------ - -/* {k:\svx\prototyp\dialog\paraext.bmp} - - [Beschreibung] - Mit dieser TabPage koennen Spezial-Attribute eines Absatzes eingestellt - werden (Silbentrennung, Seitenumbruch, Schusterjungen, Hurenkinder, ...). - - [Items] - - - - - -*/ - -class SvxExtParagraphTabPage: public SfxTabPage -{ - using TabPage::DeactivatePage; - -public: - virtual ~SvxExtParagraphTabPage(); - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void DisablePageBreak(); - -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -private: - SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rSet ); - - // Silbentrennung - FixedLine aExtFL; - TriStateBox aHyphenBox; - FixedText aBeforeText; - NumericField aExtHyphenBeforeBox; - FixedText aAfterText; - NumericField aExtHyphenAfterBox; - FixedText aMaxHyphenLabel; - NumericField aMaxHyphenEdit; - - // Seitenumbruch - FixedLine aBreaksFL; - TriStateBox aPageBreakBox; - FixedText aBreakTypeFT; - ListBox aBreakTypeLB; - FixedText aBreakPositionFT; - ListBox aBreakPositionLB; - TriStateBox aApplyCollBtn; - ListBox aApplyCollBox; - FixedText aPagenumText; - NumericField aPagenumEdit; - - FixedLine aExtendFL; - - // Absatzteilung - TriStateBox aKeepTogetherBox; - TriStateBox aKeepParaBox; - - // Witwen/Waisen - TriStateBox aOrphanBox; - NumericField aOrphanRowNo; - FixedText aOrphanRowLabel; - - TriStateBox aWidowBox; - NumericField aWidowRowNo; - FixedText aWidowRowLabel; - - sal_Bool bPageBreak; - sal_Bool bHtmlMode; - sal_uInt16 nStdPos; - -#ifdef _SVX_PARAGRPH_CXX - DECL_LINK( PageBreakHdl_Impl, TriStateBox* ); - DECL_LINK( KeepTogetherHdl_Impl, TriStateBox* ); - DECL_LINK( WidowHdl_Impl, TriStateBox* ); - DECL_LINK( OrphanHdl_Impl, TriStateBox* ); - DECL_LINK( HyphenClickHdl_Impl, TriStateBox* ); - DECL_LINK( ApplyCollClickHdl_Impl, TriStateBox* ); - DECL_LINK( PageBreakPosHdl_Impl, ListBox* ); - DECL_LINK( PageBreakTypeHdl_Impl, ListBox* ); -#endif - virtual void PageCreated(SfxAllItemSet aSet); -}; - -//-------------------------------------------------------------------------- -class SvxAsianTabPage : public SfxTabPage -{ - FixedLine aOptionsFL; - - TriStateBox aForbiddenRulesCB; - TriStateBox aHangingPunctCB; - - TriStateBox aScriptSpaceCB; - - SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ); - -#ifdef _SVX_PARAGRPH_CXX - DECL_LINK( ClickHdl_Impl, TriStateBox* ); -#endif -public: - ~SvxAsianTabPage(); - - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - -}; - -#endif // #ifndef _SVX_PARAGRPH_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx deleted file mode 100644 index 3b9258462..000000000 --- a/cui/source/inc/passwdomdlg.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _CUI_PASSWDOMDLG_HXX_ -#define _CUI_PASSWDOMDLG_HXX_ - - -#include - -#include - -////////////////////////////////////////////////////////////////////// - -struct PasswordToOpenModifyDialog_Impl; - -class PasswordToOpenModifyDialog : public SfxModalDialog -{ - std::auto_ptr< PasswordToOpenModifyDialog_Impl > m_pImpl; - - // disallow use of copy c-tor and assignment operator - PasswordToOpenModifyDialog( const PasswordToOpenModifyDialog & ); - PasswordToOpenModifyDialog & operator = ( const PasswordToOpenModifyDialog & ); - -public: - PasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, - sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */, - bool bIsPasswordToModify ); - virtual ~PasswordToOpenModifyDialog(); - - // AbstractPasswordToOpenModifyDialog - virtual String GetPasswordToOpen() const; - virtual String GetPasswordToModify() const; - virtual bool IsRecommendToOpenReadonly() const; -}; - -////////////////////////////////////////////////////////////////////// - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx deleted file mode 100644 index 98214248f..000000000 --- a/cui/source/inc/pastedlg.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _PASTEDLG_HXX -#define _PASTEDLG_HXX - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/********************** SvPasteObjectDialog ****************************** -*************************************************************************/ - -struct TransferableObjectDescriptor; -class DataFlavorExVecor; -class TransferableDataHelper; - -class SvPasteObjectDialog : public ModalDialog -{ - FixedText aFtSource; - FixedText aFtObjectSource; - RadioButton aRbPaste; - RadioButton aRbPasteLink; - CheckBox aCbDisplayAsIcon; - PushButton aPbChangeIcon; - FixedLine aFlChoice; - ListBox aLbInsertList; - OKButton aOKButton1; - CancelButton aCancelButton1; - HelpButton aHelpButton1; - String aSObject; - Table aSupplementTable; - SvGlobalName aObjClassName; - String aObjName; - sal_uInt16 nAspect; - sal_Bool bLink; - - ListBox& ObjectLB() { return aLbInsertList; } - FixedText& ObjectSource() { return aFtObjectSource; } - RadioButton& PasteLink() { return aRbPasteLink; } - CheckBox& AsIconBox() { return aCbDisplayAsIcon; } - - const String& GetObjString() { return aSObject; } - void SelectObject(); - DECL_LINK( SelectHdl, ListBox * ); - DECL_LINK( DoubleClickHdl, ListBox * ); - void SetDefault(); - sal_uInt16 GetAspect() const { return nAspect; } - sal_Bool ShouldLink() const { return bLink; } - -public: - SvPasteObjectDialog( Window* pParent ); - ~SvPasteObjectDialog(); - - void Insert( SotFormatStringId nFormat, const String & rFormatName ); - void SetObjName( const SvGlobalName & rClass, const String & rObjName ); - sal_uLong GetFormat( const TransferableDataHelper& aHelper, - const DataFlavorExVector* pFormats=0, - const TransferableObjectDescriptor* pDesc=0 ); -}; - -#endif // _PASTEDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx deleted file mode 100644 index 966e35231..000000000 --- a/cui/source/inc/postdlg.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_POSTDLG_HXX -#define _SVX_POSTDLG_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include - -// class SvxPostItDialog ------------------------------------------------- -/* - {k:\svx\prototyp\dialog\memo.bmp} - - [Beschreibung] - In diesem Dialog kann eine Notiz erstellt oder bearbeitet werden. Wenn die - Applikation eine Liste von Notizen haelt, kann mit Hilfe von Links, ueber - diese Liste iteriert werden. - - [Items] - - - -*/ - -class SvxPostItDialog : public SfxModalDialog -{ -public: - SvxPostItDialog( Window* pParent, const SfxItemSet& rCoreSet, - sal_Bool bPrevNext = sal_False, sal_Bool bRedline = sal_False ); - ~SvxPostItDialog(); - - static sal_uInt16* GetRanges(); - const SfxItemSet* GetOutputItemSet() const { return pOutSet; } - - Link GetPrevHdl() const { return aPrevHdlLink; } - void SetPrevHdl( const Link& rLink ) - { aPrevHdlLink = rLink; } - Link GetNextHdl() const { return aNextHdlLink; } - void SetNextHdl( const Link& rLink ) - { aNextHdlLink = rLink; } - - void EnableTravel(sal_Bool bNext, sal_Bool bPrev); - inline String GetNote() { return aEditED.GetText(); } - inline void SetNote(const String& rTxt) { aEditED.SetText(rTxt); } - - void ShowLastAuthor(const String& rAuthor, const String& rDate); - inline void DontChangeAuthor() { aAuthorBtn.Enable(sal_False); } - inline void HideAuthor() { aAuthorBtn.Hide(); } - inline void SetReadonlyPostIt(sal_Bool bDisable) - { - aOKBtn.Enable( !bDisable ); - aEditED.SetReadOnly( bDisable ); - aAuthorBtn.Enable( !bDisable ); - } - inline sal_Bool IsOkEnabled() const { return aOKBtn.IsEnabled(); } - -private: - FixedLine aPostItFL; - FixedText aLastEditLabelFT; - FixedInfo aLastEditFT; - - FixedText aEditFT; - MultiLineEdit aEditED; - - FixedText aAuthorFT; - PushButton aAuthorBtn; - - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - ImageButton aPrevBtn; - ImageButton aNextBtn; - - const SfxItemSet& rSet; - SfxItemSet* pOutSet; - - Link aPrevHdlLink; - Link aNextHdlLink; - -#ifdef _SVX_POSTDLG_CXX - DECL_LINK( Stamp, Button* ); - DECL_LINK( OKHdl, Button* ); - DECL_LINK( PrevHdl, Button* ); - DECL_LINK( NextHdl, Button* ); -#endif -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/radiobtnbox.hxx b/cui/source/inc/radiobtnbox.hxx deleted file mode 100644 index f4ca17b21..000000000 --- a/cui/source/inc/radiobtnbox.hxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_RADIOBTNBOX_HXX -#define _SVX_RADIOBTNBOX_HXX - -// include --------------------------------------------------------------- - -#include - -namespace svx { - -// class SvxRadioButtonListBox ------------------------------------------- - -class SvxRadioButtonListBox : public SvxSimpleTable -{ - using SvxSimpleTable::SetTabs; - -private: - Point m_aCurMousePoint; - -protected: - virtual void SetTabs(); - virtual void MouseButtonUp( const MouseEvent& _rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - -public: - SvxRadioButtonListBox(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); - ~SvxRadioButtonListBox(); - - void HandleEntryChecked( SvLBoxEntry* _pEntry ); - - const Point& GetCurMousePoint() const; -}; - -} // end of namespace ::svx - -#endif // #ifndef _SVX_RADIOBTNBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx deleted file mode 100644 index 80f82ba80..000000000 --- a/cui/source/inc/scriptdlg.hxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SCRIPTDLG_HXX -#define _SCRIPTDLG_HXX - -#include - -#include "tools/solar.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#define OBJTYPE_BASICMANAGER 1L -#define OBJTYPE_METHOD 2L -#define OBJTYPE_SCRIPTCONTAINER 3L -#define OBJTYPE_SFROOT 4L - -#define BROWSEMODE_MODULES 0x01 -#define BROWSEMODE_SUBS 0x02 -#define BROWSEMODE_OBJS 0x04 -#define BROWSEMODE_PROPS 0x08 -#define BROWSEMODE_SUBOBJS 0x10 - -#define INPUTMODE_NEWLIB 1 -#define INPUTMODE_NEWMACRO 2 -#define INPUTMODE_RENAME 3 - -typedef ::boost::unordered_map < ::rtl::OUString, ::rtl::OUString , - ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > Selection_hash; - -class SFEntry; - -class SFTreeListBox : public SvTreeListBox -{ - friend class SvxScriptOrgDialog; -private: - sal_uInt16 nMode; - Image m_hdImage; - Image m_libImage; - Image m_macImage; - Image m_docImage; - ::rtl::OUString m_sMyMacros; - ::rtl::OUString m_sProdMacros; - - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > - getLangNodeFromRootNode( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& root, ::rtl::OUString& language ); - void delUserData( SvLBoxEntry* pEntry ); - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, ::rtl::OUString& docName ); - -protected: - void ExpandTree( SvLBoxEntry* pRootEntry ); - virtual void RequestingChilds( SvLBoxEntry* pParent ); - virtual void ExpandedHdl(); - virtual long ExpandingHdl(); -public: - void Init( const ::rtl::OUString& language ); - void RequestSubEntries( SvLBoxEntry* pRootEntry, ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node, - ::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model ); - SFTreeListBox( Window* pParent, const ResId& rRes ); - ~SFTreeListBox(); - - void ExpandAllTrees(); - - - - SvLBoxEntry * insertEntry(String const & rText, sal_uInt16 nBitmap, - SvLBoxEntry * pParent, - bool bChildrenOnDemand, - std::auto_ptr< SFEntry > aUserData, - ::rtl::OUString factoryURL ); - SvLBoxEntry * insertEntry(String const & rText, sal_uInt16 nBitmap, - SvLBoxEntry * pParent, - bool bChildrenOnDemand, - std::auto_ptr< SFEntry > aUserData ); - void deleteTree( SvLBoxEntry * pEntry ); - void deleteAllTree( ); -}; - -class InputDialog : public ModalDialog -{ -private: - FixedText aText; - Edit aEdit; - OKButton aOKButton; - CancelButton aCancelButton; - -public: - InputDialog( Window * pParent, sal_uInt16 nMode ); - ~InputDialog(); - - String GetObjectName() const { return aEdit.GetText(); } - void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );} -}; - -class SFEntry -{ -private: - sal_uInt8 nType; - bool loaded; - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > nodes; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > model; - SFEntry(){} -public: - SFEntry( sal_uInt8 nT ) { nType = nT; loaded=false; } - SFEntry( sal_uInt8 nT, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& entryNodes , - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& entryModel) { nType = nT; nodes = entryNodes; loaded=false; model = entryModel; } - SFEntry( const SFEntry& r ) { nType = r.nType; nodes = r.nodes; loaded = r.loaded; } - virtual ~SFEntry() {} - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > GetNode() { return nodes ;} - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() { return model ;}; - sal_uInt8 GetType() const { return nType; } - bool isLoaded() const { return loaded; } - void setLoaded() { loaded=true; } -}; - -class SvxScriptOrgDialog : public SfxModalDialog -{ -protected: - FixedText aScriptsTxt; - SFTreeListBox aScriptsBox; - - PushButton aRunButton; - CancelButton aCloseButton; - PushButton aCreateButton; - PushButton aEditButton; - PushButton aRenameButton; - PushButton aDelButton; - HelpButton aHelpButton; - - ::rtl::OUString m_sLanguage; - static Selection_hash m_lastSelection; - const String m_delErrStr; - const String m_delErrTitleStr; - const String m_delQueryStr; - const String m_delQueryTitleStr; - const String m_createErrStr; - const String m_createDupStr; - const String m_createErrTitleStr; - const String m_renameErrStr; - const String m_renameDupStr; - const String m_renameErrTitleStr; - - DECL_LINK( MacroSelectHdl, SvTreeListBox * ); - DECL_LINK( MacroDoubleClickHdl, SvTreeListBox * ); - DECL_LINK( ScriptSelectHdl, SvTreeListBox * ); - DECL_LINK( ButtonHdl, Button * ); - sal_Bool getBoolProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProps, ::rtl::OUString& propName ); - void CheckButtons( ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& node ); - - - void createEntry( SvLBoxEntry* pEntry ); - void renameEntry( SvLBoxEntry* pEntry ); - void deleteEntry( SvLBoxEntry* pEntry ); - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > - getBrowseNode( SvLBoxEntry* pEntry ); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel( SvLBoxEntry* pEntry ); - String getListOfChildren( ::com::sun::star::uno::Reference< com::sun::star::script::browse::XBrowseNode > node, int depth ); - void StoreCurrentSelection(); - void RestorePreviousSelection(); - -public: - // prob need another arg in the ctor - // to specify the language or provider - SvxScriptOrgDialog( Window* pParent, ::rtl::OUString language ); - ~SvxScriptOrgDialog(); - - virtual short Execute(); - -}; - -class SvxScriptErrorDialog : public VclAbstractDialog -{ -private: - - ::rtl::OUString m_sMessage; - - DECL_LINK( ShowDialog, ::rtl::OUString* ); - -public: - - SvxScriptErrorDialog( - Window* parent, ::com::sun::star::uno::Any aException ); - - ~SvxScriptErrorDialog(); - - short Execute(); -}; - -#endif // _SCRIPTDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/sdrcelldlg.hxx b/cui/source/inc/sdrcelldlg.hxx deleted file mode 100644 index b32d069f0..000000000 --- a/cui/source/inc/sdrcelldlg.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_FORMAT_CELLS_DLG_HXX -#define _SVX_FORMAT_CELLS_DLG_HXX - - -#include - -class XColorTable; -class XGradientList; -class XHatchList; -class XBitmapList; -class SdrModel; - -class SvxFormatCellsDialog : public SfxTabDialog -{ -private: - const SfxItemSet& mrOutAttrs; - - XColorTable* mpColorTab; - XGradientList* mpGradientList; - XHatchList* mpHatchingList; - XBitmapList* mpBitmapList; - -protected: - virtual void Apply(); - -public: - SvxFormatCellsDialog( Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel ); - ~SvxFormatCellsDialog(); - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -}; - -#endif // _SVX_FORMAT_CELLS_DLG_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx deleted file mode 100644 index f9f69d68a..000000000 --- a/cui/source/inc/selector.hxx +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVXSELECTOR_HXX -#define _SVXSELECTOR_HXX - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define _SVSTDARR_USHORTS -#define _SVSTDARR_STRINGSDTOR -#include // SvUShorts -#include - -#define SVX_CFGGROUP_FUNCTION 1 -#define SVX_CFGFUNCTION_SLOT 2 -#define SVX_CFGGROUP_SCRIPTCONTAINER 3 -#define SVX_CFGFUNCTION_SCRIPT 4 - -struct SvxGroupInfo_Impl -{ - sal_uInt16 nKind; - sal_uInt16 nOrd; - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > - xBrowseNode; - ::rtl::OUString sURL; - ::rtl::OUString sHelpText; - sal_Bool bWasOpened; - - SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr ) - :nKind( n ) - ,nOrd( nr ) - ,xBrowseNode() - ,sURL() - ,sHelpText() - ,bWasOpened(sal_False) - { - } - - SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxNode ) - :nKind( n ) - ,nOrd( nr ) - ,xBrowseNode( _rxNode ) - ,sURL() - ,sHelpText() - ,bWasOpened(sal_False) - { - } - - SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const ::rtl::OUString& _rURL, const ::rtl::OUString& _rHelpText ) - :nKind( n ) - ,nOrd( nr ) - ,xBrowseNode() - ,sURL( _rURL ) - ,sHelpText( _rHelpText ) - ,bWasOpened(sal_False) - { - } -}; - -typedef SvxGroupInfo_Impl* SvxGroupInfoPtr; -SV_DECL_PTRARR_DEL(SvxGroupInfoArr_Impl, SvxGroupInfoPtr, 5, 5) - -class ImageProvider -{ -public: - virtual ~ImageProvider() {} - - virtual Image GetImage( const rtl::OUString& rCommandURL ) = 0; -}; - -class SvxConfigFunctionListBox_Impl : public SvTreeListBox -{ -friend class SvxConfigGroupListBox_Impl; - Timer aTimer; - SvLBoxEntry* pCurEntry; - SvxGroupInfoArr_Impl aArr; - SvLBoxEntry* m_pDraggingEntry; - - DECL_LINK( TimerHdl, Timer* ); - virtual void MouseMove( const MouseEvent& rMEvt ); - -public: - SvxConfigFunctionListBox_Impl( Window*, const ResId& ); - ~SvxConfigFunctionListBox_Impl(); - void ClearAll(); - String GetHelpText( SvLBoxEntry *pEntry ); - using Window::GetHelpText; - SvLBoxEntry* GetLastSelectedEntry(); - void FunctionSelected(); - - // drag n drop methods - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - - virtual DragDropMode NotifyStartDrag( - TransferDataContainer&, SvLBoxEntry* ); - - virtual void DragFinished( sal_Int8 ); -}; - -class SvxConfigGroupListBox_Impl : public SvTreeListBox -{ - SvxGroupInfoArr_Impl aArr; - bool m_bShowSlots; - - SvxConfigFunctionListBox_Impl* pFunctionListBox; - ImageProvider* m_pImageProvider; - - ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XFrame > m_xFrame; - - ::com::sun::star::uno::Reference - < ::com::sun::star::container::XNameAccess > m_xModuleCommands; - - Image m_hdImage; - Image m_libImage; - Image m_macImage; - Image m_docImage; - ::rtl::OUString m_sMyMacros; - ::rtl::OUString m_sProdMacros; - Image GetImage( - ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > node, - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xCtx, - bool bIsRootNode - ); - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getDocumentModel( - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xCtx, - ::rtl::OUString& docName - ); - -private: - void fillScriptList( - const ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode >& _rxRootNode, - SvLBoxEntry* _pParentEntry, - bool _bCheapChildsOnDemand - ); - -protected: - virtual void RequestingChilds( SvLBoxEntry *pEntry); - virtual sal_Bool Expand( SvLBoxEntry* pParent ); - using SvListView::Expand; - -public: - SvxConfigGroupListBox_Impl ( - Window* pParent, const ResId&, - bool _bShowSlots, - const ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XFrame >& xFrame - ); - - ~SvxConfigGroupListBox_Impl(); - - void Init(); - void Open( SvLBoxEntry*, sal_Bool ); - void ClearAll(); - void GroupSelected(); - - void SetFunctionListBox( SvxConfigFunctionListBox_Impl *pBox ) - { pFunctionListBox = pBox; } - - void SetImageProvider( ImageProvider* provider ) - { m_pImageProvider = provider; } -}; - -class SvxScriptSelectorDialog : public ModelessDialog -{ - FixedText aDialogDescription; - FixedText aGroupText; - SvxConfigGroupListBox_Impl aCategories; - FixedText aFunctionText; - SvxConfigFunctionListBox_Impl aCommands; - OKButton aOKButton; - CancelButton aCancelButton; - HelpButton aHelpButton; - FixedLine aDescription; - FixedText aDescriptionText; - - sal_Bool m_bShowSlots; - Link m_aAddHdl; - - DECL_LINK( ClickHdl, Button * ); - DECL_LINK( SelectHdl, Control* ); - DECL_LINK( FunctionDoubleClickHdl, Control* ); - - void UpdateUI(); - void ResizeControls(); - -public: - - SvxScriptSelectorDialog ( - Window* pParent = NULL, - sal_Bool bShowSlots = sal_False, - const ::com::sun::star::uno::Reference - < ::com::sun::star::frame::XFrame >& xFrame = 0 - ); - - ~SvxScriptSelectorDialog ( ); - - void SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; } - const Link& GetAddHdl() const { return m_aAddHdl; } - - void SetImageProvider( ImageProvider* provider ) - { aCategories.SetImageProvider( provider ); } - - String GetScriptURL() const; - String GetSelectedDisplayName(); - String GetSelectedHelpText(); - void SetRunLabel(); - void SetDialogDescription(const String& rDescription); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/showcols.hxx b/cui/source/inc/showcols.hxx deleted file mode 100644 index d65987548..000000000 --- a/cui/source/inc/showcols.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_SHOWCOLS_HXX -#define _SVX_SHOWCOLS_HXX - -#include -#include -#include - -#include -#include -#include -#include - -//========================================================================== -// FmShowColsDialog -//========================================================================== - -class FmShowColsDialog : public ModalDialog -{ - ListBox m_aList; - FixedText m_aLabel; - OKButton m_aOK; - CancelButton m_aCancel; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xColumns; - -public: - FmShowColsDialog( Window* pParent ); - virtual ~FmShowColsDialog(); - - void SetColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer>& xCols); - -protected: - DECL_LINK( OnClickedOk, Button* ); -}; - -#endif // _SVX_SHOWCOLS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx deleted file mode 100644 index ffc3ae9a0..000000000 --- a/cui/source/inc/splitcelldlg.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SPLITCELLDLG_HXX -#define _SVX_SPLITCELLDLG_HXX - -#include -#include -#include -#include - -#include -#include - -class SvxSplitTableDlg : public SvxAbstractSplittTableDialog, public SvxStandardDialog -{ - FixedLine maCountFL; - FixedText maCountLbl; - NumericField maCountEdit; - FixedLine maDirFL; - ImageRadioButton maHorzBox; - ImageRadioButton maVertBox; - CheckBox maPropCB; - OKButton maOKBtn; - CancelButton maCancelBtn; - HelpButton maHelpBtn; - - long mnMaxVertical; - long mnMaxHorizontal; -protected: - virtual void Apply(); - -public: - SvxSplitTableDlg(Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal ); - virtual ~SvxSplitTableDlg(); - - DECL_LINK( ClickHdl, Button * ); - - virtual bool IsHorizontal() const; - virtual bool IsProportional() const; - virtual long GetCount() const; - - virtual short Execute(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx deleted file mode 100644 index 96e2eb9eb..000000000 --- a/cui/source/inc/srchxtra.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SRCHXTRA_HXX -#define _SVX_SRCHXTRA_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include - -#include -#include - -// class SvxSearchFormatDialog ------------------------------------------- - -class SvxSearchFormatDialog : public SfxTabDialog -{ -public: - SvxSearchFormatDialog( Window* pParent, const SfxItemSet& rSet ); - ~SvxSearchFormatDialog(); - -protected: - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -private: - FontList* pFontList; -}; - -// class SvxSearchFormatDialog ------------------------------------------- - -class SvxSearchAttributeDialog : public ModalDialog -{ -public: - SvxSearchAttributeDialog( Window* pParent, SearchAttrItemList& rLst, - const sal_uInt16* pWhRanges ); - -private: - FixedText aAttrFL; - SvxCheckListBox aAttrLB; - - OKButton aOKBtn; - CancelButton aEscBtn; - HelpButton aHelpBtn; - - SearchAttrItemList& rList; - - DECL_LINK( OKHdl, Button * ); -}; - -// class SvxSearchSimilarityDialog --------------------------------------- - -class SvxSearchSimilarityDialog : public ModalDialog -{ -private: - FixedLine aFixedLine; - FixedText aOtherTxt; - NumericField aOtherFld; - FixedText aLongerTxt; - NumericField aLongerFld; - FixedText aShorterTxt; - NumericField aShorterFld; - CheckBox aRelaxBox; - - OKButton aOKBtn; - CancelButton aEscBtn; - HelpButton aHelpBtn; - -public: - SvxSearchSimilarityDialog( Window* pParent, - sal_Bool bRelax, - sal_uInt16 nOther, - sal_uInt16 nShorter, - sal_uInt16 nLonger ); - - sal_uInt16 GetOther() { return (sal_uInt16)aOtherFld.GetValue(); } - sal_uInt16 GetShorter() { return (sal_uInt16)aShorterFld.GetValue(); } - sal_uInt16 GetLonger() { return (sal_uInt16)aLongerFld.GetValue(); } - sal_Bool IsRelaxed() { return aRelaxBox.IsChecked(); } -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx deleted file mode 100644 index 49c7d20bf..000000000 --- a/cui/source/inc/tabstpge.hxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABSTPGE_HXX -#define _SVX_TABSTPGE_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -#include -#include - -// forward --------------------------------------------------------------- - -class TabWin_Impl; - -// class SvxTabulatorTabPage --------------------------------------------- -/* - {k:\svx\prototyp\dialog\tabstop.bmp} - - [Beschreibung] - In dieser TabPage werden Tabulatoren verwaltet. - - [Items] - - - - -*/ - -class SvxTabulatorTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - -public: - ~SvxTabulatorTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - void DisableControls( const sal_uInt16 nFlag ); - -protected: - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -private: - SvxTabulatorTabPage( Window* pParent, const SfxItemSet& rSet ); - - // Tabulatoren und Positionen - FixedLine aTabLabel; - MetricBox aTabBox; - FixedLine aTabLabelVert; - - FixedLine aTabTypeLabel; - // TabType - RadioButton aLeftTab; - RadioButton aRightTab; - RadioButton aCenterTab; - RadioButton aDezTab; - - TabWin_Impl* pLeftWin; - TabWin_Impl* pRightWin; - TabWin_Impl* pCenterWin; - TabWin_Impl* pDezWin; - - FixedText aDezCharLabel; - Edit aDezChar; - - FixedLine aFillLabel; - // Fuellzeichen - RadioButton aNoFillChar; - RadioButton aFillPoints; - RadioButton aFillDashLine ; - RadioButton aFillSolidLine; - RadioButton aFillSpecial; - Edit aFillChar; - // Buttons - PushButton aNewBtn; - PushButton aDelAllBtn; - PushButton aDelBtn; - - // lokale Variablen, interne Funktionen - SvxTabStop aAktTab; - SvxTabStopItem aNewTabs; - long nDefDist; - FieldUnit eDefUnit; - sal_Bool bCheck; - -#ifdef _SVX_TABSTPGE_CXX - void InitTabPos_Impl( sal_uInt16 nPos = 0 ); - void SetFillAndTabType_Impl(); - - // Handler - DECL_LINK( NewHdl_Impl, Button* ); - DECL_LINK( DelHdl_Impl, Button* ); - DECL_LINK( DelAllHdl_Impl, Button* ); - - DECL_LINK( FillTypeCheckHdl_Impl, RadioButton* ); - DECL_LINK( TabTypeCheckHdl_Impl, RadioButton* ); - - DECL_LINK( SelectHdl_Impl, MetricBox* ); - DECL_LINK( ModifyHdl_Impl, MetricBox* ); - DECL_LINK( GetFillCharHdl_Impl, Edit* ); - DECL_LINK( GetDezCharHdl_Impl, Edit* ); -#endif - virtual void PageCreated(SfxAllItemSet aSet); -}; - -#endif // #ifndef _SVX_TABSTPGE_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx deleted file mode 100644 index 9c8486afa..000000000 --- a/cui/source/inc/textanim.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TEXTANIM_HXX -#define _SVX_TEXTANIM_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include - -class SdrView; - -/************************************************************************* -|* -|* Page zum "Andern von TextAnimationen (Lauftext etc.) -|* -\************************************************************************/ - -class SvxTextAnimationPage : public SfxTabPage -{ -private: - FixedLine aFlEffect; - FixedText aFtEffects; - ListBox aLbEffect; - FixedText aFtDirection; - ImageButton aBtnUp; - ImageButton aBtnLeft; - ImageButton aBtnRight; - ImageButton aBtnDown; - - FixedLine aFlProperties; - TriStateBox aTsbStartInside; - TriStateBox aTsbStopInside; - - FixedText aFtCount; - TriStateBox aTsbEndless; - NumericField aNumFldCount; - - FixedText aFtAmount; - TriStateBox aTsbPixel; - MetricField aMtrFldAmount; - - FixedText aFtDelay; - TriStateBox aTsbAuto; - MetricField aMtrFldDelay; - - const SfxItemSet& rOutAttrs; - SdrTextAniKind eAniKind; - FieldUnit eFUnit; - SfxMapUnit eUnit; - -#ifdef _SVX_TEXTANIM_CXX - DECL_LINK( SelectEffectHdl_Impl, void * ); - DECL_LINK( ClickEndlessHdl_Impl, void * ); - DECL_LINK( ClickAutoHdl_Impl, void * ); - DECL_LINK( ClickPixelHdl_Impl, void * ); - DECL_LINK( ClickDirectionHdl_Impl, ImageButton * ); - - void SelectDirection( SdrTextAniDirection nValue ); - sal_uInt16 GetSelectedDirection(); -#endif - -public: - - SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs ); - ~SvxTextAnimationPage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - void Construct(); -}; - -/************************************************************************* -|* -|* Text-Tab-Dialog -|* -\************************************************************************/ -class SvxTextTabDialog : public SfxTabDialog -{ -private: - const SfxItemSet& rOutAttrs; - const SdrView* pView; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -public: - - SvxTextTabDialog( Window* pParent, const SfxItemSet* pAttr, - const SdrView* pView ); - ~SvxTextTabDialog() {}; -}; - - -#endif // _SVX_TEXTANIM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx deleted file mode 100644 index 5eef8e12e..000000000 --- a/cui/source/inc/textattr.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TEXTATTR_HXX -#define _SVX_TEXTATTR_HXX - -// include --------------------------------------------------------------- - -#include - -#include - -#include -#include - -class SdrView; - -/************************************************************************* -|* -|* Dialog zum "Andern von TextAttributen -|* -\************************************************************************/ - -class SvxTextAttrPage : public SvxTabPage -{ -private: - FixedLine aFlText; - TriStateBox aTsbAutoGrowWidth; - TriStateBox aTsbAutoGrowHeight; - TriStateBox aTsbFitToSize; - TriStateBox aTsbContour; - TriStateBox aTsbWordWrapText; - TriStateBox aTsbAutoGrowSize; - - - FixedLine aFlDistance; - FixedText aFtLeft; - MetricField aMtrFldLeft; - FixedText aFtRight; - MetricField aMtrFldRight; - FixedText aFtTop; - MetricField aMtrFldTop; - FixedText aFtBottom; - MetricField aMtrFldBottom; - - FixedLine aFlSeparator; - - FixedLine aFlPosition; - SvxRectCtl aCtlPosition; - TriStateBox aTsbFullWidth; - - const SfxItemSet& rOutAttrs; - const SdrView* pView; - - sal_Bool bAutoGrowSizeEnabled; - sal_Bool bContourEnabled; - sal_Bool bAutoGrowWidthEnabled; - sal_Bool bAutoGrowHeightEnabled; - sal_Bool bWordWrapTextEnabled; - sal_Bool bFitToSizeEnabled; - - -#ifdef _SVX_TEXTATTR_CXX - DECL_LINK( ClickFullWidthHdl_Impl, void * ); - DECL_LINK( ClickHdl_Impl, void * ); -#endif - - /** Return whether the text direction is from left to right () or - top to bottom (). - */ - bool IsTextDirectionLeftToRight (void) const; - -public: - SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs ); - ~SvxTextAttrPage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { pView = pSdrView; } - virtual void PageCreated(SfxAllItemSet aSet); -}; - -#endif // _SVX_TEXTATTR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx deleted file mode 100644 index 6ea7bc591..000000000 --- a/cui/source/inc/thesdlg.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_THESDLG_HXX -#define _SVX_THESDLG_HXX - - -#include - -#include "svx/stddlg.hxx" -#include "svx/svxdllapi.h" - -#include - - -///////////////////////////////////////////////////////////////// - -struct SvxThesaurusDialog_Impl; - -class SvxThesaurusDialog : public SvxStandardDialog -{ - std::auto_ptr< SvxThesaurusDialog_Impl > m_pImpl; - - SVX_DLLPRIVATE virtual void Apply(); - -public: - SvxThesaurusDialog( Window* pParent, - ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus, - const String &rWord, LanguageType nLanguage ); - ~SvxThesaurusDialog(); - - void SetWindowTitle( LanguageType nLanguage ); - String GetWord(); - sal_uInt16 GetLanguage() const; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx deleted file mode 100644 index 4790ff27f..000000000 --- a/cui/source/inc/transfrm.hxx +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TRANSFRM_HXX -#define _SVX_TRANSFRM_HXX - -// include --------------------------------------------------------------- - -#include - -#include - -// #i75273# -#include - -// predefines -class SdrView; - -/************************************************************************* -|* -|* Transform-Tab-Dialog -|* -\************************************************************************/ - -/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor - to disable the size controls */ -const sal_uInt16 SVX_OBJ_NORESIZE = 0x0100; - -/** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor - to disable the protect controls */ -const sal_uInt16 SVX_OBJ_NOPROTECT = 0x0200; - -class SvxTransformTabDialog : public SfxTabDialog -{ -private: - const SdrView* pView; - - sal_uInt16 nAnchorCtrls; - Link aValidateLink; - - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ); - -public: - - SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, - const SdrView* pView, - sal_uInt16 nAnchorTypes = 0); - ~SvxTransformTabDialog(); - - //link for the Writer to validate positions - void SetValidateFramePosLink( const Link& rLink ); -}; - -/************************************************************************* -|* -|* position and size tab page -|* -\************************************************************************/ - -class SvxPositionSizeTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - // position - FixedLine maFlPosition; - FixedText maFtPosX; - MetricField maMtrPosX; - FixedText maFtPosY; - MetricField maMtrPosY; - FixedText maFtPosReference; - SvxRectCtl maCtlPos; - - // size - FixedLine maFlSize; - FixedText maFtWidth; - MetricField maMtrWidth; - FixedText maFtHeight; - MetricField maMtrHeight; - CheckBox maCbxScale; - FixedText maFtSizeReference; - SvxRectCtl maCtlSize; - - // protect - FixedLine maFlProtect; - TriStateBox maTsbPosProtect; - TriStateBox maTsbSizeProtect; - - // adjust - FixedLine maFlAdjust; - TriStateBox maTsbAutoGrowWidth; - TriStateBox maTsbAutoGrowHeight; - - FixedLine maFlDivider; - -private: - const SfxItemSet& mrOutAttrs; - - const SdrView* mpView; - - // #i75273# - basegfx::B2DRange maRange; - basegfx::B2DRange maWorkRange; - basegfx::B2DPoint maAnchor; - - SfxMapUnit mePoolUnit; - FieldUnit meDlgUnit; - MapUnit meMapUnit; - TriState mnProtectSizeState; - bool mbPageDisabled; - bool mbProtectDisabled; - bool mbSizeDisabled; - bool mbAdjustDisabled; - - // frome size - // #i75273# - double mfOldWidth; - double mfOldHeight; - RECT_POINT meRP; - - //------------------------------------ -#if _SOLAR__PRIVATE - DECL_LINK( ChangePosProtectHdl, void * ); - DECL_LINK( ChangeSizeProtectHdl, void * ); - DECL_LINK( ChangePosXHdl, void * ); - DECL_LINK( ChangePosYHdl, void * ); - - void SetMinMaxPosition(); - void GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange); -#endif - -#if _SOLAR__PRIVATE - DECL_LINK( ChangeWidthHdl, void * ); - DECL_LINK( ChangeHeightHdl, void * ); - DECL_LINK( ClickSizeProtectHdl, void * ); - DECL_LINK( ClickAutoHdl, void * ); - - void SetMaxSize( Rectangle aRect ); - Rectangle GetRect(); -#endif - -public: - SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { mpView = pSdrView; } - - virtual void FillUserData(); - - void DisableResize(); - void DisableProtect(); - - void UpdateControlStates(); -}; - -/************************************************************************* -|* -|* Drehwinkel-Tab-Page -|* -\************************************************************************/ -class SvxAngleTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlPosition; - FixedText aFtPosX; - MetricField aMtrPosX; - FixedText aFtPosY; - MetricField aMtrPosY; - FixedText aFtPosPresets; - SvxRectCtl aCtlRect; - - FixedLine aFlAngle; - FixedText aFtAngle; - MetricField aMtrAngle; - FixedText aFtAnglePresets; - SvxRectCtl aCtlAngle; - - const SfxItemSet& rOutAttrs; - const SdrView* pView; - - // #i75273# - basegfx::B2DRange maRange; - basegfx::B2DPoint maAnchor; - - SfxMapUnit ePoolUnit; - FieldUnit eDlgUnit; - MapUnit eMapUnit; - //------------------------------------ -#if _SOLAR__PRIVATE - DECL_LINK( ModifiedHdl, void * ); -#endif -public: - SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { pView = pSdrView; } -}; - -/************************************************************************* -|* -|* Schraegstellen/Eckenradius-Tab-Page -|* -\************************************************************************/ -class SvxSlantTabPage : public SvxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine aFlRadius; - FixedText aFtRadius; - MetricField aMtrRadius; - FixedLine aFlAngle; - FixedText aFtAngle; - MetricField aMtrAngle; - - const SfxItemSet& rOutAttrs; - - const SdrView* pView; - - // #i75273# - basegfx::B2DRange maRange; - - SfxMapUnit ePoolUnit; - FieldUnit eDlgUnit; - MapUnit eMapUnit; - //------------------------------------ -public: - SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet ); - - virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - - void Construct(); - void SetView( const SdrView* pSdrView ) { pView = pSdrView; } -}; - - - -#endif // _SVX_TRANSFRM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx deleted file mode 100644 index 00e2c82cb..000000000 --- a/cui/source/inc/treeopt.hxx +++ /dev/null @@ -1,352 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// static ---------------------------------------------------------------- - -sal_Bool EnableSSO(); -CreateTabPage GetSSOCreator( void ); - -// class OfaOptionsTreeListBox ------------------------------------------- - -class SfxModule; -class SfxShell; -class SfxItemSet; -class XColorTable; -class OfaOptionsTreeListBox : public SvTreeListBox -{ - using SvListView::Collapse; - -private: - sal_Bool bInCollapse; - -public: - OfaOptionsTreeListBox(Window* pParent, const ResId& rResId) : - SvTreeListBox( pParent, rResId ), bInCollapse(sal_False) {} - - virtual sal_Bool Collapse( SvLBoxEntry* pParent ); - sal_Bool IsInCollapse()const {return bInCollapse;} -}; - -// struct OrderedEntry --------------------------------------------------- - -struct OrderedEntry -{ - sal_Int32 m_nIndex; - rtl::OUString m_sId; - - OrderedEntry( sal_Int32 nIndex, const rtl::OUString& rId ) : - m_nIndex( nIndex ), m_sId( rId ) {} -}; - -typedef std::vector< OrderedEntry* > VectorOfOrderedEntries; - -// struct Module --------------------------------------------------------- - -struct Module -{ - rtl::OUString m_sName; - bool m_bActive; - VectorOfOrderedEntries m_aNodeList; - - Module( const rtl::OUString& rName ) : m_sName( rName ), m_bActive( false ) {} -}; - -// struct OptionsLeaf ---------------------------------------------------- - -struct OptionsLeaf -{ - rtl::OUString m_sId; - rtl::OUString m_sLabel; - rtl::OUString m_sPageURL; - rtl::OUString m_sEventHdl; - rtl::OUString m_sGroupId; - sal_Int32 m_nGroupIndex; - - OptionsLeaf( const rtl::OUString& rId, - const rtl::OUString& rLabel, - const rtl::OUString& rPageURL, - const rtl::OUString& rEventHdl, - const rtl::OUString& rGroupId, - sal_Int32 nGroupIndex ) : - m_sId( rId ), - m_sLabel( rLabel ), - m_sPageURL( rPageURL ), - m_sEventHdl( rEventHdl ), - m_sGroupId( rGroupId ), - m_nGroupIndex( nGroupIndex ) {} -}; - -typedef ::std::vector< OptionsLeaf* > VectorOfLeaves; -typedef ::std::vector< VectorOfLeaves > VectorOfGroupedLeaves; - -// struct OptionsNode ---------------------------------------------------- - -struct OptionsNode -{ - rtl::OUString m_sId; - rtl::OUString m_sLabel; - rtl::OUString m_sPageURL; - bool m_bAllModules; - rtl::OUString m_sGroupId; - sal_Int32 m_nGroupIndex; - VectorOfLeaves m_aLeaves; - VectorOfGroupedLeaves m_aGroupedLeaves; - - OptionsNode( const rtl::OUString& rId, - const rtl::OUString& rLabel, - const rtl::OUString& rPageURL, - bool bAllModules, - const rtl::OUString& rGroupId, - sal_Int32 nGroupIndex ) : - m_sId( rId ), - m_sLabel( rLabel ), - m_sPageURL( rPageURL ), - m_bAllModules( bAllModules ), - m_sGroupId( rGroupId ), - m_nGroupIndex( nGroupIndex ) {} - - ~OptionsNode() - { - for ( sal_uInt32 i = 0; i < m_aLeaves.size(); ++i ) - delete m_aLeaves[i]; - m_aLeaves.clear(); - m_aGroupedLeaves.clear(); - } -}; - -typedef ::std::vector< OptionsNode* > VectorOfNodes; - -struct LastPageSaver -{ - sal_uInt16 m_nLastPageId; - rtl::OUString m_sLastPageURL_Tools; - rtl::OUString m_sLastPageURL_ExtMgr; - - LastPageSaver() : m_nLastPageId( USHRT_MAX ) {} -}; - -// class OfaTreeOptionsDialog -------------------------------------------- - -namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } } -namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } } } } -namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } -namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } } - -struct OptionsPageInfo; -struct Module; -class ExtensionsTabPage; -typedef std::vector< ExtensionsTabPage* > VectorOfPages; - -class OfaTreeOptionsDialog : public SfxModalDialog -{ -private: - OKButton aOkPB; - CancelButton aCancelPB; - HelpButton aHelpPB; - PushButton aBackPB; - - FixedBorder aHiddenGB; - FixedText aPageTitleFT; - FixedLine aLine1FL; - FixedText aHelpFT; - FixedImage aHelpImg; - - ImageList aPageImages; - - ResStringArray aHelpTextsArr; - - OfaOptionsTreeListBox aTreeLB; - - String sTitle; - String sNotLoadedError; - - SvLBoxEntry* pCurrentPageEntry; - - // for the ColorTabPage - SfxItemSet* pColorPageItemSet; - XColorTable* pColorTab; - sal_uInt16 nChangeType; - sal_uInt16 nUnknownType; - sal_uInt16 nUnknownPos; - sal_Bool bIsAreaTP; - - sal_Bool bForgetSelection; - sal_Bool bExternBrowserActive; - sal_Bool bImageResized; - bool bInSelectHdl_Impl; - bool bIsFromExtensionManager; - - // check "for the current document only" and set focus to "Western" languages box - bool bIsForSetDocumentLanguage; - - Timer aSelectTimer; - - com::sun::star::uno::Reference < com::sun::star::awt::XContainerWindowProvider > - m_xContainerWinProvider; - - static LastPageSaver* pLastPageSaver; - - SfxItemSet* CreateItemSet( sal_uInt16 nId ); - void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); - void InitTreeAndHandler(); - void Initialize( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame ); - void ResizeTreeLB( void ); // resizes dialog so that treelistbox has no horizontal scroll bar - - void LoadExtensionOptions( const rtl::OUString& rExtensionId ); - rtl::OUString GetModuleIdentifier( const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory >& xMFac, - const com::sun::star::uno::Reference< - com::sun::star::frame::XFrame >& xFrame ); - Module* LoadModule( const rtl::OUString& rModuleIdentifier, - const com::sun::star::uno::Reference< - com::sun::star::container::XNameAccess >& xRoot ); - void LoadNodes( const com::sun::star::uno::Reference< - com::sun::star::container::XNameAccess >& xRoot, - Module* pModule, - const rtl::OUString& rExtensionId, - VectorOfNodes& rOutNodeList ); - void InsertNodes( const VectorOfNodes& rNodeList ); - -protected: - DECL_LINK(ExpandedHdl_Impl, SvTreeListBox* ); - DECL_LINK(ShowPageHdl_Impl, SvTreeListBox* ); - DECL_LINK(BackHdl_Impl, PushButton* ); - DECL_LINK( OKHdl_Impl, Button * ); - DECL_LINK( HintHdl_Impl, Timer * ); - DECL_LINK( SelectHdl_Impl, Timer * ); - - virtual long Notify( NotifyEvent& rNEvt ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual short Execute(); - -public: - OfaTreeOptionsDialog( Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& _xFrame, - bool bActivateLastSelection = true ); - OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ); - ~OfaTreeOptionsDialog(); - - OptionsPageInfo* AddTabPage( sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup ); - sal_uInt16 AddGroup( const String& rGroupName, SfxShell* pCreateShell, - SfxModule* pCreateModule, sal_uInt16 nDialogId ); - - void ActivateLastSelection(); - void ActivatePage( sal_uInt16 nResId ); - void ActivatePage( const String& rPageURL ); - void ApplyItemSets(); - - sal_uInt16 GetColorChanged() const { return nChangeType; } - XColorTable* GetColorTable() { return pColorTab; } - - // helper functions to call the language settings TabPage from the SpellDialog - static void ApplyLanguageOptions(const SfxItemSet& rSet); -}; - -// class OfaPageResource ------------------------------------------------- - -class OfaPageResource : public Resource -{ - ResStringArray aGeneralDlgAry; - ResStringArray aInetDlgAry; - ResStringArray aLangDlgAry; - ResStringArray aTextDlgAry; - ResStringArray aHTMLDlgAry; - ResStringArray aCalcDlgAry; - ResStringArray aStarMathDlgAry; - ResStringArray aImpressDlgAry; - ResStringArray aDrawDlgAry; - ResStringArray aChartDlgAry; - ResStringArray aFilterDlgAry; - ResStringArray aDatasourcesDlgAry; - -public: - OfaPageResource(); - - ResStringArray& GetGeneralArray() {return aGeneralDlgAry;} - ResStringArray& GetInetArray() {return aInetDlgAry;} - ResStringArray& GetLangArray() {return aLangDlgAry;} - ResStringArray& GetTextArray() {return aTextDlgAry;} - ResStringArray& GetHTMLArray() {return aHTMLDlgAry;} - ResStringArray& GetCalcArray() {return aCalcDlgAry;} - ResStringArray& GetStarMathArray() {return aStarMathDlgAry;} - ResStringArray& GetImpressArray() {return aImpressDlgAry;} - ResStringArray& GetDrawArray() {return aDrawDlgAry;} - ResStringArray& GetChartArray() {return aChartDlgAry;} - ResStringArray& GetFilterArray() {return aFilterDlgAry;} - ResStringArray& GetDatasourcesArray() {return aDatasourcesDlgAry;} -}; - -// class ExtensionsTabPage ----------------------------------------------- - -namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } } -namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowEventHandler; } } } } - -class ExtensionsTabPage : public TabPage -{ -private: - rtl::OUString m_sPageURL; - com::sun::star::uno::Reference< com::sun::star::awt::XWindow > - m_xPage; - rtl::OUString m_sEventHdl; - com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowEventHandler > - m_xEventHdl; - com::sun::star::uno::Reference< com::sun::star::awt::XContainerWindowProvider > - m_xWinProvider; - bool m_bIsWindowHidden; - - void CreateDialogWithHandler(); - sal_Bool DispatchAction( const rtl::OUString& rAction ); - -public: - ExtensionsTabPage( - Window* pParent, WinBits nStyle, - const rtl::OUString& rPageURL, const rtl::OUString& rEvtHdl, - const com::sun::star::uno::Reference< - com::sun::star::awt::XContainerWindowProvider >& rProvider ); - - virtual ~ExtensionsTabPage(); - - virtual void ActivatePage(); - virtual void DeactivatePage(); - - void ResetPage(); - void SavePage(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx deleted file mode 100644 index ab73095fd..000000000 --- a/cui/source/inc/zoom.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_ZOOM_HXX -#define _SVX_ZOOM_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include - -#include - -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; - - const SfxItemSet& rSet; - SfxItemSet* pOutSet; - sal_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: - SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ); - ~SvxZoomDialog(); - - const SfxItemSet* GetOutputItemSet() const { return pOutSet; } - - sal_uInt16 GetFactor() const; - void SetFactor( sal_uInt16 nNewFactor, sal_uInt16 nBtnId = 0 ); - - void HideButton( sal_uInt16 nBtnId ); - void SetLimits( sal_uInt16 nMin, sal_uInt16 nMax ); -}; - -#include - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/cfgchart.cxx b/cui/source/options/cfgchart.cxx deleted file mode 100644 index 969eae062..000000000 --- a/cui/source/options/cfgchart.cxx +++ /dev/null @@ -1,341 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include // header for SvStream -#include // header for SAL_STATIC_CAST -#include "cfgchart.hxx" -#include -#include - -#define ROW_COLOR_COUNT 12 - -using namespace com::sun::star; - -TYPEINIT1( SvxChartColorTableItem, SfxPoolItem ); - -SvxChartColorTable::SvxChartColorTable() -{} - -SvxChartColorTable::SvxChartColorTable( const SvxChartColorTable & _rSource ) : - m_aColorEntries( _rSource.m_aColorEntries ), - nNextElementNumber( m_aColorEntries.size() + 1 ) -{} - -// accessors -size_t SvxChartColorTable::size() const -{ - return m_aColorEntries.size(); -} - -const XColorEntry & SvxChartColorTable::operator[]( size_t _nIndex ) const -{ - if ( _nIndex >= m_aColorEntries.size() ) - { - DBG_ERRORFILE( "SvxChartColorTable::[] invalid index" ); - return m_aColorEntries[ 0 ]; - } - - return m_aColorEntries[ _nIndex ]; -} - -ColorData SvxChartColorTable::getColorData( size_t _nIndex ) const -{ - if ( _nIndex >= m_aColorEntries.size() ) - { - DBG_ERRORFILE( "SvxChartColorTable::getColorData invalid index" ); - return COL_BLACK; - } - - // GetColor should be const but unfortunately isn't - return const_cast< XColorEntry & >( m_aColorEntries[ _nIndex ] ).GetColor().GetRGBColor(); -} - -// mutators -void SvxChartColorTable::clear() -{ - m_aColorEntries.clear(); - nNextElementNumber = 1; -} - -void SvxChartColorTable::append( const XColorEntry & _rEntry ) -{ - m_aColorEntries.push_back( _rEntry ); -} - -void SvxChartColorTable::remove( size_t _nIndex ) -{ - if (m_aColorEntries.size() > 0) - m_aColorEntries.erase( m_aColorEntries.begin() + _nIndex); - - for (size_t i=0 ; im_aColorEntries.size() == _rOther.m_aColorEntries.size() ); - - if( bEqual ) - { - for( size_t i = 0; i < m_aColorEntries.size(); ++i ) - { - if( getColorData( i ) != _rOther.getColorData( i )) - { - bEqual = false; - break; - } - } - } - - return bEqual; -} - -// ==================== -// class SvxChartOptions -// ==================== - -SvxChartOptions::SvxChartOptions() : - ::utl::ConfigItem( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Chart") ) ), - mbIsInitialized( sal_False ) -{ - maPropertyNames.realloc( 1 ); - maPropertyNames[ 0 ] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultColor/Series") ); -} - -SvxChartOptions::~SvxChartOptions() -{ -} - -const SvxChartColorTable& SvxChartOptions::GetDefaultColors() -{ - if ( !mbIsInitialized ) - mbIsInitialized = RetrieveOptions(); - return maDefColors; -} - -void SvxChartOptions::SetDefaultColors( const SvxChartColorTable& aCol ) -{ - maDefColors = aCol; - SetModified(); -} - -sal_Bool SvxChartOptions::RetrieveOptions() -{ - // get sequence containing all properties - - uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames(); - uno::Sequence< uno::Any > aProperties( aNames.getLength()); - aProperties = GetProperties( aNames ); - - if( aProperties.getLength() == aNames.getLength()) - { - // 1. default colors for series - maDefColors.clear(); - uno::Sequence< sal_Int64 > aColorSeq; - aProperties[ 0 ] >>= aColorSeq; - - sal_Int32 nCount = aColorSeq.getLength(); - Color aCol; - - // create strings for entry names - String aResName( CUI_RES( RID_SVXSTR_DIAGRAM_ROW ) ); - String aPrefix, aPostfix, aName; - xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" ); - if( nPos != STRING_NOTFOUND ) - { - aPrefix = String( aResName, 0, nPos ); - aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN ); - } - else - aPrefix = aResName; - - // set color values - for( sal_Int32 i=0; i < nCount; i++ ) - { - aCol.SetColor( SAL_STATIC_CAST( ColorData, aColorSeq[ i ] )); - - aName = aPrefix; - aName.Append( String::CreateFromInt32( i + 1 )); - aName.Append( aPostfix ); - - maDefColors.append( XColorEntry( aCol, aName )); - } - return sal_True; - } - return sal_False; -} - -void SvxChartOptions::Commit() -{ - uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames(); - uno::Sequence< uno::Any > aValues( aNames.getLength()); - - if( aValues.getLength() >= 1 ) - { - // 1. default colors for series - // convert list to sequence - const size_t nCount = maDefColors.size(); - uno::Sequence< sal_Int64 > aColors( nCount ); - for( size_t i=0; i < nCount; i++ ) - { - ColorData aData = maDefColors.getColorData( i ); - aColors[ i ] = aData; - } - - aValues[ 0 ] <<= aColors; - } - - PutProperties( aNames, aValues ); -} - -void SvxChartOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) -{ -} - -// -------------------- -// class SvxChartColorTableItem -// -------------------- - -SvxChartColorTableItem::SvxChartColorTableItem( sal_uInt16 nWhich_, const SvxChartColorTable& aTable ) : - SfxPoolItem( nWhich_ ), - m_aColorTable( aTable ) -{ -} - -SvxChartColorTableItem::SvxChartColorTableItem( const SvxChartColorTableItem& rOther ) : - SfxPoolItem( rOther ), - m_aColorTable( rOther.m_aColorTable ) -{ -} - -SfxPoolItem* SvxChartColorTableItem::Clone( SfxItemPool * ) const -{ - return new SvxChartColorTableItem( *this ); -} - -int SvxChartColorTableItem::operator==( const SfxPoolItem& rAttr ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rAttr ), "SvxChartColorTableItem::operator== : types differ" ); - - const SvxChartColorTableItem * rCTItem( dynamic_cast< const SvxChartColorTableItem * >( & rAttr )); - if( rCTItem ) - { - return (this->m_aColorTable == rCTItem->GetColorTable()); - } - - return 0; -} - -void SvxChartColorTableItem::SetOptions( SvxChartOptions* pOpts ) const -{ - if ( pOpts ) - pOpts->SetDefaultColors( m_aColorTable ); -} - - -SvxChartColorTable & SvxChartColorTableItem::GetColorTable() -{ - return m_aColorTable; -} - -const SvxChartColorTable & SvxChartColorTableItem::GetColorTable() const -{ - return m_aColorTable; -} - -void SvxChartColorTableItem::ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry ) -{ - m_aColorTable.replace( _nIndex, _rEntry ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/cfgchart.hxx b/cui/source/options/cfgchart.hxx deleted file mode 100644 index b9adf3900..000000000 --- a/cui/source/options/cfgchart.hxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_CFGCHART_HXX -#define _SVX_CFGCHART_HXX - -// header for TYPEINFO -#include -// header for ConfigItem -#include -// header for SfxPoolItem -#include -// header for XColorEntry -#include - -#include - -class SvxChartColorTable -{ -private: - ::std::vector< XColorEntry > m_aColorEntries; - int nNextElementNumber; - String sDefaultNamePrefix; - String sDefaultNamePostfix; - -public: - SvxChartColorTable(); - explicit SvxChartColorTable( const SvxChartColorTable & _rSource ); - - // accessors - size_t size() const; - const XColorEntry & operator[]( size_t _nIndex ) const; - ColorData getColorData( size_t _nIndex ) const; - - // mutators - void clear(); - void append( const XColorEntry & _rEntry ); - void remove( size_t _nIndex ); - void replace( size_t _nIndex, const XColorEntry & _rEntry ); - void useDefault(); - String getDefaultName(size_t _nIndex); - - // comparison - bool operator==( const SvxChartColorTable & _rOther ) const; -}; - -// ==================== -// all options -// ==================== -class SvxChartOptions : public ::utl::ConfigItem -{ -private: - SvxChartColorTable maDefColors; - sal_Bool mbIsInitialized; - - ::com::sun::star::uno::Sequence< ::rtl::OUString > - maPropertyNames; - - inline ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames() const - { return maPropertyNames; } - sal_Bool RetrieveOptions(); - -public: - SvxChartOptions(); - virtual ~SvxChartOptions(); - - const SvxChartColorTable& GetDefaultColors(); - void SetDefaultColors( const SvxChartColorTable& aCol ); - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); -}; - -// ==================== -// items -// ==================== -class SvxChartColorTableItem : public SfxPoolItem -{ -public: - TYPEINFO(); - SvxChartColorTableItem( sal_uInt16 nWhich, const SvxChartColorTable& ); - SvxChartColorTableItem( const SvxChartColorTableItem& ); - - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual int operator==( const SfxPoolItem& ) const; - void SetOptions( SvxChartOptions* pOpts ) const; - - const SvxChartColorTable & GetColorTable() const ; - SvxChartColorTable & GetColorTable(); - void ReplaceColorByIndex( size_t _nIndex, const XColorEntry & _rEntry ); - -private: - SvxChartColorTable m_aColorTable; -}; - -#endif // _SVX_CFGCHART_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpoolconfig.cxx b/cui/source/options/connpoolconfig.cxx deleted file mode 100644 index 6505ba341..000000000 --- a/cui/source/options/connpoolconfig.cxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "connpoolconfig.hxx" -#include "connpoolsettings.hxx" - -#include "connpooloptions.hxx" -#include -#include -#include -#include -#include -#include "sdbcdriverenum.hxx" - -//........................................................................ -namespace offapp -{ -//........................................................................ - - using namespace ::utl; - using namespace ::com::sun::star::uno; - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getConnectionPoolNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess/ConnectionPool") ); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getEnablePoolingNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("EnablePooling")); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getDriverSettingsNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverSettings")); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getDriverNameNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("DriverName")); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getEnableNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("Enable")); - return s_sNodeName; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& getTimeoutNodeName() - { - static ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("Timeout")); - return s_sNodeName; - } - - //==================================================================== - //= ConnectionPoolConfig - //==================================================================== - //-------------------------------------------------------------------- - void ConnectionPoolConfig::GetOptions(SfxItemSet& _rFillItems) - { - // the config node where all pooling relevant info are stored under - OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_READONLY); - - // the global "enabled" flag - Any aEnabled = aConnectionPoolRoot.getNodeValue(getEnablePoolingNodeName()); - sal_Bool bEnabled = sal_True; - aEnabled >>= bEnabled; - _rFillItems.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, bEnabled)); - - // the settings for the single drivers - DriverPoolingSettings aSettings; - // first get all the drivers register at the driver manager - ODriverEnumeration aEnumDrivers; - for ( ODriverEnumeration::const_iterator aLoopDrivers = aEnumDrivers.begin(); - aLoopDrivers != aEnumDrivers.end(); - ++aLoopDrivers - ) - { - aSettings.push_back(DriverPooling(*aLoopDrivers, sal_False, 120)); - } - - // then look for which of them settings are stored in the configuration - OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName()); - - Sequence< ::rtl::OUString > aDriverKeys = aDriverSettings.getNodeNames(); - const ::rtl::OUString* pDriverKeys = aDriverKeys.getConstArray(); - const ::rtl::OUString* pDriverKeysEnd = pDriverKeys + aDriverKeys.getLength(); - for (;pDriverKeys != pDriverKeysEnd; ++pDriverKeys) - { - // the name of the driver in this round - OConfigurationNode aThisDriverSettings = aDriverSettings.openNode(*pDriverKeys); - ::rtl::OUString sThisDriverName; - aThisDriverSettings.getNodeValue(getDriverNameNodeName()) >>= sThisDriverName; - - // look if we (resp. the driver manager) know this driver - // doing O(n) search here, which is expensive, but this doesn't matter in this small case ... - DriverPoolingSettings::iterator aLookup; - for ( aLookup = aSettings.begin(); - aLookup != aSettings.end(); - ++aLookup - ) - if (sThisDriverName.equals(aLookup->sName)) - break; - - if (aLookup == aSettings.end()) - { // do not know the driver - add it - aSettings.push_back(DriverPooling(sThisDriverName, sal_False, 120)); - - // and the position of the new entry - aLookup = aSettings.end(); - --aLookup; - } - - // now fill this entry with the settings from the configuration - aThisDriverSettings.getNodeValue(getEnableNodeName()) >>= aLookup->bEnabled; - aThisDriverSettings.getNodeValue(getTimeoutNodeName()) >>= aLookup->nTimeoutSeconds; - } - - _rFillItems.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, aSettings)); - } - - //-------------------------------------------------------------------- - void ConnectionPoolConfig::SetOptions(const SfxItemSet& _rSourceItems) - { - // the config node where all pooling relevant info are stored under - OConfigurationTreeRoot aConnectionPoolRoot = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), getConnectionPoolNodeName(), -1, OConfigurationTreeRoot::CM_UPDATABLE); - - if (!aConnectionPoolRoot.isValid()) - // already asserted by the OConfigurationTreeRoot - return; - - sal_Bool bNeedCommit = sal_False; - - // the global "enabled" flag - SFX_ITEMSET_GET( _rSourceItems, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True ); - if (pEnabled) - { - sal_Bool bEnabled = pEnabled->GetValue(); - aConnectionPoolRoot.setNodeValue(getEnablePoolingNodeName(), Any(&bEnabled, ::getBooleanCppuType())); - bNeedCommit = sal_True; - } - - // the settings for the single drivers - SFX_ITEMSET_GET( _rSourceItems, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True ); - if (pDriverSettings) - { - OConfigurationNode aDriverSettings = aConnectionPoolRoot.openNode(getDriverSettingsNodeName()); - if (!aDriverSettings.isValid()) - return; - - ::rtl::OUString sThisDriverName; - OConfigurationNode aThisDriverSettings; - - const DriverPoolingSettings& rNewSettings = pDriverSettings->getSettings(); - for ( DriverPoolingSettings::const_iterator aLoop = rNewSettings.begin(); - aLoop != rNewSettings.end(); - ++aLoop - ) - { - // need the name as ::rtl::OUString - sThisDriverName = aLoop->sName; - - // the sub-node for this driver - if (aDriverSettings.hasByName(aLoop->sName)) - aThisDriverSettings = aDriverSettings.openNode(aLoop->sName); - else - aThisDriverSettings = aDriverSettings.createNode(aLoop->sName); - - // set the values - aThisDriverSettings.setNodeValue(getDriverNameNodeName(), makeAny(sThisDriverName)); - aThisDriverSettings.setNodeValue(getEnableNodeName(), Any(&aLoop->bEnabled, ::getBooleanCppuType())); - aThisDriverSettings.setNodeValue(getTimeoutNodeName(), makeAny(aLoop->nTimeoutSeconds)); - } - bNeedCommit = sal_True; - } - if (bNeedCommit) - aConnectionPoolRoot.commit(); - } - -//........................................................................ -} // namespace offapp -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpoolconfig.hxx b/cui/source/options/connpoolconfig.hxx deleted file mode 100644 index 774c5a744..000000000 --- a/cui/source/options/connpoolconfig.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_CONNPOOLCONFIG_HXX_ -#define _OFFAPP_CONNPOOLCONFIG_HXX_ - -class SfxItemSet; -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= ConnectionPoolConfig - //==================================================================== - class ConnectionPoolConfig - { - - public: - static void GetOptions(SfxItemSet& _rFillItems); - static void SetOptions(const SfxItemSet& _rSourceItems); - }; - -//........................................................................ -} // namespace offapp -//........................................................................ - -#endif // _OFFAPP_CONNPOOLCONFIG_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.cxx b/cui/source/options/connpooloptions.cxx deleted file mode 100644 index a02f2888d..000000000 --- a/cui/source/options/connpooloptions.cxx +++ /dev/null @@ -1,505 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "connpooloptions.hxx" -#include "connpooloptions.hrc" -#include -#include -#include "connpoolsettings.hxx" -#include -#include -#include "helpid.hrc" -#include - -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= DriverListControl - //==================================================================== - typedef ::svt::EditBrowseBox DriverListControl_Base; - class DriverListControl : public DriverListControl_Base - { - using Window::Update; - protected: - DriverPoolingSettings m_aSavedSettings; - DriverPoolingSettings m_aSettings; - DriverPoolingSettings::const_iterator m_aSeekRow; - - String m_sYes; - String m_sNo; - - Link m_aRowChangeHandler; - - public: - DriverListControl( Window* _pParent, const ResId& _rId); - - virtual void Init(); - void Update(const DriverPoolingSettings& _rSettings); - virtual String GetCellText( long nRow, sal_uInt16 nColId ) const; - - // the handler will be called with a DriverPoolingSettings::const_iterator as parameter, - // or NULL if no valid current row exists - void SetRowChangeHandler(const Link& _rHdl) { m_aRowChangeHandler = _rHdl; } - Link GetRowChangeHandler() const { return m_aRowChangeHandler; } - - const DriverPooling* getCurrentRow() const; - DriverPooling* getCurrentRow(); - void updateCurrentRow(); - - const DriverPoolingSettings& getSettings() const { return m_aSettings; } - - void saveValue() { m_aSavedSettings = m_aSettings; } - sal_Bool isModified() const; - - protected: - virtual void InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ); - virtual ::svt::CellController* GetController( long nRow, sal_uInt16 nCol ); - - virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const; - - virtual sal_Bool SeekRow( long nRow ); - virtual sal_Bool SaveModified(); - - virtual sal_Bool IsTabAllowed(sal_Bool _bForward) const; - - virtual void StateChanged( StateChangedType nStateChange ); - - virtual void CursorMoved(); - - protected: - virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId); - - - private: - String implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const; - }; - - //-------------------------------------------------------------------- - DriverListControl::DriverListControl( Window* _pParent, const ResId& _rId) - :DriverListControl_Base(_pParent, _rId, EBBF_NOROWPICTURE, BROWSER_AUTO_VSCROLL | BROWSER_AUTO_HSCROLL | BROWSER_HIDECURSOR | BROWSER_AUTOSIZE_LASTCOL) - ,m_aSeekRow(m_aSettings.end()) - ,m_sYes(ResId(STR_YES,*_rId.GetResMgr())) - ,m_sNo(ResId(STR_NO,*_rId.GetResMgr())) - { - SetStyle((GetStyle() & ~WB_HSCROLL) | WB_AUTOHSCROLL); - - SetUniqueId(UID_OFA_CONNPOOL_DRIVERLIST_BACK); - GetDataWindow().SetHelpId(HID_OFA_CONNPOOL_DRIVERLIST); - } - - //-------------------------------------------------------------------- - sal_Bool DriverListControl::IsTabAllowed(sal_Bool /*_bForward*/) const - { - // no travinling within the fields via RETURN and TAB - return sal_False; - } - - //-------------------------------------------------------------------- - sal_Bool DriverListControl::isModified() const - { - if (m_aSettings.size() != m_aSavedSettings.size()) - return sal_True; - - DriverPoolingSettings::const_iterator aCurrent = m_aSettings.begin(); - DriverPoolingSettings::const_iterator aCurrentEnd = m_aSettings.end(); - DriverPoolingSettings::const_iterator aSaved = m_aSavedSettings.begin(); - for (;aCurrent != aCurrentEnd; ++aCurrent, ++aSaved) - { - if (*aCurrent != *aSaved) - return sal_True; - } - - return sal_False; - } - - //-------------------------------------------------------------------- - void DriverListControl::Init() - { - DriverListControl_Base::Init(); - - Size aColWidth = LogicToPixel(Size(160, 0), MAP_APPFONT); - InsertDataColumn(1, String(CUI_RES(STR_DRIVER_NAME)), aColWidth.Width()); - aColWidth = LogicToPixel(Size(30, 0), MAP_APPFONT); - InsertDataColumn(2, String(CUI_RES(STR_POOLED_FLAG)), aColWidth.Width()); - aColWidth = LogicToPixel(Size(60, 0), MAP_APPFONT); - InsertDataColumn(3, String(CUI_RES(STR_POOL_TIMEOUT)), aColWidth.Width()); - // Attention: the resource of the string is local to the resource of the enclosing dialog! - } - - //-------------------------------------------------------------------- - void DriverListControl::CursorMoved() - { - DriverListControl_Base::CursorMoved(); - - // call the row change handler - if ( m_aRowChangeHandler.IsSet() ) - { - if ( GetCurRow() >= 0 ) - { // == -1 may happen in case the browse box has just been cleared - m_aRowChangeHandler.Call( getCurrentRow() ); - } - } - } - - //-------------------------------------------------------------------- - const DriverPooling* DriverListControl::getCurrentRow() const - { - OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ), - "DriverListControl::getCurrentRow: invalid current row!"); - - if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) ) - return &(*(m_aSettings.begin() + GetCurRow())); - - return NULL; - } - - //-------------------------------------------------------------------- - DriverPooling* DriverListControl::getCurrentRow() - { - OSL_ENSURE( ( GetCurRow() < m_aSettings.size() ) && ( GetCurRow() >= 0 ), - "DriverListControl::getCurrentRow: invalid current row!"); - - if ( ( GetCurRow() >= 0 ) && ( GetCurRow() < m_aSettings.size() ) ) - return &(*(m_aSettings.begin() + GetCurRow())); - - return NULL; - } - - //-------------------------------------------------------------------- - void DriverListControl::updateCurrentRow() - { - Window::Invalidate( GetRowRectPixel( GetCurRow() ), INVALIDATE_UPDATE ); - } - - //-------------------------------------------------------------------- - void DriverListControl::Update(const DriverPoolingSettings& _rSettings) - { - m_aSettings = _rSettings; - - SetUpdateMode(sal_False); - RowRemoved(0, GetRowCount()); - RowInserted(0, m_aSettings.size()); - SetUpdateMode(sal_True); - - ActivateCell(1, 0); - } - - //-------------------------------------------------------------------- - sal_uInt32 DriverListControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId) - { - return GetDataWindow().GetTextWidth(GetCellText(nRow, nColId)); - } - - //-------------------------------------------------------------------- - String DriverListControl::implGetCellText(DriverPoolingSettings::const_iterator _rPos, sal_uInt16 _nColId) const - { - OSL_ENSURE(_rPos < m_aSettings.end(), "DriverListControl::implGetCellText: invalid position!"); - - String sReturn; - switch (_nColId) - { - case 1: - sReturn = _rPos->sName; - break; - case 2: - sReturn = _rPos->bEnabled ? m_sYes : m_sNo; - break; - case 3: - if (_rPos->bEnabled) - sReturn = String::CreateFromInt32(_rPos->nTimeoutSeconds); - break; - default: - OSL_FAIL("DriverListControl::implGetCellText: invalid column id!"); - } - return sReturn; - } - - //-------------------------------------------------------------------- - void DriverListControl::StateChanged( StateChangedType nStateChange ) - { - if (STATE_CHANGE_ENABLE == nStateChange) - Window::Invalidate(INVALIDATE_UPDATE); - DriverListControl_Base::StateChanged( nStateChange ); - } - - //-------------------------------------------------------------------- - String DriverListControl::GetCellText( long nRow, sal_uInt16 nColId ) const - { - String sReturn; - if (nRow > m_aSettings.size()) - { - OSL_FAIL("DriverListControl::GetCellText: don't ask me for such rows!"); - } - else - { - sReturn = implGetCellText(m_aSettings.begin() + nRow, nColId); - } - return sReturn; - } - - //-------------------------------------------------------------------- - void DriverListControl::InitController( ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol ) - { - rController->GetWindow().SetText(GetCellText(nRow, nCol)); - } - - //-------------------------------------------------------------------- - ::svt::CellController* DriverListControl::GetController( long /*nRow*/, sal_uInt16 /*nCol*/ ) - { - return NULL; - } - - //-------------------------------------------------------------------- - sal_Bool DriverListControl::SaveModified() - { - return sal_True; - } - - //-------------------------------------------------------------------- - sal_Bool DriverListControl::SeekRow( long _nRow ) - { - DriverListControl_Base::SeekRow(_nRow); - - if (_nRow < m_aSettings.size()) - m_aSeekRow = m_aSettings.begin() + _nRow; - else - m_aSeekRow = m_aSettings.end(); - - return m_aSeekRow != m_aSettings.end(); - } - - //-------------------------------------------------------------------- - void DriverListControl::PaintCell( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId ) const - { - OSL_ENSURE(m_aSeekRow != m_aSettings.end(), "DriverListControl::PaintCell: invalid row!"); - - if (m_aSeekRow != m_aSettings.end()) - { - rDev.SetClipRegion(rRect); - - sal_uInt16 nStyle = TEXT_DRAW_CLIP; - if (!IsEnabled()) - nStyle |= TEXT_DRAW_DISABLE; - switch (nColId) - { - case 1: nStyle |= TEXT_DRAW_LEFT; break; - case 2: - case 3: nStyle |= TEXT_DRAW_CENTER; break; - } - - rDev.DrawText(rRect, implGetCellText(m_aSeekRow, nColId), nStyle); - - rDev.SetClipRegion(); - } - } - - //==================================================================== - //= ConnectionPoolOptionsPage - //==================================================================== - //-------------------------------------------------------------------- - ConnectionPoolOptionsPage::ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet) - :SfxTabPage(_pParent, CUI_RES(RID_OFAPAGE_CONNPOOLOPTIONS ), _rAttrSet) - ,m_aFrame (this, CUI_RES(FL_POOLING)) - ,m_aEnablePooling (this, CUI_RES(CB_POOL_CONNS)) - ,m_aDriversLabel (this, CUI_RES(FT_DRIVERS)) - ,m_pDriverList(new DriverListControl(this, CUI_RES(CTRL_DRIVER_LIST))) - ,m_aDriverLabel (this, CUI_RES(FT_DRIVERLABEL)) - ,m_aDriver (this, CUI_RES(FT_DRIVER)) - ,m_aDriverPoolingEnabled(this, CUI_RES(CB_DRIVERPOOLING)) - ,m_aTimeoutLabel (this, CUI_RES(FT_TIMEOUT)) - ,m_aTimeout (this, CUI_RES(NF_TIMEOUT)) - { - m_pDriverList->Init(); - m_pDriverList->Show(); - - FreeResource(); - - m_aEnablePooling.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); - m_aDriverPoolingEnabled.SetClickHdl( LINK(this, ConnectionPoolOptionsPage, OnEnabledDisabled) ); - - m_pDriverList->SetRowChangeHandler( LINK(this, ConnectionPoolOptionsPage, OnDriverRowChanged) ); - } - - //-------------------------------------------------------------------- - SfxTabPage* ConnectionPoolOptionsPage::Create(Window* _pParent, const SfxItemSet& _rAttrSet) - { - return new ConnectionPoolOptionsPage(_pParent, _rAttrSet); - } - - //-------------------------------------------------------------------- - ConnectionPoolOptionsPage::~ConnectionPoolOptionsPage() - { - delete m_pDriverList; - } - - //-------------------------------------------------------------------- - void ConnectionPoolOptionsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool /*_bFromReset*/) - { - // the enabled flag - SFX_ITEMSET_GET( _rSet, pEnabled, SfxBoolItem, SID_SB_POOLING_ENABLED, sal_True ); - OSL_ENSURE(pEnabled, "ConnectionPoolOptionsPage::implInitControls: missing the Enabled item!"); - m_aEnablePooling.Check(pEnabled ? pEnabled->GetValue() : sal_True); - - m_aEnablePooling.SaveValue(); - - // the settings for the single drivers - SFX_ITEMSET_GET( _rSet, pDriverSettings, DriverPoolingSettingsItem, SID_SB_DRIVER_TIMEOUTS, sal_True ); - if (pDriverSettings) - m_pDriverList->Update(pDriverSettings->getSettings()); - else - { - OSL_FAIL("ConnectionPoolOptionsPage::implInitControls: missing the DriverTimeouts item!"); - m_pDriverList->Update(DriverPoolingSettings()); - } - m_pDriverList->saveValue(); - - // reflect the new settings - OnEnabledDisabled(&m_aEnablePooling); - } - - //-------------------------------------------------------------------- - long ConnectionPoolOptionsPage::Notify( NotifyEvent& _rNEvt ) - { - if (EVENT_LOSEFOCUS == _rNEvt.GetType()) - if (m_aTimeout.IsWindowOrChild(_rNEvt.GetWindow())) - commitTimeoutField(); - - return SfxTabPage::Notify(_rNEvt); - } - - //-------------------------------------------------------------------- - sal_Bool ConnectionPoolOptionsPage::FillItemSet(SfxItemSet& _rSet) - { - commitTimeoutField(); - - sal_Bool bModified = sal_False; - // the enabled flag - if (m_aEnablePooling.GetSavedValue() != m_aEnablePooling.IsChecked()) - { - _rSet.Put(SfxBoolItem(SID_SB_POOLING_ENABLED, m_aEnablePooling.IsChecked()), SID_SB_POOLING_ENABLED); - bModified = sal_True; - } - - // the settings for the single drivers - if (m_pDriverList->isModified()) - { - _rSet.Put(DriverPoolingSettingsItem(SID_SB_DRIVER_TIMEOUTS, m_pDriverList->getSettings()), SID_SB_DRIVER_TIMEOUTS); - bModified = sal_True; - } - - return bModified; - } - - //-------------------------------------------------------------------- - void ConnectionPoolOptionsPage::ActivatePage( const SfxItemSet& _rSet) - { - SfxTabPage::ActivatePage(_rSet); - implInitControls(_rSet, sal_False); - } - - //-------------------------------------------------------------------- - void ConnectionPoolOptionsPage::Reset(const SfxItemSet& _rSet) - { - implInitControls(_rSet, sal_True); - } - - //-------------------------------------------------------------------- - IMPL_LINK( ConnectionPoolOptionsPage, OnDriverRowChanged, const void*, _pRowIterator ) - { - sal_Bool bValidRow = (NULL != _pRowIterator); - m_aDriverPoolingEnabled.Enable(bValidRow && m_aEnablePooling.IsChecked()); - m_aTimeoutLabel.Enable(bValidRow); - m_aTimeout.Enable(bValidRow); - - if (!bValidRow) - { // positioned on an invalid row - m_aDriver.SetText(String()); - } - else - { - const DriverPooling *pDriverPos = static_cast(_pRowIterator); - - m_aDriver.SetText(pDriverPos->sName); - m_aDriverPoolingEnabled.Check(pDriverPos->bEnabled); - m_aTimeout.SetText(String::CreateFromInt32(pDriverPos->nTimeoutSeconds)); - - OnEnabledDisabled(&m_aDriverPoolingEnabled); - } - - return 0L; - } - - //-------------------------------------------------------------------- - void ConnectionPoolOptionsPage::commitTimeoutField() - { - if (DriverPooling* pCurrentDriver = m_pDriverList->getCurrentRow()) - { - pCurrentDriver->nTimeoutSeconds = static_cast(m_aTimeout.GetValue()); - m_pDriverList->updateCurrentRow(); - } - } - - //-------------------------------------------------------------------- - IMPL_LINK( ConnectionPoolOptionsPage, OnEnabledDisabled, const CheckBox*, _pCheckBox ) - { - sal_Bool bGloballyEnabled = m_aEnablePooling.IsChecked(); - sal_Bool bLocalDriverChanged = &m_aDriverPoolingEnabled == _pCheckBox; - - if (&m_aEnablePooling == _pCheckBox) - { - m_aDriversLabel.Enable(bGloballyEnabled); - m_pDriverList->Enable(bGloballyEnabled); - m_aDriverLabel.Enable(bGloballyEnabled); - m_aDriver.Enable(bGloballyEnabled); - m_aDriverPoolingEnabled.Enable(bGloballyEnabled); - } - else - OSL_ENSURE(bLocalDriverChanged, "ConnectionPoolOptionsPage::OnEnabledDisabled: where did this come from?"); - - m_aTimeoutLabel.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked()); - m_aTimeout.Enable(bGloballyEnabled && m_aDriverPoolingEnabled.IsChecked()); - - if (bLocalDriverChanged) - { - // update the list - m_pDriverList->getCurrentRow()->bEnabled = m_aDriverPoolingEnabled.IsChecked(); - m_pDriverList->updateCurrentRow(); - } - - return 0L; - } - -//........................................................................ -} // namespace offapp -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.hrc b/cui/source/options/connpooloptions.hrc deleted file mode 100644 index 88b36f0ed..000000000 --- a/cui/source/options/connpooloptions.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_CONNPOOLOPTIONS_HRC_ -#define _OFFAPP_CONNPOOLOPTIONS_HRC_ - -#define FL_POOLING 1 -#define CB_POOL_CONNS 2 -#define FT_DRIVERS 3 -#define CTRL_DRIVER_LIST 4 -#define FT_DRIVERLABEL 5 -#define FT_DRIVER 6 -#define CB_DRIVERPOOLING 7 -#define FT_TIMEOUT 8 -#define NF_TIMEOUT 9 - -#define STR_DRIVER_NAME 1 -#define STR_POOLED_FLAG 2 -#define STR_POOL_TIMEOUT 3 -#define STR_YES 4 -#define STR_NO 5 - -#endif // _OFFAPP_CONNPOOLOPTIONS_HRC_ - - diff --git a/cui/source/options/connpooloptions.hxx b/cui/source/options/connpooloptions.hxx deleted file mode 100644 index 183ed7788..000000000 --- a/cui/source/options/connpooloptions.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_CONNPOOLOPTIONS_HXX_ -#define _OFFAPP_CONNPOOLOPTIONS_HXX_ - -#include -#include -#include -#include -#include -#include - -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= ConnectionPoolOptionsPage - //==================================================================== - class DriverListControl; - class ConnectionPoolOptionsPage : public SfxTabPage - { - using TabPage::ActivatePage; - - protected: - FixedLine m_aFrame; - CheckBox m_aEnablePooling; - FixedText m_aDriversLabel; - DriverListControl* m_pDriverList; - FixedText m_aDriverLabel; - FixedText m_aDriver; - CheckBox m_aDriverPoolingEnabled; - FixedText m_aTimeoutLabel; - NumericField m_aTimeout; - - protected: - ConnectionPoolOptionsPage(Window* _pParent, const SfxItemSet& _rAttrSet); - - public: - static SfxTabPage* Create(Window* _pParent, const SfxItemSet& _rAttrSet); - - ~ConnectionPoolOptionsPage(); - - protected: - virtual long Notify( NotifyEvent& _rNEvt ); - - virtual sal_Bool FillItemSet(SfxItemSet& _rSet); - virtual void Reset(const SfxItemSet& _rSet); - virtual void ActivatePage( const SfxItemSet& _rSet); - - protected: - DECL_LINK( OnEnabledDisabled, const CheckBox* ); - DECL_LINK( OnDriverRowChanged, const void* ); - - void implInitControls(const SfxItemSet& _rSet, sal_Bool _bFromReset); - - void commitTimeoutField(); - }; - -//........................................................................ -} // namespace offapp -//........................................................................ - -#endif // _OFFAPP_CONNPOOLOPTIONS_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpooloptions.src b/cui/source/options/connpooloptions.src deleted file mode 100644 index 64aa376a7..000000000 --- a/cui/source/options/connpooloptions.src +++ /dev/null @@ -1,169 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "connpooloptions.hrc" -#include - -#define PAGE_SIZE_X 260 -#define PAGE_SIZE_Y 185 - -#define LIST_SIZE_Y 100 - -TabPage RID_OFAPAGE_CONNPOOLOPTIONS -{ - HelpID = "cui:TabPage:RID_OFAPAGE_CONNPOOLOPTIONS"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ; - SVLook = TRUE ; - Hide = TRUE ; - - FixedLine FL_POOLING - { - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 8, 8 ); - Text [ en-US ] = "Connection pool"; - }; - CheckBox CB_POOL_CONNS - { - HelpID = "cui:CheckBox:RID_OFAPAGE_CONNPOOLOPTIONS:CB_POOL_CONNS"; - Pos = MAP_APPFONT( 7, 15 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14, 10 ); - Text [ en-US ] = "Connection pooling enabled"; - }; - FixedText FT_DRIVERS - { - Pos = MAP_APPFONT( 17, 28 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, 8 ); - Text [ en-US ] = "Drivers known in %PRODUCTNAME"; - }; - Control CTRL_DRIVER_LIST - { - Pos = MAP_APPFONT( 17, 39 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 14 - 8, LIST_SIZE_Y ); - TabStop = TRUE; - Border = TRUE; - SVLook = TRUE; - }; - FixedText FT_DRIVERLABEL - { - Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 ); - Size = MAP_APPFONT( 70, 8 ); - Text [ en-US ] = "Current driver:"; - }; - FixedText FT_DRIVER - { - Pos = MAP_APPFONT( 17 + 70 + 3, 39 + LIST_SIZE_Y + 4 ); - Size = MAP_APPFONT( PAGE_SIZE_X - ( 15 + 70 + 3 ) - 7, 8 ); - }; - CheckBox CB_DRIVERPOOLING - { - HelpID = "cui:CheckBox:RID_OFAPAGE_CONNPOOLOPTIONS:CB_DRIVERPOOLING"; - Pos = MAP_APPFONT( 17, 39 + LIST_SIZE_Y + 4 + 8 + 3 ); - Size = MAP_APPFONT( PAGE_SIZE_X - 23, 10 ); - Text [ en-US ] = "Enable pooling for this driver"; - }; - FixedText FT_TIMEOUT - { - Pos = MAP_APPFONT( 27, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 + 2 ); - Size = MAP_APPFONT( 100, 8 ); - Text [ en-US ] = "Timeout (seconds)"; - }; - NumericField NF_TIMEOUT - { - HelpID = "cui:NumericField:RID_OFAPAGE_CONNPOOLOPTIONS:NF_TIMEOUT"; - Pos = MAP_APPFONT( 27 + 100 + 3, 39 + LIST_SIZE_Y + 4 + 8 + 3 + 10 + 3 ); - Size = MAP_APPFONT( 40, 12 ); - SvLook = TRUE; - Border = TRUE; - Right = TRUE; - Spin = TRUE; - Repeat = TRUE; - Minimum = 30; - Maximum = 600; - StrictFormat = TRUE; - DecimalDigits = 0; - SpinSize = 1; - }; - - String STR_DRIVER_NAME - { - Text [ en-US ] = "Driver name"; - }; - String STR_POOLED_FLAG - { - Text [ en-US ] = "Pool"; - }; - String STR_POOL_TIMEOUT - { - Text [ en-US ] = "Timeout"; - }; - String STR_YES - { - Text [ en-US ] = "Yes"; - }; - String STR_NO - { - Text [ en-US ] = "No"; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/connpoolsettings.cxx b/cui/source/options/connpoolsettings.cxx deleted file mode 100644 index 7ce1a16ea..000000000 --- a/cui/source/options/connpoolsettings.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "connpoolsettings.hxx" - -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= DriverPooling - //==================================================================== - //-------------------------------------------------------------------- - DriverPooling::DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout ) - :sName(_rName) - ,bEnabled(_bEnabled) - ,nTimeoutSeconds(_nTimeout) - { - } - - //-------------------------------------------------------------------- - sal_Bool DriverPooling::operator == (const DriverPooling& _rR) const - { - return (sName == _rR.sName) - && (bEnabled == _rR.bEnabled) - && (nTimeoutSeconds == _rR.nTimeoutSeconds); - } - - //==================================================================== - //= DriverPoolingSettings - //==================================================================== - //-------------------------------------------------------------------- - DriverPoolingSettings::DriverPoolingSettings() - { - } - - //==================================================================== - //= DriverPoolingSettingsItem - //==================================================================== - TYPEINIT1( DriverPoolingSettingsItem, SfxPoolItem ) - //-------------------------------------------------------------------- - DriverPoolingSettingsItem::DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings ) - :SfxPoolItem(_nId) - ,m_aSettings(_rSettings) - { - } - - //-------------------------------------------------------------------- - int DriverPoolingSettingsItem::operator==( const SfxPoolItem& _rCompare ) const - { - const DriverPoolingSettingsItem* pItem = PTR_CAST(DriverPoolingSettingsItem, &_rCompare); - if (!pItem) - return sal_False; - - if (m_aSettings.size() != pItem->m_aSettings.size()) - return sal_False; - - DriverPoolingSettings::const_iterator aOwn = m_aSettings.begin(); - DriverPoolingSettings::const_iterator aOwnEnd = m_aSettings.end(); - DriverPoolingSettings::const_iterator aForeign = pItem->m_aSettings.begin(); - while (aOwn < aOwnEnd) - { - if (*aOwn != *aForeign) - return sal_False; - - ++aForeign; - ++aOwn; - } - - return sal_True; - } - - //-------------------------------------------------------------------- - SfxPoolItem* DriverPoolingSettingsItem::Clone( SfxItemPool * ) const - { - return new DriverPoolingSettingsItem(Which(), m_aSettings); - } - - //-------------------------------------------------------------------- - -//........................................................................ -} // namespace offapp -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/connpoolsettings.hxx b/cui/source/options/connpoolsettings.hxx deleted file mode 100644 index 8a9f3b8cb..000000000 --- a/cui/source/options/connpoolsettings.hxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_CONNPOOLSETTINGS_HXX_ -#define _OFFAPP_CONNPOOLSETTINGS_HXX_ - -#include -#include -#include - -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= DriverPooling - //==================================================================== - struct DriverPooling - { - String sName; - sal_Bool bEnabled; - sal_Int32 nTimeoutSeconds; - - DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout ); - - sal_Bool operator == (const DriverPooling& _rR) const; - sal_Bool operator != (const DriverPooling& _rR) const { return !operator ==(_rR); } - }; - - //==================================================================== - //= DriverPoolingSettings - //==================================================================== - class DriverPoolingSettings - { - protected: - DECLARE_STL_VECTOR( DriverPooling, DriverSettings ); - DriverSettings m_aDrivers; - - public: - typedef ConstDriverSettingsIterator const_iterator; - typedef DriverSettingsIterator iterator; - - public: - DriverPoolingSettings(); - - sal_Int32 size() const { return m_aDrivers.size(); } - - const_iterator begin() const { return m_aDrivers.begin(); } - const_iterator end() const { return m_aDrivers.end(); } - - iterator begin() { return m_aDrivers.begin(); } - iterator end() { return m_aDrivers.end(); } - - void push_back(const DriverPooling& _rElement) { m_aDrivers.push_back(_rElement); } - }; - - //==================================================================== - //= DriverPoolingSettingsItem - //==================================================================== - class DriverPoolingSettingsItem : public SfxPoolItem - { - protected: - DriverPoolingSettings m_aSettings; - - public: - TYPEINFO(); - - DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings &_rSettings ); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - - const DriverPoolingSettings& getSettings() const { return m_aSettings; } - }; - -//........................................................................ -} // namespace offapp -//........................................................................ - -#endif // _OFFAPP_CONNPOOLSETTINGS_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/cuisrchdlg.cxx b/cui/source/options/cuisrchdlg.cxx deleted file mode 100644 index a78908f9d..000000000 --- a/cui/source/options/cuisrchdlg.cxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _CUI_SRCHDLG_CXX -#include "cuisrchdlg.hxx" - -#include - -#define ITEMID_SETITEM 0 - -#include -#include -#include -#include -#include -#include -#include "backgrnd.hxx" - - -// class SvxJSearchOptionsDialog ----------------------------------------- - -SvxJSearchOptionsDialog::SvxJSearchOptionsDialog( - Window *pParent, - const SfxItemSet& rOptionsSet, sal_Int32 nInitialFlags ) : - SfxSingleTabDialog ( pParent, rOptionsSet, RID_SVXPAGE_JSEARCH_OPTIONS ), - nInitialTlFlags( nInitialFlags ) -{ - pPage = (SvxJSearchOptionsPage *) - SvxJSearchOptionsPage::Create( this, rOptionsSet ); - SetTabPage( pPage ); //! implicitly calls pPage->Reset(...)! - pPage->EnableSaveOptions( sal_False ); -} - - -SvxJSearchOptionsDialog::~SvxJSearchOptionsDialog() -{ - // pPage will be implicitly destroyed by the - // SfxSingleTabDialog destructor -} - - -void SvxJSearchOptionsDialog::Activate() -{ - pPage->SetTransliterationFlags( nInitialTlFlags ); -} - - -sal_Int32 SvxJSearchOptionsDialog::GetTransliterationFlags() const -{ - return pPage->GetTransliterationFlags(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx deleted file mode 100644 index 094826fd9..000000000 --- a/cui/source/options/dbregister.cxx +++ /dev/null @@ -1,467 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dbregister.hxx" -#include "dbregister.hrc" -#include "dbregistersettings.hxx" -#include "connpooloptions.hxx" -#include -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "doclinkdialog.hxx" -#include -#include -#include "optHeaderTabListbox.hxx" -#include -#include -#include "dbregisterednamesconfig.hxx" -#include - -#define TAB_WIDTH1 80 -#define TAB_WIDTH_MIN 10 -#define TAB_WIDTH2 1000 -#define ITEMID_TYPE 1 -#define ITEMID_PATH 2 -//........................................................................ -namespace svx -{ -//........................................................................ - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; -using namespace ::svt; - -// class RegistrationItemSetHolder ------------------------------------------------- - -RegistrationItemSetHolder::RegistrationItemSetHolder( const SfxItemSet& _rMasterSet ) - :m_aRegistrationItems( _rMasterSet ) -{ - DbRegisteredNamesConfig::GetOptions( m_aRegistrationItems ); -} - -RegistrationItemSetHolder::~RegistrationItemSetHolder() -{ -} - -// class DatabaseRegistrationDialog ------------------------------------------------ - -DatabaseRegistrationDialog::DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rInAttrs ) - :RegistrationItemSetHolder( rInAttrs ) - ,SfxSingleTabDialog( pParent, getRegistrationItems(), RID_SFXPAGE_DBREGISTER ) -{ - SfxTabPage* page = DbRegistrationOptionsPage::Create( this, getRegistrationItems() ); - - SetTabPage( page ); - SetText( page->GetText() ); -} - -DatabaseRegistrationDialog::~DatabaseRegistrationDialog() -{ -} - -short DatabaseRegistrationDialog::Execute() -{ - short result = SfxSingleTabDialog::Execute(); - if ( result == RET_OK ) - { - DBG_ASSERT( GetOutputItemSet(), "DatabaseRegistrationDialog::Execute: no output items!" ); - if ( GetOutputItemSet() ) - DbRegisteredNamesConfig::SetOptions( *GetOutputItemSet() ); - } - return result; -} - -// class DbRegistrationOptionsPage -------------------------------------------------- - -DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_DBREGISTER), rSet ), - - aStdBox ( this, CUI_RES( GB_STD ) ), - aTypeText ( this, CUI_RES( FT_TYPE ) ), - aPathText ( this, CUI_RES( FT_PATH ) ), - aPathCtrl ( this, CUI_RES( LB_PATH ) ), - m_aNew ( this, CUI_RES( BTN_NEW ) ), - m_aEdit ( this, CUI_RES( BTN_EDIT ) ), - m_aDelete ( this, CUI_RES( BTN_DELETE ) ), - pHeaderBar ( NULL ), - pPathBox ( NULL ), - m_pCurEntry ( NULL ), - m_nOldCount ( 0 ), - m_bModified ( sal_False ) -{ - m_aNew.SetClickHdl( LINK( this, DbRegistrationOptionsPage, NewHdl ) ); - m_aEdit.SetClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) ); - m_aDelete.SetClickHdl( LINK( this, DbRegistrationOptionsPage, DeleteHdl ) ); - - Size aBoxSize = aPathCtrl.GetOutputSizePixel(); - - - WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP; - pPathBox = new ::svx::OptHeaderTabListBox( &aPathCtrl, nBits ); - - pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); - pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) ); - pHeaderBar->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, HeaderSelect_Impl ) ); - pHeaderBar->SetEndDragHdl( LINK( this, DbRegistrationOptionsPage, HeaderEndDrag_Impl ) ); - Size aSz; - aSz.Width() = TAB_WIDTH1; - pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(), - LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(), - HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW ); - aSz.Width() = TAB_WIDTH2; - pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(), - LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(), - HIB_LEFT | HIB_VCENTER ); - - static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 }; - Size aHeadSize = pHeaderBar->GetSizePixel(); - - aPathCtrl.SetFocusControl( pPathBox ); - pPathBox->SetStyle( pPathBox->GetStyle()|nBits ); - pPathBox->SetDoubleClickHdl( LINK( this, DbRegistrationOptionsPage, EditHdl ) ); - pPathBox->SetSelectHdl( LINK( this, DbRegistrationOptionsPage, PathSelect_Impl ) ); - pPathBox->SetSelectionMode( SINGLE_SELECTION ); - pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ), - Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) ); - pPathBox->SetTabs( &nTabs[0], MAP_APPFONT ); - pPathBox->InitHeaderBar( pHeaderBar ); - pPathBox->SetHighlightRange(); - - pPathBox->SetHelpId( HID_DBPATH_CTL_PATH ); - pHeaderBar->SetHelpId( HID_DBPATH_HEADERBAR ); - - pPathBox->Show(); - pHeaderBar->Show(); - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -DbRegistrationOptionsPage::~DbRegistrationOptionsPage() -{ - // #110603# do not grab focus to a destroyed window !!! - aPathCtrl.SetFocusControl( NULL ); - - pHeaderBar->Hide(); - for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i ) - delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() ); - delete pPathBox; - delete pHeaderBar; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* DbRegistrationOptionsPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return ( new DbRegistrationOptionsPage( pParent, rAttrSet ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool DbRegistrationOptionsPage::FillItemSet( SfxItemSet& rCoreSet ) -{ - // the settings for the single drivers - sal_Bool bModified = sal_False; - DatabaseRegistrations aRegistrations; - sal_uLong nCount = pPathBox->GetEntryCount(); - for ( sal_uLong i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = pPathBox->GetEntry(i); - DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); - if ( pRegistration && pRegistration->sLocation.getLength() ) - { - ::rtl::OUString sName( pPathBox->GetEntryText( pEntry, 0 ) ); - OFileNotation aTransformer( pRegistration->sLocation ); - aRegistrations[ sName ] = DatabaseRegistration( aTransformer.get( OFileNotation::N_URL ), pRegistration->bReadOnly ); - } - } - if ( m_nOldCount != aRegistrations.size() || m_bModified ) - { - rCoreSet.Put(DatabaseMapItem( SID_SB_DB_REGISTER, aRegistrations ), SID_SB_DB_REGISTER); - bModified = sal_True; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void DbRegistrationOptionsPage::Reset( const SfxItemSet& rSet ) -{ - // the settings for the single drivers - SFX_ITEMSET_GET( rSet, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); - if ( !pRegistrations ) - return; - - pPathBox->Clear(); - - const DatabaseRegistrations& rRegistrations = pRegistrations->getRegistrations(); - m_nOldCount = rRegistrations.size(); - DatabaseRegistrations::const_iterator aIter = rRegistrations.begin(); - DatabaseRegistrations::const_iterator aEnd = rRegistrations.end(); - for ( ; aIter != aEnd; ++aIter ) - { - OFileNotation aTransformer( aIter->second.sLocation ); - insertNewEntry( aIter->first, aTransformer.get( OFileNotation::N_SYSTEM ), aIter->second.bReadOnly ); - } - - String aUserData = GetUserData(); - if ( aUserData.Len() ) - { - // Spaltenbreite restaurieren - pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() ); - HeaderEndDrag_Impl( NULL ); - // Sortierrichtung restaurieren - sal_Bool bUp = (sal_Bool)(sal_uInt16)aUserData.GetToken(1).ToInt32(); - HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); - HeaderSelect_Impl( NULL ); - } -} - -// ----------------------------------------------------------------------- - -void DbRegistrationOptionsPage::FillUserData() -{ - String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) ); - aUserData += ';'; - HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE ); - sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); - aUserData += (bUp ? '1' : '0'); - SetUserData( aUserData ); -} -// ----------------------------------------------------------------------- - -IMPL_LINK( DbRegistrationOptionsPage, DeleteHdl, void *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = pPathBox->FirstSelected(); - if ( pEntry ) - { - QueryBox aQuery(this,CUI_RES(QUERY_DELETE_CONFIRM)); - if ( aQuery.Execute() == RET_YES ) - pPathBox->GetModel()->Remove(pEntry); - } - return 0; -} -// ----------------------------------------------------------------------- -IMPL_LINK( DbRegistrationOptionsPage, NewHdl, void *, EMPTYARG ) -{ - String sNewName,sNewLocation; - openLinkDialog(sNewName,sNewLocation); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( DbRegistrationOptionsPage, EditHdl, void *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = pPathBox->GetCurEntry(); - if ( !pEntry ) - return 0L; - - DatabaseRegistration* pOldRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); - if ( !pOldRegistration || pOldRegistration->bReadOnly ) - return 0L; - - String sOldName = pPathBox->GetEntryText(pEntry,0); - m_pCurEntry = pEntry; - openLinkDialog( sOldName, pOldRegistration->sLocation, pEntry ); - m_pCurEntry = NULL; - - return 1L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, HeaderBar*, pBar ) -{ - if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE ) - return 0; - - HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); - sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); - SvSortMode eMode = SortAscending; - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - eMode = SortDescending; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); - SvTreeList* pModel = pPathBox->GetModel(); - pModel->SetSortMode( eMode ); - pModel->Resort(); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( DbRegistrationOptionsPage, HeaderEndDrag_Impl, HeaderBar*, pBar ) -{ - if ( pBar && !pBar->GetCurItemId() ) - return 0; - - if ( !pHeaderBar->IsItemMode() ) - { - Size aSz; - sal_uInt16 nTabs = pHeaderBar->GetItemCount(); - long nTmpSz = 0; - long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE); - long nBarWidth = pHeaderBar->GetSizePixel().Width(); - - if(nWidth < TAB_WIDTH_MIN) - pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN); - else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN ) - pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN ); - - for ( sal_uInt16 i = 1; i <= nTabs; ++i ) - { - long _nWidth = pHeaderBar->GetItemSize(i); - aSz.Width() = _nWidth + nTmpSz; - nTmpSz += _nWidth; - pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT ); - } - } - return 1; -} -// ----------------------------------------------------------------------- - -IMPL_LINK( DbRegistrationOptionsPage, PathSelect_Impl, SvTabListBox *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = pPathBox->FirstSelected(); - - bool bReadOnly = true; - if ( pEntry ) - { - DatabaseRegistration* pRegistration = static_cast< DatabaseRegistration* >( pEntry->GetUserData() ); - bReadOnly = pRegistration->bReadOnly; - } - - m_aEdit.Enable( !bReadOnly ); - m_aDelete.Enable( !bReadOnly ); - return 0; -} -// ----------------------------------------------------------------------------- -void DbRegistrationOptionsPage::insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool _bReadOnly ) -{ - String aStr( _sName ); - aStr += '\t'; - aStr += String(_sLocation); - - SvLBoxEntry* pEntry = NULL; - if ( _bReadOnly ) - { - Image aLocked( CUI_RES( RID_SVXBMP_LOCK ) ); - pEntry = pPathBox->InsertEntry( aStr, aLocked, aLocked ); - } - else - { - pEntry = pPathBox->InsertEntry( aStr ); - } - - pEntry->SetUserData( new DatabaseRegistration( _sLocation, _bReadOnly ) ); -} - -// ----------------------------------------------------------------------------- -void DbRegistrationOptionsPage::openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry) -{ - ODocumentLinkDialog aDlg(this,_pEntry == NULL); - - aDlg.set(_sOldName,_sOldLocation); - aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) ); - - if ( aDlg.Execute() == RET_OK ) - { - String sNewName,sNewLocation; - aDlg.get(sNewName,sNewLocation); - if ( _pEntry == NULL || sNewName != _sOldName || sNewLocation != _sOldLocation ) - { - if ( _pEntry ) - { - delete static_cast< DatabaseRegistration* >( _pEntry->GetUserData() ); - pPathBox->GetModel()->Remove( _pEntry ); - } - insertNewEntry( sNewName, sNewLocation, false ); - m_bModified = sal_True; - } - } -} -// ----------------------------------------------------------------------------- -IMPL_LINK( DbRegistrationOptionsPage, NameValidator, String*, _pName ) -{ - if ( _pName ) - { - sal_uLong nCount = pPathBox->GetEntryCount(); - for ( sal_uLong i = 0; i < nCount; ++i ) - { - SvLBoxEntry* pEntry = pPathBox->GetEntry(i); - if ( (!m_pCurEntry || m_pCurEntry != pEntry) && pPathBox->GetEntryText(pEntry,0) == *_pName ) - return 0L; - } - } - return 1L; -} -//........................................................................ -} // namespace svx -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregister.hrc b/cui/source/options/dbregister.hrc deleted file mode 100644 index eb53ca07f..000000000 --- a/cui/source/options/dbregister.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_DBREGISTER_HRC -#define SVX_DBREGISTER_HRC -// defines --------------------------------------------------------------- - -#define FT_TYPE 10 -#define FT_PATH 11 -#define LB_PATH 12 -#define BTN_NEW 13 -#define BTN_EDIT 14 -#define GB_STD 15 -#define IMG_LOCK 16 -#define IMG_LOCK_HC 17 -#define BTN_DELETE 18 - -#endif // SVX_DBREGISTER_HRC - diff --git a/cui/source/options/dbregister.src b/cui/source/options/dbregister.src deleted file mode 100644 index 88cd8e4df..000000000 --- a/cui/source/options/dbregister.src +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dbregister.hrc" -#include -#include -#include - -// RID_SFXPAGE_PATH ----------------------------------------------------- -#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; } -TabPage RID_SFXPAGE_DBREGISTER -{ - HelpId = "cui:TabPage:RID_SFXPAGE_DBREGISTER" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Registered databases" ; - - FixedText FT_TYPE - { - Hide = TRUE; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Registered name" ; - }; - FixedText FT_PATH - { - Hide = TRUE; - Pos = MAP_APPFONT ( 110 , 14 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Database file" ; - }; - Control LB_PATH - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 236 , 147 ) ; - Border = TRUE ; - TabStop = TRUE; - }; - PushButton BTN_NEW - { - HelpID = "cui:PushButton:RID_SFXPAGE_DBREGISTER:BTN_NEW"; - Pos = MAP_APPFONT ( 47 , 165 ) ; - Size = MAP_APPFONT ( 65 , 14 ) ; - Text [ en-US ] = "~New..." ; - }; - PushButton BTN_EDIT - { - HelpID = "cui:PushButton:RID_SFXPAGE_DBREGISTER:BTN_EDIT"; - Pos = MAP_APPFONT ( 183 , 165 ) ; - Size = MAP_APPFONT ( 65 , 14 ) ; - Text [ en-US ] = "~Edit..." ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SFXPAGE_DBREGISTER:BTN_DELETE"; - Pos = MAP_APPFONT ( 115 , 165 ) ; - Size = MAP_APPFONT ( 65 , 14 ) ; - Text [ en-US ] = "~Delete" ; - }; - FixedLine GB_STD - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Registered databases" ; - }; -}; - diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx deleted file mode 100644 index 097c3ebdf..000000000 --- a/cui/source/options/dbregisterednamesconfig.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "connpooloptions.hxx" -#include "dbregisterednamesconfig.hxx" -#include "dbregistersettings.hxx" -#include "svx/svxids.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//........................................................................ -namespace svx -{ -//........................................................................ - - using namespace ::utl; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::container; - - //==================================================================== - //= DbRegisteredNamesConfig - //==================================================================== - //-------------------------------------------------------------------- - void DbRegisteredNamesConfig::GetOptions( SfxItemSet& _rFillItems ) - { - DatabaseRegistrations aSettings; - - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XDatabaseRegistrations > xRegistrations( - aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); - - Sequence< ::rtl::OUString > aRegistrationNames( xRegistrations->getRegistrationNames() ); - const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray(); - const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); - for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) - { - ::rtl::OUString sLocation( xRegistrations->getDatabaseLocation( *pRegistrationName ) ); - aSettings[ *pRegistrationName ] = - DatabaseRegistration( sLocation, xRegistrations->isDatabaseRegistrationReadOnly( *pRegistrationName ) ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - _rFillItems.Put( DatabaseMapItem( SID_SB_DB_REGISTER, aSettings ) ); - } - - //-------------------------------------------------------------------- - void DbRegisteredNamesConfig::SetOptions(const SfxItemSet& _rSourceItems) - { - // the settings for the single drivers - SFX_ITEMSET_GET( _rSourceItems, pRegistrations, DatabaseMapItem, SID_SB_DB_REGISTER, sal_True ); - if ( !pRegistrations ) - return; - - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XDatabaseRegistrations > xRegistrations( - aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); - - const DatabaseRegistrations& rNewRegistrations = pRegistrations->getRegistrations(); - for ( DatabaseRegistrations::const_iterator reg = rNewRegistrations.begin(); - reg != rNewRegistrations.end(); - ++reg - ) - { - const ::rtl::OUString sName = reg->first; - const ::rtl::OUString sLocation = reg->second.sLocation; - - if ( xRegistrations->hasRegisteredDatabase( sName ) ) - { - if ( !xRegistrations->isDatabaseRegistrationReadOnly( sName ) ) - xRegistrations->changeDatabaseLocation( sName, sLocation ); - else - { - OSL_ENSURE( xRegistrations->getDatabaseLocation( sName ) == sLocation, - "DbRegisteredNamesConfig::SetOptions: somebody changed a read-only registration. How unrespectful." ); - } - } - else - xRegistrations->registerDatabaseLocation( sName, sLocation ); - } - - // delete unused entries - Sequence< ::rtl::OUString > aRegistrationNames = xRegistrations->getRegistrationNames(); - const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray(); - const ::rtl::OUString* pRegistrationNamesEnd = pRegistrationName + aRegistrationNames.getLength(); - for ( ; pRegistrationName != pRegistrationNamesEnd; ++pRegistrationName ) - { - if ( rNewRegistrations.find( *pRegistrationName ) == rNewRegistrations.end() ) - xRegistrations->revokeDatabaseLocation( *pRegistrationName ); - } - } - catch( const Exception& ) - { - //DBG_UNHANDLED_EXCEPTION(); - } - } - -//........................................................................ -} // namespace svx -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregisterednamesconfig.hxx b/cui/source/options/dbregisterednamesconfig.hxx deleted file mode 100644 index 1754d4c81..000000000 --- a/cui/source/options/dbregisterednamesconfig.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_DBREGISTEREDNAMESCONFIG_HXX -#define SVX_DBREGISTEREDNAMESCONFIG_HXX - -class SfxItemSet; -//........................................................................ -namespace svx -{ -//........................................................................ - - //==================================================================== - //= DbRegisteredNamesConfig - //==================================================================== - class DbRegisteredNamesConfig - { - - public: - static void GetOptions(SfxItemSet& _rFillItems); - static void SetOptions(const SfxItemSet& _rSourceItems); - }; - -//........................................................................ -} // namespace svx -//........................................................................ - -#endif // SVX_DBREGISTEREDNAMESCONFIG_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregistersettings.cxx b/cui/source/options/dbregistersettings.cxx deleted file mode 100644 index 561b96547..000000000 --- a/cui/source/options/dbregistersettings.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dbregistersettings.hxx" - -#include - -//........................................................................ -namespace svx -{ -//........................................................................ - - //==================================================================== - //= DatabaseMapItem - //==================================================================== - TYPEINIT1( DatabaseMapItem, SfxPoolItem ) - //-------------------------------------------------------------------- - DatabaseMapItem::DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ) - :SfxPoolItem( _nId ) - ,m_aRegistrations( _rRegistrations ) - { - } - - //-------------------------------------------------------------------- - int DatabaseMapItem::operator==( const SfxPoolItem& _rCompare ) const - { - const DatabaseMapItem* pItem = PTR_CAST(DatabaseMapItem, &_rCompare); - if ( !pItem ) - return sal_False; - - if ( m_aRegistrations.size() != pItem->m_aRegistrations.size() ) - return sal_False; - - return m_aRegistrations == pItem->m_aRegistrations; - } - - //-------------------------------------------------------------------- - SfxPoolItem* DatabaseMapItem::Clone( SfxItemPool* ) const - { - return new DatabaseMapItem( Which(), m_aRegistrations ); - } - - //-------------------------------------------------------------------- - -//........................................................................ -} // namespace svx -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/dbregistersettings.hxx b/cui/source/options/dbregistersettings.hxx deleted file mode 100644 index 531eac7a0..000000000 --- a/cui/source/options/dbregistersettings.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_DBREGISTERSETTING_HXX -#define SVX_DBREGISTERSETTING_HXX - -#include -#include - -//........................................................................ -namespace svx -{ -//........................................................................ - - struct DatabaseRegistration - { - ::rtl::OUString sLocation; - bool bReadOnly; - - DatabaseRegistration() - :sLocation() - ,bReadOnly( true ) - { - } - - DatabaseRegistration( const ::rtl::OUString& _rLocation, const sal_Bool _bReadOnly ) - :sLocation( _rLocation ) - ,bReadOnly( _bReadOnly ) - { - } - - bool operator==( const DatabaseRegistration& _rhs ) const - { - return ( sLocation == _rhs.sLocation ); - // do not take the read-only-ness into account, this is not maintained everywhere, but only - // properly set when filling the struct from the XDatabaseRegistrations data - } - - bool operator!=( const DatabaseRegistration& _rhs ) const - { - return !( this->operator==( _rhs ) ); - } - }; - - typedef ::std::map< ::rtl::OUString, DatabaseRegistration, ::comphelper::UStringLess > DatabaseRegistrations; - - //==================================================================== - //= DatabaseMapItem - //==================================================================== - class DatabaseMapItem : public SfxPoolItem - { - protected: - DatabaseRegistrations m_aRegistrations; - - public: - TYPEINFO(); - - DatabaseMapItem( sal_uInt16 _nId, const DatabaseRegistrations& _rRegistrations ); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - - const DatabaseRegistrations& - getRegistrations() const { return m_aRegistrations; } - }; - -//........................................................................ -} // namespace svx -//........................................................................ -#endif // SVX_DBREGISTERSETTING_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx deleted file mode 100644 index 971f8e579..000000000 --- a/cui/source/options/doclinkdialog.cxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "doclinkdialog.hxx" -#include "doclinkdialog.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -//...................................................................... -namespace svx -{ -//...................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::ucb; - using namespace ::svt; - - //================================================================== - //= ODocumentLinkDialog - //================================================================== - //------------------------------------------------------------------ - ODocumentLinkDialog::ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew ) - :ModalDialog( _pParent, CUI_RES(DLG_DOCUMENTLINK) ) - ,m_aURLLabel (this, CUI_RES(FT_URL)) - ,m_aURL (this, CUI_RES(CMB_URL)) - ,m_aBrowseFile (this, CUI_RES(PB_BROWSEFILE)) - ,m_aNameLabel (this, CUI_RES(FT_NAME)) - ,m_aName (this, CUI_RES(ET_NAME)) - ,m_aBottomLine (this, CUI_RES(FL_BOTTOM)) - ,m_aOK (this, CUI_RES(BTN_OK)) - ,m_aCancel (this, CUI_RES(BTN_CANCEL)) - ,m_aHelp (this, CUI_RES(BTN_HELP)) - ,m_bCreatingNew(_bCreateNew) - { - String sText = String( CUI_RES( m_bCreatingNew ? STR_NEW_LINK : STR_EDIT_LINK ) ); - SetText(sText); - - FreeResource(); - - String sTemp = String::CreateFromAscii("*.odb"); - m_aURL.SetFilter(sTemp); - - m_aName.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) ); - m_aURL.SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) ); - m_aBrowseFile.SetClickHdl( LINK(this, ODocumentLinkDialog, OnBrowseFile) ); - m_aOK.SetClickHdl( LINK(this, ODocumentLinkDialog, OnOk) ); - - m_aURL.SetDropDownLineCount(10); - - validate(); - - m_aURL.SetDropDownLineCount( 5 ); - } - - //------------------------------------------------------------------ - void ODocumentLinkDialog::set( const String& _rName, const String& _rURL ) - { - m_aName.SetText(_rName); - m_aURL.SetText(_rURL); - validate(); - } - - //------------------------------------------------------------------ - void ODocumentLinkDialog::get( String& _rName, String& _rURL ) const - { - _rName = m_aName.GetText(); - _rURL = m_aURL.GetText(); - } - - //------------------------------------------------------------------ - void ODocumentLinkDialog::validate( ) - { - - m_aOK.Enable( (0 != m_aName.GetText().Len()) && ( 0 != m_aURL.GetText().Len() ) ); - } - - //------------------------------------------------------------------ - IMPL_LINK( ODocumentLinkDialog, OnOk, void*, EMPTYARG ) - { - // get the current URL - ::rtl::OUString sURL = m_aURL.GetText(); - OFileNotation aTransformer(sURL); - sURL = aTransformer.get(OFileNotation::N_URL); - - // check for the existence of the selected file - sal_Bool bFileExists = sal_False; - try - { - ::ucbhelper::Content aFile(sURL, Reference< XCommandEnvironment >()); - if (aFile.isDocument()) - bFileExists = sal_True; - } - catch(Exception&) - { - } - - if (!bFileExists) - { - String sMsg = String(CUI_RES(STR_LINKEDDOC_DOESNOTEXIST)); - sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText()); - ErrorBox aError(this, WB_OK , sMsg); - aError.Execute(); - return 0L; - } // if (!bFileExists) - INetURLObject aURL( sURL ); - if ( aURL.GetProtocol() != INET_PROT_FILE ) - { - String sMsg = String(CUI_RES(STR_LINKEDDOC_NO_SYSTEM_FILE)); - sMsg.SearchAndReplaceAscii("$file$", m_aURL.GetText()); - ErrorBox aError(this, WB_OK , sMsg); - aError.Execute(); - return 0L; - } - - String sCurrentText = m_aName.GetText(); - if ( m_aNameValidator.IsSet() ) - { - if ( !m_aNameValidator.Call( &sCurrentText ) ) - { - String sMsg = String(CUI_RES(STR_NAME_CONFLICT)); - sMsg.SearchAndReplaceAscii("$file$", sCurrentText); - InfoBox aError(this, sMsg); - aError.Execute(); - - m_aName.SetSelection(Selection(0,sCurrentText.Len())); - m_aName.GrabFocus(); - return 0L; - } - } - - EndDialog(RET_OK); - return 0L; - } - - //------------------------------------------------------------------ - IMPL_LINK( ODocumentLinkDialog, OnBrowseFile, void*, EMPTYARG ) - { - ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK | WB_STDMODAL | WB_OPEN); - static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - if ( pFilter ) - { - aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension()); - aFileDlg.SetCurrentFilter(pFilter->GetUIName()); - } - - String sPath = m_aURL.GetText(); - if (sPath.Len()) - { - OFileNotation aTransformer( sPath, OFileNotation::N_SYSTEM ); - aFileDlg.SetDisplayDirectory( aTransformer.get( OFileNotation::N_URL ) ); - } - - if (0 != aFileDlg.Execute()) - return 0L; - - if (0 == m_aName.GetText().Len()) - { // default the name to the base of the chosen URL - INetURLObject aParser; - - aParser.SetSmartProtocol(INET_PROT_FILE); - aParser.SetSmartURL(aFileDlg.GetPath()); - - m_aName.SetText(aParser.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET)); - - m_aName.SetSelection(Selection(0,m_aName.GetText().Len())); - m_aName.GrabFocus(); - } - else - m_aURL.GrabFocus(); - - // get the path in system notation - OFileNotation aTransformer(aFileDlg.GetPath(), OFileNotation::N_URL); - m_aURL.SetText(aTransformer.get(OFileNotation::N_SYSTEM)); - - validate(); - return 0L; - } - - //------------------------------------------------------------------ - IMPL_LINK( ODocumentLinkDialog, OnTextModified, Control*, EMPTYARG ) - { - validate( ); - return 0L; - } - -//...................................................................... -} // namespace svx -//...................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/doclinkdialog.hrc b/cui/source/options/doclinkdialog.hrc deleted file mode 100644 index 2ad812e73..000000000 --- a/cui/source/options/doclinkdialog.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_DOCLINKDIALOG_HRC_ -#define _SVX_DOCLINKDIALOG_HRC_ - -#define FT_NAME 1 -#define FT_URL 2 - -#define ET_NAME 1 - -#define CMB_URL 1 - -#define PB_BROWSEFILE 1 - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -#define FL_BOTTOM 1 - -#define STR_EDIT_LINK 1 -#define STR_NEW_LINK 2 - -#endif // _SVX_DOCLINKDIALOG_HRC_ - diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx deleted file mode 100644 index 298d15c99..000000000 --- a/cui/source/options/doclinkdialog.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_DOCLINKDIALOG_HXX_ -#define _SVX_DOCLINKDIALOG_HXX_ - -#include -#include -#include -#include -#include -#include - -//...................................................................... -namespace svx -{ -//...................................................................... - - //================================================================== - //= ODocumentLinkDialog - //================================================================== - /** dialog for editing document links associated with data sources - */ - class ODocumentLinkDialog : public ModalDialog - { - protected: - FixedText m_aURLLabel; - ::svt::OFileURLControl m_aURL; - PushButton m_aBrowseFile; - FixedText m_aNameLabel; - Edit m_aName; - - FixedLine m_aBottomLine; - OKButton m_aOK; - CancelButton m_aCancel; - HelpButton m_aHelp; - - sal_Bool m_bCreatingNew; - - Link m_aNameValidator; - - public: - ODocumentLinkDialog( Window* _pParent, sal_Bool _bCreateNew ); - - // name validation has to be done by an external instance - // the validator link gets a pointer to a String, and should return 0 if the string is not - // acceptable - void setNameValidator( const Link& _rValidator ) { m_aNameValidator = _rValidator; } - Link getNameValidator( ) const { return m_aNameValidator; } - - void set( const String& _rName, const String& _rURL ); - void get( String& _rName, String& _rURL ) const; - - protected: - DECL_LINK( OnTextModified, Control* ); - DECL_LINK( OnBrowseFile, void* ); - DECL_LINK( OnOk, void* ); - - void validate( ); - }; - -//...................................................................... -} // namespace svx -//...................................................................... - -#endif // _SVX_DOCLINKDIALOG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/doclinkdialog.src b/cui/source/options/doclinkdialog.src deleted file mode 100644 index e0bd02390..000000000 --- a/cui/source/options/doclinkdialog.src +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#ifndef _SVX_DOCLINKDIALOG_HRC_ -#include "doclinkdialog.hrc" -#endif - -#define DIALOG_SIZE_X 200 -#define DIALOG_SIZE_Y 94 -#define BUTTON_SIZE_X 50 -#define BUTTON_SIZE_Y 14 - -#define LABEL_WIDTH 50 - -#define HEIGHT_LABEL 8 -#define HEIGHT_EDIT 12 - -#define LINE_1_Y 6 -#define LINE_2_Y LINE_1_Y + HEIGHT_EDIT + 4 -#define OFFSET_Y 6 - -ModalDialog DLG_DOCUMENTLINK -{ - HelpID = "cui:ModalDialog:DLG_DOCUMENTLINK"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( DIALOG_SIZE_X , DIALOG_SIZE_Y ) ; - - Moveable = TRUE ; - Closeable = TRUE ; - - FixedText FT_URL - { - - Pos = MAP_APPFONT ( 6, LINE_1_Y ) ; - Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ; - Group = TRUE; - - Text [ en-US ] = "~Database file"; - }; - ComboBox CMB_URL - { - HelpID = "cui:ComboBox:DLG_DOCUMENTLINK:CMB_URL"; - Pos = MAP_APPFONT ( 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 3) ; - Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ; - - SVLook = TRUE ; - Border = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_BROWSEFILE - { - HelpID = "cui:PushButton:DLG_DOCUMENTLINK:PB_BROWSEFILE"; - Pos = MAP_APPFONT ( DIALOG_SIZE_X - BUTTON_SIZE_X - 6 , LINE_1_Y + OFFSET_Y + HEIGHT_LABEL - 4) ; - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ); - Text [ en-US ] = "~Browse..."; - }; - - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 6, LINE_1_Y + 2*OFFSET_Y + HEIGHT_LABEL + BUTTON_SIZE_Y - 3) ; - Size = MAP_APPFONT ( DIALOG_SIZE_X - 6, HEIGHT_LABEL ) ; - Group = TRUE; - - Text [ en-US ] = "Registered ~name"; - }; - Edit ET_NAME - { - HelpID = "cui:Edit:DLG_DOCUMENTLINK:ET_NAME"; - Pos = MAP_APPFONT ( 6, LINE_1_Y + 3*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y - 6) ; - Size = MAP_APPFONT ( DIALOG_SIZE_X - 3*LINE_1_Y - BUTTON_SIZE_X , HEIGHT_EDIT ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - - FixedLine FL_BOTTOM - { - Pos = MAP_APPFONT ( 4, LINE_1_Y + 4*OFFSET_Y + 2*HEIGHT_LABEL + BUTTON_SIZE_Y + HEIGHT_EDIT - 6); - Size = MAP_APPFONT ( DIALOG_SIZE_X - 8, 8 ); - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( DIALOG_SIZE_X - 3 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y ); - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ); - DefButton = TRUE; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( DIALOG_SIZE_X - 2 * ( BUTTON_SIZE_X + 3 ) - 6, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y ); - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ); - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( DIALOG_SIZE_X - 1 * ( BUTTON_SIZE_X + 3 ) - 3, DIALOG_SIZE_Y - 6 - BUTTON_SIZE_Y ); - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ); - }; - - String STR_EDIT_LINK - { - Text [ en-US ] = "Edit Database Link"; - }; - String STR_NEW_LINK - { - Text [ en-US ] = "Create Database Link"; - }; -}; - -String STR_LINKEDDOC_DOESNOTEXIST -{ - Text [ en-US ] = "The file\n$file$\ndoes not exist."; -}; - -String STR_LINKEDDOC_NO_SYSTEM_FILE -{ - Text [ en-US ] = "The file\n$file$\ndoes not exist in the local file system."; -}; - -String STR_NAME_CONFLICT -{ - Text [ en-US ] = "The name '$file$' is already used for another database.\nPlease choose a different name."; -}; - -QueryBox QUERY_DELETE_CONFIRM -{ - Buttons = WB_YES_NO ; - Message [ en-US ] = "Do you want to delete the entry?" ; -}; diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx deleted file mode 100644 index 588982c34..000000000 --- a/cui/source/options/fontsubs.cxx +++ /dev/null @@ -1,568 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "fontsubs.hrc" -#include "fontsubs.hxx" -#include -#include "helpid.hrc" -#include - -/*********************************************************************/ -/* */ -/* TabPage Fontersetzung */ -/* */ -/*********************************************************************/ - -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 -#define CBCOL_BOTH 2 - -SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES(RID_SVX_FONT_SUBSTITUTION), rSet), - aUseTableCB (this, CUI_RES(CB_USETABLE)), - aFont1FT (this, CUI_RES(FT_FONT1)), - aFont1CB (this, CUI_RES(CB_FONT1)), - aFont2FT (this, CUI_RES(FT_FONT2)), - aFont2CB (this, CUI_RES(CB_FONT2)), - aNewDelTBX (this, CUI_RES(TBX_SUBSTNEWDEL)), - m_aCheckLBContainer(this, CUI_RES(CLB_SUBSTITUTES)), - aCheckLB(m_aCheckLBContainer), - - aSourceViewFontsFL (this, CUI_RES(FL_SOURCEVIEW )), - aFontNameFT (this, CUI_RES(FT_FONTNAME )), - aFontNameLB (this, CUI_RES(LB_FONTNAME )), - aNonPropFontsOnlyCB(this, CUI_RES(CB_NONPROP )), - aFontHeightFT (this, CUI_RES(FT_FONTHEIGHT )), - aFontHeightLB (this, CUI_RES(LB_FONTHEIGHT )), - - aImageList (CUI_RES(IL_ICON)), - - sAutomatic (CUI_RES( STR_AUTOMATIC )), - pConfig(new SvtFontSubstConfig), - pSourceViewConfig(new utl::SourceViewConfig), - - sHeader1 (CUI_RES( STR_HEADER1 )), - sHeader2 (CUI_RES( STR_HEADER2 )), - sHeader3 (CUI_RES( STR_HEADER3 )), - sHeader4 (CUI_RES( STR_HEADER4 )), - - pCheckButtonData(0) -{ - FreeResource(); - - aTextColor = aCheckLB.GetTextColor(); - - for(sal_uInt16 k = 0; k < aNewDelTBX.GetItemCount(); k++) - aNewDelTBX.SetItemImage(aNewDelTBX.GetItemId(k), - aImageList.GetImage(aNewDelTBX.GetItemId(k))); - - aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() ); - - long nDelta = ( aFont1CB.GetSizePixel().Height() - - aNewDelTBX.GetSizePixel().Height() ) / 2; - Point aNewPnt = aNewDelTBX.GetPosPixel(); - aNewPnt.Y() += nDelta; - aNewDelTBX.SetPosPixel( aNewPnt ); - - aCheckLB.SetHelpId(HID_OFA_FONT_SUBST_CLB); - aCheckLB.SetStyle(aCheckLB.GetStyle()|WB_HSCROLL|WB_VSCROLL); - aCheckLB.SetSelectionMode(MULTIPLE_SELECTION); - aCheckLB.SortByCol(2); - - Link aLink(LINK(this, SvxFontSubstTabPage, SelectHdl)); - - aCheckLB.SetSelectHdl(aLink); - aUseTableCB.SetClickHdl(aLink); - aFont1CB.SetSelectHdl(aLink); - aFont1CB.SetModifyHdl(aLink); - aFont2CB.SetSelectHdl(aLink); - aFont2CB.SetModifyHdl(aLink); - aNewDelTBX.SetClickHdl(aLink); - - aNonPropFontsOnlyCB.SetClickHdl(LINK(this, SvxFontSubstTabPage, NonPropFontsHdl)); - - static long aStaticTabs[] = { 4, 0, 0, 0, 0 }; - long nW1 = GetTextWidth( sHeader1 ); - long nW2 = GetTextWidth( sHeader2 ); - long nMax = Max( nW1, nW2 ) + 6; // width of the longest header + a little offset - long nMin = aFontNameFT.LogicToPixel( Size( 30, 0 ), MAP_APPFONT ).Width(); - nMax = Max( nMax, nMin ); - const long nDoubleMax = 2*nMax; - const long nRest = aCheckLB.GetSizePixel().Width() - nDoubleMax; - aStaticTabs[2] = nMax; - aStaticTabs[3] = nDoubleMax; - aStaticTabs[4] = nDoubleMax + nRest/2; - aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs, MAP_PIXEL ); - - String sHeader(sHeader1); - String sTab(String::CreateFromAscii("\t")); - String sTabSpace(String::CreateFromAscii("\t ")); - sHeader += sTab; - sHeader += sHeader2; - sHeader += sTabSpace; - sHeader += sHeader3; - sHeader += sTabSpace; - sHeader += sHeader4; - aCheckLB.InsertHeaderEntry(sHeader); - - HeaderBar* pBar = aCheckLB.GetTheHeaderBar(); - - HeaderBarItemBits nBits = pBar->GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED; - nBits &= ~HIB_CLICKABLE; - pBar->SetItemBits(1, nBits); - pBar->SetItemBits(2, nBits); - - sal_uInt16 nHeight; - for(nHeight = 6; nHeight <= 16; nHeight++) - aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight)); - for(nHeight = 18; nHeight <= 28; nHeight+= 2) - aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight)); - for(nHeight = 32; nHeight <= 48; nHeight+= 4) - aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight)); - for(nHeight = 54; nHeight <= 72; nHeight+= 6) - aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight)); - for(nHeight = 80; nHeight <= 96; nHeight+= 8) - aFontHeightLB.InsertEntry(String::CreateFromInt32(nHeight)); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SvLBoxEntry* SvxFontSubstTabPage::CreateEntry(String& rFont1, String& rFont2) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if( !pCheckButtonData ) - pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); - - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - - pEntry->AddItem( new SvLBoxButton( pEntry, - SvLBoxButtonKind_enabledCheckbox, 0, - pCheckButtonData ) ); - pEntry->AddItem( new SvLBoxButton( pEntry, - SvLBoxButtonKind_enabledCheckbox, 0, - pCheckButtonData ) ); - - pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont1 ) ); - pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont2 ) ); - - return pEntry; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - - SvxFontSubstTabPage::~SvxFontSubstTabPage() -{ - delete pCheckButtonData; - delete pConfig; - delete pSourceViewConfig; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SfxTabPage* SvxFontSubstTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxFontSubstTabPage(pParent, rAttrSet); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -sal_Bool SvxFontSubstTabPage::FillItemSet( SfxItemSet& ) -{ - pConfig->ClearSubstitutions();// remove all entries - - pConfig->Enable(aUseTableCB.IsChecked()); - - SvLBoxEntry* pEntry = aCheckLB.First(); - - while (pEntry) - { - SubstitutionStruct aAdd; - aAdd.sFont = aCheckLB.GetEntryText(pEntry, 0); - aAdd.sReplaceBy = aCheckLB.GetEntryText(pEntry, 1); - aAdd.bReplaceAlways = aCheckLB.IsChecked(pEntry, 0); - aAdd.bReplaceOnScreenOnly = aCheckLB.IsChecked(pEntry, 1); - pConfig->AddSubstitution(aAdd); - pEntry = aCheckLB.Next(pEntry); - } - if(pConfig->IsModified()) - pConfig->Commit(); - pConfig->Apply(); - if(aFontHeightLB.GetSavedValue() != aFontHeightLB.GetSelectEntryPos()) - pSourceViewConfig->SetFontHeight((sal_Int16)aFontHeightLB.GetSelectEntry().ToInt32()); - if(aNonPropFontsOnlyCB.GetSavedValue() != aNonPropFontsOnlyCB.IsChecked()) - pSourceViewConfig->SetShowProportionalFontsOnly(aNonPropFontsOnlyCB.IsChecked()); - //font name changes cannot be detected by saved values - String sFontName; - if(aFontNameLB.GetSelectEntryPos()) - sFontName = aFontNameLB.GetSelectEntry(); - pSourceViewConfig->SetFontName(sFontName); - - return sal_False; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -void SvxFontSubstTabPage::Reset( const SfxItemSet& ) -{ - aCheckLB.SetUpdateMode(sal_False); - aCheckLB.Clear(); - - FontList aFntLst( Application::GetDefaultDevice() ); - aFont1CB.Fill( &aFntLst ); - aFont2CB.Fill( &aFntLst ); - - sal_Int32 nCount = pConfig->SubstitutionCount(); - if (nCount) - aUseTableCB.Check(pConfig->IsEnabled()); - - for (sal_Int32 i = 0; i < nCount; i++) - { - const SubstitutionStruct* pSubs = pConfig->GetSubstitution(i); - String aTmpStr1(pSubs->sFont); - String aTmpStr2(pSubs->sReplaceBy); - SvLBoxEntry* pEntry = CreateEntry(aTmpStr1, aTmpStr2); - aCheckLB.Insert(pEntry); - aCheckLB.CheckEntry(pEntry, 0, pSubs->bReplaceAlways); - aCheckLB.CheckEntry(pEntry, 1, pSubs->bReplaceOnScreenOnly); - } - - CheckEnable(); - aCheckLB.SetUpdateMode(sal_True); - - //fill font name box first - aNonPropFontsOnlyCB.Check(pSourceViewConfig->IsShowProportionalFontsOnly()); - NonPropFontsHdl(&aNonPropFontsOnlyCB); - String sFontName(pSourceViewConfig->GetFontName()); - if(sFontName.Len()) - aFontNameLB.SelectEntry(sFontName); - else - aFontNameLB.SelectEntryPos(0); - short nFontHeight = pSourceViewConfig->GetFontHeight(); - aFontHeightLB.SelectEntry(String::CreateFromInt32(nFontHeight)); - aNonPropFontsOnlyCB.SaveValue(); - aFontHeightLB.SaveValue(); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -IMPL_LINK(SvxFontSubstTabPage, SelectHdl, Window*, pWin) -{ - if (pWin == &aNewDelTBX) - { - SvLBoxEntry* pEntry; - // nCol ist behaemmerterweise die nCol'te Textspalte, werden nicht gezaehlt! - // Daher als Spalte "0". - sal_uLong nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0); - - switch (aNewDelTBX.GetCurItemId()) - { - case BT_SUBSTAPPLY: - { - if (nPos != 0xffffffff) - { - // Eintrag aendern - aCheckLB.SetEntryText(aFont2CB.GetText(), nPos, 1); - pEntry = aCheckLB.GetEntry(nPos); - } - else - { - // Neuer Eintrag - String sFont1 = aFont1CB.GetText(); - String sFont2 = aFont2CB.GetText(); - - pEntry = CreateEntry(sFont1, sFont2); - aCheckLB.Insert(pEntry); - } - aCheckLB.SelectAll(sal_False); - aCheckLB.Select(pEntry); - } - break; - - case BT_SUBSTDELETE: - { - if (nPos != 0xffffffff) - { - pEntry = aCheckLB.FirstSelected(); - while (pEntry) - { - SvLBoxEntry* pDelEntry = pEntry; - pEntry = aCheckLB.NextSelected(pEntry); - aCheckLB.RemoveEntry(pDelEntry); - } - } - } - break; - } - } - - if (pWin == &aCheckLB) - { - SvLBoxEntry* pEntry = aCheckLB.FirstSelected(); - - if (aCheckLB.NextSelected(pEntry) == 0) - { - aFont1CB.SetText(aCheckLB.GetEntryText(pEntry, 0)); - aFont2CB.SetText(aCheckLB.GetEntryText(pEntry, 1)); - } - } - - if (pWin == &aFont1CB) - { - sal_uLong nPos = aCheckLB.GetEntryPos(aFont1CB.GetText(), 0); - - if (nPos != 0xffffffff) - { - SvLBoxEntry* pEntry = aCheckLB.GetEntry(nPos); - - if (pEntry != aCheckLB.FirstSelected()) - { - aCheckLB.SelectAll(sal_False); - aCheckLB.Select(pEntry); - } - } - } - - CheckEnable(); - - return 0; -} - -//-------------------------------------------------------------------------- -IMPL_LINK(SvxFontSubstTabPage, NonPropFontsHdl, CheckBox*, pBox) -{ - String sFontName = aFontNameLB.GetSelectEntry(); - sal_Bool bNonPropOnly = pBox->IsChecked(); - aFontNameLB.Clear(); - FontList aFntLst( Application::GetDefaultDevice() ); - aFontNameLB.InsertEntry(sAutomatic); - sal_uInt16 nFontCount = aFntLst.GetFontNameCount(); - for(sal_uInt16 nFont = 0; nFont < nFontCount; nFont++) - { - const FontInfo& rInfo = aFntLst.GetFontName( nFont ); - if(!bNonPropOnly || rInfo.GetPitch() == PITCH_FIXED) - aFontNameLB.InsertEntry(rInfo.GetName()); - } - aFontNameLB.SelectEntry(sFontName); - return 0; -} - -void SvxFontSubstTabPage::CheckEnable() -{ - sal_Bool bEnableAll = aUseTableCB.IsChecked(); - - if (bEnableAll) - { - sal_Bool bApply, bDelete; - - SvLBoxEntry* pEntry = aCheckLB.FirstSelected(); - - String sEntry = aFont1CB.GetText(); - sEntry += '\t'; - sEntry += aFont2CB.GetText(); - - // Wegen OS/2-Optimierungsfehler (Bug #56267) etwas umstaendlicher: - if (!aFont1CB.GetText().Len() || !aFont2CB.GetText().Len()) - bApply = sal_False; - else if(aFont1CB.GetText() == aFont2CB.GetText()) - bApply = sal_False; - else if(aCheckLB.GetEntryPos(sEntry) != 0xffffffff) - bApply = sal_False; - else if(pEntry != 0 && aCheckLB.NextSelected(pEntry) != 0) - bApply = sal_False; - else - bApply = sal_True; - - bDelete = pEntry != 0; - - aNewDelTBX.EnableItem(BT_SUBSTAPPLY, bApply); - aNewDelTBX.EnableItem(BT_SUBSTDELETE, bDelete); - } - - if (bEnableAll) - { - if (!aCheckLB.IsEnabled()) - { - aCheckLB.EnableTable(); - aCheckLB.SetTextColor(aTextColor); - aCheckLB.Invalidate(); - SelectHdl(&aFont1CB); - } - } - else - { - if (aCheckLB.IsEnabled()) - { - aCheckLB.DisableTable(); - aCheckLB.SetTextColor(Color(COL_GRAY)); - aCheckLB.Invalidate(); - aCheckLB.SelectAll(sal_False); - } - } - aNewDelTBX.Enable(bEnableAll); - aFont1FT.Enable(bEnableAll); - aFont1CB.Enable(bEnableAll); - aFont2FT.Enable(bEnableAll); - aFont2CB.Enable(bEnableAll); -} - -void SvxFontSubstCheckListBox::SetTabs() -{ - SvxSimpleTable::SetTabs(); - sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; - - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - - pTab = (SvLBoxTab*)aTabs.GetObject(2); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; -} - -void SvxFontSubstCheckListBox::KeyInput( const KeyEvent& rKEvt ) -{ - if(!rKEvt.GetKeyCode().GetModifier() && - KEY_SPACE == rKEvt.GetKeyCode().GetCode()) - { - sal_uLong nSelPos = GetModel()->GetAbsPos(GetCurEntry()); - sal_uInt16 nCol = GetCurrentTabPos() - 1; - if ( nCol < 2 ) - { - CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) ); - CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) ); - } - else - { - sal_uInt16 nCheck = IsChecked(nSelPos, 1) ? 1 : 0; - if(IsChecked(nSelPos, 0)) - nCheck += 2; - nCheck--; - nCheck &= 3; - CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); - CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); - } - } - else - SvxSimpleTable::KeyInput(rKEvt); -} - -void SvxFontSubstCheckListBox::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked) -{ - if ( nPos < GetEntryCount() ) - SetCheckButtonState( - GetEntry(nPos), - nCol, - bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : - SvButtonState( SV_BUTTON_UNCHECKED ) ); -} - -void SvxFontSubstCheckListBox::CheckEntry(SvLBoxEntry* pEntry, sal_uInt16 nCol, sal_Bool bChecked) -{ - if ( pEntry ) - SetCheckButtonState( - pEntry, - nCol, - bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : - SvButtonState( SV_BUTTON_UNCHECKED ) ); -} - -sal_Bool SvxFontSubstCheckListBox::IsChecked(sal_uLong nPos, sal_uInt16 nCol) -{ - return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED; -} - -sal_Bool SvxFontSubstCheckListBox::IsChecked(SvLBoxEntry* pEntry, sal_uInt16 nCol) -{ - return GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED; -} - -void SvxFontSubstCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) -{ - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - switch( eState ) - { - case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); - break; - - case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); - break; - - case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); - break; - } - InvalidateEntry( pEntry ); - } -} - -SvButtonState SvxFontSubstCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol ) const -{ - SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); - - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); - eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); - } - - return eState; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/fontsubs.hrc b/cui/source/options/fontsubs.hrc deleted file mode 100644 index a190b58a0..000000000 --- a/cui/source/options/fontsubs.hrc +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_FONT_SUBSTITUTION -#define _SVX_FONT_SUBSTITUTION - -#include - -// defines ------------------------------------------------------------------ - -#define CLB_SUBSTITUTES 1 -#define FT_FONT1 2 -#define CB_FONT1 3 -#define FT_FONT2 4 -#define CB_FONT2 5 -#define TBX_SUBSTNEWDEL 6 -#define BT_SUBSTAPPLY 7 -#define BT_SUBSTDELETE 8 - -#define STR_HEADER1 10 -#define STR_HEADER2 11 -#define STR_HEADER3 12 -#define STR_HEADER4 13 - -#define IL_ICON 20 -#define CB_USETABLE 21 - -#define FL_SOURCEVIEW 22 -#define FT_FONTNAME 23 -#define LB_FONTNAME 24 -#define CB_NONPROP 25 -#define FT_FONTHEIGHT 26 -#define LB_FONTHEIGHT 27 -#define STR_AUTOMATIC 28 - -#endif diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx deleted file mode 100644 index 50edd71e3..000000000 --- a/cui/source/options/fontsubs.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_FONT_SUBSTITUTION_HXX -#define _SVX_FONT_SUBSTITUTION_HXX - -#include -#include -#include -#include -#include - -namespace utl -{ - class SourceViewConfig; -} - -// class SvxFontSubstCheckListBox ------------------------------------------ - -class SvxFontSubstCheckListBox : public SvxSimpleTable -{ - friend class SvxFontSubstTabPage; - using SvxSimpleTable::SetTabs; - using SvTreeListBox::GetCheckButtonState; - using SvTreeListBox::SetCheckButtonState; - - protected: - virtual void SetTabs(); - virtual void KeyInput( const KeyEvent& rKEvt ); - - public: - SvxFontSubstCheckListBox(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER) - : SvxSimpleTable(rParent, nBits) - { - } - - inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); } - inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); } - - sal_Bool IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0); - sal_Bool IsChecked(SvLBoxEntry* pEntry, sal_uInt16 nCol = 0); - void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked); - void CheckEntry(SvLBoxEntry* pEntry, sal_uInt16 nCol, sal_Bool bChecked); - SvButtonState GetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol ) const; - void SetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol, SvButtonState ); -}; - -// class SvxFontSubstTabPage ---------------------------------------------------- -class SvtFontSubstConfig; -namespace svt {class SourceViewConfig;} -class SvxFontSubstTabPage : public SfxTabPage -{ - CheckBox aUseTableCB; - FixedText aFont1FT; - FontNameBox aFont1CB; - FixedText aFont2FT; - FontNameBox aFont2CB; - ToolBox aNewDelTBX; - SvxSimpleTableContainer m_aCheckLBContainer; - SvxFontSubstCheckListBox aCheckLB; - - FixedLine aSourceViewFontsFL; - FixedText aFontNameFT; - ListBox aFontNameLB; - CheckBox aNonPropFontsOnlyCB; - FixedText aFontHeightFT; - ListBox aFontHeightLB; - - ImageList aImageList; - String sAutomatic; - - SvtFontSubstConfig* pConfig; - utl::SourceViewConfig* pSourceViewConfig; - - String sHeader1; - String sHeader2; - String sHeader3; - String sHeader4; - - Color aTextColor; - - SvLBoxButtonData* pCheckButtonData; - - DECL_LINK(SelectHdl, Window *pWin = 0); - DECL_LINK(NonPropFontsHdl, CheckBox* pBox); - - SvLBoxEntry* CreateEntry(String& rFont1, String& rFont2); - void CheckEnable(); - - - SvxFontSubstTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxFontSubstTabPage(); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - - -#endif // _SVX_FONT_SUBSTITUTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/fontsubs.src b/cui/source/options/fontsubs.src deleted file mode 100644 index 8d9a537fc..000000000 --- a/cui/source/options/fontsubs.src +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include ------------------------------------------------------------------ - -#include "fontsubs.hrc" -#include "helpid.hrc" - - // pragma ------------------------------------------------------------------- - - - - -/**************************************************************************/ - -TabPage RID_SVX_FONT_SUBSTITUTION -{ - HelpID = HID_OFA_FONT_SUBSTITUTION ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - CheckBox CB_USETABLE - { - HelpID = "cui:CheckBox:RID_SVX_FONT_SUBSTITUTION:CB_USETABLE"; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Apply replacement table"; - }; - FixedText FT_FONT1 - { - Pos = MAP_APPFONT ( 6 , 20 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Font"; - }; - ComboBox CB_FONT1 - { - HelpID = "cui:ComboBox:RID_SVX_FONT_SUBSTITUTION:CB_FONT1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 33 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - AutoSize = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - DropDown = TRUE; - Sort = TRUE; - }; - FixedText FT_FONT2 - { - Pos = MAP_APPFONT ( 110 , 20 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Re~place with"; - }; - ComboBox CB_FONT2 - { - HelpID = "cui:ComboBox:RID_SVX_FONT_SUBSTITUTION:CB_FONT2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 110 , 33 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - AutoSize = TRUE ; - AutoHScroll = TRUE ; - DDExtraWidth = TRUE ; - DropDown = TRUE; - Sort = TRUE; - }; - ImageList IL_ICON - { - Prefix = "nu"; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - IdList = - { - BT_SUBSTAPPLY ; - BT_SUBSTDELETE ; - }; - IdCount = { 2 ; }; - }; - ToolBox TBX_SUBSTNEWDEL - { - Pos = MAP_APPFONT ( 214 , 33 ) ; - SVLook = TRUE ; - Border = FALSE ; - ItemList = - { - ToolBoxItem - { - Identifier = BT_SUBSTAPPLY ; - HelpID = HID_OFA_SUBST_APPLY ; - Text [ en-US ] = "Apply" ; - }; - ToolBoxItem - { - Identifier = BT_SUBSTDELETE ; - HelpID = HID_OFA_SUBST_DELETE ; - Text [ en-US ] = "Delete" ; - }; - }; - }; - Control CLB_SUBSTITUTES - { - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 248 , 75 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedLine FL_SOURCEVIEW - { - Pos = MAP_APPFONT ( 6 , 129 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Font settings for HTML, Basic and SQL sources" ; - }; - FixedText FT_FONTNAME - { - Pos = MAP_APPFONT ( 6 , 142 ) ; - Size = MAP_APPFONT ( 57 , 8 ) ; - Text [ en-US ] = "Fonts" ; - }; - ListBox LB_FONTNAME - { - HelpID = "cui:ListBox:RID_SVX_FONT_SUBSTITUTION:LB_FONTNAME"; - Pos = MAP_APPFONT ( 65 , 140 ) ; - Size = MAP_APPFONT ( 100 , 68 ) ; - Border = TRUE ; - TabStop = TRUE ; - DropDown = TRUE; - }; - CheckBox CB_NONPROP - { - HelpID = "cui:CheckBox:RID_SVX_FONT_SUBSTITUTION:CB_NONPROP"; - Pos = MAP_APPFONT ( 65 , 155 ) ; - Size = MAP_APPFONT ( 180 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Non-proportional fonts only" ; - }; - FixedText FT_FONTHEIGHT - { - Pos = MAP_APPFONT ( 6 , 171 ) ; - Size = MAP_APPFONT ( 57 , 8 ) ; - Text [ en-US ] ="~Size"; - }; - ListBox LB_FONTHEIGHT - { - HelpID = "cui:ListBox:RID_SVX_FONT_SUBSTITUTION:LB_FONTHEIGHT"; - Pos = MAP_APPFONT ( 65 , 169 ) ; - Size = MAP_APPFONT ( 30 , 68 ) ; - Border = TRUE ; - TabStop = TRUE ; - DropDown = TRUE; - }; - String STR_HEADER1 - { - Text [ en-US ] = "Always"; - }; - String STR_HEADER2 - { - Text [ en-US ] = "Screen only"; - }; - String STR_HEADER3 - { - Text [ en-US ] = "Font"; - }; - String STR_HEADER4 - { - Text [ en-US ] = "Replace with"; - }; - String STR_AUTOMATIC - { - Text [ en-US ] = "Automatic"; - }; -}; - diff --git a/cui/source/options/internationaloptions.cxx b/cui/source/options/internationaloptions.cxx deleted file mode 100644 index 0ac8a2034..000000000 --- a/cui/source/options/internationaloptions.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "internationaloptions.hxx" -#include "internationaloptions.hrc" -#include -#include -#include "helpid.hrc" -#include -#include - -namespace offapp -{ - - struct InternationalOptionsPage::IMPL - { - FixedLine m_aFL_DefaultTextDirection; - RadioButton m_aRB_TxtDirLeft2Right; - RadioButton m_aRB_TxtDirRight2Left; - FixedLine m_aFL_SheetView; - CheckBox m_aCB_ShtVwRight2Left; - CheckBox m_aCB_ShtVwCurrentDocOnly; - - sal_Bool m_bEnable_SheetView_Opt : 1; - - inline IMPL( Window* _pParent ); - - inline void EnableOption_SheetView( sal_Bool _bEnable = sal_True ); - void ShowOption_SheetView( sal_Bool _bShow = sal_True ); - - sal_Bool FillItemSet( SfxItemSet& _rSet ); - void Reset( const SfxItemSet& _rSet ); - }; - - inline InternationalOptionsPage::IMPL::IMPL( Window* _pParent ) : - m_aFL_DefaultTextDirection ( _pParent, CUI_RES( FL_DEFTXTDIRECTION ) ) - ,m_aRB_TxtDirLeft2Right ( _pParent, CUI_RES( RB_TXTDIR_LEFT2RIGHT ) ) - ,m_aRB_TxtDirRight2Left ( _pParent, CUI_RES( RB_TXTDIR_RIGHT2LEFT ) ) - ,m_aFL_SheetView ( _pParent, CUI_RES( FL_SHEETVIEW ) ) - ,m_aCB_ShtVwRight2Left ( _pParent, CUI_RES( CB_SHTVW_RIGHT2LEFT ) ) - ,m_aCB_ShtVwCurrentDocOnly ( _pParent, CUI_RES( CB_SHTVW_CURRENTDOCONLY ) ) - - ,m_bEnable_SheetView_Opt ( sal_False ) - { - ShowOption_SheetView( m_bEnable_SheetView_Opt ); - } - - inline void InternationalOptionsPage::IMPL::EnableOption_SheetView( sal_Bool _bEnable ) - { - if( m_bEnable_SheetView_Opt != _bEnable ) - { - ShowOption_SheetView( _bEnable ); - - m_bEnable_SheetView_Opt = _bEnable; - } - } - - void InternationalOptionsPage::IMPL::ShowOption_SheetView( sal_Bool _bShow ) - { - m_aFL_SheetView.Show( _bShow ); - m_aCB_ShtVwRight2Left.Show( _bShow ); - m_aCB_ShtVwCurrentDocOnly.Show( _bShow ); - } - - sal_Bool InternationalOptionsPage::IMPL::FillItemSet( SfxItemSet& _rSet ) - { - DBG_ASSERT( _rSet.GetPool(), "-InternationalOptionsPage::FillItemSet(): no pool gives rums!" ); - - // handling of DefaultTextDirection stuff - _rSet.Put( SfxBoolItem( _rSet.GetPool()->GetWhich( SID_ATTR_PARA_LEFT_TO_RIGHT ), - m_aRB_TxtDirLeft2Right.IsChecked() ), - SID_ATTR_PARA_LEFT_TO_RIGHT ); - - return sal_True; - } - - void InternationalOptionsPage::IMPL::Reset( const SfxItemSet& _rSet ) - { - // handling of DefaultTextDirection stuff - const SfxBoolItem* pLeft2RightItem = static_cast< const SfxBoolItem* >( GetItem( _rSet, SID_ATTR_PARA_LEFT_TO_RIGHT ) ); - - DBG_ASSERT( pLeft2RightItem, "+InternationalOptionsPage::Reset(): SID_ATTR_PARA_LEFT_TO_RIGHT not set!" ); - - sal_Bool bLeft2Right = pLeft2RightItem? pLeft2RightItem->GetValue() : sal_True; - m_aRB_TxtDirLeft2Right.Check( bLeft2Right ); - - } - - InternationalOptionsPage::InternationalOptionsPage( Window* _pParent, const SfxItemSet& _rAttrSet ) : - SfxTabPage ( _pParent, CUI_RES( RID_OFA_TP_INTERNATIONAL ), _rAttrSet ) - - ,m_pImpl ( new IMPL( this ) ) - { - FreeResource(); - } - - SfxTabPage* InternationalOptionsPage::CreateSd( Window* _pParent, const SfxItemSet& _rAttrSet ) - { - return new InternationalOptionsPage( _pParent, _rAttrSet ); - } - - SfxTabPage* InternationalOptionsPage::CreateSc( Window* _pParent, const SfxItemSet& _rAttrSet ) - { - InternationalOptionsPage* p = new InternationalOptionsPage( _pParent, _rAttrSet ); - return p; - } - - InternationalOptionsPage::~InternationalOptionsPage() - { - DELETEZ( m_pImpl ); - } - - sal_Bool InternationalOptionsPage::FillItemSet( SfxItemSet& _rSet ) - { - return m_pImpl->FillItemSet( _rSet ); - } - - void InternationalOptionsPage::Reset( const SfxItemSet& _rSet ) - { - m_pImpl->Reset( _rSet ); - } - -} // namespace offapp - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/internationaloptions.hrc b/cui/source/options/internationaloptions.hrc deleted file mode 100644 index 13d17f01b..000000000 --- a/cui/source/options/internationaloptions.hrc +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFAPP_INTERNATIONALOPTIONS_HRC_ -#define _OFFAPP_INTERNATIONALOPTIONS_HRC_ - -#include - -// general sizes -#define PAGE_SIZE_X 260 -#define PAGE_SIZE_Y 185 - -// x-positions -#define COL_0 RSC_SP_TBPG_INNERBORDER_LEFT -#define COL_1 (COL_0 + RSC_SP_FLGR_SPACE_X) -#define COL_2 (COL_1 + RSC_SP_CHK_TEXTINDENT) -#define COL_LAST (PAGE_SIZE_X - RSC_SP_TBPG_INNERBORDER_RIGHT) - -// heights -#define HEIGHT_FL RSC_CD_FIXEDLINE_HEIGHT -#define HEIGHT_RB RSC_CD_RADIOBUTTON_HEIGHT -#define HEIGHT_CB RSC_CD_CHECKBOX_HEIGHT - -// vertical spacing -#define SPACE_FL_NEXTCTRL_Y RSC_SP_CTRL_DESC_Y - -// y-positions -#define ROW_0 RSC_SP_TBPG_INNERBORDER_TOP -#define ROW_1 (ROW_0 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y) -#define ROW_2 (ROW_1 + HEIGHT_RB + RSC_SP_CTRL_GROUP_Y) -#define ROW_3 (ROW_2 + HEIGHT_RB + RSC_SP_FLGR_SPACE_Y) -#define ROW_4 (ROW_3 + HEIGHT_FL + SPACE_FL_NEXTCTRL_Y) -#define ROW_5 (ROW_4 + HEIGHT_CB + RSC_SP_CTRL_GROUP_Y) - -// misc calculation makros -#define WIDTH2END( startcol ) (COL_LAST - startcol) - - -// resource IDs -#define FL_DEFTXTDIRECTION 1 -#define RB_TXTDIR_LEFT2RIGHT 2 -#define RB_TXTDIR_RIGHT2LEFT 3 -#define FL_SHEETVIEW 4 -#define CB_SHTVW_RIGHT2LEFT 5 -#define CB_SHTVW_CURRENTDOCONLY 6 - -#endif - diff --git a/cui/source/options/internationaloptions.src b/cui/source/options/internationaloptions.src deleted file mode 100644 index 78d226781..000000000 --- a/cui/source/options/internationaloptions.src +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "internationaloptions.hrc" -#include "helpid.hrc" -#include -#include - -TabPage RID_OFA_TP_INTERNATIONAL -{ - HelpID = "cui:TabPage:RID_OFA_TP_INTERNATIONAL"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( PAGE_SIZE_X, PAGE_SIZE_Y ) ; - SVLook = TRUE ; - Hide = TRUE ; - - FixedLine FL_DEFTXTDIRECTION - { - Pos = MAP_APPFONT( COL_0, ROW_0 ); - Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL ); - Text [ en-US ] = "Default text direction"; - }; - - RadioButton RB_TXTDIR_LEFT2RIGHT - { - HelpID = "cui:RadioButton:RID_OFA_TP_INTERNATIONAL:RB_TXTDIR_LEFT2RIGHT"; - Pos = MAP_APPFONT( COL_1, ROW_1 ); - Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB ); - Group = TRUE; - Text [ en-US ] = "~Left-to-right"; - }; - - RadioButton RB_TXTDIR_RIGHT2LEFT - { - HelpID = "cui:RadioButton:RID_OFA_TP_INTERNATIONAL:RB_TXTDIR_RIGHT2LEFT"; - Pos = MAP_APPFONT( COL_1, ROW_2 ); - Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_RB ); - Text [ en-US ] = "~Right-to-left"; - }; - - FixedLine FL_SHEETVIEW - { - Pos = MAP_APPFONT( COL_0, ROW_3 ); - Size = MAP_APPFONT( WIDTH2END( COL_0 ), HEIGHT_FL ); - Text [ en-US ] = "Sheet view"; - }; - - CheckBox CB_SHTVW_RIGHT2LEFT - { - HelpID = "cui:CheckBox:RID_OFA_TP_INTERNATIONAL:CB_SHTVW_RIGHT2LEFT"; - Pos = MAP_APPFONT( COL_1, ROW_4 ); - Size = MAP_APPFONT( WIDTH2END( COL_1 ), HEIGHT_CB ); - Text [ en-US ] = "Right-~to-left"; - }; - - CheckBox CB_SHTVW_CURRENTDOCONLY - { - HelpID = "cui:CheckBox:RID_OFA_TP_INTERNATIONAL:CB_SHTVW_CURRENTDOCONLY"; - Pos = MAP_APPFONT( COL_2, ROW_5 ); - Size = MAP_APPFONT( WIDTH2END( COL_2 ), HEIGHT_CB ); - Text [ en-US ] = "~Current document only"; - }; -}; diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx deleted file mode 100644 index 64a7f49ca..000000000 --- a/cui/source/options/optHeaderTabListbox.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optHeaderTabListbox.hxx" -#include -#include - -namespace svx -{ -// class OptLBoxString_Impl ---------------------------------------------- - -class OptLBoxString_Impl : public SvLBoxString -{ -public: - OptLBoxString_Impl( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) : - SvLBoxString( pEntry, nFlags, rTxt ) {} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); -}; - -// ----------------------------------------------------------------------- - -void OptLBoxString_Impl::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry ) -{ - Font aOldFont( rDev.GetFont() ); - Font aFont( aOldFont ); - //detect readonly state by asking for a valid Image - if(pEntry && !(!((OptHeaderTabListBox&)rDev).GetCollapsedEntryBmp(pEntry))) - aFont.SetColor( Application::GetSettings().GetStyleSettings().GetDeactiveTextColor() ); - rDev.SetFont( aFont ); - rDev.DrawText( rPos, GetText() ); - rDev.SetFont( aOldFont ); -} -// ----------------------------------------------------------------------------- - -OptHeaderTabListBox::OptHeaderTabListBox( Window* pParent, WinBits nWinStyle ) : - - SvHeaderTabListBox( pParent, nWinStyle ) -{ -} - -// ----------------------------------------------------------------------- -void OptHeaderTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, - const Image& rImg1, const Image& rImg2, - SvLBoxButtonKind eButtonKind ) -{ - SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); - sal_uInt16 _nTabCount = TabCount(); - - for ( sal_uInt16 nCol = 1; nCol < _nTabCount; ++nCol ) - { - // alle Spalten mit eigener Klasse initialisieren (Spalte 0 == Bitmap) - SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol ); - OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, pCol->GetText() ); - pEntry->ReplaceItem( pStr, nCol ); - } -} - -} // namespace svx - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optHeaderTabListbox.hxx b/cui/source/options/optHeaderTabListbox.hxx deleted file mode 100644 index b09ebd4bf..000000000 --- a/cui/source/options/optHeaderTabListbox.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef SVX_OPTHEADERTABLISTBOX_HXX -#define SVX_OPTHEADERTABLISTBOX_HXX - -#include - -namespace svx -{ - // class OptHeaderTabListBox --------------------------------------------- - - class OptHeaderTabListBox : public SvHeaderTabListBox - { - public: - OptHeaderTabListBox( Window* pParent, WinBits nBits ); - - virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind ); - }; -} // svx -#endif // SVX_OPTHEADERTABLISTBOX_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx deleted file mode 100644 index 67938b111..000000000 --- a/cui/source/options/optaccessibility.cxx +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -static void MovePosY( Window& _rWin, long _nDelta ) -{ - Point aPoint = _rWin.GetPosPixel(); - aPoint.Y() += _nDelta; - - _rWin.SetPosPixel( aPoint ); -} - -struct SvxAccessibilityOptionsTabPage_Impl -{ - SvtAccessibilityOptions m_aConfig; - SvxAccessibilityOptionsTabPage_Impl() - : m_aConfig(){} -}; - -SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) - :SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ACCESSIBILITYCONFIG ), rSet) - ,m_aMiscellaneousLabel (this, CUI_RES(FL_MISCELLANEOUS )) - ,m_aAccessibilityTool (this, CUI_RES(CB_ACCESSIBILITY_TOOL )) - ,m_aTextSelectionInReadonly (this, CUI_RES(CB_TEXTSELECTION )) - ,m_aAnimatedGraphics (this, CUI_RES(CB_ANIMATED_GRAPHICS )) - ,m_aAnimatedTexts (this, CUI_RES(CB_ANIMATED_TEXTS )) - ,m_aTipHelpCB (this, CUI_RES(CB_TIPHELP )) - ,m_aTipHelpNF (this, CUI_RES(NF_TIPHELP )) - ,m_aTipHelpFT (this, CUI_RES(FT_TIPHELP )) - ,m_aHCOptionsLabel (this, CUI_RES(FL_HC_OPTIONS )) - ,m_aAutoDetectHC (this, CUI_RES(CB_AUTO_DETECT_HC )) - ,m_aAutomaticFontColor (this, CUI_RES(CB_AUTOMATIC_FONT_COLOR)) - ,m_aPagePreviews (this, CUI_RES(CB_PAGE_PREVIEWS )) - ,m_pImpl(new SvxAccessibilityOptionsTabPage_Impl) -{ - FreeResource(); - m_aTipHelpCB.SetClickHdl(LINK(this, SvxAccessibilityOptionsTabPage, TipHelpHdl)); - - long nHeightDelta = 0; // to correct positions _under_ m_aAccessibilityTool - -#ifdef UNX - { - // UNIX: read the gconf2 setting instead to use the checkbox - m_aAccessibilityTool.Hide(); - nHeightDelta = -( ROWA_2 - ROWA_1 ); - } -#else - // calculate the height of the checkbox. Do we need two (default in resource) or only one line - String aText = m_aAccessibilityTool.GetText(); - long nWidth = m_aAccessibilityTool.GetTextWidth( aText ); - long nCtrlWidth = m_aAccessibilityTool.GetSizePixel().Width() - ( COL2 - COL1 ); - if ( nWidth > nCtrlWidth ) - { - long nDelta = 2 * RSC_CD_FIXEDLINE_HEIGHT + LINESPACE - RSC_CD_CHECKBOX_HEIGHT; - nHeightDelta = nDelta; - Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nDelta ), MAP_APPFONT ); - nDelta = aSize.Height(); - aSize = m_aAccessibilityTool.GetSizePixel(); - aSize.Height() += nDelta; - m_aAccessibilityTool.SetSizePixel( aSize ); - } -#endif - - if( nHeightDelta ) - { //adjust positions of controls under m_aAccessibilityTool - Size aSize = m_aAccessibilityTool.LogicToPixel( Size( 0, nHeightDelta ), MAP_APPFONT ); - nHeightDelta = aSize.Height(); - - MovePosY( m_aTextSelectionInReadonly, nHeightDelta ); - MovePosY( m_aAnimatedGraphics, nHeightDelta ); - MovePosY( m_aAnimatedTexts, nHeightDelta ); - MovePosY( m_aTipHelpCB, nHeightDelta ); - MovePosY( m_aTipHelpNF, nHeightDelta ); - MovePosY( m_aTipHelpFT, nHeightDelta ); - MovePosY( m_aHCOptionsLabel, nHeightDelta ); - MovePosY( m_aAutoDetectHC, nHeightDelta ); - MovePosY( m_aAutomaticFontColor, nHeightDelta ); - MovePosY( m_aPagePreviews, nHeightDelta ); - } -} - -SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage() -{ - delete m_pImpl; -} - -SfxTabPage* SvxAccessibilityOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxAccessibilityOptionsTabPage(pParent, rAttrSet); -} - -sal_Bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet& ) -{ - //aConfig.Set... from controls - - m_pImpl->m_aConfig.SetIsForPagePreviews( m_aPagePreviews.IsChecked() ); - m_pImpl->m_aConfig.SetIsHelpTipsDisappear( m_aTipHelpCB.IsChecked() ); - m_pImpl->m_aConfig.SetHelpTipSeconds( (short)m_aTipHelpNF.GetValue() ); - m_pImpl->m_aConfig.SetIsAllowAnimatedGraphics( m_aAnimatedGraphics.IsChecked() ); - m_pImpl->m_aConfig.SetIsAllowAnimatedText( m_aAnimatedTexts.IsChecked() ); - m_pImpl->m_aConfig.SetIsAutomaticFontColor( m_aAutomaticFontColor.IsChecked() ); - m_pImpl->m_aConfig.SetSelectionInReadonly( m_aTextSelectionInReadonly.IsChecked()); - m_pImpl->m_aConfig.SetAutoDetectSystemHC( m_aAutoDetectHC.IsChecked()); - - if(m_pImpl->m_aConfig.IsModified()) - m_pImpl->m_aConfig.Commit(); - - AllSettings aAllSettings = Application::GetSettings(); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); -#ifndef UNX - aMiscSettings.SetEnableATToolSupport( m_aAccessibilityTool.IsChecked() ); -#endif - aAllSettings.SetMiscSettings(aMiscSettings); - Application::MergeSystemSettings( aAllSettings ); - Application::SetSettings(aAllSettings); - - return sal_False; -} - -void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet& ) -{ - //set controls from aConfig.Get... - - m_aPagePreviews.Check( m_pImpl->m_aConfig.GetIsForPagePreviews() ); - EnableTipHelp( m_pImpl->m_aConfig.GetIsHelpTipsDisappear() ); - m_aTipHelpNF.SetValue( m_pImpl->m_aConfig.GetHelpTipSeconds() ); - m_aAnimatedGraphics.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedGraphics() ); - m_aAnimatedTexts.Check( m_pImpl->m_aConfig.GetIsAllowAnimatedText() ); - m_aAutomaticFontColor.Check( m_pImpl->m_aConfig.GetIsAutomaticFontColor() ); - m_aTextSelectionInReadonly.Check( m_pImpl->m_aConfig.IsSelectionInReadonly() ); - m_aAutoDetectHC.Check( m_pImpl->m_aConfig.GetAutoDetectSystemHC() ); - - - AllSettings aAllSettings = Application::GetSettings(); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - m_aAccessibilityTool.Check( aMiscSettings.GetEnableATToolSupport() ); -} - -IMPL_LINK(SvxAccessibilityOptionsTabPage, TipHelpHdl, CheckBox*, pBox) -{ - sal_Bool bChecked = pBox->IsChecked(); - m_aTipHelpNF.Enable(bChecked); - return 0; -} - -void SvxAccessibilityOptionsTabPage::EnableTipHelp(sal_Bool bCheck) -{ - m_aTipHelpCB.Check(bCheck); - m_aTipHelpNF.Enable(bCheck); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaccessibility.hrc b/cui/source/options/optaccessibility.hrc deleted file mode 100644 index d60a528a5..000000000 --- a/cui/source/options/optaccessibility.hrc +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTACCESSIBILITY_HRC -#define _SVX_OPTACCESSIBILITY_HRC - -#include - -// defines for positions and sizes - -#define GB_WIDTH 248 -#define CB_WIDTH 240 -#define EDIT_WIDTH 25 - -#define COL0 6 -#define COL1 (COL0+6) -#define COL2 (COL1+10) -#define COL3 (COL1+(CB_WIDTH * 2/3)) -#define COL4 (COL3+EDIT_WIDTH+RSC_SP_CTRL_DESC_X) - -#define UNIT_WIDTH (COL1+CB_WIDTH-COL4) - -#define ROWSPACE RSC_SP_CTRL_DESC_Y -#define LINESPACE 1 -#define GROUPSPACE RSC_SP_CTRL_DESC_Y + 2 -#define ROWA_0 3 -#define ROWA_1 ( ROWA_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE ) -#define ROWA_2 ( ROWA_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) -#define ROWA_3 ( ROWA_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) -#define ROWA_4 ( ROWA_3 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) -#define ROWA_5 ( ROWA_4 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) - -#define ROWB_0 ( ROWA_5 + RSC_CD_TEXTBOX_HEIGHT + ROWSPACE + GROUPSPACE ) -#define ROWB_1 ( ROWB_0 + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE ) -#define ROWB_2 ( ROWB_1 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) -#define ROWB_3 ( ROWB_2 + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE ) - -#define WHOLE_HEIGHT 185 -#define LASTTEXT_HEIGHT (WHOLE_HEIGHT-ROWB_8) -#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) -#define DIFF(v1,v2) (v2-v1) -#define SUM(v1,v2) (v2+v1) - -#define FL_MISCELLANEOUS 1 -#define CB_PAGE_PREVIEWS 2 -#define FL_HC_OPTIONS 3 -#define CB_TIPHELP 4 -#define NF_TIPHELP 5 -#define FT_TIPHELP 6 -#define CB_ANIMATED_GRAPHICS 7 -#define CB_ANIMATED_TEXTS 8 -#define CB_AUTOMATIC_FONT_COLOR 9 -#define CB_SYSTEM_FONT 10 -#define CB_ACCESSIBILITY_TOOL 11 -#define CB_TEXTSELECTION 12 -#define CB_AUTO_DETECT_HC 13 - -#endif - diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx deleted file mode 100644 index 70379201a..000000000 --- a/cui/source/options/optaccessibility.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTACCESSIBILITY_HXX -#define _SVX_OPTACCESSIBILITY_HXX - -#include -#include -#include -struct SvxAccessibilityOptionsTabPage_Impl; -class SvxAccessibilityOptionsTabPage : public SfxTabPage -{ - FixedLine m_aMiscellaneousLabel; // FL_MISCELLANEOUS - CheckBox m_aAccessibilityTool; // CB_ACCESSIBILITY_TOOL - CheckBox m_aTextSelectionInReadonly; // CB_TEXTSELECTION - CheckBox m_aAnimatedGraphics; // CB_ANIMATED_GRAPHICS - CheckBox m_aAnimatedTexts; // CB_ANIMATED_TEXTS - CheckBox m_aTipHelpCB; // CB_TIPHELP - NumericField m_aTipHelpNF; // NF_TIPHELP - FixedText m_aTipHelpFT; // FT_TIPHELP - FixedLine m_aHCOptionsLabel; // FL_HC_OPTIONS - CheckBox m_aAutoDetectHC; // CB_AUTO_DETECT_HC - CheckBox m_aAutomaticFontColor; // CB_AUTOMATIC_FONT_COLOR - CheckBox m_aPagePreviews; // CB_PAGEPREVIEWS - - DECL_LINK(TipHelpHdl, CheckBox*); - void EnableTipHelp(sal_Bool bCheck); - - SvxAccessibilityOptionsTabPage_Impl* m_pImpl; - - SvxAccessibilityOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); -public: - - virtual ~SvxAccessibilityOptionsTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optaccessibility.src b/cui/source/options/optaccessibility.src deleted file mode 100644 index bc5fc6b37..000000000 --- a/cui/source/options/optaccessibility.src +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optaccessibility.hrc" -#include -#include "helpid.hrc" -#include - -TabPage RID_SVXPAGE_ACCESSIBILITYCONFIG -{ - HelpId = HID_OPTIONS_ACCESSIBILITYCONFIG ; - Size = MAP_APPFONT ( 260 , WHOLE_HEIGHT ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedLine FL_MISCELLANEOUS - { - Pos = MAP_APPFONT ( COL0, ROWA_0 ) ; - Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Miscellaneous options"; - }; - CheckBox CB_ACCESSIBILITY_TOOL - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_ACCESSIBILITY_TOOL"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWA_1 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - WordBreak = TRUE; - Text [ en-US ] = "Support ~assistive technology tools (program restart required)"; - }; - CheckBox CB_TEXTSELECTION - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_TEXTSELECTION"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWA_2 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Use te~xt selection cursor in read-only text documents"; - }; - CheckBox CB_ANIMATED_GRAPHICS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_ANIMATED_GRAPHICS"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWA_3 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Allow animated ~graphics"; - }; - CheckBox CB_ANIMATED_TEXTS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_ANIMATED_TEXTS"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWA_4 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Allow animated ~text"; - }; - CheckBox CB_TIPHELP - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_TIPHELP"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) ); - Size = MAP_APPFONT( DIFF(COL2,COL3), RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Help tips disappear after "; - }; - NumericField NF_TIPHELP - { - HelpID = "cui:NumericField:RID_SVXPAGE_ACCESSIBILITYCONFIG:NF_TIPHELP"; - TabStop = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROWA_5 ); - Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT ); - Minimum = 1; - Maximum = 99; - First = 1 ; - Last = 99 ; - Spin = TRUE ; - Repeat = TRUE ; - }; - FixedText FT_TIPHELP - { - Pos = MAP_APPFONT( COL4, OFFS_TEXTBOX_FIXEDTEXT( ROWA_5 ) ); - Size = MAP_APPFONT( UNIT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "seconds"; - }; - FixedLine FL_HC_OPTIONS - { - Pos = MAP_APPFONT ( COL0, ROWB_0 ) ; - Size = MAP_APPFONT ( GB_WIDTH , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Options for high contrast appearance"; - }; - CheckBox CB_AUTO_DETECT_HC - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_AUTO_DETECT_HC"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWB_1 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Automatically ~detect high contrast mode of operating system"; - }; - CheckBox CB_AUTOMATIC_FONT_COLOR - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_AUTOMATIC_FONT_COLOR"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWB_2 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Use automatic font ~color for screen display"; - }; - CheckBox CB_PAGE_PREVIEWS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ACCESSIBILITYCONFIG:CB_PAGE_PREVIEWS"; - TabStop = TRUE ; - Pos = MAP_APPFONT( COL1, ROWB_3 ); - Size = MAP_APPFONT( CB_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Use system colors for page previews"; - }; -}; diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx deleted file mode 100644 index 5a338aa11..000000000 --- a/cui/source/options/optasian.cxx +++ /dev/null @@ -1,439 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::i18n; -using namespace com::sun::star::frame; -using namespace com::sun::star::beans; -using rtl::OUString; - -#define C2U(cChar) rtl::OUString::createFromAscii(cChar) - -const sal_Char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation"; -const sal_Char cCharacterCompressionType[] = "CharacterCompressionType"; - -struct SvxForbiddenChars_Impl -{ - sal_Bool bRemoved; - ForbiddenCharacters* pCharacters; -}; - -DECLARE_TABLE( _SvxForbiddenCharacterTable_Impl, SvxForbiddenChars_Impl* ) - -class SvxForbiddenCharacterTable_Impl : public _SvxForbiddenCharacterTable_Impl -{ -public: - SvxForbiddenCharacterTable_Impl() - : _SvxForbiddenCharacterTable_Impl( 4, 4 ) - {} - ~SvxForbiddenCharacterTable_Impl(); -}; - -struct SvxAsianLayoutPage_Impl -{ - SvxAsianConfig aConfig; - SvxAsianLayoutPage_Impl() : - aConfig(sal_False){} - - Reference< XForbiddenCharacters > xForbidden; - Reference< XPropertySet > xPrSet; - Reference< XPropertySetInfo > xPrSetInfo; - SvxForbiddenCharacterTable_Impl aChangedLanguagesTbl; - - sal_Bool hasForbiddenCharacters(LanguageType eLang); - SvxForbiddenChars_Impl* getForbiddenCharacters(LanguageType eLang); - void addForbiddenCharacters(LanguageType eLang, ForbiddenCharacters* pForbidden); -}; - -SvxForbiddenCharacterTable_Impl::~SvxForbiddenCharacterTable_Impl() -{ - for( SvxForbiddenChars_Impl* pDel = First(); pDel; pDel = Next() ) - { - delete pDel->pCharacters; - delete pDel; - } -} - -sal_Bool SvxAsianLayoutPage_Impl::hasForbiddenCharacters(LanguageType eLang) -{ - return 0 != aChangedLanguagesTbl.Get(eLang); -} - -SvxForbiddenChars_Impl* SvxAsianLayoutPage_Impl::getForbiddenCharacters(LanguageType eLang) -{ - SvxForbiddenChars_Impl* pImp = aChangedLanguagesTbl.Get(eLang); - DBG_ASSERT(pImp, "language not available"); - if(pImp) - return pImp; - return 0; -} - -void SvxAsianLayoutPage_Impl::addForbiddenCharacters( - LanguageType eLang, ForbiddenCharacters* pForbidden) -{ - SvxForbiddenChars_Impl* pOld = aChangedLanguagesTbl.Get(eLang); - if( !pOld ) - { - pOld = new SvxForbiddenChars_Impl; - pOld->bRemoved = 0 == pForbidden; - pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0; - aChangedLanguagesTbl.Insert( eLang, pOld ); - } - else - { - pOld->bRemoved = 0 == pForbidden; - delete pOld->pCharacters; - pOld->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : 0; - } - -} - -static LanguageType eLastUsedLanguageTypeForForbiddenCharacters = USHRT_MAX; - -SvxAsianLayoutPage::SvxAsianLayoutPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ASIAN_LAYOUT ), rSet), - aKerningGB( this, CUI_RES(GB_KERNING )), - aCharKerningRB( this, CUI_RES(RB_CHAR_KERNING )), - aCharPunctKerningRB( this, CUI_RES(RB_CHAR_PUNCT )), - aCharDistGB( this, CUI_RES(GB_CHAR_DIST )), - aNoCompressionRB( this, CUI_RES(RB_NO_COMP )), - aPunctCompressionRB( this, CUI_RES(RB_PUNCT_COMP )), - aPunctKanaCompressionRB(this, CUI_RES(RB_PUNCT_KANA_COMP )), - aStartEndGB( this, CUI_RES(GB_START_END )), - aLanguageFT( this, CUI_RES(FT_LANGUAGE )), - aLanguageLB( this, CUI_RES(LB_LANGUAGE )), - aStandardCB( this, CUI_RES(CB_STANDARD )), - aStartFT( this, CUI_RES(FT_START )), - aStartED( this, CUI_RES(ED_START )), - aEndFT( this, CUI_RES(FT_END )), - aEndED( this, CUI_RES(ED_END )), - aHintFT( this, CUI_RES(FT_HINT )), - pImpl(new SvxAsianLayoutPage_Impl) -{ - FreeResource(); - LanguageHdl(&aLanguageLB); - aLanguageLB.SetSelectHdl(LINK(this, SvxAsianLayoutPage, LanguageHdl)); - aStandardCB.SetClickHdl(LINK(this, SvxAsianLayoutPage, ChangeStandardHdl)); - Link aLk(LINK(this, SvxAsianLayoutPage, ModifyHdl)); - aStartED.SetModifyHdl(aLk); - aEndED.SetModifyHdl(aLk); - - aLanguageLB.SetLanguageList( LANG_LIST_FBD_CHARS, sal_False, sal_False ); -} - -SvxAsianLayoutPage::~SvxAsianLayoutPage() -{ - delete pImpl; -} - -SfxTabPage* SvxAsianLayoutPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxAsianLayoutPage(pParent, rAttrSet); -} - -sal_Bool SvxAsianLayoutPage::FillItemSet( SfxItemSet& ) -{ - if(aCharKerningRB.IsChecked() != aCharKerningRB.GetSavedValue()) - { - pImpl->aConfig.SetKerningWesternTextOnly(aCharKerningRB.IsChecked()); - OUString sPunct(C2U(cIsKernAsianPunctuation)); - if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sPunct)) - { - Any aVal; - sal_Bool bVal = !aCharKerningRB.IsChecked(); - aVal.setValue(&bVal, ::getBooleanCppuType()); - pImpl->xPrSet->setPropertyValue(sPunct, aVal); - } - } - - if(aNoCompressionRB.IsChecked() != aNoCompressionRB.GetSavedValue() || - aPunctCompressionRB.IsChecked() != aPunctCompressionRB.GetSavedValue()) - { - sal_Int16 nSet = aNoCompressionRB.IsChecked() ? 0 : - aPunctCompressionRB.IsChecked() ? 1 : 2; - pImpl->aConfig.SetCharDistanceCompression(nSet); - OUString sCompress(C2U(cCharacterCompressionType)); - if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress)) - { - Any aVal; - aVal <<= nSet; - pImpl->xPrSet->setPropertyValue(sCompress, aVal); - } - } - if(pImpl->aConfig.IsModified()) - pImpl->aConfig.Commit(); - if(pImpl->xForbidden.is()) - { - try - { - for( SvxForbiddenChars_Impl* pElem = pImpl->aChangedLanguagesTbl.First(); - pElem; pElem = pImpl->aChangedLanguagesTbl.Next() ) - { - sal_uLong nLang = pImpl->aChangedLanguagesTbl.GetKey( pElem ); - Locale aLocale; - SvxLanguageToLocale(aLocale, (sal_uInt16)nLang ); - if(pElem->bRemoved) - pImpl->xForbidden->removeForbiddenCharacters( aLocale ); - else if(pElem->pCharacters) - pImpl->xForbidden->setForbiddenCharacters( aLocale, *pElem->pCharacters ); - } - } - catch(Exception&) - { - OSL_FAIL("exception in XForbiddenCharacters"); - } - } - eLastUsedLanguageTypeForForbiddenCharacters = aLanguageLB.GetSelectLanguage(); - - return sal_False; -} - -void SvxAsianLayoutPage::Reset( const SfxItemSet& ) -{ - SfxViewFrame* pCurFrm = SfxViewFrame::Current(); - SfxObjectShell* pDocSh = pCurFrm ? pCurFrm->GetObjectShell() : 0; - Reference< XModel > xModel; - if(pDocSh) - xModel = pDocSh->GetModel(); - Reference xFact(xModel, UNO_QUERY); - if(xFact.is()) - { - pImpl->xPrSet = Reference( - xFact->createInstance(C2U("com.sun.star.document.Settings")), UNO_QUERY); - } - if( pImpl->xPrSet.is() ) - pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo(); - OUString sForbidden(C2U("ForbiddenCharacters")); - sal_Bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly(); - sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression(); - if(pImpl->xPrSetInfo.is()) - { - if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden)) - { - Any aForbidden = pImpl->xPrSet->getPropertyValue(sForbidden); - aForbidden >>= pImpl->xForbidden; - } - OUString sCompress(C2U(cCharacterCompressionType)); - if(pImpl->xPrSetInfo->hasPropertyByName(sCompress)) - { - Any aVal = pImpl->xPrSet->getPropertyValue(sCompress); - aVal >>= nCompress; - } - OUString sPunct(C2U(cIsKernAsianPunctuation)); - if(pImpl->xPrSetInfo->hasPropertyByName(sPunct)) - { - Any aVal = pImpl->xPrSet->getPropertyValue(sPunct); - bKernWesternText = !*(sal_Bool*)aVal.getValue(); - } - } - else - { - aStartEndGB.Enable(sal_False); - aLanguageFT.Enable(sal_False); - aLanguageLB.Enable(sal_False); - aStandardCB.Enable(sal_False); - aStartFT.Enable(sal_False); - aStartED.Enable(sal_False); - aEndFT.Enable(sal_False); - aEndED.Enable(sal_False); - aHintFT.Enable(sal_False); - } - if(bKernWesternText) - aCharKerningRB.Check(sal_True); - else - aCharPunctKerningRB.Check(sal_True); - switch(nCompress) - { - case 0 : aNoCompressionRB.Check(); break; - case 1 : aPunctCompressionRB.Check(); break; - default: aPunctKanaCompressionRB.Check(); - } - aCharKerningRB.SaveValue(); - aNoCompressionRB.SaveValue(); - aPunctCompressionRB.SaveValue(); - aPunctKanaCompressionRB.SaveValue(); - - aLanguageLB.SelectEntryPos(0); - //preselect the system language in the box - if available - if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters) - { - eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage( - Application::GetSettings().GetLocale() ); - switch(eLastUsedLanguageTypeForForbiddenCharacters) - { - case LANGUAGE_CHINESE : - case LANGUAGE_CHINESE_SINGAPORE : - eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED; - break; - case LANGUAGE_CHINESE_HONGKONG : - case LANGUAGE_CHINESE_MACAU : - eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_TRADITIONAL; - break; - } - } - aLanguageLB.SelectLanguage( eLastUsedLanguageTypeForForbiddenCharacters ); - LanguageHdl(&aLanguageLB); -} - -IMPL_LINK(SvxAsianLayoutPage, LanguageHdl, SvxLanguageBox*, EMPTYARG ) -{ - //set current value - Locale aLocale; - LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage(); - SvxLanguageToLocale(aLocale, eSelectLanguage ); - - OUString sStart, sEnd; - sal_Bool bAvail; - if(pImpl->xForbidden.is()) - { - bAvail = pImpl->hasForbiddenCharacters(eSelectLanguage); - if(bAvail) - { - SvxForbiddenChars_Impl* pElement = pImpl->getForbiddenCharacters(eSelectLanguage); - if(pElement->bRemoved || !pElement->pCharacters) - { - bAvail = sal_False; - } - else - { - sStart = pElement->pCharacters->beginLine; - sEnd = pElement->pCharacters->endLine; - } - } - else - { - try - { - bAvail = pImpl->xForbidden->hasForbiddenCharacters(aLocale); - if(bAvail) - { - ForbiddenCharacters aForbidden = pImpl->xForbidden->getForbiddenCharacters( aLocale ); - sStart = aForbidden.beginLine; - sEnd = aForbidden.endLine; - } - } - catch(Exception&) - { - OSL_FAIL("exception in XForbiddenCharacters"); - } - } - } - else - { - bAvail = pImpl->aConfig.GetStartEndChars( aLocale, sStart, sEnd ); - } - if(!bAvail) - { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - LocaleDataWrapper aWrap( xMSF, aLocale ); - ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters(); - sStart = aForbidden.beginLine; - sEnd = aForbidden.endLine; - } - aStandardCB.Check(!bAvail); - aStartED.Enable(bAvail); - aEndED.Enable(bAvail); - aStartFT.Enable(bAvail); - aEndFT.Enable(bAvail); - aStartED.SetText(sStart); - aEndED.SetText(sEnd); - - return 0; -} - -IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, CheckBox*, pBox) -{ - sal_Bool bCheck = pBox->IsChecked(); - aStartED.Enable(!bCheck); - aEndED.Enable(!bCheck); - aStartFT.Enable(!bCheck); - aEndFT.Enable(!bCheck); - - ModifyHdl(&aStartED); - return 0; -} - -IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit*, pEdit) -{ - Locale aLocale; - LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage(); - SvxLanguageToLocale(aLocale, eSelectLanguage ); - OUString sStart = aStartED.GetText(); - OUString sEnd = aEndED.GetText(); - sal_Bool bEnable = pEdit->IsEnabled(); - if(pImpl->xForbidden.is()) - { - try - { - if(bEnable) - { - ForbiddenCharacters aSet; - aSet.beginLine = sStart; - aSet.endLine = sEnd; - pImpl->addForbiddenCharacters(eSelectLanguage, &aSet); - } - else - pImpl->addForbiddenCharacters(eSelectLanguage, 0); - } - catch(Exception&) - { - OSL_FAIL("exception in XForbiddenCharacters"); - } - } - pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : 0, bEnable ? &sEnd : 0); - return 0; -} - -sal_uInt16* SvxAsianLayoutPage::GetRanges() -{ - //no items are used - static sal_uInt16 pAsianLayoutRanges[] = { 0 }; - return pAsianLayoutRanges; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optasian.hrc b/cui/source/options/optasian.hrc deleted file mode 100644 index 089b8a616..000000000 --- a/cui/source/options/optasian.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTASIAN_HRC -#define _SVX_OPTASIAN_HRC - -#define GB_KERNING 1 -#define RB_CHAR_KERNING 2 -#define RB_CHAR_PUNCT 3 -#define GB_CHAR_DIST 4 -#define RB_NO_COMP 5 -#define RB_PUNCT_COMP 6 -#define RB_PUNCT_KANA_COMP 7 -#define GB_START_END 8 -#define CB_STANDARD 9 - -#define FT_LANGUAGE 11 -#define LB_LANGUAGE 12 -#define FT_START 13 -#define ED_START 14 -#define FT_END 15 -#define ED_END 16 -#define FT_HINT 17 - -#endif - diff --git a/cui/source/options/optasian.src b/cui/source/options/optasian.src deleted file mode 100644 index 5308a3e92..000000000 --- a/cui/source/options/optasian.src +++ /dev/null @@ -1,147 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optasian.hrc" -#include -#include "helpid.hrc" -#include - -TabPage RID_SVXPAGE_ASIAN_LAYOUT -{ - HelpId = HID_OPTIONS_ASIAN_LAYOUT ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedLine GB_KERNING - { - Pos = MAP_APPFONT ( 6, 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Kerning"; - }; - RadioButton RB_CHAR_KERNING - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ASIAN_LAYOUT:RB_CHAR_KERNING"; - Pos = MAP_APPFONT ( 12, 14 ) ; - Size = MAP_APPFONT ( 200 , 10 ) ; - Text [ en-US ] = "~Western characters only"; - }; - RadioButton RB_CHAR_PUNCT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ASIAN_LAYOUT:RB_CHAR_PUNCT"; - Pos = MAP_APPFONT ( 12, 27 ) ; - Size = MAP_APPFONT ( 200 , 10 ) ; - Text [ en-US ] = "Western ~text and Asian punctuation"; - }; - FixedLine GB_CHAR_DIST - { - Pos = MAP_APPFONT ( 6, 43 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Character spacing"; - }; - RadioButton RB_NO_COMP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ASIAN_LAYOUT:RB_NO_COMP"; - Pos = MAP_APPFONT ( 12, 54 ) ; - Size = MAP_APPFONT ( 200 , 10 ) ; - Text [ en-US ] = "~No compression"; - }; - RadioButton RB_PUNCT_COMP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ASIAN_LAYOUT:RB_PUNCT_COMP"; - Pos = MAP_APPFONT ( 12, 67) ; - Size = MAP_APPFONT ( 200 , 10 ) ; - Text [ en-US ] = "~Compress punctuation only"; - }; - RadioButton RB_PUNCT_KANA_COMP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ASIAN_LAYOUT:RB_PUNCT_KANA_COMP"; - Pos = MAP_APPFONT ( 12, 80 ) ; - Size = MAP_APPFONT ( 200 , 10 ) ; - Text [ en-US ] = "Compress ~punctuation and Japanese Kana"; - }; - FixedLine GB_START_END - { - Pos = MAP_APPFONT ( 6, 96 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "First and last characters"; - }; - FixedText FT_LANGUAGE - { - Pos = MAP_APPFONT ( 12 , 109 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "~Language"; - }; - ListBox LB_LANGUAGE - { - HelpID = "cui:ListBox:RID_SVXPAGE_ASIAN_LAYOUT:LB_LANGUAGE"; - Pos = MAP_APPFONT ( 95 , 107 ) ; - Size = MAP_APPFONT ( 80 , 48 ) ; - Border = TRUE ; - DropDown = TRUE ; - }; - CheckBox CB_STANDARD - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ASIAN_LAYOUT:CB_STANDARD"; - Pos = MAP_APPFONT ( 180, 109 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "~Default"; - }; - FixedText FT_START - { - Pos = MAP_APPFONT ( 12 , 125 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Not at start of line:"; - }; - Edit ED_START - { - HelpID = "cui:Edit:RID_SVXPAGE_ASIAN_LAYOUT:ED_START"; - Pos = MAP_APPFONT ( 95 , 123 ) ; - Size = MAP_APPFONT ( 159 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_END - { - Pos = MAP_APPFONT ( 12 , 141 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Not at end of line:"; - }; - Edit ED_END - { - HelpID = "cui:Edit:RID_SVXPAGE_ASIAN_LAYOUT:ED_END"; - Pos = MAP_APPFONT ( 95 , 139 ) ; - Size = MAP_APPFONT ( 159 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_HINT - { - Pos = MAP_APPFONT ( 12 , 155 ) ; - Size = MAP_APPFONT ( 242 , 8 ) ; - Text [ en-US ] = "Without user-defined line break symbols"; - }; - Text [ en-US ] = "Proxy"; -}; diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx deleted file mode 100644 index 6293a8fe8..000000000 --- a/cui/source/options/optchart.cxx +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "optchart.hxx" -#include "optchart.hrc" -#include -#include -#include // for SID_SCH_EDITOPTIONS - -// ==================== -// class ChartColorLB -// ==================== -void ChartColorLB::FillBox( const SvxChartColorTable & rTab ) -{ - long nCount = rTab.size(); - SetUpdateMode( sal_False ); - - for( long i = 0; i < nCount; i++ ) - { - Append( const_cast< XColorEntry * >( & rTab[ i ] )); - } - SetUpdateMode( sal_True ); -} - - -// ==================== -// class SvxDefaultColorOptPage -// ==================== -SvxDefaultColorOptPage::SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs ) : - - SfxTabPage( pParent, CUI_RES( RID_OPTPAGE_CHART_DEFCOLORS ), rInAttrs ), - - aGbChartColors ( this, CUI_RES( FL_CHART_COLOR_LIST ) ), - aLbChartColors ( this, CUI_RES( LB_CHART_COLOR_LIST ) ), - aGbColorBox ( this, CUI_RES( FL_COLOR_BOX ) ), - aValSetColorBox ( this, CUI_RES( CT_COLOR_BOX ) ), - aPBDefault ( this, CUI_RES( PB_RESET_TO_DEFAULT ) ), - aPBAdd ( this, CUI_RES( PB_ADD_CHART_COLOR ) ), - aPBRemove ( this, CUI_RES( PB_REMOVE_CHART_COLOR ) ) -{ - FreeResource(); - - aPBDefault.SetClickHdl( LINK( this, SvxDefaultColorOptPage, ResetToDefaults ) ); - aPBAdd.SetClickHdl( LINK( this, SvxDefaultColorOptPage, AddChartColor ) ); - aPBRemove.SetClickHdl( LINK( this, SvxDefaultColorOptPage, RemoveChartColor ) ); - aLbChartColors.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, ListClickedHdl ) ); - aValSetColorBox.SetSelectHdl( LINK( this, SvxDefaultColorOptPage, BoxClickedHdl ) ); - - aValSetColorBox.SetStyle( aValSetColorBox.GetStyle() - | WB_ITEMBORDER | WB_NAMEFIELD ); - aValSetColorBox.SetColCount( 8 ); - aValSetColorBox.SetLineCount( 13 ); - aValSetColorBox.SetExtraSpacing( 0 ); - aValSetColorBox.Show(); - - pChartOptions = new SvxChartOptions; - pColorTab = new XColorTable( SvtPathOptions().GetPalettePath() ); - - const SfxPoolItem* pItem = NULL; - if ( rInAttrs.GetItemState( SID_SCH_EDITOPTIONS, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pColorConfig = SAL_STATIC_CAST( SvxChartColorTableItem*, pItem->Clone() ); - } - else - { - SvxChartColorTable aTable; - aTable.useDefault(); - pColorConfig = new SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aTable ); - pColorConfig->SetOptions( pChartOptions ); - } - - Construct(); -} - -SvxDefaultColorOptPage::~SvxDefaultColorOptPage() -{ - // save changes - pChartOptions->SetDefaultColors( pColorConfig->GetColorTable() ); - pChartOptions->Commit(); - - delete pColorConfig; - delete pColorTab; - delete pChartOptions; -} - -void SvxDefaultColorOptPage::Construct() -{ - if( pColorConfig ) - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); - - FillColorBox(); - - aLbChartColors.SelectEntryPos( 0 ); - ListClickedHdl( &aLbChartColors ); -} - - -SfxTabPage* SvxDefaultColorOptPage::Create( Window* pParent, const SfxItemSet& rAttrs ) -{ - return new SvxDefaultColorOptPage( pParent, rAttrs ); -} - -sal_Bool SvxDefaultColorOptPage::FillItemSet( SfxItemSet& rOutAttrs ) -{ - if( pColorConfig ) - rOutAttrs.Put( *SAL_STATIC_CAST( SfxPoolItem*, pColorConfig )); - - return sal_True; -} - -void SvxDefaultColorOptPage::Reset( const SfxItemSet& ) -{ - aLbChartColors.SelectEntryPos( 0 ); - ListClickedHdl( &aLbChartColors ); -} - -void SvxDefaultColorOptPage::FillColorBox() -{ - if( !pColorTab ) return; - - long nCount = pColorTab->Count(); - XColorEntry* pColorEntry; - - if( nCount > 104 ) - aValSetColorBox.SetStyle( aValSetColorBox.GetStyle() | WB_VSCROLL ); - - for( long i = 0; i < nCount; i++ ) - { - pColorEntry = pColorTab->GetColor( i ); - aValSetColorBox.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); - } -} - - -long SvxDefaultColorOptPage::GetColorIndex( const Color& rCol ) -{ - if( pColorTab ) - { - long nCount = pColorTab->Count(); - XColorEntry* pColorEntry; - - for( long i = nCount - 1; i >= 0; i-- ) // default chart colors are at the end of the table - { - pColorEntry = pColorTab->GetColor( i ); - if( pColorEntry && pColorEntry->GetColor() == rCol ) - return SAL_STATIC_CAST( XPropertyTable*, pColorTab )->Get( pColorEntry->GetName() ); - } - } - return -1L; -} - - - -// -------------------- -// event handlers -// -------------------- - -// ResetToDefaults -// --------------- - -IMPL_LINK( SvxDefaultColorOptPage, ResetToDefaults, void *, EMPTYARG ) -{ - if( pColorConfig ) - { - pColorConfig->GetColorTable().useDefault(); - - aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); - - aLbChartColors.GetFocus(); - aLbChartColors.SelectEntryPos( 0 ); - aPBRemove.Enable( sal_True ); - } - - return 0L; -} - -// AddChartColor -// ------------ - -IMPL_LINK( SvxDefaultColorOptPage, AddChartColor, void *, EMPTYARG ) -{ - if( pColorConfig ) - { - ColorData black = RGB_COLORDATA( 0x00, 0x00, 0x00 ); - - pColorConfig->GetColorTable().append (XColorEntry ( black, pColorConfig->GetColorTable().getDefaultName(pColorConfig->GetColorTable().size()))); - - aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); - - aLbChartColors.GetFocus(); - aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 ); - aPBRemove.Enable( sal_True ); - } - - return 0L; -} - -// RemoveChartColor -// ---------------- - -IMPL_LINK( SvxDefaultColorOptPage, RemoveChartColor, PushButton*, pButton ) -{ - size_t nIndex = aLbChartColors.GetSelectEntryPos(); - - if (aLbChartColors.GetSelectEntryCount() == 0) - return 0L; - - if( pColorConfig ) - { - OSL_ENSURE(pColorConfig->GetColorTable().size() > 1, "don't delete the last chart color"); - QueryBox aQuery(pButton, CUI_RES(RID_OPTQB_COLOR_CHART_DELETE)); - aQuery.SetText(String(CUI_RES(RID_OPTSTR_COLOR_CHART_DELETE))); - if(RET_YES == aQuery.Execute()) - { - - pColorConfig->GetColorTable().remove( nIndex ); - - aLbChartColors.Clear(); - aLbChartColors.FillBox( pColorConfig->GetColorTable() ); - - aLbChartColors.GetFocus(); - - if (nIndex == aLbChartColors.GetEntryCount() && aLbChartColors.GetEntryCount() > 0) - aLbChartColors.SelectEntryPos( pColorConfig->GetColorTable().size() - 1 ); - else if (aLbChartColors.GetEntryCount() > 0) - aLbChartColors.SelectEntryPos( nIndex ); - else - aPBRemove.Enable( sal_False ); - } - } - - return 0L; -} - -// ListClickedHdl -// -------------- - -IMPL_LINK( SvxDefaultColorOptPage, ListClickedHdl, ChartColorLB*, pColorList ) -{ - Color aCol = pColorList->GetSelectEntryColor(); - - long nIndex = GetColorIndex( aCol ); - - if( nIndex == -1 ) // not found - { - aValSetColorBox.SetNoSelection(); - } - else - { - aValSetColorBox.SelectItem( (sal_uInt16)nIndex + 1 ); // ValueSet is 1-based - } - - return 0L; -} - -// BoxClickedHdl -// ------------- - -IMPL_LINK( SvxDefaultColorOptPage, BoxClickedHdl, ValueSet*, EMPTYARG ) -{ - sal_uInt16 nIdx = aLbChartColors.GetSelectEntryPos(); - if( nIdx != LISTBOX_ENTRY_NOTFOUND ) - { - XColorEntry aEntry( aValSetColorBox.GetItemColor( aValSetColorBox.GetSelectItemId() ), - aLbChartColors.GetSelectEntry() ); - - aLbChartColors.Modify( & aEntry, nIdx ); - pColorConfig->ReplaceColorByIndex( nIdx, aEntry ); - - aLbChartColors.SelectEntryPos( nIdx ); // reselect entry - } - - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optchart.hrc b/cui/source/options/optchart.hrc deleted file mode 100644 index dcf86df41..000000000 --- a/cui/source/options/optchart.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// tab page for setting the default colors used for new charts - -#define FL_CHART_COLOR_LIST 1 -#define LB_CHART_COLOR_LIST 2 - -#define FL_COLOR_BOX 3 -#define CT_COLOR_BOX 4 - -#define PB_RESET_TO_DEFAULT 5 -#define PB_ADD_CHART_COLOR 6 -#define PB_REMOVE_CHART_COLOR 7 diff --git a/cui/source/options/optchart.hxx b/cui/source/options/optchart.hxx deleted file mode 100644 index 141600890..000000000 --- a/cui/source/options/optchart.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_OPTCHART_HXX -#define _SVX_OPTCHART_HXX - -// header for SfxTabPage -#include -#include -// header for ValueSet -#include -// header for ColorLB -#include -// header for PushButton -#include -// header for XColorTable -#include - -#include "cfgchart.hxx" - -class ChartColorLB : public ColorLB -{ -public: - ChartColorLB( Window* pParent, ResId Id ) : ColorLB( pParent, Id ) {} - ChartColorLB( Window* pParent, WinBits aWB ) : ColorLB( pParent, aWB ) {} - - void FillBox( const SvxChartColorTable & rTab ); -}; - - -class SvxDefaultColorOptPage : public SfxTabPage -{ - -private: - FixedLine aGbChartColors; - ChartColorLB aLbChartColors; - FixedLine aGbColorBox; - ValueSet aValSetColorBox; - PushButton aPBDefault; - PushButton aPBAdd; - PushButton aPBRemove; - - SvxChartOptions* pChartOptions; - SvxChartColorTableItem* pColorConfig; - XColorTable* pColorTab; - - DECL_LINK( ResetToDefaults, void * ); - DECL_LINK( AddChartColor, void * ); - DECL_LINK( RemoveChartColor, PushButton * ); - DECL_LINK( ListClickedHdl, ChartColorLB * ); - DECL_LINK( BoxClickedHdl, ValueSet * ); - - void FillColorBox(); - long GetColorIndex( const Color& rCol ); - -public: - SvxDefaultColorOptPage( Window* pParent, const SfxItemSet& rInAttrs ); - virtual ~SvxDefaultColorOptPage(); - - void Construct(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); - virtual void Reset( const SfxItemSet& rInAttrs ); -}; - -#endif // _SVX_OPTCHART_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optchart.src b/cui/source/options/optchart.src deleted file mode 100644 index 09800aa36..000000000 --- a/cui/source/options/optchart.src +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optchart.hrc" -#include -#include "helpid.hrc" - -// tab page for setting the default colors used for new charts - -TabPage RID_OPTPAGE_CHART_DEFCOLORS -{ - HelpID = HID_OPTIONS_CHART_DEFCOLORS; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - Text [ en-US ] = "Default Colors"; - FixedLine FL_CHART_COLOR_LIST - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Chart colors"; - Text [ x-comment ] = " "; - }; - ListBox LB_CHART_COLOR_LIST - { - HelpID = "cui:ListBox:RID_OPTPAGE_CHART_DEFCOLORS:LB_CHART_COLOR_LIST"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 15 ); - Size = MAP_APPFONT ( 68 , 152 ); - DropDown = FALSE; - TabStop = TRUE ; - }; - FixedLine FL_COLOR_BOX - { - Pos = MAP_APPFONT ( 92 , 3 ) ; - Size = MAP_APPFONT ( 106 , 8 ) ; - Text [ en-US ] = "Color table" ; - Text [ x-comment ] = " "; - }; - Control CT_COLOR_BOX - { - Border = TRUE; - Pos = MAP_APPFONT ( 98 , 15 ); - Size = MAP_APPFONT ( 94 , 152 ); - TabStop = TRUE ; - }; - PushButton PB_ADD_CHART_COLOR - { - Pos = MAP_APPFONT ( 204 , 15 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add"; - Text [ x-comment ] = " "; - }; - PushButton PB_REMOVE_CHART_COLOR - { - Pos = MAP_APPFONT ( 204 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Remove"; - Text [ x-comment ] = " "; - }; - PushButton PB_RESET_TO_DEFAULT - { - HelpID = "cui:PushButton:RID_OPTPAGE_CHART_DEFCOLORS:PB_RESET_TO_DEFAULT"; - Pos = MAP_APPFONT ( 204 , 165 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Default"; - Text [ x-comment ] = " "; - }; -}; - -String RID_SVXSTR_DIAGRAM_ROW -{ - // $(ROW) can be a number or the caption of the row in quotes - - Text [ en-US ] = "Data Series $(ROW)" ; -}; -QueryBox RID_OPTQB_COLOR_CHART_DELETE -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Do you really want to delete the chart color?" ; -}; -String RID_OPTSTR_COLOR_CHART_DELETE -{ - Text [ en-US ] = "Chart Color Deletion" ; -}; diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx deleted file mode 100644 index b41c11530..000000000 --- a/cui/source/options/optcolor.cxx +++ /dev/null @@ -1,1677 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "optcolor.hxx" -#include -#include "optcolor.hrc" -#include - -using namespace ::com::sun::star; -using namespace ::svtools; - -#define GROUP_COUNT 7 -#define GROUP_UNKNOWN -1 -#define GROUP_GENERAL 0 -#define GROUP_WRITER 1 -#define GROUP_HTML 2 -#define GROUP_CALC 3 -#define GROUP_DRAW 4 -#define GROUP_BASIC 5 -#define GROUP_SQL 6 - -const char* aColorLBHids[] = -{ - HID_COLORPAGE_DOCCOLOR_LB, - HID_COLORPAGE_DOCBOUNDARIES_LB, - HID_COLORPAGE_APPBACKGROUND_LB, - HID_COLORPAGE_OBJECTBOUNDARIES_LB, - HID_COLORPAGE_TABLEBOUNDARIES_LB, - HID_COLORPAGE_FONTCOLOR_LB, - HID_COLORPAGE_LINKS_LB, - HID_COLORPAGE_LINKSVISITED_LB, - HID_COLORPAGE_ANCHOR_LB, - HID_COLORPAGE_SPELL_LB, - HID_COLORPAGE_WRITERTEXTGRID_LB, - HID_COLORPAGE_WRITERFIELDSHADINGS_LB, - HID_COLORPAGE_WRITERIDXSHADINGS_LB, - HID_COLORPAGE_WRITERDIRECTCURSOR_LB, - HID_COLORPAGE_WRITERNOTESINDICATOR_LB, - HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB, - HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB, - HID_COLORPAGE_WRITERPAGEBREAKS_LB, - HID_COLORPAGE_HTMLSGML_LB, - HID_COLORPAGE_HTMLCOMMENT_LB, - HID_COLORPAGE_HTMLKEYWORD_LB, - HID_COLORPAGE_HTMLUNKNOWN_LB, - HID_COLORPAGE_CALCGRID_LB, - HID_COLORPAGE_CALCPAGEBREAK_LB, - HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB, - HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB, - HID_COLORPAGE_CALCDETECTIVE_LB, - HID_COLORPAGE_CALCDETECTIVEERROR_LB, - HID_COLORPAGE_CALCREFERENCE_LB, - HID_COLORPAGE_CALCNOTESBACKGROUND_LB, - HID_COLORPAGE_DRAWGRID_LB, - HID_COLORPAGE_DRAWDRAWING_LB, - HID_COLORPAGE_DRAWFILL_LB, - HID_COLORPAGE_BASICIDENTIFIER_LB, - HID_COLORPAGE_BASICCOMMENT_LB, - HID_COLORPAGE_BASICNUMBER_LB, - HID_COLORPAGE_BASICSTRING_LB, - HID_COLORPAGE_BASICOPERATOR_LB, - HID_COLORPAGE_BASICKEYWORD_LB, - HID_COLORPAGE_BASICERROR_LB -}; - -const char* aColorCBHids[] = -{ - HID_COLORPAGE_DOCCOLOR_CB, - HID_COLORPAGE_DOCBOUNDARIES_CB, - HID_COLORPAGE_APPBACKGROUND_CB, - HID_COLORPAGE_OBJECTBOUNDARIES_CB, - HID_COLORPAGE_TABLEBOUNDARIES_CB, - HID_COLORPAGE_FONTCOLOR_CB, - HID_COLORPAGE_LINKS_CB, - HID_COLORPAGE_LINKSVISITED_CB, - HID_COLORPAGE_ANCHOR_CB, - HID_COLORPAGE_SPELL_CB, - HID_COLORPAGE_WRITERTEXTGRID_CB, - HID_COLORPAGE_WRITERFIELDSHADINGS_CB, - HID_COLORPAGE_WRITERIDXSHADINGS_CB, - HID_COLORPAGE_WRITERDIRECTCURSOR_CB, - HID_COLORPAGE_WRITERNOTESINDICATOR_CB, - HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB, - HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB, - HID_COLORPAGE_WRITERPAGEBREAKS_CB, - HID_COLORPAGE_HTMLSGML_CB, - HID_COLORPAGE_HTMLCOMMENT_CB, - HID_COLORPAGE_HTMLKEYWORD_CB, - HID_COLORPAGE_HTMLUNKNOWN_CB, - HID_COLORPAGE_CALCGRID_CB, - HID_COLORPAGE_CALCPAGEBREAK_CB, - HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB, - HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB, - HID_COLORPAGE_CALCDETECTIVE_CB, - HID_COLORPAGE_CALCDETECTIVEERROR_CB, - HID_COLORPAGE_CALCREFERENCE_CB, - HID_COLORPAGE_CALCNOTESBACKGROUND_CB, - HID_COLORPAGE_DRAWGRID_CB, - HID_COLORPAGE_DRAWDRAWING_CB, - HID_COLORPAGE_DRAWFILL_CB, - HID_COLORPAGE_BASICIDENTIFIER_CB, - HID_COLORPAGE_BASICCOMMENT_CB, - HID_COLORPAGE_BASICNUMBER_CB, - HID_COLORPAGE_BASICSTRING_CB, - HID_COLORPAGE_BASICOPERATOR_CB, - HID_COLORPAGE_BASICKEYWORD_CB, - HID_COLORPAGE_BASICERROR_CB -}; - -class SvxExtFixedText_Impl : public FixedText -{ -private: - long m_nGroupHeight; - -protected: - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -public: - SvxExtFixedText_Impl(Window* pParent, const ResId& rResId) : - FixedText(pParent, rResId), m_nGroupHeight(0) {} - - inline long GetGroupHeight() { return m_nGroupHeight; } - inline void SetGroupHeight( long _nHeight ) { m_nGroupHeight = _nHeight; } -}; - -class ColorConfigCtrl_Impl; -class ColorConfigWindow_Impl : public Window -{ - friend class ColorConfigCtrl_Impl; - Window aGeneralBackWN; - SvxExtFixedText_Impl aGeneralFT; - FixedText aDocColorFT; - ColorListBox aDocColorLB; - Window aDocColorWN; - CheckBox aDocBoundCB; - ColorListBox aDocBoundLB; - Window aDocBoundWN; - FixedText aAppBackFT; - ColorListBox aAppBackLB; - Window aAppBackWN; - CheckBox aObjBoundCB; - ColorListBox aObjBoundLB; - Window aObjBoundWN; - CheckBox aTableBoundCB; - ColorListBox aTableBoundLB; - Window aTableBoundWN; - FixedText aFontColorFT; - ColorListBox aFontColorLB; - Window aFontColorWN; - CheckBox aLinksCB; - ColorListBox aLinksLB; - Window aLinksWN; - CheckBox aLinksVisitedCB; - ColorListBox aLinksVisitedLB; - Window aLinksVisitedWN; - FixedText aSpellFT; - ColorListBox aSpellLB; - Window aSpellWN; - FixedText aSmarttagsFT; - ColorListBox aSmarttagsLB; - Window aSmarttagsWN; - CheckBox aShadowColorCB; - ColorListBox aShadowColorLB; - Window aShadowColorWN; - Window aWriterBackWN; - SvxExtFixedText_Impl aWriterFT; - FixedText aWrtTextGridFT; - ColorListBox aWrtTextGridLB; - Window aWrtTextGridWN; - CheckBox aWrtFieldCB; - ColorListBox aWrtFieldLB; - Window aWrtFieldWN; - CheckBox aWrtIdxShadingBackCB; - ColorListBox aWrtIdxShadingBackLB; - Window aWrtIdxShadingBackWN; - FixedText aWrtScriptIndicatorFT; - ColorListBox aWrtScriptIndicatorLB; - Window aWrtScriptIndicatorWN; - CheckBox aWrtSectionBoundCB; - ColorListBox aWrtSectionBoundLB; - Window aWrtSectionBoundWN; - FixedText aWrtPageBreaksFT; - ColorListBox aWrtPageBreaksLB; - Window aWrtPageBreaksWN; - FixedText aWrtDirectCrsrFT; - ColorListBox aWrtDirectCrsrLB; - Window aWrtDirectCrsrWN; - Window aHTMLBackWN; - SvxExtFixedText_Impl aHTMLFT; - FixedText aHTMLSGMLFT; - ColorListBox aHTMLSGMLLB; - Window aHTMLSGMLWN; - FixedText aHTMLCommentFT; - ColorListBox aHTMLCommentLB; - Window aHTMLCommentWN; - FixedText aHTMLKeywdFT; - ColorListBox aHTMLKeywdLB; - Window aHTMLKeywdWN; - FixedText aHTMLUnknownFT; - ColorListBox aHTMLUnknownLB; - Window aHTMLUnknownWN; - Window aCalcBackWN; - SvxExtFixedText_Impl aCalcFT; - FixedText aCalcGridFT; - ColorListBox aCalcGridLB; - Window aCalcGridWN; - FixedText aCalcPageBreakFT; - ColorListBox aCalcPageBreakLB; - Window aCalcPageBreakWN; - FixedText aCalcPageBreakManualFT; - ColorListBox aCalcPageBreakManualLB; - Window aCalcPageBreakManualWN; - FixedText aCalcPageBreakAutoFT; - ColorListBox aCalcPageBreakAutoLB; - Window aCalcPageBreakAutoWN; - FixedText aCalcDetectiveFT; - ColorListBox aCalcDetectiveLB; - Window aCalcDetectiveWN; - FixedText aCalcDetectiveErrorFT; - ColorListBox aCalcDetectiveErrorLB; - Window aCalcDetectiveErrorWN; - FixedText aCalcReferenceFT; - ColorListBox aCalcReferenceLB; - Window aCalcReferenceWN; - FixedText aCalcNotesBackFT; - ColorListBox aCalcNotesBackLB; - Window aCalcNotesBackWN; - Window aDrawBackWN; - SvxExtFixedText_Impl aDrawFT; - FixedText aDrawGridFT; - ColorListBox aDrawGridLB; - Window aDrawGridWN; - Window aBasicBackWN; - SvxExtFixedText_Impl aBasicFT; - FixedText aBasicIdentifierFT; - ColorListBox aBasicIdentifierLB; - Window aBasicIdentifierWN; - FixedText aBasicCommentFT; - ColorListBox aBasicCommentLB; - Window aBasicCommentWN; - FixedText aBasicNumberFT; - ColorListBox aBasicNumberLB; - Window aBasicNumberWN; - FixedText aBasicStringFT; - ColorListBox aBasicStringLB; - Window aBasicStringWN; - FixedText aBasicOperatorFT; - ColorListBox aBasicOperatorLB; - Window aBasicOperatorWN; - FixedText aBasicKeywordFT; - ColorListBox aBasicKeywordLB; - Window aBasicKeywordWN; - FixedText aBasicErrorFT; - ColorListBox aBasicErrorLB; - Window aBasicErrorWN; - Window aSQLBackWN; - SvxExtFixedText_Impl aSQLFT; - FixedText aSQLIdentifierFT; - ColorListBox aSQLIdentifierLB; - Window aSQLIdentifierWN; - FixedText aSQLNumberFT; - ColorListBox aSQLNumberLB; - Window aSQLNumberWN; - FixedText aSQLStringFT; - ColorListBox aSQLStringLB; - Window aSQLStringWN; - FixedText aSQLOperatorFT; - ColorListBox aSQLOperatorLB; - Window aSQLOperatorWN; - FixedText aSQLKeywordFT; - ColorListBox aSQLKeywordLB; - Window aSQLKeywordWN; - FixedText aSQLParameterFT; - ColorListBox aSQLParameterLB; - Window aSQLParameterWN; - FixedText aSQLCommentFT; - ColorListBox aSQLCommentLB; - Window aSQLCommentWN; - - ::std::vector< SvxExtFixedText_Impl*> aChapters; - ::std::vector< Window* > aChapterWins; - ::std::vector< FixedText* > aFixedTexts; - ::std::vector< CheckBox* > aCheckBoxes; - ::std::vector< ColorListBox* > aColorBoxes; - ::std::vector< Window* > aWindows; // [ColorConfigEntryCount] - ::std::vector< ::boost::shared_ptr > m_aExtensionTitles; - - SvtModuleOptions m_aModuleOptions; - - void SetNewPosition( sal_Int32 _nFeature, Window* _pWin ); - - virtual void Command( const CommandEvent& rCEvt ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - - // calculate position behind last chapter - sal_Int32 impl_getPosBehindLastChapter() const; - -public: - ColorConfigWindow_Impl(Window* pParent, const ResId& rResId); - ~ColorConfigWindow_Impl(); - - inline const SvtModuleOptions& GetModuleOptions() const { return m_aModuleOptions; } -}; - -sal_Bool lcl_isGroupVisible( sal_Int32 _nGroup, const SvtModuleOptions& _rModOptions ) -{ - sal_Bool bRet = sal_True; - - switch ( _nGroup ) - { - case GROUP_WRITER : - case GROUP_HTML : - { - bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SWRITER ); - break; - } - - case GROUP_CALC : - { - bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SCALC ); - break; - } - - case GROUP_DRAW : - { - bRet = ( _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) || - _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ); - break; - } - case GROUP_SQL : - { - bRet = _rModOptions.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ); - break; - } - } - - return bRet; -} - -sal_Int16 lcl_getGroup( sal_Int32 _nFeature ) -{ - if ( _nFeature >= ColorConfigEntryCount ) - return GROUP_COUNT; // feature of an extension - - sal_Int16 nRet = GROUP_UNKNOWN; - - switch ( _nFeature ) - { - case DOCCOLOR : - case DOCBOUNDARIES : - case APPBACKGROUND : - case OBJECTBOUNDARIES : - case TABLEBOUNDARIES : - case FONTCOLOR : - case LINKS : - case LINKSVISITED : - case ANCHOR : - case SPELL : - case SMARTTAGS : - case SHADOWCOLOR : - { - nRet = GROUP_GENERAL; - break; - } - - case WRITERTEXTGRID : - case WRITERFIELDSHADINGS : - case WRITERIDXSHADINGS : - case WRITERDIRECTCURSOR : - case WRITERSCRIPTINDICATOR : - case WRITERSECTIONBOUNDARIES : - case WRITERPAGEBREAKS : - { - nRet = GROUP_WRITER; - break; - } - - case HTMLSGML : - case HTMLCOMMENT : - case HTMLKEYWORD : - case HTMLUNKNOWN : - { - nRet = GROUP_HTML; - break; - } - - case CALCGRID : - case CALCPAGEBREAK : - case CALCPAGEBREAKMANUAL : - case CALCPAGEBREAKAUTOMATIC : - case CALCDETECTIVE : - case CALCDETECTIVEERROR : - case CALCREFERENCE : - case CALCNOTESBACKGROUND : - { - nRet = GROUP_CALC; - break; - } - - case DRAWGRID : - case DRAWDRAWING : - case DRAWFILL : - { - nRet = GROUP_DRAW; - break; - } - - case BASICIDENTIFIER : - case BASICCOMMENT : - case BASICNUMBER : - case BASICSTRING : - case BASICOPERATOR : - case BASICKEYWORD : - case BASICERROR : - { - nRet = GROUP_BASIC; - break; - } - case SQLIDENTIFIER : - case SQLNUMBER: - case SQLSTRING: - case SQLOPERATOR: - case SQLKEYWORD: - case SQLPARAMETER: - case SQLCOMMENT: - { - nRet = GROUP_SQL; - break; - } - } - return nRet; -} - -ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rResId) : - Window(pParent, rResId), - aGeneralBackWN(this), - aGeneralFT(&aGeneralBackWN, ResId( FT_GENERAL, *rResId.GetResMgr() )), - aDocColorFT(this, ResId( FT_DOCCOLOR, *rResId.GetResMgr())), - aDocColorLB(this, ResId( LB_DOCCOLOR, *rResId.GetResMgr())), - aDocColorWN(this, ResId( WN_DOCCOLOR, *rResId.GetResMgr())), - aDocBoundCB(this, ResId( CB_DOCBOUND, *rResId.GetResMgr())), - aDocBoundLB(this, ResId( LB_DOCBOUND, *rResId.GetResMgr())), - aDocBoundWN(this, ResId( WN_DOCBOUND, *rResId.GetResMgr())), - aAppBackFT(this, ResId( FT_APPBACKGROUND, *rResId.GetResMgr())), - aAppBackLB(this, ResId( LB_APPBACKGROUND, *rResId.GetResMgr())), - aAppBackWN(this, ResId( WN_APPBACKGROUND, *rResId.GetResMgr())), - aObjBoundCB(this, ResId( CB_OBJECTBOUNDARIES, *rResId.GetResMgr())), - aObjBoundLB(this, ResId( LB_OBJECTBOUNDARIES, *rResId.GetResMgr())), - aObjBoundWN(this, ResId( WN_OBJECTBOUNDARIES, *rResId.GetResMgr())), - aTableBoundCB(this, ResId( CB_TABLEBOUNDARIES, *rResId.GetResMgr())), - aTableBoundLB(this, ResId( LB_TABLEBOUNDARIES, *rResId.GetResMgr())), - aTableBoundWN(this, ResId( WN_TABLEBOUNDARIES, *rResId.GetResMgr())), - aFontColorFT(this, ResId( FT_FONTCOLOR, *rResId.GetResMgr())), - aFontColorLB(this, ResId( LB_FONTCOLOR, *rResId.GetResMgr())), - aFontColorWN(this, ResId( WN_FONTCOLOR, *rResId.GetResMgr())), - aLinksCB(this, ResId( CB_LINKS, *rResId.GetResMgr())), - aLinksLB(this, ResId( LB_LINKS, *rResId.GetResMgr())), - aLinksWN(this, ResId( WN_LINKS, *rResId.GetResMgr())), - aLinksVisitedCB(this, ResId( CB_LINKSVISITED, *rResId.GetResMgr())), - aLinksVisitedLB(this, ResId( LB_LINKSVISITED, *rResId.GetResMgr())), - aLinksVisitedWN(this, ResId( WN_LINKSVISITED, *rResId.GetResMgr())), - aSpellFT(this, ResId( FT_SPELL, *rResId.GetResMgr())), - aSpellLB(this, ResId( LB_SPELL, *rResId.GetResMgr())), - aSpellWN(this, ResId( WN_SPELL, *rResId.GetResMgr())), - aSmarttagsFT(this, ResId( FT_SMARTTAGS, *rResId.GetResMgr() )), - aSmarttagsLB(this, ResId( LB_SMARTTAGS, *rResId.GetResMgr() )), - aSmarttagsWN(this, ResId( WN_SMARTTAGS, *rResId.GetResMgr() )), - aShadowColorCB(this, ResId( CB_SHADOWCOLOR, *rResId.GetResMgr())), - aShadowColorLB(this, ResId( LB_SHADOWCOLOR, *rResId.GetResMgr())), - aShadowColorWN(this, ResId( WN_SHADOWCOLOR, *rResId.GetResMgr())), - aWriterBackWN(this), - aWriterFT(this, ResId(FT_WRITER, *rResId.GetResMgr())), - aWrtTextGridFT(this, ResId( FT_WRITERTEXTGRID, *rResId.GetResMgr())), - aWrtTextGridLB(this, ResId( LB_WRITERTEXTGRID, *rResId.GetResMgr())), - aWrtTextGridWN(this, ResId( WN_WRITERTEXTGRID, *rResId.GetResMgr())), - aWrtFieldCB(this, ResId( CB_WRITERFIELDSHADINGS, *rResId.GetResMgr())), - aWrtFieldLB(this, ResId( LB_WRITERFIELDSHADINGS, *rResId.GetResMgr())), - aWrtFieldWN(this, ResId( WN_WRITERFIELDSHADINGS, *rResId.GetResMgr())), - aWrtIdxShadingBackCB(this, ResId( CB_WRITERIDXSHADINGS, *rResId.GetResMgr())), - aWrtIdxShadingBackLB(this, ResId( LB_WRITERIDXSHADINGS, *rResId.GetResMgr())), - aWrtIdxShadingBackWN(this, ResId( WN_WRITERIDXSHADINGS, *rResId.GetResMgr())), - aWrtScriptIndicatorFT(this, ResId( FT_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())), - aWrtScriptIndicatorLB(this, ResId( LB_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())), - aWrtScriptIndicatorWN(this, ResId( WN_WRITERSCRIPTINDICATOR, *rResId.GetResMgr())), - aWrtSectionBoundCB(this, ResId( CB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())), - aWrtSectionBoundLB(this, ResId( LB_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())), - aWrtSectionBoundWN(this, ResId( WN_WRITERSECTIONBOUNDARIES, *rResId.GetResMgr())), - aWrtPageBreaksFT(this, ResId( FT_WRITERPAGEBREAKS, *rResId.GetResMgr())), - aWrtPageBreaksLB(this, ResId( LB_WRITERPAGEBREAKS, *rResId.GetResMgr())), - aWrtPageBreaksWN(this, ResId( WN_WRITERPAGEBREAKS, *rResId.GetResMgr())), - aWrtDirectCrsrFT(this, ResId( FT_WRITERDIRECTCURSOR, *rResId.GetResMgr())), - aWrtDirectCrsrLB(this, ResId( LB_WRITERDIRECTCURSOR, *rResId.GetResMgr())), - aWrtDirectCrsrWN(this, ResId( WN_WRITERDIRECTCURSOR, *rResId.GetResMgr())), - aHTMLBackWN(this), - aHTMLFT(this, ResId( FT_HTML, *rResId.GetResMgr())), - aHTMLSGMLFT(this, ResId( FT_HTMLSGML, *rResId.GetResMgr())), - aHTMLSGMLLB(this, ResId( LB_HTMLSGML, *rResId.GetResMgr())), - aHTMLSGMLWN(this, ResId( WN_HTMLSGML, *rResId.GetResMgr())), - aHTMLCommentFT(this, ResId( FT_HTMLCOMMENT, *rResId.GetResMgr())), - aHTMLCommentLB(this, ResId( LB_HTMLCOMMENT, *rResId.GetResMgr())), - aHTMLCommentWN(this, ResId( WN_HTMLCOMMENT, *rResId.GetResMgr())), - aHTMLKeywdFT(this, ResId( FT_HTMLKEYWORD, *rResId.GetResMgr())), - aHTMLKeywdLB(this, ResId( LB_HTMLKEYWORD, *rResId.GetResMgr())), - aHTMLKeywdWN(this, ResId( WN_HTMLKEYWORD, *rResId.GetResMgr())), - aHTMLUnknownFT(this, ResId( FT_HTMLUNKNOWN, *rResId.GetResMgr())), - aHTMLUnknownLB(this, ResId( LB_HTMLUNKNOWN, *rResId.GetResMgr())), - aHTMLUnknownWN(this, ResId( WN_HTMLUNKNOWN, *rResId.GetResMgr())), - aCalcBackWN(this), - aCalcFT(this, ResId( FT_CALC, *rResId.GetResMgr())), - aCalcGridFT(this, ResId( FT_CALCGRID, *rResId.GetResMgr())), - aCalcGridLB(this, ResId( LB_CALCGRID, *rResId.GetResMgr())), - aCalcGridWN(this, ResId( WN_CALCGRID, *rResId.GetResMgr())), - aCalcPageBreakFT(this, ResId( FT_CALCPAGEBREAK, *rResId.GetResMgr())), - aCalcPageBreakLB(this, ResId( LB_CALCPAGEBREAK, *rResId.GetResMgr())), - aCalcPageBreakWN(this, ResId( WN_CALCPAGEBREAK, *rResId.GetResMgr())), - aCalcPageBreakManualFT(this, ResId( FT_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())), - aCalcPageBreakManualLB(this, ResId( LB_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())), - aCalcPageBreakManualWN(this, ResId( WN_CALCPAGEBREAKMANUAL, *rResId.GetResMgr())), - aCalcPageBreakAutoFT(this, ResId( FT_CALCPAGEBREAKAUTO, *rResId.GetResMgr())), - aCalcPageBreakAutoLB(this, ResId( LB_CALCPAGEBREAKAUTO, *rResId.GetResMgr())), - aCalcPageBreakAutoWN(this, ResId( WN_CALCPAGEBREAKAUTO, *rResId.GetResMgr())), - aCalcDetectiveFT(this, ResId( FT_CALCDETECTIVE, *rResId.GetResMgr())), - aCalcDetectiveLB(this, ResId( LB_CALCDETECTIVE, *rResId.GetResMgr())), - aCalcDetectiveWN(this, ResId( WN_CALCDETECTIVE, *rResId.GetResMgr())), - aCalcDetectiveErrorFT(this, ResId( FT_CALCDETECTIVEERROR, *rResId.GetResMgr())), - aCalcDetectiveErrorLB(this, ResId( LB_CALCDETECTIVEERROR, *rResId.GetResMgr())), - aCalcDetectiveErrorWN(this, ResId( WN_CALCDETECTIVEERROR, *rResId.GetResMgr())), - aCalcReferenceFT(this, ResId( FT_CALCREFERENCE, *rResId.GetResMgr())), - aCalcReferenceLB(this, ResId( LB_CALCREFERENCE, *rResId.GetResMgr())), - aCalcReferenceWN(this, ResId( WN_CALCREFERENCE, *rResId.GetResMgr())), - aCalcNotesBackFT(this, ResId( FT_CALCNOTESBACKGROUND, *rResId.GetResMgr())), - aCalcNotesBackLB(this, ResId( LB_CALCNOTESBACKGROUND, *rResId.GetResMgr())), - aCalcNotesBackWN(this, ResId( WN_CALCNOTESBACKGROUND, *rResId.GetResMgr())), - aDrawBackWN(this), - aDrawFT(this, ResId( FT_DRAW, *rResId.GetResMgr())), - aDrawGridFT(this, ResId( FT_DRAWGRID, *rResId.GetResMgr())), - aDrawGridLB(this, ResId( LB_DRAWGRID, *rResId.GetResMgr())), - aDrawGridWN(this, ResId( WN_DRAWGRID, *rResId.GetResMgr())), - aBasicBackWN(this), - aBasicFT(this, ResId( FT_BASIC, *rResId.GetResMgr())), - aBasicIdentifierFT(this, ResId( FT_BASICIDENTIFIER, *rResId.GetResMgr())), - aBasicIdentifierLB(this, ResId( LB_BASICIDENTIFIER, *rResId.GetResMgr())), - aBasicIdentifierWN(this, ResId( WN_BASICIDENTIFIER, *rResId.GetResMgr())), - aBasicCommentFT(this, ResId( FT_BASICCOMMENT, *rResId.GetResMgr())), - aBasicCommentLB(this, ResId( LB_BASICCOMMENT, *rResId.GetResMgr())), - aBasicCommentWN(this, ResId( WN_BASICCOMMENT, *rResId.GetResMgr())), - aBasicNumberFT(this, ResId( FT_BASICNUMBER, *rResId.GetResMgr())), - aBasicNumberLB(this, ResId( LB_BASICNUMBER, *rResId.GetResMgr())), - aBasicNumberWN(this, ResId( WN_BASICNUMBER, *rResId.GetResMgr())), - aBasicStringFT(this, ResId( FT_BASICSTRING, *rResId.GetResMgr())), - aBasicStringLB(this, ResId( LB_BASICSTRING, *rResId.GetResMgr())), - aBasicStringWN(this, ResId( WN_BASICSTRING, *rResId.GetResMgr())), - aBasicOperatorFT(this, ResId( FT_BASICOPERATOR, *rResId.GetResMgr())), - aBasicOperatorLB(this, ResId( LB_BASICOPERATOR, *rResId.GetResMgr())), - aBasicOperatorWN(this, ResId( WN_BASICOPERATOR, *rResId.GetResMgr())), - aBasicKeywordFT(this, ResId( FT_BASICKEYWORD, *rResId.GetResMgr())), - aBasicKeywordLB(this, ResId( LB_BASICKEYWORD, *rResId.GetResMgr())), - aBasicKeywordWN(this, ResId( WN_BASICKEYWORD, *rResId.GetResMgr())), - aBasicErrorFT(this, ResId( FT_BASICERROR, *rResId.GetResMgr())), - aBasicErrorLB(this, ResId( LB_BASICERROR, *rResId.GetResMgr())), - aBasicErrorWN(this, ResId( WN_BASICERROR, *rResId.GetResMgr())), - - aSQLBackWN(this), - aSQLFT(this, ResId( FT_SQL_COMMAND, *rResId.GetResMgr())), - aSQLIdentifierFT(this, ResId( FT_SQLIDENTIFIER, *rResId.GetResMgr())), - aSQLIdentifierLB(this, ResId( LB_SQLIDENTIFIER, *rResId.GetResMgr())), - aSQLIdentifierWN(this, ResId( WN_SQLIDENTIFIER, *rResId.GetResMgr())), - - aSQLNumberFT(this, ResId( FT_SQLNUMBER, *rResId.GetResMgr())), - aSQLNumberLB(this, ResId( LB_SQLNUMBER, *rResId.GetResMgr())), - aSQLNumberWN(this, ResId( WN_SQLNUMBER, *rResId.GetResMgr())), - - aSQLStringFT(this, ResId( FT_SQLSTRING, *rResId.GetResMgr())), - aSQLStringLB(this, ResId( LB_SQLSTRING, *rResId.GetResMgr())), - aSQLStringWN(this, ResId( WN_SQLSTRING, *rResId.GetResMgr())), - - aSQLOperatorFT(this, ResId( FT_SQLOPERATOR, *rResId.GetResMgr())), - aSQLOperatorLB(this, ResId( LB_SQLOPERATOR, *rResId.GetResMgr())), - aSQLOperatorWN(this, ResId( WN_SQLOPERATOR, *rResId.GetResMgr())), - - aSQLKeywordFT(this, ResId( FT_SQLKEYWORD, *rResId.GetResMgr())), - aSQLKeywordLB(this, ResId( LB_SQLKEYWORD, *rResId.GetResMgr())), - aSQLKeywordWN(this, ResId( WN_SQLKEYWORD, *rResId.GetResMgr())), - - aSQLParameterFT(this, ResId( FT_SQLPARAMETER, *rResId.GetResMgr())), - aSQLParameterLB(this, ResId( LB_SQLPARAMETER, *rResId.GetResMgr())), - aSQLParameterWN(this, ResId( WN_SQLPARAMETER, *rResId.GetResMgr())), - - aSQLCommentFT(this, ResId( FT_SQLCOMMENT, *rResId.GetResMgr())), - aSQLCommentLB(this, ResId( LB_SQLCOMMENT, *rResId.GetResMgr())), - aSQLCommentWN(this, ResId( WN_SQLCOMMENT, *rResId.GetResMgr())) -{ - aFixedTexts.resize(ColorConfigEntryCount); - aCheckBoxes.resize(ColorConfigEntryCount); - aColorBoxes.resize(ColorConfigEntryCount); - aWindows.resize(ColorConfigEntryCount); - - aFixedTexts[DOCCOLOR ] = &aDocColorFT; - aCheckBoxes[DOCBOUNDARIES ] = &aDocBoundCB ; - aFixedTexts[APPBACKGROUND ] = &aAppBackFT; - aCheckBoxes[OBJECTBOUNDARIES ] = &aObjBoundCB ; - aCheckBoxes[TABLEBOUNDARIES ] = &aTableBoundCB ; - aFixedTexts[FONTCOLOR ] = &aFontColorFT ; - aCheckBoxes[LINKS ] = &aLinksCB ; - aCheckBoxes[LINKSVISITED ] = &aLinksVisitedCB ; - aFixedTexts[SPELL ]=& aSpellFT; - aFixedTexts[SMARTTAGS ]=& aSmarttagsFT; - aCheckBoxes[SHADOWCOLOR ]=& aShadowColorCB; - aFixedTexts[WRITERTEXTGRID ]=& aWrtTextGridFT; - aCheckBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldCB ; - aCheckBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackCB ; - aFixedTexts[WRITERDIRECTCURSOR ]=& aWrtDirectCrsrFT; - aFixedTexts[WRITERSCRIPTINDICATOR ]=& aWrtScriptIndicatorFT; - aCheckBoxes[WRITERSECTIONBOUNDARIES ]=& aWrtSectionBoundCB; - aFixedTexts[HTMLSGML ]=& aHTMLSGMLFT; - aFixedTexts[HTMLCOMMENT ]=& aHTMLCommentFT; - aFixedTexts[HTMLKEYWORD ]=& aHTMLKeywdFT; - aFixedTexts[HTMLUNKNOWN ]=& aHTMLUnknownFT; - aFixedTexts[CALCGRID ] = &aCalcGridFT ; - aFixedTexts[CALCPAGEBREAK ] = &aCalcPageBreakFT; - aFixedTexts[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualFT; - aFixedTexts[CALCPAGEBREAKAUTOMATIC ] = &aCalcPageBreakAutoFT; - aFixedTexts[CALCDETECTIVE ]=& aCalcDetectiveFT; - aFixedTexts[CALCDETECTIVEERROR ]=& aCalcDetectiveErrorFT; - aFixedTexts[CALCREFERENCE ]=& aCalcReferenceFT; - aFixedTexts[CALCNOTESBACKGROUND ]=& aCalcNotesBackFT; - aFixedTexts[WRITERPAGEBREAKS] = &aWrtPageBreaksFT; - aFixedTexts[DRAWGRID ] = &aDrawGridFT ; - aFixedTexts[BASICIDENTIFIER ] = &aBasicIdentifierFT; - aFixedTexts[BASICCOMMENT ] = &aBasicCommentFT; - aFixedTexts[BASICNUMBER ] = &aBasicNumberFT; - aFixedTexts[BASICSTRING ] = &aBasicStringFT; - aFixedTexts[BASICOPERATOR ] = &aBasicOperatorFT; - aFixedTexts[BASICKEYWORD ] = &aBasicKeywordFT; - aFixedTexts[BASICERROR ] = &aBasicErrorFT; - aFixedTexts[SQLIDENTIFIER ] = &aSQLIdentifierFT; - aFixedTexts[SQLNUMBER ] = &aSQLNumberFT; - aFixedTexts[SQLSTRING ] = &aSQLStringFT; - aFixedTexts[SQLOPERATOR ] = &aSQLOperatorFT; - aFixedTexts[SQLKEYWORD ] = &aSQLKeywordFT; - aFixedTexts[SQLPARAMETER ] = &aSQLParameterFT; - aFixedTexts[SQLCOMMENT ] = &aSQLCommentFT; - - aColorBoxes[DOCCOLOR ] = &aDocColorLB ; - aColorBoxes[DOCBOUNDARIES ] = &aDocBoundLB ; - aColorBoxes[APPBACKGROUND ] = &aAppBackLB ; - aColorBoxes[OBJECTBOUNDARIES ] = &aObjBoundLB ; - aColorBoxes[TABLEBOUNDARIES ] = &aTableBoundLB ; - aColorBoxes[FONTCOLOR ] = &aFontColorLB ; - aColorBoxes[LINKS ] = &aLinksLB ; - aColorBoxes[LINKSVISITED ] = &aLinksVisitedLB ; - aColorBoxes[SPELL ] = &aSpellLB ; - aColorBoxes[SMARTTAGS ] = &aSmarttagsLB ; - aColorBoxes[SHADOWCOLOR ] = &aShadowColorLB ; - aColorBoxes[WRITERTEXTGRID ] = &aWrtTextGridLB ; - aColorBoxes[WRITERFIELDSHADINGS ] = &aWrtFieldLB ; - aColorBoxes[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackLB ; - aColorBoxes[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrLB ; - aColorBoxes[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorLB ; - aColorBoxes[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundLB ; - aColorBoxes[WRITERPAGEBREAKS] = &aWrtPageBreaksLB; - aColorBoxes[HTMLSGML ] = &aHTMLSGMLLB ; - aColorBoxes[HTMLCOMMENT ] = &aHTMLCommentLB ; - aColorBoxes[HTMLKEYWORD ] = &aHTMLKeywdLB ; - aColorBoxes[HTMLUNKNOWN ] = &aHTMLUnknownLB ; - aColorBoxes[CALCGRID ] = &aCalcGridLB ; - aColorBoxes[CALCPAGEBREAK ] = &aCalcPageBreakLB ; - aColorBoxes[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualLB ; - aColorBoxes[CALCPAGEBREAKAUTOMATIC]= &aCalcPageBreakAutoLB ; - aColorBoxes[CALCDETECTIVE ] = &aCalcDetectiveLB ; - aColorBoxes[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorLB ; - aColorBoxes[CALCREFERENCE ] = &aCalcReferenceLB ; - aColorBoxes[CALCNOTESBACKGROUND ] = &aCalcNotesBackLB ; - aColorBoxes[DRAWGRID ] = &aDrawGridLB ; - aColorBoxes[BASICIDENTIFIER ] = &aBasicIdentifierLB; - aColorBoxes[BASICCOMMENT ] = &aBasicCommentLB; - aColorBoxes[BASICNUMBER ] = &aBasicNumberLB; - aColorBoxes[BASICSTRING ] = &aBasicStringLB; - aColorBoxes[BASICOPERATOR ] = &aBasicOperatorLB; - aColorBoxes[BASICKEYWORD ] = &aBasicKeywordLB; - aColorBoxes[BASICERROR ] = &aBasicErrorLB; - aColorBoxes[SQLIDENTIFIER ] = &aSQLIdentifierLB; - aColorBoxes[SQLNUMBER ] = &aSQLNumberLB; - aColorBoxes[SQLSTRING ] = &aSQLStringLB; - aColorBoxes[SQLOPERATOR ] = &aSQLOperatorLB; - aColorBoxes[SQLKEYWORD ] = &aSQLKeywordLB; - aColorBoxes[SQLPARAMETER ] = &aSQLParameterLB; - aColorBoxes[SQLCOMMENT ] = &aSQLCommentLB; - - aWindows[DOCCOLOR ] = &aDocColorWN ; - aWindows[DOCBOUNDARIES ] = &aDocBoundWN ; - aWindows[APPBACKGROUND ] = &aAppBackWN ; - aWindows[OBJECTBOUNDARIES ] = &aObjBoundWN ; - aWindows[TABLEBOUNDARIES ] = &aTableBoundWN ; - aWindows[FONTCOLOR ] = &aFontColorWN ; - aWindows[LINKS ] = &aLinksWN ; - aWindows[LINKSVISITED ] = &aLinksVisitedWN ; - aWindows[SPELL ] = &aSpellWN ; - aWindows[SMARTTAGS ] = &aSmarttagsWN ; - aWindows[SHADOWCOLOR ] = &aShadowColorWN ; - aWindows[WRITERTEXTGRID ] = &aWrtTextGridWN ; - aWindows[WRITERFIELDSHADINGS ] = &aWrtFieldWN ; - aWindows[WRITERIDXSHADINGS ] = &aWrtIdxShadingBackWN ; - aWindows[WRITERDIRECTCURSOR ] = &aWrtDirectCrsrWN ; - aWindows[WRITERSCRIPTINDICATOR ] = &aWrtScriptIndicatorWN ; - aWindows[WRITERSECTIONBOUNDARIES ] = &aWrtSectionBoundWN ; - aWindows[WRITERPAGEBREAKS] = &aWrtPageBreaksWN; - aWindows[HTMLSGML ] = &aHTMLSGMLWN ; - aWindows[HTMLCOMMENT ] = &aHTMLCommentWN ; - aWindows[HTMLKEYWORD ] = &aHTMLKeywdWN ; - aWindows[HTMLUNKNOWN ] = &aHTMLUnknownWN ; - aWindows[CALCGRID ] = &aCalcGridWN ; - aWindows[CALCPAGEBREAK ] = &aCalcPageBreakWN ; - aWindows[CALCPAGEBREAKMANUAL ] = &aCalcPageBreakManualWN ; - aWindows[CALCPAGEBREAKAUTOMATIC] = &aCalcPageBreakAutoWN ; - aWindows[CALCDETECTIVE ] = &aCalcDetectiveWN ; - aWindows[CALCDETECTIVEERROR ] = &aCalcDetectiveErrorWN ; - aWindows[CALCREFERENCE ] = &aCalcReferenceWN ; - aWindows[CALCNOTESBACKGROUND ] = &aCalcNotesBackWN ; - aWindows[DRAWGRID ] = &aDrawGridWN ; - aWindows[BASICIDENTIFIER ] = &aBasicIdentifierWN; - aWindows[BASICCOMMENT ] = &aBasicCommentWN; - aWindows[BASICNUMBER ] = &aBasicNumberWN; - aWindows[BASICSTRING ] = &aBasicStringWN; - aWindows[BASICOPERATOR ] = &aBasicOperatorWN; - aWindows[BASICKEYWORD ] = &aBasicKeywordWN; - aWindows[BASICERROR ] = &aBasicErrorWN; - aWindows[SQLIDENTIFIER ] = &aSQLIdentifierWN; - aWindows[SQLNUMBER ] = &aSQLNumberWN; - aWindows[SQLSTRING ] = &aSQLStringWN; - aWindows[SQLOPERATOR ] = &aSQLOperatorWN; - aWindows[SQLKEYWORD ] = &aSQLKeywordWN; - aWindows[SQLPARAMETER ] = &aSQLParameterWN; - aWindows[SQLCOMMENT ] = &aSQLCommentWN; - - aChapters.push_back(&aGeneralFT); aChapterWins.push_back(&aGeneralBackWN); - aChapters.push_back(&aWriterFT); aChapterWins.push_back(&aWriterBackWN); - aChapters.push_back(&aHTMLFT); aChapterWins.push_back(&aHTMLBackWN); - aChapters.push_back(&aCalcFT); aChapterWins.push_back(&aCalcBackWN); - aChapters.push_back(&aDrawFT); aChapterWins.push_back(&aDrawBackWN); - aChapters.push_back(&aBasicFT); aChapterWins.push_back(&aBasicBackWN); - aChapters.push_back(&aSQLFT); aChapterWins.push_back(&aSQLBackWN); - - // calculate heights of groups which can be hidden - aChapters[GROUP_WRITER ]->SetGroupHeight( aChapters[GROUP_HTML]->GetPosPixel().Y() - aChapters[GROUP_WRITER]->GetPosPixel().Y() ); - aChapters[GROUP_HTML ]->SetGroupHeight( aChapters[GROUP_CALC]->GetPosPixel().Y() - aChapters[GROUP_HTML]->GetPosPixel().Y() ); - aChapters[GROUP_CALC ]->SetGroupHeight( aChapters[GROUP_DRAW]->GetPosPixel().Y() - aChapters[GROUP_CALC]->GetPosPixel().Y() ); - aChapters[GROUP_DRAW ]->SetGroupHeight( aChapters[GROUP_BASIC]->GetPosPixel().Y() - aChapters[GROUP_DRAW]->GetPosPixel().Y() ); - aChapters[GROUP_BASIC ]->SetGroupHeight( aChapters[GROUP_SQL]->GetPosPixel().Y() - aChapters[GROUP_BASIC]->GetPosPixel().Y() ); - aChapters[GROUP_SQL]->SetGroupHeight(impl_getPosBehindLastChapter() - - aChapters[GROUP_SQL]->GetPosPixel().Y()); - - ExtendedColorConfig aExtConfig; - sal_Int32 nExtCount = aExtConfig.GetComponentCount(); - if ( nExtCount ) - { - const sal_Int32 nLastY(impl_getPosBehindLastChapter()); - // to calculate the number of lines - sal_Int32 nHeight = LogicToPixel( Size( 0, _LINE_HEIGHT ), MAP_APPFONT ).Height(); - sal_Int32 nLineNum = nLastY / nHeight; - - Size aFixedSize = LogicToPixel( Size( _FT_WIDTH , _FT_HEIGHT ), MAP_APPFONT ); - Size aLBSize = LogicToPixel( Size( _LB_WIDTH , _LB_HEIGHT ), MAP_APPFONT ); - Size aWinSize = LogicToPixel( Size( _WN_WIDTH , _WN_HEIGHT ), MAP_APPFONT ); - - for (sal_Int32 j = 0; j < nExtCount; ++j) - { - ::rtl::OUString sComponentName = aExtConfig.GetComponentName(j); - aChapterWins.push_back(new Window(this)); - ::boost::shared_ptr pTitle(new SvxExtFixedText_Impl(this,ResId(FT_SQL_COMMAND, *rResId.GetResMgr()))); - m_aExtensionTitles.push_back(pTitle); - pTitle->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize); - pTitle->SetText(aExtConfig.GetComponentDisplayName(sComponentName)); - aChapters.push_back(pTitle.get()); - ++nLineNum; - sal_Int32 nColorCount = aExtConfig.GetComponentColorCount(sComponentName); - for (sal_Int32 i = 0; i < nColorCount; ++i,++nLineNum) - { - ExtendedColorConfigValue aColorEntry = aExtConfig.GetComponentColorConfigValue(sComponentName,i); - FixedText* pFixedText = new FixedText(this,ResId(FT_BASICERROR, *rResId.GetResMgr())); - pFixedText->SetPosSizePixel(LogicToPixel( Point( _FT_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aFixedSize); - pFixedText->SetText(aColorEntry.getDisplayName()); - aFixedTexts.push_back(pFixedText); - aCheckBoxes.push_back(NULL); // no checkboxes - ColorListBox* pColorBox = new ColorListBox(this,ResId(LB_BASICERROR, *rResId.GetResMgr())); - pColorBox->SetPosSizePixel(LogicToPixel( Point( _LB_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aLBSize); - aColorBoxes.push_back(pColorBox); - Window* pWin = new Window(this,ResId(WN_BASICERROR, *rResId.GetResMgr())); - pWin->SetPosSizePixel(LogicToPixel( Point( _WN_XPOS, nLineNum * _LINE_HEIGHT ), MAP_APPFONT ),aWinSize); - aWindows.push_back(pWin); - } // for (sal_Int32 i = 0; i < nExtCount; ++i,++nLineNum) - } - } - - FreeResource(); - - Color TempColor(COL_TRANSPARENT); - Wallpaper aTransparentWall(TempColor); - sal_Int32 nWinWidth = GetSizePixel().Width(); - sal_Int32 nFTHeight = aChapters[0]->GetSizePixel().Height(); - Color aBackColor; - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode(); - if ( bHighContrast ) - aBackColor = rStyleSettings.GetShadowColor(); - else - aBackColor = Color( COL_LIGHTGRAY); - sal_Int32 nCount = aChapterWins.size(); - for(sal_Int32 i = 0; i < nCount; ++i) - { - if ( lcl_isGroupVisible( i, m_aModuleOptions ) ) - { - Font aFont = aChapters[i]->GetFont(); - aFont.SetWeight(WEIGHT_BOLD); - aChapters[i]->SetFont(aFont); - aChapters[i]->SetBackground(aTransparentWall); - aChapterWins[i]->SetPosSizePixel( Point(0, aChapters[i]->GetPosPixel().Y()), - Size(nWinWidth, nFTHeight)); - aChapterWins[i]->SetBackground(Wallpaper(aBackColor)); - aChapterWins[i]->Show(); - } - else - { - aChapters[i]->Hide(); - aChapterWins[i]->Hide(); - } - } - Color aTextColor; - sal_Bool bSetTextColor = sal_False; - //#104195# when the window color is the same as the text color it has to be changed - Color aWinCol = rStyleSettings.GetWindowColor(); - Color aRCheckCol = rStyleSettings.GetRadioCheckTextColor(); - if(aWinCol == aRCheckCol ) - { - bSetTextColor = sal_True; - aRCheckCol.Invert(); - //if inversion didn't work (gray) then it's set to black - if(aRCheckCol == aWinCol) - aRCheckCol = Color(COL_BLACK); - } // if(aWinCol == aRCheckCol ) - nCount = aFixedTexts.size(); - sal_Int16 nGroup = GROUP_UNKNOWN; - for( sal_Int32 i = 0; i < nCount; i++ ) - { - if(ANCHOR == i) - continue; - sal_Int16 nNewGroup = lcl_getGroup(i); - sal_Bool bShow = lcl_isGroupVisible( nNewGroup, m_aModuleOptions ); - - if ( nNewGroup > nGroup ) - { - nGroup = nNewGroup; - if ( bShow && nGroup >= GROUP_CALC ) - { - SetNewPosition( i, aChapters[nGroup] ); - SetNewPosition( i, aChapterWins[nGroup] ); - } - } - if(aCheckBoxes[i]) - { - if ( bShow ) - SetNewPosition( i, aCheckBoxes[i] ); - else - aCheckBoxes[i]->Hide(); - aCheckBoxes[i]->SetBackground(aTransparentWall); - aCheckBoxes[i]->SetHelpId( aColorCBHids[i] ); - if(bSetTextColor) - aCheckBoxes[i]->SetTextColor(aRCheckCol); - } - if(aFixedTexts[i]) - { - if ( bShow ) - SetNewPosition( i, aFixedTexts[i] ); - else - aFixedTexts[i]->Hide(); - aFixedTexts[i]->SetBackground(aTransparentWall); - if(bSetTextColor) - aFixedTexts[i]->SetTextColor(aRCheckCol); - } - if(aWindows[i]) - { - if ( bShow ) - SetNewPosition( i, aWindows[i] ); - else - aWindows[i]->Hide(); - aWindows[i]->SetBorderStyle(WINDOW_BORDER_MONO); - } - - if ( aColorBoxes[i] ) - { - if ( bShow ) - SetNewPosition( i, aColorBoxes[i] ); - else - aColorBoxes[i]->Hide(); - } - } - - XColorTable aColorTable( SvtPathOptions().GetPalettePath() ); - for( sal_Int32 i = 0; i < aColorTable.Count(); i++ ) - { - XColorEntry* pEntry = aColorTable.GetColor(i); - aColorBoxes[0]->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - aColorBoxes[0]->SetHelpId( aColorLBHids[0] ); - - OSL_ENSURE( nCount < sal_Int32(sizeof(aColorLBHids)/sizeof(aColorLBHids[0])), "too few helpIDs for color listboxes" ); - for( sal_Int32 i = 1; i < nCount; i++ ) - { - if(aColorBoxes[i]) - { - aColorBoxes[i]->CopyEntries( *aColorBoxes[0] ); - if( i < sal_Int32(sizeof(aColorLBHids)/sizeof(aColorLBHids[0])) ) - aColorBoxes[i]->SetHelpId( aColorLBHids[i] ); - aColorBoxes[i]->InsertAutomaticEntryColor(ColorConfig::GetDefaultColor((ColorConfigEntry) i)); - } - } - aColorBoxes[0]->InsertAutomaticEntryColor(ColorConfig::GetDefaultColor((ColorConfigEntry) 0)); -} - -ColorConfigWindow_Impl::~ColorConfigWindow_Impl() -{ - aChapters.clear(); - ::std::vector< SvxExtFixedText_Impl*>().swap(aChapters); - - - sal_Int32 nCount = aFixedTexts.size(); - for (sal_Int32 i = ColorConfigEntryCount; i < nCount; ++i) - { - delete aFixedTexts[i]; - delete aCheckBoxes[i]; - delete aColorBoxes[i]; - delete aWindows[i]; - } - for (sal_uInt32 i = GROUP_COUNT; i < aChapterWins.size(); ++i) - delete aChapterWins[i]; - aChapterWins.clear(); - ::std::vector< Window*>().swap(aChapterWins); -} - -sal_Int32 -ColorConfigWindow_Impl::impl_getPosBehindLastChapter() const -{ - sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height(); - nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height(); - return nLastY; -} - -void ColorConfigWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - sal_Bool bHighContrast = rStyleSettings.GetHighContrastMode(); - Color aBackColor( bHighContrast ? COL_TRANSPARENT : COL_LIGHTGRAY); - ::std::vector< Window* >::iterator aIter = aChapterWins.begin(); - ::std::vector< Window* >::iterator aEnd = aChapterWins.end(); - for(;aIter != aEnd; ++aIter ) - (*aIter)->SetBackground(Wallpaper(aBackColor)); - SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); - } -} - -void SvxExtFixedText_Impl::DataChanged(const DataChangedEvent& rDCEvt) -{ - FixedText::DataChanged(rDCEvt); - Color TempColor(COL_TRANSPARENT); - Wallpaper aTransparentWall(TempColor); - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - Font aFont = GetFont(); - aFont.SetWeight(WEIGHT_BOLD); - SetFont(aFont); - SetBackground(aTransparentWall); - } -} - -void ColorConfigWindow_Impl::SetNewPosition( sal_Int32 _nFeature, Window* _pWin ) -{ - DBG_ASSERT( _pWin, "ColorConfigWindow_Impl::SetNewPosition(): no window" ); - - // calculate the overall height of the invisible groups - long nDelta = 0; - sal_Int16 nGroup = lcl_getGroup( _nFeature ) - 1; - while ( nGroup > 0 ) // GROUP_GENERAL (0) is always visible - { - if ( !lcl_isGroupVisible( nGroup, m_aModuleOptions ) ) - nDelta += aChapters[nGroup]->GetGroupHeight(); - nGroup--; - } - - // move this window to its new position - if ( nDelta > 0 ) - { - Point aPos = _pWin->GetPosPixel(); - aPos.Y() -= nDelta; - _pWin->SetPosPixel( aPos ); - } -} - -void ColorConfigWindow_Impl::Command( const CommandEvent& rCEvt ) -{ - GetParent()->Command(rCEvt); -} - -class ColorConfigCtrl_Impl : public Control -{ - HeaderBar aHeaderHB; - ScrollBar aVScroll; - - String sOn; - String sUIElem; - String sColSetting; - String sPreview; - ColorConfigWindow_Impl aScrollWindow; - - EditableColorConfig* pColorConfig; - EditableExtendedColorConfig* pExtColorConfig; - - long nScrollPos; - - DECL_LINK(ScrollHdl, ScrollBar*); - DECL_LINK(ClickHdl, CheckBox*); - DECL_LINK(ColorHdl, ColorListBox*); - DECL_LINK(ControlFocusHdl, Control*); - - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); -public: - ColorConfigCtrl_Impl(Window* pParent, const ResId& rResId ); - ~ColorConfigCtrl_Impl(); - - void SetConfig(EditableColorConfig& rConfig) {pColorConfig = &rConfig;} - void SetExtendedConfig(EditableExtendedColorConfig& rConfig) {pExtColorConfig = &rConfig;} - void Update(); - sal_Int32 GetScrollPosition() {return aVScroll.GetThumbPos();} - void SetScrollPosition(sal_Int32 nSet) - { - aVScroll.SetThumbPos(nSet); - ScrollHdl(&aVScroll); - } -}; - -ColorConfigCtrl_Impl::ColorConfigCtrl_Impl( - Window* pParent, const ResId& rResId) : - Control(pParent, rResId), - - - aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), - aVScroll(this, ResId(VB_VSCROLL, *rResId.GetResMgr())), - sOn( ResId(ST_ON, *rResId.GetResMgr())), - sUIElem( ResId(ST_UIELEM, *rResId.GetResMgr())), - sColSetting( ResId(ST_COLSET, *rResId.GetResMgr())), - sPreview( ResId(ST_PREVIEW, *rResId.GetResMgr())), - aScrollWindow(this, ResId(WN_SCROLL, *rResId.GetResMgr())), - - pColorConfig(0), - pExtColorConfig(0), - nScrollPos(0) -{ - FreeResource(); - - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - aScrollWindow.SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); - aScrollWindow.SetHelpId( HID_OPTIONS_COLORCONFIG_COLORLIST_WIN ); - aVScroll.EnableDrag(); - aVScroll.Show(); - aHeaderHB.SetPosSizePixel( - Point(0,0), - Size(GetOutputSizePixel().Width(), aVScroll.GetPosPixel().Y())); - sal_Int32 nFirstWidth = aScrollWindow.aGeneralFT.GetPosPixel().X(); - sal_Int32 nSecondWidth = aScrollWindow.aColorBoxes[0]->GetPosPixel().X() - nFirstWidth; - sal_Int32 nThirdWidth = aScrollWindow.aWindows[0]->GetPosPixel().X() - nFirstWidth - nSecondWidth; - - const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS; - aHeaderHB.InsertItem( 1, sOn, nFirstWidth, (sal_uInt16)nHeadBits|HIB_CENTER); - aHeaderHB.InsertItem( 2, sUIElem, nSecondWidth, (sal_uInt16)nHeadBits|HIB_LEFT); - aHeaderHB.InsertItem( 3, sColSetting, nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT); - aHeaderHB.InsertItem( 4, sPreview, - aHeaderHB.GetSizePixel().Width() - nFirstWidth - nSecondWidth - nThirdWidth, (sal_uInt16)nHeadBits|HIB_LEFT); - aHeaderHB.Show(); - - aVScroll.SetRangeMin(0); - sal_Int32 nScrollOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y(); - sal_Int32 nVisibleEntries = aScrollWindow.GetSizePixel().Height() / nScrollOffset; - - aVScroll.SetRangeMax(aScrollWindow.aCheckBoxes.size() + aScrollWindow.aChapters.size() ); - // static: minus three for ANCHOR, DRAWFILL and DRAWDRAWING - aVScroll.SetRangeMax( aVScroll.GetRangeMax() - 3 ); - // dynamic: calculate the hidden lines - long nInvisibleLines = 0; - sal_Int16 nGroup = GROUP_UNKNOWN; - sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); - for ( sal_Int32 i = 0; i < nCount; i++ ) - { - if ( ANCHOR == i || DRAWFILL == i || DRAWDRAWING == i ) // not used at the moment - continue; - sal_Int16 nNewGroup = lcl_getGroup(i); - sal_Bool bVisible = lcl_isGroupVisible( nNewGroup, aScrollWindow.GetModuleOptions() ); - if ( !bVisible ) - nInvisibleLines++; - if ( nNewGroup > nGroup ) - { - nGroup = nNewGroup; - if ( !bVisible ) - nInvisibleLines++; - } - } - aVScroll.SetRangeMax( aVScroll.GetRangeMax() - nInvisibleLines ); - - aVScroll.SetPageSize( nVisibleEntries - 1 ); - aVScroll.SetVisibleSize(nVisibleEntries); - Link aScrollLink = LINK(this, ColorConfigCtrl_Impl, ScrollHdl); - aVScroll.SetScrollHdl(aScrollLink); - aVScroll.SetEndScrollHdl(aScrollLink); - - Link aCheckLink = LINK(this, ColorConfigCtrl_Impl, ClickHdl); - Link aColorLink = LINK(this, ColorConfigCtrl_Impl, ColorHdl); - Link aGetFocusLink = LINK(this, ColorConfigCtrl_Impl, ControlFocusHdl); - for( sal_Int16 i = 0; i < nCount; i++ ) - { - if(aScrollWindow.aColorBoxes[i]) - { - aScrollWindow.aColorBoxes[i]->SetSelectHdl(aColorLink); - aScrollWindow.aColorBoxes[i]->SetGetFocusHdl(aGetFocusLink); - } - if(aScrollWindow.aCheckBoxes[i]) - { - aScrollWindow.aCheckBoxes[i]->SetClickHdl(aCheckLink); - aScrollWindow.aCheckBoxes[i]->SetGetFocusHdl(aGetFocusLink); - } - } -} - -ColorConfigCtrl_Impl::~ColorConfigCtrl_Impl() -{ -} - -void ColorConfigCtrl_Impl::Update() -{ - DBG_ASSERT(pColorConfig, "Configuration not set" ); - sal_Int32 i; - for( i = 0; i < ColorConfigEntryCount; i++ ) - { - if(ANCHOR == i) - continue; - const ColorConfigValue& rColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i)); - if(COL_AUTO == (sal_uInt32)rColorEntry.nColor) - { - if(aScrollWindow.aColorBoxes[i]) - aScrollWindow.aColorBoxes[i]->SelectEntryPos(0); - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->SetBackground( - Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i))); - } - else - { - Color aColor(rColorEntry.nColor); - if(aScrollWindow.aColorBoxes[i]) - aScrollWindow.aColorBoxes[i]->SelectEntry( aColor ); - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); - } - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->Invalidate(); - if(aScrollWindow.aCheckBoxes[i]) - aScrollWindow.aCheckBoxes[i]->Check(rColorEntry.bIsVisible); - } // for( i = 0; i < ColorConfigEntryCount; i++ ) - - - sal_Int32 nExtCount = pExtColorConfig->GetComponentCount(); - sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); - sal_Int32 nPos = 0; - i = ColorConfigEntryCount; - for (sal_Int32 j = 0; j < nExtCount; ++j) - { - ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j); - sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName); - - for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k) - { - if(aScrollWindow.aColorBoxes[i]) - { - ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k); - Color aColor(aColorEntry.getColor()); - if(aColorEntry.getDefaultColor() == aColorEntry.getColor() ) - { - aScrollWindow.aColorBoxes[i]->SelectEntryPos(0); - } - else - { - aScrollWindow.aColorBoxes[i]->SelectEntry( aColor ); - } - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); - - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->Invalidate(); - } - } - } -} - -sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, sal_Bool _bShow) -{ - sal_Bool bHide = sal_True; - if(pWindow) - { - Point aPos = pWindow->GetPosPixel(); - aPos.Y() += nOffset; - pWindow->SetPosPixel(aPos); - if ( _bShow ) - bHide = aPos.Y() > nMaxVisible || (aPos.Y() + pWindow->GetSizePixel().Height()) < 0; - pWindow->Show(!bHide); - } - return !bHide; -} -IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar) -{ - aScrollWindow.SetUpdateMode(sal_True); - sal_Int16 i; - long nOffset = aScrollWindow.aColorBoxes[1]->GetPosPixel().Y() - aScrollWindow.aColorBoxes[0]->GetPosPixel().Y(); - nOffset *= (nScrollPos - pScrollBar->GetThumbPos()); - nScrollPos = pScrollBar->GetThumbPos(); - const long nWindowHeight = aScrollWindow.GetSizePixel().Height(); - sal_Int16 nFirstVisible = -1; - sal_Int16 nLastVisible = -1; - sal_Int32 nCount = aScrollWindow.aFixedTexts.size(); - for( i = 0; i < nCount; i++ ) - { - if(ANCHOR == i) - continue; - Point aPos; - //controls outside of the view need to be hidden to speed up accessibility tools - sal_Bool bShowCtrl = ( lcl_isGroupVisible( - lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False ); - // if any of the items on the current line is visible, the - // whole line should be visible - sal_Bool bShow(lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl)); - bShow = lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl) || bShow; - bShow = lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl) || bShow; - bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl) || bShow; - if(bShow) - { - if(nFirstVisible == -1) - nFirstVisible = i; - else - nLastVisible = i; - } - } - //show the one prior to the first visible and the first after the last visble control - //to enable KEY_TAB travelling - - if(nFirstVisible > 0) - { - //skip gaps where no controls exist for the related ColorConfigEntry - do - --nFirstVisible; - while(!aScrollWindow.aCheckBoxes[nFirstVisible] && !aScrollWindow.aColorBoxes[nFirstVisible] && nFirstVisible >= 0); - - if ( lcl_isGroupVisible( - lcl_getGroup( nFirstVisible ), aScrollWindow.GetModuleOptions() ) != sal_False ) - { - if(aScrollWindow.aCheckBoxes[nFirstVisible]) - aScrollWindow.aCheckBoxes[nFirstVisible]->Show(); - if(aScrollWindow.aColorBoxes[nFirstVisible]) - aScrollWindow.aColorBoxes[nFirstVisible]->Show(); - } - } - - if(nLastVisible < nCount - 1) - { - nLastVisible++; - //skip gaps where no controls exist for the related ColorConfigEntry - while(!aScrollWindow.aCheckBoxes[nLastVisible] && !aScrollWindow.aColorBoxes[nLastVisible] && - nLastVisible < nCount - 1 ) - nLastVisible++; - if ( nLastVisible < nCount ) - { - if ( lcl_isGroupVisible( - lcl_getGroup( nLastVisible ), aScrollWindow.GetModuleOptions() ) != sal_False ) - { - if(aScrollWindow.aCheckBoxes[nLastVisible]) - aScrollWindow.aCheckBoxes[nLastVisible]->Show(); - if(aScrollWindow.aColorBoxes[nLastVisible]) - aScrollWindow.aColorBoxes[nLastVisible]->Show(); - } - } - } // if(nLastVisible < nCount - 1) - sal_Int32 nChapterCount = aScrollWindow.aChapters.size(); - for( i = 0; i < nChapterCount; i++ ) - { - Point aPos = aScrollWindow.aChapters[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapters[i]->SetPosPixel(aPos); - aPos = aScrollWindow.aChapterWins[i]->GetPosPixel(); aPos.Y() += nOffset; aScrollWindow.aChapterWins[i]->SetPosPixel(aPos); - } - aScrollWindow.SetUpdateMode(sal_True); - return 0; -} - -long ColorConfigCtrl_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - if(rNEvt.GetType() == EVENT_COMMAND) - { - const CommandEvent* pCEvt = rNEvt.GetCommandEvent(); - sal_uInt16 nCmd = pCEvt->GetCommand(); - if( COMMAND_WHEEL == nCmd ) - { - Command(*pCEvt); - return 1; - } - } - return Control::PreNotify(rNEvt); -} - -void ColorConfigCtrl_Impl::Command( const CommandEvent& rCEvt ) -{ - switch ( rCEvt.GetCommand() ) - { - - case COMMAND_WHEEL: - case COMMAND_STARTAUTOSCROLL: - case COMMAND_AUTOSCROLL: - { - const CommandWheelData* pWheelData = rCEvt.GetWheelData(); - if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode()) - { - HandleScrollCommand( rCEvt, 0, &aVScroll ); - } - } - break; - default: - Control::Command(rCEvt); - } -} - -void ColorConfigCtrl_Impl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetBackground(Wallpaper(rStyleSettings.GetFieldColor())); - } -} - -IMPL_LINK(ColorConfigCtrl_Impl, ClickHdl, CheckBox*, pBox) -{ - DBG_ASSERT(pColorConfig, "Configuration not set" ); - - for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ ) - { - if(ANCHOR == i) - continue; - if(aScrollWindow.aCheckBoxes[i] == pBox ) - { - ColorConfigValue aBoundCol = pColorConfig->GetColorValue(ColorConfigEntry(i)); - aBoundCol.bIsVisible = pBox->IsChecked(); - pColorConfig->SetColorValue(ColorConfigEntry(i), aBoundCol); - break; - } - } - return 0; -} - -IMPL_LINK(ColorConfigCtrl_Impl, ColorHdl, ColorListBox*, pBox) -{ - DBG_ASSERT(pColorConfig, "Configuration not set" ); - sal_Int32 i = 0; - for( ; i < ColorConfigEntryCount; i++ ) - { - if(pBox && aScrollWindow.aColorBoxes[i] == pBox) - { - ColorConfigValue aColorEntry = pColorConfig->GetColorValue(ColorConfigEntry(i)); - if(pBox->IsAutomaticSelected()) - { - aColorEntry.nColor = COL_AUTO; - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->SetBackground( - Wallpaper(ColorConfig::GetDefaultColor((ColorConfigEntry) i))); - } - else - { - Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack! - aColorEntry.nColor = aColor.GetColor(); - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); - } - if(aScrollWindow.aWindows[i]) - aScrollWindow.aWindows[i]->Invalidate(); - pColorConfig->SetColorValue(ColorConfigEntry(i), aColorEntry); - break; - } - } // for( sal_Int32 i = 0; i < ColorConfigEntryCount; i++ ) - sal_Int32 nExtCount = pExtColorConfig->GetComponentCount(); - sal_Int32 nCount = aScrollWindow.aCheckBoxes.size(); - sal_Int32 nPos = 0; - i = ColorConfigEntryCount; - for (sal_Int32 j = 0; j < nExtCount; ++j) - { - ::rtl::OUString sComponentName = pExtColorConfig->GetComponentName(j); - sal_Int32 nColorCount = pExtColorConfig->GetComponentColorCount(sComponentName); - - for( sal_Int32 k = 0; i < nCount && k < nColorCount; ++i ,++nPos,++k) - { - if(pBox && aScrollWindow.aColorBoxes[i] == pBox) - { - ExtendedColorConfigValue aColorEntry = pExtColorConfig->GetComponentColorConfigValue(sComponentName,k); - Color aColor = pBox->GetSelectEntryColor(); // #i14869# no Color&, 'cause it's a ref to a temp object on the stack! - aColorEntry.setColor(aColor.GetColor()); - if( !pBox->GetSelectEntryPos() ) // auto color - { - aColorEntry.setColor(aColorEntry.getDefaultColor()); - aColor.SetColor(aColorEntry.getColor()); - } - if ( aScrollWindow.aWindows[i] ) - { - aScrollWindow.aWindows[i]->SetBackground(Wallpaper(aColor)); - aScrollWindow.aWindows[i]->Invalidate(); - } - pExtColorConfig->SetColorValue(sComponentName,aColorEntry); - break; - } - } - } - return 0; -} -IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl) -{ - //determine whether a control is completely visible - //and make it visible - Point aCtrlPos(pCtrl->GetPosPixel()); - sal_Int32 nWinHeight = aScrollWindow.GetSizePixel().Height(); - if(0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags() && - (aCtrlPos.Y() < 0 || - nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height()))) - { - long nThumbPos = aVScroll.GetThumbPos(); - if(nWinHeight < aCtrlPos.Y() + aScrollWindow.aColorBoxes[0]->GetSizePixel().Height()) - { - //scroll down - nThumbPos +=2; - } - else - { - //scroll up - nThumbPos -= 2; - if(nThumbPos < 0) - nThumbPos = 0; - } - aVScroll.SetThumbPos(nThumbPos); - ScrollHdl(&aVScroll); - } - return 0; -}; - -SvxColorOptionsTabPage::SvxColorOptionsTabPage( - Window* pParent, const SfxItemSet& rCoreSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_COLORCONFIG ), rCoreSet ), - aColorSchemeFL( this, CUI_RES( FL_COLORSCHEME ) ), - aColorSchemeFT( this, CUI_RES( FT_COLORSCHEME ) ), - aColorSchemeLB( this, CUI_RES( LB_COLORSCHEME ) ), - aSaveSchemePB( this, CUI_RES( PB_SAVESCHEME) ), - aDeleteSchemePB( this, CUI_RES( PB_DELETESCHEME ) ), - aCustomColorsFL( this, CUI_RES( FL_CUSTOMCOLORS ) ), - bFillItemSetCalled(sal_False), - pColorConfig(0), - pExtColorConfig(0), - pColorConfigCT( new ColorConfigCtrl_Impl(this, CUI_RES( CT_COLORCONFIG ) )) -{ - FreeResource(); - aColorSchemeLB.SetSelectHdl(LINK(this, SvxColorOptionsTabPage, SchemeChangedHdl_Impl)); - Link aLk = LINK(this, SvxColorOptionsTabPage, SaveDeleteHdl_Impl ); - aSaveSchemePB.SetClickHdl(aLk); - aDeleteSchemePB.SetClickHdl(aLk); -} - -SvxColorOptionsTabPage::~SvxColorOptionsTabPage() -{ - //when the dialog is cancelled but the color scheme ListBox has been changed these - //changes need to be undone - if(!bFillItemSetCalled && aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos()) - { - rtl::OUString sOldScheme = aColorSchemeLB.GetEntry(aColorSchemeLB.GetSavedValue()); - if(sOldScheme.getLength()) - { - pColorConfig->SetCurrentSchemeName(sOldScheme); - pExtColorConfig->SetCurrentSchemeName(sOldScheme); - } - } - delete pColorConfigCT; - pColorConfig->ClearModified(); - pColorConfig->EnableBroadcast(); - delete pColorConfig; - pExtColorConfig->ClearModified(); - pExtColorConfig->EnableBroadcast(); - delete pExtColorConfig; -} - -SfxTabPage* SvxColorOptionsTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return ( new SvxColorOptionsTabPage( pParent, rAttrSet ) ); -} - -sal_Bool SvxColorOptionsTabPage::FillItemSet( SfxItemSet& ) -{ - bFillItemSetCalled = sal_True; - if(aColorSchemeLB.GetSavedValue() != aColorSchemeLB.GetSelectEntryPos()) - { - pColorConfig->SetModified(); - pExtColorConfig->SetModified(); - } - if(pColorConfig->IsModified()) - pColorConfig->Commit(); - if(pExtColorConfig->IsModified()) - pExtColorConfig->Commit(); - return sal_True; -} - -void SvxColorOptionsTabPage::Reset( const SfxItemSet& ) -{ - if(pColorConfig) - { - pColorConfig->ClearModified(); - pColorConfig->DisableBroadcast(); - delete pColorConfig; - } - pColorConfig = new EditableColorConfig; - pColorConfigCT->SetConfig(*pColorConfig); - - if(pExtColorConfig) - { - pExtColorConfig->ClearModified(); - pExtColorConfig->DisableBroadcast(); - delete pExtColorConfig; - } - pExtColorConfig = new EditableExtendedColorConfig; - pColorConfigCT->SetExtendedConfig(*pExtColorConfig); - - String sUser = GetUserData(); - //has to be called always to speed up accessibility tools - pColorConfigCT->SetScrollPosition(sUser.ToInt32()); - aColorSchemeLB.Clear(); - uno::Sequence< ::rtl::OUString > aSchemes = pColorConfig->GetSchemeNames(); - const rtl::OUString* pSchemes = aSchemes.getConstArray(); - for(sal_Int32 i = 0; i < aSchemes.getLength(); i++) - aColorSchemeLB.InsertEntry(pSchemes[i]); - aColorSchemeLB.SelectEntry(pColorConfig->GetCurrentSchemeName()); - aColorSchemeLB.SaveValue(); - aDeleteSchemePB.Enable( aSchemes.getLength() > 1 ); - UpdateColorConfig(); -} - -int SvxColorOptionsTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return( LEAVE_PAGE ); -} - -void SvxColorOptionsTabPage::UpdateColorConfig() -{ - //update the color config control - pColorConfigCT->Update(); -} - -IMPL_LINK(SvxColorOptionsTabPage, SchemeChangedHdl_Impl, ListBox*, pBox) -{ - pColorConfig->LoadScheme(pBox->GetSelectEntry()); - pExtColorConfig->LoadScheme(pBox->GetSelectEntry()); - UpdateColorConfig(); - return 0; -} - -IMPL_LINK(SvxColorOptionsTabPage, SaveDeleteHdl_Impl, PushButton*, pButton ) -{ - if(&aSaveSchemePB == pButton) - { - String sName; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog( pButton, - sName, String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE2)) ); - DBG_ASSERT(aNameDlg, "Dialogdiet fail!"); - aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl)); - aNameDlg->SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_SAVE1))); - aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME); - aNameDlg->SetEditHelpId(HID_OPTIONS_COLORCONFIG_NAME_SCHEME); - aNameDlg->SetCheckNameHdl( LINK(this, SvxColorOptionsTabPage, CheckNameHdl_Impl)); - if(RET_OK == aNameDlg->Execute()) - { - aNameDlg->GetName(sName); - pColorConfig->AddScheme(sName); - pExtColorConfig->AddScheme(sName); - aColorSchemeLB.InsertEntry(sName); - aColorSchemeLB.SelectEntry(sName); - aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB); - } - delete aNameDlg; - } - else - { - DBG_ASSERT(aColorSchemeLB.GetEntryCount() > 1, "don't delete the last scheme"); - QueryBox aQuery(pButton, CUI_RES(RID_SVXQB_DELETE_COLOR_CONFIG)); - aQuery.SetText(String(CUI_RES(RID_SVXSTR_COLOR_CONFIG_DELETE))); - if(RET_YES == aQuery.Execute()) - { - rtl::OUString sDeleteScheme(aColorSchemeLB.GetSelectEntry()); - aColorSchemeLB.RemoveEntry(aColorSchemeLB.GetSelectEntryPos()); - aColorSchemeLB.SelectEntryPos(0); - aColorSchemeLB.GetSelectHdl().Call(&aColorSchemeLB); - //first select the new scheme and then delete the old one - pColorConfig->DeleteScheme(sDeleteScheme); - pExtColorConfig->DeleteScheme(sDeleteScheme); - } - } - aDeleteSchemePB.Enable( aColorSchemeLB.GetEntryCount() > 1 ); - return 0; -} - -IMPL_LINK(SvxColorOptionsTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog*, pDialog ) -{ - String sName; - pDialog->GetName(sName); - return sName.Len() && LISTBOX_ENTRY_NOTFOUND == aColorSchemeLB.GetEntryPos( sName ); -} - -void SvxColorOptionsTabPage::FillUserData() -{ - SetUserData(String::CreateFromInt32(pColorConfigCT->GetScrollPosition())); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optcolor.hrc b/cui/source/options/optcolor.hrc deleted file mode 100644 index 504cd5fe8..000000000 --- a/cui/source/options/optcolor.hrc +++ /dev/null @@ -1,223 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTCOLOR_HRC -#define _SVX_OPTCOLOR_HRC - -//Color config page -#define FL_COLORSCHEME 1 -#define FT_COLORSCHEME 2 -#define LB_COLORSCHEME 3 -#define PB_SAVESCHEME 4 -#define PB_DELETESCHEME 5 -#define FL_CUSTOMCOLORS 6 -#define CT_COLORCONFIG 7 - -#define HB_HEADER 10 -#define VB_VSCROLL 11 -#define WN_SCROLL 12 -#define ST_ON 17 -#define ST_UIELEM 18 -#define ST_COLSET 19 -#define ST_PREVIEW 20 - -#define FT_GENERAL 30 -#define FT_DOCCOLOR 31 -#define LB_DOCCOLOR 32 -#define WN_DOCCOLOR 33 -#define CB_DOCBOUND 34 -#define LB_DOCBOUND 35 -#define WN_DOCBOUND 36 -#define FT_APPBACKGROUND 37 -#define LB_APPBACKGROUND 38 -#define WN_APPBACKGROUND 39 -#define CB_OBJECTBOUNDARIES 40 -#define LB_OBJECTBOUNDARIES 41 -#define WN_OBJECTBOUNDARIES 42 -#define CB_TABLEBOUNDARIES 43 -#define LB_TABLEBOUNDARIES 44 -#define WN_TABLEBOUNDARIES 45 -#define FT_FONTCOLOR 46 -#define LB_FONTCOLOR 47 -#define WN_FONTCOLOR 48 -#define CB_LINKS 49 -#define LB_LINKS 50 -#define WN_LINKS 51 -#define CB_LINKSVISITED 52 -#define LB_LINKSVISITED 53 -#define WN_LINKSVISITED 54 - -#define FT_SPELL 58 -#define LB_SPELL 59 -#define WN_SPELL 60 - -#define FT_WRITER 61 -#define FT_WRITERTEXTGRID 62 -#define LB_WRITERTEXTGRID 63 -#define WN_WRITERTEXTGRID 64 -#define CB_WRITERFIELDSHADINGS 65 -#define LB_WRITERFIELDSHADINGS 66 -#define WN_WRITERFIELDSHADINGS 67 -#define CB_WRITERIDXSHADINGS 68 -#define LB_WRITERIDXSHADINGS 69 -#define WN_WRITERIDXSHADINGS 70 -#define LB_WRITERDIRECTCURSOR 71 -#define FT_WRITERDIRECTCURSOR 72 -#define WN_WRITERDIRECTCURSOR 73 -#define LB_WRITERSCRIPTINDICATOR 77 -#define FT_WRITERSCRIPTINDICATOR 78 -#define WN_WRITERSCRIPTINDICATOR 79 -#define LB_WRITERSECTIONBOUNDARIES 80 -#define CB_WRITERSECTIONBOUNDARIES 81 -#define WN_WRITERSECTIONBOUNDARIES 82 -#define LB_WRITERPAGEBREAKS 83 -#define FT_WRITERPAGEBREAKS 84 -#define WN_WRITERPAGEBREAKS 85 - -#define FT_HTML 88 -#define FT_HTMLSGML 89 -#define LB_HTMLSGML 90 -#define WN_HTMLSGML 91 -#define FT_HTMLCOMMENT 92 -#define LB_HTMLCOMMENT 93 -#define WN_HTMLCOMMENT 94 -#define FT_HTMLKEYWORD 95 -#define LB_HTMLKEYWORD 96 -#define WN_HTMLKEYWORD 97 -#define FT_HTMLUNKNOWN 98 -#define LB_HTMLUNKNOWN 99 -#define WN_HTMLUNKNOWN 100 - -#define FT_CALC 103 -#define FT_CALCGRID 104 -#define LB_CALCGRID 105 -#define WN_CALCGRID 106 -#define FT_CALCPAGEBREAK 107 -#define LB_CALCPAGEBREAK 108 -#define WN_CALCPAGEBREAK 109 -#define FT_CALCPAGEBREAKMANUAL 100 -#define LB_CALCPAGEBREAKMANUAL 101 -#define WN_CALCPAGEBREAKMANUAL 112 -#define FT_CALCPAGEBREAKAUTO 113 -#define LB_CALCPAGEBREAKAUTO 114 -#define WN_CALCPAGEBREAKAUTO 115 -#define FT_CALCDETECTIVE 116 -#define LB_CALCDETECTIVE 117 -#define WN_CALCDETECTIVE 118 -#define FT_CALCDETECTIVEERROR 119 -#define LB_CALCDETECTIVEERROR 120 -#define WN_CALCDETECTIVEERROR 121 -#define FT_CALCREFERENCE 122 -#define LB_CALCREFERENCE 123 -#define WN_CALCREFERENCE 124 -#define FT_CALCNOTESBACKGROUND 125 -#define LB_CALCNOTESBACKGROUND 126 -#define WN_CALCNOTESBACKGROUND 127 -#define FT_DRAW 128 -#define FT_DRAWGRID 132 -#define LB_DRAWGRID 133 -#define WN_DRAWGRID 134 -#define FT_BASICIDENTIFIER 141 -#define LB_BASICIDENTIFIER 142 -#define WN_BASICIDENTIFIER 143 -#define FT_BASICCOMMENT 144 -#define LB_BASICCOMMENT 145 -#define WN_BASICCOMMENT 146 -#define FT_BASICNUMBER 147 -#define LB_BASICNUMBER 148 -#define WN_BASICNUMBER 142 -#define FT_BASICSTRING 153 -#define LB_BASICSTRING 154 -#define WN_BASICSTRING 155 -#define FT_BASICOPERATOR 156 -#define LB_BASICOPERATOR 157 -#define WN_BASICOPERATOR 158 -#define FT_BASICKEYWORD 159 -#define LB_BASICKEYWORD 160 -#define WN_BASICKEYWORD 161 -#define FT_BASIC 162 -#define FT_BASICERROR 163 -#define LB_BASICERROR 164 -#define WN_BASICERROR 165 - -#define FT_SQL_COMMAND 173 -#define FT_SQLIDENTIFIER 174 -#define LB_SQLIDENTIFIER 175 -#define WN_SQLIDENTIFIER 176 -#define FT_SQLNUMBER 177 -#define LB_SQLNUMBER 178 -#define WN_SQLNUMBER 179 -#define FT_SQLSTRING 180 -#define LB_SQLSTRING 181 -#define WN_SQLSTRING 182 -#define FT_SQLOPERATOR 183 -#define LB_SQLOPERATOR 184 -#define WN_SQLOPERATOR 185 -#define FT_SQLKEYWORD 186 -#define LB_SQLKEYWORD 187 -#define WN_SQLKEYWORD 188 -#define FT_SQLPARAMETER 189 -#define LB_SQLPARAMETER 190 -#define WN_SQLPARAMETER 191 -#define FT_SQLCOMMENT 192 -#define LB_SQLCOMMENT 193 -#define WN_SQLCOMMENT 194 - -#define CB_SHADOWCOLOR 196 -#define LB_SHADOWCOLOR 197 -#define WN_SHADOWCOLOR 198 - -#define ST_EXTENSION 166 - - - -#define _FT_WIDTH 120 -#define _LINE_HEIGHT 15 -#define _FT_HEIGHT 10 -#define _CB_WIDTH 130 -#define _FT_XPOS 14 -#define _CB_XPOS 6 -#define _LB_XPOS 139 -#define _LB_WIDTH 50 -#define _LB_HEIGHT 50 -#define _WN_WIDTH 30 -#define _WN_HEIGHT 12 -#define _WN_XPOS 195 - -#define FT_SMARTTAGS 168 -#define LB_SMARTTAGS 169 -#define WN_SMARTTAGS 170 - -#define ST_SPELL_CHECK_HIGHLIGHTING 171 -#define ST_GRAMMAR_CHECK_HIGHLIGHTING 172 - - -#endif - - - - - diff --git a/cui/source/options/optcolor.hxx b/cui/source/options/optcolor.hxx deleted file mode 100644 index cb1bfed32..000000000 --- a/cui/source/options/optcolor.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTCOLOR_HXX -#define _SVX_OPTCOLOR_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include - -namespace svtools {class EditableColorConfig;class EditableExtendedColorConfig;} -class ColorConfigCtrl_Impl; -class AbstractSvxNameDialog; -class SvxColorOptionsTabPage : public SfxTabPage -{ - using SfxTabPage::DeactivatePage; - - FixedLine aColorSchemeFL; - FixedText aColorSchemeFT; - ListBox aColorSchemeLB; - PushButton aSaveSchemePB; - PushButton aDeleteSchemePB; - - FixedLine aCustomColorsFL; - - sal_Bool bFillItemSetCalled; - - svtools::EditableColorConfig* pColorConfig; - svtools::EditableExtendedColorConfig* pExtColorConfig; - ColorConfigCtrl_Impl* pColorConfigCT; - - DECL_LINK(SchemeChangedHdl_Impl, ListBox*); - DECL_LINK(SaveDeleteHdl_Impl, PushButton*); - DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog*); - void UpdateColorConfig(); - -public: - SvxColorOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxColorOptionsTabPage( ); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - - virtual int DeactivatePage( SfxItemSet* pSet ); - virtual void FillUserData(); - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optcolor.src b/cui/source/options/optcolor.src deleted file mode 100644 index dafa35641..000000000 --- a/cui/source/options/optcolor.src +++ /dev/null @@ -1,567 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include -#include "optcolor.hrc" - // pragma ---------------------------------------------------------------- - -TabPage RID_SVXPAGE_COLORCONFIG -{ - HelpId = HID_OPTIONS_COLORCONFIG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_COLORSCHEME - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Color scheme"; - }; - FixedText FT_COLORSCHEME - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Scheme"; - }; - ListBox LB_COLORSCHEME - { - HelpID = "cui:ListBox:RID_SVXPAGE_COLORCONFIG:LB_COLORSCHEME"; - Pos = MAP_APPFONT ( 65 , 14 ) ; - Size = MAP_APPFONT ( 77 , 58 ) ; - Border = TRUE; - Sort = TRUE; - DropDown = TRUE; - }; - PushButton PB_SAVESCHEME - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLORCONFIG:PB_SAVESCHEME"; - Pos = MAP_APPFONT ( 145, 13 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Save..."; - }; - PushButton PB_DELETESCHEME - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLORCONFIG:PB_DELETESCHEME"; - Pos = MAP_APPFONT ( 198 , 13 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Delete"; - }; - FixedLine FL_CUSTOMCOLORS - { - Pos = MAP_APPFONT ( 6 , 34 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - - Text [ en-US ] = "Custom colors"; - }; - Control CT_COLORCONFIG - { - Pos = MAP_APPFONT ( 12 , 45 ) ; - Size = MAP_APPFONT ( 236 , 134 ) ; - Border = TRUE; - DialogControl = TRUE; - OutputSize = TRUE ; - ScrollBar VB_VSCROLL - { - Pos = MAP_APPFONT ( 228 , 10 ) ; - Size = MAP_APPFONT ( 8 , 124 ) ; - VScroll = TRUE; - }; - String ST_ON - { - Text [ en-US ] = "On"; - }; - String ST_UIELEM - { - Text [ en-US ] = "User interface elements"; - }; - String ST_COLSET - { - Text [ en-US ] = "Color setting"; - }; - String ST_PREVIEW - { - Text [ en-US ] = "Preview"; - }; - Window WN_SCROLL - { - -// misc defines to shorten defining of standard elements -// standard sizes -#define FT_SEP_SIZE Size = MAP_APPFONT ( _FT_WIDTH , 8 ) -#define FT_SIZE Size = MAP_APPFONT ( _FT_WIDTH , _FT_HEIGHT ) -#define LB_SIZE Size = MAP_APPFONT ( _LB_WIDTH , _LB_HEIGHT ) -#define WN_SIZE Size = MAP_APPFONT ( _WN_WIDTH , _WN_HEIGHT ) -#define CB_SIZE Size = MAP_APPFONT ( _CB_WIDTH , _FT_HEIGHT ) - -// combination of position and size -#define POS_SIZE( POSX, LINENUM, CONTRL_SIZE ) Pos = MAP_APPFONT ( POSX , LINENUM * _LINE_HEIGHT ) ; CONTRL_SIZE - -// ... for special types -#define FT_SEP_POS_SIZE( LINENUM ) POS_SIZE( 14, LINENUM, FT_SEP_SIZE ) -#define FT_POS_SIZE( LINENUM ) POS_SIZE( _FT_XPOS, LINENUM, FT_SIZE ) -#define LB_POS_SIZE( LINENUM ) POS_SIZE( _LB_XPOS, LINENUM, LB_SIZE ) -#define WN_POS_SIZE( LINENUM ) POS_SIZE( _WN_XPOS, LINENUM, WN_SIZE ) -#define CB_POS_SIZE( LINENUM ) POS_SIZE( _CB_XPOS, LINENUM, CB_SIZE ) - -// combination of a listbox (color chooser) and window (color preview) -#define LB_WN( ID_POST, LINENUM ) ListBox LB_#ID_POST{LB_POS_SIZE(LINENUM);DropDown=TRUE;};Window WN_#ID_POST{WN_POS_SIZE(LINENUM);Border=TRUE;}; - - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 0 , 10 ) ; - Size = MAP_APPFONT ( 228 , 124 ) ; - DialogControl = TRUE; - - FixedText FT_GENERAL - { - FT_SEP_POS_SIZE( 0 ); - Text [ en-US ] = "General"; - }; - - FixedText FT_DOCCOLOR - { - FT_POS_SIZE( 1 ); - Text [ en-US ] = "Document background"; - }; - LB_WN( DOCCOLOR, 1 ) - - CheckBox CB_DOCBOUND - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_DOCBOUND"; - CB_POS_SIZE( 2 ); - Text [ en-US ] = "Text boundaries"; - }; - LB_WN( DOCBOUND, 2 ) - - FixedText FT_APPBACKGROUND - { - FT_POS_SIZE( 3 ); - Text [ en-US ] = "Application background"; - }; - LB_WN( APPBACKGROUND, 3 ) - - CheckBox CB_OBJECTBOUNDARIES - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_OBJECTBOUNDARIES"; - CB_POS_SIZE( 4 ); - Text [ en-US ] = "Object boundaries"; - }; - LB_WN( OBJECTBOUNDARIES, 4 ) - - CheckBox CB_TABLEBOUNDARIES - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_TABLEBOUNDARIES"; - CB_POS_SIZE( 5 ); - Text [ en-US ] = "Table boundaries"; - }; - LB_WN( TABLEBOUNDARIES, 5 ) - - FixedText FT_FONTCOLOR - { - FT_POS_SIZE( 6 ); - Text [ en-US ] = "Font color"; - }; - LB_WN( FONTCOLOR, 6 ) - - CheckBox CB_LINKS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_LINKS"; - CB_POS_SIZE( 7 ); - Text [ en-US ] = "Unvisited links"; - }; - LB_WN( LINKS, 7 ) - - CheckBox CB_LINKSVISITED - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_LINKSVISITED"; - CB_POS_SIZE( 8 ); - Text [ en-US ] = "Visited links"; - }; - LB_WN( LINKSVISITED, 8 ) - - FixedText FT_SPELL - { - FT_POS_SIZE( 9 ); - Text [ en-US ] = "AutoSpellcheck"; - }; - LB_WN( SPELL, 9 ) - - FixedText FT_SMARTTAGS - { - FT_POS_SIZE( 10 ); - Text [ en-US ] = "Smart Tags"; - }; - LB_WN( SMARTTAGS, 10 ) - - Checkbox CB_SHADOWCOLOR - { - CB_POS_SIZE( 11 ); - Text [ en-US ] = "Shadows"; - }; - LB_WN( SHADOWCOLOR, 11 ) - - FixedText FT_WRITER - { - FT_SEP_POS_SIZE( 12 ); - Text [ en-US ] = "Text Document"; - }; - - FixedText FT_WRITERTEXTGRID - { - FT_POS_SIZE( 13 ); - Text [ en-US ] = "Grid"; - }; - LB_WN( WRITERTEXTGRID, 13 ) - - CheckBox CB_WRITERFIELDSHADINGS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_WRITERFIELDSHADINGS"; - CB_POS_SIZE( 14 ); - Text [ en-US ] = "Field shadings"; - }; - LB_WN( WRITERFIELDSHADINGS, 14 ) - - CheckBox CB_WRITERIDXSHADINGS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_WRITERIDXSHADINGS"; - CB_POS_SIZE( 15 ); - Text [ en-US ] = "Index and table shadings"; - }; - LB_WN( WRITERIDXSHADINGS, 15 ) - - - FixedText FT_WRITERSCRIPTINDICATOR - { - FT_POS_SIZE( 16 ); - Text [ en-US ] = "Script indicator"; - }; - LB_WN( WRITERSCRIPTINDICATOR, 16 ) - - CheckBox CB_WRITERSECTIONBOUNDARIES - { - HelpID = "cui:CheckBox:RID_SVXPAGE_COLORCONFIG:CB_WRITERSECTIONBOUNDARIES"; - CB_POS_SIZE( 17 ); - Text [ en-US ] = "Section boundaries"; - }; - LB_WN( WRITERSECTIONBOUNDARIES, 17 ) - - FixedText FT_WRITERPAGEBREAKS - { - FT_POS_SIZE( 18 ); - Text [ en-US ] = "Page and column breaks"; - }; - LB_WN( WRITERPAGEBREAKS, 18 ) - - FixedText FT_WRITERDIRECTCURSOR - { - FT_POS_SIZE( 19 ); - Text [ en-US ] = "Direct cursor"; - }; - LB_WN( WRITERDIRECTCURSOR, 19 ) - - FixedText FT_HTML - { - FT_SEP_POS_SIZE( 20 ); - Text [ en-US ] = "HTML Document"; - }; - - FixedText FT_HTMLSGML - { - FT_POS_SIZE( 21 ); - Text [ en-US ] = "SGML syntax highlighting"; - }; - LB_WN( HTMLSGML, 21 ) - - FixedText FT_HTMLCOMMENT - { - FT_POS_SIZE( 22 ); - Text [ en-US ] = "Comment highlighting"; - }; - LB_WN( HTMLCOMMENT, 22 ) - - FixedText FT_HTMLKEYWORD - { - FT_POS_SIZE( 23 ); - Text [ en-US ] = "Keyword highlighting"; - }; - LB_WN( HTMLKEYWORD, 23 ) - - FixedText FT_HTMLUNKNOWN - { - FT_POS_SIZE( 24 ); - Text [ en-US ] = "Text"; - }; - LB_WN( HTMLUNKNOWN, 24 ) - - FixedText FT_CALC - { - FT_SEP_POS_SIZE( 25 ); - Text [ en-US ] = "Spreadsheet"; - }; - - FixedText FT_CALCGRID - { - FT_POS_SIZE( 26 ); - Text [ en-US ] = "Grid lines"; - }; - LB_WN( CALCGRID, 26 ) - - FixedText FT_CALCPAGEBREAK - { - FT_POS_SIZE( 27 ); - Text [ en-US ] = "Page breaks"; - }; - LB_WN( CALCPAGEBREAK, 27 ) - - FixedText FT_CALCPAGEBREAKMANUAL - { - FT_POS_SIZE( 28 ); - Text [ en-US ] = "Manual page breaks"; - }; - LB_WN( CALCPAGEBREAKMANUAL, 28 ) - - FixedText FT_CALCPAGEBREAKAUTO - { - FT_POS_SIZE( 29 ); - Text [ en-US ] = "Automatic page breaks"; - }; - LB_WN( CALCPAGEBREAKAUTO, 29) - - FixedText FT_CALCDETECTIVE - { - FT_POS_SIZE( 30 ); - Text [ en-US ] = "Detective"; - }; - LB_WN( CALCDETECTIVE, 30 ) - - FixedText FT_CALCDETECTIVEERROR - { - FT_POS_SIZE( 31 ); - Text [ en-US ] = "Detective error"; - }; - LB_WN( CALCDETECTIVEERROR, 31 ) - - FixedText FT_CALCREFERENCE - { - FT_POS_SIZE( 32 ); - Text [ en-US ] = "References"; - }; - LB_WN( CALCREFERENCE, 32 ) - - FixedText FT_CALCNOTESBACKGROUND - { - FT_POS_SIZE( 33 ); - Text [ en-US ] = "Notes background"; - }; - LB_WN( CALCNOTESBACKGROUND, 33 ) - - FixedText FT_DRAW - { - FT_SEP_POS_SIZE( 34 ); - Text [ en-US ] = "Drawing / Presentation"; - }; - - FixedText FT_DRAWGRID - { - FT_POS_SIZE( 35 ); - Text [ en-US ] = "Grid"; - }; - LB_WN( DRAWGRID, 35 ) - - FixedText FT_BASIC - { - FT_SEP_POS_SIZE( 36 ); - Text [ en-US ] = "Basic Syntax Highlighting"; - }; - - FixedText FT_BASICIDENTIFIER - { - FT_POS_SIZE( 37 ); - Text [ en-US ] = "Identifier"; - }; - LB_WN( BASICIDENTIFIER, 37 ) - - FixedText FT_BASICCOMMENT - { - FT_POS_SIZE( 38 ); - Text [ en-US ] = "Comment"; - }; - LB_WN( BASICCOMMENT, 38 ) - - FixedText FT_BASICNUMBER - { - FT_POS_SIZE( 39 ); - Text [ en-US ] = "Number"; - }; - LB_WN( BASICNUMBER, 39) - - FixedText FT_BASICSTRING - { - FT_POS_SIZE( 40 ); - Text [ en-US ] = "String"; - }; - LB_WN( BASICSTRING, 40 ) - - FixedText FT_BASICOPERATOR - { - FT_POS_SIZE( 41 ); - Text [ en-US ] = "Operator"; - }; - LB_WN( BASICOPERATOR, 41 ) - - FixedText FT_BASICKEYWORD - { - FT_POS_SIZE( 42 ); - Text [ en-US ] = "Reserved expression"; - }; - LB_WN( BASICKEYWORD, 42 ) - - FixedText FT_BASICERROR - { - FT_POS_SIZE( 43 ); - Text [ en-US ] = "Error"; - }; - LB_WN( BASICERROR, 43 ) - - FixedText FT_SQL_COMMAND - { - FT_SEP_POS_SIZE( 44 ); - Text [ en-US ] = "SQL Syntax Highlighting"; - }; - - FixedText FT_SQLIDENTIFIER - { - FT_POS_SIZE( 45 ); - Text [ en-US ] = "Identifier"; - }; - LB_WN( SQLIDENTIFIER, 45 ) - - FixedText FT_SQLNUMBER - { - FT_POS_SIZE( 46 ); - Text [ en-US ] = "Number"; - }; - LB_WN( SQLNUMBER, 46 ) - - FixedText FT_SQLSTRING - { - FT_POS_SIZE( 47 ); - Text [ en-US ] = "String"; - }; - LB_WN( SQLSTRING, 47 ) - - FixedText FT_SQLOPERATOR - { - FT_POS_SIZE( 48 ); - Text [ en-US ] = "Operator"; - }; - LB_WN( SQLOPERATOR, 48 ) - - FixedText FT_SQLKEYWORD - { - FT_POS_SIZE( 49 ); - Text [ en-US ] = "Keyword"; - }; - LB_WN( SQLKEYWORD, 49 ) - - FixedText FT_SQLPARAMETER - { - FT_POS_SIZE( 50 ); - Text [ en-US ] = "Parameter"; - }; - LB_WN( SQLPARAMETER, 50 ) - - FixedText FT_SQLCOMMENT - { - FT_POS_SIZE( 51 ); - Text [ en-US ] = "Comment"; - }; - LB_WN( SQLCOMMENT, 51 ) - - String ST_EXTENSION - { - Text [ en-US ] = "Colorsettings of the Extensions"; - }; - String ST_SPELL_CHECK_HIGHLIGHTING - { - Text [ en-US ] = "Spell check highlighting"; - }; - String ST_GRAMMAR_CHECK_HIGHLIGHTING - { - Text [ en-US ] = "Grammar check highlighting"; - }; - }; - }; -}; -QueryBox RID_SVXQB_DELETE_COLOR_CONFIG -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Do you really want to delete the color scheme?" ; -}; -String RID_SVXSTR_COLOR_CONFIG_DELETE -{ - Text [ en-US ] = "Color Scheme Deletion" ; -}; -String RID_SVXSTR_COLOR_CONFIG_SAVE1 -{ - Text [ en-US ] = "Save scheme" ; -}; -String RID_SVXSTR_COLOR_CONFIG_SAVE2 -{ - Text [ en-US ] = "Name of color scheme" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/optctl.cxx b/cui/source/options/optctl.cxx deleted file mode 100644 index 13f63ebe9..000000000 --- a/cui/source/options/optctl.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optctl.hxx" -#include -#include "optctl.hrc" -#include -#include - -// class SvxCTLOptionsPage ----------------------------------------------------- - -IMPL_LINK( SvxCTLOptionsPage, SequenceCheckingCB_Hdl, void*, EMPTYARG ) -{ - sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked(); - m_aRestrictedCB.Enable( bIsSequenceChecking ); - m_aTypeReplaceCB.Enable( bIsSequenceChecking ); - // #i48117#: by default restricted and type&replace have to be switched on - if(bIsSequenceChecking) - { - m_aTypeReplaceCB.Check( sal_True ); - m_aRestrictedCB.Check( sal_True ); - } - return 0; -} - -SvxCTLOptionsPage::SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_OPTIONS_CTL ), rSet ), - - m_aSequenceCheckingFL ( this, CUI_RES( FL_SEQUENCECHECKING ) ), - m_aSequenceCheckingCB ( this, CUI_RES( CB_SEQUENCECHECKING ) ), - m_aRestrictedCB ( this, CUI_RES( CB_RESTRICTED ) ), - m_aTypeReplaceCB ( this, CUI_RES( CB_TYPE_REPLACE ) ), - m_aCursorControlFL ( this, CUI_RES( FL_CURSORCONTROL ) ), - m_aMovementFT ( this, CUI_RES( FT_MOVEMENT ) ), - m_aMovementLogicalRB ( this, CUI_RES( RB_MOVEMENT_LOGICAL ) ), - m_aMovementVisualRB ( this, CUI_RES( RB_MOVEMENT_VISUAL ) ), - m_aGeneralFL ( this, CUI_RES( FL_GENERAL ) ), - m_aNumeralsFT ( this, CUI_RES( FT_NUMERALS ) ), - m_aNumeralsLB ( this, CUI_RES( LB_NUMERALS ) ) - -{ - FreeResource(); - - m_aSequenceCheckingCB.SetClickHdl( LINK( this, SvxCTLOptionsPage, SequenceCheckingCB_Hdl ) ); - - m_aNumeralsLB.SetDropDownLineCount( m_aNumeralsLB.GetEntryCount() ); -} -// ----------------------------------------------------------------------------- -SvxCTLOptionsPage::~SvxCTLOptionsPage() -{ -} -// ----------------------------------------------------------------------------- -SfxTabPage* SvxCTLOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxCTLOptionsPage( pParent, rAttrSet ); -} -// ----------------------------------------------------------------------------- -sal_Bool SvxCTLOptionsPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bModified = sal_False; - SvtCTLOptions aCTLOptions; - - // Sequence checking - sal_Bool bChecked = m_aSequenceCheckingCB.IsChecked(); - if ( bChecked != m_aSequenceCheckingCB.GetSavedValue() ) - { - aCTLOptions.SetCTLSequenceChecking( bChecked ); - bModified = sal_True; - } - - bChecked = m_aRestrictedCB.IsChecked(); - if( bChecked != m_aRestrictedCB.GetSavedValue() ) - { - aCTLOptions.SetCTLSequenceCheckingRestricted( bChecked ); - bModified = sal_True; - } - bChecked = m_aTypeReplaceCB.IsChecked(); - if( bChecked != m_aTypeReplaceCB.GetSavedValue()) - { - aCTLOptions.SetCTLSequenceCheckingTypeAndReplace(bChecked); - bModified = sal_True; - } - - sal_Bool bLogicalChecked = m_aMovementLogicalRB.IsChecked(); - sal_Bool bVisualChecked = m_aMovementVisualRB.IsChecked(); - if ( bLogicalChecked != m_aMovementLogicalRB.GetSavedValue() || - bVisualChecked != m_aMovementVisualRB.GetSavedValue() ) - { - SvtCTLOptions::CursorMovement eMovement = - bLogicalChecked ? SvtCTLOptions::MOVEMENT_LOGICAL : SvtCTLOptions::MOVEMENT_VISUAL; - aCTLOptions.SetCTLCursorMovement( eMovement ); - bModified = sal_True; - } - - sal_uInt16 nPos = m_aNumeralsLB.GetSelectEntryPos(); - if ( nPos != m_aNumeralsLB.GetSavedValue() ) - { - aCTLOptions.SetCTLTextNumerals( (SvtCTLOptions::TextNumerals)nPos ); - bModified = sal_True; - } - - return bModified; -} -// ----------------------------------------------------------------------------- -void SvxCTLOptionsPage::Reset( const SfxItemSet& ) -{ - SvtCTLOptions aCTLOptions; - - m_aSequenceCheckingCB.Check( aCTLOptions.IsCTLSequenceChecking() ); - m_aRestrictedCB.Check( aCTLOptions.IsCTLSequenceCheckingRestricted() ); - m_aTypeReplaceCB.Check( aCTLOptions.IsCTLSequenceCheckingTypeAndReplace() ); - - SvtCTLOptions::CursorMovement eMovement = aCTLOptions.GetCTLCursorMovement(); - switch ( eMovement ) - { - case SvtCTLOptions::MOVEMENT_LOGICAL : - m_aMovementLogicalRB.Check(); - break; - - case SvtCTLOptions::MOVEMENT_VISUAL : - m_aMovementVisualRB.Check(); - break; - - default: - DBG_ERRORFILE( "SvxCTLOptionsPage::Reset(): invalid movement enum" ); - } - - sal_uInt16 nPos = (sal_uInt16)aCTLOptions.GetCTLTextNumerals(); - DBG_ASSERT( nPos < m_aNumeralsLB.GetEntryCount(), "SvxCTLOptionsPage::Reset(): invalid numerals enum" ); - m_aNumeralsLB.SelectEntryPos( nPos ); - - m_aSequenceCheckingCB.SaveValue(); - m_aRestrictedCB.SaveValue(); - m_aTypeReplaceCB.SaveValue(); - m_aMovementLogicalRB.SaveValue(); - m_aMovementVisualRB.SaveValue(); - m_aNumeralsLB.SaveValue(); - - sal_Bool bIsSequenceChecking = m_aSequenceCheckingCB.IsChecked(); - m_aRestrictedCB.Enable( bIsSequenceChecking ); - m_aTypeReplaceCB.Enable( bIsSequenceChecking ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optctl.hrc b/cui/source/options/optctl.hrc deleted file mode 100644 index d3dcd14d8..000000000 --- a/cui/source/options/optctl.hrc +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTCTL_HRC -#define _SVX_OPTCTL_HRC - -#include - -#define FL_SEQUENCECHECKING 10 -#define CB_SEQUENCECHECKING 11 -#define CB_RESTRICTED 12 -#define CB_TYPE_REPLACE 13 - -#define FL_CURSORCONTROL 20 -#define FT_MOVEMENT 21 -#define RB_MOVEMENT_LOGICAL 22 -#define RB_MOVEMENT_VISUAL 23 - -#define FL_GENERAL 30 -#define FT_NUMERALS 31 -#define LB_NUMERALS 32 - -#define EXTRA_SPACE_Y 16 -#define ROW_0 (RSC_SP_TBPG_INNERBORDER_TOP) -#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_2 (ROW_1+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y) -#define ROW_4 (ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_5 (ROW_4+(RSC_CD_RADIOBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) -#define ROW_6 (ROW_5+RSC_CD_RADIOBUTTON_HEIGHT+RSC_SP_CTRL_Y+EXTRA_SPACE_Y) -#define ROW_7 (ROW_6+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_8 (ROW_7+(RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) - -#endif // #ifndef _SVX_OPTCTL_HRC - diff --git a/cui/source/options/optctl.hxx b/cui/source/options/optctl.hxx deleted file mode 100644 index 6ef294056..000000000 --- a/cui/source/options/optctl.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTCTL_HXX -#define _SVX_OPTCTL_HXX - -#include -#include -#include -#include - -// class SvxCTLOptionsPage ----------------------------------------------------- - -class SvxCTLOptionsPage : public SfxTabPage -{ -private: - FixedLine m_aSequenceCheckingFL; - CheckBox m_aSequenceCheckingCB; - CheckBox m_aRestrictedCB; - CheckBox m_aTypeReplaceCB; - - FixedLine m_aCursorControlFL; - FixedText m_aMovementFT; - RadioButton m_aMovementLogicalRB; - RadioButton m_aMovementVisualRB; - - FixedLine m_aGeneralFL; - FixedText m_aNumeralsFT; - ListBox m_aNumeralsLB; - - DECL_LINK( SequenceCheckingCB_Hdl, void* ); - - SvxCTLOptionsPage( Window* pParent, const SfxItemSet& rSet ); - -public: - - virtual ~SvxCTLOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif // #ifndef _SVX_OPTCTL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optctl.src b/cui/source/options/optctl.src deleted file mode 100644 index 52f265c19..000000000 --- a/cui/source/options/optctl.src +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "optctl.hrc" -#include "helpid.hrc" -#include - -#include - -TabPage RID_SVXPAGE_OPTIONS_CTL -{ - HelpId = HID_OPTIONS_CTL ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Complex Text Layout" ; - FixedLine FL_SEQUENCECHECKING - { - Pos = MAP_APPFONT ( 6, ROW_0 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Sequence checking"; - }; - CheckBox CB_SEQUENCECHECKING - { - HelpID = "cui:CheckBox:RID_SVXPAGE_OPTIONS_CTL:CB_SEQUENCECHECKING"; - Pos = MAP_APPFONT ( 12, ROW_1 ) ; - Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Use se~quence checking"; - }; - CheckBox CB_RESTRICTED - { - HelpID = "cui:CheckBox:RID_SVXPAGE_OPTIONS_CTL:CB_RESTRICTED"; - Pos = MAP_APPFONT ( 18, ROW_2 ); - Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT ); - Text[ en-US ] = "Restricted"; - }; - CheckBox CB_TYPE_REPLACE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_OPTIONS_CTL:CB_TYPE_REPLACE"; - Pos = MAP_APPFONT ( 18, ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y ); - Size = MAP_APPFONT ( 236, RSC_CD_CHECKBOX_HEIGHT ); - Text[ en-US ] = "~Type and replace"; - }; - FixedLine FL_CURSORCONTROL - { - Pos = MAP_APPFONT ( 6, ROW_3 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Cursor control"; - }; - FixedText FT_MOVEMENT - { - Pos = MAP_APPFONT ( 12, ROW_5 ) ; - Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Movement"; - }; - RadioButton RB_MOVEMENT_LOGICAL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_OPTIONS_CTL:RB_MOVEMENT_LOGICAL"; - Pos = MAP_APPFONT ( 105, ROW_4 ) ; - Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ; - Text [ en-US ] = "Lo~gical"; - }; - RadioButton RB_MOVEMENT_VISUAL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_OPTIONS_CTL:RB_MOVEMENT_VISUAL"; - Pos = MAP_APPFONT ( 177, ROW_4 ) ; - Size = MAP_APPFONT ( 69 , RSC_CD_RADIOBUTTON_HEIGHT ) ; - Text [ en-US ] = "~Visual"; - }; - FixedLine FL_GENERAL - { - Pos = MAP_APPFONT ( 6, ROW_6 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "General options"; - }; - FixedText FT_NUMERALS - { - Pos = MAP_APPFONT ( 12, ROW_8 ) ; - Size = MAP_APPFONT ( 90 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "~Numerals"; - }; - ListBox LB_NUMERALS - { - HelpID = "cui:ListBox:RID_SVXPAGE_OPTIONS_CTL:LB_NUMERALS"; - Pos = MAP_APPFONT ( 105, ROW_7 ) ; - Size = MAP_APPFONT ( 69 , 3*RSC_CD_DROPDOWN_HEIGHT ) ; - DropDown = TRUE ; - Border = TRUE ; - StringList [ en-US ]= - { - < "Arabic" ; > ; - < "Hindi" ; > ; - < "System" ; > ; - < "Context" ; > ; - }; - }; -}; diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx deleted file mode 100644 index 09c331bf0..000000000 --- a/cui/source/options/optdict.cxx +++ /dev/null @@ -1,808 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_OPTDICT_CXX - -#include -#include -#include "optdict.hrc" -#include "optdict.hxx" -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::linguistic2; - -// static ---------------------------------------------------------------- - -static const sal_uInt16 nNameLen = 8; -static const short NOACTDICT = -1; - -static long nStaticTabs[]= -{ - 2,10,71,120 -}; - -// static function ------------------------------------------------------- - -static String getNormDicEntry_Impl( const String &rText ) -{ - String aTmp( rText ); - aTmp.EraseTrailingChars( '.' ); - aTmp.EraseAllChars( '=' ); - return aTmp; -} - - -// Compare Dictionary Entry result -enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT }; - -static CDE_RESULT cmpDicEntry_Impl( const String &rText1, const String &rText2 ) -{ - CDE_RESULT eRes = CDE_DIFFERENT; - - if (rText1 == rText2) - eRes = CDE_EQUAL; - else - { // similar = equal up to trailing '.' and hyphenation positions - // marked with '=' - if (getNormDicEntry_Impl( rText1 ) == getNormDicEntry_Impl( rText2 )) - eRes = CDE_SIMILAR; - } - - return eRes; -} - -// class SvxNewDictionaryDialog ------------------------------------------- - -SvxNewDictionaryDialog::SvxNewDictionaryDialog( Window* pParent, - Reference< XSpellChecker1 > &xSpl ) : - - ModalDialog( pParent, CUI_RES( RID_SFXDLG_NEWDICT ) ), - - aNewDictBox ( this, CUI_RES( GB_NEWDICT ) ), - aNameText ( this, CUI_RES( FT_DICTNAME ) ), - aNameEdit ( this, CUI_RES( ED_DICTNAME ) ), - aLanguageText ( this, CUI_RES( FT_DICTLANG ) ), - aLanguageLB ( this, CUI_RES( LB_DICTLANG ) ), - aExceptBtn ( this, CUI_RES( BTN_EXCEPT ) ), - aOKBtn ( this, CUI_RES( BTN_NEWDICT_OK ) ), - aCancelBtn ( this, CUI_RES( BTN_NEWDICT_ESC ) ), - aHelpBtn ( this, CUI_RES( BTN_NEWDICT_HLP ) ), - xSpell( xSpl ) -{ - // Handler installieren - aNameEdit.SetModifyHdl( - LINK( this, SvxNewDictionaryDialog, ModifyHdl_Impl ) ); - aOKBtn.SetClickHdl( LINK( this, SvxNewDictionaryDialog, OKHdl_Impl ) ); - - // Sprachen anzeigen - aLanguageLB.SetLanguageList( LANG_LIST_ALL, sal_True, sal_True ); - aLanguageLB.SelectEntryPos(0); - - aNameText.SetAccessibleRelationMemberOf( &aNewDictBox ); - aNameEdit.SetAccessibleRelationMemberOf( &aNewDictBox ); - aLanguageText.SetAccessibleRelationMemberOf( &aNewDictBox ); - aLanguageLB.SetAccessibleRelationMemberOf( &aNewDictBox ); - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxNewDictionaryDialog, OKHdl_Impl, Button *, EMPTYARG ) -{ - String sDict = aNameEdit.GetText(); - sDict.EraseTrailingChars(); - // add extension for personal dictionaries - sDict.AppendAscii(".dic"); - - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - - Sequence< Reference< XDictionary > > aDics; - if (xDicList.is()) - aDics = xDicList->getDictionaries(); - const Reference< XDictionary > *pDic = aDics.getConstArray(); - sal_Int32 nCount = (sal_uInt16) aDics.getLength(); - - sal_Bool bFound = sal_False; - sal_uInt16 i; - for (i = 0; !bFound && i < nCount; ++i ) - if ( sDict.EqualsIgnoreCaseAscii( String(pDic[i]->getName()) )) - bFound = sal_True; - - if ( bFound ) - { - // Doppelte Namen? - InfoBox( this, CUI_RESSTR( RID_SVXSTR_OPT_DOUBLE_DICTS ) ).Execute(); - aNameEdit.GrabFocus(); - return 0; - } - - // Erzeugen und hinzufuegen - sal_uInt16 nLang = aLanguageLB.GetSelectLanguage(); - try - { - // create new dictionary - DictionaryType eType = aExceptBtn.IsChecked() ? - DictionaryType_NEGATIVE : DictionaryType_POSITIVE; - if (xDicList.is()) - { - lang::Locale aLocale( SvxCreateLocale(nLang) ); - String aURL( linguistic::GetWritableDictionaryURL( sDict ) ); - xNewDic = Reference< XDictionary > ( - xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY ); - xNewDic->setActive( sal_True ); - } - DBG_ASSERT(xNewDic.is(), "NULL pointer"); - } - catch(...) - { - xNewDic = NULL; - - // Fehler: konnte neues W"orterbuch nicht anlegen - SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, String(), - this, RID_SVXERRCTX, &CUI_MGR() ); - ErrorHandler::HandleError( *new StringErrorInfo( - ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) ); - - EndDialog( RET_CANCEL ); - } - - if (xDicList.is() && xNewDic.is()) - { - xDicList->addDictionary( Reference< XDictionary > ( xNewDic, UNO_QUERY ) ); - - // refresh list of dictionaries - //! dictionaries may have been added/removed elsewhere too. - aDics = xDicList->getDictionaries(); - } - pDic = aDics.getConstArray(); - nCount = (sal_uInt16) aDics.getLength(); - - - EndDialog( RET_OK ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG ) -{ - if ( aNameEdit.GetText().Len() ) - aOKBtn.Enable(); - else - aOKBtn.Disable(); - return 0; -} -IMPL_LINK_INLINE_END( SvxNewDictionaryDialog, ModifyHdl_Impl, Edit *, EMPTYARG ) - -//========================================================================== -// -// class SvxEditDictionaryDialog ------------------------------------------- -// -//========================================================================== - -SvxEditDictionaryDialog::SvxEditDictionaryDialog( - Window* pParent, - const String& rName, - Reference< XSpellChecker1 > &xSpl ) : - - ModalDialog( pParent, CUI_RES( RID_SFXDLG_EDITDICT ) ), - - aBookFT ( this, CUI_RES( FT_BOOK ) ), - aAllDictsLB ( this, CUI_RES( LB_ALLDICTS ) ), - aLangFT ( this, CUI_RES( FT_DICTLANG ) ), - aLangLB ( this, CUI_RES( LB_DICTLANG ) ), - - aWordFT ( this, CUI_RES( FT_WORD ) ), - aWordED ( this, CUI_RES( ED_WORD ) ), - aReplaceFT ( this, CUI_RES( FT_REPLACE ) ), - aReplaceED ( this, CUI_RES( ED_REPLACE ) ), - aWordsLB ( this, CUI_RES( TLB_REPLACE ) ), - aNewReplacePB ( this, CUI_RES( PB_NEW_REPLACE ) ), - aDeletePB ( this, CUI_RES( PB_DELETE_REPLACE ) ), - aEditDictsBox ( this, CUI_RES( GB_EDITDICTS ) ), - aHelpBtn ( this, CUI_RES( BTN_EDITHELP ) ), - aCloseBtn ( this, CUI_RES( BTN_EDITCLOSE ) ), - sModify (CUI_RES(STR_MODIFY)), - sNew (aNewReplacePB.GetText()), - aDecoView ( this), - xSpell ( xSpl ), - nOld ( NOACTDICT ), - bFirstSelect (sal_True), - bDoNothing (sal_False) - -{ - if (SvxGetDictionaryList().is()) - aDics = SvxGetDictionaryList()->getDictionaries(); - - aWordsLB.SetSelectHdl(LINK(this, SvxEditDictionaryDialog, SelectHdl)); - aWordsLB.SetTabs(nStaticTabs); - - //! we use an algorithm of our own to insert elements sorted - aWordsLB.SetStyle(aWordsLB.GetStyle()|/*WB_SORT|*/WB_HSCROLL|WB_CLIPCHILDREN); - - - nWidth=aWordED.GetSizePixel().Width(); - // Handler installieren - aNewReplacePB.SetClickHdl( - LINK( this, SvxEditDictionaryDialog, NewDelHdl)); - aDeletePB.SetClickHdl( - LINK( this, SvxEditDictionaryDialog, NewDelHdl)); - - aLangLB.SetSelectHdl( - LINK( this, SvxEditDictionaryDialog, SelectLangHdl_Impl ) ); - aAllDictsLB.SetSelectHdl( - LINK( this, SvxEditDictionaryDialog, SelectBookHdl_Impl ) ); - - aWordED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); - aReplaceED.SetModifyHdl(LINK(this, SvxEditDictionaryDialog, ModifyHdl)); - aWordED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl)); - aReplaceED.SetActionHdl(LINK(this, SvxEditDictionaryDialog, NewDelHdl)); - - // Listbox mit allen verfuegbaren WB's fuellen - const Reference< XDictionary > *pDic = aDics.getConstArray(); - sal_Int32 nCount = aDics.getLength(); - - String aLookUpEntry; - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - Reference< XDictionary > xDic( pDic[i], UNO_QUERY ); - if (xDic.is()) - { - sal_Bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE ? - sal_True : sal_False; - String aDicName( xDic->getName() ); - const String aTxt( ::GetDicInfoStr( aDicName, SvxLocaleToLanguage( xDic->getLocale() ), - bNegative ) ); - aAllDictsLB.InsertEntry( aTxt ); - - if (rName == aDicName) - aLookUpEntry = aTxt; - } - } - - aLangLB.SetLanguageList( LANG_LIST_ALL, sal_True, sal_True ); - - aReplaceED.SetSpaces(sal_True); - aWordED.SetSpaces(sal_True); - - if ( nCount > 0 ) - { - aAllDictsLB.SelectEntry( aLookUpEntry ); - sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos(); - - if ( nPos == LISTBOX_ENTRY_NOTFOUND ) - { - nPos = 0; - aAllDictsLB.SelectEntryPos( nPos ); - } - Reference< XDictionary > xDic; - if (nPos != LISTBOX_ENTRY_NOTFOUND) - xDic = Reference< XDictionary > ( aDics.getConstArray()[ nPos ], UNO_QUERY ); - if (xDic.is()) - SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) ); - - // check if dictionary is read-only - SetDicReadonly_Impl(xDic); - sal_Bool bEnable = !IsDicReadonly_Impl(); - aNewReplacePB .Enable( sal_False ); - aDeletePB .Enable( sal_False ); - aLangFT.Enable( bEnable ); - aLangLB.Enable( bEnable ); - ShowWords_Impl( nPos ); - - } - else - { - aNewReplacePB.Disable(); - aDeletePB .Disable(); - } - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxEditDictionaryDialog::~SvxEditDictionaryDialog() -{ -} - -// ----------------------------------------------------------------------- - -void SvxEditDictionaryDialog::Paint( const Rectangle& rRect ) -{ - ModalDialog::Paint(rRect ); - - Rectangle aRect(aEditDictsBox.GetPosPixel(),aEditDictsBox.GetSizePixel()); - - sal_uInt16 nStyle=BUTTON_DRAW_NOFILL; - aDecoView.DrawButton( aRect, nStyle); -} - -// ----------------------------------------------------------------------- - -void SvxEditDictionaryDialog::SetDicReadonly_Impl( - Reference< XDictionary > &xDic ) -{ - // enable or disable new and delete button according to file attributes - bDicIsReadonly = sal_True; - if (xDic.is()) - { - Reference< frame::XStorable > xStor( xDic, UNO_QUERY ); - if ( !xStor.is() // non persistent dictionary - || !xStor->hasLocation() // not yet persistent - || !xStor->isReadonly() ) - { - bDicIsReadonly = sal_False; - } - } -} - -// ----------------------------------------------------------------------- - -void SvxEditDictionaryDialog::SetLanguage_Impl( util::Language nLanguage ) -{ - // select language - aLangLB.SelectLanguage( nLanguage ); -} - -sal_uInt16 SvxEditDictionaryDialog::GetLBInsertPos(const String &rDicWord) -{ - sal_uInt16 nPos = USHRT_MAX; - - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); - sal_uInt16 j; - for( j = 0; j < aWordsLB.GetEntryCount(); j++ ) - { - SvLBoxEntry* pEntry = aWordsLB.GetEntry(j); - DBG_ASSERT( pEntry, "NULL pointer"); - String aNormEntry( getNormDicEntry_Impl( rDicWord ) ); - StringCompare eCmpRes = (StringCompare)pCollator-> - compareString( aNormEntry, getNormDicEntry_Impl( aWordsLB.GetEntryText(pEntry, 0) ) ); - if( COMPARE_LESS == eCmpRes ) - break; - } - if (j < aWordsLB.GetEntryCount()) // entry found? - nPos = j; - - return nPos; -} - -void SvxEditDictionaryDialog::RemoveDictEntry(SvLBoxEntry* pEntry) -{ - sal_uInt16 nLBPos = aAllDictsLB.GetSelectEntryPos(); - - if ( pEntry != NULL && nLBPos != LISTBOX_ENTRY_NOTFOUND ) - { - String sTmpShort(aWordsLB.GetEntryText(pEntry, 0)); - - Reference< XDictionary > xDic = aDics.getConstArray()[ nLBPos ]; - if (xDic->remove( sTmpShort )) // sal_True on success - { - aWordsLB.GetModel()->Remove(pEntry); - } - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aNewReplacePB.Enable( sal_False ); - aDeletePB .Enable( sal_False ); - // Dictionary anzeigen - ShowWords_Impl( nPos ); - // enable or disable new and delete button according to file attributes - Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY ); - if (xDic.is()) - SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) ); - - SetDicReadonly_Impl(xDic); - sal_Bool bEnable = !IsDicReadonly_Impl(); - aLangFT.Enable( bEnable ); - aLangLB.Enable( bEnable ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nDicPos = aAllDictsLB.GetSelectEntryPos(); - sal_uInt16 nLang = aLangLB.GetSelectLanguage(); - Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY ); - sal_Int16 nOldLang = SvxLocaleToLanguage( xDic->getLocale() ); - - if ( nLang != nOldLang ) - { - QueryBox aBox( this, CUI_RES( RID_SFXQB_SET_LANGUAGE ) ); - String sTxt( aBox.GetMessText() ); - sTxt.SearchAndReplaceAscii( "%1", aAllDictsLB.GetSelectEntry() ); - aBox.SetMessText( sTxt ); - - if ( aBox.Execute() == RET_YES ) - { - xDic->setLocale( SvxCreateLocale( nLang ) ); - sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE; - - const String sName( - ::GetDicInfoStr( xDic->getName(), - SvxLocaleToLanguage( xDic->getLocale() ), - bNegativ ) ); - aAllDictsLB.RemoveEntry( nDicPos ); - aAllDictsLB.InsertEntry( sName, nDicPos ); - aAllDictsLB.SelectEntryPos( nDicPos ); - } - else - SetLanguage_Impl( nOldLang ); - } - return 1; -} - -// ----------------------------------------------------------------------- - -void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId ) -{ - Reference< XDictionary > xDic = aDics.getConstArray()[ nId ]; - - nOld = nId; - EnterWait(); - - String aStr; - - aWordED.SetText(aStr); - aReplaceED.SetText(aStr); - - if(xDic->getDictionaryType() != DictionaryType_POSITIVE) - { - nStaticTabs[0]=2; - - // make controls for replacement text active - if(!aReplaceFT.IsVisible()) - { - Size aSize=aWordED.GetSizePixel(); - aSize.Width()=nWidth; - aWordED.SetSizePixel(aSize); - aReplaceFT.Show(); - aReplaceED.Show(); - } - } - else - { - nStaticTabs[0]=1; - - // deactivate controls for replacement text - if(aReplaceFT.IsVisible()) - { - Size aSize=aWordED.GetSizePixel(); - aSize.Width()=aWordsLB.GetSizePixel().Width(); - aWordED.SetSizePixel(aSize); - aReplaceFT.Hide(); - aReplaceED.Hide(); - } - - } - - aWordsLB.SetTabs(nStaticTabs); - aWordsLB.Clear(); - - Sequence< Reference< XDictionaryEntry > > aEntries( xDic->getEntries() ); - const Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - sal_Int32 nCount = aEntries.getLength(); - - for (sal_Int32 i = 0; i < nCount; i++) - { - aStr = String(pEntry[i]->getDictionaryWord()); - sal_uInt16 nPos = GetLBInsertPos( aStr ); - if(pEntry[i]->isNegative()) - { - aStr += '\t'; - aStr += String(pEntry[i]->getReplacementText()); - } - aWordsLB.InsertEntry(aStr, 0, sal_False, nPos == USHRT_MAX ? LIST_APPEND : nPos); - } - - if (aWordsLB.GetEntryCount()) - { - aWordED .SetText( aWordsLB.GetEntryText((sal_uLong)0, 0) ); - aReplaceED.SetText( aWordsLB.GetEntryText((sal_uLong)0, 1) ); - } - - LeaveWait(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK(SvxEditDictionaryDialog, SelectHdl, SvTabListBox*, pBox) -{ - if(!bDoNothing) - { - if(!bFirstSelect) - { - SvLBoxEntry* pEntry = pBox->FirstSelected(); - String sTmpShort(pBox->GetEntryText(pEntry, 0)); - // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor - //sonst immer am Wortanfang, obwohl man gerade hier editiert - if(aWordED.GetText() != sTmpShort) - aWordED.SetText(sTmpShort); - aReplaceED.SetText(pBox->GetEntryText(pEntry, 1)); - } - else - bFirstSelect = sal_False; - - // entries in the list box should exactly correspond to those from the - // dictionary. Thus: - aNewReplacePB.Enable(sal_False); - aDeletePB .Enable( sal_True && !IsDicReadonly_Impl() ); - } - return 0; -}; - -// ----------------------------------------------------------------------- - -IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn) -{ - SvLBoxEntry* pEntry = aWordsLB.FirstSelected(); - - if(pBtn == &aDeletePB) - { - DBG_ASSERT(pEntry, "keine Eintrag selektiert"); - String aStr; - - aWordED.SetText(aStr); - aReplaceED.SetText(aStr); - aDeletePB.Disable(); - - RemoveDictEntry(pEntry); // remove entry from dic and list-box - } - if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled()) - { - SvLBoxEntry* _pEntry = aWordsLB.FirstSelected(); - XubString aNewWord(aWordED.GetText()); - String sEntry(aNewWord); - XubString aReplaceStr(aReplaceED.GetText()); - - sal_Int16 nAddRes = DIC_ERR_UNKNOWN; - sal_uInt16 nPos = aAllDictsLB.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && aNewWord.Len() > 0) - { - DBG_ASSERT(nPos < aDics.getLength(), "invalid dictionary index"); - Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY ); - if (xDic.is()) - { - // make changes in dic - - //! ...IsVisible should reflect wether the dictionary is a negativ - //! or not (hopefully...) - sal_Bool bIsNegEntry = aReplaceFT.IsVisible(); - ::rtl::OUString aRplcText; - if(bIsNegEntry) - aRplcText = aReplaceStr; - - if (_pEntry) // entry selected in aWordsLB ie action = modify entry - xDic->remove( aWordsLB.GetEntryText( _pEntry, 0 ) ); - // if remove has failed the following add should fail too - // and thus a warning message should be triggered... - - Reference aXDictionary(xDic, UNO_QUERY); - nAddRes = linguistic::AddEntryToDic( aXDictionary, - aNewWord, bIsNegEntry, - aRplcText, SvxLocaleToLanguage( xDic->getLocale() ), sal_False ); - } - } - if (DIC_ERR_NONE != nAddRes) - SvxDicError( this, nAddRes ); - - if(DIC_ERR_NONE == nAddRes && sEntry.Len()) - { - // insert new entry in list-box etc... - - aWordsLB.SetUpdateMode(sal_False); - sal_uInt16 _nPos = USHRT_MAX; - - if(aReplaceFT.IsVisible()) - { - sEntry += '\t'; - sEntry += aReplaceStr; - } - - SvLBoxEntry* pNewEntry = NULL; - if(_pEntry) // entry selected in aWordsLB ie action = modify entry - { - aWordsLB.SetEntryText( sEntry, _pEntry ); - pNewEntry = _pEntry; - } - else - { - _nPos = GetLBInsertPos( aNewWord ); - SvLBoxEntry* pInsEntry = aWordsLB.InsertEntry(sEntry, 0, sal_False, - _nPos == USHRT_MAX ? LIST_APPEND : (sal_uInt32)_nPos); - pNewEntry = pInsEntry; - } - - aWordsLB.MakeVisible( pNewEntry ); - aWordsLB.SetUpdateMode(sal_True); - // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen - if(aReplaceED.HasFocus()) - aWordED.GrabFocus(); - } - } - else - { - // das kann nur ein Enter in einem der beiden Edit-Felder sein und das - // bedeutet EndDialog() - muss im KeyInput ausgewertet werden - return 0; - } - ModifyHdl(&aWordED); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK(SvxEditDictionaryDialog, ModifyHdl, Edit*, pEdt) -{ - SvLBoxEntry* pFirstSel = aWordsLB.FirstSelected(); - String rEntry = pEdt->GetText(); - - xub_StrLen nWordLen=rEntry.Len(); - const String& rRepString = aReplaceED.GetText(); - - sal_Bool bEnableNewReplace = sal_False; - sal_Bool bEnableDelete = sal_False; - String aNewReplaceText = sNew; - - if(pEdt == &aWordED) - { - if(nWordLen>0) - { - sal_Bool bFound = sal_False; - sal_Bool bTmpSelEntry=sal_False; - CDE_RESULT eCmpRes = CDE_DIFFERENT; - - for(sal_uInt16 i = 0; i < aWordsLB.GetEntryCount(); i++) - { - SvLBoxEntry* pEntry = aWordsLB.GetEntry( i ); - String aTestStr( aWordsLB.GetEntryText(pEntry, 0) ); - eCmpRes = cmpDicEntry_Impl( rEntry, aTestStr ); - if(CDE_DIFFERENT != eCmpRes) - { - if(rRepString.Len()) - bFirstSelect = sal_True; - bDoNothing=sal_True; - aWordsLB.SetCurEntry(pEntry); - bDoNothing=sal_False; - pFirstSel = pEntry; - aReplaceED.SetText(aWordsLB.GetEntryText(pEntry, 1)); - - if (CDE_SIMILAR == eCmpRes) - { - aNewReplaceText = sModify; - bEnableNewReplace = sal_True; - } - bFound= sal_True; - break; - } - else if(getNormDicEntry_Impl(aTestStr).Search( - getNormDicEntry_Impl( rEntry ) ) == 0 - && !bTmpSelEntry) - { - bDoNothing=sal_True; - aWordsLB.MakeVisible(pEntry); - bDoNothing=sal_False; - bTmpSelEntry=sal_True; - - aNewReplaceText = sNew; - bEnableNewReplace = sal_True; - } - } - - if(!bFound) - { - aWordsLB.SelectAll(sal_False); - pFirstSel = 0; - - aNewReplaceText = sNew; - bEnableNewReplace = sal_True; - } - bEnableDelete = CDE_DIFFERENT != eCmpRes; - } - else if(aWordsLB.GetEntryCount()>0) - { - SvLBoxEntry* pEntry = aWordsLB.GetEntry( 0 ); - bDoNothing=sal_True; - aWordsLB.MakeVisible(pEntry); - bDoNothing=sal_False; - } - } - else if(pEdt == &aReplaceED) - { - String aReplaceText; - String aWordText; - if (pFirstSel) // a aWordsLB entry is selected - { - aWordText = aWordsLB.GetEntryText( pFirstSel, 0 ); - aReplaceText = aWordsLB.GetEntryText( pFirstSel, 1 ); - - aNewReplaceText = sModify; - bEnableDelete = sal_True; - } - sal_Bool bIsChange = - CDE_EQUAL != cmpDicEntry_Impl(aWordED.GetText(), aWordText) - || CDE_EQUAL != cmpDicEntry_Impl(aReplaceED.GetText(), aReplaceText); - if (aWordED.GetText().Len() && bIsChange) - bEnableNewReplace = sal_True; - } - - aNewReplacePB.SetText( aNewReplaceText ); - aNewReplacePB.Enable( bEnableNewReplace && !IsDicReadonly_Impl() ); - aDeletePB .Enable( bEnableDelete && !IsDicReadonly_Impl() ); - - return 0; -} - -//========================================================= -//SvxDictEdit -//========================================================= -void SvxDictEdit::KeyInput( const KeyEvent& rKEvt ) -{ - const KeyCode aKeyCode = rKEvt.GetKeyCode(); - const sal_uInt16 nModifier = aKeyCode.GetModifier(); - if( aKeyCode.GetCode() == KEY_RETURN ) - { - //wird bei Enter nichts getan, dann doch die Basisklasse rufen - // um den Dialog zu schliessen - if(!nModifier && !aActionLink.Call(this)) - Edit::KeyInput(rKEvt); - } - else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) - Edit::KeyInput(rKEvt); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optdict.hrc b/cui/source/options/optdict.hrc deleted file mode 100644 index e2f7bb1d5..000000000 --- a/cui/source/options/optdict.hrc +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTDICT_HRC -#define _SVX_OPTDICT_HRC - -// defines ------------------------------------------------------------------ - -#define FT_DICTNAME 10 -#define ED_DICTNAME 11 -#define FT_DICTLANG 12 -#define LB_DICTLANG 13 -#define BTN_EXCEPT 14 -#define GB_NEWDICT 15 - -#define BTN_NEWDICT_OK 20 -#define BTN_NEWDICT_ESC 21 -#define BTN_NEWDICT_HLP 22 - -#define FT_BOOK 30 -#define FT_CONTENT 31 -#define LB_ALLDICTS 32 -#define GB_EDITDICTS 34 -#define FT_WORD 35 -#define ED_WORD 36 -#define FT_REPLACE 37 -#define ED_REPLACE 38 -#define PB_NEW_REPLACE 39 -#define PB_DELETE_REPLACE 40 -#define TLB_REPLACE 41 -#define STR_MODIFY 42 - -#define BTN_EDITCLOSE 50 -#define BTN_EDITNEW 51 -#define BTN_EDITCHANGE 52 -#define BTN_EDITREMOVE 53 -#define BTN_EDITHELP 54 - - - -#endif - diff --git a/cui/source/options/optdict.src b/cui/source/options/optdict.src deleted file mode 100644 index 209196f33..000000000 --- a/cui/source/options/optdict.src +++ /dev/null @@ -1,276 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include -#include "optdict.hrc" - // pragma ---------------------------------------------------------------- - - // RID_SFXDLG_NEWDICT ---------------------------------------------------- -ModalDialog RID_SFXDLG_NEWDICT -{ - HelpId = HID_OPTIONS_DICT_NEW ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 213 , 66 ) ; - Moveable = TRUE ; - Text [ en-US ] = "New Dictionary" ; - FixedText FT_DICTNAME - { - Pos = MAP_APPFONT ( 11 , 15 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "~Name" ; - LeftLabel = TRUE ; - }; - Edit ED_DICTNAME - { - HelpID = "cui:Edit:RID_SFXDLG_NEWDICT:ED_DICTNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 14 ) ; - Size = MAP_APPFONT ( 90 , 12 ) ; - MaxTextLength = 32 ; - }; - FixedText FT_DICTLANG - { - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "~Language" ; - LeftLabel = TRUE ; - }; - ListBox LB_DICTLANG - { - HelpID = "cui:ListBox:RID_SFXDLG_NEWDICT:LB_DICTLANG"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 30 ) ; - Size = MAP_APPFONT ( 90 , 66 ) ; - DropDown = TRUE ; - }; - CheckBox BTN_EXCEPT - { - HelpID = "cui:CheckBox:RID_SFXDLG_NEWDICT:BTN_EXCEPT"; - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "~Exception (-)" ; - }; - FixedLine GB_NEWDICT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 145 , 8 ) ; - Text [ en-US ] = "Dictionary" ; - }; - OKButton BTN_NEWDICT_OK - { - Pos = MAP_APPFONT ( 157 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_NEWDICT_ESC - { - Pos = MAP_APPFONT ( 157 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_NEWDICT_HLP - { - Pos = MAP_APPFONT ( 157 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - - // RID_SFXDLG_EDITDICT --------------------------------------------------- -ModalDialog RID_SFXDLG_EDITDICT -{ - HelpId = HID_OPTIONS_DICT_EDIT ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 270, 161 ); - - Text [ en-US ] = "Edit Custom Dictionary" ; - - Moveable = TRUE ; - FixedText FT_BOOK - { - Pos = MAP_APPFONT ( 12 , 10 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "~Book" ; - }; - ListBox LB_ALLDICTS - { - HelpID = "cui:ListBox:RID_SFXDLG_EDITDICT:LB_ALLDICTS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 9 ) ; - Size = MAP_APPFONT ( 121 , 62 ) ; - DropDown = TRUE ; - }; - FixedText FT_DICTLANG - { - Pos = MAP_APPFONT ( 12 , 26 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "~Language" ; - }; - ListBox LB_DICTLANG - { - HelpID = "cui:ListBox:RID_SFXDLG_EDITDICT:LB_DICTLANG"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 25 ) ; - Size = MAP_APPFONT ( 121 , 66 ) ; - DropDown = TRUE ; - }; - - FixedLine GB_EDITDICTS - { - Pos = MAP_APPFONT( 1, 1 ); - Size = MAP_APPFONT( 268, 138 ); - Hide=TRUE; - }; - - FixedText FT_WORD - { - Pos = MAP_APPFONT ( 13 , 46 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Word"; - }; - Edit ED_WORD - { - HelpID = "cui:Edit:RID_SFXDLG_EDITDICT:ED_WORD"; - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 71 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_REPLACE - { - Pos = MAP_APPFONT ( 84 , 46 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Replace ~By:"; - }; - - Edit ED_REPLACE - { - HelpID = "cui:Edit:RID_SFXDLG_EDITDICT:ED_REPLACE"; - Pos = MAP_APPFONT ( 83 , 56 ) ; - Size = MAP_APPFONT ( 120 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - - PushButton PB_NEW_REPLACE - { - HelpID = "cui:PushButton:RID_SFXDLG_EDITDICT:PB_NEW_REPLACE"; - Pos = MAP_APPFONT ( 209 , 56 ) ; - Size = MAP_APPFONT ( 55 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~New" ; - }; - PushButton PB_DELETE_REPLACE - { - HelpID = "cui:PushButton:RID_SFXDLG_EDITDICT:PB_DELETE_REPLACE"; - Pos = MAP_APPFONT ( 209 , 71 ) ; - Size = MAP_APPFONT ( 55 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - Control TLB_REPLACE - { - HelpId = HID_OPTIONS_DICT_EDIT_ENTRIES_LIST; - Pos = MAP_APPFONT ( 12 , 71 ) ; - Size = MAP_APPFONT ( 191 , 58 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - String STR_MODIFY - { - Text [ en-US ] = "~Replace" ; - }; - - - - HelpButton BTN_EDITHELP - { - Pos = MAP_APPFONT( 145, 143 ); - Size = MAP_APPFONT( 55, 14 ); - }; - - CancelButton BTN_EDITCLOSE - { - Pos = MAP_APPFONT ( 209 , 143 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - - Text [ en-US ] = "~Close" ; - }; -}; - - // Strings --------------------------------------------------------------- -String RID_SVXSTR_OPT_DOUBLE_DICTS -{ - Text [ en-US ] = "The specified name already exists.\nPlease enter a new name." ; -}; - // RID_SFXQB_SET_LANGUAGE ------------------------------------------------ -QueryBox RID_SFXQB_SET_LANGUAGE -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Do you want to change the '%1' dictionary language?" ; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx deleted file mode 100644 index c2c209453..000000000 --- a/cui/source/options/optfltr.cxx +++ /dev/null @@ -1,430 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include "optfltr.hxx" -#include "optfltr.hrc" -#include -#include "helpid.hrc" -#include - -enum MSFltrPg2_CheckBoxEntries { - Math, - Writer, - Calc, - Impress, - InvalidCBEntry -}; - -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 - -// ----------------------------------------------------------------------- - -OfaMSFilterTabPage::OfaMSFilterTabPage(Window* pParent, const SfxItemSet& rSet) - : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT ), rSet ), - aMSWordGB ( this, CUI_RES( GB_WORD ) ), - aWBasicCodeCB ( this, CUI_RES( CB_WBAS_CODE ) ), - aWBasicWbctblCB ( this, CUI_RES( CB_WBAS_WBCTBL ) ), - aWBasicStgCB ( this, CUI_RES( CB_WBAS_STG ) ), - aMSExcelGB ( this, CUI_RES( GB_EXCEL ) ), - aEBasicCodeCB ( this, CUI_RES( CB_EBAS_CODE ) ), - aEBasicExectblCB( this, CUI_RES( CB_EBAS_EXECTBL ) ), - aEBasicStgCB ( this, CUI_RES( CB_EBAS_STG ) ), - aMSPPointGB ( this, CUI_RES( GB_PPOINT ) ), - aPBasicCodeCB ( this, CUI_RES( CB_PBAS_CODE ) ), - aPBasicStgCB ( this, CUI_RES( CB_PBAS_STG ) ) -{ - FreeResource(); - - aWBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl ) ); - aEBasicCodeCB.SetClickHdl( LINK( this, OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl ) ); -} - -OfaMSFilterTabPage::~OfaMSFilterTabPage() -{ -} - -IMPL_LINK( OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, CheckBox*, EMPTYARG ) -{ - aWBasicWbctblCB.Enable( aWBasicCodeCB.IsChecked() ); - return 0; -} - -IMPL_LINK( OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, CheckBox*, EMPTYARG ) -{ - aEBasicExectblCB.Enable( aEBasicCodeCB.IsChecked() ); - return 0; -} - -SfxTabPage* OfaMSFilterTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return new OfaMSFilterTabPage( pParent, rAttrSet ); -} - -sal_Bool OfaMSFilterTabPage::FillItemSet( SfxItemSet& ) -{ - SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - - sal_Bool bFlag; - if( aWBasicCodeCB.GetSavedValue() != (bFlag = aWBasicCodeCB.IsChecked())) - pOpt->SetLoadWordBasicCode( bFlag ); - if( aWBasicWbctblCB.GetSavedValue() != (bFlag = aWBasicWbctblCB.IsChecked())) - pOpt->SetLoadWordBasicExecutable( bFlag ); - if( aWBasicStgCB.GetSavedValue() != (bFlag = aWBasicStgCB.IsChecked())) - pOpt->SetLoadWordBasicStorage( bFlag ); - - if( aEBasicCodeCB.GetSavedValue() != (bFlag = aEBasicCodeCB.IsChecked())) - pOpt->SetLoadExcelBasicCode( bFlag ); - if( aEBasicExectblCB.GetSavedValue() != (bFlag = aEBasicExectblCB.IsChecked())) - pOpt->SetLoadExcelBasicExecutable( bFlag ); - if( aEBasicStgCB.GetSavedValue() != (bFlag = aEBasicStgCB.IsChecked())) - pOpt->SetLoadExcelBasicStorage( bFlag ); - - if( aPBasicCodeCB.GetSavedValue() != (bFlag = aPBasicCodeCB.IsChecked())) - pOpt->SetLoadPPointBasicCode( bFlag ); - if( aPBasicStgCB.GetSavedValue() != (bFlag = aPBasicStgCB.IsChecked())) - pOpt->SetLoadPPointBasicStorage( bFlag ); - - return sal_False; -} - -void OfaMSFilterTabPage::Reset( const SfxItemSet& ) -{ - SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - - aWBasicCodeCB.Check( pOpt->IsLoadWordBasicCode() ); - aWBasicCodeCB.SaveValue(); - aWBasicWbctblCB.Check( pOpt->IsLoadWordBasicExecutable() ); - aWBasicWbctblCB.SaveValue(); - aWBasicStgCB.Check( pOpt->IsLoadWordBasicStorage() ); - aWBasicStgCB.SaveValue(); - LoadWordBasicCheckHdl_Impl( &aWBasicCodeCB ); - - aEBasicCodeCB.Check( pOpt->IsLoadExcelBasicCode() ); - aEBasicCodeCB.SaveValue(); - aEBasicExectblCB.Check( pOpt->IsLoadExcelBasicExecutable() ); - aEBasicExectblCB.SaveValue(); - aEBasicStgCB.Check( pOpt->IsLoadExcelBasicStorage() ); - aEBasicStgCB.SaveValue(); - LoadExcelBasicCheckHdl_Impl( &aEBasicCodeCB ); - - aPBasicCodeCB.Check( pOpt->IsLoadPPointBasicCode() ); - aPBasicCodeCB.SaveValue(); - aPBasicStgCB.Check( pOpt->IsLoadPPointBasicStorage() ); - aPBasicStgCB.SaveValue(); - -} - -OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_MSFILTEROPT2 ), rSet ), - m_aCheckLBContainer(this, CUI_RES( CLB_SETTINGS)), - aCheckLB(m_aCheckLBContainer), - aHeader1FT ( this, CUI_RES( FT_HEADER1_EXPLANATION )), - aHeader2FT ( this, CUI_RES( FT_HEADER2_EXPLANATION )), - sHeader1 ( CUI_RES( ST_HEADER1 )), - sHeader2 ( CUI_RES( ST_HEADER2 )), - sChgToFromMath ( CUI_RES( ST_CHG_MATH )), - sChgToFromWriter ( CUI_RES( ST_CHG_WRITER )), - sChgToFromCalc ( CUI_RES( ST_CHG_CALC )), - sChgToFromImpress ( CUI_RES( ST_CHG_IMPRESS )), - pCheckButtonData(0) -{ - FreeResource(); - - static long aStaticTabs[] = { 3, 0, 20, 40 }; - aCheckLB.SvxSimpleTable::SetTabs( aStaticTabs ); - - String sHeader( sHeader1 ); - (( sHeader += '\t' ) += sHeader2 ) += '\t'; - aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, - HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED ); - - aCheckLB.SetHelpId( HID_OFAPAGE_MSFLTR2_CLB ); - aCheckLB.SetStyle( aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL ); -} - -OfaMSFilterTabPage2::~OfaMSFilterTabPage2() -{ - delete pCheckButtonData; -} - -SfxTabPage* OfaMSFilterTabPage2::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return new OfaMSFilterTabPage2( pParent, rAttrSet ); -} - -sal_Bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet& ) -{ - SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - - static struct ChkCBoxEntries{ - MSFltrPg2_CheckBoxEntries eType; - sal_Bool (SvtFilterOptions:: *FnIs)() const; - void (SvtFilterOptions:: *FnSet)( sal_Bool bFlag ); - } aChkArr[] = { - { Math, &SvtFilterOptions::IsMathType2Math, - &SvtFilterOptions::SetMathType2Math }, - { Math, &SvtFilterOptions::IsMath2MathType, - &SvtFilterOptions::SetMath2MathType }, - { Writer, &SvtFilterOptions::IsWinWord2Writer, - &SvtFilterOptions::SetWinWord2Writer }, - { Writer, &SvtFilterOptions::IsWriter2WinWord, - &SvtFilterOptions::SetWriter2WinWord }, - { Calc, &SvtFilterOptions::IsExcel2Calc, - &SvtFilterOptions::SetExcel2Calc }, - { Calc, &SvtFilterOptions::IsCalc2Excel, - &SvtFilterOptions::SetCalc2Excel }, - { Impress, &SvtFilterOptions::IsPowerPoint2Impress, - &SvtFilterOptions::SetPowerPoint2Impress }, - { Impress, &SvtFilterOptions::IsImpress2PowerPoint, - &SvtFilterOptions::SetImpress2PowerPoint }, - { InvalidCBEntry, 0, 0 } - }; - - sal_Bool bCheck, bFirst = sal_True; - for( const ChkCBoxEntries* pArr = aChkArr; - InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst ) - { - sal_uInt16 nCol = bFirst ? 1 : 2; - SvLBoxEntry* pEntry = GetEntry4Type( pArr->eType ); - if( pEntry ) - { - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol )); - if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON ) - { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); - bCheck = SV_BUTTON_CHECKED == - pCheckButtonData->ConvertToButtonState( nButtonFlags ); - - if( bCheck != (pOpt->*pArr->FnIs)() ) - (pOpt->*pArr->FnSet)( bCheck ); - } - } - } - - return sal_True; -} - -void OfaMSFilterTabPage2::Reset( const SfxItemSet& ) -{ - SvtFilterOptions* pOpt = SvtFilterOptions::Get(); - - aCheckLB.SetUpdateMode(sal_False); - aCheckLB.Clear(); - - SvtModuleOptions aModuleOpt; - - // int the same sequence as the enums of MSFltrPg2_CheckBoxEntries - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) ) - InsertEntry( sChgToFromMath, static_cast< sal_IntPtr >( Math ) ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - InsertEntry( sChgToFromWriter, static_cast< sal_IntPtr >( Writer ) ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) ); - - static struct ChkCBoxEntries{ - MSFltrPg2_CheckBoxEntries eType; - sal_Bool (SvtFilterOptions:: *FnIs)() const; - } aChkArr[] = { - { Math, &SvtFilterOptions::IsMathType2Math }, - { Math, &SvtFilterOptions::IsMath2MathType }, - { Writer, &SvtFilterOptions::IsWinWord2Writer }, - { Writer, &SvtFilterOptions::IsWriter2WinWord }, - { Calc, &SvtFilterOptions::IsExcel2Calc }, - { Calc, &SvtFilterOptions::IsCalc2Excel }, - { Impress, &SvtFilterOptions::IsPowerPoint2Impress }, - { Impress, &SvtFilterOptions::IsImpress2PowerPoint }, - { InvalidCBEntry, NULL } - }; - - sal_Bool bFirst = sal_True; - for( const ChkCBoxEntries* pArr = aChkArr; - InvalidCBEntry != pArr->eType; ++pArr, bFirst = !bFirst ) - { - sal_uInt16 nCol = bFirst ? 1 : 2; - SvLBoxEntry* pEntry = GetEntry4Type( static_cast< sal_IntPtr >( pArr->eType ) ); - if( pEntry ) - { - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem( nCol )); - if( pItem && ((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON ) - { - if( (pOpt->*pArr->FnIs)() ) - pItem->SetStateChecked(); - else - pItem->SetStateUnchecked(); - aCheckLB.InvalidateEntry( pEntry ); - } - } - } - aCheckLB.SetUpdateMode( sal_True ); -} - -void OfaMSFilterTabPage2::InsertEntry( const String& _rTxt, sal_IntPtr _nType ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if( !pCheckButtonData ) - pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); - - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, - 0, pCheckButtonData ) ); - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, - 0, pCheckButtonData ) ); - pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) ); - - pEntry->SetUserData( (void*)_nType ); - aCheckLB.Insert( pEntry ); -} - -SvLBoxEntry* OfaMSFilterTabPage2::GetEntry4Type( sal_IntPtr _nType ) const -{ - SvLBoxEntry* pEntry = aCheckLB.First(); - while ( pEntry ) - { - if ( _nType == sal_IntPtr( pEntry->GetUserData() ) ) - return pEntry; - pEntry = aCheckLB.Next( pEntry ); - } - return NULL; -} - -void OfaMSFilterTabPage2::MSFltrSimpleTable::SetTabs() -{ - SvxSimpleTable::SetTabs(); - sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; - - if( aTabs.Count() > 1 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } - if( aTabs.Count() > 2 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } -} - -void OfaMSFilterTabPage2::MSFltrSimpleTable::HBarClick() -{ - // Sortierung durch diese Ueberladung abgeklemmt -} - -void OfaMSFilterTabPage2::MSFltrSimpleTable::SetCheckButtonState( - SvLBoxEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) -{ - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - switch( eState ) - { - case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); - break; - - case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); - break; - - case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); - break; - } - InvalidateEntry( pEntry ); - } -} - -SvButtonState OfaMSFilterTabPage2::MSFltrSimpleTable::GetCheckButtonState( - SvLBoxEntry* pEntry, sal_uInt16 nCol ) const -{ - SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); - - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); - eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); - } - - return eState; -} - -void OfaMSFilterTabPage2::MSFltrSimpleTable::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked) -{ - if ( nPos < GetEntryCount() ) - SetCheckButtonState( - GetEntry(nPos), - nCol, - bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : - SvButtonState( SV_BUTTON_UNCHECKED ) ); -} - -void OfaMSFilterTabPage2::MSFltrSimpleTable::KeyInput( const KeyEvent& rKEvt ) -{ - if(!rKEvt.GetKeyCode().GetModifier() && - KEY_SPACE == rKEvt.GetKeyCode().GetCode()) - { - sal_uLong nSelPos = GetModel()->GetAbsPos(GetCurEntry()); - sal_uInt16 nCol = GetCurrentTabPos() - 1; - if ( nCol < 2 ) - { - SvLBoxEntry* pEntry = GetEntry( nSelPos ); - sal_Bool bIsChecked = ( GetCheckButtonState( pEntry, nCol ) == SV_BUTTON_CHECKED ); - CheckEntryPos( nSelPos, nCol, !bIsChecked ); - CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)pEntry ); - } - else - { - sal_uInt16 nCheck = GetCheckButtonState( GetEntry(nSelPos), 1 ) == SV_BUTTON_CHECKED ? 1 : 0; - if(GetCheckButtonState( GetEntry(nSelPos), 0 )) - nCheck += 2; - nCheck--; - nCheck &= 3; - CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); - CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); - } - } - else - SvxSimpleTable::KeyInput(rKEvt); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optfltr.hrc b/cui/source/options/optfltr.hrc deleted file mode 100644 index 40204b717..000000000 --- a/cui/source/options/optfltr.hrc +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTFLTR_HRC -#define _SVX_OPTFLTR_HRC - -// defines ------------------------------------------------------------------ - -#define GB_WORD 1 -#define GB_EXCEL 2 -#define GB_PPOINT 3 - -#define CB_WBAS_CODE 1 -#define CB_WBAS_STG 2 -#define CB_EBAS_CODE 3 -#define CB_EBAS_EXECTBL 4 -#define CB_EBAS_STG 5 -#define CB_PBAS_CODE 6 -#define CB_PBAS_STG 7 -#define CB_WBAS_WBCTBL 8 - -#define CLB_SETTINGS 1 -#define ST_CHG_MATH 1 -#define ST_CHG_WRITER 2 -#define ST_CHG_CALC 3 -#define ST_CHG_IMPRESS 4 -#define ST_HEADER1 5 -#define ST_HEADER2 6 -#define FT_HEADER1_EXPLANATION 1 -#define FT_HEADER2_EXPLANATION 2 - -#endif - diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx deleted file mode 100644 index 4371fd69e..000000000 --- a/cui/source/options/optfltr.hxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_OPTFLTR_HXX -#define _OFA_OPTFLTR_HXX - -#include -#include -#include -#include -#include - - - -class OfaMSFilterTabPage : public SfxTabPage -{ - FixedLine aMSWordGB; - CheckBox aWBasicCodeCB; - CheckBox aWBasicWbctblCB; - CheckBox aWBasicStgCB; - FixedLine aMSExcelGB; - CheckBox aEBasicCodeCB; - CheckBox aEBasicExectblCB; - CheckBox aEBasicStgCB; - FixedLine aMSPPointGB; - CheckBox aPBasicCodeCB; - CheckBox aPBasicStgCB; - - OfaMSFilterTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~OfaMSFilterTabPage(); - - DECL_LINK( LoadWordBasicCheckHdl_Impl, CheckBox* ); - DECL_LINK( LoadExcelBasicCheckHdl_Impl, CheckBox* ); -public: - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -class OfaMSFilterTabPage2 : public SfxTabPage -{ - class MSFltrSimpleTable : public SvxSimpleTable - { - using SvTreeListBox::GetCheckButtonState; - using SvTreeListBox::SetCheckButtonState; - using SvxSimpleTable::SetTabs; - - void CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked); - SvButtonState GetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol ) const; - void SetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol, SvButtonState ); - protected: - virtual void SetTabs(); - virtual void HBarClick(); - virtual void KeyInput( const KeyEvent& rKEvt ); - - public: - MSFltrSimpleTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER) - : SvxSimpleTable(rParent, nBits) - { - } - }; - - SvxSimpleTableContainer m_aCheckLBContainer; - MSFltrSimpleTable aCheckLB; - FixedText aHeader1FT, aHeader2FT; - String sHeader1, sHeader2; - String sChgToFromMath, - sChgToFromWriter, - sChgToFromCalc, - sChgToFromImpress; - SvLBoxButtonData* pCheckButtonData; - - OfaMSFilterTabPage2( Window* pParent, const SfxItemSet& rSet ); - virtual ~OfaMSFilterTabPage2(); - - void InsertEntry( const String& _rTxt, sal_IntPtr _nType ); - SvLBoxEntry* GetEntry4Type( sal_IntPtr _nType ) const; - -public: - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - - -#endif // - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src deleted file mode 100644 index ead4eed46..000000000 --- a/cui/source/options/optfltr.src +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ----------------------------------------------------------------- -#include "optfltr.hrc" -#include - // pragma ------------------------------------------------------------------ - -// RID_OFAPAGE_MSFILTEROPT ----------------------------------------------------- -TabPage RID_OFAPAGE_MSFILTEROPT -{ - HelpID = "cui:TabPage:RID_OFAPAGE_MSFILTEROPT"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - - FixedLine GB_WORD - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Microsoft Word 97/2000/XP"; - }; - CheckBox CB_WBAS_CODE - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_WBAS_CODE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Load Basic ~code"; - }; - CheckBox CB_WBAS_WBCTBL - { - Pos = MAP_APPFONT ( 22 , 28 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "E~xecutable code"; - }; - CheckBox CB_WBAS_STG - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_WBAS_STG"; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Save ~original Basic code"; - }; - - FixedLine GB_EXCEL - { - Pos = MAP_APPFONT ( 6 , 58 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Microsoft Excel 97/2000/XP"; - }; - CheckBox CB_EBAS_CODE - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_EBAS_CODE"; - Pos = MAP_APPFONT ( 12 , 69 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Lo~ad Basic code"; - }; - CheckBox CB_EBAS_EXECTBL - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_EBAS_EXECTBL"; - Pos = MAP_APPFONT ( 22 , 83 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "E~xecutable code"; - }; - CheckBox CB_EBAS_STG - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_EBAS_STG"; - Pos = MAP_APPFONT ( 12 , 97 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Sa~ve original Basic code"; - }; - - FixedLine GB_PPOINT - { - Pos = MAP_APPFONT ( 6 , 113 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Microsoft PowerPoint 97/2000/XP"; - }; - CheckBox CB_PBAS_CODE - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_PBAS_CODE"; - Pos = MAP_APPFONT ( 12 , 124 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Load Ba~sic code"; - }; - CheckBox CB_PBAS_STG - { - HelpID = "cui:CheckBox:RID_OFAPAGE_MSFILTEROPT:CB_PBAS_STG"; - Pos = MAP_APPFONT ( 12 , 138 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Sav~e original Basic code"; - }; -}; - -// RID_OFAPAGE_MSFILTEROPT2 ----------------------------------------------------- -TabPage RID_OFAPAGE_MSFILTEROPT2 -{ - HelpID = "cui:TabPage:RID_OFAPAGE_MSFILTEROPT2"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 147 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - String ST_HEADER1 - { - Text [ en-US ] = "[L]"; - }; - String ST_HEADER2 - { - Text [ en-US ] = "[S]"; - }; - FixedText FT_HEADER1_EXPLANATION - { - Pos = MAP_APPFONT ( 6 , 160 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "[L]: Load and convert the object"; - }; - FixedText FT_HEADER2_EXPLANATION - { - Pos = MAP_APPFONT ( 6 , 171 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "[S]: Convert and save the object"; - }; - String ST_CHG_MATH - { - Text [ en-US ] = "MathType to %PRODUCTNAME Math or reverse"; - }; - String ST_CHG_WRITER - { - Text [ en-US ] = "WinWord to %PRODUCTNAME Writer or reverse"; - }; - String ST_CHG_CALC - { - Text [ en-US ] = "Excel to %PRODUCTNAME Calc or reverse"; - }; - String ST_CHG_IMPRESS - { - Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress or reverse"; - }; -}; - - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx deleted file mode 100644 index 018049c40..000000000 --- a/cui/source/options/optgdlg.cxx +++ /dev/null @@ -1,1931 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuioptgenrl.hxx" -#include "optpath.hxx" -#include "optsave.hxx" -#include "optlingu.hxx" -#include -#include -#include "cuitabarea.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "optgdlg.hrc" -#include "optgdlg.hxx" -#include -#include -#include - -#define CONFIG_LANGUAGES "OfficeLanguages" - -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::util; -using namespace ::utl; -using ::rtl::OString; -using ::rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -#define MAX_PROGRAM_ENTRIES 3 - -// class OfaMiscTabPage -------------------------------------------------- - -int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ ) -{ - if ( pSet_ ) - FillItemSet( *pSet_ ); - return LEAVE_PAGE; -} - -namespace -{ - ::rtl::OUString impl_SystemFileOpenServiceName() - { - const ::rtl::OUString &rDesktopEnvironment = - Application::GetDesktopEnvironment(); - - if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) ) - { - #ifdef ENABLE_GTK - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.GtkFilePicker") ); - #else - return rtl::OUString(); - #endif - } - else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) - { - #ifdef ENABLE_KDE4 - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker") ); - #else - return rtl::OUString(); - #endif - } - else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) - { - #ifdef ENABLE_KDE - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDEFilePicker") ); - #else - return rtl::OUString(); - #endif - } - #if defined WNT - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.SystemFilePicker") ); - #elif (defined MACOSX && defined QUARTZ) - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.AquaFilePicker") ); - #else - return rtl::OUString(); - #endif - } - - sal_Bool lcl_HasSystemFilePicker() - { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - sal_Bool bRet = sal_False; - - Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY ); - Reference< XSet > xSet( xFactory, UNO_QUERY ); - - if ( ! xEnumAccess.is() || ! xSet.is() ) - return bRet; - - try - { - ::rtl::OUString aFileService = impl_SystemFileOpenServiceName(); - Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService ); - if ( xEnum.is() && xEnum->hasMoreElements() ) - bRet = sal_True; - } - catch (const IllegalArgumentException&) - { - } - catch (const ElementExistException&) - { - } - return bRet; - } -} - -// ----------------------------------------------------------------------- - -OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( OFA_TP_MISC ), rSet ), - - aHelpFL ( this, CUI_RES( FL_HELP ) ), - aToolTipsCB ( this, CUI_RES( CB_TOOLTIP ) ), - aExtHelpCB ( this, CUI_RES( CB_EXTHELP ) ), - aHelpAgentCB ( this, CUI_RES( CB_HELPAGENT ) ), - aHelpAgentResetBtn ( this, CUI_RES( PB_HELPAGENT_RESET ) ), - aHelpFormatFT ( this, CUI_RES( FT_HELPFORMAT ) ), - aHelpFormatLB ( this, CUI_RES( LB_HELPFORMAT ) ), - aFileDlgFL ( this, CUI_RES( FL_FILEDLG ) ), - aFileDlgROImage ( this, CUI_RES( FI_FILEDLG_RO ) ), - aFileDlgCB ( this, CUI_RES( CB_FILEDLG ) ), - aODMADlgCB ( this, CUI_RES( CB_ODMADLG ) ), - aPrintDlgFL ( this, CUI_RES( FL_PRINTDLG ) ), - aPrintDlgCB ( this, CUI_RES( CB_PRINTDLG ) ), - aDocStatusFL ( this, CUI_RES( FL_DOCSTATUS ) ), - aDocStatusCB ( this, CUI_RES( CB_DOCSTATUS ) ), - aSaveAlwaysCB ( this, CUI_RES( CB_SAVE_ALWAYS ) ), - aTwoFigureFL ( this, CUI_RES( FL_TWOFIGURE ) ), - aInterpretFT ( this, CUI_RES( FT_INTERPRET ) ), - aYearValueField ( this, CUI_RES( NF_YEARVALUE ) ), - aToYearFT ( this, CUI_RES( FT_TOYEAR ) ), - aExperimentalCB ( this, CUI_RES( CB_EXPERIMENTAL ) ) -{ - FreeResource(); - -#if !defined(ENABLE_HELP_FORMATTING) - aHelpFormatFT.Hide(); - aHelpFormatLB.Hide(); -#endif - - if (!lcl_HasSystemFilePicker()) - { - aFileDlgFL.Hide(); - aFileDlgCB.Hide(); - } - -#if !defined(QUARTZ) - aPrintDlgFL.Hide(); - aPrintDlgCB.Hide(); -#endif - -#ifdef WNT - aFileDlgCB.SetToggleHdl( LINK( this, OfaMiscTabPage, OnFileDlgToggled ) ); -#else - aODMADlgCB.Hide(); -#endif - - if (!aODMADlgCB.IsVisible()) - { - // rearrange the following controls - Point aNewPos = aPrintDlgFL.GetPosPixel(); - long nDelta = aNewPos.Y() - aODMADlgCB.GetPosPixel().Y(); - - Window* pWins[] = - { - &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB, - &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB - }; - Window** pCurrent = pWins; - const sal_Int32 nCount = SAL_N_ELEMENTS( pWins ); - for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent ) - { - aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } - } - - if ( !aFileDlgCB.IsVisible() ) - { - // rearrange the following controls - Point aNewPos = aPrintDlgFL.GetPosPixel(); - long nDelta = aNewPos.Y() - aFileDlgFL.GetPosPixel().Y(); - - Window* pWins[] = - { - &aPrintDlgFL, &aPrintDlgCB, &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB, - &aTwoFigureFL, &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB - }; - Window** pCurrent = pWins; - const sal_Int32 nCount = SAL_N_ELEMENTS( pWins ); - for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent ) - { - aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } - } - else if ( SvtMiscOptions().IsUseSystemFileDialogReadOnly() ) - { - aFileDlgROImage.Show(); - aFileDlgCB.Disable(); - } - - if ( !aPrintDlgCB.IsVisible() ) - { - // rearrange the following controls - Point aNewPos = aDocStatusFL.GetPosPixel(); - long nDelta = aNewPos.Y() - aPrintDlgFL.GetPosPixel().Y(); - - Window* pWins[] = - { - &aDocStatusFL, &aDocStatusCB, &aSaveAlwaysCB, &aTwoFigureFL, - &aInterpretFT, &aYearValueField, &aToYearFT, &aExperimentalCB - }; - Window** pCurrent = pWins; - const sal_Int32 nCount = SAL_N_ELEMENTS( pWins ); - for ( sal_Int32 i = 0; i < nCount; ++i, ++pCurrent ) - { - aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } - } - - // at least the button is as wide as its text - long nTxtWidth = aHelpAgentResetBtn.GetTextWidth( aHelpAgentResetBtn.GetText() ); - Size aBtnSz = aHelpAgentResetBtn.GetSizePixel(); - if ( aBtnSz.Width() < nTxtWidth ) - { - aBtnSz.Width() = nTxtWidth; - aHelpAgentResetBtn.SetSizePixel( aBtnSz ); - } - - aStrDateInfo = aToYearFT.GetText(); - aYearValueField.SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) ); - Link aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl ); - aYearValueField.SetDownHdl( aLink ); - aYearValueField.SetUpHdl( aLink ); - aYearValueField.SetLoseFocusHdl( aLink ); - aYearValueField.SetFirstHdl( aLink ); - TwoFigureConfigHdl( &aYearValueField ); - - SetExchangeSupport(); - - aLink = LINK( this, OfaMiscTabPage, HelpCheckHdl_Impl ); - aToolTipsCB.SetClickHdl( aLink ); - aHelpAgentCB.SetClickHdl( aLink ); - aHelpAgentResetBtn.SetClickHdl( LINK( this, OfaMiscTabPage, HelpAgentResetHdl_Impl ) ); - - //fill default names as user data - static const char* aHelpFormatNames[] = - { - "Default", - "HighContrast1", - "HighContrast2", - "HighContrastBlack", - "HighContrastWhite" - }; - - for ( sal_uInt16 i = 0; i < aHelpFormatLB.GetEntryCount(); i++ ) - { - String* pData = new String( String::CreateFromAscii( aHelpFormatNames[i] ) ); - aHelpFormatLB.SetEntryData( i, pData ); - } -} - -#ifdef WNT -IMPL_LINK( OfaMiscTabPage, OnFileDlgToggled, CheckBox*, EMPTYARG ) -{ - aODMADlgCB.Enable( !aFileDlgCB.IsChecked() ); - return 0; -} -#endif - -// ----------------------------------------------------------------------- - -OfaMiscTabPage::~OfaMiscTabPage() -{ - for(sal_uInt16 i = 0; i < aHelpFormatLB.GetEntryCount(); i++) - { - delete static_cast< String* >( aHelpFormatLB.GetEntryData(i) ); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* OfaMiscTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new OfaMiscTabPage( pParent, rAttrSet ); -} - -// ----------------------------------------------------------------------- - -sal_Bool OfaMiscTabPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = sal_False; - - SvtHelpOptions aHelpOptions; - sal_Bool bChecked = aToolTipsCB.IsChecked(); - if ( bChecked != aToolTipsCB.GetSavedValue() ) - aHelpOptions.SetHelpTips( bChecked ); - bChecked = ( aExtHelpCB.IsChecked() && aToolTipsCB.IsChecked() ); - if ( bChecked != aExtHelpCB.GetSavedValue() ) - aHelpOptions.SetExtendedHelp( bChecked ); - bChecked = aHelpAgentCB.IsChecked(); - if ( bChecked != aHelpAgentCB.GetSavedValue() ) - aHelpOptions.SetHelpAgentAutoStartMode( bChecked ); - sal_uInt16 nHelpFormatPos = aHelpFormatLB.GetSelectEntryPos(); - if ( nHelpFormatPos != LISTBOX_ENTRY_NOTFOUND && - nHelpFormatPos != aHelpFormatLB.GetSavedValue() ) - { - aHelpOptions.SetHelpStyleSheet( *static_cast< String* >( aHelpFormatLB.GetEntryData( nHelpFormatPos ) ) ); - } - - if ( aFileDlgCB.IsChecked() != aFileDlgCB.GetSavedValue() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetUseSystemFileDialog( !aFileDlgCB.IsChecked() ); - bModified = sal_True; - } - - if ( aPrintDlgCB.IsChecked() != aPrintDlgCB.GetSavedValue() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetUseSystemPrintDialog( !aPrintDlgCB.IsChecked() ); - bModified = sal_True; - } - - if ( aODMADlgCB.IsChecked() != aODMADlgCB.GetSavedValue() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetTryODMADialog( aODMADlgCB.IsChecked() ); - bModified = sal_True; - } - - if ( aDocStatusCB.IsChecked() != aDocStatusCB.GetSavedValue() ) - { - SvtPrintWarningOptions aPrintOptions; - aPrintOptions.SetModifyDocumentOnPrintingAllowed( aDocStatusCB.IsChecked() ); - bModified = sal_True; - } - - if ( aSaveAlwaysCB.IsChecked() != aSaveAlwaysCB.GetSavedValue() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetSaveAlwaysAllowed( aSaveAlwaysCB.IsChecked() ); - bModified = sal_True; - } - - if ( aExperimentalCB.IsChecked() != aExperimentalCB.GetSavedValue() ) - { - SvtMiscOptions aMiscOpt; - aMiscOpt.SetExperimentalMode( aExperimentalCB.IsChecked() ); - bModified = sal_True; - } - - const SfxUInt16Item* pUInt16Item = - PTR_CAST( SfxUInt16Item, GetOldItem( rSet, SID_ATTR_YEAR2000 ) ); - sal_uInt16 nNum = (sal_uInt16)aYearValueField.GetText().ToInt32(); - if ( pUInt16Item && pUInt16Item->GetValue() != nNum ) - { - bModified = sal_True; - rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) ); - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void OfaMiscTabPage::Reset( const SfxItemSet& rSet ) -{ - SvtHelpOptions aHelpOptions; - aToolTipsCB.Check( aHelpOptions.IsHelpTips() ); - aExtHelpCB.Check( aHelpOptions.IsHelpTips() && aHelpOptions.IsExtendedHelp() ); - aHelpAgentCB.Check( aHelpOptions.IsHelpAgentAutoStartMode() ); - String sStyleSheet = aHelpOptions.GetHelpStyleSheet(); - for ( sal_uInt16 i = 0; i < aHelpFormatLB.GetEntryCount(); ++i ) - { - if ( *static_cast< String* >( aHelpFormatLB.GetEntryData(i) ) == sStyleSheet ) - { - aHelpFormatLB.SelectEntryPos(i); - break; - } - } - - aToolTipsCB.SaveValue(); - aExtHelpCB.SaveValue(); - aHelpAgentCB.SaveValue(); - aHelpFormatLB.SaveValue(); - HelpCheckHdl_Impl( &aHelpAgentCB ); - - SvtMiscOptions aMiscOpt; - aFileDlgCB.Check( !aMiscOpt.UseSystemFileDialog() ); - aFileDlgCB.SaveValue(); - aPrintDlgCB.Check( !aMiscOpt.UseSystemPrintDialog() ); - aPrintDlgCB.SaveValue(); - aSaveAlwaysCB.Check( aMiscOpt.IsSaveAlwaysAllowed() ); - aSaveAlwaysCB.SaveValue(); - aExperimentalCB.Check( aMiscOpt.IsExperimentalMode() ); - aExperimentalCB.SaveValue(); - - aODMADlgCB.Check( aMiscOpt.TryODMADialog() ); - aODMADlgCB.SaveValue(); - - SvtPrintWarningOptions aPrintOptions; - aDocStatusCB.Check(aPrintOptions.IsModifyDocumentOnPrintingAllowed()); - aDocStatusCB.SaveValue(); - - const SfxPoolItem* pItem = NULL; - if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) ) - { - aYearValueField.SetValue( ((SfxUInt16Item*)pItem)->GetValue() ); - TwoFigureConfigHdl( &aYearValueField ); - } - else - { - aYearValueField.Enable(sal_False); - aTwoFigureFL.Enable(sal_False); - aInterpretFT.Enable(sal_False); - aToYearFT.Enable(sal_False); - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( OfaMiscTabPage, TwoFigureHdl, NumericField*, pEd ) -{ - (void)pEd; - - String aOutput( aStrDateInfo ); - String aStr( aYearValueField.GetText() ); - String sSep( SvtSysLocale().GetLocaleData().getNumThousandSep() ); - xub_StrLen nIndex = 0; - while ((nIndex = aStr.Search( sSep, nIndex)) != STRING_NOTFOUND) - aStr.Erase( nIndex, sSep.Len()); - long nNum = aStr.ToInt32(); - if ( aStr.Len() != 4 || nNum < aYearValueField.GetMin() || nNum > aYearValueField.GetMax() ) - aOutput.AppendAscii("????"); - else - { - nNum += 99; - aOutput += String::CreateFromInt32( nNum ); - } - aToYearFT.SetText( aOutput ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( OfaMiscTabPage, TwoFigureConfigHdl, NumericField*, pEd ) -{ - sal_Int64 nNum = aYearValueField.GetValue(); - String aOutput( String::CreateFromInt64( nNum ) ); - aYearValueField.SetText( aOutput ); - aYearValueField.SetSelection( Selection( 0, aOutput.Len() ) ); - TwoFigureHdl( pEd ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( OfaMiscTabPage, HelpCheckHdl_Impl, CheckBox*, EMPTYARG ) -{ - aExtHelpCB.Enable( aToolTipsCB.IsChecked() ); - aHelpAgentResetBtn.Enable( aHelpAgentCB.IsChecked() ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( OfaMiscTabPage, HelpAgentResetHdl_Impl, PushButton*, EMPTYARG ) -{ - SvtHelpOptions().resetAgentIgnoreURLCounter(); - return 0; -} - -// ----------------------------------------------------------------------- - -// ------------------------------------------------------------------- -class CanvasSettings -{ -public: - CanvasSettings(); - - sal_Bool IsHardwareAccelerationEnabled() const; - sal_Bool IsHardwareAccelerationAvailable() const; - void EnabledHardwareAcceleration( sal_Bool _bEnabled ) const; - -private: - typedef std::vector< std::pair > > ServiceVector; - - Reference mxForceFlagNameAccess; - ServiceVector maAvailableImplementations; - mutable sal_Bool mbHWAccelAvailable; - mutable sal_Bool mbHWAccelChecked; -}; - -// ------------------------------------------------------------------- -CanvasSettings::CanvasSettings() : - mxForceFlagNameAccess(), - mbHWAccelAvailable(sal_False), - mbHWAccelChecked(sal_False) -{ - try - { - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - Reference xConfigProvider( - xFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), - UNO_QUERY_THROW ); - - Any propValue( - makeAny( PropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1, - makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas")) ), - PropertyState_DIRECT_VALUE ) ) ); - - mxForceFlagNameAccess.set( - xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), - Sequence( &propValue, 1 ) ), - UNO_QUERY_THROW ); - - propValue = makeAny( - PropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1, - makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Canvas/CanvasServiceList")) ), - PropertyState_DIRECT_VALUE ) ); - - Reference xNameAccess( - xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), - Sequence( &propValue, 1 ) ), UNO_QUERY_THROW ); - Reference xHierarchicalNameAccess( - xNameAccess, UNO_QUERY_THROW); - - Sequence serviceNames = xNameAccess->getElementNames(); - const OUString* pCurr = serviceNames.getConstArray(); - const OUString* const pEnd = pCurr + serviceNames.getLength(); - while( pCurr != pEnd ) - { - Reference xEntryNameAccess( - xHierarchicalNameAccess->getByHierarchicalName(*pCurr), - UNO_QUERY ); - - if( xEntryNameAccess.is() ) - { - Sequence preferredImplementations; - if( (xEntryNameAccess->getByName( OUString(RTL_CONSTASCII_USTRINGPARAM("PreferredImplementations")) ) >>= preferredImplementations) ) - maAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) ); - } - - ++pCurr; - } - } - catch (const Exception&) - { - } -} - -// ------------------------------------------------------------------- -sal_Bool CanvasSettings::IsHardwareAccelerationAvailable() const -{ - if( !mbHWAccelChecked ) - { - mbHWAccelChecked = true; - - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); - - // check whether any of the service lists has an - // implementation that presents the "HardwareAcceleration" property - ServiceVector::const_iterator aCurr=maAvailableImplementations.begin(); - const ServiceVector::const_iterator aEnd=maAvailableImplementations.end(); - while( aCurr != aEnd ) - { - const OUString* pCurrImpl = aCurr->second.getConstArray(); - const OUString* const pEndImpl = pCurrImpl + aCurr->second.getLength(); - - while( pCurrImpl != pEndImpl ) - { - try - { - Reference xPropSet( xFactory->createInstance( - pCurrImpl->trim() ), - UNO_QUERY_THROW ); - bool bHasAccel(false); - if( (xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("HardwareAcceleration"))) >>= bHasAccel) ) - if( bHasAccel ) - { - mbHWAccelAvailable = true; - return mbHWAccelAvailable; - } - } - catch (const Exception&) - { - } - - ++pCurrImpl; - } - - ++aCurr; - } - } - - return mbHWAccelAvailable; -} - -// ------------------------------------------------------------------- -sal_Bool CanvasSettings::IsHardwareAccelerationEnabled() const -{ - bool bForceLastEntry(false); - if( !mxForceFlagNameAccess.is() ) - return true; - - if( !(mxForceFlagNameAccess->getByName( OUString(RTL_CONSTASCII_USTRINGPARAM("ForceSafeServiceImpl")) ) >>= bForceLastEntry) ) - return true; - - return !bForceLastEntry; -} - -// ------------------------------------------------------------------- -void CanvasSettings::EnabledHardwareAcceleration( sal_Bool _bEnabled ) const -{ - Reference< XNameReplace > xNameReplace( - mxForceFlagNameAccess, UNO_QUERY ); - - if( !xNameReplace.is() ) - return; - - xNameReplace->replaceByName( OUString(RTL_CONSTASCII_USTRINGPARAM("ForceSafeServiceImpl")), - makeAny(!_bEnabled) ); - - Reference< XChangesBatch > xChangesBatch( - mxForceFlagNameAccess, UNO_QUERY ); - - if( !xChangesBatch.is() ) - return; - - xChangesBatch->commitChanges(); -} - -// class OfaViewTabPage -------------------------------------------------- - -OfaViewTabPage::OfaViewTabPage(Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( OFA_TP_VIEW ), rSet ), - - aUserInterfaceFL ( this, CUI_RES( FL_USERINTERFACE ) ), - aWindowSizeFT ( this, CUI_RES( FT_WINDOWSIZE ) ), - aWindowSizeMF ( this, CUI_RES( MF_WINDOWSIZE ) ), - aIconSizeStyleFT ( this, CUI_RES( FT_ICONSIZESTYLE ) ), - aIconSizeLB ( this, CUI_RES( LB_ICONSIZE ) ), - aIconStyleLB ( this, CUI_RES( LB_ICONSTYLE ) ), - m_aSystemFont (this, CUI_RES( CB_SYSTEM_FONT ) ), -#if defined( UNX ) - aFontAntiAliasing ( this, CUI_RES( CB_FONTANTIALIASING )), - aAAPointLimitLabel ( this, CUI_RES( FT_POINTLIMIT_LABEL )), - aAAPointLimit ( this, CUI_RES( NF_AA_POINTLIMIT )), - aAAPointLimitUnits ( this, CUI_RES( FT_POINTLIMIT_UNIT )), -#endif - aMenuFL ( this, CUI_RES( FL_MENU ) ), - aMenuIconsFT ( this, CUI_RES( FT_MENU_ICONS )), - aMenuIconsLB ( this, CUI_RES( LB_MENU_ICONS )), - aFontListsFL ( this, CUI_RES( FL_FONTLISTS) ), - aFontShowCB ( this, CUI_RES( CB_FONT_SHOW ) ), - aFontHistoryCB ( this, CUI_RES( CB_FONT_HISTORY ) ), - aRenderingFL ( this, CUI_RES( FL_RENDERING ) ), - aUseHardwareAccell ( this, CUI_RES( CB_USE_HARDACCELL ) ), - aUseAntiAliase ( this, CUI_RES( CB_USE_ANTIALIASE ) ), - aMouseFL ( this, CUI_RES( FL_MOUSE ) ), - aMousePosFT ( this, CUI_RES( FT_MOUSEPOS ) ), - aMousePosLB ( this, CUI_RES( LB_MOUSEPOS ) ), - aMouseMiddleFT ( this, CUI_RES( FT_MOUSEMIDDLE ) ), - aMouseMiddleLB ( this, CUI_RES( LB_MOUSEMIDDLE ) ), - - // #i97672# - maSelectionFL(this, CUI_RES(FL_SELECTION)), - maSelectionCB(this, CUI_RES(CB_SELECTION)), - maSelectionMF(this, CUI_RES(MF_SELECTION)), - - nSizeLB_InitialSelection(0), - nStyleLB_InitialSelection(0), - pAppearanceCfg(new SvtTabAppearanceCfg), - pCanvasSettings(new CanvasSettings), - mpDrawinglayerOpt(new SvtOptionsDrawinglayer) -{ -#if defined( UNX ) - aFontAntiAliasing.SetToggleHdl( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) ); - - // depending on the size of the text in aAAPointLimitLabel, we slightly re-arrange aAAPointLimit and aAAPointLimitUnits - //#110391# if the label has no mnemonic and we are in a CJK version the mnemonic "(X)" will be added which - // influences the width calculation - MnemonicGenerator aMnemonicGenerator; - String sLabel(aAAPointLimitLabel.GetText()); - aMnemonicGenerator.RegisterMnemonic( sLabel ); - aMnemonicGenerator.CreateMnemonic( sLabel ); - sLabel.EraseAllChars('~'); - - sal_Int32 nLabelWidth = aAAPointLimitLabel.GetTextWidth( sLabel ); - nLabelWidth += 3; // small gap - // pixels to move both controls to the left - Size aSize = aAAPointLimitLabel.GetSizePixel(); - sal_Int32 nMoveLeft = aSize.Width() - nLabelWidth; - // resize the first label - aSize.Width() = nLabelWidth; - aAAPointLimitLabel.SetSizePixel( aSize ); - - // move the numeric field - Point aPos( aAAPointLimit.GetPosPixel() ); - aPos.X() -= nMoveLeft; - aAAPointLimit.SetPosPixel( aPos ); - - // move (and resize) the units FixedText - aPos = ( aAAPointLimitUnits.GetPosPixel() ); - aPos.X() -= nMoveLeft; - aSize = aAAPointLimitUnits.GetSizePixel(); - aSize.Width() += nMoveLeft; - aAAPointLimitUnits.SetPosSizePixel( aPos, aSize ); -#else - // on this platform, we do not have the anti aliasing options - move the other checkboxes accordingly - // (in the resource, the coordinates are calculated for the AA options beeing present) - Control* pMiscOptions[] = - { - &aMenuFL, &aMenuIconsFT, &aMenuIconsLB, - &aFontListsFL, &aFontShowCB, &aFontHistoryCB - }; - - // temporaryly create the checkbox for the anti aliasing (we need to to determine it's pos) - CheckBox* pFontAntiAliasing = new CheckBox( this, CUI_RES( CB_FONTANTIALIASING ) ); - sal_Int32 nMoveUp = aMenuFL.GetPosPixel().Y() - pFontAntiAliasing->GetPosPixel().Y(); - DELETEZ( pFontAntiAliasing ); - - Point aPos; - for ( sal_Int32 i = 0; i < SAL_N_ELEMENTS( pMiscOptions ); ++i ) - { - aPos = pMiscOptions[i]->GetPosPixel( ); - aPos.Y() -= nMoveUp; - pMiscOptions[i]->SetPosPixel( aPos ); - } - -#endif - - // #i97672# - maSelectionCB.SetToggleHdl( LINK( this, OfaViewTabPage, OnSelectionToggled ) ); - - FreeResource(); - - if( ! Application::ValidateSystemFont() ) - { - m_aSystemFont.Check( sal_False ); - m_aSystemFont.Enable( sal_False ); - } - - const StyleSettings& aStyleSettings = Application::GetSettings().GetStyleSettings(); - - // remove non-installed icon themes - if( aIconStyleLB.GetEntryCount() == STYLE_SYMBOLS_THEMES_MAX ) - { - // do not check 0th item == auto; it is not a real theme - aIconStyleItemId[0] = 0; - sal_uLong nItem = 1; - for ( sal_uLong n=0; ++n < STYLE_SYMBOLS_THEMES_MAX; ) - { - if ( aStyleSettings.CheckSymbolStyle( n ) ) - { - // existing style => save the item id - aIconStyleItemId[n] = nItem++; - } - else - { - // non-existing style => remove item; - aIconStyleLB.RemoveEntry( nItem ); - aIconStyleItemId[n] = 0; - } - } - } - - // add real theme name to 'auto' theme, e.g. 'auto' => 'auto (classic)' - if( aIconStyleLB.GetEntryCount() > 1 ) - { - ::rtl::OUString aAutoStr( aIconStyleLB.GetEntry( 0 ) ); - - aAutoStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (") ); - - // prefer the icon style set by the desktop native widgets modules - sal_uLong nAutoStyle = aStyleSettings.GetPreferredSymbolsStyle(); - // fallback to the statically defined values - if ( nAutoStyle == STYLE_SYMBOLS_AUTO || !aIconStyleItemId[nAutoStyle] ) - nAutoStyle = aStyleSettings.GetAutoSymbolsStyle(); - if ( aIconStyleItemId[nAutoStyle] ) - aAutoStr += aIconStyleLB.GetEntry( aIconStyleItemId[nAutoStyle] ); - - aIconStyleLB.RemoveEntry( 0 ); - aIconStyleLB.InsertEntry( aAutoStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")") ), 0 ); - // separate auto and other icon themes - aIconStyleLB.SetSeparatorPos( 0 ); - } -} - -OfaViewTabPage::~OfaViewTabPage() -{ - delete mpDrawinglayerOpt; - delete pCanvasSettings; - delete pAppearanceCfg; -} - -#if defined( UNX ) -IMPL_LINK( OfaViewTabPage, OnAntialiasingToggled, void*, NOTINTERESTEDIN ) -{ - (void)NOTINTERESTEDIN; - - sal_Bool bAAEnabled = aFontAntiAliasing.IsChecked(); - - aAAPointLimitLabel.Enable( bAAEnabled ); - aAAPointLimit.Enable( bAAEnabled ); - aAAPointLimitUnits.Enable( bAAEnabled ); - - return 0L; -} -#endif - -// #i97672# -IMPL_LINK( OfaViewTabPage, OnSelectionToggled, void*, NOTINTERESTEDIN ) -{ - (void)NOTINTERESTEDIN; - const bool bSelectionEnabled(maSelectionCB.IsChecked()); - maSelectionMF.Enable(bSelectionEnabled); - return 0; -} - -SfxTabPage* OfaViewTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new OfaViewTabPage(pParent, rAttrSet); -} - -sal_Bool OfaViewTabPage::FillItemSet( SfxItemSet& ) -{ - SvtFontOptions aFontOpt; - SvtMenuOptions aMenuOpt; - SvtStartOptions aStartOpt; - - sal_Bool bModified = sal_False; - sal_Bool bMenuOptModified = sal_False; - bool bRepaintWindows(false); - - SvtMiscOptions aMiscOptions; - sal_uInt16 nSizeLB_NewSelection = aIconSizeLB.GetSelectEntryPos(); - if( nSizeLB_InitialSelection != nSizeLB_NewSelection ) - { - // from now on it's modified, even if via auto setting the same size was set as now selected in the LB - sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO; - switch( nSizeLB_NewSelection ) - { - case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break; - case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break; - case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break; - default: - OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of aIconSizeLB should not be possible!" ); - } - aMiscOptions.SetSymbolsSize( eSet ); - } - - sal_uInt16 nStyleLB_NewSelection = aIconStyleLB.GetSelectEntryPos(); - if( nStyleLB_InitialSelection != nStyleLB_NewSelection ) - { - // find the style name in the aIconStyleItemId table - // items from the non-installed icon themes were removed - for ( sal_uLong n=0; n < STYLE_SYMBOLS_THEMES_MAX; n++ ) - { - if ( aIconStyleItemId[n] == nStyleLB_NewSelection ) - { - aMiscOptions.SetSymbolsStyle( n ); - n = STYLE_SYMBOLS_THEMES_MAX; - } - } - } - - sal_Bool bAppearanceChanged = sal_False; - - - // Screen Scaling - sal_uInt16 nOldScale = pAppearanceCfg->GetScaleFactor(); - sal_uInt16 nNewScale = (sal_uInt16)aWindowSizeMF.GetValue(); - - if ( nNewScale != nOldScale ) - { - pAppearanceCfg->SetScaleFactor(nNewScale); - bAppearanceChanged = sal_True; - } - - // Mouse Snap Mode - short eOldSnap = pAppearanceCfg->GetSnapMode(); - short eNewSnap = aMousePosLB.GetSelectEntryPos(); - if(eNewSnap > 2) - eNewSnap = 2; - - if ( eNewSnap != eOldSnap ) - { - pAppearanceCfg->SetSnapMode(eNewSnap ); - bAppearanceChanged = sal_True; - } - - // Middle Mouse Button - short eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton(); - short eNewMiddleMouse = aMouseMiddleLB.GetSelectEntryPos(); - if(eNewMiddleMouse > 2) - eNewMiddleMouse = 2; - - if ( eNewMiddleMouse != eOldMiddleMouse ) - { - pAppearanceCfg->SetMiddleMouseButton( eNewMiddleMouse ); - bAppearanceChanged = sal_True; - } - -#if defined( UNX ) - if ( aFontAntiAliasing.IsChecked() != aFontAntiAliasing.GetSavedValue() ) - { - pAppearanceCfg->SetFontAntiAliasing( aFontAntiAliasing.IsChecked() ); - bAppearanceChanged = sal_True; - } - - if ( aAAPointLimit.GetValue() != aAAPointLimit.GetSavedValue().ToInt32() ) - { - pAppearanceCfg->SetFontAntialiasingMinPixelHeight( aAAPointLimit.GetValue() ); - bAppearanceChanged = sal_True; - } -#endif - - if ( aFontShowCB.IsChecked() != aFontShowCB.GetSavedValue() ) - { - aFontOpt.EnableFontWYSIWYG( aFontShowCB.IsChecked() ); - bModified = sal_True; - } - - if(aMenuIconsLB.GetSelectEntryPos() != aMenuIconsLB.GetSavedValue()) - { - aMenuOpt.SetMenuIconsState( aMenuIconsLB.GetSelectEntryPos() == 0 ? 2 : aMenuIconsLB.GetSelectEntryPos() - 1); - bModified = sal_True; - bMenuOptModified = sal_True; - bAppearanceChanged = sal_True; - } - - if ( aFontHistoryCB.IsChecked() != aFontHistoryCB.GetSavedValue() ) - { - aFontOpt.EnableFontHistory( aFontHistoryCB.IsChecked() ); - bModified = sal_True; - } - - // #i95644# if disabled, do not use value, see in ::Reset() - if(aUseHardwareAccell.IsEnabled()) - { - if(aUseHardwareAccell.IsChecked() != aUseHardwareAccell.GetSavedValue()) - { - pCanvasSettings->EnabledHardwareAcceleration(aUseHardwareAccell.IsChecked()); - bModified = sal_True; - } - } - - // #i95644# if disabled, do not use value, see in ::Reset() - if(aUseAntiAliase.IsEnabled()) - { - if(aUseAntiAliase.IsChecked() != mpDrawinglayerOpt->IsAntiAliasing()) - { - mpDrawinglayerOpt->SetAntiAliasing(aUseAntiAliase.IsChecked()); - bModified = sal_True; - bRepaintWindows = true; - } - } - - // #i97672# - if(maSelectionCB.IsEnabled()) - { - const bool bNewSelection(maSelectionCB.IsChecked()); - const sal_uInt16 nNewTransparence((sal_uInt16)maSelectionMF.GetValue()); - - if(bNewSelection != (bool)mpDrawinglayerOpt->IsTransparentSelection()) - { - mpDrawinglayerOpt->SetTransparentSelection(maSelectionCB.IsChecked()); - bModified = sal_True; - bRepaintWindows = true; - } - - // #i104150# even read the value when maSelectionMF is disabled; it may have been - // modified by enabling-modify-disabling by the user - if(nNewTransparence != mpDrawinglayerOpt->GetTransparentSelectionPercent()) - { - mpDrawinglayerOpt->SetTransparentSelectionPercent(nNewTransparence); - bModified = sal_True; - bRepaintWindows = true; - } - } - - SvtAccessibilityOptions aAccessibilityOptions; - if( aAccessibilityOptions.GetIsSystemFont() != m_aSystemFont.IsChecked() && - m_aSystemFont.IsEnabled() ) - { - aAccessibilityOptions.SetIsSystemFont( m_aSystemFont.IsChecked() ); - bModified = sal_True; - bMenuOptModified = sal_True; - } - - if( bMenuOptModified ) - { - // Set changed settings to the application instance - AllSettings aAllSettings = Application::GetSettings(); - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - if( m_aSystemFont.IsEnabled() ) - aStyleSettings.SetUseSystemUIFonts( m_aSystemFont.IsChecked() ); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::MergeSystemSettings( aAllSettings ); - Application::SetSettings(aAllSettings); - } - - if ( bAppearanceChanged ) - { - pAppearanceCfg->Commit(); - pAppearanceCfg->SetApplicationDefaults ( GetpApp() ); - } - - if(bRepaintWindows) - { - Window* pAppWindow = Application::GetFirstTopLevelWindow(); - - while(pAppWindow) - { - pAppWindow->Invalidate(); - pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); - } - } - - return bModified; -} - -void OfaViewTabPage::Reset( const SfxItemSet& ) -{ - SvtMiscOptions aMiscOptions; - - if( aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO ) - nSizeLB_InitialSelection = ( aMiscOptions.AreCurrentSymbolsLarge() )? 2 : 1; - aIconSizeLB.SelectEntryPos( nSizeLB_InitialSelection ); - aIconSizeLB.SaveValue(); - - if( aMiscOptions.GetSymbolsStyle() != STYLE_SYMBOLS_AUTO ) - nStyleLB_InitialSelection = aIconStyleItemId[aMiscOptions.GetCurrentSymbolsStyle()]; - - aIconStyleLB.SelectEntryPos( nStyleLB_InitialSelection ); - aIconStyleLB.SaveValue(); - - if( m_aSystemFont.IsEnabled() ) - { - SvtAccessibilityOptions aAccessibilityOptions; - m_aSystemFont.Check( aAccessibilityOptions.GetIsSystemFont() ); - } - - // Screen Scaling - aWindowSizeMF.SetValue ( pAppearanceCfg->GetScaleFactor() ); - // Mouse Snap - aMousePosLB.SelectEntryPos(pAppearanceCfg->GetSnapMode()); - aMousePosLB.SaveValue(); - - // Mouse Snap - aMouseMiddleLB.SelectEntryPos(pAppearanceCfg->GetMiddleMouseButton()); - aMouseMiddleLB.SaveValue(); - -#if defined( UNX ) - aFontAntiAliasing.Check( pAppearanceCfg->IsFontAntiAliasing() ); - aAAPointLimit.SetValue( pAppearanceCfg->GetFontAntialiasingMinPixelHeight() ); -#endif - - // WorkingSet - SvtFontOptions aFontOpt; - aFontShowCB.Check( aFontOpt.IsFontWYSIWYGEnabled() ); - SvtMenuOptions aMenuOpt; - aMenuIconsLB.SelectEntryPos(aMenuOpt.GetMenuIconsState() == 2 ? 0 : aMenuOpt.GetMenuIconsState() + 1); - aMenuIconsLB.SaveValue(); - aFontHistoryCB.Check( aFontOpt.IsFontHistoryEnabled() ); - - { // #i95644# HW accel (unified to disable mechanism) - if(pCanvasSettings->IsHardwareAccelerationAvailable()) - { - aUseHardwareAccell.Check(pCanvasSettings->IsHardwareAccelerationEnabled()); - } - else - { - aUseHardwareAccell.Check(false); - aUseHardwareAccell.Disable(); - } - - aUseHardwareAccell.SaveValue(); - } - - { // #i95644# AntiAliasing - if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem()) - { - aUseAntiAliase.Check(mpDrawinglayerOpt->IsAntiAliasing()); - } - else - { - aUseAntiAliase.Check(false); - aUseAntiAliase.Disable(); - } - - aUseAntiAliase.SaveValue(); - } - - { - // #i97672# Selection - // check if transparent selection is possible on this system - const bool bTransparentSelectionPossible( - !GetSettings().GetStyleSettings().GetHighContrastMode() - && supportsOperation(OutDevSupport_TransparentRect)); - - // enter values - if(bTransparentSelectionPossible) - { - maSelectionCB.Check(mpDrawinglayerOpt->IsTransparentSelection()); - } - else - { - maSelectionCB.Enable(false); - } - - maSelectionMF.SetValue(mpDrawinglayerOpt->GetTransparentSelectionPercent()); - maSelectionMF.Enable(mpDrawinglayerOpt->IsTransparentSelection() && bTransparentSelectionPossible); - } - -#if defined( UNX ) - aFontAntiAliasing.SaveValue(); - aAAPointLimit.SaveValue(); -#endif - aFontShowCB.SaveValue(); - aFontHistoryCB.SaveValue(); - -#if defined( UNX ) - LINK( this, OfaViewTabPage, OnAntialiasingToggled ).Call( NULL ); -#endif -} - -struct LanguageConfig_Impl -{ - SvtLanguageOptions aLanguageOptions; - SvtSysLocaleOptions aSysLocaleOptions; - SvtLinguConfig aLinguConfig; -}; - -static sal_Bool bLanguageCurrentDoc_Impl = sal_False; - -// some things we'll need... -static const OUString sConfigSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")); -static const OUString sAccessSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")); -static const OUString sAccessUpdSrvc(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")); -static const OUString sInstalledLocalesPath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup/Office/InstalledLocales")); -static OUString sUserLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic/General")); -//static const OUString sUserLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office/Linguistic")); -static const OUString sUserLocaleKey(RTL_CONSTASCII_USTRINGPARAM("UILocale")); -static const OUString sSystemLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.System/L10N")); -static const OUString sSystemLocaleKey(RTL_CONSTASCII_USTRINGPARAM("UILocale")); -static const OUString sOfficeLocalePath(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office/L10N")); -static const OUString sOfficeLocaleKey(RTL_CONSTASCII_USTRINGPARAM("ooLocale")); -static Sequence< OUString > seqInstalledLanguages; - -OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage( pParent, CUI_RES( OFA_TP_LANGUAGES ), rSet ), - aUILanguageGB(this, CUI_RES(FL_UI_LANG )), - aLocaleSettingFI(this, CUI_RES(FI_LOCALESETTING)), - aUserInterfaceFT(this, CUI_RES(FT_USERINTERFACE)), - aUserInterfaceLB(this, CUI_RES(LB_USERINTERFACE)), - aLocaleSettingFT(this, CUI_RES(FT_LOCALESETTING)), - aLocaleSettingLB(this, CUI_RES(LB_LOCALESETTING)), - aCurrencyFI( this, CUI_RES(FI_CURRENCY )), - aDecimalSeparatorFT(this, CUI_RES(FT_DECIMALSEPARATOR)), - aDecimalSeparatorCB(this, CUI_RES(CB_DECIMALSEPARATOR)), - aCurrencyFT( this, CUI_RES(FT_CURRENCY )), - aCurrencyLB( this, CUI_RES(LB_CURRENCY )), - aLinguLanguageGB(this, CUI_RES(FL_LINGU_LANG )), - aWesternLanguageFI(this, CUI_RES(FI_WEST_LANG )), - aWesternLanguageFT(this, CUI_RES(FT_WEST_LANG )), - aWesternLanguageLB(this, CUI_RES(LB_WEST_LANG )), - aAsianLanguageFI(this, CUI_RES(FI_ASIAN_LANG )), - aAsianLanguageFT(this, CUI_RES(FT_ASIAN_LANG )), - aAsianLanguageLB(this, CUI_RES(LB_ASIAN_LANG )), - aComplexLanguageFI(this, CUI_RES(FI_COMPLEX_LANG )), - aComplexLanguageFT(this, CUI_RES(FT_COMPLEX_LANG )), - aComplexLanguageLB(this, CUI_RES(LB_COMPLEX_LANG )), - aCurrentDocCB(this, CUI_RES(CB_CURRENT_DOC )), - aEnhancedFL(this, CUI_RES(FL_ENHANCED )), - aAsianSupportFI(this, CUI_RES(FI_ASIANSUPPORT )), - aAsianSupportCB(this, CUI_RES(CB_ASIANSUPPORT )), - aCTLSupportFI(this, CUI_RES(FI_CTLSUPPORT )), - aCTLSupportCB(this, CUI_RES(CB_CTLSUPPORT )), - sDecimalSeparatorLabel(aDecimalSeparatorCB.GetText()), - pLangConfig(new LanguageConfig_Impl) -{ - FreeResource(); - - // initialize user interface language selection - SvtLanguageTable* pLanguageTable = new SvtLanguageTable; - const String aStr( pLanguageTable->GetString( LANGUAGE_SYSTEM ) ); - - String aUILang(aStr); - aUILang += String::CreateFromAscii(" - "); - aUILang += pLanguageTable->GetString( Application::GetSettings().GetUILanguage() ); - - aUserInterfaceLB.InsertEntry(aUILang); - aUserInterfaceLB.SetEntryData(0, 0); - aUserInterfaceLB.SelectEntryPos(0); - try - { - OUString sOfficeLocaleValue; - OUString sSystemLocaleValue; - - Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > ( - theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW); - Sequence< Any > theArgs(2); - Reference< XNameAccess > theNameAccess; - - // find out which locales are currently installed and add them to the listbox - theArgs[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")), makeAny(sInstalledLocalesPath))); - theArgs[1] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("reload")), makeAny(sal_True))); - theNameAccess = Reference< XNameAccess > ( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW ); - seqInstalledLanguages = theNameAccess->getElementNames(); - LanguageType aLang = LANGUAGE_DONTKNOW; - for (sal_IntPtr i=0; iGetString( aLang ) ); - sal_uInt16 p = aUserInterfaceLB.InsertEntry(aLangStr); - aUserInterfaceLB.SetEntryData(p, (void*)(i+1)); - } - } - - // find out whether the user has a specific locale specified - Sequence< Any > theArgs2(1); - theArgs2[0] = makeAny(NamedValue(OUString(RTL_CONSTASCII_USTRINGPARAM("NodePath")), makeAny(sUserLocalePath))); - theNameAccess = Reference< XNameAccess > ( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW ); - if (theNameAccess->hasByName(sUserLocaleKey)) - theNameAccess->getByName(sUserLocaleKey) >>= m_sUserLocaleValue; - // select the user specified locale in the listbox - if (m_sUserLocaleValue.getLength() > 0) - { - sal_Int32 d = 0; - for (sal_uInt16 i=0; i < aUserInterfaceLB.GetEntryCount(); i++) - { - d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(i); - if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1].equals(m_sUserLocaleValue)) - aUserInterfaceLB.SelectEntryPos(i); - } - } - - } - catch (const Exception &e) - { - // we'll just leave the box in it's default setting and won't - // even give it event handler... - OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(aMsg.getStr()); - } - - aWesternLanguageLB.SetLanguageList( LANG_LIST_WESTERN | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True ); - aWesternLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::LATIN ); - aAsianLanguageLB.SetLanguageList( LANG_LIST_CJK | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True ); - aAsianLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::ASIAN ); - aComplexLanguageLB.SetLanguageList( LANG_LIST_CTL | LANG_LIST_ONLY_KNOWN, sal_True, sal_False, sal_True ); - aComplexLanguageLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::COMPLEX ); - - aLocaleSettingLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, sal_False, sal_False, sal_False); - aLocaleSettingLB.InsertDefaultLanguage( ::com::sun::star::i18n::ScriptType::WEAK ); - - const NfCurrencyTable& rCurrTab = SvNumberFormatter::GetTheCurrencyTable(); - const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM ); - // insert SYSTEM entry - String aDefaultCurr(aStr); - aDefaultCurr += String::CreateFromAscii(" - "); - aDefaultCurr += rCurr.GetBankSymbol(); - aCurrencyLB.InsertEntry( aDefaultCurr ); - // all currencies - String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " " ) ); - sal_uInt16 nCurrCount = rCurrTab.Count(); - // first entry is SYSTEM, skip it - for ( sal_uInt16 j=1; j < nCurrCount; ++j ) - { - const NfCurrencyEntry* pCurr = rCurrTab[j]; - String aStr_( pCurr->GetBankSymbol() ); - aStr_ += aTwoSpace; - aStr_ += pCurr->GetSymbol(); - aStr_ = ApplyLreOrRleEmbedding( aStr_ ); - aStr_ += aTwoSpace; - aStr_ += ApplyLreOrRleEmbedding( pLanguageTable->GetString( pCurr->GetLanguage() ) ); - sal_uInt16 nPos = aCurrencyLB.InsertEntry( aStr_ ); - aCurrencyLB.SetEntryData( nPos, (void*) pCurr ); - } - delete pLanguageTable; - - aLocaleSettingLB.SetSelectHdl( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) ); - Link aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) ); - aAsianSupportCB.SetClickHdl( aLink ); - aCTLSupportCB.SetClickHdl( aLink ); - - aAsianSupportCB.Check( m_bOldAsian = pLangConfig->aLanguageOptions.IsAnyEnabled() ); - aAsianSupportCB.SaveValue(); - sal_Bool bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK); - aAsianSupportCB.Enable(!bReadonly); - aAsianSupportFI.Show(bReadonly); - SupportHdl( &aAsianSupportCB ); - - aCTLSupportCB.Check( m_bOldCtl = pLangConfig->aLanguageOptions.IsCTLFontEnabled() ); - aCTLSupportCB.SaveValue(); - bReadonly = pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT); - aCTLSupportCB.Enable(!bReadonly); - aCTLSupportFI.Show(bReadonly); - SupportHdl( &aCTLSupportCB ); -} - -OfaLanguagesTabPage::~OfaLanguagesTabPage() -{ - delete pLangConfig; -} - -SfxTabPage* OfaLanguagesTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new OfaLanguagesTabPage(pParent, rAttrSet); -} - -LanguageType lcl_LangStringToLangType(const OUString& rLang) -{ - Locale aLocale; - sal_Int32 nSep = rLang.indexOf('-'); - if (nSep < 0) - aLocale.Language = rLang; - else - { - aLocale.Language = rLang.copy(0, nSep); - if (nSep < rLang.getLength()) - aLocale.Country = rLang.copy(nSep+1, rLang.getLength() - (nSep+1)); - } - LanguageType eLangType = SvxLocaleToLanguage( aLocale ); - return eLangType; -} - -void lcl_UpdateAndDelete(SfxVoidItem* pInvalidItems[], SfxBoolItem* pBoolItems[], sal_uInt16 nCount) -{ - SfxViewFrame* pCurrentFrm = SfxViewFrame::Current(); - SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst(); - while(pViewFrm) - { - SfxBindings& rBind = pViewFrm->GetBindings(); - for(sal_Int16 i = 0; i < nCount; i++) - { - if(pCurrentFrm == pViewFrm) - rBind.InvalidateAll(sal_False); - rBind.SetState( *pInvalidItems[i] ); - rBind.SetState( *pBoolItems[i] ); - } - pViewFrm = SfxViewFrame::GetNext(*pViewFrm); - } - for(sal_Int16 i = 0; i < nCount; i++) - { - delete pInvalidItems[i]; - delete pBoolItems[i] ; - } -} - -sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) -{ - // lock configuration broadcasters so that we can coordinate the notifications - pLangConfig->aSysLocaleOptions.BlockBroadcasts( sal_True ); - pLangConfig->aLanguageOptions.BlockBroadcasts( sal_True ); - pLangConfig->aLinguConfig.BlockBroadcasts( sal_True ); - - /* - * Sequence checking only matters when CTL support is enabled. - * - * So we only need to check for sequence checking if - * a) previously it was unchecked and is now checked or - * b) it was already checked but the CTL language has changed - */ - if ( - aCTLSupportCB.IsChecked() && - (aCTLSupportCB.GetSavedValue() != STATE_CHECK || - aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos()) - ) - { - //sequence checking has to be switched on depending on the selected CTL language - LanguageType eCTLLang = aComplexLanguageLB.GetSelectLanguage(); - sal_Bool bOn = MsLangId::needsSequenceChecking( eCTLLang); - pLangConfig->aLanguageOptions.SetCTLSequenceCheckingRestricted(bOn); - pLangConfig->aLanguageOptions.SetCTLSequenceChecking(bOn); - pLangConfig->aLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn); - } - try - { - // handle settings for UI Language - // a change of setting needs to bring up a warning message - OUString aLangString; - sal_Int32 d = (sal_Int32)(sal_IntPtr)aUserInterfaceLB.GetEntryData(aUserInterfaceLB.GetSelectEntryPos()); - if( d > 0 && seqInstalledLanguages.getLength() > d-1) - aLangString = seqInstalledLanguages[d-1]; - - /* - if( aUserInterfaceLB.GetSelectEntryPos() > 0) - aLangString = ConvertLanguageToIsoString(aUserInterfaceLB.GetSelectLanguage()); - */ - Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory > ( - theMSF->createInstance( sConfigSrvc ),UNO_QUERY_THROW); - Sequence< Any > theArgs(1); - theArgs[0] = makeAny(sUserLocalePath); - Reference< XPropertySet >xProp( - theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW ); - if ( !m_sUserLocaleValue.equals(aLangString)) - { - // OSL_FAIL("UserInterface language was changed, restart."); - // write new value - xProp->setPropertyValue(sUserLocaleKey, makeAny(aLangString)); - Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); - // display info - InfoBox aBox(this, CUI_RES(RID_SVX_MSGBOX_LANGUAGE_RESTART)); - aBox.Execute(); - - // tell quickstarter to stop being a veto listener - - Reference< XInitialization > xInit(theMSF->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.office.Quickstart"))), UNO_QUERY); - if (xInit.is()) - { - Sequence< Any > args(3); - args[0] = makeAny(sal_False); // will be ignored - args[1] = makeAny(sal_False); // will be ignored - args[2] = makeAny(sal_False); // disable veto - xInit->initialize(args); - } - } - } - catch (const Exception& e) - { - // we'll just leave the box in it's default setting and won't - // even give it event handler... - OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); - OSL_FAIL(aMsg.getStr()); - } - - OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString(); - LanguageType eOldLocale = (sLang.getLength() ? - lcl_LangStringToLangType( sLang ) : LANGUAGE_SYSTEM); - LanguageType eNewLocale = aLocaleSettingLB.GetSelectLanguage(); - if ( eOldLocale != eNewLocale ) - { - // an empty string denotes SYSTEM locale - OUString sNewLang; - if ( eNewLocale != LANGUAGE_SYSTEM ) - { - Locale aLocale; - SvxLanguageToLocale( aLocale, eNewLocale ); - sNewLang = aLocale.Language; - if ( aLocale.Country.getLength() > 0 ) - { - sNewLang += C2U("-"); - sNewLang += aLocale.Country; - } - } - - // locale nowadays get to AppSettings via notification - // this will happen after releasing the lock on the ConfigurationBroadcaster at - // the end of this method - pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang ); - rSet.Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, sal_True ) ); - - sal_uInt16 nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale ); - bool bNewCJK = ( nNewType & SCRIPTTYPE_ASIAN ) != 0; - SvtCompatibilityOptions aCompatOpts; - aCompatOpts.SetDefault( COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE, !bNewCJK ); - } - - if(aDecimalSeparatorCB.GetSavedValue() != aDecimalSeparatorCB.IsChecked()) - pLangConfig->aSysLocaleOptions.SetDecimalSeparatorAsLocale(aDecimalSeparatorCB.IsChecked()); - - // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default. - OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString(); - sal_uInt16 nCurrPos = aCurrencyLB.GetSelectEntryPos(); - const NfCurrencyEntry* pCurr = (const NfCurrencyEntry*) - aCurrencyLB.GetEntryData( nCurrPos ); - OUString sNewCurr; - if ( pCurr ) - sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString( - pCurr->GetBankSymbol(), pCurr->GetLanguage() ); - if ( sOldCurr != sNewCurr ) - pLangConfig->aSysLocaleOptions.SetCurrencyConfigString( sNewCurr ); - - SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current(); - Reference< XPropertySet > xLinguProp( LinguMgr::GetLinguPropertySet(), UNO_QUERY ); - sal_Bool bCurrentDocCBChecked = aCurrentDocCB.IsChecked(); - if(aCurrentDocCB.IsEnabled()) - bLanguageCurrentDoc_Impl = bCurrentDocCBChecked; - sal_Bool bCurrentDocCBChanged = bCurrentDocCBChecked != aCurrentDocCB.GetSavedValue(); - - sal_Bool bValChanged = aWesternLanguageLB.GetSavedValue() != aWesternLanguageLB.GetSelectEntryPos(); - if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged) - { - LanguageType eSelectLang = aWesternLanguageLB.GetSelectLanguage(); - if(!bCurrentDocCBChecked) - { - Any aValue; - Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); - aValue <<= aLocale; - OUString aPropName( C2U("DefaultLocale") ); - pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); - if (xLinguProp.is()) - xLinguProp->setPropertyValue( aPropName, aValue ); - } - if(pCurrentDocShell) - { - rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::LATIN), - SID_ATTR_LANGUAGE)); - } - } - bValChanged = aAsianLanguageLB.GetSavedValue() != aAsianLanguageLB.GetSelectEntryPos(); - if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged) - { - LanguageType eSelectLang = aAsianLanguageLB.GetSelectLanguage(); - if(!bCurrentDocCBChecked) - { - Any aValue; - Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); - aValue <<= aLocale; - OUString aPropName( C2U("DefaultLocale_CJK") ); - pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); - if (xLinguProp.is()) - xLinguProp->setPropertyValue( aPropName, aValue ); - } - if(pCurrentDocShell) - { - rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::ASIAN), - SID_ATTR_CHAR_CJK_LANGUAGE)); - } - } - bValChanged = aComplexLanguageLB.GetSavedValue() != aComplexLanguageLB.GetSelectEntryPos(); - if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged) - { - LanguageType eSelectLang = aComplexLanguageLB.GetSelectLanguage(); - if(!bCurrentDocCBChecked) - { - Any aValue; - Locale aLocale = MsLangId::convertLanguageToLocale( eSelectLang, false ); - aValue <<= aLocale; - OUString aPropName( C2U("DefaultLocale_CTL") ); - pLangConfig->aLinguConfig.SetProperty( aPropName, aValue ); - if (xLinguProp.is()) - xLinguProp->setPropertyValue( aPropName, aValue ); - } - if(pCurrentDocShell) - { - rSet.Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, ::com::sun::star::i18n::ScriptType::COMPLEX), - SID_ATTR_CHAR_CTL_LANGUAGE)); - } - } - - if(aAsianSupportCB.GetSavedValue() != aAsianSupportCB.IsChecked() ) - { - sal_Bool bChecked = aAsianSupportCB.IsChecked(); - pLangConfig->aLanguageOptions.SetAll(bChecked); - - //iterate over all bindings to invalidate vertical text direction - const sal_uInt16 STATE_COUNT = 2; - - SfxBoolItem* pBoolItems[STATE_COUNT]; - pBoolItems[0] = new SfxBoolItem(SID_VERTICALTEXT_STATE, sal_False); - pBoolItems[1] = new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, sal_False); - - SfxVoidItem* pInvalidItems[STATE_COUNT]; - pInvalidItems[0] = new SfxVoidItem(SID_VERTICALTEXT_STATE); - pInvalidItems[1] = new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL); - - lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT); - } - - if ( aCTLSupportCB.GetSavedValue() != aCTLSupportCB.IsChecked() ) - { - pLangConfig->aLanguageOptions.SetCTLFontEnabled( aCTLSupportCB.IsChecked() ); - - const sal_uInt16 STATE_COUNT = 1; - SfxBoolItem* pBoolItems[STATE_COUNT]; - pBoolItems[0] = new SfxBoolItem(SID_CTLFONT_STATE, sal_False); - SfxVoidItem* pInvalidItems[STATE_COUNT]; - pInvalidItems[0] = new SfxVoidItem(SID_CTLFONT_STATE); - lcl_UpdateAndDelete(pInvalidItems, pBoolItems, STATE_COUNT); - } - - if ( pLangConfig->aSysLocaleOptions.IsModified() ) - pLangConfig->aSysLocaleOptions.Commit(); - - // first release the lock on the ConfigurationBroadcaster for Locale changes - // it seems that our code relies on the fact that before other changes like e.g. currency - // are broadcasted locale changes have been done - pLangConfig->aSysLocaleOptions.BlockBroadcasts( sal_False ); - pLangConfig->aLanguageOptions.BlockBroadcasts( sal_False ); - pLangConfig->aLinguConfig.BlockBroadcasts( sal_False ); - - return sal_False; -} -//----------------------------------------------------------------------------- -void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet ) -{ - OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString(); - if ( sLang.getLength() ) - aLocaleSettingLB.SelectLanguage(lcl_LangStringToLangType(sLang)); - else - aLocaleSettingLB.SelectLanguage( LANGUAGE_SYSTEM ); - sal_Bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE); - aLocaleSettingLB.Enable(!bReadonly); - aLocaleSettingFT.Enable(!bReadonly); - aLocaleSettingFI.Show(bReadonly); - - // - aDecimalSeparatorCB.Check( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale()); - aDecimalSeparatorCB.SaveValue(); - - // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support - // #i15812# must be done *before* the configured currency is set - // and update the decimal separator used for the given locale - LocaleSettingHdl(&aLocaleSettingLB); - - // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default - String aAbbrev; - LanguageType eLang; - const NfCurrencyEntry* pCurr = NULL; - sLang = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString(); - if ( sLang.getLength() ) - { - SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sLang ); - pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang ); - } - // if pCurr==NULL the SYSTEM entry is selected - sal_uInt16 nPos = aCurrencyLB.GetEntryPos( (void*) pCurr ); - aCurrencyLB.SelectEntryPos( nPos ); - bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_CURRENCY); - aCurrencyLB.Enable(!bReadonly); - aCurrencyFT.Enable(!bReadonly); - aCurrencyFI.Show(bReadonly); - - //western/CJK/CLK language - LanguageType eCurLang = LANGUAGE_NONE; - LanguageType eCurLangCJK = LANGUAGE_NONE; - LanguageType eCurLangCTL = LANGUAGE_NONE; - SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current(); - //collect the configuration values first - aCurrentDocCB.Enable(sal_False); - // - Any aWestLang; - Any aCJKLang; - Any aCTLLang; - try - { - aWestLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale")); - Locale aLocale; - aWestLang >>= aLocale; - - eCurLang = MsLangId::convertLocaleToLanguage( aLocale ); - - aCJKLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")); - aLocale = Locale(); - aCJKLang >>= aLocale; - eCurLangCJK = MsLangId::convertLocaleToLanguage( aLocale ); - - aCTLLang = pLangConfig->aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")); - aLocale = Locale(); - aCTLLang >>= aLocale; - eCurLangCTL = MsLangId::convertLocaleToLanguage( aLocale ); - } - catch (const Exception&) - { - } - //overwrite them by the values provided by the DocShell - if(pCurrentDocShell) - { - aCurrentDocCB.Enable(sal_True); - aCurrentDocCB.Check(bLanguageCurrentDoc_Impl); - const SfxPoolItem* pLang; - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_LANGUAGE, sal_False, &pLang)) - { - LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); - if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, ::com::sun::star::i18n::ScriptType::LATIN) != eTempCurLang) - eCurLang = eTempCurLang; - } - - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pLang)) - { - LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); - if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, ::com::sun::star::i18n::ScriptType::ASIAN) != eTempCurLang) - eCurLangCJK = eTempCurLang; - } - - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pLang)) - { - LanguageType eTempCurLang = ((const SvxLanguageItem*)pLang)->GetValue(); - if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, ::com::sun::star::i18n::ScriptType::COMPLEX) != eTempCurLang) - eCurLangCTL = eTempCurLang; - } - } - if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang) - aWesternLanguageLB.SelectLanguage(LANGUAGE_NONE); - else - aWesternLanguageLB.SelectLanguage(eCurLang); - - if(LANGUAGE_NONE == eCurLangCJK || LANGUAGE_DONTKNOW == eCurLangCJK) - aAsianLanguageLB.SelectLanguage(LANGUAGE_NONE); - else - aAsianLanguageLB.SelectLanguage(eCurLangCJK); - - if(LANGUAGE_NONE == eCurLangCTL || LANGUAGE_DONTKNOW == eCurLangCTL) - aComplexLanguageLB.SelectLanguage(LANGUAGE_NONE); - else - aComplexLanguageLB.SelectLanguage(eCurLangCTL); - - aWesternLanguageLB.SaveValue(); - aAsianLanguageLB.SaveValue(); - aComplexLanguageLB.SaveValue(); - aCurrentDocCB.SaveValue(); - - sal_Bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale") ); - aWesternLanguageFT.Enable( bEnable ); - aWesternLanguageLB.Enable( bEnable ); - - - aWesternLanguageFI.Show(!bEnable); - - // #i15812# controls for CJK/CTL already enabled/disabled from LocaleSettingHdl -#if 0 - bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK") ) && aAsianSupportCB.IsChecked() ); - aAsianLanguageFT.Enable( bEnable ); - aAsianLanguageLB.Enable( bEnable ); - - bEnable = ( !pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL") ) && aCTLSupportCB.IsChecked() ); - aComplexLanguageFT.Enable( bEnable ); - aComplexLanguageLB.Enable( bEnable ); -#endif - // check the box "For the current document only" - // set the focus to the Western Language box - const SfxPoolItem* pLang = 0; - if ( SFX_ITEM_SET == rSet.GetItemState(SID_SET_DOCUMENT_LANGUAGE, sal_False, &pLang ) &&( (const SfxBoolItem*)pLang)->GetValue() == sal_True ) - { - aWesternLanguageLB.GrabFocus(); - aCurrentDocCB.Enable(sal_True); - aCurrentDocCB.Check(sal_True); - } -} - -IMPL_LINK( OfaLanguagesTabPage, SupportHdl, CheckBox*, pBox ) -{ - DBG_ASSERT( pBox, "OfaLanguagesTabPage::SupportHdl(): pBox invalid" ); - - sal_Bool bCheck = pBox->IsChecked(); - if ( &aAsianSupportCB == pBox ) - { - sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CJK")); - bCheck = ( bCheck && !bReadonly ); - aAsianLanguageFT.Enable( bCheck ); - aAsianLanguageLB.Enable( bCheck ); - aAsianLanguageFI.Show(bReadonly); - if( pBox->IsEnabled() ) - m_bOldAsian = bCheck; - } - else if ( &aCTLSupportCB == pBox ) - { - sal_Bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly( C2U("DefaultLocale_CTL")); - bCheck = ( bCheck && !bReadonly ); - aComplexLanguageFT.Enable( bCheck ); - aComplexLanguageLB.Enable( bCheck ); - aComplexLanguageFI.Show(bReadonly); - if( pBox->IsEnabled() ) - m_bOldCtl = bCheck; - } - else - { - DBG_ERRORFILE( "OfaLanguagesTabPage::SupportHdl(): wrong pBox" ); - } - - return 0; -} - -namespace -{ - void lcl_checkLanguageCheckBox(CheckBox& _rCB,sal_Bool _bNewValue,sal_Bool _bOldValue) - { - if ( _bNewValue ) - _rCB.Check(sal_True); - else - _rCB.Check( _bOldValue ); -// #i15082# do not call SaveValue() in running dialog... -// _rCB.SaveValue(); - _rCB.Enable( !_bNewValue ); - } -} - -IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox ) -{ - LanguageType eLang = pBox->GetSelectLanguage(); - sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang); - // first check if CTL must be enabled - // #103299# - if CTL font setting is not readonly - if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT)) - { - bool bIsCTLFixed = (nType & SCRIPTTYPE_COMPLEX) != 0; - lcl_checkLanguageCheckBox(aCTLSupportCB, bIsCTLFixed, m_bOldCtl); - SupportHdl( &aCTLSupportCB ); - } - // second check if CJK must be enabled - // #103299# - if CJK support is not readonly - if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK)) - { - bool bIsCJKFixed = (nType & SCRIPTTYPE_ASIAN) != 0; - lcl_checkLanguageCheckBox(aAsianSupportCB, bIsCJKFixed, m_bOldAsian); - SupportHdl( &aAsianSupportCB ); - } - - sal_uInt16 nPos; - if ( eLang == LANGUAGE_SYSTEM ) - nPos = aCurrencyLB.GetEntryPos( (void*) NULL ); - else - { - const NfCurrencyEntry* pCurr = &SvNumberFormatter::GetCurrencyEntry( eLang ); - nPos = aCurrencyLB.GetEntryPos( (void*) pCurr ); - } - aCurrencyLB.SelectEntryPos( nPos ); - - //update the decimal separator key of the related CheckBox - Locale aTempLocale; - SvxLanguageToLocale( aTempLocale, eLang ); - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale ); - String sTempLabel(sDecimalSeparatorLabel); - sTempLabel.SearchAndReplaceAscii("%1", aLocaleWrapper.getNumDecimalSep() ); - aDecimalSeparatorCB.SetText(sTempLabel); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optgdlg.hrc b/cui/source/options/optgdlg.hrc deleted file mode 100644 index 4247de3e7..000000000 --- a/cui/source/options/optgdlg.hrc +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTGDLG_HRC -#define _SVX_OPTGDLG_HRC -#include - -// defines for positions and sizes --------------------------------------- - -#define ENABLE_HELP_FORMATTING 0 - -#define WHOLE_WIDTH 248 -#define EDIT_WIDTH 30 -#define UNIT_WIDTH 40 - -#define COLSPACE RSC_SP_CTRL_DESC_X -#define COL0 6 -#define COL1 (COL0+6) -#define COL2 (COL1+10) -#define COL3 (COL2+100) -#define COL4 (COL3+COLSPACE) -#define COL5 (COL4+EDIT_WIDTH) -#define COL6 (COL5+COLSPACE) - -#define ROWSPACE RSC_SP_CTRL_DESC_Y -#define ROW0 3 -#define ROW1 (ROW0 +RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) -#if ENABLE_HELP_FORMATTING -#define ROW2 (ROW1 +RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#else -#define ROW2 (ROW1) -#endif -#define ROW3 (ROW2 +RSC_CD_DROPDOWN_HEIGHT+ROWSPACE) -#define ROW4 (ROW3 +RSC_CD_PUSHBUTTON_HEIGHT+ROWSPACE) -#define ROW5 (ROW4 +RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) -#define ROW6 (ROW5 +RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW7 (ROW6 +RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW8 (ROW7 +RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) -#define ROW9 (ROW8 +RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW10 (ROW9 +RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) -#define ROW11 (ROW10+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW12 (ROW11+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW13 (ROW12+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) -#define ROW14 (ROW13+RSC_CD_CHECKBOX_HEIGHT+ROWSPACE) -#define ROW15 (ROW14+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) - -#define DIFF(v1,v2) (v2-v1) -#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) -//#define OFFS_PUSHBUTTON_FIXEDTEXT(base) (base+(RSC_CD_PUSHBUTTON_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) - -#define ROW_MF_SCALING (13) -#define ROW_FT_ICONSIZESTYLE (ROW_MF_SCALING+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE) -#define ROW_LB_ICONSIZESTYLE (ROW_FT_ICONSIZESTYLE+RSC_CD_FIXEDTEXT_HEIGHT+ROWSPACE) -#define ROW_CB_SYSTEM_FONT (ROW_LB_ICONSIZESTYLE+RSC_CD_DROPDOWN_HEIGHT+ROWSPACE) -#define ROW_CB_FONTANTIALIASING (ROW_CB_SYSTEM_FONT+ (2 * RSC_CD_FIXEDLINE_HEIGHT) +ROWSPACE) -#define ROW_NF_AA_POINTLIMIT (ROW_CB_FONTANTIALIASING+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE) - -#define ROW_FL_MENU (ROW_NF_AA_POINTLIMIT+RSC_CD_DROPDOWN_HEIGHT+RSC_SP_FLGR_SPACE_X) -#define ROW_FT_MENU_ICONS (ROW_FL_MENU + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) -#define ROW_LB_MENU_ICONS (ROW_FT_MENU_ICONS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) - -#define ROW_FL_FONTLISTS (ROW_LB_MENU_ICONS + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_FLGR_SPACE_X) -#define ROW_CB_FONT_SHOW (ROW_FL_FONTLISTS + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) -#define ROW_CB_FONT_HISTORY (ROW_CB_FONT_SHOW + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE) - -// #i95644# start on top with rendering section -#define ROW_FL_RENDERING (3) -#define ROW_CB_USE_HARDACCELL (ROW_FL_RENDERING + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) -#define ROW_CB_USE_ANTIALIASE (ROW_CB_USE_HARDACCELL + RSC_CD_CHECKBOX_HEIGHT + ROWSPACE) - -// #i95644# set Menu to follow vertically (was (ROW_FL_MENU)) previously) -#define ROW_FL_MOUSE (ROW_CB_USE_ANTIALIASE + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_X) -#define ROW_FT_MOUSEPOS (ROW_FL_MOUSE + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) -#define ROW_LB_MOUSEPOS (ROW_FT_MOUSEPOS + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE) -#define ROW_FT_MOUSEMIDDLE (ROW_LB_MOUSEPOS + RSC_CD_DROPDOWN_HEIGHT + ROWSPACE) -#define ROW_LB_MOUSEMIDDLE (ROW_FT_MOUSEMIDDLE + RSC_CD_FIXEDTEXT_HEIGHT + ROWSPACE) - -// #i97672# -#define ROW_FL_SELECTION (ROW_LB_MOUSEMIDDLE + RSC_CD_DROPDOWN_HEIGHT + RSC_SP_FLGR_SPACE_X) -#define ROW_CB_SELECTION (ROW_FL_SELECTION + RSC_CD_FIXEDLINE_HEIGHT + ROWSPACE) - -// tabpage general ------------------------------------------------------- - -#define FL_HELP 10 -#define CB_TOOLTIP 11 -#define CB_EXTHELP 12 -#define CB_HELPAGENT 13 -#define PB_HELPAGENT_RESET 14 -#define FT_HELPFORMAT 15 -#define LB_HELPFORMAT 16 -#define FT_EXPERIMENTAL 17 -#define CB_EXPERIMENTAL 18 - -//#define FL_FILEDLG 20 -//#define CB_FILEDLG 21 - -//#define FL_DOCSTATUS 30 -//#define CB_DOCSTATUS 31 - -#define FL_TWOFIGURE 40 -#define FT_INTERPRET 41 -#define NF_YEARVALUE 42 -#define FT_TOYEAR 43 -#define FL_PRINTDLG 44 -#define CB_PRINTDLG 45 - -// tabpage view ---------------------------------------------------------- -// #i95644# 10 .. 14 freed, may be reused - -#define FL_USERINTERFACE 20 -#define FT_WINDOWSIZE 21 -#define MF_WINDOWSIZE 22 - -#define FL_MOUSE 30 -#define LB_MOUSEPOS 31 -#define FT_MOUSEPOS 32 -#define FT_MOUSEMIDDLE 33 -#define LB_MOUSEMIDDLE 34 - -#define FT_MENU_ICONS 40 -#define LB_MENU_ICONS 41 -#define FL_MENU 42 -#define FL_FONTLISTS 43 - -#define LB_ICONSIZE 54 -#define FT_ICONSIZESTYLE 55 -#define LB_ICONSTYLE 56 -#define CB_SYSTEM_FONT 57 -#define STR_ICONSIZE 58 - -#define CB_FONT_SHOW 60 -#define CB_FONT_HISTORY 62 - -#define CB_FONTANTIALIASING 63 -#define NF_AA_POINTLIMIT 64 -#define FT_POINTLIMIT_LABEL 65 -#define FT_POINTLIMIT_UNIT 66 - -#define FL_RENDERING 67 -#define CB_USE_HARDACCELL 68 -#define CB_USE_ANTIALIASE 69 - -// #i97672# -#define FL_SELECTION 70 -#define CB_SELECTION 71 -#define MF_SELECTION 72 - -// tabpage languages ----------------------------------------------------- - -#define FL_UI_LANG 1 -#define FT_UI_LANG 2 -#define LB_UI_LANG 3 -#define FL_LINGU_LANG 4 -#define FT_WEST_LANG 5 -#define LB_WEST_LANG 6 -#define FT_ASIAN_LANG 7 -#define LB_ASIAN_LANG 8 -#define FT_COMPLEX_LANG 9 -#define LB_COMPLEX_LANG 10 -#define CB_CURRENT_DOC 11 -#define FL_ENHANCED 12 -#define CB_ASIANSUPPORT 13 -#define CB_CTLSUPPORT 15 -#define FT_LOCALESETTING 16 -#define LB_LOCALESETTING 17 -#define FT_CURRENCY 18 -#define LB_CURRENCY 19 -#define FI_WEST_LANG 20 -#define FI_ASIAN_LANG 21 -#define FI_COMPLEX_LANG 22 -#define FI_ASIANSUPPORT 23 -#define FI_CTLSUPPORT 24 -#define FI_LOCALESETTING 25 -#define FI_CURRENCY 26 -#define FT_DECIMALSEPARATOR 27 -#define CB_DECIMALSEPARATOR 28 -#define FI_USERINTERFACE 29 -#define FT_USERINTERFACE 30 -#define LB_USERINTERFACE 31 -#define STR_IB_LANGCHANGE_TITLE 32 - -#define FL_FILEDLG 53 -#define FI_FILEDLG_RO 54 -#define CB_FILEDLG 55 -#define FT_GRAPHICCACHE_UNIT 56 -#define FT_GRAPHICOBJECTCACHE_UNIT 57 -#define FT_GRAPHICOBJECTTIME_UNIT 58 -#define FT_HELPAGENT_TIME_UNIT 59 -#define FL_DOCSTATUS 60 -#define CB_DOCSTATUS 61 -#define CB_ODMADLG 62 -#define CB_SAVE_ALWAYS 74 -#endif // #ifndef _SVX_OPTGDLG_HRC - -// ******************************************************************* EOF - diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx deleted file mode 100644 index 22fe65a1e..000000000 --- a/cui/source/options/optgdlg.hxx +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_OPTGDLG_HXX -#define _OFA_OPTGDLG_HXX -#include -#include -#include -#include -#include -#include -#include -#define FOLDERWEBVIEW_DEFAULTFILE "folder.so" - -// predeclarations -class CanvasSettings; -class SvtOptionsDrawinglayer; - -// class OfaMiscTabPage -------------------------------------------------- - -class OfaMiscTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; -private: - FixedLine aHelpFL; - CheckBox aToolTipsCB; - CheckBox aExtHelpCB; - CheckBox aHelpAgentCB; - PushButton aHelpAgentResetBtn; - FixedText aHelpFormatFT; - ListBox aHelpFormatLB; - - FixedLine aFileDlgFL; - ReadOnlyImage aFileDlgROImage; - CheckBox aFileDlgCB; - CheckBox aODMADlgCB; - - FixedLine aPrintDlgFL; - CheckBox aPrintDlgCB; - - FixedLine aDocStatusFL; - CheckBox aDocStatusCB; - CheckBox aSaveAlwaysCB; - - FixedLine aTwoFigureFL; - FixedText aInterpretFT; - NumericField aYearValueField; - FixedText aToYearFT; - - String aStrDateInfo; - - CheckBox aExperimentalCB; - - DECL_LINK( TwoFigureHdl, NumericField* ); - DECL_LINK( TwoFigureConfigHdl, NumericField* ); - DECL_LINK( HelpCheckHdl_Impl, CheckBox* ); - DECL_LINK( HelpAgentResetHdl_Impl, PushButton* ); -#ifdef WNT - DECL_LINK( OnFileDlgToggled, CheckBox* ); -#endif -protected: - virtual int DeactivatePage( SfxItemSet* pSet = NULL ); - -public: - OfaMiscTabPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaMiscTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -// class OfaViewTabPage -------------------------------------------------- -class SvtTabAppearanceCfg; - -class OfaViewTabPage : public SfxTabPage -{ -private: - FixedLine aUserInterfaceFL; - FixedText aWindowSizeFT; - MetricField aWindowSizeMF; - FixedText aIconSizeStyleFT; - ListBox aIconSizeLB; - ListBox aIconStyleLB; - CheckBox m_aSystemFont; - -#if defined( UNX ) - CheckBox aFontAntiAliasing; - FixedText aAAPointLimitLabel; - NumericField aAAPointLimit; - FixedText aAAPointLimitUnits; -#endif - - FixedLine aMenuFL; - FixedText aMenuIconsFT; - ListBox aMenuIconsLB; - - FixedLine aFontListsFL; - CheckBox aFontShowCB; - CheckBox aFontHistoryCB; - - FixedLine aRenderingFL; - CheckBox aUseHardwareAccell; - CheckBox aUseAntiAliase; - - FixedLine aMouseFL; - FixedText aMousePosFT; - ListBox aMousePosLB; - FixedText aMouseMiddleFT; - ListBox aMouseMiddleLB; - - // #i97672# - FixedLine maSelectionFL; - CheckBox maSelectionCB; - MetricField maSelectionMF; - - sal_uInt16 nSizeLB_InitialSelection; - sal_uInt16 nStyleLB_InitialSelection; - sal_Bool bSfxSymbolsAuto; - - // item ID for the given icon theme - // might be zero when the theme is not installed and the item is removed - sal_uLong aIconStyleItemId[STYLE_SYMBOLS_THEMES_MAX]; - SvtTabAppearanceCfg* pAppearanceCfg; - CanvasSettings* pCanvasSettings; - SvtOptionsDrawinglayer* mpDrawinglayerOpt; - -#if defined( UNX ) - DECL_LINK( OnAntialiasingToggled, void* ); -#endif - // #i97672# - DECL_LINK( OnSelectionToggled, void* ); - -public: - OfaViewTabPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaViewTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -struct LanguageConfig_Impl; -class OfaLanguagesTabPage : public SfxTabPage -{ - FixedLine aUILanguageGB; - ReadOnlyImage aLocaleSettingFI; - FixedText aUserInterfaceFT; - ListBox aUserInterfaceLB; - FixedText aLocaleSettingFT; - SvxLanguageBox aLocaleSettingLB; - ReadOnlyImage aCurrencyFI; - FixedText aDecimalSeparatorFT; - CheckBox aDecimalSeparatorCB; - FixedText aCurrencyFT; - ListBox aCurrencyLB; - - FixedLine aLinguLanguageGB; - ReadOnlyImage aWesternLanguageFI; - FixedText aWesternLanguageFT; - SvxLanguageBox aWesternLanguageLB; - ReadOnlyImage aAsianLanguageFI; - FixedText aAsianLanguageFT; - SvxLanguageBox aAsianLanguageLB; - ReadOnlyImage aComplexLanguageFI; - FixedText aComplexLanguageFT; - SvxLanguageBox aComplexLanguageLB; - CheckBox aCurrentDocCB; - FixedLine aEnhancedFL; - ReadOnlyImage aAsianSupportFI; - CheckBox aAsianSupportCB; - ReadOnlyImage aCTLSupportFI; - CheckBox aCTLSupportCB; - - const String sDecimalSeparatorLabel; - - sal_Bool m_bOldAsian; - sal_Bool m_bOldCtl; - LanguageConfig_Impl* pLangConfig; - - rtl::OUString m_sUserLocaleValue; - - DECL_LINK( SupportHdl, CheckBox* ) ; - DECL_LINK( LocaleSettingHdl, SvxLanguageBox* ) ; - -public: - OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaLanguagesTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; -#endif // #ifndef _OFA_OPTGDLG_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optgdlg.src b/cui/source/options/optgdlg.src deleted file mode 100644 index db5898512..000000000 --- a/cui/source/options/optgdlg.src +++ /dev/null @@ -1,695 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- - -#include -#include "optgdlg.hrc" -#include "helpid.hrc" - - //**************************************************************************** - // - // TabPage Sonstiges - // - //**************************************************************************** - -TabPage OFA_TP_MISC -{ - HelpID = HID_OFA_TP_MISC ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_HELP - { - Pos = MAP_APPFONT( COL0, ROW0 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Help"; - }; - CheckBox CB_TOOLTIP - { - HelpID = "cui:CheckBox:OFA_TP_MISC:CB_TOOLTIP"; - Pos = MAP_APPFONT( COL1, ROW1 ); - Size = MAP_APPFONT( COL3 - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Tips"; - }; - CheckBox CB_EXTHELP - { - HelpID = "cui:CheckBox:OFA_TP_MISC:CB_EXTHELP"; - Pos = MAP_APPFONT( COL3, ROW1 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL3, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Extended tips"; - }; -#if ENABLE_HELP_FORMATTING - FixedText FT_HELPFORMAT - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW2) ); - Size = MAP_APPFONT( DIFF( COL1, COL3 ), RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Help ~formatting"; - }; - ListBox LB_HELPFORMAT - { - HelpID = "cui:ListBox:OFA_TP_MISC:LB_HELPFORMAT"; - Pos = MAP_APPFONT( COL3, ROW2 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL4, 50 ); - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Default" ; > ; - < "High Contrast #1" ; > ; - < "High Contrast #2" ; > ; - < "High Contrast Black" ; > ; - < "High Contrast White" ; > ; - }; - }; -#endif - CheckBox CB_HELPAGENT - { - HelpID = "cui:CheckBox:OFA_TP_MISC:CB_HELPAGENT"; - Pos = MAP_APPFONT( COL1, ROW3 ); - Size = MAP_APPFONT( COL3 - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Help Agent"; - }; - PushButton PB_HELPAGENT_RESET - { - HelpID = "cui:PushButton:OFA_TP_MISC:PB_HELPAGENT_RESET"; - Pos = MAP_APPFONT( COL3, ROW3 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH + 20, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "~Reset Help Agent"; - }; - FixedLine FL_FILEDLG - { - Pos = MAP_APPFONT( COL0, ROW4 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Open/Save dialogs"; - }; - FixedImage FI_FILEDLG_RO - { - Pos = MAP_APPFONT( COL1 - 7, ROW5 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - Hide = TRUE; - }; - CheckBox CB_FILEDLG - { - HelpID = "cui:CheckBox:OFA_TP_MISC:CB_FILEDLG"; - Pos = MAP_APPFONT( COL1, ROW5 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Use %PRODUCTNAME dialogs"; - }; - CheckBox CB_ODMADLG - { - Pos = MAP_APPFONT( COL1, ROW6 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Show ODMA DMS dialogs first"; - Text [ en-GB ] = "Show ODMA DMS dialogues first"; - }; - FixedLine FL_PRINTDLG - { - Pos = MAP_APPFONT( COL0, ROW7 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Print dialogs"; - }; - CheckBox CB_PRINTDLG - { - Pos = MAP_APPFONT( COL1, ROW8 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Use %PRODUCTNAME ~dialogs"; - }; - FixedLine FL_DOCSTATUS - { - Pos = MAP_APPFONT( COL0, ROW9 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Document status"; - }; - CheckBox CB_DOCSTATUS - { - HelpID = "cui:CheckBox:OFA_TP_MISC:CB_DOCSTATUS"; - Pos = MAP_APPFONT( COL1, ROW10 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "~Printing sets \"document modified\" status"; - }; - CheckBox CB_SAVE_ALWAYS - { - Pos = MAP_APPFONT( COL1, ROW11 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Allow to save document even when the document is not modified"; - }; - FixedLine FL_TWOFIGURE - { - Pos = MAP_APPFONT( COL0, ROW12 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Year (two digits)" ; - }; - FixedText FT_INTERPRET - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT(ROW13) ); - Size = MAP_APPFONT( DIFF( COL1, COL3), RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Interpret as years between"; - }; - NumericField NF_YEARVALUE - { - HelpID = "cui:NumericField:OFA_TP_MISC:NF_YEARVALUE"; - Border = TRUE ; - Pos = MAP_APPFONT( COL4, ROW13 ); - Size = MAP_APPFONT( EDIT_WIDTH, RSC_CD_TEXTBOX_HEIGHT ); - Minimum = 1583 ; - Maximum = 9857 ; - Spin = TRUE ; - Repeat = TRUE ; - }; - FixedText FT_TOYEAR - { - Pos = MAP_APPFONT( COL6, OFFS_TEXTBOX_FIXEDTEXT(ROW13) ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL6, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "and " ; - }; - CheckBox CB_EXPERIMENTAL - { - Pos = MAP_APPFONT( COL1, ROW15 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Enable experimental (unstable) features"; - }; -}; - - //**************************************************************************** - // - // TabPage Ansicht - // - //**************************************************************************** - -TabPage OFA_TP_VIEW -{ - HelpID = HID_OFA_TP_VIEW ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_USERINTERFACE - { - Pos = MAP_APPFONT ( 6 , ROW0 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "User Interface" ; - }; - FixedText FT_WINDOWSIZE - { - Pos = MAP_APPFONT ( 12 , OFFS_TEXTBOX_FIXEDTEXT( ROW_MF_SCALING ) ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Sc~aling" ; - }; - MetricField MF_WINDOWSIZE - { - HelpID = "cui:MetricField:OFA_TP_VIEW:MF_WINDOWSIZE"; - Pos = MAP_APPFONT ( 95 , ROW_MF_SCALING ) ; - Size = MAP_APPFONT ( 31 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 80 ; - Maximum = 130 ; - DecimalDigits = 0 ; - First = 80 ; - Last = 130 ; - SpinSize = 1 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - }; - FixedText FT_ICONSIZESTYLE - { - Pos = MAP_APPFONT ( 12 , ROW_FT_ICONSIZESTYLE ) ; - Size = MAP_APPFONT ( 114 , 8 ) ; - Text [ en-US ] = "Icon size and style" ; - }; - String STR_ICONSIZE - { - Text [ en-US ] = "Icon size" ; - }; - ListBox LB_ICONSIZE - { - HelpID = "cui:ListBox:OFA_TP_VIEW:LB_ICONSIZE"; - Pos = MAP_APPFONT ( 12 , ROW_LB_ICONSIZESTYLE ) ; - Size = MAP_APPFONT ( 45 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Automatic" ; > ; - < "Small" ; > ; - < "Large" ; > ; - }; - }; - ListBox LB_ICONSTYLE - { - HelpID = "cui:ListBox:OFA_TP_VIEW:LB_ICONSTYLE"; - Pos = MAP_APPFONT ( 61 , ROW_LB_ICONSIZESTYLE ) ; - Size = MAP_APPFONT ( 65 , 70 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Automatic" ; > ; - < "Galaxy (default)" ; > ; - < "High Contrast" ; > ; - < "Industrial" ; > ; // industrial is dead, but we have to keep the entry - < "Crystal" ; > ; - < "Tango" ; > ; - < "Oxygen" ; > ; - < "Classic" ; > ; - < "Human" ; > ; - }; - }; - CheckBox CB_SYSTEM_FONT - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_SYSTEM_FONT"; - TabStop = TRUE ; - Pos = MAP_APPFONT( 12, ROW_CB_SYSTEM_FONT ); - Size = MAP_APPFONT( 114, 16 ); - WordBreak = TRUE; - Text[ en-US ] = "Use system ~font for user interface"; - }; - - CheckBox CB_FONTANTIALIASING - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_FONTANTIALIASING"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , ROW_CB_FONTANTIALIASING ) ; - Size = MAP_APPFONT ( 110 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Screen font antialiasing" ; - }; - FixedText FT_POINTLIMIT_LABEL - { - Pos = MAP_APPFONT ( 23 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ; - Size = MAP_APPFONT ( 20 , 8 ) ; - Text [ en-US ] = "from"; - }; - NumericField NF_AA_POINTLIMIT - { - HelpID = "cui:NumericField:OFA_TP_VIEW:NF_AA_POINTLIMIT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 46, ROW_NF_AA_POINTLIMIT ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Minimum = 1; - Maximum = 10000; - SpinSize = 1; - Spin = TRUE ; - Repeat = TRUE ; - }; - FixedText FT_POINTLIMIT_UNIT - { - Pos = MAP_APPFONT ( 79 , OFFS_TEXTBOX_FIXEDTEXT( ROW_NF_AA_POINTLIMIT ) ) ; - Size = MAP_APPFONT ( 47 , 8 ) ; - Text [ en-US ] = "Pixels"; - }; - FixedLine FL_MENU - { - Pos = MAP_APPFONT ( 6, ROW_FL_MENU ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Menu" ; - }; - FixedText FT_MENU_ICONS - { - Pos = MAP_APPFONT ( 12 , ROW_FT_MENU_ICONS ) ; - Size = MAP_APPFONT ( 114 , 8 ) ; - Text [ en-US ] = "Icons in menus" ; - }; - ListBox LB_MENU_ICONS - { - HelpID = "cui:ListBox:OFA_TP_VIEW:LB_MENU_ICONS"; - Pos = MAP_APPFONT ( 12 , ROW_LB_MENU_ICONS ) ; - Size = MAP_APPFONT ( 114 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Automatic" ; > ; - < "Hide" ; > ; - < "Show" ; > ; - }; - }; - FixedLine FL_FONTLISTS - { - Pos = MAP_APPFONT ( 6, ROW_FL_FONTLISTS ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Font Lists" ; - }; - CheckBox CB_FONT_SHOW - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_FONT_SHOW"; - Pos = MAP_APPFONT ( 12, ROW_CB_FONT_SHOW ) ; - Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Show p~review of fonts" ; - }; - CheckBox CB_FONT_HISTORY - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_FONT_HISTORY"; - Pos = MAP_APPFONT ( 12, ROW_CB_FONT_HISTORY ) ; - Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Show font h~istory" ; - }; - FixedLine FL_RENDERING - { - Pos = MAP_APPFONT ( 133 , ROW_FL_RENDERING ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Graphics output"; - }; - - CheckBox CB_USE_HARDACCELL - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_USE_HARDACCELL"; - Pos = MAP_APPFONT ( 139, ROW_CB_USE_HARDACCELL ) ; - Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Use hardware acceleration" ; - }; - - CheckBox CB_USE_ANTIALIASE - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_USE_ANTIALIASE"; - Pos = MAP_APPFONT ( 139, ROW_CB_USE_ANTIALIASE ) ; - Size = MAP_APPFONT ( 118 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Use Anti-Aliasing" ; - }; - - FixedLine FL_MOUSE - { - Pos = MAP_APPFONT ( 133 , ROW_FL_MOUSE ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Mouse"; - }; - FixedText FT_MOUSEPOS - { - Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEPOS ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Mouse positioning" ; - }; - ListBox LB_MOUSEPOS - { - HelpID = "cui:ListBox:OFA_TP_VIEW:LB_MOUSEPOS"; - Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEPOS ) ; - Size = MAP_APPFONT ( 114 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Default button" ; > ; - < "Dialog center" ; > ; - < "No automatic positioning" ; > ; - }; - }; - FixedText FT_MOUSEMIDDLE - { - Pos = MAP_APPFONT ( 139, ROW_FT_MOUSEMIDDLE ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Middle mouse button"; - }; - ListBox LB_MOUSEMIDDLE - { - HelpID = "cui:ListBox:OFA_TP_VIEW:LB_MOUSEMIDDLE"; - Pos = MAP_APPFONT ( 139, ROW_LB_MOUSEMIDDLE ) ; - Size = MAP_APPFONT ( 114 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "No function" ; > ; - < "Automatic scrolling" ; > ; - < "Paste clipboard" ; > ; - }; - }; - - // #i97672# - FixedLine FL_SELECTION - { - Pos = MAP_APPFONT ( 133 , ROW_FL_SELECTION ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Selection"; - }; - - CheckBox CB_SELECTION - { - HelpID = "cui:CheckBox:OFA_TP_VIEW:CB_SELECTION"; - Pos = MAP_APPFONT ( 139, ROW_CB_SELECTION + (((12 - RSC_CD_CHECKBOX_HEIGHT) / 2) + 1)) ; - Size = MAP_APPFONT ( 118 - 34 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Transparency" ; - }; - - MetricField MF_SELECTION - { - HelpID = "cui:MetricField:OFA_TP_VIEW:MF_SELECTION"; - Pos = MAP_APPFONT ( 139 + (95 - 12), ROW_CB_SELECTION ) ; - Size = MAP_APPFONT ( 31 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 10 ; - Maximum = 90 ; - DecimalDigits = 0 ; - First = 10 ; - Last = 90 ; - SpinSize = 5 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = "%" ; - }; -}; -// ******************************************************************* - -TabPage OFA_TP_LANGUAGES -{ - HelpID = HID_OFA_TP_LANGUAGES ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_UI_LANG - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Language of"; - }; - FixedImage FI_USERINTERFACE - { - Pos = MAP_APPFONT ( 5 , 17 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_USERINTERFACE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "~User interface"; - }; - ListBox LB_USERINTERFACE - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_USERINTERFACE"; - Pos = MAP_APPFONT ( 123 , 14 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - FixedImage FI_LOCALESETTING - { - Pos = MAP_APPFONT ( 5 , 32 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_LOCALESETTING - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "Locale setting"; - }; - ListBox LB_LOCALESETTING - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_LOCALESETTING"; - Pos = MAP_APPFONT ( 123 , 30 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - FixedText FT_DECIMALSEPARATOR - { - Pos = MAP_APPFONT ( 12 , 46 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "Decimal separator key"; - }; - CheckBox CB_DECIMALSEPARATOR - { - HelpID = "cui:CheckBox:OFA_TP_LANGUAGES:CB_DECIMALSEPARATOR"; - Pos = MAP_APPFONT ( 123 , 46) ; - Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "~Same as locale setting ( %1 )"; - }; - FixedImage FI_CURRENCY - { - Pos = MAP_APPFONT ( 5 , 63 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_CURRENCY - { - Pos = MAP_APPFONT ( 12 , 61 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "~Default currency"; - }; - ListBox LB_CURRENCY - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_CURRENCY"; - Pos = MAP_APPFONT ( 123 , 59 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - FixedLine FL_LINGU_LANG - { - Pos = MAP_APPFONT ( 6 , 77 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Default languages for documents"; - }; - FixedImage FI_WEST_LANG - { - Pos = MAP_APPFONT ( 5 , 92 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_WEST_LANG - { - Pos = MAP_APPFONT ( 12 , 90 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "Western"; - }; - - ListBox LB_WEST_LANG - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_WEST_LANG"; - Pos = MAP_APPFONT ( 123 , 88 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - FixedImage FI_ASIAN_LANG - { - Pos = MAP_APPFONT ( 5 , 108 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_ASIAN_LANG - { - Pos = MAP_APPFONT ( 12 , 106 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "Asian"; - }; - ListBox LB_ASIAN_LANG - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_ASIAN_LANG"; - Pos = MAP_APPFONT ( 123 , 104 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - FixedImage FI_COMPLEX_LANG - { - Pos = MAP_APPFONT ( 5 , 124 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - FixedText FT_COMPLEX_LANG - { - Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 108 , 8 ) ; - Text [ en-US ] = "C~TL"; - }; - ListBox LB_COMPLEX_LANG - { - HelpID = "cui:ListBox:OFA_TP_LANGUAGES:LB_COMPLEX_LANG"; - Pos = MAP_APPFONT ( 123 , 120 ) ; - Size = MAP_APPFONT ( 125 , 60 ) ; - DropDown = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - Sort = TRUE; - }; - CheckBox CB_CURRENT_DOC - { - HelpID = "cui:CheckBox:OFA_TP_LANGUAGES:CB_CURRENT_DOC"; - Pos = MAP_APPFONT ( 123 , 135 ) ; - Size = MAP_APPFONT ( 125 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "For the current document only"; - }; - FixedLine FL_ENHANCED - { - Pos = MAP_APPFONT ( 6 , 145 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Enhanced language support"; - }; - FixedImage FI_ASIANSUPPORT - { - Pos = MAP_APPFONT ( 5 , 160 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - CheckBox CB_ASIANSUPPORT - { - HelpID = "cui:CheckBox:OFA_TP_LANGUAGES:CB_ASIANSUPPORT"; - Pos = MAP_APPFONT ( 12 , 158 ) ; - Size = MAP_APPFONT ( 236 ,RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "E~nabled for Asian languages"; - }; - FixedImage FI_CTLSUPPORT - { - Pos = MAP_APPFONT ( 5 , 175 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - CheckBox CB_CTLSUPPORT - { - HelpID = "cui:CheckBox:OFA_TP_LANGUAGES:CB_CTLSUPPORT"; - Pos = MAP_APPFONT ( 12 , 173 ) ; - Size = MAP_APPFONT ( 236 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "Ena~bled for complex text layout (CTL)"; - }; -}; - -InfoBox RID_SVX_MSGBOX_LANGUAGE_RESTART -{ - Message [ en-US ] = "The language setting of the user interface has been updated and will take effect the next time you start %PRODUCTNAME %PRODUCTVERSION"; -}; - - diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx deleted file mode 100644 index 4c1ba607a..000000000 --- a/cui/source/options/optgenrl.cxx +++ /dev/null @@ -1,561 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include - -#define _SVX_OPTGENRL_CXX - -#include -#include "optgenrl.hrc" -#include -#include "cuioptgenrl.hxx" -#include -#include -#include -#include // SID_FIELD_GRABFOCUS - -#define TRIM(s) s.EraseLeadingChars().EraseTrailingChars() - -// struct GeneralTabPage_Impl -------------------------------------------- - -struct GeneralTabPage_Impl -{ - sal_Bool mbStreetEnabled; - sal_Bool mbPLZEnabled; - sal_Bool mbCityEnabled; - sal_Bool mbUsCityEnabled; - sal_Bool mbUsZipEnabled; - - String maQueryStr; - - GeneralTabPage_Impl() : - mbStreetEnabled ( sal_False ), - mbPLZEnabled ( sal_False ), - mbCityEnabled ( sal_False ), - mbUsCityEnabled ( sal_False ), - mbUsZipEnabled ( sal_False ) {} -}; - -// ----------------------------------------------------------------------- - -SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : - - SfxTabPage( pParent, CUI_RES(RID_SFXPAGE_GENERAL), rCoreSet ), - - aAddrFrm ( this, CUI_RES( GB_ADDRESS ) ), - aCompanyLbl ( this, CUI_RES( FT_COMPANY ), true ), - aCompanyEdit ( this, CUI_RES( ED_COMPANY ), INDEX_NOTSET, &aCompanyLbl ), - aNameLbl ( this, CUI_RES( FT_NAME ), true ), - aNameLblRuss ( this, CUI_RES( FT_NAME_RUSS ), true ), - aNameLblEastern ( this, CUI_RES( FT_NAME_EASTERN ), true ), - aFirstName ( this, CUI_RES( ED_FIRSTNAME ), 0, &aNameLbl ), - aFatherName ( this, CUI_RES( ED_FATHERNAME ) ), - aName ( this, CUI_RES( ED_NAME ), 1, &aNameLbl ), - aShortName ( this, CUI_RES( ED_SHORTNAME ), 2, &aNameLbl ), - aStreetLbl ( this, CUI_RES( FT_STREET ), true ), - aStreetLblRuss ( this, CUI_RES( FT_STREET_RUSS ), true ), - aStreetEdit ( this, CUI_RES( ED_STREET ), 0, &aStreetLbl ), - aApartmentNrEdit( this, CUI_RES( ED_APARTMENTNR ), 1, &aStreetLblRuss ), - aCityLbl ( this, CUI_RES( FT_CITY ), true ), - aPLZEdit ( this, CUI_RES( ED_PLZ ), 0, &aCityLbl ), - aCityEdit ( this, CUI_RES( ED_CITY ), 1, &aCityLbl ), - aUsCityEdit ( this, CUI_RES( ED_US_CITY ), 0, &aCityLbl ), - aUsStateEdit ( this, CUI_RES( ED_US_STATE ), 1, &aCityLbl ), - aUsZipEdit ( this, CUI_RES( ED_US_ZIPCODE ), 2, &aCityLbl ), - aCountryLbl ( this, CUI_RES( FT_COUNTRY ), true ), - aCountryEdit ( this, CUI_RES( ED_COUNTRY ), INDEX_NOTSET, &aCountryLbl ), - aTitlePosLbl ( this, CUI_RES( FT_TITLEPOS ), true ), - aTitleEdit ( this, CUI_RES( ED_TITLE ), 0, &aTitlePosLbl ), - aPositionEdit ( this, CUI_RES( ED_POSITION ), 1, &aTitlePosLbl ), - aPhoneLbl ( this, CUI_RES( FT_PHONE ), true ), - aTelPrivEdit ( this, CUI_RES( ED_TELPRIVAT ), 0, &aPhoneLbl ), - aTelCompanyEdit ( this, CUI_RES( ED_TELCOMPANY ), 1, &aPhoneLbl ), - aFaxMailLbl ( this, CUI_RES( FT_FAXMAIL ), true ), - aFaxEdit ( this, CUI_RES( ED_FAX ), 0, &aFaxMailLbl ), - aEmailEdit ( this, CUI_RES( ED_EMAIL ), 1, &aFaxMailLbl ), - aUseDataCB ( this, CUI_RES( CB_USEDATA ) ), - pImpl ( new GeneralTabPage_Impl ) - -{ - LanguageType eLang = Application::GetSettings().GetUILanguage(); - pImpl->maQueryStr = String( CUI_RES( STR_QUERY_REG ) ); - - if ( LANGUAGE_ENGLISH_US == eLang ) - { - // amerikanische Postadresse aufbauen - aPLZEdit.Hide(); - aCityEdit.Hide(); - aCityLbl.SetText( CUI_RES( STR_US_STATE ) ); - } - else if ( LANGUAGE_RUSSIAN == eLang ) - { - aUsCityEdit.Hide(); - aUsStateEdit.Hide(); - aUsZipEdit.Hide(); - aNameLbl.Hide(); - aNameLblRuss.Show(); - aStreetLbl.Hide(); - aStreetLblRuss.Show(); - aFatherName.Show(); - aName.SetIndex( 0 ); - aName.SetLabel( &aNameLblRuss ); - aFirstName.SetIndex( 1 ); - aFirstName.SetLabel( &aNameLblRuss ); - aFatherName.SetIndex( 2 ); - aFatherName.SetLabel( &aNameLblRuss ); - aShortName.SetIndex( 3 ); - aShortName.SetLabel( &aNameLblRuss ); - - Point aEditPoint = LogicToPixel( Point( MID, LINE(1) ), MAP_APPFONT ); - Point aRightPoint = LogicToPixel( Point( RIGHT, LINE(1) ), MAP_APPFONT ); - Size aEditSize = LogicToPixel( Size( 42, 12 ), MAP_APPFONT ); - Size a2Size = LogicToPixel( Size( 2, 2 ), MAP_APPFONT ); - long nDelta = aEditSize.Width() + a2Size.Width(); - aName.SetPosSizePixel( aEditPoint, aEditSize ); - aEditPoint.X() = aEditPoint.X() + nDelta; - aFirstName.SetPosSizePixel( aEditPoint, aEditSize ); - aEditPoint.X() = aEditPoint.X() + nDelta; - aFatherName.SetPosSizePixel( aEditPoint, aEditSize ); - aEditPoint.X() = aEditPoint.X() + nDelta; - aEditSize.Width() = aRightPoint.X() - aEditPoint.X(); - aShortName.SetPosSizePixel( aEditPoint, aEditSize ); - - Size aStreetSize = aStreetEdit.GetSizePixel(); - aStreetSize.Width() = aStreetSize.Width() - aEditSize.Width() - a2Size.Width(); - aStreetEdit.SetSizePixel( aStreetSize ); - aApartmentNrEdit.Show(); - Point aApartmentPoint = LogicToPixel( Point( MID, LINE(2) ), MAP_APPFONT ); - aApartmentPoint.X() = aEditPoint.X(); - aApartmentNrEdit.SetPosSizePixel( aApartmentPoint, aEditSize ); - - aName.SetZOrder( &aNameLblRuss, WINDOW_ZORDER_BEHIND ); - aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND ); - aFatherName.SetZOrder( &aFirstName, WINDOW_ZORDER_BEHIND ); - } - else if ( LANGUAGE_JAPANESE == eLang || - LANGUAGE_KOREAN == eLang || - LANGUAGE_HUNGARIAN == eLang || - LANGUAGE_CHINESE_TRADITIONAL == eLang || - LANGUAGE_CHINESE_SIMPLIFIED == eLang) - { - aUsCityEdit.Hide(); - aUsStateEdit.Hide(); - aUsZipEdit.Hide(); - aNameLbl.Hide(); - aNameLblEastern.Show(); - - // swap "first name" field and "last name" field - Point aPosTmp = aFirstName.GetPosPixel(); - aFirstName.SetPosPixel( aName.GetPosPixel() ); - aName.SetPosPixel( aPosTmp ); - aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND ); - } - else - { - aUsCityEdit.Hide(); - aUsStateEdit.Hide(); - aUsZipEdit.Hide(); - } - - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - Link aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl ); - aFirstName.SetModifyHdl( aLink ); - aName.SetModifyHdl( aLink ); - - // because some labels have text for more than one edit field we have to split these texts - // and set these texts as accessible name of the corresponding edit fields - SvxUserEdit* pEdits[] = - { - &aCompanyEdit, &aFirstName, &aFatherName, &aName, &aShortName, &aStreetEdit, - &aApartmentNrEdit, &aPLZEdit, &aCityEdit, &aUsCityEdit, &aUsStateEdit, &aUsZipEdit, - &aCountryEdit, &aTitleEdit, &aPositionEdit, &aTelPrivEdit, &aTelCompanyEdit, - &aFaxEdit, &aEmailEdit, NULL - }; - SvxUserEdit** pCurrent = pEdits; - while ( *pCurrent ) - { - Window* pLabel = (*pCurrent)->GetLabel(); - if ( pLabel ) - { - String sName, sText = pLabel->GetDisplayText(); - sal_Int16 nIndex = (*pCurrent)->GetIndex(); - if ( INDEX_NOTSET == nIndex ) - sName = sText; - else - sName = sText.GetToken( nIndex, '/' ); - sName.EraseAllChars( '(' ); - sName.EraseAllChars( ')' ); - if ( sName.Len() > 0 ) - (*pCurrent)->SetAccessibleName( sName ); - } - pCurrent++; - } -} - -//------------------------------------------------------------------------ - -SvxGeneralTabPage::~SvxGeneralTabPage() -{ - delete pImpl; -} - -//------------------------------------------------------------------------ - -SfxTabPage* SvxGeneralTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return ( new SvxGeneralTabPage( pParent, rAttrSet ) ); -} - -//------------------------------------------------------------------------ - -sal_Bool SvxGeneralTabPage::FillItemSet( SfxItemSet& ) -{ - // Eingaben trimmen (f"uhrende und nachfolgende Leerzeichen entfernen) - aCompanyEdit.SetText( TRIM(aCompanyEdit.GetText()) ); - aFirstName.SetText( TRIM(aFirstName.GetText()) ); - aName.SetText( TRIM(aName.GetText()) ); - aShortName.SetText( TRIM(aShortName.GetText()) ); - aStreetEdit.SetText( TRIM(aStreetEdit.GetText()) ); - aCountryEdit.SetText( TRIM(aCountryEdit.GetText()) ); - aPLZEdit.SetText( TRIM(aPLZEdit.GetText()) ); - aCityEdit.SetText( TRIM(aCityEdit.GetText()) ); - aUsCityEdit.SetText( TRIM(aUsCityEdit.GetText()) ); - aUsStateEdit.SetText( TRIM(aUsStateEdit.GetText()) ); - aUsZipEdit.SetText( TRIM(aUsZipEdit.GetText()) ); - aTitleEdit.SetText( TRIM(aTitleEdit.GetText()) ); - aPositionEdit.SetText( TRIM(aPositionEdit.GetText()) ); - aTelPrivEdit.SetText( TRIM(aTelPrivEdit.GetText()) ); - aTelCompanyEdit.SetText( TRIM(aTelCompanyEdit.GetText()) ); - aFaxEdit.SetText( TRIM(aFaxEdit.GetText()) ); - aEmailEdit.SetText( TRIM(aEmailEdit.GetText()) ); - - sal_Bool bModified = sal_False; - bModified |= GetAddress_Impl(); - SvtSaveOptions aSaveOpt; - if ( aUseDataCB.IsChecked() != aSaveOpt.IsUseUserData() ) - { - aSaveOpt.SetUseUserData( aUseDataCB.IsChecked() ); - bModified |= sal_True; - } - return bModified; -} - -//------------------------------------------------------------------------ - -void SvxGeneralTabPage::Reset( const SfxItemSet& rSet ) -{ - SetAddress_Impl(); - - sal_uInt16 nWhich = GetWhich( SID_FIELD_GRABFOCUS ); - if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - sal_uInt16 nField = ( (SfxUInt16Item&)rSet.Get( nWhich ) ).GetValue(); - - switch ( nField ) - { - case COMPANY_EDIT: aCompanyEdit.GrabFocus(); break; - case FIRSTNAME_EDIT: aFirstName.GrabFocus(); break; - case LASTNAME_EDIT: aName.GrabFocus(); break; - case STREET_EDIT: aStreetEdit.GrabFocus(); break; - case COUNTRY_EDIT: aCountryEdit.GrabFocus(); break; - case PLZ_EDIT: - if ( aPLZEdit.IsVisible() ) - aPLZEdit.GrabFocus(); - else - aUsZipEdit.GrabFocus(); - break; - case CITY_EDIT: - if ( aCityEdit.IsVisible() ) - aCityEdit.GrabFocus(); - else - aUsCityEdit.GrabFocus(); - break; - case STATE_EDIT: - if ( aUsStateEdit.IsVisible() ) - aUsStateEdit.GrabFocus(); - else - aCityEdit.GrabFocus(); - break; - case TITLE_EDIT: aTitleEdit.GrabFocus(); break; - case POSITION_EDIT: aPositionEdit.GrabFocus(); break; - case SHORTNAME_EDIT: aShortName.GrabFocus(); break; - case TELPRIV_EDIT: aTelPrivEdit.GrabFocus(); break; - case TELCOMPANY_EDIT: aTelCompanyEdit.GrabFocus(); break; - case FAX_EDIT: aFaxEdit.GrabFocus(); break; - case EMAIL_EDIT: aEmailEdit.GrabFocus(); break; - default: aCompanyEdit.GrabFocus(); - } - } - - aUseDataCB.Check( SvtSaveOptions().IsUseUserData() ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit *, pEdit ) -{ - if ( aShortName.IsEnabled() ) - { - String aShortStr( aShortName.GetText() ); - switch ( aShortStr.Len() ) - { - case 0: - aShortStr = String( RTL_CONSTASCII_USTRINGPARAM(" ") ); - break; - - case 1: - aShortStr += ' '; - break; - } - - sal_uInt16 nPos = ( pEdit == &aFirstName ) ? 0 : 1; - String aTxt = pEdit->GetText(); - sal_Unicode cChar = ( aTxt.Len() > 0 ) ? aTxt.GetChar(0) : ' '; - aShortStr.SetChar( nPos, cChar ); - aShortStr.EraseTrailingChars(); - aShortName.SetText( aShortStr ); - } - return 0; -} - -//------------------------------------------------------------------------ - -sal_Bool SvxGeneralTabPage::GetAddress_Impl() -{ - sal_Bool bRet = - ( aCompanyEdit.GetSavedValue() != aCompanyEdit.GetText() || - aFirstName.GetSavedValue() != aFirstName.GetText() || - aFatherName.GetSavedValue() != aFatherName.GetText() || - aName.GetSavedValue() != aName.GetText() || - aShortName.GetSavedValue() != aShortName.GetText() || - aStreetEdit.GetSavedValue() != aStreetEdit.GetText() || - aApartmentNrEdit.GetSavedValue() != aApartmentNrEdit.GetText() || - aPLZEdit.GetSavedValue() != aPLZEdit.GetText() || - aCityEdit.GetSavedValue() != aCityEdit.GetText() || - aUsCityEdit.GetSavedValue() != aUsCityEdit.GetText() || - aUsStateEdit.GetSavedValue() != aUsStateEdit.GetText() || - aUsZipEdit.GetSavedValue() != aUsZipEdit.GetText() || - aCountryEdit.GetSavedValue() != aCountryEdit.GetText() || - aTitleEdit.GetSavedValue() != aTitleEdit.GetText() || - aPositionEdit.GetSavedValue() != aPositionEdit.GetText() || - aTelPrivEdit.GetSavedValue() != aTelPrivEdit.GetText() || - aTelCompanyEdit.GetSavedValue() != aTelCompanyEdit.GetText() || - aFaxEdit.GetSavedValue() != aFaxEdit.GetText() || - aEmailEdit.GetSavedValue() != aEmailEdit.GetText() ); - - LanguageType eLang = Application::GetSettings().GetUILanguage(); - sal_Bool bUS = ( LANGUAGE_ENGLISH_US == eLang ); - - SvtUserOptions aUserOpt; - aUserOpt.SetCompany(aCompanyEdit.GetText()); - aUserOpt.SetFirstName(aFirstName.GetText()); - aUserOpt.SetLastName(aName.GetText()); - aUserOpt.SetID( aShortName.GetText()); - - aUserOpt.SetStreet(aStreetEdit.GetText() ); - - aUserOpt.SetCountry(aCountryEdit.GetText() ); - - aUserOpt.SetZip(bUS ? aUsZipEdit.GetText() : aPLZEdit.GetText() ); - aUserOpt.SetCity(bUS ? aUsCityEdit.GetText() : aCityEdit.GetText() ); - - aUserOpt.SetTitle( aTitleEdit.GetText() ); - aUserOpt.SetPosition(aPositionEdit.GetText() ); - aUserOpt.SetTelephoneHome( aTelPrivEdit.GetText() ); - aUserOpt.SetTelephoneWork( aTelCompanyEdit.GetText() ); - aUserOpt.SetFax( aFaxEdit.GetText() ); - aUserOpt.SetEmail( aEmailEdit.GetText() ); - aUserOpt.SetState( bUS ? aUsStateEdit.GetText() : String() ); - - if ( LANGUAGE_RUSSIAN == eLang ) - { - aUserOpt.SetFathersName( aFatherName.GetText() ); - aUserOpt.SetApartment( aApartmentNrEdit.GetText() ); - } - return bRet; -} - -//------------------------------------------------------------------------ - -void SvxGeneralTabPage::SetAddress_Impl() -{ - LanguageType eLang = Application::GetSettings().GetUILanguage(); - sal_Bool bUS = ( LANGUAGE_ENGLISH_US == eLang ); - SvtUserOptions aUserOpt; - aCompanyEdit.SetText( aUserOpt.GetCompany() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_COMPANY ) ) - { - aCompanyLbl.Disable(); - aCompanyEdit.Disable(); - } - sal_Int16 nEditCount = 0; - aFirstName.SetText( aUserOpt.GetFirstName() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_FIRSTNAME ) ) - { - aFirstName.Disable(); - nEditCount++; - } - aName.SetText( aUserOpt.GetLastName() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_LASTNAME ) ) - { - aName.Disable(); - nEditCount++; - } - aShortName.SetText( aUserOpt.GetID() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_ID ) ) - { - aShortName.Disable(); - nEditCount++; - } - aNameLbl.Enable( ( nEditCount != 3 ) ); - aStreetEdit.SetText( aUserOpt.GetStreet() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_STREET ) ) - { - aStreetLbl.Disable(); - aStreetEdit.Disable(); - } - Edit* pPLZEdit = bUS ? &aUsZipEdit : &aPLZEdit; - Edit* pCityEdit = bUS ? &aUsCityEdit : &aCityEdit; - pPLZEdit->SetText( aUserOpt.GetZip() ); - pCityEdit->SetText( aUserOpt.GetCity() ); - nEditCount = 0; - if ( aUserOpt.IsTokenReadonly( USER_OPT_ZIP ) ) - { - pPLZEdit->Disable(); - nEditCount++; - } - if ( aUserOpt.IsTokenReadonly( USER_OPT_CITY ) ) - { - pCityEdit->Disable(); - nEditCount++; - } - if ( bUS ) - { - aUsStateEdit.SetText( aUserOpt.GetState() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_STATE ) ) - { - aUsStateEdit.Disable(); - nEditCount++; - } - } - aCityLbl.Enable( ( nEditCount != ( bUS ? 3 : 2 ) ) ); - aCountryEdit.SetText( aUserOpt.GetCountry() ); - if ( aUserOpt.IsTokenReadonly( USER_OPT_COUNTRY ) ) - { - aCountryLbl.Disable(); - aCountryEdit.Disable(); - } - aTitleEdit.SetText( aUserOpt.GetTitle() ); - aPositionEdit.SetText( aUserOpt.GetPosition() ); - nEditCount = 0; - if ( aUserOpt.IsTokenReadonly( USER_OPT_TITLE ) ) - { - aTitleEdit.Disable(); - nEditCount++; - } - if ( aUserOpt.IsTokenReadonly( USER_OPT_POSITION ) ) - { - aPositionEdit.Disable(); - nEditCount++; - } - aTitlePosLbl.Enable( ( nEditCount != 2 ) ); - aTelPrivEdit.SetText( aUserOpt.GetTelephoneHome() ); - aTelCompanyEdit.SetText( aUserOpt.GetTelephoneWork() ); - nEditCount = 0; - if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEHOME ) ) - { - aTelPrivEdit.Disable(); - nEditCount++; - } - if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEWORK ) ) - { - aTelCompanyEdit.Disable(); - nEditCount++; - } - aPhoneLbl.Enable( ( nEditCount != 2 ) ); - aFaxEdit.SetText( aUserOpt.GetFax() ); - aEmailEdit.SetText( aUserOpt.GetEmail() ); - nEditCount = 0; - if ( aUserOpt.IsTokenReadonly( USER_OPT_FAX ) ) - { - aFaxEdit.Disable(); - nEditCount++; - } - if ( aUserOpt.IsTokenReadonly( USER_OPT_EMAIL ) ) - { - aEmailEdit.Disable(); - nEditCount++; - } - aFaxMailLbl.Enable( ( nEditCount != 2 ) ); - - if ( LANGUAGE_RUSSIAN == eLang ) - { - aFatherName.SetText( aUserOpt.GetFathersName() ); - aApartmentNrEdit.SetText( aUserOpt.GetApartment() ); - } - - aCompanyEdit.SaveValue(); - aFirstName.SaveValue(); - aFatherName.SaveValue(); - aName.SaveValue(); - aShortName.SaveValue(); - aStreetEdit.SaveValue(); - aApartmentNrEdit.SaveValue(); - aPLZEdit.SaveValue(); - aCityEdit.SaveValue(); - aUsCityEdit.SaveValue(); - aUsStateEdit.SaveValue(); - aUsZipEdit.SaveValue(); - aCountryEdit.SaveValue(); - aTitleEdit.SaveValue(); - aPositionEdit.SaveValue(); - aTelPrivEdit.SaveValue(); - aTelCompanyEdit.SaveValue(); - aFaxEdit.SaveValue(); - aEmailEdit.SaveValue(); -} - -// ----------------------------------------------------------------------- - -int SvxGeneralTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optgenrl.hrc b/cui/source/options/optgenrl.hrc deleted file mode 100644 index 444c11291..000000000 --- a/cui/source/options/optgenrl.hrc +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTGENRL_HRC -#define _SVX_OPTGENRL_HRC - -// defines ------------------------------------------------------------------ - -#define FT_COMPANY 10 -#define ED_COMPANY 11 -#define FT_NAME 12 -#define FT_NAME_RUSS 13 -#define ED_FATHERNAME 14 -#define ED_FIRSTNAME 15 -#define ED_NAME 16 -#define ED_SHORTNAME 17 -#define FT_STREET 18 -#define FT_STREET_RUSS 19 -#define ED_STREET 20 -#define ED_APARTMENTNR 21 -#define FT_CITY 22 -#define ED_PLZ 23 -#define ED_CITY 24 -#define ED_US_CITY 25 -#define ED_US_STATE 26 -#define ED_US_ZIPCODE 27 -#define FT_COUNTRY 28 -#define ED_COUNTRY 29 -#define FT_TITLEPOS 30 -#define ED_TITLE 31 -#define ED_POSITION 32 -#define FT_PHONE 33 -#define ED_TELPRIVAT 34 -#define ED_TELCOMPANY 35 -#define FT_FAXMAIL 36 -#define ED_FAX 37 -#define ED_EMAIL 38 -#define GB_ADDRESS 39 -#define CB_USEDATA 40 -#define FT_NAME_EASTERN 41 - -#define STR_US_STATE 10 -#define STR_QUERY_REG 11 - -// Positionierungshilfen f"ur den Dialog - -#define HSPACE 2 -#define VSPACE 3 -#define LINEH 12 -#define FLINEH 8 -#define LEFT 12 -#define MID 100 -#define RIGHT 248 -#define TOP 10 -#define LINE(y) (14+y*15) -#define FLINE(y) (16+y*15) -#define NAMELEN 74 - -#endif // #ifndef _SVX_OPTGENRL_HRC - -// ******************************************************************* EOF - diff --git a/cui/source/options/optgenrl.src b/cui/source/options/optgenrl.src deleted file mode 100644 index aae667ff7..000000000 --- a/cui/source/options/optgenrl.src +++ /dev/null @@ -1,332 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include ------------------------------------------------------------------ - -#include - -#include "helpid.hrc" -#include -#include "optgenrl.hrc" - -// RID_SFXPAGE_GENERAL ------------------------------------------------------ - -TabPage RID_SFXPAGE_GENERAL -{ - HelpId = HID_OPTIONS_GENERAL ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "User Data" ; - FixedText FT_COMPANY - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 0 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "~Company" ; - }; - Edit ED_COMPANY - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_COMPANY"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 0 ) ) ; - Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ; - }; - FixedText FT_NAME - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "First/Last ~name/Initials" ; - }; - FixedText FT_NAME_RUSS - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Hide = TRUE; - Text [ en-US ] = "Last Name/First name/Father's name/Initials"; - }; - FixedText FT_NAME_EASTERN - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 1 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Hide = TRUE; - Text [ en-US ] = "Last/First ~name/Initials" ; - }; - Edit ED_FATHERNAME - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_FATHERNAME"; - Border = TRUE ; - Hide = TRUE; - Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ; - Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ; - }; - Edit ED_FIRSTNAME - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_FIRSTNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 1 ) ) ; - Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ; - }; - Edit ED_NAME - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID+NAMELEN-8+HSPACE , LINE ( 1 ) ) ; - Size = MAP_APPFONT ( NAMELEN-8 , LINEH ) ; - }; - Edit ED_SHORTNAME - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_SHORTNAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID+2* ( NAMELEN-8+HSPACE ) , LINE ( 1 ) ) ; - Size = MAP_APPFONT ( RIGHT- ( MID+2* ( NAMELEN-8+HSPACE ) ) , LINEH ) ; - }; - FixedText FT_STREET - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "~Street" ; - }; - FixedText FT_STREET_RUSS - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 2 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Hide = TRUE; - Text [ en-US ] = "Street/Apartment number"; - }; - Edit ED_STREET - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_STREET"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ; - Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ; - }; - Edit ED_APARTMENTNR - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_APARTMENTNR"; - Border = TRUE ; - Hide = TRUE; - Pos = MAP_APPFONT ( MID , LINE ( 2 ) ) ; - Size = MAP_APPFONT ( RIGHT-MID , LINEH ) ; - }; - FixedText FT_CITY - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 3 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Zip/City"; - }; - Edit ED_PLZ - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_PLZ"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ; - Size = MAP_APPFONT ( 24 , LINEH ) ; - }; - Edit ED_CITY - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_CITY"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID + 24 + HSPACE , LINE ( 3 ) ) ; - Size = MAP_APPFONT ( RIGHT - ( MID + 24 + HSPACE ) , LINEH ) ; - }; - Edit ED_US_CITY - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_US_CITY"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 3 ) ) ; - Size = MAP_APPFONT ( 90 , LINEH ) ; - }; - Edit ED_US_STATE - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_US_STATE"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID + 90 + HSPACE, LINE ( 3 ) ) ; - Size = MAP_APPFONT ( 30 , LINEH ) ; - }; - Edit ED_US_ZIPCODE - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_US_ZIPCODE"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID + 90 + HSPACE + 30 + HSPACE, LINE ( 3 ) ) ; - Size = MAP_APPFONT ( RIGHT - ( MID + 90 + HSPACE + 30 + HSPACE ) , LINEH ) ; - }; - FixedText FT_COUNTRY - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 4 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Country/Region"; - }; - Edit ED_COUNTRY - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_COUNTRY"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 4 ) ) ; - Size = MAP_APPFONT ( RIGHT - MID , LINEH ) ; - }; - FixedText FT_TITLEPOS - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 5 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "~Title/Position" ; - }; - Edit ED_TITLE - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_TITLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 5 ) ) ; - Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ; - }; - Edit ED_POSITION - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_POSITION"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 5 ) ) ; - Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ; - }; - FixedText FT_PHONE - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 6 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - Text [ en-US ] = "Tel. (Home/Work)" ; - LeftLabel = TRUE ; - }; - Edit ED_TELPRIVAT - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_TELPRIVAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 6 ) ) ; - Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ; - }; - Edit ED_TELCOMPANY - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_TELCOMPANY"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 6 ) ) ; - Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ; - }; - FixedText FT_FAXMAIL - { - Pos = MAP_APPFONT ( LEFT , FLINE ( 7 ) ) ; - Size = MAP_APPFONT ( MID-LEFT-2 , FLINEH ) ; - LeftLabel = TRUE ; - Text [ en-US ] = "Fa~x / E-mail" ; - }; - Edit ED_FAX - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_FAX"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID , LINE ( 7 ) ) ; - Size = MAP_APPFONT ( NAMELEN-1 , LINEH ) ; - }; - Edit ED_EMAIL - { - HelpID = "cui:Edit:RID_SFXPAGE_GENERAL:ED_EMAIL"; - Border = TRUE ; - Pos = MAP_APPFONT ( MID+NAMELEN-1+HSPACE , LINE ( 7 ) ) ; - Size = MAP_APPFONT ( RIGHT- ( MID+NAMELEN-1+HSPACE ) , LINEH ) ; - }; - FixedLine GB_ADDRESS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Address " ; - }; - CheckBox CB_USEDATA - { - HelpID = "cui:CheckBox:RID_SFXPAGE_GENERAL:CB_USEDATA"; - Pos = MAP_APPFONT ( 6 , 122 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Hide = TRUE; - Text [ en-US ] = "Use data for document properties"; - }; - - // extra Resourcen f"ur die amerikanische Postadresse - String STR_US_STATE - { - Text [ en-US ] = "City/State/Zip"; - }; - String STR_QUERY_REG - { - Text [ en-US ] = "Note that street, Zip code and city are used to generate the registration key. You will not be able to change the user data again until the registration has been carried out. Do you want to modify the user data now?"; - }; -}; - -// RID_SVXQB_CHANGEDATA --------------------------------------------------- - -QueryBox RID_SVXQB_CHANGEDATA -{ - BUTTONS = WB_YES_NO ; - DEFBUTTON = WB_DEF_NO ; - Message [ en-US ] = "The User Data have been changed.\nNote that, if you continue, the registration key will become invalid.\nTherefore, a new registration key is needed within 30 days.\nYou can find the registration form in the menu Help - Registration...\nDo you really want to change your User Data?"; -}; - - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx deleted file mode 100644 index ac63bd9c9..000000000 --- a/cui/source/options/opthtml.cxx +++ /dev/null @@ -1,246 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include "opthtml.hxx" -#include "opthtml.hrc" -#include -#include "helpid.hrc" -#include -#include - -// Umwandlung der Modi zu den Positionen in der Listbox -const sal_uInt16 aPosToExportArr[] = -{ - HTML_CFG_HTML32, - HTML_CFG_MSIE_40, - HTML_CFG_NS40, - HTML_CFG_WRITER -}; - -//#define DEPRECATED_ENTRY 0xFFFF - -const sal_uInt16 aExportToPosArr[] = -{ - 0, //HTML 3.2 - 1, //MS Internet Explorer 4.0 - 3, //StarWriter - 2 //Netscape Navigator 4.0 -}; -// ----------------------------------------------------------------------- - -OfaHtmlTabPage::OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_OFAPAGE_HTMLOPT ), rSet ), - aFontSizeGB ( this, CUI_RES( GB_FONTSIZE ) ), - aSize1FT ( this, CUI_RES( FT_SIZE1 ) ), - aSize1NF ( this, CUI_RES( NF_SIZE1 ) ), - aSize2FT ( this, CUI_RES( FT_SIZE2 ) ), - aSize2NF ( this, CUI_RES( NF_SIZE2 ) ), - aSize3FT ( this, CUI_RES( FT_SIZE3 ) ), - aSize3NF ( this, CUI_RES( NF_SIZE3 ) ), - aSize4FT ( this, CUI_RES( FT_SIZE4 ) ), - aSize4NF ( this, CUI_RES( NF_SIZE4 ) ), - aSize5FT ( this, CUI_RES( FT_SIZE5 ) ), - aSize5NF ( this, CUI_RES( NF_SIZE5 ) ), - aSize6FT ( this, CUI_RES( FT_SIZE6 ) ), - aSize6NF ( this, CUI_RES( NF_SIZE6 ) ), - aSize7FT ( this, CUI_RES( FT_SIZE7 ) ), - aSize7NF ( this, CUI_RES( NF_SIZE7 ) ), - aImportGB ( this, CUI_RES( GB_IMPORT ) ), - aNumbersEnglishUSCB ( this, CUI_RES( CB_NUMBERS_ENGLISH_US ) ), - aUnknownTagCB ( this, CUI_RES( CB_UNKNOWN_TAGS ) ), - aIgnoreFontNamesCB( this, CUI_RES( CB_IGNORE_FONTNAMES ) ), - aExportGB ( this, CUI_RES( GB_EXPORT ) ), - aExportLB ( this, CUI_RES( LB_EXPORT ) ), - aStarBasicCB ( this, CUI_RES( CB_STARBASIC ) ), - aStarBasicWarningCB(this, CUI_RES( CB_STARBASIC_WARNING ) ), - aPrintExtensionCB( this,CUI_RES(CB_PRINT_EXTENSION )), - aSaveGrfLocalCB ( this, CUI_RES( CB_LOCAL_GRF ) ), - aCharSetFT ( this, CUI_RES( FT_CHARSET ) ), - aCharSetLB ( this, CUI_RES( LB_CHARSET ) ) - -{ - FreeResource(); - - // replace placeholder with UI string from language list - String aText( aNumbersEnglishUSCB.GetText()); - String aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%ENGLISHUSLOCALE")); - xub_StrLen nPos; - if ((nPos = aText.Search( aPlaceholder)) != STRING_NOTFOUND) - { - SvtLanguageTable aLangTab; - const String& rStr = aLangTab.GetString( LANGUAGE_ENGLISH_US); - if (rStr.Len()) - { - aText.Replace( nPos, aPlaceholder.Len(), rStr); - aNumbersEnglishUSCB.SetText( aText); - } - } - - aExportLB.SetSelectHdl(LINK(this, OfaHtmlTabPage, ExportHdl_Impl)); - aStarBasicCB.SetClickHdl(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl)); - - // initialize the characterset listbox - aCharSetLB.FillWithMimeAndSelectBest(); -} - -OfaHtmlTabPage::~OfaHtmlTabPage() -{ -} - -SfxTabPage* OfaHtmlTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return new OfaHtmlTabPage(pParent, rAttrSet); -} - -sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& ) -{ - SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); - if(aSize1NF.GetSavedValue() != aSize1NF.GetText()) - rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF.GetValue()); - if(aSize2NF.GetSavedValue() != aSize2NF.GetText()) - rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF.GetValue()); - if(aSize3NF.GetSavedValue() != aSize3NF.GetText()) - rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF.GetValue()); - if(aSize4NF.GetSavedValue() != aSize4NF.GetText()) - rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF.GetValue()); - if(aSize5NF.GetSavedValue() != aSize5NF.GetText()) - rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF.GetValue()); - if(aSize6NF.GetSavedValue() != aSize6NF.GetText()) - rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF.GetValue()); - if(aSize7NF.GetSavedValue() != aSize7NF.GetText()) - rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF.GetValue()); - - if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue()) - rHtmlOpt.SetNumbersEnglishUS(aNumbersEnglishUSCB.IsChecked()); - - if(aUnknownTagCB.IsChecked() != aUnknownTagCB.GetSavedValue()) - rHtmlOpt.SetImportUnknown(aUnknownTagCB.IsChecked()); - - if(aIgnoreFontNamesCB.IsChecked() != aIgnoreFontNamesCB.GetSavedValue()) - rHtmlOpt.SetIgnoreFontFamily(aIgnoreFontNamesCB.IsChecked()); - - if(aExportLB.GetSelectEntryPos() != aExportLB.GetSavedValue()) - rHtmlOpt.SetExportMode(aPosToExportArr[aExportLB.GetSelectEntryPos()]); - - if(aStarBasicCB.IsChecked() != aStarBasicCB.GetSavedValue()) - rHtmlOpt.SetStarBasic(aStarBasicCB.IsChecked()); - - if(aStarBasicWarningCB.IsChecked() != aStarBasicWarningCB.GetSavedValue()) - rHtmlOpt.SetStarBasicWarning(aStarBasicWarningCB.IsChecked()); - - if(aSaveGrfLocalCB.IsChecked() != aSaveGrfLocalCB.GetSavedValue()) - rHtmlOpt.SetSaveGraphicsLocal(aSaveGrfLocalCB.IsChecked()); - - if(aPrintExtensionCB.IsChecked() != aPrintExtensionCB.GetSavedValue()) - rHtmlOpt.SetPrintLayoutExtension(aPrintExtensionCB.IsChecked()); - - if( aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() ) - rHtmlOpt.SetTextEncoding( aCharSetLB.GetSelectTextEncoding() ); - - return sal_False; -} - -void OfaHtmlTabPage::Reset( const SfxItemSet& ) -{ - SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); - aSize1NF.SetValue(rHtmlOpt.GetFontSize(0)); - aSize2NF.SetValue(rHtmlOpt.GetFontSize(1)); - aSize3NF.SetValue(rHtmlOpt.GetFontSize(2)); - aSize4NF.SetValue(rHtmlOpt.GetFontSize(3)); - aSize5NF.SetValue(rHtmlOpt.GetFontSize(4)); - aSize6NF.SetValue(rHtmlOpt.GetFontSize(5)); - aSize7NF.SetValue(rHtmlOpt.GetFontSize(6)); - aNumbersEnglishUSCB.Check(rHtmlOpt.IsNumbersEnglishUS()); - aUnknownTagCB.Check(rHtmlOpt.IsImportUnknown()); - aIgnoreFontNamesCB.Check(rHtmlOpt.IsIgnoreFontFamily()); - sal_uInt16 nExport = rHtmlOpt.GetExportMode(); - if( nExport >= SAL_N_ELEMENTS( aExportToPosArr ) ) - nExport = 4; // default for bad config entry is NS 4.0 - sal_uInt16 nPosArr = aExportToPosArr[ nExport ]; -// if( nPosArr == DEPRECATED_ENTRY ) -// nPosArr = aExportToPosArr[ 4 ]; // again: NS 4.0 is default - aExportLB.SelectEntryPos( nPosArr ); - aExportLB.SaveValue(); - - ExportHdl_Impl(&aExportLB); - - aStarBasicCB .Check(rHtmlOpt.IsStarBasic()); - aStarBasicWarningCB .Check(rHtmlOpt.IsStarBasicWarning()); - aStarBasicWarningCB.Enable(!aStarBasicCB.IsChecked()); - aSaveGrfLocalCB.Check(rHtmlOpt.IsSaveGraphicsLocal()); - aPrintExtensionCB.Check(rHtmlOpt.IsPrintLayoutExtension()); - - aPrintExtensionCB.SaveValue(); - aStarBasicCB .SaveValue(); - aStarBasicWarningCB .SaveValue(); - aSaveGrfLocalCB.SaveValue(); - aSize1NF.SaveValue(); - aSize2NF.SaveValue(); - aSize3NF.SaveValue(); - aSize4NF.SaveValue(); - aSize5NF.SaveValue(); - aSize6NF.SaveValue(); - aSize7NF.SaveValue(); - aNumbersEnglishUSCB.SaveValue(); - aUnknownTagCB.SaveValue(); - aIgnoreFontNamesCB.SaveValue(); - - if( !rHtmlOpt.IsDefaultTextEncoding() && - aCharSetLB.GetSelectTextEncoding() != rHtmlOpt.GetTextEncoding() ) - aCharSetLB.SelectTextEncoding( rHtmlOpt.GetTextEncoding() ); -} - -IMPL_LINK(OfaHtmlTabPage, ExportHdl_Impl, ListBox*, pBox) -{ - sal_uInt16 nExport = aPosToExportArr[ pBox->GetSelectEntryPos() ]; - switch( nExport ) - { - case HTML_CFG_MSIE_40: - case HTML_CFG_NS40 : - case HTML_CFG_WRITER : - aPrintExtensionCB.Enable(sal_True); - break; - default: aPrintExtensionCB.Enable(sal_False); - } - - return 0; -} - -IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, CheckBox*, pBox) -{ - aStarBasicWarningCB.Enable(!pBox->IsChecked()); - return 0; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/opthtml.hrc b/cui/source/options/opthtml.hrc deleted file mode 100644 index dd01f9b12..000000000 --- a/cui/source/options/opthtml.hrc +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTHTML_HRC -#define _SVX_OPTHTML_HRC - -// defines ------------------------------------------------------------------ - -#define GB_FONTSIZE 1 -#define FT_SIZE1 2 -#define NF_SIZE1 3 -#define FT_SIZE2 4 -#define NF_SIZE2 5 -#define FT_SIZE3 6 -#define NF_SIZE3 7 -#define FT_SIZE4 8 -#define NF_SIZE4 9 -#define FT_SIZE5 10 -#define NF_SIZE5 11 -#define FT_SIZE6 12 -#define NF_SIZE6 13 -#define FT_SIZE7 14 -#define NF_SIZE7 15 -#define GB_IMPORT 20 -#define CB_UNKNOWN_TAGS 21 -#define CB_IGNORE_FONTNAMES 22 -#define CB_NUMBERS_ENGLISH_US 23 - -#define GB_EXPORT 30 -#define CB_STARBASIC 31 -#define CB_STARBASIC_WARNING 32 - -#define CB_LOCAL_GRF 37 -#define CB_PRINT_EXTENSION 38 -#define LB_EXPORT 39 -#define FT_CHARSET 40 -#define LB_CHARSET 41 - -#endif - diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx deleted file mode 100644 index 3d52b39ed..000000000 --- a/cui/source/options/opthtml.hxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_OPTHTML_HXX -#define _OFA_OPTHTML_HXX - -#include -#include -#include -#include -#include -#include -#include - -class OfaHtmlTabPage : public SfxTabPage -{ - FixedLine aFontSizeGB; - FixedText aSize1FT; - NumericField aSize1NF; - FixedText aSize2FT; - NumericField aSize2NF; - FixedText aSize3FT; - NumericField aSize3NF; - FixedText aSize4FT; - NumericField aSize4NF; - FixedText aSize5FT; - NumericField aSize5NF; - FixedText aSize6FT; - NumericField aSize6NF; - FixedText aSize7FT; - NumericField aSize7NF; - - FixedLine aImportGB; - CheckBox aNumbersEnglishUSCB; - CheckBox aUnknownTagCB; - CheckBox aIgnoreFontNamesCB; - - FixedLine aExportGB; - ListBox aExportLB; - CheckBox aStarBasicCB; - CheckBox aStarBasicWarningCB; - CheckBox aPrintExtensionCB; - CheckBox aSaveGrfLocalCB; - FixedText aCharSetFT; - SvxTextEncodingBox aCharSetLB; - - DECL_LINK(ExportHdl_Impl, ListBox*); - DECL_LINK(CheckBoxHdl_Impl, CheckBox*); - - OfaHtmlTabPage(Window* pParent, const SfxItemSet& rSet); - virtual ~OfaHtmlTabPage(); -public: - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - -}; - - -#endif // - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/opthtml.src b/cui/source/options/opthtml.src deleted file mode 100644 index 06fd5d6c9..000000000 --- a/cui/source/options/opthtml.src +++ /dev/null @@ -1,303 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include ----------------------------------------------------------------- -#include "opthtml.hrc" -#include - - // RID_OFAPAGE_HTMLOPT ----------------------------------------------------- -TabPage RID_OFAPAGE_HTMLOPT -{ - HelpID = "cui:TabPage:RID_OFAPAGE_HTMLOPT"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedText FT_SIZE1 - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~1" ; - }; - NumericField NF_SIZE1 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE1"; - Pos = MAP_APPFONT ( 45 , 14 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE2 - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~2" ; - }; - NumericField NF_SIZE2 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE2"; - Pos = MAP_APPFONT ( 45 , 30 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE3 - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~3" ; - }; - NumericField NF_SIZE3 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE3"; - Pos = MAP_APPFONT ( 45 , 46 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE4 - { - Pos = MAP_APPFONT ( 12 , 64 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~4" ; - }; - NumericField NF_SIZE4 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE4"; - Pos = MAP_APPFONT ( 45 , 62 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE5 - { - Pos = MAP_APPFONT ( 12 , 80 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~5" ; - }; - NumericField NF_SIZE5 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE5"; - Pos = MAP_APPFONT ( 45 , 78 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE6 - { - Pos = MAP_APPFONT ( 12 , 96 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~6" ; - }; - NumericField NF_SIZE6 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE6"; - Pos = MAP_APPFONT ( 45 , 94 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedText FT_SIZE7 - { - Pos = MAP_APPFONT ( 12 , 112 ) ; - Size = MAP_APPFONT ( 30 , 8 ) ; - Text [ en-US ] = "Size ~7" ; - }; - NumericField NF_SIZE7 - { - HelpID = "cui:NumericField:RID_OFAPAGE_HTMLOPT:NF_SIZE7"; - Pos = MAP_APPFONT ( 45 , 110 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 50 ; - Value = 1 ; - First = 1 ; - Last = 50 ; - SpinSize = 1 ; - }; - FixedLine GB_FONTSIZE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 75 , 8 ) ; - Text [ en-US ] = "Font sizes" ; - }; - FixedLine GB_IMPORT - { - Pos = MAP_APPFONT ( 87 , 3 ) ; - Size = MAP_APPFONT ( 167 , 8 ) ; - Text [ en-US ] = "Import" ; - }; - CheckBox CB_NUMBERS_ENGLISH_US - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_NUMBERS_ENGLISH_US"; - Pos = MAP_APPFONT ( 93 , 14 ) ; - Size = MAP_APPFONT ( 161 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Use '%ENGLISHUSLOCALE' locale for numbers" ; - }; - CheckBox CB_UNKNOWN_TAGS - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_UNKNOWN_TAGS"; - Pos = MAP_APPFONT ( 93 , 28 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Import unknown HTML tags as fields" ; - }; - CheckBox CB_IGNORE_FONTNAMES - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_IGNORE_FONTNAMES"; - Pos = MAP_APPFONT ( 93 , 42 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Ignore ~font settings" ; - }; - FixedLine GB_EXPORT - { - Pos = MAP_APPFONT ( 87 , 58 ) ; - Size = MAP_APPFONT ( 167 , 8 ) ; - Text [ en-US ] = "Export" ; - }; - ListBox LB_EXPORT - { - HelpID = "cui:ListBox:RID_OFAPAGE_HTMLOPT:LB_EXPORT"; - Pos = MAP_APPFONT ( 93 , 69 ) ; - Size = MAP_APPFONT ( 155 , 50 ) ; - Border = TRUE ; - DropDown = TRUE ; - StringList = - { - < "HTML 3.2" ; > ; - < "Microsoft Internet Explorer" ; > ; - < "Netscape Navigator"; > ; - < "%PRODUCTNAME Writer" ; > ; - }; - }; - CheckBox CB_STARBASIC - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_STARBASIC"; - Pos = MAP_APPFONT ( 93 , 88 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - Text = "%PRODUCTNAME ~Basic" ; - }; - CheckBox CB_STARBASIC_WARNING - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_STARBASIC_WARNING"; - Pos = MAP_APPFONT ( 99 , 102 ) ; - Size = MAP_APPFONT ( 149 , 10 ) ; - Text [ en-US ] = "Display ~warning"; - }; - CheckBox CB_PRINT_EXTENSION - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_PRINT_EXTENSION"; - Pos = MAP_APPFONT ( 93 , 116 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - Text [ en-US ] = "~Print layout" ; - }; - CheckBox CB_LOCAL_GRF - { - HelpID = "cui:CheckBox:RID_OFAPAGE_HTMLOPT:CB_LOCAL_GRF"; - Pos = MAP_APPFONT ( 93 , 130 ) ; - Size = MAP_APPFONT ( 155 , 10 ) ; - Text [ en-US ] = "~Copy local graphics to Internet" ; - }; - - FixedText FT_CHARSET - { - Pos = MAP_APPFONT ( 93 , 144 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "Character set"; - }; - ListBox LB_CHARSET - { - HelpID = "cui:ListBox:RID_OFAPAGE_HTMLOPT:LB_CHARSET"; - Pos = MAP_APPFONT ( 162 , 143 ) ; - Size = MAP_APPFONT ( 86 , 61 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; -}; - // ******************************************************************* EOF diff --git a/cui/source/options/optimprove.cxx b/cui/source/options/optimprove.cxx deleted file mode 100644 index 0937e5900..000000000 --- a/cui/source/options/optimprove.cxx +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#define _SVX_OPTIMPROVE_CXX - -#include -#include -#include -#include -#include "optimprove.hrc" -#include "helpid.hrc" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace lang = ::com::sun::star::lang; -namespace uno = ::com::sun::star::uno; -using namespace com::sun::star::system; - -// class SvxImprovementPage ---------------------------------------------- - -SvxImprovementPage::SvxImprovementPage( Window* pParent ) : - - TabPage( pParent, CUI_RES( RID_SVXPAGE_IMPROVEMENT ) ), - - m_aImproveFL ( this, CUI_RES( FL_IMPROVE ) ), - m_aInvitationFT ( this, CUI_RES( FT_INVITATION ) ), - m_aYesRB ( this, CUI_RES( RB_YES ) ), - m_aNoRB ( this, CUI_RES( RB_NO ) ), - m_aDataFL ( this, CUI_RES( FL_DATA ) ), - m_aNumberOfReportsFT ( this, CUI_RES( FT_NR_REPORTS ) ), - m_aNumberOfReportsValueFT ( this, CUI_RES( FT_NR_REPORTS_VALUE ) ), - m_aNumberOfActionsFT ( this, CUI_RES( FT_NR_ACTIONS ) ), - m_aNumberOfActionsValueFT ( this, CUI_RES( FT_NR_ACTIONS_VALUE ) ), - m_aShowDataPB ( this, CUI_RES( PB_SHOWDATA ) ), - - m_sInfo ( CUI_RES( STR_INFO ) ), - m_sMoreInfo ( CUI_RES( STR_MOREINFO ) ) - -{ - FreeResource(); - - m_aInvitationFT.Show(); - m_aDataFL.Hide(); - m_aNumberOfReportsFT.Hide(); - m_aNumberOfReportsValueFT.Hide(); - m_aNumberOfActionsFT.Hide(); - m_aNumberOfActionsValueFT.Hide(); - m_aShowDataPB.Hide(); - - Size aNewSize = m_aInvitationFT.GetSizePixel(); - const long nMinWidth = m_aYesRB.CalcMinimumSize().Width(); - const long nNewWidth = std::max( aNewSize.Width() * 4 / 5, nMinWidth ); - const long nWDelta = aNewSize.Width() - nNewWidth; - aNewSize.Width() = nNewWidth; - const Size aCalcSize = m_aInvitationFT.CalcMinimumSize( nNewWidth ); - const long nHDelta = aCalcSize.Height() - aNewSize.Height(); - aNewSize.Height() = aCalcSize.Height(); - m_aInvitationFT.SetSizePixel( aNewSize ); - - aNewSize = m_aYesRB.GetSizePixel(); - aNewSize.Width() = nNewWidth; - Point aNewPos = m_aYesRB.GetPosPixel(); - aNewPos.Y() += nHDelta; - m_aYesRB.SetPosSizePixel( aNewPos, aNewSize ); - aNewSize = m_aNoRB.GetSizePixel(); - aNewSize.Width() = nNewWidth; - aNewPos = m_aNoRB.GetPosPixel(); - aNewPos.Y() += nHDelta; - m_aNoRB.SetPosSizePixel( aNewPos, aNewSize ); - aNewSize = m_aImproveFL.GetSizePixel(); - aNewSize.Width() -= nWDelta; - m_aImproveFL.SetSizePixel( aNewSize ); - - Size aSize = GetOutputSizePixel(); - aSize.Width() -= nWDelta; - aSize.Height() = m_aDataFL.GetPosPixel().Y(); - aSize.Height() += nHDelta; - SetSizePixel( aSize ); -} - -// ----------------------------------------------------------------------- - -SvxImprovementPage::~SvxImprovementPage() -{ -} - -// class SvxImprovementDialog -------------------------------------------- - -SvxImprovementDialog::SvxImprovementDialog( Window* pParent, const String& rInfoURL ) : - - SfxSingleTabDialog( pParent, RID_SVXPAGE_IMPROVEMENT, rInfoURL ), - - m_pPage( NULL ) - -{ - m_pPage = new SvxImprovementPage( this ); - SetInfoLink( LINK( this, SvxImprovementDialog, HandleHyperlink ) ); - SetPage( m_pPage ); - if ( GetOKButton() ) - GetOKButton()->SetClickHdl( LINK( this, SvxImprovementDialog, HandleOK ) ); -} - -IMPL_LINK( SvxImprovementDialog, HandleHyperlink, svt::FixedHyperlinkImage*, pHyperlinkImage ) -{ - ::rtl::OUString sURL( pHyperlinkImage->GetURL() ); - - if ( sURL.getLength() > 0 ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xSMGR = - ::comphelper::getProcessServiceFactory(); - uno::Reference< XSystemShellExecute > xSystemShell( - xSMGR->createInstance( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), - uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - { - xSystemShell->execute( - sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - - return 0; -} - -IMPL_LINK( SvxImprovementDialog, HandleOK, OKButton*, EMPTYARG ) -{ - uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - uno::Reference< com::sun::star::oooimprovement::XCoreController > core_c( - xSMGR->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController") ) ), - uno::UNO_QUERY); - if(core_c.is()) - { - ::comphelper::ConfigurationHelper::writeDirectKey( - xSMGR, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings") ), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Participation") ), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowedInvitation") ), - uno::makeAny( true ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - ::comphelper::ConfigurationHelper::writeDirectKey( - xSMGR, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings") ), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Participation") ), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InvitationAccepted") ), - uno::makeAny( m_pPage->IsYesChecked() ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - // TODO: refactor - ::comphelper::UiEventsLogger::reinit(); - ::tools::InitTestToolLib(); - } - EndDialog( RET_OK ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optimprove.hrc b/cui/source/options/optimprove.hrc deleted file mode 100644 index c7f191fe0..000000000 --- a/cui/source/options/optimprove.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTIMPROVE_HRC -#define _SVX_OPTIMPROVE_HRC - -// defines --------------------------------------------------------------- - -#define FL_IMPROVE 10 -#define FT_INVITATION 11 -#define RB_YES 12 -#define RB_NO 13 -#define FL_DATA 14 -#define FT_NR_REPORTS 15 -#define FT_NR_REPORTS_VALUE 16 -#define FT_NR_ACTIONS 17 -#define FT_NR_ACTIONS_VALUE 18 -#define PB_SHOWDATA 19 -#define FI_INFO 20 -#define WIN_INFO 21 -#define BTN_OK 22 - -#define STR_INFO 10 -#define STR_MOREINFO 11 - -#endif - diff --git a/cui/source/options/optimprove.src b/cui/source/options/optimprove.src deleted file mode 100644 index 15d7a643f..000000000 --- a/cui/source/options/optimprove.src +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include -------------------------------------------------------------- - -#include "optimprove.hrc" -#include -#include "helpid.hrc" -#include - -TabPage RID_SVXPAGE_IMPROVEMENT -{ - HelpId = "cui:TabPage:RID_SVXPAGE_IMPROVEMENT" ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "%PRODUCTNAME Improvement Program" ; - FixedLine FL_IMPROVE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Improvement Program" ; - }; - FixedText FT_INVITATION - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 242 , 72 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "We invite you to join our %PRODUCTNAME Improvement Program to help optimize the quality of %PRODUCTNAME.\n\nIf you are willing to participate, we will collect anonymous statistics about how you use %PRODUCTNAME. The data is used to identify usage patterns.\n\nThe %PRODUCTNAME Improvement Program will not collect any personal data, or document content." ; - }; - RadioButton RB_YES - { - HelpID = "cui:RadioButton:RID_SVXPAGE_IMPROVEMENT:RB_YES"; - Pos = MAP_APPFONT ( 12 , 92 ) ; - Size = MAP_APPFONT ( 215 , 10 ) ; - Check = TRUE ; - Text [ en-US ] = "~Yes, I am willing to participate in the %PRODUCTNAME Improvement Program" ; - }; - RadioButton RB_NO - { - HelpID = "cui:RadioButton:RID_SVXPAGE_IMPROVEMENT:RB_NO"; - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 215 , 10 ) ; - Text [ en-US ] = "~No, I do not wish to participate" ; - }; - FixedImage FI_INFO - { - Pos = MAP_APPFONT ( 230 , 91 ) ; - Size = MAP_APPFONT ( 24 , 24 ) ; - Fixed = Image - { - ImageBitmap = Bitmap { File = "info.png"; }; - }; - }; - FixedLine FL_DATA - { - Pos = MAP_APPFONT ( 6 , 121 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Tracked Data" ; - }; - FixedText FT_NR_REPORTS - { - Pos = MAP_APPFONT ( 12 , 132 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Number of reports sent:" ; - }; - FixedText FT_NR_REPORTS_VALUE - { - Pos = MAP_APPFONT ( 111 , 132 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - FixedText FT_NR_ACTIONS - { - Pos = MAP_APPFONT ( 12 , 145 ) ; - Size = MAP_APPFONT ( 96 , 8 ) ; - Text [ en-US ] = "Number of tracked actions:" ; - }; - FixedText FT_NR_ACTIONS_VALUE - { - Pos = MAP_APPFONT ( 111 , 145 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - }; - PushButton PB_SHOWDATA - { - HelpID = "cui:PushButton:RID_SVXPAGE_IMPROVEMENT:PB_SHOWDATA"; - Pos = MAP_APPFONT ( 12 , 161 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Show Data" ; - }; - String STR_INFO - { - Text [ en-US ] = "Help Optimize the Quality of %PRODUCTNAME" ; - }; - String STR_MOREINFO - { - Text [ en-US ] = "More Information" ; - }; -}; - diff --git a/cui/source/options/optimprove2.cxx b/cui/source/options/optimprove2.cxx deleted file mode 100644 index 132247d6f..000000000 --- a/cui/source/options/optimprove2.cxx +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#define _SVX_OPTIMPROVE_CXX - -#include -#include -#include - -#include "optimprove.hrc" -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define C2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -namespace beans = ::com::sun::star::beans; -namespace lang = ::com::sun::star::lang; -namespace uno = ::com::sun::star::uno; -namespace util = ::com::sun::star::util; -using namespace com::sun::star::system; - - -namespace -{ - bool lcl_doesLogfileExist(const ::rtl::OUString& sLogPath) - { - ::rtl::OUString sLogFile( sLogPath ); - sLogFile += C2S("/Current.csv"); - ::osl::File aLogFile(sLogFile); - return aLogFile.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None; - } -} - -// class SvxImprovementOptionsPage --------------------------------------- - -SvxImprovementOptionsPage::SvxImprovementOptionsPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_IMPROVEMENT ), rSet ), - - m_aImproveFL ( this, CUI_RES( FL_IMPROVE ) ), - m_aInvitationFT ( this, CUI_RES( FT_INVITATION ) ), - m_aYesRB ( this, CUI_RES( RB_YES ) ), - m_aNoRB ( this, CUI_RES( RB_NO ) ), - m_aInfoFI ( this, CUI_RES( FI_INFO ) ), - m_aDataFL ( this, CUI_RES( FL_DATA ) ), - m_aNumberOfReportsFT ( this, CUI_RES( FT_NR_REPORTS ) ), - m_aNumberOfReportsValueFT ( this, CUI_RES( FT_NR_REPORTS_VALUE ) ), - m_aNumberOfActionsFT ( this, CUI_RES( FT_NR_ACTIONS ) ), - m_aNumberOfActionsValueFT ( this, CUI_RES( FT_NR_ACTIONS_VALUE ) ), - m_aShowDataPB ( this, CUI_RES( PB_SHOWDATA ) ), - - m_sInfo ( CUI_RES( STR_INFO ) ), - m_sMoreInfo ( CUI_RES( STR_MOREINFO ) ) - -{ - FreeResource(); - - m_aInfoFI.SetURL( C2S( "www.sun.com/privacy/" ) ); - m_aInfoFI.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleHyperlink ) ); - m_aShowDataPB.SetClickHdl( LINK( this, SvxImprovementOptionsPage, HandleShowData ) ); -} - -SvxImprovementOptionsPage::~SvxImprovementOptionsPage() -{ -} - -IMPL_LINK( SvxImprovementOptionsPage, HandleHyperlink, svt::FixedHyperlinkImage*, EMPTYARG ) -{ - ::rtl::OUString sURL( m_aInfoFI.GetURL() ); - - if ( sURL.getLength() > 0 ) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xSMGR = - ::comphelper::getProcessServiceFactory(); - uno::Reference< XSystemShellExecute > xSystemShell( - xSMGR->createInstance( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), - uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - { - xSystemShell->execute( - sURL, ::rtl::OUString(), SystemShellExecuteFlags::DEFAULTS ); - } - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - - return 0; -} - -IMPL_LINK( SvxImprovementOptionsPage, HandleShowData, PushButton*, EMPTYARG ) -{ - uno::Reference < uno::XInterface > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - C2S("com.sun.star.frame.Desktop") ), uno::UNO_QUERY ); - if ( xDesktop.is() ) - { - ::rtl::OUString sLogFile( m_sLogPath ); - sLogFile += C2S("/Current.csv"); - uno::Sequence< beans::PropertyValue > aArgs(3); - aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName") ); - aArgs[0].Value = uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text - txt - csv (StarCalc)") ) ); - aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FilterOptions") ); - aArgs[1].Value = uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("44,34,12,1,") ) ); - aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); - aArgs[2].Value = uno::makeAny(true); - - uno::Reference< lang::XComponent > xDoc = ::comphelper::SynchronousDispatch::dispatch( - xDesktop, sLogFile, C2S("_default"), 0, aArgs ); - if ( xDoc.is() ) - { - dynamic_cast(GetParent())->EndDialog( RET_CANCEL ); - return 1; - } - } - - return 0; -} - -SfxTabPage* SvxImprovementOptionsPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxImprovementOptionsPage( pParent, rSet ); -} - -sal_Bool SvxImprovementOptionsPage::FillItemSet( SfxItemSet& /*rSet*/ ) -{ - uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - uno::Reference< uno::XInterface > xConfig; - - try - { - xConfig = ::comphelper::ConfigurationHelper::openConfig( - xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"), - ::comphelper::ConfigurationHelper::E_STANDARD ); - ::comphelper::ConfigurationHelper::writeRelativeKey( - xConfig, C2S("Participation"), C2S("ShowedInvitation"), uno::makeAny( true ) ); - ::comphelper::ConfigurationHelper::writeRelativeKey( - xConfig, C2S("Participation"), C2S("InvitationAccepted"), uno::makeAny( m_aYesRB.IsChecked() != sal_False ) ); - ::comphelper::ConfigurationHelper::flush( xConfig ); - // TODO: refactor - ::comphelper::UiEventsLogger::reinit(); - ::tools::InitTestToolLib(); - } - catch( uno::Exception& ) - { - } - - return sal_False; -} - -void SvxImprovementOptionsPage::Reset( const SfxItemSet& /*rSet*/ ) -{ - uno::Reference< lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - uno::Reference< com::sun::star::oooimprovement::XCore > xCore( - xSMGR->createInstance( C2S("com.sun.star.oooimprovement.Core") ), - uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xConfig; - - try - { - m_aNoRB.Check(); - xConfig = ::comphelper::ConfigurationHelper::openConfig( - xSMGR, C2S("/org.openoffice.Office.OOoImprovement.Settings"), - ::comphelper::ConfigurationHelper::E_READONLY ); - if ( xConfig.is() ) - { - bool bYesChecked = false; - uno::Any aAny = ::comphelper::ConfigurationHelper:: - readRelativeKey( xConfig, C2S("Participation"), C2S("ShowedInvitation") ); - if ( ( aAny >>= bYesChecked ) && bYesChecked ) - { - bool bTemp = false; - aAny = ::comphelper::ConfigurationHelper:: - readRelativeKey( xConfig, C2S("Participation"), C2S("InvitationAccepted") ); - if ( aAny >>= bTemp ) - { - bYesChecked &= bTemp; - if ( bYesChecked ) - m_aYesRB.Check(); - } - } - - ::rtl::OUString sURL; - aAny = ::comphelper::ConfigurationHelper:: - readRelativeKey( xConfig, C2S("Participation"), C2S("HelpUrl") ); - if ( aAny >>= sURL ) - m_aInfoFI.SetURL( sURL ); - - sal_Int32 nCount = 0; - aAny = ::comphelper::ConfigurationHelper:: - readRelativeKey( xConfig, C2S("Counters"), C2S("UploadedReports") ); - if ( aAny >>= nCount ) - m_aNumberOfReportsValueFT.SetText( String::CreateFromInt32( nCount ) ); - aAny = ::comphelper::ConfigurationHelper:: - readRelativeKey( xConfig, C2S("Counters"), C2S("LoggedEvents") ); - if ( aAny >>= nCount ) - { - if ( xCore.is() ) - nCount += xCore->getSessionLogEventCount(); - m_aNumberOfActionsValueFT.SetText( String::CreateFromInt32( nCount ) ); - } - - ::rtl::OUString sPath; - aAny = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, C2S("/org.openoffice.Office.Logging"), C2S("OOoImprovement"), - C2S("LogPath"), ::comphelper::ConfigurationHelper::E_READONLY ); - if ( aAny >>= sPath ) - { - uno::Reference< util::XStringSubstitution > xSubst( - xSMGR->createInstance( C2S("com.sun.star.util.PathSubstitution") ), - uno::UNO_QUERY ); - if ( xSubst.is() ) - sPath = xSubst->substituteVariables( sPath, sal_False ); - m_sLogPath = sPath; - m_aShowDataPB.Enable(lcl_doesLogfileExist(m_sLogPath)); - } - } - } - catch( uno::Exception& ) - { - m_aShowDataPB.Enable(false); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx deleted file mode 100644 index a1ee71025..000000000 --- a/cui/source/options/optinet2.cxx +++ /dev/null @@ -1,1469 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_OPTINET2_CXX -#include -#include "optinet2.hxx" -#include -#include -#include "optinet2.hrc" -#include "helpid.hrc" -#include -#include -#include // slot ids, mostly for changetracking - -// for security TP -#include - -#ifdef UNX -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include "com/sun/star/task/XMasterPasswordHandling2.hpp" -#include "com/sun/star/task/XPasswordContainer.hpp" -#include "securityoptions.hxx" -#include "webconninfo.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::sfx2; -using ::rtl::OUString; - - -// define ---------------------------------------------------------------- - -// different delimiter for Unix (:) and Windows (;) - -#ifdef UNX -#define CLASSPATH_DELIMITER ':' -#else -#define CLASSPATH_DELIMITER ';' -#endif - -// static ---------------------------------------------------------------- - -#define C2U(cChar) OUString::createFromAscii(cChar) - -#define INET_SEARCH_TOKEN '"' -#define RET_ALL ((short)200) -#define CFG_READONLY_DEFAULT FALSE - -#include - -SV_IMPL_PTRARR( SfxFilterPtrArr, SfxFilterPtr ) - -const char* SEARCHENGINE_INI = "srcheng.ini"; -const char* SEARCHENGINE_GROUP = "SearchEngines-$(vlang)"; - -// ----------------------------------------------------------------------- - -void SvxNoSpaceEdit::KeyInput( const KeyEvent& rKEvent ) -{ - if ( bOnlyNumeric ) - { - const KeyCode& rKeyCode = rKEvent.GetKeyCode(); - sal_uInt16 nGroup = rKeyCode.GetGroup(); - sal_uInt16 nKey = rKeyCode.GetCode(); - sal_Bool bValid = ( KEYGROUP_NUM == nGroup || KEYGROUP_CURSOR == nGroup || - ( KEYGROUP_MISC == nGroup && ( nKey < KEY_ADD || nKey > KEY_EQUAL ) ) ); - if ( !bValid && ( rKeyCode.IsMod1() && ( - KEY_A == nKey || KEY_C == nKey || KEY_V == nKey || KEY_X == nKey || KEY_Z == nKey ) ) ) - // Erase, Copy, Paste, Select All und Undo soll funktionieren - bValid = sal_True; - - if ( bValid ) - Edit::KeyInput(rKEvent); - } - else if( rKEvent.GetKeyCode().GetCode() != KEY_SPACE ) - Edit::KeyInput(rKEvent); -} - -// ----------------------------------------------------------------------- - -void SvxNoSpaceEdit::Modify() -{ - Edit::Modify(); - - if ( bOnlyNumeric ) - { - XubString aValue = GetText(); - - if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX ) - // der H�chstwert einer Portnummer ist USHRT_MAX - ErrorBox( this, CUI_RES( RID_SVXERR_OPT_PROXYPORTS ) ).Execute(); - } -} - -/********************************************************************/ -/* */ -/* SvxProxyTabPage */ -/* */ -/********************************************************************/ - -SvxProxyTabPage::SvxProxyTabPage(Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_PROXY ), rSet ), - aOptionGB (this, CUI_RES(GB_SETTINGS)), - - aProxyModeFT (this, CUI_RES(FT_PROXYMODE)), - aProxyModeLB (this, CUI_RES(LB_PROXYMODE)), - - aHttpProxyFT (this, CUI_RES( FT_HTTP_PROXY )), - aHttpProxyED (this, CUI_RES( ED_HTTP_PROXY )), - aHttpPortFT (this, CUI_RES( FT_HTTP_PORT )), - aHttpPortED (this, CUI_RES( ED_HTTP_PORT ), sal_True), - - aHttpsProxyFT (this, CUI_RES( FT_HTTPS_PROXY )), - aHttpsProxyED (this, CUI_RES( ED_HTTPS_PROXY )), - aHttpsPortFT (this, CUI_RES( FT_HTTPS_PORT )), - aHttpsPortED (this, CUI_RES( ED_HTTPS_PORT ), sal_True), - - aFtpProxyFT (this, CUI_RES( FT_FTP_PROXY )), - aFtpProxyED (this, CUI_RES( ED_FTP_PROXY )), - aFtpPortFT (this, CUI_RES( FT_FTP_PORT )), - aFtpPortED (this, CUI_RES( ED_FTP_PORT ), sal_True), - - aNoProxyForFT (this, CUI_RES( FT_NOPROXYFOR )), - aNoProxyForED (this, CUI_RES( ED_NOPROXYFOR )), - aNoProxyDescFT (this, CUI_RES( ED_NOPROXYDESC )), - sFromBrowser ( CUI_RES( ST_PROXY_FROM_BROWSER ) ), - aProxyModePN(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType")), - aHttpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName")), - aHttpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort")), - aHttpsProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName")), - aHttpsPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort")), - aFtpProxyPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName")), - aFtpPortPN(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort")), - aNoProxyDescPN(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy")) -{ - FreeResource(); - - aHttpPortED.SetMaxTextLen(5); - aHttpsPortED.SetMaxTextLen(5); - aFtpPortED.SetMaxTextLen(5); - Link aLink = LINK( this, SvxProxyTabPage, LoseFocusHdl_Impl ); - aHttpPortED.SetLoseFocusHdl( aLink ); - aHttpsPortED.SetLoseFocusHdl( aLink ); - aFtpPortED.SetLoseFocusHdl( aLink ); - - aProxyModeLB.SetSelectHdl(LINK( this, SvxProxyTabPage, ProxyHdl_Impl )); - - Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory()); - - if( xServiceManager.is() ) - { - try - { - Reference< com::sun::star::lang::XMultiServiceFactory > xConfigurationProvider = - Reference< com::sun::star::lang::XMultiServiceFactory > ( xServiceManager->createInstance( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ), - UNO_QUERY_THROW); - - OUString aConfigRoot(RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings" ) ); - - beans::PropertyValue aProperty; - aProperty.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); - aProperty.Value = makeAny( aConfigRoot ); - - Sequence< Any > aArgumentList( 1 ); - aArgumentList[0] = makeAny( aProperty ); - - m_xConfigurationUpdateAccess = xConfigurationProvider->createInstanceWithArguments( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ), - aArgumentList ); - } - catch ( RuntimeException& ) - { - } - } - - ArrangeControls_Impl(); -} - -SvxProxyTabPage::~SvxProxyTabPage() -{ -} - -SfxTabPage* SvxProxyTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxProxyTabPage(pParent, rAttrSet); -} - -void SvxProxyTabPage::ReadConfigData_Impl() -{ - try { - Reference< container::XNameAccess > xNameAccess(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - - sal_Int32 nIntValue = 0; - OUString aStringValue; - - if( xNameAccess->getByName(aProxyModePN) >>= nIntValue ) - { - aProxyModeLB.SelectEntryPos( (sal_uInt16) nIntValue ); - } - - if( xNameAccess->getByName(aHttpProxyPN) >>= aStringValue ) - { - aHttpProxyED.SetText( aStringValue ); - } - - if( xNameAccess->getByName(aHttpPortPN) >>= nIntValue ) - { - aHttpPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xNameAccess->getByName(aHttpsProxyPN) >>= aStringValue ) - { - aHttpsProxyED.SetText( aStringValue ); - } - - if( xNameAccess->getByName(aHttpsPortPN) >>= nIntValue ) - { - aHttpsPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xNameAccess->getByName(aFtpProxyPN) >>= aStringValue ) - { - aFtpProxyED.SetText( aStringValue ); - } - - if( xNameAccess->getByName(aFtpPortPN) >>= nIntValue ) - { - aFtpPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xNameAccess->getByName(aNoProxyDescPN) >>= aStringValue ) - { - aNoProxyForED.SetText( aStringValue ); - } - } - - catch(container::NoSuchElementException &e) { - OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: NoSuchElementException caught" ); - } - - catch(com::sun::star::lang::WrappedTargetException &e) { - OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: WrappedTargetException caught" ); - } - - catch(RuntimeException &e) { - OSL_TRACE( "SvxProxyTabPage::ReadConfigData_Impl: RuntimeException caught" ); - } - -} - -void SvxProxyTabPage::ReadConfigDefaults_Impl() -{ - try - { - Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - - sal_Int32 nIntValue = 0; - OUString aStringValue; - - if( xPropertyState->getPropertyDefault(aHttpProxyPN) >>= aStringValue ) - { - aHttpProxyED.SetText( aStringValue ); - } - - if( xPropertyState->getPropertyDefault(aHttpPortPN) >>= nIntValue ) - { - aHttpPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xPropertyState->getPropertyDefault(aHttpsProxyPN) >>= aStringValue ) - { - aHttpsProxyED.SetText( aStringValue ); - } - - if( xPropertyState->getPropertyDefault(aHttpsPortPN) >>= nIntValue ) - { - aHttpsPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xPropertyState->getPropertyDefault(aFtpProxyPN) >>= aStringValue ) - { - aFtpProxyED.SetText( aStringValue ); - } - - if( xPropertyState->getPropertyDefault(aFtpPortPN) >>= nIntValue ) - { - aFtpPortED.SetText( String::CreateFromInt32( nIntValue )); - } - - if( xPropertyState->getPropertyDefault(aNoProxyDescPN) >>= aStringValue ) - { - aNoProxyForED.SetText( aStringValue ); - } - } - catch(beans::UnknownPropertyException &e) - { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" ); - } - - catch(com::sun::star::lang::WrappedTargetException &e) { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" ); - } - - catch(RuntimeException &e) - { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" ); - } -} - -void SvxProxyTabPage::RestoreConfigDefaults_Impl() -{ - try - { - Reference< beans::XPropertyState > xPropertyState(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - - xPropertyState->setPropertyToDefault(aProxyModePN); - xPropertyState->setPropertyToDefault(aHttpProxyPN); - xPropertyState->setPropertyToDefault(aHttpPortPN); - xPropertyState->setPropertyToDefault(aHttpsProxyPN); - xPropertyState->setPropertyToDefault(aHttpsPortPN); - xPropertyState->setPropertyToDefault(aFtpProxyPN); - xPropertyState->setPropertyToDefault(aFtpPortPN); - xPropertyState->setPropertyToDefault(aNoProxyDescPN); - - Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - xChangesBatch->commitChanges(); - } - - catch(beans::UnknownPropertyException &e) - { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: UnknownPropertyException caught" ); - } - - catch(com::sun::star::lang::WrappedTargetException &e) { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: WrappedTargetException caught" ); - } - - catch(RuntimeException &e) - { - OSL_TRACE( "SvxProxyTabPage::RestoreConfigDefaults_Impl: RuntimeException caught" ); - } -} - -void SvxProxyTabPage::Reset(const SfxItemSet&) -{ - ReadConfigData_Impl(); - - aProxyModeLB.SaveValue(); - aHttpProxyED.SaveValue(); - aHttpPortED.SaveValue(); - aHttpsProxyED.SaveValue(); - aHttpsPortED.SaveValue(); - aFtpProxyED.SaveValue(); - aFtpPortED.SaveValue(); - aNoProxyForED.SaveValue(); - - EnableControls_Impl( aProxyModeLB.GetSelectEntryPos() == 2 ); -} - -sal_Bool SvxProxyTabPage::FillItemSet(SfxItemSet& ) -{ - sal_Bool bModified=sal_False; - - try { - Reference< beans::XPropertySet > xPropertySet(m_xConfigurationUpdateAccess, UNO_QUERY_THROW ); - - sal_uInt16 nSelPos = aProxyModeLB.GetSelectEntryPos(); - if(aProxyModeLB.GetSavedValue() != nSelPos) - { - if( nSelPos == 1 ) - { - RestoreConfigDefaults_Impl(); - return sal_True; - } - - xPropertySet->setPropertyValue(aProxyModePN, - makeAny((sal_Int32) nSelPos)); - bModified = sal_True; - } - - if(aHttpProxyED.GetSavedValue() != aHttpProxyED.GetText()) - { - xPropertySet->setPropertyValue( aHttpProxyPN, - makeAny(rtl::OUString(aHttpProxyED.GetText()))); - bModified = sal_True; - } - - if ( aHttpPortED.GetSavedValue() != aHttpPortED.GetText() ) - { - xPropertySet->setPropertyValue( aHttpPortPN, - makeAny(aHttpPortED.GetText().ToInt32())); - bModified = sal_True; - } - - if(aHttpsProxyED.GetSavedValue() != aHttpsProxyED.GetText()) - { - xPropertySet->setPropertyValue( aHttpsProxyPN, - makeAny(rtl::OUString(aHttpsProxyED.GetText()))); - bModified = sal_True; - } - - if ( aHttpsPortED.GetSavedValue() != aHttpsPortED.GetText() ) - { - xPropertySet->setPropertyValue( aHttpsPortPN, - makeAny(aHttpsPortED.GetText().ToInt32())); - bModified = sal_True; - } - - if(aFtpProxyED.GetSavedValue() != aFtpProxyED.GetText()) - { - xPropertySet->setPropertyValue( aFtpProxyPN, - makeAny( rtl::OUString(aFtpProxyED.GetText()))); - bModified = sal_True; - } - - if ( aFtpPortED.GetSavedValue() != aFtpPortED.GetText() ) - { - xPropertySet->setPropertyValue( aFtpPortPN, - makeAny(aFtpPortED.GetText().ToInt32())); - bModified = sal_True; - } - - if ( aNoProxyForED.GetSavedValue() != aNoProxyForED.GetText() ) - { - xPropertySet->setPropertyValue( aNoProxyDescPN, - makeAny( rtl::OUString(aNoProxyForED.GetText()))); - bModified = sal_True; - } - - Reference< util::XChangesBatch > xChangesBatch(m_xConfigurationUpdateAccess, UNO_QUERY_THROW); - xChangesBatch->commitChanges(); - } - - catch(com::sun::star::lang::IllegalArgumentException &e) { - OSL_TRACE( "SvxProxyTabPage::FillItemSet: IllegalArgumentException caught" ); - } - - catch(beans::UnknownPropertyException &e) { - OSL_TRACE( "SvxProxyTabPage::FillItemSet: UnknownPropertyException caught" ); - } - - catch(beans::PropertyVetoException &e) { - OSL_TRACE( "SvxProxyTabPage::FillItemSet: PropertyVetoException caught" ); - } - - catch(com::sun::star::lang::WrappedTargetException &e) { - OSL_TRACE( "SvxProxyTabPage::FillItemSet: WrappedTargetException caught" ); - } - - catch(RuntimeException &e) { - OSL_TRACE( "SvxProxyTabPage::FillItemSet: RuntimeException caught" ); - } - - return bModified; -} - -void SvxProxyTabPage::ArrangeControls_Impl() -{ - // calculate dynamic width of controls, to not cut-off translated strings #i71445# - long nWidth = aProxyModeFT.GetCtrlTextWidth( aProxyModeFT.GetText() ); - long nTemp = aHttpProxyFT.GetCtrlTextWidth( aHttpProxyFT.GetText() ); - if ( nTemp > nWidth ) - nWidth = nTemp; - nTemp = aHttpsProxyFT.GetCtrlTextWidth( aHttpsProxyFT.GetText() ); - if ( nTemp > nWidth ) - nWidth = nTemp; - nTemp = aFtpProxyFT.GetCtrlTextWidth( aFtpProxyFT.GetText() ); - if ( nTemp > nWidth ) - nWidth = nTemp; - nTemp = aNoProxyForFT.GetCtrlTextWidth( aNoProxyForFT.GetText() ); - if ( nTemp > nWidth ) - nWidth = nTemp; - - nWidth += 10; // To be sure the length of the FixedText is enough on all platforms - const long nFTWidth = aProxyModeFT.GetSizePixel().Width(); - if ( nWidth > nFTWidth ) - { - Size aNewSize = aProxyModeFT.GetSizePixel(); - aNewSize.Width() = nWidth; - - aProxyModeFT.SetSizePixel( aNewSize ); - aHttpProxyFT.SetSizePixel( aNewSize ); - aHttpsProxyFT.SetSizePixel( aNewSize ); - aFtpProxyFT.SetSizePixel( aNewSize ); - aNoProxyForFT.SetSizePixel( aNewSize ); - - const long nDelta = nWidth - nFTWidth; - Point aNewPos = aProxyModeLB.GetPosPixel(); - aNewPos.X() += nDelta; - - aProxyModeLB.SetPosPixel( aNewPos ); - - aNewSize = aHttpProxyED.GetSizePixel(); - aNewSize.Width() -= nDelta; - - aNewPos.Y() = aHttpProxyED.GetPosPixel().Y(); - aHttpProxyED.SetPosSizePixel( aNewPos, aNewSize ); - aNewPos.Y() = aHttpsProxyED.GetPosPixel().Y(); - aHttpsProxyED.SetPosSizePixel( aNewPos, aNewSize ); - aNewPos.Y() = aFtpProxyED.GetPosPixel().Y(); - aFtpProxyED.SetPosSizePixel( aNewPos, aNewSize ); - aNewPos.Y() = aNoProxyForED.GetPosPixel().Y(); - aNoProxyForED.SetPosSizePixel( aNewPos, aNewSize ); - } -} - -void SvxProxyTabPage::EnableControls_Impl(sal_Bool bEnable) -{ - aHttpProxyFT.Enable(bEnable); - aHttpProxyED.Enable(bEnable); - aHttpPortFT.Enable(bEnable); - aHttpPortED.Enable(bEnable); - - aHttpsProxyFT.Enable(bEnable); - aHttpsProxyED.Enable(bEnable); - aHttpsPortFT.Enable(bEnable); - aHttpsPortED.Enable(bEnable); - - aFtpProxyFT.Enable(bEnable); - aFtpProxyED.Enable(bEnable); - aFtpPortFT.Enable(bEnable); - aFtpPortED.Enable(bEnable); - - aNoProxyForFT.Enable(bEnable); - aNoProxyForED.Enable(bEnable); - aNoProxyDescFT.Enable(bEnable); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxProxyTabPage, ProxyHdl_Impl, ListBox *, pBox ) -{ - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - - // Restore original system values - if( nPos == 1 ) - { - ReadConfigDefaults_Impl(); - } - - EnableControls_Impl(nPos == 2); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Edit *, pEdit ) -{ - XubString aValue = pEdit->GetText(); - - if ( !ByteString(::rtl::OUStringToOString(aValue,RTL_TEXTENCODING_UTF8)).IsNumericAscii() || (long)aValue.ToInt32() > USHRT_MAX ) - pEdit->SetText( '0' ); - return 0; -} - - - -//#98647#---------------------------------------------- -void SvxScriptExecListBox::RequestHelp( const HelpEvent& rHEvt ) -{ // try to show tips just like as on toolbars - sal_uInt16 nPos=LISTBOX_ENTRY_NOTFOUND; - sal_uInt16 nTop = GetTopEntry(); - sal_uInt16 nCount = GetDisplayLineCount(); // Attention: Not GetLineCount() - Point aPt = ScreenToOutputPixel( rHEvt.GetMousePosPixel() ); - Rectangle aItemRect; - if( nCount > 0 ) // if there're some entries, find it. - for( nPos = nTop ; nPos <= nTop+nCount-1 ; nPos++ ) { - aItemRect = GetBoundingRectangle(nPos); - if( aPt.Y() < aItemRect.Top() || aPt.Y() > aItemRect.Bottom() ) - continue; - else - break; - } - else // if not, nothing happens. - return; - String aHelpText; - if( nPos <= nTop+nCount-1 ) // if find the matching entry, get its content. - aHelpText = GetEntry(nPos); - if( aHelpText.Len() && GetTextWidth(aHelpText)Execute(); - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, SavePasswordHdl, void*, EMPTYARG ) -{ - try - { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - UNO_QUERY_THROW ); - - if ( maSavePasswordsCB.IsChecked() ) - { - sal_Bool bOldValue = xMasterPasswd->allowPersistentStoring( sal_True ); - xMasterPasswd->removeMasterPassword(); - if ( xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) ) - { - maMasterPasswordPB.Enable( sal_True ); - maMasterPasswordCB.Check( sal_True ); - maMasterPasswordCB.Enable( sal_True ); - maMasterPasswordFI.Enable( sal_True ); - maShowConnectionsPB.Enable( sal_True ); - } - else - { - xMasterPasswd->allowPersistentStoring( bOldValue ); - maSavePasswordsCB.Check( sal_False ); - } - } - else - { - QueryBox aQuery( this, WB_YES_NO|WB_DEF_NO, msPasswordStoringDeactivateStr ); - sal_uInt16 nRet = aQuery.Execute(); - - if( RET_YES == nRet ) - { - xMasterPasswd->allowPersistentStoring( sal_False ); - maMasterPasswordCB.Check( sal_True ); - maMasterPasswordPB.Enable( sal_False ); - maMasterPasswordCB.Enable( sal_False ); - maMasterPasswordFI.Enable( sal_False ); - maShowConnectionsPB.Enable( sal_False ); - } - else - { - maSavePasswordsCB.Check( sal_True ); - maMasterPasswordPB.Enable( sal_True ); - maShowConnectionsPB.Enable( sal_True ); - } - } - } - catch( Exception& ) - { - maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() ); - } - - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, MasterPasswordHdl, PushButton*, EMPTYARG ) -{ - try - { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - UNO_QUERY ); - - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) - xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ); - } - catch( Exception& ) - {} - - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, MasterPasswordCBHdl, void*, EMPTYARG ) -{ - try - { - Reference< task::XMasterPasswordHandling2 > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - UNO_QUERY_THROW ); - - if ( maMasterPasswordCB.IsChecked() ) - { - if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->changeMasterPassword( Reference< task::XInteractionHandler >() ) ) - { - maMasterPasswordPB.Enable( sal_True ); - maMasterPasswordFI.Enable( sal_True ); - } - else - { - maMasterPasswordCB.Check( sal_False ); - maMasterPasswordPB.Enable( sal_True ); - maMasterPasswordFI.Enable( sal_True ); - } - } - else - { - if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->useDefaultMasterPassword( Reference< task::XInteractionHandler >() ) ) - { - maMasterPasswordPB.Enable( sal_False ); - maMasterPasswordFI.Enable( sal_False ); - } - else - { - maMasterPasswordCB.Check( sal_True ); - maMasterPasswordPB.Enable( sal_True ); - maShowConnectionsPB.Enable( sal_True ); - } - } - } - catch( Exception& ) - { - maSavePasswordsCB.Check( !maSavePasswordsCB.IsChecked() ); - } - - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, ShowPasswordsHdl, PushButton*, EMPTYARG ) -{ - try - { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - UNO_QUERY ); - - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword( Reference< task::XInteractionHandler>() ) ) - { - svx::WebConnectionInfoDialog aDlg( this ); - aDlg.Execute(); - } - } - catch( Exception& ) - {} - return 0; -} - -IMPL_LINK( SvxSecurityTabPage, MacroSecPBHdl, void*, EMPTYARG ) -{ - Reference< security::XDocumentDigitalSignatures > xD( - comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), UNO_QUERY ); - if ( xD.is() ) - xD->manageTrustedSources(); - - return 0; -} - - -void SvxSecurityTabPage::InitControls() -{ - // Hide all controls which belong to the macro security button in case the macro - // security settings managed by the macro security dialog opened via the button - // are all readonly or if the macros are disabled in general. - // @@@ Better would be to query the dialog whether it is 'useful' or not. Exposing - // macro security dialog implementations here, which is bad. - if ( mpSecOptions->IsMacroDisabled() - || ( mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_SECLEVEL ) - && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS ) - && mpSecOptions->IsReadOnly( SvtSecurityOptions::E_SECUREURLS ) ) ) - { - maMacroSecFL.Hide(); - maMacroSecFI.Hide(); - maMacroSecPB.Hide(); - } - - // one button too small for its text? - sal_Int32 i = 0; - long nBtnTextWidth = 0; - Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB, - &maShowConnectionsPB, &maMacroSecPB }; - Window** pButton = pButtons; - const sal_Int32 nBCount = SAL_N_ELEMENTS( pButtons ); - for ( ; i < nBCount; ++i, ++pButton ) - { - long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() ); - if ( nTemp > nBtnTextWidth ) - nBtnTextWidth = nTemp; - } - - nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset - const long nButtonWidth = maSecurityOptionsPB.GetSizePixel().Width(); - const long nMaxWidth = nButtonWidth * 140 / 100; - long nExtra = ( nBtnTextWidth > nMaxWidth ) ? nBtnTextWidth - nMaxWidth : 0; - nBtnTextWidth = std::min( nBtnTextWidth, nMaxWidth ); - - if ( nBtnTextWidth > nButtonWidth ) - { - // so make the buttons broader and its control in front of it smaller - long nDelta = nBtnTextWidth - nButtonWidth; - pButton = pButtons; - - if ( nExtra > 0 ) - { - long nPos = (*pButton)->GetPosPixel().X() - nDelta; - long nWidth = (*pButton)->GetSizePixel().Width() + nDelta; - long nMaxExtra = GetOutputSizePixel().Width() - ( nPos + nWidth ) - 2; - nExtra = ( nExtra < nMaxExtra ) ? nExtra : nMaxExtra; - } - - for ( i = 0; i < nBCount; ++i, ++pButton ) - { - Point aNewPos = (*pButton)->GetPosPixel(); - aNewPos.X() -= nDelta; - Size aNewSize = (*pButton)->GetSizePixel(); - aNewSize.Width() += ( nDelta + nExtra ); - (*pButton)->SetPosSizePixel( aNewPos, aNewSize ); - } - - Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB, - &maMasterPasswordFI, &maMacroSecFI }; - Window** pControl = pControls; - const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls ); - for ( i = 0; i < nCCount; ++i, ++pControl ) - { - Size aNewSize = (*pControl)->GetSizePixel(); - aNewSize.Width() -= nDelta; - (*pControl)->SetSizePixel( aNewSize ); - } - } - - maMasterPasswordPB.Enable( sal_False ); - maMasterPasswordCB.Enable( sal_False ); - maMasterPasswordCB.Check( sal_True ); - maMasterPasswordFI.Enable( sal_False ); - maShowConnectionsPB.Enable( sal_False ); - - // initialize the password saving checkbox - try - { - Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - UNO_QUERY_THROW ); - - if ( xMasterPasswd->isPersistentStoringAllowed() ) - { - maMasterPasswordCB.Enable( sal_True ); - maShowConnectionsPB.Enable( sal_True ); - maSavePasswordsCB.Check( sal_True ); - - Reference< task::XMasterPasswordHandling2 > xMasterPasswd2( xMasterPasswd, UNO_QUERY ); - if ( xMasterPasswd2.is() && xMasterPasswd2->isDefaultMasterPasswordUsed() ) - maMasterPasswordCB.Check( sal_False ); - else - { - maMasterPasswordPB.Enable( sal_True ); - maMasterPasswordCB.Check( sal_True ); - maMasterPasswordFI.Enable( sal_True ); - } - } - } - catch( Exception& ) - { - maSavePasswordsCB.Enable( sal_False ); - } - - -} - -SfxTabPage* SvxSecurityTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxSecurityTabPage(pParent, rAttrSet); -} - -void SvxSecurityTabPage::ActivatePage( const SfxItemSet& ) -{ -} - -int SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -namespace -{ - bool CheckAndSave( SvtSecurityOptions& _rOpt, SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModfied ) - { - bool bModified = false; - if ( _rOpt.IsOptionEnabled( _eOpt ) ) - { - bModified = _rOpt.IsOptionSet( _eOpt ) != _bIsChecked; - if ( bModified ) - { - _rOpt.SetOption( _eOpt, _bIsChecked ); - _rModfied = true; - } - } - - return bModified; - } -} - -sal_Bool SvxSecurityTabPage::FillItemSet( SfxItemSet& ) -{ - bool bModified = false; - - if ( mpSecOptDlg ) - { - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, mpSecOptDlg->IsSaveOrSendDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, mpSecOptDlg->IsSignDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_PRINT, mpSecOptDlg->IsPrintDocsChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, mpSecOptDlg->IsCreatePdfChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, mpSecOptDlg->IsRemovePersInfoChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, mpSecOptDlg->IsRecommPasswdChecked(), bModified ); - CheckAndSave( *mpSecOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, mpSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); - } - - return bModified; -} - -/*--------------------------------------------------------------------*/ - -void SvxSecurityTabPage::Reset( const SfxItemSet& ) -{ - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - if( pCurDocShell ) - { - } -} - -MozPluginTabPage::MozPluginTabPage(Window* pParent, const SfxItemSet& rSet) - : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_MOZPLUGIN ), rSet ), - aMSWordGB ( this, CUI_RES( GB_MOZPLUGIN ) ), - aWBasicCodeCB ( this, CUI_RES( CB_MOZPLUGIN_CODE ) ) -{ - FreeResource(); -} - -MozPluginTabPage::~MozPluginTabPage() -{ -} - -SfxTabPage* MozPluginTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return new MozPluginTabPage( pParent, rAttrSet ); -} -sal_Bool MozPluginTabPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool hasInstall = isInstalled(); - sal_Bool hasChecked = aWBasicCodeCB.IsChecked(); - if(hasInstall && (!hasChecked)){ - //try to uninstall - uninstallPlugin(); - } - else if((!hasInstall) && hasChecked){ - //try to install - installPlugin(); - } - else{ - // do nothing - } - return sal_True; -} -void MozPluginTabPage::Reset( const SfxItemSet& ) -{ - aWBasicCodeCB.Check( isInstalled()); - aWBasicCodeCB.SaveValue(); -} - -#ifdef WNT -extern "C" { - int lc_isInstalled(const char* realFilePath); - int lc_installPlugin(const char* realFilePath); - int lc_uninstallPlugin(const char* realFilePath); -} -#endif - -#define NPP_PATH_MAX 2048 -inline bool getDllURL(rtl::OString * path) -{ - OSL_ASSERT(path != NULL); - ::rtl::OUString dirPath/*dllPath, */; - if (osl_getExecutableFile(&dirPath.pData) != osl_Process_E_None) { - return false; - } - dirPath = dirPath.copy(0, dirPath.lastIndexOf('/')); - ::rtl::OUString sysDirPath; - osl::FileBase::getSystemPathFromFileURL(dirPath, sysDirPath); - *path = OUStringToOString(sysDirPath, RTL_TEXTENCODING_ASCII_US); - return true; -} - -sal_Bool MozPluginTabPage::isInstalled() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char lnkFilePath[NPP_PATH_MAX] = {0}; - char lnkReferFilePath[NPP_PATH_MAX] = {0}; - char* pHome = getpwuid(getuid())->pw_dir; - strcat(lnkFilePath, pHome); - strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION); - - struct stat sBuf; - if (0 > lstat(lnkFilePath, &sBuf)) - return false; - if (!S_ISLNK(sBuf.st_mode)) - return false; - if (0 >= readlink(lnkFilePath, lnkReferFilePath, NPP_PATH_MAX)) - return false; - // If the link is relative, then we regard it as non-standard - if (lnkReferFilePath[0] != '/') - return false; - - // get the real file path - char realFilePath[NPP_PATH_MAX] = {0}; - ::rtl::OString tempString; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION); - - if (0 != strcmp(lnkReferFilePath, realFilePath)) - return false; - return true; -#endif -#ifdef WNT - // get the value from registry - sal_Bool ret = true; - ::rtl::OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)){ - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if(! lc_isInstalled(realFilePath)) - ret =true; - else - ret = false; - return ret; -#endif -} - -sal_Bool MozPluginTabPage::installPlugin() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char lnkFilePath[NPP_PATH_MAX] = {0}; - char* pHome = getpwuid(getuid())->pw_dir; - strcat(lnkFilePath, pHome); - strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION); - remove(lnkFilePath); - - // create the dirs if necessary - struct stat buf; - char tmpDir[NPP_PATH_MAX] = {0}; - sprintf(tmpDir, "%s/.mozilla", pHome); - if (0 > stat(lnkFilePath, &buf)) - { - mkdir(tmpDir, 0755); - strcat(tmpDir, "/plugins"); - mkdir(tmpDir, 0755); - } - - // get the real file path - char realFilePath[NPP_PATH_MAX] = {0}; - ::rtl::OString tempString; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION); - - // create the link - if (0 != symlink(realFilePath, lnkFilePath)) - return false; - return true; -#endif -#ifdef WNT - ::rtl::OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if( !lc_installPlugin(realFilePath)) - return true; - else - return false; -#endif -} - -sal_Bool MozPluginTabPage::uninstallPlugin() -{ -#ifdef UNIX - // get the real file referred by .so lnk file - char lnkFilePath[NPP_PATH_MAX] = {0}; - char* pHome = getpwuid(getuid())->pw_dir; - strcat(lnkFilePath, pHome); - strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION); - - if(0 > remove(lnkFilePath)) - return false; - return true; -#endif -#ifdef WNT - ::rtl::OString tempString; - char realFilePath[NPP_PATH_MAX] = {0}; - if (!getDllURL(&tempString)) { - return false; - } - strncpy(realFilePath, tempString.getStr(), NPP_PATH_MAX); - if(!lc_uninstallPlugin(realFilePath)) - return true; - else - return false; -#endif -} - -/* -------------------------------------------------------------------------*/ - -class MailerProgramCfg_Impl : public utl::ConfigItem -{ - friend class SvxEMailTabPage; - // variables - OUString sProgram; - // readonly states - sal_Bool bROProgram; - - const Sequence GetPropertyNames(); -public: - MailerProgramCfg_Impl(); - virtual ~MailerProgramCfg_Impl(); - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); -}; - -/* -------------------------------------------------------------------------*/ - -MailerProgramCfg_Impl::MailerProgramCfg_Impl() : - utl::ConfigItem(C2U("Office.Common/ExternalMailer")), - bROProgram(sal_False) -{ - const Sequence< OUString > aNames = GetPropertyNames(); - const Sequence< Any > aValues = GetProperties(aNames); - const Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - for(sal_Int32 nProp = 0; nProp < aValues.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case 0 : - { - pValues[nProp] >>= sProgram; - bROProgram = pROStates[nProp]; - } - break; - } - } - } -} - -/* -------------------------------------------------------------------------*/ - -MailerProgramCfg_Impl::~MailerProgramCfg_Impl() -{ -} - -/* -------------------------------------------------------------------------*/ - -const Sequence MailerProgramCfg_Impl::GetPropertyNames() -{ - Sequence aRet(1); - OUString* pRet = aRet.getArray(); - pRet[0] = C2U("Program"); - return aRet; -} - -/* -------------------------------------------------------------------------*/ - -void MailerProgramCfg_Impl::Commit() -{ - const Sequence< OUString > aOrgNames = GetPropertyNames(); - sal_Int32 nOrgCount = aOrgNames.getLength(); - - Sequence< OUString > aNames(nOrgCount); - Sequence< Any > aValues(nOrgCount); - sal_Int32 nRealCount = 0; - - for(int nProp = 0; nProp < nOrgCount; nProp++) - { - switch(nProp) - { - case 0: - { - if (!bROProgram) - { - aNames[nRealCount] = aOrgNames[nProp]; - aValues[nRealCount] <<= sProgram; - ++nRealCount; - } - } - break; - } - } - - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties(aNames, aValues); -} - -void MailerProgramCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) -{ -} - -/* -------------------------------------------------------------------------*/ - -struct SvxEMailTabPage_Impl -{ - MailerProgramCfg_Impl aMailConfig; -}; - -SvxEMailTabPage::SvxEMailTabPage(Window* pParent, const SfxItemSet& rSet) : - SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_INET_MAIL ), rSet), - aMailFL(this, CUI_RES(FL_MAIL )), - aMailerURLFI(this, CUI_RES(FI_MAILERURL )), - aMailerURLFT(this, CUI_RES(FT_MAILERURL )), - aMailerURLED(this, CUI_RES(ED_MAILERURL )), - aMailerURLPB(this, CUI_RES(PB_MAILERURL )), - m_sDefaultFilterName( CUI_RES(STR_DEFAULT_FILENAME )), - pImpl(new SvxEMailTabPage_Impl) -{ - FreeResource(); - - aMailerURLPB.SetClickHdl( LINK( this, SvxEMailTabPage, FileDialogHdl_Impl ) ); - - // FixedText not wide enough? - long nTxtW = aMailerURLFT.GetCtrlTextWidth( aMailerURLFT.GetText() ); - long nCtrlW = aMailerURLFT.GetSizePixel().Width(); - if ( nTxtW >= nCtrlW ) - { - long nDelta = Max( (long)10, nTxtW - nCtrlW ); - // so FixedText wider - Size aNewSz = aMailerURLFT.GetSizePixel(); - aNewSz.Width() += nDelta; - aMailerURLFT.SetSizePixel( aNewSz ); - // and Edit smaller - aNewSz = aMailerURLED.GetSizePixel(); - aNewSz.Width() -= nDelta; - Point aNewPt = aMailerURLED.GetPosPixel(); - aNewPt.X() += nDelta; - aMailerURLED.SetPosSizePixel( aNewPt, aNewSz ); - } -} - -/* -------------------------------------------------------------------------*/ - -SvxEMailTabPage::~SvxEMailTabPage() -{ - delete pImpl; -} - -/* -------------------------------------------------------------------------*/ - -SfxTabPage* SvxEMailTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxEMailTabPage(pParent, rAttrSet); -} - -/* -------------------------------------------------------------------------*/ - -sal_Bool SvxEMailTabPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bMailModified = sal_False; - if(!pImpl->aMailConfig.bROProgram && aMailerURLED.GetSavedValue() != aMailerURLED.GetText()) - { - pImpl->aMailConfig.sProgram = aMailerURLED.GetText(); - bMailModified = sal_True; - } - if ( bMailModified ) - pImpl->aMailConfig.Commit(); - - return sal_False; -} - -/* -------------------------------------------------------------------------*/ - -void SvxEMailTabPage::Reset( const SfxItemSet& ) -{ - aMailerURLED.Enable(sal_True ); - aMailerURLPB.Enable(sal_True ); - - if(pImpl->aMailConfig.bROProgram) - aMailerURLFI.Show(); - - aMailerURLED.SetText(pImpl->aMailConfig.sProgram); - aMailerURLED.SaveValue(); - aMailerURLED.Enable(!pImpl->aMailConfig.bROProgram); - aMailerURLPB.Enable(!pImpl->aMailConfig.bROProgram); - aMailerURLFT.Enable(!pImpl->aMailConfig.bROProgram); - - aMailFL.Enable(aMailerURLFT.IsEnabled() || - aMailerURLED.IsEnabled() || - aMailerURLPB.IsEnabled()); -} - -/* -------------------------------------------------------------------------*/ - -IMPL_LINK( SvxEMailTabPage, FileDialogHdl_Impl, PushButton*, pButton ) -{ - if ( &aMailerURLPB == pButton && !pImpl->aMailConfig.bROProgram ) - { - FileDialogHelper aHelper( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - WB_OPEN ); - String sPath = aMailerURLED.GetText(); - if ( !sPath.Len() ) - sPath.AppendAscii("/usr/bin"); - - String sUrl; - ::utl::LocalFileHelper::ConvertPhysicalNameToURL(sPath,sUrl); - aHelper.SetDisplayDirectory(sUrl); - aHelper.AddFilter( m_sDefaultFilterName, String::CreateFromAscii("*")); - - if ( ERRCODE_NONE == aHelper.Execute() ) - { - sUrl = aHelper.GetPath(); - ::utl::LocalFileHelper::ConvertURLToPhysicalName(sUrl,sPath); - aMailerURLED.SetText(sPath); - } - } - return 0; -} - -// ----------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc deleted file mode 100755 index 2ccee079f..000000000 --- a/cui/source/options/optinet2.hrc +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTINET_HRC -#define _SVX_OPTINET_HRC - -#ifndef _SVT_CONTROLDIMS_HRC_ -#include -#endif - -// Proxy ------------------------------------------------------------------ -#define GB_SETTINGS 1 -#define FT_PROXYMODE 2 -#define LB_PROXYMODE 2 -#define FT_HTTP_PROXY 3 -#define ED_HTTP_PROXY 3 -#define FT_HTTP_PORT 4 -#define ED_HTTP_PORT 4 -#define FT_FTP_PROXY 5 -#define ED_FTP_PROXY 5 -#define FT_FTP_PORT 6 -#define ED_FTP_PORT 6 -#define FT_SOCKS_PROXY 7 -#define ED_SOCKS_PROXY 7 -#define FT_SOCKS_PORT 8 -#define ED_SOCKS_PORT 8 -#define FT_NOPROXYFOR 11 -#define ED_NOPROXYFOR 11 -#define ED_NOPROXYDESC 12 -#define ST_PROXY_FROM_BROWSER 13 -#define FT_HTTPS_PROXY 14 -#define ED_HTTPS_PROXY 14 -#define FT_HTTPS_PORT 15 -#define ED_HTTPS_PORT 15 - -// Protocols -------------------------------------------------------------- -#define GB_DNS 105 -#define RB_DNS_AUTO 106 -#define RB_DNS_MANUAL 107 -#define ED_DNS 107 - -#define ST_MSG_255_0 111 -#define ST_MSG_255_1 112 - -// Site Certificate -------------------------------------------------------- -#define GB_SITECERT 120 -#define LB_SITECERT 121 -#define LB_FILTERCERT 122 -#define PB_EDIT_CERT 123 -#define PB_DELETE_CERT 124 - -// personal Certificate ---------------------------------------------------- -#define GB_PERSCERT 130 -#define LB_PERSCERT 131 -#define PB_NEW_PERSCERT 132 -#define PB_INFO_PERSCERT 133 -#define PB_DELETE_PERSCERT 134 - -// Security ------------------------------------------------------------- - -#define FL_SEC_SECURITYOPTIONS 10 -#define FI_SEC_SECURITYOPTIONS 11 -#define PB_SEC_SECURITYOPTIONS 12 -#define FL_SEC_PASSWORDS 13 -#define CB_SEC_SAVEPASSWORDS 14 -#define PB_SEC_CONNECTIONS 15 -#define CB_SEC_MASTERPASSWORD 16 -#define FI_SEC_MASTERPASSWORD 17 -#define PB_SEC_MASTERPASSWORD 18 -#define FL_SEC_MACROSEC 19 -#define FI_SEC_MACROSEC 20 -#define PB_SEC_MACROSEC 21 - -#define STR_SEC_NOPASSWDSAVE 12 - -#define TP_WIDTH 260 -#define TP_HEIGHT 185 -#define OFFS_BUTTON_Y (-6) -#define BORDER_OFFSET 8 -#define COL_0 (RSC_SP_TBPG_INNERBORDER_LEFT) -#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X) -#define COL_1a (COL_1+RSC_SP_CHK_TEXTINDENT) -#define COL_4 (TP_WIDTH-RSC_SP_TBPG_INNERBORDER_RIGHT) -#define COL_3 (COL_4-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_2 (COL_3-RSC_SP_CTRL_DESC_X) - -#define ROW_0 (RSC_SP_FLGR_INNERBORDER_TOP) -#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_2 (ROW_1+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_2a (ROW_2-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT) -#define ROW_3 (ROW_2+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y-1) -#define ROW_4a (ROW_4+RSC_CD_CHECKBOX_HEIGHT+1) -#define ROW_5 (ROW_4a+4*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_6 (ROW_5+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_7 (ROW_6+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define ROW_9 (ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_DESC_Y) - -// Defines - JavaScriptDisableQueryBox_Impl ------------------------------- - -#define IMG_JSCPT_WARNING 220 -#define FT_JSCPT_WARNING 221 -#define CB_JSCPT_DISABLE 222 -#define GB_JSCPT_WARNING 223 -#define BTN_JSCPT_YES 224 -#define BTN_JSCPT_NO 225 - -// Defines - SvxEMailTabPage_Impl -#define FL_MAIL 1 -#define FT_MAILERURL 2 -#define FI_MAILERURL 3 -#define ED_MAILERURL 4 -#define PB_MAILERURL 5 -#define STR_DEFAULT_FILENAME 6 - -// plugin -#define GB_MOZPLUGIN 1 -#define CB_MOZPLUGIN_CODE 2 - - -#endif // #ifndef _SVX_OPTINET_HRC - -// ******************************************************************* EOF - diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx deleted file mode 100644 index 89f3285f0..000000000 --- a/cui/source/options/optinet2.hxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTINET_HXX -#define _SVX_OPTINET_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _SVX_OPTINET2_CXX -#include -#else -class HeaderBar; -#endif -#include - -class SfxFilter; -class SvtInetOptions; - -#ifndef SV_NODIALOG -#define PROXY_CONTROLS 23 -#define CACHE_CONTROLS 20 - -#define TYPE_CONTROLS 18 - -namespace svx { - class SecurityOptionsDialog; -} - -namespace lang = ::com::sun::star::lang; -namespace uno = ::com::sun::star::uno; - -// class SvxNoSpaceEdit -------------------------------------------------- - -class SvxNoSpaceEdit : public Edit -{ -private: - sal_Bool bOnlyNumeric; - -public: - SvxNoSpaceEdit(Window* pParent, ResId rResId, sal_Bool bNum = sal_False ) : - Edit( pParent, rResId ), bOnlyNumeric( bNum ) {} - - virtual void KeyInput( const KeyEvent& rKEvent ); - virtual void Modify(); -}; - -typedef SfxFilter* SfxFilterPtr; -SV_DECL_PTRARR( SfxFilterPtrArr, SfxFilterPtr, 0, 4 ) - -// class SvxProxyTabPage ------------------------------------------------- - -class SvxProxyTabPage : public SfxTabPage -{ -private: - FixedLine aOptionGB; - - FixedText aProxyModeFT; - ListBox aProxyModeLB; - - FixedText aHttpProxyFT; - SvxNoSpaceEdit aHttpProxyED; - FixedText aHttpPortFT; - SvxNoSpaceEdit aHttpPortED; - - FixedText aHttpsProxyFT; - SvxNoSpaceEdit aHttpsProxyED; - FixedText aHttpsPortFT; - SvxNoSpaceEdit aHttpsPortED; - - - FixedText aFtpProxyFT; - SvxNoSpaceEdit aFtpProxyED; - FixedText aFtpPortFT; - SvxNoSpaceEdit aFtpPortED; - - FixedText aNoProxyForFT; - Edit aNoProxyForED; - FixedText aNoProxyDescFT; - - String sFromBrowser; - - const rtl::OUString aProxyModePN; - const rtl::OUString aHttpProxyPN; - const rtl::OUString aHttpPortPN; - const rtl::OUString aHttpsProxyPN; - const rtl::OUString aHttpsPortPN; - const rtl::OUString aFtpProxyPN; - const rtl::OUString aFtpPortPN; - const rtl::OUString aNoProxyDescPN; - - uno::Reference< uno::XInterface > m_xConfigurationUpdateAccess; - -#ifdef _SVX_OPTINET2_CXX - void ArrangeControls_Impl(); - void EnableControls_Impl(sal_Bool bEnable); - void ReadConfigData_Impl(); - void ReadConfigDefaults_Impl(); - void RestoreConfigDefaults_Impl(); - - DECL_LINK( ProxyHdl_Impl, ListBox * ); - DECL_LINK( LoseFocusHdl_Impl, Edit * ); -#endif - - SvxProxyTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~SvxProxyTabPage(); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -// #98647# class SvxScriptExecListBox ------------------------------------ -class SvxScriptExecListBox : public ListBox -{ // for adding tooltips to ListBox -public: - SvxScriptExecListBox( Window* pParent, WinBits nStyle = WB_BORDER ) - :ListBox(pParent, nStyle) {} - SvxScriptExecListBox( Window* pParent, const ResId& rResId ) - :ListBox(pParent, rResId) {} - -protected: - virtual void RequestHelp( const HelpEvent& rHEvt ); -}; - -// class SvxSecurityTabPage --------------------------------------------- - -class SvtSecurityOptions; - -class SvxSecurityTabPage : public SfxTabPage -{ - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - -private: - FixedLine maSecurityOptionsFL; - FixedInfo maSecurityOptionsFI; - PushButton maSecurityOptionsPB; - - FixedLine maPasswordsFL; - CheckBox maSavePasswordsCB; - PushButton maShowConnectionsPB; - CheckBox maMasterPasswordCB; - FixedInfo maMasterPasswordFI; - PushButton maMasterPasswordPB; - - FixedLine maMacroSecFL; - FixedInfo maMacroSecFI; - PushButton maMacroSecPB; - - SvtSecurityOptions* mpSecOptions; - svx::SecurityOptionsDialog* mpSecOptDlg; - - String msPasswordStoringDeactivateStr; - - DECL_LINK( SecurityOptionsHdl, PushButton* ); - DECL_LINK( SavePasswordHdl, void* ); - DECL_LINK( MasterPasswordHdl, PushButton* ); - DECL_LINK( MasterPasswordCBHdl, void* ); - DECL_LINK( ShowPasswordsHdl, PushButton* ); - DECL_LINK( MacroSecPBHdl, void* ); - - void InitControls(); - - SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~SvxSecurityTabPage(); - -protected: - virtual void ActivatePage( const SfxItemSet& rSet ); - virtual int DeactivatePage( SfxItemSet* pSet = 0 ); - -public: - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -class MozPluginTabPage : public SfxTabPage -{ - FixedLine aMSWordGB; - CheckBox aWBasicCodeCB; - - sal_Bool isInstalled(void); - sal_Bool installPlugin(void); - sal_Bool uninstallPlugin(void); - - MozPluginTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~MozPluginTabPage(); - -public: - - static SfxTabPage* Create( Window* pParent, - const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - -}; - -#endif - -#ifdef WNT -#else -#define HELPER_PAGE_COMPLETE -#endif - -struct SvxEMailTabPage_Impl; -class SvxEMailTabPage : public SfxTabPage -{ - FixedLine aMailFL; - ReadOnlyImage aMailerURLFI; - FixedText aMailerURLFT; - Edit aMailerURLED; - PushButton aMailerURLPB; - - String m_sDefaultFilterName; - - SvxEMailTabPage_Impl* pImpl; - - DECL_LINK( FileDialogHdl_Impl, PushButton* ) ; - -public: - SvxEMailTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxEMailTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif // #ifndef _SVX_OPTINET_HXX - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src deleted file mode 100644 index 80543f8ec..000000000 --- a/cui/source/options/optinet2.src +++ /dev/null @@ -1,482 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include -#include "helpid.hrc" -#include -#include "optinet2.hrc" - // pragma ------------------------------------------------------------------- - -/************************************************************************/ -/* */ -/* Proxy server */ -/* */ -/************************************************************************/ - -TabPage RID_SVXPAGE_INET_MOZPLUGIN -{ - HelpID = "cui:TabPage:RID_SVXPAGE_INET_MOZPLUGIN"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - - FixedLine GB_MOZPLUGIN - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text[ en-US ] = "Browser Plug-in"; - }; - CheckBox CB_MOZPLUGIN_CODE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_INET_MOZPLUGIN:CB_MOZPLUGIN_CODE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Display documents in browser" ; - }; -}; - -TabPage RID_SVXPAGE_INET_PROXY -{ - HelpId = HID_OPTIONS_PROXY ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Proxy" ; - #define GB_TYPES_TOP 3 - #define GB_TYPES_LEFT 6 - FixedLine GB_SETTINGS - { - Pos = MAP_APPFONT ( GB_TYPES_LEFT , GB_TYPES_TOP ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Settings" ; - }; - FixedText FT_PROXYMODE - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 13 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Proxy s~erver" ; - }; - ListBox LB_PROXYMODE - { - HelpID = "cui:ListBox:RID_SVXPAGE_INET_PROXY:LB_PROXYMODE"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 11 ) ; - Size = MAP_APPFONT ( 49 , 48 ) ; - Border = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "None" ; > ; - < "System" ; > ; - < "Manual" ; > ; - }; - }; - String ST_PROXY_FROM_BROWSER - { - Text [ en-US ] = "Use browser settings"; - }; - FixedText FT_HTTP_PROXY - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 29 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "HT~TP proxy" ; - }; - Edit ED_HTTP_PROXY - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_HTTP_PROXY"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 27 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - }; - - #define FT_PORT_WIDTH 37 - #define ED_PORT_WIDTH 20 - #define ED_PORT_COL 229 - - FixedText FT_HTTP_PORT - { - Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 29 ) ; - Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ; - Right = TRUE; - Text [ en-US ] = "~Port" ; - }; - Edit ED_HTTP_PORT - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_HTTP_PORT"; - Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 27 ) ; - Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ; - Border = TRUE ; - }; - - FixedText FT_HTTPS_PROXY - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 45 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "HTTP~S proxy" ; - }; - Edit ED_HTTPS_PROXY - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_HTTPS_PROXY"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 43 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_HTTPS_PORT - { - Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 45 ) ; - Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ; - Right = TRUE; - Text [ en-US ] = "P~ort" ; - }; - Edit ED_HTTPS_PORT - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_HTTPS_PORT"; - Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 43 ) ; - Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ; - Border = TRUE ; - }; - - FixedText FT_FTP_PROXY - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 61 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~FTP proxy" ; - }; - Edit ED_FTP_PROXY - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_FTP_PROXY"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 59 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_FTP_PORT - { - Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 61 ) ; - Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ; - Right = TRUE; - Text [ en-US ] = "P~ort" ; - }; - Edit ED_FTP_PORT - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_FTP_PORT"; - Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 59 ) ; - Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ; - Border = TRUE ; - }; - FixedText FT_SOCKS_PROXY - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 77 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~SOCKS proxy" ; - }; - Edit ED_SOCKS_PROXY - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_SOCKS_PROXY"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 75 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - }; - FixedText FT_SOCKS_PORT - { - Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 77 ) ; - Size = MAP_APPFONT ( FT_PORT_WIDTH , 8 ) ; - Right = TRUE; - Text [ en-US ] = "Po~rt" ; - }; - Edit ED_SOCKS_PORT - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_SOCKS_PORT"; - Pos = MAP_APPFONT ( ED_PORT_COL , GB_TYPES_TOP + 75 ) ; - Size = MAP_APPFONT ( ED_PORT_WIDTH , 12 ) ; - Border = TRUE ; - }; - FixedText FT_NOPROXYFOR - { - Pos = MAP_APPFONT ( 12 , GB_TYPES_TOP + 93 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~No proxy for:" ; - }; - Edit ED_NOPROXYFOR - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_PROXY:ED_NOPROXYFOR"; - Pos = MAP_APPFONT ( 65 , GB_TYPES_TOP + 91 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - }; - FixedText ED_NOPROXYDESC - { - Pos = MAP_APPFONT ( 190 , GB_TYPES_TOP + 93 ) ; - Size = MAP_APPFONT ( 56 , 8 ) ; - Text [ en-US ] = "Separator ;" ; - }; - FixedLine GB_DNS - { - Pos = MAP_APPFONT( 6, 100 ); - Size = MAP_APPFONT( 248, 8 ); - Text [ en-US ] = "DNS server" ; - }; - RadioButton RB_DNS_AUTO - { - HelpID = "cui:RadioButton:RID_SVXPAGE_INET_PROXY:RB_DNS_AUTO"; - Pos = MAP_APPFONT( 12, 111 ); - Size = MAP_APPFONT( 236, 10 ); - Text [ en-US ] = "~Automatic" ; - }; - RadioButton RB_DNS_MANUAL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_INET_PROXY:RB_DNS_MANUAL"; - Pos = MAP_APPFONT( 12, 124 ); - Size = MAP_APPFONT( 75, 10 ); - Text [ en-US ] = "~Manual" ; - }; - PatternField ED_DNS - { - HelpID = "cui:PatternField:RID_SVXPAGE_INET_PROXY:ED_DNS"; - Pos = MAP_APPFONT( 90, 126 ); - Size = MAP_APPFONT( 66, 12 ); - Border = TRUE ; - LiteralMask = " . . . " ; - EditMask = "nnnLnnnLnnnLnnn" ; - StrictFormat = TRUE ; - }; - String ST_MSG_255_0 - { - Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 0 and 255." ; - }; - String ST_MSG_255_1 - { - Text [ en-US ] = "is not a valid entry for this field. Please specify a value between 1 and 255." ; - }; -}; - - -/************************************************************************/ -/* */ -/* Scripting */ -/* */ -/************************************************************************/ - -TabPage RID_SVXPAGE_INET_SECURITY -{ - HelpID = "cui:TabPage:RID_SVXPAGE_INET_SECURITY"; - OutputSize = TRUE ; - Size = MAP_APPFONT( TP_WIDTH , TP_HEIGHT ); - SVLook = TRUE; - Hide = TRUE; - Text [ en-US ] = "Security"; - FixedLine FL_SEC_SECURITYOPTIONS - { - Pos = MAP_APPFONT( COL_0, ROW_0 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Security options and warnings"; - }; - FixedText FI_SEC_SECURITYOPTIONS - { - Pos = MAP_APPFONT( COL_1, ROW_1 ); - Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT ); - Wordbreak = TRUE; - Text [ en-US ] = "Adjust security related options and define warnings for hidden information in documents."; - }; - PushButton PB_SEC_SECURITYOPTIONS - { - HelpID = "cui:PushButton:RID_SVXPAGE_INET_SECURITY:PB_SEC_SECURITYOPTIONS"; - Pos = MAP_APPFONT( COL_3, ROW_2a ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Options..."; - }; - FixedLine FL_SEC_PASSWORDS - { - Pos = MAP_APPFONT( COL_0, ROW_2 - 2 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Passwords for web connections"; - }; - CheckBox CB_SEC_SAVEPASSWORDS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_INET_SECURITY:CB_SEC_SAVEPASSWORDS"; - Pos = MAP_APPFONT( COL_1, ROW_3 - 4 ); - Size = MAP_APPFONT( COL_2-COL_1, 16 ); - Wordbreak = TRUE; - Text [ en-US ] = "Persistently save passwords for web connections"; - }; - PushButton PB_SEC_CONNECTIONS - { - HelpID = "cui:PushButton:RID_SVXPAGE_INET_SECURITY:PB_SEC_CONNECTIONS"; - Pos = MAP_APPFONT( COL_3, ROW_3-1 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Connections..."; - }; - CheckBox CB_SEC_MASTERPASSWORD - { - HelpID = "cui:CheckBox:RID_SVXPAGE_INET_SECURITY:CB_SEC_MASTERPASSWORD"; - Pos = MAP_APPFONT( COL_1a, ROW_4 ); - Size = MAP_APPFONT( COL_2-COL_1a, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Protected by a master password (recommended)"; - }; - FixedText FI_SEC_MASTERPASSWORD - { - Pos = MAP_APPFONT( COL_1a, ROW_4a ); - Size = MAP_APPFONT( COL_2-COL_1a, 4*RSC_CD_FIXEDLINE_HEIGHT ); - Wordbreak = TRUE; - Text [ en-US ] = "Passwords are protected by a master password. You will be asked to enter it once per session, if %PRODUCTNAME retrieves a password from the protected password list."; - }; - PushButton PB_SEC_MASTERPASSWORD - { - HelpID = "cui:PushButton:RID_SVXPAGE_INET_SECURITY:PB_SEC_MASTERPASSWORD"; - Pos = MAP_APPFONT( COL_3, ROW_4a ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Master Password..."; - }; - FixedLine FL_SEC_MACROSEC - { - Pos = MAP_APPFONT( COL_0, ROW_5 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Macro security"; - }; - FixedText FI_SEC_MACROSEC - { - Pos = MAP_APPFONT( COL_1, ROW_6 ); - Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT ); - Wordbreak = TRUE; - Text [ en-US ] = "Adjust the security level for executing macros and specify trusted macro developers."; - }; - PushButton PB_SEC_MACROSEC - { - HelpID = "cui:PushButton:RID_SVXPAGE_INET_SECURITY:PB_SEC_MACROSEC"; - Pos = MAP_APPFONT( COL_3, ROW_6-2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Macro Security..."; - }; - String STR_SEC_NOPASSWDSAVE - { - Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?"; - }; -}; - -ErrorBox RID_SVXERR_OPT_PROXYPORTS -{ - BUTTONS = WB_OK ; - Message [ en-US ] = "Invalid value!\n\nThe maximum value for a port number is 65535."; -}; - -// RID_SVXDLG_OPT_JAVASCRIPT_DISABLE ----------------------------------------- - -ModalDialog RID_SVXDLG_OPT_JAVASCRIPT_DISABLE -{ - HelpID = "cui:ModalDialog:RID_SVXDLG_OPT_JAVASCRIPT_DISABLE"; - OutputSize = TRUE; - Size = MAP_APPFONT( 150, 81 ); - Moveable = TRUE; - Closeable = TRUE; - FixedImage IMG_JSCPT_WARNING - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 30, 30 ); - }; - FixedText FT_JSCPT_WARNING - { - Pos = MAP_APPFONT( 39, 6 ); - Size = MAP_APPFONT( 195, 36 ); - WordBreak = TRUE; - Text [ en-US ] = "Please note that with Java\nyou disable Javascript as well.\n\nDo you still want to disable Java?"; - }; - CheckBox CB_JSCPT_DISABLE - { - HelpID = "cui:CheckBox:RID_SVXDLG_OPT_JAVASCRIPT_DISABLE:CB_JSCPT_DISABLE"; - Pos = MAP_APPFONT( 39, 45 ); - Size = MAP_APPFONT( 195, 12 ); - Hide = TRUE; - Text [ en-US ] = "~Don't show warning again"; - }; - OKButton BTN_JSCPT_YES - { - Pos = MAP_APPFONT( 41, 61 ); - Size = MAP_APPFONT( 50, 14 ); - }; - CancelButton BTN_JSCPT_NO - { - Pos = MAP_APPFONT( 94, 61 ); - Size = MAP_APPFONT( 50, 14 ); - DefButton = TRUE; - }; -}; - -// ******************************************************************* - -TabPage RID_SVXPAGE_INET_MAIL -{ - HelpID = HID_OPTIONS_MAIL ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - - FixedLine FL_MAIL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Sending documents as e-mail attachments"; - }; - - FixedImage FI_MAILERURL - { - Pos = MAP_APPFONT ( 5 , 21 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - - FixedText FT_MAILERURL - { - Pos = MAP_APPFONT ( 14 , 20 ) ; - Size = MAP_APPFONT ( 43 , 8 ) ; - Text [ en-US ] = "~E-mail program"; - }; - - Edit ED_MAILERURL - { - HelpID = "cui:Edit:RID_SVXPAGE_INET_MAIL:ED_MAILERURL"; - Pos = MAP_APPFONT ( 60 , 18 ) ; - Size = MAP_APPFONT ( 171 , 12 ) ; - Border = TRUE; - }; - - PushButton PB_MAILERURL - { - HelpID = "cui:PushButton:RID_SVXPAGE_INET_MAIL:PB_MAILERURL"; - Pos = MAP_APPFONT ( 234 , 17 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "..." ; - }; - - String STR_DEFAULT_FILENAME - { - Text [ en-US ] = "All files (*.*)" ; - }; -}; - - // ******************************************************************* EOF - diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx deleted file mode 100644 index f3b31216e..000000000 --- a/cui/source/options/optjava.cxx +++ /dev/null @@ -1,1077 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "optjava.hxx" -#include - -#include "optjava.hrc" -#include -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// define ---------------------------------------------------------------- - -#define CLASSPATH_DELIMITER SAL_PATHSEPARATOR -#define STRIM( s ) s.EraseLeadingChars().EraseTrailingChars() -#define BUTTON_BORDER 2 -#define RESET_TIMEOUT 300 - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; - -// ----------------------------------------------------------------------- - -bool areListsEqual( const Sequence< ::rtl::OUString >& rListA, const Sequence< ::rtl::OUString >& rListB ) -{ - bool bRet = true; - const sal_Int32 nLen = rListA.getLength(); - - if ( rListB.getLength() != nLen ) - bRet = false; - else - { - const ::rtl::OUString* pStringA = rListA.getConstArray(); - const ::rtl::OUString* pStringB = rListB.getConstArray(); - - for ( sal_Int32 i = 0; i < nLen; ++i ) - { - if ( *pStringA++ != *pStringB++ ) - { - bRet = false; - break; - } - } - } - - return bRet; -} - -// class SvxJavaOptionsPage ---------------------------------------------- - -SvxJavaOptionsPage::SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_OPTIONS_JAVA ), rSet ), - - m_aJavaLine ( this, CUI_RES( FL_JAVA ) ), - m_aJavaEnableCB ( this, CUI_RES( CB_JAVA_ENABLE ) ), - m_aJavaFoundLabel ( this, CUI_RES( FT_JAVA_FOUND ) ), - m_aJavaListContainer(this, CUI_RES(LB_JAVA)), - m_aJavaList(m_aJavaListContainer), - m_aJavaPathText ( this, CUI_RES( FT_JAVA_PATH ) ), - m_aAddBtn ( this, CUI_RES( PB_ADD ) ), - m_aParameterBtn ( this, CUI_RES( PB_PARAMETER ) ), - m_aClassPathBtn ( this, CUI_RES( PB_CLASSPATH ) ), - - m_pParamDlg ( NULL ), - m_pPathDlg ( NULL ), - m_parJavaInfo ( NULL ), - m_parParameters ( NULL ), - m_pClassPath ( NULL ), - m_nInfoSize ( 0 ), - m_nParamSize ( 0 ), - m_sInstallText ( CUI_RES( STR_INSTALLED_IN ) ), - m_sAccessibilityText( CUI_RES( STR_ACCESSIBILITY ) ), - m_sAddDialogText ( CUI_RES( STR_ADDDLGTEXT ) ), - - xDialogListener ( new ::svt::DialogClosedListener() ) - -{ - m_aJavaEnableCB.SetClickHdl( LINK( this, SvxJavaOptionsPage, EnableHdl_Impl ) ); - m_aJavaList.SetCheckButtonHdl( LINK( this, SvxJavaOptionsPage, CheckHdl_Impl ) ); - m_aJavaList.SetSelectHdl( LINK( this, SvxJavaOptionsPage, SelectHdl_Impl ) ); - m_aAddBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, AddHdl_Impl ) ); - m_aParameterBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ParameterHdl_Impl ) ); - m_aClassPathBtn.SetClickHdl( LINK( this, SvxJavaOptionsPage, ClassPathHdl_Impl ) ); - m_aResetTimer.SetTimeoutHdl( LINK( this, SvxJavaOptionsPage, ResetHdl_Impl ) ); - m_aResetTimer.SetTimeout( RESET_TIMEOUT ); - - static long aStaticTabs[]= - { - 5, 0, 15, 90, 130, 300 - }; - - m_aJavaList.SvxSimpleTable::SetTabs( aStaticTabs ); - String sHeader( '\t' ); - sHeader += String( CUI_RES( STR_HEADER_VENDOR ) ); - sHeader += '\t'; - sHeader += String( CUI_RES( STR_HEADER_VERSION ) ); - sHeader += '\t'; - sHeader += String( CUI_RES( STR_HEADER_FEATURES ) ); - sHeader += '\t'; - m_aJavaList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT ); - - m_aJavaList.SetHelpId( HID_OPTIONS_JAVA_LIST ); - - FreeResource(); - - xDialogListener->SetDialogClosedLink( LINK( this, SvxJavaOptionsPage, DialogClosedHdl ) ); - - EnableHdl_Impl( &m_aJavaEnableCB ); - jfw_lock(); - - //check if the text fits into the class path button - Size aButtonSize = m_aClassPathBtn.GetOutputSizePixel(); - sal_Int32 nTextWidth = m_aClassPathBtn.GetTextWidth(m_aClassPathBtn.GetText()); - //add some additional space - sal_Int32 nDiff = nTextWidth + 4 - aButtonSize.Width(); - if( nDiff > 0) - { - Point aPos(m_aClassPathBtn.GetPosPixel()); - aPos.X() -= nDiff; - aButtonSize.Width() += nDiff; - m_aClassPathBtn.SetPosSizePixel(aPos, aButtonSize); - aPos = m_aAddBtn.GetPosPixel(); - aPos.X() -= nDiff; - m_aAddBtn.SetPosSizePixel(aPos, aButtonSize); - aPos = m_aParameterBtn.GetPosPixel(); - aPos.X() -= nDiff; - m_aParameterBtn.SetPosSizePixel(aPos, aButtonSize); - Size aSize = m_aJavaListContainer.GetSizePixel(); - aSize.Width() -= nDiff; - m_aJavaListContainer.SetSizePixel(aSize); - } -} - -// ----------------------------------------------------------------------- - -SvxJavaOptionsPage::~SvxJavaOptionsPage() -{ - delete m_pParamDlg; - delete m_pPathDlg; - ClearJavaInfo(); - std::vector< JavaInfo* >::iterator pIter; - for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter ) - { - JavaInfo* pInfo = *pIter; - jfw_freeJavaInfo( pInfo ); - } - - jfw_unlock(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, EnableHdl_Impl, CheckBox *, EMPTYARG ) -{ - sal_Bool bEnable = m_aJavaEnableCB.IsChecked(); - m_aJavaFoundLabel.Enable( bEnable ); - m_aJavaPathText.Enable( bEnable ); - m_aAddBtn.Enable( bEnable ); - m_aParameterBtn.Enable( bEnable ); - m_aClassPathBtn.Enable( bEnable ); - - bEnable ? m_aJavaList.EnableTable() : m_aJavaList.DisableTable(); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, CheckHdl_Impl, SvxSimpleTable *, pList ) -{ - SvLBoxEntry* pEntry = pList ? m_aJavaList.GetEntry( m_aJavaList.GetCurMousePoint() ) - : m_aJavaList.FirstSelected(); - if ( pEntry ) - m_aJavaList.HandleEntryChecked( pEntry ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, SelectHdl_Impl, SvxSimpleTable *, EMPTYARG ) -{ - // set installation directory info - SvLBoxEntry* pEntry = m_aJavaList.FirstSelected(); - DBG_ASSERT( pEntry, "SvxJavaOptionsPage::SelectHdl_Impl(): no entry" ); - String* pLocation = static_cast< String* >( pEntry->GetUserData() ); - DBG_ASSERT( pLocation, "invalid location string" ); - String sInfo = m_sInstallText; - if ( pLocation ) - sInfo += *pLocation; - m_aJavaPathText.SetText( sInfo ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, AddHdl_Impl, PushButton *, EMPTYARG ) -{ - try - { - Reference < XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - xFolderPicker = Reference< XFolderPicker >( - xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FolderPicker") ) ), UNO_QUERY ); - - String sWorkFolder = SvtPathOptions().GetWorkPath(); - xFolderPicker->setDisplayDirectory( sWorkFolder ); - xFolderPicker->setDescription( m_sAddDialogText ); - - Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK ) - AddFolder( xFolderPicker->getDirectory() ); - } - catch ( Exception& ) - { -#ifdef DBG_UTIL - DBG_ERRORFILE( "SvxJavaOptionsPage::AddHdl_Impl(): caught exception" ); -#endif - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, ParameterHdl_Impl, PushButton *, EMPTYARG ) -{ - Sequence< ::rtl::OUString > aParameterList; - if ( !m_pParamDlg ) - { - m_pParamDlg = new SvxJavaParameterDlg( this ); - javaFrameworkError eErr = jfw_getVMParameters( &m_parParameters, &m_nParamSize ); - if ( JFW_E_NONE == eErr && m_parParameters && m_nParamSize > 0 ) - { - rtl_uString** pParamArr = m_parParameters; - aParameterList.realloc( m_nParamSize ); - ::rtl::OUString* pParams = aParameterList.getArray(); - for ( sal_Int32 i = 0; i < m_nParamSize; ++i ) - { - rtl_uString* pParam = *pParamArr++; - pParams[i] = ::rtl::OUString( pParam ); - } - m_pParamDlg->SetParameters( aParameterList ); - } - } - else - aParameterList = m_pParamDlg->GetParameters(); - - if ( m_pParamDlg->Execute() == RET_OK ) - { - if ( !areListsEqual( aParameterList, m_pParamDlg->GetParameters() ) ) - { - aParameterList = m_pParamDlg->GetParameters(); - sal_Bool bRunning = sal_False; - javaFrameworkError eErr = jfw_isVMRunning( &bRunning ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" ); - (void)eErr; - if ( bRunning ) - { - WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) ); - aWarnBox.Execute(); - } - } - } - else - m_pParamDlg->SetParameters( aParameterList ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, ClassPathHdl_Impl, PushButton *, EMPTYARG ) -{ - String sClassPath; - - if ( !m_pPathDlg ) - { - m_pPathDlg = new SvxJavaClassPathDlg( this ); - javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath ); - if ( JFW_E_NONE == eErr && m_pClassPath ) - { - sClassPath = String( ::rtl::OUString( m_pClassPath ) ); - m_pPathDlg->SetClassPath( sClassPath ); - } - } - else - sClassPath = m_pPathDlg->GetClassPath(); - - m_pPathDlg->SetFocus(); - if ( m_pPathDlg->Execute() == RET_OK ) - { - - if ( m_pPathDlg->GetClassPath() != sClassPath ) - { - sClassPath = m_pPathDlg->GetClassPath(); - sal_Bool bRunning = sal_False; - javaFrameworkError eErr = jfw_isVMRunning( &bRunning ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::ParameterHdl_Impl(): error in jfw_isVMRunning" ); - (void)eErr; - if ( bRunning ) - { - WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) ); - aWarnBox.Execute(); - } - } - } - else - m_pPathDlg->SetClassPath( sClassPath ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, ResetHdl_Impl, Timer *, EMPTYARG ) -{ - LoadJREs(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, StartFolderPickerHdl, void*, EMPTYARG ) -{ - try - { - Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else if ( xFolderPicker.is() && xFolderPicker->execute() == ExecutableDialogResults::OK ) - AddFolder( xFolderPicker->getDirectory() ); - } - catch ( Exception& ) - { -#ifdef DBG_UTIL - DBG_ERRORFILE( "SvxJavaOptionsPage::StartFolderPickerHdl(): caught exception" ); -#endif - } - - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt ) -{ - if ( RET_OK == pEvt->DialogResult ) - { - DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxJavaOptionsPage::DialogClosedHdl(): no folder picker" ); - - AddFolder( xFolderPicker->getDirectory() ); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::ClearJavaInfo() -{ - if ( m_parJavaInfo ) - { - JavaInfo** parInfo = m_parJavaInfo; - for ( sal_Int32 i = 0; i < m_nInfoSize; ++i ) - { - JavaInfo* pInfo = *parInfo++; - jfw_freeJavaInfo( pInfo ); - } - - rtl_freeMemory( m_parJavaInfo ); - m_parJavaInfo = NULL; - m_nInfoSize = 0; - } -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::ClearJavaList() -{ - SvLBoxEntry* pEntry = m_aJavaList.First(); - while ( pEntry ) - { - String* pLocation = static_cast< String* >( pEntry->GetUserData() ); - delete pLocation; - pEntry = m_aJavaList.Next( pEntry ); - } - m_aJavaList.Clear(); -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::LoadJREs() -{ - WaitObject aWaitObj( &m_aJavaList ); - javaFrameworkError eErr = jfw_findAllJREs( &m_parJavaInfo, &m_nInfoSize ); - if ( JFW_E_NONE == eErr && m_parJavaInfo ) - { - JavaInfo** parInfo = m_parJavaInfo; - for ( sal_Int32 i = 0; i < m_nInfoSize; ++i ) - { - JavaInfo* pInfo = *parInfo++; - AddJRE( pInfo ); - } - } - - std::vector< JavaInfo* >::iterator pIter; - for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter ) - { - JavaInfo* pInfo = *pIter; - AddJRE( pInfo ); - } - - JavaInfo* pSelectedJava = NULL; - eErr = jfw_getSelectedJRE( &pSelectedJava ); - if ( JFW_E_NONE == eErr && pSelectedJava ) - { - JavaInfo** parInfo = m_parJavaInfo; - for ( sal_Int32 i = 0; i < m_nInfoSize; ++i ) - { - JavaInfo* pCmpInfo = *parInfo++; - if ( jfw_areEqualJavaInfo( pCmpInfo, pSelectedJava ) ) - { - SvLBoxEntry* pEntry = m_aJavaList.GetEntry(i); - if ( pEntry ) - m_aJavaList.HandleEntryChecked( pEntry ); - break; - } - } - } - - jfw_freeJavaInfo( pSelectedJava ); -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::AddJRE( JavaInfo* _pInfo ) -{ - String sEntry( '\t' ); - sEntry += String( ::rtl::OUString( _pInfo->sVendor ) ); - sEntry += '\t'; - sEntry += String( ::rtl::OUString( _pInfo->sVersion ) ); - sEntry += '\t'; - if ( ( _pInfo->nFeatures & JFW_FEATURE_ACCESSBRIDGE ) == JFW_FEATURE_ACCESSBRIDGE ) - sEntry += m_sAccessibilityText; - SvLBoxEntry* pEntry = m_aJavaList.InsertEntry( sEntry ); - INetURLObject aLocObj( ::rtl::OUString( _pInfo->sLocation ) ); - String* pLocation = new String( aLocObj.getFSysPath( INetURLObject::FSYS_DETECT ) ); - pEntry->SetUserData( pLocation ); -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::HandleCheckEntry( SvLBoxEntry* _pEntry ) -{ - m_aJavaList.Select( _pEntry, sal_True ); - SvButtonState eState = m_aJavaList.GetCheckButtonState( _pEntry ); - - if ( SV_BUTTON_CHECKED == eState ) - { - // we have radio button behavior -> so uncheck the other entries - SvLBoxEntry* pEntry = m_aJavaList.First(); - while ( pEntry ) - { - if ( pEntry != _pEntry ) - m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED ); - pEntry = m_aJavaList.Next( pEntry ); - } - } - else - m_aJavaList.SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED ); -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::AddFolder( const ::rtl::OUString& _rFolder ) -{ - bool bStartAgain = true; - JavaInfo* pInfo = NULL; - javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo ); - if ( JFW_E_NONE == eErr && pInfo ) - { - sal_Int32 nPos = 0; - bool bFound = false; - JavaInfo** parInfo = m_parJavaInfo; - for ( sal_Int32 i = 0; i < m_nInfoSize; ++i ) - { - JavaInfo* pCmpInfo = *parInfo++; - if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) ) - { - bFound = true; - nPos = i; - break; - } - } - - if ( !bFound ) - { - std::vector< JavaInfo* >::iterator pIter; - for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter ) - { - JavaInfo* pCmpInfo = *pIter; - if ( jfw_areEqualJavaInfo( pCmpInfo, pInfo ) ) - { - bFound = true; - break; - } - } - } - - if ( !bFound ) - { - jfw_addJRELocation( pInfo->sLocation ); - AddJRE( pInfo ); - m_aAddedInfos.push_back( pInfo ); - nPos = m_aJavaList.GetEntryCount() - 1; - } - else - jfw_freeJavaInfo( pInfo ); - - SvLBoxEntry* pEntry = m_aJavaList.GetEntry( nPos ); - m_aJavaList.Select( pEntry ); - m_aJavaList.SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - HandleCheckEntry( pEntry ); - bStartAgain = false; - } - else if ( JFW_E_NOT_RECOGNIZED == eErr ) - { - ErrorBox aErrBox( this, CUI_RES( RID_SVXERR_JRE_NOT_RECOGNIZED ) ); - aErrBox.Execute(); - } - else if ( JFW_E_FAILED_VERSION == eErr ) - { - ErrorBox aErrBox( this, CUI_RES( RID_SVXERR_JRE_FAILED_VERSION ) ); - aErrBox.Execute(); - } - - if ( bStartAgain ) - { - xFolderPicker->setDisplayDirectory( _rFolder ); - Application::PostUserEvent( LINK( this, SvxJavaOptionsPage, StartFolderPickerHdl ) ); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxJavaOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return ( new SvxJavaOptionsPage( pParent, rAttrSet ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxJavaOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ ) -{ - sal_Bool bModified = sal_False; - javaFrameworkError eErr = JFW_E_NONE; - if ( m_pParamDlg ) - { - Sequence< ::rtl::OUString > aParamList = m_pParamDlg->GetParameters(); - sal_Int32 i, nSize = aParamList.getLength(); - rtl_uString** pParamArr = (rtl_uString**)rtl_allocateMemory( sizeof(rtl_uString*) * nSize ); - rtl_uString** pParamArrIter = pParamArr; - const ::rtl::OUString* pList = aParamList.getConstArray(); - for ( i = 0; i < nSize; ++i ) - pParamArr[i] = pList[i].pData; - eErr = jfw_setVMParameters( pParamArrIter, nSize ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters" ); - pParamArrIter = pParamArr; - rtl_freeMemory( pParamArr ); - bModified = sal_True; - } - - if ( m_pPathDlg ) - { - ::rtl::OUString sPath( m_pPathDlg->GetClassPath() ); - if ( m_pPathDlg->GetOldPath() != String( sPath ) ) - { - eErr = jfw_setUserClassPath( sPath.pData ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath" ); - bModified = sal_True; - } - } - - sal_uLong nCount = m_aJavaList.GetEntryCount(); - for ( sal_uLong i = 0; i < nCount; ++i ) - { - if ( m_aJavaList.GetCheckButtonState( m_aJavaList.GetEntry(i) ) == SV_BUTTON_CHECKED ) - { - JavaInfo* pInfo = NULL; - if ( i < static_cast< sal_uLong >( m_nInfoSize ) ) - pInfo = m_parJavaInfo[i]; - else - pInfo = m_aAddedInfos[ i - m_nInfoSize ]; - - JavaInfo* pSelectedJava = NULL; - eErr = jfw_getSelectedJRE( &pSelectedJava ); - if ( JFW_E_NONE == eErr || JFW_E_INVALID_SETTINGS == eErr ) - { - if (pSelectedJava == NULL || !jfw_areEqualJavaInfo( pInfo, pSelectedJava ) ) - { - sal_Bool bRunning = sal_False; - eErr = jfw_isVMRunning( &bRunning ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_isVMRunning" ); - if ( bRunning || - ( ( pInfo->nRequirements & JFW_REQUIRE_NEEDRESTART ) == JFW_REQUIRE_NEEDRESTART ) ) - { - WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART ) ); - aWarnBox.Execute(); - } - - eErr = jfw_setSelectedJRE( pInfo ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE" ); - bModified = sal_True; - } - } - jfw_freeJavaInfo( pSelectedJava ); - break; - } - } - - sal_Bool bEnabled = sal_False; - eErr = jfw_getEnabled( &bEnabled ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_getEnabled" ); - if ( bEnabled != m_aJavaEnableCB.IsChecked() ) - { - eErr = jfw_setEnabled( m_aJavaEnableCB.IsChecked() ); - DBG_ASSERT( JFW_E_NONE == eErr, - "SvxJavaOptionsPage::FillItemSet(): error in jfw_setEnabled" ); - bModified = sal_True; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::Reset( const SfxItemSet& /*rSet*/ ) -{ - ClearJavaInfo(); - ClearJavaList(); - - sal_Bool bEnabled = sal_False; - javaFrameworkError eErr = jfw_getEnabled( &bEnabled ); - if ( eErr != JFW_E_NONE ) - bEnabled = sal_False; - m_aJavaEnableCB.Check( bEnabled ); - EnableHdl_Impl( &m_aJavaEnableCB ); - - m_aResetTimer.Start(); -} - -// ----------------------------------------------------------------------- - -void SvxJavaOptionsPage::FillUserData() -{ - String aUserData; - SetUserData( aUserData ); -} - -// class SvxJavaParameterDlg --------------------------------------------- - -SvxJavaParameterDlg::SvxJavaParameterDlg( Window* pParent ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_JAVA_PARAMETER ) ), - - m_aParameterLabel ( this, CUI_RES( FT_PARAMETER ) ), - m_aParameterEdit ( this, CUI_RES( ED_PARAMETER ) ), - m_aAssignBtn ( this, CUI_RES( PB_ASSIGN ) ), - m_aAssignedLabel ( this, CUI_RES( FT_ASSIGNED ) ), - m_aAssignedList ( this, CUI_RES( LB_ASSIGNED ) ), - m_aExampleText ( this, CUI_RES( FT_EXAMPLE ) ), - m_aRemoveBtn ( this, CUI_RES( PB_REMOVE ) ), - m_aButtonsLine ( this, CUI_RES( FL_BUTTONS ) ), - m_aOKBtn ( this, CUI_RES( PB_PARAMETER_OK ) ), - m_aCancelBtn ( this, CUI_RES( PB_PARAMETER_ESC ) ), - m_aHelpBtn ( this, CUI_RES( PB_PARAMETER_HLP ) ) - -{ - FreeResource(); - - m_aParameterEdit.SetModifyHdl( LINK( this, SvxJavaParameterDlg, ModifyHdl_Impl ) ); - m_aAssignBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, AssignHdl_Impl ) ); - m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaParameterDlg, RemoveHdl_Impl ) ); - m_aAssignedList.SetSelectHdl( LINK( this, SvxJavaParameterDlg, SelectHdl_Impl ) ); - m_aAssignedList.SetDoubleClickHdl( LINK( this, SvxJavaParameterDlg, DblClickHdl_Impl ) ); - - ModifyHdl_Impl( &m_aParameterEdit ); - EnableRemoveButton(); -} - -// ----------------------------------------------------------------------- - -SvxJavaParameterDlg::~SvxJavaParameterDlg() -{ -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaParameterDlg, ModifyHdl_Impl, Edit *, EMPTYARG ) -{ - String sParam = STRIM( m_aParameterEdit.GetText() ); - m_aAssignBtn.Enable( sParam.Len() > 0 ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaParameterDlg, AssignHdl_Impl, PushButton *, EMPTYARG ) -{ - String sParam = STRIM( m_aParameterEdit.GetText() ); - if ( sParam.Len() > 0 ) - { - sal_uInt16 nPos = m_aAssignedList.GetEntryPos( sParam ); - if ( LISTBOX_ENTRY_NOTFOUND == nPos ) - nPos = m_aAssignedList.InsertEntry( sParam ); - m_aAssignedList.SelectEntryPos( nPos ); - m_aParameterEdit.SetText( String() ); - ModifyHdl_Impl( &m_aParameterEdit ); - EnableRemoveButton(); - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaParameterDlg, SelectHdl_Impl, ListBox *, EMPTYARG ) -{ - EnableRemoveButton(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaParameterDlg, DblClickHdl_Impl, ListBox *, EMPTYARG ) -{ - sal_uInt16 nPos = m_aAssignedList.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - m_aParameterEdit.SetText( m_aAssignedList.GetEntry( nPos ) ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaParameterDlg, RemoveHdl_Impl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nPos = m_aAssignedList.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - m_aAssignedList.RemoveEntry( nPos ); - sal_uInt16 nCount = m_aAssignedList.GetEntryCount(); - if ( nCount ) - { - if ( nPos >= nCount ) - nPos = ( nCount - 1 ); - m_aAssignedList.SelectEntryPos( nPos ); - } - } - EnableRemoveButton(); - - return 0; -} - -// ----------------------------------------------------------------------- - -short SvxJavaParameterDlg::Execute() -{ - m_aParameterEdit.GrabFocus(); - m_aAssignedList.SetNoSelection(); - return ModalDialog::Execute(); -} - -// ----------------------------------------------------------------------- - -Sequence< ::rtl::OUString > SvxJavaParameterDlg::GetParameters() const -{ - sal_uInt16 nCount = m_aAssignedList.GetEntryCount(); - Sequence< ::rtl::OUString > aParamList( nCount ); - ::rtl::OUString* pArray = aParamList.getArray(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - pArray[i] = ::rtl::OUString( m_aAssignedList.GetEntry(i) ); - return aParamList; -} - -// ----------------------------------------------------------------------- - -void SvxJavaParameterDlg::SetParameters( Sequence< ::rtl::OUString >& rParams ) -{ - m_aAssignedList.Clear(); - sal_uLong i, nCount = rParams.getLength(); - const ::rtl::OUString* pArray = rParams.getConstArray(); - for ( i = 0; i < nCount; ++i ) - { - String sParam = String( *pArray++ ); - m_aAssignedList.InsertEntry( sParam ); - } -} - -// class SvxJavaClassPathDlg --------------------------------------------- - -SvxJavaClassPathDlg::SvxJavaClassPathDlg( Window* pParent ) : - - ModalDialog( pParent, CUI_RES( RID_SVXDLG_JAVA_CLASSPATH ) ), - - m_aPathLabel ( this, CUI_RES( FT_PATH ) ), - m_aPathList ( this, CUI_RES( LB_PATH ) ), - m_aAddArchiveBtn ( this, CUI_RES( PB_ADDARCHIVE ) ), - m_aAddPathBtn ( this, CUI_RES( PB_ADDPATH ) ), - m_aRemoveBtn ( this, CUI_RES( PB_REMOVE_PATH ) ), - m_aButtonsLine ( this, CUI_RES( FL_PATH_BUTTONS ) ), - m_aOKBtn ( this, CUI_RES( PB_PATH_OK ) ), - m_aCancelBtn ( this, CUI_RES( PB_PATH_ESC ) ), - m_aHelpBtn ( this, CUI_RES( PB_PATH_HLP ) ) - -{ - FreeResource(); - - m_aAddArchiveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) ); - m_aAddPathBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) ); - m_aRemoveBtn.SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) ); - m_aPathList.SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) ); - - // check if the buttons text are not too wide otherwise we have to stretch the buttons - // and shrink the listbox - long nTxtWidth1 = m_aAddArchiveBtn.GetTextWidth( m_aAddArchiveBtn.GetText() ); - long nTxtWidth2 = m_aAddPathBtn.GetTextWidth( m_aAddPathBtn.GetText() ); - Size aBtnSz = m_aAddArchiveBtn.GetSizePixel(); - if ( nTxtWidth1 > aBtnSz.Width() || nTxtWidth2 > aBtnSz.Width() ) - { - long nW = ( nTxtWidth1 > aBtnSz.Width() ) ? nTxtWidth1 : nTxtWidth2; - long nDelta = nW - aBtnSz.Width() + 2 * BUTTON_BORDER; - aBtnSz.Width() += nDelta; - Point aBtnPnt = m_aAddArchiveBtn.GetPosPixel(); - aBtnPnt.X() -= nDelta; - m_aAddArchiveBtn.SetPosSizePixel( aBtnPnt, aBtnSz ); - aBtnPnt = m_aAddPathBtn.GetPosPixel(); - aBtnPnt.X() -= nDelta; - m_aAddPathBtn.SetPosSizePixel( aBtnPnt, aBtnSz ); - aBtnPnt = m_aRemoveBtn.GetPosPixel(); - aBtnPnt.X() -= nDelta; - m_aRemoveBtn.SetPosSizePixel( aBtnPnt, aBtnSz ); - Size aBoxSz = m_aPathList.GetSizePixel(); - aBoxSz.Width() -= nDelta; - m_aPathList.SetSizePixel( aBoxSz ); - } - - // set initial focus to path list - m_aPathList.GrabFocus(); -} - -// ----------------------------------------------------------------------- - -SvxJavaClassPathDlg::~SvxJavaClassPathDlg() -{ - sal_uInt16 i, nCount = m_aPathList.GetEntryCount(); - for ( i = 0; i < nCount; ++i ) - delete static_cast< String* >( m_aPathList.GetEntryData(i) ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaClassPathDlg, AddArchiveHdl_Impl, PushButton *, EMPTYARG ) -{ - sfx2::FileDialogHelper aDlg( TemplateDescription::FILEOPEN_SIMPLE, 0 ); - aDlg.SetTitle( CUI_RES( RID_SVXSTR_ARCHIVE_TITLE ) ); - aDlg.AddFilter( CUI_RES( RID_SVXSTR_ARCHIVE_HEADLINE ), String::CreateFromAscii("*.jar;*.zip") ); - String sFolder; - if ( m_aPathList.GetSelectEntryCount() > 0 ) - { - INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT ); - sFolder = aObj.GetMainURL( INetURLObject::NO_DECODE ); - } - else - sFolder = SvtPathOptions().GetWorkPath(); - aDlg.SetDisplayDirectory( sFolder ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - String sURL = aDlg.GetPath(); - INetURLObject aURL( sURL ); - String sFile = aURL.getFSysPath( INetURLObject::FSYS_DETECT ); - if ( !IsPathDuplicate( sURL ) ) - { - sal_uInt16 nPos = m_aPathList.InsertEntry( sFile, SvFileInformationManager::GetImage( aURL, false ) ); - m_aPathList.SelectEntryPos( nPos ); - } - else - { - String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sFile ); - ErrorBox( this, WB_OK, sMsg ).Execute(); - } - } - EnableRemoveButton(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaClassPathDlg, AddPathHdl_Impl, PushButton *, EMPTYARG ) -{ - rtl::OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( sService ), UNO_QUERY ); - - String sOldFolder; - if ( m_aPathList.GetSelectEntryCount() > 0 ) - { - INetURLObject aObj( m_aPathList.GetSelectEntry(), INetURLObject::FSYS_DETECT ); - sOldFolder = aObj.GetMainURL( INetURLObject::NO_DECODE ); - } - else - sOldFolder = SvtPathOptions().GetWorkPath(); - xFolderPicker->setDisplayDirectory( sOldFolder ); - if ( xFolderPicker->execute() == ExecutableDialogResults::OK ) - { - String sFolderURL( xFolderPicker->getDirectory() ); - INetURLObject aURL( sFolderURL ); - String sNewFolder = aURL.getFSysPath( INetURLObject::FSYS_DETECT ); - if ( !IsPathDuplicate( sFolderURL ) ) - { - sal_uInt16 nPos = m_aPathList.InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL, false ) ); - m_aPathList.SelectEntryPos( nPos ); - } - else - { - String sMsg( CUI_RES( RID_SVXSTR_MULTIFILE_DBL_ERR ) ); - sMsg.SearchAndReplaceAscii( "%1", sNewFolder ); - ErrorBox( this, WB_OK, sMsg ).Execute(); - } - } - EnableRemoveButton(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaClassPathDlg, RemoveHdl_Impl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nPos = m_aPathList.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - m_aPathList.RemoveEntry( nPos ); - sal_uInt16 nCount = m_aPathList.GetEntryCount(); - if ( nCount ) - { - if ( nPos >= nCount ) - nPos = ( nCount - 1 ); - m_aPathList.SelectEntryPos( nPos ); - } - } - - EnableRemoveButton(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxJavaClassPathDlg, SelectHdl_Impl, ListBox *, EMPTYARG ) -{ - EnableRemoveButton(); - return 0; -} - -// ----------------------------------------------------------------------- - -bool SvxJavaClassPathDlg::IsPathDuplicate( const String& _rPath ) -{ - bool bRet = false; - INetURLObject aFileObj( _rPath ); - sal_uInt16 nCount = m_aPathList.GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - INetURLObject aOtherObj( m_aPathList.GetEntry(i), INetURLObject::FSYS_DETECT ); - if ( aOtherObj == aFileObj ) - { - bRet = true; - break; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -String SvxJavaClassPathDlg::GetClassPath() const -{ - String sPath; - sal_uInt16 nCount = m_aPathList.GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - if ( sPath.Len() > 0 ) - sPath += CLASSPATH_DELIMITER; - String* pFullPath = static_cast< String* >( m_aPathList.GetEntryData(i) ); - if ( pFullPath ) - sPath += *pFullPath; - else - sPath += m_aPathList.GetEntry(i); - } - return sPath; -} - -// ----------------------------------------------------------------------- - -void SvxJavaClassPathDlg::SetClassPath( const String& _rPath ) -{ - if ( m_sOldPath.Len() == 0 ) - m_sOldPath = _rPath; - m_aPathList.Clear(); - xub_StrLen i, nIdx = 0; - xub_StrLen nCount = _rPath.GetTokenCount( CLASSPATH_DELIMITER ); - for ( i = 0; i < nCount; ++i ) - { - String sToken = _rPath.GetToken( 0, CLASSPATH_DELIMITER, nIdx ); - INetURLObject aURL( sToken, INetURLObject::FSYS_DETECT ); - String sPath = aURL.getFSysPath( INetURLObject::FSYS_DETECT ); - m_aPathList.InsertEntry( sPath, SvFileInformationManager::GetImage( aURL, false ) ); - } - // select first entry - m_aPathList.SelectEntryPos(0); - SelectHdl_Impl( NULL ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optjava.hrc b/cui/source/options/optjava.hrc deleted file mode 100644 index 23da073e0..000000000 --- a/cui/source/options/optjava.hrc +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTJAVA_HRC -#define _SVX_OPTJAVA_HRC - -// defines --------------------------------------------------------------- - -// class SvxJavaOptionsPage ---------------------------------------------- - -#define FL_JAVA 10 -#define CB_JAVA_ENABLE 11 -#define FT_JAVA_FOUND 12 -#define LB_JAVA 13 -#define FT_JAVA_PATH 14 - -#define PB_ADD 20 -#define PB_PARAMETER 21 -#define PB_CLASSPATH 22 - -#define STR_INSTALLED_IN 30 -#define STR_ACCESSIBILITY 31 -#define STR_ADDDLGTEXT 32 - -#define STR_HEADER_VENDOR 40 -#define STR_HEADER_VERSION 41 -#define STR_HEADER_FEATURES 42 - -// class SvxJavaParameterDlg --------------------------------------------- - -#define FT_PARAMETER 10 -#define ED_PARAMETER 11 -#define PB_ASSIGN 12 - -#define FT_ASSIGNED 20 -#define LB_ASSIGNED 21 -#define FT_EXAMPLE 22 -#define PB_REMOVE 23 - -#define FL_BUTTONS 30 -#define PB_PARAMETER_OK 31 -#define PB_PARAMETER_ESC 32 -#define PB_PARAMETER_HLP 33 - -// class SvxJavaClassPathDlg --------------------------------------------- - -#define FT_PATH 10 -#define LB_PATH 11 - -#define PB_ADDARCHIVE 20 -#define PB_ADDPATH 21 -#define PB_REMOVE_PATH 22 - -#define FL_PATH_BUTTONS 30 -#define PB_PATH_OK 31 -#define PB_PATH_ESC 32 -#define PB_PATH_HLP 33 - -#endif // #ifndef _SVX_OPTJAVA_HRC - diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx deleted file mode 100644 index 697d198da..000000000 --- a/cui/source/options/optjava.hxx +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTJAVA_HXX -#define _SVX_OPTJAVA_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "radiobtnbox.hxx" - -// forward --------------------------------------------------------------- - -typedef struct _JavaInfo JavaInfo; - -class SvxJavaParameterDlg; -class SvxJavaClassPathDlg; - -// class SvxJavaOptionsPage ---------------------------------------------- - -class SvxJavaOptionsPage : public SfxTabPage -{ -private: - FixedLine m_aJavaLine; - CheckBox m_aJavaEnableCB; - FixedText m_aJavaFoundLabel; - SvxSimpleTableContainer m_aJavaListContainer; - svx::SvxRadioButtonListBox m_aJavaList; - FixedText m_aJavaPathText; - PushButton m_aAddBtn; - PushButton m_aParameterBtn; - PushButton m_aClassPathBtn; - - SvxJavaParameterDlg* m_pParamDlg; - SvxJavaClassPathDlg* m_pPathDlg; - - JavaInfo** m_parJavaInfo; - rtl_uString** m_parParameters; - rtl_uString* m_pClassPath; - sal_Int32 m_nInfoSize; - sal_Int32 m_nParamSize; - String m_sInstallText; - String m_sAccessibilityText; - String m_sAddDialogText; - Timer m_aResetTimer; - - ::std::vector< JavaInfo* > - m_aAddedInfos; - - ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; - - DECL_LINK( EnableHdl_Impl, CheckBox * ); - DECL_LINK( CheckHdl_Impl, SvxSimpleTable * ); - DECL_LINK( SelectHdl_Impl, SvxSimpleTable * ); - DECL_LINK( AddHdl_Impl, PushButton * ); - DECL_LINK( ParameterHdl_Impl, PushButton * ); - DECL_LINK( ClassPathHdl_Impl, PushButton * ); - DECL_LINK( ResetHdl_Impl, Timer * ); - - DECL_LINK( StartFolderPickerHdl, void * ); - DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* ); - - void ClearJavaInfo(); - void ClearJavaList(); - void LoadJREs(); - void AddJRE( JavaInfo* _pInfo ); - void HandleCheckEntry( SvLBoxEntry* _pEntry ); - void AddFolder( const ::rtl::OUString& _rFolder ); - -public: - SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxJavaOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); -}; - -// class SvxJavaParameterDlg --------------------------------------------- - -class SvxJavaParameterDlg : public ModalDialog -{ -private: - FixedText m_aParameterLabel; - Edit m_aParameterEdit; - PushButton m_aAssignBtn; - - FixedText m_aAssignedLabel; - ListBox m_aAssignedList; - FixedText m_aExampleText; - PushButton m_aRemoveBtn; - - FixedLine m_aButtonsLine; - OKButton m_aOKBtn; - CancelButton m_aCancelBtn; - HelpButton m_aHelpBtn; - - DECL_LINK( ModifyHdl_Impl, Edit * ); - DECL_LINK( AssignHdl_Impl, PushButton * ); - DECL_LINK( SelectHdl_Impl, ListBox * ); - DECL_LINK( DblClickHdl_Impl, ListBox * ); - DECL_LINK( RemoveHdl_Impl, PushButton * ); - - inline void EnableRemoveButton() - { m_aRemoveBtn.Enable( - m_aAssignedList.GetSelectEntryPos() - != LISTBOX_ENTRY_NOTFOUND ); } - - -public: - SvxJavaParameterDlg( Window* pParent ); - ~SvxJavaParameterDlg(); - - virtual short Execute(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > GetParameters() const; - void SetParameters( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rParams ); -}; - -// class SvxJavaClassPathDlg --------------------------------------------- - -class SvxJavaClassPathDlg : public ModalDialog -{ -private: - FixedText m_aPathLabel; - ListBox m_aPathList; - PushButton m_aAddArchiveBtn; - PushButton m_aAddPathBtn; - PushButton m_aRemoveBtn; - - FixedLine m_aButtonsLine; - OKButton m_aOKBtn; - CancelButton m_aCancelBtn; - HelpButton m_aHelpBtn; - - String m_sOldPath; - - DECL_LINK( AddArchiveHdl_Impl, PushButton * ); - DECL_LINK( AddPathHdl_Impl, PushButton * ); - DECL_LINK( RemoveHdl_Impl, PushButton * ); - DECL_LINK( SelectHdl_Impl, ListBox * ); - - bool IsPathDuplicate( const String& _rPath ); - inline void EnableRemoveButton() - { m_aRemoveBtn.Enable( - m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); } - -public: - SvxJavaClassPathDlg( Window* pParent ); - ~SvxJavaClassPathDlg(); - - inline const String& GetOldPath() const { return m_sOldPath; } - inline void SetFocus() { m_aPathList.GrabFocus(); } - - String GetClassPath() const; - void SetClassPath( const String& _rPath ); -}; - -#endif // #ifndef _SVX_OPTJAVA_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src deleted file mode 100644 index e92291d36..000000000 --- a/cui/source/options/optjava.src +++ /dev/null @@ -1,299 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include -------------------------------------------------------------- - -#include "optjava.hrc" -#include -#include "helpid.hrc" - -// RID_SVXPAGE_OPTIONS_JAVA ---------------------------------------------- - -TabPage RID_SVXPAGE_OPTIONS_JAVA -{ - HelpId = HID_OPTIONS_JAVA ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Java" ; - - FixedLine FL_JAVA - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Java options" ; - }; - CheckBox CB_JAVA_ENABLE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_OPTIONS_JAVA:CB_JAVA_ENABLE"; - Pos = MAP_APPFONT ( 12, 14 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Text [ en-US ] = "~Use a Java runtime environment" ; - }; - FixedText FT_JAVA_FOUND - { - Pos = MAP_APPFONT ( 21 , 27 ) ; - Size = MAP_APPFONT ( 233 , 8 ) ; - Text [ en-US ] = "~Java runtime environments (JRE) already installed:" ; - }; - Control LB_JAVA - { - Pos = MAP_APPFONT ( 21 , 38 ) ; - Size = MAP_APPFONT ( 177 , 130 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_JAVA_PATH - { - Pos = MAP_APPFONT ( 21 , 171 ) ; - Size = MAP_APPFONT ( 233 , 8 ) ; - NoLabel = TRUE ; - }; - PushButton PB_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_OPTIONS_JAVA:PB_ADD"; - Pos = MAP_APPFONT ( 204 , 38 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - }; - PushButton PB_PARAMETER - { - HelpID = "cui:PushButton:RID_SVXPAGE_OPTIONS_JAVA:PB_PARAMETER"; - Pos = MAP_APPFONT ( 204 , 55 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Parameters..." ; - }; - PushButton PB_CLASSPATH - { - HelpID = "cui:PushButton:RID_SVXPAGE_OPTIONS_JAVA:PB_CLASSPATH"; - Pos = MAP_APPFONT ( 204 , 72 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Class Path..." ; - }; - String STR_INSTALLED_IN - { - Text [ en-US ] = "Location: " ; - }; - String STR_ACCESSIBILITY - { - Text [ en-US ] = "with accessibility support" ; - }; - String STR_ADDDLGTEXT - { - Text [ en-US ] = "Select a Java Runtime Environment" ; - }; - String STR_HEADER_VENDOR - { - Text [ en-US ] = "Vendor" ; - }; - String STR_HEADER_VERSION - { - Text [ en-US ] = "Version" ; - }; - String STR_HEADER_FEATURES - { - Text [ en-US ] = "Features" ; - }; -}; - -// RID_SVXDLG_JAVA_PARAMETER --------------------------------------------- - -ModalDialog RID_SVXDLG_JAVA_PARAMETER -{ - HelpId = HID_OPTIONS_JAVA_PARAMETER ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 270 , 140 ) ; - Text [ en-US ] = "Java Start Parameters" ; - Moveable = TRUE ; - FixedText FT_PARAMETER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "Java start ~parameter" ; - }; - Edit ED_PARAMETER - { - HelpID = "cui:Edit:RID_SVXDLG_JAVA_PARAMETER:ED_PARAMETER"; - Pos = MAP_APPFONT ( 6 , 15 ) ; - Size = MAP_APPFONT ( 202 , 12 ) ; - Border = TRUE ; - }; - PushButton PB_ASSIGN - { - HelpID = "cui:PushButton:RID_SVXDLG_JAVA_PARAMETER:PB_ASSIGN"; - Pos = MAP_APPFONT ( 214 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Assign" ; - }; - FixedText FT_ASSIGNED - { - Pos = MAP_APPFONT ( 6 , 31 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "Assig~ned start parameters" ; - }; - ListBox LB_ASSIGNED - { - HelpID = "cui:ListBox:RID_SVXDLG_JAVA_PARAMETER:LB_ASSIGNED"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 42 ) ; - Size = MAP_APPFONT ( 202 , 53 ) ; - AutoHScroll = TRUE ; - }; - FixedText FT_EXAMPLE - { - Pos = MAP_APPFONT ( 6 , 98 ) ; - Size = MAP_APPFONT ( 202 , 8 ) ; - Text [ en-US ] = "For example: -Dmyprop=c:\\program files\\java" ; - }; - PushButton PB_REMOVE - { - HelpID = "cui:PushButton:RID_SVXDLG_JAVA_PARAMETER:PB_REMOVE"; - Pos = MAP_APPFONT ( 214 , 42 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Remove" ; - }; - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT ( 3 , 109 ) ; - Size = MAP_APPFONT ( 264 , 8 ) ; - }; - OKButton PB_PARAMETER_OK - { - Pos = MAP_APPFONT ( 105 , 120 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton PB_PARAMETER_ESC - { - Pos = MAP_APPFONT ( 158 , 120 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_PARAMETER_HLP - { - Pos = MAP_APPFONT ( 214 , 120 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -// RID_SVXDLG_JAVA_CLASSPATH --------------------------------------------- - -ModalDialog RID_SVXDLG_JAVA_CLASSPATH -{ - HelpId = HID_OPTIONS_JAVA_CLASSPATH ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 240 , 120 ) ; - Text [ en-US ] = "Class Path" ; - Moveable = TRUE ; - FixedText FT_PATH - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 172 , 8 ) ; - Text [ en-US ] = "A~ssigned folders and archives" ; - }; - ListBox LB_PATH - { - HelpID = "cui:ListBox:RID_SVXDLG_JAVA_CLASSPATH:LB_PATH"; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 172 , 72 ) ; - Border = TRUE ; - AutoHScroll = TRUE ; - }; - PushButton PB_ADDARCHIVE - { - HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_ADDARCHIVE"; - Pos = MAP_APPFONT ( 184 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add Archive..." ; - }; - PushButton PB_ADDPATH - { - HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_ADDPATH"; - Pos = MAP_APPFONT ( 184 , 31 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Add ~Folder" ; - }; - PushButton PB_REMOVE_PATH - { - HelpID = "cui:PushButton:RID_SVXDLG_JAVA_CLASSPATH:PB_REMOVE_PATH"; - Pos = MAP_APPFONT ( 184 , 48 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Remove" ; - }; - FixedLine FL_PATH_BUTTONS - { - Pos = MAP_APPFONT ( 3 , 89 ) ; - Size = MAP_APPFONT ( 236 , 8 ) ; - }; - OKButton PB_PATH_OK - { - Pos = MAP_APPFONT ( 75 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton PB_PATH_ESC - { - Pos = MAP_APPFONT ( 128 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton PB_PATH_HLP - { - Pos = MAP_APPFONT ( 186 , 100 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -ErrorBox RID_SVXERR_JRE_NOT_RECOGNIZED -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "The folder you selected does not contain a Java runtime environment.\nPlease select a different folder." ; -}; - -ErrorBox RID_SVXERR_JRE_FAILED_VERSION -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "The Java runtime environment you selected is not the required version.\nPlease select a different folder." ; -}; - -WarningBox RID_SVX_MSGBOX_JAVA_RESTART -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.\nPlease restart %PRODUCTNAME now." ; -}; - -WarningBox RID_SVX_MSGBOX_JAVA_RESTART2 -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "You have to restart %PRODUCTNAME so the new or modified values can take effect.\nPlease restart %PRODUCTNAME now." ; -}; - diff --git a/cui/source/options/optjsearch.cxx b/cui/source/options/optjsearch.cxx deleted file mode 100644 index 9ef976fc6..000000000 --- a/cui/source/options/optjsearch.cxx +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "optjsearch.hrc" - -using namespace com::sun::star::i18n; - -////////////////////////////////////////////////////////////////////// - -SvxJSearchOptionsPage::SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_JSEARCH_OPTIONS ), rSet ), - - aTreatAsEqual ( this, CUI_RES( FL_TREAT_AS_EQUAL ) ), - aMatchCase ( this, CUI_RES( CB_MATCH_CASE ) ), - aMatchFullHalfWidth ( this, CUI_RES( CB_MATCH_FULL_HALF_WIDTH ) ), - aMatchHiraganaKatakana ( this, CUI_RES( CB_MATCH_HIRAGANA_KATAKANA ) ), - aMatchContractions ( this, CUI_RES( CB_MATCH_CONTRACTIONS ) ), - aMatchMinusDashChoon ( this, CUI_RES( CB_MATCH_MINUS_DASH_CHOON ) ), - aMatchRepeatCharMarks ( this, CUI_RES( CB_MATCH_REPEAT_CHAR_MARKS ) ), - aMatchVariantFormKanji ( this, CUI_RES( CB_MATCH_VARIANT_FORM_KANJI ) ), - aMatchOldKanaForms ( this, CUI_RES( CB_MATCH_OLD_KANA_FORMS ) ), - aMatchDiziDuzu ( this, CUI_RES( CB_MATCH_DIZI_DUZU ) ), - aMatchBavaHafa ( this, CUI_RES( CB_MATCH_BAVA_HAFA ) ), - aMatchTsithichiDhizi ( this, CUI_RES( CB_MATCH_TSITHICHI_DHIZI ) ), - aMatchHyuiyuByuvyu ( this, CUI_RES( CB_MATCH_HYUFYU_BYUVYU ) ), - aMatchSesheZeje ( this, CUI_RES( CB_MATCH_SESHE_ZEJE ) ), - aMatchIaiya ( this, CUI_RES( CB_MATCH_IAIYA ) ), - aMatchKiku ( this, CUI_RES( CB_MATCH_KIKU ) ), - aMatchProlongedSoundMark ( this, CUI_RES( CB_MATCH_PROLONGED_SOUNDMARK ) ), - aIgnore ( this, CUI_RES( FL_IGNORE ) ), - aIgnorePunctuation ( this, CUI_RES( CB_IGNORE_PUNCTUATION ) ), - aIgnoreWhitespace ( this, CUI_RES( CB_IGNORE_WHITESPACES ) ), - aIgnoreMiddleDot ( this, CUI_RES( CB_IGNORE_MIDDLE_DOT ) ) -{ - FreeResource(); - bSaveOptions = sal_True; - nTransliterationFlags = 0x00000000; -} - - -SvxJSearchOptionsPage::~SvxJSearchOptionsPage() -{ -} - - -SfxTabPage* SvxJSearchOptionsPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxJSearchOptionsPage( pParent, rSet ); -} - - -void SvxJSearchOptionsPage::SetTransliterationFlags( sal_Int32 nSettings ) -{ - sal_Bool bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE); - aMatchCase .Check( bVal ); //! treat as equal uppercase/lowercase - bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH); - aMatchFullHalfWidth .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_IGNORE_KANA); - aMatchHiraganaKatakana .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreSize_ja_JP); - aMatchContractions .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreMinusSign_ja_JP); - aMatchMinusDashChoon .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreIterationMark_ja_JP); - aMatchRepeatCharMarks .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKanji_ja_JP); - aMatchVariantFormKanji .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreTraditionalKana_ja_JP); - aMatchOldKanaForms .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreZiZu_ja_JP); - aMatchDiziDuzu .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreBaFa_ja_JP); - aMatchBavaHafa .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreTiJi_ja_JP); - aMatchTsithichiDhizi .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreHyuByu_ja_JP); - aMatchHyuiyuByuvyu .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreSeZe_ja_JP); - aMatchSesheZeje .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreIandEfollowedByYa_ja_JP); - aMatchIaiya .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreKiKuFollowedBySa_ja_JP); - aMatchKiku .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreSeparator_ja_JP); - aIgnorePunctuation .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreSpace_ja_JP); - aIgnoreWhitespace .Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreProlongedSoundMark_ja_JP); - aMatchProlongedSoundMark.Check( bVal ); - bVal = 0 != (nSettings & TransliterationModules_ignoreMiddleDot_ja_JP); - aIgnoreMiddleDot .Check( bVal ); - - nTransliterationFlags = nSettings; -} - - -sal_Int32 SvxJSearchOptionsPage::GetTransliterationFlags_Impl() -{ - sal_Int32 nTmp = 0; - if (aMatchCase.IsChecked()) //! treat as equal uppercase/lowercase - nTmp |= TransliterationModules_IGNORE_CASE; - if (aMatchFullHalfWidth.IsChecked()) - nTmp |= TransliterationModules_IGNORE_WIDTH; - if (aMatchHiraganaKatakana.IsChecked()) - nTmp |= TransliterationModules_IGNORE_KANA; - if (aMatchContractions.IsChecked()) - nTmp |= TransliterationModules_ignoreSize_ja_JP; - if (aMatchMinusDashChoon.IsChecked()) - nTmp |= TransliterationModules_ignoreMinusSign_ja_JP; - if (aMatchRepeatCharMarks.IsChecked()) - nTmp |= TransliterationModules_ignoreIterationMark_ja_JP; - if (aMatchVariantFormKanji.IsChecked()) - nTmp |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if (aMatchOldKanaForms.IsChecked()) - nTmp |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if (aMatchDiziDuzu.IsChecked()) - nTmp |= TransliterationModules_ignoreZiZu_ja_JP; - if (aMatchBavaHafa.IsChecked()) - nTmp |= TransliterationModules_ignoreBaFa_ja_JP; - if (aMatchTsithichiDhizi.IsChecked()) - nTmp |= TransliterationModules_ignoreTiJi_ja_JP; - if (aMatchHyuiyuByuvyu.IsChecked()) - nTmp |= TransliterationModules_ignoreHyuByu_ja_JP; - if (aMatchSesheZeje.IsChecked()) - nTmp |= TransliterationModules_ignoreSeZe_ja_JP; - if (aMatchIaiya.IsChecked()) - nTmp |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if (aMatchKiku.IsChecked()) - nTmp |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if (aIgnorePunctuation.IsChecked()) - nTmp |= TransliterationModules_ignoreSeparator_ja_JP; - if (aIgnoreWhitespace.IsChecked()) - nTmp |= TransliterationModules_ignoreSpace_ja_JP; - if (aMatchProlongedSoundMark.IsChecked()) - nTmp |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if (aIgnoreMiddleDot.IsChecked()) - nTmp |= TransliterationModules_ignoreMiddleDot_ja_JP; - - nTransliterationFlags = nTmp; - return nTransliterationFlags; -} - - -void SvxJSearchOptionsPage::Reset( const SfxItemSet& ) -{ - SvtSearchOptions aOpt; - - // read settings from configuration - aMatchCase .Check(!aOpt.IsMatchCase() ); //! treat as equal uppercase/lowercase - aMatchFullHalfWidth .Check( aOpt.IsMatchFullHalfWidthForms() ); - aMatchHiraganaKatakana .Check( aOpt.IsMatchHiraganaKatakana() ); - aMatchContractions .Check( aOpt.IsMatchContractions() ); - aMatchMinusDashChoon .Check( aOpt.IsMatchMinusDashChoon() ); - aMatchRepeatCharMarks .Check( aOpt.IsMatchRepeatCharMarks() ); - aMatchVariantFormKanji .Check( aOpt.IsMatchVariantFormKanji() ); - aMatchOldKanaForms .Check( aOpt.IsMatchOldKanaForms() ); - aMatchDiziDuzu .Check( aOpt.IsMatchDiziDuzu() ); - aMatchBavaHafa .Check( aOpt.IsMatchBavaHafa() ); - aMatchTsithichiDhizi .Check( aOpt.IsMatchTsithichiDhizi() ); - aMatchHyuiyuByuvyu .Check( aOpt.IsMatchHyuiyuByuvyu() ); - aMatchSesheZeje .Check( aOpt.IsMatchSesheZeje() ); - aMatchIaiya .Check( aOpt.IsMatchIaiya() ); - aMatchKiku .Check( aOpt.IsMatchKiku() ); - aIgnorePunctuation .Check( aOpt.IsIgnorePunctuation() ); - aIgnoreWhitespace .Check( aOpt.IsIgnoreWhitespace() ); - aMatchProlongedSoundMark .Check( aOpt.IsIgnoreProlongedSoundMark() ); - aIgnoreMiddleDot .Check( aOpt.IsIgnoreMiddleDot() ); - - nTransliterationFlags = GetTransliterationFlags_Impl(); - DBG_ASSERT( nTransliterationFlags == aOpt.GetTransliterationFlags(), - "Transliteration settings different" ); - - aMatchCase .SaveValue(); - aMatchFullHalfWidth .SaveValue(); - aMatchHiraganaKatakana .SaveValue(); - aMatchContractions .SaveValue(); - aMatchMinusDashChoon .SaveValue(); - aMatchRepeatCharMarks .SaveValue(); - aMatchVariantFormKanji .SaveValue(); - aMatchOldKanaForms .SaveValue(); - aMatchDiziDuzu .SaveValue(); - aMatchBavaHafa .SaveValue(); - aMatchTsithichiDhizi .SaveValue(); - aMatchHyuiyuByuvyu .SaveValue(); - aMatchSesheZeje .SaveValue(); - aMatchIaiya .SaveValue(); - aMatchKiku .SaveValue(); - aIgnorePunctuation .SaveValue(); - aIgnoreWhitespace .SaveValue(); - aMatchProlongedSoundMark .SaveValue(); - aIgnoreMiddleDot .SaveValue(); -} - - -sal_Bool SvxJSearchOptionsPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bModified = sal_False; - - sal_Int32 nOldVal = nTransliterationFlags; - nTransliterationFlags = GetTransliterationFlags_Impl(); - bModified = nOldVal != nTransliterationFlags; - - if (!IsSaveOptions()) - return bModified; - - bModified = sal_False; - SvtSearchOptions aOpt; - sal_Bool bNewVal, bChanged; - - bNewVal = aMatchCase.IsChecked(); //! treat as equal uppercase/lowercase - bChanged = bNewVal != aMatchCase.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchCase(!bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchFullHalfWidth.IsChecked(); - bChanged = bNewVal != aMatchFullHalfWidth.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchFullHalfWidthForms( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchHiraganaKatakana.IsChecked(); - bChanged = bNewVal != aMatchHiraganaKatakana.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchHiraganaKatakana( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchContractions.IsChecked(); - bChanged = bNewVal != aMatchContractions.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchContractions( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchMinusDashChoon.IsChecked(); - bChanged = bNewVal != aMatchMinusDashChoon.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchMinusDashChoon( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchRepeatCharMarks.IsChecked(); - bChanged = bNewVal != aMatchRepeatCharMarks.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchRepeatCharMarks( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchVariantFormKanji.IsChecked(); - bChanged = bNewVal != aMatchVariantFormKanji.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchVariantFormKanji( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchOldKanaForms.IsChecked(); - bChanged = bNewVal != aMatchOldKanaForms.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchOldKanaForms( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchDiziDuzu.IsChecked(); - bChanged = bNewVal != aMatchDiziDuzu.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchDiziDuzu( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchBavaHafa.IsChecked(); - bChanged = bNewVal != aMatchBavaHafa.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchBavaHafa( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchTsithichiDhizi.IsChecked(); - bChanged = bNewVal != aMatchTsithichiDhizi.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchTsithichiDhizi( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchHyuiyuByuvyu.IsChecked(); - bChanged = bNewVal != aMatchHyuiyuByuvyu.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchHyuiyuByuvyu( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchSesheZeje.IsChecked(); - bChanged = bNewVal != aMatchSesheZeje.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchSesheZeje( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchIaiya.IsChecked(); - bChanged = bNewVal != aMatchIaiya.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchIaiya( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchKiku.IsChecked(); - bChanged = bNewVal != aMatchKiku.GetSavedValue(); - if (bChanged) - { - aOpt.SetMatchKiku( bNewVal ); - bModified = sal_True; - } - bNewVal = aIgnorePunctuation.IsChecked(); - bChanged = bNewVal != aIgnorePunctuation.GetSavedValue(); - if (bChanged) - { - aOpt.SetIgnorePunctuation( bNewVal ); - bModified = sal_True; - } - bNewVal = aIgnoreWhitespace.IsChecked(); - bChanged = bNewVal != aIgnoreWhitespace.GetSavedValue(); - if (bChanged) - { - aOpt.SetIgnoreWhitespace( bNewVal ); - bModified = sal_True; - } - bNewVal = aMatchProlongedSoundMark.IsChecked(); - bChanged = bNewVal != aMatchProlongedSoundMark.GetSavedValue(); - if (bChanged) - { - aOpt.SetIgnoreProlongedSoundMark( bNewVal ); - bModified = sal_True; - } - bNewVal = aIgnoreMiddleDot.IsChecked(); - bChanged = bNewVal != aIgnoreMiddleDot.GetSavedValue(); - if (bChanged) - { - aOpt.SetIgnoreMiddleDot( bNewVal ); - bModified = sal_True; - } - - return bModified; -} - - -////////////////////////////////////////////////////////////////////// - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optjsearch.hrc b/cui/source/options/optjsearch.hrc deleted file mode 100644 index 40024df86..000000000 --- a/cui/source/options/optjsearch.hrc +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FL_TREAT_AS_EQUAL 100 -#define CB_MATCH_CASE 101 -#define CB_MATCH_FULL_HALF_WIDTH 102 -#define CB_MATCH_HIRAGANA_KATAKANA 103 -#define CB_MATCH_CONTRACTIONS 104 -#define CB_MATCH_MINUS_DASH_CHOON 105 -#define CB_MATCH_REPEAT_CHAR_MARKS 106 -#define CB_MATCH_VARIANT_FORM_KANJI 107 -#define CB_MATCH_OLD_KANA_FORMS 108 -#define CB_MATCH_DIZI_DUZU 109 -#define CB_MATCH_BAVA_HAFA 110 -#define CB_MATCH_TSITHICHI_DHIZI 111 -#define CB_MATCH_HYUFYU_BYUVYU 112 -#define CB_MATCH_SESHE_ZEJE 113 -#define CB_MATCH_IAIYA 114 -#define CB_MATCH_KIKU 115 - -#define FL_IGNORE 200 -#define CB_IGNORE_PUNCTUATION 201 -#define CB_IGNORE_WHITESPACES 202 -#define CB_MATCH_PROLONGED_SOUNDMARK 203 -#define CB_IGNORE_MIDDLE_DOT 204 - diff --git a/cui/source/options/optjsearch.hxx b/cui/source/options/optjsearch.hxx deleted file mode 100644 index 5b7f0ce3c..000000000 --- a/cui/source/options/optjsearch.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_OPTJSEARCH_HXX_ -#define _SVX_OPTJSEARCH_HXX_ - -#include -#include -#include - -class Window; -class SfxItemSet; - -////////////////////////////////////////////////////////////////////// - -class SvxJSearchOptionsPage : public SfxTabPage -{ -private: - FixedLine aTreatAsEqual; - CheckBox aMatchCase; - CheckBox aMatchFullHalfWidth; - CheckBox aMatchHiraganaKatakana; - CheckBox aMatchContractions; - CheckBox aMatchMinusDashChoon; - CheckBox aMatchRepeatCharMarks; - CheckBox aMatchVariantFormKanji; - CheckBox aMatchOldKanaForms; - CheckBox aMatchDiziDuzu; - CheckBox aMatchBavaHafa; - CheckBox aMatchTsithichiDhizi; - CheckBox aMatchHyuiyuByuvyu; - CheckBox aMatchSesheZeje; - CheckBox aMatchIaiya; - CheckBox aMatchKiku; - CheckBox aMatchProlongedSoundMark; - FixedLine aIgnore; - CheckBox aIgnorePunctuation; - CheckBox aIgnoreWhitespace; - CheckBox aIgnoreMiddleDot; - - sal_Int32 nTransliterationFlags; - sal_Bool bSaveOptions; - - sal_Int32 GetTransliterationFlags_Impl(); - -protected: - SvxJSearchOptionsPage( Window* pParent, const SfxItemSet& rSet ); - -public: - ~SvxJSearchOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - - virtual void Reset( const SfxItemSet& rSet ); - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - - sal_Bool IsSaveOptions() const { return bSaveOptions; } - void EnableSaveOptions( sal_Bool bVal ) { bSaveOptions = bVal; } - - sal_Int32 GetTransliterationFlags() const { return nTransliterationFlags; } - void SetTransliterationFlags( sal_Int32 nSettings ); -}; - -////////////////////////////////////////////////////////////////////// - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optjsearch.src b/cui/source/options/optjsearch.src deleted file mode 100644 index f058d13f4..000000000 --- a/cui/source/options/optjsearch.src +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include - -#include "optjsearch.hrc" - - -TabPage RID_SVXPAGE_JSEARCH_OPTIONS -{ - HelpId = HID_SVXPAGE_JSEARCH_OPTIONS ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_TREAT_AS_EQUAL - { - Pos = MAP_APPFONT( 6, 3 ); - Size = MAP_APPFONT( 248, 8 ); - Text [ en-US ] = "Treat as equal"; - }; - CheckBox CB_MATCH_CASE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_CASE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~uppercase/lowercase"; - }; - CheckBox CB_MATCH_FULL_HALF_WIDTH - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_FULL_HALF_WIDTH"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~full-width/half-width forms"; - }; - CheckBox CB_MATCH_HIRAGANA_KATAKANA - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_HIRAGANA_KATAKANA"; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~hiragana/katakana"; - }; - CheckBox CB_MATCH_CONTRACTIONS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_CONTRACTIONS"; - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~contractions (yo-on, sokuon)"; - }; - CheckBox CB_MATCH_MINUS_DASH_CHOON - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_MINUS_DASH_CHOON"; - Pos = MAP_APPFONT ( 12 , 70 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~minus/dash/cho-on"; - }; - CheckBox CB_MATCH_REPEAT_CHAR_MARKS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_REPEAT_CHAR_MARKS"; - Pos = MAP_APPFONT ( 12 , 84 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "'re~peat character' marks"; - }; - CheckBox CB_MATCH_VARIANT_FORM_KANJI - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_VARIANT_FORM_KANJI"; - Pos = MAP_APPFONT ( 12 , 98 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~variant-form kanji (itaiji)"; - }; - CheckBox CB_MATCH_OLD_KANA_FORMS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_OLD_KANA_FORMS"; - Pos = MAP_APPFONT ( 12 , 112) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~old Kana forms"; - }; - CheckBox CB_MATCH_DIZI_DUZU - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_DIZI_DUZU"; - Pos = MAP_APPFONT ( 136 , 14 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~di/zi, du/zu"; - }; - CheckBox CB_MATCH_BAVA_HAFA - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_BAVA_HAFA"; - Pos = MAP_APPFONT ( 136 , 28 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~ba/va, ha/fa"; - }; - CheckBox CB_MATCH_TSITHICHI_DHIZI - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_TSITHICHI_DHIZI"; - Pos = MAP_APPFONT ( 136 , 42 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~tsi/thi/chi, dhi/zi"; - }; - CheckBox CB_MATCH_HYUFYU_BYUVYU - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_HYUFYU_BYUVYU"; - Pos = MAP_APPFONT ( 136 , 56 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "h~yu/fyu, byu/vyu"; - }; - CheckBox CB_MATCH_SESHE_ZEJE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_SESHE_ZEJE"; - Pos = MAP_APPFONT ( 136 , 70 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~se/she, ze/je"; - }; - CheckBox CB_MATCH_IAIYA - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_IAIYA"; - Pos = MAP_APPFONT ( 136 , 84 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~ia/iya (piano/piyano)"; - }; - CheckBox CB_MATCH_KIKU - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_KIKU"; - Pos = MAP_APPFONT ( 136 , 98 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~ki/ku (tekisuto/tekusuto)"; - }; - CheckBox CB_MATCH_PROLONGED_SOUNDMARK - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_MATCH_PROLONGED_SOUNDMARK"; - Pos = MAP_APPFONT ( 136 , 112 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Prolon~ged vowels (ka-/kaa)"; - }; - FixedLine FL_IGNORE - { - Pos = MAP_APPFONT( 6, 128 ); - Size = MAP_APPFONT( 248, 8 ); - Text [ en-US ] = "Ignore"; - }; - CheckBox CB_IGNORE_PUNCTUATION - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_IGNORE_PUNCTUATION"; - Pos = MAP_APPFONT ( 12 , 139 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Pu~nctuation characters"; - }; - CheckBox CB_IGNORE_WHITESPACES - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_IGNORE_WHITESPACES"; - Pos = MAP_APPFONT ( 12 , 153 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "~Whitespace characters"; - }; - CheckBox CB_IGNORE_MIDDLE_DOT - { - HelpID = "cui:CheckBox:RID_SVXPAGE_JSEARCH_OPTIONS:CB_IGNORE_MIDDLE_DOT"; - Pos = MAP_APPFONT ( 136 , 139 ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Midd~le dots"; - }; - Text [ en-US ] = "Searching in Japanese"; -}; -// end TabPage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx deleted file mode 100644 index 66c2aee01..000000000 --- a/cui/source/options/optlingu.cxx +++ /dev/null @@ -1,2499 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define _SVX_OPTLINGU_CXX -#include "optlingu.hrc" - -#include -#include -#include "optlingu.hxx" -#include -#include -#include "helpid.hrc" - -#include - -#include -#include - - -using namespace ::ucbhelper; -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::linguistic2; -using namespace ::com::sun::star::beans; -namespace css = com::sun::star; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define SVX_MAX_USERDICTS 20 -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 -#define CBCOL_BOTH 2 - -static const sal_Char cSpell[] = SN_SPELLCHECKER; -static const sal_Char cGrammar[] = SN_GRAMMARCHECKER; -static const sal_Char cHyph[] = SN_HYPHENATOR; -static const sal_Char cThes[] = SN_THESAURUS; - -// static ---------------------------------------------------------------- - -static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &rSeq ) -{ - sal_Int32 nLen = rSeq.getLength(); - Sequence< sal_Int16 > aRes( nLen ); - sal_Int16 *pRes = aRes.getArray(); - const Locale *pSeq = rSeq.getConstArray(); - for (sal_Int32 i = 0; i < nLen; ++i) - { - pRes[i] = SvxLocaleToLanguage( pSeq[i] ); - } - return aRes; -} - - -static sal_Bool lcl_SeqHasLang( const Sequence< sal_Int16 > &rSeq, sal_Int16 nLang ) -{ - sal_Int32 nLen = rSeq.getLength(); - const sal_Int16 *pLang = rSeq.getConstArray(); - sal_Int32 nPos = -1; - for (sal_Int32 i = 0; i < nLen && nPos < 0; ++i) - { - if (nLang == pLang[i]) - nPos = i; - } - return nPos < 0 ? sal_False : sal_True; -} - - -static sal_Int32 lcl_SeqGetEntryPos( - const Sequence< OUString > &rSeq, const OUString &rEntry ) -{ - sal_Int32 i; - sal_Int32 nLen = rSeq.getLength(); - const OUString *pItem = rSeq.getConstArray(); - for (i = 0; i < nLen; ++i) - { - if (rEntry == pItem[i]) - break; - } - return i < nLen ? i : -1; -} - -static void lcl_OpenURL( ::rtl::OUString sURL ) -{ - if ( sURL.getLength() > 0 ) - { - localizeWebserviceURI(sURL); - try - { - uno::Reference< lang::XMultiServiceFactory > xSMGR = - ::comphelper::getProcessServiceFactory(); - uno::Reference< css::system::XSystemShellExecute > xSystemShell( - xSMGR->createInstance( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), - uno::UNO_QUERY_THROW ); - if ( xSystemShell.is() ) - xSystemShell->execute( sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS ); - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - } -} - -static const sal_uInt16 nNameLen = 8; - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_SPELL, - SID_ATTR_SPELL, - 0 -}; - -sal_Bool KillFile_Impl( const String& rURL ) -{ - sal_Bool bRet = sal_True; - try - { - Content aCnt( rURL, uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > () ); - aCnt.executeCommand( OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) ); - } - catch( ::com::sun::star::ucb::CommandAbortedException& ) - { - DBG_ERRORFILE( "KillFile: CommandAbortedException" ); - bRet = sal_False; - } - catch( ... ) - { - DBG_ERRORFILE( "KillFile: Any other exception" ); - bRet = sal_False; - } - - return bRet; -} - -// 0x 0p 0t 0c nn -// p: 1 -> parent -// t: 1 -> spell, 2 -> hyph, 3 -> thes, 4 -> grammar -// c: 1 -> checked 0 -> unchecked -// n: index - -#define TYPE_SPELL (sal_uInt8)1 -#define TYPE_GRAMMAR (sal_uInt8)2 -#define TYPE_HYPH (sal_uInt8)3 -#define TYPE_THES (sal_uInt8)4 - -class ModuleUserData_Impl -{ - sal_Bool bParent; - sal_Bool bIsChecked; - sal_uInt8 nType; - sal_uInt8 nIndex; - String sImplName; - -public: - ModuleUserData_Impl( String sImpName, sal_Bool bIsParent, sal_Bool bChecked, sal_uInt8 nSetType, sal_uInt8 nSetIndex ) : - bParent(bIsParent), - bIsChecked(bChecked), - nType(nSetType), - nIndex(nSetIndex), - sImplName(sImpName) - { - } - sal_Bool IsParent() const {return bParent;} - sal_uInt8 GetType() const {return nType;} - sal_Bool IsChecked() const {return bIsChecked;} - sal_uInt8 GetIndex() const {return nIndex;} - void SetIndex(sal_uInt8 nSet) {nIndex = nSet;} - const String& GetImplName() const {return sImplName;} - -}; - -// -// User for user-dictionaries (XDictionary interface) -// -class DicUserData -{ - sal_uLong nVal; - -public: - DicUserData( sal_uLong nUserData ) : nVal( nUserData ) {} - DicUserData( sal_uInt16 nEID, - sal_Bool bChecked, sal_Bool bEditable, sal_Bool bDeletable ); - - sal_uLong GetUserData() const { return nVal; } - sal_uInt16 GetEntryId() const { return (sal_uInt16)(nVal >> 16); } - sal_Bool IsChecked() const { return (sal_Bool)(nVal >> 8) & 0x01; } - sal_Bool IsEditable() const { return (sal_Bool)(nVal >> 9) & 0x01; } - sal_Bool IsDeletable() const { return (sal_Bool)(nVal >> 10) & 0x01; } - - void SetChecked( sal_Bool bVal ); -}; - - -DicUserData::DicUserData( - sal_uInt16 nEID, - sal_Bool bChecked, sal_Bool bEditable, sal_Bool bDeletable ) -{ - DBG_ASSERT( nEID < 65000, "Entry Id out of range" ); - nVal = ((sal_uLong)(0xFFFF & nEID) << 16) | - ((sal_uLong)(bChecked ? 1 : 0) << 8) | - ((sal_uLong)(bEditable ? 1 : 0) << 9) | - ((sal_uLong)(bDeletable ? 1 : 0) << 10); -} - - -void DicUserData::SetChecked( sal_Bool bVal ) -{ - nVal &= ~(1UL << 8); - nVal |= (sal_uLong)(bVal ? 1 : 0) << 8; -} - - -// class BrwString_Impl ------------------------------------------------- - -void lcl_SetCheckButton( SvLBoxEntry* pEntry, sal_Bool bCheck ) -{ - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON)); - - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - if (bCheck) - pItem->SetStateChecked(); - else - pItem->SetStateUnchecked(); - } -} - - -class BrwStringDic_Impl : public SvLBoxString -{ -public: - - BrwStringDic_Impl( SvLBoxEntry* pEntry, sal_uInt16 nFlags, - const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, - SvLBoxEntry* pEntry); -}; - -void BrwStringDic_Impl::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, - SvLBoxEntry* pEntry ) -{ - ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData(); - Point aPos(rPos); - Font aOldFont( rDev.GetFont()); - if(pData->IsParent()) - { - Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - rDev.SetFont( aFont ); - aPos.X() = 0; - } - else - aPos.X() += 5; - rDev.DrawText( aPos, GetText() ); - rDev.SetFont( aOldFont ); -} - -class OptionsBreakSet : public ModalDialog -{ - OKButton aOKPB; - CancelButton aCancelPB; - FixedLine aValFL; - NumericField aValNF; - -public: - OptionsBreakSet(Window* pParent, int nRID) : - ModalDialog(pParent, CUI_RES(RID_SVXDLG_LNG_ED_NUM_PREBREAK )), - aOKPB (this, CUI_RES(BT_OK_PREBREAK)), - aCancelPB (this, CUI_RES(BT_CANCEL_PREBREAK)), - aValFL (this, CUI_RES(FL_NUMVAL_PREBREAK)), - aValNF (this, CUI_RES(ED_PREBREAK)) - { - DBG_ASSERT( STR_NUM_PRE_BREAK_DLG == nRID || - STR_NUM_POST_BREAK_DLG == nRID || - STR_NUM_MIN_WORDLEN_DLG == nRID, "unexpected RID" ); - - if (nRID != -1) - aValFL.SetText( String( CUI_RES(nRID) ) ); - FreeResource(); - } - - NumericField& GetNumericFld() { return aValNF; } -}; - - -/*-------------------------------------------------- - Entry IDs for options listbox of dialog ---------------------------------------------------*/ - -enum EID_OPTIONS -{ - EID_SPELL_AUTO, - EID_GRAMMAR_AUTO, - EID_CAPITAL_WORDS, - EID_WORDS_WITH_DIGITS, - EID_CAPITALIZATION, - EID_SPELL_SPECIAL, - EID_NUM_MIN_WORDLEN, - EID_NUM_PRE_BREAK, - EID_NUM_POST_BREAK, - EID_HYPH_AUTO, - EID_HYPH_SPECIAL -}; - -//! this array must have an entry for every value of EID_OPTIONS. -// It is used to get the respective property name. -static const char * aEidToPropName[] = -{ - UPN_IS_SPELL_AUTO, // EID_SPELL_AUTO - UPN_IS_GRAMMAR_AUTO, // EID_GRAMMAR_AUTO - UPN_IS_SPELL_UPPER_CASE, // EID_CAPITAL_WORDS - UPN_IS_SPELL_WITH_DIGITS, // EID_WORDS_WITH_DIGITS - UPN_IS_SPELL_CAPITALIZATION, // EID_CAPITALIZATION - UPN_IS_SPELL_SPECIAL, // EID_SPELL_SPECIAL - UPN_HYPH_MIN_WORD_LENGTH, // EID_NUM_MIN_WORDLEN, - UPN_HYPH_MIN_LEADING, // EID_NUM_PRE_BREAK - UPN_HYPH_MIN_TRAILING, // EID_NUM_POST_BREAK - UPN_IS_HYPH_AUTO, // EID_HYPH_AUTO - UPN_IS_HYPH_SPECIAL // EID_HYPH_SPECIAL -}; - - -static inline String lcl_GetPropertyName( EID_OPTIONS eEntryId ) -{ - DBG_ASSERT( (unsigned int) eEntryId < SAL_N_ELEMENTS(aEidToPropName), "index out of range" ); - return String::CreateFromAscii( aEidToPropName[ (int) eEntryId ] ); -} - -// class OptionsUserData ------------------------------------------------- - -class OptionsUserData -{ - sal_uLong nVal; - - void SetModified(); - -public: - OptionsUserData( sal_uLong nUserData ) : nVal( nUserData ) {} - OptionsUserData( sal_uInt16 nEID, - sal_Bool bHasNV, sal_uInt16 nNumVal, - sal_Bool bCheckable, sal_Bool bChecked ); - - sal_uLong GetUserData() const { return nVal; } - sal_uInt16 GetEntryId() const { return (sal_uInt16)(nVal >> 16); } - sal_Bool HasNumericValue() const { return (sal_Bool)(nVal >> 10) & 0x01; } - sal_uInt16 GetNumericValue() const { return (sal_uInt16)(nVal & 0xFF); } - sal_Bool IsChecked() const { return (sal_Bool)(nVal >> 8) & 0x01; } - sal_Bool IsCheckable() const { return (sal_Bool)(nVal >> 9) & 0x01; } - sal_Bool IsModified() const { return (sal_Bool)(nVal >> 11) & 0x01; } - - void SetChecked( sal_Bool bVal ); - void SetNumericValue( sal_uInt8 nNumVal ); -}; - -OptionsUserData::OptionsUserData( sal_uInt16 nEID, - sal_Bool bHasNV, sal_uInt16 nNumVal, - sal_Bool bCheckable, sal_Bool bChecked ) -{ - DBG_ASSERT( nEID < 65000, "Entry Id out of range" ); - DBG_ASSERT( nNumVal < 256, "value out of range" ); - nVal = ((sal_uLong)(0xFFFF & nEID) << 16) | - ((sal_uLong)(bHasNV ? 1 : 0) << 10) | - ((sal_uLong)(bCheckable ? 1 : 0) << 9) | - ((sal_uLong)(bChecked ? 1 : 0) << 8) | - ((sal_uLong)(0xFF & nNumVal)); -} - -void OptionsUserData::SetChecked( sal_Bool bVal ) -{ - if (IsCheckable() && (IsChecked() != bVal)) - { - nVal &= ~(1UL << 8); - nVal |= (sal_uLong)(bVal ? 1 : 0) << 8; - SetModified(); - } -} - -void OptionsUserData::SetNumericValue( sal_uInt8 nNumVal ) -{ - if (HasNumericValue() && (GetNumericValue() != nNumVal)) - { - nVal &= 0xffffff00; - nVal |= (nNumVal); - SetModified(); - } -} - -void OptionsUserData::SetModified() -{ - nVal |= (sal_uLong)1 << 11; -} - -// class BrwString_Impl ------------------------------------------------- - -class BrwString_Impl : public SvLBoxString -{ -public: - - BrwString_Impl( SvLBoxEntry* pEntry, sal_uInt16 nFlags, - const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, - SvLBoxEntry* pEntry); -}; - -void BrwString_Impl::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, - SvLBoxEntry* pEntry ) -{ - Point aPos(rPos); - aPos.X() += 20; - rDev.DrawText( aPos, GetText() ); - if(pEntry->GetUserData()) - { - Point aNewPos(aPos); - aNewPos.X() += rDev.GetTextWidth(GetText()); - Font aOldFont( rDev.GetFont()); - Font aFont( aOldFont ); - aFont.SetWeight( WEIGHT_BOLD ); - - //??? das untere byte aus dem user data in string wandeln - OptionsUserData aData( (sal_uLong) pEntry->GetUserData() ); - if(aData.HasNumericValue()) - { - String sTxt( ' ' ); - sTxt += String::CreateFromInt32( aData.GetNumericValue() ); - rDev.SetFont( aFont ); - rDev.DrawText( aNewPos, sTxt ); - } - - rDev.SetFont( aOldFont ); - } -} - -// ServiceInfo_Impl ---------------------------------------------------- - -struct ServiceInfo_Impl -{ - OUString sDisplayName; - OUString sSpellImplName; - OUString sHyphImplName; - OUString sThesImplName; - OUString sGrammarImplName; - uno::Reference< XSpellChecker > xSpell; - uno::Reference< XHyphenator > xHyph; - uno::Reference< XThesaurus > xThes; - uno::Reference< XProofreader > xGrammar; - sal_Bool bConfigured; - - ServiceInfo_Impl() : bConfigured(sal_False) {} -}; - -typedef std::vector< ServiceInfo_Impl > ServiceInfoArr; -typedef std::map< sal_Int16 /*LanguageType*/, Sequence< OUString > > LangImplNameTable; - - -// SvxLinguData_Impl ---------------------------------------------------- - -class SvxLinguData_Impl -{ - //contains services and implementation names sorted by implementation names - ServiceInfoArr aDisplayServiceArr; - sal_uLong nDisplayServices; - - Sequence< Locale > aAllServiceLocales; - LangImplNameTable aCfgSpellTable; - LangImplNameTable aCfgHyphTable; - LangImplNameTable aCfgThesTable; - LangImplNameTable aCfgGrammarTable; - uno::Reference< XMultiServiceFactory > xMSF; - uno::Reference< XLinguServiceManager > xLinguSrvcMgr; - - - sal_Bool AddRemove( Sequence< OUString > &rConfigured, - const OUString &rImplName, sal_Bool bAdd ); - -public: - SvxLinguData_Impl(); - SvxLinguData_Impl( const SvxLinguData_Impl &rData ); - ~SvxLinguData_Impl(); - - SvxLinguData_Impl & operator = (const SvxLinguData_Impl &rData); - - uno::Reference & GetManager() { return xLinguSrvcMgr; } - - void SetChecked( const Sequence< OUString > &rConfiguredServices ); - void Reconfigure( const OUString &rDisplayName, sal_Bool bEnable ); - - const Sequence & GetAllSupportedLocales() const { return aAllServiceLocales; } - - const LangImplNameTable & GetSpellTable() const { return aCfgSpellTable; } - LangImplNameTable & GetSpellTable() { return aCfgSpellTable; } - const LangImplNameTable & GetHyphTable() const { return aCfgHyphTable; } - LangImplNameTable & GetHyphTable() { return aCfgHyphTable; } - const LangImplNameTable & GetThesTable() const { return aCfgThesTable; } - LangImplNameTable & GetThesTable() { return aCfgThesTable; } - const LangImplNameTable & GetGrammarTable() const { return aCfgGrammarTable; } - LangImplNameTable & GetGrammarTable() { return aCfgGrammarTable; } - - const ServiceInfoArr & GetDisplayServiceArray() const { return aDisplayServiceArr; } - ServiceInfoArr & GetDisplayServiceArray() { return aDisplayServiceArr; } - - const sal_uLong & GetDisplayServiceCount() const { return nDisplayServices; } - void SetDisplayServiceCount( sal_uLong nVal ) { nDisplayServices = nVal; } - - // returns the list of service implementation names for the specified - // language and service (TYPE_SPELL, TYPE_HYPH, TYPE_THES) sorted in - // the proper order for the SvxEditModulesDlg (the ones from the - // configuration (keeping that order!) first and then the other ones. - // I.e. the ones available but not configured in arbitrary order). - // They available ones may contain names that do not(!) support that - // language. - Sequence< OUString > GetSortedImplNames( sal_Int16 nLang, sal_uInt8 nType ); - - ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName ); -}; - - -sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUString &rTxt ) -{ - sal_Int32 nRes = -1; - sal_Int32 nLen = rSeq.getLength(); - const OUString *pString = rSeq.getConstArray(); - for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i) - { - if (pString[i] == rTxt) - nRes = i; - } - return nRes; -} - - -Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( sal_Int16 nLang, sal_uInt8 nType ) -{ - LangImplNameTable *pTable = 0; - switch (nType) - { - case TYPE_SPELL : pTable = &aCfgSpellTable; break; - case TYPE_HYPH : pTable = &aCfgHyphTable; break; - case TYPE_THES : pTable = &aCfgThesTable; break; - case TYPE_GRAMMAR : pTable = &aCfgGrammarTable; break; - } - Sequence< OUString > aRes; - if (pTable->count( nLang )) - aRes = (*pTable)[ nLang ]; // add configured services - sal_Int32 nIdx = aRes.getLength(); - DBG_ASSERT( (sal_Int32) nDisplayServices >= nIdx, "size mismatch" ); - aRes.realloc( nDisplayServices ); - OUString *pRes = aRes.getArray(); - - // add not configured services - for (sal_Int32 i = 0; i < (sal_Int32) nDisplayServices; ++i) - { - const ServiceInfo_Impl &rInfo = aDisplayServiceArr[ i ]; - OUString aImplName; - switch (nType) - { - case TYPE_SPELL : aImplName = rInfo.sSpellImplName; break; - case TYPE_HYPH : aImplName = rInfo.sHyphImplName; break; - case TYPE_THES : aImplName = rInfo.sThesImplName; break; - case TYPE_GRAMMAR : aImplName = rInfo.sGrammarImplName; break; - } - - if (aImplName.getLength() && (lcl_SeqGetIndex( aRes, aImplName) == -1)) // name not yet added - { - DBG_ASSERT( nIdx < aRes.getLength(), "index out of range" ); - if (nIdx < aRes.getLength()) - pRes[ nIdx++ ] = aImplName; - } - } - // don't forget to put aRes back to its actual size just in case you allocated too much - // since all of the names may have already been added - // otherwise you get duplicate entries in the edit dialog - aRes.realloc( nIdx ); - return aRes; -} - - -ServiceInfo_Impl * SvxLinguData_Impl::GetInfoByImplName( const OUString &rSvcImplName ) -{ - ServiceInfo_Impl* pInfo = 0; - for (sal_uLong i = 0; i < nDisplayServices && !pInfo; ++i) - { - ServiceInfo_Impl &rTmp = aDisplayServiceArr[ i ]; - if (rTmp.sSpellImplName == rSvcImplName || - rTmp.sHyphImplName == rSvcImplName || - rTmp.sThesImplName == rSvcImplName || - rTmp.sGrammarImplName == rSvcImplName) - pInfo = &rTmp; - } - return pInfo; -} - - -//----------------------------------------------------------------------------- - -void lcl_MergeLocales(Sequence< Locale >& aAllLocales, const Sequence< Locale >& rAdd) -{ - const Locale* pAdd = rAdd.getConstArray(); - Sequence aLocToAdd(rAdd.getLength()); - const Locale* pAllLocales = aAllLocales.getConstArray(); - Locale* pLocToAdd = aLocToAdd.getArray(); - sal_Int32 nFound = 0; - sal_Int32 i; - for(i = 0; i < rAdd.getLength(); i++) - { - sal_Bool bFound = sal_False; - for(sal_Int32 j = 0; j < aAllLocales.getLength() && !bFound; j++) - { - bFound = pAdd[i].Language == pAllLocales[j].Language && - pAdd[i].Country == pAllLocales[j].Country; - } - if(!bFound) - { - pLocToAdd[nFound++] = pAdd[i]; - } - } - sal_Int32 nLength = aAllLocales.getLength(); - aAllLocales.realloc( nLength + nFound); - Locale* pAllLocales2 = aAllLocales.getArray(); - for(i = 0; i < nFound; i++) - pAllLocales2[nLength++] = pLocToAdd[i]; -} - -void lcl_MergeDisplayArray( - SvxLinguData_Impl &rData, - const ServiceInfo_Impl &rToAdd ) -{ - sal_uLong nCnt = 0; - - ServiceInfoArr &rSvcInfoArr = rData.GetDisplayServiceArray(); - sal_uLong nEntries = rData.GetDisplayServiceCount(); - - ServiceInfo_Impl* pEntry; - for (sal_uLong i = 0; i < nEntries; ++i) - { - pEntry = &rSvcInfoArr[i]; - if (pEntry && pEntry->sDisplayName == rToAdd.sDisplayName) - { - if(rToAdd.xSpell.is()) - { - DBG_ASSERT( !pEntry->xSpell.is() && - pEntry->sSpellImplName.getLength() == 0, - "merge conflict" ); - pEntry->sSpellImplName = rToAdd.sSpellImplName; - pEntry->xSpell = rToAdd.xSpell; - } - if(rToAdd.xGrammar.is()) - { - DBG_ASSERT( !pEntry->xGrammar.is() && - pEntry->sGrammarImplName.getLength() == 0, - "merge conflict" ); - pEntry->sGrammarImplName = rToAdd.sGrammarImplName; - pEntry->xGrammar = rToAdd.xGrammar; - } - if(rToAdd.xHyph.is()) - { - DBG_ASSERT( !pEntry->xHyph.is() && - pEntry->sHyphImplName.getLength() == 0, - "merge conflict" ); - pEntry->sHyphImplName = rToAdd.sHyphImplName; - pEntry->xHyph = rToAdd.xHyph; - } - if(rToAdd.xThes.is()) - { - DBG_ASSERT( !pEntry->xThes.is() && - pEntry->sThesImplName.getLength() == 0, - "merge conflict" ); - pEntry->sThesImplName = rToAdd.sThesImplName; - pEntry->xThes = rToAdd.xThes; - } - return ; - } - ++nCnt; - } - rData.GetDisplayServiceArray().push_back( rToAdd ); - rData.SetDisplayServiceCount( nCnt + 1 ); -} - -SvxLinguData_Impl::SvxLinguData_Impl() : - nDisplayServices (0) -{ - xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < XInterface > xI = xMSF->createInstance( - C2U( "com.sun.star.linguistic2.LinguServiceManager" ) ); - xLinguSrvcMgr = uno::Reference(xI, UNO_QUERY); - DBG_ASSERT(xLinguSrvcMgr.is(), "No linguistic service available!"); - if(xLinguSrvcMgr.is()) - { - Locale aCurrentLocale; - LanguageType eLang = Application::GetSettings().GetLanguage(); - SvxLanguageToLocale(aCurrentLocale, eLang); - Sequence aArgs(2);//second arguments has to be empty! - aArgs.getArray()[0] <<= SvxGetLinguPropertySet(); - - //read spell checker - Sequence< OUString > aSpellNames = xLinguSrvcMgr->getAvailableServices( - C2U(cSpell), Locale() ); - const OUString* pSpellNames = aSpellNames.getConstArray(); - - sal_Int32 nIdx; - for(nIdx = 0; nIdx < aSpellNames.getLength(); nIdx++) - { - ServiceInfo_Impl aInfo; - aInfo.sSpellImplName = pSpellNames[nIdx]; - aInfo.xSpell = uno::Reference( - xMSF->createInstanceWithArguments(aInfo.sSpellImplName, aArgs), UNO_QUERY); - - uno::Reference xDispName(aInfo.xSpell, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } - } - - //read grammar checker - Sequence< OUString > aGrammarNames = xLinguSrvcMgr->getAvailableServices( - C2U(cGrammar), Locale() ); - const OUString* pGrammarNames = aGrammarNames.getConstArray(); - for(nIdx = 0; nIdx < aGrammarNames.getLength(); nIdx++) - { - ServiceInfo_Impl aInfo; - aInfo.sGrammarImplName = pGrammarNames[nIdx]; - aInfo.xGrammar = uno::Reference( - xMSF->createInstanceWithArguments(aInfo.sGrammarImplName, aArgs), UNO_QUERY); - - uno::Reference xDispName(aInfo.xGrammar, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } - } - - //read hyphenator - Sequence< OUString > aHyphNames = xLinguSrvcMgr->getAvailableServices( - C2U(cHyph), Locale() ); - const OUString* pHyphNames = aHyphNames.getConstArray(); - for(nIdx = 0; nIdx < aHyphNames.getLength(); nIdx++) - { - ServiceInfo_Impl aInfo; - aInfo.sHyphImplName = pHyphNames[nIdx]; - aInfo.xHyph = uno::Reference( - xMSF->createInstanceWithArguments(aInfo.sHyphImplName, aArgs), UNO_QUERY); - - uno::Reference xDispName(aInfo.xHyph, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } - } - - //read thesauri - Sequence< OUString > aThesNames = xLinguSrvcMgr->getAvailableServices( - C2U(cThes), Locale() ); - const OUString* pThesNames = aThesNames.getConstArray(); - for(nIdx = 0; nIdx < aThesNames.getLength(); nIdx++) - { - ServiceInfo_Impl aInfo; - aInfo.sThesImplName = pThesNames[nIdx]; - aInfo.xThes = uno::Reference( - xMSF->createInstanceWithArguments(aInfo.sThesImplName, aArgs), UNO_QUERY); - - uno::Reference xDispName(aInfo.xThes, UNO_QUERY); - if(xDispName.is()) - aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale ); - - const Sequence< Locale > aLocales( aInfo.xThes->getLocales() ); - //! suppress display of entries with no supported languages (see feature 110994) - if (aLocales.getLength()) - { - lcl_MergeLocales( aAllServiceLocales, aLocales ); - lcl_MergeDisplayArray( *this, aInfo ); - } - } - - Sequence< OUString > aCfgSvcs; - const Locale* pAllLocales = aAllServiceLocales.getConstArray(); - for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++) - { - sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] ); - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cSpell), pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgSpellTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cGrammar), pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgGrammarTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cHyph), pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgHyphTable[ nLang ] = aCfgSvcs; - - aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(C2U(cThes), pAllLocales[nLocale]); - SetChecked( aCfgSvcs ); - if (aCfgSvcs.getLength()) - aCfgThesTable[ nLang ] = aCfgSvcs; - } - } -} - -SvxLinguData_Impl::SvxLinguData_Impl( const SvxLinguData_Impl &rData ) : - aDisplayServiceArr (rData.aDisplayServiceArr), - nDisplayServices (rData.nDisplayServices), - aAllServiceLocales (rData.aAllServiceLocales), - aCfgSpellTable (rData.aCfgSpellTable), - aCfgHyphTable (rData.aCfgHyphTable), - aCfgThesTable (rData.aCfgThesTable), - aCfgGrammarTable (rData.aCfgGrammarTable), - xMSF (rData.xMSF), - xLinguSrvcMgr (rData.xLinguSrvcMgr) -{ -} - -SvxLinguData_Impl & SvxLinguData_Impl::operator = (const SvxLinguData_Impl &rData) -{ - xMSF = rData.xMSF; - xLinguSrvcMgr = rData.xLinguSrvcMgr; - aAllServiceLocales = rData.aAllServiceLocales; - aCfgSpellTable = rData.aCfgSpellTable; - aCfgHyphTable = rData.aCfgHyphTable; - aCfgThesTable = rData.aCfgThesTable; - aCfgGrammarTable = rData.aCfgGrammarTable; - aDisplayServiceArr = rData.aDisplayServiceArr; - nDisplayServices = rData.nDisplayServices; - return *this; -} - -SvxLinguData_Impl::~SvxLinguData_Impl() -{ -} - -void SvxLinguData_Impl::SetChecked(const Sequence& rConfiguredServices) -{ - const OUString* pConfiguredServices = rConfiguredServices.getConstArray(); - for(sal_Int32 n = 0; n < rConfiguredServices.getLength(); n++) - { - ServiceInfo_Impl* pEntry; - for (sal_uLong i = 0; i < nDisplayServices; ++i) - { - pEntry = &aDisplayServiceArr[i]; - if (pEntry && !pEntry->bConfigured) - { - const OUString &rSrvcImplName = pConfiguredServices[n]; - if (rSrvcImplName.getLength() && - (pEntry->sSpellImplName == rSrvcImplName || - pEntry->sGrammarImplName == rSrvcImplName || - pEntry->sHyphImplName == rSrvcImplName || - pEntry->sThesImplName == rSrvcImplName)) - { - pEntry->bConfigured = sal_True; - break; - } - } - } - } -} - -sal_Bool SvxLinguData_Impl::AddRemove( - Sequence< OUString > &rConfigured, - const OUString &rImplName, sal_Bool bAdd ) -{ - sal_Bool bRet = sal_False; // modified? - - sal_Int32 nEntries = rConfigured.getLength(); - sal_Int32 nPos = lcl_SeqGetEntryPos(rConfigured, rImplName); - if (bAdd && nPos < 0) // add new entry - { - rConfigured.realloc( ++nEntries ); - OUString *pConfigured = rConfigured.getArray(); - pConfigured = rConfigured.getArray(); - pConfigured[nEntries - 1] = rImplName; - bRet = sal_True; - } - else if (!bAdd && nPos >= 0) // remove existing entry - { - OUString *pConfigured = rConfigured.getArray(); - for (sal_Int32 i = nPos; i < nEntries - 1; ++i) - pConfigured[i] = pConfigured[i + 1]; - rConfigured.realloc(--nEntries); - bRet = sal_True; - } - - return bRet; -} - - -void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, sal_Bool bEnable ) -{ - DBG_ASSERT( rDisplayName.getLength(), "empty DisplayName" ); - - ServiceInfo_Impl *pInfo = 0; - ServiceInfo_Impl *pTmp = 0; - for (sal_uLong i = 0; i < nDisplayServices; ++i) - { - pTmp = &aDisplayServiceArr[i]; - if (pTmp && pTmp->sDisplayName == rDisplayName) - { - pInfo = pTmp; - break; - } - } - DBG_ASSERT( pInfo, "DisplayName entry not found" ); - if (pInfo) - { - pInfo->bConfigured = bEnable; - - Sequence< Locale > aLocales; - const Locale *pLocale = 0; - sal_Int32 nLocales = 0; - sal_Int32 i; - - // update configured spellchecker entries - if (pInfo->xSpell.is()) - { - aLocales = pInfo->xSpell->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) - { - sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] ); - if (!aCfgSpellTable.count( nLang ) && bEnable) - aCfgSpellTable[ nLang ] = Sequence< OUString >(); - if (aCfgSpellTable.count( nLang )) - AddRemove( aCfgSpellTable[ nLang ], pInfo->sSpellImplName, bEnable ); - } - } - - // update configured grammar checker entries - if (pInfo->xGrammar.is()) - { - aLocales = pInfo->xGrammar->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) - { - sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] ); - if (!aCfgGrammarTable.count( nLang ) && bEnable) - aCfgGrammarTable[ nLang ] = Sequence< OUString >(); - if (aCfgGrammarTable.count( nLang )) - AddRemove( aCfgGrammarTable[ nLang ], pInfo->sGrammarImplName, bEnable ); - } - } - - // update configured hyphenator entries - if (pInfo->xHyph.is()) - { - aLocales = pInfo->xHyph->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) - { - sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] ); - if (!aCfgHyphTable.count( nLang ) && bEnable) - aCfgHyphTable[ nLang ] = Sequence< OUString >(); - if (aCfgHyphTable.count( nLang )) - AddRemove( aCfgHyphTable[ nLang ], pInfo->sHyphImplName, bEnable ); - } - } - - // update configured spellchecker entries - if (pInfo->xThes.is()) - { - aLocales = pInfo->xThes->getLocales(); - pLocale = aLocales.getConstArray(); - nLocales = aLocales.getLength(); - for (i = 0; i < nLocales; ++i) - { - sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] ); - if (!aCfgThesTable.count( nLang ) && bEnable) - aCfgThesTable[ nLang ] = Sequence< OUString >(); - if (aCfgThesTable.count( nLang )) - AddRemove( aCfgThesTable[ nLang ], pInfo->sThesImplName, bEnable ); - } - } - } -} - - -// class SvxLinguTabPage ------------------------------------------------- - -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 -#define CBCOL_BOTH 2 - -SvxLinguTabPage::SvxLinguTabPage( Window* pParent, - const SfxItemSet& rSet ): - - SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_LINGU ), rSet ), - - aLinguisticFL ( this, CUI_RES( FL_LINGUISTIC ) ), - aLinguModulesFT ( this, CUI_RES( FT_LINGU_MODULES ) ), - aLinguModulesCLB ( this, CUI_RES( CLB_LINGU_MODULES ) ), - aLinguModulesEditPB ( this, CUI_RES( PB_LINGU_MODULES_EDIT ) ), - aLinguDicsFT ( this, CUI_RES( FT_LINGU_DICS ) ), - aLinguDicsCLB ( this, CUI_RES( CLB_LINGU_DICS ) ), - aLinguDicsNewPB ( this, CUI_RES( PB_LINGU_DICS_NEW_DIC ) ), - aLinguDicsEditPB ( this, CUI_RES( PB_LINGU_DICS_EDIT_DIC ) ), - aLinguDicsDelPB ( this, CUI_RES( PB_LINGU_DICS_DEL_DIC ) ), - aLinguOptionsFT ( this, CUI_RES( FT_LINGU_OPTIONS ) ), - aLinguOptionsCLB ( this, CUI_RES( CLB_LINGU_OPTIONS ) ), - aLinguOptionsEditPB ( this, CUI_RES( PB_LINGU_OPTIONS_EDIT ) ), - aMoreDictsLink ( this, CUI_RES( FT_LINGU_OPTIONS_MOREDICTS ) ), - sCapitalWords ( CUI_RES( STR_CAPITAL_WORDS ) ), - sWordsWithDigits ( CUI_RES( STR_WORDS_WITH_DIGITS ) ), - sCapitalization ( CUI_RES( STR_CAPITALIZATION ) ), - sSpellSpecial ( CUI_RES( STR_SPELL_SPECIAL ) ), - sSpellAuto ( CUI_RES( STR_SPELL_AUTO ) ), - sGrammarAuto ( CUI_RES( STR_GRAMMAR_AUTO ) ), - sNumMinWordlen ( CUI_RES( STR_NUM_MIN_WORDLEN ) ), - sNumPreBreak ( CUI_RES( STR_NUM_PRE_BREAK ) ), - sNumPostBreak ( CUI_RES( STR_NUM_POST_BREAK ) ), - sHyphAuto ( CUI_RES( STR_HYPH_AUTO ) ), - sHyphSpecial ( CUI_RES( STR_HYPH_SPECIAL ) ), - - pLinguData ( NULL ) -{ - pCheckButtonData = NULL; - - aLinguModulesCLB.SetStyle( aLinguModulesCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aLinguModulesCLB.SetHelpId(HID_CLB_LINGU_MODULES ); - aLinguModulesCLB.SetHighlightRange(); - aLinguModulesCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); - aLinguModulesCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl)); - aLinguModulesCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl)); - - aLinguModulesEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - aLinguOptionsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - - aLinguDicsCLB.SetStyle( aLinguDicsCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aLinguDicsCLB.SetHelpId(HID_CLB_EDIT_MODULES_DICS ); - aLinguDicsCLB.SetHighlightRange(); - aLinguDicsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); - aLinguDicsCLB.SetCheckButtonHdl(LINK(this, SvxLinguTabPage, BoxCheckButtonHdl_Impl)); - - aLinguDicsNewPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - aLinguDicsEditPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - aLinguDicsDelPB.SetClickHdl( LINK( this, SvxLinguTabPage, ClickHdl_Impl )); - - aLinguOptionsCLB.SetStyle( aLinguOptionsCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aLinguOptionsCLB.SetHelpId(HID_CLB_LINGU_OPTIONS ); - aLinguOptionsCLB.SetHighlightRange(); - aLinguOptionsCLB.SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl )); - aLinguOptionsCLB.SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl)); - - if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() - != SvtExtendedSecurityOptions::OPEN_NEVER ) - { - aMoreDictsLink.SetURL( String( - RTL_CONSTASCII_USTRINGPARAM( "http://extensions.libreoffice.org/dictionary/" ) ) ); - aMoreDictsLink.SetClickHdl( LINK( this, SvxLinguTabPage, OpenURLHdl_Impl ) ); - } - else - aMoreDictsLink.Hide(); - - String sAccessibleNameModuleEdit( CUI_RES( STR_LINGU_MODULES_EDIT ) ); - String sAccessibleNameDicsEdit ( CUI_RES( STR_LINGU_DICS_EDIT_DIC ) ); - String sAccessibleNameOptionEdit( CUI_RES( STR_LINGU_OPTIONS_EDIT ) ); - - aLinguModulesEditPB.SetAccessibleName(sAccessibleNameModuleEdit); - aLinguDicsEditPB.SetAccessibleName(sAccessibleNameDicsEdit); - aLinguOptionsEditPB.SetAccessibleName(sAccessibleNameOptionEdit); - - // force recalculation of hash value used for checking the need of updating - // because new dictionaries might be installed / downloaded. - //! Thus it needs to be called now since it may infuence the supported languages - //! to be reported AND the found user-dictionaries(!) as well. - SvxLinguConfigUpdate::UpdateAll( sal_True ); - - xProp = uno::Reference< XPropertySet >( SvxGetLinguPropertySet(), UNO_QUERY ); - xDicList = uno::Reference< XDictionaryList >( SvxGetDictionaryList(), UNO_QUERY ); - if (xDicList.is()) - { - // keep references to all **currently** available dictionaries, - // since the diclist may get changed meanwhile (e.g. through the API). - // We want the dialog to operate on the same set of dictionaries it - // was started with. - // Also we have to take care to not loose the last reference when - // someone else removes a dictionary from the list. - // removed dics will be replaced by NULL new entries be added to the end - // Thus we may use indizes as consistent references. - aDics = xDicList->getDictionaries(); - - UpdateDicBox_Impl(); - } - else - { - aLinguDicsFT.Disable(); - aLinguDicsCLB.Disable(); - aLinguDicsNewPB.Disable(); - aLinguDicsEditPB.Disable(); - aLinguDicsDelPB.Disable(); - } - - const SfxSpellCheckItem* pItem = 0; - SfxItemState eItemState = SFX_ITEM_UNKNOWN; - - eItemState = rSet.GetItemState( GetWhich( SID_ATTR_SPELL ), - sal_False, (const SfxPoolItem**)&pItem ); - - // handelt es sich um ein Default-Item? - if ( eItemState == SFX_ITEM_DEFAULT ) - pItem = (const SfxSpellCheckItem*)&(rSet.Get( GetWhich( SID_ATTR_SPELL ) ) ); - else if ( eItemState == SFX_ITEM_DONTCARE ) - pItem = NULL; - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxLinguTabPage::~SvxLinguTabPage() -{ - if (pLinguData) - delete pLinguData; -} - -//------------------------------------------------------------------------ - -//nicht �berladen wegschmeissen -sal_uInt16* SvxLinguTabPage::GetRanges() -{ - //TL??? - return pRanges; -} - -//------------------------------------------------------------------------ - -SfxTabPage* SvxLinguTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return ( new SvxLinguTabPage( pParent, rAttrSet ) ); -} - -//------------------------------------------------------------------------ - -Any lcl_Bool2Any(sal_Bool bVal) -{ - Any aRet(&bVal, ::getBooleanCppuType()); - return aRet; -} - - -sal_Bool lcl_Bool2Any(Any& rVal) -{ - return *(sal_Bool*)rVal.getValue(); -} - - -sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet ) -{ - sal_Bool bModified = sal_True; // !!!! - - // if not HideGroups was called with GROUP_MODULES... - if (aLinguModulesCLB.IsVisible()) - { - DBG_ASSERT( pLinguData, "pLinguData not yet initialized" ); - if (!pLinguData) - pLinguData = new SvxLinguData_Impl; - - LangImplNameTable::const_iterator aIt; - - // update spellchecker configuration entries - const LangImplNameTable *pTable = &pLinguData->GetSpellTable(); - for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt) - { - sal_Int16 nLang = aIt->first; - const Sequence< OUString > aImplNames( aIt->second ); -#if OSL_DEBUG_LEVEL > 1 - const OUString *pTmpStr; - pTmpStr = aImplNames.getConstArray(); -#endif - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); - Locale aLocale( SvxCreateLocale(nLang) ); - if (xMgr.is()) - xMgr->setConfiguredServices( C2U(cSpell), aLocale, aImplNames ); - } - - // update grammar checker configuration entries - pTable = &pLinguData->GetGrammarTable(); - for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt) - { - sal_Int16 nLang = aIt->first; - const Sequence< OUString > aImplNames( aIt->second ); -#if OSL_DEBUG_LEVEL > 1 - const OUString *pTmpStr; - pTmpStr = aImplNames.getConstArray(); -#endif - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); - Locale aLocale( SvxCreateLocale(nLang) ); - if (xMgr.is()) - xMgr->setConfiguredServices( C2U(cGrammar), aLocale, aImplNames ); - } - - // update hyphenator configuration entries - pTable = &pLinguData->GetHyphTable(); - for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt) - { - sal_Int16 nLang = aIt->first; - const Sequence< OUString > aImplNames( aIt->second ); -#if OSL_DEBUG_LEVEL > 1 - const OUString *pTmpStr; - pTmpStr = aImplNames.getConstArray(); -#endif - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); - Locale aLocale( SvxCreateLocale(nLang) ); - if (xMgr.is()) - xMgr->setConfiguredServices( C2U(cHyph), aLocale, aImplNames ); - } - - // update thesaurus configuration entries - pTable = &pLinguData->GetThesTable(); - for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt) - { - sal_Int16 nLang = aIt->first; - const Sequence< OUString > aImplNames( aIt->second ); -#if OSL_DEBUG_LEVEL > 1 - const OUString *pTmpStr; - pTmpStr = aImplNames.getConstArray(); -#endif - uno::Reference< XLinguServiceManager > xMgr( pLinguData->GetManager() ); - Locale aLocale( SvxCreateLocale(nLang) ); - if (xMgr.is()) - xMgr->setConfiguredServices( C2U(cThes), aLocale, aImplNames ); - } - } - - - // - // activate dictionaries according to checkbox state - // - Sequence< OUString > aActiveDics; - sal_Int32 nActiveDics = 0; - sal_uLong nEntries = aLinguDicsCLB.GetEntryCount(); - for (sal_uLong i = 0; i < nEntries; ++i) - { - sal_Int32 nDics = aDics.getLength(); - - aActiveDics.realloc( nDics ); - OUString *pActiveDic = aActiveDics.getArray(); - - SvLBoxEntry *pEntry = aLinguDicsCLB.GetEntry( i ); - if (pEntry) - { - DicUserData aData( (sal_uLong)pEntry->GetUserData() ); - if (aData.GetEntryId() < nDics) - { - sal_Bool bChecked = aLinguDicsCLB.IsChecked( (sal_uInt16) i ); - uno::Reference< XDictionary > xDic( aDics.getConstArray()[ i ] ); - if (xDic.is()) - { - if (SvxGetIgnoreAllList() == xDic) - bChecked = sal_True; - xDic->setActive( bChecked ); - - if (bChecked) - { - String aDicName( xDic->getName() ); - pActiveDic[ nActiveDics++ ] = aDicName; - } - } - } - } - } - - aActiveDics.realloc( nActiveDics ); - Any aTmp; - aTmp <<= aActiveDics; - SvtLinguConfig aLngCfg; - aLngCfg.SetProperty( UPH_ACTIVE_DICTIONARIES, aTmp ); - - - nEntries = aLinguOptionsCLB.GetEntryCount(); - for (sal_uInt16 j = 0; j < nEntries; ++j) - { - SvLBoxEntry *pEntry = aLinguOptionsCLB.GetEntry( j ); - - OptionsUserData aData( (sal_uLong)pEntry->GetUserData() ); - String aPropName( lcl_GetPropertyName( (EID_OPTIONS) aData.GetEntryId() ) ); - - Any aAny; - if (aData.IsCheckable()) - { - sal_Bool bChecked = aLinguOptionsCLB.IsChecked( j ); - aAny <<= bChecked; - } - else if (aData.HasNumericValue()) - { - sal_Int16 nVal = aData.GetNumericValue(); - aAny <<= nVal; - } - - if (xProp.is()) - xProp->setPropertyValue( aPropName, aAny ); - aLngCfg.SetProperty( aPropName, aAny ); - } - - SvLBoxEntry *pPreBreakEntry = aLinguOptionsCLB.GetEntry( (sal_uInt16) EID_NUM_PRE_BREAK ); - SvLBoxEntry *pPostBreakEntry = aLinguOptionsCLB.GetEntry( (sal_uInt16) EID_NUM_POST_BREAK ); - DBG_ASSERT( pPreBreakEntry, "NULL Pointer" ); - DBG_ASSERT( pPostBreakEntry, "NULL Pointer" ); - if (pPreBreakEntry && pPostBreakEntry) - { - OptionsUserData aPreBreakData( (sal_uLong)pPreBreakEntry->GetUserData() ); - OptionsUserData aPostBreakData( (sal_uLong)pPostBreakEntry->GetUserData() ); - if ( aPreBreakData.IsModified() || aPostBreakData.IsModified() ) - { - SfxHyphenRegionItem aHyp( GetWhich( SID_ATTR_HYPHENREGION ) ); - aHyp.GetMinLead() = (sal_uInt8) aPreBreakData.GetNumericValue(); - aHyp.GetMinTrail() = (sal_uInt8) aPostBreakData.GetNumericValue(); - rCoreSet.Put( aHyp ); - } - } - - - // automatic spell checking - sal_Bool bNewAutoCheck = aLinguOptionsCLB.IsChecked( (sal_uInt16) EID_SPELL_AUTO ); - const SfxPoolItem* pOld = GetOldItem( rCoreSet, SID_AUTOSPELL_CHECK ); - if ( !pOld || ( (SfxBoolItem*)pOld )->GetValue() != bNewAutoCheck ) - { - rCoreSet.Put( SfxBoolItem( GetWhich( SID_AUTOSPELL_CHECK ), - bNewAutoCheck ) ); - bModified |= sal_True; - } - - return bModified; -} - -// ---------------------------------------------------------------------- - -sal_uLong SvxLinguTabPage::GetDicUserData( const uno::Reference< XDictionary > &rxDic, sal_uInt16 nIdx ) -{ - sal_uLong nRes = 0; - DBG_ASSERT( rxDic.is(), "dictionary not supplied" ); - if (rxDic.is()) - { - uno::Reference< frame::XStorable > xStor( rxDic, UNO_QUERY ); - - sal_Bool bChecked = rxDic->isActive(); - sal_Bool bEditable = !xStor.is() || !xStor->isReadonly(); - sal_Bool bDeletable = bEditable; - - nRes = DicUserData( nIdx, - bChecked, bEditable, bDeletable ).GetUserData(); - } - return nRes; -} - - -void SvxLinguTabPage::AddDicBoxEntry( - const uno::Reference< XDictionary > &rxDic, - sal_uInt16 nIdx ) -{ - aLinguDicsCLB.SetUpdateMode(sal_False); - - String aTxt( ::GetDicInfoStr( rxDic->getName(), - SvxLocaleToLanguage( rxDic->getLocale() ), - DictionaryType_NEGATIVE == rxDic->getDictionaryType() ) ); - aLinguDicsCLB.InsertEntry( aTxt, (sal_uInt16)LISTBOX_APPEND ); // append at end - SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( aLinguDicsCLB.GetEntryCount() - 1 ); - DBG_ASSERT( pEntry, "failed to add entry" ); - if (pEntry) - { - DicUserData aData( GetDicUserData( rxDic, nIdx ) ); - pEntry->SetUserData( (void *) aData.GetUserData() ); - lcl_SetCheckButton( pEntry, aData.IsChecked() ); - } - - aLinguDicsCLB.SetUpdateMode(sal_True); -} - -// ---------------------------------------------------------------------- - -void SvxLinguTabPage::UpdateDicBox_Impl() -{ - aLinguDicsCLB.SetUpdateMode(sal_False); - aLinguDicsCLB.Clear(); - - sal_Int32 nDics = aDics.getLength(); - const uno::Reference< XDictionary > *pDic = aDics.getConstArray(); - for (sal_Int32 i = 0; i < nDics; ++i) - { - const uno::Reference< XDictionary > &rDic = pDic[i]; - if (rDic.is()) - AddDicBoxEntry( rDic, (sal_uInt16)i ); - } - - aLinguDicsCLB.SetUpdateMode(sal_True); -} - -// ---------------------------------------------------------------------- - -void SvxLinguTabPage::UpdateModulesBox_Impl() -{ - if (pLinguData) - { - const ServiceInfoArr &rAllDispSrvcArr = pLinguData->GetDisplayServiceArray(); - const sal_uLong nDispSrvcCount = pLinguData->GetDisplayServiceCount(); - - aLinguModulesCLB.Clear(); - - for (sal_uInt16 i = 0; i < nDispSrvcCount; ++i) - { - const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i]; - aLinguModulesCLB.InsertEntry( rInfo.sDisplayName, (sal_uInt16)LISTBOX_APPEND ); - SvLBoxEntry* pEntry = aLinguModulesCLB.GetEntry(i); - pEntry->SetUserData( (void *) &rInfo ); - aLinguModulesCLB.CheckEntryPos( i, rInfo.bConfigured ); - } - aLinguModulesEditPB.Enable( nDispSrvcCount > 0 ); - } -} - -//------------------------------------------------------------------------ - -void SvxLinguTabPage::Reset( const SfxItemSet& rSet ) -{ - // if not HideGroups was called with GROUP_MODULES... - if (aLinguModulesCLB.IsVisible()) - { - if (!pLinguData) - pLinguData = new SvxLinguData_Impl; - UpdateModulesBox_Impl(); - } - - - // - // get data from configuration - // - - SvtLinguConfig aLngCfg; - - aLinguOptionsCLB.SetUpdateMode(sal_False); - aLinguOptionsCLB.Clear(); - - SvLBoxTreeList *pModel = aLinguOptionsCLB.GetModel(); - SvLBoxEntry* pEntry = NULL; - - sal_Int16 nVal = 0; - sal_Bool bVal = sal_False; - sal_uLong nUserData = 0; - - pEntry = CreateEntry( sSpellAuto, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_SPELL_AUTO) ) >>= bVal; - const SfxPoolItem* pItem = GetItem( rSet, SID_AUTOSPELL_CHECK ); - if (pItem) - bVal = ((SfxBoolItem *) pItem)->GetValue(); - nUserData = OptionsUserData( EID_SPELL_AUTO, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sGrammarAuto, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_GRAMMAR_AUTO) ) >>= bVal; - nUserData = OptionsUserData( EID_GRAMMAR_AUTO, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sCapitalWords, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_SPELL_UPPER_CASE) ) >>= bVal; - nUserData = OptionsUserData( EID_CAPITAL_WORDS, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sWordsWithDigits, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_SPELL_WITH_DIGITS) ) >>= bVal; - nUserData = OptionsUserData( EID_WORDS_WITH_DIGITS, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sCapitalization, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_SPELL_CAPITALIZATION) ) >>= bVal; - nUserData = OptionsUserData( EID_CAPITALIZATION, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sSpellSpecial, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_SPELL_SPECIAL) ) >>= bVal; - nUserData = OptionsUserData( EID_SPELL_SPECIAL, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sNumMinWordlen, CBCOL_SECOND ); - aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_WORD_LENGTH) ) >>= nVal; - nUserData = OptionsUserData( EID_NUM_MIN_WORDLEN, sal_True, (sal_uInt16)nVal, sal_False, sal_False).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - - const SfxHyphenRegionItem *pHyp = NULL; - sal_uInt16 nWhich = GetWhich( SID_ATTR_HYPHENREGION ); - if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) - pHyp = &( (const SfxHyphenRegionItem &) rSet.Get( nWhich ) ); - - pEntry = CreateEntry( sNumPreBreak, CBCOL_SECOND ); - aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_LEADING) ) >>= nVal; - if (pHyp) - nVal = (sal_Int16) pHyp->GetMinLead(); - nUserData = OptionsUserData( EID_NUM_PRE_BREAK, sal_True, (sal_uInt16)nVal, sal_False, sal_False).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - - pEntry = CreateEntry( sNumPostBreak, CBCOL_SECOND ); - aLngCfg.GetProperty( C2U(UPN_HYPH_MIN_TRAILING) ) >>= nVal; - if (pHyp) - nVal = (sal_Int16) pHyp->GetMinTrail(); - nUserData = OptionsUserData( EID_NUM_POST_BREAK, sal_True, (sal_uInt16)nVal, sal_False, sal_False).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - - pEntry = CreateEntry( sHyphAuto, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_HYPH_AUTO) ) >>= bVal; - nUserData = OptionsUserData( EID_HYPH_AUTO, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - pEntry = CreateEntry( sHyphSpecial, CBCOL_FIRST ); - aLngCfg.GetProperty( C2U(UPN_IS_HYPH_SPECIAL) ) >>= bVal; - nUserData = OptionsUserData( EID_HYPH_SPECIAL, sal_False, 0, sal_True, bVal).GetUserData(); - pEntry->SetUserData( (void *)nUserData ); - pModel->Insert( pEntry ); - lcl_SetCheckButton( pEntry, bVal ); - - aLinguOptionsCLB.SetUpdateMode(sal_True); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, BoxDoubleClickHdl_Impl, SvTreeListBox *, pBox ) -{ - if (pBox == &aLinguModulesCLB) - { - //! in order to avoid a bug causing a GPF when double clicking - //! on a module entry and exiting the "Edit Modules" dialog - //! after that. - Application::PostUserEvent( LINK( - this, SvxLinguTabPage, PostDblClickHdl_Impl ) ); - } - else if (pBox == &aLinguOptionsCLB) - { - ClickHdl_Impl(&aLinguOptionsEditPB); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, PostDblClickHdl_Impl, SvTreeListBox *, EMPTYARG ) -{ - ClickHdl_Impl(&aLinguModulesEditPB); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG ) -{ - ::rtl::OUString sURL( aMoreDictsLink.GetURL() ); - lcl_OpenURL( sURL ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox ) -{ - if (pBox == &aLinguModulesCLB) - { - DBG_ASSERT( pLinguData, "NULL pointer, LinguData missing" ); - sal_uInt16 nPos = aLinguModulesCLB.GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND && pLinguData) - { - pLinguData->Reconfigure( aLinguModulesCLB.GetText( nPos ), - aLinguModulesCLB.IsChecked( nPos ) ); - } - } - else if (pBox == &aLinguDicsCLB) - { - sal_uInt16 nPos = aLinguDicsCLB.GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - const uno::Reference< XDictionary > &rDic = aDics.getConstArray()[ nPos ]; - if (SvxGetIgnoreAllList() == rDic) - { - SvLBoxEntry* pEntry = aLinguDicsCLB.GetEntry( nPos ); - if (pEntry) - lcl_SetCheckButton( pEntry, sal_True ); - } - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn ) -{ - if (&aLinguModulesEditPB == pBtn) - { - if (!pLinguData) - pLinguData = new SvxLinguData_Impl; - - SvxLinguData_Impl aOldLinguData( *pLinguData ); - SvxEditModulesDlg aDlg( this, *pLinguData ); - if (aDlg.Execute() != RET_OK) - *pLinguData = aOldLinguData; - - // evaluate new status of 'bConfigured' flag - sal_uLong nLen = pLinguData->GetDisplayServiceCount(); - for (sal_uLong i = 0; i < nLen; ++i) - pLinguData->GetDisplayServiceArray()[i].bConfigured = sal_False; - const Locale* pAllLocales = pLinguData->GetAllSupportedLocales().getConstArray(); - sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength(); - for (sal_Int32 k = 0; k < nLocales; ++k) - { - sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[k] ); - if (pLinguData->GetSpellTable().count( nLang )) - pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] ); - if (pLinguData->GetGrammarTable().count( nLang )) - pLinguData->SetChecked( pLinguData->GetGrammarTable()[ nLang ] ); - if (pLinguData->GetHyphTable().count( nLang )) - pLinguData->SetChecked( pLinguData->GetHyphTable()[ nLang ] ); - if (pLinguData->GetThesTable().count( nLang )) - pLinguData->SetChecked( pLinguData->GetThesTable()[ nLang ] ); - } - - // show new status of modules - UpdateModulesBox_Impl(); - } - else if (&aLinguDicsNewPB == pBtn) - { - uno::Reference< XSpellChecker1 > xSpellChecker1; - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - AbstractSvxNewDictionaryDialog* aDlg = pFact->CreateSvxNewDictionaryDialog( this, xSpellChecker1, RID_SFXDLG_NEWDICT ); - DBG_ASSERT(aDlg, "Dialogdiet fail!"); - uno::Reference< XDictionary > xNewDic; - if ( aDlg->Execute() == RET_OK ) - xNewDic = uno::Reference< XDictionary >( aDlg->GetNewDictionary(), UNO_QUERY ); - if ( xNewDic.is() ) - { - // add new dics to the end - sal_Int32 nLen = aDics.getLength(); - aDics.realloc( nLen + 1 ); - - aDics.getArray()[ nLen ] = xNewDic; - - AddDicBoxEntry( xNewDic, (sal_uInt16) nLen ); - } - delete aDlg; - } - } - else if (&aLinguDicsEditPB == pBtn) - { - SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry(); - if (pEntry) - { - DicUserData aData( (sal_uLong) pEntry->GetUserData() ); - sal_uInt16 nDicPos = aData.GetEntryId(); - sal_Int32 nDics = aDics.getLength(); - if (nDicPos < nDics) - { - uno::Reference< XDictionary > xDic; - xDic = aDics.getConstArray()[ nDicPos ]; - if (xDic.is()) - { - uno::Reference< XSpellChecker1 > xSpellChecker1; - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - VclAbstractDialog* aDlg = pFact->CreateSvxEditDictionaryDialog( this, xDic->getName(), xSpellChecker1, RID_SFXDLG_EDITDICT ); - DBG_ASSERT(aDlg, "Dialogdiet fail!"); - aDlg->Execute(); - delete aDlg; - } - } - } - } - } - else if (&aLinguDicsDelPB == pBtn) - { - if ( RET_NO == - QueryBox( this, CUI_RES( RID_SFXQB_DELDICT ) ).Execute() ) - return 0; - - SvLBoxEntry *pEntry = aLinguDicsCLB.GetCurEntry(); - if (pEntry) - { - DicUserData aData( (sal_uLong) pEntry->GetUserData() ); - sal_uInt16 nDicPos = aData.GetEntryId(); - sal_Int32 nDics = aDics.getLength(); - if (nDicPos < nDics) - { - uno::Reference< XDictionary > xDic; - xDic = aDics.getConstArray()[ nDicPos ]; - if (xDic.is()) - { - if (SvxGetIgnoreAllList() == xDic) - xDic->clear(); - else - { - if (xDicList.is()) - xDicList->removeDictionary( xDic ); - - uno::Reference< frame::XStorable > xStor( xDic, UNO_QUERY ); - if ( xStor->hasLocation() && !xStor->isReadonly() ) - { - String sURL = xStor->getLocation(); - INetURLObject aObj(sURL); - DBG_ASSERT( aObj.GetProtocol() == INET_PROT_FILE, - "non-file URLs cannot be deleted" ); - if ( aObj.GetProtocol() == INET_PROT_FILE ) - { - KillFile_Impl( aObj.GetMainURL( INetURLObject::NO_DECODE ) ); - } - } - - aDics.getArray()[ nDicPos ] = 0; - - // remove entry from checklistbox - sal_uLong nCnt = aLinguDicsCLB.GetEntryCount(); - for (sal_uLong i = 0; i < nCnt; ++i) - { - SvLBoxEntry *pDicEntry = aLinguDicsCLB.GetEntry( i ); - DBG_ASSERT( pDicEntry, "missing entry" ); - if (pDicEntry) - { - DicUserData aDicData( (sal_uLong) pDicEntry->GetUserData() ); - if (aDicData.GetEntryId() == nDicPos ) - { - aLinguDicsCLB.RemoveEntry( (sal_uInt16) i ); - break; - } - } - } - DBG_ASSERT( nCnt > aLinguDicsCLB.GetEntryCount(), - "remove failed ?"); - } - } - } - } - } - else if (&aLinguOptionsEditPB == pBtn) - { - SvLBoxEntry *pEntry = aLinguOptionsCLB.GetCurEntry(); - DBG_ASSERT( pEntry, "no entry selected" ); - if (pEntry) - { - OptionsUserData aData( (sal_uLong)pEntry->GetUserData() ); - if(aData.HasNumericValue()) - { - int nRID = -1; - switch (aData.GetEntryId()) - { - case EID_NUM_PRE_BREAK : nRID = STR_NUM_PRE_BREAK_DLG; break; - case EID_NUM_POST_BREAK : nRID = STR_NUM_POST_BREAK_DLG; break; - case EID_NUM_MIN_WORDLEN: nRID = STR_NUM_MIN_WORDLEN_DLG; break; - default: - OSL_FAIL( "unexpected case" ); - } - - OptionsBreakSet aDlg( this, nRID ); - aDlg.GetNumericFld().SetValue( aData.GetNumericValue() ); - if (RET_OK == aDlg.Execute() ) - { - long nVal = static_cast(aDlg.GetNumericFld().GetValue()); - if (-1 != nVal && aData.GetNumericValue() != nVal) - { - aData.SetNumericValue( (sal_uInt8)nVal ); //! sets IsModified ! - pEntry->SetUserData( (void *) aData.GetUserData() ); - aLinguOptionsCLB.Invalidate(); - } - } - } - } - } - else - { - OSL_FAIL( "pBtn unexpected value" ); - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLinguTabPage, SelectHdl_Impl, SvxCheckListBox *, pBox ) -{ - if (&aLinguModulesCLB == pBox) - { - } - else if (&aLinguDicsCLB == pBox) - { - SvLBoxEntry *pEntry = pBox->GetCurEntry(); - if (pEntry) - { - DicUserData aData( (sal_uLong) pEntry->GetUserData() ); - - // always allow to edit (i.e. at least view the content of the dictionary) - aLinguDicsEditPB.Enable( true/*aData.IsEditable()*/ ); - aLinguDicsDelPB .Enable( aData.IsDeletable() ); - } - } - else if (&aLinguOptionsCLB == pBox) - { - SvLBoxEntry *pEntry = pBox->GetCurEntry(); - if (pEntry) - { - OptionsUserData aData( (sal_uLong) pEntry->GetUserData() ); - aLinguOptionsEditPB.Enable( aData.HasNumericValue() ); - } - } - else - { - OSL_FAIL( "pBox unexpected value" ); - } - - return 0; -} - -// ----------------------------------------------------------------------- - -SvLBoxEntry* SvxLinguTabPage::CreateEntry( String& rTxt, sal_uInt16 nCol ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if( !pCheckButtonData ) - pCheckButtonData = new SvLBoxButtonData( &aLinguOptionsCLB ); - - String sEmpty; - if (CBCOL_FIRST == nCol) - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - if (CBCOL_SECOND == nCol) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - pEntry->AddItem( new BrwString_Impl( pEntry, 0, rTxt ) ); - - return pEntry; -} - -// ----------------------------------------------------------------------- - -void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp ) -{ - if ( 0 != ( GROUP_MODULES & nGrp ) ) - { - aLinguModulesFT.Hide(); - aLinguModulesCLB.Hide(); - aLinguModulesEditPB.Hide(); - - // reposition / resize remaining controls - long nDeltaY = aLinguDicsFT.GetPosPixel().Y() - - aLinguModulesFT.GetPosPixel().Y(); - DBG_ASSERT( nDeltaY >= 0, "move/resize value is negative" ); - Point aPos; - - aPos = aLinguDicsFT.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguDicsFT.SetPosPixel( aPos ); - aPos = aLinguDicsCLB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguDicsCLB.SetPosPixel( aPos ); - aPos = aLinguDicsNewPB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguDicsNewPB.SetPosPixel( aPos ); - aPos = aLinguDicsEditPB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguDicsEditPB.SetPosPixel( aPos ); - aPos = aLinguDicsDelPB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguDicsDelPB.SetPosPixel( aPos ); - - aPos = aLinguOptionsFT.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguOptionsFT.SetPosPixel( aPos ); - aPos = aLinguOptionsCLB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguOptionsCLB.SetPosPixel( aPos ); - aPos = aLinguOptionsEditPB.GetPosPixel(); - aPos.Y() -= nDeltaY; - aLinguOptionsEditPB.SetPosPixel( aPos ); - - Size aSize( aLinguOptionsCLB.GetSizePixel() ); - aSize.Height() += nDeltaY; - aLinguOptionsCLB.SetSizePixel( aSize ); - - if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() - != SvtExtendedSecurityOptions::OPEN_NEVER ) - { - aSize = GetOutputSizePixel(); - aSize.Height() += ( aMoreDictsLink.GetSizePixel().Height() * 11 / 8 ); - SetSizePixel( aSize ); - aMoreDictsLink.Show(); - } - } -} - -SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData) : - ModalDialog( pParent, CUI_RES(RID_SVXDLG_EDIT_MODULES ) ), - aModulesFL ( this, CUI_RES( FL_EDIT_MODULES_OPTIONS ) ), - aLanguageFT ( this, CUI_RES( FT_EDIT_MODULES_LANGUAGE ) ), - aLanguageLB ( this, CUI_RES( LB_EDIT_MODULES_LANGUAGE ), sal_False ), - aModulesCLB ( this, CUI_RES( CLB_EDIT_MODULES_MODULES ) ), - aPrioUpPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_UP ) ), - aPrioDownPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_DOWN ) ), - aBackPB ( this, CUI_RES( PB_EDIT_MODULES_PRIO_BACK ) ), - aMoreDictsLink ( this, CUI_RES( FT_EDIT_MODULES_NEWDICTSLINK ) ), - aButtonsFL ( this, CUI_RES( FL_EDIT_MODULES_BUTTONS ) ), - aHelpPB ( this, CUI_RES( PB_HELP ) ), - aClosePB ( this, CUI_RES( PB_OK ) ), - sSpell ( CUI_RES( ST_SPELL ) ), - sHyph ( CUI_RES( ST_HYPH ) ), - sThes ( CUI_RES( ST_THES ) ), - sGrammar ( CUI_RES( ST_GRAMMAR ) ), - rLinguData ( rData ) -{ - pCheckButtonData = NULL; - FreeResource(); - - pDefaultLinguData = new SvxLinguData_Impl( rLinguData ); - - aModulesCLB.SetStyle( aModulesCLB.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); - aModulesCLB.SetHighlightRange(); - aModulesCLB.SetHelpId(HID_CLB_EDIT_MODULES_MODULES ); - aModulesCLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, SelectHdl_Impl )); - aModulesCLB.SetCheckButtonHdl( LINK( this, SvxEditModulesDlg, BoxCheckButtonHdl_Impl) ); - - aClosePB .SetClickHdl( LINK( this, SvxEditModulesDlg, ClickHdl_Impl )); - aPrioUpPB .SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl )); - aPrioDownPB.SetClickHdl( LINK( this, SvxEditModulesDlg, UpDownHdl_Impl )); - aBackPB .SetClickHdl( LINK( this, SvxEditModulesDlg, BackHdl_Impl )); - // in case of not installed language modules - aPrioUpPB .Enable( sal_False ); - aPrioDownPB.Enable( sal_False ); - - if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() - != SvtExtendedSecurityOptions::OPEN_NEVER ) - { - aMoreDictsLink.SetURL( String( - RTL_CONSTASCII_USTRINGPARAM( "http://extensions.libreoffice.org/dictionary/" ) ) ); - aMoreDictsLink.SetClickHdl( LINK( this, SvxEditModulesDlg, OpenURLHdl_Impl ) ); - } - else - { - aMoreDictsLink.Hide(); - long nPos = aMoreDictsLink.GetPosPixel().Y() + aMoreDictsLink.GetSizePixel().Height(); - Size aSize = aModulesCLB.GetSizePixel(); - aSize.Height() += ( nPos - ( aModulesCLB.GetPosPixel().Y() + aSize.Height() ) ); - aModulesCLB.SetSizePixel( aSize ); - } - - // - //fill language box - // - Sequence< sal_Int16 > aAvailLang; - uno::Reference< XAvailableLocales > xAvail( rLinguData.GetManager(), UNO_QUERY ); - if (xAvail.is()) - { - aAvailLang = lcl_LocaleSeqToLangSeq( - xAvail->getAvailableLocales( C2U(cSpell) ) ); - } - const Sequence< Locale >& rLoc = rLinguData.GetAllSupportedLocales(); - const Locale* pLocales = rLoc.getConstArray(); - aLanguageLB.Clear(); - for(long i = 0; i < rLoc.getLength(); i++) - { - sal_Int16 nLang = SvxLocaleToLanguage( pLocales[i] ); - aLanguageLB.InsertLanguage( nLang, lcl_SeqHasLang( aAvailLang, nLang ) ); - } - LanguageType eSysLang = MsLangId::getSystemLanguage(); - aLanguageLB.SelectLanguage( eSysLang ); - if(!aLanguageLB.IsLanguageSelected( eSysLang ) ) - aLanguageLB.SelectEntryPos(0); - - aLanguageLB.SetSelectHdl( LINK( this, SvxEditModulesDlg, LangSelectHdl_Impl )); - LangSelectHdl_Impl(&aLanguageLB); -} - - -SvxEditModulesDlg::~SvxEditModulesDlg() -{ - delete pDefaultLinguData; -} - - -SvLBoxEntry* SvxEditModulesDlg::CreateEntry( String& rTxt, sal_uInt16 nCol ) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - if( !pCheckButtonData ) - { - pCheckButtonData = new SvLBoxButtonData( &aModulesCLB ); - pCheckButtonData->SetLink( aModulesCLB.GetCheckButtonHdl() ); - } - - String sEmpty; - if (CBCOL_FIRST == nCol) - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - if (CBCOL_SECOND == nCol) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - pEntry->AddItem( new BrwStringDic_Impl( pEntry, 0, rTxt ) ); - - return pEntry; -} - -IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, SvxCheckListBox *, pBox ) -{ - if (&aModulesCLB == pBox) - { - sal_Bool bDisableUp = sal_True; - sal_Bool bDisableDown = sal_True; - SvLBoxEntry *pEntry = pBox->GetCurEntry(); - if (pEntry) - { - ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData(); - if(!pData->IsParent() && pData->GetType() != TYPE_HYPH) - { - sal_uInt16 nCurPos = pBox->GetSelectEntryPos(); - if(nCurPos < pBox->GetEntryCount() - 1) - { - bDisableDown = ((ModuleUserData_Impl*)pBox-> - GetEntry(nCurPos + 1)->GetUserData())->IsParent(); - } - if(nCurPos > 1) - { - bDisableUp = ((ModuleUserData_Impl*)pBox-> - GetEntry(nCurPos - 1)->GetUserData())->IsParent(); - } - } - aPrioUpPB.Enable(!bDisableUp); - aPrioDownPB.Enable(!bDisableDown); - } - } - else - { - OSL_FAIL( "pBox unexpected value" ); - } - - return 0; -} - -IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox ) -{ - pBox = &aModulesCLB; - SvLBoxEntry *pCurEntry = pBox->GetCurEntry(); - if (pCurEntry) - { - ModuleUserData_Impl* pData = (ModuleUserData_Impl *) - pCurEntry->GetUserData(); - if (!pData->IsParent() && pData->GetType() == TYPE_HYPH) - { - // make hyphenator checkboxes function as radio-buttons - // (at most one box may be checked) - SvLBoxEntry *pEntry = pBox->First(); - while (pEntry) - { - pData = (ModuleUserData_Impl *) pEntry->GetUserData(); - if (!pData->IsParent() && - pData->GetType() == TYPE_HYPH && - pEntry != pCurEntry) - { - lcl_SetCheckButton( pEntry, sal_False ); - pBox->InvalidateEntry( pEntry ); - } - pEntry = pBox->Next( pEntry ); - } - } - } - return 0; -} - -OUString lcl_GetServiceName(sal_uInt8 nType) -{ - switch(nType) - { - case TYPE_SPELL : return C2U(cSpell); - case TYPE_GRAMMAR : return C2U(cGrammar); - case TYPE_HYPH : return C2U(cHyph); - case TYPE_THES : return C2U(cThes); - } - return OUString(); -} - - -IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox ) -{ - LanguageType eCurLanguage = aLanguageLB.GetSelectLanguage(); - static Locale aLastLocale; - Locale aCurLocale; - SvxLanguageToLocale(aCurLocale, eCurLanguage); - SvLBoxTreeList *pModel = aModulesCLB.GetModel(); - - if (pBox) - { - // save old probably changed settings - // before switching to new language entries - - sal_Int16 nLang = SvxLocaleToLanguage( aLastLocale ); - - sal_Int32 nStart = 0, nLocalIndex = 0; - Sequence< OUString > aChange; - sal_Bool bChanged = sal_False; - for(sal_uInt16 i = 0; i < aModulesCLB.GetEntryCount(); i++) - { - SvLBoxEntry *pEntry = aModulesCLB.GetEntry(i); - ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData(); - if(pData->IsParent()) - { - if(bChanged) - { - LangImplNameTable *pTable = 0; - sal_uInt8 nType = pData->GetType(); - switch (nType - 1) - { - case TYPE_SPELL : pTable = &rLinguData.GetSpellTable(); break; - case TYPE_GRAMMAR : pTable = &rLinguData.GetGrammarTable(); break; - case TYPE_HYPH : pTable = &rLinguData.GetHyphTable(); break; - case TYPE_THES : pTable = &rLinguData.GetThesTable(); break; - } - if (pTable) - { - aChange.realloc(nStart); - (*pTable)[ nLang ] = aChange; - } - } - nLocalIndex = nStart = 0; - aChange.realloc(aModulesCLB.GetEntryCount()); - bChanged = sal_False; - } - else - { - OUString* pChange = aChange.getArray(); - pChange[nStart] = pData->GetImplName(); - bChanged |= pData->GetIndex() != nLocalIndex || - pData->IsChecked() != aModulesCLB.IsChecked(i); - if(aModulesCLB.IsChecked(i)) - nStart++; - ++nLocalIndex; - } - } - if(bChanged) - { - aChange.realloc(nStart); - rLinguData.GetThesTable()[ nLang ] = aChange; - } - } - - for(sal_uLong i = 0; i < aModulesCLB.GetEntryCount(); i++) - delete (ModuleUserData_Impl*)aModulesCLB.GetEntry(i)->GetUserData(); - - // - // display entries for new selected language - // - aModulesCLB.Clear(); - if(LANGUAGE_DONTKNOW != eCurLanguage) - { - sal_uLong n; - ServiceInfo_Impl* pInfo; - - // - // spellchecker entries - // - SvLBoxEntry* pEntry = CreateEntry( sSpell, CBCOL_SECOND ); - ModuleUserData_Impl* pUserData = new ModuleUserData_Impl( - String(), sal_True, sal_False, TYPE_SPELL, 0 ); - pEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pEntry ); - - Sequence< OUString > aNames( rLinguData.GetSortedImplNames( eCurLanguage, TYPE_SPELL ) ); - const OUString *pName = aNames.getConstArray(); - sal_uLong nNames = (sal_uLong) aNames.getLength(); - sal_Int32 nLocalIndex = 0; // index relative to parent - for (n = 0; n < nNames; ++n) - { - OUString aImplName; - sal_Bool bIsSuppLang = sal_False; - - pInfo = rLinguData.GetInfoByImplName( pName[n] ); - if (pInfo) - { - bIsSuppLang = pInfo->xSpell.is() && - pInfo->xSpell->hasLocale( aCurLocale ); - aImplName = pInfo->sSpellImplName; - } - if (aImplName.getLength() && bIsSuppLang) - { - String aTxt( pInfo->sDisplayName ); - SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST ); - - LangImplNameTable &rTable = rLinguData.GetSpellTable(); - const bool bHasLang = rTable.count( eCurLanguage ); - if (!bHasLang) - { - DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported - } - const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; - lcl_SetCheckButton( pNewEntry, bCheck ); - pUserData = new ModuleUserData_Impl( aImplName, sal_False, - bCheck, TYPE_SPELL, (sal_uInt8)nLocalIndex++ ); - pNewEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pNewEntry ); - } - } - - // - // grammar checker entries - // - pEntry = CreateEntry( sGrammar, CBCOL_SECOND ); - pUserData = new ModuleUserData_Impl( String(), sal_True, sal_False, TYPE_GRAMMAR, 0 ); - pEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pEntry ); - - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_GRAMMAR ); - pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); - nLocalIndex = 0; - for (n = 0; n < nNames; ++n) - { - OUString aImplName; - sal_Bool bIsSuppLang = sal_False; - - pInfo = rLinguData.GetInfoByImplName( pName[n] ); - if (pInfo) - { - bIsSuppLang = pInfo->xGrammar.is() && - pInfo->xGrammar->hasLocale( aCurLocale ); - aImplName = pInfo->sGrammarImplName; - } - if (aImplName.getLength() && bIsSuppLang) - { - String aTxt( pInfo->sDisplayName ); - SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST ); - - LangImplNameTable &rTable = rLinguData.GetGrammarTable(); - const bool bHasLang = rTable.count( eCurLanguage ); - if (!bHasLang) - { - DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported - } - const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; - lcl_SetCheckButton( pNewEntry, bCheck ); - pUserData = new ModuleUserData_Impl( aImplName, sal_False, - bCheck, TYPE_GRAMMAR, (sal_uInt8)nLocalIndex++ ); - pNewEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pNewEntry ); - } - } - - // - // hyphenator entries - // - pEntry = CreateEntry( sHyph, CBCOL_SECOND ); - pUserData = new ModuleUserData_Impl( String(), sal_True, sal_False, TYPE_HYPH, 0 ); - pEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pEntry ); - - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_HYPH ); - pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); - nLocalIndex = 0; - for (n = 0; n < nNames; ++n) - { - OUString aImplName; - sal_Bool bIsSuppLang = sal_False; - - pInfo = rLinguData.GetInfoByImplName( pName[n] ); - if (pInfo) - { - bIsSuppLang = pInfo->xHyph.is() && - pInfo->xHyph->hasLocale( aCurLocale ); - aImplName = pInfo->sHyphImplName; - } - if (aImplName.getLength() && bIsSuppLang) - { - String aTxt( pInfo->sDisplayName ); - SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST ); - - LangImplNameTable &rTable = rLinguData.GetHyphTable(); - const bool bHasLang = rTable.count( eCurLanguage ); - if (!bHasLang) - { - DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported - } - const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; - lcl_SetCheckButton( pNewEntry, bCheck ); - pUserData = new ModuleUserData_Impl( aImplName, sal_False, - bCheck, TYPE_HYPH, (sal_uInt8)nLocalIndex++ ); - pNewEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pNewEntry ); - } - } - - // - // thesaurus entries - // - pEntry = CreateEntry( sThes, CBCOL_SECOND ); - pUserData = new ModuleUserData_Impl( String(), sal_True, sal_False, TYPE_THES, 0 ); - pEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pEntry ); - - aNames = rLinguData.GetSortedImplNames( eCurLanguage, TYPE_THES ); - pName = aNames.getConstArray(); - nNames = (sal_uLong) aNames.getLength(); - nLocalIndex = 0; - for (n = 0; n < nNames; ++n) - { - OUString aImplName; - sal_Bool bIsSuppLang = sal_False; - - pInfo = rLinguData.GetInfoByImplName( pName[n] ); - if (pInfo) - { - bIsSuppLang = pInfo->xThes.is() && - pInfo->xThes->hasLocale( aCurLocale ); - aImplName = pInfo->sThesImplName; - } - if (aImplName.getLength() && bIsSuppLang) - { - String aTxt( pInfo->sDisplayName ); - SvLBoxEntry* pNewEntry = CreateEntry( aTxt, CBCOL_FIRST ); - - LangImplNameTable &rTable = rLinguData.GetThesTable(); - const bool bHasLang = rTable.count( eCurLanguage ); - if (!bHasLang) - { - DBG_WARNING( "language entry missing" ); // only relevant if all languages found should be supported - } - const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ eCurLanguage ], aImplName ) >= 0; - lcl_SetCheckButton( pNewEntry, bCheck ); - pUserData = new ModuleUserData_Impl( aImplName, sal_False, - bCheck, TYPE_THES, (sal_uInt8)nLocalIndex++ ); - pNewEntry->SetUserData( (void *)pUserData ); - pModel->Insert( pNewEntry ); - } - } - } - aLastLocale.Language = aCurLocale.Language; - aLastLocale.Country = aCurLocale.Country; - return 0; -} - -IMPL_LINK( SvxEditModulesDlg, UpDownHdl_Impl, PushButton *, pBtn ) -{ - sal_Bool bUp = &aPrioUpPB == pBtn; - sal_uInt16 nCurPos = aModulesCLB.GetSelectEntryPos(); - SvLBoxEntry* pEntry; - if (nCurPos != LISTBOX_ENTRY_NOTFOUND && - 0 != (pEntry = aModulesCLB.GetEntry(nCurPos))) - { - aModulesCLB.SetUpdateMode(sal_False); - SvLBoxTreeList *pModel = aModulesCLB.GetModel(); - - ModuleUserData_Impl* pData = (ModuleUserData_Impl*)pEntry->GetUserData(); - String aStr(aModulesCLB.GetEntryText(pEntry)); - SvLBoxEntry* pToInsert = CreateEntry( aStr, CBCOL_FIRST ); - pToInsert->SetUserData( (void *)pData); - sal_Bool bIsChecked = aModulesCLB.IsChecked(nCurPos); - - pModel->Remove(pEntry); - - sal_uInt16 nDestPos = bUp ? nCurPos - 1 : nCurPos + 1; - pModel->Insert(pToInsert, nDestPos); - aModulesCLB.CheckEntryPos(nDestPos, bIsChecked ); - aModulesCLB.SelectEntryPos(nDestPos ); - SelectHdl_Impl(&aModulesCLB); - aModulesCLB.SetUpdateMode(sal_True); - } - return 0; -} - -IMPL_LINK( SvxEditModulesDlg, ClickHdl_Impl, PushButton *, pBtn ) -{ - if (&aClosePB == pBtn) - { - // store language config - LangSelectHdl_Impl(&aLanguageLB); - EndDialog( RET_OK ); - } - else - { - OSL_FAIL( "pBtn unexpected value" ); - } - - return 0; -} - -IMPL_LINK( SvxEditModulesDlg, BackHdl_Impl, PushButton *, EMPTYARG ) -{ - rLinguData = *pDefaultLinguData; - LangSelectHdl_Impl(0); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxEditModulesDlg, OpenURLHdl_Impl, svt::FixedHyperlink *, EMPTYARG ) -{ - ::rtl::OUString sURL( aMoreDictsLink.GetURL() ); - lcl_OpenURL( sURL ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optlingu.hrc b/cui/source/options/optlingu.hrc deleted file mode 100644 index 0a1812351..000000000 --- a/cui/source/options/optlingu.hrc +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// defines --------------------------------------------------------------- - -#define FL_LINGUISTIC 101 - -#define FT_LINGU_MODULES 111 -#define CLB_LINGU_MODULES 112 -#define PB_LINGU_MODULES_EDIT 113 - -#define FT_LINGU_OPTIONS 121 -#define CLB_LINGU_OPTIONS 122 -#define PB_LINGU_OPTIONS_EDIT 123 -#define FT_LINGU_OPTIONS_MOREDICTS 124 - -#define STR_CAPITAL_WORDS 201 -#define STR_WORDS_WITH_DIGITS 202 -#define STR_CAPITALIZATION 203 -#define STR_SPELL_SPECIAL 204 -#define STR_SPELL_AUTO 206 -#define STR_NUM_PRE_BREAK 209 -#define STR_NUM_POST_BREAK 210 -#define STR_HYPH_AUTO 211 -#define STR_HYPH_SPECIAL 212 -#define STR_NUM_MIN_WORDLEN 213 - -#define STR_NUM_PRE_BREAK_DLG 214 -#define STR_NUM_POST_BREAK_DLG 215 -#define STR_NUM_MIN_WORDLEN_DLG 216 - -#define STR_GRAMMAR_AUTO 217 - -#define STR_WARNING 63 - -#define PB_OK 70 -#define PB_HELP 72 - -#define ST_SPELL 82 -#define ST_HYPH 83 -#define ST_THES 84 -#define ST_GRAMMAR 85 - -#define FL_NUMVAL_PREBREAK 305 -#define BT_OK_PREBREAK 306 -#define BT_CANCEL_PREBREAK 307 -#define ED_PREBREAK 308 -#define PB_EDIT_MODULES_PRIO_UP 309 -#define PB_EDIT_MODULES_PRIO_DOWN 310 -#define PB_EDIT_MODULES_PRIO_BACK 311 - -#define FT_LINGU_DICS 312 -#define CLB_LINGU_DICS 313 -#define PB_LINGU_DICS_NEW_DIC 314 -#define PB_LINGU_DICS_EDIT_DIC 315 -#define PB_LINGU_DICS_DEL_DIC 316 - -#define FL_EDIT_MODULES_OPTIONS 317 -#define FT_EDIT_MODULES_LANGUAGE 318 -#define LB_EDIT_MODULES_LANGUAGE 319 -#define CLB_EDIT_MODULES_MODULES 320 -#define FT_EDIT_MODULES_NEWDICTSLINK 321 -#define FL_EDIT_MODULES_BUTTONS 322 -// IAccessibility2 implementation 2009. ------ -#define STR_LINGU_MODULES_EDIT 323 -#define STR_LINGU_DICS_EDIT_DIC 324 -#define STR_LINGU_OPTIONS_EDIT 325 -// ------ IAccessibility2 implementation 2009. diff --git a/cui/source/options/optlingu.src b/cui/source/options/optlingu.src deleted file mode 100644 index a4e0f312c..000000000 --- a/cui/source/options/optlingu.src +++ /dev/null @@ -1,370 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include ------------------------------------------------------------------ - -#include "optlingu.hrc" -#include "helpid.hrc" - -#include -#include -#include - -// RID_SVXDLG_EDIT_MODULES --------------------------------------------------- - -ModalDialog RID_SVXDLG_EDIT_MODULES -{ - HelpID = HID_EDIT_MODULES ; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 240 , 197 ) ; - Text [ en-US ] = "Edit Modules"; - - FixedLine FL_EDIT_MODULES_OPTIONS - { - Pos = MAP_APPFONT ( RSC_SP_FLGR_INNERBORDER_LEFT , RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 240 - 2*RSC_SP_FLGR_INNERBORDER_LEFT , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Options"; - }; - FixedText FT_EDIT_MODULES_LANGUAGE - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 68 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Language"; - }; - ListBox LB_EDIT_MODULES_LANGUAGE - { - HelpID = "cui:ListBox:RID_SVXDLG_EDIT_MODULES:LB_EDIT_MODULES_LANGUAGE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 83 , 14 ) ; - Size = MAP_APPFONT ( 95 , 80 ) ; - DropDown = TRUE ; - Sort = TRUE ; - }; - Control CLB_EDIT_MODULES_MODULES - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 166 , 120 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_EDIT_MODULES_PRIO_UP - { - HelpID = "cui:PushButton:RID_SVXDLG_EDIT_MODULES:PB_EDIT_MODULES_PRIO_UP"; - Pos = MAP_APPFONT ( 184 , 32 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "Move Up"; - }; - PushButton PB_EDIT_MODULES_PRIO_DOWN - { - HelpID = "cui:PushButton:RID_SVXDLG_EDIT_MODULES:PB_EDIT_MODULES_PRIO_DOWN"; - Pos = MAP_APPFONT ( 184 , 49 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "Move Down"; - }; - PushButton PB_EDIT_MODULES_PRIO_BACK - { - HelpID = "cui:PushButton:RID_SVXDLG_EDIT_MODULES:PB_EDIT_MODULES_PRIO_BACK"; - Pos = MAP_APPFONT ( 184 , 66 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Back"; - }; - FixedText FT_EDIT_MODULES_NEWDICTSLINK - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 155 ) ; - Size = MAP_APPFONT ( 169 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "~Get more dictionaries online..."; - }; - FixedLine FL_EDIT_MODULES_BUTTONS - { - Pos = MAP_APPFONT ( 0 , 166 ) ; - Size = MAP_APPFONT ( 240 , RSC_CD_FIXEDLINE_HEIGHT ) ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 12, 177 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 184 , 177 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Close"; - }; - - String ST_SPELL - { - Text [ en-US ] = "Spelling"; - }; - String ST_HYPH - { - Text [ en-US ] = "Hyphenation"; - }; - String ST_THES - { - Text [ en-US ] = "Thesaurus"; - }; - String ST_GRAMMAR - { - Text [ en-US ] = "Grammar"; - }; -}; - -// RID_SVXDLG_LNG_ED_NUM_PREBREAK ------------------------------------------- - -ModalDialog RID_SVXDLG_LNG_ED_NUM_PREBREAK -{ - HelpID = HID_LNGDLG_NUM_PREBREAK ; - SVLook = TRUE ; - Moveable = TRUE ; - Size = MAP_APPFONT ( 155 , 43 ) ; - Text [ en-US ] = "Hyphenation"; - FixedLine FL_NUMVAL_PREBREAK - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 87 , 8 ) ; - }; - OKButton BT_OK_PREBREAK - { - Pos = MAP_APPFONT ( 99 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL_PREBREAK - { - Pos = MAP_APPFONT ( 99 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - NumericField ED_PREBREAK - { - HelpID = "cui:NumericField:RID_SVXDLG_LNG_ED_NUM_PREBREAK:ED_PREBREAK"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 14 ) ; - Size = MAP_APPFONT ( 31 , 12 ) ; - Left = TRUE ; - Minimum = 2 ; - Maximum = 9 ; - Last = 9 ; - Repeat = TRUE ; - Spin = TRUE ; - SpinSize = 1; - }; - String STR_NUM_PRE_BREAK_DLG - { - Text [ en-US ] = "Characters before break"; - }; - String STR_NUM_POST_BREAK_DLG - { - Text [ en-US ] = "Characters after break"; - }; - String STR_NUM_MIN_WORDLEN_DLG - { - Text [ en-US ] = "Minimal word length"; - }; -}; - -// RID_SFXPAGE_LINGU -------------------------------------------------------- - -TabPage RID_SFXPAGE_LINGU -{ - HelpId = HID_OPTIONS_LINGU ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Options"; - FixedLine FL_LINGUISTIC - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Writing aids"; - }; - FixedText FT_LINGU_MODULES - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 175 , 8 ) ; - Text [ en-US ] = "Available language modules"; - }; - Control CLB_LINGU_MODULES - { - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 182 , 30 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_LINGU_MODULES_EDIT - { - HelpID = "cui:PushButton:RID_SFXPAGE_LINGU:PB_LINGU_MODULES_EDIT"; - Pos = MAP_APPFONT ( 198 , 25 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Edit..."; - }; - FixedText FT_LINGU_DICS - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 175 , 8 ) ; - Text [ en-US ] = "User-defined dictionaries"; - }; - Control CLB_LINGU_DICS - { - Pos = MAP_APPFONT ( 12 , 70 ) ; - Size = MAP_APPFONT ( 182 , 48 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_LINGU_DICS_NEW_DIC - { - HelpID = "cui:PushButton:RID_SFXPAGE_LINGU:PB_LINGU_DICS_NEW_DIC"; - Pos = MAP_APPFONT ( 198 , 70 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~New..."; - }; - PushButton PB_LINGU_DICS_EDIT_DIC - { - HelpID = "cui:PushButton:RID_SFXPAGE_LINGU:PB_LINGU_DICS_EDIT_DIC"; - Pos = MAP_APPFONT ( 198 , 87 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Ed~it..."; - }; - PushButton PB_LINGU_DICS_DEL_DIC - { - HelpID = "cui:PushButton:RID_SFXPAGE_LINGU:PB_LINGU_DICS_DEL_DIC"; - Pos = MAP_APPFONT ( 198 , 104 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Delete"; - }; - FixedText FT_LINGU_OPTIONS - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 175 , 8 ) ; - Text [ en-US ] = "~Options"; - }; - Control CLB_LINGU_OPTIONS - { - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 182 , 46 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_LINGU_OPTIONS_EDIT - { - HelpID = "cui:PushButton:RID_SFXPAGE_LINGU:PB_LINGU_OPTIONS_EDIT"; - Pos = MAP_APPFONT ( 198 , 133 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Edi~t..."; - }; - FixedText FT_LINGU_OPTIONS_MOREDICTS - { - Left = TRUE ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 182 ) ; - Size = MAP_APPFONT ( 182 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "~Get more dictionaries online..."; - }; - - String STR_CAPITAL_WORDS - { - Text [ en-US ] = "Check uppercase words"; - }; - String STR_WORDS_WITH_DIGITS - { - Text [ en-US ] = "Check words with numbers "; - }; - String STR_CAPITALIZATION - { - Text [ en-US ] = "Check capitalization"; - }; - String STR_SPELL_SPECIAL - { - Text [ en-US ] = "Check special regions"; - }; - String STR_SPELL_AUTO - { - Text [ en-US ] = "Check spelling as you type"; - }; - String STR_GRAMMAR_AUTO - { - Text [ en-US ] = "Check grammar as you type"; - }; - String STR_NUM_MIN_WORDLEN - { - Text [ en-US ] = "Minimal number of characters for hyphenation: "; - }; - String STR_NUM_PRE_BREAK - { - Text [ en-US ] = "Characters before line break: "; - }; - String STR_NUM_POST_BREAK - { - Text [ en-US ] = "Characters after line break: "; - }; - String STR_HYPH_AUTO - { - Text [ en-US ] = "Hyphenate without inquiry"; - }; - String STR_HYPH_SPECIAL - { - Text [ en-US ] = "Hyphenate special regions"; - }; - String STR_LINGU_MODULES_EDIT - { - Text [ en-US ] = "Edit Available language modules"; - }; - String STR_LINGU_DICS_EDIT_DIC - { - Text [ en-US ] = "Edit User-defined dictionaries"; - }; - String STR_LINGU_OPTIONS_EDIT - { - Text [ en-US ] = "Edit Options"; - }; - // ------ IAccessibility2 implementation 2009. -}; -// end: TabPage RID_SFXPAGE_LINGU - - // RID_SFXQB_DELDICT -------------------------------------------------------- -QueryBox RID_SFXQB_DELDICT -{ - Buttons = WB_YES_NO ; - DefButton = WB_DEF_NO ; - Message [ en-US ] = "Do you want to delete the dictionary?" ; -}; - // ******************************************************************* EOF diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx deleted file mode 100644 index 9fdc7f52e..000000000 --- a/cui/source/options/optmemory.cxx +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuioptgenrl.hxx" -#include "optpath.hxx" -#include "optsave.hxx" -#include "optlingu.hxx" -#include -#include -#include "cuitabarea.hxx" -#include "optmemory.hrc" -#include "optmemory.hxx" -#include -#include -#include "helpid.hrc" -#include - -#define CONFIG_LANGUAGES "OfficeLanguages" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::utl; -using namespace ::rtl; -using namespace ::sfx2; - - -#define NF2BYTES 104857.6 // 2^20/10, used for aNfGraphicObjectCache-unit -> Byte -#define BYTES2NF (1.0/NF2BYTES) // 10/2^20 - - -inline long OfaMemoryOptionsPage::GetNfGraphicCacheVal( void ) const -{ - return static_cast(aNfGraphicCache.GetValue() << 20); -} - -inline void OfaMemoryOptionsPage::SetNfGraphicCacheVal( long nSizeInBytes ) -{ - aNfGraphicCache.SetValue( nSizeInBytes >> 20 ); -} - -long OfaMemoryOptionsPage::GetNfGraphicObjectCacheVal( void ) const -{ - return long( ::rtl::math::round( double( aNfGraphicObjectCache.GetValue() ) * NF2BYTES ) ); -} - -void OfaMemoryOptionsPage::SetNfGraphicObjectCacheVal( long nSizeInBytes ) -{ - aNfGraphicObjectCache.SetValue( long( ::rtl::math::round( double( nSizeInBytes ) * BYTES2NF ) ) ); -} - -inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheMax( long nSizeInBytes ) -{ - aNfGraphicObjectCache.SetMax( long( double( nSizeInBytes ) * BYTES2NF ) ); -} - -inline void OfaMemoryOptionsPage::SetNfGraphicObjectCacheLast( long nSizeInBytes ) -{ - aNfGraphicObjectCache.SetLast( long( double( nSizeInBytes ) * BYTES2NF ) ); -} - -int OfaMemoryOptionsPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -OfaMemoryOptionsPage::OfaMemoryOptionsPage(Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( OFA_TP_MEMORY ), rSet ), - - aUndoBox ( this, CUI_RES( GB_UNDO ) ), - aUndoText ( this, CUI_RES( FT_UNDO ) ), - aUndoEdit ( this, CUI_RES( ED_UNDO ) ), - aGbGraphicCache ( this, CUI_RES( GB_GRAPHICCACHE ) ), - aFtGraphicCache ( this, CUI_RES( FT_GRAPHICCACHE ) ), - aNfGraphicCache ( this, CUI_RES( NF_GRAPHICCACHE ) ), - aFtGraphicCacheUnit ( this, CUI_RES( FT_GRAPHICCACHE_UNIT ) ), - aFtGraphicObjectCache ( this, CUI_RES( FT_GRAPHICOBJECTCACHE ) ), - aNfGraphicObjectCache ( this, CUI_RES( NF_GRAPHICOBJECTCACHE ) ), - aFtGraphicObjectCacheUnit(this, CUI_RES( FT_GRAPHICOBJECTCACHE_UNIT ) ), - aFtGraphicObjectTime ( this, CUI_RES( FT_GRAPHICOBJECTTIME ) ), - aTfGraphicObjectTime ( this, CUI_RES( TF_GRAPHICOBJECTTIME ) ), - aFtGraphicObjectTimeUnit( this, CUI_RES( FT_GRAPHICOBJECTTIME_UNIT ) ), - - aGbOLECache ( this, CUI_RES( GB_OLECACHE ) ), - aFtOLECache ( this, CUI_RES( FT_OLECACHE ) ), - aNfOLECache ( this, CUI_RES( NF_OLECACHE ) ), - aQuickLaunchFL ( this, CUI_RES( FL_QUICKLAUNCH ) ), - aQuickLaunchCB ( this, CUI_RES( CB_QUICKLAUNCH ) )//, -{ -#if defined(UNX) - aQuickLaunchCB.SetText( CUI_RES( STR_QUICKLAUNCH_UNX ) ); -#endif - FreeResource(); - - //quick launch only available in Win -#if !defined(WNT) && !defined(ENABLE_GTK) - aQuickLaunchFL.Hide(); - aQuickLaunchCB.Hide(); -#endif - - aTfGraphicObjectTime.SetExtFormat( EXTTIMEF_24H_SHORT ); - - SetExchangeSupport(); - - aNfGraphicCache.SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) ); -} - -// ----------------------------------------------------------------------- - -OfaMemoryOptionsPage::~OfaMemoryOptionsPage() -{ -} - -// ----------------------------------------------------------------------- - -SfxTabPage* OfaMemoryOptionsPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new OfaMemoryOptionsPage( pParent, rAttrSet ); -} - -// ----------------------------------------------------------------------- - -sal_Bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = sal_False; - - SvtCacheOptions aCacheOptions; - - // Undo-Schritte - if ( aUndoEdit.GetText() != aUndoEdit.GetSavedValue() ) - SvtUndoOptions().SetUndoCount((sal_uInt16)aUndoEdit.GetValue()); - - // GraphicCache - aCacheOptions.SetGraphicManagerTotalCacheSize( GetNfGraphicCacheVal() ); - aCacheOptions.SetGraphicManagerObjectCacheSize( GetNfGraphicObjectCacheVal() ); - - const Time aTime( aTfGraphicObjectTime.GetTime() ); - aCacheOptions.SetGraphicManagerObjectReleaseTime( aTime.GetSec() + aTime.GetMin() * 60 + aTime.GetHour() * 3600 ); - - // create a dummy graphic object to get access to the common GraphicManager - GraphicObject aDummyObject; - GraphicManager& rGrfMgr = aDummyObject.GetGraphicManager(); - - rGrfMgr.SetMaxCacheSize( aCacheOptions.GetGraphicManagerTotalCacheSize() ); - rGrfMgr.SetMaxObjCacheSize( aCacheOptions.GetGraphicManagerObjectCacheSize(), sal_True ); - rGrfMgr.SetCacheTimeout( aCacheOptions.GetGraphicManagerObjectReleaseTime() ); - - // OLECache - aCacheOptions.SetWriterOLE_Objects( static_cast(aNfOLECache.GetValue()) ); - aCacheOptions.SetDrawingEngineOLE_Objects( static_cast(aNfOLECache.GetValue()) ); - - if( aQuickLaunchCB.IsChecked() != aQuickLaunchCB.GetSavedValue()) - { - rSet.Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, aQuickLaunchCB.IsChecked())); - bModified = sal_True; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void OfaMemoryOptionsPage::Reset( const SfxItemSet& rSet ) -{ - SvtCacheOptions aCacheOptions; - const SfxPoolItem* pItem; - - // Undo-Schritte - aUndoEdit.SetValue( SvtUndoOptions().GetUndoCount() ); - aUndoEdit.SaveValue(); - - // GraphicCache - long n = aCacheOptions.GetGraphicManagerTotalCacheSize(); - SetNfGraphicCacheVal( n ); - SetNfGraphicObjectCacheVal( Min( static_cast(GetNfGraphicCacheVal()), aCacheOptions.GetGraphicManagerObjectCacheSize() ) ); - - sal_Int32 nTime = aCacheOptions.GetGraphicManagerObjectReleaseTime(); - Time aTime( (sal_uInt16)( nTime / 3600 ), (sal_uInt16)( ( nTime % 3600 ) / 60 ), (sal_uInt16)( ( nTime % 3600 ) % 60 ) ); - aTfGraphicObjectTime.SetTime( aTime ); - - GraphicCacheConfigHdl( &aNfGraphicCache ); - - // OLECache - aNfOLECache.SetValue( Max( aCacheOptions.GetWriterOLE_Objects(), aCacheOptions.GetDrawingEngineOLE_Objects() ) ); - - SfxItemState eState = rSet.GetItemState( SID_ATTR_QUICKLAUNCHER, sal_False, &pItem ); - if ( SFX_ITEM_SET == eState ) - aQuickLaunchCB.Check( ( (SfxBoolItem*)pItem )->GetValue() ); - else if ( SFX_ITEM_DISABLED == eState ) - { - // quickstart not installed - aQuickLaunchFL.Hide(); - aQuickLaunchCB.Hide(); - } - - aQuickLaunchCB.SaveValue(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( OfaMemoryOptionsPage, GraphicCacheConfigHdl, NumericField*, EMPTYARG ) -{ - long n = GetNfGraphicCacheVal(); - SetNfGraphicObjectCacheMax( n ); - SetNfGraphicObjectCacheLast( n ); - - if( GetNfGraphicObjectCacheVal() > n ) - SetNfGraphicObjectCacheVal( n ); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optmemory.hrc b/cui/source/options/optmemory.hrc deleted file mode 100644 index 134a32126..000000000 --- a/cui/source/options/optmemory.hrc +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_OPTMEMORY_HRC -#define _OFA_OPTMEMORY_HRC - -#include - -// defines for positions and sizes --------------------------------------- - -#define WHOLE_WIDTH 248 - -#define COLSPACE RSC_SP_CTRL_DESC_X -#define COL0 6 -#define COL1 (COL0+6) -#define COL2 (COL1+140) // width text before control -#define COL3 (COL2+COLSPACE) -#define COL4 (COL3+30) // width control -#define COL5 (COL4+COLSPACE) -#define COL6 (WHOLE_WIDTH) // width text after control (unit) - -#define ROWSPACE RSC_SP_CTRL_DESC_Y -#define ROW0 3 -#define ROW1 ( ROW0+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE ) -#define ROW2 ( ROW1+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE ) -#define ROW3 ( ROW2+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE ) -#define ROW4 ( ROW3+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE ) -#define ROW5 ( ROW4+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE ) -#define ROW6 ( ROW5+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE ) -#define ROW7 ( ROW6+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE ) -#define ROW8 ( ROW7+RSC_CD_TEXTBOX_HEIGHT+ROWSPACE ) -#define ROW9 ( ROW8+RSC_CD_FIXEDLINE_HEIGHT+ROWSPACE ) - -#define DIFF(v1,v2) (v2-v1) -#define OFFS_TEXTBOX_FIXEDTEXT(base) (base+(RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2) - -#define WIDTH1 DIFF( COL1, COL2 ) -#define WIDTH2 DIFF( COL3, COL4 ) -#define WIDTH3 DIFF( COL5, COL6 ) -// tabpage memory -------------------------------------------------------- - -#define GB_UNDO 10 -#define FT_UNDO 11 -#define ED_UNDO 12 -#define GB_GRAPHICCACHE 13 -#define FT_GRAPHICCACHE 14 -#define FT_GRAPHICCACHE_UNIT 15 -#define FT_GRAPHICOBJECTCACHE_UNIT 16 -#define FT_GRAPHICOBJECTTIME_UNIT 17 -#define NF_GRAPHICCACHE 18 -#define FT_GRAPHICOBJECTCACHE 19 -#define NF_GRAPHICOBJECTCACHE 20 -#define FT_GRAPHICOBJECTTIME 21 -#define TF_GRAPHICOBJECTTIME 22 -#define GB_OLECACHE 23 -#define FT_OLECACHE 24 -#define NF_OLECACHE 25 -#define FL_QUICKLAUNCH 26 -#define CB_QUICKLAUNCH 27 -#define STR_QUICKLAUNCH_UNX 28 - -#endif // #ifndef _OFA_OPTMEMORY_HRC - diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx deleted file mode 100644 index 0d3062ea3..000000000 --- a/cui/source/options/optmemory.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _OFA_OPTMEMORY_HXX -#define _OFA_OPTMEMORY_HXX - -#include -#include -#include -#include -#include -#include -#define FOLDERWEBVIEW_DEFAULTFILE "folder.so" - -// class OfaMiscTabPage -------------------------------------------------- - -class OfaMemoryOptionsPage : public SfxTabPage -{ - using SfxTabPage::DeactivatePage; -private: - FixedLine aUndoBox; - FixedText aUndoText; - NumericField aUndoEdit; - - FixedLine aGbGraphicCache; - FixedText aFtGraphicCache; - NumericField aNfGraphicCache; - FixedText aFtGraphicCacheUnit; - FixedText aFtGraphicObjectCache; - NumericField aNfGraphicObjectCache; - FixedText aFtGraphicObjectCacheUnit; - FixedText aFtGraphicObjectTime; - TimeField aTfGraphicObjectTime; - FixedText aFtGraphicObjectTimeUnit; - - FixedLine aGbOLECache; - FixedText aFtOLECache; - NumericField aNfOLECache; - - FixedLine aQuickLaunchFL; - CheckBox aQuickLaunchCB; - - DECL_LINK( GraphicCacheConfigHdl, NumericField* ); - - inline long GetNfGraphicCacheVal( void ) const; // returns # of Bytes - inline void SetNfGraphicCacheVal( long nSizeInBytes ); - - long GetNfGraphicObjectCacheVal( void ) const; // returns # of Bytes - void SetNfGraphicObjectCacheVal( long nSizeInBytes ); - inline void SetNfGraphicObjectCacheMax( long nSizeInBytes ); - inline void SetNfGraphicObjectCacheLast( long nSizeInBytes ); -protected: - virtual int DeactivatePage( SfxItemSet* pSet = NULL ); - -public: - OfaMemoryOptionsPage( Window* pParent, const SfxItemSet& rSet ); - ~OfaMemoryOptionsPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optmemory.src b/cui/source/options/optmemory.src deleted file mode 100644 index f7e66cea9..000000000 --- a/cui/source/options/optmemory.src +++ /dev/null @@ -1,213 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- - -#include -#include "optmemory.hrc" -#include "helpid.hrc" - -TabPage OFA_TP_MEMORY -{ - HelpID = HID_OFA_TP_MEMORY ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine GB_UNDO - { - Pos = MAP_APPFONT( COL0, ROW0 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Undo" ; - }; - FixedText FT_UNDO - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW1 ) ); - Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Number of steps"; - }; - NumericField ED_UNDO - { - HelpID = "cui:NumericField:OFA_TP_MEMORY:ED_UNDO"; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROW1 ); - Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT ); - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - Maximum = 1000 ; - Value = 100 ; - Last = 100 ; - SpinSize = 1 ; - MaxTextLength = 4; - }; - FixedLine GB_GRAPHICCACHE - { - Pos = MAP_APPFONT( COL0, ROW2 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Graphics cache"; - }; - FixedText FT_GRAPHICCACHE - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) ); - Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Use for %PRODUCTNAME"; - }; - NumericField NF_GRAPHICCACHE - { - HelpID = "cui:NumericField:OFA_TP_MEMORY:NF_GRAPHICCACHE"; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROW3 ); - Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT ); - Minimum = 1; - Maximum = 256; - SpinSize = 1; - Spin = TRUE ; - Repeat = TRUE ; - }; - FixedText FT_GRAPHICCACHE_UNIT - { - Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW3 ) ); - Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "MB"; - }; - FixedText FT_GRAPHICOBJECTCACHE - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) ); - Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Memory per object" ; - }; - NumericField NF_GRAPHICOBJECTCACHE - { - HelpID = "cui:NumericField:OFA_TP_MEMORY:NF_GRAPHICOBJECTCACHE"; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROW4 ); - Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT ); - Minimum = 10; - Maximum = 2560; - SpinSize = 1; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 1; - }; - FixedText FT_GRAPHICOBJECTCACHE_UNIT - { - Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW4 ) ); - Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "MB"; - }; - FixedText FT_GRAPHICOBJECTTIME - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) ); - Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Remove from memory after"; - }; - TimeField TF_GRAPHICOBJECTTIME - { - HelpID = "cui:TimeField:OFA_TP_MEMORY:TF_GRAPHICOBJECTTIME"; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROW5 ); - Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT ); - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Value = Time - { - Minute = 10; - }; - Minimum = Time - { - Minute = 1; - }; - Maximum = Time - { - Hour = 23 ; - Minute = 59 ; - }; - First = Time - { - Minute = 10; - }; - Last = Time - { - Hour = 23 ; - Minute = 59 ; - }; - Format = TIMEF_NONE ; - Duration = TRUE ; - StrictFormat = TRUE ; - }; - FixedText FT_GRAPHICOBJECTTIME_UNIT - { - Pos = MAP_APPFONT( COL5, OFFS_TEXTBOX_FIXEDTEXT( ROW5 ) ); - Size = MAP_APPFONT( WIDTH3, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "hh:mm"; - }; - FixedLine GB_OLECACHE - { - Pos = MAP_APPFONT( COL0, ROW6 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Cache for inserted objects"; - }; - FixedText FT_OLECACHE - { - Pos = MAP_APPFONT( COL1, OFFS_TEXTBOX_FIXEDTEXT( ROW7 ) ); - Size = MAP_APPFONT( WIDTH1, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Number of objects"; - }; - NumericField NF_OLECACHE - { - HelpID = "cui:NumericField:OFA_TP_MEMORY:NF_OLECACHE"; - Border = TRUE ; - Pos = MAP_APPFONT( COL3, ROW7 ); - Size = MAP_APPFONT( WIDTH2, RSC_CD_TEXTBOX_HEIGHT ); - Minimum = 1; - Maximum = 1024; - Spin = TRUE ; - Repeat = TRUE ; - }; - FixedLine FL_QUICKLAUNCH - { - Pos = MAP_APPFONT( COL0, ROW8 ); - Size = MAP_APPFONT( WHOLE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "%PRODUCTNAME Quickstarter"; - }; - CheckBox CB_QUICKLAUNCH - { - HelpID = "cui:CheckBox:OFA_TP_MEMORY:CB_QUICKLAUNCH"; - Pos = MAP_APPFONT( COL1, ROW9 ); - Size = MAP_APPFONT( WHOLE_WIDTH - COL1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Load %PRODUCTNAME during system start-up"; - }; - String STR_QUICKLAUNCH_UNX - { - Text[ en-US ] = "Enable systray Quickstarter"; - }; -}; - diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx deleted file mode 100644 index ddf4d6170..000000000 --- a/cui/source/options/optpath.cxx +++ /dev/null @@ -1,850 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_OPTPATH_CXX - -#include "optpath.hxx" -#include -#include "optpath.hrc" -#include -#include "helpid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include "optHeaderTabListbox.hxx" -#include -#include - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::uno; -using namespace svx; - -// define ---------------------------------------------------------------- - -#define TAB_WIDTH1 80 -#define TAB_WIDTH_MIN 10 -#define TAB_WIDTH2 1000 -#define ITEMID_TYPE 1 -#define ITEMID_PATH 2 - -#define POSTFIX_INTERNAL String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_internal" ) ) -#define POSTFIX_USER String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_user" ) ) -#define POSTFIX_WRITABLE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) ) -#define POSTFIX_READONLY String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) ) -#define VAR_ONE String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) ) -#define IODLG_CONFIGNAME String(DEFINE_CONST_UNICODE("FilePicker_Save")) - -// struct OptPath_Impl --------------------------------------------------- - -struct OptPath_Impl -{ - SvtDefaultOptions m_aDefOpt; - Image m_aLockImage; - Image m_aLockImageHC; - String m_sMultiPathDlg; - Reference< XPropertySet > m_xPathSettings; - - OptPath_Impl(const ResId& rLockRes, const ResId& rLockResHC) : - m_aLockImage(rLockRes), - m_aLockImageHC(rLockResHC){} -}; - -// struct PathUserData_Impl ---------------------------------------------- - -struct PathUserData_Impl -{ - sal_uInt16 nRealId; - SfxItemState eState; - String sUserPath; - String sWritablePath; - - PathUserData_Impl( sal_uInt16 nId ) : - nRealId( nId ), eState( SFX_ITEM_UNKNOWN ) {} -}; - -struct Handle2CfgNameMapping_Impl -{ - sal_uInt16 m_nHandle; - const char* m_pCfgName; -}; - -static Handle2CfgNameMapping_Impl const Hdl2CfgMap_Impl[] = -{ - { SvtPathOptions::PATH_AUTOCORRECT, "AutoCorrect" }, - { SvtPathOptions::PATH_AUTOTEXT, "AutoText" }, - { SvtPathOptions::PATH_BACKUP, "Backup" }, - { SvtPathOptions::PATH_GALLERY, "Gallery" }, - { SvtPathOptions::PATH_GRAPHIC, "Graphic" }, - { SvtPathOptions::PATH_TEMP, "Temp" }, - { SvtPathOptions::PATH_TEMPLATE, "Template" }, - { SvtPathOptions::PATH_WORK, "Work" }, -#if OSL_DEBUG_LEVEL > 1 - { SvtPathOptions::PATH_LINGUISTIC, "Linguistic" }, - { SvtPathOptions::PATH_DICTIONARY, "Dictionary" }, -#endif - { USHRT_MAX, NULL } -}; - -static String getCfgName_Impl( sal_uInt16 _nHandle ) -{ - String sCfgName; - sal_uInt16 nIndex = 0; - while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != USHRT_MAX ) - { - if ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle == _nHandle ) - { - // config name found - sCfgName = String::CreateFromAscii( Hdl2CfgMap_Impl[ nIndex ].m_pCfgName ); - break; - } - ++nIndex; - } - - return sCfgName; -} - -#define MULTIPATH_DELIMITER ';' - -String Convert_Impl( const String& rValue ) -{ - char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = rValue.GetTokenCount( cDelim ); - String aReturn; - for ( sal_uInt16 i=0; iGrabFocus(); - return nRet; -} - -// functions ------------------------------------------------------------- - -sal_Bool IsMultiPath_Impl( const sal_uInt16 nIndex ) -{ -#if OSL_DEBUG_LEVEL > 1 - return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex || - SvtPathOptions::PATH_AUTOTEXT == nIndex || - SvtPathOptions::PATH_BASIC == nIndex || - SvtPathOptions::PATH_GALLERY == nIndex || - SvtPathOptions::PATH_TEMPLATE == nIndex ); -#else - return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex || - SvtPathOptions::PATH_AUTOTEXT == nIndex || - SvtPathOptions::PATH_BASIC == nIndex || - SvtPathOptions::PATH_GALLERY == nIndex || - SvtPathOptions::PATH_TEMPLATE == nIndex || - SvtPathOptions::PATH_LINGUISTIC == nIndex || - SvtPathOptions::PATH_DICTIONARY == nIndex ); -#endif -} - -// class SvxPathTabPage -------------------------------------------------- - -SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_PATH ), rSet ), - - aStdBox ( this, CUI_RES( GB_STD ) ), - aTypeText ( this, CUI_RES( FT_TYPE ) ), - aPathText ( this, CUI_RES( FT_PATH ) ), - aPathCtrl ( this, CUI_RES( LB_PATH ) ), - aStandardBtn ( this, CUI_RES( BTN_STANDARD ) ), - aPathBtn ( this, CUI_RES( BTN_PATH ) ), - pHeaderBar ( NULL ), - pPathBox ( NULL ), - pImpl ( new OptPath_Impl( CUI_RES(IMG_LOCK), CUI_RES(IMG_LOCK_HC) ) ), - xDialogListener ( new ::svt::DialogClosedListener() ) - -{ - pImpl->m_sMultiPathDlg = String( CUI_RES( STR_MULTIPATHDLG ) ); - aStandardBtn.SetClickHdl( LINK( this, SvxPathTabPage, StandardHdl_Impl ) ); - Link aLink = LINK( this, SvxPathTabPage, PathHdl_Impl ); - aPathBtn.SetClickHdl( aLink ); - Size aBoxSize = aPathCtrl.GetOutputSizePixel(); - pHeaderBar = new HeaderBar( &aPathCtrl, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); - pHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) ); - pHeaderBar->SetSelectHdl( LINK( this, SvxPathTabPage, HeaderSelect_Impl ) ); - pHeaderBar->SetEndDragHdl( LINK( this, SvxPathTabPage, HeaderEndDrag_Impl ) ); - Size aSz; - aSz.Width() = TAB_WIDTH1; - pHeaderBar->InsertItem( ITEMID_TYPE, aTypeText.GetText(), - LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(), - HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE | HIB_UPARROW ); - aSz.Width() = TAB_WIDTH2; - pHeaderBar->InsertItem( ITEMID_PATH, aPathText.GetText(), - LogicToPixel( aSz, MapMode( MAP_APPFONT ) ).Width(), - HIB_LEFT | HIB_VCENTER ); - - static long nTabs[] = {3, 0, TAB_WIDTH1, TAB_WIDTH1 + TAB_WIDTH2 }; - Size aHeadSize = pHeaderBar->GetSizePixel(); - - WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP; - pPathBox = new svx::OptHeaderTabListBox( &aPathCtrl, nBits ); - aPathCtrl.SetFocusControl( pPathBox ); - pPathBox->SetDoubleClickHdl( aLink ); - pPathBox->SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) ); - pPathBox->SetSelectionMode( MULTIPLE_SELECTION ); - pPathBox->SetPosSizePixel( Point( 0, aHeadSize.Height() ), - Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) ); - pPathBox->SetTabs( &nTabs[0], MAP_APPFONT ); - pPathBox->InitHeaderBar( pHeaderBar ); - pPathBox->SetHighlightRange(); - pPathBox->SetHelpId( HID_OPTPATH_CTL_PATH ); - pHeaderBar->SetHelpId( HID_OPTPATH_HEADERBAR ); - pPathBox->Show(); - pHeaderBar->Show(); - - FreeResource(); - - xDialogListener->SetDialogClosedLink( LINK( this, SvxPathTabPage, DialogClosedHdl ) ); -} - -// ----------------------------------------------------------------------- - -SvxPathTabPage::~SvxPathTabPage() -{ - // #110603# do not grab focus to a destroyed window !!! - aPathCtrl.SetFocusControl( NULL ); - - pHeaderBar->Hide(); - for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i ) - delete (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData(); - delete pPathBox; - delete pHeaderBar; - delete pImpl; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxPathTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return ( new SvxPathTabPage( pParent, rAttrSet ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxPathTabPage::FillItemSet( SfxItemSet& ) -{ - SvtPathOptions aPathOpt; - for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i ) - { - PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(i)->GetUserData(); - sal_uInt16 nRealId = pPathImpl->nRealId; - if ( pPathImpl->eState == SFX_ITEM_SET ) - SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath ); - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -void SvxPathTabPage::Reset( const SfxItemSet& ) -{ - pPathBox->Clear(); - SvtPathOptions aPathOpt; //! deprecated - - for( sal_uInt16 i = 0; i <= (sal_uInt16)SvtPathOptions::PATH_WORK; ++i ) - { - // only writer uses autotext - if ( i == SvtPathOptions::PATH_AUTOTEXT - && !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - continue; - - switch (i) - { - case SvtPathOptions::PATH_AUTOCORRECT: - case SvtPathOptions::PATH_AUTOTEXT: - case SvtPathOptions::PATH_BACKUP: - case SvtPathOptions::PATH_GALLERY: - case SvtPathOptions::PATH_GRAPHIC: - case SvtPathOptions::PATH_TEMP: - case SvtPathOptions::PATH_TEMPLATE: -#if OSL_DEBUG_LEVEL > 1 - case SvtPathOptions::PATH_LINGUISTIC: - case SvtPathOptions::PATH_DICTIONARY: -#endif - case SvtPathOptions::PATH_WORK: - { - String aStr( CUI_RES( RID_SVXSTR_PATH_NAME_START + i ) ); - String sInternal, sUser, sWritable; - sal_Bool bReadOnly = sal_False; - GetPathList( i, sInternal, sUser, sWritable, bReadOnly ); - String sTmpPath = sUser; - if ( sTmpPath.Len() > 0 && sWritable.Len() > 0 ) - sTmpPath += MULTIPATH_DELIMITER; - sTmpPath += sWritable; - String aValue( sTmpPath ); - aStr += '\t'; - aStr += Convert_Impl( aValue ); - SvLBoxEntry* pEntry = pPathBox->InsertEntry( aStr ); - if ( bReadOnly ) - { - pPathBox->SetCollapsedEntryBmp( pEntry, pImpl->m_aLockImage ); - } - PathUserData_Impl* pPathImpl = new PathUserData_Impl(i); - pPathImpl->sUserPath = sUser; - pPathImpl->sWritablePath = sWritable; - pEntry->SetUserData( pPathImpl ); - } - } - } - - String aUserData = GetUserData(); - if ( aUserData.Len() ) - { - // Spaltenbreite restaurieren - pHeaderBar->SetItemSize( ITEMID_TYPE, aUserData.GetToken(0).ToInt32() ); - HeaderEndDrag_Impl( NULL ); - // Sortierrichtung restaurieren - sal_Bool bUp = (sal_Bool)(sal_uInt16)aUserData.GetToken(1).ToInt32(); - HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); - HeaderSelect_Impl( NULL ); - } - PathSelect_Impl( NULL ); -} - -// ----------------------------------------------------------------------- - -void SvxPathTabPage::FillUserData() -{ - String aUserData = String::CreateFromInt32( pHeaderBar->GetItemSize( ITEMID_TYPE ) ); - aUserData += ';'; - HeaderBarItemBits nBits = pHeaderBar->GetItemBits( ITEMID_TYPE ); - sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); - aUserData += bUp ? '1' : '0'; - SetUserData( aUserData ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, PathSelect_Impl, svx::OptHeaderTabListBox *, EMPTYARG ) -{ - sal_uInt16 nSelCount = 0; - SvLBoxEntry* pEntry = pPathBox->FirstSelected(); - - //the entry image indicates whether the path is write protected - Image aEntryImage; - if(pEntry) - aEntryImage = pPathBox->GetCollapsedEntryBmp( pEntry ); - sal_Bool bEnable = !aEntryImage; - while ( pEntry && ( nSelCount < 2 ) ) - { - nSelCount++; - pEntry = pPathBox->NextSelected( pEntry ); - } - - aPathBtn.Enable( 1 == nSelCount && bEnable); - aStandardBtn.Enable( nSelCount > 0 && bEnable); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, StandardHdl_Impl, PushButton *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = pPathBox->FirstSelected(); - while ( pEntry ) - { - PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData(); - String aOldPath = pImpl->m_aDefOpt.GetDefaultPath( pPathImpl->nRealId ); - - if ( aOldPath.Len() ) - { - String sInternal, sUser, sWritable, sTemp; - sal_Bool bReadOnly = sal_False; - GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly ); - - sal_uInt16 i; - sal_uInt16 nOldCount = aOldPath.GetTokenCount( MULTIPATH_DELIMITER ); - sal_uInt16 nIntCount = sInternal.GetTokenCount( MULTIPATH_DELIMITER ); - for ( i = 0; i < nOldCount; ++i ) - { - bool bFound = false; - String sOnePath = aOldPath.GetToken( i, MULTIPATH_DELIMITER ); - for ( sal_uInt16 j = 0; !bFound && j < nIntCount; ++j ) - { - if ( sInternal.GetToken( i, MULTIPATH_DELIMITER ) == sOnePath ) - bFound = true; - } - if ( !bFound ) - { - if ( sTemp.Len() > 0 ) - sTemp += MULTIPATH_DELIMITER; - sTemp += sOnePath; - } - } - - String sUserPath, sWritablePath; - nOldCount = sTemp.GetTokenCount( MULTIPATH_DELIMITER ); - for ( i = 0; nOldCount > 0 && i < nOldCount - 1; ++i ) - { - if ( sUserPath.Len() > 0 ) - sUserPath += MULTIPATH_DELIMITER; - sUserPath += sTemp.GetToken( i, MULTIPATH_DELIMITER ); - } - sWritablePath = sTemp.GetToken( nOldCount - 1, MULTIPATH_DELIMITER ); - - pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 ); - pPathImpl->eState = SFX_ITEM_SET; - pPathImpl->sUserPath = sUserPath; - pPathImpl->sWritablePath = sWritablePath; - } - pEntry = pPathBox->NextSelected( pEntry ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder ) -{ - SvLBoxEntry* pEntry = pPathBox->GetCurEntry(); - if ( !pEntry ) - { - DBG_ERRORFILE( "SvxPathTabPage::ChangeCurrentEntry(): no entry" ); - return; - } - - String sInternal, sUser, sWritable; - PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData(); - sal_Bool bReadOnly = sal_False; - GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly ); - sUser = pPathImpl->sUserPath; - sWritable = pPathImpl->sWritablePath; - sal_uInt16 nPos = pPathImpl->nRealId; - - // old path is an URL? - INetURLObject aObj( sWritable ); - bool bURL = ( aObj.GetProtocol() != INET_PROT_NOT_VALID ); - rtl::OUString aPathStr( _rFolder ); - INetURLObject aNewObj( aPathStr ); - aNewObj.removeFinalSlash(); - - // then the new path also an URL else system path - String sNewPathStr = bURL ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT ); - - bool bChanged = -#ifdef UNX -// Unix is case sensitive - ( sNewPathStr != sWritable ); -#else - ( sNewPathStr.CompareIgnoreCaseToAscii( sWritable ) != COMPARE_EQUAL ); -#endif - - if ( bChanged ) - { - pPathBox->SetEntryText( Convert_Impl( sNewPathStr ), pEntry, 1 ); - nPos = (sal_uInt16)pPathBox->GetModel()->GetAbsPos( pEntry ); - pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData(); - pPathImpl->eState = SFX_ITEM_SET; - pPathImpl->sWritablePath = sNewPathStr; - if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId ) - { - // Remove view options entry so the new work path - // will be used for the next open dialog. - SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME ); - aDlgOpt.Delete(); - // Reset also last used dir in the sfx application instance - SfxApplication *pSfxApp = SFX_APP(); - pSfxApp->ResetLastDir(); - - // Set configuration flag to notify file picker that it's necessary - // to take over the path provided. - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - ::comphelper::ConfigurationHelper::writeDirectKey(xFactory, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")), - ::com::sun::star::uno::makeAny(true), - ::comphelper::ConfigurationHelper::E_STANDARD); - } - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, PathHdl_Impl, PushButton *, EMPTYARG ) -{ - SvLBoxEntry* pEntry = pPathBox->GetCurEntry(); - sal_uInt16 nPos = ( pEntry != NULL ) ? ( (PathUserData_Impl*)pEntry->GetUserData() )->nRealId : 0; - String sInternal, sUser, sWritable; - if ( pEntry ) - { - PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData(); - sal_Bool bReadOnly = sal_False; - GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly ); - sUser = pPathImpl->sUserPath; - sWritable = pPathImpl->sWritablePath; - } - - if(pEntry && !(!((OptHeaderTabListBox*)pPathBox)->GetCollapsedEntryBmp(pEntry))) - return 0; - - if ( IsMultiPath_Impl( nPos ) ) - { - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - AbstractSvxMultiPathDialog* pMultiDlg = - pFact->CreateSvxMultiPathDialog( this ); - DBG_ASSERT( pMultiDlg, "Dialogdiet fail!" ); - pMultiDlg->EnableRadioButtonMode(); - - String sPath( sUser ); - if ( sPath.Len() > 0 ) - sPath += MULTIPATH_DELIMITER; - sPath += sWritable; - pMultiDlg->SetPath( sPath ); - - String sPathName = pPathBox->GetEntryText( pEntry, 0 ); - String sNewTitle( pImpl->m_sMultiPathDlg ); - sNewTitle.SearchAndReplace( VAR_ONE, sPathName ); - pMultiDlg->SetTitle( sNewTitle ); - - if ( pMultiDlg->Execute() == RET_OK && pEntry ) - { - sUser.Erase(); - sWritable.Erase(); - String sFullPath; - String sNewPath = pMultiDlg->GetPath(); - char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = sNewPath.GetTokenCount( cDelim ); - if ( nCount > 0 ) - { - sal_uInt16 i = 0; - for ( ; i < nCount - 1; ++i ) - { - if ( sUser.Len() > 0 ) - sUser += cDelim; - sUser += sNewPath.GetToken( i, cDelim ); - } - if ( sFullPath.Len() > 0 ) - sFullPath += cDelim; - sFullPath += sUser; - sWritable += sNewPath.GetToken( i, cDelim ); - if ( sFullPath.Len() > 0 ) - sFullPath += cDelim; - sFullPath += sWritable; - } - - pPathBox->SetEntryText( Convert_Impl( sFullPath ), pEntry, 1 ); - // save modified flag - PathUserData_Impl* pPathImpl = (PathUserData_Impl*)pEntry->GetUserData(); - pPathImpl->eState = SFX_ITEM_SET; - pPathImpl->sUserPath = sUser; - pPathImpl->sWritablePath = sWritable; - } - delete pMultiDlg; - } - } - else if ( pEntry ) - { - try - { - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >( - xFactory->createInstance( aService ), UNO_QUERY ); - - INetURLObject aURL( sWritable, INET_PROT_FILE ); - xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else - { - short nRet = xFolderPicker->execute(); - if ( ExecutableDialogResults::OK != nRet ) - return 0; - - String sFolder( xFolderPicker->getDirectory() ); - ChangeCurrentEntry( sFolder ); - } - } - catch( Exception& ) - { - DBG_ERRORFILE( "SvxPathTabPage::PathHdl_Impl: exception from folder picker" ); - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, HeaderSelect_Impl, HeaderBar*, pBar ) -{ - if ( pBar && pBar->GetCurItemId() != ITEMID_TYPE ) - return 0; - - HeaderBarItemBits nBits = pHeaderBar->GetItemBits(ITEMID_TYPE); - sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); - SvSortMode eMode = SortAscending; - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - eMode = SortDescending; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - pHeaderBar->SetItemBits( ITEMID_TYPE, nBits ); - SvTreeList* pModel = pPathBox->GetModel(); - pModel->SetSortMode( eMode ); - pModel->Resort(); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, HeaderEndDrag_Impl, HeaderBar*, pBar ) -{ - if ( pBar && !pBar->GetCurItemId() ) - return 0; - - if ( !pHeaderBar->IsItemMode() ) - { - Size aSz; - sal_uInt16 nTabs = pHeaderBar->GetItemCount(); - long nTmpSz = 0; - long nWidth = pHeaderBar->GetItemSize(ITEMID_TYPE); - long nBarWidth = pHeaderBar->GetSizePixel().Width(); - - if(nWidth < TAB_WIDTH_MIN) - pHeaderBar->SetItemSize( ITEMID_TYPE, TAB_WIDTH_MIN); - else if ( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN ) - pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - TAB_WIDTH_MIN ); - - for ( sal_uInt16 i = 1; i <= nTabs; ++i ) - { - long _nWidth = pHeaderBar->GetItemSize(i); - aSz.Width() = _nWidth + nTmpSz; - nTmpSz += _nWidth; - pPathBox->SetTab( i, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT ); - } - } - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPathTabPage, DialogClosedHdl, DialogClosedEvent*, pEvt ) -{ - if ( RET_OK == pEvt->DialogResult ) - { - DBG_ASSERT( xFolderPicker.is() == sal_True, "SvxPathTabPage::DialogClosedHdl(): no folder picker" ); - - String sURL = String( xFolderPicker->getDirectory() ); - ChangeCurrentEntry( sURL ); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -void SvxPathTabPage::GetPathList( - sal_uInt16 _nPathHandle, String& _rInternalPath, - String& _rUserPath, String& _rWritablePath, sal_Bool& _rReadOnly ) -{ - String sCfgName = getCfgName_Impl( _nPathHandle ); - - // load PathSettings service if necessary - if ( !pImpl->m_xPathSettings.is() ) - { - Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory(); - pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSettings") ) ), UNO_QUERY ); - } - - try - { - if ( pImpl->m_xPathSettings.is() ) - { - // load internal paths - String sProp( sCfgName ); - sProp = sCfgName; - sProp += POSTFIX_INTERNAL; - Any aAny = pImpl->m_xPathSettings->getPropertyValue( sProp ); - Sequence< ::rtl::OUString > aPathSeq; - if ( aAny >>= aPathSeq ) - { - long i, nCount = aPathSeq.getLength(); - const ::rtl::OUString* pPaths = aPathSeq.getConstArray(); - - for ( i = 0; i < nCount; ++i ) - { - if ( _rInternalPath.Len() > 0 ) - _rInternalPath += ';'; - _rInternalPath += String( pPaths[i] ); - } - } - // load user paths - sProp = sCfgName; - sProp += POSTFIX_USER; - aAny = pImpl->m_xPathSettings->getPropertyValue( sProp ); - if ( aAny >>= aPathSeq ) - { - long i, nCount = aPathSeq.getLength(); - const ::rtl::OUString* pPaths = aPathSeq.getConstArray(); - - for ( i = 0; i < nCount; ++i ) - { - if ( _rUserPath.Len() > 0 ) - _rUserPath += ';'; - _rUserPath += String( pPaths[i] ); - } - } - // then the writable path - sProp = sCfgName; - sProp += POSTFIX_WRITABLE; - aAny = pImpl->m_xPathSettings->getPropertyValue( sProp ); - ::rtl::OUString sWritablePath; - if ( aAny >>= sWritablePath ) - _rWritablePath = String( sWritablePath ); - - // and the readonly flag - sProp = sCfgName; - Reference< XPropertySetInfo > xInfo = pImpl->m_xPathSettings->getPropertySetInfo(); - Property aProp = xInfo->getPropertyByName( sProp ); - _rReadOnly = ( ( aProp.Attributes & PropertyAttribute::READONLY ) == PropertyAttribute::READONLY ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "SvxPathTabPage::GetPathList(): caught an exception!" ); - } -} - -// ----------------------------------------------------------------------- - -void SvxPathTabPage::SetPathList( - sal_uInt16 _nPathHandle, const String& _rUserPath, const String& _rWritablePath ) -{ - String sCfgName = getCfgName_Impl( _nPathHandle ); - - // load PathSettings service if necessary - if ( !pImpl->m_xPathSettings.is() ) - { - Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory(); - pImpl->m_xPathSettings = Reference< XPropertySet >( xSMgr->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.PathSettings") ) ), UNO_QUERY ); - } - - try - { - if ( pImpl->m_xPathSettings.is() ) - { - // save user paths - char cDelim = MULTIPATH_DELIMITER; - sal_uInt16 nCount = _rUserPath.GetTokenCount( cDelim ); - Sequence< ::rtl::OUString > aPathSeq( nCount ); - ::rtl::OUString* pArray = aPathSeq.getArray(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - pArray[i] = ::rtl::OUString( _rUserPath.GetToken( i, cDelim ) ); - String sProp( sCfgName ); - sProp += POSTFIX_USER; - Any aValue = makeAny( aPathSeq ); - pImpl->m_xPathSettings->setPropertyValue( sProp, aValue ); - - // then the writable path - aValue = makeAny( ::rtl::OUString( _rWritablePath ) ); - sProp = sCfgName; - sProp += POSTFIX_WRITABLE; - pImpl->m_xPathSettings->setPropertyValue( sProp, aValue ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "SvxPathTabPage::SetPathList(): caught an exception!" ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optpath.hrc b/cui/source/options/optpath.hrc deleted file mode 100644 index bb7abf2c4..000000000 --- a/cui/source/options/optpath.hrc +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTPATH_HRC -#define _SVX_OPTPATH_HRC - -// defines --------------------------------------------------------------- - -#define FT_TYPE 10 -#define FT_PATH 11 -#define LB_PATH 12 -#define BTN_PATH 13 -#define BTN_STANDARD 14 -#define GB_STD 15 -#define IMG_LOCK 16 -#define IMG_LOCK_HC 17 -#define STR_MULTIPATHDLG 18 - -#endif - diff --git a/cui/source/options/optpath.src b/cui/source/options/optpath.src deleted file mode 100644 index 4b5f76ce2..000000000 --- a/cui/source/options/optpath.src +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include -------------------------------------------------------------- -#include "optpath.hrc" -#include -#ifndef _SFX_HRC -#include -#endif -#include "helpid.hrc" - - // RID_SFXPAGE_PATH ----------------------------------------------------- -#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; } -TabPage RID_SFXPAGE_PATH -{ - HelpId = HID_OPTIONS_PATH ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Paths" ; - FixedText FT_TYPE - { - Hide = TRUE; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Type" ; - }; - FixedText FT_PATH - { - Hide = TRUE; - Pos = MAP_APPFONT ( 110 , 14 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Path" ; - }; - Control LB_PATH - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 236 , 147 ) ; - Border = TRUE ; - TabStop = TRUE; - }; - PushButton BTN_PATH - { - HelpID = "cui:PushButton:RID_SFXPAGE_PATH:BTN_PATH"; - Pos = MAP_APPFONT ( 183 , 165 ) ; - Size = MAP_APPFONT ( 65 , 14 ) ; - Text [ en-US ] = "~Edit..." ; - }; - PushButton BTN_STANDARD - { - HelpID = "cui:PushButton:RID_SFXPAGE_PATH:BTN_STANDARD"; - Pos = MAP_APPFONT ( 115 , 165 ) ; - Size = MAP_APPFONT ( 65 , 14 ) ; - Text [ en-US ] = "~Default" ; - }; - FixedLine GB_STD - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Paths used by %PRODUCTNAME" ; - }; - Image IMG_LOCK - { - ImageBitmap = Bitmap { File = "lock.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - String STR_MULTIPATHDLG - { - Text [ en-US ] = "Edit Paths: %1" ; - }; -}; -ErrorBox RID_SVXERR_OPT_DOUBLEPATHS -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - Message [ en-US ] = "The configuration and mail directories must be specified as separate directories.\nPlease choose a new path." ; -}; - // ******************************************************************* EOF -String RID_SVXSTR_KEY_CONFIG_DIR -{ - Text [ en-US ] = "Configuration" ; -}; -String RID_SVXSTR_KEY_WORK_PATH -{ - Text [ en-US ] = "My Documents" ; -}; -String RID_SVXSTR_KEY_GRAPHICS_PATH -{ - Text [ en-US ] = "Graphics" ; -}; -String RID_SVXSTR_KEY_BITMAP_PATH -{ - Text [ en-US ] = "Icons" ; -}; -String RID_SVXSTR_KEY_BASIC_PATH -{ - Text = "BASIC" ; -}; - -String RID_SVXSTR_KEY_PALETTE_PATH -{ - Text [ en-US ] = "Palettes" ; -}; -String RID_SVXSTR_KEY_BACKUP_PATH -{ - Text [ en-US ] = "Backups" ; -}; -String RID_SVXSTR_KEY_MODULES_PATH -{ - Text [ en-US ] = "Modules" ; -}; -String RID_SVXSTR_KEY_TEMPLATE_PATH -{ - Text [ en-US ] = "Templates" ; -}; -String RID_SVXSTR_KEY_GLOSSARY_PATH -{ - Text [ en-US ] = "AutoText"; -}; -String RID_SVXSTR_KEY_DICTIONARY_PATH -{ - Text [ en-US ] = "Dictionaries" ; -}; -String RID_SVXSTR_KEY_HELP_DIR -{ - Text [ en-US ] = "Help" ; -}; -String RID_SVXSTR_KEY_GALLERY_DIR -{ - Text [ en-US ] = "Gallery" ; -}; - -String RID_SVXSTR_KEY_STORAGE_DIR -{ - Text [ en-US ] = "Message Storage" ; -}; -String RID_SVXSTR_KEY_TEMP_PATH -{ - Text [ en-US ] = "Temporary files"; -}; -String RID_SVXSTR_KEY_PLUGINS_PATH -{ - Text [ en-US ] = "Plug-ins"; -}; -String RID_SVXSTR_KEY_FAVORITES_DIR -{ - Text [ en-US ] = "Folder Bookmarks"; -}; -String RID_SVXSTR_KEY_FILTER_PATH -{ - Text [ en-US ] = "Filters"; -}; -String RID_SVXSTR_KEY_ADDINS_PATH -{ - Text [ en-US ] = "Add-ins"; -}; -String RID_SVXSTR_KEY_USERCONFIG_PATH -{ - Text [ en-US ] = "User Configuration"; -}; -String RID_SVXSTR_KEY_USERDICTIONARY_DIR -{ - Text [ en-US ] = "User-defined dictionaries"; -}; -String RID_SVXSTR_KEY_AUTOCORRECT_DIR -{ - Text [ en-US ] = "AutoCorrect"; -}; -String RID_SVXSTR_KEY_LINGUISTIC_DIR -{ - Text [ en-US ] = "Writing aids"; -}; - diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx deleted file mode 100644 index eba8cf1b5..000000000 --- a/cui/source/options/optsave.cxx +++ /dev/null @@ -1,665 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#define _SVX_OPTSAVE_CXX - -#include "optsave.hrc" -#include - -#include "optsave.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::util; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; -using namespace comphelper; -using rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define C2S(cChar) String( RTL_CONSTASCII_USTRINGPARAM(cChar) ) -#define CFG_PAGE_AND_GROUP C2S("General"), C2S("LoadSave") -// !! you have to update these index, if you changed the list of the child windows !! -#define WININDEX_AUTOSAVE ((sal_uInt16)6) -#define WININDEX_SAVEURL_RELFSYS ((sal_uInt16)9) - -// ---------------------------------------------------------------------- - -struct SvxSaveTabPage_Impl -{ - Reference< XNameContainer > xFact; - Sequence< OUString > aFilterArr[APP_COUNT]; - Sequence< sal_Bool > aAlienArr[APP_COUNT]; - Sequence< sal_Bool > aODFArr[APP_COUNT]; - Sequence< OUString > aUIFilterArr[APP_COUNT]; - OUString aDefaultArr[APP_COUNT]; - sal_Bool aDefaultReadonlyArr[APP_COUNT]; - sal_Bool bInitialized; - - SvxSaveTabPage_Impl(); - ~SvxSaveTabPage_Impl(); -}; - -SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( sal_False ) -{ -} - -SvxSaveTabPage_Impl::~SvxSaveTabPage_Impl() -{ -} - -// class SvxSaveTabPage -------------------------------------------------- - -SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_SAVE ), rCoreSet ), - - aLoadFL ( this, CUI_RES( LB_LOAD ) ), - aLoadUserSettingsCB ( this, CUI_RES( CB_LOAD_SETTINGS ) ), - aLoadDocPrinterCB ( this, CUI_RES( CB_LOAD_DOCPRINTER ) ), - - aSaveFL ( this, CUI_RES( GB_SAVE ) ), - aDocInfoCB ( this, CUI_RES( BTN_DOCINFO ) ), - aBackupFI ( this, CUI_RES( FI_BACKUP ) ), - aBackupCB ( this, CUI_RES( BTN_BACKUP ) ), - aAutoSaveCB ( this, CUI_RES( BTN_AUTOSAVE ) ), - aAutoSaveEdit ( this, CUI_RES( ED_AUTOSAVE ) ), - aMinuteFT ( this, CUI_RES( FT_MINUTE ) ), - aRelativeFsysCB ( this, CUI_RES( BTN_RELATIVE_FSYS ) ), - aRelativeInetCB ( this, CUI_RES( BTN_RELATIVE_INET ) ), - - aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ), - aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ), - aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ), - aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ), - aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ), - aDocTypeFT ( this, CUI_RES( FT_APP ) ), - aDocTypeLB ( this, CUI_RES( LB_APP ) ), - aSaveAsFT ( this, CUI_RES( FT_FILTER ) ), - aSaveAsFI ( this, CUI_RES( FI_FILTER ) ), - aSaveAsLB ( this, CUI_RES( LB_FILTER ) ), - aODFWarningFI ( this, CUI_RES( FI_ODF_WARNING ) ), - aODFWarningFT ( this, CUI_RES( FT_WARN ) ), - - pImpl ( new SvxSaveTabPage_Impl ) - -{ - aODFWarningFI.SetImage( Image( CUI_RES( IMG_ODF_WARNING ))); - - FreeResource(); - - Link aLink = LINK( this, SfxSaveTabPage, AutoClickHdl_Impl ); - aAutoSaveCB.SetClickHdl( aLink ); - aAutoSaveEdit.SetMaxTextLen( 2 ); - - SvtModuleOptions aModuleOpt; - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) ) - { - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_MATH )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_MATH )); - } - else - { - pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH); - pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_MATH); - } - - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - { - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_DRAW )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_DRAW )); - } - else - { - pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW); - pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_DRAW); - } - - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - { - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_IMPRESS )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_IMPRESS )); - } - else - { - pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS); - pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_IMPRESS); - } - - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - { - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_CALC )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_CALC )); - } - else - { - pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC); - pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_CALC); - } - - if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - { - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER )); - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_WEB )); - aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_GLOBAL )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_WEB )); - aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_GLOBAL )); - } - else - { - pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER); - pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB); - pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL); - pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITER); - pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERWEB); - pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERGLOBAL); - } - - aLink = LINK( this, SfxSaveTabPage, ODFVersionHdl_Impl ); - aODFVersionLB.SetSelectHdl( aLink ); - aLink = LINK( this, SfxSaveTabPage, FilterHdl_Impl ); - aDocTypeLB.SetSelectHdl( aLink ); - aSaveAsLB.SetSelectHdl( aLink ); - - DetectHiddenControls(); -} - -// ----------------------------------------------------------------------- - -SfxSaveTabPage::~SfxSaveTabPage() -{ - delete pImpl; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SfxSaveTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return ( new SfxSaveTabPage( pParent, rAttrSet ) ); -} - -// ----------------------------------------------------------------------- -void SfxSaveTabPage::DetectHiddenControls() -{ - long nDelta = 0; - // the index of the first child window which perhaps have to move upwards - sal_uInt16 nWinIndex = WININDEX_SAVEURL_RELFSYS; - SvtOptionsDialogOptions aOptionsDlgOpt; - - if ( aOptionsDlgOpt.IsOptionHidden( C2S("Backup"), CFG_PAGE_AND_GROUP ) ) - { - // hide controls of "Backup" - aBackupFI.Hide(); - aBackupCB.Hide(); - // the other controls have to move upwards the height of checkbox + space - nDelta = aAutoSaveCB.GetPosPixel().Y() - aBackupCB.GetPosPixel().Y(); - } - - if ( aOptionsDlgOpt.IsOptionHidden( C2S("AutoSave"), CFG_PAGE_AND_GROUP ) ) - { - // hide controls of "AutoSave" - aAutoSaveCB.Hide(); - aAutoSaveEdit.Hide(); - aMinuteFT.Hide(); - // the other controls have to move upwards the height of checkbox + space - nDelta += aRelativeFsysCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y(); - } - else if ( nDelta > 0 ) - // the "AutoSave" controls have to move upwards too - nWinIndex = WININDEX_AUTOSAVE; - - if ( nDelta > 0 ) - { - sal_uInt16 i, nChildCount = GetChildCount(); - for ( i = nWinIndex; i < nChildCount; ++i ) - { - Window* pWin = GetChild(i); - Point aPos = pWin->GetPosPixel(); - aPos.Y() -= nDelta; - pWin->SetPosPixel( aPos ); - } - } -} -// ----------------------------------------------------------------------- -sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = sal_False; - SvtSaveOptions aSaveOpt; - if(aLoadUserSettingsCB.IsChecked() != aLoadUserSettingsCB.GetSavedValue()) - { - aSaveOpt.SetLoadUserSettings(aLoadUserSettingsCB.IsChecked()); - } - - if ( aLoadDocPrinterCB.IsChecked() != aLoadDocPrinterCB.GetSavedValue() ) - aSaveOpt.SetLoadDocumentPrinter( aLoadDocPrinterCB.IsChecked() ); - - if ( aODFVersionLB.GetSelectEntryPos() != aODFVersionLB.GetSavedValue() ) - { - long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) ); - aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) ); - } - - if ( aDocInfoCB.IsChecked() != aDocInfoCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ), - aDocInfoCB.IsChecked() ) ); - bModified |= sal_True; - } - - if ( aBackupCB.IsEnabled() && aBackupCB.IsChecked() != aBackupCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ), - aBackupCB.IsChecked() ) ); - bModified |= sal_True; - } - - if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) ); - bModified |= sal_True; - } - - if ( aAutoSaveCB.IsChecked() != aAutoSaveCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ), - aAutoSaveCB.IsChecked() ) ); - bModified |= sal_True; - } - if ( aWarnAlienFormatCB.IsChecked() != aWarnAlienFormatCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ), - aWarnAlienFormatCB.IsChecked() ) ); - bModified |= sal_True; - } - - if ( aAutoSaveEdit.GetText() != aAutoSaveEdit.GetSavedValue() ) - { - rSet.Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ), - (sal_uInt16)aAutoSaveEdit.GetValue() ) ); - bModified |= sal_True; - } - // relativ speichern - if ( aRelativeFsysCB.IsChecked() != aRelativeFsysCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ), - aRelativeFsysCB.IsChecked() ) ); - bModified |= sal_True; - } - - if ( aRelativeInetCB.IsChecked() != aRelativeInetCB.GetSavedValue() ) - { - rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ), - aRelativeInetCB.IsChecked() ) ); - bModified |= sal_True; - } - - SvtModuleOptions aModuleOpt; - if(pImpl->aDefaultArr[APP_MATH].getLength() && - pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_MATH, pImpl->aDefaultArr[APP_MATH]); - - if( pImpl->aDefaultArr[APP_DRAW].getLength() && - pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_DRAW, pImpl->aDefaultArr[APP_DRAW]); - - if(pImpl->aDefaultArr[APP_IMPRESS].getLength() && - pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]); - - if(pImpl->aDefaultArr[APP_CALC].getLength() && - pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_CALC, pImpl->aDefaultArr[APP_CALC]); - - if(pImpl->aDefaultArr[APP_WRITER].getLength() && - pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITER, pImpl->aDefaultArr[APP_WRITER]); - - if(pImpl->aDefaultArr[APP_WRITER_WEB].getLength() && - pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]); - - if(pImpl->aDefaultArr[APP_WRITER_GLOBAL].getLength() && - pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL)) - aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]); - - return bModified; -} - -// ----------------------------------------------------------------------- - -sal_Bool isODFFormat( OUString sFilter ) -{ - static const char* aODFFormats[] = - { - "writer8", - "writer8_template", - "writerglobal8", - "writerglobal8_writer", - "calc8", - "calc8_template", - "draw8", - "draw8_template", - "impress8", - "impress8_template", - "impress8_draw", - "chart8", - "math8", - NULL - }; - - sal_Bool bRet = sal_False; - int i = 0; - while ( aODFFormats[i] != NULL ) - { - if ( sFilter.equalsAscii( aODFFormats[i++] ) ) - { - bRet = sal_True; - break; - } - } - - return bRet; -} - -void SfxSaveTabPage::Reset( const SfxItemSet& ) -{ - SvtSaveOptions aSaveOpt; - aLoadUserSettingsCB.Check(aSaveOpt.IsLoadUserSettings()); - aLoadUserSettingsCB.SaveValue(); - aLoadDocPrinterCB.Check( aSaveOpt.IsLoadDocumentPrinter() ); - aLoadDocPrinterCB.SaveValue(); - - if ( !pImpl->bInitialized ) - { - try - { - Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory(); - pImpl->xFact = Reference( - xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY); - - DBG_ASSERT(pImpl->xFact.is(), "service com.sun.star.document.FilterFactory unavailable"); - Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY); - if(xQuery.is()) - { - for(sal_uInt16 n = 0; n < aDocTypeLB.GetEntryCount(); n++) - { - long nData = (long) aDocTypeLB.GetEntryData(n); - OUString sCommand; - sCommand = C2U("matchByDocumentService=%1:iflags="); - sCommand += String::CreateFromInt32(SFX_FILTER_IMPORT|SFX_FILTER_EXPORT); - sCommand += C2U(":eflags="); - sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG); - sCommand += C2U(":default_first"); - String sReplace; - switch(nData) - { - case APP_WRITER : sReplace = C2U("com.sun.star.text.TextDocument"); break; - case APP_WRITER_WEB : sReplace = C2U("com.sun.star.text.WebDocument"); break; - case APP_WRITER_GLOBAL : sReplace = C2U("com.sun.star.text.GlobalDocument"); break; - case APP_CALC : sReplace = C2U("com.sun.star.sheet.SpreadsheetDocument");break; - case APP_IMPRESS : sReplace = C2U("com.sun.star.presentation.PresentationDocument");break; - case APP_DRAW : sReplace = C2U("com.sun.star.drawing.DrawingDocument");break; - case APP_MATH : sReplace = C2U("com.sun.star.formula.FormulaProperties");break; - default: OSL_FAIL("illegal user data"); - } - String sTmp(sCommand); - sTmp.SearchAndReplaceAscii("%1", sReplace); - sCommand = sTmp; - Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand); - SequenceAsVector< OUString > lList; - SequenceAsVector< sal_Bool > lAlienList; - SequenceAsVector< sal_Bool > lODFList; - while(xList->hasMoreElements()) - { - SequenceAsHashMap aFilter(xList->nextElement()); - OUString sFilter = aFilter.getUnpackedValueOrDefault(OUString(RTL_CONSTASCII_USTRINGPARAM("Name")),OUString()); - if (sFilter.getLength()) - { - sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(OUString(RTL_CONSTASCII_USTRINGPARAM("Flags")),sal_Int32()); - lList.push_back(sFilter); - lAlienList.push_back(0 != (nFlags & SFX_FILTER_ALIEN)); - lODFList.push_back( isODFFormat( sFilter ) ); - } - } - pImpl->aFilterArr[nData] = lList.getAsConstList(); - pImpl->aAlienArr[nData] = lAlienList.getAsConstList(); - pImpl->aODFArr[nData] = lODFList.getAsConstList(); - } - } - aDocTypeLB.SelectEntryPos(0); - FilterHdl_Impl(&aDocTypeLB); - } - catch(Exception& e) - { - (void) e; - OSL_FAIL( - rtl::OUStringToOString( - (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "exception in FilterFactory access: ")) + - e.Message), - RTL_TEXTENCODING_UTF8). - getStr()); - } - - pImpl->bInitialized = sal_True; - } - - aDocInfoCB.Check(aSaveOpt.IsDocInfoSave()); - - aBackupCB.Check(aSaveOpt.IsBackup()); - sal_Bool bBackupRO = aSaveOpt.IsReadOnly(SvtSaveOptions::E_BACKUP); - aBackupCB.Enable(!bBackupRO); - aBackupFI.Show(bBackupRO); - - aAutoSaveCB.Check(aSaveOpt.IsAutoSave()); - aWarnAlienFormatCB.Check(aSaveOpt.IsWarnAlienFormat()); - aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT)); - - // the pretty printing - aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting()); - - aAutoSaveEdit.SetValue( aSaveOpt.GetAutoSaveTime() ); - - // relativ speichern - aRelativeFsysCB.Check( aSaveOpt.IsSaveRelFSys() ); - - aRelativeInetCB.Check( aSaveOpt.IsSaveRelINet() ); - - void* pDefaultVersion = (void*)long( aSaveOpt.GetODFDefaultVersion() ); - aODFVersionLB.SelectEntryPos( aODFVersionLB.GetEntryPos( pDefaultVersion ) ); - - AutoClickHdl_Impl( &aAutoSaveCB ); - ODFVersionHdl_Impl( &aODFVersionLB ); - - aDocInfoCB.SaveValue(); - aBackupCB.SaveValue(); - aWarnAlienFormatCB.SaveValue(); - aSizeOptimizationCB.SaveValue(); - aAutoSaveCB.SaveValue(); - aAutoSaveEdit.SaveValue(); - - aRelativeFsysCB.SaveValue(); - aRelativeInetCB.SaveValue(); - aODFVersionLB.SaveValue(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox ) -{ - if ( pBox == &aAutoSaveCB ) - { - if ( aAutoSaveCB.IsChecked() ) - { - aAutoSaveEdit.Enable(); - aMinuteFT.Enable(); - } - else - { - aAutoSaveEdit.Disable(); - aMinuteFT.Disable(); - } - } - return 0; -} - -OUString lcl_ExtracUIName(const Sequence rProperties) -{ - OUString sRet; - const PropertyValue* pProperties = rProperties.getConstArray(); - for(int nProp = 0; nProp < rProperties.getLength(); nProp++) - { - if(!pProperties[nProp].Name.compareToAscii("UIName")) - { - pProperties[nProp].Value >>= sRet; - break; - } - else if(!pProperties[nProp].Name.compareToAscii("Name")) - { - pProperties[nProp].Value >>= sRet; - } - } - return sRet; -} - -IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox ) -{ - sal_uInt16 nCurPos = aDocTypeLB.GetSelectEntryPos(); - - long nData = -1; - if(nCurPos < APP_COUNT) - nData = (long) aDocTypeLB.GetEntryData(nCurPos); - - if ( nData >= 0 && nData < APP_COUNT ) - { - if(&aDocTypeLB == pBox) - { - aSaveAsLB.Clear(); - const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray(); - if(!pImpl->aUIFilterArr[nData].getLength()) - { - pImpl->aUIFilterArr[nData].realloc(pImpl->aFilterArr[nData].getLength()); - OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray(); - for(int nFilter = 0; nFilter < pImpl->aFilterArr[nData].getLength(); nFilter++) - { - Any aProps = pImpl->xFact->getByName(pFilters[nFilter]); - Sequence aProperties; - aProps >>= aProperties; - pUIFilters[nFilter] = lcl_ExtracUIName(aProperties); - } - } - const OUString* pUIFilters = pImpl->aUIFilterArr[nData].getConstArray(); - OUString sSelect; - for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++) - { - sal_uInt16 nEntryPos = aSaveAsLB.InsertEntry(pUIFilters[i]); - if ( pImpl->aODFArr[nData][i] ) - aSaveAsLB.SetEntryData( nEntryPos, (void*)pImpl ); - if(pFilters[i] == pImpl->aDefaultArr[nData]) - sSelect = pUIFilters[i]; - } - if(sSelect.getLength()) - aSaveAsLB.SelectEntry(sSelect); - aSaveAsFI.Show(pImpl->aDefaultReadonlyArr[nData]); - aSaveAsFT.Enable(!pImpl->aDefaultReadonlyArr[nData]); - aSaveAsLB.Enable(!pImpl->aDefaultReadonlyArr[nData]); - } - else - { - OUString sSelect = pBox->GetSelectEntry(); - const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray(); - OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray(); - for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++) - if(pUIFilters[i] == sSelect) - { - sSelect = pFilters[i]; - break; - } - - pImpl->aDefaultArr[nData] = sSelect; - } - } - - ODFVersionHdl_Impl( &aSaveAsLB ); - return 0; -}; - -IMPL_LINK( SfxSaveTabPage, ODFVersionHdl_Impl, ListBox *, EMPTYARG ) -{ - long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) ); - bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != SvtSaveOptions::ODFVER_LATEST; - if ( bShown ) - { - bool bHasODFFormat = false; - sal_uInt16 i = 0, nCount = aSaveAsLB.GetEntryCount(); - for ( ; i < nCount; ++ i ) - { - if ( aSaveAsLB.GetEntryData(i) != NULL ) - { - bHasODFFormat = true; - break; - } - } - - bShown = !bHasODFFormat - || ( aSaveAsLB.GetEntryData( aSaveAsLB.GetSelectEntryPos() ) != NULL ); - } - - aODFWarningFI.Show( bShown ); - aODFWarningFT.Show( bShown ); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optsave.hrc b/cui/source/options/optsave.hrc deleted file mode 100644 index 06388569e..000000000 --- a/cui/source/options/optsave.hrc +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTSAVE_HRC -#define _SVX_OPTSAVE_HRC - -// defines ------------------------------------------------------------------ - -#define LB_LOAD 10 -#define CB_LOAD_SETTINGS 11 -#define CB_LOAD_DOCPRINTER 12 -#define GB_SAVE 13 -#define BTN_DOCINFO 14 -#define BTN_BACKUP 15 -#define BTN_AUTOSAVE 16 -#define ED_AUTOSAVE 17 -#define FT_MINUTE 18 -#define BTN_AUTOSAVEPROMPT 19 -#define BTN_NOPRETTYPRINTING 20 -#define FI_BACKUP 21 -#define BTN_WARNALIENFORMAT 22 -#define FT_ODF_VERSION 23 -#define LB_ODF_VERSION 24 - -#define GB_RELATIVE 40 -#define BTN_RELATIVE_FSYS 41 -#define BTN_RELATIVE_INET 42 - -#define FL_FILTER 43 -#define FT_APP 44 -#define LB_APP 45 -#define FT_FILTER 46 -#define LB_FILTER 47 -#define FI_FILTER 48 -#define FT_WARN 49 -#define FI_ODF_WARNING 50 - -#define IMG_ODF_WARNING 1 - -#define APP_WRITER 0 -#define APP_WRITER_WEB 1 -#define APP_WRITER_GLOBAL 2 -#define APP_CALC 3 -#define APP_IMPRESS 4 -#define APP_DRAW 5 -#define APP_MATH 6 -#define APP_COUNT 7 - -//Filter warning -#define PB_OK 1 -#define FT_FILTER_WARNING 2 -#define CB_DONT_SHOW_AGAIN 3 -#define IMG_WARNING 4 -#define PB_CANCEL 5 - -#endif // #ifndef _SVX_OPTSAVE_HRC - diff --git a/cui/source/options/optsave.hxx b/cui/source/options/optsave.hxx deleted file mode 100644 index 844c189e9..000000000 --- a/cui/source/options/optsave.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTSAVE_HXX -#define _SVX_OPTSAVE_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - -namespace com { namespace sun { namespace star { - namespace beans { - struct PropertyValue; -}}}} - -// define ---------------------------------------------------------------- - -#define SfxSaveTabPage SvxSaveTabPage - -// class SvxSaveTabPage -------------------------------------------------- - -struct SvxSaveTabPage_Impl; - -class SvxSaveTabPage : public SfxTabPage -{ -private: - FixedLine aLoadFL; - CheckBox aLoadUserSettingsCB; - CheckBox aLoadDocPrinterCB; - - FixedLine aSaveFL; - CheckBox aDocInfoCB; - ReadOnlyImage aBackupFI; - CheckBox aBackupCB; - CheckBox aAutoSaveCB; - NumericField aAutoSaveEdit; - FixedText aMinuteFT; - CheckBox aRelativeFsysCB; - CheckBox aRelativeInetCB; - - FixedLine aDefaultFormatFL; - FixedText aODFVersionFT; - ListBox aODFVersionLB; - CheckBox aSizeOptimizationCB; - CheckBox aWarnAlienFormatCB; - FixedText aDocTypeFT; - ListBox aDocTypeLB; - FixedText aSaveAsFT; - ReadOnlyImage aSaveAsFI; - ListBox aSaveAsLB; - FixedImage aODFWarningFI; - FixedText aODFWarningFT; - - SvxSaveTabPage_Impl* pImpl; - -#ifdef _SVX_OPTSAVE_CXX - DECL_LINK( AutoClickHdl_Impl, CheckBox * ); - DECL_LINK( FilterHdl_Impl, ListBox * ); - DECL_LINK( ODFVersionHdl_Impl, ListBox * ); - - void DetectHiddenControls(); -#endif - -public: - SvxSaveTabPage( Window* pParent, const SfxItemSet& rSet ); - virtual ~SvxSaveTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); -}; - -#endif // #ifndef _SVX_OPTSAVE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optsave.src b/cui/source/options/optsave.src deleted file mode 100644 index 7dc387aae..000000000 --- a/cui/source/options/optsave.src +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- -#include -#include -#include "helpid.hrc" -#include "optsave.hrc" - - // SID_SFXPAGE_SAVE ------------------------------------------------------ -#define TEXT_SAVEPAGE \ - Text [ en-US ] = "Save" ;\ - -TabPage RID_SFXPAGE_SAVE -{ - HelpId = HID_OPTIONS_SAVE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - TEXT_SAVEPAGE - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine LB_LOAD - { - Pos = MAP_APPFONT ( 6 , 2 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Load"; - }; - CheckBox CB_LOAD_SETTINGS - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:CB_LOAD_SETTINGS"; - Pos = MAP_APPFONT ( 12 , 11 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "Load user-specific settings with the document"; - }; - CheckBox CB_LOAD_DOCPRINTER - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:CB_LOAD_DOCPRINTER"; - Pos = MAP_APPFONT ( 12 , 22 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "Load printer settings with the document"; - }; - FixedLine GB_SAVE - { - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Save" ; - }; - CheckBox BTN_DOCINFO - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_DOCINFO"; - Pos = MAP_APPFONT ( 12 , 41 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "~Edit document properties before saving" ; - TabStop = TRUE ; - }; - FixedImage FI_BACKUP - { - Pos = MAP_APPFONT ( 5, 53 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - CheckBox BTN_BACKUP - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_BACKUP"; - Pos = MAP_APPFONT ( 12 , 52 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "Al~ways create backup copy" ; - }; - CheckBox BTN_AUTOSAVE - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_AUTOSAVE"; - Pos = MAP_APPFONT ( 12 , 63 ) ; - Size = MAP_APPFONT ( 193 , 10 ) ; - Text [ en-US ] = "Save ~AutoRecovery information every" ; - }; - NumericField ED_AUTOSAVE - { - HelpID = "cui:NumericField:RID_SFXPAGE_SAVE:ED_AUTOSAVE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 210 , 61 ) ; - Size = MAP_APPFONT ( 21 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 60 ; - StrictFormat = TRUE ; - First = 1 ; - Last = 60 ; - SpinSize = 1 ; - TabStop = TRUE ; - }; - FixedText FT_MINUTE - { - Pos = MAP_APPFONT ( 234 , 63 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "Minutes" ; - }; - CheckBox BTN_RELATIVE_FSYS - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_RELATIVE_FSYS"; - Pos = MAP_APPFONT ( 12 , 74 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "Save URLs relative to file system" ; - }; - CheckBox BTN_RELATIVE_INET - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_RELATIVE_INET"; - Pos = MAP_APPFONT ( 12 , 85 ) ; - Size = MAP_APPFONT ( 248 , 10 ) ; - Text [ en-US ] = "Save URLs relative to internet" ; - }; - FixedLine FL_FILTER - { - Pos = MAP_APPFONT ( 6 , 97 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Default file format and ODF settings" ; - }; - FixedText FT_ODF_VERSION - { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 121 , 8 ) ; - Text [ en-US ] = "ODF format version" ; - }; - ListBox LB_ODF_VERSION - { - HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_ODF_VERSION"; - Pos = MAP_APPFONT ( 136 , 105 ) ; - Size = MAP_APPFONT ( 108 , 58 ) ; - Border = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "1.0/1.1" ; 2 ; > ; - < "1.2" ; 4 ; > ; - < "1.2 Extended (recommended)"; 0x7fffffff ; > ; - }; - }; - CheckBox BTN_NOPRETTYPRINTING - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_NOPRETTYPRINTING"; - Pos = MAP_APPFONT ( 12 , 120 ) ; - Size = MAP_APPFONT ( 248 , 10 ) ; - Text [ en-US ] = "Size optimization for ODF format" ; - }; - CheckBox BTN_WARNALIENFORMAT - { - HelpID = "cui:CheckBox:RID_SFXPAGE_SAVE:BTN_WARNALIENFORMAT"; - Pos = MAP_APPFONT ( 12 , 131 ) ; - Size = MAP_APPFONT ( 248 , 10 ) ; - Text [ en-US ] = "Warn when not saving in ODF or default format" ; - }; - FixedText FT_APP - { - Pos = MAP_APPFONT ( 12 , 142 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "D~ocument type"; - }; - FixedText FT_FILTER - { - Pos = MAP_APPFONT ( 136 , 142 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Always sa~ve as"; - }; - ListBox LB_APP - { - HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_APP"; - Pos = MAP_APPFONT ( 12 , 153 ) ; - Size = MAP_APPFONT ( 108 , 58 ) ; - Border = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Text document" ; APP_WRITER ; > ; - < "HTML document" ; APP_WRITER_WEB; > ; - < "Master document" ; APP_WRITER_GLOBAL; > ; - < "Spreadsheet" ; APP_CALC ; > ; - < "Presentation" ; APP_IMPRESS ; > ; - < "Drawing" ; APP_DRAW ; > ; - < "Formula" ; APP_MATH ; > ; - }; - }; - FixedImage FI_FILTER - { - Pos = MAP_APPFONT ( 129, 154 ) ; - Size = MAP_APPFONT ( 6 , 6 ) ; - Hide = TRUE; - }; - ListBox LB_FILTER - { - HelpID = "cui:ListBox:RID_SFXPAGE_SAVE:LB_FILTER"; - Pos = MAP_APPFONT ( 136 , 153 ) ; - Size = MAP_APPFONT ( 108 , 58 ) ; - Border = TRUE; - Sort = TRUE; - DropDown = TRUE; - }; - FixedImage FI_ODF_WARNING - { - Pos = MAP_APPFONT ( 12, 169 ) ; - Size = MAP_APPFONT ( 8 , 8 ) ; - Hide = TRUE; - }; - FixedText FT_WARN - { - Pos = MAP_APPFONT ( 23 , 169 ) ; - Size = MAP_APPFONT ( 239 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "Not using ODF 1.2 Extended may cause infomation to be lost."; - Text [ x-comment ] = "EN-US, the term 'extended' must not be translated."; - }; - Image IMG_ODF_WARNING - { - ImageBitmap = Bitmap - { - File = "odfwarning.png"; - }; - MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; }; - }; -}; - -ModalDialog RID_SVXDLG_FILTER_WARNING -{ - HelpID = HID_SVXDLG_FILTER_WARNING; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Sizeable = FALSE ; - Border = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 175 + 39 + (3 * 6), (4 * 9)+ 12 + (3 * 12) + 6 - 21 ); - Text = "%PRODUCTNAME %PRODUCTVERSION" ; - FixedImage IMG_WARNING - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 30, 30 ); - }; - FixedText FT_FILTER_WARNING - { - Pos = MAP_APPFONT( 39, 6 ); - Size = MAP_APPFONT( 175, 4 * 9 ); - Wordbreak = TRUE; - Text [ en-US ] = "Using \"%1\" as default file format may cause information loss.\n"; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT( 60, (4 * 9)/*+ 12*/ + 13 ); - Size = MAP_APPFONT( 50, 14 ); - DefButton = TRUE; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT( 120, (4 * 9)/*+ 12*/ + 13 ); - Size = MAP_APPFONT( 50, 14 ); - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx deleted file mode 100644 index adcca4524..000000000 --- a/cui/source/options/optupdt.cxx +++ /dev/null @@ -1,411 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include "optupdt.hxx" -#include "optupdt.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace beans = ::com::sun::star::beans; -namespace container = ::com::sun::star::container; -namespace dialogs = ::com::sun::star::ui::dialogs; -namespace frame = ::com::sun::star::frame; -namespace lang = ::com::sun::star::lang; -namespace uno = ::com::sun::star::uno; -namespace util = ::com::sun::star::util; - -// define ---------------------------------------------------------------- - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -// class SvxOnlineUpdateTabPage -------------------------------------------------- - -SvxOnlineUpdateTabPage::SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ONLINEUPDATE ), rSet ), - m_aOptionsLine( this, CUI_RES( FL_OPTIONS ) ), - m_aAutoCheckCheckBox( this, CUI_RES( CB_AUTOCHECK ) ), - m_aEveryDayButton( this, CUI_RES( RB_EVERYDAY ) ), - m_aEveryWeekButton( this, CUI_RES( RB_EVERYWEEK ) ), - m_aEveryMonthButton( this, CUI_RES( RB_EVERYMONTH ) ), - m_aCheckNowButton( this, CUI_RES( PB_CHECKNOW ) ), - m_aAutoDownloadCheckBox( this, CUI_RES( CB_AUTODOWNLOAD ) ), - m_aDestPathLabel( this, CUI_RES( FT_DESTPATHLABEL ) ), - m_aDestPath( this, CUI_RES( FT_DESTPATH ) ), - m_aChangePathButton( this, CUI_RES( PB_CHANGEPATH ) ), - m_aLastChecked( this, CUI_RES( FT_LASTCHECKED ) ) -{ - m_aNeverChecked = String( CUI_RES( STR_NEVERCHECKED ) ); - FreeResource(); - - m_aAutoCheckCheckBox.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, AutoCheckHdl_Impl ) ); - m_aCheckNowButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, CheckNowHdl_Impl ) ); - m_aChangePathButton.SetClickHdl( LINK( this, SvxOnlineUpdateTabPage, FileDialogHdl_Impl ) ); - - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - - m_xUpdateAccess = uno::Reference < container::XNameReplace >( - xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), - uno::UNO_QUERY_THROW ); - - sal_Bool bDownloadSupported = sal_False; - m_xUpdateAccess->getByName( UNISTRING( "DownloadSupported") ) >>= bDownloadSupported; - - WinBits nStyle = m_aDestPath.GetStyle(); - nStyle |= WB_PATHELLIPSIS; - m_aDestPath.SetStyle(nStyle); - - m_aAutoDownloadCheckBox.Show(bDownloadSupported); - m_aDestPathLabel.Show(bDownloadSupported); - m_aDestPath.Show(bDownloadSupported); - m_aChangePathButton.Show(bDownloadSupported); - - // dynamical length of the PushButtons - CalcButtonWidth(); - - m_aLastCheckedTemplate = m_aLastChecked.GetText(); - - UpdateLastCheckedText(); -} - -// ----------------------------------------------------------------------- - -SvxOnlineUpdateTabPage::~SvxOnlineUpdateTabPage() -{ -} - -// ----------------------------------------------------------------------- -void SvxOnlineUpdateTabPage::UpdateLastCheckedText() -{ - rtl::OUString aDateStr; - rtl::OUString aTimeStr; - rtl::OUString aText; - sal_Int64 lastChecked = 0; - - m_xUpdateAccess->getByName( UNISTRING( "LastCheck") ) >>= lastChecked; - - if( lastChecked == 0 ) // never checked - { - aText = m_aNeverChecked; - } - else - { - TimeValue lastCheckedTV; - oslDateTime lastCheckedDT; - - Date aDate; - Time aTime; - - lastCheckedTV.Seconds = (sal_uInt32) lastChecked; - osl_getLocalTimeFromSystemTime( &lastCheckedTV, &lastCheckedTV ); - - if ( osl_getDateTimeFromTimeValue( &lastCheckedTV, &lastCheckedDT ) ) - { - aDate = Date( lastCheckedDT.Day, lastCheckedDT.Month, lastCheckedDT.Year ); - aTime = Time( lastCheckedDT.Hours, lastCheckedDT.Minutes ); - } - - LanguageType eUILang = Application::GetSettings().GetUILanguage(); - SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), eUILang ); - String aTmpStr; - Color* pColor = NULL; - Date* pNullDate = pNumberFormatter->GetNullDate(); - sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang ); - - pNumberFormatter->GetOutputString( aDate - *pNullDate, nFormat, aTmpStr, &pColor ); - aDateStr = aTmpStr; - - nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang ); - pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor ); - aTimeStr = aTmpStr; - - delete pColor; - delete pNumberFormatter; - - aText = m_aLastCheckedTemplate; - sal_Int32 nIndex = aText.indexOf( UNISTRING( "%DATE%" ) ); - if ( nIndex != -1 ) - aText = aText.replaceAt( nIndex, 6, aDateStr ); - - nIndex = aText.indexOf( UNISTRING( "%TIME%" ) ); - if ( nIndex != -1 ) - aText = aText.replaceAt( nIndex, 6, aTimeStr ); - } - - m_aLastChecked.SetText( aText ); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* -SvxOnlineUpdateTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxOnlineUpdateTabPage( pParent, rAttrSet ); -} - -// ----------------------------------------------------------------------- - - -sal_Bool SvxOnlineUpdateTabPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bModified = sal_False; - - sal_Bool bValue; - sal_Int64 nValue; - - if( m_aAutoCheckCheckBox.GetSavedValue() != m_aAutoCheckCheckBox.IsChecked() ) - { - bValue = (sal_True == m_aAutoCheckCheckBox.IsChecked()); - m_xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), uno::makeAny( bValue ) ); - bModified = sal_True; - } - - nValue = 0; - if( sal_True == m_aEveryDayButton.IsChecked() ) - { - if( sal_False == m_aEveryDayButton.GetSavedValue() ) - nValue = 86400; - } - else if( sal_True == m_aEveryWeekButton.IsChecked() ) - { - if( sal_False == m_aEveryWeekButton.GetSavedValue() ) - nValue = 604800; - } - else if( sal_True == m_aEveryMonthButton.IsChecked() ) - { - if( sal_False == m_aEveryMonthButton.GetSavedValue() ) - nValue = 2592000; - } - - if( nValue > 0 ) - { - m_xUpdateAccess->replaceByName( UNISTRING("CheckInterval"), uno::makeAny( nValue ) ); - bModified = sal_True; - } - - if( m_aAutoDownloadCheckBox.GetSavedValue() != m_aAutoDownloadCheckBox.IsChecked() ) - { - bValue = (sal_True == m_aAutoDownloadCheckBox.IsChecked()); - m_xUpdateAccess->replaceByName( UNISTRING("AutoDownloadEnabled"), uno::makeAny( bValue ) ); - bModified = sal_True; - } - - rtl::OUString sValue, aURL; - m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue; - - if( ( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) ) && - ( ! aURL.equals( sValue ) ) ) - { - m_xUpdateAccess->replaceByName( UNISTRING("DownloadDestination"), uno::makeAny( aURL ) ); - bModified = sal_True; - } - - uno::Reference< util::XChangesBatch > xChangesBatch(m_xUpdateAccess, uno::UNO_QUERY); - if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) - xChangesBatch->commitChanges(); - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxOnlineUpdateTabPage::Reset( const SfxItemSet& ) -{ - sal_Bool bValue = sal_Bool(); - m_xUpdateAccess->getByName( UNISTRING("AutoCheckEnabled") ) >>= bValue; - - m_aAutoCheckCheckBox.Check(bValue); - m_aEveryDayButton.Enable(bValue); - m_aEveryWeekButton.Enable(bValue); - m_aEveryMonthButton.Enable(bValue); - - sal_Int64 nValue = 0; - m_xUpdateAccess->getByName( UNISTRING("CheckInterval") ) >>= nValue; - - if( nValue == 86400 ) - m_aEveryDayButton.Check(); - else if( nValue == 604800 ) - m_aEveryWeekButton.Check(); - else - m_aEveryMonthButton.Check(); - - m_aAutoCheckCheckBox.SaveValue(); - m_aEveryDayButton.SaveValue(); - m_aEveryWeekButton.SaveValue(); - m_aEveryMonthButton.SaveValue(); - - m_xUpdateAccess->getByName( UNISTRING("AutoDownloadEnabled") ) >>= bValue; - m_aAutoDownloadCheckBox.Check(bValue); - m_aDestPathLabel.Enable(sal_True); - m_aDestPath.Enable(sal_True); - m_aChangePathButton.Enable(sal_True); - - rtl::OUString sValue, aPath; - m_xUpdateAccess->getByName( UNISTRING("DownloadDestination") ) >>= sValue; - - if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sValue, aPath) ) - m_aDestPath.SetText(aPath); - - m_aAutoDownloadCheckBox.SaveValue(); -} - -// ----------------------------------------------------------------------- - -void SvxOnlineUpdateTabPage::FillUserData() -{ -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, CheckBox *, pBox ) -{ - sal_Bool bEnabled = pBox->IsChecked(); - - m_aEveryDayButton.Enable(bEnabled); - m_aEveryWeekButton.Enable(bEnabled); - m_aEveryMonthButton.Enable(bEnabled); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxOnlineUpdateTabPage, FileDialogHdl_Impl, PushButton *, EMPTYARG ) -{ - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < dialogs::XFolderPicker > xFolderPicker( - xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ) ), - uno::UNO_QUERY ); - - rtl::OUString aURL; - if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) ) - osl::Security().getHomeDir(aURL); - - xFolderPicker->setDisplayDirectory( aURL ); - sal_Int16 nRet = xFolderPicker->execute(); - - if ( dialogs::ExecutableDialogResults::OK == nRet ) - { - rtl::OUString aFolder; - if( osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(xFolderPicker->getDirectory(), aFolder)) - m_aDestPath.SetText( aFolder ); - } - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxOnlineUpdateTabPage, CheckNowHdl_Impl, PushButton *, EMPTYARG ) -{ - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - - try - { - uno::Reference< lang::XMultiServiceFactory > xConfigProvider( - xFactory->createInstance( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" )), - uno::UNO_QUERY_THROW); - - beans::PropertyValue aProperty; - aProperty.Name = UNISTRING( "nodepath" ); - aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] = uno::makeAny( aProperty ); - - uno::Reference< container::XNameAccess > xNameAccess( - xConfigProvider->createInstanceWithArguments( - UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ), - uno::UNO_QUERY_THROW ); - - util::URL aURL; - xNameAccess->getByName(UNISTRING("URL")) >>= aURL.Complete; - - uno::Reference < util::XURLTransformer > xTransformer( - xFactory->createInstance( UNISTRING( "com.sun.star.util.URLTransformer" ) ), - uno::UNO_QUERY_THROW ); - - xTransformer->parseStrict(aURL); - - uno::Reference < frame::XDesktop > xDesktop( - xFactory->createInstance( UNISTRING( "com.sun.star.frame.Desktop" ) ), - uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDispatchProvider > xDispatchProvider( - xDesktop->getCurrentFrame(), uno::UNO_QUERY ); - - uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); - - if( xDispatch.is() ) - { - xDispatch->dispatch(aURL, uno::Sequence< beans::PropertyValue > ()); - UpdateLastCheckedText(); - } - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - - return 0; -} - -void SvxOnlineUpdateTabPage::CalcButtonWidth() -{ - // detect the longest button text - long nTxtWidth = ::std::max( m_aCheckNowButton.GetCtrlTextWidth( m_aCheckNowButton.GetText() ), - m_aCheckNowButton.GetCtrlTextWidth( m_aChangePathButton.GetText() ) ); - // add a little offset - nTxtWidth = nTxtWidth + 12; - // compare with the button width - Size aSize = m_aCheckNowButton.GetSizePixel(); - // and change it if it's necessary - if ( nTxtWidth > aSize.Width() ) - { - aSize.Width() = nTxtWidth; - m_aCheckNowButton.SetSizePixel( aSize ); - m_aChangePathButton.SetSizePixel( aSize ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optupdt.hrc b/cui/source/options/optupdt.hrc deleted file mode 100644 index 9848f6383..000000000 --- a/cui/source/options/optupdt.hrc +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_OPTUPDT_HRC -#define _SVX_OPTUPDT_HRC - -// defines --------------------------------------------------------------- - -// class SvxOnlineUpdateTabPage ---------------------------------------------- - -#define FL_OPTIONS 10 -#define CB_AUTOCHECK 11 -#define RB_EVERYDAY 12 -#define RB_EVERYWEEK 13 -#define RB_EVERYMONTH 14 -#define PB_CHECKNOW 15 -#define CB_AUTODOWNLOAD 16 -#define FT_DESTPATHLABEL 17 -#define FT_DESTPATH 18 -#define PB_CHANGEPATH 19 -#define FT_LASTCHECKED 20 -#define STR_NEVERCHECKED 21 - - -#endif // #ifndef _SVX_OPTUPDT_HRC - diff --git a/cui/source/options/optupdt.hxx b/cui/source/options/optupdt.hxx deleted file mode 100644 index 7bb376133..000000000 --- a/cui/source/options/optupdt.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_OPTUPDT_HXX -#define _SVX_OPTUPDT_HXX - -// include --------------------------------------------------------------- - -#include -#include -#include - -// class SvxPathTabPage -------------------------------------------------- - -class SvxOnlineUpdateTabPage : public SfxTabPage -{ -private: - FixedLine m_aOptionsLine; - CheckBox m_aAutoCheckCheckBox; - RadioButton m_aEveryDayButton; - RadioButton m_aEveryWeekButton; - RadioButton m_aEveryMonthButton; - PushButton m_aCheckNowButton; - CheckBox m_aAutoDownloadCheckBox; - FixedText m_aDestPathLabel; - FixedText m_aDestPath; - PushButton m_aChangePathButton; - FixedText m_aLastChecked; - rtl::OUString m_aNeverChecked; - rtl::OUString m_aLastCheckedTemplate; - - DECL_LINK( FileDialogHdl_Impl, PushButton* ) ; - DECL_LINK( CheckNowHdl_Impl, PushButton* ) ; - DECL_LINK( AutoCheckHdl_Impl, CheckBox* ) ; - - void CalcButtonWidth(); - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > m_xUpdateAccess; - - void UpdateLastCheckedText(); - -public: - SvxOnlineUpdateTabPage( Window* pParent, const SfxItemSet& rSet ); - ~SvxOnlineUpdateTabPage(); - - static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet ); - - virtual sal_Bool FillItemSet( SfxItemSet& rSet ); - virtual void Reset( const SfxItemSet& rSet ); - virtual void FillUserData(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/optupdt.src b/cui/source/options/optupdt.src deleted file mode 100644 index ad1202739..000000000 --- a/cui/source/options/optupdt.src +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include -------------------------------------------------------------- -#include "optupdt.hrc" -#include -#include "helpid.hrc" - - // RID_SVXPAGE_ONLINEUPDATE -------------------------------------------- -TabPage RID_SVXPAGE_ONLINEUPDATE -{ - HelpId = HID_SVX_OPTIONS_ONLINEUPDATE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "OnlineUpdate" ; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Online Update Options" ; - }; - CheckBox CB_AUTOCHECK - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ONLINEUPDATE:CB_AUTOCHECK"; - Pos = MAP_APPFONT ( 12, 14 ) ; - Size = MAP_APPFONT ( 210, 10 ) ; - Text [ en-US ] = "~Check for updates automatically" ; - }; - RadioButton RB_EVERYDAY - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ONLINEUPDATE:RB_EVERYDAY"; - Pos = MAP_APPFONT ( 18, 27 ) ; - Size = MAP_APPFONT ( 160, 10 ) ; - Text [ en-US ] = "Every Da~y" ; - }; - RadioButton RB_EVERYWEEK - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ONLINEUPDATE:RB_EVERYWEEK"; - Pos = MAP_APPFONT ( 18, 40 ) ; - Size = MAP_APPFONT ( 160, 10 ) ; - Text [ en-US ] = "Every ~Week" ; - }; - RadioButton RB_EVERYMONTH - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ONLINEUPDATE:RB_EVERYMONTH"; - Pos = MAP_APPFONT ( 18, 53 ) ; - Size = MAP_APPFONT ( 160, 10 ) ; - Text [ en-US ] = "Every ~Month" ; - }; - FixedText FT_LASTCHECKED - { - Pos = MAP_APPFONT ( 12, 69 ) ; - Size = MAP_APPFONT ( 160, 10 ) ; - Text [ en-US ] = "Last checked: %DATE%, %TIME%" ; - }; - PushButton PB_CHECKNOW - { - HelpID = "cui:PushButton:RID_SVXPAGE_ONLINEUPDATE:PB_CHECKNOW"; - Pos = MAP_APPFONT ( 12, 82 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - Text [ en-US ] = "Check ~now" ; - }; - CheckBox CB_AUTODOWNLOAD - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ONLINEUPDATE:CB_AUTODOWNLOAD"; - Pos = MAP_APPFONT ( 12, 130 ) ; - Size = MAP_APPFONT ( 160, 10 ) ; - Text [ en-US ] = "~Download updates automatically" ; - }; - FixedText FT_DESTPATHLABEL - { - Pos = MAP_APPFONT ( 22, 143 ) ; - Size = MAP_APPFONT ( 150, 8 ) ; - Text [ en-US ] = "Download destination:" ; - }; - FixedText FT_DESTPATH - { - Pos = MAP_APPFONT ( 22, 154 ) ; - Size = MAP_APPFONT ( 138, 8 ) ; - }; - PushButton PB_CHANGEPATH - { - HelpID = "cui:PushButton:RID_SVXPAGE_ONLINEUPDATE:PB_CHANGEPATH"; - Pos = MAP_APPFONT ( 162, 151 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - Text [ en-US ] = "Ch~ange..." ; - }; - String STR_NEVERCHECKED - { - Text [ en-US ] = "Last checked: Not yet" ; - }; -}; diff --git a/cui/source/options/radiobtnbox.cxx b/cui/source/options/radiobtnbox.cxx deleted file mode 100644 index ca30c33ea..000000000 --- a/cui/source/options/radiobtnbox.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "radiobtnbox.hxx" -#include - -namespace svx { - -// class SvxRadioButtonListBox ---------------------------------------------------- - -SvxRadioButtonListBox::SvxRadioButtonListBox(SvxSimpleTableContainer& rParent, WinBits nBits) - : SvxSimpleTable(rParent, nBits) - -{ - EnableCheckButton( new SvLBoxButtonData( this, true ) ); -} - -SvxRadioButtonListBox::~SvxRadioButtonListBox() -{ -} - -void SvxRadioButtonListBox::SetTabs() -{ - SvxSimpleTable::SetTabs(); -} - -void SvxRadioButtonListBox::MouseButtonUp( const MouseEvent& _rMEvt ) -{ - m_aCurMousePoint = _rMEvt.GetPosPixel(); - SvxSimpleTable::MouseButtonUp( _rMEvt ); -} - -void SvxRadioButtonListBox::KeyInput( const KeyEvent& rKEvt ) -{ - if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() ) - { - SvLBoxEntry* pEntry = FirstSelected(); - if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED ) - { - SetCheckButtonState( pEntry, SV_BUTTON_CHECKED ); - GetCheckButtonHdl().Call( NULL ); - return ; - } - } - - SvxSimpleTable::KeyInput( rKEvt ); -} - -void SvxRadioButtonListBox::HandleEntryChecked( SvLBoxEntry* _pEntry ) -{ - Select( _pEntry, sal_True ); - SvButtonState eState = GetCheckButtonState( _pEntry ); - - if ( SV_BUTTON_CHECKED == eState ) - { - // we have radio button behavior -> so uncheck the other entries - SvLBoxEntry* pEntry = First(); - while ( pEntry ) - { - if ( pEntry != _pEntry ) - SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED ); - pEntry = Next( pEntry ); - } - } - else - SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED ); -} - -const Point& SvxRadioButtonListBox::GetCurMousePoint() const -{ - return m_aCurMousePoint; -} - -} // end of namespace ::svx - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/readonlyimage.cxx b/cui/source/options/readonlyimage.cxx deleted file mode 100644 index b481c631b..000000000 --- a/cui/source/options/readonlyimage.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include - -ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) : - FixedImage(pParent, rResId) -{ - SetImage( Image(CUI_RES( RID_SVXBMP_LOCK ))); -} - -ReadOnlyImage::~ReadOnlyImage() -{ -} - -void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt ) -{ - if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() ) - { - Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) ); - Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ), - OutputToScreenPixel( aLogicPix.BottomRight() ) ); - - String aStr(ReadOnlyImage::GetHelpTip()); - if ( Help::IsBalloonHelpEnabled() ) - Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, - aStr ); - else if ( Help::IsQuickHelpEnabled() ) - Help::ShowQuickHelp( this, aScreenRect, aStr ); - } - else - Window::RequestHelp( rHEvt ); -} - -const String& ReadOnlyImage::GetHelpTip() -{ - static String aStr(CUI_RES(RID_SVXSTR_READONLY_CONFIG_TIP)); - return aStr; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/readonlyimage.hxx b/cui/source/options/readonlyimage.hxx deleted file mode 100644 index d10b492e9..000000000 --- a/cui/source/options/readonlyimage.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_READONLYIMAGE_HXX -#define _SVX_READONLYIMAGE_HXX - -#include - -class ReadOnlyImage : public FixedImage -{ -public: - ReadOnlyImage(Window* pParent, const ResId rResId); - ~ReadOnlyImage(); - - virtual void RequestHelp( const HelpEvent& rHEvt ); - static const String& GetHelpTip(); - -}; -#endif // - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/readonlyimage.src b/cui/source/options/readonlyimage.src deleted file mode 100644 index 4a42c4d56..000000000 --- a/cui/source/options/readonlyimage.src +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -String RID_SVXSTR_READONLY_CONFIG_TIP -{ - Text [ en-US ] = "This setting is protected by the Administrator"; -}; -Image RID_SVXBMP_LOCK -{ - ImageBitmap = Bitmap - { - File = "lock.bmp"; - }; - MaskColor = Color { Red=0xffff; Green=0x0000; Blue=0xffff; }; -}; diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx deleted file mode 100644 index 2fbfdd6d8..000000000 --- a/cui/source/options/sdbcdriverenum.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "sdbcdriverenum.hxx" -#include -#include -#include -#include -#include - -//........................................................................ -namespace offapp -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; - - //==================================================================== - //= ODriverEnumerationImpl - //==================================================================== - class ODriverEnumerationImpl - { - protected: - ::std::vector< ::rtl::OUString > m_aImplNames; - - public: - ODriverEnumerationImpl(); - - const ::std::vector< ::rtl::OUString >& getDriverImplNames() const { return m_aImplNames; } - }; - - //-------------------------------------------------------------------- - ODriverEnumerationImpl::ODriverEnumerationImpl() - { - try - { - Reference< XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); - Reference< XInterface > xDM = xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager") ) ); - OSL_ENSURE(xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: no access to the SDBC driver manager!"); - - Reference< XEnumerationAccess > xEnumAccess(xDM, UNO_QUERY); - OSL_ENSURE(xEnumAccess.is() || !xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: can't enumerate SDBC drivers (missing the interface)!"); - if (xEnumAccess.is()) - { - Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration(); - OSL_ENSURE(xEnumDrivers.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: invalid enumeration object!"); - - Reference< XServiceInfo > xDriverSI; - while (xEnumDrivers->hasMoreElements()) - { - xEnumDrivers->nextElement() >>= xDriverSI; - OSL_ENSURE(xDriverSI.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: driver without service info!"); - if (xDriverSI.is()) - m_aImplNames.push_back(xDriverSI->getImplementationName()); - } - } - } - catch(const Exception&) - { - OSL_FAIL("ODriverEnumerationImpl::ODriverEnumerationImpl: caught an exception while enumerating the drivers!"); - } - } - - //==================================================================== - //= ODriverEnumeration - //==================================================================== - //-------------------------------------------------------------------- - ODriverEnumeration::ODriverEnumeration() throw() - :m_pImpl(new ODriverEnumerationImpl) - { - } - - //-------------------------------------------------------------------- - ODriverEnumeration::~ODriverEnumeration() throw() - { - delete m_pImpl; - } - - //-------------------------------------------------------------------- - ODriverEnumeration::const_iterator ODriverEnumeration::begin() const throw() - { - return m_pImpl->getDriverImplNames().begin(); - } - - //-------------------------------------------------------------------- - ODriverEnumeration::const_iterator ODriverEnumeration::end() const throw() - { - return m_pImpl->getDriverImplNames().end(); - } -//........................................................................ -} // namespace offapp -//........................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/sdbcdriverenum.hxx b/cui/source/options/sdbcdriverenum.hxx deleted file mode 100644 index a4254d030..000000000 --- a/cui/source/options/sdbcdriverenum.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OFFMGR_SDBCDRIVERENUMERATION_HXX_ -#define _OFFMGR_SDBCDRIVERENUMERATION_HXX_ - - -#include - -#include - -namespace rtl -{ - class OUString; -} - -//........................................................................ -namespace offapp -{ -//........................................................................ - - //==================================================================== - //= ODriverEnumeration - //==================================================================== - class ODriverEnumerationImpl; - /** simple class for accessing SDBC drivers registered within the office -

Rather small, introduced to not contaminate other instances with the - exception handling (code-size-bloating) implementations here. -

- */ - class ODriverEnumeration - { - private: - ODriverEnumerationImpl* m_pImpl; - - public: - ODriverEnumeration() throw(); - ~ODriverEnumeration() throw(); - typedef ::std::vector< ::rtl::OUString >::const_iterator const_iterator; - - const_iterator begin() const throw(); - const_iterator end() const throw(); - }; - -//........................................................................ -} // namespace offapp -//........................................................................ - -#endif // _OFFMGR_SDBCDRIVERENUMERATION_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx deleted file mode 100644 index ee1c482e0..000000000 --- a/cui/source/options/securityoptions.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include "securityoptions.hxx" -#include "securityoptions.hrc" - -namespace -{ - bool enableAndSet( const SvtSecurityOptions& rOptions, - SvtSecurityOptions::EOption eOption, - CheckBox& rCheckBox, FixedImage& rFixedImage ) - { - bool bEnable = rOptions.IsOptionEnabled( eOption ); - rCheckBox.Enable( bEnable ); - rFixedImage.Show( !bEnable ); - rCheckBox.Check( rOptions.IsOptionSet( eOption ) ); - return bEnable; - } -} - -//........................................................................ -namespace svx -{ -//........................................................................ - -SecurityOptionsDialog::SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_SECURITY_OPTIONS ) ) - ,m_aWarningsFL ( this, CUI_RES( FL_WARNINGS ) ) - ,m_aWarningsFI ( this, CUI_RES( FI_WARNINGS ) ) - ,m_aSaveOrSendDocsFI( this, CUI_RES( FI_SAVESENDDOCS ) ) - ,m_aSaveOrSendDocsCB( this, CUI_RES( CB_SAVESENDDOCS ) ) - ,m_aSignDocsFI ( this, CUI_RES( FI_SIGNDOCS ) ) - ,m_aSignDocsCB ( this, CUI_RES( CB_SIGNDOCS ) ) - ,m_aPrintDocsFI ( this, CUI_RES( FI_PRINTDOCS ) ) - ,m_aPrintDocsCB ( this, CUI_RES( CB_PRINTDOCS ) ) - ,m_aCreatePdfFI ( this, CUI_RES( FI_CREATEPDF ) ) - ,m_aCreatePdfCB ( this, CUI_RES( CB_CREATEPDF ) ) - ,m_aOptionsFL ( this, CUI_RES( FL_OPTIONS ) ) - ,m_aRemovePersInfoFI( this, CUI_RES( FI_REMOVEINFO ) ) - ,m_aRemovePersInfoCB( this, CUI_RES( CB_REMOVEINFO ) ) - ,m_aRecommPasswdFI ( this, CUI_RES( FI_RECOMMENDPWD ) ) - ,m_aRecommPasswdCB ( this, CUI_RES( CB_RECOMMENDPWD ) ) - ,m_aCtrlHyperlinkFI ( this, CUI_RES( FI_CTRLHYPERLINK ) ) - ,m_aCtrlHyperlinkCB ( this, CUI_RES( CB_CTRLHYPERLINK ) ) - - ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) ) - ,m_aOKBtn ( this, CUI_RES( PB_OK ) ) - ,m_aCancelBtn ( this, CUI_RES( PB_CANCEL ) ) - ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) ) - -{ - FreeResource(); - - DBG_ASSERT( pOptions, "SecurityOptionsDialog::SecurityOptionsDialog(): invalid SvtSecurityOptions" ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SAVEORSEND, m_aSaveOrSendDocsCB, m_aSaveOrSendDocsFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_SIGNING, m_aSignDocsCB, m_aSignDocsFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_PRINT, m_aPrintDocsCB, m_aPrintDocsFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_CREATEPDF, m_aCreatePdfCB, m_aCreatePdfFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO, m_aRemovePersInfoCB, m_aRemovePersInfoFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD, m_aRecommPasswdCB, m_aRecommPasswdFI ); - enableAndSet( *pOptions, SvtSecurityOptions::E_CTRLCLICK_HYPERLINK, m_aCtrlHyperlinkCB, m_aCtrlHyperlinkFI ); -} - -SecurityOptionsDialog::~SecurityOptionsDialog() -{ -} - -//........................................................................ -} // namespace svx -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/securityoptions.hrc b/cui/source/options/securityoptions.hrc deleted file mode 100644 index 39359de06..000000000 --- a/cui/source/options/securityoptions.hrc +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_SECURITYOPTIONS_HRC -#define _SVX_SECURITYOPTIONS_HRC - -#define FL_WARNINGS 10 -#define FI_WARNINGS 11 -#define FI_SAVESENDDOCS 12 -#define CB_SAVESENDDOCS 13 -#define FI_SIGNDOCS 14 -#define CB_SIGNDOCS 15 -#define FI_PRINTDOCS 16 -#define CB_PRINTDOCS 17 -#define FI_CREATEPDF 18 -#define CB_CREATEPDF 19 -#define FL_OPTIONS 20 -#define FI_REMOVEINFO 21 -#define CB_REMOVEINFO 22 -#define FI_RECOMMENDPWD 23 -#define CB_RECOMMENDPWD 24 -#define FI_CTRLHYPERLINK 25 -#define CB_CTRLHYPERLINK 26 -#define FL_BUTTONS 27 -#define PB_OK 28 -#define PB_CANCEL 29 -#define PB_HELP 30 - -#define DLG_WIDTH 260 - -#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT) -#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X) -#define COL_2 (COL_1+RSC_SP_CHK_TEXTINDENT) -#define COL_4 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT) -#define COL_3 (COL_4-RSC_SP_FLGR_SPACE_X) - -#define COL_C (COL_4-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH) - -#define CHECKBOX_WIDTH ((COL_3-COL_2-RSC_SP_CTRL_X)/2) - -#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP) -#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_2 (ROW_1+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_5 (ROW_4+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_6 (ROW_5+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_7 (ROW_6+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_8 (ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_9 (ROW_8+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_10 (ROW_9+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM) - -#endif // #ifndef _SVX_SECURITYOPTIONS_HRC - diff --git a/cui/source/options/securityoptions.hxx b/cui/source/options/securityoptions.hxx deleted file mode 100644 index 40a693fe3..000000000 --- a/cui/source/options/securityoptions.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SECURITYOPTIONS_HXX -#define _SVX_SECURITYOPTIONS_HXX - -#include -#include -#include - -#include "readonlyimage.hxx" - -class SvtSecurityOptions; - -//........................................................................ -namespace svx -{ -//........................................................................ - - //==================================================================== - //= class SecurityOptionsDialog - //==================================================================== - class SecurityOptionsDialog : public ModalDialog - { - private: - FixedLine m_aWarningsFL; - FixedInfo m_aWarningsFI; - ReadOnlyImage m_aSaveOrSendDocsFI; - CheckBox m_aSaveOrSendDocsCB; - ReadOnlyImage m_aSignDocsFI; - CheckBox m_aSignDocsCB; - ReadOnlyImage m_aPrintDocsFI; - CheckBox m_aPrintDocsCB; - ReadOnlyImage m_aCreatePdfFI; - CheckBox m_aCreatePdfCB; - - FixedLine m_aOptionsFL; - ReadOnlyImage m_aRemovePersInfoFI; - CheckBox m_aRemovePersInfoCB; - ReadOnlyImage m_aRecommPasswdFI; - CheckBox m_aRecommPasswdCB; - ReadOnlyImage m_aCtrlHyperlinkFI; - CheckBox m_aCtrlHyperlinkCB; - - FixedLine m_aButtonsFL; - OKButton m_aOKBtn; - CancelButton m_aCancelBtn; - HelpButton m_aHelpBtn; - - public: - SecurityOptionsDialog( Window* pParent, SvtSecurityOptions* pOptions ); - ~SecurityOptionsDialog(); - - inline bool IsSaveOrSendDocsChecked() const { return m_aSaveOrSendDocsCB.IsChecked() != sal_False; } - inline bool IsSignDocsChecked() const { return m_aSignDocsCB.IsChecked() != sal_False; } - inline bool IsPrintDocsChecked() const { return m_aPrintDocsCB.IsChecked() != sal_False; } - inline bool IsCreatePdfChecked() const { return m_aCreatePdfCB.IsChecked() != sal_False; } - inline bool IsRemovePersInfoChecked() const { return m_aRemovePersInfoCB.IsChecked() != sal_False; } - inline bool IsRecommPasswdChecked() const { return m_aRecommPasswdCB.IsChecked() != sal_False; } - inline bool IsCtrlHyperlinkChecked() const { return m_aCtrlHyperlinkCB.IsChecked() != sal_False; } - }; - -//........................................................................ -} // namespace svx -//........................................................................ - -#endif // #ifndef _SVX_SECURITYOPTIONS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/securityoptions.src b/cui/source/options/securityoptions.src deleted file mode 100644 index 632f28794..000000000 --- a/cui/source/options/securityoptions.src +++ /dev/null @@ -1,172 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include -------------------------------------------------------------- - -#include -#include "securityoptions.hrc" -#include -#include "helpid.hrc" - -ModalDialog RID_SVXDLG_SECURITY_OPTIONS -{ - HelpID = HID_DLG_SECURITY_OPTIONS ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( DLG_WIDTH , ROW_10 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Security options and warnings" ; - FixedLine FL_WARNINGS - { - Pos = MAP_APPFONT( COL_0, ROW_0 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Security warnings"; - }; - FixedText FI_WARNINGS - { - Pos = MAP_APPFONT( COL_1, ROW_1 ); - Size = MAP_APPFONT( COL_3-COL_1, 2*RSC_CD_FIXEDLINE_HEIGHT ); - Wordbreak = TRUE; - Text [ en-US ] = "Warn if document contains recorded changes, versions, hidden information or notes:"; - }; - FixedImage FI_SAVESENDDOCS - { - Pos = MAP_APPFONT( COL_2 - 7, ROW_2 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_SAVESENDDOCS - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_SAVESENDDOCS"; - Pos = MAP_APPFONT( COL_2, ROW_2 ); - Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "When saving or sending"; - }; - FixedImage FI_SIGNDOCS - { - Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_2 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_SIGNDOCS - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_SIGNDOCS"; - Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_2 ); - Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "When signing"; - }; - FixedImage FI_PRINTDOCS - { - Pos = MAP_APPFONT( COL_2 - 7, ROW_3 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_PRINTDOCS - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_PRINTDOCS"; - Pos = MAP_APPFONT( COL_2, ROW_3 ); - Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "When printing"; - }; - FixedImage FI_CREATEPDF - { - Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X - 7, ROW_3 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_CREATEPDF - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_CREATEPDF"; - Pos = MAP_APPFONT( COL_2 + CHECKBOX_WIDTH + RSC_SP_CTRL_X, ROW_3 ); - Size = MAP_APPFONT( CHECKBOX_WIDTH, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "When creating PDF files"; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT( COL_0, ROW_4 ); - Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT ); - Text [ en-US ] = "Security options"; - }; - FixedImage FI_REMOVEINFO - { - Pos = MAP_APPFONT( COL_1 - 7, ROW_5 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_REMOVEINFO - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_REMOVEINFO"; - Pos = MAP_APPFONT( COL_1, ROW_5 ); - Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Remove personal information on saving"; - }; - FixedImage FI_RECOMMENDPWD - { - Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_RECOMMENDPWD - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_RECOMMENDPWD"; - Pos = MAP_APPFONT( COL_1, ROW_6 ); - Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Recommend password protection on saving"; - }; - FixedImage FI_CTRLHYPERLINK - { - Pos = MAP_APPFONT( COL_1 - 7, ROW_6 + 2 ); - Size = MAP_APPFONT( 6, 6 ); - }; - CheckBox CB_CTRLHYPERLINK - { - HelpID = "cui:CheckBox:RID_SVXDLG_SECURITY_OPTIONS:CB_CTRLHYPERLINK"; - Pos = MAP_APPFONT( COL_1, ROW_7 ); - Size = MAP_APPFONT( COL_3-COL_1, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Ctrl-click required to follow hyperlinks"; - }; - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT( 0, ROW_8 ); - Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( COL_A , ROW_9 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( COL_B , ROW_9 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( COL_C , ROW_9 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; -}; - diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx deleted file mode 100644 index a6ae33454..000000000 --- a/cui/source/options/treeopt.cxx +++ /dev/null @@ -1,2779 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuitabarea.hxx" -#include -#include "opthtml.hxx" -#include "optcolor.hxx" -#include "optctl.hxx" -#include "optjava.hxx" -#include "optsave.hxx" -#include "optpath.hxx" -#include "cuioptgenrl.hxx" -#include "optlingu.hxx" -#include "optinet2.hxx" -#include "optasian.hxx" -#include "optaccessibility.hxx" -#include "optjsearch.hxx" -#include "connpooloptions.hxx" -#include "optupdt.hxx" -#include -#include "optchart.hxx" -#include "optgdlg.hxx" -#include "optmemory.hxx" -#include "optfltr.hxx" -#include -#include "helpid.hrc" -#include -#include "treeopt.hxx" -#include "treeopt.hrc" -#include "fontsubs.hxx" -#include -#include -#include "connpoolconfig.hxx" -#include "dbregister.hxx" -#include "dbregisterednamesconfig.hxx" -#include "cfgchart.hxx" -#include - -#ifndef _SVX_LANGITEM_HXX -#define ITEMID_LANGUAGE SID_ATTR_CHAR_LANGUAGE -#include -#endif - - -#include - -#include -#include - -#ifdef LINUX -#include -#include -#include -#include -#endif - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::linguistic2; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; - -#ifdef C2U - #error "Who define C2U before! I use it to create const ascii strings ..." -#else - #define C2U(cChar) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( cChar ) ) -#endif - -#define HINT_TIMEOUT 200 -#define SELECT_FIRST_TIMEOUT 0 -#define SELECT_TIMEOUT 300 -#define COLORPAGE_UNKNOWN ((sal_uInt16)0xFFFF) -#define EXPAND_PROTOCOL "vnd.sun.star.expand:" - -LastPageSaver* OfaTreeOptionsDialog::pLastPageSaver = NULL; - -// some stuff for easier changes for SvtViewOptions -static const sal_Char* pViewOptDataName = "page data"; -#define VIEWOPT_DATANAME rtl::OUString::createFromAscii( pViewOptDataName ) - -static XOutdevItemPool* mpStaticXOutdevItemPool = 0L; - -static inline void SetViewOptUserItem( SvtViewOptions& rOpt, const String& rData ) -{ - rOpt.SetUserItem( VIEWOPT_DATANAME, makeAny( rtl::OUString( rData ) ) ); -} - -static inline String GetViewOptUserItem( const SvtViewOptions& rOpt ) -{ - Any aAny( rOpt.GetUserItem( VIEWOPT_DATANAME ) ); - rtl::OUString aUserData; - aAny >>= aUserData; - - return String( aUserData ); -} - -struct ModuleToGroupNameMap_Impl -{ - const char* m_pModule; - String m_sGroupName; - sal_uInt16 m_nNodeId; -}; - -static OfaPageResource* pPageRes = NULL; - -static ModuleToGroupNameMap_Impl ModuleMap[] = -{ - { "ProductName", String::EmptyString(), SID_GENERAL_OPTIONS }, - { "LanguageSettings", String::EmptyString(), SID_LANGUAGE_OPTIONS }, - { "Internet", String::EmptyString(), SID_INET_DLG }, - { "LoadSave", String::EmptyString(), SID_FILTER_DLG }, - { "Writer", String::EmptyString(), SID_SW_EDITOPTIONS }, - { "WriterWeb", String::EmptyString(), SID_SW_ONLINEOPTIONS }, - { "Math", String::EmptyString(), SID_SM_EDITOPTIONS }, - { "Calc", String::EmptyString(), SID_SC_EDITOPTIONS }, - { "Impress", String::EmptyString(), SID_SD_EDITOPTIONS }, - { "Draw", String::EmptyString(), SID_SD_GRAPHIC_OPTIONS }, - { "Charts", String::EmptyString(), SID_SCH_EDITOPTIONS }, - { "Base", String::EmptyString(), SID_SB_STARBASEOPTIONS }, - - { NULL, String::EmptyString(), 0xFFFF } -}; - -static void setGroupName( const rtl::OUString& rModule, const String& rGroupName ) -{ - sal_uInt16 nIndex = 0; - while ( ModuleMap[ nIndex ].m_pModule ) - { - rtl::OUString sTemp = - rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); - if ( sTemp == rModule ) - { - ModuleMap[ nIndex ].m_sGroupName = rGroupName; - break; - } - ++nIndex; - } -} - -static String getGroupName( const rtl::OUString& rModule, bool bForced ) -{ - String sGroupName; - sal_uInt16 nIndex = 0; - while ( ModuleMap[ nIndex ].m_pModule ) - { - rtl::OUString sTemp = - rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); - if ( sTemp == rModule ) - { - sGroupName = ModuleMap[ nIndex ].m_sGroupName; - break; - } - ++nIndex; - } - - if ( sGroupName.Len() == 0 && bForced ) - { - if ( !pPageRes ) - pPageRes = new OfaPageResource; - - if ( rModule == C2U("Writer") ) - sGroupName = pPageRes->GetTextArray().GetString(0); - else if ( rModule == C2U("WriterWeb") ) - sGroupName = pPageRes->GetHTMLArray().GetString(0); - else if ( rModule == C2U("Calc") ) - sGroupName = pPageRes->GetCalcArray().GetString(0); - else if ( rModule == C2U("Impress") ) - sGroupName = pPageRes->GetImpressArray().GetString(0); - else if ( rModule == C2U("Draw") ) - sGroupName = pPageRes->GetDrawArray().GetString(0); - else if ( rModule == C2U("Math") ) - sGroupName = pPageRes->GetStarMathArray().GetString(0); - else if ( rModule == C2U("Base") ) - sGroupName = pPageRes->GetDatasourcesArray().GetString(0); - } - return sGroupName; -} - -static void deleteGroupNames() -{ - sal_uInt16 nIndex = 0; - while ( ModuleMap[ nIndex ].m_pModule ) - ModuleMap[ nIndex++ ].m_sGroupName = String::EmptyString(); -} - -static sal_uInt16 getGroupNodeId( const rtl::OUString& rModule ) -{ - sal_uInt16 nNodeId = 0xFFFF, nIndex = 0; - while ( ModuleMap[ nIndex ].m_pModule ) - { - rtl::OUString sTemp = - rtl::OUString::createFromAscii( ModuleMap[ nIndex ].m_pModule ); - if ( sTemp == rModule ) - { - nNodeId = ModuleMap[ nIndex ].m_nNodeId; - break; - } - ++nIndex; - } - - return nNodeId; -} - -class MailMergeCfg_Impl : public utl::ConfigItem -{ - friend class SvxEMailTabPage; - // variables - sal_Bool bIsEmailSupported; - -public: - MailMergeCfg_Impl(); - virtual ~MailMergeCfg_Impl(); - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); - - sal_Bool IsEmailSupported() const {return bIsEmailSupported;} - -}; - -MailMergeCfg_Impl::MailMergeCfg_Impl() : - utl::ConfigItem(C2U("Office.Writer/MailMergeWizard")), - bIsEmailSupported(sal_False) -{ - Sequence aNames(1); - aNames.getArray()[0] = C2U("EMailSupported"); - const Sequence< Any > aValues = GetProperties(aNames); - const Any* pValues = aValues.getConstArray(); - if(aValues.getLength() && pValues[0].hasValue()) - pValues[0] >>= bIsEmailSupported; -} - -MailMergeCfg_Impl::~MailMergeCfg_Impl() -{ -} -/* -------------------------------------------------------------------------*/ -void MailMergeCfg_Impl::Commit() -{ -} - -void MailMergeCfg_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) -{ -} - -//typedef SfxTabPage* (*FNCreateTabPage)( Window *pParent, const SfxItemSet &rAttrSet ); -SfxTabPage* CreateGeneralTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) -{ - CreateTabPage fnCreate = 0; - switch(nId) - { - case RID_SFXPAGE_SAVE: fnCreate = &SvxSaveTabPage::Create; break; - case RID_SFXPAGE_PATH: fnCreate = &SvxPathTabPage::Create; break; - case RID_SFXPAGE_GENERAL: fnCreate = &SvxGeneralTabPage::Create; break; - case RID_SFXPAGE_PRINTOPTIONS: fnCreate = &SfxCommonPrintOptionsTabPage::Create; break; - case OFA_TP_LANGUAGES: fnCreate = &OfaLanguagesTabPage::Create; break; - case RID_SFXPAGE_LINGU: fnCreate = &SvxLinguTabPage::Create; break; - case RID_SVXPAGE_COLOR: fnCreate = &SvxColorTabPage::Create; break; - case OFA_TP_VIEW: fnCreate = &OfaViewTabPage::Create; break; - case OFA_TP_MISC: fnCreate = &OfaMiscTabPage::Create; break; - case OFA_TP_MEMORY: fnCreate = &OfaMemoryOptionsPage::Create; break; - case RID_SVXPAGE_ASIAN_LAYOUT: fnCreate = &SvxAsianLayoutPage::Create; break; - case RID_SVX_FONT_SUBSTITUTION: fnCreate = &SvxFontSubstTabPage::Create; break; - case RID_SVXPAGE_INET_PROXY: fnCreate = &SvxProxyTabPage::Create; break; - case RID_SVXPAGE_INET_SECURITY: fnCreate = &SvxSecurityTabPage::Create; break; - case RID_SVXPAGE_INET_MAIL: fnCreate = &SvxEMailTabPage::Create; break; - case RID_SVXPAGE_COLORCONFIG: fnCreate = &SvxColorOptionsTabPage::Create; break; - case RID_OFAPAGE_HTMLOPT: fnCreate = &OfaHtmlTabPage::Create; break; - case SID_OPTFILTER_MSOFFICE: fnCreate = &OfaMSFilterTabPage::Create; break; - case RID_OFAPAGE_MSFILTEROPT2: fnCreate = &OfaMSFilterTabPage2::Create; break; - case RID_SVXPAGE_JSEARCH_OPTIONS: fnCreate = &SvxJSearchOptionsPage::Create ; break; - case SID_SB_CONNECTIONPOOLING: fnCreate = &::offapp::ConnectionPoolOptionsPage::Create; break; - case SID_SB_DBREGISTEROPTIONS: fnCreate = &::svx::DbRegistrationOptionsPage::Create; break; - case RID_SVXPAGE_ACCESSIBILITYCONFIG: fnCreate = &SvxAccessibilityOptionsTabPage::Create; break; - case RID_SVXPAGE_SSO: fnCreate = GetSSOCreator(); break; - case RID_SVXPAGE_OPTIONS_CTL: fnCreate = &SvxCTLOptionsPage::Create ; break; - case RID_SVXPAGE_INET_MOZPLUGIN: fnCreate = &MozPluginTabPage::Create; break; - case RID_SVXPAGE_OPTIONS_JAVA: fnCreate = &SvxJavaOptionsPage::Create ; break; - case RID_SVXPAGE_ONLINEUPDATE: fnCreate = &SvxOnlineUpdateTabPage::Create; break; - case RID_OPTPAGE_CHART_DEFCOLORS: fnCreate = &SvxDefaultColorOptPage::Create; break; - case RID_SVXPAGE_IMPROVEMENT: fnCreate = &SvxImprovementOptionsPage::Create; break; - } - - SfxTabPage* pRet = fnCreate ? (*fnCreate)( pParent, rSet ) : NULL; - return pRet; -} - - -struct OptionsMapping_Impl -{ - const char* m_pGroupName; - const char* m_pPageName; - sal_uInt16 m_nPageId; -}; - -static OptionsMapping_Impl const OptionsMap_Impl[] = -{ -// GROUP PAGE PAGE-ID - { "ProductName", NULL, SID_GENERAL_OPTIONS }, - { "ProductName", "UserData", RID_SFXPAGE_GENERAL }, - { "ProductName", "General", OFA_TP_MISC }, - { "ProductName", "Memory", OFA_TP_MEMORY }, - { "ProductName", "View", OFA_TP_VIEW }, - { "ProductName", "Print", RID_SFXPAGE_PRINTOPTIONS }, - { "ProductName", "Paths", RID_SFXPAGE_PATH }, - { "ProductName", "Colors", RID_SVXPAGE_COLOR }, - { "ProductName", "Fonts", RID_SVX_FONT_SUBSTITUTION }, - { "ProductName", "Security", RID_SVXPAGE_INET_SECURITY }, - { "ProductName", "Appearance", RID_SVXPAGE_COLORCONFIG }, - { "ProductName", "Accessibility", RID_SVXPAGE_ACCESSIBILITYCONFIG }, - { "ProductName", "Java", RID_SVXPAGE_OPTIONS_JAVA }, - { "ProductName", "NetworkIdentity", RID_SVXPAGE_SSO }, - { "ProductName", "OnlineUpdate", RID_SVXPAGE_ONLINEUPDATE }, - { "ProductName", "ImprovementProgram", RID_SVXPAGE_IMPROVEMENT }, - { "LanguageSettings", NULL, SID_LANGUAGE_OPTIONS }, - { "LanguageSettings", "Languages", OFA_TP_LANGUAGES }, - { "LanguageSettings", "WritingAids", RID_SFXPAGE_LINGU }, - { "LanguageSettings", "SearchingInJapanese", RID_SVXPAGE_JSEARCH_OPTIONS }, - { "LanguageSettings", "AsianLayout", RID_SVXPAGE_ASIAN_LAYOUT }, - { "LanguageSettings", "ComplexTextLayout", RID_SVXPAGE_OPTIONS_CTL }, - { "Internet", NULL, SID_INET_DLG }, - { "Internet", "Proxy", RID_SVXPAGE_INET_PROXY }, - { "Internet", "Email", RID_SVXPAGE_INET_MAIL }, - { "Internet", "MozillaPlugin", RID_SVXPAGE_INET_MOZPLUGIN }, - { "LoadSave", NULL, SID_FILTER_DLG }, - { "LoadSave", "General", RID_SFXPAGE_SAVE }, - { "LoadSave", "VBAProperties", SID_OPTFILTER_MSOFFICE }, - { "LoadSave", "MicrosoftOffice", RID_OFAPAGE_MSFILTEROPT2 }, - { "LoadSave", "HTMLCompatibility", RID_OFAPAGE_HTMLOPT }, - { "Writer", NULL, SID_SW_EDITOPTIONS }, - { "Writer", "General", RID_SW_TP_OPTLOAD_PAGE }, - { "Writer", "View", RID_SW_TP_CONTENT_OPT }, - { "Writer", "FormattingAids", RID_SW_TP_OPTSHDWCRSR }, - { "Writer", "Grid", RID_SVXPAGE_GRID }, - { "Writer", "BasicFontsWestern", RID_SW_TP_STD_FONT }, - { "Writer", "BasicFontsAsian", RID_SW_TP_STD_FONT_CJK }, - { "Writer", "BasicFontsCTL", RID_SW_TP_STD_FONT_CTL }, - { "Writer", "Print", RID_SW_TP_OPTPRINT_PAGE }, - { "Writer", "Table", RID_SW_TP_OPTTABLE_PAGE }, - { "Writer", "Changes", RID_SW_TP_REDLINE_OPT }, - { "Writer", "Compatibility", RID_SW_TP_OPTCOMPATIBILITY_PAGE }, - { "Writer", "AutoCaption", RID_SW_TP_OPTCAPTION_PAGE }, - { "Writer", "MailMerge", RID_SW_TP_MAILCONFIG }, - { "WriterWeb", NULL, SID_SW_ONLINEOPTIONS }, - { "WriterWeb", "View", RID_SW_TP_HTML_CONTENT_OPT }, - { "WriterWeb", "FormattingAids", RID_SW_TP_HTML_OPTSHDWCRSR }, - { "WriterWeb", "Grid", RID_SW_TP_HTML_OPTGRID_PAGE }, - { "WriterWeb", "Print", RID_SW_TP_HTML_OPTPRINT_PAGE }, - { "WriterWeb", "Table", RID_SW_TP_HTML_OPTTABLE_PAGE }, - { "WriterWeb", "Background", RID_SW_TP_BACKGROUND }, - { "Math", NULL, SID_SM_EDITOPTIONS }, - { "Math", "Settings", SID_SM_TP_PRINTOPTIONS }, - { "Calc", NULL, SID_SC_EDITOPTIONS }, - { "Calc", "General", SID_SC_TP_LAYOUT }, - { "Calc", "View", SID_SC_TP_CONTENT }, - { "Calc", "International", RID_OFA_TP_INTERNATIONAL }, - { "Calc", "Calculate", SID_SC_TP_CALC }, - { "Calc", "Formula", SID_SC_TP_FORMULA }, - { "Calc", "SortLists", SID_SC_TP_USERLISTS }, - { "Calc", "Changes", SID_SC_TP_CHANGES }, - { "Calc", "Compatibility", SID_SC_TP_COMPATIBILITY }, - { "Calc", "Grid", SID_SC_TP_GRID }, - { "Calc", "Print", RID_SC_TP_PRINT }, - { "Impress", NULL, SID_SD_EDITOPTIONS }, - { "Impress", "General", SID_SI_TP_MISC }, - { "Impress", "View", SID_SI_TP_CONTENTS }, - { "Impress", "Grid", SID_SI_TP_SNAP }, - { "Impress", "Print", SID_SI_TP_PRINT }, - { "Draw", NULL, SID_SD_GRAPHIC_OPTIONS }, - { "Draw", "General", SID_SD_TP_MISC }, - { "Draw", "View", SID_SD_TP_CONTENTS }, - { "Draw", "Grid", SID_SD_TP_SNAP }, - { "Draw", "Print", SID_SD_TP_PRINT }, - { "Charts", NULL, SID_SCH_EDITOPTIONS }, - { "Charts", "DefaultColors", RID_OPTPAGE_CHART_DEFCOLORS }, - { "Base", NULL, SID_SB_STARBASEOPTIONS }, - { "Base", "Connections", SID_SB_CONNECTIONPOOLING }, - { "Base", "Databases", SID_SB_DBREGISTEROPTIONS }, - { NULL, NULL, 0 } -}; - -static sal_Bool lcl_getStringFromID( sal_uInt16 _nPageId, String& _rGroupName, String& _rPageName ) -{ - sal_Bool bRet = sal_False; - - sal_uInt16 nIdx = 0; - while ( OptionsMap_Impl[nIdx].m_pGroupName != NULL ) - { - if ( _nPageId == OptionsMap_Impl[nIdx].m_nPageId ) - { - bRet = sal_True; - _rGroupName = String( OptionsMap_Impl[nIdx].m_pGroupName, RTL_TEXTENCODING_ASCII_US ); - if ( OptionsMap_Impl[nIdx].m_pPageName != NULL ) - _rPageName = String( OptionsMap_Impl[nIdx].m_pPageName, RTL_TEXTENCODING_ASCII_US ); - break; - } - ++nIdx; - } - - return bRet; -} - -static sal_Bool lcl_isOptionHidden( sal_uInt16 _nPageId, const SvtOptionsDialogOptions& _rOptOptions ) -{ - sal_Bool bIsHidden = sal_False; - String sGroupName, sPageName; - if ( lcl_getStringFromID( _nPageId, sGroupName, sPageName ) ) - { - if ( sPageName.Len() == 0 ) - bIsHidden = _rOptOptions.IsGroupHidden( sGroupName ); - else - bIsHidden = _rOptOptions.IsPageHidden( sPageName, sGroupName ); - } - return bIsHidden; -} - -struct OptionsPageInfo -{ - SfxTabPage* m_pPage; - sal_uInt16 m_nPageId; - rtl::OUString m_sPageURL; - rtl::OUString m_sEventHdl; - ExtensionsTabPage* m_pExtPage; - - OptionsPageInfo( sal_uInt16 nId ) : m_pPage( NULL ), m_nPageId( nId ), m_pExtPage( NULL ) {} -}; - -struct OptionsGroupInfo -{ - SfxItemSet* m_pInItemSet; - SfxItemSet* m_pOutItemSet; - SfxShell* m_pShell; // used to create the page - SfxModule* m_pModule; // used to create the ItemSet - sal_uInt16 m_nDialogId; // Id of the former dialog - sal_Bool m_bLoadError; // load fails? - rtl::OUString m_sPageURL; - ExtensionsTabPage* m_pExtPage; - - OptionsGroupInfo( SfxShell* pSh, SfxModule* pMod, sal_uInt16 nId ) : - m_pInItemSet( NULL ), m_pOutItemSet( NULL ), m_pShell( pSh ), - m_pModule( pMod ), m_nDialogId( nId ), m_bLoadError( sal_False ), - m_sPageURL( rtl::OUString() ), m_pExtPage( NULL ) {} - ~OptionsGroupInfo() { delete m_pInItemSet; delete m_pOutItemSet; } -}; - -sal_Bool OfaOptionsTreeListBox::Collapse( SvLBoxEntry* pParent ) -{ - bInCollapse = sal_True; - sal_Bool bRet = SvTreeListBox::Collapse(pParent); - bInCollapse = sal_False; - return bRet; -} - -// ----------------------------------------------------------------------- - -#define INI_LIST() \ - aOkPB ( this, CUI_RES( PB_OK ) ),\ - aCancelPB ( this, CUI_RES( PB_CANCEL ) ),\ - aHelpPB ( this, CUI_RES( PB_HELP ) ),\ - aBackPB ( this, CUI_RES( PB_BACK ) ),\ - aHiddenGB ( this, CUI_RES( FB_BORDER ) ),\ - aPageTitleFT ( this, CUI_RES( FT_PAGE_TITLE ) ),\ - aLine1FL ( this, CUI_RES( FL_LINE_1 ) ),\ - aHelpFT ( this, CUI_RES( FT_HELPTEXT ) ),\ - aHelpImg ( this, CUI_RES( IMG_HELP ) ),\ - aHelpTextsArr ( CUI_RES( STR_HELPTEXTS ) ),\ - aTreeLB ( this, CUI_RES( TLB_PAGES ) ),\ - sTitle ( GetText() ),\ - sNotLoadedError ( CUI_RES( ST_LOAD_ERROR ) ),\ - pCurrentPageEntry ( NULL ),\ - pColorPageItemSet ( NULL ),\ - pColorTab ( NULL ),\ - nChangeType ( CT_NONE ),\ - nUnknownType ( COLORPAGE_UNKNOWN ),\ - nUnknownPos ( COLORPAGE_UNKNOWN ),\ - bIsAreaTP ( sal_False ),\ - bForgetSelection ( sal_False ),\ - bImageResized ( sal_False ),\ - bInSelectHdl_Impl ( false ),\ - bIsFromExtensionManager( false ), \ - bIsForSetDocumentLanguage( false ) - -// Ctor() with Frame ----------------------------------------------------- -using namespace ::com::sun::star; -OfaTreeOptionsDialog::OfaTreeOptionsDialog( - Window* pParent, - const Reference< XFrame >& _xFrame, - bool bActivateLastSelection ) : - - SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ), - INI_LIST() -{ - FreeResource(); - - InitTreeAndHandler(); - Initialize( _xFrame ); - LoadExtensionOptions( rtl::OUString() ); - ResizeTreeLB(); - if (bActivateLastSelection) - ActivateLastSelection(); - - aTreeLB.SetAccessibleName(GetDisplayText()); -} - -// Ctor() with ExtensionId ----------------------------------------------- - -OfaTreeOptionsDialog::OfaTreeOptionsDialog( Window* pParent, const rtl::OUString& rExtensionId ) : - - SfxModalDialog( pParent, CUI_RES( RID_OFADLG_OPTIONS_TREE ) ), - - INI_LIST() - -{ - FreeResource(); - - bIsFromExtensionManager = ( rExtensionId.getLength() > 0 ); - InitTreeAndHandler(); - LoadExtensionOptions( rExtensionId ); - ResizeTreeLB(); - ActivateLastSelection(); -} - -OfaTreeOptionsDialog::~OfaTreeOptionsDialog() -{ - SvLBoxEntry* pEntry = aTreeLB.First(); - // first children - while(pEntry) - { - // if Child (has parent), then OptionsPageInfo - if(aTreeLB.GetParent(pEntry)) - { - OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); - if(pPageInfo->m_pPage) - { - pPageInfo->m_pPage->FillUserData(); - String aPageData(pPageInfo->m_pPage->GetUserData()); - if ( aPageData.Len() ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) ); - SetViewOptUserItem( aTabPageOpt, aPageData ); - } - delete pPageInfo->m_pPage; - } - - if (pPageInfo->m_nPageId == RID_SFXPAGE_LINGU) - { - // write personal dictionaries - Reference< XDictionaryList > xDicList( SvxGetDictionaryList() ); - if (xDicList.is()) - { - linguistic::SaveDictionaries( xDicList ); - } - } - - if( pPageInfo->m_pExtPage ) - delete pPageInfo->m_pExtPage; - - delete pPageInfo; - } - pEntry = aTreeLB.Next(pEntry); - } - - // and parents - pEntry = aTreeLB.First(); - while(pEntry) - { - if(!aTreeLB.GetParent(pEntry)) - { - OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pEntry->GetUserData(); - if ( pGroupInfo && pGroupInfo->m_pExtPage ) - delete pGroupInfo->m_pExtPage; - delete pGroupInfo; - } - pEntry = aTreeLB.Next(pEntry); - } - delete pColorPageItemSet; - deleteGroupNames(); -} - -OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage( - sal_uInt16 nId, const String& rPageName, sal_uInt16 nGroup ) -{ - OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId ); - SvLBoxEntry* pParent = aTreeLB.GetEntry( 0, nGroup ); - DBG_ASSERT( pParent, "OfaTreeOptionsDialog::AddTabPage(): no group found" ); - SvLBoxEntry* pEntry = aTreeLB.InsertEntry( rPageName, pParent ); - pEntry->SetUserData( pPageInfo ); - return pPageInfo; -} - -// der ItemSet* geht in den Besitz des Dialogs -sal_uInt16 OfaTreeOptionsDialog::AddGroup(const String& rGroupName, - SfxShell* pCreateShell, - SfxModule* pCreateModule, - sal_uInt16 nDialogId ) -{ - SvLBoxEntry* pEntry = aTreeLB.InsertEntry(rGroupName); - OptionsGroupInfo* pInfo = - new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId ); - pEntry->SetUserData(pInfo); - sal_uInt16 nRet = 0; - pEntry = aTreeLB.First(); - while(pEntry) - { - if(!aTreeLB.GetParent(pEntry)) - nRet++; - pEntry = aTreeLB.Next(pEntry); - } - return nRet - 1; -} - -IMPL_LINK(OfaTreeOptionsDialog, ShowPageHdl_Impl, SvTreeListBox*, EMPTYARG) -{ - if ( aSelectTimer.GetTimeout() == SELECT_FIRST_TIMEOUT ) - { - aSelectTimer.SetTimeout( SELECT_TIMEOUT ); - SelectHdl_Impl( NULL ); - } - else if ( aSelectTimer.GetTimeout() == SELECT_TIMEOUT ) - aSelectTimer.Start(); - - return 0; -} - -IMPL_LINK( OfaTreeOptionsDialog, BackHdl_Impl, PushButton*, EMPTYARG ) -{ - if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) - { - OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pCurrentPageEntry->GetUserData(); - if ( pPageInfo->m_pPage ) - { - OptionsGroupInfo* pGroupInfo = - (OptionsGroupInfo*)aTreeLB.GetParent( pCurrentPageEntry )->GetUserData(); - if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) - pPageInfo->m_pPage->Reset( *pColorPageItemSet ); - else - pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet ); - } - else if ( pPageInfo->m_pExtPage ) - pPageInfo->m_pExtPage->ResetPage(); - } - return 0; -} - -IMPL_LINK( OfaTreeOptionsDialog, OKHdl_Impl, Button *, EMPTYARG ) -{ - aTreeLB.EndSelection(); - if ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) - { - OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pCurrentPageEntry->GetUserData(); - if ( pPageInfo->m_pPage ) - { - OptionsGroupInfo* pGroupInfo = - (OptionsGroupInfo *)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData(); - if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId - && pPageInfo->m_pPage->HasExchangeSupport() ) - { - int nLeave = pPageInfo->m_pPage->DeactivatePage(pGroupInfo->m_pOutItemSet); - if ( nLeave == SfxTabPage::KEEP_PAGE ) - { - //die Seite darf nicht verlassen werden! - aTreeLB.Select(pCurrentPageEntry); - return 0; - } - } - pPageInfo->m_pPage->Hide(); - } - } - - SvLBoxEntry* pEntry = aTreeLB.First(); - while ( pEntry ) - { - if ( aTreeLB.GetParent( pEntry ) ) - { - OptionsPageInfo* pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); - if ( pPageInfo->m_pPage && !pPageInfo->m_pPage->HasExchangeSupport() ) - { - OptionsGroupInfo* pGroupInfo = - (OptionsGroupInfo*)aTreeLB.GetParent(pEntry)->GetUserData(); - pPageInfo->m_pPage->FillItemSet(*pGroupInfo->m_pOutItemSet); - } - - if ( pPageInfo->m_pExtPage ) - { - pPageInfo->m_pExtPage->DeactivatePage(); - pPageInfo->m_pExtPage->SavePage(); - } - } - pEntry = aTreeLB.Next(pEntry); - } - EndDialog(RET_OK); - return 0; -} - -// Eine aufgeklappte Gruppe soll vollstaendig sichtbar sein -IMPL_LINK(OfaTreeOptionsDialog, ExpandedHdl_Impl, SvTreeListBox*, pBox ) -{ - pBox->Update(); - pBox->InitStartEntry(); - SvLBoxEntry* pEntry = pBox->GetHdlEntry(); - if(pEntry && pBox->IsExpanded(pEntry)) - { - sal_uInt32 nChildCount = pBox->GetChildCount( pEntry ); - - SvLBoxEntry* pNext = pEntry; - for(sal_uInt32 i = 0; i < nChildCount;i++) - { - pNext = pBox->GetNextEntryInView(pNext); - if(!pNext) - { - pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); - break; - } - else - { - Size aSz(pBox->GetOutputSizePixel()); - int nHeight = pBox->GetEntryHeight(); - Point aPos(pBox->GetEntryPosition(pNext)); - if(aPos.Y()+nHeight > aSz.Height()) - { - pBox->ScrollOutputArea( -(short)(nChildCount - i + 1) ); - break; - } - } - } - } - return 0; -} - -void OfaTreeOptionsDialog::ApplyItemSets() -{ - SvLBoxEntry* pEntry = aTreeLB.First(); - while(pEntry) - { - if(!aTreeLB.GetParent(pEntry)) - { - OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pEntry->GetUserData(); - if(pGroupInfo->m_pOutItemSet) - { - if(pGroupInfo->m_pShell) - pGroupInfo->m_pShell->ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet); - else - ApplyItemSet( pGroupInfo->m_nDialogId, *pGroupInfo->m_pOutItemSet); - } - } - pEntry = aTreeLB.Next(pEntry); - } -} - -void OfaTreeOptionsDialog::InitTreeAndHandler() -{ - aTreeLB.SetNodeDefaultImages(); - aPageImages = ImageList( CUI_RES( RID_IMGLIST_TREEOPT ) ); - - - aTreeLB.SetHelpId( HID_OFADLG_TREELISTBOX ); - aTreeLB.SetStyle( aTreeLB.GetStyle()|WB_HASBUTTONS | WB_HASBUTTONSATROOT | - WB_HASLINES | WB_HASLINESATROOT | - WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE | WB_QUICK_SEARCH ); - aTreeLB.SetSpaceBetweenEntries( 0 ); - aTreeLB.SetSelectionMode( SINGLE_SELECTION ); - aTreeLB.SetSublistOpenWithLeftRight( sal_True ); - aTreeLB.SetExpandedHdl( LINK( this, OfaTreeOptionsDialog, ExpandedHdl_Impl ) ); - aTreeLB.SetSelectHdl( LINK( this, OfaTreeOptionsDialog, ShowPageHdl_Impl ) ); - aBackPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, BackHdl_Impl ) ); - aOkPB.SetClickHdl( LINK( this, OfaTreeOptionsDialog, OKHdl_Impl ) ); - - aHiddenGB.Show(); - aSelectTimer.SetTimeout( SELECT_FIRST_TIMEOUT ); - aSelectTimer.SetTimeoutHdl( LINK( this, OfaTreeOptionsDialog, SelectHdl_Impl ) ); -} - -void OfaTreeOptionsDialog::ActivatePage( sal_uInt16 nResId ) -{ - bIsForSetDocumentLanguage = false; - if ( nResId == OFA_TP_LANGUAGES_FOR_SET_DOCUMENT_LANGUAGE ) - { - bIsForSetDocumentLanguage = true; - nResId = OFA_TP_LANGUAGES; - } - - DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" ); - if ( !pLastPageSaver ) - pLastPageSaver = new LastPageSaver; - bForgetSelection = sal_True; - sal_uInt16 nTemp = pLastPageSaver->m_nLastPageId; - pLastPageSaver->m_nLastPageId = nResId; - ActivateLastSelection(); - pLastPageSaver->m_nLastPageId = nTemp; -} - -void OfaTreeOptionsDialog::ActivatePage( const String& rPageURL ) -{ - DBG_ASSERT( !bIsFromExtensionManager, "OfaTreeOptionsDialog::ActivatePage(): call from extension manager" ); - if ( !pLastPageSaver ) - pLastPageSaver = new LastPageSaver; - bForgetSelection = sal_True; - pLastPageSaver->m_nLastPageId = 0; - pLastPageSaver->m_sLastPageURL_Tools = rPageURL; - ActivateLastSelection(); -} - -void OfaTreeOptionsDialog::ActivateLastSelection() -{ - SvLBoxEntry* pEntry = NULL; - if ( pLastPageSaver ) - { - String sExpand( RTL_CONSTASCII_USTRINGPARAM( EXPAND_PROTOCOL ) ); - String sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr - : pLastPageSaver->m_sLastPageURL_Tools; - if ( sLastURL.Len() == 0 ) - { - sLastURL = !bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr - : pLastPageSaver->m_sLastPageURL_Tools; - } - - // MacroExpander to convert "expand"-URL to "file"-URL - Reference< XMacroExpander > m_xMacroExpander; - bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INET_PROT_FILE ); - - if ( bMustExpand ) - { - Reference< XComponentContext > xContext; - Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - xProps->getPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ) >>= xContext; - if ( xContext.is() ) - m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( - xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "/singletons/com.sun.star.util.theMacroExpander" ) ) ), UNO_QUERY ); - } - - SvLBoxEntry* pTemp = aTreeLB.First(); - while( !pEntry && pTemp ) - { - // restore only selection of a leaf - if ( aTreeLB.GetParent( pTemp ) && pTemp->GetUserData() ) - { - OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pTemp->GetUserData(); - String sPageURL = pPageInfo->m_sPageURL; - if ( bMustExpand - && sPageURL.Len() > 0 - && sExpand.Match( sPageURL ) == STRING_MATCH ) - { - // cut protocol - ::rtl::OUString sTemp( sPageURL.Copy( sizeof( EXPAND_PROTOCOL ) -1 ) ); - // decode uri class chars - sTemp = ::rtl::Uri::decode( - sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - // expand string - sPageURL = m_xMacroExpander->expandMacros( sTemp ); - } - - if ( ( !bIsFromExtensionManager - && pPageInfo->m_nPageId && pPageInfo->m_nPageId == pLastPageSaver->m_nLastPageId ) - || ( !pPageInfo->m_nPageId && sLastURL == sPageURL ) ) - pEntry = pTemp; - } - pTemp = aTreeLB.Next(pTemp); - } - } - - if ( !pEntry ) - { - pEntry = aTreeLB.First(); - pEntry = aTreeLB.Next(pEntry); - } - - SvLBoxEntry* pParent = aTreeLB.GetParent(pEntry); - aTreeLB.Expand(pParent); - aTreeLB.MakeVisible(pParent); - aTreeLB.MakeVisible(pEntry); - aTreeLB.Select(pEntry); - aTreeLB.GrabFocus(); -} - -long OfaTreeOptionsDialog::Notify( NotifyEvent& rNEvt ) -{ - if ( rNEvt.GetType() == EVENT_KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - const KeyCode aKeyCode = pKEvt->GetKeyCode(); - - if( aKeyCode.GetCode() == KEY_PAGEUP || - aKeyCode.GetCode() == KEY_PAGEDOWN) - { - SvLBoxEntry* pCurEntry = aTreeLB.FirstSelected(); - SvLBoxEntry* pTemp = 0; - if(aKeyCode.GetCode() == KEY_PAGEDOWN) - { - pTemp = aTreeLB.Next( pCurEntry ) ; - if(pTemp && !aTreeLB.GetParent(pTemp)) - { - pTemp = aTreeLB.Next( pTemp ) ; - aTreeLB.Select(pTemp); - } - } - else - { - pTemp = aTreeLB.Prev( pCurEntry ) ; - if(pTemp && !aTreeLB.GetParent(pTemp)) - { - pTemp = aTreeLB.Prev( pTemp ) ; - } - } - if(pTemp) - { - if(!aTreeLB.IsExpanded(aTreeLB.GetParent(pTemp))) - aTreeLB.Expand(aTreeLB.GetParent(pTemp)); - aTreeLB.MakeVisible(pTemp); - aTreeLB.Select(pTemp); - } - } - } - return SfxModalDialog::Notify(rNEvt); -} - -// -------------------------------------------------------------------- - -void OfaTreeOptionsDialog::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxModalDialog::DataChanged( rDCEvt ); - - SvLBoxEntry* pEntry = aTreeLB.GetCurEntry(); - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) && - !aTreeLB.GetParent(pEntry)) - { - OptionsGroupInfo* pInfo = static_cast(pEntry->GetUserData()); - ImageList* pImgLst = &aPageImages; - for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) - { - if ( aHelpTextsArr.GetValue(i) == pInfo->m_nDialogId ) - { - aHelpImg.SetImage( pImgLst->GetImage( pInfo->m_nDialogId ) ); - break; - } - } - } -} -class FlagSet_Impl -{ - bool & rFlag; - public: - FlagSet_Impl(bool& bFlag) : rFlag(bFlag){rFlag = true;} - ~FlagSet_Impl(){rFlag = false;} -}; - -IMPL_LINK( OfaTreeOptionsDialog, SelectHdl_Impl, Timer*, EMPTYARG ) -{ - SvTreeListBox* pBox = &aTreeLB; - SvLBoxEntry* pEntry = pBox->GetCurEntry(); - SvLBoxEntry* pParent = pBox->GetParent(pEntry); - pBox->EndSelection(); - - DBG_ASSERT(!bInSelectHdl_Impl, "Timeout handler called twice"); - if(bInSelectHdl_Impl || pCurrentPageEntry == pEntry) - return 0; - //#111938# lock the SelectHdl_Impl to prevent multiple executes - FlagSet_Impl aFlag(bInSelectHdl_Impl); - TabPage* pOldPage = NULL; - TabPage* pNewPage = NULL; - OptionsPageInfo* pOptPageInfo = ( pCurrentPageEntry && aTreeLB.GetParent( pCurrentPageEntry ) ) - ? (OptionsPageInfo*)pCurrentPageEntry->GetUserData() : NULL; - - if ( pOptPageInfo && pOptPageInfo->m_pPage && pOptPageInfo->m_pPage->IsVisible() ) - { - pOldPage = pOptPageInfo->m_pPage; - OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)aTreeLB.GetParent(pCurrentPageEntry)->GetUserData(); - int nLeave = SfxTabPage::LEAVE_PAGE; - if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_pPage->HasExchangeSupport() ) - nLeave = pOptPageInfo->m_pPage->DeactivatePage( pGroupInfo->m_pOutItemSet ); - - if ( nLeave == SfxTabPage::KEEP_PAGE ) - { - // we cannot leave this page - pBox->Select( pCurrentPageEntry ); - return 0; - } - else - pOptPageInfo->m_pPage->Hide(); - } - else if ( pOptPageInfo && pOptPageInfo->m_pExtPage ) - { - pOptPageInfo->m_pExtPage->Hide(); - pOptPageInfo->m_pExtPage->DeactivatePage(); - } - else if ( pCurrentPageEntry && !aTreeLB.GetParent( pCurrentPageEntry ) ) - { - OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo*)pCurrentPageEntry->GetUserData(); - if ( pGroupInfo && pGroupInfo->m_pExtPage ) - { - pGroupInfo->m_pExtPage->Hide(); - pGroupInfo->m_pExtPage->DeactivatePage(); - } - } - if ( pParent ) - { - aPageTitleFT.Hide(); - aLine1FL.Hide(); - aHelpFT.Hide(); - aHelpImg.Hide(); - OptionsPageInfo *pPageInfo = (OptionsPageInfo *)pEntry->GetUserData(); - OptionsGroupInfo* pGroupInfo = (OptionsGroupInfo *)pParent->GetUserData(); - if(!pPageInfo->m_pPage && pPageInfo->m_nPageId > 0) - { - if(pGroupInfo->m_bLoadError) - return 0; - if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) - { - if(!pColorPageItemSet) - { - // Move usage of a static XOutdevItemPool instance here - if(!mpStaticXOutdevItemPool) - { - mpStaticXOutdevItemPool = new XOutdevItemPool(); - } - pColorPageItemSet = new SfxItemSet( *mpStaticXOutdevItemPool, XATTR_FILLSTYLE, XATTR_FILLCOLOR); - pColorPageItemSet->Put( XFillColorItem() ); - } - } - else - { - if(pGroupInfo->m_pModule /*&& !pGroupInfo->pModule->IsLoaded()*/) - { - SfxModule* pOldModule = pGroupInfo->m_pModule; - sal_Bool bIdentical = pGroupInfo->m_pModule == pGroupInfo->m_pShell; - - WaitObject aWait(this); - //pGroupInfo->pModule = pGroupInfo->pModule->Load(); - if(!pGroupInfo->m_pModule) - { - pGroupInfo->m_bLoadError = sal_True; - InfoBox(pBox, sNotLoadedError).Execute(); - return 0; - } - if(bIdentical) - pGroupInfo->m_pShell = pGroupInfo->m_pModule; - //jetzt noch testen, ob es auch in anderen Gruppen das gleiche Module gab (z.B. Text+HTML) - SvLBoxEntry* pTemp = aTreeLB.First(); - while(pTemp) - { - if(!aTreeLB.GetParent(pTemp) && pTemp != pEntry) - { - OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pTemp->GetUserData(); - if(pTGInfo->m_pModule == pOldModule) - { - pTGInfo->m_pModule = pGroupInfo->m_pModule; - if(bIdentical) - pTGInfo->m_pShell = pGroupInfo->m_pModule; - } - } - pTemp = aTreeLB.Next(pTemp); - } - } - -// if ( pPageInfo->nPageId != RID_OPTPAGE_CHART_DEFCOLORS ) - { - if(!pGroupInfo->m_pInItemSet) - pGroupInfo->m_pInItemSet = pGroupInfo->m_pShell - ? pGroupInfo->m_pShell->CreateItemSet( pGroupInfo->m_nDialogId ) - : CreateItemSet( pGroupInfo->m_nDialogId ); - if(!pGroupInfo->m_pOutItemSet) - pGroupInfo->m_pOutItemSet = new SfxItemSet( - *pGroupInfo->m_pInItemSet->GetPool(), - pGroupInfo->m_pInItemSet->GetRanges()); - } - } - - if(pGroupInfo->m_pModule) - { - pPageInfo->m_pPage = pGroupInfo->m_pModule->CreateTabPage( - pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet ); - } - else if(RID_SVXPAGE_COLOR != pPageInfo->m_nPageId) - pPageInfo->m_pPage = ::CreateGeneralTabPage( pPageInfo->m_nPageId, this, *pGroupInfo->m_pInItemSet ); - else - { - pPageInfo->m_pPage = ::CreateGeneralTabPage( - pPageInfo->m_nPageId, this, *pColorPageItemSet ); - SvxColorTabPage& rColPage = *(SvxColorTabPage*)pPageInfo->m_pPage; - const OfaPtrItem* pPtr = NULL; - if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() ) - pPtr = (const OfaPtrItem*)SfxViewFrame::Current()-> - GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON ); - pColorTab = pPtr ? (XColorTable*)pPtr->GetValue() : &XColorTable::GetStdColorTable(); - - rColPage.SetColorTable( pColorTab ); - rColPage.SetPageType( &nUnknownType ); - rColPage.SetDlgType( &nUnknownType ); - rColPage.SetPos( &nUnknownPos ); - rColPage.SetAreaTP( &bIsAreaTP ); - rColPage.SetColorChgd( (ChangeType*)&nChangeType ); - rColPage.Construct(); - } - - DBG_ASSERT( pPageInfo->m_pPage, "tabpage could not created"); - if ( pPageInfo->m_pPage ) - { - SvtViewOptions aTabPageOpt( E_TABPAGE, String::CreateFromInt32( pPageInfo->m_nPageId ) ); - pPageInfo->m_pPage->SetUserData( GetViewOptUserItem( aTabPageOpt ) ); - - Point aTreePos(aTreeLB.GetPosPixel()); - Size aTreeSize(aTreeLB.GetSizePixel()); - Point aGBPos(aHiddenGB.GetPosPixel()); - Size aPageSize(pPageInfo->m_pPage->GetSizePixel()); - Size aGBSize(aHiddenGB.GetSizePixel()); - Point aPagePos( aGBPos.X() + ( aGBSize.Width() - aPageSize.Width() ) / 2, - aGBPos.Y() + ( aGBSize.Height() - aPageSize.Height() ) / 2 ); - pPageInfo->m_pPage->SetPosPixel( aPagePos ); - if ( RID_SVXPAGE_COLOR == pPageInfo->m_nPageId ) - { - pPageInfo->m_pPage->Reset( *pColorPageItemSet ); - pPageInfo->m_pPage->ActivatePage( *pColorPageItemSet ); - } - else - { - pPageInfo->m_pPage->Reset( *pGroupInfo->m_pInItemSet ); - } - } - } - else if ( 0 == pPageInfo->m_nPageId && !pPageInfo->m_pExtPage ) - { - if ( !m_xContainerWinProvider.is() ) - { - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >( - xFactory->createInstance( - C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY ); - DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" ); - } - - pPageInfo->m_pExtPage = new ExtensionsTabPage( - this, 0, pPageInfo->m_sPageURL, pPageInfo->m_sEventHdl, m_xContainerWinProvider ); - Size aSize = aHiddenGB.GetSizePixel(); - aSize.Width() = aSize.Width() - 4; - aSize.Height() = aSize.Height() - 4; - Point aPos = aHiddenGB.GetPosPixel(); - aPos.X() = aPos.X() + 2; - aPos.Y() = aPos.Y() + 2; - pPageInfo->m_pExtPage->SetPosSizePixel( aPos, aSize ); - } - - if ( pPageInfo->m_pPage ) - { - if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId && - pPageInfo->m_pPage->HasExchangeSupport()) - { - pPageInfo->m_pPage->ActivatePage(*pGroupInfo->m_pOutItemSet); - } - pPageInfo->m_pPage->Show(); - } - else if ( pPageInfo->m_pExtPage ) - { - pPageInfo->m_pExtPage->Show(); - pPageInfo->m_pExtPage->ActivatePage(); - } - - String sTmpTitle = sTitle; - sTmpTitle += String::CreateFromAscii(" - "); - sTmpTitle += aTreeLB.GetEntryText(pParent); - sTmpTitle += String::CreateFromAscii(" - "); - sTmpTitle += aTreeLB.GetEntryText(pEntry); - SetText(sTmpTitle); - pCurrentPageEntry = pEntry; - if ( !bForgetSelection ) - { - if ( !pLastPageSaver ) - pLastPageSaver = new LastPageSaver; - if ( !bIsFromExtensionManager ) - pLastPageSaver->m_nLastPageId = pPageInfo->m_nPageId; - if ( pPageInfo->m_pExtPage ) - { - if ( bIsFromExtensionManager ) - pLastPageSaver->m_sLastPageURL_ExtMgr = pPageInfo->m_sPageURL; - else - pLastPageSaver->m_sLastPageURL_Tools = pPageInfo->m_sPageURL; - } - } - pNewPage = pPageInfo->m_pPage; - } - else - { - OptionsGroupInfo* pTGInfo = (OptionsGroupInfo *)pEntry->GetUserData(); - if ( pTGInfo->m_sPageURL.getLength() == 0 ) - { - ImageList* pImgLst = &aPageImages; - //hier den Hilfetext anzeigen - for ( sal_uInt16 i = 0; i < aHelpTextsArr.Count(); ++i ) - { - if ( aHelpTextsArr.GetValue(i) == pTGInfo->m_nDialogId ) - { - aHelpFT.SetText(aHelpTextsArr.GetString(i)); - aHelpImg.SetImage(pImgLst->GetImage(pTGInfo->m_nDialogId)); - break; - } - } - - aPageTitleFT.Show(); - aLine1FL.Show(); - aHelpFT.Show(); - aHelpImg.Show(); - - //auf die Groesse der Bitmap anpassen - if(!bImageResized) - { - const long nCtrlDist = 2; - bImageResized = sal_True; - Point aImgPos(aHelpImg.GetPosPixel()); - Size aImgSize(aHelpImg.GetSizePixel()); - Point aTitlePos(aPageTitleFT.GetPosPixel()); - Point aLinePos(aLine1FL.GetPosPixel()); - Point aHelpPos(aHelpFT.GetPosPixel()); - Size aHelpSize(aHelpFT.GetSizePixel()); - long nXDiff = 0; - long nYDiff = 0; - if(aTitlePos.X() <= (aImgPos.X() + aImgSize.Width() + nCtrlDist)) - { - nXDiff = aImgPos.X() + aImgSize.Width() + nCtrlDist - aTitlePos.X(); - } - if(aLinePos.Y() <= (aImgPos.Y() + aImgSize.Height() + nCtrlDist)) - { - nYDiff = aImgPos.Y() + aImgSize.Height() + nCtrlDist - aLinePos.Y(); - } - aLinePos.Y() += nYDiff; - aLine1FL.SetPosPixel(aLinePos); - - aTitlePos.X() += nXDiff; - aPageTitleFT.SetPosPixel(aTitlePos); - - aHelpPos.X() += nXDiff; - aHelpPos.Y() += nYDiff; - aHelpSize.Width() -= nXDiff; - aHelpSize.Height() -= nYDiff; - aHelpFT.SetPosSizePixel(aHelpPos, aHelpSize); - - Font aFont = aHelpFT.GetFont(); - Size aSz = aFont.GetSize(); - aSz.Height() = (aSz.Height() * 14 ) / 10; - aFont.SetSize(aSz); - aPageTitleFT.SetFont(aFont); - } - - String sTmpTitle = sTitle; - sTmpTitle += String::CreateFromAscii(" - "); - aPageTitleFT.SetText(aTreeLB.GetEntryText(pEntry)); - sTmpTitle += aPageTitleFT.GetText(); - SetText(sTmpTitle); - pCurrentPageEntry = NULL; - } - else - { - if ( !pTGInfo->m_pExtPage ) - { - if ( !m_xContainerWinProvider.is() ) - { - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - m_xContainerWinProvider = Reference < awt::XContainerWindowProvider >( - xFactory->createInstance( - C2U("com.sun.star.awt.ContainerWindowProvider") ), UNO_QUERY ); - DBG_ASSERT( m_xContainerWinProvider.is(), "service com.sun.star.awt.ContainerWindowProvider could not be loaded" ); - } - - pTGInfo->m_pExtPage = - new ExtensionsTabPage( this, 0, pTGInfo->m_sPageURL, rtl::OUString(), m_xContainerWinProvider ); - Size aSize = aHiddenGB.GetSizePixel(); - aSize.Width() = aSize.Width() - 4; - aSize.Height() = aSize.Height() - 4; - Point aPos = aHiddenGB.GetPosPixel(); - aPos.X() = aPos.X() + 2; - aPos.Y() = aPos.Y() + 2; - pTGInfo->m_pExtPage->SetPosSizePixel( aPos, aSize ); - } - - if ( pTGInfo->m_pExtPage ) - { - pTGInfo->m_pExtPage->Show(); - pTGInfo->m_pExtPage->ActivatePage(); - } - - pCurrentPageEntry = pEntry; - } - } - - // restore lost focus, if necessary - Window* pFocusWin = Application::GetFocusWindow(); - // if the focused window is not the options treebox and the old page has the focus - if ( pFocusWin && pFocusWin != pBox && pOldPage && pOldPage->HasChildPathFocus() ) - // then set the focus to the new page or if we are on a group set the focus to the options treebox - pNewPage ? pNewPage->GrabFocus() : pBox->GrabFocus(); - - return 0; -} - -OfaPageResource::OfaPageResource() : - Resource(CUI_RES(RID_OFADLG_OPTIONS_TREE_PAGES)), - aGeneralDlgAry(CUI_RES(SID_GENERAL_OPTIONS)), - aInetDlgAry(CUI_RES(SID_INET_DLG)), - aLangDlgAry(CUI_RES(SID_LANGUAGE_OPTIONS)), - aTextDlgAry(CUI_RES(SID_SW_EDITOPTIONS)), - aHTMLDlgAry(CUI_RES(SID_SW_ONLINEOPTIONS)), - aCalcDlgAry(CUI_RES(SID_SC_EDITOPTIONS)), - aStarMathDlgAry(CUI_RES(SID_SM_EDITOPTIONS)), - aImpressDlgAry(CUI_RES(SID_SD_EDITOPTIONS)), - aDrawDlgAry(CUI_RES(SID_SD_GRAPHIC_OPTIONS)), - aChartDlgAry(CUI_RES(SID_SCH_EDITOPTIONS)), - aFilterDlgAry(CUI_RES(SID_FILTER_DLG)), - aDatasourcesDlgAry(CUI_RES(SID_SB_STARBASEOPTIONS)) -{ - FreeResource(); -} - -sal_Bool EnableSSO( void ) -{ - // SSO must be enabled if the configuration manager bootstrap settings - // are configured as follows ... - // CFG_Offline=false - // CFG_ServerType=uno ( or unspecified ) - // CFG_BackendService= - // com.sun.star.comp.configuration.backend.LdapSingleBackend - - rtl::OUString theIniFile; - osl_getExecutableFile( &theIniFile.pData ); - theIniFile = theIniFile.copy( 0, theIniFile.lastIndexOf( '/' ) + 1 ) + - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SAL_CONFIGFILE( "configmgr" )) ); - ::rtl::Bootstrap theBootstrap( theIniFile ); - - rtl::OUString theOfflineValue; - rtl::OUString theDefaultOfflineValue (RTL_CONSTASCII_USTRINGPARAM("false") ); - theBootstrap.getFrom( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CFG_Offline") ), - theOfflineValue, - theDefaultOfflineValue ); - - rtl::OUString theServerTypeValue; - theBootstrap.getFrom( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CFG_ServerType") ), - theServerTypeValue ); - - rtl::OUString theBackendServiceTypeValue; - theBootstrap.getFrom( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CFG_BackendService") ), - theBackendServiceTypeValue ); - - sal_Bool bSSOEnabled = - ( theOfflineValue == theDefaultOfflineValue && - ( theServerTypeValue.getLength() == 0 || - theServerTypeValue == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("uno") ) ) && - theBackendServiceTypeValue == - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.backend.LdapSingleBackend") ) ); - if ( bSSOEnabled && GetSSOCreator() == 0 ) - { - bSSOEnabled = sal_False; - } - return bSSOEnabled; -} - -extern "C" { static void SAL_CALL thisModule() {} } - -CreateTabPage GetSSOCreator( void ) -{ - static CreateTabPage theSymbol = 0; - if ( theSymbol == 0 ) - { - osl::Module aModule; - rtl::OUString theModuleName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "ssoopt" ) ) ); - if( aModule.loadRelative( - &thisModule, theModuleName, SAL_LOADMODULE_DEFAULT ) ) - { - rtl::OUString theSymbolName( RTL_CONSTASCII_USTRINGPARAM("CreateSSOTabPage" ) ); - theSymbol = reinterpret_cast(aModule.getFunctionSymbol( theSymbolName )); - } - } - - return theSymbol; -} - -SfxItemSet* OfaTreeOptionsDialog::CreateItemSet( sal_uInt16 nId ) -{ - Reference< XPropertySet > xProp( SvxGetLinguPropertySet() ); - SfxItemSet* pRet = 0; - switch(nId) - { - case SID_GENERAL_OPTIONS: - { - pRet = new SfxItemSet( - SFX_APP()->GetPool(), - SID_ATTR_METRIC, SID_ATTR_SPELL, - SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK, - SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER, - SID_ATTR_YEAR2000, SID_ATTR_YEAR2000, - SID_HTML_MODE, SID_HTML_MODE, - 0 ); - - SfxItemSet aOptSet( SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER ); - SFX_APP()->GetOptions(aOptSet); - pRet->Put(aOptSet); - - utl::MiscCfg aMisc; - const SfxPoolItem* pItem; - SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - if ( pViewFrame ) - { - SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); - - // Sonstiges - Year2000 - if( SFX_ITEM_AVAILABLE <= pDispatch->QueryState( SID_ATTR_YEAR2000, pItem ) ) - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, ((const SfxUInt16Item*)pItem)->GetValue() ) ); - else - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); - } - else - pRet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, (sal_uInt16)aMisc.GetYear2000() ) ); - - - // Sonstiges - Tabulator - pRet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning())); - - sal_uInt16 nFlag = aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0; - nFlag |= aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0; - pRet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, nFlag )); - - } - break; - case SID_LANGUAGE_OPTIONS : - { - pRet = new SfxItemSet(SFX_APP()->GetPool(), - SID_ATTR_LANGUAGE, SID_AUTOSPELL_CHECK, - SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE, - SID_OPT_LOCALE_CHANGED, SID_OPT_LOCALE_CHANGED, - SID_SET_DOCUMENT_LANGUAGE, SID_SET_DOCUMENT_LANGUAGE, - 0 ); - - // fuer die Linguistik - - Reference< XSpellChecker1 > xSpell = SvxGetSpellChecker(); - pRet->Put(SfxSpellCheckItem( xSpell, SID_ATTR_SPELL )); - SfxHyphenRegionItem aHyphen( SID_ATTR_HYPHENREGION ); - - sal_Int16 nMinLead = 2, - nMinTrail = 2; - if (xProp.is()) - { - xProp->getPropertyValue( String::CreateFromAscii( - UPN_HYPH_MIN_LEADING) ) >>= nMinLead; - xProp->getPropertyValue( String::CreateFromAscii( - UPN_HYPH_MIN_TRAILING) ) >>= nMinTrail; - } - aHyphen.GetMinLead() = (sal_uInt8)nMinLead; - aHyphen.GetMinTrail() = (sal_uInt8)nMinTrail; - - const SfxPoolItem* pItem; - SfxPoolItem* pClone; - SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - if ( pViewFrame ) - { - SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); - if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_LANGUAGE, pItem)) - pRet->Put(SfxUInt16Item(SID_ATTR_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); - if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CJK_LANGUAGE, pItem)) - pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CJK_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); - if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_ATTR_CHAR_CTL_LANGUAGE, pItem)) - pRet->Put(SfxUInt16Item(SID_ATTR_CHAR_CTL_LANGUAGE, ((const SvxLanguageItem*)pItem)->GetLanguage())); - - pRet->Put(aHyphen); - if(SFX_ITEM_AVAILABLE <= pDispatch->QueryState(SID_AUTOSPELL_CHECK, pItem)) - { - pClone = pItem->Clone(); - pRet->Put(*pClone); - delete pClone; - } - else - { - sal_Bool bVal = sal_False; - if (xProp.is()) - { - xProp->getPropertyValue( String::CreateFromAscii( UPN_IS_SPELL_AUTO) ) >>= bVal; - } - - pRet->Put(SfxBoolItem(SID_AUTOSPELL_CHECK, bVal)); - } - } - pRet->Put( SfxBoolItem( SID_SET_DOCUMENT_LANGUAGE, bIsForSetDocumentLanguage ) ); - } - break; - case SID_INET_DLG : - pRet = new SfxItemSet( SFX_APP()->GetPool(), - SID_BASIC_ENABLED, SID_BASIC_ENABLED, - //SID_OPTIONS_START - ..END - SID_OPTIONS_START, SID_INET_PROXY_PORT, - SID_SAVEREL_INET, SID_SAVEREL_FSYS, - SID_INET_SMTPSERVER, SID_INET_SMTPSERVER, - SID_INET_NOPROXY, SID_INET_SOCKS_PROXY_PORT, - SID_INET_DNS_AUTO, SID_INET_DNS_SERVER, - SID_SECURE_URL, SID_SECURE_URL, - 0L ); - SFX_APP()->GetOptions(*pRet); - break; - case SID_FILTER_DLG: - pRet = new SfxItemSet( SFX_APP()->GetPool(), - SID_ATTR_DOCINFO, SID_ATTR_AUTOSAVEMINUTE, - SID_SAVEREL_INET, SID_SAVEREL_FSYS, - SID_ATTR_PRETTYPRINTING, SID_ATTR_PRETTYPRINTING, - SID_ATTR_WARNALIENFORMAT, SID_ATTR_WARNALIENFORMAT, - 0 ); - SFX_APP()->GetOptions(*pRet); - break; - - case SID_SB_STARBASEOPTIONS: - pRet = new SfxItemSet( SFX_APP()->GetPool(), - SID_SB_POOLING_ENABLED, SID_SB_DB_REGISTER, - 0 ); - ::offapp::ConnectionPoolConfig::GetOptions(*pRet); - ::svx::DbRegisteredNamesConfig::GetOptions(*pRet); - break; - - case SID_SCH_EDITOPTIONS: - { - SvxChartOptions aChartOpt; - pRet = new SfxItemSet( SFX_APP()->GetPool(), SID_SCH_EDITOPTIONS, SID_SCH_EDITOPTIONS ); - pRet->Put( SvxChartColorTableItem( SID_SCH_EDITOPTIONS, aChartOpt.GetDefaultColors() ) ); - break; - } - } - return pRet; -} - -void OfaTreeOptionsDialog::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) -{ - switch(nId) - { - case SID_GENERAL_OPTIONS: - { - utl::MiscCfg aMisc; - const SfxPoolItem* pItem; - SfxItemSet aOptSet(SFX_APP()->GetPool(), SID_ATTR_QUICKLAUNCHER, SID_ATTR_QUICKLAUNCHER ); - aOptSet.Put(rSet); - if(aOptSet.Count()) - SFX_APP()->SetOptions( aOptSet ); - // Dispatcher neu holen, weil SetOptions() ggf. den Dispatcher zerst"ort hat - SfxViewFrame *pViewFrame = SfxViewFrame::Current(); -// ------------------------------------------------------------------------- -// Year2000 auswerten -// ------------------------------------------------------------------------- - sal_uInt16 nY2K = USHRT_MAX; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_YEAR2000, sal_False, &pItem ) ) - nY2K = ((const SfxUInt16Item*)pItem)->GetValue(); - if( USHRT_MAX != nY2K ) - { - if ( pViewFrame ) - { - SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); - pDispatch->Execute( SID_ATTR_YEAR2000, SFX_CALLMODE_ASYNCHRON, pItem, 0L); - } - aMisc.SetYear2000(nY2K); - } - -// ------------------------------------------------------------------------- -// Drucken auswerten -// ------------------------------------------------------------------------- - if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_NOTFOUND_WARN, sal_False, &pItem)) - aMisc.SetNotFoundWarning(((const SfxBoolItem*)pItem)->GetValue()); - - if(SFX_ITEM_SET == rSet.GetItemState(SID_PRINTER_CHANGESTODOC, sal_False, &pItem)) - { - const SfxFlagItem* pFlag = (const SfxFlagItem*)pItem; - aMisc.SetPaperSizeWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_SIZE )); - aMisc.SetPaperOrientationWarning(0 != (pFlag->GetValue() & SFX_PRINTER_CHG_ORIENTATION )); - } -// ------------------------------------------------------------------------- -// evaluate help options -// ------------------------------------------------------------------------- - if ( SvtHelpOptions().IsHelpTips() != Help::IsQuickHelpEnabled() ) - SvtHelpOptions().IsHelpTips() ? Help::EnableQuickHelp() : Help::DisableQuickHelp(); - if ( SvtHelpOptions().IsExtendedHelp() != Help::IsBalloonHelpEnabled() ) - SvtHelpOptions().IsExtendedHelp() ? Help::EnableBalloonHelp() : Help::DisableBalloonHelp(); - } - break; - case SID_LANGUAGE_OPTIONS : - { - OfaTreeOptionsDialog::ApplyLanguageOptions(rSet); - } - break; - case SID_INET_DLG : - case SID_FILTER_DLG: - SFX_APP()->SetOptions( rSet ); - break; - - case SID_SB_STARBASEOPTIONS: - ::offapp::ConnectionPoolConfig::SetOptions( rSet ); - ::svx::DbRegisteredNamesConfig::SetOptions(rSet); - break; - - case SID_SCH_EDITOPTIONS: - // nothing to do. Chart options only apply to newly created charts - break; - - default: - { - OSL_FAIL( "Unhandled option in ApplyItemSet" ); - } - break; - } - -} -void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) -{ - sal_Bool bSaveSpellCheck = sal_False; - const SfxPoolItem* pItem; - - if ( SFX_ITEM_SET == rSet.GetItemState( SID_SPELL_MODIFIED, sal_False, &pItem ) ) - { - bSaveSpellCheck = ( (const SfxBoolItem*)pItem )->GetValue(); - } - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - Reference< XPropertySet > xProp( - xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguProperties") ) ), - UNO_QUERY ); - if ( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_HYPHENREGION, sal_False, &pItem ) ) - { - const SfxHyphenRegionItem* pHyphenItem = (const SfxHyphenRegionItem*)pItem; - - if (xProp.is()) - { - xProp->setPropertyValue( - String::CreateFromAscii(UPN_HYPH_MIN_LEADING), - makeAny((sal_Int16) pHyphenItem->GetMinLead()) ); - xProp->setPropertyValue( - String::CreateFromAscii(UPN_HYPH_MIN_TRAILING), - makeAny((sal_Int16) pHyphenItem->GetMinTrail()) ); - } - bSaveSpellCheck = sal_True; - } - - SfxViewFrame *pViewFrame = SfxViewFrame::Current(); - if ( pViewFrame ) - { - SfxDispatcher* pDispatch = pViewFrame->GetDispatcher(); - pItem = 0; - if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_LANGUAGE, sal_False, &pItem )) - { - pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - bSaveSpellCheck = sal_True; - } - if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE, sal_False, &pItem )) - { - pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - bSaveSpellCheck = sal_True; - } - if(SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE, sal_False, &pItem )) - { - pDispatch->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - bSaveSpellCheck = sal_True; - } - - if( SFX_ITEM_SET == rSet.GetItemState(SID_AUTOSPELL_CHECK, sal_False, &pItem )) - { - sal_Bool bOnlineSpelling = ((const SfxBoolItem*)pItem)->GetValue(); - pDispatch->Execute(SID_AUTOSPELL_CHECK, - SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, pItem, 0L); - - if (xProp.is()) - { - xProp->setPropertyValue( - String::CreateFromAscii(UPN_IS_SPELL_AUTO), - makeAny(bOnlineSpelling) ); - } - } - - if( bSaveSpellCheck ) - { - //! the config item has changed since we modified the - //! property set it uses - pDispatch->Execute(SID_SPELLCHECKER_CHANGED, SFX_CALLMODE_ASYNCHRON); - } - } - - if( SFX_ITEM_SET == rSet.GetItemState(SID_OPT_LOCALE_CHANGED, sal_False, &pItem )) - { - SfxViewFrame* _pViewFrame = SfxViewFrame::GetFirst(); - while ( _pViewFrame ) - { - _pViewFrame->GetDispatcher()->Execute(pItem->Which(), SFX_CALLMODE_ASYNCHRON, pItem, 0L); - _pViewFrame = SfxViewFrame::GetNext( *_pViewFrame ); - } - } -} - -rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) -{ - rtl::OUString sIdentifier; - Reference < XFrame > xCurrentFrame( _xFrame ); - Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); - if ( !xCurrentFrame.is() ) - { - Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); - } - - if ( xCurrentFrame.is() && xModuleManager.is() ) - { - try - { - sIdentifier = xModuleManager->identify( xCurrentFrame ); - } - catch ( ::com::sun::star::frame::UnknownModuleException& ) - { - DBG_WARNING( "getActiveModule_Impl(): unknown module" ); - } - catch ( Exception& ) - { - DBG_ERRORFILE( "getActiveModule_Impl(): exception of XModuleManager::identify()" ); - } - } - - return sIdentifier; -} - -void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) -{ - OfaPageResource aDlgResource; - sal_uInt16 nGroup = 0; - - SvtOptionsDialogOptions aOptionsDlgOpt; - sal_uInt16 i, nPageId; - - // %PRODUCTNAME options - sal_Bool isSSOEnabled = EnableSSO(); - if ( !lcl_isOptionHidden( SID_GENERAL_OPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rGeneralArray = aDlgResource.GetGeneralArray(); - setGroupName( C2U("ProductName"), rGeneralArray.GetString(0) ); - nGroup = AddGroup( rGeneralArray.GetString(0), 0, 0, SID_GENERAL_OPTIONS ); - sal_uInt16 nEnd = static_cast< sal_uInt16 >( rGeneralArray.Count() ); - String sPageTitle; - - for ( i = 1; i < nEnd; ++i ) - { - String sNewTitle = rGeneralArray.GetString(i); - nPageId = (sal_uInt16)rGeneralArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - - // Disable Online Update page if service not installed - if( RID_SVXPAGE_ONLINEUPDATE == nPageId ) - { - const ::rtl::OUString sService = C2U("com.sun.star.setup.UpdateCheck"); - - try - { - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XInterface > xService( xFactory->createInstance( sService ) ); - - if( ! xService.is() ) - continue; - } - catch ( ::com::sun::star::loader::CannotActivateFactoryException& ) - { - continue; - } - } - // Disable OOoImprovement page if not enabled - if( RID_SVXPAGE_IMPROVEMENT == nPageId ) - { - continue; - } - if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled ) - { - AddTabPage( nPageId, sNewTitle, nGroup ); - } - } - // private iteration hack for Improvement Program - // hack for OOo 3.1 - // should not be in found in any later release - for(bool bOnce = false; bOnce==false; bOnce=true) - { - String sNewTitle = C2U("Improvement Program"); - { - SvxImprovementPage aTempTabPage(this); - sNewTitle = aTempTabPage.GetTitleText(); - } - nPageId = RID_SVXPAGE_IMPROVEMENT; - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - // Disable OOoImprovement page if not enabled - { - const ::rtl::OUString sService = C2U("com.sun.star.oooimprovement.CoreController"); - try - { - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < ::com::sun::star::oooimprovement::XCoreController > xService( xFactory->createInstance( sService ), UNO_QUERY ); - - if( ! xService.is() ) - continue; - if( ! xService->showBuiltinOptionsPage(1)) - continue; - } - catch ( ::com::sun::star::loader::CannotActivateFactoryException& ) - { - continue; - } - } - if ( nPageId != RID_SVXPAGE_SSO || isSSOEnabled ) - { - AddTabPage( nPageId, sNewTitle, nGroup ); - } - } - } - - // Load and Save options - if ( !lcl_isOptionHidden( SID_FILTER_DLG, aOptionsDlgOpt ) ) - { - ResStringArray& rFilterArray = aDlgResource.GetFilterArray(); - setGroupName( C2U("LoadSave"), rFilterArray.GetString(0) ); - nGroup = AddGroup( rFilterArray.GetString(0), 0, 0, SID_FILTER_DLG ); - for ( i = 1; i < rFilterArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rFilterArray.GetValue(i); - if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - AddTabPage( nPageId, rFilterArray.GetString(i), nGroup ); - } - } - - // Language options - SvtLanguageOptions aLanguageOptions; - if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rLangArray = aDlgResource.GetLangArray(); - setGroupName( C2U("LanguageSettings"), rLangArray.GetString(0) ); - nGroup = AddGroup( rLangArray.GetString(0), 0, 0, SID_LANGUAGE_OPTIONS ); - for ( i = 1; i < rLangArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rLangArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aLanguageOptions.IsJapaneseFindEnabled() ) && - ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aLanguageOptions.IsAsianTypographyEnabled() ) && - ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) ) - AddTabPage( nPageId, rLangArray.GetString(i), nGroup ); - } - } - - - rtl::OUString aFactory = getCurrentFactory_Impl( _xFrame ); - rtl::OUString sTemp = GetModuleIdentifier( comphelper::getProcessServiceFactory(), _xFrame ); - DBG_ASSERT( sTemp == aFactory, "S H I T!!!" ); - - // Writer and Writer/Web options - SvtModuleOptions aModuleOpt; - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) ) - { - // Textdokument - ResStringArray& rTextArray = aDlgResource.GetTextArray(); - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) - || aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.WebDocument" ) ) - || aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.GlobalDocument" ) ) ) - { - SfxModule* pSwMod = (*(SfxModule**) GetAppData(SHL_WRITER)); - if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) ) - { - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.WebDocument" ) ) ) - setGroupName( C2U("WriterWeb"), rTextArray.GetString(0) ); - else - setGroupName( C2U("Writer"), rTextArray.GetString(0) ); - nGroup = AddGroup(rTextArray.GetString(0), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); - for ( i = 1; i < rTextArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rTextArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aLanguageOptions.IsCJKFontEnabled() ) && - ( RID_SW_TP_STD_FONT_CTL != nPageId || aLanguageOptions.IsCTLFontEnabled() ) && - ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) ) - AddTabPage( nPageId, rTextArray.GetString(i), nGroup ); - } -#ifdef DBG_UTIL - AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup ); -#endif - } - - // HTML-Dokument - if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rHTMLArray = aDlgResource.GetHTMLArray(); - nGroup = AddGroup(rHTMLArray.GetString(0), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); - for( i = 1; i < rHTMLArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rHTMLArray.GetValue(i); - if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - AddTabPage( nPageId, rHTMLArray.GetString(i), nGroup ); - } -#ifdef DBG_UTIL - AddTabPage( RID_SW_TP_OPTTEST_PAGE, String::CreateFromAscii("Interner Test"), nGroup ); -#endif - } - } - } - - // Calc options - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) ) - { - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.sheet.SpreadsheetDocument" ) )) - { - if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rCalcArray = aDlgResource.GetCalcArray(); - SfxModule* pScMod = ( *( SfxModule** ) GetAppData( SHL_CALC ) ); - setGroupName( C2U("Calc"), rCalcArray.GetString(0) ); - nGroup = AddGroup( rCalcArray.GetString( 0 ), pScMod, pScMod, SID_SC_EDITOPTIONS ); - const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rCalcArray.Count() ); - for ( i = 1; i < nCount; ++i ) - { - nPageId = (sal_uInt16)rCalcArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; -// if( bCTL || nId != RID_OFA_TP_INTERNATIONAL ) -// #103755# if an international tabpage is need one day, this should be used again... ;-) - if ( nPageId != RID_OFA_TP_INTERNATIONAL ) - AddTabPage( nPageId, rCalcArray.GetString( i ), nGroup ); - } - } - } - } - - // Impress options - SfxModule* pSdMod = ( *( SfxModule** ) GetAppData( SHL_DRAW ) ); - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) ) - { - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) )) - { - if ( !lcl_isOptionHidden( SID_SD_EDITOPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rImpressArray = aDlgResource.GetImpressArray(); - setGroupName( C2U("Impress"), rImpressArray.GetString(0) ); - nGroup = AddGroup( rImpressArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_EDITOPTIONS ); - const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled(); - const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rImpressArray.Count() ); - for ( i = 1; i < nCount; ++i ) - { - nPageId = (sal_uInt16)rImpressArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_IMPR ) - AddTabPage( nPageId, rImpressArray.GetString(i), nGroup ); - } - } - } - } - - // Draw options - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) ) - { - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) )) - { - if ( !lcl_isOptionHidden( SID_SD_GRAPHIC_OPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rDrawArray = aDlgResource.GetDrawArray(); - setGroupName( C2U("Draw"), rDrawArray.GetString(0) ); - nGroup = AddGroup( rDrawArray.GetString( 0 ), pSdMod, pSdMod, SID_SD_GRAPHIC_OPTIONS ); - const sal_Bool bCTL = aLanguageOptions.IsCTLFontEnabled(); - const sal_uInt16 nCount = static_cast< const sal_uInt16 >( rDrawArray.Count() ); - for ( i = 1; i < nCount; ++i ) - { - nPageId = (sal_uInt16)rDrawArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; - if ( bCTL || nPageId != RID_OFA_TP_INTERNATIONAL_SD ) - AddTabPage( nPageId, rDrawArray.GetString(i), nGroup ); - } - } - } - } - - // Math options - if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) ) - { - if ( aFactory.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.formula.FormulaProperties" ) )) - { - if ( !lcl_isOptionHidden( SID_SM_EDITOPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rStarMathArray = aDlgResource.GetStarMathArray(); - SfxModule* pSmMod = (*(SfxModule**) GetAppData(SHL_SM)); - setGroupName( C2U("Math"), rStarMathArray.GetString(0) ); - nGroup = AddGroup(rStarMathArray.GetString(0), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); - for ( i = 1; i < rStarMathArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rStarMathArray.GetValue(i); - if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - AddTabPage( nPageId, rStarMathArray.GetString(i), nGroup ); - } - } - } - } - - // Database - needed only if there is an application which integrates with databases - if ( !lcl_isOptionHidden( SID_SB_STARBASEOPTIONS, aOptionsDlgOpt ) && - ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) - || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) - || aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) - ) ) - { - ResStringArray& rDSArray = aDlgResource.GetDatasourcesArray(); - setGroupName( C2U("Base"), rDSArray.GetString(0) ); - nGroup = AddGroup( rDSArray.GetString(0), 0, NULL, SID_SB_STARBASEOPTIONS ); - for ( i = 1; i < rDSArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rDSArray.GetValue(i); - if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - AddTabPage( nPageId, rDSArray.GetString(i), nGroup ); - } - } - - // Chart options (always installed and active) - if ( !lcl_isOptionHidden( SID_SCH_EDITOPTIONS, aOptionsDlgOpt ) ) - { - ResStringArray& rChartArray = aDlgResource.GetChartArray(); - setGroupName( C2U("Charts"), rChartArray.GetString(0) ); - nGroup = AddGroup( rChartArray.GetString(0), 0, 0, SID_SCH_EDITOPTIONS ); - for ( i = 1; i < rChartArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rChartArray.GetValue(i); - if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - AddTabPage( nPageId, rChartArray.GetString(i), nGroup ); - } - } - - // Internet options - if ( !lcl_isOptionHidden( SID_INET_DLG, aOptionsDlgOpt ) ) - { - ResStringArray& rInetArray = aDlgResource.GetInetArray(); - setGroupName( C2U("Internet"), rInetArray.GetString(0) ); - nGroup = AddGroup(rInetArray.GetString(0), 0, 0, SID_INET_DLG ); - - for ( i = 1; i < rInetArray.Count(); ++i ) - { - nPageId = (sal_uInt16)rInetArray.GetValue(i); - if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) - continue; -#if defined WNT - // Disable E-mail tab-page on Windows - if ( nPageId == RID_SVXPAGE_INET_MAIL ) - continue; -#endif -#if defined MACOSX - // Disable Mozilla Plug-in tab-page on Mac - if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN ) - continue; -#endif -#ifdef LINUX - // Disable Mozilla Plug-in tab-page on Linux if we find a - // globally installed plugin - if ( nPageId == RID_SVXPAGE_INET_MOZPLUGIN ) { - struct stat sb; - char *p; - bool bHaveSystemWidePlugin = false; - char mozpaths[]="/usr/lib/mozilla/plugins/libnpsoplugin.so:/usr/lib/firefox/plugins/libnpsoplugin.so:/usr/lib/mozilla-firefox/plugins/libnpsoplugin.so:/usr/lib/iceweasel/plugins/libnpsoplugin.so:/usr/lib/iceape/plugins/libnpsoplugin.so:/usr/lib/browser-plugins/libnpsoplugin.so:/usr/lib64/browser-plugins/libnpsoplugin.so"; - - p = strtok(mozpaths, ":"); - while (p != NULL) { - if (stat(p, &sb) != -1) { - bHaveSystemWidePlugin = true; - break; - } - p = strtok(NULL, ":"); - } - - if (bHaveSystemWidePlugin == true) - continue; - } -#endif - AddTabPage( nPageId, rInetArray.GetString(i), nGroup ); - } - } - -/*!!! - ResizeTreeLB(); - ActivateLastSelection(); - */ -} - -namespace -{ - void MoveControl( Control& _rCtrl, long _nDeltaPixel ) - { - Point aPt( _rCtrl.GetPosPixel() ); - aPt.X() += _nDeltaPixel; - _rCtrl.SetPosPixel( aPt ); - } -} - -void OfaTreeOptionsDialog::ResizeTreeLB( void ) -{ - const long nMax = aHiddenGB.GetSizePixel().Width() * 42 / 100; - // don't ask where 42 comes from... but it looks / feels ok ;-) - long nDelta = 50; // min. - sal_uInt16 nDepth = 0; - const long nIndent0 = PixelToLogic( Size( 28, 0 ) ).Width(); - const long nIndent1 = PixelToLogic( Size( 52, 0 ) ).Width(); - - SvTreeList* pTreeList = aTreeLB.GetModel(); - DBG_ASSERT( pTreeList, "-OfaTreeOptionsDialog::ResizeTreeLB(): no model, no cookies!" ); - - SvListEntry* pEntry = pTreeList->First(); - while( pEntry ) - { - long n = aTreeLB.GetTextWidth( aTreeLB.GetEntryText( static_cast< SvLBoxEntry* >( pEntry ) ) ); - n += ((nDepth == 0) ? nIndent0 : nIndent1); - - if( n > nDelta ) - nDelta = n; - - pEntry = pTreeList->Next( pEntry, &nDepth ); - } - - nDelta = LogicToPixel( Size( nDelta + 3, 0 ) ).Width(); // + extra space [logic] - nDelta += GetSettings().GetStyleSettings().GetScrollBarSize(); // + scroll bar, in case it's needed - - if( nDelta > nMax ) - nDelta = nMax; - - // starting resizing with this - Size aSize( GetSizePixel() ); - aSize.Width() += nDelta; - SetSizePixel( aSize ); - - // resize treelistbox - aSize = aTreeLB.GetSizePixel(); - aSize.Width() += nDelta; - aTreeLB.SetSizePixel( aSize ); - - // ... and move depending controls - MoveControl( aOkPB, nDelta ); - MoveControl( aCancelPB, nDelta ); - MoveControl( aHelpPB, nDelta ); - MoveControl( aBackPB, nDelta ); - MoveControl( aHiddenGB, nDelta ); - MoveControl( aPageTitleFT, nDelta ); - MoveControl( aLine1FL, nDelta ); - MoveControl( aHelpFT, nDelta ); - MoveControl( aHelpImg, nDelta ); -} - -bool isNodeActive( OptionsNode* pNode, Module* pModule ) -{ - if ( pNode ) - { - // Node for all modules actine? - if ( pNode->m_bAllModules ) - return true; - - // OOo-Nodes (Writer, Calc, Impress...) are active if node is already inserted - if ( getGroupName( pNode->m_sId, false ).Len() > 0 ) - return true; - - // no module -> not active - if ( !pModule ) - return false; - - // search node in active module - if ( pModule->m_bActive ) - { - for ( sal_uInt32 j = 0; j < pModule->m_aNodeList.size(); ++j ) - if ( pModule->m_aNodeList[j]->m_sId == pNode->m_sId ) - return true; - } - } - return false; -} - -void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtensionId ) -{ - Module* pModule = NULL; - Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory(); - // open optionsdialog.xcu - Reference< XNameAccess > xRoot( - ::comphelper::ConfigurationHelper::openConfig( - xMSFac, C2U("org.openoffice.Office.OptionsDialog"), - ::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY ); - DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" ); - // when called by Tools - Options then load nodes of active module - if ( rExtensionId.getLength() == 0 ) - pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot ); - - VectorOfNodes aNodeList; - LoadNodes( xRoot, pModule, rExtensionId, aNodeList ); - InsertNodes( aNodeList ); -} - -rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( - const Reference< XMultiServiceFactory >& xMFac, const Reference< XFrame >& rFrame ) -{ - rtl::OUString sModule; - Reference < XFrame > xCurrentFrame( rFrame ); - Reference < XModuleManager > xModuleManager( xMFac->createInstance( - C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); - - if ( !xCurrentFrame.is() ) - { - Reference < XDesktop > xDesktop( xMFac->createInstance( - C2U("com.sun.star.frame.Desktop") ), UNO_QUERY ); - if ( xDesktop.is() ) - xCurrentFrame = xDesktop->getCurrentFrame(); - } - - if ( xCurrentFrame.is() && xModuleManager.is() ) - { - try - { - sModule = xModuleManager->identify( xCurrentFrame ); - } - catch ( ::com::sun::star::frame::UnknownModuleException& ) - { - DBG_WARNING( "OfaTreeOptionsDialog::GetModuleIdentifier(): unknown module" ); - } - catch ( Exception& ) - { - DBG_ERRORFILE( "OfaTreeOptionsDialog::GetModuleIdentifier(): exception of XModuleManager::identify()" ); - } - } - return sModule; -} - -Module* OfaTreeOptionsDialog::LoadModule( - const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot ) -{ - Module* pModule = NULL; - Reference< XNameAccess > xSet; - - if ( xRoot->hasByName( C2U("Modules") ) ) - { - xRoot->getByName( C2U("Modules") ) >>= xSet; - if ( xSet.is() ) - { - Sequence< rtl::OUString > seqNames = xSet->getElementNames(); - for ( int i = 0; i < seqNames.getLength(); ++i ) - { - rtl::OUString sModule( seqNames[i] ); - if ( rModuleIdentifier == sModule ) - { - // current active module found - pModule = new Module( sModule ); - pModule->m_bActive = true; - - Reference< XNameAccess > xModAccess; - xSet->getByName( seqNames[i] ) >>= xModAccess; - if ( xModAccess.is() ) - { - // load the nodes of this module - Reference< XNameAccess > xNodeAccess; - xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess; - if ( xNodeAccess.is() ) - { - Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames(); - Reference< XNameAccess > xAccess; - sal_Int32 nIndex = -1; - for ( int x = 0; x < xTemp.getLength(); ++x ) - { - xNodeAccess->getByName( xTemp[x] ) >>= xAccess; - if ( xAccess.is() ) - { - xAccess->getByName( C2U("Index") ) >>= nIndex; - if ( nIndex < 0 ) - // append nodes with index < 0 - pModule->m_aNodeList.push_back( - new OrderedEntry( nIndex, xTemp[x] ) ); - else - { - // search position of the node - sal_uInt32 y = 0; - for ( ; y < pModule->m_aNodeList.size(); ++y ) - { - sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex; - if ( nNodeIdx < 0 || nNodeIdx > nIndex ) - break; - } - // and insert the node on this position - pModule->m_aNodeList.insert( - pModule->m_aNodeList.begin() + y, - new OrderedEntry( nIndex, xTemp[x] ) ); - } - } - } - } - } - } - } - } - } - return pModule; -} - -void OfaTreeOptionsDialog::LoadNodes( - const Reference< XNameAccess >& xRoot, Module* pModule, - const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList ) -{ - Reference< XNameAccess > xSet; - if ( xRoot->hasByName( C2U("Nodes") ) ) - { - xRoot->getByName( C2U("Nodes") ) >>= xSet; - if ( xSet.is() ) - { - VectorOfNodes aNodeList; - Sequence< rtl::OUString > seqNames = xSet->getElementNames(); - - for ( int i = 0; i < seqNames.getLength(); ++i ) - { - String sGroupName( seqNames[i] ); - Reference< XNameAccess > xNodeAccess; - xSet->getByName( seqNames[i] ) >>= xNodeAccess; - - if ( xNodeAccess.is() ) - { - rtl::OUString sNodeId, sLabel, sPageURL, sGroupId; - bool bAllModules = false; - sal_Int32 nGroupIndex = 0; - - sNodeId = seqNames[i]; - xNodeAccess->getByName( C2U("Label") ) >>= sLabel; - xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL; - xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules; - xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId; - xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex; - - if ( sLabel.getLength() == 0 ) - sLabel = sGroupName; - String sTemp = getGroupName( sLabel, rExtensionId.getLength() > 0 ); - if ( sTemp.Len() > 0 ) - sLabel = sTemp; - OptionsNode* pNode = - new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex ); - - if ( !rExtensionId.getLength() && !isNodeActive( pNode, pModule ) ) - { - delete pNode; - continue; - } - - Reference< XNameAccess > xLeavesSet; - xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet; - if ( xLeavesSet.is() ) - { - Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames(); - for ( int j = 0; j < seqLeaves.getLength(); ++j ) - { - Reference< XNameAccess > xLeaveAccess; - xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess; - - if ( xLeaveAccess.is() ) - { - rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId; - sal_Int32 nLeafGrpIdx = 0; - - xLeaveAccess->getByName( C2U("Id") ) >>= sId; - xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel; - xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL; - xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl; - xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId; - xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx; - - if ( !rExtensionId.getLength() || sId == rExtensionId ) - { - OptionsLeaf* pLeaf = new OptionsLeaf( - sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx ); - - if ( sLeafGrpId.getLength() > 0 ) - { - bool bAlreadyOpened = false; - if ( pNode->m_aGroupedLeaves.size() > 0 ) - { - for ( sal_uInt32 k = 0; - k < pNode->m_aGroupedLeaves.size(); ++k ) - { - if ( pNode->m_aGroupedLeaves[k].size() > 0 && - pNode->m_aGroupedLeaves[k][0]->m_sGroupId - == sLeafGrpId ) - { - sal_uInt32 l = 0; - for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l ) - { - if ( pNode->m_aGroupedLeaves[k][l]-> - m_nGroupIndex >= nLeafGrpIdx ) - break; - } - pNode->m_aGroupedLeaves[k].insert( - pNode->m_aGroupedLeaves[k].begin() + l, pLeaf ); - bAlreadyOpened = true; - break; - } - } - } - if ( !bAlreadyOpened ) - { - VectorOfLeaves aGroupedLeaves; - aGroupedLeaves.push_back( pLeaf ); - pNode->m_aGroupedLeaves.push_back( aGroupedLeaves ); - } - } - else - pNode->m_aLeaves.push_back( - new OptionsLeaf( - sId, sLeafLabel, sLeafURL, - sEventHdl, sLeafGrpId, nLeafGrpIdx ) ); - } - } - } - } - - // do not insert nodes without leaves - if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 ) - { - pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode ); - } - } - } - - if ( pModule && aNodeList.size() > 0 ) - { - sal_uInt32 i = 0, j = 0; - for ( ; i < pModule->m_aNodeList.size(); ++i ) - { - rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId; - for ( j = 0; j < aNodeList.size(); ++j ) - { - OptionsNode* pNode = aNodeList[j]; - if ( pNode->m_sId == sNodeId ) - { - rOutNodeList.push_back( pNode ); - aNodeList.erase( aNodeList.begin() + j ); - break; - } - } - } - - for ( i = 0; i < aNodeList.size(); ++i ) - rOutNodeList.push_back( aNodeList[i] ); - } - } - } -} - -sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB ) -{ - String sGroupName( rGroupName ); - sal_uInt16 nRet = 0; - SvLBoxEntry* pEntry = rTreeLB.First(); - while( pEntry ) - { - if ( !rTreeLB.GetParent( pEntry ) ) - { - String sTemp( rTreeLB.GetEntryText( pEntry ) ); - if ( sTemp == sGroupName ) - return nRet; - nRet++; - } - pEntry = rTreeLB.Next( pEntry ); - } - - return USHRT_MAX; -} - -void lcl_insertLeaf( - OfaTreeOptionsDialog* pDlg, OptionsNode* pNode, OptionsLeaf* pLeaf, const SvTreeListBox& rTreeLB ) -{ - sal_uInt16 nGrpId = lcl_getGroupId( pNode->m_sLabel, rTreeLB ); - if ( USHRT_MAX == nGrpId ) - { - sal_uInt16 nNodeGrpId = getGroupNodeId( pNode->m_sId ); - nGrpId = pDlg->AddGroup( pNode->m_sLabel, NULL, NULL, nNodeGrpId ); - if ( pNode->m_sPageURL.getLength() > 0 ) - { - SvLBoxEntry* pGrpEntry = rTreeLB.GetEntry( 0, nGrpId ); - DBG_ASSERT( pGrpEntry, "OfaTreeOptionsDialog::InsertNodes(): no group" ); - if ( pGrpEntry ) - { - OptionsGroupInfo* pGrpInfo = - static_cast(pGrpEntry->GetUserData()); - pGrpInfo->m_sPageURL = pNode->m_sPageURL; - } - } - } - OptionsPageInfo* pInfo = pDlg->AddTabPage( 0, pLeaf->m_sLabel, nGrpId ); - pInfo->m_sPageURL = pLeaf->m_sPageURL; - pInfo->m_sEventHdl = pLeaf->m_sEventHdl; -} - -void OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList ) -{ - for ( sal_uInt32 i = 0; i < rNodeList.size(); ++i ) - { - OptionsNode* pNode = rNodeList[i]; - - if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 ) - { - sal_uInt32 j = 0; - for ( ; j < pNode->m_aGroupedLeaves.size(); ++j ) - { - for ( sal_uInt32 k = 0; k < pNode->m_aGroupedLeaves[j].size(); ++k ) - { - OptionsLeaf* pLeaf = pNode->m_aGroupedLeaves[j][k]; - lcl_insertLeaf( this, pNode, pLeaf, aTreeLB ); - } - } - - for ( j = 0; j < pNode->m_aLeaves.size(); ++j ) - { - OptionsLeaf* pLeaf = pNode->m_aLeaves[j]; - lcl_insertLeaf( this, pNode, pLeaf, aTreeLB ); - } - } - } -} - -short OfaTreeOptionsDialog::Execute() -{ - ::std::auto_ptr< SvxDicListChgClamp > pClamp; - if ( !bIsFromExtensionManager ) - { - // collect all DictionaryList Events while the dialog is executed - Reference xDictionaryList(SvxGetDictionaryList()); - pClamp = ::std::auto_ptr< SvxDicListChgClamp >( new SvxDicListChgClamp( xDictionaryList ) ); - } - short nRet = SfxModalDialog::Execute(); - - if( RET_OK == nRet ) - { - ApplyItemSets(); - if( GetColorTable() ) - { - GetColorTable()->Save(); - - // notify current viewframe it it uses the same color table - if ( SfxViewFrame::Current() && SfxViewFrame::Current()->GetDispatcher() ) - { - const OfaPtrItem* pPtr = (const OfaPtrItem*)SfxViewFrame::Current()->GetDispatcher()->Execute( SID_GET_COLORTABLE, SFX_CALLMODE_SYNCHRON ); - if( pPtr ) - { - XColorTable* _pColorTab = (XColorTable*)pPtr->GetValue(); - - if( _pColorTab && - _pColorTab->GetPath() == GetColorTable()->GetPath() && - _pColorTab->GetName() == GetColorTable()->GetName() ) - SfxObjectShell::Current()->PutItem( SvxColorTableItem( GetColorTable(), SID_COLOR_TABLE ) ); - } - } - } - - utl::ConfigManager::GetConfigManager().StoreConfigItems(); - } - - return nRet; -} - -// class ExtensionsTabPage ----------------------------------------------- - -ExtensionsTabPage::ExtensionsTabPage( - Window* pParent, WinBits nStyle, const rtl::OUString& rPageURL, - const rtl::OUString& rEvtHdl, const Reference< awt::XContainerWindowProvider >& rProvider ) : - - TabPage( pParent, nStyle ), - - m_sPageURL ( rPageURL ), - m_sEventHdl ( rEvtHdl ), - m_xWinProvider ( rProvider ), - m_bIsWindowHidden ( false ) - -{ -} - -// ----------------------------------------------------------------------- - -ExtensionsTabPage::~ExtensionsTabPage() -{ - Hide(); - DeactivatePage(); -} - -// ----------------------------------------------------------------------- - -void ExtensionsTabPage::CreateDialogWithHandler() -{ - try - { - bool bWithHandler = ( m_sEventHdl.getLength() > 0 ); - if ( bWithHandler ) - { - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - m_xEventHdl = Reference< awt::XContainerWindowEventHandler >( - xFactory->createInstance( m_sEventHdl ), UNO_QUERY ); - } - - if ( !bWithHandler || m_xEventHdl.is() ) - { - SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); - Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY ); - m_xPage = Reference < awt::XWindow >( - m_xWinProvider->createContainerWindow( - m_sPageURL, rtl::OUString(), xParent, m_xEventHdl ), UNO_QUERY ); - - Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY ); - if ( xPageControl.is() ) - { - Reference< awt::XWindowPeer > xWinPeer( xPageControl->getPeer() ); - if ( xWinPeer.is() ) - { - Window* pWindow = VCLUnoHelper::GetWindow( xWinPeer ); - if ( pWindow ) - pWindow->SetStyle( pWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); - } - } - } - } - catch ( ::com::sun::star::lang::IllegalArgumentException& ) - { - DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): illegal argument" ); - } - catch ( Exception& ) - { - DBG_ERRORFILE( "ExtensionsTabPage::CreateDialogWithHandler(): exception of XDialogProvider2::createDialogWithHandler()" ); - } -} - -// ----------------------------------------------------------------------- - -sal_Bool ExtensionsTabPage::DispatchAction( const rtl::OUString& rAction ) -{ - sal_Bool bRet = sal_False; - if ( m_xEventHdl.is() ) - { - try - { - bRet = m_xEventHdl->callHandlerMethod( m_xPage, makeAny( rAction ), C2U("external_event") ); - } - catch ( Exception& ) - { - DBG_ERRORFILE( "ExtensionsTabPage::DispatchAction(): exception of XDialogEventHandler::callHandlerMethod()" ); - } - } - return bRet; -} - -// ----------------------------------------------------------------------- - -void ExtensionsTabPage::ActivatePage() -{ - TabPage::ActivatePage(); - - if ( !m_xPage.is() ) - { - CreateDialogWithHandler(); - - if ( m_xPage.is() ) - { - Point aPos = Point(); - Size aSize = GetSizePixel(); - m_xPage->setPosSize( aPos.X() + 1, aPos.Y() + 1, - aSize.Width() - 2, aSize.Height() - 2, awt::PosSize::POSSIZE ); - if ( m_sEventHdl.getLength() > 0 ) - DispatchAction( C2U("initialize") ); - } - } - - if ( m_xPage.is() ) - { - m_xPage->setVisible( sal_True ); - m_bIsWindowHidden = false; - } -} - -// ----------------------------------------------------------------------- - -void ExtensionsTabPage::DeactivatePage() -{ - TabPage::DeactivatePage(); - - if ( m_xPage.is() ) - m_xPage->setVisible( sal_False ); -} - -// ----------------------------------------------------------------------- - -void ExtensionsTabPage::ResetPage() -{ - DispatchAction( C2U("back") ); - ActivatePage(); -} - -// ----------------------------------------------------------------------- - -void ExtensionsTabPage::SavePage() -{ - DispatchAction( C2U("ok") ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/treeopt.hrc b/cui/source/options/treeopt.hrc deleted file mode 100644 index ea8da73a2..000000000 --- a/cui/source/options/treeopt.hrc +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#define PB_OK 1 -#define PB_CANCEL 2 -#define PB_HELP 3 -#define PB_BACK 4 -#define TLB_PAGES 5 -#define FT_HELPTEXT 6 -#define STR_HELPTEXTS 7 -#define IMG_LIST 8 -#define IMG_HELP 9 -#define FT_PAGE_TITLE 10 -#define FL_LINE_1 11 - -#define BMP_ROOT_CLOSED 17 -#define BMP_ROOT_OPENED 18 -#define FB_BORDER 19 - -#define IMG_HINT 20 -#define FT_HINT 21 -#define CB_DISABLE 22 -#define BTN_HINT 23 -#define ST_LOAD_ERROR 24 - -#define STR_GENERAL_PAGES_START 1 -#define STR_GENERAL (STR_GENERAL_PAGES_START) -#define STR_MISC_PAGE (STR_GENERAL_PAGES_START + 1) -#define STR_DESKTOP_PAGE (STR_GENERAL_PAGES_START + 2) -#define STR_VIEW_PAGE (STR_GENERAL_PAGES_START + 3) -#define STR_FONT_PAGE (STR_GENERAL_PAGES_START + 4) -#define STR_PRINT_PAGE (STR_GENERAL_PAGES_START + 5) -#define STR_COLOR_PAGE (STR_GENERAL_PAGES_START + 6) -#define STR_LING_PAGE (STR_GENERAL_PAGES_START + 7) -#define STR_PATH_PAGE (STR_GENERAL_PAGES_START + 8) -#define STR_SAVE_PAGE (STR_GENERAL_PAGES_START + 9) -#define STR_USERDATA_PAGE (STR_GENERAL_PAGES_START + 10) - -#define FB_IMAGE 43 - - -// metrics - -#define WIDTH_PAGEFRAME 263 -#define HEIGHT_PAGEFRAME 191 -#define WIDTH_IMG_HELP 25 -#define HEIGHT_IMG_HELP 30 - -#define COL_1 (RSC_SP_DLG_INNERBORDER_LEFT) -#define COL_2 (COL_1+0) -#define COL_3 (COL_2+RSC_SP_GRP_SPACE_X) -#define COL_11 (COL_3+WIDTH_PAGEFRAME) -#define COL_12 (COL_11+RSC_SP_DLG_INNERBORDER_RIGHT) -#define COL_10 (COL_11-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_9 (COL_10-RSC_SP_CTRL_GROUP_X) -#define COL_8 (COL_9-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_7 (COL_8-RSC_SP_CTRL_GROUP_X) -#define COL_6 (COL_7-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_5 (COL_6-RSC_SP_CTRL_GROUP_X) -#define COL_4 (COL_5-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_3_1 (COL_3+RSC_SP_TBPG_INNERBORDER_LEFT) -#define COL_3_3 (COL_3_1+WIDTH_IMG_HELP) -#define COL_3_5 (COL_11-RSC_SP_TBPG_INNERBORDER_RIGHT) - -#define ROW_1 (RSC_SP_DLG_INNERBORDER_TOP) -#define ROW_2 (ROW_1+HEIGHT_PAGEFRAME) -#define ROW_3 (ROW_2+RSC_SP_CTRL_GROUP_Y) -#define ROW_4 (ROW_3+RSC_CD_PUSHBUTTON_HEIGHT) -#define ROW_5 (ROW_4+RSC_SP_DLG_INNERBORDER_BOTTOM) -#define ROW_1_1 (ROW_1+2) -#define ROW_1_2 (ROW_1+12) -#define ROW_1_3 (ROW_1_1+HEIGHT_IMG_HELP+2) -#define ROW_1_4 (ROW_1_3+8) - diff --git a/cui/source/options/treeopt.src b/cui/source/options/treeopt.src deleted file mode 100644 index ff7d70fa1..000000000 --- a/cui/source/options/treeopt.src +++ /dev/null @@ -1,339 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "treeopt.hrc" -#include -#include "helpid.hrc" -#include - -#define IMAGE_STDBTN_COLOR Color { Red = 0xC000; Green = 0xC000; Blue = 0xC000; } - -ModalDialog RID_OFADLG_OPTIONS_TREE -{ - HelpID = HID_OFADLG_OPTIONS_TREE; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - - Size = MAP_APPFONT ( COL_12 , ROW_5 ) ; - Text [ en-US ] = "Options"; - - OKButton PB_OK - { - Pos = MAP_APPFONT ( COL_4, ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( COL_6, ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( COL_8, ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - PushButton PB_BACK - { - HelpID = "cui:PushButton:RID_OFADLG_OPTIONS_TREE:PB_BACK"; - Pos = MAP_APPFONT ( COL_10, ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Back" ; - }; - //TreeListBox - Control TLB_PAGES - { - Pos = MAP_APPFONT ( COL_1, ROW_1 ) ; - Size = MAP_APPFONT ( (COL_2-COL_1), (ROW_4-ROW_1) ); - TabStop = TRUE ; - Border = TRUE; - }; - Control FB_BORDER - { - Pos = MAP_APPFONT ( COL_3, ROW_1 ) ; - Size = MAP_APPFONT ( WIDTH_PAGEFRAME, HEIGHT_PAGEFRAME ) ; - Hide = TRUE; - }; - FixedImage IMG_HELP - { - Pos = MAP_APPFONT ( COL_3_1, ROW_1_1 ) ; - Size = MAP_APPFONT ( WIDTH_IMG_HELP, HEIGHT_IMG_HELP ) ; - Hide = TRUE; - }; - FixedText FT_PAGE_TITLE - { - Pos = MAP_APPFONT ( COL_3_3, ROW_1_2 ) ; - Size = MAP_APPFONT ( (COL_3_5-COL_3_3), 15 ) ; - Hide = TRUE; - }; - FixedLine FL_LINE_1 - { - Pos = MAP_APPFONT ( COL_3_1 , ROW_1_3 ) ; - Size = MAP_APPFONT ( (COL_3_5-COL_3_1), 1 ) ; - Comment = "Trennlinie" ; - Hide = TRUE; - }; - FixedText FT_HELPTEXT - { - Pos = MAP_APPFONT ( COL_3_3, ROW_1_4 ) ; - Size = MAP_APPFONT ( (COL_3_5-COL_3_3), (HEIGHT_PAGEFRAME-ROW_1_4-1) ) ; - WordBreak = TRUE; - Hide = TRUE; - }; - String ST_LOAD_ERROR - { - Text [ en-US ] = "The selected module could not be loaded."; - }; - StringArray STR_HELPTEXTS - { - ItemList [ en-US ] = - { - < "This dialog is used to define general settings when working with %PRODUCTNAME. Enter your personal data, the defaults to be used when saving documents, and paths to important files. These settings will be saved automatically and used in later sessions as well."; SID_GENERAL_OPTIONS; > ; - < "This is where you make settings concerning language and writing aids for your work with %PRODUCTNAME."; SID_LANGUAGE_OPTIONS; > ; - < "This is where you configure %PRODUCTNAME for the Internet. You can save your proxy settings." ; SID_INET_DLG; > ; - < "This is where you specify various settings for text documents. These settings determine how your text documents are handled in %PRODUCTNAME and are valid for all new %PRODUCTNAME Writer documents. You can also define a few settings for the active text document if you save it afterwards." ; SID_SW_EDITOPTIONS; > ; - < "This is where you define the basic settings for %PRODUCTNAME documents in HTML format. For example, you decide which contents should be displayed on the screen or printed, how the pages are scrolled on the screen, in which color keywords are highlighted in the source text and much more." ; SID_SW_ONLINEOPTIONS; > ; - < "This is where you define various global settings for spreadsheets. For example, you can define which contents should be displayed and in which direction the cursor will move after you enter data in a cell. You also define sort lists, the number of the decimal places displayed, etc." ; SID_SC_EDITOPTIONS; > ; - < "This is where you define the settings that apply to all newly saved presentations. Among other things, you decide which contents are displayed on the slides, which default unit of measure is used, if and how grid alignment is used, and if notes and handouts are always printed." ; SID_SD_EDITOPTIONS; > ; - < "This is where you define the settings for drawing documents. Among other things, you determine which contents are displayed on the pages, which scale is used, if and how grid alignment is used, and which contents are printed by default." ; SID_SD_GRAPHIC_OPTIONS; > ; - < "This is where you select the print format and print options for all newly saved formula documents. These options take effect when you want to print a formula directly from %PRODUCTNAME Math." ; SID_SM_EDITOPTIONS; > ; - < "This is where you specify general default settings for your %PRODUCTNAME Charts. Set the colors you want for all new charts." ; SID_SCH_EDITOPTIONS; > ; - < "This is where you define general settings for accessing external data sources."; SID_SB_STARBASEOPTIONS; > ; - < "This is where you define general settings for opening and saving documents in external formats. You can control the behavior of macros or OLE objects in Microsoft Office documents or define settings for HTML documents." ; SID_FILTER_DLG; > ; - }; - }; - Bitmap BMP_ROOT_CLOSED - { - File = "plus.bmp" ; - }; - Bitmap BMP_ROOT_OPENED - { - File = "minus.bmp" ; - }; -}; - -Resource RID_OFADLG_OPTIONS_TREE_PAGES -{ - StringArray SID_GENERAL_OPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME" ; 0; > ; - < "User Data" ; RID_SFXPAGE_GENERAL; > ; - < "General" ; OFA_TP_MISC; > ; - < "Memory" ; OFA_TP_MEMORY; > ; - < "View" ; OFA_TP_VIEW ; > ; - < "Print" ; RID_SFXPAGE_PRINTOPTIONS; > ; - < "Paths" ; RID_SFXPAGE_PATH; > ; - < "Colors" ; RID_SVXPAGE_COLOR; > ; - < "Fonts" ; RID_SVX_FONT_SUBSTITUTION ; > ; - < "Security" ; RID_SVXPAGE_INET_SECURITY ; > ; - < "Appearance" ; RID_SVXPAGE_COLORCONFIG ; > ; - < "Accessibility" ; RID_SVXPAGE_ACCESSIBILITYCONFIG ; > ; - < "Java" ; RID_SVXPAGE_OPTIONS_JAVA ; > ; - < "Network Identity" ; RID_SVXPAGE_SSO ; > ; - < "Online Update" ; RID_SVXPAGE_ONLINEUPDATE ; > ; - < "" ; RID_SVXPAGE_IMPROVEMENT ; > ; - }; - }; - StringArray SID_LANGUAGE_OPTIONS - { - ItemList [ en-US ] = - { - < "Language Settings" ; 0; > ; - < "Languages"; OFA_TP_LANGUAGES; > ; - < "Writing Aids" ; RID_SFXPAGE_LINGU; > ; - < "Searching in Japanese" ; RID_SVXPAGE_JSEARCH_OPTIONS; > ; - < "Asian Layout" ; RID_SVXPAGE_ASIAN_LAYOUT; > ; - < "Complex Text Layout" ; RID_SVXPAGE_OPTIONS_CTL; >; - }; - }; - StringArray SID_INET_DLG - { - //modified by jmeng begin - ItemList [ en-US ] = - { - < "Internet" ; 0; > ; - < "Proxy" ; RID_SVXPAGE_INET_PROXY; > ; - < "E-mail" ; RID_SVXPAGE_INET_MAIL; > ; - < "Browser Plug-in" ; RID_SVXPAGE_INET_MOZPLUGIN; > ; - }; - //modified by jmeng end - }; - StringArray SID_SW_EDITOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Writer" ; 0; > ; - < "General" ; RID_SW_TP_OPTLOAD_PAGE ; > ; - < "View" ; RID_SW_TP_CONTENT_OPT ;> ; - < "Formatting Aids" ; RID_SW_TP_OPTSHDWCRSR ; > ; - < "Grid" ; RID_SVXPAGE_GRID ; > ; - < "Basic Fonts (Western)" ;RID_SW_TP_STD_FONT ; > ; - < "Basic Fonts (Asian)" ;RID_SW_TP_STD_FONT_CJK ; > ; - < "Basic Fonts (CTL)" ; RID_SW_TP_STD_FONT_CTL ; > ; - < "Print" ; RID_SW_TP_OPTPRINT_PAGE ; > ; - < "Table" ; RID_SW_TP_OPTTABLE_PAGE ; > ; - < "Changes" ; RID_SW_TP_REDLINE_OPT ; > ; - < "Compatibility" ; RID_SW_TP_OPTCOMPATIBILITY_PAGE ; > ; - < "AutoCaption" ; RID_SW_TP_OPTCAPTION_PAGE ; > ; - < "Mail Merge E-mail" ; RID_SW_TP_MAILCONFIG ; >; - }; - }; - StringArray SID_SW_ONLINEOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Writer/Web" ; 0; > ; - < "View" ; RID_SW_TP_HTML_CONTENT_OPT ;> ; - < "Formatting Aids" ; RID_SW_TP_HTML_OPTSHDWCRSR ; > ; - < "Grid" ; RID_SW_TP_HTML_OPTGRID_PAGE ; > ; - < "Print" ; RID_SW_TP_HTML_OPTPRINT_PAGE ; > ; - < "Table" ; RID_SW_TP_HTML_OPTTABLE_PAGE ; > ; - < "Background" ; RID_SW_TP_BACKGROUND ; > ; - }; - }; - StringArray SID_SM_EDITOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Math" ; 0; > ; - < "Settings" ; SID_SM_TP_PRINTOPTIONS;> ; - }; - }; - StringArray SID_SC_EDITOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Calc" ; 0; > ; - < "General" ; SID_SC_TP_LAYOUT ;> ; - < "Defaults" ; RID_SC_TP_DEFAULTS ;> ; - < "View" ; SID_SC_TP_CONTENT ;> ; - < "International" ; RID_OFA_TP_INTERNATIONAL ;> ; - < "Calculate" ; SID_SC_TP_CALC ;> ; - < "Formula" ; SID_SC_TP_FORMULA ;> ; - < "Sort Lists" ; SID_SC_TP_USERLISTS ;> ; - < "Changes" ; SID_SC_TP_CHANGES ;> ; - < "Compatibility" ; SID_SC_TP_COMPATIBILITY ;> ; - < "Grid" ; SID_SC_TP_GRID ;> ; - < "Print" ; RID_SC_TP_PRINT ;> ; - }; - }; - StringArray SID_SD_EDITOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Impress" ; 0; > ; - < "General"; SID_SI_TP_MISC ; > ; - < "View" ; SID_SI_TP_CONTENTS ; > ; - < "Grid" ; SID_SI_TP_SNAP ; > ; - < "Print" ; SID_SI_TP_PRINT ; > ; - }; - }; - StringArray SID_SD_GRAPHIC_OPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Draw" ; 0; > ; - < "General" ; SID_SD_TP_MISC ; > ; - < "View" ; SID_SD_TP_CONTENTS ; > ; - < "Grid" ; SID_SD_TP_SNAP ; > ; - < "Print" ; SID_SD_TP_PRINT ; > ; - }; - }; - StringArray SID_SCH_EDITOPTIONS - { - ItemList [ en-US ] = - { - < "Charts" ; 0; > ; - < "Default Colors" ; RID_OPTPAGE_CHART_DEFCOLORS ; > ; - }; - }; - StringArray SID_FILTER_DLG - { - ItemList [ en-US ] = - { - < "Load/Save" ; 0; > ; - < "General" ; RID_SFXPAGE_SAVE; > ; - < "VBA Properties" ; SID_OPTFILTER_MSOFFICE; > ; - < "Microsoft Office" ; RID_OFAPAGE_MSFILTEROPT2; > ; - < "HTML Compatibility" ; RID_OFAPAGE_HTMLOPT ; > ; - }; - }; - StringArray SID_SB_STARBASEOPTIONS - { - ItemList [ en-US ] = - { - < "%PRODUCTNAME Base" ; 0; > ; - < "Connections" ; SID_SB_CONNECTIONPOOLING; > ; - < "Databases" ; SID_SB_DBREGISTEROPTIONS; > ; - }; - }; -}; -String RID_RIDER_SLL_SITE -{ - Text [ en-US ] = "Site certificates" ; -}; -String RID_RIDER_SLL_PERSONAL -{ - Text [ en-US ] = "Personal certificates" ; -}; - -#define MASK_COL MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } ; -#define IMGLST_IDLST \ - IdList = { \ - SID_GENERAL_OPTIONS; \ - SID_LANGUAGE_OPTIONS; \ - SID_INET_DLG; \ - SID_SW_EDITOPTIONS; \ - SID_SW_ONLINEOPTIONS; \ - SID_SC_EDITOPTIONS; \ - SID_SD_EDITOPTIONS; \ - SID_SD_GRAPHIC_OPTIONS; \ - SID_SM_EDITOPTIONS; \ - SID_SCH_EDITOPTIONS; \ - SID_SB_STARBASEOPTIONS; \ - SID_FILTER_DLG; \ - }; \ - IdCount = { \ - 12; \ - }; - -ImageList RID_IMGLIST_TREEOPT -{ - Prefix = "tr"; - MASK_COL - IMGLST_IDLST -}; - - - diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx deleted file mode 100644 index 3a5a90c8e..000000000 --- a/cui/source/options/webconninfo.cxx +++ /dev/null @@ -1,372 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include "com/sun/star/task/XUrlContainer.hpp" -#include -#include -#include "webconninfo.hxx" -#include "webconninfo.hrc" - -using namespace ::com::sun::star; - -//........................................................................ -namespace svx -{ -//........................................................................ - -// class PasswordTable --------------------------------------------------- - -PasswordTable::PasswordTable(SvxSimpleTableContainer& rParent, WinBits nBits) - : SvxSimpleTable(rParent, nBits | WB_NOINITIALSELECTION) -{ -} - -void PasswordTable::InsertHeaderItem( sal_uInt16 nColumn, const String& rText, HeaderBarItemBits nBits ) -{ - GetTheHeaderBar()->InsertItem( nColumn, rText, 0, nBits ); -} - -void PasswordTable::ResetTabs() -{ - SetTabs(); -} - -void PasswordTable::Resort( bool bForced ) -{ - sal_uInt16 nColumn = GetSelectedCol(); - if ( 0 == nColumn || bForced ) // only the first column is sorted - { - HeaderBarItemBits nBits = GetTheHeaderBar()->GetItemBits(1); - sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW ); - SvSortMode eMode = SortAscending; - - if ( bUp ) - { - nBits &= ~HIB_UPARROW; - nBits |= HIB_DOWNARROW; - eMode = SortDescending; - } - else - { - nBits &= ~HIB_DOWNARROW; - nBits |= HIB_UPARROW; - } - GetTheHeaderBar()->SetItemBits( 1, nBits ); - SvTreeList* pListModel = GetModel(); - pListModel->SetSortMode( eMode ); - pListModel->Resort(); - } -} - -// class WebConnectionInfoDialog ----------------------------------------- - -// ----------------------------------------------------------------------- -WebConnectionInfoDialog::WebConnectionInfoDialog( Window* pParent ) : - ModalDialog( pParent, CUI_RES( RID_SVXDLG_WEBCONNECTION_INFO ) ) - ,m_aNeverShownFI ( this, CUI_RES( FI_NEVERSHOWN ) ) - ,m_aPasswordsLBContainer(this, CUI_RES( LB_PASSWORDS)) - ,m_aPasswordsLB(m_aPasswordsLBContainer) - ,m_aRemoveBtn ( this, CUI_RES( PB_REMOVE ) ) - ,m_aRemoveAllBtn ( this, CUI_RES( PB_REMOVEALL ) ) - ,m_aChangeBtn ( this, CUI_RES( PB_CHANGE ) ) - ,m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) ) - ,m_aCloseBtn ( this, CUI_RES( PB_CLOSE ) ) - ,m_aHelpBtn ( this, CUI_RES( PB_HELP ) ) - ,m_nPos ( -1 ) -{ - static long aStaticTabs[]= { 3, 0, 150, 250 }; - m_aPasswordsLB.SetTabs( aStaticTabs ); - m_aPasswordsLB.InsertHeaderItem( 1, CUI_RESSTR( STR_WEBSITE ), - HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS | HIB_CLICKABLE | HIB_UPARROW ); - m_aPasswordsLB.InsertHeaderItem( 2, CUI_RESSTR( STR_USERNAME ), - HIB_LEFT | HIB_VCENTER | HIB_FIXEDPOS ); - m_aPasswordsLB.ResetTabs(); - - FreeResource(); - - m_aPasswordsLB.SetHeaderBarClickHdl( LINK( this, WebConnectionInfoDialog, HeaderBarClickedHdl ) ); - m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) ); - m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) ); - m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) ); - - // one button too small for its text? - sal_Int32 i = 0; - long nBtnTextWidth = 0; - Window* pButtons[] = { &m_aRemoveBtn, &m_aRemoveAllBtn, &m_aChangeBtn }; - Window** pButton = pButtons; - const sal_Int32 nBCount = SAL_N_ELEMENTS( pButtons ); - for ( ; i < nBCount; ++i, ++pButton ) - { - long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() ); - if ( nTemp > nBtnTextWidth ) - nBtnTextWidth = nTemp; - } - nBtnTextWidth = nBtnTextWidth * 115 / 100; // a little offset - long nButtonWidth = m_aRemoveBtn.GetSizePixel().Width(); - if ( nBtnTextWidth > nButtonWidth ) - { - // so make the buttons broader and its control in front of it smaller - long nDelta = nBtnTextWidth - nButtonWidth; - pButton = pButtons; - for ( i = 0; i < nBCount; ++i, ++pButton ) - { - Point aNewPos = (*pButton)->GetPosPixel(); - if ( &m_aRemoveAllBtn == (*pButton) ) - aNewPos.X() += nDelta; - else if ( &m_aChangeBtn == (*pButton) ) - aNewPos.X() -= nDelta; - Size aNewSize = (*pButton)->GetSizePixel(); - aNewSize.Width() += nDelta; - (*pButton)->SetPosSizePixel( aNewPos, aNewSize ); - } - } - - FillPasswordList(); - - m_aRemoveBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemovePasswordHdl ) ); - m_aRemoveAllBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, RemoveAllPasswordsHdl ) ); - m_aChangeBtn.SetClickHdl( LINK( this, WebConnectionInfoDialog, ChangePasswordHdl ) ); - m_aPasswordsLB.SetSelectHdl( LINK( this, WebConnectionInfoDialog, EntrySelectedHdl ) ); - - m_aRemoveBtn.Enable( sal_False ); - m_aChangeBtn.Enable( sal_False ); - - HeaderBarClickedHdl( NULL ); -} - -// ----------------------------------------------------------------------- -WebConnectionInfoDialog::~WebConnectionInfoDialog() -{ -} - -// ----------------------------------------------------------------------- -IMPL_LINK( WebConnectionInfoDialog, HeaderBarClickedHdl, SvxSimpleTable*, pTable ) -{ - m_aPasswordsLB.Resort( NULL == pTable ); - return 0; -} - -// ----------------------------------------------------------------------- -void WebConnectionInfoDialog::FillPasswordList() -{ - try - { - uno::Reference< task::XMasterPasswordHandling > xMasterPasswd( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY ); - - if ( xMasterPasswd.is() && xMasterPasswd->isPersistentStoringAllowed() ) - { - uno::Reference< task::XPasswordContainer > xPasswdContainer( xMasterPasswd, uno::UNO_QUERY_THROW ); - uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); - - uno::Sequence< task::UrlRecord > aURLEntries = xPasswdContainer->getAllPersistent( xInteractionHandler ); - sal_Int32 nCount = 0; - for ( sal_Int32 nURLInd = 0; nURLInd < aURLEntries.getLength(); nURLInd++ ) - { - for ( sal_Int32 nUserInd = 0; nUserInd < aURLEntries[nURLInd].UserList.getLength(); nUserInd++ ) - { - ::rtl::OUString aUIEntry( aURLEntries[nURLInd].Url ); - aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' ); - aUIEntry += aURLEntries[nURLInd].UserList[nUserInd].UserName; - SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); - pEntry->SetUserData( (void*)(sal_IntPtr)(nCount++) ); - } - } - - // remember pos of first url container entry. - m_nPos = nCount; - - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); - - uno::Sequence< rtl::OUString > aUrls - = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); - - for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) - { - ::rtl::OUString aUIEntry( aUrls[ nURLIdx ] ); - aUIEntry += ::rtl::OUString::valueOf( (sal_Unicode)'\t' ); - aUIEntry += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*" ) ); - SvLBoxEntry* pEntry = m_aPasswordsLB.InsertEntry( aUIEntry ); - pEntry->SetUserData( (void*)(sal_IntPtr)(nCount++) ); - } - } - } - catch( uno::Exception& ) - {} -} - -// ----------------------------------------------------------------------- -IMPL_LINK( WebConnectionInfoDialog, RemovePasswordHdl, PushButton*, EMPTYARG ) -{ - try - { - SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); - if ( pEntry ) - { - ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); - ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - - uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY_THROW ); - - sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); - if ( nPos < m_nPos ) - { - xPasswdContainer->removePersistent( aURL, aUserName ); - } - else - { - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); - xUrlContainer->removeUrl( aURL ); - } - m_aPasswordsLB.RemoveEntry( pEntry ); - } - } - catch( uno::Exception& ) - {} - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( WebConnectionInfoDialog, RemoveAllPasswordsHdl, PushButton*, EMPTYARG ) -{ - try - { - uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY_THROW ); - - // should the master password be requested before? - xPasswdContainer->removeAllPersistent(); - - uno::Reference< task::XUrlContainer > xUrlContainer( - xPasswdContainer, uno::UNO_QUERY_THROW ); - uno::Sequence< rtl::OUString > aUrls - = xUrlContainer->getUrls( sal_True /* OnlyPersistent */ ); - for ( sal_Int32 nURLIdx = 0; nURLIdx < aUrls.getLength(); nURLIdx++ ) - xUrlContainer->removeUrl( aUrls[ nURLIdx ] ); - - m_aPasswordsLB.Clear(); - } - catch( uno::Exception& ) - {} - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( WebConnectionInfoDialog, ChangePasswordHdl, PushButton*, EMPTYARG ) -{ - try - { - SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); - if ( pEntry ) - { - ::rtl::OUString aURL = m_aPasswordsLB.GetEntryText( pEntry, 0 ); - ::rtl::OUString aUserName = m_aPasswordsLB.GetEntryText( pEntry, 1 ); - - ::comphelper::SimplePasswordRequest* pPasswordRequest - = new ::comphelper::SimplePasswordRequest( task::PasswordRequestMode_PASSWORD_CREATE ); - uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); - - uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); - xInteractionHandler->handle( rRequest ); - - if ( pPasswordRequest->isPassword() ) - { - String aNewPass = pPasswordRequest->getPassword(); - uno::Sequence< ::rtl::OUString > aPasswd( 1 ); - aPasswd[0] = aNewPass; - - uno::Reference< task::XPasswordContainer > xPasswdContainer( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer" ) ) ), - uno::UNO_QUERY_THROW ); - xPasswdContainer->addPersistent( - aURL, aUserName, aPasswd, xInteractionHandler ); - } - } - } - catch( uno::Exception& ) - {} - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( WebConnectionInfoDialog, EntrySelectedHdl, void*, EMPTYARG ) -{ - SvLBoxEntry* pEntry = m_aPasswordsLB.GetCurEntry(); - if ( !pEntry ) - { - m_aRemoveBtn.Enable( sal_False ); - m_aChangeBtn.Enable( sal_False ); - } - else - { - m_aRemoveBtn.Enable( sal_True ); - - // url container entries (-> use system credentials) have - // no password - sal_Int32 nPos = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); - m_aChangeBtn.Enable( nPos < m_nPos ); - } - - return 0; -} - -//........................................................................ -} // namespace svx -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/webconninfo.hrc b/cui/source/options/webconninfo.hrc deleted file mode 100644 index 1b1bcf53d..000000000 --- a/cui/source/options/webconninfo.hrc +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_WEBCONNINFO_HRC -#define _SVX_WEBCONNINFO_HRC - -#define FI_NEVERSHOWN 10 -#define LB_PASSWORDS 11 -#define PB_REMOVE 12 -#define PB_REMOVEALL 13 -#define PB_CHANGE 14 -#define FL_BUTTONS 15 -// #define PB_OK 16 -#define PB_CLOSE 17 -#define PB_HELP 18 - -#define STR_WEBSITE 10 -#define STR_USERNAME 11 - -#define DLG_WIDTH 260 -#define DLG_HEIGHT 150 - -#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT) -#define COL_1 (COL_0+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_GROUP_X) -#define COL_2 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_LEFT) -#define COL_C (COL_2-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH) -#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH) - -#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP) -#define ROW_1 (ROW_0+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y) -#define ROW_5 (DLG_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM-RSC_CD_PUSHBUTTON_HEIGHT) -#define ROW_4 (ROW_5-RSC_SP_FLGR_SPACE_Y-RSC_CD_FIXEDLINE_HEIGHT) -#define ROW_3 (ROW_4-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT) -#define ROW_2 (ROW_3-RSC_SP_GRP_SPACE_Y) - -#endif // #ifndef _SVX_WEBCONNINFO_HRC - diff --git a/cui/source/options/webconninfo.hxx b/cui/source/options/webconninfo.hxx deleted file mode 100644 index bd8e04aee..000000000 --- a/cui/source/options/webconninfo.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_WEBCONNINFO_HXX -#define _SVX_WEBCONNINFO_HXX - -#include -#include -#include -#include -#include - -//........................................................................ -namespace svx -{ -//........................................................................ - - class PasswordTable : public SvxSimpleTable - { - public: - PasswordTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); - - void InsertHeaderItem( sal_uInt16 nColumn, const String& rText, HeaderBarItemBits nBits ); - void ResetTabs(); - void Resort( bool bForced ); - }; - - //==================================================================== - //= class WebConnectionIfoDialog - //==================================================================== - class WebConnectionInfoDialog : public ModalDialog - { - private: - FixedInfo m_aNeverShownFI; - SvxSimpleTableContainer m_aPasswordsLBContainer; - PasswordTable m_aPasswordsLB; - PushButton m_aRemoveBtn; - PushButton m_aRemoveAllBtn; - PushButton m_aChangeBtn; - FixedLine m_aButtonsFL; - CancelButton m_aCloseBtn; - HelpButton m_aHelpBtn; - sal_Int32 m_nPos; - - DECL_LINK( HeaderBarClickedHdl, SvxSimpleTable* ); - DECL_LINK( RemovePasswordHdl, PushButton* ); - DECL_LINK( RemoveAllPasswordsHdl, PushButton* ); - DECL_LINK( ChangePasswordHdl, PushButton* ); - DECL_LINK( EntrySelectedHdl, void* ); - - void FillPasswordList(); - - public: - WebConnectionInfoDialog( Window* pParent ); - ~WebConnectionInfoDialog(); - }; - -//........................................................................ -} // namespace svx -//........................................................................ - -#endif // #ifndef _SVX_WEBCONNINFO_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/options/webconninfo.src b/cui/source/options/webconninfo.src deleted file mode 100644 index 45ab62167..000000000 --- a/cui/source/options/webconninfo.src +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include -------------------------------------------------------------- - -#include -#include "webconninfo.hrc" -#include -#include "helpid.hrc" - -ModalDialog RID_SVXDLG_WEBCONNECTION_INFO -{ - HelpID = HID_DLG_WEBCONNECTION_INFO ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGHT ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "Stored Web Connection Information" ; - FixedText FI_NEVERSHOWN - { - Pos = MAP_APPFONT( COL_0, ROW_0 ); - Size = MAP_APPFONT( COL_2-COL_0, RSC_CD_FIXEDTEXT_HEIGHT ); - Text [ en-US ] = "Web login information (passwords are never shown)"; - }; - Control LB_PASSWORDS - { - Pos = MAP_APPFONT ( COL_0 , ROW_1 ) ; - Size = MAP_APPFONT ( COL_2-COL_0 , ROW_2-ROW_1 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_REMOVE - { - HelpID = "cui:PushButton:RID_SVXDLG_WEBCONNECTION_INFO:PB_REMOVE"; - Pos = MAP_APPFONT ( COL_0 , ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Remove"; - }; - PushButton PB_REMOVEALL - { - HelpID = "cui:PushButton:RID_SVXDLG_WEBCONNECTION_INFO:PB_REMOVEALL"; - Pos = MAP_APPFONT ( COL_1 , ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Remove All"; - }; - PushButton PB_CHANGE - { - HelpID = "cui:PushButton:RID_SVXDLG_WEBCONNECTION_INFO:PB_CHANGE"; - Pos = MAP_APPFONT ( COL_C , ROW_3 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Text [ en-US ] = "Change Password..."; - }; - FixedLine FL_BUTTONS - { - Pos = MAP_APPFONT( 0, ROW_4 ); - Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - }; - CancelButton PB_CLOSE - { - Pos = MAP_APPFONT ( COL_B , ROW_5 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - DefButton = TRUE ; - Text [ en-US ] = "Close"; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( COL_C , ROW_5 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - TabStop = TRUE ; - }; - String STR_WEBSITE - { - Text [ en-US ] = "Website"; - }; - String STR_USERNAME - { - Text [ en-US ] = "User name"; - }; -}; - diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx deleted file mode 100644 index f90f57d1c..000000000 --- a/cui/source/tabpages/align.cxx +++ /dev/null @@ -1,401 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include "align.hxx" - -#include -#include -#include -#include "align.hrc" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace svx { - -// item connections =========================================================== - -// horizontal alignment ------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper; -typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection; - -static const HorJustConnection::MapEntryType s_pHorJustMap[] = -{ - { ALIGNDLG_HORALIGN_STD, SVX_HOR_JUSTIFY_STANDARD }, - { ALIGNDLG_HORALIGN_LEFT, SVX_HOR_JUSTIFY_LEFT }, - { ALIGNDLG_HORALIGN_CENTER, SVX_HOR_JUSTIFY_CENTER }, - { ALIGNDLG_HORALIGN_RIGHT, SVX_HOR_JUSTIFY_RIGHT }, - { ALIGNDLG_HORALIGN_BLOCK, SVX_HOR_JUSTIFY_BLOCK }, - { ALIGNDLG_HORALIGN_FILL, SVX_HOR_JUSTIFY_REPEAT }, - { ALIGNDLG_HORALIGN_DISTRIBUTED, SVX_HOR_JUSTIFY_BLOCK }, - { LISTBOX_ENTRY_NOTFOUND, SVX_HOR_JUSTIFY_STANDARD } -}; - -// vertical alignment --------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper; -typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection; - -static const VerJustConnection::MapEntryType s_pVerJustMap[] = -{ - { ALIGNDLG_VERALIGN_STD, SVX_VER_JUSTIFY_STANDARD }, - { ALIGNDLG_VERALIGN_TOP, SVX_VER_JUSTIFY_TOP }, - { ALIGNDLG_VERALIGN_MID, SVX_VER_JUSTIFY_CENTER }, - { ALIGNDLG_VERALIGN_BOTTOM, SVX_VER_JUSTIFY_BOTTOM }, - { ALIGNDLG_VERALIGN_BLOCK, SVX_VER_JUSTIFY_BLOCK }, - { ALIGNDLG_VERALIGN_DISTRIBUTED, SVX_VER_JUSTIFY_BLOCK }, - { LISTBOX_ENTRY_NOTFOUND, SVX_VER_JUSTIFY_STANDARD } -}; - -// cell rotate mode ----------------------------------------------------------- - -typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper; -typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection; - -static const RotateModeConnection::MapEntryType s_pRotateModeMap[] = -{ - { IID_BOTTOMLOCK, SVX_ROTATE_MODE_BOTTOM }, - { IID_TOPLOCK, SVX_ROTATE_MODE_TOP }, - { IID_CELLLOCK, SVX_ROTATE_MODE_STANDARD }, - { VALUESET_ITEM_NOTFOUND, SVX_ROTATE_MODE_STANDARD } -}; - -// ============================================================================ - -static sal_uInt16 s_pRanges[] = -{ - SID_ATTR_ALIGN_HOR_JUSTIFY,SID_ATTR_ALIGN_VER_JUSTIFY, - SID_ATTR_ALIGN_STACKED,SID_ATTR_ALIGN_LINEBREAK, - SID_ATTR_ALIGN_INDENT,SID_ATTR_ALIGN_INDENT, - SID_ATTR_ALIGN_DEGREES,SID_ATTR_ALIGN_DEGREES, - SID_ATTR_ALIGN_LOCKPOS,SID_ATTR_ALIGN_LOCKPOS, - SID_ATTR_ALIGN_HYPHENATION,SID_ATTR_ALIGN_HYPHENATION, - SID_ATTR_ALIGN_ASIANVERTICAL,SID_ATTR_ALIGN_ASIANVERTICAL, - SID_ATTR_FRAMEDIRECTION,SID_ATTR_FRAMEDIRECTION, - SID_ATTR_ALIGN_SHRINKTOFIT,SID_ATTR_ALIGN_SHRINKTOFIT, - 0 -}; - -// ============================================================================ - -namespace { - -template -void lcl_MaybeResetAlignToDistro( - ListBox& rLB, sal_uInt16 nListPos, const SfxItemSet& rCoreAttrs, sal_uInt16 nWhichAlign, sal_uInt16 nWhichJM, _JustEnumType eBlock) -{ - const SfxPoolItem* pItem; - if (rCoreAttrs.GetItemState(nWhichAlign, sal_True, &pItem) != SFX_ITEM_SET) - // alignment not set. - return; - - const SfxEnumItem* p = static_cast(pItem); - _JustContainerType eVal = static_cast<_JustContainerType>(p->GetEnumValue()); - if (eVal != eBlock) - // alignment is not 'justify'. No need to go further. - return; - - if (rCoreAttrs.GetItemState(nWhichJM, sal_True, &pItem) != SFX_ITEM_SET) - // justification method is not set. - return; - - p = static_cast(pItem); - SvxCellJustifyMethod eMethod = static_cast(p->GetEnumValue()); - if (eMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE) - // Select the 'distribute' entry in the specified list box. - rLB.SelectEntryPos(nListPos); -} - -void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const ListBox& rLB, sal_uInt16 nListPos) -{ - SvxCellJustifyMethod eJM = SVX_JUSTIFY_METHOD_AUTO; - if (rLB.GetSelectEntryPos() == nListPos) - eJM = SVX_JUSTIFY_METHOD_DISTRIBUTE; - - SvxJustifyMethodItem aItem(eJM, nWhichJM); - rSet.Put(aItem); -} - -} - -// ============================================================================ - -AlignmentTabPage::AlignmentTabPage( Window* pParent, const SfxItemSet& rCoreAttrs ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_ALIGNMENT ), rCoreAttrs ), - - maFlAlignment ( this, CUI_RES( FL_ALIGNMENT ) ), - maFtHorAlign ( this, CUI_RES( FT_HORALIGN ) ), - maLbHorAlign ( this, CUI_RES( LB_HORALIGN ) ), - maFtIndent ( this, CUI_RES( FT_INDENT ) ), - maEdIndent ( this, CUI_RES( ED_INDENT ) ), - maFtVerAlign ( this, CUI_RES( FT_VERALIGN ) ), - maLbVerAlign ( this, CUI_RES( LB_VERALIGN ) ), - - maFlOrient ( this, CUI_RES( FL_ORIENTATION ) ), - maCtrlDial ( this, CUI_RES( CTR_DIAL ) ), - maFtRotate ( this, CUI_RES( FT_DEGREES ) ), - maNfRotate ( this, CUI_RES( NF_DEGREES ) ), - maFtRefEdge ( this, CUI_RES( FT_BORDER_LOCK ) ), - maVsRefEdge ( this, CUI_RES( CTR_BORDER_LOCK ) ), - maCbStacked ( this, CUI_RES( BTN_TXTSTACKED ) ), - maCbAsianMode ( this, CUI_RES( BTN_ASIAN_VERTICAL ) ), - maOrientHlp ( maCtrlDial, maNfRotate, maCbStacked ), - - maFlProperties ( this, CUI_RES( FL_WRAP ) ), - maBtnWrap ( this, CUI_RES( BTN_WRAP ) ), - maBtnHyphen ( this, CUI_RES( BTN_HYPH ) ), - maBtnShrink ( this, CUI_RES( BTN_SHRINK ) ), - maFtFrameDir ( this, CUI_RES( FT_TEXTFLOW ) ), - maLbFrameDir ( this, CUI_RES( LB_FRAMEDIR ) ) -{ - InitVsRefEgde(); - - // windows to be disabled, if stacked text is turned ON - maOrientHlp.AddDependentWindow( maFtRotate, STATE_CHECK ); - maOrientHlp.AddDependentWindow( maFtRefEdge, STATE_CHECK ); - maOrientHlp.AddDependentWindow( maVsRefEdge, STATE_CHECK ); - // windows to be disabled, if stacked text is turned OFF - maOrientHlp.AddDependentWindow( maCbAsianMode, STATE_NOCHECK ); - - Link aLink = LINK( this, AlignmentTabPage, UpdateEnableHdl ); - - maLbHorAlign.SetSelectHdl( aLink ); - maBtnWrap.SetClickHdl( aLink ); - - // Asian vertical mode - maCbAsianMode.Show( SvtCJKOptions().IsVerticalTextEnabled() ); - - // CTL frame direction - maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); - maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); - maLbFrameDir.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); - if( !SvtLanguageOptions().IsCTLFontEnabled() ) - { - maFtFrameDir.Hide(); - maLbFrameDir.Hide(); - } - - // This page needs ExchangeSupport. - SetExchangeSupport(); - - FreeResource(); - - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maFtHorAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new HorJustConnection( SID_ATTR_ALIGN_HOR_JUSTIFY, maLbHorAlign, s_pHorJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_INDENT, maFtIndent, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::UInt16MetricConnection( SID_ATTR_ALIGN_INDENT, maEdIndent, FUNIT_TWIP, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maFtVerAlign, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new VerJustConnection( SID_ATTR_ALIGN_VER_JUSTIFY, maLbVerAlign, s_pVerJustMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new DialControlConnection( SID_ATTR_ALIGN_DEGREES, maCtrlDial, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_DEGREES, maFtRotate, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_LOCKPOS, maFtRefEdge, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new RotateModeConnection( SID_ATTR_ALIGN_LOCKPOS, maVsRefEdge, s_pRotateModeMap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new OrientStackedConnection( SID_ATTR_ALIGN_STACKED, maOrientHlp ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_ALIGN_STACKED, maCbStacked, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_ASIANVERTICAL, maCbAsianMode, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_LINEBREAK, maBtnWrap, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_HYPHENATION, maBtnHyphen, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_ALIGN_SHRINKTOFIT, maBtnShrink, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new sfx::DummyItemConnection( SID_ATTR_FRAMEDIRECTION, maFtFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - AddItemConnection( new FrameDirListBoxConnection( SID_ATTR_FRAMEDIRECTION, maLbFrameDir, sfx::ITEMCONN_HIDE_UNKNOWN ) ); - - maLbHorAlign.SetAccessibleRelationMemberOf( &maFlAlignment ); - maEdIndent.SetAccessibleRelationMemberOf( &maFlAlignment ); - maLbVerAlign.SetAccessibleRelationMemberOf( &maFlAlignment ); -} - -AlignmentTabPage::~AlignmentTabPage() -{ -} - -SfxTabPage* AlignmentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new AlignmentTabPage( pParent, rAttrSet ); -} - -sal_uInt16* AlignmentTabPage::GetRanges() -{ - return s_pRanges; -} - -sal_Bool AlignmentTabPage::FillItemSet( SfxItemSet& rSet ) -{ - bool bChanged = SfxTabPage::FillItemSet(rSet); - - // Special treatment for distributed alignment; we need to set the justify - // method to 'distribute' to distinguish from the normal justification. - - sal_uInt16 nWhichHorJM = GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(rSet, nWhichHorJM, maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED); - if (!bChanged) - bChanged = HasAlignmentChanged(rSet, nWhichHorJM); - - sal_uInt16 nWhichVerJM = GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD); - lcl_SetJustifyMethodToItemSet(rSet, nWhichVerJM, maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED); - if (!bChanged) - bChanged = HasAlignmentChanged(rSet, nWhichVerJM); - - return bChanged; -} - -void AlignmentTabPage::Reset( const SfxItemSet& rCoreAttrs ) -{ - SfxTabPage::Reset( rCoreAttrs ); - - // Special treatment for distributed alignment; we need to set the justify - // method to 'distribute' to distinguish from the normal justification. - - lcl_MaybeResetAlignToDistro( - maLbHorAlign, ALIGNDLG_HORALIGN_DISTRIBUTED, rCoreAttrs, - GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY), GetWhich(SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD), - SVX_HOR_JUSTIFY_BLOCK); - - lcl_MaybeResetAlignToDistro( - maLbVerAlign, ALIGNDLG_VERALIGN_DISTRIBUTED, rCoreAttrs, - GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY), GetWhich(SID_ATTR_ALIGN_VER_JUSTIFY_METHOD), - SVX_VER_JUSTIFY_BLOCK); - - UpdateEnableControls(); -} - -int AlignmentTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -void AlignmentTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxTabPage::DataChanged( rDCEvt ); - if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - svt::OLocalResourceAccess aLocalResAcc( CUI_RES( RID_SVXPAGE_ALIGNMENT ), RSC_TABPAGE ); - InitVsRefEgde(); - } -} - -void AlignmentTabPage::InitVsRefEgde() -{ - // remember selection - is deleted in call to ValueSet::Clear() - sal_uInt16 nSel = maVsRefEdge.GetSelectItemId(); - - ResId aResId( IL_LOCK_BMPS, CUI_MGR() ); - ImageList aImageList( aResId ); - Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); - - maVsRefEdge.Clear(); - maVsRefEdge.SetStyle( maVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - - maVsRefEdge.SetColCount( 3 ); - maVsRefEdge.InsertItem( IID_BOTTOMLOCK, aImageList.GetImage( IID_BOTTOMLOCK ), String( CUI_RES( STR_BOTTOMLOCK ) ) ); - maVsRefEdge.InsertItem( IID_TOPLOCK, aImageList.GetImage( IID_TOPLOCK ), String( CUI_RES( STR_TOPLOCK ) ) ); - maVsRefEdge.InsertItem( IID_CELLLOCK, aImageList.GetImage( IID_CELLLOCK ), String( CUI_RES( STR_CELLLOCK ) ) ); - - maVsRefEdge.SetSizePixel( maVsRefEdge.CalcWindowSizePixel( aItemSize ) ); - - maVsRefEdge.SelectItem( nSel ); -} - -void AlignmentTabPage::UpdateEnableControls() -{ - sal_uInt16 nHorAlign = maLbHorAlign.GetSelectEntryPos(); - bool bHorLeft = (nHorAlign == ALIGNDLG_HORALIGN_LEFT); - bool bHorBlock = (nHorAlign == ALIGNDLG_HORALIGN_BLOCK); - bool bHorFill = (nHorAlign == ALIGNDLG_HORALIGN_FILL); - bool bHorDist = (nHorAlign == ALIGNDLG_HORALIGN_DISTRIBUTED); - - // indent edit field only for left alignment - maFtIndent.Enable( bHorLeft ); - maEdIndent.Enable( bHorLeft ); - - // rotation/stacked disabled for fill alignment - maOrientHlp.Enable( !bHorFill ); - - // hyphenation only for automatic line breaks or for block alignment - maBtnHyphen.Enable( maBtnWrap.IsChecked() || bHorBlock ); - - // shrink only without automatic line break, and not for block, fill or distribute. - maBtnShrink.Enable( (maBtnWrap.GetState() == STATE_NOCHECK) && !bHorBlock && !bHorFill && !bHorDist ); - - // visibility of fixed lines - maFlAlignment.Show( maLbHorAlign.IsVisible() || maEdIndent.IsVisible() || maLbVerAlign.IsVisible() ); - maFlOrient.Show( maCtrlDial.IsVisible() || maVsRefEdge.IsVisible() || maCbStacked.IsVisible() || maCbAsianMode.IsVisible() ); - maFlProperties.Show( maBtnWrap.IsVisible() || maBtnHyphen.IsVisible() || maBtnShrink.IsVisible() || maLbFrameDir.IsVisible() ); -} - -bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 nWhich ) const -{ - const SfxItemSet& rOld = GetItemSet(); - const SfxPoolItem* pItem; - SvxCellJustifyMethod eMethodOld = SVX_JUSTIFY_METHOD_AUTO; - SvxCellJustifyMethod eMethodNew = SVX_JUSTIFY_METHOD_AUTO; - if (rOld.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET) - { - const SfxEnumItem* p = static_cast(pItem); - eMethodOld = static_cast(p->GetEnumValue()); - } - - if (rNew.GetItemState(nWhich, sal_True, &pItem) == SFX_ITEM_SET) - { - const SfxEnumItem* p = static_cast(pItem); - eMethodNew = static_cast(p->GetEnumValue()); - } - - return eMethodOld != eMethodNew; -} - -IMPL_LINK( AlignmentTabPage, UpdateEnableHdl, void*, EMPTYARG ) -{ - UpdateEnableControls(); - return 0; -} - -// ============================================================================ - -} // namespace svx - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/align.hrc b/cui/source/tabpages/align.hrc deleted file mode 100644 index baae1be9d..000000000 --- a/cui/source/tabpages/align.hrc +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_ALIGN_HRC -#define _SVX_ALIGN_HRC - -// defines ------------------------------------------------------------------ - -// resource id's -#define FL_ALIGNMENT 10 -#define FT_HORALIGN 11 -#define LB_HORALIGN 12 -#define FT_INDENT 13 -#define ED_INDENT 14 -#define FT_VERALIGN 15 -#define LB_VERALIGN 16 - -#define FL_ORIENTATION 20 -#define BTN_TXTSTACKED 21 -#define CTR_DIAL 22 -#define FT_DEGREES 23 -#define NF_DEGREES 24 -#define FT_BORDER_LOCK 25 -#define CTR_BORDER_LOCK 26 -#define BTN_ASIAN_VERTICAL 27 - -#define FL_WRAP 40 -#define BTN_WRAP 41 -#define BTN_HYPH 42 -#define FT_TEXTFLOW 43 -#define LB_FRAMEDIR 44 -#define BTN_SHRINK 45 - -//#define ED_INDENT1 100 - -// list box indexes -#define ALIGNDLG_HORALIGN_STD 0 -#define ALIGNDLG_HORALIGN_LEFT 1 -#define ALIGNDLG_HORALIGN_CENTER 2 -#define ALIGNDLG_HORALIGN_RIGHT 3 -#define ALIGNDLG_HORALIGN_BLOCK 4 -#define ALIGNDLG_HORALIGN_FILL 5 -#define ALIGNDLG_HORALIGN_DISTRIBUTED 6 - -#define ALIGNDLG_VERALIGN_STD 0 -#define ALIGNDLG_VERALIGN_TOP 1 -#define ALIGNDLG_VERALIGN_MID 2 -#define ALIGNDLG_VERALIGN_BOTTOM 3 -#define ALIGNDLG_VERALIGN_BLOCK 4 -#define ALIGNDLG_VERALIGN_DISTRIBUTED 5 - -// image list for ValueSets: -#define IL_LOCK_BMPS 1100 -#define IID_BOTTOMLOCK 1 -#define IID_TOPLOCK 2 -#define IID_CELLLOCK 3 - -#define STR_BOTTOMLOCK 1 -#define STR_TOPLOCK 2 -#define STR_CELLLOCK 3 - -#endif - diff --git a/cui/source/tabpages/align.src b/cui/source/tabpages/align.src deleted file mode 100644 index f4e966f39..000000000 --- a/cui/source/tabpages/align.src +++ /dev/null @@ -1,249 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include "align.hrc" -#include - -#define MASKCOLOR \ - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; } - - // define --------------------------------------------------------------- -#define IL_LOCK_MCOL Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } - // RID_SVXPAGE_ALIGNMENT ------------------------------------------------- -TabPage RID_SVXPAGE_ALIGNMENT -{ - HelpId = HID_ALIGNMENT ; - Hide = TRUE ; - Text [ en-US ] = "Alignment" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - FixedLine FL_ALIGNMENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Text alignment"; - }; - FixedText FT_HORALIGN - { - Pos = MAP_APPFONT ( 12 ,14 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Hori~zontal"; - }; - ListBox LB_HORALIGN - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGNMENT:LB_HORALIGN"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 25 ); - Size = MAP_APPFONT ( 100 , 60 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Default" ; ALIGNDLG_HORALIGN_STD ; > ; - < "Left" ; ALIGNDLG_HORALIGN_LEFT ; > ; - < "Center" ; ALIGNDLG_HORALIGN_CENTER ; > ; - < "Right" ; ALIGNDLG_HORALIGN_RIGHT ; > ; - < "Justified" ; ALIGNDLG_HORALIGN_BLOCK ; > ; - < "Filled" ; ALIGNDLG_HORALIGN_FILL ; > ; - < "Distributed" ; ALIGNDLG_HORALIGN_DISTRIBUTED ; > ; - }; - }; - FixedText FT_INDENT - { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "I~ndent" ; - }; - MetricField ED_INDENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_ALIGNMENT:ED_INDENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 118 , 25 ) ; - Size = MAP_APPFONT ( 36 , 12 ) ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 990 ; - SpinSize = 10 ; - Unit = FUNIT_POINT ; - }; - FixedText FT_VERALIGN - { - Pos = MAP_APPFONT ( 160 , 14 ) ; - Size = MAP_APPFONT ( 88 , 8 ) ; - Text [ en-US ] = "~Vertical"; - }; - ListBox LB_VERALIGN - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGNMENT:LB_VERALIGN"; - Border = TRUE; - Pos = MAP_APPFONT ( 160 , 25 ); - Size = MAP_APPFONT ( 88 , 60 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Default" ; ALIGNDLG_VERALIGN_STD ; > ; - < "Top" ; ALIGNDLG_VERALIGN_TOP ; > ; - < "Middle" ; ALIGNDLG_VERALIGN_MID ; > ; - < "Bottom" ; ALIGNDLG_VERALIGN_BOTTOM ; > ; - < "Justified" ; ALIGNDLG_VERALIGN_BLOCK ; > ; - < "Distributed" ; ALIGNDLG_VERALIGN_DISTRIBUTED ; > ; - }; - }; - FixedLine FL_ORIENTATION - { - Pos = MAP_APPFONT ( 6 , 43 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Text orientation" ; - }; - TriStateBox BTN_TXTSTACKED - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_ALIGNMENT:BTN_TXTSTACKED"; - Pos = MAP_APPFONT ( 133 , 54 ) ; - Size = MAP_APPFONT ( 115 , 10 ) ; - TabStop = TRUE ; - Text[ en-US ] = "Ve~rtically stacked"; - }; - Control CTR_DIAL - { - HelpId = HID_ALIGNMENT_CTR_DIAL ; - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 42 , 43 ) ; - Text = "ABCD" ; - }; - FixedText FT_DEGREES - { - Pos = MAP_APPFONT ( 72 , 54 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "De~grees"; - }; - NumericField NF_DEGREES - { - HelpID = "cui:NumericField:RID_SVXPAGE_ALIGNMENT:NF_DEGREES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 65 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 359 ; - SpinSize = 5 ; - StrictFormat = TRUE ; - }; - FixedText FT_BORDER_LOCK - { - Pos = MAP_APPFONT ( 72 , 83 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Re~ference edge" ; - }; - Control CTR_BORDER_LOCK - { - HelpId = HID_ALIGNMENT_CTR_BORDER_LOCK ; - Pos = MAP_APPFONT ( 72 , 94 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - TabStop = TRUE ; - }; - TriStateBox BTN_ASIAN_VERTICAL - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_ALIGNMENT:BTN_ASIAN_VERTICAL"; - Pos = MAP_APPFONT ( 143 , 68 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Asian layout ~mode" ; - }; - FixedLine FL_WRAP - { - Pos = MAP_APPFONT ( 6 , 115 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Properties" ; - }; - TriStateBox BTN_WRAP - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_ALIGNMENT:BTN_WRAP"; - Pos = MAP_APPFONT ( 12 , 126 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "~Wrap text automatically" ; - }; - TriStateBox BTN_HYPH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_ALIGNMENT:BTN_HYPH"; - Pos = MAP_APPFONT ( 22 , 139 ) ; - Size = MAP_APPFONT ( 226 , 10 ) ; - Text [ en-US ] = "Hyphenation ~active"; - }; - TriStateBox BTN_SHRINK - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_ALIGNMENT:BTN_SHRINK"; - Pos = MAP_APPFONT( 12, 152 ); - Size = MAP_APPFONT( 236, 10 ); - Text [ en-US ] = "~Shrink to fit cell size"; - }; - FixedText FT_TEXTFLOW - { - Pos = MAP_APPFONT( 12 , 170 ); - Size = MAP_APPFONT( 64 , 8 ); - Text [ en-US ] = "Te~xt direction"; - }; - ListBox LB_FRAMEDIR - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGNMENT:LB_FRAMEDIR"; - Pos = MAP_APPFONT( 78 , 168 ); - Size = MAP_APPFONT( 170 , 50 ); - Border = TRUE; - DropDown = TRUE; - }; - ImageList IL_LOCK_BMPS - { - Prefix = "lo"; - MaskColor = IL_LOCK_MCOL ; - IdList = - { - IID_BOTTOMLOCK ; - IID_TOPLOCK ; - IID_CELLLOCK ; - }; - IdCount = { 3 ; }; - }; - String STR_BOTTOMLOCK - { - Text [ en-US ] = "Text Extension From Lower Cell Border" ; - }; - String STR_TOPLOCK - { - Text [ en-US ] = "Text Extension From Upper Cell Border" ; - }; - String STR_CELLLOCK - { - Text [ en-US ] = "Text Extension Inside Cell" ; - }; -}; - // ********************************************************************** EOF - diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx deleted file mode 100644 index 3383a0b27..000000000 --- a/cui/source/tabpages/autocdlg.cxx +++ /dev/null @@ -1,2741 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define _SVSTDARR_STRINGSISORTDTOR -#define _SVSTDARR_STRINGSDTOR - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _OFA_AUTOCDLG_CXX -#include "autocdlg.hxx" -#include "autocdlg.hrc" -#include "helpid.hrc" -#include -#include -#include "cuicharmap.hxx" -#include -#include -#include // SID_OPEN_SMARTTAGSOPTIONS - -static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM; - -using namespace ::com::sun::star::util; -using namespace ::com::sun::star; -using namespace ::rtl; - -static ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact() -{ - static ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > xMSF = - ::comphelper::getProcessServiceFactory(); - return xMSF; -} - -OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) : - SfxTabDialog(pParent, CUI_RES( RID_OFA_AUTOCORR_DLG ), _pSet), - aLanguageFT( this, CUI_RES(FT_LANG )), - aLanguageLB( this, CUI_RES(LB_LANG )) -{ - sal_Bool bShowSWOptions = sal_False; - sal_Bool bOpenSmartTagOptions = sal_False; - - if ( _pSet ) - { - SFX_ITEMSET_ARG( _pSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, sal_False ); - if ( pItem && pItem->GetValue() ) - bShowSWOptions = sal_True; - - SFX_ITEMSET_ARG( _pSet, pItem2, SfxBoolItem, SID_OPEN_SMARTTAGOPTIONS, sal_False ); - if ( pItem2 && pItem2->GetValue() ) - bOpenSmartTagOptions = sal_True; - } - - aLanguageFT.SetZOrder(0, WINDOW_ZORDER_FIRST); - aLanguageLB.SetZOrder(&aLanguageFT, WINDOW_ZORDER_BEHIND); - aLanguageLB.SetHelpId(HID_AUTOCORR_LANGUAGE); - FreeResource(); - - AddTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS, OfaAutocorrOptionsPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOFMT_APPLY, OfaSwAutoFmtOptionsPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS, OfaAutoCompleteTabPage::Create, 0); - AddTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS, OfaSmartTagOptionsTabPage::Create, 0); - - if (!bShowSWOptions) - { - RemoveTabPage(RID_OFAPAGE_AUTOFMT_APPLY); - RemoveTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS); - RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); - } - else - { - // remove smart tag tab page if no extensions are installed - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() ) - RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); - - RemoveTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS); - } - - AddTabPage(RID_OFAPAGE_AUTOCORR_REPLACE, OfaAutocorrReplacePage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCORR_EXCEPT, OfaAutocorrExceptPage::Create, 0); - AddTabPage(RID_OFAPAGE_AUTOCORR_QUOTE, OfaQuoteTabPage::Create, 0); - - // initialize languages - //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType - //! will be set to LANGUAGE_DONTKNOW - sal_Int16 nLangList = LANG_LIST_WESTERN; - - if( SvtLanguageOptions().IsCTLFontEnabled() ) - nLangList |= LANG_LIST_CTL; - aLanguageLB.SetLanguageList( nLangList, sal_True, sal_True ); - aLanguageLB.SelectLanguage( LANGUAGE_NONE ); - sal_uInt16 nPos = aLanguageLB.GetSelectEntryPos(); - DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); - aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW ); - - // Initialisierung funktionier fuer static nicht unter Linux - deswegen hier - if( LANGUAGE_SYSTEM == eLastDialogLanguage ) - eLastDialogLanguage = Application::GetSettings().GetLanguage(); - - LanguageType nSelectLang = LANGUAGE_DONTKNOW; - nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage ); - if (LISTBOX_ENTRY_NOTFOUND != nPos) - nSelectLang = eLastDialogLanguage; - aLanguageLB.SelectLanguage( nSelectLang ); - - aLanguageLB.SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); - - Size aMinSize(aLanguageFT.CalcMinimumSize()); - //reserve some extra space for CJK accelerators that are possible inserted - //later (like '(A)') - aLanguageFT.SetPosSizePixel( 0, 0, aMinSize.Width() + 20, 0, WINDOW_POSSIZE_WIDTH ); - - if ( bOpenSmartTagOptions ) - SetCurPageId( RID_OFAPAGE_SMARTTAG_OPTIONS ); -} - -sal_Bool lcl_FindEntry( ListBox& rLB, const String& rEntry, - CollatorWrapper& rCmpClass ) -{ - sal_uInt16 nCount = rLB.GetEntryCount(); - sal_uInt16 nSelPos = rLB.GetSelectEntryPos(); - sal_uInt16 i; - for(i = 0; i < nCount; i++) - { - if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) )) - { - rLB.SelectEntryPos(i, sal_True); - return sal_True; - } - } - if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - rLB.SelectEntryPos(nSelPos, sal_False); - return sal_False; -} - -IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox*, pBox) -{ - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - void* pVoid = pBox->GetEntryData(nPos); - LanguageType eNewLang = (LanguageType)(long)pVoid; - //alte Einstellungen speichern und neu fuellen - if(eNewLang != eLastDialogLanguage) - { - sal_uInt16 nPageId = GetCurPageId(); - if(RID_OFAPAGE_AUTOCORR_REPLACE == nPageId) - ((OfaAutocorrReplacePage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); - else if(RID_OFAPAGE_AUTOCORR_EXCEPT == nPageId) - ((OfaAutocorrExceptPage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); - } - return 0; -} - -OfaAutocorrOptionsPage::OfaAutocorrOptionsPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_OPTIONS ), rSet), - aCheckLB (this, CUI_RES(CLB_SETTINGS )), - - sInput (CUI_RES(ST_USE_REPLACE )), - sDoubleCaps (CUI_RES(ST_CPTL_STT_WORD )), - sStartCap (CUI_RES(ST_CPTL_STT_SENT )), - sBoldUnderline (CUI_RES(ST_BOLD_UNDER )), - sURL (CUI_RES(ST_DETECT_URL )), - sNoDblSpaces (CUI_RES(STR_NO_DBL_SPACES )), - sDash (CUI_RES(ST_DASH )), - sAccidentalCaps (CUI_RES(ST_CORRECT_ACCIDENTAL_CAPS_LOCK)) -{ - FreeResource(); - - aCheckLB.SetHelpId(HID_OFAPAGE_AUTOCORR_CLB); -} - -OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage() -{ -} - -SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrOptionsPage(pParent, rSet); -} - -sal_Bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - long nFlags = pAutoCorrect->GetFlags(); - - sal_uInt16 nPos = 0; - pAutoCorrect->SetAutoCorrFlag(Autocorrect, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(SetINetAttr, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(IgnoreDoubleSpace, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(CorrectCapsLock, aCheckLB.IsChecked(nPos++)); - - sal_Bool bReturn = nFlags != pAutoCorrect->GetFlags(); - if(bReturn ) - { - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - rCfg.SetModified(); - rCfg.Commit(); - } - return bReturn; -} - -void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); -} - -void OfaAutocorrOptionsPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - const long nFlags = pAutoCorrect->GetFlags(); - - aCheckLB.SetUpdateMode(sal_False); - aCheckLB.Clear(); - - aCheckLB.InsertEntry(sInput); - aCheckLB.InsertEntry(sDoubleCaps); - aCheckLB.InsertEntry(sStartCap); - aCheckLB.InsertEntry(sBoldUnderline); - aCheckLB.InsertEntry(sURL); - aCheckLB.InsertEntry(sDash); - aCheckLB.InsertEntry(sNoDblSpaces); - aCheckLB.InsertEntry(sAccidentalCaps); - - sal_uInt16 nPos = 0; - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & Autocorrect) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttWrd) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttSntnc) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgWeightUnderl) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & SetINetAttr) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgToEnEmDash) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & IgnoreDoubleSpace) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CorrectCapsLock) ); - - aCheckLB.SetUpdateMode(sal_True); -} - -/*********************************************************************/ -/* */ -/* Hilfs-struct fuer dUserDaten der Checklistbox */ -/* */ -/*********************************************************************/ - -struct ImpUserData -{ - String *pString; - Font* pFont; - - ImpUserData(String* pText, Font* pFnt) - { pString = pText; pFont = pFnt;} -}; - - -/*********************************************************************/ -/* */ -/* Dialog fuer Prozenteinstellung */ -/* */ -/*********************************************************************/ - -class OfaAutoFmtPrcntSet : public ModalDialog -{ - OKButton aOKPB; - CancelButton aCancelPB; - FixedLine aPrcntFL; - MetricField aPrcntMF; - - public: - OfaAutoFmtPrcntSet(Window* pParent) : - ModalDialog(pParent, CUI_RES(RID_OFADLG_PRCNT_SET)), - aOKPB(this, CUI_RES(BT_OK)), - aCancelPB(this, CUI_RES(BT_CANCEL)), - aPrcntFL(this, CUI_RES(FL_PRCNT)), - aPrcntMF(this, CUI_RES(ED_RIGHT_MARGIN)) - { - FreeResource(); - } - MetricField& GetPrcntFld(){return aPrcntMF;} -}; - - -/*********************************************************************/ -/* */ -/* veraenderter LBoxString */ -/* */ -/*********************************************************************/ - -class OfaImpBrwString : public SvLBoxString -{ -public: - - OfaImpBrwString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, - const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} - - virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, - SvLBoxEntry* pEntry); -}; - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -void OfaImpBrwString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, - SvLBoxEntry* pEntry ) -{ - rDev.DrawText( rPos, GetText() ); - if(pEntry->GetUserData()) - { - ImpUserData* pUserData = (ImpUserData* )pEntry->GetUserData(); - Point aNewPos(rPos); - aNewPos.X() += rDev.GetTextWidth(GetText()); - Font aOldFont( rDev.GetFont()); - Font aFont( aOldFont ); - if(pUserData->pFont) - { - aFont = *pUserData->pFont; - aFont.SetColor(aOldFont.GetColor()); - aFont.SetSize(aOldFont.GetSize()); - } - aFont.SetWeight( WEIGHT_BOLD ); - - sal_Bool bFett = sal_True; - sal_uInt16 nPos = 0; - do { - String sTxt( pUserData->pString->GetToken( 0, 1, nPos )); - - if( bFett ) - rDev.SetFont( aFont ); - - rDev.DrawText( aNewPos, sTxt ); - - if( STRING_NOTFOUND != nPos ) - aNewPos.X() += rDev.GetTextWidth( sTxt ); - - if( bFett ) - rDev.SetFont( aOldFont ); - - bFett = !bFett; - } while( STRING_NOTFOUND != nPos ); - } -} - -/*********************************************************************/ -/* */ -/* TabPage Autoformat anwenden */ -/* */ -/*********************************************************************/ - -#define CBCOL_FIRST 0 -#define CBCOL_SECOND 1 -#define CBCOL_BOTH 2 - -enum OfaAutoFmtOptions -{ - USE_REPLACE_TABLE, - CORR_UPPER, - BEGIN_UPPER, - BOLD_UNDERLINE, - DETECT_URL, - REPLACE_DASHES, - DEL_SPACES_AT_STT_END, - DEL_SPACES_BETWEEN_LINES, - IGNORE_DBLSPACE, - CORRECT_CAPS_LOCK, - APPLY_NUMBERING, - INSERT_BORDER, - CREATE_TABLE, - REPLACE_STYLES, - DEL_EMPTY_NODE, - REPLACE_USER_COLL, - REPLACE_BULLETS, - MERGE_SINGLE_LINE_PARA -}; - -OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES(RID_OFAPAGE_AUTOFMT_APPLY), rSet), - m_aCheckLBContainer(this, CUI_RES(CLB_SETTINGS)), - aCheckLB(m_aCheckLBContainer), - aEditPB (this, CUI_RES(PB_EDIT)), - aHeader1Expl (this, CUI_RES(FT_HEADER1_EXPLANATION)), - aHeader2Expl (this, CUI_RES(FT_HEADER2_EXPLANATION)), - sHeader1 (CUI_RES( STR_HEADER1 )), - sHeader2 (CUI_RES( STR_HEADER2 )), - sDeleteEmptyPara (CUI_RES( ST_DEL_EMPTY_PARA)), - sUseReplaceTbl (CUI_RES( ST_USE_REPLACE )), - sCptlSttWord (CUI_RES( ST_CPTL_STT_WORD)), - sCptlSttSent (CUI_RES( ST_CPTL_STT_SENT)), - sUserStyle (CUI_RES( ST_USER_STYLE )), - sBullet (CUI_RES( ST_BULLET )), - sBoldUnder (CUI_RES( ST_BOLD_UNDER )), - sNoDblSpaces (CUI_RES( STR_NO_DBL_SPACES)), - sCorrectCapsLock (CUI_RES( ST_CORRECT_ACCIDENTAL_CAPS_LOCK)), - sDetectURL (CUI_RES( ST_DETECT_URL )), - sDash (CUI_RES( ST_DASH )), - sRightMargin (CUI_RES( ST_RIGHT_MARGIN )), - sNum (CUI_RES( STR_NUM )), - sBorder (CUI_RES( STR_BORDER )), - sTable (CUI_RES( STR_TABLE )), - sReplaceTemplates (CUI_RES( STR_REPLACE_TEMPLATES)), - sDelSpaceAtSttEnd (CUI_RES( STR_DEL_SPACES_AT_STT_END)), - sDelSpaceBetweenLines(CUI_RES(STR_DEL_SPACES_BETWEEN_LINES)), - - nPercent ( 50 ), - pCheckButtonData( NULL ) - -{ - FreeResource(); - - //typ. Anfuehrungszeichen einsetzen - SvtSysLocale aSysLcl; - - aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB); - aCheckLB.SetStyle(aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL); - - aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl)); - aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); - - static long aStaticTabs[]= - { - 3, 0, 20, 40 - }; - - aCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); - String sHeader( sHeader1 ); - sHeader += '\t'; - sHeader += sHeader2; - sHeader += '\t'; - aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, - HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); - - aEditPB.SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SvLBoxEntry* OfaSwAutoFmtOptionsPage::CreateEntry(String& rTxt, sal_uInt16 nCol) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if ( !pCheckButtonData ) - { - pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); - aCheckLB.SetCheckButtonData( pCheckButtonData ); - } - - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - - String sEmpty; - if (nCol == CBCOL_SECOND) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - - if (nCol == CBCOL_FIRST) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); - - return pEntry; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage() -{ - delete (ImpUserData*) aCheckLB.GetUserData( REPLACE_BULLETS ); - delete (ImpUserData*) aCheckLB.GetUserData( APPLY_NUMBERING ); - delete (ImpUserData*) aCheckLB.GetUserData( MERGE_SINGLE_LINE_PARA ); - delete pCheckButtonData; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SfxTabPage* OfaSwAutoFmtOptionsPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new OfaSwAutoFmtOptionsPage(pParent, rAttrSet); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -sal_Bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bModified = sal_False; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - long nFlags = pAutoCorrect->GetFlags(); - - sal_Bool bCheck = aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_FIRST); - bModified |= pOpt->bAutoCorrect != bCheck; - pOpt->bAutoCorrect = bCheck; - pAutoCorrect->SetAutoCorrFlag(Autocorrect, - aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(CORR_UPPER, CBCOL_FIRST); - bModified |= pOpt->bCptlSttWrd != bCheck; - pOpt->bCptlSttWrd = bCheck; - pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, - aCheckLB.IsChecked(CORR_UPPER, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_FIRST); - bModified |= pOpt->bCptlSttSntnc != bCheck; - pOpt->bCptlSttSntnc = bCheck; - pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, - aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_FIRST); - bModified |= pOpt->bChgWeightUnderl != bCheck; - pOpt->bChgWeightUnderl = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, - aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_SECOND)); - - pAutoCorrect->SetAutoCorrFlag(IgnoreDoubleSpace, - aCheckLB.IsChecked(IGNORE_DBLSPACE, CBCOL_SECOND)); - - pAutoCorrect->SetAutoCorrFlag(CorrectCapsLock, - aCheckLB.IsChecked(CORRECT_CAPS_LOCK, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DETECT_URL, CBCOL_FIRST); - bModified |= pOpt->bSetINetAttr != bCheck; - pOpt->bSetINetAttr = bCheck; - pAutoCorrect->SetAutoCorrFlag(SetINetAttr, - aCheckLB.IsChecked(DETECT_URL, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DEL_EMPTY_NODE, CBCOL_FIRST); - bModified |= pOpt->bDelEmptyNode != bCheck; - pOpt->bDelEmptyNode = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_USER_COLL, CBCOL_FIRST); - bModified |= pOpt->bChgUserColl != bCheck; - pOpt->bChgUserColl = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_BULLETS, CBCOL_FIRST); - bModified |= pOpt->bChgEnumNum != bCheck; - pOpt->bChgEnumNum = bCheck; - bModified |= aBulletFont != pOpt->aBulletFont; - pOpt->aBulletFont = aBulletFont; - bModified |= String(pOpt->cBullet) != sBulletChar; - pOpt->cBullet = sBulletChar.GetChar(0); - - bModified |= aByInputBulletFont != pOpt->aByInputBulletFont; - bModified |= String(pOpt->cByInputBullet) != sByInputBulletChar; - pOpt->aByInputBulletFont = aByInputBulletFont; - pOpt->cByInputBullet = sByInputBulletChar.GetChar(0); - - bCheck = aCheckLB.IsChecked(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST); - bModified |= pOpt->bRightMargin != bCheck; - pOpt->bRightMargin = bCheck; - bModified |= nPercent != pOpt->nRightMargin; - pOpt->nRightMargin = (sal_uInt8)nPercent; - - bCheck = aCheckLB.IsChecked(APPLY_NUMBERING, CBCOL_SECOND); - bModified |= pOpt->bSetNumRule != bCheck; - pOpt->bSetNumRule = bCheck; - - bCheck = aCheckLB.IsChecked(INSERT_BORDER, CBCOL_SECOND); - bModified |= pOpt->bSetBorder != bCheck; - pOpt->bSetBorder = bCheck; - - bCheck = aCheckLB.IsChecked(CREATE_TABLE, CBCOL_SECOND); - bModified |= pOpt->bCreateTable != bCheck; - pOpt->bCreateTable = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_STYLES, CBCOL_SECOND); - bModified |= pOpt->bReplaceStyles != bCheck; - pOpt->bReplaceStyles = bCheck; - - bCheck = aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_FIRST); - bModified |= pOpt->bChgToEnEmDash != bCheck; - pOpt->bChgToEnEmDash = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, - aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_SECOND)); - - bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_FIRST); - bModified |= pOpt->bAFmtDelSpacesAtSttEnd != bCheck; - pOpt->bAFmtDelSpacesAtSttEnd = bCheck; - bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_SECOND); - bModified |= pOpt->bAFmtByInpDelSpacesAtSttEnd != bCheck; - pOpt->bAFmtByInpDelSpacesAtSttEnd = bCheck; - - bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST); - bModified |= pOpt->bAFmtDelSpacesBetweenLines != bCheck; - pOpt->bAFmtDelSpacesBetweenLines = bCheck; - bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND); - bModified |= pOpt->bAFmtByInpDelSpacesBetweenLines != bCheck; - pOpt->bAFmtByInpDelSpacesBetweenLines = bCheck; - - if(bModified || nFlags != pAutoCorrect->GetFlags()) - { - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - rCfg.SetModified(); - rCfg.Commit(); - } - - return sal_True; -} - -void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - - -void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - const long nFlags = pAutoCorrect->GetFlags(); - - aCheckLB.SetUpdateMode(sal_False); - aCheckLB.Clear(); - - // Die folgenden Eintraege muessen in der selben Reihenfolge, wie im - // OfaAutoFmtOptions-enum eingefuegt werden! - aCheckLB.GetModel()->Insert(CreateEntry(sUseReplaceTbl, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttWord, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttSent, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sBoldUnder, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDetectURL, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDash, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH )); - aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH )); - - aCheckLB.GetModel()->Insert(CreateEntry(sNoDblSpaces, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sCorrectCapsLock, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sNum, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sBorder, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sTable, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sReplaceTemplates, CBCOL_SECOND)); - aCheckLB.GetModel()->Insert(CreateEntry(sDeleteEmptyPara, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sUserStyle, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sBullet, CBCOL_FIRST )); - aCheckLB.GetModel()->Insert(CreateEntry(sRightMargin, CBCOL_FIRST )); - - aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_FIRST, pOpt->bAutoCorrect ); - aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_SECOND, 0 != (nFlags & Autocorrect)); - aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_FIRST, pOpt->bCptlSttWrd ); - aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttWrd) ); - aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_FIRST, pOpt->bCptlSttSntnc ); - aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttSntnc) ); - aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_FIRST, pOpt->bChgWeightUnderl ); - aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_SECOND, 0 != (nFlags & ChgWeightUnderl) ); - aCheckLB.CheckEntryPos( IGNORE_DBLSPACE, CBCOL_SECOND, 0 != (nFlags & IgnoreDoubleSpace) ); - aCheckLB.CheckEntryPos( CORRECT_CAPS_LOCK, CBCOL_SECOND, 0 != (nFlags & CorrectCapsLock) ); - aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_FIRST, pOpt->bSetINetAttr ); - aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_SECOND, 0 != (nFlags & SetINetAttr) ); - aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_FIRST, pOpt->bChgToEnEmDash ); - aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_SECOND, 0 != (nFlags & ChgToEnEmDash) ); - aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_FIRST, pOpt->bAFmtDelSpacesAtSttEnd ); - aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesAtSttEnd ); - aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST, pOpt->bAFmtDelSpacesBetweenLines ); - aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesBetweenLines ); - aCheckLB.CheckEntryPos( DEL_EMPTY_NODE, CBCOL_FIRST, pOpt->bDelEmptyNode ); - aCheckLB.CheckEntryPos( REPLACE_USER_COLL, CBCOL_FIRST, pOpt->bChgUserColl ); - aCheckLB.CheckEntryPos( REPLACE_BULLETS, CBCOL_FIRST, pOpt->bChgEnumNum ); - - aBulletFont = pOpt->aBulletFont; - sBulletChar = pOpt->cBullet; - ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont); - aCheckLB.SetUserData( REPLACE_BULLETS, pUserData ); - - nPercent = pOpt->nRightMargin; - sMargin = ' '; - sMargin += String::CreateFromInt32( nPercent ); - sMargin += '%'; - pUserData = new ImpUserData(&sMargin, 0); - aCheckLB.SetUserData( MERGE_SINGLE_LINE_PARA, pUserData ); - - aCheckLB.CheckEntryPos( APPLY_NUMBERING, CBCOL_SECOND, pOpt->bSetNumRule ); - - aByInputBulletFont = pOpt->aByInputBulletFont; - sByInputBulletChar = pOpt->cByInputBullet; - ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont); - aCheckLB.SetUserData( APPLY_NUMBERING , pUserData2 ); - - aCheckLB.CheckEntryPos( MERGE_SINGLE_LINE_PARA, CBCOL_FIRST, pOpt->bRightMargin ); - aCheckLB.CheckEntryPos( INSERT_BORDER, CBCOL_SECOND, pOpt->bSetBorder ); - aCheckLB.CheckEntryPos( CREATE_TABLE, CBCOL_SECOND, pOpt->bCreateTable ); - aCheckLB.CheckEntryPos( REPLACE_STYLES, CBCOL_SECOND, pOpt->bReplaceStyles ); - - aCheckLB.SetUpdateMode(sal_True); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, OfaACorrCheckListBox*, pBox) -{ - aEditPB.Enable(0 != pBox->FirstSelected()->GetUserData()); - return 0; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -IMPL_LINK(OfaSwAutoFmtOptionsPage, EditHdl, PushButton*, EMPTYARG) -{ - sal_uLong nSelEntryPos = aCheckLB.GetSelectEntryPos(); - if( nSelEntryPos == REPLACE_BULLETS || - nSelEntryPos == APPLY_NUMBERING) - { - SvxCharacterMap *pMapDlg = new SvxCharacterMap(this); - ImpUserData* pUserData = (ImpUserData*)aCheckLB.FirstSelected()->GetUserData(); - pMapDlg->SetCharFont(*pUserData->pFont); - pMapDlg->SetChar( pUserData->pString->GetChar(0) ); - if(RET_OK == pMapDlg->Execute()) - { - Font aFont(pMapDlg->GetCharFont()); - *pUserData->pFont = aFont; - sal_UCS4 aChar = pMapDlg->GetChar(); - // using the UCS4 constructor - rtl::OUString aOUStr( &aChar, 1 ); - *pUserData->pString = aOUStr; - } - delete pMapDlg; - } - else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos ) - { - // Dialog fuer Prozenteinstellung - OfaAutoFmtPrcntSet aDlg(this); - aDlg.GetPrcntFld().SetValue(nPercent); - if(RET_OK == aDlg.Execute()) - { - nPercent = (sal_uInt16)aDlg.GetPrcntFld().GetValue(); - sMargin = ' '; - sMargin += String::CreateFromInt32( nPercent ); - sMargin += '%'; - } - } - aCheckLB.Invalidate(); - return 0; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::SetTabs() -{ - SvxSimpleTable::SetTabs(); - sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; - - if( aTabs.Count() > 1 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } - if( aTabs.Count() > 2 ) - { - SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2); - pTab->nFlags &= ~nAdjust; - pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; - } -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked) -{ - if ( nPos < GetEntryCount() ) - SetCheckButtonState( - GetEntry(nPos), - nCol, - bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : - SvButtonState( SV_BUTTON_UNCHECKED ) ); -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -sal_Bool OfaACorrCheckListBox::IsChecked(sal_uLong nPos, sal_uInt16 nCol) -{ - return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED; -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -void OfaACorrCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) -{ - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - - DBG_ASSERT(pItem,"SetCheckButton:Item not found"); - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - switch( eState ) - { - case SV_BUTTON_CHECKED: - pItem->SetStateChecked(); - break; - - case SV_BUTTON_UNCHECKED: - pItem->SetStateUnchecked(); - break; - - case SV_BUTTON_TRISTATE: - pItem->SetStateTristate(); - break; - } - InvalidateEntry( pEntry ); - } -} - -/*********************************************************************/ -/* */ -/*********************************************************************/ - -SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol ) const -{ - SvButtonState eState = SV_BUTTON_UNCHECKED; - SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); - DBG_ASSERT(pItem,"GetChButnState:Item not found"); - - if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) - { - sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); - eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); - } - - return eState; -} - -void OfaACorrCheckListBox::HBarClick() -{ - // Sortierung durch diese Ueberladung abgeklemmt -} - -void OfaACorrCheckListBox::KeyInput( const KeyEvent& rKEvt ) -{ - if(!rKEvt.GetKeyCode().GetModifier() && - KEY_SPACE == rKEvt.GetKeyCode().GetCode()) - { - sal_uLong nSelPos = GetSelectEntryPos(); - sal_uInt16 nCol = GetCurrentTabPos() - 1; - if ( nCol < 2 ) - { - CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) ); - CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) ); - } - else - { - sal_uInt16 nCheck = IsChecked(nSelPos, 1) ? 1 : 0; - if(IsChecked(nSelPos, 0)) - nCheck += 2; - nCheck--; - nCheck &= 3; - CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); - CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); - } - } - else - SvxSimpleTable::KeyInput(rKEvt); -} - -struct DoubleString -{ - String sShort; - String sLong; - void* pUserData; // CheckBox -> form. Text Bool -> Selektionstext -}; -typedef DoubleString* DoubleStringPtr; -SV_DECL_PTRARR_DEL(DoubleStringArray, DoubleStringPtr, 4, 4) -SV_IMPL_PTRARR(DoubleStringArray, DoubleStringPtr); - -void lcl_ClearTable(DoubleStringTable& rTable) -{ - DoubleStringArrayPtr pArray = rTable.Last(); - while(pArray) - { - pArray->DeleteAndDestroy(0, pArray->Count()); - delete pArray; - pArray = rTable.Prev(); - } - rTable.Clear(); -} - -OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_REPLACE ), rSet), - aTextOnlyCB( this, CUI_RES(CB_TEXT_ONLY )), - aShortFT ( this, CUI_RES(FT_SHORT )), - aShortED ( this, CUI_RES(ED_SHORT )), - aReplaceFT( this, CUI_RES(FT_REPLACE )), - aReplaceED( this, CUI_RES(ED_REPLACE )), - aReplaceTLB( this, CUI_RES(TLB_REPLACE )), - aNewReplacePB( this, CUI_RES(PB_NEW_REPLACE )), - aDeleteReplacePB(this,CUI_RES(PB_DELETE_REPLACE )), - sModify(CUI_RES(STR_MODIFY)), - sNew(aNewReplacePB.GetText()), - pFormatText(0), - eLang(eLastDialogLanguage), - bHasSelectionText(sal_False), - bFirstSelect(sal_True), - bReplaceEditChanged(sal_False), - bSWriter(sal_True) -{ - FreeResource(); - SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER); - bSWriter = pMod == SfxModule::GetActiveModule(); - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, 0 ); - pCharClass = new CharClass( aLcl ); - - static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; - aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); - - aReplaceTLB.SetStyle(aReplaceTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); - aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl)); - aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aShortED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); - aReplaceED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); - aShortED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - aReplaceED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); - - aReplaceED.SetSpaces(sal_True); - aShortED.SetSpaces(sal_True); - aShortED.SetMaxTextLen(30); -} - -OfaAutocorrReplacePage::~OfaAutocorrReplacePage() -{ - delete pFormatText; - lcl_ClearTable(aDoubleStringTable); - delete pCompareClass; - delete pCharClass; -} - -SfxTabPage* OfaAutocorrReplacePage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrReplacePage(pParent, rSet); -} - -void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& ) -{ - if(eLang != eLastDialogLanguage) - SetLanguage(eLastDialogLanguage); - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_True); -} - -int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} - -sal_Bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last(); - while(pDoubleStringArray) - { - LanguageType eCurLang = (LanguageType)aDoubleStringTable.GetCurKey(); - if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt - { - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eCurLang); - sal_uInt16 nWordListCount = pWordList->Count(); - sal_uInt16 nDoubleStringArrayCount = pDoubleStringArray->Count(); - sal_uInt16 nPos = nDoubleStringArrayCount; - sal_uInt16 nLastPos = nPos; - // 1. Durchlauf: Eintraege loeschen oder veraendern: - - - for( sal_uInt16 nWordListPos = nWordListCount; nWordListPos; nWordListPos-- ) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(nWordListPos - 1); - String sEntry(pWordPtr->GetShort()); - // formatierter Text steht nur im Writer - sal_Bool bFound = !bSWriter && !pWordPtr->IsTextOnly(); - while(!bFound && nPos) - { - DoubleString* pDouble = pDoubleStringArray->GetObject( nPos - 1); - - if( 0 == pCompareClass->compareString( - sEntry, pDouble->sShort )) - { - nLastPos = nPos - 1; - bFound = sal_True; - if( !(pWordPtr->IsTextOnly() == (0 == pDouble->pUserData) - && 0 == pCompareClass->compareString( - pWordPtr->GetLong(), pDouble->sLong ) ) ) - { - pAutoCorrect->PutText(sEntry, pDouble->sLong, eCurLang); - } - pDoubleStringArray->DeleteAndDestroy(nPos - 1, 1); - break; - } - nPos--; - } - nPos = nLastPos; - if(!bFound) - { - pAutoCorrect->DeleteText(sEntry, eCurLang); - } - } - nDoubleStringArrayCount = pDoubleStringArray->Count(); - for(sal_uInt16 nDoubleStringArrayPos = 0; nDoubleStringArrayPos < nDoubleStringArrayCount; nDoubleStringArrayPos++ ) - { - //jetzt sollte es nur noch neue Eintraege geben - DoubleString* pDouble = pDoubleStringArray->GetObject( nDoubleStringArrayPos ); - if(pDouble->pUserData == &bHasSelectionText) - pAutoCorrect->PutText( pDouble->sShort, - *SfxObjectShell::Current(), eCurLang ); - else - { - pAutoCorrect->PutText( pDouble->sShort, pDouble->sLong, - eCurLang); - } - } - } - pDoubleStringArray->DeleteAndDestroy(0, pDoubleStringArray->Count()); - delete pDoubleStringArray; - pDoubleStringArray = aDoubleStringTable.Prev(); - } - aDoubleStringTable.Clear(); - // jetzt noch die aktuelle Selektion - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); - sal_uInt16 nWordListCount = pWordList->Count(); - sal_uInt16 nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); - - aReplaceTLB.SetUpdateMode(sal_False); - sal_uInt16 nListBoxPos = nListBoxCount; - sal_uInt16 nLastListBoxPos = nListBoxPos; - // 1. Durchlauf: Eintraege loeschen oder veraendern: - - sal_uInt16 i; - for( i = nWordListCount; i; i-- ) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i- 1); - String sEntry(pWordPtr->GetShort()); - // formatierter Text steht nur im Writer - sal_Bool bFound = !bSWriter && !pWordPtr->IsTextOnly(); - while(!bFound && nListBoxPos) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( nListBoxPos - 1); - if( 0 == pCompareClass->compareString( sEntry, - aReplaceTLB.GetEntryText(pEntry, 0))) - { - nLastListBoxPos = nListBoxPos - 1; - bFound = sal_True; - String sLong = aReplaceTLB.GetEntryText(pEntry, 1); - if( !(pWordPtr->IsTextOnly() == (0 == pEntry->GetUserData()) - && 0 == pCompareClass->compareString( - pWordPtr->GetLong(), sLong ))) - { - pAutoCorrect->PutText(sEntry, sLong, eLang); - } - aReplaceTLB.GetModel()->Remove(pEntry); - break; - - } - nListBoxPos --; - } - nListBoxPos = nLastListBoxPos; - if(!bFound) - { - pAutoCorrect->DeleteText(sEntry, eLang); - } - - } - nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); - for(i = 0; i < nListBoxCount; i++ ) - { - //jetzt sollte es nur noch neue Eintraege geben - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - String sShort = aReplaceTLB.GetEntryText(pEntry, 0); - if(pEntry->GetUserData() == &bHasSelectionText) - pAutoCorrect->PutText(sShort, *SfxObjectShell::Current(), eLang); - else - { - String sLong = aReplaceTLB.GetEntryText(pEntry, 1); - pAutoCorrect->PutText(sShort, sLong, eLang); - } - } - - return sal_False; -} - -void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset, - LanguageType eOldLanguage, - LanguageType eNewLanguage) -{ - eLang = eNewLanguage; - if(bFromReset) - lcl_ClearTable(aDoubleStringTable); - else - { - DoubleStringArray* pArray = 0; - if(aDoubleStringTable.IsKeyValid(eOldLanguage)) - { - pArray = aDoubleStringTable.Seek(sal_uLong(eOldLanguage)); - pArray->DeleteAndDestroy(0, pArray->Count()); - } - else - { - pArray = new DoubleStringArray; - aDoubleStringTable.Insert(sal_uLong(eOldLanguage), pArray); - } - - sal_uInt16 nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); - sal_uInt16 i; - for(i = 0; i < nListBoxCount; i++) - { - DoubleString* pDouble = new DoubleString(); - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - pDouble->sShort = aReplaceTLB.GetEntryText(pEntry, 0); - pDouble->sLong = aReplaceTLB.GetEntryText(pEntry, 1); - pDouble->pUserData = pEntry->GetUserData(); - pArray->Insert(pDouble, i); - } - } - - aReplaceTLB.Clear(); - if(!bSWriter) - { - if(pFormatText) - pFormatText->DeleteAndDestroy(0, pFormatText->Count()); - else - pFormatText = new SvStringsISortDtor(); - } - - if(aDoubleStringTable.IsKeyValid(eLang)) - { - DoubleStringArray* pArray = aDoubleStringTable.Seek(sal_uLong(eNewLanguage)); - for(sal_uInt16 i = 0; i < pArray->Count(); i++) - { - DoubleString* pDouble = pArray->GetObject(i); - sal_Bool bTextOnly = 0 == pDouble->pUserData; - // formatierter Text wird nur im Writer angeboten - if(bSWriter || bTextOnly) - { - String sEntry(pDouble->sShort); - sEntry += '\t'; - sEntry += pDouble->sLong; - SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); - aTextOnlyCB.Check(bTextOnly); - if(!bTextOnly) - pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext - } - else - { - pFormatText->Insert(new String(pDouble->sShort)); - } - } - } - else - { - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); - - for(sal_uInt16 i = 0; i < pWordList->Count(); i++) - { - SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i); - sal_Bool bTextOnly = pWordPtr->IsTextOnly(); - // formatierter Text wird nur im Writer angeboten - if(bSWriter || bTextOnly) - { - String sEntry(pWordPtr->GetShort()); - sEntry += '\t'; - sEntry += pWordPtr->GetLong(); - SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); - aTextOnlyCB.Check(pWordPtr->IsTextOnly()); - if(!bTextOnly) - pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo - } - else - { - pFormatText->Insert(new String(pWordPtr->GetShort())); - } - } - aNewReplacePB.Enable(sal_False); - aDeleteReplacePB.Enable(sal_False); - - } - - SfxViewShell* pViewShell = SfxViewShell::Current(); - if( pViewShell && pViewShell->HasSelection( sal_True ) ) - { - bHasSelectionText = sal_True; - const String sSelection( pViewShell->GetSelectionText() ); - aReplaceED.SetText( sSelection ); - aTextOnlyCB.Check( !bSWriter ); - aTextOnlyCB.Enable( bSWriter && sSelection.Len() ); - } - else - aTextOnlyCB.Enable( sal_False ); -} - -void OfaAutocorrReplacePage::Reset( const SfxItemSet& ) -{ - RefillReplaceBox(sal_True, eLang, eLang); - aShortED.GrabFocus(); -} - -void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) -{ - //save old settings an refill - if(eSet != eLang) - { - RefillReplaceBox(sal_False, eLang, eSet); - eLastDialogLanguage = eSet; - delete pCompareClass; - delete pCharClass; - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, 0 ); - pCharClass = new CharClass( aLcl ); - ModifyHdl(&aShortED); - } -} - -IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox) -{ - if(!bFirstSelect || !bHasSelectionText) - { - SvLBoxEntry* pEntry = pBox->FirstSelected(); - String sTmpShort(pBox->GetEntryText(pEntry, 0)); - // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor sonst immer am Wortanfang, - // obwohl man gerade hier editiert - sal_Bool bSameContent = 0 == pCompareClass->compareString( - sTmpShort, aShortED.GetText() ); - Selection aSel = aShortED.GetSelection(); - if(aShortED.GetText() != sTmpShort) - { - aShortED.SetText(sTmpShort); - //war es nur eine andere Schreibweise, dann muss die Selektion auch wieder gesetzt werden - if(bSameContent) - aShortED.SetSelection(aSel); - } - aReplaceED.SetText(pBox->GetEntryText(pEntry, 1)); - // mit UserData gibt es eine Formatinfo - aTextOnlyCB.Check(0 == pEntry->GetUserData()); - } - else - bFirstSelect = sal_False; - - aNewReplacePB.Enable(sal_False); - aDeleteReplacePB.Enable(); - return 0; -}; - -IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) -{ - SvLBoxEntry* _pEntry = aReplaceTLB.FirstSelected(); - if(pBtn == &aDeleteReplacePB) - { - DBG_ASSERT(_pEntry, "keine Eintrag selektiert"); - if(_pEntry) - { - aReplaceTLB.GetModel()->Remove(_pEntry); - ModifyHdl(&aShortED); - return 0; - } - } - if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled()) - { - SvLBoxEntry* _pNewEntry = aReplaceTLB.FirstSelected(); - String sEntry(aShortED.GetText()); - if(sEntry.Len() && ( aReplaceED.GetText().Len() || - ( bHasSelectionText && bSWriter ) )) - { - aReplaceTLB.SetUpdateMode(sal_False); - sal_uInt16 nPos = USHRT_MAX; - sEntry += '\t'; - sEntry += aReplaceED.GetText(); - if(_pNewEntry) - { - nPos = (sal_uInt16)aReplaceTLB.GetModel()->GetAbsPos(_pNewEntry); - aReplaceTLB.GetModel()->Remove(_pNewEntry); - } - else - { - sal_uInt16 j; - for( j = 0; j < aReplaceTLB.GetEntryCount(); j++ ) - { - SvLBoxEntry* pReplaceEntry = aReplaceTLB.GetEntry(j); - if( 0 >= pCompareClass->compareString(sEntry, - aReplaceTLB.GetEntryText(pReplaceEntry, 0) ) ) - break; - } - nPos = j; - } - SvLBoxEntry* pInsEntry = - aReplaceTLB.InsertEntry( - sEntry, static_cast< SvLBoxEntry * >(NULL), false, - nPos == USHRT_MAX ? LIST_APPEND : nPos); - if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked()) - pInsEntry->SetUserData(&bHasSelectionText); // neuer formatierter Text - - aReplaceTLB.MakeVisible( pInsEntry ); - aReplaceTLB.SetUpdateMode(sal_True); - // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen - if(aReplaceED.HasFocus()) - aShortED.GrabFocus(); - - } - } - else - { - // das kann nur ein Enter in einem der beiden Edit-Felder sein und das - // bedeutet EndDialog() - muss im KeyInput ausgewertet werden - return 0; - } - ModifyHdl(&aShortED); - return 1; -} - -IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) -{ - SvLBoxEntry* pFirstSel = aReplaceTLB.FirstSelected(); - sal_Bool bShort = pEdt == &aShortED; - const String rEntry = pEdt->GetText(); - const String rRepString = aReplaceED.GetText(); - String aWordStr( pCharClass->lower( rEntry )); - - if(bShort) - { - if(rEntry.Len()) - { - sal_Bool bFound = sal_False; - sal_Bool bTmpSelEntry=sal_False; - - for(sal_uInt16 i = 0; i < aReplaceTLB.GetEntryCount(); i++) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); - String aTestStr=aReplaceTLB.GetEntryText(pEntry, 0); - if( 0 == pCompareClass->compareString(rEntry, aTestStr )) - { - if(rRepString.Len()) - bFirstSelect = sal_True; - aReplaceTLB.SetCurEntry(pEntry); - pFirstSel = pEntry; - aNewReplacePB.SetText(sModify); - bFound= sal_True; - break; - } - else - { - pCharClass->toLower( aTestStr ); - if(aTestStr.Search(aWordStr)==0 && !bTmpSelEntry) - { - aReplaceTLB.MakeVisible(pEntry); - bTmpSelEntry=sal_True; - } - } - } - if(!bFound) - { - aReplaceTLB.SelectAll(sal_False); - pFirstSel = 0; - aNewReplacePB.SetText(sNew); - if(bReplaceEditChanged) - aTextOnlyCB.Enable(sal_False); - } - aDeleteReplacePB.Enable(bFound); - } - else if(aReplaceTLB.GetEntryCount()>0) - { - SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( 0 ); - aReplaceTLB.MakeVisible(pEntry); - } - - } - else if(!bShort) - { - bReplaceEditChanged = sal_True; - if(pFirstSel) - { - aNewReplacePB.SetText(sModify); - } - } - - const String& rShortTxt = aShortED.GetText(); - sal_Bool bEnableNew = rShortTxt.Len() && - ( rRepString.Len() || - ( bHasSelectionText && bSWriter )) && - ( !pFirstSel || rRepString != - aReplaceTLB.GetEntryText( pFirstSel, 1 ) ); - if(bEnableNew && pFormatText) - { - for(sal_uInt16 i = 0; i < pFormatText->Count(); i++) - if(*pFormatText->GetObject(i) == rShortTxt) - { - bEnableNew = sal_False; - break; - } - } - aNewReplacePB.Enable(bEnableNew); - - return 0; -} - -struct StringsArrays -{ - - SvStringsDtor aAbbrevStrings; - SvStringsDtor aDoubleCapsStrings; - - StringsArrays() : - aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {} -}; -typedef StringsArrays* StringsArraysPtr; - -sal_Bool lcl_FindInArray(SvStringsDtor& rStrings, const String& rString) -{ - for(sal_uInt16 i = 0; i < rStrings.Count(); i++) - if(rString == *rStrings.GetObject(i)) - return sal_True; - return sal_False; -} - -void lcl_ClearTable(StringsTable& rTable) -{ - StringsArraysPtr pArrays = rTable.Last(); - while(pArrays) - { - delete pArrays; - pArrays = rTable.Prev(); - } - rTable.Clear(); -} - -OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent, - const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_EXCEPT ), rSet), - aAbbrevFL (this, CUI_RES(FL_ABBREV )), - aAbbrevED (this, CUI_RES(ED_ABBREV )), - aAbbrevLB (this, CUI_RES(LB_ABBREV )), - aNewAbbrevPB (this, CUI_RES(PB_NEWABBREV )), - aDelAbbrevPB (this, CUI_RES(PB_DELABBREV )), - aAutoAbbrevCB (this, CUI_RES(CB_AUTOABBREV )), - aDoubleCapsFL (this, CUI_RES(FL_DOUBLECAPS )), - aDoubleCapsED (this, CUI_RES(ED_DOUBLE_CAPS )), - aDoubleCapsLB (this, CUI_RES(LB_DOUBLE_CAPS )), - aNewDoublePB (this, CUI_RES(PB_NEWDOUBLECAPS)), - aDelDoublePB (this, CUI_RES(PB_DELDOUBLECAPS)), - aAutoCapsCB (this, CUI_RES(CB_AUTOCAPS )), - eLang(eLastDialogLanguage) -{ - aNewAbbrevPB.SetAccessibleName(String(CUI_RES(STR_PB_NEWABBREV) ) ); - aDelAbbrevPB.SetAccessibleName(String(CUI_RES(STR_PB_DELABBREV) ) ); - aNewDoublePB.SetAccessibleName(String(CUI_RES(STR_PB_NEWDOUBLECAPS) ) ); - aDelDoublePB.SetAccessibleName(String(CUI_RES(STR_PB_DELDOUBLECAPS) ) ); - - FreeResource(); - - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - - aNewAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDelAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aNewDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDelDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - - aAbbrevLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - aDoubleCapsLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); - aAbbrevED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - aDoubleCapsED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); - - aAbbrevED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - aDoubleCapsED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - - aNewAbbrevPB.SetAccessibleRelationMemberOf(&aAbbrevFL); - aDelAbbrevPB.SetAccessibleRelationMemberOf(&aAbbrevFL); - aNewDoublePB.SetAccessibleRelationMemberOf(&aDoubleCapsFL); - aDelDoublePB.SetAccessibleRelationMemberOf(&aDoubleCapsFL); -} - -OfaAutocorrExceptPage::~OfaAutocorrExceptPage() -{ - lcl_ClearTable(aStringsTable); - delete pCompareClass; -} - -SfxTabPage* OfaAutocorrExceptPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutocorrExceptPage(pParent, rSet); -} - -void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) -{ - if(eLang != eLastDialogLanguage) - SetLanguage(eLastDialogLanguage); - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_True); -} - -int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* ) -{ - return LEAVE_PAGE; -} - -sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - StringsArraysPtr pArrays = aStringsTable.Last(); - while(pArrays) - { - LanguageType eCurLang = (LanguageType)aStringsTable.GetCurKey(); - if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt - { - SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang); - - if(pWrdList) - { - sal_uInt16 nCount = pWrdList->Count(); - sal_uInt16 i; - for( i = nCount; i; ) - { - String* pString = pWrdList->GetObject( --i ); - //Eintrag finden u. gfs entfernen - if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString)) - pWrdList->DeleteAndDestroy( i ); - } - nCount = pArrays->aDoubleCapsStrings.Count(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) ); - if( !pWrdList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveWrdSttExceptList(eCurLang); - } - - SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang); - - if(pCplList) - { - sal_uInt16 nCount = pCplList->Count(); - sal_uInt16 i; - for( i = nCount; i; ) - { - String* pString = pCplList->GetObject( --i ); - if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString)) - pCplList->DeleteAndDestroy( i ); - } - nCount = pArrays->aAbbrevStrings.Count(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) ); - if( !pCplList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveCplSttExceptList(eCurLang); - } - } - pArrays = aStringsTable.Prev(); - } - aStringsTable.Clear(); - - SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang); - - if(pWrdList) - { - sal_uInt16 nCount = pWrdList->Count(); - sal_uInt16 i; - for( i = nCount; i; ) - { - String* pString = pWrdList->GetObject( --i ); - if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) ) - pWrdList->DeleteAndDestroy( i ); - } - nCount = aDoubleCapsLB.GetEntryCount(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) ); - if( !pWrdList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveWrdSttExceptList(eLang); - } - - SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang); - - if(pCplList) - { - sal_uInt16 nCount = pCplList->Count(); - sal_uInt16 i; - for( i = nCount; i; ) - { - String* pString = pCplList->GetObject( --i ); - if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) ) - pCplList->DeleteAndDestroy( i ); - } - nCount = aAbbrevLB.GetEntryCount(); - for( i = 0; i < nCount; ++i ) - { - String* pEntry = new String( aAbbrevLB.GetEntry( i ) ); - if( !pCplList->Insert( pEntry )) - delete pEntry; - } - pAutoCorrect->SaveCplSttExceptList(eLang); - } - if(aAutoAbbrevCB.IsChecked() != aAutoAbbrevCB.GetSavedValue()) - pAutoCorrect->SetAutoCorrFlag( SaveWordCplSttLst, aAutoAbbrevCB.IsChecked()); - if(aAutoCapsCB.IsChecked() != aAutoCapsCB.GetSavedValue()) - pAutoCorrect->SetAutoCorrFlag( SaveWordWrdSttLst, aAutoCapsCB.IsChecked()); - return sal_False; -} - -void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet) -{ - if(eLang != eSet) - { - //alte Einstellungen speichern und neu fuellen - RefillReplaceBoxes(sal_False, eLang, eSet); - eLastDialogLanguage = eSet; - delete pCompareClass; - pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ), - ::com::sun::star::i18n:: - CollatorOptions::CollatorOptions_IGNORE_CASE ); - ModifyHdl(&aAbbrevED); - ModifyHdl(&aDoubleCapsED); - } -} - -void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset, - LanguageType eOldLanguage, - LanguageType eNewLanguage) -{ - eLang = eNewLanguage; - if(bFromReset) - lcl_ClearTable(aStringsTable); - else - { - StringsArraysPtr pArrays = 0; - if(aStringsTable.IsKeyValid(eOldLanguage)) - { - pArrays = aStringsTable.Seek(sal_uLong(eOldLanguage)); - pArrays->aAbbrevStrings.DeleteAndDestroy( - 0, pArrays->aAbbrevStrings.Count()); - pArrays->aDoubleCapsStrings.DeleteAndDestroy( - 0, pArrays->aDoubleCapsStrings.Count()); - } - else - { - pArrays = new StringsArrays; - aStringsTable.Insert(sal_uLong(eOldLanguage), pArrays); - } - - sal_uInt16 i; - for(i = 0; i < aAbbrevLB.GetEntryCount(); i++) - { - pArrays->aAbbrevStrings.Insert( - new String(aAbbrevLB.GetEntry(i)), i); - - } - for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++) - { - pArrays->aDoubleCapsStrings.Insert( - new String(aDoubleCapsLB.GetEntry(i)), i); - } - } - aDoubleCapsLB.Clear(); - aAbbrevLB.Clear(); - String sTemp; - aAbbrevED.SetText(sTemp); - aDoubleCapsED.SetText(sTemp); - - if(aStringsTable.IsKeyValid(eLang)) - { - StringsArraysPtr pArrays = aStringsTable.Seek(sal_uLong(eLang)); - sal_uInt16 i; - for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ ) - { - aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i)); - } - for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ ) - { - aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i)); - } - } - else - { - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang); - const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang); - sal_uInt16 i; - for( i = 0; i < pCplList->Count(); i++ ) - { - aAbbrevLB.InsertEntry(*pCplList->GetObject(i)); - } - for( i = 0; i < pWrdList->Count(); i++ ) - { - aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i)); - } - } -} - -void OfaAutocorrExceptPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - RefillReplaceBoxes(sal_True, eLang, eLang); - aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst )); - aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst )); - aAutoAbbrevCB.SaveValue(); - aAutoCapsCB.SaveValue(); -} - -IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, PushButton*, pBtn) -{ - if((pBtn == &aNewAbbrevPB || pBtn == (PushButton*)&aAbbrevED ) - && aAbbrevED.GetText().Len()) - { - aAbbrevLB.InsertEntry(aAbbrevED.GetText()); - ModifyHdl(&aAbbrevED); - } - else if(pBtn == &aDelAbbrevPB) - { - aAbbrevLB.RemoveEntry(aAbbrevED.GetText()); - ModifyHdl(&aAbbrevED); - } - else if((pBtn == &aNewDoublePB || pBtn == (PushButton*)&aDoubleCapsED ) - && aDoubleCapsED.GetText().Len()) - { - aDoubleCapsLB.InsertEntry(aDoubleCapsED.GetText()); - ModifyHdl(&aDoubleCapsED); - } - else if(pBtn == &aDelDoublePB) - { - aDoubleCapsLB.RemoveEntry(aDoubleCapsED.GetText()); - ModifyHdl(&aDoubleCapsED); - } - return 0; -} - -IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox) -{ - if(pBox == &aAbbrevLB) - { - aAbbrevED.SetText(pBox->GetSelectEntry()); - aNewAbbrevPB.Enable(sal_False); - aDelAbbrevPB.Enable(); - } - else - { - aDoubleCapsED.SetText(pBox->GetSelectEntry()); - aNewDoublePB.Enable(sal_False); - aDelDoublePB.Enable(); - } - return 0; -} - -IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt) -{ -// sal_Bool bSame = pEdt->GetText() == ->GetSelectEntry(); - const String& sEntry = pEdt->GetText(); - sal_Bool bEntryLen = 0!= sEntry.Len(); - if(pEdt == &aAbbrevED) - { - sal_Bool bSame = lcl_FindEntry(aAbbrevLB, sEntry, *pCompareClass); - if(bSame && sEntry != aAbbrevLB.GetSelectEntry()) - pEdt->SetText(aAbbrevLB.GetSelectEntry()); - aNewAbbrevPB.Enable(!bSame && bEntryLen); - aDelAbbrevPB.Enable(bSame && bEntryLen); - } - else - { - sal_Bool bSame = lcl_FindEntry(aDoubleCapsLB, sEntry, *pCompareClass); - if(bSame && sEntry != aDoubleCapsLB.GetSelectEntry()) - pEdt->SetText(aDoubleCapsLB.GetSelectEntry()); - aNewDoublePB.Enable(!bSame && bEntryLen); - aDelDoublePB.Enable(bSame && bEntryLen); - } - return 0; -} - -void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) -{ - const KeyCode aKeyCode = rKEvt.GetKeyCode(); - const sal_uInt16 nModifier = aKeyCode.GetModifier(); - if( aKeyCode.GetCode() == KEY_RETURN ) - { - //wird bei Enter nichts getan, dann doch die Basisklasse rufen - // um den Dialog zu schliessen - if(!nModifier && !aActionLink.Call(this)) - Edit::KeyInput(rKEvt); - } - else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) - Edit::KeyInput(rKEvt); -} - -enum OfaQuoteOptions -{ - ADD_NONBRK_SPACE, - REPLACE_1ST -}; - -SvLBoxEntry* OfaQuoteTabPage::CreateEntry(String& rTxt, sal_uInt16 nCol) -{ - SvLBoxEntry* pEntry = new SvLBoxEntry; - - if ( !pCheckButtonData ) - { - pCheckButtonData = new SvLBoxButtonData( &aSwCheckLB ); - aSwCheckLB.SetCheckButtonData( pCheckButtonData ); - } - - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! - - String sEmpty; - if (nCol == CBCOL_SECOND) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - - if (nCol == CBCOL_FIRST) - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte - else - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); - - pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); - - return pEntry; -} - -OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_QUOTE ), rSet), - aCheckLB (this, CUI_RES(CLB_SETTINGS )), - m_aSwCheckLBContainer(this, CUI_RES(CLB_SETTINGS)), - aSwCheckLB(m_aSwCheckLBContainer), - sHeader1 (CUI_RES( STR_HEADER1 )), - sHeader2 (CUI_RES( STR_HEADER2 )), - sNonBrkSpace (CUI_RES( ST_NON_BREAK_SPACE )), - sOrdinal (CUI_RES( ST_ORDINAL )), - pCheckButtonData ( NULL ), - - aSingleFL (this, CUI_RES(FL_SINGLE )), - aSingleTypoCB (this, CUI_RES(CB_SGL_TYPO )), - aSglStartQuoteFT (this, CUI_RES(FT_SGL_STARTQUOTE )), - aSglStartQuotePB (this, CUI_RES(PB_SGL_STARTQUOTE )), - aSglStartExFT (this, CUI_RES(FT_SGSTEX )), - aSglEndQuoteFT (this, CUI_RES(FT_SGL_ENDQUOTE )), - aSglEndQuotePB (this, CUI_RES(PB_SGL_ENDQUOTE )), - aSglEndExFT (this, CUI_RES(FT_SGENEX )), - aSglStandardPB (this, CUI_RES(PB_SGL_STD )), - - aDoubleFL (this, CUI_RES(FL_DOUBLE )), - aTypoCB (this, CUI_RES(CB_TYPO )), - aStartQuoteFT (this, CUI_RES(FT_STARTQUOTE )), - aStartQuotePB (this, CUI_RES(PB_STARTQUOTE )), - aDblStartExFT (this, CUI_RES(FT_DBSTEX )), - aEndQuoteFT (this, CUI_RES(FT_ENDQUOTE )), - aEndQuotePB (this, CUI_RES(PB_ENDQUOTE )), - aDblEndExFT (this, CUI_RES(FT_DBECEX )), - aDblStandardPB (this, CUI_RES(PB_DBL_STD )), - - sStartQuoteDlg (CUI_RES(STR_CHANGE_START)), - sEndQuoteDlg (CUI_RES(STR_CHANGE_END)), - - sStandard(CUI_RES(ST_STANDARD)) -{ - aSglStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_STD) ) ); - aDblStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_STD) ) ); - aStartQuotePB.SetAccessibleName( String(CUI_RES(STR_PB_DBL_START) )); - aEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_END) )); - aSglStartQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_START) )); - aSglEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_END) ) ); - - FreeResource(); - - sal_Bool bShowSWOptions = sal_False; - - aCheckLB.SetHelpId( HID_OFAPAGE_QUOTE_CLB ); - aSwCheckLB.SetHelpId( HID_OFAPAGE_QUOTE_SW_CLB ); - - SFX_ITEMSET_ARG( &rSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, sal_False ); - if ( pItem && pItem->GetValue() ) - bShowSWOptions = sal_True; - - if ( bShowSWOptions ) - { - static long aStaticTabs[]= - { - 3, 0, 20, 40 - }; - - aSwCheckLB.SetStyle(aSwCheckLB.GetStyle() | WB_HSCROLL| WB_VSCROLL); - - aSwCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); - String sHeader( sHeader1 ); - sHeader += '\t'; - sHeader += sHeader2; - sHeader += '\t'; - aSwCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, - HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); - aCheckLB.Hide( sal_True ); - } - else - { - aSwCheckLB.HideTable( ); - } - - aStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aSglStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aSglEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); - aDblStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); - aSglStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); - - aSglStartQuotePB.SetAccessibleRelationLabeledBy( &aSglStartQuoteFT ); - aSglEndQuotePB.SetAccessibleRelationLabeledBy( &aSglEndQuoteFT ); - aSglStartQuotePB.SetAccessibleRelationMemberOf( &aSingleFL ); - aSglEndQuotePB.SetAccessibleRelationMemberOf( &aSingleFL ); - aStartQuotePB.SetAccessibleRelationLabeledBy( &aStartQuoteFT ); - aEndQuotePB.SetAccessibleRelationLabeledBy( &aEndQuoteFT ); - aStartQuotePB.SetAccessibleRelationMemberOf( &aDoubleFL ); - aEndQuotePB.SetAccessibleRelationMemberOf( &aDoubleFL ); - aSglStandardPB.SetAccessibleRelationMemberOf(&aSingleFL); - aDblStandardPB.SetAccessibleRelationMemberOf(&aDoubleFL); -} - -OfaQuoteTabPage::~OfaQuoteTabPage() -{ - delete( pCheckButtonData ); -} - -SfxTabPage* OfaQuoteTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new OfaQuoteTabPage(pParent, rAttrSet); -} - -sal_Bool OfaQuoteTabPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - - long nFlags = pAutoCorrect->GetFlags(); - - if ( aCheckLB.IsVisible( ) ) - { - sal_uInt16 nPos = 0; - pAutoCorrect->SetAutoCorrFlag(AddNonBrkSpace, aCheckLB.IsChecked(nPos++)); - pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, aCheckLB.IsChecked(nPos++)); - } - - sal_Bool bModified = sal_False; - if ( aSwCheckLB.IsVisible( ) ) - { - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - - sal_Bool bCheck = aSwCheckLB.IsChecked(ADD_NONBRK_SPACE, CBCOL_FIRST); - bModified |= pOpt->bAddNonBrkSpace != bCheck; - pOpt->bAddNonBrkSpace = bCheck; - pAutoCorrect->SetAutoCorrFlag(AddNonBrkSpace, - aSwCheckLB.IsChecked(ADD_NONBRK_SPACE, CBCOL_SECOND)); - - bCheck = aSwCheckLB.IsChecked(REPLACE_1ST, CBCOL_FIRST); - bModified |= pOpt->bChgOrdinalNumber != bCheck; - pOpt->bChgOrdinalNumber = bCheck; - pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, - aSwCheckLB.IsChecked(REPLACE_1ST, CBCOL_SECOND)); - } - - pAutoCorrect->SetAutoCorrFlag(ChgQuotes, aTypoCB.IsChecked()); - pAutoCorrect->SetAutoCorrFlag(ChgSglQuotes, aSingleTypoCB.IsChecked()); - sal_Bool bReturn = nFlags != pAutoCorrect->GetFlags(); - if(cStartQuote != pAutoCorrect->GetStartDoubleQuote()) - { - bReturn = sal_True; - sal_Unicode cUCS2 = static_cast(cStartQuote); //TODO - pAutoCorrect->SetStartDoubleQuote(cUCS2); - } - if(cEndQuote != pAutoCorrect->GetEndDoubleQuote()) - { - bReturn = sal_True; - sal_Unicode cUCS2 = static_cast(cEndQuote); //TODO - pAutoCorrect->SetEndDoubleQuote(cUCS2); - } - if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote()) - { - bReturn = sal_True; - sal_Unicode cUCS2 = static_cast(cSglStartQuote); //TODO - pAutoCorrect->SetStartSingleQuote(cUCS2); - } - if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote()) - { - bReturn = sal_True; - sal_Unicode cUCS2 = static_cast(cSglEndQuote); //TODO - pAutoCorrect->SetEndSingleQuote(cUCS2); - } - - if( bModified || bReturn ) - { - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - rCfg.SetModified(); - rCfg.Commit(); - } - return bReturn; -} - -void OfaQuoteTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); -} - -void OfaQuoteTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - const long nFlags = pAutoCorrect->GetFlags(); - - // Initialize the Sw options - if ( aSwCheckLB.IsVisible( ) ) - { - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - - aSwCheckLB.SetUpdateMode( sal_False ); - aSwCheckLB.Clear(); - - aSwCheckLB.GetModel()->Insert(CreateEntry(sNonBrkSpace, CBCOL_BOTH )); - aSwCheckLB.GetModel()->Insert(CreateEntry(sOrdinal, CBCOL_BOTH )); - - aSwCheckLB.CheckEntryPos( ADD_NONBRK_SPACE, CBCOL_FIRST, pOpt->bAddNonBrkSpace ); - aSwCheckLB.CheckEntryPos( ADD_NONBRK_SPACE, CBCOL_SECOND, 0 != (nFlags & AddNonBrkSpace) ); - aSwCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_FIRST, pOpt->bChgOrdinalNumber ); - aSwCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_SECOND, 0 != (nFlags & ChgOrdinalNumber) ); - - aSwCheckLB.SetUpdateMode( sal_True ); - } - - // Initialize the non Sw options - if ( aCheckLB.IsVisible( ) ) - { - aCheckLB.SetUpdateMode( sal_False ); - aCheckLB.Clear( ); - - aCheckLB.InsertEntry( sNonBrkSpace ); - aCheckLB.InsertEntry( sOrdinal ); - - sal_uInt16 nPos = 0; - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & AddNonBrkSpace) ); - aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgOrdinalNumber) ); - - aCheckLB.SetUpdateMode( sal_True ); - } - - // Initialize the quote stuffs - aTypoCB .Check(0 != (nFlags & ChgQuotes)); - aSingleTypoCB .Check(0 != (nFlags & ChgSglQuotes)); - aTypoCB .SaveValue(); - aSingleTypoCB .SaveValue(); - - cStartQuote = pAutoCorrect->GetStartDoubleQuote(); - cEndQuote = pAutoCorrect->GetEndDoubleQuote(); - cSglStartQuote = pAutoCorrect->GetStartSingleQuote(); - cSglEndQuote = pAutoCorrect->GetEndSingleQuote(); - - aSglStartExFT .SetText(ChangeStringExt_Impl(cSglStartQuote)); - aSglEndExFT .SetText(ChangeStringExt_Impl(cSglEndQuote)); - aDblStartExFT .SetText(ChangeStringExt_Impl(cStartQuote)); - aDblEndExFT .SetText(ChangeStringExt_Impl(cEndQuote)); -} - -#define SGL_START 0 -#define DBL_START 1 -#define SGL_END 2 -#define DBL_END 3 - - -IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn ) -{ - sal_uInt16 nMode = SGL_START; - if(pBtn == &aSglEndQuotePB) - nMode = SGL_END; - else if(pBtn == &aStartQuotePB) - nMode = DBL_START; - else if(pBtn == &aEndQuotePB) - nMode = DBL_END; - // Zeichenauswahl-Dialog starten - SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True ); - pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, - LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 )); - pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg ); - sal_UCS4 cDlg; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - LanguageType eLang = Application::GetSettings().GetLanguage(); - switch( nMode ) - { - case SGL_START: - cDlg = cSglStartQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\'', sal_True, eLang); - break; - case SGL_END: - cDlg = cSglEndQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\'', sal_False, eLang); - break; - case DBL_START: - cDlg = cStartQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\"', sal_True, eLang); - break; - case DBL_END: - cDlg = cEndQuote; - if(cDlg == 0) - cDlg = pAutoCorrect->GetQuote('\"', sal_False, eLang); - break; - default: - OSL_FAIL("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" ); - cDlg = 0; - break; - - } - pMap->SetChar( cDlg ); - pMap->DisableFontSelection(); - if(pMap->Execute() == RET_OK) - { - sal_UCS4 cNewChar = pMap->GetChar(); - switch( nMode ) - { - case SGL_START: - cSglStartQuote = cNewChar; - aSglStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case SGL_END: - cSglEndQuote = cNewChar; - aSglEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case DBL_START: - cStartQuote = cNewChar; - aDblStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - case DBL_END: - cEndQuote = cNewChar; - aDblEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); - break; - } - } - delete pMap; - - return 0; -} - -IMPL_LINK( OfaQuoteTabPage, StdQuoteHdl, PushButton*, pBtn ) -{ - if(pBtn == &aDblStandardPB) - { - cStartQuote = 0; - aDblStartExFT.SetText(ChangeStringExt_Impl(0)); - cEndQuote = 0; - aDblEndExFT.SetText(ChangeStringExt_Impl(0)); - - } - else - { - cSglStartQuote = 0; - aSglStartExFT.SetText(ChangeStringExt_Impl(0)); - cSglEndQuote = 0; - aSglEndExFT.SetText(ChangeStringExt_Impl(0)); - } - return 0; -} - -// -------------------------------------------------- - -String OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar ) -{ - if( !cChar ) - return sStandard; - - // convert codepoint value to unicode-hex string - sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' }; - aStrCodes[0] = cChar; - int nFullLen = 5; - int nHexLen = 4; - while( (cChar >> (4*nHexLen)) != 0 ) - ++nHexLen; - for( int i = nHexLen; --i >= 0;) - { - sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0'; - if( cHexDigit > '9' ) - cHexDigit += 'A' - ('9' + 1); - aStrCodes[ nFullLen++ ] = cHexDigit; - } - aStrCodes[ nFullLen++ ] = ')'; - // using the new UCS4 constructor - rtl::OUString aOUStr( aStrCodes, nFullLen ); - return aOUStr; -} - -OfaAutoCompleteTabPage::OfaAutoCompleteTabPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ), rSet), - aCBActiv (this, CUI_RES(CB_ACTIV)), - aCBAppendSpace (this, CUI_RES(CB_APPEND_SPACE)), - aCBAsTip (this, CUI_RES(CB_AS_TIP)), - aCBCollect (this, CUI_RES(CB_COLLECT)), - aCBRemoveList (this, CUI_RES(CB_REMOVE_LIST)), - aFTExpandKey (this, CUI_RES(FT_EXPAND_KEY)), - aDCBExpandKey (this, CUI_RES(DCB_EXPAND_KEY)), - aFTMinWordlen (this, CUI_RES(FT_MIN_WORDLEN)), - aNFMinWordlen (this, CUI_RES(NF_MIN_WORDLEN)), - aFTMaxEntries (this, CUI_RES(FT_MAX_ENTRIES)), - aNFMaxEntries (this, CUI_RES(NF_MAX_ENTRIES)), - aLBEntries (*this, CUI_RES(LB_ENTRIES)), - aPBEntries (this, CUI_RES(PB_ENTRIES)), - pAutoCmpltList( 0 ), - nAutoCmpltListCnt( 0 ) -{ - FreeResource(); - - // the defined KEYs - static const sal_uInt16 aKeyCodes[] = { - KEY_END, - KEY_RETURN, - KEY_SPACE, - KEY_RIGHT, - KEY_TAB, - 0 - }; - - for( const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys ) - { - KeyCode aKCode( *pKeys ); - sal_uInt16 nPos = aDCBExpandKey.InsertEntry( aKCode.GetName() ); - aDCBExpandKey.SetEntryData( nPos, (void*)(sal_uLong)*pKeys ); - if( KEY_RETURN == *pKeys ) // default to RETURN - aDCBExpandKey.SelectEntryPos( nPos ); - } - - aPBEntries.SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl)); - aCBActiv.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); - aCBCollect.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); - aLBEntries.SetAccessibleRelationLabeledBy(&aLBEntries); -} - -OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage() -{ -} - -SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new OfaAutoCompleteTabPage( pParent, rSet ); -} - -sal_Bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& ) -{ - sal_Bool bModified = sal_False, bCheck; - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - sal_uInt16 nVal; - - bCheck = aCBActiv.IsChecked(); - bModified |= pOpt->bAutoCompleteWords != bCheck; - pOpt->bAutoCompleteWords = bCheck; - bCheck = aCBCollect.IsChecked(); - bModified |= pOpt->bAutoCmpltCollectWords != bCheck; - pOpt->bAutoCmpltCollectWords = bCheck; - bCheck = !aCBRemoveList.IsChecked(); // inverted value! - bModified |= pOpt->bAutoCmpltKeepList != bCheck; - pOpt->bAutoCmpltKeepList = bCheck; - bCheck = aCBAppendSpace.IsChecked(); - bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck; - pOpt->bAutoCmpltAppendBlanc = bCheck; - bCheck = aCBAsTip.IsChecked(); - bModified |= pOpt->bAutoCmpltShowAsTip != bCheck; - pOpt->bAutoCmpltShowAsTip = bCheck; - - nVal = (sal_uInt16)aNFMinWordlen.GetValue(); - bModified |= nVal != pOpt->nAutoCmpltWordLen; - pOpt->nAutoCmpltWordLen = nVal; - - nVal = (sal_uInt16)aNFMaxEntries.GetValue(); - bModified |= nVal != pOpt->nAutoCmpltListLen; - pOpt->nAutoCmpltListLen = nVal; - - nVal = aDCBExpandKey.GetSelectEntryPos(); - if( nVal < aDCBExpandKey.GetEntryCount() ) - { - sal_uLong nKey = (sal_uLong)aDCBExpandKey.GetEntryData( nVal ); - bModified |= nKey != pOpt->nAutoCmpltExpandKey; - pOpt->nAutoCmpltExpandKey = (sal_uInt16)nKey; - } - - if( pAutoCmpltList && nAutoCmpltListCnt != aLBEntries.GetEntryCount() ) - { - bModified = sal_True; - pOpt->pAutoCmpltList = pAutoCmpltList; - } - if( bModified ) - { - SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); - rCfg.SetModified(); - rCfg.Commit(); - } - return sal_True; -} - -void OfaAutoCompleteTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - - aCBActiv.Check( 0 != pOpt->bAutoCompleteWords ); - aCBCollect.Check( 0 != pOpt->bAutoCmpltCollectWords ); - aCBRemoveList.Check( !pOpt->bAutoCmpltKeepList ); //inverted value! - aCBAppendSpace.Check( 0 != pOpt->bAutoCmpltAppendBlanc ); - aCBAsTip.Check( 0 != pOpt->bAutoCmpltShowAsTip ); - - aNFMinWordlen.SetValue( pOpt->nAutoCmpltWordLen ); - aNFMaxEntries.SetValue( pOpt->nAutoCmpltListLen ); - - // select the specific KeyCode: - { - sal_uLong nKey = pOpt->nAutoCmpltExpandKey; - for( sal_uInt16 n = 0, nCnt = aDCBExpandKey.GetEntryCount(); n < nCnt; ++n ) - if( nKey == (sal_uLong)aDCBExpandKey.GetEntryData( n )) - { - aDCBExpandKey.SelectEntryPos( n ); - break; - } - } - - if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() ) - { - pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList; - pOpt->pAutoCmpltList = 0; - nAutoCmpltListCnt = pAutoCmpltList->Count(); - for( sal_uInt16 n = 0; n < nAutoCmpltListCnt; ++n ) - { - const StringPtr pStr = pAutoCmpltList->GetObject( n ); - sal_uInt16 nPos = aLBEntries.InsertEntry( *pStr ); - aLBEntries.SetEntryData( nPos, (void*)pStr ); - } - } - else - { - aLBEntries.Disable(); - aPBEntries.Disable(); - } - - CheckHdl( &aCBActiv ); - CheckHdl( &aCBCollect ); -} - -void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( sal_False ); -} - -IMPL_LINK( OfaAutoCompleteTabPage, DeleteHdl, PushButton*, EMPTYARG ) -{ - sal_uInt16 nSelCnt = pAutoCmpltList ? aLBEntries.GetSelectEntryCount() : 0; - while( nSelCnt ) - { - sal_uInt16 nPos = aLBEntries.GetSelectEntryPos( --nSelCnt ); - const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos ); - aLBEntries.RemoveEntry( nPos ); - nPos = pAutoCmpltList->GetPos( pStr ); - if( USHRT_MAX != nPos ) - pAutoCmpltList->Remove( nPos ); - } - return 0; -} - -IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox*, pBox ) -{ - sal_Bool bEnable = pBox->IsChecked(); - if( pBox == &aCBActiv ) - { - aCBAppendSpace.Enable( bEnable ); - aCBAppendSpace.Enable( bEnable ); - aCBAsTip.Enable( bEnable ); - aDCBExpandKey.Enable( bEnable ); - } - else if(&aCBCollect == pBox) - aCBRemoveList.Enable( bEnable ); - return 0; -} - -void OfaAutoCompleteTabPage::CopyToClipboard() const -{ - sal_uInt16 nSelCnt = aLBEntries.GetSelectEntryCount(); - if( pAutoCmpltList && nSelCnt ) - { - TransferDataContainer* pCntnr = new TransferDataContainer; - ::com::sun::star::uno::Reference< - ::com::sun::star::datatransfer::XTransferable > xRef( pCntnr ); - - ByteString sData; - const sal_Char* pLineEnd = -#if defined(UNX) - "\012"; -#else - "\015\012"; -#endif - - rtl_TextEncoding nEncode = gsl_getSystemTextEncoding(); - - for( sal_uInt16 n = 0; n < nSelCnt; ++n ) - { - sData += ByteString( aLBEntries.GetSelectEntry( n ), nEncode ); - sData += pLineEnd; - } - pCntnr->CopyByteString( SOT_FORMAT_STRING, sData ); - pCntnr->CopyToClipboard( (Window*)this ); - } -} - -long OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify( - NotifyEvent& rNEvt ) -{ - long nHandled = MultiListBox::PreNotify( rNEvt ); - - if( !nHandled && EVENT_KEYUP == rNEvt.GetType() ) - { - const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) - { - case KEY_DELETE: - rPage.DeleteHdl( 0 ); - nHandled = 1; - break; - - default: - if( KEYFUNC_COPY == rKeyCode.GetFunction() ) - { - rPage.CopyToClipboard(); - nHandled = 1; - } - break; - } - } - return nHandled; -} - -// class OfaSmartTagOptionsTabPage --------------------------------------------- - -OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent, - const SfxItemSet& rSet ) - : SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_SMARTTAG_OPTIONS ), rSet), - m_aMainCB( this, CUI_RES(CB_SMARTTAGS) ), - m_aSmartTagTypesLB( this, CUI_RES(LB_SMARTTAGS) ), - m_aPropertiesPB( this, CUI_RES(PB_SMARTTAGS) ), - m_aTitleFT( this, CUI_RES(FT_SMARTTAGS) ) -{ - FreeResource(); - - // some options for the list box: - m_aSmartTagTypesLB.SetStyle( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); - m_aSmartTagTypesLB.SetHighlightRange(); - - // set the handlers: - m_aMainCB.SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl)); - m_aPropertiesPB.SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl)); - m_aSmartTagTypesLB.SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl)); -} - -OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage() -{ - -} - -SfxTabPage* OfaSmartTagOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet) -{ - return new OfaSmartTagOptionsTabPage( pParent, rSet ); -} - -/** This struct is used to associate list box entries with smart tag data -*/ -struct ImplSmartTagLBUserData -{ - rtl::OUString maSmartTagType; - uno::Reference< smarttags::XSmartTagRecognizer > mxRec; - sal_Int32 mnSmartTagIdx; - - ImplSmartTagLBUserData( const rtl::OUString& rSmartTagType, - uno::Reference< smarttags::XSmartTagRecognizer > xRec, - sal_Int32 nSmartTagIdx ) : - maSmartTagType( rSmartTagType ), - mxRec( xRec ), - mnSmartTagIdx( nSmartTagIdx ) {} -}; - -/** Clears m_aSmartTagTypesLB -*/ -void OfaSmartTagOptionsTabPage::ClearListBox() -{ - const sal_uLong nCount = m_aSmartTagTypesLB.GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - delete pUserData; - } - - m_aSmartTagTypesLB.Clear(); -} - -/** Inserts items into m_aSmartTagTypesLB -*/ -void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr ) -{ - // first we have to clear the list box: - ClearListBox(); - - // fill list box: - const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers(); - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - std::vector< ActionReference > aActionReferences; - - for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i ) - { - uno::Reference< smarttags::XSmartTagRecognizer > xRec = rSmartTagMgr.GetRecognizer(i); - - const rtl::OUString aName = xRec->getName( aLocale ); - const rtl::OUString aDesc = xRec->getDescription( aLocale ); - const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount(); - - for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j ) - { - const rtl::OUString aSmartTagType = xRec->getSmartTagName(j); - rtl::OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale ); - - if ( !aSmartTagCaption.getLength() ) - aSmartTagCaption = aSmartTagType; - - const rtl::OUString aLBEntry = aSmartTagCaption + - OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + - aName + - OUString(RTL_CONSTASCII_USTRINGPARAM(")")); - - SvLBoxEntry* pEntry = m_aSmartTagTypesLB.SvTreeListBox::InsertEntry( aLBEntry ); - if ( pEntry ) - { - const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType ); - m_aSmartTagTypesLB.SetCheckButtonState( pEntry, bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); - pEntry->SetUserData(static_cast(new ImplSmartTagLBUserData( aSmartTagType, xRec, j ) ) ); - } - } - } -} - -/** Handler for the push button -*/ -IMPL_LINK( OfaSmartTagOptionsTabPage, ClickHdl, PushButton*, EMPTYARG ) -{ - const sal_uInt16 nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; - const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; - - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) - xRec->displayPropertyPage( nSmartTagIdx, aLocale ); - - return 0; -} - -/** Handler for the check box -*/ -IMPL_LINK( OfaSmartTagOptionsTabPage, CheckHdl, CheckBox*, EMPTYARG ) -{ - const sal_Bool bEnable = m_aMainCB.IsChecked(); - m_aSmartTagTypesLB.Enable( bEnable ); - m_aSmartTagTypesLB.Invalidate(); - m_aPropertiesPB.Enable( false ); - - // if the controls are currently enabled, we still have to check - // if the properties button should be disabled because the currently - // seleted smart tag type does not have a properties dialog. - // We do this by calling SelectHdl: - if ( bEnable ) - SelectHdl( &m_aSmartTagTypesLB ); - - return 0; -} - -/** Handler for the list box -*/ -IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG) -{ - if ( m_aSmartTagTypesLB.GetEntryCount() < 1 ) - return 0; - - const sal_uInt16 nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; - const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; - - const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); - if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) - m_aPropertiesPB.Enable( sal_True ); - else - m_aPropertiesPB.Enable( sal_False ); - - return 0; -} - -/** Propagates the current settings to the smart tag manager. -*/ -sal_Bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; - - // robust! - if ( !pSmartTagMgr ) - return sal_False; - - sal_Bool bModifiedSmartTagTypes = sal_False; - std::vector< rtl::OUString > aDisabledSmartTagTypes; - - const sal_uLong nCount = m_aSmartTagTypesLB.GetEntryCount(); - - for ( sal_uInt16 i = 0; i < nCount; ++i ) - { - const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); - const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); - const sal_Bool bChecked = m_aSmartTagTypesLB.IsChecked(i); - const sal_Bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType ); - - bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled ); - - if ( !bChecked ) - aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType ); - - delete pUserData; - } - - const sal_Bool bModifiedRecognize = ( !m_aMainCB.IsChecked() != !pSmartTagMgr->IsLabelTextWithSmartTags() ); - if ( bModifiedSmartTagTypes || bModifiedRecognize ) - { - bool bLabelTextWithSmartTags = m_aMainCB.IsChecked() ? true : false; - pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : 0, - bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : 0 ); - } - - return sal_True; -} - -/** Sets the controls based on the current settings at SmartTagMgr. -*/ -void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& ) -{ - SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); - SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); - const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; - - // robust, should not happen! - if ( !pSmartTagMgr ) - return; - - FillListBox( *pSmartTagMgr ); - m_aSmartTagTypesLB.SelectEntryPos( 0 ); - m_aMainCB.Check( pSmartTagMgr->IsLabelTextWithSmartTags() ); - CheckHdl( &m_aMainCB ); -} - -void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& ) -{ - ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( sal_False ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/autocdlg.hrc b/cui/source/tabpages/autocdlg.hrc deleted file mode 100644 index d58f65b1a..000000000 --- a/cui/source/tabpages/autocdlg.hrc +++ /dev/null @@ -1,172 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_AUTOCDLG_HRC -#define _SVX_AUTOCDLG_HRC - -#include - -// defines ------------------------------------------------------------------ - -#define CLB_SETTINGS 1 -/* -#define STR_DOUBLECAPS 3 -#define STR_STARTCAPS 4 -#define STR_FIRST 5 -#define STR_HALF 6 -#define STR_DASH 7 -#define STR_BOLDUNDERLINE 8 -#define STR_URL 9 -*/ - -#define CB_TYPO 11 -#define FT_STARTQUOTE 12 -#define PB_STARTQUOTE 13 -#define FT_ENDQUOTE 14 -#define PB_ENDQUOTE 15 - -#define FL_ABBREV 16 -#define ED_ABBREV 17 -#define LB_ABBREV 18 -#define PB_NEWABBREV 19 -#define PB_DELABBREV 20 -#define FL_DOUBLECAPS 21 -#define ED_DOUBLE_CAPS 22 -#define LB_DOUBLE_CAPS 23 -#define PB_NEWDOUBLECAPS 24 -#define PB_DELDOUBLECAPS 25 - -#define ED_SHORT 31 -#define ED_REPLACE 32 -#define TLB_REPLACE 33 -#define CB_TEXT_ONLY 34 -#define PB_NEW_REPLACE 35 -#define PB_DELETE_REPLACE 36 -#define STR_MODIFY 37 -#define STR_CLOSE_AUTOCORR 38 -#define FT_SHORT 39 -#define FT_REPLACE 40 -#define STR_CHANGE_START 41 -#define STR_CHANGE_END 42 -#define CB_AUTOABBREV 43 -#define CB_AUTOCAPS 44 - -#define FT_SGL_STARTQUOTE 45 -#define PB_SGL_STARTQUOTE 46 -#define FT_SGL_ENDQUOTE 47 -#define PB_SGL_ENDQUOTE 48 -#define PB_SGL_STD 49 -#define PB_DBL_STD 50 -#define FL_SINGLE 51 -#define FL_DOUBLE 52 -#define FT_SGSTEX 53 -#define FT_SGENEX 54 -#define FT_DBSTEX 55 -#define FT_DBECEX 56 -#define CB_SGL_TYPO 57 -#define ST_STANDARD 58 - -#define PB_EDIT 61 -#define ST_DEL_EMPTY_PARA 62 -#define ST_TYPO 66 -#define ST_USER_STYLE 67 -#define ST_BULLET 68 -#define STR_DEL_SPACES_AT_STT_END 69 -#define STR_DEL_SPACES_BETWEEN_LINES 70 - -#define ST_RIGHT_MARGIN 74 -#define STR_NUM 75 -#define STR_BORDER 76 -#define STR_TABLE 77 -#define STR_REPLACE_TEMPLATES 78 -#define FL_PRCNT 79 - -#define STR_HEADER 90 -#define FT_HEADER_EXPLANATION 91 -#define STR_HEADER1 92 -#define STR_HEADER2 93 -#define FT_HEADER1_EXPLANATION 94 -#define FT_HEADER2_EXPLANATION 95 - -#define ED_RIGHT_MARGIN 100 -#define BT_OK 101 -#define BT_CANCEL 102 - -#define BT_AWCP_OK 110 -#define BT_AWCP_CANCEL 111 -#define GB_AWCP_VALUE 112 -#define ED_AWCP_WORD_LEN 113 -#define ED_AWCP_LIST_LEN 114 -#define FT_AWCP_WORD_LEN 115 -#define FT_AWCP_LIST_LEN 116 - -#define CB_ACTIV 121 -#define CB_COLLECT 122 -#define CB_APPEND_SPACE 123 -#define CB_REMOVE_LIST 124 -#define CB_AS_TIP 125 -#define FT_MIN_WORDLEN 126 -#define FT_MAX_ENTRIES 127 -#define NF_MIN_WORDLEN 128 -#define NF_MAX_ENTRIES 129 -#define FT_EXPAND_KEY 130 -#define DCB_EXPAND_KEY 131 -#define LB_ENTRIES 132 -#define PB_ENTRIES 133 - - -#define ST_USE_REPLACE 200 -#define ST_CPTL_STT_WORD 201 -#define ST_CPTL_STT_SENT 202 -#define ST_BOLD_UNDER 203 -#define STR_NO_DBL_SPACES 204 -#define ST_DETECT_URL 205 -#define ST_ORDINAL 206 -#define ST_NON_BREAK_SPACE 207 -#define ST_DASH 208 -#define FT_LANG 209 -#define LB_LANG 210 -#define ST_CORRECT_ACCIDENTAL_CAPS_LOCK 211 - -#define CB_SMARTTAGS 220 -#define FT_SMARTTAGS 221 -#define LB_SMARTTAGS 222 -#define PB_SMARTTAGS 223 -//IAccessibility2 Implementation 2009----- -#define STR_PB_NEWABBREV 224 -#define STR_PB_DELABBREV 225 -#define STR_PB_NEWDOUBLECAPS 226 -#define STR_PB_DELDOUBLECAPS 227 -#define STR_PB_SGL_STD 228 -#define STR_PB_DBL_STD 229 -#define STR_PB_SGL_START 230 -#define STR_PB_DBL_START 231 -#define STR_PB_SGL_END 232 -#define STR_PB_DBL_END 233 -//-----IAccessibility2 Implementation 2009 - -#endif - diff --git a/cui/source/tabpages/autocdlg.src b/cui/source/tabpages/autocdlg.src deleted file mode 100644 index 3076af0e8..000000000 --- a/cui/source/tabpages/autocdlg.src +++ /dev/null @@ -1,941 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include "autocdlg.hrc" -#include -#include "helpid.hrc" -#include // SID_AUTOFORMAT - - // pragma ------------------------------------------------------------------- -/**************************************************************************/ -/* */ -/* TabDialog RID_OFA_AUTOCORR_DLG */ -/* */ -/**************************************************************************/ -TabDialog RID_OFA_AUTOCORR_DLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "AutoCorrect" ; - Moveable = TRUE ; - TabControl 1 - { - SVLook = TRUE ; - PageList = - { - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_REPLACE ; - Text [ en-US ] = "Replace" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_EXCEPT ; - Text [ en-US ] = "Exceptions" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_OPTIONS ; - Text [ en-US ] = "Options" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOFMT_APPLY ; - Text [ en-US ] = "Options" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCORR_QUOTE ; - Text [ en-US ] = "Localized Options" ; - }; - PageItem - { - Identifier = RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; - Text [ en-US ] = "Word Completion"; - }; - PageItem - { - Identifier = RID_OFAPAGE_SMARTTAG_OPTIONS ; - Text [ en-US ] = "Smart Tags"; - }; - }; - }; - FixedText FT_LANG - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 140 , 8 ) ; - - Left = TRUE ; - Text [ en-US ] = "Replacements and exceptions for language:"; - }; - ListBox LB_LANG - { - Pos = MAP_APPFONT ( 150 , 3 ) ; - Size = MAP_APPFONT ( 60 , 100 ) ; - DropDown = TRUE; - TabStop = TRUE ; - Border = TRUE ; - }; -}; -#define COMMON_CLB_ENTRIES \ - String ST_USE_REPLACE \ - { \ - Text [ en-US ] = "Use replacement table" ; \ - }; \ - String ST_CPTL_STT_WORD \ - { \ - Text [ en-US ] = "Correct TWo INitial CApitals" ; \ - }; \ - String ST_CPTL_STT_SENT \ - { \ - Text [ en-US ] = "Capitalize first letter of every sentence" ; \ - }; \ - String ST_BOLD_UNDER \ - { \ - Text [ en-US ] = "Automatic *bold* and _underline_" ; \ - }; \ - String STR_NO_DBL_SPACES \ - { \ - Text [ en-US ] = "Ignore double spaces" ; \ - }; \ - String ST_DETECT_URL \ - { \ - Text [ en-US ] = "URL Recognition" ; \ - }; \ - String ST_DASH \ - { \ - Text [ en-US ] = "Replace dashes" ; \ - }; \ - String ST_CORRECT_ACCIDENTAL_CAPS_LOCK \ - { \ - Text [ en-US ] = "Correct accidental use of cAPS LOCK key" ; \ - }; - -/**************************************************************************/ -/* */ -/* Beschreibung: Autokorrektur-Optionen */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_OPTIONS -{ - HelpId = HID_OFAPAGE_AUTOCORR_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Settings" ; - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 173 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - COMMON_CLB_ENTRIES -}; -/**************************************************************************/ -/* */ -/* */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOFMT_APPLY -{ - HelpID = HID_OFAPAGE_AUTOFMT_OPTIONS ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 248 , 149 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_EDIT - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOFMT_APPLY:PB_EDIT"; - Pos = MAP_APPFONT ( 6 , 162 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Edit..." ; - TabStop = TRUE ; - }; - String STR_HEADER1 - { - Text [ en-US ] = "[M]" ; - }; - String STR_HEADER2 - { - Text [ en-US ] = "[T]" ; - }; - FixedText FT_HEADER1_EXPLANATION - { - Pos = MAP_APPFONT ( 80 , 159 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "[M]: Replace while modifying existing text" ; - }; - FixedText FT_HEADER2_EXPLANATION - { - Pos = MAP_APPFONT ( 80 , 171 ) ; - Size = MAP_APPFONT ( 174 , 8 ) ; - Text [ en-US ] = "[T]: AutoFormat/AutoCorrect while typing" ; - }; - COMMON_CLB_ENTRIES - String ST_DEL_EMPTY_PARA - { - Text [ en-US ] = "Remove blank paragraphs" ; - }; - String ST_USER_STYLE - { - Text [ en-US ] = "Replace Custom Styles" ; - }; - String ST_BULLET - { - Text [ en-US ] = "Replace bullets with: " ; - }; - String ST_RIGHT_MARGIN - { - // Text [ norwegian_wrong ] = "+++Combine single line paragraphs at" ; - // Text [ swedish_wrong ] = ~Kombinera enradiga stycken B738vid " ; - Text [ en-US ] = "Combine single line paragraphs if length greater than" ; - }; - String STR_NUM - { - Text [ en-US ] = "Apply numbering - symbol: " ; - }; - String STR_BORDER - { - Text [ en-US ] = "Apply border" ; - }; - String STR_TABLE - { - Text [ en-US ] = "Create table" ; - }; - String STR_REPLACE_TEMPLATES - { - Text [ en-US ] = "Apply Styles" ; - }; - String STR_DEL_SPACES_AT_STT_END - { - Text [ en-US ] = "Delete spaces and tabs at beginning and end of paragraph"; - }; - String STR_DEL_SPACES_BETWEEN_LINES - { - Text [ en-US ] = "Delete spaces and tabs at end and start of line"; - }; -}; - -ModalDialog RID_OFADLG_PRCNT_SET -{ - HelpID = CMD_SID_AUTOFORMAT ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 155 , 43 ) ; - Moveable = TRUE ; - FixedLine FL_PRCNT - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 87 , 8 ) ; - Text [ en-US ] = "Minimum size" ; - }; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 99 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 99 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - MetricField ED_RIGHT_MARGIN - { - HelpID = "cui:MetricField:RID_OFADLG_PRCNT_SET:ED_RIGHT_MARGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 7 , 14 ) ; - Size = MAP_APPFONT ( 31 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Value = 77 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 10 ; - Last = 100 ; - SpinSize = 5 ; - }; - Text [ en-US ] = "Combine" ; -}; - -/**************************************************************************/ -/* */ -/* Beschreibung: Ersetzungstabelle */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_REPLACE -{ - HelpId = HID_OFAPAGE_AUTOCORR_REPLACE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedText FT_SHORT - { - Pos = MAP_APPFONT ( 7 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Repla~ce" ; - Left = TRUE ; - }; - Edit ED_SHORT - { - HelpID = "cui:Edit:RID_OFAPAGE_AUTOCORR_REPLACE:ED_SHORT"; - Pos = MAP_APPFONT ( 7 , 13 ) ; - Size = MAP_APPFONT ( 60 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_REPLACE - { - Pos = MAP_APPFONT ( 71 , 3 ) ; - Size = MAP_APPFONT ( 64 , 8 ) ; - Text [ en-US ] = "~With:" ; - Left = TRUE ; - }; - Edit ED_REPLACE - { - HelpID = "cui:Edit:RID_OFAPAGE_AUTOCORR_REPLACE:ED_REPLACE"; - Pos = MAP_APPFONT ( 71 , 13 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - CheckBox CB_TEXT_ONLY - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCORR_REPLACE:CB_TEXT_ONLY"; - Pos = MAP_APPFONT ( 140 , 3 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Text only" ; - }; - PushButton PB_NEW_REPLACE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_REPLACE:PB_NEW_REPLACE"; - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~New" ; - }; - PushButton PB_DELETE_REPLACE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_REPLACE:PB_DELETE_REPLACE"; - Pos = MAP_APPFONT ( 198 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - Control TLB_REPLACE - { - HelpId = HID_OFACTL_AUTOCORR_REPLACE ; - Pos = MAP_APPFONT ( 7 , 29 ) ; - Size = MAP_APPFONT ( 187 , 150 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - String STR_MODIFY - { - Text [ en-US ] = "~Replace" ; - }; -}; -/**************************************************************************/ -/* */ -/* Beschreibung: Ausnahmelisten */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_EXCEPT -{ - HelpId = HID_OFAPAGE_AUTOCORR_EXCEPT ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - FixedLine FL_ABBREV - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Abbreviations (no subsequent capital)" ; - }; - Edit ED_ABBREV - { - HelpID = "cui:Edit:RID_OFAPAGE_AUTOCORR_EXCEPT:ED_ABBREV"; - Pos = MAP_APPFONT ( 7 , 14 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - ListBox LB_ABBREV - { - HelpID = "cui:ListBox:RID_OFAPAGE_AUTOCORR_EXCEPT:LB_ABBREV"; - Pos = MAP_APPFONT ( 7 , 30 ) ; - Size = MAP_APPFONT ( 123 , 58 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - Border = TRUE ; - }; - PushButton PB_NEWABBREV - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_EXCEPT:PB_NEWABBREV"; - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Text [ en-US ] = "~New" ; - }; - PushButton PB_DELABBREV - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_EXCEPT:PB_DELABBREV"; - Pos = MAP_APPFONT ( 198 , 31 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Disable = TRUE ; - Text [ en-US ] = "~Delete" ; - }; - CheckBox CB_AUTOABBREV - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCORR_EXCEPT:CB_AUTOABBREV"; - Pos = MAP_APPFONT ( 137 , 78 ) ; - Size = MAP_APPFONT ( 111 , 10 ) ; - Text [ en-US ] = "~AutoInclude"; - TabStop = TRUE ; - }; - FixedLine FL_DOUBLECAPS - { - Pos = MAP_APPFONT ( 4 , 94 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Words with TWo INitial CApitals" ; - }; - Edit ED_DOUBLE_CAPS - { - HelpID = "cui:Edit:RID_OFAPAGE_AUTOCORR_EXCEPT:ED_DOUBLE_CAPS"; - Pos = MAP_APPFONT ( 7 , 105 ) ; - Size = MAP_APPFONT ( 123 , 12 ) ; - TabStop = TRUE ; - Border = TRUE ; - }; - ListBox LB_DOUBLE_CAPS - { - HelpID = "cui:ListBox:RID_OFAPAGE_AUTOCORR_EXCEPT:LB_DOUBLE_CAPS"; - Pos = MAP_APPFONT ( 7 , 120 ) ; - Size = MAP_APPFONT ( 123 , 59 ) ; - TabStop = TRUE ; - AutoHScroll = TRUE ; - SORT = TRUE ; - Border = TRUE ; - }; - PushButton PB_NEWDOUBLECAPS - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_EXCEPT:PB_NEWDOUBLECAPS"; - Pos = MAP_APPFONT ( 198 , 105 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "Ne~w" ; - }; - PushButton PB_DELDOUBLECAPS - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_EXCEPT:PB_DELDOUBLECAPS"; - Pos = MAP_APPFONT ( 198 , 122 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Disable = TRUE ; - Text [ en-US ] = "Dele~te" ; - }; - CheckBox CB_AUTOCAPS - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCORR_EXCEPT:CB_AUTOCAPS"; - Pos = MAP_APPFONT ( 137 , 169 ) ; - Size = MAP_APPFONT ( 111 , 10 ) ; - Text [ en-US ] = "A~utoInclude"; - }; - String STR_PB_NEWABBREV - { - Text [ en-US ] = "New abbreviations" ; - }; - String STR_PB_DELABBREV - { - Text [ en-US ] = "Delete abbreviations" ; - }; - String STR_PB_NEWDOUBLECAPS - { - Text [ en-US ] = "New words with two initial capitals" ; - }; - String STR_PB_DELDOUBLECAPS - { - Text [ en-US ] = "Delete words with two initial capitals" ; - }; - String STR_PB_SGL_STD - { - Text [ en-US ] = "Single quotes default" ; - }; - String STR_PB_DBL_STD - { - Text [ en-US ] = "Double quotes default" ; - }; - String STR_PB_SGL_START - { - Text [ en-US ] = "Start quote of single quotes" ; - }; - String STR_PB_DBL_START - { - Text [ en-US ] = "Start quote of double quotes" ; - }; - String STR_PB_SGL_END - { - Text [ en-US ] = "End quote of single quotes" ; - }; - String STR_PB_DBL_END - { - Text [ en-US ] = "End quote of double quotes" ; - }; -}; -/**************************************************************************/ -/* */ -/* Beschreibung: Typografische Anfuehrungszeichen */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCORR_QUOTE -{ - HelpId = HID_OFAPAGE_AUTOCORR_QUOTE ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Localized Options" ; - Control CLB_SETTINGS - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( 252 , 85 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - String STR_HEADER1 - { - Text [ en-US ] = "[M]" ; - }; - String STR_HEADER2 - { - Text [ en-US ] = "[T]" ; - }; - String ST_NON_BREAK_SPACE - { - Text [ en-US ] = "Add non breaking space before specific punctuation marks in french text" ; - }; - String ST_ORDINAL - { - Text [ en-US ] = "Format ordinal numbers suffixes (1st -> 1^st)" ; - }; - FixedLine FL_SINGLE - { - Pos = MAP_APPFONT ( 4 , 90 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Single quotes" ; - }; - CheckBox CB_SGL_TYPO - { - HelpId = "cui:CheckBox:RID_OFAPAGE_AUTOCORR_QUOTE:CB_SGL_TYPO"; - Pos = MAP_APPFONT ( 7 , 101 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "Repla~ce" ; - }; - FixedText FT_SGL_STARTQUOTE - { - Pos = MAP_APPFONT ( 7 , 114 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "~Start quote:" ; - }; - PushButton PB_SGL_STARTQUOTE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_SGL_STARTQUOTE"; - Pos = MAP_APPFONT ( 10 , 125 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\'" ; - TabStop = TRUE ; - }; - FixedText FT_SGSTEX - { - Pos = MAP_APPFONT ( 26 , 127 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - FixedText FT_SGL_ENDQUOTE - { - Pos = MAP_APPFONT ( 7 , 139 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "~End quote:" ; - }; - PushButton PB_SGL_ENDQUOTE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_SGL_ENDQUOTE"; - Pos = MAP_APPFONT ( 10 , 151 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\'" ; - TabStop = TRUE ; - }; - FixedText FT_SGENEX - { - Pos = MAP_APPFONT ( 26 , 153 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - PushButton PB_SGL_STD - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_SGL_STD"; - Pos = MAP_APPFONT ( 7 , 167 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Default" ; - }; - FixedLine FL_DOUBLE - { - Pos = MAP_APPFONT ( 134 , 90 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Double quotes" ; - }; - CheckBox CB_TYPO - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCORR_QUOTE:CB_TYPO"; - Pos = MAP_APPFONT ( 137 , 101 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Repl~ace" ; - }; - FixedText FT_STARTQUOTE - { - Pos = MAP_APPFONT ( 137 , 114 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "Start q~uote:" ; - }; - PushButton PB_STARTQUOTE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_STARTQUOTE"; - Pos = MAP_APPFONT ( 140 , 125 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\"" ; - TabStop = TRUE ; - }; - FixedText FT_DBSTEX - { - Pos = MAP_APPFONT ( 156 , 127 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - FixedText FT_ENDQUOTE - { - Pos = MAP_APPFONT ( 137 , 139 ) ; - Size = MAP_APPFONT ( 86 , 10 ) ; - Text [ en-US ] = "E~nd quote:" ; - }; - PushButton PB_ENDQUOTE - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_ENDQUOTE"; - Pos = MAP_APPFONT ( 140 , 151 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "\"" ; - TabStop = TRUE ; - }; - FixedText FT_DBECEX - { - Pos = MAP_APPFONT ( 156 , 153 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - }; - PushButton PB_DBL_STD - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCORR_QUOTE:PB_DBL_STD"; - Pos = MAP_APPFONT ( 137 , 167 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "De~fault" ; - }; - String STR_CHANGE_START - { - Text [ en-US ] = "Start quote" ; - }; - String STR_CHANGE_END - { - Text [ en-US ] = "End quote" ; - }; - String ST_STANDARD - { - Text [ en-US ] = "Default" ; - }; -}; - -/**************************************************************************/ -/* */ -/* Beschreibung: automatische Wortergänzung */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_AUTOCOMPLETE_OPTIONS -{ - HelpId = HID_OFAPAGE_AUTOCOMPLETE_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - CheckBox CB_ACTIV - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:CB_ACTIV"; - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "Enable word ~completion"; - }; - CheckBox CB_APPEND_SPACE - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:CB_APPEND_SPACE"; - Pos = MAP_APPFONT( 10, 17 ); - Size = MAP_APPFONT( 110, 10 ); - Text [ en-US ] = "~Append space"; - }; - CheckBox CB_AS_TIP - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:CB_AS_TIP"; - Pos = MAP_APPFONT( 10, 31 ); - Size = MAP_APPFONT( 110, 10 ); - Text [ en-US ] = "~Show as tip"; - }; - CheckBox CB_COLLECT - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:CB_COLLECT"; - Pos = MAP_APPFONT( 4, 45 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "C~ollect words"; - }; - CheckBox CB_REMOVE_LIST - { - HelpID = "cui:CheckBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:CB_REMOVE_LIST"; - Pos = MAP_APPFONT( 10, 59 ); - Size = MAP_APPFONT( 110, 40 ); - WordBreak = TRUE; - Text [ en-US ] = "~When closing a document, remove the words collected from it from the list"; - }; - FixedText FT_EXPAND_KEY - { - Pos = MAP_APPFONT( 4, 102 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Acc~ept with"; - }; - ListBox DCB_EXPAND_KEY - { - HelpID = "cui:ListBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:DCB_EXPAND_KEY"; - Pos = MAP_APPFONT( 4, 113 ); - Size = MAP_APPFONT( 116, 60 ); - TabStop = TRUE; - DropDown = TRUE; - Group = TRUE; - Sort = FALSE; - }; - FixedText FT_MIN_WORDLEN - { - Pos = MAP_APPFONT( 4, 129 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Mi~n. word length"; - }; - NumericField NF_MIN_WORDLEN - { - HelpID = "cui:NumericField:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:NF_MIN_WORDLEN"; - Border = TRUE; - Pos = MAP_APPFONT( 4, 140 ); - Size = MAP_APPFONT( 30, 12 ); - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Value = 10 ; - Minimum = 5 ; - First = 5 ; - Last = 100 ; - Maximum = 100 ; - SpinSize = 1 ; - }; - FixedText FT_MAX_ENTRIES - { - Pos = MAP_APPFONT( 4, 156 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "~Max. entries"; - }; - NumericField NF_MAX_ENTRIES - { - HelpID = "cui:NumericField:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:NF_MAX_ENTRIES"; - Border = TRUE; - Pos = MAP_APPFONT( 4, 167 ); - Size = MAP_APPFONT( 30, 12 ); - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Value = 500 ; - Maximum = 10000; - Last = 10000 ; - First = 50 ; - Minimum = 50; - SpinSize = 25 ; - }; - MultiListBox LB_ENTRIES - { - HelpID = "cui:MultiListBox:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:LB_ENTRIES"; - Pos = MAP_APPFONT( 127, 3 ); - Size = MAP_APPFONT( 121, 158 ); - TabStop = TRUE; - DropDown = FALSE; - Group = TRUE; - Border = TRUE; - Sort = TRUE; - }; - PushButton PB_ENTRIES - { - HelpID = "cui:PushButton:RID_OFAPAGE_AUTOCOMPLETE_OPTIONS:PB_ENTRIES"; - Pos = MAP_APPFONT( 127, 165 ); - Size = MAP_APPFONT( 121, 14 ); - TabStop = TRUE ; - Text [ en-US ] = "~Delete Entry"; - }; - Text [ en-US ] = "Word Completion"; -}; - - -/**************************************************************************/ -/* */ -/* Beschreibung: Smart Tag Options */ -/* */ -/**************************************************************************/ -TabPage RID_OFAPAGE_SMARTTAG_OPTIONS -{ - HelpId = HID_OFAPAGE_SMARTTAG_OPTIONS ; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - SVLook = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "Smart Tags"; - - CheckBox CB_SMARTTAGS - { - HelpID = "cui:CheckBox:RID_OFAPAGE_SMARTTAG_OPTIONS:CB_SMARTTAGS"; - Pos = MAP_APPFONT( 4, 3 ); - Size = MAP_APPFONT( 116, 10 ); - Text [ en-US ] = "Label text with smart tags"; - }; - - FixedText FT_SMARTTAGS - { - Pos = MAP_APPFONT( 12, 15 ); - Size = MAP_APPFONT( 116, 8 ); - Text [ en-US ] = "Currently installed smart tags"; - }; - - Control LB_SMARTTAGS - { - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 172 , 154 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - - PushButton PB_SMARTTAGS - { - HelpID = "cui:PushButton:RID_OFAPAGE_SMARTTAG_OPTIONS:PB_SMARTTAGS"; - Pos = MAP_APPFONT ( 188 , 25 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Properties..."; - }; - -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx deleted file mode 100644 index aa603154b..000000000 --- a/cui/source/tabpages/backgrnd.cxx +++ /dev/null @@ -1,1893 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_BACKGRND_CXX - -#include -#include "backgrnd.hrc" -#include -#include -#include -#include - -// Tabellenhintergrund -#define TBL_DEST_CELL 0 -#define TBL_DEST_ROW 1 -#define TBL_DEST_TBL 2 - -#include -#include "backgrnd.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace ::com::sun::star; -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_VIEW_FLD_PIC, SID_VIEW_FLD_PIC, - SID_ATTR_BRUSH, SID_ATTR_BRUSH, - SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, - 0 -}; - -struct SvxBackgroundTable_Impl -{ - SvxBrushItem* pCellBrush; - SvxBrushItem* pRowBrush; - SvxBrushItem* pTableBrush; - sal_uInt16 nCellWhich; - sal_uInt16 nRowWhich; - sal_uInt16 nTableWhich; - sal_uInt16 nActPos; - - SvxBackgroundTable_Impl() : - pCellBrush(NULL), pRowBrush(NULL), pTableBrush(NULL), - nCellWhich(0), nRowWhich(0), nTableWhich(0) {} -}; - -struct SvxBackgroundPara_Impl -{ - SvxBrushItem* pParaBrush; - SvxBrushItem* pCharBrush; - - sal_uInt16 nActPos; - - SvxBackgroundPara_Impl() : - pParaBrush(NULL), pCharBrush(NULL) {} -}; - -struct SvxBackgroundPage_Impl -{ - Timer* pLoadTimer; - sal_Bool bIsImportDlgInExecute; - - SvxBackgroundPage_Impl() : - pLoadTimer(NULL), bIsImportDlgInExecute(sal_False) {} -}; - -inline sal_uInt8 lcl_PercentToTransparency(long nPercent) -{ - //0xff must not be returned! - return sal_uInt8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0); -} -inline sal_uInt8 lcl_TransparencyToPercent(sal_uInt8 nTrans) -{ - return (nTrans * 100 + 127) / 254; -} -void lcl_SetTransparency(SvxBrushItem& rBrush, long nTransparency) -{ - uno::Any aTransparency; - aTransparency <<= (sal_Int8)nTransparency; - rBrush.PutValue(aTransparency, MID_GRAPHIC_TRANSPARENCY); -} -//------------------------------------------------------------------------- - -sal_uInt16 GetItemId_Impl( ValueSet& rValueSet, const Color& rCol ) -{ - sal_Bool bFound = sal_False; - sal_uInt16 nCount = rValueSet.GetItemCount(); - sal_uInt16 n = 1; - - while ( !bFound && n <= nCount ) - { - Color aValCol = rValueSet.GetItemColor(n); - - bFound = ( aValCol.GetRed() == rCol.GetRed() - && aValCol.GetGreen() == rCol.GetGreen() - && aValCol.GetBlue() == rCol.GetBlue() ); - - if ( !bFound ) - n++; - } - return bFound ? n : 0; -} - -// class BackgroundPreview ----------------------------------------------- - -/* [Beschreibung] - - Vorschaufenster f"ur Brush oder Bitmap -*/ - -class BackgroundPreviewImpl : public Window -{ -public: - BackgroundPreviewImpl( Window* pParent, - const ResId& rResId, sal_Bool bIsBmpPreview ); - ~BackgroundPreviewImpl(); - - void NotifyChange( const Color& rColor ); - void NotifyChange( const Bitmap* pBitmap ); - -protected: - virtual void Paint( const Rectangle& rRect ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - -private: - const sal_Bool bIsBmp; - Bitmap* pBitmap; - Point aDrawPos; - Size aDrawSize; - Rectangle aDrawRect; - sal_uInt8 nTransparency; -}; - -//----------------------------------------------------------------------- - -BackgroundPreviewImpl::BackgroundPreviewImpl -( - Window* pParent, - const ResId& rResId, - sal_Bool bIsBmpPreview -) : - - Window( pParent, rResId ), - - bIsBmp ( bIsBmpPreview ), - pBitmap ( NULL ), - aDrawRect( Point(0,0), GetOutputSizePixel() ), - nTransparency(0) - -{ - SetBorderStyle(WINDOW_BORDER_MONO); - Paint( aDrawRect ); -} - -//----------------------------------------------------------------------- - -BackgroundPreviewImpl::~BackgroundPreviewImpl() -{ - delete pBitmap; -} - -//----------------------------------------------------------------------- -void BackgroundPreviewImpl::NotifyChange( const Color& rColor ) -{ - if ( !bIsBmp ) - { - const static Color aTranspCol( COL_TRANSPARENT ); - - nTransparency = lcl_TransparencyToPercent( rColor.GetTransparency() ); - - SetFillColor( rColor == aTranspCol ? GetSettings().GetStyleSettings().GetFieldColor() : (Color) rColor.GetRGBColor() ); - Paint( aDrawRect ); - } -} - -//----------------------------------------------------------------------- - -void BackgroundPreviewImpl::NotifyChange( const Bitmap* pNewBitmap ) -{ - if ( bIsBmp && (pNewBitmap || pBitmap) ) - { - if ( pNewBitmap && pBitmap ) - *pBitmap = *pNewBitmap; - else if ( pNewBitmap && !pBitmap ) - pBitmap = new Bitmap( *pNewBitmap ); - else if ( !pNewBitmap ) - DELETEZ( pBitmap ); - - if ( pBitmap ) - { - Size aSize = GetOutputSizePixel(); - // InnerSize == Size without one pixel border - Size aInnerSize = aSize; - aInnerSize.Width() -= 2; - aInnerSize.Height() -= 2; - aDrawSize = pBitmap->GetSizePixel(); - - // bitmap bigger than preview window? - if ( aDrawSize.Width() > aInnerSize.Width() ) - { - aDrawSize.Height() = aDrawSize.Height() * aInnerSize.Width() / aDrawSize.Width(); - if ( aDrawSize.Height() > aInnerSize.Height() ) - { - aDrawSize.Width() = aDrawSize.Height(); - aDrawSize.Height() = aInnerSize.Height(); - } - else - aDrawSize.Width() = aInnerSize.Width(); - } - else if ( aDrawSize.Height() > aInnerSize.Height() ) - { - aDrawSize.Width() = aDrawSize.Width() * aInnerSize.Height() / aDrawSize.Height(); - if ( aDrawSize.Width() > aInnerSize.Width() ) - { - aDrawSize.Height() = aDrawSize.Width(); - aDrawSize.Width() = aInnerSize.Width(); - } - else - aDrawSize.Height() = aInnerSize.Height(); - } - - aDrawPos.X() = (aSize.Width() - aDrawSize.Width()) / 2; - aDrawPos.Y() = (aSize.Height() - aDrawSize.Height()) / 2; - } - Invalidate( aDrawRect ); - Update(); - } -} - -//----------------------------------------------------------------------- - -void BackgroundPreviewImpl::Paint( const Rectangle& ) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetBackground(Wallpaper(rStyleSettings.GetWindowColor())); - SetLineColor(); - if(bIsBmp) - SetFillColor( Color(COL_TRANSPARENT) ); - DrawRect( aDrawRect ); - if ( bIsBmp ) - { - if ( pBitmap ) - DrawBitmap( aDrawPos, aDrawSize, *pBitmap ); - else - { - Size aSize = GetOutputSizePixel(); - DrawLine( Point(0,0), Point(aSize.Width(),aSize.Height()) ); - DrawLine( Point(0,aSize.Height()), Point(aSize.Width(),0) ); - } - } -} - -void BackgroundPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - Invalidate(); - } - Window::DataChanged( rDCEvt ); -} - -// class SvxBackgroundTabPage -------------------------------------------- - -#define HDL(hdl) LINK(this,SvxBackgroundTabPage,hdl) - -SvxBackgroundTabPage::SvxBackgroundTabPage( Window* pParent, - const SfxItemSet& rCoreSet ) : - - SvxTabPage( pParent, CUI_RES( RID_SVXPAGE_BACKGROUND ), rCoreSet ), - - aSelectTxt ( this, CUI_RES( FT_SELECTOR ) ), - aLbSelect ( this, CUI_RES( LB_SELECTOR ) ), - aStrBrowse ( CUI_RES( STR_BROWSE ) ), - aStrUnlinked ( CUI_RES( STR_UNLINKED ) ), - aTblDesc ( this, CUI_RES( FT_TBL_DESC ) ), - aTblLBox ( this, CUI_RES( LB_TBL_BOX ) ), - aParaLBox ( this, CUI_RES( LB_PARA_BOX ) ), - - aBorderWin ( this, CUI_RES(CT_BORDER) ), - aBackgroundColorSet ( &aBorderWin, CUI_RES( SET_BGDCOLOR ) ), - aBackgroundColorBox ( this, CUI_RES( GB_BGDCOLOR ) ), - pPreviewWin1 ( new BackgroundPreviewImpl( this, CUI_RES( WIN_PREVIEW1 ), sal_False ) ), - - aColTransFT ( this, CUI_RES( FT_COL_TRANS ) ), - aColTransMF ( this, CUI_RES( MF_COL_TRANS ) ), - aBtnPreview ( this, CUI_RES( BTN_PREVIEW ) ), - aGbFile ( this, CUI_RES( GB_FILE ) ), - aBtnBrowse ( this, CUI_RES( BTN_BROWSE ) ), - aBtnLink ( this, CUI_RES( BTN_LINK ) ), - aGbPosition ( this, CUI_RES( GB_POSITION ) ), - aBtnPosition ( this, CUI_RES( BTN_POSITION ) ), - aBtnArea ( this, CUI_RES( BTN_AREA ) ), - aBtnTile ( this, CUI_RES( BTN_TILE ) ), - aWndPosition ( this, CUI_RES( WND_POSITION ), RP_MM ), - aFtFile ( this, CUI_RES( FT_FILE ) ), - aGraphTransFL ( this, CUI_RES( FL_GRAPH_TRANS ) ), - aGraphTransMF ( this, CUI_RES( MF_GRAPH_TRANS ) ), - pPreviewWin2 ( new BackgroundPreviewImpl( - this, CUI_RES( WIN_PREVIEW2 ), sal_True ) ), - - nHtmlMode ( 0 ), - bAllowShowSelector ( sal_True ), - bIsGraphicValid ( sal_False ), - bLinkOnly ( sal_False ), - bResized ( sal_False ), - bColTransparency ( sal_False ), - bGraphTransparency ( sal_False ), - - pPageImpl ( new SvxBackgroundPage_Impl ), - pImportDlg ( NULL ), - pTableBck_Impl ( NULL ), - pParaBck_Impl ( NULL ) - -{ - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - const SfxPoolItem* pItem; - SfxObjectShell* pShell; - - if ( SFX_ITEM_SET == rCoreSet.GetItemState( SID_HTML_MODE, sal_False, &pItem ) - || ( 0 != ( pShell = SfxObjectShell::Current()) && - 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) - { - nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); - } - - FillColorValueSets_Impl(); - - aBackgroundColorSet.SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); - FreeResource(); - - aBtnBrowse.SetAccessibleRelationMemberOf(&aGbFile); - aWndPosition.SetAccessibleRelationMemberOf(&aGbPosition); - aWndPosition.SetAccessibleRelationLabeledBy(&aBtnPosition); - aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorBox); -} - -//------------------------------------------------------------------------ - -SvxBackgroundTabPage::~SvxBackgroundTabPage() -{ - delete pPreviewWin1; - delete pPreviewWin2; - delete pPageImpl->pLoadTimer; - delete pPageImpl; - delete pImportDlg; - - if( pTableBck_Impl) - { - delete pTableBck_Impl->pCellBrush; - delete pTableBck_Impl->pRowBrush; - delete pTableBck_Impl->pTableBrush; - delete pTableBck_Impl; - } - - if(pParaBck_Impl) - { - delete pParaBck_Impl->pParaBrush; - delete pParaBck_Impl->pCharBrush; - delete pParaBck_Impl; - } -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxBackgroundTabPage::GetRanges() - -/* [Beschreibung] - - gibt den Bereich der Which-Werte zur"uck -*/ - -{ - return pRanges; -} - -//------------------------------------------------------------------------ - -SfxTabPage* SvxBackgroundTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) - -/* [Beschreibung] - - Create-Methode f"ur den TabDialog -*/ - -{ - return ( new SvxBackgroundTabPage( pParent, rAttrSet ) ); -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::Reset( const SfxItemSet& rSet ) -{ -// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, -// es muss aber im rSet vorhanden sein! -// const SfxPoolItem* pX = GetOldItem( rSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) - if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) - { - ResetFromWallpaperItem( rSet ); - return; - } - - // Zustand des Vorschau-Buttons durch UserData persistent - String aUserData = GetUserData(); - aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); - - // nach Reset kein ShowSelector() mehr aufrufen d"urfen - bAllowShowSelector = sal_False; - - - // Input-BrushItem besorgen und auswerten - const SvxBrushItem* pBgdAttr = NULL; - sal_uInt16 nSlot = SID_ATTR_BRUSH; - const SfxPoolItem* pItem; - sal_uInt16 nDestValue = USHRT_MAX; - - if ( SFX_ITEM_SET == rSet.GetItemState( SID_BACKGRND_DESTINATION, - sal_False, &pItem ) ) - { - nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); - aTblLBox.SelectEntryPos(nDestValue); - - switch ( nDestValue ) - { - case TBL_DEST_CELL: - nSlot = SID_ATTR_BRUSH; - break; - case TBL_DEST_ROW: - nSlot = SID_ATTR_BRUSH_ROW; - break; - case TBL_DEST_TBL: - nSlot = SID_ATTR_BRUSH_TABLE; - break; - } - } - else if( SFX_ITEM_SET == rSet.GetItemState( - SID_PARA_BACKGRND_DESTINATION, sal_False, &pItem ) ) - { - nDestValue = ((const SfxUInt16Item*)pItem)->GetValue(); - // ist gerade Zeichen aktiviert? - sal_uInt16 nParaSel = aParaLBox.GetSelectEntryPos(); - if(1 == nParaSel) - { - // dann war das ein "Standard" - Aufruf - nDestValue = nParaSel; - } - aParaLBox.SelectEntryPos(nDestValue); - - switch ( nDestValue ) - { - case PARA_DEST_PARA: - nSlot = SID_ATTR_BRUSH; - break; - case PARA_DEST_CHAR: - nSlot = SID_ATTR_BRUSH_CHAR; - break; - } - } - //#111173# the destination item is missing when the parent style has been changed - if(USHRT_MAX == nDestValue && (aParaLBox.IsVisible()||aTblLBox.IsVisible())) - nDestValue = 0; - sal_uInt16 nWhich = GetWhich( nSlot ); - - if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - - aBtnTile.Check(); - - if ( pBgdAttr ) - { - FillControls_Impl(*pBgdAttr, aUserData); - aBgdColor = ( (SvxBrushItem*)pBgdAttr )->GetColor(); - } - else - { - aSelectTxt.Hide(); - aLbSelect.Hide(); - aLbSelect.SelectEntryPos( 0 ); - ShowColorUI_Impl(); - - const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_BRUSH ); - - if ( pOld ) - aBgdColor = ( (SvxBrushItem*)pOld )->GetColor(); - } - - if ( nDestValue != USHRT_MAX ) - { - if(aTblLBox.IsVisible()) - { - sal_uInt16 nValue = aTblLBox.GetSelectEntryPos(); - - if ( pTableBck_Impl ) - { - DELETEZ( pTableBck_Impl->pCellBrush); - DELETEZ( pTableBck_Impl->pRowBrush); - DELETEZ( pTableBck_Impl->pTableBrush); - } - else - pTableBck_Impl = new SvxBackgroundTable_Impl(); - - pTableBck_Impl->nActPos = nValue; - - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pTableBck_Impl->pCellBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nCellWhich = nWhich; - - if ( rSet.GetItemState( SID_ATTR_BRUSH_ROW, sal_False ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_ROW ) ); - pTableBck_Impl->pRowBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nRowWhich = SID_ATTR_BRUSH_ROW; - - if ( rSet.GetItemState( SID_ATTR_BRUSH_TABLE, sal_False ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( SID_ATTR_BRUSH_TABLE ) ); - pTableBck_Impl->pTableBrush = new SvxBrushItem(*pBgdAttr); - } - pTableBck_Impl->nTableWhich = SID_ATTR_BRUSH_TABLE; - - TblDestinationHdl_Impl(&aTblLBox); - aTblLBox.SaveValue(); - } - else - { - sal_uInt16 nValue = aParaLBox.GetSelectEntryPos(); - - if ( pParaBck_Impl ) - { - delete pParaBck_Impl->pParaBrush; - delete pParaBck_Impl->pCharBrush; - } - else - pParaBck_Impl = new SvxBackgroundPara_Impl(); - - pParaBck_Impl->nActPos = nValue; - - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pParaBrush = new SvxBrushItem(*pBgdAttr); - } - - nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); - rSet.GetItemState( nWhich, sal_True ); - rSet.GetItemState( nWhich, sal_False ); - if ( rSet.GetItemState( nWhich, sal_True ) > SFX_ITEM_AVAILABLE ) - { - pBgdAttr = (const SvxBrushItem*)&( rSet.Get( nWhich ) ); - pParaBck_Impl->pCharBrush = new SvxBrushItem(*pBgdAttr); - } - else - pParaBck_Impl->pCharBrush = new SvxBrushItem(SID_ATTR_BRUSH_CHAR); - - ParaDestinationHdl_Impl(&aParaLBox); - aParaLBox.SaveValue(); - } - } - if(!bResized) - { - if(!aLbSelect.IsVisible() && !aTblLBox.IsVisible() && !aParaLBox.IsVisible()) - { - long nY(LogicToPixel(Point(11,14), MAP_APPFONT).X()); - long nX(LogicToPixel(Point(11,14), MAP_APPFONT).Y()); - Point aPos(aBorderWin.GetPosPixel()); - aPos.X() = nX; - aPos.Y() = nY; - aBorderWin.SetPosPixel(aPos); - aPos = pPreviewWin1->GetPosPixel(); - aPos.Y() = nY; - pPreviewWin1->SetPosPixel(aPos); - aBackgroundColorBox.Hide(); - aBackgroundColorSet.SetAccessibleRelationLabeledBy(&aBackgroundColorSet); - } - } -} - -void SvxBackgroundTabPage::ResetFromWallpaperItem( const SfxItemSet& rSet ) -{ - ShowSelector(); - - // Zustand des Vorschau-Buttons durch UserData persistent - String aUserData = GetUserData(); - aBtnPreview.Check( aUserData.Len() && sal_Unicode('1') == aUserData.GetChar( 0 ) ); - - // Input-BrushItem besorgen und auswerten - const SvxBrushItem* pBgdAttr = NULL; - sal_uInt16 nSlot = SID_VIEW_FLD_PIC; - sal_uInt16 nWhich = GetWhich( nSlot ); - SvxBrushItem* pTemp = 0; - const CntWallpaperItem* pItem = 0; - - if ( rSet.GetItemState( nWhich, sal_False ) >= SFX_ITEM_AVAILABLE ) - { - pItem = (const CntWallpaperItem*)&rSet.Get( nWhich ); - pTemp = new SvxBrushItem( *pItem, nWhich ); - pBgdAttr = pTemp; - } - - aBtnTile.Check(); - - if ( pBgdAttr ) - { - FillControls_Impl(*pBgdAttr, aUserData); - // Auch bei Anzeige der Grafik, soll die Brush erhalten bleiben - if( aBgdColor != pBgdAttr->GetColor() ) - { - aBgdColor = pBgdAttr->GetColor(); - sal_uInt16 nCol = GetItemId_Impl( aBackgroundColorSet, aBgdColor ); - aBackgroundColorSet.SelectItem( nCol ); - pPreviewWin1->NotifyChange( aBgdColor ); - } - } - else - { - aLbSelect.SelectEntryPos( 0 ); - ShowColorUI_Impl(); - - const SfxPoolItem* pOld = GetOldItem( rSet, SID_VIEW_FLD_PIC ); - if ( pOld ) - aBgdColor = Color( ((CntWallpaperItem*)pOld)->GetColor() ); - } - - // We now have always a link to the background - bLinkOnly = sal_True; - aBtnLink.Check( sal_True ); - aBtnLink.Show( sal_False ); -// if( !pItem || !pItem->GetWallpaper(sal_False).IsBitmap() ) -// aBtnLink.Check(); - - delete pTemp; -} - - - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::FillUserData() - -/* [Beschreibung] - - Beim Destruieren einer SfxTabPage wird diese virtuelle Methode gerufen, - damit die TabPage interne Informationen sichern kann. - - In diesem Fall wird der Zustand des Vorschau-Buttons gesichert. -*/ - -{ - SetUserData( String( aBtnPreview.IsChecked() ? sal_Unicode('1') : sal_Unicode('0') ) ); -} - -//------------------------------------------------------------------------ - -sal_Bool SvxBackgroundTabPage::FillItemSet( SfxItemSet& rCoreSet ) -{ - if ( pPageImpl->pLoadTimer && pPageImpl->pLoadTimer->IsActive() ) - { - pPageImpl->pLoadTimer->Stop(); - LoadTimerHdl_Impl( pPageImpl->pLoadTimer ); - } -// os: So ein Unsinn! Irgendwo laesst sich so ein Item immer finden, -// es muss aber im rSet vorhanden sein! - -// const SfxPoolItem* pX = GetOldItem( rCoreSet, SID_VIEW_FLD_PIC ); -// if( pX && pX->ISA(SfxWallpaperItem)) - if(SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(GetWhich(SID_VIEW_FLD_PIC), sal_False)) - return FillItemSetWithWallpaperItem( rCoreSet, SID_VIEW_FLD_PIC ); - - sal_Bool bModified = sal_False; - sal_uInt16 nSlot = SID_ATTR_BRUSH; - - if ( aTblLBox.IsVisible() ) - { - switch( aTblLBox.GetSelectEntryPos() ) - { - case TBL_DEST_CELL: - nSlot = SID_ATTR_BRUSH; - break; - case TBL_DEST_ROW: - nSlot = SID_ATTR_BRUSH_ROW; - break; - case TBL_DEST_TBL: - nSlot = SID_ATTR_BRUSH_TABLE; - break; - } - } - else if(aParaLBox.GetData() == &aParaLBox) - { - switch(aParaLBox.GetSelectEntryPos()) - { - case PARA_DEST_PARA: - nSlot = SID_ATTR_BRUSH; - break; - case PARA_DEST_CHAR: - nSlot = SID_ATTR_BRUSH_CHAR; - break; - } - } - sal_uInt16 nWhich = GetWhich( nSlot ); - - const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); - SfxItemState eOldItemState = rCoreSet.GetItemState(nSlot, sal_False); - const SfxItemSet& rOldSet = GetItemSet(); - - sal_Bool bGraphTransparencyChanged = bGraphTransparency && (aGraphTransMF.GetText() != aGraphTransMF.GetSavedValue()); - if ( pOld ) - { - const SvxBrushItem& rOldItem = (const SvxBrushItem&)*pOld; - SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); - const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); - - // transparency has to be set if enabled, the color not already set to "No fill" and - if( bColTransparency && - aBgdColor.GetTransparency() < 0xff) - { - aBgdColor.SetTransparency(lcl_PercentToTransparency(static_cast(aColTransMF.GetValue()))); - } - if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) - || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? - { - // Hintergrund-Art wurde nicht gewechselt: - - if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) - { - // Brush-Behandlung: - if ( rOldItem.GetColor() != aBgdColor || - (SFX_ITEM_AVAILABLE >= eOldItemState && !aBackgroundColorSet.IsNoSelection())) - { - bModified = sal_True; - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - rCoreSet.ClearItem( nWhich ); - } - else - { - // Bitmap-Behandlung: - - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - const sal_Bool bIsLink = aBtnLink.IsChecked(); - const sal_Bool bWasLink = (NULL != rOldItem.GetGraphicLink() ); - - - if ( !bIsLink && !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bGraphTransparencyChanged || - eNewPos != eOldPos - || bIsLink != bWasLink - || ( bWasLink && *rOldItem.GetGraphicLink() - != aBgdGraphicPath ) - || ( !bWasLink && rOldItem.GetGraphic()->GetBitmap() - != aBgdGraphic.GetBitmap() ) - ) - { - bModified = sal_True; - - SvxBrushItem aTmpBrush(nWhich); - if ( bIsLink ) - { - aTmpBrush = SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - eNewPos, - nWhich ); - } - else - aTmpBrush = SvxBrushItem( aBgdGraphic, - eNewPos, - nWhich ); - lcl_SetTransparency(aTmpBrush, static_cast(aGraphTransMF.GetValue())); - - rCoreSet.Put(aTmpBrush); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - rCoreSet.ClearItem( nWhich ); - } - } - else // Brush <-> Bitmap gewechselt! - { - if ( bIsBrush ) - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - else - { - SvxBrushItem* pTmpBrush = 0; - if ( aBtnLink.IsChecked() ) - { - pTmpBrush = new SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - GetGraphicPosition_Impl(), - nWhich ); - } - else - { - if ( !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bIsGraphicValid ) - pTmpBrush = new SvxBrushItem( aBgdGraphic, - GetGraphicPosition_Impl(), - nWhich ); - } - if(pTmpBrush) - { - lcl_SetTransparency(*pTmpBrush, static_cast(aGraphTransMF.GetValue())); - rCoreSet.Put(*pTmpBrush); - delete pTmpBrush; - } - } - bModified = ( bIsBrush || aBtnLink.IsChecked() || bIsGraphicValid ); - } - } - else if ( SID_ATTR_BRUSH_CHAR == nSlot && aBgdColor != Color( COL_WHITE ) ) - { - rCoreSet.Put( SvxBrushItem( aBgdColor, nWhich ) ); - bModified = sal_True; - } - - if( aTblLBox.IsVisible() ) - { - // Der aktuelle Zustand wurde bereits geputtet - if( nSlot != SID_ATTR_BRUSH && pTableBck_Impl->pCellBrush) - { - const SfxPoolItem* pOldCell = - GetOldItem( rCoreSet, SID_ATTR_BRUSH ); - - if ( *pTableBck_Impl->pCellBrush != *pOldCell ) - { - rCoreSet.Put( *pTableBck_Impl->pCellBrush ); - bModified |= sal_True; - } - } - - if( nSlot != SID_ATTR_BRUSH_ROW && pTableBck_Impl->pRowBrush) - { - const SfxPoolItem* pOldRow = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_ROW ); - - if ( *pTableBck_Impl->pRowBrush != *pOldRow ) - { - rCoreSet.Put( *pTableBck_Impl->pRowBrush ); - bModified |= sal_True; - } - } - - if( nSlot != SID_ATTR_BRUSH_TABLE && pTableBck_Impl->pTableBrush) - { - const SfxPoolItem* pOldTable = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_TABLE ); - - if ( *pTableBck_Impl->pTableBrush != *pOldTable ) - { - rCoreSet.Put( *pTableBck_Impl->pTableBrush ); - bModified |= sal_True; - } - } - - if( aTblLBox.GetSavedValue() != aTblLBox.GetSelectEntryPos() ) - { - rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, - aTblLBox.GetSelectEntryPos() ) ); - bModified |= sal_True; - } - } - else if(aParaLBox.GetData() == &aParaLBox) - { - // Der aktuelle Zustand wurde bereits geputtet - if( nSlot != SID_ATTR_BRUSH && aParaLBox.IsVisible()) // nicht im Suchen-Format-Dialog - { - const SfxPoolItem* pOldPara = - GetOldItem( rCoreSet, SID_ATTR_BRUSH ); - - if ( *pParaBck_Impl->pParaBrush != *pOldPara ) - { - rCoreSet.Put( *pParaBck_Impl->pParaBrush ); - bModified |= sal_True; - } - } - - if( nSlot != SID_ATTR_BRUSH_CHAR ) - { - const SfxPoolItem* pOldChar = - GetOldItem( rCoreSet, SID_ATTR_BRUSH_CHAR ); - DBG_ASSERT(pParaBck_Impl, "pParaBck_Impl == NULL ?"); - if ( pOldChar && - //#111173# crash report shows that pParaBck_Impl can be NULL, the cause is unknown - pParaBck_Impl && - (*pParaBck_Impl->pCharBrush != *pOldChar || - *pParaBck_Impl->pCharBrush != SvxBrushItem(SID_ATTR_BRUSH_CHAR))) - { - rCoreSet.Put( *pParaBck_Impl->pCharBrush ); - bModified |= sal_True; - } - } - - if( aParaLBox.GetSavedValue() != aParaLBox.GetSelectEntryPos() ) - { - rCoreSet.Put( SfxUInt16Item( SID_BACKGRND_DESTINATION, - aParaLBox.GetSelectEntryPos() ) ); - bModified |= sal_True; - } - } - return bModified; -} - -sal_Bool SvxBackgroundTabPage::FillItemSetWithWallpaperItem( SfxItemSet& rCoreSet, sal_uInt16 nSlot) -{ - sal_uInt16 nWhich = GetWhich( nSlot ); - const SfxPoolItem* pOld = GetOldItem( rCoreSet, nSlot ); - const SfxItemSet& rOldSet = GetItemSet(); - DBG_ASSERT(pOld,"FillItemSetWithWallpaperItem: Item not found"); - - SvxBrushItem rOldItem( (const CntWallpaperItem&)*pOld, nWhich ); - SvxGraphicPosition eOldPos = rOldItem.GetGraphicPos(); - const sal_Bool bIsBrush = ( 0 == aLbSelect.GetSelectEntryPos() ); - sal_Bool bModified = sal_False; - - if ( ( (GPOS_NONE == eOldPos) && bIsBrush ) - || ( (GPOS_NONE != eOldPos) && !bIsBrush ) ) // Brush <-> Bitmap gewechselt? - { - // Hintergrund-Art wurde nicht gewechselt: - - if ( (GPOS_NONE == eOldPos) || !aLbSelect.IsVisible() ) - { - // Brush-Behandlung: - if ( rOldItem.GetColor() != aBgdColor ) - { - bModified = sal_True; - CntWallpaperItem aItem( nWhich ); - aItem.SetColor( aBgdColor ); - rCoreSet.Put( aItem ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - rCoreSet.ClearItem( nWhich ); - } - else - { - // Bitmap-Behandlung: - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - - int bBitmapChanged = ( ( eNewPos != eOldPos ) || - ( *rOldItem.GetGraphicLink() != aBgdGraphicPath ) ); - int bBrushChanged = ( rOldItem.GetColor() != aBgdColor ); - if( bBitmapChanged || bBrushChanged ) - { - bModified = sal_True; - - CntWallpaperItem aItem( nWhich ); - WallpaperStyle eWallStyle = SvxBrushItem::GraphicPos2WallpaperStyle(eNewPos); - aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); - aItem.SetColor( aBgdColor ); - aItem.SetBitmapURL( aBgdGraphicPath ); - rCoreSet.Put( aItem ); - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - rCoreSet.ClearItem( nWhich ); - } - } - else // Brush <-> Bitmap gewechselt! - { - CntWallpaperItem aItem( nWhich ); - if ( bIsBrush ) - { - aItem.SetColor( aBgdColor ); - rCoreSet.Put( aItem ); - } - else - { - WallpaperStyle eWallStyle = - SvxBrushItem::GraphicPos2WallpaperStyle( GetGraphicPosition_Impl() ); - aItem.SetStyle( sal::static_int_cast< sal_uInt16 >( eWallStyle ) ); - aItem.SetColor( aBgdColor ); - aItem.SetBitmapURL( aBgdGraphicPath ); - rCoreSet.Put( aItem ); - } - - bModified = sal_True; - } - return bModified; -} - -//----------------------------------------------------------------------- - -int SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet ) - -/* [Beschreibung] - - virtuelle Methode, wird beim Deaktivieren gerufen -*/ - -{ - if ( pPageImpl->bIsImportDlgInExecute ) - return KEEP_PAGE; - - if ( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::PointChanged( Window* , RECT_POINT ) -{ - // muss implementiert werden, damit Position-Control funktioniert -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::ShowSelector() -{ - if( bAllowShowSelector) - { - aSelectTxt.Show(); - aLbSelect.Show(); - aLbSelect.SetSelectHdl( HDL(SelectHdl_Impl) ); - aBtnLink.SetClickHdl( HDL(FileClickHdl_Impl) ); - aBtnPreview.SetClickHdl( HDL(FileClickHdl_Impl) ); - aBtnBrowse.SetClickHdl( HDL(BrowseHdl_Impl) ); - aBtnArea.SetClickHdl( HDL(RadioClickHdl_Impl) ); - aBtnTile.SetClickHdl( HDL(RadioClickHdl_Impl) ); - aBtnPosition.SetClickHdl( HDL(RadioClickHdl_Impl) ); - - // Verz"ogertes Laden "uber Timer (wg. UI-Update) - pPageImpl->pLoadTimer = new Timer; - pPageImpl->pLoadTimer->SetTimeout( 500 ); // 500ms verz"ogern - pPageImpl->pLoadTimer->SetTimeoutHdl( - LINK( this, SvxBackgroundTabPage, LoadTimerHdl_Impl ) ); - - bAllowShowSelector = sal_False; - - if(nHtmlMode & HTMLMODE_ON) - { - if(!(nHtmlMode & HTMLMODE_GRAPH_POS)) - aBtnPosition.Enable(sal_False); - aBtnArea.Enable(sal_False); - } - } -} - -//------------------------------------------------------------------------ - - -void SvxBackgroundTabPage::RaiseLoadError_Impl() -{ - SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, - String(), - this, - RID_SVXERRCTX, - &CUI_MGR() ); - - ErrorHandler::HandleError( - *new StringErrorInfo( ERRCODE_SVX_GRAPHIC_NOTREADABLE, - aBgdGraphicPath ) ); -} - -//------------------------------------------------------------------------ - -sal_Bool SvxBackgroundTabPage::LoadLinkedGraphic_Impl() -{ - sal_Bool bResult = ( aBgdGraphicPath.Len() > 0 ) && - ( GRFILTER_OK == GraphicFilter::LoadGraphic( aBgdGraphicPath, - aBgdGraphicFilter, - aBgdGraphic ) ); - return bResult; -} - -//------------------------------------------------------------------------ - - -void SvxBackgroundTabPage::FillColorValueSets_Impl() - -/* [Beschreibung] - - F"ullen des Farb-Sets -*/ - -{ - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = NULL; - XColorTable* pColorTable = NULL; - const Size aSize15x15 = Size( 15, 15 ); - bool bOwn = false; - - if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - - if ( !pColorTable ) - { - bOwn = true; - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - } - - if ( pColorTable ) - { - short i = 0; - long nCount = pColorTable->Count(); - XColorEntry* pEntry = NULL; - Color aColWhite( COL_WHITE ); - String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) ); - WinBits nBits = ( aBackgroundColorSet.GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD ); - aBackgroundColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); - aBackgroundColorSet.SetStyle( nBits ); - aBackgroundColorSet.SetAccessibleName(aBackgroundColorBox.GetText()); - for ( i = 0; i < nCount; i++ ) - { - pEntry = pColorTable->GetColor(i); - aBackgroundColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); - } - - while ( i < 104 ) - { - aBackgroundColorSet.InsertItem( i + 1, aColWhite, aStrWhite ); - i++; - } - - if ( nCount > 104 ) - { - aBackgroundColorSet.SetStyle( nBits | WB_VSCROLL ); - } - } - - if ( bOwn ) - delete pColorTable; - - aBackgroundColorSet.SetColCount( 8 ); - aBackgroundColorSet.SetLineCount( 13 ); - aBackgroundColorSet.CalcWindowSizePixel( aSize15x15 ); - -} - -//------------------------------------------------------------------------ - - - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::ShowColorUI_Impl() - -/* [Beschreibung] - - Die Controls f"ur das Einstellen der Grafik ausblenden und die - Controls f"ur die Farbeinstellung einblenden. -*/ - -{ - if( !aBackgroundColorSet.IsVisible() ) - { - aBackgroundColorSet.Show(); - aBackgroundColorBox.Show(); - aBorderWin.Show(); - pPreviewWin1->Show(); - aBtnBrowse.Hide(); - aFtFile.Hide(); - aBtnLink.Hide(); - aBtnPreview.Hide(); - aGbFile.Hide(); - aBtnPosition.Hide(); - aBtnArea.Hide(); - aBtnTile.Hide(); - aWndPosition.Hide(); - aGbPosition.Hide(); - pPreviewWin2->Hide(); - aGraphTransFL.Show(sal_False); - aGraphTransMF.Show(sal_False); - if(bColTransparency) - { - aColTransFT.Show(); - aColTransMF.Show(); - } - } -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::ShowBitmapUI_Impl() - -/* [Beschreibung] - - Die Controls f"ur die Farbeinstellung ausblenden und die - Controls f"ur das Einstellen der Grafik einblenden. -*/ - -{ - if ( aLbSelect.IsVisible() && - ( - aBackgroundColorSet.IsVisible() - || !aBtnBrowse.IsVisible() ) ) - { - aBackgroundColorSet.Hide(); - aBackgroundColorBox.Hide(); - aBorderWin.Hide(); - pPreviewWin1->Hide(); - aBtnBrowse.Show(); - aFtFile.Show(); - - if ( !bLinkOnly && ! nHtmlMode & HTMLMODE_ON ) - aBtnLink.Show(); - aBtnPreview.Show(); - aGbFile.Show(); - aBtnPosition.Show(); - aBtnArea.Show(); - aBtnTile.Show(); - aWndPosition.Show(); - aGbPosition.Show(); - pPreviewWin2->Show(); - if(bGraphTransparency) - { - aGraphTransFL.Show(); - aGraphTransMF.Show(); - } - aColTransFT.Show(sal_False); - aColTransMF.Show(sal_False); - } -} - -//------------------------------------------------------------------------ - -void SvxBackgroundTabPage::SetGraphicPosition_Impl( SvxGraphicPosition ePos ) - -/* [Beschreibung] - - Die Controls f"ur die Grafikposition einstellen. -*/ - -{ - switch ( ePos ) - { - case GPOS_AREA: - { - aBtnArea.Check(); - aWndPosition.Disable(); - } - break; - - case GPOS_TILED: - { - aBtnTile.Check(); - aWndPosition.Disable(); - } - break; - - default: - { - aBtnPosition.Check(); - aWndPosition.Enable(); - RECT_POINT eNewPos = RP_MM; - - switch ( ePos ) - { - case GPOS_MM: break; - case GPOS_LT: eNewPos = RP_LT; break; - case GPOS_MT: eNewPos = RP_MT; break; - case GPOS_RT: eNewPos = RP_RT; break; - case GPOS_LM: eNewPos = RP_LM; break; - case GPOS_RM: eNewPos = RP_RM; break; - case GPOS_LB: eNewPos = RP_LB; break; - case GPOS_MB: eNewPos = RP_MB; break; - case GPOS_RB: eNewPos = RP_RB; break; - default: ;//prevent warning - } - aWndPosition.SetActualRP( eNewPos ); - } - break; - } - aWndPosition.Invalidate(); -} - -//------------------------------------------------------------------------ - -SvxGraphicPosition SvxBackgroundTabPage::GetGraphicPosition_Impl() - -/* [Beschreibung] - - Die Position der Grafik zur"uckgeben. -*/ - -{ - if ( aBtnTile.IsChecked() ) - return GPOS_TILED; - else if ( aBtnArea.IsChecked() ) - return GPOS_AREA; - else - { - switch ( aWndPosition.GetActualRP() ) - { - case RP_LT: return GPOS_LT; - case RP_MT: return GPOS_MT; - case RP_RT: return GPOS_RT; - case RP_LM: return GPOS_LM; - case RP_MM: return GPOS_MM; - case RP_RM: return GPOS_RM; - case RP_LB: return GPOS_LB; - case RP_MB: return GPOS_MB; - case RP_RB: return GPOS_RB; - } - } - return GPOS_MM; -} - -//----------------------------------------------------------------------- -// Handler -//----------------------------------------------------------------------- - -IMPL_LINK( SvxBackgroundTabPage, BackgroundColorHdl_Impl, ValueSet*, EMPTYARG ) -/* - Handler, called when color selection is changed -*/ -{ - sal_uInt16 nItemId = aBackgroundColorSet.GetSelectItemId(); - Color aColor = nItemId ? ( aBackgroundColorSet.GetItemColor( nItemId ) ) : Color( COL_TRANSPARENT ); - aBgdColor = aColor; - pPreviewWin1->NotifyChange( aBgdColor ); - sal_Bool bEnableTransp = aBgdColor.GetTransparency() < 0xff; - aColTransFT.Enable(bEnableTransp); - aColTransMF.Enable(bEnableTransp); - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, SelectHdl_Impl, ListBox*, EMPTYARG ) -{ - if ( 0 == aLbSelect.GetSelectEntryPos() ) - { - ShowColorUI_Impl(); - aParaLBox.Enable(); // Zeichenhintergrund kann keine Bitmap sein - } - else - { - ShowBitmapUI_Impl(); - aParaLBox.Enable(sal_False);// Zeichenhintergrund kann keine Bitmap sein - } - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, FileClickHdl_Impl, CheckBox*, pBox ) -{ - if ( &aBtnLink == pBox ) - { - if ( aBtnLink.IsChecked() ) - { - INetURLObject aObj( aBgdGraphicPath ); - String aFilePath; - if ( aObj.GetProtocol() == INET_PROT_FILE ) - aFilePath = aObj.getFSysPath( INetURLObject::FSYS_DETECT ); - else - aFilePath = aBgdGraphicPath; - aFtFile.SetText( aFilePath ); - } - else - aFtFile.SetText( aStrUnlinked ); - } - else if ( &aBtnPreview == pBox ) - { - if ( aBtnPreview.IsChecked() ) - { - if ( !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bIsGraphicValid ) - { - Bitmap aBmp = aBgdGraphic.GetBitmap(); - pPreviewWin2->NotifyChange( &aBmp ); - } - else - { - if ( aBgdGraphicPath.Len() > 0 ) // nur bei gelinkter Grafik - RaiseLoadError_Impl(); // ein Fehler - pPreviewWin2->NotifyChange( NULL ); - } - } - else - pPreviewWin2->NotifyChange( NULL ); - } - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, RadioClickHdl_Impl, RadioButton*, pBtn ) -{ - if ( pBtn == &aBtnPosition ) - { - if ( !aWndPosition.IsEnabled() ) - { - aWndPosition.Enable(); - aWndPosition.Invalidate(); - } - } - else if ( aWndPosition.IsEnabled() ) - { - aWndPosition.Disable(); - aWndPosition.Invalidate(); - } - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBackgroundTabPage, BrowseHdl_Impl, PushButton* , EMPTYARG ) - -/* [Beschreibung] - - Handler, gerufen durch das Dr"ucken des Durchsuchen-Buttons. - Grafik/Einf"ugen-Dialog erzeugen, Pfad setzen und starten. -*/ - -{ - if ( pPageImpl->pLoadTimer->IsActive() ) - return 0; - sal_Bool bHtml = 0 != ( nHtmlMode & HTMLMODE_ON ); - - pImportDlg = new SvxOpenGraphicDialog( aStrBrowse ); - if ( bHtml || bLinkOnly ) - pImportDlg->EnableLink(sal_False); - pImportDlg->SetPath( aBgdGraphicPath, aBtnLink.IsChecked() ); - - pPageImpl->bIsImportDlgInExecute = sal_True; - short nErr = pImportDlg->Execute(); - pPageImpl->bIsImportDlgInExecute = sal_False; - - if( !nErr ) - { - if ( bHtml ) - aBtnLink.Check(); - // wenn Verkn"upfen nicht gecheckt ist und die Vorschau auch nicht, - // dann die Vorschau aktivieren, damit der Anwender sieht, - // welche Grafik er ausgew"ahlt hat - if ( !aBtnLink.IsChecked() && !aBtnPreview.IsChecked() ) - aBtnPreview.Check( sal_True ); - // timer-verz"ogertes Laden der Grafik - pPageImpl->pLoadTimer->Start(); - } - else - DELETEZ( pImportDlg ); - return 0; -} - -//----------------------------------------------------------------------- - -IMPL_LINK( SvxBackgroundTabPage, LoadTimerHdl_Impl, Timer* , pTimer ) - -/* [Beschreibung] - - Verz"ogertes Laden der Grafik. - Grafik wird nur dann geladen, wenn sie unterschiedlich zur - aktuellen Grafik ist. -*/ - -{ - if ( pTimer == pPageImpl->pLoadTimer ) - { - pPageImpl->pLoadTimer->Stop(); - - if ( pImportDlg ) - { - INetURLObject aOld( aBgdGraphicPath ); - INetURLObject aNew( pImportDlg->GetPath() ); - if ( !aBgdGraphicPath.Len() || aNew != aOld ) - { - // neue Datei gew"ahlt - aBgdGraphicPath = pImportDlg->GetPath(); - aBgdGraphicFilter = pImportDlg->GetCurrentFilter(); - sal_Bool bLink = ( nHtmlMode & HTMLMODE_ON ) || bLinkOnly ? sal_True : pImportDlg->IsAsLink(); - aBtnLink.Check( bLink ); - aBtnLink.Enable(); - - if ( aBtnPreview.IsChecked() ) - { - if( !pImportDlg->GetGraphic(aBgdGraphic) ) - { - bIsGraphicValid = sal_True; - } - else - { - aBgdGraphicFilter.Erase(); - aBgdGraphicPath.Erase(); - bIsGraphicValid = sal_False; - } - } - else - bIsGraphicValid = sal_False; // Grafik erst beim Preview-Click laden - - if ( aBtnPreview.IsChecked() && bIsGraphicValid ) - { - Bitmap aBmp = aBgdGraphic.GetBitmap(); - pPreviewWin2->NotifyChange( &aBmp ); - } - else - pPreviewWin2->NotifyChange( NULL ); - } - - FileClickHdl_Impl( &aBtnLink ); - DELETEZ( pImportDlg ); - } - } - return 0; -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::ShowTblControl() -{ - aTblLBox .SetSelectHdl( HDL(TblDestinationHdl_Impl) ); - aTblLBox .SelectEntryPos(0); - aTblDesc.Show(); - aTblLBox.Show(); -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::ShowParaControl(sal_Bool bCharOnly) -{ - aParaLBox.SetSelectHdl(HDL(ParaDestinationHdl_Impl)); - aParaLBox.SelectEntryPos(0); - if(!bCharOnly) - { - aTblDesc.Show(); - aParaLBox.Show(); - } - aParaLBox.SetData(&aParaLBox); // hier erkennt man, dass dieser Mode eingeschaltet ist -} -//----------------------------------------------------------------------- - -IMPL_LINK( SvxBackgroundTabPage, TblDestinationHdl_Impl, ListBox*, pBox ) -{ - sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); - if( pTableBck_Impl && pTableBck_Impl->nActPos != nSelPos) - { - SvxBrushItem** pActItem = new (SvxBrushItem*); - sal_uInt16 nWhich = 0; - switch(pTableBck_Impl->nActPos) - { - case TBL_DEST_CELL: - *pActItem = pTableBck_Impl->pCellBrush; - nWhich = pTableBck_Impl->nCellWhich; - break; - case TBL_DEST_ROW: - *pActItem = pTableBck_Impl->pRowBrush; - nWhich = pTableBck_Impl->nRowWhich; - break; - case TBL_DEST_TBL: - *pActItem = pTableBck_Impl->pTableBrush; - nWhich = pTableBck_Impl->nTableWhich; - break; - } - pTableBck_Impl->nActPos = nSelPos; - if(!*pActItem) - *pActItem = new SvxBrushItem(nWhich); - if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt - { - **pActItem = SvxBrushItem( aBgdColor, nWhich ); - } - else - { - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - const sal_Bool bIsLink = aBtnLink.IsChecked(); - - if ( !bIsLink && !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bIsLink ) - **pActItem = SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - eNewPos, - (*pActItem)->Which() ); - else - **pActItem = SvxBrushItem( aBgdGraphic, - eNewPos, - (*pActItem)->Which() ); - } - switch(nSelPos) - { - case TBL_DEST_CELL: - *pActItem = pTableBck_Impl->pCellBrush; - aLbSelect.Enable(); - nWhich = pTableBck_Impl->nCellWhich; - break; - case TBL_DEST_ROW: - { - if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_SOME_STYLES)) - aLbSelect.Disable(); - *pActItem = pTableBck_Impl->pRowBrush; - nWhich = pTableBck_Impl->nRowWhich; - } - break; - case TBL_DEST_TBL: - *pActItem = pTableBck_Impl->pTableBrush; - aLbSelect.Enable(); - nWhich = pTableBck_Impl->nTableWhich; - break; - } - String aUserData = GetUserData(); - if(!*pActItem) - *pActItem = new SvxBrushItem(nWhich); - FillControls_Impl(**pActItem, aUserData); - delete pActItem; - } - return 0; -} - -//----------------------------------------------------------------------- - -IMPL_LINK( SvxBackgroundTabPage, ParaDestinationHdl_Impl, ListBox*, pBox ) -{ - sal_uInt16 nSelPos = pBox->GetSelectEntryPos(); - if( pParaBck_Impl && pParaBck_Impl->nActPos != nSelPos) - { - SvxBrushItem** pActItem = new (SvxBrushItem*); - switch(pParaBck_Impl->nActPos) - { - case PARA_DEST_PARA: - *pActItem = pParaBck_Impl->pParaBrush; - break; - case PARA_DEST_CHAR: - *pActItem = pParaBck_Impl->pCharBrush; - break; - } - pParaBck_Impl->nActPos = nSelPos; - if(0 == aLbSelect.GetSelectEntryPos()) // Brush ausgewaehlt - { - sal_uInt16 nWhich = (*pActItem)->Which(); - **pActItem = SvxBrushItem( aBgdColor, nWhich ); - } - else - { - SvxGraphicPosition eNewPos = GetGraphicPosition_Impl(); - const sal_Bool bIsLink = aBtnLink.IsChecked(); - - if ( !bIsLink && !bIsGraphicValid ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - - if ( bIsLink ) - **pActItem = SvxBrushItem( aBgdGraphicPath, - aBgdGraphicFilter, - eNewPos, - (*pActItem)->Which() ); - else - **pActItem = SvxBrushItem( aBgdGraphic, - eNewPos, - (*pActItem)->Which() ); - } - switch(nSelPos) - { - case PARA_DEST_PARA: - *pActItem = pParaBck_Impl->pParaBrush; - aLbSelect.Enable(); - break; - case PARA_DEST_CHAR: - { - *pActItem = pParaBck_Impl->pCharBrush; - aLbSelect.Enable(sal_False); - } - break; - } - String aUserData = GetUserData(); - FillControls_Impl(**pActItem, aUserData); - delete pActItem; - } - return 0; -} - -//----------------------------------------------------------------------- - -void SvxBackgroundTabPage::FillControls_Impl( const SvxBrushItem& rBgdAttr, - const String& rUserData ) -{ - SvxGraphicPosition ePos = rBgdAttr.GetGraphicPos(); - const Color& rColor = rBgdAttr.GetColor(); - if(bColTransparency) - { - aColTransMF.SetValue(lcl_TransparencyToPercent(rColor.GetTransparency())); - aColTransMF.SaveValue(); - sal_Bool bEnableTransp = rColor.GetTransparency() < 0xff; - aColTransFT.Enable(bEnableTransp); - aColTransMF.Enable(bEnableTransp); - //the default setting should be "no transparency" - if(!bEnableTransp) - aColTransMF.SetValue(0); - } - - if ( GPOS_NONE == ePos || !aLbSelect.IsVisible() ) - { - aLbSelect.SelectEntryPos( 0 ); - ShowColorUI_Impl(); - Color aTrColor( COL_TRANSPARENT ); - aBgdColor = rColor; - - sal_uInt16 nCol = ( aTrColor != aBgdColor ) ? - GetItemId_Impl( aBackgroundColorSet, aBgdColor ) : 0; - - if( aTrColor != aBgdColor && nCol == 0) - { - aBackgroundColorSet.SetNoSelection(); - } - else - { - aBackgroundColorSet.SelectItem( nCol ); - } - - pPreviewWin1->NotifyChange( aBgdColor ); - if ( aLbSelect.IsVisible() ) // Grafikteil initialisieren - { - aBgdGraphicFilter.Erase(); - aBgdGraphicPath.Erase(); - - if ( !rUserData.Len() ) - aBtnPreview.Check( sal_False ); - aBtnLink.Check( sal_False ); - aBtnLink.Disable(); - pPreviewWin2->NotifyChange( NULL ); - SetGraphicPosition_Impl( GPOS_TILED ); // Kacheln als Default - } - } - else - { - const String* pStrLink = rBgdAttr.GetGraphicLink(); - const String* pStrFilter = rBgdAttr.GetGraphicFilter(); - - aLbSelect.SelectEntryPos( 1 ); - ShowBitmapUI_Impl(); - - if ( pStrLink ) - { -#ifdef DBG_UTIL - INetURLObject aObj( *pStrLink ); - DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); -#endif - aBgdGraphicPath = *pStrLink; - aBtnLink.Check( sal_True ); - aBtnLink.Enable(); - } - else - { - aBgdGraphicPath.Erase(); - aBtnLink.Check( sal_False ); - aBtnLink.Disable(); - } - - if(bGraphTransparency) - { - const GraphicObject* pObject = rBgdAttr.GetGraphicObject(); - if(pObject) - aGraphTransMF.SetValue(lcl_TransparencyToPercent(pObject->GetAttr().GetTransparency())); - else - aGraphTransMF.SetValue(0); - aGraphTransMF.SaveValue(); - } - - FileClickHdl_Impl( &aBtnLink ); - - if ( pStrFilter ) - aBgdGraphicFilter = *pStrFilter; - else - aBgdGraphicFilter.Erase(); - - if ( !pStrLink || aBtnPreview.IsChecked() ) - { - // Grafik ist im Item vorhanden und muss nicht - // geladen werden: - - const Graphic* pGraphic = rBgdAttr.GetGraphic(); - - if ( !pGraphic && aBtnPreview.IsChecked() ) - bIsGraphicValid = LoadLinkedGraphic_Impl(); - else if ( pGraphic ) - { - aBgdGraphic = *pGraphic; - bIsGraphicValid = sal_True; - - if ( !rUserData.Len() ) - aBtnPreview.Check(); - } - else - { - RaiseLoadError_Impl(); - bIsGraphicValid = sal_False; - - if ( !rUserData.Len() ) - aBtnPreview.Check( sal_False ); - } - } - - if ( aBtnPreview.IsChecked() && bIsGraphicValid ) - { - Bitmap aBmp = aBgdGraphic.GetBitmap(); - pPreviewWin2->NotifyChange( &aBmp ); - } - else - pPreviewWin2->NotifyChange( NULL ); - - SetGraphicPosition_Impl( ePos ); - } -} - -void SvxBackgroundTabPage::EnableTransparency(sal_Bool bColor, sal_Bool bGraphic) -{ - bColTransparency = bColor; - bGraphTransparency = bGraphic; - if(bColor) - { - aColTransFT.Show(); - aColTransMF.Show(); - } - if(bGraphic) - { - Size aRectSize(aWndPosition.GetSizePixel()); - Point aRectPos(aWndPosition.GetPosPixel()); - Point aFLPos(aGraphTransFL.GetPosPixel()); - Size aTmp(LogicToPixel(Size(RSC_SP_FLGR_SPACE_Y, RSC_SP_FLGR_SPACE_Y), MAP_APPFONT)); - long nRectHeight = aFLPos.Y() - aRectPos.Y() - aTmp.Height(); - aRectSize.Height() = nRectHeight; - aWndPosition.SetSizePixel(aRectSize); - aWndPosition.Invalidate(); - } -} - -void SvxBackgroundTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - if (pFlagItem) - { - sal_uInt32 nFlags=pFlagItem->GetValue(); - if ( ( nFlags & SVX_SHOW_TBLCTL ) == SVX_SHOW_TBLCTL ) - ShowTblControl(); - if ( ( nFlags & SVX_SHOW_PARACTL ) == SVX_SHOW_PARACTL ) - ShowParaControl(); - if ( ( nFlags & SVX_SHOW_SELECTOR ) == SVX_SHOW_SELECTOR ) - ShowSelector(); - if ( ( nFlags & SVX_ENABLE_TRANSPARENCY ) == SVX_ENABLE_TRANSPARENCY ) - EnableTransparency(sal_True, sal_True); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/backgrnd.hrc b/cui/source/tabpages/backgrnd.hrc deleted file mode 100644 index dcd161ce8..000000000 --- a/cui/source/tabpages/backgrnd.hrc +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BACKGRND_HRC -#define _SVX_BACKGRND_HRC - -// defines ------------------------------------------------------------------ - -#define FT_SELECTOR 1 -#define LB_SELECTOR 1 - -#define SET_BGDCOLOR 10 -#define GB_BGDCOLOR 11 -#define SET_PATTERN 12 -#define GB_COL_PREVIEW 13 -#define SET_PATCOLOR 14 -#define GB_PATCOLOR 15 -#define CT_BORDER 16 -#define FT_PREVIEW 20 -#define WIN_PREVIEW1 21 - -#define BTN_BROWSE 20 -#define FT_FILE 21 -#define BTN_LINK 22 -#define BTN_PREVIEW 23 -#define GB_FILE 24 -#define BTN_AREA 25 -#define BTN_TILE 26 -#define BTN_POSITION 27 -#define WND_POSITION 28 -#define GB_POSITION 29 -#define WIN_PREVIEW2 30 -#define GB_PREVIEW 31 -#define LB_TBL_BOX 32 -#define FT_TBL_DESC 33 -#define LB_PARA_BOX 34 -#define FT_COL_TRANS 35 -#define MF_COL_TRANS 36 -#define FL_GRAPH_TRANS 37 -#define MF_GRAPH_TRANS 38 - -#define STR_BROWSE 1 -#define STR_UNLINKED 2 - - -#endif - diff --git a/cui/source/tabpages/backgrnd.src b/cui/source/tabpages/backgrnd.src deleted file mode 100644 index 5e670d295..000000000 --- a/cui/source/tabpages/backgrnd.src +++ /dev/null @@ -1,315 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include -#include "backgrnd.hrc" -#include - - // define ---------------------------------------------------------------- -#define UNLINKED_IMAGE \ - Text [ en-US ] = "Unlinked graphic" ; \ - - // pragma ---------------------------------------------------------------- - - // RID_SVXPAGE_BACKGROUND ------------------------------------------------ -TabPage RID_SVXPAGE_BACKGROUND -{ - HelpId = HID_BACKGROUND ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Background" ; - FixedText FT_SELECTOR - { - Pos = MAP_APPFONT ( 6 , 4 ) ; - Size = MAP_APPFONT ( 24 , 10 ) ; - Hide = TRUE ; - LeftLabel = TRUE ; - Text [ en-US ] = "A~s" ; - }; - ListBox LB_SELECTOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_BACKGROUND:LB_SELECTOR"; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 33 , 3 ) ; - Size = MAP_APPFONT ( 82 , 48 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Color" ; Default ; > ; - < "Graphic" ; Default ; > ; - }; - }; - FixedText FT_TBL_DESC - { - Pos = MAP_APPFONT ( 145 , 5 ) ; - Size = MAP_APPFONT ( 24 , 10 ) ; - Hide = TRUE ; - LeftLabel = TRUE ; - Text [ en-US ] = "F~or" ; - }; - ListBox LB_TBL_BOX - { - HelpID = "cui:ListBox:RID_SVXPAGE_BACKGROUND:LB_TBL_BOX"; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 172 , 3 ) ; - Size = MAP_APPFONT ( 82 , 48 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Cell" ; > ; - < "Row" ; > ; - < "Table" ; > ; - }; - }; - ListBox LB_PARA_BOX - { - HelpID = "cui:ListBox:RID_SVXPAGE_BACKGROUND:LB_PARA_BOX"; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 172 , 3 ) ; - Size = MAP_APPFONT ( 82 , 48 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Paragraph" ; > ; - < "Character" ; > ; - }; - }; - // Hintergrund-Brush ---------------------------------------------------- - Control CT_BORDER - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 116+2 , 145+2 ) ; - DialogControl = TRUE; - }; - Control SET_BGDCOLOR - { - HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 116 , 145 ) ; - TabStop = TRUE ; - }; - FixedLine GB_BGDCOLOR - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 21 ) ; - Size = MAP_APPFONT ( 248 , 8) ; - Text [ en-US ] = "Background color" ; - }; - Window WIN_PREVIEW1 - { - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 166 , 34 ) ; - Size = MAP_APPFONT ( 82 , 40 ) ; - }; - FixedText FT_COL_TRANS - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 166, 74 + RSC_SP_CTRL_Y + 2 ) ; - Size = MAP_APPFONT ( 50 , 8) ; - Text [ en-US ] = "~Transparency" ; - }; - MetricField MF_COL_TRANS - { - HelpID = "cui:MetricField:RID_SVXPAGE_BACKGROUND:MF_COL_TRANS"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 218 , 74 + RSC_SP_CTRL_Y ) ; - Size = MAP_APPFONT ( 30 , 12) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 5 ; - Minimum = 0; - Maximum = 100; - }; - - // Hintergrund-Bitmap ---------------------------------------------------- - FixedLine GB_FILE - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 23 ) ; - Size = MAP_APPFONT ( 153 , 8 ) ; - Text [ en-US ] = "File" ; - }; - PushButton BTN_BROWSE - { - HelpID = "cui:PushButton:RID_SVXPAGE_BACKGROUND:BTN_BROWSE"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "~Browse..." ; - }; - CheckBox BTN_LINK - { - HelpID = "cui:CheckBox:RID_SVXPAGE_BACKGROUND:BTN_LINK"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT + 60 + 2*RSC_SP_CTRL_X, 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 3 ) ; - Size = MAP_APPFONT ( 78 , 10 ) ; - Text [ en-US ] = "~Link" ; - }; - FixedText FT_FILE - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 + RSC_SP_FLGR_INNERBORDER_LEFT , 23 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + RSC_CD_PUSHBUTTON_HEIGHT + RSC_SP_CTRL_Y ) ; - Size = MAP_APPFONT ( 141 , 8 ) ; - UNLINKED_IMAGE - }; - FixedLine GB_POSITION - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 78 ) ; - Size = MAP_APPFONT ( 153 , 8 ) ; - Text [ en-US ] = "Type" ; - }; - RadioButton BTN_POSITION - { - HelpID = "cui:RadioButton:RID_SVXPAGE_BACKGROUND:BTN_POSITION"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 89 ) ; - Size = MAP_APPFONT ( 49 , 10 ) ; - Text [ en-US ] = "~Position" ; - }; - RadioButton BTN_AREA - { - HelpID = "cui:RadioButton:RID_SVXPAGE_BACKGROUND:BTN_AREA"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 103 ) ; - Size = MAP_APPFONT ( 49 , 10 ) ; - Text [ en-US ] = "Ar~ea" ; - }; - RadioButton BTN_TILE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_BACKGROUND:BTN_TILE"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 117 ) ; - Size = MAP_APPFONT ( 49 , 10 ) ; - Text [ en-US ] = "~Tile" ; - }; - Control WND_POSITION - { - HelpId = HID_BACKGROUND_CTL_POSITION ; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 64 , 89 ) ; - Size = MAP_APPFONT ( 90 , 87 ) ; - TabStop = TRUE ; - }; - FixedLine FL_GRAPH_TRANS - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 6 , 157 ) ; - Size = MAP_APPFONT ( 153 , 8) ; - Text [ en-US ] = "Transparency" ; - }; - MetricField MF_GRAPH_TRANS - { - HelpID = "cui:MetricField:RID_SVXPAGE_BACKGROUND:MF_GRAPH_TRANS"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 168 ) ; - Size = MAP_APPFONT ( 30 , 12) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 5 ; - Minimum = 0; - Maximum = 100; - }; - Window WIN_PREVIEW2 - { - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 170 , 23 + 4 ) ; - Size = MAP_APPFONT ( 81 , 139 ) ; - }; - CheckBox BTN_PREVIEW - { - HelpID = "cui:CheckBox:RID_SVXPAGE_BACKGROUND:BTN_PREVIEW"; - Pos = MAP_APPFONT ( 170 , 23 + 4 + 139 + RSC_SP_CTRL_GROUP_Y ) ; - Size = MAP_APPFONT ( 141 , 10 ) ; - Text [ en-US ] = "Pre~view" ; - }; - String STR_BROWSE - { - Text [ en-US ] = "Find graphics" ; - }; - String STR_UNLINKED - { - UNLINKED_IMAGE - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx deleted file mode 100644 index 3133b2fb7..000000000 --- a/cui/source/tabpages/bbdlg.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include "page.hrc" - -#include "bbdlg.hxx" -#include "border.hxx" -#include "backgrnd.hxx" -#include - -// class SvxBorderBackgroundDlg ------------------------------------------ - -SvxBorderBackgroundDlg::SvxBorderBackgroundDlg( Window *pParent, - const SfxItemSet& rCoreSet, - sal_Bool bEnableSelector ) : - - SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_BBDLG ), &rCoreSet ), - bEnableBackgroundSelector( bEnableSelector ) -{ - FreeResource(); - AddTabPage( RID_SVXPAGE_BORDER, SvxBorderTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_BACKGROUND, SvxBackgroundTabPage::Create, 0 ); -} - -// ----------------------------------------------------------------------- - -SvxBorderBackgroundDlg::~SvxBorderBackgroundDlg() -{ -} - -// ----------------------------------------------------------------------- - -void SvxBorderBackgroundDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) -{ - // Umschalten zwischen Farbe/Grafik ermoeglichen: - - if ( bEnableBackgroundSelector && (RID_SVXPAGE_BACKGROUND == nPageId) ) - ((SvxBackgroundTabPage&)rTabPage).ShowSelector( ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/bbdlg.src b/cui/source/tabpages/bbdlg.src deleted file mode 100644 index 0b4089801..000000000 --- a/cui/source/tabpages/bbdlg.src +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include - - // RID_SVXDLG_BBDLG ------------------------------------------------------ -TabDialog RID_SVXDLG_BBDLG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 328 , 155 ) ; - Text [ en-US ] = "Border / Background" ; - Moveable = TRUE ; - // Closeable = TRUE; hat ja einen OKButton - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 2 , 10 ) ; - Size = MAP_APPFONT ( 260 , 135 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_BORDER ; - Text [ en-US ] = "Borders" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_BACKGROUND ; - Text [ en-US ] = "Background" ; - }; - }; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx deleted file mode 100644 index a13cb4958..000000000 --- a/cui/source/tabpages/border.cxx +++ /dev/null @@ -1,1224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#define _SVX_BORDER_CXX - -#include -#include "border.hrc" -#include "helpid.hrc" - -#define LINESTYLE_HTML_MAX 5 - -#include // XColorTable -#include -#include -#include -#include "border.hxx" -#include -#include -#include "svx/htmlmode.hxx" -#include -#include "svx/flagsdef.hxx" -#include -#include -#include -#include -#include "borderconn.hxx" - -using namespace ::editeng; - -// ----------------------------------------------------------------------- - -/* - * [Beschreibung:] - * TabPage zum Einstellen der Rahmen-Attribute. - * Benoetigt - * ein SvxShadowItem: Schatten - * ein SvxBoxItem: Linien links,rechts,oben,unten ), - * ein SvxBoxInfo: Linien vertikal,horizontal, Abstaende, Flags ) - * - * Linien koennen drei Zustaende haben. - * 1. Show ( -> gueltige Werte ) - * 2. Hide ( -> NULL-Pointer ) - * 3. DontCare ( -> gesonderte Valid-Flags im InfoItem ) - */ - -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, - SID_ATTR_ALIGN_MARGIN, SID_ATTR_ALIGN_MARGIN, - SID_ATTR_BORDER_CONNECT, SID_ATTR_BORDER_CONNECT, - SID_SW_COLLAPSING_BORDERS, SID_SW_COLLAPSING_BORDERS, - SID_ATTR_BORDER_DIAG_TLBR, SID_ATTR_BORDER_DIAG_BLTR, - 0 -}; - -sal_Bool SvxBorderTabPage::bSync = sal_True; - -// ----------------------------------------------------------------------- -void lcl_SetDecimalDigitsTo1(MetricField& rField) -{ - sal_Int64 nMin = rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ); - rField.SetDecimalDigits(1); - rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP ); -} -// ----------------------------------------------------------------------- - -SvxBorderTabPage::SvxBorderTabPage( Window* pParent, - const SfxItemSet& rCoreAttrs ) - - : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_BORDER ), rCoreAttrs ), - - aFlBorder ( this, CUI_RES( FL_BORDER ) ), - aDefaultFT ( this, CUI_RES( FT_DEFAULT ) ), - aWndPresets ( this, CUI_RES( WIN_PRESETS ) ), - aUserDefFT ( this, CUI_RES( FT_USERDEF ) ), - aFrameSel ( this, CUI_RES( WIN_FRAMESEL ) ), - - aFlSep1 ( this, CUI_RES( FL_SEPARATOR1 ) ), - aFlLine ( this, CUI_RES( FL_LINE ) ), - aStyleFT ( this, CUI_RES( FT_STYLE ) ), - aLbLineStyle ( this, CUI_RES( LB_LINESTYLE ) ), - aColorFT ( this, CUI_RES( FT_COLOR ) ), - aLbLineColor ( this, CUI_RES( LB_LINECOLOR ) ), - aWidthFT ( this, CUI_RES( FT_WIDTH ) ), - aLineWidthMF ( this, CUI_RES( MF_LINEWIDTH ) ), - - aFlSep2 ( this, CUI_RES( FL_SEPARATOR2 ) ), - aDistanceFL ( this, CUI_RES( FL_DISTANCE ) ), - aLeftFT ( this, CUI_RES( FT_LEFT ) ), - aLeftMF ( this, CUI_RES( MF_LEFT ) ), - aRightFT ( this, CUI_RES( FT_RIGHT ) ), - aRightMF ( this, CUI_RES( MF_RIGHT ) ), - aTopFT ( this, CUI_RES( FT_TOP ) ), - aTopMF ( this, CUI_RES( MF_TOP ) ), - aBottomFT ( this, CUI_RES( FT_BOTTOM ) ), - aBottomMF ( this, CUI_RES( MF_BOTTOM ) ), - aSynchronizeCB ( this, CUI_RES( CB_SYNC ) ), - - aFlShadow ( this, CUI_RES( FL_SHADOW ) ), - aFtShadowPos ( this, CUI_RES( FT_SHADOWPOS ) ), - aWndShadows ( this, CUI_RES( WIN_SHADOWS ) ), - aFtShadowSize ( this, CUI_RES( FT_SHADOWSIZE ) ), - aEdShadowSize ( this, CUI_RES( ED_SHADOWSIZE ) ), - aFtShadowColor ( this, CUI_RES( FT_SHADOWCOLOR ) ), - aLbShadowColor ( this, CUI_RES( LB_SHADOWCOLOR ) ), - aPropertiesFL ( this, CUI_RES( FL_PROPERTIES ) ), - aMergeWithNextCB( this, CUI_RES( CB_MERGEWITHNEXT ) ), - aMergeAdjacentBordersCB( this, CUI_RES( CB_MERGEADJACENTBORDERS ) ), - aShadowImgLst( CUI_RES(IL_SDW_BITMAPS)), - aBorderImgLst( CUI_RES(IL_PRE_BITMAPS)), - nMinValue(0), - nSWMode(0), - mbHorEnabled( false ), - mbVerEnabled( false ), - mbTLBREnabled( false ), - mbBLTREnabled( false ), - mbUseMarginItem( false ) - -{ - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - /* Use SvxMarginItem instead of margins from SvxBoxItem, if present. - -> Remember this state in mbUseMarginItem, because other special handling - is needed across various functions... */ - mbUseMarginItem = rCoreAttrs.GetItemState(GetWhich(SID_ATTR_ALIGN_MARGIN),sal_True) != SFX_ITEM_UNKNOWN; - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs ); - - if( mbUseMarginItem ) - { - // copied from SvxAlignmentTabPage - switch ( eFUnit ) - { - // #103396# the default value (1pt) can't be accurately represented in - // inches or pica with two decimals, so point is used instead. - case FUNIT_PICA: - case FUNIT_INCH: - case FUNIT_FOOT: - case FUNIT_MILE: - eFUnit = FUNIT_POINT; - break; - - case FUNIT_CM: - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ;//prevent warning - } - } - else - { - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ; //prevent warning - } - } - - SetFieldUnit( aEdShadowSize, eFUnit ); - - sal_uInt16 nWhich = GetWhich( SID_ATTR_BORDER_INNER, sal_False ); - sal_Bool bIsDontCare = sal_True; - - if ( rCoreAttrs.GetItemState( nWhich, sal_True ) >= SFX_ITEM_AVAILABLE ) - { - // Absatz oder Tabelle - const SvxBoxInfoItem* pBoxInfo = - (const SvxBoxInfoItem*)&( rCoreAttrs.Get( nWhich ) ); - - mbHorEnabled = pBoxInfo->IsHorEnabled(); - mbVerEnabled = pBoxInfo->IsVerEnabled(); - mbTLBREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_TLBR ); - mbBLTREnabled = sfx::ItemWrapperHelper::IsKnownItem( rCoreAttrs, SID_ATTR_BORDER_DIAG_BLTR ); - - if(pBoxInfo->IsDist()) - { - SetFieldUnit(aLeftMF, eFUnit); - SetFieldUnit(aRightMF, eFUnit); - SetFieldUnit(aTopMF, eFUnit); - SetFieldUnit(aBottomMF, eFUnit); - aSynchronizeCB.Check(bSync); - aSynchronizeCB.SetClickHdl(LINK(this, SvxBorderTabPage, SyncHdl_Impl)); - aLeftMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - aRightMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - aTopMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - aBottomMF.SetModifyHdl(LINK(this, SvxBorderTabPage, ModifyDistanceHdl_Impl)); - } - else - { - aFlSep2.Hide(); - aDistanceFL.Hide(); - aLeftFT.Hide(); - aLeftMF.Hide(); - aRightFT.Hide(); - aRightMF.Hide(); - aTopFT.Hide(); - aTopMF.Hide(); - aBottomFT.Hide(); - aBottomMF.Hide(); - aSynchronizeCB.Hide(); - } - bIsDontCare = !pBoxInfo->IsValid( VALID_DISABLE ); - } - if(!mbUseMarginItem && eFUnit == FUNIT_MM && SFX_MAPUNIT_TWIP == rCoreAttrs.GetPool()->GetMetric( GetWhich( SID_ATTR_BORDER_INNER ) )) - { - //#i91548# changing the number of decimal digits changes the minimum values, too - lcl_SetDecimalDigitsTo1(aLeftMF); - lcl_SetDecimalDigitsTo1(aRightMF); - lcl_SetDecimalDigitsTo1(aTopMF); - lcl_SetDecimalDigitsTo1(aBottomMF); - lcl_SetDecimalDigitsTo1(aEdShadowSize); - } - - svx::FrameSelFlags nFlags = svx::FRAMESEL_OUTER; - if( mbHorEnabled ) - nFlags |= svx::FRAMESEL_INNER_HOR; - if( mbVerEnabled ) - nFlags |= svx::FRAMESEL_INNER_VER; - if( mbTLBREnabled ) - nFlags |= svx::FRAMESEL_DIAG_TLBR; - if( mbBLTREnabled ) - nFlags |= svx::FRAMESEL_DIAG_BLTR; - if( bIsDontCare ) - nFlags |= svx::FRAMESEL_DONTCARE; - aFrameSel.Initialize( nFlags ); - - aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl)); - aLbLineStyle.SetSelectHdl( LINK( this, SvxBorderTabPage, SelStyleHdl_Impl ) ); - aLbLineColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); - aLineWidthMF.SetModifyHdl( LINK( this, SvxBorderTabPage, ModifyWidthHdl_Impl ) ); - aLbShadowColor.SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl ) ); - aWndPresets.SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl ) ); - aWndShadows.SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl ) ); - - FillValueSets(); - FillLineListBox_Impl(); - - // ColorBox aus der XColorTable fuellen. - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = NULL; - XColorTable* pColorTable = NULL; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - } - - DBG_ASSERT( pColorTable, "ColorTable not found!" ); - - if ( pColorTable ) - { - // fuellen der Linienfarben-Box - aLbLineColor.SetUpdateMode( sal_False ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - XColorEntry* pEntry = pColorTable->GetColor(i); - aLbLineColor.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - aLbLineColor.SetUpdateMode( sal_True ); - // dann nur noch in die Schattenfarben-Box kopieren - aLbShadowColor.CopyEntries( aLbLineColor ); - } - FreeResource(); - - // connections - - bool bSupportsShadow = !SfxItemPool::IsSlot( GetWhich( SID_ATTR_BORDER_SHADOW ) ); - if( bSupportsShadow ) - AddItemConnection( svx::CreateShadowConnection( rCoreAttrs, aWndShadows, aEdShadowSize, aLbShadowColor ) ); - else - HideShadowControls(); - - if( mbUseMarginItem ) - AddItemConnection( svx::CreateMarginConnection( rCoreAttrs, aLeftMF, aRightMF, aTopMF, aBottomMF ) ); - if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_TLBR ) ) - AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_TLBR, aFrameSel, svx::FRAMEBORDER_TLBR ) ); - if( aFrameSel.IsBorderEnabled( svx::FRAMEBORDER_BLTR ) ) - AddItemConnection( svx::CreateFrameLineConnection( SID_ATTR_BORDER_DIAG_BLTR, aFrameSel, svx::FRAMEBORDER_BLTR ) ); - // #i43593# - item connection doesn't work for Writer, - // because the Writer item sets contain these items - // checkbox "Merge with next paragraph" only visible for Writer dialog format.paragraph - AddItemConnection( new sfx::CheckBoxConnection( SID_ATTR_BORDER_CONNECT, aMergeWithNextCB, sfx::ITEMCONN_DEFAULT ) ); - aMergeWithNextCB.Hide(); - // checkbox "Merge adjacent line styles" only visible for Writer dialog format.table - AddItemConnection( new sfx::CheckBoxConnection( SID_SW_COLLAPSING_BORDERS, aMergeAdjacentBordersCB, sfx::ITEMCONN_DEFAULT ) ); - aMergeAdjacentBordersCB.Hide(); -} - -// ----------------------------------------------------------------------- - -SvxBorderTabPage::~SvxBorderTabPage() -{ -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxBorderTabPage::GetRanges() -{ - return pRanges; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxBorderTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet ) -{ - return ( new SvxBorderTabPage( pParent, rAttrSet ) ); -} - -// ----------------------------------------------------------------------- - -void SvxBorderTabPage::ResetFrameLine_Impl( svx::FrameBorderType eBorder, const SvxBorderLine* pCoreLine, bool bValid ) -{ - if( aFrameSel.IsBorderEnabled( eBorder ) ) - { - if( bValid ) - aFrameSel.ShowBorder( eBorder, pCoreLine ); - else - aFrameSel.SetBorderDontCare( eBorder ); - } -} - -// ----------------------------------------------------------------------- - -void SvxBorderTabPage::Reset( const SfxItemSet& rSet ) -{ - SfxTabPage::Reset( rSet ); - - const SvxBoxItem* pBoxItem; - const SvxBoxInfoItem* pBoxInfoItem; - sal_uInt16 nWhichBox = GetWhich(SID_ATTR_BORDER_OUTER); - SfxMapUnit eCoreUnit; - - pBoxItem = (const SvxBoxItem*)GetItem( rSet, SID_ATTR_BORDER_OUTER ); - - pBoxInfoItem = (const SvxBoxInfoItem*)GetItem( rSet, SID_ATTR_BORDER_INNER, sal_False ); - - eCoreUnit = rSet.GetPool()->GetMetric( nWhichBox ); - - if ( pBoxItem && pBoxInfoItem ) // -> Don't Care - { - ResetFrameLine_Impl( svx::FRAMEBORDER_LEFT, pBoxItem->GetLeft(), pBoxInfoItem->IsValid( VALID_LEFT ) ); - ResetFrameLine_Impl( svx::FRAMEBORDER_RIGHT, pBoxItem->GetRight(), pBoxInfoItem->IsValid( VALID_RIGHT ) ); - ResetFrameLine_Impl( svx::FRAMEBORDER_TOP, pBoxItem->GetTop(), pBoxInfoItem->IsValid( VALID_TOP ) ); - ResetFrameLine_Impl( svx::FRAMEBORDER_BOTTOM, pBoxItem->GetBottom(), pBoxInfoItem->IsValid( VALID_BOTTOM ) ); - ResetFrameLine_Impl( svx::FRAMEBORDER_VER, pBoxInfoItem->GetVert(), pBoxInfoItem->IsValid( VALID_VERT ) ); - ResetFrameLine_Impl( svx::FRAMEBORDER_HOR, pBoxInfoItem->GetHori(), pBoxInfoItem->IsValid( VALID_HORI ) ); - - //------------------- - // Abstand nach innen - //------------------- - if( !mbUseMarginItem ) - { - if ( aLeftMF.IsVisible() ) - { - SetMetricValue( aLeftMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); - SetMetricValue( aRightMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); - SetMetricValue( aTopMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); - SetMetricValue( aBottomMF, pBoxInfoItem->GetDefDist(), eCoreUnit ); - - nMinValue = static_cast(aLeftMF.GetValue()); - - if ( pBoxInfoItem->IsMinDist() ) - { - aLeftMF.SetFirst( nMinValue ); - aRightMF.SetFirst( nMinValue ); - aTopMF.SetFirst( nMinValue ); - aBottomMF.SetFirst( nMinValue ); - } - - if ( pBoxInfoItem->IsDist() ) - { - if( rSet.GetItemState( nWhichBox, sal_True ) >= SFX_ITEM_DEFAULT ) - { - sal_Bool bIsAnyBorderVisible = aFrameSel.IsAnyBorderVisible(); - if( !bIsAnyBorderVisible || !pBoxInfoItem->IsMinDist() ) - { - aLeftMF.SetMin( 0 ); - aLeftMF.SetFirst( 0 ); - aRightMF.SetMin( 0 ); - aRightMF.SetFirst( 0 ); - aTopMF.SetMin( 0 ); - aTopMF.SetFirst( 0 ); - aBottomMF.SetMin( 0 ); - aBottomMF.SetFirst( 0 ); - } - long nLeftDist = pBoxItem->GetDistance( BOX_LINE_LEFT); - SetMetricValue( aLeftMF, nLeftDist, eCoreUnit ); - long nRightDist = pBoxItem->GetDistance( BOX_LINE_RIGHT); - SetMetricValue( aRightMF, nRightDist, eCoreUnit ); - long nTopDist = pBoxItem->GetDistance( BOX_LINE_TOP); - SetMetricValue( aTopMF, nTopDist, eCoreUnit ); - long nBottomDist = pBoxItem->GetDistance( BOX_LINE_BOTTOM); - SetMetricValue( aBottomMF, nBottomDist, eCoreUnit ); - - // ist der Abstand auf nicht-default gesetzt, - // dann soll der Wert auch nicht - // mehr autom. veraendert werden - - // if the distance is set with no active border line - // or it is null with an active border line - // no automatic changes should be made - const long nDefDist = bIsAnyBorderVisible ? pBoxInfoItem->GetDefDist() : 0; - sal_Bool bDiffDist = (nDefDist != nLeftDist || - nDefDist != nRightDist || - nDefDist != nTopDist || - nDefDist != nBottomDist); - if((pBoxItem->GetDistance() || - bIsAnyBorderVisible) && bDiffDist ) - { - aLeftMF.SetModifyFlag(); - aRightMF.SetModifyFlag(); - aTopMF.SetModifyFlag(); - aBottomMF.SetModifyFlag(); - } - } - else - { - // #106224# different margins -> do not fill the edits - aLeftMF.SetText( String() ); - aRightMF.SetText( String() ); - aTopMF.SetText( String() ); - aBottomMF.SetText( String() ); - } - } - aLeftMF.SaveValue(); - aRightMF.SaveValue(); - aTopMF.SaveValue(); - aBottomMF.SaveValue(); - } - } - } - else - { - // ResetFrameLine-Aufrufe einsparen: - aFrameSel.HideAllBorders(); - } - - //------------------------------------------------------------- - // Linie/Linienfarbe in Controllern darstellen, wenn eindeutig: - //------------------------------------------------------------- - { - // Do all visible lines show the same line widths? - long nWidth; - SvxBorderStyle nStyle; - bool bWidthEq = aFrameSel.GetVisibleWidth( nWidth, nStyle ); - if( bWidthEq ) - { - // Determine the width first as some styles can be missing depending on it - sal_Int64 nWidthPt = static_cast(MetricField::ConvertDoubleValue( - sal_Int64( nWidth ), aLineWidthMF.GetDecimalDigits( ), - MAP_TWIP,aLineWidthMF.GetUnit() )); - aLineWidthMF.SetValue( nWidthPt ); - aLbLineStyle.SetWidth( nWidth ); - - // then set the style - aLbLineStyle.SelectEntry( nStyle ); - } - else - aLbLineStyle.SelectEntryPos( 1 ); - - // Do all visible lines show the same line color? - Color aColor; - bool bColorEq = aFrameSel.GetVisibleColor( aColor ); - if( !bColorEq ) - aColor.SetColor( COL_BLACK ); - - sal_uInt16 nSelPos = aLbLineColor.GetEntryPos( aColor ); - if( nSelPos == LISTBOX_ENTRY_NOTFOUND ) - nSelPos = aLbLineColor.InsertEntry( aColor, SVX_RESSTR( RID_SVXSTR_COLOR_USER ) ); - - aLbLineColor.SelectEntryPos( nSelPos ); - aLbLineStyle.SetColor( aColor ); - - // Select all visible lines, if they are all equal. - if( bWidthEq && bColorEq ) - aFrameSel.SelectAllVisibleBorders(); - - // set the current style and color (caches style in control even if nothing is selected) - SelStyleHdl_Impl( &aLbLineStyle ); - SelColHdl_Impl( &aLbLineColor ); - } - - sal_Bool bEnable = aWndShadows.GetSelectItemId() > 1 ; - aFtShadowSize.Enable(bEnable); - aEdShadowSize.Enable(bEnable); - aFtShadowColor.Enable(bEnable); - aLbShadowColor.Enable(bEnable); - - aWndPresets.SetNoSelection(); - - // - keine Line - sollte nicht selektiert sein - - if ( aLbLineStyle.GetSelectEntryPos() == 0 ) - { - aLbLineStyle.SelectEntryPos( 1 ); - SelStyleHdl_Impl( &aLbLineStyle ); - } - - const SfxPoolItem* pItem; - SfxObjectShell* pShell; - if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) || - ( 0 != (pShell = SfxObjectShell::Current()) && - 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) - { - sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); - if(nHtmlMode & HTMLMODE_ON) - { - //Im Html-Mode gibt es keinen Schatten und nur komplette Umrandungen - aFtShadowPos .Disable(); - aWndShadows .Disable(); - aFtShadowSize .Disable(); - aEdShadowSize .Disable(); - aFtShadowColor.Disable(); - aLbShadowColor.Disable(); - aFlShadow .Disable(); - - sal_uInt16 nLBCount = aLbLineStyle.GetEntryCount(); - // ist es ein Absatzdialog, dann alle Linien fuer - // Sw-Export, sonst ist die Page nicht da - if(!(mbHorEnabled || mbVerEnabled) - && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS) && - SFX_ITEM_AVAILABLE > rSet.GetItemState(GetWhich( SID_ATTR_PARA_LINESPACE ))) - { - for( sal_uInt16 i = nLBCount - 1; i > LINESTYLE_HTML_MAX; --i) - aLbLineStyle.RemoveEntry(i); - } - - if( !(nSWMode & SW_BORDER_MODE_TABLE) ) - { - aUserDefFT.Disable(); - aFrameSel.Disable(); - aWndPresets.RemoveItem(3); - aWndPresets.RemoveItem(4); - aWndPresets.RemoveItem(5); - } - } - } - - LinesChanged_Impl( 0 ); -} - -// ----------------------------------------------------------------------- - -int SvxBorderTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -#define IS_DONT_CARE(a) ((a).GetState() == svx::FRAMESTATE_DONTCARE ) - -sal_Bool SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) -{ - bool bAttrsChanged = SfxTabPage::FillItemSet( rCoreAttrs ); - - sal_Bool bPut = sal_True; - sal_uInt16 nBoxWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - sal_uInt16 nBoxInfoWhich = rCoreAttrs.GetPool()->GetWhich( SID_ATTR_BORDER_INNER, sal_False ); - const SfxItemSet& rOldSet = GetItemSet(); - SvxBoxItem aBoxItem ( nBoxWhich ); - SvxBoxInfoItem aBoxInfoItem ( nBoxInfoWhich ); - SvxBoxItem* pOldBoxItem = (SvxBoxItem*)GetOldItem( rCoreAttrs, SID_ATTR_BORDER_OUTER ); - - SfxMapUnit eCoreUnit = rOldSet.GetPool()->GetMetric( nBoxWhich ); - const SfxPoolItem* pOld = 0; - - //------------------ - // Umrandung aussen: - //------------------ - typedef ::std::pair TBorderPair; - TBorderPair eTypes1[] = { - TBorderPair(svx::FRAMEBORDER_TOP,BOX_LINE_TOP), - TBorderPair(svx::FRAMEBORDER_BOTTOM,BOX_LINE_BOTTOM), - TBorderPair(svx::FRAMEBORDER_LEFT,BOX_LINE_LEFT), - TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT), - }; - - for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(eTypes1); ++i) - aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second ); - - //-------------------------------- - // Umrandung hor/ver und TableFlag - //-------------------------------- - TBorderPair eTypes2[] = { - TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI), - TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT) - }; - for (sal_uInt32 j=0; j < SAL_N_ELEMENTS(eTypes2); ++j) - aBoxInfoItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second ); - - aBoxInfoItem.EnableHor( mbHorEnabled ); - aBoxInfoItem.EnableVer( mbVerEnabled ); - - //------------------- - // Abstand nach Innen - //------------------- - if( aLeftMF.IsVisible() ) - { - // #i40405# enable distance controls for next dialog call - aBoxInfoItem.SetDist( sal_True ); - - if( !mbUseMarginItem ) - { - // #106224# all edits empty: do nothing - if( aLeftMF.GetText().Len() || aRightMF.GetText().Len() || - aTopMF.GetText().Len() || aBottomMF.GetText().Len() ) - { - if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SW_BORDER_MODE_TABLE)) && - (aLeftMF.IsModified()||aRightMF.IsModified()|| - aTopMF.IsModified()||aBottomMF.IsModified()) )|| - aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_HIDE - || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_HIDE - || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_HIDE - || aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_HIDE ) - { - SvxBoxInfoItem* pOldBoxInfoItem = (SvxBoxInfoItem*)GetOldItem( - rCoreAttrs, SID_ATTR_BORDER_INNER ); - if ( - !pOldBoxItem || - aLeftMF .GetText() != aLeftMF .GetSavedValue() || - aRightMF .GetText() != aRightMF .GetSavedValue() || - aTopMF .GetText() != aTopMF .GetSavedValue() || - aBottomMF.GetText() != aBottomMF.GetSavedValue() || - nMinValue == aLeftMF .GetValue() || - nMinValue == aRightMF .GetValue() || - nMinValue == aTopMF .GetValue() || - nMinValue == aBottomMF.GetValue() || - (pOldBoxInfoItem && !pOldBoxInfoItem->IsValid(VALID_DISTANCE)) - ) - { - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aLeftMF, eCoreUnit ), BOX_LINE_LEFT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aRightMF, eCoreUnit ), BOX_LINE_RIGHT ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aTopMF, eCoreUnit ), BOX_LINE_TOP ); - aBoxItem.SetDistance( (sal_uInt16)GetCoreValue( aBottomMF, eCoreUnit ), BOX_LINE_BOTTOM); - } - else - { - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_LEFT ), BOX_LINE_LEFT); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_RIGHT), BOX_LINE_RIGHT); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_TOP ), BOX_LINE_TOP); - aBoxItem.SetDistance(pOldBoxItem->GetDistance(BOX_LINE_BOTTOM), BOX_LINE_BOTTOM); - } - aBoxInfoItem.SetValid( VALID_DISTANCE, sal_True ); - } - else - aBoxInfoItem.SetValid( VALID_DISTANCE, sal_False ); - } - } - } - - //------------------------------------------ - // Don't Care Status im Info-Item vermerken: - //------------------------------------------ - aBoxInfoItem.SetValid( VALID_TOP, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP ) != svx::FRAMESTATE_DONTCARE ); - aBoxInfoItem.SetValid( VALID_BOTTOM, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM ) != svx::FRAMESTATE_DONTCARE ); - aBoxInfoItem.SetValid( VALID_LEFT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT ) != svx::FRAMESTATE_DONTCARE ); - aBoxInfoItem.SetValid( VALID_RIGHT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) != svx::FRAMESTATE_DONTCARE ); - aBoxInfoItem.SetValid( VALID_HORI, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_HOR ) != svx::FRAMESTATE_DONTCARE ); - aBoxInfoItem.SetValid( VALID_VERT, aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_VER ) != svx::FRAMESTATE_DONTCARE ); - - // - // Put oder Clear der Umrandung? - // - bPut = sal_True; - - if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxWhich, sal_False )) - { - bPut = aBoxItem != (const SvxBoxItem&)(rOldSet.Get(nBoxWhich)) ? sal_True : sal_False; - } - if( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nBoxInfoWhich, sal_False ) ) - { - const SvxBoxInfoItem& rOldBoxInfo = (const SvxBoxInfoItem&) - rOldSet.Get(nBoxInfoWhich); - - aBoxInfoItem.SetMinDist( rOldBoxInfo.IsMinDist() ); - aBoxInfoItem.SetDefDist( rOldBoxInfo.GetDefDist() ); - bPut |= (aBoxInfoItem != rOldBoxInfo ); - } - - if ( bPut ) - { - if ( !pOldBoxItem || !( *pOldBoxItem == aBoxItem ) ) - { - rCoreAttrs.Put( aBoxItem ); - bAttrsChanged |= sal_True; - } - pOld = GetOldItem( rCoreAttrs, SID_ATTR_BORDER_INNER, sal_False ); - - if ( !pOld || !( *(const SvxBoxInfoItem*)pOld == aBoxInfoItem ) ) - { - rCoreAttrs.Put( aBoxInfoItem ); - bAttrsChanged |= sal_True; - } - } - else - { - rCoreAttrs.ClearItem( nBoxWhich ); - rCoreAttrs.ClearItem( nBoxInfoWhich ); - } - - return bAttrsChanged; -} - -// ----------------------------------------------------------------------- - -void SvxBorderTabPage::HideShadowControls() -{ - aFtShadowPos.Hide(); - aWndShadows.Hide(); - aFtShadowSize.Hide(); - aEdShadowSize.Hide(); - aFtShadowColor.Hide(); - aLbShadowColor.Hide(); - aFlShadow.Hide(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBorderTabPage, SelPreHdl_Impl, void *, EMPTYARG ) -{ - const svx::FrameBorderState SHOW = svx::FRAMESTATE_SHOW; - const svx::FrameBorderState HIDE = svx::FRAMESTATE_HIDE; - const svx::FrameBorderState DONT = svx::FRAMESTATE_DONTCARE; - - static const svx::FrameBorderState ppeStates[][ svx::FRAMEBORDERTYPE_COUNT ] = - { /* Left Right Top Bot Hor Ver TLBR BLTR */ -/* ---------------------+--------------------------------------------------- */ -/* IID_PRE_CELL_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_CELL_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_CELL_LR */ { SHOW, SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_CELL_TB */ { HIDE, HIDE, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_CELL_L */ { SHOW, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_CELL_DIAG */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, SHOW, SHOW }, -/* IID_PRE_HOR_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_HOR_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_HOR_HOR */ { HIDE, HIDE, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, -/* IID_PRE_HOR_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, -/* IID_PRE_HOR_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, HIDE, HIDE, HIDE }, -/* IID_PRE_VER_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_VER_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_VER_VER */ { SHOW, SHOW, HIDE, HIDE, HIDE, SHOW, HIDE, HIDE }, -/* IID_PRE_VER_ALL */ { SHOW, SHOW, SHOW, SHOW, HIDE, SHOW, HIDE, HIDE }, -/* IID_PRE_VER_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, HIDE, DONT, HIDE, HIDE }, -/* IID_PRE_TABLE_NONE */ { HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_TABLE_OUTER */ { SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE, HIDE }, -/* IID_PRE_TABLE_OUTERH */ { SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE, HIDE }, -/* IID_PRE_TABLE_ALL */ { SHOW, SHOW, SHOW, SHOW, SHOW, SHOW, HIDE, HIDE }, -/* IID_PRE_TABLE_OUTER2 */ { SHOW, SHOW, SHOW, SHOW, DONT, DONT, HIDE, HIDE } - }; - - // first hide and deselect all frame borders - aFrameSel.HideAllBorders(); - aFrameSel.DeselectAllBorders(); - - // Using image ID to find correct line in table above. - sal_uInt16 nLine = GetPresetImageId( aWndPresets.GetSelectItemId() ) - 1; - - // Apply all styles from the table - for( int nBorder = 0; nBorder < svx::FRAMEBORDERTYPE_COUNT; ++nBorder ) - { - svx::FrameBorderType eBorder = svx::GetFrameBorderTypeFromIndex( nBorder ); - switch( ppeStates[ nLine ][ nBorder ] ) - { - case SHOW: aFrameSel.SelectBorder( eBorder ); break; - case HIDE: /* nothing to do */ break; - case DONT: aFrameSel.SetBorderDontCare( eBorder ); break; - } - } - - // Show all lines that have been selected above - if( aFrameSel.IsAnyBorderSelected() ) - { - // any visible style, but "no-line" in line list box? -> use hair-line - if( (aLbLineStyle.GetSelectEntryPos() == 0) || (aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND) ) - aLbLineStyle.SelectEntryPos( 1 ); - - // set current style to all previously selected lines - SelStyleHdl_Impl( &aLbLineStyle ); - SelColHdl_Impl( &aLbLineColor ); - } - - // Presets ValueSet does not show a selection (used as push buttons). - aWndPresets.SetNoSelection(); - - LinesChanged_Impl( 0 ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBorderTabPage, SelSdwHdl_Impl, void *, EMPTYARG ) -{ - sal_Bool bEnable = aWndShadows.GetSelectItemId() > 1; - aFtShadowSize.Enable(bEnable); - aEdShadowSize.Enable(bEnable); - aFtShadowColor.Enable(bEnable); - aLbShadowColor.Enable(bEnable); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBorderTabPage, SelColHdl_Impl, ListBox *, pLb ) -{ - ColorListBox* pColLb = (ColorListBox*)pLb; - - if ( pLb == &aLbLineColor ) - { - aFrameSel.SetColorToSelection( pColLb->GetSelectEntryColor() ); - aLbLineStyle.SetColor( pColLb->GetSelectEntryColor() ); - } - - return 0; -} - -IMPL_LINK( SvxBorderTabPage, ModifyWidthHdl_Impl, void *, EMPTYARG ) -{ - sal_Int64 nVal = static_cast(MetricField::ConvertDoubleValue( - aLineWidthMF.GetValue( ), - aLineWidthMF.GetDecimalDigits( ), - aLineWidthMF.GetUnit(), MAP_TWIP )); - aLbLineStyle.SetWidth( nVal ); - - aFrameSel.SetStyleToSelection( nVal, - SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBorderTabPage, SelStyleHdl_Impl, ListBox *, pLb ) -{ - if ( pLb == &aLbLineStyle ) - { - sal_Int64 nVal = static_cast(MetricField::ConvertDoubleValue( - aLineWidthMF.GetValue( ), - aLineWidthMF.GetDecimalDigits( ), - aLineWidthMF.GetUnit(), MAP_TWIP )); - aFrameSel.SetStyleToSelection ( nVal, - SvxBorderStyle( aLbLineStyle.GetSelectEntryStyle() ) ); - } - - return 0; -} - -// ============================================================================ -// ValueSet handling -// ============================================================================ - -// number of preset images to show -const sal_uInt16 SVX_BORDER_PRESET_COUNT = 5; - -// number of shadow images to show -const sal_uInt16 SVX_BORDER_SHADOW_COUNT = 5; - -// ---------------------------------------------------------------------------- - -sal_uInt16 SvxBorderTabPage::GetPresetImageId( sal_uInt16 nValueSetIdx ) const -{ - // table with all sets of predefined border styles - static const sal_uInt16 ppnImgIds[][ SVX_BORDER_PRESET_COUNT ] = - { - // simple cell without diagonal frame borders - { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_L }, - // simple cell with diagonal frame borders - { IID_PRE_CELL_NONE, IID_PRE_CELL_ALL, IID_PRE_CELL_LR, IID_PRE_CELL_TB, IID_PRE_CELL_DIAG }, - // with horizontal inner frame border - { IID_PRE_HOR_NONE, IID_PRE_HOR_OUTER, IID_PRE_HOR_HOR, IID_PRE_HOR_ALL, IID_PRE_HOR_OUTER2 }, - // with vertical inner frame border - { IID_PRE_VER_NONE, IID_PRE_VER_OUTER, IID_PRE_VER_VER, IID_PRE_VER_ALL, IID_PRE_VER_OUTER2 }, - // with horizontal and vertical inner frame borders - { IID_PRE_TABLE_NONE, IID_PRE_TABLE_OUTER, IID_PRE_TABLE_OUTERH, IID_PRE_TABLE_ALL, IID_PRE_TABLE_OUTER2 } - }; - - // find correct set of presets - int nLine = 0; - if( !mbHorEnabled && !mbVerEnabled ) - nLine = (mbTLBREnabled || mbBLTREnabled) ? 1 : 0; - else if( mbHorEnabled && !mbVerEnabled ) - nLine = 2; - else if( !mbHorEnabled && mbVerEnabled ) - nLine = 3; - else - nLine = 4; - - DBG_ASSERT( (1 <= nValueSetIdx) && (nValueSetIdx <= SVX_BORDER_PRESET_COUNT), - "SvxBorderTabPage::GetPresetImageId - wrong index" ); - return ppnImgIds[ nLine ][ nValueSetIdx - 1 ]; -} - -sal_uInt16 SvxBorderTabPage::GetPresetStringId( sal_uInt16 nValueSetIdx ) const -{ - // string resource IDs for each image (in order of the IID_PRE_* image IDs) - static const sal_uInt16 pnStrIds[] = - { - RID_SVXSTR_TABLE_PRESET_NONE, - RID_SVXSTR_PARA_PRESET_ALL, - RID_SVXSTR_PARA_PRESET_LEFTRIGHT, - RID_SVXSTR_PARA_PRESET_TOPBOTTOM, - RID_SVXSTR_PARA_PRESET_ONLYLEFT, - RID_SVXSTR_PARA_PRESET_DIAGONAL, - - RID_SVXSTR_TABLE_PRESET_NONE, - RID_SVXSTR_TABLE_PRESET_ONLYOUTER, - RID_SVXSTR_HOR_PRESET_ONLYHOR, - RID_SVXSTR_TABLE_PRESET_OUTERALL, - RID_SVXSTR_TABLE_PRESET_OUTERINNER, - - RID_SVXSTR_TABLE_PRESET_NONE, - RID_SVXSTR_TABLE_PRESET_ONLYOUTER, - RID_SVXSTR_VER_PRESET_ONLYVER, - RID_SVXSTR_TABLE_PRESET_OUTERALL, - RID_SVXSTR_TABLE_PRESET_OUTERINNER, - - RID_SVXSTR_TABLE_PRESET_NONE, - RID_SVXSTR_TABLE_PRESET_ONLYOUTER, - RID_SVXSTR_TABLE_PRESET_OUTERHORI, - RID_SVXSTR_TABLE_PRESET_OUTERALL, - RID_SVXSTR_TABLE_PRESET_OUTERINNER - }; - return pnStrIds[ GetPresetImageId( nValueSetIdx ) - 1 ]; -} - -// ---------------------------------------------------------------------------- - -void SvxBorderTabPage::FillPresetVS() -{ - ImageList& rImgList = aBorderImgLst; - Size aImgSize( rImgList.GetImage( IID_PRE_CELL_NONE ).GetSizePixel() ); - - // basic initialization of the ValueSet - aWndPresets.SetColCount( SVX_BORDER_PRESET_COUNT ); - aWndPresets.SetStyle( aWndPresets.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - aWndPresets.SetSizePixel( aWndPresets.CalcWindowSizePixel( aImgSize ) ); - - // insert images and help texts - for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx ) - { - aWndPresets.InsertItem( nVSIdx ); - aWndPresets.SetItemImage( nVSIdx, rImgList.GetImage( GetPresetImageId( nVSIdx ) ) ); - aWndPresets.SetItemText( nVSIdx, CUI_RESSTR( GetPresetStringId( nVSIdx ) ) ); - } - - // show the control - aWndPresets.SetNoSelection(); - aWndPresets.Show(); -} - -// ---------------------------------------------------------------------------- - -void SvxBorderTabPage::FillShadowVS() -{ - ImageList& rImgList = aShadowImgLst; - Size aImgSize( rImgList.GetImage( IID_SHADOWNONE ).GetSizePixel() ); - - // basic initialization of the ValueSet - aWndShadows.SetColCount( SVX_BORDER_SHADOW_COUNT ); - aWndShadows.SetStyle( aWndShadows.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); - aWndShadows.SetSizePixel( aWndShadows.CalcWindowSizePixel( aImgSize ) ); - - // image resource IDs - static const sal_uInt16 pnImgIds[ SVX_BORDER_SHADOW_COUNT ] = - { IID_SHADOWNONE, IID_SHADOW_BOT_RIGHT, IID_SHADOW_TOP_RIGHT, IID_SHADOW_BOT_LEFT, IID_SHADOW_TOP_LEFT }; - // string resource IDs for each image - static const sal_uInt16 pnStrIds[ SVX_BORDER_SHADOW_COUNT ] = - { RID_SVXSTR_SHADOW_STYLE_NONE, RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT, RID_SVXSTR_SHADOW_STYLE_TOPRIGHT, RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT, RID_SVXSTR_SHADOW_STYLE_TOPLEFT }; - - // insert images and help texts - for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx ) - { - aWndShadows.InsertItem( nVSIdx ); - aWndShadows.SetItemImage( nVSIdx, rImgList.GetImage( pnImgIds[ nVSIdx - 1 ] ) ); - aWndShadows.SetItemText( nVSIdx, CUI_RESSTR( pnStrIds[ nVSIdx - 1 ] ) ); - } - - // show the control - aWndShadows.SelectItem( 1 ); - aWndShadows.Show(); -} - -// ---------------------------------------------------------------------------- - -void SvxBorderTabPage::FillValueSets() -{ - FillPresetVS(); - FillShadowVS(); -} - -// ============================================================================ -Color lcl_mediumColor( Color aMain, Color /*aDefault*/ ) -{ - return SvxBorderLine::threeDMediumColor( aMain ); -} - -void SvxBorderTabPage::FillLineListBox_Impl() -{ - aLbLineStyle.SetSourceUnit( FUNIT_TWIP ); - - aLbLineStyle.SetNone( SVX_RESSTR( RID_SVXSTR_NONE ) ); - - // Simple lines - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED ); - - // Double lines - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP ); - - // Engraved / Embossed - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15, - &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor, - &lcl_mediumColor ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15, - &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor, - &lcl_mediumColor ); - - // Inset / Outset - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10, - &SvxBorderLine::lightColor, &SvxBorderLine::darkColor ); - aLbLineStyle.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10, - &SvxBorderLine::darkColor, &SvxBorderLine::lightColor ); - - sal_Int64 nVal = static_cast(MetricField::ConvertDoubleValue( - aLineWidthMF.GetValue( ), - aLineWidthMF.GetDecimalDigits( ), - aLineWidthMF.GetUnit(), MAP_TWIP )); - aLbLineStyle.SetWidth( nVal ); -} - -// ----------------------------------------------------------------------- -IMPL_LINK( SvxBorderTabPage, LinesChanged_Impl, void*, EMPTYARG ) -{ - if(!mbUseMarginItem && aLeftMF.IsVisible()) - { - sal_Bool bLineSet = aFrameSel.IsAnyBorderVisible(); - sal_Bool bMinAllowed = 0 != (nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_TABLE)); - sal_Bool bSpaceModified = aLeftMF .IsModified()|| - aRightMF .IsModified()|| - aTopMF .IsModified()|| - aBottomMF.IsModified(); - - if(bLineSet) - { - if(!bMinAllowed) - { - aLeftMF .SetFirst(nMinValue); - aRightMF .SetFirst(nMinValue); - aTopMF .SetFirst(nMinValue); - aBottomMF.SetFirst(nMinValue); - } - if(!bSpaceModified) - { - aLeftMF .SetValue(nMinValue); - aRightMF .SetValue(nMinValue); - aTopMF .SetValue(nMinValue); - aBottomMF.SetValue(nMinValue); - } - } - else - { - aLeftMF .SetMin(0); - aRightMF .SetMin(0); - aTopMF .SetMin(0); - aBottomMF.SetMin(0); - aLeftMF .SetFirst(0); - aRightMF .SetFirst(0); - aTopMF .SetFirst(0); - aBottomMF.SetFirst(0); - if(!bSpaceModified) - { - aLeftMF .SetValue(0); - aRightMF .SetValue(0); - aTopMF .SetValue(0); - aBottomMF.SetValue(0); - } - } - //fuer Tabellen ist alles erlaubt - sal_uInt16 nValid = VALID_TOP|VALID_BOTTOM|VALID_LEFT|VALID_RIGHT; - - //fuer Rahmen und Absatz wird das Edit disabled, wenn keine Border gesetzt ist - if(nSWMode & (SW_BORDER_MODE_FRAME|SW_BORDER_MODE_PARA)) - { - if(bLineSet) - { - nValid = (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_TOP) == svx::FRAMESTATE_SHOW) ? VALID_TOP : 0; - nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_BOTTOM) == svx::FRAMESTATE_SHOW) ? VALID_BOTTOM : 0; - nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_LEFT) == svx::FRAMESTATE_SHOW) ? VALID_LEFT : 0; - nValid |= (aFrameSel.GetFrameBorderState( svx::FRAMEBORDER_RIGHT ) == svx::FRAMESTATE_SHOW) ? VALID_RIGHT : 0; - } - else - nValid = 0; - } - aLeftFT.Enable(0 != (nValid&VALID_LEFT)); - aRightFT.Enable(0 != (nValid&VALID_RIGHT)); - aTopFT.Enable(0 != (nValid&VALID_TOP)); - aBottomFT.Enable(0 != (nValid&VALID_BOTTOM)); - aLeftMF.Enable(0 != (nValid&VALID_LEFT)); - aRightMF.Enable(0 != (nValid&VALID_RIGHT)); - aTopMF.Enable(0 != (nValid&VALID_TOP)); - aBottomMF.Enable(0 != (nValid&VALID_BOTTOM)); - aSynchronizeCB.Enable( aRightMF.IsEnabled() || aTopMF.IsEnabled() || - aBottomMF.IsEnabled() || aLeftMF.IsEnabled() ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBorderTabPage, ModifyDistanceHdl_Impl, MetricField*, pField) -{ - if ( bSync ) - { - sal_Int64 nVal = pField->GetValue(); - if(pField != &aLeftMF) - aLeftMF.SetValue(nVal); - if(pField != &aRightMF) - aRightMF.SetValue(nVal); - if(pField != &aTopMF) - aTopMF.SetValue(nVal); - if(pField != &aBottomMF) - aBottomMF.SetValue(nVal); - } - return 0; -} - -IMPL_LINK( SvxBorderTabPage, SyncHdl_Impl, CheckBox*, pBox) -{ - bSync = pBox->IsChecked(); - return 0; -} - -void SvxBorderTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - FillValueSets(); - - SfxTabPage::DataChanged( rDCEvt ); -} - -void SvxBorderTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pSWModeItem,SfxUInt16Item,SID_SWMODE_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - if (pSWModeItem) - { - nSWMode = pSWModeItem->GetValue(); - // #i43593# - // show checkbox for format.paragraph - if ( nSWMode == SW_BORDER_MODE_PARA ) - { - aMergeWithNextCB.Show(); - aPropertiesFL.Show(); - } - // show checkbox for format.paragraph - else if ( nSWMode == SW_BORDER_MODE_TABLE ) - { - aMergeAdjacentBordersCB.Show(); - aPropertiesFL.Show(); - } - } - if (pFlagItem) - if ( ( pFlagItem->GetValue() & SVX_HIDESHADOWCTL ) == SVX_HIDESHADOWCTL ) - HideShadowControls(); -} - -// ============================================================================ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/border.hrc b/cui/source/tabpages/border.hrc deleted file mode 100644 index 4dcfbf171..000000000 --- a/cui/source/tabpages/border.hrc +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_BORDER_HRC -#define _SVX_BORDER_HRC - -// defines ------------------------------------------------------------------ - -#define FL_BORDER 10 -#define WIN_PRESETS 11 -#define WIN_FRAMESEL 12 - -#define FL_SEPARATOR1 19 -#define FL_LINE 20 -#define LB_LINESTYLE 21 -#define LB_LINECOLOR 22 -#define MF_LINEWIDTH 23 - -#define FL_SEPARATOR2 29 -#define FL_SHADOW 30 -#define FT_SHADOWPOS 31 -#define WIN_SHADOWS 32 -#define FT_SHADOWSIZE 33 -#define ED_SHADOWSIZE 34 -#define FT_SHADOWCOLOR 35 -#define LB_SHADOWCOLOR 36 - -#define FT_XSPACE 41 -#define ED_XSPACE 42 - -#define FL_DISTANCE 50 -#define FT_LEFT 51 -#define MF_LEFT 52 -#define FT_RIGHT 53 -#define MF_RIGHT 54 -#define FT_TOP 55 -#define MF_TOP 56 -#define FT_BOTTOM 57 -#define MF_BOTTOM 58 -#define CB_SYNC 59 -#define FT_DEFAULT 60 -#define FT_USERDEF 61 -#define FT_STYLE 62 -#define FT_COLOR 63 -#define FL_PROPERTIES 64 -#define CB_MERGEWITHNEXT 65 -#define CB_MERGEADJACENTBORDERS 66 -#define FT_WIDTH 67 - -// ImageListe fuer ValueSets: -#define IL_PRE_BITMAPS 1400 -#define IID_PRE_CELL_NONE 1 -#define IID_PRE_CELL_ALL 2 -#define IID_PRE_CELL_LR 3 -#define IID_PRE_CELL_TB 4 -#define IID_PRE_CELL_L 5 -#define IID_PRE_CELL_DIAG 6 -#define IID_PRE_HOR_NONE 7 -#define IID_PRE_HOR_OUTER 8 -#define IID_PRE_HOR_HOR 9 -#define IID_PRE_HOR_ALL 10 -#define IID_PRE_HOR_OUTER2 11 -#define IID_PRE_VER_NONE 12 -#define IID_PRE_VER_OUTER 13 -#define IID_PRE_VER_VER 14 -#define IID_PRE_VER_ALL 15 -#define IID_PRE_VER_OUTER2 16 -#define IID_PRE_TABLE_NONE 17 -#define IID_PRE_TABLE_OUTER 18 -#define IID_PRE_TABLE_OUTERH 19 -#define IID_PRE_TABLE_ALL 20 -#define IID_PRE_TABLE_OUTER2 21 - -#define IL_SDW_BITMAPS 1500 -#define IID_SHADOWNONE 1 -#define IID_SHADOW_BOT_RIGHT 2 -#define IID_SHADOW_BOT_LEFT 3 -#define IID_SHADOW_TOP_RIGHT 4 -#define IID_SHADOW_TOP_LEFT 5 - - -#endif - diff --git a/cui/source/tabpages/border.src b/cui/source/tabpages/border.src deleted file mode 100644 index 10599d5e8..000000000 --- a/cui/source/tabpages/border.src +++ /dev/null @@ -1,449 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include -#include "border.hrc" -#include - - // define --------------------------------------------------------------- -#define STD_MASKCOLOR Color { Red=0xFFFF; Green=0x0000; Blue=0xFFFF; } - // RID_SVXPAGE_BORDER --------------------------------------------------- -TabPage RID_SVXPAGE_BORDER -{ - Size = MAP_APPFONT ( 260 , 185 ) ; - Helpid = HID_BORDER ; - Hide = TRUE ; - Text [ en-US ] = "Borders" ; - FixedLine FL_BORDER - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Line arrangement" ; - }; - FixedText FT_DEFAULT - { - Pos = MAP_APPFONT ( 12, 14) ; - Size = MAP_APPFONT ( 64, 8) ; - Text [ en-US ] = "~Default"; - }; - Control WIN_PRESETS - { - HelpId = HID_BORDER_CTL_PRESETS ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 61 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_USERDEF - { - Pos = MAP_APPFONT (12 , 41) ; - Size = MAP_APPFONT ( 64, 8) ; - Text [ en-US ] = "~User-defined"; - }; - Control WIN_FRAMESEL - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 61 , 65 ) ; - TabStop = TRUE ; - Text = "Border control"; - }; - FixedLine FL_SEPARATOR1 - { - Pos = MAP_APPFONT ( 77 , 14 ) ; - Size = MAP_APPFONT ( 4 , 104 ) ; - Vert = TRUE ; - }; - FixedLine FL_LINE - { - Pos = MAP_APPFONT ( 82 , 3 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Text [ en-US ] = "Line" ; - }; - FixedText FT_STYLE - { - Pos = MAP_APPFONT ( 88, 14) ; - Size = MAP_APPFONT ( 77, 8) ; - Text [ en-US ] = "St~yle"; - }; - ListBox LB_LINESTYLE - { - HelpID = "cui:ListBox:RID_SVXPAGE_BORDER:LB_LINESTYLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 88 , 25 ) ; - Size = MAP_APPFONT ( 74 , 66 ) ; - DropDown = TRUE ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( 88, 39 ) ; - Size = MAP_APPFONT ( 77, 8 ) ; - Text [ en-US ] = "~Width"; - }; - MetricField MF_LINEWIDTH - { - Border = TRUE ; - Pos = MAP_APPFONT ( 88 , 50 ) ; - Size = MAP_APPFONT ( 74 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 25 ; - First = 25 ; - Last = 900 ; - Maximum = 900 ; - Minimum = 25 ; - DecimalDigits = 2 ; - Unit = FUNIT_POINT ; - }; - FixedText FT_COLOR - { - Pos = MAP_APPFONT ( 88, 64 ) ; - Size = MAP_APPFONT ( 77, 8 ) ; - Text [ en-US ] = "~Color"; - }; - ListBox LB_LINECOLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_BORDER:LB_LINECOLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 88 , 75 ) ; - Size = MAP_APPFONT ( 74 , 68 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedLine FL_SEPARATOR2 - { - Pos = MAP_APPFONT ( 166 , 14 ) ; - Size = MAP_APPFONT ( 4 , 104 ) ; - Vert = TRUE ; - }; - FixedText FT_LEFT - { - Pos = MAP_APPFONT ( 177 , 16 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "~Left"; - }; - MetricField MF_LEFT - { - HelpID = "cui:MetricField:RID_SVXPAGE_BORDER:MF_LEFT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 213 , 14 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 10 ; - First = 100 ; - Last = 5000 ; - Maximum = 5000 ; - Minimum = 0 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - }; - FixedText FT_RIGHT - { - Pos = MAP_APPFONT ( 177 , 32 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "Right"; - }; - MetricField MF_RIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_BORDER:MF_RIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 213 , 30 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 10 ; - First = 100 ; - Last = 5000 ; - Maximum = 5000 ; - Minimum = 0 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - }; - FixedText FT_TOP - { - Pos = MAP_APPFONT ( 177 , 48 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "~Top"; - }; - MetricField MF_TOP - { - HelpID = "cui:MetricField:RID_SVXPAGE_BORDER:MF_TOP"; - Border = TRUE ; - Pos = MAP_APPFONT ( 213 , 46 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 10 ; - First = 100 ; - Last = 5000 ; - Maximum = 5000 ; - Minimum = 0 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - }; - FixedText FT_BOTTOM - { - Pos = MAP_APPFONT ( 177 , 64 ) ; - Size = MAP_APPFONT ( 34 , 8 ) ; - Text [ en-US ] = "~Bottom"; - }; - MetricField MF_BOTTOM - { - HelpID = "cui:MetricField:RID_SVXPAGE_BORDER:MF_BOTTOM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 213 , 62 ) ; - Size = MAP_APPFONT ( 38 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 10 ; - First = 100 ; - Last = 5000 ; - Maximum = 5000 ; - Minimum = 0 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - }; - CheckBox CB_SYNC - { - HelpID = "cui:CheckBox:RID_SVXPAGE_BORDER:CB_SYNC"; - Pos = MAP_APPFONT ( 177 , 78 ) ; - Size = MAP_APPFONT ( 74 , 10 ) ; - Text [ en-US ] = "Synchronize"; - }; - FixedLine FL_DISTANCE - { - Pos = MAP_APPFONT ( 171 , 3 ) ; - Size = MAP_APPFONT ( 83 , 8 ) ; - Text [ en-US ] = "Spacing to contents"; - }; - - FixedText FT_SHADOWPOS - { - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 74 , 8 ) ; - Text [ en-US ] = "~Position" ; - }; - Control WIN_SHADOWS - { - HelpId = HID_BORDER_CTL_SHADOWS ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 12 , 144 ) ; - Size = MAP_APPFONT ( 74 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_SHADOWSIZE - { - Pos = MAP_APPFONT ( 88 , 133 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Distan~ce"; - }; - MetricField ED_SHADOWSIZE - { - HelpID = "cui:MetricField:RID_SVXPAGE_BORDER:ED_SHADOWSIZE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 88 , 144 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Spin = TRUE ; - Repeat = TRUE ; - SpinSize = 10 ; - First = 100 ; - Last = 5000 ; - Maximum = 5000 ; - Minimum = 50 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - }; - FixedText FT_SHADOWCOLOR - { - Pos = MAP_APPFONT ( 177 , 133 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "C~olor" ; - }; - ListBox LB_SHADOWCOLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_BORDER:LB_SHADOWCOLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 177 , 144 ) ; - Size = MAP_APPFONT ( 74 , 68 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedLine FL_SHADOW - { - Pos = MAP_APPFONT ( 6 , 123 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Shadow style" ; - }; - FixedLine FL_PROPERTIES - { - Pos = MAP_APPFONT ( 6 , 162 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "Properties" ; - }; - CheckBox CB_MERGEWITHNEXT - { - HelpID = "cui:CheckBox:RID_SVXPAGE_BORDER:CB_MERGEWITHNEXT"; - Pos = MAP_APPFONT ( 12 , 173 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Hide = TRUE; - Text [ en-US ] = "~Merge with next paragraph" ; - }; - CheckBox CB_MERGEADJACENTBORDERS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_BORDER:CB_MERGEADJACENTBORDERS"; - Pos = MAP_APPFONT ( 12 , 173 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Hide = TRUE; - Text [ en-US ] = "~Merge adjacent line styles" ; - }; - -#define _PREVIEW_IDLIST_ \ - IdList = \ - { \ - IID_PRE_CELL_NONE ; \ - IID_PRE_CELL_ALL ; \ - IID_PRE_CELL_LR ; \ - IID_PRE_CELL_TB ; \ - IID_PRE_CELL_L ; \ - IID_PRE_CELL_DIAG ; \ - IID_PRE_HOR_NONE ; \ - IID_PRE_HOR_OUTER ; \ - IID_PRE_HOR_HOR ; \ - IID_PRE_HOR_ALL ; \ - IID_PRE_HOR_OUTER2 ; \ - IID_PRE_VER_NONE ; \ - IID_PRE_VER_OUTER ; \ - IID_PRE_VER_VER ; \ - IID_PRE_VER_ALL ; \ - IID_PRE_VER_OUTER2 ; \ - IID_PRE_TABLE_NONE ; \ - IID_PRE_TABLE_OUTER ; \ - IID_PRE_TABLE_OUTERH ; \ - IID_PRE_TABLE_ALL ; \ - IID_PRE_TABLE_OUTER2 ; \ - }; \ - IdCount = { 21 ; }; - - ImageList IL_PRE_BITMAPS - { - Prefix = "pr"; - MaskColor = STD_MASKCOLOR ; - _PREVIEW_IDLIST_ - }; - -#define _SHADOW_IDLIST_ \ - IdList = \ - { \ - IID_SHADOWNONE ; \ - IID_SHADOW_BOT_RIGHT ; \ - IID_SHADOW_BOT_LEFT ; \ - IID_SHADOW_TOP_RIGHT ; \ - IID_SHADOW_TOP_LEFT ; \ - }; \ - IdCount = { 5 ; }; - - ImageList IL_SDW_BITMAPS - { - Prefix = "sh"; - MaskColor = STD_MASKCOLOR ; - _SHADOW_IDLIST_ - }; -}; - -String RID_SVXSTR_TABLE_PRESET_NONE -{ - Text [ en-US ] = "Set No Borders" ; -}; -String RID_SVXSTR_TABLE_PRESET_ONLYOUTER -{ - Text [ en-US ] = "Set Outer Border Only" ; -}; -String RID_SVXSTR_TABLE_PRESET_OUTERHORI -{ - Text [ en-US ] = "Set Outer Border and Horizontal Lines" ; -}; -String RID_SVXSTR_TABLE_PRESET_OUTERALL -{ - Text [ en-US ] = "Set Outer Border and All Inner Lines" ; -}; -String RID_SVXSTR_TABLE_PRESET_OUTERINNER -{ - Text [ en-US ] = "Set Outer Border Without Changing Inner Lines" ; -}; -String RID_SVXSTR_PARA_PRESET_DIAGONAL -{ - Text [ en-US ] = "Set Diagonal Lines Only" ; -}; -String RID_SVXSTR_PARA_PRESET_ALL -{ - Text [ en-US ] = "Set All Four Borders" ; -}; -String RID_SVXSTR_PARA_PRESET_LEFTRIGHT -{ - Text [ en-US ] = "Set Left and Right Borders Only" ; -}; -String RID_SVXSTR_PARA_PRESET_TOPBOTTOM -{ - Text [ en-US ] = "Set Top and Bottom Borders Only" ; -}; -String RID_SVXSTR_PARA_PRESET_ONLYLEFT -{ - Text [ en-US ] = "Set Left Border Only" ; -}; -String RID_SVXSTR_HOR_PRESET_ONLYHOR -{ - Text [ en-US ] = "Set Top and Bottom Borders, and All Inner Lines"; -}; -String RID_SVXSTR_VER_PRESET_ONLYVER -{ - Text [ en-US ] = "Set Left and Right Borders, and All Inner Lines"; -}; -String RID_SVXSTR_SHADOW_STYLE_NONE -{ - Text [ en-US ] = "No Shadow" ; -}; -String RID_SVXSTR_SHADOW_STYLE_BOTTOMRIGHT -{ - Text [ en-US ] = "Cast Shadow to Bottom Right" ; -}; -String RID_SVXSTR_SHADOW_STYLE_TOPRIGHT -{ - Text [ en-US ] = "Cast Shadow to Top Right" ; -}; -String RID_SVXSTR_SHADOW_STYLE_BOTTOMLEFT -{ - Text [ en-US ] = "Cast Shadow to Bottom Left" ; -}; -String RID_SVXSTR_SHADOW_STYLE_TOPLEFT -{ - Text [ en-US ] = "Cast Shadow to Top Left" ; -}; - -// ********************************************************************** diff --git a/cui/source/tabpages/borderconn.cxx b/cui/source/tabpages/borderconn.cxx deleted file mode 100644 index 263eb95c4..000000000 --- a/cui/source/tabpages/borderconn.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "borderconn.hxx" -#include -#include "editeng/bolnitem.hxx" -#include -#include -#include - -namespace svx { - -/* ============================================================================ -SvxLineItem connection ----------------------- -Connects an SvxLineItem (that contains the style of one line of a cell border) -with one frame border from a svx::FrameSelector control. If this connection is -used, no additional code is needed in the Reset() and FillItemSet() functions -of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -class LineItemWrapper : public sfx::SingleItemWrapper< SvxLineItem, const editeng::SvxBorderLine* > -{ -public: - inline explicit LineItemWrapper( sal_uInt16 nSlot ) : SingleItemWrapperType( nSlot ) {} - - virtual const editeng::SvxBorderLine* GetItemValue( const SvxLineItem& rItem ) const - { return rItem.GetLine(); } - virtual void SetItemValue( SvxLineItem& rItem, const editeng::SvxBorderLine* pLine ) const - { rItem.SetLine( pLine ); } -}; - -// 2nd: control wrappers ------------------------------------------------------ - -class FrameSelectorWrapper : public sfx::SingleControlWrapper< FrameSelector, const editeng::SvxBorderLine* > -{ -public: - inline explicit FrameSelectorWrapper( FrameSelector& rFrameSel, FrameBorderType eBorder ) : - SingleControlWrapperType( rFrameSel ), meBorder( eBorder ) {} - - virtual bool IsControlDontKnow() const; - virtual void SetControlDontKnow( bool bSet ); - - virtual const editeng::SvxBorderLine* GetControlValue() const; - virtual void SetControlValue( const editeng::SvxBorderLine* pLine ); - -private: - FrameBorderType meBorder; /// The line this wrapper works with. -}; - -bool FrameSelectorWrapper::IsControlDontKnow() const -{ - return GetControl().GetFrameBorderState( meBorder ) == FRAMESTATE_DONTCARE; -} - -void FrameSelectorWrapper::SetControlDontKnow( bool bSet ) -{ - if( bSet ) - GetControl().SetBorderDontCare( meBorder ); -} - -const editeng::SvxBorderLine* FrameSelectorWrapper::GetControlValue() const -{ - return GetControl().GetFrameBorderStyle( meBorder ); -} - -void FrameSelectorWrapper::SetControlValue( const editeng::SvxBorderLine* pLine ) -{ - GetControl().ShowBorder( meBorder, pLine ); -} - -// 3rd: connection ------------------------------------------------------------ - -typedef sfx::ItemControlConnection< LineItemWrapper, FrameSelectorWrapper > FrameLineConnection; - -/* ============================================================================ -SvxMarginItem connection ------------------------- -Connects an SvxMarginItem (that contains the inner margin of all cell borders) -with the numerical edit controls of the SvxBorderTabPage. If this connection is -used, no additional code is needed in the Reset() and FillItemSet() functions -of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -typedef sfx::IdentItemWrapper< SvxMarginItem > MarginItemWrapper; - -// 2nd: control wrappers ------------------------------------------------------ - -class MarginControlsWrapper : public sfx::MultiControlWrapper< SvxMarginItem > -{ -public: - explicit MarginControlsWrapper( - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom ); - - virtual SvxMarginItem GetControlValue() const; - virtual void SetControlValue( SvxMarginItem aItem ); - -private: - sfx::Int16MetricFieldWrapper maLeftWrp; - sfx::Int16MetricFieldWrapper maRightWrp; - sfx::Int16MetricFieldWrapper maTopWrp; - sfx::Int16MetricFieldWrapper maBottomWrp; -}; - -MarginControlsWrapper::MarginControlsWrapper( - MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom ) : - maLeftWrp( rMfLeft, FUNIT_TWIP ), - maRightWrp( rMfRight, FUNIT_TWIP ), - maTopWrp( rMfTop, FUNIT_TWIP ), - maBottomWrp( rMfBottom, FUNIT_TWIP ) -{ - RegisterControlWrapper( maLeftWrp ); - RegisterControlWrapper( maRightWrp ); - RegisterControlWrapper( maTopWrp ); - RegisterControlWrapper( maBottomWrp ); -} - -SvxMarginItem MarginControlsWrapper::GetControlValue() const -{ - SvxMarginItem aItem( GetDefaultValue() ); - if( !maLeftWrp.IsControlDontKnow() ) - aItem.SetLeftMargin( maLeftWrp.GetControlValue() ); - if( !maRightWrp.IsControlDontKnow() ) - aItem.SetRightMargin( maRightWrp.GetControlValue() ); - if( !maTopWrp.IsControlDontKnow() ) - aItem.SetTopMargin( maTopWrp.GetControlValue() ); - if( !maBottomWrp.IsControlDontKnow() ) - aItem.SetBottomMargin( maBottomWrp.GetControlValue() ); - return aItem; -} - -void MarginControlsWrapper::SetControlValue( SvxMarginItem aItem ) -{ - maLeftWrp.SetControlValue( aItem.GetLeftMargin() ); - maRightWrp.SetControlValue( aItem.GetRightMargin() ); - maTopWrp.SetControlValue( aItem.GetTopMargin() ); - maBottomWrp.SetControlValue( aItem.GetBottomMargin() ); -} - -// 3rd: connection ------------------------------------------------------------ - -class MarginConnection : public sfx::ItemControlConnection< MarginItemWrapper, MarginControlsWrapper > -{ -public: - explicit MarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom, - sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); -}; - -MarginConnection::MarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, MetricField& rMfTop, MetricField& rMfBottom, - sfx::ItemConnFlags nFlags ) : - ItemControlConnectionType( SID_ATTR_ALIGN_MARGIN, new MarginControlsWrapper( rMfLeft, rMfRight, rMfTop, rMfBottom ), nFlags ) -{ - mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); -} - -/* ============================================================================ -SvxShadowItem connection ------------------------- -Connects an SvxShadowItem (that contains shadow position, size, and color) with -the controls of the SvxBorderTabPage. If this connection is used, no additional -code is needed in the Reset() and FillItemSet() functions of the tab page. -============================================================================ */ - -// 1st: item wrappers --------------------------------------------------------- - -typedef sfx::IdentItemWrapper< SvxShadowItem > ShadowItemWrapper; - -// 2nd: control wrappers ------------------------------------------------------ - -typedef sfx::ValueSetWrapper< SvxShadowLocation > ShadowPosWrapper; -static const ShadowPosWrapper::MapEntryType s_pShadowPosMap[] = -{ - { 1, SVX_SHADOW_NONE }, - { 2, SVX_SHADOW_BOTTOMRIGHT }, - { 3, SVX_SHADOW_TOPRIGHT }, - { 4, SVX_SHADOW_BOTTOMLEFT }, - { 5, SVX_SHADOW_TOPLEFT }, - { VALUESET_ITEM_NOTFOUND, SVX_SHADOW_NONE } -}; - -class ShadowControlsWrapper : public sfx::MultiControlWrapper< SvxShadowItem > -{ -public: - explicit ShadowControlsWrapper( ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ); - - virtual SvxShadowItem GetControlValue() const; - virtual void SetControlValue( SvxShadowItem aItem ); - -private: - ShadowPosWrapper maPosWrp; - sfx::UShortMetricFieldWrapper maSizeWrp; - sfx::ColorListBoxWrapper maColorWrp; -}; - -ShadowControlsWrapper::ShadowControlsWrapper( - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor ) : - maPosWrp( rVsPos, s_pShadowPosMap ), - maSizeWrp( rMfSize, FUNIT_TWIP ), - maColorWrp( rLbColor ) -{ - RegisterControlWrapper( maPosWrp ); - RegisterControlWrapper( maSizeWrp ); - RegisterControlWrapper( maColorWrp ); -} - -SvxShadowItem ShadowControlsWrapper::GetControlValue() const -{ - SvxShadowItem aItem( GetDefaultValue() ); - if( !maPosWrp.IsControlDontKnow() ) - aItem.SetLocation( maPosWrp.GetControlValue() ); - if( !maSizeWrp.IsControlDontKnow() ) - aItem.SetWidth( maSizeWrp.GetControlValue() ); - if( !maColorWrp.IsControlDontKnow() ) - aItem.SetColor( maColorWrp.GetControlValue() ); - return aItem; -} - -void ShadowControlsWrapper::SetControlValue( SvxShadowItem aItem ) -{ - maPosWrp.SetControlValue( aItem.GetLocation() ); - maSizeWrp.SetControlValue( aItem.GetWidth() ); - maColorWrp.SetControlValue( aItem.GetColor() ); -} - -// 3rd: connection ------------------------------------------------------------ - -class ShadowConnection : public sfx::ItemControlConnection< ShadowItemWrapper, ShadowControlsWrapper > -{ -public: - explicit ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, - sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); -}; - -ShadowConnection::ShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, sfx::ItemConnFlags nFlags ) : - ItemControlConnectionType( SID_ATTR_BORDER_SHADOW, new ShadowControlsWrapper( rVsPos, rMfSize, rLbColor ), nFlags ) -{ - mxCtrlWrp->SetDefaultValue( maItemWrp.GetDefaultItem( rItemSet ) ); -} - -// ============================================================================ -// ============================================================================ - -sfx::ItemConnectionBase* CreateFrameLineConnection( sal_uInt16 nSlot, - FrameSelector& rFrameSel, FrameBorderType eBorder, sfx::ItemConnFlags nFlags ) -{ - return new FrameLineConnection( nSlot, new FrameSelectorWrapper( rFrameSel, eBorder ), nFlags ); -} - -sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom, - sfx::ItemConnFlags nFlags ) -{ - return new MarginConnection( rItemSet, rMfLeft, rMfRight, rMfTop, rMfBottom, nFlags ); -} - -sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, - sfx::ItemConnFlags nFlags ) -{ - return new ShadowConnection( rItemSet, rVsPos, rMfSize, rLbColor, nFlags ); -} - -// ============================================================================ - -} // namespace svx - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/borderconn.hxx b/cui/source/tabpages/borderconn.hxx deleted file mode 100644 index 1993787f8..000000000 --- a/cui/source/tabpages/borderconn.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_BORDERCONN_HXX -#define SVX_BORDERCONN_HXX - -#include -#include - -class SfxItemSet; -class MetricField; -class ValueSet; -class ColorListBox; - -namespace svx { - -class FrameSelector; - -// ============================================================================ - -/** Creates an item connection object that connects an SvxLineItem with an - svx::FrameSelector control. */ -sfx::ItemConnectionBase* CreateFrameLineConnection( sal_uInt16 nSlot, - FrameSelector& rFrameSel, FrameBorderType eBorder, - sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); - -/** Creates an item connection object that connects an SvxMarginItem with the - controls of the SvxBorderTabPage. */ -sfx::ItemConnectionBase* CreateMarginConnection( const SfxItemSet& rItemSet, - MetricField& rMfLeft, MetricField& rMfRight, - MetricField& rMfTop, MetricField& rMfBottom, - sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); - -/** Creates an item connection object that connects an SvxShadowItem with the - controls of the SvxBorderTabPage. */ -sfx::ItemConnectionBase* CreateShadowConnection( const SfxItemSet& rItemSet, - ValueSet& rVsPos, MetricField& rMfSize, ColorListBox& rLbColor, - sfx::ItemConnFlags nFlags = sfx::ITEMCONN_DEFAULT ); - -// ============================================================================ - -} // namespace svx - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx deleted file mode 100644 index daf8b6d6d..000000000 --- a/cui/source/tabpages/chardlg.cxx +++ /dev/null @@ -1,3754 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_CHARDLG_CXX -#include - -#include "chardlg.hrc" - -#include // XColorTable -#include "chardlg.hxx" -#include "editeng/fontitem.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "editeng/flstitem.hxx" -#include -#include -#include -#include "svx/drawitem.hxx" -#include "svx/dlgutil.hxx" -#include -#include "svx/htmlmode.hxx" -#include "cuicharmap.hxx" -#include "chardlg.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "svx/flagsdef.hxx" - -using namespace ::com::sun::star; - -// define ---------------------------------------------------------------- - -#define ISITEMSET rSet.GetItemState(nWhich)>=SFX_ITEM_DEFAULT - -#define CLEARTITEM rSet.InvalidateItem(nWhich) - -#define LW_NORMAL 0 -#define LW_GESPERRT 1 -#define LW_SCHMAL 2 - -// static ---------------------------------------------------------------- - -static sal_uInt16 pNameRanges[] = -{ - SID_ATTR_CHAR_FONT, - SID_ATTR_CHAR_WEIGHT, - SID_ATTR_CHAR_FONTHEIGHT, - SID_ATTR_CHAR_FONTHEIGHT, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_LANGUAGE, - SID_ATTR_CHAR_LANGUAGE, - SID_ATTR_CHAR_CJK_FONT, - SID_ATTR_CHAR_CJK_WEIGHT, - SID_ATTR_CHAR_CTL_FONT, - SID_ATTR_CHAR_CTL_WEIGHT, - 0 -}; - -static sal_uInt16 pEffectsRanges[] = -{ - SID_ATTR_CHAR_SHADOWED, - SID_ATTR_CHAR_UNDERLINE, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_CASEMAP, - SID_ATTR_CHAR_CASEMAP, - SID_ATTR_FLASH, - SID_ATTR_FLASH, - SID_ATTR_CHAR_EMPHASISMARK, - SID_ATTR_CHAR_EMPHASISMARK, - SID_ATTR_CHAR_RELIEF, - SID_ATTR_CHAR_RELIEF, - SID_ATTR_CHAR_HIDDEN, - SID_ATTR_CHAR_HIDDEN, - SID_ATTR_CHAR_OVERLINE, - SID_ATTR_CHAR_OVERLINE, - 0 -}; - -static sal_uInt16 pPositionRanges[] = -{ - SID_ATTR_CHAR_KERNING, - SID_ATTR_CHAR_KERNING, - SID_ATTR_CHAR_ESCAPEMENT, - SID_ATTR_CHAR_ESCAPEMENT, - SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_ROTATED, - SID_ATTR_CHAR_SCALEWIDTH, - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, - 0 -}; - -static sal_uInt16 pTwoLinesRanges[] = -{ - SID_ATTR_CHAR_TWO_LINES, - SID_ATTR_CHAR_TWO_LINES, - 0 -}; - -// C-Funktion ------------------------------------------------------------ - -inline sal_Bool StateToAttr( TriState aState ) -{ - return ( STATE_CHECK == aState ); -} - -// class SvxCharBasePage ------------------------------------------------- - -inline SvxFont& SvxCharBasePage::GetPreviewFont() -{ - return m_aPreviewWin.GetFont(); -} - -// ----------------------------------------------------------------------- - -inline SvxFont& SvxCharBasePage::GetPreviewCJKFont() -{ - return m_aPreviewWin.GetCJKFont(); -} -// ----------------------------------------------------------------------- - -inline SvxFont& SvxCharBasePage::GetPreviewCTLFont() -{ - return m_aPreviewWin.GetCTLFont(); -} - -// ----------------------------------------------------------------------- - -SvxCharBasePage::SvxCharBasePage( Window* pParent, const ResId& rResId, const SfxItemSet& rItemset, - sal_uInt16 nResIdPrewievWin, sal_uInt16 nResIdFontTypeFT ): - SfxTabPage( pParent, rResId, rItemset ), - m_aPreviewWin( this, ResId( nResIdPrewievWin, *rResId.GetResMgr() ) ), - m_aFontTypeFT( this, ResId( nResIdFontTypeFT, *rResId.GetResMgr() ) ), - m_bPreviewBackgroundToCharacter( sal_False ) -{ -} - -// ----------------------------------------------------------------------- - -SvxCharBasePage::~SvxCharBasePage() -{ -} - -// ----------------------------------------------------------------------- - -void SvxCharBasePage::ActivatePage( const SfxItemSet& rSet ) -{ - m_aPreviewWin.SetFromItemSet( rSet, m_bPreviewBackgroundToCharacter ); -} - - -// ----------------------------------------------------------------------- - -void SvxCharBasePage::SetPrevFontWidthScale( const SfxItemSet& rSet ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); - if( ISITEMSET ) - { - const SvxCharScaleWidthItem &rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); - m_aPreviewWin.SetFontWidthScale( rItem.GetValue() ); - } -} - -// ----------------------------------------------------------------------- -namespace -{ - // ----------------------------------------------------------------------- - void setPrevFontEscapement(SvxFont& _rFont,sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) - { - _rFont.SetPropr( nProp ); - _rFont.SetProprRel( nEscProp ); - _rFont.SetEscapement( nEsc ); - } - // ----------------------------------------------------------------------- - // ----------------------------------------------------------------------- -} -// ----------------------------------------------------------------------- - -void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) -{ - setPrevFontEscapement(GetPreviewFont(),nProp,nEscProp,nEsc); - setPrevFontEscapement(GetPreviewCJKFont(),nProp,nEscProp,nEsc); - setPrevFontEscapement(GetPreviewCTLFont(),nProp,nEscProp,nEsc); - m_aPreviewWin.Invalidate(); -} - -// SvxCharNamePage_Impl -------------------------------------------------- - -struct SvxCharNamePage_Impl -{ - Timer m_aUpdateTimer; - String m_aNoStyleText; - String m_aTransparentText; - const FontList* m_pFontList; - sal_uInt16 m_nExtraEntryPos; - sal_Bool m_bMustDelete; - sal_Bool m_bInSearchMode; - - SvxCharNamePage_Impl() : - - m_pFontList ( NULL ), - m_nExtraEntryPos( LISTBOX_ENTRY_NOTFOUND ), - m_bMustDelete ( sal_False ), - m_bInSearchMode ( sal_False ) - - { - m_aUpdateTimer.SetTimeout( 350 ); - } - - ~SvxCharNamePage_Impl() - { - if ( m_bMustDelete ) - delete m_pFontList; - } -}; - -// class SvxCharNamePage ------------------------------------------------- - -SvxCharNamePage::SvxCharNamePage( Window* pParent, const SfxItemSet& rInSet ) : - - SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_NAME ), rInSet, WIN_CHAR_PREVIEW, FT_CHAR_FONTTYPE ), - m_pImpl ( new SvxCharNamePage_Impl ) -{ - m_pImpl->m_aNoStyleText = String( CUI_RES( STR_CHARNAME_NOSTYLE ) ); - m_pImpl->m_aTransparentText = String( CUI_RES( STR_CHARNAME_TRANSPARENT ) ); - - SvtLanguageOptions aLanguageOptions; - sal_Bool bCJK = ( aLanguageOptions.IsCJKFontEnabled() || aLanguageOptions.IsCTLFontEnabled() ); - - m_pWestLine = new FixedLine( this, CUI_RES( FL_WEST ) ); - m_pWestFontNameFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_NAME : FT_WEST_NAME_NOCJK ) ); - m_pWestFontNameLB = new FontNameBox( this, CUI_RES( bCJK ? LB_WEST_NAME : LB_WEST_NAME_NOCJK ) ); - m_pWestFontStyleFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_STYLE : FT_WEST_STYLE_NOCJK ) ); - m_pWestFontStyleLB = new FontStyleBox( this, CUI_RES( bCJK ? LB_WEST_STYLE : LB_WEST_STYLE_NOCJK ) ); - m_pWestFontSizeFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_SIZE : FT_WEST_SIZE_NOCJK ) ); - m_pWestFontSizeLB = new FontSizeBox( this, CUI_RES( bCJK ? LB_WEST_SIZE : LB_WEST_SIZE_NOCJK ) ); - - if( !bCJK ) - { - m_pColorFL = new FixedLine( this, CUI_RES( FL_COLOR2 ) ); - m_pColorFT = new FixedText( this, CUI_RES( FT_COLOR2 ) ); - m_pColorLB = new ColorListBox( this, CUI_RES( LB_COLOR2 ) ); - } - - m_pWestFontLanguageFT = new FixedText( this, CUI_RES( bCJK ? FT_WEST_LANG : FT_WEST_LANG_NOCJK ) ); - m_pWestFontLanguageLB = new SvxLanguageBox( this, CUI_RES( bCJK ? LB_WEST_LANG : LB_WEST_LANG_NOCJK ) ); - - m_pEastLine = new FixedLine( this, CUI_RES( FL_EAST ) ); - m_pEastFontNameFT = new FixedText( this, CUI_RES( FT_EAST_NAME ) ); - m_pEastFontNameLB = new FontNameBox( this, CUI_RES( LB_EAST_NAME ) ); - m_pEastFontStyleFT = new FixedText( this, CUI_RES( FT_EAST_STYLE ) ); - m_pEastFontStyleLB = new FontStyleBox( this, CUI_RES( LB_EAST_STYLE ) ); - m_pEastFontSizeFT = new FixedText( this, CUI_RES( FT_EAST_SIZE ) ); - m_pEastFontSizeLB = new FontSizeBox( this, CUI_RES( LB_EAST_SIZE ) ); - m_pEastFontLanguageFT = new FixedText( this, CUI_RES( FT_EAST_LANG ) ); - m_pEastFontLanguageLB = new SvxLanguageBox( this, CUI_RES( LB_EAST_LANG ) ); - - m_pCTLLine = new FixedLine( this, CUI_RES( FL_CTL ) ); - m_pCTLFontNameFT = new FixedText( this, CUI_RES( FT_CTL_NAME ) ); - m_pCTLFontNameLB = new FontNameBox( this, CUI_RES( LB_CTL_NAME ) ); - m_pCTLFontStyleFT = new FixedText( this, CUI_RES( FT_CTL_STYLE ) ); - m_pCTLFontStyleLB = new FontStyleBox( this, CUI_RES( LB_CTL_STYLE ) ); - m_pCTLFontSizeFT = new FixedText( this, CUI_RES( FT_CTL_SIZE ) ); - m_pCTLFontSizeLB = new FontSizeBox( this, CUI_RES( LB_CTL_SIZE ) ); - m_pCTLFontLanguageFT = new FixedText( this, CUI_RES( FT_CTL_LANG ) ); - m_pCTLFontLanguageLB = new SvxLanguageBox( this, CUI_RES( LB_CTL_LANG ) ); - - if( bCJK ) - { - m_pColorFL = new FixedLine( this, CUI_RES( FL_COLOR2 ) ); - m_pColorFT = new FixedText( this, CUI_RES( FT_COLOR2 ) ); - m_pColorLB = new ColorListBox( this, CUI_RES( LB_COLOR2 ) ); - } - - //In MacOSX the standard dialogs name font-name, font-style as - //Family, Typeface - //In GNOME the standard dialogs name font-name, font-style as - //Family, Style - //In Windows the standard dialogs name font-name, font-style as - //Font, Style -#ifdef WNT - String sFontFamilyString(CUI_RES(STR_CHARNAME_FONT)); -#else - String sFontFamilyString(CUI_RES(STR_CHARNAME_FAMILY)); -#endif - m_pWestFontNameFT->SetText(sFontFamilyString); - m_pEastFontNameFT->SetText(sFontFamilyString); - m_pCTLFontNameFT->SetText(sFontFamilyString); - -#ifdef MACOSX - String sFontStyleString(CUI_RES(STR_CHARNAME_TYPEFACE)); -#else - String sFontStyleString(CUI_RES(STR_CHARNAME_STYLE)); -#endif - m_pWestFontStyleFT->SetText(sFontStyleString); - m_pEastFontStyleFT->SetText(sFontStyleString); - m_pCTLFontStyleFT->SetText(sFontStyleString); - - m_pWestLine ->Show( bCJK ); - m_pColorFL ->Show( bCJK ); - - bCJK = aLanguageOptions.IsCJKFontEnabled(); - m_pEastLine ->Show( bCJK ); - m_pEastFontNameFT ->Show( bCJK ); - m_pEastFontNameLB ->Show( bCJK ); - m_pEastFontStyleFT ->Show( bCJK ); - m_pEastFontStyleLB ->Show( bCJK ); - m_pEastFontSizeFT ->Show( bCJK ); - m_pEastFontSizeLB ->Show( bCJK ); - m_pEastFontLanguageFT ->Show( bCJK ); - m_pEastFontLanguageLB ->Show( bCJK ); - - sal_Bool bShowCTL = aLanguageOptions.IsCTLFontEnabled(); - if ( bShowCTL && !bCJK ) - { - // move CTL controls to the places of the CJK controls, if these controls aren't visible - m_pCTLLine ->SetPosPixel( m_pEastLine->GetPosPixel() ); - m_pCTLFontNameFT ->SetPosPixel( m_pEastFontNameFT->GetPosPixel() ); - m_pCTLFontNameLB ->SetPosPixel( m_pEastFontNameLB->GetPosPixel() ); - m_pCTLFontStyleFT ->SetPosPixel( m_pEastFontStyleFT->GetPosPixel() ); - m_pCTLFontStyleLB ->SetPosPixel( m_pEastFontStyleLB->GetPosPixel() ); - m_pCTLFontSizeFT ->SetPosPixel( m_pEastFontSizeFT->GetPosPixel() ); - m_pCTLFontSizeLB ->SetPosPixel( m_pEastFontSizeLB->GetPosPixel() ); - m_pCTLFontLanguageFT ->SetPosPixel( m_pEastFontLanguageFT->GetPosPixel() ); - m_pCTLFontLanguageLB ->SetPosPixel( m_pEastFontLanguageLB->GetPosPixel() ); - } - m_pCTLLine ->Show( bShowCTL ); - m_pCTLFontNameFT ->Show( bShowCTL ); - m_pCTLFontNameLB ->Show( bShowCTL ); - m_pCTLFontStyleFT ->Show( bShowCTL ); - m_pCTLFontStyleLB ->Show( bShowCTL ); - m_pCTLFontSizeFT ->Show( bShowCTL ); - m_pCTLFontSizeLB ->Show( bShowCTL ); - m_pCTLFontLanguageFT ->Show( bShowCTL ); - m_pCTLFontLanguageLB ->Show( bShowCTL ); - - FreeResource(); - - m_pWestFontLanguageLB->SetLanguageList( LANG_LIST_WESTERN, sal_True, sal_False, sal_True ); - m_pEastFontLanguageLB->SetLanguageList( LANG_LIST_CJK, sal_True, sal_False, sal_True ); - m_pCTLFontLanguageLB->SetLanguageList( LANG_LIST_CTL, sal_True, sal_False, sal_True ); - - Initialize(); -} - -// ----------------------------------------------------------------------- - -SvxCharNamePage::~SvxCharNamePage() -{ - delete m_pImpl; - - delete m_pWestLine; - delete m_pWestFontNameFT; - delete m_pWestFontNameLB; - delete m_pWestFontStyleFT; - delete m_pWestFontStyleLB; - delete m_pWestFontSizeFT; - delete m_pWestFontSizeLB; - delete m_pWestFontLanguageFT; - delete m_pWestFontLanguageLB; - - delete m_pEastLine; - delete m_pEastFontNameFT; - delete m_pEastFontNameLB; - delete m_pEastFontStyleFT; - delete m_pEastFontStyleLB; - delete m_pEastFontSizeFT; - delete m_pEastFontSizeLB; - delete m_pEastFontLanguageFT; - delete m_pEastFontLanguageLB; - - delete m_pCTLLine; - delete m_pCTLFontNameFT; - delete m_pCTLFontNameLB; - delete m_pCTLFontStyleFT; - delete m_pCTLFontStyleLB; - delete m_pCTLFontSizeFT; - delete m_pCTLFontSizeLB; - delete m_pCTLFontLanguageFT; - delete m_pCTLFontLanguageLB; - - delete m_pColorFL; - delete m_pColorFT; - delete m_pColorLB; -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::Initialize() -{ - // to handle the changes of the other pages - SetExchangeSupport(); - - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - //DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorTable* pColorTable = NULL; - bool bKillTable = false; - const SfxPoolItem* pItem = NULL; - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - } - - if ( !pColorTable ) - { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } - - m_pColorLB->SetUpdateMode( sal_False ); - - { - SfxPoolItem* pDummy; - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); - if( !pFrame || SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( - SID_ATTR_AUTO_COLOR_INVALID, pDummy )) - m_pColorLB->InsertEntry( Color( COL_AUTO ), - SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); - } - for ( long i = 0; i < pColorTable->Count(); i++ ) - { - XColorEntry* pEntry = pColorTable->GetColor(i); - m_pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - m_pColorLB->SetUpdateMode( sal_True ); - - if ( bKillTable ) - delete pColorTable; - - m_pColorLB->SetSelectHdl( LINK( this, SvxCharNamePage, ColorBoxSelectHdl_Impl ) ); - - Link aLink = LINK( this, SvxCharNamePage, FontModifyHdl_Impl ); - m_pWestFontNameLB->SetModifyHdl( aLink ); - m_pWestFontStyleLB->SetModifyHdl( aLink ); - m_pWestFontSizeLB->SetModifyHdl( aLink ); - m_pEastFontNameLB->SetModifyHdl( aLink ); - m_pEastFontStyleLB->SetModifyHdl( aLink ); - m_pEastFontSizeLB->SetModifyHdl( aLink ); - m_pCTLFontNameLB->SetModifyHdl( aLink ); - m_pCTLFontStyleLB->SetModifyHdl( aLink ); - m_pCTLFontSizeLB->SetModifyHdl( aLink ); - - m_pImpl->m_aUpdateTimer.SetTimeoutHdl( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) ); - - m_pColorFL->Hide(); - m_pColorFT->Hide(); - m_pColorLB->Hide(); -} - -// ----------------------------------------------------------------------- - -const FontList* SvxCharNamePage::GetFontList() const -{ - if ( !m_pImpl->m_pFontList ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem; - - /* #110771# SvxFontListItem::GetFontList can return NULL */ - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); - if ( pItem != NULL ) - { - DBG_ASSERT(NULL != ( (SvxFontListItem*)pItem )->GetFontList(), - "Where is the font list?"); - m_pImpl->m_pFontList = static_cast(pItem )->GetFontList()->Clone(); - m_pImpl->m_bMustDelete = sal_True; - } - } - if(!m_pImpl->m_pFontList) - { - m_pImpl->m_pFontList = - new FontList( Application::GetDefaultDevice() ); - m_pImpl->m_bMustDelete = sal_True; - } - } - - return m_pImpl->m_pFontList; -} - -// ----------------------------------------------------------------------------- -namespace -{ - FontInfo calcFontInfo( SvxFont& _rFont, - SvxCharNamePage* _pPage, - const FontNameBox* _pFontNameLB, - const FontStyleBox* _pFontStyleLB, - const FontSizeBox* _pFontSizeLB, - const FontList* _pFontList, - sal_uInt16 _nFontWhich, - sal_uInt16 _nFontHeightWhich) - { - Size aSize = _rFont.GetSize(); - aSize.Width() = 0; - FontInfo aFontInfo; - String sFontName(_pFontNameLB->GetText()); - sal_Bool bFontAvailable = _pFontList->IsAvailable( sFontName ); - if(bFontAvailable || _pFontNameLB->GetSavedValue() != sFontName) - aFontInfo = _pFontList->Get( sFontName, _pFontStyleLB->GetText() ); - else - { - //get the font from itemset - SfxItemState eState = _pPage->GetItemSet().GetItemState( _nFontWhich ); - if ( eState >= SFX_ITEM_DEFAULT ) - { - const SvxFontItem* pFontItem = (const SvxFontItem*)&( _pPage->GetItemSet().Get( _nFontWhich ) ); - aFontInfo.SetName(pFontItem->GetFamilyName()); - aFontInfo.SetStyleName(pFontItem->GetStyleName()); - aFontInfo.SetFamily(pFontItem->GetFamily()); - aFontInfo.SetPitch(pFontItem->GetPitch()); - aFontInfo.SetCharSet(pFontItem->GetCharSet()); - } - } - if ( _pFontSizeLB->IsRelative() ) - { - DBG_ASSERT( _pPage->GetItemSet().GetParent(), "No parent set" ); - const SvxFontHeightItem& rOldItem = (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ); - - // alter Wert, skaliert - long nHeight; - if ( _pFontSizeLB->IsPtRelative() ) - nHeight = rOldItem.GetHeight() + PointToTwips( static_cast(_pFontSizeLB->GetValue() / 10) ); - else - nHeight = static_cast(rOldItem.GetHeight() * _pFontSizeLB->GetValue() / 100); - - // Umrechnung in twips fuer das Beispiel-Window - aSize.Height() = - ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), SFX_FUNIT_TWIP ); - } - else if ( _pFontSizeLB->GetText().Len() ) - aSize.Height() = PointToTwips( static_cast(_pFontSizeLB->GetValue() / 10) ); - else - aSize.Height() = 200; // default 10pt - aFontInfo.SetSize( aSize ); - - _rFont.SetFamily( aFontInfo.GetFamily() ); - _rFont.SetName( aFontInfo.GetName() ); - _rFont.SetStyleName( aFontInfo.GetStyleName() ); - _rFont.SetPitch( aFontInfo.GetPitch() ); - _rFont.SetCharSet( aFontInfo.GetCharSet() ); - _rFont.SetWeight( aFontInfo.GetWeight() ); - _rFont.SetItalic( aFontInfo.GetItalic() ); - _rFont.SetSize( aFontInfo.GetSize() ); - - return aFontInfo; - } -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::UpdatePreview_Impl() -{ - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - // Size - Size aSize = rFont.GetSize(); - aSize.Width() = 0; - Size aCJKSize = rCJKFont.GetSize(); - aCJKSize.Width() = 0; - Size aCTLSize = rCTLFont.GetSize(); - aCTLSize.Width() = 0; - // Font - const FontList* pFontList = GetFontList(); - FontInfo aFontInfo = - calcFontInfo(rFont,this,m_pWestFontNameLB,m_pWestFontStyleLB,m_pWestFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_FONT ),GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); - - calcFontInfo(rCJKFont,this,m_pEastFontNameLB,m_pEastFontStyleLB,m_pEastFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CJK_FONT ),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); - - calcFontInfo(rCTLFont,this,m_pCTLFontNameLB,m_pCTLFontStyleLB,m_pCTLFontSizeLB,pFontList,GetWhich( SID_ATTR_CHAR_CTL_FONT ),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); - - m_aPreviewWin.Invalidate(); - m_aFontTypeFT.SetText( pFontList->GetFontMapText( aFontInfo ) ); -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::FillStyleBox_Impl( const FontNameBox* pNameBox ) -{ - const FontList* pFontList = GetFontList(); - DBG_ASSERT( pFontList, "no fontlist" ); - - FontStyleBox* pStyleBox = NULL; - - if ( m_pWestFontNameLB == pNameBox ) - pStyleBox = m_pWestFontStyleLB; - else if ( m_pEastFontNameLB == pNameBox ) - pStyleBox = m_pEastFontStyleLB; - else if ( m_pCTLFontNameLB == pNameBox ) - pStyleBox = m_pCTLFontStyleLB; - else - { - DBG_ERRORFILE( "invalid font name box" ); - return; - } - - pStyleBox->Fill( pNameBox->GetText(), pFontList ); - - if ( m_pImpl->m_bInSearchMode ) - { - // Bei der Suche zus"atzliche Eintr"age: - // "Nicht Fett" und "Nicht Kursiv" - String aEntry = m_pImpl->m_aNoStyleText; - const sal_Char sS[] = "%1"; - aEntry.SearchAndReplaceAscii( sS, pFontList->GetBoldStr() ); - m_pImpl->m_nExtraEntryPos = pStyleBox->InsertEntry( aEntry ); - aEntry = m_pImpl->m_aNoStyleText; - aEntry.SearchAndReplaceAscii( sS, pFontList->GetItalicStr() ); - pStyleBox->InsertEntry( aEntry ); - } -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::FillSizeBox_Impl( const FontNameBox* pNameBox ) -{ - const FontList* pFontList = GetFontList(); - DBG_ASSERT( pFontList, "no fontlist" ); - - FontStyleBox* pStyleBox = NULL; - FontSizeBox* pSizeBox = NULL; - - if ( m_pWestFontNameLB == pNameBox ) - { - pStyleBox = m_pWestFontStyleLB; - pSizeBox = m_pWestFontSizeLB; - } - else if ( m_pEastFontNameLB == pNameBox ) - { - pStyleBox = m_pEastFontStyleLB; - pSizeBox = m_pEastFontSizeLB; - } - else if ( m_pCTLFontNameLB == pNameBox ) - { - pStyleBox = m_pCTLFontStyleLB; - pSizeBox = m_pCTLFontSizeLB; - } - else - { - DBG_ERRORFILE( "invalid font name box" ); - return; - } - - FontInfo _aFontInfo( pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ); - pSizeBox->Fill( &_aFontInfo, pFontList ); -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp ) -{ - FontNameBox* pNameBox = NULL; - FixedText* pStyleLabel = NULL; - FontStyleBox* pStyleBox = NULL; - FixedText* pSizeLabel = NULL; - FontSizeBox* pSizeBox = NULL; - FixedText* pLangFT = NULL; - SvxLanguageBox* pLangBox = NULL; - sal_uInt16 nWhich = 0; - - switch ( eLangGrp ) - { - case Western : - pNameBox = m_pWestFontNameLB; - pStyleLabel = m_pWestFontStyleFT; - pStyleBox = m_pWestFontStyleLB; - pSizeLabel = m_pWestFontSizeFT; - pSizeBox = m_pWestFontSizeLB; - pLangFT = m_pWestFontLanguageFT; - pLangBox = m_pWestFontLanguageLB; - nWhich = GetWhich( SID_ATTR_CHAR_FONT ); - break; - - case Asian : - pNameBox = m_pEastFontNameLB; - pStyleLabel = m_pEastFontStyleFT; - pStyleBox = m_pEastFontStyleLB; - pSizeLabel = m_pEastFontSizeFT; - pSizeBox = m_pEastFontSizeLB; - pLangFT = m_pEastFontLanguageFT; - pLangBox = m_pEastFontLanguageLB; - nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT ); - break; - - case Ctl : - pNameBox = m_pCTLFontNameLB; - pStyleLabel = m_pCTLFontStyleFT; - pStyleBox = m_pCTLFontStyleLB; - pSizeLabel = m_pCTLFontSizeFT; - pSizeBox = m_pCTLFontSizeLB; - pLangFT = m_pCTLFontLanguageFT; - pLangBox = m_pCTLFontLanguageLB; - nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT ); - break; - } - - // die FontListBox fuellen - const FontList* pFontList = GetFontList(); - pNameBox->Fill( pFontList ); - - // Font ermitteln - const SvxFontItem* pFontItem = NULL; - SfxItemState eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DEFAULT ) - { - pFontItem = (const SvxFontItem*)&( rSet.Get( nWhich ) ); - pNameBox->SetText( pFontItem->GetFamilyName() ); - } - else - { - pNameBox->SetText( String() ); - } - - FillStyleBox_Impl( pNameBox ); - - bool bStyle = false; - bool bStyleAvailable = true; - FontItalic eItalic = ITALIC_NONE; - FontWeight eWeight = WEIGHT_NORMAL; - switch ( eLangGrp ) - { - case Western : nWhich = GetWhich( SID_ATTR_CHAR_POSTURE ); break; - case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_POSTURE ); break; - case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_POSTURE ); break; - } - eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DEFAULT ) - { - const SvxPostureItem& rItem = (SvxPostureItem&)rSet.Get( nWhich ); - eItalic = (FontItalic)rItem.GetValue(); - bStyle = true; - } - bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); - - switch ( eLangGrp ) - { - case Western : nWhich = GetWhich( SID_ATTR_CHAR_WEIGHT ); break; - case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_WEIGHT ); break; - case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_WEIGHT ); break; - } - eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DEFAULT ) - { - SvxWeightItem& rItem = (SvxWeightItem&)rSet.Get( nWhich ); - eWeight = (FontWeight)rItem.GetValue(); - } - else - bStyle = false; - bStyleAvailable = bStyleAvailable && (eState >= SFX_ITEM_DONTCARE); - - // Aktuell eingestellter Font - if ( bStyle && pFontItem ) - { - FontInfo aInfo = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic ); - pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); - } - else if ( !m_pImpl->m_bInSearchMode || !bStyle ) - { - pStyleBox->SetText( String() ); - } - else if ( bStyle ) - { - FontInfo aInfo = pFontList->Get( String(), eWeight, eItalic ); - pStyleBox->SetText( pFontList->GetStyleName( aInfo ) ); - } - if (!bStyleAvailable) - { - pStyleBox->Disable( ); - pStyleLabel->Disable( ); - } - - // SizeBox fuellen - FillSizeBox_Impl( pNameBox ); - switch ( eLangGrp ) - { - case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break; - case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ); break; - case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ); break; - } - eState = rSet.GetItemState( nWhich ); - - if ( pSizeBox->IsRelativeMode() ) - { - SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); - const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); - - if( rItem.GetProp() != 100 || SFX_MAPUNIT_RELATIVE != rItem.GetPropUnit() ) - { - sal_Bool bPtRel = SFX_MAPUNIT_POINT == rItem.GetPropUnit(); - pSizeBox->SetPtRelative( bPtRel ); - pSizeBox->SetValue( bPtRel ? ((short)rItem.GetProp()) * 10 : rItem.GetProp() ); - } - else - { - pSizeBox->SetRelative(); - pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); - } - } - else if ( eState >= SFX_ITEM_DEFAULT ) - { - SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); - const SvxFontHeightItem& rItem = (SvxFontHeightItem&)rSet.Get( nWhich ); - pSizeBox->SetValue( (long)CalcToPoint( rItem.GetHeight(), eUnit, 10 ) ); - } - else - { - pSizeBox->SetText( String() ); - if ( eState <= SFX_ITEM_READONLY ) - { - pSizeBox->Disable( ); - pSizeLabel->Disable( ); - } - } - - switch ( eLangGrp ) - { - case Western : nWhich = GetWhich( SID_ATTR_CHAR_LANGUAGE ); break; - case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break; - case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break; - } - pLangBox->SetNoSelection(); - eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - pLangFT->Hide(); - pLangBox->Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - pLangFT->Disable(); - pLangBox->Disable(); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxLanguageItem& rItem = (SvxLanguageItem&)rSet.Get( nWhich ); - LanguageType eLangType = (LanguageType)rItem.GetValue(); - DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" ); - if ( eLangType != LANGUAGE_DONTKNOW ) - pLangBox->SelectLanguage( eLangType ); - break; - } - } - - if ( Western == eLangGrp ) - m_aFontTypeFT.SetText( pFontList->GetFontMapText( - pFontList->Get( pNameBox->GetText(), pStyleBox->GetText() ) ) ); - - // save these settings - pNameBox->SaveValue(); - pStyleBox->SaveValue(); - pSizeBox->SaveValue(); - pLangBox->SaveValue(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp ) -{ - sal_Bool bModified = sal_False; - - FontNameBox* pNameBox = NULL; - FontStyleBox* pStyleBox = NULL; - FontSizeBox* pSizeBox = NULL; - SvxLanguageBox* pLangBox = NULL; - sal_uInt16 nWhich = 0; - sal_uInt16 nSlot = 0; - - switch ( eLangGrp ) - { - case Western : - pNameBox = m_pWestFontNameLB; - pStyleBox = m_pWestFontStyleLB; - pSizeBox = m_pWestFontSizeLB; - pLangBox = m_pWestFontLanguageLB; - nSlot = SID_ATTR_CHAR_FONT; - break; - - case Asian : - pNameBox = m_pEastFontNameLB; - pStyleBox = m_pEastFontStyleLB; - pSizeBox = m_pEastFontSizeLB; - pLangBox = m_pEastFontLanguageLB; - nSlot = SID_ATTR_CHAR_CJK_FONT; - break; - - case Ctl : - pNameBox = m_pCTLFontNameLB; - pStyleBox = m_pCTLFontStyleLB; - pSizeBox = m_pCTLFontSizeLB; - pLangBox = m_pCTLFontLanguageLB; - nSlot = SID_ATTR_CHAR_CTL_FONT; - break; - } - - nWhich = GetWhich( nSlot ); - const SfxPoolItem* pItem = NULL; - const SfxItemSet& rOldSet = GetItemSet(); - const SfxPoolItem* pOld = NULL; - - const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; - - bool bChanged = true; - const String& rFontName = pNameBox->GetText(); - const FontList* pFontList = GetFontList(); - String aStyleBoxText =pStyleBox->GetText(); - sal_uInt16 nEntryPos = pStyleBox->GetEntryPos( aStyleBoxText ); - if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) - aStyleBoxText.Erase(); - FontInfo aInfo( pFontList->Get( rFontName, aStyleBoxText ) ); - SvxFontItem aFontItem( aInfo.GetFamily(), aInfo.GetName(), aInfo.GetStyleName(), - aInfo.GetPitch(), aInfo.GetCharSet(), nWhich ); - pOld = GetOldItem( rSet, nSlot ); - - if ( pOld ) - { - const SvxFontItem& rItem = *( (const SvxFontItem*)pOld ); - - if ( rItem.GetFamilyName() == aFontItem.GetFamilyName() ) - bChanged = false; - } - - if ( !bChanged ) - bChanged = !pNameBox->GetSavedValue().Len(); - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - ( (SvxFontItem*)pItem )->GetFamilyName() != aFontItem.GetFamilyName() ) - bChanged = true; - - if ( bChanged && rFontName.Len() ) - { - rSet.Put( aFontItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - rSet.ClearItem( nWhich ); - - - bChanged = sal_True; - switch ( eLangGrp ) - { - case Western : nSlot = SID_ATTR_CHAR_WEIGHT; break; - case Asian : nSlot = SID_ATTR_CHAR_CJK_WEIGHT; break; - case Ctl : nSlot = SID_ATTR_CHAR_CTL_WEIGHT; break; - } - nWhich = GetWhich( nSlot ); - FontWeight eWeight = aInfo.GetWeight(); - if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) - eWeight = WEIGHT_NORMAL; - SvxWeightItem aWeightItem( eWeight, nWhich ); - pOld = GetOldItem( rSet, nSlot ); - - if ( pOld ) - { - const SvxWeightItem& rItem = *( (const SvxWeightItem*)pOld ); - - if ( rItem.GetValue() == aWeightItem.GetValue() ) - bChanged = false; - } - - if ( !bChanged ) - { - bChanged = !pStyleBox->GetSavedValue().Len(); - - if ( m_pImpl->m_bInSearchMode && bChanged && - aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE ) - bChanged = true; - } - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - ( (SvxWeightItem*)pItem )->GetValue() != aWeightItem.GetValue() ) - bChanged = true; - - if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) - bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos ); - - String aText( pStyleBox->GetText() ); // Tristate, dann Text leer - - if ( bChanged && aText.Len() ) - { - rSet.Put( aWeightItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - switch ( eLangGrp ) - { - case Western : nSlot = SID_ATTR_CHAR_POSTURE; break; - case Asian : nSlot = SID_ATTR_CHAR_CJK_POSTURE; break; - case Ctl : nSlot = SID_ATTR_CHAR_CTL_POSTURE; break; - } - nWhich = GetWhich( nSlot ); - FontItalic eItalic = aInfo.GetItalic(); - if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) - eItalic = ITALIC_NONE; - SvxPostureItem aPostureItem( eItalic, nWhich ); - pOld = GetOldItem( rSet, nSlot ); - - if ( pOld ) - { - const SvxPostureItem& rItem = *( (const SvxPostureItem*)pOld ); - - if ( rItem.GetValue() == aPostureItem.GetValue() ) - bChanged = false; - } - - if ( !bChanged ) - { - bChanged = !pStyleBox->GetSavedValue().Len(); - - if ( m_pImpl->m_bInSearchMode && bChanged && - aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL ) - bChanged = false; - } - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - ( (SvxPostureItem*)pItem )->GetValue() != aPostureItem.GetValue() ) - bChanged = true; - - if ( nEntryPos >= m_pImpl->m_nExtraEntryPos ) - bChanged = ( nEntryPos == ( m_pImpl->m_nExtraEntryPos + 1 ) ); - - if ( bChanged && aText.Len() ) - { - rSet.Put( aPostureItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - // FontSize - long nSize = static_cast(pSizeBox->GetValue()); - - if ( !pSizeBox->GetText().Len() ) // GetValue() gibt dann Min-Wert zurueck - nSize = 0; - long nSavedSize = pSizeBox->GetSavedValue().ToInt32(); - bool bRel = true; - - if ( !pSizeBox->IsRelative() ) - { - nSavedSize *= 10; - bRel = false; - } - - switch ( eLangGrp ) - { - case Western : nSlot = SID_ATTR_CHAR_FONTHEIGHT; break; - case Asian : nSlot = SID_ATTR_CHAR_CJK_FONTHEIGHT; break; - case Ctl : nSlot = SID_ATTR_CHAR_CTL_FONTHEIGHT; break; - } - nWhich = GetWhich( nSlot ); - const SvxFontHeightItem* pOldHeight = (const SvxFontHeightItem*)GetOldItem( rSet, nSlot ); - bChanged = ( nSize != nSavedSize ); - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET ) - { - float fSize = (float)nSize / 10; - long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) ); - if ( ( (SvxFontHeightItem*)pItem )->GetHeight() != (sal_uInt32)nVal ) - bChanged = true; - } - - if ( bChanged || !pOldHeight || - bRel != ( SFX_MAPUNIT_RELATIVE != pOldHeight->GetPropUnit() || 100 != pOldHeight->GetProp() ) ) - { - SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); - if ( pSizeBox->IsRelative() ) - { - DBG_ASSERT( GetItemSet().GetParent(), "No parent set" ); - const SvxFontHeightItem& rOldItem = - (const SvxFontHeightItem&)GetItemSet().GetParent()->Get( nWhich ); - - SvxFontHeightItem aHeight( 240, 100, nWhich ); - if ( pSizeBox->IsPtRelative() ) - aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)( nSize / 10 ), SFX_MAPUNIT_POINT, eUnit ); - else - aHeight.SetHeight( rOldItem.GetHeight(), (sal_uInt16)nSize, SFX_MAPUNIT_RELATIVE ); - rSet.Put( aHeight ); - } - else - { - float fSize = (float)nSize / 10; - rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) ); - } - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - switch ( eLangGrp ) - { - case Western : nSlot = SID_ATTR_CHAR_LANGUAGE; break; - case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break; - case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break; - } - nWhich = GetWhich( nSlot ); - pOld = GetOldItem( rSet, nSlot ); - sal_uInt16 nLangPos = pLangBox->GetSelectEntryPos(); - LanguageType eLangType = (LanguageType)(sal_uLong)pLangBox->GetEntryData( nLangPos ); - - if ( pOld ) - { - const SvxLanguageItem& rItem = *( (const SvxLanguageItem*)pOld ); - - if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == (LanguageType)rItem.GetValue() ) - bChanged = false; - } - - if ( !bChanged ) - bChanged = ( pLangBox->GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); - - if ( bChanged && nLangPos != LISTBOX_ENTRY_NOTFOUND ) - { - rSet.Put( SvxLanguageItem( eLangType, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::ResetColor_Impl( const SfxItemSet& rSet ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); - SfxItemState eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_pColorLB->Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_pColorLB->Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_pColorLB->SetNoSelection(); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); - Color aColor = rItem.GetValue(); - rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - m_aPreviewWin.Invalidate(); - sal_uInt16 nSelPos = m_pColorLB->GetEntryPos( aColor ); - if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) - nSelPos = m_pColorLB->GetEntryPos( m_pImpl->m_aTransparentText ); - - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_pColorLB->SelectEntryPos( nSelPos ); - else - { - nSelPos = m_pColorLB->GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_pColorLB->SelectEntryPos( nSelPos ); - else - m_pColorLB->SelectEntryPos( - m_pColorLB->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } - break; - } - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharNamePage, UpdateHdl_Impl, Timer*, EMPTYARG ) -{ - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharNamePage, FontModifyHdl_Impl, void*, pNameBox ) -{ - m_pImpl->m_aUpdateTimer.Start(); - - if ( m_pWestFontNameLB == pNameBox || m_pEastFontNameLB == pNameBox || m_pCTLFontNameLB == pNameBox ) - { - FillStyleBox_Impl( (FontNameBox*)pNameBox ); - FillSizeBox_Impl( (FontNameBox*)pNameBox ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharNamePage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) -{ - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - Color aSelectedColor; - if ( pBox->GetSelectEntry() == m_pImpl->m_aTransparentText ) - aSelectedColor = Color( COL_TRANSPARENT ); - else - aSelectedColor = pBox->GetSelectEntryColor(); - rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - m_aPreviewWin.Invalidate(); - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet ) -{ - SvxCharBasePage::ActivatePage( rSet ); - - UpdatePreview_Impl(); // instead of asynchronous calling in ctor -} - -// ----------------------------------------------------------------------- - -int SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxCharNamePage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxCharNamePage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxCharNamePage::GetRanges() -{ - return pNameRanges; -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::Reset( const SfxItemSet& rSet ) -{ - Reset_Impl( rSet, Western ); - Reset_Impl( rSet, Asian ); - Reset_Impl( rSet, Ctl ); - ResetColor_Impl( rSet ); - m_pColorLB->SaveValue(); - - SetPrevFontWidthScale( rSet ); - UpdatePreview_Impl(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharNamePage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = FillItemSet_Impl( rSet, Western ); - bModified |= FillItemSet_Impl( rSet, Asian ); - bModified |= FillItemSet_Impl( rSet, Ctl ); - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::SetFontList( const SvxFontListItem& rItem ) -{ - if ( m_pImpl->m_bMustDelete ) - { - delete m_pImpl->m_pFontList; - } - m_pImpl->m_pFontList = rItem.GetFontList()->Clone(); - m_pImpl->m_bMustDelete = sal_True; -} - -// ----------------------------------------------------------------------- -namespace -{ - void enableRelativeMode( SvxCharNamePage* _pPage, FontSizeBox* _pFontSizeLB, sal_uInt16 _nHeightWhich ) - { - _pFontSizeLB->EnableRelativeMode( 5, 995, 5 ); // min 5%, max 995%, step 5 - - const SvxFontHeightItem& rHeightItem = - (SvxFontHeightItem&)_pPage->GetItemSet().GetParent()->Get( _nHeightWhich ); - SfxMapUnit eUnit = _pPage->GetItemSet().GetPool()->GetMetric( _nHeightWhich ); - short nCurHeight = - static_cast< short >( CalcToPoint( rHeightItem.GetHeight(), eUnit, 1 ) * 10 ); - - // ausgehend von der akt. Hoehe: - // - negativ bis minimal 2 pt - // - positiv bis maximal 999 pt - _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight), 10 ); - } -} -// ----------------------------------------------------------------------------- - -void SvxCharNamePage::EnableRelativeMode() -{ - DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" ); - enableRelativeMode(this,m_pWestFontSizeLB,GetWhich( SID_ATTR_CHAR_FONTHEIGHT )); - enableRelativeMode(this,m_pEastFontSizeLB,GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT )); - enableRelativeMode(this,m_pCTLFontSizeLB,GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT )); -} - -// ----------------------------------------------------------------------- - -void SvxCharNamePage::EnableSearchMode() -{ - m_pImpl->m_bInSearchMode = sal_True; -} -// ----------------------------------------------------------------------- -void SvxCharNamePage::DisableControls( sal_uInt16 nDisable ) -{ - if ( DISABLE_LANGUAGE & nDisable ) - { - if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Disable(); - if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Disable(); - if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Disable(); - if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Disable(); - if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Disable(); - if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Disable(); - } - - if ( DISABLE_HIDE_LANGUAGE & nDisable ) - { - if ( m_pWestFontLanguageFT ) m_pWestFontLanguageFT->Hide(); - if ( m_pWestFontLanguageLB ) m_pWestFontLanguageLB->Hide(); - if ( m_pEastFontLanguageFT ) m_pEastFontLanguageFT->Hide(); - if ( m_pEastFontLanguageLB ) m_pEastFontLanguageLB->Hide(); - if ( m_pCTLFontLanguageFT ) m_pCTLFontLanguageFT->Hide(); - if ( m_pCTLFontLanguageLB ) m_pCTLFontLanguageLB->Hide(); - } -} - -// ----------------------------------------------------------------------- -void SvxCharNamePage::SetPreviewBackgroundToCharacter() -{ - m_bPreviewBackgroundToCharacter = sal_True; -} - -// ----------------------------------------------------------------------- -void SvxCharNamePage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pFontListItem,SvxFontListItem,SID_ATTR_CHAR_FONTLIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDisalbeItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); - if (pFontListItem) - SetFontList(*pFontListItem); - - if (pFlagItem) - { - sal_uInt32 nFlags=pFlagItem->GetValue(); - if ( ( nFlags & SVX_RELATIVE_MODE ) == SVX_RELATIVE_MODE ) - EnableRelativeMode(); - if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) - SetPreviewBackgroundToCharacter(); - } - if (pDisalbeItem) - DisableControls(pDisalbeItem->GetValue()); -} -// class SvxCharEffectsPage ---------------------------------------------- - -SvxCharEffectsPage::SvxCharEffectsPage( Window* pParent, const SfxItemSet& rInSet ) : - - SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_EFFECTS ), rInSet, WIN_EFFECTS_PREVIEW, FT_EFFECTS_FONTTYPE ), - - m_aFontColorFT ( this, CUI_RES( FT_FONTCOLOR ) ), - m_aFontColorLB ( this, CUI_RES( LB_FONTCOLOR ) ), - - m_aEffectsFT ( this, CUI_RES( FT_EFFECTS ) ), - m_aEffectsLB ( this, 0 ), - - m_aEffects2LB ( this, CUI_RES( LB_EFFECTS2 ) ), - - m_aReliefFT ( this, CUI_RES( FT_RELIEF ) ), - m_aReliefLB ( this, CUI_RES( LB_RELIEF ) ), - - m_aOutlineBtn ( this, CUI_RES( CB_OUTLINE ) ), - m_aShadowBtn ( this, CUI_RES( CB_SHADOW ) ), - m_aBlinkingBtn ( this, CUI_RES( CB_BLINKING ) ), - m_aHiddenBtn ( this, CUI_RES( CB_CHARHIDDEN ) ), - - m_aVerticalLine ( this, CUI_RES( FL_EFFECTS_VERTICAL ) ), - - m_aOverlineFT ( this, CUI_RES( FT_OVERLINE ) ), - m_aOverlineLB ( this, CUI_RES( LB_OVERLINE ) ), - m_aOverlineColorFT ( this, CUI_RES( FT_OVERLINE_COLOR ) ), - m_aOverlineColorLB ( this, CUI_RES( LB_OVERLINE_COLOR ) ), - m_aStrikeoutFT ( this, CUI_RES( FT_STRIKEOUT ) ), - m_aStrikeoutLB ( this, CUI_RES( LB_STRIKEOUT ) ), - m_aUnderlineFT ( this, CUI_RES( FT_UNDERLINE ) ), - m_aUnderlineLB ( this, CUI_RES( LB_UNDERLINE ) ), - m_aUnderlineColorFT ( this, CUI_RES( FT_UNDERLINE_COLOR ) ), - m_aUnderlineColorLB ( this, CUI_RES( LB_UNDERLINE_COLOR ) ), - m_aIndividualWordsBtn ( this, CUI_RES( CB_INDIVIDUALWORDS ) ), - - m_aAsianLine ( this, CUI_RES( FL_EFFECTS_ASIAN ) ), - - m_aEmphasisFT ( this, CUI_RES( FT_EMPHASIS ) ), - m_aEmphasisLB ( this, CUI_RES( LB_EMPHASIS ) ), - m_aPositionFT ( this, CUI_RES( FT_POSITION ) ), - m_aPositionLB ( this, CUI_RES( LB_POSITION ) ), - - m_aTransparentColorName ( CUI_RES( STR_CHARNAME_TRANSPARENT ) ) - -{ - m_aEffectsLB.Hide(); - FreeResource(); - Initialize(); -} - -// ----------------------------------------------------------------------- - -void SvxCharEffectsPage::Initialize() -{ - // to handle the changes of the other pages - SetExchangeSupport(); - - // HTML-Mode - const SfxPoolItem* pItem; - SfxObjectShell* pShell; - if ( SFX_ITEM_SET == GetItemSet().GetItemState( SID_HTML_MODE, sal_False, &pItem ) || - ( NULL != ( pShell = SfxObjectShell::Current() ) && - NULL != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) - { - m_nHtmlMode = ( (const SfxUInt16Item*)pItem )->GetValue(); - if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON ) - { - //!!! hide some controls please - } - } - - // fill the color box - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorTable* pColorTable = NULL; - bool bKillTable = false; - - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != NULL ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - } - - if ( !pColorTable ) - { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } - - m_aUnderlineColorLB.SetUpdateMode( sal_False ); - m_aOverlineColorLB.SetUpdateMode( sal_False ); - m_aFontColorLB.SetUpdateMode( sal_False ); - - { - SfxPoolItem* pDummy; - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); - if ( !pFrame || - SFX_ITEM_DEFAULT > pFrame->GetBindings().QueryState( SID_ATTR_AUTO_COLOR_INVALID, pDummy ) ) - { - m_aUnderlineColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) ); - m_aOverlineColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) ); - m_aFontColorLB.InsertAutomaticEntryColor( Color( COL_AUTO ) ); - } - } - for ( long i = 0; i < pColorTable->Count(); i++ ) - { - XColorEntry* pEntry = pColorTable->GetColor(i); - m_aUnderlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - m_aOverlineColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - m_aFontColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - m_aUnderlineColorLB.SetUpdateMode( sal_True ); - m_aOverlineColorLB.SetUpdateMode( sal_True ); - m_aFontColorLB.SetUpdateMode( sal_True ); - m_aFontColorLB.SetSelectHdl( LINK( this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl ) ); - - if ( bKillTable ) - delete pColorTable; - - // handler - Link aLink = LINK( this, SvxCharEffectsPage, SelectHdl_Impl ); - m_aUnderlineLB.SetSelectHdl( aLink ); - m_aUnderlineColorLB.SetSelectHdl( aLink ); - m_aOverlineLB.SetSelectHdl( aLink ); - m_aOverlineColorLB.SetSelectHdl( aLink ); - m_aStrikeoutLB.SetSelectHdl( aLink ); - m_aEmphasisLB.SetSelectHdl( aLink ); - m_aPositionLB.SetSelectHdl( aLink ); - m_aEffects2LB.SetSelectHdl( aLink ); - m_aReliefLB.SetSelectHdl( aLink ); - - m_aUnderlineLB.SelectEntryPos( 0 ); - m_aUnderlineColorLB.SelectEntryPos( 0 ); - m_aOverlineLB.SelectEntryPos( 0 ); - m_aOverlineColorLB.SelectEntryPos( 0 ); - m_aStrikeoutLB.SelectEntryPos( 0 ); - m_aEmphasisLB.SelectEntryPos( 0 ); - m_aPositionLB.SelectEntryPos( 0 ); - SelectHdl_Impl( NULL ); - SelectHdl_Impl( &m_aEmphasisLB ); - - m_aEffects2LB.SelectEntryPos( 0 ); - - m_aIndividualWordsBtn.SetClickHdl( LINK( this, SvxCharEffectsPage, CbClickHdl_Impl ) ); - aLink = LINK( this, SvxCharEffectsPage, TristClickHdl_Impl ); - m_aOutlineBtn.SetClickHdl( aLink ); - m_aShadowBtn.SetClickHdl( aLink ); - - if ( !SvtLanguageOptions().IsAsianTypographyEnabled() ) - { - m_aAsianLine.Hide(); - m_aEmphasisFT.Hide(); - m_aEmphasisLB.Hide(); - m_aPositionFT.Hide(); - m_aPositionLB.Hide(); - } -} -// ----------------------------------------------------------------------- - -void SvxCharEffectsPage::UpdatePreview_Impl() -{ - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - sal_uInt16 nPos = m_aUnderlineLB.GetSelectEntryPos(); - FontUnderline eUnderline = (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData( nPos ); - nPos = m_aOverlineLB.GetSelectEntryPos(); - FontUnderline eOverline = (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData( nPos ); - nPos = m_aStrikeoutLB.GetSelectEntryPos(); - FontStrikeout eStrikeout = (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData( nPos ); - rFont.SetUnderline( eUnderline ); - rCJKFont.SetUnderline( eUnderline ); - rCTLFont.SetUnderline( eUnderline ); - m_aPreviewWin.SetTextLineColor( m_aUnderlineColorLB.GetSelectEntryColor() ); - rFont.SetOverline( eOverline ); - rCJKFont.SetOverline( eOverline ); - rCTLFont.SetOverline( eOverline ); - m_aPreviewWin.SetOverlineColor( m_aOverlineColorLB.GetSelectEntryColor() ); - rFont.SetStrikeout( eStrikeout ); - rCJKFont.SetStrikeout( eStrikeout ); - rCTLFont.SetStrikeout( eStrikeout ); - - nPos = m_aPositionLB.GetSelectEntryPos(); - sal_Bool bUnder = ( CHRDLG_POSITION_UNDER == (sal_uLong)m_aPositionLB.GetEntryData( nPos ) ); - FontEmphasisMark eMark = (FontEmphasisMark)m_aEmphasisLB.GetSelectEntryPos(); - eMark |= bUnder ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; - rFont.SetEmphasisMark( eMark ); - rCJKFont.SetEmphasisMark( eMark ); - rCTLFont.SetEmphasisMark( eMark ); - - sal_uInt16 nRelief = m_aReliefLB.GetSelectEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nRelief) - { - rFont.SetRelief( (FontRelief)nRelief ); - rCJKFont.SetRelief( (FontRelief)nRelief ); - rCTLFont.SetRelief( (FontRelief)nRelief ); - } - - rFont.SetOutline( StateToAttr( m_aOutlineBtn.GetState() ) ); - rCJKFont.SetOutline( rFont.IsOutline() ); - rCTLFont.SetOutline( rFont.IsOutline() ); - - rFont.SetShadow( StateToAttr( m_aShadowBtn.GetState() ) ); - rCJKFont.SetShadow( rFont.IsShadow() ); - rCTLFont.SetShadow( rFont.IsShadow() ); - - sal_uInt16 nCapsPos = m_aEffects2LB.GetSelectEntryPos(); - if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) - { - rFont.SetCaseMap( (SvxCaseMap)nCapsPos ); - rCJKFont.SetCaseMap( (SvxCaseMap)nCapsPos ); - // #i78474# small caps do not exist in CTL fonts - rCTLFont.SetCaseMap( static_cast( nCapsPos == SVX_CASEMAP_KAPITAELCHEN ? SVX_CASEMAP_NOT_MAPPED : (SvxCaseMap)nCapsPos) ); - } - - sal_Bool bWordLine = m_aIndividualWordsBtn.IsChecked(); - rFont.SetWordLineMode( bWordLine ); - rCJKFont.SetWordLineMode( bWordLine ); - rCTLFont.SetWordLineMode( bWordLine ); - - m_aPreviewWin.Invalidate(); -} - -// ----------------------------------------------------------------------- - -void SvxCharEffectsPage::SetCaseMap_Impl( SvxCaseMap eCaseMap ) -{ - if ( SVX_CASEMAP_END > eCaseMap ) - m_aEffects2LB.SelectEntryPos( - sal::static_int_cast< sal_uInt16 >( eCaseMap ) ); - else - { - m_aEffects2LB.SetNoSelection(); - eCaseMap = SVX_CASEMAP_NOT_MAPPED; - } - - UpdatePreview_Impl(); -} - -// ----------------------------------------------------------------------- - -void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); - SfxItemState eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aFontColorFT.Hide(); - m_aFontColorLB.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aFontColorFT.Disable(); - m_aFontColorLB.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aFontColorLB.SetNoSelection(); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - const SvxColorItem& rItem = (SvxColorItem&)rSet.Get( nWhich ); - Color aColor = rItem.GetValue(); - rFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - rCJKFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - rCTLFont.SetColor( aColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aColor ); - - m_aPreviewWin.Invalidate(); - sal_uInt16 nSelPos = m_aFontColorLB.GetEntryPos( aColor ); - if ( nSelPos == LISTBOX_ENTRY_NOTFOUND && aColor == Color( COL_TRANSPARENT ) ) - nSelPos = m_aFontColorLB.GetEntryPos( m_aTransparentColorName ); - - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_aFontColorLB.SelectEntryPos( nSelPos ); - else - { - nSelPos = m_aFontColorLB.GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nSelPos ) - m_aFontColorLB.SelectEntryPos( nSelPos ); - else - m_aFontColorLB.SelectEntryPos( - m_aFontColorLB.InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } - break; - } - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); - const SvxColorItem* pOld = (const SvxColorItem*)GetOldItem( rSet, SID_ATTR_CHAR_COLOR ); - const SvxColorItem* pItem = NULL; - sal_Bool bChanged = sal_True; - const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; - const SfxItemSet& rOldSet = GetItemSet(); - - Color aSelectedColor; - if ( m_aFontColorLB.GetSelectEntry() == m_aTransparentColorName ) - aSelectedColor = Color( COL_TRANSPARENT ); - else - aSelectedColor = m_aFontColorLB.GetSelectEntryColor(); - - if ( pOld && pOld->GetValue() == aSelectedColor ) - bChanged = sal_False; - - if ( !bChanged ) - bChanged = ( m_aFontColorLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND ); - - if ( !bChanged && pExampleSet && - pExampleSet->GetItemState( nWhich, sal_False, (const SfxPoolItem**)&pItem ) == SFX_ITEM_SET && - ( (SvxColorItem*)pItem )->GetValue() != aSelectedColor ) - bChanged = sal_True; - - sal_Bool bModified = sal_False; - - if ( bChanged && m_aFontColorLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) - { - rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - return bModified; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharEffectsPage, SelectHdl_Impl, ListBox*, pBox ) -{ - if ( &m_aEmphasisLB == pBox ) - { - sal_uInt16 nEPos = m_aEmphasisLB.GetSelectEntryPos(); - sal_Bool bEnable = ( nEPos > 0 && nEPos != LISTBOX_ENTRY_NOTFOUND ); - m_aPositionFT.Enable( bEnable ); - m_aPositionLB.Enable( bEnable ); - } - else if( &m_aReliefLB == pBox) - { - sal_Bool bEnable = ( pBox->GetSelectEntryPos() == 0 ); - m_aOutlineBtn.Enable( bEnable ); - m_aShadowBtn.Enable( bEnable ); - } - else if ( &m_aPositionLB != pBox ) - { - sal_uInt16 nUPos = m_aUnderlineLB.GetSelectEntryPos(), - nOPos = m_aOverlineLB.GetSelectEntryPos(), - nSPos = m_aStrikeoutLB.GetSelectEntryPos(); - sal_Bool bUEnable = ( nUPos > 0 && nUPos != LISTBOX_ENTRY_NOTFOUND ); - sal_Bool bOEnable = ( nOPos > 0 && nOPos != LISTBOX_ENTRY_NOTFOUND ); - m_aUnderlineColorFT.Enable( bUEnable ); - m_aUnderlineColorLB.Enable( bUEnable ); - m_aOverlineColorFT.Enable( bOEnable ); - m_aOverlineColorLB.Enable( bOEnable ); - m_aIndividualWordsBtn.Enable( bUEnable || bOEnable || ( nSPos > 0 && nSPos != LISTBOX_ENTRY_NOTFOUND ) ); - } - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharEffectsPage, UpdatePreview_Impl, ListBox*, EMPTYARG ) -{ - bool bEnable = ( ( m_aUnderlineLB.GetSelectEntryPos() > 0 ) || - ( m_aOverlineLB.GetSelectEntryPos() > 0 ) || - ( m_aStrikeoutLB.GetSelectEntryPos() > 0 ) ); - m_aIndividualWordsBtn.Enable( bEnable ); - - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharEffectsPage, CbClickHdl_Impl, CheckBox*, EMPTYARG ) -{ - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharEffectsPage, TristClickHdl_Impl, TriStateBox*, EMPTYARG ) -{ - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ColorListBox*, pBox ) -{ - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - Color aSelectedColor; - if ( pBox->GetSelectEntry() == m_aTransparentColorName ) - aSelectedColor = Color( COL_TRANSPARENT ); - else - aSelectedColor = pBox->GetSelectEntryColor(); - rFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCJKFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - rCTLFont.SetColor( aSelectedColor.GetColor() == COL_AUTO ? Color(COL_BLACK) : aSelectedColor ); - - m_aPreviewWin.Invalidate(); - return 0; -} -// ----------------------------------------------------------------------- - -int SvxCharEffectsPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxCharEffectsPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxCharEffectsPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxCharEffectsPage::GetRanges() -{ - return pEffectsRanges; -} - -// ----------------------------------------------------------------------- - -void SvxCharEffectsPage::Reset( const SfxItemSet& rSet ) -{ - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - sal_Bool bEnable = sal_False; - - // Underline - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); - rFont.SetUnderline( UNDERLINE_NONE ); - rCJKFont.SetUnderline( UNDERLINE_NONE ); - rCTLFont.SetUnderline( UNDERLINE_NONE ); - - m_aUnderlineLB.SelectEntryPos( 0 ); - SfxItemState eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DONTCARE ) - { - if ( eState == SFX_ITEM_DONTCARE ) - m_aUnderlineLB.SetNoSelection(); - else - { - const SvxUnderlineItem& rItem = (SvxUnderlineItem&)rSet.Get( nWhich ); - FontUnderline eUnderline = (FontUnderline)rItem.GetValue(); - rFont.SetUnderline( eUnderline ); - rCJKFont.SetUnderline( eUnderline ); - rCTLFont.SetUnderline( eUnderline ); - - if ( eUnderline != UNDERLINE_NONE ) - { - for ( sal_uInt16 i = 0; i < m_aUnderlineLB.GetEntryCount(); ++i ) - { - if ( (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData(i) == eUnderline ) - { - m_aUnderlineLB.SelectEntryPos(i); - bEnable = sal_True; - break; - } - } - - Color aColor = rItem.GetColor(); - sal_uInt16 nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); - - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_aUnderlineColorLB.SelectEntryPos( nPos ); - else - { - nPos = m_aUnderlineColorLB.GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_aUnderlineColorLB.SelectEntryPos( nPos ); - else - m_aUnderlineColorLB.SelectEntryPos( - m_aUnderlineColorLB.InsertEntry( aColor, - String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } - } - else - { - m_aUnderlineColorLB.SelectEntry( Color( COL_AUTO )); - m_aUnderlineColorLB.Disable(); - } - } - } - - // Overline - nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); - rFont.SetOverline( UNDERLINE_NONE ); - rCJKFont.SetOverline( UNDERLINE_NONE ); - rCTLFont.SetOverline( UNDERLINE_NONE ); - - m_aOverlineLB.SelectEntryPos( 0 ); - eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DONTCARE ) - { - if ( eState == SFX_ITEM_DONTCARE ) - m_aOverlineLB.SetNoSelection(); - else - { - const SvxOverlineItem& rItem = (SvxOverlineItem&)rSet.Get( nWhich ); - FontUnderline eOverline = (FontUnderline)rItem.GetValue(); - rFont.SetOverline( eOverline ); - rCJKFont.SetOverline( eOverline ); - rCTLFont.SetOverline( eOverline ); - - if ( eOverline != UNDERLINE_NONE ) - { - for ( sal_uInt16 i = 0; i < m_aOverlineLB.GetEntryCount(); ++i ) - { - if ( (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData(i) == eOverline ) - { - m_aOverlineLB.SelectEntryPos(i); - bEnable = sal_True; - break; - } - } - - Color aColor = rItem.GetColor(); - sal_uInt16 nPos = m_aOverlineColorLB.GetEntryPos( aColor ); - - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_aOverlineColorLB.SelectEntryPos( nPos ); - else - { - nPos = m_aOverlineColorLB.GetEntryPos( aColor ); - if ( LISTBOX_ENTRY_NOTFOUND != nPos ) - m_aOverlineColorLB.SelectEntryPos( nPos ); - else - m_aOverlineColorLB.SelectEntryPos( - m_aOverlineColorLB.InsertEntry( aColor, - String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); - } - } - else - { - m_aOverlineColorLB.SelectEntry( Color( COL_AUTO )); - m_aOverlineColorLB.Disable(); - } - } - } - - // Strikeout - nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); - rFont.SetStrikeout( STRIKEOUT_NONE ); - rCJKFont.SetStrikeout( STRIKEOUT_NONE ); - rCTLFont.SetStrikeout( STRIKEOUT_NONE ); - - m_aStrikeoutLB.SelectEntryPos( 0 ); - eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DONTCARE ) - { - if ( eState == SFX_ITEM_DONTCARE ) - m_aStrikeoutLB.SetNoSelection(); - else - { - const SvxCrossedOutItem& rItem = (SvxCrossedOutItem&)rSet.Get( nWhich ); - FontStrikeout eStrikeout = (FontStrikeout)rItem.GetValue(); - rFont.SetStrikeout( eStrikeout ); - rCJKFont.SetStrikeout( eStrikeout ); - rCTLFont.SetStrikeout( eStrikeout ); - - if ( eStrikeout != STRIKEOUT_NONE ) - { - for ( sal_uInt16 i = 0; i < m_aStrikeoutLB.GetEntryCount(); ++i ) - { - if ( (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData(i) == eStrikeout ) - { - m_aStrikeoutLB.SelectEntryPos(i); - bEnable = sal_True; - break; - } - } - } - } - } - - // WordLineMode - nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aIndividualWordsBtn.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aIndividualWordsBtn.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aIndividualWordsBtn.SetState( STATE_DONTKNOW ); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxWordLineModeItem& rItem = (SvxWordLineModeItem&)rSet.Get( nWhich ); - rFont.SetWordLineMode( rItem.GetValue() ); - rCJKFont.SetWordLineMode( rItem.GetValue() ); - rCTLFont.SetWordLineMode( rItem.GetValue() ); - - m_aIndividualWordsBtn.Check( rItem.GetValue() ); - m_aIndividualWordsBtn.Enable( bEnable ); - break; - } - } - - // Emphasis - nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); - eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DEFAULT ) - { - const SvxEmphasisMarkItem& rItem = (SvxEmphasisMarkItem&)rSet.Get( nWhich ); - FontEmphasisMark eMark = rItem.GetEmphasisMark(); - rFont.SetEmphasisMark( eMark ); - rCJKFont.SetEmphasisMark( eMark ); - rCTLFont.SetEmphasisMark( eMark ); - - m_aEmphasisLB.SelectEntryPos( (sal_uInt16)( eMark & EMPHASISMARK_STYLE ) ); - eMark &= ~EMPHASISMARK_STYLE; - sal_uLong nEntryData = ( eMark == EMPHASISMARK_POS_ABOVE ) - ? CHRDLG_POSITION_OVER - : ( eMark == EMPHASISMARK_POS_BELOW ) ? CHRDLG_POSITION_UNDER : 0; - - for ( sal_uInt16 i = 0; i < m_aPositionLB.GetEntryCount(); i++ ) - { - if ( nEntryData == (sal_uLong)m_aPositionLB.GetEntryData(i) ) - { - m_aPositionLB.SelectEntryPos(i); - break; - } - } - } - else if ( eState == SFX_ITEM_DONTCARE ) - m_aEmphasisLB.SetNoSelection( ); - else if ( eState == SFX_ITEM_UNKNOWN ) - { - m_aEmphasisFT.Hide(); - m_aEmphasisLB.Hide(); - } - else // SFX_ITEM_DISABLED or SFX_ITEM_READONLY - { - m_aEmphasisFT.Disable(); - m_aEmphasisLB.Disable(); - } - - // the select handler for the underline/overline/strikeout list boxes -// SelectHdl_Impl( NULL ); - DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aOverlineLB.GetSelectHdl(), - "SvxCharEffectsPage::Reset: inconsistence (1)!"); - DBG_ASSERT(m_aUnderlineLB.GetSelectHdl() == m_aStrikeoutLB.GetSelectHdl(), - "SvxCharEffectsPage::Reset: inconsistence (1)!"); - m_aUnderlineLB.GetSelectHdl().Call(NULL); - // don't call SelectHdl_Impl directly! - // in DisableControls, we may have re-reouted the select handler - - // the select handler for the emphasis listbox -// SelectHdl_Impl( &m_aEmphasisLB ); - DBG_ASSERT(m_aEmphasisLB.GetSelectHdl() == LINK(this, SvxCharEffectsPage, SelectHdl_Impl), - "SvxCharEffectsPage::Reset: inconsistence (2)!"); - m_aEmphasisLB.GetSelectHdl().Call( &m_aEmphasisLB ); - // this is for consistency only. Here it would be allowed to call SelectHdl_Impl directly ... - - // Effects - SvxCaseMap eCaseMap = SVX_CASEMAP_END; - nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); - eState = rSet.GetItemState( nWhich ); - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aEffectsFT.Hide(); - m_aEffects2LB.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aEffectsFT.Disable(); - m_aEffects2LB.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aEffects2LB.SetNoSelection(); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxCaseMapItem& rItem = (const SvxCaseMapItem&)rSet.Get( nWhich ); - eCaseMap = (SvxCaseMap)rItem.GetValue(); - break; - } - } - SetCaseMap_Impl( eCaseMap ); - - //Relief - nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); - eState = rSet.GetItemState( nWhich ); - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aReliefFT.Hide(); - m_aReliefLB.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aReliefFT.Disable(); - m_aReliefLB.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aReliefLB.SetNoSelection(); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxCharReliefItem& rItem = (const SvxCharReliefItem&)rSet.Get( nWhich ); - m_aReliefLB.SelectEntryPos(rItem.GetValue()); - SelectHdl_Impl(&m_aReliefLB); - break; - } - } - - // Outline - nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); - eState = rSet.GetItemState( nWhich ); - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aOutlineBtn.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aOutlineBtn.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aOutlineBtn.SetState( STATE_DONTKNOW ); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxContourItem& rItem = (SvxContourItem&)rSet.Get( nWhich ); - m_aOutlineBtn.SetState( (TriState)rItem.GetValue() ); - m_aOutlineBtn.EnableTriState( sal_False ); - break; - } - } - - // Shadow - nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); - eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aShadowBtn.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aShadowBtn.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aShadowBtn.SetState( STATE_DONTKNOW ); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxShadowedItem& rItem = (SvxShadowedItem&)rSet.Get( nWhich ); - m_aShadowBtn.SetState( (TriState)rItem.GetValue() ); - m_aShadowBtn.EnableTriState( sal_False ); - break; - } - } - - // Blinking - nWhich = GetWhich( SID_ATTR_FLASH ); - eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aBlinkingBtn.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aBlinkingBtn.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aBlinkingBtn.SetState( STATE_DONTKNOW ); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxBlinkItem& rItem = (SvxBlinkItem&)rSet.Get( nWhich ); - m_aBlinkingBtn.SetState( (TriState)rItem.GetValue() ); - m_aBlinkingBtn.EnableTriState( sal_False ); - break; - } - } - // Hidden - nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); - eState = rSet.GetItemState( nWhich ); - - switch ( eState ) - { - case SFX_ITEM_UNKNOWN: - m_aHiddenBtn.Hide(); - break; - - case SFX_ITEM_DISABLED: - case SFX_ITEM_READONLY: - m_aHiddenBtn.Disable(); - break; - - case SFX_ITEM_DONTCARE: - m_aHiddenBtn.SetState( STATE_DONTKNOW ); - break; - - case SFX_ITEM_DEFAULT: - case SFX_ITEM_SET: - { - const SvxCharHiddenItem& rItem = (SvxCharHiddenItem&)rSet.Get( nWhich ); - m_aHiddenBtn.SetState( (TriState)rItem.GetValue() ); - m_aHiddenBtn.EnableTriState( sal_False ); - break; - } - } - - SetPrevFontWidthScale( rSet ); - ResetColor_Impl( rSet ); - - // preview update - m_aPreviewWin.Invalidate(); - - // save this settings - m_aUnderlineLB.SaveValue(); - m_aUnderlineColorLB.SaveValue(); - m_aOverlineLB.SaveValue(); - m_aOverlineColorLB.SaveValue(); - m_aStrikeoutLB.SaveValue(); - m_aIndividualWordsBtn.SaveValue(); - m_aEmphasisLB.SaveValue(); - m_aPositionLB.SaveValue(); - m_aEffects2LB.SaveValue(); - m_aReliefLB.SaveValue(); - m_aOutlineBtn.SaveValue(); - m_aShadowBtn.SaveValue(); - m_aBlinkingBtn.SaveValue(); - m_aHiddenBtn.SaveValue(); - m_aFontColorLB.SaveValue(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharEffectsPage::FillItemSet( SfxItemSet& rSet ) -{ - const SfxPoolItem* pOld = 0; - const SfxItemSet& rOldSet = GetItemSet(); - sal_Bool bModified = sal_False; - bool bChanged = true; - - // Underline - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_UNDERLINE ); - sal_uInt16 nPos = m_aUnderlineLB.GetSelectEntryPos(); - FontUnderline eUnder = (FontUnderline)(sal_uLong)m_aUnderlineLB.GetEntryData( nPos ); - - if ( pOld ) - { - //! if there are different underline styles in the selection the - //! item-state in the 'rOldSet' will be invalid. In this case - //! changing the underline style will be allowed if a style is - //! selected in the listbox. - sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && - SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); - - const SvxUnderlineItem& rItem = *( (const SvxUnderlineItem*)pOld ); - if ( (FontUnderline)rItem.GetValue() == eUnder && - ( UNDERLINE_NONE == eUnder || rItem.GetColor() == m_aUnderlineColorLB.GetSelectEntryColor() ) && - ! bAllowChg ) - bChanged = false; - } - - if ( bChanged ) - { - SvxUnderlineItem aNewItem( eUnder, nWhich ); - aNewItem.SetColor( m_aUnderlineColorLB.GetSelectEntryColor() ); - rSet.Put( aNewItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Overline - nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_OVERLINE ); - nPos = m_aOverlineLB.GetSelectEntryPos(); - FontUnderline eOver = (FontUnderline)(sal_uLong)m_aOverlineLB.GetEntryData( nPos ); - - if ( pOld ) - { - //! if there are different underline styles in the selection the - //! item-state in the 'rOldSet' will be invalid. In this case - //! changing the underline style will be allowed if a style is - //! selected in the listbox. - sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && - SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); - - const SvxOverlineItem& rItem = *( (const SvxOverlineItem*)pOld ); - if ( (FontUnderline)rItem.GetValue() == eOver && - ( UNDERLINE_NONE == eOver || rItem.GetColor() == m_aOverlineColorLB.GetSelectEntryColor() ) && - ! bAllowChg ) - bChanged = false; - } - - if ( bChanged ) - { - SvxOverlineItem aNewItem( eOver, nWhich ); - aNewItem.SetColor( m_aOverlineColorLB.GetSelectEntryColor() ); - rSet.Put( aNewItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Strikeout - nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_STRIKEOUT ); - nPos = m_aStrikeoutLB.GetSelectEntryPos(); - FontStrikeout eStrike = (FontStrikeout)(sal_uLong)m_aStrikeoutLB.GetEntryData( nPos ); - - if ( pOld ) - { - //! if there are different strikeout styles in the selection the - //! item-state in the 'rOldSet' will be invalid. In this case - //! changing the strikeout style will be allowed if a style is - //! selected in the listbox. - sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && - SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); - - const SvxCrossedOutItem& rItem = *( (const SvxCrossedOutItem*)pOld ); - if ( !m_aStrikeoutLB.IsEnabled() - || ((FontStrikeout)rItem.GetValue() == eStrike && !bAllowChg) ) - bChanged = false; - } - - if ( bChanged ) - { - rSet.Put( SvxCrossedOutItem( eStrike, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Individual words - nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_WORDLINEMODE ); - - if ( pOld ) - { - const SvxWordLineModeItem& rItem = *( (const SvxWordLineModeItem*)pOld ); - if ( rItem.GetValue() == m_aIndividualWordsBtn.IsChecked() ) - bChanged = false; - } - - if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && - m_aIndividualWordsBtn.IsChecked() == m_aIndividualWordsBtn.GetSavedValue() ) - bChanged = false; - - if ( bChanged ) - { - rSet.Put( SvxWordLineModeItem( m_aIndividualWordsBtn.IsChecked(), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Emphasis - nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_EMPHASISMARK ); - sal_uInt16 nMarkPos = m_aEmphasisLB.GetSelectEntryPos(); - sal_uInt16 nPosPos = m_aPositionLB.GetSelectEntryPos(); - FontEmphasisMark eMark = (FontEmphasisMark)nMarkPos; - if ( m_aPositionLB.IsEnabled() ) - { - eMark |= ( CHRDLG_POSITION_UNDER == (sal_uLong)m_aPositionLB.GetEntryData( nPosPos ) ) - ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; - } - - if ( pOld ) - { - if( rOldSet.GetItemState( nWhich ) != SFX_ITEM_DONTCARE ) - { - const SvxEmphasisMarkItem& rItem = *( (const SvxEmphasisMarkItem*)pOld ); - if ( rItem.GetEmphasisMark() == eMark ) - bChanged = false; - } - } - - if ( rOldSet.GetItemState( nWhich ) == SFX_ITEM_DONTCARE && - m_aEmphasisLB.GetSavedValue() == nMarkPos && m_aPositionLB.GetSavedValue() == nPosPos ) - bChanged = false; - - if ( bChanged ) - { - rSet.Put( SvxEmphasisMarkItem( eMark, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Effects - nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_CASEMAP ); - SvxCaseMap eCaseMap = SVX_CASEMAP_NOT_MAPPED; - bool bChecked = false; - sal_uInt16 nCapsPos = m_aEffects2LB.GetSelectEntryPos(); - if ( nCapsPos != LISTBOX_ENTRY_NOTFOUND ) - { - eCaseMap = (SvxCaseMap)nCapsPos; - bChecked = true; - } - - if ( pOld ) - { - //! if there are different effect styles in the selection the - //! item-state in the 'rOldSet' will be invalid. In this case - //! changing the effect style will be allowed if a style is - //! selected in the listbox. - sal_Bool bAllowChg = LISTBOX_ENTRY_NOTFOUND != nPos && - SFX_ITEM_DEFAULT > rOldSet.GetItemState( nWhich, sal_True ); - - const SvxCaseMapItem& rItem = *( (const SvxCaseMapItem*)pOld ); - if ( (SvxCaseMap)rItem.GetValue() == eCaseMap && !bAllowChg ) - bChanged = false; - } - - if ( bChanged && bChecked ) - { - rSet.Put( SvxCaseMapItem( eCaseMap, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - //Relief - nWhich = GetWhich(SID_ATTR_CHAR_RELIEF); - if(m_aReliefLB.GetSelectEntryPos() != m_aReliefLB.GetSavedValue()) - { - m_aReliefLB.SaveValue(); - SvxCharReliefItem aRelief((FontRelief)m_aReliefLB.GetSelectEntryPos(), nWhich); - rSet.Put(aRelief); - } - - // Outline - const SfxItemSet* pExampleSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; - nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_CONTOUR ); - TriState eState = m_aOutlineBtn.GetState(); - const SfxPoolItem* pItem; - - if ( pOld ) - { - const SvxContourItem& rItem = *( (const SvxContourItem*)pOld ); - if ( rItem.GetValue() == StateToAttr( eState ) && m_aOutlineBtn.GetSavedValue() == eState ) - bChanged = false; - } - - if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - !StateToAttr( eState ) && ( (SvxContourItem*)pItem )->GetValue() ) - bChanged = true; - - if ( bChanged && eState != STATE_DONTKNOW ) - { - rSet.Put( SvxContourItem( StateToAttr( eState ), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Shadow - nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_SHADOWED ); - eState = m_aShadowBtn.GetState(); - - if ( pOld ) - { - const SvxShadowedItem& rItem = *( (const SvxShadowedItem*)pOld ); - if ( rItem.GetValue() == StateToAttr( eState ) && m_aShadowBtn.GetSavedValue() == eState ) - bChanged = false; - } - - if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - !StateToAttr( eState ) && ( (SvxShadowedItem*)pItem )->GetValue() ) - bChanged = true; - - if ( bChanged && eState != STATE_DONTKNOW ) - { - rSet.Put( SvxShadowedItem( StateToAttr( eState ), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = true; - - // Blinking - nWhich = GetWhich( SID_ATTR_FLASH ); - pOld = GetOldItem( rSet, SID_ATTR_FLASH ); - eState = m_aBlinkingBtn.GetState(); - - if ( pOld ) - { - const SvxBlinkItem& rItem = *( (const SvxBlinkItem*)pOld ); - if ( rItem.GetValue() == StateToAttr( eState ) && m_aBlinkingBtn.GetSavedValue() == eState ) - bChanged = false; - } - - if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - !StateToAttr( eState ) && ( (SvxBlinkItem*)pItem )->GetValue() ) - bChanged = true; - - if ( bChanged && eState != STATE_DONTKNOW ) - { - rSet.Put( SvxBlinkItem( StateToAttr( eState ), nWhich ) ); - bModified = true; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - // Hidden - nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_HIDDEN ); - eState = m_aHiddenBtn.GetState(); - bChanged = true; - - if ( pOld ) - { - const SvxCharHiddenItem& rItem = *( (const SvxCharHiddenItem*)pOld ); - if ( rItem.GetValue() == StateToAttr( eState ) && m_aHiddenBtn.GetSavedValue() == eState ) - bChanged = false; - } - - if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, sal_False, &pItem ) == SFX_ITEM_SET && - !StateToAttr( eState ) && ( (SvxCharHiddenItem*)pItem )->GetValue() ) - bChanged = true; - - if ( bChanged && eState != STATE_DONTKNOW ) - { - rSet.Put( SvxCharHiddenItem( StateToAttr( eState ), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bModified |= FillItemSetColor_Impl( rSet ); - - return bModified; -} - -void SvxCharEffectsPage::DisableControls( sal_uInt16 nDisable ) -{ - if ( ( DISABLE_CASEMAP & nDisable ) == DISABLE_CASEMAP ) - { - m_aEffectsFT.Disable(); - m_aEffects2LB.Disable(); - } - - if ( ( DISABLE_WORDLINE & nDisable ) == DISABLE_WORDLINE ) - m_aIndividualWordsBtn.Disable(); - - if ( ( DISABLE_BLINK & nDisable ) == DISABLE_BLINK ) - m_aBlinkingBtn.Disable(); - - if ( ( DISABLE_UNDERLINE_COLOR & nDisable ) == DISABLE_UNDERLINE_COLOR ) - { - // disable the controls - m_aUnderlineColorFT.Disable( ); - m_aUnderlineColorLB.Disable( ); - // and reroute the selection handler of the controls which normally would affect the color box dis-/enabling - m_aUnderlineLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); - m_aStrikeoutLB.SetSelectHdl(LINK(this, SvxCharEffectsPage, UpdatePreview_Impl)); - } -} - -void SvxCharEffectsPage::EnableFlash() -{ - if ( !( ( m_nHtmlMode & HTMLMODE_ON ) && !( m_nHtmlMode & HTMLMODE_BLINK ) ) ) - m_aBlinkingBtn.Show(); -} - -// ----------------------------------------------------------------------- -void SvxCharEffectsPage::SetPreviewBackgroundToCharacter() -{ - m_bPreviewBackgroundToCharacter = sal_True; -} - -// ----------------------------------------------------------------------- -void SvxCharEffectsPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pDisableCtlItem,SfxUInt16Item,SID_DISABLE_CTL,sal_False); - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - if (pDisableCtlItem) - DisableControls(pDisableCtlItem->GetValue()); - - if (pFlagItem) - { - sal_uInt32 nFlags=pFlagItem->GetValue(); - if ( ( nFlags & SVX_ENABLE_FLASH ) == SVX_ENABLE_FLASH ) - EnableFlash(); - if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) - SetPreviewBackgroundToCharacter(); - } -} - -// class SvxCharPositionPage --------------------------------------------- - -SvxCharPositionPage::SvxCharPositionPage( Window* pParent, const SfxItemSet& rInSet ) : - - SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_POSITION ), rInSet, WIN_POS_PREVIEW, FT_POS_FONTTYPE ), - - m_aPositionLine ( this, CUI_RES( FL_POSITION ) ), - m_aHighPosBtn ( this, CUI_RES( RB_HIGHPOS ) ), - m_aNormalPosBtn ( this, CUI_RES( RB_NORMALPOS ) ), - m_aLowPosBtn ( this, CUI_RES( RB_LOWPOS ) ), - m_aHighLowFT ( this, CUI_RES( FT_HIGHLOW ) ), - m_aHighLowEdit ( this, CUI_RES( ED_HIGHLOW ) ), - m_aHighLowRB ( this, CUI_RES( CB_HIGHLOW ) ), - m_aFontSizeFT ( this, CUI_RES( FT_FONTSIZE ) ), - m_aFontSizeEdit ( this, CUI_RES( ED_FONTSIZE ) ), - m_aRotationScalingFL( this, CUI_RES( FL_ROTATION_SCALING ) ), - m_aScalingFL ( this, CUI_RES( FL_SCALING ) ), - m_a0degRB ( this, CUI_RES( RB_0_DEG ) ), - m_a90degRB ( this, CUI_RES( RB_90_DEG ) ), - m_a270degRB ( this, CUI_RES( RB_270_DEG ) ), - m_aFitToLineCB ( this, CUI_RES( CB_FIT_TO_LINE ) ), - m_aScaleWidthFT ( this, CUI_RES( FT_SCALE_WIDTH ) ), - m_aScaleWidthMF ( this, CUI_RES( MF_SCALE_WIDTH ) ), - - m_aKerningLine ( this, CUI_RES( FL_KERNING2 ) ), - m_aKerningLB ( this, CUI_RES( LB_KERNING2 ) ), - m_aKerningFT ( this, CUI_RES( FT_KERNING2 ) ), - m_aKerningEdit ( this, CUI_RES( ED_KERNING2 ) ), - m_aPairKerningBtn ( this, CUI_RES( CB_PAIRKERNING ) ), - - m_nSuperEsc ( (short)DFLT_ESC_SUPER ), - m_nSubEsc ( (short)DFLT_ESC_SUB ), - m_nScaleWidthItemSetVal ( 100 ), - m_nScaleWidthInitialVal ( 100 ), - m_nSuperProp ( (sal_uInt8)DFLT_ESC_PROP ), - m_nSubProp ( (sal_uInt8)DFLT_ESC_PROP ) -{ - FreeResource(); - Initialize(); -} - -// ----------------------------------------------------------------------- - -void SvxCharPositionPage::Initialize() -{ - // to handle the changes of the other pages - SetExchangeSupport(); - - GetPreviewFont().SetSize( Size( 0, 240 ) ); - GetPreviewCJKFont().SetSize( Size( 0, 240 ) ); - GetPreviewCTLFont().SetSize( Size( 0, 240 ) ); - - m_aNormalPosBtn.Check(); - PositionHdl_Impl( &m_aNormalPosBtn ); - m_aKerningLB.SelectEntryPos( 0 ); - KerningSelectHdl_Impl( NULL ); - - Link aLink = LINK( this, SvxCharPositionPage, PositionHdl_Impl ); - m_aHighPosBtn.SetClickHdl( aLink ); - m_aNormalPosBtn.SetClickHdl( aLink ); - m_aLowPosBtn.SetClickHdl( aLink ); - - aLink = LINK( this, SvxCharPositionPage, RotationHdl_Impl ); - m_a0degRB .SetClickHdl( aLink ); - m_a90degRB .SetClickHdl( aLink ); - m_a270degRB.SetClickHdl( aLink ); - - aLink = LINK( this, SvxCharPositionPage, FontModifyHdl_Impl ); - m_aHighLowEdit.SetModifyHdl( aLink ); - m_aFontSizeEdit.SetModifyHdl( aLink ); - - aLink = LINK( this, SvxCharPositionPage, LoseFocusHdl_Impl ); - m_aHighLowEdit.SetLoseFocusHdl( aLink ); - m_aFontSizeEdit.SetLoseFocusHdl( aLink ); - - m_aHighLowRB.SetClickHdl( LINK( this, SvxCharPositionPage, AutoPositionHdl_Impl ) ); - m_aFitToLineCB.SetClickHdl( LINK( this, SvxCharPositionPage, FitToLineHdl_Impl ) ); - m_aKerningLB.SetSelectHdl( LINK( this, SvxCharPositionPage, KerningSelectHdl_Impl ) ); - m_aKerningEdit.SetModifyHdl( LINK( this, SvxCharPositionPage, KerningModifyHdl_Impl ) ); - m_aPairKerningBtn.SetClickHdl( LINK( this, SvxCharPositionPage, PairKerningHdl_Impl ) ); - m_aScaleWidthMF.SetModifyHdl( LINK( this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl ) ); -} - -// ----------------------------------------------------------------------- - -void SvxCharPositionPage::UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc ) -{ - SetPrevFontEscapement( nProp, nEscProp, nEsc ); -} - -// ----------------------------------------------------------------------- - -void SvxCharPositionPage::SetEscapement_Impl( sal_uInt16 nEsc ) -{ - SvxEscapementItem aEscItm( (SvxEscapement)nEsc, SID_ATTR_CHAR_ESCAPEMENT ); - - if ( SVX_ESCAPEMENT_SUPERSCRIPT == nEsc ) - { - aEscItm.GetEsc() = m_nSuperEsc; - aEscItm.GetProp() = m_nSuperProp; - } - else if ( SVX_ESCAPEMENT_SUBSCRIPT == nEsc ) - { - aEscItm.GetEsc() = m_nSubEsc; - aEscItm.GetProp() = m_nSubProp; - } - - short nFac = aEscItm.GetEsc() < 0 ? -1 : 1; - - m_aHighLowEdit.SetValue( aEscItm.GetEsc() * nFac ); - m_aFontSizeEdit.SetValue( aEscItm.GetProp() ); - - if ( SVX_ESCAPEMENT_OFF == nEsc ) - { - m_aHighLowFT.Disable(); - m_aHighLowEdit.Disable(); - m_aFontSizeFT.Disable(); - m_aFontSizeEdit.Disable(); - m_aHighLowRB.Disable(); - } - else - { - m_aFontSizeFT.Enable(); - m_aFontSizeEdit.Enable(); - m_aHighLowRB.Enable(); - - if ( !m_aHighLowRB.IsChecked() ) - { - m_aHighLowFT.Enable(); - m_aHighLowEdit.Enable(); - } - else - AutoPositionHdl_Impl( &m_aHighLowRB ); - } - - UpdatePreview_Impl( 100, aEscItm.GetProp(), aEscItm.GetEsc() ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, PositionHdl_Impl, RadioButton*, pBtn ) -{ - sal_uInt16 nEsc = SVX_ESCAPEMENT_OFF; // also when pBtn == NULL - - if ( &m_aHighPosBtn == pBtn ) - nEsc = SVX_ESCAPEMENT_SUPERSCRIPT; - else if ( &m_aLowPosBtn == pBtn ) - nEsc = SVX_ESCAPEMENT_SUBSCRIPT; - - SetEscapement_Impl( nEsc ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, RotationHdl_Impl, RadioButton*, pBtn ) -{ - sal_Bool bEnable = sal_False; - if (&m_a90degRB == pBtn || &m_a270degRB == pBtn) - bEnable = sal_True; - else - OSL_ENSURE( &m_a0degRB == pBtn, "unexpected button" ); - m_aFitToLineCB.Enable( bEnable ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, FontModifyHdl_Impl, MetricField*, EMPTYARG ) -{ - sal_uInt8 nEscProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); - short nEsc = (short)m_aHighLowEdit.GetValue(); - nEsc *= m_aLowPosBtn.IsChecked() ? -1 : 1; - UpdatePreview_Impl( 100, nEscProp, nEsc ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, AutoPositionHdl_Impl, CheckBox*, pBox ) -{ - if ( pBox->IsChecked() ) - { - m_aHighLowFT.Disable(); - m_aHighLowEdit.Disable(); - } - else - PositionHdl_Impl( m_aHighPosBtn.IsChecked() ? &m_aHighPosBtn - : m_aLowPosBtn.IsChecked() ? &m_aLowPosBtn - : &m_aNormalPosBtn ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, FitToLineHdl_Impl, CheckBox*, pBox ) -{ - if ( &m_aFitToLineCB == pBox) - { - sal_uInt16 nVal = m_nScaleWidthInitialVal; - if (m_aFitToLineCB.IsChecked()) - nVal = m_nScaleWidthItemSetVal; - m_aScaleWidthMF.SetValue( nVal ); - - m_aPreviewWin.SetFontWidthScale( nVal ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, KerningSelectHdl_Impl, ListBox*, EMPTYARG ) -{ - if ( m_aKerningLB.GetSelectEntryPos() > 0 ) - { - m_aKerningFT.Enable(); - m_aKerningEdit.Enable(); - - if ( m_aKerningLB.GetSelectEntryPos() == 2 ) - { - // Condensed -> max value == 1/6 of the current font height - SvxFont& rFont = GetPreviewFont(); - long nMax = rFont.GetSize().Height() / 6; - m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nMax ), FUNIT_TWIP ); - m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); - } - else - { - m_aKerningEdit.SetMax( 9999 ); - m_aKerningEdit.SetLast( 9999 ); - } - } - else - { - m_aKerningEdit.SetValue( 0 ); - m_aKerningFT.Disable(); - m_aKerningEdit.Disable(); - } - - KerningModifyHdl_Impl( NULL ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, KerningModifyHdl_Impl, MetricField*, EMPTYARG ) -{ - long nVal = static_cast(m_aKerningEdit.GetValue()); - nVal = LogicToLogic( nVal, MAP_POINT, MAP_TWIP ); - long nKern = (short)m_aKerningEdit.Denormalize( nVal ); - - // Condensed? -> then negative - if ( m_aKerningLB.GetSelectEntryPos() == 2 ) - nKern *= -1; - - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - - rFont.SetFixKerning( (short)nKern ); - rCJKFont.SetFixKerning( (short)nKern ); - rCTLFont.SetFixKerning( (short)nKern ); - m_aPreviewWin.Invalidate(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, PairKerningHdl_Impl, CheckBox*, EMPTYARG ) -{ - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, LoseFocusHdl_Impl, MetricField*, pField ) -{ -#ifdef DBG_UTIL - sal_Bool bHigh = m_aHighPosBtn.IsChecked(); -#endif - sal_Bool bLow = m_aLowPosBtn.IsChecked(); - DBG_ASSERT( bHigh || bLow, "normal position is not valid" ); - - if ( &m_aHighLowEdit == pField ) - { - if ( bLow ) - m_nSubEsc = (short)m_aHighLowEdit.GetValue() * -1; - else - m_nSuperEsc = (short)m_aHighLowEdit.GetValue(); - } - else if ( &m_aFontSizeEdit == pField ) - { - if ( bLow ) - m_nSubProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); - else - m_nSuperProp = (sal_uInt8)m_aFontSizeEdit.GetValue(); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharPositionPage, ScaleWidthModifyHdl_Impl, MetricField*, EMPTYARG ) -{ - m_aPreviewWin.SetFontWidthScale( sal_uInt16( m_aScaleWidthMF.GetValue() ) ); - - return 0; -} - -void SvxCharPositionPage::ActivatePage( const SfxItemSet& rSet ) -{ - //update the preview - SvxCharBasePage::ActivatePage( rSet ); - - //the only thing that has to be checked is the max. allowed value for the - //condense edit field - if ( m_aKerningLB.GetSelectEntryPos() == 2 ) - { - // Condensed -> max value == 1/6 of the current font height - SvxFont& rFont = GetPreviewFont(); - long nMax = rFont.GetSize().Height() / 6; - long nKern = (short)m_aKerningEdit.Denormalize( LogicToLogic( static_cast(m_aKerningEdit.GetValue()), MAP_POINT, MAP_TWIP ) ); - m_aKerningEdit.SetMax( m_aKerningEdit.Normalize( nKern > nMax ? nKern : nMax ), FUNIT_TWIP ); - m_aKerningEdit.SetLast( m_aKerningEdit.GetMax( m_aKerningEdit.GetUnit() ) ); - } -} - -// ----------------------------------------------------------------------- - -int SvxCharPositionPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxCharPositionPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxCharPositionPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxCharPositionPage::GetRanges() -{ - return pPositionRanges; -} - -// ----------------------------------------------------------------------- -void SvxCharPositionPage::Reset( const SfxItemSet& rSet ) -{ - String sUser = GetUserData(); - - if ( sUser.Len() ) - { - m_nSuperEsc = (short)sUser.GetToken( 0 ).ToInt32(); - m_nSubEsc = (short)sUser.GetToken( 1 ).ToInt32(); - m_nSuperProp = (sal_uInt8)sUser.GetToken( 2 ).ToInt32(); - m_nSubProp = (sal_uInt8)sUser.GetToken( 3 ).ToInt32(); - } - - short nEsc = 0; - sal_uInt8 nEscProp = 100; - sal_uInt8 nProp = 100; - - m_aHighLowFT.Disable(); - m_aHighLowEdit.Disable(); - m_aFontSizeFT.Disable(); - m_aFontSizeEdit.Disable(); - - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); - - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) - { - const SvxEscapementItem& rItem = (SvxEscapementItem&)rSet.Get( nWhich ); - nEsc = rItem.GetEsc(); - nEscProp = rItem.GetProp(); - - if ( nEsc != 0 ) - { - m_aHighLowFT.Enable(); - m_aHighLowEdit.Enable(); - m_aFontSizeFT.Enable(); - m_aFontSizeEdit.Enable(); - - short nFac; - sal_Bool bAutomatic(sal_False); - - if ( nEsc > 0 ) - { - nFac = 1; - m_aHighPosBtn.Check( sal_True ); - if ( nEsc == DFLT_ESC_AUTO_SUPER ) - { - nEsc = DFLT_ESC_SUPER; - bAutomatic = sal_True; - } - } - else - { - nFac = -1; - m_aLowPosBtn.Check( sal_True ); - if ( nEsc == DFLT_ESC_AUTO_SUB ) - { - nEsc = DFLT_ESC_SUB; - bAutomatic = sal_True; - } - } - if (!m_aHighLowRB.IsEnabled()) - { - m_aHighLowRB.Enable(); - } - m_aHighLowRB.Check(bAutomatic); - - if ( m_aHighLowRB.IsChecked() ) - { - m_aHighLowFT.Disable(); - m_aHighLowEdit.Disable(); - } - m_aHighLowEdit.SetValue( m_aHighLowEdit.Normalize( nFac * nEsc ) ); - } - else - { - m_aNormalPosBtn.Check( sal_True ); - m_aHighLowRB.Check( sal_True ); - PositionHdl_Impl( NULL ); - } - //the height has to be set after the handler is called to keep the value also if the escapement is zero - m_aFontSizeEdit.SetValue( m_aFontSizeEdit.Normalize( nEscProp ) ); - } - else - { - m_aHighPosBtn.Check( sal_False ); - m_aNormalPosBtn.Check( sal_False ); - m_aLowPosBtn.Check( sal_False ); - } - - // BspFont setzen - SetPrevFontEscapement( nProp, nEscProp, nEsc ); - - // Kerning - nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); - - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) - { - const SvxKerningItem& rItem = (SvxKerningItem&)rSet.Get( nWhich ); - SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); - MapUnit eOrgUnit = (MapUnit)eUnit; - MapUnit ePntUnit( MAP_POINT ); - long nBig = static_cast(m_aKerningEdit.Normalize( static_cast(rItem.GetValue()) )); - long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit ); - - // Kerning am Font setzen, vorher in Twips umrechnen - long nKern = LogicToLogic( rItem.GetValue(), (MapUnit)eUnit, MAP_TWIP ); - rFont.SetFixKerning( (short)nKern ); - rCJKFont.SetFixKerning( (short)nKern ); - rCTLFont.SetFixKerning( (short)nKern ); - - if ( nKerning > 0 ) - { - m_aKerningLB.SelectEntryPos( LW_GESPERRT ); - } - else if ( nKerning < 0 ) - { - m_aKerningLB.SelectEntryPos( LW_SCHMAL ); - nKerning = -nKerning; - } - else - { - nKerning = 0; - m_aKerningLB.SelectEntryPos( LW_NORMAL ); - } - //enable/disable and set min/max of the Edit - KerningSelectHdl_Impl(&m_aKerningLB); - //the attribute value must be displayed also if it's above the maximum allowed value - long nVal = static_cast(m_aKerningEdit.GetMax()); - if(nVal < nKerning) - m_aKerningEdit.SetMax( nKerning ); - m_aKerningEdit.SetValue( nKerning ); - } - else - m_aKerningEdit.SetText( String() ); - - // Pair kerning - nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); - - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) - { - const SvxAutoKernItem& rItem = (SvxAutoKernItem&)rSet.Get( nWhich ); - m_aPairKerningBtn.Check( rItem.GetValue() ); - } - else - m_aPairKerningBtn.Check( sal_False ); - - // Scale Width - nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) - { - const SvxCharScaleWidthItem& rItem = ( SvxCharScaleWidthItem& ) rSet.Get( nWhich ); - m_nScaleWidthInitialVal = rItem.GetValue(); - m_aScaleWidthMF.SetValue( m_nScaleWidthInitialVal ); - } - else - m_aScaleWidthMF.SetValue( 100 ); - - nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_DEFAULT ) - m_nScaleWidthItemSetVal = ((SfxUInt16Item&) rSet.Get( nWhich )).GetValue(); - - // Rotation - nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); - SfxItemState eState = rSet.GetItemState( nWhich ); - if( SFX_ITEM_UNKNOWN == eState ) - { - m_aRotationScalingFL.Hide(); - m_aScalingFL.Show(); - m_a0degRB.Hide(); - m_a90degRB.Hide(); - m_a270degRB.Hide(); - m_aFitToLineCB.Hide(); - m_aFitToLineCB .Hide(); - - - // move the following controls upwards - Window* aCntrlArr[] = { - &m_aScaleWidthFT, &m_aScaleWidthMF, &m_aKerningLine, - &m_aKerningLB, &m_aKerningFT, &m_aKerningEdit, &m_aPairKerningBtn, - 0 }; - - long nDiff = m_aScaleWidthMF.GetPosPixel().Y() - - m_a0degRB.GetPosPixel().Y(); - - for( Window** ppW = aCntrlArr; *ppW; ++ppW ) - { - Point aPnt( (*ppW)->GetPosPixel() ); - aPnt.Y() -= nDiff; - (*ppW)->SetPosPixel( aPnt ); - } - } - else - { - m_aScalingFL.Hide(); - - Link aOldLink( m_aFitToLineCB.GetClickHdl() ); - m_aFitToLineCB.SetClickHdl( Link() ); - if( eState >= SFX_ITEM_DEFAULT ) - { - const SvxCharRotateItem& rItem = - (SvxCharRotateItem&) rSet.Get( nWhich ); - if (rItem.IsBottomToTop()) - m_a90degRB.Check( sal_True ); - else if (rItem.IsTopToBotton()) - m_a270degRB.Check( sal_True ); - else - { - DBG_ASSERT( 0 == rItem.GetValue(), "incorrect value" ); - m_a0degRB.Check( sal_True ); - } - m_aFitToLineCB.Check( rItem.IsFitToLine() ); - } - else - { - if( eState == SFX_ITEM_DONTCARE ) - { - m_a0degRB.Check( sal_False ); - m_a90degRB.Check( sal_False ); - m_a270degRB.Check( sal_False ); - } - else - m_a0degRB.Check( sal_True ); - - m_aFitToLineCB.Check( sal_False ); - } - m_aFitToLineCB.SetClickHdl( aOldLink ); - m_aFitToLineCB.Enable( !m_a0degRB.IsChecked() ); - - // is this value set? - if( SFX_ITEM_UNKNOWN == rSet.GetItemState( GetWhich( - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) )) - m_aFitToLineCB.Hide(); - } - - m_aHighPosBtn.SaveValue(); - m_aNormalPosBtn.SaveValue(); - m_aLowPosBtn.SaveValue(); - m_a0degRB.SaveValue(); - m_a90degRB.SaveValue(); - m_a270degRB.SaveValue(); - m_aFitToLineCB.SaveValue(); - m_aScaleWidthMF.SaveValue(); - m_aKerningLB.SaveValue(); - m_aKerningEdit.SaveValue(); - m_aPairKerningBtn.SaveValue(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharPositionPage::FillItemSet( SfxItemSet& rSet ) -{ - // Position (hoch, normal oder tief) - const SfxItemSet& rOldSet = GetItemSet(); - sal_Bool bModified = sal_False, bChanged = sal_True; - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT ); - const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_ESCAPEMENT ); - const bool bHigh = m_aHighPosBtn.IsChecked(); - short nEsc; - sal_uInt8 nEscProp; - - if ( bHigh || m_aLowPosBtn.IsChecked() ) - { - if ( m_aHighLowRB.IsChecked() ) - nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB; - else - { - nEsc = (short)m_aHighLowEdit.Denormalize( m_aHighLowEdit.GetValue() ); - nEsc *= (bHigh ? 1 : -1); - } - nEscProp = (sal_uInt8)m_aFontSizeEdit.Denormalize( m_aFontSizeEdit.GetValue() ); - } - else - { - nEsc = 0; - nEscProp = 100; - } - - if ( pOld ) - { - const SvxEscapementItem& rItem = *( (const SvxEscapementItem*)pOld ); - if ( rItem.GetEsc() == nEsc && rItem.GetProp() == nEscProp ) - bChanged = sal_False; - } - - if ( !bChanged && !m_aHighPosBtn.GetSavedValue() && - !m_aNormalPosBtn.GetSavedValue() && !m_aLowPosBtn.GetSavedValue() ) - bChanged = sal_True; - - if ( bChanged && - ( m_aHighPosBtn.IsChecked() || m_aNormalPosBtn.IsChecked() || m_aLowPosBtn.IsChecked() ) ) - { - rSet.Put( SvxEscapementItem( nEsc, nEscProp, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = sal_True; - - // Kerning - nWhich = GetWhich( SID_ATTR_CHAR_KERNING ); - pOld = GetOldItem( rSet, SID_ATTR_CHAR_KERNING ); - sal_uInt16 nPos = m_aKerningLB.GetSelectEntryPos(); - short nKerning = 0; - SfxMapUnit eUnit = rSet.GetPool()->GetMetric( nWhich ); - - if ( nPos == LW_GESPERRT || nPos == LW_SCHMAL ) - { - long nTmp = static_cast(m_aKerningEdit.GetValue()); - long nVal = LogicToLogic( nTmp, MAP_POINT, (MapUnit)eUnit ); - nKerning = (short)m_aKerningEdit.Denormalize( nVal ); - - if ( nPos == LW_SCHMAL ) - nKerning *= - 1; - } - - if ( pOld ) - { - const SvxKerningItem& rItem = *( (const SvxKerningItem*)pOld ); - if ( rItem.GetValue() == nKerning ) - bChanged = sal_False; - } - - if ( !bChanged && - ( m_aKerningLB.GetSavedValue() == LISTBOX_ENTRY_NOTFOUND || - ( !m_aKerningEdit.GetSavedValue().Len() && m_aKerningEdit.IsEnabled() ) ) ) - bChanged = sal_True; - - if ( bChanged && nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rSet.Put( SvxKerningItem( nKerning, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - bChanged = sal_True; - - // Pair-Kerning - nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN ); - - if ( m_aPairKerningBtn.IsChecked() != m_aPairKerningBtn.GetSavedValue() ) - { - rSet.Put( SvxAutoKernItem( m_aPairKerningBtn.IsChecked(), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - // Scale Width - nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); - if ( m_aScaleWidthMF.GetText() != m_aScaleWidthMF.GetSavedValue() ) - { - rSet.Put( SvxCharScaleWidthItem( (sal_uInt16)m_aScaleWidthMF.GetValue(), nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - // Rotation - nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); - if ( m_a0degRB .IsChecked() != m_a0degRB .GetSavedValue() || - m_a90degRB .IsChecked() != m_a90degRB .GetSavedValue() || - m_a270degRB .IsChecked() != m_a270degRB .GetSavedValue() || - m_aFitToLineCB.IsChecked() != m_aFitToLineCB.GetSavedValue() ) - { - SvxCharRotateItem aItem( 0, m_aFitToLineCB.IsChecked(), nWhich ); - if (m_a90degRB.IsChecked()) - aItem.SetBottomToTop(); - else if (m_a270degRB.IsChecked()) - aItem.SetTopToBotton(); - rSet.Put( aItem ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxCharPositionPage::FillUserData() -{ - const sal_Unicode cTok = ';'; - - String sUser( UniString::CreateFromInt32( m_nSuperEsc ) ); - sUser.Append( cTok ); - sUser.Append( UniString::CreateFromInt32( m_nSubEsc ) ); - sUser.Append( cTok ); - sUser.Append( UniString::CreateFromInt32( m_nSuperProp ) ); - sUser.Append( cTok ); - sUser.Append( UniString::CreateFromInt32( m_nSubProp ) ); - SetUserData( sUser ); -} - -// ----------------------------------------------------------------------- -void SvxCharPositionPage::SetPreviewBackgroundToCharacter() -{ - m_bPreviewBackgroundToCharacter = sal_True; -} -// ----------------------------------------------------------------------- -void SvxCharPositionPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - if (pFlagItem) - { - sal_uInt32 nFlags=pFlagItem->GetValue(); - if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) - SetPreviewBackgroundToCharacter(); - } -} -// class SvxCharTwoLinesPage ------------------------------------------------ - -SvxCharTwoLinesPage::SvxCharTwoLinesPage( Window* pParent, const SfxItemSet& rInSet ) : - - SvxCharBasePage( pParent, CUI_RES( RID_SVXPAGE_CHAR_TWOLINES ), rInSet, WIN_TWOLINES_PREVIEW, FT_TWOLINES_FONTTYPE ), - - m_aSwitchOnLine ( this, CUI_RES( FL_SWITCHON ) ), - m_aTwoLinesBtn ( this, CUI_RES( CB_TWOLINES ) ), - - m_aEncloseLine ( this, CUI_RES( FL_ENCLOSE ) ), - m_aStartBracketFT ( this, CUI_RES( FT_STARTBRACKET ) ), - m_aStartBracketLB ( this, CUI_RES( ED_STARTBRACKET ) ), - m_aEndBracketFT ( this, CUI_RES( FT_ENDBRACKET ) ), - m_aEndBracketLB ( this, CUI_RES( ED_ENDBRACKET ) ), - m_nStartBracketPosition( 0 ), - m_nEndBracketPosition( 0 ) -{ - FreeResource(); - Initialize(); -} - -// ----------------------------------------------------------------------- - -void SvxCharTwoLinesPage::Initialize() -{ - Size aSize = m_aStartBracketLB.GetSizePixel(); - aSize.Height() = m_aStartBracketLB.CalcSize( 1, 6 ).Height(); - m_aStartBracketLB.SetSizePixel( aSize ); - aSize = m_aEndBracketLB.GetSizePixel(); - aSize.Height() = m_aEndBracketLB.CalcSize( 1, 6 ).Height(); - m_aEndBracketLB.SetSizePixel( aSize ); - - m_aTwoLinesBtn.Check( sal_False ); - TwoLinesHdl_Impl( NULL ); - - m_aTwoLinesBtn.SetClickHdl( LINK( this, SvxCharTwoLinesPage, TwoLinesHdl_Impl ) ); - - Link aLink = LINK( this, SvxCharTwoLinesPage, CharacterMapHdl_Impl ); - m_aStartBracketLB.SetSelectHdl( aLink ); - m_aEndBracketLB.SetSelectHdl( aLink ); - - SvxFont& rFont = GetPreviewFont(); - SvxFont& rCJKFont = GetPreviewCJKFont(); - SvxFont& rCTLFont = GetPreviewCTLFont(); - rFont.SetSize( Size( 0, 220 ) ); - rCJKFont.SetSize( Size( 0, 220 ) ); - rCTLFont.SetSize( Size( 0, 220 ) ); -} - -// ----------------------------------------------------------------------- - -void SvxCharTwoLinesPage::SelectCharacter( ListBox* pBox ) -{ - - bool bStart = pBox == &m_aStartBracketLB; - //SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - //if(pFact) - { - //AbstractSvxCharacterMap* aDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP ); - SvxCharacterMap* aDlg = new SvxCharacterMap( this ); - aDlg->DisableFontSelection(); - - if ( aDlg->Execute() == RET_OK ) - { - sal_Unicode cChar = (sal_Unicode) aDlg->GetChar(); - SetBracket( cChar, bStart ); - } - else - { - pBox->SelectEntryPos( bStart ? m_nStartBracketPosition : m_nEndBracketPosition ); - } - delete aDlg; - } -} - -// ----------------------------------------------------------------------- - -void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, sal_Bool bStart ) -{ - sal_uInt16 nEntryPos = 0; - ListBox* pBox = bStart ? &m_aStartBracketLB : &m_aEndBracketLB; - if ( 0 == cBracket ) - pBox->SelectEntryPos(0); - else - { - bool bFound = false; - for ( sal_uInt16 i = 1; i < pBox->GetEntryCount(); ++i ) - { - if ( (sal_uLong)pBox->GetEntryData(i) != CHRDLG_ENCLOSE_SPECIAL_CHAR ) - { - const sal_Unicode cChar = pBox->GetEntry(i).GetChar(0); - if ( cChar == cBracket ) - { - pBox->SelectEntryPos(i); - nEntryPos = i; - bFound = true; - break; - } - } - } - - if ( !bFound ) - { - nEntryPos = pBox->InsertEntry( String( cBracket ) ); - pBox->SelectEntryPos( nEntryPos ); - } - } - if( bStart ) - m_nStartBracketPosition = nEntryPos; - else - m_nEndBracketPosition = nEntryPos; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharTwoLinesPage, TwoLinesHdl_Impl, CheckBox*, EMPTYARG ) -{ - sal_Bool bChecked = m_aTwoLinesBtn.IsChecked(); - m_aStartBracketFT.Enable( bChecked ); - m_aStartBracketLB.Enable( bChecked ); - m_aEndBracketFT.Enable( bChecked ); - m_aEndBracketLB.Enable( bChecked ); - - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxCharTwoLinesPage, CharacterMapHdl_Impl, ListBox*, pBox ) -{ - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - if ( CHRDLG_ENCLOSE_SPECIAL_CHAR == (sal_uLong)pBox->GetEntryData( nPos ) ) - SelectCharacter( pBox ); - else - { - bool bStart = pBox == &m_aStartBracketLB; - if( bStart ) - m_nStartBracketPosition = nPos; - else - m_nEndBracketPosition = nPos; - } - UpdatePreview_Impl(); - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxCharTwoLinesPage::ActivatePage( const SfxItemSet& rSet ) -{ - SvxCharBasePage::ActivatePage( rSet ); -} - -// ----------------------------------------------------------------------- - -int SvxCharTwoLinesPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxCharTwoLinesPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxCharTwoLinesPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxCharTwoLinesPage::GetRanges() -{ - return pTwoLinesRanges; -} - -// ----------------------------------------------------------------------- - -void SvxCharTwoLinesPage::Reset( const SfxItemSet& rSet ) -{ - m_aTwoLinesBtn.Check( sal_False ); - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); - SfxItemState eState = rSet.GetItemState( nWhich ); - - if ( eState >= SFX_ITEM_DONTCARE ) - { - const SvxTwoLinesItem& rItem = (SvxTwoLinesItem&)rSet.Get( nWhich ); - m_aTwoLinesBtn.Check( rItem.GetValue() ); - - if ( rItem.GetValue() ) - { - SetBracket( rItem.GetStartBracket(), sal_True ); - SetBracket( rItem.GetEndBracket(), sal_False ); - } - } - TwoLinesHdl_Impl( NULL ); - - SetPrevFontWidthScale( rSet ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCharTwoLinesPage::FillItemSet( SfxItemSet& rSet ) -{ - const SfxItemSet& rOldSet = GetItemSet(); - sal_Bool bModified = sal_False, bChanged = sal_True; - sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); - const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_CHAR_TWO_LINES ); - sal_Bool bOn = m_aTwoLinesBtn.IsChecked(); - sal_Unicode cStart = ( bOn && m_aStartBracketLB.GetSelectEntryPos() > 0 ) - ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; - sal_Unicode cEnd = ( bOn && m_aEndBracketLB.GetSelectEntryPos() > 0 ) - ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; - - if ( pOld ) - { - const SvxTwoLinesItem& rItem = *( (const SvxTwoLinesItem*)pOld ); - if ( rItem.GetValue() == bOn && - ( !bOn || ( rItem.GetStartBracket() == cStart && rItem.GetEndBracket() == cEnd ) ) ) - bChanged = sal_False; - } - - if ( bChanged ) - { - rSet.Put( SvxTwoLinesItem( bOn, cStart, cEnd, nWhich ) ); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich, sal_False ) ) - CLEARTITEM; - - return bModified; -} - -void SvxCharTwoLinesPage::UpdatePreview_Impl() -{ - sal_Unicode cStart = m_aStartBracketLB.GetSelectEntryPos() > 0 - ? m_aStartBracketLB.GetSelectEntry().GetChar(0) : 0; - sal_Unicode cEnd = m_aEndBracketLB.GetSelectEntryPos() > 0 - ? m_aEndBracketLB.GetSelectEntry().GetChar(0) : 0; - m_aPreviewWin.SetBrackets(cStart, cEnd); - m_aPreviewWin.SetTwoLines(m_aTwoLinesBtn.IsChecked()); - m_aPreviewWin.Invalidate(); -} -// ----------------------------------------------------------------------- -void SvxCharTwoLinesPage::SetPreviewBackgroundToCharacter() -{ - m_bPreviewBackgroundToCharacter = sal_True; -} - -// ----------------------------------------------------------------------- -void SvxCharTwoLinesPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_FLAG_TYPE,sal_False); - if (pFlagItem) - { - sal_uInt32 nFlags=pFlagItem->GetValue(); - if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) - SetPreviewBackgroundToCharacter(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/chardlg.h b/cui/source/tabpages/chardlg.h deleted file mode 100644 index f597a9bee..000000000 --- a/cui/source/tabpages/chardlg.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CHARDLG_H -#define _SVX_CHARDLG_H - -// define ---------------------------------------------------------------- - -#define CHRDLG_UNDERLINE_NONE 0 -#define CHRDLG_UNDERLINE_SINGLE 1 -#define CHRDLG_UNDERLINE_DOUBLE 2 -#define CHRDLG_UNDERLINE_DOTTED 3 -#define CHRDLG_UNDERLINE_DONTKNOW 4 -#define CHRDLG_UNDERLINE_DASH 5 -#define CHRDLG_UNDERLINE_LONGDASH 6 -#define CHRDLG_UNDERLINE_DASHDOT 7 -#define CHRDLG_UNDERLINE_DASHDOTDOT 8 -#define CHRDLG_UNDERLINE_SMALLWAVE 9 -#define CHRDLG_UNDERLINE_WAVE 10 -#define CHRDLG_UNDERLINE_DOUBLEWAVE 11 -#define CHRDLG_UNDERLINE_BOLD 12 -#define CHRDLG_UNDERLINE_BOLDDOTTED 13 -#define CHRDLG_UNDERLINE_BOLDDASH 14 -#define CHRDLG_UNDERLINE_BOLDLONGDASH 15 -#define CHRDLG_UNDERLINE_BOLDDASHDOT 16 -#define CHRDLG_UNDERLINE_BOLDDASHDOTDOT 17 -#define CHRDLG_UNDERLINE_BOLDWAVE 18 - -#define CHRDLG_STRIKEOUT_NONE 0 -#define CHRDLG_STRIKEOUT_SINGLE 1 -#define CHRDLG_STRIKEOUT_DOUBLE 2 -#define CHRDLG_STRIKEOUT_DONTKNOW 3 -#define CHRDLG_STRIKEOUT_BOLD 4 -#define CHRDLG_STRIKEOUT_SLASH 5 -#define CHRDLG_STRIKEOUT_X 6 - -#define CHRDLG_ENCLOSE_NONE 0 -#define CHRDLG_ENCLOSE_ROUND 1 -#define CHRDLG_ENCLOSE_SQUARE 2 -#define CHRDLG_ENCLOSE_POINTED 3 -#define CHRDLG_ENCLOSE_CURVED 4 -#define CHRDLG_ENCLOSE_SPECIAL_CHAR 5 - -#define CHRDLG_POSITION_OVER 0 -#define CHRDLG_POSITION_UNDER 1 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/chardlg.hrc b/cui/source/tabpages/chardlg.hrc deleted file mode 100644 index 259611da1..000000000 --- a/cui/source/tabpages/chardlg.hrc +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_CHARDLG_HRC -#define _SVX_CHARDLG_HRC - -// defines ------------------------------------------------------------------ - -// NamePage ----------------------------------------------------------------- - -#define FL_WEST 100 -#define FT_WEST_NAME 101 -#define LB_WEST_NAME 102 -#define FT_WEST_STYLE 103 -#define LB_WEST_STYLE 104 -#define FT_WEST_SIZE 105 -#define LB_WEST_SIZE 106 -#define FT_WEST_LANG 107 -#define LB_WEST_LANG 108 - -#define FL_EAST 110 -#define FT_EAST_NAME 111 -#define LB_EAST_NAME 112 -#define FT_EAST_STYLE 113 -#define LB_EAST_STYLE 114 -#define FT_EAST_SIZE 115 -#define LB_EAST_SIZE 116 -#define FT_EAST_LANG 117 -#define LB_EAST_LANG 118 - -#define FL_CTL 120 -#define FT_CTL_NAME 121 -#define LB_CTL_NAME 122 -#define FT_CTL_STYLE 123 -#define LB_CTL_STYLE 124 -#define FT_CTL_SIZE 125 -#define LB_CTL_SIZE 126 -#define FT_CTL_LANG 127 -#define LB_CTL_LANG 128 - -#define WIN_CHAR_PREVIEW 131 -#define FT_CHAR_FONTTYPE 132 - -#define FL_COLOR2 140 -#define FT_COLOR2 141 -#define LB_COLOR2 142 - -#define STR_CHARNAME_NOSTYLE 150 -#define STR_CHARNAME_TRANSPARENT 151 -#define STR_CHARNAME_FAMILY 152 -#define STR_CHARNAME_FONT 153 -#define STR_CHARNAME_STYLE 154 -#define STR_CHARNAME_TYPEFACE 155 - -// EffectsPage -------------------------------------------------------------- - -#define FT_FONTCOLOR 201 -#define LB_FONTCOLOR 202 - -#define FT_EFFECTS 203 -#define LB_EFFECTS 204 -#define LB_EFFECTS2 205 - -#define FT_RELIEF 206 -#define LB_RELIEF 207 - -#define CB_OUTLINE 208 -#define CB_SHADOW 209 -#define CB_BLINKING 210 -#define CB_CHARHIDDEN 211 - -#define FL_EFFECTS_VERTICAL 220 - -#define FT_OVERLINE 221 -#define LB_OVERLINE 222 -#define FT_OVERLINE_COLOR 223 -#define LB_OVERLINE_COLOR 224 - -#define FT_STRIKEOUT 225 -#define LB_STRIKEOUT 226 - -#define FT_UNDERLINE 227 -#define LB_UNDERLINE 228 -#define FT_UNDERLINE_COLOR 229 -#define LB_UNDERLINE_COLOR 230 - -#define CB_INDIVIDUALWORDS 231 - -#define FL_EFFECTS_ASIAN 240 - -#define FT_EMPHASIS 241 -#define LB_EMPHASIS 242 -#define FT_POSITION 243 -#define LB_POSITION 244 - -#define WIN_EFFECTS_PREVIEW 251 -#define FT_EFFECTS_FONTTYPE 252 - -#define STR_EFFECTS_TRANSPARENT 260 -#define STR_EFFECTS_CAPITALS 261 -#define STR_EFFECTS_LOWERCASE 262 -#define STR_EFFECTS_TITLE 263 -#define STR_EFFECTS_SMALL 264 -#define STR_EFFECTS_OUTLINE 265 -#define STR_EFFECTS_SHADOW 266 -#define STR_EFFECTS_BLINKING 267 - -// PositionPage ------------------------------------------------------------- - -#define FL_POSITION 300 -#define RB_HIGHPOS 301 -#define RB_NORMALPOS 302 -#define RB_LOWPOS 303 -#define FT_HIGHLOW 304 -#define ED_HIGHLOW 305 -#define CB_HIGHLOW 306 -#define FT_FONTSIZE 307 -#define ED_FONTSIZE 308 -#define FL_ROTATION_SCALING 309 -#define FL_SCALING 310 -#define RB_0_DEG 311 -#define RB_90_DEG 312 -#define RB_270_DEG 313 -#define CB_FIT_TO_LINE 314 -#define FT_SCALE_WIDTH 315 -#define MF_SCALE_WIDTH 316 - -#define FL_KERNING2 320 -#define LB_KERNING2 321 -#define FT_KERNING2 322 -#define ED_KERNING2 323 -#define CB_PAIRKERNING 324 - -#define WIN_POS_PREVIEW 331 -#define FT_POS_FONTTYPE 332 - -// TwoLinesPage ------------------------------------------------------------- - -#define FL_SWITCHON 400 -#define CB_TWOLINES 401 - -#define FL_ENCLOSE 410 -#define FT_STARTBRACKET 411 -#define ED_STARTBRACKET 412 -#define FT_ENDBRACKET 413 -#define ED_ENDBRACKET 414 - -#define FL_TWOLINES_PREVIEW 420 -#define WIN_TWOLINES_PREVIEW 421 -#define FT_TWOLINES_FONTTYPE 422 - -#define FT_WEST_NAME_NOCJK 423 -#define LB_WEST_NAME_NOCJK 424 -#define FT_WEST_STYLE_NOCJK 425 -#define LB_WEST_STYLE_NOCJK 426 -#define FT_WEST_SIZE_NOCJK 427 -#define LB_WEST_SIZE_NOCJK 428 -#define FT_WEST_LANG_NOCJK 429 -#define LB_WEST_LANG_NOCJK 430 - -#endif - diff --git a/cui/source/tabpages/chardlg.src b/cui/source/tabpages/chardlg.src deleted file mode 100644 index d1b1fc02e..000000000 --- a/cui/source/tabpages/chardlg.src +++ /dev/null @@ -1,1182 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include -#include "chardlg.hrc" -#include "chardlg.h" -#include - -// RID_SVXPAGE_CHAR_NAME ---------------------------------------------------- - -TabPage RID_SVXPAGE_CHAR_NAME -{ - HelpId = HID_SVXPAGE_CHAR_NAME ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_WEST - { - Pos = MAP_APPFONT ( 6 , 3 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Western text font"; - }; - FixedText FT_WEST_NAME - { - Pos = MAP_APPFONT ( 12 , 14 ); - Size = MAP_APPFONT ( 80 , 8 ); - }; - FixedText FT_WEST_NAME_NOCJK - { - Pos = MAP_APPFONT ( 12 , 6 ); - Size = MAP_APPFONT ( 112 , 8 ); - }; - ComboBox LB_WEST_NAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_NAME"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 25 ); - Size = MAP_APPFONT ( 80 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - ComboBox LB_WEST_NAME_NOCJK - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_NAME_NOCJK"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 17 ); - Size = MAP_APPFONT ( 112 , 71 ); - TabStop = TRUE; - DropDown = FALSE; - }; - FixedText FT_WEST_STYLE - { - Pos = MAP_APPFONT ( 96 , 14 ); - Size = MAP_APPFONT ( 40 , 8 ); - }; - FixedText FT_WEST_STYLE_NOCJK - { - Pos = MAP_APPFONT ( 130 , 6 ); - Size = MAP_APPFONT ( 72 , 8 ); - }; - ComboBox LB_WEST_STYLE - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_STYLE"; - Border = TRUE; - Pos = MAP_APPFONT ( 96 , 25 ); - Size = MAP_APPFONT ( 40 , 48 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - "Normal" ; - "Italic" ; - "Bold" ; - "Bold italic" ; - }; - }; - ComboBox LB_WEST_STYLE_NOCJK - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_STYLE_NOCJK"; - Border = TRUE; - Pos = MAP_APPFONT ( 130 , 17 ); - Size = MAP_APPFONT ( 72 , 71 ); - TabStop = TRUE; - DropDown = FALSE; - StringList [ en-US ] = - { - "Normal" ; - "Italic" ; - "Bold" ; - "Bold italic" ; - }; - }; - FixedText FT_WEST_SIZE - { - Pos = MAP_APPFONT ( 140 , 14 ); - Size = MAP_APPFONT ( 38 , 8 ); - Text [ en-US ] = "Size"; - }; - FixedText FT_WEST_SIZE_NOCJK - { - Pos = MAP_APPFONT ( 208 , 6 ); - Size = MAP_APPFONT ( 40 , 8 ); - Text [ en-US ] = "Size"; - }; - MetricBox LB_WEST_SIZE - { - HelpID = "cui:MetricBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_SIZE"; - Border = TRUE; - Pos = MAP_APPFONT ( 140 , 25 ); - Size = MAP_APPFONT ( 38 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - MetricBox LB_WEST_SIZE_NOCJK - { - HelpID = "cui:MetricBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_SIZE_NOCJK"; - Border = TRUE; - Pos = MAP_APPFONT ( 208 , 17 ); - Size = MAP_APPFONT ( 40 , 71 ); - TabStop = TRUE; - DropDown = FALSE; - }; - FixedText FT_WEST_LANG - { - Pos = MAP_APPFONT ( 182 , 14 ); - Size = MAP_APPFONT ( 66 , 8 ); - Text [ en-US ] = "Language"; - }; - FixedText FT_WEST_LANG_NOCJK - { - Pos = MAP_APPFONT ( 130 , 94 ); - Size = MAP_APPFONT ( 72 , 8 ); - Text [ en-US ] = "~Language"; - }; - ListBox LB_WEST_LANG - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_LANG"; - Border = TRUE; - Pos = MAP_APPFONT ( 182 , 25 ); - Size = MAP_APPFONT ( 66 , 72 ); - TabStop = TRUE; - Sort = TRUE ; - DropDown = TRUE; - }; - ListBox LB_WEST_LANG_NOCJK - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_NAME:LB_WEST_LANG_NOCJK"; - Border = TRUE; - Pos = MAP_APPFONT ( 130 , 105 ); - Size = MAP_APPFONT ( 72 , 72 ); - TabStop = TRUE; - Sort = TRUE ; - DropDown = TRUE; - }; - FixedLine FL_EAST - { - Pos = MAP_APPFONT ( 6 , 43 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Asian text font"; - }; - FixedText FT_EAST_NAME - { - Pos = MAP_APPFONT ( 12 , 54 ); - Size = MAP_APPFONT ( 80 , 8 ); - }; - ComboBox LB_EAST_NAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_EAST_NAME"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 65 ); - Size = MAP_APPFONT ( 80 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_EAST_STYLE - { - Pos = MAP_APPFONT ( 96 , 54 ); - Size = MAP_APPFONT ( 40 , 8 ); - }; - ComboBox LB_EAST_STYLE - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_EAST_STYLE"; - Border = TRUE; - Pos = MAP_APPFONT ( 96 , 65 ); - Size = MAP_APPFONT ( 40 , 48 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - "Normal" ; - "Italic" ; - "Bold" ; - "Bold italic" ; - }; - }; - FixedText FT_EAST_SIZE - { - Pos = MAP_APPFONT ( 140 , 54 ); - Size = MAP_APPFONT ( 38 , 8 ); - Text [ en-US ] = "Size"; - }; - MetricBox LB_EAST_SIZE - { - HelpID = "cui:MetricBox:RID_SVXPAGE_CHAR_NAME:LB_EAST_SIZE"; - Border = TRUE; - Pos = MAP_APPFONT ( 140 , 65 ); - Size = MAP_APPFONT ( 38 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_EAST_LANG - { - Pos = MAP_APPFONT ( 182 , 54 ); - Size = MAP_APPFONT ( 66 , 8 ); - Text [ en-US ] = "Language"; - }; - ListBox LB_EAST_LANG - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_NAME:LB_EAST_LANG"; - Border = TRUE; - Pos = MAP_APPFONT ( 182 , 65 ); - Size = MAP_APPFONT ( 66 , 72 ); - TabStop = TRUE; - Sort = TRUE ; - DropDown = TRUE; - }; - FixedLine FL_CTL - { - Pos = MAP_APPFONT ( 6 , 83 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "CTL font"; - }; - FixedText FT_CTL_NAME - { - Pos = MAP_APPFONT ( 12 , 94 ); - Size = MAP_APPFONT ( 80 , 8 ); - }; - ComboBox LB_CTL_NAME - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_CTL_NAME"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 105 ); - Size = MAP_APPFONT ( 80 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_CTL_STYLE - { - Pos = MAP_APPFONT ( 96 , 94 ); - Size = MAP_APPFONT ( 40 , 8 ); - }; - ComboBox LB_CTL_STYLE - { - HelpID = "cui:ComboBox:RID_SVXPAGE_CHAR_NAME:LB_CTL_STYLE"; - Border = TRUE; - Pos = MAP_APPFONT ( 96 , 105 ); - Size = MAP_APPFONT ( 40 , 48 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - "Normal" ; - "Italic" ; - "Bold" ; - "Bold italic" ; - }; - }; - FixedText FT_CTL_SIZE - { - Pos = MAP_APPFONT ( 140 , 94 ); - Size = MAP_APPFONT ( 38 , 8 ); - Text [ en-US ] = "Size"; - }; - MetricBox LB_CTL_SIZE - { - HelpID = "cui:MetricBox:RID_SVXPAGE_CHAR_NAME:LB_CTL_SIZE"; - Border = TRUE; - Pos = MAP_APPFONT ( 140 , 105 ); - Size = MAP_APPFONT ( 38 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_CTL_LANG - { - Pos = MAP_APPFONT ( 182 , 94 ); - Size = MAP_APPFONT ( 66 , 8 ); - Text [ en-US ] = "Language"; - }; - ListBox LB_CTL_LANG - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_NAME:LB_CTL_LANG"; - Border = TRUE; - Pos = MAP_APPFONT ( 182 , 105 ); - Size = MAP_APPFONT ( 66 , 72 ); - TabStop = TRUE; - Sort = TRUE ; - DropDown = TRUE; - }; - Window WIN_CHAR_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 149 ) ; - Size = MAP_APPFONT ( 248 , 37 ) ; - Text [ en-US ] = "Example"; - }; - FixedText FT_CHAR_FONTTYPE - { - Pos = MAP_APPFONT ( 6 , 129 ) ; - Size = MAP_APPFONT ( 248 , 16 ) ; - WordBreak = TRUE ; - }; - FixedLine FL_COLOR2 - { - Pos = MAP_APPFONT ( 6 , 83 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Color" ; - }; - FixedText FT_COLOR2 - { - Pos = MAP_APPFONT ( 12 , 94 ); - Size = MAP_APPFONT ( 58 , 8 ); - Text [ en-US ] = "Font ~color" ; - }; - ListBox LB_COLOR2 - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_NAME:LB_COLOR2"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 105 ); - Size = MAP_APPFONT ( 58 , 100 ); - TabStop = TRUE; - DropDown = TRUE; - }; - String STR_CHARNAME_NOSTYLE - { - Text [ en-US ] = "No %1"; - }; - String STR_CHARNAME_TRANSPARENT - { - Text [ en-US ] = "Transparent"; - }; - String STR_CHARNAME_FAMILY - { - Text [ en-US ] = "Family"; - }; - String STR_CHARNAME_FONT - { - Text [ en-US ] = "Font"; - }; - String STR_CHARNAME_STYLE - { - Text [ en-US ] = "Style"; - }; - String STR_CHARNAME_TYPEFACE - { - Text [ en-US ] = "Typeface"; - }; -}; - -// RID_SVXPAGE_CHAR_EFFECTS --------------------------------------------------- - -TabPage RID_SVXPAGE_CHAR_EFFECTS -{ - HelpId = HID_SVXPAGE_CHAR_EFFECTS ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedText FT_FONTCOLOR - { - Pos = MAP_APPFONT ( 10 , 4 ); - Size = MAP_APPFONT ( 82 , 8 ); - Text [ en-US ] = "Font ~color" ; - }; - ListBox LB_FONTCOLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_FONTCOLOR"; - Border = TRUE; - Pos = MAP_APPFONT ( 10 , 15 ); - Size = MAP_APPFONT ( 82 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_EFFECTS - { - Pos = MAP_APPFONT( 10 , 33 ); - Size = MAP_APPFONT( 82 , 8 ); - Text [ en-US ] = "~Effects" ; - }; - ListBox LB_EFFECTS2 - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_EFFECTS2"; - Pos = MAP_APPFONT ( 10 , 44 ) ; - Size = MAP_APPFONT ( 82 , 56 ) ; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; Default ; > ; - < "Capitals" ; Default ; > ; - < "Lowercase" ; Default ; > ; - < "Title" ; Default ; > ; - < "Small capitals" ; Default ; > ; - }; - }; - FixedText FT_RELIEF - { - Pos = MAP_APPFONT ( 10 , 62 ); - Size = MAP_APPFONT ( 82 , 8 ); - Text [ en-US ] = "~Relief"; - }; - ListBox LB_RELIEF - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_RELIEF"; - Pos = MAP_APPFONT ( 10 , 73 ) ; - Size = MAP_APPFONT ( 82 , 56 ) ; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; Default ; > ; - < "Embossed" ; Default ; > ; - < "Engraved" ; Default ; > ; - }; - }; - TriStateBox CB_OUTLINE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_CHAR_EFFECTS:CB_OUTLINE"; - Pos = MAP_APPFONT ( 10 , 93 ) ; - Size = MAP_APPFONT ( 82 , 10 ) ; - Text [ en-US ] = "Out~line" ; - }; - TriStateBox CB_SHADOW - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_CHAR_EFFECTS:CB_SHADOW"; - Pos = MAP_APPFONT ( 10 , 107 ) ; - Size = MAP_APPFONT ( 82 , 10 ) ; - Text [ en-US ] = "Sha~dow" ; - }; - TriStateBox CB_BLINKING - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_CHAR_EFFECTS:CB_BLINKING"; - Pos = MAP_APPFONT ( 10 , 121 ) ; - Size = MAP_APPFONT ( 82 , 10 ) ; - Hide = TRUE; - Text [ en-US ] = "~Blinking" ; - }; - TriStateBox CB_CHARHIDDEN - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_CHAR_EFFECTS:CB_CHARHIDDEN"; - Pos = MAP_APPFONT ( 10 , 135 ) ; - Size = MAP_APPFONT ( 82 , 10 ) ; - Text [ en-US ] = "H~idden" ; - }; - FixedLine FL_EFFECTS_VERTICAL - { - Pos = MAP_APPFONT ( 100 , 4 ) ; - Size = MAP_APPFONT ( 4 , 142 ) ; - Vert = TRUE; - }; - FixedText FT_OVERLINE - { - Pos = MAP_APPFONT( 110 , 4 ); - Size = MAP_APPFONT( 68 , 8 ); - Text [ en-US ] = "~Overlining" ; - }; - ListBox LB_OVERLINE - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_OVERLINE"; - Border = TRUE; - Pos = MAP_APPFONT ( 110 , 15 ); - Size = MAP_APPFONT ( 68 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ; - < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ; - < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ; - < "Bold"; CHRDLG_UNDERLINE_BOLD; > ; - < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ; - < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ; - < "Dash"; CHRDLG_UNDERLINE_DASH; > ; - < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ; - < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ; - < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ; - < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ; - < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ; - < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ; - < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ; - < "Wave"; CHRDLG_UNDERLINE_WAVE; > ; - < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ; - < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ; - }; - }; - FixedText FT_OVERLINE_COLOR - { - Pos = MAP_APPFONT ( 184 , 4 ); - Size = MAP_APPFONT ( 68 , 8 ); - Text [ en-US ] = "O~verline color"; - }; - ListBox LB_OVERLINE_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_OVERLINE_COLOR"; - Border = TRUE; - Pos = MAP_APPFONT ( 184 , 15 ); - Size = MAP_APPFONT ( 68 , 100 ); - TabStop = TRUE; - DropDown = TRUE; - }; - FixedText FT_STRIKEOUT - { - Pos = MAP_APPFONT ( 110 , 33 ); - Size = MAP_APPFONT ( 68 , 8 ); - Text [ en-US ] = "~Strikethrough" ; - }; - ListBox LB_STRIKEOUT - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_STRIKEOUT"; - Border = TRUE; - Pos = MAP_APPFONT ( 110 , 44 ); - Size = MAP_APPFONT ( 68 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; CHRDLG_STRIKEOUT_NONE ; > ; - < "Single" ; CHRDLG_STRIKEOUT_SINGLE ; > ; - < "Double" ; CHRDLG_STRIKEOUT_DOUBLE ; > ; - < "Bold" ; CHRDLG_STRIKEOUT_BOLD ; > ; - < "With /" ; CHRDLG_STRIKEOUT_SLASH ; > ; - < "With X" ; CHRDLG_STRIKEOUT_X ; > ; - }; - }; - FixedText FT_UNDERLINE - { - Pos = MAP_APPFONT( 110 , 62 ); - Size = MAP_APPFONT( 68 , 8 ); - Text [ en-US ] = "~Underlining" ; - }; - ListBox LB_UNDERLINE - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_UNDERLINE"; - Border = TRUE; - Pos = MAP_APPFONT ( 110 , 73 ); - Size = MAP_APPFONT ( 68 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; CHRDLG_UNDERLINE_NONE ; > ; - < "Single" ; CHRDLG_UNDERLINE_SINGLE ; > ; - < "Double" ; CHRDLG_UNDERLINE_DOUBLE ; > ; - < "Bold"; CHRDLG_UNDERLINE_BOLD; > ; - < "Dotted" ; CHRDLG_UNDERLINE_DOTTED ; > ; - < "Dotted (Bold)" ; CHRDLG_UNDERLINE_BOLDDOTTED; > ; - < "Dash"; CHRDLG_UNDERLINE_DASH; > ; - < "Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASH; > ; - < "Long Dash"; CHRDLG_UNDERLINE_LONGDASH; > ; - < "Long Dash (Bold)"; CHRDLG_UNDERLINE_BOLDLONGDASH; > ; - < "Dot Dash"; CHRDLG_UNDERLINE_DASHDOT; > ; - < "Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOT; > ; - < "Dot Dot Dash"; CHRDLG_UNDERLINE_DASHDOTDOT; > ; - < "Dot Dot Dash (Bold)"; CHRDLG_UNDERLINE_BOLDDASHDOTDOT; > ; - < "Wave"; CHRDLG_UNDERLINE_WAVE; > ; - < "Wave (Bold)"; CHRDLG_UNDERLINE_BOLDWAVE; > ; - < "Double Wave"; CHRDLG_UNDERLINE_DOUBLEWAVE; > ; - }; - }; - FixedText FT_UNDERLINE_COLOR - { - Pos = MAP_APPFONT ( 184 , 62 ); - Size = MAP_APPFONT ( 68 , 8 ); - Text [ en-US ] = "U~nderline color"; - }; - ListBox LB_UNDERLINE_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_UNDERLINE_COLOR"; - Border = TRUE; - Pos = MAP_APPFONT ( 184 , 73 ); - Size = MAP_APPFONT ( 68 , 100 ); - TabStop = TRUE; - DropDown = TRUE; - }; - CheckBox CB_INDIVIDUALWORDS - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CHAR_EFFECTS:CB_INDIVIDUALWORDS"; - Pos = MAP_APPFONT ( 110 , 93 ); - Size = MAP_APPFONT ( 68 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "Individual ~words" ; - }; - FixedLine FL_EFFECTS_ASIAN - { - Pos = MAP_APPFONT ( 106 , 110 ) ; - Size = MAP_APPFONT ( 148 , 4 ) ; - }; - FixedText FT_EMPHASIS - { - Pos = MAP_APPFONT ( 110 , 117 ); - Size = MAP_APPFONT ( 68 , 8 ); - Text [ en-US ] = "Emp~hasis mark" ; - }; - ListBox LB_EMPHASIS - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_EMPHASIS"; - Border = TRUE; - Pos = MAP_APPFONT ( 110 , 128 ); - Size = MAP_APPFONT ( 68 , 72 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "(Without)" ; default ; > ; - < "Dot" ; default ; > ; - < "Circle" ; default ; > ; - < "Disc" ; default ; > ; - < "Accent" ; default ; > ; - }; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT ( 184 , 117 ); - Size = MAP_APPFONT ( 68 , 8 ); - Text [ en-US ] = "~Position" ; - }; - ListBox LB_POSITION - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_EFFECTS:LB_POSITION"; - Border = TRUE; - Pos = MAP_APPFONT ( 184 , 128 ); - Size = MAP_APPFONT ( 68 , 48 ); - TabStop = TRUE; - DropDown = TRUE; - StringList [ en-US ] = - { - < "Above text" ; CHRDLG_POSITION_OVER ; > ; - < "Below text" ; CHRDLG_POSITION_UNDER ; > ; - }; - }; - Window WIN_EFFECTS_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 149 ) ; - Size = MAP_APPFONT ( 248 , 37 ) ; - Text [ en-US ] = "Example"; - }; - FixedText FT_EFFECTS_FONTTYPE - { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 248 , 16 ) ; - WordBreak = TRUE ; - Hide = TRUE; - }; - String STR_EFFECTS_CAPITALS - { - Text [ en-US ] = "Capitals" ; - }; - String STR_EFFECTS_LOWERCASE - { - Text [ en-US ] = "Lowercase" ; - }; - String STR_EFFECTS_TITLE - { - Text [ en-US ] = "Title" ; - }; - String STR_EFFECTS_SMALL - { - Text [ en-US ] = "Small Capitals" ; - }; - String STR_EFFECTS_OUTLINE - { - Text [ en-US ] = "Outline" ; - }; - String STR_EFFECTS_SHADOW - { - Text [ en-US ] = "Shadow" ; - }; - String STR_EFFECTS_BLINKING - { - Text [ en-US ] = "Blinking" ; - }; - String STR_CHARNAME_TRANSPARENT - { - Text [ en-US ] = "Transparent"; - }; -}; - -// RID_SVXPAGE_CHAR_POSITION ------------------------------------------------ - -TabPage RID_SVXPAGE_CHAR_POSITION -{ - HelpId = HID_SVXPAGE_CHAR_POSITION ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 6 , 3 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Position" ; - }; - RadioButton RB_HIGHPOS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_HIGHPOS"; - Pos = MAP_APPFONT ( 12 , 16 ); - Size = MAP_APPFONT ( 58 , 10 ); - Text [ en-US ] = "Superscript" ; - TabStop = TRUE; - }; - RadioButton RB_NORMALPOS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_NORMALPOS"; - Pos = MAP_APPFONT ( 12 , 30 ); - Size = MAP_APPFONT ( 58 , 10 ); - Text [ en-US ] = "Normal" ; - TabStop = TRUE; - }; - RadioButton RB_LOWPOS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_LOWPOS"; - Pos = MAP_APPFONT ( 12 , 44 ); - Size = MAP_APPFONT ( 58 , 10 ); - Text [ en-US ] = "Subscript" ; - TabStop = TRUE; - }; - FixedText FT_HIGHLOW - { - Pos = MAP_APPFONT ( 74 , 16 ); - Size = MAP_APPFONT ( 58 , 8 ); - Text [ en-US ] = "~Raise/lower by" ; - }; - MetricField ED_HIGHLOW - { - HelpID = "cui:MetricField:RID_SVXPAGE_CHAR_POSITION:ED_HIGHLOW"; - Border = TRUE; - Pos = MAP_APPFONT ( 136 , 14 ); - Size = MAP_APPFONT ( 30 , 12 ); - TabStop = TRUE; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 1 ; - Last = 100 ; - SpinSize = 1 ; - }; - CheckBox CB_HIGHLOW - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CHAR_POSITION:CB_HIGHLOW"; - Pos = MAP_APPFONT ( 172 , 16 ); - Size = MAP_APPFONT ( 76 , 10 ); - Text [ en-US ] = "A~utomatic" ; - TabStop = TRUE; - }; - FixedText FT_FONTSIZE - { - Pos = MAP_APPFONT ( 74 , 32 ); - Size = MAP_APPFONT ( 58 , 8 ); - Text [ en-US ] = "Relative font size" ; - }; - MetricField ED_FONTSIZE - { - HelpID = "cui:MetricField:RID_SVXPAGE_CHAR_POSITION:ED_FONTSIZE"; - Border = TRUE; - Pos = MAP_APPFONT ( 136 , 30 ); - Size = MAP_APPFONT ( 30 , 12 ); - TabStop = TRUE; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 1 ; - Last = 100 ; - SpinSize = 1 ; - }; - FixedLine FL_ROTATION_SCALING - { - Pos = MAP_APPFONT ( 6 , 59 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Rotation / scaling" ; - }; - FixedLine FL_SCALING - { - Pos = MAP_APPFONT ( 6 , 59 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Scaling" ; - }; - RadioButton RB_0_DEG - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_0_DEG"; - Pos = MAP_APPFONT ( 12 , 70 ); - Size = MAP_APPFONT ( 46 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "~0 degrees" ; - }; - RadioButton RB_90_DEG - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_90_DEG"; - Pos = MAP_APPFONT ( 62 , 70 ); - Size = MAP_APPFONT ( 46 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "~90 degrees" ; - }; - RadioButton RB_270_DEG - { - HelpID = "cui:RadioButton:RID_SVXPAGE_CHAR_POSITION:RB_270_DEG"; - Pos = MAP_APPFONT ( 112 , 70 ); - Size = MAP_APPFONT ( 46 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "~270 degrees" ; - }; - CheckBox CB_FIT_TO_LINE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CHAR_POSITION:CB_FIT_TO_LINE"; - Pos = MAP_APPFONT ( 162 , 70 ); - Size = MAP_APPFONT ( 86 , 10 ); - TabStop = TRUE; - Text [ en-US ] = "Fit to line" ; - }; - FixedText FT_SCALE_WIDTH - { - Pos = MAP_APPFONT ( 12 , 86 ); - Size = MAP_APPFONT ( 80 , 8 ); - Text [ en-US ] = "Scale ~width" ; - }; - MetricField MF_SCALE_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_CHAR_POSITION:MF_SCALE_WIDTH"; - Border = TRUE; - Pos = MAP_APPFONT ( 94 , 84 ); - Size = MAP_APPFONT ( 30 , 12 ); - TabStop = TRUE; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 999 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 50 ; - Last = 200 ; - SpinSize = 1 ; - }; - FixedLine FL_KERNING2 - { - Pos = MAP_APPFONT ( 6 , 100 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Spacing" ; - }; - ListBox LB_KERNING2 - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_POSITION:LB_KERNING2"; - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 111 ); - Size = MAP_APPFONT ( 72 , 48 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Default" ; Default ; > ; - < "Expanded" ; Default ; > ; - < "Condensed" ; Default ; > ; - }; - }; - FixedText FT_KERNING2 - { - Pos = MAP_APPFONT ( 86 , 113 ); - Size = MAP_APPFONT ( 24 , 8 ); - Center = TRUE ; - Text [ en-US ] = "b~y" ; - }; - MetricField ED_KERNING2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CHAR_POSITION:ED_KERNING2"; - Border = TRUE; - Pos = MAP_APPFONT ( 112 , 111 ); - Size = MAP_APPFONT ( 40 , 12 ); - TabStop = TRUE; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 1 ; - Unit = FUNIT_POINT ; - SpinSize = 10 ; - }; - CheckBox CB_PAIRKERNING - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CHAR_POSITION:CB_PAIRKERNING"; - Pos = MAP_APPFONT ( 156 , 113 ); - Size = MAP_APPFONT ( 92 , 10 ); - Text [ en-US ] = "~Pair kerning" ; - TabStop = TRUE; - }; - Window WIN_POS_PREVIEW - { - Text [ en-US ] = "Example" ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 149 ) ; - Size = MAP_APPFONT ( 248 , 37 ) ; - }; - FixedText FT_POS_FONTTYPE - { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 248 , 16 ) ; - WordBreak = TRUE ; - Hide = TRUE; - }; -}; - -TabPage RID_SVXPAGE_CHAR_TWOLINES -{ - HelpId = HID_SVXPAGE_CHAR_TWOLINES ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE ; - FixedLine FL_SWITCHON - { - Pos = MAP_APPFONT ( 6 , 3 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Double-lined" ; - }; - CheckBox CB_TWOLINES - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CHAR_TWOLINES:CB_TWOLINES"; - Pos = MAP_APPFONT ( 12 , 14 ); - Size = MAP_APPFONT ( 236 , 10 ); - Text [ en-US ] = "~Write in double lines" ; - TabStop = TRUE; - }; - FixedLine FL_ENCLOSE - { - Pos = MAP_APPFONT ( 6 , 30 ); - Size = MAP_APPFONT ( 248 , 8 ); - Text [ en-US ] = "Enclosing character" ; - }; - FixedText FT_STARTBRACKET - { - Pos = MAP_APPFONT ( 12 , 41 ); - Size = MAP_APPFONT ( 90 , 8 ); - Text [ en-US ] = "I~nitial character" ; - }; - ListBox ED_STARTBRACKET - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_TWOLINES:ED_STARTBRACKET"; - Pos = MAP_APPFONT ( 12 , 52 ); - Size = MAP_APPFONT ( 90 , 72 ); - TabStop = TRUE; - Border = TRUE; - StringList [ en-US ] = - { - < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ; - < "(" ; CHRDLG_ENCLOSE_ROUND ; > ; - < "[" ; CHRDLG_ENCLOSE_SQUARE ; > ; - < "<" ; CHRDLG_ENCLOSE_POINTED ; > ; - < "{" ; CHRDLG_ENCLOSE_CURVED ; > ; - < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ; - }; - }; - FixedText FT_ENDBRACKET - { - Pos = MAP_APPFONT ( 108 , 41 ); - Size = MAP_APPFONT ( 90 , 8 ); - Text [ en-US ] = "Final charact~er" ; - }; - ListBox ED_ENDBRACKET - { - HelpID = "cui:ListBox:RID_SVXPAGE_CHAR_TWOLINES:ED_ENDBRACKET"; - Pos = MAP_APPFONT ( 108 , 52 ); - Size = MAP_APPFONT ( 90 , 72 ); - TabStop = TRUE; - Border = TRUE; - StringList [ en-US ] = - { - < "(None)" ; CHRDLG_ENCLOSE_NONE ; > ; - < ")" ; CHRDLG_ENCLOSE_ROUND ; > ; - < "]" ; CHRDLG_ENCLOSE_SQUARE ; > ; - < ">" ; CHRDLG_ENCLOSE_POINTED ; > ; - < "}" ; CHRDLG_ENCLOSE_CURVED ; > ; - < "Other Characters..." ; CHRDLG_ENCLOSE_SPECIAL_CHAR ; > ; - }; - }; - Window WIN_TWOLINES_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 149 ) ; - Size = MAP_APPFONT ( 248 , 37 ) ; - Text [ en-US ] = "Example" ; - }; - FixedText FT_TWOLINES_FONTTYPE - { - Pos = MAP_APPFONT ( 6 , 168 ) ; - Size = MAP_APPFONT ( 248 , 16 ) ; - WordBreak = TRUE ; - Hide = TRUE; - }; -}; - - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/connect.cxx b/cui/source/tabpages/connect.cxx deleted file mode 100644 index c1ffd80f2..000000000 --- a/cui/source/tabpages/connect.cxx +++ /dev/null @@ -1,566 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include "svx/ofaitem.hxx" -#include -#include - -#define _SVX_CONNECT_CXX - -#include -#include -#include -#include - -#include "svx/connctrl.hxx" -#include "connect.hxx" -#include "connect.hrc" -#include -#include "svx/dlgutil.hxx" - -#include "paragrph.hrc" -#include - -static sal_uInt16 pRanges[] = -{ - SDRATTR_EDGE_FIRST, - SDRATTR_EDGE_LAST, - 0 -}; - -/************************************************************************* -|* -|* Dialog zum Aendern von Konnektoren (Connectors) -|* -\************************************************************************/ - -SvxConnectionDialog::SvxConnectionDialog( Window* pParent, const SfxItemSet& rInAttrs, - const SdrView* pSdrView ) : - SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_CONNECTION ) -{ - SvxConnectionPage* _pPage = new SvxConnectionPage( this, rInAttrs ); - - _pPage->SetView( pSdrView ); - _pPage->Construct(); - - SetTabPage( _pPage ); - SetText( _pPage->GetText() ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxConnectionDialog::~SvxConnectionDialog() -{ -} - -/************************************************************************* -|* -|* Seite zum Aendern von Konnektoren (Connectors) -|* -\************************************************************************/ - -SvxConnectionPage::SvxConnectionPage( Window* pWindow, const SfxItemSet& rInAttrs ) : - SfxTabPage ( pWindow, CUI_RES( RID_SVXPAGE_CONNECTION ), - rInAttrs ), - - aFtType ( this, CUI_RES( FT_TYPE ) ), - aLbType ( this, CUI_RES( LB_TYPE ) ), - - aFlDelta ( this, CUI_RES( FL_DELTA ) ), - aFtLine1 ( this, CUI_RES( FT_LINE_1 ) ), - aMtrFldLine1 ( this, CUI_RES( MTR_FLD_LINE_1 ) ), - aFtLine2 ( this, CUI_RES( FT_LINE_2 ) ), - aMtrFldLine2 ( this, CUI_RES( MTR_FLD_LINE_2 ) ), - aFtLine3 ( this, CUI_RES( FT_LINE_3 ) ), - aMtrFldLine3 ( this, CUI_RES( MTR_FLD_LINE_3 ) ), - - aFlDistance ( this, CUI_RES( FL_DISTANCE ) ), - aFtHorz1 ( this, CUI_RES( FT_HORZ_1 ) ), - aMtrFldHorz1 ( this, CUI_RES( MTR_FLD_HORZ_1 ) ), - aFtVert1 ( this, CUI_RES( FT_VERT_1 ) ), - aMtrFldVert1 ( this, CUI_RES( MTR_FLD_VERT_1 ) ), - aFtHorz2 ( this, CUI_RES( FT_HORZ_2 ) ), - aMtrFldHorz2 ( this, CUI_RES( MTR_FLD_HORZ_2 ) ), - aFtVert2 ( this, CUI_RES( FT_VERT_2 ) ), - aMtrFldVert2 ( this, CUI_RES( MTR_FLD_VERT_2 ) ), - - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ), rInAttrs ), - rOutAttrs ( rInAttrs ), - aAttrSet ( *rInAttrs.GetPool() ) -{ - FreeResource(); - - aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - eUnit = pPool->GetMetric( SDRATTR_EDGENODE1HORZDIST ); - - FillTypeLB(); - - const FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( aMtrFldHorz1, eFUnit ); - SetFieldUnit( aMtrFldHorz2, eFUnit ); - SetFieldUnit( aMtrFldVert1, eFUnit ); - SetFieldUnit( aMtrFldVert2, eFUnit ); - SetFieldUnit( aMtrFldLine1, eFUnit ); - SetFieldUnit( aMtrFldLine2, eFUnit ); - SetFieldUnit( aMtrFldLine3, eFUnit ); - if( eFUnit == FUNIT_MM ) - { - aMtrFldHorz1.SetSpinSize( 50 ); - aMtrFldHorz2.SetSpinSize( 50 ); - aMtrFldVert1.SetSpinSize( 50 ); - aMtrFldVert2.SetSpinSize( 50 ); - aMtrFldLine1.SetSpinSize( 50 ); - aMtrFldLine2.SetSpinSize( 50 ); - aMtrFldLine3.SetSpinSize( 50 ); - } - - // disable 3D border - aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO); - - Link aLink( LINK( this, SvxConnectionPage, ChangeAttrHdl_Impl ) ); - aMtrFldHorz1.SetModifyHdl( aLink ); - aMtrFldVert1.SetModifyHdl( aLink ); - aMtrFldHorz2.SetModifyHdl( aLink ); - aMtrFldVert2.SetModifyHdl( aLink ); - aMtrFldLine1.SetModifyHdl( aLink ); - aMtrFldLine2.SetModifyHdl( aLink ); - aMtrFldLine3.SetModifyHdl( aLink ); - aLbType.SetSelectHdl( aLink ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxConnectionPage::~SvxConnectionPage() -{ -} - -/************************************************************************* -|* -|* Liest uebergebenen Item-Set -|* -\************************************************************************/ - -void SvxConnectionPage::Reset( const SfxItemSet& rAttrs ) -{ - const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_EDGENODE1HORZDIST ); - const SfxItemPool* pPool = rAttrs.GetPool(); - - // SdrEdgeNode1HorzDistItem - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1HORZDIST ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeNode1HorzDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHorz1, nValue, eUnit ); - } - else - aMtrFldHorz1.SetEmptyFieldValue(); - - aMtrFldHorz1.SaveValue(); - - // SdrEdgeNode2HorzDistItem - pItem = GetItem( rAttrs, SDRATTR_EDGENODE2HORZDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2HORZDIST ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeNode2HorzDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHorz2, nValue, eUnit ); - } - else - aMtrFldHorz2.SetEmptyFieldValue(); - - aMtrFldHorz2.SaveValue(); - - // SdrEdgeNode1VertDistItem - pItem = GetItem( rAttrs, SDRATTR_EDGENODE1VERTDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE1VERTDIST ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeNode1VertDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldVert1, nValue, eUnit ); - } - else - aMtrFldVert1.SetEmptyFieldValue(); - - aMtrFldVert1.SaveValue(); - - // SdrEdgeNode2VertDistItem - pItem = GetItem( rAttrs, SDRATTR_EDGENODE2VERTDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGENODE2VERTDIST ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeNode2VertDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldVert2, nValue, eUnit ); - } - else - aMtrFldVert2.SetEmptyFieldValue(); - - aMtrFldVert2.SaveValue(); - - // SdrEdgeLine1DeltaItem - pItem = GetItem( rAttrs, SDRATTR_EDGELINE1DELTA ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE1DELTA ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeLine1DeltaItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldLine1, nValue, eUnit ); - } - else - aMtrFldLine1.SetEmptyFieldValue(); - - aMtrFldLine1.SaveValue(); - - // SdrEdgeLine2DeltaItem - pItem = GetItem( rAttrs, SDRATTR_EDGELINE2DELTA ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE2DELTA ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeLine2DeltaItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldLine2, nValue, eUnit ); - } - else - aMtrFldLine2.SetEmptyFieldValue(); - - aMtrFldLine2.SaveValue(); - - // SdrEdgeLine3DeltaItem - pItem = GetItem( rAttrs, SDRATTR_EDGELINE3DELTA ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINE3DELTA ); - if( pItem ) - { - long nValue = ( ( const SdrEdgeLine3DeltaItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldLine3, nValue, eUnit ); - } - else - aMtrFldLine3.SetEmptyFieldValue(); - - aMtrFldLine3.SaveValue(); - - // SdrEdgeLineDeltaAnzItem - pItem = GetItem( rAttrs, SDRATTR_EDGELINEDELTAANZ ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGELINEDELTAANZ ); - if( pItem ) - { - sal_uInt16 nValue = ( ( const SdrEdgeLineDeltaAnzItem* )pItem )->GetValue(); - if( nValue <= 2 ) - { - aFtLine3.Enable( sal_False ); - aMtrFldLine3.Enable( sal_False ); - aMtrFldLine3.SetEmptyFieldValue(); - } - if( nValue <= 1 ) - { - aFtLine2.Enable( sal_False ); - aMtrFldLine2.Enable( sal_False ); - aMtrFldLine2.SetEmptyFieldValue(); - } - if( nValue == 0 ) - { - aFtLine1.Enable( sal_False ); - aMtrFldLine1.Enable( sal_False ); - aMtrFldLine1.SetEmptyFieldValue(); - } - } - - // SdrEdgeKindItem - pItem = GetItem( rAttrs, SDRATTR_EDGEKIND ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND ); - if( pItem ) - { - SdrEdgeKind nValue = ( ( const SdrEdgeKindItem* )pItem )->GetValue(); - aLbType.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(nValue) ); - } - else - aLbType.SetNoSelection(); - aLbType.SaveValue(); -} - -/************************************************************************* -|* -|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen -|* -\************************************************************************/ - -sal_Bool SvxConnectionPage::FillItemSet( SfxItemSet& rAttrs) -{ - sal_Bool bModified = sal_False; - sal_Int32 nValue; - - if( aMtrFldHorz1.GetText() != aMtrFldHorz1.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHorz1, eUnit ); - rAttrs.Put( SdrEdgeNode1HorzDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldHorz2.GetText() != aMtrFldHorz2.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHorz2, eUnit ); - rAttrs.Put( SdrEdgeNode2HorzDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldVert1.GetText() != aMtrFldVert1.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldVert1, eUnit ); - rAttrs.Put( SdrEdgeNode1VertDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldVert2.GetText() != aMtrFldVert2.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldVert2, eUnit ); - rAttrs.Put( SdrEdgeNode2VertDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldLine1.GetText() != aMtrFldLine1.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldLine1, eUnit ); - rAttrs.Put( SdrEdgeLine1DeltaItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldLine2.GetText() != aMtrFldLine2.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldLine2, eUnit ); - rAttrs.Put( SdrEdgeLine2DeltaItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldLine3.GetText() != aMtrFldLine3.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldLine3, eUnit ); - rAttrs.Put( SdrEdgeLine3DeltaItem( nValue ) ); - bModified = sal_True; - } - - - sal_uInt16 nPos = aLbType.GetSelectEntryPos(); - if( nPos != aLbType.GetSavedValue() ) - { - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rAttrs.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) ); - bModified = sal_True; - } - } - - return( bModified ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxConnectionPage::Construct() -{ - DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); - - aCtlPreview.SetView( pView ); - aCtlPreview.Construct(); -} - -/************************************************************************* -|* -|* Erzeugt die Seite -|* -\************************************************************************/ - -SfxTabPage* SvxConnectionPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxConnectionPage( pWindow, rAttrs ) ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16* SvxConnectionPage::GetRanges() -{ - return( pRanges ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxConnectionPage, ChangeAttrHdl_Impl, void *, p ) -{ - if( p == &aMtrFldHorz1 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHorz1, eUnit ); - aAttrSet.Put( SdrEdgeNode1HorzDistItem( nValue ) ); - } - - if( p == &aMtrFldHorz2 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHorz2, eUnit ); - aAttrSet.Put( SdrEdgeNode2HorzDistItem( nValue ) ); - } - - if( p == &aMtrFldVert1 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldVert1, eUnit ); - aAttrSet.Put( SdrEdgeNode1VertDistItem( nValue ) ); - } - - if( p == &aMtrFldVert2 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldVert2, eUnit ); - aAttrSet.Put( SdrEdgeNode2VertDistItem( nValue ) ); - } - - if( p == &aMtrFldLine1 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldLine1, eUnit ); - aAttrSet.Put( SdrEdgeLine1DeltaItem( nValue ) ); - } - - if( p == &aMtrFldLine2 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldLine2, eUnit ); - aAttrSet.Put( SdrEdgeLine2DeltaItem( nValue ) ); - } - - if( p == &aMtrFldLine3 ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldLine3, eUnit ); - aAttrSet.Put( SdrEdgeLine3DeltaItem( nValue ) ); - } - - - if( p == &aLbType ) - { - sal_uInt16 nPos = aLbType.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aAttrSet.Put( SdrEdgeKindItem( (SdrEdgeKind) nPos ) ); - } - } - - aCtlPreview.SetAttributes( aAttrSet ); - - if( p == &aLbType ) - { - // Anzahl der Linienversaetze ermitteln - sal_uInt16 nCount = aCtlPreview.GetLineDeltaAnz(); - - aFtLine3.Enable( nCount > 2 ); - aMtrFldLine3.Enable( nCount > 2 ); - if( nCount > 2 ) - aMtrFldLine3.SetValue( aMtrFldLine3.GetValue() ); - else - aMtrFldLine3.SetEmptyFieldValue(); - - aFtLine2.Enable( nCount > 1 ); - aMtrFldLine2.Enable( nCount > 1 ); - if( nCount > 1 ) - aMtrFldLine2.SetValue( aMtrFldLine2.GetValue() ); - else - aMtrFldLine2.SetEmptyFieldValue(); - - aFtLine1.Enable( nCount > 0 ); - aMtrFldLine1.Enable( nCount > 0 ); - if( nCount > 0 ) - aMtrFldLine1.SetValue( aMtrFldLine1.GetValue() ); - else - aMtrFldLine1.SetEmptyFieldValue(); - - } - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxConnectionPage::FillTypeLB() -{ - // ListBox mit Verbindernamen fuellen - const SfxPoolItem* pItem = GetItem( rOutAttrs, SDRATTR_EDGEKIND ); - const SfxItemPool* pPool = rOutAttrs.GetPool(); - - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_EDGEKIND ); - if( pItem ) - { - const SdrEdgeKindItem* pEdgeKindItem = (const SdrEdgeKindItem*) pItem; - sal_uInt16 nCount = pEdgeKindItem->GetValueCount(); - String aStr; - - for( sal_uInt16 i = 0; i < nCount; i++ ) - { - aStr = pEdgeKindItem->GetValueTextByPos( i ); - aLbType.InsertEntry( aStr ); - } - } -} -void SvxConnectionPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG(&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); - if (pOfaPtrItem) - SetView( static_cast(pOfaPtrItem->GetValue()) ); - - Construct(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/connect.hrc b/cui/source/tabpages/connect.hrc deleted file mode 100644 index 263972a1d..000000000 --- a/cui/source/tabpages/connect.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FL_DISTANCE 1 -#define FL_DELTA 2 -#define FT_LINE_1 1 -#define FT_LINE_2 2 -#define FT_LINE_3 3 -#define MTR_FLD_LINE_1 1 -#define MTR_FLD_LINE_2 2 -#define MTR_FLD_LINE_3 3 -#define FT_HORZ_1 4 -#define FT_HORZ_2 5 -#define MTR_FLD_HORZ_1 4 -#define MTR_FLD_HORZ_2 5 -#define MTR_FLD_VERT_1 6 -#define MTR_FLD_VERT_2 7 -#define FT_VERT_2 7 -#define FT_VERT_1 6 -#define FT_TYPE 8 -#define LB_TYPE 1 -#define CTL_PREVIEW 1 diff --git a/cui/source/tabpages/connect.src b/cui/source/tabpages/connect.src deleted file mode 100644 index 3031be2c5..000000000 --- a/cui/source/tabpages/connect.src +++ /dev/null @@ -1,275 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // pragma ---------------------------------------------------------------- - - // include --------------------------------------------------------------- -#include -#include "connect.hrc" -#include -#include "helpid.hrc" -#include - - // RID_SVXPAGE_CONNECTION ------------------------------------------------ -TabPage RID_SVXPAGE_CONNECTION -{ - HelpId = HID_PAGE_CONNECTION ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Connector" ; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 6 , 8 ) ; - Size = MAP_APPFONT ( 25 , 8 ) ; - Text [ en-US ] = "~Type" ; - }; - ListBox LB_TYPE - { - HelpID = "cui:ListBox:RID_SVXPAGE_CONNECTION:LB_TYPE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 37 , 6 ) ; - Size = MAP_APPFONT ( 83 , 54 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedLine FL_DELTA - { - Pos = MAP_APPFONT ( 6 , 24 ) ; - Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Line skew" ; - }; - FixedText FT_LINE_1 - { - Pos = MAP_APPFONT ( 12 , 37 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "Line ~1" ; - }; - MetricField MTR_FLD_LINE_1 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 35 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedText FT_LINE_2 - { - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "Line ~2" ; - }; - MetricField MTR_FLD_LINE_2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 51 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedText FT_LINE_3 - { - Pos = MAP_APPFONT ( 12 , 69 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "Line ~3" ; - }; - MetricField MTR_FLD_LINE_3 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_LINE_3"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 67 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedLine FL_DISTANCE - { - Pos = MAP_APPFONT ( 6 , 85 ) ; - Size = MAP_APPFONT ( 120 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Line spacing" ; - }; - FixedText FT_HORZ_1 - { - Pos = MAP_APPFONT ( 12 , 98 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "~Begin horizontal" ; - }; - MetricField MTR_FLD_HORZ_1 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_HORZ_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 96 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedText FT_HORZ_2 - { - Pos = MAP_APPFONT ( 12 , 130 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "End ~horizontal" ; - }; - MetricField MTR_FLD_HORZ_2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_HORZ_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 128 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedText FT_VERT_1 - { - Pos = MAP_APPFONT ( 12 , 114 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "Begin ~vertical" ; - }; - MetricField MTR_FLD_VERT_1 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_VERT_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 112 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - FixedText FT_VERT_2 - { - Pos = MAP_APPFONT ( 12 , 146 ) ; - Size = MAP_APPFONT ( 66 , 8 ) ; - Text [ en-US ] = "~End vertical" ; - }; - MetricField MTR_FLD_VERT_2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_CONNECTION:MTR_FLD_VERT_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 79 , 144 ) ; - Size = MAP_APPFONT ( 41 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - Unit = FUNIT_CM ; - }; - Control CTL_PREVIEW - { - HelpId = HID_PAGE_CONNECTION_CTL_PREVIEW ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 + 120 + RSC_SP_FLGR_SPACE_Y + RSC_SP_FLGR_INNERBORDER_LEFT , 35 ) ; - Size = MAP_APPFONT ( 118 , 121 ) ; - QuickHelpText [ en-US ] = "Preview"; - }; -}; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx deleted file mode 100644 index 08f37dc50..000000000 --- a/cui/source/tabpages/dstribut.cxx +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "dstribut.hxx" -#include "dstribut.hrc" -#include -#include -#include -#include - -static sal_uInt16 pRanges[] = -{ - SDRATTR_MEASURE_FIRST, - SDRATTR_MEASURE_LAST, - 0 -}; - -/************************************************************************* -|* -|* Dialog -|* -\************************************************************************/ - -SvxDistributeDialog::SvxDistributeDialog( - Window* pParent, - const SfxItemSet& rInAttrs, - SvxDistributeHorizontal eHor, - SvxDistributeVertical eVer) -: SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ), - mpPage(0L) -{ - mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer); - SetTabPage(mpPage); - SetText(mpPage->GetText()); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxDistributeDialog::~SvxDistributeDialog() -{ -} - -/************************************************************************* -|* -|* Tabpage -|* -\************************************************************************/ - -SvxDistributePage::SvxDistributePage( - Window* pWindow, - const SfxItemSet& rInAttrs, - SvxDistributeHorizontal eHor, - SvxDistributeVertical eVer) -: SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs), - meDistributeHor(eHor), - meDistributeVer(eVer), - maFlHorizontal (this, CUI_RES(FL_HORIZONTAL )), - maBtnHorNone (this, CUI_RES(BTN_HOR_NONE )), - maBtnHorLeft (this, CUI_RES(BTN_HOR_LEFT )), - maBtnHorCenter (this, CUI_RES(BTN_HOR_CENTER )), - maBtnHorDistance (this, CUI_RES(BTN_HOR_DISTANCE )), - maBtnHorRight (this, CUI_RES(BTN_HOR_RIGHT )), - maHorLow (this, CUI_RES(IMG_HOR_LOW )), - maHorCenter (this, CUI_RES(IMG_HOR_CENTER )), - maHorDistance (this, CUI_RES(IMG_HOR_DISTANCE )), - maHorHigh (this, CUI_RES(IMG_HOR_HIGH )), - maFlVertical (this, CUI_RES(FL_VERTICAL )), - maBtnVerNone (this, CUI_RES(BTN_VER_NONE )), - maBtnVerTop (this, CUI_RES(BTN_VER_TOP )), - maBtnVerCenter (this, CUI_RES(BTN_VER_CENTER )), - maBtnVerDistance (this, CUI_RES(BTN_VER_DISTANCE )), - maBtnVerBottom (this, CUI_RES(BTN_VER_BOTTOM )), - maVerLow (this, CUI_RES(IMG_VER_LOW )), - maVerCenter (this, CUI_RES(IMG_VER_CENTER )), - maVerDistance (this, CUI_RES(IMG_VER_DISTANCE )), - maVerHigh (this, CUI_RES(IMG_VER_HIGH )) -{ - FreeResource(); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxDistributePage::~SvxDistributePage() -{ -} - -/************************************************************************* -|* -|* create the tabpage -|* -\************************************************************************/ - -SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs, - SvxDistributeHorizontal eHor, SvxDistributeVertical eVer) -{ - return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer)); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16* SvxDistributePage::GetRanges() -{ - return(pRanges); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/) -{ -} - -/************************************************************************* -|* -|* read the delivered Item-Set -|* -\************************************************************************/ - -void SvxDistributePage::Reset(const SfxItemSet& ) -{ - maBtnHorNone.SetState(sal_False); - maBtnHorLeft.SetState(sal_False); - maBtnHorCenter.SetState(sal_False); - maBtnHorDistance.SetState(sal_False); - maBtnHorRight.SetState(sal_False); - - switch(meDistributeHor) - { - case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break; - case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break; - case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break; - case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break; - case SvxDistributeHorizontalRight : maBtnHorRight.SetState(sal_True); break; - } - - maBtnVerNone.SetState(sal_False); - maBtnVerTop.SetState(sal_False); - maBtnVerCenter.SetState(sal_False); - maBtnVerDistance.SetState(sal_False); - maBtnVerBottom.SetState(sal_False); - - switch(meDistributeVer) - { - case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break; - case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break; - case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break; - case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break; - case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break; - } -} - -/************************************************************************* -|* -|* Fill the delivered Item-Set with dialogbox-attributes -|* -\************************************************************************/ - -sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& ) -{ - SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone); - SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone); - - if(maBtnHorLeft.IsChecked()) - eDistributeHor = SvxDistributeHorizontalLeft; - else if(maBtnHorCenter.IsChecked()) - eDistributeHor = SvxDistributeHorizontalCenter; - else if(maBtnHorDistance.IsChecked()) - eDistributeHor = SvxDistributeHorizontalDistance; - else if(maBtnHorRight.IsChecked()) - eDistributeHor = SvxDistributeHorizontalRight; - - if(maBtnVerTop.IsChecked()) - eDistributeVer = SvxDistributeVerticalTop; - else if(maBtnVerCenter.IsChecked()) - eDistributeVer = SvxDistributeVerticalCenter; - else if(maBtnVerDistance.IsChecked()) - eDistributeVer = SvxDistributeVerticalDistance; - else if(maBtnVerBottom.IsChecked()) - eDistributeVer = SvxDistributeVerticalBottom; - - if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer) - { - meDistributeHor = eDistributeHor; - meDistributeVer = eDistributeVer; - return sal_True; - } - - return sal_False; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/dstribut.hrc b/cui/source/tabpages/dstribut.hrc deleted file mode 100644 index b277da50f..000000000 --- a/cui/source/tabpages/dstribut.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FL_HORIZONTAL 1 -#define BTN_HOR_NONE 2 -#define BTN_HOR_LEFT 3 -#define BTN_HOR_CENTER 4 -#define BTN_HOR_DISTANCE 5 -#define BTN_HOR_RIGHT 6 -#define FL_VERTICAL 7 -#define BTN_VER_NONE 8 -#define BTN_VER_TOP 9 -#define BTN_VER_CENTER 10 -#define BTN_VER_DISTANCE 11 -#define BTN_VER_BOTTOM 12 -#define IMG_HOR_LOW 14 -#define IMG_HOR_CENTER 15 -#define IMG_HOR_DISTANCE 16 -#define IMG_HOR_HIGH 17 -#define IMG_VER_LOW 18 -#define IMG_VER_CENTER 19 -#define IMG_VER_DISTANCE 20 -#define IMG_VER_HIGH 21 diff --git a/cui/source/tabpages/dstribut.src b/cui/source/tabpages/dstribut.src deleted file mode 100644 index ed5108c90..000000000 --- a/cui/source/tabpages/dstribut.src +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include "dstribut.hrc" -#include "helpid.hrc" -#include - -// RID_SVXPAGE_DISTRIBUTE --------------------------------------------------- -#define STD_MASKCOLOR Color { Red=0xffff; Green=0x0000; Blue=0xffff; } -TabPage RID_SVXPAGE_DISTRIBUTE -{ - HelpId = HID_PAGE_DISTRIBUTE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 81 ) ; - Text [ en-US ] = "Distribution" ; - - FixedLine FL_HORIZONTAL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Horizontal" ; - }; - - RadioButton BTN_HOR_NONE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_HOR_NONE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 48 , 10 ) ; - Text [ en-US ] = "~None" ; - }; - - RadioButton BTN_HOR_LEFT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_HOR_LEFT"; - Pos = MAP_APPFONT ( 56 , 26 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Left" ; - }; - - RadioButton BTN_HOR_CENTER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_HOR_CENTER"; - Pos = MAP_APPFONT ( 105 , 26 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Center" ; - }; - - RadioButton BTN_HOR_DISTANCE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_HOR_DISTANCE"; - Pos = MAP_APPFONT ( 154 , 26 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Spacing" ; - }; - - RadioButton BTN_HOR_RIGHT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_HOR_RIGHT"; - Pos = MAP_APPFONT ( 203 , 26 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Right" ; - }; - - FixedImage IMG_HOR_LOW { - Pos = MAP_APPFONT ( 65 , 10 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dsth_low.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_HOR_CENTER { - Pos = MAP_APPFONT ( 114 , 10 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dsth_cen.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_HOR_DISTANCE { - Pos = MAP_APPFONT ( 163 , 10 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dsth_dst.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_HOR_HIGH { - Pos = MAP_APPFONT ( 212 , 10 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dsth_hig.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedLine FL_VERTICAL - { - Pos = MAP_APPFONT ( 6 , 42 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Vertical" ; - }; - - RadioButton BTN_VER_NONE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_VER_NONE"; - Pos = MAP_APPFONT ( 12 , 53 ) ; - Size = MAP_APPFONT ( 46 , 10 ) ; - Text [ en-US ] = "N~one" ; - }; - - RadioButton BTN_VER_TOP - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_VER_TOP"; - Pos = MAP_APPFONT ( 56 , 65 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Top" ; - }; - - RadioButton BTN_VER_CENTER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_VER_CENTER"; - Pos = MAP_APPFONT ( 105 , 65 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "C~enter" ; - }; - - RadioButton BTN_VER_DISTANCE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_VER_DISTANCE"; - Pos = MAP_APPFONT ( 154 , 65 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "S~pacing" ; - }; - - RadioButton BTN_VER_BOTTOM - { - HelpID = "cui:RadioButton:RID_SVXPAGE_DISTRIBUTE:BTN_VER_BOTTOM"; - Pos = MAP_APPFONT ( 203 , 65 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "~Bottom" ; - }; - - FixedImage IMG_VER_HIGH { - Pos = MAP_APPFONT ( 65 , 49 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dstv_hig.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_VER_CENTER { - Pos = MAP_APPFONT ( 114 , 49 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dstv_cen.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_VER_DISTANCE { - Pos = MAP_APPFONT ( 163 , 49 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dstv_dst.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - - FixedImage IMG_VER_LOW { - Pos = MAP_APPFONT ( 212 , 49 ); - Size = MAP_APPFONT ( 15 , 16 ); - Hide = FALSE; - Fixed = Image { - ImageBitmap = Bitmap { File = "dstv_low.bmp"; }; - MaskColor = STD_MASKCOLOR; - }; - }; - -}; - -// ********************************************************************** EOF diff --git a/cui/source/tabpages/frmdirlbox.src b/cui/source/tabpages/frmdirlbox.src deleted file mode 100644 index 518defe0c..000000000 --- a/cui/source/tabpages/frmdirlbox.src +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -// frame direction ------------------------------------------------------------ - -String RID_SVXSTR_FRAMEDIR_LTR -{ - Text [ en-US ] = "Left-to-right"; -}; - -String RID_SVXSTR_FRAMEDIR_RTL -{ - Text [ en-US ] = "Right-to-left"; -}; - -String RID_SVXSTR_FRAMEDIR_SUPER -{ - Text [ en-US ] = "Use superordinate object settings"; -}; - -// page direction ------------------------------------------------------------- - -String RID_SVXSTR_PAGEDIR_LTR_HORI -{ - Text [ en-US ] = "Left-to-right (horizontal)"; -}; - -String RID_SVXSTR_PAGEDIR_RTL_HORI -{ - Text [ en-US ] = "Right-to-left (horizontal)"; -}; - -String RID_SVXSTR_PAGEDIR_RTL_VERT -{ - Text [ en-US ] = "Right-to-left (vertical)"; -}; - -String RID_SVXSTR_PAGEDIR_LTR_VERT -{ - Text [ en-US ] = "Left-to-right (vertical)"; -}; - -// ---------------------------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx deleted file mode 100644 index 167280ca8..000000000 --- a/cui/source/tabpages/grfpage.cxx +++ /dev/null @@ -1,792 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for RID_SVXPAGE_GRFCROP - -#define CM_1_TO_TWIP 567 - - -inline long lcl_GetValue( MetricField& rMetric, FieldUnit eUnit ) -{ - return static_cast(rMetric.Denormalize( rMetric.GetValue( eUnit ))); -} - -/*-------------------------------------------------------------------- - Beschreibung: Grafik zuschneiden - --------------------------------------------------------------------*/ - -SvxGrfCropPage::SvxGrfCropPage ( Window *pParent, const SfxItemSet &rSet ) - : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_GRFCROP ), rSet ), - aCropFL( this, CUI_RES( FL_CROP )), - aZoomConstRB( this, CUI_RES( RB_ZOOMCONST)), - aSizeConstRB( this, CUI_RES( RB_SIZECONST)), - aLeftFT( this, CUI_RES( FT_LEFT )), - aLeftMF( this, CUI_RES( MF_LEFT )), - aRightFT( this, CUI_RES( FT_RIGHT )), - aRightMF( this, CUI_RES( MF_RIGHT )), - aTopFT( this, CUI_RES( FT_TOP )), - aTopMF( this, CUI_RES( MF_TOP )), - aBottomFT( this, CUI_RES( FT_BOTTOM )), - aBottomMF( this, CUI_RES( MF_BOTTOM )), - aZoomFL( this, CUI_RES( FL_ZOOM )), - aWidthZoomFT( this, CUI_RES( FT_WIDTHZOOM )), - aWidthZoomMF( this, CUI_RES( MF_WIDTHZOOM )), - aHeightZoomFT( this, CUI_RES( FT_HEIGHTZOOM)), - aHeightZoomMF( this, CUI_RES( MF_HEIGHTZOOM)), - aSizeFL( this, CUI_RES( FL_SIZE )), - aWidthFT( this, CUI_RES( FT_WIDTH )), - aWidthMF( this, CUI_RES( MF_WIDTH )), - aHeightFT( this, CUI_RES( FT_HEIGHT )), - aHeightMF( this, CUI_RES( MF_HEIGHT )), - aOrigSizeFT( this, CUI_RES(FT_ORIG_SIZE)), - aOrigSizePB( this, CUI_RES( PB_ORGSIZE )), - aExampleWN( this, CUI_RES( WN_BSP )), - pLastCropField(0), - bInitialized(sal_False), - bSetOrigSize(sal_False) -{ - FreeResource(); - - SetExchangeSupport(); - - // set the correct metric - const FieldUnit eMetric = GetModuleFieldUnit( rSet ); - - SetFieldUnit( aWidthMF, eMetric ); - SetFieldUnit( aHeightMF, eMetric ); - SetFieldUnit( aLeftMF, eMetric ); - SetFieldUnit( aRightMF, eMetric ); - SetFieldUnit( aTopMF , eMetric ); - SetFieldUnit( aBottomMF, eMetric ); - - Link aLk = LINK(this, SvxGrfCropPage, SizeHdl); - aWidthMF.SetModifyHdl( aLk ); - aHeightMF.SetModifyHdl( aLk ); - - aLk = LINK(this, SvxGrfCropPage, ZoomHdl); - aWidthZoomMF.SetModifyHdl( aLk ); - aHeightZoomMF.SetModifyHdl( aLk ); - - aLk = LINK(this, SvxGrfCropPage, CropHdl); - aLeftMF.SetDownHdl( aLk ); - aRightMF.SetDownHdl( aLk ); - aTopMF.SetDownHdl( aLk ); - aBottomMF.SetDownHdl( aLk ); - aLeftMF.SetUpHdl( aLk ); - aRightMF.SetUpHdl( aLk ); - aTopMF.SetUpHdl( aLk ); - aBottomMF.SetUpHdl( aLk ); - - aLk = LINK(this, SvxGrfCropPage, CropModifyHdl); - aLeftMF.SetModifyHdl( aLk ); - aRightMF.SetModifyHdl( aLk ); - aTopMF.SetModifyHdl( aLk ); - aBottomMF.SetModifyHdl( aLk ); - - aLk = LINK(this, SvxGrfCropPage, CropLoseFocusHdl); - aLeftMF.SetLoseFocusHdl( aLk ); - aRightMF.SetLoseFocusHdl( aLk ); - aTopMF.SetLoseFocusHdl( aLk ); - aBottomMF.SetLoseFocusHdl( aLk ); - - aLk = LINK(this, SvxGrfCropPage, OrigSizeHdl); - aOrigSizePB.SetClickHdl( aLk ); - - aTimer.SetTimeoutHdl(LINK(this, SvxGrfCropPage, Timeout)); - aTimer.SetTimeout( 1500 ); - - aOrigSizePB.SetAccessibleRelationLabeledBy( &aOrigSizeFT ); -} - -SvxGrfCropPage::~SvxGrfCropPage() -{ - aTimer.Stop(); -} - -SfxTabPage* SvxGrfCropPage::Create(Window *pParent, const SfxItemSet &rSet) -{ - return new SvxGrfCropPage( pParent, rSet ); -} - -void SvxGrfCropPage::Reset( const SfxItemSet &rSet ) -{ - const SfxPoolItem* pItem; - const SfxItemPool& rPool = *rSet.GetPool(); - - if(SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( - SID_ATTR_GRAF_KEEP_ZOOM ), sal_True, &pItem )) - { - if( ((const SfxBoolItem*)pItem)->GetValue() ) - aZoomConstRB.Check(); - else - aSizeConstRB.Check(); - aZoomConstRB.SaveValue(); - } - - sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_CROP ); - if( SFX_ITEM_SET == rSet.GetItemState( nW, sal_True, &pItem)) - { - FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); - - SvxGrfCrop* pCrop = (SvxGrfCrop*)pItem; - - aExampleWN.SetLeft( pCrop->GetLeft()); - aExampleWN.SetRight( pCrop->GetRight()); - aExampleWN.SetTop( pCrop->GetTop()); - aExampleWN.SetBottom( pCrop->GetBottom()); - - aLeftMF.SetValue( aLeftMF.Normalize( pCrop->GetLeft()), eUnit ); - aRightMF.SetValue( aRightMF.Normalize( pCrop->GetRight()), eUnit ); - aTopMF.SetValue( aTopMF.Normalize( pCrop->GetTop()), eUnit ); - aBottomMF.SetValue( aBottomMF.Normalize( pCrop->GetBottom()), eUnit ); - } - else - { - aLeftMF.SetValue( 0 ); - aRightMF.SetValue( 0 ); - aTopMF.SetValue( 0 ); - aBottomMF.SetValue( 0 ); - } - - nW = rPool.GetWhich( SID_ATTR_PAGE_SIZE ); - if ( SFX_ITEM_SET == rSet.GetItemState( nW, sal_False, &pItem ) ) - { - // Orientation und Size aus dem PageItem - FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); - - aPageSize = ((const SvxSizeItem*)pItem)->GetSize(); - - sal_Int64 nTmp = aHeightMF.Normalize(aPageSize.Height()); - aHeightMF.SetMax( nTmp, eUnit ); - nTmp = aWidthMF.Normalize(aPageSize.Width()); - aWidthMF.SetMax( nTmp, eUnit ); - nTmp = aWidthMF.Normalize( 23 ); - aHeightMF.SetMin( nTmp, eUnit ); - aWidthMF.SetMin( nTmp, eUnit ); - } - else - { - aPageSize = OutputDevice::LogicToLogic( - Size( CM_1_TO_TWIP, CM_1_TO_TWIP ), - MapMode( MAP_TWIP ), - MapMode( (MapUnit)rSet.GetPool()->GetMetric( nW ) ) ); - } - - sal_Bool bFound = sal_False; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) ) - { - const Graphic* pGrf = ((SvxBrushItem*)pItem)->GetGraphic(); - if( pGrf ) - aOrigSize = GetGrfOrigSize( *pGrf ); - - if( aOrigSize.Width() && aOrigSize.Height() ) - { - CalcMinMaxBorder(); - aExampleWN.SetGraphic( *pGrf ); - aExampleWN.SetFrameSize( aOrigSize ); - - bFound = sal_True; - if( ((SvxBrushItem*)pItem)->GetGraphicLink() ) - aGraphicName = *((SvxBrushItem*)pItem)->GetGraphicLink(); - } - } - - GraphicHasChanged( bFound ); - bReset = sal_True; - ActivatePage( rSet ); - bReset = sal_False; -} - -sal_Bool SvxGrfCropPage::FillItemSet(SfxItemSet &rSet) -{ - const SfxItemPool& rPool = *rSet.GetPool(); - sal_Bool bModified = sal_False; - if( aWidthMF.GetSavedValue() != aWidthMF.GetText() || - aHeightMF.GetSavedValue() != aHeightMF.GetText() ) - { - sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_FRMSIZE ); - FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); - - SvxSizeItem aSz( nW ); - - // die Groesse koennte schon von einer anderen Page gesetzt worden sein - // #44204# - const SfxItemSet* pExSet = GetTabDialog() ? GetTabDialog()->GetExampleSet() : NULL; - const SfxPoolItem* pItem = 0; - if( pExSet && SFX_ITEM_SET == - pExSet->GetItemState( nW, sal_False, &pItem ) ) - aSz = *(const SvxSizeItem*)pItem; - else - aSz = (const SvxSizeItem&)GetItemSet().Get( nW ); - - Size aTmpSz( aSz.GetSize() ); - if( aWidthMF.GetText() != aWidthMF.GetSavedValue() ) - aTmpSz.Width() = lcl_GetValue( aWidthMF, eUnit ); - if( aHeightMF.GetText() != aHeightMF.GetSavedValue() ) - aTmpSz.Height() = lcl_GetValue( aHeightMF, eUnit ); - aSz.SetSize( aTmpSz ); - aWidthMF.SaveValue(); - aHeightMF.SaveValue(); - - bModified |= 0 != rSet.Put( aSz ); - - if( bSetOrigSize ) - { - bModified |= 0 != rSet.Put( SvxSizeItem( rPool.GetWhich( - SID_ATTR_GRAF_FRMSIZE_PERCENT ), Size( 0, 0 )) ); - } - } - if( aLeftMF.IsModified() || aRightMF.IsModified() || - aTopMF.IsModified() || aBottomMF.IsModified() ) - { - sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_CROP ); - FieldUnit eUnit = MapToFieldUnit( rSet.GetPool()->GetMetric( nW )); - SvxGrfCrop* pNew = (SvxGrfCrop*)rSet.Get( nW ).Clone(); - - pNew->SetLeft( lcl_GetValue( aLeftMF, eUnit ) ); - pNew->SetRight( lcl_GetValue( aRightMF, eUnit ) ); - pNew->SetTop( lcl_GetValue( aTopMF, eUnit ) ); - pNew->SetBottom( lcl_GetValue( aBottomMF, eUnit ) ); - bModified |= 0 != rSet.Put( *pNew ); - delete pNew; - } - - if( aZoomConstRB.GetSavedValue() != aZoomConstRB.IsChecked() ) - { - bModified |= 0 != rSet.Put( SfxBoolItem( rPool.GetWhich( - SID_ATTR_GRAF_KEEP_ZOOM), aZoomConstRB.IsChecked() ) ); - } - - bInitialized = sal_False; - - return bModified; -} - -void SvxGrfCropPage::ActivatePage(const SfxItemSet& rSet) -{ -#ifdef DBG_UTIL - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); -#endif - - bSetOrigSize = sal_False; - - // Size - Size aSize; - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_FRMSIZE, sal_False, &pItem ) ) - aSize = ((const SvxSizeItem*)pItem)->GetSize(); - - nOldWidth = aSize.Width(); - nOldHeight = aSize.Height(); - - sal_Int64 nWidth = aWidthMF.Normalize(nOldWidth); - sal_Int64 nHeight = aHeightMF.Normalize(nOldHeight); - - if (nWidth != aWidthMF.GetValue(FUNIT_TWIP)) - { - if(!bReset) - { - // Wert wurde von Umlauf-Tabpage geaendert und muss - // mit Modify-Flag gesetzt werden - aWidthMF.SetUserValue(nWidth, FUNIT_TWIP); - } - else - aWidthMF.SetValue(nWidth, FUNIT_TWIP); - } - aWidthMF.SaveValue(); - - if (nHeight != aHeightMF.GetValue(FUNIT_TWIP)) - { - if (!bReset) - { - // Wert wurde von Umlauf-Tabpage geaendert und muss - // mit Modify-Flag gesetzt werden - aHeightMF.SetUserValue(nHeight, FUNIT_TWIP); - } - else - aHeightMF.SetValue(nHeight, FUNIT_TWIP); - } - aHeightMF.SaveValue(); - bInitialized = sal_True; - - if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) ) - { - const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem; - if( rBrush.GetGraphicLink() && - aGraphicName != *rBrush.GetGraphicLink() ) - aGraphicName = *rBrush.GetGraphicLink(); - - const Graphic* pGrf = rBrush.GetGraphic(); - if( pGrf ) - { - aExampleWN.SetGraphic( *pGrf ); - aOrigSize = GetGrfOrigSize( *pGrf ); - aExampleWN.SetFrameSize(aOrigSize); - GraphicHasChanged( aOrigSize.Width() && aOrigSize.Height() ); - CalcMinMaxBorder(); - } - else - GraphicHasChanged( sal_False ); - } - - CalcZoom(); -} - -int SvxGrfCropPage::DeactivatePage(SfxItemSet *_pSet) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return sal_True; -} - -/*-------------------------------------------------------------------- - Beschreibung: Massstab geaendert, Groesse anpassen - --------------------------------------------------------------------*/ - -IMPL_LINK( SvxGrfCropPage, ZoomHdl, MetricField *, pField ) -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - - if( pField == &aWidthZoomMF ) - { - long nLRBorders = lcl_GetValue(aLeftMF, eUnit) - +lcl_GetValue(aRightMF, eUnit); - aWidthMF.SetValue( aWidthMF.Normalize( - ((aOrigSize.Width() - nLRBorders) * pField->GetValue())/100L), - eUnit); - } - else - { - long nULBorders = lcl_GetValue(aTopMF, eUnit) - +lcl_GetValue(aBottomMF, eUnit); - aHeightMF.SetValue( aHeightMF.Normalize( - ((aOrigSize.Height() - nULBorders ) * pField->GetValue())/100L) , - eUnit ); - } - - return 0; -} - -/*-------------------------------------------------------------------- - Beschreibung: Groesse aendern, Massstab anpassen - --------------------------------------------------------------------*/ - -IMPL_LINK( SvxGrfCropPage, SizeHdl, MetricField *, pField ) -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - - Size aSize( lcl_GetValue(aWidthMF, eUnit), - lcl_GetValue(aHeightMF, eUnit) ); - - if(pField == &aWidthMF) - { - long nWidth = aOrigSize.Width() - - ( lcl_GetValue(aLeftMF, eUnit) + - lcl_GetValue(aRightMF, eUnit) ); - if(!nWidth) - nWidth++; - sal_uInt16 nZoom = (sal_uInt16)( aSize.Width() * 100L / nWidth); - aWidthZoomMF.SetValue(nZoom); - } - else - { - long nHeight = aOrigSize.Height() - - ( lcl_GetValue(aTopMF, eUnit) + - lcl_GetValue(aBottomMF, eUnit)); - if(!nHeight) - nHeight++; - sal_uInt16 nZoom = (sal_uInt16)( aSize.Height() * 100L/ nHeight); - aHeightZoomMF.SetValue(nZoom); - } - - return 0; -} - -/*-------------------------------------------------------------------- - Beschreibung: Raender auswerten - --------------------------------------------------------------------*/ - -IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - - sal_Bool bZoom = aZoomConstRB.IsChecked(); - if( pField == &aLeftMF || pField == &aRightMF ) - { - long nLeft = lcl_GetValue( aLeftMF, eUnit ); - long nRight = lcl_GetValue( aRightMF, eUnit ); - long nWidthZoom = static_cast(aWidthZoomMF.GetValue()); - if(bZoom && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom ) - / 100 >= aPageSize.Width() ) ) - { - if(pField == &aLeftMF) - { - nLeft = aOrigSize.Width() - - ( aPageSize.Width() * 100 / nWidthZoom + nRight ); - aLeftMF.SetValue( aLeftMF.Normalize( nLeft ), eUnit ); - } - else - { - nRight = aOrigSize.Width() - - ( aPageSize.Width() * 100 / nWidthZoom + nLeft ); - aRightMF.SetValue( aRightMF.Normalize( nRight ), eUnit ); - } - } - aExampleWN.SetLeft(nLeft); - aExampleWN.SetRight(nRight); - if(bZoom) - { - //Massstab bleibt -> Breite neu berechnen - ZoomHdl(&aWidthZoomMF); - } - } - else - { - long nTop = lcl_GetValue( aTopMF, eUnit ); - long nBottom = lcl_GetValue( aBottomMF, eUnit ); - long nHeightZoom = static_cast(aHeightZoomMF.GetValue()); - if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom) - / 100 >= aPageSize.Height())) - { - if(pField == &aTopMF) - { - nTop = aOrigSize.Height() - - ( aPageSize.Height() * 100 / nHeightZoom + nBottom); - aTopMF.SetValue( aWidthMF.Normalize( nTop ), eUnit ); - } - else - { - nBottom = aOrigSize.Height() - - ( aPageSize.Height() * 100 / nHeightZoom + nTop); - aBottomMF.SetValue( aWidthMF.Normalize( nBottom ), eUnit ); - } - } - aExampleWN.SetTop( nTop ); - aExampleWN.SetBottom( nBottom ); - if(bZoom) - { - //Massstab bleibt -> Hoehe neu berechnen - ZoomHdl(&aHeightZoomMF); - } - } - aExampleWN.Invalidate(); - //Groesse und Raender veraendert -> Massstab neu berechnen - if(!bZoom) - CalcZoom(); - CalcMinMaxBorder(); - return 0; -} -/*-------------------------------------------------------------------- - Beschreibung: Originalgroesse einstellen - --------------------------------------------------------------------*/ - -IMPL_LINK( SvxGrfCropPage, OrigSizeHdl, PushButton *, EMPTYARG ) -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - - long nWidth = aOrigSize.Width() - - lcl_GetValue( aLeftMF, eUnit ) - - lcl_GetValue( aRightMF, eUnit ); - aWidthMF.SetValue( aWidthMF.Normalize( nWidth ), eUnit ); - long nHeight = aOrigSize.Height() - - lcl_GetValue( aTopMF, eUnit ) - - lcl_GetValue( aBottomMF, eUnit ); - aHeightMF.SetValue( aHeightMF.Normalize( nHeight ), eUnit ); - aWidthZoomMF.SetValue(100); - aHeightZoomMF.SetValue(100); - bSetOrigSize = sal_True; - return 0; -} -/*-------------------------------------------------------------------- - Beschreibung: Massstab berechnen - --------------------------------------------------------------------*/ - -void SvxGrfCropPage::CalcZoom() -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - - long nWidth = lcl_GetValue( aWidthMF, eUnit ); - long nHeight = lcl_GetValue( aHeightMF, eUnit ); - long nLRBorders = lcl_GetValue( aLeftMF, eUnit ) + - lcl_GetValue( aRightMF, eUnit ); - long nULBorders = lcl_GetValue( aTopMF, eUnit ) + - lcl_GetValue( aBottomMF, eUnit ); - sal_uInt16 nZoom = 0; - long nDen; - if( (nDen = aOrigSize.Width() - nLRBorders) > 0) - nZoom = (sal_uInt16)((( nWidth * 1000L / nDen )+5)/10); - aWidthZoomMF.SetValue(nZoom); - if( (nDen = aOrigSize.Height() - nULBorders) > 0) - nZoom = (sal_uInt16)((( nHeight * 1000L / nDen )+5)/10); - else - nZoom = 0; - aHeightZoomMF.SetValue(nZoom); -} - -/*-------------------------------------------------------------------- - Beschreibung: Minimal-/Maximalwerte fuer die Raender setzen - --------------------------------------------------------------------*/ - -void SvxGrfCropPage::CalcMinMaxBorder() -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) ) ); - long nR = lcl_GetValue(aRightMF, eUnit ); - long nMinWidth = (aOrigSize.Width() * 10) /11; - long nMin = nMinWidth - (nR >= 0 ? nR : 0); - aLeftMF.SetMax( aLeftMF.Normalize(nMin), eUnit ); - - long nL = lcl_GetValue(aLeftMF, eUnit ); - nMin = nMinWidth - (nL >= 0 ? nL : 0); - aRightMF.SetMax( aRightMF.Normalize(nMin), eUnit ); - - long nUp = lcl_GetValue( aTopMF, eUnit ); - long nMinHeight = (aOrigSize.Height() * 10) /11; - nMin = nMinHeight - (nUp >= 0 ? nUp : 0); - aBottomMF.SetMax( aBottomMF.Normalize(nMin), eUnit ); - - long nLow = lcl_GetValue(aBottomMF, eUnit ); - nMin = nMinHeight - (nLow >= 0 ? nLow : 0); - aTopMF.SetMax( aTopMF.Normalize(nMin), eUnit ); -} -/*-------------------------------------------------------------------- - Beschreibung: Spinsize auf 1/20 der Originalgroesse setzen, - FixedText mit der Originalgroesse fuellen - --------------------------------------------------------------------*/ - -void SvxGrfCropPage::GraphicHasChanged( sal_Bool bFound ) -{ - if( bFound ) - { - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( pPool->GetWhich( - SID_ATTR_GRAF_CROP ) )); - - sal_Int64 nSpin = aLeftMF.Normalize(aOrigSize.Width()) / 20; - nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, - eUnit, aLeftMF.GetUnit()); - - // Ist der Rand zu gross, wird er auf beiden Seiten auf 1/3 eingestellt. - long nR = lcl_GetValue( aRightMF, eUnit ); - long nL = lcl_GetValue( aLeftMF, eUnit ); - if((nL + nR) < - aOrigSize.Width()) - { - long nVal = aOrigSize.Width() / -3; - aRightMF.SetValue( aRightMF.Normalize( nVal ), eUnit ); - aLeftMF.SetValue( aLeftMF.Normalize( nVal ), eUnit ); - aExampleWN.SetLeft(nVal); - aExampleWN.SetRight(nVal); - } - long nUp = lcl_GetValue(aTopMF, eUnit ); - long nLow = lcl_GetValue(aBottomMF, eUnit ); - if((nUp + nLow) < - aOrigSize.Height()) - { - long nVal = aOrigSize.Height() / -3; - aTopMF.SetValue( aTopMF.Normalize( nVal ), eUnit ); - aBottomMF.SetValue( aBottomMF.Normalize( nVal ), eUnit ); - aExampleWN.SetTop(nVal); - aExampleWN.SetBottom(nVal); - } - - aLeftMF.SetSpinSize(nSpin); - aRightMF.SetSpinSize(nSpin); - nSpin = aTopMF.Normalize(aOrigSize.Height()) / 20; - nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, - eUnit, aLeftMF.GetUnit() ); - aTopMF.SetSpinSize(nSpin); - aBottomMF.SetSpinSize(nSpin); - - //Originalgroesse anzeigen - const FieldUnit eMetric = GetModuleFieldUnit( GetItemSet() ); - - MetricField aFld(this, WB_HIDE); - SetFieldUnit( aFld, eMetric ); - aFld.SetDecimalDigits( aWidthMF.GetDecimalDigits() ); - aFld.SetMax( LONG_MAX - 1 ); - - aFld.SetValue( aFld.Normalize( aOrigSize.Width() ), eUnit ); - String sTemp = aFld.GetText(); - aFld.SetValue( aFld.Normalize( aOrigSize.Height() ), eUnit ); - sTemp += UniString::CreateFromAscii(" x "); - sTemp += aFld.GetText(); - aOrigSizeFT.SetText(sTemp); - } - aLeftFT .Enable(bFound); - aLeftMF .Enable(bFound); - aRightFT .Enable(bFound); - aRightMF .Enable(bFound); - aTopFT .Enable(bFound); - aTopMF .Enable(bFound); - aBottomFT .Enable(bFound); - aBottomMF .Enable(bFound); - aSizeConstRB .Enable(bFound); - aZoomConstRB .Enable(bFound); - aWidthFT .Enable(bFound); - aWidthMF .Enable(bFound); - aHeightFT .Enable(bFound); - aHeightMF .Enable(bFound); - aWidthZoomFT .Enable(bFound); - aWidthZoomMF .Enable(bFound); - aHeightZoomFT .Enable(bFound); - aHeightZoomMF .Enable(bFound); - aExampleWN .Enable(bFound); - aOrigSizePB .Enable(bFound); - aOrigSizeFT .Enable(bFound); -} - -IMPL_LINK( SvxGrfCropPage, Timeout, Timer *, EMPTYARG ) -{ - DBG_ASSERT(pLastCropField,"Timeout ohne Feld?"); - CropHdl(pLastCropField); - pLastCropField = 0; - return 0; -} - - -IMPL_LINK( SvxGrfCropPage, CropLoseFocusHdl, MetricField*, pField ) -{ - aTimer.Stop(); - CropHdl(pField); - pLastCropField = 0; - return 0; -} - - -IMPL_LINK( SvxGrfCropPage, CropModifyHdl, MetricField *, pField ) -{ - aTimer.Start(); - pLastCropField = pField; - return 0; -} - -Size SvxGrfCropPage::GetGrfOrigSize( const Graphic& rGrf ) const -{ - const MapMode aMapTwip( MAP_TWIP ); - Size aSize( rGrf.GetPrefSize() ); - if( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() ) - aSize = PixelToLogic( aSize, aMapTwip ); - else - aSize = OutputDevice::LogicToLogic( aSize, - rGrf.GetPrefMapMode(), aMapTwip ); - return aSize; -} - -/*****************************************************************/ - -SvxGrfCropPage::SvxCropExample::SvxCropExample( Window* pPar, - const ResId& rResId ) - : Window( pPar, rResId ), - aFrameSize( OutputDevice::LogicToLogic( - Size( CM_1_TO_TWIP / 2, CM_1_TO_TWIP / 2 ), - MapMode( MAP_TWIP ), GetMapMode() )), - aTopLeft(0,0), aBottomRight(0,0) -{ - SetBorderStyle( WINDOW_BORDER_MONO ); -} - -void SvxGrfCropPage::SvxCropExample::Paint( const Rectangle& ) -{ - Size aWinSize( PixelToLogic(GetOutputSizePixel() )); - SetLineColor(); - SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); - SetRasterOp( ROP_OVERPAINT ); - DrawRect( Rectangle( Point(), aWinSize ) ); - - SetLineColor( Color( COL_WHITE ) ); - Rectangle aRect(Point((aWinSize.Width() - aFrameSize.Width())/2, - (aWinSize.Height() - aFrameSize.Height())/2), - aFrameSize ); - aGrf.Draw( this, aRect.TopLeft(), aRect.GetSize() ); - - Size aSz( 2, 0 ); - aSz = PixelToLogic( aSz ); - SetFillColor( Color( COL_TRANSPARENT ) ); - SetRasterOp( ROP_INVERT ); - aRect.Left() += aTopLeft.Y(); - aRect.Top() += aTopLeft.X(); - aRect.Right() -= aBottomRight.Y(); - aRect.Bottom() -= aBottomRight.X(); - DrawRect( aRect ); -} - -void SvxGrfCropPage::SvxCropExample::SetFrameSize( const Size& rSz ) -{ - aFrameSize = rSz; - if(!aFrameSize.Width()) - aFrameSize.Width() = 1; - if(!aFrameSize.Height()) - aFrameSize.Height() = 1; - Size aWinSize( GetOutputSizePixel() ); - Fraction aXScale( aWinSize.Width() * 4, aFrameSize.Width() * 5 ); - Fraction aYScale( aWinSize.Height() * 4, aFrameSize.Height() * 5 ); - - if( aYScale < aXScale ) - aXScale = aYScale; - - MapMode aMapMode( GetMapMode() ); - - aMapMode.SetScaleX( aXScale ); - aMapMode.SetScaleY( aXScale ); - - SetMapMode( aMapMode ); - Invalidate(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/grfpage.hrc b/cui/source/tabpages/grfpage.hrc deleted file mode 100644 index 72b288d8f..000000000 --- a/cui/source/tabpages/grfpage.hrc +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FT_BOTTOM 1 -#define FT_HEIGHT 2 -#define FT_HEIGHTZOOM 3 -#define FT_LEFT 4 -#define FT_ORIG_SIZE 5 -#define FT_RIGHT 6 -#define FT_TOP 7 -#define FT_WIDTH 8 -#define FT_WIDTHZOOM 9 -#define FL_CROP 10 -#define FL_SIZE 12 -#define FL_ZOOM 13 -#define MF_BOTTOM 14 -#define MF_HEIGHT 15 -#define MF_HEIGHTZOOM 16 -#define MF_LEFT 17 -#define MF_RIGHT 18 -#define MF_TOP 19 -#define MF_WIDTH 20 -#define MF_WIDTHZOOM 21 -#define PB_ORGSIZE 22 -#define RB_SIZECONST 23 -#define RB_ZOOMCONST 24 -#define WN_BSP 25 - - diff --git a/cui/source/tabpages/grfpage.src b/cui/source/tabpages/grfpage.src deleted file mode 100644 index a6733903f..000000000 --- a/cui/source/tabpages/grfpage.src +++ /dev/null @@ -1,343 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "helpid.hrc" -#include "grfpage.hrc" -#include - -/************************************************************/ -/* */ -/* */ -/* Crop-Page */ -/* */ -/* */ -/************************************************************/ -TabPage RID_SVXPAGE_GRFCROP -{ - Hide = TRUE ; - HelpID = HID_SVXPAGE_GRFCROP; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_CROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text [ en-US ] = "Crop" ; - }; - FixedText FT_LEFT - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "~Left" ; - }; - MetricField MF_LEFT - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_LEFT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 42 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_RIGHT - { - Pos = MAP_APPFONT ( 12 , 60 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Right" ; - }; - MetricField MF_RIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_RIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 58 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_TOP - { - Pos = MAP_APPFONT ( 94 , 44 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "~Top" ; - }; - MetricField MF_TOP - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_TOP"; - Border = TRUE ; - Pos = MAP_APPFONT ( 124 , 42 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_BOTTOM - { - Pos = MAP_APPFONT ( 94 , 60 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Bottom" ; - }; - MetricField MF_BOTTOM - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_BOTTOM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 124 , 58 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 9999 ; - SpinSize = 10 ; - }; - RadioButton RB_SIZECONST - { - HelpID = "cui:RadioButton:RID_SVXPAGE_GRFCROP:RB_SIZECONST"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 152 , 10 ) ; - Text [ en-US ] = "Keep image si~ze" ; - }; - RadioButton RB_ZOOMCONST - { - HelpID = "cui:RadioButton:RID_SVXPAGE_GRFCROP:RB_ZOOMCONST"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 152 , 10 ) ; - Check = TRUE ; - Text [ en-US ] = "Keep ~scale" ; - }; - Window WN_BSP - { - Pos = MAP_APPFONT ( 176 , 6 ) ; - Size = MAP_APPFONT ( 78 , 78 ) ; - Border = TRUE ; - }; - FixedLine FL_ZOOM - { - Pos = MAP_APPFONT ( 6, 76 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text [ en-US ] = "Scale" ; - }; - FixedText FT_WIDTHZOOM - { - Left = TRUE ; - Pos = MAP_APPFONT ( 12 , 89 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "~Width" ; - }; - MetricField MF_WIDTHZOOM - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_WIDTHZOOM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 87 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 9999 ; - First = 5 ; - Last = 1000 ; - Maximum = 9999 ; - Value = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 10 ; - }; - FixedText FT_HEIGHTZOOM - { - Pos = MAP_APPFONT ( 12 , 105 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "H~eight" ; - Left = TRUE ; - }; - MetricField MF_HEIGHTZOOM - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_HEIGHTZOOM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 103 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 9999 ; - First = 5 ; - Last = 1000 ; - Maximum = 9999 ; - Value = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 10 ; - }; - FixedLine FL_SIZE - { - Pos = MAP_APPFONT ( 6 , 121 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text [ en-US ] = "Image size" ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( 12 , 134 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Width" ; - }; - MetricField MF_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 132 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 5 ; - Maximum = 20000 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 20000 ; - SpinSize = 10 ; - }; - FixedText FT_HEIGHT - { - Pos = MAP_APPFONT ( 12 , 150 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "H~eight" ; - }; - MetricField MF_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRFCROP:MF_HEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 148 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 5 ; - Maximum = 20000 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 20000 ; - SpinSize = 10 ; - }; - FixedText FT_ORIG_SIZE - { - Pos = MAP_APPFONT ( 176 , 132 ) ; - Size = MAP_APPFONT ( 74 , 8 ) ; - }; - PushButton PB_ORGSIZE - { - HelpID = "cui:PushButton:RID_SVXPAGE_GRFCROP:PB_ORGSIZE"; - Pos = MAP_APPFONT ( 176 , 143 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original Size" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx deleted file mode 100644 index 3f04a3a07..000000000 --- a/cui/source/tabpages/labdlg.cxx +++ /dev/null @@ -1,639 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#define _SVX_LABDLG_CXX - -#include -#include -#include -#include "svx/dlgutil.hxx" -#include "transfrm.hxx" - -#include "labdlg.hrc" -#include "labdlg.hxx" - -// define ---------------------------------------------------------------- - -#define AZ_OPTIMAL 0 -#define AZ_VON_OBEN 1 -#define AZ_VON_LINKS 2 -#define AZ_HORIZONTAL 3 -#define AZ_VERTIKAL 4 - -#define AT_OBEN 0 -#define AT_MITTE 1 -#define AT_UNTEN 2 - -#define WK_OPTIMAL 0 -#define WK_30 1 -#define WK_45 2 -#define WK_60 3 -#define WK_90 4 - -// static ---------------------------------------------------------------- - -static sal_uInt16 pCaptionRanges[] = -{ - SDRATTR_CAPTIONTYPE, - SDRATTR_CAPTIONFIXEDANGLE, - SDRATTR_CAPTIONANGLE, - SDRATTR_CAPTIONGAP, - SDRATTR_CAPTIONESCDIR, - SDRATTR_CAPTIONESCISREL, - SDRATTR_CAPTIONESCREL, - SDRATTR_CAPTIONESCABS, - SDRATTR_CAPTIONLINELEN, - SDRATTR_CAPTIONFITLINELEN, - 0 -}; - -// ----------------------------------------------------------------------- - -SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs) - : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_CAPTION ), rInAttrs ), - - aCT_CAPTTYPE( this, CUI_RES( CT_CAPTTYPE ) ), - aFT_ABSTAND( this, CUI_RES( FT_ABSTAND ) ), - aMF_ABSTAND( this, CUI_RES( MF_ABSTAND ) ), - aFT_WINKEL( this, CUI_RES( FT_WINKEL ) ), - aLB_WINKEL( this, CUI_RES( LB_WINKEL ) ), - aFT_ANSATZ( this, CUI_RES( FT_ANSATZ ) ), - aLB_ANSATZ( this, CUI_RES( LB_ANSATZ ) ), - aFT_UM( this, CUI_RES( FT_UM ) ), - aMF_ANSATZ( this, CUI_RES( MF_ANSATZ ) ), - aFT_ANSATZ_REL( this, CUI_RES( FT_ANSATZ_REL ) ), - aLB_ANSATZ_REL( this, CUI_RES( LB_ANSATZ_REL ) ), - aFT_LAENGE( this, CUI_RES( FT_LAENGE ) ), - aMF_LAENGE( this, CUI_RES( MF_LAENGE ) ), - aCB_LAENGE( this, CUI_RES( CB_LAENGE ) ), - - aStrHorzList( CUI_RES(STR_HORZ_LIST) ), - aStrVertList( CUI_RES(STR_VERT_LIST) ), - - rOutAttrs ( rInAttrs ) -{ - //------------NYI------------------------------------------- - aFT_WINKEL.Hide(); - aLB_WINKEL.Hide(); - - //------------Positionen korrigieren------------------------- - aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() ); - aLB_ANSATZ_REL.SetPosPixel( - Point( - aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6, - aLB_ANSATZ.GetPosPixel().Y() ) - ); - - aMF_ANSATZ.SetPosPixel( - Point( - aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6, - aLB_ANSATZ.GetPosPixel().Y() ) - ); - - sal_uInt16 nBitmap; - for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ ) - mpBmpCapTypes[nBitmap] = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1 + nBitmap)), COL_LIGHTMAGENTA ); - - //------------ValueSet installieren-------------------------- - aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD ); - aCT_CAPTTYPE.SetColCount(5);//XXX - aCT_CAPTTYPE.SetLineCount(1); - aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl)); - - Image aImage; - aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(CUI_RES(STR_CAPTTYPE_1))); - aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(CUI_RES(STR_CAPTTYPE_2))); - aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(CUI_RES(STR_CAPTTYPE_3))); - - FillValueSet(); - - aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl)); - aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl)); - aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl)); - - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxCaptionTabPage::~SvxCaptionTabPage() -{ - sal_uInt16 nBitmap; - for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ ) - delete mpBmpCapTypes[nBitmap]; -} - -// ----------------------------------------------------------------------- - -void SvxCaptionTabPage::Construct() -{ - // Setzen des Rechtecks und der Workingarea - DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxCaptionTabPage::FillItemSet( SfxItemSet& _rOutAttrs) -{ - SfxItemPool* pPool = _rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - - SfxMapUnit eUnit; - - nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1; - - _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) ); - - if( aMF_ABSTAND.IsValueModified() ) - { - eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) ); - _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) ); - } - - // Sonderbehandlung!!! XXX - if( nCaptionType==SDRCAPT_TYPE1 ) - { - switch( nEscDir ) - { - case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break; - case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break; - } - } - - _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) ); - - bEscRel = aLB_ANSATZ_REL.IsVisible(); - _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) ); - - if( bEscRel ) - { - long nVal = 0; - - switch( aLB_ANSATZ_REL.GetSelectEntryPos() ) - { - case AT_OBEN: nVal=0;break; - case AT_MITTE: nVal=5000;break; - case AT_UNTEN: nVal=10000;break; - } - _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) ); - } - else - { - if( aMF_ANSATZ.IsValueModified() ) - { - eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) ); - _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) ); - } - } - - bFitLineLen = aCB_LAENGE.IsChecked(); - _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) ); - - if( ! bFitLineLen ) - { - if( aMF_LAENGE.IsValueModified() ) - { - eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) ); - _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) ); - } - } - -//NYI-------------die Winkel muessen noch hier rein!!! XXX---------------------- - - return( sal_True ); -} - -// ----------------------------------------------------------------------- - -void SvxCaptionTabPage::Reset( const SfxItemSet& ) -{ - - //------------Metrik einstellen----------------------------- - - FieldUnit eFUnit = GetModuleFieldUnit( rOutAttrs ); - - switch ( eFUnit ) - { - case FUNIT_CM: - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ;//prevent warning - } - SetFieldUnit( aMF_ABSTAND, eFUnit ); - SetFieldUnit( aMF_ANSATZ, eFUnit ); - SetFieldUnit( aMF_LAENGE, eFUnit ); - - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - - sal_uInt16 nWhich; - SfxMapUnit eUnit; - - //------- Winkel ---------- - nWhich = GetWhich( SDRATTR_CAPTIONANGLE ); - nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); - - //------- absolute Ansatzentfernung ---------- - nWhich = GetWhich( SDRATTR_CAPTIONESCABS ); - eUnit = pPool->GetMetric( nWhich ); - nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); - SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit ); - nEscAbs = static_cast(aMF_ANSATZ.GetValue()); - - //------- relative Ansatzentfernung ---------- - nWhich = GetWhich( SDRATTR_CAPTIONESCREL ); - nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); - - //------- Linienlaenge ---------- - nWhich = GetWhich( SDRATTR_CAPTIONLINELEN ); - eUnit = pPool->GetMetric( nWhich ); - nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); - SetMetricValue( aMF_LAENGE, nLineLen, eUnit ); - nLineLen = static_cast(aMF_LAENGE.GetValue()); - - //------- Abstand zur Box ---------- - nWhich = GetWhich( SDRATTR_CAPTIONGAP ); - eUnit = pPool->GetMetric( nWhich ); - nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue(); - SetMetricValue( aMF_ABSTAND, nGap, eUnit ); - nGap = static_cast(aMF_ABSTAND.GetValue()); - - nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue(); - bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue(); - bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue(); - nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue(); - bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue(); - - // Sonderbehandlung!!! XXX - if( nCaptionType==SDRCAPT_TYPE1 ) - { - switch( nEscDir ) - { - case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break; - case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break; - } - } - - nAnsatzRelPos=AT_MITTE; - nAnsatzTypePos=AZ_OPTIMAL; - nWinkelTypePos=WK_OPTIMAL; - - aMF_ABSTAND.SetValue( nGap ); - - if( nEscDir == SDRCAPT_ESCHORIZONTAL ) - { - if( bEscRel ) - { - if( nEscRel < 3333 ) - nAnsatzRelPos = AT_OBEN; - if( nEscRel > 6666 ) - nAnsatzRelPos = AT_UNTEN; - nAnsatzTypePos = AZ_HORIZONTAL; - } - else - { - nAnsatzTypePos = AZ_VON_OBEN; - aMF_ANSATZ.SetValue( nEscAbs ); - } - } - else if( nEscDir == SDRCAPT_ESCVERTICAL ) - { - if( bEscRel ) - { - if( nEscRel < 3333 ) - nAnsatzRelPos = AT_OBEN; - if( nEscRel > 6666 ) - nAnsatzRelPos = AT_UNTEN; - nAnsatzTypePos = AZ_VERTIKAL; - } - else - { - nAnsatzTypePos = AZ_VON_LINKS; - aMF_ANSATZ.SetValue( nEscAbs ); - } - } - else if( nEscDir == SDRCAPT_ESCBESTFIT ) - { - nAnsatzTypePos = AZ_OPTIMAL; - } - - if( bFixedAngle ) - { - if( nFixedAngle <= 3000 ) - nWinkelTypePos=WK_30; - else if( nFixedAngle <= 4500 ) - nWinkelTypePos=WK_45; - else if( nFixedAngle <= 6000 ) - nWinkelTypePos=WK_60; - else - nWinkelTypePos=WK_90; - } - - aCB_LAENGE.Check( bFitLineLen ); - aMF_LAENGE.SetValue( nLineLen ); - - aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos ); - aLB_WINKEL.SelectEntryPos( nWinkelTypePos ); - - SetupAnsatz_Impl( nAnsatzTypePos ); - aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0! - SetupType_Impl( nCaptionType+1 ); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow, - const SfxItemSet& rOutAttrs ) -{ - return( new SvxCaptionTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxCaptionTabPage::GetRanges() -{ - return( pCaptionRanges ); -} - -//------------------------------------------------------------------------ - -void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType ) -{ - xub_StrLen nCnt=0, nIdx=0; - - switch( nType ) - { - case AZ_OPTIMAL: -// aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen -// aFT_UM.Hide(); - aMF_ANSATZ.Show(); - aFT_UM.Show(); - aFT_ANSATZ_REL.Hide(); - aLB_ANSATZ_REL.Hide(); - nEscDir = SDRCAPT_ESCBESTFIT; - break; - - case AZ_VON_OBEN: - aMF_ANSATZ.Show(); - aFT_UM.Show(); - aFT_ANSATZ_REL.Hide(); - aLB_ANSATZ_REL.Hide(); - nEscDir = SDRCAPT_ESCHORIZONTAL; - break; - - case AZ_VON_LINKS: - aMF_ANSATZ.Show(); - aFT_UM.Show(); - aFT_ANSATZ_REL.Hide(); - aLB_ANSATZ_REL.Hide(); - nEscDir = SDRCAPT_ESCVERTICAL; - break; - - case AZ_HORIZONTAL: - aLB_ANSATZ_REL.Clear(); - nCnt = aStrHorzList.GetTokenCount(); - for( nIdx=0 ; nIdx(rPage); - rSwPage.EnableAnchorTypes(nAnchorCtrls); - rSwPage.SetValidateFramePosLink( aValidateLink ); - } - break; - - case RID_SVXPAGE_CAPTION: - ( (SvxCaptionTabPage&) rPage ).SetView( pView ); - ( (SvxCaptionTabPage&) rPage ).Construct(); - break; - } -} - -void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink ) -{ - aValidateLink = rLink; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/labdlg.hrc b/cui/source/tabpages/labdlg.hrc deleted file mode 100644 index 7991be093..000000000 --- a/cui/source/tabpages/labdlg.hrc +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -//#define RID_SVXPAGE_CAPTION 1000 -//#define RID_SVXDLG_CAPTION 1001 - -#define TAB_CONTROL 1 -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -#define FT_ABSTAND 1 -#define FT_WINKEL 2 -#define FT_ANSATZ 3 -#define FT_LAENGE 4 -#define FT_UM 5 -#define FT_ANSATZ_REL 6 - -#define CT_CAPTTYPE 1 - -#define MF_ABSTAND 1 -#define MF_ANSATZ 2 -#define MF_LAENGE 3 - -#define CB_LAENGE 1 - -#define CM_LAENGE 1 - -#define LB_WINKEL 1 -#define LB_ANSATZ 2 -#define LB_ANSATZ_REL 3 - -#define STR_CAPTTYPE_1 1 -#define STR_CAPTTYPE_2 2 -#define STR_CAPTTYPE_3 3 -#define STR_CAPTTYPE_4 4 -#define STR_HORZ_LIST 10 -#define STR_VERT_LIST 11 - -#define BMP_CAPTTYPE_1 1 -#define BMP_CAPTTYPE_2 2 -#define BMP_CAPTTYPE_3 3 -#define BMP_CAPTTYPE_4 4 - -#define SHOW_HORZ 1 -#define SHOW_VERT 2 -#define SHOW_ABS 3 -#define SHOW_NONE 4 diff --git a/cui/source/tabpages/labdlg.src b/cui/source/tabpages/labdlg.src deleted file mode 100644 index 802bcec08..000000000 --- a/cui/source/tabpages/labdlg.src +++ /dev/null @@ -1,287 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include "labdlg.hrc" -#include - - // RID_SVXPAGE_CAPTION --------------------------------------------------- -TabPage RID_SVXPAGE_CAPTION -{ - HelpId = HID_CAPTION ; - Hide = TRUE ; - //Size = MAP_APPFONT ( 189 , 97 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Callouts" ; - Control CT_CAPTTYPE - { - HelpId = HID_CAPTION_CTL_TYPE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 187 , 38 ) ; - TabStop = TRUE ; - }; - FixedText FT_ABSTAND - { - Pos = MAP_APPFONT ( 6 , 53 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Spacing" ; - }; - MetricField MF_ABSTAND - { - HelpID = "cui:MetricField:RID_SVXPAGE_CAPTION:MF_ABSTAND"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 51 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 50 ; - }; - FixedText FT_WINKEL - { - Pos = MAP_APPFONT ( 106 , 53 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Angle" ; - }; - ListBox LB_WINKEL - { - HelpID = "cui:ListBox:RID_SVXPAGE_CAPTION:LB_WINKEL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 143 , 51 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Free" ; 1 ; > ; - < "30 Degrees" ; 3000 ; > ; - < "45 Degrees" ; 4500 ; > ; - < "60 Degrees" ; 6000 ; > ; - < "90 Degrees" ; 9000 ; > ; - }; - }; - FixedText FT_ANSATZ - { - Pos = MAP_APPFONT ( 6 , 69 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Extension" ; - }; - ListBox LB_ANSATZ - { - HelpID = "cui:ListBox:RID_SVXPAGE_CAPTION:LB_ANSATZ"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 67 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Optimal" ; 4 ; > ; - < "From top" ; 3 ; > ; - < "From left" ; 3 ; > ; - < "Horizontal" ; 1 ; > ; - < "Vertical" ; 2 ; > ; - }; - }; - FixedText FT_UM - { - Pos = MAP_APPFONT ( 106 , 69 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~By" ; - }; - MetricField MF_ANSATZ - { - HelpID = "cui:MetricField:RID_SVXPAGE_CAPTION:MF_ANSATZ"; - Border = TRUE ; - Pos = MAP_APPFONT ( 143 , 67 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 50 ; - }; - FixedText FT_ANSATZ_REL - { - Pos = MAP_APPFONT ( 106 , 69 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Position" ; - }; - ListBox LB_ANSATZ_REL - { - HelpID = "cui:ListBox:RID_SVXPAGE_CAPTION:LB_ANSATZ_REL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 143 , 67 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_LAENGE - { - Pos = MAP_APPFONT ( 6 , 85 ) ; - Size = MAP_APPFONT ( 42 , 8 ) ; - Text [ en-US ] = "~Length" ; - }; - MetricField MF_LAENGE - { - HelpID = "cui:MetricField:RID_SVXPAGE_CAPTION:MF_LAENGE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 83 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 50 ; - }; - CheckBox CB_LAENGE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_CAPTION:CB_LAENGE"; - Pos = MAP_APPFONT ( 106 , 84 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Optimal" ; - }; - String STR_CAPTTYPE_1 - { - Text [ en-US ] = "Straight Line" ; - }; - String STR_CAPTTYPE_2 - { - Text [ en-US ] = "Angled Line" ; - }; - String STR_CAPTTYPE_3 - { - Text [ en-US ] = "Angled Connector Line" ; - }; - String STR_CAPTTYPE_4 - { - Text [ en-US ] = "Double-angled line" ; - }; - String STR_HORZ_LIST - { - Text [ en-US ] = "Top;Middle;Bottom" ; - }; - String STR_VERT_LIST - { - Text [ en-US ] = "Left;Middle;Right" ; - }; - Bitmap BMP_CAPTTYPE_1 - { - File = "legtyp1.bmp" ; - }; - Bitmap BMP_CAPTTYPE_2 - { - File = "legtyp2.bmp" ; - }; - Bitmap BMP_CAPTTYPE_3 - { - File = "legtyp3.bmp" ; - }; - Bitmap BMP_CAPTTYPE_4 - { - File = "legtyp4.bmp" ; - }; -}; - // RID_SVXDLG_CAPTION ---------------------------------------------------- - -#define _POS_SIZE_TEXT \ - Text [ en-US ] = "Position and Size" ; \ - -TabDialog RID_SVXDLG_CAPTION\ -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 237 , 161 ) ; - Text [ en-US ] = "Callouts" ;\ - Moveable = TRUE ; - TabControl TAB_CONTROL\ - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 189 , 97 ) ; - PageList = - { - PageItem\ - { - Identifier = RID_SVXPAGE_POSITION_SIZE ; - PageResID = RID_SVXPAGE_POSITION_SIZE ; - _POS_SIZE_TEXT - }; - PageItem - { - Identifier = RID_SVXPAGE_SWPOSSIZE; - PageResID = RID_SVXPAGE_SWPOSSIZE; - _POS_SIZE_TEXT - }; - PageItem - { - Identifier = RID_SVXPAGE_CAPTION ; - PageResID = RID_SVXPAGE_CAPTION ; - Text [ en-US ] = "Callout" ; - }; - }; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx deleted file mode 100644 index fb33590d8..000000000 --- a/cui/source/tabpages/macroass.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define ITEMID_MACRO 0 -#include -#undef ITEMID_MACRO - -#include "macroass.hxx" - -#include -#include -#include -#define _SVSTDARR_STRINGSDTOR -#include - -#include -#include "cfgutil.hxx" -#include -#include -#include -#include "macroass.hrc" -#include "cuires.hrc" -#include -#include "headertablistbox.hxx" - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::frame::XFrame; - -class _SfxMacroTabPage_Impl -{ -public: - _SfxMacroTabPage_Impl( void ); - ~_SfxMacroTabPage_Impl(); - - String maStaticMacroLBLabel; - PushButton* pAssignPB; - PushButton* pDeletePB; - String* pStrEvent; - String* pAssignedMacro; - _HeaderTabListBox* pEventLB; - SfxConfigGroupListBox_Impl* pGroupLB; - FixedText* pFT_MacroLBLabel; - SfxConfigFunctionListBox_Impl* pMacroLB; - - FixedText* pMacroFT; - String* pMacroStr; - - sal_Bool bReadOnly; - Timer maFillGroupTimer; - sal_Bool bGotEvents; -}; - -_SfxMacroTabPage_Impl::_SfxMacroTabPage_Impl( void ) : - pAssignPB( NULL ), - pDeletePB( NULL ), - pStrEvent( NULL ), - pAssignedMacro( NULL ), - pEventLB( NULL ), - pGroupLB( NULL ), - pFT_MacroLBLabel( NULL ), - pMacroLB( NULL ), - pMacroFT( NULL ), - pMacroStr( NULL ), - bReadOnly( sal_False ), - bGotEvents( sal_False ) -{ -} - -_SfxMacroTabPage_Impl::~_SfxMacroTabPage_Impl() -{ - delete pAssignPB; - delete pDeletePB; - delete pStrEvent; - delete pAssignedMacro; - delete pEventLB; - delete pGroupLB; - delete pMacroLB; - delete pFT_MacroLBLabel; - delete pMacroFT; - delete pMacroStr; -} - - -static sal_uInt16 aPageRg[] = { - SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, - 0 -}; - -// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert -static long nTabs[] = - { - 2, // Number of Tabs - 0, 90 - }; - -#define TAB_WIDTH_MIN 10 - -// IDs for items in HeaderBar of EventLB -#define ITEMID_EVENT 1 -#define ITMEID_ASSMACRO 2 - - -#define LB_EVENTS_ITEMPOS 1 -#define LB_MACROS_ITEMPOS 2 - -String ConvertToUIName_Impl( SvxMacro *pMacro ) -{ - String aName( pMacro->GetMacName() ); - String aEntry; - if ( ! pMacro->GetLanguage().EqualsAscii("JavaScript") ) - { - sal_uInt16 nCount = aName.GetTokenCount('.'); - aEntry = aName.GetToken( nCount-1, '.' ); - if ( nCount > 2 ) - { - aEntry += '('; - aEntry += aName.GetToken( 0, '.' ); - aEntry += '.'; - aEntry += aName.GetToken( nCount-2, '.' ); - aEntry += ')'; - } - return aEntry; - } - else - return aName; -} - -void _SfxMacroTabPage::EnableButtons() -{ - // Solange die Eventbox leer ist, nichts tun - const SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().FirstSelected(); - if ( pE ) - { - // Gebundenes Macro holen - const SvxMacro* pM = aTbl.Get( (sal_uInt16)(sal_uLong) pE->GetUserData() ); - mpImpl->pDeletePB->Enable( 0 != pM && !mpImpl->bReadOnly ); - - String sEventMacro; - sEventMacro = ((SvLBoxString*)pE->GetItem( LB_MACROS_ITEMPOS ))->GetText(); - - String sScriptURI = mpImpl->pMacroLB->GetSelectedScriptURI(); - mpImpl->pAssignPB->Enable( !mpImpl->bReadOnly && !sScriptURI.EqualsIgnoreCaseAscii( sEventMacro ) ); - } - else - mpImpl->pAssignPB->Enable( sal_False ); -} - -_SfxMacroTabPage::_SfxMacroTabPage( Window* pParent, const ResId& rResId, const SfxItemSet& rAttrSet ) - : SfxTabPage( pParent, rResId, rAttrSet ) - -{ - mpImpl = new _SfxMacroTabPage_Impl; -} - -_SfxMacroTabPage::~_SfxMacroTabPage() -{ - DELETEZ( mpImpl ); -} - -void _SfxMacroTabPage::AddEvent( const String & rEventName, sal_uInt16 nEventId ) -{ - String sTmp( rEventName ); - sTmp += '\t'; - - // falls die Tabelle schon gueltig ist - SvxMacro* pM = aTbl.Get( nEventId ); - if( pM ) - { - String sNew( ConvertToUIName_Impl( pM ) ); - sTmp += sNew; - } - - SvLBoxEntry* pE = mpImpl->pEventLB->GetListBox().InsertEntry( sTmp ); - pE->SetUserData( reinterpret_cast< void* >( sal::static_int_cast< sal_IntPtr >( nEventId )) ); -} - -void _SfxMacroTabPage::ScriptChanged() -{ - // neue Bereiche und deren Funktionen besorgen - { - mpImpl->pGroupLB->Show(); - mpImpl->pMacroLB->Show(); - mpImpl->pMacroFT->SetText( *mpImpl->pMacroStr ); - } - - EnableButtons(); -} - -sal_Bool _SfxMacroTabPage::FillItemSet( SfxItemSet& rSet ) -{ - SvxMacroItem aItem( GetWhich( aPageRg[0] ) ); - ((SvxMacroTableDtor&)aItem.GetMacroTable()) = aTbl; - - const SfxPoolItem* pItem; - if( SFX_ITEM_SET != GetItemSet().GetItemState( aItem.Which(), sal_True, &pItem ) - || aItem != *(SvxMacroItem*)pItem ) - { - rSet.Put( aItem ); - return sal_True; - } - return sal_False; -} - -void _SfxMacroTabPage::PageCreated (SfxAllItemSet aSet) -{ - const SfxPoolItem* pEventsItem; - if( !mpImpl->bGotEvents && SFX_ITEM_SET == aSet.GetItemState( SID_EVENTCONFIG, sal_True, &pEventsItem ) ) - { - mpImpl->bGotEvents = sal_True; - const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); - for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo ) - { - const SfxEventName *pOwn = rList.at(nNo); - AddEvent( pOwn->maUIName, pOwn->mnId ); - } - } -} - -void _SfxMacroTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( aPageRg[0] ), sal_True, &pItem )) - aTbl = ((SvxMacroItem*)pItem)->GetMacroTable(); - - const SfxPoolItem* pEventsItem; - if( !mpImpl->bGotEvents && SFX_ITEM_SET == rSet.GetItemState( SID_EVENTCONFIG, sal_True, &pEventsItem ) ) - { - mpImpl->bGotEvents = sal_True; - const SfxEventNamesList& rList = ((SfxEventNamesItem*)pEventsItem)->GetEvents(); - for ( size_t nNo = 0, nCnt = rList.size(); nNo < nCnt; ++nNo ) - { - const SfxEventName *pOwn = rList.at(nNo); - AddEvent( pOwn->maUIName, pOwn->mnId ); - } - } - - FillEvents(); - - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.GetEntry( 0 ); - if( pE ) - rListBox.SetCurEntry( pE ); -} - -sal_Bool _SfxMacroTabPage::IsReadOnly() const -{ - return mpImpl->bReadOnly; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, SelectEvent_Impl, SvTabListBox*, EMPTYARG ) -{ - _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; - SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.FirstSelected(); - sal_uLong nPos; - if( !pE || LISTBOX_ENTRY_NOTFOUND == - ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - return 0; - } - - pThis->ScriptChanged(); - pThis->EnableButtons(); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, SelectGroup_Impl, ListBox*, EMPTYARG ) -{ - _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; - String sSel( pImpl->pGroupLB->GetGroup() ); - pImpl->pGroupLB->GroupSelected(); - const String sScriptURI = pImpl->pMacroLB->GetSelectedScriptURI(); - String aLabelText; - if( sScriptURI.Len() > 0 ) - aLabelText = pImpl->maStaticMacroLBLabel; - pImpl->pFT_MacroLBLabel->SetText( aLabelText ); - - pThis->EnableButtons(); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, SelectMacro_Impl, ListBox*, EMPTYARG ) -{ - _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; - pImpl->pMacroLB->FunctionSelected(); - pThis->EnableButtons(); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn ) -{ - _SfxMacroTabPage_Impl* pImpl = pThis->mpImpl; - SvHeaderTabListBox& rListBox = pImpl->pEventLB->GetListBox(); - SvLBoxEntry* pE = rListBox.FirstSelected(); - sal_uLong nPos; - if( !pE || LISTBOX_ENTRY_NOTFOUND == - ( nPos = rListBox.GetModel()->GetAbsPos( pE ) ) ) - { - DBG_ASSERT( pE, "wo kommt der leere Eintrag her?" ); - return 0; - } - - const sal_Bool bAssEnabled = pBtn != pImpl->pDeletePB && pImpl->pAssignPB->IsEnabled(); - - // aus der Tabelle entfernen - sal_uInt16 nEvent = (sal_uInt16)(sal_uLong)pE->GetUserData(); - SvxMacro *pRemoveMacro = pThis->aTbl.Remove( nEvent ); - delete pRemoveMacro; - - String sScriptURI; - if( bAssEnabled ) - { - sScriptURI = pImpl->pMacroLB->GetSelectedScriptURI(); - if( sScriptURI.CompareToAscii( "vnd.sun.star.script:", 20 ) == COMPARE_EQUAL ) - { - pThis->aTbl.Insert( - nEvent, new SvxMacro( sScriptURI, String::CreateFromAscii( SVX_MACRO_LANGUAGE_SF ) ) ); - } - else - { - OSL_ENSURE( false, "_SfxMacroTabPage::AssignDeleteHdl_Impl: this branch is *not* dead? (out of interest: tell fs, please!)" ); - pThis->aTbl.Insert( - nEvent, new SvxMacro( sScriptURI, String::CreateFromAscii( SVX_MACRO_LANGUAGE_STARBASIC ) ) ); - } - } - - pImpl->pEventLB->SetUpdateMode( sal_False ); - pE->ReplaceItem( new SvLBoxString( pE, 0, sScriptURI ), LB_MACROS_ITEMPOS ); - rListBox.GetModel()->InvalidateEntry( pE ); - rListBox.Select( pE ); - rListBox.MakeVisible( pE ); - rListBox.SetUpdateMode( sal_True ); - - pThis->EnableButtons(); - return 0; -} - -IMPL_STATIC_LINK( _SfxMacroTabPage, TimeOut_Impl, Timer*, EMPTYARG ) -{ - // FillMacroList() can take a long time -> show wait cursor and disable input - SfxTabDialog* pTabDlg = pThis->GetTabDialog(); - // perhaps the tabpage is part of a SingleTabDialog then pTabDlg == NULL - if ( pTabDlg ) - { - pTabDlg->EnterWait(); - pTabDlg->EnableInput( sal_False ); - } - pThis->FillMacroList(); - if ( pTabDlg ) - { - pTabDlg->EnableInput( sal_True ); - pTabDlg->LeaveWait(); - } - return 0; -} - -void _SfxMacroTabPage::InitAndSetHandler() -{ - // Handler installieren - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - HeaderBar& rHeaderBar = mpImpl->pEventLB->GetHeaderBar(); - Link aLnk(STATIC_LINK(this, _SfxMacroTabPage, AssignDeleteHdl_Impl )); - mpImpl->pMacroLB->SetDoubleClickHdl( aLnk ); - mpImpl->pDeletePB->SetClickHdl( aLnk ); - mpImpl->pAssignPB->SetClickHdl( aLnk ); - rListBox.SetDoubleClickHdl( aLnk ); - - rListBox.SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectEvent_Impl )); - mpImpl->pGroupLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectGroup_Impl )); - mpImpl->pMacroLB->SetSelectHdl( STATIC_LINK( this, _SfxMacroTabPage, SelectMacro_Impl )); - - rListBox.SetSelectionMode( SINGLE_SELECTION ); - rListBox.SetTabs( &nTabs[0], MAP_APPFONT ); - Size aSize( nTabs[ 2 ], 0 ); - rHeaderBar.InsertItem( ITEMID_EVENT, *mpImpl->pStrEvent, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); - aSize.Width() = 1764; // don't know what, so 42^2 is best to use... - rHeaderBar.InsertItem( ITMEID_ASSMACRO, *mpImpl->pAssignedMacro, LogicToPixel( aSize, MapMode( MAP_APPFONT ) ).Width() ); - rListBox.SetSpaceBetweenEntries( 0 ); - - mpImpl->pEventLB->Show(); - mpImpl->pEventLB->ConnectElements(); - - mpImpl->pEventLB->Enable( sal_True ); - mpImpl->pGroupLB->Enable( sal_True ); - mpImpl->pMacroLB->Enable( sal_True ); - - mpImpl->pGroupLB->SetFunctionListBox( mpImpl->pMacroLB ); - - mpImpl->maFillGroupTimer.SetTimeoutHdl( STATIC_LINK( this, _SfxMacroTabPage, TimeOut_Impl ) ); - mpImpl->maFillGroupTimer.SetTimeout( 0 ); - mpImpl->maFillGroupTimer.Start(); -} - -void _SfxMacroTabPage::FillMacroList() -{ - mpImpl->pGroupLB->Init( - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >(), - GetFrame(), - ::rtl::OUString() ); -} - -void _SfxMacroTabPage::FillEvents() -{ - SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox(); - - sal_uLong nEntryCnt = rListBox.GetEntryCount(); - - // Events aus der Tabelle holen und die EventListBox entsprechen fuellen - for( sal_uLong n = 0 ; n < nEntryCnt ; ++n ) - { - SvLBoxEntry* pE = rListBox.GetEntry( n ); - if( pE ) - { - SvLBoxString* pLItem = ( SvLBoxString* ) pE->GetItem( LB_MACROS_ITEMPOS ); - DBG_ASSERT( pLItem && SV_ITEM_ID_LBOXSTRING == pLItem->IsA(), "_SfxMacroTabPage::FillEvents(): no LBoxString" ); - - String sOld( pLItem->GetText() ); - String sNew; - sal_uInt16 nEventId = ( sal_uInt16 ) ( sal_uLong ) pE->GetUserData(); - if( aTbl.IsKeyValid( nEventId ) ) - sNew = ConvertToUIName_Impl( aTbl.Get( nEventId ) ); - - if( sOld != sNew ) - { - pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS ); - rListBox.GetModel()->InvalidateEntry( pE ); - } - } - } -} - -SfxMacroTabPage::SfxMacroTabPage( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) - : _SfxMacroTabPage( pParent, rResId, rSet ) -{ - mpImpl->pStrEvent = new String( CUI_RES( STR_EVENT ) ); - mpImpl->pAssignedMacro = new String( CUI_RES( STR_ASSMACRO ) ); - mpImpl->pEventLB = new _HeaderTabListBox( this, CUI_RES( LB_EVENT ) ); - mpImpl->pAssignPB = new PushButton( this, CUI_RES( PB_ASSIGN ) ); - mpImpl->pDeletePB = new PushButton( this, CUI_RES( PB_DELETE ) ); - mpImpl->pMacroFT = new FixedText( this, CUI_RES( FT_MACRO ) ); - mpImpl->pGroupLB = new SfxConfigGroupListBox_Impl( this, CUI_RES( LB_GROUP ) ); - mpImpl->pFT_MacroLBLabel = new FixedText( this, CUI_RES( FT_LABEL4LB_MACROS ) ); - mpImpl->maStaticMacroLBLabel= mpImpl->pFT_MacroLBLabel->GetText(); - mpImpl->pMacroLB = new SfxConfigFunctionListBox_Impl( this, CUI_RES( LB_MACROS ) ); - mpImpl->pMacroStr = new String( CUI_RES( STR_MACROS ) ); - - FreeResource(); - - SetFrame( rxDocumentFrame ); - - InitAndSetHandler(); - - ScriptChanged(); -} - -SfxTabPage* SfxMacroTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SfxMacroTabPage( pParent, CUI_RES( RID_SVXPAGE_EVENTASSIGN ), NULL, rAttrSet ); -} - -SfxMacroAssignDlg::SfxMacroAssignDlg( Window* pParent, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) - : SfxSingleTabDialog( pParent, rSet, 0 ) -{ - SfxTabPage* pPage = SfxMacroTabPage::Create( this, rSet ); - pPage->SetFrame( rxDocumentFrame ); - SetTabPage( pPage ); -} - -SfxMacroAssignDlg::~SfxMacroAssignDlg() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/macroass.hrc b/cui/source/tabpages/macroass.hrc deleted file mode 100644 index 997bb6cf9..000000000 --- a/cui/source/tabpages/macroass.hrc +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MACROASS_HRC -#define _MACROASS_HRC - -#ifndef _SVT_CONTROLDIMS_HRC_ -#include -#endif - -#define LB_EVENT 2 -#define PB_ASSIGN 3 -#define PB_DELETE 4 -#define FT_MACRO 5 -#define LB_GROUP 6 -#define LB_MACROS 7 - // FREE -#define FT_LABEL4LB_MACROS 9 -#define STR_JAVASCRIPT 10 -#define STR_MACROS 11 -#define ED_JAVASCRIPT 12 -#define STR_EVENT 13 -#define STR_ASSMACRO 14 - - -// COL0<---------------WIDTH_1_2--------------->COL3<->COL4<----WIDTH4---->COL5 -// <--WIDTH1-->COL1<-SPACE1->COL2<--WIDTH2-> - -#define WIDTH_TP 260 // of whole tabpage -#define COL5 (WIDTH_TP-RSC_SP_DLG_INNERBORDER_RIGHT) -#define COL4 (COL5-RSC_CD_PUSHBUTTON_WIDTH) -#define COL3 (COL4-RSC_SP_CTRL_X) -#define COL0 (RSC_SP_TBPG_INNERBORDER_LEFT) -#define WIDTH1_2 (COL3-COL0) // width of upper listbox -#define SPACE1 4 // space between lower listboxes -#define WIDTH1 ((WIDTH1_2-SPACE1)/2) // width of lower left listbox -#define WIDTH2 (WIDTH1_2-WIDTH1-SPACE1) // width of lower right listbox -#define COL1 (COL0+WIDTH1) -#define COL2 (COL1+SPACE1) - -#define HEIGHT_TP 185 // of whole tabpage -#define HEIGHT0 62 // of upper listbox -#define ROW0 6 // more than RSC_SP_FLGR_INNERBORDER_TOP cause of bad design -#define ROW1 (ROW0+RSC_CD_PUSHBUTTON_HEIGHT) // Assign button -#define ROW2 (ROW1+RSC_SP_CTRL_GROUP_Y) -#define ROW3 (ROW2+RSC_CD_PUSHBUTTON_HEIGHT) // Remove button -#define ROW4 (ROW3+RSC_SP_CTRL_GROUP_Y) -#define ROW5 (ROW4+RSC_CD_DROPDOWN_HEIGHT) // script type listbox (hidden) -#define ROW6 (ROW0+HEIGHT0) -#define ROW7 (ROW6+RSC_SP_CTRL_Y) -#define HEIGHT_EXTRA7 (RSC_CD_FIXEDTEXT_HEIGHT) // additional height for FT_LABEL4LB_MACROS -#define ROW7A (ROW7+HEIGHT_EXTRA7) -#define ROW8 (ROW7+RSC_CD_FIXEDTEXT_HEIGHT+HEIGHT_EXTRA7)// label for lower listboxes (2 lines!) -#define ROW9 (HEIGHT_TP-RSC_SP_TBPG_INNERBORDER_BOTTOM) -#define HEIGHT8 (ROW9-ROW8) // of lower listboxes - -#endif - diff --git a/cui/source/tabpages/macroass.src b/cui/source/tabpages/macroass.src deleted file mode 100644 index 0db9825a5..000000000 --- a/cui/source/tabpages/macroass.src +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "macroass.hrc" -#include "cuires.hrc" -#include "helpid.hrc" -#include - -TabPage RID_SVXPAGE_EVENTASSIGN -{ - HelpID = "cui:TabPage:RID_SVXPAGE_EVENTASSIGN"; - Hide = TRUE ; - SVLook = TRUE ; - DialogControl = TRUE ; - Size = MAP_APPFONT ( WIDTH_TP , HEIGHT_TP ) ; - Text [ en-US ] = "Assign Macro" ; - String STR_EVENT - { - Text [ en-US ] = "Event" ; - }; - String STR_ASSMACRO - { - Text [ en-US ] = "Assigned macro"; - }; - Control LB_EVENT - { - Border = TRUE ; - Pos = MAP_APPFONT ( COL0 , ROW0 ) ; - Size = MAP_APPFONT ( WIDTH1_2 , HEIGHT0 ) ; - TabStop = TRUE ; - DialogControl = TRUE ; - ClipChildren = TRUE ; - Disable = TRUE ; - Group = TRUE ; - HelpID = HID_MACRO_LB_EVENT ; - }; - FixedText FT_MACRO - { - Pos = MAP_APPFONT ( COL0 , ROW7A ) ; - Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT ) ; - Group = TRUE ; - }; - Control LB_GROUP - { - Border = TRUE ; - Pos = MAP_APPFONT ( COL0 , ROW8 ) ; - Size = MAP_APPFONT ( WIDTH1 , HEIGHT8 ) ; - TabStop = TRUE ; - Group = TRUE ; - HelpId = HID_MACRO_GROUP ; - }; - FixedText FT_LABEL4LB_MACROS - { - Pos = MAP_APPFONT ( COL2 , ROW7 ) ; - Size = MAP_APPFONT ( WIDTH1 , RSC_CD_FIXEDTEXT_HEIGHT + HEIGHT_EXTRA7 ) ; - WordBreak = TRUE; - Text [ en-US ] = "~Existing macros\n" ; - }; - Control LB_MACROS - { - Border = TRUE ; - Pos = MAP_APPFONT ( COL2 , ROW8 ) ; - Size = MAP_APPFONT ( WIDTH2 , HEIGHT8 ) ; - TabStop = TRUE ; - HelpId = HID_MACRO_MACROS ; - }; - PushButton PB_ASSIGN - { - HelpID = "cui:PushButton:RID_SVXPAGE_EVENTASSIGN:PB_ASSIGN"; - Pos = MAP_APPFONT ( COL4 , ROW0 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Disable = TRUE ; - TabStop = TRUE ; - Text [ en-US ] = "~Assign" ; - }; - PushButton PB_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_EVENTASSIGN:PB_DELETE"; - Pos = MAP_APPFONT ( COL4 , ROW2 ) ; - Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ; - Disable = TRUE ; - TabStop = TRUE ; - Text [ en-US ] = "~Remove" ; - }; - String STR_MACROS - { - Text [ en-US ] = "Macros" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx deleted file mode 100644 index 55632dfda..000000000 --- a/cui/source/tabpages/measure.cxx +++ /dev/null @@ -1,874 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include - -#include - -#define _SVX_MEASURE_CXX - -#include -#include -#include -#include -#include -#include -#include "svx/measctrl.hxx" -#include "measure.hxx" -#include "measure.hrc" -#include -#include "svx/dlgutil.hxx" -#include -#include -#include "svx/ofaitem.hxx" - -static sal_uInt16 pRanges[] = -{ - SDRATTR_MEASURE_FIRST, - SDRATTR_MEASURE_LAST, - 0 -}; - -/************************************************************************* -|* -|* Dialog to change measure-attributes -|* -\************************************************************************/ - -SvxMeasureDialog::SvxMeasureDialog( Window* pParent, const SfxItemSet& rInAttrs, - const SdrView* pSdrView ) : - SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_MEASURE ) -{ - SvxMeasurePage* _pPage = new SvxMeasurePage( this, rInAttrs ); - - _pPage->SetView( pSdrView ); - _pPage->Construct(); - - SetTabPage( _pPage ); - SetText( _pPage->GetText() ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxMeasureDialog::~SvxMeasureDialog() -{ -} - -/************************************************************************* -|* -|* Tabpage for changing measure-attributes -|* -\************************************************************************/ - -SvxMeasurePage::SvxMeasurePage( Window* pWindow, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pWindow, CUI_RES( RID_SVXPAGE_MEASURE ), - rInAttrs ), - - aFlLine ( this, CUI_RES( FL_LINE ) ), - aFtLineDist ( this, CUI_RES( FT_LINE_DIST ) ), - aMtrFldLineDist ( this, CUI_RES( MTR_LINE_DIST ) ), - aFtHelplineOverhang ( this, CUI_RES( FT_HELPLINE_OVERHANG ) ), - aMtrFldHelplineOverhang ( this, CUI_RES( MTR_FLD_HELPLINE_OVERHANG ) ), - aFtHelplineDist ( this, CUI_RES( FT_HELPLINE_DIST ) ), - aMtrFldHelplineDist ( this, CUI_RES( MTR_FLD_HELPLINE_DIST ) ), - aFtHelpline1Len ( this, CUI_RES( FT_HELPLINE1_LEN ) ), - aMtrFldHelpline1Len ( this, CUI_RES( MTR_FLD_HELPLINE1_LEN ) ), - aFtHelpline2Len ( this, CUI_RES( FT_HELPLINE2_LEN ) ), - aMtrFldHelpline2Len ( this, CUI_RES( MTR_FLD_HELPLINE2_LEN ) ), - aTsbBelowRefEdge ( this, CUI_RES( TSB_BELOW_REF_EDGE ) ), - aFtDecimalPlaces ( this, CUI_RES( FT_DECIMALPLACES ) ), - aMtrFldDecimalPlaces ( this, CUI_RES( MTR_FLD_DECIMALPLACES ) ), - - aFlLabel ( this, CUI_RES( FL_LABEL ) ), - aFtPosition ( this, CUI_RES( FT_POSITION ) ), - aCtlPosition ( this, CUI_RES( CTL_POSITION ) ), - aTsbAutoPosV ( this, CUI_RES( TSB_AUTOPOSV ) ), - aTsbAutoPosH ( this, CUI_RES( TSB_AUTOPOSH ) ), - aTsbShowUnit ( this, CUI_RES( TSB_SHOW_UNIT ) ), - aLbUnit ( this, CUI_RES( LB_UNIT ) ), - aTsbParallel ( this, CUI_RES( TSB_PARALLEL ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ), rInAttrs ), - - aFlVert ( this, CUI_RES( FL_VERT ) ), - rOutAttrs ( rInAttrs ), - aAttrSet ( *rInAttrs.GetPool() ), - pView( 0 ), - - bPositionModified ( sal_False ) -{ - aCtlPreview.SetAccessibleName(aCtlPreview.GetHelpText()); - FillUnitLB(); - - FreeResource(); - - const FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( aMtrFldLineDist, eFUnit ); - SetFieldUnit( aMtrFldHelplineOverhang, eFUnit ); - SetFieldUnit( aMtrFldHelplineDist, eFUnit ); - SetFieldUnit( aMtrFldHelpline1Len, eFUnit ); - SetFieldUnit( aMtrFldHelpline2Len, eFUnit ); - if( eFUnit == FUNIT_MM ) - { - aMtrFldLineDist.SetSpinSize( 50 ); - aMtrFldHelplineOverhang.SetSpinSize( 50 ); - aMtrFldHelplineDist.SetSpinSize( 50 ); - aMtrFldHelpline1Len.SetSpinSize( 50 ); - aMtrFldHelpline2Len.SetSpinSize( 50 ); - } - - aTsbAutoPosV.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) ); - aTsbAutoPosH.SetClickHdl( LINK( this, SvxMeasurePage, ClickAutoPosHdl_Impl ) ); - - // set background and border of iconchoicectrl - const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - aCtlPreview.SetBackground ( rStyles.GetWindowColor() ); - aCtlPreview.SetBorderStyle(WINDOW_BORDER_MONO); - - Link aLink( LINK( this, SvxMeasurePage, ChangeAttrHdl_Impl ) ); - aMtrFldLineDist.SetModifyHdl( aLink ); - aMtrFldHelplineOverhang.SetModifyHdl( aLink ); - aMtrFldHelplineDist.SetModifyHdl( aLink ); - aMtrFldHelpline1Len.SetModifyHdl( aLink ); - aMtrFldHelpline2Len.SetModifyHdl( aLink ); - aMtrFldDecimalPlaces.SetModifyHdl( aLink ); - aTsbBelowRefEdge.SetClickHdl( aLink ); - aTsbParallel.SetClickHdl( aLink ); - aTsbShowUnit.SetClickHdl( aLink ); - aLbUnit.SetSelectHdl( aLink ); - aLbUnit.SetAccessibleName(GetNonMnemonicString(aTsbShowUnit.GetText())); - aCtlPosition.SetAccessibleRelationMemberOf( &aFlLabel ); - aLbUnit.SetAccessibleRelationLabeledBy( &aTsbShowUnit ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxMeasurePage::~SvxMeasurePage() -{ -} - -/************************************************************************* -|* -|* read the delivered Item-Set -|* -\************************************************************************/ - -void SvxMeasurePage::Reset( const SfxItemSet& rAttrs ) -{ - SfxItemPool* pPool = rAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - eUnit = pPool->GetMetric( SDRATTR_MEASURELINEDIST ); - - const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_MEASURELINEDIST ); - - // SdrMeasureLineDistItem - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASURELINEDIST ); - if( pItem ) - { - long nValue = ( ( const SdrMeasureLineDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldLineDist, nValue, eUnit ); - } - else - { - aMtrFldLineDist.SetText( String() ); - } - aMtrFldLineDist.SaveValue(); - - // SdrMeasureHelplineOverhangItem - pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEOVERHANG ); - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEOVERHANG ); - if( pItem ) - { - long nValue = ( ( const SdrMeasureHelplineOverhangItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHelplineOverhang, nValue, eUnit ); - } - else - { - aMtrFldHelplineOverhang.SetText( String() ); - } - aMtrFldHelplineOverhang.SaveValue(); - - // SdrMeasureHelplineDistItem - pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINEDIST ); - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINEDIST ); - if( pItem ) - { - long nValue = ( ( const SdrMeasureHelplineDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHelplineDist, nValue, eUnit ); - } - else - { - aMtrFldHelplineDist.SetText( String() ); - } - aMtrFldHelplineDist.SaveValue(); - - // SdrMeasureHelpline1LenItem - pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE1LEN ); - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE1LEN ); - if( pItem ) - { - long nValue = ( ( const SdrMeasureHelpline1LenItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHelpline1Len, nValue, eUnit ); - } - else - { - aMtrFldHelpline1Len.SetText( String() ); - } - aMtrFldHelpline1Len.SaveValue(); - - // SdrMeasureHelpline2LenItem - pItem = GetItem( rAttrs, SDRATTR_MEASUREHELPLINE2LEN ); - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREHELPLINE2LEN ); - if( pItem ) - { - long nValue = ( ( const SdrMeasureHelpline2LenItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldHelpline2Len, nValue, eUnit ); - } - else - { - aMtrFldHelpline2Len.SetText( String() ); - } - aMtrFldHelpline2Len.SaveValue(); - - // SdrMeasureBelowRefEdgeItem - if( rAttrs.GetItemState( SDRATTR_MEASUREBELOWREFEDGE ) != SFX_ITEM_DONTCARE ) - { - aTsbBelowRefEdge.SetState( ( ( const SdrMeasureBelowRefEdgeItem& )rAttrs.Get( SDRATTR_MEASUREBELOWREFEDGE ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbBelowRefEdge.EnableTriState( sal_False ); - } - else - { - aTsbBelowRefEdge.SetState( STATE_DONTKNOW ); - } - aTsbBelowRefEdge.SaveValue(); - - // SdrMeasureDecimalPlacesItem - pItem = GetItem( rAttrs, SDRATTR_MEASUREDECIMALPLACES ); - if( pItem == NULL ) - pItem = &pPool->GetDefaultItem( SDRATTR_MEASUREDECIMALPLACES ); - if( pItem ) - { - sal_Int16 nValue = ( ( const SdrMeasureDecimalPlacesItem* )pItem )->GetValue(); - aMtrFldDecimalPlaces.SetValue( nValue ); - } - else - { - aMtrFldDecimalPlaces.SetText( String() ); - } - aMtrFldDecimalPlaces.SaveValue(); - - // SdrMeasureTextRota90Item - // Attention: negate ! - if( rAttrs.GetItemState( SDRATTR_MEASURETEXTROTA90 ) != SFX_ITEM_DONTCARE ) - { - aTsbParallel.SetState( ( ( const SdrMeasureTextRota90Item& )rAttrs.Get( SDRATTR_MEASURETEXTROTA90 ) ). - GetValue() ? STATE_NOCHECK : STATE_CHECK ); - aTsbParallel.EnableTriState( sal_False ); - } - else - { - aTsbParallel.SetState( STATE_DONTKNOW ); - } - aTsbParallel.SaveValue(); - - // SdrMeasureShowUnitItem - if( rAttrs.GetItemState( SDRATTR_MEASURESHOWUNIT ) != SFX_ITEM_DONTCARE ) - { - aTsbShowUnit.SetState( ( ( const SdrMeasureShowUnitItem& )rAttrs.Get( SDRATTR_MEASURESHOWUNIT ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbShowUnit.EnableTriState( sal_False ); - } - else - { - aTsbShowUnit.SetState( STATE_DONTKNOW ); - } - aTsbShowUnit.SaveValue(); - - // SdrMeasureUnitItem - if( rAttrs.GetItemState( SDRATTR_MEASUREUNIT ) != SFX_ITEM_DONTCARE ) - { - long nFieldUnit = (long) ( ( const SdrMeasureUnitItem& )rAttrs. - Get( SDRATTR_MEASUREUNIT ) ).GetValue(); - - for( sal_uInt16 i = 0; i < aLbUnit.GetEntryCount(); ++i ) - { - if ( (long)aLbUnit.GetEntryData( i ) == nFieldUnit ) - { - aLbUnit.SelectEntryPos( i ); - break; - } - } - } - else - { - aLbUnit.SetNoSelection(); - } - aLbUnit.SaveValue(); - - // Position - if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE ) - { - SdrMeasureTextVPos eVPos = (SdrMeasureTextVPos) - ( ( const SdrMeasureTextVPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); - { - if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE ) - { - aTsbAutoPosV.EnableTriState( sal_False ); - aTsbAutoPosH.EnableTriState( sal_False ); - - SdrMeasureTextHPos eHPos = (SdrMeasureTextHPos) - ( ( const SdrMeasureTextHPosItem& )rAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue(); - RECT_POINT eRP = RP_MM; - switch( eVPos ) - { - case SDRMEASURE_ABOVE: - switch( eHPos ) - { - case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LT; break; - case SDRMEASURE_TEXTINSIDE: eRP = RP_MT; break; - case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RT; break; - case SDRMEASURE_TEXTHAUTO: eRP = RP_MT; break; - } - break; - case SDRMEASURETEXT_VERTICALCENTERED: - switch( eHPos ) - { - case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break; - case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break; - case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break; - case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break; - } - break; - case SDRMEASURE_BELOW: - switch( eHPos ) - { - case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LB; break; - case SDRMEASURE_TEXTINSIDE: eRP = RP_MB; break; - case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RB; break; - case SDRMEASURE_TEXTHAUTO: eRP = RP_MB; break; - } - break; - case SDRMEASURE_TEXTVAUTO: - switch( eHPos ) - { - case SDRMEASURE_TEXTLEFTOUTSIDE: eRP = RP_LM; break; - case SDRMEASURE_TEXTINSIDE: eRP = RP_MM; break; - case SDRMEASURE_TEXTRIGHTOUTSIDE: eRP = RP_RM; break; - case SDRMEASURE_TEXTHAUTO: eRP = RP_MM; break; - } - break; - default: ;//prevent warning - } - - CTL_STATE nState = 0; - - if( eHPos == SDRMEASURE_TEXTHAUTO ) - { - aTsbAutoPosH.SetState( STATE_CHECK ); - nState = CS_NOHORZ; - } - - if( eVPos == SDRMEASURE_TEXTVAUTO ) - { - aTsbAutoPosV.SetState( STATE_CHECK ); - nState |= CS_NOVERT; - } - - aCtlPosition.SetState( nState ); - aCtlPosition.SetActualRP( eRP ); - } - } - } - else - { - aCtlPosition.Reset(); - aTsbAutoPosV.SetState( STATE_DONTKNOW ); - aTsbAutoPosH.SetState( STATE_DONTKNOW ); - } - - // put the attributes to the preview-control, - // otherwise the control don't know about - // the settings of the dialog (#67930) - ChangeAttrHdl_Impl( &aTsbShowUnit ); - aCtlPreview.SetAttributes( rAttrs ); - - bPositionModified = sal_False; -} - -/************************************************************************* -|* -|* Fill the delivered Item-Set with dialogbox-attributes -|* -\************************************************************************/ - -sal_Bool SvxMeasurePage::FillItemSet( SfxItemSet& rAttrs) -{ - sal_Bool bModified = sal_False; - sal_Int32 nValue; - TriState eState; - - if( aMtrFldLineDist.GetText() != aMtrFldLineDist.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldLineDist, eUnit ); - rAttrs.Put( SdrMeasureLineDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldHelplineOverhang.GetText() != aMtrFldHelplineOverhang.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit ); - rAttrs.Put( SdrMeasureHelplineOverhangItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldHelplineDist.GetText() != aMtrFldHelplineDist.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHelplineDist, eUnit ); - rAttrs.Put( SdrMeasureHelplineDistItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldHelpline1Len.GetText() != aMtrFldHelpline1Len.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit ); - rAttrs.Put( SdrMeasureHelpline1LenItem( nValue ) ); - bModified = sal_True; - } - - if( aMtrFldHelpline2Len.GetText() != aMtrFldHelpline2Len.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit ); - rAttrs.Put( SdrMeasureHelpline2LenItem( nValue ) ); - bModified = sal_True; - } - - eState = aTsbBelowRefEdge.GetState(); - if( eState != aTsbBelowRefEdge.GetSavedValue() ) - { - rAttrs.Put( SdrMeasureBelowRefEdgeItem( (sal_Bool) STATE_CHECK == eState ) ); - bModified = sal_True; - } - - if( aMtrFldDecimalPlaces.GetText() != aMtrFldDecimalPlaces.GetSavedValue() ) - { - nValue = static_cast(aMtrFldDecimalPlaces.GetValue()); - rAttrs.Put( - SdrMeasureDecimalPlacesItem( - sal::static_int_cast< sal_Int16 >( nValue ) ) ); - bModified = sal_True; - } - - eState = aTsbParallel.GetState(); - if( eState != aTsbParallel.GetSavedValue() ) - { - rAttrs.Put( SdrMeasureTextRota90Item( (sal_Bool) STATE_NOCHECK == eState ) ); - bModified = sal_True; - } - - eState = aTsbShowUnit.GetState(); - if( eState != aTsbShowUnit.GetSavedValue() ) - { - rAttrs.Put( SdrMeasureShowUnitItem( (sal_Bool) STATE_CHECK == eState ) ); - bModified = sal_True; - } - - sal_uInt16 nPos = aLbUnit.GetSelectEntryPos(); - if( nPos != aLbUnit.GetSavedValue() ) - { - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - sal_uInt16 nFieldUnit = (sal_uInt16)(long)aLbUnit.GetEntryData( nPos ); - FieldUnit _eUnit = (FieldUnit) nFieldUnit; - rAttrs.Put( SdrMeasureUnitItem( _eUnit ) ); - bModified = sal_True; - } - } - - if( bPositionModified ) - { - // Position - SdrMeasureTextVPos eVPos, eOldVPos; - SdrMeasureTextHPos eHPos, eOldHPos; - - RECT_POINT eRP = aCtlPosition.GetActualRP(); - switch( eRP ) - { - default: - case RP_LT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_LB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_MT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_MB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_RT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - case RP_RB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - } - if( aTsbAutoPosH.GetState() == STATE_CHECK ) - eHPos = SDRMEASURE_TEXTHAUTO; - - if( aTsbAutoPosV.GetState() == STATE_CHECK ) - eVPos = SDRMEASURE_TEXTVAUTO; - - if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTVPOS ) != SFX_ITEM_DONTCARE ) - { - eOldVPos = (SdrMeasureTextVPos) - ( ( const SdrMeasureTextVPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTVPOS ) ).GetValue(); - if( eOldVPos != eVPos ) - { - rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) ); - bModified = sal_True; - } - } - else - { - rAttrs.Put( SdrMeasureTextVPosItem( eVPos ) ); - bModified = sal_True; - } - - if ( rAttrs.GetItemState( SDRATTR_MEASURETEXTHPOS ) != SFX_ITEM_DONTCARE ) - { - eOldHPos = (SdrMeasureTextHPos) - ( ( const SdrMeasureTextHPosItem& )rOutAttrs.Get( SDRATTR_MEASURETEXTHPOS ) ).GetValue(); - if( eOldHPos != eHPos ) - { - rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) ); - bModified = sal_True; - } - } - else - { - rAttrs.Put( SdrMeasureTextHPosItem( eHPos ) ); - bModified = sal_True; - } - } - - return( bModified ); -} - -/************************************************************************* -|* -|* The View have to set at the measure-object to be able to notify -|* unit and floatingpoint-values -|* -\************************************************************************/ - -void SvxMeasurePage::Construct() -{ - DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); - - aCtlPreview.pMeasureObj->SetModel( pView->GetModel() ); - aCtlPreview.Invalidate(); -} - -/************************************************************************* -|* -|* create the tabpage -|* -\************************************************************************/ - -SfxTabPage* SvxMeasurePage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxMeasurePage( pWindow, rAttrs ) ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16* SvxMeasurePage::GetRanges() -{ - return( pRanges ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxMeasurePage::PointChanged( Window* pWindow, RECT_POINT /*eRP*/ ) -{ - ChangeAttrHdl_Impl( pWindow ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, void *, p ) -{ - if( aTsbAutoPosH.GetState() == STATE_CHECK ) - { - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: - case RP_RT: - aCtlPosition.SetActualRP( RP_MT ); - break; - - case RP_LM: - case RP_RM: - aCtlPosition.SetActualRP( RP_MM ); - break; - - case RP_LB: - case RP_RB: - aCtlPosition.SetActualRP( RP_MB ); - break; - default: ;//prevent warning - } - } - if( aTsbAutoPosV.GetState() == STATE_CHECK ) - { - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: - case RP_LB: - aCtlPosition.SetActualRP( RP_LM ); - break; - - case RP_MT: - case RP_MB: - aCtlPosition.SetActualRP( RP_MM ); - break; - - case RP_RT: - case RP_RB: - aCtlPosition.SetActualRP( RP_RM ); - break; - default: ;//prevent warning - } - } - ChangeAttrHdl_Impl( p ); - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxMeasurePage, ChangeAttrHdl_Impl, void *, p ) -{ - - if( p == &aMtrFldLineDist ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldLineDist, eUnit ); - aAttrSet.Put( SdrMeasureLineDistItem( nValue ) ); - } - - if( p == &aMtrFldHelplineOverhang ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHelplineOverhang, eUnit ); - aAttrSet.Put( SdrMeasureHelplineOverhangItem( nValue) ); - } - - if( p == &aMtrFldHelplineDist ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHelplineDist, eUnit ); - aAttrSet.Put( SdrMeasureHelplineDistItem( nValue) ); - } - - if( p == &aMtrFldHelpline1Len ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHelpline1Len, eUnit ); - aAttrSet.Put( SdrMeasureHelpline1LenItem( nValue ) ); - } - - if( p == &aMtrFldHelpline2Len ) - { - sal_Int32 nValue = GetCoreValue( aMtrFldHelpline2Len, eUnit ); - aAttrSet.Put( SdrMeasureHelpline2LenItem( nValue ) ); - } - - if( p == &aTsbBelowRefEdge ) - { - TriState eState = aTsbBelowRefEdge.GetState(); - if( eState != STATE_DONTKNOW ) - aAttrSet.Put( SdrMeasureBelowRefEdgeItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - if( p == &aMtrFldDecimalPlaces ) - { - sal_Int16 nValue = sal::static_int_cast< sal_Int16 >( - aMtrFldDecimalPlaces.GetValue() ); - aAttrSet.Put( SdrMeasureDecimalPlacesItem( nValue ) ); - } - - if( p == &aTsbParallel ) - { - TriState eState = aTsbParallel.GetState(); - if( eState != STATE_DONTKNOW ) - aAttrSet.Put( SdrMeasureTextRota90Item( (sal_Bool) !STATE_CHECK == eState ) ); - } - - if( p == &aTsbShowUnit ) - { - TriState eState = aTsbShowUnit.GetState(); - if( eState != STATE_DONTKNOW ) - aAttrSet.Put( SdrMeasureShowUnitItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - if( p == &aLbUnit ) - { - sal_uInt16 nPos = aLbUnit.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - sal_uInt16 nFieldUnit = (sal_uInt16)(long)aLbUnit.GetEntryData( nPos ); - FieldUnit _eUnit = (FieldUnit) nFieldUnit; - aAttrSet.Put( SdrMeasureUnitItem( _eUnit ) ); - } - } - - if( p == &aTsbAutoPosV || p == &aTsbAutoPosH || p == &aCtlPosition ) - { - bPositionModified = sal_True; - - // Position - RECT_POINT eRP = aCtlPosition.GetActualRP(); - SdrMeasureTextVPos eVPos; - SdrMeasureTextHPos eHPos; - - switch( eRP ) - { - default: - case RP_LT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_LM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_LB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTLEFTOUTSIDE; break; - case RP_MT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_MM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_MB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTINSIDE; break; - case RP_RT: eVPos = SDRMEASURE_ABOVE; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - case RP_RM: eVPos = SDRMEASURETEXT_VERTICALCENTERED; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - case RP_RB: eVPos = SDRMEASURE_BELOW; - eHPos = SDRMEASURE_TEXTRIGHTOUTSIDE; break; - } - - CTL_STATE nState = 0; - - if( aTsbAutoPosH.GetState() == STATE_CHECK ) - { - eHPos = SDRMEASURE_TEXTHAUTO; - nState = CS_NOHORZ; - } - - if( aTsbAutoPosV.GetState() == STATE_CHECK ) - { - eVPos = SDRMEASURE_TEXTVAUTO; - nState |= CS_NOVERT; - } - - if( p == &aTsbAutoPosV || p == &aTsbAutoPosH ) - aCtlPosition.SetState( nState ); - - aAttrSet.Put( SdrMeasureTextVPosItem( eVPos ) ); - aAttrSet.Put( SdrMeasureTextHPosItem( eHPos ) ); - } - - aCtlPreview.SetAttributes( aAttrSet ); - aCtlPreview.Invalidate(); - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxMeasurePage::FillUnitLB() -{ - // fill ListBox with metrics - SvxStringArray aMetricArr( SVX_RES( RID_SVXSTR_FIELDUNIT_TABLE ) ); - - long nUnit = FUNIT_NONE; - String aStrMetric( CUI_RES( STR_MEASURE_AUTOMATIC ) ); - sal_uInt16 nPos = aLbUnit.InsertEntry( aStrMetric ); - aLbUnit.SetEntryData( nPos, (void*)nUnit ); - - for( sal_uInt16 i = 0; i < aMetricArr.Count(); ++i ) - { - aStrMetric = aMetricArr.GetStringByPos( i ); - nUnit = aMetricArr.GetValue( i ); - nPos = aLbUnit.InsertEntry( aStrMetric ); - aLbUnit.SetEntryData( nPos, (void*)nUnit ); - } -} -void SvxMeasurePage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pOfaPtrItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); - - if (pOfaPtrItem) - SetView( static_cast(pOfaPtrItem->GetValue())); - - Construct(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/measure.hrc b/cui/source/tabpages/measure.hrc deleted file mode 100644 index 0229ca775..000000000 --- a/cui/source/tabpages/measure.hrc +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FL_LINE 1 -#define FL_LABEL 2 -#define FL_VERT 3 - -#define FT_LINE_DIST 1 -#define FT_HELPLINE_OVERHANG 2 -#define FT_HELPLINE_DIST 3 -#define FT_HELPLINE1_LEN 4 -#define FT_HELPLINE2_LEN 5 -#define FT_POSITION 6 -#define FT_DECIMALPLACES 7 -#define MTR_LINE_DIST 1 -#define MTR_FLD_HELPLINE_OVERHANG 2 -#define MTR_FLD_HELPLINE_DIST 3 -#define MTR_FLD_HELPLINE1_LEN 4 -#define MTR_FLD_HELPLINE2_LEN 5 -#define MTR_FLD_DECIMALPLACES 6 -#define TSB_BELOW_REF_EDGE 1 -#define TSB_SHOW_UNIT 2 -#define TSB_AUTOPOSV 3 -#define TSB_AUTOPOSH 4 -#define TSB_PARALLEL 5 -#define CTL_POSITION 1 -#define CTL_PREVIEW 2 -#define LB_UNIT 1 - -#define STR_MEASURE_AUTOMATIC 1 diff --git a/cui/source/tabpages/measure.src b/cui/source/tabpages/measure.src deleted file mode 100644 index 52bf76a58..000000000 --- a/cui/source/tabpages/measure.src +++ /dev/null @@ -1,321 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "measure.hrc" -#include "helpid.hrc" -#include - -#define DELTA 20 - // pragma ---------------------------------------------------------------- - - // RID_SVXPAGE_MEASURE --------------------------------------------------- -TabPage RID_SVXPAGE_MEASURE -{ - HelpId = HID_PAGE_MEASURE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Dimensioning" ; - - FixedLine FL_LINE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Line"; - }; - FixedText FT_LINE_DIST - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "Line ~distance" ; - }; - MetricField MTR_LINE_DIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_LINE_DIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 14 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_MM ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - FixedText FT_HELPLINE_OVERHANG - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "Guide ~overhang" ; - }; - MetricField MTR_FLD_HELPLINE_OVERHANG - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE_OVERHANG"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 30 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_MM ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - FixedText FT_HELPLINE_DIST - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "~Guide distance" ; - }; - MetricField MTR_FLD_HELPLINE_DIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE_DIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 46 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_MM ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - FixedText FT_HELPLINE1_LEN - { - Pos = MAP_APPFONT ( 12 , 64 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "~Left guide" ; - }; - MetricField MTR_FLD_HELPLINE1_LEN - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE1_LEN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 62 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_MM ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - FixedText FT_HELPLINE2_LEN - { - Pos = MAP_APPFONT ( 12 , 80 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - Text [ en-US ] = "~Right guide" ; - }; - MetricField MTR_FLD_HELPLINE2_LEN - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_HELPLINE2_LEN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 78 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_MM ; - DecimalDigits = 2 ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - TriStateBox TSB_BELOW_REF_EDGE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_BELOW_REF_EDGE"; - Pos = MAP_APPFONT ( 12 , 96 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Measure ~below object"; - }; - FixedText FT_DECIMALPLACES - { - Pos = MAP_APPFONT ( 12 , 112 ) ; - Size = MAP_APPFONT ( 65 , 8 ) ; - - Text [ en-US ] = "Decimal places" ; - }; - MetricField MTR_FLD_DECIMALPLACES - { - HelpID = "cui:MetricField:RID_SVXPAGE_MEASURE:MTR_FLD_DECIMALPLACES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 78 , 110 ) ; - Size = MAP_APPFONT ( 42 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99 ; - StrictFormat = TRUE ; - Last = 99 ; - SpinSize = 1 ; - }; - FixedLine FL_VERT - { - Pos = MAP_APPFONT ( 127 , 14 ) ; - Size = MAP_APPFONT ( 4 , 108 ) ; - Vert = TRUE ; - }; - FixedLine FL_LABEL - { - Pos = MAP_APPFONT ( 132 , 3 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Legend"; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT ( 138 , 14 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "~Text position" ; - }; - Control CTL_POSITION - { - HelpId = HID_MEASURE_CTL_POSITION ; - Border = TRUE ; - Pos = MAP_APPFONT ( 154 , 25 ) ; - Size = MAP_APPFONT ( 60 , 24 ) ; - TabStop = TRUE ; - }; - TriStateBox TSB_AUTOPOSV - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_AUTOPOSV"; - Pos = MAP_APPFONT ( 154 , 54 ) ; - Size = MAP_APPFONT ( 101 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~AutoVertical" ; - }; - TriStateBox TSB_AUTOPOSH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_AUTOPOSH"; - Pos = MAP_APPFONT ( 154 , 68 ) ; - Size = MAP_APPFONT ( 101 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "A~utoHorizontal" ; - }; - TriStateBox TSB_PARALLEL - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_PARALLEL"; - Pos = MAP_APPFONT ( 138 , 82 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Parallel to line"; - }; - TriStateBox TSB_SHOW_UNIT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_MEASURE:TSB_SHOW_UNIT"; - Pos = MAP_APPFONT ( 138 , 96 ) ; - Size = MAP_APPFONT ( 64+40 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Show ~meas. units" ; - }; - ListBox LB_UNIT - { - HelpID = "cui:ListBox:RID_SVXPAGE_MEASURE:LB_UNIT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 154 , 110 ) ; - Size = MAP_APPFONT ( 60 , 80+35 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - Control CTL_PREVIEW - { - HelpId = HID_MEASURE_CTL_PREVIEW ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 132 ) ; - Size = MAP_APPFONT ( 248 , 47 ) ; - }; - String STR_MEASURE_AUTOMATIC - { - Text [ en-US ] = "Automatic" ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx deleted file mode 100644 index b92831e41..000000000 --- a/cui/source/tabpages/numfmt.cxx +++ /dev/null @@ -1,1849 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#define _SVSTDARR_STRINGS -#define _SVSTDARR_STRINGSDTOR -#include -#include - -#define _SVX_NUMFMT_CXX - -#include -#include "numfmt.hrc" - -#include - -#include "numfmt.hxx" -#include -#include -#include -#include -#include -#include "svx/flagsdef.hxx" - -#define NUMKEY_UNDEFINED SAL_MAX_UINT32 - -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_NUMBERFORMAT_VALUE, - SID_ATTR_NUMBERFORMAT_INFO, - SID_ATTR_NUMBERFORMAT_NOLANGUAGE, - SID_ATTR_NUMBERFORMAT_NOLANGUAGE, - SID_ATTR_NUMBERFORMAT_ONE_AREA, - SID_ATTR_NUMBERFORMAT_ONE_AREA, - SID_ATTR_NUMBERFORMAT_SOURCE, - SID_ATTR_NUMBERFORMAT_SOURCE, - 0 -}; - -/************************************************************************* -#* Methode: SvxNumberPreviewImpl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberPreview -#* Funktion: Konstruktor der Klasse SvxNumberPreviewImpl -#* Input: Fenster, Resource-ID -#* Output: --- -#* -#************************************************************************/ - -SvxNumberPreviewImpl::SvxNumberPreviewImpl( Window* pParent, const ResId& rResId ) : - - Window( pParent, rResId ) - -{ - Font aFont( GetFont() ); - aFont.SetTransparent( sal_True ); - aFont.SetColor( Application::GetSettings().GetStyleSettings().GetFieldColor() ); - SetFont( aFont ); - InitSettings( sal_True, sal_True ); - SetBorderStyle( WINDOW_BORDER_MONO ); -} - -/************************************************************************* -#* Methode: SvxNumberPreviewImpl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberPreview -#* Funktion: Destruktor der Klasse SvxNumberPreviewImpl -#* Input: --- -#* Output: --- -#* -#************************************************************************/ - -SvxNumberPreviewImpl::~SvxNumberPreviewImpl() -{ -} - -/************************************************************************* -#* Methode: NotifyChange -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberPreviewImpl -#* Funktion: Funktion fuer das Aendern des Preview- Strings -#* Input: String, Farbe -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr, - const Color* pColor ) -{ - aPrevStr = rPrevStr; - svtools::ColorConfig aColorConfig; - Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - aPrevCol = pColor ? *pColor : aWindowTextColor; - Invalidate(); - Update(); -} - -/************************************************************************* -#* Methode: Paint -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberPreviewImpl -#* Funktion: Funktion fuer das neu zeichnen des Fensters. -#* Input: --- -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberPreviewImpl::Paint( const Rectangle& ) -{ - Font aDrawFont = GetFont(); - Size aSzWnd = GetOutputSizePixel(); - Point aPosText = Point( (aSzWnd.Width() - GetTextWidth( aPrevStr )) /2, - (aSzWnd.Height() - GetTextHeight())/2 ); - - aDrawFont.SetColor( aPrevCol ); - SetFont( aDrawFont ); - DrawText( aPosText, aPrevStr ); -} - -// ----------------------------------------------------------------------- - -void SvxNumberPreviewImpl::InitSettings( sal_Bool bForeground, sal_Bool bBackground ) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); -} - -// ----------------------------------------------------------------------- - -void SvxNumberPreviewImpl::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings( sal_True, sal_False ); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings( sal_False, sal_True ); - - Window::StateChanged( nType ); -} - -// ----------------------------------------------------------------------- - -void SvxNumberPreviewImpl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings( sal_True, sal_True ); -} - -// class SvxNumberFormatTabPage ------------------------------------------ - -#define REMOVE_DONTKNOW() \ - if ( !aFtLanguage.IsEnabled() ) \ - { \ - aFtLanguage .Enable(); \ - aLbLanguage .Enable(); \ - aLbLanguage .SelectLanguage( pNumFmtShell->GetCurLanguage() ); \ - } - -#define HDL(hdl) LINK( this, SvxNumberFormatTabPage, hdl ) - -#include - -#if ENABLE_LAYOUT -#undef CUI_RES -#define CUI_RES(x) #x -#define CUI_RES_PLAIN(x) ResId (x, CUI_MGR ()) -#define THIS_CUI_RES(x) this, #x -#undef SfxTabPage -#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "number-format.xml", id, &args ) -#else /* !ENABLE_LAYOUT */ -#define CUI_RES_PLAIN CUI_RES -#define THIS_CUI_RES CUI_RES -#endif /* !ENABLE_LAYOUT */ - -SvxNumberFormatTabPage::SvxNumberFormatTabPage( Window* pParent, - const SfxItemSet& rCoreAttrs ) - - : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUMBERFORMAT ), rCoreAttrs ), - - aFtCategory ( this, CUI_RES( FT_CATEGORY ) ), - aLbCategory ( this, CUI_RES( LB_CATEGORY ) ), - aFtFormat ( this, CUI_RES( FT_FORMAT ) ), - aLbCurrency ( this, CUI_RES( LB_CURRENCY) ), - aLbFormat ( this, CUI_RES( LB_FORMAT ) ), - aFtLanguage ( this, CUI_RES( FT_LANGUAGE ) ), - aLbLanguage ( this, CUI_RES( LB_LANGUAGE ), sal_False ), - aCbSourceFormat ( this, CUI_RES( CB_SOURCEFORMAT ) ), -#if ENABLE_LAYOUT - aWndPreview ( LAYOUT_THIS_WINDOW(this), CUI_RES_PLAIN( WND_NUMBER_PREVIEW ) ), -#else - aWndPreview ( this, CUI_RES_PLAIN( WND_NUMBER_PREVIEW ) ), -#endif - aFlOptions ( this, CUI_RES( FL_OPTIONS ) ), - aFtDecimals ( this, CUI_RES( FT_DECIMALS ) ), - aEdDecimals ( this, CUI_RES( ED_DECIMALS ) ), - aBtnNegRed ( this, CUI_RES( BTN_NEGRED ) ), - aFtLeadZeroes ( this, CUI_RES( FT_LEADZEROES ) ), - aEdLeadZeroes ( this, CUI_RES( ED_LEADZEROES ) ), - aBtnThousand ( this, CUI_RES( BTN_THOUSAND ) ), - - aFtEdFormat ( this, CUI_RES( FT_EDFORMAT ) ), - aEdFormat ( this, CUI_RES( ED_FORMAT ) ), - aIbAdd ( this, CUI_RES( IB_ADD ) ), - aIbInfo ( this, CUI_RES( IB_INFO ) ), - aIbRemove ( this, CUI_RES( IB_REMOVE ) ), - aFtComment ( this, CUI_RES( FT_COMMENT ) ), - aEdComment ( this, CUI_RES( ED_COMMENT ) ), - - pNumItem ( NULL ), - pNumFmtShell ( NULL ), - nInitFormat ( ULONG_MAX ), - - sAutomaticEntry ( THIS_CUI_RES( STR_AUTO_ENTRY)), - pLastActivWindow( NULL ) -{ -#if ENABLE_LAYOUT - aLbFormat.Clear (); -#endif /* ENABLE_LAYOUT */ - - Init_Impl(); - SetExchangeSupport(); // diese Page braucht ExchangeSupport - FreeResource(); - nFixedCategory=-1; -} - -SvxNumberFormatTabPage::~SvxNumberFormatTabPage() -{ - delete pNumFmtShell; - delete pNumItem; -} - -void SvxNumberFormatTabPage::Init_Impl() -{ - ImageList aIconList( CUI_RES_PLAIN ( IL_ICON ) ); - - bNumItemFlag=sal_True; - bOneAreaFlag=sal_False; - - nCatHeight=aLbCategory.GetSizePixel().Height(); - - nCurFormatY =aLbFormat.GetPosPixel().Y(); - nCurFormatHeight=aLbFormat.GetSizePixel().Height(); - nStdFormatY =aLbCurrency.GetPosPixel().Y(); - nStdFormatHeight=nCurFormatY-nStdFormatY+nCurFormatHeight; - - aIbAdd. SetModeImage( aIconList.GetImage( IID_ADD ) ); - aIbRemove. SetModeImage( aIconList.GetImage( IID_REMOVE ) ); - aIbInfo. SetModeImage( aIconList.GetImage( IID_INFO ) ); - - aIbAdd.Enable(sal_False ); - aIbRemove.Enable(sal_False ); - aIbInfo.Enable(sal_False ); - - aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert - //holen - aEdComment.Hide(); - - aCbSourceFormat.Check( sal_False ); - aCbSourceFormat.Disable(); - aCbSourceFormat.Hide(); - -// Handler verbinden - Link aLink = LINK( this, SvxNumberFormatTabPage, SelFormatHdl_Impl ); - - aLbCategory .SetSelectHdl( aLink ); - aLbFormat .SetSelectHdl( aLink ); - aLbLanguage .SetSelectHdl( aLink ); - aLbCurrency .SetSelectHdl( aLink ); - aCbSourceFormat .SetClickHdl( aLink ); - - aLink = LINK( this, SvxNumberFormatTabPage, OptHdl_Impl ); - - aEdDecimals .SetModifyHdl( aLink ); - aEdLeadZeroes .SetModifyHdl( aLink ); - aBtnNegRed .SetClickHdl( aLink ); - aBtnThousand .SetClickHdl( aLink ); - aLbFormat .SetDoubleClickHdl( HDL( DoubleClickHdl_Impl ) ); - aEdFormat .SetModifyHdl( HDL( EditHdl_Impl ) ); - aIbAdd.SetClickHdl( HDL( ClickHdl_Impl ) ); - aIbRemove.SetClickHdl( HDL( ClickHdl_Impl ) ); - aIbInfo.SetClickHdl( HDL( ClickHdl_Impl ) ); - - aLink = LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl); - - aEdComment .SetLoseFocusHdl( aLink); - aResetWinTimer .SetTimeoutHdl(LINK( this, SvxNumberFormatTabPage, TimeHdl_Impl)); - aResetWinTimer .SetTimeout( 10); - - // Sprachen-ListBox initialisieren - - aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM ); - // Don't list ambiguous locales where we won't be able to convert the - // LanguageType back to an identical Language_Country name and therefore - // couldn't load the i18n LocaleData. Show DebugMsg in non-PRODUCT version. - ::com::sun::star::uno::Sequence< sal_uInt16 > xLang = - LocaleDataWrapper::getInstalledLanguageTypes(); - sal_Int32 nCount = xLang.getLength(); - for ( sal_Int32 i=0; iGetValue()) - { - HideLanguage(); - } - else - { - HideLanguage(sal_False); - } - - } - - eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_INFO ),sal_True,&pItem); - - if(eState==SFX_ITEM_SET) - { - if(pNumItem==NULL) - { - bNumItemFlag=sal_True; - pNumItem= (SvxNumberInfoItem *) pItem->Clone(); - } - else - { - bNumItemFlag=sal_False; - } - } - else - { - bNumItemFlag=sal_False; - } - - - eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ONE_AREA )); - - if(eState==SFX_ITEM_SET) - { - const SfxBoolItem* pBoolItem = (const SfxBoolItem*) - GetItem( rSet, SID_ATTR_NUMBERFORMAT_ONE_AREA); - - if(pBoolItem!=NULL) - { - bOneAreaFlag= pBoolItem->GetValue(); - } - } - - eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ) ); - - if ( eState == SFX_ITEM_SET ) - { - const SfxBoolItem* pBoolItem = (const SfxBoolItem*) - GetItem( rSet, SID_ATTR_NUMBERFORMAT_SOURCE ); - if ( pBoolItem ) - aCbSourceFormat.Check( pBoolItem->GetValue() ); - else - aCbSourceFormat.Check( sal_False ); - aCbSourceFormat.Enable(); - aCbSourceFormat.Show(); - } - else - { - sal_Bool bInit = sal_False; // set to sal_True for debug test - aCbSourceFormat.Check( bInit ); - aCbSourceFormat.Enable( bInit ); - aCbSourceFormat.Show( bInit ); - } - - // pNumItem muss von aussen gesetzt worden sein! - DBG_ASSERT( pNumItem, "No NumberInfo, no NumberFormatter, good bye.CRASH. :-(" ); - - // aktuellen Zahlenformat-Tabellenindex holen - eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ) ); - - if ( SFX_ITEM_DONTCARE != eState ) - pValFmtAttr = (const SfxUInt32Item*) - GetItem( rSet, SID_ATTR_NUMBERFORMAT_VALUE ); - - eValType = pNumItem->GetValueType(); - - switch ( eValType ) - { - case SVX_VALUE_TYPE_STRING: - aValString = pNumItem->GetValueString(); - break; - case SVX_VALUE_TYPE_NUMBER: - // #50441# string may be set in addition to the value - aValString = pNumItem->GetValueString(); - nValDouble = pNumItem->GetValueDouble(); - break; - case SVX_VALUE_TYPE_UNDEFINED: - default: - break; - } - - // nun sind alle Informationen fuer die Formatierer-Shell beisammen: - - if ( pNumFmtShell ) - delete pNumFmtShell; // ggF. alte Shell loeschen (==Reset) - - nInitFormat = ( pValFmtAttr ) // Init-Key merken - ? pValFmtAttr->GetValue() // (fuer FillItemSet()) - : ULONG_MAX; // == DONT_KNOW - - - if ( eValType == SVX_VALUE_TYPE_STRING ) - pNumFmtShell =SvxNumberFormatShell::Create( - pNumItem->GetNumberFormatter(), - (pValFmtAttr) ? nInitFormat : 0L, - eValType, - aValString ); - else - pNumFmtShell =SvxNumberFormatShell::Create( - pNumItem->GetNumberFormatter(), - (pValFmtAttr) ? nInitFormat : 0L, - eValType, - nValDouble, - &aValString ); - - FillCurrencyBox(); - - String aPrevString; - Color* pDummy = NULL; - pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos, - aFmtEntryList, aPrevString, pDummy ); - - aLbCurrency.SelectEntryPos((sal_uInt16)pNumFmtShell->GetCurrencySymbol()); - - nFixedCategory=nCatLbSelPos; - if(bOneAreaFlag) - { - String sFixedCategory=aLbCategory.GetEntry(nFixedCategory); - aLbCategory.Clear(); - aLbCategory.InsertEntry(sFixedCategory); - SetCategory(0); - } - else - { - SetCategory(nCatLbSelPos ); - } - eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_ADD_AUTO ) ); - if(SFX_ITEM_SET == eState) - pAutoEntryAttr = (const SfxBoolItem*) - GetItem( rSet, SID_ATTR_NUMBERFORMAT_ADD_AUTO ); - // no_NO is an alias for nb_NO and normally isn't listed, we need it for - // backwards compatibility, but only if the format passed is of - // LanguageType no_NO. - if ( eLangType == LANGUAGE_NORWEGIAN ) - { - aLbLanguage.RemoveLanguage( eLangType ); // in case we're already called - aLbLanguage.InsertLanguage( eLangType ); - } - aLbLanguage.SelectLanguage( eLangType ); - if(pAutoEntryAttr) - AddAutomaticLanguage_Impl(eLangType, pAutoEntryAttr->GetValue()); - UpdateFormatListBox_Impl(sal_False,sal_True); - -//! This spoils everything because it rematches currency formats based on -//! the selected aLbCurrency entry instead of the current format. -//! Besides that everything seems to be initialized by now, so why call it? -// SelFormatHdl_Impl( &aLbCategory ); - - if ( pValFmtAttr ) - { - EditHdl_Impl( &aEdFormat ); // UpdateOptions_Impl() als Seiteneffekt - } - else // DONT_KNOW - { - // Kategoriewechsel und direkte Eingabe sind moeglich, sonst nix: - Obstructing(); - } - - if ( aCbSourceFormat.IsChecked() ) - { - // everything disabled except SourceFormat checkbox - EnableBySourceFormat_Impl(); - } - - DeleteEntryList_Impl(aFmtEntryList); -} - -/************************************************************************* -#* Methode: Obstructing -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Sperren der Controls mit Ausnahme von Kategoriewechsel -#* und direkter Eingabe. -#* Input: --- -#* Output: --- -#* -#************************************************************************/ -void SvxNumberFormatTabPage::Obstructing() -{ - aLbFormat .SetNoSelection(); - aLbLanguage .SetNoSelection(); - aFtLanguage .Disable(); - aLbLanguage .Disable(); - - aIbAdd.Enable(sal_False ); - aIbRemove.Enable(sal_False ); - aIbInfo.Enable(sal_False ); - - aBtnNegRed .Disable(); - aBtnThousand .Disable(); - aFtLeadZeroes .Disable(); - aFtDecimals .Disable(); - aEdLeadZeroes .Disable(); - aEdDecimals .Disable(); - aFlOptions .Disable(); - aEdDecimals .SetText( String() ); - aEdLeadZeroes .SetText( String() ); - aBtnNegRed .Check( sal_False ); - aBtnThousand .Check( sal_False ); - aWndPreview .NotifyChange( String() ); - - aLbCategory .SelectEntryPos( 0 ); - aEdFormat .SetText( String() ); - aFtComment .SetText( String() ); - aEdComment .SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert - //holen - - aEdFormat .GrabFocus(); -} - - -/************************************************************************* -#* Enable/Disable dialog parts depending on the value of the SourceFormat -#* checkbox. -#************************************************************************/ -void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() -{ - sal_Bool bEnable = !aCbSourceFormat.IsChecked(); - if ( !bEnable ) - aCbSourceFormat.GrabFocus(); - aFtCategory .Enable( bEnable ); - aLbCategory .Enable( bEnable ); - aFtFormat .Enable( bEnable ); - aLbCurrency .Enable( bEnable ); - aLbFormat .Enable( bEnable ); - aFtLanguage .Enable( bEnable ); - aLbLanguage .Enable( bEnable ); - aFtDecimals .Enable( bEnable ); - aEdDecimals .Enable( bEnable ); - aFtLeadZeroes .Enable( bEnable ); - aEdLeadZeroes .Enable( bEnable ); - aBtnNegRed .Enable( bEnable ); - aBtnThousand .Enable( bEnable ); - aFlOptions .Enable( bEnable ); - aFtEdFormat .Enable( bEnable ); - aEdFormat .Enable( bEnable ); - aIbAdd .Enable( bEnable ); - aIbRemove .Enable( bEnable ); - aIbInfo .Enable( bEnable ); - aFtComment .Enable( bEnable ); - aEdComment .Enable( bEnable ); - aLbFormat.Invalidate(); // #i43322# -} - - -/************************************************************************* -#* Methode: HideLanguage -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Versteckt die Spracheinstellung: -#* Input: sal_Bool nFlag -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberFormatTabPage::HideLanguage(sal_Bool nFlag) -{ - Size aSize=aLbCategory.GetSizePixel(); - - if(nFlag) - { - aSize.Height()=aLbFormat.GetSizePixel().Height(); - } - else - { - aSize.Height()=nCatHeight; - } - - aLbCategory.SetSizePixel(aSize); - - aFtLanguage.Show(!nFlag); - aLbLanguage.Show(!nFlag); -} - -/************************************************************************* -#* Methode: FillItemSet -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Stellt die Attribute im ItemSet ein, -#* sowie in der DocShell den numItem, wenn -#* bNumItemFlag nicht gesetzt ist. -#* Input: SfxItemSet -#* Output: --- -#* -#************************************************************************/ - -sal_Bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) -{ - sal_Bool bDataChanged = aFtLanguage.IsEnabled() || aCbSourceFormat.IsEnabled(); - if ( bDataChanged ) - { - const SfxItemSet& rMyItemSet = GetItemSet(); - sal_uInt16 nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_VALUE ); - SfxItemState eItemState = rMyItemSet.GetItemState( nWhich, sal_False ); - - // OK chosen - Is format code input entered already taken over? - // If not, simulate Add. Upon syntax error ignore input and prevent Put. - String aFormat = aEdFormat.GetText(); - sal_uInt32 nCurKey = pNumFmtShell->GetCurNumFmtKey(); - - if ( aIbAdd.IsEnabled() || pNumFmtShell->IsTmpCurrencyFormat(aFormat) ) - { // #79599# It is not sufficient to just add the format code (or - // delete it in case of bOneAreaFlag and resulting category change). - // Upon switching tab pages we need all settings to be consistent - // in case this page will be redisplayed later. - bDataChanged = (ClickHdl_Impl( &aIbAdd ) != 0); - nCurKey = pNumFmtShell->GetCurNumFmtKey(); - } - else if(nCurKey == NUMKEY_UNDEFINED) - { // something went wrong, e.g. in Writer #70281# - pNumFmtShell->FindEntry(aFormat, &nCurKey); - } - - //--------------------------------------------------------------- - // Chosen format: - // -------------- - if ( bDataChanged ) - { - bDataChanged = ( nInitFormat != nCurKey ); - - if (bDataChanged) - { - rCoreAttrs.Put( SfxUInt32Item( nWhich, nCurKey ) ); - } - else if(SFX_ITEM_DEFAULT == eItemState) - { - rCoreAttrs.ClearItem( nWhich ); - } - } - - // -------------------------------------------------------------- - // List of changed user defined formats: - // ------------------------------------- - const sal_uInt32 nDelCount = pNumFmtShell->GetUpdateDataCount(); - - if ( nDelCount > 0 ) - { - sal_uInt32* pDelArr = new sal_uInt32[nDelCount]; - - pNumFmtShell->GetUpdateData( pDelArr, nDelCount ); - pNumItem->SetDelFormatArray( pDelArr, nDelCount ); - - if(bNumItemFlag==sal_True) - { - rCoreAttrs.Put( *pNumItem ); - } - else - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - - if ( pDocSh ) - pDocSh->PutItem( *pNumItem ); - } - delete [] pDelArr; - } - - //--------------------------------------------------------------- - // Whether source format is to be taken or not: - // -------------------------------------------- - if ( aCbSourceFormat.IsEnabled() ) - { - sal_uInt16 _nWhich = GetWhich( SID_ATTR_NUMBERFORMAT_SOURCE ); - SfxItemState _eItemState = rMyItemSet.GetItemState( _nWhich, sal_False ); - const SfxBoolItem* pBoolItem = (const SfxBoolItem*) - GetItem( rMyItemSet, SID_ATTR_NUMBERFORMAT_SOURCE ); - sal_Bool bOld = (pBoolItem ? pBoolItem->GetValue() : sal_False); - rCoreAttrs.Put( SfxBoolItem( _nWhich, aCbSourceFormat.IsChecked() ) ); - if ( !bDataChanged ) - bDataChanged = (bOld != (sal_Bool) aCbSourceFormat.IsChecked() || - _eItemState != SFX_ITEM_SET); - } - - // FillItemSet is only called on OK, here we can notify the - // NumberFormatShell that all new user defined formats are valid. - pNumFmtShell->ValidateNewEntries(); - if(aLbLanguage.IsVisible() && - LISTBOX_ENTRY_NOTFOUND != aLbLanguage.GetEntryPos(sAutomaticEntry)) - rCoreAttrs.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, - aLbLanguage.GetSelectEntry() == sAutomaticEntry)); - } - - return bDataChanged; -} - - -int SvxNumberFormatTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -void SvxNumberFormatTabPage::SetInfoItem( const SvxNumberInfoItem& rItem ) -{ - if(pNumItem==NULL) - { - pNumItem = (SvxNumberInfoItem*)rItem.Clone(); - } -} - -void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries ) -{ - String* pEntry; - String aTmpString; - String aTmpCatString; - Font aFont=aLbCategory.GetFont(); - sal_uInt16 i = 0; - short nTmpCatPos; - short aPrivCat; - - aLbFormat.Clear(); - aLbFormat.SetUpdateMode( sal_False ); - - sal_uInt16 nCount = rEntries.Count(); - - if(nCount<1) return; - - if(bOneAreaFlag) - { - nTmpCatPos=nFixedCategory; - } - else - { - nTmpCatPos=aLbCategory.GetSelectEntryPos(); - } - - switch (nTmpCatPos) - { - case CAT_ALL: - case CAT_TEXT: - case CAT_NUMBER: i=1; - pEntry=rEntries[0]; - if(pEntry!=NULL) - { - if (nTmpCatPos == CAT_TEXT) - aTmpString=*pEntry; - else - aTmpString = pNumFmtShell->GetStandardName(); - aPrivCat=pNumFmtShell->GetCategory4Entry(0); - aLbFormat.InsertFontEntry( aTmpString, aFont ); - } - break; - - default: break; - } - - if(pNumFmtShell!=NULL) - { - for ( ; i < nCount; ++i ) - { - pEntry = rEntries[i]; - aPrivCat=pNumFmtShell->GetCategory4Entry(i); - if(aPrivCat!=CAT_TEXT) - { - Color* pPreviewColor = NULL; - String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) ); - Font aEntryFont( aLbFormat.GetFont() ); - aLbFormat.InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor ); - } - else - { - aLbFormat.InsertFontEntry(*pEntry,aFont); - } - } - } - aLbFormat.SetUpdateMode( sal_True ); - DeleteEntryList_Impl(rEntries); -} - - -/************************************************************************* -#* Methode: DeleteEntryList_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Loescht eine SvStrings- Liste -#* Input: String-liste -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberFormatTabPage::DeleteEntryList_Impl( SvxDelStrgs& rEntries ) -{ - sal_uInt16 nCount = rEntries.Count(); - rEntries.DeleteAndDestroy(0,nCount); -} - - -/************************************************************************* -#* Methode: UpdateOptions_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Stellt je nach eingestelltem Format die Options- -#* attribute neu ein. -#* Input: Flag, ob sich die Kategorie geaendert hat. -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberFormatTabPage::UpdateOptions_Impl( sal_Bool bCheckCatChange /*= sal_False*/ ) -{ - SvxDelStrgs aEntryList; - String theFormat = aEdFormat.GetText(); - sal_uInt16 nCurCategory = aLbCategory.GetSelectEntryPos(); - sal_uInt16 nCategory = nCurCategory; - sal_uInt16 nDecimals = 0; - sal_uInt16 nZeroes = 0; - sal_Bool bNegRed = sal_False; - sal_Bool bThousand = sal_False; - sal_uInt16 nCurrencyPos =aLbCurrency.GetSelectEntryPos(); - - if(bOneAreaFlag) - nCurCategory=nFixedCategory; - - - pNumFmtShell->GetOptions( theFormat, - bThousand, bNegRed, - nDecimals, nZeroes, - nCategory ); - sal_Bool bDoIt=sal_False; - if(nCategory==CAT_CURRENCY) - { - sal_uInt16 nTstPos=pNumFmtShell->FindCurrencyFormat(theFormat); - if(nCurrencyPos!=nTstPos && nTstPos!=(sal_uInt16)-1) - { - aLbCurrency.SelectEntryPos(nTstPos); - pNumFmtShell->SetCurrencySymbol(nTstPos); - bDoIt=sal_True; - } - } - - - - if ( nCategory != nCurCategory || bDoIt) - { - if ( bCheckCatChange ) - { - if(bOneAreaFlag) - SetCategory(0); - else - SetCategory(nCategory ); - - UpdateFormatListBox_Impl( sal_True, sal_False ); - } - } - else if ( aLbFormat.GetEntryCount() > 0 ) - { - sal_uInt32 nCurEntryKey=NUMKEY_UNDEFINED; - if(!pNumFmtShell->FindEntry( aEdFormat.GetText(),&nCurEntryKey)) - { - aLbFormat.SetNoSelection(); - } - } - if(bOneAreaFlag) - { - nCategory=nFixedCategory; - } - - switch ( nCategory ) - { - case CAT_NUMBER: - case CAT_PERCENT: - case CAT_CURRENCY: - aFlOptions.Enable(); - aFtDecimals.Enable(); - aEdDecimals.Enable(); - aFtLeadZeroes.Enable(); - aEdLeadZeroes.Enable(); - aBtnNegRed.Enable(); - aBtnThousand.Enable(); - aEdDecimals .SetText( UniString::CreateFromInt32( nDecimals ) ); - aEdLeadZeroes.SetText( UniString::CreateFromInt32( nZeroes ) ); - aBtnNegRed .Check( bNegRed ); - aBtnThousand .Check( bThousand ); - break; - - case CAT_ALL: - case CAT_USERDEFINED: - case CAT_TEXT: - case CAT_DATE: - case CAT_TIME: - case CAT_BOOLEAN: - case CAT_SCIENTIFIC: - case CAT_FRACTION: - default: - aFlOptions .Disable(); - aFtDecimals .Disable(); - aEdDecimals .Disable(); - aFtLeadZeroes .Disable(); - aEdLeadZeroes .Disable(); - aBtnNegRed .Disable(); - aBtnThousand .Disable(); - aEdDecimals .SetText( UniString::CreateFromInt32( 0 ) ); - aEdLeadZeroes .SetText( UniString::CreateFromInt32( 0 ) ); - aBtnNegRed .Check( sal_False ); - aBtnThousand .Check( sal_False ); - } -} - - -/************************************************************************* -#* Methode: UpdateFormatListBox_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Aktualisiert die Format- Listbox und zusaetzlich -#* wird abhaengig vom bUpdateEdit- Flag der String -#* in der Editbox geaendert. -#* Input: Flags fuer Kategorie und Editbox -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberFormatTabPage::UpdateFormatListBox_Impl - ( - sal_uInt16 bCat, // Category oder Land/Sprache ListBox? - sal_Bool bUpdateEdit // Format-Edit aktualisieren? - ) -{ - SvxDelStrgs aEntryList; - short nFmtLbSelPos = 0; - short nTmpCatPos; - - if(bOneAreaFlag) - { - nTmpCatPos=nFixedCategory; - } - else - { - nTmpCatPos=aLbCategory.GetSelectEntryPos(); - } - - - if ( bCat ) - { - Point aPos=aLbFormat.GetPosPixel(); - Size aSize=aLbFormat.GetSizePixel(); - - if(nTmpCatPos!=CAT_CURRENCY) - { - aPos.Y()=nStdFormatY; - aSize.Height()=nStdFormatHeight; - aLbFormat.SetPosSizePixel(aPos,aSize); -#if ENABLE_LAYOUT - aLbCurrency.Disable(); -#else /* !ENABLE_LAYOUT */ - aLbCurrency.Hide(); -#endif /* !ENABLE_LAYOUT */ - } - else - { - aPos.Y()=nCurFormatY; - aSize.Height()=nCurFormatHeight; - aLbFormat.SetPosSizePixel(aPos,aSize); -#if ENABLE_LAYOUT - aLbCurrency.Enable(); -#else /* !ENABLE_LAYOUT */ - aLbCurrency.Show(); -#endif /* !ENABLE_LAYOUT */ - } - - pNumFmtShell->CategoryChanged( nTmpCatPos,nFmtLbSelPos, aEntryList ); - } - else - pNumFmtShell->LanguageChanged( aLbLanguage.GetSelectLanguage(), - nFmtLbSelPos,aEntryList ); - - REMOVE_DONTKNOW() // ggF. UI-Enable - - - if ( (aEntryList.Count() > 0) && (nFmtLbSelPos != SELPOS_NONE) ) - { - if(bUpdateEdit) - { - String aFormat=*aEntryList[nFmtLbSelPos]; - aEdFormat.SetText(aFormat); - aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); - } - - if(!bOneAreaFlag || !bCat) - { - FillFormatListBox_Impl( aEntryList ); - aLbFormat.SelectEntryPos( nFmtLbSelPos ); - - aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); - if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) - { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) - { - aFtComment.SetText(aLbCategory.GetEntry(1)); - } - } - ChangePreviewText( (sal_uInt16)nFmtLbSelPos ); - } - - } - else - { - FillFormatListBox_Impl( aEntryList ); - if(nFmtLbSelPos != SELPOS_NONE) - { - aLbFormat.SelectEntryPos( (sal_uInt16)nFmtLbSelPos ); - - aFtComment.SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); - if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) - { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) - { - aFtComment.SetText(aLbCategory.GetEntry(1)); - } - } - } - else - { - aLbFormat.SetNoSelection(); - } - - if ( bUpdateEdit ) - { - aEdFormat.SetText( String() ); - aWndPreview.NotifyChange( String() ); - } - } -} - - -/************************************************************************* -#* Handle: DoubleClickHdl_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Bei einem Doppelklick in die Format- Listbox -#* wird der Wert uebernommen und der OK-Button -#* ausgeloest -#* Input: Pointer auf Listbox -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( SvxNumberFormatTabPage, DoubleClickHdl_Impl, SvxFontListBox*, pLb ) -{ - if ( pLb == &aLbFormat ) - { - SelFormatHdl_Impl( pLb ); - - if ( fnOkHdl.IsSet() ) - { // Uebergangsloesung, sollte von SfxTabPage angeboten werden - fnOkHdl.Call( NULL ); - } - else - { - SfxSingleTabDialog* pParent = dynamic_cast< SfxSingleTabDialog* >( GetParent() ); - OKButton* pOKButton = pParent ? pParent->GetOKButton() : NULL; - if ( pOKButton ) - pOKButton->Click(); - } - } - return 0; -} - - -/************************************************************************* -#* Methode: SelFormatHdl_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Wird aufgerufen, wenn sich die Sprache, die Kategorie -#* oder das Format aendert. Dem entsprechend werden die -#* Einstellungen geaendert. -#* Input: Pointer auf Listbox -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb ) -{ - if ( (CheckBox*)pLb == &aCbSourceFormat ) - { - EnableBySourceFormat_Impl(); // enable/disable everything else - if ( aCbSourceFormat.IsChecked() ) - return 0; // just disabled everything else - - // Reinit options enable/disable for current selection. - -#if ENABLE_LAYOUT - if (aLbFormat.GetSelectEntryPos () == LISTBOX_ENTRY_NOTFOUND) -#else /* !ENABLE_LAYOUT */ - // Current category may be UserDefined with no format entries defined. - // And yes, aLbFormat is a SvxFontListBox with sal_uLong list positions, - // implementation returns a LIST_APPEND if empty, comparison with - // sal_uInt16 LISTBOX_ENTRY_NOTFOUND wouldn't match. - if ( aLbFormat.GetSelectEntryPos() == LIST_APPEND ) -#endif /* !ENABLE_LAYOUT */ - pLb = &aLbCategory; // continue with the current category selected - else - pLb = &aLbFormat; // continue with the current format selected - } - - short nTmpCatPos; - - if(bOneAreaFlag) - { - nTmpCatPos=nFixedCategory; - } - else - { - nTmpCatPos=aLbCategory.GetSelectEntryPos(); - } - - sal_uInt16 nCurrencyPos=LISTBOX_ENTRY_NOTFOUND ; - - if(nTmpCatPos==CAT_CURRENCY && (ListBox *)pLb == &aLbCurrency ) - { - nCurrencyPos=aLbCurrency.GetSelectEntryPos(); - pNumFmtShell->SetCurrencySymbol(nCurrencyPos); - } - - //-------------------------------------------------------------------- - // Format-ListBox ---------------------------------------------------- - if ( (SvxFontListBox *)pLb == &aLbFormat ) - { - sal_uInt16 nSelPos = (sal_uInt16) aLbFormat.GetSelectEntryPos(); - String aFormat = aLbFormat.GetSelectEntry(); - String aComment; - SvxDelStrgs aEntryList; - - short nFmtLbSelPos = nSelPos; - - aFormat=pNumFmtShell->GetFormat4Entry(nSelPos); - aComment=pNumFmtShell->GetComment4Entry(nSelPos); - if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) - { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) - { - aComment=aLbCategory.GetEntry(1); - } - } - - if ( aFormat.Len() > 0 ) - { - if(!aEdFormat.HasFocus()) aEdFormat.SetText( aFormat ); - aFtComment.SetText(aComment); - ChangePreviewText( nSelPos ); - } - - REMOVE_DONTKNOW() // ggF. UI-Enable - - if ( pNumFmtShell->FindEntry( aFormat) ) - { - aIbAdd.Enable(sal_False ); - sal_Bool bIsUserDef=pNumFmtShell->IsUserDefined( aFormat ); - aIbRemove.Enable(bIsUserDef); - aIbInfo.Enable(bIsUserDef); - - } - else - { - aIbAdd.Enable(sal_True ); - aIbInfo.Enable(sal_True ); - aIbRemove.Enable(sal_False ); - aFtComment.SetText(aEdComment.GetText()); - - } - UpdateOptions_Impl( sal_False ); - - return 0; - } - - //-------------------------------------------------------------------- - // Kategorie-ListBox ------------------------------------------------- - if ( pLb == &aLbCategory || pLb == &aLbCurrency) - { - UpdateFormatListBox_Impl( sal_True, sal_True ); - EditHdl_Impl( NULL ); - UpdateOptions_Impl( sal_False ); - - return 0; - } - - //-------------------------------------------------------------------- - // Sprache/Land-ListBox ---------------------------------------------- - if ( pLb == &aLbLanguage ) - { - UpdateFormatListBox_Impl( sal_False, sal_True ); - EditHdl_Impl( &aEdFormat ); - - return 0; - } - return 0; -} - - -/************************************************************************* -#* Methode: ClickHdl_Impl, ImageButton* pIB -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Wenn, der Hinzufuegen- oder Entfernen- Button -#* wird diese Funktion aufgerufen und die Zahlenformat- -#* Liste den entsprechend geaendert. -#* Input: Toolbox- Button -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB) -{ - sal_Bool bAdded = sal_False; - sal_Bool bDeleted = sal_False; - sal_uLong nReturn = 0; - const sal_uLong nReturnChanged = 0x1; // THE boolean return value - const sal_uLong nReturnAdded = 0x2; // temp: format added - const sal_uLong nReturnOneArea = 0x4; // temp: one area but category changed => ignored - - if(pIB==&aIbAdd) - { // Also called from FillItemSet() if a temporary currency format has - // to be added, not only if the Add button is enabled. - String aFormat = aEdFormat.GetText(); - SvxDelStrgs aEntryList; - SvxDelStrgs a2EntryList; - sal_uInt16 nCatLbSelPos = 0; - short nFmtLbSelPos = SELPOS_NONE; - xub_StrLen nErrPos=0; - - pNumFmtShell->SetCurCurrencyEntry(NULL); - bAdded = pNumFmtShell->AddFormat( aFormat, nErrPos, - nCatLbSelPos, nFmtLbSelPos, - aEntryList); - if ( bAdded ) - nReturn |= nReturnChanged | nReturnAdded; - - if(pLastActivWindow== (Window *) &aEdComment) - { - aEdFormat.GrabFocus(); - aEdComment.Hide(); - aFtComment.Show(); - aFtComment.SetText(aEdComment.GetText()); - } - - if ( !nErrPos ) // Syntax ok? - { - // May be sorted under a different locale if LCID was parsed. - if (bAdded) - aLbLanguage.SelectLanguage( pNumFmtShell->GetCurLanguage() ); - - if(nCatLbSelPos==CAT_CURRENCY) - { - aLbCurrency.SelectEntryPos((sal_uInt16)pNumFmtShell->GetCurrencySymbol()); - } - - if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos)) - { - if(bAdded) DeleteEntryList_Impl(aEntryList); - bDeleted = pNumFmtShell->RemoveFormat( aFormat, - nCatLbSelPos, - nFmtLbSelPos, - a2EntryList); - if(bDeleted) DeleteEntryList_Impl(a2EntryList); - aEdFormat.GrabFocus(); - aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); - nReturn |= nReturnOneArea; - } - else - { - if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) ) - { - // Alles klar - if(bOneAreaFlag) //@@ ??? - SetCategory(0); - else - SetCategory(nCatLbSelPos ); - - FillFormatListBox_Impl( aEntryList ); - if(aEdComment.GetText()!=aLbCategory.GetEntry(1)) - { - pNumFmtShell->SetComment4Entry(nFmtLbSelPos, - aEdComment.GetText()); - } - else - { - pNumFmtShell->SetComment4Entry(nFmtLbSelPos, - String()); - } - aLbFormat.SelectEntryPos( (sal_uInt16)nFmtLbSelPos ); - aEdFormat.SetText( aFormat ); - - aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert - //holen - ChangePreviewText( (sal_uInt16)nFmtLbSelPos ); - } - } - } - else // Syntaxfehler - { - aEdFormat.GrabFocus(); - aEdFormat.SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); - } - EditHdl_Impl( &aEdFormat ); - nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged)); - } - else if(pIB==&aIbRemove) - { - String aFormat = aEdFormat.GetText(); - SvxDelStrgs aEntryList; - sal_uInt16 nCatLbSelPos = 0; - short nFmtLbSelPos = SELPOS_NONE; - - bDeleted = pNumFmtShell->RemoveFormat( aFormat, - nCatLbSelPos, - nFmtLbSelPos, - aEntryList ); - - aEdComment.SetText(aLbCategory.GetEntry(1)); - if ( bDeleted ) - { - if(nFmtLbSelPos>=0 && nFmtLbSelPosFindEntry( aFormat, &nCurKey ) ) - { - aIbAdd.Enable(sal_False ); - sal_Bool bUserDef=pNumFmtShell->IsUserDefined( aFormat ); - - aIbRemove.Enable(bUserDef); - aIbInfo.Enable(bUserDef); - - if(bUserDef) - { - sal_uInt16 nTmpCurPos=pNumFmtShell->FindCurrencyFormat(aFormat ); - - if(nTmpCurPos!=(sal_uInt16)-1) - aLbCurrency.SelectEntryPos(nTmpCurPos); - } - short nPosi=pNumFmtShell->GetListPos4Entry(aFormat); - if(nPosi>=0) - aLbFormat.SelectEntryPos( (sal_uInt16)nPosi); - - } - else - { - - aIbAdd.Enable(sal_True ); - aIbInfo.Enable(sal_True); - aIbRemove.Enable(sal_False ); - - aFtComment.SetText(aEdComment.GetText()); - - } - } - - if ( pEdFormat ) - { - pNumFmtShell->SetCurNumFmtKey( nCurKey ); - UpdateOptions_Impl( sal_True ); - } - - return 0; -} - - -/************************************************************************* -#* Methode: NotifyChange -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. -#* Input: Options- Controls -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl ) -{ - if ( ((NumericField*)pOptCtrl == &aEdLeadZeroes) - || ((NumericField*)pOptCtrl == &aEdDecimals) - || ((CheckBox*) pOptCtrl == &aBtnNegRed) - || ((CheckBox*) pOptCtrl == &aBtnThousand) ) - { - String aFormat; - sal_Bool bThousand = aBtnThousand.IsEnabled() - && aBtnThousand.IsChecked(); - sal_Bool bNegRed = aBtnNegRed.IsEnabled() - && aBtnNegRed.IsChecked(); - sal_uInt16 nPrecision = (aEdDecimals.IsEnabled()) - ? (sal_uInt16)aEdDecimals.GetValue() - : (sal_uInt16)0; - sal_uInt16 nLeadZeroes = (aEdLeadZeroes.IsEnabled()) - ? (sal_uInt16)aEdLeadZeroes.GetValue() - : (sal_uInt16)0; - - pNumFmtShell->MakeFormat( aFormat, - bThousand, bNegRed, - nPrecision, nLeadZeroes, - (sal_uInt16)aLbFormat.GetSelectEntryPos() ); - - aEdFormat.SetText( aFormat ); - MakePreviewText( aFormat ); - - if ( pNumFmtShell->FindEntry( aFormat ) ) - { - aIbAdd.Enable(sal_False ); - sal_Bool bUserDef=pNumFmtShell->IsUserDefined( aFormat ); - aIbRemove.Enable(bUserDef); - aIbInfo.Enable(bUserDef); - EditHdl_Impl( &aEdFormat); - - } - else - { - EditHdl_Impl( NULL ); - aLbFormat.SetNoSelection(); - } - } - return 0; -} - -IMPL_LINK( SvxNumberFormatTabPage, TimeHdl_Impl, Timer*, EMPTYARG) -{ - pLastActivWindow=NULL; - return 0; -} - - -/************************************************************************* -#* Methode: LostFocusHdl_Impl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. -#* Input: Options- Controls -#* Output: --- -#* -#************************************************************************/ - -IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Edit *, pEd) -{ - if (pEd==&aEdComment) - { - aResetWinTimer.Start(); - aFtComment.SetText(aEdComment.GetText()); - aEdComment.Hide(); - aFtComment.Show(); - if(!aIbAdd.IsEnabled()) - { - sal_uInt16 nSelPos = (sal_uInt16) aLbFormat.GetSelectEntryPos(); - pNumFmtShell->SetComment4Entry(nSelPos, - aEdComment.GetText()); - aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert - //holen - } - } - return 0; -} - -/************************************************************************* -#* Methode: NotifyChange -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Fuehrt Aenderungen in den Zahlen- Attributen durch. -#* Input: Options- Controls -#* Output: --- -#* -#************************************************************************/ - -String SvxNumberFormatTabPage::GetExpColorString( - Color*& rpPreviewColor, const String& rFormatStr, short nTmpCatPos) -{ - double nVal = 0; - switch (nTmpCatPos) - { - case CAT_CURRENCY: nVal=SVX_NUMVAL_CURRENCY; break; - - case CAT_SCIENTIFIC: - case CAT_FRACTION: - case CAT_NUMBER: nVal=SVX_NUMVAL_STANDARD; break; - - case CAT_PERCENT: nVal=SVX_NUMVAL_PERCENT; break; - - case CAT_ALL: nVal=SVX_NUMVAL_STANDARD; break; - - case CAT_TIME: nVal=SVX_NUMVAL_TIME; break; - case CAT_DATE: nVal=SVX_NUMVAL_DATE; break; - - case CAT_BOOLEAN: nVal=SVX_NUMVAL_BOOLEAN; break; - - case CAT_USERDEFINED: - case CAT_TEXT: - default: nVal=0;break; - } - - String aPreviewString; - pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal ); - return aPreviewString; -} - -void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat ) -{ - String aPreviewString; - Color* pPreviewColor = NULL; - pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor ); - aWndPreview.NotifyChange( aPreviewString, pPreviewColor ); -} - -void SvxNumberFormatTabPage::ChangePreviewText( sal_uInt16 nPos ) -{ - String aPreviewString; - Color* pPreviewColor = NULL; - pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor ); - aWndPreview.NotifyChange( aPreviewString, pPreviewColor ); -} - -long SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt ) -{ - if(rNEvt.GetType()==EVENT_LOSEFOCUS) - { - if ( rNEvt.GetWindow() == dynamic_cast< Window* >( &aEdComment ) && !aEdComment.IsVisible() ) - { - pLastActivWindow = NULL; - } - else - { - pLastActivWindow = rNEvt.GetWindow(); - } - } - - return SfxTabPage::PreNotify( rNEvt ); -} -/************************************************************************* -#* Methode: SetOkHdl -#*------------------------------------------------------------------------ -#* -#* Klasse: SvxNumberFormatTabPage -#* Funktion: Setzt den OkHandler neu. -#* Input: Neuer OkHandler -#* Output: --- -#* -#************************************************************************/ - -void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler ) -{ - fnOkHdl = rOkHandler; -} - -void SvxNumberFormatTabPage::FillCurrencyBox() -{ - SvStringsDtor aList; - NfShCurrencyEntries rEntries; - XubString* pEntry = NULL; - sal_uInt16 nSelPos=0; - - pNumFmtShell->GetCurrencySymbols( aList, &nSelPos); - - for(sal_uInt16 i=1;iGetValue()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/numfmt.hrc b/cui/source/tabpages/numfmt.hrc deleted file mode 100644 index 907b25656..000000000 --- a/cui/source/tabpages/numfmt.hrc +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_NUMFMT_HRC -#define _SVX_NUMFMT_HRC - -// defines ------------------------------------------------------------------ - -//================================================ -// Zahlen-TabPage: -#define WND_NUMBER_PREVIEW 2 -#define FT_CATEGORY 3 -#define FT_FORMAT 4 -#define FT_OPTIONS 5 -#define FT_EDFORMAT 6 -#define LB_CATEGORY 9 -#define LB_FORMAT 10 -#define FL_OPTIONS 11 -#define FT_LANGUAGE 12 -#define LB_LANGUAGE 13 -#define ED_FORMAT 14 -#define BTN_ADD 15 -#define BTN_REMOVE 16 -#define BMP_CHECK 17 -#define BMP_DCHECK 18 -#define BMP_CROSS 19 -#define BMP_DCROSS 20 -#define FT_DECIMALS 21 -#define ED_DECIMALS 22 -#define FT_LEADZEROES 23 -#define ED_LEADZEROES 24 -#define BTN_NEGRED 25 -#define BTN_THOUSAND 26 -#define FT_COMMENT 27 -#define ED_COMMENT 28 -#define IB_ADD 29 -#define IB_REMOVE 30 -#define IB_INFO 31 -#define IL_ICON 32 -#define LB_CURRENCY 33 -#define CB_SOURCEFORMAT 34 -#define STR_AUTO_ENTRY 36 - -#define TBX_ADDREMOVE 1 -#define IID_ADD 1 -#define IID_REMOVE 2 -#define IID_INFO 3 - -#endif - diff --git a/cui/source/tabpages/numfmt.src b/cui/source/tabpages/numfmt.src deleted file mode 100644 index 867f93c7e..000000000 --- a/cui/source/tabpages/numfmt.src +++ /dev/null @@ -1,291 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include "numfmt.hrc" -#include - - // RID_SVXPAGE_NUMBERFORMAT ---------------------------------------------- -TabPage RID_SVXPAGE_NUMBERFORMAT -{ - HelpId = HID_NUMBERFORMAT ; - Hide = TRUE ; - Text [ en-US ] = "Number Format" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedText FT_CATEGORY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Category" ; - }; - ListBox LB_CATEGORY - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CATEGORY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 14 ) ; - Size = MAP_APPFONT ( 70 , 71 ) ; - AutoHScroll = TRUE ; - StringList [ en-US ] = - { - < "All" ; Default ; > ; - < "User-defined" ; Default ; > ; - < "Number" ; Default ; > ; - < "Percent" ; Default ; > ; - < "Currency" ; Default ; > ; - < "Date" ; Default ; > ; - < "Time" ; Default ; > ; - < "Scientific" ; Default ; > ; - < "Fraction" ; Default ; > ; - < "Boolean Value" ; Default ; > ; - < "Text" ; Default ; > ; - }; - }; - FixedText FT_EDFORMAT - { - Pos = MAP_APPFONT ( 6 , 136 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "~Format code" ; - }; - Edit ED_FORMAT - { - HelpID = "cui:Edit:RID_SVXPAGE_NUMBERFORMAT:ED_FORMAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 147 ) ; - Size = MAP_APPFONT ( 200 , 12 ) ; - }; - FixedText FT_COMMENT - { - Pos = MAP_APPFONT ( 6 , 163 ) ; - Size = MAP_APPFONT ( 248 , 16 ) ; - WordBreak = TRUE ; - NoLabel = TRUE ; - }; - Edit ED_COMMENT - { - HelpID = "cui:Edit:RID_SVXPAGE_NUMBERFORMAT:ED_COMMENT"; - Hide = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 163 ) ; - Size = MAP_APPFONT ( 248 , 12 ) ; - }; - FixedText FT_FORMAT - { - Pos = MAP_APPFONT ( 82 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "F~ormat" ; - }; - - ListBox LB_CURRENCY - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_CURRENCY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 14 ) ; - Size = MAP_APPFONT ( 90 , 71 ) ; - DropDown = TRUE ; - TabStop = TRUE ; - StringList [ en-US ] = - { - < "Automatically" ; Default ; > ; - }; - }; - - Control LB_FORMAT - { - HelpId = HID_NUMBERFORMAT_LB_FORMAT ; - Border = TRUE ; - Pos = MAP_APPFONT ( 82 , 27 ) ; - Size = MAP_APPFONT ( 90 , 58 ) ; - TabStop = TRUE ; - }; - - FixedText FT_DECIMALS - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 69 , 8 ) ; - Text [ en-US ] = "~Decimal places" ; - }; - NumericField ED_DECIMALS - { - HelpID = "cui:NumericField:RID_SVXPAGE_NUMBERFORMAT:ED_DECIMALS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 84 , 102 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Spin = TRUE ; - Maximum = 20 ; - Last = 15 ; - First = 0 ; - StrictFormat = TRUE ; - SpinSize = 1 ; - Repeat = TRUE ; - }; - FixedText FT_LEADZEROES - { - Pos = MAP_APPFONT ( 12 , 120 ) ; - Size = MAP_APPFONT ( 69 , 8 ) ; - Text [ en-US ] = "Leading ~zeroes" ; - }; - NumericField ED_LEADZEROES - { - HelpID = "cui:NumericField:RID_SVXPAGE_NUMBERFORMAT:ED_LEADZEROES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 84 , 118 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Spin = TRUE ; - Maximum = 20 ; - Last = 15 ; - First = 0 ; - StrictFormat = TRUE ; - SpinSize = 1 ; - Repeat = TRUE ; - }; - CheckBox BTN_NEGRED - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUMBERFORMAT:BTN_NEGRED"; - Pos = MAP_APPFONT ( 133 , 104 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Negative numbers red" ; - }; - CheckBox BTN_THOUSAND - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUMBERFORMAT:BTN_THOUSAND"; - Pos = MAP_APPFONT ( 133 , 120 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "~Thousands separator" ; - }; - FixedLine FL_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 91 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Options" ; - }; - FixedText FT_LANGUAGE - { - Pos = MAP_APPFONT ( 178 , 3 ) ; - Size = MAP_APPFONT ( 76 , 8 ) ; - Text [ en-US ] = "~Language" ; - }; - ListBox LB_LANGUAGE - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUMBERFORMAT:LB_LANGUAGE"; - Border = TRUE ; - Sort = TRUE ; - Pos = MAP_APPFONT ( 178 , 14 ) ; - Size = MAP_APPFONT ( 76 , 71 ) ; - DropDown = TRUE ; - }; - CheckBox CB_SOURCEFORMAT - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUMBERFORMAT:CB_SOURCEFORMAT"; - Pos = MAP_APPFONT ( 178 , 42 ) ; - Size = MAP_APPFONT ( 76 , 10 ) ; - Text [ en-US ] = "So~urce format" ; - }; - Window WND_NUMBER_PREVIEW - { - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 178 , 67 ) ; - Size = MAP_APPFONT ( 76 , 18 ) ; - HelpId = HID_NUMBERFORMAT_WND_NUMBER_PREVIEW ; - }; - ImageButton IB_ADD - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 208 , 146 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - HelpId = HID_NUMBERFORMAT_TBI_ADD ; - QuickHelpText [ en-US ] = "Add" ; - }; - ImageButton IB_REMOVE - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 240 , 146 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - HelpId = HID_NUMBERFORMAT_TBI_REMOVE ; - QuickHelpText [ en-US ] = "Remove" ; - }; - ImageButton IB_INFO - { - SVLook = TRUE ; - Pos = MAP_APPFONT ( 224 , 146 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - HelpId = HID_NUMBERFORMAT_TBI_INFO ; - QuickHelpText [ en-US ] = "Edit Comment" ; - }; - ImageList IL_ICON - { - Prefix = "nu"; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - IdList = - { - IID_ADD ; - IID_REMOVE ; - IID_INFO ; - }; - IdCount = { 3 ; }; - }; - - String STR_AUTO_ENTRY - { - Text [ en-US ] = "Automatic"; - }; - -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx deleted file mode 100644 index 21dbb6f88..000000000 --- a/cui/source/tabpages/numpages.cxx +++ /dev/null @@ -1,3606 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cuicharmap.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "sfx2/opengrf.hxx" - -#include -#include -#include -#include -#include - -using namespace com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::i18n; -using namespace com::sun::star::text; -using namespace com::sun::star::container; -using namespace com::sun::star::style; -using rtl::OUString; - -SV_IMPL_PTRARR(SvxNumSettingsArr_Impl,SvxNumSettings_ImplPtr); - -#define NUM_PAGETYPE_BULLET 0 -#define NUM_PAGETYPE_SINGLENUM 1 -#define NUM_PAGETYPE_NUM 2 -#define NUM_PAGETYPE_BMP 3 -#define PAGETYPE_USER_START 10 - -#define SHOW_NUMBERING 0 -#define SHOW_BULLET 1 -#define SHOW_BITMAP 2 - -#define MAX_BMP_WIDTH 16 -#define MAX_BMP_HEIGHT 16 - -static sal_Bool bLastRelative = sal_False; -static const sal_Char cNumberingType[] = "NumberingType"; -static const sal_Char cValue[] = "Value"; -static const sal_Char cParentNumbering[] = "ParentNumbering"; -static const sal_Char cPrefix[] = "Prefix"; -static const sal_Char cSuffix[] = "Suffix"; -static const sal_Char cBulletChar[] = "BulletChar"; -static const sal_Char cBulletFontName[] = "BulletFontName"; - -Reference lcl_GetNumberingProvider() -{ - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - Reference < XInterface > xI = xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.DefaultNumberingProvider" )) ); - Reference xRet(xI, UNO_QUERY); - DBG_ASSERT(xRet.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\""); - - return xRet; -} - -SvxNumSettings_ImplPtr lcl_CreateNumSettingsPtr(const Sequence& rLevelProps) -{ - const PropertyValue* pValues = rLevelProps.getConstArray(); - SvxNumSettings_ImplPtr pNew = new SvxNumSettings_Impl; - for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++) - { - if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType))) - pValues[j].Value >>= pNew->nNumberType; - else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix))) - pValues[j].Value >>= pNew->sPrefix; - else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix))) - pValues[j].Value >>= pNew->sSuffix; - else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering))) - pValues[j].Value >>= pNew->nParentNumbering; - else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar))) - pValues[j].Value >>= pNew->sBulletChar; - else if(pValues[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName))) - pValues[j].Value >>= pNew->sBulletFont; - } - return pNew; -} - -// Die Auswahl an Bullets aus den StarSymbol -static const sal_Unicode aBulletTypes[] = -{ - 0x2022, - 0x25cf, - 0xe00c, - 0xe00a, - 0x2794, - 0x27a2, - 0x2717, - 0x2714 -}; - -static sal_Char const aNumChar[] = -{ - 'A', //CHARS_UPPER_LETTER - 'a', //CHARS_LOWER_LETTER - 'I', //ROMAN_UPPER - 'i', //ROMAN_LOWER - '1', //ARABIC - ' ' -}; - -// Ist eins der maskierten Formate gesetzt? -sal_Bool lcl_IsNumFmtSet(SvxNumRule* pNum, sal_uInt16 nLevelMask) -{ - sal_Bool bRet = sal_False; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < SVX_MAX_NUM && !bRet; i++ ) - { - if(nLevelMask & nMask) - bRet |= 0 != pNum->Get( i ); - nMask <<= 1 ; - } - return bRet; -} - -Font& lcl_GetDefaultBulletFont() -{ - static sal_Bool bInit = 0; - static Font aDefBulletFont( UniString::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ), - String(), Size( 0, 14 ) ); - if(!bInit) - { - aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); - aDefBulletFont.SetFamily( FAMILY_DONTKNOW ); - aDefBulletFont.SetPitch( PITCH_DONTKNOW ); - aDefBulletFont.SetWeight( WEIGHT_DONTKNOW ); - aDefBulletFont.SetTransparent( sal_True ); - bInit = sal_True; - } - return aDefBulletFont; -} - - -/**************************************************************************/ -/* */ -/* */ -/**************************************************************************/ - - -SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_SINGLE_NUM ), rSet ), - aValuesFL( this, CUI_RES(FL_VALUES) ), - pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_SINGLENUM )), - pActNum(0), - pSaveNum(0), - nActNumLvl( USHRT_MAX ), - bModified(sal_False), - bPreset(sal_False), - nNumItemId(SID_ATTR_NUMBERING_RULE) -{ - FreeResource(); - SetExchangeSupport(); - pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl)); - pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl)); - pExamplesVS->SetHelpId(HID_VALUESET_SINGLENUM ); - - Reference xDefNum = lcl_GetNumberingProvider(); - if(xDefNum.is()) - { - Sequence< Sequence< PropertyValue > > aNumberings; - LanguageType eLang = Application::GetSettings().GetLanguage(); - Locale aLocale = SvxCreateLocale(eLang); - try - { - aNumberings = - xDefNum->getDefaultContinuousNumberingLevels( aLocale ); - - - sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength(); - - const Sequence* pValuesArr = aNumberings.getConstArray(); - for(sal_Int32 i = 0; i < nLength; i++) - { - SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]); - aNumSettingsArr.Insert(pNew, aNumSettingsArr.Count()); - } - } - catch(Exception&) - { - } - Reference xFormat(xDefNum, UNO_QUERY); - pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale); - } -} - - SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage() -{ - delete pActNum; - delete pExamplesVS; - delete pSaveNum; - aNumSettingsArr.DeleteAndDestroy(0, aNumSettingsArr.Count()); -} - -SfxTabPage* SvxSingleNumPickTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxSingleNumPickTabPage(pParent, rAttrSet); -} - -sal_Bool SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( (bPreset || bModified) && pSaveNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); - } - - return bModified; -} - -void SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - bPreset = sal_False; - sal_Bool bIsPreset = sal_False; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - if(*pSaveNum != *pActNum) - { - *pActNum = *pSaveNum; - pExamplesVS->SetNoSelection(); - } - // ersten Eintrag vorselektieren - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) - { - pExamplesVS->SelectItem(1); - NumSelectHdl_Impl(pExamplesVS); - bPreset = sal_True; - } - bPreset |= bIsPreset; - - bModified = sal_False; -} - -int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; -} - -IMPL_LINK(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) -{ - if(pActNum) - { - bPreset = sal_False; - bModified = sal_True; - sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1; - DBG_ASSERT(aNumSettingsArr.Count() > nIdx, "wrong index"); - if(aNumSettingsArr.Count() <= nIdx) - return 0; - SvxNumSettings_ImplPtr _pSet = aNumSettingsArr.GetObject(nIdx); - sal_Int16 eNewType = _pSet->nNumberType; - const sal_Unicode cLocalPrefix = _pSet->sPrefix.getLength() ? _pSet->sPrefix.getStr()[0] : 0; - const sal_Unicode cLocalSuffix = _pSet->sSuffix.getLength() ? _pSet->sSuffix.getStr()[0] : 0; - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aFmt(pActNum->GetLevel(i)); - aFmt.SetNumberingType(eNewType); - String aEmptyStr; - if(cLocalPrefix == ' ') - aFmt.SetPrefix( aEmptyStr ); - else - aFmt.SetPrefix(_pSet->sPrefix); - if(cLocalSuffix == ' ') - aFmt.SetSuffix( aEmptyStr ); - else - aFmt.SetSuffix(_pSet->sSuffix); - aFmt.SetCharFmtName(sNumCharFmtName); - // #62069# // #92724# - aFmt.SetBulletRelSize(100); - pActNum->SetLevel(i, aFmt); - } - nMask <<= 1 ; - } - } - return 0; -} - -IMPL_LINK(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) -{ - NumSelectHdl_Impl(pExamplesVS); - OKButton& rOk = GetTabDialog()->GetOKButton(); - rOk.GetClickHdl().Call(&rOk); - return 0; -} - - -SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BULLET ), rSet ), - aValuesFL( this, CUI_RES(FL_VALUES) ), - pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_BULLET )), - pActNum(0), - pSaveNum(0), - nActNumLvl( USHRT_MAX ), - bModified(sal_False), - bPreset(sal_False), - nNumItemId(SID_ATTR_NUMBERING_RULE) -{ - FreeResource(); - SetExchangeSupport(); - pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl)); - pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl)); - pExamplesVS->SetHelpId(HID_VALUESET_BULLET ); - -} - - SvxBulletPickTabPage::~SvxBulletPickTabPage() -{ - delete pActNum; - delete pExamplesVS; - delete pSaveNum; -} - -SfxTabPage* SvxBulletPickTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxBulletPickTabPage(pParent, rAttrSet); -} - -sal_Bool SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( (bPreset || bModified) && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); - } - return bModified; -} - -void SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - bPreset = sal_False; - sal_Bool bIsPreset = sal_False; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - if(*pSaveNum != *pActNum) - { - *pActNum = *pSaveNum; - pExamplesVS->SetNoSelection(); - } - // ersten Eintrag vorselektieren - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) - { - pExamplesVS->SelectItem(1); - NumSelectHdl_Impl(pExamplesVS); - bPreset = sal_True; - } - bPreset |= bIsPreset; - bModified = sal_False; -} - -int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; -} - -IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) -{ - if(pActNum) - { - bPreset = sal_False; - bModified = sal_True; - sal_Unicode cChar = aBulletTypes[pExamplesVS->GetSelectItemId() - 1]; - Font& rActBulletFont = lcl_GetDefaultBulletFont(); - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aFmt(pActNum->GetLevel(i)); - aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL ); - // #i93908# clear suffix for bullet lists - aFmt.SetPrefix(::rtl::OUString()); - aFmt.SetSuffix(::rtl::OUString()); - aFmt.SetBulletFont(&rActBulletFont); - aFmt.SetBulletChar(cChar ); - aFmt.SetCharFmtName(sBulletCharFmtName); - // #62069# // #92724# - aFmt.SetBulletRelSize(45); - pActNum->SetLevel(i, aFmt); - } - nMask <<= 1; - } - } - - return 0; -} - - -IMPL_LINK(SvxBulletPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) -{ - NumSelectHdl_Impl(pExamplesVS); - OKButton& rOk = GetTabDialog()->GetOKButton(); - rOk.GetClickHdl().Call(&rOk); - return 0; -} - - -void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet) -{ - - SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); - - if (pBulletCharFmt) - SetCharFmtName( pBulletCharFmt->GetValue()); - - -} - - -SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_NUM ), rSet ), - aValuesFL( this, CUI_RES(FL_VALUES) ), - pExamplesVS( new SvxNumValueSet(this, CUI_RES(VS_VALUES), NUM_PAGETYPE_NUM )), - pActNum(0), - pSaveNum(0), - nActNumLvl( USHRT_MAX ), - nNumItemId(SID_ATTR_NUMBERING_RULE), - bModified(sal_False), - bPreset(sal_False) -{ - - FreeResource(); - - SetExchangeSupport(); - - pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl)); - pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl)); - pExamplesVS->SetHelpId(HID_VALUESET_NUM ); - - Reference xDefNum = lcl_GetNumberingProvider(); - if(xDefNum.is()) - { - Sequence > aOutlineAccess; - LanguageType eLang = Application::GetSettings().GetLanguage(); - Locale aLocale = SvxCreateLocale(eLang); - try - { - aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale ); - - for(sal_Int32 nItem = 0; - nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT; - nItem++ ) - { - SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ]; - - Reference xLevel = aOutlineAccess.getConstArray()[nItem]; - for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++) - { - Any aValueAny = xLevel->getByIndex(nLevel); - Sequence aLevelProps; - aValueAny >>= aLevelProps; - SvxNumSettings_ImplPtr pNew = lcl_CreateNumSettingsPtr(aLevelProps); - rItemArr.Insert( pNew, rItemArr.Count() ); - } - } - } - catch(Exception&) - { - } - Reference xFormat(xDefNum, UNO_QUERY); - pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale); - } -} - - SvxNumPickTabPage::~SvxNumPickTabPage() -{ - delete pActNum; - delete pExamplesVS; - delete pSaveNum; -} - -SfxTabPage* SvxNumPickTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxNumPickTabPage(pParent, rAttrSet); -} - -sal_Bool SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( (bPreset || bModified) && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); - } - return bModified; -} - -void SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - bPreset = sal_False; - sal_Bool bIsPreset = sal_False; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - if(*pSaveNum != *pActNum) - { - *pActNum = *pSaveNum; - pExamplesVS->SetNoSelection(); - } - // ersten Eintrag vorselektieren - if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)) - { - pExamplesVS->SelectItem(1); - NumSelectHdl_Impl(pExamplesVS); - bPreset = sal_True; - } - bPreset |= bIsPreset; - bModified = sal_False; -} - -int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; - -} - -// Hier werden alle Ebenen veraendert -IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) -{ - if(pActNum) - { - bPreset = sal_False; - bModified = sal_True; - - const FontList* pList = 0; - - SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[pExamplesVS->GetSelectItemId() - 1]; - - Font& rActBulletFont = lcl_GetDefaultBulletFont(); - SvxNumSettings_ImplPtr pLevelSettings = 0; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(rItemArr.Count() > i) - pLevelSettings = rItemArr[i]; - if(!pLevelSettings) - break; - SvxNumberFormat aFmt(pActNum->GetLevel(i)); - aFmt.SetNumberingType( pLevelSettings->nNumberType ); - sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; - if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) - { - // #i93908# clear suffix for bullet lists - aFmt.SetPrefix(::rtl::OUString()); - aFmt.SetSuffix(::rtl::OUString()); - if( pLevelSettings->sBulletFont.getLength() && - pLevelSettings->sBulletFont.compareTo( - rActBulletFont.GetName())) - { - //search for the font - if(!pList) - { - SfxObjectShell* pCurDocShell = SfxObjectShell::Current(); - const SvxFontListItem* pFontListItem = - (const SvxFontListItem* )pCurDocShell - ->GetItem( SID_ATTR_CHAR_FONTLIST ); - pList = pFontListItem ? pFontListItem->GetFontList() : 0; - } - if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) ) - { - FontInfo aInfo = pList->Get( - pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE); - Font aFont(aInfo); - aFmt.SetBulletFont(&aFont); - } - else - { - //if it cannot be found then create a new one - Font aCreateFont( pLevelSettings->sBulletFont, - String(), Size( 0, 14 ) ); - aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW ); - aCreateFont.SetFamily( FAMILY_DONTKNOW ); - aCreateFont.SetPitch( PITCH_DONTKNOW ); - aCreateFont.SetWeight( WEIGHT_DONTKNOW ); - aCreateFont.SetTransparent( sal_True ); - aFmt.SetBulletFont( &aCreateFont ); - } - } - else - aFmt.SetBulletFont( &rActBulletFont ); - - aFmt.SetBulletChar( pLevelSettings->sBulletChar.getLength() - ? pLevelSettings->sBulletChar.getStr()[0] - : 0 ); - aFmt.SetCharFmtName( sBulletCharFmtName ); - // #62069# // #92724# - aFmt.SetBulletRelSize(45); - } - else - { - aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0)); - aFmt.SetCharFmtName(sNumCharFmtName); - // #62069# // #92724# - aFmt.SetBulletRelSize(100); - // #i93908# - aFmt.SetPrefix(pLevelSettings->sPrefix); - aFmt.SetSuffix(pLevelSettings->sSuffix); - } - pActNum->SetLevel(i, aFmt); - } - } - return 0; -} - -IMPL_LINK(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) -{ - NumSelectHdl_Impl(pExamplesVS); - OKButton& rOk = GetTabDialog()->GetOKButton(); - rOk.GetClickHdl().Call(&rOk); - return 0; -} - -void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); - SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); - - - if (pNumCharFmt &&pBulletCharFmt) - SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); -} - - -SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PICK_BMP ), rSet ), - aValuesFL( this, CUI_RES(FL_VALUES) ), - pExamplesVS( new SvxBmpNumValueSet(this, CUI_RES(VS_VALUES)/*, aGrfNames*/ )), - aErrorText( this, CUI_RES(FT_ERROR)), - aLinkedCB( this, CUI_RES(CB_LINKED)), - pActNum(0), - pSaveNum(0), - nActNumLvl( USHRT_MAX ), - nNumItemId(SID_ATTR_NUMBERING_RULE), - bModified(sal_False), - bPreset(sal_False) -{ - FreeResource(); - SetExchangeSupport(); - eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); - pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl)); - pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl)); - aLinkedCB.SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl)); - - // Grafiknamen ermitteln - GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); - pExamplesVS->SetHelpId(HID_VALUESET_NUMBMP ); - - sal_uInt16 i = 0; - for(std::vector::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i) - { - pExamplesVS->InsertItem( i + 1, i); - - INetURLObject aObj(*it); - if(aObj.GetProtocol() == INET_PROT_FILE) - *it = aObj.PathToFileName(); - - pExamplesVS->SetItemText( i + 1, *it ); - } - - if(aGrfNames.empty()) - { - aErrorText.Show(); - } - else - { - pExamplesVS->Show(); - pExamplesVS->Format(); - } - - pExamplesVS->SetAccessibleRelationMemberOf( &aValuesFL ); -} - -SvxBitmapPickTabPage::~SvxBitmapPickTabPage() -{ - delete pExamplesVS; - delete pActNum; - delete pSaveNum; -} - -SfxTabPage* SvxBitmapPickTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxBitmapPickTabPage(pParent, rAttrSet); -} - -void SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - bPreset = sal_False; - sal_Bool bIsPreset = sal_False; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bIsPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - if(*pSaveNum != *pActNum) - { - *pActNum = *pSaveNum; - pExamplesVS->SetNoSelection(); - } - // ersten Eintrag vorselektieren - if(!aGrfNames.empty() && - (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))) - { - pExamplesVS->SelectItem(1); - NumSelectHdl_Impl(pExamplesVS); - bPreset = sal_True; - } - bPreset |= bIsPreset; - bModified = sal_False; -} - -int SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -sal_Bool SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if ( aGrfNames.empty() ) - { - return sal_False; - } - if( (bPreset || bModified) && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset)); - } - - return bModified; -} - -void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; - if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) - { - aLinkedCB.Check(sal_False); - aLinkedCB.Enable(sal_False); - } - else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) - { - aLinkedCB.Check(sal_True); - aLinkedCB.Enable(sal_False); - } -} - -IMPL_LINK(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG) -{ - if(pActNum) - { - bPreset = sal_False; - bModified = sal_True; - sal_uInt16 nIdx = pExamplesVS->GetSelectItemId() - 1; - - sal_uInt16 nMask = 1; - String aEmptyStr; - sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP; - if(aLinkedCB.IsChecked()) - nSetNumberingType |= LINK_TOKEN; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aFmt(pActNum->GetLevel(i)); - aFmt.SetNumberingType(nSetNumberingType); - aFmt.SetPrefix( aEmptyStr ); - aFmt.SetSuffix( aEmptyStr ); - aFmt.SetCharFmtName( sNumCharFmtName ); - - Graphic aGraphic; - if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic)) - { - Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); - sal_Int16 eOrient = text::VertOrientation::LINE_CENTER; - aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit); - SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH ); - aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient ); - } - else if(aGrfNames.size() > nIdx) - aFmt.SetGraphic( aGrfNames[nIdx] ); - pActNum->SetLevel(i, aFmt); - } - nMask <<= 1 ; - } - } - - return 0; -} - -IMPL_LINK(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, EMPTYARG) -{ - NumSelectHdl_Impl(pExamplesVS); - OKButton& rOk = GetTabDialog()->GetOKButton(); - rOk.GetClickHdl().Call(&rOk); - return 0; -} - -IMPL_LINK(SvxBitmapPickTabPage, LinkBmpHdl_Impl, CheckBox*, EMPTYARG ) -{ - if(!pExamplesVS->IsNoSelection()) - { - NumSelectHdl_Impl(pExamplesVS); - } - return 0; -} - -// Tabpage Numerierungsoptionen -#define NUM_NO_GRAPHIC 1000 -SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUM_OPTIONS ), rSet ), - - aFormatFL( this, CUI_RES(FL_FORMAT )), - aLevelFT( this, CUI_RES(FT_LEVEL )), - aLevelLB( this, CUI_RES(LB_LEVEL )), - aFmtFT( this, CUI_RES(FT_FMT )), - aFmtLB( this, CUI_RES(LB_FMT )), - aPrefixFT( this, CUI_RES(FT_PREFIX )), - aPrefixED( this, CUI_RES(ED_PREFIX )), - aSuffixFT( this, CUI_RES(FT_SUFFIX )), - aSuffixED( this, CUI_RES(ED_SUFFIX )), - aCharFmtFT( this, CUI_RES(FT_CHARFMT )), - aCharFmtLB( this, CUI_RES(LB_CHARFMT )), - aBulColorFT( this, CUI_RES(FT_BUL_COLOR)), - aBulColLB( this, CUI_RES(LB_BUL_COLOR)), - aBulRelSizeFT( this, CUI_RES(FT_BUL_REL_SIZE)), - aBulRelSizeMF( this, CUI_RES(MF_BUL_REL_SIZE)), - aAllLevelFT( this, CUI_RES(FT_ALL_LEVEL)), - aAllLevelNF( this, CUI_RES(NF_ALL_LEVEL)), - aStartFT( this, CUI_RES(FT_START )), - aStartED( this, CUI_RES(ED_START )), - aBulletPB( this, CUI_RES(PB_BULLET )), - aAlignFT( this, CUI_RES(FT_ALIGN )), - aAlignLB( this, CUI_RES(LB_ALIGN )), - aBitmapFT( this, CUI_RES(FT_BITMAP )), - aBitmapMB( this, CUI_RES(MB_BITMAP )), - aSizeFT( this, CUI_RES(FT_SIZE )), - aWidthMF( this, CUI_RES(MF_WIDTH )), - aMultFT( this, CUI_RES(FT_MULT )), - aHeightMF( this, CUI_RES(MF_HEIGHT )), - aRatioCB( this, CUI_RES(CB_RATIO )), - aOrientFT( this, CUI_RES(FT_ORIENT )), - aOrientLB( this, CUI_RES(LB_ORIENT )), - aSameLevelFL( this, CUI_RES(FL_SAME_LEVEL)), - aSameLevelCB( this, CUI_RES(CB_SAME_LEVEL)), - pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))), - pActNum(0), - pSaveNum(0), - bLastWidthModified(sal_False), - bModified(sal_False), - bPreset(sal_False), - bAutomaticCharStyles(sal_True), - bHTMLMode(sal_False), - bMenuButtonInitialized(sal_False), - sBullet(CUI_RES(STR_BULLET)), - nBullet(0xff), - nActNumLvl(USHRT_MAX), - nNumItemId(SID_ATTR_NUMBERING_RULE) -{ - sStartWith = aStartFT.GetText(); - pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); - SetExchangeSupport(); - aActBulletFont = lcl_GetDefaultBulletFont(); - - aBulletPB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl)); - aFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl)); - aBitmapMB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl)); - aLevelLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl)); - aCharFmtLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl)); - aWidthMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl)); - aHeightMF.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl)); - aRatioCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl)); - aStartED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); - aPrefixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); - aSuffixED.SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); - aAllLevelNF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl)); - aOrientLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl)); - aSameLevelCB.SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl)); - aBulRelSizeMF.SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl)); - aBulColLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl)); - aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl)); - aInvalidateTimer.SetTimeout(50); - - aBitmapMB.GetPopupMenu()->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl)); - PopupMenu* pPopup = new PopupMenu; - aBitmapMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); - - pPopup->InsertItem( NUM_NO_GRAPHIC, String(CUI_RES(ST_POPUP_EMPTY_ENTRY)) ); - pPopup->EnableItem( NUM_NO_GRAPHIC, sal_False ); - - eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); - - aBitmapMB.SetAccessibleRelationLabeledBy( &aBitmapFT ); - - FreeResource(); - - //get advanced numbering types from the component - Reference xDefNum = lcl_GetNumberingProvider(); - Reference xInfo(xDefNum, UNO_QUERY); - - // Extended numbering schemes present in the resource but not offered by - // the i18n framework per configuration must be removed from the listbox. - // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that. - const sal_uInt16 nDontRemove = 0xffff; - ::std::vector< sal_uInt16> aRemove( aFmtLB.GetEntryCount(), nDontRemove); - for (size_t i=0; i(i)); - if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && - nEntryData != (SVX_NUM_BITMAP | 0x80)) - aRemove[i] = nEntryData; - } - if(xInfo.is()) - { - Sequence aTypes = xInfo->getSupportedNumberingTypes( ); - const sal_Int16* pTypes = aTypes.getConstArray(); - for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++) - { - sal_Int16 nCurrent = pTypes[nType]; - if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N) - { - sal_Bool bInsert = sal_True; - for(sal_uInt16 nEntry = 0; nEntry < aFmtLB.GetEntryCount(); nEntry++) - { - sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(nEntry); - if(nEntryData == (sal_uInt16) nCurrent) - { - bInsert = sal_False; - aRemove[nEntry] = nDontRemove; - break; - } - } - if(bInsert) - { - OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); - sal_uInt16 nPos = aFmtLB.InsertEntry(aIdent); - aFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent); - } - } - } - } - for (size_t i=0; iGetPopupMenu( MN_GALLERY ); - delete pActNum; - delete pPreviewWIN; - delete pSaveNum; -} - -void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric) -{ - if(eMetric == FUNIT_MM) - { - aWidthMF .SetDecimalDigits(1); - aHeightMF .SetDecimalDigits(1); - } - aWidthMF .SetUnit( eMetric ); - aHeightMF .SetUnit( eMetric ); -} - -SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxNumOptionsTabPage(pParent, rAttrSet); -}; - -void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - sal_uInt16 nTmpNumLvl = USHRT_MAX; - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - // - bModified = (!pActNum->Get( 0 ) || bPreset); - if(*pActNum != *pSaveNum || - nActNumLvl != nTmpNumLvl) - { - nActNumLvl = nTmpNumLvl; - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); - if(nActNumLvl != USHRT_MAX) - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1 ; - } - aLevelLB.SetUpdateMode(sal_True); - *pActNum = *pSaveNum; - InitControls(); - } - -} - -int SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -sal_Bool SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) -{ - rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); - if(bModified && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False)); - } - return bModified; -}; - -void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - // Ebenen einfuegen - if(!aLevelLB.GetEntryCount()) - { - for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++) - aLevelLB.InsertEntry( UniString::CreateFromInt32(i)); - if(pSaveNum->GetLevelCount() > 1) - { - String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ) ) ); - sEntry += UniString::CreateFromInt32( pSaveNum->GetLevelCount() ); - aLevelLB.InsertEntry(sEntry); - aLevelLB.SelectEntry(sEntry); - } - else - aLevelLB.SelectEntryPos(0); - } - else - aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); - - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - if(nActNumLvl == USHRT_MAX) - { - aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True); - } - else - for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1 ; - } - aLevelLB.SetUpdateMode(sal_True); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; - pPreviewWIN->SetNumRule(pActNum); - aSameLevelCB.Check(pActNum->IsContinuousNumbering()); - - //ColorListBox bei Bedarf fuellen - if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) - { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - DBG_ASSERT( pDocSh, "DocShell not found!" ); - XColorTable* pColorTable = NULL; - bool bKillTable = false; - if ( pDocSh ) - { - pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem ) - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - } - - if ( !pColorTable ) - { - pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); - bKillTable = true; - } - - aBulColLB.InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC )); - - for ( long i = 0; i < pColorTable->Count(); i++ ) - { - XColorEntry* pEntry = pColorTable->GetColor(i); - aBulColLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - if ( bKillTable ) - delete pColorTable; - } - - SfxObjectShell* pShell; - if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False, &pItem ) - || ( 0 != ( pShell = SfxObjectShell::Current()) && - 0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) - { - sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); - bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON); - } - - sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); - aCharFmtFT.Show(bCharFmt); - aCharFmtLB.Show(bCharFmt); - - sal_Bool bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS); - - sal_Bool bAllLevel = bContinuous && !bHTMLMode; - aAllLevelFT.Show(bAllLevel); - aAllLevelNF.Show(bAllLevel); - - aSameLevelFL.Show(bContinuous); - aSameLevelCB.Show(bContinuous); - //wieder Missbrauch: im Draw gibt es die Numerierung nur bis zum Bitmap - // without SVX_NUM_NUMBER_NONE - //remove types that are unsupported by Draw/Impress - if(!bContinuous) - { - sal_uInt16 nFmtCount = aFmtLB.GetEntryCount(); - for(sal_uInt16 i = nFmtCount; i; i--) - { - sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1); - if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/ - ((SVX_NUM_BITMAP|LINK_TOKEN) == nEntryData)) - aFmtLB.RemoveEntry(i - 1); - } - } - //one must be enabled - if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP)) - { - long nData = SVX_NUM_BITMAP|LINK_TOKEN; - sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData); - if(LISTBOX_ENTRY_NOTFOUND != nPos) - aFmtLB.RemoveEntry(nPos); - } - else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP)) - { - long nData = SVX_NUM_BITMAP; - sal_uInt16 nPos = aFmtLB.GetEntryPos((void*)nData); - if(LISTBOX_ENTRY_NOTFOUND != nPos) - aFmtLB.RemoveEntry(nPos); - } - if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT)) - { - aAlignFT.Show(); - aAlignLB.Show(); - Size aSz(aFormatFL.GetSizePixel()); - aSz.Height() = aLevelFT.GetSizePixel().Height(); - aFormatFL.SetSizePixel(aSz); - aAlignLB.SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl)); - } - - //MegaHack: Aufgrund eines nicht fixbaren 'designfehlers' im Impress - //Alle arten der numerischen Aufzaehlungen loeschen - if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS)) - { - sal_uInt16 nFmtCount = aFmtLB.GetEntryCount(); - for(sal_uInt16 i = nFmtCount; i; i--) - { - sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)aFmtLB.GetEntryData(i - 1); - if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/ nEntryData <= SVX_NUM_NUMBER_NONE) - aFmtLB.RemoveEntry(i - 1); - } - } - - InitControls(); - bModified = sal_False; - -} - -void SvxNumOptionsTabPage::InitControls() -{ - sal_Bool bShowBullet = sal_True; - sal_Bool bShowBitmap = sal_True; - sal_Bool bSameType = sal_True; - sal_Bool bSameStart = sal_True; - sal_Bool bSamePrefix = sal_True; - sal_Bool bSameSuffix = sal_True; - sal_Bool bAllLevel = sal_True; - sal_Bool bSameCharFmt = sal_True; - sal_Bool bSameVOrient = sal_True; - sal_Bool bSameSize = sal_True; - sal_Bool bSameBulColor = sal_True; - sal_Bool bSameBulRelSize= sal_True; - sal_Bool bSameAdjust = sal_True; - - const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; - String sFirstCharFmt; - sal_Int16 eFirstOrient = text::VertOrientation::NONE; - Size aFirstSize(0,0); - sal_uInt16 nMask = 1; - sal_uInt16 nLvl = USHRT_MAX; - sal_uInt16 nHighestLevel = 0; - String aEmptyStr; - - sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); - sal_Bool bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - aNumFmtArr[i] = &pActNum->GetLevel(i); - bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL; - bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP; - if(USHRT_MAX == nLvl) - { - nLvl = i; - sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName(); - eFirstOrient = aNumFmtArr[i]->GetVertOrient(); - if(bShowBitmap) - aFirstSize = aNumFmtArr[i]->GetGraphicSize(); - } - if( i > nLvl) - { - bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType(); - bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart(); - - bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix(); - bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix(); - bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels(); - bSameCharFmt &= sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName(); - bSameVOrient &= eFirstOrient == aNumFmtArr[i]->GetVertOrient(); - if(bShowBitmap && bSameSize) - bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize; - bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor(); - bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize(); - bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); - } - nHighestLevel = i; - } - else - aNumFmtArr[i] = 0; - - nMask <<= 1 ; - - } - SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0); - CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType()); - if(bShowBitmap) - { - if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE) - aOrientLB.SetNoSelection(); - else - aOrientLB.SelectEntryPos( - sal::static_int_cast< sal_uInt16 >(eFirstOrient - 1)); - // kein text::VertOrientation::NONE - - if(bSameSize) - { - SetMetricValue(aHeightMF, aFirstSize.Height(), eCoreUnit); - SetMetricValue(aWidthMF, aFirstSize.Width(), eCoreUnit); - } - else - { - aHeightMF.SetText(aEmptyStr); - aWidthMF.SetText(aEmptyStr); - } - } - - if(bSameType) - { - sal_uInt16 nLBData = (sal_uInt16) aNumFmtArr[nLvl]->GetNumberingType(); - aFmtLB.SelectEntryPos(aFmtLB.GetEntryPos( (void*)sal::static_int_cast( nLBData ) )); - } - else - aFmtLB.SetNoSelection(); - - aAllLevelNF.Enable(nHighestLevel > 0 && !aSameLevelCB.IsChecked()); - aAllLevelNF.SetMax(nHighestLevel + 1); - if(bAllLevel) - { - aAllLevelNF.SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels()); - } - else - { - aAllLevelNF.SetText(aEmptyStr); - } - if(bSameAdjust) - { - sal_uInt16 nPos = 1; // zentriert - if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) - nPos = 0; - else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) - nPos = 2; - aAlignLB.SelectEntryPos(nPos); - } - else - { - aAlignLB.SetNoSelection(); - } - - if(bBullRelSize) - { - if(bSameBulRelSize) - aBulRelSizeMF.SetValue(aNumFmtArr[nLvl]->GetBulletRelSize()); - else - aBulRelSizeMF.SetText(aEmptyStr); - } - if(bBullColor) - { - if(bSameBulColor) - aBulColLB.SelectEntry(aNumFmtArr[nLvl]->GetBulletColor()); - else - aBulColLB.SetNoSelection(); - } - switch(nBullet) - { - case SHOW_NUMBERING: - if(bSameStart) - { - aStartED.SetValue(aNumFmtArr[nLvl]->GetStart()); - } - else - aStartED.SetText(aEmptyStr); - break; - case SHOW_BULLET: - break; - case SHOW_BITMAP: - break; - } - - if(bSamePrefix) - aPrefixED.SetText(aNumFmtArr[nLvl]->GetPrefix()); - else - aPrefixED.SetText(aEmptyStr); - if(bSameSuffix) - aSuffixED.SetText(aNumFmtArr[nLvl]->GetSuffix()); - else - aSuffixED.SetText(aEmptyStr); - - if(bSameCharFmt) - { - if(sFirstCharFmt.Len()) - aCharFmtLB.SelectEntry(sFirstCharFmt); - else - aCharFmtLB.SelectEntryPos( 0 ); - } - else - aCharFmtLB.SetNoSelection(); - - pPreviewWIN->SetLevel(nActNumLvl); - pPreviewWIN->Invalidate(); -} - -// 0 - Nummer; 1 - Bullet; 2 - Bitmap -void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType, sal_Bool ) -{ - if(nBullet == nType) - return; - nBullet = nType; - sal_Bool bBitmap = sal_False; - sal_Bool bBullet = sal_False; - sal_Bool bEnableBitmap = sal_False; - if(nType == SHOW_NUMBERING) - { - // Label umschalten, alten Text merken - aStartFT.SetText(sStartWith); - - } - else if(nType == SHOW_BULLET) - { - // Label umschalten, alten Text merken - aStartFT.SetText(sBullet); - bBullet = sal_True; - } - else - { - bBitmap = sal_True; - bEnableBitmap = sal_True; - } - sal_Bool bNumeric = !(bBitmap||bBullet); - aPrefixFT.Show(bNumeric); - aPrefixED.Show(bNumeric); - aSuffixFT.Show(bNumeric); - aSuffixED.Show(bNumeric); - - sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE); - aCharFmtFT.Show(!bBitmap && bCharFmt); - aCharFmtLB.Show(!bBitmap && bCharFmt); - - // das ist eigentlich Missbrauch, da fuer die vollst. Numerierung kein - // eigenes Flag existiert - sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); - sal_Bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode; - aAllLevelFT.Show(bAllLevel); - aAllLevelNF.Show(bAllLevel); - - aStartFT.Show(!bBitmap); - aStartED.Show(!(bBullet||bBitmap)); - - aBulletPB.Show(bBullet); - sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR); - aBulColorFT.Show( !bBitmap && bBullColor ); - aBulColLB.Show( !bBitmap && bBullColor ); - sal_Bool bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE); - aBulRelSizeFT.Show( !bBitmap && bBullResSize ); - aBulRelSizeMF.Show( !bBitmap && bBullResSize ); - - aBitmapFT .Show(bBitmap); - aBitmapMB .Show(bBitmap); - - aSizeFT .Show(bBitmap); - aWidthMF .Show(bBitmap); - aMultFT .Show(bBitmap); - aHeightMF .Show(bBitmap); - aRatioCB .Show(bBitmap); - - aOrientFT .Show(bBitmap && bAllLevelFeature); - aOrientLB .Show(bBitmap && bAllLevelFeature); - - aSizeFT .Enable(bEnableBitmap); - aWidthMF .Enable(bEnableBitmap); - aMultFT .Enable(bEnableBitmap); - aHeightMF .Enable(bEnableBitmap); - aRatioCB .Enable(bEnableBitmap); - aOrientFT .Enable(bEnableBitmap); - aOrientLB .Enable(bEnableBitmap); - -} - -IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox ) -{ - sal_uInt16 nSaveNumLvl = nActNumLvl; - nActNumLvl = 0; - if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && - (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) - { - nActNumLvl = 0xFFFF; - pBox->SetUpdateMode(sal_False); - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - pBox->SelectEntryPos( i, sal_False ); - pBox->SetUpdateMode(sal_True); - } - else if(pBox->GetSelectEntryCount()) - { - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - { - if(pBox->IsEntryPosSelected( i )) - nActNumLvl |= nMask; - nMask <<= 1; - } - pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False ); - } - else - { - nActNumLvl = nSaveNumLvl; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - { - if(nActNumLvl & nMask) - { - pBox->SelectEntryPos(i); - break; - } - nMask <<=1; - } - } - InitControls(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl, Timer*, EMPTYARG ) -{ - pPreviewWIN->Invalidate(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox ) -{ - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - sal_uInt16 nMask = 1; - for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(e)); - aNumFmt.SetIncludeUpperLevels((sal_uInt8) std::min(pBox->GetValue(), sal_Int64(e + 1)) ); - pActNum->SetLevel(e, aNumFmt); - } - nMask <<= 1; - } - } - SetModified(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox ) -{ - String sSelectStyle; - sal_Bool bShowOrient = sal_False; - sal_Bool bBmp = sal_False; - String aEmptyStr; - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - // PAGEDESC gibt es nicht - sal_uInt16 nNumType = (sal_uInt16)(sal_uLong)pBox->GetEntryData(pBox->GetSelectEntryPos()); - aNumFmt.SetNumberingType((sal_Int16)nNumType); - sal_uInt16 nNumberingType = aNumFmt.GetNumberingType(); - if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN))) - { - bBmp |= 0 != aNumFmt.GetBrush(); - aNumFmt.SetIncludeUpperLevels( sal_False ); - aNumFmt.SetSuffix( aEmptyStr ); - aNumFmt.SetPrefix( aEmptyStr ); - if(!bBmp) - aNumFmt.SetGraphic(aEmptyStr); - pActNum->SetLevel(i, aNumFmt); - SwitchNumberType(SHOW_BITMAP, bBmp ); - bShowOrient = sal_True; - } - else if( SVX_NUM_CHAR_SPECIAL == nNumberingType ) - { - aNumFmt.SetIncludeUpperLevels( sal_False ); - aNumFmt.SetSuffix( aEmptyStr ); - aNumFmt.SetPrefix( aEmptyStr ); - if( !aNumFmt.GetBulletFont() ) - aNumFmt.SetBulletFont(&aActBulletFont); - if( !aNumFmt.GetBulletChar() ) - aNumFmt.SetBulletChar( SVX_DEF_BULLET ); - pActNum->SetLevel(i, aNumFmt); - SwitchNumberType(SHOW_BULLET); - // Zuweisung der Zeichenvorlage automatisch - if(bAutomaticCharStyles) - { - sSelectStyle = sBulletCharFmtName; - } - } - else - { - aNumFmt.SetPrefix( aPrefixED.GetText() ); - aNumFmt.SetSuffix( aSuffixED.GetText() ); - SwitchNumberType(SHOW_NUMBERING); - pActNum->SetLevel(i, aNumFmt); - CheckForStartValue_Impl(nNumberingType); - - // Zuweisung der Zeichenvorlage automatisch - if(bAutomaticCharStyles) - { - sSelectStyle = sNumCharFmtName; - } - } - } - nMask <<= 1; - } - sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS); - if(bShowOrient && bAllLevelFeature) - { - aOrientFT.Show(); - aOrientLB.Show(); - } - else - { - aOrientFT.Hide(); - aOrientLB.Hide(); - } - SetModified(); - if(sSelectStyle.Len()) - { - aCharFmtLB.SelectEntry(sSelectStyle); - CharFmtHdl_Impl(&aCharFmtLB); - bAutomaticCharStyles = sal_True; - } - return 0; -} - -void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType) -{ - sal_Bool bIsNull = aStartED.GetValue() == 0; - sal_Bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC || - SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType || - SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType; - aStartED.SetMin(bNoZeroAllowed ? 1 : 0); - if(bIsNull && bNoZeroAllowed) - aStartED.GetModifyHdl().Call(&aStartED); -} - -IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox ) -{ - sal_uInt16 nPos = pBox->GetSelectEntryPos(); - nPos ++; // kein VERT_NONE - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) - { - const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); - const Size& rSize = aNumFmt.GetGraphicSize(); - sal_Int16 eOrient = (sal_Int16)nPos; - aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient ); - pActNum->SetLevel(i, aNumFmt); - } - } - nMask <<= 1; - } - SetModified(sal_False); - return 0; - -} - -IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox ) -{ - sal_Bool bSet = pBox->IsChecked(); - pActNum->SetContinuousNumbering(bSet); - sal_Bool bRepaint = sal_False; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE) - { - bRepaint = sal_True; - break; - } - } - SetModified(bRepaint); - InitControls(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox ) -{ - Color nSetColor = pBox->GetSelectEntryColor(); - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - aNumFmt.SetBulletColor(nSetColor); - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField) -{ - sal_uInt16 nRelSize = (sal_uInt16)pField->GetValue(); - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - aNumFmt.SetBulletRelSize(nRelSize); - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton ) -{ - sal_uInt16 nItemId = pButton->GetCurItemId(); - String aGrfName; - Size aSize; - sal_Bool bSucc(sal_False); - SvxOpenGraphicDialog aGrfDlg( CUI_RES(RID_STR_EDIT_GRAPHIC) ); - - if(MN_GALLERY_ENTRY <= nItemId ) - { - sal_uInt16 idx = nItemId - MN_GALLERY_ENTRY; - if (idx < aGrfNames.size()) - { - aGrfName = aGrfNames[idx]; - Graphic aGraphic; - if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, idx, &aGraphic)) - { - aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); - bSucc = sal_True; - } - } - } - else - { - aGrfDlg.EnableLink( sal_False ); - aGrfDlg.AsLink( sal_False ); - if ( !aGrfDlg.Execute() ) - { - // ausgewaehlten Filter merken - aGrfName = aGrfDlg.GetPath(); - - Graphic aGraphic; - if( !aGrfDlg.GetGraphic(aGraphic) ) - { - aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic); - bSucc = sal_True; - } - } - } - if(bSucc) - { - aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit); - - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - aNumFmt.SetCharFmtName(sNumCharFmtName); - aNumFmt.SetGraphic(aGrfName); - - // Size schon mal fuer spaeteren Groessenabgleich setzen - const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); - // initiate asynchronous loading - sal_Int16 eOrient = aNumFmt.GetVertOrient(); - aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); - aInitSize[i] = aNumFmt.GetGraphicSize(); - - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - aRatioCB .Enable(); - aSizeFT .Enable(); - aMultFT.Enable(); - aWidthMF .Enable(); - aHeightMF.Enable(); - SetMetricValue(aWidthMF, aSize.Width(), eCoreUnit); - SetMetricValue(aHeightMF, aSize.Height(), eCoreUnit); - aOrientFT.Enable(); - aOrientLB.Enable(); - SetModified(); - //needed due to asynchronous loading of graphics in the SvxBrushItem - aInvalidateTimer.Start(); - } - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, PopupActivateHdl_Impl, Menu *, EMPTYARG ) -{ - if(!bMenuButtonInitialized) - { - bMenuButtonInitialized = sal_True; - EnterWait(); - PopupMenu* pPopup = aBitmapMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); - - if(GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames)) - { - pPopup->RemoveItem( pPopup->GetItemPos( NUM_NO_GRAPHIC )); - GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS); - - Graphic aGraphic; - String sGrfName; - std::vector::const_iterator it = aGrfNames.begin(); - for(sal_uInt16 i = 0; it != aGrfNames.end(); ++it, ++i) - { - sGrfName = *it; - INetURLObject aObj(sGrfName); - if(aObj.GetProtocol() == INET_PROT_FILE) - sGrfName = aObj.PathToFileName(); - - if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic)) - { - Bitmap aBitmap(aGraphic.GetBitmap()); - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || - aSize.Height() > MAX_BMP_HEIGHT) - { - sal_Bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); - aBitmap.Scale(nScale, nScale); - } - Image aImage(aBitmap); - - pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage ); - } - else - { - Image aImage; - pPopup->InsertItem( - MN_GALLERY_ENTRY + i, sGrfName, aImage ); - } - } - GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS); - } - LeaveWait(); - } - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, BulletHdl_Impl, Button *, EMPTYARG ) -{ - SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True ); - - sal_uInt16 nMask = 1; - const Font* pFmtFont = 0; - sal_Bool bSameBullet = sal_True; - sal_Unicode cBullet = 0; - sal_Bool bFirst = sal_True; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - const SvxNumberFormat& rCurFmt = pActNum->GetLevel(i); - if(bFirst) - { - cBullet = rCurFmt.GetBulletChar(); - } - else if(rCurFmt.GetBulletChar() != cBullet ) - { - bSameBullet = sal_False; - break; - } - if(!pFmtFont) - pFmtFont = rCurFmt.GetBulletFont(); - bFirst = sal_False; - } - nMask <<= 1; - - } - - if(pFmtFont) - pMap->SetCharFont(*pFmtFont); - else - pMap->SetCharFont(aActBulletFont); - if(bSameBullet) - pMap->SetChar( cBullet ); - if(pMap->Execute() == RET_OK) - { - // Font Numrules umstellen - aActBulletFont = pMap->GetCharFont(); - - sal_uInt16 _nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & _nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - aNumFmt.SetBulletFont(&aActBulletFont); ; - aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() ); - pActNum->SetLevel(i, aNumFmt); - } - _nMask <<= 1; - } - - SetModified(); - } - delete pMap; - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField) -{ - sal_Bool bWidth = pField == &aWidthMF; - bLastWidthModified = bWidth; - sal_Bool bRatio = aRatioCB.IsChecked(); - long nWidthVal = static_cast(aWidthMF.Denormalize(aWidthMF.GetValue(FUNIT_100TH_MM))); - long nHeightVal = static_cast(aHeightMF.Denormalize(aHeightMF.GetValue(FUNIT_100TH_MM))); - nWidthVal = OutputDevice::LogicToLogic( nWidthVal , - MAP_100TH_MM, (MapUnit)eCoreUnit ); - nHeightVal = OutputDevice::LogicToLogic( nHeightVal, - MAP_100TH_MM, (MapUnit)eCoreUnit); - double fSizeRatio; - - sal_Bool bRepaint = sal_False; - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) - { - Size aSize(aNumFmt.GetGraphicSize() ); - Size aSaveSize(aSize); - - if (aInitSize[i].Height()) - fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height(); - else - fSizeRatio = (double)1; - - if(bWidth) - { - long nDelta = nWidthVal - aInitSize[i].Width(); - aSize.Width() = nWidthVal; - if (bRatio) - { - aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio); - aHeightMF.SetUserValue(aHeightMF.Normalize( - OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )), - FUNIT_100TH_MM); - } - } - else - { - long nDelta = nHeightVal - aInitSize[i].Height(); - aSize.Height() = nHeightVal; - if (bRatio) - { - aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio); - aWidthMF.SetUserValue(aWidthMF.Normalize( - OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )), - FUNIT_100TH_MM); - } - } - const SvxBrushItem* pBrushItem = aNumFmt.GetBrush(); - sal_Int16 eOrient = aNumFmt.GetVertOrient(); - if(aSize != aSaveSize) - bRepaint = sal_True; - aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient ); - pActNum->SetLevel(i, aNumFmt); - } - } - nMask <<= 1; - } - SetModified(bRepaint); - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox ) -{ - if (pBox->IsChecked()) - { - if (bLastWidthModified) - SizeHdl_Impl(&aWidthMF); - else - SizeHdl_Impl(&aHeightMF); - } - return 0; -} - -IMPL_LINK( SvxNumOptionsTabPage, CharFmtHdl_Impl, ListBox *, EMPTYARG ) -{ - bAutomaticCharStyles = sal_False; - sal_uInt16 nEntryPos = aCharFmtLB.GetSelectEntryPos(); - String sEntry = aCharFmtLB.GetSelectEntry(); - sal_uInt16 nMask = 1; - String aEmptyStr; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if( 0 == nEntryPos ) - aNumFmt.SetCharFmtName(aEmptyStr); - else - { - if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN))) - aNumFmt.SetCharFmtName(sEntry); - } - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(sal_False); - return 0; - -}; - -IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit ) -{ - sal_Bool bPrefix = pEdit == &aPrefixED; - sal_Bool bSuffix = pEdit == &aSuffixED; - sal_Bool bStart = pEdit == &aStartED; - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - if(bPrefix) - aNumFmt.SetPrefix( aPrefixED.GetText() ); - else if(bSuffix) - aNumFmt.SetSuffix( aSuffixED.GetText() ); - else if(bStart) - aNumFmt.SetStart( (sal_uInt16)aStartED.GetValue() ); - else //align - { - sal_uInt16 nPos = aAlignLB.GetSelectEntryPos(); - SvxAdjust eAdjust = SVX_ADJUST_CENTER; - if(nPos == 0) - eAdjust = SVX_ADJUST_LEFT; - else if(nPos == 2) - eAdjust = SVX_ADJUST_RIGHT; - aNumFmt.SetNumAdjust( eAdjust ); - } - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - - return 0; -} - -sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, sal_uInt16 nXStart, - sal_uInt16 nYStart, sal_uInt16 nDivision) -{ - const SvxBrushItem* pBrushItem = rFmt.GetBrush(); - sal_uInt16 nRet = 0; - if(pBrushItem) - { - const Graphic* pGrf = pBrushItem->GetGraphic(); - if(pGrf) - { - Size aGSize( rFmt.GetGraphicSize() ); - aGSize.Width() /= nDivision; - nRet = (sal_uInt16)aGSize.Width(); - aGSize.Height() /= nDivision; - pGrf->Draw( pVDev, Point(nXStart,nYStart), - pVDev->PixelToLogic( aGSize ) ); - } - } - return nRet; - -} - -sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev, - const SvxNumberFormat& rFmt, sal_uInt16 nXStart, - sal_uInt16 nYStart, const Size& rSize) -{ - Font aTmpFont(pVDev->GetFont()); - - //per Uno kann es sein, dass kein Font gesetzt ist! - Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont); - Size aTmpSize(rSize); - aTmpSize.Width() *= rFmt.GetBulletRelSize(); - aTmpSize.Width() /= 100 ; - aTmpSize.Height() *= rFmt.GetBulletRelSize(); - aTmpSize.Height() /= 100 ; - // bei einer Hoehe von Null wird in Ursprungshoehe gezeichnet - if(!aTmpSize.Height()) - aTmpSize.Height() = 1; - aFont.SetSize(aTmpSize); - aFont.SetTransparent(sal_True); - Color aBulletColor = rFmt.GetBulletColor(); - if(aBulletColor.GetColor() == COL_AUTO) - aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK); - else if(aBulletColor == pVDev->GetFillColor()) - aBulletColor.Invert(); - aFont.SetColor(aBulletColor); - pVDev->SetFont( aFont ); - String aText(sal_Unicode(rFmt.GetBulletChar())); - long nY = nYStart; - nY -= ((aTmpSize.Height() - rSize.Height())/ 2); - pVDev->DrawText( Point(nXStart, nY), aText ); - sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText); - - pVDev->SetFont(aTmpFont); - return nRet; -} - -// Vorschau der Numerierung painten -void SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ ) -{ - Size aSize(PixelToLogic(GetOutputSizePixel())); - Rectangle aRect(Point(0,0), aSize); - - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - const Color aBackColor = rStyleSettings.GetFieldColor(); - const Color aTextColor = rStyleSettings.GetFieldTextColor(); - - VirtualDevice* pVDev = new VirtualDevice(*this); - pVDev->EnableRTL( IsRTLEnabled() ); - pVDev->SetMapMode(GetMapMode()); - pVDev->SetOutputSize( aSize ); - - Color aLineColor(COL_LIGHTGRAY); - if(aLineColor == aBackColor) - aLineColor.Invert(); - pVDev->SetLineColor(aLineColor); - pVDev->SetFillColor( aBackColor ); - pVDev->DrawRect(aRect); - - if(pActNum) - { - sal_uInt16 nWidthRelation; - if(nPageWidth) - { - nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width()); - if(bPosition) - nWidthRelation = nWidthRelation * 2 / 3; - else - nWidthRelation = nWidthRelation / 4; - } - else - nWidthRelation = 30; // Kapiteldialog - - //Hoehe pro Ebene - sal_uInt16 nXStep = sal::static_int_cast< sal_uInt16 >(aSize.Width() / (3 * pActNum->GetLevelCount())); - if(pActNum->GetLevelCount() < 10) - nXStep /= 2; - sal_uInt16 nYStart = 4; - // fuer ein einziges Level darf nicht die gesamte Hoehe benutzt werden - sal_uInt16 nYStep = sal::static_int_cast< sal_uInt16 >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5)); - aStdFont = OutputDevice::GetDefaultFont( - DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE); - aStdFont.SetColor(aTextColor); - aStdFont.SetFillColor(aBackColor); - - sal_uInt16 nFontHeight = nYStep * 6 / 10; - if(bPosition) - nFontHeight = nYStep * 15 / 10; - aStdFont.SetSize(Size( 0, nFontHeight )); - - SvxNodeNum aNum( (sal_uInt8)0 ); - sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart(); - - if(bPosition) - { - sal_uInt16 nLineHeight = nFontHeight * 8 / 7; - sal_uInt8 nStart = 0; - while( !(nActLevel & (1<GetLevelCount() ); - for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel ) - { - const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); - aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); - - sal_uInt16 nXStart( 0 ); - short nTextOffset( 0 ); - sal_uInt16 nNumberXPos( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nXStart = rFmt.GetAbsLSpace() / nWidthRelation; - nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation; - nNumberXPos = nXStart; - sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation; - - if(nFirstLineOffset <= nNumberXPos) - nNumberXPos = nNumberXPos - nFirstLineOffset; - else - nNumberXPos = 0; - //im draw ist das zulaeesig - if(nTextOffset < 0) - nNumberXPos = nNumberXPos + nTextOffset; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - const long nTmpNumberXPos( ( rFmt.GetIndentAt() + - rFmt.GetFirstLineIndent() ) / - nWidthRelation ); - if ( nTmpNumberXPos < 0 ) - { - nNumberXPos = 0; - } - else - { - nNumberXPos = static_cast( nTmpNumberXPos ); - } - } - - sal_uInt16 nBulletWidth = 0; - if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN))) - { - nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt, - nNumberXPos, - nYStart, nWidthRelation) : 0; - } - else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) - { - nBulletWidth = rFmt.IsShowSymbol() ? - lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0; - } - else - { - pVDev->SetFont(aStdFont); - aNum.SetLevel( nLevel ); - if(pActNum->IsContinuousNumbering()) - aNum.GetLevelVal()[nLevel] = nPreNum; - String aText(pActNum->MakeNumString( aNum )); - Font aSaveFont = pVDev->GetFont(); - Font aColorFont(aSaveFont); - Color aTmpBulletColor = rFmt.GetBulletColor(); - if(aTmpBulletColor.GetColor() == COL_AUTO) - aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); - else if(aTmpBulletColor == aBackColor) - aTmpBulletColor.Invert(); - aColorFont.SetColor(aTmpBulletColor); - pVDev->SetFont(aColorFont); - pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); - pVDev->SetFont(aSaveFont); - nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText); - nPreNum++; - } - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT && - rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE ) - { - pVDev->SetFont(aStdFont); - String aText(' '); - pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); - nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText); - } - - sal_uInt16 nTextXPos( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nTextXPos = nXStart; - if(nTextOffset < 0) - nTextXPos = nTextXPos + nTextOffset; - if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos ) - nTextXPos = nNumberXPos + nBulletWidth + nTextOffset; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - switch ( rFmt.GetLabelFollowedBy() ) - { - case SvxNumberFormat::LISTTAB: - { - nTextXPos = static_cast( - rFmt.GetListtabPos() / nWidthRelation ); - if ( nTextXPos < nNumberXPos + nBulletWidth ) - { - nTextXPos = nNumberXPos + nBulletWidth; - } - } - break; - case SvxNumberFormat::SPACE: - case SvxNumberFormat::NOTHING: - { - nTextXPos = nNumberXPos + nBulletWidth; - } - break; - } - - nXStart = static_cast( rFmt.GetIndentAt() / nWidthRelation ); - } - - Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2)); - pVDev->SetFillColor( aBackColor ); - pVDev->DrawRect( aRect1 ); - - Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2)); - pVDev->DrawRect( aRect2 ); - nYStart += 2 * nLineHeight; - } - } - else - { - //#i5153# painting gray or black rectangles as 'normal' numbering text - String sMsg( RTL_CONSTASCII_USTRINGPARAM( "Preview") ); - long nWidth = pVDev->GetTextWidth(sMsg); - long nTextHeight = pVDev->GetTextHeight(); - long nRectHeight = nTextHeight * 2 / 3; - long nTopOffset = nTextHeight - nRectHeight; - Color aBlackColor(COL_BLACK); - if(aBlackColor == aBackColor) - aBlackColor.Invert(); - - for( sal_uInt8 nLevel = 0; nLevel < pActNum->GetLevelCount(); - ++nLevel, nYStart = nYStart + nYStep ) - { - const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel); - aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart(); - sal_uInt16 nXStart( 0 ); - if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - nXStart = rFmt.GetAbsLSpace() / nWidthRelation; - } - else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - const long nTmpXStart( ( rFmt.GetIndentAt() + - rFmt.GetFirstLineIndent() ) / - nWidthRelation ); - if ( nTmpXStart < 0 ) - { - nXStart = 0; - } - else - { - nXStart = static_cast(nTmpXStart); - } - } - nXStart /= 2; - nXStart += 2; - sal_uInt16 nTextOffset = 2 * nXStep; - if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) ) - { - if(rFmt.IsShowSymbol()) - { - nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation); - nTextOffset = nTextOffset + nXStep; - } - } - else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() ) - { - if(rFmt.IsShowSymbol()) - { - nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize()); - nTextOffset = nTextOffset + nXStep; - } - } - else - { - Font aColorFont(aStdFont); - Color aTmpBulletColor = rFmt.GetBulletColor(); - if(aTmpBulletColor.GetColor() == COL_AUTO) - aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK); - else if(aTmpBulletColor == aBackColor) - aTmpBulletColor.Invert(); - aColorFont.SetColor(aTmpBulletColor); - pVDev->SetFont(aColorFont); - aNum.SetLevel( nLevel ); - if(pActNum->IsContinuousNumbering()) - aNum.GetLevelVal()[nLevel] = nPreNum; - String aText(pActNum->MakeNumString( aNum )); - pVDev->DrawText( Point(nXStart, nYStart), aText ); - pVDev->SetFont(aStdFont); - nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText); - nTextOffset = nTextOffset + nXStep; - nPreNum++; - } - if(pOutlineNames) - { - //#i5153# outline numberings still use the style names as text - pVDev->SetFont(aStdFont); - sMsg = pOutlineNames[nLevel]; - pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg ); - } - else - { - //#i5153# the selected rectangle(s) should be black - if( 0 != (nActLevel & (1<SetFillColor( aBlackColor ); - pVDev->SetLineColor( aBlackColor ); - } - else - { - //#i5153# unselected levels are gray - pVDev->SetFillColor( aLineColor ); - pVDev->SetLineColor( aLineColor ); - } - Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight)); - pVDev->DrawRect(aRect1); - } - } - } - } - DrawOutDev( Point(0,0), aSize, - Point(0,0), aSize, - *pVDev ); - delete pVDev; - -} - -SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent, - const SfxItemSet& rSet) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_NUM_POSITION ), rSet ), - aPositionFL( this, CUI_RES(FL_POSITION )), - aLevelFT( this, CUI_RES(FT_LEVEL )), - aLevelLB( this, CUI_RES(LB_LEVEL )), - aDistBorderFT( this, CUI_RES(FT_BORDERDIST )), - aDistBorderMF( this, CUI_RES(MF_BORDERDIST )), - aRelativeCB( this, CUI_RES(CB_RELATIVE )), - aIndentFT( this, CUI_RES(FT_INDENT )), - aIndentMF( this, CUI_RES(MF_INDENT )), - aDistNumFT( this, CUI_RES(FT_NUMDIST )), - aDistNumMF( this, CUI_RES(MF_NUMDIST )), - aAlignFT( this, CUI_RES(FT_ALIGN )), - aAlignLB( this, CUI_RES(LB_ALIGN )), - aLabelFollowedByFT( this, CUI_RES(FT_LABEL_FOLLOWED_BY) ), - aLabelFollowedByLB( this, CUI_RES(LB_LABEL_FOLLOWED_BY) ), - aListtabFT( this, CUI_RES(FT_LISTTAB) ), - aListtabMF( this, CUI_RES(MF_LISTTAB) ), - aAlign2FT( this, CUI_RES(FT_ALIGN_2) ), - aAlign2LB( this, CUI_RES(LB_ALIGN_2) ), - aAlignedAtFT( this, CUI_RES(FT_ALIGNED_AT) ), - aAlignedAtMF( this, CUI_RES(MF_ALIGNED_AT) ), - aIndentAtFT( this, CUI_RES(FT_INDENT_AT) ), - aIndentAtMF( this, CUI_RES(MF_INDENT_AT) ), - aStandardPB( this, CUI_RES(PB_STANDARD )), - pPreviewWIN( new SvxNumberingPreview(this, CUI_RES(WIN_PREVIEW ))), - pActNum(0), - pSaveNum(0), - nActNumLvl( USHRT_MAX ), - nNumItemId(SID_ATTR_NUMBERING_RULE), - bModified(false), - bPreset(false), - bInInintControl(sal_False), - bLabelAlignmentPosAndSpaceModeActive( false ) -{ - FreeResource(); - SetExchangeSupport(); - pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); - - aRelativeCB.Check(); - aAlignLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); - aAlign2LB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl)); - for ( sal_uInt16 i = 0; i < aAlignLB.GetEntryCount(); ++i ) - { - aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) ); - } - aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() ); - aAlign2FT.SetText( aAlignFT.GetText() ); - - Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl); - - aDistBorderMF.SetUpHdl(aLk); - aDistBorderMF.SetDownHdl(aLk); - aDistBorderMF.SetLoseFocusHdl(aLk); - - aDistNumMF.SetUpHdl(aLk); - aDistNumMF.SetDownHdl(aLk); - aDistNumMF.SetLoseFocusHdl(aLk); - - aIndentMF.SetUpHdl(aLk); - aIndentMF.SetDownHdl(aLk); - aIndentMF.SetLoseFocusHdl(aLk); - - aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() ); - aLabelFollowedByLB.SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) ); - - aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl); - aListtabMF.SetUpHdl(aLk); - aListtabMF.SetDownHdl(aLk); - aListtabMF.SetLoseFocusHdl(aLk); - - aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl); - aAlignedAtMF.SetUpHdl(aLk); - aAlignedAtMF.SetDownHdl(aLk); - aAlignedAtMF.SetLoseFocusHdl(aLk); - - aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl); - aIndentAtMF.SetUpHdl(aLk); - aIndentAtMF.SetDownHdl(aLk); - aIndentAtMF.SetLoseFocusHdl(aLk); - - aLevelLB.SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl)); - aRelativeCB.SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl)); - aStandardPB.SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl)); - - - aRelativeCB.Check(bLastRelative); - pPreviewWIN->SetPositionMode(); - eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); - -#if OSL_DEBUG_LEVEL > 1 - pDebugFixedText = new FixedText(this, 0); - pDebugFixedText->Show(); - Size aSize(200, 20); - Point aPos(250,0); - - pDebugFixedText->SetPosSizePixel(aPos, aSize); - pDebugFixedText->SetText( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Das ist ein Debug-Text" ) ) ); -#endif - - aStandardPB.SetAccessibleRelationMemberOf(&aPositionFL); -} - -SvxNumPositionTabPage::~SvxNumPositionTabPage() -{ - delete pActNum; - delete pPreviewWIN; - delete pSaveNum; -#if OSL_DEBUG_LEVEL > 1 - delete pDebugFixedText; -#endif -} -/*-------------------------------------------------------*/ - -#if OSL_DEBUG_LEVEL > 1 -void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt) -{ -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) - - sal_Char const sHash[] = " # "; - if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) ); - sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); - sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) ); - sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); - sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) ); - rFixed.SetText(sDebugText); - } - else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - String sDebugText( UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) ); - sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); - sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) ); - sDebugText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sHash ) ); - sDebugText += UniString::CreateFromInt32( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) ); - rFixed.SetText(sDebugText); - } - -} -#endif - -void SvxNumPositionTabPage::InitControls() -{ - bInInintControl = sal_True; - const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive && - aRelativeCB.IsEnabled() && aRelativeCB.IsChecked(); - const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && - USHRT_MAX != nActNumLvl; - - aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative ) ); - aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive && - ( bSingleSelection || bRelative ) ); - - bool bSetDistEmpty = false; - bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive; - bool bSameAdjust = true; - - bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive; - bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive; - bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive; - bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive; - - const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM]; - sal_uInt16 nMask = 1; - sal_uInt16 nLvl = USHRT_MAX; - long nFirstBorderTextRelative = -1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - aNumFmtArr[i] = &pActNum->GetLevel(i); - if(nActNumLvl & nMask) - { - if(USHRT_MAX == nLvl) - nLvl = i; - - if( i > nLvl) - { - bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust(); - if ( !bLabelAlignmentPosAndSpaceModeActive ) - { - if(bRelative) - { - if(nFirstBorderTextRelative == -1) - nFirstBorderTextRelative = - (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - - aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); - else - bSameDistBorderNum &= nFirstBorderTextRelative == - (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() - - aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset()); - } - else - bSameDistBorderNum &= - aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() == - aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset(); - - bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance(); - bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset(); - } - else - { - bSameLabelFollowedBy &= - aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy(); - bSameListtab &= - aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos(); - bSameAlignAt &= - ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() ) - == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) ); - bSameIndentAt &= - aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt(); - } - } - } - nMask <<= 1; - - } - if(bSameDistBorderNum) - { - long nDistBorderNum; - if(bRelative) - { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); - if(nLvl) - nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset(); - } - else - { - nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset(); - } - SetMetricValue(aDistBorderMF, nDistBorderNum, eCoreUnit); - } - else - bSetDistEmpty = true; - -#if OSL_DEBUG_LEVEL > 1 - lcl_PrintDebugOutput(*pDebugFixedText, *aNumFmtArr[nLvl]); -#endif - - const String aEmptyStr; - if(bSameDist) - SetMetricValue(aDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit); - else - aDistNumMF.SetText(aEmptyStr); - if(bSameIndent) - SetMetricValue(aIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit); - else - aIndentMF.SetText(aEmptyStr); - - if(bSameAdjust) - { - sal_uInt16 nPos = 1; // zentriert - if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT) - nPos = 0; - else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT) - nPos = 2; - aAlignLB.SelectEntryPos(nPos); - aAlign2LB.SelectEntryPos( nPos ); - } - else - { - aAlignLB.SetNoSelection(); - aAlign2LB.SetNoSelection(); - } - - if ( bSameLabelFollowedBy ) - { - sal_uInt16 nPos = 0; // LISTTAB - if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE ) - { - nPos = 1; - } - else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING ) - { - nPos = 2; - } - aLabelFollowedByLB.SelectEntryPos( nPos ); - } - else - { - aLabelFollowedByLB.SetNoSelection(); - } - - if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB ) - { - aListtabFT.Enable( true ); - aListtabMF.Enable( true ); - if ( bSameListtab ) - { - SetMetricValue( aListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit ); - } - else - { - aListtabMF.SetText(aEmptyStr); - } - } - else - { - aListtabFT.Enable( false ); - aListtabMF.Enable( false ); - aListtabMF.SetText(aEmptyStr); - } - - if ( bSameAlignAt ) - { - SetMetricValue( aAlignedAtMF, - aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(), - eCoreUnit ); - } - else - { - aAlignedAtMF.SetText(aEmptyStr); - } - - if ( bSameIndentAt ) - { - SetMetricValue( aIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit ); - } - else - { - aIndentAtMF.SetText(aEmptyStr); - } - - if ( bSetDistEmpty ) - aDistBorderMF.SetText(aEmptyStr); - - bInInintControl = sal_False; -} - -void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem; - sal_uInt16 nTmpNumLvl = USHRT_MAX; - const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet) - { - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem)) - bPreset = ((const SfxBoolItem*)pItem)->GetValue(); - if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem)) - nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue(); - } - if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem)) - { - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - } - bModified = (!pActNum->Get( 0 ) || bPreset); - if(*pSaveNum != *pActNum || - nActNumLvl != nTmpNumLvl ) - { - *pActNum = *pSaveNum; - nActNumLvl = nTmpNumLvl; - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - aLevelLB.SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX); - if(nActNumLvl != USHRT_MAX) - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1 ; - } - aRelativeCB.Enable(nActNumLvl != 1); - aLevelLB.SetUpdateMode(sal_True); - - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - - InitControls(); - } - pPreviewWIN->SetLevel(nActNumLvl); - pPreviewWIN->Invalidate(); -} - -int SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) -{ - if(_pSet) - FillItemSet(*_pSet); - return sal_True; -} - -sal_Bool SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) -{ - rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl)); - - if(bModified && pActNum) - { - *pSaveNum = *pActNum; - rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId); - rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False)); - } - return bModified; -} - -void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) -{ - const SfxPoolItem* pItem; - //im Draw gibt es das Item als WhichId, im Writer nur als SlotId - SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem); - if(eState != SFX_ITEM_SET) - { - nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); - eState = rSet.GetItemState(nNumItemId, sal_False, &pItem); - - if( eState != SFX_ITEM_SET ) - { - pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) ); - eState = SFX_ITEM_SET; - } - - } - DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); - delete pSaveNum; - pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); - - // Ebenen einfuegen - if(!aLevelLB.GetEntryCount()) - { - for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++) - aLevelLB.InsertEntry(UniString::CreateFromInt32(i)); - if(pSaveNum->GetLevelCount() > 1) - { - String sEntry( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "1 - ") ) ); - sEntry.Append( UniString::CreateFromInt32( pSaveNum->GetLevelCount() ) ); - aLevelLB.InsertEntry(sEntry); - aLevelLB.SelectEntry(sEntry); - } - else - aLevelLB.SelectEntryPos(0); - } - else - aLevelLB.SelectEntryPos(aLevelLB.GetEntryCount() - 1); - sal_uInt16 nMask = 1; - aLevelLB.SetUpdateMode(sal_False); - aLevelLB.SetNoSelection(); - if(nActNumLvl == USHRT_MAX) - { - aLevelLB.SelectEntryPos( pSaveNum->GetLevelCount(), sal_True); - } - else - for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - aLevelLB.SelectEntryPos( i, sal_True); - nMask <<= 1; - } - aLevelLB.SetUpdateMode(sal_True); - - if(!pActNum) - pActNum = new SvxNumRule(*pSaveNum); - else if(*pSaveNum != *pActNum) - *pActNum = *pSaveNum; - pPreviewWIN->SetNumRule(pActNum); - - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - - InitControls(); - bModified = sal_False; -} - -void SvxNumPositionTabPage::InitPosAndSpaceMode() -{ - if ( pActNum == 0 ) - { - DBG_ASSERT( false, - " - misusage of method -> has to be already set!" ); - return; - } - - SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode = - SvxNumberFormat::LABEL_ALIGNMENT; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); - ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode(); - if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) - { - break; - } - } - nMask <<= 1; - } - - bLabelAlignmentPosAndSpaceModeActive = - ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT; -} - -void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode() -{ - aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive && - pActNum->IsFeatureSupported(NUM_CONTINUOUS) ); - aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive && - pActNum->IsFeatureSupported(NUM_CONTINUOUS)); - aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive ); - aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive ); - - aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive ); - aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); - aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive ); - aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive ); -} - -SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent, - const SfxItemSet& rAttrSet) -{ - return new SvxNumPositionTabPage(pParent, rAttrSet); -} - -void SvxNumPositionTabPage::SetMetric(FieldUnit eMetric) -{ - if(eMetric == FUNIT_MM) - { - aDistBorderMF .SetDecimalDigits(1); - aDistNumMF .SetDecimalDigits(1); - aIndentMF .SetDecimalDigits(1); - aListtabMF.SetDecimalDigits(1); - aAlignedAtMF.SetDecimalDigits(1); - aIndentAtMF.SetDecimalDigits(1); - } - aDistBorderMF .SetUnit( eMetric ); - aDistNumMF .SetUnit( eMetric ); - aIndentMF .SetUnit( eMetric ); - aListtabMF.SetUnit( eMetric ); - aAlignedAtMF.SetUnit( eMetric ); - aIndentAtMF.SetUnit( eMetric ); -} - -IMPL_LINK( SvxNumPositionTabPage, EditModifyHdl_Impl, Edit *, EMPTYARG ) -{ - sal_uInt16 nMask = 1; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt(pActNum->GetLevel(i)); - - const sal_uInt16 nPos = aAlignLB.IsVisible() - ? aAlignLB.GetSelectEntryPos() - : aAlign2LB.GetSelectEntryPos(); - SvxAdjust eAdjust = SVX_ADJUST_CENTER; - if(nPos == 0) - eAdjust = SVX_ADJUST_LEFT; - else if(nPos == 2) - eAdjust = SVX_ADJUST_RIGHT; - aNumFmt.SetNumAdjust( eAdjust ); - pActNum->SetLevel(i, aNumFmt); - } - nMask <<= 1; - } - SetModified(); - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox ) -{ - sal_uInt16 nSaveNumLvl = nActNumLvl; - nActNumLvl = 0; - if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) && - (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff)) - { - nActNumLvl = 0xFFFF; - pBox->SetUpdateMode(sal_False); - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - pBox->SelectEntryPos( i, sal_False ); - pBox->SetUpdateMode(sal_True); - } - else if(pBox->GetSelectEntryCount()) - { - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - { - if(pBox->IsEntryPosSelected( i )) - nActNumLvl |= nMask; - nMask <<= 1; - } - pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False ); - } - else - { - nActNumLvl = nSaveNumLvl; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - { - if(nActNumLvl & nMask) - { - pBox->SelectEntryPos(i); - break; - } - nMask <<=1; - } - } - aRelativeCB.Enable(nActNumLvl != 1); - SetModified(); - InitPosAndSpaceMode(); - ShowControlsDependingOnPosAndSpaceMode(); - InitControls(); - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) -{ - if(bInInintControl) - return 0; - long nValue = GetCoreValue(*pFld, eCoreUnit); - sal_uInt16 nMask = 1; -#if OSL_DEBUG_LEVEL > 1 - sal_Bool bFirst = sal_True; -#endif - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); - if(pFld == &aDistBorderMF) - { - - if(aRelativeCB.IsChecked()) - { - if(0 == i) - { - long nTmp = aNumFmt.GetFirstLineOffset(); - aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp)); - } - else - { - long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() + - pActNum->GetLevel( i - 1 ).GetFirstLineOffset() - - pActNum->GetLevel( i ).GetFirstLineOffset(); - - aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp)); - } - } - else - { - aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); - } - } - else if(pFld == &aDistNumMF) - { - aNumFmt.SetCharTextDistance( (short)nValue ); - } - else if(pFld == &aIndentMF) - { - //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden - long nDiff = nValue + aNumFmt.GetFirstLineOffset(); - long nAbsLSpace = aNumFmt.GetAbsLSpace(); - aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff)); - aNumFmt.SetFirstLineOffset( -(short)nValue ); - } - -#if OSL_DEBUG_LEVEL > 1 - if(bFirst) - lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); - bFirst = sal_False; -#endif - pActNum->SetLevel( i, aNumFmt ); - } - nMask <<= 1; - } - - SetModified(); - if(!aDistBorderMF.IsEnabled()) - { - String aEmptyStr; - aDistBorderMF.SetText(aEmptyStr); - } - - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox ) -{ - sal_Bool bOn = pBox->IsChecked(); - sal_Bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl; - sal_Bool bSetValue = sal_False; - long nValue = 0; - if(bOn || bSingleSelection) - { - sal_uInt16 nMask = 1; - sal_Bool bFirst = sal_True; - bSetValue = sal_True; - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i); - if(bFirst) - { - nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset(); - if(bOn && i) - nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); - } - else - bSetValue = nValue == - (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) - - (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset()); - bFirst = sal_False; - } - nMask <<= 1; - } - - } - String aEmptyStr; - if(bSetValue) - SetMetricValue(aDistBorderMF, nValue, eCoreUnit); - else - aDistBorderMF.SetText(aEmptyStr); - aDistBorderMF.Enable(bOn || bSingleSelection); - aDistBorderFT.Enable(bOn || bSingleSelection); - bLastRelative = bOn; - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG ) -{ - // determine value to be set at the chosen list levels - SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy = - SvxNumberFormat::LISTTAB; - { - const sal_uInt16 nPos = aLabelFollowedByLB.GetSelectEntryPos(); - if ( nPos == 1 ) - { - eLabelFollowedBy = SvxNumberFormat::SPACE; - } - else if ( nPos == 2 ) - { - eLabelFollowedBy = SvxNumberFormat::NOTHING; - } - } - - // set value at the chosen list levels - bool bSameListtabPos = true; - sal_uInt16 nFirstLvl = USHRT_MAX; - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) - { - if ( nActNumLvl & nMask ) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); - aNumFmt.SetLabelFollowedBy( eLabelFollowedBy ); - pActNum->SetLevel( i, aNumFmt ); - - if ( nFirstLvl == USHRT_MAX ) - { - nFirstLvl = i; - } - else - { - bSameListtabPos &= aNumFmt.GetListtabPos() == - pActNum->GetLevel( nFirstLvl ).GetListtabPos(); - } - } - nMask <<= 1; - } - - // enable/disable metric field for list tab stop position depending on - // selected item following the list label. - aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); - aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB ); - if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB ) - { - SetMetricValue( aListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit ); - } - else - { - aListtabMF.SetText( String() ); - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) - { - if ( nActNumLvl & nMask ) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); - aNumFmt.SetListtabPos( nValue ); - pActNum->SetLevel( i, aNumFmt ); -#if OSL_DEBUG_LEVEL > 1 - lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); -#endif - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) - { - if ( nActNumLvl & nMask ) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); - const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt(); - aNumFmt.SetFirstLineIndent( nFirstLineIndent ); - pActNum->SetLevel( i, aNumFmt ); -#if OSL_DEBUG_LEVEL > 1 - lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); -#endif - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) -{ - // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); - - // set value at the chosen list levels - sal_uInt16 nMask = 1; - for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i ) - { - if ( nActNumLvl & nMask ) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel(i) ); - const long nAlignedAt = aNumFmt.GetIndentAt() + - aNumFmt.GetFirstLineIndent(); - aNumFmt.SetIndentAt( nValue ); - const long nNewFirstLineIndent = nAlignedAt - nValue; - aNumFmt.SetFirstLineIndent( nNewFirstLineIndent ); - pActNum->SetLevel( i, aNumFmt ); -#if OSL_DEBUG_LEVEL > 1 - lcl_PrintDebugOutput(*pDebugFixedText, aNumFmt); -#endif - } - nMask <<= 1; - } - - SetModified(); - - return 0; -} - -IMPL_LINK( SvxNumPositionTabPage, StandardHdl_Impl, PushButton *, EMPTYARG ) -{ - sal_uInt16 nMask = 1; - SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(), - pActNum->GetLevelCount(), - pActNum->IsContinuousNumbering(), - SVX_RULETYPE_NUMBERING, - pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() ); - for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) - { - if(nActNumLvl & nMask) - { - SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); - SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i )); - aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() ); - if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() ); - aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() ); - aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() ); - } - else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) - { - aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() ); - aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() ); - aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() ); - aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() ); - aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() ); - } - - pActNum->SetLevel( i, aNumFmt ); - } - nMask <<= 1; - } - - InitControls(); - SetModified(); - return 0; -} - -void SvxNumPositionTabPage::SetModified(sal_Bool bRepaint) -{ - bModified = sal_True; - if(bRepaint) - { - pPreviewWIN->SetLevel(nActNumLvl); - pPreviewWIN->Invalidate(); - } -} - -void SvxNumOptionsTabPage::SetModified(sal_Bool bRepaint) -{ - bModified = sal_True; - if(bRepaint) - { - pPreviewWIN->SetLevel(nActNumLvl); - pPreviewWIN->Invalidate(); - } -} - - -void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False); - SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False); - SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False); - SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); - - if (pNumCharFmt &&pBulletCharFmt) - SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue()); - - if (pListItem) - { - ListBox& myCharFmtLB = GetCharFmtListBox(); - const std::vector &aList = (pListItem)->GetList(); - sal_uInt32 nCount = aList.size();; - for(sal_uInt32 i = 0; i < nCount; i++) - myCharFmtLB.InsertEntry(aList[i]); - } - if (pMetricItem) - SetMetric(static_cast(pMetricItem->GetValue())); -} - -void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False); - - if (pMetricItem) - SetMetric(static_cast(pMetricItem->GetValue())); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/numpages.hrc b/cui/source/tabpages/numpages.hrc deleted file mode 100644 index 1482de300..000000000 --- a/cui/source/tabpages/numpages.hrc +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FT_ALIGN 50 -#define LB_ALIGN 51 -#define FT_DIST_BORDER 52 -#define MF_DIST_BORDER 53 -#define FT_DIST_NUM 54 -#define MF_DIST_NUM 55 -#define GB_POS 56 - -#define LB_FMT_CHAR 60 -#define FT_FMT_CHAR 61 - -#define FT_WIDTH 67 -#define FI_URL 68 -#define FT_HEIGHT 70 - - -#define MN_STD_NUMBER 120 -#define MD_DEL_NUMBER 121 -#define MN_STD_BULLET 122 -#define MN_DEL_BULLET 123 - -#define STR_BULLET 200 -//#define STR_NUMFMT_1 201 -//#define STR_NUMFMT_2 202 -//#define STR_NUMFMT_3 203 -//#define STR_NUMFMT_4 204 -//#define STR_NUMFMT_5 205 -//#define STR_NUMFMT_6 206 -//#define STR_NUMFMT_7 207 -//#define STR_NUMFMT_8 208 -//#define STR_NUMFMT_7_HTML 209 - -#define LB_FORM 210 -#define ED_FORM 211 -#define GB_FORM 212 - -#define BT_BULLET 213 - -#define FL_VALUES 220 -#define VS_VALUES 221 -#define ST_CUSTOMIZE 222 -#define FT_ERROR 223 -#define CB_LINKED 224 - -#define FT_LEVEL 151 -#define LB_LEVEL 152 -#define FL_FORMAT 153 -#define FL_POSITION 154 -#define FT_PREFIX 155 -#define ED_PREFIX 156 -#define FT_FMT 157 -#define LB_FMT 158 -#define FT_SUFFIX 159 -#define ED_SUFFIX 160 -#define FT_BORDERDIST 161 -#define MF_BORDERDIST 162 -#define FT_NUMDIST 163 -#define MF_NUMDIST 164 -#define FT_INDENT 165 -#define MF_INDENT 166 -#define FT_CHARFMT 167 -#define LB_CHARFMT 168 -#define NF_ALL_LEVEL 169 -#define FT_START 170 -#define ED_START 171 -#define FT_BULLET 172 -#define PB_BULLET 173 -#define WIN_PREVIEW 174 -#define FT_BITMAP 175 -#define PB_SEARCH 176 -#define CB_RATIO 177 -#define FT_SIZE 178 -#define MF_WIDTH 179 -#define FT_MULT 180 -#define MF_HEIGHT 181 -#define FT_ORIENT 182 -#define LB_ORIENT 183 -#define MB_BITMAP 184 -#define CB_RELATIVE 185 -#define FT_ALL_LEVEL 186 -#define PB_STANDARD 187 -#define CB_SAME_LEVEL 188 -#define FL_SAME_LEVEL 189 -#define FT_BUL_COLOR 190 -#define LB_BUL_COLOR 191 -#define FT_BUL_REL_SIZE 192 -#define MF_BUL_REL_SIZE 193 -// 194 removed -#define ST_POPUP_EMPTY_ENTRY 195 - -#define MN_GRAPHIC_DLG 1 -#define MN_GALLERY 2 -#define MN_GALLERY_ENTRY 100 - -#define FT_LABEL_FOLLOWED_BY 250 -#define LB_LABEL_FOLLOWED_BY 251 -#define FT_LISTTAB 252 -#define MF_LISTTAB 253 -#define FT_ALIGN_2 254 -#define LB_ALIGN_2 255 -#define FT_ALIGNED_AT 256 -#define MF_ALIGNED_AT 257 -#define FT_INDENT_AT 258 -#define MF_INDENT_AT 259 - diff --git a/cui/source/tabpages/numpages.src b/cui/source/tabpages/numpages.src deleted file mode 100644 index 3e8808924..000000000 --- a/cui/source/tabpages/numpages.src +++ /dev/null @@ -1,842 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include "numpages.hrc" -#include - -/**************************************************************************/ -/* */ -/* TabPage */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_PICK_BULLET -{ - HelpID = HID_SVXPAGE_PICK_BULLET ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_VALUES - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - Control VS_VALUES - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 242 , 167 ) ; - TabStop = TRUE ; - }; -}; -/**************************************************************************/ -/* */ -/* TabPage */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_PICK_SINGLE_NUM -{ - HelpID = HID_SVXPAGE_PICK_SINGLE_NUM ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_VALUES - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - Control VS_VALUES - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 242 , 167 ) ; - TabStop = TRUE ; - }; -}; -/**************************************************************************/ -/* */ -/* TabPage */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_PICK_NUM -{ - HelpID = HID_SVXPAGE_PICK_NUM; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_VALUES - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - Control VS_VALUES - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 242 , 167 ) ; - TabStop = TRUE ; - }; -}; -/**************************************************************************/ -/* */ -/* TabPage */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_PICK_BMP -{ - HelpID = HID_SVXPAGE_PICK_BMP; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedLine FL_VALUES - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Selection" ; - }; - Control VS_VALUES - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 242 , 152 ) ; - TabStop = TRUE ; - Hide = TRUE ; - }; - CheckBox CB_LINKED - { - HelpID = "cui:CheckBox:RID_SVXPAGE_PICK_BMP:CB_LINKED"; - Pos = MAP_APPFONT ( 9 , 169 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Link graphics"; - }; - FixedText FT_ERROR - { - Pos = MAP_APPFONT ( 9 , 14 ) ; - Size = MAP_APPFONT ( 242 , 30 ) ; - Text [ en-US ] = "The Gallery theme 'Bullets' is empty (no graphics)." ; - Hide = TRUE ; - WordBreak = TRUE ; - }; -}; -/**************************************************************************/ -/* */ -/* TabPage Numerierungsoptionen */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_NUM_OPTIONS -{ - HelpID = HID_SVXPAGE_NUM_OPTIONS ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedText FT_LEVEL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Level" ; - }; - MultiListBox LB_LEVEL - { - HelpID = "cui:MultiListBox:RID_SVXPAGE_NUM_OPTIONS:LB_LEVEL"; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 26 , 154 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - Border = TRUE ; - SimpleMode = TRUE ; - }; - FixedLine FL_FORMAT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Format" ; - }; - FixedText FT_FMT - { - Pos = MAP_APPFONT ( 50 , 27 ) ; - Size = MAP_APPFONT ( 50, 8 ) ; - Text [ en-US ] = "~Numbering" ; - }; - ListBox LB_FMT - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_OPTIONS:LB_FMT"; - Pos = MAP_APPFONT ( 103 , 25 ) ; - Size = MAP_APPFONT ( 67 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "1, 2, 3, ... " ; 4/*SVX_NUM_ARABIC */; > ; - < "A, B, C, ... " ; 0/*SVX_NUM_CHARS_UPPER_LETTER */; > ; - < "a, b, c, ..." ; 1/*SVX_NUM_CHARS_LOWER_LETTER */; > ; - < "I, II, III, ... " ; 2/*SVX_NUM_ROMAN_UPPER */; > ; - < "i, ii, iii, ... " ; 3/*SVX_NUM_ROMAN_LOWER */; > ; - < "A, .., AA, .., AAA, ... " ; 9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ; - < "a, .., aa, .., aaa, ..." ; 10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ; - < "Bullet" ; 6/*SVX_NUM_CHAR_SPECIAL */; > ; - < "Graphics" ; 8/*SVX_NUM_BITMAP */; > ; - < "Linked graphics" ; 0x88/*SVX_NUM_BITMAP|0x80 */; > ; - < "None" ; 5/*SVX_NUM_NUMBER_NONE */; > ; - < "Native Numbering" ; 12 /*NATIVE_NUMBERING */; > ; - < "Ð, Б, .., Ðа, Ðб, ... (Bulgarian)" ; 38 /*CHARS_CYRILLIC_UPPER_LETTER_BG */; > ; - < "а, б, .., аа, аб, ... (Bulgarian)" ; 39 /*CHARS_CYRILLIC_LOWER_LETTER_BG */; > ; - < "Ð, Б, .., Ðа, Бб, ... (Bulgarian)" ; 40 /*CHARS_CYRILLIC_UPPER_LETTER_N_BG */; > ; - < "а, б, .., аа, бб, ... (Bulgarian)" ; 41 /*CHARS_CYRILLIC_LOWER_LETTER_N_BG */; > ; - < "Ð, Б, .., Ðа, Ðб, ... (Russian)" ; 42 /*CHARS_CYRILLIC_UPPER_LETTER_RU */; > ; - < "а, б, .., аа, аб, ... (Russian)" ; 43 /*CHARS_CYRILLIC_LOWER_LETTER_RU */; > ; - < "Ð, Б, .., Ðа, Бб, ... (Russian)" ; 44 /*CHARS_CYRILLIC_UPPER_LETTER_N_RU */; > ; - < "а, б, .., аа, бб, ... (Russian)" ; 45 /*CHARS_CYRILLIC_LOWER_LETTER_N_RU */; > ; - < "Ð, Б, .., Ðа, Ðб, ... (Serbian)" ; 48 /*CHARS_CYRILLIC_UPPER_LETTER_SR */; > ; - < "а, б, .., аа, аб, ... (Serbian)" ; 49 /*CHARS_CYRILLIC_LOWER_LETTER_SR */; > ; - < "Ð, Б, .., Ðа, Бб, ... (Serbian)" ; 50 /*CHARS_CYRILLIC_UPPER_LETTER_N_SR */; > ; - < "а, б, .., аа, бб, ... (Serbian)" ; 51 /*CHARS_CYRILLIC_LOWER_LETTER_N_SR */; > ; - < "Α, Î’, Γ, ... (Greek Upper Letter)"; 52 /*CHARS_GREEK_UPPER_LETTER */; > ; - < "α, β, γ, ... (Greek Lower Letter)"; 53 /*CHARS_GREEK_LOWER_LETTER */; > ; - }; - }; - FixedText FT_PREFIX - { - Pos = MAP_APPFONT ( 50 , 43 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Before" ; - Left = TRUE ; - }; - Edit ED_PREFIX - { - HelpID = "cui:Edit:RID_SVXPAGE_NUM_OPTIONS:ED_PREFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 41 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_SUFFIX - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "After" ; - Left = TRUE ; - }; - Edit ED_SUFFIX - { - HelpID = "cui:Edit:RID_SVXPAGE_NUM_OPTIONS:ED_SUFFIX"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 57 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - MaxTextLength = 50 ; - }; - FixedText FT_CHARFMT - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Character Style" ; - }; - ListBox LB_CHARFMT - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_OPTIONS:LB_CHARFMT"; - TabStop = TRUE ; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 103 , 73 ) ; - Size = MAP_APPFONT ( 67 , 72 ) ; - }; - FixedText FT_BUL_COLOR - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "Color"; - }; - ListBox LB_BUL_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_OPTIONS:LB_BUL_COLOR"; - TabStop = TRUE ; - DropDown = TRUE ; - Pos = MAP_APPFONT ( 103 , 73 ) ; - Size = MAP_APPFONT ( 67 , 100 ) ; - Hide = TRUE; - }; - FixedText FT_BUL_REL_SIZE - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "~Relative size"; - }; - MetricField MF_BUL_REL_SIZE - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_OPTIONS:MF_BUL_REL_SIZE"; - Pos = MAP_APPFONT ( 103 , 89 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - Border = TRUE ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - SpinSize = 1 ; - Minimum = 1; - Maximum = 250; - Hide = TRUE; - }; - FixedText FT_ALL_LEVEL - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Show sublevels" ; - }; - NumericField NF_ALL_LEVEL - { - HelpID = "cui:NumericField:RID_SVXPAGE_NUM_OPTIONS:NF_ALL_LEVEL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 89 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 10 ; - Value = 1 ; - First = 1 ; - Last = 10 ; - }; - FixedText FT_START - { - Pos = MAP_APPFONT ( 50 , 107 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Start at" ; - Left = TRUE ; - }; - NumericField ED_START - { - HelpID = "cui:NumericField:RID_SVXPAGE_NUM_OPTIONS:ED_START"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 105 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 65535 ; - Value = 1 ; - First = 0 ; - Last = 65535 ; - }; - FixedText FT_ALIGN - { - Pos = MAP_APPFONT ( 50 , 135 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Alignment" ; - Hide = TRUE; - }; - ListBox LB_ALIGN - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_OPTIONS:LB_ALIGN"; - Pos = MAP_APPFONT ( 103 , 133 ) ; - Size = MAP_APPFONT ( 40 , 40 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Hide = TRUE; - StringList [ en-US ] = - { - < "Left" ; > ; - < "Centered" ; > ; - < "Right" ; > ; - }; - }; - String STR_BULLET - { - Text [ en-US ] = "Character" ; - }; - PushButton PB_BULLET - { - HelpID = "cui:PushButton:RID_SVXPAGE_NUM_OPTIONS:PB_BULLET"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 103 , 105 ) ; - Size = MAP_APPFONT ( 12 , 12 ) ; - Text = "..." ; - TabStop = TRUE ; - }; - FixedText FT_BITMAP - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 50 , 43 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Graphics" ; - }; - MenuButton MB_BITMAP - { - HelpID = "cui:MenuButton:RID_SVXPAGE_NUM_OPTIONS:MB_BITMAP"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 103 , 41 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - ButtonMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = MN_GRAPHIC_DLG ; - // HelpID = HID_NUM_NAMED_NUMS ; - Text [ en-US ] = "From file..." ; - }; - MenuItem - { - Identifier = MN_GALLERY ; - Text [ en-US ] = "Gallery"; - }; - }; - }; - Text [ en-US ] = "Select..." ; - }; - FixedText FT_SIZE - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 50 , 61 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MF_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_OPTIONS:MF_WIDTH"; - Pos = MAP_APPFONT ( 103 , 59 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Hide = TRUE ; - }; - FixedText FT_MULT - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 50 , 77 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Height" ; - }; - MetricField MF_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_OPTIONS:MF_HEIGHT"; - Pos = MAP_APPFONT ( 103 , 75 ) ; - Size = MAP_APPFONT ( 67 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Hide = TRUE ; - }; - CheckBox CB_RATIO - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUM_OPTIONS:CB_RATIO"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 100 , 10 ) ; - Text [ en-US ] = "Keep ratio" ; - }; - FixedText FT_ORIENT - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 50 , 105 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Alignment" ; - }; - ListBox LB_ORIENT - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_OPTIONS:LB_ORIENT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 103 , 103 ) ; - Size = MAP_APPFONT ( 67 , 72 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - CurPos = 0 ; - StringList [ en-US ] = - { - < "Top of baseline" ; > ; - < "Center of baseline" ; > ; - < "Bottom of baseline" ; > ; - < "Top of character" ; > ; - < "Center of character" ; > ; - < "Bottom of character" ; > ; - < "Top of line" ; > ; - < "Center of line" ; > ; - < "Bottom of line" ; > ; - }; - }; - FixedLine FL_SAME_LEVEL - { - Pos = MAP_APPFONT ( 47 , 156 ) ; - Size = MAP_APPFONT ( 126 , 8 ) ; - Text [ en-US ] = "All levels" ; - }; - CheckBox CB_SAME_LEVEL - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUM_OPTIONS:CB_SAME_LEVEL"; - Pos = MAP_APPFONT ( 53 , 167 ) ; - Size = MAP_APPFONT ( 114 , 10 ) ; - Text [ en-US ] = "~Consecutive numbering" ; - }; - Window WIN_PREVIEW - { - Pos = MAP_APPFONT ( 179 , 25 ) ; - Size = MAP_APPFONT ( 69 , 154 ) ; - Border = TRUE ; - }; - String ST_POPUP_EMPTY_ENTRY - { - Text [ en-US ] = "There are no graphics in the 'Bullets' Gallery theme."; - }; - -}; -/**************************************************************************/ -/* */ -/* TabPage Positionen */ -/* */ -/**************************************************************************/ -TabPage RID_SVXPAGE_NUM_POSITION -{ - HelpID = HID_SVXPAGE_NUM_POSITION ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Hide = TRUE; - FixedText FT_LEVEL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 50, 8 ) ; - Text [ en-US ] = "Level" ; - }; - MultiListBox LB_LEVEL - { - HelpID = "cui:MultiListBox:RID_SVXPAGE_NUM_POSITION:LB_LEVEL"; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 26 , 154 ) ; - TabStop = TRUE ; - DropDown = FALSE ; - Border = TRUE ; - SimpleMode = TRUE ; - }; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Group = TRUE ; - Text [ en-US ] = "Position and spacing" ; - }; - FixedText FT_BORDERDIST - { - Pos = MAP_APPFONT ( 50 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "Indent" ; - }; - MetricField MF_BORDERDIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_BORDERDIST"; - Pos = MAP_APPFONT ( 198 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - CheckBox CB_RELATIVE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_NUM_POSITION:CB_RELATIVE"; - Pos = MAP_APPFONT ( 198 , 41 ) ; - Size = MAP_APPFONT ( 52 , 10 ) ; - Text [ en-US ] = "Relati~ve" ; - }; - FixedText FT_INDENT - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Width of numbering" ; - }; - MetricField MF_INDENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_INDENT"; - Pos = MAP_APPFONT ( 198 , 57 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - FixedText FT_NUMDIST - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Minimum space numbering <-> text" ; - }; - MetricField MF_NUMDIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_NUMDIST"; - Pos = MAP_APPFONT ( 198 , 73 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_ALIGN - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "N~umbering alignment" ; - }; - ListBox LB_ALIGN - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_POSITION:LB_ALIGN"; - Pos = MAP_APPFONT ( 198 , 89 ) ; - Size = MAP_APPFONT ( 40 , 40 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Left" ; > ; - < "Centered" ; > ; - < "Right" ; > ; - }; - }; - FixedText FT_LABEL_FOLLOWED_BY - { - Pos = MAP_APPFONT ( 50 , 27 ) ; - Size = MAP_APPFONT ( 105 , 10 ) ; - Text [ en-US ] = "Numbering followed by" ; - }; - ListBox LB_LABEL_FOLLOWED_BY - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_POSITION:LB_LABEL_FOLLOWED_BY"; - Pos = MAP_APPFONT ( 198 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Tab stop" ; > ; - < "Space" ; > ; - < "Nothing" ; > ; - }; - }; - FixedText FT_LISTTAB - { - Pos = MAP_APPFONT ( 50 , 43 ) ; - Size = MAP_APPFONT ( 143 , 10 ) ; - Right = TRUE ; - Text [ en-US ] = "at" ; - }; - MetricField MF_LISTTAB - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_LISTTAB"; - Pos = MAP_APPFONT ( 198 , 41 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - }; - FixedText FT_ALIGN_2 - { - Pos = MAP_APPFONT ( 50 , 59 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - }; - ListBox LB_ALIGN_2 - { - HelpID = "cui:ListBox:RID_SVXPAGE_NUM_POSITION:LB_ALIGN_2"; - Pos = MAP_APPFONT ( 198 , 57 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_ALIGNED_AT - { - Pos = MAP_APPFONT ( 50 , 75 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Aligned at" ; - }; - MetricField MF_ALIGNED_AT - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_ALIGNED_AT"; - Pos = MAP_APPFONT ( 198 , 73 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_INDENT_AT - { - Pos = MAP_APPFONT ( 50 , 91 ) ; - Size = MAP_APPFONT ( 105 , 8 ) ; - Text [ en-US ] = "Indent at" ; - }; - MetricField MF_INDENT_AT - { - HelpID = "cui:MetricField:RID_SVXPAGE_NUM_POSITION:MF_INDENT_AT"; - Pos = MAP_APPFONT ( 198 , 89 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -1999 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Border = TRUE ; - TabStop = TRUE ; - }; - PushButton PB_STANDARD - { - HelpID = "cui:PushButton:RID_SVXPAGE_NUM_POSITION:PB_STANDARD"; - Pos = MAP_APPFONT ( 198 , 165 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Default" ; - }; - Window WIN_PREVIEW - { - Pos = MAP_APPFONT ( 50 , 113 ) ; - Size = MAP_APPFONT ( 143 , 67 ) ; - Border = TRUE ; - }; -}; - -String RID_STR_EDIT_GRAPHIC -{ - Text [ en-US ] = "Link" ; -}; -/* -String RID_STR_FULLNUMS_1 { Text = "1.|1.1|a)|61589|61589" ; }; -String RID_STR_FULLNUMS_2 { Text = "1.|a)|61589|61589|61589" ; }; -String RID_STR_FULLNUMS_3 { Text = "1.|(a)|i.|A.|61589" ; }; -String RID_STR_FULLNUMS_4 { Text = "1.|1.|1.|1.|1." ; }; -String RID_STR_FULLNUMS_5 { Text = "I.|A.|i.|a)|61589" ; }; -String RID_STR_FULLNUMS_6 { Text = "A.|I.|a.|i.|61589" ; }; -String RID_STR_FULLNUMS_7 { Text = "1|1.1|1.1.1|1.1.1.1|1.1.1.1.1" ; }; -String RID_STR_FULLNUMS_8 { Text = "61487|61488|61485|61589|61589" ; }; -String RID_STR_FULLNUMS_7_HTML { Text = "I.|I.|I|I.|I." ; }; -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx deleted file mode 100644 index e3c0c6a59..000000000 --- a/cui/source/tabpages/page.cxx +++ /dev/null @@ -1,1768 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "svx/htmlmode.hxx" -#include - -#define _SVX_PAGE_CXX - -#include -#include "page.hrc" -#include "helpid.hrc" -#include "page.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "svx/dlgutil.hxx" -#include -#include -#include -#include -#include // for RID_SVXPAGE_PAGE -#include -#include // for RID_SVXSTR_PAPERBIN..., -#include - -// #i4219# -#include -#include -#include -#include -// configuration helper ======================================================= - -/** Helper to get a configuration setting. - @descr This is a HACK to get a configuration item directly. Normally the - OfaHtmlOptions class from 'offmgr' project would do the job, but we cannot - use it here. On the other hand, the OfaHtmlOptions cannot be moved to - 'svtools', because it uses 'svx' itself... - The correct way would be to move OfaHtmlOptions to 'svtools' anyway, and to - remove the dependency from 'svx' (a call to the static function - SvxTextEncodingBox::GetBestMimeEncoding(), which contains low level - operations that can be moved to lower projects, i.e. 'rtl'). Then this - class can be removed, and the OfaHtmlOptions can be used instead. */ -class SvxHtmlExportModeConfigItem_Impl : public utl::ConfigItem -{ -public: - explicit SvxHtmlExportModeConfigItem_Impl(); - - /** Returns the HTML export mode, as read from the configuration. */ - inline sal_Int32 GetExportMode() const { return mnExpMode; } - - /** Returns true, if the current HTML export mode is set to HTML 3.2. */ - inline bool IsExportModeHTML32() const { return mnExpMode == 0; } // 0 == HTML_CFG_HTML32, see offmgr/htmlcfg.hxx - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); - -private: - sal_Int32 mnExpMode; -}; - -SvxHtmlExportModeConfigItem_Impl::SvxHtmlExportModeConfigItem_Impl() : - utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/HTML/Export" ) ) ), - mnExpMode( 3 ) // default to 3 == HTML_CFG_NS40, see offmgr/htmlcfg.hxx -{ - using com::sun::star::uno::Sequence; - using com::sun::star::uno::Any; - - Sequence< rtl::OUString > aPropNames( 1 ); - aPropNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Browser" ) ); - Sequence< Any > aPropValues( GetProperties( aPropNames ) ); - if( aPropValues.getLength() == 1 ) - aPropValues[ 0 ] >>= mnExpMode; -} - -void SvxHtmlExportModeConfigItem_Impl::Commit() -{ -} - -void SvxHtmlExportModeConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) -{ -} - -// static ---------------------------------------------------------------- - -static const long MINBODY = 284; // 0,5cm in twips aufgerundet -//static const long PRINT_OFFSET = 17; // 0,03cm in twips abgerundet -static const long PRINT_OFFSET = 0; // why was this ever set to 17 ? it led to wrong right and bottom margins. - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_BORDER_OUTER, - SID_ATTR_BORDER_SHADOW, - SID_ATTR_LRSPACE, - SID_ATTR_PAGE_SHARED, - SID_SWREGISTER_COLLECTION, - SID_SWREGISTER_MODE, - 0 -}; - -// ------- Mapping Seitenlayout ------------------------------------------ - -sal_uInt16 aArr[] = -{ - SVX_PAGE_ALL, - SVX_PAGE_MIRROR, - SVX_PAGE_RIGHT, - SVX_PAGE_LEFT -}; - -// ----------------------------------------------------------------------- - -sal_uInt16 PageUsageToPos_Impl( sal_uInt16 nUsage ) -{ - for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) - if ( aArr[i] == ( nUsage & 0x000f ) ) - return i; - return SVX_PAGE_ALL; -} - -// ----------------------------------------------------------------------- - -sal_uInt16 PosToPageUsage_Impl( sal_uInt16 nPos ) -{ - if ( nPos >= SAL_N_ELEMENTS(aArr) ) - return 0; - return aArr[nPos]; -} - -// ----------------------------------------------------------------------- - -Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) -{ - Size aSz; - aSz.Height() = rShadow.CalcShadowSpace( SHADOW_BOTTOM ) + rBox.CalcLineSpace( BOX_LINE_BOTTOM ); - aSz.Height() += rShadow.CalcShadowSpace( SHADOW_TOP ) + rBox.CalcLineSpace( BOX_LINE_TOP ); - aSz.Width() = rShadow.CalcShadowSpace( SHADOW_LEFT ) + rBox.CalcLineSpace( BOX_LINE_LEFT ); - aSz.Width() += rShadow.CalcShadowSpace( SHADOW_RIGHT ) + rBox.CalcLineSpace( BOX_LINE_RIGHT ); - return aSz; -} - -// ----------------------------------------------------------------------- - -long ConvertLong_Impl( const long nIn, SfxMapUnit eUnit ) -{ - return OutputDevice::LogicToLogic( nIn, (MapUnit)eUnit, MAP_TWIP ); -} - -sal_Bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) -{ - if ( pSize ) - { - Size aSize = pSize->GetSize(); - long nDiffW = Abs( rSize.Width () - aSize.Width () ); - long nDiffH = Abs( rSize.Height() - aSize.Height() ); - return ( nDiffW < 10 && nDiffH < 10 ); - } - else - return sal_False; -} - -// ----------------------------------------------------------------------- - -#define MARGIN_LEFT ( (MarginPosition)0x0001 ) -#define MARGIN_RIGHT ( (MarginPosition)0x0002 ) -#define MARGIN_TOP ( (MarginPosition)0x0004 ) -#define MARGIN_BOTTOM ( (MarginPosition)0x0008 ) - -struct SvxPage_Impl -{ - MarginPosition m_nPos; - Printer* mpDefPrinter; - bool mbDelPrinter; - - SvxPage_Impl() : - m_nPos( 0 ), - mpDefPrinter( 0 ), - mbDelPrinter( false ) {} - - ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; } -}; - -// class SvxPageDescPage -------------------------------------------------- - -// gibt den Bereich der Which-Werte zur"uck - -sal_uInt16* SvxPageDescPage::GetRanges() -{ - return pRanges; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxPageDescPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_PAGE ), rAttr ), - - aPaperSizeFl ( this, CUI_RES( FL_PAPER_SIZE ) ), - aPaperFormatText ( this, CUI_RES( FT_PAPER_FORMAT ) ), - aPaperSizeBox ( this, CUI_RES( LB_PAPER_SIZE ) ), - aPaperWidthText ( this, CUI_RES( FT_PAPER_WIDTH ) ), - aPaperWidthEdit ( this, CUI_RES( ED_PAPER_WIDTH ) ), - aPaperHeightText ( this, CUI_RES( FT_PAPER_HEIGHT ) ), - aPaperHeightEdit ( this, CUI_RES( ED_PAPER_HEIGHT ) ), - aOrientationFT ( this, CUI_RES( FT_ORIENTATION ) ), - aPortraitBtn ( this, CUI_RES( RB_PORTRAIT ) ), - aLandscapeBtn ( this, CUI_RES( RB_LANDSCAPE ) ), - aBspWin ( this, CUI_RES( WN_BSP ) ), - aTextFlowLbl ( this, CUI_RES( FT_TEXT_FLOW ) ), - aTextFlowBox ( this, CUI_RES( LB_TEXT_FLOW ) ), - aPaperTrayLbl ( this, CUI_RES( FT_PAPER_TRAY ) ), - aPaperTrayBox ( this, CUI_RES( LB_PAPER_TRAY ) ), - aMarginFl ( this, CUI_RES( FL_MARGIN ) ), - aLeftMarginLbl ( this, CUI_RES( FT_LEFT_MARGIN ) ), - aLeftMarginEdit ( this, CUI_RES( ED_LEFT_MARGIN ) ), - aRightMarginLbl ( this, CUI_RES( FT_RIGHT_MARGIN ) ), - aRightMarginEdit ( this, CUI_RES( ED_RIGHT_MARGIN ) ), - aTopMarginLbl ( this, CUI_RES( FT_TOP_MARGIN ) ), - aTopMarginEdit ( this, CUI_RES( ED_TOP_MARGIN ) ), - aBottomMarginLbl ( this, CUI_RES( FT_BOTTOM_MARGIN ) ), - aBottomMarginEdit ( this, CUI_RES( ED_BOTTOM_MARGIN ) ), - aBottomSeparatorFl ( this, CUI_RES( FL_BOTTOM_SEP ) ), - aLayoutFL ( this, CUI_RES( FL_LAYOUT ) ), - aPageText ( this, CUI_RES( FT_PAGELAYOUT ) ), - aLayoutBox ( this, CUI_RES( LB_LAYOUT ) ), - aNumberFormatText ( this, CUI_RES( FT_NUMBER_FORMAT ) ), - aNumberFormatBox ( this, CUI_RES( LB_NUMBER_FORMAT ) ), - aTblAlignFT ( this, CUI_RES( FT_TBL_ALIGN ) ), - aHorzBox ( this, CUI_RES( CB_HORZ ) ), - aVertBox ( this, CUI_RES( CB_VERT ) ), - aAdaptBox ( this, CUI_RES( CB_ADAPT ) ), - aRegisterCB ( this, CUI_RES( CB_REGISTER ) ), - aRegisterFT ( this, CUI_RES( FT_REGISTER ) ), - aRegisterLB ( this, CUI_RES( LB_REGISTER ) ), - - aInsideText ( CUI_RES( STR_INSIDE ) ), - aOutsideText ( CUI_RES( STR_OUTSIDE ) ), - aPrintRangeQueryText( CUI_RES( STR_QUERY_PRINTRANGE ) ), - - bLandscape ( sal_False ), - eMode ( SVX_PAGE_MODE_STANDARD ), - ePaperStart ( PAPER_A3 ), - ePaperEnd ( PAPER_ENV_DL ), - pImpl ( new SvxPage_Impl ) - -{ - bBorderModified = sal_False; - FreeResource(); - aBspWin.EnableRTL( sal_False ); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - SvtLanguageOptions aLangOptions; - sal_Bool bCJK = aLangOptions.IsAsianTypographyEnabled(); - sal_Bool bCTL = aLangOptions.IsCTLFontEnabled(); - sal_Bool bWeb = sal_False; - const SfxPoolItem* pItem; - - SfxObjectShell* pShell; - if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, sal_False, &pItem) || - ( 0 != (pShell = SfxObjectShell::Current()) && - 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) - bWeb = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); - - // #109989# get the HTML export setting from configuration. - // !! This is a hack, see comments in SvxHtmlExportModeConfigItem_Impl class above. - bool bHTML32 = SvxHtmlExportModeConfigItem_Impl().IsExportModeHTML32(); - - // fill text flow listbox with valid entries - aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_HORI ), FRMDIR_HORI_LEFT_TOP ); - if( bCTL ) - aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_HORI ), FRMDIR_HORI_RIGHT_TOP ); - // #109989# do not show vertical directions in Writer/Web - if( !bWeb ) - { - if( bCJK ) - { - aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_RTL_VERT ), FRMDIR_VERT_TOP_RIGHT ); -// aTextFlowBox.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_PAGEDIR_LTR_VERT ), FRMDIR_VERT_TOP_LEFT ); - } - } - - // #109989# show the text direction box in Writer/Web too, but only, if HTML export mode is not HTML3.2. - if( !(bWeb && bHTML32) && (bCJK || bCTL) && - SFX_ITEM_UNKNOWN < rAttr.GetItemState(GetWhich( SID_ATTR_FRAMEDIRECTION ))) - { - aTextFlowLbl.Show(); - aTextFlowBox.Show(); - aTextFlowBox.SetSelectHdl(LINK(this, SvxPageDescPage, FrameDirectionModify_Impl )); - - aBspWin.EnableFrameDirection(sal_True); - } - Init_Impl(); - - FieldUnit eFUnit = GetModuleFieldUnit( rAttr ); - SetFieldUnit( aLeftMarginEdit, eFUnit ); - SetFieldUnit( aRightMarginEdit, eFUnit ); - SetFieldUnit( aTopMarginEdit, eFUnit ); - SetFieldUnit( aBottomMarginEdit, eFUnit ); - SetFieldUnit( aPaperWidthEdit, eFUnit ); - SetFieldUnit( aPaperHeightEdit, eFUnit ); - - if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() ) - pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter(); - else - { - pImpl->mpDefPrinter = new Printer; - pImpl->mbDelPrinter = true; - } - - MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); - pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); - - // First- und Last-Werte f"ur die R"ander setzen - Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); - Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); - /* - * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, - * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des - * Koordinatensystems verschoben ist. - */ - Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - - pImpl->mpDefPrinter->PixelToLogic( Point() ); - pImpl->mpDefPrinter->SetMapMode( aOldMode ); - - long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; - aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( aPrintOffset.X() ), FUNIT_TWIP ); - nFirstLeftMargin = static_cast(aLeftMarginEdit.GetFirst()); - aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( - aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset ), FUNIT_TWIP); - nFirstRightMargin = static_cast(aRightMarginEdit.GetFirst()); - aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( aPrintOffset.Y() ), FUNIT_TWIP ); - nFirstTopMargin = static_cast(aTopMarginEdit.GetFirst()); - aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( - aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset ), FUNIT_TWIP ); - nFirstBottomMargin = static_cast(aBottomMarginEdit.GetFirst()); - aLeftMarginEdit.SetLast( aLeftMarginEdit.Normalize( - aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); - nLastLeftMargin = static_cast(aLeftMarginEdit.GetLast()); - aRightMarginEdit.SetLast( aRightMarginEdit.Normalize( - aPrintOffset.X() + aPrintSize.Width() ), FUNIT_TWIP ); - nLastRightMargin = static_cast(aRightMarginEdit.GetLast()); - aTopMarginEdit.SetLast( aTopMarginEdit.Normalize( - aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); - nLastTopMargin = static_cast(aTopMarginEdit.GetLast()); - aBottomMarginEdit.SetLast( aBottomMarginEdit.Normalize( - aPrintOffset.Y() + aPrintSize.Height() ), FUNIT_TWIP ); - nLastBottomMargin = static_cast(aBottomMarginEdit.GetLast()); - - // #i4219# get DrawingLayer options - const SvtOptionsDrawinglayer aDrawinglayerOpt; - - // #i4219# take Maximum now from configuration (1/100th cm) - // was: 11900 -> 119 cm ;new value 3 meters -> 300 cm -> 30000 - aPaperWidthEdit.SetMax(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); - aPaperWidthEdit.SetLast(aPaperWidthEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperWidth()), FUNIT_CM); - aPaperHeightEdit.SetMax(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); - aPaperHeightEdit.SetLast(aPaperHeightEdit.Normalize(aDrawinglayerOpt.GetMaximumPaperHeight()), FUNIT_CM); - - // #i4219# also for margins (1/100th cm). Was: 9999, keeping. - aLeftMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); - aLeftMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperLeftMargin()); - aRightMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperRightMargin()); - aRightMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperRightMargin()); - aTopMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperTopMargin()); - aTopMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperTopMargin()); - aBottomMarginEdit.SetMax(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); - aBottomMarginEdit.SetLast(aDrawinglayerOpt.GetMaximumPaperBottomMargin()); - - aPortraitBtn.SetAccessibleRelationMemberOf(&aOrientationFT); - aLandscapeBtn.SetAccessibleRelationMemberOf(&aOrientationFT); -} - -// ----------------------------------------------------------------------- - -SvxPageDescPage::~SvxPageDescPage() -{ - delete pImpl; -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::Init_Impl() -{ - aLeftText = aLeftMarginLbl.GetText(); - aRightText = aRightMarginLbl.GetText(); - - // Handler einstellen - aLayoutBox.SetSelectHdl( LINK( this, SvxPageDescPage, LayoutHdl_Impl ) ); - aPaperSizeBox.SetDropDownLineCount(10); - - aPaperTrayBox.SetGetFocusHdl( - LINK( this, SvxPageDescPage, PaperBinHdl_Impl ) ); - aPaperSizeBox.SetSelectHdl( - LINK( this, SvxPageDescPage, PaperSizeSelect_Impl ) ); - aPaperWidthEdit.SetModifyHdl( - LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); - aPaperHeightEdit.SetModifyHdl( - LINK( this, SvxPageDescPage, PaperSizeModify_Impl ) ); - aLandscapeBtn.SetClickHdl( - LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); - aPortraitBtn.SetClickHdl( - LINK( this, SvxPageDescPage, SwapOrientation_Impl ) ); - - Link aLink = LINK( this, SvxPageDescPage, BorderModify_Impl ); - aLeftMarginEdit.SetModifyHdl( aLink ); - aRightMarginEdit.SetModifyHdl( aLink ); - aTopMarginEdit.SetModifyHdl( aLink ); - aBottomMarginEdit.SetModifyHdl( aLink ); - - aLink = LINK( this, SvxPageDescPage, RangeHdl_Impl ); - aPaperWidthEdit.SetLoseFocusHdl( aLink ); - aPaperHeightEdit.SetLoseFocusHdl( aLink ); - aLeftMarginEdit.SetLoseFocusHdl( aLink ); - aRightMarginEdit.SetLoseFocusHdl( aLink ); - aTopMarginEdit.SetLoseFocusHdl( aLink ); - aBottomMarginEdit.SetLoseFocusHdl( aLink ); - - aHorzBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); - aVertBox.SetClickHdl( LINK( this, SvxPageDescPage, CenterHdl_Impl ) ); - -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::Reset( const SfxItemSet& rSet ) -{ - SfxItemPool* pPool = rSet.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ); - - // R"ander (Links/Rechts) einstellen - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE ); - - if ( pItem ) - { - const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem; - SetMetricValue( aLeftMarginEdit, rLRSpace.GetLeft(), eUnit ); - aBspWin.SetLeft( - (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetLeft(), eUnit ) ); - SetMetricValue( aRightMarginEdit, rLRSpace.GetRight(), eUnit ); - aBspWin.SetRight( - (sal_uInt16)ConvertLong_Impl( (long)rLRSpace.GetRight(), eUnit ) ); - } - - // R"ander (Oben/Unten) einstellen - pItem = GetItem( rSet, SID_ATTR_ULSPACE ); - - if ( pItem ) - { - const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem; - SetMetricValue( aTopMarginEdit, rULSpace.GetUpper(), eUnit ); - aBspWin.SetTop( - (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetUpper(), eUnit ) ); - SetMetricValue( aBottomMarginEdit, rULSpace.GetLower(), eUnit ); - aBspWin.SetBottom( - (sal_uInt16)ConvertLong_Impl( (long)rULSpace.GetLower(), eUnit ) ); - } - - // allgemeine Seitendaten - SvxNumType eNumType = SVX_ARABIC; - bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ); - sal_uInt16 nUse = (sal_uInt16)SVX_PAGE_ALL; - pItem = GetItem( rSet, SID_ATTR_PAGE ); - - if ( pItem ) - { - const SvxPageItem& rItem = (const SvxPageItem&)*pItem; - eNumType = rItem.GetNumType(); - nUse = rItem.GetPageUsage(); - bLandscape = rItem.IsLandscape(); - } - - // Ausrichtung - aLayoutBox.SelectEntryPos( ::PageUsageToPos_Impl( nUse ) ); - aBspWin.SetUsage( nUse ); - LayoutHdl_Impl( 0 ); - - // Numerierungsart der Seitenvorlage einstellen - aNumberFormatBox.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(eNumType) ); - - // Aktueller Papierschacht - aPaperTrayBox.Clear(); - sal_uInt8 nPaperBin = PAPERBIN_PRINTER_SETTINGS; - pItem = GetItem( rSet, SID_ATTR_PAGE_PAPERBIN ); - - if ( pItem ) - { - nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue(); - - if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() ) - nPaperBin = PAPERBIN_PRINTER_SETTINGS; - } - - String aBinName; - - if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin ) - aBinName = EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ); - else - aBinName = pImpl->mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin ); - - sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( aBinName ); - aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)nPaperBin ); - aPaperTrayBox.SelectEntry( aBinName ); - - // Size rausholen - Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter ); - pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); - - if ( pItem ) - aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize(); - - bool bOrientationSupport = - pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION ); - - if ( !bOrientationSupport && - aPaperSize.Width() > aPaperSize.Height() ) - bLandscape = sal_True; - - aLandscapeBtn.Check( bLandscape ); - aPortraitBtn.Check( !bLandscape ); - - aBspWin.SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ), - ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) ); - - aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MAP_100TH_MM); - if ( bLandscape ) - Swap( aPaperSize ); - - // Actual Paper Format - Paper ePaper = SvxPaperInfo::GetSvxPaper( aPaperSize, MAP_100TH_MM, sal_True ); - - if ( PAPER_USER != ePaper ) - aPaperSize = SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ); - - if ( bLandscape ) - Swap( aPaperSize ); - - // Werte in die Edits eintragen - SetMetricValue( aPaperHeightEdit, aPaperSize.Height(), SFX_MAPUNIT_100TH_MM ); - SetMetricValue( aPaperWidthEdit, aPaperSize.Width(), SFX_MAPUNIT_100TH_MM ); - aPaperSizeBox.Clear(); - - sal_uInt16 nActPos = LISTBOX_ENTRY_NOTFOUND; - sal_uInt16 nAryId = RID_SVXSTRARY_PAPERSIZE_STD; - - if ( ePaperStart != PAPER_A3 ) - nAryId = RID_SVXSTRARY_PAPERSIZE_DRAW; - ResStringArray aPaperAry( CUI_RES( nAryId ) ); - sal_uInt32 nCnt = aPaperAry.Count(); - - sal_uInt16 nUserPos = LISTBOX_ENTRY_NOTFOUND; - for ( sal_uInt32 i = 0; i < nCnt; ++i ) - { - String aStr = aPaperAry.GetString(i); - Paper eSize = (Paper)aPaperAry.GetValue(i); - sal_uInt16 nPos = aPaperSizeBox.InsertEntry( aStr ); - aPaperSizeBox.SetEntryData( nPos, (void*)(sal_uLong)eSize ); - - if ( eSize == ePaper ) - nActPos = nPos; - if( eSize == PAPER_USER ) - nUserPos = nPos; - } - // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead - aPaperSizeBox.SelectEntryPos( nActPos != LISTBOX_ENTRY_NOTFOUND ? nActPos : nUserPos ); - - // Applikationsspezifisch - - switch ( eMode ) - { - case SVX_PAGE_MODE_CENTER: - { - aTblAlignFT.Show(); - aHorzBox.Show(); - aVertBox.Show(); - DisableVerticalPageDir(); - - // Horizontale Ausrichtung - pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); - aHorzBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() - : sal_False ); - - // Vertikale Ausrichtung - pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 ); - aVertBox.Check( pItem ? ( (const SfxBoolItem*)pItem )->GetValue() - : sal_False ); - - // Beispiel-Fenster auf Tabelle setzen - aBspWin.SetTable( sal_True ); - aBspWin.SetHorz( aHorzBox.IsChecked() ); - aBspWin.SetVert( aVertBox.IsChecked() ); - - break; - } - - case SVX_PAGE_MODE_PRESENTATION: - { - DisableVerticalPageDir(); - aAdaptBox.Show(); - pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 ); - aAdaptBox.Check( pItem ? - ( (const SfxBoolItem*)pItem )->GetValue() : sal_False ); - - //!!! hidden, weil von StarDraw nicht implementiert - aLayoutBox.Hide(); - aPageText.Hide(); - - break; - } - default: ;//prevent warning - } - - - // im Beispiel Hintergrund und Umrandung anzeigen - ResetBackground_Impl( rSet ); -//! UpdateExample_Impl(); - RangeHdl_Impl( 0 ); - - // Header Footer anzeigen - InitHeadFoot_Impl( rSet ); - - // R"ander auf Hoch/Quer updaten, dann Beispiel updaten - bBorderModified = sal_False; - SwapFirstValues_Impl( sal_False ); - UpdateExample_Impl(); - - // Alte Werte sichern - aLeftMarginEdit.SaveValue(); - aRightMarginEdit.SaveValue(); - aTopMarginEdit.SaveValue(); - aBottomMarginEdit.SaveValue(); - aLayoutBox.SaveValue(); - aNumberFormatBox.SaveValue(); - aPaperSizeBox.SaveValue(); - aPaperWidthEdit.SaveValue(); - aPaperHeightEdit.SaveValue(); - aPortraitBtn.SaveValue(); - aLandscapeBtn.SaveValue(); - aPaperTrayBox.SaveValue(); - aVertBox.SaveValue(); - aHorzBox.SaveValue(); - aAdaptBox.SaveValue(); - - CheckMarginEdits( true ); - - // Registerhaltigkeit - if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_MODE)) - { - aRegisterCB.Check(((const SfxBoolItem&)rSet.Get( - SID_SWREGISTER_MODE)).GetValue()); - aRegisterCB.SaveValue(); - RegisterModify(&aRegisterCB); - } - if(SFX_ITEM_SET == rSet.GetItemState(SID_SWREGISTER_COLLECTION)) - { - aRegisterLB.SelectEntry( - ((const SfxStringItem&)rSet.Get(SID_SWREGISTER_COLLECTION)).GetValue()); - aRegisterLB.SaveValue(); - } - - SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ), - sal_True, &pItem ); - if( SFX_ITEM_UNKNOWN != eState ) - { - sal_uInt32 nVal = SFX_ITEM_SET == eState - ? ((SvxFrameDirectionItem*)pItem)->GetValue() - : 0; - aTextFlowBox.SelectEntryValue( static_cast< SvxFrameDirection >( nVal ) ); - aTextFlowBox.SaveValue(); - aBspWin.SetFrameDirection(nVal); - } -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::FillUserData() -{ - if ( SVX_PAGE_MODE_PRESENTATION == eMode ) - SetUserData( UniString::CreateFromInt32( (sal_Int32)aAdaptBox.IsChecked() ) ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxPageDescPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = sal_False; - const SfxItemSet& rOldSet = GetItemSet(); - SfxItemPool* pPool = rOldSet.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE ); - SfxMapUnit eUnit = pPool->GetMetric( nWhich ); - const SfxPoolItem* pOld = 0; - - // alten linken und rechten Rand kopieren - SvxLRSpaceItem aMargin( (const SvxLRSpaceItem&)rOldSet.Get( nWhich ) ); - - // alten oberen und unteren Rand kopieren - nWhich = GetWhich( SID_ATTR_ULSPACE ); - SvxULSpaceItem aTopMargin( (const SvxULSpaceItem&)rOldSet.Get( nWhich ) ); - - if ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) - { - aMargin.SetLeft( (sal_uInt16)GetCoreValue( aLeftMarginEdit, eUnit ) ); - bModified |= sal_True; - } - - if ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) - { - aMargin.SetRight( (sal_uInt16)GetCoreValue( aRightMarginEdit, eUnit ) ); - bModified |= sal_True; - } - - // Linken und rechten Rand setzen - if ( bModified ) - { - pOld = GetOldItem( rSet, SID_ATTR_LRSPACE ); - - if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ) - rSet.Put( aMargin ); - else - bModified = sal_False; - } - - sal_Bool bMod = sal_False; - - if ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) - { - aTopMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopMarginEdit, eUnit ) ); - bMod |= sal_True; - } - - if ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) - { - aTopMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomMarginEdit, eUnit ) ); - bMod |= sal_True; - } - - // unteren oberen Rand setzen - // - if ( bMod ) - { - pOld = GetOldItem( rSet, SID_ATTR_ULSPACE ); - - if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aTopMargin ) ) - { - bModified |= sal_True; - rSet.Put( aTopMargin ); - } - } - - // Druckerschacht - nWhich = GetWhich( SID_ATTR_PAGE_PAPERBIN ); - sal_uInt16 nPos = aPaperTrayBox.GetSelectEntryPos(); - sal_uInt16 nBin = (sal_uInt16)(sal_uLong)aPaperTrayBox.GetEntryData( nPos ); - pOld = GetOldItem( rSet, SID_ATTR_PAGE_PAPERBIN ); - - if ( !pOld || ( (const SvxPaperBinItem*)pOld )->GetValue() != nBin ) - { - rSet.Put( SvxPaperBinItem( nWhich, (sal_uInt8)nBin ) ); - bModified |= sal_True; - } - - nPos = aPaperSizeBox.GetSelectEntryPos(); - Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); - const sal_uInt16 nOld = aPaperSizeBox.GetSavedValue(); - sal_Bool bChecked = aLandscapeBtn.IsChecked(); - - if ( PAPER_USER == ePaper ) - { - if ( nOld != nPos || - aPaperWidthEdit.IsValueModified() || - aPaperHeightEdit.IsValueModified() || - bChecked != aLandscapeBtn.GetSavedValue() ) - { - Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), - GetCoreValue( aPaperHeightEdit, eUnit ) ); - pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); - - if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) - { - rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); - bModified |= sal_True; - } - } - } - else - { - if ( nOld != nPos || bChecked != aLandscapeBtn.GetSavedValue() ) - { - Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) ); - - if ( bChecked ) - Swap( aSize ); - - pOld = GetOldItem( rSet, SID_ATTR_PAGE_SIZE ); - - if ( !pOld || ( (const SvxSizeItem*)pOld )->GetSize() != aSize ) - { - rSet.Put( SvxSizeItem( GetWhich(SID_ATTR_PAGE_SIZE), aSize ) ); - bModified |= sal_True; - } - } - } - - // sonstiges Zeug der Page - nWhich = GetWhich( SID_ATTR_PAGE ); - SvxPageItem aPage( (const SvxPageItem&)rOldSet.Get( nWhich ) ); - bMod = aLayoutBox.GetSelectEntryPos() != aLayoutBox.GetSavedValue(); - - if ( bMod ) - aPage.SetPageUsage( - ::PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); - - if ( bChecked != aLandscapeBtn.GetSavedValue() ) - { - aPage.SetLandscape(bChecked); - bMod |= sal_True; - } - - // Einstellen der Numerierungsart der Seite - nPos = aNumberFormatBox.GetSelectEntryPos(); - - if ( nPos != aNumberFormatBox.GetSavedValue() ) - { - aPage.SetNumType( (SvxNumType)nPos ); - bMod |= sal_True; - } - - if ( bMod ) - { - pOld = GetOldItem( rSet, SID_ATTR_PAGE ); - - if ( !pOld || !( *(const SvxPageItem*)pOld == aPage ) ) - { - rSet.Put( aPage ); - bModified |= sal_True; - } - } - else if ( SFX_ITEM_DEFAULT == rOldSet.GetItemState( nWhich ) ) - rSet.ClearItem( nWhich ); - else - rSet.Put( rOldSet.Get( nWhich ) ); - - // Modispezifische Controls auswerten - - switch ( eMode ) - { - case SVX_PAGE_MODE_CENTER: - { - if ( aHorzBox.IsChecked() != aHorzBox.GetSavedValue() ) - { - SfxBoolItem aHorz( GetWhich( SID_ATTR_PAGE_EXT1 ), - aHorzBox.IsChecked() ); - rSet.Put( aHorz ); - bModified |= sal_True; - } - - if ( aVertBox.IsChecked() != aVertBox.GetSavedValue() ) - { - SfxBoolItem aVert( GetWhich( SID_ATTR_PAGE_EXT2 ), - aVertBox.IsChecked() ); - rSet.Put( aVert ); - bModified |= sal_True; - } - break; - } - - case SVX_PAGE_MODE_PRESENTATION: - { - // immer putten, damit Draw das auswerten kann - rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PAGE_EXT1 ), - aAdaptBox.IsChecked() ) ); - bModified |= sal_True; - break; - } - default: ;//prevent warning - - } - - if(aRegisterCB.IsVisible() && - (aRegisterCB.IsChecked() || aRegisterCB.GetSavedValue() != aRegisterCB.IsChecked())) - { - const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE); - SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone(); - sal_Bool bCheck = aRegisterCB.IsChecked(); - pRegItem->SetValue(bCheck); - rSet.Put(*pRegItem); - bModified |= sal_True; - if(bCheck) - { - bModified |= sal_True; - rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, - aRegisterLB.GetSelectEntry())); - } - delete pRegItem; - } - - SvxFrameDirection eDirection = aTextFlowBox.GetSelectEntryValue(); - if( aTextFlowBox.IsVisible() && (eDirection != aTextFlowBox.GetSavedValue()) ) - { - rSet.Put( SvxFrameDirectionItem( eDirection, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); - bModified = sal_True; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, LayoutHdl_Impl, ListBox *, EMPTYARG ) -{ - // innen au\sen umschalten - const sal_uInt16 nPos = PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ); - - if ( nPos == SVX_PAGE_MIRROR ) - { - if ( aLeftMarginLbl.GetText() != aInsideText ) - aLeftMarginLbl.SetText( aInsideText ); - - if ( aRightMarginLbl.GetText() != aOutsideText ) - aRightMarginLbl.SetText( aOutsideText ); - } - else - { - if ( aLeftMarginLbl.GetText() != aLeftText ) - aLeftMarginLbl.SetText( aLeftText ); - - if ( aRightMarginLbl.GetText() != aRightText ) - aRightMarginLbl.SetText( aRightText ); - } - UpdateExample_Impl( true ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, PaperBinHdl_Impl, ListBox *, EMPTYARG ) -{ - if ( aPaperTrayBox.GetEntryCount() > 1 ) - // schon gef"ullt - return 0; - - // Schacht-Box initialisieren - String aOldName = aPaperTrayBox.GetSelectEntry(); - aPaperTrayBox.SetUpdateMode( sal_False ); - aPaperTrayBox.Clear(); - sal_uInt16 nEntryPos = aPaperTrayBox.InsertEntry( - EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ) ); - aPaperTrayBox.SetEntryData( nEntryPos, - (void*)(sal_uLong)PAPERBIN_PRINTER_SETTINGS ); - String aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) ); - sal_uInt16 nBinCount = pImpl->mpDefPrinter->GetPaperBinCount(); - - for ( sal_uInt16 i = 0; i < nBinCount; ++i ) - { - String aName = pImpl->mpDefPrinter->GetPaperBinName(i); - - if ( !aName.Len() ) - { - aName = aPaperBin; - aName.Append( sal_Unicode(' ') ); - aName.Append( UniString::CreateFromInt32( i+1 ) ); - } - nEntryPos = aPaperTrayBox.InsertEntry( aName ); - aPaperTrayBox.SetEntryData( nEntryPos, (void*)(sal_uLong)i ); - } - aPaperTrayBox.SelectEntry( aOldName ); - aPaperTrayBox.SetUpdateMode( sal_True ); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, PaperSizeSelect_Impl, ListBox *, pBox ) -{ - const sal_uInt16 nPos = pBox->GetSelectEntryPos(); - Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); - - if ( ePaper != PAPER_USER ) - { - Size aSize( SvxPaperInfo::GetPaperSize( ePaper, MAP_100TH_MM ) ); - - if ( aLandscapeBtn.IsChecked() ) - Swap( aSize ); - - if ( aSize.Height() < aPaperHeightEdit.GetMin( FUNIT_100TH_MM ) ) - aPaperHeightEdit.SetMin( - aPaperHeightEdit.Normalize( aSize.Height() ), FUNIT_100TH_MM ); - if ( aSize.Width() < aPaperWidthEdit.GetMin( FUNIT_100TH_MM ) ) - aPaperWidthEdit.SetMin( - aPaperWidthEdit.Normalize( aSize.Width() ), FUNIT_100TH_MM ); - SetMetricValue( aPaperHeightEdit, aSize.Height(), SFX_MAPUNIT_100TH_MM ); - SetMetricValue( aPaperWidthEdit, aSize.Width(), SFX_MAPUNIT_100TH_MM ); - - // R"ander ggf. neu berechnen - CalcMargin_Impl(); - - RangeHdl_Impl( 0 ); - UpdateExample_Impl( true ); - - if ( eMode == SVX_PAGE_MODE_PRESENTATION ) - { - // Draw: bei Papierformat soll der Rand 1cm betragen - long nTmp = 0; - sal_Bool bScreen = ( PAPER_SCREEN == ePaper ); - - if ( !bScreen ) - // bei Bildschirm keinen Rand - nTmp = 1; // entspr. 1cm - - // Abfragen, ob fuer Raender 0 gesetzt ist: - if ( bScreen || aRightMarginEdit.GetValue() == 0 ) - { - SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_CM ); - if ( !bScreen && - aRightMarginEdit.GetFirst() > aRightMarginEdit.GetValue() ) - aRightMarginEdit.SetValue( aRightMarginEdit.GetFirst() ); - } - if ( bScreen || aLeftMarginEdit.GetValue() == 0 ) - { - SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_CM ); - if ( !bScreen && - aLeftMarginEdit.GetFirst() > aLeftMarginEdit.GetValue() ) - aLeftMarginEdit.SetValue( aLeftMarginEdit.GetFirst() ); - } - if ( bScreen || aBottomMarginEdit.GetValue() == 0 ) - { - SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_CM ); - if ( !bScreen && - aBottomMarginEdit.GetFirst() > aBottomMarginEdit.GetValue() ) - aBottomMarginEdit.SetValue( aBottomMarginEdit.GetFirst() ); - } - if ( bScreen || aTopMarginEdit.GetValue() == 0 ) - { - SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_CM ); - if ( !bScreen && - aTopMarginEdit.GetFirst() > aTopMarginEdit.GetValue() ) - aTopMarginEdit.SetValue( aTopMarginEdit.GetFirst() ); - } - UpdateExample_Impl( true ); - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, PaperSizeModify_Impl, Edit *, EMPTYARG ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_LRSPACE ); - SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich ); - Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), - GetCoreValue( aPaperHeightEdit, eUnit ) ); - Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, sal_True ); - sal_uInt16 nEntryCount = aPaperSizeBox.GetEntryCount(); - - for ( sal_uInt16 i = 0; i < nEntryCount; ++i ) - { - Paper eTmp = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData(i); - - if ( eTmp == ePaper ) - { - aPaperSizeBox.SelectEntryPos(i); - break; - } - } - UpdateExample_Impl( true ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn ) -{ - if ( - (!bLandscape && pBtn == &aLandscapeBtn) || - (bLandscape && pBtn == &aPortraitBtn) - ) - { - bLandscape = aLandscapeBtn.IsChecked(); - - const long lWidth = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_100TH_MM ); - const long lHeight = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_100TH_MM ); - - // swap with and height - SetMetricValue( aPaperWidthEdit, lHeight, SFX_MAPUNIT_100TH_MM ); - SetMetricValue( aPaperHeightEdit, lWidth, SFX_MAPUNIT_100TH_MM ); - - // recalculate margins if necessary - CalcMargin_Impl(); - - PaperSizeSelect_Impl( &aPaperSizeBox ); - RangeHdl_Impl( 0 ); - SwapFirstValues_Impl( bBorderModified ); - UpdateExample_Impl( true ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::SwapFirstValues_Impl( bool bSet ) -{ - MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); - Orientation eOri = ORIENTATION_PORTRAIT; - - if ( bLandscape ) - eOri = ORIENTATION_LANDSCAPE; - Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation(); - pImpl->mpDefPrinter->SetOrientation( eOri ); - pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); - - // First- und Last-Werte f"ur die R"ander setzen - Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); - Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); - /* - * einen Punkt ( 0,0 ) in logische Koordinaten zu konvertieren, - * sieht aus wie Unsinn; ist aber sinnvoll, wenn der Ursprung des - * Koordinatensystems verschoben ist. - */ - Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - - pImpl->mpDefPrinter->PixelToLogic( Point() ); - pImpl->mpDefPrinter->SetMapMode( aOldMode ); - pImpl->mpDefPrinter->SetOrientation( eOldOri ); - - sal_Int64 nSetL = aLeftMarginEdit.Denormalize( - aLeftMarginEdit.GetValue( FUNIT_TWIP ) ); - sal_Int64 nSetR = aRightMarginEdit.Denormalize( - aRightMarginEdit.GetValue( FUNIT_TWIP ) ); - sal_Int64 nSetT = aTopMarginEdit.Denormalize( - aTopMarginEdit.GetValue( FUNIT_TWIP ) ); - sal_Int64 nSetB = aBottomMarginEdit.Denormalize( - aBottomMarginEdit.GetValue( FUNIT_TWIP ) ); - - long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; - long nNewL = aPrintOffset.X(); - long nNewR = - aPaperSize.Width() - aPrintSize.Width() - aPrintOffset.X() + nOffset; - long nNewT = aPrintOffset.Y(); - long nNewB = - aPaperSize.Height() - aPrintSize.Height() - aPrintOffset.Y() + nOffset; - - aLeftMarginEdit.SetFirst( aLeftMarginEdit.Normalize( nNewL ), FUNIT_TWIP ); - nFirstLeftMargin = static_cast(aLeftMarginEdit.GetFirst()); - aRightMarginEdit.SetFirst( aRightMarginEdit.Normalize( nNewR ), FUNIT_TWIP ); - nFirstRightMargin = static_cast(aRightMarginEdit.GetFirst()); - aTopMarginEdit.SetFirst( aTopMarginEdit.Normalize( nNewT ), FUNIT_TWIP ); - nFirstTopMargin = static_cast(aTopMarginEdit.GetFirst()); - aBottomMarginEdit.SetFirst( aBottomMarginEdit.Normalize( nNewB ), FUNIT_TWIP ); - nFirstBottomMargin = static_cast(aBottomMarginEdit.GetFirst()); - - if ( bSet ) - { - // ggf. auch die Werte umsetzen, - if ( nSetL < nNewL ) - aLeftMarginEdit.SetValue( aLeftMarginEdit.Normalize( nNewL ), - FUNIT_TWIP ); - if ( nSetR < nNewR ) - aRightMarginEdit.SetValue( aRightMarginEdit.Normalize( nNewR ), - FUNIT_TWIP ); - if ( nSetT < nNewT ) - aTopMarginEdit.SetValue( aTopMarginEdit.Normalize( nNewT ), - FUNIT_TWIP ); - if ( nSetB < nNewB ) - aBottomMarginEdit.SetValue( aBottomMarginEdit.Normalize( nNewB ), - FUNIT_TWIP ); - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) -{ - if ( !bBorderModified ) - bBorderModified = sal_True; - UpdateExample_Impl(); - return 0; -} -IMPL_LINK_INLINE_END( SvxPageDescPage, BorderModify_Impl, MetricField *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground ) -{ - // Size - Size aSize( GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ), - GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ) ); - - aBspWin.SetSize( aSize ); - - // R"ander - aBspWin.SetTop( GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ) ); - aBspWin.SetBottom( GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ) ); - aBspWin.SetLeft( GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ) ); - aBspWin.SetRight( GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ) ); - - // Layout - aBspWin.SetUsage( PosToPageUsage_Impl( aLayoutBox.GetSelectEntryPos() ) ); - if ( bResetbackground ) - aBspWin.ResetBackground(); - aBspWin.Invalidate(); -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet ) -{ - sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET ); - - if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) - { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, sal_False ); - const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); - - if ( rOn.GetValue() ) - { - nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rTmpSet.Get( nWhich ); - aBspWin.SetHdColor( rItem.GetColor() ); - } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - aBspWin.SetHdBorder( rItem ); - } - } - } - - nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET ); - - if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) - { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, sal_False ); - const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); - - if ( rOn.GetValue() ) - { - nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rTmpSet.Get( nWhich ); - aBspWin.SetFtColor( rItem.GetColor() ); - } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - aBspWin.SetFtBorder( rItem ); - } - } - } - - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH ); - - if ( pItem ) - { - aBspWin.SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); - const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); - - if ( pGrf ) - { - Bitmap aBitmap = pGrf->GetBitmap(); - aBspWin.SetBitmap( &aBitmap ); - } - else - aBspWin.SetBitmap( NULL ); - } - - pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER ); - - if ( pItem ) - aBspWin.SetBorder( (SvxBoxItem&)*pItem ); -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) -{ - bLandscape = aLandscapeBtn.IsChecked(); - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE ); - - if ( pItem ) - aBspWin.SetSize( ( (const SvxSizeItem*)pItem )->GetSize() ); - - const SvxSetItem* pSetItem = 0; - - // Kopfzeilen-Attribute auswerten - - if ( SFX_ITEM_SET == - rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ), - sal_False, (const SfxPoolItem**)&pSetItem ) ) - { - const SfxItemSet& rHeaderSet = pSetItem->GetItemSet(); - const SfxBoolItem& rHeaderOn = - (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); - - if ( rHeaderOn.GetValue() ) - { - const SvxSizeItem& rSize = (const SvxSizeItem&) - rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ); - const SvxULSpaceItem& rUL = (const SvxULSpaceItem&) - rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ); - long nDist = rUL.GetLower(); - aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist ); - aBspWin.SetHdDist( nDist ); - const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) - rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); - aBspWin.SetHdLeft( rLR.GetLeft() ); - aBspWin.SetHdRight( rLR.GetRight() ); - aBspWin.SetHeader( sal_True ); - } - else - aBspWin.SetHeader( sal_False ); - - // im Beispiel Hintergrund und Umrandung anzeigen - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) - { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rHeaderSet.Get( nWhich ); - aBspWin.SetHdColor( rItem.GetColor() ); - } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - - if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) - { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rHeaderSet.Get( nWhich ); - aBspWin.SetHdBorder( rItem ); - } - } - - // Fusszeilen-Attribute auswerten - - if ( SFX_ITEM_SET == - rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ), - sal_False, (const SfxPoolItem**)&pSetItem ) ) - { - const SfxItemSet& rFooterSet = pSetItem->GetItemSet(); - const SfxBoolItem& rFooterOn = - (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); - - if ( rFooterOn.GetValue() ) - { - const SvxSizeItem& rSize = (const SvxSizeItem&) - rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) ); - const SvxULSpaceItem& rUL = (const SvxULSpaceItem&) - rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ); - long nDist = rUL.GetUpper(); - aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist ); - aBspWin.SetFtDist( nDist ); - const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&) - rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ); - aBspWin.SetFtLeft( rLR.GetLeft() ); - aBspWin.SetFtRight( rLR.GetRight() ); - aBspWin.SetFooter( sal_True ); - } - else - aBspWin.SetFooter( sal_False ); - - // im Beispiel Hintergrund und Umrandung anzeigen - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) - { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rFooterSet.Get( nWhich ); - aBspWin.SetFtColor( rItem.GetColor() ); - } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - - if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) - { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rFooterSet.Get( nWhich ); - aBspWin.SetFtBorder( rItem ); - } - } -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::ActivatePage( const SfxItemSet& rSet ) -{ - InitHeadFoot_Impl( rSet ); - ResetBackground_Impl( rSet ); - RangeHdl_Impl( 0 ); -} - -// ----------------------------------------------------------------------- - -int SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) -{ - // Abfrage, ob die Seitenr"ander ausserhalb des Druckbereichs liegen - // Wenn nicht, dann den Anwender fragen, ob sie "ubernommen werden sollen. - // Wenn nicht, dann auf der TabPage bleiben. - sal_uInt16 nPos = aPaperSizeBox.GetSelectEntryPos(); - Paper ePaper = (Paper)(sal_uLong)aPaperSizeBox.GetEntryData( nPos ); - - if ( ePaper != PAPER_SCREEN && IsMarginOutOfRange() ) - { - if ( QueryBox( this, WB_YES_NO | WB_DEF_NO, aPrintRangeQueryText ).Execute() == RET_NO ) - { - MetricField* pField = NULL; - if ( IsPrinterRangeOverflow( aLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) ) - pField = &aLeftMarginEdit; - if ( IsPrinterRangeOverflow( aRightMarginEdit, nFirstRightMargin, nLastRightMargin, MARGIN_RIGHT ) - && !pField ) - pField = &aRightMarginEdit; - if ( IsPrinterRangeOverflow( aTopMarginEdit, nFirstTopMargin, nLastTopMargin, MARGIN_TOP ) - && !pField ) - pField = &aTopMarginEdit; - if ( IsPrinterRangeOverflow( aBottomMarginEdit, nFirstBottomMargin, nLastBottomMargin, MARGIN_BOTTOM ) - && !pField ) - pField = &aBottomMarginEdit; - if ( pField ) - pField->GrabFocus(); - UpdateExample_Impl(); - return KEEP_PAGE; - } - else - CheckMarginEdits( false ); - } - - if ( _pSet ) - { - FillItemSet( *_pSet ); - - // ggf. hoch/quer putten - sal_uInt16 nWh = GetWhich( SID_ATTR_PAGE_SIZE ); - SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWh ); - Size aSize( GetCoreValue( aPaperWidthEdit, eUnit ), - GetCoreValue( aPaperHeightEdit, eUnit ) ); - - // putten, wenn aktuelle Gr"o/se unterschiedlich zum Wert in _pSet - const SvxSizeItem* pSize = (const SvxSizeItem*)GetItem( *_pSet, SID_ATTR_PAGE_SIZE ); - if ( aSize.Width() && ( !pSize || !IsEqualSize_Impl( pSize, aSize ) ) ) - _pSet->Put( SvxSizeItem( nWh, aSize ) ); - } - - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, RangeHdl_Impl, Edit *, EMPTYARG ) -{ - // Aktuelle Header-Breite/H"ohe aus dem Bsp - long nHHeight = aBspWin.GetHdHeight(); - long nHDist = aBspWin.GetHdDist(); - - // Aktuelle Footer-Breite/H"ohe aus dem Bsp - long nFHeight = aBspWin.GetFtHeight(); - long nFDist = aBspWin.GetFtDist(); - - // Aktuelle Header/Footer-R"ander aus dem Bsp - long nHFLeft = Max( aBspWin.GetHdLeft(), aBspWin.GetFtLeft() ); - long nHFRight = Max( aBspWin.GetHdRight(), aBspWin.GetFtRight() ); - - // Aktuelle Werte der Seitenr"ander - long nBT = static_cast(aTopMarginEdit.Denormalize(aTopMarginEdit.GetValue(FUNIT_TWIP))); - long nBB = static_cast(aBottomMarginEdit.Denormalize(aBottomMarginEdit.GetValue(FUNIT_TWIP))); - long nBL = static_cast(aLeftMarginEdit.Denormalize(aLeftMarginEdit.GetValue(FUNIT_TWIP))); - long nBR = static_cast(aRightMarginEdit.Denormalize(aRightMarginEdit.GetValue(FUNIT_TWIP))); - - // Breite Umrandung der Seite berechnen - const SfxItemSet* _pSet = &GetItemSet(); - Size aBorder; - - if ( _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_SHADOW) ) >= - SFX_ITEM_AVAILABLE && - _pSet->GetItemState( GetWhich(SID_ATTR_BORDER_OUTER) ) >= - SFX_ITEM_AVAILABLE ) - { - aBorder = ( GetMinBorderSpace_Impl( - (const SvxShadowItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)), - (const SvxBoxItem&)_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)))); - } - - long nH = static_cast(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); - long nW = static_cast(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); - - // Grenzen Papier - // Maximum liegt bei 54cm - // - long nMin = nHHeight + nHDist + nFDist + nFHeight + nBT + nBB + - MINBODY + aBorder.Height(); - aPaperHeightEdit.SetMin(aPaperHeightEdit.Normalize(nMin), FUNIT_TWIP); - - nMin = MINBODY + nBL + nBR + aBorder.Width(); - aPaperWidthEdit.SetMin(aPaperWidthEdit.Normalize(nMin), FUNIT_TWIP); - - // Falls sich die Papiergr"o\se ge"adert hat - nH = static_cast(aPaperHeightEdit.Denormalize(aPaperHeightEdit.GetValue(FUNIT_TWIP))); - nW = static_cast(aPaperWidthEdit.Denormalize(aPaperWidthEdit.GetValue(FUNIT_TWIP))); - - // Top - long nMax = nH - nBB - aBorder.Height() - MINBODY - - nFDist - nFHeight - nHDist - nHHeight; - - aTopMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); - - // Bottom - nMax = nH - nBT - aBorder.Height() - MINBODY - - nFDist - nFHeight - nHDist - nHHeight; - - aBottomMarginEdit.SetMax(aTopMarginEdit.Normalize(nMax), FUNIT_TWIP); - - // Left - nMax = nW - nBR - MINBODY - aBorder.Width() - nHFLeft - nHFRight; - aLeftMarginEdit.SetMax(aLeftMarginEdit.Normalize(nMax), FUNIT_TWIP); - - // Right - nMax = nW - nBL - MINBODY - aBorder.Width() - nHFLeft - nHFRight; - aRightMarginEdit.SetMax(aRightMarginEdit.Normalize(nMax), FUNIT_TWIP); - return 0; -} - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::CalcMargin_Impl() -{ - // Aktuelle Werte der Seitenr"ander - long nBT = GetCoreValue( aTopMarginEdit, SFX_MAPUNIT_TWIP ); - long nBB = GetCoreValue( aBottomMarginEdit, SFX_MAPUNIT_TWIP ); - - long nBL = GetCoreValue( aLeftMarginEdit, SFX_MAPUNIT_TWIP ); - long nBR = GetCoreValue( aRightMarginEdit, SFX_MAPUNIT_TWIP ); - - long nH = GetCoreValue( aPaperHeightEdit, SFX_MAPUNIT_TWIP ); - long nW = GetCoreValue( aPaperWidthEdit, SFX_MAPUNIT_TWIP ); - - long nWidth = nBL + nBR + MINBODY; - long nHeight = nBT + nBB + MINBODY; - - if ( nWidth > nW || nHeight > nH ) - { - if ( nWidth > nW ) - { - long nTmp = nBL <= nBR ? nBR : nBL; - nTmp -= nWidth - nW; - - if ( nBL <= nBR ) - SetMetricValue( aRightMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); - else - SetMetricValue( aLeftMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); - } - - if ( nHeight > nH ) - { - long nTmp = nBT <= nBB ? nBB : nBT; - nTmp -= nHeight - nH; - - if ( nBT <= nBB ) - SetMetricValue( aBottomMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); - else - SetMetricValue( aTopMarginEdit, nTmp, SFX_MAPUNIT_TWIP ); - } - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) -{ - aBspWin.SetHorz( aHorzBox.IsChecked() ); - aBspWin.SetVert( aVertBox.IsChecked() ); - UpdateExample_Impl(); - return 0; -} -IMPL_LINK_INLINE_END( SvxPageDescPage, CenterHdl_Impl, CheckBox *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -void SvxPageDescPage::SetCollectionList(const std::vector &aList) -{ - OSL_ENSURE(!aList.empty(), "Empty string list"); - - sStandardRegister = aList[0]; - for( sal_uInt16 i = 1; i < aList.size(); i++ ) - aRegisterLB.InsertEntry(aList[i]); - - aRegisterCB .Show(); - aRegisterFT .Show(); - aRegisterLB.Show(); - aRegisterCB.SetClickHdl(LINK(this, SvxPageDescPage, RegisterModify)); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxPageDescPage, RegisterModify, CheckBox*, pBox ) -{ - sal_Bool bEnable = sal_False; - if(pBox->IsChecked()) - { - bEnable = sal_True; - if(USHRT_MAX == aRegisterLB.GetSelectEntryPos()) - aRegisterLB.SelectEntry(sStandardRegister); - } - aRegisterFT.Enable( bEnable ); - aRegisterLB.Enable( bEnable ); - return 0; -} - -// ---------------------------------------------------------------------------- - -void SvxPageDescPage::DisableVerticalPageDir() -{ - aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_RIGHT ); - aTextFlowBox.RemoveEntryValue( FRMDIR_VERT_TOP_LEFT ); - if( aTextFlowBox.GetEntryCount() < 2 ) - { - aTextFlowLbl.Hide(); - aTextFlowBox.Hide(); - aBspWin.EnableFrameDirection( sal_False ); - } -} - -IMPL_LINK( SvxPageDescPage, FrameDirectionModify_Impl, ListBox*, EMPTYARG) -{ - aBspWin.SetFrameDirection( (sal_uInt32) aTextFlowBox.GetSelectEntryValue() ); - aBspWin.Invalidate(); - return 0; -} - -bool SvxPageDescPage::IsPrinterRangeOverflow( - MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos ) -{ - bool bRet = false; - bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 ); - long nValue = static_cast(rField.GetValue()); - if ( bCheck && - ( nValue < nFirstMargin || nValue > nLastMargin ) && - rField.GetText() != rField.GetSavedValue() ) - { - rField.SetValue( nValue < nFirstMargin ? nFirstMargin : nLastMargin ); - bRet = true; - } - - return bRet; -} - -/** Check if a value of a margin edit is outside the printer paper margins - and save this information. -*/ -void SvxPageDescPage::CheckMarginEdits( bool _bClear ) -{ - if ( _bClear ) - pImpl->m_nPos = 0; - - sal_Int64 nValue = aLeftMarginEdit.GetValue(); - if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin ) - pImpl->m_nPos |= MARGIN_LEFT; - nValue = aRightMarginEdit.GetValue(); - if ( nValue < nFirstRightMargin || nValue > nLastRightMargin ) - pImpl->m_nPos |= MARGIN_RIGHT; - nValue = aTopMarginEdit.GetValue(); - if ( nValue < nFirstTopMargin || nValue > nLastTopMargin ) - pImpl->m_nPos |= MARGIN_TOP; - nValue = aBottomMarginEdit.GetValue(); - if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin ) - pImpl->m_nPos |= MARGIN_BOTTOM; -} - -bool SvxPageDescPage::IsMarginOutOfRange() -{ - bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) && - ( aLeftMarginEdit.GetText() != aLeftMarginEdit.GetSavedValue() ) ) && - ( aLeftMarginEdit.GetValue() < nFirstLeftMargin || - aLeftMarginEdit.GetValue() > nLastLeftMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) && - ( aRightMarginEdit.GetText() != aRightMarginEdit.GetSavedValue() ) ) && - ( aRightMarginEdit.GetValue() < nFirstRightMargin || - aRightMarginEdit.GetValue() > nLastRightMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_TOP ) && - ( aTopMarginEdit.GetText() != aTopMarginEdit.GetSavedValue() ) ) && - ( aTopMarginEdit.GetValue() < nFirstTopMargin || - aTopMarginEdit.GetValue() > nLastTopMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) && - ( aBottomMarginEdit.GetText() != aBottomMarginEdit.GetSavedValue() ) ) && - ( aBottomMarginEdit.GetValue() < nFirstBottomMargin || - aBottomMarginEdit.GetValue() > nLastBottomMargin ) ) ); - return bRet; -} - -void SvxPageDescPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pModeItem,SfxAllEnumItem,SID_ENUM_PAGE_MODE,sal_False); - SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,sal_False); - SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,sal_False); - SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,sal_False); - if (pModeItem) - SetMode((SvxModeType)pModeItem->GetEnumValue()); - if (pPaperStartItem && pPaperEndItem) - SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() ); - if (pCollectListItem) - SetCollectionList(pCollectListItem->GetList()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/page.h b/cui/source/tabpages/page.h deleted file mode 100644 index 564077a4f..000000000 --- a/cui/source/tabpages/page.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_PAGE_H -#define _SVX_PAGE_H - -// define ---------------------------------------------------------------- - -//!! the values of the following defines must correspond to the array position -//!! of the respective paper size in the file i18npool/source/paper/paper.cxx -//!! There are enums for them in i18npool/inc/i18npool/paper.hxx but unfortunately -//!! the resource compiler does not understand enums, thus the enum values need -//!! to be duplicated here for use in the src file. -#define PAPERSIZE_A0 0 -#define PAPERSIZE_A1 1 -#define PAPERSIZE_A2 2 -#define PAPERSIZE_A3 3 -#define PAPERSIZE_A4 4 -#define PAPERSIZE_A5 5 -#define PAPERSIZE_B4_ISO 6 -#define PAPERSIZE_B5_ISO 7 -#define PAPERSIZE_LETTER 8 -#define PAPERSIZE_LEGAL 9 -#define PAPERSIZE_TABLOID 10 -#define PAPERSIZE_USER 11 -#define PAPERSIZE_B6_ISO 12 -#define PAPERSIZE_C4 13 -#define PAPERSIZE_C5 14 -#define PAPERSIZE_C6 15 -#define PAPERSIZE_C65 16 -#define PAPERSIZE_DL 17 -#define PAPERSIZE_DIA 18 -#define PAPERSIZE_SCREEN 19 -#define PAPERSIZE_C 20 -#define PAPERSIZE_D 21 -#define PAPERSIZE_E 22 -#define PAPERSIZE_EXECUTIVE 23 -#define PAPERSIZE_LEGAL2 24 -#define PAPERSIZE_MONARCH 25 -#define PAPERSIZE_COM675 26 -#define PAPERSIZE_COM9 27 -#define PAPERSIZE_COM10 28 -#define PAPERSIZE_COM11 29 -#define PAPERSIZE_COM12 30 -#define PAPERSIZE_KAI16 31 -#define PAPERSIZE_KAI32 32 -#define PAPERSIZE_KAI32BIG 33 -#define PAPERSIZE_B4_JIS 34 -#define PAPERSIZE_B5_JIS 35 -#define PAPERSIZE_B6_JIS 36 -#define PAPERSIZE_A6 56 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/page.hrc b/cui/source/tabpages/page.hrc deleted file mode 100644 index 55ffdbd0c..000000000 --- a/cui/source/tabpages/page.hrc +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_PAGE_HRC -#define _SVX_PAGE_HRC - -// defines --------------------------------------------------------------- - -#define FT_LEFT_MARGIN 10 -#define ED_LEFT_MARGIN 11 -#define FT_RIGHT_MARGIN 12 -#define ED_RIGHT_MARGIN 13 -#define FT_TOP_MARGIN 14 -#define ED_TOP_MARGIN 15 -#define FT_BOTTOM_MARGIN 16 -#define ED_BOTTOM_MARGIN 17 -#define FL_MARGIN 18 - -#define LB_LAYOUT 20 -#define FT_PAGELAYOUT 21 - -#define LB_NUMBER_FORMAT 30 -#define FL_LAYOUT 31 -#define FT_NUMBER_FORMAT 32 - -#define FT_TEXT_FLOW 35 -#define LB_TEXT_FLOW 36 - -#define WN_BSP 40 - -#define FT_ORIENTATION 48 -#define FT_PAPER_FORMAT 49 -#define LB_PAPER_SIZE 50 -#define RB_PORTRAIT 51 -#define RB_LANDSCAPE 52 -#define FT_PAPER_WIDTH 53 -#define ED_PAPER_WIDTH 54 -#define FT_PAPER_HEIGHT 55 -#define ED_PAPER_HEIGHT 56 -#define FT_PAPER_TRAY 57 -#define LB_PAPER_TRAY 58 -#define FL_PAPER_SIZE 59 - -#define CB_REGISTER 60 -#define FT_REGISTER 61 -#define LB_REGISTER 62 -#define FL_BOTTOM_SEP 64 - -#define CB_HORZ 70 -#define CB_VERT 71 -#define CB_ADAPT 72 -#define FT_TBL_ALIGN 73 - -#define PB_BACK 80 - -#define STR_INSIDE 90 -#define STR_OUTSIDE 91 -#define STR_QUERY_PRINTRANGE 92 - -#endif - diff --git a/cui/source/tabpages/page.src b/cui/source/tabpages/page.src deleted file mode 100644 index 0de093b21..000000000 --- a/cui/source/tabpages/page.src +++ /dev/null @@ -1,524 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - // include --------------------------------------------------------------- - -#include -#include "helpid.hrc" -#include "page.hrc" -#include "page.h" -#include - - // RID_SVXPAGE_PAGE ------------------------------------------------------ - -TabPage RID_SVXPAGE_PAGE -{ - HelpId = HID_FORMAT_PAGE ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_PAPER_SIZE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 164 , 8 ) ; - Text [ en-US ] = "Paper format" ; - }; - FixedText FT_PAPER_FORMAT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Format"; - }; - ListBox LB_PAPER_SIZE - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_PAPER_SIZE"; - Pos = MAP_APPFONT ( 50 , 14 ) ; - Size = MAP_APPFONT ( 50 , 64 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_PAPER_WIDTH - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Width" ; - Left = TRUE ; - }; - MetricField ED_PAPER_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_PAPER_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50, 30 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 11900 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 11900 ; - SpinSize = 10 ; - }; - FixedText FT_PAPER_HEIGHT - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "~Height" ; - Left = TRUE ; - }; - MetricField ED_PAPER_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_PAPER_HEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 50 , 46 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 11900 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 11900 ; - SpinSize = 10 ; - }; - FixedText FT_ORIENTATION - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Text [ en-US ] = "Orientation"; - }; - RadioButton RB_PORTRAIT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_PAGE:RB_PORTRAIT"; - Pos = MAP_APPFONT ( 50 , 62 ) ; - Size = MAP_APPFONT ( 53 , 10 ) ; - Check = TRUE ; - Text [ en-US ] = "~Portrait" ; - }; - RadioButton RB_LANDSCAPE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_PAGE:RB_LANDSCAPE"; - Pos = MAP_APPFONT ( 50 , 74 ) ; - Size = MAP_APPFONT ( 53 , 10 ) ; - Text [ en-US ] = "L~andscape"; - }; - Window WN_BSP - { - Pos = MAP_APPFONT ( 176 , 6 ) ; - Size = MAP_APPFONT ( 75 , 46 ) ; - }; - - FixedText FT_TEXT_FLOW - { - Pos = MAP_APPFONT ( 113 , 60 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Left = TRUE ; - Hide = TRUE ; - Text [ en-US ] = "~Text direction"; - }; - ListBox LB_TEXT_FLOW - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_TEXT_FLOW"; - Border = TRUE ; - Pos = MAP_APPFONT ( 165 , 58 ) ; - Size = MAP_APPFONT ( 83 , 50 ) ; - DropDown = TRUE ; - Hide = TRUE ; - }; - - FixedText FT_PAPER_TRAY - { - Pos = MAP_APPFONT ( 113 , 74 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Paper ~tray"; - }; - ListBox LB_PAPER_TRAY - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_PAPER_TRAY"; - Pos = MAP_APPFONT ( 165 , 72 ) ; - Size = MAP_APPFONT ( 83 , 50 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedLine FL_MARGIN - { - Pos = MAP_APPFONT ( 6 , 90 ) ; - Size = MAP_APPFONT ( 95 , 8 ) ; - Text [ en-US ] = "Margins"; - }; - FixedText FT_LEFT_MARGIN - { - Pos = MAP_APPFONT ( 12 , 103 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Left" ; - Left = TRUE ; - }; - MetricField ED_LEFT_MARGIN - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_LEFT_MARGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 101 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_RIGHT_MARGIN - { - Pos = MAP_APPFONT ( 12 , 119 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Right" ; - Left = TRUE ; - }; - MetricField ED_RIGHT_MARGIN - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_RIGHT_MARGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 117 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_TOP_MARGIN - { - Pos = MAP_APPFONT ( 12 , 135 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Top" ; - Left = TRUE ; - }; - MetricField ED_TOP_MARGIN - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_TOP_MARGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 133 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_BOTTOM_MARGIN - { - Pos = MAP_APPFONT ( 12 , 151 ) ; - Size = MAP_APPFONT ( 40 , 8 ) ; - Text [ en-US ] = "~Bottom" ; - Left = TRUE ; - }; - MetricField ED_BOTTOM_MARGIN - { - HelpID = "cui:MetricField:RID_SVXPAGE_PAGE:ED_BOTTOM_MARGIN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 55 , 149 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - // #i4219# taken from congiguration now Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - // #i4219# Last = 9999 ; - SpinSize = 10 ; - }; - FixedLine FL_BOTTOM_SEP - { - Pos = MAP_APPFONT ( 102 , 101 ) ; - Size = MAP_APPFONT ( 4 , 68 ) ; - Vert = TRUE; - }; - FixedLine FL_LAYOUT - { - Pos = MAP_APPFONT ( 107, 90 ) ; - Size = MAP_APPFONT ( 147 , 8 ) ; - Text [ en-US ] = "Layout settings"; - }; - FixedText FT_PAGELAYOUT - { - Pos = MAP_APPFONT ( 113 , 103 ) ; - Size = MAP_APPFONT ( 54 , 8 ) ; - Text [ en-US ] = "Page layout" ; - }; - ListBox LB_LAYOUT - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_LAYOUT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 170, 101 ) ; - Size = MAP_APPFONT ( 78 , 44 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Right and left" ; Default ; > ; - < "Mirrored" ; Default ; > ; - < "Only right" ; Default ; > ; - < "Only left" ; Default ; > ; - }; - }; - FixedText FT_NUMBER_FORMAT - { - Pos = MAP_APPFONT ( 113 , 119 ) ; - Size = MAP_APPFONT ( 54 , 8 ) ; - Text [ en-US ] = "For~mat"; - }; - ListBox LB_NUMBER_FORMAT - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_NUMBER_FORMAT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 170 , 117 ) ; - Size = MAP_APPFONT ( 78 , 64 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "A, B, C, ..." ; Default ; > ; - < "a, b, c, ..." ; Default ; > ; - < "I, II, III, ..." ; Default ; > ; - < "i, ii, iii, ..." ; Default ; > ; - < "1, 2, 3, ..." ; Default ; > ; - < "None" ; Default ; > ; - }; - }; - FixedText FT_TBL_ALIGN - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 113 , 133 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Table alignment"; - }; - CheckBox CB_HORZ - { - HelpID = "cui:CheckBox:RID_SVXPAGE_PAGE:CB_HORZ"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 175 , 133 ) ; - Size = MAP_APPFONT ( 73 , 10 ) ; - Text [ en-US ] = "Hori~zontal" ; - }; - CheckBox CB_VERT - { - HelpID = "cui:CheckBox:RID_SVXPAGE_PAGE:CB_VERT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 175 , 147 ) ; - Size = MAP_APPFONT ( 73 , 10 ) ; - Text [ en-US ] = "~Vertical" ; - }; - CheckBox CB_ADAPT - { - HelpID = "cui:CheckBox:RID_SVXPAGE_PAGE:CB_ADAPT"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 113 , 133 ) ; - Size = MAP_APPFONT ( 135 , 10 ) ; - Text [ en-US ] = "~Fit object to paper format"; - }; - /* Registerhaltigkeit (fuer SW) */ - CheckBox CB_REGISTER - { - HelpID = "cui:CheckBox:RID_SVXPAGE_PAGE:CB_REGISTER"; - Pos = MAP_APPFONT ( 113 , 133 ) ; - Size = MAP_APPFONT ( 135 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "Register-true" ; - }; - FixedText FT_REGISTER - { - Pos = MAP_APPFONT ( 122 , 147 ) ; - Size = MAP_APPFONT ( 126 , 8 ) ; - Text [ en-US ] = "Reference ~Style" ; - Hide = TRUE ; - }; - ListBox LB_REGISTER - { - HelpID = "cui:ListBox:RID_SVXPAGE_PAGE:LB_REGISTER"; - Pos = MAP_APPFONT ( 122 , 157 ) ; - Size = MAP_APPFONT ( 126 , 50 ) ; - DropDown = TRUE ; - Hide = TRUE ; - Sort = TRUE ; - HScroll = TRUE ; - DDExtraWidth = TRUE ; - }; - String STR_INSIDE - { - Text [ en-US ] = "I~nner" ; - }; - String STR_OUTSIDE - { - Text [ en-US ] = "O~uter" ; - }; - String STR_QUERY_PRINTRANGE - { - Text [ en-US ] = "The margin settings are out of print range.\n\nDo you still want to apply these settings?"; - }; -}; -StringArray RID_SVXSTRARY_PAPERSIZE_STD -{ - ItemList [ en-US ] = - { - < "A6" ; PAPERSIZE_A6 ; > ; - < "A5" ; PAPERSIZE_A5 ; > ; - < "A4" ; PAPERSIZE_A4 ; > ; - < "A3" ; PAPERSIZE_A3 ; > ; - < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ; - < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ; - < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ; - < "Letter" ; PAPERSIZE_LETTER ; > ; - < "Legal" ; PAPERSIZE_LEGAL ; > ; - < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ; - < "Tabloid" ; PAPERSIZE_TABLOID ; > ; - < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ; - < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ; - < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ; - < "16 Kai" ; PAPERSIZE_KAI16; > ; - < "32 Kai" ; PAPERSIZE_KAI32; > ; - < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ; - < "User" ; PAPERSIZE_USER ; > ; - < "DL Envelope" ; PAPERSIZE_DL ; > ; - < "C6 Envelope" ; PAPERSIZE_C6 ; > ; - < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ; - < "C5 Envelope" ; PAPERSIZE_C5 ; > ; - < "C4 Envelope" ; PAPERSIZE_C4 ; > ; - < "#6 3/4 (Personal) Envelope" ; PAPERSIZE_COM675; > ; - < "#8 (Monarch) Envelope" ; PAPERSIZE_MONARCH; > ; - < "#9 Envelope" ; PAPERSIZE_COM9; > ; - < "#10 Envelope" ; PAPERSIZE_COM10; > ; - < "#11 Envelope" ; PAPERSIZE_COM11; > ; - < "#12 Envelope" ; PAPERSIZE_COM12; > ; - }; -}; -StringArray RID_SVXSTRARY_PAPERSIZE_DRAW -{ - ItemList [ en-US ] = - { - < "A6" ; PAPERSIZE_A6 ; > ; - < "A5" ; PAPERSIZE_A5 ; > ; - < "A4" ; PAPERSIZE_A4 ; > ; - < "A3" ; PAPERSIZE_A3 ; > ; - < "A2" ; PAPERSIZE_A2 ; > ; - < "A1" ; PAPERSIZE_A1 ; > ; - < "A0" ; PAPERSIZE_A0 ; > ; - < "B6 (ISO)" ; PAPERSIZE_B6_ISO ; > ; - < "B5 (ISO)" ; PAPERSIZE_B5_ISO ; > ; - < "B4 (ISO)" ; PAPERSIZE_B4_ISO ; > ; - < "Letter" ; PAPERSIZE_LETTER ; > ; - < "Legal" ; PAPERSIZE_LEGAL ; > ; - < "Long Bond" ; PAPERSIZE_LEGAL2 ; > ; - < "Tabloid" ; PAPERSIZE_TABLOID ; > ; - < "B6 (JIS)" ; PAPERSIZE_B6_JIS ; > ; - < "B5 (JIS)" ; PAPERSIZE_B5_JIS ; > ; - < "B4 (JIS)" ; PAPERSIZE_B4_JIS ; > ; - < "16 Kai" ; PAPERSIZE_KAI16; > ; - < "32 Kai" ; PAPERSIZE_KAI32; > ; - < "Big 32 Kai" ; PAPERSIZE_KAI32BIG; > ; - < "User" ; PAPERSIZE_USER ; > ; - < "DL Envelope" ; PAPERSIZE_DL ; > ; - < "C6 Envelope" ; PAPERSIZE_C6 ; > ; - < "C6/5 Envelope" ; PAPERSIZE_C65 ; > ; - < "C5 Envelope" ; PAPERSIZE_C5 ; > ; - < "C4 Envelope" ; PAPERSIZE_C4 ; > ; - < "Dia Slide" ; PAPERSIZE_DIA ; > ; - < "Screen" ; PAPERSIZE_SCREEN ; > ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx deleted file mode 100644 index a0c05e907..000000000 --- a/cui/source/tabpages/paragrph.cxx +++ /dev/null @@ -1,2328 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#define _SVX_PARAGRPH_CXX 0 - -#include -#include -#include -#include -#include "paragrph.hrc" -#include "paragrph.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "svx/dlgutil.hxx" -#include -#include "svx/htmlmode.hxx" -#include -#include -#include -#include - -// static ---------------------------------------------------------------- - -static sal_uInt16 pStdRanges[] = -{ - SID_ATTR_PARA_LINESPACE, // 10033 - SID_ATTR_PARA_LINESPACE, - SID_ATTR_LRSPACE, // 10048 - - SID_ATTR_ULSPACE, // 10049 - SID_ATTR_PARA_REGISTER, // 10413 - SID_ATTR_PARA_REGISTER, - 0 -}; - -static sal_uInt16 pAlignRanges[] = -{ - SID_ATTR_PARA_ADJUST, // 10027 - SID_ATTR_PARA_ADJUST, - 0 -}; - -static sal_uInt16 pExtRanges[] = -{ - SID_ATTR_PARA_PAGEBREAK, // 10037 - - SID_ATTR_PARA_WIDOWS, // 10041 - SID_ATTR_PARA_MODEL, // 10065 - - SID_ATTR_PARA_KEEP, // 10066 - 0 -}; - -// define ---------------------------------------------------------------- - -#define MAX_DURCH 5670 // 10 cm ist sinnvoll als maximaler Durchschuss - // laut BP -#define FIX_DIST_DEF 283 // Standard-Fix-Abstand 0,5cm - -// enum ------------------------------------------------------------------ - -enum LineSpaceList -{ - LLINESPACE_1 = 0, - LLINESPACE_15 = 1, - LLINESPACE_2 = 2, - LLINESPACE_PROP = 3, - LLINESPACE_MIN = 4, - LLINESPACE_DURCH= 5, - LLINESPACE_FIX = 6, - LLINESPACE_END -}; - -// C-Funktion ------------------------------------------------------------ - -void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); - -void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, - int eSpace, long lValue ) -{ - switch ( eSpace ) - { - case LLINESPACE_1: - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; - rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; - break; - - case LLINESPACE_15: - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; - rLineSpace.SetPropLineSpace( 150 ); - break; - - case LLINESPACE_2: - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; - rLineSpace.SetPropLineSpace( 200 ); - break; - - case LLINESPACE_PROP: - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; - rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); - break; - - case LLINESPACE_MIN: - rLineSpace.SetLineHeight( (sal_uInt16)lValue ); - rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; - break; - - case LLINESPACE_DURCH: - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO; - rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); - break; - - case LLINESPACE_FIX: - rLineSpace.SetLineHeight((sal_uInt16)lValue); - rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX; - rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF; - break; - } -} - - -sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet) -{ - sal_uInt16 nHtmlMode = 0; - const SfxPoolItem* pItem = 0; - SfxObjectShell* pShell; - if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) || - ( 0 != (pShell = SfxObjectShell::Current()) && - 0 != (pItem = pShell->GetItem(SID_HTML_MODE)))) - { - nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue(); - } - return nHtmlMode; - -} - -// class SvxStdParagraphTabPage ------------------------------------------ - -IMPL_LINK( SvxStdParagraphTabPage, ELRLoseFocusHdl, Edit *, EMPTYARG ) -{ - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = - MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); - - sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) ); - sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) ); - String aTmp = aFLineIndent.GetText(); - - // Erstzeilen Einzug - if( aLeftIndent.GetMin() < 0 ) - aFLineIndent.SetMin( -99999, FUNIT_MM ); - else - aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit ); - - // Check nur fuer konkrete Breite (Shell) - sal_Int64 nTmp = nWidth - nL - nR - MM50; - aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit ); - - if ( !aTmp.Len() ) - aFLineIndent.SetEmptyFieldValue(); - // Maximum Links Rechts - aTmp = aLeftIndent.GetText(); - nTmp = nWidth - nR - MM50; - aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit ); - - if ( !aTmp.Len() ) - aLeftIndent.SetEmptyFieldValue(); - aTmp = aRightIndent.GetText(); - nTmp = nWidth - nL - MM50; - aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit ); - - if ( !aTmp.Len() ) - aRightIndent.SetEmptyFieldValue(); - return 0; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return new SvxStdParagraphTabPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) -{ - SfxItemState eState = SFX_ITEM_UNKNOWN; - const SfxPoolItem* pOld = 0; - SfxItemPool* pPool = rOutSet.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - - sal_Bool bModified = sal_False; - sal_uInt16 nWhich; - sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); - - if ( LISTBOX_ENTRY_NOTFOUND != nPos && - ( nPos != aLineDist.GetSavedValue() || - aLineDistAtPercentBox.IsValueModified() || - aLineDistAtMetricBox.IsValueModified() ) ) - { - nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); - SfxMapUnit eUnit = pPool->GetMetric( nWhich ); - SvxLineSpacingItem aSpacing( - (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) ); - - switch ( nPos ) - { - case LLINESPACE_1: - case LLINESPACE_15: - case LLINESPACE_2: - SetLineSpace_Impl( aSpacing, nPos ); - break; - - case LLINESPACE_PROP: - SetLineSpace_Impl( aSpacing, nPos, - static_cast(aLineDistAtPercentBox.Denormalize( - aLineDistAtPercentBox.GetValue() )) ); - break; - - case LLINESPACE_MIN: - case LLINESPACE_DURCH: - case LLINESPACE_FIX: - SetLineSpace_Impl( aSpacing, nPos, - GetCoreValue( aLineDistAtMetricBox, eUnit ) ); - break; - - default: - OSL_FAIL( "unbekannter Type fuer Zeilenabstand." ); - break; - } - eState = GetItemSet().GetItemState( nWhich ); - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE ); - - if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) || - SFX_ITEM_DONTCARE == eState ) - { - rOutSet.Put( aSpacing ); - bModified = sal_True; - } - } - - if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() ) - { - nWhich = GetWhich( SID_ATTR_ULSPACE ); - SfxMapUnit eUnit = pPool->GetMetric( nWhich ); - pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE ); - SvxULSpaceItem aMargin( nWhich ); - - if ( bRelativeMode ) - { - DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); - - const SvxULSpaceItem& rOldItem = - (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); - - if ( aTopDist.IsRelative() ) - aMargin.SetUpper( rOldItem.GetUpper(), - (sal_uInt16)aTopDist.GetValue() ); - else - aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) ); - - if ( aBottomDist.IsRelative() ) - aMargin.SetLower( rOldItem.GetLower(), - (sal_uInt16)aBottomDist.GetValue() ); - else - aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) ); - - } - else - { - aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) ); - aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) ); - } - eState = GetItemSet().GetItemState( nWhich ); - - if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) || - SFX_ITEM_DONTCARE == eState ) - { - rOutSet.Put( aMargin ); - bModified = sal_True; - } - } - bool bNullTab = false; - - if ( aLeftIndent.IsValueModified() || - aFLineIndent.IsValueModified() || - aRightIndent.IsValueModified() - || aAutoCB.GetSavedValue() != aAutoCB.IsChecked() ) - { - nWhich = GetWhich( SID_ATTR_LRSPACE ); - SfxMapUnit eUnit = pPool->GetMetric( nWhich ); - SvxLRSpaceItem aMargin( nWhich ); - pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE ); - - if ( bRelativeMode ) - { - DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" ); - - const SvxLRSpaceItem& rOldItem = - (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich ); - - if ( aLeftIndent.IsRelative() ) - aMargin.SetTxtLeft( rOldItem.GetTxtLeft(), - (sal_uInt16)aLeftIndent.GetValue() ); - else - aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); - - if ( aRightIndent.IsRelative() ) - aMargin.SetRight( rOldItem.GetRight(), - (sal_uInt16)aRightIndent.GetValue() ); - else - aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); - - if ( aFLineIndent.IsRelative() ) - aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(), - (sal_uInt16)aFLineIndent.GetValue() ); - else - aMargin.SetTxtFirstLineOfst( - (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) ); - } - else - { - aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) ); - aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) ); - aMargin.SetTxtFirstLineOfst( - (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) ); - } - aMargin.SetAutoFirst(aAutoCB.IsChecked()); - if ( aMargin.GetTxtFirstLineOfst() < 0 ) - bNullTab = true; - eState = GetItemSet().GetItemState( nWhich ); - - if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) || - SFX_ITEM_DONTCARE == eState ) - { - rOutSet.Put( aMargin ); - bModified = sal_True; - } - } - - if ( bNullTab ) - { - MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); - if ( MAP_100TH_MM != eUnit ) - { - - // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen - sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP ); - const SfxItemSet& rInSet = GetItemSet(); - - if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE ) - { - const SvxTabStopItem& rTabItem = - (const SvxTabStopItem&)rInSet.Get( _nWhich ); - SvxTabStopItem aNullTab( rTabItem ); - SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT ); - aNullTab.Insert( aNull ); - rOutSet.Put( aNullTab ); - } - } - } - if( aRegisterCB.IsVisible()) - { - const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem( - rOutSet, SID_ATTR_PARA_REGISTER); - SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone(); - sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); - sal_Bool bSet = pRegItem->GetValue(); - - if(aRegisterCB.IsChecked() != bSet ) - { - pRegItem->SetValue(!bSet); - rOutSet.Put(*pRegItem); - bModified = sal_True; - } - else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, sal_False ) ) - rOutSet.ClearItem(_nWhich); - delete pRegItem; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet ) -{ - SfxItemPool* pPool = rSet.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - String aEmpty; - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rSet ); - - bool bApplyCharUnit = GetApplyCharUnit( rSet ); - - SvtCJKOptions aCJKOptions; - if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit ) - eFUnit = FUNIT_CHAR; - - SetFieldUnit( aLeftIndent, eFUnit ); - SetFieldUnit( aRightIndent, eFUnit ); - SetFieldUnit( aFLineIndent, eFUnit ); - if ( eFUnit == FUNIT_CHAR ) - { - SetFieldUnit( aTopDist, FUNIT_LINE ); - SetFieldUnit( aBottomDist, FUNIT_LINE ); - SetFieldUnit( aLineDistAtMetricBox, FUNIT_POINT ); - } - else - { - SetFieldUnit( aTopDist, eFUnit ); - SetFieldUnit( aBottomDist, eFUnit ); - SetFieldUnit( aLineDistAtMetricBox, eFUnit ); - } - - sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE ); - SfxItemState eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); - - if ( bRelativeMode ) - { - const SvxLRSpaceItem& rOldItem = - (const SvxLRSpaceItem&)rSet.Get( _nWhich ); - - if ( rOldItem.GetPropLeft() != 100 ) - { - aLeftIndent.SetRelative( sal_True ); - aLeftIndent.SetValue( rOldItem.GetPropLeft() ); - } - else - { - aLeftIndent.SetRelative(); - SetFieldUnit( aLeftIndent, eFUnit ); - SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit ); - } - - if ( rOldItem.GetPropRight() != 100 ) - { - aRightIndent.SetRelative( sal_True ); - aRightIndent.SetValue( rOldItem.GetPropRight() ); - } - else - { - aRightIndent.SetRelative(); - SetFieldUnit( aRightIndent, eFUnit ); - SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit ); - } - - if ( rOldItem.GetPropTxtFirstLineOfst() != 100 ) - { - aFLineIndent.SetRelative( sal_True ); - aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() ); - } - else - { - aFLineIndent.SetRelative(); - aFLineIndent.SetMin(-9999); - SetFieldUnit( aFLineIndent, eFUnit ); - SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(), - eUnit ); - } - aAutoCB.Check(rOldItem.IsAutoFirst()); - } - else - { - const SvxLRSpaceItem& rSpace = - (const SvxLRSpaceItem&)rSet.Get( _nWhich ); - - SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit ); - SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit ); - SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit ); - aAutoCB.Check(rSpace.IsAutoFirst()); - } - AutoHdl_Impl(&aAutoCB); - } - else - { - aLeftIndent.SetEmptyFieldValue(); - aRightIndent.SetEmptyFieldValue(); - aFLineIndent.SetEmptyFieldValue(); - } - - _nWhich = GetWhich( SID_ATTR_ULSPACE ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - SfxMapUnit eUnit = pPool->GetMetric( _nWhich ); - - if ( bRelativeMode ) - { - const SvxULSpaceItem& rOldItem = - (const SvxULSpaceItem&)rSet.Get( _nWhich ); - - if ( rOldItem.GetPropUpper() != 100 ) - { - aTopDist.SetRelative( sal_True ); - aTopDist.SetValue( rOldItem.GetPropUpper() ); - } - else - { - aTopDist.SetRelative(); - if ( eFUnit == FUNIT_CHAR ) - SetFieldUnit( aTopDist, FUNIT_LINE ); - else - SetFieldUnit( aTopDist, eFUnit ); - SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit ); - } - - if ( rOldItem.GetPropLower() != 100 ) - { - aBottomDist.SetRelative( sal_True ); - aBottomDist.SetValue( rOldItem.GetPropLower() ); - } - else - { - aBottomDist.SetRelative(); - if ( eFUnit == FUNIT_CHAR ) - SetFieldUnit( aBottomDist, FUNIT_LINE ); - else - SetFieldUnit( aBottomDist, eFUnit ); - SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit ); - } - } - else - { - const SvxULSpaceItem& rTopMargin = - (const SvxULSpaceItem&)rSet.Get( _nWhich ); - SetMetricValue( aTopDist, rTopMargin.GetUpper(), eUnit ); - SetMetricValue( aBottomDist, rTopMargin.GetLower(), eUnit ); - } - } - else - { - aTopDist.SetEmptyFieldValue(); - aBottomDist.SetEmptyFieldValue(); - } - - _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) ); - else - aLineDist.SetNoSelection(); - - - _nWhich = GetWhich( SID_ATTR_PARA_REGISTER ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue()); - aRegisterCB.SaveValue(); - sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); - if(nHtmlMode & HTMLMODE_ON) - { - aRegisterCB.Hide(); - aRegisterFL.Hide(); - aAutoCB.Hide(); - if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE oder SW - { - aRightLabel.Disable(); - aRightIndent.Disable(); - aTopDist.Disable(); //HTML3.2 und NS 3.0 - aBottomDist.Disable(); - if(!(nHtmlMode & HTMLMODE_FIRSTLINE)) //NS 3.0 - { - aFLineIndent.Disable(); - aFLineLabel.Disable(); - } - } - } - - ELRLoseFocusHdl( NULL ); - aAutoCB.SaveValue(); - aLineDist.SaveValue(); -} - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::EnableRelativeMode() -{ - DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" ); - - aLeftIndent.EnableRelativeMode( 0, 999 ); - aFLineIndent.EnableRelativeMode( 0, 999 ); - aRightIndent.EnableRelativeMode( 0, 999 ); - aTopDist.EnableRelativeMode( 0, 999 ); - aBottomDist.EnableRelativeMode( 0, 999 ); - bRelativeMode = sal_True; -} - -// ----------------------------------------------------------------------- - -int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - ELRLoseFocusHdl( NULL ); - - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent, - const SfxItemSet& rAttr ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ), - - aIndentFrm ( this, CUI_RES( FL_INDENT ) ), - aLeftLabel ( this, CUI_RES( FT_LEFTINDENT ) ), - aLeftIndent ( this, CUI_RES( ED_LEFTINDENT ) ), - aRightLabel ( this, CUI_RES( FT_RIGHTINDENT ) ), - aRightIndent ( this, CUI_RES( ED_RIGHTINDENT ) ), - - aFLineLabel ( this, CUI_RES( FT_FLINEINDENT ) ), - aFLineIndent ( this, CUI_RES( ED_FLINEINDENT ) ), - aAutoCB ( this, CUI_RES( CB_AUTO ) ), - aDistFrm ( this, CUI_RES( FL_DIST ) ), - aTopLabel ( this, CUI_RES( FT_TOPDIST ) ), - aTopDist ( this, CUI_RES( ED_TOPDIST ) ), - aBottomLabel ( this, CUI_RES( FT_BOTTOMDIST ) ), - aBottomDist ( this, CUI_RES( ED_BOTTOMDIST ) ), - - aLineDistFrm ( this, CUI_RES( FL_LINEDIST ) ), - aLineDist ( this, CUI_RES( LB_LINEDIST ) ), - aLineDistAtLabel ( this, CUI_RES( FT_LINEDIST ) ), - aLineDistAtPercentBox ( this, CUI_RES( ED_LINEDISTPERCENT ) ), - aLineDistAtMetricBox ( this, CUI_RES( ED_LINEDISTMETRIC ) ), - sAbsDist ( CUI_RES(ST_LINEDIST_ABS) ), - aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ), - aRegisterFL ( this, CUI_RES( FL_REGISTER ) ), - aRegisterCB ( this, CUI_RES( CB_REGISTER ) ), - pActLineDistFld ( &aLineDistAtPercentBox ), - nAbst ( MAX_DURCH ), - nWidth ( 11905 /*567 * 50*/ ), - nMinFixDist(0L), - - bRelativeMode ( sal_False ), - bNegativeIndents(sal_False) - -{ - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - aLineDistAtMetricBox.Hide(); - FreeResource(); - Init_Impl(); - aFLineIndent.SetMin(-9999); // wird default auf 0 gesetzt - - aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - -} - - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::EnableNegativeMode() -{ - aLeftIndent.SetMin(-9999); - aRightIndent.SetMin(-9999); - aRightIndent.EnableNegativeMode(); - aLeftIndent.EnableNegativeMode(); - bNegativeIndents = sal_True; -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxStdParagraphTabPage::GetRanges() -{ - return pStdRanges; -} - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::SetLineSpacing_Impl -( - const SvxLineSpacingItem &rAttr -) -{ - SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() ); - - switch( rAttr.GetLineSpaceRule() ) - { - case SVX_LINE_SPACE_AUTO: - { - SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule(); - - switch( eInter ) - { - // Default einzeilig - case SVX_INTER_LINE_SPACE_OFF: - aLineDist.SelectEntryPos( LLINESPACE_1 ); - break; - - // Default einzeilig - case SVX_INTER_LINE_SPACE_PROP: - if ( 100 == rAttr.GetPropLineSpace() ) - { - aLineDist.SelectEntryPos( LLINESPACE_1 ); - break; - } - // 1.5zeilig - if ( 150 == rAttr.GetPropLineSpace() ) - { - aLineDist.SelectEntryPos( LLINESPACE_15 ); - break; - } - // 2zeilig - if ( 200 == rAttr.GetPropLineSpace() ) - { - aLineDist.SelectEntryPos( LLINESPACE_2 ); - break; - } - // eingestellter Prozentwert - aLineDistAtPercentBox. - SetValue( aLineDistAtPercentBox.Normalize( - rAttr.GetPropLineSpace() ) ); - aLineDist.SelectEntryPos( LLINESPACE_PROP ); - break; - - case SVX_INTER_LINE_SPACE_FIX: - SetMetricValue( aLineDistAtMetricBox, - rAttr.GetInterLineSpace(), eUnit ); - aLineDist.SelectEntryPos( LLINESPACE_DURCH ); - break; - default: ;//prevent warning - } - } - break; - case SVX_LINE_SPACE_FIX: - SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); - aLineDist.SelectEntryPos( LLINESPACE_FIX ); - break; - - case SVX_LINE_SPACE_MIN: - SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit); - aLineDist.SelectEntryPos( LLINESPACE_MIN ); - break; - default: ;//prevent warning - } - LineDistHdl_Impl( &aLineDist ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox ) -{ - switch( pBox->GetSelectEntryPos() ) - { - case LLINESPACE_1: - case LLINESPACE_15: - case LLINESPACE_2: - aLineDistAtLabel.Enable(sal_False); - pActLineDistFld->Enable(sal_False); - pActLineDistFld->SetText( String() ); - break; - - case LLINESPACE_DURCH: - // Setzen eines sinnvollen Defaults? - // MS Begrenzen min(10, aPageSize) - aLineDistAtPercentBox.Hide(); - pActLineDistFld = &aLineDistAtMetricBox; - aLineDistAtMetricBox.SetMin(0); - - - if ( !aLineDistAtMetricBox.GetText().Len() ) - aLineDistAtMetricBox.SetValue( - aLineDistAtMetricBox.Normalize( 1 ) ); - aLineDistAtPercentBox.Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); - aLineDistAtLabel.Enable(); - break; - - case LLINESPACE_MIN: - aLineDistAtPercentBox.Hide(); - pActLineDistFld = &aLineDistAtMetricBox; - aLineDistAtMetricBox.SetMin(0); - - if ( !aLineDistAtMetricBox.GetText().Len() ) - aLineDistAtMetricBox.SetValue( - aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP ); - aLineDistAtPercentBox.Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); - aLineDistAtLabel.Enable(); - break; - - case LLINESPACE_PROP: - aLineDistAtMetricBox.Hide(); - pActLineDistFld = &aLineDistAtPercentBox; - - if ( !aLineDistAtPercentBox.GetText().Len() ) - aLineDistAtPercentBox.SetValue( - aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP ); - aLineDistAtMetricBox.Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); - aLineDistAtLabel.Enable(); - break; - case LLINESPACE_FIX: - { - aLineDistAtPercentBox.Hide(); - pActLineDistFld = &aLineDistAtMetricBox; - sal_Int64 nTemp = aLineDistAtMetricBox.GetValue(); - aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP); - - // wurde der Wert beim SetMin veraendert, dann ist es Zeit - // fuer den default - if ( aLineDistAtMetricBox.GetValue() != nTemp ) - SetMetricValue( aLineDistAtMetricBox, - FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix gibt's nur im Writer - aLineDistAtPercentBox.Hide(); - pActLineDistFld->Show(); - pActLineDistFld->Enable(); - aLineDistAtLabel.Enable(); - } - break; - } - UpdateExample_Impl( sal_True ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) -{ - UpdateExample_Impl(); - return 0; -} -IMPL_LINK_INLINE_END( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::Init_Impl() -{ - aLineDist.SetSelectHdl( - LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) ); - - Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl ); - aFLineIndent.SetLoseFocusHdl( aLink ); - aLeftIndent.SetLoseFocusHdl( aLink ); - aRightIndent.SetLoseFocusHdl( aLink ); - - aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl ); - aFLineIndent.SetModifyHdl( aLink ); - aLeftIndent.SetModifyHdl( aLink ); - aRightIndent.SetModifyHdl( aLink ); - aTopDist.SetModifyHdl( aLink ); - aBottomDist.SetModifyHdl( aLink ); - - aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl )); - SfxItemPool* pPool = GetItemSet().GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - FieldUnit eUnit = - MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) ); - - aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit ); - aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit ); - aLineDistAtMetricBox.SetMax( - aLineDistAtMetricBox.Normalize( nAbst ), eUnit ); -} - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll ) -{ - aExampleWin.SetFirstLineOfst( - (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) ); - aExampleWin.SetLeftMargin( - static_cast(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) ); - aExampleWin.SetRightMargin( - static_cast(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) ); - aExampleWin.SetUpper( - (sal_uInt16)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) ); - aExampleWin.SetLower( - (sal_uInt16)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) ); - - - - sal_uInt16 nPos = aLineDist.GetSelectEntryPos(); - - switch ( nPos ) - { - case LLINESPACE_1: - case LLINESPACE_15: - case LLINESPACE_2: - aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos ); - break; - - case LLINESPACE_PROP: - aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, - (sal_uInt16)aLineDistAtPercentBox.Denormalize( - aLineDistAtPercentBox.GetValue() ) ); - break; - - case LLINESPACE_MIN: - case LLINESPACE_DURCH: - case LLINESPACE_FIX: - aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos, - (sal_uInt16)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) ); - break; - } - aExampleWin.Draw( bAll ); -} - -// ----------------------------------------------------------------------- - -void SvxStdParagraphTabPage::EnableRegisterMode() -{ - aRegisterCB.Show(); - aRegisterFL.Show(); -} - -IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox ) -{ - sal_Bool bEnable = !pBox->IsChecked(); - aFLineLabel .Enable(bEnable); - aFLineIndent.Enable(bEnable); - return 0; -} - -void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth ) -{ - nWidth = nPageWidth; -} - - -void SvxStdParagraphTabPage::EnableAutoFirstLine() -{ - aAutoCB.Show(); -} - - -void SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip) -{ - aLineDist.InsertEntry(sAbsDist); - nMinFixDist = nMinTwip; -} - - -void SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet) -{ - -/* different bit represent call to different method of SvxStdParagraphTabPage - 0x0001 --->EnableRelativeMode() - 0x0002 --->EnableRegisterMode() - 0x0004 --->EnableAutoFirstLine() - 0x0008 --->EnableNegativeMode() - */ - SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False); - SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False); - SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False); - - if (pPageWidthItem) - SetPageWidth(pPageWidthItem->GetValue()); - - if (pFlagSetItem ) - if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 ) - EnableRelativeMode(); - - if (pFlagSetItem) - if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 ) - EnableRegisterMode(); - - if (pFlagSetItem) - if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 ) - EnableAutoFirstLine(); - - if(pLineDistItem) - EnableAbsLineDist(pLineDistItem->GetValue()); - - if (pFlagSetItem) - if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 ) - EnableNegativeMode(); - -} - - -#define LASTLINEPOS_DEFAULT 0 -#define LASTLINEPOS_LEFT 1 - -#define LASTLINECOUNT_OLD 3 -#define LASTLINECOUNT_NEW 4 - -// class SvxParaAlignTabPage ------------------------------------------------ - -SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet ) - : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet), - aAlignFrm ( this, CUI_RES( FL_ALIGN ) ), - aLeft ( this, CUI_RES( BTN_LEFTALIGN ) ), - aRight ( this, CUI_RES( BTN_RIGHTALIGN ) ), - aCenter ( this, CUI_RES( BTN_CENTERALIGN ) ), - aJustify ( this, CUI_RES( BTN_JUSTIFYALIGN ) ), - aLastLineFT ( this, CUI_RES( FT_LASTLINE ) ), - aLastLineLB ( this, CUI_RES( LB_LASTLINE ) ), - aExpandCB ( this, CUI_RES( CB_EXPAND ) ), - aSnapToGridCB ( this, CUI_RES( CB_SNAP ) ), - aExampleWin ( this, CUI_RES( WN_EXAMPLE ) ), - - aVertAlignFL ( this, CUI_RES( FL_VERTALIGN ) ), - aVertAlignFT ( this, CUI_RES( FT_VERTALIGN ) ), - aVertAlignLB ( this, CUI_RES( LB_VERTALIGN ) ), - - aPropertiesFL ( this, CUI_RES( FL_PROPERTIES )), - aTextDirectionFT ( this, CUI_RES( FT_TEXTDIRECTION )), - aTextDirectionLB ( this, CUI_RES( LB_TEXTDIRECTION )) -{ - SvtLanguageOptions aLangOptions; - sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT; - - if ( aLangOptions.IsAsianTypographyEnabled() ) - { - String sLeft(CUI_RES(ST_LEFTALIGN_ASIAN)); - aLeft.SetText(sLeft); - aRight.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN))); - sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft ); - - if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD ) - { - aLastLineLB.RemoveEntry( 0 ); - aLastLineLB.InsertEntry( sLeft, 0 ); - } - else - nLastLinePos = LASTLINEPOS_LEFT; - } - // remove "Default" or "Left" entry, depends on CJKOptions - if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW ) - aLastLineLB.RemoveEntry( nLastLinePos ); - - FreeResource(); - Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl ); - aLeft.SetClickHdl( aLink ); - aRight.SetClickHdl( aLink ); - aCenter.SetClickHdl( aLink ); - aJustify.SetClickHdl( aLink ); - aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) ); - aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) ); - - sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); - if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) ) - { - if( aLangOptions.IsCTLFontEnabled() ) - { - aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP ); - aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP ); - aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT ); - - aPropertiesFL.Show(); - aTextDirectionFT.Show(); - aTextDirectionLB.Show(); - } - } - - aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - -} - -SvxParaAlignTabPage::~SvxParaAlignTabPage() -{ -} - -int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxParaAlignTabPage(pParent, rSet); -} - -sal_uInt16* SvxParaAlignTabPage::GetRanges() -{ - return pAlignRanges; - -} - -sal_Bool SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet ) -{ - sal_Bool bModified = sal_False; - - bool bAdj = false, bChecked = false; - SvxAdjust eAdjust = SVX_ADJUST_LEFT; - - if ( aLeft.IsChecked() ) - { - eAdjust = SVX_ADJUST_LEFT; - bAdj = !aLeft.GetSavedValue(); - bChecked = true; - } - else if ( aRight.IsChecked() ) - { - eAdjust = SVX_ADJUST_RIGHT; - bAdj = !aRight.GetSavedValue(); - bChecked = true; - } - else if ( aCenter.IsChecked() ) - { - eAdjust = SVX_ADJUST_CENTER; - bAdj = !aCenter.GetSavedValue(); - bChecked = true; - } - else if ( aJustify.IsChecked() ) - { - eAdjust = SVX_ADJUST_BLOCK; - bAdj = !aJustify.GetSavedValue() || - aExpandCB.IsChecked() != aExpandCB.GetSavedValue() || - aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue(); - bChecked = true; - } - sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); - - if ( bAdj ) - { - const SvxAdjustItem* pOld = - (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST ); - SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK - : SVX_ADJUST_LEFT; - sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos(); - SvxAdjust eLastBlock = SVX_ADJUST_LEFT; - - if ( 1 == nLBPos ) - eLastBlock = SVX_ADJUST_CENTER; - else if ( 2 == nLBPos ) - eLastBlock = SVX_ADJUST_BLOCK; - - bool bNothingWasChecked = - !aLeft.GetSavedValue() && !aRight.GetSavedValue() && - !aCenter.GetSavedValue() && !aJustify.GetSavedValue(); - - if ( !pOld || pOld->GetAdjust() != eAdjust || - pOld->GetOneWord() != eOneWord || - pOld->GetLastBlock() != eLastBlock || - ( bChecked && bNothingWasChecked ) ) - { - bModified = sal_True; - SvxAdjustItem aAdj( - (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) ); - aAdj.SetAdjust( eAdjust ); - aAdj.SetOneWord( eOneWord ); - aAdj.SetLastBlock( eLastBlock ); - rOutSet.Put( aAdj ); - } - } - if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue()) - { - rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID ))); - bModified = sal_True; - } - if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos()) - { - rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN ))); - bModified = sal_True; - } - - if( aTextDirectionLB.IsVisible() ) - { - SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); - if( eDir != aTextDirectionLB.GetSavedValue() ) - { - rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); - bModified = sal_True; - } - } - - return bModified; -} - -void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet ) -{ - sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST ); - SfxItemState eItemState = rSet.GetItemState( _nWhich ); - - sal_uInt16 nLBSelect = 0; - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich ); - - switch ( rAdj.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ ) - { - case SVX_ADJUST_LEFT: aLeft.Check(); break; - - case SVX_ADJUST_RIGHT: aRight.Check(); break; - - case SVX_ADJUST_CENTER: aCenter.Check(); break; - - case SVX_ADJUST_BLOCK: aJustify.Check(); break; - default: ; //prevent warning - } - sal_Bool bEnable = aJustify.IsChecked(); - aLastLineFT.Enable(bEnable); - aLastLineLB.Enable(bEnable); - aExpandCB .Enable(bEnable); - - aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord()); - switch(rAdj.GetLastBlock()) - { - case SVX_ADJUST_LEFT: nLBSelect = 0; break; - - case SVX_ADJUST_CENTER: nLBSelect = 1; break; - - case SVX_ADJUST_BLOCK: nLBSelect = 2; break; - default: ; //prevent warning - } - } - else - { - aLeft.Check( sal_False ); - aRight.Check( sal_False ); - aCenter.Check( sal_False ); - aJustify.Check( sal_False ); - } - aLastLineLB.SelectEntryPos(nLBSelect); - - sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet); - if(nHtmlMode & HTMLMODE_ON) - { - aLastLineLB.Hide(); - aLastLineFT.Hide(); - aExpandCB.Hide(); - if(!(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE)) ) - aJustify.Disable(); - aSnapToGridCB.Show(sal_False); - } - _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID); - eItemState = rSet.GetItemState( _nWhich ); - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich ); - aSnapToGridCB.Check(rSnap.GetValue()); - } - - _nWhich = GetWhich( SID_PARA_VERTALIGN ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - aVertAlignLB.Show(); - aVertAlignFL.Show(); - aVertAlignFT.Show(); - - const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich ); - aVertAlignLB.SelectEntryPos(rAlign.GetValue()); - } - - _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); - //text direction - if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) ) - { - const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich ); - aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() ); - aTextDirectionLB.SaveValue(); - } - - aSnapToGridCB.SaveValue(); - aVertAlignLB.SaveValue(); - aLeft.SaveValue(); - aRight.SaveValue(); - aCenter.SaveValue(); - aJustify.SaveValue(); - aLastLineLB.SaveValue(); - aExpandCB.SaveValue(); - - UpdateExample_Impl(sal_True); -} - -IMPL_LINK( SvxParaAlignTabPage, AlignHdl_Impl, RadioButton*, EMPTYARG ) -{ - sal_Bool bJustify = aJustify.IsChecked(); - aLastLineFT.Enable(bJustify); - aLastLineLB.Enable(bJustify); - aExpandCB.Enable(bJustify); - UpdateExample_Impl(sal_False); - return 0; -} - -IMPL_LINK( SvxParaAlignTabPage, LastLineHdl_Impl, ListBox*, EMPTYARG ) -{ - UpdateExample_Impl(sal_False); - return 0; -} - -IMPL_LINK( SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox*, EMPTYARG ) -{ - SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue(); - switch ( eDir ) - { - // check the default alignment for this text direction - case FRMDIR_HORI_LEFT_TOP : aLeft.Check( sal_True ); break; - case FRMDIR_HORI_RIGHT_TOP : aRight.Check( sal_True ); break; - case FRMDIR_ENVIRONMENT : /* do nothing */ break; - default: - { - DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" ); - } - } - - return 0; -} - -void SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll ) -{ - if ( aLeft.IsChecked() ) - aExampleWin.SetAdjust( SVX_ADJUST_LEFT ); - else if ( aRight.IsChecked() ) - aExampleWin.SetAdjust( SVX_ADJUST_RIGHT ); - else if ( aCenter.IsChecked() ) - aExampleWin.SetAdjust( SVX_ADJUST_CENTER ); - else if ( aJustify.IsChecked() ) - { - aExampleWin.SetAdjust( SVX_ADJUST_BLOCK ); - SvxAdjust eLastBlock = SVX_ADJUST_LEFT; - sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos(); - if(nLBPos == 1) - eLastBlock = SVX_ADJUST_CENTER; - else if(nLBPos == 2) - eLastBlock = SVX_ADJUST_BLOCK; - aExampleWin.SetLastLine( eLastBlock ); - } - - aExampleWin.Draw( bAll ); -} - -// Erweiterungen fuer den Blocksatz einschalten -void SvxParaAlignTabPage::EnableJustifyExt() -{ - aLastLineFT.Show(); - aLastLineLB.Show(); - aExpandCB .Show(); - SvtLanguageOptions aCJKOptions; - if(aCJKOptions.IsAsianTypographyEnabled()) - aSnapToGridCB.Show(); - -} - -void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False); - if (pBoolItem) - if(pBoolItem->GetValue()) - EnableJustifyExt(); -} - -SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent, - const SfxItemSet& rSet ) -{ - return new SvxExtParagraphTabPage( pParent, rSet ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet ) -{ - sal_Bool bModified = sal_False; - sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); - const TriState eHyphenState = aHyphenBox.GetState(); - const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE ); - - if ( eHyphenState != aHyphenBox.GetSavedValue() || - aExtHyphenBeforeBox.IsValueModified() || - aExtHyphenAfterBox.IsValueModified() || - aMaxHyphenEdit.IsValueModified() ) - { - SvxHyphenZoneItem aHyphen( - (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) ); - aHyphen.SetHyphen( eHyphenState == STATE_CHECK ); - - if ( eHyphenState == STATE_CHECK ) - { - aHyphen.GetMinLead() = (sal_uInt8)aExtHyphenBeforeBox.GetValue(); - aHyphen.GetMinTrail() = (sal_uInt8)aExtHyphenAfterBox.GetValue(); - } - aHyphen.GetMaxHyphens() = (sal_uInt8)aMaxHyphenEdit.GetValue(); - - if ( !pOld || - !( *(SvxHyphenZoneItem*)pOld == aHyphen ) || - eHyphenState != aHyphenBox.GetSavedValue()) - { - rOutSet.Put( aHyphen ); - bModified = sal_True; - } - } - - if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified()) - { - SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, - (sal_uInt16)aPagenumEdit.GetValue() ); - - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM ); - - if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() ) - { - rOutSet.Put( aPageNum ); - bModified = sal_True; - } - } - - // Seitenumbruch - - TriState eState = aApplyCollBtn.GetState(); - bool bIsPageModel = false; - - _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); - String sPage; - if ( eState != aApplyCollBtn.GetSavedValue() || - ( STATE_CHECK == eState && - aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) ) - { - if ( eState == STATE_CHECK ) - { - sPage = aApplyCollBox.GetSelectEntry(); - bIsPageModel = 0 != sPage.Len(); - } - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL ); - - if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage ) - { - rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) ); - bModified = sal_True; - } - else - bIsPageModel = false; - } - else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled()) - bIsPageModel = true; - else - rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) ); - - _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); - - if ( bIsPageModel ) - // wird PageModel eingeschaltet, dann immer PageBreak ausschalten - rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) ); - else - { - eState = aPageBreakBox.GetState(); - SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, sal_False); - - if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) || - eState != aPageBreakBox.GetSavedValue() || - aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue() || - aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() ) - { - const SvxFmtBreakItem rOldBreak( - (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich )); - SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which()); - - switch ( eState ) - { - case STATE_CHECK: - { - sal_Bool bBefore = aBreakPositionLB.GetSelectEntryPos() == 0; - - if ( aBreakTypeLB.GetSelectEntryPos() == 0 ) - { - if ( bBefore ) - aBreak.SetValue( SVX_BREAK_PAGE_BEFORE ); - else - aBreak.SetValue( SVX_BREAK_PAGE_AFTER ); - } - else - { - if ( bBefore ) - aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE ); - else - aBreak.SetValue( SVX_BREAK_COLUMN_AFTER ); - } - break; - } - - case STATE_NOCHECK: - aBreak.SetValue( SVX_BREAK_NONE ); - break; - default: ; //prevent warning - } - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK ); - - if ( eState != aPageBreakBox.GetSavedValue() || - !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) ) - { - bModified = sal_True; - rOutSet.Put( aBreak ); - } - } - } - - - // Absatztrennung - _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); - eState = aKeepTogetherBox.GetState(); - - if ( eState != aKeepTogetherBox.GetSavedValue() ) - { - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT ); - - if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() != - ( eState == STATE_NOCHECK ) ) - { - rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) ); - bModified = sal_True; - } - } - - // Absaetze zusammenhalten - _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); - eState = aKeepParaBox.GetState(); - - if ( eState != aKeepParaBox.GetSavedValue() ) - { - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP ); - - // hat sich der Status geaendert, muss immer geputtet werden - rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) ); - bModified = sal_True; - } - - // Witwen und Waisen - _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); - eState = aWidowBox.GetState(); - - if ( eState != aWidowBox.GetSavedValue() || - aWidowRowNo.IsValueModified() ) - { - SvxWidowsItem rItem( eState == STATE_CHECK ? - (sal_uInt8)aWidowRowNo.GetValue() : 0, _nWhich ); - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS ); - - if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) ) - { - rOutSet.Put( rItem ); - bModified = sal_True; - } - } - - _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); - eState = aOrphanBox.GetState(); - - if ( eState != aOrphanBox.GetSavedValue() || - aOrphanRowNo.IsValueModified() ) - { - SvxOrphansItem rItem( eState == STATE_CHECK ? - (sal_uInt8)aOrphanRowNo.GetValue() : 0, _nWhich ); - pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS ); - - if ( eState != aOrphanBox.GetSavedValue() || - !pOld || - !( *(const SvxOrphansItem*)pOld == rItem ) ) - { - rOutSet.Put( rItem ); - bModified = sal_True; - } - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet ) -{ - sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE ); - SfxItemState eItemState = rSet.GetItemState( _nWhich ); - - sal_Bool bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE; - sal_Bool bIsHyphen = sal_False; - if( !bHtmlMode && bItemAvailable ) - { - const SvxHyphenZoneItem& rHyphen = - (const SvxHyphenZoneItem&)rSet.Get( _nWhich ); - aHyphenBox.EnableTriState( sal_False ); - - bIsHyphen = rHyphen.IsHyphen(); - aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK ); - - aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() ); - aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() ); - aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() ); - } - else - { - aHyphenBox.SetState( STATE_DONTKNOW ); - } - sal_Bool bEnable = bItemAvailable && bIsHyphen; - aExtHyphenBeforeBox.Enable(bEnable); - aExtHyphenAfterBox.Enable(bEnable); - aBeforeText.Enable(bEnable); - aAfterText.Enable(bEnable); - aMaxHyphenLabel.Enable(bEnable); - aMaxHyphenEdit.Enable(bEnable); - - _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM ); - - if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE ) - { - const sal_uInt16 nPageNum = - ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue(); - aPagenumEdit.SetValue( nPageNum ); - } - - if ( bPageBreak ) - { - // zuerst PageModel behandeln - _nWhich = GetWhich( SID_ATTR_PARA_MODEL ); - sal_Bool bIsPageModel = sal_False; - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_SET ) - { - aApplyCollBtn.EnableTriState( sal_False ); - - const SvxPageModelItem& rModel = - (const SvxPageModelItem&)rSet.Get( _nWhich ); - String aStr( rModel.GetValue() ); - - if ( aStr.Len() && - aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND ) - { - aApplyCollBox.SelectEntry( aStr ); - aApplyCollBtn.SetState( STATE_CHECK ); - bIsPageModel = sal_True; - - aPageBreakBox.Enable(); - aPageBreakBox.EnableTriState( sal_False ); - aBreakTypeFT.Enable(); - aBreakTypeLB.Enable(); - aBreakPositionFT.Enable(); - aBreakPositionLB.Enable(); - aApplyCollBtn.Enable(); - aPageBreakBox.SetState( STATE_CHECK ); - - //select page break - aBreakTypeLB.SelectEntryPos(0); - //select break before - aBreakPositionLB.SelectEntryPos(0); - } - else - { - aApplyCollBox.SetNoSelection(); - aApplyCollBtn.SetState( STATE_NOCHECK ); - } - } - else if ( SFX_ITEM_DONTCARE == eItemState ) - { - aApplyCollBtn.EnableTriState( sal_True ); - aApplyCollBtn.SetState( STATE_DONTKNOW ); - aApplyCollBox.SetNoSelection(); - } - else - { - aApplyCollBtn.Enable(sal_False); - aApplyCollBox.Enable(sal_False); - aPagenumEdit.Enable(sal_False); - aPagenumText.Enable(sal_False); - } - - if ( !bIsPageModel ) - { - _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - const SvxFmtBreakItem& rPageBreak = - (const SvxFmtBreakItem&)rSet.Get( _nWhich ); - - SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue(); - - // PageBreak nicht ueber CTRL-RETURN, - // dann kann CheckBox frei gegeben werden - aPageBreakBox.Enable(); - aPageBreakBox.EnableTriState( sal_False ); - aBreakTypeFT.Enable(); - aBreakTypeLB.Enable(); - aBreakPositionFT.Enable(); - aBreakPositionLB.Enable(); - - aPageBreakBox.SetState( STATE_CHECK ); - - sal_Bool _bEnable = eBreak != SVX_BREAK_NONE && - eBreak != SVX_BREAK_COLUMN_BEFORE && - eBreak != SVX_BREAK_COLUMN_AFTER; - aApplyCollBtn.Enable(_bEnable); - if(!_bEnable) - { - aApplyCollBox.Enable(_bEnable); - aPagenumEdit.Enable(_bEnable); - } - - if ( eBreak == SVX_BREAK_NONE ) - aPageBreakBox.SetState( STATE_NOCHECK ); - - sal_uInt16 nType = 0; // selection position in break type ListBox : Page - sal_uInt16 nPosition = 0; // selection position in break position ListBox : Before - switch ( eBreak ) - { - case SVX_BREAK_PAGE_BEFORE: - break; - case SVX_BREAK_PAGE_AFTER: - nPosition = 1; - break; - case SVX_BREAK_COLUMN_BEFORE: - nType = 1; - break; - case SVX_BREAK_COLUMN_AFTER: - nType = 1; - nPosition = 1; - break; - default: ;//prevent warning - } - aBreakTypeLB.SelectEntryPos(nType); - aBreakPositionLB.SelectEntryPos(nPosition); - } - else if ( SFX_ITEM_DONTCARE == eItemState ) - aPageBreakBox.SetState( STATE_DONTKNOW ); - else - { - aPageBreakBox.Enable(sal_False); - aBreakTypeFT.Enable(sal_False); - aBreakTypeLB.Enable(sal_False); - aBreakPositionFT.Enable(sal_False); - aBreakPositionLB.Enable(sal_False); - } - } - - PageBreakPosHdl_Impl( &aBreakPositionLB ); - PageBreakHdl_Impl( &aPageBreakBox ); - } - - _nWhich = GetWhich( SID_ATTR_PARA_KEEP ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - aKeepParaBox.EnableTriState( sal_False ); - const SvxFmtKeepItem& rKeep = - (const SvxFmtKeepItem&)rSet.Get( _nWhich ); - - if ( rKeep.GetValue() ) - aKeepParaBox.SetState( STATE_CHECK ); - else - aKeepParaBox.SetState( STATE_NOCHECK ); - } - else if ( SFX_ITEM_DONTCARE == eItemState ) - aKeepParaBox.SetState( STATE_DONTKNOW ); - else - aKeepParaBox.Enable(sal_False); - - _nWhich = GetWhich( SID_ATTR_PARA_SPLIT ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SFX_ITEM_AVAILABLE ) - { - const SvxFmtSplitItem& rSplit = - (const SvxFmtSplitItem&)rSet.Get( _nWhich ); - aKeepTogetherBox.EnableTriState( sal_False ); - - if ( !rSplit.GetValue() ) - aKeepTogetherBox.SetState( STATE_CHECK ); - else - { - aKeepTogetherBox.SetState( STATE_NOCHECK ); - - // Witwen und Waisen - aWidowBox.Enable(); - _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS ); - SfxItemState eTmpState = rSet.GetItemState( _nWhich ); - - if ( eTmpState >= SFX_ITEM_AVAILABLE ) - { - const SvxWidowsItem& rWidow = - (const SvxWidowsItem&)rSet.Get( _nWhich ); - aWidowBox.EnableTriState( sal_False ); - const sal_uInt16 nLines = rWidow.GetValue(); - - sal_Bool _bEnable = nLines > 0; - aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) ); - aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); - aWidowRowNo.Enable(_bEnable); - aWidowRowLabel.Enable(_bEnable); - - } - else if ( SFX_ITEM_DONTCARE == eTmpState ) - aWidowBox.SetState( STATE_DONTKNOW ); - else - aWidowBox.Enable(sal_False); - - aOrphanBox.Enable(); - _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS ); - eTmpState = rSet.GetItemState( _nWhich ); - - if ( eTmpState >= SFX_ITEM_AVAILABLE ) - { - const SvxOrphansItem& rOrphan = - (const SvxOrphansItem&)rSet.Get( _nWhich ); - const sal_uInt16 nLines = rOrphan.GetValue(); - aOrphanBox.EnableTriState( sal_False ); - - sal_Bool _bEnable = nLines > 0; - aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK); - aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) ); - aOrphanRowNo.Enable(_bEnable); - aOrphanRowLabel.Enable(_bEnable); - - } - else if ( SFX_ITEM_DONTCARE == eTmpState ) - aOrphanBox.SetState( STATE_DONTKNOW ); - else - aOrphanBox.Enable(sal_False); - } - } - else if ( SFX_ITEM_DONTCARE == eItemState ) - aKeepTogetherBox.SetState( STATE_DONTKNOW ); - else - aKeepTogetherBox.Enable(sal_False); - - // damit alles richt enabled wird - KeepTogetherHdl_Impl( 0 ); - WidowHdl_Impl( 0 ); - OrphanHdl_Impl( 0 ); - - aHyphenBox.SaveValue(); - aExtHyphenBeforeBox.SaveValue(); - aExtHyphenAfterBox.SaveValue(); - aMaxHyphenEdit.SaveValue(); - aPageBreakBox.SaveValue(); - aBreakPositionLB.SaveValue(); - aBreakTypeLB.SaveValue(); - aApplyCollBtn.SaveValue(); - aApplyCollBox.SaveValue(); - aPagenumEdit.SaveValue(); - aKeepTogetherBox.SaveValue(); - aKeepParaBox.SaveValue(); - aWidowBox.SaveValue(); - aOrphanBox.SaveValue(); -} - -// ----------------------------------------------------------------------- - -int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -void SvxExtParagraphTabPage::DisablePageBreak() -{ - bPageBreak = sal_False; - aPageBreakBox.Enable(sal_False); - aBreakTypeLB.RemoveEntry(0); - aBreakPositionFT.Enable(sal_False); - aBreakPositionLB.Enable(sal_False); - aApplyCollBtn.Enable(sal_False); - aApplyCollBox.Enable(sal_False); - aPagenumEdit.Enable(sal_False); -} - -// ----------------------------------------------------------------------- - -SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ), - - aExtFL ( this, CUI_RES( FL_HYPHEN ) ), - aHyphenBox ( this, CUI_RES( BTN_HYPHEN ) ), - aBeforeText ( this, CUI_RES( FT_HYPHENBEFORE ) ), - aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE ) ), - aAfterText ( this, CUI_RES( FT_HYPHENAFTER ) ), - aExtHyphenAfterBox ( this, CUI_RES( ED_HYPHENAFTER ) ), - aMaxHyphenLabel ( this, CUI_RES( FT_MAXHYPH ) ), - aMaxHyphenEdit ( this, CUI_RES( ED_MAXHYPH ) ), - aBreaksFL ( this, CUI_RES( FL_BREAKS ) ), - aPageBreakBox ( this, CUI_RES( BTN_PAGEBREAK ) ), - aBreakTypeFT ( this, CUI_RES( FT_BREAKTYPE )), - aBreakTypeLB ( this, CUI_RES( LB_BREAKTYPE )), - aBreakPositionFT ( this, CUI_RES( FT_BREAKPOSITION )), - aBreakPositionLB ( this, CUI_RES( LB_BREAKPOSITION )), - aApplyCollBtn ( this, CUI_RES( BTN_PAGECOLL ) ), - aApplyCollBox ( this, CUI_RES( LB_PAGECOLL ) ), - aPagenumText ( this, CUI_RES( FT_PAGENUM ) ), - aPagenumEdit ( this, CUI_RES( ED_PAGENUM ) ), - aExtendFL ( this, CUI_RES( FL_OPTIONS ) ), - aKeepTogetherBox ( this, CUI_RES( BTN_KEEPTOGETHER ) ), - aKeepParaBox ( this, CUI_RES( CB_KEEPTOGETHER ) ), - aOrphanBox ( this, CUI_RES( BTN_ORPHANS ) ), - aOrphanRowNo ( this, CUI_RES( ED_ORPHANS ) ), - aOrphanRowLabel ( this, CUI_RES( FT_ORPHANS ) ), - aWidowBox ( this, CUI_RES( BTN_WIDOWS ) ), - aWidowRowNo ( this, CUI_RES( ED_WIDOWS ) ), - aWidowRowLabel ( this, CUI_RES( FT_WIDOWS ) ), - bPageBreak ( sal_True ), - bHtmlMode ( sal_False ), - nStdPos ( 0 ) -{ - FreeResource(); - - aApplyCollBox.SetAccessibleRelationLabeledBy(&aApplyCollBtn); - aApplyCollBox.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE))); - aOrphanRowNo.SetAccessibleRelationLabeledBy(&aOrphanBox); - aWidowRowNo.SetAccessibleRelationLabeledBy(&aWidowBox); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - aHyphenBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) ); - aPageBreakBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) ); - aKeepTogetherBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) ); - aWidowBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) ); - aOrphanBox.SetClickHdl( LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) ); - aApplyCollBtn.SetClickHdl( LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) ); - aBreakTypeLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) ); - aBreakPositionLB.SetSelectHdl( LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) ); - - SfxObjectShell* pSh = SfxObjectShell::Current(); - if ( pSh ) - { - SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool(); - pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE ); - SfxStyleSheetBase* pStyle = pPool->First(); - String aStdName; - - while( pStyle ) - { - if ( aStdName.Len() == 0 ) - // first style == standard style - aStdName = pStyle->GetName(); - aApplyCollBox.InsertEntry( pStyle->GetName() ); - pStyle = pPool->Next(); - } - nStdPos = aApplyCollBox.GetEntryPos( aStdName ); - } - - sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr ); - if ( nHtmlMode & HTMLMODE_ON ) - { - bHtmlMode = sal_True; - aHyphenBox .Enable(sal_False); - aBeforeText .Enable(sal_False); - aExtHyphenBeforeBox .Enable(sal_False); - aAfterText .Enable(sal_False); - aExtHyphenAfterBox .Enable(sal_False); - aMaxHyphenLabel .Enable(sal_False); - aMaxHyphenEdit .Enable(sal_False); - aExtFL .Enable(sal_False); - aPagenumText .Enable(sal_False); - aPagenumEdit .Enable(sal_False); - // no column break in HTML - aBreakTypeLB.RemoveEntry(1); - } -} - -// ----------------------------------------------------------------------- - -SvxExtParagraphTabPage::~SvxExtParagraphTabPage() -{ -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxExtParagraphTabPage::GetRanges() -{ - return pExtRanges; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, PageBreakHdl_Impl, TriStateBox *, EMPTYARG ) -{ - switch ( aPageBreakBox.GetState() ) - { - case STATE_CHECK: - aBreakTypeFT.Enable(); - aBreakTypeLB.Enable(); - aBreakPositionFT.Enable(); - aBreakPositionLB.Enable(); - - if ( 0 == aBreakTypeLB.GetSelectEntryPos()&& - 0 == aBreakPositionLB.GetSelectEntryPos() ) - { - aApplyCollBtn.Enable(); - - sal_Bool bEnable = STATE_CHECK == aApplyCollBtn.GetState() && - aApplyCollBox.GetEntryCount(); - aApplyCollBox.Enable(bEnable); - if(!bHtmlMode) - { - aPagenumText.Enable(bEnable); - aPagenumEdit.Enable(bEnable); - } - } - break; - - case STATE_NOCHECK: - case STATE_DONTKNOW: - aApplyCollBtn.SetState( STATE_NOCHECK ); - aApplyCollBtn.Enable(sal_False); - aApplyCollBox.Enable(sal_False); - aPagenumText.Enable(sal_False); - aPagenumEdit.Enable(sal_False); - aBreakTypeFT.Enable(sal_False); - aBreakTypeLB.Enable(sal_False); - aBreakPositionFT.Enable(sal_False); - aBreakPositionLB.Enable(sal_False); - break; - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, KeepTogetherHdl_Impl, TriStateBox *, EMPTYARG ) -{ - sal_Bool bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK; - aWidowBox.Enable(bEnable); - aOrphanBox.Enable(bEnable); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, WidowHdl_Impl, TriStateBox *, EMPTYARG ) -{ - switch ( aWidowBox.GetState() ) - { - case STATE_CHECK: - aWidowRowNo.Enable(); - aWidowRowLabel.Enable(); - aKeepTogetherBox.Enable(sal_False); - break; - - case STATE_NOCHECK: - if ( aOrphanBox.GetState() == STATE_NOCHECK ) - aKeepTogetherBox.Enable(); - - // kein break - case STATE_DONTKNOW: - aWidowRowNo.Enable(sal_False); - aWidowRowLabel.Enable(sal_False); - break; - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, OrphanHdl_Impl, TriStateBox *, EMPTYARG ) -{ - switch( aOrphanBox.GetState() ) - { - case STATE_CHECK: - aOrphanRowNo.Enable(); - aOrphanRowLabel.Enable(); - aKeepTogetherBox.Enable(sal_False); - break; - - case STATE_NOCHECK: - if ( aWidowBox.GetState() == STATE_NOCHECK ) - aKeepTogetherBox.Enable(); - - // kein break - case STATE_DONTKNOW: - aOrphanRowNo.Enable(sal_False); - aOrphanRowLabel.Enable(sal_False); - break; - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, HyphenClickHdl_Impl, TriStateBox *, EMPTYARG ) -{ - - sal_Bool bEnable = aHyphenBox.GetState() == STATE_CHECK; - aBeforeText.Enable(bEnable); - aExtHyphenBeforeBox.Enable(bEnable); - aAfterText.Enable(bEnable); - aExtHyphenAfterBox.Enable(bEnable); - aMaxHyphenLabel.Enable(bEnable); - aMaxHyphenEdit.Enable(bEnable); - aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK); - - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, TriStateBox *, EMPTYARG ) -{ - sal_Bool bEnable = sal_False; - if ( aApplyCollBtn.GetState() == STATE_CHECK && - aApplyCollBox.GetEntryCount() ) - { - bEnable = sal_True; - aApplyCollBox.SelectEntryPos( nStdPos ); - } - else - { - aApplyCollBox.SetNoSelection(); - } - aApplyCollBox.Enable(bEnable); - if(!bHtmlMode) - { - aPagenumText.Enable(bEnable); - aPagenumEdit.Enable(bEnable); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox ) -{ - if ( 0 == pListBox->GetSelectEntryPos() ) - { - aApplyCollBtn.Enable(); - - sal_Bool bEnable = aApplyCollBtn.GetState() == STATE_CHECK && - aApplyCollBox.GetEntryCount(); - - aApplyCollBox.Enable(bEnable); - if(!bHtmlMode) - { - aPagenumText.Enable(bEnable); - aPagenumEdit.Enable(bEnable); - } - } - else if ( 1 == pListBox->GetSelectEntryPos() ) - { - aApplyCollBtn.SetState( STATE_NOCHECK ); - aApplyCollBtn.Enable(sal_False); - aApplyCollBox.Enable(sal_False); - aPagenumText.Enable(sal_False); - aPagenumEdit.Enable(sal_False); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox ) -{ - //column break or break break after - sal_uInt16 nBreakPos = aBreakPositionLB.GetSelectEntryPos(); - if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos) - { - aApplyCollBtn.SetState( STATE_NOCHECK ); - aApplyCollBtn.Enable(sal_False); - aApplyCollBox.Enable(sal_False); - aPagenumText.Enable(sal_False); - aPagenumEdit.Enable(sal_False); - } - else - PageBreakPosHdl_Impl( &aBreakPositionLB ); - return 0; -} - -void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet) -{ - - - SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False); - - if (pDisablePageBreakItem) - if ( pDisablePageBreakItem->GetValue()) - DisablePageBreak(); - - -} - -SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) : - SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet), - aOptionsFL( this, CUI_RES(FL_AS_OPTIONS )), - aForbiddenRulesCB( this, CUI_RES(CB_AS_FORBIDDEN )), - aHangingPunctCB( this, CUI_RES(CB_AS_HANG_PUNC )), - aScriptSpaceCB( this, CUI_RES(CB_AS_SCRIPT_SPACE ))//, - -{ - FreeResource(); - - Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl ); - aHangingPunctCB.SetClickHdl( aLink ); - aScriptSpaceCB.SetClickHdl( aLink ); - aForbiddenRulesCB.SetClickHdl( aLink ); - -} - -SvxAsianTabPage::~SvxAsianTabPage() -{ -} - -SfxTabPage* SvxAsianTabPage::Create( Window* pParent, const SfxItemSet& rSet ) -{ - return new SvxAsianTabPage(pParent, rSet); -} - -sal_uInt16* SvxAsianTabPage::GetRanges() -{ - static sal_uInt16 pRanges[] = - { - SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES, - 0 - }; - return pRanges; -} - -sal_Bool SvxAsianTabPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bRet = sal_False; - SfxItemPool* pPool = rSet.GetPool(); - if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue()) - { - SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( - pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone(); - pNewItem->SetValue(aScriptSpaceCB.IsChecked()); - rSet.Put(*pNewItem); - delete pNewItem; - bRet = sal_True; - } - if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue()) - { - SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( - pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone(); - pNewItem->SetValue(aHangingPunctCB.IsChecked()); - rSet.Put(*pNewItem); - delete pNewItem; - bRet = sal_True; - } - if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue()) - { - SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get( - pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone(); - pNewItem->SetValue(aForbiddenRulesCB.IsChecked()); - rSet.Put(*pNewItem); - delete pNewItem; - bRet = sal_True; - } - return bRet; -} - -void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox) -{ - sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId); - SfxItemState eState = rSet.GetItemState(_nWhich, sal_True); - if(!eState || eState == SFX_ITEM_DISABLED ) - rBox.Enable(sal_False); - else if(eState >= SFX_ITEM_AVAILABLE) - { - rBox.EnableTriState( sal_False ); - rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue()); - } - else - rBox.SetState( STATE_DONTKNOW ); - rBox.SaveValue(); -} - - -void SvxAsianTabPage::Reset( const SfxItemSet& rSet ) -{ - lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB ); - lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB ); - - //character distance not yet available - lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB ); -} - -IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox ) -{ - pBox->EnableTriState( sal_False ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/paragrph.hrc b/cui/source/tabpages/paragrph.hrc deleted file mode 100644 index d831d447f..000000000 --- a/cui/source/tabpages/paragrph.hrc +++ /dev/null @@ -1,125 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_PARAGRPH_HRC -#define _SVX_PARAGRPH_HRC - -// 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_FORBIDDEN 4 - -#define CB_AS_SCRIPT_SPACE 7 - -//IAccessibility2 Implementation 2009----- -#define STR_EXAMPLE 5010 -#define STR_PAGE_STYLE 5011 -//-----IAccessibility2 Implementation 2009 -#endif - diff --git a/cui/source/tabpages/paragrph.src b/cui/source/tabpages/paragrph.src deleted file mode 100644 index 46dfb5cdf..000000000 --- a/cui/source/tabpages/paragrph.src +++ /dev/null @@ -1,742 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include "helpid.hrc" -#include "paragrph.hrc" -#include - - // RID_SVXPAGE_STD_PARAGRAPH --------------------------------------------- -TabPage RID_SVXPAGE_STD_PARAGRAPH -{ - HelpId = HID_FORMAT_PARAGRAPH_STD ; - Hide = TRUE ; - Text [ en-US ] = "Indents and Spacing" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedText FT_LEFTINDENT - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Before text" ; - }; - MetricField ED_LEFTINDENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_LEFTINDENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 14 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_RIGHTINDENT - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "After text" ; - }; - MetricField ED_RIGHTINDENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_RIGHTINDENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 30 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_FLINEINDENT - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "~First line" ; - Left = TRUE ; - }; - MetricField ED_FLINEINDENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_FLINEINDENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 46 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = -9999 ; - Last = 9999 ; - SpinSize = 10 ; - }; - CheckBox CB_AUTO - { - HelpID = "cui:CheckBox:RID_SVXPAGE_STD_PARAGRAPH:CB_AUTO"; - Pos = MAP_APPFONT ( 12 , 61 ) ; - Size = MAP_APPFONT ( 120 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "~Automatic" ; - }; - FixedLine FL_INDENT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Text [ en-US ] = "Indent" ; - }; - FixedText FT_TOPDIST - { - Pos = MAP_APPFONT ( 12 , 90 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Ab~ove paragraph" ; - }; - MetricField ED_TOPDIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_TOPDIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 88 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_BOTTOMDIST - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Below paragraph" ; - }; - MetricField ED_BOTTOMDIST - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_BOTTOMDIST"; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 104 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedLine FL_DIST - { - Pos = MAP_APPFONT ( 6 , 77 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Text [ en-US ] = "Spacing" ; - }; - ListBox LB_LINEDIST - { - HelpID = "cui:ListBox:RID_SVXPAGE_STD_PARAGRAPH:LB_LINEDIST"; - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 55 , 72 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Single" ; Default ; > ; - < "1.5 lines" ; Default ; > ; - < "Double" ; Default ; > ; - < "Proportional" ; Default ; > ; - < "At least" ; Default ; > ; - < "Leading" ; Default ; > ; - }; - }; - String ST_LINEDIST_ABS - { - Text [ en-US ] = "Fixed" ; - }; - FixedText FT_LINEDIST - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 70 , 135 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "of" ; - Left = TRUE ; - }; - MetricField ED_LINEDISTPERCENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_LINEDISTPERCENT"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 135 , 133 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 50 ; - Maximum = 200 ; - Value = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - First = 50 ; - Last = 200 ; - SpinSize = 1 ; - }; - MetricField ED_LINEDISTMETRIC - { - HelpID = "cui:MetricField:RID_SVXPAGE_STD_PARAGRAPH:ED_LINEDISTMETRIC"; - Disable = TRUE ; - Border = TRUE ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 135 , 133 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedLine FL_LINEDIST - { - Pos = MAP_APPFONT ( 6 , 122 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Text [ en-US ] = "Line spacing" ; - }; - Window WN_EXAMPLE - { - Border = TRUE ; - Pos = MAP_APPFONT ( 185 , 7 ) ; - Size = MAP_APPFONT ( 68 , 112 ) ; - }; - CheckBox CB_REGISTER - { - HelpID = "cui:CheckBox:RID_SVXPAGE_STD_PARAGRAPH:CB_REGISTER"; - Pos = MAP_APPFONT ( 12 , 162 ) ; - Size = MAP_APPFONT ( 120 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "A~ctivate" ; - }; - FixedLine FL_REGISTER - { - Pos = MAP_APPFONT ( 6 , 151 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Hide = TRUE ; - Text [ en-US ] = "Register-true" ; - }; - -}; - // RID_SVXPAGE_ALIGN_PARAGRAPH --------------------------------------------- -TabPage RID_SVXPAGE_ALIGN_PARAGRAPH -{ - HelpId = HID_FORMAT_PARAGRAPH_ALIGN ; - Hide = TRUE ; - Text [ en-US ] = "Alignment" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_ALIGN - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Text [ en-US ] = "Options" ; - Group = TRUE ; - }; - RadioButton BTN_LEFTALIGN - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_LEFTALIGN"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 161 , 10 ) ; - Text [ en-US ] = "~Left" ; - Group = TRUE ; - }; - RadioButton BTN_RIGHTALIGN - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_RIGHTALIGN"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 161 , 10 ) ; - Text [ en-US ] = "Righ~t" ; - }; - RadioButton BTN_CENTERALIGN - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_CENTERALIGN"; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 161 , 10 ) ; - Text [ en-US ] = "~Center" ; - }; - RadioButton BTN_JUSTIFYALIGN - { - HelpID = "cui:RadioButton:RID_SVXPAGE_ALIGN_PARAGRAPH:BTN_JUSTIFYALIGN"; - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 161 , 10 ) ; - Text [ en-US ] = "Justified" ; - }; - String ST_LEFTALIGN_ASIAN - { - Text [ en-US ] = "~Left/Top" ; - }; - String ST_RIGHTALIGN_ASIAN - { - Text [ en-US ] = "Righ~t/Bottom" ; - }; - FixedText FT_LASTLINE - { - Pos = MAP_APPFONT ( 20 , 72 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Hide = TRUE ; - Text [ en-US ] = "~Last line" ; - }; - ListBox LB_LASTLINE - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGN_PARAGRAPH:LB_LASTLINE"; - Pos = MAP_APPFONT ( 105 , 70 ) ; - Size = MAP_APPFONT ( 70 , 50 ) ; - DropDown = TRUE ; - Hide = TRUE ; - StringList [ en-US ] = - { - < "Default" ; Default ; > ; - < "Left" ; Default ; > ; - < "Centered" ; Default ; > ; - < "Justified"; Default; > ; - }; - }; - CheckBox CB_EXPAND - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ALIGN_PARAGRAPH:CB_EXPAND"; - Pos = MAP_APPFONT ( 20 , 86 ) ; - Size = MAP_APPFONT ( 153 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "~Expand single word" ; - }; - CheckBox CB_SNAP - { - HelpID = "cui:CheckBox:RID_SVXPAGE_ALIGN_PARAGRAPH:CB_SNAP"; - Pos = MAP_APPFONT ( 20 , 100 ) ; - Size = MAP_APPFONT ( 153 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "Snap to text grid (if active)"; - }; - Window WN_EXAMPLE - { - Border = TRUE ; - Pos = MAP_APPFONT ( 185 , 7 ) ; - Size = MAP_APPFONT ( 68 , 112 ) ; - }; - FixedLine FL_VERTALIGN - { - Pos = MAP_APPFONT ( 6 , 122 ) ; - Size = MAP_APPFONT ( 173 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "Text-to-text"; - }; - FixedText FT_VERTALIGN - { - Pos = MAP_APPFONT ( 12 , 135 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Hide = TRUE; - Text [ en-US ] = "~Alignment"; - }; - ListBox LB_VERTALIGN - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGN_PARAGRAPH:LB_VERTALIGN"; - Pos = MAP_APPFONT ( 105 , 133 ) ; - Size = MAP_APPFONT ( 70 , 50 ) ; - DropDown = TRUE ; - Hide = TRUE ; - StringList [ en-US ] = - { - < "Automatic" ; > ; - < "Base line" ; > ; - < "Top" ; > ; - < "Middle" ; > ; - < "Bottom" ; > ; - }; - }; - FixedLine FL_PROPERTIES - { - Pos = MAP_APPFONT ( 6 , 154 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Hide = TRUE ; - Text [ en-US ] = "Properties"; - }; - FixedText FT_TEXTDIRECTION - { - Pos = MAP_APPFONT ( 12 , 167 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Hide = TRUE ; - Text [ en-US ] = "Text ~direction"; - }; - ListBox LB_TEXTDIRECTION - { - HelpID = "cui:ListBox:RID_SVXPAGE_ALIGN_PARAGRAPH:LB_TEXTDIRECTION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 105 , 165 ) ; - Size = MAP_APPFONT ( 146 , 50 ) ; - DropDown = TRUE ; - Hide = TRUE ; - }; -}; - // RID_SVXPAGE_EXT_PARAGRAPH --------------------------------------------- -TabPage RID_SVXPAGE_EXT_PARAGRAPH -{ - HelpId = HID_FORMAT_PARAGRAPH_EXT ; - Hide = TRUE ; - Text [ en-US ] = "Text Flow" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - TriStateBox BTN_HYPHEN - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_HYPHEN"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "A~utomatically" ; - }; - NumericField ED_HYPHENBEFORE - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_HYPHENBEFORE"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 21 , 26 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 9 ; - Value = 2 ; - First = 2 ; - Last = 9 ; - }; - FixedText FT_HYPHENBEFORE - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 48 , 29 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - Text [ en-US ] = "C~haracters at line end" ; - Left = TRUE ; - }; - NumericField ED_HYPHENAFTER - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_HYPHENAFTER"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 21 , 41 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 9 ; - Value = 2 ; - First = 2 ; - Last = 9 ; - }; - FixedText FT_HYPHENAFTER - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 48 , 43 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - Text [ en-US ] = "Cha~racters at line begin" ; - Left = TRUE ; - }; - FixedText FT_MAXHYPH - { - Pos = MAP_APPFONT ( 48 , 57 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "~Maximum number of consecutive hyphens" ; - }; - NumericField ED_MAXHYPH - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_MAXHYPH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 21 , 55 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99 ; - Last = 99 ; - }; - FixedLine FL_HYPHEN - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Hyphenation" ; - }; - FixedLine FL_OPTIONS - { // is moved one section deeper to not raise unnecessary translations - Pos = MAP_APPFONT ( 6 , 116 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Options" ; - Group = TRUE ; - }; - FixedLine FL_BREAKS - { - Pos = MAP_APPFONT ( 6 , 73 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Breaks" ; - Group = TRUE ; - }; - TriStateBox BTN_PAGEBREAK - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_PAGEBREAK"; - // Disable = TRUE; - Pos = MAP_APPFONT ( 12 , 86 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; - Text [ en-US ] = "Insert" ; - Group = TRUE ; - }; - FixedText FT_BREAKTYPE - { - Pos = MAP_APPFONT ( 75 , 86 ) ; - Size = MAP_APPFONT ( 21 , 10 ) ; - Text [ en-US ] = "~Type"; - }; - ListBox LB_BREAKTYPE - { - HelpID = "cui:ListBox:RID_SVXPAGE_EXT_PARAGRAPH:LB_BREAKTYPE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 98 , 84 ) ; - Size = MAP_APPFONT ( 61 , 50 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Page" ; 0; > ; - < "Column" ; 1; > ; - }; - }; - FixedText FT_BREAKPOSITION - { - Pos = MAP_APPFONT ( 163 , 86 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Right = TRUE; - Text [ en-US ] = "Position"; - }; - ListBox LB_BREAKPOSITION - { - HelpID = "cui:ListBox:RID_SVXPAGE_EXT_PARAGRAPH:LB_BREAKPOSITION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 211 , 84 ) ; - Size = MAP_APPFONT ( 40 , 50 ) ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Before" ; 0; > ; - < "After" ; 1; > ; - }; - }; - TriStateBox BTN_PAGECOLL - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_PAGECOLL"; - // Disable = TRUE; - Pos = MAP_APPFONT (21 , 100 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "With Page St~yle" ; - Group = TRUE ; - }; - ListBox LB_PAGECOLL - { - HelpID = "cui:ListBox:RID_SVXPAGE_EXT_PARAGRAPH:LB_PAGECOLL"; - // Disable = TRUE; - Pos = MAP_APPFONT ( 98 , 98 ) ; - Size = MAP_APPFONT ( 61 , 50 ) ; - DropDown = TRUE ; - Sort = TRUE; - }; - FixedText FT_PAGENUM - { - Pos = MAP_APPFONT ( 163 , 100 ) ; - Size = MAP_APPFONT ( 45 , 8 ) ; - Right = TRUE ; - Text [ en-US ] = "Page ~number" ; - }; - NumericField ED_PAGENUM - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_PAGENUM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 211 , 98 ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9999 ; - Value = 0 ; - First = 0 ; - Last = 9999 ; - }; - TriStateBox BTN_KEEPTOGETHER - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_KEEPTOGETHER"; - Pos = MAP_APPFONT ( 12 , 127 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "~Do not split paragraph" ; - Group = TRUE ; - }; - TriStateBox CB_KEEPTOGETHER - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:CB_KEEPTOGETHER"; - Pos = MAP_APPFONT ( 12, 141 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - Text [ en-US ] = "~Keep with next paragraph" ; - }; - TriStateBox BTN_ORPHANS - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_ORPHANS"; - Disable = TRUE ; - Pos = MAP_APPFONT ( 12 , 155 ) ; - Size = MAP_APPFONT ( 120 , 10 ) ; - Group = TRUE ; - Text [ en-US ] = "~Orphan control"; - }; - NumericField ED_ORPHANS - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_ORPHANS"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 134 , 153 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 9 ; - Value = 2 ; - First = 2 ; - Last = 9 ; - }; - FixedText FT_ORPHANS - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 161 , 155 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "Lines" ; - Left = TRUE ; - }; - TriStateBox BTN_WIDOWS - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_EXT_PARAGRAPH:BTN_WIDOWS"; - Disable = TRUE ; - Pos = MAP_APPFONT ( 12 , 169 ) ; - Size = MAP_APPFONT ( 120 , 10 ) ; - Group = TRUE ; - Text [ en-US ] = "~Widow control"; - }; - NumericField ED_WIDOWS - { - HelpID = "cui:NumericField:RID_SVXPAGE_EXT_PARAGRAPH:ED_WIDOWS"; - Disable = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( 134 , 167 ) ; - Size = MAP_APPFONT ( 24 , 12 ) ; - Group = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 2 ; - Maximum = 9 ; - Value = 2 ; - First = 2 ; - Last = 9 ; - }; - FixedText FT_WIDOWS - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 161 , 169 ) ; - Size = MAP_APPFONT ( 86 , 8 ) ; - Text [ en-US ] = "Lines" ; - Left = TRUE ; - }; -}; - -// Asian typography -TabPage RID_SVXPAGE_PARA_ASIAN -{ - HelpId = HID_SVXPAGE_PARA_ASIAN ; - Hide = TRUE ; - Text [ en-US ] = "Asian Typography"; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_AS_OPTIONS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Line change"; - }; - TriStateBox CB_AS_FORBIDDEN - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_FORBIDDEN"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Text [ en-US ] = "Apply list of forbidden characters to the beginning and end of lines"; - }; - TriStateBox CB_AS_HANG_PUNC - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_HANG_PUNC"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Text [ en-US ] = "Allow hanging punctuation"; - }; - TriStateBox CB_AS_SCRIPT_SPACE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_PARA_ASIAN:CB_AS_SCRIPT_SPACE"; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 242 , 10 ) ; - Text [ en-US ] = "Apply spacing between Asian, Latin and Complex text"; - }; -}; - -String STR_EXAMPLE -{ - Text [ en-US ] = "Example" ; -}; -String STR_PAGE_STYLE -{ - Text [ en-US ] = "Page Style" ; -}; - diff --git a/cui/source/tabpages/strings.src b/cui/source/tabpages/strings.src deleted file mode 100644 index 6c7f79d2e..000000000 --- a/cui/source/tabpages/strings.src +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include - -String RID_SVXSTR_DESC_GRADIENT -{ - Text [ en-US ] = "Please enter a name for the gradient:" ; -}; -String RID_SVXSTR_ASK_DEL_GRADIENT -{ - Text [ en-US ] = "Do you want to delete the gradient?" ; -}; -String RID_SVXSTR_ASK_CHANGE_GRADIENT -{ - Text [ en-US ] = "The gradient was modified without saving. \nModify the selected gradient or add a new gradient." ; -}; -String RID_SVXSTR_DESC_NEW_BITMAP -{ - Text [ en-US ] = "Please enter a name for the bitmap:" ; -}; -String RID_SVXSTR_DESC_EXT_BITMAP -{ - Text [ en-US ] = "Please enter a name for the external bitmap:" ; -}; -String RID_SVXSTR_ASK_DEL_BITMAP -{ - Text [ en-US ] = "Are you sure you want to delete the bitmap?" ; -}; -String RID_SVXSTR_ASK_CHANGE_BITMAP -{ - Text [ en-US ] = "The bitmap was modified without saving. \nModify the selected bitmap or add a new bitmap." ; -}; -String RID_SVXSTR_DESC_LINESTYLE -{ - Text [ en-US ] = "Please enter a name for the line style:" ; -}; -String RID_SVXSTR_ASK_DEL_LINESTYLE -{ - Text [ en-US ] = "Do you want to delete the line style?" ; -}; -String RID_SVXSTR_ASK_CHANGE_LINESTYLE -{ - Text [ en-US ] = "The line style was modified without saving. \nModify the selected line style or add a new line style." ; -}; -String RID_SVXSTR_DESC_HATCH -{ - Text [ en-US ] = "Please enter a name for the hatching:" ; -}; -String RID_SVXSTR_ASK_DEL_HATCH -{ - Text [ en-US ] = "Do you want to delete the hatching?" ; -}; -String RID_SVXSTR_ASK_CHANGE_HATCH -{ - Text [ en-US ] = "The hatching type was modified but not saved. \nModify the selected hatching type or add a new hatching type." ; -}; -String RID_SVXSTR_CHANGE -{ - Text [ en-US ] = "Modify" ; -}; -String RID_SVXSTR_ADD -{ - Text [ en-US ] = "Add" ; -}; -String RID_SVXSTR_DESC_COLOR -{ - Text [ en-US ] = "Please enter a name for the new color:" ; -}; -String RID_SVXSTR_ASK_DEL_COLOR -{ - Text [ en-US ] = "Do you want to delete the color?" ; -}; -String RID_SVXSTR_ASK_CHANGE_COLOR -{ - Text [ en-US ] = "The color was modified without saving.\nModify the selected color or add a new color." ; -}; -String RID_SVXSTR_TABLE -{ - Text [ en-US ] = "Table" ; -}; -String RID_SVXSTR_WRITE_DATA_ERROR -{ - Text [ en-US ] = "The file could not be saved!" ; -}; -String RID_SVXSTR_READ_DATA_ERROR -{ - Text [ en-US ] = "The file could not be loaded!" ; -}; -String RID_SVXSTR_WARN_TABLE_OVERWRITE -{ - Text [ en-US ] = "The list was modified without saving. Would you like to save the list now?" ; -}; -String RID_SVXSTR_WARN_NAME_DUPLICATE -{ - Text [ en-US ] = "The name you have entered already exists. \nPlease choose another name." ; -}; -String RID_SVXSTR_DESC_LINEEND -{ - Text [ en-US ] = "Please enter a name for the new arrowhead:" ; -}; -String RID_SVXSTR_ASK_DEL_LINEEND -{ - Text [ en-US ] = "Do you want to delete the arrowhead?" ; -}; -String RID_SVXSTR_ASK_CHANGE_LINEEND -{ - Text [ en-US ] = "The arrowhead was modified without saving.\nWould you like to save the arrowhead now?" ; -}; - diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx deleted file mode 100644 index 2d08dede0..000000000 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ /dev/null @@ -1,1867 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::text; -#define SwFPos SvxSwFramePosString - -struct FrmMap -{ - SvxSwFramePosString::StringId eStrId; - SvxSwFramePosString::StringId eMirrorStrId; - short nAlign; - sal_uLong nLBRelations; -}; - -struct RelationMap -{ - SvxSwFramePosString::StringId eStrId; - SvxSwFramePosString::StringId eMirrorStrId; - sal_uLong nLBRelation; - short nRelation; -}; -struct StringIdPair_Impl -{ - SvxSwFramePosString::StringId eHori; - SvxSwFramePosString::StringId eVert; -}; - -#define LB_FRAME 0x00000001L // paragraph text area -#define LB_PRTAREA 0x00000002L // paragraph text area + indents -#define LB_VERT_FRAME 0x00000004L // vertical paragraph text area -#define LB_VERT_PRTAREA 0x00000008L // vertical paragraph text area + indents -#define LB_REL_FRM_LEFT 0x00000010L // left paragraph margin -#define LB_REL_FRM_RIGHT 0x00000020L // right paragraph margin - -#define LB_REL_PG_LEFT 0x00000040L // left page margin -#define LB_REL_PG_RIGHT 0x00000080L // right page margin -#define LB_REL_PG_FRAME 0x00000100L // complete page -#define LB_REL_PG_PRTAREA 0x00000200L // text area of page - -#define LB_FLY_REL_PG_LEFT 0x00000400L // left frame margin -#define LB_FLY_REL_PG_RIGHT 0x00000800L // right frame margin -#define LB_FLY_REL_PG_FRAME 0x00001000L // complete frame -#define LB_FLY_REL_PG_PRTAREA 0x00002000L // frame interior - -#define LB_REL_BASE 0x00010000L // as char, relative to baseline -#define LB_REL_CHAR 0x00020000L // as char, relative to character -#define LB_REL_ROW 0x00040000L // as char, relative to line - -// #i22305# -#define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame -#define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area - -// #i22341# -#define LB_VERT_LINE 0x00400000L // vertical text line - -static RelationMap aRelationMap[] = -{ - {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, RelOrientation::FRAME}, - {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, RelOrientation::PRINT_AREA}, - {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, - {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, - {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, RelOrientation::FRAME_LEFT}, - {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, RelOrientation::FRAME_RIGHT}, - {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, - {SwFPos::REL_PG_PRTAREA,SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, - {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::CHAR}, - - {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, RelOrientation::PAGE_LEFT}, - {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, RelOrientation::PAGE_RIGHT}, - {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, RelOrientation::PAGE_FRAME}, - {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, RelOrientation::PAGE_PRINT_AREA}, - - {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, RelOrientation::FRAME}, - {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, RelOrientation::PRINT_AREA}, - - // #i22305# - {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, RelOrientation::FRAME}, - {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, RelOrientation::PRINT_AREA}, - - // #i22341# - {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, RelOrientation::TEXT_LINE} -}; - -static RelationMap aAsCharRelationMap[] = -{ - {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, RelOrientation::FRAME}, - {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, RelOrientation::FRAME}, - {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, RelOrientation::FRAME} -}; - -/*-------------------------------------------------------------------- - Anchored at page - --------------------------------------------------------------------*/ - -#define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \ - LB_REL_PG_RIGHT) - -static FrmMap aHPageMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PAGE_REL}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PAGE_REL}, - {SwFPos::CENTER_HORI,SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PAGE_REL}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PAGE_REL} -}; - -static FrmMap aHPageHtmlMap[] = -{ - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} -}; - -#define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) - -static FrmMap aVPageMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PAGE_REL}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PAGE_REL}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PAGE_REL}, - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PAGE_REL} -}; - -static FrmMap aVPageHtmlMap[] = -{ - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_REL_PG_FRAME} -}; - -/*-------------------------------------------------------------------- - Anchored at frame - --------------------------------------------------------------------*/ - -#define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \ - LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT) - -static FrmMap aHFrameMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_FRAME_REL}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_FRAME_REL}, - {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_FRAME_REL}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_FRAME_REL} -}; - -static FrmMap aHFlyHtmlMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_FLY_REL_PG_FRAME} -}; - -// #i18732# - own vertical alignment map for to frame anchored objects -// #i22305# -#define VERT_FRAME_REL (LB_VERT_FRAME|LB_FLY_VERT_PRTAREA) - -static FrmMap aVFrameMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_FRAME_REL}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_FRAME_REL}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_FRAME_REL}, - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_FRAME_REL} -}; - -static FrmMap aVFlyHtmlMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_FLY_VERT_FRAME}, - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, LB_FLY_VERT_FRAME} -}; - -static FrmMap aVMultiSelectionMap[] = -{ - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, 0} -}; -static FrmMap aHMultiSelectionMap[] = -{ - {SwFPos::FROMLEFT, SwFPos::FROMLEFT, HoriOrientation::NONE, 0} -}; - -/*-------------------------------------------------------------------- - Anchored at paragraph - --------------------------------------------------------------------*/ - -#define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ - LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ - LB_REL_FRM_RIGHT) - -static FrmMap aHParaMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_PARA_REL}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_PARA_REL}, - {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_PARA_REL}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_PARA_REL} -}; - -#define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA) - -static FrmMap aHParaHtmlMap[] = -{ - {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, - {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} -}; - -static FrmMap aHParaHtmlAbsMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HTML_HORI_PARA_REL}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HTML_HORI_PARA_REL} -}; - - -#define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ - LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) - -static FrmMap aVParaMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_PARA_REL}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_PARA_REL}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_PARA_REL}, - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_PARA_REL} -}; - -static FrmMap aVParaHtmlMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_VERT_PRTAREA} -}; - -/*-------------------------------------------------------------------- - Anchored at character - --------------------------------------------------------------------*/ - -#define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ - LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ - LB_REL_FRM_RIGHT|LB_REL_CHAR) - -static FrmMap aHCharMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, HORI_CHAR_REL}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, HORI_CHAR_REL}, - {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, HoriOrientation::CENTER, HORI_CHAR_REL}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, HORI_CHAR_REL} -}; - -#define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR) - -static FrmMap aHCharHtmlMap[] = -{ - {SwFPos::LEFT, SwFPos::LEFT, HoriOrientation::LEFT, HTML_HORI_CHAR_REL}, - {SwFPos::RIGHT, SwFPos::RIGHT, HoriOrientation::RIGHT, HTML_HORI_CHAR_REL} -}; - -static FrmMap aHCharHtmlAbsMap[] = -{ - {SwFPos::LEFT, SwFPos::MIR_LEFT, HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR}, - {SwFPos::RIGHT, SwFPos::MIR_RIGHT, HoriOrientation::RIGHT, LB_PRTAREA}, - {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, HoriOrientation::NONE, LB_REL_PG_FRAME} -}; - -// #i18732# - allow vertical alignment at page areas -// #i22341# - handle on its own -#define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ - LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) - -static FrmMap aVCharMap[] = -{ - // #i22341# - // introduce mappings for new vertical alignment at top of line - // and correct mapping for vertical alignment at character for position - // Note: Because of these adjustments the map becomes ambigous in its values - // / and . These ambiguities are considered - // in the methods , - // and - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR}, - {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR}, - {SwFPos::FROMTOP, SwFPos::FROMTOP, VertOrientation::NONE, VERT_CHAR_REL}, - {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE}, - {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_VERT_LINE}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_VERT_LINE}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_VERT_LINE} -}; - - -static FrmMap aVCharHtmlMap[] = -{ - {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} -}; - -static FrmMap aVCharHtmlAbsMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_CHAR}, - {SwFPos::BELOW, SwFPos::BELOW, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} -}; -/*-------------------------------------------------------------------- - anchored as character - --------------------------------------------------------------------*/ - -static FrmMap aVAsCharMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::BOTTOM, LB_REL_BASE}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, - - {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CHAR_CENTER, LB_REL_CHAR}, - - {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW}, - - {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, VertOrientation::NONE, LB_REL_BASE} -}; - -static FrmMap aVAsCharHtmlMap[] = -{ - {SwFPos::TOP, SwFPos::TOP, VertOrientation::TOP, LB_REL_BASE}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::CENTER, LB_REL_BASE}, - - {SwFPos::TOP, SwFPos::TOP, VertOrientation::CHAR_TOP, LB_REL_CHAR}, - - {SwFPos::TOP, SwFPos::TOP, VertOrientation::LINE_TOP, LB_REL_ROW}, - {SwFPos::BOTTOM, SwFPos::BOTTOM, VertOrientation::LINE_BOTTOM, LB_REL_ROW}, - {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, VertOrientation::LINE_CENTER, LB_REL_ROW} -}; - -std::size_t lcl_GetFrmMapCount(const FrmMap* pMap) -{ - if( pMap ) - { - if( pMap == aVParaHtmlMap ) - return SAL_N_ELEMENTS(aVParaHtmlMap); - if( pMap == aVAsCharHtmlMap ) - return SAL_N_ELEMENTS( aVAsCharHtmlMap ); - if( pMap == aHParaHtmlMap ) - return SAL_N_ELEMENTS( aHParaHtmlMap ); - if( pMap == aHParaHtmlAbsMap ) - return SAL_N_ELEMENTS( aHParaHtmlAbsMap ); - if( pMap == aVPageMap ) - return SAL_N_ELEMENTS( aVPageMap ); - if( pMap == aVPageHtmlMap ) - return SAL_N_ELEMENTS( aVPageHtmlMap ); - if( pMap == aVAsCharMap ) - return SAL_N_ELEMENTS( aVAsCharMap ); - if( pMap == aVParaMap ) - return SAL_N_ELEMENTS( aVParaMap ); - if( pMap == aHParaMap ) - return SAL_N_ELEMENTS( aHParaMap ); - if( pMap == aHFrameMap ) - return SAL_N_ELEMENTS( aHFrameMap ); - if( pMap == aVFrameMap ) - return SAL_N_ELEMENTS( aVFrameMap ); - if( pMap == aHCharMap ) - return SAL_N_ELEMENTS( aHCharMap ); - if( pMap == aHCharHtmlMap ) - return SAL_N_ELEMENTS( aHCharHtmlMap ); - if( pMap == aHCharHtmlAbsMap ) - return SAL_N_ELEMENTS( aHCharHtmlAbsMap ); - if( pMap == aVCharMap ) - return SAL_N_ELEMENTS( aVCharMap ); - if( pMap == aVCharHtmlMap ) - return SAL_N_ELEMENTS( aVCharHtmlMap ); - if( pMap == aVCharHtmlAbsMap ) - return SAL_N_ELEMENTS( aVCharHtmlAbsMap ); - if( pMap == aHPageHtmlMap ) - return SAL_N_ELEMENTS( aHPageHtmlMap ); - if( pMap == aHFlyHtmlMap ) - return SAL_N_ELEMENTS( aHFlyHtmlMap ); - if( pMap == aVFlyHtmlMap ) - return SAL_N_ELEMENTS( aVFlyHtmlMap ); - if( pMap == aVMultiSelectionMap ) - return SAL_N_ELEMENTS( aVMultiSelectionMap ); - if( pMap == aHMultiSelectionMap ) - return SAL_N_ELEMENTS( aHMultiSelectionMap ); - return SAL_N_ELEMENTS(aHPageMap); - } - return 0; -} - -SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( - SvxSwFramePosString::StringId eStringId, sal_Bool bVertical, sal_Bool bRTL) -{ - //special handling of STR_FROMLEFT - if(SwFPos::FROMLEFT == eStringId) - { - eStringId = bVertical ? - bRTL ? SwFPos::FROMBOTTOM : SwFPos::FROMTOP : - bRTL ? SwFPos::FROMRIGHT : SwFPos::FROMLEFT; - return eStringId; - } - if(bVertical) - { - //exchange horizontal strings with vertical strings and vice versa - static const StringIdPair_Impl aHoriIds[] = - { - {SwFPos::LEFT, SwFPos::TOP}, - {SwFPos::RIGHT, SwFPos::BOTTOM}, - {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT}, - {SwFPos::FROMTOP, SwFPos::FROMRIGHT}, - {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP}, - {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} , - {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP}, - {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM} - }; - static const StringIdPair_Impl aVertIds[] = - { - {SwFPos::TOP, SwFPos::RIGHT}, - {SwFPos::BOTTOM, SwFPos::LEFT }, - {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI}, - {SwFPos::FROMTOP, SwFPos::FROMRIGHT }, - {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT }, - {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } , - {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, - {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } - }; - sal_uInt16 nIndex; - for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex) - { - if(aHoriIds[nIndex].eHori == eStringId) - { - eStringId = aHoriIds[nIndex].eVert; - return eStringId; - } - } - nIndex = 0; - for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex) - { - if(aVertIds[nIndex].eHori == eStringId) - { - eStringId = aVertIds[nIndex].eVert; - break; - } - } - } - return eStringId; -} -// #i22341# - helper method in order to determine all possible -// listbox relations in a relation map for a given relation -sal_uLong lcl_GetLBRelationsForRelations( const sal_uInt16 _nRel ) -{ - sal_uLong nLBRelations = 0L; - - for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < SAL_N_ELEMENTS(aRelationMap); ++nRelMapPos ) - { - if ( aRelationMap[nRelMapPos].nRelation == _nRel ) - { - nLBRelations |= aRelationMap[nRelMapPos].nLBRelation; - } - } - - return nLBRelations; -} - -// #i22341# - helper method on order to determine all possible -// listbox relations in a relation map for a given string ID -sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap, - const SvxSwFramePosString::StringId _eStrId, - const bool _bUseMirrorStr ) -{ - sal_uLong nLBRelations = 0L; - - std::size_t nRelMapSize = lcl_GetFrmMapCount( _pMap ); - for ( std::size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) - { - if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) || - ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) ) - { - nLBRelations |= _pMap[nRelMapPos].nLBRelations; - } - } - - return nLBRelations; -} - -SvxSwPosSizeTabPage::SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_SWPOSSIZE ), rInAttrs ), -#ifdef _MSC_VER -#pragma warning (disable : 4355) -#endif - m_aSizeFL( this, CUI_RES( FL_SIZE ) ), - m_aWidthFT( this, CUI_RES( FT_WIDTH ) ), - m_aWidthMF( this, CUI_RES( MF_WIDTH ) ), - m_aHeightFT( this, CUI_RES( FT_HEIGHT ) ), - m_aHeightMF( this, CUI_RES( MF_HEIGHT ) ), - m_aKeepRatioCB(this,CUI_RES( CB_KEEPRATIO) ), - m_aSeparatorFL(this,CUI_RES( FL_SEPARATOR) ), - - m_aAnchorFL( this, CUI_RES( FL_ANCHOR ) ), - m_aToPageRB( this, CUI_RES( RB_TOPAGE ) ), - m_aToParaRB( this, CUI_RES( RB_TOPARA ) ), - m_aToCharRB( this, CUI_RES( RB_TOCHAR ) ), - m_aAsCharRB( this, CUI_RES( RB_ASCHAR ) ), - m_aToFrameRB( this, CUI_RES( RB_TOFRAME) ), - - m_aProtectionFL( this, CUI_RES( FL_PROTECTION ) ), - m_aPositionCB( this, CUI_RES( CB_POSITION ) ), - m_aSizeCB( this, CUI_RES( CB_SIZE ) ), - - m_aPositionFL( this, CUI_RES( FL_POSITION ) ), - m_aHoriFT( this, CUI_RES( FT_HORI ) ), - m_aHoriLB( this, CUI_RES( LB_HORI ) ), - m_aHoriByFT( this, CUI_RES( FT_HORIBY ) ), - m_aHoriByMF( this, CUI_RES( MF_HORIBY ) ), - m_aHoriToFT( this, CUI_RES( FT_HORITO ) ), - m_aHoriToLB( this, CUI_RES( LB_HORITO ) ), - - m_aHoriMirrorCB( this, CUI_RES( CB_HORIMIRROR ) ), - - m_aVertFT( this, CUI_RES( FT_VERT ) ), - m_aVertLB( this, CUI_RES( LB_VERT ) ), - m_aVertByFT( this, CUI_RES( FT_VERTBY ) ), - m_aVertByMF( this, CUI_RES( MF_VERTBY ) ), - m_aVertToFT( this, CUI_RES( FT_VERTTO ) ), - m_aVertToLB( this, CUI_RES( LB_VERTTO ) ), - - m_aFollowCB( this, CUI_RES( CB_FOLLOW ) ), - m_aExampleWN( this, CUI_RES( WN_EXAMPLE ) ), -#ifdef _MSC_VER -#pragma warning (default : 4355) -#endif - m_pVMap( 0 ), - m_pHMap( 0 ), - m_pSdrView( 0 ), - m_nOldH(HoriOrientation::CENTER), - m_nOldHRel(RelOrientation::FRAME), - m_nOldV(VertOrientation::TOP), - m_nOldVRel(RelOrientation::PRINT_AREA), - m_fWidthHeightRatio(1.0), - m_nHtmlMode(0), - m_bHtmlMode(false), - m_bAtHoriPosModified(false), - m_bAtVertPosModified(false), - m_bIsVerticalFrame(false), - m_bPositioningDisabled(false), - m_bIsMultiSelection(false), - m_bIsInRightToLeft(false) -{ - FreeResource(); - FieldUnit eDlgUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( m_aHoriByMF, eDlgUnit, sal_True ); - SetFieldUnit( m_aVertByMF, eDlgUnit, sal_True ); - SetFieldUnit( m_aWidthMF , eDlgUnit, sal_True ); - SetFieldUnit( m_aHeightMF, eDlgUnit, sal_True ); - - SetExchangeSupport(); - - Link aLk = LINK(this, SvxSwPosSizeTabPage, RangeModifyHdl); - m_aWidthMF. SetLoseFocusHdl( aLk ); - m_aHeightMF. SetLoseFocusHdl( aLk ); - m_aHoriByMF.SetLoseFocusHdl( aLk ); - m_aVertByMF.SetLoseFocusHdl( aLk ); - m_aFollowCB.SetClickHdl( aLk ); - - aLk = LINK(this, SvxSwPosSizeTabPage, ModifyHdl); - m_aWidthMF. SetModifyHdl( aLk ); - m_aHeightMF. SetModifyHdl( aLk ); - m_aHoriByMF.SetModifyHdl( aLk ); - m_aVertByMF.SetModifyHdl( aLk ); - - aLk = LINK(this, SvxSwPosSizeTabPage, AnchorTypeHdl); - m_aToPageRB.SetClickHdl( aLk ); - m_aToParaRB.SetClickHdl( aLk ); - m_aToCharRB.SetClickHdl( aLk ); - m_aAsCharRB.SetClickHdl( aLk ); - m_aToFrameRB.SetClickHdl( aLk ); - - m_aHoriLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); - m_aVertLB. SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, PosHdl)); - - m_aHoriToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); - m_aVertToLB.SetSelectHdl(LINK(this, SvxSwPosSizeTabPage, RelHdl)); - - m_aHoriMirrorCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, MirrorHdl)); - m_aPositionCB.SetClickHdl(LINK(this, SvxSwPosSizeTabPage, ProtectHdl)); -} - -SvxSwPosSizeTabPage::~SvxSwPosSizeTabPage() -{ -} - -SfxTabPage* SvxSwPosSizeTabPage::Create( Window* pParent, const SfxItemSet& rSet) -{ - return new SvxSwPosSizeTabPage(pParent, rSet); -} - -sal_uInt16* SvxSwPosSizeTabPage::GetRanges() -{ - static sal_uInt16 pSwPosRanges[] = - { - SID_ATTR_TRANSFORM_POS_X, - SID_ATTR_TRANSFORM_POS_Y, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_ANCHOR, - SID_ATTR_TRANSFORM_VERT_ORIENT, - SID_ATTR_TRANSFORM_WIDTH, - SID_ATTR_TRANSFORM_SIZE_POINT, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_AUTOWIDTH, - SID_ATTR_TRANSFORM_VERT_ORIENT, - SID_HTML_MODE, - SID_HTML_MODE, - SID_SW_FOLLOW_TEXT_FLOW, - SID_SW_FOLLOW_TEXT_FLOW, - SID_ATTR_TRANSFORM_HORI_POSITION, - SID_ATTR_TRANSFORM_VERT_POSITION, - 0 - }; - return pSwPosRanges; -} - -sal_Bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet& rSet) -{ - bool bAnchorChanged = false; - short nAnchor = GetAnchorType(&bAnchorChanged); - sal_Bool bModified = sal_False; - if(bAnchorChanged) - { - rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor)); - bModified |= sal_True; - } - if ( m_aPositionCB.GetState() != m_aPositionCB.GetSavedValue() ) - { - if( m_aPositionCB.GetState() == STATE_DONTKNOW ) - rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); - else - rSet.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), - m_aPositionCB.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - bModified |= sal_True; - } - - if ( m_aSizeCB.GetState() != m_aSizeCB.GetSavedValue() ) - { - if ( m_aSizeCB.GetState() == STATE_DONTKNOW ) - rSet.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); - else - rSet.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), - m_aSizeCB.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - bModified |= sal_True; - } - - const SfxItemSet& rOldSet = GetItemSet(); - - if(!m_bPositioningDisabled) - { - //on multiple selections the positioning is set via SdrView - if(m_bIsMultiSelection) - { - if( m_aHoriByMF.IsValueModified() || m_aVertByMF.IsValueModified() ) - { - long nHoriByPos = - static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); - long nVertByPos = - static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); - - // Altes Rechteck mit CoreUnit - m_aRect = m_pSdrView->GetAllMarkedRect(); - m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); - - nHoriByPos += m_aAnchorPos.X(); - nVertByPos += m_aAnchorPos.Y(); - - rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_X ), nHoriByPos ) ); - rSet.Put( SfxInt32Item( GetWhich( SID_ATTR_TRANSFORM_POS_Y ), nVertByPos ) ); - - bModified |= sal_True; - } - } - else - { - if ( m_pHMap ) - { - const SfxInt16Item& rHoriOrient = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_ORIENT)); - const SfxInt16Item& rHoriRelation = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_RELATION)); - const SfxInt32Item& rHoriPosition = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_HORI_POSITION)) ; - - sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriLB); - short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); - short nRel = GetRelation(m_pHMap, m_aHoriToLB); - const long nHoriByPos = - static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); - if ( - nAlign != rHoriOrient.GetValue() || - nRel != rHoriRelation.GetValue() || - (m_aHoriByMF.IsEnabled() && nHoriByPos != rHoriPosition.GetValue()) - ) - { - rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, nAlign)); - rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, nRel)); - if(m_aHoriByMF.IsEnabled()) - rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, nHoriByPos)); - bModified |= sal_True; - } - } - if(m_aHoriMirrorCB.IsEnabled() && m_aHoriMirrorCB.IsChecked() != m_aHoriMirrorCB.GetSavedValue()) - bModified |= 0 != rSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, m_aHoriMirrorCB.IsChecked())); - - if ( m_pVMap ) - { - const SfxInt16Item& rVertOrient = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_ORIENT)); - const SfxInt16Item& rVertRelation = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_RELATION)); - const SfxInt32Item& rVertPosition = - static_cast(rOldSet.Get( SID_ATTR_TRANSFORM_VERT_POSITION)); - - sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); - short nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); - short nRel = GetRelation(m_pVMap, m_aVertToLB); - // #i34055# - convert vertical position for - // as-character anchored objects - long nVertByPos = - static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); - if ( GetAnchorType() == TextContentAnchorType_AS_CHARACTER ) - { - nVertByPos *= -1; - } - if ( nAlign != rVertOrient.GetValue() || - nRel != rVertRelation.GetValue() || - ( m_aVertByMF.IsEnabled() && - nVertByPos != rVertPosition.GetValue() ) ) - { - rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, nAlign)); - rSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, nRel)); - if(m_aVertByMF.IsEnabled()) - rSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, nVertByPos)); - bModified |= sal_True; - } - } - - // #i18732# - if(m_aFollowCB.IsChecked() != m_aFollowCB.GetSavedValue()) - { - //Writer internal type - based on SfxBoolItem - const SfxPoolItem* pItem = GetItem( rOldSet, SID_SW_FOLLOW_TEXT_FLOW); - if(pItem) - { - SfxBoolItem* pFollow = static_cast(pItem->Clone()); - pFollow->SetValue(m_aFollowCB.IsChecked()); - bModified |= 0 != rSet.Put(*pFollow); - delete pFollow; - } - } - } - } - if ( m_aWidthMF.IsValueModified() || m_aHeightMF.IsValueModified() ) - { - sal_uInt32 nWidth = static_cast(m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); - sal_uInt32 nHeight = static_cast(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); - rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), - (sal_uInt32) nWidth ) ); - rSet.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), - (sal_uInt32) nHeight ) ); - //this item is required by SdrEditView::SetGeoAttrToMarked() - rSet.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), RP_LT ) ); - - bModified |= sal_True; - } - - return bModified; -} - -void SvxSwPosSizeTabPage::Reset( const SfxItemSet& rSet) -{ - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TRANSFORM_ANCHOR ); - bool bInvalidateAnchor = false; - short nAnchorType = TextContentAnchorType_AT_PARAGRAPH; - if(pItem) - { - nAnchorType = static_cast(pItem)->GetValue(); - switch(nAnchorType) - { - case TextContentAnchorType_AT_PAGE: m_aToPageRB.Check(); break; - case TextContentAnchorType_AT_PARAGRAPH: m_aToParaRB.Check(); break; - case TextContentAnchorType_AT_CHARACTER: m_aToCharRB.Check(); break; - case TextContentAnchorType_AS_CHARACTER: m_aAsCharRB.Check(); break; - case TextContentAnchorType_AT_FRAME: m_aToFrameRB.Check(); break; - default : bInvalidateAnchor = true; - } - m_aToPageRB.SaveValue(); - m_aToParaRB.SaveValue(); - m_aToCharRB.SaveValue(); - m_aAsCharRB.SaveValue(); - m_aToFrameRB.SaveValue(); - } - if(bInvalidateAnchor) - { - m_aToPageRB.Enable( sal_False ); - m_aToParaRB.Enable( sal_False ); - m_aToCharRB.Enable( sal_False ); - m_aAsCharRB.Enable( sal_False ); - m_aToFrameRB.Enable( sal_False ); - } - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_POS ); - if ( pItem ) - { - sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); - m_aPositionCB.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); - m_aPositionCB.EnableTriState( sal_False ); - m_aSizeCB.Enable( !bProtected ); - } - else - { - m_aPositionCB.SetState( STATE_DONTKNOW ); - } - - m_aPositionCB.SaveValue(); - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_PROTECT_SIZE ); - - if ( pItem ) - { - m_aSizeCB.SetState( ( (const SfxBoolItem*)pItem )->GetValue() - ? STATE_CHECK : STATE_NOCHECK ); - m_aSizeCB.EnableTriState( sal_False ); - } - else - m_aSizeCB.SetState( STATE_DONTKNOW ); - m_aSizeCB.SaveValue(); - - pItem = GetItem( rSet, SID_HTML_MODE ); - if(pItem) - m_nHtmlMode = static_cast(pItem)->GetValue(); - m_bHtmlMode = 0 != (m_bHtmlMode & HTMLMODE_ON); - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT ); - if(pItem && static_cast(pItem)->GetValue()) - { - String sHLabel = m_aHoriFT.GetText(); - m_aHoriFT.SetText(m_aVertFT.GetText()); - m_aVertFT.SetText(sHLabel); - m_bIsVerticalFrame = true; - } - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_IN_RTL_TEXT); - if(pItem) - m_bIsInRightToLeft = static_cast(pItem)->GetValue(); - - pItem = GetItem( rSet, SID_SW_FOLLOW_TEXT_FLOW); - if(pItem) - { - const bool bFollowTextFlow = - static_cast(pItem)->GetValue(); - m_aFollowCB.Check( bFollowTextFlow ); - } - m_aFollowCB.SaveValue(); - - if(m_bHtmlMode) - { - if( 0 == (m_nHtmlMode & HTMLMODE_FULL_ABS_POS)) - { - m_aHeightFT .Enable( sal_False ); - m_aHeightMF .Enable( sal_False ); - } - if( 0 == (m_nHtmlMode & HTMLMODE_SOME_ABS_POS)) - { - if(GetAnchorType() == TextContentAnchorType_AT_PAGE) - { - m_aToParaRB.Check(); - } - m_aToPageRB.Enable(sal_False); - } - m_aHoriMirrorCB.Show(sal_False); - m_aKeepRatioCB.Enable(sal_False); - // #i18732# - hide checkbox in HTML mode - m_aFollowCB.Show(sal_False); - } - else - { - // #i18732# correct enable/disable of check box 'Mirror on..' - m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); - - // #i18732# - enable/disable check box 'Follow text flow'. - m_aFollowCB.Enable( m_aToParaRB.IsChecked() || - m_aToCharRB.IsChecked() ); - } - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_WIDTH ); - sal_Int32 nWidth = Max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (sal_uInt32)1 ); - - m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HEIGHT ); - sal_Int32 nHeight = Max( pItem ? ( static_cast(pItem)->GetValue()) : 0, (sal_uInt32)1 ); - m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); - m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; - - if(!m_bPositioningDisabled) - { - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_ORIENT); - if(pItem) - { - short nHoriOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); - m_nOldH = nHoriOrientation; - } - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_ORIENT); - if(pItem) - { - short nVertOrientation = static_cast< const SfxInt16Item*>(pItem)->GetValue(); - m_nOldV = nVertOrientation; - } - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_RELATION); - if(pItem) - { - m_nOldHRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); - } - - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_RELATION); - if(pItem) - { - m_nOldVRel = static_cast< const SfxInt16Item*>(pItem)->GetValue(); - } - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_MIRROR); - if(pItem) - m_aHoriMirrorCB.Check(static_cast(pItem)->GetValue()); - m_aHoriMirrorCB.SaveValue(); - - sal_Int32 nHoriPos = 0; - sal_Int32 nVertPos = 0; - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_HORI_POSITION); - if(pItem) - nHoriPos = static_cast(pItem)->GetValue(); - pItem = GetItem( rSet, SID_ATTR_TRANSFORM_VERT_POSITION); - if(pItem) - nVertPos = static_cast(pItem)->GetValue(); - - InitPos(nAnchorType, m_nOldH, m_nOldHRel, m_nOldV, m_nOldVRel, nHoriPos, nVertPos); - - m_aVertByMF.SaveValue(); - m_aHoriByMF.SaveValue(); - // #i18732# - m_aFollowCB.SaveValue(); - - RangeModifyHdl(&m_aWidthMF); // initially set maximum values - } -} - -int SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - FillItemSet( *_pSet ); - return( LEAVE_PAGE ); -} - -void SvxSwPosSizeTabPage::EnableAnchorTypes(sal_uInt16 nAnchorEnable) -{ - if((nAnchorEnable & SVX_OBJ_AT_FLY)) - m_aToFrameRB.Show(); - if(!(nAnchorEnable & SVX_OBJ_PAGE)) - m_aToPageRB.Enable(sal_False); -} - -short SvxSwPosSizeTabPage::GetAnchorType(bool* pbHasChanged) -{ - short nRet = -1; - RadioButton* pCheckedButton = 0; - if(m_aToParaRB.IsEnabled()) - { - if(m_aToPageRB.IsChecked()) - { - nRet = TextContentAnchorType_AT_PAGE; - pCheckedButton = &m_aToPageRB; - } - else if(m_aToParaRB.IsChecked()) - { - nRet = TextContentAnchorType_AT_PARAGRAPH; - pCheckedButton = &m_aToParaRB; - } - else if(m_aToCharRB.IsChecked()) - { - nRet = TextContentAnchorType_AT_CHARACTER; - pCheckedButton = &m_aToCharRB; - } - else if(m_aAsCharRB.IsChecked()) - { - nRet = TextContentAnchorType_AS_CHARACTER; - pCheckedButton = &m_aAsCharRB; - } - else if(m_aToFrameRB.IsChecked()) - { - nRet = TextContentAnchorType_AT_FRAME; - pCheckedButton = &m_aToFrameRB; - } - } - if(pbHasChanged) - { - if(pCheckedButton) - *pbHasChanged = pCheckedButton->IsChecked() != pCheckedButton->GetSavedValue(); - else - *pbHasChanged = false; - } - return nRet; -} - -IMPL_LINK( SvxSwPosSizeTabPage, RangeModifyHdl, Edit *, EMPTYARG ) -{ - if(m_bPositioningDisabled) - return 0; - SvxSwFrameValidation aVal; - - aVal.nAnchorType = GetAnchorType(); - aVal.bAutoHeight = false; - aVal.bAutoWidth = false; - aVal.bMirror = m_aHoriMirrorCB.IsChecked(); - // #i18732# - aVal.bFollowTextFlow = m_aFollowCB.IsChecked(); - - if ( m_pHMap ) - { - // Ausrichtung Horizontal - sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriToLB); - sal_uInt16 nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); - sal_uInt16 nRel = GetRelation(m_pHMap, m_aHoriToLB); - - aVal.nHoriOrient = (short)nAlign; - aVal.nHRelOrient = (short)nRel; - } - else - aVal.nHoriOrient = HoriOrientation::NONE; - - if ( m_pVMap ) - { - // Ausrichtung Vertikal - sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); - sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); - sal_uInt16 nRel = GetRelation(m_pVMap, m_aVertToLB); - - aVal.nVertOrient = (short)nAlign; - aVal.nVRelOrient = (short)nRel; - } - else - aVal.nVertOrient = VertOrientation::NONE; - - const long nAtHorzPosVal = - static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); - const long nAtVertPosVal = - static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); - - aVal.nHPos = nAtHorzPosVal; - aVal.nVPos = nAtVertPosVal; - - sal_Int32 nWidth = static_cast(m_aWidthMF. Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP))); - sal_Int32 nHeight = static_cast(m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP))); - aVal.nWidth = nWidth; - aVal.nHeight = nHeight; - - if(m_aValidateLink.IsSet()) - m_aValidateLink.Call(&aVal); - - nWidth = aVal.nWidth; - nHeight = aVal.nHeight; - - // Mindestbreite auch fuer Vorlage - m_aHeightMF.SetMin(m_aHeightMF.Normalize(aVal.nMinHeight), FUNIT_TWIP); - m_aWidthMF. SetMin(m_aWidthMF.Normalize(aVal.nMinWidth), FUNIT_TWIP); - - sal_Int32 nMaxWidth(aVal.nMaxWidth); - sal_Int32 nMaxHeight(aVal.nMaxHeight); - - sal_Int64 nTmp = m_aHeightMF.Normalize(nMaxHeight); - m_aHeightMF.SetMax(nTmp, FUNIT_TWIP); - - nTmp = m_aWidthMF.Normalize(nMaxWidth); - m_aWidthMF.SetMax(nTmp, FUNIT_TWIP); - - m_aHoriByMF.SetMin(m_aHoriByMF.Normalize(aVal.nMinHPos), FUNIT_TWIP); - m_aHoriByMF.SetMax(m_aHoriByMF.Normalize(aVal.nMaxHPos), FUNIT_TWIP); - if ( aVal.nHPos != nAtHorzPosVal ) - m_aHoriByMF.SetValue(m_aHoriByMF.Normalize(aVal.nHPos), FUNIT_TWIP); - - m_aVertByMF.SetMin(m_aVertByMF.Normalize(aVal.nMinVPos ), FUNIT_TWIP); - m_aVertByMF.SetMax(m_aVertByMF.Normalize(aVal.nMaxVPos), FUNIT_TWIP); - if ( aVal.nVPos != nAtVertPosVal ) - m_aVertByMF.SetValue(m_aVertByMF.Normalize(aVal.nVPos), FUNIT_TWIP); - - return 0; -} - -IMPL_LINK( SvxSwPosSizeTabPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) -{ - m_aHoriMirrorCB.Enable(!m_aAsCharRB.IsChecked() && !m_bIsMultiSelection); - - // #i18732# - enable check box 'Follow text flow' for anchor - // type to-paragraph' and to-character - m_aFollowCB.Enable( m_aToParaRB.IsChecked() || m_aToCharRB.IsChecked() ); - - short nId = GetAnchorType(); - - InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); - RangeModifyHdl(0); - - if(m_bHtmlMode) - { - PosHdl(&m_aHoriLB); - PosHdl(&m_aVertLB); - } - return 0; -} - -IMPL_LINK( SvxSwPosSizeTabPage, MirrorHdl, CheckBox *, EMPTYARG ) -{ - short nId = GetAnchorType(); - InitPos( nId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); - - return 0; -} - -IMPL_LINK( SvxSwPosSizeTabPage, RelHdl, ListBox *, pLB ) -{ - sal_Bool bHori = pLB == &m_aHoriToLB; - - UpdateExample(); - - if (bHori) - m_bAtHoriPosModified = sal_True; - else - m_bAtVertPosModified = sal_True; - - if(m_bHtmlMode && TextContentAnchorType_AT_CHARACTER == GetAnchorType()) // wieder Sonderbehandlung - { - if(bHori) - { - sal_uInt16 nRel = GetRelation(m_pHMap, m_aHoriToLB); - if(RelOrientation::PRINT_AREA == nRel && 0 == m_aVertLB.GetSelectEntryPos()) - { - m_aVertLB.SelectEntryPos(1); - } - else if(RelOrientation::CHAR == nRel && 1 == m_aVertLB.GetSelectEntryPos()) - { - m_aVertLB.SelectEntryPos(0); - } - } - } - if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde - RangeModifyHdl(0); - - return 0; - -} - -IMPL_LINK( SvxSwPosSizeTabPage, PosHdl, ListBox *, pLB ) -{ - sal_Bool bHori = pLB == &m_aHoriLB; - ListBox *pRelLB = bHori ? &m_aHoriToLB : &m_aVertToLB; - FixedText *pRelFT = bHori ? &m_aHoriToFT : &m_aVertToFT; - FrmMap *pMap = bHori ? m_pHMap : m_pVMap; - - - sal_uInt16 nMapPos = GetMapPos(pMap, *pLB); - sal_uInt16 nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB); - - if (bHori) - { - sal_Bool bEnable = HoriOrientation::NONE == nAlign; - m_aHoriByMF.Enable( bEnable ); - m_aHoriByFT.Enable( bEnable ); - } - else - { - sal_Bool bEnable = VertOrientation::NONE == nAlign; - m_aVertByMF.Enable( bEnable ); - m_aVertByFT.Enable( bEnable ); - } - - if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde - RangeModifyHdl( 0 ); - - short nRel = 0; - if (pLB->GetSelectEntryCount()) - { - - if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) - nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation; - - FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT); - } - else - pRelLB->Clear(); - - UpdateExample(); - - if (bHori) - m_bAtHoriPosModified = sal_True; - else - m_bAtVertPosModified = sal_True; - - // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten - if(m_bHtmlMode && m_nHtmlMode & HTMLMODE_SOME_ABS_POS && - TextContentAnchorType_AT_CHARACTER == GetAnchorType()) - { - sal_Bool bSet = sal_False; - if(bHori) - { - // rechts ist nur unterhalb erlaubt - von links nur oben - // von links am Zeichen -> unterhalb - if((HoriOrientation::LEFT == nAlign || HoriOrientation::RIGHT == nAlign) && - 0 == m_aVertLB.GetSelectEntryPos()) - { - if(RelOrientation::FRAME == nRel) - m_aVertLB.SelectEntryPos(1); - else - m_aVertLB.SelectEntryPos(0); - bSet = sal_True; - } - else if(HoriOrientation::LEFT == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) - { - m_aVertLB.SelectEntryPos(0); - bSet = sal_True; - } - else if(HoriOrientation::NONE == nAlign && 1 == m_aVertLB.GetSelectEntryPos()) - { - m_aVertLB.SelectEntryPos(0); - bSet = sal_True; - } - if(bSet) - PosHdl(&m_aVertLB); - } - else - { - if(VertOrientation::TOP == nAlign) - { - if(1 == m_aHoriLB.GetSelectEntryPos()) - { - m_aHoriLB.SelectEntryPos(0); - bSet = sal_True; - } - m_aHoriToLB.SelectEntryPos(1); - } - else if(VertOrientation::CHAR_BOTTOM == nAlign) - { - if(2 == m_aHoriLB.GetSelectEntryPos()) - { - m_aHoriLB.SelectEntryPos(0); - bSet = sal_True; - } - m_aHoriToLB.SelectEntryPos(0) ; - } - if(bSet) - PosHdl(&m_aHoriLB); - } - - } - return 0; -} - -IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit *, pEdit ) -{ - sal_Int64 nWidth = m_aWidthMF.Denormalize(m_aWidthMF.GetValue(FUNIT_TWIP)); - sal_Int64 nHeight = m_aHeightMF.Denormalize(m_aHeightMF.GetValue(FUNIT_TWIP)); - if ( m_aKeepRatioCB.IsChecked() ) - { - if ( pEdit == &m_aWidthMF ) - { - nHeight = sal_Int64((double)nWidth / m_fWidthHeightRatio); - m_aHeightMF.SetValue(m_aHeightMF.Normalize(nHeight), FUNIT_TWIP); - } - else if(pEdit == &m_aHeightMF) - { - nWidth = sal_Int64((double)nHeight * m_fWidthHeightRatio); - m_aWidthMF.SetValue(m_aWidthMF.Normalize(nWidth), FUNIT_TWIP); - } - } - m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; - UpdateExample(); - return 0; -} - -IMPL_LINK( SvxSwPosSizeTabPage, ProtectHdl, TriStateBox *, EMPTYARG) -{ - m_aSizeCB.Enable(m_aPositionCB.IsEnabled() && !m_aPositionCB.IsChecked()); - return 0; -} - -short SvxSwPosSizeTabPage::GetRelation(FrmMap *, ListBox &rRelationLB) -{ - short nRel = 0; - sal_uInt16 nPos = rRelationLB.GetSelectEntryPos(); - - if (nPos != LISTBOX_ENTRY_NOTFOUND) - { - RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos); - nRel = pEntry->nRelation; - } - - return nRel; -} - -short SvxSwPosSizeTabPage::GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &/*rAlignLB*/, ListBox &rRelationLB) -{ - short nAlign = 0; - - // #i22341# - special handling also for map , - // because it contains ambigous items for alignment - if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap || - pMap == aVCharMap ) - { - if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) - { - sal_uLong nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation; - std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); - SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; - - for (std::size_t i = 0; i < nMapCount; i++) - { - if (pMap[i].eStrId == eStrId) - { - sal_uLong nLBRelations = pMap[i].nLBRelations; - if (nLBRelations & nRel) - { - nAlign = pMap[i].nAlign; - break; - } - } - } - } - } - else if (pMap) - nAlign = pMap[nMapPos].nAlign; - - return nAlign; -} - -sal_uInt16 SvxSwPosSizeTabPage::GetMapPos(FrmMap *pMap, ListBox &rAlignLB) -{ - sal_uInt16 nMapPos = 0; - sal_uInt16 nLBSelPos = rAlignLB.GetSelectEntryPos(); - - if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND) - { - if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) - { - std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); - String sSelEntry(rAlignLB.GetSelectEntry()); - - for (std::size_t i = 0; i < nMapCount; i++) - { - SvxSwFramePosString::StringId eResId = pMap[i].eStrId; - - String sEntry = m_aFramePosString.GetString(eResId); - - if (sEntry == sSelEntry) - { - nMapPos = sal::static_int_cast< sal_uInt16 >(i); - break; - } - } - } - else - nMapPos = nLBSelPos; - } - - return nMapPos; -} - -void SvxSwPosSizeTabPage::InitPos(short nAnchor, - sal_uInt16 nH, - sal_uInt16 nHRel, - sal_uInt16 nV, - sal_uInt16 nVRel, - long nX, - long nY) -{ - sal_uInt16 nPos = m_aVertLB.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pVMap ) - { - m_nOldV = m_pVMap[nPos].nAlign; - nPos = m_aVertToLB.GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - m_nOldVRel = ((RelationMap *)m_aVertToLB.GetEntryData(nPos))->nRelation; - } - - nPos = m_aHoriLB.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && m_pHMap ) - { - m_nOldH = m_pHMap[nPos].nAlign; - - nPos = m_aHoriToLB.GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) - m_nOldHRel = ((RelationMap *)m_aHoriToLB.GetEntryData(nPos))->nRelation; - } - - sal_Bool bEnable = sal_True; - if( m_bIsMultiSelection ) - { - m_pVMap = aVMultiSelectionMap; - m_pHMap = aHMultiSelectionMap; - } - else if( nAnchor == TextContentAnchorType_AT_PAGE ) - { - m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap; - m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap; - } - else if ( nAnchor == TextContentAnchorType_AT_FRAME ) - { - // #i18732# - own vertical alignment map for to frame - // anchored objects. - m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap; - m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap; - } - else if ( nAnchor == TextContentAnchorType_AT_PARAGRAPH ) - { - if(m_bHtmlMode) - { - m_pVMap = aVParaHtmlMap; - m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap; - } - else - { - m_pVMap = aVParaMap; - m_pHMap = aHParaMap; - } - } - else if ( nAnchor == TextContentAnchorType_AT_CHARACTER ) - { - if(m_bHtmlMode) - { - m_pVMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap; - m_pHMap = m_nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap; - } - else - { - m_pVMap = aVCharMap; - m_pHMap = aHCharMap; - } - } - else if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) - { - m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap; - m_pHMap = 0; - bEnable = sal_False; - } - m_aHoriLB.Enable( bEnable ); - m_aHoriFT.Enable( bEnable ); - - // aktuelle Pos selektieren - // Horizontal - if ( nH == USHRT_MAX ) - { - nH = m_nOldH; - nHRel = m_nOldHRel; - } - // #i22341# - pass as 3rd parameter to method - sal_uInt16 nMapPos = FillPosLB(m_pHMap, nH, nHRel, m_aHoriLB); - FillRelLB(m_pHMap, nMapPos, nH, nHRel, m_aHoriToLB, m_aHoriToFT); - - // Vertikal - if ( nV == USHRT_MAX ) - { - nV = m_nOldV; - nVRel = m_nOldVRel; - } - // #i22341# - pass as 3rd parameter to method - nMapPos = FillPosLB(m_pVMap, nV, nVRel, m_aVertLB); - FillRelLB(m_pVMap, nMapPos, nV, nVRel, m_aVertToLB, m_aVertToFT); - - // Edits init - bEnable = nH == HoriOrientation::NONE && - nAnchor != TextContentAnchorType_AS_CHARACTER;//#61359# warum nicht in Formaten&& !bFormat; - if (!bEnable) - { - m_aHoriByMF.SetValue( 0, FUNIT_TWIP ); - if (nX != LONG_MAX && m_bHtmlMode) - m_aHoriByMF.SetModifyFlag(); - } - else if(m_bIsMultiSelection) - { - m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(m_aRect.Left()), FUNIT_TWIP ); - } - else - { - if (nX != LONG_MAX) - m_aHoriByMF.SetValue( m_aHoriByMF.Normalize(nX), FUNIT_TWIP ); - } - m_aHoriByFT.Enable( bEnable ); - m_aHoriByMF.Enable( bEnable ); - - bEnable = nV == VertOrientation::NONE; - if ( !bEnable ) - { - m_aVertByMF.SetValue( 0, FUNIT_TWIP ); - if(nY != LONG_MAX && m_bHtmlMode) - m_aVertByMF.SetModifyFlag(); - } - else if(m_bIsMultiSelection) - { - m_aVertByMF.SetValue( m_aVertByMF.Normalize(m_aRect.Top()), FUNIT_TWIP ); - } - else - { - if ( nAnchor == TextContentAnchorType_AS_CHARACTER ) - { - if ( nY == LONG_MAX ) - nY = 0; - else - nY *= -1; - } - if ( nY != LONG_MAX ) - m_aVertByMF.SetValue( m_aVertByMF.Normalize(nY), FUNIT_TWIP ); - } - m_aVertByFT.Enable( bEnable ); - m_aVertByMF.Enable( bEnable ); - UpdateExample(); -} - -void SvxSwPosSizeTabPage::UpdateExample() -{ - sal_uInt16 nPos = m_aHoriLB.GetSelectEntryPos(); - if ( m_pHMap && nPos != LISTBOX_ENTRY_NOTFOUND ) - { - sal_uInt16 nMapPos = GetMapPos(m_pHMap, m_aHoriLB); - short nAlign = GetAlignment(m_pHMap, nMapPos, m_aHoriLB, m_aHoriToLB); - short nRel = GetRelation(m_pHMap, m_aHoriToLB); - - m_aExampleWN.SetHAlign(nAlign); - m_aExampleWN.SetHoriRel(nRel); - } - - nPos = m_aVertLB.GetSelectEntryPos(); - if ( m_pVMap && nPos != LISTBOX_ENTRY_NOTFOUND ) - { - sal_uInt16 nMapPos = GetMapPos(m_pVMap, m_aVertLB); - sal_uInt16 nAlign = GetAlignment(m_pVMap, nMapPos, m_aVertLB, m_aVertToLB); - sal_uInt16 nRel = GetRelation(m_pVMap, m_aVertToLB); - - m_aExampleWN.SetVAlign(nAlign); - m_aExampleWN.SetVertRel(nRel); - } - - // Size - long nXPos = static_cast(m_aHoriByMF.Denormalize(m_aHoriByMF.GetValue(FUNIT_TWIP))); - long nYPos = static_cast(m_aVertByMF.Denormalize(m_aVertByMF.GetValue(FUNIT_TWIP))); - m_aExampleWN.SetRelPos(Point(nXPos, nYPos)); - - m_aExampleWN.SetAnchor( GetAnchorType() ); - m_aExampleWN.Invalidate(); -} - -sal_uLong SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, sal_uInt16 nMapPos, sal_uInt16 nAlign, - sal_uInt16 nRel, ListBox &rLB, FixedText &rFT) -{ - String sSelEntry; - sal_uLong nLBRelations = 0; - std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap); - - rLB.Clear(); - - if (nMapPos < nMapCount) - { - if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) - { - String sOldEntry(rLB.GetSelectEntry()); - sal_uInt16 nRelCount = SAL_N_ELEMENTS(aAsCharRelationMap); - SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; - - for (std::size_t _nMapPos = 0; _nMapPos < nMapCount; _nMapPos++) - { - if (pMap[_nMapPos].eStrId == eStrId) - { - nLBRelations = pMap[_nMapPos].nLBRelations; - for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) - { - if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation) - { - SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId; - - sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); - String sEntry = m_aFramePosString.GetString(sStrId1); - sal_uInt16 nPos = rLB.InsertEntry(sEntry); - rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]); - if (pMap[_nMapPos].nAlign == nAlign) - sSelEntry = sEntry; - break; - } - } - } - } - if (sSelEntry.Len()) - rLB.SelectEntry(sSelEntry); - else - { - rLB.SelectEntry(sOldEntry); - - if (!rLB.GetSelectEntryCount()) - { - for (sal_uInt16 i = 0; i < rLB.GetEntryCount(); i++) - { - RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); - if (pEntry->nLBRelation == LB_REL_CHAR) // Default - { - rLB.SelectEntryPos(i); - break; - } - } - } - } - } - else - { - sal_uInt16 nRelCount = SAL_N_ELEMENTS(aRelationMap); - - // #i22341# - special handling for map , - // because its ambigous in its /. - if ( pMap == aVCharMap ) - { - nLBRelations = ::lcl_GetLBRelationsForStrID( pMap, - ( m_aHoriMirrorCB.IsChecked() - ? pMap[nMapPos].eMirrorStrId - : pMap[nMapPos].eStrId ), - m_aHoriMirrorCB.IsChecked() ); - } - else - { - nLBRelations = pMap[nMapPos].nLBRelations; - } - - for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1) - { - if (nLBRelations & nBit) - { - for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) - { - if (aRelationMap[nRelPos].nLBRelation == nBit) - { - SvxSwFramePosString::StringId sStrId1 = m_aHoriMirrorCB.IsChecked() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId; - sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft); - String sEntry = m_aFramePosString.GetString(sStrId1); - sal_uInt16 nPos = rLB.InsertEntry(sEntry); - rLB.SetEntryData(nPos, &aRelationMap[nRelPos]); - if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == nRel) - sSelEntry = sEntry; - } - } - } - } - if (sSelEntry.Len()) - rLB.SelectEntry(sSelEntry); - else - { - // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen - switch (nRel) - { - case RelOrientation::FRAME: nRel = RelOrientation::PAGE_FRAME; break; - case RelOrientation::PRINT_AREA: nRel = RelOrientation::PAGE_PRINT_AREA; break; - case RelOrientation::PAGE_LEFT: nRel = RelOrientation::FRAME_LEFT; break; - case RelOrientation::PAGE_RIGHT: nRel = RelOrientation::FRAME_RIGHT; break; - case RelOrientation::FRAME_LEFT: nRel = RelOrientation::PAGE_LEFT; break; - case RelOrientation::FRAME_RIGHT: nRel = RelOrientation::PAGE_RIGHT; break; - case RelOrientation::PAGE_FRAME: nRel = RelOrientation::FRAME; break; - case RelOrientation::PAGE_PRINT_AREA: nRel = RelOrientation::PRINT_AREA; break; - - default: - if (rLB.GetEntryCount()) - { - RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(rLB.GetEntryCount() - 1); - nRel = pEntry->nRelation; - } - break; - } - - for (sal_uInt16 i = 0; i < rLB.GetEntryCount(); i++) - { - RelationMap *pEntry = (RelationMap *)rLB.GetEntryData(i); - if (pEntry->nRelation == nRel) - { - rLB.SelectEntryPos(i); - break; - } - } - - if (!rLB.GetSelectEntryCount()) - rLB.SelectEntryPos(0); - } - } - } - - rLB.Enable(rLB.GetEntryCount() != 0); - rFT.Enable(rLB.GetEntryCount() != 0); - - RelHdl(&rLB); - - return nLBRelations; -} - -sal_uInt16 SvxSwPosSizeTabPage::FillPosLB(FrmMap *_pMap, - sal_uInt16 _nAlign, - const sal_uInt16 _nRel, - ListBox &_rLB) -{ - String sSelEntry, sOldEntry; - sOldEntry = _rLB.GetSelectEntry(); - - _rLB.Clear(); - - // #i22341# - determine all possible listbox relations for - // given relation for map - const sal_uLong nLBRelations = (_pMap != aVCharMap) - ? 0L - : ::lcl_GetLBRelationsForRelations( _nRel ); - - // Listbox fuellen - std::size_t nCount = ::lcl_GetFrmMapCount(_pMap); - for (std::size_t i = 0; _pMap && i < nCount; ++i) - { -// #61359# Warum nicht von links/von innen bzw. von oben? -// if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP)) - { - SvxSwFramePosString::StringId eStrId = m_aHoriMirrorCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; - eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, m_bIsVerticalFrame, m_bIsInRightToLeft); - String sEntry(m_aFramePosString.GetString(eStrId)); - if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND) - { - // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen - _rLB.InsertEntry(sEntry); - } - // #i22341# - add condition to handle map - // that is ambigous in the alignment. - if ( _pMap[i].nAlign == _nAlign && - ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) ) - { - sSelEntry = sEntry; - } - } - } - - _rLB.SelectEntry(sSelEntry); - if (!_rLB.GetSelectEntryCount()) - _rLB.SelectEntry(sOldEntry); - - if (!_rLB.GetSelectEntryCount()) - _rLB.SelectEntryPos(0); - - PosHdl(&_rLB); - - return GetMapPos(_pMap, _rLB); -} - -void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView ) -{ - m_pSdrView = pSdrView; - if(!m_pSdrView) - { - OSL_FAIL("No SdrView* set"); - return; - } - - // Setzen des Rechtecks und der Workingarea - m_aRect = m_pSdrView->GetAllMarkedRect(); - m_pSdrView->GetSdrPageView()->LogicToPagePos( m_aRect ); - - // get WorkArea - m_aWorkArea = m_pSdrView->GetWorkArea(); - - // Beruecksichtigung Ankerposition (bei Writer) - const SdrMarkList& rMarkList = m_pSdrView->GetMarkedObjectList(); - if( rMarkList.GetMarkCount() >= 1 ) - { - const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - m_aAnchorPos = pObj->GetAnchorPos(); - - if( m_aAnchorPos != Point(0,0) ) // -> Writer - { - for( sal_uInt16 i = 1; i < rMarkList.GetMarkCount(); i++ ) - { - pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); - if( m_aAnchorPos != pObj->GetAnchorPos() ) - { - // different anchor positions -> disable positioning - m_aPositionFL.Enable(sal_False); - m_aHoriFT.Enable(sal_False); - m_aHoriLB.Enable(sal_False); - m_aHoriByFT.Enable(sal_False); - m_aHoriByMF.Enable(sal_False); - m_aHoriToFT.Enable(sal_False); - m_aHoriToLB.Enable(sal_False); - m_aHoriMirrorCB.Enable(sal_False); - m_aVertFT.Enable(sal_False); - m_aVertLB.Enable(sal_False); - m_aVertByFT.Enable(sal_False); - m_aVertByMF.Enable(sal_False); - m_aVertToFT.Enable(sal_False); - m_aVertToLB.Enable(sal_False); - m_aFollowCB.Enable(sal_False); - m_aHoriByMF.SetText(String()); - m_aVertByMF.SetText(String()); - - m_bPositioningDisabled = true; - return; - } - } - } - Point aPt = m_aAnchorPos * -1; - Point aPt2 = aPt; - - aPt += m_aWorkArea.TopLeft(); - m_aWorkArea.SetPos( aPt ); - - aPt2 += m_aRect.TopLeft(); - m_aRect.SetPos( aPt2 ); - } - - // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE - if( rMarkList.GetMarkCount() != 1 ) - m_bIsMultiSelection = true; -#if OSL_DEBUG_LEVEL > 1 - else - { - const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier(); - if( ( pObj->GetObjInventor() == SdrInventor ) && - ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) && - ( (SdrTextObj*) pObj )->HasText() ) - { - OSL_FAIL("AutoWidth/AutoHeight should be enabled"); - } - } -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/swpossizetabpage.hrc b/cui/source/tabpages/swpossizetabpage.hrc deleted file mode 100644 index b7e69c27c..000000000 --- a/cui/source/tabpages/swpossizetabpage.hrc +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define FL_SIZE 1 -#define FT_WIDTH 2 -#define MF_WIDTH 3 -#define FT_HEIGHT 4 -#define MF_HEIGHT 5 -#define CB_KEEPRATIO 6 -#define FL_SEPARATOR 7 -#define FL_ANCHOR 8 -#define RB_TOPAGE 9 -#define RB_TOPARA 10 -#define RB_TOCHAR 11 -#define RB_ASCHAR 12 -#define RB_TOFRAME 13 -#define FL_PROTECTION 14 -#define CB_POSITION 15 -#define CB_SIZE 16 -#define FL_POSITION 17 -#define FT_HORI 18 -#define LB_HORI 19 -#define FT_HORIBY 20 -#define MF_HORIBY 21 -#define FT_HORITO 22 -#define LB_HORITO 23 -#define CB_HORIMIRROR 24 -#define FT_VERT 25 -#define LB_VERT 26 -#define FT_VERTBY 27 -#define MF_VERTBY 28 -#define FT_VERTTO 29 -#define LB_VERTTO 30 -#define CB_FOLLOW 31 -#define WN_EXAMPLE 32 diff --git a/cui/source/tabpages/swpossizetabpage.hxx b/cui/source/tabpages/swpossizetabpage.hxx deleted file mode 100644 index 22821099d..000000000 --- a/cui/source/tabpages/swpossizetabpage.hxx +++ /dev/null @@ -1,159 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_SWPOSSIZETABPAGE_HXX -#define _SVX_SWPOSSIZETABPAGE_HXX - -#include -#include -#include -#include -#include -#include - -// SvxSwPosSizeTabPage - position and size page for Writer drawing objects -struct FrmMap; -class SdrView; -class SvxSwPosSizeTabPage : public SfxTabPage -{ - using TabPage::DeactivatePage; - - FixedLine m_aSizeFL; - FixedText m_aWidthFT; - MetricField m_aWidthMF; - FixedText m_aHeightFT; - MetricField m_aHeightMF; - CheckBox m_aKeepRatioCB; - - FixedLine m_aSeparatorFL; - - FixedLine m_aAnchorFL; - RadioButton m_aToPageRB; - RadioButton m_aToParaRB; - RadioButton m_aToCharRB; - RadioButton m_aAsCharRB; - RadioButton m_aToFrameRB; - - FixedLine m_aProtectionFL; - TriStateBox m_aPositionCB; - TriStateBox m_aSizeCB; - - FixedLine m_aPositionFL; - FixedText m_aHoriFT; - ListBox m_aHoriLB; - FixedText m_aHoriByFT; - MetricField m_aHoriByMF; - FixedText m_aHoriToFT; - ListBox m_aHoriToLB; - - CheckBox m_aHoriMirrorCB; - - FixedText m_aVertFT; - ListBox m_aVertLB; - FixedText m_aVertByFT; - MetricField m_aVertByMF; - FixedText m_aVertToFT; - ListBox m_aVertToLB; - - CheckBox m_aFollowCB; - - SvxSwFrameExample m_aExampleWN; - - Link m_aValidateLink; - - //'string provider' - SvxSwFramePosString m_aFramePosString; - - Rectangle m_aRect; //size of all selected objects - Rectangle m_aWorkArea; - Point m_aAnchorPos; - - FrmMap* m_pVMap; - FrmMap* m_pHMap; - const SdrView* m_pSdrView; - - // initial values - short m_nOldH; - short m_nOldHRel; - short m_nOldV; - short m_nOldVRel; - - double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button - sal_uInt16 m_nHtmlMode; - bool m_bHtmlMode; - bool m_bAtHoriPosModified; - bool m_bAtVertPosModified; - bool m_bIsVerticalFrame; - bool m_bPositioningDisabled; - bool m_bIsMultiSelection; - bool m_bIsInRightToLeft; - - - - DECL_LINK( RangeModifyHdl, Edit * ); - DECL_LINK( AnchorTypeHdl, RadioButton * ); - DECL_LINK( PosHdl, ListBox * ); - DECL_LINK( RelHdl, ListBox * ); - DECL_LINK( MirrorHdl, CheckBox * ); - DECL_LINK( ModifyHdl, Edit * ); - DECL_LINK( ProtectHdl, TriStateBox *); - - void InitPos(short nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel, - sal_uInt16 nV, sal_uInt16 nVRel, - long nX, long nY); - sal_uInt16 GetMapPos(FrmMap *pMap, ListBox &rAlignLB); - short GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &rAlignLB, ListBox &rRelationLB); - short GetRelation(FrmMap *pMap, ListBox &rRelationLB); - short GetAnchorType(bool* pbHasChanged = 0); - sal_uLong FillRelLB(FrmMap *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, ListBox &rLB, FixedText &rFT); - sal_uInt16 FillPosLB(FrmMap *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, ListBox &rLB); - - void UpdateExample(); - -public: - SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ); - ~SvxSwPosSizeTabPage(); - - static SfxTabPage* Create( Window*, const SfxItemSet& ); - static sal_uInt16* GetRanges(); - - virtual sal_Bool FillItemSet( SfxItemSet& ); - virtual void Reset( const SfxItemSet & ); - - virtual int DeactivatePage( SfxItemSet* pSet ); - - void EnableAnchorTypes(sal_uInt16 nAnchorEnable); - - void SetValidateFramePosLink( const Link& rLink ) - {m_aValidateLink = rLink;} - - void SetView( const SdrView* pSdrView ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/swpossizetabpage.src b/cui/source/tabpages/swpossizetabpage.src deleted file mode 100644 index 58b9832c1..000000000 --- a/cui/source/tabpages/swpossizetabpage.src +++ /dev/null @@ -1,313 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include "helpid.hrc" -#include -#include "swpossizetabpage.hrc" -#include - - // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------ -TabPage RID_SVXPAGE_SWPOSSIZE -{ - HelpId = HID_SVXPAGE_SWPOSSIZE; - Hide = TRUE ; - Text[ en-US ] = "Position and Size" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_SIZE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 104 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 43 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Width" ; - }; - MetricField MF_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_SWPOSSIZE:MF_WIDTH"; - Pos = MAP_APPFONT ( 59 , 14 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - Border = TRUE ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 5 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_HEIGHT - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 43 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "H~eight" ; - }; - MetricField MF_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_SWPOSSIZE:MF_HEIGHT"; - Pos = MAP_APPFONT ( 59 , 30 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - Border = TRUE ; - Text = "12,99" ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 5 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = 5 ; - Last = 9999 ; - SpinSize = 10 ; - }; - CheckBox CB_KEEPRATIO - { - HelpID = "cui:CheckBox:RID_SVXPAGE_SWPOSSIZE:CB_KEEPRATIO"; - Pos = MAP_APPFONT ( 12 , 45 ) ; - Size = MAP_APPFONT ( 95 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Keep ratio" ; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 111 , 14 ) ; - Size = MAP_APPFONT ( 4 , 66 ) ; - Vert = TRUE; - }; - FixedLine FL_ANCHOR - { - Pos = MAP_APPFONT ( 116 , 3 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text [ en-US ] = "Anchor" ; - }; - RadioButton RB_TOPAGE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_SWPOSSIZE:RB_TOPAGE"; - Pos = MAP_APPFONT ( 122 , 14 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "To ~page"; - }; - RadioButton RB_TOPARA - { - HelpID = "cui:RadioButton:RID_SVXPAGE_SWPOSSIZE:RB_TOPARA"; - Pos = MAP_APPFONT ( 122 , 28 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "To paragrap~h"; - }; - RadioButton RB_TOCHAR - { - HelpID = "cui:RadioButton:RID_SVXPAGE_SWPOSSIZE:RB_TOCHAR"; - Pos = MAP_APPFONT ( 122 , 42 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "To cha~racter"; - }; - RadioButton RB_ASCHAR - { - HelpID = "cui:RadioButton:RID_SVXPAGE_SWPOSSIZE:RB_ASCHAR"; - Pos = MAP_APPFONT ( 122 , 56 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "~As character" ; - }; - RadioButton RB_TOFRAME - { - HelpID = "cui:RadioButton:RID_SVXPAGE_SWPOSSIZE:RB_TOFRAME"; - Hide = TRUE; - Pos = MAP_APPFONT ( 122 , 70 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "To ~frame"; - }; - Window WN_EXAMPLE - { - Pos = MAP_APPFONT ( 202 , 14 ) ; - Size = MAP_APPFONT ( 52 , 66 ) ; - }; - FixedLine FL_PROTECTION - { - Pos = MAP_APPFONT ( 6 , 86 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Protect" ; - }; - TriStateBox CB_POSITION - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_SWPOSSIZE:CB_POSITION"; - Pos = MAP_APPFONT ( 12 , 97 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Position" ; - }; - TriStateBox CB_SIZE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_SWPOSSIZE:CB_SIZE"; - Pos = MAP_APPFONT ( 122 , 97 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 6 , 113 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Position" ; - }; - FixedText FT_HORI - { - Pos = MAP_APPFONT ( 12 , 126 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "Hori~zontal" ; - }; - ListBox LB_HORI - { - HelpID = "cui:ListBox:RID_SVXPAGE_SWPOSSIZE:LB_HORI"; - Pos = MAP_APPFONT ( 49 , 124 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_HORIBY - { - Pos = MAP_APPFONT ( 101 , 126 ) ; - Size = MAP_APPFONT ( 20 , 8 ) ; - Center = TRUE ; - Text [ en-US ] = "b~y" ; - }; - MetricField MF_HORIBY - { - HelpID = "cui:MetricField:RID_SVXPAGE_SWPOSSIZE:MF_HORIBY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 123 , 124 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = -9999 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_HORITO - { - Pos = MAP_APPFONT ( 160 , 126 ) ; - Size = MAP_APPFONT ( 21 , 8 ) ; - Center = TRUE ; - Text [ en-US ] = "~to" ; - }; - ListBox LB_HORITO - { - HelpID = "cui:ListBox:RID_SVXPAGE_SWPOSSIZE:LB_HORITO"; - Pos = MAP_APPFONT ( 183 , 124 ) ; - Size = MAP_APPFONT ( 65 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - CheckBox CB_HORIMIRROR - { - HelpID = "cui:CheckBox:RID_SVXPAGE_SWPOSSIZE:CB_HORIMIRROR"; - Pos = MAP_APPFONT ( 12 , 139 ) ; - Size = MAP_APPFONT ( 236 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Mirror on even pages" ; - }; - FixedText FT_VERT - { - Pos = MAP_APPFONT ( 12 , 155 ) ; - Size = MAP_APPFONT ( 35 , 8 ) ; - Left = TRUE ; - Text [ en-US ] = "~Vertical" ; - }; - ListBox LB_VERT - { - HelpID = "cui:ListBox:RID_SVXPAGE_SWPOSSIZE:LB_VERT"; - Pos = MAP_APPFONT ( 49 , 153 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_VERTBY - { - Pos = MAP_APPFONT ( 101 , 155 ) ; - Size = MAP_APPFONT ( 20 , 8 ) ; - Center = TRUE ; - Text [ en-US ] = "by" ; - }; - MetricField MF_VERTBY - { - HelpID = "cui:MetricField:RID_SVXPAGE_SWPOSSIZE:MF_VERTBY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 123 , 153 ) ; - Size = MAP_APPFONT ( 35 , 12 ) ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -9999 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - First = -9999 ; - Last = 9999 ; - SpinSize = 10 ; - }; - FixedText FT_VERTTO - { - Pos = MAP_APPFONT ( 160 , 155 ) ; - Size = MAP_APPFONT ( 21 , 8 ) ; - Center = TRUE ; - Text [ en-US ] = "t~o" ; - }; - ListBox LB_VERTTO - { - HelpID = "cui:ListBox:RID_SVXPAGE_SWPOSSIZE:LB_VERTTO"; - Pos = MAP_APPFONT ( 183 , 153 ) ; - Size = MAP_APPFONT ( 65 , 60 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - CheckBox CB_FOLLOW - { - HelpID = "cui:CheckBox:RID_SVXPAGE_SWPOSSIZE:CB_FOLLOW"; - Pos = MAP_APPFONT ( 12 , 168 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Follow text flow" ; - }; -}; diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx deleted file mode 100644 index 95491d538..000000000 --- a/cui/source/tabpages/tabarea.cxx +++ /dev/null @@ -1,351 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _SVX_TABAREA_CXX - -#include -#include -#include "svx/globl3d.hxx" -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "tabarea.hrc" -#include "dlgname.hxx" -#include - -#define DLGWIN this->GetParent()->GetParent() - -/************************************************************************* -|* -|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu -|* -|************************************************************************/ - -SvxAreaTabDialog::SvxAreaTabDialog -( - Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - const SdrView* /* pSdrView */ -) : - - SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_AREA ), pAttr ), - - mpDrawModel ( pModel ), - mpColorTab ( pModel->GetColorTable() ), - mpNewColorTab ( pModel->GetColorTable() ), - mpGradientList ( pModel->GetGradientList() ), - mpNewGradientList ( pModel->GetGradientList() ), - mpHatchingList ( pModel->GetHatchList() ), - mpNewHatchingList ( pModel->GetHatchList() ), - mpBitmapList ( pModel->GetBitmapList() ), - mpNewBitmapList ( pModel->GetBitmapList() ), - mrOutAttrs ( *pAttr ), - mnColorTableState ( CT_NONE ), - mnBitmapListState ( CT_NONE ), - mnGradientListState ( CT_NONE ), - mnHatchingListState ( CT_NONE ), - mnPageType( PT_AREA ), - mnDlgType( 0 ), - mnPos( 0 ), - mbAreaTP( sal_False ), - mbDeleteColorTable( sal_True ) -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create, 0); - AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_GRADIENT, SvxGradientTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_HATCH, SvxHatchTabPage::Create, 0 ); - AddTabPage( RID_SVXPAGE_BITMAP, SvxBitmapTabPage::Create, 0); - - SetCurPageId( RID_SVXPAGE_AREA ); - - CancelButton& rBtnCancel = GetCancelButton(); - rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) ); -//! rBtnCancel.SetText( CUI_RESSTR( RID_SVXSTR_CLOSE ) ); -} - -// ----------------------------------------------------------------------- - -SvxAreaTabDialog::~SvxAreaTabDialog() -{ -} - - -// ----------------------------------------------------------------------- - -void SvxAreaTabDialog::SavePalettes() -{ - SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != mpDrawModel->GetColorTable() ) - { - if(mbDeleteColorTable) - delete mpDrawModel->GetColorTable(); - mpDrawModel->SetColorTable( mpNewColorTab ); - SvxColorTableItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE ); - if ( pShell ) - pShell->PutItem( aColorTableItem ); - else - { - mpDrawModel->GetItemPool().Put(aColorTableItem,SID_COLOR_TABLE); - } - mpColorTab = mpDrawModel->GetColorTable(); - } - if( mpNewGradientList != mpDrawModel->GetGradientList() ) - { - delete mpDrawModel->GetGradientList(); - mpDrawModel->SetGradientList( mpNewGradientList ); - SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST ); - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem,SID_GRADIENT_LIST); - } - mpGradientList = mpDrawModel->GetGradientList(); - } - if( mpNewHatchingList != mpDrawModel->GetHatchList() ) - { - delete mpDrawModel->GetHatchList(); - mpDrawModel->SetHatchList( mpNewHatchingList ); - SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST ); - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem,SID_HATCH_LIST); - } - mpHatchingList = mpDrawModel->GetHatchList(); - } - if( mpNewBitmapList != mpDrawModel->GetBitmapList() ) - { - delete mpDrawModel->GetBitmapList(); - mpDrawModel->SetBitmapList( mpNewBitmapList ); - SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST ); - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem,SID_BITMAP_LIST); - } - mpBitmapList = mpDrawModel->GetBitmapList(); - } - - // Speichern der Tabellen, wenn sie geaendert wurden. - - const String aPath( SvtPathOptions().GetPalettePath() ); - - if( mnHatchingListState & CT_MODIFIED ) - { - mpHatchingList->SetPath( aPath ); - mpHatchingList->Save(); - - SvxHatchListItem aItem( mpHatchingList, SID_HATCH_LIST ); - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem); - } - } - - if( mnBitmapListState & CT_MODIFIED ) - { - mpBitmapList->SetPath( aPath ); - mpBitmapList->Save(); - - SvxBitmapListItem aItem( mpBitmapList, SID_BITMAP_LIST ); - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem); - } - } - - if( mnGradientListState & CT_MODIFIED ) - { - mpGradientList->SetPath( aPath ); - mpGradientList->Save(); - - SvxGradientListItem aItem( mpGradientList, SID_GRADIENT_LIST ); - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem); - } - } - - if( mnColorTableState & CT_MODIFIED ) - { - mpColorTab->SetPath( aPath ); - mpColorTab->Save(); - - SvxColorTableItem aItem( mpColorTab, SID_COLOR_TABLE ); - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( aItem ); - else - { - mpDrawModel->GetItemPool().Put(aItem); - } - } -} -// ----------------------------------------------------------------------- - -short SvxAreaTabDialog::Ok() -{ - SavePalettes(); - - // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine - // TabPage in FillItemSet() sal_True zurueckliefert. Dieses - // geschieht z.Z. standardmaessig. - return( SfxTabDialog::Ok() ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxAreaTabDialog, CancelHdlImpl, void *, EMPTYARG) -{ - SavePalettes(); - - EndDialog( RET_CANCEL ); - return 0; -} -IMPL_LINK_INLINE_END( SvxAreaTabDialog, CancelHdlImpl, void *, p ) - -// ----------------------------------------------------------------------- - -void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - switch( nId ) - { - case RID_SVXPAGE_AREA: - ( (SvxAreaTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); - ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); - ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); - ( (SvxAreaTabPage&) rPage ).SetPageType( mnPageType ); - ( (SvxAreaTabPage&) rPage ).SetDlgType( mnDlgType ); - ( (SvxAreaTabPage&) rPage ).SetPos( mnPos ); - ( (SvxAreaTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); - ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); - ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); - ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxAreaTabPage&) rPage ).Construct(); - // ActivatePage() wird das erste mal nicht gerufen - ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs ); - - break; - - case RID_SVXPAGE_SHADOW: - { - ( (SvxShadowTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxShadowTabPage&) rPage ).SetPageType( mnPageType ); - ( (SvxShadowTabPage&) rPage ).SetDlgType( mnDlgType ); - ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxShadowTabPage&) rPage ).Construct(); - } - break; - - case RID_SVXPAGE_GRADIENT: - ( (SvxGradientTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxGradientTabPage&) rPage ).SetGradientList( mpGradientList ); - ( (SvxGradientTabPage&) rPage ).SetPageType( &mnPageType ); - ( (SvxGradientTabPage&) rPage ).SetDlgType( &mnDlgType ); - ( (SvxGradientTabPage&) rPage ).SetPos( &mnPos ); - ( (SvxGradientTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxGradientTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); - ( (SvxGradientTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxGradientTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_HATCH: - ( (SvxHatchTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxHatchTabPage&) rPage ).SetHatchingList( mpHatchingList ); - ( (SvxHatchTabPage&) rPage ).SetPageType( &mnPageType ); - ( (SvxHatchTabPage&) rPage ).SetDlgType( &mnDlgType ); - ( (SvxHatchTabPage&) rPage ).SetPos( &mnPos ); - ( (SvxHatchTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxHatchTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); - ( (SvxHatchTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxHatchTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_BITMAP: - ( (SvxBitmapTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxBitmapTabPage&) rPage ).SetBitmapList( mpBitmapList ); - ( (SvxBitmapTabPage&) rPage ).SetPageType( &mnPageType ); - ( (SvxBitmapTabPage&) rPage ).SetDlgType( &mnDlgType ); - ( (SvxBitmapTabPage&) rPage ).SetPos( &mnPos ); - ( (SvxBitmapTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxBitmapTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); - ( (SvxBitmapTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxBitmapTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_COLOR: - ( (SvxColorTabPage&) rPage ).SetColorTable( mpColorTab ); - ( (SvxColorTabPage&) rPage ).SetPageType( &mnPageType ); - ( (SvxColorTabPage&) rPage ).SetDlgType( &mnDlgType ); - ( (SvxColorTabPage&) rPage ).SetPos( &mnPos ); - ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxColorTabPage&) rPage ).SetDeleteColorTable( mbDeleteColorTable ); - ( (SvxColorTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_TRANSPARENCE: - ( (SvxTransparenceTabPage&) rPage ).SetPageType( mnPageType ); - ( (SvxTransparenceTabPage&) rPage ).SetDlgType( mnDlgType ); - ( (SvxTransparenceTabPage&) rPage ).Construct(); - break; - - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tabarea.hrc b/cui/source/tabpages/tabarea.hrc deleted file mode 100644 index efb48ff7a..000000000 --- a/cui/source/tabpages/tabarea.hrc +++ /dev/null @@ -1,191 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define BTN_LOAD 5 -#define BTN_SAVE 6 -#define GRP_FILL 1 -#define GRP_SHADOW 2 -#define GRP_PREVIEW 3 -#define GRP_TRANSPARENT 4 -#define GRP_STEPCOUNT 5 -#define CTL_PREVIEW 1 -#define CTL_POSITION 2 -//#define CTL_GRADIENT_PREVIEW 3 -//#define CTL_HATCHING_PREVIEW 4 -#define CTL_COLOR_PREVIEW 5 -#define CTL_BITMAP_PREVIEW 6 -#define MTR_FLD_DISTANCE 1 -#define TSB_INVISIBLE 1 -#define TSB_SHOW_SHADOW 2 -#define TSB_STEPCOUNT 3 -#define TSB_TILE 4 -#define TSB_STRETCH 5 -#define TSB_ORIGINAL 6 -#define AREADLG_INVISIBLE 0 -#define AREADLG_COLOR 1 -#define AREADLG_GRADIENT 2 -#define AREADLG_HATCH 3 -#define AREADLG_BITMAP 4 - -#define LB_COLOR 1 -#define LB_GRADIENT 2 -#define LB_HATCHING 3 -#define LB_BITMAP 4 -//#define LB_TRANSPARENT 5 -#define LB_BITMAPS 4 -#define LB_BACKGROUND_COLOR 3 -#define LB_DLG_TYPE 99 -#define GRP_COLOR 1 -#define BTN_ADD 1 -#define BTN_IMPORT 2 -#define BTN_MODIFY 3 -#define BTN_DELETE 4 -#define FT_COLOR 1 -#define FT_BACKGROUND_COLOR 2 -#define FT_POSITION 2 -#define FT_DISTANCE 1 -#define FT_LINE_COLOR 2 -#define FT_LINE_TYPE 1 -#define FT_LINE_DISTANCE 3 -#define FT_LINE_ANGLE 4 -#define GRP_LINE 1 -#define GRP_HATCHINGS 5 -#define MTR_FLD_ANGLE 3 -#define CTL_ANGLE 2 -#define LB_HATCHINGS 4 -#define LB_LINE_TYPE 1 -#define LB_LINE_COLOR 3 -#define GRP_GRADIENTS 4 -#define GRP_GRADIENT_TYPE 5 -#define LB_GRADIENTS 3 -#define LB_GRADIENT_TYPES 4 -#define LB_COLOR_FROM 1 -#define LB_COLOR_TO 2 -#define FT_COLOR_FROM 1 -#define FT_COLOR_TO 2 -#define FT_CENTER_X 3 -#define FT_CENTER_Y 5 -#define FT_ANGLE 4 -#define FT_BORDER 6 -#define MTR_COLOR_FROM 4 -#define MTR_COLOR_TO 5 -#define MTR_CENTER_X 2 -#define MTR_CENTER_Y 3 -#define MTR_BORDER 6 -#define MTR_ANGLE 1 -#define NUM_FLD_STEPCOUNT 1 -#define FT_PIXEL_EDIT 4 -#define CTL_PIXEL 2 -#define FT_TYPE 7 -#define FT_SHADOW_COLOR 10 -#define LB_SHADOW_COLOR 10 -#define FL_PROP 2 -#define FL_SIZE 3 -#define FL_POSITION 4 -#define FL_OFFSET 5 -#define FL_STEPCOUNT 7 - -// Farben definieren TabPage -// nur temporaer !!! -// #define RID_SVXPAGE_COLOR 999 - -//#define GRP_COLORTABLE 1 -//#define GRP_COLORMODEL 2 - -#define BTN_WORK_ON 2 -#define CTL_COLORTABLE 3 -#define CTL_PREVIEW_OLD 1 -#define CTL_PREVIEW_NEW 2 -#define FT_NAME 2 -#define EDT_NAME 1 -// #define LB_COLOR 1 -#define LB_COLORMODEL 2 -#define FT_1 3 -#define FT_2 4 -#define FT_3 5 -#define FT_4 6 -#define MTR_FLD_1 1 -#define MTR_FLD_2 2 -#define MTR_FLD_3 3 -#define MTR_FLD_4 4 -#define FT_TABLE_NAME 7 -#define MTR_FLD_X_SIZE 4 -#define MTR_FLD_Y_SIZE 5 -#define GRP_SIZE 6 -#define TSB_SCALE 1 -#define GRP_POSITION 7 -#define FT_X_OFFSET 1 -#define FT_Y_OFFSET 2 -#define MTR_FLD_X_OFFSET 1 -#define MTR_FLD_Y_OFFSET 2 -#define LB_AREA_TYPE 19 -#define RBT_ROW 6 -#define RBT_COLUMN 7 -#define MTR_FLD_OFFSET 3 -#define GRP_OFFSET 8 - -#define FT_TRANSPARENT 9 -#define FT_X_SIZE 10 -#define FT_Y_SIZE 11 -#define FT_BITMAPS_HIDDEN 12 - -#define RBT_TRANS_OFF 8 -#define RBT_TRANS_LINEAR 9 -#define RBT_TRANS_GRADIENT 10 -#define GRP_TRANS_MODE 9 -#define GRP_TRANS_GRADIENT 10 -#define CTL_TRANS_PREVIEW 19 - -#define FT_TRGR_TYPE 12 -#define LB_TRGR_GRADIENT_TYPES 3 -#define FT_TRGR_CENTER_X 13 -#define MTR_TRGR_CENTER_X 4 -#define FT_TRGR_CENTER_Y 14 -#define MTR_TRGR_CENTER_Y 5 -#define FT_TRGR_ANGLE 15 -#define MTR_TRGR_ANGLE 6 -#define FT_TRGR_BORDER 16 -#define MTR_TRGR_BORDER 7 -#define FT_TRGR_START_VALUE 17 -#define MTR_TRGR_START_VALUE 8 -#define FT_TRGR_END_VALUE 18 -#define MTR_TRGR_END_VALUE 9 -#define MTR_TRANSPARENT 10 - -#define MTR_SHADOW_TRANSPARENT 11 - -// Hatch-Background on Area-TabPage -#define GRP_HATCHBCKGRD 20 -#define CB_HATCHBCKGRD 21 -#define LB_HATCHBCKGRDCOLOR 22 - - -#define IMG_LOAD_H 23 -#define IMG_SAVE_H 24 -// IAccessibility2 implementation 2009 ------ -#define STR_CUI_COLORMODEL 5030 -#define STR_LB_HATCHINGSTYLE 5031 -// ------ IAccessibility2 implementation 2009. diff --git a/cui/source/tabpages/tabarea.src b/cui/source/tabpages/tabarea.src deleted file mode 100644 index 24b4c1068..000000000 --- a/cui/source/tabpages/tabarea.src +++ /dev/null @@ -1,1557 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include -#include "tabarea.hrc" -#include - -#define MASKCOLOR MaskColor = Color{ Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; }; - - - // RID_SVXPAGE_AREA ------------------------------------------------------ -#define TRANS_GRAD_OFFSET_X 6 -#define TRANS_GRAD_OFFSET_Y 64 -#define TRANS_GRAD_FIELD_SEPARATION 24 - -TabPage RID_SVXPAGE_TRANSPARENCE -{ - HelpID = HID_AREA_TRANSPARENCE; - Hide = TRUE; - Size = MAP_APPFONT ( 260 , 185 ); - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Transparency mode"; - }; - RadioButton RBT_TRANS_OFF - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TRANSPARENCE:RBT_TRANS_OFF"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - Text [ en-US ] = "~No transparency"; - }; - RadioButton RBT_TRANS_LINEAR - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TRANSPARENCE:RBT_TRANS_LINEAR"; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 60 , 10 ) ; - Text [ en-US ] = "~Transparency"; - }; - MetricField MTR_TRANSPARENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRANSPARENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 26 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - RadioButton RBT_TRANS_GRADIENT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TRANSPARENCE:RBT_TRANS_GRADIENT"; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - Text [ en-US ] = "Gradient"; - }; - FixedText FT_TRGR_TYPE - { - Pos = MAP_APPFONT ( 21 , 56 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "Ty~pe"; - }; - ListBox LB_TRGR_GRADIENT_TYPES - { - HelpID = "cui:ListBox:RID_SVXPAGE_TRANSPARENCE:LB_TRGR_GRADIENT_TYPES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 54 ) ; - Size = MAP_APPFONT ( 53 , 63 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Linear" ; Default ; > ; - < "Axial" ; Default ; > ; - < "Radial" ; Default ; > ; - < "Ellipsoid" ; Default ; > ; - < "Quadratic" ; Default ; > ; - < "Square" ; Default ; > ; - }; - }; - FixedText FT_TRGR_CENTER_X - { - Pos = MAP_APPFONT ( 21 , 72 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "Center ~X"; - }; - MetricField MTR_TRGR_CENTER_X - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_CENTER_X"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 70 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_TRGR_CENTER_Y - { - Pos = MAP_APPFONT ( 21 , 88 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "Center ~Y"; - }; - MetricField MTR_TRGR_CENTER_Y - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_CENTER_Y"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 86 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_TRGR_ANGLE - { - Pos = MAP_APPFONT ( 21 , 104 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "~Angle"; - }; - MetricField MTR_TRGR_ANGLE - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_ANGLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 102 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 359 ; - Unit = FUNIT_CUSTOM ; - Last = 359 ; - SpinSize = 15 ; - CustomUnitText [ en-US ] = " degrees"; - }; - FixedText FT_TRGR_BORDER - { - Pos = MAP_APPFONT ( 15 + TRANS_GRAD_OFFSET_X, 56 + TRANS_GRAD_OFFSET_Y) ; - Size = MAP_APPFONT ( 41, 8 ) ; - Text [ en-US ] = "~Border"; - }; - MetricField MTR_TRGR_BORDER - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_BORDER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 + TRANS_GRAD_OFFSET_X, 54 + TRANS_GRAD_OFFSET_Y) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_TRGR_START_VALUE - { - Pos = MAP_APPFONT ( 21 , 136 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "~Start value"; - }; - MetricField MTR_TRGR_START_VALUE - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_START_VALUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 134 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_TRGR_END_VALUE - { - Pos = MAP_APPFONT ( 21 , 152 ) ; - Size = MAP_APPFONT ( 41 , 8 ) ; - Text [ en-US ] = "~End value"; - }; - MetricField MTR_TRGR_END_VALUE - { - HelpID = "cui:MetricField:RID_SVXPAGE_TRANSPARENCE:MTR_TRGR_END_VALUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 150 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - Control CTL_BITMAP_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 138 , 14 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - }; - Control CTL_TRANS_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 138 , 14 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - }; - Text [ en-US ] = "Transparency"; -}; - - // RID_SVXPAGE_AREA ------------------------------------------------------ -TabPage RID_SVXPAGE_AREA -{ - Size = MAP_APPFONT ( 260 , 185 ) ; - HelpID = HID_AREA_AREA ; - Hide = TRUE ; - Text [ en-US ] = "Area" ; - - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 120, 8 ) ; - Text [ en-US ] = "Fill"; - }; - ListBox LB_AREA_TYPE - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_AREA_TYPE"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 108 , 60 ) ; - DropDown = TRUE; - Border = TRUE; - StringList [ en-US ] = - { - < "None" ; Default ; > ; - < "Color" ; Default ; > ; - < "Gradient" ; Default ; > ; - < "Hatching" ; Default ; > ; - < "Bitmap" ; Default ; > ; - }; - }; - - - ListBox LB_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 108 , 103 ) ; - TabStop = TRUE ; - }; - ListBox LB_GRADIENT - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_GRADIENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 108 , 103 ) ; - TabStop = TRUE ; - }; - ListBox LB_HATCHING - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_HATCHING"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 108 , 103 ) ; - TabStop = TRUE ; - }; - ListBox LB_BITMAP - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_BITMAP"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 30 ) ; - Size = MAP_APPFONT ( 108 , 103 ) ; - TabStop = TRUE ; - }; - - // ---------- preview ---------- - - Control CTL_COLOR_PREVIEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 137 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - }; - Control CTL_BITMAP_PREVIEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 12 , 137 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - Hide = TRUE ; - }; - - // ---------- for gradients ---------- - - FixedLine FL_STEPCOUNT - { - Pos = MAP_APPFONT ( 132 , 3 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Increments" ; - }; - TriStateBox TSB_STEPCOUNT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_AREA:TSB_STEPCOUNT"; - Pos = MAP_APPFONT ( 138 , 15 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "A~utomatic" ; - }; - NumericField NUM_FLD_STEPCOUNT - { - HelpID = "cui:NumericField:RID_SVXPAGE_AREA:NUM_FLD_STEPCOUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 208 , 14 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 3 ; - First = 3 ; - Maximum = 256 ; - Last = 256 ; - StrictFormat = TRUE ; - }; - - // ---------- for hatches ---------- - - CheckBox CB_HATCHBCKGRD - { - HelpID = "cui:CheckBox:RID_SVXPAGE_AREA:CB_HATCHBCKGRD"; - Pos = MAP_APPFONT ( 132 , 3 ) ; - Size = MAP_APPFONT ( 122 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Background color" ; - }; - ListBox LB_HATCHBCKGRDCOLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_AREA:LB_HATCHBCKGRDCOLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 141 , 16 ) ; - Size = MAP_APPFONT ( 70 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - - // ---------- for bitmaps ---------- - - FixedLine FL_SIZE - { - Pos = MAP_APPFONT ( 132 , 3 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - TriStateBox TSB_ORIGINAL - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_AREA:TSB_ORIGINAL"; - Pos = MAP_APPFONT ( 138 , 15 ) ; - Size = MAP_APPFONT ( 48 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - TriStateBox TSB_SCALE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_AREA:TSB_SCALE"; - Pos = MAP_APPFONT ( 138 , 30 ) ; - Size = MAP_APPFONT ( 48 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Re~lative" ; - }; - FixedText FT_X_SIZE - { - Pos = MAP_APPFONT ( 187 , 15 ) ; - Size = MAP_APPFONT ( 24 , 8 ) ; - Text [ en-US ] = "Wi~dth" ; - }; - MetricField MTR_FLD_X_SIZE - { - HelpID = "cui:MetricField:RID_SVXPAGE_AREA:MTR_FLD_X_SIZE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 212 , 14 ) ; - Size = MAP_APPFONT ( 36 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - CustomUnitText = "%" ; - Minimum = 5 ; - Maximum = 100 ; - First = 5 ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_Y_SIZE - { - Pos = MAP_APPFONT ( 187 , 31 ) ; - Size = MAP_APPFONT ( 24 , 8 ) ; - Text [ en-US ] = "H~eight" ; - }; - MetricField MTR_FLD_Y_SIZE - { - HelpID = "cui:MetricField:RID_SVXPAGE_AREA:MTR_FLD_Y_SIZE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 212 , 29 ) ; - Size = MAP_APPFONT ( 36 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - CustomUnitText = "%" ; - Minimum = 5 ; - Maximum = 100 ; - First = 5 ; - Last = 100 ; - SpinSize = 5 ; - SpinSize = 5 ; - }; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 132 , 47 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Position" ; - }; - - Control CTL_POSITION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 138 , 57 ) ; - Size = MAP_APPFONT ( 40 , 27 ) ; - TabStop = TRUE ; - }; - FixedText FT_X_OFFSET - { - Pos = MAP_APPFONT ( 138 , 89 ) ; - Size = MAP_APPFONT ( 39 , 8 ) ; - Text [ en-US ] = "~X Offset" ; - }; - FixedText FT_Y_OFFSET - { - Pos = MAP_APPFONT ( 139 , 104 ) ; - Size = MAP_APPFONT ( 78 , 8 ) ; - Text [ en-US ] = "~Y Offset" ; - }; - MetricField MTR_FLD_X_OFFSET - { - HelpID = "cui:MetricField:RID_SVXPAGE_AREA:MTR_FLD_X_OFFSET"; - Border = TRUE ; - Pos = MAP_APPFONT ( 219 , 87 ) ; - Size = MAP_APPFONT ( 29 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Maximum = 100 ; - Last = 100 ; - SpinSize = 5 ; - }; - MetricField MTR_FLD_Y_OFFSET - { - HelpID = "cui:MetricField:RID_SVXPAGE_AREA:MTR_FLD_Y_OFFSET"; - Border = TRUE ; - Pos = MAP_APPFONT ( 219 , 102 ) ; - Size = MAP_APPFONT ( 29 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - TriStateBox TSB_TILE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_AREA:TSB_TILE"; - Pos = MAP_APPFONT ( 138 , 117 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Tile" ; - }; - TriStateBox TSB_STRETCH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_AREA:TSB_STRETCH"; - Pos = MAP_APPFONT ( 194 , 117 ) ; - Size = MAP_APPFONT ( 54 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Auto~Fit" ; - }; - FixedLine FL_OFFSET - { - Pos = MAP_APPFONT ( 132 , 133 ) ; - Size = MAP_APPFONT ( 122 , 8 ) ; - Text [ en-US ] = "Offset" ; - }; - RadioButton RBT_ROW - { - HelpID = "cui:RadioButton:RID_SVXPAGE_AREA:RBT_ROW"; - Pos = MAP_APPFONT ( 138 , 144 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "Ro~w" ; - }; - RadioButton RBT_COLUMN - { - HelpID = "cui:RadioButton:RID_SVXPAGE_AREA:RBT_COLUMN"; - Pos = MAP_APPFONT ( 138 , 158 ) ; - Size = MAP_APPFONT ( 75 , 10 ) ; - Text [ en-US ] = "Colu~mn" ; - }; - MetricField MTR_FLD_OFFSET - { - HelpID = "cui:MetricField:RID_SVXPAGE_AREA:MTR_FLD_OFFSET"; - Border = TRUE ; - Pos = MAP_APPFONT ( 219 , 157 ) ; - Size = MAP_APPFONT ( 29 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; -}; - // RID_SVXPAGE_SHADOW ------------------------------------------------------ -TabPage RID_SVXPAGE_SHADOW -{ - HelpID = HID_AREA_SHADOW ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Shadow" ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - TriStateBox TSB_SHOW_SHADOW - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_SHADOW:TSB_SHOW_SHADOW"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 110 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Use shadow"; - }; - FixedText FT_POSITION - { - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - Text [ en-US ] = "~Position"; - }; - Control CTL_POSITION - { - HelpId = HID_TPSHADOW_CTRL ; - Pos = MAP_APPFONT ( 65 , 31 ) ; - Size = MAP_APPFONT ( 57 , 29 ) ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_DISTANCE - { - Pos = MAP_APPFONT ( 12 , 69 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Distance"; - }; - MetricField MTR_FLD_DISTANCE - { - HelpID = "cui:MetricField:RID_SVXPAGE_SHADOW:MTR_FLD_DISTANCE"; - Pos = MAP_APPFONT ( 65 , 67 ) ; - Size = MAP_APPFONT ( 47 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99999 ; - Minimum = 0 ; // #i33700# - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Last = 99999 ; - /*SpinSize = 100 ; */ - SpinSize = 1 ; - }; - ListBox LB_SHADOW_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_SHADOW:LB_SHADOW_COLOR"; - Pos = MAP_APPFONT ( 65 , 86 ) ; - Size = MAP_APPFONT ( 57 , 100 ) ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - Border = TRUE ; - TabStop = TRUE ; - }; - FixedText FT_SHADOW_COLOR - { - Pos = MAP_APPFONT ( 12 , 88 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Color" ; - }; - FixedText FT_TRANSPARENT - { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Transparency"; - }; - MetricField MTR_SHADOW_TRANSPARENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_SHADOW:MTR_SHADOW_TRANSPARENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 65 , 105 ) ; - Size = MAP_APPFONT ( 47 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - Control CTL_COLOR_PREVIEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 138 , 14 ) ; - Size = MAP_APPFONT ( 110 , 42 ) ; - TabStop = FALSE ; - }; -}; - // RID_SVXPAGE_HATCH -------------------------------------------------------- -TabPage RID_SVXPAGE_HATCH -{ - HelpID = HID_AREA_HATCH ; - Hide = TRUE ; - Text [ en-US ] = "Hatching" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - FixedText FT_LINE_DISTANCE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 78 , 8 ) ; - Text [ en-US ] = "~Spacing" ; - }; - MetricField MTR_FLD_DISTANCE - { - HelpID = "cui:MetricField:RID_SVXPAGE_HATCH:MTR_FLD_DISTANCE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 30 ; - Maximum = 9999 ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 30 ; - Last = 9999 ; - SpinSize = 100 ; - }; - FixedText FT_LINE_ANGLE - { - Pos = MAP_APPFONT ( 12 , 41 ) ; - Size = MAP_APPFONT ( 78 , 8 ) ; - Text [ en-US ] = "A~ngle" ; - }; - MetricField MTR_FLD_ANGLE - { - HelpID = "cui:MetricField:RID_SVXPAGE_HATCH:MTR_FLD_ANGLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 52 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 359 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " degrees" ; - Last = 359 ; - SpinSize = 15 ; - }; - Control CTL_ANGLE - { - HelpId = HID_TPHATCH_CTRL ; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 72 ) ; - Size = MAP_APPFONT ( 39 , 39 ) ; - TabStop = TRUE ; - }; - FixedText FT_LINE_TYPE - { - Pos = MAP_APPFONT ( 12 , 123 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Line type" ; - }; - ListBox LB_LINE_TYPE - { - HelpID = "cui:ListBox:RID_SVXPAGE_HATCH:LB_LINE_TYPE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 134 ) ; - Size = MAP_APPFONT ( 62 , 62 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Single" ; Default ; > ; - < "Crossed" ; Default ; > ; - < "Triple" ; Default ; > ; - }; - }; - FixedText FT_LINE_COLOR - { - Pos = MAP_APPFONT ( 12 , 150 ) ; - Size = MAP_APPFONT ( 49 , 8 ) ; - Text [ en-US ] = "Line ~color" ; - }; - ListBox LB_LINE_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_HATCH:LB_LINE_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 161 ) ; - Size = MAP_APPFONT ( 62 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - ListBox LB_HATCHINGS - { - HelpID = "cui:ListBox:RID_SVXPAGE_HATCH:LB_HATCHINGS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 14 ) ; - Size = MAP_APPFONT ( 88 , 110 ) ; - TabStop = TRUE ; - }; - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 131 ) ; - Size = MAP_APPFONT ( 88 , 42 ) ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_HATCH:BTN_ADD"; - Pos = MAP_APPFONT ( 197 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_HATCH:BTN_MODIFY"; - Pos = MAP_APPFONT ( 197 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_HATCH:BTN_DELETE"; - Pos = MAP_APPFONT ( 197 , 68 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HATCH:BTN_LOAD"; - Pos = MAP_APPFONT ( 197 , 104 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Hatches List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_HATCH:BTN_SAVE"; - Pos = MAP_APPFONT ( 197 , 124 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Hatches List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; -}; - // RID_SVXPAGE_BITMAP ------------------------------------------------------- -TabPage RID_SVXPAGE_BITMAP -{ - HelpID = HID_AREA_BITMAP ; - Hide = TRUE ; - Text [ en-US ] = "Bitmap Patterns" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - FixedText FT_PIXEL_EDIT - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 85 , 8 ) ; - Text [ en-US ] = "Pattern Editor"; - }; - Control CTL_PIXEL - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 72 , 72 ) ; - TabStop = TRUE ; - }; - FixedText FT_COLOR - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 85 , 8 ) ; - Text [ en-US ] = "~Foreground color"; - }; - ListBox LB_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_BITMAP:LB_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 115 ) ; - Size = MAP_APPFONT ( 62 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_BACKGROUND_COLOR - { - Pos = MAP_APPFONT ( 12 , 131 ) ; - Size = MAP_APPFONT ( 85 , 8 ) ; - Text [ en-US ] = "~Background color"; - }; - ListBox LB_BACKGROUND_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_BITMAP:LB_BACKGROUND_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 142 ) ; - Size = MAP_APPFONT ( 62 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_BITMAPS_HIDDEN - { - // Hidden label that provides the name for the bitmaps list box. - Text [ en-US ] = "Bitmap"; - }; - ListBox LB_BITMAPS - { - HelpID = "cui:ListBox:RID_SVXPAGE_BITMAP:LB_BITMAPS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 14 ) ; - Size = MAP_APPFONT ( 88 , 110 ) ; - TabStop = TRUE ; - }; - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 131 ) ; - Size = MAP_APPFONT ( 88 , 42 ) ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_BITMAP:BTN_ADD"; - Pos = MAP_APPFONT ( 197 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_BITMAP:BTN_MODIFY"; - Pos = MAP_APPFONT ( 197 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - TabStop = TRUE ; - }; - PushButton BTN_IMPORT - { - HelpID = "cui:PushButton:RID_SVXPAGE_BITMAP:BTN_IMPORT"; - Pos = MAP_APPFONT ( 197 , 50 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Import..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_BITMAP:BTN_DELETE"; - Pos = MAP_APPFONT ( 197 , 68 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_BITMAP:BTN_LOAD"; - Pos = MAP_APPFONT ( 197 , 104 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Bitmap List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_BITMAP:BTN_SAVE"; - Pos = MAP_APPFONT ( 197 , 124 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Bitmap List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; -}; - // RID_SVXPAGE_GRADIENT ----------------------------------------------------- -TabPage RID_SVXPAGE_GRADIENT -{ - HelpID = HID_AREA_GRADIENT ; - Hide = TRUE ; - Text [ en-US ] = "Gradients" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 26 , 8 ) ; - Text [ en-US ] = "Ty~pe" ; - }; - ListBox LB_GRADIENT_TYPES - { - HelpID = "cui:ListBox:RID_SVXPAGE_GRADIENT:LB_GRADIENT_TYPES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 14 ) ; - Size = MAP_APPFONT ( 48, 63 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Linear" ; Default ; > ; - < "Axial" ; Default ; > ; - < "Radial" ; Default ; > ; - < "Ellipsoid" ; Default ; > ; - < "Square" ; Default ; > ; - < "Rectangular" ; Default ; > ; - }; - }; - FixedText FT_CENTER_X - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 37 , 8 ) ; - Text [ en-US ] = "Center ~X" ; - }; - MetricField MTR_CENTER_X - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_CENTER_X"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 30 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_CENTER_Y - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 37 , 8 ) ; - Text [ en-US ] = "Center ~Y" ; - }; - MetricField MTR_CENTER_Y - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_CENTER_Y"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 46 ) ; - Size = MAP_APPFONT ( 40, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_ANGLE - { - Pos = MAP_APPFONT ( 12 , 64 ) ; - Size = MAP_APPFONT ( 37 , 8 ) ; - Text [ en-US ] = "A~ngle" ; - }; - MetricField MTR_ANGLE - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_ANGLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 62 ) ; - Size = MAP_APPFONT ( 40, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 359 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " degrees" ; - Last = 359 ; - SpinSize = 15 ; - }; - FixedText FT_BORDER - { - Pos = MAP_APPFONT ( 12 , 80 ) ; - Size = MAP_APPFONT ( 32 , 8 ) ; - Text [ en-US ] = "~Border" ; - }; - MetricField MTR_BORDER - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_BORDER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 78 ) ; - Size = MAP_APPFONT ( 40, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_COLOR_FROM - { - Pos = MAP_APPFONT ( 12 , 99 ) ; - Size = MAP_APPFONT ( 32 , 8 ) ; - Text [ en-US ] = "~From" ; - }; - ListBox LB_COLOR_FROM - { - HelpID = "cui:ListBox:RID_SVXPAGE_GRADIENT:LB_COLOR_FROM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 97 ) ; - Size = MAP_APPFONT ( 48, 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - MetricField MTR_COLOR_FROM - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_COLOR_FROM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 113 ) ; - Size = MAP_APPFONT ( 40, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedText FT_COLOR_TO - { - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 32 , 8 ) ; - Text [ en-US ] = "~To" ; - }; - ListBox LB_COLOR_TO - { - HelpID = "cui:ListBox:RID_SVXPAGE_GRADIENT:LB_COLOR_TO"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 131 ) ; - Size = MAP_APPFONT ( 48, 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - MetricField MTR_COLOR_TO - { - HelpID = "cui:MetricField:RID_SVXPAGE_GRADIENT:MTR_COLOR_TO"; - Border = TRUE ; - Pos = MAP_APPFONT ( 49 , 147 ) ; - Size = MAP_APPFONT ( 40, 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - ListBox LB_GRADIENTS - { - HelpID = "cui:ListBox:RID_SVXPAGE_GRADIENT:LB_GRADIENTS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 103 , 14 ) ; - Size = MAP_APPFONT ( 88 , 110 ) ; - TabStop = TRUE ; - }; - Control CTL_PREVIEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 103 , 131 ) ; - Size = MAP_APPFONT ( 88 , 42 ) ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_GRADIENT:BTN_ADD"; - Pos = MAP_APPFONT ( 197 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_GRADIENT:BTN_MODIFY"; - Pos = MAP_APPFONT ( 197 , 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_GRADIENT:BTN_DELETE"; - Pos = MAP_APPFONT ( 197 , 68 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_GRADIENT:BTN_LOAD"; - Pos = MAP_APPFONT ( 197 , 104 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Gradients List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_GRADIENT:BTN_SAVE"; - Pos = MAP_APPFONT ( 197 , 124 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Gradients List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; -}; - // RID_SVXPAGE_COLOR -------------------------------------------------------- -TabPage RID_SVXPAGE_COLOR -{ - HelpId = HID_OPTIONS_COLOR ; - Hide = TRUE ; - Text [ en-US ] = "Colors" ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_PROP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248, 8 ) ; - Text [ en-US ] = "Properties"; - }; - FixedText FT_NAME - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "~Name" ; - }; - Edit EDT_NAME - { - HelpID = "cui:Edit:RID_SVXPAGE_COLOR:EDT_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 14 ) ; - Size = MAP_APPFONT ( 76 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_COLOR - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 28 , 8 ) ; - Text [ en-US ] = "C~olor" ; - }; - ListBox LB_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_COLOR:LB_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 30 ) ; - Size = MAP_APPFONT ( 76 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - - FixedText FT_TABLE_NAME - { - Pos = MAP_APPFONT ( 42 , 48 ) ; - Size = MAP_APPFONT ( 94 , 8 ) ; - Text [ en-US ] = "Color table" ; - }; - Control CTL_COLORTABLE - { - Border = TRUE ; - Hide = TRUE ; - Pos = MAP_APPFONT ( 42 , 59 ) ; - Size = MAP_APPFONT ( 94 , 117 ) ; - TabStop = TRUE ; - }; - - Control CTL_PREVIEW_OLD - { - Border = TRUE; - Pos = MAP_APPFONT ( 157 , 14 ) ; - Size = MAP_APPFONT ( 34 , 25 ) ; - }; - Control CTL_PREVIEW_NEW - { - Border = TRUE; - Pos = MAP_APPFONT ( 157, 39 ) ; - Size = MAP_APPFONT ( 34 , 25 ) ; - }; - ListBox LB_COLORMODEL - { - HelpID = "cui:ListBox:RID_SVXPAGE_COLOR:LB_COLORMODEL"; - Border = TRUE ; - Pos = MAP_APPFONT ( 157 , 71 ) ; - Size = MAP_APPFONT ( 34 , 12 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "RGB" ; Default ; > ; - < "CMYK" ; Default ; > ; - }; - }; - FixedText FT_1 - { - Pos = MAP_APPFONT ( 142 , 89 ) ; - Size = MAP_APPFONT ( 15 , 8 ) ; - Text = "~C" ; - }; - MetricField MTR_FLD_1 - { - HelpID = "cui:MetricField:RID_SVXPAGE_COLOR:MTR_FLD_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 157 , 87 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - }; - FixedText FT_2 - { - Pos = MAP_APPFONT ( 142 , 105 ) ; - Size = MAP_APPFONT ( 15 , 8 ) ; - Text = "~M" ; - }; - MetricField MTR_FLD_2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_COLOR:MTR_FLD_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 157 , 103 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - }; - FixedText FT_3 - { - Pos = MAP_APPFONT ( 142 , 121 ) ; - Size = MAP_APPFONT ( 15 , 8 ) ; - Text = "~Y" ; - }; - MetricField MTR_FLD_3 - { - HelpID = "cui:MetricField:RID_SVXPAGE_COLOR:MTR_FLD_3"; - Border = TRUE ; - Pos = MAP_APPFONT ( 157 , 119 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - }; - FixedText FT_4 - { - Pos = MAP_APPFONT ( 142 , 137 ) ; - Size = MAP_APPFONT ( 15 , 8 ) ; - Text = "~K" ; - }; - MetricField MTR_FLD_4 - { - HelpID = "cui:MetricField:RID_SVXPAGE_COLOR:MTR_FLD_4"; - Border = TRUE ; - Pos = MAP_APPFONT ( 157 , 135 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLOR:BTN_ADD"; - Pos = MAP_APPFONT ( 197 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add" ; - TabStop = TRUE ; - }; - PushButton BTN_WORK_ON - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLOR:BTN_WORK_ON"; - Pos = MAP_APPFONT ( 197 , 50 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Edit..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLOR:BTN_DELETE"; - Pos = MAP_APPFONT ( 197 , 68 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_COLOR:BTN_MODIFY"; - Pos = MAP_APPFONT ( 197, 32 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify" ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_COLOR:BTN_LOAD"; - Pos = MAP_APPFONT ( 197 , 104 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Color List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_COLOR:BTN_SAVE"; - Pos = MAP_APPFONT ( 197 , 124 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Color List" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; -}; - // RID_SVXDLG_AREA ---------------------------------------------------------- -TabDialog RID_SVXDLG_AREA -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 289 , 176 ) ; - Text [ en-US ] = "Area" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_AREA ; - Text [ en-US ] = "Area" ; - PageResID = RID_SVXPAGE_AREA ; - }; - PageItem - { - Identifier = RID_SVXPAGE_SHADOW ; - PageResID = RID_SVXPAGE_SHADOW ; - Text [ en-US ] = "Shadow" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_TRANSPARENCE ; - Text [ en-US ] = "Transparency"; - }; - PageItem - { - Identifier = RID_SVXPAGE_COLOR ; - Text [ en-US ] = "Colors" ; - PageResID = RID_SVXPAGE_COLOR ; - }; - PageItem - { - Identifier = RID_SVXPAGE_GRADIENT ; - Text [ en-US ] = "Gradients" ; - PageResID = RID_SVXPAGE_GRADIENT ; - }; - PageItem - { - Identifier = RID_SVXPAGE_HATCH ; - Text [ en-US ] = "Hatching" ; - PageResID = RID_SVXPAGE_HATCH ; - }; - PageItem - { - Identifier = RID_SVXPAGE_BITMAP ; - Text [ en-US ] = "Bitmaps" ; - PageResID = RID_SVXPAGE_BITMAP ; - }; - }; - }; -}; - -String STR_LB_HATCHINGSTYLE -{ - Text [ en-US ] = "Hatching Style" ; -}; - -String STR_CUI_COLORMODEL -{ - Text [ en-US ] = "Color Mode" ; -}; - diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx deleted file mode 100644 index 550cff4d7..000000000 --- a/cui/source/tabpages/tabline.cxx +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#define _SVX_TABLINE_CXX -#include -#include "tabline.hrc" - -#include "cuitabarea.hxx" -#include "cuitabline.hxx" -#include "dlgname.hxx" -#include -#include -#include -#include "svx/drawitem.hxx" - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 -#define XOUT_WIDTH 150 - -/************************************************************************* -|* -|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu -|* -\************************************************************************/ - -SvxLineTabDialog::SvxLineTabDialog -( - Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - const SdrObject* pSdrObj, - sal_Bool bHasObj -) : - - SfxTabDialog ( pParent, CUI_RES( RID_SVXDLG_LINE ), pAttr ), - pDrawModel ( pModel ), - pObj ( pSdrObj ), - rOutAttrs ( *pAttr ), - pColorTab ( pModel->GetColorTable() ), - mpNewColorTab ( pModel->GetColorTable() ), - pDashList ( pModel->GetDashList() ), - pNewDashList ( pModel->GetDashList() ), - pLineEndList ( pModel->GetLineEndList() ), - pNewLineEndList ( pModel->GetLineEndList() ), - bObjSelected ( bHasObj ), - nLineEndListState( CT_NONE ), - nDashListState( CT_NONE ), - mnColorTableState( CT_NONE ), - nPageType( 0 ), // wird hier in erster Linie benutzt, um mit FillItemSet - // die richtigen Attribute zu erhalten ( noch Fragen? ) - nDlgType( 0 ), - nPosDashLb( 0 ), - nPosLineEndLb( 0 ), - mnPos( 0 ), - mbAreaTP( sal_False ), - mbDeleteColorTable( sal_True ) -{ - FreeResource(); - - bool bLineOnly = false; - if( pObj && pObj->GetObjInventor() == SdrInventor ) - { - switch( pObj->GetObjIdentifier() ) - { - case OBJ_LINE: - case OBJ_PLIN: - case OBJ_PATHLINE: - case OBJ_FREELINE: - case OBJ_MEASURE: - case OBJ_EDGE: - bLineOnly = true; - - default: - break; - } - - } - - AddTabPage( RID_SVXPAGE_LINE, SvxLineTabPage::Create, 0); - if( bLineOnly ) - AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 ); - else - RemoveTabPage( RID_SVXPAGE_SHADOW ); - - AddTabPage( RID_SVXPAGE_LINE_DEF, SvxLineDefTabPage::Create, 0); - AddTabPage( RID_SVXPAGE_LINEEND_DEF, SvxLineEndDefTabPage::Create, 0); - - SetCurPageId( RID_SVXPAGE_LINE ); - - CancelButton& rBtnCancel = GetCancelButton(); - rBtnCancel.SetClickHdl( LINK( this, SvxLineTabDialog, CancelHdlImpl ) ); -} - -// ----------------------------------------------------------------------- - -SvxLineTabDialog::~SvxLineTabDialog() -{ -} - -// ----------------------------------------------------------------------- - -void SvxLineTabDialog::SavePalettes() -{ - SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != pDrawModel->GetColorTable() ) - { - if(mbDeleteColorTable) - delete pDrawModel->GetColorTable(); - pDrawModel->SetColorTable( mpNewColorTab ); - if ( pShell ) - pShell->PutItem( SvxColorTableItem( mpNewColorTab, SID_COLOR_TABLE ) ); - pColorTab = pDrawModel->GetColorTable(); - } - if( pNewDashList != pDrawModel->GetDashList() ) - { - delete pDrawModel->GetDashList(); - pDrawModel->SetDashList( pNewDashList ); - if ( pShell ) - pShell->PutItem( SvxDashListItem( pNewDashList, SID_DASH_LIST ) ); - pDashList = pDrawModel->GetDashList(); - } - if( pNewLineEndList != pDrawModel->GetLineEndList() ) - { - delete pDrawModel->GetLineEndList(); - pDrawModel->SetLineEndList( pNewLineEndList ); - if ( pShell ) - pShell->PutItem( SvxLineEndListItem( pNewLineEndList, SID_LINEEND_LIST ) ); - pLineEndList = pDrawModel->GetLineEndList(); - } - - // Speichern der Tabellen, wenn sie geaendert wurden. - - const String aPath( SvtPathOptions().GetPalettePath() ); - - if( nDashListState & CT_MODIFIED ) - { - pDashList->SetPath( aPath ); - pDashList->Save(); - - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( SvxDashListItem( pDashList, SID_DASH_LIST ) ); - } - - if( nLineEndListState & CT_MODIFIED ) - { - pLineEndList->SetPath( aPath ); - pLineEndList->Save(); - - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( SvxLineEndListItem( pLineEndList, SID_LINEEND_LIST ) ); - } - - if( mnColorTableState & CT_MODIFIED ) - { - pColorTab->SetPath( aPath ); - pColorTab->Save(); - - // ToolBoxControls werden benachrichtigt: - if ( pShell ) - pShell->PutItem( SvxColorTableItem( pColorTab, SID_COLOR_TABLE ) ); - } -} - -// ----------------------------------------------------------------------- - -short SvxLineTabDialog::Ok() -{ - SavePalettes(); - - // Es wird RET_OK zurueckgeliefert, wenn wenigstens eine - // TabPage in FillItemSet() sal_True zurueckliefert. Dieses - // geschieht z.Z. standardmaessig. - return( SfxTabDialog::Ok() ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG ) -{ - SavePalettes(); - - EndDialog( RET_CANCEL ); - return 0; -} -IMPL_LINK_INLINE_END( SvxLineTabDialog, CancelHdlImpl, void *, EMPTYARG ) - -// ----------------------------------------------------------------------- - -void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - switch( nId ) - { - case RID_SVXPAGE_LINE: - ( (SvxLineTabPage&) rPage ).SetColorTable( pColorTab ); - ( (SvxLineTabPage&) rPage ).SetDashList( pDashList ); - ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList ); - ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType ); - ( (SvxLineTabPage&) rPage ).SetPageType( nPageType ); - ( (SvxLineTabPage&) rPage ).SetPosDashLb( &nPosDashLb ); - ( (SvxLineTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb ); - ( (SvxLineTabPage&) rPage ).SetDashChgd( &nDashListState ); - ( (SvxLineTabPage&) rPage ).SetLineEndChgd( &nLineEndListState ); - ( (SvxLineTabPage&) rPage ).SetObjSelected( bObjSelected ); - ( (SvxLineTabPage&) rPage ).Construct(); - ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - // ActivatePage() wird das erste mal nicht gerufen - ( (SvxLineTabPage&) rPage ).ActivatePage( rOutAttrs ); - break; - - case RID_SVXPAGE_LINE_DEF: - ( (SvxLineDefTabPage&) rPage ).SetDashList( pDashList ); - ( (SvxLineDefTabPage&) rPage ).SetDlgType( &nDlgType ); - ( (SvxLineDefTabPage&) rPage ).SetPageType( &nPageType ); - ( (SvxLineDefTabPage&) rPage ).SetPosDashLb( &nPosDashLb ); - ( (SvxLineDefTabPage&) rPage ).SetDashChgd( &nDashListState ); - ( (SvxLineDefTabPage&) rPage ).SetObjSelected( bObjSelected ); - ( (SvxLineDefTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_LINEEND_DEF: - ( (SvxLineEndDefTabPage&) rPage ).SetLineEndList( pLineEndList ); - ( (SvxLineEndDefTabPage&) rPage ).SetPolyObj( pObj ); - ( (SvxLineEndDefTabPage&) rPage ).SetDlgType( &nDlgType ); - ( (SvxLineEndDefTabPage&) rPage ).SetPageType( &nPageType ); - ( (SvxLineEndDefTabPage&) rPage ).SetPosLineEndLb( &nPosLineEndLb ); - ( (SvxLineEndDefTabPage&) rPage ).SetLineEndChgd( &nLineEndListState ); - ( (SvxLineEndDefTabPage&) rPage ).SetObjSelected( bObjSelected ); - ( (SvxLineEndDefTabPage&) rPage ).Construct(); - break; - - case RID_SVXPAGE_SHADOW: - { - ( (SvxShadowTabPage&) rPage ).SetColorTable( pColorTab ); - ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType ); - ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType ); - ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); - ( (SvxShadowTabPage&) rPage ).Construct(); - } - break; - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tabline.hrc b/cui/source/tabpages/tabline.hrc deleted file mode 100644 index 15d6db12c..000000000 --- a/cui/source/tabpages/tabline.hrc +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define TAB_CONTROL 1 -#define LB_COLOR 1 -#define FT_COLOR 1 -#define LB_LINE_STYLE 2 -#define FT_LINE_STYLE 3 -#define FT_LINE_WIDTH 2 -#define MTR_FLD_LINE_WIDTH 1 -#define TSB_INVISIBLE 1 -#define FL_LINE 1 -#define FL_LINE_ENDS 2 -#define FT_LINE_START 4 -#define FT_LINE_END 8 -#define FT_LINE_ENDS_STYLE 5 -#define FT_LINE_ENDS_WIDTH 6 -#define LB_START_STYLE 3 -#define LB_END_STYLE 4 -//IAccessibility2 Impplementaton 2009----- -#define STR_STYLE (LB_END_STYLE+1) -#define STR_LB_START_STYLE 30 -#define STR_LB_END_STYLE 31 -#define STR_MTR_FLD_START_WIDTH 32 -#define STR_MTR_FLD_END_WIDTH 33 -#define STR_CENTER_START 34 -#define STR_CENTER_END 35 -#define STR_START_TYPE 36 -#define STR_END_TYPE 37 -#define STR_START_NUM 38 -#define STR_END_NUM 39 -#define STR_START_LENGTH 40 -#define STR_END_LENGTH 41 -//-----IAccessibility2 Impplementaton 2009 -#define MTR_FLD_START_WIDTH 3 -#define MTR_FLD_END_WIDTH 2 -#define CBX_SYNCHRONIZE 1 -#define FL_MEASURING 3 -#define CTL_POSITION 2 -#define FT_POSITION 9 -#define TSB_SHOW_MEASURING 2 -#define CTL_PREVIEW 1 -#define FL_DEFINITION 1 -#define FT_NUMBER 3 -#define FT_DISTANCE 2 -#define FT_LENGTH 4 -#define TSB_SYNCHRONIZE 3 -#define LB_TYPE_1 3 -#define FT_TYPE 1 -#define LB_TYPE_2 1 -#define NUM_FLD_1 1 -#define NUM_FLD_2 2 -#define MTR_FLD_DISTANCE 1 -#define MTR_FLD_LENGTH_1 3 -#define MTR_FLD_LENGTH_2 4 -#define FT_LINESTYLE 10 -#define LB_LINESTYLES 2 -#define BTN_ADD 1 -#define BTN_MODIFY 2 -#define BTN_DELETE 3 -#define BTN_LOAD 5 -#define BTN_SAVE 6 -#define EDT_NAME 1 -#define LB_LINEENDS 1 -#define FL_TIP 1 -#define FI_TIP 10 -#define TSB_CENTER_START 4 -#define TSB_CENTER_END 5 -#define FT_TRANSPARENT 10 -#define MTR_LINE_TRANSPARENT 5 -#define FL_SEPARATOR 4 -#define FT_LINE_END_STYLE 11 -#define FT_TITLE 12 - -// #116827# -#define FL_EDGE_STYLE 5 -#define FT_EDGE_STYLE 13 -#define LB_EDGE_STYLE 5 - -//Symbole (fuer StarChart) -#define FT_SYMBOL_WIDTH 20 -#define FT_SYMBOL_HEIGHT 21 -#define MF_SYMBOL_WIDTH 22 -#define MF_SYMBOL_HEIGHT 23 -#define CB_SYMBOL_RATIO 24 -#define FL_SYMBOL_FORMAT 25 -#define MB_SYMBOL_BITMAP 26 - - -#define MN_GRAPHIC_DLG 1 -#define MN_GALLERY 2 -#define MN_SYMBOLS 3 -#define MN_SYMBOLS_NONE 4 -#define MN_SYMBOLS_AUTO 5 -#define MN_GALLERY_ENTRY 100 - -/* -//IAccessibility2 Implementation 2009----- -#define STR_START_TYPE 1 -#define STR_END_TYPE 2 -#define STR_START_NUM 3 -#define STR_END_NUM 4 -#define STR_START_LENGTH 5 -#define STR_END_LENGTH 6 -//-----IAccessibility2 Implementation 2009 -*/ diff --git a/cui/source/tabpages/tabline.src b/cui/source/tabpages/tabline.src deleted file mode 100644 index ccb482fa8..000000000 --- a/cui/source/tabpages/tabline.src +++ /dev/null @@ -1,890 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include -#include "helpid.hrc" -#include "tabline.hrc" -#include - -// Selecting LineStyle / Color / Width -------------------- - -#define MASKCOLOR MaskColor = Color{ Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - - -TabPage RID_SVXPAGE_LINE -{ - Size = MAP_APPFONT ( 260 , 185 ); - HelpId = HID_LINE_LINE ; - Hide = TRUE ; - Text [ en-US ] = "Lines" ; - FixedLine FL_LINE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 112 , 8 ) ; - Text [ en-US ] = "Line properties" ; - }; - FixedText FT_LINE_STYLE - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "~Style" ; - }; - ListBox LB_LINE_STYLE - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_LINE_STYLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_COLOR - { - Pos = MAP_APPFONT ( 12 , 41 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Colo~r" ; - }; - ListBox LB_COLOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_COLOR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 52 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_LINE_WIDTH - { - Pos = MAP_APPFONT ( 12 , 68 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "~Width" ; - }; - MetricField MTR_FLD_LINE_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MTR_FLD_LINE_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 79 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - Last = 5000 ; - SpinSize = 10 ; - }; - FixedText FT_TRANSPARENT - { - Pos = MAP_APPFONT ( 12 , 95 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "~Transparency" ; - }; - MetricField MTR_LINE_TRANSPARENT - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MTR_LINE_TRANSPARENT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 106 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = "%" ; - Last = 100 ; - SpinSize = 5 ; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 6 , 111 ) ; - Vert = TRUE; - }; - FixedLine FL_LINE_ENDS - { - Pos = MAP_APPFONT ( 124 , 3 ) ; - Size = MAP_APPFONT ( 130 , 8 ) ; - Text [ en-US ] = "Arrow styles" ; - }; - FixedText FT_LINE_ENDS_STYLE - { - Pos = MAP_APPFONT ( 130 , 14 ) ; - Size = MAP_APPFONT ( 118 , 8 ) ; - Text [ en-US ] = "St~yle" ; - }; - ListBox LB_START_STYLE - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_START_STYLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 130 , 25 ) ; - Size = MAP_APPFONT ( 57 , 99 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - ListBox LB_END_STYLE - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_END_STYLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 191 , 25 ) ; - Size = MAP_APPFONT ( 57 , 100 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - FixedText FT_LINE_ENDS_WIDTH - { - Pos = MAP_APPFONT ( 130 , 41 ) ; - Size = MAP_APPFONT ( 118 , 8 ) ; - Text [ en-US ] = "Wi~dth" ; - }; - MetricField MTR_FLD_START_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MTR_FLD_START_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 130 , 52 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - Last = 5000 ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_END_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MTR_FLD_END_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 191 , 52 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - Last = 5000 ; - SpinSize = 10 ; - }; - TriStateBox TSB_CENTER_START - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_LINE:TSB_CENTER_START"; - Pos = MAP_APPFONT ( 130 , 68 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "Ce~nter" ; - TabStop = TRUE ; - }; - TriStateBox TSB_CENTER_END - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_LINE:TSB_CENTER_END"; - Pos = MAP_APPFONT ( 191 , 68 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "C~enter" ; - TabStop = TRUE ; - }; - CheckBox CBX_SYNCHRONIZE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_LINE:CBX_SYNCHRONIZE"; - // #116827# - // Pos = MAP_APPFONT ( 130 , 107 ) ; - Pos = MAP_APPFONT ( 130 , 68 + (16 - 4) ) ; - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Synchroni~ze ends" ; - TabStop = TRUE ; - }; - - ////////////////////////////////////////////////////////////////////////////// - // #116827# - - FixedLine FL_EDGE_STYLE - { - Pos = MAP_APPFONT ( 124 , 3 + (16 * 6) - 4 ) ; - Size = MAP_APPFONT ( 130 , 8 ) ; - Text [ en-US ] = "Corner style" ; - }; - FixedText FT_EDGE_STYLE - { - Pos = MAP_APPFONT ( 130 , 14 + (16 * 6) - 4 ) ; - Size = MAP_APPFONT ( 118 , 8 ) ; - Text [ en-US ] = "Sty~le" ; - }; - ListBox LB_EDGE_STYLE - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE:LB_EDGE_STYLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 130 , 25 + (16 * 6) - 4 ) ; - Size = MAP_APPFONT ( 57 , 99 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Rounded" ; Default ; > ; - < "- none -" ; > ; - < "Mitered" ; > ; - < "Beveled" ; > ; - }; - }; - - ////////////////////////////////////////////////////////////////////////////// - - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 135 ) ; - Size = MAP_APPFONT ( 248 , 40 ) ; - }; - - //#58425# Symbole auf einer Linie (z.B. StarChart) -> - FixedLine FL_SYMBOL_FORMAT - { - Hide = TRUE ; - - Pos = MAP_APPFONT ( 124 , 3 ) ; - Size = MAP_APPFONT ( 130 , 8 ) ; - Text [ en-US ] = "Icon"; - }; - - MenuButton MB_SYMBOL_BITMAP - { - HelpID = "cui:MenuButton:RID_SVXPAGE_LINE:MB_SYMBOL_BITMAP"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 130 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - ButtonMenu = Menu - { - ItemList = - { - MenuItem - { - Identifier = MN_SYMBOLS_NONE; - Text [ en-US ] = "No Symbol"; - }; - MenuItem - { - Identifier = MN_SYMBOLS_AUTO; - Text [ en-US ] = "Automatic"; - }; - MenuItem - { - Identifier = MN_GRAPHIC_DLG ; - Text [ en-US ] = "From file..." ; - }; - MenuItem - { - Identifier = MN_GALLERY ; - Text [ en-US ] = "Gallery"; - }; - MenuItem - { - Identifier = MN_SYMBOLS; - Text [ en-US ] = "Symbols"; - }; - }; - }; - Text [ en-US ] = "Select..." ; - }; - FixedText FT_SYMBOL_WIDTH - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 130 , 32 ) ; - Size = MAP_APPFONT ( 57 , 8 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MF_SYMBOL_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MF_SYMBOL_WIDTH"; - Pos = MAP_APPFONT ( 191 , 30 ); - Size = MAP_APPFONT ( 57 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Hide = TRUE ; - }; - FixedText FT_SYMBOL_HEIGHT - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 130 , 48 ) ; - Size = MAP_APPFONT ( 57 , 8 ) ; - Text [ en-US ] = "Height" ; - }; - MetricField MF_SYMBOL_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE:MF_SYMBOL_HEIGHT"; - Pos = MAP_APPFONT ( 191 , 46 ); - Size = MAP_APPFONT ( 57 , 12 ) ; - Border = TRUE ; - TabStop = TRUE ; - Left = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 1999 ; - DecimalDigits = 2 ; - Value = 0 ; - Unit = FUNIT_CM ; - First = 0 ; - Last = 1999 ; - SpinSize = 5 ; - Hide = TRUE ; - }; - CheckBox CB_SYMBOL_RATIO - { - HelpID = "cui:CheckBox:RID_SVXPAGE_LINE:CB_SYMBOL_RATIO"; - Hide = TRUE ; - Pos = MAP_APPFONT ( 130 , 62 ); - Size = MAP_APPFONT ( 118 , 10 ) ; - Text [ en-US ] = "Keep ratio" ; - }; - String STR_STYLE - { - Text [ en-US ] = "Style" ; - }; - String STR_LB_START_STYLE - { - Text [ en-US ] = "Start style" ; - }; - String STR_LB_END_STYLE - { - Text [ en-US ] = "End style" ; - }; - String STR_MTR_FLD_START_WIDTH - { - Text [ en-US ] = "Start width" ; - }; - String STR_MTR_FLD_END_WIDTH - { - Text [ en-US ] = "End width" ; - }; - String STR_CENTER_START - { - Text [ en-US ] = "Start with center" ; - }; - String STR_CENTER_END - { - Text [ en-US ] = "End with center" ; - }; -}; - -// Defining LineStyles -------------------- - -TabPage RID_SVXPAGE_LINE_DEF -{ - Size = MAP_APPFONT ( 260 , 185 ) ; - HelpId = HID_LINE_DEF ; - Hide = TRUE ; - Text [ en-US ] = "Define line styles" ; - - FixedLine FL_DEFINITION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Properties" ; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 12 , 34 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Type" ; - }; - ListBox LB_TYPE_1 - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE_DEF:LB_TYPE_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 32 ) ; - Size = MAP_APPFONT ( 43 , 49 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Dot" ; Default ; > ; - < "Dash" ; Default ; > ; - }; - }; - ListBox LB_TYPE_2 - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE_DEF:LB_TYPE_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 113 , 32 ) ; - Size = MAP_APPFONT ( 43 , 49 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "Dot" ; Default ; > ; - < "Dash" ; Default ; > ; - }; - }; - FixedText FT_NUMBER - { - Pos = MAP_APPFONT ( 12 , 50 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Number" ; - }; - NumericField NUM_FLD_1 - { - HelpID = "cui:NumericField:RID_SVXPAGE_LINE_DEF:NUM_FLD_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 48 ) ; - Size = MAP_APPFONT ( 43 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99 ; - StrictFormat = TRUE ; - Last = 99 ; - SpinSize = 1 ; - }; - NumericField NUM_FLD_2 - { - HelpID = "cui:NumericField:RID_SVXPAGE_LINE_DEF:NUM_FLD_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 113 , 48 ) ; - Size = MAP_APPFONT ( 43 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 99 ; - StrictFormat = TRUE ; - Last = 99 ; - SpinSize = 1 ; - }; - FixedText FT_LENGTH - { - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Length" ; - }; - MetricField MTR_FLD_LENGTH_1 - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE_DEF:MTR_FLD_LENGTH_1"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 64 ) ; - Size = MAP_APPFONT ( 43 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - Maximum = 5000 ; - Last = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - CustomUnitText = "%" ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_LENGTH_2 - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE_DEF:MTR_FLD_LENGTH_2"; - Border = TRUE ; - Pos = MAP_APPFONT ( 113 , 64 ) ; - Size = MAP_APPFONT ( 43 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - Maximum = 5000 ; - Last = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - CustomUnitText = "%" ; - SpinSize = 10 ; - }; - FixedText FT_DISTANCE - { - Pos = MAP_APPFONT ( 12 , 81 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "~Spacing" ; - }; - MetricField MTR_FLD_DISTANCE - { - HelpID = "cui:MetricField:RID_SVXPAGE_LINE_DEF:MTR_FLD_DISTANCE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 79 ) ; - Size = MAP_APPFONT ( 43 , 12 ) ; - TabStop = TRUE ; - Right = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 5000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Value = 1 ; - Unit = FUNIT_MM ; - CustomUnitText = "%" ; - Last = 5000 ; - SpinSize = 10 ; - }; - CheckBox CBX_SYNCHRONIZE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_LINE_DEF:CBX_SYNCHRONIZE"; - Pos = MAP_APPFONT ( 12 , 95 ) ; - Size = MAP_APPFONT ( 174 , 10 ) ; - Text [ en-US ] = "~Fit to line width" ; - TabStop = TRUE ; - }; - - // ---------------------------------------- - - FixedText FT_LINESTYLE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 52 , 8 ) ; - Text [ en-US ] = "Line style" ; - }; - ListBox LB_LINESTYLES - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINE_DEF:LB_LINESTYLES"; - Border = TRUE ; - Pos = MAP_APPFONT ( 66 , 14 ) ; - Size = MAP_APPFONT ( 120 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINE_DEF:BTN_ADD"; - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINE_DEF:BTN_MODIFY"; - Pos = MAP_APPFONT ( 198 , 34 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINE_DEF:BTN_DELETE"; - Pos = MAP_APPFONT ( 198 , 54 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_LINE_DEF:BTN_LOAD"; - Pos = MAP_APPFONT ( 198 , 74 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Line Styles" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_LINE_DEF:BTN_SAVE"; - Pos = MAP_APPFONT ( 198 , 96 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Line Styles" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 135 ) ; - Size = MAP_APPFONT ( 248 , 40 ) ; - }; - - String STR_START_TYPE - { - Text [ en-US ] = "Start type" ; - }; - String STR_END_TYPE - { - Text [ en-US ] = "End type" ; - }; - String STR_START_NUM - { - Text [ en-US ] = "Start number" ; - }; - String STR_END_NUM - { - Text [ en-US ] = "End number" ; - }; - String STR_START_LENGTH - { - Text [ en-US ] = "Start length" ; - }; - String STR_END_LENGTH - { - Text [ en-US ] = "End length" ; - }; -}; - -// Defining LineEnds -------------------- - -TabPage RID_SVXPAGE_LINEEND_DEF -{ - Size = MAP_APPFONT ( 260 , 185 ) ; - HelpId = HID_LINE_ENDDEF ; - Hide = TRUE ; - Text [ en-US ] = "Arrowheads" ; - - FixedLine FL_TIP - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Organize arrow styles" ; - }; - FixedText FI_TIP - { - Pos = MAP_APPFONT ( 6 , 123 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Add a selected object to create new arrow styles." ; - WordBreak = TRUE ; - }; - - FixedText FT_LINE_END_STYLE - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 84 , 8 ) ; - Text [ en-US ] = "Arrow style" ; - }; - Edit EDT_NAME - { - HelpID = "cui:Edit:RID_SVXPAGE_LINEEND_DEF:EDT_NAME"; - Border = TRUE ; - Pos = MAP_APPFONT ( 98 , 14 ) ; - Size = MAP_APPFONT ( 87 , 12 ) ; - TabStop = TRUE ; - }; - FixedText FT_TITLE - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 84 , 8 ) ; - Text [ en-US ] = "~Title" ; - }; - ListBox LB_LINEENDS - { - HelpID = "cui:ListBox:RID_SVXPAGE_LINEEND_DEF:LB_LINEENDS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 98 , 30 ) ; - Size = MAP_APPFONT ( 87 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - DDExtraWidth = TRUE ; - }; - PushButton BTN_ADD - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINEEND_DEF:BTN_ADD"; - Pos = MAP_APPFONT ( 198 , 14 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Add..." ; - TabStop = TRUE ; - }; - PushButton BTN_MODIFY - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINEEND_DEF:BTN_MODIFY"; - Pos = MAP_APPFONT ( 198 , 34 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Modify..." ; - TabStop = TRUE ; - }; - PushButton BTN_DELETE - { - HelpID = "cui:PushButton:RID_SVXPAGE_LINEEND_DEF:BTN_DELETE"; - Pos = MAP_APPFONT ( 198 , 54 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete..." ; - TabStop = TRUE ; - }; - ImageButton BTN_LOAD - { - HelpID = "cui:ImageButton:RID_SVXPAGE_LINEEND_DEF:BTN_LOAD"; - Pos = MAP_APPFONT ( 198 , 74 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Load Arrow Styles" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05501.bmp" ; - }; - MASKCOLOR - }; - }; - ImageButton BTN_SAVE - { - HelpID = "cui:ImageButton:RID_SVXPAGE_LINEEND_DEF:BTN_SAVE"; - Pos = MAP_APPFONT ( 198 , 96 ) ; - Size = MAP_APPFONT ( 16 , 16 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Save Arrow Styles" ; - ButtonImage = Image - { - ImageBitmap = Bitmap - { - File = "sc05502.bmp" ; - }; - MASKCOLOR - }; - }; - - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 135 ) ; - Size = MAP_APPFONT ( 248 , 40 ) ; - }; - -}; - // RID_SVXDLG_LINE ---------------------------------------------------------- -TabDialog RID_SVXDLG_LINE -{ - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 289 , 176 ) ; - Text [ en-US ] = "Line" ; - Moveable = TRUE ; - TabControl TAB_CONTROL - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , 135 ) ; - PageList = - { - PageItem - { - Identifier = RID_SVXPAGE_LINE ; - Text [ en-US ] = "Line" ; - PageResID = RID_SVXPAGE_LINE ; - }; - PageItem - { - Identifier = RID_SVXPAGE_SHADOW ; - PageResID = RID_SVXPAGE_SHADOW ; - Text [ en-US ] = "Shadow" ; - }; - PageItem - { - Identifier = RID_SVXPAGE_LINE_DEF ; - Text [ en-US ] = "Line Styles" ; - PageResID = RID_SVXPAGE_LINE_DEF ; - }; - PageItem - { - Identifier = RID_SVXPAGE_LINEEND_DEF ; - Text [ en-US ] = "Arrow Styles" ; - PageResID = RID_SVXPAGE_LINEEND_DEF ; - }; -/* - PageItem - { - Identifier = RID_SVXPAGE_COLOR ; - Text [ en-US ] = "Colors" ; - PageResID = RID_SVXPAGE_COLOR ; - }; -*/ - }; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx deleted file mode 100644 index f2d8e0c3c..000000000 --- a/cui/source/tabpages/tabstpge.cxx +++ /dev/null @@ -1,759 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include - -#define _SVX_TABSTPGE_CXX - -#include -#include "tabstpge.hrc" -#include -#include "tabstpge.hxx" -#include -#include "svx/dlgutil.hxx" -#include -#include -#include -#include -#include -#include - -// class TabWin_Impl ----------------------------------------------------- - -class TabWin_Impl : public Window -{ -private: - sal_uInt16 nTabStyle; - -public: - TabWin_Impl( Window* pParent, const ResId& rId, sal_uInt16 nStyle ) : - Window( pParent, rId ), - nTabStyle( nStyle ) {} - - virtual void Paint( const Rectangle& rRect ); -}; - -// static ---------------------------------------------------------------- - -static sal_uInt16 pRanges[] = -{ - SID_ATTR_TABSTOP, - SID_ATTR_TABSTOP_OFFSET, - 0 -}; - -// C-Funktion ------------------------------------------------------------ - -void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs ) -{ - if( rTabs.Count() ) - return; - { - SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT ); - rTabs.Insert( aSwTabStop ); - } -} - -// class TabWin_Impl ----------------------------------------------------- - -void TabWin_Impl::Paint( const Rectangle& ) -{ - // Tabulatoren malen - Point aPnt; - Size aSize = GetOutputSizePixel(); - aPnt.X() = aSize.Width() / 2; - aPnt.Y() = aSize.Height() / 2; - Ruler::DrawTab( this, aPnt, nTabStyle ); -} - -// class SvxTabulatorTabPage --------------------------------------------- - -SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent, - const SfxItemSet& rAttr ): - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_TABULATOR ), rAttr ), - - aTabLabel ( this, CUI_RES( FL_TABPOS ) ), - aTabBox ( this, CUI_RES( ED_TABPOS ) ), - aTabLabelVert ( this, CUI_RES( FL_TABPOS_VERT ) ), - aTabTypeLabel ( this, CUI_RES( FL_TABTYPE ) ), - aLeftTab ( this, CUI_RES( BTN_TABTYPE_LEFT ) ), - aRightTab ( this, CUI_RES( BTN_TABTYPE_RIGHT ) ), - aCenterTab ( this, CUI_RES( BTN_TABTYPE_CENTER ) ), - aDezTab ( this, CUI_RES( BTN_TABTYPE_DECIMAL ) ), - pLeftWin ( new TabWin_Impl( this, CUI_RES( WIN_TABLEFT ), (sal_uInt16)(RULER_TAB_LEFT|WB_HORZ) ) ), - pRightWin ( new TabWin_Impl( this, CUI_RES( WIN_TABRIGHT ), (sal_uInt16)(RULER_TAB_RIGHT|WB_HORZ) ) ), - pCenterWin ( new TabWin_Impl( this, CUI_RES( WIN_TABCENTER ), (sal_uInt16)(RULER_TAB_CENTER|WB_HORZ) ) ), - pDezWin ( new TabWin_Impl( this, CUI_RES( WIN_TABDECIMAL ), (sal_uInt16)(RULER_TAB_DECIMAL|WB_HORZ) ) ), - aDezCharLabel ( this, CUI_RES( FT_TABTYPE_DECCHAR ) ), - aDezChar ( this, CUI_RES( ED_TABTYPE_DECCHAR ) ), - aFillLabel ( this, CUI_RES( FL_FILLCHAR ) ), - aNoFillChar ( this, CUI_RES( BTN_FILLCHAR_NO ) ), - aFillPoints ( this, CUI_RES( BTN_FILLCHAR_POINTS ) ), - aFillDashLine ( this, CUI_RES( BTN_FILLCHAR_DASHLINE ) ), - aFillSolidLine ( this, CUI_RES( BTN_FILLCHAR_UNDERSCORE ) ), - aFillSpecial ( this, CUI_RES( BTN_FILLCHAR_OTHER ) ), - aFillChar ( this, CUI_RES( ED_FILLCHAR_OTHER ) ), - aNewBtn ( this, CUI_RES( BTN_NEW ) ), - aDelAllBtn ( this, CUI_RES( BTN_DELALL ) ), - aDelBtn ( this, CUI_RES( BTN_DEL ) ), - - aAktTab ( 0 ), - aNewTabs ( 0, 0, SVX_TAB_ADJUST_LEFT, GetWhich( SID_ATTR_TABSTOP ) ), - nDefDist ( 0 ), - eDefUnit( FUNIT_100TH_MM ), - bCheck ( sal_False ) - -{ - SvtCJKOptions aCJKOptions; - if(aCJKOptions.IsAsianTypographyEnabled()) - { - aLeftTab .SetText(String(CUI_RES( ST_LEFTTAB_ASIAN ))); - aRightTab .SetText(String(CUI_RES( ST_RIGHTTAB_ASIAN ))); - } - - aFillChar.SetAccessibleName(String(CUI_RES( ST_FILLCHAR_OTHER ))); - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rAttr ); - SetFieldUnit( aTabBox, eFUnit ); - - // Buttons initialisieren - aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) ); - aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) ); - aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) ); - - Link aLink = LINK( this, SvxTabulatorTabPage, TabTypeCheckHdl_Impl ); - aLeftTab.SetClickHdl( aLink ); - aRightTab.SetClickHdl( aLink ); - aDezTab.SetClickHdl( aLink ); - aCenterTab.SetClickHdl( aLink ); - - aDezChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetDezCharHdl_Impl ) ); - aDezChar.SetMaxTextLen(1); - aDezChar.Disable(); - aDezCharLabel.Disable(); - - aLink = LINK( this, SvxTabulatorTabPage, FillTypeCheckHdl_Impl ); - aNoFillChar.SetClickHdl( aLink ); - aFillPoints.SetClickHdl( aLink ); - aFillDashLine.SetClickHdl( aLink ); - aFillSolidLine.SetClickHdl( aLink ); - aFillSpecial.SetClickHdl( aLink ); - aFillChar.SetLoseFocusHdl( LINK( this, SvxTabulatorTabPage, GetFillCharHdl_Impl ) ); - aFillChar.SetMaxTextLen(1); - aFillChar.Disable(); - - aTabBox.SetDoubleClickHdl( LINK( this, SvxTabulatorTabPage, SelectHdl_Impl ) ); - aTabBox.SetModifyHdl( LINK( this, SvxTabulatorTabPage, ModifyHdl_Impl ) ); - - aLeftTab.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - aRightTab.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - aCenterTab.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - aDezTab.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - aDezCharLabel.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - aDezChar.SetAccessibleRelationMemberOf( &aTabTypeLabel ); - - aNoFillChar.SetAccessibleRelationMemberOf( &aFillLabel ); - aFillPoints.SetAccessibleRelationMemberOf( &aFillLabel ); - aFillDashLine.SetAccessibleRelationMemberOf( &aFillLabel ); - aFillSolidLine.SetAccessibleRelationMemberOf( &aFillLabel ); - aFillSpecial.SetAccessibleRelationMemberOf( &aFillLabel ); - aFillChar.SetAccessibleRelationMemberOf( &aFillLabel ); - - aFillChar.SetAccessibleRelationLabeledBy(&aFillSpecial); - - // das Default-Dezimalzeichen vom System holen - LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); - aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep().GetChar(0); - FreeResource(); -} - -// ----------------------------------------------------------------------- - -SvxTabulatorTabPage::~SvxTabulatorTabPage() -{ - delete pLeftWin; - delete pRightWin; - delete pCenterWin; - delete pDezWin; -} - -// ----------------------------------------------------------------------- - -sal_uInt16* SvxTabulatorTabPage::GetRanges() -{ - return pRanges; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxTabulatorTabPage::FillItemSet( SfxItemSet& rSet ) -{ - sal_Bool bModified = sal_False; - - // Hier die Werte aus den Controls eintueten - if ( aNewBtn.IsEnabled() ) - NewHdl_Impl( 0 ); - - // call at first the LoseFocus-Handler - GetDezCharHdl_Impl( &aDezChar ); - GetFillCharHdl_Impl( &aFillChar ); - - FillUpWithDefTabs_Impl( nDefDist, aNewTabs ); - SfxItemPool* pPool = rSet.GetPool(); - MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); - const SfxPoolItem* pOld = GetOldItem( rSet, SID_ATTR_TABSTOP ); - - if ( MAP_100TH_MM != eUnit ) - { - // Wenn sich im ItemSet ein LRSpaceItem mit negativen Erstzeileneinzug - // befindet, muss im TabStopItem auf der Position 0 ein DefTab sein. - const SfxPoolItem* pLRSpace; - // wenn nicht im neuen Set, dann vielleicht im alten - if ( SFX_ITEM_SET != - rSet.GetItemState( GetWhich( SID_ATTR_LRSPACE ), sal_True, &pLRSpace ) ) - pLRSpace = GetOldItem( rSet, SID_ATTR_LRSPACE ); - - if ( pLRSpace && ( (SvxLRSpaceItem*)pLRSpace )->GetTxtFirstLineOfst() < 0 ) - { - SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT ); - aNewTabs.Insert( aNull ); - } - - SvxTabStopItem aTmp( aNewTabs ); - aTmp.Remove( 0, aTmp.Count() ); - - for ( sal_uInt16 i = 0; i < aNewTabs.Count(); ++i ) - { - SvxTabStop aTmpStop = aNewTabs[i]; - aTmpStop.GetTabPos() = - LogicToLogic( aTmpStop.GetTabPos(), MAP_100TH_MM, eUnit ); - aTmp.Insert( aTmpStop ); - } - - if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aTmp ) ) - { - rSet.Put( aTmp ); - bModified = sal_True; - } - } - else if ( !pOld || !( *( (SvxTabStopItem*)pOld ) == aNewTabs ) ) - { - rSet.Put( aNewTabs ); - bModified = sal_True; - } - return bModified; -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxTabulatorTabPage::Create( Window* pParent, - const SfxItemSet& rSet) -{ - return ( new SvxTabulatorTabPage( pParent, rSet ) ); -} - -// ----------------------------------------------------------------------- - -void SvxTabulatorTabPage::Reset( const SfxItemSet& rSet ) -{ - SfxItemPool* pPool = rSet.GetPool(); - MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); - - // Aktuelle Tabs - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_TABSTOP ); - - if ( pItem ) - { - if ( MAP_100TH_MM != eUnit ) - { - SvxTabStopItem aTmp( *( (const SvxTabStopItem*)pItem ) ); - aNewTabs.Remove( 0, aNewTabs.Count() ); - - for ( sal_uInt16 i = 0; i < aTmp.Count(); ++i ) - { - SvxTabStop aTmpStop = aTmp[i]; - aTmpStop.GetTabPos() = - LogicToLogic( aTmpStop.GetTabPos(), eUnit, MAP_100TH_MM ); - aNewTabs.Insert( aTmpStop ); - } - } - else - aNewTabs = *( (const SvxTabStopItem*)pItem ); - } - else - aNewTabs.Remove( 0, aNewTabs.Count() ); - - // Default-Tab - Abstand - nDefDist = SVX_TAB_DEFDIST; - pItem = GetItem( rSet, SID_ATTR_TABSTOP_DEFAULTS ); - - if ( pItem ) - nDefDist = LogicToLogic( - (long)((const SfxUInt16Item*)pItem)->GetValue(), eUnit, MAP_100TH_MM ); - - // Aktuell selektierte Tab-Pos - sal_uInt16 nTabPos = 0; - pItem = GetItem( rSet, SID_ATTR_TABSTOP_POS ); - - if ( pItem ) - nTabPos = ( (const SfxUInt16Item*)pItem )->GetValue(); - - InitTabPos_Impl( nTabPos ); -} - -// ----------------------------------------------------------------------- - -void SvxTabulatorTabPage::DisableControls( const sal_uInt16 nFlag ) -{ - if ( ( TABTYPE_LEFT & nFlag ) == TABTYPE_LEFT ) - { - aLeftTab.Disable(); - pLeftWin->Disable(); - } - if ( ( TABTYPE_RIGHT & nFlag ) == TABTYPE_RIGHT ) - { - aRightTab.Disable(); - pRightWin->Disable(); - } - if ( ( TABTYPE_CENTER & nFlag ) == TABTYPE_CENTER ) - { - aCenterTab.Disable(); - pCenterWin->Disable(); - } - if ( ( TABTYPE_DEZIMAL & nFlag ) == TABTYPE_DEZIMAL ) - { - aDezTab.Disable(); - pDezWin->Disable(); - aDezCharLabel.Disable(); - aDezChar.Disable(); - } - if ( ( TABTYPE_ALL & nFlag ) == TABTYPE_ALL ) - aTabTypeLabel.Disable(); - if ( ( TABFILL_NONE & nFlag ) == TABFILL_NONE ) - aNoFillChar.Disable(); - if ( ( TABFILL_POINT & nFlag ) == TABFILL_POINT ) - aFillPoints.Disable(); - if ( ( TABFILL_DASHLINE & nFlag ) == TABFILL_DASHLINE ) - aFillDashLine.Disable(); - if ( ( TABFILL_SOLIDLINE & nFlag ) == TABFILL_SOLIDLINE ) - aFillSolidLine.Disable(); - if ( ( TABFILL_SPECIAL & nFlag ) == TABFILL_SPECIAL ) - { - aFillSpecial.Disable(); - aFillChar.Disable(); - } - if ( ( TABFILL_ALL & nFlag ) == TABFILL_ALL ) - aFillLabel.Disable(); -} - -// ----------------------------------------------------------------------- - -int SvxTabulatorTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos ) -{ - aTabBox.Clear(); - - long nOffset = 0; - const SfxPoolItem* pItem = 0; - if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, sal_True, &pItem ) - == SFX_ITEM_SET ) - { - nOffset = ( (const SfxInt32Item*)pItem )->GetValue(); - MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); - nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM ); - } - - // Aktuelle TabPos korrigieren und Defaults-Tabs - for ( sal_uInt16 i = 0; i < aNewTabs.Count(); i++ ) - { - if ( aNewTabs[i].GetAdjustment() != SVX_TAB_ADJUST_DEFAULT ) - { - aTabBox.InsertValue( aTabBox.Normalize( - aNewTabs[i].GetTabPos() + nOffset ), eDefUnit ); - } - else - aNewTabs.Remove( i-- ); - } - - // aktuellen Tabulator auswaehlen - const sal_uInt16 nSize = aNewTabs.Count(); - - if ( nTabPos >= nSize ) - nTabPos = 0; - - // alle RadioButtons erstmal ausschalten - aLeftTab.Check( sal_True ); - aNoFillChar.Check( sal_True ); - - if( aTabBox.GetEntryCount() > 0 ) - { - aTabBox.SetText( aTabBox.GetEntry( nTabPos ) ); - aAktTab = aNewTabs[nTabPos]; - - SetFillAndTabType_Impl(); - aNewBtn.Disable(); - aDelBtn.Enable(); - } - else - { // kein Eintrag dann ist 0 der Default-Wert - aTabBox.SetValue( 0, eDefUnit ); - - aNewBtn.Enable(); - aDelBtn.Disable(); - } -} - -// ----------------------------------------------------------------------- - -void SvxTabulatorTabPage::SetFillAndTabType_Impl() -{ - RadioButton* pTypeBtn = 0; - RadioButton* pFillBtn = 0; - - aDezChar.Disable(); - aDezCharLabel.Disable(); - - if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_LEFT ) - pTypeBtn = &aLeftTab; - else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT ) - pTypeBtn = &aRightTab; - else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_DECIMAL ) - { - pTypeBtn = &aDezTab; - aDezChar.Enable(); - aDezCharLabel.Enable(); - aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) ); - } - else if ( aAktTab.GetAdjustment() == SVX_TAB_ADJUST_CENTER ) - pTypeBtn = &aCenterTab; - - if ( pTypeBtn ) - pTypeBtn->Check(); - - aFillChar.Disable(); - aFillChar.SetText( String() ); - - if ( aAktTab.GetFill() == ' ' ) - pFillBtn = &aNoFillChar; - else if ( aAktTab.GetFill() == '-' ) - pFillBtn = &aFillDashLine; - else if ( aAktTab.GetFill() == '_' ) - pFillBtn = &aFillSolidLine; - else if ( aAktTab.GetFill() == '.' ) - pFillBtn = &aFillPoints; - else - { - pFillBtn = &aFillSpecial; - aFillChar.Enable(); - aFillChar.SetText( String( (sal_Unicode)aAktTab.GetFill() ) ); - } - pFillBtn->Check(); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn ) -{ - // Einen neuen Hinzufuegen und Selectieren - // Wert aus der Anzeige holen - long nVal = static_cast(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) )); - - // Wenn der pBtn == 0 && der Value == 0 dann keinen Tab Erzeugen - // weil ueber OK erzeugt - if ( nVal == 0 && pBtn == 0 ) - return 0; - - long nOffset = 0; - const SfxPoolItem* pItem = 0; - - if ( GetItemSet().GetItemState( SID_ATTR_TABSTOP_OFFSET, sal_True, &pItem ) == - SFX_ITEM_SET ) - { - nOffset = ( (const SfxInt32Item*)pItem )->GetValue(); - MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) ); - nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MAP_100TH_MM ); - } - const long nReal = nVal - nOffset; - sal_uInt16 nSize = aTabBox.GetEntryCount(); - - sal_uInt16 i; - for( i = 0; i < nSize; i++ ) - { - if ( nReal < aNewTabs[i].GetTabPos() ) - break; - } - - // ListBox-Eintrag vornehmen - aTabBox.InsertValue( aTabBox.Normalize( nVal ), eDefUnit, i ); - aAktTab.GetTabPos() = nReal; - SvxTabAdjust eAdj = SVX_TAB_ADJUST_LEFT; - - if ( aRightTab.IsChecked() ) - eAdj = SVX_TAB_ADJUST_RIGHT; - else if ( aCenterTab.IsChecked() ) - eAdj = SVX_TAB_ADJUST_CENTER; - else if ( aDezTab.IsChecked() ) - eAdj = SVX_TAB_ADJUST_DECIMAL; - - aAktTab.GetAdjustment() = eAdj; - aNewTabs.Insert( aAktTab ); - - aNewBtn.Disable(); - aDelBtn.Enable(); - aTabBox.GrabFocus(); - - // falls kein RadioButton geclickt wurde, - // muss trotzdem geputtet werden - bCheck |= sal_True; - // set the selection into the position Edit - aTabBox.SetSelection(Selection(0, aTabBox.GetText().Len())); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, DelHdl_Impl, Button *, EMPTYARG ) -{ - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue() ); - - if ( nPos == COMBOBOX_ENTRY_NOTFOUND ) - return 0; - - if ( aTabBox.GetEntryCount() == 1 ) - { - DelAllHdl_Impl( 0 ); - return 0; - } - - // Tab loeschen - aTabBox.RemoveEntry( nPos ); - aNewTabs.Remove( nPos ); - - // aAktTab neu setzen - const sal_uInt16 nSize = aNewTabs.Count(); - - if ( nSize > 0 ) - { - // Pos korrigieren - nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1; - aTabBox.SetValue( aTabBox.GetValue( nPos ) ); - aAktTab = aNewTabs[nPos]; - } - - // Falls keine Tabs Enable Disable Controls - if ( aTabBox.GetEntryCount() == 0 ) - { - aDelBtn.Disable(); - aNewBtn.Enable(); - aTabBox.GrabFocus(); - } - - // falls kein RadioButton geclickt wurde, - // muss trotzdem geputtet werden - bCheck |= sal_True; - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, DelAllHdl_Impl, Button *, EMPTYARG ) -{ - if ( aNewTabs.Count() ) - { - aNewTabs = SvxTabStopItem( 0 ); - InitTabPos_Impl(); - - // damit in FillItemSet() geputtet wird - bCheck |= sal_True; - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, TabTypeCheckHdl_Impl, RadioButton *, pBox ) -{ - bCheck |= sal_True; - SvxTabAdjust eAdj; - aDezChar.Disable(); - aDezCharLabel.Disable(); - aDezChar.SetText( String() ); - - if ( pBox == &aLeftTab ) - eAdj = SVX_TAB_ADJUST_LEFT; - else if ( pBox == &aRightTab ) - eAdj = SVX_TAB_ADJUST_RIGHT; - else if ( pBox == &aCenterTab ) - eAdj = SVX_TAB_ADJUST_CENTER; - else - { - eAdj = SVX_TAB_ADJUST_DECIMAL; - aDezChar.Enable(); - aDezCharLabel.Enable(); - aDezChar.SetText( String( (sal_Unicode)aAktTab.GetDecimal() ) ); - } - - aAktTab.GetAdjustment() = eAdj; - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); - - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aAktTab ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, FillTypeCheckHdl_Impl, RadioButton *, pBox ) -{ - bCheck |= sal_True; - sal_uInt8 cFill = ' '; - aFillChar.SetText( String() ); - aFillChar.Disable(); - - if( pBox == &aFillSpecial ) - aFillChar.Enable(); - else if ( pBox == &aNoFillChar ) - cFill = ' '; - else if ( pBox == &aFillSolidLine ) - cFill = '_'; - else if ( pBox == &aFillPoints ) - cFill = '.'; - else if ( pBox == &aFillDashLine ) - cFill = '-'; - - aAktTab.GetFill() = cFill; - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); - - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aAktTab ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, GetFillCharHdl_Impl, Edit *, pEdit ) -{ - String aChar( pEdit->GetText() ); - - if ( aChar.Len() > 0 ) - aAktTab.GetFill() = aChar.GetChar( 0 ); - - const sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aAktTab ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, GetDezCharHdl_Impl, Edit *, pEdit ) -{ - String aChar( pEdit->GetText() ); - if ( aChar.Len() > 0 && ( aChar.GetChar( 0 ) >= ' ')) - aAktTab.GetDecimal() = aChar.GetChar( 0 ); - - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aAktTab ); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, SelectHdl_Impl, MetricBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aAktTab = aNewTabs[nPos]; - aNewBtn.Disable(); - SetFillAndTabType_Impl(); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxTabulatorTabPage, ModifyHdl_Impl, MetricBox *, EMPTYARG ) -{ - sal_uInt16 nPos = aTabBox.GetValuePos( aTabBox.GetValue( eDefUnit ), eDefUnit ); - if ( nPos != COMBOBOX_ENTRY_NOTFOUND ) - { - aAktTab = aNewTabs[nPos]; - SetFillAndTabType_Impl(); - - aAktTab.GetTabPos() = - static_cast(aTabBox.Denormalize( aTabBox.GetValue( eDefUnit ) )); - - aNewBtn.Disable(); - aDelBtn.Enable(); - return 0; - } - aNewBtn.Enable(); - aDelBtn.Disable(); - return 0; -} - -void SvxTabulatorTabPage::PageCreated(SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pControlItem,SfxUInt16Item,SID_SVXTABULATORTABPAGE_CONTROLFLAGS,sal_False); - if (pControlItem) - DisableControls(pControlItem->GetValue()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tabstpge.hrc b/cui/source/tabpages/tabstpge.hrc deleted file mode 100644 index 095b89c04..000000000 --- a/cui/source/tabpages/tabstpge.hrc +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVX_TABSTPGE_HRC -#define _SVX_TABSTPGE_HRC - -// defines ------------------------------------------------------------------ - -#define ED_TABPOS 10 -#define FL_TABPOS 11 -#define FL_TABPOS_VERT 12 - -#define BTN_TABTYPE_LEFT 20 -#define WIN_TABLEFT 21 -#define BTN_TABTYPE_RIGHT 22 -#define WIN_TABRIGHT 23 -#define BTN_TABTYPE_CENTER 24 -#define WIN_TABCENTER 25 -#define BTN_TABTYPE_DECIMAL 26 -#define WIN_TABDECIMAL 27 -#define ED_TABTYPE_DECCHAR 28 -#define FT_TABTYPE_DECCHAR 29 -#define FL_TABTYPE 30 - - -#define BTN_FILLCHAR_NO 40 -#define BTN_FILLCHAR_POINTS 41 -#define BTN_FILLCHAR_DASHLINE 42 -#define BTN_FILLCHAR_UNDERSCORE 43 -#define BTN_FILLCHAR_OTHER 44 -#define ED_FILLCHAR_OTHER 45 -#define FL_FILLCHAR 46 - -#define BTN_NEW 50 -#define BTN_DEL 51 -#define BTN_DELALL 52 -#define ST_LEFTTAB_ASIAN 53 -#define ST_RIGHTTAB_ASIAN 54 -//IAccessibility2 Implementation 2009----- -#define ST_FILLCHAR_OTHER 55 -//-----IAccessibility2 Implementation 2009 -#endif - diff --git a/cui/source/tabpages/tabstpge.src b/cui/source/tabpages/tabstpge.src deleted file mode 100644 index 79421f0ce..000000000 --- a/cui/source/tabpages/tabstpge.src +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include "helpid.hrc" -#include -#include "tabstpge.hrc" -#include - - // RID_SVXPAGE_TABULATOR ------------------------------------------------- -TabPage RID_SVXPAGE_TABULATOR -{ - HelpId = HID_TABULATOR ; - Hide = TRUE ; - Text [ en-US ] = "Tabs" ; - Size = MAP_APPFONT ( 260 , 185 ) ; - FixedLine FL_TABPOS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 48 , 8 ) ; - Text [ en-US ] = "Position" ; - }; - MetricBox ED_TABPOS - { - HelpID = "cui:MetricBox:RID_SVXPAGE_TABULATOR:ED_TABPOS"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 39 , 165 ) ; - Minimum = -5600 ; - Maximum = 5600 ; - DecimalDigits = 2 ; - Unit = FUNIT_CM ; - }; - FixedLine FL_TABPOS_VERT - { - Pos = MAP_APPFONT ( 55 , 14 ) ; - Size = MAP_APPFONT ( 4 , 165 ) ; - Vert = TRUE; - }; - FixedLine FL_TABTYPE - { - Pos = MAP_APPFONT ( 60 , 3 ) ; - Size = MAP_APPFONT ( 138 , 8 ) ; - Text [ en-US ] = "Type" ; - }; - RadioButton BTN_TABTYPE_LEFT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_TABTYPE_LEFT"; - Pos = MAP_APPFONT ( 66 , 14 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "~Left" ; - Check = TRUE ; - }; - Window WIN_TABLEFT - { - Pos = MAP_APPFONT ( 157 , 14 ) ; - Size = MAP_APPFONT ( 7 , 10 ) ; - }; - RadioButton BTN_TABTYPE_RIGHT - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_TABTYPE_RIGHT"; - Pos = MAP_APPFONT ( 66 , 28 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "Righ~t" ; - }; - Window WIN_TABRIGHT - { - Pos = MAP_APPFONT ( 157 , 28 ) ; - Size = MAP_APPFONT ( 7 , 10 ) ; - }; - RadioButton BTN_TABTYPE_CENTER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_TABTYPE_CENTER"; - Pos = MAP_APPFONT ( 66 , 42 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "C~entered" ; - }; - Window WIN_TABCENTER - { - Pos = MAP_APPFONT ( 157 , 42 ) ; - Size = MAP_APPFONT ( 7 , 10 ) ; - }; - RadioButton BTN_TABTYPE_DECIMAL - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_TABTYPE_DECIMAL"; - Pos = MAP_APPFONT ( 66 , 56 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "Deci~mal" ; - }; - Window WIN_TABDECIMAL - { - Pos = MAP_APPFONT ( 157 , 56 ) ; - Size = MAP_APPFONT ( 7 , 10 ) ; - }; - FixedText FT_TABTYPE_DECCHAR - { - Pos = MAP_APPFONT ( 75 , 70 ) ; - Size = MAP_APPFONT ( 79 , 8 ) ; - Text [ en-US ] = "~Character" ; - }; - Edit ED_TABTYPE_DECCHAR - { - HelpID = "cui:Edit:RID_SVXPAGE_TABULATOR:ED_TABTYPE_DECCHAR"; - Border = TRUE ; - Pos = MAP_APPFONT ( 156 , 68 ) ; - Size = MAP_APPFONT ( 9 , 12 ) ; - Left = TRUE ; - }; - FixedLine FL_FILLCHAR - { - Pos = MAP_APPFONT ( 60 , 86 ) ; - Size = MAP_APPFONT ( 138 , 8 ) ; - Text [ en-US ] = "Fill character" ; - }; - RadioButton BTN_FILLCHAR_NO - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_FILLCHAR_NO"; - Pos = MAP_APPFONT ( 66 , 97 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "N~one" ; - Check = TRUE ; - }; - RadioButton BTN_FILLCHAR_POINTS - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_FILLCHAR_POINTS"; - Pos = MAP_APPFONT ( 66 , 111 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text = "~........" ; - }; - RadioButton BTN_FILLCHAR_DASHLINE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_FILLCHAR_DASHLINE"; - Pos = MAP_APPFONT ( 66 , 125 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text = "~--------" ; - }; - RadioButton BTN_FILLCHAR_UNDERSCORE - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_FILLCHAR_UNDERSCORE"; - Pos = MAP_APPFONT ( 66 , 139 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text = "~_____" ; - }; - RadioButton BTN_FILLCHAR_OTHER - { - HelpID = "cui:RadioButton:RID_SVXPAGE_TABULATOR:BTN_FILLCHAR_OTHER"; - Pos = MAP_APPFONT ( 66 , 153 ) ; - Size = MAP_APPFONT ( 89 , 10 ) ; - Text [ en-US ] = "Character" ; - }; - Edit ED_FILLCHAR_OTHER - { - HelpID = "cui:Edit:RID_SVXPAGE_TABULATOR:ED_FILLCHAR_OTHER"; - Border = TRUE ; - Pos = MAP_APPFONT ( 156 , 151 ) ; - Size = MAP_APPFONT ( 9 , 12 ) ; - Left = TRUE ; - }; - PushButton BTN_NEW - { - HelpID = "cui:PushButton:RID_SVXPAGE_TABULATOR:BTN_NEW"; - Pos = MAP_APPFONT ( 204 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~New" ; - }; - PushButton BTN_DELALL - { - HelpID = "cui:PushButton:RID_SVXPAGE_TABULATOR:BTN_DELALL"; - Pos = MAP_APPFONT ( 204 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "Delete ~All" ; - }; - PushButton BTN_DEL - { - HelpID = "cui:PushButton:RID_SVXPAGE_TABULATOR:BTN_DEL"; - Pos = MAP_APPFONT ( 204 , 40 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - Text [ en-US ] = "~Delete" ; - }; - String ST_LEFTTAB_ASIAN - { - Text [ en-US ] = "~Left/Top" ; - }; - String ST_RIGHTTAB_ASIAN - { - Text [ en-US ] = "Righ~t/Bottom" ; - }; - String ST_FILLCHAR_OTHER - { - Text [ en-US ] = "Character" ; - }; -}; - diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx deleted file mode 100644 index c8a0fd4ad..000000000 --- a/cui/source/tabpages/textanim.cxx +++ /dev/null @@ -1,774 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include - -#include -#include - -#ifndef _SVX_TEXTANIM_CXX -#define _SVX_TEXTANIM_CXX -#endif -#include "textanim.hxx" -#include "textanim.hrc" -#include "textattr.hxx" -#include -#include "svx/dlgutil.hxx" - -static sal_uInt16 pRanges[] = -{ - SDRATTR_TEXT_ANIKIND, - SDRATTR_TEXT_ANIAMOUNT, - 0 -}; - -/************************************************************************* -|* -|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu -|* -\************************************************************************/ - -SvxTextTabDialog::SvxTextTabDialog( Window* pParent, - const SfxItemSet* pAttr, - const SdrView* pSdrView ) : - SfxTabDialog ( pParent, CUI_RES( RID_SVXDLG_TEXT ), pAttr ), - rOutAttrs ( *pAttr ), - pView ( pSdrView ) -{ - FreeResource(); - - AddTabPage( RID_SVXPAGE_TEXTATTR, SvxTextAttrPage::Create, 0); - AddTabPage( RID_SVXPAGE_TEXTANIMATION, SvxTextAnimationPage::Create, 0); -} - -/************************************************************************* -|* -|* PageCreated() -|* -\************************************************************************/ - -void SvxTextTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) -{ - switch( nId ) - { - case RID_SVXPAGE_TEXTATTR: - { - ( (SvxTextAttrPage&) rPage ).SetView( pView ); - ( (SvxTextAttrPage&) rPage ).Construct(); - } - break; - - case RID_SVXPAGE_TEXTANIMATION: - break; - - default: - break; - } -} - - -/************************************************************************* -|* -|* Page -|* -\************************************************************************/ - -SvxTextAnimationPage::SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs ) : - SfxTabPage ( pWindow, CUI_RES( RID_SVXPAGE_TEXTANIMATION ), - rInAttrs ), - aFlEffect ( this, CUI_RES(FL_EFFECT)), - aFtEffects ( this, CUI_RES(FT_EFFECTS)), - aLbEffect ( this, CUI_RES( LB_EFFECT ) ), - //aCtlEffect ( this, CUI_RES( CTL_EFFECT ) ), - aFtDirection ( this, CUI_RES(FT_DIRECTION) ), - aBtnUp ( this, CUI_RES( BTN_UP ) ), - aBtnLeft ( this, CUI_RES( BTN_LEFT ) ), - aBtnRight ( this, CUI_RES( BTN_RIGHT ) ), - aBtnDown ( this, CUI_RES( BTN_DOWN ) ), - - aFlProperties ( this, CUI_RES(FL_PROPERTIES)), - aTsbStartInside ( this, CUI_RES( TSB_START_INSIDE ) ), - aTsbStopInside ( this, CUI_RES( TSB_STOP_INSIDE ) ), - - aFtCount ( this, CUI_RES(FT_COUNT)), - aTsbEndless ( this, CUI_RES( TSB_ENDLESS ) ), - aNumFldCount ( this, CUI_RES( NUM_FLD_COUNT ) ), - - aFtAmount ( this, CUI_RES(FT_AMOUNT)), - aTsbPixel ( this, CUI_RES( TSB_PIXEL ) ), - aMtrFldAmount ( this, CUI_RES( MTR_FLD_AMOUNT ) ), - - aFtDelay ( this, CUI_RES(FT_DELAY)), - aTsbAuto ( this, CUI_RES( TSB_AUTO ) ), - aMtrFldDelay ( this, CUI_RES( MTR_FLD_DELAY ) ), - - rOutAttrs ( rInAttrs ), - eAniKind ( SDRTEXTANI_NONE ) -{ - FreeResource(); - - eFUnit = GetModuleFieldUnit( rInAttrs ); - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); - - Construct(); - - aLbEffect.SetSelectHdl( - LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) ); - aTsbEndless.SetClickHdl( - LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) ); - aTsbAuto.SetClickHdl( - LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) ); - aTsbPixel.SetClickHdl( - LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) ); - - Link aLink( LINK( this, SvxTextAnimationPage, ClickDirectionHdl_Impl ) ); - aBtnUp.SetClickHdl( aLink ); - aBtnLeft.SetClickHdl( aLink ); - aBtnRight.SetClickHdl( aLink ); - aBtnDown.SetClickHdl( aLink ); - - aNumFldCount.SetAccessibleRelationLabeledBy( &aTsbEndless ); - aMtrFldAmount.SetAccessibleRelationLabeledBy( &aTsbPixel ); - aMtrFldDelay.SetAccessibleRelationLabeledBy( &aTsbAuto ); - - aBtnUp.SetAccessibleRelationLabeledBy( &aFtDirection ); - aBtnLeft.SetAccessibleRelationLabeledBy( &aFtDirection ); - aBtnRight.SetAccessibleRelationLabeledBy( &aFtDirection ); - aBtnDown.SetAccessibleRelationLabeledBy( &aFtDirection ); - - aBtnUp.SetAccessibleRelationMemberOf( &aFlEffect ); - aBtnLeft.SetAccessibleRelationMemberOf( &aFlEffect ); - aBtnRight.SetAccessibleRelationMemberOf( &aFlEffect ); - aBtnDown.SetAccessibleRelationMemberOf( &aFlEffect ); - - aTsbEndless.SetAccessibleRelationLabeledBy( &aFtCount ); - aTsbPixel.SetAccessibleRelationLabeledBy( &aFtAmount ); - aTsbAuto.SetAccessibleRelationLabeledBy( &aFtDelay ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxTextAnimationPage::~SvxTextAnimationPage() -{ -} - -/************************************************************************* -|* -|* Liest uebergebenen Item-Set -|* -\************************************************************************/ - -void SvxTextAnimationPage::Reset( const SfxItemSet& rAttrs ) -{ - const SfxItemPool* pPool = rAttrs.GetPool(); - - // Animationstyp - const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIKIND ); - - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND ); - if( pItem ) - { - eAniKind = ( ( const SdrTextAniKindItem* )pItem )->GetValue(); - aLbEffect.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(eAniKind) ); - } - else - aLbEffect.SetNoSelection(); - aLbEffect.SaveValue(); - - // Animationsrichtung - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDIRECTION ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION ); - if( pItem ) - { - SdrTextAniDirection eValue = ( ( const SdrTextAniDirectionItem* )pItem )->GetValue(); - SelectDirection( eValue ); - } - else - { - aBtnUp.Check( sal_False ); - aBtnLeft.Check( sal_False ); - aBtnRight.Check( sal_False ); - aBtnDown.Check( sal_False ); - } - aBtnUp.SaveValue(); - aBtnLeft.SaveValue(); - aBtnRight.SaveValue(); - aBtnDown.SaveValue(); - - // Start inside - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTARTINSIDE ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE ); - if( pItem ) - { - aTsbStartInside.EnableTriState( sal_False ); - sal_Bool bValue = ( ( const SdrTextAniStartInsideItem* )pItem )->GetValue(); - if( bValue ) - aTsbStartInside.SetState( STATE_CHECK ); - else - aTsbStartInside.SetState( STATE_NOCHECK ); - } - else - aTsbStartInside.SetState( STATE_DONTKNOW ); - aTsbStartInside.SaveValue(); - - // Stop inside - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTOPINSIDE ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE ); - if( pItem ) - { - aTsbStopInside.EnableTriState( sal_False ); - sal_Bool bValue = ( ( const SdrTextAniStopInsideItem* )pItem )->GetValue(); - if( bValue ) - aTsbStopInside.SetState( STATE_CHECK ); - else - aTsbStopInside.SetState( STATE_NOCHECK ); - } - else - aTsbStopInside.SetState( STATE_DONTKNOW ); - aTsbStopInside.SaveValue(); - - // Anzahl - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANICOUNT ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT ); - if( pItem ) - { - aTsbEndless.EnableTriState( sal_False ); - long nValue = (long) ( ( const SdrTextAniCountItem* )pItem )->GetValue(); - aNumFldCount.SetValue( nValue ); - if( nValue == 0 ) - { - if( eAniKind == SDRTEXTANI_SLIDE ) - { - aTsbEndless.SetState( STATE_NOCHECK ); - aTsbEndless.Enable( sal_False ); - } - else - { - aTsbEndless.SetState( STATE_CHECK ); - aNumFldCount.SetEmptyFieldValue(); - } - } - else - aTsbEndless.SetState( STATE_NOCHECK ); - } - else - { - aNumFldCount.SetEmptyFieldValue(); - aTsbEndless.SetState( STATE_DONTKNOW ); - } - aTsbEndless.SaveValue(); - aNumFldCount.SaveValue(); - - // Verzoegerung - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDELAY ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY ); - if( pItem ) - { - aTsbAuto.EnableTriState( sal_False ); - long nValue = (long) ( ( const SdrTextAniDelayItem* )pItem )->GetValue(); - aMtrFldDelay.SetValue( nValue ); - if( nValue == 0 ) - { - aTsbAuto.SetState( STATE_CHECK ); - aMtrFldDelay.SetEmptyFieldValue(); - } - else - aTsbAuto.SetState( STATE_NOCHECK ); - } - else - { - aMtrFldDelay.SetEmptyFieldValue(); - aTsbAuto.SetState( STATE_DONTKNOW ); - } - aTsbAuto.SaveValue(); - aMtrFldDelay.SaveValue(); - - // Schrittweite - pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIAMOUNT ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT ); - if( pItem ) - { - aTsbPixel.EnableTriState( sal_False ); - long nValue = (long) ( ( const SdrTextAniAmountItem* )pItem )->GetValue(); - if( nValue <= 0 ) - { - aTsbPixel.SetState( STATE_CHECK ); - nValue = -nValue; - if( nValue == 0 ) - nValue++; - aMtrFldAmount.SetUnit( FUNIT_CUSTOM ); - aMtrFldAmount.SetDecimalDigits( 0 ); - - aMtrFldAmount.SetSpinSize( 1 ); - aMtrFldAmount.SetMin( 1 ); - aMtrFldAmount.SetFirst( 1 ); - aMtrFldAmount.SetMax( 100 ); - aMtrFldAmount.SetLast( 100 ); - - aMtrFldAmount.SetValue( nValue ); - } - else - { - aTsbPixel.SetState( STATE_NOCHECK ); - aMtrFldAmount.SetUnit( eFUnit ); - aMtrFldAmount.SetDecimalDigits( 2 ); - - aMtrFldAmount.SetSpinSize( 10 ); - aMtrFldAmount.SetMin( 1 ); - aMtrFldAmount.SetFirst( 1 ); - aMtrFldAmount.SetMax( 10000 ); - aMtrFldAmount.SetLast( 10000 ); - - SetMetricValue( aMtrFldAmount, nValue, eUnit ); - } - } - else - { - aMtrFldAmount.Disable(); - aMtrFldAmount.SetEmptyFieldValue(); - aTsbPixel.SetState( STATE_DONTKNOW ); - } - aTsbPixel.SaveValue(); - aMtrFldAmount.SaveValue(); - - - SelectEffectHdl_Impl( NULL ); - ClickEndlessHdl_Impl( NULL ); - ClickAutoHdl_Impl( NULL ); - //ClickPixelHdl_Impl( NULL ); -} - -/************************************************************************* -|* -|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen -|* -\************************************************************************/ - -sal_Bool SvxTextAnimationPage::FillItemSet( SfxItemSet& rAttrs) -{ - sal_Bool bModified = sal_False; - sal_uInt16 nPos; - TriState eState; - - // Animationstyp - nPos = aLbEffect.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbEffect.GetSavedValue() ) - { - rAttrs.Put( SdrTextAniKindItem( (SdrTextAniKind) nPos ) ); - bModified = sal_True; - } - - // Animationsrichtung - if( aBtnUp.GetSavedValue() != aBtnUp.IsChecked() || - aBtnLeft.GetSavedValue() != aBtnLeft.IsChecked() || - aBtnRight.GetSavedValue() != aBtnRight.IsChecked() || - aBtnDown.GetSavedValue() != aBtnDown.IsChecked() ) - { - SdrTextAniDirection eValue = (SdrTextAniDirection) GetSelectedDirection(); - rAttrs.Put( SdrTextAniDirectionItem( eValue ) ); - bModified = sal_True; - } - - // Start inside - eState = aTsbStartInside.GetState(); - if( eState != aTsbStartInside.GetSavedValue() ) - { - rAttrs.Put( SdrTextAniStartInsideItem( (sal_Bool) STATE_CHECK == eState ) ); - bModified = sal_True; - } - - // Stop inside - eState = aTsbStopInside.GetState(); - if( eState != aTsbStopInside.GetSavedValue() ) - { - rAttrs.Put( SdrTextAniStopInsideItem( (sal_Bool) STATE_CHECK == eState ) ); - bModified = sal_True; - } - - // Anzahl - eState = aTsbEndless.GetState(); - String aStr = aNumFldCount.GetText(); - if( eState != aTsbEndless.GetSavedValue() || - aStr != aNumFldCount.GetSavedValue() ) - { - sal_Int64 nValue = 0; - if( eState == STATE_CHECK /*#89844#*/ && aTsbEndless.IsEnabled()) - bModified = sal_True; - else - { - if( aStr != aNumFldCount.GetSavedValue() ) - { - nValue = aNumFldCount.GetValue(); - bModified = sal_True; - } - } - if( bModified ) - rAttrs.Put( SdrTextAniCountItem( (sal_uInt16) nValue ) ); - } - - // Verzoegerung - eState = aTsbAuto.GetState(); - aStr = aMtrFldDelay.GetText(); - if( eState != aTsbAuto.GetSavedValue() || - aStr != aMtrFldDelay.GetSavedValue() ) - { - sal_Int64 nValue = 0; - if( eState == STATE_CHECK ) - bModified = sal_True; - else - { - if( aStr != aMtrFldDelay.GetSavedValue() ) - { - nValue = aMtrFldDelay.GetValue(); - bModified = sal_True; - } - } - if( bModified ) - rAttrs.Put( SdrTextAniDelayItem( (sal_uInt16) nValue ) ); - } - - // Schrittweite - eState = aTsbPixel.GetState(); - aStr = aMtrFldAmount.GetText(); - if( eState != aTsbPixel.GetSavedValue() || - aStr != aMtrFldAmount.GetSavedValue() ) - { - sal_Int64 nValue = 0; - if( eState == STATE_CHECK ) - { - nValue = aMtrFldAmount.GetValue(); - nValue = -nValue; - } - else - { - nValue = GetCoreValue( aMtrFldAmount, eUnit ); - } - rAttrs.Put( SdrTextAniAmountItem( (sal_Int16) nValue ) ); - - bModified = sal_True; - } - - return( bModified ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxTextAnimationPage::Construct() -{ -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16* SvxTextAnimationPage::GetRanges() -{ - return( pRanges ); -} - -/************************************************************************* -|* -|* Erzeugt die Seite -|* -\************************************************************************/ - -SfxTabPage* SvxTextAnimationPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxTextAnimationPage( pWindow, rAttrs ) ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAnimationPage, SelectEffectHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbEffect.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - eAniKind = (SdrTextAniKind) nPos; - switch( eAniKind ) - { - case SDRTEXTANI_NONE: - { - aFtDirection.Disable(); - aBtnUp.Disable(); - aBtnLeft.Disable(); - aBtnRight.Disable(); - aBtnDown.Disable(); - aTsbStartInside.Disable(); - aTsbStopInside.Disable(); - - aTsbEndless.Disable(); - aNumFldCount.Disable(); - aFtCount.Disable(); - - aTsbAuto.Disable(); - aMtrFldDelay.Disable(); - aFtDelay.Disable(); - - aTsbPixel.Disable(); - aMtrFldAmount.Disable(); - aFtAmount.Disable(); - } - break; - - case SDRTEXTANI_BLINK: - case SDRTEXTANI_SCROLL: - case SDRTEXTANI_ALTERNATE: - case SDRTEXTANI_SLIDE: - { - if( eAniKind == SDRTEXTANI_SLIDE ) - { - aTsbStartInside.Disable(); - aTsbStopInside.Disable(); - - aTsbEndless.Disable(); - aNumFldCount.Enable(); - aNumFldCount.SetValue( aNumFldCount.GetValue() ); - } - else - { - aTsbStartInside.Enable(); - aTsbStopInside.Enable(); - - aTsbEndless.Enable(); - ClickEndlessHdl_Impl( NULL ); - } - aFtCount.Enable(); - - aTsbAuto.Enable(); - aFtDelay.Enable(); - ClickAutoHdl_Impl( NULL ); - - if( eAniKind == SDRTEXTANI_BLINK ) - { - aFtDirection.Disable(); - aBtnUp.Disable(); - aBtnLeft.Disable(); - aBtnRight.Disable(); - aBtnDown.Disable(); - - aTsbPixel.Disable(); - aMtrFldAmount.Disable(); - aFtAmount.Disable(); - } - else - { - aFtDirection.Enable(); - aBtnUp.Enable(); - aBtnLeft.Enable(); - aBtnRight.Enable(); - aBtnDown.Enable(); - - aTsbPixel.Enable(); - aMtrFldAmount.Enable(); - aFtAmount.Enable(); - } - } - break; - } - - } - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAnimationPage, ClickEndlessHdl_Impl, void *, EMPTYARG ) -{ - - if( eAniKind != SDRTEXTANI_SLIDE ) - { - TriState eState = aTsbEndless.GetState(); - if( eState != STATE_NOCHECK ) - { - aNumFldCount.Disable(); - aNumFldCount.SetEmptyFieldValue(); - } - else - { - aNumFldCount.Enable(); - aNumFldCount.SetValue( aNumFldCount.GetValue() ); - } - } - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAnimationPage, ClickAutoHdl_Impl, void *, EMPTYARG ) -{ - TriState eState = aTsbAuto.GetState(); - if( eState != STATE_NOCHECK ) - { - aMtrFldDelay.Disable(); - aMtrFldDelay.SetEmptyFieldValue(); - } - else - { - aMtrFldDelay.Enable(); - aMtrFldDelay.SetValue( aMtrFldDelay.GetValue() ); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAnimationPage, ClickPixelHdl_Impl, void *, EMPTYARG ) -{ - TriState eState = aTsbPixel.GetState(); - if( eState == STATE_CHECK ) - { - sal_Int64 nValue = aMtrFldAmount.GetValue() / 10; - aMtrFldAmount.Enable(); - aMtrFldAmount.SetUnit( FUNIT_CUSTOM ); - //SetFieldUnit( aMtrFldAmount, FUNIT_CUSTOM ); - aMtrFldAmount.SetDecimalDigits( 0 ); - - aMtrFldAmount.SetSpinSize( 1 ); - aMtrFldAmount.SetMin( 1 ); - aMtrFldAmount.SetFirst( 1 ); - aMtrFldAmount.SetMax( 100 ); - aMtrFldAmount.SetLast( 100 ); - - aMtrFldAmount.SetValue( nValue ); - } - else if( eState == STATE_NOCHECK ) - { - sal_Int64 nValue = aMtrFldAmount.GetValue() * 10; - aMtrFldAmount.Enable(); - aMtrFldAmount.SetUnit( eFUnit ); - //SetFieldUnit( aMtrFldAmount, eFUnit ); - aMtrFldAmount.SetDecimalDigits( 2 ); - - aMtrFldAmount.SetSpinSize( 10 ); - aMtrFldAmount.SetMin( 1 ); - aMtrFldAmount.SetFirst( 1 ); - aMtrFldAmount.SetMax( 10000 ); - aMtrFldAmount.SetLast( 10000 ); - - aMtrFldAmount.SetValue( nValue ); - } - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAnimationPage, ClickDirectionHdl_Impl, ImageButton *, pBtn ) -{ - aBtnUp.Check( pBtn == &aBtnUp ); - aBtnLeft.Check( pBtn == &aBtnLeft ); - aBtnRight.Check( pBtn == &aBtnRight ); - aBtnDown.Check( pBtn == &aBtnDown ); - - return( 0L ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxTextAnimationPage::SelectDirection( SdrTextAniDirection nValue ) -{ - aBtnUp.Check( nValue == SDRTEXTANI_UP ); - aBtnLeft.Check( nValue == SDRTEXTANI_LEFT ); - aBtnRight.Check( nValue == SDRTEXTANI_RIGHT ); - aBtnDown.Check( nValue == SDRTEXTANI_DOWN ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16 SvxTextAnimationPage::GetSelectedDirection() -{ - sal_uInt16 nValue = 0; - - if( aBtnUp.IsChecked() ) - nValue = SDRTEXTANI_UP; - else if( aBtnLeft.IsChecked() ) - nValue = SDRTEXTANI_LEFT; - else if( aBtnRight.IsChecked() ) - nValue = SDRTEXTANI_RIGHT; - else if( aBtnDown.IsChecked() ) - nValue = SDRTEXTANI_DOWN; - - return( nValue ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/textanim.hrc b/cui/source/tabpages/textanim.hrc deleted file mode 100644 index 9fc1d207e..000000000 --- a/cui/source/tabpages/textanim.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define LB_EFFECT 1 -#define CTL_EFFECT 1 -#define TSB_START_INSIDE 1 -#define TSB_STOP_INSIDE 2 -#define FL_EFFECT 1 -#define FT_EFFECTS 1 -#define FT_DIRECTION 2 -#define FL_PROPERTIES 2 -#define FT_COUNT 3 -#define TSB_ENDLESS 3 -#define NUM_FLD_COUNT 1 -#define FT_AMOUNT 4 -#define MTR_FLD_AMOUNT 1 -#define FT_DELAY 5 -#define MTR_FLD_DELAY 2 -#define TSB_PIXEL 4 -#define TSB_AUTO 5 -#define BTN_UP 1 -#define BTN_LEFT 2 -#define BTN_RIGHT 3 -#define BTN_DOWN 4 diff --git a/cui/source/tabpages/textanim.src b/cui/source/tabpages/textanim.src deleted file mode 100644 index 212492378..000000000 --- a/cui/source/tabpages/textanim.src +++ /dev/null @@ -1,334 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // pragma ---------------------------------------------------------------- - -#include -#include -#include "textanim.hrc" -#include - -// direction image buttons -#define MA_HALFBUTTON_WIDTH 7 -#define MA_BUTTON_WIDTH (2 * MA_HALFBUTTON_WIDTH) -#define MA_BUTTON_HEIGHT (2 * MA_HALFBUTTON_WIDTH) -#define BUTTON_SIZE MAP_APPFONT( MA_BUTTON_WIDTH, MA_BUTTON_WIDTH ) -#define MA_MOVEBUT_GRACE_X 6 - -// height of first group Text effects -#define MA_EFFECTSGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + \ - RSC_SP_FLGR_INNERBORDER_LEFT + \ -/* direction buttons */ 3*MA_BUTTON_HEIGHT + \ - RSC_SP_FLGR_INNERBORDER_BOTTOM + RSC_SP_FLGR_SPACE_Y) - -// height of second group height of FIXEDTEXT -#define MA_PROPERTIESGROUP_HEIGHT (RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_LEFT + \ -/* text initially visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* text finally visible */ RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* animation runs */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* number of runs */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* step size */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* number of pixel */ RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* step delay */ RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_GROUP_Y + \ -/* delay time */ RSC_CD_TEXTBOX_HEIGHT) - - -// left space for real controls -#define MA_LEFT_SPACE (RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT) - -// tabpage total size -#define MA_TOTAL_WIDTH 260 -#define MA_TOTAL_HEIGHT RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + MA_PROPERTIESGROUP_HEIGHT + RSC_SP_TBPG_INNERBORDER_BOTTOM - -// X position and width of effects drop down -#define MA_EFFECTLIST_X 50 -#define MA_EFFECTLIST_WIDTH 95 - - - // RID_SVXPAGE_TEXTANIMATION --------------------------------------------- -TabPage RID_SVXPAGE_TEXTANIMATION -{ - HelpID = "cui:TabPage:RID_SVXPAGE_TEXTANIMATION"; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH , 185 ) ; - Text [ en-US ] = "Animation" ; - FixedLine FL_EFFECT - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT, RSC_SP_TBPG_INNERBORDER_TOP ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Text animation effects" ; - }; -#define MA_CURR_Y RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT - FixedText FT_EFFECTS - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y + 3 ) ; - Size = MAP_APPFONT ( MA_EFFECTLIST_X - RSC_SP_CTRL_DESC_X - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_FLGR_INNERBORDER_LEFT, - RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "E~ffect" ; - }; - ListBox LB_EFFECT - { - HelpID = "cui:ListBox:RID_SVXPAGE_TEXTANIMATION:LB_EFFECT"; - Border = TRUE ; - Pos = MAP_APPFONT ( MA_EFFECTLIST_X, MA_CURR_Y + 1 ) ; - Size = MAP_APPFONT ( MA_EFFECTLIST_WIDTH , 57 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "No Effect" ; Default ; > ; - < "Blink" ; Default ; > ; - < "Scroll Through" ; Default ; > ; - < "Scroll Back and Forth" ; Default ; > ; - < "Scroll In" ; Default ; > ; - }; - }; - FixedText FT_DIRECTION - { - Pos = MAP_APPFONT ( MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X, MA_CURR_Y + 3 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - - (MA_MOVEBUT_GRACE_X + 3*MA_BUTTON_WIDTH + RSC_SP_TBPG_INNERBORDER_RIGHT + RSC_SP_FLGR_INNERBORDER_RIGHT) - - (MA_EFFECTLIST_X + MA_EFFECTLIST_WIDTH + RSC_SP_CTRL_X + RSC_SP_CTRL_DESC_X + 6), - RSC_CD_FIXEDTEXT_HEIGHT ) ; - Right = TRUE; - Text [ en-US ] = "Direction" ; - }; - ImageButton BTN_UP - { - HelpID = "cui:ImageButton:RID_SVXPAGE_TEXTANIMATION:BTN_UP"; - Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, - RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP ); - Size = BUTTON_SIZE ; - Symbol = IMAGEBUTTON_ARROW_UP ; - QuickHelpText [ en-US ] = "To Top" ; - }; - ImageButton BTN_LEFT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_TEXTANIMATION:BTN_LEFT"; - Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 3*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, - RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT); - Size = BUTTON_SIZE ; - Symbol = IMAGEBUTTON_ARROW_LEFT ; - QuickHelpText [ en-US ] = "To Left" ; - }; - ImageButton BTN_RIGHT - { - HelpID = "cui:ImageButton:RID_SVXPAGE_TEXTANIMATION:BTN_RIGHT"; - Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, - RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + MA_BUTTON_HEIGHT ) ; - Size = BUTTON_SIZE ; - Symbol = IMAGEBUTTON_ARROW_RIGHT ; - QuickHelpText [ en-US ] = "To Right" ; - }; - ImageButton BTN_DOWN - { - HelpID = "cui:ImageButton:RID_SVXPAGE_TEXTANIMATION:BTN_DOWN"; - Pos = MAP_APPFONT ( MA_TOTAL_WIDTH - MA_MOVEBUT_GRACE_X - 2*MA_BUTTON_WIDTH - RSC_SP_TBPG_INNERBORDER_RIGHT - RSC_SP_FLGR_INNERBORDER_RIGHT, - RSC_SP_TBPG_INNERBORDER_TOP + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP + 2*MA_BUTTON_HEIGHT ) ; - Size = BUTTON_SIZE ; - Symbol = IMAGEBUTTON_ARROW_DOWN ; - QuickHelpText [ en-US ] = "To Bottom" ; - }; - - FixedLine FL_PROPERTIES - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT , RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT, RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Properties" ; - }; -#define MA_CURR_Y2 RSC_SP_TBPG_INNERBORDER_TOP + MA_EFFECTSGROUP_HEIGHT + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - TriStateBox TSB_START_INSIDE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTANIMATION:TSB_START_INSIDE"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y2 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "S~tart inside" ; - }; -#define MA_CURR_Y3 MA_CURR_Y2 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - TriStateBox TSB_STOP_INSIDE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTANIMATION:TSB_STOP_INSIDE"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y3 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, RSC_CD_CHECKBOX_HEIGHT ); - Text [ en-US ] = "Text visible when exiting" ; - }; -#define MA_CURR_Y4 MA_CURR_Y3 + RSC_CD_CHECKBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - FixedText FT_COUNT - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y4 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, - RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Animation cycles" ; - }; -#define MA_CURR_Y5 MA_CURR_Y4 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - TriStateBox TSB_ENDLESS - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTANIMATION:TSB_ENDLESS"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y5 + 2 ) ; - Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "~Continuous" ; - }; - NumericField NUM_FLD_COUNT - { - HelpID = "cui:NumericField:RID_SVXPAGE_TEXTANIMATION:NUM_FLD_COUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, - MA_CURR_Y5 ) ; - Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - First = 1 ; - }; -#define MA_CURR_Y6 MA_CURR_Y5 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - FixedText FT_AMOUNT - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y6 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, - RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Increment" ; - }; -#define MA_CURR_Y7 MA_CURR_Y6 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - TriStateBox TSB_PIXEL - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTANIMATION:TSB_PIXEL"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y7 + 2 ) ; - Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; - Text [ en-US ] = "~Pixels" ; - }; - MetricField MTR_FLD_AMOUNT - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTANIMATION:MTR_FLD_AMOUNT"; - Border = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, - MA_CURR_Y7 ) ; - Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " Pixel" ; - Minimum = 1 ; - First = 1 ; - Maximum = 10000 ; - Last = 10000 ; - }; -#define MA_CURR_Y8 MA_CURR_Y7 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_GROUP_Y - FixedText FT_DELAY - { - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT, MA_CURR_Y8 ) ; - Size = MAP_APPFONT ( MA_TOTAL_WIDTH - RSC_SP_TBPG_INNERBORDER_LEFT - RSC_SP_TBPG_INNERBORDER_RIGHT - 12, - RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "Delay" ; - }; -#define MA_CURR_Y9 MA_CURR_Y8 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_FLGR_INNERBORDER_TOP - TriStateBox TSB_AUTO - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTANIMATION:TSB_AUTO"; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 9 , MA_CURR_Y9 + 2 ) ; - Size = MAP_APPFONT ( 71 , RSC_CD_CHECKBOX_HEIGHT ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Automatic" ; - }; - MetricField MTR_FLD_DELAY - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTANIMATION:MTR_FLD_DELAY"; - Border = TRUE ; - Pos = MAP_APPFONT ( RSC_SP_TBPG_INNERBORDER_LEFT + RSC_SP_FLGR_INNERBORDER_LEFT + 80 + RSC_SP_CTRL_GROUP_X, - MA_CURR_Y9 ) ; - Size = MAP_APPFONT ( 50 , RSC_CD_TEXTBOX_HEIGHT ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Spinsize = 50 ; - StrictFormat = TRUE ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " ms" ; - Maximum = 30000 ; - Last = 30000 ; - }; -}; - // RID_SVXDLG_TEXT ------------------------------------------------------- -TabDialog RID_SVXDLG_TEXT -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 289 , 185 + 46 ) ; - Text [ en-US ] = "Text" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , 185 ) ; - PageList = - { - PageItem - { - PageResID = RID_SVXPAGE_TEXTATTR ; - Identifier = RID_SVXPAGE_TEXTATTR ; - Text [ en-US ] = "Text" ; - }; - PageItem - { - PageResID = RID_SVXPAGE_TEXTANIMATION ; - Identifier = RID_SVXPAGE_TEXTANIMATION ; - Text [ en-US ] = "Text Animation" ; - }; - }; - }; -}; - // ******************************************************************* EOF - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx deleted file mode 100644 index f9634b6d8..000000000 --- a/cui/source/tabpages/textattr.cxx +++ /dev/null @@ -1,767 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _SVX_TEXTATTR_CXX -#define _SVX_TEXTATTR_CXX -#endif -#include "textattr.hxx" -#include "textattr.hrc" -#include -#include "svx/dlgutil.hxx" -#include -#include -#include - -static sal_uInt16 pRanges[] = -{ - SDRATTR_MISC_FIRST, SDRATTR_TEXT_HORZADJUST, - SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE, - 0 -}; - -/************************************************************************* -|* -|* Dialog (Seite) zum Kopieren von Objekten -|* -\************************************************************************/ - -SvxTextAttrPage::SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pWindow, CUI_RES( RID_SVXPAGE_TEXTATTR ), - rInAttrs ), - - aFlText ( this, CUI_RES( FL_TEXT ) ), - aTsbAutoGrowWidth ( this, CUI_RES( TSB_AUTOGROW_WIDTH ) ), - aTsbAutoGrowHeight ( this, CUI_RES( TSB_AUTOGROW_HEIGHT ) ), - aTsbFitToSize ( this, CUI_RES( TSB_FIT_TO_SIZE ) ), - aTsbContour ( this, CUI_RES( TSB_CONTOUR ) ), - aTsbWordWrapText( this, CUI_RES( TSB_WORDWRAP_TEXT ) ), - aTsbAutoGrowSize( this, CUI_RES( TSB_AUTOGROW_SIZE ) ), - aFlDistance ( this, CUI_RES( FL_DISTANCE ) ), - aFtLeft ( this, CUI_RES( FT_LEFT ) ), - aMtrFldLeft ( this, CUI_RES( MTR_FLD_LEFT ) ), - aFtRight ( this, CUI_RES( FT_RIGHT ) ), - aMtrFldRight ( this, CUI_RES( MTR_FLD_RIGHT ) ), - aFtTop ( this, CUI_RES( FT_TOP ) ), - aMtrFldTop ( this, CUI_RES( MTR_FLD_TOP ) ), - aFtBottom ( this, CUI_RES( FT_BOTTOM ) ), - aMtrFldBottom ( this, CUI_RES( MTR_FLD_BOTTOM ) ), - - aFlSeparator ( this, CUI_RES( FL_SEPARATOR ) ), - - aFlPosition ( this, CUI_RES( FL_POSITION ) ), - aCtlPosition ( this, CUI_RES( CTL_POSITION ), - RP_MM, 240, 100 ), - aTsbFullWidth ( this, CUI_RES( TSB_FULL_WIDTH ) ), - - rOutAttrs ( rInAttrs ) -{ - FreeResource(); - - FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - SetFieldUnit( aMtrFldLeft, eFUnit ); - SetFieldUnit( aMtrFldRight, eFUnit ); - SetFieldUnit( aMtrFldTop, eFUnit ); - SetFieldUnit( aMtrFldBottom, eFUnit ); - - Link aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) ); - aTsbAutoGrowWidth.SetClickHdl( aLink ); - aTsbAutoGrowHeight.SetClickHdl( aLink ); - aTsbFitToSize.SetClickHdl( aLink ); - aTsbContour.SetClickHdl( aLink ); - - aTsbFullWidth.SetClickHdl( - LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) ); - - aCtlPosition.SetAccessibleRelationMemberOf( &aFlPosition ); -} - -/************************************************************************* -|* -|* Dtor -|* -\************************************************************************/ - -SvxTextAttrPage::~SvxTextAttrPage() -{ -} - -/************************************************************************* -|* -|* Liest uebergebenen Item-Set -|* -\************************************************************************/ - -void SvxTextAttrPage::Reset( const SfxItemSet& rAttrs ) -{ - SfxItemPool* pPool = rAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); - - // Linker Abstand vom Rahmen - const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_LEFTDIST ); - - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST ); - if( pItem ) - { - long nValue = ( ( const SdrTextLeftDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldLeft, nValue, eUnit ); - } - else - aMtrFldLeft.SetText( String() ); - aMtrFldLeft.SaveValue(); - - // Rechter Abstand vom Rahmen - pItem = GetItem( rAttrs, SDRATTR_TEXT_RIGHTDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST ); - if( pItem ) - { - long nValue = ( ( const SdrTextRightDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldRight, nValue, eUnit ); - } - else - aMtrFldRight.SetText( String() ); - aMtrFldRight.SaveValue(); - - // Oberer Abstand vom Rahmen - pItem = GetItem( rAttrs, SDRATTR_TEXT_UPPERDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST ); - if( pItem ) - { - long nValue = ( ( const SdrTextUpperDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldTop, nValue, eUnit ); - } - else - aMtrFldTop.SetText( String() ); - aMtrFldTop.SaveValue(); - - // Unterer Abstand vom Rahmen - pItem = GetItem( rAttrs, SDRATTR_TEXT_LOWERDIST ); - if( !pItem ) - pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST ); - if( pItem ) - { - long nValue = ( ( const SdrTextLowerDistItem* )pItem )->GetValue(); - SetMetricValue( aMtrFldBottom, nValue, eUnit ); - } - else - aMtrFldBottom.SetText( String() ); - aMtrFldBottom.SaveValue(); - - // An Hoehe anpassen - if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SFX_ITEM_DONTCARE ) - { - aTsbAutoGrowHeight.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbAutoGrowHeight.EnableTriState( sal_False ); - } - else - aTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); - aTsbAutoGrowHeight.SaveValue(); - - // An Breite anpassen - if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SFX_ITEM_DONTCARE ) - { - aTsbAutoGrowWidth.SetState( ( ( const SdrTextAutoGrowWidthItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWWIDTH ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbAutoGrowWidth.EnableTriState( sal_False ); - } - else - aTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); - aTsbAutoGrowWidth.SaveValue(); - - // autogrowsize - if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWSIZE ) != SFX_ITEM_DONTCARE ) - { - aTsbAutoGrowSize.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbAutoGrowSize.EnableTriState( sal_False ); - } - else - aTsbAutoGrowSize.SetState( STATE_DONTKNOW ); - aTsbAutoGrowSize.SaveValue(); - - // wordwrap text - if ( rAttrs.GetItemState( SDRATTR_TEXT_WORDWRAP ) != SFX_ITEM_DONTCARE ) - { - aTsbWordWrapText.SetState( ( ( const SdrTextWordWrapItem& )rAttrs.Get( SDRATTR_TEXT_WORDWRAP ) ). - GetValue() ? STATE_CHECK : STATE_NOCHECK ); - aTsbWordWrapText.EnableTriState( sal_False ); - } - else - aTsbWordWrapText.SetState( STATE_DONTKNOW ); - aTsbWordWrapText.SaveValue(); - - - // #103516# Do the setup based on states of hor/ver adjust - // Setup center field and FullWidth - SfxItemState eVState = rAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); - SfxItemState eHState = rAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); - - if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) - { - // VertAdjust and HorAdjust are unequivocal, thus - SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)rAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); - SdrTextHorzAdjust eTHA = (SdrTextHorzAdjust)((const SdrTextHorzAdjustItem&)rAttrs.Get(SDRATTR_TEXT_HORZADJUST)).GetValue(); - RECT_POINT eRP = RP_LB; - - aTsbFullWidth.EnableTriState( sal_False ); - - // Translate item values into local anchor position. - switch (eTVA) - { - case SDRTEXTVERTADJUST_TOP: - { - switch (eTHA) - { - case SDRTEXTHORZADJUST_LEFT: eRP = RP_LT; break; - case SDRTEXTHORZADJUST_BLOCK: - case SDRTEXTHORZADJUST_CENTER: eRP = RP_MT; break; - case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RT; break; - } - break; - } - case SDRTEXTVERTADJUST_BLOCK: - case SDRTEXTVERTADJUST_CENTER: - { - switch (eTHA) - { - case SDRTEXTHORZADJUST_LEFT: eRP = RP_LM; break; - case SDRTEXTHORZADJUST_BLOCK: - case SDRTEXTHORZADJUST_CENTER: eRP = RP_MM; break; - case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RM; break; - } - break; - } - case SDRTEXTVERTADJUST_BOTTOM: - { - switch (eTHA) - { - case SDRTEXTHORZADJUST_LEFT: eRP = RP_LB; break; - case SDRTEXTHORZADJUST_BLOCK: - case SDRTEXTHORZADJUST_CENTER: eRP = RP_MB; break; - case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RB; break; - } - break; - } - default: - break; - } - - // See if we have to check the "full width" check button. - sal_Bool bLeftToRight(IsTextDirectionLeftToRight()); - - if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA))) - { - // Move anchor to valid position. - ClickFullWidthHdl_Impl(NULL); - aTsbFullWidth.SetState(STATE_CHECK); - } - - aCtlPosition.SetActualRP( eRP ); - } - else - { - // VertAdjust or HorAdjust is not unequivocal - aCtlPosition.Reset(); - - aCtlPosition.SetState(STATE_DONTKNOW); - aCtlPosition.DoCompletelyDisable(sal_True); - - aTsbFullWidth.SetState(STATE_DONTKNOW); - aTsbFullWidth.Enable( sal_False ); - aFlPosition.Enable( sal_False ); - } - - // Am Rahmen anpassen - if ( rAttrs.GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SFX_ITEM_DONTCARE ) - { - SdrFitToSizeType eFTS = (SdrFitToSizeType) - ( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue(); - aTsbFitToSize.SetState( eFTS == SDRTEXTFIT_NONE ? STATE_NOCHECK : STATE_CHECK ); - aTsbFitToSize.EnableTriState( sal_False ); - } - else - aTsbFitToSize.SetState( STATE_DONTKNOW ); - aTsbFitToSize.SaveValue(); - - // Konturfluss - if( rAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SFX_ITEM_DONTCARE ) - { - sal_Bool bContour = ( ( const SdrTextContourFrameItem& )rAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); - aTsbContour.SetState( bContour ? STATE_CHECK : STATE_NOCHECK ); - aTsbContour.EnableTriState( sal_False ); - } - else - aTsbContour.SetState( STATE_DONTKNOW ); - aTsbContour.SaveValue(); - - ClickHdl_Impl( NULL ); -} - -/************************************************************************* -|* -|* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen -|* -\************************************************************************/ - -sal_Bool SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs) -{ - SfxItemPool* pPool = rAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool" ); - SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST ); - - sal_Int32 nValue; - TriState eState; - - if( aMtrFldLeft.GetText() != aMtrFldLeft.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldLeft, eUnit ); - rAttrs.Put( SdrTextLeftDistItem( nValue ) ); - } - - if( aMtrFldRight.GetText() != aMtrFldRight.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldRight, eUnit ); - rAttrs.Put( SdrTextRightDistItem( nValue ) ); - } - - if( aMtrFldTop.GetText() != aMtrFldTop.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldTop, eUnit ); - rAttrs.Put( SdrTextUpperDistItem( nValue ) ); - } - - if( aMtrFldBottom.GetText() != aMtrFldBottom.GetSavedValue() ) - { - nValue = GetCoreValue( aMtrFldBottom, eUnit ); - rAttrs.Put( SdrTextLowerDistItem( nValue ) ); - } - - eState = aTsbAutoGrowHeight.GetState(); - if( eState != aTsbAutoGrowHeight.GetSavedValue() ) - { - rAttrs.Put( SdrTextAutoGrowHeightItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - eState = aTsbAutoGrowWidth.GetState(); - if( eState != aTsbAutoGrowWidth.GetSavedValue() ) - { - rAttrs.Put( SdrTextAutoGrowWidthItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - eState = aTsbAutoGrowSize.GetState(); - if( eState != aTsbAutoGrowSize.GetSavedValue() ) - { - rAttrs.Put( SdrTextAutoGrowHeightItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - eState = aTsbWordWrapText.GetState(); - if( eState != aTsbWordWrapText.GetSavedValue() ) - { - rAttrs.Put( SdrTextWordWrapItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - // Konturfluss - eState = aTsbContour.GetState(); - if( eState != aTsbContour.GetSavedValue() ) - { - rAttrs.Put( SdrTextContourFrameItem( (sal_Bool) STATE_CHECK == eState ) ); - } - - eState = aTsbFitToSize.GetState(); - if( eState != aTsbFitToSize.GetSavedValue() ) - { - SdrFitToSizeType eFTS; - switch( eState ) - { - default: ; //prevent warning - OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" ); - case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break; - case STATE_CHECK: eFTS = SDRTEXTFIT_AUTOFIT; break; - } - rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) ); - } - - // zentriert - RECT_POINT eRP = aCtlPosition.GetActualRP(); - SdrTextVertAdjust eTVA, eOldTVA; - SdrTextHorzAdjust eTHA, eOldTHA; - - switch( eRP ) - { - default: - case RP_LT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RP_LM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RP_LB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_LEFT; break; - case RP_MT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RP_MM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RP_MB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_CENTER; break; - case RP_RT: eTVA = SDRTEXTVERTADJUST_TOP; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - case RP_RM: eTVA = SDRTEXTVERTADJUST_CENTER; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - case RP_RB: eTVA = SDRTEXTVERTADJUST_BOTTOM; - eTHA = SDRTEXTHORZADJUST_RIGHT; break; - } - - // #103516# Do not change values if adjust controls were disabled. - sal_Bool bIsDisabled(aCtlPosition.IsCompletelyDisabled()); - - if(!bIsDisabled) - { - if( aTsbFullWidth.GetState() == STATE_CHECK ) - { - if (IsTextDirectionLeftToRight()) - eTHA = SDRTEXTHORZADJUST_BLOCK; - else - eTVA = SDRTEXTVERTADJUST_BLOCK; - } - - if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE ) - { - eOldTVA = (SdrTextVertAdjust) - ( ( const SdrTextVertAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue(); - if( eOldTVA != eTVA ) - rAttrs.Put( SdrTextVertAdjustItem( eTVA ) ); - } - else - rAttrs.Put( SdrTextVertAdjustItem( eTVA ) ); - - if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SFX_ITEM_DONTCARE ) - { - eOldTHA = (SdrTextHorzAdjust) - ( ( const SdrTextHorzAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue(); - if( eOldTHA != eTHA ) - rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) ); - } - else - rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) ); - } - - return( sal_True ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void SvxTextAttrPage::Construct() -{ - DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); - - bFitToSizeEnabled = bContourEnabled = sal_True; - bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = sal_False; - - const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); - if( rMarkList.GetMarkCount() == 1 ) - { - const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier(); - if( pObj->GetObjInventor() == SdrInventor ) - { - switch( eKind ) - { - case OBJ_TEXT : - case OBJ_TITLETEXT : - case OBJ_OUTLINETEXT : - case OBJ_CAPTION : - { - if ( ((SdrTextObj*)pObj)->HasText() ) - { - // Konturfluss ist NICHT bei reinen Textobjekten m�glich - bContourEnabled = sal_False; - - // Breite und Hoehe anpassen ist NUR bei reinen Textobjekten m�glich - bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = sal_True; - } - } - break; - case OBJ_CUSTOMSHAPE : - { - bFitToSizeEnabled = bContourEnabled = sal_False; - bAutoGrowSizeEnabled = sal_True; - bWordWrapTextEnabled = sal_True; - } - break; - default: ;//prevent warning - } - } - } - aTsbAutoGrowHeight.Enable( bAutoGrowHeightEnabled ); - aTsbAutoGrowWidth.Enable( bAutoGrowWidthEnabled ); - aTsbFitToSize.Enable( bFitToSizeEnabled ); - aTsbContour.Enable( bContourEnabled ); - aTsbAutoGrowSize.Enable( bAutoGrowSizeEnabled ); - aTsbWordWrapText.Enable( bWordWrapTextEnabled ); -} - -/************************************************************************* -|* -|* Erzeugt die Seite -|* -\************************************************************************/ - -SfxTabPage* SvxTextAttrPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxTextAttrPage( pWindow, rAttrs ) ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -sal_uInt16* SvxTextAttrPage::GetRanges() -{ - return( pRanges ); -} - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -/** Check whether we have to uncheck the "Full width" check box. -*/ -void SvxTextAttrPage::PointChanged( Window*, RECT_POINT eRP ) -{ - if (aTsbFullWidth.GetState() == STATE_CHECK) - { - // Depending on write direction and currently checked anchor we have - // to uncheck the "full width" button. - if (IsTextDirectionLeftToRight()) - switch( eRP ) - { - case RP_LT: - case RP_LM: - case RP_LB: - case RP_RT: - case RP_RM: - case RP_RB: - aTsbFullWidth.SetState( STATE_NOCHECK ); - break; - default: ;//prevent warning - } - else - switch (eRP) - { - case RP_LT: - case RP_MT: - case RP_RT: - case RP_LB: - case RP_MB: - case RP_RB: - aTsbFullWidth.SetState( STATE_NOCHECK ); - break; - default: ;//prevent warning - } - } -} - -/************************************************************************* -|* -|* Aendert evtl. die Position des Positions-Controls -|* -\************************************************************************/ - -/** When switching the "full width" check button on the text anchor may have - to be moved to a valid and adjacent position. This position depends on - the current anchor position and the text writing direction. -*/ -IMPL_LINK( SvxTextAttrPage, ClickFullWidthHdl_Impl, void *, EMPTYARG ) -{ - if( aTsbFullWidth.GetState() == STATE_CHECK ) - { - if (IsTextDirectionLeftToRight()) - { - // Move text anchor to horizontal middle axis. - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: - case RP_RT: - aCtlPosition.SetActualRP( RP_MT ); - break; - - case RP_LM: - case RP_RM: - aCtlPosition.SetActualRP( RP_MM ); - break; - - case RP_LB: - case RP_RB: - aCtlPosition.SetActualRP( RP_MB ); - break; - default: ;//prevent warning - } - } - else - { - // Move text anchor to vertical middle axis. - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: - case RP_LB: - aCtlPosition.SetActualRP( RP_LM ); - break; - - case RP_MT: - case RP_MB: - aCtlPosition.SetActualRP( RP_MM ); - break; - - case RP_RT: - case RP_RB: - aCtlPosition.SetActualRP( RP_RM ); - break; - default: ;//prevent warning - } - } - } - return( 0L ); -} - -/************************************************************************* -|* -|* Enabled/Disabled "Groesse an Text" oder "Am Rahmen Anpassen" -|* -\************************************************************************/ - -IMPL_LINK( SvxTextAttrPage, ClickHdl_Impl, void *, EMPTYARG ) -{ - sal_Bool bAutoGrowWidth = aTsbAutoGrowWidth.GetState() == STATE_CHECK; - sal_Bool bAutoGrowHeight = aTsbAutoGrowHeight.GetState() == STATE_CHECK; - sal_Bool bFitToSize = aTsbFitToSize.GetState() == STATE_CHECK; - sal_Bool bContour = aTsbContour.GetState() == STATE_CHECK; - - aTsbContour.Enable( !bFitToSize && - !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) && - bContourEnabled ); - - aTsbAutoGrowWidth.Enable( !bFitToSize && - !( bContour && bContourEnabled ) && - bAutoGrowWidthEnabled ); - - aTsbAutoGrowHeight.Enable( !bFitToSize && - !( bContour && bContourEnabled ) && - bAutoGrowHeightEnabled ); - - aTsbFitToSize.Enable( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) && - !( bContour && bContourEnabled ) && - bFitToSizeEnabled ); - - // #101901# enable/disable metric fields and decorations dependent of contour - aMtrFldLeft.Enable(!bContour); - aMtrFldRight.Enable(!bContour); - aMtrFldTop.Enable(!bContour); - aMtrFldBottom.Enable(!bContour); - aFlDistance.Enable(!bContour); - aFtLeft.Enable(!bContour); - aFtRight.Enable(!bContour); - aFtTop.Enable(!bContour); - aFtBottom.Enable(!bContour); - - if( bContour && bContourEnabled ) - { - aMtrFldLeft.SetValue( 0 ); - aMtrFldRight.SetValue( 0 ); - aMtrFldTop.SetValue( 0 ); - aMtrFldBottom.SetValue( 0 ); - } - - // #103516# Do the setup based on states of hor/ver adjust - SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); - SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); - sal_Bool bHorAndVer(SFX_ITEM_DONTCARE == eVState || SFX_ITEM_DONTCARE == eHState); - - // #83698# enable/disable text anchoring dependent of contour - aCtlPosition.Enable(!bContour && !bHorAndVer); - aTsbFullWidth.Enable(!bContour && !bHorAndVer); - aFlPosition.Enable(!bContour && !bHorAndVer); - - return( 0L ); -} - - -bool SvxTextAttrPage::IsTextDirectionLeftToRight (void) const -{ - // Determine the text writing direction with left to right as default. - bool bLeftToRightDirection = true; - SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION); - - if(SFX_ITEM_DONTCARE != eState) - { - const SvxWritingModeItem& rItem = static_cast ( - rOutAttrs.Get (SDRATTR_TEXTDIRECTION)); - if (rItem.GetValue() == com::sun::star::text::WritingMode_TB_RL) - bLeftToRightDirection = false; - } - return bLeftToRightDirection; -} - -void SvxTextAttrPage::PageCreated(SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pViewItem,OfaPtrItem,SID_SVXTEXTATTRPAGE_VIEW,sal_False); - - if (pViewItem) - SetView( static_cast(pViewItem->GetValue())); - - Construct(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/textattr.hrc b/cui/source/tabpages/textattr.hrc deleted file mode 100644 index 70d4512c5..000000000 --- a/cui/source/tabpages/textattr.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define FL_TEXT 2 -#define FL_DISTANCE 1 -#define FL_POSITION 3 -#define FL_SEPARATOR 4 -#define TSB_AUTOGROW_HEIGHT 1 -#define TSB_AUTOGROW_WIDTH 2 -#define TSB_FIT_TO_SIZE 3 -#define TSB_FULL_WIDTH 4 -#define TSB_CONTOUR 5 -#define TSB_WORDWRAP_TEXT 6 -#define TSB_AUTOGROW_SIZE 7 -#define CTL_POSITION 1 -#define FT_LEFT 1 -#define MTR_FLD_LEFT 1 -#define FT_RIGHT 2 -#define MTR_FLD_RIGHT 2 -#define FT_TOP 3 -#define MTR_FLD_TOP 3 -#define FT_BOTTOM 4 -#define MTR_FLD_BOTTOM 4 diff --git a/cui/source/tabpages/textattr.src b/cui/source/tabpages/textattr.src deleted file mode 100644 index 45e5e9cb7..000000000 --- a/cui/source/tabpages/textattr.src +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include --------------------------------------------------------------- -#include -#include -#include "textattr.hrc" -#include "helpid.hrc" -#include - - // RID_SVXPAGE_TEXTATTR -------------------------------------------------- -TabPage RID_SVXPAGE_TEXTATTR -{ - HelpId = HID_PAGE_TEXTATTR ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , 185 ) ; - Text [ en-US ] = "Text" ; - FixedLine FL_TEXT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Text" ; - }; - TriStateBox TSB_AUTOGROW_WIDTH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_AUTOGROW_WIDTH"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 102 , 10 ) ; - Text [ en-US ] = "Fit wi~dth to text" ; - }; - TriStateBox TSB_AUTOGROW_HEIGHT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_AUTOGROW_HEIGHT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 102 , 10 ) ; - Text [ en-US ] = "Fit h~eight to text" ; - }; - TriStateBox TSB_FIT_TO_SIZE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_FIT_TO_SIZE"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 42 ) ; - Size = MAP_APPFONT ( 102 , 10 ) ; - Text [ en-US ] = "~Fit to frame" ; - }; - TriStateBox TSB_CONTOUR - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_CONTOUR"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 102 , 10 ) ; - Text [ en-US ] = "~Adjust to contour" ; - }; - TriStateBox TSB_WORDWRAP_TEXT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_WORDWRAP_TEXT"; - TabStop = TRUE; - Pos = MAP_APPFONT( 132, 14 ) ; - Size = MAP_APPFONT( 127 , 10 ) ; - Text [ en-US ] = "~Word wrap text in shape"; - }; - TriStateBox TSB_AUTOGROW_SIZE - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_AUTOGROW_SIZE"; - TabStop = TRUE; - Pos = MAP_APPFONT( 132, 28 ); - Size = MAP_APPFONT( 127 , 10 ); - Text [ en-US ] = "~Resize shape to fit text"; - }; - FixedLine FL_DISTANCE - { - Pos = MAP_APPFONT ( 6 , 72 ) ; - Size = MAP_APPFONT ( 114 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Spacing to borders" ; - }; - FixedText FT_LEFT - { - Pos = MAP_APPFONT ( 12 , 85 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Left" ; - }; - FixedText FT_RIGHT - { - Pos = MAP_APPFONT ( 12 , 101 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Right" ; - }; - FixedText FT_TOP - { - Pos = MAP_APPFONT ( 12 , 117 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Top" ; - }; - FixedText FT_BOTTOM - { - Pos = MAP_APPFONT ( 12 , 133 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "~Bottom" ; - }; - MetricField MTR_FLD_LEFT - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTATTR:MTR_FLD_LEFT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 69 , 83 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_RIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTATTR:MTR_FLD_RIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 69 , 99 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_TOP - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTATTR:MTR_FLD_TOP"; - Border = TRUE ; - Pos = MAP_APPFONT ( 69 , 115 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_BOTTOM - { - HelpID = "cui:MetricField:RID_SVXPAGE_TEXTATTR:MTR_FLD_BOTTOM"; - Border = TRUE ; - Pos = MAP_APPFONT ( 69 , 131 ) ; - Size = MAP_APPFONT ( 45 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - Minimum = -10000 ; - First = -10000 ; - Maximum = 10000 ; - Last = 10000 ; - SpinSize = 10 ; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 121 , 83 ) ; - Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 66 ) ; - Vert = TRUE; - }; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 126 , 72 ) ; - Size = MAP_APPFONT ( 128 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Text anchor" ; - }; - Control CTL_POSITION - { - HelpId = HID_TEXTATTR_CTL_POSITION ; - Border = TRUE ; - Pos = MAP_APPFONT ( 132 , 83 ) ; - Size = MAP_APPFONT ( 116 , 52 ) ; - TabStop = TRUE ; - }; - TriStateBox TSB_FULL_WIDTH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_TEXTATTR:TSB_FULL_WIDTH"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( 132 , 139 ) ; - Size = MAP_APPFONT ( 116 , 10 ) ; - Text [ en-US ] = "Full ~width" ; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx deleted file mode 100644 index 633e63c70..000000000 --- a/cui/source/tabpages/tparea.cxx +++ /dev/null @@ -1,2537 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include - -#define _SVX_TPAREA_CXX - -#if defined (UNX) || defined (ICC) || defined(WNT) -#include -#endif - -#include "svx/xattr.hxx" -#include -#include -#include "tabarea.hrc" -#include -#include -#include -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "dlgname.hxx" -#include -#include "svx/dlgutil.hxx" -#include -#include -#include "paragrph.hrc" -#define DLGWIN this->GetParent()->GetParent() - -// static ---------------------------------------------------------------- - -static sal_uInt16 pAreaRanges[] = -{ - XATTR_GRADIENTSTEPCOUNT, - XATTR_GRADIENTSTEPCOUNT, - SID_ATTR_FILL_STYLE, - SID_ATTR_FILL_BITMAP, - 0 -}; - -static sal_uInt16 pTransparenceRanges[] = -{ - XATTR_FILLTRANSPARENCE, - XATTR_FILLTRANSPARENCE, - SDRATTR_SHADOWTRANSPARENCE, - SDRATTR_SHADOWTRANSPARENCE, - XATTR_FILLFLOATTRANSPARENCE, - XATTR_FILLFLOATTRANSPARENCE, - 0 -}; - -/************************************************************************* -|* -|* Dialog for transparence -|* -\************************************************************************/ - -IMPL_LINK(SvxTransparenceTabPage, ClickTransOffHdl_Impl, void *, EMPTYARG) -{ - // disable all other controls - ActivateLinear(sal_False); - ActivateGradient(sal_False); - - // Preview - rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); - rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - InvalidatePreview( sal_False ); - - return( 0L ); -} - -IMPL_LINK(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, void *, EMPTYARG) -{ - // enable linear, disable other - ActivateLinear(sal_True); - ActivateGradient(sal_False); - - // preview - rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); - ModifyTransparentHdl_Impl (NULL); - - return( 0L ); -} - -IMPL_LINK(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, void *, EMPTYARG) -{ - // enable gradient, disable other - ActivateLinear(sal_False); - ActivateGradient(sal_True); - - // preview - rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); - ModifiedTrgrHdl_Impl (NULL); - - return( 0L ); -} - -void SvxTransparenceTabPage::ActivateLinear(sal_Bool bActivate) -{ - aMtrTransparent.Enable(bActivate); -} - -IMPL_LINK(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, void*, EMPTYARG) -{ - sal_uInt16 nPos = (sal_uInt16)aMtrTransparent.GetValue(); - XFillTransparenceItem aItem(nPos); - rXFSet.Put(XFillTransparenceItem(aItem)); - - // preview - InvalidatePreview(); - - return 0L; -} - -IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl) -{ - if(pControl == &aLbTrgrGradientType || pControl == this) - { - XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); - SetControlState_Impl( eXGS ); - } - - // preview - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrStartValue.GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrEndValue.GetValue() * 255) / 100); - XGradient aTmpGradient( - Color(nStartCol, nStartCol, nStartCol), - Color(nEndCol, nEndCol, nEndCol), - (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), - (sal_uInt16)aMtrTrgrAngle.GetValue() * 10, - (sal_uInt16)aMtrTrgrCenterX.GetValue(), - (sal_uInt16)aMtrTrgrCenterY.GetValue(), - (sal_uInt16)aMtrTrgrBorder.GetValue(), - 100, 100); - - String aString; - XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); - rXFSet.Put ( aItem ); - - InvalidatePreview(); - - return( 0L ); -} - -void SvxTransparenceTabPage::ActivateGradient(sal_Bool bActivate) -{ - aFtTrgrType.Enable(bActivate); - aLbTrgrGradientType.Enable(bActivate); - aFtTrgrCenterX.Enable(bActivate); - aMtrTrgrCenterX.Enable(bActivate); - aFtTrgrCenterY.Enable(bActivate); - aMtrTrgrCenterY.Enable(bActivate); - aFtTrgrAngle.Enable(bActivate); - aMtrTrgrAngle.Enable(bActivate); - aFtTrgrBorder.Enable(bActivate); - aMtrTrgrBorder.Enable(bActivate); - aFtTrgrStartValue.Enable(bActivate); - aMtrTrgrStartValue.Enable(bActivate); - aFtTrgrEndValue.Enable(bActivate); - aMtrTrgrEndValue.Enable(bActivate); - - if(bActivate) - { - XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); - SetControlState_Impl( eXGS ); - } -} - -IMPL_LINK(SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) -{ - return( 0L ); -} - -void SvxTransparenceTabPage::SetControlState_Impl(XGradientStyle eXGS) -{ - switch(eXGS) - { - case XGRAD_LINEAR: - case XGRAD_AXIAL: - aFtTrgrCenterX.Disable(); - aMtrTrgrCenterX.Disable(); - aFtTrgrCenterY.Disable(); - aMtrTrgrCenterY.Disable(); - aFtTrgrAngle.Enable(); - aMtrTrgrAngle.Enable(); - break; - - case XGRAD_RADIAL: - aFtTrgrCenterX.Enable(); - aMtrTrgrCenterX.Enable(); - aFtTrgrCenterY.Enable(); - aMtrTrgrCenterY.Enable(); - aFtTrgrAngle.Disable(); - aMtrTrgrAngle.Disable(); - break; - - case XGRAD_ELLIPTICAL: - aFtTrgrCenterX.Enable(); - aMtrTrgrCenterX.Enable(); - aFtTrgrCenterY.Enable(); - aMtrTrgrCenterY.Enable(); - aFtTrgrAngle.Enable(); - aMtrTrgrAngle.Enable(); - break; - - case XGRAD_SQUARE: - case XGRAD_RECT: - aFtTrgrCenterX.Enable(); - aMtrTrgrCenterX.Enable(); - aFtTrgrCenterY.Enable(); - aMtrTrgrCenterY.Enable(); - aFtTrgrAngle.Enable(); - aMtrTrgrAngle.Enable(); - break; - } -} - -SvxTransparenceTabPage::SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs) -: SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_TRANSPARENCE ), rInAttrs), - rOutAttrs ( rInAttrs ), - nPageType(0), - nDlgType(0), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aRbtTransOff ( this, CUI_RES( RBT_TRANS_OFF ) ), - aRbtTransLinear ( this, CUI_RES( RBT_TRANS_LINEAR ) ), - aRbtTransGradient ( this, CUI_RES( RBT_TRANS_GRADIENT ) ), - - aMtrTransparent ( this, CUI_RES( MTR_TRANSPARENT ) ), - - aFtTrgrType ( this, CUI_RES( FT_TRGR_TYPE ) ), - aLbTrgrGradientType ( this, CUI_RES( LB_TRGR_GRADIENT_TYPES ) ), - aFtTrgrCenterX ( this, CUI_RES( FT_TRGR_CENTER_X ) ), - aMtrTrgrCenterX ( this, CUI_RES( MTR_TRGR_CENTER_X ) ), - aFtTrgrCenterY ( this, CUI_RES( FT_TRGR_CENTER_Y ) ), - aMtrTrgrCenterY ( this, CUI_RES( MTR_TRGR_CENTER_Y ) ), - aFtTrgrAngle ( this, CUI_RES( FT_TRGR_ANGLE ) ), - aMtrTrgrAngle ( this, CUI_RES( MTR_TRGR_ANGLE ) ), - aFtTrgrBorder ( this, CUI_RES( FT_TRGR_BORDER ) ), - aMtrTrgrBorder ( this, CUI_RES( MTR_TRGR_BORDER ) ), - aFtTrgrStartValue ( this, CUI_RES( FT_TRGR_START_VALUE ) ), - aMtrTrgrStartValue ( this, CUI_RES( MTR_TRGR_START_VALUE ) ), - aFtTrgrEndValue ( this, CUI_RES( FT_TRGR_END_VALUE ) ), - aMtrTrgrEndValue ( this, CUI_RES( MTR_TRGR_END_VALUE ) ), - - aCtlBitmapPreview ( this, CUI_RES( CTL_BITMAP_PREVIEW ) ), - aCtlXRectPreview ( this, CUI_RES( CTL_TRANS_PREVIEW ) ), - bBitmap ( sal_False ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) -{ - FreeResource(); - - String accName = String(CUI_RES(STR_EXAMPLE)); - aCtlBitmapPreview.SetAccessibleName(accName); - aCtlXRectPreview.SetAccessibleName(accName); - aMtrTransparent.SetAccessibleRelationLabeledBy( &aRbtTransLinear ); - - // main selection - aRbtTransOff.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl)); - aRbtTransLinear.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl)); - aRbtTransGradient.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl)); - - // linear transparency - aMtrTransparent.SetValue( 50 ); - aMtrTransparent.SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl)); - - // gradient transparency - aMtrTrgrEndValue.SetValue( 100 ); - aMtrTrgrStartValue.SetValue( 0 ); - aLbTrgrGradientType.SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl)); - Link aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl); - aLbTrgrGradientType.SetSelectHdl( aLink ); - aMtrTrgrCenterX.SetModifyHdl( aLink ); - aMtrTrgrCenterY.SetModifyHdl( aLink ); - aMtrTrgrAngle.SetModifyHdl( aLink ); - aMtrTrgrBorder.SetModifyHdl( aLink ); - aMtrTrgrStartValue.SetModifyHdl( aLink ); - aMtrTrgrEndValue.SetModifyHdl( aLink ); - - // this page needs ExchangeSupport - SetExchangeSupport(); -} - -void SvxTransparenceTabPage::Construct() -{ -} - -SfxTabPage* SvxTransparenceTabPage::Create(Window* pWindow, const SfxItemSet& rAttrs) -{ - return(new SvxTransparenceTabPage(pWindow, rAttrs)); -} - -sal_uInt16* SvxTransparenceTabPage::GetRanges() -{ - return(pTransparenceRanges); -} - -sal_Bool SvxTransparenceTabPage::FillItemSet(SfxItemSet& rAttrs) -{ - const SfxPoolItem* pGradientItem = NULL; - const SfxPoolItem* pLinearItem = NULL; - SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)); - SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, sal_True, &pLinearItem)); - sal_Bool bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); - sal_Bool bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); - - // #103765# - sal_Bool bGradUsed = (eStateGradient == SFX_ITEM_DONTCARE); - sal_Bool bLinearUsed = (eStateLinear == SFX_ITEM_DONTCARE); - - sal_Bool bModified(sal_False); - sal_Bool bSwitchOffLinear(sal_False); - sal_Bool bSwitchOffGradient(sal_False); - - if(aMtrTransparent.IsEnabled()) - { - // linear transparence - sal_uInt16 nPos = (sal_uInt16)aMtrTransparent.GetValue(); - if(nPos != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() || !bLinearActive) - { - XFillTransparenceItem aItem(nPos); - SdrShadowTransparenceItem aShadowItem(nPos); - const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLTRANSPARENCE); - if(!pOld || !(*(const XFillTransparenceItem*)pOld == aItem) || !bLinearActive) - { - rAttrs.Put(aItem); - rAttrs.Put(aShadowItem); - bModified = sal_True; - bSwitchOffGradient = sal_True; - } - } - } - else if(aLbTrgrGradientType.IsEnabled()) - { - // transparence gradient, fill ItemSet from values - if(!bGradActive - || (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos() != (XGradientStyle)aLbTrgrGradientType.GetSavedValue() - || (sal_uInt16)aMtrTrgrAngle.GetValue() != (sal_uInt16)aMtrTrgrAngle.GetSavedValue().ToInt32() - || (sal_uInt16)aMtrTrgrCenterX.GetValue() != (sal_uInt16)aMtrTrgrCenterX.GetSavedValue().ToInt32() - || (sal_uInt16)aMtrTrgrCenterY.GetValue() != (sal_uInt16)aMtrTrgrCenterY.GetSavedValue().ToInt32() - || (sal_uInt16)aMtrTrgrBorder.GetValue() != (sal_uInt16)aMtrTrgrBorder.GetSavedValue().ToInt32() - || (sal_uInt16)aMtrTrgrStartValue.GetValue() != (sal_uInt16)aMtrTrgrStartValue.GetSavedValue().ToInt32() - || (sal_uInt16)aMtrTrgrEndValue.GetValue() != (sal_uInt16)aMtrTrgrEndValue.GetSavedValue().ToInt32() ) - { - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrStartValue.GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrEndValue.GetValue() * 255) / 100); - XGradient aTmpGradient( - Color(nStartCol, nStartCol, nStartCol), - Color(nEndCol, nEndCol, nEndCol), - (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), - (sal_uInt16)aMtrTrgrAngle.GetValue() * 10, - (sal_uInt16)aMtrTrgrCenterX.GetValue(), - (sal_uInt16)aMtrTrgrCenterY.GetValue(), - (sal_uInt16)aMtrTrgrBorder.GetValue(), - 100, 100); - - String aString; - XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); - const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLFLOATTRANSPARENCE); - - if(!pOld || !(*(const XFillFloatTransparenceItem*)pOld == aItem) || !bGradActive) - { - rAttrs.Put(aItem); - bModified = sal_True; - bSwitchOffLinear = sal_True; - } - } - } - else - { - // no transparence - bSwitchOffGradient = sal_True; - bSwitchOffLinear = sal_True; - } - - // disable unused XFillFloatTransparenceItem - if(bSwitchOffGradient && (bGradActive || bGradUsed)) - { - Color aColor(COL_BLACK); - XGradient aGrad(aColor, Color(COL_WHITE)); - aGrad.SetStartIntens(100); - aGrad.SetEndIntens(100); - String aString; - XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad); - aItem.SetEnabled(sal_False); - rAttrs.Put(aItem); - bModified = sal_True; - } - - // disable unused XFillFloatTransparenceItem - if(bSwitchOffLinear && (bLinearActive || bLinearUsed)) - { - XFillTransparenceItem aItem(0); - SdrShadowTransparenceItem aShadowItem(0); - rAttrs.Put(aItem); - rAttrs.Put(aShadowItem); - bModified = sal_True; - } - rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); - return bModified; -} - -void SvxTransparenceTabPage::Reset(const SfxItemSet& rAttrs) -{ - const SfxPoolItem* pGradientItem = NULL; - SfxItemState eStateGradient(rAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)); - if(!pGradientItem) - pGradientItem = &rAttrs.Get(XATTR_FILLFLOATTRANSPARENCE); - sal_Bool bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); - - const SfxPoolItem* pLinearItem = NULL; - SfxItemState eStateLinear(rAttrs.GetItemState(XATTR_FILLTRANSPARENCE, sal_True, &pLinearItem)); - if(!pLinearItem) - pLinearItem = &rAttrs.Get(XATTR_FILLTRANSPARENCE); - sal_Bool bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); - - // transparence gradient - const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); - XGradientStyle eXGS(rGradient.GetGradientStyle()); - aLbTrgrGradientType.SelectEntryPos(sal::static_int_cast< sal_uInt16 >(eXGS)); - aMtrTrgrAngle.SetValue(rGradient.GetAngle() / 10); - aMtrTrgrBorder.SetValue(rGradient.GetBorder()); - aMtrTrgrCenterX.SetValue(rGradient.GetXOffset()); - aMtrTrgrCenterY.SetValue(rGradient.GetYOffset()); - aMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)); - aMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)); - - // linear transparence - sal_uInt16 nTransp = ((XFillTransparenceItem*)pLinearItem)->GetValue(); - aMtrTransparent.SetValue(bLinearActive ? nTransp : 50); - ModifyTransparentHdl_Impl(NULL); - - // select the correct radio button - if(bGradActive) - { - // transparence gradient, set controls appropriate to item - aRbtTransGradient.Check(); - ClickTransGradientHdl_Impl(NULL); - } - else if(bLinearActive) - { - // linear transparence - aRbtTransLinear.Check(); - ClickTransLinearHdl_Impl(NULL); - } - else - { - // no transparence - aRbtTransOff.Check(); - ClickTransOffHdl_Impl(NULL); - ModifiedTrgrHdl_Impl(NULL); - } - - // save values - aMtrTransparent.SaveValue(); - aLbTrgrGradientType.SaveValue(); - aMtrTrgrCenterX.SaveValue(); - aMtrTrgrCenterY.SaveValue(); - aMtrTrgrAngle.SaveValue(); - aMtrTrgrBorder.SaveValue(); - aMtrTrgrStartValue.SaveValue(); - aMtrTrgrEndValue.SaveValue(); - - sal_Bool bActive = InitPreview ( rAttrs ); - InvalidatePreview ( bActive ); -} - -void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet) -{ - SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - - if(nDlgType == 0) // Flaechen-Dialog - nPageType = PT_TRANSPARENCE; - - InitPreview ( rSet ); -} - -int SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet) -{ - if( _pSet ) - FillItemSet( *_pSet ); - return(LEAVE_PAGE); -} - -void SvxTransparenceTabPage::PointChanged(Window* , RECT_POINT eRcPt) -{ - eRP = eRcPt; -} - -// -// Preview-Methods -// -sal_Bool SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet ) -{ - // set transparencetyp for preview - if ( aRbtTransOff.IsChecked() ) - { - ClickTransOffHdl_Impl(NULL); - } else if ( aRbtTransLinear.IsChecked() ) - { - ClickTransLinearHdl_Impl(NULL); - } else if ( aRbtTransGradient.IsChecked() ) - { - ClickTransGradientHdl_Impl(NULL); - } - - // Get fillstyle for preview - rXFSet.Put ( ( XFillStyleItem& ) rSet.Get(XATTR_FILLSTYLE) ); - rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); - rXFSet.Put ( ( XFillGradientItem& ) rSet.Get(XATTR_FILLGRADIENT) ); - rXFSet.Put ( ( XFillHatchItem& ) rSet.Get(XATTR_FILLHATCH) ); - rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); - rXFSet.Put ( ( XFillBitmapItem& ) rSet.Get(XATTR_FILLBITMAP) ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - bBitmap = ( ( ( XFillStyleItem& )rSet.Get(XATTR_FILLSTYLE) ).GetValue() == XFILL_BITMAP ); - - // show the right preview window - if ( bBitmap ) - { - aCtlBitmapPreview.Show(); - aCtlXRectPreview.Hide(); - } - else - { - aCtlBitmapPreview.Hide(); - aCtlXRectPreview.Show(); - } - - return !aRbtTransOff.IsChecked(); -} - -void SvxTransparenceTabPage::InvalidatePreview (sal_Bool bEnable) -{ - if ( bBitmap ) - { - if ( bEnable ) - { - aCtlBitmapPreview.Enable(); - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - } - else - aCtlBitmapPreview.Disable(); - aCtlBitmapPreview.Invalidate(); - } - else - { - if ( bEnable ) - { - aCtlXRectPreview.Enable(); - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - } - else - aCtlXRectPreview.Disable(); - aCtlXRectPreview.Invalidate(); - } -} - -void SvxTransparenceTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); - - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if (pDlgTypeItem) - SetDlgType(pDlgTypeItem->GetValue()); - Construct(); -} -/************************************************************************* -|* -|* Dialog to modify fill-attributes -|* -\************************************************************************/ - -SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_AREA ), rInAttrs ), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aTypeLB ( this, CUI_RES( LB_AREA_TYPE ) ), - - aLbColor ( this, CUI_RES( LB_COLOR ) ), - aLbGradient ( this, CUI_RES( LB_GRADIENT ) ), - aLbHatching ( this, CUI_RES( LB_HATCHING ) ), - aLbBitmap ( this, CUI_RES( LB_BITMAP ) ), - aCtlBitmapPreview ( this, CUI_RES( CTL_BITMAP_PREVIEW ) ), - - aTsbStepCount ( this, CUI_RES( TSB_STEPCOUNT ) ), - aFlStepCount ( this, CUI_RES( FL_STEPCOUNT ) ), - aNumFldStepCount ( this, CUI_RES( NUM_FLD_STEPCOUNT ) ), - - aCbxHatchBckgrd ( this, CUI_RES( CB_HATCHBCKGRD ) ), - aLbHatchBckgrdColor ( this, CUI_RES( LB_HATCHBCKGRDCOLOR ) ), - - aFlSize ( this, CUI_RES( FL_SIZE ) ), - aTsbOriginal ( this, CUI_RES( TSB_ORIGINAL ) ), - aTsbScale ( this, CUI_RES( TSB_SCALE ) ), - aFtXSize ( this, CUI_RES( FT_X_SIZE ) ), - aMtrFldXSize ( this, CUI_RES( MTR_FLD_X_SIZE ) ), - aFtYSize ( this, CUI_RES( FT_Y_SIZE ) ), - aMtrFldYSize ( this, CUI_RES( MTR_FLD_Y_SIZE ) ), - aFlPosition ( this, CUI_RES( FL_POSITION ) ), - aCtlPosition ( this, CUI_RES( CTL_POSITION ), RP_RM, 110, 80, CS_RECT ), - aFtXOffset ( this, CUI_RES( FT_X_OFFSET ) ), - aMtrFldXOffset ( this, CUI_RES( MTR_FLD_X_OFFSET ) ), - aFtYOffset ( this, CUI_RES( FT_Y_OFFSET ) ), - aMtrFldYOffset ( this, CUI_RES( MTR_FLD_Y_OFFSET ) ), - aTsbTile ( this, CUI_RES( TSB_TILE ) ), - aTsbStretch ( this, CUI_RES( TSB_STRETCH ) ), - aFlOffset ( this, CUI_RES( FL_OFFSET ) ), - aRbtRow ( this, CUI_RES( RBT_ROW ) ), - aRbtColumn ( this, CUI_RES( RBT_COLUMN ) ), - aMtrFldOffset ( this, CUI_RES( MTR_FLD_OFFSET ) ), - - aCtlXRectPreview ( this, CUI_RES( CTL_COLOR_PREVIEW ) ), - - rOutAttrs ( rInAttrs ), - - pColorTab( NULL ), - pGradientList( NULL ), - pHatchingList( NULL ), - pBitmapList( NULL ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) -{ - FreeResource(); - - String accName = String(CUI_RES(STR_EXAMPLE)); - aCtlXRectPreview.SetAccessibleName(accName); - aCtlBitmapPreview.SetAccessibleName(accName); - - // Gruppen, die sich ueberlagern - aLbBitmap.Hide(); - aCtlBitmapPreview.Hide(); - - aFlStepCount.Hide(); - aTsbStepCount.Hide(); - aNumFldStepCount.Hide(); - - aTsbTile.Hide(); - aTsbStretch.Hide(); - aTsbScale.Hide(); - aTsbOriginal.Hide(); - aFtXSize.Hide(); - aMtrFldXSize.Hide(); - aFtYSize.Hide(); - aMtrFldYSize.Hide(); - aFlSize.Hide(); - aRbtRow.Hide(); - aRbtColumn.Hide(); - aMtrFldOffset.Hide(); - aFlOffset.Hide(); - aCtlPosition.Hide(); - aFtXOffset.Hide(); - aMtrFldXOffset.Hide(); - aFtYOffset.Hide(); - aMtrFldYOffset.Hide(); - aFlPosition.Hide(); - // Controls for Hatch-Background - aCbxHatchBckgrd.Hide(); - aLbHatchBckgrdColor.Hide(); - - - aTsbOriginal.EnableTriState( sal_False ); - - - // this page needs ExchangeSupport - SetExchangeSupport(); - - // set Metrics - eFUnit = GetModuleFieldUnit( rInAttrs ); - - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ;//prevent warning - } - SetFieldUnit( aMtrFldXSize, eFUnit, sal_True ); - SetFieldUnit( aMtrFldYSize, eFUnit, sal_True ); - - // get PoolUnit - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX ); - - // Setzen Output-Devices - rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); - rXFSet.Put( XFillColorItem( String(), COL_BLACK ) ); - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aLbColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) ); - aLbHatchBckgrdColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) ); - aCbxHatchBckgrd.SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) ); - - aLbGradient.SetSelectHdl( - LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) ); - aLbHatching.SetSelectHdl( - LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) ); - aLbBitmap.SetSelectHdl( - LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) ); - - aTsbStepCount.SetClickHdl( - LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); - aNumFldStepCount.SetModifyHdl( - LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); - - Link aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) ); - aTsbTile.SetClickHdl( aLink ); - aTsbStretch.SetClickHdl( aLink ); - aTsbOriginal.SetClickHdl( aLink ); - aMtrFldXSize.SetModifyHdl( aLink ); - aMtrFldYSize.SetModifyHdl( aLink ); - aRbtRow.SetClickHdl( aLink ); - aRbtColumn.SetClickHdl( aLink ); - aMtrFldOffset.SetModifyHdl( aLink ); - aMtrFldXOffset.SetModifyHdl( aLink ); - aMtrFldYOffset.SetModifyHdl( aLink ); - aTsbScale.SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) ); - - aTypeLB.SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) ); - - // #i76307# always paint the preview in LTR, because this is what the document does - aCtlXRectPreview.EnableRTL(sal_False); - - aNumFldStepCount.SetAccessibleRelationLabeledBy( &aTsbStepCount ); - aCtlPosition.SetAccessibleRelationMemberOf( &aFlPosition ); - aLbHatchBckgrdColor.SetAccessibleRelationLabeledBy( &aCbxHatchBckgrd ); - aLbHatchBckgrdColor.SetAccessibleName(aCbxHatchBckgrd.GetText()); - - aLbColor.SetAccessibleRelationMemberOf( &aFlProp ); - aMtrFldOffset.SetAccessibleRelationLabeledBy(&aFlOffset); - aMtrFldOffset.SetAccessibleName(aFlOffset.GetText()); -} - -// ----------------------------------------------------------------------- - -void SvxAreaTabPage::Construct() -{ - // fill colortables / lists - aLbColor.Fill( pColorTab ); - aLbHatchBckgrdColor.Fill ( pColorTab ); - - aLbGradient.Fill( pGradientList ); - aLbHatching.Fill( pHatchingList ); - aLbBitmap.Fill( pBitmapList ); -} - -// ----------------------------------------------------------------------- - -void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - sal_uInt16 nCount; - SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if (pPosItem) - SetPos(pPosItem->GetValue()); - if( nDlgType == 0 ) // Flaechen-Dialog - { - *pbAreaTP = sal_True; - - if( pColorTab ) - { - sal_uInt16 _nPos = 0; - // Bitmapliste - if( *pnBitmapListState ) - { - if( *pnBitmapListState & CT_CHANGED ) - pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )-> - GetNewBitmapList(); - - _nPos = aLbBitmap.GetSelectEntryPos(); - - aLbBitmap.Clear(); - aLbBitmap.Fill( pBitmapList ); - nCount = aLbBitmap.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= _nPos ) - aLbBitmap.SelectEntryPos( 0 ); - else - aLbBitmap.SelectEntryPos( _nPos ); - ModifyBitmapHdl_Impl( this ); - } - // hatch-liste - if( *pnHatchingListState ) - { - if( *pnHatchingListState & CT_CHANGED ) - pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )-> - GetNewHatchingList(); - - _nPos = aLbHatching.GetSelectEntryPos(); - - aLbHatching.Clear(); - aLbHatching.Fill( pHatchingList ); - nCount = aLbHatching.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= _nPos ) - aLbHatching.SelectEntryPos( 0 ); - else - aLbHatching.SelectEntryPos( _nPos ); - ModifyHatchingHdl_Impl( this ); - - ModifyHatchBckgrdColorHdl_Impl( this ); - } - // gradient-liste - if( *pnGradientListState ) - { - if( *pnGradientListState & CT_CHANGED ) - pGradientList = ( (SvxAreaTabDialog*) DLGWIN )-> - GetNewGradientList(); - - _nPos = aLbGradient.GetSelectEntryPos(); - - aLbGradient.Clear(); - aLbGradient.Fill( pGradientList ); - nCount = aLbGradient.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= _nPos ) - aLbGradient.SelectEntryPos( 0 ); - else - aLbGradient.SelectEntryPos( _nPos ); - ModifyGradientHdl_Impl( this ); - } - // ColorTable - if( *pnColorTableState ) - { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )-> - GetNewColorTable(); - // aLbColor - _nPos = aLbColor.GetSelectEntryPos(); - aLbColor.Clear(); - aLbColor.Fill( pColorTab ); - nCount = aLbColor.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= _nPos ) - aLbColor.SelectEntryPos( 0 ); - else - aLbColor.SelectEntryPos( _nPos ); - - ModifyColorHdl_Impl( this ); - - // Backgroundcolor of hatch - _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); - aLbHatchBckgrdColor.Clear(); - aLbHatchBckgrdColor.Fill( pColorTab ); - nCount = aLbHatchBckgrdColor.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= _nPos ) - aLbHatchBckgrdColor.SelectEntryPos( 0 ); - else - aLbHatchBckgrdColor.SelectEntryPos( _nPos ); - - ModifyHatchBckgrdColorHdl_Impl( this ); - } - - // evaluate if any other Tabpage set another filltype - if( aTypeLB.GetSelectEntryPos() > XFILL_NONE) - { - switch( nPageType ) - { - case PT_GRADIENT: - aTypeLB.SelectEntryPos( XFILL_GRADIENT ); - aLbGradient.SelectEntryPos( _nPos ); - ClickGradientHdl_Impl( this ); - break; - - case PT_HATCH: - aTypeLB.SelectEntryPos( XFILL_HATCH ); - aLbHatching.SelectEntryPos( _nPos ); - ClickHatchingHdl_Impl( this ); - break; - - case PT_BITMAP: - aTypeLB.SelectEntryPos( XFILL_BITMAP ); - aLbBitmap.SelectEntryPos( _nPos ); - ClickBitmapHdl_Impl( this ); - break; - - case PT_COLOR: - aTypeLB.SelectEntryPos( XFILL_SOLID ); - aLbColor.SelectEntryPos( _nPos ); - aLbHatchBckgrdColor.SelectEntryPos( _nPos ); - ClickColorHdl_Impl( this ); - break; - } - } - nPageType = PT_AREA; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( nDlgType == 0 ) // Flaechen-Dialog - { - XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); - switch( eStyle ) - { - case XFILL_GRADIENT: - { - nPageType = PT_GRADIENT; - nPos = aLbGradient.GetSelectEntryPos(); - } - break; - case XFILL_HATCH: - { - nPageType = PT_HATCH; - nPos = aLbHatching.GetSelectEntryPos(); - } - break; - case XFILL_BITMAP: - { - nPageType = PT_BITMAP; - nPos = aLbBitmap.GetSelectEntryPos(); - } - break; - case XFILL_SOLID: - { - nPageType = PT_COLOR; - nPos = aLbColor.GetSelectEntryPos(); - } - break; - default: ;//prevent warning - } - } - - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs ) -{ - const SfxPoolItem* pOld = NULL; - sal_uInt16 _nPos; - sal_Bool bModified = sal_False; - - if( nDlgType != 0 || *pbAreaTP ) - { - XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); - XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue(); - switch( eStyle ) - { - case XFILL_NONE: - { - if( eSavedStyle != eStyle ) - { - XFillStyleItem aStyleItem( XFILL_NONE ); - pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); - if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) - { - rAttrs.Put( aStyleItem ); - bModified = sal_True; - } - } - } - break; - case XFILL_SOLID: - { - _nPos = aLbColor.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND && - _nPos != aLbColor.GetSavedValue() ) - { - XFillColorItem aItem( aLbColor.GetSelectEntry(), - aLbColor.GetSelectEntryColor() ); - pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); - if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - // NEU - if( (eSavedStyle != eStyle) && - ( bModified || - SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True ) ) ) - { - XFillStyleItem aStyleItem( XFILL_SOLID ); - pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); - if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) - { - rAttrs.Put( aStyleItem ); - bModified = sal_True; - } - } - } - break; - case XFILL_GRADIENT: - { - _nPos = aLbGradient.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND && - _nPos != aLbGradient.GetSavedValue() ) - { - XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient(); - String aString = aLbGradient.GetSelectEntry(); - XFillGradientItem aItem( aString, aGradient ); - pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT ); - if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - // NEU - if( (eSavedStyle != eStyle) && - ( bModified || - SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True ) ) ) - { - XFillStyleItem aStyleItem( XFILL_GRADIENT ); - pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); - if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) - { - rAttrs.Put( aStyleItem ); - bModified = sal_True; - } - } - } - break; - case XFILL_HATCH: - { - _nPos = aLbHatching.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND && - _nPos != aLbHatching.GetSavedValue() ) - { - XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch(); - String aString = aLbHatching.GetSelectEntry(); - XFillHatchItem aItem( aString, aHatching ); - pOld = GetOldItem( rAttrs, XATTR_FILLHATCH ); - if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() ); - rAttrs.Put( aItem ); - nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbHatchBckgrdColor.GetSavedValue() ) - { - XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(), - aLbHatchBckgrdColor.GetSelectEntryColor() ); - pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); - if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) ) - { - rAttrs.Put( aFillColorItem ); - bModified = sal_True; - } - } - // NEU - if( (eSavedStyle != eStyle) && - ( bModified || - SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True ) ) ) - { - XFillStyleItem aStyleItem( XFILL_HATCH ); - pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); - if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) - { - rAttrs.Put( aStyleItem ); - bModified = sal_True; - } - } - } - break; - case XFILL_BITMAP: - { - nPos = aLbBitmap.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbBitmap.GetSavedValue() ) - { - XOBitmap aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap(); - String aString = aLbBitmap.GetSelectEntry(); - XFillBitmapItem aFillBitmapItem( aString, aXOBitmap ); - pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP ); - if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) ) - { - rAttrs.Put( aFillBitmapItem ); - bModified = sal_True; - } - } - // NEU - if( (eSavedStyle != eStyle) && - ( bModified || - SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True ) ) ) - { - XFillStyleItem aStyleItem( XFILL_BITMAP ); - pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); - if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) - { - rAttrs.Put( aStyleItem ); - bModified = sal_True; - } - } - } - break; - } - - // Schrittweite - if( aTsbStepCount.IsEnabled() ) - { - sal_uInt16 nValue = 0; - sal_Bool bValueModified = sal_False; - TriState eState = aTsbStepCount.GetState(); - if( eState == STATE_CHECK ) - { - if( eState != aTsbStepCount.GetSavedValue() ) - bValueModified = sal_True; - } - else - { - // Zustand != Disabled ? - if( aNumFldStepCount.GetText().Len() > 0 ) - { - nValue = (sal_uInt16) aNumFldStepCount.GetValue(); - if( nValue != (sal_uInt16) aNumFldStepCount.GetSavedValue().ToInt32() ) - bValueModified = sal_True; - } - } - if( bValueModified ) - { - XGradientStepCountItem aFillBitmapItem( nValue ); - pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT ); - if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) ) - { - rAttrs.Put( aFillBitmapItem ); - bModified = sal_True; - } - } - } - - // Kacheln - if( aTsbTile.IsEnabled() ) - { - TriState eState = aTsbTile.GetState(); - if( eState != aTsbTile.GetSavedValue() ) - { - XFillBmpTileItem aFillBmpTileItem( - sal::static_int_cast< sal_Bool >( eState ) ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE ); - if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) ) - { - rAttrs.Put( aFillBmpTileItem ); - bModified = sal_True; - } - } - } - // Stretchen - if( aTsbStretch.IsEnabled() ) - { - TriState eState = aTsbStretch.GetState(); - if( eState != aTsbStretch.GetSavedValue() ) - { - XFillBmpStretchItem aFillBmpStretchItem( - sal::static_int_cast< sal_Bool >( eState ) ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH ); - if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) ) - { - rAttrs.Put( aFillBmpStretchItem ); - bModified = sal_True; - } - } - } - - // Originalgroesse (im UI) wird wie folgt benutzt: - // Controls sind disabled, muessen aber gesetzt werden. - // SizeX = 0; SizeY = 0; Log = sal_True - - //aTsbScale - TriState eState = aTsbScale.GetState(); - if( eState != aTsbScale.GetSavedValue() || - ( !aTsbScale.IsEnabled() && - aTsbOriginal.IsEnabled() && - aTsbScale.GetSavedValue() != STATE_CHECK ) ) - { - XFillBmpSizeLogItem* pItem = NULL; - if( aTsbScale.IsEnabled() ) - pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK ); - else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) - pItem = new XFillBmpSizeLogItem( sal_True ); - - if( pItem ) - { - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG ); - if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) ) - { - rAttrs.Put( *pItem ); - bModified = sal_True; - } - delete pItem; - } - } - - //aMtrFldXSize - String aStr = aMtrFldXSize.GetText(); - { - XFillBmpSizeXItem* pItem = NULL; - TriState eScaleState = aTsbScale.GetState(); - - if( aMtrFldXSize.IsEnabled() && - aStr.Len() > 0 && - aStr != aMtrFldXSize.GetSavedValue() ) - { - if( eScaleState == STATE_NOCHECK ) - pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); - else - { - // Prozentwerte werden negativ gesetzt, damit - // diese nicht skaliert werden; dieses wird - // im Item beruecksichtigt - pItem = new XFillBmpSizeXItem( -labs( static_cast(aMtrFldXSize.GetValue()) ) ); - } - } - else if( aTsbOriginal.IsEnabled() && - aTsbOriginal.GetState() == STATE_CHECK && - aMtrFldXSize.GetSavedValue().Len() > 0 ) - pItem = new XFillBmpSizeXItem( 0 ); - - if( pItem ) - { - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX ); - if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) ) - { - rAttrs.Put( *pItem ); - bModified = sal_True; - } - delete pItem; - } - } - - //aMtrFldYSize - aStr = aMtrFldYSize.GetText(); - { - XFillBmpSizeYItem* pItem = NULL; - TriState eScaleState = aTsbScale.GetState(); - - if( aMtrFldYSize.IsEnabled() && - aStr.Len() > 0 && - aStr != aMtrFldYSize.GetSavedValue() ) - { - if( eScaleState == STATE_NOCHECK ) - pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); - else - { - // Prozentwerte werden negativ gesetzt, damit - // diese vom MetricItem nicht skaliert werden; - // dieses wird im Item beruecksichtigt - pItem = new XFillBmpSizeYItem( -labs( static_cast(aMtrFldYSize.GetValue()) ) ); - } - } - else if( aTsbOriginal.IsEnabled() && - aTsbOriginal.GetState() == STATE_CHECK && - aMtrFldYSize.GetSavedValue().Len() > 0 ) - pItem = new XFillBmpSizeYItem( 0 ); - - if( pItem ) - { - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY ); - if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) ) - { - rAttrs.Put( *pItem ); - bModified = sal_True; - } - delete pItem; - } - } - - //aRbtRow - //aRbtColumn - //aMtrFldOffset - if( aMtrFldOffset.IsEnabled() ) - { - String aMtrString = aMtrFldOffset.GetText(); - if( ( aMtrString.Len() > 0 && - aMtrString != aMtrFldOffset.GetSavedValue() ) || - aRbtRow.GetSavedValue() != aRbtRow.IsChecked() || - aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() ) - { - if( aRbtRow.IsChecked() ) - { - XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX ); - if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) ) - { - rAttrs.Put( aFillBmpTileOffsetXItem ); - rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) ); - bModified = sal_True; - } - } - else if( aRbtColumn.IsChecked() ) - { - XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY ); - if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) ) - { - rAttrs.Put( aFillBmpTileOffsetYItem ); - rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) ); - bModified = sal_True; - } - } - } - } - - //aCtlPosition - if( aCtlPosition.IsEnabled() ) - { - sal_Bool bPut = sal_False; - RECT_POINT _eRP = aCtlPosition.GetActualRP(); - - if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) ) - bPut = sal_True; - else - { - RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); - if( eValue != _eRP ) - bPut = sal_True; - } - if( bPut ) - { - XFillBmpPosItem aFillBmpPosItem( _eRP ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS ); - if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) ) - { - rAttrs.Put( aFillBmpPosItem ); - bModified = sal_True; - } - } - } - - //aMtrFldXOffset - if( aMtrFldXOffset.IsEnabled() ) - { - String sMtrXOffset = aMtrFldXOffset.GetText(); - if( sMtrXOffset.Len() > 0 && - sMtrXOffset != aMtrFldXOffset.GetSavedValue() ) - { - XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX ); - if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) ) - { - rAttrs.Put( aFillBmpPosOffsetXItem ); - bModified = sal_True; - } - } - } - - //aMtrFldYOffset - if( aMtrFldYOffset.IsEnabled() ) - { - String sMtrYOffset = aMtrFldYOffset.GetText(); - if( sMtrYOffset.Len() > 0 && - sMtrYOffset != aMtrFldYOffset.GetSavedValue() ) - { - XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() ); - pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY ); - if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) ) - { - rAttrs.Put( aFillBmpPosOffsetYItem ); - bModified = sal_True; - } - } - } - rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); - rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos)); - } - - return( bModified ); -} - -// ----------------------------------------------------------------------- - -void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs ) -{ - XFillStyle eXFS; - if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) - { - eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs. - Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() ); - aTypeLB.SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); - switch( eXFS ) - { - case XFILL_NONE: - ClickInvisibleHdl_Impl( this ); - break; - - case XFILL_SOLID: - if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) - { - XFillColorItem aColorItem( ( const XFillColorItem& ) - rAttrs.Get( XATTR_FILLCOLOR ) ); - - aLbColor.SelectEntry( aColorItem.GetColorValue() ); - aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); - } - ClickColorHdl_Impl( this ); - - break; - - case XFILL_GRADIENT: - if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) ) - { - XFillGradientItem aGradientItem( ( ( const XFillGradientItem& ) - rAttrs.Get( XATTR_FILLGRADIENT ) ) ); - String aString( aGradientItem.GetName() ); - XGradient aGradient( aGradientItem.GetGradientValue() ); - - aLbGradient.SelectEntryByList( pGradientList, aString, aGradient ); - } - ClickGradientHdl_Impl( this ); - break; - - case XFILL_HATCH: - if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) ) - { - aLbHatching.SelectEntry( ( ( const XFillHatchItem& ) - rAttrs.Get( XATTR_FILLHATCH ) ).GetName() ); - } - ClickHatchingHdl_Impl( this ); - - if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) ) - { - aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() ); - } - ToggleHatchBckgrdColorHdl_Impl( this ); - if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) - { - XFillColorItem aColorItem( ( const XFillColorItem& ) - rAttrs.Get( XATTR_FILLCOLOR ) ); - - aLbColor.SelectEntry( aColorItem.GetColorValue() ); - aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); - } - break; - - case XFILL_BITMAP: - { - if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) ) - { - XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& ) - rAttrs.Get( XATTR_FILLBITMAP ) ); - - String aString( aBitmapItem.GetName() ); - aLbBitmap.SelectEntry( aString ); - } - ClickBitmapHdl_Impl( this ); - } - break; - - default: - break; - } - } - else - { - // Alle LBs nicht zug"anglich machen - aLbColor.Hide(); - aLbGradient.Hide(); - aLbHatching.Hide(); - aLbBitmap.Hide(); - aCtlBitmapPreview.Hide(); - aLbColor.Disable(); - aLbColor.Show(); - - // Damit Reset() auch mit Zurueck richtig funktioniert - aTypeLB.SetNoSelection(); - } - - // Schrittweite - if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) || - ( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) ) - { - aTsbStepCount.EnableTriState( sal_False ); - sal_uInt16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue(); - if( nValue == 0 ) - { - aTsbStepCount.SetState( STATE_CHECK ); - aNumFldStepCount.SetText( String() ); - } - else - { - aTsbStepCount.SetState( STATE_NOCHECK ); - aNumFldStepCount.SetValue( nValue ); - } - ModifyStepCountHdl_Impl( &aTsbStepCount ); - } - else - { - aTsbStepCount.SetState( STATE_DONTKNOW ); - aNumFldStepCount.SetText( String() ); - } - - // Attribute fuer die Bitmap-Fuellung - - // Ist Kacheln gesetzt? - if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE ) - { - aTsbTile.EnableTriState( sal_False ); - - if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() ) - aTsbTile.SetState( STATE_CHECK ); - else - aTsbTile.SetState( STATE_NOCHECK ); - } - else - aTsbTile.SetState( STATE_DONTKNOW ); - - // Ist Stretchen gesetzt? - if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE ) - { - aTsbStretch.EnableTriState( sal_False ); - - if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() ) - aTsbStretch.SetState( STATE_CHECK ); - else - aTsbStretch.SetState( STATE_NOCHECK ); - } - else - aTsbStretch.SetState( STATE_DONTKNOW ); - - - //aTsbScale - if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE ) - { - aTsbScale.EnableTriState( sal_False ); - - if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() ) - aTsbScale.SetState( STATE_NOCHECK ); - else - aTsbScale.SetState( STATE_CHECK ); - - ClickScaleHdl_Impl( NULL ); - } - else - aTsbScale.SetState( STATE_DONTKNOW ); - - - // Status fuer Originalgroesse ermitteln - TriState eOriginal = STATE_NOCHECK; - - //aMtrFldXSize - if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue(); - if( aTsbScale.GetState() == STATE_CHECK ) - { - // Wenn im Item eine Prozentangabe steckt, - // so ist diese wegen des MetricItems negativ - aMtrFldXSize.SetValue( labs( nValue ) ); - } - else - SetMetricValue( aMtrFldXSize, nValue, ePoolUnit ); - aMtrFldXSize.SaveValue(); - - if( nValue == 0 ) - { - eOriginal = STATE_CHECK; - // Wert ist beim Ausschalten von Originalgroesse sonst zu klein - // (Performance-Problem) - aMtrFldXSize.SetValue( 100 ); - } - } - else - { - aMtrFldXSize.SetText( String() ); - aMtrFldXSize.SaveValue(); - } - - //aMtrFldYSize - if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue(); - if( aTsbScale.GetState() == STATE_CHECK ) - { - // Wenn im Item eine Prozentangabe steckt, - // so ist diese wegen des MetricItems negativ - aMtrFldYSize.SetValue( labs( nValue ) ); - } - else - SetMetricValue( aMtrFldYSize, nValue, ePoolUnit ); - aMtrFldYSize.SaveValue(); - - if( nValue == 0 ) - aMtrFldYSize.SetValue( 100 ); //s.o. - else - eOriginal = STATE_NOCHECK; - } - else - { - aMtrFldYSize.SetText( String() ); - aMtrFldYSize.SaveValue(); - eOriginal = STATE_NOCHECK; - } - - // aTsbOriginal - aTsbOriginal.SetState( eOriginal ); - - // #93372# Setting proper state after changing button - ModifyTileHdl_Impl( NULL ); - - //aRbtRow - //aRbtColumn - //aMtrFldOffset - if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE ) - { - sal_uInt16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue(); - if( nValue > 0 ) - { - aMtrFldOffset.SetValue( nValue ); - aRbtRow.Check(); - } - else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE ) - { - nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue(); - if( nValue > 0 ) - { - aMtrFldOffset.SetValue( nValue ); - aRbtColumn.Check(); - } - } - else - aMtrFldOffset.SetValue( 0 ); - } - else - aMtrFldOffset.SetText( String() ); - - - //aCtlPosition - if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE ) - { - RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); - aCtlPosition.SetActualRP( eValue ); - } - else - aCtlPosition.Reset(); - - //aMtrFldXOffset - if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue(); - aMtrFldXOffset.SetValue( nValue ); - } - else - aMtrFldXOffset.SetText( String() ); - - //aMtrFldYOffset - if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue(); - aMtrFldYOffset.SetValue( nValue ); - } - else - aMtrFldYOffset.SetText( String() ); - - // Erst hier, damit Tile und Stretch mit beruecksichtigt wird - if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP ) - ClickBitmapHdl_Impl( NULL ); - - // Werte sichern - aTypeLB.SaveValue(); - aLbColor.SaveValue(); - aLbGradient.SaveValue(); - aLbHatching.SaveValue(); - aLbHatchBckgrdColor.SaveValue(); - aLbBitmap.SaveValue(); - aTsbStepCount.SaveValue(); - aNumFldStepCount.SaveValue(); - aTsbTile.SaveValue(); - aTsbStretch.SaveValue(); - aTsbScale.SaveValue(); - aRbtRow.SaveValue(); - aRbtColumn.SaveValue(); - aMtrFldOffset.SaveValue(); - aMtrFldXOffset.SaveValue(); - aMtrFldYOffset.SaveValue(); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxAreaTabPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxAreaTabPage( pWindow, rAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxAreaTabPage::GetRanges() -{ - return( pAreaRanges ); -} - -//------------------------------------------------------------------------ -IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG ) -{ - switch( (XFillStyle)aTypeLB.GetSelectEntryPos() ) - { - case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break; - case XFILL_SOLID: ClickColorHdl_Impl( this ); break; - case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break; - case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break; - case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break; - } - - return 0; -} - -IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) -{ - aTsbTile.Hide(); - aTsbStretch.Hide(); - aTsbScale.Hide(); - aTsbOriginal.Hide(); - aFtXSize.Hide(); - aMtrFldXSize.Hide(); - aFtYSize.Hide(); - aMtrFldYSize.Hide(); - aFlSize.Hide(); - aRbtRow.Hide(); - aRbtColumn.Hide(); - aMtrFldOffset.Hide(); - aFlOffset.Hide(); - aCtlPosition.Hide(); - aFtXOffset.Hide(); - aMtrFldXOffset.Hide(); - aFtYOffset.Hide(); - aMtrFldYOffset.Hide(); - aFlPosition.Hide(); - - aLbColor.Hide(); - aLbGradient.Hide(); - aLbHatching.Hide(); - aLbBitmap.Hide(); - aCtlXRectPreview.Hide(); - aCtlBitmapPreview.Hide(); - - aFlStepCount.Hide(); - aTsbStepCount.Hide(); - aNumFldStepCount.Hide(); - - // Controls for Hatch-Background - aCbxHatchBckgrd.Hide(); - aLbHatchBckgrdColor.Hide(); - - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlXRectPreview.Invalidate(); - aCtlBitmapPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG ) -{ - aTsbTile.Hide(); - aTsbStretch.Hide(); - aTsbScale.Hide(); - aTsbOriginal.Hide(); - aFtXSize.Hide(); - aMtrFldXSize.Hide(); - aFtYSize.Hide(); - aMtrFldYSize.Hide(); - aFlSize.Hide(); - aRbtRow.Hide(); - aRbtColumn.Hide(); - aMtrFldOffset.Hide(); - aFlOffset.Hide(); - aCtlPosition.Hide(); - aFtXOffset.Hide(); - aMtrFldXOffset.Hide(); - aFtYOffset.Hide(); - aMtrFldYOffset.Hide(); - aFlPosition.Hide(); - - aLbColor.Enable(); - aLbColor.Show(); - aLbGradient.Hide(); - aLbHatching.Hide(); - aLbBitmap.Hide(); - aCtlXRectPreview.Enable(); - aCtlXRectPreview.Show(); - aCtlBitmapPreview.Hide(); - - aFlStepCount.Hide(); - aTsbStepCount.Hide(); - aNumFldStepCount.Hide(); - - // Controls for Hatch-Background - aCbxHatchBckgrd.Hide(); - aLbHatchBckgrdColor.Hide(); - - // Text der Tabelle setzen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pColorTab->GetPath() ); - - aURL.Append( pColorTab->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - ModifyColorHdl_Impl( this ); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG ) -{ - const SfxPoolItem* pPoolItem = NULL; - sal_uInt16 _nPos = aLbColor.GetSelectEntryPos(); - aLbHatchBckgrdColor.SelectEntryPos( _nPos ); - if( _nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); - rXFSet.Put( XFillColorItem( String(), - aLbColor.GetSelectEntryColor() ) ); - } - // NEU - else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) - { - rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); - Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); - rXFSet.Put( XFillColorItem( String(), aColor ) ); - } - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG ) -{ - aTsbTile.Hide(); - aTsbStretch.Hide(); - aTsbScale.Hide(); - aTsbOriginal.Hide(); - aFtXSize.Hide(); - aMtrFldXSize.Hide(); - aFtYSize.Hide(); - aMtrFldYSize.Hide(); - aFlSize.Hide(); - aRbtRow.Hide(); - aRbtColumn.Hide(); - aMtrFldOffset.Hide(); - aFlOffset.Hide(); - aCtlPosition.Hide(); - aFtXOffset.Hide(); - aMtrFldXOffset.Hide(); - aFtYOffset.Hide(); - aMtrFldYOffset.Hide(); - aFlPosition.Hide(); - - aLbColor.Hide(); - aLbGradient.Enable(); - aLbGradient.Show(); - aLbHatching.Hide(); - aLbBitmap.Hide(); - aCtlXRectPreview.Enable(); - aCtlXRectPreview.Show(); - aCtlBitmapPreview.Hide(); - - aFlStepCount.Enable(); - aFlStepCount.Show(); - aTsbStepCount.Enable(); - aTsbStepCount.Show(); - aNumFldStepCount.Show(); - - // Controls for Hatch-Background - aCbxHatchBckgrd.Hide(); - aLbHatchBckgrdColor.Hide(); - - // Text der Tabelle setzen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pGradientList->GetPath() ); - - aURL.Append( pGradientList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - ModifyGradientHdl_Impl( this ); - ModifyStepCountHdl_Impl( &aTsbStepCount ); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG ) -{ - const SfxPoolItem* pPoolItem = NULL; - sal_uInt16 _nPos = aLbGradient.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND ) - { - // ItemSet fuellen und an aCtlXRectPreview weiterleiten - XGradientEntry* pEntry = pGradientList->GetGradient( _nPos ); - - rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); - rXFSet.Put( XFillGradientItem( String(), - pEntry->GetGradient() ) ); - } - else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) ) - { - rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); - rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) ); - } - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG ) -{ - aLbColor.Hide(); - aLbGradient.Hide(); - aLbHatching.Enable(); - aLbHatching.Show(); - aLbBitmap.Hide(); - aCtlXRectPreview.Enable(); - aCtlXRectPreview.Show(); - aCtlBitmapPreview.Hide(); - - aFlStepCount.Hide(); - aTsbStepCount.Hide(); - aNumFldStepCount.Hide(); - - aTsbTile.Hide(); - aTsbStretch.Hide(); - aTsbScale.Hide(); - aTsbOriginal.Hide(); - aFtXSize.Hide(); - aMtrFldXSize.Hide(); - aFtYSize.Hide(); - aMtrFldYSize.Hide(); - aFlSize.Hide(); - aRbtRow.Hide(); - aRbtColumn.Hide(); - aMtrFldOffset.Hide(); - aFlOffset.Hide(); - aCtlPosition.Hide(); - aFtXOffset.Hide(); - aMtrFldXOffset.Hide(); - aFtYOffset.Hide(); - aMtrFldYOffset.Hide(); - aFlPosition.Hide(); - - // Controls for Hatch-Background - aCbxHatchBckgrd.Show(); - aLbHatchBckgrdColor.Show(); - aCbxHatchBckgrd.Enable(); - aLbHatchBckgrdColor.Enable(); - - // Text der Tabelle setzen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pHatchingList->GetPath() ); - - aURL.Append( pHatchingList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( aURL.getBase().getLength() > 18 ) - { - aString += String(String(aURL.getBase()).Copy( 0, 15 )); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - ModifyHatchingHdl_Impl( this ); - ModifyHatchBckgrdColorHdl_Impl( this ); - ToggleHatchBckgrdColorHdl_Impl( this ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG ) -{ - const SfxPoolItem* pPoolItem = NULL; - sal_uInt16 _nPos = aLbHatching.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND ) - { - // ItemSet fuellen und an aCtlXRectPreview weiterleiten - XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos ); - - rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); - rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) ); - } - else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) ) - { - rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); - rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) ); - } - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) -{ - const SfxPoolItem* pPoolItem = NULL; - sal_uInt16 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); - aLbColor.SelectEntryPos( _nPos ); - if( _nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rXFSet.Put( XFillColorItem( String(), - aLbHatchBckgrdColor.GetSelectEntryColor() ) ); - } - else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) - { - Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); - rXFSet.Put( XFillColorItem( String(), aColor ) ); - } - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) -{ - // switch on/off backgroundcolor for hatches - aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() ); - - XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() ); - rXFSet.Put ( aItem, XATTR_FILLBACKGROUND ); - - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - { - if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT ) - { - XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) ); - aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); - } - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG ) -{ - aLbColor.Hide(); - aLbGradient.Hide(); - aLbHatching.Hide(); - aLbBitmap.Enable(); - aLbBitmap.Show(); - aCtlBitmapPreview.Enable(); - aCtlBitmapPreview.Show(); - aCtlXRectPreview.Hide(); - aFlStepCount.Hide(); - aTsbStepCount.Hide(); - aNumFldStepCount.Hide(); - - aTsbTile.Enable(); - aTsbStretch.Enable(); - aTsbScale.Enable(); - aTsbOriginal.Enable(); - aFtXSize.Enable(); - aMtrFldXSize.Enable(); - aFtYSize.Enable(); - aMtrFldYSize.Enable(); - aFlSize.Enable(); - aCtlPosition.Enable(); - aFtXOffset.Enable(); - aMtrFldXOffset.Enable(); - aFtYOffset.Enable(); - aMtrFldYOffset.Enable(); - aFlPosition.Enable(); - aRbtRow.Enable(); - aRbtColumn.Enable(); - aMtrFldOffset.Enable(); - aFlOffset.Enable(); - - // Controls for Hatch-Background - aCbxHatchBckgrd.Hide(); - aLbHatchBckgrdColor.Hide(); - - aTsbTile.Show(); - aTsbStretch.Show(); - aTsbScale.Show(); - aTsbOriginal.Show(); - aFtXSize.Show(); - aMtrFldXSize.Show(); - aFtYSize.Show(); - aMtrFldYSize.Show(); - aFlSize.Show(); - aCtlPosition.Show(); - aFtXOffset.Show(); - aMtrFldXOffset.Show(); - aFtYOffset.Show(); - aMtrFldYOffset.Show(); - aFlPosition.Show(); - aRbtRow.Show(); - aRbtColumn.Show(); - aMtrFldOffset.Show(); - aFlOffset.Show(); - - // Text der Tabelle setzen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pBitmapList->GetPath() ); - - aURL.Append( pBitmapList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - ModifyBitmapHdl_Impl( this ); - ModifyTileHdl_Impl( &aTsbOriginal ); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG ) -{ - const SfxPoolItem* pPoolItem = NULL; - sal_uInt16 _nPos = aLbBitmap.GetSelectEntryPos(); - if( _nPos != LISTBOX_ENTRY_NOTFOUND ) - { - // ItemSet fuellen und an aCtlXRectPreview weiterleiten - XBitmapEntry* pEntry = pBitmapList->GetBitmap( _nPos ); - - rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) ); - rXFSet.Put( XFillBitmapItem( String(), pEntry->GetXBitmap() ) ); - } - else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) ) - { - rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) ); - rXFSet.Put( XFillBitmapItem( String(), ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ) ); - } - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p ) -{ - if( p == &aTsbStepCount ) - { - if( aTsbStepCount.GetState() == STATE_NOCHECK ) - { - if( aNumFldStepCount.GetText().Len() == 0 ) - aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") )); - - aNumFldStepCount.Enable(); - } - else - aNumFldStepCount.Disable(); - } - - sal_uInt16 nValue = 0; - if( aTsbStepCount.GetState() != STATE_CHECK ) - { - // Zustand != Disabled ? - if( aNumFldStepCount.GetText().Len() > 0 ) - nValue = (sal_uInt16) aNumFldStepCount.GetValue(); - } - rXFSet.Put( XGradientStepCountItem( nValue ) ); - aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG ) -{ - TriState eState = aTsbTile.GetState(); - if( eState == STATE_CHECK ) - { - aTsbStretch.Disable(); - aRbtRow.Enable(); - aRbtColumn.Enable(); - aMtrFldOffset.Enable(); - aFlOffset.Enable(); - - aCtlPosition.Enable(); - aCtlPosition.Invalidate(); - aFtXOffset.Enable(); - aMtrFldXOffset.Enable(); - aFtYOffset.Enable(); - aMtrFldYOffset.Enable(); - aFlPosition.Enable(); - - aTsbScale.Enable(); - aTsbOriginal.Enable(); - aFtXSize.Enable(); - aMtrFldXSize.Enable(); - aFtYSize.Enable(); - aMtrFldYSize.Enable(); - aFlSize.Enable(); - } - else if( eState == STATE_NOCHECK ) - { - aTsbStretch.Enable(); - aRbtRow.Disable(); - aRbtColumn.Disable(); - aMtrFldOffset.Disable(); - aFlOffset.Disable(); - - aCtlPosition.Disable(); - aCtlPosition.Invalidate(); - aFtXOffset.Disable(); - aMtrFldXOffset.Disable(); - aFtYOffset.Disable(); - aMtrFldYOffset.Disable(); - aFlPosition.Disable(); - - if( aTsbStretch.GetState() != STATE_NOCHECK ) - { - aTsbScale.Disable(); - aTsbOriginal.Disable(); - aFtXSize.Disable(); - aMtrFldXSize.Disable(); - aFtYSize.Disable(); - aMtrFldYSize.Disable(); - aFlSize.Disable(); - } - else - { - aTsbScale.Enable(); - aTsbOriginal.Enable(); - aFtXSize.Enable(); - aMtrFldXSize.Enable(); - aFtYSize.Enable(); - aMtrFldYSize.Enable(); - aFlSize.Enable(); - } - } - else - { - aTsbStretch.Disable(); - aRbtRow.Disable(); - aRbtColumn.Disable(); - aMtrFldOffset.Disable(); - aFlOffset.Disable(); - - aCtlPosition.Disable(); - aCtlPosition.Invalidate(); - aFtXOffset.Disable(); - aMtrFldXOffset.Disable(); - aFtYOffset.Disable(); - aMtrFldYOffset.Disable(); - aFlPosition.Disable(); - - aTsbScale.Disable(); - aTsbOriginal.Disable(); - aFtXSize.Disable(); - aMtrFldXSize.Disable(); - aFtYSize.Disable(); - aMtrFldYSize.Disable(); - aFlSize.Disable(); - } - - if( aTsbOriginal.GetState() == STATE_CHECK ) - { - aMtrFldXSize.SetText( String() ); - aMtrFldYSize.SetText( String() ); - aFtXSize.Disable(); - aFtYSize.Disable(); - aMtrFldXSize.Disable(); - aMtrFldYSize.Disable(); - aTsbScale.Disable(); - } - else - { - aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() ); - aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() ); - } - - rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< sal_Bool >( eState ) ) ); - - if( aTsbStretch.IsEnabled() ) - rXFSet.Put( - XFillBmpStretchItem( - sal::static_int_cast< sal_Bool >( aTsbStretch.GetState() ) ) ); - - if( aTsbScale.IsEnabled() ) - rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) ); - - if( aMtrFldXSize.IsEnabled() ) - { - XFillBmpSizeXItem* pItem = NULL; - TriState eScaleState = aTsbScale.GetState(); - - if( eScaleState == STATE_NOCHECK ) - pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); - else - pItem = new XFillBmpSizeXItem( -labs( static_cast(aMtrFldXSize.GetValue()) ) ); - - rXFSet.Put( *pItem ); - - delete pItem; - } - else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) - { - // Originalgroesse -> Size == 0 - rXFSet.Put( XFillBmpSizeXItem( 0 ) ); - rXFSet.Put( XFillBmpSizeLogItem( sal_True ) ); - } - - if( aMtrFldYSize.IsEnabled() ) - { - XFillBmpSizeYItem* pItem = NULL; - TriState eScaleState = aTsbScale.GetState(); - - if( eScaleState == STATE_NOCHECK ) - pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); - else - pItem = new XFillBmpSizeYItem( -labs( static_cast(aMtrFldYSize.GetValue()) ) ); - - rXFSet.Put( *pItem ); - - delete pItem; - } - else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) - { - // Originalgroesse -> Size == 0 - rXFSet.Put( XFillBmpSizeYItem( 0 ) ); - rXFSet.Put( XFillBmpSizeLogItem( sal_True ) ); - } - - if( aMtrFldOffset.IsEnabled() ) - { - if( aRbtRow.IsChecked() ) - { - rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() ) ); - rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) 0 ) ); - } - else if( aRbtColumn.IsChecked() ) - { - rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) 0 ) ); - rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() ) ); - } - } - - if( aCtlPosition.IsEnabled() ) - rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) ); - - if( aMtrFldXOffset.IsEnabled() ) - rXFSet.Put( XFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() ) ); - - if( aMtrFldYOffset.IsEnabled() ) - rXFSet.Put( XFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() ) ); - - - aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlBitmapPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG ) -{ - if( aTsbScale.GetState() == STATE_CHECK ) - { - aMtrFldXSize.SetDecimalDigits( 0 ); - aMtrFldXSize.SetUnit( FUNIT_CUSTOM ); - aMtrFldXSize.SetValue( 100 ); - aMtrFldXSize.SetMax( 100 ); - aMtrFldXSize.SetLast( 100 ); - - aMtrFldYSize.SetDecimalDigits( 0 ); - aMtrFldYSize.SetUnit( FUNIT_CUSTOM ); - aMtrFldYSize.SetValue( 100 ); - aMtrFldYSize.SetMax( 100 ); - aMtrFldYSize.SetLast( 100 ); - } - else - { - aMtrFldXSize.SetDecimalDigits( 2 ); - aMtrFldXSize.SetUnit( eFUnit ); - aMtrFldXSize.SetValue( 100 ); - aMtrFldXSize.SetMax( 999900 ); - aMtrFldXSize.SetLast( 100000 ); - - aMtrFldYSize.SetDecimalDigits( 2 ); - aMtrFldYSize.SetUnit( eFUnit ); - aMtrFldYSize.SetValue( 100 ); - aMtrFldYSize.SetMax( 999900 ); - aMtrFldYSize.SetLast( 100000 ); - } - - ModifyTileHdl_Impl( NULL ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) -{ - eRP = eRcPt; - - // Ausrichtung der Bitmapfuellung - ModifyTileHdl_Impl( pWindow ); -} - -void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); - SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); - - if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); - if (pGradientListItem) - SetGradientList(pGradientListItem->GetGradientList()); - if (pHatchingListItem) - SetHatchingList(pHatchingListItem->GetHatchList()); - if (pBitmapListItem) - SetBitmapList(pBitmapListItem->GetBitmapList()); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if (pDlgTypeItem) - SetDlgType(pDlgTypeItem->GetValue()); - if (pPosItem) - SetPos(pPosItem->GetValue()); - Construct(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx deleted file mode 100644 index 34a9499c8..000000000 --- a/cui/source/tabpages/tpbitmap.cxx +++ /dev/null @@ -1,1150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -//svdraw.hxx -#define _SVDRAW_HXX -#define _SDR_NOITEMS -#define _SDR_NOTOUCH -#define _SDR_NOTRANSFORM -#define _SDR_NOOBJECTS -#define _SDR_NOVIEWS -#define _SDR_NOVIEWMARKER -#define _SDR_NODRAGMETHODS -#define _SDR_NOUNDO -#define _SDR_NOXOUTDEV -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include -#include -#include - -#define _SVX_TPBITMAP_CXX - -#include -#include "helpid.hrc" -#include "svx/xattr.hxx" -#include -#include -#include "svx/xoutbmp.hxx" -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "tabarea.hrc" -#include "defdlgname.hxx" -#include -#include -#include "sfx2/opengrf.hxx" -#include "paragrph.hrc" - -#define DLGWIN this->GetParent()->GetParent() - -/************************************************************************* -|* -|* Dialog zum Aendern und Definieren der Bitmaps -|* -\************************************************************************/ - -SvxBitmapTabPage::SvxBitmapTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_BITMAP ), rInAttrs ), - - aCtlPixel ( this, CUI_RES( CTL_PIXEL ) ), - aFtPixelEdit ( this, CUI_RES( FT_PIXEL_EDIT ) ), - aFtColor ( this, CUI_RES( FT_COLOR ) ), - aLbColor ( this, CUI_RES( LB_COLOR ) ), - aFtBackgroundColor ( this, CUI_RES( FT_BACKGROUND_COLOR ) ), - aLbBackgroundColor ( this, CUI_RES( LB_BACKGROUND_COLOR ) ), - // This fix text is used only to provide the name for the following - // bitmap list box. The fixed text is not displayed. - aLbBitmapsHidden ( this, CUI_RES( FT_BITMAPS_HIDDEN ) ), - aLbBitmaps ( this, CUI_RES( LB_BITMAPS ) ), - aFlProp ( this, CUI_RES( FL_PROP ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnImport ( this, CUI_RES( BTN_IMPORT ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - - aBitmapCtl ( this, aCtlPreview.GetSizePixel() ), - rOutAttrs ( rInAttrs ), - - pColorTab( NULL ), - pBitmapList( NULL ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFStyleItem ( XFILL_BITMAP ), - aXBitmapItem ( String(), XOBitmap() ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) -{ - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Setzen des Output-Devices - rXFSet.Put( aXFStyleItem ); - rXFSet.Put( aXBitmapItem ); - - aBtnAdd.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickAddHdl_Impl ) ); - aBtnImport.SetClickHdl( - LINK( this, SvxBitmapTabPage, ClickImportHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxBitmapTabPage, ClickModifyHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxBitmapTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( LINK( this, SvxBitmapTabPage, ClickSaveHdl_Impl ) ); - - aLbBitmaps.SetSelectHdl( - LINK( this, SvxBitmapTabPage, ChangeBitmapHdl_Impl ) ); - aLbColor.SetSelectHdl( - LINK( this, SvxBitmapTabPage, ChangePixelColorHdl_Impl ) ); - aLbBackgroundColor.SetSelectHdl( - LINK( this, SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl ) ); - - String accName = String(SVX_RES(STR_EXAMPLE)); - aCtlPreview.SetAccessibleName(accName); - aCtlPixel.SetAccessibleRelationMemberOf( &aFlProp ); - aCtlPixel.SetAccessibleRelationLabeledBy( &aFtPixelEdit ); - aLbBitmaps.SetAccessibleRelationLabeledBy(&aLbBitmaps); - aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnModify.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnImport.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnDelete.SetAccessibleRelationMemberOf( &aFlProp ); - -} - -// ----------------------------------------------------------------------- - -void SvxBitmapTabPage::Construct() -{ - // Farbtabellen - aLbColor.Fill( pColorTab ); - aLbBackgroundColor.CopyEntries( aLbColor ); - - // Bitmaptabelle - aLbBitmaps.Fill( pBitmapList ); -} - -// ----------------------------------------------------------------------- - -void SvxBitmapTabPage::ActivatePage( const SfxItemSet& ) -{ - sal_uInt16 nPos; - sal_uInt16 nCount; - - if( *pDlgType == 0 ) // Flaechen-Dialog - { - *pbAreaTP = sal_False; - - if( pColorTab ) - { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) - { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); - - // LbColor - nPos = aLbColor.GetSelectEntryPos(); - aLbColor.Clear(); - aLbColor.Fill( pColorTab ); - nCount = aLbColor.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbColor.SelectEntryPos( 0 ); - else - aLbColor.SelectEntryPos( nPos ); - - // LbColorBackground - nPos = aLbBackgroundColor.GetSelectEntryPos(); - aLbBackgroundColor.Clear(); - aLbBackgroundColor.CopyEntries( aLbColor ); - nCount = aLbBackgroundColor.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbBackgroundColor.SelectEntryPos( 0 ); - else - aLbBackgroundColor.SelectEntryPos( nPos ); - - ChangePixelColorHdl_Impl( this ); - ChangeBackgrndColorHdl_Impl( this ); - } - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pBitmapList->GetPath() ); - - aURL.Append( pBitmapList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - if( *pPageType == PT_BITMAP && *pPos != LISTBOX_ENTRY_NOTFOUND ) - { - aLbBitmaps.SelectEntryPos( *pPos ); - } - // Farben koennten geloescht worden sein - ChangeBitmapHdl_Impl( this ); - - *pPageType = PT_BITMAP; - *pPos = LISTBOX_ENTRY_NOTFOUND; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxBitmapTabPage::DeactivatePage( SfxItemSet* _pSet) -{ - if ( CheckChanges_Impl() == -1L ) - return KEEP_PAGE; - - if( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxBitmapTabPage::FillItemSet( SfxItemSet& _rOutAttrs ) -{ - if( *pDlgType == 0 && *pbAreaTP == sal_False ) // Flaechen-Dialog - { - if( *pPageType == PT_BITMAP ) - { - // CheckChanges_Impl(); <-- doppelte Abfrage ? - - XOBitmap aXOBitmap; - String aString; - sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap(); - aString = aLbBitmaps.GetSelectEntry(); - - } - else - { - aXOBitmap = aBitmapCtl.GetXBitmap(); - - // #85339# if it's an array, force conversion to bitmap before using it. - if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) - aXOBitmap.GetBitmap(); - - } - _rOutAttrs.Put( XFillStyleItem( XFILL_BITMAP ) ); - _rOutAttrs.Put( XFillBitmapItem( aString, aXOBitmap ) ); - } - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -void SvxBitmapTabPage::Reset( const SfxItemSet& ) -{ - // aLbBitmaps.SelectEntryPos( 0 ); - - aBitmapCtl.SetLines( aCtlPixel.GetLineCount() ); - aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); - aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); - aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); - - // Bitmap holen und darstellen - XFillBitmapItem aBmpItem( (const String &) String(), aBitmapCtl.GetXBitmap() ); - rXFSet.Put( aBmpItem ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); - - ChangeBitmapHdl_Impl( this ); - - // Status der Buttons ermitteln - if( pBitmapList->Count() ) - { - aBtnAdd.Enable(); - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow, - const SfxItemSet& rSet ) -{ - return new SvxBitmapTabPage( pWindow, rSet ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ChangeBitmapHdl_Impl, void *, EMPTYARG ) -{ - XOBitmap* pXOBitmap = NULL; - int nPos = aLbBitmaps.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); - else - { - const SfxPoolItem* pPoolItem = NULL; - if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), sal_True, &pPoolItem ) ) - { - XFillStyle eXFS = (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue(); - if( ( XFILL_BITMAP == eXFS ) && - ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) ) ) - { - pXOBitmap = new XOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); - } - } - if( !pXOBitmap ) - { - aLbBitmaps.SelectEntryPos( 0 ); - nPos = aLbBitmaps.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pXOBitmap = new XOBitmap( ( (XBitmapEntry*) pBitmapList->GetBitmap( nPos ) )->GetXBitmap() ); - } - } - if( pXOBitmap ) - { - // #85339# try to convert bitmapped item to array item. - if(pXOBitmap->GetBitmapType() == XBITMAP_IMPORT) - { - Bitmap aBitmap(pXOBitmap->GetBitmap()); - Size aSizePixel(aBitmap.GetSizePixel()); - - if(8 == aSizePixel.Width() && 8 == aSizePixel.Height()) - { - sal_uInt16* pPixelArray = new sal_uInt16[64]; - sal_uInt32 nCol1(0xffffffff); // background - sal_uInt32 nCol2(0xffffffff); // pixel - BitmapReadAccess* pAccess = aBitmap.AcquireReadAccess(); - sal_Bool bValid(sal_True); - - if(pAccess) - { - for(sal_uInt32 a(0); bValid && a < 64; a++) - { - const BitmapColor aBmCol = pAccess->GetColor(a>>3, a%8); - Color aRgbCol(aBmCol.GetRed(), aBmCol.GetGreen(), aBmCol.GetBlue()); - sal_uInt32 nColVal = aRgbCol.GetRGBColor(); - - // test with nCol1 - if(nCol1 != nColVal) - { - if(0xffffffff == nCol1) - { - // nCol1 is used first time - nCol1 = nColVal; - pPixelArray[a] = 0; - } - else - { - // test with nCol2 - if(nCol2 != nColVal) - { - if(0xffffffff == nCol2) - { - // nCol2 used first time - nCol2 = nColVal; - pPixelArray[a] = 1; - } - else - { - // Third color detected - bValid = sal_False; - } - } - else - { - // color is pixel color - pPixelArray[a] = 1; - } - } - } - else - { - // color is background color - pPixelArray[a] = 0; - } - } - - // release ReadAccess - aBitmap.ReleaseAccess(pAccess); - } - else - { - // no access -> no success - bValid = sal_False; - } - - if(bValid) - { - Color aCol1(nCol1); - Color aCol2(nCol2); - - // no pixel color found? Use opposite od background color. - if(0xffffffff == nCol2) - { - aCol2 = Color( - 0xff - aCol1.GetRed(), - 0xff - aCol1.GetGreen(), - 0xff - aCol1.GetBlue()); - } - - // transformation did work, create a new Item - delete pXOBitmap; - pXOBitmap = new XOBitmap(pPixelArray, aCol2, aCol1); - } - - // cleanup - delete[] pPixelArray; - } - } - - aLbColor.SetNoSelection(); - aLbBackgroundColor.SetNoSelection(); - - if( pXOBitmap->GetBitmapType() == XBITMAP_IMPORT ) - { - aCtlPixel.Reset(); - aCtlPixel.SetPaintable( sal_False ); - aCtlPixel.Disable(); - aFtPixelEdit.Disable(); - aFtColor.Disable(); - aLbColor.Disable(); - aFtBackgroundColor.Disable(); - aLbBackgroundColor.Disable(); - aBtnModify.Disable(); - aBtnAdd.Disable(); - } - else if( pXOBitmap->GetBitmapType() == XBITMAP_8X8 ) - { - aCtlPixel.SetPaintable( sal_True ); - aCtlPixel.Enable(); - aFtPixelEdit.Enable(); - aFtColor.Enable(); - aLbColor.Enable(); - aFtBackgroundColor.Enable(); - aLbBackgroundColor.Enable(); - aBtnModify.Enable(); - aBtnAdd.Enable(); - - // Setzen des PixelControls - aCtlPixel.SetXBitmap( *pXOBitmap ); - - Color aPixelColor = pXOBitmap->GetPixelColor(); - Color aBackColor = pXOBitmap->GetBackgroundColor(); - - aBitmapCtl.SetPixelColor( aPixelColor ); - aBitmapCtl.SetBackgroundColor( aBackColor ); - - // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe - // temporaer hinzugenommen - if( 0 == aLbBitmaps.GetSelectEntryPos() ) - { - aLbColor.SelectEntry( Color( COL_BLACK ) ); - ChangePixelColorHdl_Impl( this ); - } - else - aLbColor.SelectEntry( aPixelColor ); - if( aLbColor.GetSelectEntryCount() == 0 ) - { - aLbColor.InsertEntry( aPixelColor, String() ); - aLbColor.SelectEntry( aPixelColor ); - } - aLbBackgroundColor.SelectEntry( aBackColor ); - if( aLbBackgroundColor.GetSelectEntryCount() == 0 ) - { - aLbBackgroundColor.InsertEntry( aBackColor, String() ); - aLbBackgroundColor.SelectEntry( aBackColor ); - } - } - aCtlPixel.Invalidate(); - - // Bitmap darstellen - XFillBitmapItem aXBmpItem( (const String &) String(), *pXOBitmap ); - rXFSet.Put( aXBmpItem ); - - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); - - bBmpChanged = sal_False; - delete pXOBitmap; - } - return 0L; -} - -// ----------------------------------------------------------------------- - -long SvxBitmapTabPage::CheckChanges_Impl() -{ - sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - String aString = aLbBitmaps.GetSelectEntry(); - - if( bBmpChanged ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, - String( SVX_RES( RID_SVXSTR_BITMAP ) ), - String( CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ) ), - &aWarningBoxImage ); - DBG_ASSERT(aMessDlg, "Dialogdiet fail!"); - aMessDlg->SetButtonText( MESS_BTN_1, - String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); - aMessDlg->SetButtonText( MESS_BTN_2, - String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); - - short nRet = aMessDlg->Execute(); - - switch( nRet ) - { - case RET_BTN_1: // Aendern - { - ClickModifyHdl_Impl( this ); - } - break; - - case RET_BTN_2: // Hinzufuegen - { - ClickAddHdl_Impl( this ); - nPos = aLbBitmaps.GetSelectEntryPos(); - } - break; - - case RET_CANCEL: - break; - } - delete aMessDlg; - } - } - nPos = aLbBitmaps.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - *pPos = nPos; - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_BITMAP ) ); - String aDesc( CUI_RES( RID_SVXSTR_DESC_NEW_BITMAP ) ); - String aName; - - long nCount = pBitmapList->Count(); - long j = 1; - sal_Bool bDifferent = sal_False; - - while( !bDifferent ) - { - aName = aNewName; - aName += sal_Unicode(' '); - aName += UniString::CreateFromInt32( j++ ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pBitmapList->GetBitmap( i )->GetName() ) - bDifferent = sal_False; - } - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - WarningBox* pWarnBox = NULL; - sal_uInt16 nError = RID_SVXSTR_WARN_NAME_DUPLICATE; - - while( pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pBitmapList->GetBitmap( i )->GetName() ) - bDifferent = sal_False; - - if( bDifferent ) { - nError = 0; - break; - } - - if( !pWarnBox ) - { - pWarnBox = new WarningBox( DLGWIN, - WinBits( WB_OK_CANCEL ), - String( ResId( nError, rMgr ) ) ); - pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); - } - - if( pWarnBox->Execute() != RET_OK ) - break; - } - delete pDlg; - delete pWarnBox; - - if( !nError ) - { - XBitmapEntry* pEntry = 0; - if( aCtlPixel.IsEnabled() ) - { - XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); - - // #85339# if it's an array, force conversion to bitmap before using it. - if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) - aXOBitmap.GetBitmap(); - - pEntry = new XBitmapEntry( aXOBitmap, aName ); - } - else // Es muss sich um eine nicht vorhandene importierte Bitmap handeln - { - const SfxPoolItem* pPoolItem = NULL; - if( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLBITMAP, sal_True, &pPoolItem ) ) - { - XOBitmap aXOBitmap( ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ); - pEntry = new XBitmapEntry( aXOBitmap, aName ); - } - } - - DBG_ASSERT( pEntry, "SvxBitmapTabPage::ClickAddHdl_Impl(), pEntry == 0 ?" ); - - if( pEntry ) - { - pBitmapList->Insert( pEntry ); - - aLbBitmaps.Append( pEntry ); - aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); - -#ifdef WNT - // hack: #31355# W.P. - Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - //aLbBitmaps.Invalidate(); - } -#endif - - // Flag fuer modifiziert setzen - *pnBitmapListState |= CT_MODIFIED; - - ChangeBitmapHdl_Impl( this ); - } - } - - // Status der Buttons ermitteln - if( pBitmapList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return 0L; -} - - -/******************************************************************************/ -/******************************************************************************/ - - -//------------------------------------------------------------------------ - -#ifdef _MSC_VER -#pragma optimize ( "", off ) -#endif - -IMPL_LINK( SvxBitmapTabPage, ClickImportHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - SvxOpenGraphicDialog aDlg( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Import" ) ) ); - aDlg.EnableLink(sal_False); - - if( !aDlg.Execute() ) - { - Graphic aGraphic; - int nError = 1; - - EnterWait(); - nError = aDlg.GetGraphic( aGraphic ); - LeaveWait(); - - if( !nError ) - { - String aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) ); - WarningBox* pWarnBox = NULL; - - // convert file URL to UI name - String aName; - INetURLObject aURL( aDlg.GetPath() ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, String(aURL.GetName()).GetToken( 0, '.' ), aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - nError = RID_SVXSTR_WARN_NAME_DUPLICATE; - - while( pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - - sal_Bool bDifferent = sal_True; - long nCount = pBitmapList->Count(); - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pBitmapList->GetBitmap( i )->GetName() ) - bDifferent = sal_False; - - if( bDifferent ) { - nError = 0; - break; - } - - if( !pWarnBox ) - { - pWarnBox = new WarningBox( DLGWIN, - WinBits( WB_OK_CANCEL ), - String( ResId( nError, rMgr ) ) ); - pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); - } - - - if( pWarnBox->Execute() != RET_OK ) - break; - } - delete pDlg; - delete pWarnBox; - - if( !nError ) - { - Bitmap aBmp( aGraphic.GetBitmap() ); - XBitmapEntry* pEntry = - new XBitmapEntry( XOBitmap( aBmp ), aName ); - pBitmapList->Insert( pEntry ); - - aLbBitmaps.Append( pEntry ); - aLbBitmaps.SelectEntryPos( aLbBitmaps.GetEntryCount() - 1 ); - -#ifdef WNT - // hack: #31355# W.P. - Rectangle aRect( aLbBitmaps.GetPosPixel(), aLbBitmaps.GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - } -#endif - - // Flag fuer modifiziert setzen - *pnBitmapListState |= CT_MODIFIED; - - ChangeBitmapHdl_Impl( this ); - } - } - else - // Graphik konnte nicht geladen werden - ErrorBox( DLGWIN, - WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - - return 0L; -} - -#ifdef _MSC_VER -#pragma optimize ( "", on ) -#endif - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_BITMAP ) ); - String aDesc( ResId( RID_SVXSTR_DESC_NEW_BITMAP, rMgr ) ); - String aName( pBitmapList->GetBitmap( nPos )->GetName() ); - String aOldName = aName; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - - long nCount = pBitmapList->Count(); - sal_Bool bDifferent = sal_False; - sal_Bool bLoop = sal_True; - - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pBitmapList->GetBitmap( i )->GetName() && - aName != aOldName ) - bDifferent = sal_False; - } - - if( bDifferent ) - { - bLoop = sal_False; - XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos ); - - pEntry->SetName( aName ); - - XOBitmap aXOBitmap = aBitmapCtl.GetXBitmap(); - - // #85339# if it's an array, force conversion to bitmap before using it. - if(aXOBitmap.GetBitmapType() == XBITMAP_8X8) - aXOBitmap.GetBitmap(); - - pEntry->SetXBitmap( aXOBitmap ); - - aLbBitmaps.Modify( pEntry, nPos ); - aLbBitmaps.SelectEntryPos( nPos ); - - // Flag fuer modifiziert setzen - *pnBitmapListState |= CT_MODIFIED; - - bBmpChanged = sal_False; - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - } - delete pDlg; - } - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbBitmaps.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_BITMAP ) ) ); - - if( aQueryBox.Execute() == RET_YES ) - { - delete pBitmapList->Remove( nPos ); - aLbBitmaps.RemoveEntry( nPos ); - aLbBitmaps.SelectEntryPos( 0 ); - - aCtlPreview.Invalidate(); - aCtlPixel.Invalidate(); - - ChangeBitmapHdl_Impl( this ); - - // Flag fuer modifiziert setzen - *pnBitmapListState |= CT_MODIFIED; - } - } - // Status der Buttons ermitteln - if( !pBitmapList->Count() ) - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBitmapTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nReturn = RET_YES; - ResMgr& rMgr = CUI_MGR(); - - if ( *pnBitmapListState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pBitmapList->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - EnterWait(); - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Tabelle speichern - XBitmapList* pBmpList = new XBitmapList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pBmpList->SetName( aURL.getName() ); - if( pBmpList->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - if( pBitmapList != ( (SvxAreaTabDialog*) DLGWIN )->GetBitmapList() ) - delete pBitmapList; - - pBitmapList = pBmpList; - ( (SvxAreaTabDialog*) DLGWIN )->SetNewBitmapList( pBitmapList ); - - aLbBitmaps.Clear(); - aLbBitmaps.Fill( pBitmapList ); - Reset( rOutAttrs ); - - pBitmapList->SetName( aURL.getName() ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gewechselt setzen - *pnBitmapListState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnBitmapListState &= ~CT_MODIFIED; - LeaveWait(); - } - else - { - LeaveWait(); - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - } - } - - // Status der Buttons ermitteln - if( pBitmapList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxBitmapTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sob" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pBitmapList->GetName().Len() ) - { - aFile.Append( pBitmapList->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sob" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pBitmapList->SetName( aURL.getName() ); - pBitmapList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pBitmapList->Save() ) - { - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gespeichert setzen - *pnBitmapListState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnBitmapListState &= ~CT_MODIFIED; - } - else - { - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); - } - } - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ChangePixelColorHdl_Impl, void *, EMPTYARG ) -{ - aCtlPixel.SetPixelColor( aLbColor.GetSelectEntryColor() ); - aCtlPixel.Invalidate(); - - aBitmapCtl.SetPixelColor( aLbColor.GetSelectEntryColor() ); - - // Bitmap holen und darstellen - rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); - - bBmpChanged = sal_True; - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxBitmapTabPage, ChangeBackgrndColorHdl_Impl, void *, EMPTYARG ) -{ - aCtlPixel.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); - aCtlPixel.Invalidate(); - - aBitmapCtl.SetBackgroundColor( aLbBackgroundColor.GetSelectEntryColor() ); - - // Bitmap holen und darstellen - rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); - - bBmpChanged = sal_True; - - return 0L; -} - -//------------------------------------------------------------------------ - -void SvxBitmapTabPage::PointChanged( Window* pWindow, RECT_POINT ) -{ - if( pWindow == &aCtlPixel ) - { - aBitmapCtl.SetBmpArray( aCtlPixel.GetBitmapPixelPtr() ); - - // Bitmap holen und darstellen - rXFSet.Put( XFillBitmapItem( String(), aBitmapCtl.GetXBitmap() ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); - - bBmpChanged = sal_True; - } -} - - - - -Window* SvxBitmapTabPage::GetParentLabeledBy( const Window* pLabeled ) const -{ - if (pLabeled == &aLbBitmaps) - return const_cast(&aLbBitmapsHidden); - else - return SvxTabPage::GetParentLabeledBy (pLabeled); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx deleted file mode 100644 index 406e4985f..000000000 --- a/cui/source/tabpages/tpcolor.cxx +++ /dev/null @@ -1,1264 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#define _SVX_TPCOLOR_CXX - -#include -#include "helpid.hrc" -#include "svx/xattr.hxx" -#include -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "tabarea.hrc" -#include "defdlgname.hxx" -#include -#include -#include -#include -#include - -#define DLGWIN GetParentDialog( this ) - -/************************************************************************* -|* -|* Dialog zum Aendern und Definieren der Farben -|* -\************************************************************************/ - -static Window* GetParentDialog( Window* pWindow ) -{ - while( pWindow ) - { - if( pWindow->IsDialog() ) - break; - - pWindow = pWindow->GetParent(); - } - - return pWindow; -} - -SvxColorTabPage::SvxColorTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - - SfxTabPage ( pParent, CUI_RES( RID_SVXPAGE_COLOR ), rInAttrs ), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aFtName ( this, CUI_RES( FT_NAME ) ), - aEdtName ( this, CUI_RES( EDT_NAME ) ), - aFtColor ( this, CUI_RES( FT_COLOR ) ), - aLbColor ( this, CUI_RES( LB_COLOR ) ), - - aTableNameFT ( this, CUI_RES( FT_TABLE_NAME ) ), - aValSetColorTable ( this, CUI_RES( CTL_COLORTABLE ) ), - - aCtlPreviewOld ( this, CUI_RES( CTL_PREVIEW_OLD ) ), - aCtlPreviewNew ( this, CUI_RES( CTL_PREVIEW_NEW ) ), - - aLbColorModel ( this, CUI_RES( LB_COLORMODEL ) ), - aFtColorModel1 ( this, CUI_RES( FT_1 ) ), - aMtrFldColorModel1 ( this, CUI_RES( MTR_FLD_1 ) ), - aFtColorModel2 ( this, CUI_RES( FT_2 ) ), - aMtrFldColorModel2 ( this, CUI_RES( MTR_FLD_2 ) ), - aFtColorModel3 ( this, CUI_RES( FT_3 ) ), - aMtrFldColorModel3 ( this, CUI_RES( MTR_FLD_3 ) ), - aFtColorModel4 ( this, CUI_RES( FT_4 ) ), - aMtrFldColorModel4 ( this, CUI_RES( MTR_FLD_4 ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnWorkOn ( this, CUI_RES( BTN_WORK_ON ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - - rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - - bDeleteColorTable ( sal_True ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFStyleItem ( XFILL_SOLID ), - aXFillColorItem ( String(), Color( COL_BLACK ) ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ), - - eCM ( CM_RGB ) - -{ - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Setzen des Output-Devices - rXFSet.Put( aXFStyleItem ); - rXFSet.Put( aXFillColorItem ); - aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - // Handler ueberladen - aLbColor.SetSelectHdl( - LINK( this, SvxColorTabPage, SelectColorLBHdl_Impl ) ); - aValSetColorTable.SetSelectHdl( - LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ) ); - aLbColorModel.SetSelectHdl( - LINK( this, SvxColorTabPage, SelectColorModelHdl_Impl ) ); - - Link aLink = LINK( this, SvxColorTabPage, ModifiedHdl_Impl ); - aMtrFldColorModel1.SetModifyHdl( aLink ); - aMtrFldColorModel2.SetModifyHdl( aLink ); - aMtrFldColorModel3.SetModifyHdl( aLink ); - aMtrFldColorModel4.SetModifyHdl( aLink ); - - aBtnAdd.SetClickHdl( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxColorTabPage, ClickModifyHdl_Impl ) ); - aBtnWorkOn.SetClickHdl( - LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( LINK( this, SvxColorTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) ); - - // ValueSet - aValSetColorTable.SetStyle( aValSetColorTable.GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); - aValSetColorTable.SetColCount( 8 ); - aValSetColorTable.SetLineCount( 13 ); - aValSetColorTable.SetExtraSpacing( 0 ); - aValSetColorTable.Show(); - - aLbColorModel.SetAccessibleName( String( CUI_RES(STR_CUI_COLORMODEL) ) ); - aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnModify.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnWorkOn.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnDelete.SetAccessibleRelationMemberOf( &aFlProp ); -} - -// ----------------------------------------------------------------------- - -void SvxColorTabPage::Construct() -{ - aLbColor.Fill( pColorTab ); - FillValueSet_Impl( aValSetColorTable ); -} - -// ----------------------------------------------------------------------- - -void SvxColorTabPage::ActivatePage( const SfxItemSet& ) -{ - if( *pDlgType == 0 ) // Flaechen-Dialog - { - *pbAreaTP = sal_False; - - if( pColorTab ) - { - if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND ) - { - aLbColor.SelectEntryPos( *pPos ); - aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); - aEdtName.SetText( aLbColor.GetSelectEntry() ); - - ChangeColorHdl_Impl( this ); - } - else if( *pPageType == PT_COLOR && *pPos == LISTBOX_ENTRY_NOTFOUND ) - { - const SfxPoolItem* pPoolItem = NULL; - if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) - { - aLbColorModel.SelectEntryPos( CM_RGB ); - - aAktuellColor.SetColor ( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue().GetColor() ); - - aEdtName.SetText( ( ( const XFillColorItem* ) pPoolItem )->GetName() ); - - aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); - aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); - aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); - - // ItemSet fuellen und an XOut weiterleiten - rXFSet.Put( XFillColorItem( String(), aAktuellColor ) ); - aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewNew.Invalidate(); - aCtlPreviewOld.Invalidate(); - } - } - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pColorTab->GetPath() ); - - aURL.Append( pColorTab->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - aTableNameFT.SetText( aString ); - - // Damit evtl. geaenderte Farbe verworfen wird - SelectColorLBHdl_Impl( this ); - - *pPageType = PT_COLOR; - *pPos = LISTBOX_ENTRY_NOTFOUND; - } - } - else - { - // Buttons werden gehided, weil Paletten z.Z. nur - // ueber den AreaDlg funktionieren!!! - // ActivatePage() muss von anderen Dialogen explizit - // gerufen werden, da ActivatePage() nicht gerufen wird, - // wenn Seite als Erste im Dialog angezeigt wird - aBtnLoad.Hide(); - aBtnSave.Hide(); - } -} - -// ----------------------------------------------------------------------- - -int SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( CheckChanges_Impl() == -1L ) - return( KEEP_PAGE ); - - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -long SvxColorTabPage::CheckChanges_Impl() -{ - // wird hier benutzt, um Aenderungen NICHT zu verlieren - - Color aTmpColor (aAktuellColor); - if (eCM != CM_RGB) - ConvertColorValues (aTmpColor, CM_RGB); - - sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - Color aColor = pColorTab->GetColor( nPos )->GetColor(); - String aString = aLbColor.GetSelectEntry(); - - // aNewColor, da COL_USER != COL_irgendwas, auch wenn RGB-Werte gleich - // Color aNewColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); - - if( ColorToPercent_Impl( aTmpColor.GetRed() ) != ColorToPercent_Impl( aColor.GetRed() ) || - ColorToPercent_Impl( aTmpColor.GetGreen() ) != ColorToPercent_Impl( aColor.GetGreen() ) || - ColorToPercent_Impl( aTmpColor.GetBlue() ) != ColorToPercent_Impl( aColor.GetBlue() ) || - aString != aEdtName.GetText() ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, - SVX_RESSTR( RID_SVXSTR_COLOR ), - String( ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ) ), - &aWarningBoxImage ); - DBG_ASSERT(aMessDlg, "Dialogdiet fail!"); - aMessDlg->SetButtonText( MESS_BTN_1, - String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); - aMessDlg->SetButtonText( MESS_BTN_2, - String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); - - short nRet = aMessDlg->Execute(); - - switch( nRet ) - { - case RET_BTN_1: // Aendern - { - ClickModifyHdl_Impl( this ); - aColor = pColorTab->GetColor( nPos )->GetColor(); - } - break; - - case RET_BTN_2: // Hinzufuegen - { - ClickAddHdl_Impl( this ); - nPos = aLbColor.GetSelectEntryPos(); - aColor = pColorTab->GetColor( nPos )->GetColor(); - } - break; - - case RET_CANCEL: - break; - } - delete aMessDlg; - } - } - if( *pDlgType == 0 ) // Flaechen-Dialog - { - nPos = aLbColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - *pPos = nPos; - } - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxColorTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( ( *pDlgType != 0 ) || - ( *pPageType == PT_COLOR && *pbAreaTP == sal_False ) ) - { - String aString; - Color aColor; - - sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aColor = pColorTab->GetColor( nPos )->GetColor(); - aString = aLbColor.GetSelectEntry(); - } - else - { - aColor.SetColor (aAktuellColor.GetColor()); - if (eCM != CM_RGB) - ConvertColorValues (aColor, CM_RGB); - } - rSet.Put( XFillColorItem( aString, aColor ) ); - rSet.Put( XFillStyleItem( XFILL_SOLID ) ); - } - - return( sal_True ); -} - -// ----------------------------------------------------------------------- - -void SvxColorTabPage::Reset( const SfxItemSet& rSet ) -{ - sal_uInt16 nState = rSet.GetItemState( XATTR_FILLCOLOR ); - - if ( nState >= SFX_ITEM_DEFAULT ) - { - XFillColorItem aColorItem( (const XFillColorItem&)rSet.Get( XATTR_FILLCOLOR ) ); - aLbColor.SelectEntry( aColorItem.GetColorValue() ); - aValSetColorTable.SelectItem( aLbColor.GetSelectEntryPos() + 1 ); - aEdtName.SetText( aLbColor.GetSelectEntry() ); - } - - // Farbmodell setzen - String aStr = GetUserData(); - aLbColorModel.SelectEntryPos( (sal_uInt16) aStr.ToInt32() ); - - ChangeColorHdl_Impl( this ); - SelectColorModelHdl_Impl( this ); - - aCtlPreviewOld.Invalidate(); - - // Status der Buttons ermitteln - if( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxColorTabPage::Create( Window* pWindow, - const SfxItemSet& rOutAttrs ) -{ - return( new SvxColorTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -// -// Wird aufgerufen, wenn Inhalt der MtrFileds f�r Farbwerte ver�ndert wird -// -IMPL_LINK( SvxColorTabPage, ModifiedHdl_Impl, void *, EMPTYARG ) -{ - // lese aktuelle MtrFields aus, wenn cmyk, dann k-Wert als Trans.-Farbe - aAktuellColor.SetColor ( Color( (sal_uInt8)PercentToColor_Impl( (sal_uInt16) aMtrFldColorModel4.GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) aMtrFldColorModel1.GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) aMtrFldColorModel2.GetValue() ), - (sal_uInt8)PercentToColor_Impl( (sal_uInt16) aMtrFldColorModel3.GetValue() ) ).GetColor() ); - - Color aTmpColor(aAktuellColor); - if (eCM != CM_RGB) - ConvertColorValues (aTmpColor, CM_RGB); - - rXFSet.Put( XFillColorItem( String(), aTmpColor ) ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewNew.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -// -// Button 'Hinzuf�gen' -// -IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - Window *pWindow = this; - while( pWindow ) - { - pWindow = pWindow->GetParent(); - } - - ResMgr& rMgr = CUI_MGR(); - String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); - String aName( aEdtName.GetText() ); - XColorEntry* pEntry; - long nCount = pColorTab->Count(); - sal_Bool bDifferent = sal_True; - - // Pruefen, ob Name schon vorhanden ist - for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pColorTab->GetColor( i )->GetName() ) - bDifferent = sal_False; - - // Wenn ja, wird wiederholt ein neuer Name angefordert - if ( !bDifferent ) - { - WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aWarningBox.Execute(); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - sal_Bool bLoop = sal_True; - - while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pColorTab->GetColor( i )->GetName() ) - bDifferent = sal_False; - } - - if( bDifferent ) - bLoop = sal_False; - else - aWarningBox.Execute(); - } - delete( pDlg ); - } - - // Wenn nicht vorhanden, wird Eintrag aufgenommen - if( bDifferent ) - { - if (eCM != CM_RGB) - ConvertColorValues (aAktuellColor, CM_RGB); - pEntry = new XColorEntry( aAktuellColor, aName ); - - pColorTab->Insert( pColorTab->Count(), pEntry ); - - aLbColor.Append( pEntry ); - aValSetColorTable.InsertItem( aValSetColorTable.GetItemCount() + 1, - pEntry->GetColor(), pEntry->GetName() ); - - aLbColor.SelectEntryPos( aLbColor.GetEntryCount() - 1 ); - - // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; - - SelectColorLBHdl_Impl( this ); - } - // Status der Buttons ermitteln - if( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -// -// Button '�ndern' -// -IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); - String aName( aEdtName.GetText() ); - long nCount = pColorTab->Count(); - sal_Bool bDifferent = sal_True; - - // Pruefen, ob Name schon vorhanden ist - for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) - bDifferent = sal_False; - - // Wenn ja, wird wiederholt ein neuer Name angefordert - if ( !bDifferent ) - { - WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aWarningBox.Execute(); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - sal_Bool bLoop = sal_True; - - while ( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for ( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) - bDifferent = sal_False; - - if( bDifferent ) - bLoop = sal_False; - else - aWarningBox.Execute(); - } - delete( pDlg ); - } - - // Wenn nicht vorhanden, wird Eintrag aufgenommen - if( bDifferent ) - { - XColorEntry* pEntry = pColorTab->GetColor( nPos ); - - Color aTmpColor (aAktuellColor); - if (eCM != CM_RGB) - ConvertColorValues (aTmpColor, CM_RGB); - - pEntry->SetColor( aTmpColor ); - pEntry->SetName( aName ); - - aLbColor.Modify( pEntry, nPos ); - aLbColor.SelectEntryPos( nPos ); - ///// - aValSetColorTable.SetItemColor( nPos + 1, pEntry->GetColor() ); - aValSetColorTable.SetItemText( nPos + 1, pEntry->GetName() ); - aEdtName.SetText( aName ); - - aCtlPreviewOld.Invalidate(); - - // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; - } - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -// -// Button 'Bearbeiten' -// -IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG ) -{ - SvColorDialog* pColorDlg = new SvColorDialog( DLGWIN ); - - Color aTmpColor (aAktuellColor); - if (eCM != CM_RGB) - ConvertColorValues (aTmpColor, CM_RGB); - - pColorDlg->SetColor (aTmpColor); - pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY ); - - if( pColorDlg->Execute() == RET_OK ) - { - sal_uInt16 nK = 0; - Color aPreviewColor = pColorDlg->GetColor(); - aAktuellColor = aPreviewColor; - if (eCM != CM_RGB) - ConvertColorValues (aAktuellColor, eCM); - - aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); - aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); - aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); - aMtrFldColorModel4.SetValue( ColorToPercent_Impl( nK ) ); - - // ItemSet fuellen und an XOut weiterleiten - rXFSet.Put( XFillColorItem( String(), aPreviewColor ) ); - //aCtlPreviewOld.SetAttributes( aXFillAttr ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewNew.Invalidate(); - } - delete( pColorDlg ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -// -// Button 'Loeschen' -// -IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_COLOR ) ) ); - - if( aQueryBox.Execute() == RET_YES ) - { - // Jetzt wird richtig geloescht - sal_uLong nCount = pColorTab->Count() - 1; - XColorEntry* pEntry; - - pEntry = pColorTab->Remove( nPos ); - DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (1) !" ); - delete pEntry; - - for( sal_uLong i = nPos; i < nCount; i++ ) - { - pEntry = pColorTab->Remove( i + 1 ); - DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (2) !" ); - pColorTab->Insert( i, pEntry ); - } - - // Listbox und ValueSet aktualisieren - aLbColor.RemoveEntry( nPos ); - aValSetColorTable.Clear(); - FillValueSet_Impl( aValSetColorTable ); - - // Positionieren - aLbColor.SelectEntryPos( nPos ); - SelectColorLBHdl_Impl( this ); - - aCtlPreviewOld.Invalidate(); - - // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; - } - } - // Status der Buttons ermitteln - if( !pColorTab->Count() ) - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -// -// Button 'Farbtabelle laden' -// -IMPL_LINK( SvxColorTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if( *pnColorTableState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pColorTab->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Tabelle speichern - XColorTable* pColTab = new XColorTable( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pColTab->SetName( aURL.getName() ); // XXX - if( pColTab->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - const XColorTable *pTempTable = 0; - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); - if( pArea ) - { - pTempTable = pArea->GetColorTable(); - } - else if( pLine ) - { - pTempTable = pLine->GetColorTable(); - } - - if( pColorTab != pTempTable ) - { - if( bDeleteColorTable ) - delete pColorTab; - else - bDeleteColorTable = sal_True; - } - - pColorTab = pColTab; - if( pArea ) - { - pArea->SetNewColorTable( pColorTab ); - } - else if( pLine ) - { - pLine->SetNewColorTable( pColorTab ); - } - - aLbColor.Clear(); - aValSetColorTable.Clear(); - Construct(); - Reset( rOutAttrs ); - - pColorTab->SetName( aURL.getName() ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - aTableNameFT.SetText( aString ); - - // Flag fuer gewechselt setzen - *pnColorTableState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnColorTableState &= ~CT_MODIFIED; - - if( aLbColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - aLbColor.SelectEntryPos( 0 ); - else - aLbColor.SelectEntryPos( aLbColor.GetSelectEntryPos() ); - - ChangeColorHdl_Impl( this ); - SelectColorLBHdl_Impl( this ); - } - else - { - ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ); - aErrorBox.Execute(); - } - } - } - - // Status der Buttons ermitteln - if ( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -// -// Button 'Farbtabelle speichern' -// -IMPL_LINK( SvxColorTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pColorTab->GetName().Len() ) - { - aFile.Append( pColorTab->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soc" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pColorTab->SetName( aURL.getName() ); - pColorTab->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pColorTab->Save() ) - { - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - aTableNameFT.SetText( aString ); - - // Flag fuer gespeichert setzen - *pnColorTableState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnColorTableState &= ~CT_MODIFIED; - } - else - { - ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ); - aErrorBox.Execute(); - } - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aValSetColorTable.SelectItem( nPos + 1 ); - aEdtName.SetText( aLbColor.GetSelectEntry() ); - - rXFSet.Put( XFillColorItem( String(), - aLbColor.GetSelectEntryColor() ) ); - aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewOld.Invalidate(); - aCtlPreviewNew.Invalidate(); - - ChangeColorHdl_Impl( this ); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxColorTabPage, SelectValSetHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aValSetColorTable.GetSelectItemId(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aLbColor.SelectEntryPos( nPos - 1 ); - aEdtName.SetText( aLbColor.GetSelectEntry() ); - - rXFSet.Put( XFillColorItem( String(), - aLbColor.GetSelectEntryColor() ) ); - aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewOld.Invalidate(); - aCtlPreviewNew.Invalidate(); - - ChangeColorHdl_Impl( this ); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -// -// Farbwerte je nach �bergebenes Farbmodell umrechnen -// -void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) -{ - switch (eModell) - { - case CM_RGB: - { - CmykToRgb_Impl (rColor, (sal_uInt16)rColor.GetTransparency() ); - rColor.SetTransparency ((sal_uInt8) 0); - } - break; - - case CM_CMYK: - { - sal_uInt16 nK; - RgbToCmyk_Impl (rColor, nK ); - rColor.SetTransparency ((sal_uInt8) nK); - } - break; - } -} - -// -// Auswahl Listbox 'Farbmodell' (RGB/CMY) -// -IMPL_LINK( SvxColorTabPage, SelectColorModelHdl_Impl, void *, EMPTYARG ) -{ - int nPos = aLbColorModel.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - if (eCM != (ColorModel) nPos) - { - // wenn Farbmodell geaendert wurde, dann Werte umrechnen - ConvertColorValues (aAktuellColor, (ColorModel) nPos); - } - - eCM = (ColorModel) nPos; - - switch( eCM ) - { - case CM_RGB: - { - String aStr( aLbColorModel.GetSelectEntry() ); - String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) ); - xub_StrLen nIdx = 1; - aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) ); - aFtColorModel1.SetText( aColorStr ); - aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) ); - aFtColorModel2.SetText( aColorStr ); - aColorStr.SetChar( nIdx, aStr.GetChar( 2 ) ); - aFtColorModel3.SetText( aColorStr ); - - aFtColorModel4.Hide(); - aMtrFldColorModel4.Hide(); - aMtrFldColorModel4.SetValue( 0L ); - - aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_RGB_1 ); - aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_RGB_2 ); - aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_RGB_3 ); - - // Da der alte HelpText noch am Control steht wuerde - // ein Umsetzen der HelpID alleine nichts bewirken - aMtrFldColorModel1.SetHelpText( String() ); - aMtrFldColorModel2.SetHelpText( String() ); - aMtrFldColorModel3.SetHelpText( String() ); - - // RGB-Werte im Bereich 0..255 verarbeiten (nicht in %), - // dazu MetricField's entsprechend einstellen - aMtrFldColorModel1.SetUnit(FUNIT_NONE); - aMtrFldColorModel1.SetMin(0); - aMtrFldColorModel1.SetMax(255); - aMtrFldColorModel1.SetLast(255); - - aMtrFldColorModel2.SetUnit(FUNIT_NONE); - aMtrFldColorModel2.SetMin(0); - aMtrFldColorModel2.SetMax(255); - aMtrFldColorModel2.SetLast(255); - - aMtrFldColorModel3.SetUnit(FUNIT_NONE); - aMtrFldColorModel3.SetMin(0); - aMtrFldColorModel3.SetMax(255); - aMtrFldColorModel3.SetLast(255); - } - break; - - case CM_CMYK: - { - String aStr( aLbColorModel.GetSelectEntry() ); - String aColorStr( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "~X" ) ) ); - xub_StrLen nIdx = 1; - aColorStr.SetChar( nIdx, aStr.GetChar( 0 ) ); - aFtColorModel1.SetText( aColorStr ); - aColorStr.SetChar( nIdx, aStr.GetChar( 1 ) ); - aFtColorModel2.SetText( aColorStr ); - aColorStr.SetChar( nIdx,aStr.GetChar( 2 ) ); - aFtColorModel3.SetText( aColorStr ); - aColorStr.SetChar( nIdx,aStr.GetChar( 3 ) ); - aFtColorModel4.SetText( aColorStr ); - - aFtColorModel4.Show(); - aMtrFldColorModel4.Show(); - - aMtrFldColorModel1.SetHelpId( HID_TPCOLOR_CMYK_1 ); - aMtrFldColorModel2.SetHelpId( HID_TPCOLOR_CMYK_2 ); - aMtrFldColorModel3.SetHelpId( HID_TPCOLOR_CMYK_3 ); - - // s.o. - aMtrFldColorModel1.SetHelpText( String() ); - aMtrFldColorModel2.SetHelpText( String() ); - aMtrFldColorModel3.SetHelpText( String() ); - - // CMYK-Werte im Bereich 0..100% verarbeiten, - // dazu MetricField's entsprechend einstellen - String aStrUnit( RTL_CONSTASCII_USTRINGPARAM( " %" ) ); - - aMtrFldColorModel1.SetUnit(FUNIT_CUSTOM); - aMtrFldColorModel1.SetCustomUnitText( aStrUnit ); - aMtrFldColorModel1.SetMin(0); - aMtrFldColorModel1.SetMax(100); - aMtrFldColorModel1.SetLast(100); - - aMtrFldColorModel2.SetUnit(FUNIT_CUSTOM); - aMtrFldColorModel2.SetCustomUnitText( aStrUnit ); - aMtrFldColorModel2.SetMin(0); - aMtrFldColorModel2.SetMax(100); - aMtrFldColorModel2.SetLast(100); - - aMtrFldColorModel3.SetUnit(FUNIT_CUSTOM); - aMtrFldColorModel3.SetCustomUnitText( aStrUnit ); - aMtrFldColorModel3.SetMin(0); - aMtrFldColorModel3.SetMax(100); - aMtrFldColorModel3.SetLast(100); - } - break; - } - - aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); - aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); - aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); - aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) ); - } - - aMtrFldColorModel1.SetAccessibleName( GetNonMnemonicString(aFtColorModel1.GetText()) ); - aMtrFldColorModel2.SetAccessibleName( GetNonMnemonicString(aFtColorModel2.GetText()) ); - aMtrFldColorModel3.SetAccessibleName( GetNonMnemonicString(aFtColorModel3.GetText()) ); - aMtrFldColorModel4.SetAccessibleName( GetNonMnemonicString(aFtColorModel4.GetText()) ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -long SvxColorTabPage::ChangeColorHdl_Impl( void* ) -{ - int nPos = aLbColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - XColorEntry* pEntry = pColorTab->GetColor( nPos ); - - aAktuellColor.SetColor ( pEntry->GetColor().GetColor() ); - if (eCM != CM_RGB) - ConvertColorValues (aAktuellColor, eCM); - - aMtrFldColorModel1.SetValue( ColorToPercent_Impl( aAktuellColor.GetRed() ) ); - aMtrFldColorModel2.SetValue( ColorToPercent_Impl( aAktuellColor.GetGreen() ) ); - aMtrFldColorModel3.SetValue( ColorToPercent_Impl( aAktuellColor.GetBlue() ) ); - aMtrFldColorModel4.SetValue( ColorToPercent_Impl( aAktuellColor.GetTransparency() ) ); - - // ItemSet fuellen und an XOut weiterleiten - rXFSet.Put( XFillColorItem( String(), pEntry->GetColor() ) ); - aCtlPreviewOld.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreviewNew.Invalidate(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) -{ - long nCount = pColorTab->Count(); - XColorEntry* pColorEntry; - - if( nCount > 104 ) - rVs.SetStyle( rVs.GetStyle() | WB_VSCROLL ); - - for( long i = 0; i < nCount; i++ ) - { - pColorEntry = pColorTab->GetColor( i ); - rVs.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); - } -} - -//------------------------------------------------------------------------ - -// Ein RGB-Wert wird in einen CMYK-Wert konvertiert, wobei die Color- -// Klasse vergewaltigt wird, da R in C, G in M und B in Y umgewandelt -// wird. Der Wert K wird in einer Extra-Variablen gehalten. -// Bei weiteren Farbmodellen sollte man hierfuer eigene Klassen entwickeln, -// die dann auch entsprechende Casts enthalten. - -void SvxColorTabPage::RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK ) -{ - sal_uInt16 const nColor1 = 255 - rColor.GetRed(); - sal_uInt16 const nColor2 = 255 - rColor.GetGreen(); - sal_uInt16 const nColor3 = 255 - rColor.GetBlue(); - - rK = Min( Min( nColor1, nColor2 ), nColor3 ); - - rColor.SetRed( sal::static_int_cast< sal_uInt8 >( nColor1 - rK ) ); - rColor.SetGreen( sal::static_int_cast< sal_uInt8 >( nColor2 - rK ) ); - rColor.SetBlue( sal::static_int_cast< sal_uInt8 >( nColor3 - rK ) ); -} - -//------------------------------------------------------------------------ - -// Umgekehrter Fall zu RgbToCmyk_Impl (s.o.) - -void SvxColorTabPage::CmykToRgb_Impl( Color& rColor, const sal_uInt16 nK ) -{ - long lTemp; - - lTemp = 255 - ( rColor.GetRed() + nK ); - - if( lTemp < 0L ) - lTemp = 0L; - rColor.SetRed( (sal_uInt8)lTemp ); - - lTemp = 255 - ( rColor.GetGreen() + nK ); - - if( lTemp < 0L ) - lTemp = 0L; - rColor.SetGreen( (sal_uInt8)lTemp ); - - lTemp = 255 - ( rColor.GetBlue() + nK ); - - if( lTemp < 0L ) - lTemp = 0L; - rColor.SetBlue( (sal_uInt8)lTemp ); -} - -//------------------------------------------------------------------------ - -sal_uInt16 SvxColorTabPage::ColorToPercent_Impl( sal_uInt16 nColor ) -{ - sal_uInt16 nWert = 0; - - switch (eCM) - { - case CM_RGB : - nWert = nColor; - break; - - case CM_CMYK: - nWert = (sal_uInt16) ( (double) nColor * 100.0 / 255.0 + 0.5 ); - break; - } - - return ( nWert ); -} - -//------------------------------------------------------------------------ - -sal_uInt16 SvxColorTabPage::PercentToColor_Impl( sal_uInt16 nPercent ) -{ - sal_uInt16 nWert = 0; - - switch (eCM) - { - case CM_RGB : - nWert = nPercent; - break; - - case CM_CMYK: - nWert = (sal_uInt16) ( (double) nPercent * 255.0 / 100.0 + 0.5 ); - break; - } - - return ( nWert ); -} - -//------------------------------------------------------------------------ - -void SvxColorTabPage::FillUserData() -{ - // Das Farbmodell wird in der Ini-Datei festgehalten - SetUserData( UniString::CreateFromInt32( eCM ) ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx deleted file mode 100644 index 6fa476bb8..000000000 --- a/cui/source/tabpages/tpgradnt.cxx +++ /dev/null @@ -1,929 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#define _SVX_TPGRADNT_CXX - -#include -#include "helpid.hrc" -#include "svx/xattr.hxx" -#include -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "tabarea.hrc" -#include "defdlgname.hxx" -#include -#include -#include -#include -#include "paragrph.hrc" - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 - -/************************************************************************* -|* -|* Dialog zum Aendern und Definieren der Farbverlaeufe -|* -\************************************************************************/ - -SvxGradientTabPage::SvxGradientTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - SfxTabPage ( pParent, CUI_RES( RID_SVXPAGE_GRADIENT ), rInAttrs ), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aFtType ( this, CUI_RES( FT_TYPE ) ), - aLbGradientType ( this, CUI_RES( LB_GRADIENT_TYPES ) ), - aFtCenterX ( this, CUI_RES( FT_CENTER_X ) ), - aMtrCenterX ( this, CUI_RES( MTR_CENTER_X ) ), - aFtCenterY ( this, CUI_RES( FT_CENTER_Y ) ), - aMtrCenterY ( this, CUI_RES( MTR_CENTER_Y ) ), - aFtAngle ( this, CUI_RES( FT_ANGLE ) ), - aMtrAngle ( this, CUI_RES( MTR_ANGLE ) ), - aFtBorder ( this, CUI_RES( FT_BORDER ) ), - aMtrBorder ( this, CUI_RES( MTR_BORDER ) ), - aFtColorFrom ( this, CUI_RES( FT_COLOR_FROM ) ), - aLbColorFrom ( this, CUI_RES( LB_COLOR_FROM ) ), - aMtrColorFrom ( this, CUI_RES( MTR_COLOR_FROM ) ), - aFtColorTo ( this, CUI_RES( FT_COLOR_TO ) ), - aLbColorTo ( this, CUI_RES( LB_COLOR_TO ) ), - aMtrColorTo ( this, CUI_RES( MTR_COLOR_TO ) ), - aLbGradients ( this, CUI_RES( LB_GRADIENTS ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - - rOutAttrs ( rInAttrs ), - - pColorTab( NULL ), - pGradientList( NULL ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFStyleItem ( XFILL_GRADIENT ), - aXGradientItem ( String(), XGradient( COL_BLACK, COL_WHITE ) ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) -{ - FreeResource(); - - aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - aLbGradients.SetAccessibleName( GetText()); - - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Solange NICHT vom Item unterstuetzt - - aMtrColorTo.SetValue( 100 ); - aMtrColorFrom.SetValue( 100 ); - - // Setzen des Output-Devices - rXFSet.Put( aXFStyleItem ); - rXFSet.Put( aXGradientItem ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - // Handler ueberladen - aLbGradients.SetSelectHdl( - LINK( this, SvxGradientTabPage, ChangeGradientHdl_Impl ) ); - aBtnAdd.SetClickHdl( LINK( this, SvxGradientTabPage, ClickAddHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxGradientTabPage, ClickModifyHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxGradientTabPage, ClickDeleteHdl_Impl ) ); - - Link aLink = LINK( this, SvxGradientTabPage, ModifiedHdl_Impl ); - aLbGradientType.SetSelectHdl( aLink ); - aMtrCenterX.SetModifyHdl( aLink ); - aMtrCenterY.SetModifyHdl( aLink ); - aMtrAngle.SetModifyHdl( aLink ); - aMtrBorder.SetModifyHdl( aLink ); - aMtrColorFrom.SetModifyHdl( aLink ); - aLbColorFrom.SetSelectHdl( aLink ); - aMtrColorTo.SetModifyHdl( aLink ); - aLbColorTo.SetSelectHdl( aLink ); - - aBtnLoad.SetClickHdl( - LINK( this, SvxGradientTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( - LINK( this, SvxGradientTabPage, ClickSaveHdl_Impl ) ); - - aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnModify.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnDelete.SetAccessibleRelationMemberOf( &aFlProp ); - aLbGradients.SetAccessibleRelationLabeledBy(&aLbGradients); - - // #i76307# always paint the preview in LTR, because this is what the document does - aCtlPreview.EnableRTL( sal_False ); -} - -// ----------------------------------------------------------------------- - -void SvxGradientTabPage::Construct() -{ - // Farbtabelle - aLbColorFrom.Fill( pColorTab ); - aLbColorTo.CopyEntries( aLbColorFrom ); - - // Farbverlauftabelle - aLbGradients.Fill( pGradientList ); -} - -// ----------------------------------------------------------------------- - -void SvxGradientTabPage::ActivatePage( const SfxItemSet& ) -{ - sal_uInt16 nPos; - sal_uInt16 nCount; - - if( *pDlgType == 0 ) // Flaechen-Dialog - { - *pbAreaTP = sal_False; - - if( pColorTab ) - { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) - { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); - - // LbColorFrom - nPos = aLbColorFrom.GetSelectEntryPos(); - aLbColorFrom.Clear(); - aLbColorFrom.Fill( pColorTab ); - nCount = aLbColorFrom.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbColorFrom.SelectEntryPos( 0 ); - else - aLbColorFrom.SelectEntryPos( nPos ); - - // LbColorTo - nPos = aLbColorTo.GetSelectEntryPos(); - aLbColorTo.Clear(); - aLbColorTo.CopyEntries( aLbColorFrom ); - nCount = aLbColorTo.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbColorTo.SelectEntryPos( 0 ); - else - aLbColorTo.SelectEntryPos( nPos ); - - ModifiedHdl_Impl( this ); - } - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pGradientList->GetPath() ); - - aURL.Append( pGradientList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - if ( *pPageType == PT_GRADIENT && *pPos != LISTBOX_ENTRY_NOTFOUND ) - { - aLbGradients.SelectEntryPos( *pPos ); - } - // Farben koennten geloescht worden sein - ChangeGradientHdl_Impl( this ); - - *pPageType = PT_GRADIENT; - *pPos = LISTBOX_ENTRY_NOTFOUND; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxGradientTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( CheckChanges_Impl() == -1L ) - return KEEP_PAGE; - - if( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -long SvxGradientTabPage::CheckChanges_Impl() -{ - // wird hier benutzt, um Aenderungen NICHT zu verlieren - XGradient aTmpGradient( aLbColorFrom.GetSelectEntryColor(), - aLbColorTo.GetSelectEntryColor(), - (XGradientStyle) aLbGradientType.GetSelectEntryPos(), - static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden - (sal_uInt16) aMtrCenterX.GetValue(), - (sal_uInt16) aMtrCenterY.GetValue(), - (sal_uInt16) aMtrBorder.GetValue(), - (sal_uInt16) aMtrColorFrom.GetValue(), - (sal_uInt16) aMtrColorTo.GetValue() ); - - sal_uInt16 nPos = aLbGradients.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - XGradient aGradient = pGradientList->GetGradient( nPos )->GetGradient(); - String aString = aLbGradients.GetSelectEntry(); - - if( !( aTmpGradient == aGradient ) ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, - SVX_RESSTR( RID_SVXSTR_GRADIENT ), - CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ), - &aWarningBoxImage ); - DBG_ASSERT(aMessDlg, "Dialogdiet fail!"); - aMessDlg->SetButtonText( MESS_BTN_1, - String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); - aMessDlg->SetButtonText( MESS_BTN_2, - String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); - - short nRet = aMessDlg->Execute(); - - switch( nRet ) - { - case RET_BTN_1: // Aendern - { - ClickModifyHdl_Impl( this ); - aGradient = pGradientList->GetGradient( nPos )->GetGradient(); - } - break; - - case RET_BTN_2: // Hinzufuegen - { - ClickAddHdl_Impl( this ); - nPos = aLbGradients.GetSelectEntryPos(); - aGradient = pGradientList->GetGradient( nPos )->GetGradient(); - } - break; - - case RET_CANCEL: - break; - } - delete aMessDlg; - } - } - nPos = aLbGradients.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - *pPos = nPos; - } - return 0L; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxGradientTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( *pDlgType == 0 && *pPageType == PT_GRADIENT && *pbAreaTP == sal_False ) - { - // CheckChanges(); <-- doppelte Abfrage ? - - XGradient* pXGradient = NULL; - String aString; - sal_uInt16 nPos = aLbGradients.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - pXGradient = new XGradient( pGradientList->GetGradient( nPos )->GetGradient() ); - aString = aLbGradients.GetSelectEntry(); - - } - else - // Farbverlauf wurde (unbekannt) uebergeben - { - pXGradient = new XGradient( aLbColorFrom.GetSelectEntryColor(), - aLbColorTo.GetSelectEntryColor(), - (XGradientStyle) aLbGradientType.GetSelectEntryPos(), - static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden - (sal_uInt16) aMtrCenterX.GetValue(), - (sal_uInt16) aMtrCenterY.GetValue(), - (sal_uInt16) aMtrBorder.GetValue(), - (sal_uInt16) aMtrColorFrom.GetValue(), - (sal_uInt16) aMtrColorTo.GetValue() ); - } - DBG_ASSERT( pXGradient, "XGradient konnte nicht erzeugt werden" ); - rSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); - rSet.Put( XFillGradientItem( aString, *pXGradient ) ); - - delete pXGradient; - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -void SvxGradientTabPage::Reset( const SfxItemSet& ) -{ - // aLbGradients.SelectEntryPos( 0 ); - ChangeGradientHdl_Impl( this ); - - // Status der Buttons ermitteln - if( pGradientList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxGradientTabPage::Create( Window* pWindow, - const SfxItemSet& rOutAttrs ) -{ - return new SvxGradientTabPage( pWindow, rOutAttrs ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGradientTabPage, ModifiedHdl_Impl, void *, pControl ) -{ - XGradientStyle eXGS = (XGradientStyle) aLbGradientType.GetSelectEntryPos(); - - XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), - aLbColorTo.GetSelectEntryColor(), - eXGS, - static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden - (sal_uInt16) aMtrCenterX.GetValue(), - (sal_uInt16) aMtrCenterY.GetValue(), - (sal_uInt16) aMtrBorder.GetValue(), - (sal_uInt16) aMtrColorFrom.GetValue(), - (sal_uInt16) aMtrColorTo.GetValue() ); - - // Enablen/Disablen von Controls - if( pControl == &aLbGradientType || pControl == this ) - SetControlState_Impl( eXGS ); - - // Anzeigen im XOutDev - rXFSet.Put( XFillGradientItem( String(), aXGradient ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreview.Invalidate(); - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGradientTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_GRADIENT ) ); - String aDesc( CUI_RES( RID_SVXSTR_DESC_GRADIENT ) ); - String aName; - - long nCount = pGradientList->Count(); - long j = 1; - sal_Bool bDifferent = sal_False; - - while( !bDifferent ) - { - aName = aNewName; - aName += sal_Unicode(' '); - aName += UniString::CreateFromInt32( j++ ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pGradientList->GetGradient( i )->GetName() ) - bDifferent = sal_False; - } - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - WarningBox* pWarnBox = NULL; - sal_uInt16 nError = RID_SVXSTR_WARN_NAME_DUPLICATE; - - while( pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pGradientList->GetGradient( i )->GetName() ) - bDifferent = sal_False; - - if( bDifferent ) - { - nError = 0; - break; - } - - if( !pWarnBox ) - { - pWarnBox = new WarningBox( DLGWIN, - WinBits( WB_OK_CANCEL ), - String( ResId( nError, rMgr ) ) ); - pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); - } - - if( pWarnBox->Execute() != RET_OK ) - break; - } - delete pDlg; - delete pWarnBox; - - if( !nError ) - { - XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), - aLbColorTo.GetSelectEntryColor(), - (XGradientStyle) aLbGradientType.GetSelectEntryPos(), - static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden - (sal_uInt16) aMtrCenterX.GetValue(), - (sal_uInt16) aMtrCenterY.GetValue(), - (sal_uInt16) aMtrBorder.GetValue(), - (sal_uInt16) aMtrColorFrom.GetValue(), - (sal_uInt16) aMtrColorTo.GetValue() ); - XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); - - pGradientList->Insert( pEntry, nCount ); - - aLbGradients.Append( pEntry ); - - aLbGradients.SelectEntryPos( aLbGradients.GetEntryCount() - 1 ); - -#ifdef WNT - // hack: #31355# W.P. - Rectangle aRect( aLbGradients.GetPosPixel(), aLbGradients.GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - } -#endif - - // Flag fuer modifiziert setzen - *pnGradientListState |= CT_MODIFIED; - - ChangeGradientHdl_Impl( this ); - } - - // Status der Buttons ermitteln - if( pGradientList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGradientTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbGradients.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_GRADIENT ) ); - String aDesc( CUI_RES( RID_SVXSTR_DESC_GRADIENT ) ); - String aName( pGradientList->GetGradient( nPos )->GetName() ); - String aOldName = aName; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - - long nCount = pGradientList->Count(); - sal_Bool bDifferent = sal_False; - sal_Bool bLoop = sal_True; - - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pGradientList->GetGradient( i )->GetName() && - aName != aOldName ) - bDifferent = sal_False; - } - - if( bDifferent ) - { - bLoop = sal_False; - XGradient aXGradient( aLbColorFrom.GetSelectEntryColor(), - aLbColorTo.GetSelectEntryColor(), - (XGradientStyle) aLbGradientType.GetSelectEntryPos(), - static_cast(aMtrAngle.GetValue() * 10), // sollte in Resource geaendert werden - (sal_uInt16) aMtrCenterX.GetValue(), - (sal_uInt16) aMtrCenterY.GetValue(), - (sal_uInt16) aMtrBorder.GetValue(), - (sal_uInt16) aMtrColorFrom.GetValue(), - (sal_uInt16) aMtrColorTo.GetValue() ); - - XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName ); - - delete pGradientList->Replace( pEntry, nPos ); - - aLbGradients.Modify( pEntry, nPos ); - - aLbGradients.SelectEntryPos( nPos ); - - // Flag fuer modifiziert setzen - *pnGradientListState |= CT_MODIFIED; - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - - } - delete pDlg; - } - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGradientTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbGradients.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_GRADIENT ) ) ); - - if ( aQueryBox.Execute() == RET_YES ) - { - delete pGradientList->Remove( nPos ); - aLbGradients.RemoveEntry( nPos ); - aLbGradients.SelectEntryPos( 0 ); - - aCtlPreview.Invalidate(); - - ChangeGradientHdl_Impl( this ); - - // Flag fuer modifiziert setzen - *pnGradientListState |= CT_MODIFIED; - } - } - // Status der Buttons ermitteln - if( !pGradientList->Count() ) - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxGradientTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *pnGradientListState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pGradientList->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( aDlg.Execute() == ERRCODE_NONE ) - { - EnterWait(); - - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Liste speichern - XGradientList* pGrdList = new XGradientList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pGrdList->SetName( aURL.getName() ); - - if ( pGrdList->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - if ( pGradientList != - ( (SvxAreaTabDialog*) DLGWIN )->GetGradientList() ) - delete pGradientList; - - pGradientList = pGrdList; - ( (SvxAreaTabDialog*) DLGWIN )-> - SetNewGradientList( pGradientList ); - - aLbGradients.Clear(); - aLbGradients.Fill( pGradientList ); - Reset( rOutAttrs ); - - pGradientList->SetName( aURL.getName() ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gewechselt setzen - *pnGradientListState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnGradientListState &= ~CT_MODIFIED; - LeaveWait(); - } - else - { - LeaveWait(); - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - } - } - - // Status der Buttons ermitteln - if( pGradientList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxGradientTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sog" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pGradientList->GetName().Len() ) - { - aFile.Append( pGradientList->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sog" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pGradientList->SetName( aURL.getName() ); - pGradientList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pGradientList->Save() ) - { - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gespeichert setzen - *pnGradientListState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnGradientListState &= ~CT_MODIFIED; - } - else - { - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); - } - } - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxGradientTabPage, ChangeGradientHdl_Impl, void *, EMPTYARG ) -{ - XGradient* pGradient = NULL; - int nPos = aLbGradients.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() ); - else - { - const SfxPoolItem* pPoolItem = NULL; - if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), sal_True, &pPoolItem ) ) - { - if( ( XFILL_GRADIENT == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) && - ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) ) ) - { - pGradient = new XGradient( ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ); - } - } - if( !pGradient ) - { - aLbGradients.SelectEntryPos( 0 ); - nPos = aLbGradients.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pGradient = new XGradient( ( (XGradientEntry*) pGradientList->GetGradient( nPos ) )->GetGradient() ); - } - } - - if( pGradient ) - { - XGradientStyle eXGS = pGradient->GetGradientStyle(); - - aLbGradientType.SelectEntryPos( - sal::static_int_cast< sal_uInt16 >( eXGS ) ); - // Wenn der EIntrag nicht in der Listbox ist, werden die Farben - // temporaer hinzugenommen - aLbColorFrom.SetNoSelection(); - aLbColorFrom.SelectEntry( pGradient->GetStartColor() ); - - if ( aLbColorFrom.GetSelectEntryCount() == 0 ) - { - aLbColorFrom.InsertEntry( pGradient->GetStartColor(), - String() ); - aLbColorFrom.SelectEntry( pGradient->GetStartColor() ); - } - aLbColorTo.SetNoSelection(); - aLbColorTo.SelectEntry( pGradient->GetEndColor() ); - - if ( aLbColorTo.GetSelectEntryCount() == 0 ) - { - aLbColorTo.InsertEntry( pGradient->GetEndColor(), String() ); - aLbColorTo.SelectEntry( pGradient->GetEndColor() ); - } - - aMtrAngle.SetValue( pGradient->GetAngle() / 10 ); // sollte in Resource geaendert werden - aMtrBorder.SetValue( pGradient->GetBorder() ); - aMtrCenterX.SetValue( pGradient->GetXOffset() ); - aMtrCenterY.SetValue( pGradient->GetYOffset() ); - aMtrColorFrom.SetValue( pGradient->GetStartIntens() ); - aMtrColorTo.SetValue( pGradient->GetEndIntens() ); - - // Controls Disablen/Enablen - SetControlState_Impl( eXGS ); - - // ItemSet fuellen und an aCtlPreview weiterleiten - rXFSet.Put( XFillGradientItem( String(), *pGradient ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreview.Invalidate(); - delete pGradient; - } - return 0L; -} - -//------------------------------------------------------------------------ - -void SvxGradientTabPage::SetControlState_Impl( XGradientStyle eXGS ) -{ - switch( eXGS ) - { - case XGRAD_LINEAR: - case XGRAD_AXIAL: - aFtCenterX.Disable(); - aMtrCenterX.Disable(); - aFtCenterY.Disable(); - aMtrCenterY.Disable(); - aFtAngle.Enable(); - aMtrAngle.Enable(); - break; - - case XGRAD_RADIAL: - aFtCenterX.Enable(); - aMtrCenterX.Enable(); - aFtCenterY.Enable(); - aMtrCenterY.Enable(); - aFtAngle.Disable(); - aMtrAngle.Disable(); - break; - - case XGRAD_ELLIPTICAL: - aFtCenterX.Enable(); - aMtrCenterX.Enable(); - aFtCenterY.Enable(); - aMtrCenterY.Enable(); - aFtAngle.Enable(); - aMtrAngle.Enable(); - break; - - case XGRAD_SQUARE: - case XGRAD_RECT: - aFtCenterX.Enable(); - aMtrCenterX.Enable(); - aFtCenterY.Enable(); - aMtrCenterY.Enable(); - aFtAngle.Enable(); - aMtrAngle.Enable(); - break; - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx deleted file mode 100644 index 8c6901684..000000000 --- a/cui/source/tabpages/tphatch.cxx +++ /dev/null @@ -1,876 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#define _SVX_TPHATCH_CXX - -#include -#include "tabarea.hrc" -#include "helpid.hrc" -#include "svx/xattr.hxx" -#include -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include "defdlgname.hxx" -#include -#include -#include "svx/dlgutil.hxx" -#include -#include "paragrph.hrc" -#include - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 - -/************************************************************************* -|* -|* Dialog zum Aendern und Definieren der Schraffuren -|* -\************************************************************************/ - -SvxHatchTabPage::SvxHatchTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_HATCH ), rInAttrs ), - - aFtDistance ( this, CUI_RES( FT_LINE_DISTANCE ) ), - aMtrDistance ( this, CUI_RES( MTR_FLD_DISTANCE ) ), - aFtAngle ( this, CUI_RES( FT_LINE_ANGLE ) ), - aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), - aCtlAngle ( this, CUI_RES( CTL_ANGLE ), - RP_RB, 200, 80, CS_ANGLE ), - aFlProp ( this, CUI_RES( FL_PROP ) ), - aFtLineType ( this, CUI_RES( FT_LINE_TYPE ) ), - aLbLineType ( this, CUI_RES( LB_LINE_TYPE ) ), - aFtLineColor ( this, CUI_RES( FT_LINE_COLOR ) ), - aLbLineColor ( this, CUI_RES( LB_LINE_COLOR ) ), - aLbHatchings ( this, CUI_RES( LB_HATCHINGS ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - - rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - pHatchingList( NULL ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFStyleItem ( XFILL_HATCH ), - aXHatchItem ( String(), XHatch() ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) - -{ - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ;//prevent warning - } - SetFieldUnit( aMtrDistance, eFUnit ); - - // PoolUnit ermitteln - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH ); - - // Setzen des Output-Devices - rXFSet.Put( aXFStyleItem ); - rXFSet.Put( aXHatchItem ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aLbHatchings.SetSelectHdl( LINK( this, SvxHatchTabPage, ChangeHatchHdl_Impl ) ); - - Link aLink = LINK( this, SvxHatchTabPage, ModifiedHdl_Impl ); - aMtrDistance.SetModifyHdl( aLink ); - aMtrAngle.SetModifyHdl( aLink ); - aLbLineType.SetSelectHdl( aLink ); - aLbLineColor.SetSelectHdl( aLink ); - - aBtnAdd.SetClickHdl( LINK( this, SvxHatchTabPage, ClickAddHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxHatchTabPage, ClickModifyHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxHatchTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( LINK( this, SvxHatchTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( LINK( this, SvxHatchTabPage, ClickSaveHdl_Impl ) ); - - aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - - aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - aLbHatchings.SetAccessibleName( String(CUI_RES(STR_LB_HATCHINGSTYLE)) ); - aCtlAngle.SetAccessibleRelationMemberOf( &aFlProp ); - aLbHatchings.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnAdd.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnModify.SetAccessibleRelationMemberOf( &aFlProp ); - aBtnDelete.SetAccessibleRelationMemberOf( &aFlProp ); - aLbHatchings.SetAccessibleRelationLabeledBy(&aLbHatchings); -} - -// ----------------------------------------------------------------------- - -void SvxHatchTabPage::Construct() -{ - // Farbtabelle - aLbLineColor.Fill( pColorTab ); - - // Schraffurentabelle - aLbHatchings.Fill( pHatchingList ); -} - -// ----------------------------------------------------------------------- - -void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - sal_uInt16 nPos; - sal_uInt16 nCount; - - if( *pDlgType == 0 ) // Flaechen-Dialog - { - *pbAreaTP = sal_False; - - if( pColorTab ) - { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) - { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); - - // LbLineColor - nPos = aLbLineColor.GetSelectEntryPos(); - aLbLineColor.Clear(); - aLbLineColor.Fill( pColorTab ); - nCount = aLbLineColor.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbLineColor.SelectEntryPos( 0 ); - else - aLbLineColor.SelectEntryPos( nPos ); - - ModifiedHdl_Impl( this ); - } - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pHatchingList->GetPath() ); - - aURL.Append( pHatchingList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - if( *pPageType == PT_HATCH && *pPos != LISTBOX_ENTRY_NOTFOUND ) - { - aLbHatchings.SelectEntryPos( *pPos ); - } - // Farben koennten geloescht worden sein - ChangeHatchHdl_Impl( this ); - - *pPageType = PT_HATCH; - *pPos = LISTBOX_ENTRY_NOTFOUND; - } - } - - rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); - rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); -} - -// ----------------------------------------------------------------------- - -int SvxHatchTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if ( CheckChanges_Impl() == -1L ) - return KEEP_PAGE; - - if( _pSet ) - FillItemSet( *_pSet ); - - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -long SvxHatchTabPage::CheckChanges_Impl() -{ - if( aMtrDistance.GetText() != aMtrDistance.GetSavedValue() || - aMtrAngle.GetText() != aMtrAngle.GetSavedValue() || - aLbLineType.GetSelectEntryPos() != aLbLineType.GetSavedValue() || - aLbLineColor.GetSelectEntryPos() != aLbLineColor.GetSavedValue() || - aLbHatchings.GetSelectEntryPos() != aLbHatchings.GetSavedValue() ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, - SVX_RESSTR( RID_SVXSTR_HATCH ), - CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ), - &aWarningBoxImage ); - DBG_ASSERT(aMessDlg, "Dialogdiet fail!"); - aMessDlg->SetButtonText( MESS_BTN_1, - String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); - aMessDlg->SetButtonText( MESS_BTN_2, - String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); - - short nRet = aMessDlg->Execute(); - - switch( nRet ) - { - case RET_BTN_1: // Aendern - { - ClickModifyHdl_Impl( this ); - } - break; - - case RET_BTN_2: // Hinzufuegen - { - ClickAddHdl_Impl( this ); - } - break; - - case RET_CANCEL: - break; - } - delete aMessDlg; - } - - sal_uInt16 nPos = aLbHatchings.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - *pPos = nPos; - return 0L; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxHatchTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( *pDlgType == 0 && *pbAreaTP == sal_False ) // Flaechen-Dialog - { - if( *pPageType == PT_HATCH ) - { - // CheckChanges(); <-- doppelte Abfrage ? - - XHatch* pXHatch = NULL; - String aString; - sal_uInt16 nPos = aLbHatchings.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - pXHatch = new XHatch( pHatchingList->GetHatch( nPos )->GetHatch() ); - aString = aLbHatchings.GetSelectEntry(); - } - // Farbverlauf wurde (unbekannt) uebergeben - else - { - pXHatch = new XHatch( aLbLineColor.GetSelectEntryColor(), - (XHatchStyle) aLbLineType.GetSelectEntryPos(), - GetCoreValue( aMtrDistance, ePoolUnit ), - static_cast(aMtrAngle.GetValue() * 10) ); - } - DBG_ASSERT( pXHatch, "XHatch konnte nicht erzeugt werden" ); - rSet.Put( XFillStyleItem( XFILL_HATCH ) ); - rSet.Put( XFillHatchItem( aString, *pXHatch ) ); - - delete pXHatch; - } - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -void SvxHatchTabPage::Reset( const SfxItemSet& rSet ) -{ - ChangeHatchHdl_Impl( this ); - - // Status der Buttons ermitteln - if( pHatchingList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - - rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); - rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - aCtlPreview.Invalidate(); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxHatchTabPage::Create( Window* pWindow, - const SfxItemSet& rSet ) -{ - return new SvxHatchTabPage( pWindow, rSet ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxHatchTabPage, ModifiedHdl_Impl, void *, p ) -{ - if( p == &aMtrAngle ) - { - // Setzen des Winkels im AngleControl - switch( aMtrAngle.GetValue() ) - { - case 135: aCtlAngle.SetActualRP( RP_LT ); break; - case 90: aCtlAngle.SetActualRP( RP_MT ); break; - case 45: aCtlAngle.SetActualRP( RP_RT ); break; - case 180: aCtlAngle.SetActualRP( RP_LM ); break; - case 0: aCtlAngle.SetActualRP( RP_RM ); break; - case 225: aCtlAngle.SetActualRP( RP_LB ); break; - case 270: aCtlAngle.SetActualRP( RP_MB ); break; - case 315: aCtlAngle.SetActualRP( RP_RB ); break; - default: aCtlAngle.SetActualRP( RP_MM ); break; - } - } - - XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), - (XHatchStyle) aLbLineType.GetSelectEntryPos(), - GetCoreValue( aMtrDistance, ePoolUnit ), - static_cast(aMtrAngle.GetValue() * 10) ); - - rXFSet.Put( XFillHatchItem( String(), aXHatch ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreview.Invalidate(); - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxHatchTabPage, ChangeHatchHdl_Impl, void *, EMPTYARG ) -{ - XHatch* pHatch = NULL; - int nPos = aLbHatchings.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() ); - else - { - const SfxPoolItem* pPoolItem = NULL; - if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLSTYLE ), sal_True, &pPoolItem ) ) - { - if( ( XFILL_HATCH == (XFillStyle) ( ( const XFillStyleItem* ) pPoolItem )->GetValue() ) && - ( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) ) ) - { - pHatch = new XHatch( ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ); - } - } - if( !pHatch ) - { - aLbHatchings.SelectEntryPos( 0 ); - nPos = aLbHatchings.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - pHatch = new XHatch( ( (XHatchEntry*) pHatchingList->GetHatch( nPos ) )->GetHatch() ); - } - } - if( pHatch ) - { - aLbLineType.SelectEntryPos( - sal::static_int_cast< sal_uInt16 >( pHatch->GetHatchStyle() ) ); - // Wenn der Eintrag nicht in der Listbox ist, wird die Farbe - // temporaer hinzugenommen - aLbLineColor.SetNoSelection(); - aLbLineColor.SelectEntry( pHatch->GetColor() ); - if( aLbLineColor.GetSelectEntryCount() == 0 ) - { - aLbLineColor.InsertEntry( pHatch->GetColor(), String() ); - aLbLineColor.SelectEntry( pHatch->GetColor() ); - } - SetMetricValue( aMtrDistance, pHatch->GetDistance(), ePoolUnit ); - aMtrAngle.SetValue( pHatch->GetAngle() / 10 ); - - // Setzen des Winkels im AngleControl - switch( aMtrAngle.GetValue() ) - { - case 135: aCtlAngle.SetActualRP( RP_LT ); break; - case 90: aCtlAngle.SetActualRP( RP_MT ); break; - case 45: aCtlAngle.SetActualRP( RP_RT ); break; - case 180: aCtlAngle.SetActualRP( RP_LM ); break; - case 0: aCtlAngle.SetActualRP( RP_RM ); break; - case 225: aCtlAngle.SetActualRP( RP_LB ); break; - case 270: aCtlAngle.SetActualRP( RP_MB ); break; - case 315: aCtlAngle.SetActualRP( RP_RB ); break; - default: aCtlAngle.SetActualRP( RP_MM ); break; - } - - // ItemSet fuellen und an aCtlPreview weiterleiten - rXFSet.Put( XFillHatchItem( String(), *pHatch ) ); - aCtlPreview.SetAttributes( aXFillAttr.GetItemSet() ); - - aCtlPreview.Invalidate(); - delete pHatch; - } - aMtrDistance.SaveValue(); - aMtrAngle.SaveValue(); - aLbLineType.SaveValue(); - aLbLineColor.SaveValue(); - aLbHatchings.SaveValue(); - - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxHatchTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_HATCH ) ); - String aDesc( CUI_RES( RID_SVXSTR_DESC_HATCH ) ); - String aName; - - long nCount = pHatchingList->Count(); - long j = 1; - sal_Bool bDifferent = sal_False; - - while( !bDifferent ) - { - aName = aNewName; - aName += sal_Unicode(' '); - aName += UniString::CreateFromInt32( j++ ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pHatchingList->GetHatch( i )->GetName() ) - bDifferent = sal_False; - } - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - WarningBox* pWarnBox = NULL; - sal_uInt16 nError = RID_SVXSTR_WARN_NAME_DUPLICATE; - - while( pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pHatchingList->GetHatch( i )->GetName() ) - bDifferent = sal_False; - - if( bDifferent ) { - nError = 0; - break; - } - - if( !pWarnBox ) - { - pWarnBox = new WarningBox( DLGWIN, - WinBits( WB_OK_CANCEL ), - String( ResId( nError, rMgr ) ) ); - pWarnBox->SetHelpId( HID_WARN_NAME_DUPLICATE ); - } - - if( pWarnBox->Execute() != RET_OK ) - break; - } - delete pDlg; - delete pWarnBox; - - if( !nError ) - { - XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), - (XHatchStyle) aLbLineType.GetSelectEntryPos(), - GetCoreValue( aMtrDistance, ePoolUnit ), - static_cast(aMtrAngle.GetValue() * 10) ); - XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); - - pHatchingList->Insert( pEntry, nCount ); - - aLbHatchings.Append( pEntry ); - - aLbHatchings.SelectEntryPos( aLbHatchings.GetEntryCount() - 1 ); - -#ifdef WNT - // hack: #31355# W.P. - Rectangle aRect( aLbHatchings.GetPosPixel(), aLbHatchings.GetSizePixel() ); - if( sal_True ) { // ??? overlapped with pDlg - // and srolling - Invalidate( aRect ); - } -#endif - - // Flag fuer modifiziert setzen - *pnHatchingListState |= CT_MODIFIED; - - ChangeHatchHdl_Impl( this ); - } - - // Status der Buttons ermitteln - if( pHatchingList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxHatchTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbHatchings.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_HATCH ) ); - String aDesc( CUI_RES( RID_SVXSTR_DESC_HATCH ) ); - String aName( pHatchingList->GetHatch( nPos )->GetName() ); - String aOldName = aName; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - - long nCount = pHatchingList->Count(); - sal_Bool bDifferent = sal_False; - sal_Bool bLoop = sal_True; - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pHatchingList->GetHatch( i )->GetName() && - aName != aOldName ) - bDifferent = sal_False; - } - - if( bDifferent ) - { - bLoop = sal_False; - XHatch aXHatch( aLbLineColor.GetSelectEntryColor(), - (XHatchStyle) aLbLineType.GetSelectEntryPos(), - GetCoreValue( aMtrDistance, ePoolUnit ), - static_cast(aMtrAngle.GetValue() * 10) ); - - XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName ); - - delete pHatchingList->Replace( pEntry, nPos ); - - aLbHatchings.Modify( pEntry, nPos ); - - aLbHatchings.SelectEntryPos( nPos ); - - // Werte sichern fuer Changes-Erkennung ( -> Methode ) - aMtrDistance.SaveValue(); - aMtrAngle.SaveValue(); - aLbLineType.SaveValue(); - aLbLineColor.SaveValue(); - aLbHatchings.SaveValue(); - - // Flag fuer modifiziert setzen - *pnHatchingListState |= CT_MODIFIED; - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - } - delete( pDlg ); - } - return 0L; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxHatchTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbHatchings.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_HATCH ) ) ); - - if( aQueryBox.Execute() == RET_YES ) - { - delete pHatchingList->Remove( nPos ); - aLbHatchings.RemoveEntry( nPos ); - aLbHatchings.SelectEntryPos( 0 ); - - aCtlPreview.Invalidate(); - - ChangeHatchHdl_Impl( this ); - - // Flag fuer modifiziert setzen - *pnHatchingListState |= CT_MODIFIED; - } - } - // Status der Buttons ermitteln - if( !pHatchingList->Count() ) - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxHatchTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *pnHatchingListState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pHatchingList->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Liste speichern - XHatchList* pHatchList = new XHatchList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pHatchList->SetName( aURL.getName() ); - if( pHatchList->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - if( pHatchingList != ( (SvxAreaTabDialog*) DLGWIN )->GetHatchingList() ) - delete pHatchingList; - - pHatchingList = pHatchList; - ( (SvxAreaTabDialog*) DLGWIN )->SetNewHatchingList( pHatchingList ); - - aLbHatchings.Clear(); - aLbHatchings.Fill( pHatchingList ); - Reset( rOutAttrs ); - - pHatchingList->SetName( aURL.getName() ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gewechselt setzen - *pnHatchingListState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnHatchingListState &= ~CT_MODIFIED; - } - else - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - } - - // Status der Buttons ermitteln - if ( pHatchingList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return 0L; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxHatchTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soh" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pHatchingList->GetName().Len() ) - { - aFile.Append( pHatchingList->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soh" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pHatchingList->SetName( aURL.getName() ); - pHatchingList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pHatchingList->Save() ) - { - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - // Flag fuer gespeichert setzen - *pnHatchingListState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnHatchingListState &= ~CT_MODIFIED; - } - else - { - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); - } - } - - return 0L; -} - -//------------------------------------------------------------------------ - -void SvxHatchTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) -{ - if( pWindow == &aCtlAngle ) - { - switch( eRcPt ) - { - case RP_LT: aMtrAngle.SetValue( 135 ); break; - case RP_MT: aMtrAngle.SetValue( 90 ); break; - case RP_RT: aMtrAngle.SetValue( 45 ); break; - case RP_LM: aMtrAngle.SetValue( 180 ); break; - case RP_RM: aMtrAngle.SetValue( 0 ); break; - case RP_LB: aMtrAngle.SetValue( 225 ); break; - case RP_MB: aMtrAngle.SetValue( 270 ); break; - case RP_RB: aMtrAngle.SetValue( 315 ); break; - case RP_MM: break; - } - ModifiedHdl_Impl( this ); - } -} - - -void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - aCtlPreview.SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); - - SvxTabPage::DataChanged( rDCEvt ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx deleted file mode 100644 index ee1b0a3ec..000000000 --- a/cui/source/tabpages/tpline.cxx +++ /dev/null @@ -1,1845 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVX_SIZEITEM_HXX //autogen -#include -#endif -#include -#include -#include -#include - -#define _SVX_TPLINE_CXX - -#include -#include "tabline.hrc" -#include "svx/xattr.hxx" -#include -#include -#include "svx/drawitem.hxx" -#include "cuitabline.hxx" -#include "dlgname.hxx" -#include -#include "svx/dlgutil.hxx" -#include "svx/svxgrahicitem.hxx" -#include -#include "svx/ofaitem.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "paragrph.hrc" -#include "sfx2/opengrf.hxx" -#include -#include - -#define MAX_BMP_WIDTH 16 -#define MAX_BMP_HEIGHT 16 -// define ---------------------------------------------------------------- - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 -#define XOUT_WIDTH 150 - -// static ---------------------------------------------------------------- - -static sal_uInt16 pLineRanges[] = -{ - XATTR_LINETRANSPARENCE, - XATTR_LINETRANSPARENCE, - SID_ATTR_LINE_STYLE, - SID_ATTR_LINE_ENDCENTER, - 0 -}; - -/************************************************************************* -|* -|* Dialog zum Aendern der Linien -|* -\************************************************************************/ - -SvxLineTabPage::SvxLineTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_LINE ), rInAttrs ), - aFlLine ( this, CUI_RES( FL_LINE ) ), - aFtLineStyle ( this, CUI_RES( FT_LINE_STYLE ) ), - aLbLineStyle ( this, CUI_RES( LB_LINE_STYLE ) ), - aFtColor ( this, CUI_RES( FT_COLOR ) ), - aLbColor ( this, CUI_RES( LB_COLOR ) ), - aFtLineWidth ( this, CUI_RES( FT_LINE_WIDTH ) ), - aMtrLineWidth ( this, CUI_RES( MTR_FLD_LINE_WIDTH ) ), - aFtTransparent ( this, CUI_RES( FT_TRANSPARENT ) ), - aMtrTransparent ( this, CUI_RES( MTR_LINE_TRANSPARENT ) ), - aFlLineEnds ( this, CUI_RES( FL_LINE_ENDS ) ), - aLbStartStyle ( this, CUI_RES( LB_START_STYLE ) ), - aMtrStartWidth ( this, CUI_RES( MTR_FLD_START_WIDTH ) ), - aTsbCenterStart ( this, CUI_RES( TSB_CENTER_START ) ), - aFtLineEndsStyle ( this, CUI_RES( FT_LINE_ENDS_STYLE ) ), - aLbEndStyle ( this, CUI_RES( LB_END_STYLE ) ), - aFtLineEndsWidth ( this, CUI_RES( FT_LINE_ENDS_WIDTH ) ), - aMtrEndWidth ( this, CUI_RES( MTR_FLD_END_WIDTH ) ), - aTsbCenterEnd ( this, CUI_RES( TSB_CENTER_END ) ), - aCbxSynchronize ( this, CUI_RES( CBX_SYNCHRONIZE ) ), - aFLSeparator ( this, CUI_RES( FL_SEPARATOR ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - - // #116827# - maFLEdgeStyle ( this, CUI_RES( FL_EDGE_STYLE ) ), - maFTEdgeStyle ( this, CUI_RES( FT_EDGE_STYLE ) ), - maLBEdgeStyle ( this, CUI_RES( LB_EDGE_STYLE ) ), - - pSymbolList(NULL), - bNewSize(false), - nNumMenuGalleryItems(0), - nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged - pSymbolAttr(NULL), - //#58425# Symbole auf einer Linie (z.B. StarChart) - aFlSymbol ( this, CUI_RES(FL_SYMBOL_FORMAT)), - aSymbolMB ( this, CUI_RES(MB_SYMBOL_BITMAP)), - aSymbolWidthFT ( this, CUI_RES(FT_SYMBOL_WIDTH)), - aSymbolWidthMF ( this, CUI_RES(MF_SYMBOL_WIDTH)), - aSymbolHeightFT ( this, CUI_RES(FT_SYMBOL_HEIGHT)), - aSymbolHeightMF ( this, CUI_RES(MF_SYMBOL_HEIGHT)), - aSymbolRatioCB ( this, CUI_RES(CB_SYMBOL_RATIO)), - - bLastWidthModified(sal_False), - aSymbolLastSize(Size(0,0)), - bSymbols(sal_False), - - rOutAttrs ( rInAttrs ), - bObjSelected( sal_False ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXLStyle ( XLINE_DASH ), - aXWidth ( 1 ), - aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ), - aXColor ( String(), COL_LIGHTRED ), - aXLineAttr ( pXPool ), - rXLSet ( aXLineAttr.GetItemSet() ), - pnLineEndListState( 0 ), - pnDashListState( 0 ), - pnColorTableState( 0 ), - nPageType ( 0 ) -{ - aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE))); - aLbStartStyle.SetAccessibleName(String(CUI_RES( STR_LB_START_STYLE ) ) ); - aMtrStartWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_START_WIDTH ) ) ); - aLbEndStyle.SetAccessibleName(String(CUI_RES( STR_LB_END_STYLE ) ) ); - aMtrEndWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_END_WIDTH ) ) ); - aTsbCenterStart.SetAccessibleName(String(CUI_RES( STR_CENTER_START ) ) ); - aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) ); - - FreeResource(); - - aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - // no break -> we now have mm - case FUNIT_MM: - aMtrLineWidth.SetSpinSize( 50 ); - aMtrStartWidth.SetSpinSize( 50 ); - aMtrEndWidth.SetSpinSize( 50 ); - break; - - case FUNIT_INCH: - aMtrLineWidth.SetSpinSize( 2 ); - aMtrStartWidth.SetSpinSize( 2 ); - aMtrEndWidth.SetSpinSize( 2 ); - break; - default: ;//prevent warning - } - SetFieldUnit( aMtrLineWidth, eFUnit ); - SetFieldUnit( aMtrStartWidth, eFUnit ); - SetFieldUnit( aMtrEndWidth, eFUnit ); - - // PoolUnit ermitteln - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); - - aLbLineStyle.SetSelectHdl( - LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) ); - aLbColor.SetSelectHdl( - LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) ); - aMtrLineWidth.SetModifyHdl( - LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) ); - aMtrTransparent.SetModifyHdl( - LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) ); - - Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl ); - Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl ); - aLbStartStyle.SetSelectHdl( aStart ); - aLbEndStyle.SetSelectHdl( aEnd ); - aMtrStartWidth.SetModifyHdl( aStart ); - aMtrEndWidth.SetModifyHdl( aEnd ); - aTsbCenterStart.SetClickHdl( aStart ); - aTsbCenterEnd.SetClickHdl( aEnd ); - - pColorTab = NULL; - pDashList = NULL; - pLineEndList = NULL; - - // #116827# - Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); - maLBEdgeStyle.SetSelectHdl( aEdgeStyle ); - - //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen - aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); - aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); - aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl)); - aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl)); - - aSymbolRatioCB.Check(sal_True); - ShowSymbolControls(sal_False); - - // #63083# - nActLineWidth = -1; -} -//#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren -void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn) -{ - bSymbols=bOn; - aSymbolWidthFT.Show(bOn); - aSymbolWidthMF.Show(bOn); - aSymbolHeightFT.Show(bOn); - aSymbolHeightMF.Show(bOn); - aFlSymbol.Show(bOn); - aSymbolRatioCB.Show(bOn); - aSymbolMB.Show(bOn); - aCtlPreview.ShowSymbol(bOn); -} -// ----------------------------------------------------------------------- -//#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu! -SvxLineTabPage::~SvxLineTabPage() -{ - delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); - - if(pSymbolList) - delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ); - - for ( size_t i = 0, n = aGrfBrushItems.size(); i < n; ++i ) - { - SvxBmpItemInfo* pInfo = aGrfBrushItems[ i ]; - delete pInfo->pBrushItem; - delete pInfo; - } -} -void SvxLineTabPage::Construct() -{ - // Farbtabelle - aLbColor.Fill( pColorTab ); - FillListboxes(); -} - -void SvxLineTabPage::FillListboxes() -{ - // Linienstile - sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos(); - aLbLineStyle.FillStyles(); - aLbLineStyle.Fill( pDashList ); - aLbLineStyle.SelectEntryPos( nOldSelect ); - - // LinienEndenStile - String sNone( SVX_RES( RID_SVXSTR_NONE ) ); - nOldSelect = aLbStartStyle.GetSelectEntryPos(); - aLbStartStyle.Clear(); - aLbStartStyle.InsertEntry( sNone ); - aLbStartStyle.Fill( pLineEndList ); - aLbStartStyle.SelectEntryPos( nOldSelect ); - nOldSelect = aLbEndStyle.GetSelectEntryPos(); - aLbEndStyle.Clear(); - aLbEndStyle.InsertEntry( sNone ); - aLbEndStyle.Fill( pLineEndList, sal_False ); - aLbEndStyle.SelectEntryPos( nOldSelect ); -} - -// ----------------------------------------------------------------------- - -void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if( nDlgType == 0 && pDashList ) - { - sal_uInt16 nPos; - sal_uInt16 nCount; - - // Dashliste - if( ( *pnDashListState & CT_MODIFIED ) || - ( *pnDashListState & CT_CHANGED ) ) - { - if( *pnDashListState & CT_CHANGED ) - pDashList = ( (SvxLineTabDialog*) DLGWIN )-> - GetNewDashList(); - *pnDashListState = CT_NONE; - - // Styleliste - nPos = aLbLineStyle.GetSelectEntryPos(); - - aLbLineStyle.Clear(); - aLbLineStyle.InsertEntry( - SVX_RESSTR( RID_SVXSTR_INVISIBLE ) ); - aLbLineStyle.InsertEntry( - SVX_RESSTR( RID_SVXSTR_SOLID ) ); - aLbLineStyle.Fill( pDashList ); - nCount = aLbLineStyle.GetEntryCount(); - - if ( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbLineStyle.SelectEntryPos( 0 ); - else - aLbLineStyle.SelectEntryPos( nPos ); - // SelectStyleHdl_Impl( this ); - } - - INetURLObject aDashURL( pDashList->GetPath() ); - - aDashURL.Append( pDashList->GetName() ); - DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - // LineEndliste - if( ( *pnLineEndListState & CT_MODIFIED ) || - ( *pnLineEndListState & CT_CHANGED ) ) - { - if( *pnLineEndListState & CT_CHANGED ) - pLineEndList = ( (SvxLineTabDialog*) DLGWIN )-> - GetNewLineEndList(); - *pnLineEndListState = CT_NONE; - - nPos = aLbLineStyle.GetSelectEntryPos(); - String sNone( SVX_RES( RID_SVXSTR_NONE ) ); - aLbStartStyle.Clear(); - aLbStartStyle.InsertEntry( sNone ); - - aLbStartStyle.Fill( pLineEndList ); - nCount = aLbStartStyle.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbStartStyle.SelectEntryPos( 0 ); - else - aLbStartStyle.SelectEntryPos( nPos ); - - aLbEndStyle.Clear(); - aLbEndStyle.InsertEntry( sNone ); - - aLbEndStyle.Fill( pLineEndList, sal_False ); - nCount = aLbEndStyle.GetEntryCount(); - - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbEndStyle.SelectEntryPos( 0 ); - else - aLbEndStyle.SelectEntryPos( nPos ); - } - INetURLObject aLineURL( pLineEndList->GetPath() ); - - aLineURL.Append( pLineEndList->GetName() ); - DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde - if( aLbLineStyle.GetSelectEntryPos() != 0 ) - { - if( nPageType == 2 ) // 1 - { - aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE - ChangePreviewHdl_Impl( this ); - } - if( nPageType == 3 ) - { - aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID - aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID - ChangePreviewHdl_Impl( this ); - } - } - - // ColorTable - if( *pnColorTableState ) - { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxLineTabDialog*) DLGWIN )-> - GetNewColorTable(); - // aLbColor - sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos(); - aLbColor.Clear(); - aLbColor.Fill( pColorTab ); - nCount = aLbColor.GetEntryCount(); - if( nCount == 0 ) - ; // This case should never occur - else if( nCount <= nColorPos ) - aLbColor.SelectEntryPos( 0 ); - else - aLbColor.SelectEntryPos( nColorPos ); - - ChangePreviewHdl_Impl( this ); - } - - nPageType = 0; - } - // Seite existiert im Ctor noch nicht, deswegen hier! - - else if ( nDlgType == 1100 || - nDlgType == 1101 ) - { - aFtLineEndsStyle.Hide(); - aFtLineEndsWidth.Hide(); - aLbStartStyle.Hide(); - aMtrStartWidth.Hide(); - aTsbCenterStart.Hide(); - aLbEndStyle.Hide(); - aMtrEndWidth.Hide(); - aTsbCenterEnd.Hide(); - aCbxSynchronize.Hide(); - aFlLineEnds.Hide(); - - // #116827# - maFLEdgeStyle.Hide(); - maFTEdgeStyle.Hide(); - maLBEdgeStyle.Hide(); - } -} - -// ----------------------------------------------------------------------- - -int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( nDlgType == 0 ) // Linien-Dialog - { - nPageType = 1; // evtl. fuer Erweiterungen - *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!! - sal_uInt16 nPos = aLbStartStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - nPos--; - *pPosLineEndLb = nPos; - } - - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs ) -{ - const SfxPoolItem* pOld = NULL; - sal_uInt16 nPos; - sal_Bool bModified = sal_False; - - // Um evtl. Modifikationen der Liste vorzubeugen - // werden Items anderer Seiten nicht gesetzt - if( nDlgType != 0 || nPageType != 2 ) - { - nPos = aLbLineStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbLineStyle.GetSavedValue() ) - { - XLineStyleItem* pStyleItem = NULL; - - if( nPos == 0 ) - pStyleItem = new XLineStyleItem( XLINE_NONE ); - else if( nPos == 1 ) - pStyleItem = new XLineStyleItem( XLINE_SOLID ); - else - { - pStyleItem = new XLineStyleItem( XLINE_DASH ); - - // Zusaetzliche Sicherheit - if( pDashList->Count() > (long) ( nPos - 2 ) ) - { - XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(), - pDashList->GetDash( nPos - 2 )->GetDash() ); - pOld = GetOldItem( rAttrs, XATTR_LINEDASH ); - if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) ) - { - rAttrs.Put( aDashItem ); - bModified = sal_True; - } - } - } - pOld = GetOldItem( rAttrs, XATTR_LINESTYLE ); - if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) ) - { - rAttrs.Put( *pStyleItem ); - bModified = sal_True; - } - delete pStyleItem; - } - } - // Linienbreite - // GetSavedValue() liefert String! - if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() ) - { - XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ); - pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH ); - if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - //Breite Linienanfang - if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() ) - { - XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ); - pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH ); - if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - //Breite Linienende - if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() ) - { - XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ); - pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH ); - if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - // Linienfarbe - if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() ) - { - XLineColorItem aItem( aLbColor.GetSelectEntry(), - aLbColor.GetSelectEntryColor() ); - pOld = GetOldItem( rAttrs, XATTR_LINECOLOR ); - if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - if( nDlgType != 0 || nPageType != 3 ) - { - // Linienanfang - nPos = aLbStartStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbStartStyle.GetSavedValue() ) - { - XLineStartItem* pItem = NULL; - if( nPos == 0 ) - pItem = new XLineStartItem(); - else if( pLineEndList->Count() > (long) ( nPos - 1 ) ) - pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(), - pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); - pOld = GetOldItem( rAttrs, XATTR_LINESTART ); - if( pItem && - ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) ) - { - rAttrs.Put( *pItem ); - bModified = sal_True; - } - delete pItem; - } - // Linienende - nPos = aLbEndStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbEndStyle.GetSavedValue() ) - { - XLineEndItem* pItem = NULL; - if( nPos == 0 ) - pItem = new XLineEndItem(); - else if( pLineEndList->Count() > (long) ( nPos - 1 ) ) - pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(), - pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); - pOld = GetOldItem( rAttrs, XATTR_LINEEND ); - if( pItem && - ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) ) - { - rAttrs.Put( *pItem ); - bModified = sal_True; - } - delete pItem; - } - } - - // Linienenden zentriert - TriState eState = aTsbCenterStart.GetState(); - if( eState != aTsbCenterStart.GetSavedValue() ) - { - XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) ); - pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER ); - if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - eState = aTsbCenterEnd.GetState(); - if( eState != aTsbCenterEnd.GetSavedValue() ) - { - XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) ); - pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER ); - if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - //Breite Linienanfang - if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() ) - { - XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ); - pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH ); - if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - //Breite Linienende - if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() ) - { - XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ); - pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH ); - if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - // Transparenz - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() ) - { - XLineTransparenceItem aItem( nVal ); - pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE ); - if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - // #116827# - nPos = maLBEdgeStyle.GetSelectEntryPos(); - if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() ) - { - XLineJointItem* pNew = 0L; - - switch(nPos) - { - case 0: // Rounded, default - { - pNew = new XLineJointItem(XLINEJOINT_ROUND); - break; - } - case 1: // - none - - { - pNew = new XLineJointItem(XLINEJOINT_NONE); - break; - } - case 2: // Miter - { - pNew = new XLineJointItem(XLINEJOINT_MITER); - break; - } - case 3: // Bevel - { - pNew = new XLineJointItem(XLINEJOINT_BEVEL); - break; - } - } - - if(pNew) - { - pOld = GetOldItem( rAttrs, XATTR_LINEJOINT ); - - if(!pOld || !(*(const XLineJointItem*)pOld == *pNew)) - { - rAttrs.Put( *pNew ); - bModified = sal_True; - } - - delete pNew; - } - } - - if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize) - { - //wurde also per Auswahl gesetzt oder Gr��e ist anders - SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize); - const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) ); - bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ; - if(bNewSize) - { - rAttrs.Put(aSItem); - bModified=sal_True; - } - - SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType); - const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) ); - bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem; - if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN) - bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen! - if(bNewType) - { - rAttrs.Put(aTItem); - bModified=sal_True; - } - - if(nSymbolType!=SVX_SYMBOLTYPE_NONE) - { - SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH)); - const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) ); - bool bNewBrush = - pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem; - if(bNewBrush) - { - rAttrs.Put(aBItem); - bModified=sal_True; - } - } - } - rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); - return( bModified ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxLineTabPage::FillXLSet_Impl() -{ - sal_uInt16 nPos; - - if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - { - rXLSet.Put( XLineStyleItem( XLINE_NONE ) ); - } - else if( aLbLineStyle.IsEntryPosSelected( 0 ) ) - rXLSet.Put( XLineStyleItem( XLINE_NONE ) ); - else if( aLbLineStyle.IsEntryPosSelected( 1 ) ) - rXLSet.Put( XLineStyleItem( XLINE_SOLID ) ); - else - { - rXLSet.Put( XLineStyleItem( XLINE_DASH ) ); - - nPos = aLbLineStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(), - pDashList->GetDash( nPos - 2 )->GetDash() ) ); - } - } - - nPos = aLbStartStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - if( nPos == 0 ) - rXLSet.Put( XLineStartItem() ); - else - rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(), - pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); - } - nPos = aLbEndStyle.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - if( nPos == 0 ) - rXLSet.Put( XLineEndItem() ); - else - rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(), - pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) ); - } - - // #116827# - nPos = maLBEdgeStyle.GetSelectEntryPos(); - if(LISTBOX_ENTRY_NOTFOUND != nPos) - { - switch(nPos) - { - case 0: // Rounded, default - { - rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND)); - break; - } - case 1: // - none - - { - rXLSet.Put(XLineJointItem(XLINEJOINT_NONE)); - break; - } - case 2: // Miter - { - rXLSet.Put(XLineJointItem(XLINEJOINT_MITER)); - break; - } - case 3: // Bevel - { - rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL)); - break; - } - } - } - - rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) ); - rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) ); - - rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) ); - rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(), - aLbColor.GetSelectEntryColor() ) ); - - // Linienenden zentriert - if( aTsbCenterStart.GetState() == STATE_CHECK ) - rXLSet.Put( XLineStartCenterItem( sal_True ) ); - else if( aTsbCenterStart.GetState() == STATE_NOCHECK ) - rXLSet.Put( XLineStartCenterItem( sal_False ) ); - - if( aTsbCenterEnd.GetState() == STATE_CHECK ) - rXLSet.Put( XLineEndCenterItem( sal_True ) ); - else if( aTsbCenterEnd.GetState() == STATE_NOCHECK ) - rXLSet.Put( XLineEndCenterItem( sal_False ) ); - - // Transparenz - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - rXLSet.Put( XLineTransparenceItem( nVal ) ); - - // #116827# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - return( sal_True ); -} - -// ----------------------------------------------------------------------- - -void SvxLineTabPage::Reset( const SfxItemSet& rAttrs ) -{ - String aString; - XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH - - // Linienstil - const SfxPoolItem *pPoolItem; - long nSymType=SVX_SYMBOLTYPE_UNKNOWN; - sal_Bool bPrevSym=sal_False; - sal_Bool bEnable=sal_True; - sal_Bool bIgnoreGraphic=sal_False; - sal_Bool bIgnoreSize=sal_False; - if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),sal_True,&pPoolItem) == SFX_ITEM_SET) - { - nSymType=((const SfxInt32Item *)pPoolItem)->GetValue(); - } - - if(nSymType == SVX_SYMBOLTYPE_AUTO) - { - aSymbolGraphic=aAutoSymbolGraphic; - aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize(); - bPrevSym=sal_True; - } - else if(nSymType == SVX_SYMBOLTYPE_NONE) - { - bEnable=sal_False; - bIgnoreGraphic=sal_True; - bIgnoreSize=sal_True; - } - else if(nSymType >= 0) - { - VirtualDevice aVDev; - aVDev.SetMapMode(MapMode(MAP_100TH_MM)); - - SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS); - pModel->GetItemPool().FreezeIdRanges(); - SdrPage* pPage = new SdrPage( *pModel, sal_False ); - pPage->SetSize(Size(1000,1000)); - pModel->InsertPage( pPage, 0 ); - SdrView* pView = new SdrView( pModel, &aVDev ); - pView->hideMarkHandles(); - SdrPageView* pPageView = pView->ShowSdrPage(pPage); - SdrObject *pObj=NULL; - long nSymTmp=nSymType; - if(pSymbolList) - { - if(pSymbolList->GetObjCount()) - { - nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!! - pObj=pSymbolList->GetObj(nSymTmp); - if(pObj) - { - pObj=pObj->Clone(); - pPage->NbcInsertObject(pObj); - pView->MarkObj(pObj,pPageView); - if(pSymbolAttr) - { - pObj->SetMergedItemSet(*pSymbolAttr); - } - else - { - pObj->SetMergedItemSet(rOutAttrs); - } - GDIMetaFile aMeta(pView->GetAllMarkedMetaFile()); - - aSymbolGraphic=Graphic(aMeta); - aSymbolSize=pObj->GetSnapRect().GetSize(); - aSymbolGraphic.SetPrefSize(aSymbolSize); - aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM); - bPrevSym=sal_True; - bEnable=sal_True; - bIgnoreGraphic=sal_True; - - pView->UnmarkAll(); - pObj=pPage->RemoveObject(0); - SdrObject::Free( pObj ); - } - } - } - delete pView; - delete pModel; - } - if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET) - { - const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic(); - if( pGraphic ) - { - if(!bIgnoreGraphic) - { - aSymbolGraphic=*pGraphic; - } - if(!bIgnoreSize) - { - aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(), - pGraphic->GetPrefMapMode(), - MAP_100TH_MM ); - } - bPrevSym=sal_True; - } - } - if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET) - { - aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize(); - } - - - aSymbolRatioCB.Enable(bEnable); - aSymbolHeightFT.Enable(bEnable); - aSymbolWidthFT.Enable(bEnable); - aSymbolWidthMF.Enable(bEnable); - aSymbolHeightMF.Enable(bEnable); - if(bPrevSym) - { - SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit); - SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit); - aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize); - aSymbolLastSize=aSymbolSize; - } - - if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE ) - { - eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue(); - - switch( eXLS ) - { - case XLINE_NONE: - aLbLineStyle.SelectEntryPos( 0 ); - break; - case XLINE_SOLID: - aLbLineStyle.SelectEntryPos( 1 ); - break; - - case XLINE_DASH: - aLbLineStyle.SetNoSelection(); - aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs. - Get( XATTR_LINEDASH ) ).GetName() ); - break; - - default: - break; - } - } - else - { - aLbLineStyle.SetNoSelection(); - } - - // Linienstaerke - if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE ) - { - SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs. - Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit ); - } - else - aMtrLineWidth.SetText( String() ); - - // Linienfarbe - aLbColor.SetNoSelection(); - - if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE ) - { - Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue(); - aLbColor.SelectEntry( aCol ); - if( aLbColor.GetSelectEntryCount() == 0 ) - { - aLbColor.InsertEntry( aCol, String() ); - aLbColor.SelectEntry( aCol ); - } - } - - // LinienAnfang - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT ) - { - aLbStartStyle.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE ) - { - // #86265# select entry using list and polygon, not string - sal_Bool bSelected(sal_False); - const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue(); - - for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++) - { - XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a); - const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); - - if(rItemPolygon == rEntryPolygon) - { - // select this entry - aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1); - bSelected = sal_True; - } - } - - if(!bSelected) - aLbStartStyle.SelectEntryPos( 0 ); - } - else - { - aLbStartStyle.SetNoSelection(); - } - - // LinienEnde - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT ) - { - aLbEndStyle.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE ) - { - // #86265# select entry using list and polygon, not string - sal_Bool bSelected(sal_False); - const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue(); - - for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++) - { - XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a); - const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); - - if(rItemPolygon == rEntryPolygon) - { - // select this entry - aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1); - bSelected = sal_True; - } - } - - if(!bSelected) - aLbEndStyle.SelectEntryPos( 0 ); - } - else - { - aLbEndStyle.SetNoSelection(); - } - - // LinienAnfang St"arke - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT ) - { - aMtrStartWidth.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE ) - { - SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs. - Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit ); - } - else - aMtrStartWidth.SetText( String() ); - - // LinienEnde St"arke - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT ) - { - aMtrEndWidth.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE ) - { - SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs. - Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit ); - } - else - aMtrEndWidth.SetText( String() ); - - // Linienenden zentriert (Start) - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT ) - { - aTsbCenterStart.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE ) - { - aTsbCenterStart.EnableTriState( sal_False ); - - if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() ) - aTsbCenterStart.SetState( STATE_CHECK ); - else - aTsbCenterStart.SetState( STATE_NOCHECK ); - } - else - { - aTsbCenterStart.SetState( STATE_DONTKNOW ); - } - - // Linienenden zentriert (Ende) - if( bObjSelected && - rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT ) - { - aTsbCenterEnd.Disable(); - } - else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE ) - { - aTsbCenterEnd.EnableTriState( sal_False ); - - if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() ) - aTsbCenterEnd.SetState( STATE_CHECK ); - else - aTsbCenterEnd.SetState( STATE_NOCHECK ); - } - else - { - aTsbCenterEnd.SetState( STATE_DONTKNOW ); - } - - // Transparenz - if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE ) - { - sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs. - Get( XATTR_LINETRANSPARENCE ) ).GetValue(); - aMtrTransparent.SetValue( nTransp ); - ChangeTransparentHdl_Impl( NULL ); - } - else - aMtrTransparent.SetText( String() ); - - if( !aLbStartStyle.IsEnabled() && - !aLbEndStyle.IsEnabled() && - !aMtrStartWidth.IsEnabled() && - !aMtrEndWidth.IsEnabled() && - !aTsbCenterStart.IsEnabled()&& - !aTsbCenterEnd.IsEnabled() ) - { - aCbxSynchronize.Disable(); - aFtLineEndsStyle.Disable(); - aFtLineEndsWidth.Disable(); - aFlLineEnds.Disable(); - } - - // Synchronisieren - // Jetzt wird der Wert aus der INI-Datei geholt (#42258#) - String aStr = GetUserData(); - aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() ); - - // #116827# - if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT)) - { - maFTEdgeStyle.Disable(); - maLBEdgeStyle.Disable(); - } - else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT)) - { - XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue(); - - switch(eLineJoint) - { - case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break; - case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break; - case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break; - case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break; - case XLINEJOINT_MIDDLE : break; - } - } - else - { - maLBEdgeStyle.SetNoSelection(); - } - - // Werte sichern - aLbLineStyle.SaveValue(); - aMtrLineWidth.SaveValue(); - aLbColor.SaveValue(); - aLbStartStyle.SaveValue(); - aLbEndStyle.SaveValue(); - aMtrStartWidth.SaveValue(); - aMtrEndWidth.SaveValue(); - aTsbCenterStart.SaveValue(); - aTsbCenterEnd.SaveValue(); - aMtrTransparent.SaveValue(); - - // #116827# - maLBEdgeStyle.SaveValue(); - - ClickInvisibleHdl_Impl( this ); - - ChangePreviewHdl_Impl( NULL ); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxLineTabPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxLineTabPage( pWindow, rAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxLineTabPage::GetRanges() -{ - return( pLineRanges ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl ) -{ - if(pCntrl == &aMtrLineWidth) - { - // Linienbreite und Start/EndBreite - sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit ); - if(nActLineWidth == -1) - { - // Noch nicht initialisiert, hole den Startwert - const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH ); - sal_Int32 nStartLineWidth = 0; - if(pOld) - nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue(); - nActLineWidth = nStartLineWidth; - } - - if(nActLineWidth != nNewLineWidth) - { - // Anpassungen Start/EndWidth #63083# - sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit ); - sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); - if(nValNew < 0) - nValNew = 0; - SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit ); - - nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit ); - nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); - if(nValNew < 0) - nValNew = 0; - SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit ); - } - - // Aktuellen Wert merken - nActLineWidth = nNewLineWidth; - } - - FillXLSet_Impl(); - aCtlPreview.Invalidate(); - - // Transparenz entspr. zugaenglich machen - if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar - { - aFtTransparent.Disable(); - aMtrTransparent.Disable(); - } - else - { - aFtTransparent.Enable(); - aMtrTransparent.Enable(); - } - - const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0; - const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0; - - aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd ); - aMtrStartWidth.Enable( bHasLineStart ); - aTsbCenterStart.Enable( bHasLineStart ); - aMtrEndWidth.Enable( bHasLineEnd ); - aTsbCenterEnd.Enable( bHasLineEnd ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p ) -{ - if( aCbxSynchronize.IsChecked() ) - { - if( p == &aMtrStartWidth ) - aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() ); - if( p == &aLbStartStyle ) - aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() ); - if( p == &aTsbCenterStart ) - aTsbCenterEnd.SetState( aTsbCenterStart.GetState() ); - } - - ChangePreviewHdl_Impl( this ); - - return( 0L ); -} - -//------------------------------------------------------------------------ -// #116827# - -IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG ) -{ - ChangePreviewHdl_Impl( this ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) -{ - if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar - { - aFtColor.Disable(); - if(!bSymbols) - aLbColor.Disable(); - aFtLineWidth.Disable(); - aMtrLineWidth.Disable(); - - if( aFlLineEnds.IsEnabled() ) - { - aFtLineEndsStyle.Disable(); - aFtLineEndsWidth.Disable(); - aLbStartStyle.Disable(); - aMtrStartWidth.Disable(); - aTsbCenterStart.Disable(); - aLbEndStyle.Disable(); - aMtrEndWidth.Disable(); - aTsbCenterEnd.Disable(); - aCbxSynchronize.Disable(); - - // #116827# - maFTEdgeStyle.Disable(); - maLBEdgeStyle.Disable(); - } - } - else - { - aFtColor.Enable(); - aLbColor.Enable(); - aFtLineWidth.Enable(); - aMtrLineWidth.Enable(); - - if( aFlLineEnds.IsEnabled() ) - { - aFtLineEndsStyle.Enable(); - aFtLineEndsWidth.Enable(); - aLbStartStyle.Enable(); - aMtrStartWidth.Enable(); - aTsbCenterStart.Enable(); - aLbEndStyle.Enable(); - aMtrEndWidth.Enable(); - aTsbCenterEnd.Enable(); - aCbxSynchronize.Enable(); - - // #116827# - maFTEdgeStyle.Enable(); - maLBEdgeStyle.Enable(); - } - } - ChangePreviewHdl_Impl( NULL ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p ) -{ - if( aCbxSynchronize.IsChecked() ) - { - if( p == &aMtrEndWidth ) - aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() ); - if( p == &aLbEndStyle ) - aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() ); - if( p == &aTsbCenterEnd ) - aTsbCenterStart.SetState( aTsbCenterEnd.GetState() ); - } - - ChangePreviewHdl_Impl( this ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - XLineTransparenceItem aItem( nVal ); - - rXLSet.Put( XLineTransparenceItem( aItem ) ); - - // #116827# - FillXLSet_Impl(); - - aCtlPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt ) -{ - eRP = eRcPt; -} - -//------------------------------------------------------------------------ - -void SvxLineTabPage::FillUserData() -{ - // Abgleich wird in der Ini-Datei festgehalten - UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() ); - SetUserData( aStrUserData ); -} - - -//#58425# Symbole auf einer Linie (z.B. StarChart) -//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) -//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage -IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton ) -{ - //Popup initialisieren - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY )) - { - // Gallery-Eintraege besorgen - GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); - - PopupMenu* pPopup = new PopupMenu; - String aEmptyStr; - const String *pUIName = NULL; - sal_uInt32 i = 0; - for(std::vector::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i) - { - pUIName = &(*it); - - // convert URL encodings to UI characters (eg %20 for spaces) - String aPhysicalName; - if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *it, aPhysicalName )) - pUIName = &aPhysicalName; - - SvxBrushItem* pBrushItem = new SvxBrushItem(*it, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH); - pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); - pInfo->pBrushItem = pBrushItem; - pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i); - if ( i < aGrfBrushItems.size() ) { - aGrfBrushItems.insert( aGrfBrushItems.begin() + i, pInfo ); - } else { - aGrfBrushItems.push_back( pInfo ); - } - const Graphic* pGraphic = pBrushItem->GetGraphic(); - - if(pGraphic) - { - Bitmap aBitmap(pGraphic->GetBitmap()); - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || - aSize.Height() > MAX_BMP_HEIGHT) - { - sal_Bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); - aBitmap.Scale(nScale, nScale); - - } - Image aImage(aBitmap); - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - else - { - Image aImage; - pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); - } - } - aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); - - if(aGrfNames.empty()) - aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False); - } - - if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList) - { - VirtualDevice aVDev; - aVDev.SetMapMode(MapMode(MAP_100TH_MM)); - SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS); - pModel->GetItemPool().FreezeIdRanges(); - // Page - SdrPage* pPage = new SdrPage( *pModel, sal_False ); - pPage->SetSize(Size(1000,1000)); - pModel->InsertPage( pPage, 0 ); - // 3D View - SdrView* pView = new SdrView( pModel, &aVDev ); - pView->hideMarkHandles(); - SdrPageView* pPageView = pView->ShowSdrPage(pPage); - - PopupMenu* pPopup = new PopupMenu; - String aEmptyStr; - for(long i=0;; ++i) - { - SdrObject *pObj=pSymbolList->GetObj(i); - if(pObj==NULL) - break; - pObj=pObj->Clone(); - aGrfNames.push_back(aEmptyStr); - pPage->NbcInsertObject(pObj); - pView->MarkObj(pObj,pPageView); - if(pSymbolAttr) - { - pObj->SetMergedItemSet(*pSymbolAttr); - } - else - { - pObj->SetMergedItemSet(rOutAttrs); - } - - Bitmap aBitmap(pView->GetAllMarkedBitmap()); - GDIMetaFile aMeta(pView->GetAllMarkedMetaFile()); - pView->UnmarkAll(); - pObj=pPage->RemoveObject(0); - SdrObject::Free(pObj); - - SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH); - pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); - - SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); - pInfo->pBrushItem = pBrushItem; - pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems); - if ( (size_t)(nNumMenuGalleryItems + i) < aGrfBrushItems.size() ) { - aGrfBrushItems.insert( aGrfBrushItems.begin() + nNumMenuGalleryItems + i, pInfo ); - } else { - aGrfBrushItems.push_back( pInfo ); - } - - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) - { - sal_Bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); - aBitmap.Scale(nScale, nScale); - } - Image aImage(aBitmap); - pPopup->InsertItem(pInfo->nItemId,aEmptyStr,aImage); - } - aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup ); - - if(aGrfNames.empty()) - aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False); - - delete pView; - delete pModel; - } - return 0; -} -//#58425# Symbole auf einer Linie (z.B. StarChart) -//Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) -//der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage: -IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem) -{ - PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); - - SvxBmpItemInfo* pBmpInfo = 0; - for ( size_t i = 0; i < pThis->aGrfBrushItems.size(); i++ ) - { - SvxBmpItemInfo* pInfo = pThis->aGrfBrushItems[ i ]; - if( pInfo->pBrushItem == pItem ) - { - pBmpInfo = pInfo; break; - } - } - if( pBmpInfo ) - { - if( pItem->GetGraphic() ) - { - Bitmap aBitmap(pItem->GetGraphic()->GetBitmap()); - Size aSize(aBitmap.GetSizePixel()); - if(aSize.Width() > MAX_BMP_WIDTH || - aSize.Height() > MAX_BMP_HEIGHT) - { - sal_Bool bWidth = aSize.Width() > aSize.Height(); - double nScale = bWidth ? - (double)MAX_BMP_WIDTH / (double)aSize.Width(): - (double)MAX_BMP_HEIGHT / (double)aSize.Height(); - aBitmap.Scale(nScale, nScale); - } - Image aImage(aBitmap); - pPopup->SetItemImage( pBmpInfo->nItemId, aImage ); - } - } - - return 0; -} - -//#58425# Symbole auf einer Linie (z.B. StarChart) -//Handler f�r Menuebutton -IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton ) -{ - sal_uInt16 nItemId = pButton->GetCurItemId(); - const Graphic* pGraphic = 0; - Graphic aGraphic; - String aGrfName; - sal_Bool bResetSize = sal_False; - sal_Bool bEnable=sal_True; - long nPreviousSymbolType = nSymbolType; - - if(nItemId >= MN_GALLERY_ENTRY) - { - if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems) - { - nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste - } - else - { - nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - bResetSize = sal_True; - } - SvxBmpItemInfo* pInfo = aGrfBrushItems[ nItemId - MN_GALLERY_ENTRY ]; - pGraphic = pInfo->pBrushItem->GetGraphic(); - } - else switch(nItemId) - { - case MN_SYMBOLS_AUTO: - { - pGraphic=&aAutoSymbolGraphic; - aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); - nSymbolType=SVX_SYMBOLTYPE_AUTO; - } - break; - - case MN_SYMBOLS_NONE: - { - nSymbolType=SVX_SYMBOLTYPE_NONE; - pGraphic=NULL; - bEnable=sal_False; - } - break; - default: - { - SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC)); - aGrfDlg.EnableLink(sal_False); - aGrfDlg.AsLink(sal_False); - if( !aGrfDlg.Execute() ) - { - // ausgewaehlten Filter merken - aGrfName = aGrfDlg.GetPath(); - if( !aGrfDlg.GetGraphic(aGraphic) ) - { - nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; - pGraphic = &aGraphic; - bResetSize = sal_True; - } - } - if( !pGraphic ) - return 0; - } - break; - } - - if(pGraphic) - { - Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); - aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit); - aSymbolGraphic=*pGraphic; - if( bResetSize ) - { - aSymbolSize=aSize; - } - else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) - { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg) - if( aSymbolSize.Width() != aSymbolSize.Height() ) - { - aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); - aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); - aSymbolSize = aSize; - } - } - aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize); - } - else - { - aSymbolGraphic=Graphic(); - aCtlPreview.SetSymbol(NULL,aSymbolSize); - bEnable=sal_False; - } - aSymbolLastSize=aSymbolSize; - SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit); - SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit); - aSymbolRatioCB.Enable(bEnable); - aSymbolHeightFT.Enable(bEnable); - aSymbolWidthFT.Enable(bEnable); - aSymbolWidthMF.Enable(bEnable); - aSymbolHeightMF.Enable(bEnable); - aCtlPreview.Invalidate(); - - return 0; -} -IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField) -{ - bNewSize=true; - sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF); - bLastWidthModified = bWidth; - sal_Bool bRatio = aSymbolRatioCB.IsChecked(); - long nWidthVal = static_cast(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM))); - long nHeightVal= static_cast(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM))); - nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit ); - nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit); - aSymbolSize=Size(nWidthVal,nHeightVal); - double fSizeRatio = (double)1; - - if(bRatio) - { - if (aSymbolLastSize.Height() && aSymbolLastSize.Width()) - fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height(); - } - - //Size aSymbolSize(aSymbolLastSize); - - if(bWidth) - { - long nDelta = nWidthVal - aSymbolLastSize.Width(); - aSymbolSize.Width() = nWidthVal; - if (bRatio) - { - aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio); - aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM ); - aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM); - } - } - else - { - long nDelta = nHeightVal - aSymbolLastSize.Height(); - aSymbolSize.Height() = nHeightVal; - if (bRatio) - { - aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio); - aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(), - (MapUnit)ePoolUnit, MAP_100TH_MM ); - aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM); - } - } - aCtlPreview.ResizeSymbol(aSymbolSize); - aSymbolLastSize=aSymbolSize; - return 0; -} -IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox ) -{ - if (pBox->IsChecked()) - { - if (bLastWidthModified) - SizeHdl_Impl(&aSymbolWidthMF); - else - SizeHdl_Impl(&aSymbolHeightMF); - } - return 0; -} - - -void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SvxTabPage::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - FillListboxes(); - } -} - -void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); - SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False); - SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False); - - if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); - if (pDashListItem) - SetDashList(pDashListItem->GetDashList()); - if (pLineEndListItem) - SetLineEndList(pLineEndListItem->GetLineEndList()); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if (pDlgTypeItem) - SetDlgType(pDlgTypeItem->GetValue()); - Construct(); - - if(pSdrObjListItem) //symbols - { - ShowSymbolControls(sal_True); - pSymbolList = static_cast(pSdrObjListItem->GetValue()); - if (pSymbolAttrItem) - pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet()); - if(pGraphicItem) - aAutoSymbolGraphic = pGraphicItem->GetGraphic(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx deleted file mode 100644 index bfa75eac1..000000000 --- a/cui/source/tabpages/tplnedef.cxx +++ /dev/null @@ -1,959 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#define _SVX_TPLNEDEF_CXX - -#include -#include "tabline.hrc" -#include "helpid.hrc" - -#include "svx/xattr.hxx" -#include -#include - -#include "svx/drawitem.hxx" -#include "cuitabline.hxx" -#include "defdlgname.hxx" -#include -#include -#include "svx/dlgutil.hxx" -#include -#include - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 -#define XOUT_WIDTH 150 - -/************************************************************************* -|* -|* Dialog zum Definieren von Linienstilen -|* -\************************************************************************/ - -SvxLineDefTabPage::SvxLineDefTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_LINE_DEF ), rInAttrs ), - - aFlDefinition ( this, CUI_RES( FL_DEFINITION ) ), - aFTLinestyle ( this, CUI_RES( FT_LINESTYLE ) ), - aLbLineStyles ( this, CUI_RES( LB_LINESTYLES ) ), - aFtType ( this, CUI_RES( FT_TYPE ) ), - aLbType1 ( this, CUI_RES( LB_TYPE_1 ) ), - aLbType2 ( this, CUI_RES( LB_TYPE_2 ) ), - aFtNumber ( this, CUI_RES( FT_NUMBER ) ), - aNumFldNumber1 ( this, CUI_RES( NUM_FLD_1 ) ), - aNumFldNumber2 ( this, CUI_RES( NUM_FLD_2 ) ), - aFtLength ( this, CUI_RES( FT_LENGTH ) ), - aMtrLength1 ( this, CUI_RES( MTR_FLD_LENGTH_1 ) ), - aMtrLength2 ( this, CUI_RES( MTR_FLD_LENGTH_2 ) ), - aFtDistance ( this, CUI_RES( FT_DISTANCE ) ), - aMtrDistance ( this, CUI_RES( MTR_FLD_DISTANCE ) ), - aCbxSynchronize ( this, CUI_RES( CBX_SYNCHRONIZE ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - - rOutAttrs ( rInAttrs ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXLStyle ( XLINE_DASH ), - aXWidth ( XOUT_WIDTH ), - aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ), - aXColor ( String(), COL_BLACK ), - aXLineAttr ( pXPool ), - rXLSet ( aXLineAttr.GetItemSet() ) -{ - aLbType1.SetAccessibleName(String(CUI_RES( STR_START_TYPE ) ) ); - aLbType2.SetAccessibleName(String(CUI_RES( STR_END_TYPE ) ) ); - aNumFldNumber1.SetAccessibleName(String(CUI_RES( STR_START_NUM ) ) ); - aNumFldNumber2.SetAccessibleName(String(CUI_RES( STR_END_NUM ) ) ); - aMtrLength1.SetAccessibleName(String(CUI_RES( STR_START_LENGTH ) ) ); - aMtrLength2.SetAccessibleName(String(CUI_RES( STR_END_LENGTH ) ) ); - - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Metrik einstellen - eFUnit = GetModuleFieldUnit( rInAttrs ); - - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ; //prevent warning - } - SetFieldUnit( aMtrDistance, eFUnit ); - SetFieldUnit( aMtrLength1, eFUnit ); - SetFieldUnit( aMtrLength2, eFUnit ); - - // PoolUnit ermitteln - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH ); - - rXLSet.Put( aXLStyle ); - rXLSet.Put( aXWidth ); - rXLSet.Put( aXDash ); - rXLSet.Put( aXColor ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - aBtnAdd.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickAddHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxLineDefTabPage, ClickModifyHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxLineDefTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickSaveHdl_Impl ) ); - - aNumFldNumber1.SetModifyHdl( - LINK( this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl ) ); - aNumFldNumber2.SetModifyHdl( - LINK( this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl ) ); - aLbLineStyles.SetSelectHdl( - LINK( this, SvxLineDefTabPage, SelectLinestyleHdl_Impl ) ); - - // Absolut (in mm) oder Relativ (in %) - aCbxSynchronize.SetClickHdl( - LINK( this, SvxLineDefTabPage, ChangeMetricHdl_Impl ) ); - - // Wenn sich etwas aendert, muss Preview upgedatet werden werden - Link aLink = LINK( this, SvxLineDefTabPage, SelectTypeHdl_Impl ); - aLbType1.SetSelectHdl( aLink ); - aLbType2.SetSelectHdl( aLink ); - aLink = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl ); - aMtrLength1.SetModifyHdl( aLink ); - aMtrLength2.SetModifyHdl( aLink ); - aMtrDistance.SetModifyHdl( aLink ); - - pDashList = NULL; - - aBtnAdd.SetAccessibleRelationMemberOf( &aFlDefinition ); - aBtnModify.SetAccessibleRelationMemberOf( &aFlDefinition ); - aBtnDelete.SetAccessibleRelationMemberOf( &aFlDefinition ); - aBtnLoad.SetAccessibleRelationMemberOf( &aFlDefinition ); - aBtnSave.SetAccessibleRelationMemberOf( &aFlDefinition ); -} - - -// ----------------------------------------------------------------------- - -void SvxLineDefTabPage::Construct() -{ - // Linienstile - aLbLineStyles.Fill( pDashList ); -} - -// ----------------------------------------------------------------------- - -void SvxLineDefTabPage::ActivatePage( const SfxItemSet& ) -{ - if( *pDlgType == 0 ) // Flaechen-Dialog - { - // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! - if( pDashList ) - { - if( *pPageType == 1 && - *pPosDashLb != LISTBOX_ENTRY_NOTFOUND ) - { - aLbLineStyles.SelectEntryPos( *pPosDashLb ); - } - // Damit evtl. vorhandener Linestyle verworfen wird - SelectLinestyleHdl_Impl( this ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pDashList->GetPath() ); - - aURL.Append( pDashList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - *pPageType = 0; // 2 - *pPosDashLb = LISTBOX_ENTRY_NOTFOUND; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxLineDefTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - CheckChanges_Impl(); - - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -void SvxLineDefTabPage::CheckChanges_Impl() -{ - // wird hier benutzt, um Aenderungen NICHT zu verlieren - //XDashStyle eXDS; - - if( aNumFldNumber1.GetText() != aNumFldNumber1.GetSavedValue() || - aMtrLength1.GetText() != aMtrLength1.GetSavedValue() || - aLbType1.GetSelectEntryPos() != aLbType1.GetSavedValue() || - aNumFldNumber2.GetText() != aNumFldNumber2.GetSavedValue() || - aMtrLength2.GetText() != aMtrLength2.GetSavedValue() || - aLbType2.GetSelectEntryPos() != aLbType2.GetSavedValue() || - aMtrDistance.GetText() != aMtrDistance.GetSavedValue() ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( DLGWIN, RID_SVXDLG_MESSBOX, - SVX_RESSTR( RID_SVXSTR_LINESTYLE ), - String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ), - &aWarningBoxImage ); - DBG_ASSERT(aMessDlg, "Dialogdiet fail!"); - aMessDlg->SetButtonText( MESS_BTN_1, - String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) ); - aMessDlg->SetButtonText( MESS_BTN_2, - String( ResId( RID_SVXSTR_ADD, rMgr ) ) ); - - short nRet = aMessDlg->Execute(); - - switch( nRet ) - { - case RET_BTN_1: // Aendern - { - ClickModifyHdl_Impl( this ); - } - break; - - case RET_BTN_2: // Hinzufuegen - { - ClickAddHdl_Impl( this ); - } - break; - - case RET_CANCEL: - break; - } - delete aMessDlg; - } - - - - sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - *pPosDashLb = nPos; - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxLineDefTabPage::FillItemSet( SfxItemSet& rAttrs ) -{ - if( *pDlgType == 0 ) // Linien-Dialog - { - if( *pPageType == 2 ) - { - FillDash_Impl(); - - String aString( aLbLineStyles.GetSelectEntry() ); - rAttrs.Put( XLineStyleItem( XLINE_DASH ) ); - rAttrs.Put( XLineDashItem( aString, aDash ) ); - } - } - return( sal_True ); -} - -// ----------------------------------------------------------------------- - -void SvxLineDefTabPage::Reset( const SfxItemSet& rAttrs ) -{ - if( rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SFX_ITEM_DONTCARE ) - { - XLineStyle eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( GetWhich( XATTR_LINESTYLE ) ) ).GetValue(); - - switch( eXLS ) - { - case XLINE_NONE: - case XLINE_SOLID: - aLbLineStyles.SelectEntryPos( 0 ); - break; - - case XLINE_DASH: - { - const XLineDashItem& rDashItem = ( const XLineDashItem& ) rAttrs.Get( XATTR_LINEDASH ); - aDash = rDashItem.GetDashValue(); - - aLbLineStyles.SetNoSelection(); - aLbLineStyles.SelectEntry( rDashItem.GetName() ); - } - break; - - default: - break; - } - } - SelectLinestyleHdl_Impl( NULL ); - - // Status der Buttons ermitteln - if( pDashList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxLineDefTabPage::Create( Window* pWindow, - const SfxItemSet& rOutAttrs ) -{ - return( new SvxLineDefTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, SelectLinestyleHdl_Impl, void *, p ) -{ - if( pDashList->Count() > 0 ) - { - int nTmp = aLbLineStyles.GetSelectEntryPos(); - if( nTmp == LISTBOX_ENTRY_NOTFOUND ) - { - } - else - aDash = pDashList->GetDash( nTmp )->GetDash(); - - FillDialog_Impl(); - - rXLSet.Put( XLineDashItem( String(), aDash ) ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - aCtlPreview.Invalidate(); - - // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen, - // wenn in der ListBox ein Eintrag ausgewaehlt wurde - // Wenn ueber Reset() gerufen wurde ist p == NULL - if( p ) - *pPageType = 2; - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK_INLINE_START( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG ) -{ - FillDash_Impl(); - aCtlPreview.Invalidate(); - - return( 0L ); -} -IMPL_LINK_INLINE_END( SvxLineDefTabPage, ChangePreviewHdl_Impl, void *, EMPTYARG ) - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ChangeNumber1Hdl_Impl, void *, EMPTYARG ) -{ - if( aNumFldNumber1.GetValue() == 0L ) - { - aNumFldNumber2.SetMin( 1L ); - aNumFldNumber2.SetFirst( 1L ); - } - else - { - aNumFldNumber2.SetMin( 0L ); - aNumFldNumber2.SetFirst( 0L ); - } - - ChangePreviewHdl_Impl( this ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ChangeNumber2Hdl_Impl, void *, EMPTYARG ) -{ - if( aNumFldNumber2.GetValue() == 0L ) - { - aNumFldNumber1.SetMin( 1L ); - aNumFldNumber1.SetFirst( 1L ); - } - else - { - aNumFldNumber1.SetMin( 0L ); - aNumFldNumber1.SetFirst( 0L ); - } - - ChangePreviewHdl_Impl( this ); - - return( 0L ); -} - - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, void *, p ) -{ - if( !aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != eFUnit ) - { - long nTmp1, nTmp2, nTmp3; - - // Wurde ueber Control geaendert - if( p ) - { - nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100; - nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100; - nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100; - } - else - { - nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ); - nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ); - nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ); - } - aMtrLength1.SetDecimalDigits( 2 ); - aMtrLength2.SetDecimalDigits( 2 ); - aMtrDistance.SetDecimalDigits( 2 ); - - // Metrik einstellen - aMtrLength1.SetUnit( eFUnit ); - aMtrLength2.SetUnit( eFUnit ); - aMtrDistance.SetUnit( eFUnit ); - - SetMetricValue( aMtrLength1, nTmp1, ePoolUnit ); - SetMetricValue( aMtrLength2, nTmp2, ePoolUnit ); - SetMetricValue( aMtrDistance, nTmp3, ePoolUnit ); - } - else if( aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != FUNIT_CUSTOM ) - { - long nTmp1, nTmp2, nTmp3; - - // Wurde ueber Control geaendert - if( p ) - { - nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH; - nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH; - nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH; - } - else - { - nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ); - nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ); - nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ); - } - - aMtrLength1.SetDecimalDigits( 0 ); - aMtrLength2.SetDecimalDigits( 0 ); - aMtrDistance.SetDecimalDigits( 0 ); - - aMtrLength1.SetUnit( FUNIT_CUSTOM ); - aMtrLength2.SetUnit( FUNIT_CUSTOM ); - aMtrDistance.SetUnit( FUNIT_CUSTOM ); - - - SetMetricValue( aMtrLength1, nTmp1, ePoolUnit ); - SetMetricValue( aMtrLength2, nTmp2, ePoolUnit ); - SetMetricValue( aMtrDistance, nTmp3, ePoolUnit ); - } - SelectTypeHdl_Impl( NULL ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, SelectTypeHdl_Impl, void *, p ) -{ - if ( p == &aLbType1 || !p ) - { - if ( aLbType1.GetSelectEntryPos() == 0 ) - { - aMtrLength1.Disable(); - aMtrLength1.SetText( String() ); - } - else if ( !aMtrLength1.IsEnabled() ) - { - aMtrLength1.Enable(); - aMtrLength1.Reformat(); - } - } - - if ( p == &aLbType2 || !p ) - { - if ( aLbType2.GetSelectEntryPos() == 0 ) - { - aMtrLength2.Disable(); - aMtrLength2.SetText( String() ); - } - else if ( !aMtrLength2.IsEnabled() ) - { - aMtrLength2.Enable(); - aMtrLength2.Reformat(); - } - } - ChangePreviewHdl_Impl( p ); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_LINESTYLE ) ); - String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) ); - String aName; - XDashEntry* pEntry; - - long nCount = pDashList->Count(); - long j = 1; - sal_Bool bDifferent = sal_False; - - while ( !bDifferent ) - { - aName = aNewName; - aName += sal_Unicode(' '); - aName += UniString::CreateFromInt32( j++ ); - bDifferent = sal_True; - - for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pDashList->GetDash( i )->GetName() ) - bDifferent = sal_False; - } - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - sal_Bool bLoop = sal_True; - - while ( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pDashList->GetDash( i )->GetName() ) - bDifferent = sal_False; - } - - if( bDifferent ) - { - bLoop = sal_False; - FillDash_Impl(); - - pEntry = new XDashEntry( aDash, aName ); - - long nDashCount = pDashList->Count(); - pDashList->Insert( pEntry, nDashCount ); - Bitmap* pBitmap = pDashList->GetBitmap( nDashCount ); - aLbLineStyles.Append( pEntry, pBitmap ); - - aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 ); - - // Flag fuer modifiziert setzen - *pnDashListState |= CT_MODIFIED; - - *pPageType = 2; - - // Werte sichern fuer Changes-Erkennung ( -> Methode ) - aNumFldNumber1.SaveValue(); - aMtrLength1.SaveValue(); - aLbType1.SaveValue(); - aNumFldNumber2.SaveValue(); - aMtrLength2.SaveValue(); - aLbType2.SaveValue(); - aMtrDistance.SaveValue(); - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - } - delete( pDlg ); - - // Status der Buttons ermitteln - if ( pDashList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_LINESTYLE ) ); - String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) ); - String aName( pDashList->GetDash( nPos )->GetName() ); - String aOldName = aName; - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - - long nCount = pDashList->Count(); - sal_Bool bDifferent = sal_False; - sal_Bool bLoop = sal_True; - - while ( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pDashList->GetDash( i )->GetName() && - aName != aOldName ) - bDifferent = sal_False; - } - - if ( bDifferent ) - { - bLoop = sal_False; - FillDash_Impl(); - - XDashEntry* pEntry = new XDashEntry( aDash, aName ); - - delete pDashList->Replace( pEntry, nPos ); - Bitmap* pBitmap = pDashList->GetBitmap( nPos ); - aLbLineStyles.Modify( pEntry, nPos, pBitmap ); - - aLbLineStyles.SelectEntryPos( nPos ); - - // Flag fuer modifiziert setzen - *pnDashListState |= CT_MODIFIED; - - *pPageType = 2; - - // Werte sichern fuer Changes-Erkennung ( -> Methode ) - aNumFldNumber1.SaveValue(); - aMtrLength1.SaveValue(); - aLbType1.SaveValue(); - aNumFldNumber2.SaveValue(); - aMtrLength2.SaveValue(); - aLbType2.SaveValue(); - aMtrDistance.SaveValue(); - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - } - delete( pDlg ); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_LINESTYLE ) ) ); - - if ( aQueryBox.Execute() == RET_YES ) - { - delete pDashList->Remove( nPos ); - aLbLineStyles.RemoveEntry( nPos ); - aLbLineStyles.SelectEntryPos( 0 ); - - SelectLinestyleHdl_Impl( this ); - *pPageType = 0; // Style soll nicht uebernommen werden - - // Flag fuer modifiziert setzen - *pnDashListState |= CT_MODIFIED; - - ChangePreviewHdl_Impl( this ); - } - } - - // Status der Buttons ermitteln - if ( !pDashList->Count() ) - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLineDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *pnDashListState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pDashList->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Liste speichern - XDashList* pDshLst = new XDashList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pDshLst->SetName( aURL.getName() ); - - if( pDshLst->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - if( pDashList != ( (SvxLineTabDialog*) DLGWIN )->GetDashList() ) - delete pDashList; - - pDashList = pDshLst; - ( (SvxLineTabDialog*) DLGWIN )->SetNewDashList( pDashList ); - - aLbLineStyles.Clear(); - aLbLineStyles.Fill( pDashList ); - Reset( rOutAttrs ); - - pDashList->SetName( aURL.getName() ); - - // Flag fuer gewechselt setzen - *pnDashListState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnDashListState &= ~CT_MODIFIED; - } - else - //aIStream.Close(); - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - } - - // Status der Buttons ermitteln - if ( pDashList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxLineDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pDashList->GetName().Len() ) - { - aFile.Append( pDashList->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "sod" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pDashList->SetName( aURL.getName() ); - pDashList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pDashList->Save() ) - { - // Flag fuer gespeichert setzen - *pnDashListState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnDashListState &= ~CT_MODIFIED; - } - else - { - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); - } - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxLineDefTabPage::FillDash_Impl() -{ - XDashStyle eXDS; - - if( aCbxSynchronize.IsChecked() ) - eXDS = XDASH_RECTRELATIVE; - else - eXDS = XDASH_RECT; - - aDash.SetDashStyle( eXDS ); - aDash.SetDots( (sal_uInt8) aNumFldNumber1.GetValue() ); - aDash.SetDotLen( aLbType1.GetSelectEntryPos() == 0 ? 0 : - GetCoreValue( aMtrLength1, ePoolUnit ) ); - aDash.SetDashes( (sal_uInt8) aNumFldNumber2.GetValue() ); - aDash.SetDashLen( aLbType2.GetSelectEntryPos() == 0 ? 0 : - GetCoreValue( aMtrLength2, ePoolUnit ) ); - aDash.SetDistance( GetCoreValue( aMtrDistance, ePoolUnit ) ); - - rXLSet.Put( XLineDashItem( String(), aDash ) ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); -} - -//------------------------------------------------------------------------ - -void SvxLineDefTabPage::FillDialog_Impl() -{ - XDashStyle eXDS = aDash.GetDashStyle(); // XDASH_RECT, XDASH_ROUND - if( eXDS == XDASH_RECTRELATIVE ) - aCbxSynchronize.Check(); - else - aCbxSynchronize.Check( sal_False ); - - aNumFldNumber1.SetValue( aDash.GetDots() ); - SetMetricValue( aMtrLength1, aDash.GetDotLen(), ePoolUnit ); - aLbType1.SelectEntryPos( aDash.GetDotLen() == 0 ? 0 : 1 ); - aNumFldNumber2.SetValue( aDash.GetDashes() ); - SetMetricValue( aMtrLength2, aDash.GetDashLen(), ePoolUnit ); - aLbType2.SelectEntryPos( aDash.GetDashLen() == 0 ? 0 : 1 ); - SetMetricValue( aMtrDistance, aDash.GetDistance(), ePoolUnit ); - - ChangeMetricHdl_Impl( NULL ); - - // Werte sichern fuer Changes-Erkennung ( -> Methode ) - aNumFldNumber1.SaveValue(); - aMtrLength1.SaveValue(); - aLbType1.SaveValue(); - aNumFldNumber2.SaveValue(); - aMtrLength2.SaveValue(); - aLbType2.SaveValue(); - aMtrDistance.SaveValue(); -} - - -void SvxLineDefTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxTabPage::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - sal_uInt16 nOldSelect = aLbLineStyles.GetSelectEntryPos(); - aLbLineStyles.Clear(); - aLbLineStyles.Fill( pDashList ); - aLbLineStyles.SelectEntryPos( nOldSelect ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx deleted file mode 100644 index afb15156c..000000000 --- a/cui/source/tabpages/tplneend.cxx +++ /dev/null @@ -1,701 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" - -#define _SVX_TPLNEEND_CXX - -#include -#include "tabline.hrc" -#include "helpid.hrc" -#include -#include -#include -#include "svx/drawitem.hxx" -#include -#include -#include "cuitabline.hxx" -#include -#include -#include "svx/dlgutil.hxx" -#include -#include -#include -#include -#include -#include -#include - -#define DLGWIN this->GetParent()->GetParent() - -#define BITMAP_WIDTH 32 -#define BITMAP_HEIGHT 12 -#define XOUT_WIDTH 150 - -/************************************************************************* -|* -|* Dialog zum Definieren von Linienenden-Stilen -|* -\************************************************************************/ - -SvxLineEndDefTabPage::SvxLineEndDefTabPage -( - Window* pParent, - const SfxItemSet& rInAttrs -) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_LINEEND_DEF ), rInAttrs ), - - aFlTip ( this, CUI_RES( FL_TIP ) ), - aFTTitle ( this, CUI_RES( FT_TITLE ) ), - aEdtName ( this, CUI_RES( EDT_NAME ) ), - aFTLineEndStyle ( this, CUI_RES( FT_LINE_END_STYLE ) ), - aLbLineEnds ( this, CUI_RES( LB_LINEENDS ) ), - aBtnAdd ( this, CUI_RES( BTN_ADD ) ), - aBtnModify ( this, CUI_RES( BTN_MODIFY ) ), - aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), - aBtnLoad ( this, CUI_RES( BTN_LOAD ) ), - aBtnSave ( this, CUI_RES( BTN_SAVE ) ), - aFiTip ( this, CUI_RES( FI_TIP ) ), - aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ), - - rOutAttrs ( rInAttrs ), - pPolyObj( NULL ), - - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXLStyle ( XLINE_SOLID ), - aXWidth ( XOUT_WIDTH ), - aXColor ( String(), COL_BLACK ), - aXLineAttr ( pXPool ), - rXLSet ( aXLineAttr.GetItemSet() ), - pLineEndList( NULL ) -{ - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - rXLSet.Put( aXLStyle ); - rXLSet.Put( aXWidth ); - rXLSet.Put( aXColor ); - rXLSet.Put( XLineStartWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) ); - rXLSet.Put( XLineEndWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - aBtnAdd.SetClickHdl( - LINK( this, SvxLineEndDefTabPage, ClickAddHdl_Impl ) ); - aBtnModify.SetClickHdl( - LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl ) ); - aBtnDelete.SetClickHdl( - LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( - LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( - LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl ) ); - - aLbLineEnds.SetSelectHdl( - LINK( this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl ) ); - - aBtnAdd.SetAccessibleRelationMemberOf(&aFlTip); - aBtnModify.SetAccessibleRelationMemberOf(&aFlTip); - aBtnDelete.SetAccessibleRelationMemberOf(&aFlTip); -} - -//------------------------------------------------------------------------ - -SvxLineEndDefTabPage::~SvxLineEndDefTabPage() -{ -} - -// ----------------------------------------------------------------------- - -void SvxLineEndDefTabPage::Construct() -{ - aLbLineEnds.Fill( pLineEndList ); - - bool bCreateArrowPossible = true; - - if( !pPolyObj ) - { - bCreateArrowPossible = false; - } - else if( !pPolyObj->ISA( SdrPathObj ) ) - { - SdrObjTransformInfoRec aInfoRec; - pPolyObj->TakeObjInfo( aInfoRec ); - SdrObject* pNewObj = 0; - if( aInfoRec.bCanConvToPath ) - pNewObj = pPolyObj->ConvertToPolyObj( sal_True, sal_False ); - - bCreateArrowPossible = pNewObj && pNewObj->ISA( SdrPathObj ); - SdrObject::Free( pNewObj ); - } - - if( !bCreateArrowPossible ) - aBtnAdd.Disable(); -} - -// ----------------------------------------------------------------------- - -void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& ) -{ - if( *pDlgType == 0 ) // Flaechen-Dialog - { - // ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!! - if( pLineEndList ) - { - if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND ) - { - aLbLineEnds.SelectEntryPos( *pPosLineEndLb ); - SelectLineEndHdl_Impl( this ); - } - INetURLObject aURL( pLineEndList->GetPath() ); - - aURL.Append( pLineEndList->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - *pPageType = 0; // 3 - *pPosLineEndLb = LISTBOX_ENTRY_NOTFOUND; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxLineEndDefTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - CheckChanges_Impl(); - - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -void SvxLineEndDefTabPage::CheckChanges_Impl() -{ - sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - String aString = aEdtName.GetText(); - - if( aString != aLbLineEnds.GetSelectEntry() ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_LINEEND ) ); - - if ( aQueryBox.Execute() == RET_YES ) - ClickModifyHdl_Impl( this ); - } - } - nPos = aLbLineEnds.GetSelectEntryPos(); - - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - *pPosLineEndLb = nPos; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxLineEndDefTabPage::FillItemSet( SfxItemSet& rSet ) -{ - if( *pDlgType == 0 ) // Linien-Dialog - { - if( *pPageType == 3 ) - { - CheckChanges_Impl(); - - long nPos = aLbLineEnds.GetSelectEntryPos(); - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); - - rSet.Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) ); - rSet.Put( XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() ) ); - } - } - return( sal_True ); -} - -// ----------------------------------------------------------------------- - -void SvxLineEndDefTabPage::Reset( const SfxItemSet& ) -{ - aLbLineEnds.SelectEntryPos( 0 ); - - // Update lineend - if( pLineEndList->Count() > 0 ) - { - int nPos = aLbLineEnds.GetSelectEntryPos(); - - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); - - aEdtName.SetText( aLbLineEnds.GetSelectEntry() ); - - rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) ); - rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - aCtlPreview.Invalidate(); - } - - // Status der Buttons ermitteln - if( pLineEndList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxLineEndDefTabPage::Create( Window* pWindow, - const SfxItemSet& rSet ) -{ - return( new SvxLineEndDefTabPage( pWindow, rSet ) ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, SelectLineEndHdl_Impl, void *, EMPTYARG ) -{ - if( pLineEndList->Count() > 0 ) - { - int nPos = aLbLineEnds.GetSelectEntryPos(); - - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); - - aEdtName.SetText( aLbLineEnds.GetSelectEntry() ); - - rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) ); - rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) ); - - // #i34740# - aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet()); - - aCtlPreview.Invalidate(); - - // Wird erst hier gesetzt, um den Style nur dann zu uebernehmen, - // wenn in der ListBox ein Eintrag ausgewaehlt wurde - *pPageType = 3; - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -long SvxLineEndDefTabPage::ChangePreviewHdl_Impl( void* ) -{ - aCtlPreview.Invalidate(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) ); - String aName( aEdtName.GetText() ); - long nCount = pLineEndList->Count(); - sal_Bool bDifferent = sal_True; - - // Pruefen, ob Name schon vorhanden ist - for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pLineEndList->GetLineEnd( i )->GetName() ) - bDifferent = sal_False; - - // Wenn ja, wird wiederholt ein neuer Name angefordert - if ( !bDifferent ) - { - WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aWarningBox.Execute(); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - sal_Bool bLoop = sal_True; - - while( !bDifferent && bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pLineEndList->GetLineEnd( i )->GetName() ) - bDifferent = sal_False; - } - - if( bDifferent ) - bLoop = sal_False; - else - aWarningBox.Execute(); - } - delete( pDlg ); - } - - // Wenn nicht vorhanden, wird Eintrag aufgenommen - if( bDifferent ) - { - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos ); - - pEntry->SetName( aName ); - aEdtName.SetText( aName ); - - aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) ); - aLbLineEnds.SelectEntryPos( nPos ); - - // Flag fuer modifiziert setzen - *pnLineEndListState |= CT_MODIFIED; - - *pPageType = 3; - } - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) -{ - if( pPolyObj ) - { - const SdrObject* pNewObj; - SdrObject* pConvPolyObj = NULL; - - if( pPolyObj->ISA( SdrPathObj ) ) - { - pNewObj = pPolyObj; - } - else - { - SdrObjTransformInfoRec aInfoRec; - pPolyObj->TakeObjInfo( aInfoRec ); - - if( aInfoRec.bCanConvToPath ) - { - pNewObj = pConvPolyObj = pPolyObj->ConvertToPolyObj( sal_True, sal_False ); - - if( !pNewObj || !pNewObj->ISA( SdrPathObj ) ) - return( 0L ); // Abbruch, zusaetzliche Sicherheit, die bei - // Gruppenobjekten aber nichts bringt. - } - else return( 0L ); // Abbruch - } - - basegfx::B2DPolyPolygon aNewPolyPolygon(((SdrPathObj*)pNewObj)->GetPathPoly()); - basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon)); - - // Normalisieren - aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix( - -aNewRange.getMinX(), -aNewRange.getMinY())); - - // Loeschen des angelegten PolyObjektes - SdrObject::Free( pConvPolyObj ); - - XLineEndEntry* pEntry; - - ResMgr& rMgr = CUI_MGR(); - String aNewName( SVX_RES( RID_SVXSTR_LINEEND ) ); - String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) ); - String aName; - - long nCount = pLineEndList->Count(); - long j = 1; - sal_Bool bDifferent = sal_False; - - while ( !bDifferent ) - { - aName = aNewName; - aName += sal_Unicode(' '); - aName += UniString::CreateFromInt32( j++ ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pLineEndList->GetLineEnd( i )->GetName() ) - bDifferent = sal_False; - } - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - sal_Bool bLoop = sal_True; - - while ( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - bDifferent = sal_True; - - for( long i = 0; i < nCount && bDifferent; i++ ) - { - if( aName == pLineEndList->GetLineEnd( i )->GetName() ) - bDifferent = sal_False; - } - - if( bDifferent ) - { - bLoop = sal_False; - pEntry = new XLineEndEntry( aNewPolyPolygon, aName ); - - long nLineEndCount = pLineEndList->Count(); - pLineEndList->Insert( pEntry, nLineEndCount ); - Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount ); - - // Zur ListBox hinzufuegen - aLbLineEnds.Append( pEntry, pBitmap ); - aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 ); - - // Flag fuer modifiziert setzen - *pnLineEndListState |= CT_MODIFIED; - - SelectLineEndHdl_Impl( this ); - } - else - { - WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) ); - aBox.SetHelpId( HID_WARN_NAME_DUPLICATE ); - aBox.Execute(); - } - } - delete pDlg; - } - else - aBtnAdd.Disable(); - - // Status der Buttons ermitteln - if ( pLineEndList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ), - String( CUI_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) ); - - if ( aQueryBox.Execute() == RET_YES ) - { - delete pLineEndList->Remove( nPos ); - aLbLineEnds.RemoveEntry( nPos ); - aLbLineEnds.SelectEntryPos( 0 ); - - SelectLineEndHdl_Impl( this ); - *pPageType = 0; // LineEnd soll nicht uebernommen werden - - // Flag fuer modifiziert setzen - *pnLineEndListState |= CT_MODIFIED; - - ChangePreviewHdl_Impl( this ); - } - } - // Status der Buttons ermitteln - if( !pLineEndList->Count() ) - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if ( *pnLineEndListState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pLineEndList->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Liste speichern - XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); - pLeList->SetName( aURL.getName() ); - if( pLeList->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() ) - delete pLineEndList; - - pLineEndList = pLeList; - ( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList ); - aLbLineEnds.Clear(); - aLbLineEnds.Fill( pLineEndList ); - Reset( rOutAttrs ); - - pLineEndList->SetName( aURL.getName() ); - - // Flag fuer gewechselt setzen - *pnLineEndListState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnLineEndListState &= ~CT_MODIFIED; - } - else - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute(); - } - } - - // Status der Buttons ermitteln - if ( pLineEndList->Count() ) - { - aBtnModify.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pLineEndList->GetName().Len() ) - { - aFile.Append( pLineEndList->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soe" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pLineEndList->SetName( aURL.getName() ); - pLineEndList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pLineEndList->Save() ) - { - // Flag fuer gespeichert setzen - *pnLineEndListState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnLineEndListState &= ~CT_MODIFIED; - } - else - { - ErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute(); - } - } - return( 0L ); -} - -void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt ) -{ - SfxTabPage::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - sal_uInt16 nOldSelect = aLbLineEnds.GetSelectEntryPos(); - aLbLineEnds.Clear(); - aLbLineEnds.Fill( pLineEndList ); - aLbLineEnds.SelectEntryPos( nOldSelect ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx deleted file mode 100644 index aa01b6933..000000000 --- a/cui/source/tabpages/tpshadow.cxx +++ /dev/null @@ -1,612 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- -#include -#include -#include -#include - -#define _SVX_TPSHADOW_CXX - -#include "svx/xattr.hxx" -#include -#include -#include "tabarea.hrc" -#include -#include "svx/drawitem.hxx" -#include "cuitabarea.hxx" -#include -#include "svx/dlgutil.hxx" -#include -#include "paragrph.hrc" -#include -#include - -#define DLGWIN this->GetParent()->GetParent() - -// static ---------------------------------------------------------------- - -static sal_uInt16 pShadowRanges[] = -{ - SDRATTR_SHADOWCOLOR, - SDRATTR_SHADOWTRANSPARENCE, - SID_ATTR_FILL_SHADOW, - SID_ATTR_FILL_SHADOW, - 0 -}; - -/************************************************************************* -|* -|* Dialog zum Aendern des Schattens -|* -\************************************************************************/ - -SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_SHADOW ), rInAttrs ), - - aFlProp ( this, CUI_RES( FL_PROP ) ), - aTsbShowShadow ( this, CUI_RES( TSB_SHOW_SHADOW ) ), - aFtPosition ( this, CUI_RES( FT_POSITION ) ), - aCtlPosition ( this, CUI_RES( CTL_POSITION ) ), - aFtDistance ( this, CUI_RES( FT_DISTANCE ) ), - aMtrDistance ( this, CUI_RES( MTR_FLD_DISTANCE ) ), - aFtShadowColor ( this, CUI_RES( FT_SHADOW_COLOR ) ), - aLbShadowColor ( this, CUI_RES( LB_SHADOW_COLOR ) ), - aFtTransparent ( this, CUI_RES( FT_TRANSPARENT ) ), - aMtrTransparent ( this, CUI_RES( MTR_SHADOW_TRANSPARENT ) ), - aCtlXRectPreview ( this, CUI_RES( CTL_COLOR_PREVIEW ) ), - rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - bDisable ( sal_False ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), - aXFillAttr ( pXPool ), - rXFSet ( aXFillAttr.GetItemSet() ) -{ - FreeResource(); - - // diese Page braucht ExchangeSupport - SetExchangeSupport(); - - // Metrik einstellen - FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs ); - - switch ( eFUnit ) - { - case FUNIT_M: - case FUNIT_KM: - eFUnit = FUNIT_MM; - break; - default: ;//prevent warning - } - SetFieldUnit( aMtrDistance, eFUnit ); - - // PoolUnit ermitteln - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "Wo ist der Pool?" ); - ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST ); - - // Setzen des Output-Devices - XFillStyle eXFS = XFILL_SOLID; - if( rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) - { - eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rOutAttrs. - Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() ); - switch( eXFS ) - { - //case XFILL_NONE: --> NICHTS - - case XFILL_SOLID: - if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLCOLOR ) ) - { - XFillColorItem aColorItem( ( const XFillColorItem& ) - rOutAttrs.Get( XATTR_FILLCOLOR ) ); - rXFSet.Put( aColorItem ); - } - break; - - case XFILL_GRADIENT: - if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) ) - { - XFillGradientItem aGradientItem( ( ( const XFillGradientItem& ) - rOutAttrs.Get( XATTR_FILLGRADIENT ) ) ); - rXFSet.Put( aGradientItem ); - } - break; - - case XFILL_HATCH: - if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLHATCH ) ) - { - XFillHatchItem aHatchItem( ( ( const XFillHatchItem& ) - rOutAttrs.Get( XATTR_FILLHATCH ) ) ); - rXFSet.Put( aHatchItem ); - } - break; - - case XFILL_BITMAP: - { - if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLBITMAP ) ) - { - XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& ) - rOutAttrs.Get( XATTR_FILLBITMAP ) ); - rXFSet.Put( aBitmapItem ); - } - } - break; - case XFILL_NONE : break; - } - } - else - { - rXFSet.Put( XFillColorItem( String(), COL_LIGHTRED ) ); - } - - if(XFILL_NONE == eXFS) - { - // #i96350# - // fallback to solid fillmode when no fill mode is provided to have - // a reasonable shadow preview. The used color will be a set one or - // the default (currently blue8) - eXFS = XFILL_SOLID; - } - - rXFSet.Put( XFillStyleItem( eXFS ) ); - aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet()); - //aCtlXRectPreview.SetFillAttr( aXFillAttr ); - - aTsbShowShadow.SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) ); - Link aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl ); - aLbShadowColor.SetSelectHdl( aLink ); - aMtrTransparent.SetModifyHdl( aLink ); - aMtrDistance.SetModifyHdl( aLink ); - - aCtlXRectPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE))); - aCtlPosition.SetAccessibleRelationMemberOf( &aFlProp ); -} - -// ----------------------------------------------------------------------- - -void SvxShadowTabPage::Construct() -{ - // Farbtabelle fuellen - aLbShadowColor.Fill( pColorTab ); - - if( bDisable ) - { - aTsbShowShadow.Disable(); - aFtPosition.Disable(); - aCtlPosition.Disable(); - aFtDistance.Disable(); - aMtrDistance.Disable(); - aFtShadowColor.Disable(); - aLbShadowColor.Disable(); - aFtTransparent.Disable(); - aMtrTransparent.Disable(); - } -} - -// ----------------------------------------------------------------------- - -void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - sal_uInt16 nPos; - sal_uInt16 nCount; - - SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - - if( nDlgType == 0 ) - { - if( pColorTab ) - { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) - { - if( *pnColorTableState & CT_CHANGED ) - { - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); - if( pArea ) - { - pColorTab = pArea->GetNewColorTable(); - } - else - { - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); - if( pLine ) - pColorTab = pLine->GetNewColorTable(); - } - } - - // aLbShadowColor - nPos = aLbShadowColor.GetSelectEntryPos(); - aLbShadowColor.Clear(); - aLbShadowColor.Fill( pColorTab ); - nCount = aLbShadowColor.GetEntryCount(); - if( nCount == 0 ) - ; // Dieser Fall sollte nicht auftreten - else if( nCount <= nPos ) - aLbShadowColor.SelectEntryPos( 0 ); - else - aLbShadowColor.SelectEntryPos( nPos ); - - ModifyShadowHdl_Impl( this ); - } - nPageType = PT_SHADOW; - } - } -} - -// ----------------------------------------------------------------------- - -int SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - FillItemSet( *_pSet ); - - return( LEAVE_PAGE ); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs ) -{ - const SfxPoolItem* pOld = NULL; - sal_Bool bModified = sal_False; - - if( !bDisable ) - { - // Schatten - TriState eState = aTsbShowShadow.GetState(); - if( eState != aTsbShowShadow.GetSavedValue() ) - { - SdrShadowItem aItem( sal::static_int_cast< sal_Bool >( eState ) ); - pOld = GetOldItem( rAttrs, SDRATTR_SHADOW ); - if ( !pOld || !( *(const SdrShadowItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - // Schatten-Entfernung - // Etwas umstaendliche Abfrage, ob etwas geaendert wurde, - // da Items nicht direkt auf Controls abbildbar sind - sal_Int32 nX = 0L, nY = 0L; - sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); - - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: nX = nY = -nXY; break; - case RP_MT: nY = -nXY; break; - case RP_RT: nX = nXY; nY = -nXY; break; - case RP_LM: nX = -nXY; break; - case RP_RM: nX = nXY; break; - case RP_LB: nX = -nXY; nY = nXY; break; - case RP_MB: nY = nXY; break; - case RP_RB: nX = nY = nXY; break; - case RP_MM: break; - } - - // Wenn die Werte des Schattenabstanden==SFX_ITEM_DONTCARE und der angezeigte - // String im entspr. MetricField=="", dann w�rde der Vergleich zw. alten und - // neuen Distance-Werte ein falsches Ergebnis liefern, da in so einem Fall die - // neuen Distance-Werte den Default-Werten des MetricField entspr�chen !!!! - if ( !aMtrDistance.IsEmptyFieldValue() || - rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE || - rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nOldX = 9876543; // Unmoeglicher Wert, entspr. DontCare - sal_Int32 nOldY = 9876543; - if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE && - rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) - { - nOldX = ( ( const SdrShadowXDistItem& ) rOutAttrs. - Get( SDRATTR_SHADOWXDIST ) ).GetValue(); - nOldY = ( ( const SdrShadowYDistItem& ) rOutAttrs. - Get( SDRATTR_SHADOWYDIST ) ).GetValue(); - } - SdrShadowXDistItem aXItem( nX ); - pOld = GetOldItem( rAttrs, SDRATTR_SHADOWXDIST ); - if ( nX != nOldX && - ( !pOld || !( *(const SdrShadowXDistItem*)pOld == aXItem ) ) ) - { - rAttrs.Put( aXItem ); - bModified = sal_True; - } - SdrShadowYDistItem aYItem( nY ); - pOld = GetOldItem( rAttrs, SDRATTR_SHADOWYDIST ); - if ( nY != nOldY && - ( !pOld || !( *(const SdrShadowYDistItem*)pOld == aYItem ) ) ) - { - rAttrs.Put( aYItem ); - bModified = sal_True; - } - } - - // ShadowColor - sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND && - nPos != aLbShadowColor.GetSavedValue() ) - { - SdrShadowColorItem aItem( aLbShadowColor.GetSelectEntry(), - aLbShadowColor.GetSelectEntryColor() ); - pOld = GetOldItem( rAttrs, SDRATTR_SHADOWCOLOR ); - if ( !pOld || !( *(const SdrShadowColorItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - - // Transparenz - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() ) - { - SdrShadowTransparenceItem aItem( nVal ); - pOld = GetOldItem( rAttrs, SDRATTR_SHADOWTRANSPARENCE ); - if ( !pOld || !( *(const SdrShadowTransparenceItem*)pOld == aItem ) ) - { - rAttrs.Put( aItem ); - bModified = sal_True; - } - } - } - - rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); - - return( bModified ); -} - -// ----------------------------------------------------------------------- - -void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs ) -{ - if( !bDisable ) - { - // Alle Objekte koennen einen Schatten besitzen - // z.Z. gibt es nur 8 m�gliche Positionen den Schatten zu setzen - - // Ist Schatten gesetzt? - if( rAttrs.GetItemState( SDRATTR_SHADOW ) != SFX_ITEM_DONTCARE ) - { - aTsbShowShadow.EnableTriState( sal_False ); - - if( ( ( const SdrShadowItem& ) rAttrs.Get( SDRATTR_SHADOW ) ).GetValue() ) - aTsbShowShadow.SetState( STATE_CHECK ); - else - { - aTsbShowShadow.SetState( STATE_NOCHECK ); - } - } - else - aTsbShowShadow.SetState( STATE_DONTKNOW ); - - // Entfernung (nur 8 moegliche Positionen), deshalb - // wird nur ein Item ausgewertet - - if( rAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE && - rAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE ) - { - sal_Int32 nX = ( ( const SdrShadowXDistItem& ) rAttrs.Get( SDRATTR_SHADOWXDIST ) ).GetValue(); - sal_Int32 nY = ( ( const SdrShadowYDistItem& ) rAttrs.Get( SDRATTR_SHADOWYDIST ) ).GetValue(); - - if( nX != 0 ) - SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); - else - SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); - - // Setzen des Schatten-Controls - if ( nX < 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_LT ); - else if( nX == 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_MT ); - else if( nX > 0L && nY < 0L ) aCtlPosition.SetActualRP( RP_RT ); - else if( nX < 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_LM ); - // Mittelpunkt gibt es nicht mehr - else if( nX == 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RB ); - else if( nX > 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RM ); - else if( nX < 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_LB ); - else if( nX == 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_MB ); - else if( nX > 0L && nY > 0L ) aCtlPosition.SetActualRP( RP_RB ); - } - else - { - // determine default-distance - SfxItemPool* pPool = rOutAttrs.GetPool(); - SdrShadowXDistItem* pXDistItem = (SdrShadowXDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWXDIST); - SdrShadowYDistItem* pYDistItem = (SdrShadowYDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWYDIST); - if (pXDistItem && pYDistItem) - { - sal_Int32 nX = pXDistItem->GetValue(); - sal_Int32 nY = pYDistItem->GetValue(); - if( nX != 0 ) - SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit ); - else - SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit ); - } - - // Tristate, z.B. mehrer Objekte wurden markiert, wovon einige einen Schatten besitzen, einige nicht. - // Der anzuzeigende Text des MetricFields wird auf "" gesetzt und dient in der Methode FillItemSet - // als Erkennungszeichen daf�r, das der Distance-Wert NICHT ver�ndert wurde !!!! - aMtrDistance.SetText( String() ); - aCtlPosition.SetActualRP( RP_MM ); - } - - // SchattenFarbe: - if( rAttrs.GetItemState( SDRATTR_SHADOWCOLOR ) != SFX_ITEM_DONTCARE ) - { - aLbShadowColor.SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() ); - } - else - aLbShadowColor.SetNoSelection(); - - // Transparenz - if( rAttrs.GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SFX_ITEM_DONTCARE ) - { - sal_uInt16 nTransp = ( ( const SdrShadowTransparenceItem& ) rAttrs.Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue(); - aMtrTransparent.SetValue( nTransp ); - } - else - aMtrTransparent.SetText( String() ); - - // Werte sichern - //aCtlPosition - aMtrDistance.SaveValue(); - aLbShadowColor.SaveValue(); - aTsbShowShadow.SaveValue(); - - // #66832# This field was not saved, but used to determine changes. - // Why? Seems to be the error. - // It IS the error. - aMtrTransparent.SaveValue(); - - ClickShadowHdl_Impl( NULL ); - ModifyShadowHdl_Impl( NULL ); - } -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxShadowTabPage::Create( Window* pWindow, - const SfxItemSet& rAttrs ) -{ - return( new SvxShadowTabPage( pWindow, rAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxShadowTabPage::GetRanges() -{ - return( pShadowRanges ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxShadowTabPage, ClickShadowHdl_Impl, void *, EMPTYARG ) -{ - if( aTsbShowShadow.GetState() == STATE_NOCHECK ) - { - aFtPosition.Disable(); - aCtlPosition.Disable(); - aFtDistance.Disable(); - aMtrDistance.Disable(); - aFtShadowColor.Disable(); - aLbShadowColor.Disable(); - aFtTransparent.Disable(); - aMtrTransparent.Disable(); - } - else - { - aFtPosition.Enable(); - aCtlPosition.Enable(); - aFtDistance.Enable(); - aMtrDistance.Enable(); - aFtShadowColor.Enable(); - aLbShadowColor.Enable(); - aFtTransparent.Enable(); - aMtrTransparent.Enable(); - } - aCtlPosition.Invalidate(); - - ModifyShadowHdl_Impl( NULL ); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxShadowTabPage, ModifyShadowHdl_Impl, void *, EMPTYARG ) -{ - if( aTsbShowShadow.GetState() == STATE_CHECK ) - rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); - else - rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); - - sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - rXFSet.Put( XFillColorItem( String(), - aLbShadowColor.GetSelectEntryColor() ) ); - } - sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); - XFillTransparenceItem aItem( nVal ); - rXFSet.Put( XFillTransparenceItem( aItem ) ); - - // Schatten-Entfernung - sal_Int32 nX = 0L, nY = 0L; - sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit ); - switch( aCtlPosition.GetActualRP() ) - { - case RP_LT: nX = nY = -nXY; break; - case RP_MT: nY = -nXY; break; - case RP_RT: nX = nXY; nY = -nXY; break; - case RP_LM: nX = -nXY; break; - case RP_RM: nX = nXY; break; - case RP_LB: nX = -nXY; nY = nXY; break; - case RP_MB: nY = nXY; break; - case RP_RB: nX = nY = nXY; break; - case RP_MM: break; - } - - aCtlXRectPreview.SetShadowPosition(Point(nX, nY)); - - aCtlXRectPreview.SetShadowAttributes(aXFillAttr.GetItemSet()); - //aCtlXRectPreview.SetFillAttr( aXFillAttr ); - aCtlXRectPreview.Invalidate(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) -{ - eRP = eRcPt; - - // Schatten neu zeichnen - ModifyShadowHdl_Impl( pWindow ); -} - -void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) -{ - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); - SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); - SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); - - - if (pColorTabItem) - SetColorTable(pColorTabItem->GetColorTable()); - if (pPageTypeItem) - SetPageType(pPageTypeItem->GetValue()); - if (pDlgTypeItem) - SetDlgType(pDlgTypeItem->GetValue()); - Construct(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx deleted file mode 100644 index 0f2409b64..000000000 --- a/cui/source/tabpages/transfrm.cxx +++ /dev/null @@ -1,1705 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// include --------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "transfrm.hrc" -#include - -#include "transfrm.hxx" -#include -#include "svx/dlgutil.hxx" -#include -#include "svx/anchorid.hxx" -#include -#include -#include -#include - -// Toleranz fuer WorkingArea -#define DIFF 1000 - -// static ---------------------------------------------------------------- - -static sal_uInt16 pPosSizeRanges[] = -{ - SID_ATTR_TRANSFORM_POS_X, - SID_ATTR_TRANSFORM_POS_Y, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_ANCHOR, - SID_ATTR_TRANSFORM_VERT_ORIENT, - SID_ATTR_TRANSFORM_WIDTH, - SID_ATTR_TRANSFORM_SIZE_POINT, - SID_ATTR_TRANSFORM_PROTECT_POS, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_AUTOWIDTH, - SID_ATTR_TRANSFORM_AUTOHEIGHT, - 0 -}; - -static sal_uInt16 pAngleRanges[] = -{ - SID_ATTR_TRANSFORM_ROT_X, - SID_ATTR_TRANSFORM_ANGLE, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_INTERN, - 0 -}; - -static sal_uInt16 pSlantRanges[] = -{ - SDRATTR_ECKENRADIUS, - SDRATTR_ECKENRADIUS, - SID_ATTR_TRANSFORM_SHEAR, - SID_ATTR_TRANSFORM_SHEAR_VERTICAL, - SID_ATTR_TRANSFORM_INTERN, - SID_ATTR_TRANSFORM_INTERN, - 0 -}; - -void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) -{ - const basegfx::B2DPoint aTopLeft( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); - const basegfx::B2DPoint aBottomRight( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); - - rRange = basegfx::B2DRange(aTopLeft, aBottomRight); -} - -void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) -{ - const double fFactor(1.0 / double(aUIScale)); - rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); -} - -/************************************************************************* -|* -|* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu -|* -\************************************************************************/ - -SvxTransformTabDialog::SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, - const SdrView* pSdrView, sal_uInt16 nAnchorTypes ) : - SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_TRANSFORM ), pAttr ), - pView ( pSdrView ), - nAnchorCtrls(nAnchorTypes) -{ - DBG_ASSERT(pView, "no valid view (!)"); - FreeResource(); - - //different positioning page in Writer - if(nAnchorCtrls & 0x00ff) - { - AddTabPage(RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges); - RemoveTabPage(RID_SVXPAGE_POSITION_SIZE); - } - else - { - AddTabPage(RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create, SvxPositionSizeTabPage::GetRanges); - RemoveTabPage(RID_SVXPAGE_SWPOSSIZE); - } - - AddTabPage(RID_SVXPAGE_ANGLE, SvxAngleTabPage::Create, SvxAngleTabPage::GetRanges); - AddTabPage(RID_SVXPAGE_SLANT, SvxSlantTabPage::Create, SvxSlantTabPage::GetRanges); -} - -// ----------------------------------------------------------------------- - -SvxTransformTabDialog::~SvxTransformTabDialog() -{ -} - -// ----------------------------------------------------------------------- - -void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) -{ - switch(nId) - { - case RID_SVXPAGE_POSITION_SIZE: - { - SvxPositionSizeTabPage& rSvxPos = static_cast(rPage); - rSvxPos.SetView(pView); - rSvxPos.Construct(); - - if(nAnchorCtrls & SVX_OBJ_NORESIZE) - { - rSvxPos.DisableResize(); - } - - if(nAnchorCtrls & SVX_OBJ_NOPROTECT) - { - rSvxPos.DisableProtect(); - rSvxPos.UpdateControlStates(); - } - - break; - } - case RID_SVXPAGE_SWPOSSIZE : - { - SvxSwPosSizeTabPage& rSwPos = static_cast(rPage); - - rSwPos.EnableAnchorTypes(nAnchorCtrls); - rSwPos.SetValidateFramePosLink(aValidateLink); - rSwPos.SetView(pView); - - break; - } - - case RID_SVXPAGE_ANGLE: - { - SvxAngleTabPage& rSvxAng = static_cast(rPage); - - rSvxAng.SetView( pView ); - rSvxAng.Construct(); - - break; - } - - case RID_SVXPAGE_SLANT: - { - SvxSlantTabPage& rSvxSlnt = static_cast(rPage); - - rSvxSlnt.SetView( pView ); - rSvxSlnt.Construct(); - - break; - } - } -} - -// ----------------------------------------------------------------------- - -void SvxTransformTabDialog::SetValidateFramePosLink(const Link& rLink) -{ - aValidateLink = rLink; -} - -/************************************************************************* -|* -|* Dialog zum Aendern der Position des Drehwinkels und des Drehwinkels -|* der Grafikobjekte -|* -\************************************************************************/ - -SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_ANGLE ), rInAttrs ), - aFlPosition ( this, CUI_RES( FL_POSITION ) ), - aFtPosX ( this, CUI_RES( FT_POS_X ) ), - aMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), - aFtPosY ( this, CUI_RES( FT_POS_Y ) ), - aMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), - aFtPosPresets ( this, CUI_RES(FT_POSPRESETS) ), - aCtlRect ( this, CUI_RES( CTL_RECT ) ), - - aFlAngle ( this, CUI_RES( FL_ANGLE ) ), - aFtAngle ( this, CUI_RES( FT_ANGLE ) ), - aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), - aFtAnglePresets ( this, CUI_RES(FT_ANGLEPRESETS) ), - aCtlAngle ( this, CUI_RES( CTL_ANGLE ), - RP_RB, 200, 80, CS_ANGLE ), - rOutAttrs ( rInAttrs ) -{ - FreeResource(); - - // calculate PoolUnit - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "no pool (!)" ); - ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X); - - aMtrAngle.SetModifyHdl(LINK( this, SvxAngleTabPage, ModifiedHdl)); - - aCtlRect.SetAccessibleRelationLabeledBy(&aFtPosPresets); - aCtlRect.SetAccessibleRelationMemberOf(&aFlPosition); - aCtlAngle.SetAccessibleRelationLabeledBy(&aFtAnglePresets); - aCtlAngle.SetAccessibleRelationMemberOf(&aFlAngle); -} - -// ----------------------------------------------------------------------- - -void SvxAngleTabPage::Construct() -{ - DBG_ASSERT(pView, "No valid view (!)"); - eDlgUnit = GetModuleFieldUnit(GetItemSet()); - SetFieldUnit(aMtrPosX, eDlgUnit, sal_True); - SetFieldUnit(aMtrPosY, eDlgUnit, sal_True); - - if(FUNIT_MILE == eDlgUnit || FUNIT_KM == eDlgUnit) - { - aMtrPosX.SetDecimalDigits( 3 ); - aMtrPosY.SetDecimalDigits( 3 ); - } - - { // #i75273# - Rectangle aTempRect(pView->GetAllMarkedRect()); - pView->GetSdrPageView()->LogicToPagePos(aTempRect); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } - - // Take anchor into account (Writer) - const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); - - if(rMarkList.GetMarkCount()) - { - const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); - - if(!maAnchor.equalZero()) // -> Writer - { - maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); - } - } - - // take scale into account - const Fraction aUIScale(pView->GetModel()->GetUIScale()); - lcl_ScaleRect(maRange, aUIScale); - - // take UI units into account - sal_uInt16 nDigits(aMtrPosX.GetDecimalDigits()); - lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); - - if(!pView->IsRotateAllowed()) - { - aFlPosition.Disable(); - aFtPosX.Disable(); - aMtrPosX.Disable(); - aFtPosY.Disable(); - aMtrPosY.Disable(); - aFtPosPresets.Disable(); - aCtlRect.Disable(); - aFlAngle.Disable(); - aFtAngle.Disable(); - aMtrAngle.Disable(); - aFtAnglePresets.Disable(); - aCtlAngle.Disable(); - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxAngleTabPage::FillItemSet(SfxItemSet& rSet) -{ - sal_Bool bModified = sal_False; - - if(aMtrAngle.IsValueModified() || aMtrPosX.IsValueModified() || aMtrPosY.IsValueModified()) - { - const double fUIScale(double(pView->GetModel()->GetUIScale())); - const double fTmpX((GetCoreValue(aMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale); - const double fTmpY((GetCoreValue(aMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale); - - rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), static_cast(aMtrAngle.GetValue()))); - rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX))); - rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY))); - - bModified |= sal_True; - } - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxAngleTabPage::Reset(const SfxItemSet& rAttrs) -{ - const double fUIScale(double(pView->GetModel()->GetUIScale())); - - const SfxPoolItem* pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ROT_X ); - if(pItem) - { - const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); - SetMetricValue(aMtrPosX, basegfx::fround(fTmp), ePoolUnit); - } - else - { - aMtrPosX.SetText( String() ); - } - - pItem = GetItem(rAttrs, SID_ATTR_TRANSFORM_ROT_Y); - if(pItem) - { - const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); - SetMetricValue(aMtrPosY, basegfx::fround(fTmp), ePoolUnit); - } - else - { - aMtrPosX.SetText( String() ); - } - - pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ANGLE ); - if(pItem) - { - aMtrAngle.SetValue(((const SfxInt32Item*)pItem)->GetValue()); - } - else - { - aMtrAngle.SetText( String() ); - } - - aMtrAngle.SaveValue(); - ModifiedHdl(this); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxAngleTabPage::Create( Window* pWindow, const SfxItemSet& rSet) -{ - return(new SvxAngleTabPage(pWindow, rSet)); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxAngleTabPage::GetRanges() -{ - return(pAngleRanges); -} - -// ----------------------------------------------------------------------- - -void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/) -{ -} - -// ----------------------------------------------------------------------- - -int SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if(_pSet) - { - FillItemSet(*_pSet); - } - - return LEAVE_PAGE; -} - -//------------------------------------------------------------------------ - -void SvxAngleTabPage::PointChanged(Window* pWindow, RECT_POINT eRP) -{ - if(pWindow == &aCtlRect) - { - switch(eRP) - { - case RP_LT: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); - break; - } - case RP_MT: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); - break; - } - case RP_RT: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); - break; - } - case RP_LM: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); - break; - } - case RP_MM: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); - break; - } - case RP_RM: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); - break; - } - case RP_LB: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); - break; - } - case RP_MB: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); - break; - } - case RP_RB: - { - aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); - aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); - break; - } - } - } - else if(pWindow == &aCtlAngle) - { - switch( eRP ) - { - case RP_LT: aMtrAngle.SetUserValue( 13500, FUNIT_NONE ); break; - case RP_MT: aMtrAngle.SetUserValue( 9000, FUNIT_NONE ); break; - case RP_RT: aMtrAngle.SetUserValue( 4500, FUNIT_NONE ); break; - case RP_LM: aMtrAngle.SetUserValue( 18000, FUNIT_NONE ); break; - case RP_RM: aMtrAngle.SetUserValue( 0, FUNIT_NONE ); break; - case RP_LB: aMtrAngle.SetUserValue( 22500, FUNIT_NONE ); break; - case RP_MB: aMtrAngle.SetUserValue( 27000, FUNIT_NONE ); break; - case RP_RB: aMtrAngle.SetUserValue( 31500, FUNIT_NONE ); break; - case RP_MM: break; - } - } -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxAngleTabPage, ModifiedHdl, void *, EMPTYARG ) -{ - switch(aMtrAngle.GetValue()) - { - case 13500: aCtlAngle.SetActualRP( RP_LT ); break; - case 9000: aCtlAngle.SetActualRP( RP_MT ); break; - case 4500: aCtlAngle.SetActualRP( RP_RT ); break; - case 18000: aCtlAngle.SetActualRP( RP_LM ); break; - case 0: aCtlAngle.SetActualRP( RP_RM ); break; - case 22500: aCtlAngle.SetActualRP( RP_LB ); break; - case 27000: aCtlAngle.SetActualRP( RP_MB ); break; - case 31500: aCtlAngle.SetActualRP( RP_RB ); break; - default: aCtlAngle.SetActualRP( RP_MM ); break; - } - - return( 0L ); -} - -/************************************************************************* -|* -|* Dialog zum Aendern des Eckenradius und zum Schraegstellen -|* -\************************************************************************/ - -SvxSlantTabPage::SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_SLANT ), rInAttrs ), - - aFlRadius ( this, CUI_RES( FL_RADIUS ) ), - aFtRadius ( this, CUI_RES( FT_RADIUS ) ), - aMtrRadius ( this, CUI_RES( MTR_FLD_RADIUS ) ), - aFlAngle ( this, CUI_RES( FL_SLANT ) ), - aFtAngle ( this, CUI_RES( FT_ANGLE ) ), - aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), - rOutAttrs ( rInAttrs ) -{ - FreeResource(); - - // this page needs ExchangeSupport - SetExchangeSupport(); - - // evaluate PoolUnit - SfxItemPool* pPool = rOutAttrs.GetPool(); - DBG_ASSERT( pPool, "no pool (!)" ); - ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); -} - -// ----------------------------------------------------------------------- - -void SvxSlantTabPage::Construct() -{ - // get the range - DBG_ASSERT(pView, "no valid view (!)"); - eDlgUnit = GetModuleFieldUnit(GetItemSet()); - SetFieldUnit(aMtrRadius, eDlgUnit, sal_True); - - { // #i75273# - Rectangle aTempRect(pView->GetAllMarkedRect()); - pView->GetSdrPageView()->LogicToPagePos(aTempRect); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) -{ - sal_Bool bModified = sal_False; - String aStr = aMtrRadius.GetText(); - - if( aStr != aMtrRadius.GetSavedValue() ) - { - Fraction aUIScale = pView->GetModel()->GetUIScale(); - long nTmp = GetCoreValue( aMtrRadius, ePoolUnit ); - nTmp = Fraction( nTmp ) * aUIScale; - - rAttrs.Put( SdrEckenradiusItem( nTmp ) ); - bModified = sal_True; - } - - aStr = aMtrAngle.GetText(); - - if( aStr != aMtrAngle.GetSavedValue() ) - { - sal_Int32 nValue = static_cast(aMtrAngle.GetValue()); - rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); - bModified = sal_True; - } - - if( bModified ) - { - // Referenzpunkt setzen - // #75897# - Rectangle aObjectRect(pView->GetAllMarkedRect()); - pView->GetSdrPageView()->LogicToPagePos(aObjectRect); - Point aPt = aObjectRect.Center(); - - rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X, aPt.X())); - rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y, aPt.Y())); - rAttrs.Put( SfxBoolItem( SID_ATTR_TRANSFORM_SHEAR_VERTICAL, sal_False ) ); - } - - return( bModified ); -} - -// ----------------------------------------------------------------------- - -void SvxSlantTabPage::Reset(const SfxItemSet& rAttrs) -{ - // if the view has selected objects, items with SFX_ITEM_DEFAULT need to be disabled - const SfxPoolItem* pItem; - - // Eckenradius - if(!pView->IsEdgeRadiusAllowed()) - { - aFlRadius.Disable(); - aFtRadius.Disable(); - aMtrRadius.Disable(); - aMtrRadius.SetText( String() ); - } - else - { - pItem = GetItem( rAttrs, SDRATTR_ECKENRADIUS ); - - if( pItem ) - { - const double fUIScale(double(pView->GetModel()->GetUIScale())); - const double fTmp((double)((const SdrEckenradiusItem*)pItem)->GetValue() / fUIScale); - SetMetricValue(aMtrRadius, basegfx::fround(fTmp), ePoolUnit); - } - else - { - aMtrRadius.SetText( String() ); - } - } - - aMtrRadius.SaveValue(); - - // Schraegstellen: Winkel - if( !pView->IsShearAllowed() ) - { - aFlAngle.Disable(); - aFtAngle.Disable(); - aMtrAngle.Disable(); - aMtrAngle.SetText( String() ); - } - else - { - pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_SHEAR ); - - if( pItem ) - { - aMtrAngle.SetValue( ( (const SfxInt32Item*)pItem )->GetValue() ); - } - else - { - aMtrAngle.SetText( String() ); - } - } - - aMtrAngle.SaveValue(); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxSlantTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) -{ - return( new SvxSlantTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxSlantTabPage::GetRanges() -{ - return( pSlantRanges ); -} - -// ----------------------------------------------------------------------- - -void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - SfxRectangleItem* pRectItem = NULL; - - if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) - { - const Rectangle aTempRect(pRectItem->GetValue()); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } -} - -// ----------------------------------------------------------------------- - -int SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if(_pSet) - { - FillItemSet(*_pSet); - } - - return LEAVE_PAGE; -} - -//------------------------------------------------------------------------ - -void SvxSlantTabPage::PointChanged( Window* , RECT_POINT ) -{ -} - -/************************************************************************* -|* -|* Dialog for changing position and size of graphic objects -|* -\************************************************************************/ - -SvxPositionSizeTabPage::SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_POSITION_SIZE ), rInAttrs ), - maFlPosition ( this, CUI_RES( FL_POSITION ) ), - maFtPosX ( this, CUI_RES( FT_POS_X ) ), - maMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), - maFtPosY ( this, CUI_RES( FT_POS_Y ) ), - maMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), - maFtPosReference ( this, CUI_RES( FT_POSREFERENCE ) ), - maCtlPos ( this, CUI_RES( CTL_POSRECT ), RP_LT ), - - maFlSize ( this, CUI_RES( FL_SIZE ) ), - maFtWidth ( this, CUI_RES( FT_WIDTH ) ), - maMtrWidth ( this, CUI_RES( MTR_FLD_WIDTH ) ), - maFtHeight ( this, CUI_RES( FT_HEIGHT ) ), - maMtrHeight ( this, CUI_RES( MTR_FLD_HEIGHT ) ), - maCbxScale ( this, CUI_RES( CBX_SCALE ) ), - maFtSizeReference ( this, CUI_RES( FT_SIZEREFERENCE) ), - maCtlSize ( this, CUI_RES( CTL_SIZERECT ), RP_LT ), - - maFlProtect ( this, CUI_RES( FL_PROTECT) ), - maTsbPosProtect ( this, CUI_RES( TSB_POSPROTECT ) ), - maTsbSizeProtect ( this, CUI_RES( TSB_SIZEPROTECT ) ), - - - maFlAdjust ( this, CUI_RES( FL_ADJUST ) ), - maTsbAutoGrowWidth ( this, CUI_RES( TSB_AUTOGROW_WIDTH ) ), - maTsbAutoGrowHeight ( this, CUI_RES( TSB_AUTOGROW_HEIGHT ) ), - - maFlDivider (this, CUI_RES( FL_DIVIDER ) ), - - mrOutAttrs ( rInAttrs ), - mnProtectSizeState( STATE_NOCHECK ), - mbPageDisabled ( sal_False ), - mbProtectDisabled( false ), - mbSizeDisabled( false ), - mbAdjustDisabled( true ) -{ - FreeResource(); - - // this pege needs ExchangeSupport - SetExchangeSupport(); - - // evaluate PoolUnit - SfxItemPool* pPool = mrOutAttrs.GetPool(); - DBG_ASSERT( pPool, "no pool (!)" ); - mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); - - meRP = RP_LT; // s.o. - - maMtrWidth.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) ); - maMtrHeight.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) ); - maCbxScale.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) ); - - maTsbAutoGrowWidth.Disable(); - maTsbAutoGrowHeight.Disable(); - maFlAdjust.Disable(); - - // #i2379# disable controls when protected - maTsbPosProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangePosProtectHdl ) ); - maTsbSizeProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangeSizeProtectHdl ) ); - - maCtlPos.SetAccessibleRelationMemberOf( &maFlPosition ); - maCtlSize.SetAccessibleRelationMemberOf( &maFlSize ); - maCtlPos.SetAccessibleRelationLabeledBy( &maFtPosReference ); - maCtlSize.SetAccessibleRelationLabeledBy( &maFtSizeReference ); -} - -// ----------------------------------------------------------------------- - -void SvxPositionSizeTabPage::Construct() -{ - // get range and work area - DBG_ASSERT( mpView, "no valid view (!)" ); - meDlgUnit = GetModuleFieldUnit( GetItemSet() ); - SetFieldUnit( maMtrPosX, meDlgUnit, sal_True ); - SetFieldUnit( maMtrPosY, meDlgUnit, sal_True ); - SetFieldUnit( maMtrWidth, meDlgUnit, sal_True ); - SetFieldUnit( maMtrHeight, meDlgUnit, sal_True ); - - if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit) - { - maMtrPosX.SetDecimalDigits( 3 ); - maMtrPosY.SetDecimalDigits( 3 ); - maMtrWidth.SetDecimalDigits( 3 ); - maMtrHeight.SetDecimalDigits( 3 ); - } - - { // #i75273# - Rectangle aTempRect(mpView->GetAllMarkedRect()); - mpView->GetSdrPageView()->LogicToPagePos(aTempRect); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } - - { // #i75273# - Rectangle aTempRect(mpView->GetWorkArea()); - mpView->GetSdrPageView()->LogicToPagePos(aTempRect); - maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } - - // take anchor into account (Writer) - const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); - - if(rMarkList.GetMarkCount()) - { - const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); - - if(!maAnchor.equalZero()) // -> Writer - { - for(sal_uInt16 i(1); i < rMarkList.GetMarkCount(); i++) - { - pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); - - if(maAnchor != basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y())) - { - // diferent anchor positions - maMtrPosX.SetText( String() ); - maMtrPosY.SetText( String() ); - mbPageDisabled = sal_True; - return; - } - } - - // translate ranges about anchor - maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); - maWorkRange = basegfx::B2DRange(maWorkRange.getMinimum() - maAnchor, maWorkRange.getMaximum() - maAnchor); - } - } - - // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE - if(1 == rMarkList.GetMarkCount()) - { - const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); - - if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) - { - mbAdjustDisabled = false; - maFlAdjust.Enable(); - maTsbAutoGrowWidth.Enable(); - maTsbAutoGrowHeight.Enable(); - maTsbAutoGrowWidth.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); - maTsbAutoGrowHeight.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); - - // is used as flag to evaluate if its selectable - maTsbAutoGrowWidth.EnableTriState( sal_False ); - maTsbAutoGrowHeight.EnableTriState( sal_False ); - } - } - - // take scale into account - const Fraction aUIScale(mpView->GetModel()->GetUIScale()); - lcl_ScaleRect( maWorkRange, aUIScale ); - lcl_ScaleRect( maRange, aUIScale ); - - // take UI units into account - const sal_uInt16 nDigits(maMtrPosX.GetDecimalDigits()); - lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); - lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); - - SetMinMaxPosition(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet& rOutAttrs ) -{ - sal_Bool bModified(sal_False); - - if ( maMtrWidth.HasFocus() ) - { - ChangeWidthHdl( this ); - } - - if ( maMtrHeight.HasFocus() ) - { - ChangeHeightHdl( this ); - } - - if( !mbPageDisabled ) - { - if ( maMtrPosX.IsValueModified() || maMtrPosY.IsValueModified() ) - { - const double fUIScale(double(mpView->GetModel()->GetUIScale())); - double fX((GetCoreValue( maMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale); - double fY((GetCoreValue( maMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale); - - { // #i75273# - Rectangle aTempRect(mpView->GetAllMarkedRect()); - mpView->GetSdrPageView()->LogicToPagePos(aTempRect); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } - - // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions - GetTopLeftPosition(fX, fY, maRange); - - rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX))); - rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY))); - - bModified |= sal_True; - } - - if ( maTsbPosProtect.GetState() != maTsbPosProtect.GetSavedValue() ) - { - if( maTsbPosProtect.GetState() == STATE_DONTKNOW ) - { - rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); - } - else - { - rOutAttrs.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), - maTsbPosProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - } - - bModified |= sal_True; - } - } - - if ( maMtrWidth.IsValueModified() || maMtrHeight.IsValueModified() ) - { - Fraction aUIScale = mpView->GetModel()->GetUIScale(); - - // get Width - double nWidth = static_cast(maMtrWidth.GetValue( meDlgUnit )); - nWidth = MetricField::ConvertDoubleValue( nWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lWidth = long(nWidth * (double)aUIScale); - lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); - lWidth = static_cast(maMtrWidth.Denormalize( lWidth )); - - // get Height - double nHeight = static_cast(maMtrHeight.GetValue( meDlgUnit )); - nHeight = MetricField::ConvertDoubleValue( nHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lHeight = long(nHeight * (double)aUIScale); - lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); - lHeight = static_cast(maMtrWidth.Denormalize( lHeight )); - - // put Width & Height to itemset - rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), - (sal_uInt32) lWidth ) ); - rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), - (sal_uInt32) lHeight ) ); - rOutAttrs.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< sal_uInt16 >( meRP ) ) ); - bModified |= sal_True; - } - - if ( maTsbSizeProtect.GetState() != maTsbSizeProtect.GetSavedValue() ) - { - if ( maTsbSizeProtect.GetState() == STATE_DONTKNOW ) - rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); - else - rOutAttrs.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), - maTsbSizeProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - bModified |= sal_True; - } - - if ( maTsbAutoGrowWidth.GetState() != maTsbAutoGrowWidth.GetSavedValue() ) - { - if ( !maTsbAutoGrowWidth.IsTriStateEnabled() ) - { - if( maTsbAutoGrowWidth.GetState() == STATE_DONTKNOW ) - rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH ); - else - rOutAttrs.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ), - maTsbAutoGrowWidth.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - } - bModified |= sal_True; - } - - if ( maTsbAutoGrowHeight.GetState() != maTsbAutoGrowHeight.GetSavedValue() ) - { - if ( !maTsbAutoGrowHeight.IsTriStateEnabled() ) - { - if( maTsbAutoGrowHeight.GetState() == STATE_DONTKNOW ) - rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT ); - else - rOutAttrs.Put( - SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ), - maTsbAutoGrowHeight.GetState() == STATE_CHECK ? sal_True : sal_False ) ); - } - bModified |= sal_True; - } - - - return bModified; -} - -// ----------------------------------------------------------------------- - -void SvxPositionSizeTabPage::Reset( const SfxItemSet& ) -{ - const SfxPoolItem* pItem; - const double fUIScale(double(mpView->GetModel()->GetUIScale())); - - if ( !mbPageDisabled ) - { - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X ); - if ( pItem ) - { - const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); - SetMetricValue(maMtrPosX, basegfx::fround(fTmp), mePoolUnit); - } - - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y ); - if ( pItem ) - { - const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); - SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit); - } - - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS ); - if ( pItem ) - { - sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); - maTsbPosProtect.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); - maTsbPosProtect.EnableTriState( sal_False ); - } - else - { - maTsbPosProtect.SetState( STATE_DONTKNOW ); - } - - maTsbPosProtect.SaveValue(); - maCtlPos.Reset(); - - // #i2379# Disable controls for protected objects - ChangePosProtectHdl( this ); - } - - { // #i75273# set width - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH ); - mfOldWidth = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); - double fTmpWidth((OutputDevice::LogicToLogic(static_cast(mfOldWidth), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); - - if(maMtrWidth.GetDecimalDigits()) - fTmpWidth *= pow(10.0, maMtrWidth.GetDecimalDigits()); - - fTmpWidth = MetricField::ConvertDoubleValue(fTmpWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); - maMtrWidth.SetValue(static_cast(fTmpWidth), meDlgUnit); - } - - { // #i75273# set height - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT ); - mfOldHeight = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); - double fTmpHeight((OutputDevice::LogicToLogic(static_cast(mfOldHeight), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); - - if(maMtrHeight.GetDecimalDigits()) - fTmpHeight *= pow(10.0, maMtrHeight.GetDecimalDigits()); - - fTmpHeight = MetricField::ConvertDoubleValue(fTmpHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); - maMtrHeight.SetValue(static_cast(fTmpHeight), meDlgUnit); - } - - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE ); - if ( pItem ) - { - maTsbSizeProtect.SetState( ( (const SfxBoolItem*)pItem )->GetValue() - ? STATE_CHECK : STATE_NOCHECK ); - maTsbSizeProtect.EnableTriState( sal_False ); - } - else - maTsbSizeProtect.SetState( STATE_DONTKNOW ); - - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH ); - if ( pItem ) - { - maTsbAutoGrowWidth.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() - ? STATE_CHECK : STATE_NOCHECK ); - } - else - maTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); - - pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT ); - if ( pItem ) - { - maTsbAutoGrowHeight.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() - ? STATE_CHECK : STATE_NOCHECK ); - } - else - maTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); - - // Ist Abgleich gesetzt? - String aStr = GetUserData(); - maCbxScale.Check( (sal_Bool)aStr.ToInt32() ); - - maTsbSizeProtect.SaveValue(); - maTsbAutoGrowWidth.SaveValue(); - maTsbAutoGrowHeight.SaveValue(); - ClickSizeProtectHdl( NULL ); - - // #i2379# Disable controls for protected objects - ChangeSizeProtectHdl( this ); -} - -// ----------------------------------------------------------------------- - -SfxTabPage* SvxPositionSizeTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) -{ - return( new SvxPositionSizeTabPage( pWindow, rOutAttrs ) ); -} - -//------------------------------------------------------------------------ - -sal_uInt16* SvxPositionSizeTabPage::GetRanges() -{ - return( pPosSizeRanges ); -} - -// ----------------------------------------------------------------------- - -void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet ) -{ - SfxRectangleItem* pRectItem = NULL; - - if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) - { - { // #i75273# - const Rectangle aTempRect(pRectItem->GetValue()); - maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); - } - - SetMinMaxPosition(); - } -} - -// ----------------------------------------------------------------------- - -int SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if( _pSet ) - { - double fX((double)maMtrPosX.GetValue()); - double fY((double)maMtrPosY.GetValue()); - - GetTopLeftPosition(fX, fY, maRange); - const Rectangle aOutRectangle( - basegfx::fround(fX), basegfx::fround(fY), - basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight())); - _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle)); - - FillItemSet(*_pSet); - } - - return LEAVE_PAGE; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ChangePosProtectHdl, void *, EMPTYARG ) -{ - // #106572# Remember user's last choice - maTsbSizeProtect.SetState( maTsbPosProtect.GetState() == STATE_CHECK ? STATE_CHECK : mnProtectSizeState ); - UpdateControlStates(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::UpdateControlStates() -{ - const bool bPosProtect = maTsbPosProtect.GetState() == STATE_CHECK; - const bool bSizeProtect = maTsbSizeProtect.GetState() == STATE_CHECK; - const bool bHeightChecked = !maTsbAutoGrowHeight.IsTriStateEnabled() && (maTsbAutoGrowHeight.GetState() == STATE_CHECK); - const bool bWidthChecked = !maTsbAutoGrowWidth.IsTriStateEnabled() && (maTsbAutoGrowWidth.GetState() == STATE_CHECK); - - maFlPosition.Enable( !bPosProtect && !mbPageDisabled ); - maFtPosX.Enable( !bPosProtect && !mbPageDisabled ); - maMtrPosX.Enable( !bPosProtect && !mbPageDisabled ); - maFtPosY.Enable( !bPosProtect && !mbPageDisabled ); - maMtrPosY.Enable( !bPosProtect && !mbPageDisabled ); - maFtPosReference.Enable( !bPosProtect && !mbPageDisabled ); - maCtlPos.Enable( !bPosProtect ); - maTsbPosProtect.Enable( !mbProtectDisabled && !mbPageDisabled ); - - maFlSize.Enable( !mbSizeDisabled && !bSizeProtect ); - maCtlSize.Enable( !mbSizeDisabled && !bSizeProtect && (!bHeightChecked || !bWidthChecked) ); - maFtWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); - maMtrWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); - maFtHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); - maMtrHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); - maCbxScale.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked && !bWidthChecked ); - maFtSizeReference.Enable( !mbSizeDisabled && !bSizeProtect ); - maFlProtect.Enable( !mbProtectDisabled ); - maTsbSizeProtect.Enable( !mbProtectDisabled && !bPosProtect ); - - maFlAdjust.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); - maTsbAutoGrowWidth.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); - maTsbAutoGrowHeight.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); - - maCtlSize.Invalidate(); - maCtlPos.Invalidate(); - -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ChangeSizeProtectHdl, void *, EMPTYARG ) -{ - if( maTsbSizeProtect.IsEnabled() ) - { - // #106572# Remember user's last choice - - // Note: this works only as long as the dialog is open. When - // the user closes the dialog, there is no way to remember - // whether size was enabled or disabled befor pos protect was - // clicked. Thus, if pos protect is selected, the dialog is - // closed and reopened again, unchecking pos protect will - // always uncheck size protect, too. That's life. - mnProtectSizeState = maTsbSizeProtect.GetState(); - } - - UpdateControlStates(); - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) -{ - return( 0L ); -} -IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) - -//------------------------------------------------------------------------ - -IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) -{ - return( 0L ); -} -IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::SetMinMaxPosition() -{ - // position - double fLeft(maWorkRange.getMinX()); - double fTop(maWorkRange.getMinY()); - double fRight(maWorkRange.getMaxX()); - double fBottom(maWorkRange.getMaxY()); - - switch ( maCtlPos.GetActualRP() ) - { - case RP_LT: - { - fRight -= maRange.getWidth(); - fBottom -= maRange.getHeight(); - break; - } - case RP_MT: - { - fLeft += maRange.getWidth() / 2.0; - fRight -= maRange.getWidth() / 2.0; - fBottom -= maRange.getHeight(); - break; - } - case RP_RT: - { - fLeft += maRange.getWidth(); - fBottom -= maRange.getHeight(); - break; - } - case RP_LM: - { - fRight -= maRange.getWidth(); - fTop += maRange.getHeight() / 2.0; - fBottom -= maRange.getHeight() / 2.0; - break; - } - case RP_MM: - { - fLeft += maRange.getWidth() / 2.0; - fRight -= maRange.getWidth() / 2.0; - fTop += maRange.getHeight() / 2.0; - fBottom -= maRange.getHeight() / 2.0; - break; - } - case RP_RM: - { - fLeft += maRange.getWidth(); - fTop += maRange.getHeight() / 2.0; - fBottom -= maRange.getHeight() / 2.0; - break; - } - case RP_LB: - { - fRight -= maRange.getWidth(); - fTop += maRange.getHeight(); - break; - } - case RP_MB: - { - fLeft += maRange.getWidth() / 2.0; - fRight -= maRange.getWidth() / 2.0; - fTop += maRange.getHeight(); - break; - } - case RP_RB: - { - fLeft += maRange.getWidth(); - fTop += maRange.getHeight(); - break; - } - } - - const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L)); - fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft; - fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight; - fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop; - fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom; - - // #i75273# normalizing when setting the min/max values was wrong, removed - maMtrPosX.SetMin(basegfx::fround64(fLeft)); - maMtrPosX.SetFirst(basegfx::fround64(fLeft)); - maMtrPosX.SetMax(basegfx::fround64(fRight)); - maMtrPosX.SetLast(basegfx::fround64(fRight)); - maMtrPosY.SetMin(basegfx::fround64(fTop)); - maMtrPosY.SetFirst(basegfx::fround64(fTop)); - maMtrPosY.SetMax(basegfx::fround64(fBottom)); - maMtrPosY.SetLast(basegfx::fround64(fBottom)); - - // size - fLeft = maWorkRange.getMinX(); - fTop = maWorkRange.getMinY(); - fRight = maWorkRange.getMaxX(); - fBottom = maWorkRange.getMaxY(); - double fNewX(0); - double fNewY(0); - - switch ( maCtlSize.GetActualRP() ) - { - case RP_LT: - { - fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); - fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); - break; - } - case RP_MT: - { - fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; - fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); - break; - } - case RP_RT: - { - fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); - fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); - break; - } - case RP_LM: - { - fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); - fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; - break; - } - case RP_MM: - { - const double f1(maRange.getCenter().getX() - fLeft); - const double f2(fRight - maRange.getCenter().getX()); - const double f3(std::min(f1, f2)); - const double f4(maRange.getCenter().getY() - fTop); - const double f5(fBottom - maRange.getCenter().getY()); - const double f6(std::min(f4, f5)); - - fNewX = f3 * 2.0; - fNewY = f6 * 3.0; - - break; - } - case RP_RM: - { - fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); - fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; - break; - } - case RP_LB: - { - fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); - fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); - break; - } - case RP_MB: - { - fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; - fNewY = maWorkRange.getHeight() - ( maRange.getMaxY() - fBottom ); - break; - } - case RP_RB: - { - fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); - fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); - break; - } - } - - // #i75273# normalizing when setting the min/max values was wrong, removed - maMtrWidth.SetMax(basegfx::fround64(fNewX)); - maMtrWidth.SetLast(basegfx::fround64(fNewX)); - maMtrHeight.SetMax(basegfx::fround64(fNewY)); - maMtrHeight.SetLast(basegfx::fround64(fNewY)); -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange) -{ - switch (maCtlPos.GetActualRP()) - { - case RP_LT: - { - break; - } - case RP_MT: - { - rfX -= rRange.getCenter().getX() - rRange.getMinX(); - break; - } - case RP_RT: - { - rfX -= rRange.getWidth(); - break; - } - case RP_LM: - { - rfY -= rRange.getCenter().getY() - rRange.getMinY(); - break; - } - case RP_MM: - { - rfX -= rRange.getCenter().getX() - rRange.getMinX(); - rfY -= rRange.getCenter().getY() - rRange.getMinY(); - break; - } - case RP_RM: - { - rfX -= rRange.getWidth(); - rfY -= rRange.getCenter().getY() - rRange.getMinY(); - break; - } - case RP_LB: - { - rfY -= rRange.getHeight(); - break; - } - case RP_MB: - { - rfX -= rRange.getCenter().getX() - rRange.getMinX(); - rfY -= rRange.getHeight(); - break; - } - case RP_RB: - { - rfX -= rRange.getWidth(); - rfY -= rRange.getHeight(); - break; - } - } -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::PointChanged( Window* pWindow, RECT_POINT eRP ) -{ - if( pWindow == &maCtlPos ) - { - SetMinMaxPosition(); - switch( eRP ) - { - case RP_LT: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); - break; - } - case RP_MT: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); - break; - } - case RP_RT: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); - break; - } - case RP_LM: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); - break; - } - case RP_MM: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); - break; - } - case RP_RM: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); - break; - } - case RP_LB: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); - break; - } - case RP_MB: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); - break; - } - case RP_RB: - { - maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); - maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); - break; - } - } - } - else - { - meRP = eRP; - - Rectangle aTmpRect( GetRect() ); - SetMinMaxPosition(); - } -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::DisableResize() -{ - mbSizeDisabled = true; -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::DisableProtect() -{ - mbProtectDisabled = true; -} - -//------------------------------------------------------------------------ - -Rectangle SvxPositionSizeTabPage::GetRect() -{ - double fLeft(maRange.getMinX()); - double fTop(maRange.getMinY()); - double fRight(fLeft + (double)maMtrWidth.GetValue()); - double fBottom(fTop + (double)maMtrHeight.GetValue()); - - switch ( maCtlSize.GetActualRP() ) - { - case RP_LT: - { - break; - } - case RP_MT: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; - break; - } - case RP_RT: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); - break; - } - case RP_LM: - { - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; - break; - } - case RP_MM: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; - break; - } - case RP_RM: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; - break; - } - case RP_LB: - { - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); - break; - } - case RP_MB: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); - break; - } - case RP_RB: - { - fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); - fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); - break; - } - } - - return Rectangle(basegfx::fround(fLeft), basegfx::fround(fTop), basegfx::fround(fRight), basegfx::fround(fBottom)); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ChangeWidthHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) - { - sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)maMtrWidth.GetValue()) / mfOldWidth)); - - if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE)) - { - maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); - } - else - { - nHeight = maMtrHeight.GetMax(FUNIT_NONE); - maMtrHeight.SetUserValue(nHeight); - - const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight)); - maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); - } - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ChangeHeightHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) - { - sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)maMtrHeight.GetValue()) / mfOldHeight)); - - if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE)) - { - maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); - } - else - { - nWidth = maMtrWidth.GetMax(FUNIT_NONE); - maMtrWidth.SetUserValue(nWidth); - - const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth)); - maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); - } - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ClickSizeProtectHdl, void *, EMPTYARG ) -{ - UpdateControlStates(); - return( 0L ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SvxPositionSizeTabPage, ClickAutoHdl, void *, EMPTYARG ) -{ - if( maCbxScale.IsChecked() ) - { - mfOldWidth = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); - mfOldHeight = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); - } - - return( 0L ); -} - -//------------------------------------------------------------------------ - -void SvxPositionSizeTabPage::FillUserData() -{ - // Abgleich wird in der Ini-Datei festgehalten - UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() ); - SetUserData( aStr ); -} - -// eof - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/transfrm.hrc b/cui/source/tabpages/transfrm.hrc deleted file mode 100644 index 28d81fa62..000000000 --- a/cui/source/tabpages/transfrm.hrc +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define TAB_CONTROL 1 -#define BTN_OK 2 -#define BTN_CANCEL 3 -#define BTN_HELP 4 -#define FT_POS_X 5 -#define FT_POS_Y 6 -#define MTR_FLD_POS_X 7 -#define MTR_FLD_POS_Y 8 -#define CBX_COPY 9 -#define TSB_PROTECT 10 -#define TSB_AUTO 11 -#define TSB_AUTOGROW_HEIGHT 12 -#define TSB_AUTOGROW_WIDTH 13 -#define BTN_RESET 14 -#define FT_WIDTH 15 -#define FT_HEIGHT 16 -#define MTR_FLD_WIDTH 17 -#define MTR_FLD_HEIGHT 18 -#define MTR_FLD_ANGLE 19 -#define CTL_RECT 20 -#define CTL_ANGLE 21 -#define CBX_SCALE 22 -#define FL_ADJUST 23 -#define FL_POSITION 24 -#define FL_SIZE 25 -#define FL_SLANT 26 -#define FL_RADIUS 27 -#define FT_RADIUS 28 -#define MTR_FLD_RADIUS 29 -#define FL_ANGLE 30 -#define FT_ANGLE 31 -#define TSB_VERTICAL 32 -#define FL_ANCHOR 33 -#define FT_ANCHOR 34 -#define LB_ANCHOR 35 -#define FT_ORIENT 36 -#define FT_REFERENCE 37 -#define FT_POSPRESETS 38 -#define FT_ANGLEPRESETS 39 -#define LB_ORIENT 40 -#define FT_SIZEREFERENCE 41 -#define CTL_SIZERECT 42 -#define FT_POSREFERENCE 43 -#define CTL_POSRECT 44 -#define TSB_POSPROTECT 45 -#define TSB_SIZEPROTECT 46 -#define FL_PROTECT 47 -#define FL_DIVIDER 48 - -// diff --git a/cui/source/tabpages/transfrm.src b/cui/source/tabpages/transfrm.src deleted file mode 100644 index d8960137a..000000000 --- a/cui/source/tabpages/transfrm.src +++ /dev/null @@ -1,625 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - // include ------------------------------------------------------------------ -#include -#include "helpid.hrc" -#include -#include "transfrm.hrc" -#include - -#define MA_TABPAGE_HEIGHT 185 - - // RID_SVXPAGE_POSITION_SIZE ------------------------------------------------ -TabPage RID_SVXPAGE_POSITION_SIZE -{ - HelpId = HID_TRANS_POSITION_SIZE ; - Hide = TRUE ; - Text [ en-US ] = "Position and Size" ; - Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; - - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Position" ; - }; - FixedText FT_POS_X - { - Pos = MAP_APPFONT ( 12 , 16 + 8 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Position ~X" ; - }; - FixedText FT_POS_Y - { - Pos = MAP_APPFONT ( 12 , 32 + 8 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Position ~Y" ; - }; - MetricField MTR_FLD_POS_X - { - HelpID = "cui:MetricField:RID_SVXPAGE_POSITION_SIZE:MTR_FLD_POS_X"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 14 + 8 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -120000 ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_POS_Y - { - HelpID = "cui:MetricField:RID_SVXPAGE_POSITION_SIZE:MTR_FLD_POS_Y"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 30 + 8 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -120000 ; - Maximum = 240000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedText FT_POSREFERENCE - { - Pos = MAP_APPFONT ( 178 , 2 + 8 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Base point"; - }; - Control CTL_POSRECT - { - HelpId = HID_TPPOSITION_CTRL ; - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 12 + 8 ) ; - Size = MAP_APPFONT ( 48 , 34 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Base point" ; - }; - - // size - - FixedLine FL_SIZE - { - Pos = MAP_APPFONT ( 6 , 56 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_WIDTH - { - Pos = MAP_APPFONT ( 12 , 16 + 61 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Wi~dth" ; - }; - FixedText FT_HEIGHT - { - Pos = MAP_APPFONT ( 12 , 32 + 61 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "H~eight" ; - }; - MetricField MTR_FLD_WIDTH - { - HelpID = "cui:MetricField:RID_SVXPAGE_POSITION_SIZE:MTR_FLD_WIDTH"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 14 + 61 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 120000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_HEIGHT - { - HelpID = "cui:MetricField:RID_SVXPAGE_POSITION_SIZE:MTR_FLD_HEIGHT"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 30 + 61 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 1 ; - Maximum = 120000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedText FT_SIZEREFERENCE - { - Pos = MAP_APPFONT ( 178 , 2 + 61 ) ; - Size = MAP_APPFONT ( 70 , 10 ) ; - Text [ en-US ] = "Base point"; - }; - Control CTL_SIZERECT - { - HelpId = HID_TPSIZE_CTRL ; - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 12 + 61 ) ; - Size = MAP_APPFONT ( 48 , 34 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Base point" ; - }; - CheckBox CBX_SCALE - { - HelpID = "cui:CheckBox:RID_SVXPAGE_POSITION_SIZE:CBX_SCALE"; - Pos = MAP_APPFONT ( 12 , 47 + 61 ) ; - Size = MAP_APPFONT ( 162 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Keep ratio" ; - }; - - // Protect - - FixedLine FL_PROTECT - { - Pos = MAP_APPFONT ( 6 , 120 ) ; - Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Protect" ; - }; - - TriStateBox TSB_POSPROTECT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_POSITION_SIZE:TSB_POSPROTECT"; - Pos = MAP_APPFONT ( 12 , 10 + 120 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - Text [ en-US ] = "Position" ; - TabStop = TRUE ; - }; - - TriStateBox TSB_SIZEPROTECT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_POSITION_SIZE:TSB_SIZEPROTECT"; - Pos = MAP_APPFONT ( 12 , 24 + 120 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - Text [ en-US ] = "~Size" ; - TabStop = TRUE ; - }; - - // Adjust - - FixedLine FL_ADJUST - { - Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ; - Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Adapt" ; - }; - TriStateBox TSB_AUTOGROW_WIDTH - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_POSITION_SIZE:TSB_AUTOGROW_WIDTH"; - Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - Text [ en-US ] = "~Fit width to text" ; - TabStop = TRUE ; - }; - TriStateBox TSB_AUTOGROW_HEIGHT - { - HelpID = "cui:TriStateBox:RID_SVXPAGE_POSITION_SIZE:TSB_AUTOGROW_HEIGHT"; - Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ; - Size = MAP_APPFONT ( 113 , 10 ) ; - Text [ en-US ] = "Fit ~height to text" ; - TabStop = TRUE ; - }; - - FixedLine FL_DIVIDER - { - Pos = MAP_APPFONT( 6 + 119 + 5, 128 ); - Size = MAP_APPFONT( RSC_CD_FIXEDLINE_WIDTH, 26 ); - Vert = True; - }; - - // Anchor - - FixedLine FL_ANCHOR - { - Pos = MAP_APPFONT ( 6 + 123 + 6 , 120 ) ; - Size = MAP_APPFONT ( 119 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Hide = TRUE ; - Text [ en-US ] = "Anchor" ; - }; - FixedText FT_ANCHOR - { - Pos = MAP_APPFONT ( 12 + 121 + 8, 10 + 120 ) ; - Size = MAP_APPFONT ( 37 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "~Anchor" ; - }; - ListBox LB_ANCHOR - { - HelpID = "cui:ListBox:RID_SVXPAGE_POSITION_SIZE:LB_ANCHOR"; - Pos = MAP_APPFONT ( 46 + 121 + 16 , 8 + 120 ) ; - Size = MAP_APPFONT ( 54 , 60 ) ; - Hide = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "To paragraph" ; > ; - < "As character" ; > ; - < "To page" ; > ; - < "To frame" ; > ; - }; - }; - FixedText FT_ORIENT - { - Pos = MAP_APPFONT ( 12 + 121 + 8, 24 + 120 ) ; - Size = MAP_APPFONT ( 37 , 10 ) ; - Hide = TRUE ; - Text [ en-US ] = "P~osition"; - }; - ListBox LB_ORIENT - { - HelpID = "cui:ListBox:RID_SVXPAGE_POSITION_SIZE:LB_ORIENT"; - Pos = MAP_APPFONT ( 46 + 121 + 16 , 22 + 120 ); - Size = MAP_APPFONT ( 54 , 60 ) ; - Hide = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "From top" ; > ; - < "Above" ; > ; - < "Centered" ; > ; - < "Below" ; > ; - < "Top of character" ; > ; - < "Center of character" ; > ; - < "Bottom of character" ; > ; - < "Top of line" ; > ; - < "Center of line" ; > ; - < "Bottom of line" ; > ; - }; - }; -}; - - // RID_SVXPAGE_ANGLE -------------------------------------------------------- -TabPage RID_SVXPAGE_ANGLE -{ - HelpId = HID_TRANS_ANGLE ; - Hide = TRUE ; - Text [ en-US ] = "Angle" ; - Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; - FixedLine FL_POSITION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Pivot point" ; - }; - FixedText FT_POS_X - { - Pos = MAP_APPFONT ( 12 , 16 + 11 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Position ~X" ; - }; - FixedText FT_POS_Y - { - Pos = MAP_APPFONT ( 12 , 32 + 11 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "Position ~Y" ; - }; - MetricField MTR_FLD_POS_X - { - HelpID = "cui:MetricField:RID_SVXPAGE_ANGLE:MTR_FLD_POS_X"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 14 + 11 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -500000 ; - Maximum = 500000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - MetricField MTR_FLD_POS_Y - { - HelpID = "cui:MetricField:RID_SVXPAGE_ANGLE:MTR_FLD_POS_Y"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 30 + 11 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -500000 ; - Maximum = 500000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedText FT_POSPRESETS - { - Pos = MAP_APPFONT ( 178 , 14 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Default settings"; - }; - Control CTL_RECT - { - HelpId = HID_TPROTATION_CTRL1 ; - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 14 + 11 ) ; - Size = MAP_APPFONT ( 70 , 48 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Rotation point" ; - }; - FixedLine FL_ANGLE - { - Pos = MAP_APPFONT ( 6 , 71 + 11 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Rotation angle" ; - }; - FixedText FT_ANGLE - { - Pos = MAP_APPFONT ( 12 , 84 + 22 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "~Angle" ; - }; - MetricField MTR_FLD_ANGLE - { - HelpID = "cui:MetricField:RID_SVXPAGE_ANGLE:MTR_FLD_ANGLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 82 + 22 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -500000 ; - Maximum = 500000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText [ en-US ] = " degrees" ; - SpinSize = 500 ; - }; - FixedText FT_ANGLEPRESETS - { - Pos = MAP_APPFONT ( 178 , 82 + 11 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Default settings"; - }; - Control CTL_ANGLE - { - HelpId = HID_TPROTATION_CTRL2 ; - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 82 + 22 ) ; - Size = MAP_APPFONT ( 70 , 48 ) ; - TabStop = TRUE ; - QuickHelpText [ en-US ] = "Rotation Angle"; - }; -}; - // RID_SVXPAGE_SLANT ----------------------------------------------------- -TabPage RID_SVXPAGE_SLANT -{ - HelpId = HID_TRANS_SLANT ; - Hide = TRUE ; - Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; - Text [ en-US ] = "Slant & Corner Radius" ; - FixedLine FL_RADIUS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Corner radius" ; - }; - FixedText FT_RADIUS - { - Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "~Radius" ; - }; - MetricField MTR_FLD_RADIUS - { - HelpID = "cui:MetricField:RID_SVXPAGE_SLANT:MTR_FLD_RADIUS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 14 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 500000 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - SpinSize = 10 ; - }; - FixedLine FL_SLANT - { - Pos = MAP_APPFONT ( 6 , 35 ) ; - Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; - Text [ en-US ] = "Slant" ; - }; - FixedText FT_ANGLE - { - Pos = MAP_APPFONT ( 12 , 48 ) ; - Size = MAP_APPFONT ( 40 , 10 ) ; - Text [ en-US ] = "~Angle" ; - }; - MetricField MTR_FLD_ANGLE - { - HelpID = "cui:MetricField:RID_SVXPAGE_SLANT:MTR_FLD_ANGLE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 56 , 46 ) ; - Size = MAP_APPFONT ( 54 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = -8900 ; - First = -8900 ; - Maximum = 8900 ; - Last = 8900 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_CUSTOM ; - SpinSize = 500 ; - CustomUnitText [ en-US ] = " degrees" ; - }; -}; - // RID_SVXDLG_TRANSFORM ----------------------------------------------------- - -#define _POS_SIZE_TEXT \ - Text [ en-US ] = "Position and Size" ; \ - - -TabDialog RID_SVXDLG_TRANSFORM\ -{ - OutputSize = TRUE ; - SvLook = TRUE ; - Size = MAP_APPFONT ( 289 , MA_TABPAGE_HEIGHT + 41 ) ; - Text [ en-US ] = "Position and Size" ;\ - Moveable = TRUE ; - TabControl TAB_CONTROL\ - { - OutputSize = TRUE ; - Pos = MAP_APPFONT ( 3 , 3 ) ; - Size = MAP_APPFONT ( 260 , MA_TABPAGE_HEIGHT ) ; - PageList = - { - PageItem\ - { - Identifier = RID_SVXPAGE_POSITION_SIZE ; - PageResID = RID_SVXPAGE_POSITION_SIZE ; - _POS_SIZE_TEXT - }; - PageItem - { - Identifier = RID_SVXPAGE_SWPOSSIZE; - PageResID = RID_SVXPAGE_SWPOSSIZE; - _POS_SIZE_TEXT - }; - PageItem - { - Identifier = RID_SVXPAGE_ANGLE ; - Text [ en-US ] = "Rotation" ; - PageResID = RID_SVXPAGE_ANGLE ; - }; - PageItem - { - Identifier = RID_SVXPAGE_SLANT ; - PageResID = RID_SVXPAGE_SLANT ; - Text [ en-US ] = "Slant & Corner Radius" ; - }; - }; - }; -}; - // ********************************************************************** EOF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cui/source/uno/services.cxx b/cui/source/uno/services.cxx deleted file mode 100644 index a63fd3c1e..000000000 --- a/cui/source/uno/services.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Christian Lippka - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include -#include "sal/types.h" -#include "cppuhelper/factory.hxx" -#include - -using rtl::OUString; -using namespace com::sun::star; - -namespace cui { -extern rtl::OUString SAL_CALL ColorPicker_getImplementationName(); -extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) ); -extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException ); -} - -namespace -{ - - cppu::ImplementationEntry entries[] = { - { &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/util/cui.component b/cui/util/cui.component deleted file mode 100644 index 43cfdb5d2..000000000 --- a/cui/util/cui.component +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/cui/util/cui.map b/cui/util/cui.map deleted file mode 100644 index e0809cfbd..000000000 --- a/cui/util/cui.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - CreateDialogFactory; - GetSpecialCharsForEdit; - component_getFactory; - local: - *; -}; diff --git a/cui/util/hidother.src b/cui/util/hidother.src deleted file mode 100644 index d5299d854..000000000 --- a/cui/util/hidother.src +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "../source/inc/helpid.hrc" // HID_XXX - -hidspecial HID_AUTOCORR_LANGUAGE { HelpId = HID_AUTOCORR_LANGUAGE; }; -hidspecial HID_CLB_EDIT_MODULES_DICS { HelpID = HID_CLB_EDIT_MODULES_DICS ;}; -hidspecial HID_CLB_EDIT_MODULES_MODULES { HelpID = HID_CLB_EDIT_MODULES_MODULES ;}; -hidspecial HID_CLB_LINGU_MODULES { HelpID = HID_CLB_LINGU_MODULES ;}; -hidspecial HID_CLB_LINGU_OPTIONS { HelpID = HID_CLB_LINGU_OPTIONS ;}; -hidspecial HID_COLORPAGE_ANCHOR_CB { HelpID = HID_COLORPAGE_ANCHOR_CB ; }; -hidspecial HID_COLORPAGE_ANCHOR_LB { HelpID = HID_COLORPAGE_ANCHOR_LB ; }; -hidspecial HID_COLORPAGE_APPBACKGROUND_CB { HelpID = HID_COLORPAGE_APPBACKGROUND_CB ; }; -hidspecial HID_COLORPAGE_APPBACKGROUND_LB { HelpID = HID_COLORPAGE_APPBACKGROUND_LB ; }; -hidspecial HID_COLORPAGE_BASICCOMMENT_CB { HelpID = HID_COLORPAGE_BASICCOMMENT_CB ; }; -hidspecial HID_COLORPAGE_BASICCOMMENT_LB { HelpID = HID_COLORPAGE_BASICCOMMENT_LB ; }; -hidspecial HID_COLORPAGE_BASICERROR_CB { HelpID = HID_COLORPAGE_BASICERROR_CB ; }; -hidspecial HID_COLORPAGE_BASICERROR_LB { HelpID = HID_COLORPAGE_BASICERROR_LB ; }; -hidspecial HID_COLORPAGE_BASICIDENTIFIER_CB { HelpID = HID_COLORPAGE_BASICIDENTIFIER_CB ; }; -hidspecial HID_COLORPAGE_BASICIDENTIFIER_LB { HelpID = HID_COLORPAGE_BASICIDENTIFIER_LB ; }; -hidspecial HID_COLORPAGE_BASICKEYWORD_CB { HelpID = HID_COLORPAGE_BASICKEYWORD_CB ; }; -hidspecial HID_COLORPAGE_BASICKEYWORD_LB { HelpID = HID_COLORPAGE_BASICKEYWORD_LB ; }; -hidspecial HID_COLORPAGE_BASICNUMBER_CB { HelpID = HID_COLORPAGE_BASICNUMBER_CB ; }; -hidspecial HID_COLORPAGE_BASICNUMBER_LB { HelpID = HID_COLORPAGE_BASICNUMBER_LB ; }; -hidspecial HID_COLORPAGE_BASICOPERATOR_CB { HelpID = HID_COLORPAGE_BASICOPERATOR_CB ; }; -hidspecial HID_COLORPAGE_BASICOPERATOR_LB { HelpID = HID_COLORPAGE_BASICOPERATOR_LB ; }; -hidspecial HID_COLORPAGE_BASICSTRING_CB { HelpID = HID_COLORPAGE_BASICSTRING_CB ; }; -hidspecial HID_COLORPAGE_BASICSTRING_LB { HelpID = HID_COLORPAGE_BASICSTRING_LB ; }; -hidspecial HID_COLORPAGE_CALCDETECTIVEERROR_CB { HelpID = HID_COLORPAGE_CALCDETECTIVEERROR_CB ; }; -hidspecial HID_COLORPAGE_CALCDETECTIVEERROR_LB { HelpID = HID_COLORPAGE_CALCDETECTIVEERROR_LB ; }; -hidspecial HID_COLORPAGE_CALCDETECTIVE_CB { HelpID = HID_COLORPAGE_CALCDETECTIVE_CB ; }; -hidspecial HID_COLORPAGE_CALCDETECTIVE_LB { HelpID = HID_COLORPAGE_CALCDETECTIVE_LB ; }; -hidspecial HID_COLORPAGE_CALCGRID_CB { HelpID = HID_COLORPAGE_CALCGRID_CB ; }; -hidspecial HID_COLORPAGE_CALCGRID_LB { HelpID = HID_COLORPAGE_CALCGRID_LB ; }; -hidspecial HID_COLORPAGE_CALCNOTESBACKGROUND_CB { HelpID = HID_COLORPAGE_CALCNOTESBACKGROUND_CB ; }; -hidspecial HID_COLORPAGE_CALCNOTESBACKGROUND_LB { HelpID = HID_COLORPAGE_CALCNOTESBACKGROUND_LB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB { HelpID = HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_CB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB { HelpID = HID_COLORPAGE_CALCPAGEBREAKAUTOMATIC_LB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB { HelpID = HID_COLORPAGE_CALCPAGEBREAKMANUAL_CB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB { HelpID = HID_COLORPAGE_CALCPAGEBREAKMANUAL_LB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAK_CB { HelpID = HID_COLORPAGE_CALCPAGEBREAK_CB ; }; -hidspecial HID_COLORPAGE_CALCPAGEBREAK_LB { HelpID = HID_COLORPAGE_CALCPAGEBREAK_LB ; }; -hidspecial HID_COLORPAGE_CALCREFERENCE_CB { HelpID = HID_COLORPAGE_CALCREFERENCE_CB ; }; -hidspecial HID_COLORPAGE_CALCREFERENCE_LB { HelpID = HID_COLORPAGE_CALCREFERENCE_LB ; }; -hidspecial HID_COLORPAGE_DOCBOUNDARIES_CB { HelpID = HID_COLORPAGE_DOCBOUNDARIES_CB ; }; -hidspecial HID_COLORPAGE_DOCBOUNDARIES_LB { HelpID = HID_COLORPAGE_DOCBOUNDARIES_LB ; }; -hidspecial HID_COLORPAGE_DOCCOLOR_CB { HelpID = HID_COLORPAGE_DOCCOLOR_CB ; }; -hidspecial HID_COLORPAGE_DOCCOLOR_LB { HelpID = HID_COLORPAGE_DOCCOLOR_LB ; }; -hidspecial HID_COLORPAGE_DRAWDRAWING_CB { HelpID = HID_COLORPAGE_DRAWDRAWING_CB ; }; -hidspecial HID_COLORPAGE_DRAWDRAWING_LB { HelpID = HID_COLORPAGE_DRAWDRAWING_LB ; }; -hidspecial HID_COLORPAGE_DRAWFILL_CB { HelpID = HID_COLORPAGE_DRAWFILL_CB ; }; -hidspecial HID_COLORPAGE_DRAWFILL_LB { HelpID = HID_COLORPAGE_DRAWFILL_LB ; }; -hidspecial HID_COLORPAGE_DRAWGRID_CB { HelpID = HID_COLORPAGE_DRAWGRID_CB ; }; -hidspecial HID_COLORPAGE_DRAWGRID_LB { HelpID = HID_COLORPAGE_DRAWGRID_LB ; }; -hidspecial HID_COLORPAGE_FONTCOLOR_CB { HelpID = HID_COLORPAGE_FONTCOLOR_CB ; }; -hidspecial HID_COLORPAGE_FONTCOLOR_LB { HelpID = HID_COLORPAGE_FONTCOLOR_LB ; }; -hidspecial HID_COLORPAGE_HTMLCOMMENT_CB { HelpID = HID_COLORPAGE_HTMLCOMMENT_CB ; }; -hidspecial HID_COLORPAGE_HTMLCOMMENT_LB { HelpID = HID_COLORPAGE_HTMLCOMMENT_LB ; }; -hidspecial HID_COLORPAGE_HTMLKEYWORD_CB { HelpID = HID_COLORPAGE_HTMLKEYWORD_CB ; }; -hidspecial HID_COLORPAGE_HTMLKEYWORD_LB { HelpID = HID_COLORPAGE_HTMLKEYWORD_LB ; }; -hidspecial HID_COLORPAGE_HTMLSGML_CB { HelpID = HID_COLORPAGE_HTMLSGML_CB ; }; -hidspecial HID_COLORPAGE_HTMLSGML_LB { HelpID = HID_COLORPAGE_HTMLSGML_LB ; }; -hidspecial HID_COLORPAGE_HTMLUNKNOWN_CB { HelpID = HID_COLORPAGE_HTMLUNKNOWN_CB ; }; -hidspecial HID_COLORPAGE_HTMLUNKNOWN_LB { HelpID = HID_COLORPAGE_HTMLUNKNOWN_LB ; }; -hidspecial HID_COLORPAGE_LINKSVISITED_CB { HelpID = HID_COLORPAGE_LINKSVISITED_CB ; }; -hidspecial HID_COLORPAGE_LINKSVISITED_LB { HelpID = HID_COLORPAGE_LINKSVISITED_LB ; }; -hidspecial HID_COLORPAGE_LINKS_CB { HelpID = HID_COLORPAGE_LINKS_CB ; }; -hidspecial HID_COLORPAGE_LINKS_LB { HelpID = HID_COLORPAGE_LINKS_LB ; }; -hidspecial HID_COLORPAGE_OBJECTBOUNDARIES_CB { HelpID = HID_COLORPAGE_OBJECTBOUNDARIES_CB ; }; -hidspecial HID_COLORPAGE_OBJECTBOUNDARIES_LB { HelpID = HID_COLORPAGE_OBJECTBOUNDARIES_LB ; }; -hidspecial HID_COLORPAGE_SPELL_CB { HelpID = HID_COLORPAGE_SPELL_CB ; }; -hidspecial HID_COLORPAGE_SPELL_LB { HelpID = HID_COLORPAGE_SPELL_LB ; }; -hidspecial HID_COLORPAGE_TABLEBOUNDARIES_CB { HelpID = HID_COLORPAGE_TABLEBOUNDARIES_CB ; }; -hidspecial HID_COLORPAGE_TABLEBOUNDARIES_LB { HelpID = HID_COLORPAGE_TABLEBOUNDARIES_LB ; }; -hidspecial HID_COLORPAGE_WRITERDIRECTCURSOR_CB { HelpID = HID_COLORPAGE_WRITERDIRECTCURSOR_CB ; }; -hidspecial HID_COLORPAGE_WRITERDIRECTCURSOR_LB { HelpID = HID_COLORPAGE_WRITERDIRECTCURSOR_LB ; }; -hidspecial HID_COLORPAGE_WRITERFIELDSHADINGS_CB { HelpID = HID_COLORPAGE_WRITERFIELDSHADINGS_CB ; }; -hidspecial HID_COLORPAGE_WRITERFIELDSHADINGS_LB { HelpID = HID_COLORPAGE_WRITERFIELDSHADINGS_LB ; }; -hidspecial HID_COLORPAGE_WRITERIDXSHADINGS_CB { HelpID = HID_COLORPAGE_WRITERIDXSHADINGS_CB ; }; -hidspecial HID_COLORPAGE_WRITERIDXSHADINGS_LB { HelpID = HID_COLORPAGE_WRITERIDXSHADINGS_LB ; }; -hidspecial HID_COLORPAGE_WRITERNOTESINDICATOR_CB { HelpID = HID_COLORPAGE_WRITERNOTESINDICATOR_CB ; }; -hidspecial HID_COLORPAGE_WRITERNOTESINDICATOR_LB { HelpID = HID_COLORPAGE_WRITERNOTESINDICATOR_LB ; }; -hidspecial HID_COLORPAGE_WRITERPAGEBREAKS_CB { HelpID = HID_COLORPAGE_WRITERPAGEBREAKS_CB ; }; -hidspecial HID_COLORPAGE_WRITERPAGEBREAKS_LB { HelpID = HID_COLORPAGE_WRITERPAGEBREAKS_LB ; }; -hidspecial HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB { HelpID = HID_COLORPAGE_WRITERSCRIPTINDICATOR_CB ; }; -hidspecial HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB { HelpID = HID_COLORPAGE_WRITERSCRIPTINDICATOR_LB ; }; -hidspecial HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB { HelpID = HID_COLORPAGE_WRITERSECTIONBOUNDARIES_CB ; }; -hidspecial HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB { HelpID = HID_COLORPAGE_WRITERSECTIONBOUNDARIES_LB ; }; -hidspecial HID_COLORPAGE_WRITERTEXTGRID_CB { HelpID = HID_COLORPAGE_WRITERTEXTGRID_CB ; }; -hidspecial HID_COLORPAGE_WRITERTEXTGRID_LB { HelpID = HID_COLORPAGE_WRITERTEXTGRID_LB ; }; -hidspecial HID_DBPATH_CTL_PATH { HelpId = HID_DBPATH_CTL_PATH; }; -hidspecial HID_DBPATH_HEADERBAR { HelpId = HID_DBPATH_HEADERBAR; }; -hidspecial HID_GALLERY_EDIT_MSNAME { HelpID = HID_GALLERY_EDIT_MSNAME ; }; -hidspecial HID_GALLERY_NEWTHEME_ADDFILES { HelpID = HID_GALLERY_NEWTHEME_ADDFILES; }; -hidspecial HID_GALLERY_NEWTHEME_FINDFILES { HelpID = HID_GALLERY_NEWTHEME_FINDFILES; }; -hidspecial HID_HANGULDLG_BUTTON_CHANGE { HelpID = HID_HANGULDLG_BUTTON_CHANGE ; }; -hidspecial HID_HANGULDLG_BUTTON_CHANGEALL { HelpID = HID_HANGULDLG_BUTTON_CHANGEALL; }; -hidspecial HID_HANGULDLG_BUTTON_CLOSE { HelpID = HID_HANGULDLG_BUTTON_CLOSE ; }; -hidspecial HID_HANGULDLG_BUTTON_IGNORE { HelpID = HID_HANGULDLG_BUTTON_IGNORE ; }; -hidspecial HID_HANGULDLG_BUTTON_IGNOREALL { HelpID = HID_HANGULDLG_BUTTON_IGNOREALL; }; -hidspecial HID_HANGULDLG_BUTTON_OPTIONS { HelpId = HID_HANGULDLG_BUTTON_OPTIONS; }; -hidspecial HID_HANGULDLG_EDIT_NEWWORD { HelpID = HID_HANGULDLG_EDIT_NEWWORD ; }; -hidspecial HID_HANGULDLG_SUGGESTIONS { HelpId = HID_HANGULDLG_SUGGESTIONS; }; -hidspecial HID_HANGULDLG_SUGGESTIONS_GRID { HelpId = HID_HANGULDLG_SUGGESTIONS_GRID; }; -hidspecial HID_HANGULDLG_SUGGESTIONS_LIST { HelpId = HID_HANGULDLG_SUGGESTIONS_LIST; }; -hidspecial HID_HYPERLINK_DIALOG { HelpID = HID_HYPERLINK_DIALOG ;}; -hidspecial HID_HYPERDLG_DOC_PATH { HelpID = HID_HYPERDLG_DOC_PATH ;}; -hidspecial HID_HYPERDLG_INET_PATH { HelpID = HID_HYPERDLG_INET_PATH ;}; -hidspecial HID_HYPERDLG_MAIL_PATH { HelpID = HID_HYPERDLG_MAIL_PATH ;}; -hidspecial HID_ICCDIALOG_CANCEL_BTN { HelpID = HID_ICCDIALOG_CANCEL_BTN ;}; -hidspecial HID_ICCDIALOG_CHOICECTRL { HelpID = HID_ICCDIALOG_CHOICECTRL ;}; -hidspecial HID_ICCDIALOG_OK_BTN { HelpID = HID_ICCDIALOG_OK_BTN ;}; -hidspecial HID_ICCDIALOG_RESET_BTN { HelpID = HID_ICCDIALOG_RESET_BTN ;}; -hidspecial HID_LINKDLG_TABLB { HelpId = HID_LINKDLG_TABLB; }; -hidspecial HID_NUMBERINGOPT_SEL_GRF_FROM_FILE { HelpID = HID_NUMBERINGOPT_SEL_GRF_FROM_FILE; }; -hidspecial HID_OFADLG_TREELISTBOX { HelpId = HID_OFADLG_TREELISTBOX; }; -hidspecial HID_OFAPAGE_AUTOCORR_CLB { HelpId = HID_OFAPAGE_AUTOCORR_CLB; }; -hidspecial HID_OFAPAGE_AUTOFORMAT_CLB { HelpId = HID_OFAPAGE_AUTOFORMAT_CLB; }; -hidspecial HID_OFAPAGE_MSFLTR2_CLB { HelpId = HID_OFAPAGE_MSFLTR2_CLB ; }; -hidspecial HID_OFAPAGE_QUOTE_CLB { HelpId = HID_OFAPAGE_QUOTE_CLB; }; -hidspecial HID_OFAPAGE_QUOTE_SW_CLB { HelpId = HID_OFAPAGE_QUOTE_SW_CLB; }; -hidspecial HID_OFA_CONNPOOL_DRIVERLIST { HelpId = HID_OFA_CONNPOOL_DRIVERLIST; }; -hidspecial HID_OFA_FONT_SUBST_CLB { HelpId = HID_OFA_FONT_SUBST_CLB; }; -hidspecial HID_OPTIONS_COLORCONFIG_COLORLIST_WIN { HelpID = HID_OPTIONS_COLORCONFIG_COLORLIST_WIN ;}; -hidspecial HID_OPTIONS_COLORCONFIG_NAME_SCHEME { HelpID = HID_OPTIONS_COLORCONFIG_NAME_SCHEME ;}; -hidspecial HID_OPTIONS_COLORCONFIG_SAVE_SCHEME { HelpID = HID_OPTIONS_COLORCONFIG_SAVE_SCHEME ;}; -hidspecial HID_OPTIONS_JAVA_LIST { HelpId = HID_OPTIONS_JAVA_LIST; }; -hidspecial HID_OPTIONS_PATHS_SELECTFOLDER { HelpID = HID_OPTIONS_PATHS_SELECTFOLDER; }; -hidspecial HID_OPTPATH_CTL_PATH { HelpId = HID_OPTPATH_CTL_PATH ;}; -hidspecial HID_OPTPATH_HEADERBAR { HelpId = HID_OPTPATH_HEADERBAR ;}; -hidspecial HID_PASTE_DLG { HelpId = HID_PASTE_DLG; }; -hidspecial HID_REDLINING_DLG { HelpID = HID_REDLINING_DLG; }; -hidspecial HID_REDLINING_EDIT { HelpID = HID_REDLINING_EDIT; }; -hidspecial HID_REDLINING_NEXT { HelpID = HID_REDLINING_NEXT; }; -hidspecial HID_REDLINING_PREV { HelpID = HID_REDLINING_PREV; }; -hidspecial HID_SCRIPTSBOX { HelpId = HID_SCRIPTSBOX; }; -hidspecial HID_SELECTOR_CATEGORIES { HelpId = HID_SELECTOR_CATEGORIES; }; -hidspecial HID_SELECTOR_COMMANDS { HelpId = HID_SELECTOR_COMMANDS; }; -hidspecial HID_SELECTOR_DIALOG { HelpId = HID_SELECTOR_DIALOG; }; -hidspecial HID_SPLDLG_BUTTON_CHANGE { HelpID = HID_SPLDLG_BUTTON_CHANGE ; }; -hidspecial HID_SPLDLG_BUTTON_CHANGEALL { HelpID = HID_SPLDLG_BUTTON_CHANGEALL ; }; -hidspecial HID_SPLDLG_BUTTON_CLOSE { HelpID = HID_SPLDLG_BUTTON_CLOSE ; }; -hidspecial HID_SPLDLG_BUTTON_EXPLAIN { HelpID = HID_SPLDLG_BUTTON_EXPLAIN ; }; -hidspecial HID_SPLDLG_BUTTON_IGNORE { HelpID = HID_SPLDLG_BUTTON_IGNORE ; }; -hidspecial HID_SPLDLG_BUTTON_IGNOREALL { HelpID = HID_SPLDLG_BUTTON_IGNOREALL ; }; -hidspecial HID_SPLDLG_BUTTON_IGNORERULE { HelpID = HID_SPLDLG_BUTTON_IGNORERULE ; }; -hidspecial HID_SVX_CONFIG_EVENT { HelpId = HID_SVX_CONFIG_EVENT; }; -hidspecial HID_SVX_CONFIG_ICON_SELECTOR { HelpId = HID_SVX_CONFIG_ICON_SELECTOR; }; -hidspecial HID_SVX_CONFIG_MENU { HelpId = HID_SVX_CONFIG_MENU; }; -hidspecial HID_SVX_CONFIG_MENU_CONTENTS { HelpId = HID_SVX_CONFIG_MENU_CONTENTS; }; -hidspecial HID_SVX_CONFIG_MENU_ORGANIZER { HelpId = HID_SVX_CONFIG_MENU_ORGANIZER; }; -hidspecial HID_SVX_CONFIG_NAME_SUBMENU { HelpId = HID_SVX_CONFIG_NAME_SUBMENU; }; -hidspecial HID_SVX_CONFIG_RENAME_MENU { HelpId = HID_SVX_CONFIG_RENAME_MENU; }; -hidspecial HID_SVX_CONFIG_RENAME_MENU_ITEM { HelpId = HID_SVX_CONFIG_RENAME_MENU_ITEM; }; -hidspecial HID_SVX_CONFIG_RENAME_TOOLBAR { HelpId = HID_SVX_CONFIG_RENAME_TOOLBAR; }; -hidspecial HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM { HelpId = HID_SVX_CONFIG_RENAME_TOOLBAR_ITEM; }; -hidspecial HID_SVX_CONFIG_TOOLBAR { HelpId = HID_SVX_CONFIG_TOOLBAR; }; -hidspecial HID_SVX_CONFIG_TOOLBAR_CONTENTS { HelpId = HID_SVX_CONFIG_TOOLBAR_CONTENTS; }; -hidspecial HID_SVX_MACRO_LB_EVENT { HelpId = HID_SVX_MACRO_LB_EVENT; }; -hidspecial HID_SVX_MODIFY_TOOLBAR { HelpId = HID_SVX_MODIFY_TOOLBAR; }; -hidspecial HID_SVX_MODIFY_TOOLBAR_ITEM { HelpId = HID_SVX_MODIFY_TOOLBAR_ITEM; }; -hidspecial HID_SVX_NEW_TOOLBAR { HelpId = HID_SVX_NEW_TOOLBAR; }; -hidspecial HID_SVX_NEW_TOOLBAR_ITEM { HelpId = HID_SVX_NEW_TOOLBAR_ITEM; }; -hidspecial HID_SVX_SAVE_IN { HelpId = HID_SVX_SAVE_IN; }; -hidspecial HID_TPCOLOR_CMYK_1 { HelpID = HID_TPCOLOR_CMYK_1; }; -hidspecial HID_TPCOLOR_CMYK_2 { HelpID = HID_TPCOLOR_CMYK_2; }; -hidspecial HID_TPCOLOR_CMYK_3 { HelpID = HID_TPCOLOR_CMYK_3; }; -hidspecial HID_TPCOLOR_RGB_1 { HelpID = HID_TPCOLOR_RGB_1; }; -hidspecial HID_TPCOLOR_RGB_2 { HelpID = HID_TPCOLOR_RGB_2; }; -hidspecial HID_TPCOLOR_RGB_3 { HelpID = HID_TPCOLOR_RGB_3; }; -hidspecial HID_VALUESET_BULLET { HelpID = HID_VALUESET_BULLET ;}; -hidspecial HID_VALUESET_NUM { HelpID = HID_VALUESET_NUM ;}; -hidspecial HID_VALUESET_NUMBMP { HelpID = HID_VALUESET_NUMBMP ;}; -hidspecial HID_VALUESET_SINGLENUM { HelpID = HID_VALUESET_SINGLENUM ;}; -hidspecial HID_WARN_NAME_DUPLICATE { HelpID = HID_WARN_NAME_DUPLICATE ;}; -hidspecial UID_OFA_CONNPOOL_DRIVERLIST_BACK { HelpId = UID_OFA_CONNPOOL_DRIVERLIST_BACK; }; -hidspecial UID_SEARCH_RECORDSTATUS { HelpID = UID_SEARCH_RECORDSTATUS ;}; -hidspecial HID_MACRO_HEADERTABLISTBOX { HelpID = HID_MACRO_HEADERTABLISTBOX ;}; -hidspecial HID_DLG_PASSWORD_TO_OPEN_MODIFY { HelpID = HID_DLG_PASSWORD_TO_OPEN_MODIFY ;}; - diff --git a/embedserv/prj/build.lst b/embedserv/prj/build.lst deleted file mode 100644 index a6cfd10ea..000000000 --- a/embedserv/prj/build.lst +++ /dev/null @@ -1,5 +0,0 @@ -es embedserv : offapi sal cppu cppuhelper comphelper LIBXSLT:libxslt NULL -es embedserv usr1 - w es_mkout NULL -es embedserv\source\embed nmake - w es_embed NULL -es embedserv\source\inprocserv nmake - w es_inproc NULL -es embedserv\util nmake - w es_util es_embed.w es_inproc.w NULL diff --git a/embedserv/prj/d.lst b/embedserv/prj/d.lst deleted file mode 100644 index 292dfe821..000000000 --- a/embedserv/prj/d.lst +++ /dev/null @@ -1,2 +0,0 @@ -..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll -..\%__SRC%\misc\emser.component %_DEST%\xml\emser.component diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx deleted file mode 100644 index f18f43c7e..000000000 --- a/embedserv/source/embed/docholder.cxx +++ /dev/null @@ -1,1533 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - - -#include "xwin.hxx" -#include "docholder.hxx" -#include "embeddoc.hxx" -#include "intercept.hxx" -#include "syswinwrapper.hxx" -#include "iipaobj.hxx" - -#include "common.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; - -extern ::rtl::OUString getFilterNameFromGUID_Impl( GUID* ); - -// add mutex locking ??? - -DocumentHolder::DocumentHolder( - const uno::Reference& xFactory, - const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess ) - : - m_bAllowInPlace(true), - m_pIOleIPSite(0), - m_pIOleIPFrame(0), - m_pIOleIPUIWindow(0), - m_pCHatchWin(0), - m_xOleAccess( xOleAccess ), - m_pInterceptor(0), - m_xFactory( xFactory ), - m_bOnDeactivate(false), - m_hWndxWinParent(NULL), - m_hWndxWinCont(NULL), - m_nMenuHandle(NULL), - m_nMenuShared(NULL), - m_nOLEMenu(NULL), - m_nMacroExecMode( document::MacroExecMode::USE_CONFIG ), - m_bLink( sal_False ) -{ - static const ::rtl::OUString aServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( (frame::XTerminateListener*)this ); -} - - -DocumentHolder::~DocumentHolder() -{ - delete m_pCHatchWin; - - ClearInterceptorInternally(); -} - - -void DocumentHolder::LoadDocInFrame( sal_Bool bPluginMode ) -{ - uno::Reference xComponentLoader( - m_xFrame,uno::UNO_QUERY); - if( xComponentLoader.is() && m_xDocument.is() ) - { - uno::Reference< task::XInteractionHandler > xHandler( - m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY ); - - uno::Any aAny; - sal_Int32 nLen = 3; - uno::Sequence aSeq( nLen ); - - aAny <<= uno::Reference( - m_xDocument, uno::UNO_QUERY); - aSeq[0] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Model")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - - aAny <<= sal_False; - aSeq[1] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("ReadOnly")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - - aAny <<= (sal_Bool) sal_True; - aSeq[2] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - - if ( bPluginMode ) - { - aSeq.realloc( ++nLen ); - aAny <<= (sal_Int16) 3; - aSeq[nLen-1] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("PluginMode")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - } - - if ( xHandler.is() ) - { - aSeq.realloc( nLen+=2 ); - aAny <<= xHandler; - aSeq[nLen-2] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - - aAny <<= m_nMacroExecMode; - aSeq[nLen-1] = beans::PropertyValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")), - -1, - aAny, - beans::PropertyState_DIRECT_VALUE); - } - - xComponentLoader->loadComponentFromURL( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("private:object")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), - 0, - aSeq); - - uno::Sequence< beans::PropertyValue > aResArgs = m_xDocument->getArgs(); - for ( int nInd = 0; nInd < aResArgs.getLength(); nInd++ ) - if ( aResArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MacroExecutionMode" ) ) ) ) - { - aResArgs[nInd].Value >>= m_nMacroExecMode; - break; - } - } -} - -void DocumentHolder::OnPosRectChanged(LPRECT lpRect) const -{ - lpRect->left += m_aBorder.left; - lpRect->right -= m_aBorder.right; - lpRect->top += m_aBorder.top; - lpRect->bottom -= m_aBorder.bottom; - if(m_pIOleIPSite) - m_pIOleIPSite->OnPosRectChange(lpRect); -} - - - -void DocumentHolder::DisableInplaceActivation(BOOL b) -{ - m_bAllowInPlace = ! b; -} - -BOOL DocumentHolder::isActive() const -{ - return m_pIOleIPSite != 0; -} - -HRESULT DocumentHolder::InPlaceActivate( - LPOLECLIENTSITE pActiveSite, - BOOL fIncludeUI) -{ - m_bOnDeactivate = false; - - if(!m_bAllowInPlace) - return ERROR; - - HRESULT hr; - HWND hWndSite; - RECT rcPos; - RECT rcClip; - OLEINPLACEFRAMEINFO frameInfo; - - if (NULL==pActiveSite) - return ResultFromScode(E_INVALIDARG); - - if (NULL!=m_pIOleIPSite) - { - if (fIncludeUI) - UIActivate(); - - return NOERROR; - } - - if ( !m_xDocument.is() ) - return ERROR; - - //1. Initialization, obtaining interfaces, OnInPlaceActivate. - hr=pActiveSite->QueryInterface( - IID_IOleInPlaceSite, - (void**) &m_pIOleIPSite); - - if (FAILED(hr)) - return hr; - - hr=m_pIOleIPSite->CanInPlaceActivate(); - - if (NOERROR!=hr) - { - m_pIOleIPSite->Release(), m_pIOleIPSite=NULL; - return ResultFromScode(E_FAIL); - } - - m_pIOleIPSite->OnInPlaceActivate(); - - //2. Get the site window - //3. and determine container frame and - // document window for tools and menus, as well - // as frameInfo for accelerators - m_pIOleIPSite->GetWindow(&hWndSite); - - frameInfo.cb=sizeof(OLEINPLACEFRAMEINFO); - m_pIOleIPSite->GetWindowContext( - &m_pIOleIPFrame,&m_pIOleIPUIWindow,&rcPos,&rcClip,&frameInfo); - - // initialize the office as, with hwnd as parentwindow - uno::Any aAny; - uno::Sequence aProcessIdent(16); - rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); - - try - { - if(!m_xEditWindow.is()) - { // determine XWindow and window handle of parent - HWND hWndxWinParent(0); - uno::Reference xWin; - - static const ::rtl::OUString aToolkitServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) ); - uno::Reference xToolkit( - m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY); - - if(xToolkit.is()) { - // create system window wrapper for hwnd - if( !m_pCHatchWin ) - m_pCHatchWin = new winwrap::CHatchWin( - m_hInstance,this); - - if(m_pCHatchWin->Init(hWndSite,/*ID_HATCHWINDOW*/2000, NULL)) { - m_pCHatchWin->RectsSet(&rcPos,&rcClip); //set visible area - hWndxWinParent = m_pCHatchWin->Window(); - ShowWindow(hWndxWinParent,SW_SHOW); //Make visible. - } - else { - // no success initializing hatch window - delete m_pCHatchWin, m_pCHatchWin = 0; - hWndxWinParent = hWndSite; - } - - aAny <<= sal_Int32(hWndxWinParent); - xWin = uno::Reference( - xToolkit->createSystemChild( - aAny, - aProcessIdent, - lang::SystemDependent::SYSTEM_WIN32), - uno::UNO_QUERY); - } - - if(xWin.is()) { - xWin->setPosSize( - m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - rcPos.right-rcPos.left, - rcPos.bottom - rcPos.top, - awt::PosSize::POSSIZE); - xWin->setVisible(sal_True); - - m_xEditWindow = xWin; - m_hWndxWinParent = hWndxWinParent; - } - else - return ERROR; - } - else { - if(m_hWndxWinParent) { - SetParent(m_hWndxWinParent,hWndSite); - ShowWindow(m_hWndxWinParent,SW_SHOW); //Make visible. - } - - if ( !m_xFrame.is() ) - // initially set size to "empty", this guarantees that the final resize - // is always executed (will be done by "SetObjectRects" after getting internal border) - m_xEditWindow->setPosSize( - 0, - 0, - 0, - 0, - awt::PosSize::POSSIZE); - m_xEditWindow->setVisible(sal_True); - } - - if(m_xContainerWindow.is()) { - if(m_hWndxWinCont) { - if(m_pIOleIPFrame) { - HWND hWndCont; - m_pIOleIPFrame->GetWindow(&hWndCont); - SetParent(m_hWndxWinCont,hWndCont); - ShowWindow(m_hWndxWinCont,SW_SHOW); - } - } - m_xContainerWindow->setVisible(true); - } - - if(m_xFrame.is()) - m_xFrame->activate(); - else { - // create frame and initialize it with with the created window - static const ::rtl::OUString aFrameServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Frame" ) ); - m_xFrame = uno::Reference( - m_xFactory->createInstance(aFrameServiceName), - uno::UNO_QUERY); - - if(!m_xFrame.is()) - return ERROR; - - m_xFrame->initialize(m_xEditWindow); - - uno::Reference - xDPI(m_xFrame,uno::UNO_QUERY); - if(xDPI.is()) - xDPI->registerDispatchProviderInterceptor( CreateNewInterceptor() ); - - uno::Reference xPS(m_xFrame,uno::UNO_QUERY); - if( xPS.is() ) - { - aAny = xPS->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager"))); - aAny >>= m_xLayoutManager; - } - - if(m_xLayoutManager.is()) - m_xLayoutManager->setDockingAreaAcceptor(this); - - // load the model into the frame - LoadDocInFrame( sal_True ); - - static const ::rtl::OUString aDesktopServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XFramesSupplier > xDesktop( - m_xFactory->createInstance( aDesktopServiceName ), - uno::UNO_QUERY ); - if(xDesktop.is()) - xDesktop->getFrames()->append(m_xFrame); - - // determine the menuhandle to get menutitems. - if(m_xLayoutManager.is()) { - uno::Reference< ::com::sun::star::ui::XUIElement > xUIEl( - m_xLayoutManager->getElement( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "private:resource/menubar/menubar")))); - OSL_ENSURE(xUIEl.is(),"no menubar"); - uno::Reference xSDMP( - xUIEl->getRealInterface(), - uno::UNO_QUERY); - aAny = xSDMP->getMenuHandle( - aProcessIdent,lang::SystemDependent::SYSTEM_WIN32); - sal_Int32 tmp; - if( aAny >>= tmp ) - m_nMenuHandle = HMENU(tmp); - m_xLayoutManager->hideElement( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "private:resource/menubar/menubar" ))); - } - } - - // TODO/cd: Workaround for status indicator bug. It always makes the - // document window visible, when someone tries to use the status - // indicator. As we save our document when we get the deactivation - // from OLE this conflict to hide floating windows. - if(m_xLayoutManager.is()) - m_xLayoutManager->setVisible(true); - - // get document border and resize rects according to border - GetDocumentBorder( &m_aBorder ); - SetObjectRects( &rcPos, &rcClip ); - - if ( m_xOleAccess.is() ) - { - LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument(); - if ( aDocLock.GetEmbedDocument() ) - aDocLock.GetEmbedDocument()->ShowObject(); - } - - // setTitle(m_aDocumentNamePart); - if (fIncludeUI) - hr=UIActivate(); - - m_pIOleIPSite->DiscardUndoState(); - } - catch( uno::Exception& ) - { - hr = ERROR; - } - - return hr; -} - - -void DocumentHolder::InPlaceDeactivate(void) -{ - m_bOnDeactivate = true; - - UIDeactivate(); - if(m_xFrame.is()) m_xFrame->deactivate(); - - if(m_xEditWindow.is()) { - m_xEditWindow->setVisible(false); - ShowWindow(m_hWndxWinParent,SW_HIDE); - SetParent(m_hWndxWinParent,0); - } - - if(m_xContainerWindow.is()) { - m_xContainerWindow->setVisible(false); - ShowWindow(m_hWndxWinCont,SW_HIDE); - SetParent(m_hWndxWinCont,0); - } - - // TODO/cd: Workaround for status indicator bug. It always makes the - // document window visible, when someone tries to use the status - // indicator. As we save our document when we get the deactivation - // from OLE this conflict to hide floating windows. - if (m_xLayoutManager.is()) - m_xLayoutManager->setVisible(false); - - if (NULL!=m_pIOleIPSite) - m_pIOleIPSite->OnInPlaceDeactivate(); - - if(m_pIOleIPFrame) m_pIOleIPFrame->Release(); m_pIOleIPFrame = 0; - if(m_pIOleIPUIWindow) m_pIOleIPUIWindow->Release(); m_pIOleIPUIWindow = 0; - if(m_pIOleIPSite) m_pIOleIPSite->Release(); m_pIOleIPSite = 0; - - if ( m_xOleAccess.is() ) - { - LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument(); - if ( aDocLock.GetEmbedDocument() ) - { - aDocLock.GetEmbedDocument()->SaveObject(); - } - } - - return; -} - - -HRESULT DocumentHolder::UIActivate() -{ - // 1. Call IOleInPlaceSite::UIActivate - if (NULL!=m_pIOleIPSite) - m_pIOleIPSite->OnUIActivate(); - - //2. Critical for accelerators to work initially. - SetFocus(m_pCHatchWin->Window()); - // if(m_xEditWindow.is()) m_xEditWindow->setFocus(); - - //3. Set the active object - - OLECHAR starOffice[] = {'S','t','a','r','O','f','f','i','c','e',0}; - CComPtr< IOleInPlaceActiveObject > pObj = new CIIAObj( this ); - - if (NULL!=m_pIOleIPFrame) - m_pIOleIPFrame->SetActiveObject( - pObj, starOffice ); - - if (NULL!=m_pIOleIPUIWindow) - m_pIOleIPUIWindow->SetActiveObject( - pObj, starOffice ); - - //4. Create the shared menu. - InPlaceMenuCreate(); - - return NOERROR; -} - -void DocumentHolder::UIDeactivate() -{ - //1. Remove the shared menu. - InPlaceMenuDestroy(); - - if (NULL!=m_pIOleIPFrame) - m_pIOleIPFrame->SetActiveObject(NULL, NULL); - - if (NULL!=m_pIOleIPUIWindow) - m_pIOleIPUIWindow->SetActiveObject(NULL, NULL); - - //3. Call IOleInPlaceSite::OnUIDeactivate - if (NULL!=m_pIOleIPSite) - m_pIOleIPSite->OnUIDeactivate(FALSE); - - return; -} - -void CopyToOLEMenu(HMENU hOrig,WORD origPos,HMENU hDest,WORD destPos) -{ - HMENU subMenu(NULL); - UINT uTemp = MF_BYPOSITION | MF_POPUP; - char buffer[256]; - - subMenu = GetSubMenu(hOrig,origPos); - GetMenuString(hOrig,origPos,buffer,256,MF_BYPOSITION); - InsertMenu(hDest,destPos,uTemp, - (UINT)subMenu,LPCTSTR(buffer)); - - MENUITEMINFOW mi; - memset(&mi,0,sizeof(mi)); - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA; - if(GetMenuItemInfoW(hOrig,origPos,TRUE,&mi)) - SetMenuItemInfoW(hDest,(WORD)destPos,TRUE,&mi); -} - -BOOL DocumentHolder::InPlaceMenuCreate(void) -{ - HMENU hMenu; - UINT i; - OLEMENUGROUPWIDTHS mgw; - - for (i=0; i<6; i++) - mgw.width[i]=0; - - //We already have popup menu handles in m_pFR->m_phMenu[] - - //Create the new shared menu and let container do its thing - hMenu=CreateMenu(); - m_pIOleIPFrame->InsertMenus(hMenu,&mgw); - - int count = GetMenuItemCount(m_nMenuHandle); - int help = count-1; - - // start with 1, because we don't include "File" - WORD pos = (WORD)mgw.width[0]; - CopyToOLEMenu(m_nMenuHandle,1,hMenu,pos); - mgw.width[1] = 1; - - // insert object menu here - pos = ((WORD)(mgw.width[0] + mgw.width[1] + mgw.width[2])); - for(WORD i = 2; i < help-1; ++i,++pos) - CopyToOLEMenu(m_nMenuHandle,i,hMenu,pos); - mgw.width[3] = help - 3; - - // insert help menu - pos = (WORD)(mgw.width[0] + mgw.width[1] + mgw.width[2] + - mgw.width[3] + mgw.width[4]); - CopyToOLEMenu(m_nMenuHandle,WORD(help),hMenu,pos); - mgw.width[5] = 1; - - m_nMenuShared = hMenu; - m_nOLEMenu = OleCreateMenuDescriptor(m_nMenuShared,&mgw); - - uno::Reference xSysDepWin(m_xContainerWindow,uno::UNO_QUERY); - if(xSysDepWin.is()) { - uno::Sequence aProcessIdent(16); - rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); - uno::Any aAny = xSysDepWin->getWindowHandle(aProcessIdent,lang::SystemDependent::SYSTEM_WIN32); - sal_Int32 tmp; - aAny >>= tmp; - HWND aHwnd = (HWND) tmp; - m_pIOleIPFrame->SetMenu( - m_nMenuShared,m_nOLEMenu,aHwnd); - } - else - m_pIOleIPFrame->SetMenu( - m_nMenuShared,m_nOLEMenu,::GetWindow(m_hWndxWinParent,GW_CHILD)); - return TRUE; -} - -BOOL DocumentHolder::InPlaceMenuDestroy(void) -{ - if( NULL == m_nMenuShared ) - return TRUE; - - m_pIOleIPFrame->SetMenu(NULL,NULL,NULL); - - OleDestroyMenuDescriptor(m_nOLEMenu),m_nOLEMenu = NULL; - return TRUE; -} - -void DocumentHolder::OpenIntoWindow(void) -{ - // not implemented -} - -BOOL DocumentHolder::Undo(void) -{ - // not implemented - return false; -} - - -void DocumentHolder::FreeOffice() -{ - const ::rtl::OUString aServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) ); - uno::Reference< frame::XDesktop > xDesktop( - m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - if ( xDesktop.is() ) - { - xDesktop->removeTerminateListener( - (frame::XTerminateListener*)this ); - } -} - -void DocumentHolder::DisconnectFrameDocument( sal_Bool bComplete ) -{ - try - { - uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW ); - xModifiable->removeModifyListener( (util::XModifyListener*)this ); - } - catch( uno::Exception& ) - {} - - try - { - uno::Reference< util::XCloseBroadcaster > xBroadcaster( - m_xDocument, uno::UNO_QUERY_THROW ); - xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - } - catch( uno::Exception& ) - {} - - try - { - uno::Reference< util::XCloseBroadcaster > xBroadcaster( - m_xFrame, uno::UNO_QUERY_THROW ); - xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - } - catch( uno::Exception& ) - {} - - if ( bComplete ) - { - m_xFrame = uno::Reference< frame::XFrame>(); - m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); - } -} - -void DocumentHolder::CloseDocument() -{ - DisconnectFrameDocument(); - - uno::Reference< util::XCloseable > xCloseable( - m_xDocument, uno::UNO_QUERY ); - - if ( xCloseable.is() ) - { - try - { - xCloseable->close( sal_True ); - } - catch( uno::Exception& ) - {} - } - - m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); -} - - -void DocumentHolder::CloseFrame() -{ - try - { - uno::Reference< util::XCloseBroadcaster > xBroadcaster( - m_xFrame, uno::UNO_QUERY_THROW ); - xBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - } - catch( uno::Exception& ) - {} - - uno::Reference xCloseable( - m_xFrame,uno::UNO_QUERY); - if(xCloseable.is()) - try { - xCloseable->close(sal_True); - } - catch( const uno::Exception& ) { - } - else { - uno::Reference xComp(m_xFrame,uno::UNO_QUERY); - if(xComp.is()) - xComp->dispose(); - } - - m_xFrame = uno::Reference< frame::XFrame >(); -} - -void DocumentHolder::SetDocument( const uno::Reference< frame::XModel >& xDoc, sal_Bool bLink ) -{ - if ( m_xDocument.is() ) - CloseDocument(); - - m_xDocument = xDoc; - m_bLink = bLink; - - uno::Reference< util::XCloseBroadcaster > xBroadcaster( - m_xDocument, uno::UNO_QUERY ); - - if ( xBroadcaster.is() ) - xBroadcaster->addCloseListener( (util::XCloseListener*)this ); - - if ( m_xDocument.is() && !m_bLink ) - { - // set the document mode to embedded - uno::Sequence< beans::PropertyValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SetEmbedded" )); - aSeq[0].Value <<= sal_True; - m_xDocument->attachResource(::rtl::OUString(),aSeq); - } -} - -sal_Bool DocumentHolder::ExecuteSuspendCloseFrame() -{ - if ( m_xFrame.is() && m_xFactory.is() ) - { - try - { - uno::Reference< frame::XController > xController = m_xFrame->getController(); - if ( xController.is() ) - { - if ( !xController->suspend( sal_True ) ) - return sal_False; - - FreeOffice(); - try - { - uno::Reference xCloseable( m_xFrame, uno::UNO_QUERY ); - if ( xCloseable.is() ) - xCloseable->close(sal_True); - else - { - uno::Reference xComp( m_xFrame, uno::UNO_QUERY_THROW ); - if( xComp.is() ) - xComp->dispose(); - } - } - catch( const util::CloseVetoException& ) - { - // should be called if the frame could not be closed - xController->suspend( sal_False ); - } - } - } - catch( uno::Exception& ) - { - } - - m_xFrame = uno::Reference< frame::XFrame >(); - } - - return sal_True; -} - -uno::Reference< frame::XFrame > DocumentHolder::DocumentFrame() -{ - if(! m_xFrame.is() ) - { - rtl::OUString aDesktopSrvNm( - RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")); - - uno::Reference xDesktop( - m_xFactory->createInstance(aDesktopSrvNm), - uno::UNO_QUERY); - - uno::Reference xFrame( - xDesktop,uno::UNO_QUERY); - - // the frame will be registered on desktop here, later when the document - // is loaded into the frame in ::show() method the terminate listener will be removed - // this is so only for outplace activation - if( xFrame.is() ) - m_xFrame = xFrame->findFrame( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")),0); - - uno::Reference< util::XCloseBroadcaster > xBroadcaster( - m_xFrame, uno::UNO_QUERY ); - - if ( xBroadcaster.is() ) - { - xBroadcaster->addCloseListener( (util::XCloseListener*)this ); - FreeOffice(); // the frame is part of the desktop - } - } - - if( m_xFrame.is() ) - { - // intercept - uno::Reference - xDPI(m_xFrame,uno::UNO_QUERY); - if(xDPI.is()) - xDPI->registerDispatchProviderInterceptor( CreateNewInterceptor() ); - } - - return m_xFrame; -} - - -uno::Reference< frame::XDispatchProviderInterceptor > DocumentHolder::CreateNewInterceptor() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - ClearInterceptorInternally(); - - uno::Reference< frame::XDispatchProviderInterceptor > xInterceptor( m_pInterceptor = new Interceptor( m_xOleAccess, this, m_bLink ) ); - m_xInterceptorLocker = xInterceptor; - return xInterceptor; -} - -void DocumentHolder::ClearInterceptorInternally() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - uno::Reference< frame::XDispatchProviderInterceptor > xInterceptor( m_xInterceptorLocker ); - if ( xInterceptor.is() && m_pInterceptor ) - m_pInterceptor->DisconnectDocHolder(); - - m_xInterceptorLocker = uno::Reference< frame::XDispatchProviderInterceptor >(); - m_pInterceptor = 0; -} - -void DocumentHolder::ClearInterceptor() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_xInterceptorLocker = uno::Reference< frame::XDispatchProviderInterceptor >(); - m_pInterceptor = 0; -} - - -void DocumentHolder::show() -{ - try - { - if(m_xFrame.is()) - { - m_xFrame->activate(); - uno::Reference xTopWindow( - m_xFrame->getContainerWindow(),uno::UNO_QUERY); - if(xTopWindow.is()) - xTopWindow->toFront(); - } - else if( DocumentFrame().is() ) - { - LoadDocInFrame( sal_False ); - - // get rid of second closer if it is there - uno::Reference< beans::XPropertySet > xProps( m_xFrame, uno::UNO_QUERY ); - if ( xProps.is() ) - { - uno::Reference< frame::XLayoutManager > xLayoutManager; - xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) ) >>= xLayoutManager; - uno::Reference< beans::XPropertySet > xLMProps( xLayoutManager, uno::UNO_QUERY ); - if ( xLMProps.is() ) - { - xLMProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MenuBarCloser" )), - uno::makeAny( uno::Reference< frame::XStatusListener >() ) ); - } - } - - if ( !m_bLink ) - { - try - { - uno::Reference< util::XModifyBroadcaster > xModifiable( m_xDocument, uno::UNO_QUERY_THROW ); - xModifiable->addModifyListener( (util::XModifyListener*)this ); - } - catch( uno::Exception& ) - {} - } - - if ( !m_bLink ) - setTitle(m_aDocumentNamePart); - } - } - catch( uno::Exception& ) - { - OSL_FAIL( "Can not show the frame!\n" ); - } - -} - -void DocumentHolder::resizeWin( const SIZEL& rNewSize ) -{ - LockedEmbedDocument_Impl aDocLock; - - if ( m_xOleAccess.is() ) - aDocLock = m_xOleAccess->GetEmbedDocument(); - - if ( m_xFrame.is() && aDocLock.GetEmbedDocument() ) - { - uno::Reference< awt::XWindow > xWindow( - m_xFrame->getContainerWindow(), uno::UNO_QUERY ); - uno::Reference< awt::XView > xView( xWindow, uno::UNO_QUERY ); - - if ( xWindow.is() && xView.is() ) - { - float fScale = 1; - xView->setZoom( fScale, fScale ); - - SIZEL aOldSize; - GetExtent( &aOldSize ); - - if ( aOldSize.cx != rNewSize.cx || aOldSize.cy != rNewSize.cy ) - { - HDC hdc = GetDC( NULL ); - SetMapMode( hdc, MM_HIMETRIC ); - - POINT aOldOffset; - aOldOffset.x = aOldSize.cx; - aOldOffset.y = aOldSize.cy; - BOOL bIsOk = LPtoDP( hdc, &aOldOffset, 1 ); - - POINT aNewOffset; - aNewOffset.x = rNewSize.cx; - aNewOffset.y = rNewSize.cy; - bIsOk = LPtoDP( hdc, &aNewOffset, 1 ); - - ReleaseDC( NULL, hdc ); - - awt::Rectangle aWinRect = xWindow->getPosSize(); - - sal_Int32 aWidthDelta = aWinRect.Width - aOldOffset.x; - sal_Int32 aHeightDelta = aWinRect.Height - aOldOffset.y; - - if ( aWidthDelta > 0 && aHeightDelta > 0 ) - xWindow->setPosSize(0, - 0, - aNewOffset.x + aWidthDelta, - aNewOffset.y + aHeightDelta, - awt::PosSize::SIZE ); - } - } - } -} - -void DocumentHolder::setTitle(const rtl::OUString& aDocumentName) -{ - if(m_xFrame.is()) - { - if(m_aFilterName.getLength() == 0) - { - rtl::OUString aFilterName; - uno::Sequence aSeq; - if(m_xDocument.is()) - { - aSeq = - m_xDocument->getArgs(); - for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) - { - if(aSeq[j].Name == - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("FilterName"))) - { - aSeq[j].Value >>= aFilterName; - break; - } - } - } - - if(aFilterName.getLength()) - { - uno::Reference xNameAccess( - m_xFactory->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.document.FilterFactory"))), - uno::UNO_QUERY); - try { - if(xNameAccess.is() && - (xNameAccess->getByName(aFilterName) >>= aSeq)) - { - for(sal_Int32 j = 0; j < aSeq.getLength(); ++j) - if(aSeq[j].Name == - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("UIName"))) - { - aSeq[j].Value >>= m_aFilterName; - break; - } - } - } - catch(const uno::Exception& ) { - // nothing better to do here - m_aFilterName = aFilterName; - } - } - } - // set the title - uno::Reference xPropSet( - m_xFrame,uno::UNO_QUERY); - if(xPropSet.is()) { - uno::Any aAny; - static const sal_Unicode u[] = { ' ','(',0 }; - static const sal_Unicode c[] = { ')',0 }; - rtl::OUString aTotalName(m_aFilterName); - aTotalName += rtl::OUString(u); - aTotalName += aDocumentName; - aTotalName += rtl::OUString(c); - aAny <<= aTotalName; - try { - xPropSet->setPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), - aAny); - } - catch( const uno::Exception& ) { - } - } - } - - m_aDocumentNamePart = aDocumentName; - - if(m_pInterceptor) - { - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - - Interceptor* pTmpInter = NULL; - uno::Reference< frame::XDispatchProviderInterceptor > xLock( m_xInterceptorLocker ); - if ( xLock.is() && m_pInterceptor ) - pTmpInter = m_pInterceptor; - - aGuard.clear(); - - if ( pTmpInter ) - pTmpInter->generateFeatureStateEvent(); - } -} - - -void DocumentHolder::setContainerName(const rtl::OUString& aContainerName) -{ - m_aContainerName = aContainerName; -} - - -void DocumentHolder::hide() -{ - if(m_xFrame.is()) m_xFrame->deactivate(); - - //todo: sendadvise - // after hiding the window it is always allowed to InPlaceActivate it - m_bAllowInPlace = true; -} - -IDispatch* DocumentHolder::GetIDispatch() -{ - if ( !m_pIDispatch && m_xDocument.is() ) - { - const ::rtl::OUString aServiceName ( - RTL_CONSTASCII_USTRINGPARAM ( - "com.sun.star.bridge.OleBridgeSupplier2" ) ); - uno::Reference< bridge::XBridgeSupplier2 > xSupplier( - m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); - - if ( xSupplier.is() ) - { - uno::Sequence< sal_Int8 > aProcId( 16 ); - rtl_getGlobalProcessId( (sal_uInt8*)aProcId.getArray() ); - - try { - uno::Any anyResult = xSupplier->createBridge( - uno::makeAny( m_xDocument ), - aProcId, - bridge::ModelDependent::UNO, - bridge::ModelDependent::OLE ); - - if ( anyResult.getValueTypeClass() == - getCppuType((sal_uInt32*) 0).getTypeClass() ) - { - VARIANT* pVariant = *(VARIANT**)anyResult.getValue(); - if ( pVariant->vt == VT_DISPATCH ) - m_pIDispatch = pVariant->pdispVal; - - VariantClear( pVariant ); - CoTaskMemFree( pVariant ); - } - } - catch ( uno::Exception& ) - {} - } - } - - return m_pIDispatch; -} - -HRESULT DocumentHolder::GetDocumentBorder( RECT *pRect ) -{ - if ( pRect && m_xDocument.is() ) - { - uno::Sequence< beans::PropertyValue > aArgs = m_xDocument->getArgs(); - for ( sal_Int32 nInd = 0; nInd < aArgs.getLength(); nInd++ ) - if ( aArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentBorder" ) ) ) - { - uno::Sequence< sal_Int32 > aRect; - if ( ( aArgs[nInd].Value >>= aRect ) && aRect.getLength() == 4 ) - { - pRect->left = aRect[0]; - pRect->top = aRect[1]; - pRect->right = aRect[2]; - pRect->bottom = aRect[3]; - - return S_OK; - } - - break; - } - } - - return E_FAIL; -} - -HRESULT DocumentHolder::SetExtent( const SIZEL *pSize ) -{ - if ( pSize ) - { - uno::Reference< embed::XVisualObject > xVisObj( m_xDocument, uno::UNO_QUERY ); - if ( xVisObj.is() ) - { - try - { - awt::Size aNewSize( pSize->cx, pSize->cy ); - - sal_Int32 aMapMode = xVisObj->getMapUnit( DVASPECT_CONTENT ); - - // TODO/LATER: in future UNO API should be used for the conversion, currently there is no - if ( aMapMode == embed::EmbedMapUnits::TWIP ) - { - // convertion from ONE_100TH_MM - aNewSize.Width = aNewSize.Width * 144 / 254; - aNewSize.Height = aNewSize.Height * 144 / 254; - } - - - xVisObj->setVisualAreaSize( DVASPECT_CONTENT, aNewSize ); - - return S_OK; - } - catch( uno::Exception& ) - {} - } - } - - return E_FAIL; -} - -HRESULT DocumentHolder::GetExtent( SIZEL *pSize ) -{ - if ( pSize ) - { - uno::Reference< embed::XVisualObject > xVisObj( m_xDocument, uno::UNO_QUERY ); - if ( xVisObj.is() ) - { - try - { - awt::Size aDocSize = xVisObj->getVisualAreaSize( DVASPECT_CONTENT ); - - sal_Int32 aMapMode = xVisObj->getMapUnit( DVASPECT_CONTENT ); - - // TODO/LATER: in future UNO API should be used for the conversion, currently there is no - if ( aMapMode == embed::EmbedMapUnits::TWIP ) - { - // convertion to ONE_100TH_MM - aDocSize.Width = aDocSize.Width * 254 / 144; - aDocSize.Height = aDocSize.Height * 254 / 144; - } - - pSize->cx = aDocSize.Width; - pSize->cy = aDocSize.Height; - - return S_OK; - } - catch( uno::Exception& ) - {} - } - } - - return E_FAIL; -} - - -HRESULT DocumentHolder::SetContRects(LPCRECT aRect) -{ - if(m_xContainerWindow.is()) { - RECT wi; - memset(&wi,0,sizeof(wi)); - if(m_pIOleIPFrame) { - m_pIOleIPFrame->GetBorder((LPRECT)&wi); - m_xContainerWindow->setPosSize( - 0,0, - wi.right - wi.left, - wi.bottom - wi.top, - awt::PosSize::POSSIZE); - } - else - m_xContainerWindow->setPosSize( - 0,0, - aRect->right - aRect->left, - aRect->bottom - aRect->top, - awt::PosSize::POSSIZE); - return NOERROR; - } - else { - return ERROR; - } -} - - -HRESULT DocumentHolder::SetObjectRects(LPCRECT aRect, LPCRECT aClip) -{ - ((LPRECT)aRect)->left -= m_aBorder.left; - ((LPRECT)aRect)->right += m_aBorder.right; - ((LPRECT)aRect)->top -= m_aBorder.top; - ((LPRECT)aRect)->bottom += m_aBorder.bottom; - ((LPRECT)aClip)->left -= m_aBorder.left; - ((LPRECT)aClip)->right += m_aBorder.right; - ((LPRECT)aClip)->top -= m_aBorder.top; - ((LPRECT)aClip)->bottom += m_aBorder.bottom; - - if(m_pCHatchWin) - m_pCHatchWin->RectsSet((LPRECT)aRect, (LPRECT)aClip); - if(m_xEditWindow.is()) { - m_xEditWindow->setVisible(false); - m_xEditWindow->setPosSize( - m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - m_pCHatchWin ? HATCHWIN_BORDERWIDTHDEFAULT : 0, - aRect->right - aRect->left, - aRect->bottom - aRect->top, - awt::PosSize::POSSIZE); - m_xEditWindow->setVisible(true); - } - return NOERROR; -} - - -::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindow> SAL_CALL -DocumentHolder::getContainerWindow( -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - if(m_xContainerWindow.is()) - return m_xContainerWindow; - - uno::Reference xWin(0); - - static const ::rtl::OUString aToolkitServiceName( - RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.awt.Toolkit" ) ); - uno::Reference xToolkit( - m_xFactory->createInstance(aToolkitServiceName ),uno::UNO_QUERY); - - if(xToolkit.is() && m_pIOleIPFrame) { - HWND hWnd; - m_pIOleIPFrame->GetWindow(&hWnd); - - uno::Sequence aProcessIdent(16); - rtl_getGlobalProcessId((sal_uInt8*)aProcessIdent.getArray()); - - uno::Any aAny; - aAny <<= sal_Int32(hWnd); - xWin = uno::Reference( - xToolkit->createSystemChild( - aAny, - aProcessIdent, - lang::SystemDependent::SYSTEM_WIN32), - uno::UNO_QUERY); - - RECT wi; - memset(&wi,0,sizeof(wi)); - if(xWin.is() && m_pIOleIPFrame->GetBorder((LPRECT)&wi) == NOERROR) { - xWin->setVisible(true); - xWin->setPosSize( - 0,0, - wi.right-wi.left, - wi.bottom - wi.top, - awt::PosSize::POSSIZE); - - uno::Reference xSysWin( - xWin,uno::UNO_QUERY); - if(xSysWin.is()) { - aAny = xSysWin->getWindowHandle( - aProcessIdent,lang::SystemDependent::SYSTEM_WIN32); - sal_Int32 tmp; - if( aAny >>= tmp ) - SetContainerWindowHandle((HWND) tmp); - } - } - } - - m_xContainerWindow= xWin; - return xWin; -} - - - -sal_Bool SAL_CALL -DocumentHolder::requestDockingAreaSpace( - const ::com::sun::star::awt::Rectangle& RequestedSpace -) - throw( - ::com::sun::star::uno::RuntimeException - ) -{ - if(m_bOnDeactivate) - return sal_True; - - BORDERWIDTHS bw; - SetRect((LPRECT)&bw, - RequestedSpace.X,RequestedSpace.Y, - RequestedSpace.Width,RequestedSpace.Height); - if( m_pIOleIPFrame ) - return m_pIOleIPFrame->RequestBorderSpace(&bw) == NOERROR ; - else - return sal_Bool(false); -} - - -void SAL_CALL -DocumentHolder::setDockingAreaSpace( - const ::com::sun::star::awt::Rectangle& BorderSpace -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - if(m_bOnDeactivate) - return; - - BORDERWIDTHS bw; - SetRect((LPRECT)&bw, - BorderSpace.X,BorderSpace.Y, - BorderSpace.Width,BorderSpace.Height); - if( m_pIOleIPFrame ) { - RECT aRect; - GetClientRect(m_hWndxWinCont,&aRect); - HRGN hrgn1 = CreateRectRgn( - 0,0, - aRect.right,BorderSpace.Y); - HRGN hrgn2 = CreateRectRgn(aRect.right-BorderSpace.Width,0,aRect.right,aRect.bottom); - CombineRgn(hrgn1,hrgn1,hrgn2,RGN_OR); - DeleteObject(hrgn2); - hrgn2 = CreateRectRgn(0,aRect.bottom-BorderSpace.Height,aRect.right,aRect.bottom); - CombineRgn(hrgn1,hrgn1,hrgn2,RGN_OR); - DeleteObject(hrgn2); - hrgn2 = CreateRectRgn(0,0,BorderSpace.X,aRect.bottom); - CombineRgn(hrgn1,hrgn1,hrgn2,RGN_OR); - DeleteObject(hrgn2); - - SetWindowRgn(m_hWndxWinCont,hrgn1,true); - // not:: DeleteObject(hrgn1); - m_pIOleIPFrame->SetBorderSpace(&bw); - } -} - - -void SAL_CALL -DocumentHolder::disposing( - const com::sun::star::lang::EventObject& aSource -) - throw( uno::RuntimeException ) -{ - if ( m_xDocument.is() && m_xDocument == aSource.Source ) - { - m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); - } - - if( m_xFrame.is() && m_xFrame == aSource.Source ) - m_xFrame = uno::Reference< frame::XFrame >(); -} - - -void SAL_CALL -DocumentHolder::queryClosing( - const lang::EventObject& aSource, - sal_Bool /*bGetsOwnership*/ -) - throw( - util::CloseVetoException - ) -{ - if ( !m_bLink - && ( m_xDocument.is() && m_xDocument == aSource.Source || m_xFrame.is() && m_xFrame == aSource.Source ) ) - throw util::CloseVetoException(); -} - - -void SAL_CALL -DocumentHolder::notifyClosing( - const lang::EventObject& aSource ) - throw( uno::RuntimeException ) -{ - try - { - uno::Reference< util::XCloseBroadcaster > xEventBroadcaster( - aSource.Source, uno::UNO_QUERY_THROW ); - xEventBroadcaster->removeCloseListener( (util::XCloseListener*)this ); - } - catch( uno::Exception& ) - {} - - if ( m_xDocument.is() && m_xDocument == aSource.Source ) - { - // can happen only in case of links - m_pIDispatch = NULL; - m_xDocument = uno::Reference< frame::XModel >(); - m_xFrame = uno::Reference< frame::XFrame >(); - - LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument(); - if ( aDocLock.GetEmbedDocument() ) - aDocLock.GetEmbedDocument()->OLENotifyClosing(); - } - else if( m_xFrame.is() && m_xFrame == aSource.Source ) - m_xFrame = uno::Reference< frame::XFrame >(); -} - -void SAL_CALL -DocumentHolder::queryTermination( - const lang::EventObject& /*aSource*/ -) - throw( - frame::TerminationVetoException - ) -{ - if ( m_xDocument.is() ) - throw frame::TerminationVetoException(); -} - -void SAL_CALL -DocumentHolder::notifyTermination( - const lang::EventObject& aSource -) - throw( uno::RuntimeException ) -{ - OSL_ENSURE( !m_xDocument.is(), "Just a disaster..." ); - uno::Reference< frame::XDesktop > xDesktop( - aSource.Source, uno::UNO_QUERY ); - - if ( xDesktop.is() ) - xDesktop->removeTerminateListener( (frame::XTerminateListener*)this ); -} - - - -void SAL_CALL DocumentHolder::modified( const lang::EventObject& /*aEvent*/ ) - throw (uno::RuntimeException) -{ - if ( m_xOleAccess.is() ) - { - LockedEmbedDocument_Impl aDocLock = m_xOleAccess->GetEmbedDocument(); - if ( aDocLock.GetEmbedDocument() ) - aDocLock.GetEmbedDocument()->notify(); - } -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/ed_idataobj.cxx b/embedserv/source/embed/ed_idataobj.cxx deleted file mode 100644 index 73e1ed629..000000000 --- a/embedserv/source/embed/ed_idataobj.cxx +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -// actually this workaround should be in presys.h! -//#define UINT64 USE_WIN_UINT64 -//#define INT64 USE_WIN_INT64 -//#define UINT32 USE_WIN_UINT32 -//#define INT32 USE_WIN_INT32 - -#include "embeddoc.hxx" - -//#undef UINT64 -//#undef INT64 -//#undef UINT32 -//#undef INT32 - - -#include -#include -#include - - -#include - -using namespace ::com::sun::star; - -//=============================================================================== -// EmbedDocument_Impl -//=============================================================================== - -sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( sal_Bool isEnhMeta ) -{ - sal_uInt64 pResult = NULL; - - uno::Reference< datatransfer::XTransferable > xTransferable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if ( xTransferable.is() ) - { - uno::Sequence< sal_Int8 > aMetaBuffer; - datatransfer::DataFlavor aFlavor; - - if ( isEnhMeta ) - { - aFlavor.MimeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" ) ); - aFlavor.HumanPresentableName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enhanced Windows MetaFile" ) ); - } - else - { - aFlavor.MimeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" ) ); - aFlavor.HumanPresentableName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Windows GDIMetaFile" ) ); - } - - aFlavor.DataType = getCppuType( (const sal_uInt64*) 0 ); - - uno::Any aAny = xTransferable->getTransferData( aFlavor ); - aAny >>= pResult; - } - - return pResult; -} - -//------------------------------------------------------------------------------- -// IDataObject - -STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) -{ - if ( !pFormatetc ) - return DV_E_FORMATETC; - - if ( !pMedium ) - return STG_E_MEDIUMFULL; - - if ( pFormatetc->dwAspect == DVASPECT_THUMBNAIL - || pFormatetc->dwAspect == DVASPECT_ICON - || pFormatetc->dwAspect == DVASPECT_DOCPRINT ) - return DV_E_DVASPECT; - - if ( pFormatetc->cfFormat == CF_ENHMETAFILE ) - { - if ( !( pFormatetc->tymed & TYMED_ENHMF ) ) - return DV_E_TYMED; - - HENHMETAFILE hMeta = reinterpret_cast( getMetaFileHandle_Impl( sal_True ) ); - - if ( hMeta ) - { - pMedium->tymed = TYMED_ENHMF; - pMedium->hEnhMetaFile = hMeta; - pMedium->pUnkForRelease = NULL; - - return S_OK; - } - - return STG_E_MEDIUMFULL; - } - else if ( pFormatetc->cfFormat == CF_METAFILEPICT ) - { - if ( !( pFormatetc->tymed & TYMED_MFPICT ) ) - return DV_E_TYMED; - - HGLOBAL hMeta = reinterpret_cast( getMetaFileHandle_Impl( sal_False ) ); - - if ( hMeta ) - { - pMedium->tymed = TYMED_MFPICT; - pMedium->hMetaFilePict = hMeta; - pMedium->pUnkForRelease = NULL; - - return S_OK; - } - - return STG_E_MEDIUMFULL; - } - else - { - CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatA( "Embed Source" ); - CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj ) - { - if ( !( pFormatetc->tymed & TYMED_ISTORAGE ) ) - return DV_E_TYMED; - - CComPtr< IStorage > pNewStg; - HRESULT hr = StgCreateDocfile( NULL, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, 0, &pNewStg ); - if ( FAILED( hr ) || !pNewStg ) return STG_E_MEDIUMFULL; - - hr = SaveTo_Impl( pNewStg ); - if ( FAILED( hr ) ) return STG_E_MEDIUMFULL; - - pMedium->tymed = TYMED_ISTORAGE; - pMedium->pstg = pNewStg; - pMedium->pstg->AddRef(); - pMedium->pUnkForRelease = ( IUnknown* )pNewStg; - - return S_OK; - } - } - - return DV_E_FORMATETC; -} - -STDMETHODIMP EmbedDocument_Impl::GetDataHere( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) -{ - if ( !pFormatetc ) - return DV_E_FORMATETC; - - if ( !pMedium ) - return STG_E_MEDIUMFULL; - - if ( pFormatetc->dwAspect == DVASPECT_THUMBNAIL - || pFormatetc->dwAspect == DVASPECT_ICON - || pFormatetc->dwAspect == DVASPECT_DOCPRINT ) - return DV_E_DVASPECT; - - CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatA( "Embed Source" ); - CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - - if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj ) - { - if ( !( pFormatetc->tymed & TYMED_ISTORAGE ) ) - return DV_E_TYMED; - - if ( !pMedium->pstg ) return STG_E_MEDIUMFULL; - - HRESULT hr = SaveTo_Impl( pMedium->pstg ); - if ( FAILED( hr ) ) return STG_E_MEDIUMFULL; - - pMedium->tymed = TYMED_ISTORAGE; - pMedium->pUnkForRelease = NULL; - - return S_OK; - } - - return DV_E_FORMATETC; -} - -STDMETHODIMP EmbedDocument_Impl::QueryGetData( FORMATETC * pFormatetc ) -{ - if ( pFormatetc ) - { - if ( pFormatetc->dwAspect == DVASPECT_THUMBNAIL - || pFormatetc->dwAspect == DVASPECT_ICON - || pFormatetc->dwAspect == DVASPECT_DOCPRINT ) - return DV_E_DVASPECT; - - if ( pFormatetc->cfFormat == CF_ENHMETAFILE ) - { - if ( !( pFormatetc->tymed & TYMED_ENHMF ) ) - return DV_E_TYMED; - - return S_OK; - } - else if ( pFormatetc->cfFormat == CF_METAFILEPICT ) - { - if ( !( pFormatetc->tymed & TYMED_MFPICT ) ) - return DV_E_TYMED; - - return S_OK; - } - else - { - CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatA( "Embed Source" ); - CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - if ( pFormatetc->cfFormat == cf_embSource || pFormatetc->cfFormat == cf_embObj ) - { - if ( !( pFormatetc->tymed & TYMED_ISTORAGE ) ) - return DV_E_TYMED; - - return S_OK; - } - } - } - - return DV_E_FORMATETC; - -} - -STDMETHODIMP EmbedDocument_Impl::GetCanonicalFormatEtc( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ) -{ - if ( !pFormatetcIn || !pFormatetcOut ) - return DV_E_FORMATETC; - - pFormatetcOut->ptd = NULL; - pFormatetcOut->cfFormat = pFormatetcIn->cfFormat; - pFormatetcOut->dwAspect = DVASPECT_CONTENT; - - if ( pFormatetcIn->cfFormat == CF_ENHMETAFILE ) - { - pFormatetcOut->tymed = TYMED_ENHMF; - return S_OK; - } - else if ( pFormatetcIn->cfFormat == CF_METAFILEPICT ) - { - pFormatetcOut->tymed = TYMED_MFPICT; - return S_OK; - } - else - { - CLIPFORMAT cf_embSource = (CLIPFORMAT)RegisterClipboardFormatA( "Embed Source" ); - CLIPFORMAT cf_embObj = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - if ( pFormatetcIn->cfFormat == cf_embSource || pFormatetcIn->cfFormat == cf_embObj ) - { - pFormatetcOut->tymed = TYMED_ISTORAGE; - return S_OK; - } - } - - return DV_E_FORMATETC; -} - -STDMETHODIMP EmbedDocument_Impl::SetData( FORMATETC * /*pFormatetc*/, STGMEDIUM * /*pMedium*/, BOOL /*fRelease*/ ) -{ - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC ** /*ppFormatetc*/ ) -{ - if ( dwDirection == DATADIR_GET ) - return OLE_S_USEREG; - - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::DAdvise( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ) -{ - if ( !m_pDAdviseHolder ) - if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder ) - return E_OUTOFMEMORY; - - return m_pDAdviseHolder->Advise( (IDataObject*)this, pFormatetc, advf, pAdvSink, pdwConnection ); -} - -STDMETHODIMP EmbedDocument_Impl::DUnadvise( DWORD dwConnection ) -{ - if ( !m_pDAdviseHolder ) - if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder ) - return E_OUTOFMEMORY; - - return m_pDAdviseHolder->Unadvise( dwConnection ); -} - -STDMETHODIMP EmbedDocument_Impl::EnumDAdvise( IEnumSTATDATA ** ppenumAdvise ) -{ - if ( !m_pDAdviseHolder ) - if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder ) - return E_OUTOFMEMORY; - - return m_pDAdviseHolder->EnumAdvise( ppenumAdvise ); -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/ed_iinplace.cxx b/embedserv/source/embed/ed_iinplace.cxx deleted file mode 100644 index 7e696463f..000000000 --- a/embedserv/source/embed/ed_iinplace.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "embeddoc.hxx" -#include - - -STDMETHODIMP EmbedDocument_Impl::GetWindow(HWND *hWnd) -{ - OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); - - *hWnd = m_pDocHolder->GetTopMostWinHandle(); - if(*hWnd != NULL) - return NOERROR; - else - return ERROR; -} - -STDMETHODIMP EmbedDocument_Impl::ContextSensitiveHelp(BOOL) -{ - return NOERROR; -} - -STDMETHODIMP EmbedDocument_Impl::InPlaceDeactivate(void) -{ - // no locking is used since the OLE must use the same thread always - if ( m_bIsInVerbHandling ) - return E_UNEXPECTED; - - BooleanGuard_Impl aGuard( m_bIsInVerbHandling ); - - m_pDocHolder->InPlaceDeactivate(); - - // the inplace object needs the notification after the storing ( on deactivating ) - // if it happens before the storing the replacement might not be updated - notify(); - - return NOERROR; -} - -STDMETHODIMP EmbedDocument_Impl::UIDeactivate(void) -{ - // no locking is used since the OLE must use the same thread always - if ( m_bIsInVerbHandling ) - return E_UNEXPECTED; - - BooleanGuard_Impl aGuard( m_bIsInVerbHandling ); - - - m_pDocHolder->UIDeactivate(); - - // the inplace object needs the notification after the storing ( on deactivating ) - // if it happens before the storing the replacement might not be updated - notify(); - - return NOERROR; -} - -STDMETHODIMP EmbedDocument_Impl::SetObjectRects(LPCRECT aRect, LPCRECT aClip) -{ - OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); - - return m_pDocHolder->SetObjectRects(aRect,aClip); -} - -STDMETHODIMP EmbedDocument_Impl::ReactivateAndUndo(void) -{ - return E_NOTIMPL; -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx deleted file mode 100644 index 4910dca3d..000000000 --- a/embedserv/source/embed/ed_ioleobject.cxx +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "embeddoc.hxx" -#include -#include -#include - - -using namespace ::com::sun::star; - - -extern ::rtl::OUString getFilterNameFromGUID_Impl( GUID* ); - -//------------------------------------------------------------------------------- -// IOleObject - - -STDMETHODIMP EmbedDocument_Impl::SetClientSite( IOleClientSite* pSite ) -{ - m_pClientSite = pSite; - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::GetClientSite( IOleClientSite** pSite ) -{ - *pSite = m_pClientSite; - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) -{ - // the code should be ignored for links - if ( !m_aFileName.getLength() ) - { - m_pDocHolder->setTitle( - rtl::OUString( - (sal_Unicode*)szContainerObj)); - m_pDocHolder->setContainerName( - rtl::OUString( - (sal_Unicode*)szContainerApp)); - } - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::Close( DWORD dwSaveOption ) -{ - HRESULT hr = S_OK; - - if ( m_pDocHolder->HasFrame() ) - { - if ( dwSaveOption == 2 && m_aFileName.getLength() ) - { - // ask the user about saving - if ( m_pDocHolder->ExecuteSuspendCloseFrame() ) - { - m_pDocHolder->CloseDocument(); - return S_OK; - } - else - return OLE_E_PROMPTSAVECANCELLED; - } - - if ( dwSaveOption != 1 ) - hr = SaveObject(); // ADVF_DATAONSTOP); - - m_pDocHolder->CloseFrame(); - OLENotifyDeactivation(); - } - - m_pDocHolder->FreeOffice(); - m_pDocHolder->CloseDocument(); - - OLENotifyClosing(); - - return hr; -} - - -HRESULT EmbedDocument_Impl::OLENotifyClosing() -{ - HRESULT hr = S_OK; - - AdviseSinkHashMap aAHM(m_aAdviseHashMap); - - for ( AdviseSinkHashMapIterator iAdvise = aAHM.begin(); - iAdvise != aAHM.end(); iAdvise++ ) - { - if ( iAdvise->second ) - iAdvise->second->OnClose(); - } - - return hr; - -} - -STDMETHODIMP EmbedDocument_Impl::SetMoniker( DWORD /*dwWhichMoniker*/, IMoniker * /*pmk*/ ) -{ - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::GetMoniker( DWORD /*dwAssign*/, DWORD /*dwWhichMoniker*/, IMoniker ** /*ppmk*/ ) -{ - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::InitFromData( IDataObject * /*pDataObject*/, BOOL /*fCreation*/, DWORD /*dwReserved*/ ) -{ - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::GetClipboardData( DWORD /*dwReserved*/, IDataObject ** /*ppDataObject*/ ) -{ - return E_NOTIMPL; -} - -/** - * Well, this is a not so very inefficient way to deliver - * - */ - -STDMETHODIMP EmbedDocument_Impl::DoVerb( - LONG iVerb, - LPMSG, - IOleClientSite *pActiveSite, - LONG, - HWND, - LPCRECT ) -{ - // no locking is used since the OLE must use the same thread always - if ( m_bIsInVerbHandling ) - return OLEOBJ_S_CANNOT_DOVERB_NOW; - - // an object can not handle any Verbs in Hands off mode - if ( m_pMasterStorage == NULL || m_pOwnStream == NULL ) - return OLE_E_CANT_BINDTOSOURCE; - - - BooleanGuard_Impl aGuard( m_bIsInVerbHandling ); - - if ( iVerb == OLEIVERB_PRIMARY ) - { - if ( m_aFileName.getLength() ) - { - // that should be a link - iVerb = OLEIVERB_OPEN; - } - else - iVerb = OLEIVERB_SHOW; - } - - try - { - switch(iVerb) { - case OLEIVERB_DISCARDUNDOSTATE: - // free any undostate? - break; - case OLEIVERB_INPLACEACTIVATE: - OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); - - return m_pDocHolder->InPlaceActivate(pActiveSite,FALSE); - break; - case OLEIVERB_UIACTIVATE: - OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); - - return m_pDocHolder->InPlaceActivate(pActiveSite,TRUE); - break; - case OLEIVERB_PRIMARY: - case OLEIVERB_SHOW: - OSL_ENSURE(m_pDocHolder,"no document for inplace activation"); - - if(m_pDocHolder->isActive()) - return NOERROR; //Already active - - if(SUCCEEDED( - m_pDocHolder->InPlaceActivate( - pActiveSite,TRUE))) - return NOERROR; - - // intended fall trough - case OLEIVERB_OPEN: - OSL_ENSURE(m_pDocHolder,"no document to open"); - - // the commented code could be usefull in case - // outer window would be resized depending from inner one - // RECTL aEmbArea; - // m_pDocHolder->GetVisArea( &aEmbArea ); - // m_pDocHolder->show(); - // m_pDocHolder->SetVisArea( &aEmbArea ); - - if(m_pDocHolder->isActive()) - { - m_pDocHolder->InPlaceDeactivate(); - m_pDocHolder->DisableInplaceActivation(true); - } - - SIZEL aEmbSize; - m_pDocHolder->GetExtent( &aEmbSize ); - m_pDocHolder->show(); - m_pDocHolder->resizeWin( aEmbSize ); - - if ( m_pClientSite ) - m_pClientSite->OnShowWindow( TRUE ); - - notify(); - break; - case OLEIVERB_HIDE: - OSL_ENSURE(m_pDocHolder,"no document to hide"); - - if(m_pDocHolder->isActive()) - m_pDocHolder->InPlaceDeactivate(); - else { - m_pDocHolder->hide(); - - if( m_pClientSite ) - m_pClientSite->OnShowWindow(FALSE); - } - break; - default: - break; - } - } - catch( uno::Exception& ) - { - return OLEOBJ_S_CANNOT_DOVERB_NOW; - } - - return NOERROR; -} - - - -STDMETHODIMP EmbedDocument_Impl::EnumVerbs( IEnumOLEVERB ** /*ppEnumOleVerb*/ ) -{ - return OLE_S_USEREG; -} - -STDMETHODIMP EmbedDocument_Impl::Update() -{ - return S_OK; -// HRESULT hr = CACHE_E_NOCACHE_UPDATED; -// return hr; -} - -STDMETHODIMP EmbedDocument_Impl::IsUpToDate() -{ - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::GetUserClassID( CLSID *pClsid ) -{ - return GetClassID( pClsid ); -} - -STDMETHODIMP EmbedDocument_Impl::GetUserType( DWORD /*dwFormOfTypeUe*/, LPOLESTR * /*pszUserType*/ ) -{ - return OLE_S_USEREG; -} - -STDMETHODIMP EmbedDocument_Impl::SetExtent( DWORD /*dwDrawAspect*/, SIZEL *psizel ) -{ - if ( !psizel ) - return E_FAIL; - - m_pDocHolder->SetExtent( psizel ); - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::GetExtent( DWORD /*dwDrawAspect*/, SIZEL * psizel ) -{ - if ( !psizel ) - return E_INVALIDARG; - - if ( FAILED( m_pDocHolder->GetExtent( psizel ) ) ) - { - // return default values - psizel->cx = 500; - psizel->cy = 500; - } - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::Advise( IAdviseSink *pAdvSink, DWORD *pdwConnection ) -{ - if ( m_nAdviseNum == 0xFFFFFFFF ) - return E_OUTOFMEMORY; - - pAdvSink->AddRef(); - m_aAdviseHashMap.insert( ::std::pair< DWORD, IAdviseSink* >( m_nAdviseNum, pAdvSink ) ); - *pdwConnection = m_nAdviseNum++; - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::Unadvise( DWORD dwConnection ) -{ - AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.find( dwConnection ); - if ( iAdvise != m_aAdviseHashMap.end() ) - { - iAdvise->second->Release(); - m_aAdviseHashMap.erase( iAdvise ); - } - else - return OLE_E_NOCONNECTION; - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::EnumAdvise( IEnumSTATDATA ** /*ppenumAdvise*/ ) -{ - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::GetMiscStatus( DWORD /*dwAspect*/, DWORD * /*pdwStatus*/ ) -{ - return OLE_S_USEREG; -} - -STDMETHODIMP EmbedDocument_Impl::SetColorScheme( LOGPALETTE * /*pLogpal*/ ) -{ - return E_NOTIMPL; -} - -//------------------------------------------------------------------------------- -// IDispatch - -STDMETHODIMP EmbedDocument_Impl::GetTypeInfoCount( unsigned int FAR* pctinfo ) -{ - if ( m_pDocHolder->GetIDispatch() ) - return m_pDocHolder->GetIDispatch()->GetTypeInfoCount( pctinfo ); - - return E_NOTIMPL; -} - -STDMETHODIMP EmbedDocument_Impl::GetTypeInfo( unsigned int iTInfo, LCID lcid, ITypeInfo FAR* FAR* ppTInfo ) -{ - if ( m_pDocHolder->GetIDispatch() ) - return m_pDocHolder->GetIDispatch()->GetTypeInfo( iTInfo, lcid, ppTInfo ); - - return DISP_E_BADINDEX; // the only error that can be returned -} - -STDMETHODIMP EmbedDocument_Impl::GetIDsOfNames( REFIID riid, - OLECHAR FAR* FAR* rgszNames, - unsigned int cNames, - LCID lcid, - DISPID FAR* rgDispId ) -{ - if ( m_pDocHolder->GetIDispatch() ) - return m_pDocHolder->GetIDispatch()->GetIDsOfNames( riid, rgszNames, cNames, lcid, rgDispId ); - - for ( unsigned int ind = 0; ind < cNames; ind++ ) - rgDispId[ind] = DISPID_UNKNOWN; - - return DISP_E_UNKNOWNNAME; -} - -STDMETHODIMP EmbedDocument_Impl::Invoke( DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS FAR* pDispParams, - VARIANT FAR* pVarResult, - EXCEPINFO FAR* pExcepInfo, - unsigned int FAR* puArgErr ) -{ - if ( m_pDocHolder->GetIDispatch() ) - return m_pDocHolder->GetIDispatch()->Invoke( dispIdMember, - riid, - lcid, - wFlags, - pDispParams, - pVarResult, - pExcepInfo, - puArgErr ); - - return DISP_E_MEMBERNOTFOUND; -} - -//------------------------------------------------------------------------------- -// IExternalConnection - -DWORD STDMETHODCALLTYPE EmbedDocument_Impl::AddConnection( DWORD , DWORD ) -{ - return AddRef(); -} - -DWORD STDMETHODCALLTYPE EmbedDocument_Impl::ReleaseConnection( DWORD , DWORD , BOOL ) -{ - return Release(); -} - -// C++ - methods - -HRESULT EmbedDocument_Impl::SaveObject() -{ - HRESULT hr = S_OK; - - if(m_pClientSite) { - hr = m_pClientSite->SaveObject(); - - for ( AdviseSinkHashMapIterator iAdvise = - m_aAdviseHashMap.begin(); - iAdvise != m_aAdviseHashMap.end(); - iAdvise++ ) - if ( iAdvise->second ) - iAdvise->second->OnSave( ); - } - else if ( m_aFileName.getLength() && IsDirty() == S_OK ) - { - ::rtl::OUString aPreservFileName = m_aFileName; - - // in case of links the containers does not provide client site sometimes - hr = Save( (LPCOLESTR)NULL, FALSE ); // triggers saving to the link location - SaveCompleted( (LPCOLESTR)aPreservFileName.getStr() ); - } - - notify( false ); - - return hr; -} - - -HRESULT EmbedDocument_Impl::ShowObject() -{ - HRESULT hr = S_OK; - - if(m_pClientSite) - hr = m_pClientSite->ShowObject(); - - return hr; -} - - -void EmbedDocument_Impl::notify( bool bDataChanged ) -{ - for ( AdviseSinkHashMapIterator iAdvise = - m_aAdviseHashMap.begin(); - iAdvise != m_aAdviseHashMap.end(); - iAdvise++ ) - if ( iAdvise->second ) - iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 ); - - if ( m_pDAdviseHolder && bDataChanged ) - m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 ); -} - -void EmbedDocument_Impl::Deactivate() -{ - HRESULT hr = S_OK; - - if ( m_pDocHolder->HasFrame() ) - { - hr = SaveObject(); - m_pDocHolder->CloseFrame(); - OLENotifyDeactivation(); - } -} - -HRESULT EmbedDocument_Impl::OLENotifyDeactivation() -{ - HRESULT hr = S_OK; - - if ( m_pClientSite ) - hr = m_pClientSite->OnShowWindow( FALSE ); - - return hr; - -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx deleted file mode 100644 index 7a762f0ed..000000000 --- a/embedserv/source/embed/ed_ipersiststr.cxx +++ /dev/null @@ -1,1020 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "embeddoc.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -#include - -#define EXT_STREAM_LENGTH 16 - -using namespace ::com::sun::star; - -extern ::rtl::OUString getStorageTypeFromGUID_Impl( GUID* guid ); -extern ::rtl::OUString getServiceNameFromGUID_Impl( GUID* ); -extern ::rtl::OUString getFilterNameFromGUID_Impl( GUID* ); -// extern CLIPFORMAT getClipFormatFromGUID_Impl( GUID* ); -::rtl::OUString getTestFileURLFromGUID_Impl( GUID* guid ); - -const ::rtl::OUString aOfficeEmbedStreamName( RTL_CONSTASCII_USTRINGPARAM ( "package_stream" ) ); -const ::rtl::OUString aExtentStreamName( RTL_CONSTASCII_USTRINGPARAM ( "properties_stream" ) ); - -uno::Reference< io::XInputStream > createTempXInStreamFromIStream( - uno::Reference< lang::XMultiServiceFactory > xFactory, - IStream *pStream ) -{ - uno::Reference< io::XInputStream > xResult; - - if ( !pStream ) - return xResult; - - const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) ); - uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > ( - xFactory->createInstance ( aServiceName ), - uno::UNO_QUERY ); - if ( xTempOut.is() ) - { - ULARGE_INTEGER nNewPos; - LARGE_INTEGER aZero = { 0L, 0L }; - HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos ); - if ( FAILED( hr ) ) return xResult; - - STATSTG aStat; - hr = pStream->Stat( &aStat, STATFLAG_NONAME ); - if ( FAILED( hr ) ) return xResult; - - sal_uInt32 nSize = (sal_uInt32)aStat.cbSize.QuadPart; - sal_uInt32 nCopied = 0; - uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize ); - try - { - sal_uInt32 nRead = 0; - do - { - pStream->Read( (void*)aBuffer.getArray(), nConstBufferSize, &nRead ); - - if ( nRead < nConstBufferSize ) - aBuffer.realloc( nRead ); - - xTempOut->writeBytes( aBuffer ); - nCopied += nRead; - } while( nRead == nConstBufferSize ); - - if ( nCopied == nSize ) - { - uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY ); - if ( xTempSeek.is() ) - { - xTempSeek->seek ( 0 ); - xResult = uno::Reference< io::XInputStream >( xTempOut, uno::UNO_QUERY ); - } - } - } - catch( uno::Exception& ) - { - } - } - - return xResult; -} - -HRESULT copyXTempOutToIStream( uno::Reference< io::XOutputStream > xTempOut, IStream* pStream ) -{ - if ( !xTempOut.is() || !pStream ) - return E_FAIL; - - uno::Reference < io::XSeekable > xTempSeek ( xTempOut, uno::UNO_QUERY ); - if ( !xTempSeek.is() ) - return E_FAIL; - - xTempSeek->seek ( 0 ); - - uno::Reference< io::XInputStream > xTempIn ( xTempOut, uno::UNO_QUERY ); - if ( !xTempSeek.is() ) - return E_FAIL; - - // Seek to zero and truncate the stream - ULARGE_INTEGER nNewPos; - LARGE_INTEGER aZero = { 0L, 0L }; - HRESULT hr = pStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos ); - if ( FAILED( hr ) ) return E_FAIL; - ULARGE_INTEGER aUZero = { 0L, 0L }; - hr = pStream->SetSize( aUZero ); - if ( FAILED( hr ) ) return E_FAIL; - - uno::Sequence< sal_Int8 > aBuffer( nConstBufferSize ); - sal_uInt32 nReadBytes = 0; - - do - { - try { - nReadBytes = xTempIn->readBytes( aBuffer, nConstBufferSize ); - } - catch( uno::Exception& ) - { - return E_FAIL; - } - - sal_uInt32 nWritten = 0; - HRESULT hr = pStream->Write( (void*)aBuffer.getArray(), nReadBytes, &nWritten ); - if ( !SUCCEEDED( hr ) || nWritten != nReadBytes ) - return E_FAIL; - - } while( nReadBytes == nConstBufferSize ); - - return S_OK; -} - - -//=============================================================================== -// EmbedDocument_Impl -//=============================================================================== - -EmbedDocument_Impl::EmbedDocument_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory, const GUID* guid ) -: m_refCount( 0L ) -, m_xFactory( xFactory ) -, m_guid( *guid ) -, m_bIsDirty( sal_False ) -, m_nAdviseNum( 0 ) -, m_bIsInVerbHandling( sal_False ) -//, m_bLoadedFromFile( sal_False ) -{ - m_xOwnAccess = new EmbeddedDocumentInstanceAccess_Impl( this ); - m_pDocHolder = new DocumentHolder( xFactory, m_xOwnAccess ); - m_pDocHolder->acquire(); -} - -EmbedDocument_Impl::~EmbedDocument_Impl() -{ - m_pDocHolder->FreeOffice(); - - if ( m_pDocHolder->HasFrame() && m_pDocHolder->IsLink() ) - { - // a link with frame should be only disconnected, not closed - m_pDocHolder->DisconnectFrameDocument( sal_True ); - } - else - { - m_pDocHolder->CloseDocument(); - m_pDocHolder->CloseFrame(); - } - - m_pDocHolder->release(); -} - -uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Impl( uno::Reference< io::XInputStream > xStream, DWORD /*nStreamMode*/, LPCOLESTR pFilePath ) -{ - uno::Sequence< beans::PropertyValue > aArgs( 3 ); - - sal_Int32 nInd = 0; // must not be bigger than the preset size - aArgs[nInd].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "FilterName" ) ); - aArgs[nInd++].Value <<= getFilterNameFromGUID_Impl( &m_guid ); - - if ( xStream.is() ) - { - aArgs[nInd].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "InputStream" ) ); - aArgs[nInd++].Value <<= xStream; - aArgs[nInd].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "URL" ) ); - aArgs[nInd++].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ); - } - else - { - aArgs[nInd].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "URL" ) ); - - rtl::OUString sDocUrl; - if ( pFilePath ) - { - ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.util.URLTransformer" ) ); - uno::Reference< util::XURLTransformer > aTransformer( m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); - if ( aTransformer.is() ) - { - util::URL aURL; - - aURL.Complete = ::rtl::OUString( reinterpret_cast(pFilePath) ); - - if ( aTransformer->parseSmart( aURL, ::rtl::OUString() ) ) - sDocUrl = aURL.Complete; - } - } - - aArgs[nInd++].Value <<= sDocUrl; - } - - aArgs.realloc( nInd ); - - // aArgs[].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ReadOnly" ) ); - // aArgs[].Value <<= sal_False; //( ( nStreamMode & ( STGM_READWRITE | STGM_WRITE ) ) ? sal_True : sal_False ); - - return aArgs; -} - -uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForStoring_Impl( uno::Reference< io::XOutputStream > xStream) -{ - uno::Sequence< beans::PropertyValue > aArgs( xStream.is() ? 2 : 1 ); - - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "FilterName" ) ); - aArgs[0].Value <<= getFilterNameFromGUID_Impl( &m_guid ); - - if ( xStream.is() ) - { - aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "OutputStream" ) ); - aArgs[1].Value <<= xStream; - } - - return aArgs; -} - -HRESULT EmbedDocument_Impl::SaveTo_Impl( IStorage* pStg ) -{ - if ( !pStg || pStg == m_pMasterStorage ) - return E_FAIL; - - // for saveto operation the master storage - // should not enter NoScribble mode - CComPtr< IStream > pOrigOwn = m_pOwnStream; - CComPtr< IStream > pOrigExt = m_pExtStream; - HRESULT hr = Save( pStg, sal_False ); - pStg->Commit( STGC_ONLYIFCURRENT ); - m_pOwnStream = pOrigOwn; - m_pExtStream = pOrigExt; - - return hr; -} - -//------------------------------------------------------------------------------- -// IUnknown - -STDMETHODIMP EmbedDocument_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv ) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersist)) - { - AddRef(); - *ppv = (IPersist*) (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IExternalConnection)) - { - AddRef(); - *ppv = (IExternalConnection*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersistStorage)) - { - AddRef(); - *ppv = (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IDataObject)) - { - AddRef(); - *ppv = (IDataObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleObject)) - { - AddRef(); - *ppv = (IOleObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleWindow)) - { - AddRef(); - *ppv = (IOleWindow*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleInPlaceObject)) - { - AddRef(); - *ppv = (IOleInPlaceObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersistFile)) - { - AddRef(); - *ppv = (IPersistFile*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IDispatch)) - { - AddRef(); - *ppv = (IDispatch*) this; - return S_OK; - } - - *ppv = NULL; - return ResultFromScode(E_NOINTERFACE); -} - -STDMETHODIMP_(ULONG) EmbedDocument_Impl::AddRef() -{ - return osl_incrementInterlockedCount( &m_refCount); -} - -STDMETHODIMP_(ULONG) EmbedDocument_Impl::Release() -{ - // if there is a time when the last reference is destructed, that means that only internal pointers are alive - // after the following call either the refcount is increased or the pointers are empty - if ( m_refCount == 1 ) - m_xOwnAccess->ClearEmbedDocument(); - - sal_Int32 nCount = osl_decrementInterlockedCount( &m_refCount ); - if ( nCount == 0 ) - delete this; - return nCount; -} - -//------------------------------------------------------------------------------- -// IPersist - -STDMETHODIMP EmbedDocument_Impl::GetClassID( CLSID* pClassId ) -{ - *pClassId = *&m_guid; - return S_OK; -} - -//------------------------------------------------------------------------------- -// IPersistStorage - -STDMETHODIMP EmbedDocument_Impl::IsDirty() -{ - // the link modified state is controlled by the document - if ( m_bIsDirty && !m_aFileName.getLength() ) - return S_OK; - - uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if ( xMod.is() ) - return xMod->isModified() ? S_OK : S_FALSE; - return S_FALSE; -} - -STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg ) -{ - HRESULT hr = CO_E_ALREADYINITIALIZED; - - if ( !m_pDocHolder->GetDocument().is() ) - { - - STATSTG aStat; - hr = pStg->Stat( &aStat, STATFLAG_NONAME ); - if ( FAILED( hr ) ) return E_FAIL; - - DWORD nStreamMode = aStat.grfMode; - - hr = E_FAIL; - if ( m_xFactory.is() && pStg ) - { - uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), - uno::UNO_QUERY ); - if ( aDocument.is() ) - { - m_pDocHolder->SetDocument( aDocument ); - - uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if( xLoadable.is() ) - { - try - { - xLoadable->initNew(); - // xLoadable->load( fillArgsForLoading_Impl( uno::Reference< io::XInputStream >(), nStreamMode ) ); - hr = S_OK; - } - catch( uno::Exception& ) - { - } - } - - if ( hr == S_OK ) - { - ::rtl::OUString aCurType = getStorageTypeFromGUID_Impl( &m_guid ); // ??? - CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - hr = WriteFmtUserTypeStg( pStg, - cf, // ??? - reinterpret_cast(( sal_Unicode* )aCurType.getStr()) ); - - if ( hr == S_OK ) - { - hr = pStg->CreateStream( reinterpret_cast(aOfficeEmbedStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &m_pOwnStream ); - - if ( hr == S_OK && m_pOwnStream ) - { - hr = pStg->CreateStream( reinterpret_cast(aExtentStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &m_pExtStream ); - - if ( hr == S_OK && m_pExtStream ) - { - - m_pMasterStorage = pStg; - m_bIsDirty = sal_True; - } - else - hr = E_FAIL; - } - else - hr = E_FAIL; - } - else - hr = E_FAIL; - } - - if ( hr != S_OK ) - m_pDocHolder->CloseDocument(); - } - } - } - - return hr; -} - -STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg ) -{ - if ( m_pDocHolder->GetDocument().is() ) - return CO_E_ALREADYINITIALIZED; - - if ( !m_xFactory.is() || !pStg ) - return E_FAIL; - - HRESULT hr = E_FAIL; - - STATSTG aStat; - hr = pStg->Stat( &aStat, STATFLAG_NONAME ); - if ( FAILED( hr ) ) return E_FAIL; - - DWORD nStreamMode = aStat.grfMode; - hr = pStg->OpenStream( reinterpret_cast(aOfficeEmbedStreamName.getStr()), - 0, - nStreamMode & 0x73, - 0, - &m_pOwnStream ); - if ( !m_pOwnStream ) hr = E_FAIL; - - if ( SUCCEEDED( hr ) ) - { - hr = pStg->OpenStream( reinterpret_cast(aExtentStreamName.getStr()), - 0, - nStreamMode & 0x73, - 0, - &m_pExtStream ); - if ( !m_pExtStream ) hr = E_FAIL; - } - - // RECTL aRectToSet; - SIZEL aSizeToSet; - if ( SUCCEEDED( hr ) ) - { - ULARGE_INTEGER nNewPos; - LARGE_INTEGER aZero = { 0L, 0L }; - hr = m_pExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos ); - if ( SUCCEEDED( hr ) ) - { - sal_uInt32 nRead; - sal_Int8 aInf[EXT_STREAM_LENGTH]; - hr = m_pExtStream->Read( (void*)aInf, EXT_STREAM_LENGTH, &nRead ); - if ( nRead != EXT_STREAM_LENGTH ) hr = E_FAIL; - - if ( SUCCEEDED( hr ) ) - { - // aRectToSet.left = *((sal_Int32*)aInf); - // aRectToSet.top = *((sal_Int32*)&aInf[4]); - // aRectToSet.right = *((sal_Int32*)&aInf[8]); - // aRectToSet.bottom = *((sal_Int32*)&aInf[12]); - aSizeToSet.cx = *((sal_Int32*)&aInf[8]) - *((sal_Int32*)aInf); - aSizeToSet.cy = *((sal_Int32*)&aInf[12]) - *((sal_Int32*)&aInf[4]); - } - } - } - - if ( SUCCEEDED( hr ) ) - { - hr = E_FAIL; - - uno::Reference < io::XInputStream > xTempIn = createTempXInStreamFromIStream( m_xFactory, m_pOwnStream ); - if ( xTempIn.is() ) - { - uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), - uno::UNO_QUERY ); - if ( aDocument.is() ) - { - m_pDocHolder->SetDocument( aDocument ); - - uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if( xLoadable.is() ) - { - try - { - xLoadable->load( fillArgsForLoading_Impl( xTempIn, nStreamMode ) ); - m_pMasterStorage = pStg; - hr = m_pDocHolder->SetExtent( &aSizeToSet ); - // hr = m_pDocHolder->SetVisArea( &aRectToSet ); - } - catch( uno::Exception& ) - { - } - } - - if ( FAILED( hr ) ) - m_pDocHolder->CloseDocument(); - } - } - } - - if ( FAILED( hr ) ) - { - m_pOwnStream = CComPtr< IStream >(); - m_pExtStream = CComPtr< IStream >(); - hr = pStg->DestroyElement( reinterpret_cast(aOfficeEmbedStreamName.getStr()) ); - hr = pStg->DestroyElement( reinterpret_cast(aExtentStreamName.getStr()) ); - - OSL_ENSURE( SUCCEEDED( hr ), "Can not destroy created stream!\n" ); - if ( FAILED( hr ) ) - hr = E_FAIL; - } - - return hr; -} - -STDMETHODIMP EmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad ) -{ - if ( !m_pDocHolder->GetDocument().is() || !m_xFactory.is() || !pStgSave || !m_pOwnStream || !m_pExtStream ) - return E_FAIL; - - CComPtr< IStream > pTargetStream; - CComPtr< IStream > pNewExtStream; - - if ( !fSameAsLoad && pStgSave != m_pMasterStorage ) - { - OSL_ENSURE( m_pMasterStorage, "How could the document be initialized without storage!??\n" ); - HRESULT hr = m_pMasterStorage->CopyTo( NULL, NULL, NULL, pStgSave ); - if ( FAILED( hr ) ) return E_FAIL; - - STATSTG aStat; - hr = pStgSave->Stat( &aStat, STATFLAG_NONAME ); - if ( FAILED( hr ) ) return E_FAIL; - - DWORD nStreamMode = aStat.grfMode; - hr = pStgSave->CreateStream( reinterpret_cast(aOfficeEmbedStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &pTargetStream ); - if ( FAILED( hr ) || !pTargetStream ) return E_FAIL; - - hr = pStgSave->CreateStream( reinterpret_cast(aExtentStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &pNewExtStream ); - if ( FAILED( hr ) || !pNewExtStream ) return E_FAIL; - } - else - { - pTargetStream = m_pOwnStream; - pNewExtStream = m_pExtStream; - } - - HRESULT hr = E_FAIL; - - const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) ); - uno::Reference < io::XOutputStream > xTempOut = uno::Reference < io::XOutputStream > ( - m_xFactory->createInstance ( aServiceName ), - uno::UNO_QUERY ); - - if ( xTempOut.is() ) - { - uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if( xStorable.is() ) - { - try - { - xStorable->storeToURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "private:stream" ) ), - fillArgsForStoring_Impl( xTempOut ) ); - hr = copyXTempOutToIStream( xTempOut, pTargetStream ); - if ( SUCCEEDED( hr ) ) - { - // no need to truncate the stream, the size of the stream is always the same - ULARGE_INTEGER nNewPos; - LARGE_INTEGER aZero = { 0L, 0L }; - hr = pNewExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos ); - if ( SUCCEEDED( hr ) ) - { - SIZEL aSize; - hr = m_pDocHolder->GetExtent( &aSize ); - - if ( SUCCEEDED( hr ) ) - { - sal_uInt32 nWritten; - sal_Int8 aInf[EXT_STREAM_LENGTH]; - *((sal_Int32*)aInf) = 0; - *((sal_Int32*)&aInf[4]) = 0; - *((sal_Int32*)&aInf[8]) = aSize.cx; - *((sal_Int32*)&aInf[12]) = aSize.cy; - - hr = pNewExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten ); - if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL; - - if ( SUCCEEDED( hr ) ) - { - m_pOwnStream = CComPtr< IStream >(); - m_pExtStream = CComPtr< IStream >(); - if ( fSameAsLoad || pStgSave == m_pMasterStorage ) - { - uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if ( xMod.is() ) - xMod->setModified( sal_False ); - m_bIsDirty = sal_False; - } - } - } - } - } - } - catch( uno::Exception& ) - { - } - } - } - - return hr; -} - -STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage *pStgNew ) -{ - // m_pOwnStream == NULL && m_pMasterStorage != NULL means the object is in NoScribble mode - // m_pOwnStream == NULL && m_pMasterStorage == NULL means the object is in HandsOff mode - - if ( m_pOwnStream || m_pExtStream ) - return E_UNEXPECTED; - - if ( !m_pMasterStorage && !pStgNew ) - return E_INVALIDARG; - - if ( pStgNew ) - m_pMasterStorage = pStgNew; - - STATSTG aStat; - HRESULT hr = m_pMasterStorage->Stat( &aStat, STATFLAG_NONAME ); - if ( FAILED( hr ) ) return E_OUTOFMEMORY; - - DWORD nStreamMode = aStat.grfMode; - hr = m_pMasterStorage->OpenStream( reinterpret_cast(aOfficeEmbedStreamName.getStr()), - 0, - nStreamMode & 0x73, - 0, - &m_pOwnStream ); - if ( FAILED( hr ) || !m_pOwnStream ) return E_OUTOFMEMORY; - - hr = m_pMasterStorage->OpenStream( reinterpret_cast(aExtentStreamName.getStr()), - 0, - nStreamMode & 0x73, - 0, - &m_pExtStream ); - if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY; - - sal_Bool bModified = sal_False; - uno::Reference< util::XModifiable > xMod( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if ( xMod.is() ) - bModified = xMod->isModified(); - - for ( AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.begin(); iAdvise != m_aAdviseHashMap.end(); iAdvise++ ) - { - if ( iAdvise->second ) - iAdvise->second->OnSave(); - } - - if ( xMod.is() ) - bModified = xMod->isModified(); - - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::HandsOffStorage() -{ - m_pMasterStorage = CComPtr< IStorage >(); - m_pOwnStream = CComPtr< IStream >(); - m_pExtStream = CComPtr< IStream >(); - - return S_OK; -} - -//------------------------------------------------------------------------------- -// IPersistFile - -STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ ) -{ - if ( m_pDocHolder->GetDocument().is() ) - return CO_E_ALREADYINITIALIZED; - - if ( !m_xFactory.is() ) - return E_FAIL; - - DWORD nStreamMode = STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE | STGM_SHARE_EXCLUSIVE; - HRESULT hr = StgCreateDocfile( NULL, - nStreamMode , - 0, - &m_pMasterStorage ); - - if ( FAILED( hr ) || !m_pMasterStorage ) return E_FAIL; - - ::rtl::OUString aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ??? - CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - hr = WriteFmtUserTypeStg( m_pMasterStorage, - cf, // ??? - reinterpret_cast(( sal_Unicode* )aCurType.getStr()) ); - if ( FAILED( hr ) ) return E_FAIL; - - hr = m_pMasterStorage->SetClass( m_guid ); - if ( FAILED( hr ) ) return E_FAIL; - - hr = m_pMasterStorage->CreateStream( reinterpret_cast(aOfficeEmbedStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &m_pOwnStream ); - if ( FAILED( hr ) || !m_pOwnStream ) return E_FAIL; - - hr = m_pMasterStorage->CreateStream( reinterpret_cast(aExtentStreamName.getStr()), - STGM_CREATE | ( nStreamMode & 0x73 ), - 0, - 0, - &m_pExtStream ); - if ( FAILED( hr ) || !m_pExtStream ) return E_FAIL; - - - uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), - uno::UNO_QUERY ); - if ( aDocument.is() ) - { - m_pDocHolder->SetDocument( aDocument, sal_True ); - - uno::Reference< frame::XLoadable > xLoadable( m_pDocHolder->GetDocument(), uno::UNO_QUERY ); - if( xLoadable.is() ) - { - try - { - xLoadable->load( fillArgsForLoading_Impl( uno::Reference< io::XInputStream >(), - STGM_READWRITE, - pszFileName ) ); - hr = S_OK; - - m_aFileName = ::rtl::OUString( reinterpret_cast(pszFileName) ); - } - catch( uno::Exception& ) - { - } - } - - if ( hr == S_OK ) - { - ::rtl::OUString aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ??? - CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); - hr = WriteFmtUserTypeStg( m_pMasterStorage, - cf, // ??? - reinterpret_cast(( sal_Unicode* )aCurType.getStr()) ); - - if ( SUCCEEDED( hr ) ) - { - // no need to truncate the stream, the size of the stream is always the same - ULARGE_INTEGER nNewPos; - LARGE_INTEGER aZero = { 0L, 0L }; - hr = m_pExtStream->Seek( aZero, STREAM_SEEK_SET, &nNewPos ); - if ( SUCCEEDED( hr ) ) - { - SIZEL aSize; - hr = m_pDocHolder->GetExtent( &aSize ); - - if ( SUCCEEDED( hr ) ) - { - sal_uInt32 nWritten; - sal_Int8 aInf[EXT_STREAM_LENGTH]; - *((sal_Int32*)aInf) = 0; - *((sal_Int32*)&aInf[4]) = 0; - *((sal_Int32*)&aInf[8]) = aSize.cx; - *((sal_Int32*)&aInf[12]) = aSize.cy; - - hr = m_pExtStream->Write( (void*)aInf, EXT_STREAM_LENGTH, &nWritten ); - if ( nWritten != EXT_STREAM_LENGTH ) hr = E_FAIL; - } - } - } - - if ( SUCCEEDED( hr ) ) - m_bIsDirty = sal_True; - else - hr = E_FAIL; - } - - if ( FAILED( hr ) ) - { - m_pDocHolder->CloseDocument(); - m_pOwnStream = NULL; - m_pExtStream = NULL; - m_pMasterStorage = NULL; - } - } - - return hr; -} - -STDMETHODIMP EmbedDocument_Impl::Save( LPCOLESTR pszFileName, BOOL fRemember ) -{ - if ( !m_pDocHolder->GetDocument().is() || !m_xFactory.is() ) - return E_FAIL; - - HRESULT hr = E_FAIL; - - // TODO/LATER: currently there is no hands off state implemented - try - { - uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetDocument(), uno::UNO_QUERY_THROW ); - - if ( !pszFileName ) - xStorable->store(); - else - { - util::URL aURL; - aURL.Complete = ::rtl::OUString( reinterpret_cast( pszFileName ) ); - - ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.util.URLTransformer" ) ); - uno::Reference< util::XURLTransformer > aTransformer( m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY_THROW ); - - if ( aTransformer->parseSmart( aURL, ::rtl::OUString() ) && aURL.Complete.getLength() ) - { - if ( fRemember ) - { - xStorable->storeAsURL( aURL.Complete, fillArgsForStoring_Impl( uno::Reference< io::XOutputStream >() ) ); - m_aFileName = aURL.Complete; - } - else - xStorable->storeToURL( aURL.Complete, fillArgsForStoring_Impl( uno::Reference< io::XOutputStream >() ) ); - } - } - - hr = S_OK; - } - catch( uno::Exception& ) - { - } - - return hr; -} - -STDMETHODIMP EmbedDocument_Impl::SaveCompleted( LPCOLESTR pszFileName ) -{ - // the different file name would mean error here - m_aFileName = ::rtl::OUString( reinterpret_cast(pszFileName) ); - return S_OK; -} - -STDMETHODIMP EmbedDocument_Impl::GetCurFile( LPOLESTR *ppszFileName ) -{ - CComPtr pMalloc; - - HRESULT hr = CoGetMalloc( 1, &pMalloc ); - if ( FAILED( hr ) || !pMalloc ) return E_FAIL; - - *ppszFileName = (LPOLESTR)( pMalloc->Alloc( sizeof( sal_Unicode ) * ( m_aFileName.getLength() + 1 ) ) ); - wcsncpy( *ppszFileName, reinterpret_cast(m_aFileName.getStr()), m_aFileName.getLength() + 1 ); - - return m_aFileName.getLength() ? S_OK : S_FALSE; -} - -// =============================================== - -LockedEmbedDocument_Impl EmbeddedDocumentInstanceAccess_Impl::GetEmbedDocument() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - return LockedEmbedDocument_Impl( m_pEmbedDocument ); -} - -void EmbeddedDocumentInstanceAccess_Impl::ClearEmbedDocument() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pEmbedDocument = NULL; -} - -// =============================================== - -LockedEmbedDocument_Impl::LockedEmbedDocument_Impl() -: m_pEmbedDocument( NULL ) -{} - -LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument ) -: m_pEmbedDocument( pEmbedDocument ) -{ - if ( m_pEmbedDocument ) - m_pEmbedDocument->AddRef(); -} - -LockedEmbedDocument_Impl::LockedEmbedDocument_Impl( const LockedEmbedDocument_Impl& aDocLock ) -: m_pEmbedDocument( aDocLock.m_pEmbedDocument ) -{ - if ( m_pEmbedDocument ) - m_pEmbedDocument->AddRef(); -} - -LockedEmbedDocument_Impl& LockedEmbedDocument_Impl::operator=( const LockedEmbedDocument_Impl& aDocLock ) -{ - if ( m_pEmbedDocument ) - m_pEmbedDocument->Release(); - - m_pEmbedDocument = aDocLock.m_pEmbedDocument; - if ( m_pEmbedDocument ) - m_pEmbedDocument->AddRef(); - - return *this; -} - -LockedEmbedDocument_Impl::~LockedEmbedDocument_Impl() -{ - if ( m_pEmbedDocument ) - m_pEmbedDocument->Release(); -} - -void LockedEmbedDocument_Impl::ExecuteMethod( sal_Int16 nId ) -{ - if ( m_pEmbedDocument ) - { - if ( nId == OLESERV_SAVEOBJECT ) - m_pEmbedDocument->SaveObject(); - else if ( nId == OLESERV_CLOSE ) - m_pEmbedDocument->Close( 0 ); - else if ( nId == OLESERV_NOTIFY ) - m_pEmbedDocument->notify(); - else if ( nId == OLESERV_NOTIFYCLOSING ) - m_pEmbedDocument->OLENotifyClosing(); - else if ( nId == OLESERV_SHOWOBJECT ) - m_pEmbedDocument->ShowObject(); - else if ( nId == OLESERV_DEACTIVATE ) - m_pEmbedDocument->Deactivate(); - } -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/esdll.cxx b/embedserv/source/embed/esdll.cxx deleted file mode 100644 index 582a3dcba..000000000 --- a/embedserv/source/embed/esdll.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define STRICT -#define _WIN32_WINNT 0x0400 -#define _WIN32_DCOM -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#ifdef __MINGW32__ -#define _INIT_ATL_COMMON_VARS -#endif - -#include "stdafx.h" - -#include -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable: 4710 ) -#endif -CComModule _Module; -#ifdef _MSC_VER -#pragma warning( pop ) -#endif -#include - -BEGIN_OBJECT_MAP(ObjectMap) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - - -#include "syswinwrapper.hxx" -#include "docholder.hxx" - - -HINSTANCE DocumentHolder::m_hInstance; - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - DocumentHolder::m_hInstance = hInstance; - if (!winwrap::HatchWindowRegister(hInstance)) - return FALSE; - - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, NULL); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - _Module.Term(); - } - return TRUE; // ok -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/guid.cxx b/embedserv/source/embed/guid.cxx deleted file mode 100644 index 2737eec04..000000000 --- a/embedserv/source/embed/guid.cxx +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "common.h" -#include -#include - -::rtl::OUString getStorageTypeFromGUID_Impl( GUID* guid ) -{ - if ( *guid == OID_WriterTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarWriterDocument.6" ) ); - - if ( *guid == OID_WriterOASISTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.WriterDocument.1" ) ); - - if ( *guid == OID_CalcServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarCalcDocument.6" ) ); - - if ( *guid == OID_CalcOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.CalcDocument.1" ) ); - - if ( *guid == OID_DrawingServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarDrawDocument.6" ) ); - - if ( *guid == OID_DrawingOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.DrawDocument.1" ) ); - - if ( *guid == OID_PresentationServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarImpressDocument.6" ) ); - - if ( *guid == OID_PresentationOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.ImpressDocument.1" ) ); - - if ( *guid == OID_MathServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "soffice.StarMathDocument.6" ) ); - - if ( *guid == OID_MathOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "opendocument.MathDocument.1" ) ); - - return ::rtl::OUString(); -} - -::rtl::OUString getServiceNameFromGUID_Impl( GUID* guid ) -{ - if ( *guid == OID_WriterTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) ); - - if ( *guid == OID_WriterOASISTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) ); - - if ( *guid == OID_CalcServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) ); - - if ( *guid == OID_CalcOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Calc.SpreadsheetDocument" ) ); - - if ( *guid == OID_DrawingServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) ); - - if ( *guid == OID_DrawingOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.DrawingDocument" ) ); - - if ( *guid == OID_PresentationServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) ); - - if ( *guid == OID_PresentationOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.PresentationDocument" ) ); - - if ( *guid == OID_MathServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) ); - - if ( *guid == OID_MathOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Math.FormulaDocument" ) ); - - return ::rtl::OUString(); -} - -::rtl::OUString getFilterNameFromGUID_Impl( GUID* guid ) -{ - if ( *guid == OID_WriterTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Writer)" ) ); - - if ( *guid == OID_WriterOASISTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer8" ) ); - - if ( *guid == OID_CalcServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Calc)" ) ); - - if ( *guid == OID_CalcOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "calc8" ) ); - - if ( *guid == OID_DrawingServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Draw)" ) ); - - if ( *guid == OID_DrawingOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw8" ) ); - - if ( *guid == OID_PresentationServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Impress)" ) ); - - if ( *guid == OID_PresentationOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "impress8" ) ); - - if ( *guid == OID_MathServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "StarOffice XML (Math)" ) ); - - if ( *guid == OID_MathOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "math8" ) ); - - return ::rtl::OUString(); -} - -::rtl::OUString getTestFileURLFromGUID_Impl( GUID* guid ) -{ - if ( *guid == OID_WriterTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxw" ) ); - - if ( *guid == OID_WriterOASISTextServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odt" ) ); - - if ( *guid == OID_CalcServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxc" ) ); - - if ( *guid == OID_CalcOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.ods" ) ); - - if ( *guid == OID_DrawingServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxd" ) ); - - if ( *guid == OID_DrawingOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odg" ) ); - - if ( *guid == OID_PresentationServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxi" ) ); - - if ( *guid == OID_PresentationOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odp" ) ); - - if ( *guid == OID_MathServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.sxm" ) ); - - if ( *guid == OID_MathOASISServer ) - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "file:///d:/OLE_TEST/test.odf" ) ); - - return ::rtl::OUString(); -} - -/* -::rtl::OUString getCurTypeNameFromGUID_Impl( const uno::Reference< lang::XMultiServiceFactory > xFactory, GUID* guid ) -{ - ::rtl::OUString aResult; - - const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.document.FilterFactory" ) ); - uno::Reference < container::XNameAccess > xFilters = uno::Reference < io::XOutputStream > ( - xFactory->createInstance ( aServiceName ), - uno::UNO_QUERY ); - - if ( xFilters.is() ) - { - ::rtl::OUString aFilterName = getFilterNameFromGUID_Impl( guid ); - if ( aFilterName.getLength() ) - { - uno::Any aAnyProp = xFilters->getByName( aFilterName ); - uno::Sequence< beans::PropertyValue > aProperties; - if ( aAnyProp >>= aProperties ) ) - { - for ( sal_Int32 nInd = 0; nInd < aProperties.getLength; nInd++ ) - if ( aProperties[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UIName" ) ) - { - aProperties[nInd].Value >>= aResult; - break; - } - } - } - } - - return aResult; -} -*/ - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/iipaobj.cxx b/embedserv/source/embed/iipaobj.cxx deleted file mode 100644 index d3d5ea77f..000000000 --- a/embedserv/source/embed/iipaobj.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "iipaobj.hxx" -#include "embeddoc.hxx" - - - -CIIAObj::CIIAObj(DocumentHolder* pDocHolder) - : m_refCount( 0L ), - m_rDocHolder( pDocHolder ) -{ -} - - -CIIAObj::~CIIAObj() -{ - return; -} - -/* IUnknown methods */ - -STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv) -{ - *ppv=NULL; - - if(IID_IUnknown==riid || - IID_IOleWindow==riid || - IID_IOleInPlaceActiveObject==riid) - *ppv=this; - - //AddRef any interface we'll return. - if (NULL!=*ppv) - { - ((LPUNKNOWN)*ppv)->AddRef(); - return NOERROR; - } - - return ResultFromScode(E_NOINTERFACE); -} - - -STDMETHODIMP_(ULONG) CIIAObj::AddRef(void) -{ - return osl_incrementInterlockedCount( &m_refCount); -} - -STDMETHODIMP_(ULONG) CIIAObj::Release(void) -{ - sal_Int32 nCount = osl_decrementInterlockedCount( &m_refCount); - if ( nCount == 0 ) - delete this; - - return nCount; -} - -/* IOleInPlaceActiveObject methods*/ - -STDMETHODIMP CIIAObj::GetWindow(HWND *) -{ - return NOERROR; -} - -STDMETHODIMP CIIAObj::ContextSensitiveHelp(BOOL) -{ - return NOERROR; -} - -STDMETHODIMP CIIAObj::TranslateAccelerator(LPMSG) -{ - return NOERROR; -} - -STDMETHODIMP CIIAObj::OnFrameWindowActivate(BOOL) -{ - return NOERROR; -} - -STDMETHODIMP CIIAObj::OnDocWindowActivate(BOOL) -{ - return NOERROR; -} - -STDMETHODIMP CIIAObj::ResizeBorder( - LPCRECT pRect,LPOLEINPLACEUIWINDOW,BOOL bFrame) -{ - if(!bFrame) return NOERROR; - - if ( !m_rDocHolder.is() ) - return E_FAIL; - - return m_rDocHolder->SetContRects(pRect); -} - - -STDMETHODIMP CIIAObj::EnableModeless(BOOL) -{ - return NOERROR; -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/intercept.cxx b/embedserv/source/embed/intercept.cxx deleted file mode 100644 index 02f575166..000000000 --- a/embedserv/source/embed/intercept.cxx +++ /dev/null @@ -1,592 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#include -#include -#include - -using namespace ::com::sun::star; - - - -#define IUL 6 - - - -uno::Sequence< ::rtl::OUString > Interceptor::m_aInterceptedURL(IUL); - - - - -struct equalOUString -{ - bool operator()( - const rtl::OUString& rKey1, - const rtl::OUString& rKey2 ) const - { - return !!( rKey1 == rKey2 ); - } -}; - - -struct hashOUString -{ - size_t operator()( const rtl::OUString& rName ) const - { - return rName.hashCode(); - } -}; - - - -class StatusChangeListenerContainer - : public ::cppu::OMultiTypeInterfaceContainerHelperVar< -rtl::OUString,hashOUString,equalOUString> -{ -public: - StatusChangeListenerContainer( ::osl::Mutex& aMutex ) - : cppu::OMultiTypeInterfaceContainerHelperVar< - rtl::OUString,hashOUString,equalOUString>(aMutex) - { - } -}; - - -void SAL_CALL -Interceptor::addEventListener( - const uno::Reference& Listener ) - throw( uno::RuntimeException ) -{ - osl::MutexGuard aGuard( m_aMutex ); - - if ( ! m_pDisposeEventListeners ) - m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_aMutex ); - - m_pDisposeEventListeners->addInterface( Listener ); -} - - -void SAL_CALL -Interceptor::removeEventListener( - const uno::Reference< lang::XEventListener >& Listener ) - throw( uno::RuntimeException ) -{ - osl::MutexGuard aGuard( m_aMutex ); - - if ( m_pDisposeEventListeners ) - m_pDisposeEventListeners->removeInterface( Listener ); -} - - -void SAL_CALL Interceptor::dispose() - throw(::com::sun::star::uno::RuntimeException) -{ - lang::EventObject aEvt; - aEvt.Source = static_cast< frame::XDispatch* >( this ); - - osl::MutexGuard aGuard(m_aMutex); - - if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() ) - m_pDisposeEventListeners->disposeAndClear( aEvt ); - - if(m_pStatCL) - m_pStatCL->disposeAndClear( aEvt ); - - m_xSlaveDispatchProvider = 0; - m_xMasterDispatchProvider = 0; -} - - - -Interceptor::Interceptor( - const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess, - DocumentHolder* pDocH, - sal_Bool bLink ) - : m_xOleAccess( xOleAccess ), - m_xDocHLocker( static_cast< ::cppu::OWeakObject* >( pDocH ) ), - m_pDocH(pDocH), - m_pStatCL(0), - m_pDisposeEventListeners(0), - m_bLink( bLink ) -{ - m_aInterceptedURL[0] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); - m_aInterceptedURL[1] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAll")); - m_aInterceptedURL[2] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc")); - m_aInterceptedURL[3] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:CloseWin")); - m_aInterceptedURL[4] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:CloseFrame")); - m_aInterceptedURL[5] = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAs")); -} - - -Interceptor::~Interceptor() -{ - if( m_pDisposeEventListeners ) - delete m_pDisposeEventListeners; - - if(m_pStatCL) - delete m_pStatCL; - - DocumentHolder* pTmpDocH = NULL; - uno::Reference< uno::XInterface > xLock; - { - osl::MutexGuard aGuard(m_aMutex); - xLock = m_xDocHLocker.get(); - if ( xLock.is() ) - pTmpDocH = m_pDocH; - } - - if ( pTmpDocH ) - pTmpDocH->ClearInterceptor(); -} - -void Interceptor::DisconnectDocHolder() -{ - osl::MutexGuard aGuard(m_aMutex); - m_xDocHLocker.clear(); - m_pDocH = NULL; - m_xOleAccess = NULL; -} - -//XDispatch -void SAL_CALL -Interceptor::dispatch( - const util::URL& URL, - const uno::Sequence< - beans::PropertyValue >& Arguments ) - throw (uno::RuntimeException) -{ - ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > xOleAccess; - { - osl::MutexGuard aGuard(m_aMutex); - xOleAccess = m_xOleAccess; - } - - if ( xOleAccess.is() ) - { - LockedEmbedDocument_Impl aDocLock = xOleAccess->GetEmbedDocument(); - if ( aDocLock.GetEmbedDocument() ) - { - if( !m_bLink && URL.Complete == m_aInterceptedURL[0]) - aDocLock.GetEmbedDocument()->SaveObject(); - else if(!m_bLink - && ( URL.Complete == m_aInterceptedURL[2] || - URL.Complete == m_aInterceptedURL[3] || - URL.Complete == m_aInterceptedURL[4] ) ) - aDocLock.GetEmbedDocument()->Close( 0 ); - else if ( URL.Complete == m_aInterceptedURL[5] ) - { - uno::Sequence< beans::PropertyValue > aNewArgs = Arguments; - sal_Int32 nInd = 0; - - while( nInd < aNewArgs.getLength() ) - { - if ( aNewArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SaveTo" ) ) ) - { - aNewArgs[nInd].Value <<= sal_True; - break; - } - nInd++; - } - - if ( nInd == aNewArgs.getLength() ) - { - aNewArgs.realloc( nInd + 1 ); - aNewArgs[nInd].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SaveTo" )); - aNewArgs[nInd].Value <<= sal_True; - } - - uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch( - URL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_self" )), 0 ); - if ( xDispatch.is() ) - xDispatch->dispatch( URL, aNewArgs ); - } - } - } -} - - -void Interceptor::generateFeatureStateEvent() -{ - if( m_pStatCL ) - { - DocumentHolder* pTmpDocH = NULL; - uno::Reference< uno::XInterface > xLock; - { - osl::MutexGuard aGuard(m_aMutex); - xLock = m_xDocHLocker.get(); - if ( xLock.is() ) - pTmpDocH = m_pDocH; - } - - ::rtl::OUString aTitle; - if ( pTmpDocH ) - aTitle = pTmpDocH->getTitle(); - - for(int i = 0; i < IUL; ++i) - { - if( i == 1 || m_bLink && i != 5 ) - continue; - - cppu::OInterfaceContainerHelper* pICH = - m_pStatCL->getContainer(m_aInterceptedURL[i]); - uno::Sequence > aSeq; - if(pICH) - aSeq = pICH->getElements(); - if(!aSeq.getLength()) - continue; - - frame::FeatureStateEvent aStateEvent; - aStateEvent.IsEnabled = sal_True; - aStateEvent.Requery = sal_False; - if(i == 0) - { - - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Update")); - aStateEvent.State <<= (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("($1) ")) + - aTitle); - - } - else if ( i == 5 ) - { - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("SaveCopyTo")); - aStateEvent.State <<= (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("($3)"))); - } - else - { - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Close and Return")); - aStateEvent.State <<= (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("($2) ")) + - aTitle); - - } - - for(sal_Int32 k = 0; k < aSeq.getLength(); ++k) - { - uno::Reference - Control(aSeq[k],uno::UNO_QUERY); - if(Control.is()) - Control->statusChanged(aStateEvent); - - } - } - } -} - - -void SAL_CALL -Interceptor::addStatusListener( - const uno::Reference< - frame::XStatusListener >& Control, - const util::URL& URL ) - throw ( - uno::RuntimeException - ) -{ - if(!Control.is()) - return; - - if( !m_bLink && URL.Complete == m_aInterceptedURL[0] ) - { // Save - DocumentHolder* pTmpDocH = NULL; - uno::Reference< uno::XInterface > xLock; - { - osl::MutexGuard aGuard(m_aMutex); - xLock = m_xDocHLocker.get(); - if ( xLock.is() ) - pTmpDocH = m_pDocH; - } - - ::rtl::OUString aTitle; - if ( pTmpDocH ) - aTitle = pTmpDocH->getTitle(); - - frame::FeatureStateEvent aStateEvent; - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Update")); - aStateEvent.IsEnabled = sal_True; - aStateEvent.Requery = sal_False; - aStateEvent.State <<= (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("($1) ")) + - aTitle ); - Control->statusChanged(aStateEvent); - - { - osl::MutexGuard aGuard(m_aMutex); - if(!m_pStatCL) - m_pStatCL = - new StatusChangeListenerContainer(m_aMutex); - } - - m_pStatCL->addInterface(URL.Complete,Control); - return; - } - - sal_Int32 i = 2; - if ( !m_bLink - && ( URL.Complete == m_aInterceptedURL[i] || - URL.Complete == m_aInterceptedURL[++i] || - URL.Complete == m_aInterceptedURL[++i] ) ) - { // Close and return - DocumentHolder* pTmpDocH = NULL; - uno::Reference< uno::XInterface > xLock; - { - osl::MutexGuard aGuard(m_aMutex); - xLock = m_xDocHLocker.get(); - if ( xLock.is() ) - pTmpDocH = m_pDocH; - } - - ::rtl::OUString aTitle; - if ( pTmpDocH ) - aTitle = pTmpDocH->getTitle(); - - frame::FeatureStateEvent aStateEvent; - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("Close and Return")); - aStateEvent.IsEnabled = sal_True; - aStateEvent.Requery = sal_False; - aStateEvent.State <<= (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("($2) ")) + - aTitle ); - Control->statusChanged(aStateEvent); - - - { - osl::MutexGuard aGuard(m_aMutex); - if(!m_pStatCL) - m_pStatCL = - new StatusChangeListenerContainer(m_aMutex); - } - - m_pStatCL->addInterface(URL.Complete,Control); - return; - } - - if(URL.Complete == m_aInterceptedURL[5]) - { // SaveAs - frame::FeatureStateEvent aStateEvent; - aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5]; - aStateEvent.FeatureDescriptor = rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("SaveCopyTo")); - aStateEvent.IsEnabled = sal_True; - aStateEvent.Requery = sal_False; - aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($3)"))); - Control->statusChanged(aStateEvent); - - { - osl::MutexGuard aGuard(m_aMutex); - if(!m_pStatCL) - m_pStatCL = - new StatusChangeListenerContainer(m_aMutex); - } - - m_pStatCL->addInterface(URL.Complete,Control); - return; - } - -} - - -void SAL_CALL -Interceptor::removeStatusListener( - const uno::Reference< - frame::XStatusListener >& Control, - const util::URL& URL ) - throw ( - uno::RuntimeException - ) -{ - if(!(Control.is() && m_pStatCL)) - return; - else { - m_pStatCL->removeInterface(URL.Complete,Control); - return; - } -} - - -//XInterceptorInfo -uno::Sequence< ::rtl::OUString > -SAL_CALL -Interceptor::getInterceptedURLs( ) - throw ( - uno::RuntimeException - ) -{ - // now implemented as update - if ( m_bLink ) - { - uno::Sequence< ::rtl::OUString > aResult( 2 ); - aResult[0] = m_aInterceptedURL[1]; - aResult[1] = m_aInterceptedURL[5]; - - return aResult; - } - - return m_aInterceptedURL; -} - - -// XDispatchProvider - -uno::Reference< frame::XDispatch > SAL_CALL -Interceptor::queryDispatch( - const util::URL& URL, - const ::rtl::OUString& TargetFrameName, - sal_Int32 SearchFlags ) - throw ( - uno::RuntimeException - ) -{ - osl::MutexGuard aGuard(m_aMutex); - if( !m_bLink && URL.Complete == m_aInterceptedURL[0] ) - return (frame::XDispatch*)this; - else if(URL.Complete == m_aInterceptedURL[1]) - return (frame::XDispatch*)0 ; - else if( !m_bLink && URL.Complete == m_aInterceptedURL[2] ) - return (frame::XDispatch*)this; - else if( !m_bLink && URL.Complete == m_aInterceptedURL[3] ) - return (frame::XDispatch*)this; - else if( !m_bLink && URL.Complete == m_aInterceptedURL[4] ) - return (frame::XDispatch*)this; - else if(URL.Complete == m_aInterceptedURL[5]) - return (frame::XDispatch*)this; - else { - if(m_xSlaveDispatchProvider.is()) - return m_xSlaveDispatchProvider->queryDispatch( - URL,TargetFrameName,SearchFlags); - else - return uno::Reference(0); - } -} - -uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL -Interceptor::queryDispatches( - const uno::Sequence& Requests ) - throw ( - uno::RuntimeException - ) -{ - uno::Sequence< uno::Reference< frame::XDispatch > > aRet; - osl::MutexGuard aGuard(m_aMutex); - if(m_xSlaveDispatchProvider.is()) - aRet = m_xSlaveDispatchProvider->queryDispatches(Requests); - else - aRet.realloc(Requests.getLength()); - - for(sal_Int32 i = 0; i < Requests.getLength(); ++i) - if ( !m_bLink && m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete ) - aRet[i] = (frame::XDispatch*) this; - else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete) - aRet[i] = (frame::XDispatch*) 0; - else if( !m_bLink && m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete ) - aRet[i] = (frame::XDispatch*) this; - else if( !m_bLink && m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete ) - aRet[i] = (frame::XDispatch*) this; - else if( !m_bLink && m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete ) - aRet[i] = (frame::XDispatch*) this; - else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete) - aRet[i] = (frame::XDispatch*) this; - - return aRet; -} - - - -//XDispatchProviderInterceptor - -uno::Reference< frame::XDispatchProvider > SAL_CALL -Interceptor::getSlaveDispatchProvider( ) - throw ( - uno::RuntimeException - ) -{ - osl::MutexGuard aGuard(m_aMutex); - return m_xSlaveDispatchProvider; -} - -void SAL_CALL -Interceptor::setSlaveDispatchProvider( - const uno::Reference< frame::XDispatchProvider >& NewDispatchProvider ) - throw ( - uno::RuntimeException - ) -{ - osl::MutexGuard aGuard(m_aMutex); - m_xSlaveDispatchProvider = NewDispatchProvider; -} - - -uno::Reference< frame::XDispatchProvider > SAL_CALL -Interceptor::getMasterDispatchProvider( ) - throw ( - uno::RuntimeException - ) -{ - osl::MutexGuard aGuard(m_aMutex); - return m_xMasterDispatchProvider; -} - - -void SAL_CALL -Interceptor::setMasterDispatchProvider( - const uno::Reference< frame::XDispatchProvider >& NewSupplier ) - throw ( - uno::RuntimeException - ) -{ - osl::MutexGuard aGuard(m_aMutex); - m_xMasterDispatchProvider = NewSupplier; -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/makefile.mk b/embedserv/source/embed/makefile.mk deleted file mode 100755 index a531858bc..000000000 --- a/embedserv/source/embed/makefile.mk +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=embedserv -TARGET=emser - - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(DISABLE_ATL)"=="" - -LIBTARGET=NO -USE_DEFFILE=NO - -INCPRE+= $(ATL_INCLUDE) - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/register.obj \ - $(SLO)$/servprov.obj \ - $(SLO)$/docholder.obj \ - $(SLO)$/ed_ipersiststr.obj \ - $(SLO)$/ed_idataobj.obj \ - $(SLO)$/ed_ioleobject.obj \ - $(SLO)$/ed_iinplace.obj \ - $(SLO)$/iipaobj.obj \ - $(SLO)$/guid.obj \ - $(SLO)$/esdll.obj \ - $(SLO)$/intercept.obj \ - $(SLO)$/syswinwrapper.obj \ - $(SLO)$/tracker.obj - -EXCEPTIONSFILES= \ - $(SLO)$/register.obj \ - $(SLO)$/docholder.obj \ - $(SLO)$/ed_ipersiststr.obj \ - $(SLO)$/ed_idataobj.obj \ - $(SLO)$/ed_iinplace.obj \ - $(SLO)$/ed_ioleobject.obj \ - $(SLO)$/iipaobj.obj \ - $(SLO)$/intercept.obj \ - $(SLO)$/syswinwrapper.obj \ - $(SLO)$/tracker.obj - -.ENDIF - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/embedserv/source/embed/register.cxx b/embedserv/source/embed/register.cxx deleted file mode 100644 index 841c9966f..000000000 --- a/embedserv/source/embed/register.cxx +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#ifdef __MINGW32__ -#define INITGUID -#endif -#include "servprov.hxx" -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star; - - -uno::Reference SAL_CALL EmbedServer_createInstance( - const uno::Reference & xSMgr) -throw (uno::Exception) -{ - uno::Reference xService = *new EmbedServer_Impl( xSMgr ); - return xService; -} - -::rtl::OUString SAL_CALL EmbedServer_getImplementationName() throw() -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.EmbedServer") ); - -} - -uno::Sequence< ::rtl::OUString > SAL_CALL EmbedServer_getSupportedServiceNames() throw() -{ - uno::Sequence< ::rtl::OUString > aServiceNames( 1 ); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OleEmbeddedServerRegistration" ) ); - return aServiceNames; -} - -extern "C" { - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); - uno::Reference< lang::XSingleServiceFactory > xFactory; - - if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) ) - { - xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager), - EmbedServer_getImplementationName(), - EmbedServer_createInstance, - EmbedServer_getSupportedServiceNames() ); - } - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -} // extern "C" - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/servprov.cxx b/embedserv/source/embed/servprov.cxx deleted file mode 100644 index e21780903..000000000 --- a/embedserv/source/embed/servprov.cxx +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "stdafx.h" -#include "servprov.hxx" -#include "embeddoc.hxx" -#include -#include -#include -#include - -using namespace com::sun::star; - -const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = { - &OID_WriterTextServer, - &OID_WriterOASISTextServer, - &OID_CalcServer, - &OID_CalcOASISServer, - &OID_DrawingServer, - &OID_DrawingOASISServer, - &OID_PresentationServer, - &OID_PresentationOASISServer, - &OID_MathServer, - &OID_MathOASISServer -}; - -class CurThreadData -{ - public: - CurThreadData(); - virtual ~CurThreadData(); - - sal_Bool SAL_CALL setData(void *pData); - - void* SAL_CALL getData(); - - protected: - oslThreadKey m_hKey; -}; - -CurThreadData::CurThreadData() -{ - m_hKey = osl_createThreadKey( (oslThreadKeyCallbackFunction)NULL ); -} - -CurThreadData::~CurThreadData() -{ - osl_destroyThreadKey(m_hKey); -} - -sal_Bool CurThreadData::setData(void *pData) -{ - OSL_ENSURE( m_hKey, "No thread key!\n" ); - return (osl_setThreadKeyData(m_hKey, pData)); -} - -void *CurThreadData::getData() -{ - OSL_ENSURE( m_hKey, "No thread key!\n" ); - return (osl_getThreadKeyData(m_hKey)); -} - - -// CoInitializeEx * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD); -// CoInitialize * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID); - -void o2u_attachCurrentThread() -{ - static CurThreadData oleThreadData; - - if ( oleThreadData.getData() != 0 ) - { - HINSTANCE inst= LoadLibrary( _T("ole32.dll")); - if( inst ) - { - HRESULT hr; - ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx")); - if( initFuncEx) - hr= initFuncEx( NULL, COINIT_MULTITHREADED); - else - { - ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize")); - if( initFunc) - hr= initFunc( NULL); - } - } - oleThreadData.setData((void*)sal_True); - } -} - - -//=============================================================================== -// EmbedServer_Impl - -EmbedServer_Impl::EmbedServer_Impl( const uno::Reference& xFactory): - m_xFactory( xFactory) -{ - for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ ) - { - m_pOLEFactories[nInd] = new EmbedProviderFactory_Impl( m_xFactory, guidList[nInd] ); - m_pOLEFactories[nInd]->registerClass(); - } -} - -EmbedServer_Impl::~EmbedServer_Impl() -{ - for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ ) - { - if ( m_pOLEFactories[nInd] ) - m_pOLEFactories[nInd]->deregisterClass(); - } -} - -// XInterface -------------------------------------------------- -uno::Any SAL_CALL -EmbedServer_Impl::queryInterface( - const uno::Type& aType ) - throw( - uno::RuntimeException - ) -{ - uno::Any a= - ::cppu::queryInterface( - aType, static_cast(this)); - if( a == uno::Any()) - return OWeakObject::queryInterface( aType); - else - return a; -} - -void SAL_CALL EmbedServer_Impl::acquire( ) throw(uno::RuntimeException) -{ - OWeakObject::acquire(); -} - -void SAL_CALL EmbedServer_Impl::release( ) throw (uno::RuntimeException) -{ - OWeakObject::release(); -} - - -// XTypeProvider -------------------------------------------------- -uno::Sequence< uno::Type > SAL_CALL -EmbedServer_Impl::getTypes( ) - throw( - uno::RuntimeException - ) -{ - static ::cppu::OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static ::cppu::OTypeCollection collection( - getCppuType( - reinterpret_cast*>(0)), - getCppuType( - reinterpret_cast< - uno::Reference< lang::XTypeProvider>*>(0))); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); -} - -uno::Sequence< sal_Int8 > SAL_CALL EmbedServer_Impl::getImplementationId() throw(uno::RuntimeException) -{ - static ::cppu::OImplementationId *pId = 0; - if( ! pId ) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! pId ) - { - static ::cppu::OImplementationId id( sal_False ); - pId = &id; - } - } - return (*pId).getImplementationId(); -} - -//=============================================================================== -// EmbedProviderFactory_Impl - -EmbedProviderFactory_Impl::EmbedProviderFactory_Impl(const uno::Reference& xFactory, const GUID* pGuid) - : m_refCount( 0L ) - , m_xFactory( xFactory ) - , m_guid( *pGuid ) -{ -} - -EmbedProviderFactory_Impl::~EmbedProviderFactory_Impl() -{ -} - -sal_Bool EmbedProviderFactory_Impl::registerClass() -{ - HRESULT hresult; - - o2u_attachCurrentThread(); - - hresult = CoRegisterClassObject( - m_guid, - this, - CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE, - &m_factoryHandle); - - return (hresult == NOERROR); -} - -sal_Bool EmbedProviderFactory_Impl::deregisterClass() -{ - HRESULT hresult = CoRevokeClassObject( m_factoryHandle ); - - return (hresult == NOERROR); -} - -STDMETHODIMP EmbedProviderFactory_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IClassFactory*) this; - return NOERROR; - } - else if (IsEqualIID(riid, IID_IClassFactory)) - { - AddRef(); - *ppv = (IClassFactory*) this; - return NOERROR; - } - - *ppv = NULL; - return ResultFromScode(E_NOINTERFACE); -} - -STDMETHODIMP_(ULONG) EmbedProviderFactory_Impl::AddRef() -{ - return osl_incrementInterlockedCount( &m_refCount); -} - -STDMETHODIMP_(ULONG) EmbedProviderFactory_Impl::Release() -{ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex()); - sal_Int32 nCount = --m_refCount; - if ( nCount == 0 ) - { - delete this; - } - - return nCount; -} - -STDMETHODIMP EmbedProviderFactory_Impl::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) -{ - punkOuter = NULL; - - IUnknown* pEmbedDocument = (IUnknown*)(IPersistStorage*)( new EmbedDocument_Impl( m_xFactory, &m_guid ) ); - - return pEmbedDocument->QueryInterface( riid, ppv ); -} - -STDMETHODIMP EmbedProviderFactory_Impl::LockServer( int /*fLock*/ ) -{ - return NOERROR; -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/stdafx.cpp b/embedserv/source/embed/stdafx.cpp deleted file mode 100644 index efb58b5d7..000000000 --- a/embedserv/source/embed/stdafx.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx1.cpp : source file that includes just the standard includes -// stdafx1.pch will be the pre-compiled header -// stdafx1.obj will contain the pre-compiled type information - - -#include "stdafx2.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/syswinwrapper.cxx b/embedserv/source/embed/syswinwrapper.cxx deleted file mode 100644 index c247617d9..000000000 --- a/embedserv/source/embed/syswinwrapper.cxx +++ /dev/null @@ -1,480 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "docholder.hxx" -#include "syswinwrapper.hxx" - -/* - * CWindow::CWindow - * CWindow::~CWindow - * - * Constructor Parameters: - * hInst HINSTANCE of the task owning us. - */ - - -using namespace winwrap; - - -#define HWWL_STRUCTURE 0 - -//Notification codes for WM_COMMAND messages -#define HWN_BORDERDOUBLECLICKED 1 -#define CBHATCHWNDEXTRA (sizeof(LONG)) -#define SZCLASSHATCHWIN TEXT("hatchwin") -#define SendCommand(hWnd, wID, wCode, hControl) \ - SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(wID, wCode) \ - , (LPARAM)hControl) - - -typedef CHatchWin *PCHatchWin; - - -void DrawShading(LPRECT prc, HDC hDC, UINT cWidth); - - - -winwrap::CWindow::CWindow(HINSTANCE hInst) -{ - m_hInst=hInst; - m_hWnd=NULL; - return; -} - -winwrap::CWindow::~CWindow(void) -{ - if (IsWindow(m_hWnd)) - DestroyWindow(m_hWnd); - - return; -} - - - -/* - * CWindow::Window - * - * Purpose: - * Returns the window handle associated with this object. - * - * Return Value: - * HWND Window handle for this object - */ - -HWND winwrap::CWindow::Window(void) -{ - return m_hWnd; -} - - - -/* - * CWindow::Instance - * - * Purpose: - * Returns the instance handle associated with this object. - * - * Return Value: - * HINSTANCE Instance handle of the module stored here. - */ - -HINSTANCE winwrap::CWindow::Instance(void) -{ - return m_hInst; -} - - - - - -//Hatch pattern brush bits -static WORD g_wHatchBmp[]={0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88}; - -// void DrawShading(LPRECT, HDC, UINT); - - -/* - * HatchWindowRegister - * - * Purpose: - * Registers the hatch window class for use with CHatchWin. - * - * Parameters: - * hInst HINSTANCE under which to register. - * - * Return Value: - * BOOL TRUE if successful, FALSE otherwise. - */ - -BOOL winwrap::HatchWindowRegister(HINSTANCE hInst) -{ - WNDCLASS wc; - - //Must have CS_DBLCLKS for border! - wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; - wc.hInstance = hInst; - wc.cbClsExtra = 0; - wc.lpfnWndProc = HatchWndProc; - wc.cbWndExtra = CBHATCHWNDEXTRA; - wc.hIcon = NULL; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wc.lpszMenuName = NULL; - wc.lpszClassName = SZCLASSHATCHWIN; - - return RegisterClass(&wc); - return FALSE; -} - - - - -/* - * CHatchWin:CHatchWin - * CHatchWin::~CHatchWin - * - * Constructor Parameters: - * hInst HINSTANCE of the application we're in. - */ - -CHatchWin::CHatchWin(HINSTANCE hInst,const DocumentHolder* pDocHolder) - : CWindow(hInst), - m_aTracker() -{ - m_hWnd=NULL; - m_hWndKid=NULL; - m_hWndAssociate=NULL; - m_uID=0; - - m_dBorderOrg=GetProfileInt(TEXT("windows") - , TEXT("OleInPlaceBorderWidth") - , HATCHWIN_BORDERWIDTHDEFAULT); - - m_dBorder=m_dBorderOrg; - SetRect(&m_rcPos, 0, 0, 0, 0); - SetRect(&m_rcClip, 0, 0, 0, 0); - - m_pDocHolder = pDocHolder; - return; -} - - -CHatchWin::~CHatchWin(void) -{ - /* - * Chances are this was already destroyed when a document - * was destroyed. - */ - if (NULL!=m_hWnd && IsWindow(m_hWnd)) - DestroyWindow(m_hWnd); - - return; -} - - - -/* - * CHatchWin::Init - * - * Purpose: - * Instantiates a hatch window within a given parent with a - * default rectangle. This is not initially visible. - * - * Parameters: - * hWndParent HWND of the parent of this window - * uID UINT identifier for this window (send in - * notifications to associate window). - * hWndAssoc HWND of the initial associate. - * - * Return Value: - * BOOL TRUE if the function succeeded, FALSE otherwise. - */ - -BOOL CHatchWin::Init(HWND hWndParent, UINT uID, HWND hWndAssoc) -{ - m_hWndParent = hWndParent; - m_hWnd=CreateWindowEx( - WS_EX_NOPARENTNOTIFY, SZCLASSHATCHWIN - , SZCLASSHATCHWIN, WS_CHILD | WS_CLIPSIBLINGS - | WS_CLIPCHILDREN, 0, 0, 100, 100, hWndParent, (HMENU)uID - , m_hInst, this); - - m_uID=uID; - m_hWndAssociate=hWndAssoc; - - return (NULL!=m_hWnd); -} - - -void CHatchWin::SetTrans() -{ - HRGN hrgn = CreateRectRgn(0,0,0,0); - SetWindowRgn(m_hWnd,hrgn,true); -} - -/* - * CHatchWin::HwndAssociateSet - * CHatchWin::HwndAssociateGet - * - * Purpose: - * Sets (Set) or retrieves (Get) the associate window of the - * hatch window. - * - * Parameters: (Set only) - * hWndAssoc HWND to set as the associate. - * - * Return Value: - * HWND Previous (Set) or current (Get) associate - * window. - */ - -HWND CHatchWin::HwndAssociateSet(HWND hWndAssoc) -{ - HWND hWndT=m_hWndAssociate; - - m_hWndAssociate=hWndAssoc; - return hWndT; -} - - -HWND CHatchWin::HwndAssociateGet(void) -{ - return m_hWndAssociate; -} - - -/* - * CHatchWin::RectsSet - * - * Purpose: - * Changes the size and position of the hatch window and the child - * window within it using a position rectangle for the child and - * a clipping rectangle for the hatch window and child. The hatch - * window occupies prcPos expanded by the hatch border and clipped - * by prcClip. The child window is fit to prcPos to give the - * proper scaling, but it clipped to the hatch window which - * therefore clips it to prcClip without affecting the scaling. - * - * Parameters: - * prcPos LPRECT providing the position rectangle. - * prcClip LPRECT providing the clipping rectangle. - * - * Return Value: - * None - */ - -void CHatchWin::RectsSet(LPRECT prcPos, LPRECT prcClip) -{ - RECT rc; - RECT rcPos; - - m_rcPos=*prcPos; - m_rcClip=*prcClip; - - //Calculate the rectangle for the hatch window, then clip it. - rcPos=*prcPos; - InflateRect(&rcPos, m_dBorder, m_dBorder); - IntersectRect(&rc, &rcPos, prcClip); - - SetWindowPos(m_hWnd, NULL, rc.left, rc.top, rc.right-rc.left - , rc.bottom-rc.top, SWP_NOZORDER | SWP_NOACTIVATE); - - /* - * Set the rectangle of the child window to be at m_dBorder - * from the top and left but with the same size as prcPos - * contains. The hatch window will clip it. - */ -// SetWindowPos(m_hWndKid, NULL, rcPos.left-rc.left+m_dBorder -// , rcPos.top-rc.top+m_dBorder, prcPos->right-prcPos->left -// , prcPos->bottom-prcPos->top, SWP_NOZORDER | SWP_NOACTIVATE); - - RECT newRC; - GetClientRect(m_hWnd,&newRC); - m_aTracker = Tracker( - &newRC, - Tracker::hatchInside | - Tracker::hatchedBorder | - Tracker::resizeInside - ); - - return; -} - - - -/* - * CHatchWin::ChildSet - * - * Purpose: - * Assigns a child window to this hatch window. - * - * Parameters: - * hWndKid HWND of the child window. - * - * Return Value: - * None - */ - -void CHatchWin::ChildSet(HWND hWndKid) -{ - m_hWndKid=hWndKid; - - if (NULL!=hWndKid) - { - SetParent(hWndKid, m_hWnd); - - //Insure this is visible when the hatch window becomes visible. - ShowWindow(hWndKid, SW_SHOW); - } - - return; -} - - - -/* - * CHatchWin::ShowHatch - * - * Purpose: - * Turns hatching on and off; turning the hatching off changes - * the size of the window to be exactly that of the child, leaving - * everything else the same. The result is that we don't have - * to turn off drawing because our own WM_PAINT will never be - * called. - * - * Parameters: - * fHatch BOOL indicating to show (TRUE) or hide (FALSE) - the hatching. - * - * Return Value: - * None - */ - -void CHatchWin::ShowHatch(BOOL fHatch) -{ - /* - * All we have to do is set the border to zero and - * call SetRects again with the last rectangles the - * child sent to us. - */ - m_dBorder=fHatch ? m_dBorderOrg : 0; - RectsSet(&m_rcPos, &m_rcClip); - return; -} - - - -/* - * HatchWndProc - * - * Purpose: - * Standard window procedure for the Hatch Window - */ - -LRESULT APIENTRY winwrap::HatchWndProc( - HWND hWnd, UINT iMsg - , WPARAM wParam, LPARAM lParam) -{ - PCHatchWin phw; - HDC hDC; - PAINTSTRUCT ps; - - phw=(PCHatchWin)GetWindowLong(hWnd, HWWL_STRUCTURE); - POINT ptMouse; - - switch (iMsg) - { - case WM_CREATE: - phw=(PCHatchWin)((LPCREATESTRUCT)lParam)->lpCreateParams; - SetWindowLong(hWnd, HWWL_STRUCTURE, (LONG)phw); - break; - case WM_PAINT: - hDC=BeginPaint(hWnd,&ps); - //Always draw the hatching. - phw->m_aTracker.Draw(hDC); - EndPaint(hWnd,&ps); - break; - case WM_LBUTTONDOWN: - GetCursorPos(&ptMouse); - ScreenToClient(hWnd,&ptMouse); - - // track in case we have to - if(phw->m_aTracker.Track(hWnd,ptMouse,FALSE,GetParent(hWnd))) - { - RECT aRect = phw->m_aTracker.m_rect; - TransformRect(&aRect,hWnd,GetParent(hWnd)); - phw->m_pDocHolder->OnPosRectChanged(&aRect); - } - break; - case WM_LBUTTONUP: - case WM_MOUSEMOVE: - GetCursorPos(&ptMouse); - ScreenToClient(hWnd,&ptMouse); - phw->m_aTracker.SetCursor(hWnd,HTCLIENT); - break; - case WM_SETFOCUS: - //We need this since the container will SetFocus to us. - if (NULL!=phw->m_hWndKid) - SetFocus(phw->m_hWndKid); - - break; - case WM_LBUTTONDBLCLK: - /* - * If the double click was within m_dBorder of an - * edge, send the HWN_BORDERDOUBLECLICKED notification. - * - * Because we're always sized just larger than our child - * window by the border width, we can only *get* this - * message when the mouse is on the border. So we can - * just send the notification. - */ - if (NULL!=phw->m_hWndAssociate) - { - SendCommand(phw->m_hWndAssociate, phw->m_uID - , HWN_BORDERDOUBLECLICKED, hWnd); - } - - break; - default: - return DefWindowProc(hWnd, iMsg, wParam, lParam); - } - - return 0L; -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/tracker.cxx b/embedserv/source/embed/tracker.cxx deleted file mode 100644 index 4d7e7408a..000000000 --- a/embedserv/source/embed/tracker.cxx +++ /dev/null @@ -1,841 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "stdafx.h" -#include -#include "syswinwrapper.hxx" - - -HCURSOR _afxCursors[10] = { 0, }; -HBRUSH _afxHalftoneBrush = 0; - - -// the struct below is used to determine the qualities of a particular handle -struct AFX_HANDLEINFO -{ - size_t nOffsetX; // offset within RECT for X coordinate - size_t nOffsetY; // offset within RECT for Y coordinate - int nCenterX; // adjust X by Width()/2 * this number - int nCenterY; // adjust Y by Height()/2 * this number - int nHandleX; // adjust X by handle size * this number - int nHandleY; // adjust Y by handle size * this number - int nInvertX; // handle converts to this when X inverted - int nInvertY; // handle converts to this when Y inverted -}; - -// this array describes all 8 handles (clock-wise) -const AFX_HANDLEINFO _afxHandleInfo[] = -{ - // corner handles (top-left, top-right, bottom-right, bottom-left - { offsetof(RECT, left), offsetof(RECT, top), 0, 0, 0, 0, 1, 3 }, - { offsetof(RECT, right), offsetof(RECT, top), 0, 0, -1, 0, 0, 2 }, - { offsetof(RECT, right), offsetof(RECT, bottom), 0, 0, -1, -1, 3, 1 }, - { offsetof(RECT, left), offsetof(RECT, bottom), 0, 0, 0, -1, 2, 0 }, - - // side handles (top, right, bottom, left) - { offsetof(RECT, left), offsetof(RECT, top), 1, 0, 0, 0, 4, 6 }, - { offsetof(RECT, right), offsetof(RECT, top), 0, 1, -1, 0, 7, 5 }, - { offsetof(RECT, left), offsetof(RECT, bottom), 1, 0, 0, -1, 6, 4 }, - { offsetof(RECT, left), offsetof(RECT, top), 0, 1, 0, 0, 5, 7 } -}; - -// the struct below gives us information on the layout of a RECT struct and -// the relationship between its members -struct AFX_RECTINFO -{ - size_t nOffsetAcross; // offset of opposite point (ie. left->right) - int nSignAcross; // sign relative to that point (ie. add/subtract) -}; - -// this array is indexed by the offset of the RECT member / sizeof(int) -const AFX_RECTINFO _afxRectInfo[] = -{ - { offsetof(RECT, right), +1 }, - { offsetof(RECT, bottom), +1 }, - { offsetof(RECT, left), -1 }, - { offsetof(RECT, top), -1 }, -}; - - -HBRUSH HalftoneBrush() -{ - if (_afxHalftoneBrush == NULL) - { - WORD grayPattern[8]; - for (int i = 0; i < 8; i++) - grayPattern[i] = (WORD)(0x5555 << (i & 1)); - HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); - if (grayBitmap != NULL) - { - _afxHalftoneBrush = CreatePatternBrush(grayBitmap); - DeleteObject(grayBitmap); - } - } - return _afxHalftoneBrush; -} - - - -void DrawDragRect( - HDC hDC,LPRECT lpRect,SIZE size, - LPRECT lpRectLast,SIZE sizeLast, - HBRUSH hBrush = NULL,HBRUSH hBrushLast = NULL) -{ - // first, determine the update region and select it - HRGN rgnNew; - HRGN rgnOutside,rgnInside; - rgnOutside = CreateRectRgnIndirect(lpRect); - RECT rect = *lpRect; - InflateRect(&rect,-size.cx, -size.cy); - IntersectRect(&rect,&rect,lpRect); - rgnInside = CreateRectRgnIndirect(&rect); - rgnNew = CreateRectRgn(0, 0, 0, 0); - CombineRgn(rgnNew,rgnOutside,rgnInside,RGN_XOR); - - HBRUSH hBrushOld = NULL; - if (hBrush == NULL) - hBrush = HalftoneBrush(); - if (hBrushLast == NULL) - hBrushLast = hBrush; - - HRGN rgnLast(NULL); - HRGN rgnUpdate(NULL); - if (lpRectLast != NULL) - { - // find difference between new region and old region - rgnLast = CreateRectRgn(0, 0, 0, 0); - SetRectRgn( - rgnOutside, - lpRectLast->left, - lpRectLast->top, - lpRectLast->right, - lpRectLast->bottom); - rect = *lpRectLast; - InflateRect(&rect,-sizeLast.cx, -sizeLast.cy); - IntersectRect(&rect,&rect, lpRectLast); - SetRectRgn(rgnInside,rect.left,rect.top,rect.right,rect.bottom); - CombineRgn(rgnLast,rgnOutside,rgnInside, RGN_XOR); - -// // only diff them if brushes are the same - if (hBrush == hBrushLast) - { - rgnUpdate = CreateRectRgn(0, 0, 0, 0); - CombineRgn(rgnUpdate,rgnLast,rgnNew, RGN_XOR); - } - } - if (hBrush != hBrushLast && lpRectLast != NULL) - { - // brushes are different -- erase old region first - SelectClipRgn(hDC,rgnLast); - GetClipBox(hDC,&rect); - hBrushOld = (HBRUSH)SelectObject(hDC,(HGDIOBJ)hBrushLast); - PatBlt(hDC,rect.left,rect.top,(rect.right-rect.left),(rect.bottom-rect.top),PATINVERT); - - SelectObject(hDC,(HGDIOBJ)hBrushOld); - hBrushOld = NULL; - } - - // draw into the update/new region - SelectClipRgn(hDC,rgnUpdate); - - GetClipBox(hDC,&rect); - hBrushOld = (HBRUSH) SelectObject(hDC,(HGDIOBJ) hBrush); - PatBlt(hDC,rect.left, rect.top,(rect.right-rect.left),(rect.bottom-rect.top), PATINVERT); - - // cleanup DC - if (hBrushOld != NULL) - SelectObject(hDC,(HGDIOBJ)hBrushOld); - SelectClipRgn(hDC,NULL); -} - - -void winwrap::TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo) -{ - POINT pt; - pt.x = rect->left;pt.y = rect->top; - ClientToScreen(pWnd,&pt); - ScreenToClient(pWndClipTo,&pt); - rect->left = pt.x; rect->top = pt.y; - - pt.x = rect->right;pt.y = rect->bottom; - ClientToScreen(pWnd,&pt); - ScreenToClient(pWndClipTo,&pt); - rect->right = pt.x; rect->bottom = pt.y; -} - - -void NormalizeRect(LPRECT rp) -{ - if(rp->left > rp->right) { - UINT tmp = rp->left; - rp->left = rp->right; - rp->right = tmp; - } - - if(rp->top > rp->bottom) { - UINT tmp = rp->top; - rp->top = rp->bottom; - rp->bottom = tmp; - } -} - - -using namespace winwrap; - - -Tracker::Tracker() -{ -} - - -Tracker::Tracker(LPCRECT lpSrcRect, UINT nStyle) -{ - Construct(); - CopyRect(&m_rect,lpSrcRect); - m_nStyle = nStyle; -} - -HBRUSH _afxHatchBrush = 0; -HPEN _afxBlackDottedPen = 0; -int _afxHandleSize = 0; - - -void Tracker::Construct() -{ - static BOOL bInitialized = false; - if (!bInitialized) - { - if (_afxHatchBrush == NULL) - { - // create the hatch pattern + bitmap - WORD hatchPattern[8]; - WORD wPattern = 0x1111; - for (int i = 0; i < 4; i++) - { - hatchPattern[i] = wPattern; - hatchPattern[i+4] = wPattern; - wPattern <<= 1; - } - HBITMAP hatchBitmap = CreateBitmap(8, 8, 1, 1,&hatchPattern); - - // create black hatched brush - _afxHatchBrush = CreatePatternBrush(hatchBitmap); - DeleteObject(hatchBitmap); - } - - if (_afxBlackDottedPen == NULL) - { - // create black dotted pen - _afxBlackDottedPen = CreatePen(PS_DOT, 0, RGB(0, 0, 0)); - } - - // get default handle size from Windows profile setting - static const TCHAR szWindows[] = TEXT("windows"); - static const TCHAR szInplaceBorderWidth[] = - TEXT("oleinplaceborderwidth"); - _afxHandleSize = GetProfileInt(szWindows, szInplaceBorderWidth, 4); - bInitialized = TRUE; - - _afxCursors[0] = _afxCursors[2] = LoadCursor(0,IDC_SIZENWSE); - _afxCursors[4] = _afxCursors[6] = LoadCursor(0,IDC_SIZENS); - _afxCursors[1] = _afxCursors[3] = LoadCursor(0,IDC_SIZENESW); - _afxCursors[5] = _afxCursors[7] = LoadCursor(0,IDC_SIZEWE); - _afxCursors[8] = LoadCursor(0,IDC_SIZEALL); - } - - m_nStyle = 0; - m_nHandleSize = _afxHandleSize; - m_sizeMin.cy = m_sizeMin.cx = m_nHandleSize*2; - - SetRectEmpty(&m_rectLast); - m_sizeLast.cx = m_sizeLast.cy = 0; - m_bErase = FALSE; - m_bFinalErase = FALSE; -} - -Tracker::~Tracker() -{ -} - - -int Tracker::HitTest(POINT point) const -{ - TrackerHit hitResult = hitNothing; - - RECT rectTrue; - GetTrueRect(&rectTrue); - NormalizeRect(&rectTrue); - if (PtInRect(&rectTrue,point)) - { - if ((m_nStyle & (resizeInside|resizeOutside)) != 0) - hitResult = (TrackerHit)HitTestHandles(point); - else - hitResult = hitMiddle; - } - return hitResult; -} - - -BOOL Tracker::SetCursor(HWND pWnd, UINT nHitTest) const -{ - // trackers should only be in client area - if (nHitTest != HTCLIENT) - return FALSE; - - // convert cursor position to client co-ordinates - POINT point; - GetCursorPos(&point); - ScreenToClient(pWnd,&point); - - // do hittest and normalize hit - int nHandle = HitTestHandles(point); - if (nHandle < 0) - return FALSE; - - // need to normalize the hittest such that we get proper cursors - nHandle = NormalizeHit(nHandle); - - // handle special case of hitting area between handles - // (logically the same -- handled as a move -- but different cursor) - if (nHandle == hitMiddle && !PtInRect(&m_rect,point)) - { - // only for trackers with hatchedBorder (ie. in-place resizing) - if (m_nStyle & hatchedBorder) - nHandle = (TrackerHit)9; - } - - ::SetCursor(_afxCursors[nHandle]); - return TRUE; -} - - - -BOOL Tracker::Track(HWND hWnd,POINT point,BOOL bAllowInvert, - HWND hWndClipTo) -{ - // perform hit testing on the handles - int nHandle = HitTestHandles(point); - if (nHandle < 0) - { - // didn't hit a handle, so just return FALSE - return FALSE; - } - - // otherwise, call helper function to do the tracking - m_bAllowInvert = bAllowInvert; - SetCursor(hWnd,nHandle); - return TrackHandle(nHandle, hWnd, point, hWndClipTo); -} - - -BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo) -{ - // don't handle if capture already set - if (GetCapture() != NULL) - return FALSE; - - // save original width & height in pixels - int nWidth = m_rect.right - m_rect.left; - int nHeight = m_rect.bottom - m_rect.top; - - // set capture to the window which received this message - SetCapture(hWnd); - UpdateWindow(hWnd); - if (hWndClipTo != NULL) - UpdateWindow(hWndClipTo); - RECT rectSave = m_rect; - - // find out what x/y coords we are supposed to modify - int *px, *py; - int xDiff, yDiff; - GetModifyPointers(nHandle, &px, &py, &xDiff, &yDiff); - xDiff = point.x - xDiff; - yDiff = point.y - yDiff; - - // get DC for drawing - HDC hDrawDC; - if (hWndClipTo != NULL) - { - // clip to arbitrary window by using adjusted Window DC - hDrawDC = GetDCEx(hWndClipTo,NULL, DCX_CACHE); - } - else - { - // otherwise, just use normal DC - hDrawDC = GetDC(hWnd); - } - - RECT rectOld; - BOOL bMoved = FALSE; - - // get messages until capture lost or cancelled/accepted - for (;;) - { - MSG msg; - GetMessage(&msg, NULL, 0, 0); - - if (GetCapture() != hWnd) - break; - - switch (msg.message) - { - // handle movement/accept messages - case WM_LBUTTONUP: - case WM_MOUSEMOVE: - rectOld = m_rect; - // handle resize cases (and part of move) - if (px != NULL) - *px = (int)(short)LOWORD(msg.lParam) - xDiff; - if (py != NULL) - *py = (int)(short)HIWORD(msg.lParam) - yDiff; - - // handle move case - if (nHandle == hitMiddle) - { - m_rect.right = m_rect.left + nWidth; - m_rect.bottom = m_rect.top + nHeight; - } - // allow caller to adjust the rectangle if necessary - AdjustRect(nHandle,&m_rect); - - // only redraw and callback if the rect actually changed! - m_bFinalErase = (msg.message == WM_LBUTTONUP); - if (!EqualRect(&rectOld,&m_rect) || m_bFinalErase) - { - if (bMoved) - { - m_bErase = TRUE; - DrawTrackerRect(&rectOld,hWndClipTo,hDrawDC,hWnd); - } - OnChangedRect(rectOld); - if (msg.message != WM_LBUTTONUP) - bMoved = TRUE; - } - if (m_bFinalErase) - goto ExitLoop; - - if (!EqualRect(&rectOld,&m_rect)) - { - m_bErase = FALSE; - DrawTrackerRect(&m_rect,hWndClipTo,hDrawDC,hWnd); - } - break; - - // handle cancel messages - case WM_KEYDOWN: - if (msg.wParam != VK_ESCAPE) - break; - case WM_RBUTTONDOWN: - if (bMoved) - { - m_bErase = m_bFinalErase = TRUE; - DrawTrackerRect(&m_rect, hWndClipTo, hDrawDC, hWnd); - } - m_rect = rectSave; - goto ExitLoop; - - // just dispatch rest of the messages - default: - DispatchMessage(&msg); - break; - } - } - - ExitLoop: - if (hWndClipTo != NULL) - ReleaseDC(hWndClipTo,hDrawDC); - else - ReleaseDC(hWnd,hDrawDC); - ReleaseCapture(); - - // restore rect in case bMoved is still FALSE - if (!bMoved) - m_rect = rectSave; - m_bFinalErase = FALSE; - m_bErase = FALSE; - - // return TRUE only if rect has changed - return !EqualRect(&rectSave,&m_rect); -} - - -void Tracker::OnChangedRect(const RECT& /*rectOld*/) -{ -} - - -void Tracker::AdjustRect(int nHandle, LPRECT) -{ - if(nHandle == hitMiddle) - return; - - // convert the handle into locations within m_rect - int *px, *py; - GetModifyPointers(nHandle, &px, &py, NULL, NULL); - - // enforce minimum width - int nNewWidth = m_rect.right - m_rect.left; - int nAbsWidth = m_bAllowInvert ? abs(nNewWidth) : nNewWidth; - if (px != NULL && nAbsWidth < m_sizeMin.cx) - { - nNewWidth = nAbsWidth != 0 ? nNewWidth / nAbsWidth : 1; - const AFX_RECTINFO* pRectInfo = - &_afxRectInfo[(int*)px - (int*)&m_rect]; - *px = *(int*)((BYTE*)&m_rect + pRectInfo->nOffsetAcross) + - nNewWidth * m_sizeMin.cx * -pRectInfo->nSignAcross; - } - - // enforce minimum height - int nNewHeight = m_rect.bottom - m_rect.top; - int nAbsHeight = m_bAllowInvert ? abs(nNewHeight) : nNewHeight; - if (py != NULL && nAbsHeight < m_sizeMin.cy) - { - nNewHeight = nAbsHeight != 0 ? nNewHeight / nAbsHeight : 1; - const AFX_RECTINFO* pRectInfo = - &_afxRectInfo[(int*)py - (int*)&m_rect]; - *py = *(int*)((BYTE*)&m_rect + pRectInfo->nOffsetAcross) + - nNewHeight * m_sizeMin.cy * -pRectInfo->nSignAcross; - } -} - - -void Tracker::DrawTrackerRect( - LPRECT lpRect,HWND pWndClipTo,HDC pDC,HWND pWnd) -{ - // first, normalize the rectangle for drawing - RECT rect = *lpRect; - NormalizeRect(&rect); - - // convert to client coordinates - if (pWndClipTo != NULL) - TransformRect(&rect,pWnd,pWndClipTo); - - SIZE size; - size.cx = 0; size.cy = 0; - if (!m_bFinalErase) - { - // otherwise, size depends on the style - if (m_nStyle & hatchedBorder) - { - size.cx = size.cy = max(1,GetHandleSize(&rect)-1); - InflateRect(&rect,size.cx,size.cy); - } - else - { - size.cx = 1; // CX_BORDER; - size.cy = 1; // CY_BORDER; - } - } - - // and draw it - if (m_bFinalErase || !m_bErase) - DrawDragRect(pDC,&rect,size,&m_rectLast,m_sizeLast); - - // remember last rectangles - m_rectLast = rect; - m_sizeLast = size; -} - - -void Tracker::Draw(HDC hDC) const -{ - // set initial DC state - SetMapMode(hDC,MM_TEXT); - SetViewportOrgEx(hDC,0, 0,NULL); - SetWindowOrgEx(hDC,0, 0,NULL); - - // get normalized rectangle - RECT rect = m_rect; - NormalizeRect(&rect); - - HPEN pOldPen = NULL; - HBRUSH pOldBrush = NULL; - HGDIOBJ pTemp; - int nOldROP; - - // draw lines - if ((m_nStyle & (dottedLine|solidLine)) != 0) - { - if (m_nStyle & dottedLine) - pOldPen = (HPEN)SelectObject(hDC,_afxBlackDottedPen); - else - pOldPen = (HPEN)SelectObject(hDC,(HGDIOBJ)BLACK_PEN); - pOldBrush = (HBRUSH)SelectObject(hDC,(HGDIOBJ)NULL_BRUSH); - nOldROP = SetROP2(hDC,R2_COPYPEN); - InflateRect(&rect,+1, +1); // borders are one pixel outside - Rectangle(hDC,rect.left, rect.top, rect.right, rect.bottom); - SetROP2(hDC,nOldROP); - } - - // if hatchBrush is going to be used, need to unrealize it - if ((m_nStyle & (hatchInside|hatchedBorder)) != 0) - UnrealizeObject((HGDIOBJ)_afxHatchBrush); - - // hatch inside - if ((m_nStyle & hatchInside) != 0) - { - pTemp = SelectObject(hDC,(HGDIOBJ)NULL_PEN); - if (pOldPen == NULL) - pOldPen = (HPEN)pTemp; - pTemp = SelectObject(hDC,(HGDIOBJ)_afxHatchBrush); - if (pOldBrush == NULL) - pOldBrush = (HBRUSH)pTemp; - SetBkMode(hDC,TRANSPARENT); - nOldROP = SetROP2(hDC,R2_MASKNOTPEN); - Rectangle(hDC,rect.left+1, rect.top+1, rect.right, rect.bottom); - SetROP2(hDC,nOldROP); - } - - // draw hatched border - if ((m_nStyle & hatchedBorder) != 0) - { - pTemp = SelectObject(hDC,(HGDIOBJ)_afxHatchBrush); - if (pOldBrush == NULL) - pOldBrush = (HBRUSH)pTemp; - SetBkMode(hDC,OPAQUE); - RECT rectTrue; - GetTrueRect(&rectTrue); - PatBlt(hDC,rectTrue.left, rectTrue.top, rectTrue.right-rectTrue.left, - rect.top-rectTrue.top, 0x000F0001 /* Pn */); - PatBlt(hDC,rectTrue.left, rect.bottom, - rectTrue.right-rectTrue.left, - rectTrue.bottom-rect.bottom, 0x000F0001 /* Pn */); - PatBlt(hDC,rectTrue.left, rect.top, rect.left-rectTrue.left, - rect.bottom-rect.top, 0x000F0001 /* Pn */); - PatBlt(hDC,rect.right, rect.top, rectTrue.right-rect.right, - rect.bottom-rect.top, 0x000F0001 /* Pn */); - } - - // draw resize handles - if ((m_nStyle & (resizeInside|resizeOutside)) != 0) - { - UINT mask = GetHandleMask(); - HBRUSH hbrush = CreateSolidBrush(RGB(0,0,0)); - for (int i = 0; i < 8; ++i) - { - if (mask & (1<nOffsetX); - rect.top = *(int*)((BYTE*)&rectT + pHandleInfo->nOffsetY); - rect.left += size * pHandleInfo->nHandleX; - rect.top += size * pHandleInfo->nHandleY; - rect.left += pHandleInfo->nCenterX * (nWidth - size) / 2; - rect.top += pHandleInfo->nCenterY * (nHeight - size) / 2; - rect.right = rect.left + size; - rect.bottom = rect.top + size; - - *pHandleRect = rect; -} - - -int Tracker::GetHandleSize(LPRECT lpRect) const -{ - if (lpRect == NULL) - lpRect = (LPRECT)&m_rect; - - int size = m_nHandleSize; - if (!(m_nStyle & resizeOutside)) - { - // make sure size is small enough for the size of the rect - int sizeMax = min(abs(lpRect->right - lpRect->left), - abs(lpRect->bottom - lpRect->top)); - if (size * 2 > sizeMax) - size = sizeMax / 2; - } - return size; -} - - -UINT Tracker::GetHandleMask() const -{ - UINT mask = 0x0F; // always have 4 corner handles - int size = m_nHandleSize*3; - if (abs(m_rect.right - m_rect.left) - size > 4) - mask |= 0x50; - if (abs(m_rect.bottom - m_rect.top) - size > 4) - mask |= 0xA0; - return mask; -} - - -void Tracker::GetTrueRect(LPRECT lpTrueRect) const -{ - RECT rect = m_rect; - NormalizeRect(&rect); - int nInflateBy = 0; - if ((m_nStyle & (resizeOutside|hatchedBorder)) != 0) - nInflateBy += GetHandleSize() - 1; - if ((m_nStyle & (solidLine|dottedLine)) != 0) - ++nInflateBy; - InflateRect(&rect,nInflateBy, nInflateBy); - *lpTrueRect = rect; -} - - -int Tracker::NormalizeHit(int nHandle) const -{ - if (nHandle == hitMiddle || nHandle == hitNothing) - return nHandle; - const AFX_HANDLEINFO* pHandleInfo = &_afxHandleInfo[nHandle]; - if (m_rect.right - m_rect.left < 0) - { - nHandle = (TrackerHit)pHandleInfo->nInvertX; - pHandleInfo = &_afxHandleInfo[nHandle]; - } - if (m_rect.bottom - m_rect.top < 0) - nHandle = (TrackerHit)pHandleInfo->nInvertY; - return nHandle; -} - - -int Tracker::HitTestHandles(POINT point) const -{ - RECT rect; - UINT mask = GetHandleMask(); - - // see if hit anywhere inside the tracker - GetTrueRect(&rect); - if (!PtInRect(&rect,point)) - return hitNothing; // totally missed - - // see if we hit a handle - for (int i = 0; i < 8; ++i) - { - if (mask & (1<nInvertX != nHandle) - { - *ppx = (int*)((BYTE*)&m_rect + pHandleInfo->nOffsetX); - if (px != NULL) - *px = **ppx; - } - else - { - // middle handle on X axis - if (px != NULL) - *px = m_rect.left + (m_rect.left-m_rect.right) / 2; - } - if (pHandleInfo->nInvertY != nHandle) - { - *ppy = (int*)((BYTE*)&m_rect + pHandleInfo->nOffsetY); - if (py != NULL) - *py = **ppy; - } - else - { - // middle handle on Y axis - if (py != NULL) - *py = m_rect.top + (m_rect.top-m_rect.bottom) / 2; - } -} - -// Fix strange warnings about some -// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. -// warning C4505: 'xxx' : unreferenced local function has been removed -#if defined(_MSC_VER) -#pragma warning(disable: 4505) -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/embed/xwin.cxx b/embedserv/source/embed/xwin.cxx deleted file mode 100644 index 38840a7d7..000000000 --- a/embedserv/source/embed/xwin.cxx +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "xwin.hxx" -#include - - -using namespace ::com::sun::star; - - -ContainerWindowWrapper::ContainerWindowWrapper(HWND aHwnd) - : m_aHwnd(aHwnd), - m_pDisposeEventListeners(0) -{ -} - -ContainerWindowWrapper::~ContainerWindowWrapper() -{ - delete m_pDisposeEventListeners; -} - - -void SAL_CALL -ContainerWindowWrapper::dispose( -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); - - { - osl::MutexGuard aGuard(m_aMutex); - pDisposeEventListeners = m_pDisposeEventListeners; - } - - if(pDisposeEventListeners) { - lang::EventObject aEvt; - aEvt.Source = static_cast< awt::XWindow* >(this); - - pDisposeEventListeners->disposeAndClear(aEvt); - } -} - - -void SAL_CALL -ContainerWindowWrapper::addEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XEventListener >& Listener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); - { - osl::MutexGuard aGuard(m_aMutex); - pDisposeEventListeners = m_pDisposeEventListeners; - } - - if(! pDisposeEventListeners) - { - osl::MutexGuard aGuard(m_aMutex); - pDisposeEventListeners = m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper(m_aMutex); - } - - pDisposeEventListeners->addInterface( Listener ); -} - - -void SAL_CALL -ContainerWindowWrapper::removeEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XEventListener >& Listener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - cppu::OInterfaceContainerHelper *pDisposeEventListeners(0); - { - osl::MutexGuard aGuard(m_aMutex); - pDisposeEventListeners = m_pDisposeEventListeners; - } - if( pDisposeEventListeners ) - pDisposeEventListeners->removeInterface( Listener ); -} - - - -// XSystemDependentWindowPeer - -::com::sun::star::uno::Any SAL_CALL -ContainerWindowWrapper::getWindowHandle( - const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, - sal_Int16 SystemType -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - if(SystemType == lang::SystemDependent::SYSTEM_WIN32 || - SystemType == lang::SystemDependent::SYSTEM_WIN16) - { - uno::Any aAny; - sal_Int32 nHwnd = sal_Int32(m_aHwnd); - aAny <<= nHwnd; - return aAny; - } - else - return uno::Any(); -} - - - -void SAL_CALL -ContainerWindowWrapper::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 -ContainerWindowWrapper::getPosSize( -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - return awt::Rectangle(); -} - - -void SAL_CALL -ContainerWindowWrapper::setVisible( - sal_Bool Visible -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::setEnable( - sal_Bool Enable -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::setFocus( -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::addWindowListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindowListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::removeWindowListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindowListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::addFocusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XFocusListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::removeFocusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XFocusListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::addKeyListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XKeyListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::removeKeyListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XKeyListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::addMouseListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::removeMouseListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - - -void SAL_CALL -ContainerWindowWrapper::addMouseMotionListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseMotionListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::removeMouseMotionListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseMotionListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::addPaintListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XPaintListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -void SAL_CALL -ContainerWindowWrapper::removePaintListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XPaintListener >& xListener -) - throw ( - ::com::sun::star::uno::RuntimeException - ) -{ - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/common.h b/embedserv/source/inc/common.h deleted file mode 100644 index e0d43c146..000000000 --- a/embedserv/source/inc/common.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _COMMON_H_ -#define _COMMON_H_ - -#include "stdafx.h" -#include - -#include -#include -#include - -#include "embservconst.h" - -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } - namespace frame { - class XModel; - } - namespace beans { - struct PropertyValue; - } - namespace io { - class XInputStream; - class XOutputStream; - } -} } } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/docholder.hxx b/embedserv/source/inc/docholder.hxx deleted file mode 100644 index 3e51c7b6c..000000000 --- a/embedserv/source/inc/docholder.hxx +++ /dev/null @@ -1,292 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DOCHOLDER_HXX_ -#define _DOCHOLDER_HXX_ - -#include "common.h" -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "embeddocaccess.hxx" - -class EmbedDocument_Impl; -class Interceptor; -class CIIAObj; - -namespace winwrap { - class CHatchWin; -} - - -class DocumentHolder : - public ::cppu::WeakImplHelper4< - ::com::sun::star::util::XCloseListener, - ::com::sun::star::frame::XTerminateListener, - ::com::sun::star::util::XModifyListener, - ::com::sun::star::ui::XDockingAreaAcceptor> -{ -private: - ::osl::Mutex m_aMutex; - - BOOL m_bAllowInPlace; - LPOLEINPLACESITE m_pIOleIPSite; - LPOLEINPLACEFRAME m_pIOleIPFrame; - LPOLEINPLACEUIWINDOW m_pIOleIPUIWindow; - winwrap::CHatchWin* m_pCHatchWin; - - ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess; - - ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xInterceptorLocker; - Interceptor* m_pInterceptor; - - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - - RECT m_aBorder; - - // contains top level system window data - bool m_bOnDeactivate; - HWND m_hWndxWinParent; - HWND m_hWndxWinCont; - HMENU m_nMenuHandle; - HMENU m_nMenuShared; - HOLEMENU m_nOLEMenu; - com::sun::star::uno::Reference< - com::sun::star::awt::XWindow> m_xEditWindow; - - com::sun::star::uno::Reference< - com::sun::star::awt::XWindow> m_xContainerWindow; - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > m_xDocument; - sal_Int16 m_nMacroExecMode; - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XLayoutManager> m_xLayoutManager; - - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XFrame > m_xFrame; - - ::rtl::OUString m_aContainerName,m_aDocumentNamePart,m_aFilterName; - - CComPtr< IDispatch > m_pIDispatch; - - sal_Bool m_bLink; - - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XFrame > DocumentFrame(); - - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > - CreateNewInterceptor(); - - void ClearInterceptorInternally(); - - void LoadDocInFrame( sal_Bool bPluginMode ); -public: - - - // the instance to which we belong - static HINSTANCE m_hInstance; - - HWND GetEditWindowParentHandle() const - { - return m_hWndxWinParent; - } - - void SetContainerWindowHandle(HWND hWndxWinCont) - { - m_hWndxWinCont = hWndxWinCont; - } - - DocumentHolder( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& xFactory, - const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess ); - - ~DocumentHolder(); - - // Methods for inplace activation - - - BOOL isActive() const; - void DisableInplaceActivation(BOOL); - HRESULT InPlaceActivate(LPOLECLIENTSITE,BOOL); - void InPlaceDeactivate(void); - HRESULT UIActivate(); - void UIDeactivate(); - BOOL InPlaceMenuCreate(void); - BOOL InPlaceMenuDestroy(void); - - void OpenIntoWindow(void); - BOOL Undo(void); - - // further methods - - void SetDocument( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel >& xDoc, - sal_Bool bLink = sal_False - ); - - sal_Bool ExecuteSuspendCloseFrame(); - - void DisconnectFrameDocument( sal_Bool bComplete = sal_False ); - void CloseDocument(); - void CloseFrame(); - void ClearInterceptor(); - void FreeOffice(); - - void resizeWin( const SIZEL& rNewSize ); - - void setTitle(const rtl::OUString& aDocumentName); - rtl::OUString getTitle() const { return m_aDocumentNamePart; } - - void setContainerName(const rtl::OUString& aContainerName); - rtl::OUString getContainerName() const { return m_aContainerName; } - void OnPosRectChanged(LPRECT lpRect) const; - void show(); - - sal_Bool HasFrame() { return m_xFrame.is(); } - sal_Bool IsLink() { return m_bLink; } - - /** hides the document window, even in case of an external container - * side managed window. - */ - - void hide(); - - IDispatch* GetIDispatch(); - - HRESULT GetDocumentBorder( RECT *pRect ); - // HRESULT SetVisArea( const RECTL *pRect ); - // HRESULT GetVisArea( RECTL *pRect ); - HRESULT SetExtent( const SIZEL *pSize ); - HRESULT GetExtent( SIZEL *pSize ); - // sets extension on the hatchwindow - HRESULT SetContRects(LPCRECT pRect); - HRESULT SetObjectRects(LPCRECT aRect, LPCRECT aClip); - - HWND GetTopMostWinHandle() const - { - return m_hWndxWinParent; - } - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > - GetDocument() const - { - return m_xDocument; - } - - // XEventListener - virtual void SAL_CALL - disposing( const com::sun::star::lang::EventObject& aSource ) - throw( ::com::sun::star::uno::RuntimeException ); - - // XCloseListener - virtual void SAL_CALL - queryClosing( - const com::sun::star::lang::EventObject& aSource, - sal_Bool bGetsOwnership - ) - throw( - ::com::sun::star::util::CloseVetoException - ); - - virtual void SAL_CALL - notifyClosing( - const com::sun::star::lang::EventObject& aSource - ) - throw( ::com::sun::star::uno::RuntimeException ); - - // XTerminateListener - virtual void SAL_CALL - queryTermination( - const com::sun::star::lang::EventObject& aSource - ) - throw( - ::com::sun::star::frame::TerminationVetoException - ); - - virtual void SAL_CALL - notifyTermination( - const com::sun::star::lang::EventObject& aSource - ) - 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 - ); - - // XDockingAreaAcceptor - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindow> SAL_CALL - getContainerWindow( - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual sal_Bool SAL_CALL - requestDockingAreaSpace( - const ::com::sun::star::awt::Rectangle& RequestedSpace - ) - throw( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setDockingAreaSpace( - const ::com::sun::star::awt::Rectangle& BorderSpace - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/embeddoc.hxx b/embedserv/source/inc/embeddoc.hxx deleted file mode 100644 index 61f2aedba..000000000 --- a/embedserv/source/inc/embeddoc.hxx +++ /dev/null @@ -1,211 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EMBEDDOC_HXX_ -#define _EMBEDDOC_HXX_ -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "common.h" -#include -#include - -#include -#include -#include - -#include "embeddocaccess.hxx" -#include "docholder.hxx" - -typedef ::boost::unordered_map< DWORD, IAdviseSink* > AdviseSinkHashMap; -typedef ::boost::unordered_map< DWORD, IAdviseSink* >::iterator AdviseSinkHashMapIterator; - -class GDIMetaFile; -class CIIAObj; - -class EmbedDocument_Impl - : public IPersistStorage, - public IDataObject, - public IOleObject, - public IOleInPlaceObject, - public IPersistFile, - public IDispatch, - public IExternalConnection -{ -protected: - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - fillArgsForLoading_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStream, - DWORD nStreamMode, - LPCOLESTR pFilePath = NULL ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - fillArgsForStoring_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream ); - - HRESULT SaveTo_Impl( IStorage* pStg ); - - sal_uInt64 getMetaFileHandle_Impl( sal_Bool isEnhMeta ); - -public: - EmbedDocument_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& smgr, - const GUID* guid ); - virtual ~EmbedDocument_Impl(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IPersistMethod */ - STDMETHOD(GetClassID)(CLSID *pClassID); - - /* IPersistStorage methods */ - STDMETHOD(IsDirty) (); - STDMETHOD(InitNew) ( IStorage *pStg ); - STDMETHOD(Load) ( IStorage* pStr ); - STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ); - STDMETHOD(SaveCompleted) ( IStorage *pStgNew ); - STDMETHOD(HandsOffStorage) (void); - - /* IDataObject methods */ - STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); - STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); - STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ); - STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ); - STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ); - STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ); - STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ); - STDMETHOD(DUnadvise) ( DWORD dwConnection ); - STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ); - - /* IOleObject methods */ - STDMETHOD(SetClientSite) ( IOleClientSite* pSite ); - STDMETHOD(GetClientSite) ( IOleClientSite** pSite ); - STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ); - STDMETHOD(Close) ( DWORD dwSaveOption); - STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ); - STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ); - STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ); - STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ); - STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ); - STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ); - STDMETHOD(Update) (); - STDMETHOD(IsUpToDate) (); - STDMETHOD(GetUserClassID) ( CLSID *pClsid ); - STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ); - STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); - STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); - STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ); - STDMETHOD(Unadvise) ( DWORD dwConnection ); - STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ); - STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ); - STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ); - - /* IOleInPlaceObject methods */ - STDMETHOD(GetWindow)(HWND *); - STDMETHOD(ContextSensitiveHelp)(BOOL); - STDMETHOD(InPlaceDeactivate)(); - STDMETHOD(UIDeactivate)(); - STDMETHOD(SetObjectRects)(LPCRECT, LPCRECT); - STDMETHOD(ReactivateAndUndo)(); - - /* IPersistFile methods */ - STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ); - STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ); - STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ); - STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ); - - /* IDispatch methods */ - STDMETHOD(GetTypeInfoCount) ( unsigned int FAR* pctinfo ); - STDMETHOD(GetTypeInfo) ( unsigned int iTInfo, LCID lcid, ITypeInfo FAR* FAR* ppTInfo ); - STDMETHOD(GetIDsOfNames) ( REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgDispId ); - STDMETHOD(Invoke) ( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR* pDispParams, VARIANT FAR* pVarResult, EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr ); - - /* IExternalConnection methods */ - virtual DWORD STDMETHODCALLTYPE AddConnection( DWORD extconn, DWORD reserved); - virtual DWORD STDMETHODCALLTYPE ReleaseConnection( DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses); - - // c++ - methods - - void notify( bool bDataChanged = true ); - HRESULT SaveObject(); - HRESULT ShowObject(); - GUID GetGUID() const { return m_guid; } - HRESULT OLENotifyClosing(); - - void Deactivate(); - HRESULT OLENotifyDeactivation(); - -protected: - oslInterlockedCount m_refCount; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - - DocumentHolder* m_pDocHolder; - ::rtl::OUString m_aFileName; - - CComPtr< IStorage > m_pMasterStorage; - CComPtr< IStream > m_pOwnStream; - CComPtr< IStream > m_pExtStream; - GUID m_guid; - - sal_Bool m_bIsDirty; - - CComPtr< IOleClientSite > m_pClientSite; - CComPtr< IDataAdviseHolder > m_pDAdviseHolder; - - AdviseSinkHashMap m_aAdviseHashMap; - DWORD m_nAdviseNum; - - ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOwnAccess; - - sal_Bool m_bIsInVerbHandling; -}; - -class BooleanGuard_Impl -{ - sal_Bool& m_bValue; - -public: - BooleanGuard_Impl( sal_Bool& bValue ) - : m_bValue( bValue ) - { - m_bValue = sal_True; - } - - ~BooleanGuard_Impl() - { - m_bValue = sal_False; - } -}; - -#endif //_EMBEDDOC_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/embeddocaccess.hxx b/embedserv/source/inc/embeddocaccess.hxx deleted file mode 100644 index 321bb3e7a..000000000 --- a/embedserv/source/inc/embeddocaccess.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EMBEDDOCACCESS_HXX_ -#define _EMBEDDOCACCESS_HXX_ - -#define OLESERV_SAVEOBJECT 1 -#define OLESERV_CLOSE 2 -#define OLESERV_NOTIFY 3 -#define OLESERV_NOTIFYCLOSING 4 -#define OLESERV_SHOWOBJECT 5 -#define OLESERV_DEACTIVATE 6 - -#include -#ifndef __MINGW32__ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4265) -#include -#else -#include -#endif -#endif -#include - -class EmbedDocument_Impl; -struct LockedEmbedDocument_Impl -{ -private: - EmbedDocument_Impl* m_pEmbedDocument; - -public: - LockedEmbedDocument_Impl(); - LockedEmbedDocument_Impl( EmbedDocument_Impl* pEmbedDocument ); - LockedEmbedDocument_Impl( const LockedEmbedDocument_Impl& aDocLock ); - - ~LockedEmbedDocument_Impl(); - - LockedEmbedDocument_Impl& operator=( const LockedEmbedDocument_Impl& aDocLock ); - - EmbedDocument_Impl* GetEmbedDocument() { return m_pEmbedDocument; } - - void ExecuteMethod( sal_Int16 nId ); -}; - -class EmbeddedDocumentInstanceAccess_Impl : public ::cppu::OWeakObject -{ - ::osl::Mutex m_aMutex; - EmbedDocument_Impl* m_pEmbedDocument; - - public: - EmbeddedDocumentInstanceAccess_Impl( EmbedDocument_Impl* pDoc ) - : m_pEmbedDocument( pDoc ) - {} - - LockedEmbedDocument_Impl GetEmbedDocument(); - void ClearEmbedDocument(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/embservconst.h b/embedserv/source/inc/embservconst.h deleted file mode 100644 index a952c56be..000000000 --- a/embedserv/source/inc/embservconst.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EMBSERVCONST_H_ -#define _EMBSERVCONST_H_ - -#include - -#ifndef _COMPHELPER_CLASSIDS_HXX -#include -#endif - -#ifndef _SAL_TYPES_H_ -#include -#endif - -const sal_Int32 nConstBufferSize = 32000; - -#define SUPPORTED_FACTORIES_NUM 10 - -#ifdef __MINGW32__ -#define DECLSPEC_SELECTANY -#endif -#if defined(__MINGW32__) && !defined(INITGUID) -EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer; -#else -EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterTextServer = { SO3_SW_OLE_EMBED_CLASSID_60 }; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer = { SO3_SW_OLE_EMBED_CLASSID_8 }; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcServer = { SO3_SC_OLE_EMBED_CLASSID_60 }; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_CalcOASISServer = { SO3_SC_OLE_EMBED_CLASSID_8 }; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingServer = { SO3_SDRAW_OLE_EMBED_CLASSID_60 }; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer = { SO3_SDRAW_OLE_EMBED_CLASSID_8 }; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_60 }; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer = { SO3_SIMPRESS_OLE_EMBED_CLASSID_8 }; - -EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathServer = { SO3_SM_OLE_EMBED_CLASSID_60 }; -EXTERN_C const GUID DECLSPEC_SELECTANY OID_MathOASISServer = { SO3_SM_OLE_EMBED_CLASSID_8 }; -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/iipaobj.hxx b/embedserv/source/inc/iipaobj.hxx deleted file mode 100644 index 54dabed9e..000000000 --- a/embedserv/source/inc/iipaobj.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _IIPAOBJ_HXX_ -#define _IIPAOBJ_HXX_ -#if defined(_MSC_VER) && (_MSC_VER > 1310) -#pragma warning(disable : 4917 4555) -#endif - -#include "stdafx.h" -#include - -#include -#include -class EmbedDocument_Impl; -class DocumentHolder; - -class CIIAObj - : public IOleInPlaceActiveObject -{ - -public: - - CIIAObj( DocumentHolder * ); - virtual ~CIIAObj(); - - /* IUnknown methods */ - STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - - /* IOleInPlaceActiveObject methods */ - STDMETHODIMP GetWindow(HWND *); - STDMETHODIMP ContextSensitiveHelp(BOOL); - STDMETHODIMP TranslateAccelerator(LPMSG); - STDMETHODIMP OnFrameWindowActivate(BOOL); - STDMETHODIMP OnDocWindowActivate(BOOL); - STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW - , BOOL); - STDMETHODIMP EnableModeless(BOOL); - - -private: - - oslInterlockedCount m_refCount; - ::rtl::Reference< DocumentHolder > m_rDocHolder; -}; - - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/intercept.hxx b/embedserv/source/inc/intercept.hxx deleted file mode 100644 index 09e7601bf..000000000 --- a/embedserv/source/inc/intercept.hxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _INTERCEPT_HXX_ -#define _INTERCEPT_HXX_ - -#include -#include -#include -#include -#include -#include - -#include -#include "embeddocaccess.hxx" - - -class StatusChangeListenerContainer; -class EmbedDocument_Impl; -class DocumentHolder; - -class Interceptor - : public ::cppu::WeakImplHelper3< - ::com::sun::star::frame::XDispatchProviderInterceptor, - ::com::sun::star::frame::XInterceptorInfo, - ::com::sun::star::frame::XDispatch> -{ -public: - - Interceptor( - const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess, - DocumentHolder* pDocH, - sal_Bool bLink ); - - ~Interceptor(); - - void DisconnectDocHolder(); - - void generateFeatureStateEvent(); - - // overwritten to release the statuslistner. - - - // XComponent - virtual void SAL_CALL - addEventListener( - const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener ) - throw( com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL - removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener ) - throw( com::sun::star::uno::RuntimeException ); - - void SAL_CALL - dispose() throw(::com::sun::star::uno::RuntimeException); - - - - //XDispatch - virtual void SAL_CALL - dispatch( - const ::com::sun::star::util::URL& URL, - const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& Arguments ) - throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL - addStatusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XStatusListener >& Control, - const ::com::sun::star::util::URL& URL ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeStatusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XStatusListener >& Control, - const ::com::sun::star::util::URL& URL ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - //XInterceptorInfo - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getInterceptedURLs( ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - - //XDispatchProvider ( inherited by XDispatchProviderInterceptor ) - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatch > SAL_CALL - queryDispatch( - const ::com::sun::star::util::URL& URL, - const ::rtl::OUString& TargetFrameName, - sal_Int32 SearchFlags ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatch > > SAL_CALL - queryDispatches( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::frame::DispatchDescriptor >& Requests ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - - //XDispatchProviderInterceptor - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider > SAL_CALL - getSlaveDispatchProvider( ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setSlaveDispatchProvider( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider > SAL_CALL - getMasterDispatchProvider( ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setMasterDispatchProvider( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider >& NewSupplier ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - -private: - - osl::Mutex m_aMutex; - - ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl > m_xOleAccess; - - ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface > m_xDocHLocker; - DocumentHolder* m_pDocH; - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider; - - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider; - - static ::com::sun::star::uno::Sequence< ::rtl::OUString > - m_aInterceptedURL; - - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; - StatusChangeListenerContainer* m_pStatCL; - - sal_Bool m_bLink; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/servprov.hxx b/embedserv/source/inc/servprov.hxx deleted file mode 100644 index 4206148ee..000000000 --- a/embedserv/source/inc/servprov.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SERVPROV_HXX -#define _SERVPROV_HXX - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif - -#include "common.h" -#include -#include -#include -#include -#include -#include - - -class EmbedProviderFactory_Impl; - -class EmbedServer_Impl : public ::cppu::OWeakObject, ::com::sun::star::lang::XTypeProvider -{ -public: - EmbedServer_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xFactory ); - virtual ~EmbedServer_Impl(); - - // 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); - -protected: - - CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ]; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; -}; - -class EmbedProviderFactory_Impl : public IClassFactory -{ -public: - - EmbedProviderFactory_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid); - virtual ~EmbedProviderFactory_Impl(); - - sal_Bool registerClass(); - sal_Bool deregisterClass(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); - STDMETHOD(LockServer)(int fLock); - -protected: - - oslInterlockedCount m_refCount; - GUID m_guid; - DWORD m_factoryHandle; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/stdafx.h b/embedserv/source/inc/stdafx.h deleted file mode 100644 index b6e553e7f..000000000 --- a/embedserv/source/inc/stdafx.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if !defined(AFX_STDAFX_H_) -#define AFX_STDAFX_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0403 -#endif -#define _ATL_APARTMENT_THREADED -// #define _ATL_STATIC_REGISTRY - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(push, 1) -#pragma warning(disable: 4548) -#pragma warning(disable: 4505) -#endif -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#ifdef __MINGW32__ -#include -using ::std::min; -using ::std::max; -#endif -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#ifdef _MSC_VER -#pragma warning(pop) -#pragma warning(pop) -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/syswinwrapper.hxx b/embedserv/source/inc/syswinwrapper.hxx deleted file mode 100644 index 0eff8b5d0..000000000 --- a/embedserv/source/inc/syswinwrapper.hxx +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include - -/** - ** CWindow: Our basic window class. - **/ - - -class DocumentHolder; - - -namespace winwrap { - - - void TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo); - - - LRESULT APIENTRY HatchWndProc( - HWND hWnd, UINT iMsg - , WPARAM wParam, LPARAM lParam); - - - BOOL HatchWindowRegister(HINSTANCE hInst); - - class CWindow - { - protected: - HINSTANCE m_hInst; //Task instance - HWND m_hWnd; //Window handle of the window - - public: - //Standard Class Functions - CWindow(HINSTANCE); - ~CWindow(void); - - //Just returns members. No need to modify - HWND Window(void); - HINSTANCE Instance(void); - }; - - - - class Tracker { - public: - // Constructors - Tracker(); - Tracker(LPCRECT lpSrcRect, UINT nStyle); - - // Style Flags - enum StyleFlags - { - solidLine = 1, dottedLine = 2, hatchedBorder = 4, - resizeInside = 8, resizeOutside = 16, hatchInside = 32, - }; - - // Hit-Test codes - enum TrackerHit - { - hitNothing = -1, - hitTopLeft = 0, hitTopRight = 1, - hitBottomRight = 2, hitBottomLeft = 3, - hitTop = 4, hitRight = 5, hitBottom = 6, - hitLeft = 7, hitMiddle = 8 - }; - - // Attributes - UINT m_nStyle; // current state - RECT m_rect; // current position (always in pixels) - SIZE m_sizeMin; // minimum X and Y size during track operation - int m_nHandleSize; // size of resize handles (default from WIN.INI) - - // Operations - void Draw(HDC hDC) const; - void GetTrueRect(LPRECT lpTrueRect) const; - BOOL SetCursor(HWND hWnd,UINT nHitTest) const; - BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE, - HWND hWndClipTo = NULL); -// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE); - int HitTest(POINT point) const; - int NormalizeHit(int nHandle) const; - - // Overridables - virtual void DrawTrackerRect( - LPRECT lpRect, HWND hWndClipTo, - HDC hDC, HWND hWnd); - virtual void AdjustRect(int nHandle, LPRECT lpRect); - virtual void OnChangedRect(const RECT& rectOld); - virtual UINT GetHandleMask() const; - -// Implementation - public: - virtual ~Tracker(); - -protected: - BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand - RECT m_rectLast; - SIZE m_sizeLast; - BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing - BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase - - // implementation helpers - int HitTestHandles(POINT point) const; - void GetHandleRect(int nHandle,RECT* pHandleRect) const; - void GetModifyPointers( - int nHandle,int**ppx, int**ppy, int* px, int*py); - virtual int GetHandleSize(LPRECT lpRect = NULL) const; - BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo); - void Construct(); - }; - - - -//Width of the border -#define HATCHWIN_BORDERWIDTHDEFAULT 4 - - - class CHatchWin : public CWindow - { - friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM); - - public: - - const DocumentHolder* m_pDocHolder; - Tracker m_aTracker; - - int m_dBorder; - int m_dBorderOrg; - UINT m_uID; - HWND m_hWndParent; - HWND m_hWndKid; - HWND m_hWndAssociate; - RECT m_rcPos; - RECT m_rcClip; - - public: - CHatchWin(HINSTANCE,const DocumentHolder*); - ~CHatchWin(void); - - BOOL Init(HWND, UINT, HWND); - - HWND HwndAssociateSet(HWND); - HWND HwndAssociateGet(void); - - void RectsSet(LPRECT, LPRECT); - void ChildSet(HWND); - void ShowHatch(BOOL); - void SetTrans(); - }; - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inc/xwin.hxx b/embedserv/source/inc/xwin.hxx deleted file mode 100644 index d6abfaa93..000000000 --- a/embedserv/source/inc/xwin.hxx +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XWIN_HXX_ -#define _XWIN_HXX_ - - -#include "common.h" -#include -#include -#include -#include -#include - - -class ContainerWindowWrapper: - public ::cppu::WeakImplHelper2< - ::com::sun::star::awt::XWindow, - ::com::sun::star::awt::XSystemDependentWindowPeer> -{ -public: - - ContainerWindowWrapper(HWND aHwnd); - - ~ ContainerWindowWrapper(); - - - // XComponent - - virtual void SAL_CALL - dispose( - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XEventListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeEventListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XEventListener >& aListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - - // XSystemDependentWindowPeer - - virtual ::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 - ); - - // XWindow - - virtual 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); - - virtual ::com::sun::star::awt::Rectangle SAL_CALL - getPosSize( - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setVisible( - sal_Bool Visible - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setEnable( - sal_Bool Enable - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - setFocus( - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addWindowListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindowListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeWindowListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XWindowListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addFocusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XFocusListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeFocusListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XFocusListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addKeyListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XKeyListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeKeyListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XKeyListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addMouseListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeMouseListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addMouseMotionListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseMotionListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removeMouseMotionListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XMouseMotionListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - addPaintListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XPaintListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - virtual void SAL_CALL - removePaintListener( - const ::com::sun::star::uno::Reference< - ::com::sun::star::awt::XPaintListener >& xListener - ) - throw ( - ::com::sun::star::uno::RuntimeException - ); - - -private: - - osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper *m_pDisposeEventListeners; - - HWND m_aHwnd; -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/advisesink.cxx b/embedserv/source/inprocserv/advisesink.cxx deleted file mode 100644 index 09b24e2c0..000000000 --- a/embedserv/source/inprocserv/advisesink.cxx +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#pragma warning(disable : 4668) - -#include - -namespace inprocserv -{ - -OleWrapperAdviseSink::OleWrapperAdviseSink() -: m_nRefCount( 0 ) -, m_pFormatEtc( NULL ) -, m_nAspect( DVASPECT_CONTENT ) -, m_nRegID( 0 ) -, m_bObjectAdvise( TRUE ) -, m_nDataRegFlag( 0 ) -, m_nViewRegFlag( 0 ) -, m_bHandleClosed( TRUE ) -, m_bClosed( FALSE ) -{ -} - -OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener ) -: m_nRefCount( 0 ) -, m_pListener( pListener ) -, m_pFormatEtc( NULL ) -, m_nAspect( DVASPECT_CONTENT ) -, m_nRegID( 0 ) -, m_bObjectAdvise( TRUE ) -, m_nDataRegFlag( 0 ) -, m_nViewRegFlag( 0 ) -, m_bHandleClosed( FALSE ) -, m_bClosed( FALSE ) -{ -} - -OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag ) -: m_nRefCount( 0 ) -, m_pListener( pListener ) -, m_pFormatEtc( NULL ) -, m_nAspect( DVASPECT_CONTENT ) -, m_nRegID( 0 ) -, m_bObjectAdvise( FALSE ) -, m_nDataRegFlag( nDataRegFlag ) -, m_nViewRegFlag( 0 ) -, m_bHandleClosed( FALSE ) -, m_bClosed( FALSE ) -{ - if ( pFormatEtc ) - { - m_pFormatEtc = new FORMATETC; - m_pFormatEtc->cfFormat = pFormatEtc->cfFormat; - m_pFormatEtc->ptd = NULL; - m_pFormatEtc->dwAspect = pFormatEtc->dwAspect; - m_pFormatEtc->lindex = pFormatEtc->lindex; - m_pFormatEtc->tymed = pFormatEtc->tymed; - } -} - -OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag ) -: m_nRefCount( 0 ) -, m_pListener( pListener ) -, m_pFormatEtc( NULL ) -, m_nAspect( nAspect ) -, m_nRegID( 0 ) -, m_bObjectAdvise( TRUE ) -, m_nDataRegFlag( 0 ) -, m_nViewRegFlag( nViewRegFlag ) -, m_bHandleClosed( FALSE ) -, m_bClosed( FALSE ) -{ -} - -OleWrapperAdviseSink::~OleWrapperAdviseSink() -{ - if ( m_pFormatEtc ) - delete m_pFormatEtc; -} - -STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv ) -{ - *ppv=NULL; - - if ( riid == IID_IUnknown ) - *ppv = (IUnknown*)this; - - if ( riid == IID_IAdviseSink ) - *ppv = (IAdviseSink*)this; - - if ( *ppv != NULL ) - { - ((IUnknown*)*ppv)->AddRef(); - return S_OK; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) OleWrapperAdviseSink::AddRef() -{ - return ++m_nRefCount; -} - -STDMETHODIMP_(ULONG) OleWrapperAdviseSink::Release() -{ - ULONG nReturn = --m_nRefCount; - if ( m_nRefCount == 0 ) - delete this; - - return nReturn; -} - -STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange( LPFORMATETC pFetc, LPSTGMEDIUM pMedium ) -{ - if ( m_pListener ) - { - m_pListener->OnDataChange( pFetc, pMedium ); - } -} - -STDMETHODIMP_(void) OleWrapperAdviseSink::OnViewChange( DWORD dwAspect, LONG lindex ) -{ - if ( m_pListener ) - { - m_pListener->OnViewChange( dwAspect, lindex ); - } -} - -STDMETHODIMP_(void) OleWrapperAdviseSink::OnRename( LPMONIKER pMoniker ) -{ - if ( m_pListener ) - { - m_pListener->OnRename( pMoniker ); - } -} - -STDMETHODIMP_(void) OleWrapperAdviseSink::OnSave(void) -{ - if ( m_pListener ) - { - m_pListener->OnSave(); - } -} - -STDMETHODIMP_(void) OleWrapperAdviseSink::OnClose(void) -{ - if ( m_pListener ) - { - m_pListener->OnClose(); - } - - if ( m_bHandleClosed ) - m_bClosed = TRUE; -} - -} // namespace inprocserv - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/advisesink.hxx b/embedserv/source/inprocserv/advisesink.hxx deleted file mode 100644 index 22246b1ef..000000000 --- a/embedserv/source/inprocserv/advisesink.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "smartpointer.hxx" - -namespace inprocserv { - -class OleWrapperAdviseSink : public IAdviseSink -{ -protected: - ULONG m_nRefCount; - - ComSmart< IAdviseSink > m_pListener; - DWORD m_nListenerID; - - FORMATETC* m_pFormatEtc; - DWORD m_nAspect; - - DWORD m_nRegID; - DWORD m_bObjectAdvise; - DWORD m_nDataRegFlag; - DWORD m_nViewRegFlag; - - BOOL m_bHandleClosed; - BOOL m_bClosed; - -public: - // an AdviseSink for own needs, should be created always - OleWrapperAdviseSink(); - - // an AdviseSink for IOleObject interface - OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener ); - - // an AdviseSink for IDataObject interface - OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag ); - - // an AdviseSink for IViewObject interface - OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag ); - - virtual ~OleWrapperAdviseSink(); - - void SetRegID( DWORD nRegID ) { m_nRegID = nRegID; } - DWORD GetRegID() { return m_nRegID; } - - BOOL IsOleAdvise() { return m_bObjectAdvise; } - DWORD GetDataAdviseFlag() { return m_nDataRegFlag; } - DWORD GetViewAdviseFlag() { return m_nViewRegFlag; } - - FORMATETC* GetFormatEtc() { return m_pFormatEtc; } - DWORD GetAspect() { return m_nAspect; } - ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; } - void DisconnectOrigAdvise() { m_pListener = NULL; } - - void SetClosed() { m_bClosed = TRUE; } - void UnsetClosed() { m_bClosed = FALSE; } - BOOL IsClosed() { return m_bClosed; } - - STDMETHODIMP QueryInterface(REFIID, void**); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - - STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM); - STDMETHODIMP_(void) OnViewChange(DWORD, LONG); - STDMETHODIMP_(void) OnRename(LPMONIKER); - STDMETHODIMP_(void) OnSave(void); - STDMETHODIMP_(void) OnClose(void); -}; - -}; // namespace advisesink - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx deleted file mode 100644 index acb94fd5e..000000000 --- a/embedserv/source/inprocserv/dllentry.cxx +++ /dev/null @@ -1,351 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#ifdef __MINGW32__ -#define INITGUID -#endif -#include - -static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = { - &OID_WriterTextServer, - &OID_WriterOASISTextServer, - &OID_CalcServer, - &OID_CalcOASISServer, - &OID_DrawingServer, - &OID_DrawingOASISServer, - &OID_PresentationServer, - &OID_PresentationOASISServer, - &OID_MathServer, - &OID_MathOASISServer -}; - -static HINSTANCE g_hInstance = NULL; -static ULONG g_nObj = 0; -static ULONG g_nLock = 0; - - -namespace { - void FillCharFromInt( int nValue, char* pBuf, int nLen ) - { - int nInd = 0; - while( nInd < nLen ) - { - char nSign = ( nValue / ( 1 << ( ( nLen - nInd ) * 4 ) ) ) % 16; - if ( nSign >= 0 && nSign <= 9 ) - pBuf[nInd] = nSign + '0'; - else if ( nSign >= 10 && nSign <= 15 ) - pBuf[nInd] = nSign - 10 + 'a'; - - nInd++; - } - } - - int GetStringFromClassID( const GUID& guid, char* pBuf, int nLen ) - { - // is not allowed to insert - if ( nLen < 38 ) - return 0; - - pBuf[0] = '{'; - FillCharFromInt( guid.Data1, &pBuf[1], 8 ); - pBuf[9] = '-'; - FillCharFromInt( guid.Data2, &pBuf[10], 4 ); - pBuf[14] = '-'; - FillCharFromInt( guid.Data3, &pBuf[15], 4 ); - pBuf[19] = '-'; - - int nInd = 0; - for ( nInd = 0; nInd < 2 ; nInd++ ) - FillCharFromInt( guid.Data4[nInd], &pBuf[20 + 2*nInd], 2 ); - pBuf[24] = '-'; - for ( nInd = 2; nInd < 8 ; nInd++ ) - FillCharFromInt( guid.Data4[nInd], &pBuf[20 + 1 + 2*nInd], 2 ); - pBuf[37] = '}'; - - return 38; - } - - HRESULT WriteLibraryToRegistry( char* pLibrary, DWORD nLen ) - { - HRESULT hRes = E_FAIL; - if ( pLibrary && nLen ) - { - HKEY hKey = NULL; - - hRes = S_OK; - for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ ) - { - char* pSubKey = "Software\\Classes\\CLSID\\.....................................\\InprocHandler32"; - - int nGuidLen = GetStringFromClassID( *guidList[nInd], &pSubKey[23], 38 ); - - BOOL bLocalSuccess = FALSE; - if ( nGuidLen && nGuidLen == 38 ) - { - if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) ) - { - if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, (const BYTE*)pLibrary, nLen ) ) - bLocalSuccess = TRUE; - } - - if ( hKey ) - { - RegCloseKey( hKey ); - hKey = NULL; - } - } - - if ( !bLocalSuccess ) - hRes = E_FAIL; - } - } - - return hRes; - } -}; - -// =========================== -// InprocEmbedProvider_Impl declaration -// =========================== - -namespace inprocserv -{ - -class InprocEmbedProvider_Impl : public IClassFactory, public InprocCountedObject_Impl -{ -public: - - InprocEmbedProvider_Impl( const GUID& guid ); - virtual ~InprocEmbedProvider_Impl(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); - STDMETHOD(LockServer)(int fLock); - -protected: - - ULONG m_refCount; - GUID m_guid; -}; -}; // namespace inprocserv - - -// =========================== -// Entry points -// =========================== - -// ------------------------------------------------------------------------------- -extern "C" BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/ ) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - } - else if (dwReason == DLL_PROCESS_DETACH) - { - } - - return TRUE; // ok -} - -// ------------------------------------------------------------------------------- -extern "C" STDAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID* ppv ) -{ - for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ ) - if ( *guidList[nInd] == rclsid ) - { - if ( !IsEqualIID( riid, IID_IUnknown ) && !IsEqualIID( riid, IID_IClassFactory ) ) - return E_NOINTERFACE; - - *ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid ); - if ( *ppv == NULL ) - return E_OUTOFMEMORY; - - ((LPUNKNOWN)*ppv)->AddRef(); - return S_OK; - } - - return E_FAIL; -} - -// ------------------------------------------------------------------------------- -extern "C" STDAPI DllCanUnloadNow() -{ - if ( !g_nObj && !g_nLock ) - return S_OK; - - return S_FALSE; -} - -// ------------------------------------------------------------------------------- -STDAPI DllRegisterServer( void ) -{ - char aLibPath[1024]; - HMODULE aCurModule = GetModuleHandleA( "inprocserv.dll" ); - if( aCurModule ) - { - DWORD nLen = GetModuleFileNameA( aCurModule, aLibPath, 1019 ); - if ( nLen && nLen < 1019 ) - { - aLibPath[nLen++] = 0; - return WriteLibraryToRegistry( aLibPath, nLen ); - } - } - - return E_FAIL; -} - -// ------------------------------------------------------------------------------- -STDAPI DllUnregisterServer( void ) -{ - return WriteLibraryToRegistry( "ole32.dll", 10 ); -} - -// =========================== -// End of entry points -// =========================== - -namespace inprocserv -{ - -// =========================== -// InprocCountedObject_Impl implementation -// =========================== - -// ------------------------------------------------------------------------------- -InprocCountedObject_Impl::InprocCountedObject_Impl() -{ - g_nObj++; -} - -// ------------------------------------------------------------------------------- -InprocCountedObject_Impl::~InprocCountedObject_Impl() -{ - g_nObj--; -} - -// =========================== -// InprocEmbedProvider_Impl implementation -// =========================== - -// ------------------------------------------------------------------------------- -InprocEmbedProvider_Impl::InprocEmbedProvider_Impl( const GUID& guid ) -: m_refCount( 0 ) -, m_guid( guid ) -{ -} - -// ------------------------------------------------------------------------------- -InprocEmbedProvider_Impl::~InprocEmbedProvider_Impl() -{ -} - -// IUnknown -// ------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv ) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IClassFactory)) - { - AddRef(); - *ppv = (IClassFactory*) this; - return S_OK; - } - - *ppv = NULL; - return E_NOINTERFACE; -} - -// ------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedProvider_Impl::AddRef() -{ - return ++m_refCount; -} - -// ------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedProvider_Impl::Release() -{ - sal_Int32 nCount = --m_refCount; - if ( nCount == 0 ) - delete this; - return nCount; -} - -// ------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) -{ - // TODO/LATER: should the aggregation be supported? - // if ( punkOuter != NULL && riid != IID_IUnknown ) - // return E_NOINTERFACE; - if ( punkOuter != NULL ) - return CLASS_E_NOAGGREGATION; - - InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid ); - if ( !pEmbedDocument ) - return E_OUTOFMEMORY; - - pEmbedDocument->AddRef(); - HRESULT hr = pEmbedDocument->Init(); - if ( SUCCEEDED( hr ) ) - hr = pEmbedDocument->QueryInterface( riid, ppv ); - pEmbedDocument->Release(); - - if ( !SUCCEEDED( hr ) ) - *ppv = NULL; - - return hr; -} - -// ------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedProvider_Impl::LockServer( int fLock ) -{ - if ( fLock ) - g_nLock++; - else - g_nLock--; - - return S_OK; -} - -}; // namespace inprocserv - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/exports.dxp b/embedserv/source/inprocserv/exports.dxp deleted file mode 100644 index 65a5126f1..000000000 --- a/embedserv/source/inprocserv/exports.dxp +++ /dev/null @@ -1,5 +0,0 @@ -DllGetClassObject -DllCanUnloadNow -DllMain -DllRegisterServer -DllUnregisterServer diff --git a/embedserv/source/inprocserv/inprocembobj.cxx b/embedserv/source/inprocserv/inprocembobj.cxx deleted file mode 100644 index d984e9994..000000000 --- a/embedserv/source/inprocserv/inprocembobj.cxx +++ /dev/null @@ -1,1816 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include "inprocembobj.h" - -namespace inprocserv -{ - -//------------------------------------------------------------------------------- -BOOL StringsEqual( LPCOLESTR pszNameFromOutside, wchar_t* pOwnName ) -{ - BOOL bResult = TRUE; - - if ( pszNameFromOutside && pOwnName ) - { - for ( int nInd = 0; pszNameFromOutside[nInd] != 0 || pOwnName[nInd] != 0; nInd++ ) - { - if ( pszNameFromOutside[nInd] != pOwnName[nInd] ) - { - bResult = FALSE; - break; - } - } - } - else if ( pszNameFromOutside || pOwnName ) - bResult = FALSE; - - return bResult; -} - -//------------------------------------------------------------------------------- -HRESULT InprocEmbedDocument_Impl::Init() -{ - return S_OK; -} - -//------------------------------------------------------------------------------- -void InprocEmbedDocument_Impl::SetName( LPCOLESTR pszNameFromOutside, wchar_t*& pOwnName ) -{ - if ( !pszNameFromOutside ) - return; - - // copy the string - size_t nLen = 0; - while( pszNameFromOutside[nLen] != 0 ) - nLen++; - - if ( pOwnName ) - { - delete[] pOwnName; - pOwnName = NULL; - } - - pOwnName = new wchar_t[nLen+1]; - for ( size_t nInd = 0; nInd < nLen; nInd++ ) - pOwnName[nInd] = pszNameFromOutside[nInd]; - pOwnName[nLen] = 0; -} - -//------------------------------------------------------------------------------- -BOOL InprocEmbedDocument_Impl::CheckDefHandler() -{ - // set the own listener - if ( m_pOleAdvises[0] == NULL ) - { - m_pOleAdvises[0] = new OleWrapperAdviseSink(); - } - else - { - if ( m_pOleAdvises[0]->IsClosed() ) - { - if ( m_pDefHandler ) - { - // deregister all the listeners - - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - if ( SUCCEEDED( hr ) && pOleObject ) - { - for ( DWORD nInd = 0; nInd < DEFAULT_ARRAY_LEN; nInd++ ) - if ( m_pOleAdvises[nInd] ) - { - DWORD nID = m_pOleAdvises[nInd]->GetRegID(); - pOleObject->Unadvise( nID ); - m_pOleAdvises[nInd]->SetRegID( 0 ); - } - - pOleObject->SetClientSite( NULL ); - } - - ComSmart< IDataObject > pIDataObject; - hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - if ( SUCCEEDED( hr ) && pIDataObject ) - { - for ( DWORD nInd = 0; nInd < DEFAULT_ARRAY_LEN; nInd++ ) - if ( m_pDataAdvises[nInd] ) - { - DWORD nID = m_pDataAdvises[nInd]->GetRegID(); - pIDataObject->DUnadvise( nID ); - m_pDataAdvises[nInd]->SetRegID( 0 ); - } - } - - ComSmart< IViewObject > pIViewObject; - hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - if ( SUCCEEDED( hr ) && pIViewObject ) - { - if ( m_pViewAdvise ) - pIViewObject->SetAdvise( m_pViewAdvise->GetAspect(), m_pViewAdvise->GetViewAdviseFlag(), NULL ); - } - - ComSmart< IPersistStorage > pPersist; - hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - if ( SUCCEEDED( hr ) && pPersist ) - { - // disconnect the old wrapper from the storage - pPersist->HandsOffStorage(); - } - - m_pDefHandler = NULL; - } - - m_pOleAdvises[0]->UnsetClosed(); - } - } - - if ( m_nCallsOnStack ) - return FALSE; - - if ( !m_pDefHandler ) - { - // create a new default inprocess handler - HRESULT hr = OleCreateDefaultHandler( m_guid, NULL, IID_IUnknown, (void**)&m_pDefHandler ); - if ( SUCCEEDED( hr ) ) - { - { - if ( m_nInitMode == INIT_FROM_STORAGE ) - { - ComSmart< IPersistStorage > pPersist; - hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist && m_pStorage ) - hr = pPersist->InitNew( m_pStorage ); - } - else if ( m_nInitMode == LOAD_FROM_STORAGE ) - { - ComSmart< IPersistStorage > pPersist; - hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist && m_pStorage ) - hr = pPersist->Load( m_pStorage ); - } - else if ( m_nInitMode == LOAD_FROM_FILE ) - { - ComSmart< IPersistFile > pPersistFile; - hr = m_pDefHandler->QueryInterface( IID_IPersistFile, (void**)&pPersistFile ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersistFile && m_pFileName ) - hr = pPersistFile->Load( m_pFileName, m_nFileOpenMode ); - } - } - } - - if ( !SUCCEEDED( hr ) || !m_pDefHandler ) - { - m_pDefHandler = NULL; - return FALSE; - } - - // register all the listeners new - - ComSmart< IOleObject > pOleObject; - hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - if ( SUCCEEDED( hr ) && pOleObject ) - { - if ( m_pClientSite ) - pOleObject->SetClientSite( m_pClientSite ); - - for ( DWORD nInd = 0; nInd < DEFAULT_ARRAY_LEN; nInd++ ) - if ( m_pOleAdvises[nInd] ) - { - DWORD nRegID = 0; - if ( SUCCEEDED( pOleObject->Advise( m_pOleAdvises[nInd], &nRegID ) ) && nRegID > 0 ) - m_pOleAdvises[nInd]->SetRegID( nRegID ); - } - } - - ComSmart< IDataObject > pIDataObject; - hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - if ( SUCCEEDED( hr ) && pIDataObject ) - { - for ( DWORD nInd = 0; nInd < DEFAULT_ARRAY_LEN; nInd++ ) - if ( m_pDataAdvises[nInd] ) - { - DWORD nRegID = 0; - if ( SUCCEEDED( pIDataObject->DAdvise( m_pDataAdvises[nInd]->GetFormatEtc(), m_pDataAdvises[nInd]->GetDataAdviseFlag(), m_pDataAdvises[nInd], &nRegID ) ) && nRegID > 0 ) - m_pDataAdvises[nInd]->SetRegID( nRegID ); - } - } - - ComSmart< IViewObject > pIViewObject; - hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - if ( SUCCEEDED( hr ) && pIViewObject ) - { - if ( m_pViewAdvise ) - pIViewObject->SetAdvise( m_pViewAdvise->GetAspect(), m_pViewAdvise->GetViewAdviseFlag(), m_pViewAdvise ); - } - } - - - return TRUE; -} - -//------------------------------------------------------------------------------- -DWORD InprocEmbedDocument_Impl::InsertAdviseLinkToList( const ComSmart& pOwnAdvise, ComSmart< OleWrapperAdviseSink > pAdvises[] ) -{ - // the result should start from 1 in case of success, the element 0 can be used for own needs - DWORD nResult = 0; - - if ( pOwnAdvise ) - { - for ( DWORD nInd = 1; nInd < DEFAULT_ARRAY_LEN && nResult == 0; nInd++ ) - { - if ( pAdvises[nInd] == pOwnAdvise ) - { - nResult = nInd; - } - else if ( pAdvises[nInd] == NULL ) - { - pAdvises[nInd] = pOwnAdvise; - nResult = nInd; - } - } - } - - return nResult; -} - -//------------------------------------------------------------------------------- -void InprocEmbedDocument_Impl::Clean() -{ - m_pDefHandler = (IUnknown*)NULL; - - // no DisconnectOrigAdvise() call here, since it is no explicit disconnection - for ( DWORD nInd = 0; nInd < DEFAULT_ARRAY_LEN; nInd++ ) - { - if ( m_pOleAdvises[nInd] ) - { - ComSmart< OleWrapperAdviseSink > pAdvise = m_pOleAdvises[nInd]; - m_pOleAdvises[nInd] = NULL; - } - - if ( m_pDataAdvises[nInd] ) - { - ComSmart< OleWrapperAdviseSink > pAdvise = m_pDataAdvises[nInd]; - m_pDataAdvises[nInd] = NULL; - } - } - - m_pViewAdvise = NULL; - - m_nInitMode = NOINIT; - m_pStorage = NULL; - - if ( m_pOleContainer ) - { - m_pOleContainer->LockContainer( FALSE ); - m_pOleContainer = NULL; - } - - m_pClientSite = NULL; - - m_nFileOpenMode = 0; - if ( m_pFileName ) - { - delete m_pFileName; - m_pFileName = NULL; - } -} - -// IUnknown -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::QueryInterface( REFIID riid, void FAR* FAR* ppv ) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersist)) - { - AddRef(); - *ppv = (IPersist*) (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersistStorage)) - { - AddRef(); - *ppv = (IPersistStorage*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IDataObject)) - { - AddRef(); - *ppv = (IDataObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleObject)) - { - AddRef(); - *ppv = (IOleObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IPersistFile)) - { - AddRef(); - *ppv = (IPersistFile*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IRunnableObject)) - { - AddRef(); - *ppv = (IRunnableObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IViewObject)) - { - AddRef(); - *ppv = (IViewObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IViewObject2)) - { - AddRef(); - *ppv = (IViewObject2*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleCache)) - { - AddRef(); - *ppv = (IOleCache*) &m_aInternalCache; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleCache2)) - { - AddRef(); - *ppv = (IOleCache2*) &m_aInternalCache; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleWindow)) - { - AddRef(); - *ppv = (IOleWindow*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IOleInPlaceObject)) - { - AddRef(); - *ppv = (IOleInPlaceObject*) this; - return S_OK; - } - else if (IsEqualIID(riid, IID_IDispatch)) - { - AddRef(); - *ppv = (IDispatch*) this; - return S_OK; - } - - *ppv = NULL; - return ResultFromScode(E_NOINTERFACE); -} - -//------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedDocument_Impl::AddRef() -{ - return ++m_refCount; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedDocument_Impl::Release() -{ - // unfortunately there are reentrance problems in mfc that have to be workarounded - sal_Int32 nCount = m_refCount > 0 ? --m_refCount : 0; - if ( nCount == 0 && !m_bDeleted ) - { - // deleting of this object can trigger deleting of mfc objects that will try to delete this object one more time - m_bDeleted = TRUE; - - Clean(); - delete this; - } - return nCount; -} - -// IPersist -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetClassID( CLSID* pClassId ) -{ - *pClassId = *&m_guid; - return S_OK; -} - -// IPersistStorage -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::IsDirty() -{ - if ( m_pDefHandler == NULL || m_pOleAdvises[0] == NULL || m_pOleAdvises[0]->IsClosed() ) - return S_FALSE; - - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - return pPersist->IsDirty(); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InitNew( IStorage *pStg ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->InitNew( pStg ); - if ( SUCCEEDED( hr ) ) - { - m_nInitMode = INIT_FROM_STORAGE; - m_pStorage = pStg; - - m_nFileOpenMode = 0; - if ( m_pFileName ) - { - delete[] m_pFileName; - m_pFileName = NULL; - } - } - - return hr; - } - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Load( IStorage *pStg ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->Load( pStg ); - if ( SUCCEEDED( hr ) ) - { - m_nInitMode = LOAD_FROM_STORAGE; - m_pStorage = pStg; - - m_nFileOpenMode = 0; - if ( m_pFileName ) - { - delete[] m_pFileName; - m_pFileName = NULL; - } - } - - return hr; - } - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Save( IStorage *pStgSave, BOOL fSameAsLoad ) -{ - if ( fSameAsLoad && ( m_pDefHandler == NULL || m_pOleAdvises[0] == NULL || m_pOleAdvises[0]->IsClosed() ) ) - return S_OK; - - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - return pPersist->Save( pStgSave, fSameAsLoad ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SaveCompleted( IStorage *pStgNew ) -{ - if ( m_pDefHandler == NULL || m_pOleAdvises[0] == NULL || m_pOleAdvises[0]->IsClosed() ) - { - if ( pStgNew ) - m_pStorage = pStgNew; - - return S_OK; - } - - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->SaveCompleted( pStgNew ); - if ( SUCCEEDED( hr ) ) - { - m_nInitMode = LOAD_FROM_STORAGE; - if ( pStgNew ) - { - m_pStorage = pStgNew; - } - - m_nFileOpenMode = 0; - if ( m_pFileName ) - { - delete[] m_pFileName; - m_pFileName = NULL; - } - } - - return hr; - } - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::HandsOffStorage() -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistStorage > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistStorage, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->HandsOffStorage(); - if ( SUCCEEDED( hr ) ) - { - m_pStorage = NULL; - } - - return hr; - } - } - - return E_FAIL; -} - -// IPersistFile -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD dwMode ) -{ - if ( CheckDefHandler() && pszFileName ) - { - ComSmart< IPersistFile > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistFile, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->Load( pszFileName, dwMode ); - if ( SUCCEEDED( hr ) ) - { - m_nInitMode = LOAD_FROM_FILE; - if ( m_pStorage ) - m_pStorage = NULL; - - m_nFileOpenMode = dwMode; - // copy the string - SetName( pszFileName, m_pFileName ); - } - - return hr; - } - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Save( LPCOLESTR pszFileName, BOOL fRemember ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistFile > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistFile, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - return pPersist->Save( pszFileName, fRemember ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SaveCompleted( LPCOLESTR pszFileName ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistFile > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistFile, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - { - hr = pPersist->SaveCompleted( pszFileName ); - if ( SUCCEEDED( hr ) ) - { - m_nInitMode = LOAD_FROM_STORAGE; - if ( m_pStorage ) - m_pStorage = NULL; - - m_nFileOpenMode = STGM_READWRITE; // was just written - // copy the string - SetName( pszFileName, m_pFileName ); - } - } - - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetCurFile( LPOLESTR *ppszFileName ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IPersistFile > pPersist; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IPersistFile, (void**)&pPersist ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pPersist ) - return pPersist->GetCurFile( ppszFileName ); - } - - return E_FAIL; -} - -// IOleObject -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetClientSite( IOleClientSite* pSite ) -{ - if ( pSite == m_pClientSite ) - return S_OK; - - if ( !pSite ) - { - m_pClientSite = NULL; - if ( m_pOleContainer ) - { - m_pOleContainer->LockContainer( FALSE ); - m_pOleContainer = NULL; - } - } - - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - HRESULT hr = pOleObject->SetClientSite( pSite ); - if ( SUCCEEDED( hr ) ) - { - m_pClientSite = pSite; - - if ( m_pOleContainer ) - { - m_pOleContainer->LockContainer( FALSE ); - m_pOleContainer = NULL; - } - - m_pClientSite->GetContainer( &m_pOleContainer ); - if ( m_pOleContainer ) - m_pOleContainer->LockContainer( TRUE ); - } - - return hr; - } - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetClientSite( IOleClientSite** pSite ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetClientSite( pSite ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ) -{ - - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - hr = pOleObject->SetHostNames( szContainerApp, szContainerObj ); - } - } - - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Close( DWORD dwSaveOption ) -{ - if ( m_pDefHandler && CheckDefHandler() ) - { - // no need to close if there is no default handler. - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - hr = pOleObject->Close( dwSaveOption ); - hr = CoDisconnectObject( (IUnknown*)(IPersistStorage*)this, 0 ); - } - } - - // if the object is closed from outside that means that it should go to uninitialized state - Clean(); - - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetMoniker( DWORD dwWhichMoniker, IMoniker * pmk ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->SetMoniker( dwWhichMoniker, pmk ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetMoniker( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker ** ppmk ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetMoniker( dwAssign, dwWhichMoniker, ppmk ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InitFromData( IDataObject * pDataObject, BOOL fCreation, DWORD dwReserved ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->InitFromData( pDataObject, fCreation, dwReserved ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetClipboardData( DWORD dwReserved, IDataObject ** ppDataObject ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetClipboardData( dwReserved, ppDataObject ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::DoVerb( - LONG iVerb, - LPMSG pMsg, - IOleClientSite *pActiveSite, - LONG nLong, - HWND hWin, - LPCRECT pRect ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - hr = pOleObject->DoVerb( iVerb, pMsg, pActiveSite, nLong, hWin, pRect ); - if ( SUCCEEDED( hr ) ) - { - } - - return hr; - } - - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::EnumVerbs( IEnumOLEVERB ** ppEnumOleVerb ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->EnumVerbs( ppEnumOleVerb ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Update() -{ - - if ( m_pDefHandler && CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->Update(); - } - - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::IsUpToDate() -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->IsUpToDate(); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetUserClassID( CLSID *pClsid ) -{ - if ( pClsid ) - *pClsid = m_guid; - - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetUserType( DWORD dwFormOfType, LPOLESTR * pszUserType ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetUserType( dwFormOfType, pszUserType ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetExtent( DWORD dwDrawAspect, SIZEL *psizel ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->SetExtent( dwDrawAspect, psizel ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetExtent( DWORD dwDrawAspect, SIZEL * psizel ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetExtent( dwDrawAspect, psizel ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Advise( IAdviseSink *pAdvSink, DWORD *pdwConnection ) -{ - - if ( !pdwConnection ) - return E_FAIL; - - // CheckDefHandler will set the listener, avoid reusing of old listener - if ( DEFAULT_ARRAY_LEN > *pdwConnection && *pdwConnection > 0 && m_pOleAdvises[*pdwConnection] ) - { - m_pOleAdvises[*pdwConnection]->DisconnectOrigAdvise(); - m_pOleAdvises[*pdwConnection] = NULL; - } - - if ( pAdvSink && CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - ComSmart< OleWrapperAdviseSink > pOwnAdvise( new OleWrapperAdviseSink( pAdvSink ) ); - DWORD nRegID = 0; - - if ( SUCCEEDED( pOleObject->Advise( pOwnAdvise, &nRegID ) ) && nRegID > 0 ) - { - pOwnAdvise->SetRegID( nRegID ); - *pdwConnection = InsertAdviseLinkToList( pOwnAdvise, m_pOleAdvises ); - if ( *pdwConnection ) - return S_OK; - else - pOleObject->Unadvise( nRegID ); - } - } - } - - // return success always for now - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Unadvise( DWORD dwConnection ) -{ - if ( DEFAULT_ARRAY_LEN > dwConnection && dwConnection > 0 && m_pOleAdvises[dwConnection] ) - { - if ( m_pDefHandler ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - { - DWORD nID = m_pOleAdvises[dwConnection]->GetRegID(); - pOleObject->Unadvise( nID ); - } - } - - m_pOleAdvises[dwConnection]->DisconnectOrigAdvise(); - m_pOleAdvises[dwConnection] = NULL; - - return S_OK; - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::EnumAdvise( IEnumSTATDATA ** /*ppenumAdvise*/ ) -{ - return E_NOTIMPL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetMiscStatus( DWORD dwAspect, DWORD * pdwStatus ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->GetMiscStatus( dwAspect, pdwStatus ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetColorScheme( LOGPALETTE * pLogpal ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleObject > pOleObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleObject, (void**)&pOleObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pOleObject ) - return pOleObject->SetColorScheme( pLogpal ); - } - - return E_FAIL; -} - -//IDataObject -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->GetData( pFormatetc, pMedium ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetDataHere( FORMATETC * pFormatetc, STGMEDIUM * pMedium ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->GetDataHere( pFormatetc, pMedium ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::QueryGetData( FORMATETC * pFormatetc ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->QueryGetData( pFormatetc ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetCanonicalFormatEtc( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->GetCanonicalFormatEtc( pFormatetcIn, pFormatetcOut ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetData( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->SetData( pFormatetc, pMedium, fRelease ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->EnumFormatEtc( dwDirection, ppFormatetc ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::DAdvise( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ) -{ - - if ( !pdwConnection ) - return E_FAIL; - - // avoid reusing of the old listener - if ( m_pDefHandler && DEFAULT_ARRAY_LEN > *pdwConnection && *pdwConnection > 0 && m_pDataAdvises[*pdwConnection] ) - { - m_pDataAdvises[*pdwConnection]->DisconnectOrigAdvise(); - m_pDataAdvises[*pdwConnection] = NULL; - } - - if ( pAdvSink && CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - { - ComSmart< OleWrapperAdviseSink > pOwnAdvise( new OleWrapperAdviseSink( ComSmart( pAdvSink ), pFormatetc, advf ) ); - DWORD nRegID = 0; - - if ( SUCCEEDED( pIDataObject->DAdvise( pFormatetc, advf, pOwnAdvise, &nRegID ) ) && nRegID > 0 ) - { - pOwnAdvise->SetRegID( nRegID ); - *pdwConnection = InsertAdviseLinkToList( pOwnAdvise, m_pDataAdvises ); - if ( *pdwConnection ) - return S_OK; - else - pIDataObject->DUnadvise( nRegID ); - } - } - } - - // return success always for now - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::DUnadvise( DWORD dwConnection ) -{ - if ( m_pDefHandler && DEFAULT_ARRAY_LEN > dwConnection && dwConnection > 0 && m_pDataAdvises[dwConnection] ) - { - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - { - DWORD nID = m_pDataAdvises[dwConnection]->GetRegID(); - pIDataObject->DUnadvise( nID ); - } - } - - m_pDataAdvises[dwConnection]->DisconnectOrigAdvise(); - m_pDataAdvises[dwConnection] = NULL; - - return S_OK; - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::EnumDAdvise( IEnumSTATDATA ** ppenumAdvise ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDataObject > pIDataObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDataObject, (void**)&pIDataObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDataObject ) - return pIDataObject->EnumDAdvise( ppenumAdvise ); - } - - return E_FAIL; -} - -// IRunnableObject -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetRunningClass( LPCLSID lpClsid ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IRunnableObject > pIRunObj; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IRunnableObject, (void**)&pIRunObj ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIRunObj ) - return pIRunObj->GetRunningClass( lpClsid ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Run( LPBINDCTX pbc ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IRunnableObject > pIRunObj; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IRunnableObject, (void**)&pIRunObj ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIRunObj ) - return pIRunObj->Run( pbc ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -BOOL STDMETHODCALLTYPE InprocEmbedDocument_Impl::IsRunning() -{ - if ( CheckDefHandler() ) - { - ComSmart< IRunnableObject > pIRunObj; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IRunnableObject, (void**)&pIRunObj ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIRunObj ) - return pIRunObj->IsRunning(); - } - - return E_FAIL; - -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::LockRunning( BOOL fLock, BOOL fLastUnlockCloses ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IRunnableObject > pIRunObj; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IRunnableObject, (void**)&pIRunObj ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIRunObj ) - return pIRunObj->LockRunning( fLock, fLastUnlockCloses ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetContainedObject( BOOL fContained) -{ - if ( CheckDefHandler() ) - { - ComSmart< IRunnableObject > pIRunObj; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IRunnableObject, (void**)&pIRunObj ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIRunObj ) - return pIRunObj->SetContainedObject( fContained ); - } - - return E_FAIL; -} - - -// IViewObject methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Draw( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL ( STDMETHODCALLTYPE *pfnContinue )( ULONG_PTR dwContinue ), ULONG_PTR dwContinue ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IViewObject > pIViewObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject ) - return pIViewObject->Draw( dwDrawAspect, lindex, pvAspect, ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetColorSet( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IViewObject > pIViewObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject ) - return pIViewObject->GetColorSet( dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Freeze( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IViewObject > pIViewObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject ) - return pIViewObject->Freeze( dwDrawAspect, lindex, pvAspect, pdwFreeze ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Unfreeze( DWORD dwFreeze ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IViewObject > pIViewObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject ) - return pIViewObject->Unfreeze( dwFreeze ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetAdvise( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink ) -{ - - // CheckDefHandler will set the listener, avoid reusing of old listener - if ( m_pViewAdvise ) - { - m_pViewAdvise->DisconnectOrigAdvise(); - m_pViewAdvise = NULL; - } - - if ( pAdvSink && CheckDefHandler() ) - { - ComSmart< IViewObject > pIViewObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject, (void**)&pIViewObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject ) - { - ComSmart< OleWrapperAdviseSink > pOwnAdvise( new OleWrapperAdviseSink( pAdvSink, aspects, advf ) ); - - if ( SUCCEEDED( pIViewObject->SetAdvise( aspects, advf, pOwnAdvise ) ) ) - { - m_pViewAdvise = pOwnAdvise; - return S_OK; - } - } - } - - return S_OK; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetAdvise( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink ) -{ - if ( !ppAdvSink ) - return E_INVALIDARG; - - if ( m_pViewAdvise ) - { - if ( pAspects ) - *pAspects = m_pViewAdvise->GetAspect(); - - if ( pAdvf ) - *pAdvf = m_pViewAdvise->GetViewAdviseFlag(); - - *ppAdvSink = m_pViewAdvise->GetOrigAdvise(); - if ( *ppAdvSink ) - (*ppAdvSink)->AddRef(); - } - else - *ppAdvSink = NULL; - - return S_OK; -} - -// IViewObject2 methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetExtent( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IViewObject2 > pIViewObject2; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IViewObject2, (void**)&pIViewObject2 ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIViewObject2 ) - return pIViewObject2->GetExtent( dwDrawAspect, lindex, ptd, lpsizel ); - } - - return E_FAIL; -} - - - -// IOleWindow methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetWindow( HWND *phwnd ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleWindow > pIOleWindow; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleWindow, (void**)&pIOleWindow ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleWindow ) - return pIOleWindow->GetWindow( phwnd ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::ContextSensitiveHelp( BOOL fEnterMode ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleWindow > pIOleWindow; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleWindow, (void**)&pIOleWindow ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleWindow ) - return pIOleWindow->ContextSensitiveHelp( fEnterMode ); - } - - return E_FAIL; -} - - -// IOleInPlaceObject methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InPlaceDeactivate( void ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleInPlaceObject > pIOleInPlaceObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleInPlaceObject, (void**)&pIOleInPlaceObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleInPlaceObject ) - return pIOleInPlaceObject->InPlaceDeactivate(); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::UIDeactivate( void ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleInPlaceObject > pIOleInPlaceObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleInPlaceObject, (void**)&pIOleInPlaceObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleInPlaceObject ) - return pIOleInPlaceObject->UIDeactivate(); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::SetObjectRects( LPCRECT lprcPosRect, LPCRECT lprcClipRect ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleInPlaceObject > pIOleInPlaceObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleInPlaceObject, (void**)&pIOleInPlaceObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleInPlaceObject ) - return pIOleInPlaceObject->SetObjectRects( lprcPosRect, lprcClipRect ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::ReactivateAndUndo( void ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IOleInPlaceObject > pIOleInPlaceObject; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IOleInPlaceObject, (void**)&pIOleInPlaceObject ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleInPlaceObject ) - return pIOleInPlaceObject->ReactivateAndUndo(); - } - - return E_FAIL; -} - - -// IDispatch methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetTypeInfoCount( UINT *pctinfo ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDispatch > pIDispatch; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDispatch, (void**)&pIDispatch ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDispatch ) - return pIDispatch->GetTypeInfoCount( pctinfo ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetTypeInfo( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDispatch > pIDispatch; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDispatch, (void**)&pIDispatch ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDispatch ) - return pIDispatch->GetTypeInfo( iTInfo, lcid, ppTInfo ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::GetIDsOfNames( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDispatch > pIDispatch; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDispatch, (void**)&pIDispatch ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDispatch ) - return pIDispatch->GetIDsOfNames( riid, rgszNames, cNames, lcid, rgDispId ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr ) -{ - if ( CheckDefHandler() ) - { - ComSmart< IDispatch > pIDispatch; - HRESULT hr = m_pDefHandler->QueryInterface( IID_IDispatch, (void**)&pIDispatch ); - - ULONGGuard aGuard( &m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIDispatch ) - return pIDispatch->Invoke( dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr ); - } - - return E_FAIL; -} - - -// ==== -// InternalCacheWrapper -// ==== - -// IUnknown -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::QueryInterface( REFIID riid, void FAR* FAR* ppv ) -{ - return m_rOwnDocument.QueryInterface( riid, ppv ); -} - -//------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedDocument_Impl::InternalCacheWrapper::AddRef() -{ - return m_rOwnDocument.AddRef(); -} - -//------------------------------------------------------------------------------- -STDMETHODIMP_(ULONG) InprocEmbedDocument_Impl::InternalCacheWrapper::Release() -{ - return m_rOwnDocument.Release(); -} - -// IOleCache methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::Cache( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache > pIOleCache; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache, (void**)&pIOleCache ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache ) - return pIOleCache->Cache( pformatetc, advf, pdwConnection ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::Uncache( DWORD dwConnection ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache > pIOleCache; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache, (void**)&pIOleCache ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache ) - return pIOleCache->Uncache( dwConnection ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::EnumCache( IEnumSTATDATA **ppenumSTATDATA ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache > pIOleCache; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache, (void**)&pIOleCache ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache ) - return pIOleCache->EnumCache( ppenumSTATDATA ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::InitCache( IDataObject *pDataObject ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache > pIOleCache; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache, (void**)&pIOleCache ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache ) - return pIOleCache->InitCache( pDataObject ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::SetData( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache > pIOleCache; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache, (void**)&pIOleCache ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache ) - return pIOleCache->SetData( pformatetc, pmedium, fRelease ); - } - - return E_FAIL; -} - -// IOleCache2 methods -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::UpdateCache( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache2 > pIOleCache2; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache2, (void**)&pIOleCache2 ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache2 ) - return pIOleCache2->UpdateCache( pDataObject, grfUpdf, pReserved ); - } - - return E_FAIL; -} - -//------------------------------------------------------------------------------- -STDMETHODIMP InprocEmbedDocument_Impl::InternalCacheWrapper::DiscardCache( DWORD dwDiscardOptions ) -{ - if ( m_rOwnDocument.CheckDefHandler() ) - { - ComSmart< IOleCache2 > pIOleCache2; - HRESULT hr = m_rOwnDocument.GetDefHandler()->QueryInterface( IID_IOleCache2, (void**)&pIOleCache2 ); - - ULONGGuard aGuard( &m_rOwnDocument.m_nCallsOnStack ); // avoid reentrance problem - if ( SUCCEEDED( hr ) && pIOleCache2 ) - return pIOleCache2->DiscardCache( dwDiscardOptions ); - } - - return E_FAIL; -} - -}; // namespace inprocserv - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/inprocembobj.h b/embedserv/source/inprocserv/inprocembobj.h deleted file mode 100644 index ebbbd393e..000000000 --- a/embedserv/source/inprocserv/inprocembobj.h +++ /dev/null @@ -1,244 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _INPROCEMBOBJ_HXX_ -#define _INPROCEMBOBJ_HXX_ - -#pragma warning(disable : 4668) - -#include -#include - -#include "smartpointer.hxx" -#include "advisesink.hxx" - -#define DEFAULT_ARRAY_LEN 256 - -namespace inprocserv { - -enum InitModes { - NOINIT, - INIT_FROM_STORAGE, - LOAD_FROM_STORAGE, - LOAD_FROM_FILE -}; - -// ================================== -// this is a common baseclass that is used to count the objects -// ================================== -class InprocCountedObject_Impl -{ -public: - InprocCountedObject_Impl(); - ~InprocCountedObject_Impl(); -}; - -// ================================== -// this is the inprocess embedded object implementation class -// ================================== -class InprocEmbedDocument_Impl : public InprocCountedObject_Impl - , public IOleObject - , public IDataObject - , public IPersistStorage - , public IPersistFile - , public IRunnableObject - , public IViewObject2 - // , public IExternalConnection - , public IOleInPlaceObject - , public IDispatch -{ - ULONG m_refCount; - BOOLEAN m_bDeleted; - - GUID m_guid; - - ComSmart< IUnknown > m_pDefHandler; - InitModes m_nInitMode; - - DWORD m_nFileOpenMode; - wchar_t* m_pFileName; - - ComSmart< IStorage > m_pStorage; - - ComSmart< IOleClientSite > m_pClientSite; - ComSmart< IOleContainer > m_pOleContainer; - - ULONG m_nCallsOnStack; - - // the listeners have wrappers that are directly connected to the object and call the listeners, - // the wrappers will be reconnected correctly to the new default inprocess holder object - ComSmart< OleWrapperAdviseSink > m_pOleAdvises[DEFAULT_ARRAY_LEN]; - ComSmart< OleWrapperAdviseSink > m_pDataAdvises[DEFAULT_ARRAY_LEN]; - ComSmart< OleWrapperAdviseSink > m_pViewAdvise; - - class InternalCacheWrapper : public IOleCache2 - { - InprocEmbedDocument_Impl& m_rOwnDocument; - - public: - InternalCacheWrapper( InprocEmbedDocument_Impl& rOwnDocument ) - : m_rOwnDocument( rOwnDocument ) - {} - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IOleCache2 methods */ - STDMETHOD(Cache)( FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection); - STDMETHOD(Uncache)( DWORD dwConnection); - STDMETHOD(EnumCache)( IEnumSTATDATA **ppenumSTATDATA); - STDMETHOD(InitCache)( IDataObject *pDataObject); - STDMETHOD(SetData)( FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease); - STDMETHOD(UpdateCache)( LPDATAOBJECT pDataObject, DWORD grfUpdf, LPVOID pReserved); - STDMETHOD(DiscardCache)( DWORD dwDiscardOptions); - } m_aInternalCache; - - - DWORD InsertAdviseLinkToList( const ComSmart& pOwnAdvise, ComSmart< OleWrapperAdviseSink > pAdvises[] ); - void Clean(); - - -public: - - InprocEmbedDocument_Impl( const GUID& guid ) - : m_refCount( 0 ) - , m_bDeleted( FALSE ) - , m_guid( guid ) - , m_nInitMode( NOINIT ) - , m_nFileOpenMode( 0 ) - , m_pFileName( NULL ) - , m_nCallsOnStack( 0 ) - , m_aInternalCache( *this ) - {} - - virtual ~InprocEmbedDocument_Impl() - {} - - HRESULT Init(); - void SetName( LPCOLESTR pszNameFromOutside, wchar_t*& pOwnName ); - - BOOL CheckDefHandler(); - ComSmart< IUnknown >& GetDefHandler() { return m_pDefHandler; } - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IOleObject methods */ - STDMETHOD(SetClientSite) ( IOleClientSite* pSite ); - STDMETHOD(GetClientSite) ( IOleClientSite** pSite ); - STDMETHOD(SetHostNames) ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj ); - STDMETHOD(Close) ( DWORD dwSaveOption); - STDMETHOD(SetMoniker) ( DWORD dwWhichMoniker, IMoniker *pmk ); - STDMETHOD(GetMoniker) ( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk ); - STDMETHOD(InitFromData) ( IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved ); - STDMETHOD(GetClipboardData) ( DWORD dwReserved, IDataObject **ppDataObject ); - STDMETHOD(DoVerb) ( LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect ); - STDMETHOD(EnumVerbs) ( IEnumOLEVERB **ppEnumOleVerb ); - STDMETHOD(Update) (); - STDMETHOD(IsUpToDate) (); - STDMETHOD(GetUserClassID) ( CLSID *pClsid ); - STDMETHOD(GetUserType) ( DWORD dwFormOfType, LPOLESTR *pszUserType ); - STDMETHOD(SetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); - STDMETHOD(GetExtent) ( DWORD dwDrawAspect, SIZEL *psizel ); - STDMETHOD(Advise) ( IAdviseSink *pAdvSink, DWORD *pdwConnection ); - STDMETHOD(Unadvise) ( DWORD dwConnection ); - STDMETHOD(EnumAdvise) ( IEnumSTATDATA **ppenumAdvise ); - STDMETHOD(GetMiscStatus) ( DWORD dwAspect, DWORD *pdwStatus ); - STDMETHOD(SetColorScheme) ( LOGPALETTE *pLogpal ); - - /* IDataObject methods */ - STDMETHOD(GetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); - STDMETHOD(GetDataHere) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium ); - STDMETHOD(QueryGetData) ( FORMATETC * pFormatetc ); - STDMETHOD(GetCanonicalFormatEtc) ( FORMATETC * pFormatetcIn, FORMATETC * pFormatetcOut ); - STDMETHOD(SetData) ( FORMATETC * pFormatetc, STGMEDIUM * pMedium, BOOL fRelease ); - STDMETHOD(EnumFormatEtc) ( DWORD dwDirection, IEnumFORMATETC ** ppFormatetc ); - STDMETHOD(DAdvise) ( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection ); - STDMETHOD(DUnadvise) ( DWORD dwConnection ); - STDMETHOD(EnumDAdvise) ( IEnumSTATDATA ** ppenumAdvise ); - - /* IPersistMethod */ - STDMETHOD(GetClassID)(CLSID *pClassID); - - /* IPersistStorage methods */ - STDMETHOD(IsDirty) (); - STDMETHOD(InitNew) ( IStorage *pStg ); - STDMETHOD(Load) ( IStorage* pStr ); - STDMETHOD(Save) ( IStorage *pStgSave, BOOL fSameAsLoad ); - STDMETHOD(SaveCompleted) ( IStorage *pStgNew ); - STDMETHOD(HandsOffStorage) (void); - - /* IPersistFile methods */ - STDMETHOD(Load) ( LPCOLESTR pszFileName, DWORD dwMode ); - STDMETHOD(Save) ( LPCOLESTR pszFileName, BOOL fRemember ); - STDMETHOD(SaveCompleted) ( LPCOLESTR pszFileName ); - STDMETHOD(GetCurFile) ( LPOLESTR *ppszFileName ); - - /* IRunnableObject methods */ - STDMETHOD(GetRunningClass) ( LPCLSID lpClsid); - STDMETHOD(Run) ( LPBINDCTX pbc); - virtual BOOL STDMETHODCALLTYPE IsRunning( void); - STDMETHOD(LockRunning) ( BOOL fLock, BOOL fLastUnlockCloses ); - STDMETHOD(SetContainedObject) ( BOOL fContained); - - /* IViewObject2 methods */ - STDMETHOD(Draw)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds, BOOL ( STDMETHODCALLTYPE *pfnContinue )( ULONG_PTR dwContinue ), ULONG_PTR dwContinue); - STDMETHOD(GetColorSet)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet); - STDMETHOD(Freeze)( DWORD dwDrawAspect, LONG lindex, void *pvAspect, DWORD *pdwFreeze); - STDMETHOD(Unfreeze)( DWORD dwFreeze); - STDMETHOD(SetAdvise)( DWORD aspects, DWORD advf, IAdviseSink *pAdvSink); - STDMETHOD(GetAdvise)( DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink); - STDMETHOD(GetExtent)( DWORD dwDrawAspect, LONG lindex, DVTARGETDEVICE *ptd, LPSIZEL lpsizel); - - /* IOleWindow methods */ - STDMETHOD(GetWindow)( HWND *phwnd); - STDMETHOD(ContextSensitiveHelp)( BOOL fEnterMode); - - /* IOleInPlaceObject methods */ - STDMETHOD(InPlaceDeactivate)( void); - STDMETHOD(UIDeactivate)( void); - STDMETHOD(SetObjectRects)( LPCRECT lprcPosRect, LPCRECT lprcClipRect); - STDMETHOD(ReactivateAndUndo)( void); - - /*IDispatch methods*/ - STDMETHOD(GetTypeInfoCount)( UINT *pctinfo); - STDMETHOD(GetTypeInfo)( UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo); - STDMETHOD(GetIDsOfNames)( REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); - STDMETHOD(Invoke)( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); - -}; - -} // namespace inprocserv - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/source/inprocserv/makefile.mk b/embedserv/source/inprocserv/makefile.mk deleted file mode 100644 index 024e0f9d4..000000000 --- a/embedserv/source/inprocserv/makefile.mk +++ /dev/null @@ -1,80 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=embedserv -TARGET=inprocserv - -use_shl_versions= - -# --- Settings ---------------------------------- -.INCLUDE : settings.mk - -.IF "$(GUI)" == "WNT" - -LIBTARGET=NO -USE_DEFFILE=YES -LIBCMT=libcmt.lib -UWINAPILIB= - -# --- Files ------------------------------------- - -SLOFILES=\ - $(SLO)$/dllentry.obj \ - $(SLO)$/advisesink.obj \ - $(SLO)$/inprocembobj.obj - -SHL1TARGET=$(TARGET) -.IF "$(COM)"=="GCC" -SHL1STDLIBS += -lstdc++ -.IF "$(MINGW_GCCLIB_EH)"=="YES" -SHL1STDLIBS += -lgcc_eh -.ENDIF -SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt -.ELSE -SHL1STDLIBS= -.ENDIF - -SHL1STDLIBS+=\ - $(UUIDLIB)\ - $(OLE32LIB)\ - $(GDI32LIB)\ - $(ADVAPI32LIB) - -SHL1OBJS=$(SLOFILES) - -SHL1DEF=$(MISC)$/$(TARGET).def - -DEF1NAME= $(TARGET) -DEF1EXPORTFILE= exports.dxp - -.ENDIF - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/embedserv/source/inprocserv/smartpointer.hxx b/embedserv/source/inprocserv/smartpointer.hxx deleted file mode 100644 index c4f25c4dc..000000000 --- a/embedserv/source/inprocserv/smartpointer.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _INPROCSERV_SMARTPOINTER_HXX_ -#define _INPROCSERV_SMARTPOINTER_HXX_ - -namespace inprocserv{ - -void WriteDebugInfo( DWORD pThis, char* pString, DWORD nToWrite ); - -template< class T > class ComSmart -{ - T* m_pInterface; - - void OwnRelease() - { - if ( m_pInterface ) - { - T* pInterface = m_pInterface; - m_pInterface = NULL; - pInterface->Release(); - } - } - -public: - ComSmart() - : m_pInterface( NULL ) - {} - - ComSmart( const ComSmart& rObj ) - : m_pInterface( rObj.m_pInterface ) - { - if ( m_pInterface != NULL ) - m_pInterface->AddRef(); - } - - ComSmart( T* pInterface ) - : m_pInterface( pInterface ) - { - if ( m_pInterface != NULL ) - m_pInterface->AddRef(); - } - - ~ComSmart() - { - OwnRelease(); - } - - ComSmart& operator=( const ComSmart& rObj ) - { - OwnRelease(); - - m_pInterface = rObj.m_pInterface; - - if ( m_pInterface != NULL ) - m_pInterface->AddRef(); - - return *this; - } - - ComSmart& operator=( T* pInterface ) - { - OwnRelease(); - - m_pInterface = pInterface; - - if ( m_pInterface != NULL ) - m_pInterface->AddRef(); - - return *this; - } - - operator T*() const - { - return m_pInterface; - } - - T& operator*() const - { - return *m_pInterface; - } - - T** operator&() - { - OwnRelease(); - - m_pInterface = NULL; - - return &m_pInterface; - } - - T* operator->() const - { - return m_pInterface; - } - - BOOL operator==( const ComSmart& rObj ) const - { - return ( m_pInterface == rObj.m_pInterface ); - } - - BOOL operator!=( const ComSmart& rObj ) const - { - return ( m_pInterface != rObj.m_pInterface ); - } - - BOOL operator==( const T* pInterface ) const - { - return ( m_pInterface == pInterface ); - } - - BOOL operator!=( const T* pInterface ) const - { - return ( m_pInterface != pInterface ); - } -}; - -class CSGuard -{ - CRITICAL_SECTION* m_pCriticalSection; - -public: - CSGuard( CRITICAL_SECTION* pCS ) - : m_pCriticalSection( pCS ) - { - if ( m_pCriticalSection ) - EnterCriticalSection( m_pCriticalSection ); - } - - ~CSGuard() - { - if ( m_pCriticalSection ) - LeaveCriticalSection( m_pCriticalSection ); - } -}; - -class ULONGGuard -{ - ULONG* m_pValue; - -public: - ULONGGuard( ULONG* pValue ) - : m_pValue( pValue ) - { - if ( m_pValue ) - (*m_pValue)++; - } - - ~ULONGGuard() - { - if ( m_pValue ) - (*m_pValue)--; - } -}; - -} // namespace inprocserv - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embedserv/util/emser.component b/embedserv/util/emser.component deleted file mode 100644 index 682ad1c31..000000000 --- a/embedserv/util/emser.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/embedserv/util/exports.dxp b/embedserv/util/exports.dxp deleted file mode 100755 index 700330789..000000000 --- a/embedserv/util/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/embedserv/util/makefile.mk b/embedserv/util/makefile.mk deleted file mode 100644 index 1f8ad8a90..000000000 --- a/embedserv/util/makefile.mk +++ /dev/null @@ -1,102 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=embedserv -TARGET=emser -LIBTARGET=NO -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(GUI)" == "WNT" && "$(DISABLE_ATL)"=="" - -SHL1TARGET= emser$(DLLPOSTFIX) - -SHL1IMPLIB= emserimp -SHL1OBJS= \ - $(SLO)$/register.obj \ - $(SLO)$/servprov.obj \ - $(SLO)$/docholder.obj \ - $(SLO)$/ed_ipersiststr.obj \ - $(SLO)$/ed_idataobj.obj \ - $(SLO)$/ed_ioleobject.obj \ - $(SLO)$/ed_iinplace.obj \ - $(SLO)$/iipaobj.obj \ - $(SLO)$/guid.obj \ - $(SLO)$/esdll.obj \ - $(SLO)$/intercept.obj \ - $(SLO)$/syswinwrapper.obj \ - $(SLO)$/tracker.obj - -SHL1STDLIBS=\ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(OLE32LIB) \ - $(GDI32LIB) \ - $(UUIDLIB) \ - $(OLEAUT32LIB) - -.IF "$(COM)"=="MSC" -.IF "$(CCNUMVER)" >= "001300000000" && "$(CCNUMVER)" <= "001399999999" -SHL1STDLIBS+=\ - $(ADVAPI32LIB) \ - $(ATL_LIB)$/atls.lib -.ENDIF - -SHL1STDLIBS+=\ - $(ADVAPI32LIB) \ - $(ATL_LIB)$/atls.lib -.ENDIF # "$(COM)"=="MSC" - - -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - -.ENDIF - -# --- Targets ------------------------------------------------------------- - -.INCLUDE : target.mk - - - -ALLTAR : $(MISC)/emser.component - -$(MISC)/emser.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - emser.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt emser.component diff --git a/extensions/inc/abpilot.hrc b/extensions/inc/abpilot.hrc deleted file mode 100644 index 88d5cc17c..000000000 --- a/extensions/inc/abpilot.hrc +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_ABPILOT_HRC -#define EXTENSIONS_ABPILOT_HRC - -#define HID_ABSPILOT_PREVIOUS "EXTENSIONS_HID_ABSPILOT_PREVIOUS" -#define HID_ABSPILOT_NEXT "EXTENSIONS_HID_ABSPILOT_NEXT" -#define HID_ABSPILOT_CANCEL "EXTENSIONS_HID_ABSPILOT_CANCEL" -#define HID_ABSPILOT_FINISH "EXTENSIONS_HID_ABSPILOT_FINISH" -#define UID_ABSPILOT_HELP "EXTENSIONS_UID_ABSPILOT_HELP" -#define HID_ABSPILOT "EXTENSIONS_HID_ABSPILOT" - -#endif // EXTENSIONS_ABPILOT_HRC diff --git a/extensions/inc/appsettings.hxx b/extensions/inc/appsettings.hxx deleted file mode 100644 index 78f38ffb4..000000000 --- a/extensions/inc/appsettings.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _APPSETTINGS_HXX -#define _APPSETTINGS_HXX - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -XNameContainer* getApplicationSettings(); - -#ifdef __cplusplus -} -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/inc/bibliography.hrc b/extensions/inc/bibliography.hrc deleted file mode 100644 index 52a6694e9..000000000 --- a/extensions/inc/bibliography.hrc +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_BIBLIOGRAPHY_HRC -#define EXTENSIONS_BIBLIOGRAPHY_HRC - -#define HID_BIB_CHANGESOURCE "EXTENSIONS_HID_BIB_CHANGESOURCE" -#define HID_BIB_MAPPINGDLG "EXTENSIONS_HID_BIB_MAPPINGDLG" -#define HID_BIB_TBX_TABLE "EXTENSIONS_HID_BIB_TBX_TABLE" -#define HID_BIB_TBX_SEARCH "EXTENSIONS_HID_BIB_TBX_SEARCH" -#define HID_BIB_TBX_AUTOFILTER "EXTENSIONS_HID_BIB_TBX_AUTOFILTER" -#define HID_BIB_IDENTIFIER_POS "EXTENSIONS_HID_BIB_IDENTIFIER_POS" -#define HID_BIB_AUTHORITYTYPE_POS "EXTENSIONS_HID_BIB_AUTHORITYTYPE_POS" -#define HID_BIB_AUTHOR_POS "EXTENSIONS_HID_BIB_AUTHOR_POS" -#define HID_BIB_TITLE_POS "EXTENSIONS_HID_BIB_TITLE_POS" -#define HID_BIB_YEAR_POS "EXTENSIONS_HID_BIB_YEAR_POS" -#define HID_BIB_ISBN_POS "EXTENSIONS_HID_BIB_ISBN_POS" -#define HID_BIB_BOOKTITLE_POS "EXTENSIONS_HID_BIB_BOOKTITLE_POS" -#define HID_BIB_CHAPTER_POS "EXTENSIONS_HID_BIB_CHAPTER_POS" -#define HID_BIB_EDITION_POS "EXTENSIONS_HID_BIB_EDITION_POS" -#define HID_BIB_EDITOR_POS "EXTENSIONS_HID_BIB_EDITOR_POS" -#define HID_BIB_HOWPUBLISHED_POS "EXTENSIONS_HID_BIB_HOWPUBLISHED_POS" -#define HID_BIB_INSTITUTION_POS "EXTENSIONS_HID_BIB_INSTITUTION_POS" -#define HID_BIB_JOURNAL_POS "EXTENSIONS_HID_BIB_JOURNAL_POS" -#define HID_BIB_MONTH_POS "EXTENSIONS_HID_BIB_MONTH_POS" -#define HID_BIB_NOTE_POS "EXTENSIONS_HID_BIB_NOTE_POS" -#define HID_BIB_ANNOTE_POS "EXTENSIONS_HID_BIB_ANNOTE_POS" -#define HID_BIB_NUMBER_POS "EXTENSIONS_HID_BIB_NUMBER_POS" -#define HID_BIB_ORGANIZATIONS_POS "EXTENSIONS_HID_BIB_ORGANIZATIONS_POS" -#define HID_BIB_PAGES_POS "EXTENSIONS_HID_BIB_PAGES_POS" -#define HID_BIB_PUBLISHER_POS "EXTENSIONS_HID_BIB_PUBLISHER_POS" -#define HID_BIB_ADDRESS_POS "EXTENSIONS_HID_BIB_ADDRESS_POS" -#define HID_BIB_SCHOOL_POS "EXTENSIONS_HID_BIB_SCHOOL_POS" -#define HID_BIB_SERIES_POS "EXTENSIONS_HID_BIB_SERIES_POS" -#define HID_BIB_REPORTTYPE_POS "EXTENSIONS_HID_BIB_REPORTTYPE_POS" -#define HID_BIB_VOLUME_POS "EXTENSIONS_HID_BIB_VOLUME_POS" -#define HID_BIB_URL_POS "EXTENSIONS_HID_BIB_URL_POS" -#define HID_BIB_CUSTOM1_POS "EXTENSIONS_HID_BIB_CUSTOM1_POS" -#define HID_BIB_CUSTOM2_POS "EXTENSIONS_HID_BIB_CUSTOM2_POS" -#define HID_BIB_CUSTOM3_POS "EXTENSIONS_HID_BIB_CUSTOM3_POS" -#define HID_BIB_CUSTOM4_POS "EXTENSIONS_HID_BIB_CUSTOM4_POS" -#define HID_BIB_CUSTOM5_POS "EXTENSIONS_HID_BIB_CUSTOM5_POS" -#define HID_BIB_DB_TBX "EXTENSIONS_HID_BIB_DB_TBX" -#define HID_BIB_DB_GHIDCTRL "EXTENSIONS_HID_BIB_DB_GHIDCTRL" -#define HID_BIB_CONTROL_PAGE "EXTENSIONS_HID_BIB_CONTROL_PAGE" -#define HID_BIB_CONTROL_PARENT "EXTENSIONS_HID_BIB_CONTROL_PARENT" -#define UID_BIB_FRAME_WINDOW "EXTENSIONS_UID_BIB_FRAME_WINDOW" -#define HID_BIB_DELETE_RECORD "EXTENSIONS_HID_BIB_DELETE_RECORD" -#define HID_BIB_INSERT_RECORD "EXTENSIONS_HID_BIB_INSERT_RECORD" -#define HID_BIB_DB_GRIDCTRL "EXTENSIONS_HID_BIB_DB_GRIDCTRL" -#define HID_DLG_MAPPING "EXTENSIONS_HID_DLG_MAPPING" -#define HID_DLG_DBCHANGE "EXTENSIONS_HID_DLG_DBCHANGE" -#define HID_SELECTION_TLB "EXTENSIONS_HID_SELECTION_TLB" - -#endif // EXTENSIONS_BIBLIOGRAPHY_HRC diff --git a/extensions/inc/dbpilots.hrc b/extensions/inc/dbpilots.hrc deleted file mode 100644 index 3a7f3e695..000000000 --- a/extensions/inc/dbpilots.hrc +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_DBPILOT_HRC -#define EXTENSIONS_DBPILOT_HRC - -#define HID_GHIDWIZARD_PREVIOUS "EXTENSIONS_HID_GHIDWIZARD_PREVIOUS" -#define HID_GHIDWIZARD_NEXT "EXTENSIONS_HID_GHIDWIZARD_NEXT" -#define HID_GHIDWIZARD_CANCEL "EXTENSIONS_HID_GHIDWIZARD_CANCEL" -#define HID_GHIDWIZARD_FINISH "EXTENSIONS_HID_GHIDWIZARD_FINISH" -#define HID_GROUPWIZARD_PREVIOUS "EXTENSIONS_HID_GROUPWIZARD_PREVIOUS" -#define HID_GROUPWIZARD_NEXT "EXTENSIONS_HID_GROUPWIZARD_NEXT" -#define HID_GROUPWIZARD_CANCEL "EXTENSIONS_HID_GROUPWIZARD_CANCEL" -#define HID_GROUPWIZARD_FINISH "EXTENSIONS_HID_GROUPWIZARD_FINISH" -#define HID_LISTWIZARD_PREVIOUS "EXTENSIONS_HID_LISTWIZARD_PREVIOUS" -#define HID_LISTWIZARD_NEXT "EXTENSIONS_HID_LISTWIZARD_NEXT" -#define HID_LISTWIZARD_CANCEL "EXTENSIONS_HID_LISTWIZARD_CANCEL" -#define HID_LISTWIZARD_FINISH "EXTENSIONS_HID_LISTWIZARD_FINISH" -#define HID_GRIDWIZARD_PREVIOUS "EXTENSIONS_HID_GRIDWIZARD_PREVIOUS" -#define HID_GRIDWIZARD_NEXT "EXTENSIONS_HID_GRIDWIZARD_NEXT" -#define HID_GRIDWIZARD_CANCEL "EXTENSIONS_HID_GRIDWIZARD_CANCEL" -#define HID_GRIDWIZARD_FINISH "EXTENSIONS_HID_GRIDWIZARD_FINISH" - -#endif // EXTENSIONS_DBPILOT_HRC diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc deleted file mode 100644 index 5b1154763..000000000 --- a/extensions/inc/extensio.hrc +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_INC_EXTENSIO_HRC -#define EXTENSIONS_INC_EXTENSIO_HRC - -#include - -// ----------------------------------------------------------------------- -// - resource id ranges - -#define RID_ABP_START ( RID_MORE_EXTENSIONS_START + 0 ) -#define RID_ABP_END ( RID_MORE_EXTENSIONS_START + 19 ) - -#define RID_DBP_START ( RID_MORE_EXTENSIONS_START + 20 ) -#define RID_DBP_END ( RID_MORE_EXTENSIONS_START + 39 ) - -// !!! please adjust RID_LAST_EXTENSIONS_RANGE if you add new ranges here !!! - -#define RID_LAST_EXTENSIONS_RANGE RID_DBP_END - -#if RID_LAST_EXTENSIONS_RANGE > RID_MORE_EXTENSIONS_END - #error id range overflow -#endif - -// ----------------------------------------------------------------------- -// - help id ranges - -#define HID_DBP_START ( HID_EXTENSIONS_START + 0 ) -#define HID_DBP_END ( HID_EXTENSIONS_START + 19 ) - -#define HID_ABP_START ( HID_EXTENSIONS_START + 20 ) -#define HID_ABP_END ( HID_EXTENSIONS_START + 39 ) - -#define HID_BIBLIO_START ( HID_EXTENSIONS_START + 40 ) -#define HID_BIBLIO_END ( HID_EXTENSIONS_START + 89 ) - -#define HID_PROPC_START ( HID_EXTENSIONS_START + 90 ) -#define HID_PROPC_END ( HID_EXTENSIONS_START + 499 ) - -#define HID_UPDATE_START ( HID_EXTENSIONS_START + 500 ) -#define HID_UPDATE_END ( HID_EXTENSIONS_START + 519 ) - -// !!! please adjust HID_LAST_EXTENSIONS_RANGE if you add new ranges here !!! - -#define HID_LAST_EXTENSIONS_RANGE HID_UPDATE_END - -#if HID_LAST_EXTENSIONS_RANGE > HID_EXTENSIONS_END - #error id range overflow -#endif - -#endif diff --git a/extensions/inc/makefile.mk b/extensions/inc/makefile.mk deleted file mode 100644 index 9ea45ec08..000000000 --- a/extensions/inc/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=.. - -PRJNAME=extensions -TARGET=inc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -.IF "$(ENABLE_PCH)"!="" -ALLTAR : \ - $(SLO)$/precompiled.pch \ - $(SLO)$/precompiled_ex.pch - -.ENDIF # "$(ENABLE_PCH)"!="" - diff --git a/extensions/inc/pch/precompiled_extensions.cxx b/extensions/inc/pch/precompiled_extensions.cxx deleted file mode 100644 index 6a7304512..000000000 --- a/extensions/inc/pch/precompiled_extensions.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_extensions.hxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/inc/pch/precompiled_extensions.hxx b/extensions/inc/pch/precompiled_extensions.hxx deleted file mode 100644 index 8f17d7b5b..000000000 --- a/extensions/inc/pch/precompiled_extensions.hxx +++ /dev/null @@ -1,534 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:41.030262 - -#ifdef PRECOMPILED_HEADERS - -//---MARKER--- -#include "sal/config.h" -#include "sal/types.h" - -#include "boost/scoped_array.hpp" -#include "boost/shared_ptr.hpp" - -#include "com/sun/star/awt/FocusChangeReason.hpp" -#include "com/sun/star/awt/FocusEvent.hpp" -#include "com/sun/star/awt/FontDescriptor.hpp" -#include "com/sun/star/awt/FontSlant.hpp" -#include "com/sun/star/awt/FontStrikeout.hpp" -#include "com/sun/star/awt/FontUnderline.hpp" -#include "com/sun/star/awt/FontWeight.hpp" -#include "com/sun/star/awt/Gradient.hpp" -#include "com/sun/star/awt/GradientStyle.hpp" -#include "com/sun/star/awt/InputEvent.hpp" -#include "com/sun/star/awt/Key.hpp" -#include "com/sun/star/awt/KeyEvent.hpp" -#include "com/sun/star/awt/KeyFunction.hpp" -#include "com/sun/star/awt/KeyGroup.hpp" -#include "com/sun/star/awt/KeyModifier.hpp" -#include "com/sun/star/awt/MouseButton.hpp" -#include "com/sun/star/awt/MouseEvent.hpp" -#include "com/sun/star/awt/PaintEvent.hpp" -#include "com/sun/star/awt/PosSize.hpp" -#include "com/sun/star/awt/RasterOperation.hpp" -#include "com/sun/star/awt/Rectangle.hpp" -#include "com/sun/star/awt/Size.hpp" -#include "com/sun/star/awt/VclWindowPeerAttribute.hpp" -#include "com/sun/star/awt/VisualEffect.hpp" -#include "com/sun/star/awt/WindowDescriptor.hpp" -#include "com/sun/star/awt/WindowEvent.hpp" -#include "com/sun/star/awt/XActionListener.hpp" -#include "com/sun/star/awt/XActivateListener.hpp" -#include "com/sun/star/awt/XAdjustmentListener.hpp" -#include "com/sun/star/awt/XBitmap.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/XFocusListener.hpp" -#include "com/sun/star/awt/XGraphics.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/XMouseListener.hpp" -#include "com/sun/star/awt/XMouseMotionListener.hpp" -#include "com/sun/star/awt/XPaintListener.hpp" -#include "com/sun/star/awt/XSpinListener.hpp" -#include "com/sun/star/awt/XSystemChildFactory.hpp" -#include "com/sun/star/awt/XTabController.hpp" -#include "com/sun/star/awt/XTabControllerModel.hpp" -#include "com/sun/star/awt/XTextListener.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/XWindow.hpp" -#include "com/sun/star/awt/XWindowListener.hpp" -#include "com/sun/star/awt/XWindowPeer.hpp" -#include "com/sun/star/beans/MethodConcept.hpp" -#include "com/sun/star/beans/NamedValue.hpp" -#include "com/sun/star/beans/Optional.hpp" -#include "com/sun/star/beans/Property.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/beans/PropertyChangeEvent.hpp" -#include "com/sun/star/beans/PropertyConcept.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/UnknownPropertyException.hpp" -#include "com/sun/star/beans/XExactName.hpp" -#include "com/sun/star/beans/XFastPropertySet.hpp" -#include "com/sun/star/beans/XIntrospection.hpp" -#include "com/sun/star/beans/XIntrospectionAccess.hpp" -#include "com/sun/star/beans/XMaterialHolder.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/XPropertyStateChangeListener.hpp" -#include "com/sun/star/beans/XVetoableChangeListener.hpp" -#include "com/sun/star/bridge/ModelDependent.hpp" -#include "com/sun/star/bridge/XBridgeSupplier2.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" -#include "com/sun/star/bridge/oleautomation/Currency.hpp" -#include "com/sun/star/bridge/oleautomation/Date.hpp" -#include "com/sun/star/bridge/oleautomation/Decimal.hpp" -#include "com/sun/star/bridge/oleautomation/NamedArgument.hpp" -#include "com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp" -#include "com/sun/star/bridge/oleautomation/SCode.hpp" -#include "com/sun/star/bridge/oleautomation/XAutomationObject.hpp" -#include "com/sun/star/configuration/backend/BackendAccessException.hpp" -#include "com/sun/star/configuration/backend/CannotConnectException.hpp" -#include "com/sun/star/configuration/backend/ConnectionLostException.hpp" -#include "com/sun/star/configuration/backend/InsufficientAccessRightsException.hpp" -#include "com/sun/star/configuration/backend/PropertyInfo.hpp" -#include "com/sun/star/configuration/backend/XLayer.hpp" -#include "com/sun/star/configuration/backend/XLayerContentDescriber.hpp" -#include "com/sun/star/configuration/backend/XSingleLayerStratum.hpp" -#include "com/sun/star/connection/ConnectionSetupException.hpp" -#include "com/sun/star/container/NoSuchElementException.hpp" -#include "com/sun/star/container/XChild.hpp" -#include "com/sun/star/container/XElementAccess.hpp" -#include "com/sun/star/container/XEnumeration.hpp" -#include "com/sun/star/container/XEnumerationAccess.hpp" -#include "com/sun/star/container/XHierarchicalNameAccess.hpp" -#include "com/sun/star/container/XIndexAccess.hpp" -#include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/container/XNameContainer.hpp" -#include "com/sun/star/container/XNameReplace.hpp" -#include "com/sun/star/container/XNamed.hpp" -#include "com/sun/star/container/XSet.hpp" -#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp" -#include "com/sun/star/document/EventObject.hpp" -#include "com/sun/star/document/XEventBroadcaster.hpp" -#include "com/sun/star/document/XEventListener.hpp" -#include "com/sun/star/form/FormButtonType.hpp" -#include "com/sun/star/form/FormComponentType.hpp" -#include "com/sun/star/form/FormSubmitEncoding.hpp" -#include "com/sun/star/form/ListSourceType.hpp" -#include "com/sun/star/form/XBoundComponent.hpp" -#include "com/sun/star/form/XConfirmDeleteListener.hpp" -#include "com/sun/star/form/XForm.hpp" -#include "com/sun/star/form/XFormController.hpp" -#include "com/sun/star/form/XFormsSupplier.hpp" -#include "com/sun/star/form/XGridColumnFactory.hpp" -#include "com/sun/star/form/XLoadListener.hpp" -#include "com/sun/star/form/XLoadable.hpp" -#include "com/sun/star/form/binding/XBindableValue.hpp" -#include "com/sun/star/form/binding/XListEntrySink.hpp" -#include "com/sun/star/form/binding/XListEntrySource.hpp" -#include "com/sun/star/form/binding/XValueBinding.hpp" -#include "com/sun/star/form/submission/XSubmissionSupplier.hpp" -#include "com/sun/star/frame/CommandGroup.hpp" -#include "com/sun/star/frame/DispatchResultEvent.hpp" -#include "com/sun/star/frame/DispatchResultState.hpp" -#include "com/sun/star/frame/FrameAction.hpp" -#include "com/sun/star/frame/FrameActionEvent.hpp" -#include "com/sun/star/frame/FrameSearchFlag.hpp" -#include "com/sun/star/frame/XComponentLoader.hpp" -#include "com/sun/star/frame/XController.hpp" -#include "com/sun/star/frame/XDesktop.hpp" -#include "com/sun/star/frame/XDispatch.hpp" -#include "com/sun/star/frame/XDispatchHelper.hpp" -#include "com/sun/star/frame/XDispatchInformationProvider.hpp" -#include "com/sun/star/frame/XDispatchProvider.hpp" -#include "com/sun/star/frame/XDispatchProviderInterception.hpp" -#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp" -#include "com/sun/star/frame/XFrame.hpp" -#include "com/sun/star/frame/XFrameActionListener.hpp" -#include "com/sun/star/frame/XFrameLoader.hpp" -#include "com/sun/star/frame/XFrames.hpp" -#include "com/sun/star/frame/XFramesSupplier.hpp" -#include "com/sun/star/frame/XModel.hpp" -#include "com/sun/star/frame/XStatusListener.hpp" -#include "com/sun/star/frame/XStorable.hpp" -#include "com/sun/star/graphic/XGraphicProvider.hpp" -#include "com/sun/star/inspection/LineDescriptor.hpp" -#include "com/sun/star/inspection/PropertyControlType.hpp" -#include "com/sun/star/inspection/PropertyLineElement.hpp" -#include "com/sun/star/inspection/XHyperlinkControl.hpp" -#include "com/sun/star/inspection/XNumericControl.hpp" -#include "com/sun/star/inspection/XObjectInspector.hpp" -#include "com/sun/star/inspection/XObjectInspectorModel.hpp" -#include "com/sun/star/inspection/XObjectInspectorUI.hpp" -#include "com/sun/star/inspection/XPropertyControl.hpp" -#include "com/sun/star/inspection/XPropertyControlFactory.hpp" -#include "com/sun/star/inspection/XPropertyHandler.hpp" -#include "com/sun/star/inspection/XStringListControl.hpp" -#include "com/sun/star/installation/ProtDlgRes.hpp" -#include "com/sun/star/installation/XProtocolHandlerCheck.hpp" -#include "com/sun/star/installation/protocols.hpp" -#include "com/sun/star/io/BufferSizeExceededException.hpp" -#include "com/sun/star/io/IOException.hpp" -#include "com/sun/star/io/NotConnectedException.hpp" -#include "com/sun/star/io/XActiveDataControl.hpp" -#include "com/sun/star/io/XActiveDataSink.hpp" -#include "com/sun/star/io/XActiveDataSource.hpp" -#include "com/sun/star/io/XConnectable.hpp" -#include "com/sun/star/io/XDataInputStream.hpp" -#include "com/sun/star/io/XDataOutputStream.hpp" -#include "com/sun/star/io/XInputStream.hpp" -#include "com/sun/star/io/XMarkableStream.hpp" -#include "com/sun/star/io/XObjectInputStream.hpp" -#include "com/sun/star/io/XObjectOutputStream.hpp" -#include "com/sun/star/io/XOutputStream.hpp" -#include "com/sun/star/io/XPersistObject.hpp" -#include "com/sun/star/io/XSeekable.hpp" -#include "com/sun/star/io/XStreamListener.hpp" -#include "com/sun/star/io/XXMLExtractor.hpp" -#include "com/sun/star/lang/DisposedException.hpp" -#include "com/sun/star/lang/EventObject.hpp" -#include "com/sun/star/lang/IllegalArgumentException.hpp" -#include "com/sun/star/lang/IndexOutOfBoundsException.hpp" -#include "com/sun/star/lang/NullPointerException.hpp" -#include "com/sun/star/lang/ServiceNotRegisteredException.hpp" -#include "com/sun/star/lang/SystemDependent.hpp" -#include "com/sun/star/lang/WrappedTargetException.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/XLocalizable.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XServiceName.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/ldap/LdapConnectionException.hpp" -#include "com/sun/star/ldap/LdapGenericException.hpp" -#include "com/sun/star/loader/CannotActivateFactoryException.hpp" -#include "com/sun/star/loader/XImplementationLoader.hpp" -#include "com/sun/star/plugin/PluginDescription.hpp" -#include "com/sun/star/plugin/PluginException.hpp" -#include "com/sun/star/plugin/PluginMode.hpp" -#include "com/sun/star/plugin/PluginVariable.hpp" -#include "com/sun/star/plugin/XPlugin.hpp" -#include "com/sun/star/plugin/XPluginContext.hpp" -#include "com/sun/star/plugin/XPluginManager.hpp" -#include "com/sun/star/reflection/InvocationTargetException.hpp" -#include "com/sun/star/reflection/ParamInfo.hpp" -#include "com/sun/star/reflection/XEnumTypeDescription.hpp" -#include "com/sun/star/reflection/XIdlReflection.hpp" -#include "com/sun/star/registry/InvalidRegistryException.hpp" -#include "com/sun/star/registry/InvalidValueException.hpp" -#include "com/sun/star/registry/RegistryKeyType.hpp" -#include "com/sun/star/registry/RegistryValueType.hpp" -#include "com/sun/star/registry/XRegistryKey.hpp" -#include "com/sun/star/registry/XSimpleRegistry.hpp" -#include "com/sun/star/resource/XResourceBundleLoader.hpp" -#include "com/sun/star/scanner/ScannerException.hpp" -#include "com/sun/star/scanner/XScannerManager.hpp" -#include "com/sun/star/script/ContextInformation.hpp" -#include "com/sun/star/script/FailReason.hpp" -#include "com/sun/star/script/FinishEngineEvent.hpp" -#include "com/sun/star/script/FinishReason.hpp" -#include "com/sun/star/script/InterruptEngineEvent.hpp" -#include "com/sun/star/script/InterruptReason.hpp" -#include "com/sun/star/script/InvocationInfo.hpp" -#include "com/sun/star/script/MemberType.hpp" -#include "com/sun/star/script/ScriptEventDescriptor.hpp" -#include "com/sun/star/script/XDebugging.hpp" -#include "com/sun/star/script/XEngine.hpp" -#include "com/sun/star/script/XEngineListener.hpp" -#include "com/sun/star/script/XEventAttacherManager.hpp" -#include "com/sun/star/script/XInvocation.hpp" -#include "com/sun/star/script/XInvocation2.hpp" -#include "com/sun/star/script/XInvocationAdapterFactory.hpp" -#include "com/sun/star/script/XInvocationAdapterFactory2.hpp" -#include "com/sun/star/script/XLibraryAccess.hpp" -#include "com/sun/star/script/XScriptEventsSupplier.hpp" -#include "com/sun/star/script/XTypeConverter.hpp" -#include "com/sun/star/sdb/CommandType.hpp" -#include "com/sun/star/sdb/RowChangeAction.hpp" -#include "com/sun/star/sdb/SQLContext.hpp" -#include "com/sun/star/sdb/XColumn.hpp" -#include "com/sun/star/sdb/XCompletedConnection.hpp" -#include "com/sun/star/sdb/XDatabaseEnvironment.hpp" -#include "com/sun/star/sdb/XDocumentDataSource.hpp" -#include "com/sun/star/sdb/XQueriesSupplier.hpp" -#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp" -#include "com/sun/star/sdbc/DataType.hpp" -#include "com/sun/star/sdbc/ResultSetConcurrency.hpp" -#include "com/sun/star/sdbc/ResultSetType.hpp" -#include "com/sun/star/sdbc/SQLWarning.hpp" -#include "com/sun/star/sdbc/XConnection.hpp" -#include "com/sun/star/sdbc/XDataSource.hpp" -#include "com/sun/star/sdbc/XDatabaseMetaData.hpp" -#include "com/sun/star/sdbc/XDriverAccess.hpp" -#include "com/sun/star/sdbc/XPreparedStatement.hpp" -#include "com/sun/star/sdbc/XResultSet.hpp" -#include "com/sun/star/sdbc/XResultSetUpdate.hpp" -#include "com/sun/star/sdbc/XRowSet.hpp" -#include "com/sun/star/sdbc/XRowSetListener.hpp" -#include "com/sun/star/sdbcx/KeyType.hpp" -#include "com/sun/star/sdbcx/Privilege.hpp" -#include "com/sun/star/sdbcx/XColumnsSupplier.hpp" -#include "com/sun/star/sdbcx/XKeysSupplier.hpp" -#include "com/sun/star/sdbcx/XRowLocate.hpp" -#include "com/sun/star/sdbcx/XTablesSupplier.hpp" -#include "com/sun/star/sheet/XSpreadsheetDocument.hpp" -#include "com/sun/star/sheet/XSpreadsheetView.hpp" -#include "com/sun/star/svg/XSVGPrinter.hpp" -#include "com/sun/star/svg/XSVGWriter.hpp" -#include "com/sun/star/system/SystemShellExecuteException.hpp" -#include "com/sun/star/system/SystemShellExecuteFlags.hpp" -#include "com/sun/star/system/XSystemShellExecute.hpp" -#include "com/sun/star/table/CellAddress.hpp" -#include "com/sun/star/table/CellRangeAddress.hpp" -#include "com/sun/star/table/XCellRange.hpp" -#include "com/sun/star/task/XInteractionAbort.hpp" -#include "com/sun/star/task/XInteractionApprove.hpp" -#include "com/sun/star/task/XInteractionContinuation.hpp" -#include "com/sun/star/task/XInteractionDisapprove.hpp" -#include "com/sun/star/task/XInteractionHandler.hpp" -#include "com/sun/star/task/XInteractionRequest.hpp" -#include "com/sun/star/task/XInteractionRetry.hpp" -#include "com/sun/star/task/XJob.hpp" -#include "com/sun/star/text/BibliographyDataField.hpp" -#include "com/sun/star/text/TextContentAnchorType.hpp" -#include "com/sun/star/ucb/AlreadyInitializedException.hpp" -#include "com/sun/star/ucb/Command.hpp" -#include "com/sun/star/ucb/CommandAbortedException.hpp" -#include "com/sun/star/ucb/ContentEvent.hpp" -#include "com/sun/star/ucb/IOErrorCode.hpp" -#include "com/sun/star/ucb/IllegalIdentifierException.hpp" -#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" -#include "com/sun/star/ucb/InteractiveWrongMediumException.hpp" -#include "com/sun/star/ucb/PostCommandArgument.hpp" -#include "com/sun/star/ucb/PostCommandArgument2.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/ucb/XCommandInfo.hpp" -#include "com/sun/star/ucb/XCommandProcessor.hpp" -#include "com/sun/star/ucb/XCommandProcessor2.hpp" -#include "com/sun/star/ucb/XContent.hpp" -#include "com/sun/star/ucb/XContentAccess.hpp" -#include "com/sun/star/ucb/XContentEventListener.hpp" -#include "com/sun/star/ucb/XContentIdentifier.hpp" -#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" -#include "com/sun/star/ucb/XContentProvider.hpp" -#include "com/sun/star/ucb/XProgressHandler.hpp" -#include "com/sun/star/ucb/XSimpleFileAccess.hpp" -#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp" -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" -#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp" -#include "com/sun/star/uno/Any.h" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.h" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.h" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/Type.h" -#include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/TypeClass.hpp" -#include "com/sun/star/uno/XAdapter.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "com/sun/star/uno/XNamingService.hpp" -#include "com/sun/star/uno/XReference.hpp" -#include "com/sun/star/uno/genfunc.h" -#include "com/sun/star/util/AliasProgrammaticPair.hpp" -#include "com/sun/star/util/ChangesSet.hpp" -#include "com/sun/star/util/Color.hpp" -#include "com/sun/star/util/Date.hpp" -#include "com/sun/star/util/DateTime.hpp" -#include "com/sun/star/util/ElementChange.hpp" -#include "com/sun/star/util/MeasureUnit.hpp" -#include "com/sun/star/util/NumberFormat.hpp" -#include "com/sun/star/util/Time.hpp" -#include "com/sun/star/util/URL.hpp" -#include "com/sun/star/util/XArchiver.hpp" -#include "com/sun/star/util/XChangesBatch.hpp" -#include "com/sun/star/util/XChangesListener.hpp" -#include "com/sun/star/util/XChangesNotifier.hpp" -#include "com/sun/star/util/XCloseBroadcaster.hpp" -#include "com/sun/star/util/XCloseListener.hpp" -#include "com/sun/star/util/XCloseable.hpp" -#include "com/sun/star/util/XLocalizedAliases.hpp" -#include "com/sun/star/util/XModifiable.hpp" -#include "com/sun/star/util/XNumberFormatTypes.hpp" -#include "com/sun/star/util/XNumberFormatsSupplier.hpp" -#include "com/sun/star/util/XTimeStamped.hpp" -#include "com/sun/star/util/XURLTransformer.hpp" -#include "com/sun/star/view/XSelectionSupplier.hpp" -#include "com/sun/star/xforms/XDataTypeRepository.hpp" -#include "com/sun/star/xforms/XFormsSupplier.hpp" -#include "com/sun/star/xforms/XFormsUIHelper1.hpp" -#include "com/sun/star/xforms/XModel.hpp" -#include "com/sun/star/xforms/XSubmission.hpp" -#include "com/sun/star/xml/sax/XDocumentHandler.hpp" -#include "com/sun/star/xml/sax/XExtendedDocumentHandler.hpp" -#include "com/sun/star/xsd/DataTypeClass.hpp" -#include "com/sun/star/xsd/WhiteSpaceTreatment.hpp" -#include "com/sun/star/xsd/XDataType.hpp" - -#include "comphelper/broadcasthelper.hxx" -#include "comphelper/container.hxx" -#include "comphelper/documentconstants.hxx" -#include "comphelper/interaction.hxx" -#include "comphelper/listenernotification.hxx" -#include "comphelper/namedvaluecollection.hxx" -#include "comphelper/processfactory.hxx" -#include "comphelper/sequence.hxx" -#include "comphelper/types.hxx" -#include "comphelper/uno3.hxx" - -#include "connectivity/dbconversion.hxx" -#include "connectivity/dbexception.hxx" - -#include "cppu/macros.hxx" -#include "cppu/unotype.hxx" - -#include "cppuhelper/bootstrap.hxx" -#include "cppuhelper/compbase1.hxx" -#include "cppuhelper/component_context.hxx" -#include "cppuhelper/exc_hlp.hxx" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/implbase2.hxx" -#include "cppuhelper/implbase3.hxx" -#include "cppuhelper/implbase4.hxx" -#include "cppuhelper/implbase5.hxx" -#include "cppuhelper/implbase7.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/interfacecontainer.h" -#include "cppuhelper/interfacecontainer.hxx" -#include "cppuhelper/propshlp.hxx" -#include "cppuhelper/servicefactory.hxx" -#include "cppuhelper/typeprovider.hxx" -#include "cppuhelper/weak.hxx" -#include "cppuhelper/weakagg.hxx" -#include "cppuhelper/weakref.hxx" - -#include "i18npool/mslangid.hxx" - -#include "osl/conditn.h" -#include "osl/conditn.hxx" -#include "osl/diagnose.h" -#include "osl/doublecheckedlocking.h" -#include "osl/file.hxx" -#include "osl/getglobalmutex.hxx" -#include "osl/interlck.h" -#include "osl/module.h" -#include "osl/nlsupport.h" -#include "osl/pipe.hxx" -#include "osl/process.h" -#include "osl/security.hxx" -#include "osl/thread.h" -#include "osl/time.h" - -#include "rtl/alloc.h" -#include "rtl/bootstrap.hxx" -#include "rtl/byteseq.h" -#include "rtl/instance.hxx" -#include "rtl/locale.h" -#include "rtl/math.hxx" -#include "rtl/memory.h" -#include "rtl/process.h" -#include "rtl/ref.hxx" -#include "rtl/strbuf.hxx" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textenc.h" -#include "rtl/unload.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.hxx" -#include "rtl/uuid.h" - -#include "salhelper/simplereferenceobject.hxx" -#include "salhelper/timer.hxx" - -#include "sane/sane.h" - -#include "svl/filenotation.hxx" -#include "svtools/imgdef.hxx" -#include "svtools/miscopt.hxx" -#include "unotools/moduleoptions.hxx" -#include "svl/numuno.hxx" - -#include "svx/flagsdef.hxx" - -#include "sys/stat.h" -#include "sys/types.h" - -#include "tools/diagnose_ex.h" - -#include "typelib/typeclass.h" -#include "typelib/typedescription.h" -#include "typelib/typedescription.hxx" - -#include "uno/dispatcher.h" -#include "uno/environment.h" -#include "uno/lbnames.h" - -#include "unotools/configitem.hxx" -#include "unotools/confignode.hxx" -#include "unotools/processfactory.hxx" - -#include "tools/fldunit.hxx" - -#include "osl/module.hxx" -#include "osl/mutex.hxx" - -#include "xmloff/nmspmap.hxx" -//---MARKER--- - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/inc/propctrlr.hrc b/extensions/inc/propctrlr.hrc deleted file mode 100644 index a8d202406..000000000 --- a/extensions/inc/propctrlr.hrc +++ /dev/null @@ -1,331 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_PROPCTRLR_HRC -#define EXTENSIONS_PROPCTRLR_HRC - -#define UID_PROP_DLG_FONT_TYPE "EXTENSIONS_UID_PROP_DLG_FONT_TYPE" -#define UID_PROP_DLG_IMAGE_URL "EXTENSIONS_UID_PROP_DLG_IMAGE_URL" -#define UID_PROP_DLG_BACKGROUNDCOLOR "EXTENSIONS_UID_PROP_DLG_BACKGROUNDCOLOR" -#define UID_PROP_DLG_SYMBOLCOLOR "EXTENSIONS_UID_PROP_DLG_SYMBOLCOLOR" -#define UID_PROP_DLG_ATTR_DATASOURCE "EXTENSIONS_UID_PROP_DLG_ATTR_DATASOURCE" -#define UID_PROP_DLG_ATTR_TARGET_URL "EXTENSIONS_UID_PROP_DLG_ATTR_TARGET_URL" -#define UID_PROP_DLG_NUMBER_FORMAT "EXTENSIONS_UID_PROP_DLG_NUMBER_FORMAT" -#define UID_PROP_DLG_CONTROLLABEL "EXTENSIONS_UID_PROP_DLG_CONTROLLABEL" -#define UID_PROP_DLG_FILLCOLOR "EXTENSIONS_UID_PROP_DLG_FILLCOLOR" -#define UID_PROP_DLG_TABINDEX "EXTENSIONS_UID_PROP_DLG_TABINDEX" -#define UID_PROP_DLG_SQLCOMMAND "EXTENSIONS_UID_PROP_DLG_SQLCOMMAND" -#define UID_PROP_DLG_FORMLINKFIELDS "EXTENSIONS_UID_PROP_DLG_FORMLINKFIELDS" -#define UID_PROP_DLG_FILTER "EXTENSIONS_UID_PROP_DLG_FILTER" -#define UID_PROP_DLG_ORDER "EXTENSIONS_UID_PROP_DLG_ORDER" -#define UID_PROP_DLG_SELECTION "EXTENSIONS_UID_PROP_DLG_SELECTION" -#define UID_PROP_DLG_BIND_EXPRESSION "EXTENSIONS_UID_PROP_DLG_BIND_EXPRESSION" -#define UID_PROP_DLG_XSD_REQUIRED "EXTENSIONS_UID_PROP_DLG_XSD_REQUIRED" -#define UID_PROP_DLG_XSD_RELEVANT "EXTENSIONS_UID_PROP_DLG_XSD_RELEVANT" -#define UID_PROP_DLG_XSD_READONLY "EXTENSIONS_UID_PROP_DLG_XSD_READONLY" -#define UID_PROP_DLG_XSD_CONSTRAINT "EXTENSIONS_UID_PROP_DLG_XSD_CONSTRAINT" -#define UID_PROP_DLG_XSD_CALCULATION "EXTENSIONS_UID_PROP_DLG_XSD_CALCULATION" -#define UID_PROP_ADD_DATA_TYPE "EXTENSIONS_UID_PROP_ADD_DATA_TYPE" -#define UID_PROP_REMOVE_DATA_TYPE "EXTENSIONS_UID_PROP_REMOVE_DATA_TYPE" -#define UID_PROP_DLG_BORDERCOLOR "EXTENSIONS_UID_PROP_DLG_BORDERCOLOR" - -#define UID_BRWEVT_APPROVEACTIONPERFORMED "EXTENSIONS_UID_BRWEVT_APPROVEACTIONPERFORMED" -#define UID_BRWEVT_ACTIONPERFORMED "EXTENSIONS_UID_BRWEVT_ACTIONPERFORMED" -#define UID_BRWEVT_CHANGED "EXTENSIONS_UID_BRWEVT_CHANGED" -#define UID_BRWEVT_TEXTCHANGED "EXTENSIONS_UID_BRWEVT_TEXTCHANGED" -#define UID_BRWEVT_ITEMSTATECHANGED "EXTENSIONS_UID_BRWEVT_ITEMSTATECHANGED" -#define UID_BRWEVT_FOCUSGAINED "EXTENSIONS_UID_BRWEVT_FOCUSGAINED" -#define UID_BRWEVT_FOCUSLOST "EXTENSIONS_UID_BRWEVT_FOCUSLOST" -#define UID_BRWEVT_KEYTYPED "EXTENSIONS_UID_BRWEVT_KEYTYPED" -#define UID_BRWEVT_KEYUP "EXTENSIONS_UID_BRWEVT_KEYUP" -#define UID_BRWEVT_MOUSEENTERED "EXTENSIONS_UID_BRWEVT_MOUSEENTERED" -#define UID_BRWEVT_MOUSEDRAGGED "EXTENSIONS_UID_BRWEVT_MOUSEDRAGGED" -#define UID_BRWEVT_MOUSEMOVED "EXTENSIONS_UID_BRWEVT_MOUSEMOVED" -#define UID_BRWEVT_MOUSEPRESSED "EXTENSIONS_UID_BRWEVT_MOUSEPRESSED" -#define UID_BRWEVT_MOUSERELEASED "EXTENSIONS_UID_BRWEVT_MOUSERELEASED" -#define UID_BRWEVT_MOUSEEXITED "EXTENSIONS_UID_BRWEVT_MOUSEEXITED" -#define UID_BRWEVT_APPROVERESETTED "EXTENSIONS_UID_BRWEVT_APPROVERESETTED" -#define UID_BRWEVT_RESETTED "EXTENSIONS_UID_BRWEVT_RESETTED" -#define UID_BRWEVT_SUBMITTED "EXTENSIONS_UID_BRWEVT_SUBMITTED" -#define UID_BRWEVT_BEFOREUPDATE "EXTENSIONS_UID_BRWEVT_BEFOREUPDATE" -#define UID_BRWEVT_AFTERUPDATE "EXTENSIONS_UID_BRWEVT_AFTERUPDATE" -#define UID_BRWEVT_LOADED "EXTENSIONS_UID_BRWEVT_LOADED" -#define UID_BRWEVT_RELOADING "EXTENSIONS_UID_BRWEVT_RELOADING" -#define UID_BRWEVT_RELOADED "EXTENSIONS_UID_BRWEVT_RELOADED" -#define UID_BRWEVT_UNLOADING "EXTENSIONS_UID_BRWEVT_UNLOADING" -#define UID_BRWEVT_UNLOADED "EXTENSIONS_UID_BRWEVT_UNLOADED" -#define UID_BRWEVT_CONFIRMDELETE "EXTENSIONS_UID_BRWEVT_CONFIRMDELETE" -#define UID_BRWEVT_APPROVEROWCHANGE "EXTENSIONS_UID_BRWEVT_APPROVEROWCHANGE" -#define UID_BRWEVT_ROWCHANGE "EXTENSIONS_UID_BRWEVT_ROWCHANGE" -#define UID_BRWEVT_POSITIONING "EXTENSIONS_UID_BRWEVT_POSITIONING" -#define UID_BRWEVT_POSITIONED "EXTENSIONS_UID_BRWEVT_POSITIONED" -#define UID_BRWEVT_APPROVEPARAMETER "EXTENSIONS_UID_BRWEVT_APPROVEPARAMETER" -#define UID_BRWEVT_ERROROCCURRED "EXTENSIONS_UID_BRWEVT_ERROROCCURRED" -#define UID_BRWEVT_ADJUSTMENTVALUECHANGED "EXTENSIONS_UID_BRWEVT_ADJUSTMENTVALUECHANGED" - -#define HID_PROP_INPUT_REQUIRED "EXTENSIONS_HID_PROP_INPUT_REQUIRED" -#define HID_PROP_GROUPBOX "EXTENSIONS_HID_PROP_GROUPBOX" -#define HID_PROP_CONTROLSOURCE "EXTENSIONS_HID_PROP_CONTROLSOURCE" -#define HID_PROP_NAME "EXTENSIONS_HID_PROP_NAME" -#define HID_PROP_TABINDEX "EXTENSIONS_HID_PROP_TABINDEX" -#define HID_PROP_MASTERFIELDS "EXTENSIONS_HID_PROP_MASTERFIELDS" -#define HID_PROP_SLAVEFIELDS "EXTENSIONS_HID_PROP_SLAVEFIELDS" -#define HID_PROP_DATASOURCE "EXTENSIONS_HID_PROP_DATASOURCE" -#define HID_PROP_CURSORSOURCE "EXTENSIONS_HID_PROP_CURSORSOURCE" -#define HID_PROP_CURSORSOURCETYPE "EXTENSIONS_HID_PROP_CURSORSOURCETYPE" -#define HID_PROP_CURSORTYPE "EXTENSIONS_HID_PROP_CURSORTYPE" -#define HID_PROP_READONLY "EXTENSIONS_HID_PROP_READONLY" -#define HID_PROP_DATAENTRY "EXTENSIONS_HID_PROP_DATAENTRY" -#define HID_PROP_NAVIGATION "EXTENSIONS_HID_PROP_NAVIGATION" -#define HID_PROP_CYCLE "EXTENSIONS_HID_PROP_CYCLE" -#define HID_PROP_ALLOW_ADDITIONS "EXTENSIONS_HID_PROP_ALLOW_ADDITIONS" -#define HID_PROP_ALLOW_EDITS "EXTENSIONS_HID_PROP_ALLOW_EDITS" -#define HID_PROP_ALLOW_DELETIONS "EXTENSIONS_HID_PROP_ALLOW_DELETIONS" -#define HID_PROP_DIRTY "EXTENSIONS_HID_PROP_DIRTY" -#define HID_PROP_OLDVALUE "EXTENSIONS_HID_PROP_OLDVALUE" -#define HID_PROP_VALUE "EXTENSIONS_HID_PROP_VALUE" -#define HID_PROP_LOCKED "EXTENSIONS_HID_PROP_LOCKED" -#define HID_PROP_FORMATKEY "EXTENSIONS_HID_PROP_FORMATKEY" -#define HID_PROP_REQUIRED "EXTENSIONS_HID_PROP_REQUIRED" -#define HID_PROP_WHEEL_BEHAVIOR "EXTENSIONS_HID_PROP_WHEEL_BEHAVIOR" -#define HID_PROP_UNIQUE "EXTENSIONS_HID_PROP_UNIQUE" -#define HID_PROP_CLASSID "EXTENSIONS_HID_PROP_CLASSID" -#define HID_PROP_LEFT "EXTENSIONS_HID_PROP_LEFT" -#define HID_PROP_RIGHT "EXTENSIONS_HID_PROP_RIGHT" -#define HID_PROP_HEIGHT "EXTENSIONS_HID_PROP_HEIGHT" -#define HID_PROP_WIDTH "EXTENSIONS_HID_PROP_WIDTH" -#define HID_PROP_BOUNDCOLUMN "EXTENSIONS_HID_PROP_BOUNDCOLUMN" -#define HID_PROP_LISTSOURCETYPE "EXTENSIONS_HID_PROP_LISTSOURCETYPE" -#define HID_PROP_LISTSOURCE "EXTENSIONS_HID_PROP_LISTSOURCE" -#define HID_PROP_LISTINDEX "EXTENSIONS_HID_PROP_LISTINDEX" -#define HID_PROP_TEXT "EXTENSIONS_HID_PROP_TEXT" -#define HID_PROP_LABEL "EXTENSIONS_HID_PROP_LABEL" -#define HID_PROP_STRINGITEMLIST "EXTENSIONS_HID_PROP_STRINGITEMLIST" -#define HID_PROP_SEARCHING "EXTENSIONS_HID_PROP_SEARCHING" -#define HID_PROP_FONT "EXTENSIONS_HID_PROP_FONT" -#define HID_PROP_ROWHEIGHT "EXTENSIONS_HID_PROP_ROWHEIGHT" -#define HID_PROP_BACKGROUNDCOLOR "EXTENSIONS_HID_PROP_BACKGROUNDCOLOR" -#define HID_PROP_FILLCOLOR "EXTENSIONS_HID_PROP_FILLCOLOR" -#define HID_PROP_LINECOLOR "EXTENSIONS_HID_PROP_LINECOLOR" -#define HID_PROP_BORDER "EXTENSIONS_HID_PROP_BORDER" -#define HID_PROP_ALIGN "EXTENSIONS_HID_PROP_ALIGN" -#define HID_PROP_DROPDOWN "EXTENSIONS_HID_PROP_DROPDOWN" -#define HID_PROP_MULTILINE "EXTENSIONS_HID_PROP_MULTILINE" -#define HID_PROP_HSCROLL "EXTENSIONS_HID_PROP_HSCROLL" -#define HID_PROP_VSCROLL "EXTENSIONS_HID_PROP_VSCROLL" -#define HID_PROP_TABSTOP "EXTENSIONS_HID_PROP_TABSTOP" -#define HID_PROP_REFVALUE "EXTENSIONS_HID_PROP_REFVALUE" -#define HID_PROP_BUTTONTYPE "EXTENSIONS_HID_PROP_BUTTONTYPE" -#define HID_PROP_SUBMIT_ACTION "EXTENSIONS_HID_PROP_SUBMIT_ACTION" -#define HID_PROP_SUBMIT_METHOD "EXTENSIONS_HID_PROP_SUBMIT_METHOD" -#define HID_PROP_SUBMIT_ENCODING "EXTENSIONS_HID_PROP_SUBMIT_ENCODING" -#define HID_PROP_DEFAULTVALUE "EXTENSIONS_HID_PROP_DEFAULTVALUE" -#define HID_PROP_SUBMIT_TARGET "EXTENSIONS_HID_PROP_SUBMIT_TARGET" -#define HID_PROP_DEFAULT_STATE "EXTENSIONS_HID_PROP_DEFAULT_STATE" -#define HID_PROP_IMAGE_URL "EXTENSIONS_HID_PROP_IMAGE_URL" -#define HID_PROP_DEFAULT_SELECT_SEQ "EXTENSIONS_HID_PROP_DEFAULT_SELECT_SEQ" -#define HID_PROP_MULTISELECTION "EXTENSIONS_HID_PROP_MULTISELECTION" -#define HID_PROP_DATE "EXTENSIONS_HID_PROP_DATE" -#define HID_PROP_DATEMIN "EXTENSIONS_HID_PROP_DATEMIN" -#define HID_PROP_DATEMAX "EXTENSIONS_HID_PROP_DATEMAX" -#define HID_PROP_DATEFORMAT "EXTENSIONS_HID_PROP_DATEFORMAT" -#define HID_PROP_TIME "EXTENSIONS_HID_PROP_TIME" -#define HID_PROP_TIMEMIN "EXTENSIONS_HID_PROP_TIMEMIN" -#define HID_PROP_TIMEMAX "EXTENSIONS_HID_PROP_TIMEMAX" -#define HID_PROP_TIMEFORMAT "EXTENSIONS_HID_PROP_TIMEFORMAT" -#define HID_PROP_VALUEMIN "EXTENSIONS_HID_PROP_VALUEMIN" -#define HID_PROP_VALUEMAX "EXTENSIONS_HID_PROP_VALUEMAX" -#define HID_PROP_VALUESTEP "EXTENSIONS_HID_PROP_VALUESTEP" -#define HID_PROP_CURRENCYSYMBOL "EXTENSIONS_HID_PROP_CURRENCYSYMBOL" -#define HID_PROP_EDITMASK "EXTENSIONS_HID_PROP_EDITMASK" -#define HID_PROP_LITERALMASK "EXTENSIONS_HID_PROP_LITERALMASK" -#define HID_PROP_ENABLED "EXTENSIONS_HID_PROP_ENABLED" -#define HID_PROP_AUTOCOMPLETE "EXTENSIONS_HID_PROP_AUTOCOMPLETE" -#define HID_PROP_LINECOUNT "EXTENSIONS_HID_PROP_LINECOUNT" -#define HID_PROP_MAXTEXTLEN "EXTENSIONS_HID_PROP_MAXTEXTLEN" -#define HID_PROP_SPIN "EXTENSIONS_HID_PROP_SPIN" -#define HID_PROP_STRICTFORMAT "EXTENSIONS_HID_PROP_STRICTFORMAT" -#define HID_PROP_SHOWTHOUSANDSEP "EXTENSIONS_HID_PROP_SHOWTHOUSANDSEP" -#define HID_PROP_VERTICAL_ALIGN "EXTENSIONS_HID_PROP_VERTICAL_ALIGN" -#define HID_PROP_PRINTABLE "EXTENSIONS_HID_PROP_PRINTABLE" -#define HID_PROP_TARGET_URL "EXTENSIONS_HID_PROP_TARGET_URL" -#define HID_PROP_TARGET_FRAME "EXTENSIONS_HID_PROP_TARGET_FRAME" -#define HID_PROP_TAG "EXTENSIONS_HID_PROP_TAG" -#define HID_PROP_ECHO_CHAR "EXTENSIONS_HID_PROP_ECHO_CHAR" -#define HID_PROP_EMPTY_IS_NULL "EXTENSIONS_HID_PROP_EMPTY_IS_NULL" -#define HID_PROP_DECIMAL_ACCURACY "EXTENSIONS_HID_PROP_DECIMAL_ACCURACY" -#define HID_PROP_ENABLE_VISIBLE "EXTENSIONS_HID_PROP_ENABLE_VISIBLE" -#define HID_PROP_DEFAULT_BUTTON "EXTENSIONS_HID_PROP_DEFAULT_BUTTON" -#define HID_PROP_HIDDEN_VALUE "EXTENSIONS_HID_PROP_HIDDEN_VALUE" -#define HID_PROP_TRISTATE "EXTENSIONS_HID_PROP_TRISTATE" -#define HID_PROP_NAVIGATIONBAR "EXTENSIONS_HID_PROP_NAVIGATIONBAR" -#define HID_PROP_FILTER "EXTENSIONS_HID_PROP_FILTER" -#define HID_PROP_SORT_CRITERIA "EXTENSIONS_HID_PROP_SORT_CRITERIA" -#define HID_PROP_DEFAULT_LONG_VALUE "EXTENSIONS_HID_PROP_DEFAULT_LONG_VALUE" -#define HID_PROP_DEFAULT_TIME "EXTENSIONS_HID_PROP_DEFAULT_TIME" -#define HID_PROP_DEFAULT_DATE "EXTENSIONS_HID_PROP_DEFAULT_DATE" -#define HID_PROP_HELPTEXT "EXTENSIONS_HID_PROP_HELPTEXT" -#define HID_PROP_HELPURL "EXTENSIONS_HID_PROP_HELPURL" -#define HID_PROP_RECORDMARKER "EXTENSIONS_HID_PROP_RECORDMARKER" -#define HID_PROP_FILTERPROPOSAL "EXTENSIONS_HID_PROP_FILTERPROPOSAL" -#define HID_PROP_EFFECTIVEMIN "EXTENSIONS_HID_PROP_EFFECTIVEMIN" -#define HID_PROP_EFFECTIVEMAX "EXTENSIONS_HID_PROP_EFFECTIVEMAX" -#define HID_PROP_EFFECTIVEDEFAULT "EXTENSIONS_HID_PROP_EFFECTIVEDEFAULT" -#define HID_PROP_CONTROLLABEL "EXTENSIONS_HID_PROP_CONTROLLABEL" -#define HID_PROP_CURRSYM_POSITION "EXTENSIONS_HID_PROP_CURRSYM_POSITION" -#define HID_PROP_ESCAPE_PROCESSING "EXTENSIONS_HID_PROP_ESCAPE_PROCESSING" -#define HID_PROP_TITLE "EXTENSIONS_HID_PROP_TITLE" -#define HID_PROP_STEP "EXTENSIONS_HID_PROP_STEP" -#define HID_PROP_PROGRESSVALUE "EXTENSIONS_HID_PROP_PROGRESSVALUE" -#define HID_PROP_PROGRESSVALUE_MIN "EXTENSIONS_HID_PROP_PROGRESSVALUE_MIN" -#define HID_PROP_PROGRESSVALUE_MAX "EXTENSIONS_HID_PROP_PROGRESSVALUE_MAX" -#define HID_PROP_SCROLLVALUE "EXTENSIONS_HID_PROP_SCROLLVALUE" -#define HID_PROP_SCROLLVALUE_MAX "EXTENSIONS_HID_PROP_SCROLLVALUE_MAX" -#define HID_PROP_LINEINCREMENT "EXTENSIONS_HID_PROP_LINEINCREMENT" -#define HID_PROP_BLOCKINCREMENT "EXTENSIONS_HID_PROP_BLOCKINCREMENT" -#define HID_PROP_VISIBLESIZE "EXTENSIONS_HID_PROP_VISIBLESIZE" -#define HID_PROP_ORIENTATION "EXTENSIONS_HID_PROP_ORIENTATION" -#define HID_PROP_POSITIONX "EXTENSIONS_HID_PROP_POSITIONX" -#define HID_PROP_POSITIONY "EXTENSIONS_HID_PROP_POSITIONY" -#define HID_PROP_PUSHBUTTONTYPE "EXTENSIONS_HID_PROP_PUSHBUTTONTYPE" -#define HID_PROP_STATE "EXTENSIONS_HID_PROP_STATE" -#define HID_PROP_SCALEIMAGE "EXTENSIONS_HID_PROP_SCALEIMAGE" -#define HID_PROP_BOUND_CELL "EXTENSIONS_HID_PROP_BOUND_CELL" -#define HID_PROP_LIST_CELL_RANGE "EXTENSIONS_HID_PROP_LIST_CELL_RANGE" -#define HID_PROP_CELL_EXCHANGE_TYPE "EXTENSIONS_HID_PROP_CELL_EXCHANGE_TYPE" -#define HID_PROP_SELECTEDITEMS "EXTENSIONS_HID_PROP_SELECTEDITEMS" -#define HID_PROP_SCROLLVALUE_MIN "EXTENSIONS_HID_PROP_SCROLLVALUE_MIN" -#define HID_PROP_DEFAULT_SCROLLVALUE "EXTENSIONS_HID_PROP_DEFAULT_SCROLLVALUE" -#define HID_PROP_REPEAT_DELAY "EXTENSIONS_HID_PROP_REPEAT_DELAY" -#define HID_PROP_SYMBOLCOLOR "EXTENSIONS_HID_PROP_SYMBOLCOLOR" -#define HID_PROP_SPINVALUE "EXTENSIONS_HID_PROP_SPINVALUE" -#define HID_PROP_SPINVALUE_MIN "EXTENSIONS_HID_PROP_SPINVALUE_MIN" -#define HID_PROP_SPINVALUE_MAX "EXTENSIONS_HID_PROP_SPINVALUE_MAX" -#define HID_PROP_DEFAULT_SPINVALUE "EXTENSIONS_HID_PROP_DEFAULT_SPINVALUE" -#define HID_PROP_SPININCREMENT "EXTENSIONS_HID_PROP_SPININCREMENT" -#define HID_PROP_REPEAT "EXTENSIONS_HID_PROP_REPEAT" -#define HID_PROP_WORDBREAK "EXTENSIONS_HID_PROP_WORDBREAK" -#define HID_PROP_SHOW_SCROLLBARS "EXTENSIONS_HID_PROP_SHOW_SCROLLBARS" -#define HID_PROP_TABORDER_CONTROLS "EXTENSIONS_HID_PROP_TABORDER_CONTROLS" -#define HID_FIELDLINK_DETAIL_COLUMN "EXTENSIONS_HID_FIELDLINK_DETAIL_COLUMN" -#define HID_FIELDLINK_MASTER_COLUMN "EXTENSIONS_HID_FIELDLINK_MASTER_COLUMN" -#define UID_FIELDLINK_DETAIL1 "EXTENSIONS_UID_FIELDLINK_DETAIL1" -#define UID_FIELDLINK_MASTER1 "EXTENSIONS_UID_FIELDLINK_MASTER1" -#define UID_FIELDLINK_DETAIL2 "EXTENSIONS_UID_FIELDLINK_DETAIL2" -#define UID_FIELDLINK_MASTER2 "EXTENSIONS_UID_FIELDLINK_MASTER2" -#define UID_FIELDLINK_DETAIL3 "EXTENSIONS_UID_FIELDLINK_DETAIL3" -#define UID_FIELDLINK_MASTER3 "EXTENSIONS_UID_FIELDLINK_MASTER3" -#define UID_FIELDLINK_DETAIL4 "EXTENSIONS_UID_FIELDLINK_DETAIL4" -#define UID_FIELDLINK_MASTER4 "EXTENSIONS_UID_FIELDLINK_MASTER4" -#define HID_PROP_ICONSIZE "EXTENSIONS_HID_PROP_ICONSIZE" -#define HID_PROP_SHOW_POSITION "EXTENSIONS_HID_PROP_SHOW_POSITION" -#define HID_PROP_SHOW_NAVIGATION "EXTENSIONS_HID_PROP_SHOW_NAVIGATION" -#define HID_PROP_SHOW_RECORDACTIONS "EXTENSIONS_HID_PROP_SHOW_RECORDACTIONS" -#define HID_PROP_SHOW_FILTERSORT "EXTENSIONS_HID_PROP_SHOW_FILTERSORT" -#define HID_PROP_AUTOLINEBREAK "EXTENSIONS_HID_PROP_AUTOLINEBREAK" -#define HID_PROP_TEXTTYPE "EXTENSIONS_HID_PROP_TEXTTYPE" -#define HID_PROP_LINEEND_FORMAT "EXTENSIONS_HID_PROP_LINEEND_FORMAT" -#define HID_PROP_XSD_TOTAL_DIGITS "EXTENSIONS_HID_PROP_XSD_TOTAL_DIGITS" -#define HID_PROP_XSD_FRACTION_DIGITS "EXTENSIONS_HID_PROP_XSD_FRACTION_DIGITS" -#define HID_PROP_XSD_MAX_INCLUSIVE "EXTENSIONS_HID_PROP_XSD_MAX_INCLUSIVE" -#define HID_PROP_XSD_MAX_EXCLUSIVE "EXTENSIONS_HID_PROP_XSD_MAX_EXCLUSIVE" -#define HID_PROP_XSD_MIN_INCLUSIVE "EXTENSIONS_HID_PROP_XSD_MIN_INCLUSIVE" -#define HID_PROP_XSD_MIN_EXCLUSIVE "EXTENSIONS_HID_PROP_XSD_MIN_EXCLUSIVE" -#define HID_PROP_UNCHECKEDREFVALUE "EXTENSIONS_HID_PROP_UNCHECKEDREFVALUE" -#define HID_PROP_SUBMISSION_ID "EXTENSIONS_HID_PROP_SUBMISSION_ID" -#define UID_EVT_MACRODLG "EXTENSIONS_UID_EVT_MACRODLG" -#define HID_PROP_XML_DATA_MODEL "EXTENSIONS_HID_PROP_XML_DATA_MODEL" -#define HID_PROP_BIND_EXPRESSION "EXTENSIONS_HID_PROP_BIND_EXPRESSION" -#define HID_PROP_XSD_REQUIRED "EXTENSIONS_HID_PROP_XSD_REQUIRED" -#define HID_PROP_XSD_RELEVANT "EXTENSIONS_HID_PROP_XSD_RELEVANT" -#define HID_PROP_XSD_READONLY "EXTENSIONS_HID_PROP_XSD_READONLY" -#define HID_PROP_XSD_CONSTRAINT "EXTENSIONS_HID_PROP_XSD_CONSTRAINT" -#define HID_PROP_XSD_CALCULATION "EXTENSIONS_HID_PROP_XSD_CALCULATION" -#define HID_PROP_XSD_DATA_TYPE "EXTENSIONS_HID_PROP_XSD_DATA_TYPE" -#define HID_PROP_XSD_WHITESPACES "EXTENSIONS_HID_PROP_XSD_WHITESPACES" -#define HID_PROP_XSD_PATTERN "EXTENSIONS_HID_PROP_XSD_PATTERN" -#define HID_PROP_XSD_LENGTH "EXTENSIONS_HID_PROP_XSD_LENGTH" -#define HID_PROP_XSD_MIN_LENGTH "EXTENSIONS_HID_PROP_XSD_MIN_LENGTH" -#define HID_PROP_XSD_MAX_LENGTH "EXTENSIONS_HID_PROP_XSD_MAX_LENGTH" -#define HID_PROP_LIST_BINDING "EXTENSIONS_HID_PROP_LIST_BINDING" -#define HID_PROP_BINDING_NAME "EXTENSIONS_HID_PROP_BINDING_NAME" -#define HID_PROP_SELECTION_TYPE "EXTENSIONS_HID_PROP_SELECTION_TYPE" -#define HID_PROP_ROOT_DISPLAYED "EXTENSIONS_HID_PROP_ROOT_DISPLAYED" -#define HID_PROP_SHOWS_HANDLES "EXTENSIONS_HID_PROP_SHOWS_HANDLES" -#define HID_PROP_SHOWS_ROOT_HANDLES "EXTENSIONS_HID_PROP_SHOWS_ROOT_HANDLES" -#define HID_PROP_EDITABLE "EXTENSIONS_HID_PROP_EDITABLE" -#define HID_PROP_INVOKES_STOP_NOT_EDITING "EXTENSIONS_HID_PROP_INVOKES_STOP_NOT_EDITING" -#define HID_PROP_ROW_HEIGHT "EXTENSIONS_HID_PROP_ROW_HEIGHT" -#define HID_PROP_DECORATION "EXTENSIONS_HID_PROP_DECORATION" -#define HID_EVT_ACTIONPERFORMED "EXTENSIONS_HID_EVT_ACTIONPERFORMED" -#define HID_EVT_AFTERUPDATE "EXTENSIONS_HID_EVT_AFTERUPDATE" -#define HID_EVT_BEFOREUPDATE "EXTENSIONS_HID_EVT_BEFOREUPDATE" -#define HID_EVT_CONFIRMDELETE "EXTENSIONS_HID_EVT_CONFIRMDELETE" -#define HID_EVT_ERROROCCURRED "EXTENSIONS_HID_EVT_ERROROCCURRED" -#define HID_EVT_FOCUSGAINED "EXTENSIONS_HID_EVT_FOCUSGAINED" -#define HID_EVT_FOCUSLOST "EXTENSIONS_HID_EVT_FOCUSLOST" -#define HID_EVT_ITEMSTATECHANGED "EXTENSIONS_HID_EVT_ITEMSTATECHANGED" -#define HID_EVT_KEYTYPED "EXTENSIONS_HID_EVT_KEYTYPED" -#define HID_EVT_LOADED "EXTENSIONS_HID_EVT_LOADED" -#define HID_EVT_MOUSEDRAGGED "EXTENSIONS_HID_EVT_MOUSEDRAGGED" -#define HID_EVT_MOUSEENTERED "EXTENSIONS_HID_EVT_MOUSEENTERED" -#define HID_EVT_MOUSEEXITED "EXTENSIONS_HID_EVT_MOUSEEXITED" -#define HID_EVT_MOUSEMOVED "EXTENSIONS_HID_EVT_MOUSEMOVED" -#define HID_EVT_MOUSEPRESSED "EXTENSIONS_HID_EVT_MOUSEPRESSED" -#define HID_EVT_MOUSERELEASED "EXTENSIONS_HID_EVT_MOUSERELEASED" -#define HID_EVT_POSITIONED "EXTENSIONS_HID_EVT_POSITIONED" -#define HID_EVT_RESETTED "EXTENSIONS_HID_EVT_RESETTED" -#define HID_EVT_SUBMITTED "EXTENSIONS_HID_EVT_SUBMITTED" -#define HID_EVT_TEXTCHANGED "EXTENSIONS_HID_EVT_TEXTCHANGED" -#define HID_EVT_UNLOADED "EXTENSIONS_HID_EVT_UNLOADED" -#define HID_EVT_CHANGED "EXTENSIONS_HID_EVT_CHANGED" -#define HID_EVT_APPROVEACTIONPERFORMED "EXTENSIONS_HID_EVT_APPROVEACTIONPERFORMED" -#define HID_EVT_APPROVERESETTED "EXTENSIONS_HID_EVT_APPROVERESETTED" -#define HID_EVT_KEYUP "EXTENSIONS_HID_EVT_KEYUP" -#define HID_EVT_APPROVEPARAMETER "EXTENSIONS_HID_EVT_APPROVEPARAMETER" -#define HID_EVT_POSITIONING "EXTENSIONS_HID_EVT_POSITIONING" -#define HID_EVT_RELOADED "EXTENSIONS_HID_EVT_RELOADED" -#define HID_EVT_APPROVEROWCHANGE "EXTENSIONS_HID_EVT_APPROVEROWCHANGE" -#define HID_EVT_ROWCHANGE "EXTENSIONS_HID_EVT_ROWCHANGE" -#define HID_EVT_RELOADING "EXTENSIONS_HID_EVT_RELOADING" -#define HID_EVT_UNLOADING "EXTENSIONS_HID_EVT_UNLOADING" -#define HID_EVT_ADJUSTMENTVALUECHANGED "EXTENSIONS_HID_EVT_ADJUSTMENTVALUECHANGED" -#define HID_PROP_TOGGLE "EXTENSIONS_HID_PROP_TOGGLE" -#define HID_PROP_FOCUSONCLICK "EXTENSIONS_HID_PROP_FOCUSONCLICK" -#define HID_PROP_HIDEINACTIVESELECTION "EXTENSIONS_HID_PROP_HIDEINACTIVESELECTION" -#define HID_PROP_VISUALEFFECT "EXTENSIONS_HID_PROP_VISUALEFFECT" -#define HID_PROP_BORDERCOLOR "EXTENSIONS_HID_PROP_BORDERCOLOR" -#define HID_PROP_IMAGEPOSITION "EXTENSIONS_HID_PROP_IMAGEPOSITION" -#define HID_PROP_NOLABEL "EXTENSIONS_HID_PROP_NOLABEL" -#define HID_PROP_WRITING_MODE "EXTENSIONS_HID_PROP_WRITING_MODE" -#define HID_PROP_ANCHOR_TYPE "EXTENSIONS_HID_PROP_ANCHOR_TYPE" -#define HID_FM_PROPDLG_TABCTR "EXTENSIONS_HID_FM_PROPDLG_TABCTR" -#define HID_FM_PROPDLG_TAB_GENERAL "EXTENSIONS_HID_FM_PROPDLG_TAB_GENERAL" -#define HID_FM_PROPDLG_TAB_DATA "EXTENSIONS_HID_FM_PROPDLG_TAB_DATA" -#define HID_FM_PROPDLG_TAB_EVT "EXTENSIONS_HID_FM_PROPDLG_TAB_EVT" -#define HID_PROP_GROUP_NAME "EXTENSIONS_HID_PROP_GROUP_NAME" - -#endif // EXTENSIONS_PROPCTRLR_HRC diff --git a/extensions/inc/ucbhelper/ext_content.hxx b/extensions/inc/ucbhelper/ext_content.hxx deleted file mode 100644 index c94010585..000000000 --- a/extensions/inc/ucbhelper/ext_content.hxx +++ /dev/null @@ -1,332 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _UCBHELPER_CONTENT_HXX_ -#define _UCBHELPER_CONTENT_HXX_ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace cppu; -using namespace com::sun::star::ucb; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace std; -using namespace osl; - -using ::rtl::OUString; - - - -template class safe_list : public osl::Mutex, public std::list< Type > {}; - -class OSimpleContentIdentifier : public OWeakObject, - public XContentIdentifier -{ -private: - OUString Identifier; - OUString ProviderScheme; - -public: - OSimpleContentIdentifier( const OUString& rIdentifier, const OUString& rProviderScheme ); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw(RuntimeException); - virtual void SAL_CALL release() throw(RuntimeException); - - // XContentIdentifier - virtual OUString SAL_CALL getContentIdentifier() throw(RuntimeException); - virtual OUString SAL_CALL getContentProviderScheme() throw(RuntimeException); -}; - - -//--------------------------------------------------------------------------- -// -// FileSystemContent -// -//--------------------------------------------------------------------------- - -class OContent : -public OWeakObject, -public XContent, -public XCommandTaskProcessor, -public XPropertyTaskProcessor, -public XCommandInfo, -public XPropertySetInfo, -public XComponent -{ -public: - struct PropertyChangeEventInfo - { - OUString Name; - long Handle; - - PropertyChangeEventInfo() : Handle( -1 ) {} - - inline int operator ==( const PropertyChangeEventInfo& crInfo ) const - { return Handle == crInfo.Handle && Handle > 0 || Name == crInfo.Name; } - #ifdef __SUNPRO_CC - inline int operator <( const PropertyChangeEventInfo& crInfo ) const - { return Handle != crInfo.Handle ? Handle < crInfo.Handle : Name < crInfo.Name; } - #endif - }; - - struct PropertyChangeListenerInfo - { - Reference< XPropertiesChangeListener > xListener; - list< PropertyChangeEventInfo > aEventInfos; - - inline int operator ==( const PropertyChangeListenerInfo& crInfo ) const - { return xListener == crInfo.xListener; } - #ifdef __SUNPRO_CC - inline int operator <( const PropertyChangeListenerInfo& crInfo ) const - { return xListener < crInfo.xListener; } - #endif - }; - -protected: - Sequence< PropertyChangeEvent > matchListenerEvents( const Sequence< PropertyChangeEvent >& crEvents, const PropertyChangeListenerInfo & crInfo ); - - safe_list< Reference< XContentEventListener > > m_aContentListeners; - safe_list< Reference< XEventListener > > m_aComponentListeners; - safe_list< PropertyChangeListenerInfo > m_aPropertyChangeListeners; -public: - virtual ~OContent() {} - - virtual void broadcastContentEvent( const ContentEvent & crEvent ); - virtual void broadcastPropertiesChangeEvents( const Sequence< PropertyChangeEvent >& crEvents ); - - // To be implemented by inheritents - virtual Any doCommand( const Command & crCommand ) = 0; - - // XInterface - virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException ); - - virtual void SAL_CALL acquire() throw(RuntimeException); - virtual void SAL_CALL release() throw(RuntimeException); - - // XContent - virtual void SAL_CALL addContentEventListener( const Reference< XContentEventListener >& rListener ) throw(); - virtual void SAL_CALL removeContentEventListener( const Reference< XContentEventListener >& rListener ) throw(); - - // XComponent - virtual void SAL_CALL dispose() throw(); - virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw(); - virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& xListener ) throw(); - - // XCommmandTaskProcessor - virtual Reference< XCommandInfo > SAL_CALL getCommandsInfo() throw(); - - // XCommandInfo - virtual CommandInfo SAL_CALL getCommandInfoByName( const OUString& rName ) throw( UnsupportedCommandException ); - virtual CommandInfo SAL_CALL getCommandInfoByHandle( long nHandle ) throw( UnsupportedCommandException ); - virtual sal_Bool SAL_CALL hasCommandByName( const OUString& rName ) throw(); - virtual sal_Bool SAL_CALL hasCommandByHandle( long nHandle ) throw(); - - // XPropertyTaskProcessor - virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(); - - // XPropertySetInfo - virtual Property SAL_CALL getPropertyByName( const OUString& Name ) throw( UnknownPropertyException ); - virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(); - virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw(); - virtual void SAL_CALL removePropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw(); -}; - -//--------------------------------------------------------------------------- -// -// FolderContent -// -//--------------------------------------------------------------------------- - -// supported Commands -static const sal_Int32 OPEN = 0; -static const sal_Int32 CLOSE = 1; - -class OFolderContent : public OContent -{ -protected: - // Already provided children - safe_list< XContent > m_aChildList; - - // OContent - virtual Any doCommand( const Command & crCommand ); - - // new methods, can be overloaded - virtual Any doOpenCommand(); - virtual Any doCloseCommand(); - - // To be implemented by inheritants - virtual Sequence< XContent > getAllChildren() = 0; - -public: - - // XCommmandTaskProcessor - virtual Reference< XCommandTask > SAL_CALL createCommandTask(const Command& rCommand, const Reference< XContentTaskEnvironment >& rEnvironment ) throw(); - - // XCommandInfo - virtual Sequence< CommandInfo > SAL_CALL getCommands() throw(); -}; - -//--------------------------------------------------------------------------- -// -// OContentTask -// -//--------------------------------------------------------------------------- - -class OContentTask : -public OWeakObject, -public XContentTask -{ - Guard< OContent > m_aContentGuard; -protected: - OContent *m_pContent; - Reference< XContentTaskEnvironment > m_xEnvironment; - ContentTaskStatus m_eStatus; - oslThread m_aThread; - - static void executeWorker( void * ); - virtual ContentTaskStatus setStatus( ContentTaskStatus eStatus ); - - // To be implemented by inheritants - virtual void doExecute() = 0; -public: - OContentTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent ); - virtual ~OContentTask(); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException ); - - virtual void SAL_CALL acquire() throw(RuntimeException); - virtual void SAL_CALL release() throw(RuntimeException); - - // XContentTask - virtual void SAL_CALL start() throw(); - virtual void SAL_CALL execute() throw( Exception ); - virtual void SAL_CALL abort() throw(); - virtual ContentTaskStatus SAL_CALL getStatus() throw(); - virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw(); -}; - -//--------------------------------------------------------------------------- -// -// OCommandTask -// -//--------------------------------------------------------------------------- - -class OCommandTask : -public OContentTask, -public XCommandTask -{ -protected: - Command m_aCommand; - Any m_aResult; - -public: - OCommandTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent, const Command& rCommand ); - virtual ~OCommandTask(); - - virtual void doExecute(); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw(RuntimeException); - virtual void SAL_CALL release() throw(RuntimeException); - - // XContentTask - virtual void SAL_CALL start() throw(); - virtual void SAL_CALL execute() throw( Exception ); - virtual void SAL_CALL abort() throw(); - virtual ContentTaskStatus SAL_CALL getStatus() throw(); - virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw(); - - // XCommandTask - virtual Command SAL_CALL getCommand() throw(); - virtual Any SAL_CALL getResult() throw(); -}; - -//--------------------------------------------------------------------------- -// -// OPropertyTask -// -//--------------------------------------------------------------------------- - -class OPropertyTask : -public OContentTask, -public XPropertyTask -{ -protected: - Sequence< PropertyValueInfo > m_aProperties; - PropertyTaskType m_eType; -public: - OPropertyTask(const Reference< XContentTaskEnvironment >& Environment, OContent *pContent, const Sequence< PropertyValue >& Properties, PropertyTaskType Type ); - virtual ~OPropertyTask(); - - virtual void doExecute(); - - // To be implemented by inheritants - virtual Any setPropertyValue( PropertyValueInfo & rProperty ) = 0; - virtual void getPropertyValue( PropertyValueInfo & rProperty ) = 0; - - // XInterface - virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw(RuntimeException); - virtual void SAL_CALL release() throw(RuntimeException); - - // XContentTask - virtual void SAL_CALL start() throw(); - virtual void SAL_CALL execute() throw( Exception ); - virtual void SAL_CALL abort() throw(); - virtual ContentTaskStatus SAL_CALL getStatus() throw(); - virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw(); - - // XPropertyTask - PropertyTaskType SAL_CALL getType() throw(); - Sequence< PropertyValueInfo > SAL_CALL getProperties() throw(); -}; - -#endif // _UCBHELPER_CONTENT_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/inc/update.hrc b/extensions/inc/update.hrc deleted file mode 100644 index dcdcfaaa4..000000000 --- a/extensions/inc/update.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_UPDATE_HRC -#define EXTENSIONS_UPDATE_HRC - -#define HID_CHECK_FOR_UPD_DLG "EXTENSIONS_HID_CHECK_FOR_UPD_DLG" -#define HID_CHECK_FOR_UPD_CLOSE "EXTENSIONS_HID_CHECK_FOR_UPD_CLOSE" -#define HID_CHECK_FOR_UPD_PAUSE "EXTENSIONS_HID_CHECK_FOR_UPD_PAUSE" -#define HID_CHECK_FOR_UPD_RESUME "EXTENSIONS_HID_CHECK_FOR_UPD_RESUME" -#define HID_CHECK_FOR_UPD_DOWNLOAD "EXTENSIONS_HID_CHECK_FOR_UPD_DOWNLOAD" -#define HID_CHECK_FOR_UPD_DOWNLOAD2 "EXTENSIONS_HID_CHECK_FOR_UPD_DOWNLOAD2" -#define HID_CHECK_FOR_UPD_INSTALL "EXTENSIONS_HID_CHECK_FOR_UPD_INSTALL" -#define HID_CHECK_FOR_UPD_STATUS "EXTENSIONS_HID_CHECK_FOR_UPD_STATUS" -#define HID_CHECK_FOR_UPD_DESCRIPTION "EXTENSIONS_HID_CHECK_FOR_UPD_DESCRIPTION" -#define HID_CHECK_FOR_UPD_CANCEL "EXTENSIONS_HID_CHECK_FOR_UPD_CANCEL" - -#endif // EXTENSIONS_UPDATE_HRC diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst deleted file mode 100644 index fd883a262..000000000 --- a/extensions/prj/build.lst +++ /dev/null @@ -1,37 +0,0 @@ -ex extensions : officecfg TRANSLATIONS:translations DESKTOP:rdbmaker svx SANE:sane TWAIN:twain np_sdk offapi stoc ZLIB:zlib CURL:curl LIBXSLT:libxslt NULL - -ex extensions usr1 - all ex_mkout NULL -ex extensions\inc nmake - all ex_inc NULL -ex extensions\inc\ucbhelper get - all ex_incucbh ex_inc NULL -ex extensions\source\plugin\workben get - all ex_plwkb ex_inc NULL -ex extensions\source\plugin\inc\plugin\win get - all ex_piwi ex_inc NULL -ex extensions\source\plugin\inc\plugin\unx get - all ex_piux ex_inc NULL -ex extensions\source\activex\msidl nmake - w ex_axmsidl ex_inc NULL -ex extensions\source\activex\main nmake - w ex_axmain ex_axmsidl.w ex_inc NULL -ex extensions\source\ole nmake - w ex_ole ex_xmlextr ex_inc NULL -ex extensions\source\resource nmake - all ex_resrc ex_inc NULL -ex extensions\source\plugin\aqua nmake - u ex_plaqua ex_plbase NULL -ex extensions\source\plugin\base nmake - all ex_plbase ex_inc NULL -ex extensions\source\plugin\win nmake - w ex_plwin ex_plbase ex_inc NULL -ex extensions\source\plugin\unx nmake - u ex_plunx ex_inc NULL -ex extensions\source\plugin\util nmake - all ex_plutil ex_plbase ex_plunx.u ex_plwin.w ex_plaqua.u ex_inc NULL -ex extensions\source\macosx\spotlight nmake - u ex_mxspotlight NULL -ex extensions\source\scanner nmake - all ex_scan ex_resrc ex_inc NULL -ex extensions\source\bibliography nmake - all ex_bib ex_inc NULL -ex extensions\source\xmlextract nmake - all ex_xmlextr ex_inc NULL -ex extensions\source\propctrlr nmake - all ex_propctrlr ex_bib ex_inc NULL -ex extensions\source\dbpilots nmake - all ex_dbpilots ex_inc NULL -ex extensions\source\abpilot nmake - all ex_abpilot ex_inc NULL -ex extensions\source\logging nmake - all ex_logging ex_inc NULL -ex extensions\source\oooimprovecore nmake - all ex_oooimprovecore ex_inc NULL -ex extensions\source\oooimprovement nmake - all ex_oooimprovement ex_inc NULL -ex extensions\source\config\ldap nmake - all ex_ldap ex_inc NULL -ex extensions\source\nsplugin\source nmake - u ex_nsplugin ex_inc NULL -ex extensions\source\nsplugin\source nmake - w ex_nsplugin ex_inc NULL -ex extensions\source\update\feed nmake - all ex_updchkfeed ex_inc NULL -ex extensions\source\update\check nmake - all ex_updchk ex_inc NULL -ex extensions\source\update\ui nmake - all ex_updchkui ex_inc NULL -ex extensions\util nmake - all ex_util ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil ex_oooimprovecore NULL - -# Fails at the moment -# ex extensions\qa\complex\extensions nmake - all ex_complex ex_util NULL diff --git a/extensions/prj/d.lst b/extensions/prj/d.lst deleted file mode 100644 index 8f726eb87..000000000 --- a/extensions/prj/d.lst +++ /dev/null @@ -1,57 +0,0 @@ -mkdir: %COMMON_DEST%\bin\hid -mkdir: %_DEST%\xml\uiconfig -mkdir: %_DEST%\xml\uiconfig\modules -mkdir: %_DEST%\xml\uiconfig\modules\sbibliography -mkdir: %_DEST%\xml\uiconfig\modules\sbibliography\menubar -mkdir: %_DEST%\bin\odf4ms -mkdir: %_DEST%\bin\so - -..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin\hid\*.hid -..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll -..\%__SRC%\lib\lib*.so %_DEST%\lib -..\%__SRC%\lib\ldapbe2.uno.so %_DEST%\lib\ldapbe2.uno.so -..\%__SRC%\lib\updchk.uno.so %_DEST%\lib\updchk.uno.so -..\%__SRC%\lib\updatefeed.uno.so %_DEST%\lib\updatefeed.uno.so -..\%__SRC%\bin\oleautobridge2.uno.dll %_DEST%\bin\odf4ms\oleautobridge.uno.dll -..\%__SRC%\lib\*.dylib %_DEST%\lib\*.dylib -..\%__SRC%\bin\pluginapp.bin %_DEST%\bin\pluginapp.bin -..\%__SRC%\bin\*.res %_DEST%\bin\*.res -..\%__SRC%\bin\nsplugin.exe %_DEST%\bin\nsplugin.exe -..\%__SRC%\bin\nsplugin %_DEST%\bin\nsplugin -..\%__SRC%\bin\npsoplugin.dll %_DEST%\bin\npsoplugin.dll -..\%__SRC%\bin\npsoplugin_so.dll %_DEST%\bin\so\npsoplugin.dll -..\%__SRC%\bin\x64\so_activex.dll %_DEST%\bin\so_activex_x64.dll -..\%__SRC%\bin\mdibundle.zip %_DEST%\bin\mdibundle.zip -..\%__SRC%\misc\oleautobridge.component %_DEST%\xml\oleautobridge.component - -..\source\bibliography\uiconfig\sbibliography\menubar\*.xml %_DEST%\xml\uiconfig\modules\sbibliography\menubar\*.xml - -..\source\propctrlr\pcr.xml %_DEST%\xml\pcr.xml - -mkdir: %_DEST%\xml\registry\spool -mkdir: %_DEST%\xml\registry\spool\org -mkdir: %_DEST%\xml\registry\spool\org\openoffice -mkdir: %_DEST%\xml\registry\spool\org\openoffice\Office\Addons -mkdir: %_DEST%\xml\registry\spool\org\openoffice\Office\Jobs -mkdir: %_DEST%\xml\registry\spool\org\openoffice\Office\Logging - -..\%__SRC%\misc\registry\spool\org\openoffice\Office\Addons\*.xcu %_DEST%\xml\registry\spool\org\openoffice\Office\Addons -..\%__SRC%\misc\registry\spool\org\openoffice\Office\Jobs\*.xcu %_DEST%\xml\registry\spool\org\openoffice\Office\Jobs -..\%__SRC%\misc\registry\spool\org\openoffice\Office\Logging\*.xcu %_DEST%\xml\registry\spool\org\openoffice\Office\Logging - -..\%__SRC%\bin\*.oxt %_DEST%\pck\* -..\%__SRC%\misc\abp.component %_DEST%\xml\abp.component -..\%__SRC%\misc\bib.component %_DEST%\xml\bib.component -..\%__SRC%\misc\dbp.component %_DEST%\xml\dbp.component -..\%__SRC%\misc\ldapbe2.component %_DEST%\xml\ldapbe2.component -..\%__SRC%\misc\log.component %_DEST%\xml\log.component -..\%__SRC%\misc\oooimprovecore.component %_DEST%\xml\oooimprovecore.component -..\%__SRC%\misc\oooimprovement.component %_DEST%\xml\oooimprovement.component -..\%__SRC%\misc\pcr.component %_DEST%\xml\pcr.component -..\%__SRC%\misc\pl.component %_DEST%\xml\pl.component -..\%__SRC%\misc\res.component %_DEST%\xml\res.component -..\%__SRC%\misc\scn.component %_DEST%\xml\scn.component -..\%__SRC%\misc\updatefeed.component %_DEST%\xml\updatefeed.component -..\%__SRC%\misc\updchk.component %_DEST%\xml\updchk.component -..\%__SRC%\misc\updchk.uno.component %_DEST%\xml\updchk.uno.component -..\%__SRC%\misc\xmx.component %_DEST%\xml\xmx.component diff --git a/extensions/qa/complex/extensions/OfficeResourceLoader.java b/extensions/qa/complex/extensions/OfficeResourceLoader.java deleted file mode 100644 index 6d5df80f8..000000000 --- a/extensions/qa/complex/extensions/OfficeResourceLoader.java +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.extensions; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.resource.XResourceBundle; -import com.sun.star.resource.XResourceBundleLoader; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.Locale; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; -import static org.junit.Assert.*; - -public class OfficeResourceLoader -{ - XResourceBundleLoader m_loader; - XResourceBundle m_bundle; - - /** Creates a new instance of ValueBinding */ - public OfficeResourceLoader() - { - } - - /* ------------------------------------------------------------------ */ -// public String[] getTestMethodNames() -// { -// return new String[] { -// "checkSimpleStringAccess", -// "checkLocales" -// }; -// } - - /* ------------------------------------------------------------------ */ -// public String getTestObjectName() -// { -// return "Extensions - OfficeResourceLoader"; -// } - - /* ------------------------------------------------------------------ */ - @Before public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet orb = UnoRuntime.queryInterface(XPropertySet.class, getMSF()); - XComponentContext context = UnoRuntime.queryInterface(XComponentContext.class, orb.getPropertyValue("DefaultContext")); - - m_loader = com.sun.star.resource.OfficeResourceLoader.get( context ); - } - - /* ------------------------------------------------------------------ */ - @After public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception - { - // default bundle (UI locale) - m_bundle = m_loader.loadBundle_Default( "orl" ); - - Locale resourceLocale = m_bundle.getLocale(); - - String testString = (String)m_bundle.getByName( "string:1000" ); - - if ( resourceLocale.Language.equals( "en" ) - && resourceLocale.Country.equals( "US" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); - } - - if ( resourceLocale.Language.equals( "de" ) - && resourceLocale.Country.equals( "" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); - } - - if ( resourceLocale.Language.equals( "" ) - && resourceLocale.Country.equals( "" ) - && resourceLocale.Variant.equals( "" ) - ) - { - assertTrue( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); - } - } - - /* ------------------------------------------------------------------ */ - @Test public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception - { - // en-US bundle (should always be built and thus present and thus found) - m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) ); - Locale resourceLocale = m_bundle.getLocale(); - assertTrue( "'en-US' could not be loaded", - resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); - - // some (invalid) locale which is usually no built, and should thus fallback to en-US - m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) ); - resourceLocale = m_bundle.getLocale(); - assertTrue( "non-existing locale request does not fallback to en-US", - resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); - } - - - private XMultiServiceFactory getMSF() - { - final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); - return xMSF1; - } - - // setup and close connections - @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/extensions/qa/complex/extensions/extensions_all.sce b/extensions/qa/complex/extensions/extensions_all.sce deleted file mode 100644 index 2d23dd7a1..000000000 --- a/extensions/qa/complex/extensions/extensions_all.sce +++ /dev/null @@ -1 +0,0 @@ --o complex.extensions.OfficeResourceLoader diff --git a/extensions/qa/complex/extensions/makefile.mk b/extensions/qa/complex/extensions/makefile.mk deleted file mode 100644 index 281960b32..000000000 --- a/extensions/qa/complex/extensions/makefile.mk +++ /dev/null @@ -1,98 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../../.. -PRJNAME = extensions -TARGET = qa_complex_extensions - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = complex/extensions -JAVATESTFILES = \ - OfficeResourceLoader.java - -JAVAFILES = $(JAVATESTFILES) - -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar ConnectivityTools.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) -.END - - - -.IF "$(GUI)"=="WNT" -command_seperator=&& -.ELSE -command_seperator=; -.ENDIF - - -.INCLUDE: settings.mk - -#----- resource files for the OfficeResourceLoader test ------------ -RES_TARGET = orl - -SRS1NAME=$(RES_TARGET)_A_ -SRC1FILES= \ - $(RES_TARGET)_en-US.src - -RES1FILELIST=\ - $(SRS)$/$(RES_TARGET)_A_.srs - -RESLIB1NAME=$(RES_TARGET)_A_ -RESLIB1SRSFILES=$(RES1FILELIST) - - - -SRS2NAME=$(RES_TARGET)_B_ -SRC2FILES= \ - $(RES_TARGET)_de.src - -RES2FILELIST=\ - $(SRS)$/$(RES_TARGET)_B_.srs - -RESLIB2NAME=$(RES_TARGET)_B_ -RESLIB2SRSFILES=$(RES2FILELIST) - -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - - -#----- resource files for the OfficeResourceLoader test ------------ - - -ALLTAR : copy_resources javatest - -copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) - $(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo - $(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo - - -.END - diff --git a/extensions/qa/complex/extensions/orl_de.src b/extensions/qa/complex/extensions/orl_de.src deleted file mode 100644 index e92ac818a..000000000 --- a/extensions/qa/complex/extensions/orl_de.src +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -String 1000 -{ - Text = "Attrappen-Zeichenkette"; -}; diff --git a/extensions/qa/complex/extensions/orl_en-US.src b/extensions/qa/complex/extensions/orl_en-US.src deleted file mode 100644 index bdeaac39a..000000000 --- a/extensions/qa/complex/extensions/orl_en-US.src +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -String 1000 -{ - Text = "Dummy String"; -}; diff --git a/extensions/qa/integration/extensions/ComponentFactory.java b/extensions/qa/integration/extensions/ComponentFactory.java deleted file mode 100644 index 5edeb1bb6..000000000 --- a/extensions/qa/integration/extensions/ComponentFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.XComponentContext; -import com.sun.star.lang.XSingleComponentFactory; -import java.lang.reflect.Constructor; - -/** - * - * @author fs93730 - */ -public class ComponentFactory implements XSingleComponentFactory -{ - private Class m_handlerClass; - private Constructor m_defaultConstructor; - private Constructor m_initConstructor; - - public ComponentFactory( Class _handlerClass ) - { - m_handlerClass = _handlerClass; - - Class objectArrayClass = null; - try - { - objectArrayClass = Class.forName("[Ljava.lang.Object;"); - } - catch ( java.lang.ClassNotFoundException e ) { } - - Constructor ctors[] = _handlerClass.getConstructors(); - for ( int i = 0; i < ctors.length && ctors != null; ++i) - { - Class ctorParams[] = ctors[i].getParameterTypes(); - if ( ( ctorParams.length == 1 ) && ( ctorParams[0].equals( XComponentContext.class ) ) ) - m_defaultConstructor = ctors[i]; - if ( ( ctorParams.length == 2 ) - && ( ctorParams[0].equals( XComponentContext.class ) ) - && ( ctorParams[1].equals( objectArrayClass ) ) - ) - m_initConstructor = ctors[i]; - } - if ( m_defaultConstructor == null ) - throw new java.lang.IllegalArgumentException(); - } - - private Object ipml_createInstance( Constructor _ctor, Object[] _arguments ) - { - Object newInstance = null; - try - { - newInstance = _ctor.newInstance( _arguments ); - } - catch( InstantiationException e ) - { - System.err.println( "InstantiationException: Could not instantiate an instance of " + m_handlerClass.getName() ); - } - catch( IllegalAccessException e ) - { - System.err.println( "IllegalAccessException: Could not instantiate an instance of " + m_handlerClass.getName() ); - } - catch( java.lang.reflect.InvocationTargetException e ) - { - System.err.println( "InvocationTargetException: Could not instantiate an instance of " + m_handlerClass.getName() ); - } - return newInstance; - } - - public Object createInstanceWithArgumentsAndContext(Object[] _arguments, XComponentContext _componentContext) throws com.sun.star.uno.Exception - { - if ( m_initConstructor != null ) - return ipml_createInstance( m_initConstructor, new Object[] { _componentContext, _arguments } ); - else - return createInstanceWithContext( _componentContext ); - } - - public Object createInstanceWithContext(XComponentContext _componentContext) throws com.sun.star.uno.Exception - { - return ipml_createInstance( m_defaultConstructor, new Object[] { _componentContext } ); - } -} - diff --git a/extensions/qa/integration/extensions/ConsoleWait.java b/extensions/qa/integration/extensions/ConsoleWait.java deleted file mode 100644 index 4c4a43491..000000000 --- a/extensions/qa/integration/extensions/ConsoleWait.java +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.*; -import com.sun.star.lang.XComponent; - -public class ConsoleWait implements com.sun.star.lang.XEventListener -{ - private Object m_disposable; - - /** a helper class which waits for a console ENTER key event in a dedicated thread, - and notifies a ConsoleWait object if this event happened - */ - private class WaitForEnter extends java.lang.Thread - { - private ConsoleWait m_toNotify; - private boolean m_done; - - public WaitForEnter( ConsoleWait _toNotify ) - { - m_toNotify = _toNotify; - m_done = false; - } - - public boolean isDone() - { - return m_done; - } - - public void run() - { - try - { - System.out.println( "\npress enter to exit" ); - System.in.read(); - - m_done = true; - // notify that the user pressed the key - synchronized ( m_toNotify ) - { - m_toNotify.notify(); - } - } - catch( java.lang.Exception e ) - { - // not really interested in - System.err.println( e ); - } - } - }; - - /** creates a ConsoleWait instance - * @param _disposable - * a component whose disposal should be monitored. When this component dies, - * the ConsoleWait also returns from an waitForConsole call, even if the user - * did not yet press the enter key - */ - public ConsoleWait( Object _disposable ) - { - m_disposable = _disposable; - XComponent component = (XComponent)UnoRuntime.queryInterface( XComponent.class, _disposable ); - if ( component != null ) - component.addEventListener( this ); - } - - /** waits for the user to press the ENTER key (on the console where she started the java program) - or the disposable component to be closed by the user. - @return - TRUE if the user pressed a key on the console, FALSE if she closed the document - */ - public boolean waitForUserInput() throws java.lang.Exception - { - synchronized (this) - { - WaitForEnter keyWaiter = new WaitForEnter( this ); - keyWaiter.start(); - wait(); - - // if the waiter thread is done, the user pressed enter - boolean bKeyPressed = keyWaiter.isDone(); - if ( !bKeyPressed ) - keyWaiter.interrupt(); - - return bKeyPressed; - } - } - - /* ------------------------------------------------------------------ */ - /* XEventListener overridables */ - /* ------------------------------------------------------------------ */ - public void disposing( com.sun.star.lang.EventObject eventObject ) - { - if ( eventObject.Source.equals( m_disposable ) ) - { - // notify ourself that we can stop waiting for user input - synchronized (this) - { - notify(); - } - } - } -} \ No newline at end of file diff --git a/extensions/qa/integration/extensions/Frame.java b/extensions/qa/integration/extensions/Frame.java deleted file mode 100644 index a53fe65a2..000000000 --- a/extensions/qa/integration/extensions/Frame.java +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.*; -import com.sun.star.frame.*; -import com.sun.star.task.XStatusIndicatorFactory; -import com.sun.star.util.XCloseable; - -/** wraps the coms.sun.star.frame.Frame service - * - * @author fs93730 - */ -public class Frame implements XFrame, - XDispatchProvider, - XDispatchProviderInterception, - XFramesSupplier, - XStatusIndicatorFactory, - XCloseable -{ - private XFrame m_frame; - private XDispatchProvider m_dispatchProvider; - private XDispatchProviderInterception m_dispatchProviderInterception; - private XFramesSupplier m_framesSupplier; - private XStatusIndicatorFactory m_statusIndicatorFactory; - private XCloseable m_closeable; - - /** Creates a new instance of Frame */ - public Frame( Object _frameComponent ) - { - if ( _frameComponent != null ) - { - m_frame = (XFrame)UnoRuntime.queryInterface( XFrame.class, _frameComponent ); - m_dispatchProvider = (XDispatchProvider)UnoRuntime.queryInterface( XDispatchProvider.class, _frameComponent ); - m_dispatchProviderInterception = (XDispatchProviderInterception)UnoRuntime.queryInterface( XDispatchProviderInterception.class, _frameComponent ); - m_framesSupplier = (XFramesSupplier)UnoRuntime.queryInterface( XFramesSupplier.class, _frameComponent ); - m_statusIndicatorFactory = (XStatusIndicatorFactory)UnoRuntime.queryInterface( XStatusIndicatorFactory.class, _frameComponent ); - m_closeable = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, _frameComponent ); - } - } - - public XFrame getXFrame() - { - return m_frame; - } - - public void activate() - { - m_frame.activate(); - } - - public void addEventListener(com.sun.star.lang.XEventListener _eventListener) - { - m_frame.addEventListener( _eventListener ); - } - - public void addFrameActionListener(XFrameActionListener _frameActionListener) - { - m_frame.addFrameActionListener( _frameActionListener ); - } - - public void contextChanged() - { - m_frame.contextChanged(); - } - - public com.sun.star.task.XStatusIndicator createStatusIndicator() - { - return m_statusIndicatorFactory.createStatusIndicator(); - } - - public void deactivate() - { - m_frame.deactivate(); - } - - public void dispose() - { - m_frame.dispose(); - } - - public XFrame findFrame(String str, int param) - { - return m_frame.findFrame( str, param ); - } - - public XFrame getActiveFrame() - { - return m_framesSupplier.getActiveFrame(); - } - - public com.sun.star.awt.XWindow getComponentWindow() - { - return m_frame.getComponentWindow(); - } - - public com.sun.star.awt.XWindow getContainerWindow() - { - return m_frame.getContainerWindow(); - } - - public XController getController() - { - return m_frame.getController(); - } - - public XFramesSupplier getCreator() - { - return m_frame.getCreator(); - } - - public XFrames getFrames() - { - return m_framesSupplier.getFrames(); - } - - public String getName() - { - return m_frame.getName(); - } - - public void initialize(com.sun.star.awt.XWindow _window) - { - m_frame.initialize( _window ); - } - - public boolean isActive() - { - return m_frame.isActive(); - } - - public boolean isTop() - { - return m_frame.isTop(); - } - - public XDispatch queryDispatch(com.sun.star.util.URL _url, String _str, int _param) - { - return m_dispatchProvider.queryDispatch( _url, _str, _param ); - } - - public XDispatch[] queryDispatches(DispatchDescriptor[] dispatchDescriptor) - { - return m_dispatchProvider.queryDispatches( dispatchDescriptor ); - } - - public void registerDispatchProviderInterceptor(XDispatchProviderInterceptor _dispatchProviderInterceptor) - { - m_dispatchProviderInterception.registerDispatchProviderInterceptor( _dispatchProviderInterceptor ); - } - - public void releaseDispatchProviderInterceptor(XDispatchProviderInterceptor _dispatchProviderInterceptor) - { - m_dispatchProviderInterception.releaseDispatchProviderInterceptor( _dispatchProviderInterceptor ); - } - - public void removeEventListener(com.sun.star.lang.XEventListener _eventListener) - { - m_frame.removeEventListener( _eventListener ); - } - - public void removeFrameActionListener(XFrameActionListener _frameActionListener) - { - m_frame.removeFrameActionListener( _frameActionListener ); - } - - public void setActiveFrame(XFrame _frame) - { - m_framesSupplier.setActiveFrame( _frame ); - } - - public boolean setComponent(com.sun.star.awt.XWindow _window, XController _controller) - { - return m_frame.setComponent( _window, _controller ); - } - - public void setCreator(XFramesSupplier _framesSupplier) - { - m_frame.setCreator( _framesSupplier ); - } - - public void setName(String str) - { - m_frame.setName( str ); - } - - public void close(boolean _deliverOwnership) throws com.sun.star.util.CloseVetoException - { - m_closeable.close( _deliverOwnership ); - } - - public void removeCloseListener(com.sun.star.util.XCloseListener _closeListener) - { - m_closeable.removeCloseListener( _closeListener ); - } - - public void addCloseListener(com.sun.star.util.XCloseListener _closeListener) - { - m_closeable.addCloseListener( _closeListener ); - } -} diff --git a/extensions/qa/integration/extensions/HelpTextProvider.java b/extensions/qa/integration/extensions/HelpTextProvider.java deleted file mode 100644 index 857b019ee..000000000 --- a/extensions/qa/integration/extensions/HelpTextProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * HelpTextProvider.java - * - * Created on 16. November 2006, 09:44 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package integration.extensions; - -import com.sun.star.inspection.XObjectInspectorUI; -import com.sun.star.inspection.XPropertyControl; -import com.sun.star.inspection.XPropertyControlObserver; -import com.sun.star.lang.NoSupportException; - -/** displays help text for the currently selected method - */ -public class HelpTextProvider implements XPropertyControlObserver -{ - private XObjectInspectorUI m_inspectorUI; - - /** - * Creates a new instance of HelpTextProvider - */ - public HelpTextProvider( XObjectInspectorUI _inspectorUI ) - { - m_inspectorUI = _inspectorUI; - m_inspectorUI.registerControlObserver( this ); - } - - public void focusGained( XPropertyControl _propertyControl ) - { - try - { - String helpText = "here could be the help for:\n"; - helpText += _propertyControl.getValue().toString(); - m_inspectorUI.setHelpSectionText( helpText ); - } - catch (NoSupportException ex) - { - ex.printStackTrace(); - } - } - - public void valueChanged( XPropertyControl _propertyControl ) - { - // not interested in - } -} diff --git a/extensions/qa/integration/extensions/MethodHandler.java b/extensions/qa/integration/extensions/MethodHandler.java deleted file mode 100644 index e75e0205e..000000000 --- a/extensions/qa/integration/extensions/MethodHandler.java +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.*; -import com.sun.star.lang.*; -import com.sun.star.beans.*; -import com.sun.star.reflection.*; -import com.sun.star.inspection.*; - -/** - * - * @author fs93730 - */ -public class MethodHandler implements XPropertyHandler -{ - private XComponentContext m_context; - private XIntrospection m_introspection; - private XIntrospectionAccess m_introspectionAccess; - private XIdlClass m_idlClass; - private XIdlMethod[] m_methods; - private java.util.HashMap m_methodsHash; - - /** Creates a new instance of MethodHandler */ - public MethodHandler( XComponentContext _context ) - { - m_context = _context; - m_methodsHash = new java.util.HashMap(); - - try - { - m_introspection = (XIntrospection)UnoRuntime.queryInterface( XIntrospection.class, - m_context.getServiceManager().createInstanceWithContext( "com.sun.star.beans.Introspection", m_context ) - ); - } - catch( com.sun.star.uno.Exception e ) - { - System.err.println( "MethodHandler: could not create a Introspection service, not much functionality will be available." ); - } - } - - static public XSingleComponentFactory getFactory() - { - return new ComponentFactory( MethodHandler.class ); - } - - public void actuatingPropertyChanged(String _propertyName, Object _newValue, Object _oldValue, com.sun.star.inspection.XObjectInspectorUI _objectInspectorUI, boolean _firstTimeInit) throws com.sun.star.lang.NullPointerException - { - // not interested in - } - - public void addEventListener(com.sun.star.lang.XEventListener _eventListener) - { - // ingnoring this - } - - public void addPropertyChangeListener(com.sun.star.beans.XPropertyChangeListener _propertyChangeListener) throws com.sun.star.lang.NullPointerException - { - // ingnoring this - } - - public Object convertToControlValue(String _propertyName, Object _propertyValue, com.sun.star.uno.Type type) throws com.sun.star.beans.UnknownPropertyException - { - return _propertyValue; - } - - public Object convertToPropertyValue(String _propertyName, Object _controlValue) throws com.sun.star.beans.UnknownPropertyException - { - return _controlValue; - } - - public com.sun.star.inspection.LineDescriptor describePropertyLine(String _propertyName, com.sun.star.inspection.XPropertyControlFactory _propertyControlFactory) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.NullPointerException - { - com.sun.star.inspection.LineDescriptor descriptor = new com.sun.star.inspection.LineDescriptor(); - - descriptor = new LineDescriptor(); - descriptor.Category = "Methods"; - descriptor.DisplayName = "has method"; - descriptor.HasPrimaryButton = descriptor.HasSecondaryButton = false; - descriptor.IndentLevel = 0; - try - { - XPropertyControl control = (XPropertyControl)UnoRuntime.queryInterface( - XPropertyControl.class, _propertyControlFactory.createPropertyControl( - PropertyControlType.TextField, true ) ); - - descriptor.Control = control; - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - } - return descriptor; - } - - public void dispose() - { - // nothing to do - } - - public String[] getActuatingProperties() - { - // none - return new String[] { }; - } - - public com.sun.star.beans.PropertyState getPropertyState(String _propertyName) throws com.sun.star.beans.UnknownPropertyException - { - return com.sun.star.beans.PropertyState.DIRECT_VALUE; - } - - public Object getPropertyValue(String _propertyName) throws com.sun.star.beans.UnknownPropertyException - { - XIdlMethod method = impl_getMethod( _propertyName ); - - String signature = new String(); - signature += method.getReturnType().getName(); - signature += " "; - signature += method.getName(); - - signature += "("; - - XIdlClass[] parameterTypes = method.getParameterTypes(); - for ( int param = 0; param - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.XMultiServiceFactory; - -import com.sun.star.frame.*; -import com.sun.star.inspection.*; -import com.sun.star.beans.*; - -import integration.extensions.Frame; - -public class ObjectInspector extends complexlib.ComplexTestCase -{ - private XComponentContext m_context; - private XMultiServiceFactory m_orb; - private Frame m_desktop; - - final private String m_inspectorFrameName = new String( "ObjectInspector" ); - - /** Creates a new instance of ValueBinding */ - public ObjectInspector() - { - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "interactiveObjectInspector" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Test Skeleton"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - m_context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class, - ((XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_orb )).getPropertyValue( "DefaultContext" ) ); - m_desktop = new Frame( m_orb.createInstance( "com.sun.star.frame.Desktop" ) ); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - closeExistentInspector(); - } - - /* ------------------------------------------------------------------ */ - public void interactiveObjectInspector() throws com.sun.star.uno.Exception, java.lang.Exception - { - closeExistentInspector(); - - // the to-be-inspected object - XFrame inspectee = m_desktop.getActiveFrame(); - - // the inspector - XObjectInspector inspector = createObjectInspector(); - - // do inspect - inspector.inspect( new Object[] { inspectee } ); - - ConsoleWait keyWaiter = new ConsoleWait( inspector ); - keyWaiter.waitForUserInput(); - } - - /* ------------------------------------------------------------------ */ - private XObjectInspector createObjectInspector() throws com.sun.star.uno.Exception - { - com.sun.star.awt.XWindow floatingWindow = createFloatingWindow(); - - Frame inspectorFrame = new Frame( m_orb.createInstance( "com.sun.star.frame.Frame" ) ); - inspectorFrame.setName( m_inspectorFrameName ); - inspectorFrame.initialize( floatingWindow ); - m_desktop.getFrames().append( inspectorFrame.getXFrame() ); - - // handler factories: - Object[] handlerFactories = new Object[] { - "com.sun.star.inspection.GenericPropertyHandler", - new ComponentFactory( ServicesHandler.class ), - new ComponentFactory( MethodHandler.class ) - }; - // a model - XObjectInspectorModel model = ObjectInspectorModel.createWithHandlerFactoriesAndHelpSection( - m_context, handlerFactories, 4, 4 ); - - // create the ObjectInspector - XObjectInspector inspector = com.sun.star.inspection.ObjectInspector.createWithModel( - m_context, model ); - - // add an observer which will emit help texts - new HelpTextProvider( inspector.getInspectorUI() ); - - // plug it into the frame - inspector.attachFrame( inspectorFrame.getXFrame() ); - - // make the window visible - floatingWindow.setVisible( true ); - - // outta here - return inspector; - } - - /* ------------------------------------------------------------------ */ - private void closeExistentInspector() - { - Frame existentInspectorFrame = new Frame( m_desktop.findFrame( m_inspectorFrameName, 255 ) ); - if ( existentInspectorFrame != null ) - { - try - { - existentInspectorFrame.close( true ); - } - catch( com.sun.star.util.CloseVetoException e ) - { - failed( "could not close the existent inspector frame" ); - } - } - } - - /* ------------------------------------------------------------------ */ - private com.sun.star.awt.XWindow createFloatingWindow() throws com.sun.star.uno.Exception - { - com.sun.star.awt.XToolkit toolkit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface( - com.sun.star.awt.XToolkit.class, m_orb.createInstance( "com.sun.star.awt.Toolkit" ) ); - - com.sun.star.awt.WindowDescriptor windowDescriptor = new com.sun.star.awt.WindowDescriptor(); - windowDescriptor.Type = com.sun.star.awt.WindowClass.TOP; - windowDescriptor.WindowServiceName = "modelessdialog"; // "floatingwindow" would need a parent - windowDescriptor.ParentIndex = -1; - //windowDescriptor.Parent = null; - - windowDescriptor.Bounds = new com.sun.star.awt.Rectangle( 500, 100, 400, 600 ); - windowDescriptor.WindowAttributes = com.sun.star.awt.WindowAttribute.BORDER - + com.sun.star.awt.WindowAttribute.MOVEABLE - + com.sun.star.awt.WindowAttribute.SIZEABLE - + com.sun.star.awt.WindowAttribute.CLOSEABLE - + com.sun.star.awt.VclWindowPeerAttribute.CLIPCHILDREN; - - return (com.sun.star.awt.XWindow)UnoRuntime.queryInterface( com.sun.star.awt.XWindow.class, - toolkit.createWindow( windowDescriptor ) ); - } -} diff --git a/extensions/qa/integration/extensions/ServicesHandler.java b/extensions/qa/integration/extensions/ServicesHandler.java deleted file mode 100644 index 0340a988a..000000000 --- a/extensions/qa/integration/extensions/ServicesHandler.java +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.lang.ClassNotFoundException; -import com.sun.star.uno.*; -import com.sun.star.beans.*; -import com.sun.star.inspection.*; -import com.sun.star.frame.*; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XSingleComponentFactory; - -/** - * - * @author fs93730 - */ -public class ServicesHandler implements XPropertyHandler -{ - private XComponentContext m_context; - private String[] m_supportedServices; - - private class ClickHandler implements com.sun.star.awt.XActionListener - { - XComponentContext m_context; - private String m_serviceName; - - public ClickHandler( XComponentContext _context, String _serviceName ) - { - m_context = _context; - m_serviceName = _serviceName; - } - - public void disposing(com.sun.star.lang.EventObject eventObject) - { - // not interested in - } - - public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) - { - try - { - // translate the service name into a URL to dispatch - String documentationURL = "http://api.openoffice.org/docs/common/ref/" + m_serviceName.replace('.','/') + ".html"; - System.out.println( documentationURL ); - - // the OpenHyperlink command, to be dispatched to the Desktop - com.sun.star.util.URL dispatchURL[] = { new com.sun.star.util.URL() }; - dispatchURL[0].Complete = ".uno:OpenHyperlink"; - com.sun.star.util.XURLTransformer transformer = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface( - com.sun.star.util.XURLTransformer.class, - m_context.getServiceManager().createInstanceWithContext( "com.sun.star.util.URLTransformer", m_context ) ); - transformer.parseStrict( dispatchURL ); - - // the dispatcher for the OpenHyperlink command - Frame desktop = new Frame( - m_context.getServiceManager().createInstanceWithContext( "com.sun.star.frame.Desktop", m_context ) ); - XDispatch dispatcher = desktop.queryDispatch(dispatchURL[0],"",0); - - // the arguments for the OpenHyperlink command - PropertyValue dispatchArgs[] = new PropertyValue[] { new PropertyValue() }; - dispatchArgs[0].Name = "URL"; - dispatchArgs[0].Value = documentationURL; - - dispatcher.dispatch(dispatchURL[0], dispatchArgs ); - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.err ); - } - } - } - - /** Creates a new instance of ServicesHandler */ - public ServicesHandler( XComponentContext _context ) - { - m_context = _context; - m_supportedServices = new String[] { }; - } - - public void actuatingPropertyChanged(String _propertyName, Object _newValue, Object _oldValue, com.sun.star.inspection.XObjectInspectorUI _objectInspectorUI, boolean _firstTimeInit) throws com.sun.star.lang.NullPointerException - { - // not interested in - } - - public void addEventListener(com.sun.star.lang.XEventListener _eventListener) - { - // ingnoring this - } - - public void addPropertyChangeListener(com.sun.star.beans.XPropertyChangeListener _propertyChangeListener) throws com.sun.star.lang.NullPointerException - { - // ingnoring this - } - - public Object convertToControlValue(String _propertyName, Object _propertyValue, com.sun.star.uno.Type type) throws com.sun.star.beans.UnknownPropertyException - { - return _propertyValue; - } - - public Object convertToPropertyValue(String _propertyName, Object _controlValue) throws com.sun.star.beans.UnknownPropertyException - { - return _controlValue; - } - - public com.sun.star.inspection.LineDescriptor describePropertyLine(String _propertyName, com.sun.star.inspection.XPropertyControlFactory _propertyControlFactory) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.NullPointerException - { - com.sun.star.inspection.LineDescriptor descriptor = new com.sun.star.inspection.LineDescriptor(); - - descriptor = new LineDescriptor(); - descriptor.Category = "Services"; - descriptor.DisplayName = "supports service"; - descriptor.HasPrimaryButton = descriptor.HasSecondaryButton = false; - descriptor.IndentLevel = 0; - try - { - XHyperlinkControl hyperlinkControl = (XHyperlinkControl)UnoRuntime.queryInterface( - XHyperlinkControl.class, _propertyControlFactory.createPropertyControl( PropertyControlType.HyperlinkField, true ) ); - hyperlinkControl.addActionListener( new ClickHandler( m_context, _propertyName ) ); - - descriptor.Control = hyperlinkControl; - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - } - return descriptor; - } - - public void dispose() - { - // nothing to do - } - - public String[] getActuatingProperties() - { - // none - return new String[] { }; - } - - public com.sun.star.beans.PropertyState getPropertyState(String _propertyName) throws com.sun.star.beans.UnknownPropertyException - { - return com.sun.star.beans.PropertyState.DIRECT_VALUE; - } - - public Object getPropertyValue(String _propertyName) throws com.sun.star.beans.UnknownPropertyException - { - return _propertyName; - } - - public String[] getSupersededProperties() - { - return new String[] { "SupportedServiceNames" }; - // we're used in conjunction with a GenericPropertyHandler, which (via inspection) finds - // a property SupportedServiceNames, resulting from the XServiceInfo.getSupportedServiceNames - // method. Since we handle those ourself, we supersede them. - } - - public com.sun.star.beans.Property[] getSupportedProperties() - { - Property[] properties = new Property[ m_supportedServices.length ]; - for ( int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.extensions; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.XMultiServiceFactory; - -public class TestSkeleton extends complexlib.ComplexTestCase -{ - private XMultiServiceFactory m_orb; - - /** Creates a new instance of ValueBinding */ - public TestSkeleton() - { - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkSomething" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Test Skeleton"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - public void checkSomething() throws com.sun.star.uno.Exception, java.lang.Exception - { - } -} diff --git a/extensions/qa/integration/extensions/extensions_complex.sce b/extensions/qa/integration/extensions/extensions_complex.sce deleted file mode 100644 index 563376c72..000000000 --- a/extensions/qa/integration/extensions/extensions_complex.sce +++ /dev/null @@ -1 +0,0 @@ -#-o integration.extensions.ObjectInspector \ No newline at end of file diff --git a/extensions/qa/integration/extensions/makefile.mk b/extensions/qa/integration/extensions/makefile.mk deleted file mode 100644 index 98e46fde1..000000000 --- a/extensions/qa/integration/extensions/makefile.mk +++ /dev/null @@ -1,83 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/.. -TARGET = ExtensionsIntegrationTests -PRJNAME = extensions -PACKAGE = integration$/$(PRJNAME) - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES := $(shell @$(FIND) .$/*.java) -JAVACLASSFILES := $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Runner Settings ---------------------------------------------- - -# create connection string for OOoRunner -.IF "$(RUNNER_CONNECTION_STRING)" == "" - .IF "$(OOO_RUNNER_PORT)" == "" - OOO_RUNNER_PORT=8100 - .ENDIF - .IF "$(OOO_RUNNER_HOST)" == "" - OOO_RUNNER_HOST=localhost - .ENDIF - RUNNER_CONNECTION_STRING=socket,host=$(OOO_RUNNER_HOST),port=$(OOO_RUNNER_PORT) -.ENDIF - -# classpath and argument list -RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar -RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex -cs $(RUNNER_CONNECTION_STRING) - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALL : ALLTAR -.ELSE -ALL: ALLDEP -.ENDIF - -.INCLUDE : target.mk - -run: - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce extensions_complex.sce - -run_%: - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o integration.$(PRJNAME).$(@:s/run_//) - diff --git a/extensions/qa/unoapi/Test.java b/extensions/qa/unoapi/Test.java deleted file mode 100644 index c997cb9de..000000000 --- a/extensions/qa/unoapi/Test.java +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2000, 2010 Oracle and/or its affiliates. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* -* for a copy of the LGPLv3 License. -************************************************************************/ - -package org.openoffice.extensions.qa.unoapi; - -import org.openoffice.Runner; -import org.openoffice.test.OfficeConnection; -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", "extensions.sce", "-cs", connection.getDescription())); - } - - private final OfficeConnection connection = new OfficeConnection(); -} diff --git a/extensions/qa/unoapi/extensions.sce b/extensions/qa/unoapi/extensions.sce deleted file mode 100644 index cb338fed5..000000000 --- a/extensions/qa/unoapi/extensions.sce +++ /dev/null @@ -1,5 +0,0 @@ --o pcr.ObjectInspector -# this object must be tests twice since it is the onle one in this module -# The runner only prints "[0-9]+? of [0-9]+? tests failed" -# if more then one tests is executed. This is needed by cwscheckapi. --o pcr.ObjectInspector diff --git a/extensions/qa/unoapi/makefile.mk b/extensions/qa/unoapi/makefile.mk deleted file mode 100644 index a869a3c10..000000000 --- a/extensions/qa/unoapi/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -#***********************************************************************/ - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../.. -PRJNAME = extensions -TARGET = qa_unoapi - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = org/openoffice/extensions/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/extensions/source/abpilot/abp.component b/extensions/source/abpilot/abp.component deleted file mode 100644 index a07cef986..000000000 --- a/extensions/source/abpilot/abp.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx deleted file mode 100644 index 1fb72439c..000000000 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abpfinalpage.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - using namespace ::svt; - using namespace ::utl; - - const SfxFilter* lcl_getBaseFilter() - { - static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); - return pFilter; - } - //===================================================================== - //= FinalPage - //===================================================================== - //--------------------------------------------------------------------- - FinalPage::FinalPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_FINAL)) - ,m_aExplanation ( this, ModuleRes( FT_FINISH_EXPL ) ) - ,m_aLocationLabel ( this, ModuleRes( FT_LOCATION ) ) - ,m_aLocation ( this, ModuleRes( CBB_LOCATION ) ) - ,m_aBrowse ( this, ModuleRes( PB_BROWSE ) ) - ,m_aRegisterName ( this, ModuleRes( CB_REGISTER_DS ) ) - ,m_aNameLabel ( this, ModuleRes( FT_NAME_EXPL ) ) - ,m_aName ( this, ModuleRes( ET_DATASOURCENAME ) ) - ,m_aDuplicateNameError ( this, ModuleRes( FT_DUPLICATENAME ) ) - ,m_aLocationController( ::comphelper::ComponentContext( _pParent->getORB() ), m_aLocation, m_aBrowse ) - { - FreeResource(); - - m_aName.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aLocation.SetModifyHdl( LINK(this, FinalPage, OnNameModified) ); - m_aRegisterName.SetClickHdl( LINK( this, FinalPage, OnRegister ) ); - m_aRegisterName.Check(sal_True); - } - - //--------------------------------------------------------------------- - sal_Bool FinalPage::isValidName() const - { - ::rtl::OUString sCurrentName(m_aName.GetText()); - - if (0 == sCurrentName.getLength()) - // the name must not be empty - return sal_False; - - if ( m_aInvalidDataSourceNames.find( sCurrentName ) != m_aInvalidDataSourceNames.end() ) - // there already is a data source with this name - return sal_False; - - return sal_True; - } - - //--------------------------------------------------------------------- - void FinalPage::setFields() - { - AddressSettings& rSettings = getSettings(); - - INetURLObject aURL( rSettings.sDataSourceName ); - if( aURL.GetProtocol() == INET_PROT_NOT_VALID ) - { - String sPath = SvtPathOptions().GetWorkPath(); - sPath += '/'; - sPath += String(rSettings.sDataSourceName); - - const SfxFilter* pFilter = lcl_getBaseFilter(); - if ( pFilter ) - { - String sExt = pFilter->GetDefaultExtension(); - sPath += sExt.GetToken(1,'*'); - } - - aURL.SetURL(sPath); - } - OSL_ENSURE( aURL.GetProtocol() != INET_PROT_NOT_VALID ,"No valid file name!"); - rSettings.sDataSourceName = aURL.GetMainURL( INetURLObject::NO_DECODE ); - m_aLocationController.setURL( rSettings.sDataSourceName ); - String sName = aURL.getName( ); - xub_StrLen nPos = sName.Search(String(aURL.GetExtension())); - if ( nPos != STRING_NOTFOUND ) - { - sName.Erase(nPos-1,4); - } - m_aName.SetText(sName); - - OnRegister(&m_aRegisterName); - } - - //--------------------------------------------------------------------- - void FinalPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - setFields(); - } - - //--------------------------------------------------------------------- - sal_Bool FinalPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - if ( ( ::svt::WizardTypes::eTravelBackward != _eReason ) - && ( !m_aLocationController.prepareCommit() ) - ) - return sal_False; - - AddressSettings& rSettings = getSettings(); - rSettings.sDataSourceName = m_aLocationController.getURL(); - rSettings.bRegisterDataSource = m_aRegisterName.IsChecked(); - if ( rSettings.bRegisterDataSource ) - rSettings.sRegisteredDataSourceName = m_aName.GetText(); - - return sal_True; - } - - //--------------------------------------------------------------------- - void FinalPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - // get the names of all data sources - ODataSourceContext aContext( getORB() ); - aContext.getDataSourceNames( m_aInvalidDataSourceNames ); - - // give the name edit the focus - m_aLocation.GrabFocus(); - - // default the finish button - getDialog()->defaultButton( WZB_FINISH ); - } - - //--------------------------------------------------------------------- - void FinalPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - - // default the "next" button, again - getDialog()->defaultButton( WZB_NEXT ); - // disable the finish button - getDialog()->enableButtons( WZB_FINISH, sal_False ); - } - - //--------------------------------------------------------------------- - bool FinalPage::canAdvance() const - { - return false; - } - - //--------------------------------------------------------------------- - void FinalPage::implCheckName() - { - sal_Bool bValidName = isValidName(); - sal_Bool bEmptyName = 0 == m_aName.GetText().Len(); - sal_Bool bEmptyLocation = 0 == m_aLocation.GetText().Len(); - - // enable or disable the finish button - getDialog()->enableButtons( WZB_FINISH, !bEmptyLocation && (!m_aRegisterName.IsChecked() || bValidName) ); - - // show the error message for an invalid name - m_aDuplicateNameError.Show( !bValidName && !bEmptyName ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( FinalPage, OnNameModified, Edit*, /**/ ) - { - implCheckName(); - return 0L; - } - - // ----------------------------------------------------------------------------- - IMPL_LINK( FinalPage, OnRegister, CheckBox*, EMPTYARG ) - { - sal_Bool bEnable = m_aRegisterName.IsChecked(); - m_aNameLabel.Enable(bEnable); - m_aName.Enable(bEnable); - implCheckName(); - return 0L; - } -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx deleted file mode 100644 index 6fbf76b54..000000000 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABPFINALPAGE_HXX -#define EXTENSIONS_ABP_ABPFINALPAGE_HXX - -#include "abspage.hxx" -#include "abptypes.hxx" - -#include -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FinalPage - //===================================================================== - class FinalPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - FixedText m_aLocationLabel; - ::svt::OFileURLControl m_aLocation; - PushButton m_aBrowse; - CheckBox m_aRegisterName; - FixedText m_aNameLabel; - Edit m_aName; - FixedText m_aDuplicateNameError; - - ::svx::DatabaseLocationInputController - m_aLocationController; - - StringBag m_aInvalidDataSourceNames; - - public: - FinalPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnNameModified, Edit* ); - DECL_LINK( OnRegister, CheckBox* ); - - sal_Bool isValidName() const; - void implCheckName(); - void setFields(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABPFINALPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abpresid.hrc b/extensions/source/abpilot/abpresid.hrc deleted file mode 100644 index 4a364a43c..000000000 --- a/extensions/source/abpilot/abpresid.hrc +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABPRESID_HRC -#define EXTENSIONS_ABPRESID_HRC - -#include "abpilot.hrc" -#include "extensio.hrc" - -//======================================================================== -// basics - -#define RID_DIALOG_START RID_ABP_START -#define RID_PAGE_START RID_ABP_START -#define RID_STRING_START RID_ABP_START -#define RID_ERRORBOX_START RID_ABP_START -#define RID_UNTYPED_START RID_ABP_START -#define RID_QUERYBOX_START RID_ABP_START -#define RID_BITMAP_START RID_ABP_START - -//======================================================================== -// dialogs - -#define RID_DLG_ADDRESSBOOKSOURCEPILOT ( RID_DIALOG_START + 0 ) -// please adjust RID_DIALOG_END (below) when adding new dialogs - -#define RID_DIALOG_END RID_DLG_ADDRESSBOOKSOURCEPILOT - -//======================================================================== -// tab pages - -#define RID_PAGE_SELECTABTYPE ( RID_PAGE_START + 0 ) -#define RID_PAGE_ADMININVOKATION ( RID_PAGE_START + 1 ) -#define RID_PAGE_TABLESELECTION_AB ( RID_PAGE_START + 2 ) -#define RID_PAGE_FIELDMAPPING ( RID_PAGE_START + 3 ) -#define RID_PAGE_FINAL ( RID_PAGE_START + 4 ) -// please adjust RID_PAGE_END (below) when adding new tab pages - -#define RID_PAGE_END RID_PAGE_FINAL - -//======================================================================== -// strings - -#define RID_STR_DEFAULT_NAME ( RID_STRING_START + 0 ) -#define RID_STR_ADMINDIALOGTITLE ( RID_STRING_START + 1 ) -#define RID_STR_NOCONNECTION ( RID_STRING_START + 2 ) -#define RID_STR_PLEASECHECKSETTINGS ( RID_STRING_START + 3 ) -#define RID_STR_FIELDDIALOGTITLE ( RID_STRING_START + 4 ) -#define RID_STR_NOFIELDSASSIGNED ( RID_STRING_START + 5 ) -// please adjust RID_STRING_END (below) when adding new strings - -#define RID_STRING_END RID_STR_NOFIELDSASSIGNED - -//======================================================================== -// error boxes - -#define RID_ERR_NEEDTYPESELECTION ( RID_ERRORBOX_START + 0 ) -// please adjust RID_ERRORBOX_END (below) when adding new error boxes - -#define RID_ERRORBOX_END RID_ERR_NEEDTYPESELECTION - -//======================================================================== -// query boxes - -#define RID_QRY_NOTABLES ( RID_QUERYBOX_START + 0 ) -// please adjust RID_QUERYBOX_END (below) when adding new query boxes - -#define RID_QRY_NO_EVO_GW ( RID_QUERYBOX_START + 1 ) - -#define RID_QUERYBOX_END RID_QRY_NO_EVO_GW - -//======================================================================== -// untyped resources - -#define RID_RSC_NOTUSEDYET ( RID_UNTYPED_START + 0 ) -// please adjust RID_UNTYPED_END (below) when adding new untyped resources - -#define RID_UNTYPED_END RID_RSC_NOTUSEDYET - -//======================================================================== -// bitmaps - -#define BMP_HEADERIMAGE ( RID_BITMAP_START + 0 ) -// please adjust RID_BITMAP_END (below) when adding new bitmaps - -#define RID_BITMAP_END BMP_HEADERIMAGE - -//======================================================================== -//======================================================================== -//= range checks - -#if RID_DIALOG_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_PAGE_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_STRING_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_ERRORBOX_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_QUERYBOX_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_UNTYPED_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_BITMAP_END > RID_ABP_END - #error "please adjust the resource id ranges!!" -#endif - -//======================================================================== -// local resource ids - -//........................................................................ -#define FL_SEPARATOR 1 -#define FL_TYPE 2 -#define FL_NAME 3 - -//........................................................................ -#define FT_TYPE_HINTS 1 -#define FT_ADMINEXPLANATION 3 -#define FT_NAME_EXPL 4 -#define FT_ERROR 5 -#define FL_TOOMUCHTABLES 6 -#define FT_FIELDASSIGMENTEXPL 7 -#define FT_ASSIGNEDFIELDS 8 -#define FT_FINISH_EXPL 9 -#define FT_DUPLICATENAME 10 -#define FT_LOCATION 11 - -//........................................................................ -#define RB_MORK 1 -#define RB_THUNDERBIRD 2 -#define RB_EVOLUTION 3 -#define RB_KAB 4 -#define RB_MACAB 5 -#define RB_LDAP 6 -#define RB_OUTLOOK 7 -#define RB_OUTLOOKEXPRESS 8 -#define RB_OTHER 9 -#define RB_EVOLUTION_GROUPWISE 10 -#define RB_EVOLUTION_LDAP 11 - -//........................................................................ -#define ET_DATASOURCENAME 1 -#define ET_LOCATION 2 - -//........................................................................ -#define PB_INVOKE_ADMIN_DIALOG 1 -#define PB_INVOKE_FIELDS_DIALOG 2 -#define PB_BROWSE 3 - -//........................................................................ -#define LB_TABLELIST 1 - -//........................................................................ -#define CB_REGISTER_DS 1 - -//........................................................................ -#define CBB_LOCATION 1 - -//........................................................................ -#define STR_SELECT_ABTYPE 1 -#define STR_INVOKE_ADMIN_DIALOG 2 -#define STR_TABLE_SELECTION 3 -#define STR_MANUAL_FIELD_MAPPING 4 -#define STR_FINAL_CONFIRM 5 - -//======================================================================== -// some defines - -//........................................................................ -#define WINDOW_SIZE_X 240 -#define WINDOW_SIZE_Y 185 - -#define WINDOW_BORDER_X 12 -#define WINDOW_BORDER_Y 14 - -#define BUTTON_SIZE_X 50 -#define BUTTON_SIZE_Y 14 - -#define HEADER_SIZE_Y 30 - -#define BORDER_X 12 - -//........................................................................ - -#endif // EXTENSIONS_ABPRESID_HRC - -/************************************************************************* - * history: - * - * Revision 1.0 30.01.01 16:38:29 fs - ************************************************************************/ - diff --git a/extensions/source/abpilot/abpservices.cxx b/extensions/source/abpilot/abpservices.cxx deleted file mode 100644 index d78593126..000000000 --- a/extensions/source/abpilot/abpservices.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "componentmodule.hxx" - -//--------------------------------------------------------------------------------------- - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno(); - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL abp_initializeModule() -{ - static sal_Bool s_bInit = sal_False; - if (!s_bInit) - { - createRegistryInfo_OABSPilotUno(); - ::abp::OModule::setResourceFilePrefix("abp"); - s_bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - abp_initializeModule(); - - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::abp::OModule::getComponentFactory( - ::rtl::OUString::createFromAscii(pImplementationName), - static_cast< XMultiServiceFactory* >(pServiceManager)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abptypes.hxx b/extensions/source/abpilot/abptypes.hxx deleted file mode 100644 index 3df98e9a9..000000000 --- a/extensions/source/abpilot/abptypes.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABPTYPES_HXX -#define EXTENSIONS_ABP_ABPTYPES_HXX - -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - DECLARE_STL_STDKEY_SET( ::rtl::OUString, StringBag ); - - DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, MapString2String ); - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABPTYPES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspage.cxx b/extensions/source/abpilot/abspage.cxx deleted file mode 100644 index 993396ab3..000000000 --- a/extensions/source/abpilot/abspage.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abspage.hxx" -#include "abspilot.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::svt; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - //===================================================================== - //= AddressBookSourcePage - //===================================================================== - AddressBookSourcePage::AddressBookSourcePage( OAddessBookSourcePilot* _pParent, const ResId& _rId ) - :AddressBookSourcePage_Base(_pParent, _rId) - { - } - - //--------------------------------------------------------------------- - void AddressBookSourcePage::DeactivatePage() - { - AddressBookSourcePage_Base::DeactivatePage(); - getDialog()->enableButtons(WZB_NEXT, sal_True); - } - - //--------------------------------------------------------------------- - OAddessBookSourcePilot* AddressBookSourcePage::getDialog() - { - return static_cast(GetParent()); - } - - //--------------------------------------------------------------------- - const OAddessBookSourcePilot* AddressBookSourcePage::getDialog() const - { - return static_cast(GetParent()); - } - - //--------------------------------------------------------------------- - AddressSettings& AddressBookSourcePage::getSettings() - { - return getDialog()->getSettings(); - } - - //--------------------------------------------------------------------- - const AddressSettings& AddressBookSourcePage::getSettings() const - { - return getDialog()->getSettings(); - } - - //--------------------------------------------------------------------- - Reference< XMultiServiceFactory > AddressBookSourcePage::getORB() - { - return getDialog()->getORB(); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx deleted file mode 100644 index c80c8a7a2..000000000 --- a/extensions/source/abpilot/abspage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ABSPAGE_HXX -#define EXTENSIONS_ABP_ABSPAGE_HXX - -#include -#include -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - class OAddessBookSourcePilot; - struct AddressSettings; - - //===================================================================== - //= AddressBookSourcePage - //===================================================================== - typedef ::svt::OWizardPage AddressBookSourcePage_Base; - /// the base class for all tab pages in the address book source wizard - class AddressBookSourcePage : public AddressBookSourcePage_Base - { - protected: - AddressBookSourcePage( OAddessBookSourcePilot* _pParent, const ResId& _rId ); - - protected: - // helper - OAddessBookSourcePilot* getDialog(); - const OAddessBookSourcePilot* getDialog() const; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getORB(); - AddressSettings& getSettings(); - const AddressSettings& getSettings() const; - - // TabDialog overridables - virtual void DeactivatePage(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ABSPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx deleted file mode 100644 index f9124a10d..000000000 --- a/extensions/source/abpilot/abspilot.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "abspilot.hxx" -#include "abpilot.hrc" -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include -#include -#include "typeselectionpage.hxx" -#include "admininvokationpage.hxx" -#include "tableselectionpage.hxx" -#include -#include -#include "abpfinalpage.hxx" -#include "fieldmappingpage.hxx" -#include "fieldmappingimpl.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - -#define STATE_SELECT_ABTYPE 0 -#define STATE_INVOKE_ADMIN_DIALOG 1 -#define STATE_TABLE_SELECTION 2 -#define STATE_MANUAL_FIELD_MAPPING 3 -#define STATE_FINAL_CONFIRM 4 - -#define PATH_COMPLETE 1 -#define PATH_NO_SETTINGS 2 -#define PATH_NO_FIELDS 3 -#define PATH_NO_SETTINGS_NO_FIELDS 4 - - using namespace ::svt; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - - //===================================================================== - //= OAddessBookSourcePilot - //===================================================================== - //--------------------------------------------------------------------- - OAddessBookSourcePilot::OAddessBookSourcePilot(Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB) - :OAddessBookSourcePilot_Base( _pParent, ModuleRes( RID_DLG_ADDRESSBOOKSOURCEPILOT ), - WZB_HELP | WZB_FINISH | WZB_CANCEL | WZB_NEXT | WZB_PREVIOUS ) - ,m_xORB(_rxORB) - ,m_aNewDataSource(_rxORB) - ,m_eNewDataSourceType( AST_INVALID ) - { - SetPageSizePixel(LogicToPixel(Size(WINDOW_SIZE_X, WINDOW_SIZE_Y), MAP_APPFONT)); - - ShowButtonFixedLine(sal_True); - - declarePath( PATH_COMPLETE, - STATE_SELECT_ABTYPE, - STATE_INVOKE_ADMIN_DIALOG, - STATE_TABLE_SELECTION, - STATE_MANUAL_FIELD_MAPPING, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_SETTINGS, - STATE_SELECT_ABTYPE, - STATE_TABLE_SELECTION, - STATE_MANUAL_FIELD_MAPPING, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_FIELDS, - STATE_SELECT_ABTYPE, - STATE_INVOKE_ADMIN_DIALOG, - STATE_TABLE_SELECTION, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - declarePath( PATH_NO_SETTINGS_NO_FIELDS, - STATE_SELECT_ABTYPE, - STATE_TABLE_SELECTION, - STATE_FINAL_CONFIRM, - WZS_INVALID_STATE - ); - - m_pPrevPage->SetHelpId(HID_ABSPILOT_PREVIOUS); - m_pNextPage->SetHelpId(HID_ABSPILOT_NEXT); - m_pCancel->SetHelpId(HID_ABSPILOT_CANCEL); - m_pFinish->SetHelpId(HID_ABSPILOT_FINISH); - m_pHelp->SetUniqueId(UID_ABSPILOT_HELP); - - m_pCancel->SetClickHdl( LINK( this, OAddessBookSourcePilot, OnCancelClicked) ); - - // some initial settings -#ifdef UNX -#ifdef MACOSX - m_aSettings.eType = AST_MACAB; -#else -// FIXME: if KDE use KAB instead - m_aSettings.eType = AST_EVOLUTION; -#endif -#else - m_aSettings.eType = AST_OTHER; -#endif - m_aSettings.sDataSourceName = String(ModuleRes(RID_STR_DEFAULT_NAME)); - m_aSettings.bRegisterDataSource = false; - m_aSettings.bIgnoreNoTable = false; - - defaultButton(WZB_NEXT); - enableButtons(WZB_FINISH, sal_False); - ActivatePage(); - - typeSelectionChanged( m_aSettings.eType ); - } - - //--------------------------------------------------------------------- - String OAddessBookSourcePilot::getStateDisplayName( WizardState _nState ) const - { - sal_uInt16 nResId = 0; - switch ( _nState ) - { - case STATE_SELECT_ABTYPE: nResId = STR_SELECT_ABTYPE; break; - case STATE_INVOKE_ADMIN_DIALOG: nResId = STR_INVOKE_ADMIN_DIALOG; break; - case STATE_TABLE_SELECTION: nResId = STR_TABLE_SELECTION; break; - case STATE_MANUAL_FIELD_MAPPING: nResId = STR_MANUAL_FIELD_MAPPING; break; - case STATE_FINAL_CONFIRM: nResId = STR_FINAL_CONFIRM; break; - } - DBG_ASSERT( nResId, "OAddessBookSourcePilot::getStateDisplayName: don't know this state!" ); - - String sDisplayName; - if ( nResId ) - { - svt::OLocalResourceAccess aAccess( ModuleRes( RID_DLG_ADDRESSBOOKSOURCEPILOT ), RSC_MODALDIALOG ); - sDisplayName = String( ModuleRes( nResId ) ); - } - - return sDisplayName; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCommitAll() - { - // in real, the data source already exists in the data source context - // Thus, if the user changed the name, we have to rename the data source - if ( m_aSettings.sDataSourceName != m_aNewDataSource.getName() ) - m_aNewDataSource.rename( m_aSettings.sDataSourceName ); - - // 1. the data source - m_aNewDataSource.store(); - - // 2. check if we need to register the data source - if ( m_aSettings.bRegisterDataSource ) - m_aNewDataSource.registerDataSource(m_aSettings.sRegisteredDataSourceName); - - // 3. write the data source / table names into the configuration - addressconfig::writeTemplateAddressSource( getORB(), m_aSettings.bRegisterDataSource ? m_aSettings.sRegisteredDataSourceName : m_aSettings.sDataSourceName, m_aSettings.sSelectedTable ); - - // 4. write the field mapping - fieldmapping::writeTemplateAddressFieldMapping( getORB(), m_aSettings.aFieldMapping ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCleanup() - { - if ( m_aNewDataSource.isValid() ) - m_aNewDataSource.remove(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OAddessBookSourcePilot, OnCancelClicked, void*, /*NOTINTERESTEDIN*/ ) - { - // do cleanups - implCleanup(); - - // reset the click hdl - m_pCancel->SetClickHdl( Link() ); - // simulate the click again - this time, the default handling of the button will strike .... - m_pCancel->Click(); - - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::Close() - { - implCleanup(); - - return OAddessBookSourcePilot_Base::Close(); - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::onFinish() - { - if ( !OAddessBookSourcePilot_Base::onFinish() ) - return sal_False; - - implCommitAll(); - - addressconfig::markPilotSuccess( getORB() ); - - return sal_True; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::enterState( WizardState _nState ) - { - switch ( _nState ) - { - case STATE_SELECT_ABTYPE: - impl_updateRoadmap( static_cast< TypeSelectionPage* >( GetPage( STATE_SELECT_ABTYPE ) )->getSelectedType() ); - break; - - case STATE_FINAL_CONFIRM: - if ( !needManualFieldMapping( ) ) - implDoAutoFieldMapping(); - break; - - case STATE_TABLE_SELECTION: - implDefaultTableName(); - break; - } - - OAddessBookSourcePilot_Base::enterState(_nState); - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::prepareLeaveCurrentState( CommitPageReason _eReason ) - { - if ( !OAddessBookSourcePilot_Base::prepareLeaveCurrentState( _eReason ) ) - return sal_False; - - if ( _eReason == eTravelBackward ) - return sal_True; - - sal_Bool bAllow = sal_True; - - switch ( getCurrentState() ) - { - case STATE_SELECT_ABTYPE: - implCreateDataSource(); - if ( needAdminInvokationPage() ) - break; - // no break here - - case STATE_INVOKE_ADMIN_DIALOG: - if ( !connectToDataSource( sal_False ) ) - { - // connecting did not succeed -> do not allow proceeding - bAllow = sal_False; - break; - } - - // ........................................................ - // now that we connected to the data source, check whether we need the "table selection" page - const StringBag& aTables = m_aNewDataSource.getTableNames(); - - if ( aTables.empty() ) - { - if ( RET_YES != QueryBox( this, ModuleRes( ( getSettings().eType == AST_EVOLUTION_GROUPWISE ? RID_QRY_NO_EVO_GW : RID_QRY_NOTABLES ) ) ).Execute() ) - { - // cannot ask the user, or the user chose to use this data source, though there are no tables - bAllow = sal_False; - break; - } - - m_aSettings.bIgnoreNoTable = true; - } - - if ( aTables.size() == 1 ) - // remember the one and only table we have - m_aSettings.sSelectedTable = *aTables.begin(); - - break; - } - - impl_updateRoadmap( m_aSettings.eType ); - return bAllow; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implDefaultTableName() - { - const StringBag& rTableNames = getDataSource().getTableNames(); - if ( rTableNames.end() != rTableNames.find( getSettings().sSelectedTable ) ) - // already a valid table selected - return; - - const sal_Char* pGuess = NULL; - switch ( getSettings().eType ) - { - case AST_MORK : - case AST_THUNDERBIRD : pGuess = "Personal Address book"; break; - case AST_LDAP : pGuess = "LDAP Directory"; break; - case AST_EVOLUTION : - case AST_EVOLUTION_GROUPWISE: - case AST_EVOLUTION_LDAP : pGuess = "Personal"; break; - default: - OSL_FAIL( "OAddessBookSourcePilot::implDefaultTableName: unhandled case!" ); - return; - } - const ::rtl::OUString sGuess = ::rtl::OUString::createFromAscii( pGuess ); - if ( rTableNames.end() != rTableNames.find( sGuess ) ) - getSettings().sSelectedTable = sGuess; - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implDoAutoFieldMapping() - { - DBG_ASSERT( !needManualFieldMapping( ), "OAddessBookSourcePilot::implDoAutoFieldMapping: invalid call!" ); - - fieldmapping::defaultMapping( getORB(), m_aSettings.aFieldMapping ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::implCreateDataSource() - { - if (m_aNewDataSource.isValid()) - { // we already have a data source object - if ( m_aSettings.eType == m_eNewDataSourceType ) - // and it already has the correct type - return; - - // it has a wrong type -> remove it - m_aNewDataSource.remove(); - } - - ODataSourceContext aContext( getORB() ); - aContext.disambiguate( m_aSettings.sDataSourceName ); - - switch (m_aSettings.eType) - { - case AST_MORK: - m_aNewDataSource = aContext.createNewMORK( m_aSettings.sDataSourceName ); - break; - - case AST_THUNDERBIRD: - m_aNewDataSource = aContext.createNewThunderbird( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION: - m_aNewDataSource = aContext.createNewEvolution( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION_GROUPWISE: - m_aNewDataSource = aContext.createNewEvolutionGroupwise( m_aSettings.sDataSourceName ); - break; - - case AST_EVOLUTION_LDAP: - m_aNewDataSource = aContext.createNewEvolutionLdap( m_aSettings.sDataSourceName ); - break; - - case AST_KAB: - m_aNewDataSource = aContext.createNewKab( m_aSettings.sDataSourceName ); - break; - - case AST_MACAB: - m_aNewDataSource = aContext.createNewMacab( m_aSettings.sDataSourceName ); - break; - - case AST_LDAP: - m_aNewDataSource = aContext.createNewLDAP( m_aSettings.sDataSourceName ); - break; - - case AST_OUTLOOK: - m_aNewDataSource = aContext.createNewOutlook( m_aSettings.sDataSourceName ); - break; - - case AST_OE: - m_aNewDataSource = aContext.createNewOE( m_aSettings.sDataSourceName ); - break; - - case AST_OTHER: - m_aNewDataSource = aContext.createNewDBase( m_aSettings.sDataSourceName ); - break; - - case AST_INVALID: - OSL_FAIL( "OAddessBookSourcePilot::implCreateDataSource: illegal data source type!" ); - break; - } - m_eNewDataSourceType = m_aSettings.eType; - } - - //--------------------------------------------------------------------- - sal_Bool OAddessBookSourcePilot::connectToDataSource( sal_Bool _bForceReConnect ) - { - DBG_ASSERT( m_aNewDataSource.isValid(), "OAddessBookSourcePilot::implConnect: invalid current data source!" ); - - WaitObject aWaitCursor( this ); - if ( _bForceReConnect && m_aNewDataSource.isConnected( ) ) - m_aNewDataSource.disconnect( ); - - return m_aNewDataSource.connect( this ); - } - - //--------------------------------------------------------------------- - OWizardPage* OAddessBookSourcePilot::createPage(WizardState _nState) - { - switch (_nState) - { - case STATE_SELECT_ABTYPE: - return new TypeSelectionPage( this ); - - case STATE_INVOKE_ADMIN_DIALOG: - return new AdminDialogInvokationPage( this ); - - case STATE_TABLE_SELECTION: - return new TableSelectionPage( this ); - - case STATE_MANUAL_FIELD_MAPPING: - return new FieldMappingPage( this ); - - case STATE_FINAL_CONFIRM: - return new FinalPage( this ); - - default: - OSL_FAIL("OAddessBookSourcePilot::createPage: invalid state!"); - return NULL; - } - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::impl_updateRoadmap( AddressSourceType _eType ) - { - bool bSettingsPage = needAdminInvokationPage( _eType ); - bool bTablesPage = needTableSelection( _eType ); - bool bFieldsPage = needManualFieldMapping( _eType ); - - bool bConnected = m_aNewDataSource.isConnected(); - bool bCanSkipTables = - ( m_aNewDataSource.hasTable( m_aSettings.sSelectedTable ) - || m_aSettings.bIgnoreNoTable - ); - - enableState( STATE_INVOKE_ADMIN_DIALOG, bSettingsPage ); - - enableState( STATE_TABLE_SELECTION, - bTablesPage && ( bConnected ? !bCanSkipTables : !bSettingsPage ) - // if we do not need a settings page, we connect upon "Next" on the first page - ); - - enableState( STATE_MANUAL_FIELD_MAPPING, - bFieldsPage && bConnected && m_aNewDataSource.hasTable( m_aSettings.sSelectedTable ) - ); - - enableState( STATE_FINAL_CONFIRM, - bConnected && bCanSkipTables - ); - } - - //--------------------------------------------------------------------- - void OAddessBookSourcePilot::typeSelectionChanged( AddressSourceType _eType ) - { - PathId nCurrentPathID( PATH_COMPLETE ); - bool bSettingsPage = needAdminInvokationPage( _eType ); - bool bFieldsPage = needManualFieldMapping( _eType ); - if ( !bSettingsPage ) - if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_SETTINGS_NO_FIELDS; - else - nCurrentPathID = PATH_NO_SETTINGS; - else - if ( !bFieldsPage ) - nCurrentPathID = PATH_NO_FIELDS; - else - nCurrentPathID = PATH_COMPLETE; - activatePath( nCurrentPathID, true ); - - m_aNewDataSource.disconnect(); - m_aSettings.bIgnoreNoTable = false; - impl_updateRoadmap( _eType ); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx deleted file mode 100644 index 74c010e22..000000000 --- a/extensions/source/abpilot/abspilot.hxx +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABSPILOT_HXX -#define EXTENSIONS_ABSPILOT_HXX - -#include -#include -#include "addresssettings.hxx" -#include -#include "datasourcehandling.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OAddessBookSourcePilot - //===================================================================== - typedef ::svt::RoadmapWizard OAddessBookSourcePilot_Base; - class OAddessBookSourcePilot : public OAddessBookSourcePilot_Base - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - AddressSettings m_aSettings; - - ODataSource m_aNewDataSource; - AddressSourceType m_eNewDataSourceType; - - public: - /// ctor - OAddessBookSourcePilot( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - /// get the service factory which was used to create the dialog - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getORB() { return m_xORB; } - AddressSettings& getSettings() { return m_aSettings; } - const AddressSettings& getSettings() const { return m_aSettings; } - - const ODataSource& getDataSource() const { return m_aNewDataSource; } - - sal_Bool connectToDataSource( sal_Bool _bForceReConnect ); - - void travelNext( ) { OAddessBookSourcePilot_Base::travelNext(); } - - /// to be called when the selected type changed - void typeSelectionChanged( AddressSourceType _eType ); - - protected: - // OWizardMachine overridables - virtual ::svt::OWizardPage* createPage( WizardState _nState ); - virtual void enterState( WizardState _nState ); - virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); - virtual sal_Bool onFinish(); - - // RoadmapWizard - virtual String getStateDisplayName( WizardState _nState ) const; - - virtual sal_Bool Close(); - - private: - DECL_LINK( OnCancelClicked, void* ); - - /** creates a new data source of the type indicated by m_aSettings -

If another data source has been created before, this one is deleted.

- */ - void implCreateDataSource(); - - /// does an automatic field mapping (possible for all types except AST_OTHER) - void implDoAutoFieldMapping(); - - /// guesses a default for the table name, if no valid table is selected - void implDefaultTableName(); - - inline sal_Bool needAdminInvokationPage( AddressSourceType _eType ) const - { - return ( ( AST_LDAP == _eType ) - || ( AST_OTHER == _eType ) - ); - } - /// check if with the current settings, we would need to invoke he administration dialog for more details about the data source - inline sal_Bool needAdminInvokationPage() const - { - return needAdminInvokationPage( m_aSettings.eType ); - } - - inline sal_Bool needManualFieldMapping( AddressSourceType _eType ) const - { - return ( AST_OTHER == _eType ) || ( AST_KAB == _eType ) || - ( AST_EVOLUTION == _eType ) || ( AST_EVOLUTION_GROUPWISE == _eType ) || - ( AST_EVOLUTION_LDAP == _eType ); - } - /// checks if we need a manual (user-guided) field mapping - inline sal_Bool needManualFieldMapping() const - { - return needManualFieldMapping( m_aSettings.eType ); - } - - /// determines whether the given address book type does provide one table only - inline bool needTableSelection( AddressSourceType _eType ) const - { - return ( AST_LDAP != _eType ) && ( AST_KAB != _eType ); - } - - inline bool needTableSelection() const - { - return needTableSelection( m_aSettings.eType ); - } - - void implCleanup(); - void implCommitAll(); - - void impl_updateRoadmap( AddressSourceType _eType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABSPILOT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/abspilot.src b/extensions/source/abpilot/abspilot.src deleted file mode 100644 index c21980a94..000000000 --- a/extensions/source/abpilot/abspilot.src +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABPRESID_HRC -#include "abpresid.hrc" -#endif - -//........................................................................ -ModalDialog RID_DLG_ADDRESSBOOKSOURCEPILOT -{ - Text [ en-US ] = "Address Book Data Source Wizard" ; - - HelpId = HID_ABSPILOT; - - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE; - - String STR_SELECT_ABTYPE - { - Text [ en-US ] = "Address book type"; - }; - - String STR_INVOKE_ADMIN_DIALOG - { - Text [ en-US ] = "Connection Settings"; - }; - - String STR_TABLE_SELECTION - { - Text [ en-US ] = "Table selection"; - }; - - String STR_MANUAL_FIELD_MAPPING - { - Text [ en-US ] = "Field Assignment"; - }; - - String STR_FINAL_CONFIRM - { - Text [ en-US ] = "Data Source Title"; - }; -}; - -//........................................................................ -TabPage RID_PAGE_SELECTABTYPE -{ - HelpID = "extensions:TabPage:RID_PAGE_SELECTABTYPE"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_TYPE_HINTS - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "%PRODUCTNAME lets you access address data already present in your system. To do this, a %PRODUCTNAME data source will be created in which your address data is available in tabular form.\n\nThis wizard helps you create the data source."; - }; - - FixedLine FL_TYPE - { - Pos = MAP_APPFONT ( 7, 56 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 8 ) ; - - Text [ en-US ] = "Please select the type of your external address book:"; - }; - - RadioButton RB_EVOLUTION - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution"; - }; - RadioButton RB_EVOLUTION_GROUPWISE - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION_GROUPWISE"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Groupwise"; - }; - RadioButton RB_EVOLUTION_LDAP - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_EVOLUTION_LDAP"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Evolution LDAP"; - }; - RadioButton RB_MORK - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_MORK"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Mozilla / Netscape"; - }; - RadioButton RB_THUNDERBIRD - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_THUNDERBIRD"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Thunderbird"; - }; - RadioButton RB_KAB - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_KAB"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "KDE address book"; - }; - RadioButton RB_MACAB - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_MACAB"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Mac OS X address book"; - }; - RadioButton RB_LDAP - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_LDAP"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "LDAP address data"; - }; - RadioButton RB_OUTLOOK - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OUTLOOK"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Outlook address book"; - }; - RadioButton RB_OUTLOOKEXPRESS - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OUTLOOKEXPRESS"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Windows system address book"; - }; - RadioButton RB_OTHER - { - HelpID = "extensions:RadioButton:RID_PAGE_SELECTABTYPE:RB_OTHER"; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 30, 8 ) ; - Text [ en-US ] = "Other external data source"; - }; -}; - -//........................................................................ -TabPage RID_PAGE_ADMININVOKATION -{ - HelpID = "extensions:TabPage:RID_PAGE_ADMININVOKATION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_ADMINEXPLANATION - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 48 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "To set up the new data source, additional information is required.\n\nClick the following button to open another dialog in which you then enter the necessary information."; - }; - - PushButton PB_INVOKE_ADMIN_DIALOG - { - HelpID = "extensions:PushButton:RID_PAGE_ADMININVOKATION:PB_INVOKE_ADMIN_DIALOG"; - Pos = MAP_APPFONT ( ( WINDOW_SIZE_X - BUTTON_SIZE_X ) / 2, 60 ) ; - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ) ; - - Text [ en-US ] = "Settings"; - }; - - FixedText FT_ERROR - { - Pos = MAP_APPFONT ( BORDER_X, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 48 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 48 ) ; - WordBreak = TRUE; - Hide = TRUE; - - Text [ en-US ] = "The connection to the data source could not be established.\nBefore you proceed, please check the settings made, or (on the previous page) choose another address data source type."; - }; -}; - -//........................................................................ -TabPage RID_PAGE_TABLESELECTION_AB -{ - HelpID = "extensions:TabPage:RID_PAGE_TABLESELECTION_AB"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FL_TOOMUCHTABLES - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "The external data source you have chosen contains more than one address book.\nPlease select the one you mainly want to work with:"; - }; - - ListBox LB_TABLELIST - { - HelpID = "extensions:ListBox:RID_PAGE_TABLESELECTION_AB:LB_TABLELIST"; - Pos = MAP_APPFONT ( BORDER_X, 36 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 50 ) ; - SVLook = TRUE; - Sort = TRUE; - DropDown = FALSE; - AutoHScroll = TRUE; - Border = TRUE; - }; -}; - -//........................................................................ -TabPage RID_PAGE_FIELDMAPPING -{ - HelpID = "extensions:TabPage:RID_PAGE_FIELDMAPPING"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_FIELDASSIGMENTEXPL - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 72 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "To incorporate the address data in your templates, %PRODUCTNAME has to know which fields contain which data.\n\nFor instance, you could have stored the e-mail addresses in a field named \"email\", or \"E-mail\" or \"EM\" - or something completely different.\n\nClick the button below to open another dialog where you can enter the settings for your data source."; - }; - - PushButton PB_INVOKE_FIELDS_DIALOG - { - HelpID = "extensions:PushButton:RID_PAGE_FIELDMAPPING:PB_INVOKE_FIELDS_DIALOG"; - Pos = MAP_APPFONT ( ( WINDOW_SIZE_X - BUTTON_SIZE_X ) / 2, 84 ) ; - Size = MAP_APPFONT ( BUTTON_SIZE_X, BUTTON_SIZE_Y ) ; - - Text [ en-US ] = "Field Assignment"; - }; - - FixedText FT_ASSIGNEDFIELDS - { - Pos = MAP_APPFONT ( BORDER_X, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 32 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 32 ) ; - WordBreak = TRUE; - }; -}; - -//........................................................................ -TabPage RID_PAGE_FINAL -{ - HelpID = "extensions:TabPage:RID_PAGE_FINAL"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - FixedText FT_FINISH_EXPL - { - Pos = MAP_APPFONT ( BORDER_X, 9 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 40 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "That was all the information necessary to integrate your address data into %PRODUCTNAME.\n\nNow, just enter the name under which you want to register the data source in %PRODUCTNAME."; - }; - - FixedText FT_LOCATION - { - Pos = MAP_APPFONT ( BORDER_X, 53 ) ; - Size = MAP_APPFONT ( 50, 8 ) ; - Group = TRUE; - - Text [ en-US ] = "Location"; - }; - - ComboBox CBB_LOCATION - { - HelpID = "extensions:ComboBox:RID_PAGE_FINAL:CBB_LOCATION"; - Pos = MAP_APPFONT ( BORDER_X , 64 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 53 - BORDER_X - BORDER_X, 12) ; - SVLook = TRUE; - Border = TRUE; - DropDown = TRUE ; - AutoHScroll = TRUE ; - }; - - PushButton PB_BROWSE - { - HelpID = "extensions:PushButton:RID_PAGE_FINAL:PB_BROWSE"; - Pos = MAP_APPFONT ( WINDOW_SIZE_X - 50 - BORDER_X , 63 ) ; - Size = MAP_APPFONT ( 50, 14) ; - SVLook = TRUE; - Group = FALSE; - - Text [ en-US ] = "Browse..."; - }; - - CheckBox CB_REGISTER_DS - { - HelpID = "extensions:CheckBox:RID_PAGE_FINAL:CB_REGISTER_DS"; - Pos = MAP_APPFONT ( BORDER_X, 82 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X, 8) ; - SVLook = TRUE; - Group = TRUE; - - Text [ en-US ] = "Make this address book available to all modules in %PRODUCTNAME."; - }; - FixedText FT_NAME_EXPL - { - Pos = MAP_APPFONT ( BORDER_X + 10, 93 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - BORDER_X - BORDER_X - 10, 8 ) ; - - Text [ en-US ] = "Address book name"; - }; - - Edit ET_DATASOURCENAME - { - HelpID = "extensions:Edit:RID_PAGE_FINAL:ET_DATASOURCENAME"; - Pos = MAP_APPFONT ( BORDER_X + 10, 104 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 56 - BORDER_X - BORDER_X - 10, 12) ; - SVLook = TRUE; - Border = TRUE; - }; - - FixedText FT_DUPLICATENAME - { - Pos = MAP_APPFONT ( BORDER_X + 10, WINDOW_SIZE_Y - HEADER_SIZE_Y - 7 - 24 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 2 * BORDER_X, 24) ; - WordBreak = TRUE; - Hide = TRUE; - Group = FALSE; - - Text [ en-US ] = "Another data source already has this name. As data sources have to have globally unique names, you need to choose another one."; - }; -}; - -//........................................................................ -ErrorBox RID_ERR_NEEDTYPESELECTION -{ - Buttons = WB_OK; - - Message [ en-US ] = "Please select a type of address book."; -}; - -//........................................................................ -QueryBox RID_QRY_NOTABLES -{ - Buttons = WB_YES_NO; - DefButton = WB_DEF_NO; - - Message [ en-US ] = "The data source does not contain any tables.\nDo you want to set it up as an address data source, anyway?"; -}; - -//........................................................................ -QueryBox RID_QRY_NO_EVO_GW -{ - Buttons = WB_YES_NO; - DefButton = WB_DEF_NO; - - Message [ en-US ] = "You don't seem to have any GroupWise account configured in Evolution.\nDo you want to set it up as an address data source, anyway?"; -}; - -//........................................................................ -String RID_STR_DEFAULT_NAME -{ - Text [ en-US ] = "Addresses"; -}; - -String RID_STR_ADMINDIALOGTITLE -{ - Text [ en-US ] = "Create Address Data Source"; -}; - -String RID_STR_NOCONNECTION -{ - Text [ en-US ] = "The connection could not be established."; -}; - -String RID_STR_PLEASECHECKSETTINGS -{ - Text [ en-US ] = "Please check the settings made for the data source."; -}; - -String RID_STR_FIELDDIALOGTITLE -{ - Text [ en-US ] = "Address Data - Field Assignment"; -}; - -String RID_STR_NOFIELDSASSIGNED -{ - Text [ en-US ] = "There are no fields assigned at this time.\nYou can either assign fields now or do so later by first choosing:\n\"File - Template - Address Book Source...\""; -}; - -//........................................................................ -Bitmap BMP_HEADERIMAGE -{ - file = "addresspilot.bmp"; -}; diff --git a/extensions/source/abpilot/addresssettings.hxx b/extensions/source/abpilot/addresssettings.hxx deleted file mode 100644 index 9c05144be..000000000 --- a/extensions/source/abpilot/addresssettings.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADDRESSSETTINGS_HXX -#define EXTENSIONS_ABP_ADDRESSSETTINGS_HXX - -#include -#include "abptypes.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AddressSourceType - //===================================================================== - enum AddressSourceType - { - AST_MORK, - AST_THUNDERBIRD, - AST_EVOLUTION, - AST_EVOLUTION_GROUPWISE, - AST_EVOLUTION_LDAP, - AST_KAB, - AST_MACAB, - AST_LDAP, - AST_OUTLOOK, - AST_OE, - - AST_OTHER, - - AST_INVALID - }; - - //===================================================================== - //= AddressSettings - //===================================================================== - struct AddressSettings - { - AddressSourceType eType; - ::rtl::OUString sDataSourceName; - ::rtl::OUString sRegisteredDataSourceName; - ::rtl::OUString sSelectedTable; - bool bIgnoreNoTable; - MapString2String aFieldMapping; - bool bRegisterDataSource; - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADDRESSSETTINGS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx deleted file mode 100644 index 61ef82dca..000000000 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "admininvokationimpl.hxx" -#include -#include -#include -#include -#include -#include -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include - - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::ui::dialogs; - - //===================================================================== - //= OAdminDialogInvokation - //===================================================================== - //--------------------------------------------------------------------- - OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XMultiServiceFactory >& _rxORB - , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource - , Window* _pMessageParent) - :m_xORB(_rxORB) - ,m_xDataSource(_xDataSource) - ,m_pMessageParent(_pMessageParent) - { - DBG_ASSERT(m_xORB.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); - DBG_ASSERT(m_xDataSource.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid preferred name!"); - DBG_ASSERT(m_pMessageParent, "OAdminDialogInvokation::OAdminDialogInvokation: invalid message parent!"); - } - - //--------------------------------------------------------------------- - sal_Bool OAdminDialogInvokation::invokeAdministration( sal_Bool _bFixedType ) - { - if (!m_xORB.is()) - return sal_False; - - try - { - // the service name of the administration dialog - const static ::rtl::OUString s_sAdministrationServiceName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatasourceAdministrationDialog")); - const static ::rtl::OUString s_sDataSourceTypeChangeDialog = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DataSourceTypeChangeDialog")); - - // the parameters for the call - Sequence< Any > aArguments(3); - Any* pArguments = aArguments.getArray(); - - // the parent window - Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface(m_pMessageParent); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), -1, makeAny(xDialogParent), PropertyState_DIRECT_VALUE); - - // the title of the dialog - String sAdminDialogTitle(ModuleRes(RID_STR_ADMINDIALOGTITLE)); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), -1, makeAny(::rtl::OUString(sAdminDialogTitle)), PropertyState_DIRECT_VALUE); - - // the name of the new data source - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InitialSelection")), -1, makeAny(m_xDataSource), PropertyState_DIRECT_VALUE); - - // create the dialog - Reference< XExecutableDialog > xDialog; - { - // creating the dialog service is potentially expensive (if all the libraries invoked need to be loaded) - // so we display a wait cursor - WaitObject aWaitCursor(m_pMessageParent); - xDialog = Reference< XExecutableDialog >( m_xORB->createInstanceWithArguments( _bFixedType ? s_sAdministrationServiceName : s_sDataSourceTypeChangeDialog, aArguments ), UNO_QUERY ); - - // just for a smoother UI: What the dialog does upon execution, is (amongst other things) creating - // the DriverManager service - // If this context has never been accessed before, this may be expensive (it includes loading of - // at least one library). - // As this wizard is intended to run on the first office start, it is very likely that the - // context needs to be freshly created - // Thus, we access the context here (within the WaitCursor), which means the user sees a waitcursor - // while his/her office blocks a few seconds .... - m_xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.DriverManager" )) ); - } - - if (xDialog.is()) - { // execute it - if (xDialog->execute()) - return sal_True; - } - else - ShowServiceNotAvailableError(m_pMessageParent, s_sAdministrationServiceName, sal_True); - } - catch(const Exception&) - { - OSL_FAIL("OAdminDialogInvokation::invokeAdministration: caught an exception while executing the dialog!"); - } - return sal_False; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx deleted file mode 100644 index 760d2270e..000000000 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX -#define EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX - -#include -#include - - -class Window; -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OAdminDialogInvokation - //===================================================================== - /** outsourced from AdminDialogInvokationPage, 'cause this class here, in opposite to - the page, needs exception handlíng to be enabled. - */ - class OAdminDialogInvokation - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource; - Window* m_pMessageParent; - - public: - OAdminDialogInvokation( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource, - Window* _pMessageParent - ); - - sal_Bool invokeAdministration( sal_Bool _bFixedType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationpage.cxx b/extensions/source/abpilot/admininvokationpage.cxx deleted file mode 100644 index 872c05050..000000000 --- a/extensions/source/abpilot/admininvokationpage.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "admininvokationpage.hxx" -#include "abspilot.hxx" -#include "admininvokationimpl.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AdminDialogInvokationPage - //===================================================================== - AdminDialogInvokationPage::AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_ADMININVOKATION)) - ,m_aExplanation (this, ModuleRes(FT_ADMINEXPLANATION)) - ,m_aInvokeAdminDialog (this, ModuleRes(PB_INVOKE_ADMIN_DIALOG)) - ,m_aErrorMessage (this, ModuleRes(FT_ERROR)) - ,m_bSuccessfullyExecutedDialog(sal_False) - { - FreeResource(); - - m_aInvokeAdminDialog.SetClickHdl( LINK(this, AdminDialogInvokationPage, OnInvokeAdminDialog) ); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - m_aInvokeAdminDialog.GrabFocus(); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::implUpdateErrorMessage() - { - const sal_Bool bIsConnected = getDialog()->getDataSource().isConnected(); - m_aErrorMessage.Show( !bIsConnected ); - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::initializePage() - { - AddressBookSourcePage::initializePage(); - m_aErrorMessage.Hide(); - // if we're entering this page, we assume we had no connection trial with this data source - } - - //--------------------------------------------------------------------- - void AdminDialogInvokationPage::implTryConnect() - { - getDialog()->connectToDataSource( sal_True ); - - // show our error message if and only if we could not connect - implUpdateErrorMessage(); - - // the status of the next button may have changed - updateDialogTravelUI(); - - // automatically go to the next page (if successfully connected) - if ( canAdvance() ) - getDialog()->travelNext(); - } - - //--------------------------------------------------------------------- - bool AdminDialogInvokationPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() && getDialog()->getDataSource().isConnected(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ ) - { - OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() ); - if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) ) - { - // try to connect to this data source - implTryConnect(); - } - - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/admininvokationpage.hxx b/extensions/source/abpilot/admininvokationpage.hxx deleted file mode 100644 index ac435be2c..000000000 --- a/extensions/source/abpilot/admininvokationpage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX -#define EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX - -#include "abspage.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= AdminDialogInvokationPage - //===================================================================== - class AdminDialogInvokationPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - PushButton m_aInvokeAdminDialog; - FixedText m_aErrorMessage; - - sal_Bool m_bSuccessfullyExecutedDialog; - - public: - AdminDialogInvokationPage( OAddessBookSourcePilot* _pParent ); - - protected: - // TabDialog overridables - virtual void ActivatePage(); - virtual void initializePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnInvokeAdminDialog, void* ); - - void implTryConnect(); - void implUpdateErrorMessage(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_ADMINDIALOG_INVOKATION_PAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx deleted file mode 100644 index b65635bb6..000000000 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ /dev/null @@ -1,641 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "abpresid.hrc" -#include "abptypes.hxx" -#include "componentmodule.hxx" -#include "datasourcehandling.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::utl; - using namespace ::comphelper; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::task; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::frame; - - //===================================================================== - struct PackageAccessControl { }; - - //===================================================================== - //--------------------------------------------------------------------- - static Reference< XNameAccess > lcl_getDataSourceContext( const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW (( Exception )) - { - Reference< XNameAccess > xContext( _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DatabaseContext" )) ), UNO_QUERY ); - DBG_ASSERT(xContext.is(), "lcl_getDataSourceContext: could not access the data source context!"); - return xContext; - } - - //--------------------------------------------------------------------- - /// creates a new data source and inserts it into the context - static void lcl_implCreateAndInsert( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName, - Reference< XPropertySet >& /* [out] */ _rxNewDataSource ) SAL_THROW (( ::com::sun::star::uno::Exception )) - { - //............................................................. - // get the data source context - Reference< XNameAccess > xContext = lcl_getDataSourceContext( _rxORB ); - - DBG_ASSERT( !xContext->hasByName( _rName ), "lcl_implCreateAndInsert: name already used!" ); - (void)_rName; - - //............................................................. - // create a new data source - Reference< XSingleServiceFactory > xFactory( xContext, UNO_QUERY ); - Reference< XPropertySet > xNewDataSource; - if (xFactory.is()) - xNewDataSource = Reference< XPropertySet >( xFactory->createInstance(), UNO_QUERY ); - DBG_ASSERT( xNewDataSource.is(), "lcl_implCreateAndInsert: could not create a new data source!" ); - - //............................................................. - // insert the data source into the context - Reference< XNamingService > xDynamicContext( xContext, UNO_QUERY ); - DBG_ASSERT( xDynamicContext.is(), "lcl_implCreateAndInsert: missing an interface on the context (XNamingService)!" ); - if (xDynamicContext.is()) - { - // xDynamicContext->registerObject( _rName, xNewDataSource ); - _rxNewDataSource = xNewDataSource; - } - } - - //--------------------------------------------------------------------- - /// creates and inserts a data source, and sets it's URL property to the string given - static ODataSource lcl_implCreateAndSetURL( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName, - const sal_Char* _pInitialAsciiURL ) SAL_THROW (( )) - { - ODataSource aReturn( _rxORB ); - try - { - // create the new data source - Reference< XPropertySet > xNewDataSource; - lcl_implCreateAndInsert( _rxORB, _rName, xNewDataSource ); - - //............................................................. - // set the URL property - if (xNewDataSource.is()) - { - xNewDataSource->setPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" )), - makeAny( ::rtl::OUString::createFromAscii( _pInitialAsciiURL ) ) - ); - } - - aReturn.setDataSource( xNewDataSource, _rName,PackageAccessControl() ); - } - catch(const Exception&) - { - OSL_FAIL( "lcl_implCreateAndSetURL: caught an exception while creating the data source!" ); - } - - return aReturn; - } - //--------------------------------------------------------------------- - void lcl_registerDataSource( - const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _sName, - const ::rtl::OUString& _sURL ) SAL_THROW (( ::com::sun::star::uno::Exception )) - { - OSL_ENSURE( _sName.getLength(), "lcl_registerDataSource: invalid name!" ); - OSL_ENSURE( _sURL.getLength(), "lcl_registerDataSource: invalid URL!" ); - try - { - - ::comphelper::ComponentContext aContext( _rxORB ); - Reference< XDatabaseRegistrations > xRegistrations( - aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); - - if ( xRegistrations->hasRegisteredDatabase( _sName ) ) - xRegistrations->changeDatabaseLocation( _sName, _sURL ); - else - xRegistrations->registerDatabaseLocation( _sName, _sURL ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //===================================================================== - //= ODataSourceContextImpl - //===================================================================== - struct ODataSourceContextImpl - { - Reference< XMultiServiceFactory > xORB; - Reference< XNameAccess > xContext; /// the UNO data source context - StringBag aDataSourceNames; /// for quicker name checks (without the UNO overhead) - - ODataSourceContextImpl( const Reference< XMultiServiceFactory >& _rxORB ) : xORB( _rxORB ) { } - ODataSourceContextImpl( const ODataSourceContextImpl& _rSource ) - :xORB ( _rSource.xORB ) - ,xContext ( _rSource.xContext ) - { - } - }; - - //===================================================================== - //= ODataSourceContext - //===================================================================== - //--------------------------------------------------------------------- - ODataSourceContext::ODataSourceContext(const Reference< XMultiServiceFactory >& _rxORB) - :m_pImpl( new ODataSourceContextImpl( _rxORB ) ) - { - try - { - // create the UNO context - m_pImpl->xContext = lcl_getDataSourceContext( _rxORB ); - - if (m_pImpl->xContext.is()) - { - // collect the data source names - Sequence< ::rtl::OUString > aDSNames = m_pImpl->xContext->getElementNames(); - const ::rtl::OUString* pDSNames = aDSNames.getConstArray(); - const ::rtl::OUString* pDSNamesEnd = pDSNames + aDSNames.getLength(); - - for ( ;pDSNames != pDSNamesEnd; ++pDSNames ) - m_pImpl->aDataSourceNames.insert( *pDSNames ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "ODataSourceContext::ODataSourceContext: caught an exception!" ); - } - } - - //--------------------------------------------------------------------- - ::rtl::OUString& ODataSourceContext::disambiguate(::rtl::OUString& _rDataSourceName) - { - ::rtl::OUString sCheck( _rDataSourceName ); - ConstStringBagIterator aPos = m_pImpl->aDataSourceNames.find( sCheck ); - - sal_Int32 nPostFix = 1; - while ( ( m_pImpl->aDataSourceNames.end() != aPos ) && ( nPostFix < 65535 ) ) - { // there already is a data source with this name - sCheck = _rDataSourceName; - sCheck += ::rtl::OUString::valueOf( nPostFix++ ); - - aPos = m_pImpl->aDataSourceNames.find( sCheck ); - } - - _rDataSourceName = sCheck; - return _rDataSourceName; - } - - //--------------------------------------------------------------------- - void ODataSourceContext::getDataSourceNames( StringBag& _rNames ) const SAL_THROW (( )) - { - _rNames = m_pImpl->aDataSourceNames; - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewLDAP( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:ldap:" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewMORK( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:mozilla" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewThunderbird( const ::rtl::OUString& _rName ) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:thunderbird" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolutionLdap( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:ldap" ); - } - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolutionGroupwise( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:groupwise" ); - } - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewEvolution( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:evolution:local" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewKab( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:kab" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewMacab( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:macab" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewOutlook( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:outlook" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewOE( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:address:outlookexp" ); - } - - //--------------------------------------------------------------------- - ODataSource ODataSourceContext::createNewDBase( const ::rtl::OUString& _rName) SAL_THROW (( )) - { - return lcl_implCreateAndSetURL( m_pImpl->xORB, _rName, "sdbc:dbase:" ); - } - - //===================================================================== - //= ODataSourceImpl - //===================================================================== - struct ODataSourceImpl - { - public: - Reference< XMultiServiceFactory > xORB; /// the service factory - Reference< XPropertySet > xDataSource; /// the UNO data source - ::utl::SharedUNOComponent< XConnection > - xConnection; - StringBag aTables; // the cached table names - ::rtl::OUString sName; - sal_Bool bTablesUpToDate; // table name cache up-to-date? - - ODataSourceImpl( const Reference< XMultiServiceFactory >& _rxORB ) - :xORB( _rxORB ) - ,bTablesUpToDate( sal_False ) - { - } - - ODataSourceImpl( const ODataSourceImpl& _rSource ); - }; - - //--------------------------------------------------------------------- - ODataSourceImpl::ODataSourceImpl( const ODataSourceImpl& _rSource ) - :xORB( _rSource.xORB ) - ,xDataSource( _rSource.xDataSource ) - ,xConnection( _rSource.xConnection ) - ,aTables( _rSource.aTables ) - ,sName( _rSource.sName ) - ,bTablesUpToDate( _rSource.bTablesUpToDate ) - { - } - - //===================================================================== - //= ODataSource - //===================================================================== - //--------------------------------------------------------------------- - ODataSource::ODataSource( const ODataSource& _rSource ) - :m_pImpl( NULL ) - { - *this = _rSource; - } - - //--------------------------------------------------------------------- - ODataSource& ODataSource::operator=( const ODataSource& _rSource ) - { - if( this != &_rSource ) - { - delete m_pImpl; - m_pImpl = new ODataSourceImpl( *_rSource.m_pImpl ); - } - return *this; - } - - //--------------------------------------------------------------------- - ODataSource::ODataSource( const Reference< XMultiServiceFactory >& _rxORB ) - :m_pImpl(new ODataSourceImpl(_rxORB)) - { - } - - //--------------------------------------------------------------------- - ODataSource::~ODataSource( ) - { - delete m_pImpl; - } - - //--------------------------------------------------------------------- - void ODataSource::store() SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - try - { - Reference< XDocumentDataSource > xDocAccess( m_pImpl->xDataSource, UNO_QUERY ); - Reference< XStorable > xStorable; - if ( xDocAccess.is() ) - xStorable = xStorable.query( xDocAccess->getDatabaseDocument() ); - OSL_ENSURE( xStorable.is(),"DataSource is no XStorable!" ); - if ( xStorable.is() ) - xStorable->storeAsURL(m_pImpl->sName,Sequence()); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::registerDataSource: caught an exception while creating the data source!" ); - } - } - //--------------------------------------------------------------------- - void ODataSource::registerDataSource( const ::rtl::OUString& _sRegisteredDataSourceName) SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - - try - { - // invalidate ourself - lcl_registerDataSource(m_pImpl->xORB,_sRegisteredDataSourceName,m_pImpl->sName); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::registerDataSource: caught an exception while creating the data source!" ); - } - } - - //--------------------------------------------------------------------- - void ODataSource::setDataSource( const Reference< XPropertySet >& _rxDS,const ::rtl::OUString& _sName, PackageAccessControl ) - { - if (m_pImpl->xDataSource.get() == _rxDS.get()) - // nothing to do - return; - - if ( isConnected() ) - disconnect(); - - m_pImpl->sName = _sName; - m_pImpl->xDataSource = _rxDS; - } - - //--------------------------------------------------------------------- - void ODataSource::remove() SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return; - - try - { - // invalidate ourself - m_pImpl->xDataSource.clear(); - } - catch(const Exception&) - { - OSL_FAIL( "ODataSource::remove: caught an exception while creating the data source!" ); - } - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::rename( const ::rtl::OUString& _rName ) SAL_THROW (( )) - { - if (!isValid()) - // nothing to do - return sal_False; - - m_pImpl->sName = _rName; - return sal_True; - } - - //--------------------------------------------------------------------- - ::rtl::OUString ODataSource::getName() const SAL_THROW (( )) - { - if ( !isValid() ) - return ::rtl::OUString(); - return m_pImpl->sName; - } - - //--------------------------------------------------------------------- - bool ODataSource::hasTable( const ::rtl::OUString& _rTableName ) const - { - if ( !isConnected() ) - return false; - - const StringBag& aTables( getTableNames() ); - return aTables.find( _rTableName ) != aTables.end(); - } - - //--------------------------------------------------------------------- - const StringBag& ODataSource::getTableNames() const SAL_THROW (( )) - { - m_pImpl->aTables.clear(); - if ( !isConnected() ) - { - OSL_FAIL( "ODataSource::getTableNames: not connected!" ); - } - else - { - try - { - // get the tables container from the connection - Reference< XTablesSupplier > xSuppTables( m_pImpl->xConnection.getTyped(), UNO_QUERY ); - Reference< XNameAccess > xTables; - if ( xSuppTables.is( ) ) - xTables = xSuppTables->getTables(); - DBG_ASSERT( xTables.is(), "ODataSource::getTableNames: could not retrieve the tables container!" ); - - // get the names - Sequence< ::rtl::OUString > aTableNames; - if ( xTables.is( ) ) - aTableNames = xTables->getElementNames( ); - - // copy the names - const ::rtl::OUString* pTableNames = aTableNames.getConstArray(); - const ::rtl::OUString* pTableNamesEnd = pTableNames + aTableNames.getLength(); - for (;pTableNames < pTableNamesEnd; ++pTableNames) - m_pImpl->aTables.insert( *pTableNames ); - } - catch(const Exception&) - { - } - } - - // now the table cache is up-to-date - m_pImpl->bTablesUpToDate = sal_True; - return m_pImpl->aTables; - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::connect( Window* _pMessageParent ) SAL_THROW (( )) - { - if ( isConnected( ) ) - // nothing to do - return sal_True; - - // ................................................................ - // create the interaction handler (needed for authentication and error handling) - static ::rtl::OUString s_sInteractionHandlerServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")); - Reference< XInteractionHandler > xInteractions; - try - { - xInteractions = Reference< XInteractionHandler >( - m_pImpl->xORB->createInstance( s_sInteractionHandlerServiceName ), - UNO_QUERY - ); - } - catch(const Exception&) - { - } - - // ................................................................ - // failure to create the interaction handler is a serious issue ... - if (!xInteractions.is()) - { - if ( _pMessageParent ) - ShowServiceNotAvailableError( _pMessageParent, s_sInteractionHandlerServiceName, sal_True ); - return sal_False; - } - - // ................................................................ - // open the connection - Any aError; - Reference< XConnection > xConnection; - try - { - Reference< XCompletedConnection > xComplConn( m_pImpl->xDataSource, UNO_QUERY ); - DBG_ASSERT( xComplConn.is(), "ODataSource::connect: missing the XCompletedConnection interface on the data source!" ); - if ( xComplConn.is() ) - xConnection = xComplConn->connectWithCompletion( xInteractions ); - } - catch( const SQLContext& e ) { aError <<= e; } - catch( const SQLWarning& e ) { aError <<= e; } - catch( const SQLException& e ) { aError <<= e; } - catch( const Exception& ) - { - OSL_FAIL( "ODataSource::connect: caught a generic exception!" ); - } - - // ................................................................ - // handle errors - if ( aError.hasValue() && _pMessageParent ) - { - try - { - SQLException aException; - aError >>= aException; - if ( !aException.Message.getLength() ) - { - // prepend some context info - SQLContext aDetailedError; - aDetailedError.Message = String( ModuleRes( RID_STR_NOCONNECTION ) ); - aDetailedError.Details = String( ModuleRes( RID_STR_PLEASECHECKSETTINGS ) ); - aDetailedError.NextException = aError; - // handle (aka display) the new context info - xInteractions->handle( new OInteractionRequest( makeAny( aDetailedError ) ) ); - } - else - { - // handle (aka display) the original error - xInteractions->handle( new OInteractionRequest( makeAny( aException ) ) ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "ODataSource::connect: caught an exception while trying to display the error!" ); - } - } - - if ( !xConnection.is() ) - return sal_False; - - // ................................................................ - // success - m_pImpl->xConnection.reset( xConnection ); - m_pImpl->aTables.clear(); - m_pImpl->bTablesUpToDate = sal_False; - - return sal_True; - } - - //--------------------------------------------------------------------- - void ODataSource::disconnect( ) SAL_THROW (( )) - { - m_pImpl->xConnection.clear(); - m_pImpl->aTables.clear(); - m_pImpl->bTablesUpToDate = sal_False; - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::isConnected( ) const SAL_THROW (( )) - { - return m_pImpl->xConnection.is(); - } - - //--------------------------------------------------------------------- - sal_Bool ODataSource::isValid() const SAL_THROW (( )) - { - return m_pImpl && m_pImpl->xDataSource.is(); - } - //--------------------------------------------------------------------- - Reference< XPropertySet > ODataSource::getDataSource() const SAL_THROW (( )) - { - return m_pImpl ? m_pImpl->xDataSource : Reference< XPropertySet >(); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx deleted file mode 100644 index cce6253bb..000000000 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_DATASOURCEHANDLING_HXX -#define EXTENSIONS_ABP_DATASOURCEHANDLING_HXX - -#include -#include "abptypes.hxx" - -//======================================================================== -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } - namespace beans { - class XPropertySet; - } -} } } - -class Window; - - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= ODataSourceContext - //===================================================================== - struct ODataSourceContextImpl; - class ODataSource; - /// a non-UNO wrapper for the data source context - class ODataSourceContext - { - private: - ODataSourceContextImpl* m_pImpl; - - public: - ODataSourceContext( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - /// retrieves the names of all data sources - void getDataSourceNames( StringBag& _rNames ) const SAL_THROW (( )); - - /// disambiguates the given name by appending auccessive numbers - ::rtl::OUString& disambiguate(::rtl::OUString& _rDataSourceName); - - /// creates a new MORK data source - ODataSource createNewMORK( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Thunderbird data source - ODataSource createNewThunderbird( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution local data source - ODataSource createNewEvolution( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution LDAP data source - ODataSource createNewEvolutionLdap( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Evolution GROUPWISE data source - ODataSource createNewEvolutionGroupwise( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new KDE address book data source - ODataSource createNewKab( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Mac OS X address book data source - ODataSource createNewMacab( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new LDAP data source - ODataSource createNewLDAP( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Outlook data source - ODataSource createNewOutlook( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new Outlook express data source - ODataSource createNewOE( const ::rtl::OUString& _rName ) SAL_THROW (( )); - - /// creates a new dBase data source - ODataSource createNewDBase( const ::rtl::OUString& _rName ) SAL_THROW (( )); - }; - - //===================================================================== - //= ODataSource - //===================================================================== - struct ODataSourceImpl; - struct PackageAccessControl; - /** a non-UNO wrapper for a data source -

This class allows to access data sources without the need to compile the respective file with - exception handling enabled (hopefully :).

-

In addition to wrapping an UNO data source, an instance of this class can handle at most - one valid connection, as obtained from the data source.

- */ - class ODataSource - { - private: - ODataSourceImpl* m_pImpl; - - public: - // ---------------------------------------------------------------- - // - ctor/dtor/assignment - // ---------------------------------------------------------------- - /// constructs an object which is initially invalid - ODataSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - /// copy ctor - ODataSource( const ODataSource& _rSource ); - - /// dtor - ~ODataSource( ); - - /// assignment - ODataSource& operator=( const ODataSource& _rSource ); - - // ---------------------------------------------------------------- - /// checks whether or not the object represents a valid data source - sal_Bool isValid() const SAL_THROW (( )); - - // ---------------------------------------------------------------- - /// removes the data source represented by the object from the data source context - void remove() SAL_THROW (( )); - // TODO: put this into the context class - - /// returns the name of the data source - ::rtl::OUString - getName() const SAL_THROW (( )); - - /// renames the data source - sal_Bool rename( const ::rtl::OUString& _rName ) SAL_THROW (( )); - // TODO: put this into the context class - - // ---------------------------------------------------------------- - // - connection handling - // ---------------------------------------------------------------- - /** connects to the data source represented by this object - @param _pMessageParent - the window to use as parent for any error messages. If this is , no messages are displayed - at all. - @see isConnected - */ - sal_Bool connect( Window* _pMessageParent ) SAL_THROW (( )); - - /// returns if the object has a valid connection, obtained from it's data source - sal_Bool isConnected( ) const SAL_THROW (( )); - - /// disconnects from the data source (i.e. disposes the UNO connection hold internally) - void disconnect( ) SAL_THROW (( )); - - /// stores the database file - void store() SAL_THROW (( )); - - /// register the data source under the given name in the configuration - void registerDataSource( const ::rtl::OUString& _sRegisteredDataSourceName ) SAL_THROW (( )); - - // ---------------------------------------------------------------- - /** retrieves the tables names from the connection -

to be called when isConnection returns only

- */ - const StringBag& getTableNames() const SAL_THROW (( )); - - /** determines whether a given table exists - */ - bool hasTable( const ::rtl::OUString& _rTableName ) const; - - /// return the intern data source object - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataSource() const SAL_THROW (( )); - - - // ---------------------------------------------------------------- - /** set a new data source. -

Available to selected clients only

- */ - void setDataSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDS - ,const ::rtl::OUString& _sName - ,PackageAccessControl - ); - - private: - ODataSource( ); // never implemented - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_DATASOURCEHANDLING_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/exports.dxp b/extensions/source/abpilot/exports.dxp deleted file mode 100644 index 700330789..000000000 --- a/extensions/source/abpilot/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx deleted file mode 100644 index f5c64323f..000000000 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ /dev/null @@ -1,372 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "fieldmappingimpl.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "abpresid.hrc" -#include "componentmodule.hxx" -#include -#include "sal/macros.h" - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::utl; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::ui::dialogs; - - //--------------------------------------------------------------------- - static const ::rtl::OUString& lcl_getDriverSettingsNodeName() - { - static const ::rtl::OUString s_sDriverSettingsNodeName(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver" )); - return s_sDriverSettingsNodeName; - } - - //--------------------------------------------------------------------- - static const ::rtl::OUString& lcl_getAddressBookNodeName() - { - static const ::rtl::OUString s_sAddressBookNodeName(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/AddressBook" )); - return s_sAddressBookNodeName; - } - - //..................................................................... - namespace fieldmapping - { - //..................................................................... - - //----------------------------------------------------------------- - sal_Bool invokeDialog( const Reference< XMultiServiceFactory >& _rxORB, class Window* _pParent, - const Reference< XPropertySet >& _rxDataSource, AddressSettings& _rSettings ) SAL_THROW ( ( ) ) - { - _rSettings.aFieldMapping.clear(); - - DBG_ASSERT( _rxORB.is(), "fieldmapping::invokeDialog: invalid service factory!" ); - DBG_ASSERT( _rxDataSource.is(), "fieldmapping::invokeDialog: invalid data source!" ); - if ( !_rxORB.is() || !_rxDataSource.is() ) - return sal_False; - - try - { - // ........................................................ - // the parameters for creating the dialog - Sequence< Any > aArguments(5); - Any* pArguments = aArguments.getArray(); - - // the parent window - Reference< XWindow > xDialogParent = VCLUnoHelper::GetInterface( _pParent ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), -1, makeAny( xDialogParent ), PropertyState_DIRECT_VALUE); - - // the data source to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSource" )), -1, makeAny( _rxDataSource ), PropertyState_DIRECT_VALUE); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" )), -1, makeAny( (sal_Bool)_rSettings.bRegisterDataSource ? _rSettings.sRegisteredDataSourceName : _rSettings.sDataSourceName ), PropertyState_DIRECT_VALUE); - - // the table to use - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Command" )), -1, makeAny( _rSettings.sSelectedTable ), PropertyState_DIRECT_VALUE); - - // the title - ::rtl::OUString sTitle = String( ModuleRes( RID_STR_FIELDDIALOGTITLE ) ); - *pArguments++ <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )), -1, makeAny( sTitle ), PropertyState_DIRECT_VALUE); - - // ........................................................ - // create an instance of the dialog service - static ::rtl::OUString s_sAdressBookFieldAssignmentServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" )); - Reference< XExecutableDialog > xDialog( - _rxORB->createInstanceWithArguments( s_sAdressBookFieldAssignmentServiceName, aArguments ), - UNO_QUERY - ); - if ( !xDialog.is( ) ) - { - ShowServiceNotAvailableError( _pParent, s_sAdressBookFieldAssignmentServiceName, sal_True ); - return sal_False; - } - - // execute the dialog - if ( xDialog->execute() ) - { - // retrieve the field mapping as set by he user - Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY ); - - Sequence< AliasProgrammaticPair > aMapping; -#ifdef DBG_UTIL - sal_Bool bSuccess = -#endif - xDialogProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FieldMapping" )) ) >>= aMapping; - DBG_ASSERT( bSuccess, "fieldmapping::invokeDialog: invalid property type for FieldMapping!" ); - - // and copy it into the map - const AliasProgrammaticPair* pMapping = aMapping.getConstArray(); - const AliasProgrammaticPair* pMappingEnd = pMapping + aMapping.getLength(); - for (;pMapping != pMappingEnd; ++pMapping) - _rSettings.aFieldMapping[ pMapping->ProgrammaticName ] = pMapping->Alias; - - return sal_True; - } - - } - catch(const Exception&) - { - OSL_FAIL("fieldmapping::invokeDialog: caught an exception while executing the dialog!"); - } - return sal_False; - } - - //----------------------------------------------------------------- - void defaultMapping( const Reference< XMultiServiceFactory >& _rxORB, MapString2String& _rFieldAssignment ) SAL_THROW ( ( ) ) - { - _rFieldAssignment.clear(); - - try - { - // what we have: - // a) For the address data source, we need a mapping from programmatic names (1) to real column names - // b) The SDBC driver has a fixed set of columns, which, when returned, are named according to - // some configuration entries. E.g., the driver displays the field which it knows contains - // the first name as "First Name" - the latter string is stored in the config. - // For this, the driver uses programmatic names, too, but they differ from the programmatic names the - // template documents have. - // So what we need first is a mapping from programmatic names (1) to programmatic names (2) - const sal_Char* pMappingProgrammatics[] = - { - "FirstName", "FirstName", - "LastName", "LastName", - "Street", "HomeAddress", - "Zip", "HomeZipCode", - "City", "HomeCity", - "State", "HomeState", - "Country", "HomeCountry", - "PhonePriv", "HomePhone", - "PhoneComp", "WorkPhone", - "PhoneCell", "CellularNumber", - "Pager", "PagerNumber", - "Fax", "FaxNumber", - "EMail", "PrimaryEmail", - "URL", "WebPage1", - "Note", "Notes", - "Altfield1", "Custom1", - "Altfield2", "Custom2", - "Altfield3", "Custom3", - "Altfield4", "Custom4", - "Title", "JobTitle", - "Company", "Company", - "Department", "Department" - }; - // (this list is not complete: both lists of programmatic names are larger in real, - // but this list above is the intersection) - - - // access the configuration information which the driver uses for determining it's column names - ::rtl::OUString sDriverAliasesNodeName = lcl_getDriverSettingsNodeName(); - sDriverAliasesNodeName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/ColumnAliases" )); - - // create a config node for this - OConfigurationTreeRoot aDriverFieldAliasing = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sDriverAliasesNodeName, -1, OConfigurationTreeRoot::CM_READONLY); - - // loop through all programmatic pairs - DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2, - "fieldmapping::defaultMapping: invalid programmatic map!" ); - // number of pairs - sal_Int32 nIntersectedProgrammatics = SAL_N_ELEMENTS( pMappingProgrammatics ) / 2; - - const sal_Char** pProgrammatic = pMappingProgrammatics; - ::rtl::OUString sAddressProgrammatic; - ::rtl::OUString sDriverProgrammatic; - ::rtl::OUString sDriverUI; - for ( sal_Int32 i=0; - i < nIntersectedProgrammatics; - ++i - ) - { - sAddressProgrammatic = ::rtl::OUString::createFromAscii( *pProgrammatic++ ); - sDriverProgrammatic = ::rtl::OUString::createFromAscii( *pProgrammatic++ ); - - if ( aDriverFieldAliasing.hasByName( sDriverProgrammatic ) ) - { - aDriverFieldAliasing.getNodeValue( sDriverProgrammatic ) >>= sDriverUI; - if ( 0 == sDriverUI.getLength() ) - { - OSL_FAIL( "fieldmapping::defaultMapping: invalid driver UI column name!"); - } - else - _rFieldAssignment[ sAddressProgrammatic ] = sDriverUI; - } - else - { - OSL_FAIL( "fieldmapping::defaultMapping: invalid driver programmatic name!" ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL("fieldmapping::defaultMapping: code is assumed to throw no exceptions!"); - // the config nodes we're using herein should not do this .... - } - } - - //----------------------------------------------------------------- - void writeTemplateAddressFieldMapping( const Reference< XMultiServiceFactory >& _rxORB, const MapString2String& _rFieldAssignment ) SAL_THROW ( ( ) ) - { - // want to have a non-const map for easier handling - MapString2String aFieldAssignment( _rFieldAssignment ); - - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - OConfigurationNode aFields = aAddressBookSettings.openNode( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Fields" )) ); - - // loop through all existent fields - Sequence< ::rtl::OUString > aExistentFields = aFields.getNodeNames(); - const ::rtl::OUString* pExistentFields = aExistentFields.getConstArray(); - const ::rtl::OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - - const ::rtl::OUString sProgrammaticNodeName(RTL_CONSTASCII_USTRINGPARAM( "ProgrammaticFieldName" )); - const ::rtl::OUString sAssignedNodeName(RTL_CONSTASCII_USTRINGPARAM( "AssignedFieldName" )); - - for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) - { -#ifdef DBG_UTIL - ::rtl::OUString sRedundantProgrammaticName; - aFields.openNode( *pExistentFields ).getNodeValue( sProgrammaticNodeName ) >>= sRedundantProgrammaticName; -#endif - DBG_ASSERT( sRedundantProgrammaticName == *pExistentFields, - "fieldmapping::writeTemplateAddressFieldMapping: inconsistent config data!" ); - // there should be a redundancy in the config data .... if this asserts, there isn't anymore! - - // do we have a new alias for the programmatic? - MapString2StringIterator aPos = aFieldAssignment.find( *pExistentFields ); - if ( aFieldAssignment.end() != aPos ) - { // yes - // -> set a new value - OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); - aExistentField.setNodeValue( sAssignedNodeName, makeAny( aPos->second ) ); - // and remove the mapping entry - aFieldAssignment.erase( *pExistentFields ); - } - else - { // no - // -> remove it - aFields.removeNode( *pExistentFields ); - } - } - - // now everything remaining in aFieldAssignment marks a mapping entry which was not present - // in the config before - for ( ConstMapString2StringIterator aNewMapping = aFieldAssignment.begin(); - aNewMapping != aFieldAssignment.end(); - ++aNewMapping - ) - { - DBG_ASSERT( !aFields.hasByName( aNewMapping->first ), - "fieldmapping::writeTemplateAddressFieldMapping: inconsistence!" ); - // in case the config node for the fields already has the node named first>, - // the entry should have been removed from aNewMapping (in the above loop) - OConfigurationNode aNewField = aFields.createNode( aNewMapping->first ); - aNewField.setNodeValue( sProgrammaticNodeName, makeAny( aNewMapping->first ) ); - aNewField.setNodeValue( sAssignedNodeName, makeAny( aNewMapping->second ) ); - } - - // commit the changes done - aAddressBookSettings.commit(); - } - - //..................................................................... - } // namespace fieldmapping - //..................................................................... - - //..................................................................... - namespace addressconfig - { - //..................................................................... - - //----------------------------------------------------------------- - void writeTemplateAddressSource( const Reference< XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rTableName ) SAL_THROW ( ( ) ) - { - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DataSourceName" )), makeAny( _rDataSourceName ) ); - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Command" )), makeAny( _rTableName ) ); - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CommandType" )), makeAny( (sal_Int32)CommandType::TABLE ) ); - - // commit the changes done - aAddressBookSettings.commit(); - } - - //----------------------------------------------------------------- - void markPilotSuccess( const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW ( ( ) ) - { - // access the configuration information which the driver uses for determining it's column names - const ::rtl::OUString& sAddressBookNodeName = lcl_getAddressBookNodeName(); - - // create a config node for this - OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithServiceFactory( - _rxORB, sAddressBookNodeName, -1, OConfigurationTreeRoot::CM_UPDATABLE); - - // set the flag - aAddressBookSettings.setNodeValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AutoPilotCompleted" )), makeAny( (sal_Bool)sal_True ) ); - - // commit the changes done - aAddressBookSettings.commit(); - } - - //..................................................................... - } // namespace addressconfig - //..................................................................... - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingimpl.hxx b/extensions/source/abpilot/fieldmappingimpl.hxx deleted file mode 100644 index fe93fd01f..000000000 --- a/extensions/source/abpilot/fieldmappingimpl.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX -#define EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX - -#include -#include "abptypes.hxx" -#include -#include "addresssettings.hxx" - -namespace com { namespace sun { namespace star { - namespace lang { - class XMultiServiceFactory; - } - namespace beans { - class XPropertySet; - } -} } } -class Window; - -//......................................................................... -namespace abp -{ -//......................................................................... - - //..................................................................... - namespace fieldmapping - { - //..................................................................... - - //----------------------------------------------------------------- - /** invokes the field mapping dialog - @param _rxORB - service factory to use for creating UNO services - @param _pParent - window to use as parent for the dialog and error messages - @param _rSettings - current settings. Upon return, the field mapping member of this - structure will be filled with the settings the user did in the - field mapping dialog. - */ - sal_Bool invokeDialog( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - class Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDataSource, - AddressSettings& _rSettings - ) SAL_THROW ( ( ) ); - - //----------------------------------------------------------------- - /** creates a default field mapping for usage with the address book SDBC driver -

The column names as used by the SDBC driver for address books is stored in the configuration, - and this function creates a mapping which uses this configuration information.

- */ - void defaultMapping( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - MapString2String& /* [out] */ _rFieldAssignment - ) SAL_THROW ( ( ) ); - - //----------------------------------------------------------------- - /** writes a field mapping for the template document address source - */ - void writeTemplateAddressFieldMapping( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const MapString2String& _rFieldAssignment - ) SAL_THROW ( ( ) ); - - //..................................................................... - } // namespace fieldmapping - //..................................................................... - - //..................................................................... - namespace addressconfig - { - //..................................................................... - - //----------------------------------------------------------------- - /** writes the data source / table name given into the configuration, to where the template documents - expect it. - */ - void writeTemplateAddressSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rDataSourceName, - const ::rtl::OUString& _rTableName - ) SAL_THROW ( ( ) ); - - /** writes the configuration entry which states the the pilot has been completed successfully - */ - void markPilotSuccess( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ) SAL_THROW ( ( ) ); - - //..................................................................... - } // namespace addressconfig - //..................................................................... - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_FIELDMAPPINGIMPL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingpage.cxx b/extensions/source/abpilot/fieldmappingpage.cxx deleted file mode 100644 index 85f518dbd..000000000 --- a/extensions/source/abpilot/fieldmappingpage.cxx +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "fieldmappingpage.hxx" -#include "fieldmappingimpl.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FieldMappingPage - //===================================================================== - //--------------------------------------------------------------------- - FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage( _pParent, ModuleRes( RID_PAGE_FIELDMAPPING ) ) - ,m_aExplanation ( this, ModuleRes( FT_FIELDASSIGMENTEXPL ) ) - ,m_aInvokeDialog ( this, ModuleRes( PB_INVOKE_FIELDS_DIALOG ) ) - ,m_aHint ( this, ModuleRes( FT_ASSIGNEDFIELDS ) ) - { - FreeResource(); - - m_aInvokeDialog.SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) ); - - // check the size of the InvokeDialog button - some languages are very ... gossipy here .... - sal_Int32 nTextWidth = m_aInvokeDialog.GetTextWidth( m_aInvokeDialog.GetText() ); - - sal_Int32 nBorderSpace = m_aInvokeDialog.LogicToPixel( Point( 4, 0 ), MAP_APPFONT ).X(); - sal_Int32 nSpace = m_aInvokeDialog.GetOutputSizePixel().Width() - 2 * nBorderSpace; - - if ( nSpace < nTextWidth ) - { - Size aButtonSize = m_aInvokeDialog.GetSizePixel(); - aButtonSize.Width() += nTextWidth - nSpace; - m_aInvokeDialog.SetSizePixel( aButtonSize ); - } - } - - //--------------------------------------------------------------------- - void FieldMappingPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - m_aInvokeDialog.GrabFocus(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::initializePage() - { - AddressBookSourcePage::initializePage(); - implUpdateHint(); - } - - //--------------------------------------------------------------------- - void FieldMappingPage::implUpdateHint() - { - const AddressSettings& rSettings = getSettings(); - String sHint; - if ( 0 == rSettings.aFieldMapping.size() ) - sHint = String( ModuleRes( RID_STR_NOFIELDSASSIGNED ) ); - m_aHint.SetText( sHint ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( FieldMappingPage, OnInvokeDialog, void*, /*NOTINTERESTEDIN*/ ) - { - AddressSettings& rSettings = getSettings(); - - // invoke the dialog doing the mapping - if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) ) - { - if ( rSettings.aFieldMapping.size() ) - getDialog()->travelNext(); - else - implUpdateHint(); - } - - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/fieldmappingpage.hxx b/extensions/source/abpilot/fieldmappingpage.hxx deleted file mode 100644 index 3da50be83..000000000 --- a/extensions/source/abpilot/fieldmappingpage.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX -#define EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX - -#include "abspage.hxx" - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= FieldMappingPage - //===================================================================== - class FieldMappingPage : public AddressBookSourcePage - { - protected: - FixedText m_aExplanation; - PushButton m_aInvokeDialog; - FixedText m_aHint; - - public: - FieldMappingPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - private: - DECL_LINK( OnInvokeDialog, void* ); - - void implUpdateHint(); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_FIELDMAPPINGPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/makefile.mk b/extensions/source/abpilot/makefile.mk deleted file mode 100644 index 7f8482824..000000000 --- a/extensions/source/abpilot/makefile.mk +++ /dev/null @@ -1,115 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. -PRJINC=..$/inc - -PRJNAME=extensions -TARGET=abp -USE_DEFFILE=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- defines ------------------------------------------------------ - -CDEFS+=-DCOMPMOD_NAMESPACE=abp -CDEFS+=-DCOMPMOD_RESPREFIX=abp - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/abpfinalpage.obj \ - $(SLO)$/abpservices.obj \ - $(SLO)$/abspage.obj \ - $(SLO)$/abspilot.obj \ - $(SLO)$/admininvokationimpl.obj \ - $(SLO)$/admininvokationpage.obj \ - $(SLO)$/datasourcehandling.obj \ - $(SLO)$/fieldmappingimpl.obj \ - $(SLO)$/fieldmappingpage.obj \ - $(SLO)$/moduleabp.obj \ - $(SLO)$/tableselectionpage.obj \ - $(SLO)$/typeselectionpage.obj \ - $(SLO)$/unodialogabp.obj \ - -SLOFILES= \ - $(EXCEPTIONSFILES) - - -.IF "$(WITH_MOZILLA)" != "NO" -.IF "$(SYSTEM_MOZILLA)" != "YES" -CDEFS+=-DWITH_MOZILLA -.ENDIF -.ENDIF - -SRS1NAME=$(TARGET) -SRC1FILES= abspilot.src - -RESLIB1NAME=abp -RESLIB1IMAGES=$(PRJ)$/res -RESLIB1SRSFILES= $(SRS)$/abp.srs - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(SFXLIB) \ - $(SVLLIB) \ - $(SVTLIB) \ - $(SVTOOLLIB) \ - $(SVXCORELIB) \ - $(SVXLIB) \ - $(TKLIB) \ - $(TOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(VCLLIB) \ - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/abp.component - -$(MISC)/abp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - abp.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt abp.component diff --git a/extensions/source/abpilot/moduleabp.cxx b/extensions/source/abpilot/moduleabp.cxx deleted file mode 100644 index ead975319..000000000 --- a/extensions/source/abpilot/moduleabp.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "componentmodule.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/tableselectionpage.cxx b/extensions/source/abpilot/tableselectionpage.cxx deleted file mode 100644 index 5e6a2182d..000000000 --- a/extensions/source/abpilot/tableselectionpage.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "tableselectionpage.hxx" -#include "abptypes.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TableSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - TableSelectionPage::TableSelectionPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_TABLESELECTION_AB)) - ,m_aLabel ( this, ModuleRes( FL_TOOMUCHTABLES ) ) - ,m_aTableList ( this, ModuleRes( LB_TABLELIST ) ) - { - FreeResource(); - - m_aTableList.SetSelectHdl( LINK( this, TableSelectionPage, OnTableSelected ) ); - m_aTableList.SetDoubleClickHdl( LINK( this, TableSelectionPage, OnTableDoubleClicked ) ); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - m_aTableList.GrabFocus(); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - } - - //--------------------------------------------------------------------- - void TableSelectionPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - const AddressSettings& rSettings = getSettings(); - - m_aTableList.Clear(); - - // get the table names - const StringBag& aTableNames = getDialog()->getDataSource().getTableNames(); - DBG_ASSERT( aTableNames.size() > 1, "TableSelectionPage::initializePage: to be called for more than one table only!"); - // this page should never bother the user if there is 1 or less tables. - - // fill the list - for ( ConstStringBagIterator aTables = aTableNames.begin(); - aTables != aTableNames.end(); - ++aTables - ) - m_aTableList.InsertEntry( *aTables ); - - // initially select the proper table - m_aTableList.SelectEntry( rSettings.sSelectedTable ); - } - - //--------------------------------------------------------------------- - IMPL_LINK( TableSelectionPage, OnTableDoubleClicked, void*, /*NOTINTERESTEDIN*/ ) - { - if ( 1 == m_aTableList.GetSelectEntryCount() ) - getDialog()->travelNext(); - - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK( TableSelectionPage, OnTableSelected, void*, /*NOTINTERESTEDIN*/ ) - { - updateDialogTravelUI(); - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool TableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - AddressSettings& rSettings = getSettings(); - rSettings.sSelectedTable = m_aTableList.GetSelectEntry(); - - return sal_True; - } - - //--------------------------------------------------------------------- - bool TableSelectionPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() - && ( 0 < m_aTableList.GetSelectEntryCount() ); - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/tableselectionpage.hxx b/extensions/source/abpilot/tableselectionpage.hxx deleted file mode 100644 index 82b2d5d57..000000000 --- a/extensions/source/abpilot/tableselectionpage.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX -#define EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX - -#include "abspage.hxx" -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TableSelectionPage - //===================================================================== - class TableSelectionPage : public AddressBookSourcePage - { - protected: - FixedText m_aLabel; - ListBox m_aTableList; - - public: - TableSelectionPage( OAddessBookSourcePilot* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnTableSelected, void* ); - DECL_LINK( OnTableDoubleClicked, void* ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_TABLESELECTIONPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx deleted file mode 100644 index f78878f04..000000000 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "typeselectionpage.hxx" -#include "addresssettings.hxx" -#include "abspilot.hxx" -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::sdbc; - - //===================================================================== - //= TypeSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - TypeSelectionPage::TypeSelectionPage( OAddessBookSourcePilot* _pParent ) - :AddressBookSourcePage(_pParent, ModuleRes(RID_PAGE_SELECTABTYPE)) - ,m_aHint (this, ModuleRes(FT_TYPE_HINTS)) - ,m_aTypeSep (this, ModuleRes(FL_TYPE)) - ,m_aEvolution (this, ModuleRes(RB_EVOLUTION)) - ,m_aEvolutionGroupwise (this, ModuleRes(RB_EVOLUTION_GROUPWISE)) - ,m_aEvolutionLdap (this, ModuleRes(RB_EVOLUTION_LDAP)) - ,m_aMORK (this, ModuleRes(RB_MORK)) - ,m_aThunderbird (this, ModuleRes(RB_THUNDERBIRD)) - ,m_aKab (this, ModuleRes(RB_KAB)) - ,m_aMacab (this, ModuleRes(RB_MACAB)) - ,m_aLDAP (this, ModuleRes(RB_LDAP)) - ,m_aOutlook (this, ModuleRes(RB_OUTLOOK)) - ,m_aOE (this, ModuleRes(RB_OUTLOOKEXPRESS)) - ,m_aOther (this, ModuleRes(RB_OTHER)) - { - FreeResource(); - - Point aTopLeft( LogicToPixel( Point( 15, 68 ), MAP_APPFONT ) ); - Size aItemSize( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ) ); - aItemSize.Width() = GetOutputSizePixel().Width() - 30; - - bool bWithMozilla = true, bUnx = true; - bool bHaveEvolution = true, bHaveKab = true; - bool bHaveMacab = true; - -#if !defined WITH_MOZILLA || defined MACOSX - bWithMozilla = false; -#endif -#ifndef UNX - bUnx = false; - bHaveEvolution = false; - bHaveKab = false; - bHaveMacab = false; -#else - Reference< XDriverAccess> xManager(_pParent->getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager"))), UNO_QUERY); - - // check whether Evolution is available - Reference< XDriver > xDriver( xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:evolution:local"))) ); - if ( !xDriver.is() ) - bHaveEvolution = false; - - // check whether KDE address book is available - xDriver = xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:kab"))); - if ( !xDriver.is() ) - bHaveKab = false; - - // check whether Mac OS X address book is available - xDriver = xManager->getDriverByURL(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:macab"))); - if ( !xDriver.is() ) - bHaveMacab = false; -#endif - - // Items are displayed in list order - m_aAllTypes.push_back( ButtonItem( &m_aEvolution, AST_EVOLUTION, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aEvolutionGroupwise, AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aEvolutionLdap, AST_EVOLUTION_LDAP, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( &m_aMORK, AST_MORK, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aThunderbird, AST_THUNDERBIRD, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aKab, AST_KAB, bHaveKab ) ); - m_aAllTypes.push_back( ButtonItem( &m_aMacab, AST_MACAB, bHaveMacab ) ); - m_aAllTypes.push_back( ButtonItem( &m_aLDAP, AST_LDAP, bWithMozilla ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOutlook, AST_OUTLOOK, bWithMozilla && !bUnx ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOE, AST_OE, bWithMozilla && !bUnx ) ); - m_aAllTypes.push_back( ButtonItem( &m_aOther, AST_OTHER, true ) ); - - bool bFirstVisible = true; - Link aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); - const Size aSpacing( LogicToPixel( Size( 0, 3 ), MAP_APPFONT ) ); - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = *loop; - if (!aItem.m_bVisible) - aItem.m_pItem->Hide(); - else - { - aItem.m_pItem->SetPosPixel( aTopLeft ); - aTopLeft.Y() += aItemSize.Height() + aSpacing.Height(); - aItem.m_pItem->SetClickHdl( aTypeSelectionHandler ); - aItem.m_pItem->Show(); - - if ( bFirstVisible ) - { - aItem.m_pItem->SetStyle( aItem.m_pItem->GetStyle() | WB_GROUP ); - bFirstVisible = false; - } - } - } - } - - //--------------------------------------------------------------------- - TypeSelectionPage::~TypeSelectionPage() - { - for ( ::std::vector< ButtonItem >::iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - loop->m_bVisible = false; - } - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::ActivatePage() - { - AddressBookSourcePage::ActivatePage(); - - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - const ButtonItem& rItem = (*loop); - if( rItem.m_pItem->IsChecked() && rItem.m_bVisible ) - { - rItem.m_pItem->GrabFocus(); - break; - } - } - - getDialog()->enableButtons(WZB_PREVIOUS, sal_False); - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::DeactivatePage() - { - AddressBookSourcePage::DeactivatePage(); - getDialog()->enableButtons(WZB_PREVIOUS, sal_True); - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::selectType( AddressSourceType _eType ) - { - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = (*loop); - aItem.m_pItem->Check( _eType == aItem.m_eType ); - } - } - - //--------------------------------------------------------------------- - AddressSourceType TypeSelectionPage::getSelectedType() const - { - for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin(); - loop != m_aAllTypes.end(); ++loop ) - { - ButtonItem aItem = (*loop); - if ( aItem.m_pItem->IsChecked() ) - return aItem.m_eType; - } - - return AST_INVALID; - } - - //--------------------------------------------------------------------- - void TypeSelectionPage::initializePage() - { - AddressBookSourcePage::initializePage(); - - const AddressSettings& rSettings = getSettings(); - selectType(rSettings.eType); - } - - //--------------------------------------------------------------------- - sal_Bool TypeSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!AddressBookSourcePage::commitPage(_eReason)) - return sal_False; - - if (AST_INVALID == getSelectedType( )) - { - ErrorBox aError(this, ModuleRes(RID_ERR_NEEDTYPESELECTION)); - aError.Execute(); - return sal_False; - } - - AddressSettings& rSettings = getSettings(); - rSettings.eType = getSelectedType(); - - return sal_True; - } - - //--------------------------------------------------------------------- - bool TypeSelectionPage::canAdvance() const - { - return AddressBookSourcePage::canAdvance() - && (AST_INVALID != getSelectedType()); - } - - //--------------------------------------------------------------------- - IMPL_LINK( TypeSelectionPage, OnTypeSelected, void*, /*NOTINTERESTEDIN*/ ) - { - getDialog()->typeSelectionChanged( getSelectedType() ); - updateDialogTravelUI(); - return 0L; - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx deleted file mode 100644 index 37e0a8beb..000000000 --- a/extensions/source/abpilot/typeselectionpage.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX -#define EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX - -#include "abspage.hxx" -#include "addresssettings.hxx" -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= TypeSelectionPage - //===================================================================== - class TypeSelectionPage : public AddressBookSourcePage - { - protected: - FixedText m_aHint; - FixedLine m_aTypeSep; - RadioButton m_aEvolution; - RadioButton m_aEvolutionGroupwise; - RadioButton m_aEvolutionLdap; - RadioButton m_aMORK; - RadioButton m_aThunderbird; - RadioButton m_aKab; - RadioButton m_aMacab; - RadioButton m_aLDAP; - RadioButton m_aOutlook; - RadioButton m_aOE; - RadioButton m_aOther; - - struct ButtonItem { - RadioButton *m_pItem; - AddressSourceType m_eType; - bool m_bVisible; - - ButtonItem( RadioButton *pItem, - AddressSourceType eType, - bool bVisible ) : - m_pItem( pItem ), - m_eType( eType ), - m_bVisible( bVisible ) - {} - }; - - ::std::vector< ButtonItem > m_aAllTypes; - - public: - TypeSelectionPage( OAddessBookSourcePilot* _pParent ); - ~TypeSelectionPage(); - - // retrieves the currently selected type - AddressSourceType getSelectedType() const; - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // TabDialog overridables - virtual void ActivatePage(); - virtual void DeactivatePage(); - - // OImportPage overridables - virtual bool canAdvance() const; - - private: - DECL_LINK( OnTypeSelected, void* ); - - void selectType( AddressSourceType _eType ); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_TYPESELECTIONPAGE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx deleted file mode 100644 index 2491ab61d..000000000 --- a/extensions/source/abpilot/unodialogabp.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "unodialogabp.hxx" -#include -#include "abspilot.hxx" -#include -#include - -extern "C" void SAL_CALL createRegistryInfo_OABSPilotUno() -{ - static ::abp::OMultiInstanceAutoRegistration< ::abp::OABSPilotUno > aAutoRegistration; -} - -#define PROPERTY_ID_DATASOURCENAME 3 -//......................................................................... -namespace abp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::ui::dialogs; - - //===================================================================== - //= OABSPilotUno - //===================================================================== - //--------------------------------------------------------------------- - OABSPilotUno::OABSPilotUno(const Reference< XMultiServiceFactory >& _rxORB) - :OGenericUnoDialog(_rxORB) - { - registerProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName")), PROPERTY_ID_DATASOURCENAME, PropertyAttribute::READONLY , - &m_sDataSourceName, ::getCppuType( &m_sDataSourceName ) ); - } - - //-------------------------------------------------------------------------- - Any SAL_CALL OABSPilotUno::queryInterface( const Type& aType ) throw (RuntimeException) - { - Any aReturn = OABSPilotUno_DBase::queryInterface( aType ); - return aReturn.hasValue() ? aReturn : OABSPilotUno_JBase::queryInterface( aType ); - } - - //-------------------------------------------------------------------------- - void SAL_CALL OABSPilotUno::acquire( ) throw () - { - OABSPilotUno_DBase::acquire(); - } - - //-------------------------------------------------------------------------- - void SAL_CALL OABSPilotUno::release( ) throw () - { - OABSPilotUno_DBase::release(); - } - - //--------------------------------------------------------------------- - Sequence< Type > SAL_CALL OABSPilotUno::getTypes( ) throw (RuntimeException) - { - return ::comphelper::concatSequences( - OABSPilotUno_DBase::getTypes(), - OABSPilotUno_JBase::getTypes() - ); - } - - //--------------------------------------------------------------------- - Sequence SAL_CALL OABSPilotUno::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId* s_pId; - if ( !s_pId ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !s_pId ) - { - static ::cppu::OImplementationId s_aId; - s_pId = &s_aId; - } - } - return s_pId->getImplementationId(); - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OABSPilotUno::Create(const Reference< XMultiServiceFactory >& _rxFactory) - { - return *(new OABSPilotUno(_rxFactory)); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OABSPilotUno::getImplementationName() throw(RuntimeException) - { - return getImplementationName_Static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString OABSPilotUno::getImplementationName_Static() throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.abp.OAddressBookSourcePilot")); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OABSPilotUno::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_Static(); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence OABSPilotUno::getSupportedServiceNames_Static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.AddressBookSourcePilot")); - return aSupported; - } - - //--------------------------------------------------------------------- - Reference SAL_CALL OABSPilotUno::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OABSPilotUno::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - - //-------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* OABSPilotUno::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //-------------------------------------------------------------------------- - Dialog* OABSPilotUno::createDialog(Window* _pParent) - { - return new OAddessBookSourcePilot(_pParent, m_aContext.getLegacyServiceFactory()); - } - - //-------------------------------------------------------------------------- - Any SAL_CALL OABSPilotUno::execute( const Sequence< NamedValue >& /*lArgs*/ ) throw (IllegalArgumentException, Exception, RuntimeException) - { - // not interested in the context, not interested in the args - // -> call the execute method of the XExecutableDialog - static_cast< XExecutableDialog* >( this )->execute(); - - // result interest not really ... - // We show this dialog one times only! - // User has one chance to accept it or not. - // (or he can start it again by using wizard-menu!) - // So we should deregister it on our general job execution service by using right protocol parameters. - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > lProtocol(1); - lProtocol[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Deactivate")); - lProtocol[0].Value <<= sal_True; - return makeAny( lProtocol ); - } - // ----------------------------------------------------------------------------- - void OABSPilotUno::executedDialog(sal_Int16 _nExecutionResult) - { - if ( _nExecutionResult == RET_OK ) - { - const AddressSettings& aSettings = static_cast(m_pDialog)->getSettings(); - m_sDataSourceName = aSettings.bRegisterDataSource ? aSettings.sRegisteredDataSourceName : aSettings.sDataSourceName; - } - } - -//......................................................................... -} // namespace abp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/abpilot/unodialogabp.hxx b/extensions/source/abpilot/unodialogabp.hxx deleted file mode 100644 index ab56106b5..000000000 --- a/extensions/source/abpilot/unodialogabp.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_ABP_UNODIALOG_HXX -#define EXTENSIONS_ABP_UNODIALOG_HXX - -#include -#include -#include "componentmodule.hxx" -#include -#include - -//......................................................................... -namespace abp -{ -//......................................................................... - - //===================================================================== - //= OABSPilotUno - //===================================================================== - class OABSPilotUno; - typedef ::svt::OGenericUnoDialog OABSPilotUno_DBase; - typedef ::cppu::ImplHelper1< ::com::sun::star::task::XJob > OABSPilotUno_JBase; - typedef ::comphelper::OPropertyArrayUsageHelper< OABSPilotUno > OABSPilotUno_PBase; - /// the UNO wrapper for the address book source pilot - class OABSPilotUno - :public OABSPilotUno_DBase - ,public OABSPilotUno_JBase - ,public OABSPilotUno_PBase - ,public OModuleResourceClient - { - ::rtl::OUString m_sDataSourceName; - OABSPilotUno(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - public: - // XInterface (disambiguation) - 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_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - using OABSPilotUno_DBase::execute; - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - virtual void executedDialog(sal_Int16 _nExecutionResult); - }; - -//......................................................................... -} // namespace abp -//......................................................................... - -#endif // EXTENSIONS_ABP_UNODIALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/README.txt b/extensions/source/activex/main/README.txt deleted file mode 100644 index 9d647987a..000000000 --- a/extensions/source/activex/main/README.txt +++ /dev/null @@ -1,33 +0,0 @@ - Description. - -The StarOffice ActiveX control shows an example of access to UNO through COM technology. -It requires a properly installed StarOffice version 6.0/6.1 or OpenOffice 1.0. -This is a Lite ActiveX control so it can be used only in containers that -allows to use such controls. - -Pressing to any link to staroffice document should activate the control. -So the document will be opened in ReadOnly mode. - -Also it can be activated with an tag from a html-page. -Without any parameters for an object tag a new writer document will be -opened for editing. Possible parameters are - src - full URL to the file that should be edited/viewed; - it can contain "private:factory/..." URLs to open new documents - for edit, for example "private:factory/swriter" - readonly - the default value is "true", in case it is set to any other - value the document is opened for editing - -As any ActiveX control this one should be registered. -To let MSIE register it itself the "CODEBASE" parameter -for the "OBJECT" tag should be specified -with an URL to the library "so_activex.dll". -The example of registration with "OBJECT" tag is in example.html. - -Also it can be done using regsvr32 application. -To do it please write -\System32\regsvr32 so_activex.dll - -To unregister the control please use /u option: -\system32\regsvr32 so_activex.dll /u - - diff --git a/extensions/source/activex/main/SOActionsApproval.cpp b/extensions/source/activex/main/SOActionsApproval.cpp deleted file mode 100644 index c0da27f9b..000000000 --- a/extensions/source/activex/main/SOActionsApproval.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOActionsApproval.cpp : Implementation of CHelpApp and DLL registration. - -#include "stdafx2.h" - -#include "so_activex.h" -#include "SOActionsApproval.h" -#include - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_ISOActionsApproval, - }; - - for (int i=0;i= 1300) - if (InlineIsEqualGUID(*arr[i],riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) -#endif - return S_OK; - } - return S_FALSE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOActionsApproval.h b/extensions/source/activex/main/SOActionsApproval.h deleted file mode 100644 index 097d7b97a..000000000 --- a/extensions/source/activex/main/SOActionsApproval.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOActionsApproval.h: Definition of the SOActionsApproval class -// -////////////////////////////////////////////////////////////////////// - -#if !defined __SODOCUMENTEVENTLISTENER_H_ -#define __SODOCUMENTEVENTLISTENER_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif - -#include - -#include "so_activex.h" - -///////////////////////////////////////////////////////////////////////////// -// SOActionsApproval - -class SOActionsApproval : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ -public: - SOActionsApproval() {} - virtual ~SOActionsApproval() {} - -BEGIN_COM_MAP(SOActionsApproval) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISOActionsApproval) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(SOActionsApproval) -// Remove the comment from the line above if you don't want your object to -// support aggregation. - -DECLARE_REGISTRY_RESOURCEID(IDR_SODOCUMENTEVENTLISTENER) - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// ISOActionsApproval - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE approveAction( - /* [in] */ long nActionID, - /* [retval][out] */ boolean *pbApproval) - { - // only PreventClose is approved - USES_CONVERSION; - *pbApproval = ( nActionID == 1 ); - - return S_OK; - } - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) - { - *pVal = SafeArrayCreateVector( VT_BSTR, 0, 1 ); - - if( !*pVal ) - return E_FAIL; - - long ix = 0; - CComBSTR aInterface( OLESTR( "com.sun.star.embed.XActionsApproval" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - return S_OK; - } -}; - -#endif // __SODOCUMENTEVENTLISTENER_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOActionsApproval.rgs b/extensions/source/activex/main/SOActionsApproval.rgs deleted file mode 100644 index 543320813..000000000 --- a/extensions/source/activex/main/SOActionsApproval.rgs +++ /dev/null @@ -1,24 +0,0 @@ -HKCR -{ -9F3697AC-7A18-4335-AF0A-65FAC2C35CC1 - so_activex.SOActionsApproval.1 = s 'SOActionsApproval Class' - { - CLSID = s '{9F3697AC-7A18-4335-AF0A-65FAC2C35CC1}' - } - so_activex.SOActionsApproval = s 'SOActionsApproval Class' - { - CLSID = s '{9F3697AC-7A18-4335-AF0A-65FAC2C35CC1}' - } - NoRemove CLSID - { - ForceRemove {9F3697AC-7A18-4335-AF0A-65FAC2C35CC1} = s 'SOActionsApproval Class' - { - ProgID = s 'so_activex.SOActionsApproval.1' - VersionIndependentProgID = s 'so_activex.SOActionsApproval' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/extensions/source/activex/main/SOActiveX.cpp b/extensions/source/activex/main/SOActiveX.cpp deleted file mode 100644 index 3468337a0..000000000 --- a/extensions/source/activex/main/SOActiveX.cpp +++ /dev/null @@ -1,1153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOActiveX.cpp : Implementation of CSOActiveX - -#pragma warning (disable:4505) - // permanently suppress "unreferenced local function has been removed" warning - -#pragma warning (push,1) -#pragma warning (disable:4265) - -#include "stdafx2.h" -#include "so_activex.h" -#include "SOActiveX.h" -#include "SOComWindowPeer.h" -#include "SODispatchInterceptor.h" -#include "SOActionsApproval.h" - -#pragma warning (pop) - -#define STAROFFICE_WINDOWCLASS "SOParentWindow" - - -///////////////////////////////////////////////////////////////////////////// - -void OutputError_Impl( HWND hw, HRESULT ErrorCode ) -{ - void* sMessage; - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - ErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &sMessage, - 0, - NULL - ); - ::MessageBoxA( hw, (LPCTSTR)sMessage, NULL, MB_OK | MB_ICONINFORMATION ); - LocalFree( sMessage ); -} - -HRESULT ExecuteFunc( IDispatch* idispUnoObject, - OLECHAR* sFuncName, - CComVariant* params, - unsigned int count, - CComVariant* pResult ) -{ - if( !idispUnoObject ) - return E_FAIL; - - DISPID id; - HRESULT hr = idispUnoObject->GetIDsOfNames( IID_NULL, &sFuncName, 1, LOCALE_USER_DEFAULT, &id); - if( !SUCCEEDED( hr ) ) return hr; - - DISPPARAMS dispparams= { params, 0, count, 0}; - - // DEBUG - EXCEPINFO myInfo; - hr = idispUnoObject->Invoke( id, IID_NULL,LOCALE_USER_DEFAULT, DISPATCH_METHOD, - &dispparams, pResult, &myInfo, 0); - - // for debugging purposes - // USES_CONVERSION; - // if ( !SUCCEEDED( hr ) ) - // ::MessageBox( NULL, OLE2A( myInfo.bstrDescription ), OLE2A( myInfo.bstrSource ), MB_OK | MB_ICONINFORMATION ); - - return hr; -} - -HRESULT GetIDispByFunc( IDispatch* idispUnoObject, - OLECHAR* sFuncName, - CComVariant* params, - unsigned int count, - CComPtr& pdispResult ) -{ - if( !idispUnoObject ) - return E_FAIL; - - CComVariant result; - HRESULT hr = ExecuteFunc( idispUnoObject, sFuncName, params, count, &result ); - if( !SUCCEEDED( hr ) ) return hr; - - if( result.vt != VT_DISPATCH || result.pdispVal == NULL ) - return E_FAIL; - - pdispResult = CComPtr( result.pdispVal ); - - return S_OK; -} - -HRESULT PutPropertiesToIDisp( IDispatch* pdispObject, - OLECHAR** sMemberNames, - CComVariant* pVariant, - unsigned int count ) -{ - for( unsigned int ind = 0; ind < count; ind++ ) - { - DISPID id; - HRESULT hr = pdispObject->GetIDsOfNames( IID_NULL, &sMemberNames[ind], 1, LOCALE_USER_DEFAULT, &id ); - if( !SUCCEEDED( hr ) ) return hr; - - hr = CComDispatchDriver::PutProperty( pdispObject, id, &pVariant[ind] ); - if( !SUCCEEDED( hr ) ) return hr; - } - - return S_OK; -} - -HRESULT GetPropertiesFromIDisp( IDispatch* pdispObject, - OLECHAR** sMemberNames, - CComVariant* pVariant, - unsigned int count ) -{ - for( unsigned int ind = 0; ind < count; ind++ ) - { - DISPID id; - HRESULT hr = pdispObject->GetIDsOfNames( IID_NULL, &sMemberNames[ind], 1, LOCALE_USER_DEFAULT, &id ); - if( !SUCCEEDED( hr ) ) return hr; - - hr = CComDispatchDriver::GetProperty( pdispObject, id, &pVariant[ind] ); - if( !SUCCEEDED( hr ) ) return hr; - } - - return S_OK; -} -///////////////////////////////////////////////////////////////////////////// -// CSOActiveX - -CSOActiveX::CSOActiveX() -: mCookie(0) -, mCurFileUrl( L"private:factory/swriter" ) -, mbLoad( FALSE ) -, mParentWin( NULL ) -, mOffWin( NULL ) -, mbViewOnly( TRUE ) -, mpDispatchInterceptor( NULL ) -, mnVersion( SO_NOT_DETECTED ) -, mbReadyForActivation( FALSE ) -, mbDrawLocked( FALSE ) -{ - CLSID clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}}; - HRESULT hr = CoCreateInstance( clsFactory, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&mpDispFactory); - if( !SUCCEEDED( hr ) ) - OutputError_Impl( NULL, hr ); - - mPWinClass.style = CS_HREDRAW|CS_VREDRAW; - mPWinClass.lpfnWndProc = ::DefWindowProc; - mPWinClass.cbClsExtra = 0; - mPWinClass.cbWndExtra = 0; - mPWinClass.hInstance = (HINSTANCE) GetModuleHandle(NULL); //myInstance; - mPWinClass.hIcon = NULL; - mPWinClass.hCursor = NULL; - mPWinClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND; - mPWinClass.lpszMenuName = NULL; - mPWinClass.lpszClassName = STAROFFICE_WINDOWCLASS; - - RegisterClass(&mPWinClass); -} - -CSOActiveX::~CSOActiveX() -{ - Cleanup(); - -} - -HRESULT CSOActiveX::Cleanup() -{ - CComVariant dummyResult; - - if( mpDispatchInterceptor ) - { - if( mpDispFrame ) - { - // remove dispatch interceptor - CComQIPtr< IDispatch, &IID_IDispatch > pIDispDispInter( mpDispatchInterceptor ); - CComVariant aVariant( pIDispDispInter ); - ExecuteFunc( mpDispFrame, - L"releaseDispatchProviderInterceptor", - &aVariant, - 1, - &dummyResult ); - } - - mpDispatchInterceptor->ClearParent(); - mpDispatchInterceptor->Release(); - mpDispatchInterceptor = NULL; - } - - mpDispTempFile = CComPtr< IDispatch >(); - mbReadyForActivation = FALSE; - - if( mpInstanceLocker ) - { - ExecuteFunc( mpInstanceLocker, L"dispose", NULL, 0, &dummyResult ); - mpInstanceLocker = CComPtr< IDispatch >(); - } - - if( mpDispFrame ) - { - BOOL bCloserActivated = FALSE; - - CComPtr pDispDocumentCloser; - CComVariant aDocCloser( L"com.sun.star.embed.DocumentCloser" ); - HRESULT hr = GetIDispByFunc( mpDispFactory, - L"createInstance", - &aDocCloser, - 1, - pDispDocumentCloser ); - if ( SUCCEEDED( hr ) && pDispDocumentCloser ) - { - SAFEARRAY FAR* pInitFrame = SafeArrayCreateVector( VT_VARIANT, 0, 1 ); - long nInitInd = 0; - CComVariant pFrameVariant( mpDispFrame ); - SafeArrayPutElement( pInitFrame, &nInitInd, &pFrameVariant ); - CComVariant aVarInitFrame; - aVarInitFrame.vt = VT_ARRAY | VT_VARIANT; aVarInitFrame.parray = pInitFrame; - hr = ExecuteFunc( pDispDocumentCloser, L"initialize", &aVarInitFrame, 1, &dummyResult ); - if( SUCCEEDED( hr ) ) - { - // the following call will let the closing happen - hr = ExecuteFunc( pDispDocumentCloser, L"dispose", NULL, 0, &dummyResult ); - bCloserActivated = SUCCEEDED( hr ); - } - } - - if ( !bCloserActivated ) - { - CComVariant aPropVar; - aPropVar.vt = VT_BOOL; aPropVar.boolVal = VARIANT_TRUE; - if ( !SUCCEEDED( ExecuteFunc( mpDispFrame, L"close", &aPropVar, 1, &dummyResult ) ) ) - ExecuteFunc( mpDispFrame, L"dispose", NULL, 0, &dummyResult ); - } - - mpDispFrame = CComPtr< IDispatch >(); - } - - if( ::IsWindow( mOffWin ) ) - ::DestroyWindow( mOffWin ); - - TerminateOffice(); - - return S_OK; -} - -HRESULT CSOActiveX::TerminateOffice() -{ - // create desktop - CComPtr pdispDesktop; - CComVariant aDesktopServiceName( L"com.sun.star.frame.Desktop" ); - - HRESULT hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aDesktopServiceName, 1, pdispDesktop ); - if( !pdispDesktop || !SUCCEEDED( hr ) ) return hr; - - // create tree of frames - CComPtr pdispChildren; - hr = GetIDispByFunc( pdispDesktop, L"getFrames", NULL, 0, pdispChildren ); - if( !pdispChildren || !SUCCEEDED( hr ) ) return hr; - - CComVariant aFrames; - CComVariant nFlag( 4 ); - hr = ExecuteFunc( pdispChildren, L"queryFrames", &nFlag, 1, &aFrames ); - if ( SUCCEEDED( hr ) ) - { - if ( ( aFrames.vt == ( VT_ARRAY | VT_DISPATCH ) || aFrames.vt == ( VT_ARRAY | VT_VARIANT ) ) - && ( !aFrames.parray || aFrames.parray->cDims == 1 && aFrames.parray->rgsabound[0].cElements == 0 ) ) - { - // there is no frames open - // TODO: check whether the frames are hidden if they are open? - CComVariant dummyResult; - hr = ExecuteFunc( pdispDesktop, L"terminate", NULL, 0, &dummyResult ); - } - } - - return hr; -} - -STDMETHODIMP CSOActiveX::InitNew () -{ - mnVersion = GetVersionConnected(); - mbLoad = TRUE; - return S_OK; -} - -STDMETHODIMP CSOActiveX::Load ( LPSTREAM /*pStm*/ ) -{ - mnVersion = GetVersionConnected(); - mbLoad = TRUE; - - // may be later? - // for now just ignore - - return S_OK; -} - -STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG /*pErrorLog*/ ) -{ - mnVersion = GetVersionConnected(); - - IPropertyBag2* pPropBag2; - HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, (void**)&pPropBag2 ); - //ATLASSERT( hr >= 0 ); - - if( !SUCCEEDED( hr ) ) - return hr; - - unsigned long aNum; - hr = pPropBag2->CountProperties( &aNum ); - //ATLASSERT( hr >= 0 ); - if( !SUCCEEDED( hr ) ) - return hr; - - PROPBAG2* aPropNames = new PROPBAG2[aNum]; - unsigned long aReaded; - - hr = pPropBag2->GetPropertyInfo( 0, - aNum, - aPropNames, - &aReaded ); - //ATLASSERT( hr >= 0 ); - if( !SUCCEEDED( hr ) ) - { - delete[] aPropNames; - return hr; - } - - CComVariant* aVal = new CComVariant[aNum]; - HRESULT* hvs = new HRESULT[aNum]; - hr = pPropBag2->Read( aNum, - aPropNames, - NULL, - aVal, - hvs ); - //ATLASSERT( hr >= 0 ); - if( !SUCCEEDED( hr ) ) - { - delete[] hvs; - delete[] aVal; - delete[] aPropNames; - return hr; - } - - USES_CONVERSION; - for( unsigned long ind = 0; ind < aNum; ind++ ) - { - // all information from the 'object' tag is in strings - if( aVal[ind].vt == VT_BSTR && !strcmp( OLE2T( aPropNames[ind].pstrName ), "src" ) ) - { - mCurFileUrl = wcsdup( aVal[ind].bstrVal ); - } - else if( aVal[ind].vt == VT_BSTR - && !strcmp( OLE2T( aPropNames[ind].pstrName ), "readonly" ) ) - { - if( !strcmp( OLE2T( aVal[ind].bstrVal ), "true" ) ) - { - // the default value - mbViewOnly = TRUE; - } - else - { - mbViewOnly = FALSE; - } - } - } - - delete[] hvs; - delete[] aVal; - delete[] aPropNames; - - if( !mpDispFactory ) - return hr; - - mbReadyForActivation = FALSE; - hr = CBindStatusCallback::Download( this, &CSOActiveX::CallbackCreateXInputStream, mCurFileUrl, m_spClientSite, FALSE ); - if ( hr == MK_S_ASYNCHRONOUS ) - hr = S_OK; - - if ( !SUCCEEDED( hr ) ) - { - // trigger initialization without stream - mbLoad = TRUE; - - Invalidate(); - UpdateWindow(); - } - - return hr; -} - -HRESULT CSOActiveX::GetUnoStruct( OLECHAR* sStructName, CComPtr& pdispResult ) -{ - CComVariant aComStruct( sStructName ); - return GetIDispByFunc( mpDispFactory, L"Bridge_GetStruct", &aComStruct, 1, pdispResult ); -} - -HRESULT CSOActiveX::GetUrlStruct( OLECHAR* sUrl, CComPtr& pdispUrl ) -{ - HRESULT hr = GetUnoStruct( L"com.sun.star.util.URL", pdispUrl ); - if( !SUCCEEDED( hr ) ) return hr; - - OLECHAR* sURLMemberName = L"Complete"; - DISPID nURLID; - hr = pdispUrl->GetIDsOfNames( IID_NULL, &sURLMemberName, 1, LOCALE_USER_DEFAULT, &nURLID ); - if( !SUCCEEDED( hr ) ) return hr; - CComVariant aComUrl( sUrl ); - hr = CComDispatchDriver::PutProperty( pdispUrl, nURLID, &aComUrl ); - if( !SUCCEEDED( hr ) ) return hr; - - CComPtr pdispTransformer; - CComVariant aServiceName( L"com.sun.star.util.URLTransformer" ); - hr = GetIDispByFunc( mpDispFactory, - L"createInstance", - &aServiceName, - 1, - pdispTransformer ); - if( !SUCCEEDED( hr ) ) return hr; - - CComVariant dummyResult; - CComVariant aParam[2]; - aParam[1].ppdispVal = &pdispUrl; - aParam[1].vt = VT_DISPATCH | VT_BYREF; - aParam[0] = CComVariant( L"file:///" ); - - hr = ExecuteFunc( pdispTransformer, L"parseSmart", aParam, 2, &dummyResult ); - if( !SUCCEEDED( hr ) || dummyResult.vt != VT_BOOL || !dummyResult.boolVal ) return hr; - - return S_OK; -} - -HRESULT CSOActiveX::SetLayoutManagerProps() -{ - if ( !mpDispFrame ) - return E_FAIL; - - CComVariant pVarLayoutMgr; - OLECHAR* sLMPropName = L"LayoutManager"; - HRESULT hr = GetPropertiesFromIDisp( mpDispFrame, &sLMPropName, &pVarLayoutMgr, 1 ); - if( pVarLayoutMgr.vt != VT_DISPATCH || pVarLayoutMgr.pdispVal == NULL ) - return E_FAIL; - - CComPtr pdispLM( pVarLayoutMgr.pdispVal ); - - - if( !SUCCEEDED( hr ) || !pdispLM ) - return E_FAIL; - - OLECHAR* sATName = L"AutomaticToolbars"; - CComVariant pATProp; - pATProp.vt = VT_BOOL; pATProp.boolVal = VARIANT_FALSE ; - hr = PutPropertiesToIDisp( pdispLM, &sATName, &pATProp, 1 ); - - return hr; -} - -HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) -{ - if( !mpDispFactory ) - return E_FAIL; - - // create window handle holder - CComPtr< CComObject< SOComWindowPeer > > pPeerToSend = new CComObject(); - pPeerToSend->SetHWNDInternally( hwnd ); - CComQIPtr< IDispatch, &IID_IDispatch > pIDispToSend( pPeerToSend ); - - // create rectangle structure - CComPtr pdispRectangle; - HRESULT hr = GetUnoStruct( L"com.sun.star.awt.Rectangle", pdispRectangle ); - if( !SUCCEEDED( hr ) ) return hr; - - OLECHAR* sRectMemberNames[4] = { L"X", - L"Y", - L"Width", - L"Height" }; - CComVariant pRectVariant[4]; - pRectVariant[0] = pRectVariant[1] = pRectVariant[2] = pRectVariant[3] = CComVariant( 0 ); - - hr = PutPropertiesToIDisp( pdispRectangle, sRectMemberNames, pRectVariant, 4 ); - if( !SUCCEEDED( hr ) ) return hr; - - // create WindowDescriptor structure - CComPtr pdispWinDescr; - hr = GetUnoStruct( L"com.sun.star.awt.WindowDescriptor", pdispWinDescr ); - if( !SUCCEEDED( hr ) ) return hr; - - // fill in descriptor with info - OLECHAR* sDescriptorMemberNames[6] = { L"Type", - L"WindowServiceName", - L"ParentIndex", - L"Parent", - L"Bounds", - L"WindowAttributes" }; - CComVariant pDescriptorVar[6]; - pDescriptorVar[0] = CComVariant( 0 ); - pDescriptorVar[1] = CComVariant( L"workwindow" ); - pDescriptorVar[2] = CComVariant( 1 ); - pDescriptorVar[3] = CComVariant( pIDispToSend ); - pDescriptorVar[4] = CComVariant( pdispRectangle ); - pDescriptorVar[5] = CComVariant( 33 ); - hr = PutPropertiesToIDisp( pdispWinDescr, sDescriptorMemberNames, pDescriptorVar, 6 ); - if( !SUCCEEDED( hr ) ) return hr; - - // create XToolkit instance - CComPtr pdispToolkit; - CComVariant aServiceName( L"com.sun.star.awt.Toolkit" ); - hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, pdispToolkit ); - if( !SUCCEEDED( hr ) ) return hr; - - // create window with toolkit - CComVariant aWinDescr( pdispWinDescr ); - hr = GetIDispByFunc( pdispToolkit, L"createWindow", &aWinDescr, 1, mpDispWin ); - if( !SUCCEEDED( hr ) ) return hr; - - // create frame - aServiceName = CComVariant( L"com.sun.star.frame.Task" ); - hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, mpDispFrame ); - if( !SUCCEEDED( hr ) || !mpDispFrame ) - { - // the interface com.sun.star.frame.Task is removed in 6.1 - // but the interface com.sun.star.frame.Frame has some bugs in 6.0 - aServiceName = CComVariant( L"com.sun.star.frame.Frame" ); - hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, mpDispFrame ); - if( !SUCCEEDED( hr ) ) return hr; - } - - // initialize frame - CComVariant dummyResult; - CComVariant aDispWin( mpDispWin ); - hr = ExecuteFunc( mpDispFrame, L"initialize", &aDispWin, 1, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - // set some properties to the layout manager, ignore errors for now - SetLayoutManagerProps(); - - // create desktop - CComPtr pdispDesktop; - aServiceName = CComVariant( L"com.sun.star.frame.Desktop" ); - hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, pdispDesktop ); - if( !SUCCEEDED( hr ) ) return hr; - - // create tree of frames - CComPtr pdispChildren; - hr = GetIDispByFunc( pdispDesktop, L"getFrames", NULL, 0, pdispChildren ); - if( !SUCCEEDED( hr ) ) return hr; - - // insert new frame into desctop hierarchy - CComVariant aDispFrame( mpDispFrame ); - hr = ExecuteFunc( pdispChildren, L"append", &aDispFrame, 1, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - // initialize window - CComVariant aTransparent( (long)0xFFFFFFFF ); - hr = ExecuteFunc( mpDispWin, L"setBackground", &aTransparent, 1, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - CComVariant aTrue( TRUE ); - hr = ExecuteFunc( mpDispWin, L"setVisible", &aTrue, 1, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - CComVariant aPosArgs[5]; - aPosArgs[4] = CComVariant( 0 ); - aPosArgs[3] = CComVariant( 0 ); - aPosArgs[2] = CComVariant( width ); - aPosArgs[1] = CComVariant( height ); - aPosArgs[0] = CComVariant( 12 ); - hr = ExecuteFunc( mpDispWin, L"setPosSize", aPosArgs, 5, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - // create frame locker if there is such service - aServiceName = CComVariant( L"com.sun.star.embed.InstanceLocker" ); - hr = GetIDispByFunc( mpDispFactory, L"createInstance", &aServiceName, 1, mpInstanceLocker ); - if( SUCCEEDED( hr ) && mpInstanceLocker ) - { - SAFEARRAY FAR* pInitVals = SafeArrayCreateVector( VT_VARIANT, 0, 3 ); - - // the first sequence element - long nInitInd = 0; - CComVariant pFrameVariant( mpDispFrame ); - SafeArrayPutElement( pInitVals, &nInitInd, &pFrameVariant ); - - // the second sequence element - nInitInd = 1; - CComVariant pStrArr( 1L ); - SafeArrayPutElement( pInitVals, &nInitInd, &pStrArr ); - - // the third sequence element - nInitInd = 2; - CComPtr pdispValueObj; - hr = GetIDispByFunc( mpDispFactory, L"Bridge_GetValueObject", NULL, 0, pdispValueObj ); - if( !SUCCEEDED( hr ) || !pdispValueObj ) return hr; - - CComVariant aValueArgs[2]; - aValueArgs[1] = CComVariant( L"com.sun.star.embed.XActionsApproval" ); - CComPtr< CComObject< SOActionsApproval > > pApproval( new CComObject() ); - aValueArgs[0] = CComVariant ( pApproval ); - - hr = ExecuteFunc( pdispValueObj, L"Set", aValueArgs, 2, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - CComVariant aValueObj( pdispValueObj ); - SafeArrayPutElement( pInitVals, &nInitInd, &aValueObj ); - - // execute initialize() - CComVariant aVarInitVals; - aVarInitVals.vt = VT_ARRAY | VT_VARIANT; aVarInitVals.parray = pInitVals; - hr = ExecuteFunc( mpInstanceLocker, L"initialize", &aVarInitVals, 1, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - } - - return S_OK; -} - -HRESULT CSOActiveX::CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ) -{ - SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, 1 ); - long ix = 0; - CComPtr pdispPropVal; - HRESULT hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal ); - if( !SUCCEEDED( hr ) ) return hr; - - OLECHAR* sPropMemberNames[2] = { L"Name", L"Value" }; - CComVariant pPropVar[2]; - pPropVar[0] = CComVariant( sArgName ); - pPropVar[1].vt = VT_BOOL; pPropVar[1].boolVal = sArgVal ? VARIANT_TRUE : VARIANT_FALSE ; - hr = PutPropertiesToIDisp( pdispPropVal, sPropMemberNames, pPropVar, 2 ); - if( !SUCCEEDED( hr ) ) return hr; - - SafeArrayPutElement( pPropVals, &ix, pdispPropVal ); - - CComVariant aDispArgs[4]; - aDispArgs[3] = CComVariant( sUrl ); - aDispArgs[2] = CComVariant( L"_self" ); - aDispArgs[1] = CComVariant( 0 ); - // aDispArgs[0] = CComVariant( pPropVals ); such constructor is not defined ??! - aDispArgs[0].vt = VT_ARRAY | VT_DISPATCH; aDispArgs[0].parray = pPropVals; - - CComVariant dummyResult; - hr = ExecuteFunc( mpDispFrame, L"loadComponentFromURL", aDispArgs, 4, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - return S_OK; -} - -HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl, - CComVariant* aArgNames, - CComVariant* aArgVals, - unsigned int count ) -{ - CComPtr pdispURL; - HRESULT hr = GetUrlStruct( sUrl, pdispURL ); - if( !SUCCEEDED( hr ) ) return hr; - - CComPtr pdispXDispatch; - CComVariant aArgs[3]; - aArgs[2] = CComVariant( pdispURL ); - aArgs[1] = CComVariant( L"" ); - aArgs[0] = CComVariant( (int)0 ); - hr = GetIDispByFunc( mpDispFrame, - L"queryDispatch", - aArgs, - 3, - pdispXDispatch ); - if( !SUCCEEDED( hr ) ) return hr; - - SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, count ); - for( long ix = 0; ix < (long)count; ix ++ ) - { - CComPtr pdispPropVal; - hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal ); - if( !SUCCEEDED( hr ) ) return hr; - - OLECHAR* sPropMemberNames[2] = { L"Name", L"Value" }; - CComVariant pPropVar[2]; - pPropVar[0] = aArgNames[ix]; - pPropVar[1] = aArgVals[ix]; - hr = PutPropertiesToIDisp( pdispPropVal, sPropMemberNames, pPropVar, 2 ); - if( !SUCCEEDED( hr ) ) return hr; - - SafeArrayPutElement( pPropVals, &ix, pdispPropVal ); - } - - CComVariant aDispArgs[2]; - aDispArgs[1] = CComVariant( pdispURL ); - // aDispArgs[0] = CComVariant( pPropVals ); such constructor is not defined ??! - aDispArgs[0].vt = VT_ARRAY | VT_DISPATCH; aDispArgs[0].parray = pPropVals; - - CComVariant dummyResult; - hr = ExecuteFunc( pdispXDispatch, L"dispatch", aDispArgs, 2, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - - return S_OK; -} - -void CSOActiveX::CallbackCreateXInputStream( CBindStatusCallback* /*pbsc*/, BYTE* pBytes, DWORD dwSize ) -{ - if ( mbReadyForActivation ) - return; - - BOOL bSuccess = FALSE; - BOOL bFinishDownload = FALSE; - if ( !pBytes ) - { - // means the download is finished, dwSize contains hresult - bFinishDownload = TRUE; - if ( SUCCEEDED( dwSize ) ) - bSuccess = TRUE; - } - else - { - HRESULT hr = S_OK; - - if ( !mpDispTempFile ) - { - CComVariant aServiceName( L"com.sun.star.io.TempFile" ); - hr = GetIDispByFunc( mpDispFactory, - L"createInstance", - &aServiceName, - 1, - mpDispTempFile ); - } - - if( SUCCEEDED( hr ) && mpDispTempFile ) - { - SAFEARRAY FAR* pDataArray = SafeArrayCreateVector( VT_I1, 0, dwSize ); - - if ( pDataArray ) - { - hr = SafeArrayLock( pDataArray ); - if ( SUCCEEDED( hr ) ) - { - for( DWORD ix = 0; ix < dwSize; ix++ ) - ((BYTE*)(pDataArray->pvData))[ix] = pBytes[ix]; - hr = SafeArrayUnlock( pDataArray ); - if ( SUCCEEDED( hr ) ) - { - CComVariant aArgs[1]; - aArgs[0].vt = VT_ARRAY | VT_I1; aArgs[0].parray = pDataArray; - CComVariant dummyResult; - hr = ExecuteFunc( mpDispTempFile, L"writeBytes", aArgs, 1, &dummyResult ); - if( SUCCEEDED( hr ) ) - bSuccess = TRUE; - } - } - } - } - } - - if ( !bSuccess ) - { - // the download failed, let StarOffice download - bFinishDownload = TRUE; - mpDispTempFile = CComPtr< IDispatch >(); - } - - if ( bFinishDownload ) - { - // trigger the loading now - mbLoad = TRUE; - mbReadyForActivation = TRUE; - - Invalidate(); - UpdateWindow(); - } -} - -HRESULT CSOActiveX::LoadURLToFrame( ) -{ - CComVariant aArgNames[4] = { L"ReadOnly", L"ViewOnly", L"AsTemplate", L"InputStream" }; - CComVariant aArgVals[4]; - unsigned int nCount = 3; // the 4-th argument is used only if the stream can be retrieved - - aArgVals[0].vt = VT_BOOL; aArgVals[0].boolVal = mbViewOnly ? VARIANT_TRUE : VARIANT_FALSE; - aArgVals[1].vt = VT_BOOL; aArgVals[1].boolVal = mbViewOnly ? VARIANT_TRUE : VARIANT_FALSE; - aArgVals[2].vt = VT_BOOL; aArgVals[2].boolVal = VARIANT_FALSE; - - if ( mpDispTempFile ) - { - aArgVals[3] = CComVariant( mpDispTempFile ); - nCount = 4; - } - - HRESULT hr = CallDispatchMethod( mCurFileUrl, aArgNames, aArgVals, nCount ); - if( !SUCCEEDED( hr ) ) return hr; - - CComVariant aBarName( L"MenuBarVisible" ); - CComVariant aBarVis; - aBarVis.vt = VT_BOOL; aBarVis.boolVal = VARIANT_FALSE; - hr = CallDispatchMethod( L"slot:6661", &aBarName, &aBarVis, 1 ); - // does not work for some documents, but it is no error - // if( !SUCCEEDED( hr ) ) return hr; - - // try to get the model and set the presetation specific property, the setting will fail for other document formats - CComPtr pdispController; - hr = GetIDispByFunc( mpDispFrame, L"getController", NULL, 0, pdispController ); - if ( SUCCEEDED( hr ) && pdispController ) - { - CComPtr pdispModel; - hr = GetIDispByFunc( pdispController, L"getModel", NULL, 0, pdispModel ); - if ( SUCCEEDED( hr ) && pdispModel ) - { - CComPtr pdispPres; - hr = GetIDispByFunc( pdispModel, L"getPresentation", NULL, 0, pdispPres ); - if ( SUCCEEDED( hr ) && pdispPres ) - { - // this is a presentation - // let the slide show be shown in the document window - OLECHAR* pPropName = L"IsFullScreen"; - CComVariant pPresProp; - pPresProp.vt = VT_BOOL; pPresProp.boolVal = VARIANT_FALSE ; - hr = PutPropertiesToIDisp( pdispPres, &pPropName, &pPresProp, 1 ); - - // start the slide show - if ( SUCCEEDED( hr ) ) - { - CComVariant dummyResult; - ExecuteFunc( pdispPres, L"Start", NULL, 0, &dummyResult ); - } - } - } - } - - // create dispatch interceptor - mpDispatchInterceptor = new CComObject< SODispatchInterceptor >(); - mpDispatchInterceptor->AddRef(); - mpDispatchInterceptor->SetParent( this ); - CComQIPtr< IDispatch, &IID_IDispatch > pIDispDispInter( mpDispatchInterceptor ); - - // register dispatch interceptor in the frame - CComVariant aDispVariant( pIDispDispInter ); - CComVariant dummyResult; - hr = ExecuteFunc( mpDispFrame, - L"registerDispatchProviderInterceptor", - &aDispVariant, - 1, - &dummyResult ); - - if( !SUCCEEDED( hr ) ) return hr; - - return S_OK; -} - -SOVersion CSOActiveX::GetVersionConnected() -{ - SOVersion bResult = SO_NOT_DETECTED; - if( mpDispFactory ) - { - // create ConfigurationProvider instance - CComPtr pdispConfProv; - CComVariant aServiceName( L"com.sun.star.configuration.ConfigurationProvider" ); - HRESULT hr = GetIDispByFunc( mpDispFactory, - L"createInstance", - &aServiceName, - 1, - pdispConfProv ); - - if( SUCCEEDED( hr ) && pdispConfProv ) - { - CComPtr pdispConfAccess; - - SAFEARRAY* pInitParams = SafeArrayCreateVector( VT_VARIANT, 0, 1 ); - - if( pInitParams ) - { - long ix = 0; - CComVariant aConfPath( L"org.openoffice.Setup" ); - SafeArrayPutElement( pInitParams, &ix, &aConfPath ); - - CComVariant aArgs[2]; - aArgs[1] = CComVariant( L"com.sun.star.configuration.ConfigurationAccess" ); - aArgs[0].vt = VT_ARRAY | VT_VARIANT; aArgs[0].parray = pInitParams; - - hr = GetIDispByFunc( pdispConfProv, - L"createInstanceWithArguments", - aArgs, - 2, - pdispConfAccess ); - - if( SUCCEEDED( hr ) && pdispConfAccess ) - { - CComVariant aOfficeName; - - CComVariant aProductName( L"Product/ooName" ); - hr = ExecuteFunc( pdispConfAccess, - L"getByHierarchicalName", - &aProductName, - 1, - &aOfficeName ); - - if( SUCCEEDED( hr ) && aOfficeName.vt == VT_BSTR ) - { - CComVariant aOfficeVersion; - - CComVariant aProductVersion( L"Product/ooSetupVersion" ); - hr = ExecuteFunc( pdispConfAccess, - L"getByHierarchicalName", - &aProductVersion, - 1, - &aOfficeVersion ); - - if( SUCCEEDED( hr ) && aOfficeVersion.vt == VT_BSTR ) - { - USES_CONVERSION; - if( !strcmp( OLE2T( aOfficeName.bstrVal ), "StarOffice" ) ) - { - if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "6.1", 3 ) ) - bResult = SO_61; - else if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "6.0", 3 ) ) - bResult = SO_60; - else if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "5.2", 3 ) ) - bResult = SO_52; - else - bResult = SO_UNKNOWN; - } - else // OpenOffice - { - if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "1.1", 3 ) ) - bResult = OO_11; - else if( !strncmp( OLE2T( aOfficeVersion.bstrVal ), "1.0", 3 ) ) - bResult = OO_10; - else - bResult = OO_UNKNOWN; - } - } - } - } - } - } - } - - return bResult; -} - -class LockingGuard -{ - BOOL& mbLocked; -public: - LockingGuard( BOOL& bLocked ) - : mbLocked( bLocked ) - { - mbLocked = TRUE; - } - - ~LockingGuard() - { - mbLocked = FALSE; - } -}; - -HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di ) -{ - // This method is called only in main thread, no need to lock it - - // Get read of reentrance problems - if ( mbDrawLocked ) - return S_OK; - LockingGuard aGuard( mbDrawLocked ); - - if( m_spInPlaceSite && mCurFileUrl && mbReadyForActivation ) - { - HWND hwnd; - HRESULT hr = m_spInPlaceSite->GetWindow( &hwnd ); - if( !SUCCEEDED( hr ) ) return hr; - - if( mParentWin != hwnd || !mOffWin ) - { - if( mpDispFrame ) - { - CComVariant dummyResult; - CComVariant aPropVar; - aPropVar.vt = VT_BOOL; aPropVar.boolVal = VARIANT_FALSE; - HRESULT hr = ExecuteFunc( mpDispFrame, L"close", &aPropVar, 1, &dummyResult ); - (void)hr; - mpDispFrame = CComPtr(); - } - - mParentWin = hwnd; - mOffWin = CreateWindow( - STAROFFICE_WINDOWCLASS, - "OfficeContainer", - WS_CHILD | WS_CLIPCHILDREN | WS_BORDER, - di.prcBounds->left, - di.prcBounds->top, - di.prcBounds->right - di.prcBounds->left, - di.prcBounds->bottom - di.prcBounds->top, - mParentWin, - NULL, - NULL, - NULL ); - - ::ShowWindow( mOffWin, SW_SHOW ); - } - else - { - RECT aRect; - ::GetWindowRect( mOffWin, &aRect ); - - if( aRect.left != di.prcBounds->left || aRect.top != di.prcBounds->top - || aRect.right != di.prcBounds->right || aRect.bottom != di.prcBounds->bottom ) - { - // on this state the office window should exist already - ::SetWindowPos( mOffWin, - HWND_TOP, - di.prcBounds->left, - di.prcBounds->top, - di.prcBounds->right - di.prcBounds->left, - di.prcBounds->bottom - di.prcBounds->top, - SWP_NOZORDER ); - - CComVariant aPosArgs[5]; - aPosArgs[4] = CComVariant( 0 ); - aPosArgs[3] = CComVariant( 0 ); - aPosArgs[2] = CComVariant( int(di.prcBounds->right - di.prcBounds->left) ); - aPosArgs[1] = CComVariant( int(di.prcBounds->bottom - di.prcBounds->top) ); - aPosArgs[0] = CComVariant( 12 ); - CComVariant dummyResult; - hr = ExecuteFunc( mpDispWin, L"setPosSize", aPosArgs, 5, &dummyResult ); - if( !SUCCEEDED( hr ) ) return hr; - } - } - - if( !mnVersion ) - { - OutputError_Impl( mOffWin, CS_E_INVALID_VERSION ); - return E_FAIL; - } - - if( ! mpDispFrame ) - { - hr = CreateFrameOldWay( mOffWin, - di.prcBounds->right - di.prcBounds->left, - di.prcBounds->bottom - di.prcBounds->top ); - - if( !SUCCEEDED( hr ) ) - { - // if the frame can not be opened do not try any more - mbReadyForActivation = FALSE; - OutputError_Impl( mOffWin, STG_E_ABNORMALAPIEXIT ); - return hr; - } - } - - if( mbLoad ) - { - hr = LoadURLToFrame(); - mbLoad = FALSE; - - if( !SUCCEEDED( hr ) ) - { - // if the document can not be opened do not try any more - mbReadyForActivation = FALSE; - - OutputError_Impl( mOffWin, STG_E_ABNORMALAPIEXIT ); - - return hr; - } - } - } - else - { - // activate the fallback - CComControl::OnDrawAdvanced( di ); - } - - return S_OK; -} - -HRESULT CSOActiveX::OnDraw( ATL_DRAWINFO& di ) -{ - // fallback that is activated by the parent class - if ( di.hdcDraw ) - FillRect( di.hdcDraw, (RECT*)di.prcBounds, (HBRUSH)COLOR_BACKGROUND ); - - return S_OK; -} - -STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite ) -{ - HRESULT hr = IOleObjectImpl::SetClientSite( aClientSite ); - - if( !aClientSite ) - { - //ATLASSERT( mWebBrowser2 ); - if( mWebBrowser2 ) - AtlUnadvise( mWebBrowser2, DIID_DWebBrowserEvents2, mCookie ); - return hr; - } - - CComPtr aContainer; - m_spClientSite->GetContainer( &aContainer ); -// ATLASSERT( aContainer ); - - if( SUCCEEDED( hr ) && aContainer ) - { - CComQIPtr aServiceProvider( aContainer ); - //ATLASSERT( aServiceProvider ); - - if( aServiceProvider ) - { - aServiceProvider->QueryService( SID_SInternetExplorer, - IID_IWebBrowser, - (void**)&mWebBrowser2 ); -// ATLASSERT( mWebBrowser2 ); - if( mWebBrowser2 ) - AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie ); - } - } - - return hr; -} - -STDMETHODIMP CSOActiveX::Invoke(DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pvarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr) -{ - if (riid != IID_NULL) - return DISP_E_UNKNOWNINTERFACE; - - if (!pDispParams) - return DISP_E_PARAMNOTOPTIONAL; - - if ( dispidMember == DISPID_ONQUIT ) - Cleanup(); - - IDispatchImpl::Invoke( - dispidMember, riid, lcid, wFlags, pDispParams, - pvarResult, pExcepInfo, puArgErr); - - return S_OK; -} - -HRESULT CSOActiveX::GetURL( const OLECHAR* url, - const OLECHAR* target ) -{ - CComVariant aEmpty1, aEmpty2, aEmpty3; - CComVariant aUrl( url ); - CComVariant aTarget; - if ( target ) - aTarget = CComVariant( target ); - - return mWebBrowser2->Navigate2( &aUrl, - &aEmpty1, - &aTarget, - &aEmpty2, - &aEmpty3 ); -} - - -// --------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOActiveX.h b/extensions/source/activex/main/SOActiveX.h deleted file mode 100644 index 4b589090b..000000000 --- a/extensions/source/activex/main/SOActiveX.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOActiveX.h : Declaration of the CSOActiveX - -#ifndef __SOACTIVEX_H_ -#define __SOACTIVEX_H_ - -#include "resource.h" // main symbols - -#pragma warning (disable:4505) - // permanently suppress "unreferenced local function has been removed" warning - -#pragma warning (push,1) -#pragma warning (disable:4265) - -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include - -#include "so_activex.h" - -#pragma warning (pop) - -class SODispatchInterceptor; - -enum SOVersion { - SO_NOT_DETECTED = 0, - SO_52, - SO_60, - SO_61, - SO_UNKNOWN, - OO_10, - OO_11, - OO_UNKNOWN -}; - -///////////////////////////////////////////////////////////////////////////// -// CSOActiveX -class ATL_NO_VTABLE CSOActiveX : - public CComObjectRootEx, - public IDispatchImpl, - public CComControl, - public IPersistStreamInitImpl, - public IOleControlImpl, - public IOleObjectImpl, - public IOleInPlaceActiveObjectImpl, - public IViewObjectExImpl, - public IOleInPlaceObjectWindowlessImpl, -// public IConnectionPointContainerImpl, - public CComCoClass, -// public CProxy_ItryPluginEvents< CSOActiveX >, - public IPersistPropertyBagImpl< CSOActiveX >, - public IProvideClassInfo2Impl< &CLSID_SOActiveX, - &DIID__ISOActiveXEvents, - &LIBID_SO_ACTIVEXLib >, - public IObjectSafetyImpl< CSOActiveX, - INTERFACESAFE_FOR_UNTRUSTED_DATA > -{ -protected: - CComPtr mWebBrowser2; - DWORD mCookie; - - CComPtr mpDispFactory; - CComPtr mpDispFrame; - CComPtr mpInstanceLocker; - CComPtr mpDispWin; - OLECHAR* mCurFileUrl; - BOOL mbLoad; - BOOL mbViewOnly; - WNDCLASS mPWinClass; - HWND mParentWin; - HWND mOffWin; - - SODispatchInterceptor* mpDispatchInterceptor; - SOVersion mnVersion; - - BOOL mbReadyForActivation; - CComPtr mpDispTempFile; - - BOOL mbDrawLocked; - -public: - CSOActiveX(); - ~CSOActiveX(); - -DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CSOActiveX) - COM_INTERFACE_ENTRY(ISOActiveX) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IViewObjectEx) - COM_INTERFACE_ENTRY(IViewObject2) - COM_INTERFACE_ENTRY(IViewObject) - COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceObject) - COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless) - COM_INTERFACE_ENTRY(IOleInPlaceActiveObject) - COM_INTERFACE_ENTRY(IOleControl) - COM_INTERFACE_ENTRY(IOleObject) - COM_INTERFACE_ENTRY(IPersistStreamInit) - COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) -// COM_INTERFACE_ENTRY(IConnectionPointContainer) - COM_INTERFACE_ENTRY(IProvideClassInfo) - COM_INTERFACE_ENTRY(IProvideClassInfo2) - COM_INTERFACE_ENTRY(IPersistPropertyBag) - COM_INTERFACE_ENTRY(IObjectSafety) -END_COM_MAP() - -BEGIN_PROP_MAP(CSOActiveX) - PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) - PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) - // Example entries - // PROP_ENTRY("Property Description", dispid, clsid) - // PROP_PAGE(CLSID_StockColorPage) -END_PROP_MAP() - -BEGIN_CONNECTION_POINT_MAP(CSOActiveX) -END_CONNECTION_POINT_MAP() - -BEGIN_MSG_MAP(CSOActiveX) - CHAIN_MSG_MAP(CComControl) - DEFAULT_REFLECTION_HANDLER() -END_MSG_MAP() -// Handler prototypes: -// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); -// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); -// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); - - - -// IViewObjectEx - DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) - -// ISOActiveX -public: - - STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ); - STDMETHOD(Invoke)( DISPID dispidMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS* pDispParams, - VARIANT* pvarResult, - EXCEPINFO* pExcepInfo, - UINT* puArgErr); - STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ); - STDMETHOD(Load) ( LPSTREAM pStm ); - STDMETHOD(InitNew) (); - HRESULT OnDrawAdvanced(ATL_DRAWINFO& di); - HRESULT OnDraw(ATL_DRAWINFO& di); - - HRESULT SetLayoutManagerProps(); - HRESULT CreateFrameOldWay( HWND hwnd, int width, int height ); - HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr& pdispResult ); - HRESULT LoadURLToFrame(); - HRESULT CallDispatchMethod( OLECHAR* sUrl, CComVariant* sArgNames, CComVariant* sArgVal, unsigned int count ); - HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ); - HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr& pdispUrl ); - HRESULT Cleanup(); - HRESULT TerminateOffice(); - HRESULT GetURL( const OLECHAR* url, - const OLECHAR* target ); - - void CallbackCreateXInputStream( CBindStatusCallback* pbsc, BYTE* pBytes, DWORD dwSize ); - - - SOVersion GetVersionConnected(); -}; - -#endif //__SOACTIVEX_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOActiveX.rgs b/extensions/source/activex/main/SOActiveX.rgs deleted file mode 100644 index d3814df3b..000000000 --- a/extensions/source/activex/main/SOActiveX.rgs +++ /dev/null @@ -1,33 +0,0 @@ -HKCR -{ - so_activex.SOActiveX.1 = s 'SOActiveX Class' - { - CLSID = s '{67F2A879-82D5-4A6D-8CC5-FFB3C114B69D}' - } - so_activex.SOActiveX = s 'SOActiveX Class' - { - CLSID = s '{67F2A879-82D5-4A6D-8CC5-FFB3C114B69D}' - CurVer = s 'so_activex.SOActiveX.1' - } - NoRemove CLSID - { - ForceRemove {67F2A879-82D5-4A6D-8CC5-FFB3C114B69D} = s 'SOActiveX Class' - { - ProgID = s 'so_activex.SOActiveX.1' - VersionIndependentProgID = s 'so_activex.SOActiveX' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - ForceRemove 'Control' - ForceRemove 'ToolboxBitmap32' = s '%MODULE%, 101' - 'MiscStatus' = s '0' - { - '1' = s '131473' - } - 'TypeLib' = s '{61FA3F13-8061-4796-B055-3697ED28CB38}' - 'Version' = s '1.0' - } - } -} diff --git a/extensions/source/activex/main/SOComWindowPeer.cpp b/extensions/source/activex/main/SOComWindowPeer.cpp deleted file mode 100644 index bf631a453..000000000 --- a/extensions/source/activex/main/SOComWindowPeer.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOComWindowPeer.cpp : Implementation of CHelpApp and DLL registration. - -#include "stdafx2.h" -#include "so_activex.h" -#include "SOComWindowPeer.h" -#include - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_ISOComWindowPeer, - }; - - for (int i=0;i= 1300) - if (InlineIsEqualGUID(*arr[i],riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) -#endif - return S_OK; - } - return S_FALSE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOComWindowPeer.h b/extensions/source/activex/main/SOComWindowPeer.h deleted file mode 100644 index c819e17a8..000000000 --- a/extensions/source/activex/main/SOComWindowPeer.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SOComWindowPeer.h: Definition of the SOComWindowPeer class -// -////////////////////////////////////////////////////////////////////// - -#if !defined __SOCOMWINDOWPEER_H_ -#define __SOCOMWINDOWPEER_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include - -#include "so_activex.h" - -///////////////////////////////////////////////////////////////////////////// -// SOComWindowPeer - -class SOComWindowPeer : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ - HWND m_hwnd; -public: - SOComWindowPeer() : m_hwnd( NULL ) {} - virtual ~SOComWindowPeer() { } - -BEGIN_COM_MAP(SOComWindowPeer) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISOComWindowPeer) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(SOComWindowPeer) -// Remove the comment from the line above if you don't want your object to -// support aggregation. - -DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// ISOComWindowPeer - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle( - /* [in] */ SAFEARRAY __RPC_FAR * /*procId*/, - /* [in] */ short /*s*/, - /* [retval][out] */ long __RPC_FAR *ret) - { - *ret = HandleToLong( m_hwnd ); - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) - { - *retVal = NULL; - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer( - /* [in] */ IDispatch __RPC_FAR* /*xPointer*/) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground( - /* [in] */ int /*nColor*/) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate( - /* [in] */ short /*__MIDL_0015*/) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect( - /* [in] */ IDispatch __RPC_FAR* /*aRect*/, - /* [in] */ short /*nFlags*/) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener( - /* [in] */ IDispatch __RPC_FAR* /*xListener*/) - { - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener( - /* [in] */ IDispatch __RPC_FAR* /*xListener*/) - { - return S_OK; - } - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) - { - *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 ); - - if( !*pVal ) - return E_FAIL; - - long ix = 0; - CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - ix = 1; - aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - return S_OK; - } - - void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; } -}; - -#endif // __SOCOMWINDOWPEER_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SOComWindowPeer.rgs b/extensions/source/activex/main/SOComWindowPeer.rgs deleted file mode 100644 index 42e985a31..000000000 --- a/extensions/source/activex/main/SOComWindowPeer.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - so_activex.SOComWindowPeer.1 = s 'SOComWindowPeer Class' - { - CLSID = s '{EE51BD3E-8BB6-4FB8-B319-F65B1BE3B21D}' - } - so_activex.SOComWindowPeer = s 'SOComWindowPeer Class' - { - CLSID = s '{EE51BD3E-8BB6-4FB8-B319-F65B1BE3B21D}' - } - NoRemove CLSID - { - ForceRemove {EE51BD3E-8BB6-4FB8-B319-F65B1BE3B21D} = s 'SOComWindowPeer Class' - { - ProgID = s 'so_activex.SOComWindowPeer.1' - VersionIndependentProgID = s 'so_activex.SOComWindowPeer' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/extensions/source/activex/main/SODispatchInterceptor.cpp b/extensions/source/activex/main/SODispatchInterceptor.cpp deleted file mode 100644 index 1e0535462..000000000 --- a/extensions/source/activex/main/SODispatchInterceptor.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SODispatchInterceptor.cpp : Implementation of CHelpApp and DLL registration. - -#include "stdio.h" -#include "stdafx2.h" -#include "so_activex.h" -#include "SOActiveX.h" -#include "SODispatchInterceptor.h" -#include "com_uno_helper.h" -#include - -///////////////////////////////////////////////////////////////////////////// -// - -STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid) -{ - static const IID* arr[] = - { - &IID_ISODispatchInterceptor, - }; - - for (int i=0;i= 1300) - if (InlineIsEqualGUID(*arr[i],riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) -#endif - return S_OK; - } - return S_FALSE; -} - -STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL, - BSTR aTargetFrameName, - long nSearchFlags, - IDispatch FAR* FAR* retVal ) -{ - if ( !aURL || !retVal ) return E_FAIL; - - CComVariant aTargetUrl; - OLECHAR* sURLMemberName = L"Complete"; - DISPID nURLID; - HRESULT hr = aURL->GetIDsOfNames( IID_NULL, &sURLMemberName, 1, LOCALE_USER_DEFAULT, &nURLID ); - if( !SUCCEEDED( hr ) ) return hr; - - hr = CComDispatchDriver::GetProperty( aURL, nURLID, &aTargetUrl ); - if( !SUCCEEDED( hr ) ) return hr; - - if( aTargetUrl.vt != VT_BSTR ) return E_FAIL; - - USES_CONVERSION; - if( !strncmp( OLE2T( aTargetUrl.bstrVal ), ".uno:OpenHyperlink", 18 ) ) - { - CComQIPtr< IDispatch, &IID_IDispatch > pIDisp( this ); - if( pIDisp ) - { - this->AddRef(); - *retVal = pIDisp; - } - } - else - { - if( !m_xSlave ) - { - *retVal = NULL; - return S_OK; - } - - CComVariant aResult; - CComVariant aArgs[3]; - aArgs[0] = CComVariant( nSearchFlags ); - aArgs[1] = CComVariant( aTargetFrameName ); - aArgs[2] = CComVariant( aURL ); - - hr = ExecuteFunc( m_xSlave, L"queryDispatch", aArgs, 3, &aResult ); - if( !SUCCEEDED( hr ) || aResult.vt != VT_DISPATCH || aResult.pdispVal == NULL ) - { - *retVal = NULL; - return S_OK; - } - - *retVal = aResult.pdispVal; - - CComQIPtr< IUnknown, &IID_IUnknown > pIUnk( *retVal ); - if( pIUnk ) - (*retVal)->AddRef(); - } - - return S_OK; -} - -STDMETHODIMP SODispatchInterceptor::queryDispatches( SAFEARRAY FAR* aDescripts, SAFEARRAY FAR* FAR* retVal) -{ - if ( !aDescripts || !retVal || SafeArrayGetDim( aDescripts ) != 1 ) - return E_FAIL; - - long nLB, nUB; - - HRESULT hr = SafeArrayGetLBound( aDescripts, 1, &nLB ); - if( !SUCCEEDED( hr ) ) return hr; - - hr = SafeArrayGetUBound( aDescripts, 1, &nUB ); - if( !SUCCEEDED( hr ) ) return hr; - if( nUB < nLB ) return E_FAIL; - - *retVal = SafeArrayCreateVector( VT_DISPATCH, 0, nUB - nLB ); - - for ( long ind = nLB; ind <= nUB; ind ++ ) - { - CComPtr pElem; - SafeArrayGetElement( aDescripts, &ind, pElem ); - if( pElem ) - { - OLECHAR* pMemberNames[3] = { L"FeatureURL", L"FrameName", L"SearchFlags" }; - CComVariant pValues[3]; - hr = GetPropertiesFromIDisp( pElem, pMemberNames, pValues, 3 ); - if( !SUCCEEDED( hr ) ) return hr; - if( pValues[0].vt != VT_DISPATCH || pValues[0].pdispVal == NULL - || pValues[1].vt != VT_BSTR || pValues[2].vt != VT_I4 ) - return E_FAIL; - - CComPtr aRes; - hr = queryDispatch( pValues[0].pdispVal, pValues[1].bstrVal, pValues[2].lVal, &aRes ); - SafeArrayPutElement( *retVal, &ind, aRes ); - } - } - - return S_OK; -} - - -STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR* aArgs) -{ - // get url from aURL - OLECHAR* pUrlName = L"Complete"; - CComVariant pValue; - HRESULT hr = GetPropertiesFromIDisp( aURL, &pUrlName, &pValue, 1 ); - if( !SUCCEEDED( hr ) ) return hr; - if( pValue.vt != VT_BSTR || pValue.bstrVal == NULL ) - return E_FAIL; - - USES_CONVERSION; - if( !strncmp( OLE2T( pValue.bstrVal ), ".uno:OpenHyperlink", 18 ) ) - { - long nLB = 0, nUB = 0; - // long nDim = SafeArrayGetDim( aArgs ); - - hr = SafeArrayGetLBound( aArgs, 1, &nLB ); - if( !SUCCEEDED( hr ) ) return hr; - - hr = SafeArrayGetUBound( aArgs, 1, &nUB ); - if( !SUCCEEDED( hr ) ) return hr; - if( nUB < nLB ) return E_FAIL; - - for ( long ind = nLB; ind <= nUB; ind ++ ) - { - CComVariant pVarElem; - SafeArrayGetElement( aArgs, &ind, &pVarElem ); - if( pVarElem.vt == VT_DISPATCH && pVarElem.pdispVal != NULL ) - { - OLECHAR* pMemberNames[2] = { L"Name", L"Value" }; - CComVariant pValues[2]; - hr = GetPropertiesFromIDisp( pVarElem.pdispVal, pMemberNames, pValues, 2 ); - if( !SUCCEEDED( hr ) ) return hr; - - if( pValues[0].vt == VT_BSTR && pValues[1].vt == VT_BSTR ) - { - USES_CONVERSION; - if( !strncmp( OLE2T( pValues[0].bstrVal ), "URL", 3 ) ) - { - EnterCriticalSection( &mMutex ); - if( m_xParentControl ) - { - // call GetUrl to the browser instance - m_xParentControl->GetURL( pValues[1].bstrVal, L"_self" ); - } - LeaveCriticalSection( &mMutex ); - - break; - } - } - } - } - } - - return S_OK; -} - -STDMETHODIMP SODispatchInterceptor::addStatusListener( IDispatch FAR* /*xControl*/, IDispatch FAR* /*aURL*/) -{ - // not implemented - return S_OK; -} - -STDMETHODIMP SODispatchInterceptor::removeStatusListener( IDispatch FAR* /*xControl*/, IDispatch FAR* /*aURL*/) -{ - // not implemented - return S_OK; -} - -STDMETHODIMP SODispatchInterceptor::getInterceptedURLs( SAFEARRAY FAR* FAR* pVal ) -{ - *pVal = SafeArrayCreateVector( VT_BSTR, 0, 3 ); - - if( !*pVal ) - return E_FAIL; - - long ix = 0; - CComBSTR aPattern( OLESTR( "ftp://*" ) ); - SafeArrayPutElement( *pVal, &ix, aPattern ); - - ix = 1; - aPattern = CComBSTR( OLESTR( "http://*" ) ); - SafeArrayPutElement( *pVal, &ix, aPattern ); - - ix = 2; - aPattern = CComBSTR( OLESTR( "file://*" ) ); - SafeArrayPutElement( *pVal, &ix, aPattern ); - - return S_OK; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SODispatchInterceptor.h b/extensions/source/activex/main/SODispatchInterceptor.h deleted file mode 100644 index 1a9b7e38c..000000000 --- a/extensions/source/activex/main/SODispatchInterceptor.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// SODispatchInterceptor.h: Definition of the SODispatchInterceptor class -// -////////////////////////////////////////////////////////////////////// - -#if !defined __SODISPATCHINTERCEPTOR_H_ -#define __SODISPATCHINTERCEPTOR_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "resource.h" // main symbols -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include - -#include "so_activex.h" - -class CSOActiveX; - -///////////////////////////////////////////////////////////////////////////// -// SODispatchInterceptor - -class SODispatchInterceptor : - public IDispatchImpl, - public ISupportErrorInfo, - public CComObjectRoot, - public CComCoClass -{ - CComPtr m_xMaster; - CComPtr m_xSlave; - CSOActiveX* m_xParentControl; - CRITICAL_SECTION mMutex; -public: - SODispatchInterceptor() : m_xParentControl( NULL ) { InitializeCriticalSection(&mMutex); } - virtual ~SODispatchInterceptor() { ATLASSERT( !m_xParentControl ); DeleteCriticalSection(&mMutex); } - -BEGIN_COM_MAP(SODispatchInterceptor) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISODispatchInterceptor) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() -DECLARE_NOT_AGGREGATABLE(SODispatchInterceptor) -// Remove the comment from the line above if you don't want your object to -// support aggregation. - -DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR) - - void SetParent( CSOActiveX* pParent ) - { - ATLASSERT( !m_xParentControl ); - EnterCriticalSection( &mMutex ); - m_xParentControl = pParent; - LeaveCriticalSection( &mMutex ); - } - - void ClearParent() - { - EnterCriticalSection( &mMutex ); - m_xParentControl = NULL; - LeaveCriticalSection( &mMutex ); - } - -// ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - -// ISODispatchInterceptor - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getSlaveDispatchProvider( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) - { - *retVal = m_xSlave; - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setSlaveDispatchProvider( - /* [in] */ IDispatch __RPC_FAR *xNewDispatchProvider) - { - m_xSlave = xNewDispatchProvider; - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getMasterDispatchProvider( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) - { - *retVal = m_xMaster; - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setMasterDispatchProvider( - /* [in] */ IDispatch __RPC_FAR *xNewSupplier) - { - m_xMaster = xNewSupplier; - return S_OK; - } - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE queryDispatch( - /* [in] */ IDispatch __RPC_FAR *aURL, - /* [in] */ BSTR aTargetFrameName, - /* [in] */ long nSearchFlags, - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal); - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE queryDispatches( - /* [in] */ SAFEARRAY __RPC_FAR * aDescripts, - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *retVal); - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispatch( - /* [in] */ IDispatch __RPC_FAR *aURL, - /* [in] */ SAFEARRAY __RPC_FAR * aArgs); - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addStatusListener( - /* [in] */ IDispatch __RPC_FAR *xControl, - /* [in] */ IDispatch __RPC_FAR *aURL); - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeStatusListener( - /* [in] */ IDispatch __RPC_FAR *xControl, - /* [in] */ IDispatch __RPC_FAR *aURL); - - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getInterceptedURLs( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal); - - virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) - { - *pVal = SafeArrayCreateVector( VT_BSTR, 0, 4 ); - - if( !*pVal ) - return E_FAIL; - - long ix = 0; - CComBSTR aInterface( OLESTR( "com.sun.star.frame.XDispatchProviderInterceptor" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - ix = 1; - aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XDispatchProvider" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - ix = 2; - aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XDispatch" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - ix = 3; - aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XInterceptorInfo" ) ); - SafeArrayPutElement( *pVal, &ix, aInterface ); - - return S_OK; - } -}; - -#endif // __SODISPATCHINTERCEPTOR_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/SODispatchInterceptor.rgs b/extensions/source/activex/main/SODispatchInterceptor.rgs deleted file mode 100644 index 19fe0b5f0..000000000 --- a/extensions/source/activex/main/SODispatchInterceptor.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - so_activex.SODispatchInterceptor.1 = s 'SODispatchInterceptor Class' - { - CLSID = s '{C5D6D568-57DA-4D6C-819A-451CB565E682}' - } - so_activex.SODispatchInterceptor = s 'SODispatchInterceptor Class' - { - CLSID = s '{C5D6D568-57DA-4D6C-819A-451CB565E682}' - } - NoRemove CLSID - { - ForceRemove {C5D6D568-57DA-4D6C-819A-451CB565E682} = s 'SODispatchInterceptor Class' - { - ProgID = s 'so_activex.SODispatchInterceptor.1' - VersionIndependentProgID = s 'so_activex.SODispatchInterceptor' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'both' - } - } - } -} diff --git a/extensions/source/activex/main/StdAfx2.cpp b/extensions/source/activex/main/StdAfx2.cpp deleted file mode 100644 index f1cf88d10..000000000 --- a/extensions/source/activex/main/StdAfx2.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx1.cpp : source file that includes just the standard includes -// stdafx1.pch will be the pre-compiled header -// stdafx1.obj will contain the pre-compiled type information - -#ifdef __MINGW32__ -#define _INIT_ATL_COMMON_VARS -#endif -#include "stdafx2.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/StdAfx2.h b/extensions/source/activex/main/StdAfx2.h deleted file mode 100644 index 5c540b0ba..000000000 --- a/extensions/source/activex/main/StdAfx2.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx1.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__C1799EA0_62CC_44DE_A2DD_C9F0410FF7F1__INCLUDED_) -#define AFX_STDAFX_H__C1799EA0_62CC_44DE_A2DD_C9F0410FF7F1__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED -#define _ATL_STATIC_REGISTRY - -#pragma warning (disable:4505) - // globally disable "unreferenced local function has been removed" - -#pragma warning (push,1) -#pragma warning (disable:4548) - // expression before comma has no effect; expected expression with side-effect -#pragma warning (disable:4555) - // expression has no effect; expected expression with side-effect - -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#include - -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include - -#pragma warning (pop) - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__C1799EA0_62CC_44DE_A2DD_C9F0410FF7F1__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/com_uno_helper.h b/extensions/source/activex/main/com_uno_helper.h deleted file mode 100644 index 94573c645..000000000 --- a/extensions/source/activex/main/com_uno_helper.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#include "stdafx2.h" - -HRESULT ExecuteFunc( IDispatch* idispUnoObject, - OLECHAR* sFuncName, - CComVariant* params, - unsigned int count, - CComVariant* pResult ); - -HRESULT GetIDispByFunc( IDispatch* idispUnoObject, - OLECHAR* sFuncName, - CComVariant* params, - unsigned int count, - CComPtr& pdispResult ); - -HRESULT PutPropertiesToIDisp( IDispatch* pdispObject, - OLECHAR** sMemberNames, - CComVariant* pVariant, - unsigned int count ); - -HRESULT GetPropertiesFromIDisp( IDispatch* pdispObject, - OLECHAR** sMemberNames, - CComVariant* pVariant, - unsigned int count ); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/example.html b/extensions/source/activex/main/example.html deleted file mode 100644 index 3efee1f75..000000000 --- a/extensions/source/activex/main/example.html +++ /dev/null @@ -1,26 +0,0 @@ - - -Document Title - - - -
-First you should edit the example.html file!!! -
-
- - - - - - - -
- - - diff --git a/extensions/source/activex/main/makefile.mk b/extensions/source/activex/main/makefile.mk deleted file mode 100644 index bdfe30642..000000000 --- a/extensions/source/activex/main/makefile.mk +++ /dev/null @@ -1,151 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=extensions -TARGET=so_activex - -use_shl_versions= - -# --- Settings ---------------------------------- -.INCLUDE : settings.mk - -.IF "$(GUI)" == "WNT" && "$(DISABLE_ACTIVEX)"=="" - -VERSIONOBJ= -LIBTARGET=NO -USE_DEFFILE=YES -UWINAPILIB= - -.IF "$(BUILD_X64)"!="" -USE_DEFFILE_X64=TRUE -.ENDIF - -INCPRE+=$(foreach,i,$(ATL_INCLUDE) -I$(i)) \ - -I$(MISC) \ - -# --- Files ------------------------------------- - - -.IF "$(PRODUCT)"!="" -RC+=-DPRODUCT -.ENDIF - -RCFILES=\ - $(TARGET).rc -RCDEPN=$(MISC)$/envsettings.h - -SLOFILES=\ - $(SLO)$/so_activex.obj \ - $(SLO)$/SOActiveX.obj \ - $(SLO)$/SOComWindowPeer.obj \ - $(SLO)$/SODispatchInterceptor.obj \ - $(SLO)$/SOActionsApproval.obj \ - $(SLO)$/StdAfx2.obj - -SHL1TARGET=$(TARGET) -SHL1STDLIBS=\ - $(UUIDLIB) \ - $(ADVAPI32LIB) \ - $(OLE32LIB) \ - $(OLEAUT32LIB) \ - $(GDI32LIB) \ - $(URLMONLIB) \ - $(SHLWAPILIB) - -.IF "$(COM)"!="GCC" -.IF "$(CCNUMVER)" > "001300000000" - SHL1STDLIBS+= $(ATL_LIB)$/atls.lib -.ENDIF -.ENDIF - - -# $(KERNEL32LIB) \ -# rpcndr.lib \ -# rpcns4.lib \ -# rpcrt4.lib - -#$(KERNEL32LIB) rpcndr.lib rpcns4.lib rpcrt4.lib - -SHL1OBJS=$(SLOFILES) - -SHL1LIBS= -SHL1DEF=$(TARGET).def -SHL1RES=$(RES)$/$(TARGET).res - -.ENDIF - -.IF "$(BUILD_X64)"!="" -# -------------------- x64 ----------------------- - -CDEFS_X64+:=$(foreach,i,$(CDEFS) $(subst,-D_X86_=1, $i)) -LIBTARGET_X64=NO -USE_DEFFILE_X64=YES -UWINAPILIB_X64= - -SLOFILES_X64= \ - $(SLO_X64)$/so_activex.obj \ - $(SLO_X64)$/SOActiveX.obj \ - $(SLO_X64)$/SOComWindowPeer.obj \ - $(SLO_X64)$/SODispatchInterceptor.obj \ - $(SLO_X64)$/SOActionsApproval.obj \ - $(SLO_X64)$/StdAfx2.obj - -SHL1TARGET_X64=$(TARGET) - -SHL1STDLIBS_X64+=\ - $(UUIDLIB_X64) \ - $(ADVAPI32LIB_X64) \ - $(OLE32LIB_X64) \ - $(OLEAUT32LIB_X64) \ - $(GDI32LIB_X64) \ - $(URLMONLIB_X64) \ - $(SHLWAPILIB_X64) \ - $(KERNEL32LIB_X64) \ - $(USER32LIB_X64) \ - $(MSVCRT_X64) \ - $(MSVCPRT_X64) \ - $(OLDNAMESLIB_X64) - -SHL1OBJS_X64=$(SLOFILES_X64) -SHL1DEF_X64=$(TARGET).def - -SHL1STDLIBS_X64+= $(ATL_LIB)$/amd64$/atls.lib - -.ENDIF # "$(BUILD_X64)"!="" - -# --- Targets ---------------------------------- - -.INCLUDE : set_wntx64.mk -VERSIONOBJ_X64= -.INCLUDE : target.mk -.INCLUDE : tg_wntx64.mk - -$(MISC)$/envsettings.h : makefile.mk - -$(RM) $@ -# it looks wrong; but rc likes it that way... - echo "#define MISC .\..\$(INPATH)\misc" > $@ diff --git a/extensions/source/activex/main/resource.h b/extensions/source/activex/main/resource.h deleted file mode 100644 index a80234031..000000000 --- a/extensions/source/activex/main/resource.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by so_activex.rc -// -#define IDS_PROJNAME 100 -#define IDB_SOACTIVEX 101 -#define IDR_SOACTIVEX 102 -#define IDB_SOCOMWINDOWPEER 103 -#define IDR_SOCOMWINDOWPEER 104 -#define IDB_SODISPATCHINTERCEPTOR 105 -#define IDR_SODISPATCHINTERCEPTOR 106 -#define IDB_SODOCUMENTEVENTLISTENER 107 -#define IDR_SODOCUMENTEVENTLISTENER 108 - - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 107 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/so_activex.cpp b/extensions/source/activex/main/so_activex.cpp deleted file mode 100644 index 9767c618c..000000000 --- a/extensions/source/activex/main/so_activex.cpp +++ /dev/null @@ -1,686 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// so_activex.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f so_activexps.mk in the project directory. - -#include "stdio.h" -#include "stdafx2.h" -#include "resource.h" -#include -#include "so_activex.h" - -#include "so_activex_i.c" -#include "SOActiveX.h" - -#include - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_SOActiveX, CSOActiveX) -END_OBJECT_MAP() - - -#define X64_LIB_NAME "so_activex_x64.dll" -#define X32_LIB_NAME "so_activex.dll" - -// to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY -// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. -// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and -// extensions\source\activex\main\so_activex.cpp -#ifndef KEY_WOW64_64KEY - #define KEY_WOW64_64KEY (0x0100) -#endif -#ifndef KEY_WOW64_32KEY - #define KEY_WOW64_32KEY (0x0200) -#endif - -const REGSAM n64KeyAccess = KEY_ALL_ACCESS | KEY_WOW64_64KEY; -const REGSAM n32KeyAccess = KEY_ALL_ACCESS; - -#ifdef _AMD64_ -const BOOL bX64 = TRUE; -#define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyExA( key, aPath, nKeyAccess, 0 ) -#else -const BOOL bX64 = FALSE; -#define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyA( key, aPath ) -#endif - -// MinGW doesn't know anything about RegDeleteKeyExA if WINVER < 0x0502. -extern "C" { -WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY,LPCSTR,REGSAM,DWORD); -} - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_SO_ACTIVEXLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -// for now database component and chart are always installed -#define SUPPORTED_EXT_NUM 30 -const char* aFileExt[] = { ".vor", - ".sds", ".sda", ".sdd", ".sdp", ".sdc", ".sdw", ".smf", - ".stw", ".stc", ".sti", ".std", - ".sxw", ".sxc", ".sxi", ".sxd", ".sxg", ".sxm", - ".ott", ".otg", ".otp", ".ots", ".otf", - ".odt", ".oth", ".odm", ".odg", ".odp", ".ods", ".odf"}; -const char* aMimeType[] = { - "application/vnd.stardivision.writer", - - "application/vnd.stardivision.chart", - "application/vnd.stardivision.draw", - "application/vnd.stardivision.impress", - "application/vnd.stardivision.impress-packed", - "application/vnd.stardivision.calc", - "application/vnd.stardivision.writer", - "application/vnd.stardivision.math", - - MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII, - - MIMETYPE_VND_SUN_XML_WRITER_ASCII, - MIMETYPE_VND_SUN_XML_CALC_ASCII, - MIMETYPE_VND_SUN_XML_IMPRESS_ASCII, - MIMETYPE_VND_SUN_XML_DRAW_ASCII, - MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII, - MIMETYPE_VND_SUN_XML_MATH_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII, - - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII, - MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII }; - -const int nForModes[] = { 16, - 1, 2, 4, 4, 8, 16, 32, - 16, 8, 4, 2, - 16, 8, 4, 2, 16, 32, - 16, 2, 4, 8, 32, - 16, 16, 16, 2, 4, 8, 32 }; - -const char* aClassID = "{67F2A879-82D5-4A6D-8CC5-FFB3C114B69D}"; -const char* aTypeLib = "{61FA3F13-8061-4796-B055-3697ED28CB38}"; - -// ISOComWindowPeer interface information -const char* aInterIDWinPeer = "{BF5D10F3-8A10-4A0B-B150-2B6AA2D7E118}"; -const char* aProxyStubWinPeer = "{00020424-0000-0000-C000-000000000046}"; - -// ISODispatchInterceptor interface information -const char* aInterIDDispInt = "{9337694C-B27D-4384-95A4-9D8E0EABC9E5}"; -const char* aProxyStubDispInt = "{00020424-0000-0000-C000-000000000046}"; - -// ISOActionsApproval interface information -const char* aInterIDActApprove = "{029E9F1E-2B3F-4297-9160-8197DE7ED54F}"; -const char* aProxyStubActApprove = "{00020424-0000-0000-C000-000000000046}"; - -// The following prefix is required for HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER ( not for HKEY_CLASSES_ROOT ) -const char* aLocalPrefix = "Software\\Classes\\"; - -BOOL createKey( HKEY hkey, - const char* aKeyToCreate, - REGSAM nKeyAccess, - const char* aValue = NULL, - const char* aChildName = NULL, - const char* aChildValue = NULL ) -{ - HKEY hkey1; - - return ( ERROR_SUCCESS == RegCreateKeyExA( hkey, aKeyToCreate, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && ( !aValue || ERROR_SUCCESS == RegSetValueExA( hkey1, - "", - 0, - REG_SZ, - (const BYTE*)aValue, - strlen( aValue ) ) ) - && ( !aChildName || ERROR_SUCCESS == RegSetValueExA( hkey1, - aChildName, - 0, - REG_SZ, - (const BYTE*)aChildValue, - strlen( aChildValue ) ) ) - && ERROR_SUCCESS == RegCloseKey( hkey1 ) ); - -} - -STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ); -STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess, const char* pProgramPath, const char* pLibName ) -{ - BOOL aResult = FALSE; - - HKEY hkey = NULL; - HKEY hkey1 = NULL; - HKEY hkey2 = NULL; - HKEY hkey3 = NULL; - HKEY hkey4 = NULL; - char aSubKey[513]; - int ind; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - - char pActiveXPath[1124]; - char pActiveXPath101[1124]; - - - // In case SO7 is installed for this user he can have local registry entries that will prevent him from - // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. - // Unfortunately it can be done only for the user who installs the office. - if ( bForAllUsers ) - DllUnregisterServerNative( nMode, sal_False, sal_False ); - - if ( pProgramPath && strlen( pProgramPath ) < 1024 ) - { - sprintf( pActiveXPath, "%s\\%s", pProgramPath, pLibName ); - sprintf( pActiveXPath101, "%s\\%s, 101", pProgramPath, pLibName ); - - { - wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - aResult = - ( ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) - && ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, (const BYTE*)"SOActiveX Class", 17 ) - && createKey( hkey, "Control", nKeyAccess ) - && createKey( hkey, "EnableFullPage", nKeyAccess ) - && createKey( hkey, "InprocServer32", nKeyAccess, pActiveXPath, "ThreadingModel", "Apartment" ) - && createKey( hkey, "MiscStatus", nKeyAccess, "0" ) - && createKey( hkey, "MiscStatus\\1", nKeyAccess, "131473" ) - && createKey( hkey, "ProgID", nKeyAccess, "so_activex.SOActiveX.1" ) - && createKey( hkey, "Programmable", nKeyAccess ) - && createKey( hkey, "ToolboxBitmap32", nKeyAccess, pActiveXPath101 ) - && createKey( hkey, "TypeLib", nKeyAccess, aTypeLib ) - && createKey( hkey, "Version", nKeyAccess, "1.0" ) - && createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" ) - && ERROR_SUCCESS == RegCloseKey( hkey ) - && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) - && createKey( hkey, "so_activex.SOActiveX", nKeyAccess, "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) - && createKey( hkey1, "CurVer", nKeyAccess, "so_activex.SOActiveX.1" ) - && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && createKey( hkey, "so_activex.SOActiveX.1", nKeyAccess, "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX.1", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) - && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "TypeLib", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aTypeLib, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) - && createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey3 , NULL ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey4 , NULL ) - && createKey( hkey4, "win32", nKeyAccess, pActiveXPath ) - && ERROR_SUCCESS == RegCloseKey( hkey4 ) - && createKey( hkey3, "FLAGS", nKeyAccess, "0" ) - && createKey( hkey3, "HELPDIR", nKeyAccess, pProgramPath ) - && ERROR_SUCCESS == RegCloseKey( hkey3 ) - && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "Interface", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && createKey( hkey1, aInterIDWinPeer, nKeyAccess, "ISOComWindowPeer" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDWinPeer, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) - && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubWinPeer ) - && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubWinPeer ) - && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) - && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && createKey( hkey1, aInterIDActApprove, nKeyAccess, "ISOActionsApproval" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDActApprove, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) - && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubActApprove ) - && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubActApprove ) - && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) - && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && createKey( hkey1, aInterIDDispInt, nKeyAccess, "ISODispatchInterceptor" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDDispInt, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) - && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubDispInt ) - && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubDispInt ) - && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) - && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCloseKey( hkey ) ); - - hkey = hkey1 = hkey2 = hkey3 = hkey4 = NULL; - } - } - - for( ind = 0; ind < SUPPORTED_EXT_NUM && aResult; ind++ ) - { - if( nForModes[ind] & nMode ) - { - wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) -// || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ, -// (const BYTE *)aFileExt[ind], strlen( aFileExt[ind] ) ) - || ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ, - (const BYTE *)aClassID, strlen(aClassID)) ) - aResult = FALSE; - - if( hkey ) - RegCloseKey(hkey),hkey= NULL; - -/* - wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) - || ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ, - (const BYTE *)aMimeType[ind], strlen( aMimeType[ind] ) ) ) - aResult = FALSE; - if( hkey ) - RegCloseKey(hkey),hkey= NULL; -*/ - } - } - - wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if ( aResult && ERROR_SUCCESS == RegOpenKeyExA(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nKeyAccess, &hkey) ) - { - for( ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) - { - wsprintfA( aSubKey, "EnableFullPage\\%s", aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) - aResult = FALSE; - - if ( hkey1 ) - RegCloseKey(hkey1),hkey1= NULL; - } - } - else - aResult = FALSE; - - if ( hkey ) - RegCloseKey(hkey),hkey= NULL; - - return aResult; -} - -STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, const char* pProgramPath ) -{ - HRESULT hr = S_OK; - if ( bFor64Bit ) - hr = DllRegisterServerNative_Impl( nMode, bForAllUsers, n64KeyAccess, pProgramPath, X64_LIB_NAME ); - - if ( SUCCEEDED( hr ) ) - hr = DllRegisterServerNative_Impl( nMode, bForAllUsers, n32KeyAccess, pProgramPath, X32_LIB_NAME ); - - return hr; -} - - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry -HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) -{ - HKEY hkey1 = NULL; - - char pSubKeyName[256]; - // first delete the subkeys - while( ERROR_SUCCESS == RegOpenKeyExA( hkey, pPath, 0, nKeyAccess, &hkey1) - && ERROR_SUCCESS == RegEnumKeyA( hkey1, 0, pSubKeyName, 256 ) - && ERROR_SUCCESS == DeleteKeyTree( hkey1, pSubKeyName, nKeyAccess ) ) - { - RegCloseKey( hkey1 ),hkey1= NULL; - } - - if ( hkey1 ) - RegCloseKey( hkey1 ),hkey1= NULL; - - // delete the key itself - return REG_DELETE_KEY_A( hkey, pPath, nKeyAccess & ( KEY_WOW64_64KEY | KEY_WOW64_32KEY ) ); -} - -STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) -{ - HKEY hkey = NULL; - BOOL fErr = FALSE; - char aSubKey[513]; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - - for( int ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) - { - if( nForModes[ind] & nMode ) - { - DWORD nSubKeys = 0, nValues = 0; - wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) - fErr = TRUE; - else - { - if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) - fErr = TRUE; - - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) - { - RegCloseKey( hkey ), hkey = NULL; - fErr = TRUE; - } - else - { - RegCloseKey( hkey ), hkey = NULL; - if ( !nSubKeys && !nValues ) - DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); - } - } - - wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) - fErr = TRUE; - else - { - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) - { - RegCloseKey( hkey ), hkey = NULL; - fErr = TRUE; - } - else - { - RegCloseKey( hkey ), hkey = NULL; - if ( !nSubKeys && !nValues ) - DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); - } - } - } - } - - wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%sso_activex.SOActiveX", aPrefix ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%sso_activex.SOActiveX.1", aPrefix ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%s\\TypeLib\\%s", aPrefix, aTypeLib ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDWinPeer ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDDispInt ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDActApprove ); - if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) - fErr = TRUE; - - return !fErr; -} - -STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) -{ - HRESULT hr = DllUnregisterServerNative_Impl( nMode, bForAllUsers, n32KeyAccess ); - if ( SUCCEEDED( hr ) && bFor64Bit ) - hr = DllUnregisterServerNative_Impl( nMode, bForAllUsers, n64KeyAccess ); - - return hr; -} - - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServerDoc - Adds entries to the system registry - -#define SUPPORTED_MSEXT_NUM 7 -const char* aMSFileExt[] = { ".dot", ".doc", ".xlt", ".xls", ".pot", ".ppt", ".pps" }; -const char* aMSMimeType[] = { "application/msword", - "application/msword", - "application/msexcell", - "application/msexcell", - "application/mspowerpoint", - "application/mspowerpoint", - "application/mspowerpoint" }; -const int nForMSModes[] = { 1, 1, 2, 2, 4, 4, 4 }; - -STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ); -STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) -{ - BOOL aResult = TRUE; - - HKEY hkey = NULL; - HKEY hkey1 = NULL; - char aSubKey[513]; - int ind; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - - // In case SO7 is installed for this user he can have local registry entries that will prevent him from - // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. - // Unfortunately it can be done only for the user who installs the office. - if ( bForAllUsers ) - DllUnregisterServerDoc( nMode, sal_False, sal_False ); - - for( ind = 0; ind < SUPPORTED_MSEXT_NUM && aResult; ind++ ) - { - if( nForMSModes[ind] & nMode ) - { - wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) - || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ, - (const BYTE *)aMSFileExt[ind], strlen( aMSFileExt[ind] ) ) - || ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ, - (const BYTE *)aClassID, strlen(aClassID)) ) - aResult = FALSE; - - if( hkey ) - RegCloseKey(hkey),hkey= NULL; - - wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) - || ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ, - (const BYTE *)aMSMimeType[ind], strlen( aMSMimeType[ind] ) ) ) - aResult = FALSE; - - if( hkey ) - RegCloseKey(hkey),hkey= NULL; - } - } - - wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if ( aResult && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) - && createKey( hkey, "EnableFullPage", nKeyAccess ) ) - { - for( ind = 0; ind < SUPPORTED_MSEXT_NUM; ind++ ) - { - if( nForMSModes[ind] & nMode ) - { - wsprintfA( aSubKey, "EnableFullPage\\%s", aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) - aResult = FALSE; - - if ( hkey1 ) - RegCloseKey(hkey1),hkey1= NULL; - } - } - } - else - aResult = FALSE; - - if ( hkey ) - RegCloseKey(hkey),hkey= NULL; - - return aResult; -} - -STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) -{ - HRESULT hr = S_OK; - if ( bFor64Bit ) - hr = DllRegisterServerDoc_Impl( nMode, bForAllUsers, n64KeyAccess ); - - if ( SUCCEEDED( hr ) ) - hr = DllRegisterServerDoc_Impl( nMode, bForAllUsers, n32KeyAccess ); - - return hr; -} - - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServerDoc - Removes entries from the system registry - -STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) -{ - HKEY hkey = NULL; - BOOL fErr = FALSE; - char aSubKey[513]; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - - for( int ind = 0; ind < SUPPORTED_MSEXT_NUM; ind++ ) - { - if( nForMSModes[ind] & nMode ) - { - DWORD nSubKeys = 0, nValues = 0; - - wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) - fErr = TRUE; - else - { - if ( ERROR_SUCCESS != RegDeleteValue( hkey, "Extension" ) ) - fErr = TRUE; - - if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) - fErr = TRUE; - - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) - { - RegCloseKey( hkey ), hkey = NULL; - fErr = TRUE; - } - else - { - RegCloseKey( hkey ), hkey = NULL; - if ( !nSubKeys && !nValues ) - DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); - } - } - - wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) - fErr = TRUE; - else - { - if ( ERROR_SUCCESS != RegDeleteValue( hkey, "Content Type" ) ) - fErr = TRUE; - - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) - { - RegCloseKey( hkey ), hkey = NULL; - fErr = TRUE; - } - else - { - RegCloseKey( hkey ), hkey = NULL; - if ( !nSubKeys && !nValues ) - DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); - } - } - } - } - - return !fErr; -} - -STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) -{ - HRESULT hr = S_OK; - if ( bFor64Bit ) - hr = DllUnregisterServerDoc_Impl( nMode, bForAllUsers, n64KeyAccess ); - - if ( SUCCEEDED( hr ) ) - hr = DllUnregisterServerDoc_Impl( nMode, bForAllUsers, n32KeyAccess ); - - return hr; -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - regsvr32 entry point - -STDAPI DllRegisterServer( void ) -{ - char pProgramPath[1024]; - HRESULT aResult = E_FAIL; - - HMODULE aCurModule = GetModuleHandleA( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); - DWORD nLen = 0; - DWORD nLibNameLen = strlen( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); - - if( aCurModule ) - { - nLen = GetModuleFileNameA( aCurModule, pProgramPath, 1024 ); - if ( nLen && nLen > nLibNameLen + 1 ) - { - pProgramPath[ nLen - nLibNameLen - 1 ] = 0; - aResult = DllRegisterServerNative( 31, TRUE, bX64, pProgramPath ); - if( SUCCEEDED( aResult ) ) - aResult = DllRegisterServerDoc( 31, TRUE, bX64 ); - else - { - aResult = DllRegisterServerNative( 31, FALSE, bX64, pProgramPath ); - if( SUCCEEDED( aResult ) ) - aResult = DllRegisterServerDoc( 31, FALSE, bX64 ); - } - } - } - - return aResult; -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - regsvr32 entry point - -STDAPI DllUnregisterServer( void ) -{ - DllUnregisterServerDoc( 63, FALSE, bX64 ); - DllUnregisterServerNative( 63, FALSE, bX64 ); - DllUnregisterServerDoc( 63, TRUE, bX64 ); - return DllUnregisterServerNative( 63, TRUE, bX64 ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/main/so_activex.def b/extensions/source/activex/main/so_activex.def deleted file mode 100644 index e3d56b070..000000000 --- a/extensions/source/activex/main/so_activex.def +++ /dev/null @@ -1,13 +0,0 @@ -; iervp.def : Declares the module parameters. - -LIBRARY "so_activex.dll" - -EXPORTS - DllCanUnloadNow @1 PRIVATE - DllGetClassObject @2 PRIVATE - DllRegisterServer @3 PRIVATE - DllUnregisterServer @4 PRIVATE - DllRegisterServerNative @5 PRIVATE - DllRegisterServerDoc @6 PRIVATE - DllUnregisterServerNative @7 PRIVATE - DllUnregisterServerDoc @8 PRIVATE diff --git a/extensions/source/activex/main/so_activex.rc b/extensions/source/activex/main/so_activex.rc deleted file mode 100644 index 2370a5162..000000000 --- a/extensions/source/activex/main/so_activex.rc +++ /dev/null @@ -1,113 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#if defined(_MSC_VER) && (_MSC_VER < 1500) -#include "winres.h" -#else -#define WINVER 0x0500 -#include -#define LB_ADDSTRING (WM_USER+1) -#define CB_ADDSTRING (WM_USER+3) -#define IDC_STATIC (-1) -#endif - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -//#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -//#ifdef _WIN32 -//LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -//#pragma code_page(1251) -//#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -//IDB_SOACTIVEX BITMAP DISCARDABLE "soacti.bmp" - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_SOACTIVEX REGISTRY DISCARDABLE "SOActiveX.rgs" -IDR_SOCOMWINDOWPEER REGISTRY DISCARDABLE "SOComWindowPeer.rgs" -IDR_SODISPATCHINTERCEPTOR REGISTRY DISCARDABLE "SODispatchInterceptor.rgs" -//#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""so_activex.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "so_activex" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - -#include "envsettings.h" - -1 TYPELIB MISC\so_activex.tlb - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/extensions/source/activex/msidl/makefile.mk b/extensions/source/activex/msidl/makefile.mk deleted file mode 100644 index 66c4a2a7c..000000000 --- a/extensions/source/activex/msidl/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=extensions -TARGET=msidl - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -.IF "$(GUI)" == "WNT" && "$(DISABLE_ACTIVEX)"=="" - -# --- Targets ---------------------------------- - -ALL : $(MISC)$/activex_component - -MTL=midl.exe -MTL_PROJ= - -SOURCE=so_activex.idl - -MTL_SWITCHES=-tlb $(MISC)$/so_activex.tlb -h $(MISC)$/so_activex.h -iid $(MISC)$/so_activex_i.c -dlldata $(MISC)$/so_activex_dll.c -proxy $(MISC)$/so_activex_p.c -Oicf - -.IF "$(COM)"=="GCC" -MTL_SWITCHES+=-cpp_cmd gcc -cpp_opt "-x c -E -D__stdcall= -D_stdcall= -nostdinc -I $(shell @cygpath -w $(PSDK_HOME)/include)" - -$(MISC)$/activex_component : $(SOURCE) - $(MTL) $(MTL_SWITCHES) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE) -.ELSE -$(MISC)$/activex_component : $(SOURCE) - $(WRAPCMD) $(MTL) $(MTL_SWITCHES) $(INCLUDE) $(SOURCE) && $(TOUCH) $@ -.ENDIF - -.ENDIF - -.INCLUDE : target.mk - diff --git a/extensions/source/activex/msidl/so_activex.idl b/extensions/source/activex/msidl/so_activex.idl deleted file mode 100644 index ff396f5f9..000000000 --- a/extensions/source/activex/msidl/so_activex.idl +++ /dev/null @@ -1,210 +0,0 @@ -// so_activex.idl : IDL source for so_activex.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (so_activex.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; -#include "olectl.h" - - - [ - object, - uuid(DACF7E3F-626B-4BF9-964B-F4910C843711), - dual, - helpstring("ISOActiveX Interface"), - pointer_default(unique) - ] - interface ISOActiveX : IDispatch - { - }; - -[ - object, - uuid(BF5D10F3-8A10-4A0B-B150-2B6AA2D7E118), - dual, - helpstring("ISOComWindowPeer Interface"), - pointer_default(unique) -] -interface ISOComWindowPeer : IDispatch -{ - [id(1), helpstring("method getWindowHandle")] - HRESULT getWindowHandle( [in] SAFEARRAY(VARIANT) procId, - [in] short s, - [out,retval] long* ret); - - [id(2), helpstring("method getToolkit")] - HRESULT getToolkit( [out,retval] IDispatch** retVal ); - - [id(3), helpstring("method setPointer")] - HRESULT setPointer( [in] IDispatch* xPointer ); - - [id(4), helpstring("method setBackground")] - HRESULT setBackground( [in] int nColor ); - - [id(5), helpstring("method invalidate")] - HRESULT invalidate( [in] short ); - - [id(6), helpstring("method invalidateRect")] - HRESULT invalidateRect( [in] IDispatch* aRect, [in] short nFlags ); - - [id(7), helpstring("method dispose")] - HRESULT dispose(); - - [id(8), helpstring("method addEventListener")] - HRESULT addEventListener( [in] IDispatch* xListener ); - - [id(9), helpstring("method removeEventListener")] - HRESULT removeEventListener( [in] IDispatch* xListener ); - - [propget, id(10), helpstring("property_implementedInterfaces")] - HRESULT Bridge_implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal); -}; - -[ - object, - uuid(9337694C-B27D-4384-95A4-9D8E0EABC9E5), - dual, - helpstring("ISODispatchInterceptor Interface"), - pointer_default(unique) -] -interface ISODispatchInterceptor : IDispatch -{ -//com.sun.star.frame.XDispatchProviderInterceptor - - [id(1), helpstring("method getSlaveDispatchProvider")] - HRESULT getSlaveDispatchProvider( [out,retval] IDispatch** retVal ); - - [id(2), helpstring("method setSlaveDispatchProvider")] - HRESULT setSlaveDispatchProvider( [in] IDispatch* xNewDispatchProvider ); - - [id(3), helpstring("method getMasterDispatchProvider")] - HRESULT getMasterDispatchProvider( [out,retval] IDispatch** retVal ); - - [id(4), helpstring("method setMasterDispatchProvider")] - HRESULT setMasterDispatchProvider( [in] IDispatch* xNewSupplier ); - -// com.sun.star.frame.XDispatchProvider - - [id(5), helpstring("method queryDispatch")] - HRESULT queryDispatch( [in] IDispatch* aURL, - [in] BSTR aTargetFrameName, - [in] long nSearchFlags, - [out,retval] IDispatch** retVal ); - - [id(6), helpstring("method queryDispatches")] - HRESULT queryDispatches( [in] SAFEARRAY(IDispatch*) aDescripts, - [out,retval] SAFEARRAY(VARIANT)* retVal ); - - -// com.sun.star.frame.XDispatch - - [id(7), helpstring("method dispatch")] - HRESULT dispatch( [in] IDispatch* aURL, - [in] SAFEARRAY(VARIANT) aArgs ); - - [id(8), helpstring("method addStatusListener")] - HRESULT addStatusListener( [in] IDispatch* xControl, - [in] IDispatch* aURL ); - - [id(9), helpstring("method removeStatusListener")] - HRESULT removeStatusListener( [in] IDispatch* xControl, - [in] IDispatch* aURL ); - -// com.sun.star.frame.XInterceptorInfo - - - [id(10), helpstring("method getInterceptedURLs")] - HRESULT getInterceptedURLs( [out,retval] SAFEARRAY(BSTR)* pVal ); - -// the common UNO-COM staff - [propget, id(11), helpstring("property_implementedInterfaces")] - HRESULT Bridge_implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal); - -}; - - - - -[ - object, - uuid(029E9F1E-2B3F-4297-9160-8197DE7ED54F), - dual, - helpstring("ISOActionsApproval Interface"), - pointer_default(unique) -] -interface ISOActionsApproval : IDispatch -{ -//com.sun.star.embed.XActionsApproval - - [id(1), helpstring("method approveAction")] - HRESULT approveAction( [in] long aActionID, - [out,retval] boolean* pbApproval ); - -// the common UNO-COM staff - [propget, id(2), helpstring("property_implementedInterfaces")] - HRESULT Bridge_implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal); -}; - - - -[ - uuid(61FA3F13-8061-4796-B055-3697ED28CB38), - version(1.0), - helpstring("so_activex 1.0 Type Library") -] -library SO_ACTIVEXLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(7F760565-5719-4F04-BA86-112C474B10EA), - helpstring("_ISOActiveXEvents Interface") - ] - dispinterface _ISOActiveXEvents - { - properties: - methods: - }; - - [ - uuid(67F2A879-82D5-4A6D-8CC5-FFB3C114B69D), - helpstring("SOActiveX Class") - ] - coclass SOActiveX - { - [default] interface ISOActiveX; - [default, source] dispinterface _ISOActiveXEvents; - }; - - [ - uuid(EE51BD3E-8BB6-4FB8-B319-F65B1BE3B21D), - helpstring("SOComWindowPeer Class") - ] - coclass SOComWindowPeer - { - [default] interface ISOComWindowPeer; - }; - - [ - uuid(C5D6D568-57DA-4D6C-819A-451CB565E682), - helpstring("SODispatchInterceptor Class") - ] - coclass SODispatchInterceptor - { - [default] interface ISODispatchInterceptor; - }; - - [ - uuid(9F3697AC-7A18-4335-AF0A-65FAC2C35CC1), - helpstring("SOActionsApproval Class") - ] - coclass SOActionsApproval - { - [default] interface ISOActionsApproval; - }; - -}; - diff --git a/extensions/source/bibliography/bib.component b/extensions/source/bibliography/bib.component deleted file mode 100644 index 98627854d..000000000 --- a/extensions/source/bibliography/bib.component +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - diff --git a/extensions/source/bibliography/bib.hrc b/extensions/source/bibliography/bib.hrc deleted file mode 100644 index 01715258d..000000000 --- a/extensions/source/bibliography/bib.hrc +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef BIB_HRC -#define BIB_HRC - -#include "bibliography.hrc" -#include -#ifndef RID_BIB_START -#define RID_BIB_START RID_EXTENSIONS_START -#endif - -// ResIDs - -//Dialogs (100) -#define RID_BIB_DIALOG (RID_BIB_START) -#define RID_TP_GENERAL (RID_BIB_DIALOG) -#define RID_DLG_MAPPING (RID_BIB_DIALOG + 1) -#define RID_DLG_DBCHANGE (RID_BIB_DIALOG + 2) - -//Controls(100) -#define RID_BIB_CONTROLS (RID_BIB_START + 100) -#define RID_BIB_TOOLBAR (RID_BIB_CONTROLS+ 1) -#define RID_TOOLBAR_IMGLIST (RID_BIB_CONTROLS+ 2) -// free -#define RID_TOOLBAR_BIGIMGLIST (RID_BIB_CONTROLS+ 4) - -//Menu(100) -#define RID_BIB_MENU (RID_BIB_CONTROLS + 100) -#define RID_MAIN_MENU (RID_BIB_MENU +1) -//#define RID_MAIN_ME_HIERARCHICAL (RID_BIB_MENU +2) -#define RID_MAIN_ME_NEWENTRY (RID_BIB_MENU +3) -#define RID_MAIN_ME_CHANGEENTRY (RID_BIB_MENU +4) -#define RID_MAIN_ME_REMOVEENTRY (RID_BIB_MENU +5) -#define RID_MAIN_ME_SEARCH (RID_BIB_MENU +6) -#define RID_MAIN_ME_FIELDDLG (RID_BIB_MENU +7) -//#define RID_MAIN_ME_LAYOUT (RID_BIB_MENU +8) -#define RID_MAIN_ME_MAPPING (RID_BIB_MENU +9) -#define RID_MAIN_ME_DBSOURCE (RID_BIB_MENU +10) -#define RID_MAIN_DELETE_RECORD (RID_BIB_MENU +11) -#define RID_MAIN_INSERT_RECORD (RID_BIB_MENU +12) -#define MN_TEMPLATES (RID_BIB_MENU +13) // to make makro ITEM_FILE_DOCTEMPLATE happy... - -#define RID_POPUP_ME_VIEW (RID_BIB_MENU +50) - -// Strings (500) -#define RID_BIB_STRING (RID_BIB_START + 200) - // FREE (RID_BIB_STRING + 1) -#define RID_BIB_STR_FIELDSELECTION (RID_BIB_STRING + 2) -#define RID_BIB_STR_TABWIN_PREFIX (RID_BIB_STRING + 3) -#define RID_BIB_STR_FRAME_TITLE (RID_BIB_STRING + 4) -#define RID_MAP_QUESTION (RID_BIB_STRING + 5) - -#define ST_IDENTIFIER (RID_BIB_STRING + 6) -#define ST_AUTHTYPE (RID_BIB_STRING + 7) -#define ST_AUTHOR (RID_BIB_STRING + 8) -#define ST_YEAR (RID_BIB_STRING + 9) -#define ST_ISBN (RID_BIB_STRING + 10) -#define ST_MONTH (RID_BIB_STRING + 11) -#define ST_PUBLISHER (RID_BIB_STRING + 12) -#define ST_ADDRESS (RID_BIB_STRING + 13) -#define ST_ANNOTE (RID_BIB_STRING + 14) -#define ST_BOOKTITLE (RID_BIB_STRING + 15) -#define ST_CHAPTER (RID_BIB_STRING + 16) -#define ST_EDITION (RID_BIB_STRING + 17) -#define ST_EDITOR (RID_BIB_STRING + 18) -#define ST_HOWPUBLISHED (RID_BIB_STRING + 19) -#define ST_INSTITUTION (RID_BIB_STRING + 20) -#define ST_JOURNAL (RID_BIB_STRING + 21) -#define ST_NOTE (RID_BIB_STRING + 22) -#define ST_NUMBER (RID_BIB_STRING + 23) -#define ST_ORGANIZATION (RID_BIB_STRING + 24) -#define ST_PAGE (RID_BIB_STRING + 25) -#define ST_SCHOOL (RID_BIB_STRING + 26) -#define ST_SERIES (RID_BIB_STRING + 27) -#define ST_TITLE (RID_BIB_STRING + 28) -#define ST_REPORT (RID_BIB_STRING + 29) -#define ST_VOLUME (RID_BIB_STRING + 30) -#define ST_URL (RID_BIB_STRING + 31) -#define ST_CUSTOM1 (RID_BIB_STRING + 32) -#define ST_CUSTOM2 (RID_BIB_STRING + 33) -#define ST_CUSTOM3 (RID_BIB_STRING + 34) -#define ST_CUSTOM4 (RID_BIB_STRING + 35) -#define ST_CUSTOM5 (RID_BIB_STRING + 36) - - -#endif diff --git a/extensions/source/bibliography/bib.src b/extensions/source/bibliography/bib.src deleted file mode 100644 index 1492de7b6..000000000 --- a/extensions/source/bibliography/bib.src +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" - -String RID_BIB_STR_FIELDSELECTION -{ - Text [ en-US ] = "Field selection:"; -}; - -String RID_BIB_STR_TABWIN_PREFIX -{ - Text [ en-US ] = "Table;Query;Sql;Sql [Native]"; -}; -String RID_BIB_STR_FRAME_TITLE -{ - Text [ en-US ] = "Bibliography Database"; -}; -String RID_MAP_QUESTION -{ - Text [ en-US ] = "Do you want to edit the column arrangement?"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx deleted file mode 100644 index 4ff1ee5b1..000000000 --- a/extensions/source/bibliography/bibbeam.cxx +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include "bibliography.hrc" -#include -#include -#include -#include "bibbeam.hxx" -#include "toolbar.hrc" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibtools.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::uno; - -using ::rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -#define PROPERTY_FRAME 1 -#define ID_TOOLBAR 1 -#define ID_GRIDWIN 2 - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - - void HandleTaskPaneList( Window* pWindow, sal_Bool bAddToList ) - { - Window* pParent = pWindow->GetParent(); - - DBG_ASSERT( pParent, "-GetTaskPaneList(): everybody here should have a parent!" ); - - SystemWindow* pSysWin = pParent->GetSystemWindow(); - if( pSysWin ) - { - TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList(); - if( pTaskPaneList ) - { - if( bAddToList ) - pTaskPaneList->AddWindow( pWindow ); - else - pTaskPaneList->RemoveWindow( pWindow ); - } - } - } - - //===================================================================== - //= BibGridwin - //===================================================================== - class BibGridwin - :public Window //DockingWindow - { - private: - Reference< awt::XWindow > m_xGridWin; - Reference< awt::XControlModel > m_xGridModel; - Reference< awt::XControl > m_xControl; - Reference< awt::XControlContainer > m_xControlContainer; - // #100312# --------- - Reference< frame::XDispatchProviderInterception> m_xDispatchProviderInterception; - - protected: - - virtual void Resize(); - - public: - - BibGridwin(Window* pParent, WinBits nStyle = WB_3DLOOK ); - ~BibGridwin(); - - void createGridWin(const Reference< awt::XControlModel > & xDbForm); - void disposeGridWin(); - - const Reference< awt::XControlContainer >& getControlContainer() const { return m_xControlContainer; } - // #100312# --------- - const Reference< frame::XDispatchProviderInterception>& getDispatchProviderInterception() const { return m_xDispatchProviderInterception; } - - virtual void GetFocus(); - }; - - //--------------------------------------------------------------------- - BibGridwin::BibGridwin( Window* _pParent, WinBits _nStyle ) : Window( _pParent, _nStyle ) - { - m_xControlContainer = VCLUnoHelper::CreateControlContainer(this); - - AddToTaskPaneList( this ); - } - - //--------------------------------------------------------------------- - BibGridwin::~BibGridwin() - { - RemoveFromTaskPaneList( this ); - - disposeGridWin(); - } - - //--------------------------------------------------------------------- - void BibGridwin::Resize() - { - if(m_xGridWin.is()) - { - ::Size aSize = GetOutputSizePixel(); - m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::SIZE); - } - } - - //--------------------------------------------------------------------- - void BibGridwin::createGridWin(const uno::Reference< awt::XControlModel > & xGModel) - { - m_xGridModel = xGModel; - - if( m_xControlContainer.is()) - { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - if ( m_xGridModel.is() && xMgr.is()) - { - uno::Reference< XPropertySet > xPropSet( m_xGridModel, UNO_QUERY ); - - if ( xPropSet.is() && m_xGridModel.is() ) - { - uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") ); - rtl::OUString aControlName; - aAny >>= aControlName; - - m_xControl = Reference< awt::XControl > (xMgr->createInstance( aControlName ), UNO_QUERY ); - DBG_ASSERT( m_xControl.is(), "no GridControl created" ); - if ( m_xControl.is() ) - m_xControl->setModel( m_xGridModel ); - } - - if ( m_xControl.is() ) - { - // Peer als Child zu dem FrameWindow - m_xControlContainer->addControl(C2U("GridControl"), m_xControl); - m_xGridWin=uno::Reference< awt::XWindow > (m_xControl, UNO_QUERY ); - // #100312# ----- - m_xDispatchProviderInterception=uno::Reference< frame::XDispatchProviderInterception > (m_xControl, UNO_QUERY ); - m_xGridWin->setVisible( sal_True ); - m_xControl->setDesignMode( sal_True ); - // initially switch on the desing mode - switch it off _after_ loading the form - - ::Size aSize = GetOutputSizePixel(); - m_xGridWin->setPosSize(0, 0, aSize.Width(),aSize.Height(), awt::PosSize::POSSIZE); - } - } - } - } - - //--------------------------------------------------------------------- - void BibGridwin::disposeGridWin() - { - if ( m_xControl.is() ) - { - Reference< awt::XControl > xDel( m_xControl ); - m_xControl = NULL; - m_xGridWin = NULL; - - m_xControlContainer->removeControl( xDel ); - xDel->dispose(); - } - } - - //--------------------------------------------------------------------- - void BibGridwin::GetFocus() - { - if(m_xGridWin.is()) - m_xGridWin->setFocus(); - } - - //--------------------------------------------------------------------- - BibBeamer::BibBeamer( Window* _pParent, BibDataManager* _pDM, WinBits _nStyle ) - :BibSplitWindow( _pParent, _nStyle | WB_NOSPLITDRAW ) - ,pDatMan( _pDM ) - ,pToolBar( NULL ) - ,pGridWin( NULL ) - { - createToolBar(); - createGridWin(); - if ( pDatMan ) - pDatMan->SetToolbar(pToolBar); - pGridWin->Show(); - - if ( pDatMan ) - connectForm( pDatMan ); - } - - //--------------------------------------------------------------------- - BibBeamer::~BibBeamer() - { - if ( isFormConnected() ) - disconnectForm(); - - if ( m_xToolBarRef.is() ) - m_xToolBarRef->dispose(); - - if ( pToolBar ) - { - if ( pDatMan ) - pDatMan->SetToolbar(0); - - DELETEZ( pToolBar ); - } - - if( pGridWin ) - { - BibGridwin* pDel = pGridWin; - pGridWin = NULL; - pDel->disposeGridWin(); - delete pDel; - } - - } - - //--------------------------------------------------------------------- - void BibBeamer::createToolBar() - { - pToolBar= new BibToolBar(this, LINK( this, BibBeamer, RecalcLayout_Impl )); - ::Size aSize=pToolBar->GetSizePixel(); - InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED ); - if ( m_xController.is() ) - pToolBar->SetXController( m_xController ); - } - - //--------------------------------------------------------------------- - void BibBeamer::createGridWin() - { - pGridWin = new BibGridwin(this,0); - - InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE ); - - pGridWin->createGridWin( pDatMan->updateGridModel() ); - } - - //--------------------------------------------------------------------- - Reference< awt::XControlContainer > BibBeamer::getControlContainer() - { - Reference< awt::XControlContainer > xReturn; - if ( pGridWin ) - xReturn = pGridWin->getControlContainer(); - return xReturn; - } - - // #100312# ----------------------------------------------------------- - Reference< frame::XDispatchProviderInterception > BibBeamer::getDispatchProviderInterception() - { - Reference< frame::XDispatchProviderInterception > xReturn; - if ( pGridWin ) - xReturn = pGridWin->getDispatchProviderInterception(); - return xReturn; - } - - //--------------------------------------------------------------------- - void BibBeamer::SetXController(const uno::Reference< frame::XController > & xCtr) - { - m_xController = xCtr; - - if ( pToolBar ) - pToolBar->SetXController( m_xController ); - - } - - //--------------------------------------------------------------------- - void BibBeamer::GetFocus() - { - if( pGridWin ) - pGridWin->GrabFocus(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( BibBeamer, RecalcLayout_Impl, void*, /*pVoid*/ ) - { - long nHeight = pToolBar->GetSizePixel().Height(); - SetItemSize( ID_TOOLBAR, nHeight ); - return 0L; - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx deleted file mode 100644 index c9742b38b..000000000 --- a/extensions/source/bibliography/bibbeam.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADRBEAM_HXX -#define ADRBEAM_HXX - -#include -#include -#include -#include -// #100312# ----------------- -#include -#include // helper for implementations -#include -#include "toolbar.hxx" -#include "formcontrolcontainer.hxx" -#include "bibshortcuthandler.hxx" - -class BibDataManager; - -//......................................................................... -namespace bib -{ -//......................................................................... - - class BibGridwin; - class BibBeamer - :public BibSplitWindow - ,public FormControlContainer - { - private: - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xController; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xToolBarRef; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xGridRef; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xGridWin; - - BibDataManager* pDatMan; - BibToolBar* pToolBar; - BibGridwin* pGridWin; - - DECL_LINK( RecalcLayout_Impl, void* ); - - protected: - - void createToolBar(); - void createGridWin(); - - // FormControlContainer ---------- - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer(); - public: - // #100312# ------------------- - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > - getDispatchProviderInterception(); - - BibBeamer(Window* pParent,BibDataManager* pDatMan, WinBits nStyle = WB_3DLOOK ); - ~BibBeamer(); - - void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &); - - virtual void GetFocus(); - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx deleted file mode 100644 index 5cfdbcf2f..000000000 --- a/extensions/source/bibliography/bibconfig.cxx +++ /dev/null @@ -1,370 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -using ::rtl::OUString; - -typedef Mapping* MappingPtr; -SV_DECL_PTRARR_DEL(MappingArray, MappingPtr, 2, 2) -SV_IMPL_PTRARR(MappingArray, MappingPtr); - -#define C2U(cChar) OUString::createFromAscii(cChar) - -const char* cDataSourceHistory = "DataSourceHistory"; - -Sequence BibConfig::GetPropertyNames() -{ - static Sequence aNames; - if(!aNames.getLength()) - { - aNames.realloc(8); - OUString* pNames = aNames.getArray(); - pNames[0] = C2U("CurrentDataSource/DataSourceName"); - pNames[1] = C2U("CurrentDataSource/Command"); - pNames[2] = C2U("CurrentDataSource/CommandType"); - pNames[3] = C2U("BeamerHeight"); - pNames[4] = C2U("ViewHeight"); - pNames[5] = C2U("QueryText"); - pNames[6] = C2U("QueryField"); - pNames[7] = C2U("ShowColumnAssignmentWarning"); - } - return aNames; -} - -BibConfig::BibConfig() : - ConfigItem(C2U("Office.DataAccess/Bibliography"), CONFIG_MODE_DELAYED_UPDATE), - pMappingsArr(new MappingArray), - nBeamerSize(0), - nViewSize(0), - bShowColumnAssignmentWarning(sal_False) -{ - //Names of the default columns - aColumnDefaults[0] = C2U("Identifier"); - aColumnDefaults[1] = C2U("BibliographyType"); - aColumnDefaults[2] = C2U("Author"); - aColumnDefaults[3] = C2U("Title"); - aColumnDefaults[4] = C2U("Year"); - aColumnDefaults[5] = C2U("ISBN"); - aColumnDefaults[6] = C2U("Booktitle"); - aColumnDefaults[7] = C2U("Chapter"); - aColumnDefaults[8] = C2U("Edition"); - aColumnDefaults[9] = C2U("Editor"); - aColumnDefaults[10] = C2U("Howpublished"); - aColumnDefaults[11] = C2U("Institution"); - aColumnDefaults[12] = C2U("Journal"); - aColumnDefaults[13] = C2U("Month"); - aColumnDefaults[14] = C2U("Note"); - aColumnDefaults[15] = C2U("Annote"); - aColumnDefaults[16] = C2U("Number"); - aColumnDefaults[17] = C2U("Organizations"); - aColumnDefaults[18] = C2U("Pages"); - aColumnDefaults[19] = C2U("Publisher"); - aColumnDefaults[20] = C2U("Address"); - aColumnDefaults[21] = C2U("School"); - aColumnDefaults[22] = C2U("Series"); - aColumnDefaults[23] = C2U("ReportType"); - aColumnDefaults[24] = C2U("Volume"); - aColumnDefaults[25] = C2U("URL"); - aColumnDefaults[26] = C2U("Custom1"); - aColumnDefaults[27] = C2U("Custom2"); - aColumnDefaults[28] = C2U("Custom3"); - aColumnDefaults[29] = C2U("Custom4"); - aColumnDefaults[30] = C2U("Custom5"); - - - const Sequence< OUString > aPropertyNames = GetPropertyNames(); - const Sequence aPropertyValues = GetProperties( aPropertyNames ); - const Any* pValues = aPropertyValues.getConstArray(); - if(aPropertyValues.getLength() == aPropertyNames.getLength()) - { - for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) - { - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case 0: pValues[nProp] >>= sDataSource; break; - case 1: pValues[nProp] >>= sTableOrQuery; break; - case 2: pValues[nProp] >>= nTblOrQuery; break; - case 3: pValues[nProp] >>= nBeamerSize; break; - case 4: pValues[nProp] >>= nViewSize ; break; - case 5: pValues[nProp] >>= sQueryText ; break; - case 6: pValues[nProp] >>= sQueryField; break; - case 7: - bShowColumnAssignmentWarning = *(sal_Bool*)pValues[nProp].getValue(); - break; - } - } - } - } - OUString sName(C2U("DataSourceName")); - OUString sTable(C2U("Command")); - OUString sCommandType(C2U("CommandType")); - Sequence< OUString > aNodeNames = GetNodeNames(C2U(cDataSourceHistory)); - const OUString* pNodeNames = aNodeNames.getConstArray(); - for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength(); nNode++) - { - Sequence aHistoryNames(3); - OUString* pHistoryNames = aHistoryNames.getArray(); - - OUString sPrefix(C2U(cDataSourceHistory)); - sPrefix += C2U("/"); - sPrefix += pNodeNames[nNode]; - sPrefix += C2U("/"); - pHistoryNames[0] = sPrefix; - pHistoryNames[0] += sName; - pHistoryNames[1] = sPrefix; - pHistoryNames[1] += sTable; - pHistoryNames[2] = sPrefix; - pHistoryNames[2] += sCommandType; - - Sequence aHistoryValues = GetProperties( aHistoryNames ); - const Any* pHistoryValues = aHistoryValues.getConstArray(); - - if(aHistoryValues.getLength() == aHistoryNames.getLength()) - { - Mapping* pMapping = new Mapping; - pHistoryValues[0] >>= pMapping->sURL; - pHistoryValues[1] >>= pMapping->sTableName; - pHistoryValues[2] >>= pMapping->nCommandType; - //field assignment is contained in another set - sPrefix += C2U("Fields"); - Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); - const OUString* pAssignmentNodeNames = aAssignmentNodeNames.getConstArray(); - Sequence aAssignmentPropertyNames(aAssignmentNodeNames.getLength() * 2); - OUString* pAssignmentPropertyNames = aAssignmentPropertyNames.getArray(); - sal_Int16 nFieldIdx = 0; - for(sal_Int16 nField = 0; nField < aAssignmentNodeNames.getLength(); nField++) - { - OUString sSubPrefix(sPrefix); - sSubPrefix += C2U("/"); - sSubPrefix += pAssignmentNodeNames[nField]; - pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; - pAssignmentPropertyNames[nFieldIdx++] += C2U("/ProgrammaticFieldName"); - pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; - pAssignmentPropertyNames[nFieldIdx++] += C2U("/AssignedFieldName"); - } - Sequence aAssignmentValues = GetProperties(aAssignmentPropertyNames); - const Any* pAssignmentValues = aAssignmentValues.getConstArray(); - OUString sTempLogical; - OUString sTempReal; - sal_Int16 nSetMapping = 0; - nFieldIdx = 0; - for(sal_Int16 nFieldVal = 0; nFieldVal < aAssignmentValues.getLength() / 2; nFieldVal++) - { - pAssignmentValues[nFieldIdx++] >>= sTempLogical; - pAssignmentValues[nFieldIdx++] >>= sTempReal; - if(sTempLogical.getLength() && sTempReal.getLength()) - { - pMapping->aColumnPairs[nSetMapping].sLogicalColumnName = sTempLogical; - pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal; - } - } - pMappingsArr->Insert(pMapping, pMappingsArr->Count()); - } - } -} - -BibConfig::~BibConfig() -{ - if(IsModified()) - Commit(); - delete pMappingsArr; -} - -BibDBDescriptor BibConfig::GetBibliographyURL() -{ - BibDBDescriptor aRet; - aRet.sDataSource = sDataSource; - aRet.sTableOrQuery = sTableOrQuery; - aRet.nCommandType = nTblOrQuery; - return aRet; -}; - -void BibConfig::SetBibliographyURL(const BibDBDescriptor& rDesc) -{ - sDataSource = rDesc.sDataSource; - sTableOrQuery = rDesc.sTableOrQuery; - nTblOrQuery = rDesc.nCommandType; - SetModified(); -}; -//--------------------------------------------------------------------------- -void BibConfig::Notify( const com::sun::star::uno::Sequence& ) -{ -} - -void BibConfig::Commit() -{ - const Sequence aPropertyNames = GetPropertyNames(); - Sequence aValues(aPropertyNames.getLength()); - Any* pValues = aValues.getArray(); - - for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) - { - switch(nProp) - { - case 0: pValues[nProp] <<= sDataSource; break; - case 1: pValues[nProp] <<= sTableOrQuery; break; - case 2: pValues[nProp] <<= nTblOrQuery; break; - case 3: pValues[nProp] <<= nBeamerSize; break; - case 4: pValues[nProp] <<= nViewSize; break; - case 5: pValues[nProp] <<= sQueryText; break; - case 6: pValues[nProp] <<= sQueryField; break; - case 7: - pValues[nProp].setValue(&bShowColumnAssignmentWarning, ::getBooleanCppuType()); - break; - } - } - PutProperties(aPropertyNames, aValues); - ClearNodeSet( C2U(cDataSourceHistory)); - OUString sEmpty; - Sequence< PropertyValue > aNodeValues(pMappingsArr->Count() * 3); - PropertyValue* pNodeValues = aNodeValues.getArray(); - - sal_Int32 nIndex = 0; - OUString sName(C2U("DataSourceName")); - OUString sTable(C2U("Command")); - OUString sCommandType(C2U("CommandType")); - for(sal_Int32 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject((sal_uInt16)i); - OUString sPrefix(C2U(cDataSourceHistory)); - sPrefix += C2U("/_"); - sPrefix += OUString::valueOf(i); - sPrefix += C2U("/"); - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sName; - pNodeValues[nIndex++].Value <<= pMapping->sURL; - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sTable; - pNodeValues[nIndex++].Value <<= pMapping->sTableName; - pNodeValues[nIndex].Name = sPrefix; - pNodeValues[nIndex].Name += sCommandType; - pNodeValues[nIndex++].Value <<= pMapping->nCommandType; - SetSetProperties( C2U(cDataSourceHistory), aNodeValues); - - sPrefix += C2U("Fields"); - sal_Int32 nFieldAssignment = 0; - OUString sFieldName = C2U("/ProgrammaticFieldName"); - OUString sDatabaseFieldName = C2U("/AssignedFieldName"); - ClearNodeSet( sPrefix ); - - while(nFieldAssignment < COLUMN_COUNT && - pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.getLength()) - { - OUString sSubPrefix(sPrefix); - sSubPrefix += C2U("/_"); - sSubPrefix += OUString::valueOf(nFieldAssignment); - Sequence< PropertyValue > aAssignmentValues(2); - PropertyValue* pAssignmentValues = aAssignmentValues.getArray(); - pAssignmentValues[0].Name = sSubPrefix; - pAssignmentValues[0].Name += sFieldName; - pAssignmentValues[0].Value <<= pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName; - pAssignmentValues[1].Name = sSubPrefix; - pAssignmentValues[1].Name += sDatabaseFieldName; - pAssignmentValues[1].Value <<= pMapping->aColumnPairs[nFieldAssignment].sRealColumnName; - SetSetProperties( sPrefix, aAssignmentValues ); - nFieldAssignment++; - } - } -} - -const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const -{ - for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject(i); - sal_Bool bURLEqual = rDesc.sDataSource.equals(pMapping->sURL); - if(rDesc.sTableOrQuery == pMapping->sTableName && bURLEqual) - return pMapping; - } - return 0; -} - -void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapping) -{ - for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++) - { - const Mapping* pMapping = pMappingsArr->GetObject(i); - sal_Bool bURLEqual = rDesc.sDataSource.equals(pMapping->sURL); - if(rDesc.sTableOrQuery == pMapping->sTableName && bURLEqual) - { - pMappingsArr->DeleteAndDestroy(i, 1); - break; - } - } - Mapping* pNew = new Mapping(*pSetMapping); - pMappingsArr->Insert(pNew, pMappingsArr->Count()); - SetModified(); -} - -DBChangeDialogConfig_Impl::DBChangeDialogConfig_Impl() -{ -} - -DBChangeDialogConfig_Impl::~DBChangeDialogConfig_Impl() -{ -} - -const Sequence& DBChangeDialogConfig_Impl::GetDataSourceNames() -{ - if(!aSourceNames.getLength()) - { - Reference xDBContext; - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - Reference xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" )); - xDBContext = Reference(xInstance, UNO_QUERY) ; - } - if(xDBContext.is()) - { - aSourceNames = xDBContext->getElementNames(); - } - } - return aSourceNames; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx deleted file mode 100644 index dd18549af..000000000 --- a/extensions/source/bibliography/bibconfig.hxx +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIBCONFIG_HXX -#define _BIBCONFIG_HXX - -#include -class MappingArray; - -//----------------------------------------------------------------------------- -#define COLUMN_COUNT 31 -#define IDENTIFIER_POS 0 -#define AUTHORITYTYPE_POS 1 -#define AUTHOR_POS 2 -#define TITLE_POS 3 -#define YEAR_POS 4 -#define ISBN_POS 5 -#define BOOKTITLE_POS 6 -#define CHAPTER_POS 7 -#define EDITION_POS 8 -#define EDITOR_POS 9 -#define HOWPUBLISHED_POS 10 -#define INSTITUTION_POS 11 -#define JOURNAL_POS 12 -#define MONTH_POS 13 -#define NOTE_POS 14 -#define ANNOTE_POS 15 -#define NUMBER_POS 16 -#define ORGANIZATIONS_POS 17 -#define PAGES_POS 18 -#define PUBLISHER_POS 19 -#define ADDRESS_POS 20 -#define SCHOOL_POS 21 -#define SERIES_POS 22 -#define REPORTTYPE_POS 23 -#define VOLUME_POS 24 -#define URL_POS 25 -#define CUSTOM1_POS 26 -#define CUSTOM2_POS 27 -#define CUSTOM3_POS 28 -#define CUSTOM4_POS 29 -#define CUSTOM5_POS 30 -//----------------------------------------------------------------------------- -struct StringPair -{ - rtl::OUString sRealColumnName; - rtl::OUString sLogicalColumnName; -}; -//----------------------------------------------------------------------------- -struct Mapping -{ - rtl::OUString sTableName; - rtl::OUString sURL; - sal_Int16 nCommandType; - StringPair aColumnPairs[COLUMN_COUNT]; - - Mapping() : - nCommandType(0){} -}; -//----------------------------------------------------------------------------- -struct BibDBDescriptor -{ - rtl::OUString sDataSource; - rtl::OUString sTableOrQuery; - sal_Int32 nCommandType; -}; -//----------------------------------------------------------------------------- - -class BibConfig : public utl::ConfigItem -{ - rtl::OUString sDataSource; - rtl::OUString sTableOrQuery; - sal_Int32 nTblOrQuery; - - rtl::OUString sQueryField; - rtl::OUString sQueryText; - MappingArray* pMappingsArr; - long nBeamerSize; - long nViewSize; - sal_Bool bShowColumnAssignmentWarning; - - rtl::OUString aColumnDefaults[COLUMN_COUNT]; - - com::sun::star::uno::Sequence GetPropertyNames(); -public: - BibConfig(); - ~BibConfig(); - - virtual void Commit(); - virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames); - - BibDBDescriptor GetBibliographyURL(); - void SetBibliographyURL(const BibDBDescriptor& rDesc); - - const Mapping* GetMapping(const BibDBDescriptor& rDesc) const; - void SetMapping(const BibDBDescriptor& rDesc, const Mapping* pMapping); - - const rtl::OUString& GetDefColumnName(sal_uInt16 nIndex) const - {return aColumnDefaults[nIndex];} - - - void setBeamerSize(long nSize) {SetModified(); nBeamerSize = nSize;} - long getBeamerSize()const {return nBeamerSize;} - void setViewSize(long nSize) {SetModified(); nViewSize = nSize;} - long getViewSize() {return nViewSize;} - - const rtl::OUString& getQueryField() const {return sQueryField;} - void setQueryField(const rtl::OUString& rSet) {SetModified(); sQueryField = rSet;} - - const rtl::OUString& getQueryText() const {return sQueryText;} - void setQueryText(const rtl::OUString& rSet) {SetModified(); sQueryText = rSet;} - - sal_Bool IsShowColumnAssignmentWarning() const - { return bShowColumnAssignmentWarning;} - void SetShowColumnAssignmentWarning(sal_Bool bSet) - { bShowColumnAssignmentWarning = bSet;} -}; - -class DBChangeDialogConfig_Impl -{ - com::sun::star::uno::Sequence aSourceNames; -public: - DBChangeDialogConfig_Impl(); - ~DBChangeDialogConfig_Impl(); - - const com::sun::star::uno::Sequence& GetDataSourceNames(); - -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx deleted file mode 100644 index 846a2edf3..000000000 --- a/extensions/source/bibliography/bibcont.cxx +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bibconfig.hxx" - - -#include "datman.hxx" -#include "bibcont.hxx" - - -BibShortCutHandler::~BibShortCutHandler() -{ -} - -sal_Bool BibShortCutHandler::HandleShortCutKey( const KeyEvent& ) -{ - return sal_False; -} - - -BibWindow::BibWindow( Window* pParent, WinBits nStyle ) : Window( pParent, nStyle ), BibShortCutHandler( this ) -{ -} - -BibWindow::~BibWindow() -{ -} - - -BibSplitWindow::BibSplitWindow( Window* pParent, WinBits nStyle ) : SplitWindow( pParent, nStyle ), BibShortCutHandler( this ) -{ -} - -BibSplitWindow::~BibSplitWindow() -{ -} - - -BibTabPage::BibTabPage( Window* pParent, const ResId& rResId ) : TabPage( pParent, rResId ), BibShortCutHandler( this ) -{ -} - -BibTabPage::~BibTabPage() -{ -} - - -using namespace osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define PROPERTY_FRAME 1 -//split window size is a percent value -#define WIN_MIN_HEIGHT 10 -#define WIN_STEP_SIZE 5 - -BibWindowContainer::BibWindowContainer( Window* pParent, BibShortCutHandler* pChildWin, WinBits nStyle ) : - BibWindow( pParent, nStyle ), - pChild( pChildWin ) -{ - if(pChild!=NULL) - { - Window* pChildWindow = GetChild(); - pChildWindow->SetParent(this); - pChildWindow->Show(); - pChildWindow->SetPosPixel(Point(0,0)); - } -} - -BibWindowContainer::~BibWindowContainer() -{ - if( pChild ) - { - Window* pDel = GetChild(); - pChild = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } -} - -void BibWindowContainer::Resize() -{ - if( pChild ) - GetChild()->SetSizePixel( GetOutputSizePixel() ); -} - -void BibWindowContainer::GetFocus() -{ - if( pChild ) - GetChild()->GrabFocus(); -} - -sal_Bool BibWindowContainer::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - return pChild? pChild->HandleShortCutKey( rKeyEvent ) : sal_False; -} - - -BibBookContainer::BibBookContainer(Window* pParent,BibDataManager* pDtMn, WinBits nStyle): - BibSplitWindow(pParent,nStyle), - pDatMan(pDtMn), - pTopWin(NULL), - pBottomWin(NULL), - bFirstTime(sal_True) -{ - pBibMod = OpenBibModul(); - aTimer.SetTimeoutHdl(LINK( this, BibBookContainer, SplitHdl)); - aTimer.SetTimeout(400); -} - -BibBookContainer::~BibBookContainer() -{ - if( xTopFrameRef.is() ) - xTopFrameRef->dispose(); - if( xBottomFrameRef.is() ) - xBottomFrameRef->dispose(); - - if( pTopWin ) - { - Window* pDel = pTopWin; - pTopWin = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } - - if( pBottomWin ) - { - Window* pDel = pBottomWin; - pBottomWin = NULL; // prevents GetFocus for child while deleting! - delete pDel; - } - - CloseBibModul( pBibMod ); -} - -void BibBookContainer::Split() -{ - aTimer.Start(); -} -IMPL_LINK( BibBookContainer, SplitHdl, Timer*,/*pT*/) -{ - long nSize= GetItemSize( TOP_WINDOW); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setBeamerSize(nSize); - nSize = GetItemSize( BOTTOM_WINDOW); - pConfig->setViewSize(nSize); - return 0; -} - -void BibBookContainer::createTopFrame( BibShortCutHandler* pWin ) -{ - if ( xTopFrameRef.is() ) xTopFrameRef->dispose(); - - if(pTopWin) - { - RemoveItem(TOP_WINDOW); - delete pTopWin; - } - pTopWin=new BibWindowContainer(this,pWin); - pTopWin->Show(); - BibConfig* pConfig = BibModul::GetConfig(); - long nSize = pConfig->getBeamerSize(); - InsertItem(TOP_WINDOW, pTopWin, nSize, 1, 0, SWIB_PERCENTSIZE ); - -} - -void BibBookContainer::createBottomFrame( BibShortCutHandler* pWin ) -{ - if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose(); - - if(pBottomWin) - { - RemoveItem(BOTTOM_WINDOW); - delete pBottomWin; - } - - pBottomWin=new BibWindowContainer(this,pWin); - - BibConfig* pConfig = BibModul::GetConfig(); - long nSize = pConfig->getViewSize(); - InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE ); - -} - -void BibBookContainer::GetFocus() -{ - if( pBottomWin ) - pBottomWin->GrabFocus(); -} - -long BibBookContainer::PreNotify( NotifyEvent& rNEvt ) -{ - long nHandled = 0; - if( EVENT_KEYINPUT == rNEvt.GetType() ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - const KeyCode aKeyCode = pKEvt->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - const sal_uInt16 nModifier = aKeyCode.GetModifier(); - - if( KEY_MOD2 == nModifier ) - { - if( KEY_UP == nKey || KEY_DOWN == nKey ) - { - if(pTopWin && pBottomWin) - { - sal_uInt16 nFirstWinId = KEY_UP == nKey ? TOP_WINDOW : BOTTOM_WINDOW; - sal_uInt16 nSecondWinId = KEY_UP == nKey ? BOTTOM_WINDOW : TOP_WINDOW; - long nHeight = GetItemSize( nFirstWinId ); - nHeight -= WIN_STEP_SIZE; - if(nHeight < WIN_MIN_HEIGHT) - nHeight = WIN_MIN_HEIGHT; - SetItemSize( nFirstWinId, nHeight ); - SetItemSize( nSecondWinId, 100 - nHeight ); - } - nHandled = 1; - } - else if( pKEvt->GetCharCode() && HandleShortCutKey( *pKEvt ) ) - nHandled = 1; - } - } - - return nHandled; -} - -sal_Bool BibBookContainer::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - sal_Bool bRet = sal_False; - - if( pTopWin ) - bRet = pTopWin->HandleShortCutKey( rKeyEvent ); - - if( !bRet && pBottomWin ) - bRet = pBottomWin->HandleShortCutKey( rKeyEvent ); - - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx deleted file mode 100644 index cd86a9190..000000000 --- a/extensions/source/bibliography/bibcont.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADDRCONT_HXX -#define ADDRCONT_HXX - -#include -#include -#include -#include "bibshortcuthandler.hxx" - -#include "bibmod.hxx" - -#define TOP_WINDOW 1 -#define BOTTOM_WINDOW 2 - -class BibDataManager; - -class BibWindowContainer : public BibWindow //Window -{ - private: - // !BibShortCutHandler is also always a Window! - BibShortCutHandler* pChild; - - protected: - virtual void Resize(); - - public: - BibWindowContainer( Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK); - ~BibWindowContainer(); - - inline Window* GetChild(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - - using Window::GetChild; -}; - -inline Window* BibWindowContainer::GetChild() -{ - return pChild? pChild->GetWindow() : NULL; -} - - -class BibBookContainer: public BibSplitWindow -{ - private: - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTopFrameRef; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xBottomFrameRef; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xTopPeerRef; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xBottomPeerRef; - - BibDataManager* pDatMan; - BibWindowContainer* pTopWin; - BibWindowContainer* pBottomWin; - sal_Bool bFirstTime; - HdlBibModul pBibMod; - Timer aTimer; - - DECL_LINK( SplitHdl, Timer*); - - protected: - - virtual void Split(); - - virtual long PreNotify( NotifyEvent& rNEvt ); - - public: - - BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = WB_3DLOOK ); - ~BibBookContainer(); - - inline BibWindow* GetTopWin() {return pTopWin;} - inline BibWindow* GetBottomWin() {return pBottomWin;} - - // !BibShortCutHandler is also always a Window! - void createTopFrame( BibShortCutHandler* pWin ); - - void createBottomFrame( BibShortCutHandler* pWin ); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx deleted file mode 100644 index 22b43a077..000000000 --- a/extensions/source/bibliography/bibload.cxx +++ /dev/null @@ -1,707 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // helper for factories -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bibresid.hxx" -#include "bib.hrc" -#include "bibcont.hxx" -#include "bibbeam.hxx" -#include "bibmod.hxx" -#include "bibview.hxx" -#include "framectr.hxx" -#include "datman.hxx" -#include -#include // helper for implementations - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::frame; - -#define C2U(cChar) OUString::createFromAscii(cChar) - - -//----------------------------------------------------------------------------- - -#define PROPERTY_FRAME 1 - -class BibliographyLoader : public cppu::WeakImplHelper4 - < XServiceInfo, XNameAccess, XPropertySet, XFrameLoader > -{ - HdlBibModul m_pBibMod; - Reference< XLoadable > m_xDatMan; - BibDataManager* m_pDatMan; - Reference< XNameAccess > m_xColumns; - Reference< XResultSet > m_xCursor; - -private: - - void loadView(const Reference< XFrame > & aFrame, const rtl::OUString& aURL, - const Sequence< PropertyValue >& aArgs, - const Reference< XLoadEventListener > & aListener); - - BibDataManager* GetDataManager()const; - Reference< XNameAccess > GetDataColumns() const; - Reference< XResultSet > GetDataCursor() const; - Reference< sdb::XColumn > GetIdentifierColumn() const; - -public: - BibliographyLoader(); - ~BibliographyLoader(); - - // XServiceInfo - rtl::OUString SAL_CALL getImplementationName() throw( ); - sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ); - Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ); - static rtl::OUString getImplementationName_Static() throw( ) - - { - //! - return C2U("com.sun.star.extensions.Bibliography"); - //! - } - - //XNameAccess - virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( NoSuchElementException, WrappedTargetException, RuntimeException ); - virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException ); - - //XElementAccess - virtual Type SAL_CALL getElementType(void) throw ( RuntimeException ); - virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException ); - - //XPropertySet - virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw ( RuntimeException ); - virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ); - virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ); - - static Sequence SAL_CALL getSupportedServiceNames_Static(void) throw( ); - - friend Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception ); - - // XLoader - virtual void SAL_CALL load(const Reference< XFrame > & aFrame, const rtl::OUString& aURL, - const Sequence< PropertyValue >& aArgs, - const Reference< XLoadEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL cancel(void) throw (::com::sun::star::uno::RuntimeException); -}; - -BibliographyLoader::BibliographyLoader() : - m_pBibMod(0), - m_pDatMan(0) -{ -} - -BibliographyLoader::~BibliographyLoader() -{ - Reference< lang::XComponent > xComp(m_xCursor, UNO_QUERY); - if (xComp.is()) - xComp->dispose(); - if(m_pBibMod) - CloseBibModul(m_pBibMod); -} - - -Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & /*rSMgr*/ ) throw( Exception ) -{ - return *(new BibliographyLoader); -} - - -// XServiceInfo -rtl::OUString BibliographyLoader::getImplementationName() throw( ) - -{ - return getImplementationName_Static(); -} - -// XServiceInfo -sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw( ) -{ - Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); - const rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -// XServiceInfo -Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw( ) -{ - return getSupportedServiceNames_Static(); -} - -// ORegistryServiceManager_Static -Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw( ) -{ - Sequence< rtl::OUString > aSNS( 2 ); - aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader"); - //! - aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography"); - //! - return aSNS; -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ ) - { - void * pRet = 0; - if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) ) - { - // create the factory - Reference< XSingleServiceFactory > xFactory = - cppu::createSingleFactory( - pServiceManager, - BibliographyLoader::getImplementationName_Static(), - BibliographyLoader_CreateInstance, - BibliographyLoader::getSupportedServiceNames_Static() ); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; - } - -} -// ----------------------------------------------------------------------- -void BibliographyLoader::cancel(void) throw (::com::sun::star::uno::RuntimeException) -{ - //! - //! -} - -// ----------------------------------------------------------------------- -void BibliographyLoader::load(const Reference< XFrame > & rFrame, const rtl::OUString& rURL, - const Sequence< PropertyValue >& rArgs, - const Reference< XLoadEventListener > & rListener) throw (::com::sun::star::uno::RuntimeException) -{ - //! - - SolarMutexGuard aGuard; - m_pBibMod = OpenBibModul(); - - String aURLStr( rURL ); - String aPartName = aURLStr.GetToken( 1, '/' ); - Reference xPrSet(rFrame, UNO_QUERY); - if(xPrSet.is()) - { - Any aTitle; - aTitle <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE))); - xPrSet->setPropertyValue(C2U("Title"), aTitle); - } - if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1")) - { - loadView(rFrame, rURL, rArgs, rListener); - } -} - -// ----------------------------------------------------------------------- -void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const rtl::OUString& /*rURL*/, - const Sequence< PropertyValue >& /*rArgs*/, - const Reference< XLoadEventListener > & rListener) -{ - SolarMutexGuard aGuard; - //! - if(!m_pBibMod) - m_pBibMod = OpenBibModul(); - - m_pDatMan = (*m_pBibMod)->createDataManager(); - m_xDatMan = m_pDatMan; - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - - if(!aBibDesc.sDataSource.getLength()) - { - DBChangeDialogConfig_Impl aConfig; - const Sequence aSources = aConfig.GetDataSourceNames(); - if(aSources.getLength()) - aBibDesc.sDataSource = aSources.getConstArray()[0]; - } - - Reference< XForm > xForm = m_pDatMan->createDatabaseForm( aBibDesc ); - - Reference< awt::XWindow > aWindow = rFrame->getContainerWindow(); - VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow); - - Window* pParent = VCLUnoHelper::GetWindow( aWindow ); - - BibBookContainer *pMyWindow = new BibBookContainer( pParent, m_pDatMan ); - pMyWindow->Show(); - - ::bib::BibView* pView = new ::bib::BibView( pMyWindow, m_pDatMan, WB_VSCROLL | WB_HSCROLL | WB_3DLOOK ); - pView->Show(); - m_pDatMan->SetView( pView ); - - ::bib::BibBeamer* pBeamer = new ::bib::BibBeamer( pMyWindow, m_pDatMan ); - pBeamer->Show(); - pMyWindow->createTopFrame(pBeamer); - - pMyWindow->createBottomFrame(pView); - - Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY ); - - Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_pDatMan ) ); - - xCtrRef->attachFrame(rFrame); - rFrame->setComponent( xWin, xCtrRef); - pBeamer->SetXController(xCtrRef); - //! - - // not earlier because SetFocus() is triggered in setVisible() - pParentComponent->setVisible(sal_True); - - m_xDatMan->load(); - // #100312# ---------- - m_pDatMan->RegisterInterceptor(pBeamer); - - if ( rListener.is() ) - rListener->loadFinished( this ); - - // attach menu bar - Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - if ( xPropSet.is() ) - { - try - { - Any a = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - a >>= xLayoutManager; - } - catch ( uno::Exception& ) - { - } - } - - if ( xLayoutManager.is() ) - xLayoutManager->createElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ))); -} - -BibDataManager* BibliographyLoader::GetDataManager()const -{ - if(!m_pDatMan) - { - if(!m_pBibMod) - const_cast< BibliographyLoader* >( this )->m_pBibMod = OpenBibModul(); - const_cast< BibliographyLoader* >( this )->m_pDatMan = (*m_pBibMod)->createDataManager(); - const_cast< BibliographyLoader* >( this )->m_xDatMan = m_pDatMan; - } - return m_pDatMan; -} - -Reference< XNameAccess > BibliographyLoader::GetDataColumns() const -{ - if (!m_xColumns.is()) - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XRowSet > xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY); - Reference< XPropertySet > xResultSetProps(xRowSet, UNO_QUERY); - DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !"); - - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - - Any aBibUrlAny; aBibUrlAny <<= aBibDesc.sDataSource; - xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny); - Any aCommandType; aCommandType <<= aBibDesc.nCommandType; - xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType); - Any aTableName; aTableName <<= aBibDesc.sTableOrQuery; - xResultSetProps->setPropertyValue(C2U("Command"), aTableName); - Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE); - xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType); - Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE); - xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency); - - sal_Bool bSuccess = sal_False; - try - { - xRowSet->execute(); - bSuccess = sal_True; - } - catch(const SQLException&) - { - DBG_UNHANDLED_EXCEPTION(); - } - catch(const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - bSuccess = sal_False; - } - - if (!bSuccess) - { - Reference< XComponent > xSetComp(xRowSet, UNO_QUERY); - if (xSetComp.is()) - xSetComp->dispose(); - xRowSet = NULL; - } - else - ((BibliographyLoader*)this)->m_xCursor = xRowSet.get(); - - Reference< sdbcx::XColumnsSupplier > xSupplyCols(m_xCursor, UNO_QUERY); - if (xSupplyCols.is()) - ((BibliographyLoader*)this)->m_xColumns = xSupplyCols->getColumns(); - } - - return m_xColumns; -} - -Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const -{ - BibDataManager* pDatMan = GetDataManager(); - Reference< XNameAccess > xColumns = GetDataColumns(); - rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping(); - - Reference< sdb::XColumn > xReturn; - if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName)) - { - xReturn = Reference< XColumn > (*(Reference< XInterface > *) - xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY); - } - return xReturn; -} - -Reference< XResultSet > BibliographyLoader::GetDataCursor() const -{ - if (!m_xCursor.is()) - GetDataColumns(); - if (m_xCursor.is()) - m_xCursor->first(); - return m_xCursor; -} - -rtl::OUString lcl_AddProperty(Reference< XNameAccess > xColumns, - const Mapping* pMapping, const String& rColumnName) -{ - String sColumnName(rColumnName); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == OUString(rColumnName)) - { - sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - rtl::OUString uColumnName(sColumnName); - rtl::OUString uRet; - Reference< sdb::XColumn > xCol; - if (xColumns->hasByName(uColumnName)) - xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY); - if (xCol.is()) - uRet = xCol->getString(); - return uRet; -} -//----------------------------------------------------------------------------- -Any BibliographyLoader::getByName(const rtl::OUString& rName) throw - ( NoSuchElementException, WrappedTargetException, RuntimeException ) -{ - Any aRet; - try - { - BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager(); - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY); - Reference< XNameAccess > xColumns; - if (!xSupplyCols.is()) - return aRet; - xColumns = xSupplyCols->getColumns(); - DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !"); - if (!xColumns.is()) - return aRet; - - String sIdentifierMapping = pDatMan->GetIdentifierMapping(); - rtl::OUString sId = sIdentifierMapping; - Reference< sdb::XColumn > xColumn; - if (xColumns->hasByName(sId)) - xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY); - if (xColumn.is()) - { - do - { - if ((rName == xColumn->getString()) && !xColumn->wasNull()) - { - Sequence aPropSequ(COLUMN_COUNT); - PropertyValue* pValues = aPropSequ.getArray(); - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aBibDesc = BibModul::GetConfig()->GetBibliographyURL(); - const Mapping* pMapping = pConfig->GetMapping(aBibDesc); - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - const String sColName = pConfig->GetDefColumnName( - nEntry); - pValues[nEntry].Name = sColName; - pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName); - } - aRet.setValue(&aPropSequ, ::getCppuType((Sequence*)0)); - - break; - } - } - while(xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aRet; -} - -Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException ) -{ - Sequence< rtl::OUString > aRet(10); - int nRealNameCount = 0; - try - { - Reference< XResultSet > xCursor(GetDataCursor()); - Reference< sdb::XColumn > xIdColumn(GetIdentifierColumn()); - if (xIdColumn.is()) // implies xCursor.is() - { - do - { - rtl::OUString sTemp = xIdColumn->getString(); - if (sTemp.getLength() && !xIdColumn->wasNull()) - { - int nLen = aRet.getLength(); - if(nLen == nRealNameCount) - aRet.realloc(nLen + 10); - rtl::OUString* pArray = aRet.getArray(); - pArray[nRealNameCount] = sTemp; - nRealNameCount++; - } - } - while (xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - - aRet.realloc(nRealNameCount); - return aRet; -} - -sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException ) -{ - sal_Bool bRet = sal_False; - try - { - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< sdb::XColumn > xIdColumn = GetIdentifierColumn(); - - if (xIdColumn.is()) // implies xCursor.is() - { - do - { - rtl::OUString sCurrentId = xIdColumn->getString(); - if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL)) - { - bRet = sal_True; - break; - } - } - while(xCursor->next()); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - return bRet; -} - -Type BibliographyLoader::getElementType(void) throw ( RuntimeException ) -{ - return ::getCppuType((Sequence*)0); -} - -sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException ) -{ - Reference< XResultSet > xCursor = GetDataCursor(); - Reference< XNameAccess > xColumns = GetDataColumns(); - return xColumns.is() && (xColumns->getElementNames().getLength() != 0); -} - -Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw - ( RuntimeException ) -{ - static SfxItemPropertyMapEntry aBibProps_Impl[] = - { - { MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence*)0), PropertyAttribute::READONLY, 0}, - {0,0,0,0,0,0} - }; - static Reference< XPropertySetInfo > xRet = - SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo(); - return xRet; -} - -void BibliographyLoader::setPropertyValue(const rtl::OUString& /*PropertyName*/, - const Any& /*aValue*/) - throw( UnknownPropertyException, PropertyVetoException, - IllegalArgumentException, WrappedTargetException, RuntimeException) -{ - throw UnknownPropertyException(); - //no changeable properties -} - -Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - Any aRet; - static const sal_uInt16 aInternalMapping[] = - { - IDENTIFIER_POS , // BibliographyDataField_IDENTIFIER - AUTHORITYTYPE_POS , // BibliographyDataField_BIBILIOGRAPHIC_TYPE - ADDRESS_POS , // BibliographyDataField_ADDRESS - ANNOTE_POS , // BibliographyDataField_ANNOTE - AUTHOR_POS , // BibliographyDataField_AUTHOR - BOOKTITLE_POS , // BibliographyDataField_BOOKTITLE - CHAPTER_POS , // BibliographyDataField_CHAPTER - EDITION_POS , // BibliographyDataField_EDITION - EDITOR_POS , // BibliographyDataField_EDITOR - HOWPUBLISHED_POS , // BibliographyDataField_HOWPUBLISHED - INSTITUTION_POS , // BibliographyDataField_INSTITUTION - JOURNAL_POS , // BibliographyDataField_JOURNAL - MONTH_POS , // BibliographyDataField_MONTH - NOTE_POS , // BibliographyDataField_NOTE - NUMBER_POS , // BibliographyDataField_NUMBER - ORGANIZATIONS_POS , // BibliographyDataField_ORGANIZATIONS - PAGES_POS , // BibliographyDataField_PAGES - PUBLISHER_POS , // BibliographyDataField_PUBLISHER - SCHOOL_POS , // BibliographyDataField_SCHOOL - SERIES_POS , // BibliographyDataField_SERIES - TITLE_POS , // BibliographyDataField_TITLE - REPORTTYPE_POS , // BibliographyDataField_REPORT_TYPE - VOLUME_POS , // BibliographyDataField_VOLUME - YEAR_POS , // BibliographyDataField_YEAR - URL_POS , // BibliographyDataField_URL - CUSTOM1_POS , // BibliographyDataField_CUSTOM1 - CUSTOM2_POS , // BibliographyDataField_CUSTOM2 - CUSTOM3_POS , // BibliographyDataField_CUSTOM3 - CUSTOM4_POS , // BibliographyDataField_CUSTOM4 - CUSTOM5_POS , // BibliographyDataField_CUSTOM5 - ISBN_POS //BibliographyDataField_ISBN - }; - if(C2U("BibliographyDataFieldNames") == rPropertyName) - { - Sequence aSeq(COLUMN_COUNT); - PropertyValue* pArray = aSeq.getArray(); - BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++) - { - pArray[i].Name = pConfig->GetDefColumnName(aInternalMapping[i]); - pArray[i].Value <<= (sal_Int16) i; - } - aRet.setValue(&aSeq, ::getCppuType((Sequence*)0)); - } - else - throw UnknownPropertyException(); - return aRet; -} - -void BibliographyLoader::addPropertyChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no bound properties -} - -void BibliographyLoader::removePropertyChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no bound properties -} - -void BibliographyLoader::addVetoableChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no vetoable properties -} - -void BibliographyLoader::removeVetoableChangeListener( - const rtl::OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/) - throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) -{ - //no vetoable properties -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx deleted file mode 100644 index 2db648da6..000000000 --- a/extensions/source/bibliography/bibmod.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include -#include -#include -#include -#include -#include -#include - -#include "bibmod.hxx" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibconfig.hxx" -static PtrBibModul pBibModul=NULL; -static sal_uInt32 nBibModulCount=0; -#include - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) - -HdlBibModul OpenBibModul() -{ - if(pBibModul==NULL) - { - pBibModul=new BibModul(); - } - nBibModulCount++; - return &pBibModul; -} - -void CloseBibModul(HdlBibModul ppBibModul) -{ - nBibModulCount--; - if(nBibModulCount==0 && ppBibModul!=NULL) - { - delete pBibModul; - pBibModul=NULL; - } -} - -BibResId::BibResId( sal_uInt16 nId ) : - ResId( nId, *pBibModul->GetResMgr() ) -{ -} -BibConfig* BibModul::pBibConfig = 0; -BibModul::BibModul() -{ - pResMgr = ResMgr::CreateResMgr( "bib" ); -} - -BibModul::~BibModul() -{ - delete pResMgr; - delete pBibConfig; - pBibConfig = 0; -} - -BibDataManager* BibModul::createDataManager() -{ - return new BibDataManager(); -} -//----------------------------------------------------------------------------- -BibConfig* BibModul::GetConfig() -{ - if(! pBibConfig) - pBibConfig = new BibConfig; - return pBibConfig; -} - - -// PropertyNames -#define STATIC_USTRING(a,b) rtl::OUString a(b) -STATIC_USTRING(FM_PROP_LABEL,C2U("Label")); -STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField")); -STATIC_USTRING(FM_PROP_NAME,C2U("Name")); -STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey")); -STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode")); -STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType")); -STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection")); -STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource")); -STATIC_USTRING(FM_PROP_VALUE,C2U("Value")); -STATIC_USTRING(FM_PROP_TEXT,C2U("Text")); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibmod.hxx b/extensions/source/bibliography/bibmod.hxx deleted file mode 100644 index 0e2f04854..000000000 --- a/extensions/source/bibliography/bibmod.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BIBMOD_HXX -#define BIBMOD_HXX - - -class ResMgr; -class BibDataManager; -class BibConfig; - -#define BIBLIOGRAPHY_INI_GROUP "Bibliography" -#define BIBLIOGRAPHY_INI_CUR_NAME "BibliographyCurrent" -#define BIBLIOGRAPHY_INI_DB_ENTRY "Bibliography" -#define BIBLIOGRAPHY_INI_MAPPING "BibliographyFields" -#define BIBLIOGRAPHY_TYPE_NAMES "BibliographyTypeNames" - -class BibModul -{ - private: - ResMgr* pResMgr; - static BibConfig* pBibConfig; - - public: - BibModul(); - ~BibModul(); - - ResMgr* GetResMgr(){return pResMgr;} - static BibConfig* GetConfig(); - - BibDataManager* createDataManager(); - -}; - -typedef BibModul* PtrBibModul; -typedef PtrBibModul* HdlBibModul; - -HdlBibModul OpenBibModul(); -void CloseBibModul(HdlBibModul ppBibModul); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibprop.hrc b/extensions/source/bibliography/bibprop.hrc deleted file mode 100644 index 7c51ec071..000000000 --- a/extensions/source/bibliography/bibprop.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BIB_FMPROP_HRC -#define _BIB_FMPROP_HRC - -extern rtl::OUString FM_PROP_LABEL; -extern rtl::OUString FM_PROP_NAME; -extern rtl::OUString FM_PROP_CONTROLSOURCE; -extern rtl::OUString FM_PROP_FORMATKEY; -extern rtl::OUString FM_PROP_VALUE; -extern rtl::OUString FM_PROP_EDITMODE; -extern rtl::OUString FM_PROP_DATASOURCE; -extern rtl::OUString FM_PROP_CURSORSOURCE; -extern rtl::OUString FM_PROP_CURSORSOURCETYPE; -extern rtl::OUString FM_PROP_TEXT; - -#endif // _SVX_FMPROP_HRC - diff --git a/extensions/source/bibliography/bibresid.hxx b/extensions/source/bibliography/bibresid.hxx deleted file mode 100644 index ea8576779..000000000 --- a/extensions/source/bibliography/bibresid.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef ADRRESID_HXX -#define ADRRESID_HXX - -#include - -//=================================================================== - -class BibResId : public ResId -{ - public: - BibResId( sal_uInt16 nId ); -}; - - - -#endif // ADRRESID_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibshortcuthandler.hxx b/extensions/source/bibliography/bibshortcuthandler.hxx deleted file mode 100644 index fb33b2623..000000000 --- a/extensions/source/bibliography/bibshortcuthandler.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIBSHORTCUTHANDLER_HXX -#define _BIBSHORTCUTHANDLER_HXX - -#include -#include -#include - -// additional classes to handle shortcuts -// code in bibcont.cxx - - -class BibShortCutHandler -{ -private: - Window* pBaseClass; // in cases, where BibShortCutHandler also has to be a window - -protected: - inline BibShortCutHandler( Window* pBaseClass ); - -public: - virtual ~BibShortCutHandler(); - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - - inline Window* GetWindow( void ); -}; - -inline BibShortCutHandler::BibShortCutHandler( Window* _pBaseClass ) : pBaseClass( _pBaseClass ) -{ -} - -inline Window* BibShortCutHandler::GetWindow( void ) -{ - return pBaseClass; -} - - -class BibWindow : public Window, public BibShortCutHandler -{ -public: - BibWindow( Window* pParent,WinBits nStyle = WB_3DLOOK); - virtual ~BibWindow(); -}; - - -class BibSplitWindow : public SplitWindow, public BibShortCutHandler -{ -public: - BibSplitWindow( Window* pParent,WinBits nStyle = WB_3DLOOK); - virtual ~BibSplitWindow(); -}; - - -class BibTabPage : public TabPage, public BibShortCutHandler -{ -public: - BibTabPage( Window* pParent, const ResId& rResId ); - virtual ~BibTabPage(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibtools.hxx b/extensions/source/bibliography/bibtools.hxx deleted file mode 100644 index dff45ec1b..000000000 --- a/extensions/source/bibliography/bibtools.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef BIBTOOLS_HXX - -#include // includes also vcl/window.hxx - -namespace bib -{ - // source in bibbeam.cxx - - void HandleTaskPaneList( Window* pWindow, sal_Bool bAddToList ); - // pWindow: just an system window or something wich is child of a system window - - inline void AddToTaskPaneList( Window* pWindowToBeHandled ) - { - HandleTaskPaneList( pWindowToBeHandled, sal_True ); - } - - inline void RemoveFromTaskPaneList( Window* pWindowToBeHandled ) - { - HandleTaskPaneList( pWindowToBeHandled, sal_False ); - } -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx deleted file mode 100644 index 22455a009..000000000 --- a/extensions/source/bibliography/bibview.cxx +++ /dev/null @@ -1,219 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "bib.hrc" -#include "bibcont.hxx" -#include "bibbeam.hxx" -#include "general.hxx" -#include "bibview.hxx" -#include "datman.hxx" -#include "bibresid.hxx" -#include "bibmod.hxx" -#include "sections.hrc" -#include "bibconfig.hxx" - - -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - -#define C2U( cChar ) ::rtl::OUString::createFromAscii( cChar ) - -//......................................................................... -namespace bib -{ -//......................................................................... - - // ----------------------------------------------------------------------- - BibView::BibView( Window* _pParent, BibDataManager* _pManager, WinBits _nStyle ) - :BibWindow( _pParent, _nStyle ) - ,m_pDatMan( _pManager ) - ,m_xDatMan( _pManager ) - ,m_pGeneralPage( NULL ) - { - if ( m_xDatMan.is() ) - connectForm( m_xDatMan ); - } - - // ----------------------------------------------------------------------- - BibView::~BibView() - { - BibGeneralPage* pGeneralPage = m_pGeneralPage; - m_pGeneralPage = NULL; - - pGeneralPage->CommitActiveControl(); - Reference< XForm > xForm = m_pDatMan->getForm(); - Reference< XPropertySet > xProps( xForm, UNO_QUERY ); - Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); - DBG_ASSERT( xResUpd.is(), "BibView::~BibView: invalid form!" ); - - if ( xResUpd.is() ) - { - Any aModified = xProps->getPropertyValue( C2U( "IsModified" ) ); - sal_Bool bFlag = sal_False; - if ( ( aModified >>= bFlag ) && bFlag ) - { - - try - { - Any aNew = xProps->getPropertyValue( C2U( "IsNew" ) ); - aNew >>= bFlag; - if ( bFlag ) - xResUpd->insertRow(); - else - xResUpd->updateRow(); - } - catch( const uno::Exception& rEx) - { - (void) rEx; - } - } - } - - if ( isFormConnected() ) - disconnectForm(); - - pGeneralPage->RemoveListeners(); - m_xGeneralPage = NULL; - } - - void BibView::UpdatePages() - { - // TODO: - // this is _strange_: Why not updating the existent general page? - // I consider the current behaviour a HACK. - // frank.schoenheit@sun.com - if ( m_pGeneralPage ) - { - m_pGeneralPage->Hide(); - m_pGeneralPage->RemoveListeners(); - m_xGeneralPage = 0; - } - - m_xGeneralPage = m_pGeneralPage = new BibGeneralPage( this, m_pDatMan ); - - Resize(); - - if( HasFocus() ) - // "delayed" GetFocus() because GetFocus() is initially called before GeneralPage is created - m_pGeneralPage->GrabFocus(); - - String sErrorString( m_pGeneralPage->GetErrorString() ); - if ( sErrorString.Len() ) - { - sal_Bool bExecute = BibModul::GetConfig()->IsShowColumnAssignmentWarning(); - if(!m_pDatMan->HasActiveConnection()) - { - //no connection is available -> the data base has to be assigned - m_pDatMan->DispatchDBChangeDialog(); - bExecute = sal_False; - } - else if(bExecute) - { - sErrorString += '\n'; - sErrorString += String( BibResId( RID_MAP_QUESTION ) ); - QueryBox aQuery( this, WB_YES_NO, sErrorString ); - aQuery.SetDefaultCheckBoxText(); - short nResult = aQuery.Execute(); - BibModul::GetConfig()->SetShowColumnAssignmentWarning( - !aQuery.GetCheckBoxState()); - if( RET_YES != nResult ) - { - bExecute = sal_False; - } - } - if(bExecute) - { - Application::PostUserEvent( STATIC_LINK( this, BibView, CallMappingHdl ) ); - } - } - } - - void BibView::_loaded( const EventObject& _rEvent ) - { - UpdatePages(); - FormControlContainer::_loaded( _rEvent ); - } - - void BibView::_reloaded( const EventObject& _rEvent ) - { - UpdatePages(); - FormControlContainer::_loaded( _rEvent ); - } - - IMPL_STATIC_LINK( BibView, CallMappingHdl, BibView*, EMPTYARG ) - { - pThis->m_pDatMan->CreateMappingDialog( pThis ); - return 0; - } - - void BibView::Resize() - { - if ( m_pGeneralPage ) - { - ::Size aSz( GetOutputSizePixel() ); - m_pGeneralPage->SetSizePixel( aSz ); - } - Window::Resize(); - } - - Reference< awt::XControlContainer > BibView::getControlContainer() - { - Reference< awt::XControlContainer > xReturn; - if ( m_pGeneralPage ) - xReturn = m_pGeneralPage->GetControlContainer(); - return xReturn; - } - - void BibView::GetFocus() - { - if( m_pGeneralPage ) - m_pGeneralPage->GrabFocus(); - } - - sal_Bool BibView::HandleShortCutKey( const KeyEvent& rKeyEvent ) - { - return m_pGeneralPage? m_pGeneralPage->HandleShortCutKey( rKeyEvent ) : sal_False; - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx deleted file mode 100644 index 6ddb43f09..000000000 --- a/extensions/source/bibliography/bibview.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BIB_VIEW_HXX -#define _BIB_VIEW_HXX - -#include -#include -#include "formcontrolcontainer.hxx" -#include "bibshortcuthandler.hxx" - -class BibGeneralPage; -class BibDataManager; - -namespace com{ namespace sun{ namespace star{ namespace awt{ class XFocusListener;}}}} - -//......................................................................... -namespace bib -{ -//......................................................................... - - // ----------------------------------------------------------------------- - class BibView : public BibWindow, public FormControlContainer - { - private: - BibDataManager* m_pDatMan; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable> m_xDatMan; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener> m_xGeneralPage; - BibGeneralPage* m_pGeneralPage; - - private: - DECL_STATIC_LINK(BibView, CallMappingHdl, BibView*); - - protected: - // Window overridables - virtual void Resize(); - - // FormControlContainer - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer(); - - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - - public: - BibView( Window* _pParent, BibDataManager* _pDatMan, WinBits nStyle = WB_3DLOOK ); - ~BibView(); - - void UpdatePages(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx deleted file mode 100644 index fe17033a9..000000000 --- a/extensions/source/bibliography/datman.cxx +++ /dev/null @@ -1,1739 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "datman.hxx" -#include "bibresid.hxx" -#include "bibmod.hxx" -#include "bibview.hxx" -// #100312# --------- -#include "bibprop.hrc" -#include "toolbar.hxx" -#include "toolbar.hrc" -#include "bibconfig.hxx" -#include "bibbeam.hxx" -#include "bib.hrc" -#include "datman.hrc" -#include "bibliography.hrc" -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::lang; -using namespace ::ucb; - -#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) -#define MAP_TOKEN ';' -#define PAIR_TOKEN ':' - -Reference< XConnection > getConnection(const ::rtl::OUString& _rURL) -{ - // first get the sdb::DataSource corresponding to the url - Reference< XDataSource > xDataSource; - // is it a favorite title ? - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference xNamingContextIfc = xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseContext")); - Reference< XNameAccess > xNamingContext(xNamingContextIfc, UNO_QUERY); - if (xNamingContext.is() && xNamingContext->hasByName(_rURL)) - { - DBG_ASSERT(Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !"); - try - { - xDataSource = Reference< XDataSource > (Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY); - } - catch(Exception &) - { - OSL_FAIL("Exception caught in ODatabaseContext::getRegisteredObject()"); - } - } - // build the connection from the data source - Reference< XConnection > xConn; - if (xDataSource.is()) - { - // need user/pwd for this - ::rtl::OUString sUser, sPwd; - Reference< XPropertySet > xDataSourceProps(xDataSource, UNO_QUERY); - Reference< XCompletedConnection > xComplConn(xDataSource, UNO_QUERY); - try - { - - Reference xHdl = xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")); - Reference xIHdl(xHdl, UNO_QUERY); - xConn = xComplConn->connectWithCompletion(xIHdl); - } - catch(SQLException&) - { - // TODO : a real error handling - } - catch(Exception& e ) - { - (void) e; // make compiler happy - } - - } - return xConn; -} - -Reference< XConnection > getConnection(const Reference< XInterface > & xRowSet) -{ - Reference< XConnection > xConn; - try - { - Reference< XPropertySet > xFormProps(xRowSet, UNO_QUERY); - if (!xFormProps.is()) - return xConn; - - xConn = Reference< XConnection > (*(Reference< XInterface > *)xFormProps->getPropertyValue(C2U("ActiveConnection")).getValue(), UNO_QUERY); - if (!xConn.is()) - { - DBG_WARNING("no active connection"); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("exception in getConnection"); - } - - return xConn; -} - -Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm) -{ - Reference< XNameAccess > xReturn; - // check if the form is alive - Reference< XColumnsSupplier > xSupplyCols( _rxForm, UNO_QUERY ); - if (xSupplyCols.is()) - xReturn = xSupplyCols->getColumns(); - - if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0)) - { // no .... - xReturn = NULL; - // -> get the table the form is bound to and ask it for their columns - Reference< XTablesSupplier > xSupplyTables( getConnection( _rxForm ), UNO_QUERY ); - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - if (xFormProps.is() && xSupplyTables.is()) - { - try - { - DBG_ASSERT((*(sal_Int32*)xFormProps->getPropertyValue(C2U("CommandType")).getValue()) == CommandType::TABLE, - "::getColumns : invalid form (has no table as data source) !"); - ::rtl::OUString sTable; - xFormProps->getPropertyValue(C2U("Command")) >>= sTable; - Reference< XNameAccess > xTables = xSupplyTables->getTables(); - if (xTables.is() && xTables->hasByName(sTable)) - xSupplyCols = Reference< XColumnsSupplier > ( - *(Reference< XInterface > *)xTables->getByName(sTable).getValue(), UNO_QUERY); - if (xSupplyCols.is()) - xReturn = xSupplyCols->getColumns(); - } -#ifdef DBG_UTIL - catch(Exception& e ) -#else - catch(Exception&) -#endif - { -#ifdef DBG_UTIL - String sMsg(String::CreateFromAscii("::getColumns : catched an exception (")); - sMsg += String(e.Message); - sMsg.AppendAscii(") ..."); - OSL_FAIL( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer()); -#endif - } - - } - } - return xReturn; -} - -class MappingDialog_Impl : public ModalDialog -{ - BibDataManager* pDatMan; - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; - FixedLine aMapGB; - FixedText aIdentifierFT; - ListBox aIdentifierLB; - FixedText aAuthorityTypeFT; - ListBox aAuthorityTypeLB; - FixedText aAuthorFT; - ListBox aAuthorLB; - FixedText aTitleFT; - ListBox aTitleLB; - FixedText aMonthFT; - ListBox aMonthLB; - FixedText aYearFT; - ListBox aYearLB; - FixedText aISBNFT; - ListBox aISBNLB; - FixedText aBooktitleFT; - ListBox aBooktitleLB; - FixedText aChapterFT; - ListBox aChapterLB; - FixedText aEditionFT; - ListBox aEditionLB; - FixedText aEditorFT; - ListBox aEditorLB; - FixedText aHowpublishedFT; - ListBox aHowpublishedLB; - FixedText aInstitutionFT; - ListBox aInstitutionLB; - FixedText aJournalFT; - ListBox aJournalLB; - FixedText aNoteFT; - ListBox aNoteLB; - FixedText aAnnoteFT; - ListBox aAnnoteLB; - FixedText aNumberFT; - ListBox aNumberLB; - FixedText aOrganizationsFT; - ListBox aOrganizationsLB; - FixedText aPagesFT; - ListBox aPagesLB; - FixedText aPublisherFT; - ListBox aPublisherLB; - FixedText aAddressFT; - ListBox aAddressLB; - FixedText aSchoolFT; - ListBox aSchoolLB; - FixedText aSeriesFT; - ListBox aSeriesLB; - FixedText aReportTypeFT; - ListBox aReportTypeLB; - FixedText aVolumeFT; - ListBox aVolumeLB; - FixedText aURLFT; - ListBox aURLLB; - FixedText aCustom1FT; - ListBox aCustom1LB; - FixedText aCustom2FT; - ListBox aCustom2LB; - FixedText aCustom3FT; - ListBox aCustom3LB; - FixedText aCustom4FT; - ListBox aCustom4LB; - FixedText aCustom5FT; - ListBox aCustom5LB; - ListBox* aListBoxes[COLUMN_COUNT]; - String sNone; - - sal_Bool bModified; - - - - DECL_LINK(OkHdl, OKButton*); - DECL_LINK(ListBoxSelectHdl, ListBox*); - -public: - MappingDialog_Impl(Window* pParent, BibDataManager* pDatMan); - ~MappingDialog_Impl(); - - void SetModified() {bModified = sal_True;} - -}; - -sal_uInt16 lcl_FindLogicalName(BibConfig* pConfig , - const ::rtl::OUString& rLogicalColumnName) -{ - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(rLogicalColumnName == pConfig->GetDefColumnName(i)) - return i; - } - return USHRT_MAX; -} -//----------------------------------------------------------------------------- -MappingDialog_Impl::MappingDialog_Impl(Window* pParent, BibDataManager* pMan) : - ModalDialog(pParent, BibResId(RID_DLG_MAPPING) ), - pDatMan(pMan), - aOKBT(this, BibResId( BT_OK )), - aCancelBT(this, BibResId( BT_CANCEL )), - aHelpBT(this, BibResId( BT_HELP )), - - aMapGB(this, BibResId( GB_MAPPING )), - - aIdentifierFT(this, BibResId( FT_IDENTIFIER )), - aIdentifierLB(this, BibResId( LB_IDENTIFIER )), - aAuthorityTypeFT(this, BibResId( FT_AUTHORITYTYPE )), - aAuthorityTypeLB(this, BibResId( LB_AUTHORITYTYPE )), - aAuthorFT(this, BibResId( FT_AUTHOR )), - aAuthorLB(this, BibResId( LB_AUTHOR )), - aTitleFT(this, BibResId( FT_TITLE )), - aTitleLB(this, BibResId( LB_TITLE )), - aMonthFT(this, BibResId( FT_MONTH )), - aMonthLB(this, BibResId( LB_MONTH )), - aYearFT(this, BibResId( FT_YEAR )), - aYearLB(this, BibResId( LB_YEAR )), - aISBNFT(this, BibResId( FT_ISBN )), - aISBNLB(this, BibResId( LB_ISBN )), - aBooktitleFT(this, BibResId( FT_BOOKTITLE )), - aBooktitleLB(this, BibResId( LB_BOOKTITLE )), - aChapterFT(this, BibResId( FT_CHAPTER )), - aChapterLB(this, BibResId( LB_CHAPTER )), - aEditionFT(this, BibResId( FT_EDITION )), - aEditionLB(this, BibResId( LB_EDITION )), - aEditorFT(this, BibResId( FT_EDITOR )), - aEditorLB(this, BibResId( LB_EDITOR )), - aHowpublishedFT(this, BibResId( FT_HOWPUBLISHED )), - aHowpublishedLB(this, BibResId( LB_HOWPUBLISHED )), - aInstitutionFT(this, BibResId( FT_INSTITUTION )), - aInstitutionLB(this, BibResId( LB_INSTITUTION )), - aJournalFT(this, BibResId( FT_JOURNAL )), - aJournalLB(this, BibResId( LB_JOURNAL )), - aNoteFT(this, BibResId( FT_NOTE )), - aNoteLB(this, BibResId( LB_NOTE )), - aAnnoteFT(this, BibResId( FT_ANNOTE )), - aAnnoteLB(this, BibResId( LB_ANNOTE )), - aNumberFT(this, BibResId( FT_NUMBER )), - aNumberLB(this, BibResId( LB_NUMBER )), - aOrganizationsFT(this, BibResId( FT_ORGANIZATIONS )), - aOrganizationsLB(this, BibResId( LB_ORGANIZATIONS )), - aPagesFT(this, BibResId( FT_PAGES )), - aPagesLB(this, BibResId( LB_PAGES )), - aPublisherFT(this, BibResId( FT_PUBLISHER )), - aPublisherLB(this, BibResId( LB_PUBLISHER )), - aAddressFT(this, BibResId( FT_ADDRESS )), - aAddressLB(this, BibResId( LB_ADDRESS )), - aSchoolFT(this, BibResId( FT_SCHOOL )), - aSchoolLB(this, BibResId( LB_SCHOOL )), - aSeriesFT(this, BibResId( FT_SERIES )), - aSeriesLB(this, BibResId( LB_SERIES )), - aReportTypeFT(this, BibResId( FT_REPORTTYPE )), - aReportTypeLB(this, BibResId( LB_REPORTTYPE )), - aVolumeFT(this, BibResId( FT_VOLUME )), - aVolumeLB(this, BibResId( LB_VOLUME )), - aURLFT(this, BibResId( FT_URL )), - aURLLB(this, BibResId( LB_URL )), - aCustom1FT(this, BibResId( FT_CUSTOM1 )), - aCustom1LB(this, BibResId( LB_CUSTOM1 )), - aCustom2FT(this, BibResId( FT_CUSTOM2 )), - aCustom2LB(this, BibResId( LB_CUSTOM2 )), - aCustom3FT(this, BibResId( FT_CUSTOM3 )), - aCustom3LB(this, BibResId( LB_CUSTOM3 )), - aCustom4FT(this, BibResId( FT_CUSTOM4 )), - aCustom4LB(this, BibResId( LB_CUSTOM4 )), - aCustom5FT(this, BibResId( FT_CUSTOM5 )), - aCustom5LB(this, BibResId( LB_CUSTOM5 )), - sNone(BibResId(ST_NONE)), - bModified(sal_False) -{ - FreeResource(); - - aIdentifierFT.SetText(String( BibResId( ST_IDENTIFIER ))); - aAuthorityTypeFT.SetText(String( BibResId( ST_AUTHTYPE ))); - aAuthorFT.SetText(String( BibResId( ST_AUTHOR ))); - aTitleFT.SetText(String( BibResId( ST_TITLE ))); - aMonthFT.SetText(String( BibResId( ST_MONTH ))); - aYearFT.SetText(String( BibResId( ST_YEAR ))); - aISBNFT.SetText(String( BibResId( ST_ISBN ))); - aBooktitleFT.SetText(String( BibResId( ST_BOOKTITLE ))); - aChapterFT.SetText(String( BibResId( ST_CHAPTER ))); - aEditionFT.SetText(String( BibResId( ST_EDITION ))); - aEditorFT.SetText(String( BibResId( ST_EDITOR ))); - aHowpublishedFT.SetText(String( BibResId( ST_HOWPUBLISHED ))); - aInstitutionFT.SetText(String( BibResId( ST_INSTITUTION ))); - aJournalFT.SetText(String( BibResId( ST_JOURNAL ))); - aNoteFT.SetText(String( BibResId( ST_NOTE ))); - aAnnoteFT.SetText(String( BibResId( ST_ANNOTE ))); - aNumberFT.SetText(String( BibResId( ST_NUMBER ))); - aOrganizationsFT.SetText(String( BibResId( ST_ORGANIZATION ))); - aPagesFT.SetText(String( BibResId( ST_PAGE ))); - aPublisherFT.SetText(String( BibResId( ST_PUBLISHER ))); - aAddressFT.SetText(String( BibResId( ST_ADDRESS ))); - aSchoolFT.SetText(String( BibResId( ST_SCHOOL ))); - aSeriesFT.SetText(String( BibResId( ST_SERIES ))); - aReportTypeFT.SetText(String( BibResId( ST_REPORT ))); - aVolumeFT.SetText(String( BibResId( ST_VOLUME ))); - aURLFT.SetText(String( BibResId( ST_URL ))); - aCustom1FT.SetText(String( BibResId( ST_CUSTOM1 ))); - aCustom2FT.SetText(String( BibResId( ST_CUSTOM2 ))); - aCustom3FT.SetText(String( BibResId( ST_CUSTOM3 ))); - aCustom4FT.SetText(String( BibResId( ST_CUSTOM4 ))); - aCustom5FT.SetText(String( BibResId( ST_CUSTOM5 ))); - - aOKBT.SetClickHdl(LINK(this, MappingDialog_Impl, OkHdl)); - String sTitle = GetText(); - sTitle.SearchAndReplace(C2S("%1"), pDatMan->getActiveDataTable(), 0); - SetText(sTitle); - - aListBoxes[0] = &aIdentifierLB; - aListBoxes[1] = &aAuthorityTypeLB; - aListBoxes[2] = &aAuthorLB; - aListBoxes[3] = &aTitleLB; - aListBoxes[4] = &aYearLB; - aListBoxes[5] = &aISBNLB; - aListBoxes[6] = &aBooktitleLB; - aListBoxes[7] = &aChapterLB; - aListBoxes[8] = &aEditionLB; - aListBoxes[9] = &aEditorLB; - aListBoxes[10] = &aHowpublishedLB; - aListBoxes[11] = &aInstitutionLB; - aListBoxes[12] = &aJournalLB; - aListBoxes[13] = &aMonthLB; - aListBoxes[14] = &aNoteLB; - aListBoxes[15] = &aAnnoteLB; - aListBoxes[16] = &aNumberLB; - aListBoxes[17] = &aOrganizationsLB; - aListBoxes[18] = &aPagesLB; - aListBoxes[19] = &aPublisherLB; - aListBoxes[20] = &aAddressLB; - aListBoxes[21] = &aSchoolLB; - aListBoxes[22] = &aSeriesLB; - aListBoxes[23] = &aReportTypeLB; - aListBoxes[24] = &aVolumeLB; - aListBoxes[25] = &aURLLB; - aListBoxes[26] = &aCustom1LB; - aListBoxes[27] = &aCustom2LB; - aListBoxes[28] = &aCustom3LB; - aListBoxes[29] = &aCustom4LB; - aListBoxes[30] = &aCustom5LB; - - aListBoxes[0]->InsertEntry(sNone); - Reference< XNameAccess > xFields = getColumns( pDatMan->getForm() ); - DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !"); - if(xFields.is()) - { - Sequence< ::rtl::OUString > aNames = xFields->getElementNames(); - sal_Int32 nFieldsCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - - for(sal_Int32 nField = 0; nField < nFieldsCount; nField++) - aListBoxes[0]->InsertEntry(pNames[nField]); - } - - Link aLnk = LINK(this, MappingDialog_Impl, ListBoxSelectHdl); - - aListBoxes[0]->SelectEntryPos(0); - aListBoxes[0]->SetSelectHdl(aLnk); - for(sal_uInt16 i = 1; i < COLUMN_COUNT; i++) - { - for(sal_uInt16 j = 0; j < aListBoxes[0]->GetEntryCount();j++) - aListBoxes[i]->InsertEntry(aListBoxes[0]->GetEntry(j)); - aListBoxes[i]->SelectEntryPos(0); - aListBoxes[i]->SetSelectHdl(aLnk); - } - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pConfig->GetMapping(aDesc); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, pMapping->aColumnPairs[nEntry].sLogicalColumnName); - if(nListBoxIndex < COLUMN_COUNT) - { - aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName); - } - } - } -} - -MappingDialog_Impl::~MappingDialog_Impl() -{} - -IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, ListBox*, pListBox) -{ - sal_uInt16 nEntryPos = pListBox->GetSelectEntryPos(); - if(0 < nEntryPos) - { - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(pListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos) - aListBoxes[i]->SelectEntryPos(0); - } - } - SetModified(); - return 0; -} - -IMPL_LINK(MappingDialog_Impl, OkHdl, OKButton*, EMPTYARG) -{ - if(bModified) - { - Mapping aNew; - aNew.sTableName = String(pDatMan->getActiveDataTable()); - aNew.sURL = String(pDatMan->getActiveDataSource()); - - sal_uInt16 nWriteIndex = 0; - BibConfig* pConfig = BibModul::GetConfig(); - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - String sSel = aListBoxes[nEntry]->GetSelectEntry(); - if(sSel != sNone) - { - aNew.aColumnPairs[nWriteIndex].sRealColumnName = sSel; - aNew.aColumnPairs[nWriteIndex].sLogicalColumnName = pConfig->GetDefColumnName(nEntry); - nWriteIndex++; - } - } - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - pDatMan->ResetIdentifierMapping(); - pConfig->SetMapping(aDesc, &aNew); - } - EndDialog(bModified ? RET_OK : RET_CANCEL); - return 0; -} - -class DBChangeDialog_Impl : public ModalDialog -{ - OKButton aOKBT; - CancelButton aCancelBT; - HelpButton aHelpBT; - FixedLine aSelectionGB; - SvTabListBox aSelectionLB; - HeaderBar aSelectionHB; - DBChangeDialogConfig_Impl aConfig; - String aEntryST; - String aURLST; - - BibDataManager* pDatMan; - - DECL_LINK(DoubleClickHdl, SvTabListBox*); -public: - DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ); - ~DBChangeDialog_Impl(); - - String GetCurrentURL()const; -}; - -DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) : - ModalDialog(pParent, BibResId(RID_DLG_DBCHANGE) ), - aOKBT(this, BibResId( BT_OK )), - aCancelBT(this, BibResId( BT_CANCEL )), - aHelpBT(this, BibResId( BT_HELP )), - aSelectionGB(this, BibResId( GB_SELECTION )), - aSelectionLB(this, BibResId( LB_SELECTION )), - aSelectionHB(this, BibResId( HB_SELECTION )), - aEntryST(BibResId(ST_ENTRY)), - aURLST( BibResId(ST_URL)), - pDatMan(pMan) -{ - FreeResource(); - aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl)); - try - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - ::Size aSize = aSelectionHB.GetSizePixel(); - long nTabs[2]; - nTabs[0] = 1;// Number of Tabs - nTabs[1] = aSize.Width() / 4; - - aSelectionHB.SetStyle(aSelectionHB.GetStyle()|WB_STDHEADERBAR); - aSelectionHB.InsertItem( 1, aEntryST, aSize.Width()); - aSelectionHB.SetSizePixel(aSelectionHB.CalcWindowSizePixel()); - aSelectionHB.Show(); - - aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL ); - aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); - aSelectionLB.GetModel()->SetSortMode(SortAscending); - - ::rtl::OUString sActiveSource = pDatMan->getActiveDataSource(); - const Sequence< ::rtl::OUString >& rSources = aConfig.GetDataSourceNames(); - const ::rtl::OUString* pSourceNames = rSources.getConstArray(); - for(int i = 0; i < rSources.getLength(); i++) - { - SvLBoxEntry* pEntry = aSelectionLB.InsertEntry(pSourceNames[i]); - if(pSourceNames[i] == sActiveSource) - { - aSelectionLB.Select(pEntry); - } - } - aSelectionLB.GetModel()->Resort(); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl"); - } - - -} - -IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, /*pLB*/) -{ - EndDialog(RET_OK); - return 0; -} - -DBChangeDialog_Impl::~DBChangeDialog_Impl() -{ -} - -String DBChangeDialog_Impl::GetCurrentURL()const -{ - String sRet; - SvLBoxEntry* pEntry = aSelectionLB.FirstSelected(); - if(pEntry) - { - sRet = aSelectionLB.GetEntryText(pEntry, 0); - } - return sRet; -} - -// XDispatchProvider -BibInterceptorHelper::BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch) -{ - if( pBibBeamer ) - { - xInterception = pBibBeamer->getDispatchProviderInterception(); - if( xInterception.is() ) - xInterception->registerDispatchProviderInterceptor( this ); - } - if( xDispatch.is() ) - xFormDispatch = xDispatch; -} - -BibInterceptorHelper::~BibInterceptorHelper( ) -{ -} - -void BibInterceptorHelper::ReleaseInterceptor() -{ - if ( xInterception.is() ) - xInterception->releaseDispatchProviderInterceptor( this ); - xInterception.clear(); -} - -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL - BibInterceptorHelper::queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException) -{ - Reference< XDispatch > xReturn; - - String aCommand( aURL.Path ); - if ( aCommand.EqualsAscii("FormSlots/ConfirmDeletion") ) - xReturn = xFormDispatch; - else - if ( xSlaveDispatchProvider.is() ) - xReturn = xSlaveDispatchProvider->queryDispatch( aURL, aTargetFrameName, nSearchFlags); - - return xReturn; -} - -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL - BibInterceptorHelper::queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException) -{ - Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() ); - Reference< XDispatch >* pReturn = aReturn.getArray(); - const DispatchDescriptor* pDescripts = aDescripts.getConstArray(); - for ( sal_Int16 i=0; iFeatureURL, pDescripts->FrameName, pDescripts->SearchFlags ); - } - return aReturn; -} - -// XDispatchProviderInterceptor -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL - BibInterceptorHelper::getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) -{ - return xSlaveDispatchProvider; -} - -void SAL_CALL BibInterceptorHelper::setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) -{ - xSlaveDispatchProvider = xNewSlaveDispatchProvider; -} - -::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL - BibInterceptorHelper::getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) -{ - return xMasterDispatchProvider; -} - -void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) -{ - xMasterDispatchProvider = xNewMasterDispatchProvider; -} - -//----------------------------------------------------------------------------- -#define STR_UID "uid" -::rtl::OUString gGridName(C2U("theGrid")); -::rtl::OUString gViewName(C2U("theView")); -::rtl::OUString gGlobalName(C2U("theGlobals")); -::rtl::OUString gBeamerSize(C2U("theBeamerSize")); -::rtl::OUString gViewSize(C2U("theViewSize")); - -BibDataManager::BibDataManager() - :BibDataManager_Base( GetMutex() ) - ,m_pInterceptorHelper( NULL ) - ,m_aLoadListeners(m_aMutex) - ,pBibView( NULL ) - ,pToolbar(0) -{ -} - - -BibDataManager::~BibDataManager() -{ - Reference< XLoadable > xLoad( m_xForm, UNO_QUERY ); - Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY ); - Reference< XComponent > xComp( m_xForm, UNO_QUERY ); - if ( m_xForm.is() ) - { - Reference< XComponent > xConnection; - xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection; - RemoveMeAsUidListener(); - if (xLoad.is()) - xLoad->unload(); - if (xComp.is()) - xComp->dispose(); - if(xConnection.is()) - xConnection->dispose(); - m_xForm = NULL; - } - if( m_pInterceptorHelper ) - { - m_pInterceptorHelper->ReleaseInterceptor(); - m_pInterceptorHelper->release(); - m_pInterceptorHelper = NULL; - } -} -//------------------------------------------------------------------------ -void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid) -{ - if ( !_rxGrid.is() ) - return; - - try - { - Reference< XNameContainer > xColContainer( _rxGrid, UNO_QUERY ); - // remove the old fields - if ( xColContainer->hasElements() ) - { - Sequence< ::rtl::OUString > aNames = xColContainer->getElementNames(); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pNamesEnd = pNames + aNames.getLength(); - for ( ; pNames != pNamesEnd; ++pNames ) - xColContainer->removeByName( *pNames ); - } - - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - Reference< XGridColumnFactory > xColFactory( _rxGrid, UNO_QUERY ); - - Reference< XPropertySet > xField; - - Sequence< ::rtl::OUString > aFields( xFields->getElementNames() ); - const ::rtl::OUString* pFields = aFields.getConstArray(); - const ::rtl::OUString* pFieldsEnd = pFields + aFields.getLength(); - - for ( ; pFields != pFieldsEnd; ++pFields ) - { - xFields->getByName( *pFields ) >>= xField; - - ::rtl::OUString sCurrentModelType; - const ::rtl::OUString sType(C2U("Type")); - sal_Int32 nType = 0; - sal_Bool bIsFormatted = sal_False; - sal_Bool bFormattedIsNumeric = sal_True; - xField->getPropertyValue(sType) >>= nType; - switch(nType) - { - case DataType::BIT: - case DataType::BOOLEAN: - sCurrentModelType = C2U("CheckBox"); - break; - - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - case DataType::BLOB: - sCurrentModelType = C2U("TextField"); - break; - - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - case DataType::CHAR: - case DataType::CLOB: - bFormattedIsNumeric = sal_False; - // _NO_ break ! - default: - sCurrentModelType = C2U("FormattedField"); - bIsFormatted = sal_True; - break; - } - - Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(sCurrentModelType); - if (bIsFormatted) - { - ::rtl::OUString sFormatKey(C2U("FormatKey")); - xCurrentCol->setPropertyValue(sFormatKey, xField->getPropertyValue(sFormatKey)); - Any aFormatted(&bFormattedIsNumeric, ::getBooleanCppuType()); - xCurrentCol->setPropertyValue(C2U("TreatAsNumber"), aFormatted); - } - Any aColName = makeAny( *pFields ); - xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName); - xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName); - - xColContainer->insertByName( *pFields, makeAny( xCurrentCol ) ); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::InsertFields"); - } -} - -Reference< awt::XControlModel > BibDataManager::updateGridModel() -{ - return updateGridModel( m_xForm ); -} - -Reference< awt::XControlModel > BibDataManager::updateGridModel(const Reference< XForm > & xDbForm) -{ - try - { - Reference< XPropertySet > aFormPropSet( xDbForm, UNO_QUERY ); - ::rtl::OUString sName; - aFormPropSet->getPropertyValue(C2U("Command")) >>= sName; - - if ( !m_xGridModel.is() ) - { - m_xGridModel = createGridModel( gGridName ); - - Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY); - xNameCont->insertByName( sName, makeAny( m_xGridModel ) ); - } - - // insert the fields - Reference< XFormComponent > xFormComp( m_xGridModel, UNO_QUERY ); - InsertFields( xFormComp ); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::updateGridModel: something went wrong !"); - } - - - return m_xGridModel; -} - -Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc) -{ - Reference< XForm > xResult; - try - { - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - m_xForm = Reference< XForm > ( xMgr->createInstance( C2U("com.sun.star.form.component.Form") ), UNO_QUERY ); - - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - - aDataSourceURL = rDesc.sDataSource; - if(aPropertySet.is()) - { - Any aVal; - aVal <<= (sal_Int32)ResultSetType::SCROLL_INSENSITIVE; - aPropertySet->setPropertyValue(C2U("ResultSetType"),aVal ); - aVal <<= (sal_Int32)ResultSetConcurrency::READ_ONLY; - aPropertySet->setPropertyValue(C2U("ResultSetConcurrency"), aVal); - - //Caching for Performance - aVal <<= (sal_Int32)50; - aPropertySet->setPropertyValue(C2U("FetchSize"), aVal); - - Reference< XConnection > xConnection = getConnection(rDesc.sDataSource); - aVal <<= xConnection; - aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal); - - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - Reference< XNameAccess > xTables = xSupplyTables.is() ? - xSupplyTables->getTables() : Reference< XNameAccess > (); - - Sequence< ::rtl::OUString > aTableNameSeq; - if (xTables.is()) - aTableNameSeq = xTables->getElementNames(); - - if(aTableNameSeq.getLength() > 0) - { - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - if(rDesc.sTableOrQuery.getLength()) - aActiveDataTable = rDesc.sTableOrQuery; - else - { - rDesc.sTableOrQuery = aActiveDataTable = pTableNames[0]; - rDesc.nCommandType = CommandType::TABLE; - } - - aVal <<= aActiveDataTable; - aPropertySet->setPropertyValue(C2U("Command"), aVal); - aVal <<= rDesc.nCommandType; - aPropertySet->setPropertyValue(C2U("CommandType"), aVal); - - - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - ::rtl::OUString aString(C2U("SELECT * FROM ")); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - - xResult = m_xForm; - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::createDatabaseForm: something went wrong !"); - } - - - return xResult; -} -//------------------------------------------------------------------------ -Sequence< ::rtl::OUString > BibDataManager::getDataSources() -{ - Sequence< ::rtl::OUString > aTableNameSeq; - - try - { - Reference< XTablesSupplier > xSupplyTables( getConnection( m_xForm ), UNO_QUERY ); - Reference< XNameAccess > xTables; - if (xSupplyTables.is()) - xTables = xSupplyTables->getTables(); - if (xTables.is()) - aTableNameSeq = xTables->getElementNames(); - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::getDataSources: something went wrong !"); - } - - - return aTableNameSeq; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getActiveDataTable() -{ - return aActiveDataTable; -} -//------------------------------------------------------------------------ -void BibDataManager::setFilter(const ::rtl::OUString& rQuery) -{ - if(!m_xParser.is()) - return; - try - { - m_xParser->setFilter( rQuery ); - ::rtl::OUString aQuery = m_xParser->getFilter(); - Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - xFormProps->setPropertyValue( C2U( "Filter" ), makeAny( aQuery ) ); - xFormProps->setPropertyValue( C2U( "ApplyFilter" ), makeAny( sal_True ) ); - reload(); - } - catch(Exception& e ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getFilter() -{ - - ::rtl::OUString aQueryString; - try - { - Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - OSL_VERIFY( xFormProps->getPropertyValue( C2U( "Filter" ) ) >>= aQueryString ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - - return aQueryString; - -} -//------------------------------------------------------------------------ -Sequence< ::rtl::OUString > BibDataManager::getQueryFields() -{ - Sequence< ::rtl::OUString > aFieldSeq; - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (xFields.is()) - aFieldSeq = xFields->getElementNames(); - return aFieldSeq; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getQueryField() -{ - BibConfig* pConfig = BibModul::GetConfig(); - ::rtl::OUString aFieldString = pConfig->getQueryField(); - if(!aFieldString.getLength()) - { - Sequence< ::rtl::OUString > aSeq = getQueryFields(); - const ::rtl::OUString* pFields = aSeq.getConstArray(); - if(aSeq.getLength()>0) - { - aFieldString=pFields[0]; - } - } - return aFieldString; -} -//------------------------------------------------------------------------ -void BibDataManager::startQueryWith(const ::rtl::OUString& rQuery) -{ - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryText( rQuery ); - - ::rtl::OUString aQueryString; - if(rQuery.getLength()>0) - { - aQueryString=aQuoteChar; - aQueryString+=getQueryField(); - aQueryString+=aQuoteChar; - aQueryString+=C2U(" like '"); - String sQuery(rQuery); - sQuery.SearchAndReplaceAll('?','_'); - sQuery.SearchAndReplaceAll('*','%'); - aQueryString += sQuery; - aQueryString+=C2U("%'"); - } - setFilter(aQueryString); -} - -void BibDataManager::setActiveDataSource(const ::rtl::OUString& rURL) -{ - ::rtl::OUString uTable; - ::rtl::OUString sTmp(aDataSourceURL); - aDataSourceURL = rURL; - - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - if(aPropertySet.is()) - { - unload(); - - Reference< XComponent > xOldConnection; - aPropertySet->getPropertyValue(C2U("ActiveConnection")) >>= xOldConnection; - - Reference< XConnection > xConnection = getConnection(rURL); - if(!xConnection.is()) - { - aDataSourceURL = sTmp; - return; - } - Any aVal; aVal <<= xConnection; - aPropertySet->setPropertyValue(C2U("ActiveConnection"), aVal); - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - if(xOldConnection.is()) - xOldConnection->dispose(); - - Sequence< ::rtl::OUString > aTableNameSeq; - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - if(xSupplyTables.is()) - { - Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - aTableNameSeq = xAccess->getElementNames(); - } - if(aTableNameSeq.getLength() > 0) - { - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - aActiveDataTable = pTableNames[0]; - aVal <<= aActiveDataTable; - aPropertySet->setPropertyValue(C2U("Command"), aVal); - aPropertySet->setPropertyValue(C2U("CommandType"), makeAny(CommandType::TABLE)); - //Caching for Performance - aVal <<= (sal_Int32)50; - aPropertySet->setPropertyValue(C2U("FetchSize"), aVal); - ::rtl::OUString aString(C2U("SELECT * FROM ")); - // quote the table name which may contain catalog.schema.table - Reference xMetaData(xConnection->getMetaData(),UNO_QUERY); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - setActiveDataTable(aActiveDataTable); - } - FeatureStateEvent aEvent; - util::URL aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.FeatureDescriptor = getActiveDataTable(); - - aEvent.State = makeAny( getDataSources() ); - - if(pToolbar) - { - aURL.Complete =C2U(".uno:Bib/source"); - aEvent.FeatureURL = aURL; - pToolbar->statusChanged( aEvent ); - } - - updateGridModel(); - load(); - } -} - - -void BibDataManager::setActiveDataTable(const ::rtl::OUString& rTable) -{ - ResetIdentifierMapping(); - try - { - Reference< XPropertySet > aPropertySet( m_xForm, UNO_QUERY ); - - if(aPropertySet.is()) - { - Reference< XConnection > xConnection = getConnection( m_xForm ); - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - Sequence< ::rtl::OUString > aTableNameSeq = xAccess->getElementNames(); - sal_uInt32 nCount = aTableNameSeq.getLength(); - - const ::rtl::OUString* pTableNames = aTableNameSeq.getConstArray(); - const ::rtl::OUString* pTableNamesEnd = pTableNames + nCount; - - for ( ; pTableNames != pTableNamesEnd; ++pTableNames ) - { - if ( rTable == *pTableNames ) - { - aActiveDataTable = rTable; - Any aVal; aVal <<= rTable; - aPropertySet->setPropertyValue( C2U("Command"), aVal ); - break; - } - } - if (pTableNames != pTableNamesEnd) - { - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.SingleSelectQueryComposer" ) ) ), UNO_QUERY ); - - ::rtl::OUString aString(C2U("SELECT * FROM ")); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - - m_xParser->setElementaryQuery(aString); - - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); - - BibDBDescriptor aDesc; - aDesc.sDataSource = aDataSourceURL; - aDesc.sTableOrQuery = aActiveDataTable; - aDesc.nCommandType = CommandType::TABLE; - BibModul::GetConfig()->SetBibliographyURL(aDesc); - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::setActiveDataTable: something went wrong !"); - } - -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::load( ) throw (RuntimeException) -{ - if ( isLoaded() ) - // nothing to do - return; - - Reference< XLoadable > xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::load: invalid form!"); - if ( xFormAsLoadable.is() ) - { - xFormAsLoadable->load(); - SetMeAsUidListener(); - - EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt ); - } -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::unload( ) throw (RuntimeException) -{ - if ( !isLoaded() ) - // nothing to do - return; - - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!"); - if ( xFormAsLoadable.is() ) - { - EventObject aEvt( static_cast< XWeak* >( this ) ); - - { - m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt ); - } - - RemoveMeAsUidListener(); - xFormAsLoadable->unload(); - - { - m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt ); - } - } -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::reload( ) throw (RuntimeException) -{ - if ( !isLoaded() ) - // nothing to do - return; - - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::unload: invalid form!"); - if ( xFormAsLoadable.is() ) - { - EventObject aEvt( static_cast< XWeak* >( this ) ); - - { - m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt ); - } - - xFormAsLoadable->reload(); - - { - m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt ); - } - } -} - -//------------------------------------------------------------------------ -sal_Bool SAL_CALL BibDataManager::isLoaded( ) throw (RuntimeException) -{ - Reference< XLoadable >xFormAsLoadable( m_xForm, UNO_QUERY ); - DBG_ASSERT( xFormAsLoadable.is() || !m_xForm.is(), "BibDataManager::isLoaded: invalid form!"); - - sal_Bool bLoaded = sal_False; - if ( xFormAsLoadable.is() ) - bLoaded = xFormAsLoadable->isLoaded(); - return bLoaded; -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException) -{ - m_aLoadListeners.addInterface( aListener ); -} - -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) throw (RuntimeException) -{ - m_aLoadListeners.removeInterface( aListener ); -} - -//------------------------------------------------------------------------ -Reference< awt::XControlModel > BibDataManager::createGridModel(const ::rtl::OUString& rName) -{ - Reference< awt::XControlModel > xModel; - - try - { - // create the control model - Reference< XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory(); - Reference< XInterface > xObject = xMgr->createInstance(C2U("com.sun.star.form.component.GridControl")); - xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY ); - - // set the - Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - xPropSet->setPropertyValue( C2U("Name"), makeAny( rName ) ); - - // set the name of the to-be-created control - ::rtl::OUString aControlName(C2U("com.sun.star.form.control.InteractionGridControl")); - Any aAny; aAny <<= aControlName; - xPropSet->setPropertyValue( C2U("DefaultControl"),aAny ); - - // the the helpURL - ::rtl::OUString uProp(C2U("HelpURL")); - Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - if (xPropInfo->hasPropertyByName(uProp)) - { - ::rtl::OUString sId(RTL_CONSTASCII_USTRINGPARAM( INET_HID_SCHEME )); - sId += ::rtl::OUString::createFromAscii( HID_BIB_DB_GRIDCTRL ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::createGridModel: something went wrong !"); - } - - - return xModel; -} -//------------------------------------------------------------------------ -::rtl::OUString BibDataManager::getControlName(sal_Int32 nFormatKey ) -{ - ::rtl::OUString aResStr; - switch (nFormatKey) - { - case DataType::BIT: - case DataType::BOOLEAN: - aResStr=C2U("CheckBox"); - break; - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - aResStr=C2U("NumericField"); ; - break; - case DataType::REAL: - case DataType::DOUBLE: - case DataType::NUMERIC: - case DataType::DECIMAL: - aResStr=C2U("FormattedField"); - break; - case DataType::TIMESTAMP: - aResStr=C2U("FormattedField"); - break; - case DataType::DATE: - aResStr=C2U("DateField"); - break; - case DataType::TIME: - aResStr=C2U("TimeField"); - break; - case DataType::CHAR: - case DataType::VARCHAR: - case DataType::LONGVARCHAR: - default: - aResStr=C2U("TextField"); - break; - } - return aResStr; -} -//------------------------------------------------------------------------ -Reference< awt::XControlModel > BibDataManager::loadControlModel( - const ::rtl::OUString& rName, sal_Bool bForceListBox) -{ - Reference< awt::XControlModel > xModel; - ::rtl::OUString aName(C2U("View_")); - aName += rName; - - try - { - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return xModel; - Reference< XPropertySet > xField; - - Any aElement; - - if(xFields->hasByName(rName)) - { - aElement = xFields->getByName(rName); - aElement >>= xField; - Reference< XPropertySetInfo > xInfo = xField.is() ? xField->getPropertySetInfo() : Reference< XPropertySetInfo > (); - - ::rtl::OUString sCurrentModelType; - const ::rtl::OUString sType(C2U("Type")); - sal_Int32 nFormatKey = 0; - xField->getPropertyValue(sType) >>= nFormatKey; - - ::rtl::OUString aInstanceName(C2U("com.sun.star.form.component.")); - - if (bForceListBox) - aInstanceName += C2U("ListBox"); - else - aInstanceName += getControlName(nFormatKey); - - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - Reference< XInterface > xObject = xMgr->createInstance(aInstanceName); - xModel=Reference< awt::XControlModel > ( xObject, UNO_QUERY ); - Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - Any aFieldName; aFieldName <<= aName; - - xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName); - xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, makeAny( rName ) ); - xPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NativeWidgetLook" ) ), makeAny( (sal_Bool)sal_True ) ); - - Reference< XFormComponent > aFormComp(xModel,UNO_QUERY ); - - Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY ); - xNameCont->insertByName(aName, makeAny( aFormComp ) ); - - // now if the form where we inserted the new model is already loaded, notify the model of this - // Note that this implementation below is a HACK as it relies on the fact that the model adds itself - // as load listener to it's parent, which is an implementation detail of the model. - // - // the better solution would be the following: - // in the current scenario, we insert a control model into a form. This results in the control model - // adding itself as load listener to the form. Now, the form should realize that it's already loaded - // and notify the model (which it knows as XLoadListener only) immediately. This seems to make sense. - // (as an anologon to the XStatusListener semantics). - // - // But this would be way too risky for this last-day fix here. - Reference< XLoadable > xLoad( m_xForm, UNO_QUERY ); - if ( xLoad.is() && xLoad->isLoaded() ) - { - Reference< XLoadListener > xListener( aFormComp, UNO_QUERY ); - if ( xListener.is() ) - { - EventObject aLoadSource; - aLoadSource.Source = xLoad; - xListener->loaded( aLoadSource ); - } - } - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::loadControlModel: something went wrong !"); - } - return xModel; -} -//------------------------------------------------------------------------ -void SAL_CALL BibDataManager::disposing() -{ - BibDataManager_Base::WeakComponentImplHelperBase::disposing(); -} - -//------------------------------------------------------------------------ -void BibDataManager::disposing( const EventObject& /*Source*/ ) throw( ::com::sun::star::uno::RuntimeException ) -{ - // not interested in -} - -//------------------------------------------------------------------------ -void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw( RuntimeException ) -{ - try - { - if(evt.PropertyName == FM_PROP_VALUE) - { - if( evt.NewValue.getValueType() == ::getCppuType((Reference*)0) ) - { - Reference< io::XDataInputStream > xStream( - *(const Reference< io::XInputStream > *)evt.NewValue.getValue(), UNO_QUERY ); - aUID <<= xStream->readUTF(); - } - else - aUID = evt.NewValue; - - Reference< XRowLocate > xLocate(xBibCursor, UNO_QUERY); - DBG_ASSERT(xLocate.is(), "BibDataManager::propertyChange : invalid cursor !"); - xLocate->moveToBookmark(aUID); - } - } - catch(Exception& e ) - { - (void) e; // make compiler happy - OSL_FAIL("::propertyChange: something went wrong !"); - } - - -} -//------------------------------------------------------------------------ -void BibDataManager::SetMeAsUidListener() -{ -try -{ - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - Sequence< ::rtl::OUString > aFields(xFields->getElementNames()); - const ::rtl::OUString* pFields = aFields.getConstArray(); - sal_Int32 nCount=aFields.getLength(); - String StrUID(C2S(STR_UID)); - ::rtl::OUString theFieldName; - for( sal_Int32 i=0; i0) - { - Reference< XPropertySet > xPropSet; - Any aElement; - - aElement = xFields->getByName(theFieldName); - xPropSet = *(Reference< XPropertySet > *)aElement.getValue(); - - xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this); - } - -} -catch(Exception& e ) -{ - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::SetMeAsUidListener"); -} - - -} -//------------------------------------------------------------------------ -void BibDataManager::RemoveMeAsUidListener() -{ -try -{ - Reference< XNameAccess > xFields = getColumns( m_xForm ); - if (!xFields.is()) - return; - - - Sequence< ::rtl::OUString > aFields(xFields->getElementNames()); - const ::rtl::OUString* pFields = aFields.getConstArray(); - sal_Int32 nCount=aFields.getLength(); - String StrUID(C2S(STR_UID)); - ::rtl::OUString theFieldName; - for( sal_Int32 i=0; i0) - { - Reference< XPropertySet > xPropSet; - Any aElement; - - aElement = xFields->getByName(theFieldName); - xPropSet = *(Reference< XPropertySet > *)aElement.getValue(); - - xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this); - } - -} -catch(Exception& e ) -{ - (void) e; // make compiler happy - OSL_FAIL("Exception in BibDataManager::RemoveMeAsUidListener"); -} - - -} - -void BibDataManager::CreateMappingDialog(Window* pParent) -{ - MappingDialog_Impl* pDlg = new MappingDialog_Impl(pParent, this); - if(RET_OK == pDlg->Execute() && pBibView) - { - reload(); - } - delete pDlg; -} - -::rtl::OUString BibDataManager::CreateDBChangeDialog(Window* pParent) -{ - ::rtl::OUString uRet; - DBChangeDialog_Impl * pDlg = new DBChangeDialog_Impl(pParent, this ); - if(RET_OK == pDlg->Execute()) - { - String sNewURL = pDlg->GetCurrentURL(); - if(sNewURL != String(getActiveDataSource())) - { - uRet = sNewURL; - } - } - delete pDlg; - return uRet; -} - -void BibDataManager::DispatchDBChangeDialog() -{ - if(pToolbar) - pToolbar->SendDispatch(TBC_BT_CHANGESOURCE, Sequence< PropertyValue >()); -} - -const ::rtl::OUString& BibDataManager::GetIdentifierMapping() -{ - if(!sIdentifierMapping.getLength()) - { - BibConfig* pConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = getActiveDataSource(); - aDesc.sTableOrQuery = getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pConfig->GetMapping(aDesc); - sIdentifierMapping = pConfig->GetDefColumnName(IDENTIFIER_POS); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping) - { - sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - } - return sIdentifierMapping; -} - -void BibDataManager::SetToolbar(BibToolBar* pSet) -{ - pToolbar = pSet; - if(pToolbar) - pToolbar->SetDatMan(*this); -} - -uno::Reference< form::runtime::XFormController > BibDataManager::GetFormController() -{ - if(!m_xFormCtrl.is()) - { - Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - m_xFormCtrl = uno::Reference< form::runtime::XFormController > ( - xMgr->createInstance(C2U("com.sun.star.form.runtime.FormController")), UNO_QUERY); - m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY)); - m_xFormDispatch = uno::Reference< frame::XDispatch > ( m_xFormCtrl, UNO_QUERY); - } - return m_xFormCtrl; -} - -void BibDataManager::RegisterInterceptor( ::bib::BibBeamer* pBibBeamer) -{ - DBG_ASSERT( !m_pInterceptorHelper, "BibDataManager::RegisterInterceptor: called twice!" ); - - if( pBibBeamer ) - m_pInterceptorHelper = new BibInterceptorHelper( pBibBeamer, m_xFormDispatch); - if( m_pInterceptorHelper ) - m_pInterceptorHelper->acquire(); -} - - -sal_Bool BibDataManager::HasActiveConnection()const -{ - sal_Bool bRet = sal_False; - Reference< XPropertySet > xPrSet( m_xForm, UNO_QUERY ); - if( xPrSet.is() ) - { - Reference< XComponent > xConnection; - xPrSet->getPropertyValue(C2U("ActiveConnection")) >>= xConnection; - bRet = xConnection.is(); - } - return bRet; -} - -sal_Bool BibDataManager::HasActiveConnection() -{ - return getConnection( m_xForm ).is(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.hrc b/extensions/source/bibliography/datman.hrc deleted file mode 100644 index 5ea4749ee..000000000 --- a/extensions/source/bibliography/datman.hrc +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#define BT_OK 1 -#define BT_CANCEL 2 -#define BT_HELP 3 -#define GB_MAPPING 4 -#define FT_IDENTIFIER 5 -#define LB_IDENTIFIER 6 -#define ST_NONE 7 - -#define FT_AUTHORITYTYPE 8 -#define LB_AUTHORITYTYPE 9 -#define FT_ADDRESS 10 -#define LB_ADDRESS 11 -#define FT_ANNOTE 12 -#define LB_ANNOTE 13 -#define FT_AUTHOR 14 -#define LB_AUTHOR 15 -#define FT_TITLE 16 -#define LB_TITLE 17 -#define FT_MONTH 18 -#define LB_MONTH 19 -#define FT_YEAR 20 -#define LB_YEAR 21 -#define FT_ISBN 22 -#define LB_ISBN 23 -#define FT_BOOKTITLE 24 -#define LB_BOOKTITLE 25 -#define FT_CHAPTER 26 -#define LB_CHAPTER 27 -#define FT_EDITION 28 -#define LB_EDITION 29 -#define FT_EDITOR 30 -#define LB_EDITOR 31 -#define FT_HOWPUBLISHED 32 -#define LB_HOWPUBLISHED 33 -#define FT_INSTITUTION 34 -#define LB_INSTITUTION 35 -#define FT_JOURNAL 36 -#define LB_JOURNAL 37 -#define FT_NOTE 38 -#define LB_NOTE 39 -#define FT_NUMBER 40 -#define LB_NUMBER 41 -#define FT_ORGANIZATIONS 42 -#define LB_ORGANIZATIONS 43 -#define FT_PAGES 44 -#define LB_PAGES 45 -#define FT_PUBLISHER 46 -#define LB_PUBLISHER 47 -#define FT_SCHOOL 48 -#define LB_SCHOOL 49 -#define FT_SERIES 50 -#define LB_SERIES 51 -#define FT_REPORTTYPE 52 -#define LB_REPORTTYPE 53 -#define FT_VOLUME 54 -#define LB_VOLUME 55 -#define FT_URL 56 -#define LB_URL 57 -#define FT_CUSTOM1 58 -#define LB_CUSTOM1 59 -#define FT_CUSTOM2 60 -#define LB_CUSTOM2 61 -#define FT_CUSTOM3 62 -#define LB_CUSTOM3 63 -#define FT_CUSTOM4 64 -#define LB_CUSTOM4 65 -#define FT_CUSTOM5 66 -#define LB_CUSTOM5 67 - -#define GB_SELECTION 68 -#define ST_ENTRY 69 -#define LB_SELECTION 71 -#define HB_SELECTION 72 - diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx deleted file mode 100644 index 4f485641e..000000000 --- a/extensions/source/bibliography/datman.hxx +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_DATMAN_HXX -#define _BIB_DATMAN_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -// #100312# -------------------- -#include -#include -#include - -class Window; - -//----------------------------------------------------------------------------- -namespace bib -{ - class BibView; - // #100312# ----------- - class BibBeamer; -} - -class BibToolBar; -struct BibDBDescriptor; - -// #100312# --------------------- -class BibInterceptorHelper - :public cppu::WeakImplHelper1< ::com::sun::star::frame::XDispatchProviderInterceptor > -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xMasterDispatchProvider; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xSlaveDispatchProvider; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xFormDispatch; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > xInterception; - -protected: - ~BibInterceptorHelper( ); - -public: - BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch); - - void ReleaseInterceptor(); - - // XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException); - // XDispatchProviderInterceptor - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); -}; - -typedef cppu::WeakComponentImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener - , ::com::sun::star::form::XLoadable - > BibDataManager_Base; -class BibDataManager - :public ::comphelper::OMutexAndBroadcastHelper - ,public BibDataManager_Base -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xForm; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > m_xGridModel; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSourceProps; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > m_xParser; - ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xFormCtrl; - // #100312# ------------------- - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFormDispatch; - BibInterceptorHelper* m_pInterceptorHelper; - - ::rtl::OUString aActiveDataTable; - ::rtl::OUString aDataSourceURL; - ::rtl::OUString aQuoteChar; - ::com::sun::star::uno::Any aUID; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor; - - ::cppu::OInterfaceContainerHelper m_aLoadListeners; - - ::bib::BibView* pBibView; - BibToolBar* pToolbar; - - rtl::OUString sIdentifierMapping; -protected: - - void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid); - void SetMeAsUidListener(); - void RemoveMeAsUidListener(); - - void UpdateAddressbookCursor(::rtl::OUString aSourceName); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - updateGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - createGridModel( const ::rtl::OUString& rName ); - - // XLoadable - virtual void SAL_CALL load( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unload( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reload( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLoaded( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeLoadListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL disposing(); - -public: - - BibDataManager(); - ~BibDataManager(); - - virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) - throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) - throw( ::com::sun::star::uno::RuntimeException ); - - - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm( BibDBDescriptor& aDesc); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > updateGridModel(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString> getDataSources(); - - ::rtl::OUString getActiveDataSource() {return aDataSourceURL;} - void setActiveDataSource(const ::rtl::OUString& rURL); - - ::rtl::OUString getActiveDataTable(); - void setActiveDataTable(const ::rtl::OUString& rTable); - - void setFilter(const ::rtl::OUString& rQuery); - ::rtl::OUString getFilter(); - - ::com::sun::star::uno::Sequence< ::rtl::OUString> getQueryFields(); - ::rtl::OUString getQueryField(); - void startQueryWith(const ::rtl::OUString& rQuery); - - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& getParser() { return m_xParser; } - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& getForm() { return m_xForm; } - - - ::rtl::OUString getControlName(sal_Int32 nFormatKey ); - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const ::rtl::OUString& rName, - sal_Bool bForceListBox = sal_False); - - void CreateMappingDialog(Window* pParent); - ::rtl::OUString CreateDBChangeDialog(Window* pParent); - - void DispatchDBChangeDialog(); - sal_Bool HasActiveConnection() const; - - void SetView( ::bib::BibView* pView ) { pBibView = pView; } - - void SetToolbar(BibToolBar* pSet); - - const rtl::OUString& GetIdentifierMapping(); - void ResetIdentifierMapping() {sIdentifierMapping = rtl::OUString();} - - ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(); - // #100312# ---------- - void RegisterInterceptor( ::bib::BibBeamer* pBibBeamer); - - sal_Bool HasActiveConnection(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/datman.src b/extensions/source/bibliography/datman.src deleted file mode 100644 index 639e6640d..000000000 --- a/extensions/source/bibliography/datman.src +++ /dev/null @@ -1,500 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" -#include "datman.hrc" -ModalDialog RID_DLG_MAPPING -{ - HelpID = HID_DLG_MAPPING; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 391 , 195 ) ; - Moveable = TRUE ; - - OKButton BT_OK - { - Pos = MAP_APPFONT ( 338 , 3 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 338 , 18 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 338 , 36 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - FixedLine GB_MAPPING - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 329 , 8 ) ; - Text [ en-US ] = "Column names"; - }; - FixedText FT_IDENTIFIER - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_IDENTIFIER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_IDENTIFIER"; - Pos = MAP_APPFONT ( 65 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_AUTHORITYTYPE - { - Pos = MAP_APPFONT ( 118 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_AUTHORITYTYPE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_AUTHORITYTYPE"; - Pos = MAP_APPFONT ( 171 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_YEAR - { - Pos = MAP_APPFONT ( 229 , 14 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_YEAR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_YEAR"; - Pos = MAP_APPFONT ( 282 , 13 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT ( 12 , 29 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_AUTHOR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_AUTHOR"; - Pos = MAP_APPFONT ( 65 , 28 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_TITLE - { - Pos = MAP_APPFONT ( 118 , 29 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_TITLE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_TITLE"; - Pos = MAP_APPFONT ( 171 , 28 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_PUBLISHER - { - Pos = MAP_APPFONT ( 12 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_PUBLISHER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_PUBLISHER"; - Pos = MAP_APPFONT ( 65 , 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ADDRESS - { - Pos = MAP_APPFONT ( 118 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ADDRESS - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ADDRESS"; - Pos = MAP_APPFONT ( 171, 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ISBN - { - Pos = MAP_APPFONT ( 229 , 44 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ISBN - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ISBN"; - Pos = MAP_APPFONT ( 282 , 43 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CHAPTER - { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CHAPTER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CHAPTER"; - Pos = MAP_APPFONT ( 65 , 58 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_PAGES - { - Pos = MAP_APPFONT ( 118 , 59 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_PAGES - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_PAGES"; - Pos = MAP_APPFONT ( 171, 58) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_EDITOR - { - Pos = MAP_APPFONT ( 12 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_EDITOR - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_EDITOR"; - Pos = MAP_APPFONT ( 65 , 73 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_EDITION - { - Pos = MAP_APPFONT ( 118 , 74 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_EDITION - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_EDITION"; - Pos = MAP_APPFONT ( 171 , 73 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_BOOKTITLE - { - Pos = MAP_APPFONT ( 12, 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_BOOKTITLE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_BOOKTITLE"; - Pos = MAP_APPFONT ( 65, 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_VOLUME - { - Pos = MAP_APPFONT ( 118 , 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_VOLUME - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_VOLUME"; - Pos = MAP_APPFONT ( 171 , 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_HOWPUBLISHED - { - Pos = MAP_APPFONT ( 229 , 89 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_HOWPUBLISHED - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_HOWPUBLISHED"; - Pos = MAP_APPFONT ( 282, 88 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ORGANIZATIONS - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ORGANIZATIONS - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ORGANIZATIONS"; - Pos = MAP_APPFONT ( 65 , 103 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_INSTITUTION - { - Pos = MAP_APPFONT ( 118 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_INSTITUTION - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_INSTITUTION"; - Pos = MAP_APPFONT ( 171 , 103) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_SCHOOL - { - Pos = MAP_APPFONT ( 229 , 104 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_SCHOOL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_SCHOOL"; - Pos = MAP_APPFONT ( 282 , 103 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_REPORTTYPE - { - Pos = MAP_APPFONT ( 12 , 119 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_REPORTTYPE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_REPORTTYPE"; - Pos = MAP_APPFONT ( 65 , 118 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_MONTH - { - Pos = MAP_APPFONT ( 118 , 119 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_MONTH - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_MONTH"; - Pos = MAP_APPFONT ( 171 , 118) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_JOURNAL - { - Pos = MAP_APPFONT ( 12 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_JOURNAL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_JOURNAL"; - Pos = MAP_APPFONT ( 65 , 133) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_NUMBER - { - Pos = MAP_APPFONT ( 118 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_NUMBER - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_NUMBER"; - Pos = MAP_APPFONT ( 171 , 133 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_SERIES - { - Pos = MAP_APPFONT ( 229 , 134 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_SERIES - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_SERIES"; - Pos = MAP_APPFONT ( 282 , 133 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_ANNOTE - { - Pos = MAP_APPFONT ( 12 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_ANNOTE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_ANNOTE"; - Pos = MAP_APPFONT ( 65 , 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_NOTE - { - Pos = MAP_APPFONT ( 118 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_NOTE - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_NOTE"; - Pos = MAP_APPFONT ( 171 , 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT ( 229 , 149 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_URL - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_URL"; - Pos = MAP_APPFONT ( 282, 148 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM1 - { - Pos = MAP_APPFONT ( 12 , 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM1 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM1"; - Pos = MAP_APPFONT ( 65 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM2 - { - Pos = MAP_APPFONT ( 118 , 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM2 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM2"; - Pos = MAP_APPFONT ( 171 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM3 - { - Pos = MAP_APPFONT ( 229, 164 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM3 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM3"; - Pos = MAP_APPFONT ( 282 , 163 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM4 - { - Pos = MAP_APPFONT ( 12 , 178 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM4 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM4"; - Pos = MAP_APPFONT ( 65 , 177 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - FixedText FT_CUSTOM5 - { - Pos = MAP_APPFONT ( 118 , 178 ) ; - Size = MAP_APPFONT ( 50 , 10 ) ; - }; - ListBox LB_CUSTOM5 - { - HelpID = "extensions:ListBox:RID_DLG_MAPPING:LB_CUSTOM5"; - Pos = MAP_APPFONT ( 171 , 177 ) ; - Size = MAP_APPFONT ( 50 , 60 ) ; - DropDown = TRUE; - }; - String ST_NONE - { - Text [ en-US ] = ""; - }; - Text [ en-US ] = "Column Layout for Table %1"; -}; -ModalDialog RID_DLG_DBCHANGE -{ - HelpID = HID_DLG_DBCHANGE; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 291 , 131 ) ; - Moveable = TRUE ; - Text [ en-US ] = "Choose Data Source"; - OKButton BT_OK - { - Pos = MAP_APPFONT ( 238 , 3 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 238 , 18 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT ( 238 , 36 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - }; - FixedLine GB_SELECTION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 229 , 8 ) ; - }; - String ST_ENTRY - { - Text [ en-US ] = "Entry"; - }; - Control LB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 24 ) ; - Size = MAP_APPFONT ( 223 , 100 ) ; - Border = TRUE; - TabStop = TRUE; - HelpId = HID_SELECTION_TLB; - }; - Window HB_SELECTION - { - Pos = MAP_APPFONT ( 9 , 12 ) ; - Size = MAP_APPFONT ( 223 , 12 ) ; - Border = TRUE; - }; -}; - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx deleted file mode 100644 index c41007186..000000000 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "formcontrolcontainer.hxx" -#include - -#include -#include - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::awt; - - //===================================================================== - //= FormControlContainer - //===================================================================== - //--------------------------------------------------------------------- - FormControlContainer::FormControlContainer( ) - :OLoadListener( m_aMutex ) - ,m_pFormAdapter( NULL ) - { - } - - FormControlContainer::~FormControlContainer( ) - { - DBG_ASSERT( !isFormConnected(), "FormControlContainer::~FormControlContainer: you should disconnect in your derived class!" ); - if ( isFormConnected() ) - disconnectForm(); - } - - void FormControlContainer::disconnectForm() - { - ::osl::MutexGuard aGuard( m_aMutex ); - DBG_ASSERT( isFormConnected(), "FormControlContainer::connectForm: not connected!" ); - if ( isFormConnected() ) - { - m_pFormAdapter->dispose(); - m_pFormAdapter->release(); - m_pFormAdapter = NULL; - } - } - - void FormControlContainer::connectForm( const Reference< XLoadable >& _rxForm ) - { - DBG_ASSERT( !isFormConnected(), "FormControlContainer::connectForm: already connected!" ); - - DBG_ASSERT( _rxForm.is(), "FormControlContainer::connectForm: invalid form!" ); - if ( !isFormConnected() && _rxForm.is() ) - { - m_pFormAdapter = new OLoadListenerAdapter( _rxForm ); - m_pFormAdapter->acquire(); - m_pFormAdapter->Init( this ); - - ensureDesignMode(); - } - - m_xForm = _rxForm; - } - - struct ControlModeSwitch : public ::std::unary_function< Reference< XControl >, void > - { - sal_Bool bDesign; - ControlModeSwitch( sal_Bool _bDesign ) : bDesign( _bDesign ) { } - - void operator() ( const Reference< XControl >& _rxControl ) const - { - if ( _rxControl.is() ) - _rxControl->setDesignMode( bDesign ); - } - }; - - void FormControlContainer::implSetDesignMode( sal_Bool _bDesign ) - { - try - { - Reference< XControlContainer > xControlCont = getControlContainer(); - Sequence< Reference< XControl > > aControls; - if ( xControlCont.is() ) - aControls = xControlCont->getControls(); - - ::std::for_each( - aControls.getConstArray(), - aControls.getConstArray() + aControls.getLength(), - ControlModeSwitch( _bDesign ) - ); - } - catch( const Exception& e) - { - (void) e; // make compiler happy - OSL_FAIL( "FormControlContainer::implSetDesignMode: caught an exception!" ); - } - } - - void FormControlContainer::ensureDesignMode() - { - implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() ); - } - - void FormControlContainer::_loaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_False ); - } - - void FormControlContainer::_unloading( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_True ); - } - - void FormControlContainer::_unloaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - } - - void FormControlContainer::_reloading( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_True ); - } - - void FormControlContainer::_reloaded( const ::com::sun::star::lang::EventObject& /*_rEvent*/ ) - { - implSetDesignMode( sal_False ); - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/formcontrolcontainer.hxx b/extensions/source/bibliography/formcontrolcontainer.hxx deleted file mode 100644 index a1e72b11a..000000000 --- a/extensions/source/bibliography/formcontrolcontainer.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX -#define EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX - -#include -#include "loadlisteneradapter.hxx" -#include - -class BibDataManager; - -//......................................................................... -namespace bib -{ -//......................................................................... - - //===================================================================== - //= FormControlContainer - //===================================================================== - class FormControlContainer - :public ::comphelper::OBaseMutex - ,public ::bib::OLoadListener - { - private: - OLoadListenerAdapter* m_pFormAdapter; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > - m_xForm; - private: - void implSetDesignMode( sal_Bool _bDesign ); - - protected: - FormControlContainer( ); - ~FormControlContainer( ); - - sal_Bool isFormConnected() const { return NULL != m_pFormAdapter; } - void connectForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxForm ); - void disconnectForm(); - - void ensureDesignMode(); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - getControlContainer() = 0; - - protected: - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _unloading( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _unloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloading( const ::com::sun::star::lang::EventObject& _rEvent ); - virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent ); - - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif // EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx deleted file mode 100644 index 7c5c435c2..000000000 --- a/extensions/source/bibliography/framectr.cxx +++ /dev/null @@ -1,974 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include "framectr.hxx" -#include "datman.hxx" -#include "bibresid.hxx" -#include "bib.hrc" -#include -#include "bibconfig.hxx" -#include // helper for implementations -#include -#include "bibliography.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace osl; -using namespace cppu; -using namespace com::sun::star::sdbc; -using namespace com::sun::star::frame; -using namespace com::sun::star::uno; -using namespace com::sun::star; - -using ::rtl::OUString; - -#define C2U(cChar) OUString::createFromAscii(cChar) - -struct DispatchInfo -{ - const char* pCommand; - sal_Int16 nGroupId; - sal_Bool bActiveConnection; -}; - -struct CacheDispatchInfo -{ - sal_Int16 nGroupId; - sal_Bool bActiveConnection; -}; - -// Attention: commands must be sorted by command groups. Implementation is dependent -// on this!! -static DispatchInfo SupportedCommandsArray[] = -{ - { ".uno:Undo" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Cut" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Copy" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:Paste" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:SelectAll" , frame::CommandGroup::EDIT , sal_False }, - { ".uno:CloseDoc" , frame::CommandGroup::DOCUMENT , sal_False }, - { ".uno:StatusBarVisible" , frame::CommandGroup::VIEW , sal_False }, - { ".uno:AvailableToolbars" , frame::CommandGroup::VIEW , sal_False }, - { ".uno:Bib/standardFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/DeleteRecord" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/InsertRecord" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/query" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/autoFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/source" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/removeFilter" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/sdbsource" , frame::CommandGroup::DATA , sal_True }, - { ".uno:Bib/Mapping" , frame::CommandGroup::DATA , sal_True }, - { 0 , 0 , sal_False } -}; - -typedef ::boost::unordered_map< ::rtl::OUString, CacheDispatchInfo, rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > CmdToInfoCache; - -SV_IMPL_PTRARR( BibStatusDispatchArr, BibStatusDispatchPtr ); - -const CmdToInfoCache& GetCommandToInfoCache() -{ - static sal_Bool bCacheInitialized = sal_False; - static CmdToInfoCache aCmdToInfoCache; - - if ( !bCacheInitialized ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !bCacheInitialized ) - { - sal_Int32 i( 0 ); - while ( SupportedCommandsArray[i].pCommand != 0 ) - { - rtl::OUString aCommand( rtl::OUString::createFromAscii( SupportedCommandsArray[i].pCommand )); - - CacheDispatchInfo aDispatchInfo; - aDispatchInfo.nGroupId = SupportedCommandsArray[i].nGroupId; - aDispatchInfo.bActiveConnection = SupportedCommandsArray[i].bActiveConnection; - aCmdToInfoCache.insert( CmdToInfoCache::value_type( aCommand, aDispatchInfo )); - ++i; - } - bCacheInitialized = sal_True; - } - } - - return aCmdToInfoCache; -} - - -class BibFrameCtrl_Impl : public cppu::WeakImplHelper1 < XFrameActionListener > -{ -public: - Mutex aMutex; - OMultiTypeInterfaceContainerHelper aLC; - - BibFrameController_Impl* pController; - - BibFrameCtrl_Impl() - : aLC( aMutex ) - , pController(0) - {} - - ~BibFrameCtrl_Impl(); - - virtual void SAL_CALL frameAction(const FrameActionEvent& aEvent) throw( RuntimeException ); - virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -}; - - -BibFrameCtrl_Impl::~BibFrameCtrl_Impl() -{ -} - -void BibFrameCtrl_Impl::frameAction(const FrameActionEvent& aEvent) throw( uno::RuntimeException ) -{ - if ( pController && aEvent.Frame == pController->getFrame()) - { - if(aEvent.Action == FrameAction_FRAME_ACTIVATED) - { - pController->activate(); - } - else if(aEvent.Action == FrameAction_FRAME_DEACTIVATING) - { - pController->deactivate(); - } - } -} - -void BibFrameCtrl_Impl::disposing( const lang::EventObject& /*Source*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::SolarMutexGuard aGuard; - if ( pController ) - pController->getFrame()->removeFrameActionListener( this ); -} - -BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent, - BibDataManager* pDataManager) - :xWindow( xComponent ) - ,m_xDatMan( pDataManager ) - ,pDatMan( pDataManager ) - ,pBibMod(NULL) -{ - Window* pParent = VCLUnoHelper::GetWindow( xWindow ); - pParent->SetUniqueId(UID_BIB_FRAME_WINDOW); - bDisposing=sal_False; - bHierarchical=sal_True; - pImp = new BibFrameCtrl_Impl; - pImp->pController = this; - pImp->acquire(); -} - -BibFrameController_Impl::~BibFrameController_Impl() -{ - pImp->pController = NULL; - pImp->release(); - delete pDatMan; - if(pBibMod) - CloseBibModul(pBibMod); -} - -::rtl::OUString SAL_CALL BibFrameController_Impl::getImplementationName() throw (::com::sun::star::uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.Bibliography")); -} - -sal_Bool SAL_CALL BibFrameController_Impl::supportsService( const ::rtl::OUString& sServiceName ) throw (::com::sun::star::uno::RuntimeException) -{ - return ( - sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.Bibliography")) || - sServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.frame.Controller")) - ); -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL BibFrameController_Impl::getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException) -{ - // return only top level services ... - // base services are included there and should be asked by uno-rtti. - ::com::sun::star::uno::Sequence< ::rtl::OUString > lNames(1); - lNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Bibliography")); - return lNames; -} - -void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg ) throw (::com::sun::star::uno::RuntimeException) -{ - xFrame = xArg; - xFrame->addFrameActionListener( pImp ); -} - -sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & /*xModel*/ ) throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( bSuspend ) - getFrame()->removeFrameActionListener( pImp ); - else - getFrame()->addFrameActionListener( pImp ); - return sal_True; -} - -uno::Any BibFrameController_Impl::getViewData() throw (::com::sun::star::uno::RuntimeException) -{ - return uno::Any(); -} - -void BibFrameController_Impl::restoreViewData( const uno::Any& /*Value*/ ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -uno::Reference< XFrame > BibFrameController_Impl::getFrame() throw (::com::sun::star::uno::RuntimeException) -{ - return xFrame; -} - -uno::Reference< XModel > BibFrameController_Impl::getModel() throw (::com::sun::star::uno::RuntimeException) -{ - return uno::Reference< XModel > (); -} - -void BibFrameController_Impl::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - bDisposing = sal_True; - lang::EventObject aObject; - aObject.Source = (XController*)this; - pImp->aLC.disposeAndClear(aObject); - m_xDatMan = 0; - pDatMan = 0; - aStatusListeners.DeleteAndDestroy( 0, aStatusListeners.Count() ); - } - -void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException) -{ - pImp->aLC.addInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener ); -} - -void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException) -{ - pImp->aLC.removeInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener ); -} - -uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const rtl::OUString& /*aTarget*/, sal_Int32 /*nSearchFlags*/ ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !bDisposing ) - { - const CmdToInfoCache& rCmdCache = GetCommandToInfoCache(); - CmdToInfoCache::const_iterator pIter = rCmdCache.find( aURL.Complete ); - if ( pIter != rCmdCache.end() ) - { - if (( pDatMan->HasActiveConnection() ) || - ( !pIter->second.bActiveConnection )) - return (frame::XDispatch*) this; - } - } - - return uno::Reference< frame::XDispatch > (); -} - -uno::Sequence > BibFrameController_Impl::queryDispatches( const uno::Sequence& aDescripts ) throw (::com::sun::star::uno::RuntimeException) -{ - uno::Sequence< uno::Reference< XDispatch > > aDispatches( aDescripts.getLength() ); - for ( sal_Int32 i=0; i SAL_CALL BibFrameController_Impl::getSupportedCommandGroups() -throw (::com::sun::star::uno::RuntimeException) -{ - uno::Sequence< ::sal_Int16 > aDispatchInfo( 4 ); - - aDispatchInfo[0] = frame::CommandGroup::EDIT; - aDispatchInfo[1] = frame::CommandGroup::DOCUMENT; - aDispatchInfo[2] = frame::CommandGroup::DATA; - aDispatchInfo[3] = frame::CommandGroup::VIEW; - - return aDispatchInfo; -} - -uno::Sequence< frame::DispatchInformation > SAL_CALL BibFrameController_Impl::getConfigurableDispatchInformation( ::sal_Int16 nCommandGroup ) -throw (::com::sun::star::uno::RuntimeException) -{ - const CmdToInfoCache& rCmdCache = GetCommandToInfoCache(); - - sal_Bool bGroupFound( sal_False ); - frame::DispatchInformation aDispatchInfo; - std::list< frame::DispatchInformation > aDispatchInfoList; - - if (( nCommandGroup == frame::CommandGroup::EDIT ) || - ( nCommandGroup == frame::CommandGroup::DOCUMENT ) || - ( nCommandGroup == frame::CommandGroup::DATA ) || - ( nCommandGroup == frame::CommandGroup::VIEW )) - { - CmdToInfoCache::const_iterator pIter = rCmdCache.begin(); - while ( pIter != rCmdCache.end() ) - { - if ( pIter->second.nGroupId == nCommandGroup ) - { - bGroupFound = sal_True; - aDispatchInfo.Command = pIter->first; - aDispatchInfo.GroupId = pIter->second.nGroupId; - aDispatchInfoList.push_back( aDispatchInfo ); - } - else if ( bGroupFound ) - break; - - ++pIter; - } - } - - ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq = - comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aDispatchInfoList ); - - return aSeq; -} - -sal_Bool canInsertRecords(const Reference< beans::XPropertySet>& _rxCursorSet) -{ - sal_Int32 nPriv = 0; - _rxCursorSet->getPropertyValue(C2U("Privileges")) >>= nPriv; - return ((_rxCursorSet.is() && (nPriv & sdbcx::Privilege::INSERT) != 0)); -} - -sal_Bool BibFrameController_Impl::SaveModified(const Reference< form::runtime::XFormController>& xController) -{ - if (!xController.is()) - return sal_False; - - Reference< XResultSetUpdate> _xCursor = Reference< XResultSetUpdate>(xController->getModel(), UNO_QUERY); - - if (!_xCursor.is()) - return sal_False; - - Reference< beans::XPropertySet> _xSet = Reference< beans::XPropertySet>(_xCursor, UNO_QUERY); - if (!_xSet.is()) - return sal_False; - - // need to save? - sal_Bool bIsNew = ::comphelper::getBOOL(_xSet->getPropertyValue(C2U("IsNew"))); - sal_Bool bIsModified = ::comphelper::getBOOL(_xSet->getPropertyValue(C2U("IsModified"))); - sal_Bool bResult = !bIsModified; - if (bIsModified) - { - try - { - if (bIsNew) - _xCursor->insertRow(); - else - _xCursor->updateRow(); - bResult = sal_True; - } - catch(Exception&) - { - OSL_FAIL("SaveModified: Exception occurred!"); - } - } - return bResult; -} - -Window* lcl_GetFocusChild( Window* pParent ) -{ - sal_uInt16 nChildren = pParent->GetChildCount(); - for( sal_uInt16 nChild = 0; nChild < nChildren; ++nChild) - { - Window* pChild = pParent->GetChild( nChild ); - if(pChild->HasFocus()) - return pChild; - Window* pSubChild = lcl_GetFocusChild( pChild ); - if(pSubChild) - return pSubChild; - } - return 0; -} - -//class XDispatch -void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequence< beans::PropertyValue >& aArgs) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !bDisposing ) - { - ::SolarMutexGuard aGuard; - Window* pParent = VCLUnoHelper::GetWindow( xWindow ); - WaitObject aWaitObject( pParent ); - - String aCommand( _rURL.Path); - if(aCommand.EqualsAscii("Bib/Mapping")) - { - pDatMan->CreateMappingDialog(pParent); - } - else if(aCommand.EqualsAscii("Bib/source")) - { - ChangeDataSource(aArgs); - } - else if(aCommand.EqualsAscii("Bib/sdbsource")) - { - rtl::OUString aURL = pDatMan->CreateDBChangeDialog(pParent); - if(aURL.getLength()) - { - try - { - uno::Sequence< beans::PropertyValue > aNewDataSource(2); - beans::PropertyValue* pProps = aNewDataSource.getArray(); - pProps[0].Value <<= rtl::OUString(); - pProps[1].Value <<= aURL; - ChangeDataSource(aNewDataSource); - } - catch(const Exception&) - { - OSL_FAIL("Exception catched while changing the data source"); - } - } - } - else if(aCommand.EqualsAscii("Bib/autoFilter")) - { - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; naURL.Path == C2U("Bib/removeFilter") ) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - //break; because there are more than one - } - } - - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; - rtl::OUString aQuery; - aValue >>= aQuery; - - aValue=pPropertyValue[1].Value; - rtl::OUString aQueryField; - aValue >>= aQueryField; - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(aQueryField); - pDatMan->startQueryWith(aQuery); - } - else if(aCommand.EqualsAscii("Bib/standardFilter")) - { - try - { - uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); - - // build the arguments for the filter dialog to be created - Sequence< Any > aDialogCreationArgs( 3 ); - Any* pDialogCreationArgs = aDialogCreationArgs.getArray(); - // the query composer - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" )), - -1, - makeAny( pDatMan->getParser() ), - beans::PropertyState_DIRECT_VALUE - ); - - // the rowset - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowSet" )), - -1, - makeAny( pDatMan->getForm() ), - beans::PropertyState_DIRECT_VALUE - ); - // the parent window for the dialog - *pDialogCreationArgs++ <<= beans::PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )), - -1, - makeAny( xWindow ), - beans::PropertyState_DIRECT_VALUE - ); - - // create the dialog object - const ::rtl::OUString sDialogServiceName(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" )); - uno::Reference< uno::XInterface > xDialog = xORB->createInstanceWithArguments( - sDialogServiceName, - aDialogCreationArgs - ); - if ( !xDialog.is() ) - { - ShowServiceNotAvailableError( VCLUnoHelper::GetWindow( xWindow ), sDialogServiceName, sal_True ); - } - else - { - // execute it - uno::Reference< ui::dialogs::XExecutableDialog > xExec( xDialog, UNO_QUERY ); - DBG_ASSERT( xExec.is(), "BibFrameController_Impl::dispatch: missing an interface on the dialog!" ); - if ( xExec.is() ) - if ( xExec->execute( ) ) - { - // the dialog has been executed successfully, and the filter on the query composer - // has been changed - ::rtl::OUString sNewFilter = pDatMan->getParser()->getFilter(); - pDatMan->setFilter( sNewFilter ); - } - } - } - catch( const uno::Exception& ) - { - OSL_FAIL( "BibFrameController_Impl::dispatch: caught an exception!" ); - } - - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; naURL.Path == C2U("Bib/removeFilter") && pDatMan->getParser().is()) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = 0 != pDatMan->getParser()->getFilter().getLength(); - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - } - } - } - else if(aCommand.EqualsAscii("Bib/removeFilter")) - { - RemoveFilter(); - } - else if(_rURL.Complete.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("slot:5503")) || - aCommand.EqualsAscii("CloseDoc")) - { - Application::PostUserEvent( STATIC_LINK( this, BibFrameController_Impl, - DisposeHdl ), 0 ); - - } - else if(aCommand.EqualsAscii("Bib/InsertRecord")) - { - Reference xFormCtrl = pDatMan->GetFormController(); - if(SaveModified(xFormCtrl)) - { - try - { - Reference< sdbc::XResultSet > xCursor( pDatMan->getForm(), UNO_QUERY ); - xCursor->last(); - - Reference< XResultSetUpdate > xUpdateCursor( pDatMan->getForm(), UNO_QUERY ); - xUpdateCursor->moveToInsertRow(); - } - catch(Exception&) - { - OSL_FAIL("Exception in last() or moveToInsertRow()"); - } - } - } - else if(aCommand.EqualsAscii("Bib/DeleteRecord")) - { - Reference< ::com::sun::star::sdbc::XResultSet > xCursor(pDatMan->getForm(), UNO_QUERY); - Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY); - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - sal_Bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(C2U("IsNew"))); - if(!bIsNew) - { - sal_uInt32 nCount = 0; - xSet->getPropertyValue(C2U("RowCount")) >>= nCount; - // naechste position festellen - sal_Bool bSuccess = sal_False; - sal_Bool bLeft = sal_False; - sal_Bool bRight = sal_False; - try - { - bLeft = xCursor->isLast() && nCount > 1; - bRight= !xCursor->isLast(); - // ask for confirmation - Reference< frame::XController > xCtrl = pImp->pController; - Reference< form::XConfirmDeleteListener > xConfirm(pDatMan->GetFormController(),UNO_QUERY); - if (xConfirm.is()) - { - sdb::RowChangeEvent aEvent; - aEvent.Source = Reference< XInterface > (xCursor, UNO_QUERY); - aEvent.Action = sdb::RowChangeAction::DELETE; - aEvent.Rows = 1; - bSuccess = xConfirm->confirmDelete(aEvent); - } - - // das Ding loeschen - if (bSuccess) - xUpdateCursor->deleteRow(); - } - catch(Exception&) - { - bSuccess = sal_False; - } - if (bSuccess) - { - if (bLeft || bRight) - xCursor->relative(bRight ? 1 : -1); - else - { - sal_Bool bCanInsert = canInsertRecords(xSet); - // kann noch ein Datensatz eingefuegt weden - try - { - if (bCanInsert) - xUpdateCursor->moveToInsertRow(); - else - // Datensatz bewegen um Stati neu zu setzen - xCursor->first(); - } - catch(Exception&) - { - OSL_FAIL("DeleteRecord : exception caught !"); - } - } - } - } - } - else if(aCommand.EqualsAscii("Cut")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_CUT ); - pChild->KeyInput( aEvent ); - } - } - else if(aCommand.EqualsAscii("Copy")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_COPY ); - pChild->KeyInput( aEvent ); - } - } - else if(aCommand.EqualsAscii("Paste")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - KeyEvent aEvent( 0, KEYFUNC_PASTE ); - pChild->KeyInput( aEvent ); - } - } - } -} -IMPL_STATIC_LINK( BibFrameController_Impl, DisposeHdl, void*, EMPTYARG ) -{ - pThis->xFrame->dispose(); - return 0; -}; - -//----------------------------------------------------------------------------- -void BibFrameController_Impl::addStatusListener( - const uno::Reference< frame::XStatusListener > & aListener, - const util::URL& aURL) - throw (::com::sun::star::uno::RuntimeException) -{ - BibConfig* pConfig = BibModul::GetConfig(); - // create a new Reference and insert into listener array - aStatusListeners.Insert( new BibStatusDispatch( aURL, aListener ), aStatusListeners.Count() ); - - // den ersten Status synchron zusenden - FeatureStateEvent aEvent; - aEvent.FeatureURL = aURL; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - if ( aURL.Path == C2U("StatusBarVisible") ) - { - aEvent.IsEnabled = sal_False; - aEvent.State <<= sal_Bool( sal_False ); - } - else if ( aURL.Path == C2U("Bib/hierarchical") ) - { - aEvent.IsEnabled = sal_True; - const char* pHier = bHierarchical? "" : "*" ; - aEvent.State <<= rtl::OUString::createFromAscii(pHier); - } - else if(aURL.Path == C2U("Bib/MenuFilter")) - { - aEvent.IsEnabled = sal_True; - aEvent.FeatureDescriptor=pDatMan->getQueryField(); - - uno::Sequence aStringSeq=pDatMan->getQueryFields(); - aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence*)0)); - - } - else if ( aURL.Path == C2U("Bib/source")) - { - aEvent.IsEnabled = sal_True; - aEvent.FeatureDescriptor=pDatMan->getActiveDataTable(); - - uno::Sequence aStringSeq=pDatMan->getDataSources(); - aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence*)0)); - } - else if(aURL.Path == C2U("Bib/sdbsource") || - aURL.Path == C2U("Bib/Mapping") || - aURL.Path == C2U("Bib/autoFilter") || - aURL.Path.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Bib/standardFilter"))) - { - aEvent.IsEnabled = sal_True; - } - else if(aURL.Path == C2U("Bib/query")) - { - aEvent.IsEnabled = sal_True; - aEvent.State <<= pConfig->getQueryText(); - } - else if (aURL.Path == C2U("Bib/removeFilter") ) - { - rtl::OUString aFilterStr=pDatMan->getFilter(); - aEvent.IsEnabled = (aFilterStr.getLength() > 0); - } - else if(aURL.Path == C2U("Cut")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - Edit* pEdit = dynamic_cast( pChild ); - if( pEdit ) - aEvent.IsEnabled = !pEdit->IsReadOnly() && pEdit->GetSelection().Len(); - } - if(aURL.Path == C2U("Copy")) - { - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - Edit* pEdit = dynamic_cast( pChild ); - if( pEdit ) - aEvent.IsEnabled = pEdit->GetSelection().Len() > 0; - } - else if(aURL.Path == C2U("Paste") ) - { - aEvent.IsEnabled = sal_False; - Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) - { - uno::Reference< datatransfer::clipboard::XClipboard > xClip = pChild->GetClipboard(); - if(xClip.is()) - { - uno::Reference< datatransfer::XTransferable > xDataObj; - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - try - { - xDataObj = xClip->getContents(); - } - catch( const uno::Exception& ) - { - } - Application::AcquireSolarMutex( nRef ); - - if ( xDataObj.is() ) - { - datatransfer::DataFlavor aFlavor; - SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor ); - try - { - uno::Any aData = xDataObj->getTransferData( aFlavor ); - ::rtl::OUString aText; - aData >>= aText; - aEvent.IsEnabled = aText.getLength() > 0; - } - catch( const uno::Exception& ) - { - } - } - } - uno::Reference< datatransfer::XTransferable > xContents = xClip->getContents( ); - } - } - else if(aURL.Path == C2U("Bib/DeleteRecord")) - { - Reference< ::com::sun::star::sdbc::XResultSet > xCursor(pDatMan->getForm(), UNO_QUERY); - Reference< XResultSetUpdate > xUpdateCursor(xCursor, UNO_QUERY); - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - sal_Bool bIsNew = ::comphelper::getBOOL(xSet->getPropertyValue(C2U("IsNew"))); - if(!bIsNew) - { - sal_uInt32 nCount = 0; - xSet->getPropertyValue(C2U("RowCount")) >>= nCount; - aEvent.IsEnabled = nCount > 0; - } - } - else if (aURL.Path == C2U("Bib/InsertRecord")) - { - Reference< beans::XPropertySet > xSet(pDatMan->getForm(), UNO_QUERY); - aEvent.IsEnabled = canInsertRecords(xSet); - } - aListener->statusChanged( aEvent ); -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::removeStatusListener( - const uno::Reference< frame::XStatusListener > & aObject, const util::URL& aURL) - throw (::com::sun::star::uno::RuntimeException) -{ - // search listener array for given listener - // for checking equality always "cast" to XInterface - if ( !bDisposing ) - { - sal_uInt16 nCount = aStatusListeners.Count(); - for ( sal_uInt16 n=0; nxListener.is(); - if (!bFlag || (pObj->xListener == aObject && - ( !aURL.Complete.getLength() || pObj->aURL.Path == aURL.Path ))) - { - aStatusListeners.DeleteAndDestroy( n ); - break; - } - } - } -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::RemoveFilter() -{ - rtl::OUString aQuery; - pDatMan->startQueryWith(aQuery); - - sal_uInt16 nCount = aStatusListeners.Count(); - - sal_Bool bRemoveFilter=sal_False; - sal_Bool bQueryText=sal_False; - - for ( sal_uInt16 n=0; naURL.Path == C2U("Bib/removeFilter") ) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_False; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - pObj->xListener->statusChanged( aEvent ); - bRemoveFilter=sal_True; - } - else if(pObj->aURL.Path == C2U("Bib/query")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - aEvent.State <<= aQuery; - pObj->xListener->statusChanged( aEvent ); - bQueryText=sal_True; - } - - if(bRemoveFilter && bQueryText) - break; - - } -} -//----------------------------------------------------------------------------- -void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs) -{ - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; - rtl::OUString aDBTableName; - aValue >>= aDBTableName; - - - if(aArgs.getLength() > 1) - { - uno::Any aDB = pPropertyValue[1].Value; - rtl::OUString aURL; - aDB >>= aURL; - pDatMan->setActiveDataSource(aURL); - aDBTableName = pDatMan->getActiveDataTable(); - } - else - { - m_xDatMan->unload(); - pDatMan->setActiveDataTable(aDBTableName); - pDatMan->updateGridModel(); - m_xDatMan->load(); - } - - - sal_uInt16 nCount = aStatusListeners.Count(); - - sal_Bool bMenuFilter=sal_False; - sal_Bool bQueryText=sal_False; - for ( sal_uInt16 n=0; naURL.Path.compareToAscii("Bib/MenuFilter")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - aEvent.FeatureDescriptor=pDatMan->getQueryField(); - - uno::Sequence aStringSeq=pDatMan->getQueryFields(); - aEvent.State = makeAny( aStringSeq ); - - pObj->xListener->statusChanged( aEvent ); - bMenuFilter=sal_True; - } - else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/query")) - { - FeatureStateEvent aEvent; - aEvent.FeatureURL = pObj->aURL; - aEvent.IsEnabled = sal_True; - aEvent.Requery = sal_False; - aEvent.Source = (XDispatch *) this; - BibConfig* pConfig = BibModul::GetConfig(); - aEvent.State <<= pConfig->getQueryText(); - pObj->xListener->statusChanged( aEvent ); - bQueryText=sal_True; - } - - if (bMenuFilter && bQueryText) - break; - - } -} - -void BibFrameController_Impl::activate() -{ -} -void BibFrameController_Impl::deactivate() -{ -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx deleted file mode 100644 index 4ef00f967..000000000 --- a/extensions/source/bibliography/framectr.hxx +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_FRAMECTR_HXX -#define _BIB_FRAMECTR_HXX -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bibmod.hxx" -class BibDataManager; -class BibFrameCtrl_Impl; -namespace com{namespace sun{namespace star{ - namespace form { namespace runtime { - class XFormController; - } } -}}} -class BibStatusDispatch -{ -public: - ::com::sun::star::util::URL aURL; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xListener; - BibStatusDispatch( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef ) - : aURL( rURL ) - , xListener( xRef ) - {} -}; - -typedef BibStatusDispatch* BibStatusDispatchPtr; -SV_DECL_PTRARR_DEL( BibStatusDispatchArr, BibStatusDispatchPtr, 4, 4 ) - -class BibFrameController_Impl : public cppu::WeakImplHelper5 < - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::frame::XController, - ::com::sun::star::frame::XDispatch, - ::com::sun::star::frame::XDispatchProvider, - ::com::sun::star::frame::XDispatchInformationProvider -> -{ -friend class BibFrameCtrl_Impl; - BibFrameCtrl_Impl* pImp; - BibStatusDispatchArr aStatusListeners; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; - sal_Bool bDisposing; - sal_Bool bHierarchical; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xDatMan; - BibDataManager* pDatMan; - HdlBibModul pBibMod; - - DECL_STATIC_LINK( BibFrameController_Impl, DisposeHdl, void* ); - - sal_Bool SaveModified(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& xController); -public: - BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent, - BibDataManager* pDatMan); - ~BibFrameController_Impl(); - - - void activate(); - void deactivate(); - - void ChangeDataSource(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs); - void RemoveFilter(); - - // ::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& sServiceName ) 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::frame::XController - virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getViewData() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL restoreViewData( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener ) throw (::com::sun::star::uno::RuntimeException); - virtual 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::frame::XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw (::com::sun::star::uno::RuntimeException); - - //class ::com::sun::star::frame::XDispatch - virtual void SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::frame::XDispatchInformationProvider - virtual ::com::sun::star::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 CommandGroup ) throw (::com::sun::star::uno::RuntimeException); - }; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx deleted file mode 100644 index 9c5910613..000000000 --- a/extensions/source/bibliography/general.cxx +++ /dev/null @@ -1,878 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // helper for implementations -#include "general.hxx" -#include "sections.hrc" -#include "bibresid.hxx" -#include "datman.hxx" -#include "bibconfig.hxx" -#include "bibprop.hrc" -#include "bib.hrc" -#include "bibmod.hxx" -#include "bibtools.hxx" -#include "bibliography.hrc" -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::sdb; -using namespace ::rtl; - -#define C2U(cChar) OUString::createFromAscii(cChar) -#define C2S(cChar) String::CreateFromAscii(cChar) -#define DISTANCE_CONTROL_TO_FIXEDTEXT 5 - -::Point lcl_MovePoint(const FixedText& rFixedText) -{ - ::Point aRet(rFixedText.GetPosPixel()); - aRet.X() += rFixedText.GetSizePixel().Width(); - aRet.X() += DISTANCE_CONTROL_TO_FIXEDTEXT; - return aRet; -} - -//----------------------------------------------------------------------------- -OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos ) -{ - BibConfig* pBibConfig = BibModul::GetConfig(); - OUString sRet = pBibConfig->GetDefColumnName(nIndexPos); - if(pMapping) - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) - { - if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet) - { - sRet = pMapping->aColumnPairs[i].sRealColumnName; - break; - } - } - return sRet; -} - -class BibPosListener :public cppu::WeakImplHelper1 -{ - BibGeneralPage* pParentPage; -public: - BibPosListener(BibGeneralPage* pParent); - - //XPositioningListener - virtual void SAL_CALL cursorMoved(const lang::EventObject& event) throw( uno::RuntimeException ); - virtual void SAL_CALL rowChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ } - virtual void SAL_CALL rowSetChanged(const lang::EventObject& /*event*/) throw( uno::RuntimeException ){ /* not interested in */ } - - //XEventListener - virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( uno::RuntimeException ); - -}; - -BibPosListener::BibPosListener(BibGeneralPage* pParent) : - pParentPage(pParent) -{ -} - -void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno::RuntimeException ) -{ - try - { - uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel(); - uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY); - if(xPropSet.is()) - { - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDataManager* pDatMan = pParentPage->GetDataManager(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS); - if(pMapping) - { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) - { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping) - { - sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; - break; - } - } - } - rtl::OUString uTypeMapping = sTypeMapping; - - uno::Reference< form::XForm > xForm = pDatMan->getForm(); - uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY); - uno::Reference< container::XNameAccess > xValueAcc; - if (xSupplyCols.is()) - xValueAcc = xSupplyCols->getColumns(); - - sal_Int16 nTempVal = -1; - if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping)) - { - uno::Any aVal = xValueAcc->getByName(uTypeMapping); - uno::Reference< uno::XInterface > xInt = *(uno::Reference< uno::XInterface > *)aVal.getValue(); - uno::Reference< sdb::XColumn > xCol(xInt, UNO_QUERY); - DBG_ASSERT(xCol.is(), "BibPosListener::positioned : invalid column (no sdb::XColumn) !"); - if (xCol.is()) - { - nTempVal = xCol->getShort(); - // getShort returns zero if the value is not a number - if (!nTempVal || xCol->wasNull()) - { - rtl::OUString sTempVal = xCol->getString(); - if(sTempVal != rtl::OUString('0')) - nTempVal = -1; - } - } - } - if(nTempVal < 0 || nTempVal >= TYPE_COUNT) - { - uno::Any aSel; - uno::Sequence aSelSeq(1); - sal_Int16* pArr = aSelSeq.getArray(); - pArr[0] = TYPE_COUNT; - aSel.setValue(&aSelSeq, ::getCppuType((Sequence*)0)); - xPropSet->setPropertyValue(C2U("SelectedItems"), aSel); - } - } - } - catch(Exception& rEx) - { - (void) rEx; // make compiler happy - OSL_FAIL("BibPosListener::positioned: something went wrong !"); - } -} - -void BibPosListener::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException ) -{ -} - -BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan): - BibTabPage(pParent,BibResId(RID_TP_GENERAL)), - aControlParentWin(this, WB_DIALOGCONTROL), - aIdentifierFT(&aControlParentWin, BibResId(FT_IDENTIFIER )), - aAuthTypeFT(&aControlParentWin, BibResId(FT_AUTHTYPE )), - aYearFT(&aControlParentWin, BibResId(FT_YEAR )), - aAuthorFT(&aControlParentWin, BibResId(FT_AUTHOR )), - aTitleFT(&aControlParentWin, BibResId(FT_TITLE )), - aPublisherFT(&aControlParentWin, BibResId(FT_PUBLISHER )), - aAddressFT(&aControlParentWin, BibResId(FT_ADDRESS )), - aISBNFT(&aControlParentWin, BibResId(FT_ISBN )), - aChapterFT(&aControlParentWin, BibResId(FT_CHAPTER )), - aPagesFT(&aControlParentWin, BibResId(FT_PAGE )), - aFirstFL(&aControlParentWin, BibResId(FL_1 )), - aEditorFT(&aControlParentWin, BibResId(FT_EDITOR )), - aEditionFT(&aControlParentWin, BibResId(FT_EDITION )), - aBooktitleFT(&aControlParentWin, BibResId(FT_BOOKTITLE )), - aVolumeFT(&aControlParentWin, BibResId(FT_VOLUME )), - aHowpublishedFT(&aControlParentWin, BibResId(FT_HOWPUBLISHED )), - aOrganizationsFT(&aControlParentWin,BibResId(FT_ORGANIZATION )), - aInstitutionFT(&aControlParentWin, BibResId(FT_INSTITUTION )), - aSchoolFT(&aControlParentWin, BibResId(FT_SCHOOL )), - aReportTypeFT(&aControlParentWin, BibResId(FT_REPORT )), - aMonthFT(&aControlParentWin, BibResId(FT_MONTH )), - aSecondFL(&aControlParentWin, BibResId(FL_2 )), - aJournalFT(&aControlParentWin, BibResId(FT_JOURNAL )), - aNumberFT(&aControlParentWin, BibResId(FT_NUMBER )), - aSeriesFT(&aControlParentWin, BibResId(FT_SERIES )), - aAnnoteFT(&aControlParentWin, BibResId(FT_ANNOTE )), - aNoteFT(&aControlParentWin, BibResId(FT_NOTE )), - aURLFT(&aControlParentWin, BibResId(FT_URL )), - aThirdFL(&aControlParentWin, BibResId(FL_3 )), - aCustom1FT(&aControlParentWin, BibResId(FT_CUSTOM1 )), - aCustom2FT(&aControlParentWin, BibResId(FT_CUSTOM2 )), - aCustom3FT(&aControlParentWin, BibResId(FT_CUSTOM3 )), - aCustom4FT(&aControlParentWin, BibResId(FT_CUSTOM4 )), - aCustom5FT(&aControlParentWin, BibResId(FT_CUSTOM5 )), - aHoriScroll(this, WB_HORZ), - aVertScroll(this, WB_VERT), - sErrorPrefix(BibResId(ST_ERROR_PREFIX)), - pDatMan(pMan) -{ - aControlParentWin.Show(); - aControlParentWin.SetHelpId(HID_BIB_CONTROL_PARENT); - aStdSize = GetOutputSizePixel(); - - aBibTypeArr[0] = String(BibResId(ST_TYPE_ARTICLE)); - aBibTypeArr[1] = String(BibResId(ST_TYPE_BOOK)); - aBibTypeArr[2] = String(BibResId(ST_TYPE_BOOKLET)); - aBibTypeArr[3] = String(BibResId(ST_TYPE_CONFERENCE)); - aBibTypeArr[4] = String(BibResId(ST_TYPE_INBOOK )); - aBibTypeArr[5] = String(BibResId(ST_TYPE_INCOLLECTION)); - aBibTypeArr[6] = String(BibResId(ST_TYPE_INPROCEEDINGS)); - aBibTypeArr[7] = String(BibResId(ST_TYPE_JOURNAL )); - aBibTypeArr[8] = String(BibResId(ST_TYPE_MANUAL )); - aBibTypeArr[9] = String(BibResId(ST_TYPE_MASTERSTHESIS)); - aBibTypeArr[10] = String(BibResId(ST_TYPE_MISC )); - aBibTypeArr[11] = String(BibResId(ST_TYPE_PHDTHESIS )); - aBibTypeArr[12] = String(BibResId(ST_TYPE_PROCEEDINGS )); - aBibTypeArr[13] = String(BibResId(ST_TYPE_TECHREPORT )); - aBibTypeArr[14] = String(BibResId(ST_TYPE_UNPUBLISHED )); - aBibTypeArr[15] = String(BibResId(ST_TYPE_EMAIL )); - aBibTypeArr[16] = String(BibResId(ST_TYPE_WWW )); - aBibTypeArr[17] = String(BibResId(ST_TYPE_CUSTOM1 )); - aBibTypeArr[18] = String(BibResId(ST_TYPE_CUSTOM2 )); - aBibTypeArr[19] = String(BibResId(ST_TYPE_CUSTOM3 )); - aBibTypeArr[20] = String(BibResId(ST_TYPE_CUSTOM4 )); - aBibTypeArr[21] = String(BibResId(ST_TYPE_CUSTOM5 )); - - FreeResource(); - - InitFixedTexts(); - - aBasePos = aIdentifierFT.GetPosPixel(); - - sal_Int16* pMap = nFT2CtrlMap; - for( sal_uInt16 i = 0 ; i < FIELD_COUNT ; ++i, ++pMap ) - { - aControls[ i ] = 0; - *pMap = -1; - } - - AdjustScrollbars(); - Link aScrollLnk(LINK(this, BibGeneralPage, ScrollHdl)); - aHoriScroll.SetScrollHdl( aScrollLnk ); - aVertScroll.SetScrollHdl( aScrollLnk ); - aHoriScroll.SetLineSize(10); - aVertScroll.SetLineSize(10); - aHoriScroll.SetPageSize( aIdentifierFT.GetSizePixel().Width()); - aVertScroll.SetPageSize( - aPublisherFT.GetPosPixel().Y() - aIdentifierFT.GetPosPixel().Y()); - aHoriScroll.Show(); - aVertScroll.Show(); - - BibConfig* pBibConfig = BibModul::GetConfig(); - BibDBDescriptor aDesc; - aDesc.sDataSource = pDatMan->getActiveDataSource(); - aDesc.sTableOrQuery = pDatMan->getActiveDataTable(); - aDesc.nCommandType = CommandType::TABLE; - const Mapping* pMapping = pBibConfig->GetMapping(aDesc); - - xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin); - - xMgr = comphelper::getProcessServiceFactory(); - // the control should be a bit smaller than the fixed text - Size aControlSize(aIdentifierFT.GetSizePixel()); - aControlSize.Width() = aControlSize.Width() * 8 / 10; - - AddControlWithError( lcl_GetColumnName( pMapping, IDENTIFIER_POS ), lcl_MovePoint( aIdentifierFT ), - aControlSize, sTableErrorString, aIdentifierFT.GetText(), - HID_BIB_IDENTIFIER_POS, 0 ); - - sTypeColumnName = lcl_GetColumnName(pMapping, AUTHORITYTYPE_POS); - - AddControlWithError( sTypeColumnName, lcl_MovePoint(aAuthTypeFT ), aControlSize, sTableErrorString, - aAuthTypeFT.GetText(), HID_BIB_AUTHORITYTYPE_POS, 1 ); - - ::Point aYearPos = lcl_MovePoint(aYearFT); - AddControlWithError( lcl_GetColumnName( pMapping, YEAR_POS ), aYearPos, - aControlSize, sTableErrorString, aYearFT.GetText(), HID_BIB_YEAR_POS, 4 ); - - AddControlWithError( lcl_GetColumnName(pMapping, AUTHOR_POS), lcl_MovePoint(aAuthorFT), - aControlSize, sTableErrorString, aAuthorFT.GetText(), HID_BIB_AUTHOR_POS, 2 ); - - ::Point aTitlePos( lcl_MovePoint( aTitleFT ) ); - ::Size aTitleSize = aTitleFT.GetSizePixel(); - aTitleSize.Width() = aYearPos.X() + aControlSize.Width() - aTitlePos.X(); - AddControlWithError( lcl_GetColumnName(pMapping, TITLE_POS), aTitlePos, aTitleSize, sTableErrorString, - aTitleFT.GetText(), HID_BIB_TITLE_POS, 22 ); - - AddControlWithError( lcl_GetColumnName( pMapping, PUBLISHER_POS ), lcl_MovePoint( aPublisherFT), - aControlSize, sTableErrorString, aPublisherFT.GetText(), HID_BIB_PUBLISHER_POS, 5 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ADDRESS_POS ), lcl_MovePoint( aAddressFT ), - aControlSize, sTableErrorString, aAddressFT.GetText(), HID_BIB_ADDRESS_POS, 7 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ISBN_POS ), lcl_MovePoint( aISBNFT ), - aControlSize, sTableErrorString, aISBNFT.GetText(), HID_BIB_ISBN_POS, 6 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CHAPTER_POS ), lcl_MovePoint(aChapterFT), - aControlSize, sTableErrorString, aChapterFT.GetText(), HID_BIB_CHAPTER_POS, 10 ); - - AddControlWithError( lcl_GetColumnName( pMapping, PAGES_POS ), lcl_MovePoint( aPagesFT ), - aControlSize, sTableErrorString, aPagesFT.GetText(), HID_BIB_PAGES_POS, 19 ); - - AddControlWithError( lcl_GetColumnName( pMapping, EDITOR_POS ), lcl_MovePoint( aEditorFT ), - aControlSize, sTableErrorString, aEditorFT.GetText(), HID_BIB_EDITOR_POS, 12 ); - - AddControlWithError( lcl_GetColumnName( pMapping, EDITION_POS ), lcl_MovePoint(aEditionFT), - aControlSize, sTableErrorString, aEditionFT.GetText(), HID_BIB_EDITION_POS, 11 ); - - AddControlWithError( lcl_GetColumnName(pMapping, BOOKTITLE_POS), lcl_MovePoint(aBooktitleFT), - aControlSize, sTableErrorString, aBooktitleFT.GetText(), HID_BIB_BOOKTITLE_POS, 9 ); - - AddControlWithError( lcl_GetColumnName( pMapping, VOLUME_POS ), lcl_MovePoint( aVolumeFT ), - aControlSize, sTableErrorString, aVolumeFT.GetText(), HID_BIB_VOLUME_POS, 24 ); - - AddControlWithError( lcl_GetColumnName( pMapping, HOWPUBLISHED_POS ), lcl_MovePoint( aHowpublishedFT ), - aControlSize, sTableErrorString, aHowpublishedFT.GetText(), HID_BIB_HOWPUBLISHED_POS, 13 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ORGANIZATIONS_POS ), lcl_MovePoint( aOrganizationsFT ), - aControlSize, sTableErrorString, aOrganizationsFT.GetText(), HID_BIB_ORGANIZATIONS_POS, 18 ); - - AddControlWithError( lcl_GetColumnName( pMapping, INSTITUTION_POS ), lcl_MovePoint( aInstitutionFT ), - aControlSize, sTableErrorString, aInstitutionFT.GetText(), HID_BIB_INSTITUTION_POS, 14 ); - - AddControlWithError( lcl_GetColumnName( pMapping, SCHOOL_POS ), lcl_MovePoint( aSchoolFT ), - aControlSize, sTableErrorString, aSchoolFT.GetText(), HID_BIB_SCHOOL_POS, 20 ); - - AddControlWithError( lcl_GetColumnName( pMapping, REPORTTYPE_POS ), lcl_MovePoint( aReportTypeFT ), - aControlSize, sTableErrorString, aReportTypeFT.GetText(), HID_BIB_REPORTTYPE_POS, 23 ); - - AddControlWithError( lcl_GetColumnName( pMapping, MONTH_POS ), lcl_MovePoint( aMonthFT ), - aControlSize, sTableErrorString, aMonthFT.GetText(), HID_BIB_MONTH_POS, 3 ); - - AddControlWithError( lcl_GetColumnName( pMapping, JOURNAL_POS ), lcl_MovePoint( aJournalFT ), - aControlSize, sTableErrorString, aJournalFT.GetText(), HID_BIB_JOURNAL_POS, 15 ); - - AddControlWithError( lcl_GetColumnName( pMapping, NUMBER_POS ), lcl_MovePoint( aNumberFT ), - aControlSize, sTableErrorString, aNumberFT.GetText(), HID_BIB_NUMBER_POS, 17 ); - - AddControlWithError( lcl_GetColumnName( pMapping, SERIES_POS ), lcl_MovePoint( aSeriesFT ), - aControlSize, sTableErrorString, aSeriesFT.GetText(), HID_BIB_SERIES_POS, 21 ); - - AddControlWithError( lcl_GetColumnName( pMapping, ANNOTE_POS ), lcl_MovePoint( aAnnoteFT ), - aControlSize, sTableErrorString, aAnnoteFT.GetText(), HID_BIB_ANNOTE_POS, 8 ); - - AddControlWithError( lcl_GetColumnName( pMapping, NOTE_POS ), lcl_MovePoint( aNoteFT ), - aControlSize, sTableErrorString, aNoteFT.GetText(), HID_BIB_NOTE_POS, 16 ); - - AddControlWithError( lcl_GetColumnName( pMapping, URL_POS ), lcl_MovePoint( aURLFT ), - aControlSize, sTableErrorString, aURLFT.GetText(), HID_BIB_URL_POS, 25 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM1_POS ), lcl_MovePoint( aCustom1FT ), - aControlSize, sTableErrorString, aCustom1FT.GetText(), HID_BIB_CUSTOM1_POS, 26 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM2_POS ), lcl_MovePoint( aCustom2FT ), - aControlSize, sTableErrorString, aCustom2FT.GetText(), HID_BIB_CUSTOM2_POS, 27 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM3_POS ), lcl_MovePoint( aCustom3FT ), - aControlSize, sTableErrorString, aCustom3FT.GetText(), HID_BIB_CUSTOM3_POS, 28 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM4_POS ), lcl_MovePoint( aCustom4FT ), - aControlSize, sTableErrorString, aCustom4FT.GetText(), HID_BIB_CUSTOM4_POS, 29 ); - - AddControlWithError( lcl_GetColumnName( pMapping, CUSTOM5_POS ), lcl_MovePoint( aCustom5FT ), - aControlSize, sTableErrorString, aCustom5FT.GetText(), HID_BIB_CUSTOM5_POS, 30 ); - - xPosListener = new BibPosListener(this); - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->addRowSetListener(xPosListener); - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - xFormCtrl->setContainer(xCtrlContnr); - xFormCtrl->activateTabOrder(); - - if(sTableErrorString.Len()) - sTableErrorString.Insert(sErrorPrefix, 0); -} -//----------------------------------------------------------------------------- -BibGeneralPage::~BibGeneralPage() -{ - if (pDatMan && xPosListener.is()) - { - uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY); - if(xRowSet.is()) - xRowSet->removeRowSetListener(xPosListener); - } -} - -void BibGeneralPage::RemoveListeners() -{ - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - { - if(aControls[i].is()) - { - uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY ); - xCtrWin->removeFocusListener( this ); - aControls[i] = 0; - } - } -} - -void BibGeneralPage::CommitActiveControl() -{ - uno::Reference< form::runtime::XFormController > xFormCtrl = pDatMan->GetFormController(); - uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl(); - if(xCurr.is()) - { - uno::Reference< awt::XControlModel > xModel = xCurr->getModel(); - uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY); - if(xBound.is()) - xBound->commit(); - } -} -//----------------------------------------------------------------------------- -void BibGeneralPage::AddControlWithError( const OUString& rColumnName, const ::Point& rPos, const ::Size& rSize, - String& rErrorString, String aColumnUIName, const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray ) -{ - // adds also the XControl and creates a map entry in nFT2CtrlMap[] for mapping between control and FT - - sal_Int16 nIndex = -1; - uno::Reference< awt::XControlModel > xTmp = AddXControl(rColumnName, rPos, rSize, sHelpId, nIndex ); - if( xTmp.is() ) - { - DBG_ASSERT( nIndexInFTArray < FIELD_COUNT, "*BibGeneralPage::AddControlWithError(): wrong array index!" ); - DBG_ASSERT( nFT2CtrlMap[ nIndexInFTArray ] < 0, "+BibGeneralPage::AddControlWithError(): index already in use!" ); - - nFT2CtrlMap[ nIndexInFTArray ] = nIndex; - } - else - { - if( rErrorString.Len() ) - rErrorString += '\n'; - - rErrorString += MnemonicGenerator::EraseAllMnemonicChars( aColumnUIName ); - } -} -//----------------------------------------------------------------------------- -uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl( - const String& rName, - ::Point rPos, ::Size rSize, const rtl::OString& sHelpId, sal_Int16& rIndex ) -{ - uno::Reference< awt::XControlModel > xCtrModel; - try - { - sal_Bool bTypeListBox = sTypeColumnName == rName; - xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox); - if ( xCtrModel.is() && xMgr.is()) - { - uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY ); - - if( xPropSet.is()) - { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - - uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") ); - rtl::OUString aControlName; - aAny >>= aControlName; - - rtl::OUString uProp(C2U("HelpURL")); - if(xPropInfo->hasPropertyByName(uProp)) - { - ::rtl::OUString sId = ::rtl::OUString::createFromAscii( INET_HID_SCHEME ); - DBG_ASSERT( INetURLObject( rtl::OStringToOUString( sHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INET_PROT_NOT_VALID, "Wrong HelpId!" ); - sId += ::rtl::OUString( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 ); - xPropSet->setPropertyValue( uProp, makeAny( sId ) ); - } - - if(bTypeListBox) - { - //uno::Reference< beans::XPropertySet > xPropSet(xControl, UNO_QUERY); - aAny <<= (sal_Int16)1; - xPropSet->setPropertyValue(C2U("BoundColumn"), aAny); - ListSourceType eSet = ListSourceType_VALUELIST; - aAny.setValue( &eSet, ::getCppuType((const ListSourceType*)0) ); - xPropSet->setPropertyValue(C2U("ListSourceType"), aAny); - - uno::Sequence aListSource(TYPE_COUNT); - rtl::OUString* pListSourceArr = aListSource.getArray(); - //pListSourceArr[0] = C2U("select TypeName, TypeIndex from TypeNms"); - for(sal_uInt16 i = 0; i < TYPE_COUNT; i++) - pListSourceArr[i] = String::CreateFromInt32(i); - aAny.setValue(&aListSource, ::getCppuType((uno::Sequence*)0)); - - xPropSet->setPropertyValue(C2U("ListSource"), aAny); - - uno::Sequence aValues(TYPE_COUNT + 1); - rtl::OUString* pValuesArr = aValues.getArray(); - for(sal_uInt16 j = 0; j < TYPE_COUNT; j++) - pValuesArr[j] = aBibTypeArr[j]; - // empty string if an invalid value no values is set - pValuesArr[TYPE_COUNT] = rtl::OUString(); - - aAny.setValue(&aValues, ::getCppuType((uno::Sequence*)0)); - - xPropSet->setPropertyValue(C2U("StringItemList"), aAny); - - sal_Bool bTrue = sal_True; - aAny.setValue( &bTrue, ::getBooleanCppuType() ); - xPropSet->setPropertyValue( C2U("Dropdown"), aAny ); - - aControlName = C2U("com.sun.star.form.control.ListBox"); - xLBModel = Reference< form::XBoundComponent >(xCtrModel, UNO_QUERY); - - } - - uno::Reference< awt::XControl > xControl(xMgr->createInstance( aControlName ), UNO_QUERY ); - if ( xControl.is() ) - { - xControl->setModel( xCtrModel); - - // Peer als Child zu dem FrameWindow - xCtrlContnr->addControl(rName, xControl); - uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY ); - xCtrWin->addFocusListener( this ); - rIndex = -1; // -> implies, that not found - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - if(!aControls[i].is()) - { - aControls[i] = xCtrWin; - rIndex = sal_Int16( i ); - break; - } - xCtrWin->setVisible( sal_True ); - xControl->setDesignMode( sal_True ); - // initially switch on the desing mode - switch it off _after_ loading the form - - xCtrWin->setPosSize(rPos.X(), rPos.Y(), rSize.Width(), - rSize.Height(), awt::PosSize::POSSIZE); - } - } - } - } - catch(Exception& rEx) - { - (void) rEx; // make compiler happy - OSL_FAIL("BibGeneralPage::AddXControl: something went wrong !"); - } - return xCtrModel; -} - -void BibGeneralPage::AdjustScrollbars() -{ - long nVertScrollWidth = aVertScroll.GetSizePixel().Width(); - long nHoriScrollHeight = aHoriScroll.GetSizePixel().Height(); - ::Size aOutSize(GetOutputSizePixel()); - sal_Bool bHoriVisible = aOutSize.Width() <= aStdSize.Width(); - sal_Bool bVertVisible = (aOutSize.Height()-(bHoriVisible ? nHoriScrollHeight : 0)) <= (aStdSize.Height()); - aHoriScroll.Show(bHoriVisible); - aVertScroll.Show(bVertVisible); - - if(bHoriVisible) - { - ::Size aHoriSize(aOutSize.Width() - (bVertVisible ? nVertScrollWidth : 0), - nHoriScrollHeight); - aHoriScroll.SetSizePixel(aHoriSize); - aHoriScroll.SetRange( Range(0, aStdSize.Width())); - aHoriScroll.SetVisibleSize( aHoriSize.Width() - (bVertVisible ? nVertScrollWidth : 0)); - } - if(bVertVisible) - { - ::Size aVertSize(nHoriScrollHeight, aOutSize.Height() - - (bHoriVisible ? nHoriScrollHeight : 0)); - aVertScroll.SetSizePixel(aVertSize); - aVertScroll.SetRange( Range(0, aStdSize.Height())); - aVertScroll.SetVisibleSize( aVertSize.Height() ); - } - - ::Size aSize(8, 8); - aSize = LogicToPixel(aSize, MapMode(MAP_APPFONT)); - ::Size aScrollSize(aOutSize.Width() - aSize.Height(), aSize.Height()); - ::Point aScrollPos(0, aOutSize.Height() - aSize.Height()); - aHoriScroll.SetPosSizePixel(aScrollPos, aScrollSize); - - aScrollPos.X() = aOutSize.Width() - aSize.Width(); - aScrollPos.Y() = 0; - aScrollSize.Width() = aSize.Width(); - aScrollSize.Height() = aOutSize.Height() - aSize.Height(); - aVertScroll.SetPosSizePixel(aScrollPos, aScrollSize); - - ::Size aControlParentWinSz(aOutSize); - if(bHoriVisible) - aControlParentWinSz.Height() -= aSize.Height(); - if(bVertVisible) - aControlParentWinSz.Width() -= aSize.Width(); - aControlParentWin.SetSizePixel(aControlParentWinSz); -} - -void BibGeneralPage::Resize() -{ - AdjustScrollbars(); - ScrollHdl(&aVertScroll); - ScrollHdl(&aHoriScroll); - Window::Resize(); -} - -void BibGeneralPage::InitFixedTexts( void ) -{ - String aFixedStrings[ FIELD_COUNT ] = - { - String( BibResId( ST_IDENTIFIER ) ), - String( BibResId( ST_AUTHTYPE ) ), - String( BibResId( ST_AUTHOR ) ), - String( BibResId( ST_TITLE ) ), - String( BibResId( ST_MONTH ) ), - String( BibResId( ST_YEAR ) ), - String( BibResId( ST_ISBN ) ), - String( BibResId( ST_BOOKTITLE ) ), - String( BibResId( ST_CHAPTER ) ), - String( BibResId( ST_EDITION ) ), - String( BibResId( ST_EDITOR ) ), - String( BibResId( ST_HOWPUBLISHED ) ), - String( BibResId( ST_INSTITUTION ) ), - String( BibResId( ST_JOURNAL ) ), - String( BibResId( ST_NOTE ) ), - String( BibResId( ST_ANNOTE ) ), - String( BibResId( ST_NUMBER ) ), - String( BibResId( ST_ORGANIZATION ) ), - String( BibResId( ST_PAGE ) ), - String( BibResId( ST_PUBLISHER ) ), - String( BibResId( ST_ADDRESS ) ), - String( BibResId( ST_SCHOOL ) ), - String( BibResId( ST_SERIES ) ), - String( BibResId( ST_REPORT ) ), - String( BibResId( ST_VOLUME ) ), - String( BibResId( ST_URL ) ), - String( BibResId( ST_CUSTOM1 ) ), - String( BibResId( ST_CUSTOM2 ) ), - String( BibResId( ST_CUSTOM3 ) ), - String( BibResId( ST_CUSTOM4 ) ), - String( BibResId( ST_CUSTOM5 ) ) - }; - - aFixedTexts[0] = &aIdentifierFT; - aFixedTexts[1] = &aAuthTypeFT; - aFixedTexts[2] = &aAuthorFT; - aFixedTexts[3] = &aTitleFT; - aFixedTexts[4] = &aMonthFT; - aFixedTexts[5] = &aYearFT; - aFixedTexts[6] = &aISBNFT; - aFixedTexts[7] = &aBooktitleFT; - aFixedTexts[8] = &aChapterFT; - aFixedTexts[9] = &aEditionFT; - aFixedTexts[10] = &aEditorFT; - aFixedTexts[11] = &aHowpublishedFT; - aFixedTexts[12] = &aInstitutionFT; - aFixedTexts[13] = &aJournalFT; - aFixedTexts[14] = &aNoteFT; - aFixedTexts[15] = &aAnnoteFT; - aFixedTexts[16] = &aNumberFT; - aFixedTexts[17] = &aOrganizationsFT; - aFixedTexts[18] = &aPagesFT; - aFixedTexts[19] = &aPublisherFT; - aFixedTexts[20] = &aAddressFT; - aFixedTexts[21] = &aSchoolFT; - aFixedTexts[22] = &aSeriesFT; - aFixedTexts[23] = &aReportTypeFT; - aFixedTexts[24] = &aVolumeFT; - aFixedTexts[25] = &aURLFT; - aFixedTexts[26] = &aCustom1FT; - aFixedTexts[27] = &aCustom2FT; - aFixedTexts[28] = &aCustom3FT; - aFixedTexts[29] = &aCustom4FT; - aFixedTexts[30] = &aCustom5FT; - - int i; - - MnemonicGenerator aMnemonicGenerator; - // init mnemonics, first register all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.RegisterMnemonic( aFixedStrings[ i ] ); - - // ... then get all strings - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aMnemonicGenerator.CreateMnemonic( aFixedStrings[ i ] ); - - // set texts - for( i = 0 ; i < FIELD_COUNT ; ++i ) - aFixedTexts[ i ]->SetText( aFixedStrings[ i ] ); -} - -IMPL_LINK(BibGeneralPage, ScrollHdl, ScrollBar*, pScroll) -{ - sal_Bool bVertical = &aVertScroll == pScroll; - long nOffset = 0; - long nCurrentOffset = 0; - if(bVertical) - nCurrentOffset = aFixedTexts[0]->GetPosPixel().Y() - aBasePos.Y(); - else - nCurrentOffset = aFixedTexts[0]->GetPosPixel().X() - aBasePos.X(); - nOffset = pScroll->IsVisible() ? pScroll->GetThumbPos() + nCurrentOffset : nCurrentOffset;; - - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) - { - ::Point aPos = aFixedTexts[i]->GetPosPixel(); - if(bVertical) - aPos.Y() -= nOffset; - else - aPos.X() -= nOffset; - aFixedTexts[i]->SetPosPixel(aPos); - if(aControls[i].is()) - { - awt::Rectangle aRect = aControls[i]->getPosSize(); - long nX = aRect.X; - long nY = aRect.Y; - if(bVertical) - nY -= nOffset; - else - nX -= nOffset; - aControls[i]->setPosSize(nX, nY, 0, 0, awt::PosSize::POS); - } - } - return 0; -} - -void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) throw( uno::RuntimeException ) -{ - Reference xCtrWin(rEvent.Source, UNO_QUERY ); - if(xCtrWin.is()) - { - ::Size aOutSize = aControlParentWin.GetOutputSizePixel(); - awt::Rectangle aRect = xCtrWin->getPosSize(); - long nX = aRect.X; - if(nX < 0) - { - // left of the visible area - aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX); - ScrollHdl(&aHoriScroll); - } - else if(nX > aOutSize.Width()) - { - // right of the visible area - aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX - aOutSize.Width() + aFixedTexts[0]->GetSizePixel().Width()); - ScrollHdl(&aHoriScroll); - } - long nY = aRect.Y; - if(nY < 0) - { - // below the visible area - aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY); - ScrollHdl(&aVertScroll); - } - else if(nY > aOutSize.Height()) - { - // over the visible area - aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY - aOutSize.Height()+ aFixedTexts[0]->GetSizePixel().Height()); - ScrollHdl(&aVertScroll); - } - } -} - -void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeException ) -{ - CommitActiveControl(); -} - -void BibGeneralPage::disposing(const lang::EventObject& /*Source*/) throw( uno::RuntimeException ) -{ -} - -void BibGeneralPage::GetFocus() -{ - Reference< awt::XWindow >* pxControl = aControls; - - for( int i = FIELD_COUNT ; i ; --i, ++pxControl ) - { - if( pxControl->is() ) - { - ( *pxControl )->setFocus(); - return; - } - } - - // fallback - aControlParentWin.GrabFocus(); -} - -sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) -{ - DBG_ASSERT( KEY_MOD2 == rKeyEvent.GetKeyCode().GetModifier(), "+BibGeneralPage::HandleShortCutKey(): this is not for me!" ); - - const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - const xub_Unicode c = rKeyEvent.GetCharCode(); - sal_Bool bHandled = sal_False; - - sal_Int16 i; - - typedef std::vector< sal_Int16 > sal_Int16_vector; - - sal_Int16_vector::size_type nFocused = 0xFFFF; // index of focused in vector, no one focused initial - DBG_ASSERT( nFocused > 0, "*BibGeneralPage::HandleShortCutKey(): size_type works not as expected!" ); - - sal_Int16_vector aMatchList; - - for( i = 0 ; i < FIELD_COUNT ; ++i ) - { - if( rI18nHelper.MatchMnemonic( aFixedTexts[ i ]->GetText(), c ) ) - { - bHandled = sal_True; - sal_Int16 nCtrlIndex = nFT2CtrlMap[ i ]; - - if( nCtrlIndex >= 0 ) - { // store index of control - DBG_ASSERT( aControls[ nCtrlIndex ].is(), "-BibGeneralPage::HandleShortCutKey(): valid index and no control?" ); - - uno::Reference< awt::XControl > xControl( aControls[ nCtrlIndex ], UNO_QUERY ); - DBG_ASSERT( xControl.is(), "-BibGeneralPage::HandleShortCutKey(): a control wich is not a control!" ); - - Window* pWindow = VCLUnoHelper::GetWindow( xControl->getPeer() ); - - if( pWindow ) - { - aMatchList.push_back( nCtrlIndex ); - if( pWindow->HasChildPathFocus() ) - { // save focused control - DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" ); - DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); - nFocused = aMatchList.size() - 1; - } - } - } - } - } - - if( bHandled ) - { - DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); - - if( nFocused >= ( aMatchList.size() - 1 ) ) - // >=... includes 0xFFFF - // no one or last focused, take first - nFocused = 0; - else - // take next one - nFocused++; - - aControls[ aMatchList[ nFocused ] ]->setFocus(); - } - - return bHandled; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx deleted file mode 100644 index 86ff5a0cb..000000000 --- a/extensions/source/bibliography/general.hxx +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_GENERAL_HXX -#define _BIB_GENERAL_HXX - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include // helper for implementations -#include "bibshortcuthandler.hxx" - - -class BibDataManager; -#define TYPE_COUNT 22 -#define FIELD_COUNT 31 - -typedef cppu::WeakAggImplHelper1 < ::com::sun::star::awt::XFocusListener > BibGeneralPageBaseClass; - -class BibGeneralPage: public BibGeneralPageBaseClass, public BibTabPage -{ - Window aControlParentWin; - FixedText aIdentifierFT; - FixedText aAuthTypeFT; - FixedText aYearFT; - - FixedText aAuthorFT; - FixedText aTitleFT; - - FixedText aPublisherFT; - FixedText aAddressFT; - FixedText aISBNFT; - - FixedText aChapterFT; - FixedText aPagesFT; - FixedLine aFirstFL; - - FixedText aEditorFT; - FixedText aEditionFT; - - FixedText aBooktitleFT; - FixedText aVolumeFT; - FixedText aHowpublishedFT; - - FixedText aOrganizationsFT; - FixedText aInstitutionFT; - FixedText aSchoolFT; - - FixedText aReportTypeFT; - FixedText aMonthFT; - FixedLine aSecondFL; - - FixedText aJournalFT; - FixedText aNumberFT; - FixedText aSeriesFT; - - FixedText aAnnoteFT; - FixedText aNoteFT; - FixedText aURLFT; - FixedLine aThirdFL; - - FixedText aCustom1FT; - FixedText aCustom2FT; - FixedText aCustom3FT; - FixedText aCustom4FT; - FixedText aCustom5FT; - - ScrollBar aHoriScroll; - ScrollBar aVertScroll; - - FixedText* aFixedTexts[ FIELD_COUNT ]; - sal_Int16 nFT2CtrlMap[ FIELD_COUNT ]; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > - aControls[ FIELD_COUNT ]; - - Size aStdSize; - Point aBasePos; - - String aBibTypeArr[ TYPE_COUNT ]; - String sErrorPrefix; - String sTableErrorString; - - String sTypeColumnName; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - xCtrlContnr; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - xMgr; - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > - xCurrentBoundComponent; - - ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > - xLBModel; - - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener > - xPosListener; - - - BibDataManager* pDatMan; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > - AddXControl( const String& rName, Point aPos, Size aSize, const rtl::OString& sHelpId, - sal_Int16& rIndex ); - - void AddControlWithError( const rtl::OUString& rColumnName, const Point& rPos, - const Size& rSize, String& rErrorString, String aColumnUIName, - const rtl::OString& sHelpId, sal_uInt16 nIndexInFTArray ); - - void AdjustScrollbars(); - - DECL_LINK( ScrollHdl, ScrollBar* ); - -protected: - virtual void Resize(); - void InitFixedTexts( void ); // create mnemonics and set text an all fixed texts - -public: - BibGeneralPage(Window* pParent, BibDataManager* pDatMan); - virtual ~BibGeneralPage(); - - inline const String& GetErrorString() const; - - inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >& - GetTypeListBoxModel() const; - inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& - GetControlContainer() const; - - inline BibDataManager* GetDataManager(); - - void CommitActiveControl(); - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( com::sun::star::uno::RuntimeException ); - - 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 ); - - void RemoveListeners(); - - virtual void GetFocus(); - - virtual sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); // returns true, if key was handled -}; - - -inline const String& BibGeneralPage::GetErrorString() const -{ - return sTableErrorString; -} - -inline const ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent >& - BibGeneralPage::GetTypeListBoxModel() const -{ - return xLBModel; -} - -inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& - BibGeneralPage::GetControlContainer() const -{ - return xCtrlContnr; -} - -inline BibDataManager* BibGeneralPage::GetDataManager() -{ - return pDatMan; -} - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/hidother.src b/extensions/source/bibliography/hidother.src deleted file mode 100644 index 57028fb42..000000000 --- a/extensions/source/bibliography/hidother.src +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "bibliography.hrc" - -hidspecial HID_BIB_IDENTIFIER_POS { HelpID = HID_BIB_IDENTIFIER_POS ; }; -hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpID = HID_BIB_AUTHORITYTYPE_POS ; }; -hidspecial HID_BIB_AUTHOR_POS { HelpID = HID_BIB_AUTHOR_POS ; }; -hidspecial HID_BIB_TITLE_POS { HelpID = HID_BIB_TITLE_POS ; }; -hidspecial HID_BIB_YEAR_POS { HelpID = HID_BIB_YEAR_POS ; }; -hidspecial HID_BIB_ISBN_POS { HelpID = HID_BIB_ISBN_POS ; }; -hidspecial HID_BIB_BOOKTITLE_POS { HelpID = HID_BIB_BOOKTITLE_POS ; }; -hidspecial HID_BIB_CHAPTER_POS { HelpID = HID_BIB_CHAPTER_POS ; }; -hidspecial HID_BIB_EDITION_POS { HelpID = HID_BIB_EDITION_POS ; }; -hidspecial HID_BIB_EDITOR_POS { HelpID = HID_BIB_EDITOR_POS ; }; -hidspecial HID_BIB_HOWPUBLISHED_POS { HelpID = HID_BIB_HOWPUBLISHED_POS ; }; -hidspecial HID_BIB_INSTITUTION_POS { HelpID = HID_BIB_INSTITUTION_POS ; }; -hidspecial HID_BIB_JOURNAL_POS { HelpID = HID_BIB_JOURNAL_POS ; }; -hidspecial HID_BIB_MONTH_POS { HelpID = HID_BIB_MONTH_POS ; }; -hidspecial HID_BIB_NOTE_POS { HelpID = HID_BIB_NOTE_POS ; }; -hidspecial HID_BIB_ANNOTE_POS { HelpID = HID_BIB_ANNOTE_POS ; }; -hidspecial HID_BIB_NUMBER_POS { HelpID = HID_BIB_NUMBER_POS ; }; -hidspecial HID_BIB_ORGANIZATIONS_POS { HelpID = HID_BIB_ORGANIZATIONS_POS ; }; -hidspecial HID_BIB_PAGES_POS { HelpID = HID_BIB_PAGES_POS ; }; -hidspecial HID_BIB_PUBLISHER_POS { HelpID = HID_BIB_PUBLISHER_POS ; }; -hidspecial HID_BIB_ADDRESS_POS { HelpID = HID_BIB_ADDRESS_POS ; }; -hidspecial HID_BIB_SCHOOL_POS { HelpID = HID_BIB_SCHOOL_POS ; }; -hidspecial HID_BIB_SERIES_POS { HelpID = HID_BIB_SERIES_POS ; }; -hidspecial HID_BIB_REPORTTYPE_POS { HelpID = HID_BIB_REPORTTYPE_POS ; }; -hidspecial HID_BIB_VOLUME_POS { HelpID = HID_BIB_VOLUME_POS ; }; -hidspecial HID_BIB_URL_POS { HelpID = HID_BIB_URL_POS ; }; -hidspecial HID_BIB_CUSTOM1_POS { HelpID = HID_BIB_CUSTOM1_POS ; }; -hidspecial HID_BIB_CUSTOM2_POS { HelpID = HID_BIB_CUSTOM2_POS ; }; -hidspecial HID_BIB_CUSTOM3_POS { HelpID = HID_BIB_CUSTOM3_POS ; }; -hidspecial HID_BIB_CUSTOM4_POS { HelpID = HID_BIB_CUSTOM4_POS ; }; -hidspecial HID_BIB_CUSTOM5_POS { HelpID = HID_BIB_CUSTOM5_POS ; }; -hidspecial HID_BIB_DB_GRIDCTRL { HelpID = HID_BIB_DB_GRIDCTRL ; }; diff --git a/extensions/source/bibliography/loadlisteneradapter.cxx b/extensions/source/bibliography/loadlisteneradapter.cxx deleted file mode 100644 index 928fb020a..000000000 --- a/extensions/source/bibliography/loadlisteneradapter.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "loadlisteneradapter.hxx" -#include -#include - -//......................................................................... -namespace bib -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - - //===================================================================== - //= OComponentListener - //===================================================================== - //--------------------------------------------------------------------- - OComponentListener::~OComponentListener() - { - { - ::osl::MutexGuard aGuard( m_rMutex ); - if ( m_pAdapter ) - m_pAdapter->dispose(); - } - } - - //--------------------------------------------------------------------- - void OComponentListener::_disposing( const EventObject& /*_rSource*/ ) throw( RuntimeException) - { - // nothing to do here, overrride if you're interested in - } - - //--------------------------------------------------------------------- - void OComponentListener::setAdapter( OComponentAdapterBase* pAdapter ) - { - { - ::osl::MutexGuard aGuard( m_rMutex ); - if ( m_pAdapter ) - { - m_pAdapter->release(); - m_pAdapter = NULL; - } - } - - if ( pAdapter ) - { - ::osl::MutexGuard aGuard( m_rMutex ); - m_pAdapter = pAdapter; - m_pAdapter->acquire(); - } - } - - //===================================================================== - //= OComponentAdapterBase - //===================================================================== - //--------------------------------------------------------------------- - OComponentAdapterBase::OComponentAdapterBase( const Reference< XComponent >& _rxComp, sal_Bool _bAutoRelease ) - :m_xComponent( _rxComp ) - ,m_pListener( NULL ) - ,m_nLockCount( 0 ) - ,m_bListening( sal_False ) - ,m_bAutoRelease( _bAutoRelease ) - { - OSL_ENSURE( m_xComponent.is(), "OComponentAdapterBase::OComponentAdapterBase: invalid component!" ); - } - - //--------------------------------------------------------------------- - void OComponentAdapterBase::Init( OComponentListener* _pListener ) - { - OSL_ENSURE( !m_pListener, "OComponentAdapterBase::Init: already initialized!" ); - OSL_ENSURE( _pListener, "OComponentAdapterBase::Init: invalid listener!" ); - - m_pListener = _pListener; - if ( m_pListener ) - m_pListener->setAdapter( this ); - - startComponentListening( ); - m_bListening = sal_True; - } - - //--------------------------------------------------------------------- - OComponentAdapterBase::~OComponentAdapterBase() - { - } - - //--------------------------------------------------------------------- - void OComponentAdapterBase::dispose() - { - if ( m_bListening ) - { - ::rtl::Reference< OComponentAdapterBase > xPreventDelete(this); - - disposing(); - - m_pListener->setAdapter(NULL); - - m_pListener = NULL; - m_bListening = sal_False; - - if (m_bAutoRelease) - m_xComponent = NULL; - } - } - - // XEventListener - - //--------------------------------------------------------------------- - void SAL_CALL OComponentAdapterBase::disposing( const EventObject& _rSource ) throw( RuntimeException ) - { - if ( m_pListener ) - { - // tell the listener - if ( !locked() ) - m_pListener->_disposing( _rSource ); - - // disconnect the listener - if ( m_pListener ) // may have been reset whilest calling into _disposing - m_pListener->setAdapter( NULL ); - } - - m_pListener = NULL; - m_bListening = sal_False; - - if ( m_bAutoRelease ) - m_xComponent = NULL; - } - - //===================================================================== - //= OLoadListenerAdapter - //===================================================================== - //--------------------------------------------------------------------- - OLoadListenerAdapter::OLoadListenerAdapter( const Reference< XLoadable >& _rxLoadable, sal_Bool _bAutoRelease ) - :OComponentAdapterBase( Reference< XComponent >( _rxLoadable, UNO_QUERY ), _bAutoRelease ) - { - } - - //--------------------------------------------------------------------- - void OLoadListenerAdapter::startComponentListening() - { - Reference< XLoadable > xLoadable( getComponent(), UNO_QUERY ); - OSL_ENSURE( xLoadable.is(), "OLoadListenerAdapter::OLoadListenerAdapter: invalid object!" ); - if ( xLoadable.is() ) - xLoadable->addLoadListener( this ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::acquire( ) throw () - { - OLoadListenerAdapter_Base::acquire(); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::release( ) throw () - { - OLoadListenerAdapter_Base::release(); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::disposing( const EventObject& _rSource ) throw( RuntimeException) - { - OComponentAdapterBase::disposing( _rSource ); - } - - //--------------------------------------------------------------------- - void OLoadListenerAdapter::disposing() - { - Reference< XLoadable > xLoadable( getComponent(), UNO_QUERY ); - if ( xLoadable.is() ) - xLoadable->removeLoadListener( this ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::loaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_loaded( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::unloading( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_unloading( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::unloaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_unloaded( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::reloading( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_reloading( _rEvent ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OLoadListenerAdapter::reloaded( const EventObject& _rEvent ) throw (RuntimeException) - { - if ( !locked() && getLoadListener( ) ) - getLoadListener( )->_reloaded( _rEvent ); - } - -//......................................................................... -} // namespace bib -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/loadlisteneradapter.hxx b/extensions/source/bibliography/loadlisteneradapter.hxx deleted file mode 100644 index c35cb939b..000000000 --- a/extensions/source/bibliography/loadlisteneradapter.hxx +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX -#define EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX - -#include -#include -#include -#include - -//......................................................................... -namespace bib -{ -//......................................................................... - - class OComponentAdapterBase; - - //===================================================================== - //= OComponentListener - //===================================================================== - class OComponentListener - { - friend class OComponentAdapterBase; - - private: - OComponentAdapterBase* m_pAdapter; - ::osl::Mutex& m_rMutex; - protected: - OComponentListener( ::osl::Mutex& _rMutex ) - :m_pAdapter( NULL ) - ,m_rMutex( _rMutex ) - { - } - - virtual ~OComponentListener(); - - // XEventListener equivalents - virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw( ::com::sun::star::uno::RuntimeException ); - - protected: - void setAdapter( OComponentAdapterBase* _pAdapter ); - }; - - //===================================================================== - //= OComponentAdapterBase - //===================================================================== - class OComponentAdapterBase - { - friend class OComponentListener; - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - m_xComponent; - OComponentListener* m_pListener; - sal_Int32 m_nLockCount; - sal_Bool m_bListening : 1; - sal_Bool m_bAutoRelease : 1; - - // impl method for dispose - virtual, 'cause you at least need to remove the listener from the broadcaster - virtual void disposing() = 0; - - protected: - // attribute access for derivees - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& - getComponent() const { return m_xComponent; } - OComponentListener* getListener() { return m_pListener; } - - // to be called by derivees which started listening at the component - virtual void startComponentListening() = 0; - - virtual ~OComponentAdapterBase(); - - public: - OComponentAdapterBase( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComp, - sal_Bool _bAutoRelease = sal_True - ); - - // late construction - // can be called from within you ctor, to have you're object fully initialized at the moment of - // the call (which would not be the case when calling this ctor) - void Init( OComponentListener* _pListener ); - - // base for ref-counting, implemented by OComponentAdapter - virtual void SAL_CALL acquire( ) throw () = 0; - virtual void SAL_CALL release( ) throw () = 0; - - // helper - /// get the lock count - sal_Int32 locked() const { return m_nLockCount; } - - /// dispose the object - stop listening and such - void dispose(); - - protected: - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException); - }; - - //===================================================================== - //= OLoadListener - //===================================================================== - class OLoadListener : public OComponentListener - { - friend class OLoadListenerAdapter; - - protected: - OLoadListener( ::osl::Mutex& _rMutex ) : OComponentListener( _rMutex ) { } - - // XLoadListener equivalents - virtual void _loaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _unloading( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _unloaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _reloading( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - virtual void _reloaded( const ::com::sun::star::lang::EventObject& aEvent ) = 0; - }; - - //===================================================================== - //= OLoadListenerAdapter - //===================================================================== - typedef ::cppu::WeakImplHelper1< ::com::sun::star::form::XLoadListener > OLoadListenerAdapter_Base; - class OLoadListenerAdapter - :public OLoadListenerAdapter_Base - ,public OComponentAdapterBase - { - protected: - OLoadListener* getLoadListener( ) { return static_cast< OLoadListener* >( getListener() ); } - - protected: - virtual void disposing(); - virtual void startComponentListening(); - - public: - OLoadListenerAdapter( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxLoadable, - sal_Bool _bAutoRelease = sal_True - ); - - - virtual void SAL_CALL acquire( ) throw (); - virtual void SAL_CALL release( ) throw (); - - protected: - // XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw( ::com::sun::star::uno::RuntimeException); - - // XLoadListener - virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace bib -//......................................................................... - -#endif // EXTENSIONS_BIB_LOADLISTENERADAPTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/makefile.mk b/extensions/source/bibliography/makefile.mk deleted file mode 100644 index b681c6c90..000000000 --- a/extensions/source/bibliography/makefile.mk +++ /dev/null @@ -1,98 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=extensions -TARGET=bib -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/formcontrolcontainer.obj \ - $(SLO)$/loadlisteneradapter.obj \ - $(SLO)$/bibconfig.obj \ - $(SLO)$/bibcont.obj \ - $(SLO)$/bibload.obj \ - $(SLO)$/bibmod.obj \ - $(SLO)$/general.obj \ - $(SLO)$/framectr.obj \ - $(SLO)$/bibview.obj \ - $(SLO)$/bibbeam.obj \ - $(SLO)$/toolbar.obj \ - $(SLO)$/datman.obj \ - - -SRS1NAME=$(TARGET) -SRC1FILES= bib.src \ - datman.src \ - sections.src \ - toolbar.src - -RESLIB1NAME=bib -RESLIB1SRSFILES= $(SRS)$/bib.srs -RESLIB1DEPN= bib.src bib.hrc - - -SHL1STDLIBS= \ - $(SOTLIB) \ - $(SVTOOLLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(DBTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -DEF1NAME= $(SHL1TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/bib.component - -$(MISC)/bib.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - bib.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt bib.component diff --git a/extensions/source/bibliography/sections.hrc b/extensions/source/bibliography/sections.hrc deleted file mode 100644 index 2488f4ed6..000000000 --- a/extensions/source/bibliography/sections.hrc +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "bib.hrc" - -//General -/*#define FT_FIRST_MIDDLE 1 -#define ED_FIRST 2 -#define ED_MIDDLE 3 -#define FT_NAME_SUFFIX 4 -#define ED_NAME 5 -#define CB_SUFFIX 6 -#define ED_INITIALS 8 -#define FT_COMPANY 9 -#define ED_COMPANY 10 -#define FT_DEPARTMENT 11 -#define ED_DEPARTMENT 12 -#define FT_SALUTATION 13 -#define CB_SALUTATION 14 -#define FT_SHOWNNAME 15 -#define ED_SHOWNNAME 16*/ -#define FT_IDENTIFIER 1 -#define FT_AUTHTYPE 2 -#define FT_AUTHOR 3 -#define FT_YEAR 4 -#define FT_ISBN 5 - -#define FT_MONTH 6 - -#define FT_PUBLISHER 8 - -#define FT_ADDRESS 9 -#define FT_ANNOTE 10 -#define FT_BOOKTITLE 11 -#define FT_CHAPTER 12 -#define FT_EDITION 13 -#define FT_EDITOR 14 -#define FT_HOWPUBLISHED 15 -#define FT_INSTITUTION 16 -#define FT_JOURNAL 17 -#define FT_NOTE 18 -#define FT_NUMBER 19 -#define FT_ORGANIZATION 20 -#define FT_PAGE 21 -#define FT_SCHOOL 22 -#define FT_SERIES 23 -#define FT_TITLE 24 -#define FT_REPORT 25 -#define FT_VOLUME 26 -#define FT_URL 27 -#define FT_CUSTOM1 28 -#define FT_CUSTOM2 29 -#define FT_CUSTOM3 30 -#define FT_CUSTOM4 31 -#define FT_CUSTOM5 32 -#define ST_ERROR_PREFIX 33 -#define FL_1 34 -#define FL_2 35 -#define FL_3 36 - -//Business Address -#define FT_OFFICE 1 -#define FT_STREET 2 -#define FT_CITY 3 -#define FT_STATE 4 -#define FT_COUNTRY 5 -#define FT_ZIP 6 -#define ED_OFFICE 7 -#define ED_STREET 8 -#define ED_CITY 9 -#define ED_STATE 10 -#define ED_COUNTRY 11 -#define ED_ZIP 12 -#define ED_POBOX 13 - - -//Popup SectionControl -#define PU_INSERT 1 -#define PU_REMOVE 2 -#define PU_CHG_NAME 3 - -#define ST_TYPE_ARTICLE 40 -#define ST_TYPE_BOOK 41 -#define ST_TYPE_BOOKLET 42 -#define ST_TYPE_CONFERENCE 43 -#define ST_TYPE_INBOOK 44 -#define ST_TYPE_INCOLLECTION 45 -#define ST_TYPE_INPROCEEDINGS 46 -#define ST_TYPE_JOURNAL 47 -#define ST_TYPE_MANUAL 48 -#define ST_TYPE_MASTERSTHESIS 49 -#define ST_TYPE_MISC 50 -#define ST_TYPE_PHDTHESIS 51 -#define ST_TYPE_PROCEEDINGS 52 -#define ST_TYPE_TECHREPORT 53 -#define ST_TYPE_UNPUBLISHED 54 -#define ST_TYPE_EMAIL 55 -#define ST_TYPE_WWW 56 -#define ST_TYPE_CUSTOM1 57 -#define ST_TYPE_CUSTOM2 58 -#define ST_TYPE_CUSTOM3 59 -#define ST_TYPE_CUSTOM4 60 -#define ST_TYPE_CUSTOM5 61 - diff --git a/extensions/source/bibliography/sections.src b/extensions/source/bibliography/sections.src deleted file mode 100644 index 3f7fe83d5..000000000 --- a/extensions/source/bibliography/sections.src +++ /dev/null @@ -1,584 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//#pragma CHARSET_ANSI - -#include "sections.hrc" -#include "bibliography.hrc" - -#define FT_POS 12 -#define FTSIZE_LEFT 88 -#define ED_POS_LEFT FT_POS+FTSIZE_LEFT+1 -#define ED_SIZE 70 -#define ED_POS_LEFT2 ED_POS_LEFT + ED_SIZE +1 -#define FT_POS_MIDDLE ED_POS_LEFT2 + 5 -#define FT_POS_RIGHT FT_POS_MIDDLE + FT_POS_MIDDLE - FT_POS - -#define FL_POS 6 -#define PAGE_WIDTH FT_POS_RIGHT + FTSIZE_LEFT + (FTSIZE_LEFT * 8 / 10) + FL_POS + 5 -#define FL_WIDTH PAGE_WIDTH - 2 * FL_POS - -TabPage RID_TP_GENERAL -{ - SVLook = TRUE ; - Size = MAP_APPFONT( PAGE_WIDTH, 209 ); - HelpId = HID_BIB_CONTROL_PAGE; - - FixedText FT_IDENTIFIER - { - Pos = MAP_APPFONT( FT_POS, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_AUTHTYPE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_YEAR - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 6 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_AUTHOR - { - Pos = MAP_APPFONT( FT_POS, 20 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_TITLE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 20 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_PUBLISHER - { - Pos = MAP_APPFONT( FT_POS, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ADDRESS - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ISBN - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 34 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CHAPTER - { - Pos = MAP_APPFONT( FT_POS, 48 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_PAGE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 48 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_1 - { - Pos = MAP_APPFONT( FL_POS, 62 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_EDITOR - { - Pos = MAP_APPFONT( FT_POS, 73 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_EDITION - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 73 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_BOOKTITLE - { - Pos = MAP_APPFONT( FT_POS, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_VOLUME - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_HOWPUBLISHED - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 87 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ORGANIZATION - { - Pos = MAP_APPFONT( FT_POS, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_INSTITUTION - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_SCHOOL - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 101 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_REPORT - { - Pos = MAP_APPFONT( FT_POS, 115); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_MONTH - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 115 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_2 - { - Pos = MAP_APPFONT( FL_POS, 129 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_JOURNAL - { - Pos = MAP_APPFONT( FT_POS, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - - FixedText FT_NUMBER - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_SERIES - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 140 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_ANNOTE - { - Pos = MAP_APPFONT( FT_POS, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_NOTE - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_URL - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 154 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedLine FL_3 - { - Pos = MAP_APPFONT( FL_POS, 168 ); - Size = MAP_APPFONT( FL_WIDTH, 8 ); - }; - FixedText FT_CUSTOM1 - { - Pos = MAP_APPFONT( FT_POS, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM2 - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM3 - { - Pos = MAP_APPFONT( FT_POS_RIGHT, 179 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM4 - { - Pos = MAP_APPFONT( FT_POS, 193 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - FixedText FT_CUSTOM5 - { - Pos = MAP_APPFONT( FT_POS_MIDDLE, 193 ); - Size = MAP_APPFONT( FTSIZE_LEFT, 10 ); - Right = TRUE; - }; - String ST_ERROR_PREFIX - { - Text [ en-US ] = "The following column names could not be assigned:\n"; - }; - String ST_TYPE_ARTICLE - { - Text [ en-US ] = "Article"; - }; - String ST_TYPE_BOOK - { - Text [ en-US ] = "Book"; - }; - String ST_TYPE_BOOKLET - { - Text [ en-US ] = "Brochures"; - }; - String ST_TYPE_CONFERENCE - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_INBOOK - { - Text [ en-US ] = "Book excerpt"; - }; - String ST_TYPE_INCOLLECTION - { - Text [ en-US ] = "Book excerpt with title"; - }; - String ST_TYPE_INPROCEEDINGS - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_JOURNAL - { - Text [ en-US ] = "Journal"; - }; - String ST_TYPE_MANUAL - { - Text [ en-US ] = "Techn. documentation"; - }; - String ST_TYPE_MASTERSTHESIS - { - Text [ en-US ] = "Thesis"; - }; - String ST_TYPE_MISC - { - Text [ en-US ] = "Miscellaneous"; - }; - String ST_TYPE_PHDTHESIS - { - Text [ en-US ] = "Dissertation"; - }; - String ST_TYPE_PROCEEDINGS - { - Text [ en-US ] = "Conference proceedings"; - }; - String ST_TYPE_TECHREPORT - { - Text [ en-US ] = "Research report"; - }; - String ST_TYPE_UNPUBLISHED - { - Text [ en-US ] = "Unpublished"; - }; - String ST_TYPE_EMAIL - { - Text [ en-US ] = "e-mail"; - }; - String ST_TYPE_WWW - { - Text [ en-US ] = "WWW document"; - }; - String ST_TYPE_CUSTOM1 - { - Text [ en-US ] = "User-defined1"; - }; - String ST_TYPE_CUSTOM2 - { - Text [ en-US ] = "User-defined2"; - }; - String ST_TYPE_CUSTOM3 - { - Text [ en-US ] = "User-defined3"; - }; - String ST_TYPE_CUSTOM4 - { - Text [ en-US ] = "User-defined4"; - }; - String ST_TYPE_CUSTOM5 - { - Text [ en-US ] = "User-defined5"; - }; - Text [ en-US ] = "General"; -}; -Menu RID_POPUP_ME_VIEW -{ - ItemList = - { - MenuItem - { - Identifier = PU_INSERT; - Text [ en-US ] = "Insert Section..."; - }; - MenuItem - { - Identifier = PU_REMOVE; - Text [ en-US ] = "Delete Section..."; - }; - MenuItem - { - Identifier = PU_CHG_NAME; - Text [ en-US ] = "Modify Name..."; - }; - }; -}; - -String ST_IDENTIFIER -{ - Text [ en-US ] = "~Short name"; -}; -String ST_AUTHTYPE -{ - Text [ en-US ] = "~Type"; -}; -String ST_YEAR -{ - Text [ en-US ] = "~Year"; -}; -String ST_AUTHOR -{ - Text [ en-US ] = "Author(s)"; -}; -String ST_TITLE -{ - Text [ en-US ] = "Tit~le"; -}; -String ST_PUBLISHER -{ - Text [ en-US ] = "~Publisher"; -}; -String ST_ADDRESS -{ - Text [ en-US ] = "A~ddress"; -}; -String ST_ISBN -{ - Text [ en-US ] = "~ISBN"; -}; -String ST_CHAPTER -{ - Text [ en-US ] = "~Chapter"; -}; -String ST_PAGE -{ - Text [ en-US ] = "Pa~ge(s)"; -}; -String ST_EDITOR -{ - Text [ en-US ] = "Editor"; -}; -String ST_EDITION -{ - Text [ en-US ] = "Ed~ition"; -}; -String ST_BOOKTITLE -{ - Text [ en-US ] = "~Book title"; -}; -String ST_VOLUME -{ - Text [ en-US ] = "Volume"; -}; -String ST_HOWPUBLISHED -{ - Text [ en-US ] = "Publication t~ype"; -}; -String ST_ORGANIZATION -{ - Text [ en-US ] = "Organi~zation"; -}; -String ST_INSTITUTION -{ - Text [ en-US ] = "Instit~ution"; -}; -String ST_SCHOOL -{ - Text [ en-US ] = "University"; -}; -String ST_REPORT -{ - Text [ en-US ] = "Type of re~port"; -}; -String ST_MONTH -{ - Text [ en-US ] = "~Month"; -}; -String ST_JOURNAL -{ - Text [ en-US ] = "~Journal"; -}; - -String ST_NUMBER -{ - Text [ en-US ] = "Numb~er"; -}; -String ST_SERIES -{ - Text [ en-US ] = "Se~ries"; -}; -String ST_ANNOTE -{ - Text [ en-US ] = "Ann~otation"; -}; -String ST_NOTE -{ - Text [ en-US ] = "~Note"; -}; -String ST_URL -{ - Text [ en-US ] = "URL"; -}; -String ST_CUSTOM1 -{ - Text [ en-US ] = "User-defined field ~1"; -}; -String ST_CUSTOM2 -{ - Text [ en-US ] = "User-defined field ~2"; -}; -String ST_CUSTOM3 -{ - Text [ en-US ] = "User-defined field ~3"; -}; -String ST_CUSTOM4 -{ - Text [ en-US ] = "User-defined field ~4"; -}; -String ST_CUSTOM5 -{ - Text [ en-US ] = "User-defined field ~5"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx deleted file mode 100644 index 47dd6c5ae..000000000 --- a/extensions/source/bibliography/toolbar.cxx +++ /dev/null @@ -1,633 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bibbeam.hxx" -#include "toolbar.hrc" -#include "bibresid.hxx" - -#include "bibtools.hxx" -#include - -using namespace ::rtl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -#define C2U(cChar) OUString::createFromAscii(cChar) - - -// Konstanten ------------------------------------------------------------- - - -BibToolBarListener::BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - nIndex(nId), - aCommand(aStr), - pToolBar(pTB) -{ -} - -BibToolBarListener::~BibToolBarListener() -{ -} - -void BibToolBarListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == aCommand) - { - SolarMutexGuard aGuard; - pToolBar->EnableItem(nIndex,rEvt.IsEnabled); - - ::com::sun::star::uno::Any aState=rEvt.State; - if(aState.getValueType()==::getBooleanCppuType()) - { - sal_Bool bChecked= *(sal_Bool*)aState.getValue(); - pToolBar->CheckItem(nIndex, bChecked); - } - - } -}; - -rtl::OUString BibToolBarListener::GetCommand() const -{ - return aCommand; -} - -BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBListBoxListener::~BibTBListBoxListener() -{ -} - -void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableSourceList(rEvt.IsEnabled); - - Any aState = rEvt.State; - if(aState.getValueType() == ::getCppuType((Sequence*)0)) - { - pToolBar->UpdateSourceList(sal_False); - pToolBar->ClearSourceList(); - - Sequence* pStringSeq = (Sequence*)aState.getValue(); - const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - XubString aEntry; - for( sal_uInt32 i=0; iInsertSourceEntry(aEntry); - } - pToolBar->UpdateSourceList(sal_True); - } - - XubString aStr = String(rEvt.FeatureDescriptor); - pToolBar->SelectSourceEntry(aStr); - } -}; - -BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBQueryMenuListener::~BibTBQueryMenuListener() -{ -} - -void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableSourceList(rEvt.IsEnabled); - - uno::Any aState=rEvt.State; - if(aState.getValueType()==::getCppuType((Sequence*)0)) - { - pToolBar->ClearFilterMenu(); - - Sequence* pStringSeq = (Sequence*) aState.getValue(); - const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - for( sal_uInt32 i=0; iInsertFilterItem(String(pStringArray[i])); - if(pStringArray[i]==rEvt.FeatureDescriptor) - { - pToolBar->SelectFilterItem(nID); - } - } - } - } -}; - -BibTBEditListener::BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId): - BibToolBarListener(pTB,aStr,nId) -{ -} - -BibTBEditListener::~BibTBEditListener() -{ -} - -void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException ) -{ - if(rEvt.FeatureURL.Complete == GetCommand()) - { - SolarMutexGuard aGuard; - pToolBar->EnableQuery(rEvt.IsEnabled); - - uno::Any aState=rEvt.State; - if(aState.getValueType()==::getCppuType((const OUString*)0)) - { - String aStr = String(*(OUString*) aState.getValue()); - pToolBar->SetQueryString(aStr); - } - } -} - -SV_IMPL_PTRARR( BibToolBarListenerArr, BibToolBarListenerPtr); - -BibToolBar::BibToolBar(Window* pParent, Link aLink, WinBits nStyle): - ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)), - aImgLst(BibResId( RID_TOOLBAR_IMGLIST )), - aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )), - aFtSource(this,WB_VCENTER), - aLBSource(this,WB_DROPDOWN), - aFtQuery(this,WB_VCENTER), - aEdQuery(this), - nMenuId(0), - nSelMenuItem(0), - aLayoutManager( aLink ), - nSymbolsSize( SFX_SYMBOLS_SIZE_SMALL ), - nOutStyle( 0 ) -{ - SvtMiscOptions aSvtMiscOptions; - nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize(); - nOutStyle = aSvtMiscOptions.GetToolboxStyle(); - - ApplyImageList(); - SetStyle(GetStyle()|nStyle); - SetOutStyle(TOOLBOX_STYLE_FLAT); - Size a2Size(GetOutputSizePixel()); - a2Size.Width()=100; - aLBSource.SetSizePixel(a2Size); - aLBSource.SetDropDownLineCount(9); - aLBSource.Show(); - aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl)); - - SvtMiscOptions().AddListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) ); - Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) ); - - aTimer.SetTimeoutHdl(LINK( this, BibToolBar, SendSelHdl)); - aTimer.SetTimeout(400); - - SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl)); - - aEdQuery.SetSizePixel(aLBSource.GetSizePixel()); - aEdQuery.Show(); - - XubString aStr=GetItemText(TBC_FT_SOURCE); - Rectangle aRect=GetItemRect(TBC_FT_SOURCE); - aFtSource.SetText(aStr); - aFtSource.SetSizePixel(aRect.GetSize()); - aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT )); - - aStr=GetItemText(TBC_FT_QUERY); - aRect=GetItemRect(TBC_FT_QUERY); - aFtQuery.SetText(aStr); - aFtQuery.SetSizePixel(aRect.GetSize()); - aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT )); - - SetItemWindow(TBC_FT_SOURCE,&aFtSource); - SetItemWindow(TBC_LB_SOURCE,&aLBSource); - SetItemWindow(TBC_FT_QUERY ,&aFtQuery); - SetItemWindow(TBC_ED_QUERY ,&aEdQuery); - - ::bib::AddToTaskPaneList( this ); -} - -BibToolBar::~BibToolBar() -{ - SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) ); - Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) ); - ::bib::RemoveFromTaskPaneList( this ); -} - -void BibToolBar::InitListener() -{ - sal_uInt16 nCount=GetItemCount(); - - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); - if( xTrans.is() ) - { - util::URL aQueryURL; - aQueryURL.Complete = C2U(".uno:Bib/MenuFilter"); - xTrans->parseStrict( aQueryURL); - BibToolBarListener* pQuery=new BibTBQueryMenuListener(this,aQueryURL.Complete,TBC_BT_AUTOFILTER); - xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL); - - for(sal_uInt16 nPos=0;nPosparseStrict( aURL ); - - BibToolBarListener* pListener=NULL; - if(nId==TBC_LB_SOURCE) - { - pListener=new BibTBListBoxListener(this,aURL.Complete,nId); - } - else if(nId==TBC_ED_QUERY) - { - pListener=new BibTBEditListener(this,aURL.Complete,nId); - } - else - { - pListener=new BibToolBarListener(this,aURL.Complete,nId); - } - - BibToolBarListenerPtr pxInsert = new Reference; - (*pxInsert) = pListener; - aListenerArr.Insert( pxInsert, aListenerArr.Count() ); - xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pListener),aURL); - } - } -} - -void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCtr) -{ - xController=xCtr; - InitListener(); - -} - -void BibToolBar::Select() -{ - sal_uInt16 nId=GetCurItemId(); - - if(nId!=TBC_BT_AUTOFILTER) - { - SendDispatch(nId,Sequence() ); - } - else - { - Sequence aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name=C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(nId,aPropVal); - } -} - -void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs) -{ - rtl::OUString aCommand = GetItemCommand(nId); - - uno::Reference< frame::XDispatchProvider > xDSP( xController, UNO_QUERY ); - - if( xDSP.is() && aCommand.getLength()) - { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); - if( xTrans.is() ) - { - // Datei laden - util::URL aURL; - aURL.Complete = aCommand; - - xTrans->parseStrict( aURL ); - - uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, rtl::OUString(), frame::FrameSearchFlag::SELF ); - - if ( xDisp.is() ) - xDisp->dispatch( aURL, rArgs); - } - } - -} - -void BibToolBar::Click() -{ - sal_uInt16 nId=GetCurItemId(); - - if(nId == TBC_BT_COL_ASSIGN ) - { - if(pDatMan) - pDatMan->CreateMappingDialog(GetParent()); - CheckItem( nId, sal_False ); - } - else if(nId == TBC_BT_CHANGESOURCE) - { - if(pDatMan) - { - OUString sNew = pDatMan->CreateDBChangeDialog(GetParent()); - if(sNew.getLength()) - pDatMan->setActiveDataSource(sNew); - } - CheckItem( nId, sal_False ); - } -} - -void BibToolBar::ClearFilterMenu() -{ - aPopupMenu.Clear(); - nMenuId=0; -} -sal_uInt16 BibToolBar::InsertFilterItem(const XubString& aMenuEntry) -{ - nMenuId++; - aPopupMenu.InsertItem(nMenuId,aMenuEntry); - - return nMenuId; -} -void BibToolBar::SelectFilterItem(sal_uInt16 nId) -{ - aPopupMenu.CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) ); -} - -void BibToolBar::EnableSourceList(sal_Bool bFlag) -{ - aFtSource.Enable(bFlag); - aLBSource.Enable(bFlag); -} - -void BibToolBar::ClearSourceList() -{ - aLBSource.Clear(); -} - -void BibToolBar::UpdateSourceList(sal_Bool bFlag) -{ - aLBSource.SetUpdateMode(bFlag); -} - -void BibToolBar::InsertSourceEntry(const XubString& aEntry, sal_uInt16 nPos) -{ - aLBSource.InsertEntry(aEntry, nPos); -} - -void BibToolBar::SelectSourceEntry(const XubString& aStr) -{ - aLBSource.SelectEntry(aStr); -} - -void BibToolBar::EnableQuery(sal_Bool bFlag) -{ - aFtQuery.Enable(bFlag); - aEdQuery.Enable(bFlag); -} - -void BibToolBar::SetQueryString(const XubString& aStr) -{ - aEdQuery.SetText(aStr); -} - - -long BibToolBar::PreNotify( NotifyEvent& rNEvt ) -{ - long nResult=sal_True; - - sal_uInt16 nSwitch=rNEvt.GetType(); - if(aEdQuery.HasFocus() && nSwitch==EVENT_KEYINPUT) - { - const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - if(nKey == KEY_RETURN) - { - Sequence aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(TBC_BT_AUTOFILTER,aPropVal); - return nResult; - } - - } - - nResult=ToolBox::PreNotify(rNEvt); - - return nResult; -} - -IMPL_LINK( BibToolBar, SelHdl, ListBox*, /*pLb*/ ) -{ - aTimer.Start(); - return 0; -} - -IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/) -{ - Sequence aPropVal(1); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("DataSourceName"); - String aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) ); - rtl::OUString aSelection = aEntry; - pPropertyVal[0].Value <<= aSelection; - SendDispatch(TBC_LB_SOURCE,aPropVal); - - return 0; -} -//----------------------------------------------------------------------------- -IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/) -{ - sal_uInt16 nId=GetCurItemId(); - if(nId==TBC_BT_AUTOFILTER) - { - EndSelection(); // vor SetDropMode (SetDropMode ruft SetItemImage) - - SetItemDown(TBC_BT_AUTOFILTER,sal_True); - nId = aPopupMenu.Execute(this, GetItemRect(TBC_BT_AUTOFILTER)); - - - if(nId>0) - { - aPopupMenu.CheckItem(nSelMenuItem,sal_False); - aPopupMenu.CheckItem(nId); - nSelMenuItem=nId; - aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) ); - Sequence aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); - pPropertyVal[0].Name = C2U("QueryText"); - rtl::OUString aSelection = aEdQuery.GetText(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name=C2U("QueryField"); - pPropertyVal[1].Value <<= aQueryField; - SendDispatch(TBC_BT_AUTOFILTER,aPropVal); - } - - Point aPoint; - MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC ); - MouseMove( aLeave ); - SetItemDown(TBC_BT_AUTOFILTER,sal_False); - - - } - return 0; -} -//----------------------------------------------------------------------------- -void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent) - throw( uno::RuntimeException ) -{ - for(sal_uInt16 i = 0; i < aListenerArr.Count(); i++) - { - BibToolBarListenerPtr pListener = aListenerArr.GetObject(i); - (*pListener)->statusChanged(rEvent); - } -} - -void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - ApplyImageList(); - ToolBox::DataChanged( rDCEvt ); -} - -IMPL_LINK( BibToolBar, OptionsChanged_Impl, void*, /*pVoid*/ ) -{ - sal_Bool bRebuildToolBar = sal_False; - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); - if ( nSymbolsSize != eSymbolsSize ) - { - nSymbolsSize = eSymbolsSize; - bRebuildToolBar = sal_True; - } - else if ( nOutStyle != SvtMiscOptions().GetToolboxStyle() ) - { - nOutStyle = SvtMiscOptions().GetToolboxStyle(); - SetOutStyle( nOutStyle ); - bRebuildToolBar = sal_True; - } - - if ( bRebuildToolBar ) - RebuildToolbar(); - - return 0L; -} - -//----------------------------------------------------------------------------- - -IMPL_LINK( BibToolBar, SettingsChanged_Impl, void*, /*pVoid*/ ) -{ - // Check if toolbar button size have changed and we have to use system settings - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); - if ( eSymbolsSize != nSymbolsSize ) - { - nSymbolsSize = eSymbolsSize; - RebuildToolbar(); - } - - return 0L; -} - -//----------------------------------------------------------------------------- -void BibToolBar::RebuildToolbar() -{ - ApplyImageList(); - // We have to call parent asynchronously as SetSize works also asynchronously! - Application::PostUserEvent( aLayoutManager, 0 ); -} - -//----------------------------------------------------------------------------- - -void BibToolBar::ApplyImageList() -{ - ImageList& rList = ( nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ) ? - ( aImgLst ) : - ( aBigImgLst ); - - SetItemImage(TBC_BT_AUTOFILTER , rList.GetImage(SID_FM_AUTOFILTER)); - SetItemImage(TBC_BT_FILTERCRIT , rList.GetImage(SID_FM_FILTERCRIT)); - SetItemImage(TBC_BT_REMOVEFILTER, rList.GetImage(SID_FM_REMOVE_FILTER_SORT )); - AdjustToolBox(); -} - -void BibToolBar::AdjustToolBox() -{ - Size aOldSize = GetSizePixel(); - Size aSize = CalcWindowSizePixel(); - if ( !aSize.Width() ) - aSize.Width() = aOldSize.Width(); - else if ( !aSize.Height() ) - aSize.Height() = aOldSize.Height(); - - Size aTbSize = GetSizePixel(); - if ( - (aSize.Width() && aSize.Width() != aTbSize.Width()) || - (aSize.Height() && aSize.Height() != aTbSize.Height()) - ) - { - SetPosSizePixel( GetPosPixel(), aSize ); - Invalidate(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/toolbar.hrc b/extensions/source/bibliography/toolbar.hrc deleted file mode 100644 index 7349bd2c2..000000000 --- a/extensions/source/bibliography/toolbar.hrc +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "bib.hrc" - -#define TBC_FT_SOURCE 1 -#define TBC_LB_SOURCE 2 -#define TBC_FT_QUERY 3 -#define TBC_ED_QUERY 4 -#define TBC_BT_AUTOFILTER 5 -#define TBC_BT_FILTERCRIT 6 -#define TBC_BT_REMOVEFILTER 7 -#define TBC_BT_NEWCARD 8 -#define TBC_BT_EDITCARD 9 -#define TBC_BT_REMOVECARD 10 -#define TBC_BT_INSERT 11 -#define TBC_BT_UPDATE 12 -#define TBC_BT_MAIL 13 -#define TBC_BT_URL 14 -#define TBC_BT_COL_ASSIGN 15 -#define TBC_BT_CHANGESOURCE 16 -#define IL_TOOLBOX 17 -#define ILH_TOOLBOX 18 diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx deleted file mode 100644 index 4601fca0d..000000000 --- a/extensions/source/bibliography/toolbar.hxx +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BIB_TOOLBAR_HXX -#define _BIB_TOOLBAR_HXX - -#include -#include - - -#include -#include -#include -#include -#include -#include -#include // helper for implementations - -class BibDataManager; -class BibToolBar; - -class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener> -{ -private: - - sal_uInt16 nIndex; - rtl::OUString aCommand; - -protected: - - BibToolBar *pToolBar; - -public: - - BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibToolBarListener(); - - rtl::OUString GetCommand() const; - - // ::com::sun::star::lang::XEventListener - // we do not hold References to dispatches, so there is nothing to do on disposal - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& /*Source*/) - throw( ::com::sun::star::uno::RuntimeException ){}; - - // ::com::sun::star::frame::XStatusListener - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBListBoxListener: public BibToolBarListener -{ -public: - - BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBListBoxListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBEditListener: public BibToolBarListener -{ -public: - - BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBEditListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - -class BibTBQueryMenuListener: public BibToolBarListener -{ -public: - - BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId); - ~BibTBQueryMenuListener(); - - virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - -}; - - -typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr; -SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 ) - -class BibToolBar: public ToolBox -{ - private: - - BibToolBarListenerArr aListenerArr; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController; - Timer aTimer; - ImageList aImgLst; - ImageList aImgLstHC; - ImageList aBigImgLst; - ImageList aBigImgLstHC; - FixedText aFtSource; - ListBox aLBSource; - FixedText aFtQuery; - Edit aEdQuery; - PopupMenu aPopupMenu; - sal_uInt16 nMenuId; - sal_uInt16 nSelMenuItem; - rtl::OUString aQueryField; - Link aLayoutManager; - sal_Int16 nSymbolsSize; - sal_Int16 nOutStyle; - - BibDataManager* pDatMan; - DECL_LINK( SelHdl, ListBox* ); - DECL_LINK( SendSelHdl, Timer* ); - DECL_LINK( MenuHdl, ToolBox* ); - DECL_LINK( OptionsChanged_Impl, void* ); - DECL_LINK( SettingsChanged_Impl, void* ); - - void ApplyImageList(); - void RebuildToolbar(); - - protected: - - void DataChanged( const DataChangedEvent& rDCEvt ); - void InitListener(); - virtual void Select(); - virtual void Click(); - long PreNotify( NotifyEvent& rNEvt ); - - - public: - - BibToolBar(Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK ); - ~BibToolBar(); - - void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &); - - void ClearSourceList(); - void UpdateSourceList(sal_Bool bFlag=sal_True); - void EnableSourceList(sal_Bool bFlag=sal_True); - void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND ); - void SelectSourceEntry(const XubString& ); - - void EnableQuery(sal_Bool bFlag=sal_True); - void SetQueryString(const XubString& ); - void AdjustToolBox(); - - void ClearFilterMenu(); - sal_uInt16 InsertFilterItem(const XubString& ); - void SelectFilterItem(sal_uInt16 nId); - - void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) - throw( ::com::sun::star::uno::RuntimeException ); - - void SetDatMan(BibDataManager& rDatMan) {pDatMan = &rDatMan;} - void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs); -}; - - - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/bibliography/toolbar.src b/extensions/source/bibliography/toolbar.src deleted file mode 100644 index c712bc1c3..000000000 --- a/extensions/source/bibliography/toolbar.src +++ /dev/null @@ -1,153 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -#include "bibliography.hrc" -#include "toolbar.hrc" -#include "svx/svxcommands.h" - -#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - -ToolBox RID_BIB_TOOLBAR -{ - HelpId = HID_BIB_DB_TBX; - Sizeable = TRUE ; - HideWhenDeactivate = TRUE ; - LineSpacing = TRUE ; - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 200 , 16 ) ; - ButtonType = BUTTON_SYMBOL ; - ItemList = - { - ToolBoxItem - { - Identifier = TBC_FT_SOURCE; - Text [ en-US ] = "Table"; - }; - ToolBoxItem - { - Identifier = TBC_LB_SOURCE; - HelpID = HID_BIB_TBX_TABLE; - Command = ".uno:Bib/source" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - - ToolBoxItem - { - Identifier = TBC_FT_QUERY; - Text [ en-US ] = "Search Key"; - }; - ToolBoxItem - { - Identifier = TBC_ED_QUERY; - HelpID = HID_BIB_TBX_SEARCH; - Command = ".uno:Bib/query" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - - ToolBoxItem - { - Identifier = TBC_BT_AUTOFILTER ; - HelpID = HID_BIB_TBX_AUTOFILTER; -// ItemBitmap = Bitmap { File = "sc10716.bmp" ; }; - DropDown = TRUE ; - Command = ".uno:Bib/autoFilter" ; - Text [ en-US ] = "AutoFilter"; - }; - - ToolBoxItem - { - Identifier = TBC_BT_FILTERCRIT ; -// ItemBitmap = Bitmap { File = "sc10715.bmp" ; }; -// Text [ de ] = "Standard Filter" ; - Command = ".uno:Bib/standardFilter" ; - Text [ en-US ] = "Standard Filter"; - }; - - ToolBoxItem - { - Identifier = TBC_BT_REMOVEFILTER ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Command = ".uno:Bib/removeFilter" ; - Text [ en-US ] = "Remove Filter"; - }; - ToolBoxItem - { - Identifier = TBC_BT_COL_ASSIGN ; - HelpId = HID_BIB_MAPPINGDLG; -// Command = ".uno:Bib/Mapping" ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Text [ en-US ] = "Column Arrangement"; - }; - ToolBoxItem - { - Identifier = TBC_BT_CHANGESOURCE ; - HelpId = HID_BIB_CHANGESOURCE; - Command = ".uno:Bib/sdbsource" ; -// ItemBitmap = Bitmap { File = "sc10711.bmp" ; }; - Checkable=TRUE; - Text [ en-US ] = "Data Source"; - }; - }; - Scroll = TRUE ; -}; -#define BIB_IMAGES \ - IdList = \ - { \ - SID_FM_AUTOFILTER; /*10716*/ \ - SID_FM_FILTERCRIT; /*10715*/ \ - SID_FM_REMOVE_FILTER_SORT ; /*10711*/ \ - }; \ - IdCount = { 3; }; - -ImageList RID_TOOLBAR_IMGLIST -{ - Prefix = "sc"; - MASKCOLOR - BIB_IMAGES -}; - -ImageList RID_TOOLBAR_BIGIMGLIST -{ - Prefix = "lc"; - MASKCOLOR - BIB_IMAGES -}; - - - - - - - diff --git a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml deleted file mode 100644 index 817473af0..000000000 --- a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/config/ldap/componentdef.cxx b/extensions/source/config/ldap/componentdef.cxx deleted file mode 100644 index 6d38e2090..000000000 --- a/extensions/source/config/ldap/componentdef.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "ldapuserprofilebe.hxx" -#include - -using namespace extensions::config::ldap ; - -//============================================================================== - -static uno::Reference SAL_CALL createLdapUserProfileBe( - const uno::Reference& aContext) { - return * new LdapUserProfileBe(aContext) ; -} -//------------------------------------------------------------------------------ - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createLdapUserProfileBe, - LdapUserProfileBe::getLdapUserProfileBeName, - LdapUserProfileBe::getLdapUserProfileBeServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; -//------------------------------------------------------------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char *aImplementationName, - void *aServiceManager, - void *aRegistryKey) { - return cppu::component_getFactoryHelper(aImplementationName, - aServiceManager, - aRegistryKey, - kImplementations_entries) ; -} -//------------------------------------------------------------------------------ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/exports.dxp b/extensions/source/config/ldap/exports.dxp deleted file mode 100644 index 700330789..000000000 --- a/extensions/source/config/ldap/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx deleted file mode 100644 index 089b9353e..000000000 --- a/extensions/source/config/ldap/ldapaccess.cxx +++ /dev/null @@ -1,321 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "ldapaccess.hxx" - -#include -#include - - -namespace extensions { namespace config { namespace ldap { - -oslModule LdapConnection::s_Ldap_Module = NULL; -t_ldap_unbind_s LdapConnection::s_p_unbind_s = NULL; -t_ldap_simple_bind_s LdapConnection::s_p_simple_bind_s = NULL; -t_ldap_set_option LdapConnection::s_p_set_option = NULL; -t_ldap_err2string LdapConnection::s_p_err2string = NULL; -t_ldap_init LdapConnection::s_p_init = NULL; -t_ldap_msgfree LdapConnection::s_p_msgfree = NULL; -t_ldap_get_dn LdapConnection::s_p_get_dn = NULL; -t_ldap_first_entry LdapConnection::s_p_first_entry = NULL; -t_ldap_first_attribute LdapConnection::s_p_first_attribute = NULL; -t_ldap_next_attribute LdapConnection::s_p_next_attribute = NULL; -t_ldap_search_s LdapConnection::s_p_search_s = NULL; -t_ldap_value_free LdapConnection::s_p_value_free = NULL; -t_ldap_get_values LdapConnection::s_p_get_values = NULL; -t_ldap_memfree LdapConnection::s_p_memfree = NULL; -//------------------------------------------------------------------------------ -typedef int LdapErrCode; -//------------------------------------------------------------------------------ -struct LdapMessageHolder -{ - LdapMessageHolder() : msg(0) {} - ~LdapMessageHolder() - { - if (msg) - (*LdapConnection::s_p_msgfree)(msg); - } - - LDAPMessage * msg; - -private: - LdapMessageHolder(LdapMessageHolder const&); - void operator=(LdapMessageHolder const&); -}; -//------------------------------------------------------------------------------ -LdapConnection::~LdapConnection() -{ - if (isValid()) disconnect(); -} -//------------------------------------------------------------------------------ - -void LdapConnection::disconnect() -{ - if (mConnection != NULL) - { - (*s_p_unbind_s)(mConnection) ; - mConnection = NULL; - } -} -//------------------------------------------------------------------------------ - -static void checkLdapReturnCode(const sal_Char *aOperation, - LdapErrCode aRetCode, - LDAP * /*aConnection*/) -{ - if (aRetCode == LDAP_SUCCESS) { return ; } - - static const sal_Char *kNoSpecificMessage = "No additional information" ; - rtl::OUStringBuffer message ; - - if (aOperation != NULL) - { - message.appendAscii(aOperation).appendAscii(": ") ; - } - message.appendAscii((*LdapConnection::s_p_err2string)(aRetCode)).appendAscii(" (") ; - sal_Char *stub = NULL ; - -#ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP - (*s_p_get_lderrno)(aConnection, NULL, &stub) ; -#endif - if (stub != NULL) - { - message.appendAscii(stub) ; - // It would seem the message returned is actually - // not a copy of a string but rather some static - // string itself. At any rate freeing it seems to - // cause some undue problems at least on Windows. - // This call is thus disabled for the moment. - //(*s_p_memfree)(stub) ; - } - else { message.appendAscii(kNoSpecificMessage) ; } - message.appendAscii(")") ; - throw ldap::LdapGenericException(message.makeStringAndClear(), - NULL, aRetCode) ; -} -//------------------------------------------------------------------------------ -void LdapConnection::connectSimple(const LdapDefinition& aDefinition) - throw (ldap::LdapConnectionException, ldap::LdapGenericException) -{ - OSL_ENSURE(!isValid(), "Recoonecting an LDAP connection that is already established"); - if (isValid()) disconnect(); - - mLdapDefinition = aDefinition; - connectSimple(); -} -//------------------------------------------------------------------------------ -void LdapConnection::connectSimple() - throw (ldap::LdapConnectionException, ldap::LdapGenericException) -{ - if (!isValid()) - { - // Connect to the server - initConnection() ; - // Set Protocol V3 - int version = LDAP_VERSION3; - (*s_p_set_option)(mConnection, - LDAP_OPT_PROTOCOL_VERSION, - &version); - -#ifdef LDAP_X_OPT_CONNECT_TIMEOUT // OpenLDAP doesn't support this and the func - /* timeout is specified in milliseconds -> 4 seconds*/ - int timeout = 4000; - (*s_p_set_option)( mConnection, - LDAP_X_OPT_CONNECT_TIMEOUT, - &timeout ); -#endif - - // Do the bind - LdapErrCode retCode = (*s_p_simple_bind_s)(mConnection, - mLdapDefinition.mAnonUser , - mLdapDefinition.mAnonCredentials) ; - - checkLdapReturnCode("SimpleBind", retCode, mConnection) ; - } -} -//------------------------------------------------------------------------------ -void LdapConnection::initConnection() - throw (ldap::LdapConnectionException) -{ - if (mLdapDefinition.mServer.getLength() == 0) - { - rtl::OUStringBuffer message ; - - message.appendAscii("Cannot initialise connection to LDAP: No server specified.") ; - throw ldap::LdapConnectionException(message.makeStringAndClear(), NULL) ; - } - - if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT; - - mConnection = (*s_p_init)(mLdapDefinition.mServer, - mLdapDefinition.mPort) ; - if (mConnection == NULL) - { - rtl::OUStringBuffer message ; - - message.appendAscii("Cannot initialise connection to LDAP server ") ; - message.appendAscii(mLdapDefinition.mServer) ; - message.appendAscii(":") ; - message.append(mLdapDefinition.mPort) ; - throw ldap::LdapConnectionException(message.makeStringAndClear(), - NULL) ; - } -} -//------------------------------------------------------------------------------ - void LdapConnection::getUserProfile( - const rtl::OUString& aUser, LdapData * data) - throw (lang::IllegalArgumentException, - ldap::LdapConnectionException, ldap::LdapGenericException) -{ - OSL_ASSERT(data != 0); - if (!isValid()) { connectSimple(); } - - rtl::OString aUserDn =findUserDn( rtl::OUStringToOString(aUser, RTL_TEXTENCODING_ASCII_US)); - - LdapMessageHolder result; - LdapErrCode retCode = (*s_p_search_s)(mConnection, - aUserDn, - LDAP_SCOPE_BASE, - "(objectclass=*)", - 0, - 0, // Attributes + values - &result.msg) ; - - checkLdapReturnCode("getUserProfile", retCode,mConnection) ; - - void * ptr; - char * attr = (*s_p_first_attribute)(mConnection, result.msg, &ptr); - while (attr != 0) { - char ** values = (*s_p_get_values)(mConnection, result.msg, attr); - if (values != 0) { - data->insert( - LdapData::value_type( - rtl::OStringToOUString(attr, RTL_TEXTENCODING_ASCII_US), - rtl::OStringToOUString(*values, RTL_TEXTENCODING_UTF8))); - (*s_p_value_free)(values); - } - attr = (*s_p_next_attribute)(mConnection, result.msg, ptr); - } -} -//------------------------------------------------------------------------------ - rtl::OString LdapConnection::findUserDn(const rtl::OString& aUser) - throw (lang::IllegalArgumentException, - ldap::LdapConnectionException, ldap::LdapGenericException) -{ - if (!isValid()) { connectSimple(); } - - if (aUser.getLength() == 0) - { - throw lang::IllegalArgumentException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM - ("LdapConnection::findUserDn -User id is empty")), - NULL, 0) ; - } - - - - rtl::OStringBuffer filter( "(&(objectclass=" ); - - filter.append( mLdapDefinition.mUserObjectClass ).append(")(") ; - filter.append( mLdapDefinition.mUserUniqueAttr ).append("=").append(aUser).append("))") ; - - LdapMessageHolder result; - sal_Char * attributes [2]; - attributes[0]= const_cast(LDAP_NO_ATTRS); - attributes[1]= NULL; - LdapErrCode retCode = (*s_p_search_s)(mConnection, - mLdapDefinition.mBaseDN, - LDAP_SCOPE_SUBTREE, - filter.makeStringAndClear(), attributes, 0, &result.msg) ; - - checkLdapReturnCode("FindUserDn", retCode,mConnection) ; - rtl::OString userDn ; - LDAPMessage *entry = (*s_p_first_entry)(mConnection, result.msg) ; - - if (entry != NULL) - { - sal_Char *charsDn = (*s_p_get_dn)(mConnection, entry) ; - - userDn = charsDn ; - (*s_p_memfree)(charsDn) ; - } - else - { - OSL_FAIL( "LdapConnection::findUserDn-could not get DN for User "); - } - - return userDn ; -} - -extern "C" { static void SAL_CALL thisModule() {} } -void LdapConnection::loadModule() -{ - if ( !s_Ldap_Module ) - { -#if defined(WNT) -# define LIBLDAP "nsldap32v50.dll" -#else -# ifdef WITH_OPENLDAP -# define xstr(s) str(s) -# define str(s) #s -# define LIBLDAP "libldap-" xstr(LDAP_VENDOR_VERSION_MAJOR) "." xstr(LDAP_VENDOR_VERSION_MINOR) ".so." xstr(LDAP_VENDOR_VERSION_MAJOR) -# else -# define LIBLDAP "libldap50.so" -# endif -#endif - const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(LIBLDAP)); - - // load the dbtools library - s_Ldap_Module = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0); - if ( s_Ldap_Module != NULL ) - { - s_p_unbind_s = (t_ldap_unbind_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_unbind_s")).pData)); - s_p_simple_bind_s = (t_ldap_simple_bind_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_simple_bind_s")).pData)); - s_p_set_option = (t_ldap_set_option)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_set_option")).pData)); - s_p_err2string = (t_ldap_err2string)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_err2string")).pData)); - s_p_init = (t_ldap_init)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_init")).pData)); - s_p_msgfree = (t_ldap_msgfree)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_msgfree")).pData)); - s_p_get_dn = (t_ldap_get_dn)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_get_dn")).pData)); - s_p_first_entry = (t_ldap_first_entry)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_first_entry")).pData)); - s_p_first_attribute = (t_ldap_first_attribute)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_first_attribute")).pData)); - s_p_next_attribute = (t_ldap_next_attribute)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_next_attribute")).pData)); - s_p_search_s = (t_ldap_search_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_search_s")).pData)); - s_p_value_free = (t_ldap_value_free)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_value_free")).pData)); - s_p_get_values = (t_ldap_get_values)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_get_values")).pData)); - s_p_memfree = (t_ldap_memfree)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ldap_memfree")).pData)); - } - } -} - -//------------------------------------------------------------------------------ -} } } // extensions.config.ldap - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/ldapaccess.hxx b/extensions/source/config/ldap/ldapaccess.hxx deleted file mode 100644 index a9bcbee58..000000000 --- a/extensions/source/config/ldap/ldapaccess.hxx +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_ -#define EXTENSIONS_CONFIG_LDAP_LDAPACCESS_HXX_ - -#include "sal/config.h" - -#include - -#include "wrapldapinclude.hxx" -#include - -#include -#include -#include - -namespace extensions { namespace config { namespace ldap { - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace ldap = css::ldap ; -//------------------------------------------------------------------------------ -// LdapUserProfile classes -struct LdapUserProfile; -class LdapUserProfileMap; - -typedef LDAP_API(int) (LDAP_CALL *t_ldap_unbind_s)( LDAP *ld ); -typedef LDAP_API(int) (LDAP_CALL *t_ldap_simple_bind_s)( LDAP *ld, const char *who, const char *passwd ); -typedef LDAP_API(int) (LDAP_CALL *t_ldap_set_option)( LDAP *ld, int option, const void *optdata ); -typedef LDAP_API(char *) (LDAP_CALL *t_ldap_err2string)( int err ); -typedef LDAP_API(LDAP *) (LDAP_CALL *t_ldap_init)( const char *defhost, int defport ); -typedef LDAP_API(int) (LDAP_CALL *t_ldap_msgfree)( LDAPMessage *lm ); -typedef LDAP_API(char *) (LDAP_CALL *t_ldap_get_dn)( LDAP *ld, LDAPMessage *entry ); -typedef LDAP_API(LDAPMessage *) (LDAP_CALL *t_ldap_first_entry)( LDAP *ld, LDAPMessage *chain ); -typedef LDAP_API(char *) (LDAP_CALL *t_ldap_first_attribute)( LDAP *ld, LDAPMessage *entry, void **ptr ); -typedef LDAP_API(char *) (LDAP_CALL *t_ldap_next_attribute)( LDAP *ld, LDAPMessage *entry, void *ptr ); -typedef LDAP_API(int) (LDAP_CALL *t_ldap_search_s)( LDAP *ld, const char *base, int scope, const char *filter, char **attrs, int attrsonly, LDAPMessage **res ); -typedef LDAP_API(void) (LDAP_CALL *t_ldap_value_free)( char **vals ); -typedef LDAP_API(char **) (LDAP_CALL *t_ldap_get_values)( LDAP *ld, LDAPMessage *entry, const char *target ); -typedef LDAP_API(void) (LDAP_CALL *t_ldap_memfree)( void *p ); -//------------------------------------------------------------------------------ -/** Struct containing the information on LDAP connection */ -struct LdapDefinition -{ - /** LDAP server name */ - rtl::OString mServer ; - /** LDAP server port number */ - sal_Int32 mPort ; - /** Repository base DN */ - rtl::OString mBaseDN ; - /** DN to use for "anonymous" connection */ - rtl::OString mAnonUser ; - /** Credentials to use for "anonymous" connection */ - rtl::OString mAnonCredentials ; - /** User Entity Object Class */ - rtl::OString mUserObjectClass; - /** User Entity Unique Attribute */ - rtl::OString mUserUniqueAttr; - } ; - -typedef std::map< rtl::OUString, rtl::OUString > LdapData; // key/value pairs - -/** Class encapulating all LDAP functionality */ -class LdapConnection -{ - friend struct LdapMessageHolder; -public: - - /** Default constructor */ - LdapConnection(void) : mConnection(NULL),mLdapDefinition() {} - /** Destructor, releases the connection */ - ~LdapConnection(void) ; - /** Make connection to LDAP server */ - void connectSimple(const LdapDefinition& aDefinition) - throw (ldap::LdapConnectionException, - ldap::LdapGenericException); - - /** - Gets LdapUserProfile from LDAP repository for specified user - @param aUser name of logged on user - @param aUserProfileMap Map containing LDAP->00o mapping - @param aUserProfile struct for holding OOo values - - @throws com::sun::star::ldap::LdapGenericException - if an LDAP error occurs. - */ - void getUserProfile(const rtl::OUString& aUser, LdapData * data) - throw (lang::IllegalArgumentException, - ldap::LdapConnectionException, - ldap::LdapGenericException); - - /** finds DN of user - @return DN of User - */ - rtl::OString findUserDn(const rtl::OString& aUser) - throw (lang::IllegalArgumentException, - ldap::LdapConnectionException, - ldap::LdapGenericException); - - void loadModule(); - - static t_ldap_err2string s_p_err2string; -private: - - void initConnection() - throw (ldap::LdapConnectionException); - void disconnect(); - /** - Indicates whether the connection is in a valid state. - @return sal_True if connection is valid, sal_False otherwise - */ - bool isValid(void) const { return mConnection != NULL ; } - - void connectSimple() - throw (ldap::LdapConnectionException, - ldap::LdapGenericException); - - /** LDAP connection object */ - LDAP* mConnection ; - LdapDefinition mLdapDefinition; - - static oslModule s_Ldap_Module; - static t_ldap_value_free s_p_value_free; - static t_ldap_get_values s_p_get_values; - static t_ldap_unbind_s s_p_unbind_s; - static t_ldap_simple_bind_s s_p_simple_bind_s; - static t_ldap_set_option s_p_set_option; - static t_ldap_init s_p_init; - static t_ldap_msgfree s_p_msgfree; - static t_ldap_get_dn s_p_get_dn; - static t_ldap_first_entry s_p_first_entry; - static t_ldap_first_attribute s_p_first_attribute; - static t_ldap_next_attribute s_p_next_attribute; - static t_ldap_search_s s_p_search_s; - - static t_ldap_memfree s_p_memfree; - -} ; -//------------------------------------------------------------------------------ -}} } - -#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/ldapbe2.component b/extensions/source/config/ldap/ldapbe2.component deleted file mode 100644 index 071064d1c..000000000 --- a/extensions/source/config/ldap/ldapbe2.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx deleted file mode 100644 index 0a1c3a4be..000000000 --- a/extensions/source/config/ldap/ldapuserprofilebe.cxx +++ /dev/null @@ -1,279 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "ldapaccess.hxx" -#include "ldapuserprofilebe.hxx" -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//============================================================================== -namespace extensions { namespace config { namespace ldap { - -LdapUserProfileBe::LdapUserProfileBe( const uno::Reference& xContext) -: LdapProfileMutexHolder(), - BackendBase(mMutex) -{ - LdapDefinition aDefinition; - rtl::OUString loggedOnUser; - - // This whole rigmarole is to prevent an infinite recursion where reading - // the configuration for the backend would create another instance of the - // backend, which would try and read the configuration which would... - { - osl::Mutex & aInitMutex = rtl::Static< osl::Mutex, LdapUserProfileBe >::get(); - osl::MutexGuard aInitGuard(aInitMutex); - - static bool bReentrantCall; // = false - OSL_ENSURE(!bReentrantCall, "configuration: Ldap Backend constructor called reentrantly - probably a registration error."); - - if (!bReentrantCall) - { - try - { - bReentrantCall = true ; - if (!readLdapConfiguration( - css::uno::Reference< css::lang::XMultiServiceFactory >( - xContext->getServiceManager(), - css::uno::UNO_QUERY_THROW), - &aDefinition, &loggedOnUser)) - { - throw css::uno::RuntimeException( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LdapUserProfileBe- LDAP not configured")), - NULL); - } - - bReentrantCall = false ; - } - catch (...) - { - bReentrantCall = false; - throw; - } - } - } - - LdapConnection connection; - connection.loadModule(); - connection.connectSimple(aDefinition); - connection.getUserProfile(loggedOnUser, &data_); -} -//------------------------------------------------------------------------------ -LdapUserProfileBe::~LdapUserProfileBe() -{ -} -//------------------------------------------------------------------------------ - -bool LdapUserProfileBe::readLdapConfiguration( - css::uno::Reference< css::lang::XMultiServiceFactory > const & factory, - LdapDefinition * definition, rtl::OUString * loggedOnUser) -{ - OSL_ASSERT(factory.is() && definition != 0 && loggedOnUser != 0); - const rtl::OUString kConfigurationProviderService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")) ; - const rtl::OUString kReadOnlyViewService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")) ; - const rtl::OUString kComponent( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.LDAP/UserDirectory")); - const rtl::OUString kServerDefiniton(RTL_CONSTASCII_USTRINGPARAM ("ServerDefinition")); - const rtl::OUString kServer(RTL_CONSTASCII_USTRINGPARAM ("Server")); - const rtl::OUString kPort(RTL_CONSTASCII_USTRINGPARAM("Port")); - const rtl::OUString kBaseDN(RTL_CONSTASCII_USTRINGPARAM("BaseDN")); - const rtl::OUString kUser(RTL_CONSTASCII_USTRINGPARAM("SearchUser")); - const rtl::OUString kPassword(RTL_CONSTASCII_USTRINGPARAM("SearchPassword")); - const rtl::OUString kUserObjectClass(RTL_CONSTASCII_USTRINGPARAM("UserObjectClass")); - const rtl::OUString kUserUniqueAttr(RTL_CONSTASCII_USTRINGPARAM("UserUniqueAttribute")); - - uno::Reference< XInterface > xIface; - try - { - uno::Reference< lang::XMultiServiceFactory > xCfgProvider( - factory->createInstance(kConfigurationProviderService), - uno::UNO_QUERY); - OSL_ENSURE(xCfgProvider.is(),"LdapUserProfileBe: could not create the configuration provider"); - if (!xCfgProvider.is()) - return false; - - css::beans::NamedValue aPath(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), uno::makeAny(kComponent) ); - - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= aPath; - - xIface = xCfgProvider->createInstanceWithArguments(kReadOnlyViewService, aArgs); - - uno::Reference xAccess(xIface, uno::UNO_QUERY_THROW); - xAccess->getByName(kServerDefiniton) >>= xIface; - - uno::Reference xChildAccess(xIface, uno::UNO_QUERY_THROW); - - if (!getLdapStringParam(xChildAccess, kServer, definition->mServer)) - return false; - if (!getLdapStringParam(xChildAccess, kBaseDN, definition->mBaseDN)) - return false; - - definition->mPort=0; - xChildAccess->getByName(kPort) >>= definition->mPort ; - if (definition->mPort == 0) - return false; - - if (!getLdapStringParam(xAccess, kUserObjectClass, definition->mUserObjectClass)) - return false; - if (!getLdapStringParam(xAccess, kUserUniqueAttr, definition->mUserUniqueAttr)) - return false; - - getLdapStringParam(xAccess, kUser, definition->mAnonUser); - getLdapStringParam(xAccess, kPassword, definition->mAnonCredentials); - } - catch (uno::Exception & e) - { - OSL_TRACE("LdapUserProfileBackend: access to configuration data failed: %s", - rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); - return false; - } - - osl::Security aSecurityContext; - if (!aSecurityContext.getUserName(*loggedOnUser)) - OSL_TRACE("LdapUserProfileBackend - could not get Logged on user from system"); - - sal_Int32 nIndex = loggedOnUser->indexOf('/'); - if (nIndex > 0) - *loggedOnUser = loggedOnUser->copy(nIndex+1); - - //Remember to remove - OSL_TRACE("Logged on user is %s", rtl::OUStringToOString(*loggedOnUser,RTL_TEXTENCODING_ASCII_US).getStr()); - - return true; -} - -//------------------------------------------------------------------------------ -bool LdapUserProfileBe::getLdapStringParam( - uno::Reference& xAccess, - const rtl::OUString& aLdapSetting, - rtl::OString& aServerParameter) -{ - rtl::OUString sParam; - xAccess->getByName(aLdapSetting) >>= sParam; - aServerParameter = rtl::OUStringToOString(sParam, RTL_TEXTENCODING_ASCII_US); - - return aServerParameter.getLength() != 0; -} -//------------------------------------------------------------------------------ -void LdapUserProfileBe::setPropertyValue( - rtl::OUString const &, css::uno::Any const &) - throw ( - css::beans::UnknownPropertyException, css::beans::PropertyVetoException, - css::lang::IllegalArgumentException, css::lang::WrappedTargetException, - css::uno::RuntimeException) -{ - throw css::lang::IllegalArgumentException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")), - static_cast< cppu::OWeakObject * >(this), -1); -} - -css::uno::Any LdapUserProfileBe::getPropertyValue( - rtl::OUString const & PropertyName) - throw ( - css::beans::UnknownPropertyException, css::lang::WrappedTargetException, - css::uno::RuntimeException) -{ - for (sal_Int32 i = 0;;) { - sal_Int32 j = PropertyName.indexOf(',', i); - if (j == -1) { - j = PropertyName.getLength(); - } - if (j == i) { - throw css::beans::UnknownPropertyException( - PropertyName, static_cast< cppu::OWeakObject * >(this)); - } - LdapData::iterator k(data_.find(PropertyName.copy(i, j - i))); - if (k != data_.end()) { - return css::uno::makeAny( - css::beans::Optional< css::uno::Any >( - true, css::uno::makeAny(k->second))); - } - if (j == PropertyName.getLength()) { - break; - } - i = j + 1; - } - return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); -} - -//------------------------------------------------------------------------------ -rtl::OUString SAL_CALL LdapUserProfileBe::getLdapUserProfileBeName(void) { - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.LdapUserProfileBe")); -} -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL LdapUserProfileBe::getImplementationName(void) - throw (uno::RuntimeException) -{ - return getLdapUserProfileBeName() ; -} -//------------------------------------------------------------------------------ - -uno::Sequence SAL_CALL LdapUserProfileBe::getLdapUserProfileBeServiceNames(void) -{ - uno::Sequence aServices(1) ; - aServices[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.LdapUserProfileBe")) ; - return aServices ; -} -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL LdapUserProfileBe::supportsService(const rtl::OUString& aServiceName) - throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > const svc = getLdapUserProfileBeServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - return false; -} - -//------------------------------------------------------------------------------ - -uno::Sequence -SAL_CALL LdapUserProfileBe::getSupportedServiceNames(void) - throw (uno::RuntimeException) -{ - return getLdapUserProfileBeServiceNames() ; -} -// --------------------------------------------------------------------------------------- -}}} -// --------------------------------------------------------------------------------------- - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/ldapuserprofilebe.hxx b/extensions/source/config/ldap/ldapuserprofilebe.hxx deleted file mode 100644 index 6fced57bc..000000000 --- a/extensions/source/config/ldap/ldapuserprofilebe.hxx +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_ -#define EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ldapaccess.hxx" - -namespace extensions { namespace config { namespace ldap { - -namespace css = com::sun::star ; -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace container = css::container; - -struct LdapDefinition; - -typedef cppu::WeakComponentImplHelper2 BackendBase ; - -struct LdapProfileMutexHolder { osl::Mutex mMutex; }; -/** - Implements the PlatformBackend service, a specialization of the - XPropertySet service for retreiving LDAP user profile - configuration settings from a LDAP repsoitory. - */ -class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase -{ - public : - - LdapUserProfileBe(const uno::Reference& xContext); - ~LdapUserProfileBe(void) ; - - // XServiceInfo - virtual rtl::OUString SAL_CALL - getImplementationName( ) - throw (uno::RuntimeException) ; - - virtual sal_Bool SAL_CALL - supportsService( const rtl::OUString& aServiceName ) - throw (uno::RuntimeException) ; - - virtual uno::Sequence SAL_CALL - getSupportedServiceNames( ) - throw (uno::RuntimeException) ; - - // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL - getPropertySetInfo() throw (css::uno::RuntimeException) - { return css::uno::Reference< css::beans::XPropertySetInfo >(); } - - virtual void SAL_CALL setPropertyValue( - rtl::OUString const &, css::uno::Any const &) - throw ( - css::beans::UnknownPropertyException, - css::beans::PropertyVetoException, - css::lang::IllegalArgumentException, - css::lang::WrappedTargetException, css::uno::RuntimeException); - - virtual css::uno::Any SAL_CALL getPropertyValue( - rtl::OUString const & PropertyName) - throw ( - css::beans::UnknownPropertyException, - css::lang::WrappedTargetException, css::uno::RuntimeException); - - virtual void SAL_CALL addPropertyChangeListener( - rtl::OUString const &, - css::uno::Reference< css::beans::XPropertyChangeListener > const &) - throw ( - css::beans::UnknownPropertyException, - css::lang::WrappedTargetException, css::uno::RuntimeException) - {} - - virtual void SAL_CALL removePropertyChangeListener( - rtl::OUString const &, - css::uno::Reference< css::beans::XPropertyChangeListener > const &) - throw ( - css::beans::UnknownPropertyException, - css::lang::WrappedTargetException, css::uno::RuntimeException) - {} - - virtual void SAL_CALL addVetoableChangeListener( - rtl::OUString const &, - css::uno::Reference< css::beans::XVetoableChangeListener > const &) - throw ( - css::beans::UnknownPropertyException, - css::lang::WrappedTargetException, css::uno::RuntimeException) - {} - - virtual void SAL_CALL removeVetoableChangeListener( - rtl::OUString const &, - css::uno::Reference< css::beans::XVetoableChangeListener > const &) - throw ( - css::beans::UnknownPropertyException, - css::lang::WrappedTargetException, css::uno::RuntimeException) - {} - - /** - Provides the implementation name. - @return implementation name - */ - static rtl::OUString SAL_CALL getLdapUserProfileBeName(void) ; - /** - Provides the supported services names - @return service names - */ - static uno::Sequence SAL_CALL - getLdapUserProfileBeServiceNames(void) ; - - private: - /** Check if LDAP is configured */ - bool readLdapConfiguration( - uno::Reference const & factory, - LdapDefinition * definition, rtl::OUString * loggedOnUser); - - bool getLdapStringParam(uno::Reference& xAccess, - const rtl::OUString& aLdapSetting, - rtl::OString& aServerParameter); - - LdapData data_; -} ; -//------------------------------------------------------------------------------ -}}} - -#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/ldap/makefile.mk b/extensions/source/config/ldap/makefile.mk deleted file mode 100644 index d35e2428c..000000000 --- a/extensions/source/config/ldap/makefile.mk +++ /dev/null @@ -1,105 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=ldapbe -ENABLE_EXCEPTIONS=TRUE - -# Version -LDAP_MAJOR=2 - -# --- Settings --- - -.INCLUDE : settings.mk -DLLPRE = - -.IF "$(WITH_LDAP)" != "YES" -@all: - @echo "LDAP disabled." -.ENDIF - -.IF "$(LDAPSDKINCLUDES)" == "" - -.IF "$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_OPENLDAP)" != "YES" -LDAPSDKINCLUDES = $(MOZ_LDAP_CFLAGS) -.ELSE -LDAPSDKINCLUDES = -I$(SOLARINCDIR)$/mozilla -.ENDIF -.ENDIF - -.IF "$(WITH_OPENLDAP)" == "YES" -CFLAGS += -DWITH_OPENLDAP -DLDAP_DEPRECATED -.ENDIF - -SOLARINC+= $(LDAPSDKINCLUDES) -# --- Files --- - - -SLOFILES=\ - $(SLO)$/ldapuserprofilebe.obj \ - $(SLO)$/ldapaccess.obj \ - $(SLO)$/componentdef.obj - -LIB1TARGET=$(SLB)$/_$(TARGET).lib -LIB1OBJFILES=$(SLOFILES) - -SHL1TARGET=$(TARGET)$(LDAP_MAJOR).uno -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1LIBS=$(LIB1TARGET) -SHL1IMPLIB=i$(SHL1TARGET) -SHL1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALHELPERLIB) \ - $(SALLIB) -.IF "$(OS)"=="FREEBSD" -SHL1STDLIBS+=-lcompat -# workaround for FreeBSD, which needs -llber50, too -.IF "$(WITH_OPENLDAP)" != "YES" -SHL1STDLIBS+=-Wl,-Bstatic -llber50 -.ENDIF -.ENDIF - -DEF1NAME=$(SHL1TARGET) -DEF1EXPORTFILE=exports.dxp -DEF1DES=Configuration: LDAP User Profile Backend - -# --- Targets --- - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk - - -ALLTAR : $(MISC)/ldapbe2.component - -$(MISC)/ldapbe2.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - ldapbe2.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt ldapbe2.component diff --git a/extensions/source/config/ldap/wrapldapinclude.hxx b/extensions/source/config/ldap/wrapldapinclude.hxx deleted file mode 100644 index 9e401944c..000000000 --- a/extensions/source/config/ldap/wrapldapinclude.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef WNT -#pragma warning (push,1) -#pragma warning (disable:4668) -#endif - -#ifdef WITH_OPENLDAP -#include -#ifndef LDAP_API -# define LDAP_API(rt) rt -#endif -#ifndef LDAP_CALL -# define LDAP_CALL -#endif -#else -#ifndef LDAP_INCLUDED -#define LDAP_INCLUDED -#include -#endif // LDAP_INCLUDED -#endif - -#ifdef WNT -#pragma warning (pop) -#endif // WNT - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx deleted file mode 100644 index 0ba4d5af9..000000000 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "commonpagesdbp.hxx" -#include "dbpresid.hrc" -#include "componentmodule.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::task; - using namespace ::comphelper; - - //===================================================================== - //= OTableSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - OTableSelectionPage::OTableSelectionPage(OControlWizard* _pParent) - :OControlWizardPage(_pParent, ModuleRes(RID_PAGE_TABLESELECTION)) - ,m_aData (this, ModuleRes(FL_DATA)) - ,m_aExplanation (this, ModuleRes(FT_EXPLANATION)) - ,m_aDatasourceLabel (this, ModuleRes(FT_DATASOURCE)) - ,m_aDatasource (this, ModuleRes(LB_DATASOURCE)) - ,m_aSearchDatabase (this, ModuleRes(PB_FORMDATASOURCE)) - ,m_aTableLabel (this, ModuleRes(FT_TABLE)) - ,m_aTable (this, ModuleRes(LB_TABLE)) - { - FreeResource(); - - implCollectDatasource(); - - m_aDatasource.SetSelectHdl(LINK(this, OTableSelectionPage, OnListboxSelection)); - m_aTable.SetSelectHdl(LINK(this, OTableSelectionPage, OnListboxSelection)); - m_aTable.SetDoubleClickHdl(LINK(this, OTableSelectionPage, OnListboxDoubleClicked)); - m_aSearchDatabase.SetClickHdl(LINK(this, OTableSelectionPage, OnSearchClicked)); - - m_aDatasource.SetDropDownLineCount(10); - } - - //--------------------------------------------------------------------- - void OTableSelectionPage::ActivatePage() - { - OControlWizardPage::ActivatePage(); - m_aDatasource.GrabFocus(); - } - - //--------------------------------------------------------------------- - bool OTableSelectionPage::canAdvance() const - { - if (!OControlWizardPage::canAdvance()) - return false; - - if (0 == m_aDatasource.GetSelectEntryCount()) - return false; - - if (0 == m_aTable.GetSelectEntryCount()) - return false; - - return sal_True; - } - - //--------------------------------------------------------------------- - void OTableSelectionPage::initializePage() - { - OControlWizardPage::initializePage(); - - const OControlWizardContext& rContext = getContext(); - try - { - ::rtl::OUString sDataSourceName; - rContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName"))) >>= sDataSourceName; - - Reference< XConnection > xConnection; - bool bEmbedded = ::dbtools::isEmbeddedInDatabase( rContext.xForm, xConnection ); - if ( bEmbedded ) - { - m_aDatasource.Hide(); - m_aDatasourceLabel.Hide(); - m_aSearchDatabase.Hide(); - m_aTableLabel.SetPosPixel(m_aDatasourceLabel.GetPosPixel()); - m_aTable.SetPosPixel(m_aDatasource.GetPosPixel()); - m_aDatasource.InsertEntry(sDataSourceName); - } - m_aDatasource.SelectEntry(sDataSourceName); - - implFillTables(xConnection); - - ::rtl::OUString sCommand; - OSL_VERIFY( rContext.xForm->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Command")) ) >>= sCommand ); - sal_Int32 nCommandType = CommandType::TABLE; - OSL_VERIFY( rContext.xForm->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandType")) ) >>= nCommandType ); - - // search the entry of the given type with the given name - XubString sLookup( sCommand ); - for ( sal_uInt16 nLookup = 0; nLookup < m_aTable.GetEntryCount(); ++nLookup ) - { - if ( m_aTable.GetEntry( nLookup ) == sLookup ) - if ( reinterpret_cast< sal_IntPtr >( m_aTable.GetEntryData( nLookup ) ) == nCommandType ) - { - m_aTable.SelectEntryPos( nLookup ); - break; - } - } - } - catch(Exception&) - { - OSL_FAIL("OTableSelectionPage::initializePage: caught an exception!"); - } - } - - //--------------------------------------------------------------------- - sal_Bool OTableSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OControlWizardPage::commitPage(_eReason)) - return sal_False; - - const OControlWizardContext& rContext = getContext(); - try - { - Reference< XConnection > xOldConn; - if ( !rContext.bEmbedded ) - { - xOldConn = getFormConnection(); - - ::rtl::OUString sDataSource = m_aDatasource.GetSelectEntry(); - rContext.xForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName")), makeAny( sDataSource ) ); - } - ::rtl::OUString sCommand = m_aTable.GetSelectEntry(); - sal_Int32 nCommandType = reinterpret_cast< sal_IntPtr >( m_aTable.GetEntryData( m_aTable.GetSelectEntryPos() ) ); - - rContext.xForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Command")), makeAny( sCommand ) ); - rContext.xForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandType")), makeAny( nCommandType ) ); - - if ( !rContext.bEmbedded ) - setFormConnection( xOldConn, sal_False ); - - if (!updateContext()) - return sal_False; - } - catch(Exception&) - { - OSL_FAIL("OTableSelectionPage::commitPage: caught an exception!"); - } - - return sal_True; - } - - //--------------------------------------------------------------------- - IMPL_LINK( OTableSelectionPage, OnSearchClicked, PushButton*, /*_pButton*/ ) - { - ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK); - aFileDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() ); - - static const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); - if ( pFilter ) - { - aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension()); - } - - if (0 == aFileDlg.Execute()) - { - String sDataSourceName = aFileDlg.GetPath(); - ::svt::OFileNotation aFileNotation(sDataSourceName); - sDataSourceName = aFileNotation.get(::svt::OFileNotation::N_SYSTEM); - m_aDatasource.InsertEntry(sDataSourceName); - m_aDatasource.SelectEntry(sDataSourceName); - LINK(this, OTableSelectionPage, OnListboxSelection).Call(&m_aDatasource); - } - return 0L; - } - //--------------------------------------------------------------------- - IMPL_LINK( OTableSelectionPage, OnListboxDoubleClicked, ListBox*, _pBox ) - { - if (_pBox->GetSelectEntryCount()) - getDialog()->travelNext(); - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK( OTableSelectionPage, OnListboxSelection, ListBox*, _pBox ) - { - if (&m_aDatasource == _pBox) - { // new data source selected - implFillTables(); - } - else - { - } - - updateDialogTravelUI(); - - return 0L; - } - - //--------------------------------------------------------------------- - namespace - { - void lcl_fillEntries( ListBox& _rListBox, const Sequence< ::rtl::OUString >& _rNames, const Image& _rImage, sal_Int32 _nCommandType ) - { - const ::rtl::OUString* pNames = _rNames.getConstArray(); - const ::rtl::OUString* pNamesEnd = _rNames.getConstArray() + _rNames.getLength(); - sal_uInt16 nPos = 0; - while ( pNames != pNamesEnd ) - { - nPos = _rListBox.InsertEntry( *pNames++, _rImage ); - _rListBox.SetEntryData( nPos, reinterpret_cast< void* >( _nCommandType ) ); - } - } - } - - //--------------------------------------------------------------------- - void OTableSelectionPage::implFillTables(const Reference< XConnection >& _rxConn) - { - m_aTable.Clear(); - - WaitObject aWaitCursor(this); - - // will be the table tables of the selected data source - Sequence< ::rtl::OUString > aTableNames; - Sequence< ::rtl::OUString > aQueryNames; - - // connect to the data source - Any aSQLException; - Reference< XConnection > xConn = _rxConn; - if ( !xConn.is() ) - { - if (!m_xDSContext.is()) - return; - // connect to the data source - try - { - ::rtl::OUString sCurrentDatasource = m_aDatasource.GetSelectEntry(); - if (sCurrentDatasource.getLength()) - { - // obtain the DS object - Reference< XCompletedConnection > xDatasource; - // check if I know this one otherwise transform it into a file URL - if ( !m_xDSContext->hasByName(sCurrentDatasource) ) - { - ::svt::OFileNotation aFileNotation(sCurrentDatasource); - sCurrentDatasource = aFileNotation.get(::svt::OFileNotation::N_URL); - } - - if (m_xDSContext->getByName(sCurrentDatasource) >>= xDatasource) - { // connect - // get the default SDB interaction handler - Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(this); - if (!xHandler.is() ) - return; - xConn = xDatasource->connectWithCompletion(xHandler); - setFormConnection( xConn ); - } - else - { - OSL_FAIL("OTableSelectionPage::implFillTables: invalid data source object returned by the context"); - } - } - } - catch(SQLContext& e) { aSQLException <<= e; } - catch(SQLWarning& e) { aSQLException <<= e; } - catch(SQLException& e) { aSQLException <<= e; } - catch (Exception&) - { - OSL_FAIL("OTableSelectionPage::implFillTables: could not fill the table list!"); - } - } - - // will be the table tables of the selected data source - if ( xConn.is() ) - { - try - { - // get the tables - Reference< XTablesSupplier > xSupplTables(xConn, UNO_QUERY); - if ( xSupplTables.is() ) - { - Reference< XNameAccess > xTables(xSupplTables->getTables(), UNO_QUERY); - if (xTables.is()) - aTableNames = xTables->getElementNames(); - } - - // and the queries - Reference< XQueriesSupplier > xSuppQueries( xConn, UNO_QUERY ); - if ( xSuppQueries.is() ) - { - Reference< XNameAccess > xQueries( xSuppQueries->getQueries(), UNO_QUERY ); - if ( xQueries.is() ) - aQueryNames = xQueries->getElementNames(); - } - } - catch(SQLContext& e) { aSQLException <<= e; } - catch(SQLWarning& e) { aSQLException <<= e; } - catch(SQLException& e) { aSQLException <<= e; } - catch (Exception&) - { - OSL_FAIL("OTableSelectionPage::implFillTables: could not fill the table list!"); - } - } - - - if ( aSQLException.hasValue() ) - { // an SQLException (or derivee) was thrown ... - Reference< XInteractionRequest > xRequest = new OInteractionRequest(aSQLException); - try - { - // get the default SDB interaction handler - Reference< XInteractionHandler > xHandler = getDialog()->getInteractionHandler(this); - if ( xHandler.is() ) - xHandler->handle(xRequest); - } - catch(Exception&) { } - return; - } - - Image aTableImage, aQueryImage; - { - ::svt::OLocalResourceAccess aLocalResAccess( ModuleRes( RID_PAGE_TABLESELECTION ), RSC_TABPAGE ); - - aTableImage = Image( ModuleRes( IMG_TABLE ) ); - aQueryImage = Image( ModuleRes( IMG_QUERY ) ); - } - lcl_fillEntries( m_aTable, aTableNames, aTableImage, CommandType::TABLE ); - lcl_fillEntries( m_aTable, aQueryNames, aQueryImage, CommandType::QUERY ); - } - - //--------------------------------------------------------------------- - void OTableSelectionPage::implCollectDatasource() - { - try - { - m_xDSContext = getContext().xDatasourceContext; - if (m_xDSContext.is()) - fillListBox(m_aDatasource, m_xDSContext->getElementNames()); - } - catch (Exception&) - { - OSL_FAIL("OTableSelectionPage::implCollectDatasource: could not collect the data source names!"); - } - } - - //===================================================================== - //= OMaybeListSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - OMaybeListSelectionPage::OMaybeListSelectionPage( OControlWizard* _pParent, const ResId& _rId ) - :OControlWizardPage(_pParent, _rId) - ,m_pYes(NULL) - ,m_pNo(NULL) - ,m_pList(NULL) - { - } - - //--------------------------------------------------------------------- - void OMaybeListSelectionPage::announceControls(RadioButton& _rYesButton, RadioButton& _rNoButton, ListBox& _rSelection) - { - m_pYes = &_rYesButton; - m_pNo = &_rNoButton; - m_pList = &_rSelection; - - m_pYes->SetClickHdl(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); - m_pNo->SetClickHdl(LINK(this, OMaybeListSelectionPage, OnRadioSelected)); - implEnableWindows(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OMaybeListSelectionPage, OnRadioSelected, RadioButton*, /*NOTINTERESTEDIN*/ ) - { - implEnableWindows(); - return 0L; - } - - //--------------------------------------------------------------------- - void OMaybeListSelectionPage::implInitialize(const String& _rSelection) - { - DBG_ASSERT(m_pYes, "OMaybeListSelectionPage::implInitialize: no controls announced!"); - sal_Bool bIsSelection = (0 != _rSelection.Len()); - m_pYes->Check(bIsSelection); - m_pNo->Check(!bIsSelection); - m_pList->Enable(bIsSelection); - - m_pList->SelectEntry(bIsSelection ? _rSelection : String()); - } - - //--------------------------------------------------------------------- - void OMaybeListSelectionPage::implCommit(String& _rSelection) - { - _rSelection = m_pYes->IsChecked() ? m_pList->GetSelectEntry() : String(); - } - - //--------------------------------------------------------------------- - void OMaybeListSelectionPage::implEnableWindows() - { - m_pList->Enable(m_pYes->IsChecked()); - } - - //--------------------------------------------------------------------- - void OMaybeListSelectionPage::ActivatePage() - { - OControlWizardPage::ActivatePage(); - - DBG_ASSERT(m_pYes, "OMaybeListSelectionPage::ActivatePage: no controls announced!"); - if (m_pYes->IsChecked()) - m_pList->GrabFocus(); - else - m_pNo->GrabFocus(); - } - - //===================================================================== - //= ODBFieldPage - //===================================================================== - //--------------------------------------------------------------------- - ODBFieldPage::ODBFieldPage( OControlWizard* _pParent ) - :OMaybeListSelectionPage(_pParent, ModuleRes(RID_PAGE_OPTION_DBFIELD)) - ,m_aFrame (this, ModuleRes(FL_DATABASEFIELD_EXPL)) - ,m_aDescription (this, ModuleRes(FT_DATABASEFIELD_EXPL)) - ,m_aQuestion (this, ModuleRes(FT_DATABASEFIELD_QUEST)) - ,m_aStoreYes (this, ModuleRes(RB_STOREINFIELD_YES)) - ,m_aStoreNo (this, ModuleRes(LB_STOREINFIELD)) - ,m_aStoreWhere (this, ModuleRes(RB_STOREINFIELD_NO)) - { - FreeResource(); - announceControls(m_aStoreYes, m_aStoreNo, m_aStoreWhere); - m_aStoreWhere.SetDropDownLineCount(10); - } - - //--------------------------------------------------------------------- - void ODBFieldPage::initializePage() - { - OMaybeListSelectionPage::initializePage(); - - // fill the fields page - fillListBox(m_aStoreWhere, getContext().aFieldNames); - - implInitialize(getDBFieldSetting()); - } - - //--------------------------------------------------------------------- - sal_Bool ODBFieldPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OMaybeListSelectionPage::commitPage(_eReason)) - return sal_False; - - implCommit(getDBFieldSetting()); - - return sal_True; - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx deleted file mode 100644 index bdeb59fff..000000000 --- a/extensions/source/dbpilots/commonpagesdbp.hxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_ -#define _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_ - -#include "controlwizard.hxx" -#include -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OTableSelectionPage - //===================================================================== - class OTableSelectionPage : public OControlWizardPage - { - protected: - FixedLine m_aData; - FixedText m_aExplanation; - FixedText m_aDatasourceLabel; - ListBox m_aDatasource; - PushButton m_aSearchDatabase; - FixedText m_aTableLabel; - ListBox m_aTable; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - m_xDSContext; - - public: - OTableSelectionPage(OControlWizard* _pParent); - - protected: - // TabPage overridables - void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - protected: - DECL_LINK( OnListboxSelection, ListBox* ); - DECL_LINK( OnListboxDoubleClicked, ListBox* ); - DECL_LINK( OnSearchClicked, PushButton* ); - - void implCollectDatasource(); - void implFillTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& - _rxConn = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >()); - - // OControlWizardPage overridables - virtual bool canAdvance() const; - }; - - //===================================================================== - //= OMaybeListSelectionPage - //===================================================================== - class OMaybeListSelectionPage : public OControlWizardPage - { - protected: - RadioButton* m_pYes; - RadioButton* m_pNo; - ListBox* m_pList; - - public: - OMaybeListSelectionPage( OControlWizard* _pParent, const ResId& _rId ); - - protected: - DECL_LINK( OnRadioSelected, RadioButton* ); - - // TabPage overridables - void ActivatePage(); - - // own helper - void announceControls( - RadioButton& _rYesButton, - RadioButton& _rNoButton, - ListBox& _rSelection); - - void implEnableWindows(); - - void implInitialize(const String& _rSelection); - void implCommit(String& _rSelection); - }; - - //===================================================================== - //= ODBFieldPage - //===================================================================== - class ODBFieldPage : public OMaybeListSelectionPage - { - protected: - FixedLine m_aFrame; - FixedText m_aDescription; - FixedText m_aQuestion; - RadioButton m_aStoreYes; - RadioButton m_aStoreNo; - ListBox m_aStoreWhere; - - public: - ODBFieldPage( OControlWizard* _pParent ); - - protected: - void setDescriptionText(const String& _rDesc) { m_aDescription.SetText(_rDesc); } - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - // own overridables - virtual String& getDBFieldSetting() = 0; - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - - -#endif // _EXTENSIONS_DBP_COMMONPAGESDBP_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/commonpagesdbp.src b/extensions/source/dbpilots/commonpagesdbp.src deleted file mode 100644 index d2dd863ff..000000000 --- a/extensions/source/dbpilots/commonpagesdbp.src +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#include "dbpresid.hrc" -#endif - -TabPage RID_PAGE_TABLESELECTION -{ - HelpID = "extensions:TabPage:RID_PAGE_TABLESELECTION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Data"; - - FixedLine FL_DATA - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - Text [ en-US ] = "Data"; - }; - FixedText FT_EXPLANATION - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10 , WINDOW_SIZE_Y - 21 ) ; - WordBreak = TRUE; - Group = TRUE; - Text [ en-US ] = "Currently, the form the control belongs to is not (or not completely) bound to a data source.\n\nPlease choose a data source and a table.\n\n\nPlease note that the settings made on this page will take effect immediately upon leaving the page."; - }; - FixedText FT_DATASOURCE - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10 , 8) ; - Group = TRUE; - Text [ en-US ] = "~Data source:"; - }; - ListBox LB_DATASOURCE - { - HelpID = "extensions:ListBox:RID_PAGE_TABLESELECTION:LB_DATASOURCE"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 26 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 27 , 14 ) ; - SVLook = TRUE ; - Border = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - }; - - PushButton PB_FORMDATASOURCE - { - HelpID = "extensions:PushButton:RID_PAGE_TABLESELECTION:PB_FORMDATASOURCE"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 + WINDOW_HALF_SIZE_X - 24 , 25 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text [ en-US ] = "~..."; - }; - - FixedText FT_TABLE - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3, 46 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 14 , 8) ; - Group = TRUE; - Text [ en-US ] = "~Table / Query:"; - }; - ListBox LB_TABLE - { - HelpID = "extensions:ListBox:RID_PAGE_TABLESELECTION:LB_TABLE"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3, 57 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10 , WINDOW_SIZE_Y - 6 - 57 ) ; - SVLook = TRUE ; - Border = TRUE ; - Sort = TRUE; - AutoHScroll = TRUE ; - }; - - Image IMG_TABLE - { - ImageBitmap = Bitmap { File = "sx03188.bmp"; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0; Blue = 0xFFFF; }; - }; - - Image IMG_QUERY - { - ImageBitmap = Bitmap { File = "sx03202.bmp"; }; - MaskColor = Color { Red = 0xFFFF; Green = 0x0; Blue = 0xFFFF; }; - }; -}; - -TabPage RID_PAGE_OPTION_DBFIELD -{ - HelpID = "extensions:TabPage:RID_PAGE_OPTION_DBFIELD"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Database Field"; - - FixedLine FL_DATABASEFIELD_EXPL - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_DATABASEFIELD_EXPL - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 16 ) ; - WordBreak = TRUE; - }; - FixedText FT_DATABASEFIELD_QUEST - { - Pos = MAP_APPFONT ( 7 , 34 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 16 ) ; - WordBreak = TRUE; - Text [ en-US ] = "Do you want to save the value in a database field?"; - }; - RadioButton RB_STOREINFIELD_YES - { - HelpID = "extensions:RadioButton:RID_PAGE_OPTION_DBFIELD:RB_STOREINFIELD_YES"; - Pos = MAP_APPFONT ( 7 , 53 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 20, 10 ) ; - Group = TRUE; - TabStop = TRUE; - Text [ en-US ] = "~Yes, I want to save it in the following database field:"; - }; - ListBox LB_STOREINFIELD - { - HelpID = "extensions:ListBox:RID_PAGE_OPTION_DBFIELD:LB_STOREINFIELD"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 23, 51 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 30, 14 ) ; - TabStop = TRUE; - SVLook = TRUE ; - Border = TRUE ; - DropDown = TRUE; - AutoHScroll = TRUE ; - }; - RadioButton RB_STOREINFIELD_NO - { - HelpID = "extensions:RadioButton:RID_PAGE_OPTION_DBFIELD:RB_STOREINFIELD_NO"; - Pos = MAP_APPFONT ( 7 , 68 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 10 ) ; - TabStop = FALSE; - Text [ en-US ] = "~No, I only want to save the value in the form."; - }; -}; - -TabPage RID_PAGE_FORM_DATASOURCE_STATUS -{ - HelpID = "extensions:TabPage:RID_PAGE_FORM_DATASOURCE_STATUS"; - FixedLine FL_FORMSETINGS - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - Text [ en-US ] = "Form"; - }; - FixedText FT_FORMDATASOURCELABEL - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Data source"; - }; - FixedText FT_FORMDATASOURCE - { - Pos = MAP_APPFONT ( 7 + 60 + 3 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X / 2 - 80 - 3 , 19 ) ; - WordBreak = TRUE; - }; - - FixedText FT_FORMCONTENTTYPELABEL - { - Pos = MAP_APPFONT ( WINDOW_SIZE_X / 2 + 3, 15 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Content type"; - }; - FixedText FT_FORMCONTENTTYPE - { - Pos = MAP_APPFONT ( WINDOW_SIZE_X / 2 + 3 + 60 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - ( WINDOW_SIZE_X / 2 + 3 + 60 ) - 7 , 8 ) ; - }; - - FixedText FT_FORMTABLELABEL - { - Pos = MAP_APPFONT ( WINDOW_SIZE_X / 2 + 3, 26 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Content"; - }; - FixedText FT_FORMTABLE - { - Pos = MAP_APPFONT ( WINDOW_SIZE_X / 2 + 3 + 60 , 26 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - ( WINDOW_SIZE_X / 2 + 3 + 60 ) - 7 , 8 ) ; - }; -}; - -String RID_STR_TYPE_TABLE -{ - Text [ en-US ] = "Table"; -}; - -String RID_STR_TYPE_QUERY -{ - Text [ en-US ] = "Query"; -}; - -String RID_STR_TYPE_COMMAND -{ - Text [ en-US ] = "SQL command"; -}; - diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx deleted file mode 100644 index 0e8eeadb6..000000000 --- a/extensions/source/dbpilots/controlwizard.cxx +++ /dev/null @@ -1,754 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "controlwizard.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::drawing; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::sheet; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::task; - using namespace ::svt; - using namespace ::comphelper; - using namespace ::dbtools; - - //===================================================================== - //= OAccessRegulator - //===================================================================== - struct OAccessRegulator - { - friend class OControlWizardPage; - - protected: - OAccessRegulator() { } - }; - - //===================================================================== - //= OControlWizardPage - //===================================================================== - //--------------------------------------------------------------------- - OControlWizardPage::OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId ) - :OControlWizardPage_Base( _pParent, _rResId ) - ,m_pFormSettingsSeparator(NULL) - ,m_pFormDatasourceLabel(NULL) - ,m_pFormDatasource(NULL) - ,m_pFormContentTypeLabel(NULL) - ,m_pFormContentType(NULL) - ,m_pFormTableLabel(NULL) - ,m_pFormTable(NULL) - { - } - - //--------------------------------------------------------------------- - OControlWizardPage::~OControlWizardPage() - { - delete m_pFormSettingsSeparator; - delete m_pFormDatasourceLabel; - delete m_pFormDatasource; - delete m_pFormContentTypeLabel; - delete m_pFormContentType; - delete m_pFormTableLabel; - delete m_pFormTable; - } - - //--------------------------------------------------------------------- - OControlWizard* OControlWizardPage::getDialog() - { - return static_cast< OControlWizard* >(GetParent()); - } - - //--------------------------------------------------------------------- - const OControlWizard* OControlWizardPage::getDialog() const - { - return static_cast< OControlWizard* >(GetParent()); - } - - //--------------------------------------------------------------------- - sal_Bool OControlWizardPage::updateContext() - { - return getDialog()->updateContext(OAccessRegulator()); - } - - //--------------------------------------------------------------------- - Reference< XConnection > OControlWizardPage::getFormConnection() const - { - return getDialog()->getFormConnection(OAccessRegulator()); - } - - //--------------------------------------------------------------------- - void OControlWizardPage::setFormConnection( const Reference< XConnection >& _rxConn, sal_Bool _bAutoDispose ) - { - getDialog()->setFormConnection( OAccessRegulator(), _rxConn, _bAutoDispose ); - } - - //--------------------------------------------------------------------- - const OControlWizardContext& OControlWizardPage::getContext() - { - return getDialog()->getContext(); - } - - //--------------------------------------------------------------------- - void OControlWizardPage::fillListBox(ListBox& _rList, const Sequence< ::rtl::OUString >& _rItems, sal_Bool _bClear) - { - if (_bClear) - _rList.Clear(); - const ::rtl::OUString* pItems = _rItems.getConstArray(); - const ::rtl::OUString* pEnd = pItems + _rItems.getLength(); - ::svt::WizardTypes::WizardState nPos; - sal_Int32 nIndex = 0; - for (;pItems < pEnd; ++pItems, ++nIndex) - { - nPos = _rList.InsertEntry(*pItems); - _rList.SetEntryData(nPos, reinterpret_cast(nIndex)); - } - } - - //--------------------------------------------------------------------- - void OControlWizardPage::fillListBox(ComboBox& _rList, const Sequence< ::rtl::OUString >& _rItems, sal_Bool _bClear) - { - if (_bClear) - _rList.Clear(); - const ::rtl::OUString* pItems = _rItems.getConstArray(); - const ::rtl::OUString* pEnd = pItems + _rItems.getLength(); - ::svt::WizardTypes::WizardState nPos; - sal_Int32 nIndex = 0; - for (;pItems < pEnd; ++pItems) - { - nPos = _rList.InsertEntry(*pItems); - _rList.SetEntryData(nPos, reinterpret_cast(nIndex)); - } - } - - //--------------------------------------------------------------------- - void OControlWizardPage::enableFormDatasourceDisplay() - { - if (m_pFormSettingsSeparator) - // nothing to do - return; - - ModuleRes aModuleRes(RID_PAGE_FORM_DATASOURCE_STATUS); - OLocalResourceAccess aLocalControls(aModuleRes, RSC_TABPAGE); - - m_pFormSettingsSeparator = new FixedLine(this, ModuleRes(FL_FORMSETINGS)); - m_pFormDatasourceLabel = new FixedText(this, ModuleRes(FT_FORMDATASOURCELABEL)); - m_pFormDatasource = new FixedText(this, ModuleRes(FT_FORMDATASOURCE)); - m_pFormContentTypeLabel = new FixedText(this, ModuleRes(FT_FORMCONTENTTYPELABEL)); - m_pFormContentType = new FixedText(this, ModuleRes(FT_FORMCONTENTTYPE)); - m_pFormTableLabel = new FixedText(this, ModuleRes(FT_FORMTABLELABEL)); - m_pFormTable = new FixedText(this, ModuleRes(FT_FORMTABLE)); - - const OControlWizardContext& rContext = getContext(); - if ( rContext.bEmbedded ) - { - m_pFormDatasourceLabel->Hide(); - m_pFormDatasource->Hide(); - m_pFormContentTypeLabel->SetPosPixel(m_pFormDatasourceLabel->GetPosPixel()); - m_pFormContentType->SetPosPixel(m_pFormDatasource->GetPosPixel()); - m_pFormTableLabel->SetPosPixel(::Point(m_pFormDatasourceLabel->GetPosPixel().X(),m_pFormTableLabel->GetPosPixel().Y())); - m_pFormTable->SetPosPixel(::Point(m_pFormDatasource->GetPosPixel().X(),m_pFormTable->GetPosPixel().Y())); - } - } - - //--------------------------------------------------------------------- - void OControlWizardPage::adjustControlForNoDSDisplay(Control* _pControl, sal_Bool _bConstLowerDistance) - { - ::Size aDistanceToMove = LogicToPixel( ::Size( 0, 37 ), MAP_APPFONT ); - - ::Point aPos = _pControl->GetPosPixel(); - aPos.Y() -= aDistanceToMove.Height(); - _pControl->SetPosPixel(aPos); - - if (_bConstLowerDistance) - { - ::Size aSize = _pControl->GetSizePixel(); - aSize.Height() += aDistanceToMove.Height(); - _pControl->SetSizePixel(aSize); - } - } - - //--------------------------------------------------------------------- - void OControlWizardPage::initializePage() - { - if (m_pFormDatasource && m_pFormContentTypeLabel && m_pFormTable) - { - const OControlWizardContext& rContext = getContext(); - ::rtl::OUString sDataSource; - ::rtl::OUString sCommand; - sal_Int32 nCommandType = CommandType::COMMAND; - try - { - rContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSourceName"))) >>= sDataSource; - rContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Command"))) >>= sCommand; - rContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandType"))) >>= nCommandType; - } - catch(const Exception&) - { - OSL_FAIL("OControlWizardPage::initializePage: caught an exception!"); - } - - INetURLObject aURL( sDataSource ); - if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) - sDataSource = aURL.GetName(INetURLObject::DECODE_WITH_CHARSET); - m_pFormDatasource->SetText(sDataSource); - m_pFormTable->SetText(sCommand); - - ::svt::WizardTypes::WizardState nCommandTypeResourceId = 0; - switch (nCommandType) - { - case CommandType::TABLE: - nCommandTypeResourceId = RID_STR_TYPE_TABLE; - break; - - case CommandType::QUERY: - nCommandTypeResourceId = RID_STR_TYPE_QUERY; - break; - - default: - nCommandTypeResourceId = RID_STR_TYPE_COMMAND; - break; - } - m_pFormContentType->SetText(String(ModuleRes(nCommandTypeResourceId))); - } - - OControlWizardPage_Base::initializePage(); - } - - //===================================================================== - //= OControlWizard - //===================================================================== - //--------------------------------------------------------------------- - OControlWizard::OControlWizard( Window* _pParent, const ResId& _rId, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OWizardMachine(_pParent, _rId, WZB_CANCEL | WZB_PREVIOUS | WZB_NEXT | WZB_FINISH) - ,m_xORB(_rxORB) - { - m_aContext.xObjectModel = _rxObjectModel; - initContext(); - - SetPageSizePixel(LogicToPixel(::Size(WINDOW_SIZE_X, WINDOW_SIZE_Y), MAP_APPFONT)); - ShowButtonFixedLine(sal_True); - defaultButton(WZB_NEXT); - enableButtons(WZB_FINISH, sal_False); - } - - //--------------------------------------------------------------------- - OControlWizard::~OControlWizard() - { - } - - //--------------------------------------------------------------------- - short OControlWizard::Execute() - { - // get the class id of the control we're dealing with - sal_Int16 nClassId = FormComponentType::CONTROL; - try - { - getContext().xObjectModel->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassId"))) >>= nClassId; - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::activate: could not obtain the class id!"); - } - if (!approveControl(nClassId)) - { - // TODO: MessageBox or exception - return RET_CANCEL; - } - - ActivatePage(); - - return OControlWizard_Base::Execute(); - } - - //--------------------------------------------------------------------- - void OControlWizard::ActivatePage() - { - OControlWizard_Base::ActivatePage(); - } - - //--------------------------------------------------------------------- - void OControlWizard::implDetermineShape() - { - Reference< XIndexAccess > xPageObjects(m_aContext.xDrawPage, UNO_QUERY); - DBG_ASSERT(xPageObjects.is(), "OControlWizard::implDetermineShape: invalid page!"); - - // for comparing the model - Reference< XControlModel > xModelCompare(m_aContext.xObjectModel, UNO_QUERY); - - if (xPageObjects.is()) - { - // loop through all objects of the page - sal_Int32 nObjects = xPageObjects->getCount(); - Reference< XControlShape > xControlShape; - Reference< XControlModel > xControlModel; - for (sal_Int32 i=0; igetByIndex(i) >>= xControlShape) - { // it _is_ a control shape - xControlModel = xControlShape->getControl(); - DBG_ASSERT(xControlModel.is(), "OControlWizard::implDetermineShape: control shape without model!"); - if (xModelCompare.get() == xControlModel.get()) - { - m_aContext.xObjectShape = xControlShape; - break; - } - } - } - } - } - - //--------------------------------------------------------------------- - void OControlWizard::implDetermineForm() - { - Reference< XChild > xModelAsChild(m_aContext.xObjectModel, UNO_QUERY); - Reference< XInterface > xControlParent; - if (xModelAsChild.is()) - xControlParent = xModelAsChild->getParent(); - - m_aContext.xForm = Reference< XPropertySet >(xControlParent, UNO_QUERY); - m_aContext.xRowSet = Reference< XRowSet >(xControlParent, UNO_QUERY); - DBG_ASSERT(m_aContext.xForm.is() && m_aContext.xRowSet.is(), - "OControlWizard::implDetermineForm: missing some interfaces of the control parent!"); - - } - - //--------------------------------------------------------------------- - void OControlWizard::implDeterminePage() - { - try - { - // get the document model - Reference< XChild > xControlAsChild(m_aContext.xObjectModel, UNO_QUERY); - Reference< XChild > xModelSearch(xControlAsChild->getParent(), UNO_QUERY); - - Reference< XModel > xModel(xModelSearch, UNO_QUERY); - while (xModelSearch.is() && !xModel.is()) - { - xModelSearch = Reference< XChild >(xModelSearch->getParent(), UNO_QUERY); - xModel = Reference< XModel >(xModelSearch, UNO_QUERY); - } - - Reference< XDrawPage > xPage; - if (xModel.is()) - { - m_aContext.xDocumentModel = xModel; - - Reference< XDrawPageSupplier > xPageSupp(xModel, UNO_QUERY); - if (xPageSupp.is()) - { // it's a document with only one page -> Writer - xPage = xPageSupp->getDrawPage(); - } - else - { - // get the controller currently working on this model - Reference< XController > xController = xModel->getCurrentController(); - DBG_ASSERT(xController.is(), "OControlWizard::implDeterminePage: no current controller!"); - - // maybe it's a spredsheet - Reference< XSpreadsheetView > xView(xController, UNO_QUERY); - if (xView.is()) - { // okay, it is one - Reference< XSpreadsheet > xSheet = xView->getActiveSheet(); - xPageSupp = Reference< XDrawPageSupplier >(xSheet, UNO_QUERY); - DBG_ASSERT(xPageSupp.is(), "OControlWizard::implDeterminePage: a spreadsheet which is no page supplier!"); - if (xPageSupp.is()) - xPage = xPageSupp->getDrawPage(); - } - else - { // can be a draw/impress doc only - Reference< XDrawView > xDrawView(xController, UNO_QUERY); - DBG_ASSERT(xDrawView.is(), "OControlWizard::implDeterminePage: no alternatives left ... can't determine the page!"); - if (xDrawView.is()) - xPage = xDrawView->getCurrentPage(); - } - } - } - else - { - DBG_ASSERT(xPage.is(), "OControlWizard::implDeterminePage: can't determine the page (no model)!"); - } - m_aContext.xDrawPage = xPage; - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::implDeterminePage: caught an exception!"); - } - } - - //--------------------------------------------------------------------- - void OControlWizard::implGetDSContext() - { - Reference< XMultiServiceFactory > xORB = getServiceFactory(); - try - { - DBG_ASSERT(xORB.is(), "OControlWizard::implGetDSContext: invalid service factory!"); - - Reference< XInterface > xContext; - if (xORB.is()) - xContext = xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext"))); - DBG_ASSERT(xContext.is(), "OControlWizard::implGetDSContext: invalid database context!"); - - m_aContext.xDatasourceContext = Reference< XNameAccess >(xContext, UNO_QUERY); - DBG_ASSERT(m_aContext.xDatasourceContext.is() || !xContext.is(), "OControlWizard::implGetDSContext: invalid database context (missing the XNameAccess)!"); - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::implGetDSContext: invalid database context!"); - } - } - - //--------------------------------------------------------------------- - Reference< XConnection > OControlWizard::getFormConnection(const OAccessRegulator&) const - { - return getFormConnection(); - } - //--------------------------------------------------------------------- - Reference< XConnection > OControlWizard::getFormConnection() const - { - Reference< XConnection > xConn; - try - { - if ( !::dbtools::isEmbeddedInDatabase(m_aContext.xForm,xConn) ) - m_aContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection"))) >>= xConn; - } - catch(const Exception&) - { - OSL_FAIL("OControlWizard::getFormConnection: caught an exception!"); - } - return xConn; - } - - //--------------------------------------------------------------------- - void OControlWizard::setFormConnection( const OAccessRegulator& _rAccess, const Reference< XConnection >& _rxConn, sal_Bool _bAutoDispose ) - { - try - { - Reference< XConnection > xOldConn = getFormConnection(_rAccess); - if (xOldConn.get() == _rxConn.get()) - return; - - disposeComponent(xOldConn); - - // set the new connection - if ( _bAutoDispose ) - { - // for this, use a AutoDisposer (so the conn is cleaned up when the form dies or get's another connection) - Reference< XRowSet > xFormRowSet( m_aContext.xForm, UNO_QUERY ); - OAutoConnectionDisposer* pAutoDispose = new OAutoConnectionDisposer( xFormRowSet, _rxConn ); - Reference< XPropertyChangeListener > xEnsureDelete( pAutoDispose ); - } - else - { - m_aContext.xForm->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")), makeAny( _rxConn ) ); - } - } - catch(const Exception&) - { - OSL_FAIL("OControlWizard::setFormConnection: caught an exception!"); - } - } - - //--------------------------------------------------------------------- - sal_Bool OControlWizard::updateContext(const OAccessRegulator&) - { - return initContext(); - } - //--------------------------------------------------------------------- - Reference< XInteractionHandler > OControlWizard::getInteractionHandler(Window* _pWindow) const - { - const ::rtl::OUString sInteractionHandlerServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")); - Reference< XInteractionHandler > xHandler; - try - { - if (getServiceFactory().is()) - xHandler = Reference< XInteractionHandler >(getServiceFactory()->createInstance(sInteractionHandlerServiceName), UNO_QUERY); - } - catch(Exception&) { } - if (!xHandler.is()) - ShowServiceNotAvailableError(_pWindow, sInteractionHandlerServiceName, sal_True); - return xHandler; - } - //--------------------------------------------------------------------- - sal_Bool OControlWizard::initContext() - { - DBG_ASSERT(m_aContext.xObjectModel.is(), "OGroupBoxWizard::initContext: have no control model to work with!"); - if (!m_aContext.xObjectModel.is()) - return sal_False; - - // reset the context - m_aContext.xForm.clear(); - m_aContext.xRowSet.clear(); - m_aContext.xDocumentModel.clear(); - m_aContext.xDrawPage.clear(); - m_aContext.xObjectShape.clear(); - m_aContext.aFieldNames.realloc(0); - - m_aContext.xObjectContainer.clear(); - m_aContext.aTypes.clear(); - m_aContext.bEmbedded = sal_False; - - Any aSQLException; - Reference< XPreparedStatement > xStatement; - try - { - // get the datasource context - implGetDSContext(); - - // first, determine the form the control belongs to - implDetermineForm(); - - // need the page, too - implDeterminePage(); - - // the shape of the control - implDetermineShape(); - - // get the columns of the object the settins refer to - Reference< XNameAccess > xColumns; - - if (m_aContext.xForm.is()) - { - // collect some properties of the form - ::rtl::OUString sObjectName = ::comphelper::getString(m_aContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Command")))); - sal_Int32 nObjectType = ::comphelper::getINT32(m_aContext.xForm->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CommandType")))); - - // calculate the connection the rowset is working with - Reference< XConnection > xConnection; - m_aContext.bEmbedded = ::dbtools::isEmbeddedInDatabase( m_aContext.xForm, xConnection ); - if ( !m_aContext.bEmbedded ) - xConnection = ::dbtools::connectRowset( m_aContext.xRowSet, getServiceFactory(), sal_True ); - - // get the fields - if (xConnection.is()) - { - switch (nObjectType) - { - case 0: - { - Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); - if (xSupplyTables.is() && xSupplyTables->getTables().is() && xSupplyTables->getTables()->hasByName(sObjectName)) - { - Reference< XColumnsSupplier > xSupplyColumns; - m_aContext.xObjectContainer = xSupplyTables->getTables(); - m_aContext.xObjectContainer->getByName(sObjectName) >>= xSupplyColumns; - DBG_ASSERT(xSupplyColumns.is(), "OControlWizard::initContext: invalid table columns!"); - xColumns = xSupplyColumns->getColumns(); - } - } - break; - case 1: - { - Reference< XQueriesSupplier > xSupplyQueries(xConnection, UNO_QUERY); - if (xSupplyQueries.is() && xSupplyQueries->getQueries().is() && xSupplyQueries->getQueries()->hasByName(sObjectName)) - { - Reference< XColumnsSupplier > xSupplyColumns; - m_aContext.xObjectContainer = xSupplyQueries->getQueries(); - m_aContext.xObjectContainer->getByName(sObjectName) >>= xSupplyColumns; - DBG_ASSERT(xSupplyColumns.is(), "OControlWizard::initContext: invalid query columns!"); - xColumns = xSupplyColumns->getColumns(); - } - } - break; - default: - { - xStatement = xConnection->prepareStatement(sObjectName); - - // not interested in any results, only in the fields - Reference< XPropertySet > xStatementProps(xStatement, UNO_QUERY); - xStatementProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MaxRows")), makeAny(sal_Int32(0))); - - // TODO: think about handling local SQLExceptions here ... - Reference< XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), UNO_QUERY); - if (xSupplyCols.is()) - xColumns = xSupplyCols->getColumns(); - } - } - } - } - - if (xColumns.is()) - { - m_aContext.aFieldNames = xColumns->getElementNames(); - static const ::rtl::OUString s_sFieldTypeProperty(RTL_CONSTASCII_USTRINGPARAM("Type")); - const ::rtl::OUString* pBegin = m_aContext.aFieldNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + m_aContext.aFieldNames.getLength(); - for(;pBegin != pEnd;++pBegin) - { - sal_Int32 nFieldType = DataType::OTHER; - try - { - Reference< XPropertySet > xColumn; - xColumns->getByName(*pBegin) >>= xColumn; - xColumn->getPropertyValue(s_sFieldTypeProperty) >>= nFieldType; - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::initContext: unexpected exception while gathering column information!"); - } - m_aContext.aTypes.insert(OControlWizardContext::TNameTypeMap::value_type(*pBegin,nFieldType)); - } - } - } - catch(SQLContext& e) { aSQLException <<= e; } - catch(SQLWarning& e) { aSQLException <<= e; } - catch(SQLException& e) { aSQLException <<= e; } - catch(Exception&) - { - OSL_FAIL("OControlWizard::initContext: could not retrieve the control context (caught an exception)!"); - } - - ::comphelper::disposeComponent(xStatement); - - if (aSQLException.hasValue()) - { // an SQLException (or derivee) was thrown ... - - // prepend an extra SQLContext explaining what we were doing - SQLContext aContext; - aContext.Message = String(ModuleRes(RID_STR_COULDNOTOPENTABLE)); - aContext.NextException = aSQLException; - - // create an interaction handler to display this exception - Reference< XInteractionHandler > xHandler = getInteractionHandler(this); - if ( !xHandler.is() ) - return sal_False; - - Reference< XInteractionRequest > xRequest = new OInteractionRequest(makeAny(aContext)); - try - { - xHandler->handle(xRequest); - } - catch(Exception&) { } - return sal_False; - } - - return 0 != m_aContext.aFieldNames.getLength(); - } - - //--------------------------------------------------------------------- - void OControlWizard::commitControlSettings(OControlWizardSettings* _pSettings) - { - DBG_ASSERT(m_aContext.xObjectModel.is(), "OControlWizard::commitControlSettings: have no control model to work with!"); - if (!m_aContext.xObjectModel.is()) - return; - - // the only thing we have at the moment is the label - try - { - ::rtl::OUString sLabelPropertyName(RTL_CONSTASCII_USTRINGPARAM("Label")); - Reference< XPropertySetInfo > xInfo = m_aContext.xObjectModel->getPropertySetInfo(); - if (xInfo.is() && xInfo->hasPropertyByName(sLabelPropertyName)) - { - ::rtl::OUString sControlLabel(_pSettings->sControlLabel); - m_aContext.xObjectModel->setPropertyValue( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), - makeAny(sControlLabel) - ); - } - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::commitControlSettings: could not commit the basic control settings!"); - } - } - - //--------------------------------------------------------------------- - void OControlWizard::initControlSettings(OControlWizardSettings* _pSettings) - { - DBG_ASSERT(m_aContext.xObjectModel.is(), "OControlWizard::initControlSettings: have no control model to work with!"); - if (!m_aContext.xObjectModel.is()) - return; - - // initialize some settings from the control model give - try - { - ::rtl::OUString sLabelPropertyName(RTL_CONSTASCII_USTRINGPARAM("Label")); - Reference< XPropertySetInfo > xInfo = m_aContext.xObjectModel->getPropertySetInfo(); - if (xInfo.is() && xInfo->hasPropertyByName(sLabelPropertyName)) - { - ::rtl::OUString sControlLabel; - m_aContext.xObjectModel->getPropertyValue(sLabelPropertyName) >>= sControlLabel; - _pSettings->sControlLabel = sControlLabel; - } - } - catch(Exception&) - { - OSL_FAIL("OControlWizard::initControlSettings: could not retrieve the basic control settings!"); - } - } - - //--------------------------------------------------------------------- - sal_Bool OControlWizard::needDatasourceSelection() - { - // lemme see ... - return (0 == getContext().aFieldNames.getLength()); - // if we got fields, the data source is valid ... - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx deleted file mode 100644 index 0c5eb649d..000000000 --- a/extensions/source/dbpilots/controlwizard.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_CONTROLWIZARD_HXX -#define _EXTENSIONS_DBP_CONTROLWIZARD_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dbptypes.hxx" -#include "dbpresid.hrc" -#include "componentmodule.hxx" -#include "wizardcontext.hxx" - -class ResId; -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OControlWizardSettings - //===================================================================== - struct OControlWizardSettings - { - String sControlLabel; - }; - - //===================================================================== - //= OControlWizardPage - //===================================================================== - class OControlWizard; - typedef ::svt::OWizardPage OControlWizardPage_Base; - class OControlWizardPage : public OControlWizardPage_Base - { - protected: - FixedLine* m_pFormSettingsSeparator; - FixedText* m_pFormDatasourceLabel; - FixedText* m_pFormDatasource; - FixedText* m_pFormContentTypeLabel; - FixedText* m_pFormContentType; - FixedText* m_pFormTableLabel; - FixedText* m_pFormTable; - - protected: - OControlWizard* getDialog(); - const OControlWizard* getDialog() const; - const OControlWizardContext& getContext(); - sal_Bool updateContext(); - void setFormConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > - getFormConnection() const; - - public: - OControlWizardPage( OControlWizard* _pParent, const ResId& _rResId ); - ~OControlWizardPage(); - - protected: - void fillListBox( - ListBox& _rList, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems, - sal_Bool _bClear = sal_True); - void fillListBox( - ComboBox& _rList, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rItems, - sal_Bool _bClear = sal_True); - - protected: - void enableFormDatasourceDisplay(); - void adjustControlForNoDSDisplay(Control* _pControl, sal_Bool bConstLowerDistance = sal_False); - - protected: - // OWizardPage overridables - virtual void initializePage(); - }; - - struct OAccessRegulator; - //===================================================================== - //= OControlWizard - //===================================================================== - typedef ::svt::OWizardMachine OControlWizard_Base; - class OControlWizard : public OControlWizard_Base - { - private: - OControlWizardContext m_aContext; - - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - - public: - OControlWizard( - Window* _pParent, - const ResId& _rId, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - ~OControlWizard(); - - // make the some base class methods public - sal_Bool travelNext() { return OControlWizard_Base::travelNext(); } - - public: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getServiceFactory() const { return m_xORB; } - - const OControlWizardContext& getContext() const { return m_aContext; } - sal_Bool updateContext(const OAccessRegulator&); - void setFormConnection(const OAccessRegulator&, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn, sal_Bool _bAutoDispose = sal_True ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > - getFormConnection(const OAccessRegulator&) const; - - /** returns the com.sun.star.task.InteractionHandler - @param _pWindow The window will be used when an error message has to be shown. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const; - - protected: - // initialize the derivees settings (which have to be derived from OControlWizardSettings) - // with some common data extracted from the control model - void initControlSettings(OControlWizardSettings* _pSettings); - // commit the control-relevant settings - void commitControlSettings(OControlWizardSettings* _pSettings); - - sal_Bool needDatasourceSelection(); - - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > - getFormConnection() const; - - virtual sal_Bool approveControl(sal_Int16 _nClassId) = 0; - - // ModalDialog overridables - virtual short Execute(); - - private: - sal_Bool initContext(); - - void implGetDSContext(); - void implDetermineForm(); - void implDeterminePage(); - void implDetermineShape(); - - // made private. Not to be used by derived (or external) classes - virtual void ActivatePage(); - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_CONTROLWIZARD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbp.component b/extensions/source/dbpilots/dbp.component deleted file mode 100644 index 84ec98713..000000000 --- a/extensions/source/dbpilots/dbp.component +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - diff --git a/extensions/source/dbpilots/dbpilots.src b/extensions/source/dbpilots/dbpilots.src deleted file mode 100644 index 7e5cf6adf..000000000 --- a/extensions/source/dbpilots/dbpilots.src +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#include "dbpresid.hrc" -#endif - -ModalDialog RID_DLG_GROUPBOXWIZARD -{ - HelpID = "extensions:ModalDialog:RID_DLG_GROUPBOXWIZARD"; - Text [ en-US ] = "Group Element Wizard"; - - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE; -}; - -ModalDialog RID_DLG_LISTCOMBOWIZARD -{ - HelpID = "extensions:ModalDialog:RID_DLG_LISTCOMBOWIZARD"; - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE; -}; - -ModalDialog RID_DLG_GRIDWIZARD -{ - HelpID = "extensions:ModalDialog:RID_DLG_GRIDWIZARD"; - OutputSize = TRUE ; - SVLook = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - Hide = TRUE; - - Text [ en-US ] = "Table Element Wizard"; -}; - -String RID_STR_LISTWIZARD_TITLE -{ - Text [ en-US ] = "List Box Wizard"; -}; - -String RID_STR_COMBOWIZARD_TITLE -{ - Text [ en-US ] = "Combo Box Wizard"; -}; - -String RID_STR_COULDNOTOPENTABLE -{ - Text [ en-US ] = "The table connection to the data source could not be established."; -}; - - diff --git a/extensions/source/dbpilots/dbpresid.hrc b/extensions/source/dbpilots/dbpresid.hrc deleted file mode 100644 index 2a4dbd145..000000000 --- a/extensions/source/dbpilots/dbpresid.hrc +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#define _EXTENSIONS_DBP_DBPRESID_HRC_ - -#include "dbpilots.hrc" -#include "extensio.hrc" - -//======================================================================== -// basics - -#define RID_DIALOG_START RID_DBP_START -#define RID_PAGE_START RID_DBP_START -#define RID_STRING_START RID_DBP_START -#define RID_ERRORBOX_START RID_DBP_START - -//======================================================================== -// strings - -#define RID_STR_GROUPWIZ_DBFIELD (RID_STRING_START + 1 ) -#define RID_STR_COMBOWIZ_DBFIELD (RID_STRING_START + 2 ) -#define RID_STR_LISTWIZARD_TITLE (RID_STRING_START + 3 ) -#define RID_STR_COMBOWIZARD_TITLE (RID_STRING_START + 4 ) -#define RID_STR_COULDNOTOPENTABLE (RID_STRING_START + 5 ) -#define RID_STR_DATEPOSTFIX (RID_STRING_START + 6 ) -#define RID_STR_TIMEPOSTFIX (RID_STRING_START + 7 ) -#define RID_STR_TYPE_QUERY (RID_STRING_START + 8 ) -#define RID_STR_TYPE_TABLE (RID_STRING_START + 9 ) -#define RID_STR_TYPE_COMMAND (RID_STRING_START + 10 ) - -// please adjust RID_STRING_END (below) when adding new strings -#define RID_STRING_END RID_STR_TIMEPOSTFIX - -//======================================================================== -// dialogs - -#define RID_DLG_GROUPBOXWIZARD ( RID_DIALOG_START + 1 ) -#define RID_DLG_LISTCOMBOWIZARD ( RID_DIALOG_START + 2 ) -#define RID_DLG_GRIDWIZARD ( RID_DIALOG_START + 3 ) - -// please adjust RID_DIALOG_END (below) when adding new dialogs -#define RID_DIALOG_END RID_DLG_GRIDWIZARD - -//======================================================================== -// tab pages - -#define RID_PAGE_TABLESELECTION ( RID_PAGE_START + 1 ) -#define RID_PAGE_GROUPRADIOSELECTION ( RID_PAGE_START + 2 ) -#define RID_PAGE_DEFAULTFIELDSELECTION ( RID_PAGE_START + 3 ) -#define RID_PAGE_OPTIONVALUES ( RID_PAGE_START + 4 ) -#define RID_PAGE_OPTION_DBFIELD ( RID_PAGE_START + 5 ) -#define RID_PAGE_OPTIONS_FINAL ( RID_PAGE_START + 6 ) -#define RID_PAGE_LCW_CONTENTSELECTION_TABLE ( RID_PAGE_START + 7 ) -#define RID_PAGE_LCW_CONTENTSELECTION_FIELD ( RID_PAGE_START + 8 ) -#define RID_PAGE_LCW_FIELDLINK ( RID_PAGE_START + 9 ) -#define RID_PAGE_GW_FIELDSELECTION ( RID_PAGE_START + 10 ) -#define RID_PAGE_FORM_DATASOURCE_STATUS ( RID_PAGE_START + 11 ) - -// please adjust RID_PAGE_END (below) when adding new tab pages -#define RID_PAGE_END RID_PAGE_GW_FIELDSELECTION - -//======================================================================== -// ErrorBox - -#define RID_ERR_INVALID_FORM_CONNECTION ( RID_ERRORBOX_START + 1 ) - -// please adjust RID_ERRORBOX_END (below) when adding new error boxes -#define RID_ERRORBOX_END RID_ERR_INVALID_FORM_CONNECTION - - -//======================================================================== -//======================================================================== -//= range checks - -#if RID_STRING_END > RID_DBP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_DIALOG_END > RID_DBP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_PAGE_END > RID_DBP_END - #error "please adjust the resource id ranges!!" -#endif -#if RID_ERRORBOX_END > RID_DBP_END - #error "please adjust the resource id ranges!!" -#endif - -//======================================================================== -// local ids - -//........................................................................ -// FixedLine - -#define FL_DATA 1 -#define FL_DEFAULTSELECTION 2 -#define FL_OPTIONVALUES 3 -#define FL_DATABASEFIELD_EXPL 4 -#define FL_NAMEIT 5 -#define FL_FRAME 6 -#define FL_FORMSETINGS 7 - -//........................................................................ -// FixedText - -#define FT_DATASOURCE 1 -#define FT_TABLE 2 -#define FT_RADIOLABELS 3 -#define FT_RADIOBUTTONS 4 -#define FT_DEFAULTSELECTION 5 -#define FT_OPTIONVALUES_EXPL 6 -#define FT_OPTIONVALUES 7 -#define FT_DATABASEFIELD_EXPL 8 -#define FT_DATABASEFIELD_QUEST 9 -#define FT_NAMEIT 10 -#define FT_THATSALL 11 -#define FT_SELECTTABLE_LABEL 12 -#define FT_TABLEFIELDS 13 -#define FT_DISPLAYEDFIELD 14 -#define FT_CONTENTFIELD_INFO 15 -#define FT_VALUELISTFIELD 16 -#define FT_TABLEFIELD 17 -#define FT_EXPLANATION 18 -#define FT_EXISTING_FIELDS 19 -#define FT_SELECTED_FIELDS 20 -#define FT_FIELDLINK_DESC 21 -#define FT_FORMDATASOURCELABEL 22 -#define FT_FORMDATASOURCE 23 -#define FT_FORMTABLELABEL 24 -#define FT_FORMTABLE 25 -#define FT_FORMCONTENTTYPELABEL 26 -#define FT_FORMCONTENTTYPE 27 - -//........................................................................ -// ListBox - -#define LB_DATASOURCE 1 -#define LB_TABLE 2 -#define LB_RADIOBUTTONS 3 -#define LB_DEFSELECTIONFIELD 3 -#define LB_STOREINFIELD 4 -#define LB_SELECTTABLE 5 -#define LB_SELECTFIELD 6 -#define LB_EXISTING_FIELDS 7 -#define LB_SELECTED_FIELDS 8 - -//........................................................................ -// Edit - -#define ET_RADIOLABELS 1 -#define ET_OPTIONVALUE 2 -#define ET_NAMEIT 3 -#define ET_DISPLAYEDFIELD 4 - -//........................................................................ -// PushButton - -#define PB_MOVETORIGHT 1 -#define PB_MOVETOLEFT 2 -#define PB_FIELDRIGHT 3 -#define PB_ALLFIELDSRIGHT 4 -#define PB_FIELDLEFT 5 -#define PB_ALLFIELDSLEFT 6 -#define PB_FORMDATASOURCE 7 - -//........................................................................ -// RadioButton - -#define RB_DEFSELECTION_YES 1 -#define RB_DEFSELECTION_NO 2 -#define RB_STOREINFIELD_YES 3 -#define RB_STOREINFIELD_NO 4 - -//........................................................................ -// ComboBox - -#define CMB_VALUELISTFIELD 1 -#define CMB_TABLEFIELD 2 - -//........................................................................ -// String - -#define STR_FIELDINFO_LISTBOX 1 -#define STR_FIELDINFO_COMBOBOX 2 - -//........................................................................ -// Image - -#define IMG_TABLE 1 -#define IMG_QUERY 3 - -//======================================================================== -// defines - -#define WINDOW_SIZE_X 260 -#define WINDOW_SIZE_Y 185 -#define WINDOW_HALF_SIZE_X ( WINDOW_SIZE_X / 2 ) - -#define BUTTON_SIZE_X 50 -#define BUTTON_SIZE_Y 14 - -#define ITEM_BUTTON_SIZE_X 20 -#define ITEM_BUTTON_SIZE_Y 12 - - - -#endif // _EXTENSIONS_DBP_DBPRESID_HRC_ - diff --git a/extensions/source/dbpilots/dbpservices.cxx b/extensions/source/dbpilots/dbpservices.cxx deleted file mode 100644 index f158fdac3..000000000 --- a/extensions/source/dbpilots/dbpservices.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "componentmodule.hxx" - -//--------------------------------------------------------------------------------------- - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL createRegistryInfo_OGroupBoxWizard(); -extern "C" void SAL_CALL createRegistryInfo_OListComboWizard(); -extern "C" void SAL_CALL createRegistryInfo_OGridWizard(); - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL dbp_initializeModule() -{ - static sal_Bool s_bInit = sal_False; - if (!s_bInit) - { - createRegistryInfo_OGroupBoxWizard(); - createRegistryInfo_OListComboWizard(); - createRegistryInfo_OGridWizard(); - ::dbp::OModule::setResourceFilePrefix("dbp"); - s_bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - dbp_initializeModule(); - - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::dbp::OModule::getComponentFactory( - ::rtl::OUString::createFromAscii(pImplementationName), - static_cast< XMultiServiceFactory* >(pServiceManager)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbptools.cxx b/extensions/source/dbpilots/dbptools.cxx deleted file mode 100644 index 9bd7dd61e..000000000 --- a/extensions/source/dbpilots/dbptools.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "dbptools.hxx" -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::container; - - //--------------------------------------------------------------------- - void disambiguateName(const Reference< XNameAccess >& _rxContainer, ::rtl::OUString& _rElementsName) - { - DBG_ASSERT(_rxContainer.is(), "::dbp::disambiguateName: invalid container!"); - if (!_rxContainer.is()) - return; - - try - { - ::rtl::OUString sBase(_rElementsName); - for (sal_Int32 i=1; i<0x7FFFFFFF; ++i) - { - _rElementsName = sBase; - _rElementsName += ::rtl::OUString::valueOf((sal_Int32)i); - if (!_rxContainer->hasByName(_rElementsName)) - return; - } - // can't do anything ... no free names - _rElementsName = sBase; - } - catch(Exception&) - { - OSL_FAIL("::dbp::disambiguateName: something went (strangely) wrong!"); - } - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbptools.hxx b/extensions/source/dbpilots/dbptools.hxx deleted file mode 100644 index 7c37e7edd..000000000 --- a/extensions/source/dbpilots/dbptools.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPTOOLS_HXX_ -#define _EXTENSIONS_DBP_DBPTOOLS_HXX_ - -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - void disambiguateName( - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, - ::rtl::OUString& _rElementsName); - -//......................................................................... -} // namespace dbp -//......................................................................... - - -#endif // _EXTENSIONS_DBP_DBPTOOLS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/dbptypes.hxx b/extensions/source/dbpilots/dbptypes.hxx deleted file mode 100644 index be188f63f..000000000 --- a/extensions/source/dbpilots/dbptypes.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPTYPES_HXX_ -#define _EXTENSIONS_DBP_DBPTYPES_HXX_ - -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - DECLARE_STL_VECTOR( String, StringArray ); - DECLARE_STL_STDKEY_SET( String, StringBag ); - DECLARE_STL_STDKEY_MAP( sal_uInt32, String, MapInt2String ); - -//......................................................................... -} // namespace dbp -//......................................................................... -#endif // _EXTENSIONS_DBP_DBPTYPES_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/gridpages.src b/extensions/source/dbpilots/gridpages.src deleted file mode 100644 index ccba53592..000000000 --- a/extensions/source/dbpilots/gridpages.src +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#include "dbpresid.hrc" -#endif - -TabPage RID_PAGE_GW_FIELDSELECTION -{ - HelpID = "extensions:TabPage:RID_PAGE_GW_FIELDSELECTION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - Text [ en-US ] = "Field Selection"; - - FixedLine FL_FRAME - { - Pos = MAP_APPFONT ( 4 , 40 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - Text [ en-US ] = "Table element"; - }; - - FixedText FT_EXISTING_FIELDS - { - Pos = MAP_APPFONT ( 7, 52 ); - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, 8 ); - Text [ en-US ] = "Existing fields"; - }; - ListBox LB_EXISTING_FIELDS - { - HelpID = "extensions:ListBox:RID_PAGE_GW_FIELDSELECTION:LB_EXISTING_FIELDS"; - Pos = MAP_APPFONT ( 7 , 63 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, WINDOW_SIZE_Y - 63 - 6 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - Sort = FALSE; - DropDown = FALSE; - }; - PushButton PB_FIELDRIGHT - { - HelpID = "extensions:PushButton:RID_PAGE_GW_FIELDSELECTION:PB_FIELDRIGHT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2, 63 ); - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X, ITEM_BUTTON_SIZE_Y ); - Text = "->"; - }; - PushButton PB_ALLFIELDSRIGHT - { - HelpID = "extensions:PushButton:RID_PAGE_GW_FIELDSELECTION:PB_ALLFIELDSRIGHT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2, 63 + ITEM_BUTTON_SIZE_Y + 3 ); - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X, ITEM_BUTTON_SIZE_Y ); - Text = "=>>"; - }; - PushButton PB_FIELDLEFT - { - HelpID = "extensions:PushButton:RID_PAGE_GW_FIELDSELECTION:PB_FIELDLEFT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2, 63 + ITEM_BUTTON_SIZE_Y + 3 + ITEM_BUTTON_SIZE_Y + 12 ); - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X, ITEM_BUTTON_SIZE_Y ); - Text = "<-"; - }; - PushButton PB_ALLFIELDSLEFT - { - HelpID = "extensions:PushButton:RID_PAGE_GW_FIELDSELECTION:PB_ALLFIELDSLEFT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2, 63 + ITEM_BUTTON_SIZE_Y + 3 + ITEM_BUTTON_SIZE_Y + 12 + ITEM_BUTTON_SIZE_Y + 3 ); - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X, ITEM_BUTTON_SIZE_Y ); - Text = "<<="; - }; - FixedText FT_SELECTED_FIELDS - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + ITEM_BUTTON_SIZE_X / 2 + 6, 52 ); - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, 8 ); - Text [ en-US ] = "Selected fields"; - }; - ListBox LB_SELECTED_FIELDS - { - HelpID = "extensions:ListBox:RID_PAGE_GW_FIELDSELECTION:LB_SELECTED_FIELDS"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + ITEM_BUTTON_SIZE_X / 2 + 6 , 63 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, WINDOW_SIZE_Y - 63 - 6 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - Sort = FALSE; - DropDown = FALSE; - }; -}; - -String RID_STR_DATEPOSTFIX -{ - Text [ en-US ] = " (Date)"; -}; - -String RID_STR_TIMEPOSTFIX -{ - Text [ en-US ] = " (Time)"; -}; - - diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx deleted file mode 100644 index 93e433cea..000000000 --- a/extensions/source/dbpilots/gridwizard.cxx +++ /dev/null @@ -1,487 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "gridwizard.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include "dbptools.hxx" -#include "dbpilots.hrc" - -#define GW_STATE_DATASOURCE_SELECTION 0 -#define GW_STATE_FIELDSELECTION 1 - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::awt; - using namespace ::svt; - - //===================================================================== - //= OGridWizard - //===================================================================== - //--------------------------------------------------------------------- - OGridWizard::OGridWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_GRIDWIZARD), _rxObjectModel, _rxORB) - ,m_bHadDataSelection(sal_True) - { - initControlSettings(&m_aSettings); - - m_pPrevPage->SetHelpId(HID_GRIDWIZARD_PREVIOUS); - m_pNextPage->SetHelpId(HID_GRIDWIZARD_NEXT); - m_pCancel->SetHelpId(HID_GRIDWIZARD_CANCEL); - m_pFinish->SetHelpId(HID_GRIDWIZARD_FINISH); - - // if we do not need the data source selection page ... - if (!needDatasourceSelection()) - { // ... skip it! - skip(1); - m_bHadDataSelection = sal_False; - } - } - - //--------------------------------------------------------------------- - sal_Bool OGridWizard::approveControl(sal_Int16 _nClassId) - { - if (FormComponentType::GRIDCONTROL != _nClassId) - return sal_False; - - Reference< XGridColumnFactory > xColumnFactory(getContext().xObjectModel, UNO_QUERY); - if (!xColumnFactory.is()) - return sal_False; - - return sal_True; - } - - //--------------------------------------------------------------------- - void OGridWizard::implApplySettings() - { - const OControlWizardContext& rContext = getContext(); - - // the factory for the columns - Reference< XGridColumnFactory > xColumnFactory(rContext.xObjectModel, UNO_QUERY); - DBG_ASSERT(xColumnFactory.is(), "OGridWizard::implApplySettings: should never have made it 'til here!"); - // (if we're here, what the hell happened in approveControl??) - - // the container for the columns - Reference< XNameContainer > xColumnContainer(rContext.xObjectModel, UNO_QUERY); - DBG_ASSERT(xColumnContainer.is(), "OGridWizard::implApplySettings: no container!"); - - if (!xColumnFactory.is() || !xColumnContainer.is()) - return; - - static const ::rtl::OUString s_sDataFieldProperty (RTL_CONSTASCII_USTRINGPARAM("DataField")); - static const ::rtl::OUString s_sLabelProperty (RTL_CONSTASCII_USTRINGPARAM("Label")); - static const ::rtl::OUString s_sWidthProperty (RTL_CONSTASCII_USTRINGPARAM("Width")); - static const ::rtl::OUString s_sMouseWheelBehavior (RTL_CONSTASCII_USTRINGPARAM("MouseWheelBehavior")); - static const ::rtl::OUString s_sEmptyString; - - // collect "descriptors" for the to-be-created (grid)columns - DECLARE_STL_VECTOR( ::rtl::OUString, OUStringArray ); - OUStringArray aColumnServiceNames; // service names to be used with the XGridColumnFactory - OUStringArray aColumnLabelPostfixes; // postfixes to append to the column labels - OUStringArray aFormFieldNames; // data field names - - aColumnServiceNames.reserve(getSettings().aSelectedFields.getLength()); - aColumnLabelPostfixes.reserve(getSettings().aSelectedFields.getLength()); - aFormFieldNames.reserve(getSettings().aSelectedFields.getLength()); - - // loop through the selected field names - const ::rtl::OUString* pSelectedFields = getSettings().aSelectedFields.getConstArray(); - const ::rtl::OUString* pEnd = pSelectedFields + getSettings().aSelectedFields.getLength(); - for (;pSelectedFields < pEnd; ++pSelectedFields) - { - // get the information for the selected column - sal_Int32 nFieldType = DataType::OTHER; - OControlWizardContext::TNameTypeMap::const_iterator aFind = rContext.aTypes.find(*pSelectedFields); - if ( aFind != rContext.aTypes.end() ) - nFieldType = aFind->second; - - aFormFieldNames.push_back(*pSelectedFields); - switch (nFieldType) - { - case DataType::BIT: - case DataType::BOOLEAN: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CheckBox"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - break; - - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumericField"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - break; - - case DataType::FLOAT: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::NUMERIC: - case DataType::DECIMAL: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormattedField"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - break; - - case DataType::DATE: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DateField"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - break; - - case DataType::TIME: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeField"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - break; - - case DataType::TIMESTAMP: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DateField"))); - aColumnLabelPostfixes.push_back(String(ModuleRes(RID_STR_DATEPOSTFIX))); - - aFormFieldNames.push_back(*pSelectedFields); - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TimeField"))); - aColumnLabelPostfixes.push_back(String(ModuleRes(RID_STR_TIMEPOSTFIX))); - break; - - default: - aColumnServiceNames.push_back(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TextField"))); - aColumnLabelPostfixes.push_back(s_sEmptyString); - } - } - - DBG_ASSERT( aFormFieldNames.size() == aColumnServiceNames.size() - && aColumnServiceNames.size() == aColumnLabelPostfixes.size(), - "OGridWizard::implApplySettings: inconsistent descriptor sequences!"); - - // now loop through the descriptions and create the (grid)columns out of th descriptors - { - Reference< XNameAccess > xExistenceChecker(xColumnContainer.get()); - - ConstOUStringArrayIterator pColumnServiceName = aColumnServiceNames.begin(); - ConstOUStringArrayIterator pColumnLabelPostfix = aColumnLabelPostfixes.begin(); - ConstOUStringArrayIterator pFormFieldName = aFormFieldNames.begin(); - ConstOUStringArrayIterator pColumnServiceNameEnd = aColumnServiceNames.end(); - - for (;pColumnServiceName < pColumnServiceNameEnd; ++pColumnServiceName, ++pColumnLabelPostfix, ++pFormFieldName) - { - // create a (grid)column for the (resultset)column - try - { - Reference< XPropertySet > xColumn( xColumnFactory->createColumn(*pColumnServiceName), UNO_SET_THROW ); - Reference< XPropertySetInfo > xColumnPSI( xColumn->getPropertySetInfo(), UNO_SET_THROW ); - - ::rtl::OUString sColumnName(*pColumnServiceName); - disambiguateName(xExistenceChecker, sColumnName); - - // the data field the column should be bound to - xColumn->setPropertyValue(s_sDataFieldProperty, makeAny(*pFormFieldName)); - // the label - xColumn->setPropertyValue(s_sLabelProperty, makeAny(::rtl::OUString(*pFormFieldName) += *pColumnLabelPostfix)); - // the width ( => column will be auto-sized) - xColumn->setPropertyValue(s_sWidthProperty, Any()); - - if ( xColumnPSI->hasPropertyByName( s_sMouseWheelBehavior ) ) - xColumn->setPropertyValue( s_sMouseWheelBehavior, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); - - // insert the column - xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); - } - catch(Exception&) - { - OSL_FAIL( ( ::rtl::OString("OGridWizard::implApplySettings: unexpected exception while creating the grid column for field ") - += ::rtl::OString(pFormFieldName->getStr(), pFormFieldName->getLength(), gsl_getSystemTextEncoding()) - += ::rtl::OString("!") ).getStr() ); - } - } - } - } - - //--------------------------------------------------------------------- - OWizardPage* OGridWizard::createPage(WizardState _nState) - { - switch (_nState) - { - case GW_STATE_DATASOURCE_SELECTION: - return new OTableSelectionPage(this); - case GW_STATE_FIELDSELECTION: - return new OGridFieldsSelection(this); - } - - return NULL; - } - - //--------------------------------------------------------------------- - WizardTypes::WizardState OGridWizard::determineNextState( WizardState _nCurrentState ) const - { - switch (_nCurrentState) - { - case GW_STATE_DATASOURCE_SELECTION: - return GW_STATE_FIELDSELECTION; - case GW_STATE_FIELDSELECTION: - return WZS_INVALID_STATE; - } - - return WZS_INVALID_STATE; - } - - //--------------------------------------------------------------------- - void OGridWizard::enterState(WizardState _nState) - { - OControlWizard::enterState(_nState); - - enableButtons(WZB_PREVIOUS, m_bHadDataSelection ? (GW_STATE_DATASOURCE_SELECTION < _nState) : GW_STATE_FIELDSELECTION < _nState); - enableButtons(WZB_NEXT, GW_STATE_FIELDSELECTION != _nState); - if (_nState < GW_STATE_FIELDSELECTION) - enableButtons(WZB_FINISH, sal_False); - - if (GW_STATE_FIELDSELECTION == _nState) - defaultButton(WZB_FINISH); - } - - //--------------------------------------------------------------------- - sal_Bool OGridWizard::leaveState(WizardState _nState) - { - if (!OControlWizard::leaveState(_nState)) - return sal_False; - - if (GW_STATE_FIELDSELECTION == _nState) - defaultButton(WZB_NEXT); - - return sal_True; - } - - //--------------------------------------------------------------------- - sal_Bool OGridWizard::onFinish() - { - if ( !OControlWizard::onFinish() ) - return sal_False; - - implApplySettings(); - - return sal_True; - } - - //===================================================================== - //= OGridFieldsSelection - //===================================================================== - //--------------------------------------------------------------------- - OGridFieldsSelection::OGridFieldsSelection( OGridWizard* _pParent ) - :OGridPage(_pParent, ModuleRes(RID_PAGE_GW_FIELDSELECTION)) - ,m_aFrame (this, ModuleRes(FL_FRAME)) - ,m_aExistFieldsLabel (this, ModuleRes(FT_EXISTING_FIELDS)) - ,m_aExistFields (this, ModuleRes(LB_EXISTING_FIELDS)) - ,m_aSelectOne (this, ModuleRes(PB_FIELDRIGHT)) - ,m_aSelectAll (this, ModuleRes(PB_ALLFIELDSRIGHT)) - ,m_aDeselectOne (this, ModuleRes(PB_FIELDLEFT)) - ,m_aDeselectAll (this, ModuleRes(PB_ALLFIELDSLEFT)) - ,m_aSelFieldsLabel (this, ModuleRes(FT_SELECTED_FIELDS)) - ,m_aSelFields (this, ModuleRes(LB_SELECTED_FIELDS)) - { - FreeResource(); - - enableFormDatasourceDisplay(); - - m_aSelectOne.SetClickHdl(LINK(this, OGridFieldsSelection, OnMoveOneEntry)); - m_aSelectAll.SetClickHdl(LINK(this, OGridFieldsSelection, OnMoveAllEntries)); - m_aDeselectOne.SetClickHdl(LINK(this, OGridFieldsSelection, OnMoveOneEntry)); - m_aDeselectAll.SetClickHdl(LINK(this, OGridFieldsSelection, OnMoveAllEntries)); - - m_aExistFields.SetSelectHdl(LINK(this, OGridFieldsSelection, OnEntrySelected)); - m_aSelFields.SetSelectHdl(LINK(this, OGridFieldsSelection, OnEntrySelected)); - m_aExistFields.SetDoubleClickHdl(LINK(this, OGridFieldsSelection, OnEntryDoubleClicked)); - m_aSelFields.SetDoubleClickHdl(LINK(this, OGridFieldsSelection, OnEntryDoubleClicked)); - } - - //--------------------------------------------------------------------- - void OGridFieldsSelection::ActivatePage() - { - OGridPage::ActivatePage(); - m_aExistFields.GrabFocus(); - } - - //--------------------------------------------------------------------- - bool OGridFieldsSelection::canAdvance() const - { - return false; - // we're the last page in our wizard - } - - //--------------------------------------------------------------------- - void OGridFieldsSelection::initializePage() - { - OGridPage::initializePage(); - - const OControlWizardContext& rContext = getContext(); - fillListBox(m_aExistFields, rContext.aFieldNames); - - m_aSelFields.Clear(); - const OGridSettings& rSettings = getSettings(); - const ::rtl::OUString* pSelected = rSettings.aSelectedFields.getConstArray(); - const ::rtl::OUString* pEnd = pSelected + rSettings.aSelectedFields.getLength(); - for (; pSelected < pEnd; ++pSelected) - { - m_aSelFields.InsertEntry(*pSelected); - m_aExistFields.RemoveEntry(*pSelected); - } - - implCheckButtons(); - } - - //--------------------------------------------------------------------- - sal_Bool OGridFieldsSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OGridPage::commitPage(_eReason)) - return sal_False; - - OGridSettings& rSettings = getSettings(); - sal_uInt16 nSelected = m_aSelFields.GetEntryCount(); - - rSettings.aSelectedFields.realloc(nSelected); - ::rtl::OUString* pSelected = rSettings.aSelectedFields.getArray(); - - for (sal_uInt16 i=0; ienableButtons(WZB_FINISH, 0 != m_aSelFields.GetEntryCount()); - } - - //--------------------------------------------------------------------- - IMPL_LINK(OGridFieldsSelection, OnEntryDoubleClicked, ListBox*, _pList) - { - PushButton* pSimulateButton = &m_aExistFields == _pList ? &m_aSelectOne : &m_aDeselectOne; - if (pSimulateButton->IsEnabled()) - return OnMoveOneEntry( pSimulateButton ); - else - return 1L; - } - - //--------------------------------------------------------------------- - IMPL_LINK(OGridFieldsSelection, OnEntrySelected, ListBox*, /*NOTINTERESTEDIN*/) - { - implCheckButtons(); - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK(OGridFieldsSelection, OnMoveOneEntry, PushButton*, _pButton) - { - sal_Bool bMoveRight = (&m_aSelectOne == _pButton); - ListBox& rMoveTo = bMoveRight ? m_aSelFields : m_aExistFields; - - // the index of the selected entry - sal_uInt16 nSelected = bMoveRight ? m_aExistFields.GetSelectEntryPos() : m_aSelFields.GetSelectEntryPos(); - // the (original) relative position of the entry - sal_IntPtr nRelativeIndex = reinterpret_cast(bMoveRight ? m_aExistFields.GetEntryData(nSelected) : m_aSelFields.GetEntryData(nSelected)); - - sal_uInt16 nInsertPos = LISTBOX_APPEND; - if (!bMoveRight) - { // need to determine an insert pos which reflects the original - nInsertPos = 0; - while (nInsertPos < rMoveTo.GetEntryCount()) - { - if (reinterpret_cast(rMoveTo.GetEntryData(nInsertPos)) > nRelativeIndex) - break; - ++nInsertPos; - } - } - - // the text of the entry to move - String sMovingEntry = bMoveRight ? m_aExistFields.GetEntry(nSelected) : m_aSelFields.GetEntry(nSelected); - - // insert the entry - nInsertPos = rMoveTo.InsertEntry(sMovingEntry, nInsertPos); - // preserve it's "relative position" entry data - rMoveTo.SetEntryData(nInsertPos, reinterpret_cast(nRelativeIndex)); - - // remove the entry from it's old list - if (bMoveRight) - { - sal_uInt16 nSelectPos = m_aExistFields.GetSelectEntryPos(); - m_aExistFields.RemoveEntry(nSelected); - if ((LISTBOX_ENTRY_NOTFOUND != nSelectPos) && (nSelectPos < m_aExistFields.GetEntryCount())) - m_aExistFields.SelectEntryPos(nSelectPos); - - m_aExistFields.GrabFocus(); - } - else - { - sal_uInt16 nSelectPos = m_aSelFields.GetSelectEntryPos(); - m_aSelFields.RemoveEntry(nSelected); - if ((LISTBOX_ENTRY_NOTFOUND != nSelectPos) && (nSelectPos < m_aSelFields.GetEntryCount())) - m_aSelFields.SelectEntryPos(nSelectPos); - - m_aSelFields.GrabFocus(); - } - - implCheckButtons(); - return 0; - } - - //--------------------------------------------------------------------- - IMPL_LINK(OGridFieldsSelection, OnMoveAllEntries, PushButton*, _pButton) - { - sal_Bool bMoveRight = (&m_aSelectAll == _pButton); - m_aExistFields.Clear(); - m_aSelFields.Clear(); - fillListBox(bMoveRight ? m_aSelFields : m_aExistFields, getContext().aFieldNames); - - implCheckButtons(); - return 0; - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx deleted file mode 100644 index 085762ce4..000000000 --- a/extensions/source/dbpilots/gridwizard.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_GRIDWIZARD_HXX_ -#define _EXTENSIONS_DBP_GRIDWIZARD_HXX_ - -#include "controlwizard.hxx" -#include "commonpagesdbp.hxx" - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OGridSettings - //===================================================================== - struct OGridSettings : public OControlWizardSettings - { - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSelectedFields; - }; - - //===================================================================== - //= OGridWizard - //===================================================================== - class OGridWizard : public OControlWizard - { - protected: - OGridSettings m_aSettings; - sal_Bool m_bHadDataSelection : 1; - - public: - OGridWizard( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - OGridSettings& getSettings() { return m_aSettings; } - - protected: - // OWizardMachine overridables - virtual ::svt::OWizardPage* createPage( WizardState _nState ); - virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual void enterState( WizardState _nState ); - virtual sal_Bool leaveState( WizardState _nState ); - virtual sal_Bool onFinish(); - - virtual sal_Bool approveControl(sal_Int16 _nClassId); - - protected: - void implApplySettings(); - }; - - //===================================================================== - //= OGridPage - //===================================================================== - class OGridPage : public OControlWizardPage - { - public: - OGridPage( OGridWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { } - - protected: - OGridSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - }; - - //===================================================================== - //= OGridFieldsSelection - //===================================================================== - class OGridFieldsSelection : public OGridPage - { - protected: - FixedLine m_aFrame; - FixedText m_aExistFieldsLabel; - ListBox m_aExistFields; - PushButton m_aSelectOne; - PushButton m_aSelectAll; - PushButton m_aDeselectOne; - PushButton m_aDeselectAll; - FixedText m_aSelFieldsLabel; - ListBox m_aSelFields; - - public: - OGridFieldsSelection( OGridWizard* _pParent ); - - protected: - // TabPage overridables - virtual void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - - protected: - DECL_LINK(OnMoveOneEntry, PushButton*); - DECL_LINK(OnMoveAllEntries, PushButton*); - DECL_LINK(OnEntrySelected, ListBox*); - DECL_LINK(OnEntryDoubleClicked, ListBox*); - - void implCheckButtons(); - void implApplySettings(); - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > implGetColumns(sal_Bool _bShowError = sal_True); - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_GRIDWIZARD_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/groupboxpages.src b/extensions/source/dbpilots/groupboxpages.src deleted file mode 100644 index 11f77711c..000000000 --- a/extensions/source/dbpilots/groupboxpages.src +++ /dev/null @@ -1,240 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#include "dbpresid.hrc" -#endif - -TabPage RID_PAGE_GROUPRADIOSELECTION -{ - HelpID = "extensions:TabPage:RID_PAGE_GROUPRADIOSELECTION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Data"; - - FixedLine FL_DATA - { - Pos = MAP_APPFONT ( 4 , 40 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_RADIOLABELS - { - Pos = MAP_APPFONT ( 7 , 52 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, 24 ) ; - WordBreak = TRUE; - Group = TRUE; - Text [ en-US ] = "Which ~names do you want to give the option fields?"; - }; - Edit ET_RADIOLABELS - { - HelpID = "extensions:Edit:RID_PAGE_GROUPRADIOSELECTION:ET_RADIOLABELS"; - Pos = MAP_APPFONT ( 7 , 79 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 13, 12 ) ; - SVLook = TRUE ; - Border = TRUE ; - }; - PushButton PB_MOVETORIGHT - { - HelpID = "extensions:PushButton:RID_PAGE_GROUPRADIOSELECTION:PB_MOVETORIGHT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 , 79 ) ; - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X , ITEM_BUTTON_SIZE_Y ) ; - Text = "~>>"; - }; - PushButton PB_MOVETOLEFT - { - HelpID = "extensions:PushButton:RID_PAGE_GROUPRADIOSELECTION:PB_MOVETOLEFT"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 , 79 + ITEM_BUTTON_SIZE_Y + 3 ) ; - Size = MAP_APPFONT ( ITEM_BUTTON_SIZE_X , ITEM_BUTTON_SIZE_Y ) ; - Text = "~<<"; - }; - FixedText FT_RADIOBUTTONS - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + ITEM_BUTTON_SIZE_X / 2 + 6 , 52 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 6 - 7, 8 ) ; - Group = TRUE; - Text [ en-US ] = "~Option fields"; - }; - ListBox LB_RADIOBUTTONS - { - HelpID = "extensions:ListBox:RID_PAGE_GROUPRADIOSELECTION:LB_RADIOBUTTONS"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + ITEM_BUTTON_SIZE_X / 2 + 6 , 79 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - WINDOW_HALF_SIZE_X - ITEM_BUTTON_SIZE_X / 2 - 6 - 7, WINDOW_SIZE_Y - 79 - 6 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - Sort = FALSE; - }; -}; - -TabPage RID_PAGE_DEFAULTFIELDSELECTION -{ - HelpID = "extensions:TabPage:RID_PAGE_DEFAULTFIELDSELECTION"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Default Field Selection"; - - FixedLine FL_DEFAULTSELECTION - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_DEFAULTSELECTION - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 24 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "Should one option field be selected as a default?"; - }; - RadioButton RB_DEFSELECTION_YES - { - HelpID = "extensions:RadioButton:RID_PAGE_DEFAULTFIELDSELECTION:RB_DEFSELECTION_YES"; - Pos = MAP_APPFONT ( 7 , 44 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 10 ) ; - Group = TRUE; - TabStop = TRUE; - Text [ en-US ] = "~Yes, the following:"; - }; - ListBox LB_DEFSELECTIONFIELD - { - HelpID = "extensions:ListBox:RID_PAGE_DEFAULTFIELDSELECTION:LB_DEFSELECTIONFIELD"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 42 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 14 ) ; - TabStop = TRUE; - SVLook = TRUE ; - Border = TRUE ; - DropDown = TRUE; - AutoHScroll = TRUE ; - Sort = FALSE; - }; - RadioButton RB_DEFSELECTION_NO - { - HelpID = "extensions:RadioButton:RID_PAGE_DEFAULTFIELDSELECTION:RB_DEFSELECTION_NO"; - Pos = MAP_APPFONT ( 7 , 59 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 10 ) ; - TabStop = FALSE; - Text [ en-US ] = "No, one particular field is not going to be selected."; - }; -}; - -TabPage RID_PAGE_OPTIONVALUES -{ - HelpID = "extensions:TabPage:RID_PAGE_OPTIONVALUES"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Field Values"; - - FixedLine FL_OPTIONVALUES - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_OPTIONVALUES_EXPL - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 24 ) ; - WordBreak = TRUE; - Text [ en-US ] = "When you select an option, the option group is given a specific value."; - }; - FixedText FT_OPTIONVALUES - { - Pos = MAP_APPFONT ( 7 , 42 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 16 ) ; - WordBreak = TRUE; - Group = TRUE; - Text [ en-US ] = "Which ~value do you want to assign to each option?"; - }; - Edit ET_OPTIONVALUE - { - HelpID = "extensions:Edit:RID_PAGE_OPTIONVALUES:ET_OPTIONVALUE"; - Pos = MAP_APPFONT ( 7 , 61 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 12 ) ; - SVLook = TRUE ; - Border = TRUE ; - TabStop = TRUE; - }; - FixedText FT_RADIOBUTTONS - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14 , 8 ) ; - Text [ en-US ] = "~Option fields"; - }; - ListBox LB_RADIOBUTTONS - { - HelpID = "extensions:ListBox:RID_PAGE_OPTIONVALUES:LB_RADIOBUTTONS"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 26 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10 , WINDOW_SIZE_Y - 32 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - DropDown = FALSE; - }; -}; - -TabPage RID_PAGE_OPTIONS_FINAL -{ - HelpID = "extensions:TabPage:RID_PAGE_OPTIONS_FINAL"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - Text [ en-US ] = "Create Option Group"; - - FixedLine FL_NAMEIT - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_NAMEIT - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 16 ) ; - WordBreak = TRUE; - Text [ en-US ] = "Which ~caption is to be given to your option group?"; - }; - Edit ET_NAMEIT - { - HelpID = "extensions:Edit:RID_PAGE_OPTIONS_FINAL:ET_NAMEIT"; - Pos = MAP_APPFONT ( 7 , 34 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 12 ) ; - SVLook = TRUE ; - Border = TRUE ; - }; - FixedText FT_THATSALL - { - Pos = MAP_APPFONT ( 7 , WINDOW_SIZE_Y - 22 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14, 16 ) ; - WordBreak = TRUE; - Center = TRUE; - Text [ en-US ] = "These were all details needed to create the option group."; - }; -}; - -String RID_STR_GROUPWIZ_DBFIELD -{ - Text [ en-US ] = "You can either save the value of the option group in a database field or use it for a later action."; -}; - - diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx deleted file mode 100644 index b3bb8852c..000000000 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ /dev/null @@ -1,565 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "groupboxwiz.hxx" -#include "commonpagesdbp.hxx" -#include -#include -#include -#include "optiongrouplayouter.hxx" -#include "dbpilots.hrc" - - -//#define GBW_STATE_DATASELECTION 0 -#define GBW_STATE_OPTIONLIST 0 -#define GBW_STATE_DEFAULTOPTION 1 -#define GBW_STATE_OPTIONVALUES 2 -#define GBW_STATE_DBFIELD 3 -#define GBW_STATE_FINALIZE 4 - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::form; - using namespace ::svt; - - //===================================================================== - //= OGroupBoxWizard - //===================================================================== - //--------------------------------------------------------------------- - OGroupBoxWizard::OGroupBoxWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_GROUPBOXWIZARD), _rxObjectModel, _rxORB) - ,m_bVisitedDefault(sal_False) - ,m_bVisitedDB(sal_False) - { - initControlSettings(&m_aSettings); - - m_pPrevPage->SetHelpId(HID_GROUPWIZARD_PREVIOUS); - m_pNextPage->SetHelpId(HID_GROUPWIZARD_NEXT); - m_pCancel->SetHelpId(HID_GROUPWIZARD_CANCEL); - m_pFinish->SetHelpId(HID_GROUPWIZARD_FINISH); - } - - //--------------------------------------------------------------------- - sal_Bool OGroupBoxWizard::approveControl(sal_Int16 _nClassId) - { - return FormComponentType::GROUPBOX == _nClassId; - } - - //--------------------------------------------------------------------- - OWizardPage* OGroupBoxWizard::createPage(::svt::WizardTypes::WizardState _nState) - { - switch (_nState) - { - case GBW_STATE_OPTIONLIST: - return new ORadioSelectionPage(this); - - case GBW_STATE_DEFAULTOPTION: - return new ODefaultFieldSelectionPage(this); - - case GBW_STATE_OPTIONVALUES: - return new OOptionValuesPage(this); - - case GBW_STATE_DBFIELD: - return new OOptionDBFieldPage(this); - - case GBW_STATE_FINALIZE: - return new OFinalizeGBWPage(this); - } - - return NULL; - } - - //--------------------------------------------------------------------- - WizardTypes::WizardState OGroupBoxWizard::determineNextState( ::svt::WizardTypes::WizardState _nCurrentState ) const - { - switch (_nCurrentState) - { - case GBW_STATE_OPTIONLIST: - return GBW_STATE_DEFAULTOPTION; - - case GBW_STATE_DEFAULTOPTION: - return GBW_STATE_OPTIONVALUES; - - case GBW_STATE_OPTIONVALUES: - if (getContext().aFieldNames.getLength()) - return GBW_STATE_DBFIELD; - else - return GBW_STATE_FINALIZE; - - case GBW_STATE_DBFIELD: - return GBW_STATE_FINALIZE; - } - - return WZS_INVALID_STATE; - } - - //--------------------------------------------------------------------- - void OGroupBoxWizard::enterState(::svt::WizardTypes::WizardState _nState) - { - // some stuff to do before calling the base class (modifying our settings) - switch (_nState) - { - case GBW_STATE_DEFAULTOPTION: - if (!m_bVisitedDefault) - { // assume that the first of the radio buttons should be selected - DBG_ASSERT(m_aSettings.aLabels.size(), "OGroupBoxWizard::enterState: should never have reached this state!"); - m_aSettings.sDefaultField = m_aSettings.aLabels[0]; - } - m_bVisitedDefault = sal_True; - break; - - case GBW_STATE_DBFIELD: - if (!m_bVisitedDB) - { // try to generate a default for the DB field - // (simply use the first field in the DB names collection) - if (getContext().aFieldNames.getLength()) - m_aSettings.sDBField = getContext().aFieldNames[0]; - } - m_bVisitedDB = sal_True; - break; - } - - // setting the def button .... to be done before the base class is called, too, 'cause the base class - // calls the pages, which are allowed to override our def button behaviour - defaultButton(GBW_STATE_FINALIZE == _nState ? WZB_FINISH : WZB_NEXT); - - // allow "finish" on the last page only - enableButtons(WZB_FINISH, GBW_STATE_FINALIZE == _nState); - // allow previous on all pages but the first one - enableButtons(WZB_PREVIOUS, GBW_STATE_OPTIONLIST != _nState); - // allow next on all pages but the last one - enableButtons(WZB_NEXT, GBW_STATE_FINALIZE != _nState); - - OControlWizard::enterState(_nState); - } - - //--------------------------------------------------------------------- - void OGroupBoxWizard::createRadios() - { - try - { - OOptionGroupLayouter aLayouter(getServiceFactory()); - aLayouter.doLayout(getContext(), getSettings()); - } - catch(Exception&) - { - OSL_FAIL("OGroupBoxWizard::createRadios: caught an exception while creating the radio shapes!"); - } - } - - //--------------------------------------------------------------------- - sal_Bool OGroupBoxWizard::onFinish() - { - // commit the basic control setttings - commitControlSettings(&m_aSettings); - - // create the radio buttons - createRadios(); - - return OControlWizard::onFinish(); - } - - //===================================================================== - //= ORadioSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - ORadioSelectionPage::ORadioSelectionPage( OControlWizard* _pParent ) - :OGBWPage(_pParent, ModuleRes(RID_PAGE_GROUPRADIOSELECTION)) - ,m_aFrame (this, ModuleRes(FL_DATA)) - ,m_aRadioNameLabel (this, ModuleRes(FT_RADIOLABELS)) - ,m_aRadioName (this, ModuleRes(ET_RADIOLABELS)) - ,m_aMoveRight (this, ModuleRes(PB_MOVETORIGHT)) - ,m_aMoveLeft (this, ModuleRes(PB_MOVETOLEFT)) - ,m_aExistingRadiosLabel (this, ModuleRes(FT_RADIOBUTTONS)) - ,m_aExistingRadios (this, ModuleRes(LB_RADIOBUTTONS)) - { - FreeResource(); - - if (getContext().aFieldNames.getLength()) - { - enableFormDatasourceDisplay(); - } - else - { - adjustControlForNoDSDisplay(&m_aFrame); - adjustControlForNoDSDisplay(&m_aRadioNameLabel); - adjustControlForNoDSDisplay(&m_aRadioName); - adjustControlForNoDSDisplay(&m_aMoveRight); - adjustControlForNoDSDisplay(&m_aMoveLeft); - adjustControlForNoDSDisplay(&m_aExistingRadiosLabel); - adjustControlForNoDSDisplay(&m_aExistingRadios, sal_True); - } - - m_aMoveLeft.SetClickHdl(LINK(this, ORadioSelectionPage, OnMoveEntry)); - m_aMoveRight.SetClickHdl(LINK(this, ORadioSelectionPage, OnMoveEntry)); - m_aRadioName.SetModifyHdl(LINK(this, ORadioSelectionPage, OnNameModified)); - m_aExistingRadios.SetSelectHdl(LINK(this, ORadioSelectionPage, OnEntrySelected)); - - implCheckMoveButtons(); - m_aExistingRadios.EnableMultiSelection(sal_True); - - getDialog()->defaultButton(&m_aMoveRight); - - m_aExistingRadios.SetAccessibleRelationMemberOf(&m_aExistingRadios); - m_aExistingRadios.SetAccessibleRelationLabeledBy(&m_aExistingRadiosLabel); - } - - //--------------------------------------------------------------------- - void ORadioSelectionPage::ActivatePage() - { - OGBWPage::ActivatePage(); - m_aRadioName.GrabFocus(); - } - - //--------------------------------------------------------------------- - void ORadioSelectionPage::initializePage() - { - OGBWPage::initializePage(); - - m_aRadioName.SetText(String()); - - // no need to initialize the list of radios here - // (we're the only one affecting this special setting, so it will be in the same state as last time this - // page was commited) - - implCheckMoveButtons(); - } - - //--------------------------------------------------------------------- - sal_Bool ORadioSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OGBWPage::commitPage(_eReason)) - return sal_False; - - // copy the names of the radio buttons to be inserted - // and initialize the values - OOptionGroupSettings& rSettings = getSettings(); - rSettings.aLabels.clear(); - rSettings.aValues.clear(); - rSettings.aLabels.reserve(m_aExistingRadios.GetEntryCount()); - rSettings.aValues.reserve(m_aExistingRadios.GetEntryCount()); - for (::svt::WizardTypes::WizardState i=0; ienableButtons(WZB_NEXT, bHaveSome); - - if (bUnfinishedInput) - { - if (0 == (m_aMoveRight.GetStyle() & WB_DEFBUTTON)) - getDialog()->defaultButton(&m_aMoveRight); - } - else - { - if (WB_DEFBUTTON == (m_aMoveRight.GetStyle() & WB_DEFBUTTON)) - getDialog()->defaultButton(WZB_NEXT); - } - } - - //===================================================================== - //= ODefaultFieldSelectionPage - //===================================================================== - //--------------------------------------------------------------------- - ODefaultFieldSelectionPage::ODefaultFieldSelectionPage( OControlWizard* _pParent ) - :OMaybeListSelectionPage(_pParent, ModuleRes(RID_PAGE_DEFAULTFIELDSELECTION)) - ,m_aFrame (this, ModuleRes(FL_DEFAULTSELECTION)) - ,m_aDefaultSelectionLabel (this, ModuleRes(FT_DEFAULTSELECTION)) - ,m_aDefSelYes (this, ModuleRes(RB_DEFSELECTION_YES)) - ,m_aDefSelNo (this, ModuleRes(RB_DEFSELECTION_NO)) - ,m_aDefSelection (this, ModuleRes(LB_DEFSELECTIONFIELD)) - { - FreeResource(); - - announceControls(m_aDefSelYes, m_aDefSelNo, m_aDefSelection); - m_aDefSelection.SetDropDownLineCount(10); - m_aDefSelection.SetAccessibleRelationLabeledBy( &m_aDefSelYes ); - m_aDefSelection.SetAccessibleRelationMemberOf(&m_aDefaultSelectionLabel); - } - - //--------------------------------------------------------------------- - void ODefaultFieldSelectionPage::initializePage() - { - OMaybeListSelectionPage::initializePage(); - - const OOptionGroupSettings& rSettings = getSettings(); - - // fill the listbox - m_aDefSelection.Clear(); - for ( ConstStringArrayIterator aLoop = rSettings.aLabels.begin(); - aLoop != rSettings.aLabels.end(); - ++aLoop - ) - m_aDefSelection.InsertEntry(*aLoop); - - - implInitialize(rSettings.sDefaultField); - } - - //--------------------------------------------------------------------- - sal_Bool ODefaultFieldSelectionPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OMaybeListSelectionPage::commitPage(_eReason)) - return sal_False; - - OOptionGroupSettings& rSettings = getSettings(); - implCommit(rSettings.sDefaultField); - - return sal_True; - } - - //===================================================================== - //= OOptionValuesPage - //===================================================================== - //--------------------------------------------------------------------- - OOptionValuesPage::OOptionValuesPage( OControlWizard* _pParent ) - :OGBWPage(_pParent, ModuleRes(RID_PAGE_OPTIONVALUES)) - ,m_aFrame (this, ModuleRes(FL_OPTIONVALUES)) - ,m_aDescription (this, ModuleRes(FT_OPTIONVALUES_EXPL)) - ,m_aValueLabel (this, ModuleRes(FT_OPTIONVALUES)) - ,m_aValue (this, ModuleRes(ET_OPTIONVALUE)) - ,m_aOptionsLabel (this, ModuleRes(FT_RADIOBUTTONS)) - ,m_aOptions (this, ModuleRes(LB_RADIOBUTTONS)) - ,m_nLastSelection((::svt::WizardTypes::WizardState)-1) - { - FreeResource(); - - m_aOptions.SetSelectHdl(LINK(this, OOptionValuesPage, OnOptionSelected)); - - m_aOptions.SetAccessibleRelationMemberOf(&m_aOptions); - m_aOptions.SetAccessibleRelationLabeledBy(&m_aOptionsLabel); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OOptionValuesPage, OnOptionSelected, ListBox*, /*NOTINTERESTEDIN*/ ) - { - implTraveledOptions(); - return 0L; - } - - //--------------------------------------------------------------------- - void OOptionValuesPage::ActivatePage() - { - OGBWPage::ActivatePage(); - m_aValue.GrabFocus(); - } - - //--------------------------------------------------------------------- - void OOptionValuesPage::implTraveledOptions() - { - if ((::svt::WizardTypes::WizardState)-1 != m_nLastSelection) - { - // save the value for the last option - DBG_ASSERT((size_t)m_nLastSelection < m_aUncommittedValues.size(), "OOptionValuesPage::implTraveledOptions: invalid previous selection index!"); - m_aUncommittedValues[m_nLastSelection] = m_aValue.GetText(); - } - - m_nLastSelection = m_aOptions.GetSelectEntryPos(); - DBG_ASSERT((size_t)m_nLastSelection < m_aUncommittedValues.size(), "OOptionValuesPage::implTraveledOptions: invalid new selection index!"); - m_aValue.SetText(m_aUncommittedValues[m_nLastSelection]); - } - - //--------------------------------------------------------------------- - void OOptionValuesPage::initializePage() - { - OGBWPage::initializePage(); - - const OOptionGroupSettings& rSettings = getSettings(); - DBG_ASSERT(rSettings.aLabels.size(), "OOptionValuesPage::initializePage: no options!!"); - DBG_ASSERT(rSettings.aLabels.size() == rSettings.aValues.size(), "OOptionValuesPage::initializePage: inconsistent data!"); - - // fill the list with all available options - m_aOptions.Clear(); - m_nLastSelection = -1; - for ( ConstStringArrayIterator aLoop = rSettings.aLabels.begin(); - aLoop != rSettings.aLabels.end(); - ++aLoop - ) - m_aOptions.InsertEntry(*aLoop); - - // remember the values ... can't set them directly in the settings without the explicit commit call - // so we need have a copy of the values - m_aUncommittedValues = rSettings.aValues; - - // select the first entry - m_aOptions.SelectEntryPos(0); - implTraveledOptions(); - } - - //--------------------------------------------------------------------- - sal_Bool OOptionValuesPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OGBWPage::commitPage(_eReason)) - return sal_False; - - OOptionGroupSettings& rSettings = getSettings(); - - // commit the current value - implTraveledOptions(); - // copy the uncommitted values - rSettings.aValues = m_aUncommittedValues; - - return sal_True; - } - - //===================================================================== - //= OOptionDBFieldPage - //===================================================================== - //--------------------------------------------------------------------- - OOptionDBFieldPage::OOptionDBFieldPage( OControlWizard* _pParent ) - :ODBFieldPage(_pParent) - { - setDescriptionText(String(ModuleRes(RID_STR_GROUPWIZ_DBFIELD))); - } - - //--------------------------------------------------------------------- - String& OOptionDBFieldPage::getDBFieldSetting() - { - return getSettings().sDBField; - } - - //===================================================================== - //= OFinalizeGBWPage - //===================================================================== - //--------------------------------------------------------------------- - OFinalizeGBWPage::OFinalizeGBWPage( OControlWizard* _pParent ) - :OGBWPage(_pParent, ModuleRes(RID_PAGE_OPTIONS_FINAL)) - ,m_aFrame (this, ModuleRes(FL_NAMEIT)) - ,m_aNameLabel (this, ModuleRes(FT_NAMEIT)) - ,m_aName (this, ModuleRes(ET_NAMEIT)) - ,m_aThatsAll (this, ModuleRes(FT_THATSALL)) - { - FreeResource(); - } - - //--------------------------------------------------------------------- - void OFinalizeGBWPage::ActivatePage() - { - OGBWPage::ActivatePage(); - m_aName.GrabFocus(); - } - - //--------------------------------------------------------------------- - bool OFinalizeGBWPage::canAdvance() const - { - return false; - } - - //--------------------------------------------------------------------- - void OFinalizeGBWPage::initializePage() - { - OGBWPage::initializePage(); - - const OOptionGroupSettings& rSettings = getSettings(); - m_aName.SetText(rSettings.sControlLabel); - } - - //--------------------------------------------------------------------- - sal_Bool OFinalizeGBWPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OGBWPage::commitPage(_eReason)) - return sal_False; - - getSettings().sControlLabel = m_aName.GetText(); - - return sal_True; - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx deleted file mode 100644 index 2b762e1f9..000000000 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_ -#define _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_ - -#include "controlwizard.hxx" -#include "commonpagesdbp.hxx" - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OOptionGroupSettings - //===================================================================== - struct OOptionGroupSettings : public OControlWizardSettings - { - StringArray aLabels; - StringArray aValues; - String sDefaultField; - String sDBField; - String sName; - }; - - //===================================================================== - //= OGroupBoxWizard - //===================================================================== - class OGroupBoxWizard : public OControlWizard - { - protected: - OOptionGroupSettings m_aSettings; - - sal_Bool m_bVisitedDefault : 1; - sal_Bool m_bVisitedDB : 1; - - public: - OGroupBoxWizard( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - OOptionGroupSettings& getSettings() { return m_aSettings; } - - protected: - // OWizardMachine overridables - virtual ::svt::OWizardPage* createPage( WizardState _nState ); - virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual void enterState( WizardState _nState ); - virtual sal_Bool onFinish(); - - virtual sal_Bool approveControl(sal_Int16 _nClassId); - - protected: - void createRadios(); - }; - - //===================================================================== - //= OGBWPage - //===================================================================== - class OGBWPage : public OControlWizardPage - { - public: - OGBWPage( OControlWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { } - - protected: - OOptionGroupSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - }; - - //===================================================================== - //= ORadioSelectionPage - //===================================================================== - class ORadioSelectionPage : public OGBWPage - { - protected: - FixedLine m_aFrame; - FixedText m_aRadioNameLabel; - Edit m_aRadioName; - PushButton m_aMoveRight; - PushButton m_aMoveLeft; - FixedText m_aExistingRadiosLabel; - ListBox m_aExistingRadios; - - public: - ORadioSelectionPage( OControlWizard* _pParent ); - - protected: - // TabPage overridables - void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - - DECL_LINK( OnMoveEntry, PushButton* ); - DECL_LINK( OnEntrySelected, ListBox* ); - DECL_LINK( OnNameModified, Edit* ); - - void implCheckMoveButtons(); - }; - - //===================================================================== - //= ODefaultFieldSelectionPage - //===================================================================== - class ODefaultFieldSelectionPage : public OMaybeListSelectionPage - { - protected: - FixedLine m_aFrame; - FixedText m_aDefaultSelectionLabel; - RadioButton m_aDefSelYes; - RadioButton m_aDefSelNo; - ListBox m_aDefSelection; - - public: - ODefaultFieldSelectionPage( OControlWizard* _pParent ); - - protected: - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - OOptionGroupSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - }; - - //===================================================================== - //= OOptionValuesPage - //===================================================================== - class OOptionValuesPage : public OGBWPage - { - protected: - FixedLine m_aFrame; - FixedText m_aDescription; - FixedText m_aValueLabel; - Edit m_aValue; - FixedText m_aOptionsLabel; - ListBox m_aOptions; - - StringArray m_aUncommittedValues; - ::svt::WizardTypes::WizardState - m_nLastSelection; - - public: - OOptionValuesPage( OControlWizard* _pParent ); - - protected: - // TabPage overridables - void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - - void implTraveledOptions(); - - DECL_LINK( OnOptionSelected, ListBox* ); - }; - - //===================================================================== - //= OOptionDBFieldPage - //===================================================================== - class OOptionDBFieldPage : public ODBFieldPage - { - public: - OOptionDBFieldPage( OControlWizard* _pParent ); - - protected: - OOptionGroupSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - - // ODBFieldPage overridables - virtual String& getDBFieldSetting(); - }; - - //===================================================================== - //= OFinalizeGBWPage - //===================================================================== - class OFinalizeGBWPage : public OGBWPage - { - protected: - FixedLine m_aFrame; - FixedText m_aNameLabel; - Edit m_aName; - FixedText m_aThatsAll; - - public: - OFinalizeGBWPage( OControlWizard* _pParent ); - - protected: - // TabPage overridables - void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_GROUPBOXWIZ_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/listcombopages.src b/extensions/source/dbpilots/listcombopages.src deleted file mode 100644 index dd8603502..000000000 --- a/extensions/source/dbpilots/listcombopages.src +++ /dev/null @@ -1,211 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_DBPRESID_HRC_ -#include "dbpresid.hrc" -#endif - -TabPage RID_PAGE_LCW_CONTENTSELECTION_TABLE -{ - HelpID = "extensions:TabPage:RID_PAGE_LCW_CONTENTSELECTION_TABLE"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - Text [ en-US ] = "Table Selection"; - - FixedLine FL_FRAME - { - Pos = MAP_APPFONT ( 4 , 40 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - Text [ en-US ] = "Control"; - }; - - FixedText FT_SELECTTABLE_LABEL - { - Pos = MAP_APPFONT ( 7 , 52 ) ; - Size = MAP_APPFONT ( 120, WINDOW_SIZE_Y - 21 ) ; - WordBreak = TRUE; - Group = TRUE; - Text [ en-US ] = "On the right side, you see all the tables from the data source of the form.\n\n\nChoose the table from which the data should be used as basis for the list content:"; - }; - ListBox LB_SELECTTABLE - { - HelpID = "extensions:ListBox:RID_PAGE_LCW_CONTENTSELECTION_TABLE:LB_SELECTTABLE"; - Pos = MAP_APPFONT ( 130 , 52 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 130 - 7, WINDOW_SIZE_Y - 52 - 6 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - Sort = FALSE; - DropDown = FALSE; - }; -}; - -TabPage RID_PAGE_LCW_CONTENTSELECTION_FIELD -{ - HelpID = "extensions:TabPage:RID_PAGE_LCW_CONTENTSELECTION_FIELD"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - Text [ en-US ] = "Field Selection"; - - FixedLine FL_FRAME - { - Pos = MAP_APPFONT ( 4 , 3 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - - FixedText FT_TABLEFIELDS - { - Pos = MAP_APPFONT ( 7 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 3, 8 ) ; - WordBreak = TRUE; - Group = TRUE; - Text [ en-US ] = "Existing fields"; - }; - ListBox LB_SELECTFIELD - { - HelpID = "extensions:ListBox:RID_PAGE_LCW_CONTENTSELECTION_FIELD:LB_SELECTFIELD"; - Pos = MAP_APPFONT ( 7 , 26 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, WINDOW_SIZE_Y - 32 ) ; - SVLook = TRUE ; - Border = TRUE ; - AutoHScroll = TRUE ; - Sort = FALSE; - DropDown = FALSE; - }; - FixedText FT_DISPLAYEDFIELD - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 15 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 8 ) ; - Text [ en-US ] = "Display field"; - }; - Edit ET_DISPLAYEDFIELD - { - HelpID = "extensions:Edit:RID_PAGE_LCW_CONTENTSELECTION_FIELD:ET_DISPLAYEDFIELD"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 26 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 12 ) ; - SVLook = TRUE ; - Border = TRUE ; - ReadOnly = TRUE; - }; - FixedText FT_CONTENTFIELD_INFO - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 45 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, WINDOW_SIZE_Y - 51 ) ; - WordBreak = TRUE; - }; - String STR_FIELDINFO_COMBOBOX - { - Text [ en-US ] = "The contents of the field selected will be shown in the combo box list."; - }; - - String STR_FIELDINFO_LISTBOX - { - Text [ en-US ] = "The contents of the selected field will be shown in the list box if the linked fields are identical."; - }; -}; - -TabPage RID_PAGE_LCW_FIELDLINK -{ - HelpID = "extensions:TabPage:RID_PAGE_LCW_FIELDLINK"; - SVLook = TRUE ; - Size = MAP_APPFONT ( WINDOW_SIZE_X , WINDOW_SIZE_Y ) ; - - Text [ en-US ] = "Field Link"; - - FixedText FT_FIELDLINK_DESC - { - Pos = MAP_APPFONT ( 7 , 6 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 14 , 16 ) ; - WordBreak = TRUE; - Text [ en-US ] = "This is where you select fields with matching contents so that the value from the display field will be shown."; - }; - FixedLine FL_FRAME - { - Pos = MAP_APPFONT ( 4 , 25 ) ; - Size = MAP_APPFONT ( WINDOW_SIZE_X - 8 , 8 ) ; - }; - FixedText FT_VALUELISTFIELD - { - Pos = MAP_APPFONT ( 7 , 37 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 8 ) ; - Group = TRUE; - Text [ en-US ] = "Field from the ~Value Table"; - }; - ComboBox CMB_VALUELISTFIELD - { - HelpID = "extensions:ComboBox:RID_PAGE_LCW_FIELDLINK:CMB_VALUELISTFIELD"; - Pos = MAP_APPFONT ( 7 , 48 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, WINDOW_SIZE_Y - 54 ) ; - SVLook = TRUE ; - Border = TRUE ; - DropDown = FALSE; - Sort = FALSE; - AutoHScroll = TRUE; - }; - FixedText FT_TABLEFIELD - { - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 37 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, 8 ) ; - Group = TRUE; - Text [ en-US ] = "Field from the ~List Table"; - }; - ComboBox CMB_TABLEFIELD - { - HelpID = "extensions:ComboBox:RID_PAGE_LCW_FIELDLINK:CMB_TABLEFIELD"; - Pos = MAP_APPFONT ( WINDOW_HALF_SIZE_X + 3 , 48 ) ; - Size = MAP_APPFONT ( WINDOW_HALF_SIZE_X - 10, WINDOW_SIZE_Y - 54 ) ; - SVLook = TRUE ; - Border = TRUE ; - DropDown = FALSE; - Sort = FALSE; - AutoHScroll = TRUE; - }; -}; - -String RID_STR_COMBOWIZ_DBFIELD -{ - Text [ en-US ] = "You can either save the value of the combo box in a database field or use it for display purposes."; -}; - - - - - - - - - - - - - - - - - diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx deleted file mode 100644 index 7d27faf1d..000000000 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ /dev/null @@ -1,564 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "listcombowizard.hxx" -#include "commonpagesdbp.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include "dbpilots.hrc" -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::form; - using namespace ::svt; - using namespace ::dbtools; - - //===================================================================== - //= OListComboWizard - //===================================================================== - //--------------------------------------------------------------------- - OListComboWizard::OListComboWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_LISTCOMBOWIZARD), _rxObjectModel, _rxORB) - ,m_bListBox(sal_False) - ,m_bHadDataSelection(sal_True) - { - initControlSettings(&m_aSettings); - - m_pPrevPage->SetHelpId(HID_LISTWIZARD_PREVIOUS); - m_pNextPage->SetHelpId(HID_LISTWIZARD_NEXT); - m_pCancel->SetHelpId(HID_LISTWIZARD_CANCEL); - m_pFinish->SetHelpId(HID_LISTWIZARD_FINISH); - - // if we do not need the data source selection page ... - if (!needDatasourceSelection()) - { // ... skip it! - skip(1); - m_bHadDataSelection = sal_False; - } - } - - //--------------------------------------------------------------------- - sal_Bool OListComboWizard::approveControl(sal_Int16 _nClassId) - { - switch (_nClassId) - { - case FormComponentType::LISTBOX: - m_bListBox = sal_True; - setTitleBase(String(ModuleRes(RID_STR_LISTWIZARD_TITLE))); - return sal_True; - case FormComponentType::COMBOBOX: - m_bListBox = sal_False; - setTitleBase(String(ModuleRes(RID_STR_COMBOWIZARD_TITLE))); - return sal_True; - } - return sal_False; - } - - //--------------------------------------------------------------------- - OWizardPage* OListComboWizard::createPage(WizardState _nState) - { - switch (_nState) - { - case LCW_STATE_DATASOURCE_SELECTION: - return new OTableSelectionPage(this); - case LCW_STATE_TABLESELECTION: - return new OContentTableSelection(this); - case LCW_STATE_FIELDSELECTION: - return new OContentFieldSelection(this); - case LCW_STATE_FIELDLINK: - return new OLinkFieldsPage(this); - case LCW_STATE_COMBODBFIELD: - return new OComboDBFieldPage(this); - } - - return NULL; - } - - //--------------------------------------------------------------------- - WizardTypes::WizardState OListComboWizard::determineNextState( WizardState _nCurrentState ) const - { - switch (_nCurrentState) - { - case LCW_STATE_DATASOURCE_SELECTION: - return LCW_STATE_TABLESELECTION; - case LCW_STATE_TABLESELECTION: - return LCW_STATE_FIELDSELECTION; - case LCW_STATE_FIELDSELECTION: - return getFinalState(); - } - - return WZS_INVALID_STATE; - } - - //--------------------------------------------------------------------- - void OListComboWizard::enterState(WizardState _nState) - { - OControlWizard::enterState(_nState); - - enableButtons(WZB_PREVIOUS, m_bHadDataSelection ? (LCW_STATE_DATASOURCE_SELECTION < _nState) : LCW_STATE_TABLESELECTION < _nState); - enableButtons(WZB_NEXT, getFinalState() != _nState); - if (_nState < getFinalState()) - enableButtons(WZB_FINISH, sal_False); - - if (getFinalState() == _nState) - defaultButton(WZB_FINISH); - } - - //--------------------------------------------------------------------- - sal_Bool OListComboWizard::leaveState(WizardState _nState) - { - if (!OControlWizard::leaveState(_nState)) - return sal_False; - - if (getFinalState() == _nState) - defaultButton(WZB_NEXT); - - return sal_True; - } - - //--------------------------------------------------------------------- - void OListComboWizard::implApplySettings() - { - try - { - // for quoting identifiers, we need the connection meta data - Reference< XConnection > xConn = getFormConnection(); - DBG_ASSERT(xConn.is(), "OListComboWizard::implApplySettings: no connection, unable to quote!"); - Reference< XDatabaseMetaData > xMetaData; - if (xConn.is()) - xMetaData = xConn->getMetaData(); - - // do some quotings - if (xMetaData.is()) - { - ::rtl::OUString sQuoteString = xMetaData->getIdentifierQuoteString(); - if (isListBox()) // only when we have a listbox this should be not empty - getSettings().sLinkedListField = quoteName(sQuoteString, getSettings().sLinkedListField); - - ::rtl::OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, getSettings().sListContentTable, sCatalog, sSchema, sName, ::dbtools::eInDataManipulation ); - getSettings().sListContentTable = ::dbtools::composeTableNameForSelect( xConn, sCatalog, sSchema, sName ); - - getSettings().sListContentField = quoteName(sQuoteString, getSettings().sListContentField); - } - - // ListSourceType: SQL - getContext().xObjectModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListSourceType")), makeAny((sal_Int32)ListSourceType_SQL)); - - if (isListBox()) - { - // BoundColumn: 1 - getContext().xObjectModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BoundColumn")), makeAny((sal_Int16)1)); - - // build the statement to set as list source - String sStatement; - sStatement.AppendAscii("SELECT "); - sStatement += getSettings().sListContentField; - sStatement.AppendAscii(", "); - sStatement += getSettings().sLinkedListField; - sStatement.AppendAscii(" FROM "); - sStatement += getSettings().sListContentTable; - Sequence< ::rtl::OUString > aListSource(1); - aListSource[0] = sStatement; - getContext().xObjectModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListSource")), makeAny(aListSource)); - } - else - { - // build the statement to set as list source - String sStatement; - sStatement.AppendAscii("SELECT DISTINCT "); - sStatement += getSettings().sListContentField; - sStatement.AppendAscii(" FROM "); - sStatement += getSettings().sListContentTable; - getContext().xObjectModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListSource")), makeAny(::rtl::OUString(sStatement))); - } - - // the bound field - getContext().xObjectModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataField")), makeAny(::rtl::OUString(getSettings().sLinkedFormField))); - } - catch(Exception&) - { - OSL_FAIL("OListComboWizard::implApplySettings: could not set the property values for the listbox!"); - } - } - - //--------------------------------------------------------------------- - sal_Bool OListComboWizard::onFinish() - { - if ( !OControlWizard::onFinish() ) - return sal_False; - - implApplySettings(); - return sal_True; - } - - //===================================================================== - //= OLCPage - //===================================================================== - //--------------------------------------------------------------------- - Reference< XNameAccess > OLCPage::getTables(sal_Bool _bNeedIt) - { - Reference< XConnection > xConn = getFormConnection(); - DBG_ASSERT(!_bNeedIt || xConn.is(), "OLCPage::getTables: should have an active connection when reaching this page!"); - (void)_bNeedIt; - - Reference< XTablesSupplier > xSuppTables(xConn, UNO_QUERY); - Reference< XNameAccess > xTables; - if (xSuppTables.is()) - xTables = xSuppTables->getTables(); - - DBG_ASSERT(!_bNeedIt || xTables.is() || !xConn.is(), "OLCPage::getTables: got no tables from the connection!"); - - return xTables; - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > OLCPage::getTableFields(sal_Bool _bNeedIt) - { - Reference< XNameAccess > xTables = getTables(_bNeedIt); - Sequence< ::rtl::OUString > aColumnNames; - if (xTables.is()) - { - try - { - // the list table as XColumnsSupplier - Reference< XColumnsSupplier > xSuppCols; - xTables->getByName(getSettings().sListContentTable) >>= xSuppCols; - DBG_ASSERT(!_bNeedIt || xSuppCols.is(), "OLCPage::getTableFields: no columns supplier!"); - - // the columns - Reference< XNameAccess > xColumns; - if (xSuppCols.is()) - xColumns = xSuppCols->getColumns(); - - // the column names - if (xColumns.is()) - aColumnNames = xColumns->getElementNames(); - } - catch(Exception&) - { - DBG_ASSERT(!_bNeedIt, "OLinkFieldsPage::initializePage: caught an exception while retrieving the columns!"); - } - } - return aColumnNames; - } - - //===================================================================== - //= OContentTableSelection - //===================================================================== - //--------------------------------------------------------------------- - OContentTableSelection::OContentTableSelection( OListComboWizard* _pParent ) - :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_CONTENTSELECTION_TABLE)) - ,m_aFrame (this, ModuleRes(FL_FRAME)) - ,m_aSelectTableLabel (this, ModuleRes(FT_SELECTTABLE_LABEL)) - ,m_aSelectTable (this, ModuleRes(LB_SELECTTABLE)) - { - FreeResource(); - - enableFormDatasourceDisplay(); - - m_aSelectTable.SetDoubleClickHdl(LINK(this, OContentTableSelection, OnTableDoubleClicked)); - m_aSelectTable.SetSelectHdl(LINK(this, OContentTableSelection, OnTableSelected)); - } - - //--------------------------------------------------------------------- - void OContentTableSelection::ActivatePage() - { - OLCPage::ActivatePage(); - m_aSelectTable.GrabFocus(); - } - - //--------------------------------------------------------------------- - bool OContentTableSelection::canAdvance() const - { - if (!OLCPage::canAdvance()) - return false; - - return 0 != m_aSelectTable.GetSelectEntryCount(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OContentTableSelection, OnTableSelected, ListBox*, /*_pListBox*/ ) - { - updateDialogTravelUI(); - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK( OContentTableSelection, OnTableDoubleClicked, ListBox*, _pListBox ) - { - if (_pListBox->GetSelectEntryCount()) - getDialog()->travelNext(); - return 0L; - } - - //--------------------------------------------------------------------- - void OContentTableSelection::initializePage() - { - OLCPage::initializePage(); - - // fill the list with the table name - m_aSelectTable.Clear(); - try - { - Reference< XNameAccess > xTables = getTables(sal_True); - Sequence< ::rtl::OUString > aTableNames; - if (xTables.is()) - aTableNames = xTables->getElementNames(); - fillListBox(m_aSelectTable, aTableNames); - } - catch(Exception&) - { - OSL_FAIL("OContentTableSelection::initializePage: could not retrieve the table names!"); - } - - m_aSelectTable.SelectEntry(getSettings().sListContentTable); - } - - //--------------------------------------------------------------------- - sal_Bool OContentTableSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OLCPage::commitPage(_eReason)) - return sal_False; - - OListComboSettings& rSettings = getSettings(); - rSettings.sListContentTable = m_aSelectTable.GetSelectEntry(); - if (!rSettings.sListContentTable.Len() && (::svt::WizardTypes::eTravelBackward != _eReason)) - // need to select a table - return sal_False; - - return sal_True; - } - - //===================================================================== - //= OContentFieldSelection - //===================================================================== - //--------------------------------------------------------------------- - OContentFieldSelection::OContentFieldSelection( OListComboWizard* _pParent ) - :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_CONTENTSELECTION_FIELD)) - ,m_aFrame (this, ModuleRes(FL_FRAME)) - ,m_aTableFields (this, ModuleRes(FT_TABLEFIELDS)) - ,m_aSelectTableField (this, ModuleRes(LB_SELECTFIELD)) - ,m_aDisplayedFieldLabel (this, ModuleRes(FT_DISPLAYEDFIELD)) - ,m_aDisplayedField (this, ModuleRes(ET_DISPLAYEDFIELD)) - ,m_aInfo (this, ModuleRes(FT_CONTENTFIELD_INFO)) - { - m_aInfo.SetText(String(ModuleRes( isListBox() ? STR_FIELDINFO_LISTBOX : STR_FIELDINFO_COMBOBOX))); - FreeResource(); - m_aSelectTableField.SetSelectHdl(LINK(this, OContentFieldSelection, OnFieldSelected)); - m_aSelectTableField.SetDoubleClickHdl(LINK(this, OContentFieldSelection, OnTableDoubleClicked)); - } - - //--------------------------------------------------------------------- - void OContentFieldSelection::ActivatePage() - { - OLCPage::ActivatePage(); - m_aTableFields.GrabFocus(); - } - - //--------------------------------------------------------------------- - void OContentFieldSelection::initializePage() - { - OLCPage::initializePage(); - - // fill the list of fields - fillListBox(m_aSelectTableField, getTableFields(sal_True)); - - m_aSelectTableField.SelectEntry(getSettings().sListContentField); - m_aDisplayedField.SetText(getSettings().sListContentField); - } - - //--------------------------------------------------------------------- - bool OContentFieldSelection::canAdvance() const - { - if (!OLCPage::canAdvance()) - return false; - - return 0 != m_aSelectTableField.GetSelectEntryCount(); - } - - //--------------------------------------------------------------------- - IMPL_LINK( OContentFieldSelection, OnTableDoubleClicked, ListBox*, /*NOTINTERESTEDIN*/ ) - { - if (m_aSelectTableField.GetSelectEntryCount()) - getDialog()->travelNext(); - return 0L; - } - - //--------------------------------------------------------------------- - IMPL_LINK( OContentFieldSelection, OnFieldSelected, ListBox*, /*NOTINTERESTEDIN*/ ) - { - updateDialogTravelUI(); - m_aDisplayedField.SetText(m_aSelectTableField.GetSelectEntry()); - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool OContentFieldSelection::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OLCPage::commitPage(_eReason)) - return sal_False; - - getSettings().sListContentField = m_aSelectTableField.GetSelectEntry(); - - return sal_True; - } - - //===================================================================== - //= OLinkFieldsPage - //===================================================================== - //--------------------------------------------------------------------- - OLinkFieldsPage::OLinkFieldsPage( OListComboWizard* _pParent ) - :OLCPage(_pParent, ModuleRes(RID_PAGE_LCW_FIELDLINK)) - ,m_aDescription (this, ModuleRes(FT_FIELDLINK_DESC)) - ,m_aFrame (this, ModuleRes(FL_FRAME)) - ,m_aValueListFieldLabel (this, ModuleRes(FT_VALUELISTFIELD)) - ,m_aValueListField (this, ModuleRes(CMB_VALUELISTFIELD)) - ,m_aTableFieldLabel (this, ModuleRes(FT_TABLEFIELD)) - ,m_aTableField (this, ModuleRes(CMB_TABLEFIELD)) - { - FreeResource(); - - m_aValueListField.SetModifyHdl(LINK(this, OLinkFieldsPage, OnSelectionModified)); - m_aTableField.SetModifyHdl(LINK(this, OLinkFieldsPage, OnSelectionModified)); - m_aValueListField.SetSelectHdl(LINK(this, OLinkFieldsPage, OnSelectionModified)); - m_aTableField.SetSelectHdl(LINK(this, OLinkFieldsPage, OnSelectionModified)); - } - - //--------------------------------------------------------------------- - void OLinkFieldsPage::ActivatePage() - { - OLCPage::ActivatePage(); - m_aValueListField.GrabFocus(); - } - - //--------------------------------------------------------------------- - void OLinkFieldsPage::initializePage() - { - OLCPage::initializePage(); - - // fill the value list - fillListBox(m_aValueListField, getContext().aFieldNames); - // fill the table field list - fillListBox(m_aTableField, getTableFields(sal_True)); - - // the initial selections - m_aValueListField.SetText(getSettings().sLinkedFormField); - m_aTableField.SetText(getSettings().sLinkedListField); - - implCheckFinish(); - } - - //--------------------------------------------------------------------- - bool OLinkFieldsPage::canAdvance() const - { - // we're on the last page here, no travelNext allowed ... - return false; - } - - //--------------------------------------------------------------------- - void OLinkFieldsPage::implCheckFinish() - { - sal_Bool bInvalidSelection = (COMBOBOX_ENTRY_NOTFOUND == m_aValueListField.GetEntryPos(m_aValueListField.GetText())); - bInvalidSelection |= (COMBOBOX_ENTRY_NOTFOUND == m_aTableField.GetEntryPos(m_aTableField.GetText())); - getDialog()->enableButtons(WZB_FINISH, !bInvalidSelection); - } - - //--------------------------------------------------------------------- - IMPL_LINK(OLinkFieldsPage, OnSelectionModified, void*, EMPTYARG) - { - implCheckFinish(); - return 0L; - } - - //--------------------------------------------------------------------- - sal_Bool OLinkFieldsPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) - { - if (!OLCPage::commitPage(_eReason)) - return sal_False; - - getSettings().sLinkedFormField = m_aValueListField.GetText(); - getSettings().sLinkedListField = m_aTableField.GetText(); - - return sal_True; - } - - //===================================================================== - //= OComboDBFieldPage - //===================================================================== - //--------------------------------------------------------------------- - OComboDBFieldPage::OComboDBFieldPage( OControlWizard* _pParent ) - :ODBFieldPage(_pParent) - { - setDescriptionText(String(ModuleRes(RID_STR_COMBOWIZ_DBFIELD))); - } - - //--------------------------------------------------------------------- - String& OComboDBFieldPage::getDBFieldSetting() - { - return getSettings().sLinkedFormField; - } - - //--------------------------------------------------------------------- - void OComboDBFieldPage::ActivatePage() - { - ODBFieldPage::ActivatePage(); - getDialog()->enableButtons(WZB_FINISH, sal_True); - } - - //--------------------------------------------------------------------- - bool OComboDBFieldPage::canAdvance() const - { - // we're on the last page here, no travelNext allowed ... - return false; - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx deleted file mode 100644 index 2f0ff8f85..000000000 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ -#define _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ - -#include "controlwizard.hxx" -#include "commonpagesdbp.hxx" - -//......................................................................... -namespace dbp -{ -//......................................................................... - -#define LCW_STATE_DATASOURCE_SELECTION 0 -#define LCW_STATE_TABLESELECTION 1 -#define LCW_STATE_FIELDSELECTION 2 -#define LCW_STATE_FIELDLINK 3 -#define LCW_STATE_COMBODBFIELD 4 - - //===================================================================== - //= OListComboSettings - //===================================================================== - struct OListComboSettings : public OControlWizardSettings - { - String sListContentTable; - String sListContentField; - String sLinkedFormField; - String sLinkedListField; - }; - - //===================================================================== - //= OListComboWizard - //===================================================================== - class OListComboWizard : public OControlWizard - { - protected: - OListComboSettings m_aSettings; - sal_Bool m_bListBox : 1; - sal_Bool m_bHadDataSelection : 1; - - public: - OListComboWizard( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - OListComboSettings& getSettings() { return m_aSettings; } - - sal_Bool isListBox() const { return m_bListBox; } - - protected: - // OWizardMachine overridables - virtual ::svt::OWizardPage* createPage( WizardState _nState ); - virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual void enterState( WizardState _nState ); - virtual sal_Bool leaveState( WizardState _nState ); - virtual sal_Bool onFinish(); - - virtual sal_Bool approveControl(sal_Int16 _nClassId); - - WizardState getFinalState() const { return isListBox() ? LCW_STATE_FIELDLINK : LCW_STATE_COMBODBFIELD; } - - private: - void implApplySettings(); - }; - - //===================================================================== - //= OLCPage - //===================================================================== - class OLCPage : public OControlWizardPage - { - public: - OLCPage( OListComboWizard* _pParent, const ResId& _rId ) : OControlWizardPage(_pParent, _rId) { } - - protected: - OListComboSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - sal_Bool isListBox() { return static_cast(getDialog())->isListBox(); } - - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - getTables(sal_Bool _bNeedIt); - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getTableFields(sal_Bool _bNeedIt); - }; - - //===================================================================== - //= OContentTableSelection - //===================================================================== - class OContentTableSelection : public OLCPage - { - protected: - FixedLine m_aFrame; - FixedText m_aSelectTableLabel; - ListBox m_aSelectTable; - - public: - OContentTableSelection( OListComboWizard* _pParent ); - - protected: - // TabPage overridables - virtual void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - - protected: - DECL_LINK( OnTableDoubleClicked, ListBox* ); - DECL_LINK( OnTableSelected, ListBox* ); - }; - - //===================================================================== - //= OContentFieldSelection - //===================================================================== - class OContentFieldSelection : public OLCPage - { - protected: - FixedLine m_aFrame; - FixedText m_aTableFields; - ListBox m_aSelectTableField; - FixedText m_aDisplayedFieldLabel; - Edit m_aDisplayedField; - FixedText m_aInfo; - - - public: - OContentFieldSelection( OListComboWizard* _pParent ); - - protected: - DECL_LINK( OnFieldSelected, ListBox* ); - DECL_LINK( OnTableDoubleClicked, ListBox* ); - - // TabPage overridables - virtual void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - }; - - //===================================================================== - //= OLinkFieldsPage - //===================================================================== - class OLinkFieldsPage : public OLCPage - { - protected: - FixedText m_aDescription; - FixedLine m_aFrame; - FixedText m_aValueListFieldLabel; - ComboBox m_aValueListField; - FixedText m_aTableFieldLabel; - ComboBox m_aTableField; - - - public: - OLinkFieldsPage( OListComboWizard* _pParent ); - - protected: - // TabPage overridables - virtual void ActivatePage(); - - // OWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ); - virtual bool canAdvance() const; - - private: - void implCheckFinish(); - - DECL_LINK(OnSelectionModified, void*); - }; - - //===================================================================== - //= OComboDBFieldPage - //===================================================================== - class OComboDBFieldPage : public ODBFieldPage - { - public: - OComboDBFieldPage( OControlWizard* _pParent ); - - protected: - OListComboSettings& getSettings() { return static_cast(getDialog())->getSettings(); } - - // TabPage overridables - virtual void ActivatePage(); - - // OWizardPage overridables - virtual bool canAdvance() const; - - // ODBFieldPage overridables - virtual String& getDBFieldSetting(); - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_LISTCOMBOWIZARD_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/makefile.mk b/extensions/source/dbpilots/makefile.mk deleted file mode 100644 index e37ab0a54..000000000 --- a/extensions/source/dbpilots/makefile.mk +++ /dev/null @@ -1,111 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. -PRJINC=..$/inc - -PRJNAME=extensions -TARGET=dbp -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- defines ------------------------------------------------------ - -CDEFS+=-DCOMPMOD_NAMESPACE=dbp - -# --- Files -------------------------------------------------------- - -CXXFILES= dbptools.cxx \ - gridwizard.cxx \ - listcombowizard.cxx \ - optiongrouplayouter.cxx \ - commonpagesdbp.cxx \ - groupboxwiz.cxx \ - wizardservices.cxx \ - controlwizard.cxx \ - moduledbp.cxx \ - dbpservices.cxx - -SLOFILES= $(SLO)$/dbptools.obj \ - $(SLO)$/gridwizard.obj \ - $(SLO)$/listcombowizard.obj \ - $(SLO)$/optiongrouplayouter.obj \ - $(SLO)$/commonpagesdbp.obj \ - $(SLO)$/groupboxwiz.obj \ - $(SLO)$/wizardservices.obj \ - $(SLO)$/controlwizard.obj \ - $(SLO)$/moduledbp.obj \ - $(SLO)$/dbpservices.obj - - -SRS1NAME=$(TARGET) -SRC1FILES= gridpages.src \ - commonpagesdbp.src \ - dbpilots.src \ - groupboxpages.src \ - listcombopages.src - -RESLIB1NAME=dbp -RESLIB1SRSFILES= $(SRS)$/dbp.srs - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -SHL1STDLIBS= \ - $(SVTOOLLIB) \ - $(VCLLIB) \ - $(TOOLSLIB) \ - $(SVLLIB) \ - $(SFXLIB) \ - $(DBTOOLSLIB) \ - $(UNOTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/dbp.component - -$(MISC)/dbp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - dbp.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt dbp.component diff --git a/extensions/source/dbpilots/moduledbp.cxx b/extensions/source/dbpilots/moduledbp.cxx deleted file mode 100644 index ead975319..000000000 --- a/extensions/source/dbpilots/moduledbp.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "componentmodule.cxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/optiongrouplayouter.cxx b/extensions/source/dbpilots/optiongrouplayouter.cxx deleted file mode 100644 index 16caae4a2..000000000 --- a/extensions/source/dbpilots/optiongrouplayouter.cxx +++ /dev/null @@ -1,218 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "optiongrouplayouter.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "controlwizard.hxx" -#include "groupboxwiz.hxx" -#include "dbptools.hxx" - -//......................................................................... -namespace dbp -{ -//......................................................................... - -#define BUTTON_HEIGHT 300 -#define TOP_HEIGHT 300 -#define HEIGHT 450 -#define OFFSET 300 -#define MIN_WIDTH 600 - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::drawing; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::text; - using namespace ::com::sun::star::view; - - //===================================================================== - //= OOptionGroupLayouter - //===================================================================== - //--------------------------------------------------------------------- - OOptionGroupLayouter::OOptionGroupLayouter(const Reference< XMultiServiceFactory >& _rxORB) - :m_xORB(_rxORB) - { - } - - //--------------------------------------------------------------------- - void OOptionGroupLayouter::doLayout(const OControlWizardContext& _rContext, const OOptionGroupSettings& _rSettings) - { - Reference< XShapes > xPageShapes(_rContext.xDrawPage, UNO_QUERY); - if (!xPageShapes.is()) - { - OSL_FAIL("OOptionGroupLayouter::OOptionGroupLayouter: missing the XShapes interface for the page!"); - return; - } - - Reference< XMultiServiceFactory > xDocFactory(_rContext.xDocumentModel, UNO_QUERY); - if (!xDocFactory.is()) - { - OSL_FAIL("OOptionGroupLayouter::OOptionGroupLayouter: no document service factory!"); - return; - } - - // no. of buttons to create - sal_Int32 nRadioButtons = _rSettings.aLabels.size(); - - sal_Int32 nTopSpace = 0; - - // the shape of the groupbox - ::com::sun::star::awt::Size aControlShapeSize = _rContext.xObjectShape->getSize(); - // maybe need to adjust the size if the control shapes - sal_Int32 nMinShapeHeight = BUTTON_HEIGHT*(nRadioButtons+1) + BUTTON_HEIGHT + BUTTON_HEIGHT/4; - if (aControlShapeSize.Height < nMinShapeHeight) - aControlShapeSize.Height = nMinShapeHeight; - if (aControlShapeSize.Width < MIN_WIDTH) - aControlShapeSize.Width = MIN_WIDTH; - _rContext.xObjectShape->setSize(aControlShapeSize); - - // if we're working on a writer document, we need to anchor the shape - implAnchorShape(Reference< XPropertySet >(_rContext.xObjectShape, UNO_QUERY)); - - // shape collection (for grouping the shapes) - Reference< XShapes > xButtonCollection(m_xORB->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection"))), - UNO_QUERY); - // first member : the shape of the control - xButtonCollection->add(_rContext.xObjectShape.get()); - - sal_Int32 nTempHeight = (aControlShapeSize.Height - BUTTON_HEIGHT/4) / (nRadioButtons + 1); - - ::com::sun::star::awt::Point aShapePosition = _rContext.xObjectShape->getPosition(); - - ::com::sun::star::awt::Size aButtonSize(aControlShapeSize); - aButtonSize.Width = aControlShapeSize.Width - OFFSET; - aButtonSize.Height = HEIGHT; - ::com::sun::star::awt::Point aButtonPosition; - aButtonPosition.X = aShapePosition.X + OFFSET; - - ::rtl::OUString sElementsName(RTL_CONSTASCII_USTRINGPARAM("RadioGroup")); - disambiguateName(Reference< XNameAccess >(_rContext.xForm, UNO_QUERY), sElementsName); - - StringArray::const_iterator aLabelIter = _rSettings.aLabels.begin(); - StringArray::const_iterator aValueIter = _rSettings.aValues.begin(); - for (sal_Int32 i=0; i xRadioModel( - xDocFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.RadioButton"))), - UNO_QUERY); - - // the label - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Label")), makeAny(rtl::OUString(*aLabelIter))); - // the value - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RefValue")), makeAny(rtl::OUString(*aValueIter))); - - // default selection - if (_rSettings.sDefaultField == *aLabelIter) - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultState")), makeAny(sal_Int16(1))); - - // the connection to the database field - if (0 != _rSettings.sDBField.Len()) - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataField")), makeAny(::rtl::OUString(_rSettings.sDBField))); - - // the name for the model - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), makeAny(sElementsName)); - - // create a shape for the radio button - Reference< XControlShape > xRadioShape( - xDocFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape"))), - UNO_QUERY); - Reference< XPropertySet > xShapeProperties(xRadioShape, UNO_QUERY); - - // if we're working on a writer document, we need to anchor the shape - implAnchorShape(xShapeProperties); - - // position it - xRadioShape->setSize(aButtonSize); - xRadioShape->setPosition(aButtonPosition); - // knitting with the model - xRadioShape->setControl(Reference< XControlModel >(xRadioModel, UNO_QUERY)); - - // the name of the shape - if (xShapeProperties.is()) - xShapeProperties->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), makeAny(sElementsName)); - - // add to the page - xPageShapes->add(xRadioShape.get()); - // add to the collection (for the later grouping) - xButtonCollection->add(xRadioShape.get()); - - // set the GroupBox as "LabelControl" for the RadioButton - // (_after_ having inserted the model into the page!) - xRadioModel->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LabelControl")), makeAny(_rContext.xObjectModel)); - } - - // group the shapes - try - { - Reference< XShapeGrouper > xGrouper(_rContext.xDrawPage, UNO_QUERY); - if (xGrouper.is()) - { - Reference< XShapeGroup > xGroupedOptions = xGrouper->group(xButtonCollection); - Reference< XSelectionSupplier > xSelector(_rContext.xDocumentModel->getCurrentController(), UNO_QUERY); - if (xSelector.is()) - xSelector->select(makeAny(xGroupedOptions)); - } - } - catch(Exception&) - { - OSL_FAIL("OOptionGroupLayouter::doLayout: caught an exception while grouping the shapes!"); - } - } - - //--------------------------------------------------------------------- - void OOptionGroupLayouter::implAnchorShape(const Reference< XPropertySet >& _rxShapeProps) - { - static const ::rtl::OUString s_sAnchorPropertyName(RTL_CONSTASCII_USTRINGPARAM("AnchorType")); - Reference< XPropertySetInfo > xPropertyInfo; - if (_rxShapeProps.is()) - xPropertyInfo = _rxShapeProps->getPropertySetInfo(); - if (xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(s_sAnchorPropertyName)) - _rxShapeProps->setPropertyValue(s_sAnchorPropertyName, makeAny(TextContentAnchorType_AT_PAGE)); - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/optiongrouplayouter.hxx b/extensions/source/dbpilots/optiongrouplayouter.hxx deleted file mode 100644 index 52b6e7bfc..000000000 --- a/extensions/source/dbpilots/optiongrouplayouter.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_OPTIONGROUPLAYOUTER_HXX_ -#define _EXTENSIONS_DBP_OPTIONGROUPLAYOUTER_HXX_ - -#include -#include -#include -#include -#include -#include "dbptypes.hxx" - -//......................................................................... -namespace dbp -{ -//......................................................................... - - struct OControlWizardContext; - struct OOptionGroupSettings; - //===================================================================== - //= OOptionGroupLayouter - //===================================================================== - class OOptionGroupLayouter - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - - public: - OOptionGroupLayouter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - public: - void doLayout( - const OControlWizardContext& _rContext, - const OOptionGroupSettings& _rSettings - ); - - protected: - void implAnchorShape( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxShapeProps - ); - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_OPTIONGROUPLAYOUTER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx deleted file mode 100644 index bfa4e0cfe..000000000 --- a/extensions/source/dbpilots/unoautopilot.hxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_UNOAUTOPILOT_HXX_ -#define _EXTENSIONS_DBP_UNOAUTOPILOT_HXX_ - -#include -#include -#include "componentmodule.hxx" -#include -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= IServiceInfo - //===================================================================== - /** interface for the SERVICEINFO template parameter of the OUnoAutoPilot class - */ - struct IServiceInfo - { - public: - ::rtl::OUString getImplementationName() const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getServiceNames() const; - }; - - //===================================================================== - //= OUnoAutoPilot - //===================================================================== - typedef ::svt::OGenericUnoDialog OUnoAutoPilot_Base; - template - class OUnoAutoPilot - :public OUnoAutoPilot_Base - ,public ::comphelper::OPropertyArrayUsageHelper< OUnoAutoPilot< TYPE, SERVICEINFO > > - ,public OModuleResourceClient - { - OUnoAutoPilot(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xObjectModel; - - public: - // XTypeProvider - virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - virtual void implInitialize(const com::sun::star::uno::Any& _rValue); - }; - -#include "unoautopilot.inl" - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_UNOAUTOPILOT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/unoautopilot.inl b/extensions/source/dbpilots/unoautopilot.inl deleted file mode 100644 index 9c07e4c2e..000000000 --- a/extensions/source/dbpilots/unoautopilot.inl +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// no include protecttion -// this file is included from unoautopilot.hxx directly - -//===================================================================== -//= OUnoAutoPilot -//===================================================================== -template -OUnoAutoPilot::OUnoAutoPilot(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) - :OUnoAutoPilot_Base(_rxORB) -{ -} - -//--------------------------------------------------------------------- -template -::com::sun::star::uno::Sequence SAL_CALL OUnoAutoPilot::getImplementationId( ) throw(::com::sun::star::uno::RuntimeException) -{ - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); -} - -//--------------------------------------------------------------------- -template -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OUnoAutoPilot::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) -{ - return *(new OUnoAutoPilot(_rxFactory)); -} - -//--------------------------------------------------------------------- -template -::rtl::OUString SAL_CALL OUnoAutoPilot::getImplementationName() throw(::com::sun::star::uno::RuntimeException) -{ - return getImplementationName_Static(); -} - -//--------------------------------------------------------------------- -template -::rtl::OUString OUnoAutoPilot::getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException) -{ - return SERVICEINFO().getImplementationName(); -} - -//--------------------------------------------------------------------- -template -::comphelper::StringSequence SAL_CALL OUnoAutoPilot::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} - -//--------------------------------------------------------------------- -template -::comphelper::StringSequence OUnoAutoPilot::getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException) -{ - return SERVICEINFO().getServiceNames(); -} - -//--------------------------------------------------------------------- -template -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OUnoAutoPilot::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//--------------------------------------------------------------------- -template -::cppu::IPropertyArrayHelper& OUnoAutoPilot::getInfoHelper() -{ - return *const_cast(this)->getArrayHelper(); -} - -//-------------------------------------------------------------------------- -template -::cppu::IPropertyArrayHelper* OUnoAutoPilot::createArrayHelper( ) const -{ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); -} - -//-------------------------------------------------------------------------- -template -Dialog* OUnoAutoPilot::createDialog(Window* _pParent) -{ - return new TYPE(_pParent, m_xObjectModel, m_aContext.getLegacyServiceFactory()); -} - -//-------------------------------------------------------------------------- -template -void OUnoAutoPilot::implInitialize(const com::sun::star::uno::Any& _rValue) -{ - ::com::sun::star::beans::PropertyValue aArgument; - if (_rValue >>= aArgument) - if (0 == aArgument.Name.compareToAscii("ObjectModel")) - { - aArgument.Value >>= m_xObjectModel; - return; - } - - OUnoAutoPilot_Base::implInitialize(_rValue); -} - - diff --git a/extensions/source/dbpilots/wizardcontext.hxx b/extensions/source/dbpilots/wizardcontext.hxx deleted file mode 100644 index 93cc936bd..000000000 --- a/extensions/source/dbpilots/wizardcontext.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBP_WIZARDCONTEXT_HXX_ -#define _EXTENSIONS_DBP_WIZARDCONTEXT_HXX_ - -#include -#include -#include -#include -#include -#include -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OControlWizardContext - //===================================================================== - struct OControlWizardContext - { - // the global data source context - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - xDatasourceContext; - - // the control mode - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xObjectModel; - // the form the control model belongs to - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xForm; - // the form as rowset - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > - xRowSet; - - // the model of the document - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - xDocumentModel; - // the page where the control mode resides - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > - xDrawPage; - // the shape which carries the control - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape > - xObjectShape; - - // the tables or queries of the data source the form is bound to (if any) - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - xObjectContainer; - // the column types container of the object the form is bound to (table, query or SQL statement) - DECLARE_STL_USTRINGACCESS_MAP(sal_Int32,TNameTypeMap); - TNameTypeMap aTypes; - // the column names of the object the form is bound to (table, query or SQL statement) - ::com::sun::star::uno::Sequence< ::rtl::OUString > - aFieldNames; - - sal_Bool bEmbedded; - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBP_WIZARDCONTEXT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/wizardservices.cxx b/extensions/source/dbpilots/wizardservices.cxx deleted file mode 100644 index 9846cdb9d..000000000 --- a/extensions/source/dbpilots/wizardservices.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "wizardservices.hxx" -#include "unoautopilot.hxx" -#include "groupboxwiz.hxx" -#include "listcombowizard.hxx" -#include "gridwizard.hxx" - -// the registration methods -extern "C" void SAL_CALL createRegistryInfo_OGroupBoxWizard() -{ - static ::dbp::OMultiInstanceAutoRegistration< - ::dbp::OUnoAutoPilot< ::dbp::OGroupBoxWizard, ::dbp::OGroupBoxSI > - > aAutoRegistration; -} - -extern "C" void SAL_CALL createRegistryInfo_OListComboWizard() -{ - static ::dbp::OMultiInstanceAutoRegistration< - ::dbp::OUnoAutoPilot< ::dbp::OListComboWizard, ::dbp::OListComboSI > - > aAutoRegistration; -} - -extern "C" void SAL_CALL createRegistryInfo_OGridWizard() -{ - static ::dbp::OMultiInstanceAutoRegistration< - ::dbp::OUnoAutoPilot< ::dbp::OGridWizard, ::dbp::OGridSI > - > aAutoRegistration; -} - -//......................................................................... -namespace dbp -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - - //===================================================================== - //= OGroupBoxSI - //===================================================================== - //--------------------------------------------------------------------- - ::rtl::OUString OGroupBoxSI::getImplementationName() const - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbp.OGroupBoxWizard")); - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > OGroupBoxSI::getServiceNames() const - { - Sequence< ::rtl::OUString > aReturn(1); - aReturn[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.GroupBoxAutoPilot")); - return aReturn; - } - - //===================================================================== - //= OListComboSI - //===================================================================== - //--------------------------------------------------------------------- - ::rtl::OUString OListComboSI::getImplementationName() const - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbp.OListComboWizard")); - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > OListComboSI::getServiceNames() const - { - Sequence< ::rtl::OUString > aReturn(1); - aReturn[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.ListComboBoxAutoPilot")); - return aReturn; - } - - //===================================================================== - //= OGridSI - //===================================================================== - //--------------------------------------------------------------------- - ::rtl::OUString OGridSI::getImplementationName() const - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.dbp.OGridWizard")); - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > OGridSI::getServiceNames() const - { - Sequence< ::rtl::OUString > aReturn(1); - aReturn[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.GridControlAutoPilot")); - return aReturn; - } - -//......................................................................... -} // namespace dbp -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/dbpilots/wizardservices.hxx b/extensions/source/dbpilots/wizardservices.hxx deleted file mode 100644 index 48c57115b..000000000 --- a/extensions/source/dbpilots/wizardservices.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_DBW_WIZARDSERVICES_HXX_ -#define _EXTENSIONS_DBW_WIZARDSERVICES_HXX_ - -#include -#include - -//......................................................................... -namespace dbp -{ -//......................................................................... - - //===================================================================== - //= OGroupBoxSI - //===================================================================== - /// service info for the group box wizard - struct OGroupBoxSI - { - public: - ::rtl::OUString getImplementationName() const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getServiceNames() const; - }; - - //===================================================================== - //= OListComboSI - //===================================================================== - /// service info for the list/combo box wizard - struct OListComboSI - { - public: - ::rtl::OUString getImplementationName() const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getServiceNames() const; - }; - - //===================================================================== - //= OGridSI - //===================================================================== - /// service info for the grid wizard - struct OGridSI - { - public: - ::rtl::OUString getImplementationName() const; - ::com::sun::star::uno::Sequence< ::rtl::OUString > - getServiceNames() const; - }; - -//......................................................................... -} // namespace dbp -//......................................................................... - -#endif // _EXTENSIONS_DBW_WIZARDSERVICES_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx deleted file mode 100644 index f95fb8272..000000000 --- a/extensions/source/inc/componentmodule.cxx +++ /dev/null @@ -1,293 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "componentmodule.hxx" -#include -#include -#include -#include - -#define ENTER_MOD_METHOD() \ - ::osl::MutexGuard aGuard(s_aMutex); \ - ensureImpl() - -//......................................................................... -namespace COMPMOD_NAMESPACE -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::registry; - using namespace ::comphelper; - using namespace ::cppu; - - //========================================================================= - //= OModuleImpl - //========================================================================= - /** implementation for OModule. not threadsafe, has to be guarded by it's owner - */ - class OModuleImpl - { - ResMgr* m_pRessources; - sal_Bool m_bInitialized; - ByteString m_sFilePrefix; - - public: - /// ctor - OModuleImpl(); - ~OModuleImpl(); - - /// get the manager for the ressources of the module - ResMgr* getResManager(); - void setResourceFilePrefix(const ::rtl::OString& _rPrefix) { m_sFilePrefix = _rPrefix; } - }; - - //------------------------------------------------------------------------- - OModuleImpl::OModuleImpl() - :m_pRessources(NULL) - ,m_bInitialized(sal_False) - { - } - - //------------------------------------------------------------------------- - OModuleImpl::~OModuleImpl() - { - if (m_pRessources) - delete m_pRessources; - } - - //------------------------------------------------------------------------- - ResMgr* OModuleImpl::getResManager() - { - // note that this method is not threadsafe, which counts for the whole class ! - if (!m_pRessources && !m_bInitialized) - { - DBG_ASSERT(m_sFilePrefix.Len(), "OModuleImpl::getResManager: no resource file prefix!"); - // create a manager with a fixed prefix - ByteString aMgrName = m_sFilePrefix; - - m_pRessources = ResMgr::CreateResMgr(aMgrName.GetBuffer()); - DBG_ASSERT(m_pRessources, - (ByteString("OModuleImpl::getResManager: could not create the resource manager (file name: ") - += aMgrName - += ByteString(")!")).GetBuffer()); - - m_bInitialized = sal_True; - } - return m_pRessources; - } - - //========================================================================= - //= OModule - //========================================================================= - ::osl::Mutex OModule::s_aMutex; - sal_Int32 OModule::s_nClients = 0; - OModuleImpl* OModule::s_pImpl = NULL; - ::rtl::OString OModule::s_sResPrefix; - //------------------------------------------------------------------------- - ResMgr* OModule::getResManager() - { - ENTER_MOD_METHOD(); - return s_pImpl->getResManager(); - } - - //------------------------------------------------------------------------- - void OModule::setResourceFilePrefix(const ::rtl::OString& _rPrefix) - { - ::osl::MutexGuard aGuard(s_aMutex); - s_sResPrefix = _rPrefix; - if (s_pImpl) - s_pImpl->setResourceFilePrefix(_rPrefix); - } - - //------------------------------------------------------------------------- - void OModule::registerClient() - { - ::osl::MutexGuard aGuard(s_aMutex); - ++s_nClients; - } - - //------------------------------------------------------------------------- - void OModule::revokeClient() - { - ::osl::MutexGuard aGuard(s_aMutex); - if (!--s_nClients && s_pImpl) - { - delete s_pImpl; - s_pImpl = NULL; - } - } - - //------------------------------------------------------------------------- - void OModule::ensureImpl() - { - if (s_pImpl) - return; - s_pImpl = new OModuleImpl(); - s_pImpl->setResourceFilePrefix(s_sResPrefix); - } - - //-------------------------------------------------------------------------- - //- registration helper - //-------------------------------------------------------------------------- - - Sequence< ::rtl::OUString >* OModule::s_pImplementationNames = NULL; - Sequence< Sequence< ::rtl::OUString > >* OModule::s_pSupportedServices = NULL; - Sequence< sal_Int64 >* OModule::s_pCreationFunctionPointers = NULL; - Sequence< sal_Int64 >* OModule::s_pFactoryFunctionPointers = NULL; - - //-------------------------------------------------------------------------- - void OModule::registerComponent( - const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, - ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction) - { - if (!s_pImplementationNames) - { - OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers, - "OModule::registerComponent : inconsistent state (the pointers (1)) !"); - s_pImplementationNames = new Sequence< ::rtl::OUString >; - s_pSupportedServices = new Sequence< Sequence< ::rtl::OUString > >; - s_pCreationFunctionPointers = new Sequence< sal_Int64 >; - s_pFactoryFunctionPointers = new Sequence< sal_Int64 >; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::registerComponent : inconsistent state (the pointers (2)) !"); - - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OModule::registerComponent : inconsistent state !"); - - sal_Int32 nOldLen = s_pImplementationNames->getLength(); - s_pImplementationNames->realloc(nOldLen + 1); - s_pSupportedServices->realloc(nOldLen + 1); - s_pCreationFunctionPointers->realloc(nOldLen + 1); - s_pFactoryFunctionPointers->realloc(nOldLen + 1); - - s_pImplementationNames->getArray()[nOldLen] = _rImplementationName; - s_pSupportedServices->getArray()[nOldLen] = _rServiceNames; - s_pCreationFunctionPointers->getArray()[nOldLen] = reinterpret_cast(_pCreateFunction); - s_pFactoryFunctionPointers->getArray()[nOldLen] = reinterpret_cast(_pFactoryFunction); - } - - //-------------------------------------------------------------------------- - void OModule::revokeComponent(const ::rtl::OUString& _rImplementationName) - { - if (!s_pImplementationNames) - { - OSL_FAIL("OModule::revokeComponent : have no class infos ! Are you sure called this method at the right time ?"); - return; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::revokeComponent : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OModule::revokeComponent : inconsistent state !"); - - sal_Int32 nLen = s_pImplementationNames->getLength(); - const ::rtl::OUString* pImplNames = s_pImplementationNames->getConstArray(); - for (sal_Int32 i=0; iequals(_rImplementationName)) - { - removeElementAt(*s_pImplementationNames, i); - removeElementAt(*s_pSupportedServices, i); - removeElementAt(*s_pCreationFunctionPointers, i); - removeElementAt(*s_pFactoryFunctionPointers, i); - break; - } - } - - if (s_pImplementationNames->getLength() == 0) - { - delete s_pImplementationNames; s_pImplementationNames = NULL; - delete s_pSupportedServices; s_pSupportedServices = NULL; - delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = NULL; - delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = NULL; - } - } - - //-------------------------------------------------------------------------- - Reference< XInterface > OModule::getComponentFactory( - const ::rtl::OUString& _rImplementationName, - const Reference< XMultiServiceFactory >& _rxServiceManager) - { - OSL_ENSURE(_rxServiceManager.is(), "OModule::getComponentFactory : invalid argument (service manager) !"); - OSL_ENSURE(_rImplementationName.getLength(), "OModule::getComponentFactory : invalid argument (implementation name) !"); - - if (!s_pImplementationNames) - { - OSL_FAIL("OModule::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?"); - return NULL; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::getComponentFactory : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OModule::getComponentFactory : inconsistent state !"); - - - Reference< XInterface > xReturn; - - - sal_Int32 nLen = s_pImplementationNames->getLength(); - const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); - const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); - const sal_Int64* pComponentFunction = s_pCreationFunctionPointers->getConstArray(); - const sal_Int64* pFactoryFunction = s_pFactoryFunctionPointers->getConstArray(); - - for (sal_Int32 i=0; iequals(_rImplementationName)) - { - const FactoryInstantiation FactoryInstantiationFunction = reinterpret_cast(*pFactoryFunction); - const ComponentInstantiation ComponentInstantiationFunction = reinterpret_cast(*pComponentFunction); - - xReturn = FactoryInstantiationFunction( _rxServiceManager, *pImplName, ComponentInstantiationFunction, *pServices, NULL); - if (xReturn.is()) - { - xReturn->acquire(); - return xReturn.get(); - } - } - } - - return NULL; - } - - -//......................................................................... -} // namespace COMPMOD_NAMESPACE -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/inc/componentmodule.hxx b/extensions/source/inc/componentmodule.hxx deleted file mode 100644 index 6834f3c55..000000000 --- a/extensions/source/inc/componentmodule.hxx +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_COMPONENT_MODULE_HXX_ -#define _EXTENSIONS_COMPONENT_MODULE_HXX_ - -/** you may find this file helpfull if you implement a component (in it's own library) which can't use - the usual infrastructure.
- More precise, you find helper classes to ease the use of resources and the registration of services. -

- You need to define a preprocessor variable COMPMOD_NAMESPACE in order to use this file. Set it to a string - which should be used as namespace for the classes defined herein.

-*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -class ResMgr; - -//......................................................................... -namespace COMPMOD_NAMESPACE -{ -//......................................................................... - -typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > (SAL_CALL *FactoryInstantiation) - ( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rServiceManager, - const ::rtl::OUString & _rComponentName, - ::cppu::ComponentInstantiation _pCreateFunction, - const ::com::sun::star::uno::Sequence< ::rtl::OUString > & _rServiceNames, - rtl_ModuleCount* _pModuleCounter - ); - - //========================================================================= - //= OModule - //========================================================================= - class OModuleImpl; - class OModule - { - friend class OModuleResourceClient; - - private: - OModule(); - // not implemented. OModule is a static class - - protected: - // resource administration - static ::osl::Mutex s_aMutex; /// access safety - static sal_Int32 s_nClients; /// number of registered clients - static OModuleImpl* s_pImpl; /// impl class. lives as long as at least one client for the module is registered - static ::rtl::OString s_sResPrefix; - - // auto registration administration - static ::com::sun::star::uno::Sequence< ::rtl::OUString >* - s_pImplementationNames; - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >* - s_pSupportedServices; - static ::com::sun::star::uno::Sequence< sal_Int64 >* - s_pCreationFunctionPointers; - static ::com::sun::star::uno::Sequence< sal_Int64 >* - s_pFactoryFunctionPointers; - - public: - // cna be set as long as no resource has been accessed ... - static void setResourceFilePrefix(const ::rtl::OString& _rPrefix); - - /// get the vcl res manager of the module - static ResMgr* getResManager(); - - /** register a component implementing a service with the given data. - @param _rImplementationName - the implementation name of the component - @param _rServiceNames - the services the component supports - @param _pCreateFunction - a function for creating an instance of the component - @param _pFactoryFunction - a function for creating a factory for that component - @see revokeComponent - */ - static void registerComponent( - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, - ::cppu::ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction); - - /** revoke the registration for the specified component - @param _rImplementationName - the implementation name of the component - */ - static void revokeComponent( - const ::rtl::OUString& _rImplementationName); - - /** creates a Factory for the component with the given implementation name. -

Usually used from within component_getFactory.

- @param _rxServiceManager - a pointer to an XMultiServiceFactory interface as got in component_getFactory - @param _pImplementationName - the implementation name of the component - @return - the XInterface access to a factory for the component - */ - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory( - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager - ); - - protected: - /// register a client for the module - static void registerClient(); - /// revoke a client for the module - static void revokeClient(); - - private: - /** ensure that the impl class exists - @precond m_aMutex is guarded when this method gets called - */ - static void ensureImpl(); - }; - - //========================================================================= - //= OModuleResourceClient - //========================================================================= - /** base class for objects which uses any global module-specific ressources - */ - class OModuleResourceClient - { - public: - OModuleResourceClient() { OModule::registerClient(); } - ~OModuleResourceClient() { OModule::revokeClient(); } - }; - - //========================================================================= - //= ModuleRes - //========================================================================= - /** specialized ResId, using the ressource manager provided by the global module - */ - class ModuleRes : public ::ResId - { - public: - ModuleRes(sal_uInt16 _nId) : ResId(_nId, *OModule::getResManager()) { } - }; - - //========================================================================== - //= OMultiInstanceAutoRegistration - //========================================================================== - template - class OMultiInstanceAutoRegistration - { - public: - /** automatically registeres a multi instance component -

Assumed that the template argument has the three methods -

    -
  • static ::rtl::OUString getImplementationName_Static()
  • -
  • static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()
  • -
  • static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&) -
  • -
      - the instantiation of this object will automatically register the class via OModule::registerComponent. -

      - The factory creation function used is ::cppu::createSingleFactory. - @see OOneInstanceAutoRegistration - */ - OMultiInstanceAutoRegistration(); - ~OMultiInstanceAutoRegistration(); - }; - - template - OMultiInstanceAutoRegistration::OMultiInstanceAutoRegistration() - { - OModule::registerComponent( - TYPE::getImplementationName_Static(), - TYPE::getSupportedServiceNames_Static(), - TYPE::Create, - ::cppu::createSingleFactory - ); - } - - template - OMultiInstanceAutoRegistration::~OMultiInstanceAutoRegistration() - { - OModule::revokeComponent(TYPE::getImplementationName_Static()); - } - - //========================================================================== - //= OOneInstanceAutoRegistration - //========================================================================== - template - class OOneInstanceAutoRegistration - { - public: - /** automatically registeres a single instance component -

      Assumed that the template argument has the three methods -

        -
      • static ::rtl::OUString getImplementationName_Static()
      • -
      • static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()
      • -
      • static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&) -
      • -
          - the instantiation of this object will automatically register the class via OModule::registerComponent. -

          - The factory creation function used is ::cppu::createOneInstanceFactory. - @see OOneInstanceAutoRegistration - */ - OOneInstanceAutoRegistration(); - ~OOneInstanceAutoRegistration(); - }; - - template - OOneInstanceAutoRegistration::OOneInstanceAutoRegistration() - { - OModule::registerComponent( - TYPE::getImplementationName_Static(), - TYPE::getSupportedServiceNames_Static(), - TYPE::Create, - ::cppu::createOneInstanceFactory - ); - } - - template - OOneInstanceAutoRegistration::~OOneInstanceAutoRegistration() - { - OModule::revokeComponent(TYPE::getImplementationName_Static()); - } - -//......................................................................... -} // namespace COMPMOD_NAMESPACE -//......................................................................... - -#endif // _EXTENSIONS_COMPONENT_MODULE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/consolehandler.cxx b/extensions/source/logging/consolehandler.cxx deleted file mode 100644 index 5cfac7e06..000000000 --- a/extensions/source/logging/consolehandler.cxx +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "log_module.hxx" -#include "methodguard.hxx" -#include "loghandler.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include -#include - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::logging::XConsoleHandler; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::lang::XInitialization; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::beans::NamedValue; - /** === end UNO using === **/ - namespace LogLevel = ::com::sun::star::logging::LogLevel; - - //==================================================================== - //= ConsoleHandler - declaration - //==================================================================== - //-------------------------------------------------------------------- - typedef ::cppu::WeakComponentImplHelper3 < XConsoleHandler - , XServiceInfo - , XInitialization - > ConsoleHandler_Base; - class ConsoleHandler :public ::cppu::BaseMutex - ,public ConsoleHandler_Base - { - private: - ::comphelper::ComponentContext m_aContext; - LogHandlerHelper m_aHandlerHelper; - sal_Int32 m_nThreshold; - - protected: - ConsoleHandler( const Reference< XComponentContext >& _rxContext ); - virtual ~ConsoleHandler(); - - // XConsoleHandler - virtual ::sal_Int32 SAL_CALL getThreshold() throw (RuntimeException); - virtual void SAL_CALL setThreshold( ::sal_Int32 _threshold ) throw (RuntimeException); - - // XLogHandler - virtual ::rtl::OUString SAL_CALL getEncoding() throw (RuntimeException); - virtual void SAL_CALL setEncoding( const ::rtl::OUString& _encoding ) throw (RuntimeException); - virtual Reference< XLogFormatter > SAL_CALL getFormatter() throw (RuntimeException); - virtual void SAL_CALL setFormatter( const Reference< XLogFormatter >& _formatter ) throw (RuntimeException); - virtual ::sal_Int32 SAL_CALL getLevel() throw (RuntimeException); - virtual void SAL_CALL setLevel( ::sal_Int32 _level ) throw (RuntimeException); - virtual void SAL_CALL flush( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL publish( const LogRecord& Record ) throw (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); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - - public: - typedef ComponentMethodGuard< ConsoleHandler > MethodGuard; - void enterMethod( MethodGuard::Access ); - void leaveMethod( MethodGuard::Access ); - }; - - //==================================================================== - //= ConsoleHandler - implementation - //==================================================================== - //-------------------------------------------------------------------- - ConsoleHandler::ConsoleHandler( const Reference< XComponentContext >& _rxContext ) - :ConsoleHandler_Base( m_aMutex ) - ,m_aContext( _rxContext ) - ,m_aHandlerHelper( _rxContext, m_aMutex, rBHelper ) - ,m_nThreshold( LogLevel::SEVERE ) - { - } - - //-------------------------------------------------------------------- - ConsoleHandler::~ConsoleHandler() - { - if ( !rBHelper.bDisposed ) - { - acquire(); - dispose(); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::disposing() - { - m_aHandlerHelper.setFormatter( NULL ); - } - - //-------------------------------------------------------------------- - void ConsoleHandler::enterMethod( MethodGuard::Access ) - { - m_aHandlerHelper.enterMethod(); - } - - //-------------------------------------------------------------------- - void ConsoleHandler::leaveMethod( MethodGuard::Access ) - { - m_aMutex.release(); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL ConsoleHandler::getThreshold() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - return m_nThreshold; - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::setThreshold( ::sal_Int32 _threshold ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_nThreshold = _threshold; - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL ConsoleHandler::getEncoding() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - ::rtl::OUString sEncoding; - OSL_VERIFY( m_aHandlerHelper.getEncoding( sEncoding ) ); - return sEncoding; - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::setEncoding( const ::rtl::OUString& _rEncoding ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - OSL_VERIFY( m_aHandlerHelper.setEncoding( _rEncoding ) ); - } - - //-------------------------------------------------------------------- - Reference< XLogFormatter > SAL_CALL ConsoleHandler::getFormatter() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aHandlerHelper.getFormatter(); - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::setFormatter( const Reference< XLogFormatter >& _rxFormatter ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aHandlerHelper.setFormatter( _rxFormatter ); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL ConsoleHandler::getLevel() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aHandlerHelper.getLevel(); - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::setLevel( ::sal_Int32 _nLevel ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aHandlerHelper.setLevel( _nLevel ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::flush( ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - fflush( stdout ); - fflush( stderr ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ConsoleHandler::publish( const LogRecord& _rRecord ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - ::rtl::OString sEntry; - if ( !m_aHandlerHelper.formatForPublishing( _rRecord, sEntry ) ) - return sal_False; - - if ( _rRecord.Level >= m_nThreshold ) - fprintf( stderr, "%s\n", sEntry.getStr() ); - else - fprintf( stdout, "%s\n", sEntry.getStr() ); - - return sal_True; - } - - //-------------------------------------------------------------------- - void SAL_CALL ConsoleHandler::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_aHandlerHelper.getIsInitialized() ) - throw AlreadyInitializedException(); - - if ( _rArguments.getLength() == 0 ) - { // create() - nothing to init - m_aHandlerHelper.setIsInitialized(); - return; - } - - if ( _rArguments.getLength() != 1 ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - Sequence< NamedValue > aSettings; - if ( !( _rArguments[0] >>= aSettings ) ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - // createWithSettings( [in] sequence< ::com::sun::star::beans::NamedValue > Settings ) - ::comphelper::NamedValueCollection aTypedSettings( aSettings ); - m_aHandlerHelper.initFromSettings( aTypedSettings ); - - aTypedSettings.get_ensureType( "Threshold", m_nThreshold ); - - m_aHandlerHelper.setIsInitialized(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL ConsoleHandler::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ConsoleHandler::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) - { - const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); - for ( const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray(); - pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++pServiceNames - ) - if ( _rServiceName == *pServiceNames ) - return sal_True; - return sal_False; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL ConsoleHandler::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL ConsoleHandler::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.ConsoleHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL ConsoleHandler::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.ConsoleHandler" ) ); - return aServiceNames; - } - - //-------------------------------------------------------------------- - Reference< XInterface > ConsoleHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new ConsoleHandler( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void createRegistryInfo_ConsoleHandler() - { - static OAutoRegistration< ConsoleHandler > aAutoRegistration; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx deleted file mode 100644 index 244b0b340..000000000 --- a/extensions/source/logging/csvformatter.cxx +++ /dev/null @@ -1,377 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "log_module.hxx" - -#include -#include - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include - -#include - -namespace logging -{ - - /** === begin UNO using === **/ - using ::com::sun::star::logging::XCsvLogFormatter; - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::XInterface; - /** === end UNO using === **/ - - //= CsvFormatter - declaration - //= formats for csv files as defined by RFC4180 - typedef ::cppu::WeakImplHelper2 < XCsvLogFormatter - , XServiceInfo - > CsvFormatter_Base; - class CsvFormatter : public CsvFormatter_Base - { - public: - virtual ::rtl::OUString SAL_CALL formatMultiColumn(const Sequence< ::rtl::OUString>& column_data) throw (RuntimeException); - - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& context ); - - protected: - CsvFormatter( const Reference< XComponentContext >& context ); - virtual ~CsvFormatter(); - - // XCsvLogFormatter - virtual ::sal_Bool SAL_CALL getLogEventNo() throw (RuntimeException); - virtual ::sal_Bool SAL_CALL getLogThread() throw (RuntimeException); - virtual ::sal_Bool SAL_CALL getLogTimestamp() throw (RuntimeException); - virtual ::sal_Bool SAL_CALL getLogSource() throw (RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getColumnnames() throw (RuntimeException); - - virtual void SAL_CALL setLogEventNo( ::sal_Bool log_event_no ) throw (RuntimeException); - virtual void SAL_CALL setLogThread( ::sal_Bool log_thread ) throw (RuntimeException); - virtual void SAL_CALL setLogTimestamp( ::sal_Bool log_timestamp ) throw (RuntimeException); - virtual void SAL_CALL setLogSource( ::sal_Bool log_source ) throw (RuntimeException); - virtual void SAL_CALL setColumnnames( const Sequence< ::rtl::OUString>& column_names) throw (RuntimeException); - - // XLogFormatter - virtual ::rtl::OUString SAL_CALL getHead( ) throw (RuntimeException); - virtual ::rtl::OUString SAL_CALL format( const LogRecord& Record ) throw (RuntimeException); - virtual ::rtl::OUString SAL_CALL getTail( ) throw (RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& service_name ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - private: - ::comphelper::ComponentContext m_aContext; - ::sal_Bool m_LogEventNo; - ::sal_Bool m_LogThread; - ::sal_Bool m_LogTimestamp; - ::sal_Bool m_LogSource; - ::sal_Bool m_MultiColumn; - ::com::sun::star::uno::Sequence< ::rtl::OUString > m_Columnnames; - }; -} // namespace logging - -//= private helpers -namespace -{ - const sal_Unicode quote_char = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")).toChar(); - const sal_Unicode comma_char = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")).toChar(); - const ::rtl::OUString dos_newline = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\r\n")); - - inline bool needsQuoting(const ::rtl::OUString& str) - { - static const ::rtl::OUString quote_trigger_chars = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("\",\n\r")); - sal_Int32 len = str.getLength(); - for(sal_Int32 i=0; i=0; ) - { - i=str.lastIndexOf(quote_char, --i); - if(i!=-1) - buf.insert(buf_offset + i, quote_char); - } - buf.append(quote_char); - } - else - buf.append(str); - }; - - ::com::sun::star::uno::Sequence< ::rtl::OUString> initialColumns() - { - com::sun::star::uno::Sequence< ::rtl::OUString> result = ::com::sun::star::uno::Sequence< ::rtl::OUString>(1); - result[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("message")); - return result; - }; -} - -//= CsvFormatter - implementation -namespace logging -{ - CsvFormatter::CsvFormatter( const Reference< XComponentContext >& context ) - :m_aContext( context ), - m_LogEventNo(true), - m_LogThread(true), - m_LogTimestamp(true), - m_LogSource(false), - m_MultiColumn(false), - m_Columnnames(initialColumns()) - { } - - CsvFormatter::~CsvFormatter() - { } - - ::sal_Bool CsvFormatter::getLogEventNo() throw (RuntimeException) - { - return m_LogEventNo; - } - - ::sal_Bool CsvFormatter::getLogThread() throw (RuntimeException) - { - return m_LogThread; - } - - ::sal_Bool CsvFormatter::getLogTimestamp() throw (RuntimeException) - { - return m_LogTimestamp; - } - - ::sal_Bool CsvFormatter::getLogSource() throw (RuntimeException) - { - return m_LogSource; - } - - Sequence< ::rtl::OUString > CsvFormatter::getColumnnames() throw (RuntimeException) - { - return m_Columnnames; - } - - void CsvFormatter::setLogEventNo(::sal_Bool log_event_no) throw (RuntimeException) - { - m_LogEventNo = log_event_no; - } - - void CsvFormatter::setLogThread(::sal_Bool log_thread) throw (RuntimeException) - { - m_LogThread = log_thread; - } - - void CsvFormatter::setLogTimestamp(::sal_Bool log_timestamp) throw (RuntimeException) - { - m_LogTimestamp = log_timestamp; - } - - void CsvFormatter::setLogSource(::sal_Bool log_source) throw (RuntimeException) - { - m_LogSource = log_source; - } - - void CsvFormatter::setColumnnames(const Sequence< ::rtl::OUString >& columnnames) throw (RuntimeException) - { - m_Columnnames = Sequence< ::rtl::OUString>(columnnames); - m_MultiColumn = (m_Columnnames.getLength()>1); - } - - ::rtl::OUString SAL_CALL CsvFormatter::getHead( ) throw (RuntimeException) - { - ::rtl::OUStringBuffer buf; - if(m_LogEventNo) - buf.appendAscii("event no,"); - if(m_LogThread) - buf.appendAscii("thread,"); - if(m_LogTimestamp) - buf.appendAscii("timestamp,"); - if(m_LogSource) - buf.appendAscii("class,method,"); - sal_Int32 columns = m_Columnnames.getLength(); - for(sal_Int32 i=0; i& column_data) throw (RuntimeException) - { - sal_Int32 columns = column_data.getLength(); - ::rtl::OUStringBuffer buf; - for(int i=0; i aServiceNames( getSupportedServiceNames() ); - for ( const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray(); - pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++pServiceNames - ) - if ( service_name == *pServiceNames ) - return sal_True; - return sal_False; - } - - ::rtl::OUString SAL_CALL CsvFormatter::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - Sequence< ::rtl::OUString > SAL_CALL CsvFormatter::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - ::rtl::OUString SAL_CALL CsvFormatter::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.CsvFormatter" ) ); - } - - Sequence< ::rtl::OUString > SAL_CALL CsvFormatter::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.CsvFormatter" ) ); - return aServiceNames; - } - - Reference< XInterface > CsvFormatter::Create( const Reference< XComponentContext >& context ) - { - return *( new CsvFormatter( context ) ); - } - - void createRegistryInfo_CsvFormatter() - { - static OAutoRegistration< CsvFormatter > aAutoRegistration; - } -} // namespace logging - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx deleted file mode 100644 index 85780ea28..000000000 --- a/extensions/source/logging/filehandler.cxx +++ /dev/null @@ -1,444 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "log_module.hxx" -#include "methodguard.hxx" -#include "loghandler.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include -#include - -#include -#include - -#include - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::logging::XLogHandler; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::lang::XInitialization; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::util::XStringSubstitution; - using ::com::sun::star::beans::NamedValue; - /** === end UNO using === **/ - - //==================================================================== - //= FileHandler - declaration - //==================================================================== - typedef ::cppu::WeakComponentImplHelper3 < XLogHandler - , XServiceInfo - , XInitialization - > FileHandler_Base; - class FileHandler :public ::cppu::BaseMutex - ,public FileHandler_Base - { - private: - enum FileValidity - { - /// never attempted to open the file - eUnknown, - /// file is valid - eValid, - /// file is invalid - eInvalid - }; - - private: - ::comphelper::ComponentContext m_aContext; - LogHandlerHelper m_aHandlerHelper; - ::rtl::OUString m_sFileURL; - ::std::auto_ptr< ::osl::File > m_pFile; - FileValidity m_eFileValidity; - - protected: - FileHandler( const Reference< XComponentContext >& _rxContext ); - virtual ~FileHandler(); - - // XLogHandler - virtual ::rtl::OUString SAL_CALL getEncoding() throw (RuntimeException); - virtual void SAL_CALL setEncoding( const ::rtl::OUString& _encoding ) throw (RuntimeException); - virtual Reference< XLogFormatter > SAL_CALL getFormatter() throw (RuntimeException); - virtual void SAL_CALL setFormatter( const Reference< XLogFormatter >& _formatter ) throw (RuntimeException); - virtual ::sal_Int32 SAL_CALL getLevel() throw (RuntimeException); - virtual void SAL_CALL setLevel( ::sal_Int32 _level ) throw (RuntimeException); - virtual void SAL_CALL flush( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL publish( const LogRecord& Record ) throw (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); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - - public: - typedef ComponentMethodGuard< FileHandler > MethodGuard; - void enterMethod( MethodGuard::Access ); - void leaveMethod( MethodGuard::Access ); - - private: - /** prepares our output file for writing - */ - bool impl_prepareFile_nothrow(); - - /// writes the given string to our file - void impl_writeString_nothrow( const ::rtl::OString& _rEntry ); - - /** does string substitution on a (usually externally provided) file url - */ - void impl_doStringsubstitution_nothrow( ::rtl::OUString& _inout_rURL ); - }; - - //==================================================================== - //= FileHandler - implementation - //==================================================================== - //-------------------------------------------------------------------- - FileHandler::FileHandler( const Reference< XComponentContext >& _rxContext ) - :FileHandler_Base( m_aMutex ) - ,m_aContext( _rxContext ) - ,m_aHandlerHelper( _rxContext, m_aMutex, rBHelper ) - ,m_sFileURL( ) - ,m_pFile( ) - ,m_eFileValidity( eUnknown ) - { - } - - //-------------------------------------------------------------------- - FileHandler::~FileHandler() - { - if ( !rBHelper.bDisposed ) - { - acquire(); - dispose(); - } - } - - //-------------------------------------------------------------------- - bool FileHandler::impl_prepareFile_nothrow() - { - if ( m_eFileValidity == eUnknown ) - { - m_pFile.reset( new ::osl::File( m_sFileURL ) ); - // check whether the log file already exists - ::osl::DirectoryItem aFileItem; - ::osl::DirectoryItem::get( m_sFileURL, aFileItem ); - ::osl::FileStatus aStatus( osl_FileStatus_Mask_Validate ); - if ( ::osl::FileBase::E_None == aFileItem.getFileStatus( aStatus ) ) - ::osl::File::remove( m_sFileURL ); - - ::osl::FileBase::RC res = m_pFile->open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); - m_eFileValidity = res == ::osl::FileBase::E_None - ? eValid - : eInvalid; - #if OSL_DEBUG_LEVEL > 0 - if ( m_eFileValidity == eInvalid ) - { - ::rtl::OStringBuffer sMessage; - sMessage.append( "FileHandler::impl_prepareFile_nothrow: could not open the designated log file:" ); - sMessage.append( "\nURL: " ); - sMessage.append( ::rtl::OString( m_sFileURL.getStr(), m_sFileURL.getLength(), osl_getThreadTextEncoding() ) ); - sMessage.append( "\nerror code: " ); - sMessage.append( (sal_Int32)res ); - OSL_FAIL( sMessage.makeStringAndClear() ); - } - #endif - if ( m_eFileValidity == eValid ) - { - ::rtl::OString sHead; - if ( m_aHandlerHelper.getEncodedHead( sHead ) ) - impl_writeString_nothrow( sHead ); - } - } - - return m_eFileValidity == eValid; - } - - //-------------------------------------------------------------------- - void FileHandler::impl_writeString_nothrow( const ::rtl::OString& _rEntry ) - { - OSL_PRECOND( m_pFile.get(), "FileHandler::impl_writeString_nothrow: no file!" ); - - sal_uInt64 nBytesToWrite( _rEntry.getLength() ); - sal_uInt64 nBytesWritten( 0 ); - #if OSL_DEBUG_LEVEL > 0 - ::osl::FileBase::RC res = - #endif - m_pFile->write( _rEntry.getStr(), nBytesToWrite, nBytesWritten ); - OSL_ENSURE( ( res == ::osl::FileBase::E_None ) && ( nBytesWritten == nBytesToWrite ), - "FileHandler::impl_writeString_nothrow: could not write the log entry!" ); - } - - //-------------------------------------------------------------------- - void FileHandler::impl_doStringsubstitution_nothrow( ::rtl::OUString& _inout_rURL ) - { - try - { - Reference< XStringSubstitution > xStringSubst; - if ( m_aContext.createComponent( "com.sun.star.util.PathSubstitution", xStringSubst ) ) - _inout_rURL = xStringSubst->substituteVariables( _inout_rURL, true ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::disposing() - { - if ( m_eFileValidity == eValid ) - { - ::rtl::OString sTail; - if ( m_aHandlerHelper.getEncodedTail( sTail ) ) - impl_writeString_nothrow( sTail ); - } - - m_pFile.reset( NULL ); - m_aHandlerHelper.setFormatter( NULL ); - } - - //-------------------------------------------------------------------- - void FileHandler::enterMethod( MethodGuard::Access ) - { - m_aHandlerHelper.enterMethod(); - } - - //-------------------------------------------------------------------- - void FileHandler::leaveMethod( MethodGuard::Access ) - { - m_aMutex.release(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL FileHandler::getEncoding() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - ::rtl::OUString sEncoding; - OSL_VERIFY( m_aHandlerHelper.getEncoding( sEncoding ) ); - return sEncoding; - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::setEncoding( const ::rtl::OUString& _rEncoding ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - OSL_VERIFY( m_aHandlerHelper.setEncoding( _rEncoding ) ); - } - - //-------------------------------------------------------------------- - Reference< XLogFormatter > SAL_CALL FileHandler::getFormatter() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aHandlerHelper.getFormatter(); - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::setFormatter( const Reference< XLogFormatter >& _rxFormatter ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aHandlerHelper.setFormatter( _rxFormatter ); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL FileHandler::getLevel() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aHandlerHelper.getLevel(); - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::setLevel( ::sal_Int32 _nLevel ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aHandlerHelper.setLevel( _nLevel ); - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::flush( ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if(!m_pFile.get()) - { - OSL_PRECOND(false, "FileHandler::flush: no file!"); - return; - } - #if OSL_DEBUG_LEVEL > 0 - ::osl::FileBase::RC res = - #endif - m_pFile->sync(); - OSL_ENSURE(res == ::osl::FileBase::E_None, "FileHandler::flush: Could not sync logfile to filesystem."); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL FileHandler::publish( const LogRecord& _rRecord ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - if ( !impl_prepareFile_nothrow() ) - return sal_False; - - ::rtl::OString sEntry; - if ( !m_aHandlerHelper.formatForPublishing( _rRecord, sEntry ) ) - return sal_False; - - impl_writeString_nothrow( sEntry ); - return sal_True; - } - - //-------------------------------------------------------------------- - void SAL_CALL FileHandler::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_aHandlerHelper.getIsInitialized() ) - throw AlreadyInitializedException(); - - if ( _rArguments.getLength() != 1 ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - Sequence< NamedValue > aSettings; - if ( _rArguments[0] >>= m_sFileURL ) - { - // create( [in] string URL ); - impl_doStringsubstitution_nothrow( m_sFileURL ); - } - else if ( _rArguments[0] >>= aSettings ) - { - // createWithSettings( [in] sequence< ::com::sun::star::beans::NamedValue > Settings ) - ::comphelper::NamedValueCollection aTypedSettings( aSettings ); - m_aHandlerHelper.initFromSettings( aTypedSettings ); - - if ( aTypedSettings.get_ensureType( "FileURL", m_sFileURL ) ) - impl_doStringsubstitution_nothrow( m_sFileURL ); - } - else - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - m_aHandlerHelper.setIsInitialized(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL FileHandler::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL FileHandler::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) - { - const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); - for ( const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray(); - pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++pServiceNames - ) - if ( _rServiceName == *pServiceNames ) - return sal_True; - return sal_False; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FileHandler::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL FileHandler::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.FileHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FileHandler::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.FileHandler" ) ); - return aServiceNames; - } - - //-------------------------------------------------------------------- - Reference< XInterface > FileHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new FileHandler( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void createRegistryInfo_FileHandler() - { - static OAutoRegistration< FileHandler > aAutoRegistration; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/log.component b/extensions/source/logging/log.component deleted file mode 100644 index 4dd2db56c..000000000 --- a/extensions/source/logging/log.component +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/logging/log_module.cxx b/extensions/source/logging/log_module.cxx deleted file mode 100644 index 8fbdb094a..000000000 --- a/extensions/source/logging/log_module.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "log_module.hxx" -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - struct LogModuleCreator - { - LogModule m_aLogModule; - }; - namespace - { - class theLogModuleInstance : public rtl::Static {}; - } - - LogModule::LogModule() - :BaseClass() - { - } - - LogModule& LogModule::getInstance() - { - return theLogModuleInstance::get().m_aLogModule; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/log_module.hxx b/extensions/source/logging/log_module.hxx deleted file mode 100644 index 7f825dabf..000000000 --- a/extensions/source/logging/log_module.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_LOG_MODULE_HXX -#define EXTENSIONS_LOG_MODULE_HXX - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - class LogModule : public ::comphelper::OModule - { - friend struct LogModuleCreator; - typedef ::comphelper::OModule BaseClass; - - public: - static LogModule& getInstance(); - - private: - LogModule(); - }; - - /* -------------------------------------------------------------------- */ - class LogModuleClient : public ::comphelper::OModuleClient - { - private: - typedef ::comphelper::OModuleClient BaseClass; - - public: - LogModuleClient() : BaseClass( LogModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > - { - private: - typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; - - public: - OAutoRegistration() : BaseClass( LogModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > - { - private: - typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; - - public: - OSingletonRegistration() : BaseClass( LogModule::getInstance() ) - { - } - }; - -//........................................................................ -} // namespace logging -//........................................................................ - -#endif // EXTENSIONS_LOG_MODULE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/log_services.cxx b/extensions/source/logging/log_services.cxx deleted file mode 100644 index f568f634b..000000000 --- a/extensions/source/logging/log_services.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ -#include "log_module.hxx" - -//........................................................................ -namespace logging -{ -//........................................................................ - - //-------------------------------------------------------------------- - extern void createRegistryInfo_LoggerPool(); - extern void createRegistryInfo_FileHandler(); - extern void createRegistryInfo_ConsoleHandler(); - extern void createRegistryInfo_PlainTextFormatter(); - extern void createRegistryInfo_CsvFormatter(); - - static void initializeModule() - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - createRegistryInfo_LoggerPool(); - createRegistryInfo_FileHandler(); - createRegistryInfo_ConsoleHandler(); - createRegistryInfo_PlainTextFormatter(); - createRegistryInfo_CsvFormatter(); - } - -//........................................................................ -} // namespace logging -//........................................................................ - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) -{ - ::logging::initializeModule(); - return ::logging::LogModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx deleted file mode 100644 index 64de34fc7..000000000 --- a/extensions/source/logging/logger.cxx +++ /dev/null @@ -1,406 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "log_module.hxx" -#include "logrecord.hxx" -#include "loggerconfig.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include -#include -#include -#include - -#include - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::logging::XLogger; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::WeakReference; - using ::com::sun::star::logging::XLogHandler; - using ::com::sun::star::logging::XLoggerPool; - using ::com::sun::star::logging::LogRecord; - /** === end UNO using === **/ - namespace LogLevel = ::com::sun::star::logging::LogLevel; - - //==================================================================== - //= helper - //==================================================================== - namespace - { - sal_Bool lcl_supportsService_nothrow( XServiceInfo& _rSI, const ::rtl::OUString& _rServiceName ) - { - const Sequence< ::rtl::OUString > aServiceNames( _rSI.getSupportedServiceNames() ); - for ( const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray(); - pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++pServiceNames - ) - if ( _rServiceName == *pServiceNames ) - return sal_True; - return sal_False; - } - } - - //==================================================================== - //= EventLogger - declaration - //==================================================================== - typedef ::cppu::WeakImplHelper2 < XLogger - , XServiceInfo - > EventLogger_Base; - class EventLogger :public ::cppu::BaseMutex - ,public EventLogger_Base - { - private: - ::comphelper::ComponentContext m_aContext; - ::cppu::OInterfaceContainerHelper m_aHandlers; - oslInterlockedCount m_nEventNumber; - - // - sal_Int32 m_nLogLevel; - ::rtl::OUString m_sName; - // - - public: - EventLogger( const Reference< XComponentContext >& _rxContext, const ::rtl::OUString& _rName ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // XLogger - virtual ::rtl::OUString SAL_CALL getName() throw (RuntimeException); - virtual ::sal_Int32 SAL_CALL getLevel() throw (RuntimeException); - virtual void SAL_CALL setLevel( ::sal_Int32 _level ) throw (RuntimeException); - virtual void SAL_CALL addLogHandler( const Reference< XLogHandler >& LogHandler ) throw (RuntimeException); - virtual void SAL_CALL removeLogHandler( const Reference< XLogHandler >& LogHandler ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL isLoggable( ::sal_Int32 _nLevel ) throw (RuntimeException); - virtual void SAL_CALL log( ::sal_Int32 Level, const ::rtl::OUString& Message ) throw (RuntimeException); - virtual void SAL_CALL logp( ::sal_Int32 Level, const ::rtl::OUString& SourceClass, const ::rtl::OUString& SourceMethod, const ::rtl::OUString& Message ) throw (RuntimeException); - - protected: - ~EventLogger(); - - private: - /** logs the given log record - */ - void impl_ts_logEvent_nothrow( const LogRecord& _rRecord ); - - /** non-threadsafe impl-version of isLoggable - */ - bool impl_nts_isLoggable_nothrow( ::sal_Int32 _nLevel ); - }; - - //==================================================================== - //= LoggerPool - declaration - //==================================================================== - typedef ::cppu::WeakImplHelper2 < XLoggerPool - , XServiceInfo - > LoggerPool_Base; - /** administrates a pool of XLogger instances, where a logger is keyed by its name, - and subsequent requests for a logger with the same name return the same instance. - */ - class LoggerPool : public LoggerPool_Base - { - private: - typedef ::std::map< ::rtl::OUString, WeakReference< XLogger > > ImplPool; - - private: - ::osl::Mutex m_aMutex; - ::comphelper::ComponentContext m_aContext; - ImplPool m_aImpl; - - public: - LoggerPool( const Reference< XComponentContext >& _rxContext ); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // helper for factories - static Sequence< ::rtl::OUString > getSupportedServiceNames_static(); - static ::rtl::OUString getImplementationName_static(); - static ::rtl::OUString getSingletonName_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - - // XLoggerPool - virtual Reference< XLogger > SAL_CALL getNamedLogger( const ::rtl::OUString& Name ) throw (RuntimeException); - virtual Reference< XLogger > SAL_CALL getDefaultLogger( ) throw (RuntimeException); - }; - - //==================================================================== - //= EventLogger - implementation - //==================================================================== - //-------------------------------------------------------------------- - EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, const ::rtl::OUString& _rName ) - :m_aContext( _rxContext ) - ,m_aHandlers( m_aMutex ) - ,m_nEventNumber( 0 ) - ,m_nLogLevel( LogLevel::OFF ) - ,m_sName( _rName ) - { - osl_incrementInterlockedCount( &m_refCount ); - { - initializeLoggerFromConfiguration( m_aContext, this ); - } - osl_decrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - EventLogger::~EventLogger() - { - } - - //-------------------------------------------------------------------- - bool EventLogger::impl_nts_isLoggable_nothrow( ::sal_Int32 _nLevel ) - { - if ( _nLevel < m_nLogLevel ) - return false; - - if ( !m_aHandlers.getLength() ) - return false; - - return true; - } - - //-------------------------------------------------------------------- - void EventLogger::impl_ts_logEvent_nothrow( const LogRecord& _rRecord ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !impl_nts_isLoggable_nothrow( _rRecord.Level ) ) - return; - - m_aHandlers.forEach< XLogHandler >( - ::boost::bind( &XLogHandler::publish, _1, ::boost::cref( _rRecord ) ) ); - m_aHandlers.forEach< XLogHandler >( - ::boost::bind( &XLogHandler::flush, _1 ) ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EventLogger::getName() throw (RuntimeException) - { - return m_sName; - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL EventLogger::getLevel() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return m_nLogLevel; - } - - //-------------------------------------------------------------------- - void SAL_CALL EventLogger::setLevel( ::sal_Int32 _level ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_nLogLevel = _level; - } - - //-------------------------------------------------------------------- - void SAL_CALL EventLogger::addLogHandler( const Reference< XLogHandler >& _rxLogHandler ) throw (RuntimeException) - { - if ( _rxLogHandler.is() ) - m_aHandlers.addInterface( _rxLogHandler ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventLogger::removeLogHandler( const Reference< XLogHandler >& _rxLogHandler ) throw (RuntimeException) - { - if ( _rxLogHandler.is() ) - m_aHandlers.removeInterface( _rxLogHandler ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL EventLogger::isLoggable( ::sal_Int32 _nLevel ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return impl_nts_isLoggable_nothrow( _nLevel ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventLogger::log( ::sal_Int32 _nLevel, const ::rtl::OUString& _rMessage ) throw (RuntimeException) - { - impl_ts_logEvent_nothrow( createLogRecord( - m_sName, - _rMessage, - _nLevel, - osl_incrementInterlockedCount( &m_nEventNumber ) - ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventLogger::logp( ::sal_Int32 _nLevel, const ::rtl::OUString& _rSourceClass, const ::rtl::OUString& _rSourceMethod, const ::rtl::OUString& _rMessage ) throw (RuntimeException) - { - impl_ts_logEvent_nothrow( createLogRecord( - m_sName, - _rSourceClass, - _rSourceMethod, - _rMessage, - _nLevel, - osl_incrementInterlockedCount( &m_nEventNumber ) - ) ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EventLogger::getImplementationName() throw(RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EventLogger" ) ); - } - - //-------------------------------------------------------------------- - ::sal_Bool EventLogger::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) - { - return lcl_supportsService_nothrow( *this, _rServiceName ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EventLogger::getSupportedServiceNames() throw(RuntimeException) - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.Logger" ) ); - return aServiceNames; - } - - //==================================================================== - //= LoggerPool - implementation - //==================================================================== - //-------------------------------------------------------------------- - LoggerPool::LoggerPool( const Reference< XComponentContext >& _rxContext ) - :m_aContext( _rxContext ) - { - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL LoggerPool::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL LoggerPool::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) - { - return lcl_supportsService_nothrow( *this, _rServiceName ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL LoggerPool::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL LoggerPool::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.LoggerPool" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL LoggerPool::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = getSingletonName_static(); - return aServiceNames; - } - - //-------------------------------------------------------------------- - ::rtl::OUString LoggerPool::getSingletonName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.LoggerPool" ) ); - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL LoggerPool::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new LoggerPool( _rxContext ) ); - } - - //-------------------------------------------------------------------- - Reference< XLogger > SAL_CALL LoggerPool::getNamedLogger( const ::rtl::OUString& _rName ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - WeakReference< XLogger >& rLogger( m_aImpl[ _rName ] ); - Reference< XLogger > xLogger( (Reference< XLogger >)rLogger ); - if ( !xLogger.is() ) - { - // never requested before, or already dead - xLogger = new EventLogger( m_aContext.getUNOContext(), _rName ); - rLogger = xLogger; - } - - return xLogger; - } - - //-------------------------------------------------------------------- - Reference< XLogger > SAL_CALL LoggerPool::getDefaultLogger( ) throw (RuntimeException) - { - return getNamedLogger( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.logging.DefaultLogger" ) ) ); - } - - //-------------------------------------------------------------------- - void createRegistryInfo_LoggerPool() - { - static OSingletonRegistration< LoggerPool > aAutoRegistration; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx deleted file mode 100644 index b46fa397e..000000000 --- a/extensions/source/logging/loggerconfig.cxx +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "loggerconfig.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include - -#include -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::logging::XLogger; - using ::com::sun::star::lang::XMultiServiceFactory; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Any; - using ::com::sun::star::container::XNameContainer; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::lang::XSingleServiceFactory; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::util::XChangesBatch; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::lang::ServiceNotRegisteredException; - using ::com::sun::star::beans::NamedValue; - using ::com::sun::star::logging::XLogHandler; - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::container::XNameAccess; - using ::com::sun::star::uno::XComponentContext; - /** === end UNO using === **/ - namespace LogLevel = ::com::sun::star::logging::LogLevel; - - namespace - { - //---------------------------------------------------------------- - typedef void (*SettingTranslation)( const Reference< XLogger >&, const ::rtl::OUString&, Any& ); - - //---------------------------------------------------------------- - void lcl_substituteFileHandlerURLVariables_nothrow( const Reference< XLogger >& _rxLogger, ::rtl::OUString& _inout_rFileURL ) - { - struct Variable - { - const sal_Char* pVariablePattern; - const sal_Int32 nPatternLength; - rtl_TextEncoding eEncoding; - const ::rtl::OUString sVariableValue; - - Variable( const sal_Char* _pVariablePattern, const sal_Int32 _nPatternLength, rtl_TextEncoding _eEncoding, - const ::rtl::OUString& _rVariableValue ) - :pVariablePattern( _pVariablePattern ) - ,nPatternLength( _nPatternLength ) - ,eEncoding( _eEncoding ) - ,sVariableValue( _rVariableValue ) - { - } - }; - - ::rtl::OUString sLoggerName; - try { sLoggerName = _rxLogger->getName(); } - catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - - Variable aVariables[] = - { - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName ) - }; - - for ( size_t i = 0; i < SAL_N_ELEMENTS( aVariables ); ++i ) - { - ::rtl::OUString sPattern( aVariables[i].pVariablePattern, aVariables[i].nPatternLength, aVariables[i].eEncoding ); - sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); - if ( ( nVariableIndex == 0 ) - || ( ( nVariableIndex > 0 ) - && ( sPattern[ nVariableIndex - 1 ] != '$' ) - ) - ) - { - // found an (unescaped) variable - _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariables[i].sVariableValue ); - } - } - } - - //---------------------------------------------------------------- - void lcl_transformFileHandlerSettings_nothrow( const Reference< XLogger >& _rxLogger, const ::rtl::OUString& _rSettingName, Any& _inout_rSettingValue ) - { - if ( !_rSettingName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FileURL" ) ) ) - // not interested in this setting - return; - - ::rtl::OUString sURL; - OSL_VERIFY( _inout_rSettingValue >>= sURL ); - lcl_substituteFileHandlerURLVariables_nothrow( _rxLogger, sURL ); - _inout_rSettingValue <<= sURL; - } - - //---------------------------------------------------------------- - Reference< XInterface > lcl_createInstanceFromSetting_throw( - const ::comphelper::ComponentContext& _rContext, - const Reference< XLogger >& _rxLogger, - const Reference< XNameAccess >& _rxLoggerSettings, - const sal_Char* _pServiceNameAsciiNodeName, - const sal_Char* _pServiceSettingsAsciiNodeName, - SettingTranslation _pSettingTranslation = NULL - ) - { - Reference< XInterface > xInstance; - - // read the settings for the to-be-created service - Reference< XNameAccess > xServiceSettingsNode( _rxLoggerSettings->getByName( - ::rtl::OUString::createFromAscii( _pServiceSettingsAsciiNodeName ) ), UNO_QUERY_THROW ); - - Sequence< ::rtl::OUString > aSettingNames( xServiceSettingsNode->getElementNames() ); - size_t nServiceSettingCount( aSettingNames.getLength() ); - Sequence< NamedValue > aSettings( nServiceSettingCount ); - if ( nServiceSettingCount ) - { - const ::rtl::OUString* pSettingNames = aSettingNames.getConstArray(); - const ::rtl::OUString* pSettingNamesEnd = aSettingNames.getConstArray() + aSettingNames.getLength(); - NamedValue* pSetting = aSettings.getArray(); - - for ( ; - pSettingNames != pSettingNamesEnd; - ++pSettingNames, ++pSetting - ) - { - pSetting->Name = *pSettingNames; - pSetting->Value = xServiceSettingsNode->getByName( *pSettingNames ); - - if ( _pSettingTranslation ) - (_pSettingTranslation)( _rxLogger, pSetting->Name, pSetting->Value ); - } - } - - ::rtl::OUString sServiceName; - _rxLoggerSettings->getByName( ::rtl::OUString::createFromAscii( _pServiceNameAsciiNodeName ) ) >>= sServiceName; - if ( sServiceName.getLength() ) - { - bool bSuccess = false; - if ( aSettings.getLength() ) - { - Sequence< Any > aConstructionArgs(1); - aConstructionArgs[0] <<= aSettings; - bSuccess = _rContext.createComponentWithArguments( sServiceName, aConstructionArgs, xInstance ); - } - else - { - bSuccess = _rContext.createComponent( sServiceName, xInstance ); - } - - if ( !bSuccess ) - throw ServiceNotRegisteredException( sServiceName, NULL ); - } - - return xInstance; - } - } - - //-------------------------------------------------------------------- - void initializeLoggerFromConfiguration( const ::comphelper::ComponentContext& _rContext, const Reference< XLogger >& _rxLogger ) - { - try - { - if ( !_rxLogger.is() ) - throw NullPointerException(); - - // the configuration provider - Reference< XMultiServiceFactory > xConfigProvider; - ::rtl::OUString sConfigProvServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); - if ( !_rContext.createComponent( sConfigProvServiceName, xConfigProvider ) ) - throw ServiceNotRegisteredException( sConfigProvServiceName, _rxLogger ); - - // write access to the "Settings" node (which includes settings for all loggers) - Sequence< Any > aArguments(1); - aArguments[0] <<= NamedValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ), - makeAny( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Logging/Settings" ) ) ) - ); - Reference< XNameContainer > xAllSettings( xConfigProvider->createInstanceWithArguments( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ), - aArguments - ), UNO_QUERY_THROW ); - - ::rtl::OUString sLoggerName( _rxLogger->getName() ); - if ( !xAllSettings->hasByName( sLoggerName ) ) - { - // no node yet for this logger. Create default settings. - Reference< XSingleServiceFactory > xNodeFactory( xAllSettings, UNO_QUERY_THROW ); - Reference< XInterface > xLoggerSettings( xNodeFactory->createInstance(), UNO_QUERY_THROW ); - xAllSettings->insertByName( sLoggerName, makeAny( xLoggerSettings ) ); - Reference< XChangesBatch > xChanges( xAllSettings, UNO_QUERY_THROW ); - xChanges->commitChanges(); - } - - // actually read and forward the settings - Reference< XNameAccess > xLoggerSettings( xAllSettings->getByName( sLoggerName ), UNO_QUERY_THROW ); - - // the log level - sal_Int32 nLogLevel( LogLevel::OFF ); - OSL_VERIFY( xLoggerSettings->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LogLevel" ) ) ) >>= nLogLevel ); - _rxLogger->setLevel( nLogLevel ); - - // the default handler, if any - Reference< XInterface > xUntyped( lcl_createInstanceFromSetting_throw( _rContext, _rxLogger, xLoggerSettings, "DefaultHandler", "HandlerSettings", &lcl_transformFileHandlerSettings_nothrow ) ); - if ( !xUntyped.is() ) - // no handler -> we're done - return; - Reference< XLogHandler > xHandler( xUntyped, UNO_QUERY_THROW ); - _rxLogger->addLogHandler( xHandler ); - - // The newly created handler might have an own (default) level. Ensure that it uses - // the same level as the logger. - xHandler->setLevel( nLogLevel ); - - // the default formatter for the handler - xUntyped = lcl_createInstanceFromSetting_throw( _rContext, _rxLogger, xLoggerSettings, "DefaultFormatter", "FormatterSettings" ); - if ( !xUntyped.is() ) - // no formatter -> we're done - return; - Reference< XLogFormatter > xFormatter( xUntyped, UNO_QUERY_THROW ); - xHandler->setFormatter( xFormatter ); - - // TODO: we could first create the formatter, then the handler. This would allow - // passing the formatter as value in the component context, so the handler would - // not create an own default formatter - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loggerconfig.hxx b/extensions/source/logging/loggerconfig.hxx deleted file mode 100644 index 78157d8ad..000000000 --- a/extensions/source/logging/loggerconfig.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_LOGGERCONFIG_HXX -#define EXTENSIONS_LOGGERCONFIG_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -namespace comphelper -{ - class ComponentContext; -} - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** initializes the given logger from the configuration - - The configuration node /org.openoffice.Office.Logging/Settings/ - is examined for this. If it does not yet exist, it will be created. - - The function creates a default handler and a default formatter, as specified in the - configuration. - - This function is currently external to the logger instance. Perhaps it can, on the long - run, be moved to the logger implementation - not sure if it's the best place. - */ - void initializeLoggerFromConfiguration( - const ::comphelper::ComponentContext& _rContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogger >& _rxLogger - ); - -//........................................................................ -} // namespace logging -//........................................................................ - -#endif // EXTENSIONS_LOGGERCONFIG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loghandler.cxx b/extensions/source/logging/loghandler.cxx deleted file mode 100644 index a2c7411b3..000000000 --- a/extensions/source/logging/loghandler.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "loghandler.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Any; - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::logging::PlainTextFormatter; - /** === end UNO using === **/ - namespace LogLevel = ::com::sun::star::logging::LogLevel; - - //==================================================================== - //= LogHandlerHelper - //==================================================================== - //-------------------------------------------------------------------- - LogHandlerHelper::LogHandlerHelper( const Reference< XComponentContext >& _rxContext, ::osl::Mutex& _rMutex, ::cppu::OBroadcastHelper& _rBHelper ) - :m_eEncoding( RTL_TEXTENCODING_UTF8 ) - ,m_nLevel( LogLevel::SEVERE ) - ,m_xFormatter( NULL ) - ,m_xContext( _rxContext ) - ,m_rMutex( _rMutex ) - ,m_rBHelper( _rBHelper ) - ,m_bInitialized( false ) - { - } - - //-------------------------------------------------------------------- - void LogHandlerHelper::initFromSettings( const ::comphelper::NamedValueCollection& _rSettings ) - { - ::rtl::OUString sEncoding; - if ( _rSettings.get_ensureType( "Encoding", sEncoding ) ) - { - if ( !setEncoding( sEncoding ) ) - throw IllegalArgumentException(); - } - - _rSettings.get_ensureType( "Formatter", m_xFormatter ); - _rSettings.get_ensureType( "Level", m_nLevel ); - } - - //-------------------------------------------------------------------- - void LogHandlerHelper::enterMethod() - { - m_rMutex.acquire(); - - if ( !getIsInitialized() ) - throw DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "component not initialized" ) ), NULL ); - - if ( m_rBHelper.bDisposed ) - throw DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "component already disposed" ) ), NULL ); - - // fallback settings, in case they weren't passed at construction time - if ( !getFormatter().is() ) - { - try - { - Reference< XLogFormatter > xFormatter( PlainTextFormatter::create( m_xContext ), UNO_QUERY_THROW ); - setFormatter( xFormatter ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //-------------------------------------------------------------------- - bool LogHandlerHelper::getEncoding( ::rtl::OUString& _out_rEncoding ) const - { - const char* pMimeCharset = rtl_getMimeCharsetFromTextEncoding( m_eEncoding ); - if ( pMimeCharset ) - { - _out_rEncoding = ::rtl::OUString::createFromAscii( pMimeCharset ); - return true; - } - _out_rEncoding = ::rtl::OUString(); - return false; - } - - //-------------------------------------------------------------------- - bool LogHandlerHelper::setEncoding( const ::rtl::OUString& _rEncoding ) - { - ::rtl::OString sAsciiEncoding( ::rtl::OUStringToOString( _rEncoding, RTL_TEXTENCODING_ASCII_US ) ); - rtl_TextEncoding eEncoding = rtl_getTextEncodingFromMimeCharset( sAsciiEncoding.getStr() ); - if ( eEncoding != RTL_TEXTENCODING_DONTKNOW ) - { - m_eEncoding = eEncoding; - return true; - } - return false; - } - - //-------------------------------------------------------------------- - bool LogHandlerHelper::formatForPublishing( const LogRecord& _rRecord, ::rtl::OString& _out_rEntry ) const - { - if ( _rRecord.Level < getLevel() ) - // not to be published due to low level - return false; - - try - { - Reference< XLogFormatter > xFormatter( getFormatter(), UNO_QUERY_THROW ); - ::rtl::OUString sEntry( xFormatter->format( _rRecord ) ); - _out_rEntry = ::rtl::OUStringToOString( sEntry, getTextEncoding() ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - //-------------------------------------------------------------------- - bool LogHandlerHelper::getEncodedHead( ::rtl::OString& _out_rHead ) const - { - try - { - Reference< XLogFormatter > xFormatter( getFormatter(), UNO_QUERY_THROW ); - ::rtl::OUString sHead( xFormatter->getHead() ); - _out_rHead = ::rtl::OUStringToOString( sHead, getTextEncoding() ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - //-------------------------------------------------------------------- - bool LogHandlerHelper::getEncodedTail( ::rtl::OString& _out_rTail ) const - { - try - { - Reference< XLogFormatter > xFormatter( getFormatter(), UNO_QUERY_THROW ); - ::rtl::OUString sTail( xFormatter->getTail() ); - _out_rTail = ::rtl::OUStringToOString( sTail, getTextEncoding() ); - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/loghandler.hxx b/extensions/source/logging/loghandler.hxx deleted file mode 100644 index a4e2bf2d9..000000000 --- a/extensions/source/logging/loghandler.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LOGHANDLER_HXX -#define LOGHANDLER_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - //==================================================================== - //= - //==================================================================== - class LogHandlerHelper - { - private: - // - rtl_TextEncoding m_eEncoding; - sal_Int32 m_nLevel; - ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogFormatter > - m_xFormatter; - // - - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - m_xContext; - ::osl::Mutex& m_rMutex; - ::cppu::OBroadcastHelper& m_rBHelper; - bool m_bInitialized; - - public: - LogHandlerHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, - ::osl::Mutex& _rMutex, - ::cppu::OBroadcastHelper& _rBHelper - ); - - public: - bool getIsInitialized() const { return m_bInitialized; } - void setIsInitialized() { m_bInitialized = true; } - - bool getEncoding( ::rtl::OUString& _out_rEncoding ) const; - bool setEncoding( const ::rtl::OUString& _rEncoding ); - - inline rtl_TextEncoding - getTextEncoding() const { return m_eEncoding; } - - inline ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogFormatter > - getFormatter() const { return m_xFormatter; } - inline void - setFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogFormatter >& _rxFormatter ) - { - m_xFormatter = _rxFormatter; - } - - inline sal_Int32 - getLevel() const { return m_nLevel; } - inline void - setLevel( const sal_Int32 _nLevel ) - { - m_nLevel = _nLevel; - } - - /** prepares implementation of an public accessible method of a log handler - - enterMethod does the following things: -

          • It acquires the mutex given in the constructor.
          • -
          • It checks whether the component is already initialized, and throws an exception if not os.
          • -
          • It checks whether the component is already disposed, and throws an exception if not os.
          • -
          • It creates a default formatter (PlainTextFormatter), if no formatter exists at this time.
          • -
          - */ - void enterMethod(); - - /** formats a record for publishing it - - The method first checks whether the records log level is greater or equal our own - log level. If not, is returned. - - Second, our formatter is used to create a unicode string from the log record. If an error occurs - during this, e.g. if the formatter is or throws an exception during formatting, - is returned. - - Finally, the unicode string is encoded into a byte string, using our encoding setting. Then, - is returned. - */ - bool formatForPublishing( const ::com::sun::star::logging::LogRecord& _rRecord, ::rtl::OString& _out_rEntry ) const; - - /** retrieves our formatter's heading, encoded with our encoding - - @return in case of success, if any error occurred - */ - bool getEncodedHead( ::rtl::OString& _out_rHead ) const; - - /** retrieves our formatter's tail, encoded with our encoding - - @return in case of success, if any error occurred - */ - bool getEncodedTail( ::rtl::OString& _out_rTail ) const; - - /** initializes the instance from a collection of named settings - - The recognized named settings are Encoding, Formatter, and Level, - which initialize the respective attributes. - - Settings which are recognized are remove from the given collection. This allows - the caller to determine whether or not the collection contained any unsupported - items, and react appropriately. - - @throws IllegalArgumentException - if one of the values in the collection is of wrong type. - */ - void initFromSettings( const ::comphelper::NamedValueCollection& _rSettings ); - }; - -//........................................................................ -} // namespace logging -//........................................................................ - -#endif // LOGHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/logrecord.cxx b/extensions/source/logging/logrecord.cxx deleted file mode 100644 index 8ff2f94b1..000000000 --- a/extensions/source/logging/logrecord.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "logrecord.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::util::DateTime; - /** === end UNO using === **/ - - //==================================================================== - //= helper - //==================================================================== - //-------------------------------------------------------------------- - namespace - { - /** returns a string representation of the current thread - - @todo - We need a way to retrieve the current UNO thread ID as string, - which is issue #i77342# - */ - ::rtl::OUString getCurrentThreadID() - { - oslThreadIdentifier nThreadID( osl_getThreadIdentifier( NULL ) ); - return ::rtl::OUString::valueOf( (sal_Int64)nThreadID ); - } - } - - //-------------------------------------------------------------------- - LogRecord createLogRecord( const ::rtl::OUString& _rLoggerName, const ::rtl::OUString& _rClassName, - const ::rtl::OUString& _rMethodName, const ::rtl::OUString& _rMessage, - sal_Int32 _nLogLevel, oslInterlockedCount _nEventNumber ) - { - TimeValue aTimeValue; - osl_getSystemTime( &aTimeValue ); - - oslDateTime aDateTime; - OSL_VERIFY( osl_getDateTimeFromTimeValue( &aTimeValue, &aDateTime ) ); - - DateTime aTimeStamp; - aTimeStamp.Year = aDateTime.Year; - aTimeStamp.Month = aDateTime.Month; - aTimeStamp.Day = aDateTime.Day; - aTimeStamp.Hours = aDateTime.Hours; - aTimeStamp.Minutes = aDateTime.Minutes; - aTimeStamp.Seconds = aDateTime.Seconds; - aTimeStamp.HundredthSeconds = ::sal::static_int_cast< sal_Int16 >( aDateTime.NanoSeconds / 10000000 ); - - return LogRecord( - _rLoggerName, - _rClassName, - _rMethodName, - _rMessage, - aTimeStamp, - _nEventNumber, - getCurrentThreadID(), - _nLogLevel - ); - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/logrecord.hxx b/extensions/source/logging/logrecord.hxx deleted file mode 100644 index 53c8f49f7..000000000 --- a/extensions/source/logging/logrecord.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LOGRECORD_HXX -#define LOGRECORD_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - //==================================================================== - //= helper - //==================================================================== - ::com::sun::star::logging::LogRecord createLogRecord( - const ::rtl::OUString& _rLoggerName, - const ::rtl::OUString& _rClassName, - const ::rtl::OUString& _rMethodName, - const ::rtl::OUString& _rMessage, - sal_Int32 _nLogLevel, - oslInterlockedCount _nEventNumber - ); - - inline ::com::sun::star::logging::LogRecord createLogRecord( - const ::rtl::OUString& _rLoggerName, - const ::rtl::OUString& _rMessage, - sal_Int32 _nLogLevel, - oslInterlockedCount _nEventNumber - ) - { - return createLogRecord( _rLoggerName, ::rtl::OUString(), ::rtl::OUString(), _rMessage, _nLogLevel, _nEventNumber ); - } - -//........................................................................ -} // namespace logging -//........................................................................ - -#endif // LOGRECORD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/makefile.mk b/extensions/source/logging/makefile.mk deleted file mode 100644 index 1436576e8..000000000 --- a/extensions/source/logging/makefile.mk +++ /dev/null @@ -1,84 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=extensions -TARGET=log - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -# --- Files ------------------------------------- - -# ... object files ............................ -EXCEPTIONSFILES= \ - $(SLO)$/consolehandler.obj \ - $(SLO)$/csvformatter.obj \ - $(SLO)$/filehandler.obj \ - $(SLO)$/log_services.obj \ - $(SLO)$/logger.obj \ - $(SLO)$/loggerconfig.obj \ - $(SLO)$/loghandler.obj \ - $(SLO)$/plaintextformatter.obj \ - -SLOFILES= \ - $(EXCEPTIONSFILES) \ - $(SLO)$/log_module.obj \ - $(SLO)$/logrecord.obj \ - -# --- library ----------------------------------- - -LIB1TARGET=$(SLB)$/$(TARGET)_t.lib -LIB1FILES=\ - $(SLB)$/$(TARGET).lib - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1LIBS=$(LIB1TARGET) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/log.component - -$(MISC)/log.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - log.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt log.component diff --git a/extensions/source/logging/methodguard.hxx b/extensions/source/logging/methodguard.hxx deleted file mode 100644 index 62b37f670..000000000 --- a/extensions/source/logging/methodguard.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_METHODGUARD_HXX -#define EXTENSIONS_METHODGUARD_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace logging -{ -//........................................................................ - - //==================================================================== - //= ComponentMethodGuard - //==================================================================== - template < class COMPONENT > - class ComponentMethodGuard - { - private: - COMPONENT& m_rHandler; - - public: - class Access - { - private: - friend class ComponentMethodGuard; - Access() { } - }; - - public: - ComponentMethodGuard( COMPONENT& _rHandler ) - :m_rHandler( _rHandler ) - { - m_rHandler.enterMethod( Access() ); - } - ~ComponentMethodGuard() - { - m_rHandler.leaveMethod( Access() ); - } - }; - -//........................................................................ -} // namespace logging -//........................................................................ - -#endif // EXTENSIONS_METHODGUARD_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx deleted file mode 100644 index 6d5591467..000000000 --- a/extensions/source/logging/plaintextformatter.cxx +++ /dev/null @@ -1,229 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "log_module.hxx" - -#include - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include - -#include - -//........................................................................ -namespace logging -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::logging::XLogFormatter; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::XInterface; - /** === end UNO using === **/ - - //==================================================================== - //= PlainTextFormatter - declaration - //==================================================================== - typedef ::cppu::WeakImplHelper2 < XLogFormatter - , XServiceInfo - > PlainTextFormatter_Base; - class PlainTextFormatter : public PlainTextFormatter_Base - { - private: - ::comphelper::ComponentContext m_aContext; - - protected: - PlainTextFormatter( const Reference< XComponentContext >& _rxContext ); - virtual ~PlainTextFormatter(); - - // XLogFormatter - virtual ::rtl::OUString SAL_CALL getHead( ) throw (RuntimeException); - virtual ::rtl::OUString SAL_CALL format( const LogRecord& Record ) throw (RuntimeException); - virtual ::rtl::OUString SAL_CALL getTail( ) throw (RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(); - static Reference< XInterface > Create( const Reference< XComponentContext >& _rxContext ); - }; - - //==================================================================== - //= PlainTextFormatter - implementation - //==================================================================== - //-------------------------------------------------------------------- - PlainTextFormatter::PlainTextFormatter( const Reference< XComponentContext >& _rxContext ) - :m_aContext( _rxContext ) - { - } - - //-------------------------------------------------------------------- - PlainTextFormatter::~PlainTextFormatter() - { - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL PlainTextFormatter::getHead( ) throw (RuntimeException) - { - ::rtl::OUStringBuffer aHeader; - aHeader.appendAscii( " event no" ); // column 1: the event number - aHeader.appendAscii( " " ); - aHeader.appendAscii( "thread " ); // column 2: the thread ID - aHeader.appendAscii( " " ); - aHeader.appendAscii( "date " ); // column 3: date - aHeader.appendAscii( " " ); - aHeader.appendAscii( "time " ); // column 4: time - aHeader.appendAscii( " " ); - aHeader.appendAscii( "(class/method:) message" ); // column 5: class/method/message - aHeader.appendAscii( "\n" ); - return aHeader.makeStringAndClear(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL PlainTextFormatter::format( const LogRecord& _rRecord ) throw (RuntimeException) - { - char buffer[ 30 ]; - const int buffer_size = sizeof( buffer ); - int used = snprintf( buffer, buffer_size, "%10i", (int)_rRecord.SequenceNumber ); - if ( used >= buffer_size || used < 0 ) - buffer[ buffer_size - 1 ] = 0; - - ::rtl::OUStringBuffer aLogEntry; - aLogEntry.appendAscii( buffer ); - aLogEntry.appendAscii( " " ); - - ::rtl::OString sThreadID( ::rtl::OUStringToOString( _rRecord.ThreadID, osl_getThreadTextEncoding() ) ); - snprintf( buffer, buffer_size, "%8s", sThreadID.getStr() ); - aLogEntry.appendAscii( buffer ); - aLogEntry.appendAscii( " " ); - - snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%02i", - (int)_rRecord.LogTime.Year, (int)_rRecord.LogTime.Month, (int)_rRecord.LogTime.Day, - (int)_rRecord.LogTime.Hours, (int)_rRecord.LogTime.Minutes, (int)_rRecord.LogTime.Seconds, (int)_rRecord.LogTime.HundredthSeconds ); - aLogEntry.appendAscii( buffer ); - aLogEntry.appendAscii( " " ); - - if ( _rRecord.SourceClassName.getLength() && _rRecord.SourceMethodName.getLength() ) - { - aLogEntry.append( _rRecord.SourceClassName ); - aLogEntry.appendAscii( "::" ); - aLogEntry.append( _rRecord.SourceMethodName ); - aLogEntry.appendAscii( ": " ); - } - - aLogEntry.append( _rRecord.Message ); - aLogEntry.appendAscii( "\n" ); - - return aLogEntry.makeStringAndClear(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL PlainTextFormatter::getTail( ) throw (RuntimeException) - { - // no tail - return ::rtl::OUString(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL PlainTextFormatter::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) - { - const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); - for ( const ::rtl::OUString* pServiceNames = aServiceNames.getConstArray(); - pServiceNames != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++pServiceNames - ) - if ( _rServiceName == *pServiceNames ) - return sal_True; - return sal_False; - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL PlainTextFormatter::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PlainTextFormatter::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL PlainTextFormatter::getImplementationName_static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.PlainTextFormatter" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PlainTextFormatter::getSupportedServiceNames_static() - { - Sequence< ::rtl::OUString > aServiceNames(1); - aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.PlainTextFormatter" ) ); - return aServiceNames; - } - - //-------------------------------------------------------------------- - Reference< XInterface > PlainTextFormatter::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new PlainTextFormatter( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void createRegistryInfo_PlainTextFormatter() - { - static OAutoRegistration< PlainTextFormatter > aAutoRegistration; - } - -//........................................................................ -} // namespace logging -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/GetMetadataForFile.m b/extensions/source/macosx/spotlight/GetMetadataForFile.m deleted file mode 100644 index 40d785097..000000000 --- a/extensions/source/macosx/spotlight/GetMetadataForFile.m +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#include -#include -#include - - -#import "OOoSpotlightImporter.h" - - -/* ----------------------------------------------------------------------------- - Get metadata attributes from file - - This function's job is to extract useful information your file format supports - and return it as a dictionary - ----------------------------------------------------------------------------- */ - -Boolean GetMetadataForFile(void* thisInterface, - CFMutableDictionaryRef attributes, - CFStringRef contentTypeUTI, - CFStringRef pathToFile) -{ - /* Pull any available metadata from the file at the specified path */ - /* Return the attribute keys and attribute values in the dict */ - /* Return TRUE if successful, FALSE if there was no data provided */ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - OOoSpotlightImporter *importer = [OOoSpotlightImporter new]; - - Boolean importOK = NO; - @try { - importOK = [importer importDocument:(NSString*)pathToFile - contentType:(NSString*)contentTypeUTI - attributes:(NSMutableDictionary*)attributes]; - } - @catch (NSException *exception) { - NSLog(@"main: Caught %@: %@", [exception name], [exception reason]); - } - - [importer release]; - - [pool release]; - - return importOK; -} diff --git a/extensions/source/macosx/spotlight/OOoContentDataParser.h b/extensions/source/macosx/spotlight/OOoContentDataParser.h deleted file mode 100644 index b307bb375..000000000 --- a/extensions/source/macosx/spotlight/OOoContentDataParser.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import - - -@interface OOoContentDataParser : NSObject { - // indicates if we are interested in an element's content - BOOL shouldReadCharacters; - - // the MD importer's values - NSMutableDictionary *mdiValues; - - // all of the text inside a document - NSMutableString *textContent; - - // the current element's content - NSMutableString *runningTextContent; -} - -- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict; - -// delegates -- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict; - -- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName; - -- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string; - -- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError; - -- (void)parserDidEndDocument:(NSXMLParser *)parser; - -@end - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/OOoContentDataParser.m b/extensions/source/macosx/spotlight/OOoContentDataParser.m deleted file mode 100644 index f48560747..000000000 --- a/extensions/source/macosx/spotlight/OOoContentDataParser.m +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import "OOoContentDataParser.h" - -@implementation OOoContentDataParser - -- (id)init -{ - if ((self = [super init]) != nil) { - shouldReadCharacters = NO; - textContent = nil; - runningTextContent = nil; - - return self; - } - - return nil; -} - -- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict -{ - mdiValues = dict; - - //NSLog(@"data: %@ %d", data, [data length]); - - //init parser settings - shouldReadCharacters = NO; - - NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; - - [parser setDelegate:self]; - [parser setShouldResolveExternalEntities:NO]; - [parser parse]; - - [parser release]; - - //NSLog(@"finished"); -} - -- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict -{ - // all text content is stored inside elements - if ([elementName isEqualToString:@"text:p"] == YES) { - runningTextContent = [NSMutableString new]; - shouldReadCharacters = YES; - //NSLog(@"start"); - } else { - return; - } - - //NSLog(@"start element %@", elementName); -} - -- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName -{ - if (shouldReadCharacters == TRUE) { - if (textContent == nil) { - textContent = [NSMutableString new]; - } else if ([runningTextContent isEqualToString:@""] == NO) { - // separate by whitespace - [textContent appendString:@" "]; - } - //NSLog(@"end"); - - [textContent appendString:[NSString stringWithString:runningTextContent]]; - [runningTextContent release]; - } - shouldReadCharacters = NO; -} - -- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string -{ - if (shouldReadCharacters == NO) { - return; - } - //NSLog(string); - - [runningTextContent appendString:string]; - - //NSLog(@"currentElement: %@", currentElement); - //NSLog(@"read: %@", string); - -} - -- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError -{ - //NSLog(@"parsing finished with error"); - NSLog([NSString stringWithFormat:@"An error occurred parsing the document. (Error %i, Description: %@, Line: %i, Column: %i)", [parseError code], - [[parser parserError] localizedDescription], [parser lineNumber], - [parser columnNumber]]); - - if (runningTextContent != nil) { - [runningTextContent release]; - } - if (textContent != nil) { - [textContent release]; - } -} - -- (void)parserDidEndDocument:(NSXMLParser *)parser -{ - if (textContent != nil && [textContent length] > 0) { - [mdiValues setObject:[NSString stringWithString:textContent] forKey:(NSString*)kMDItemTextContent]; - [textContent release]; - } -} - -@end diff --git a/extensions/source/macosx/spotlight/OOoMetaDataParser.h b/extensions/source/macosx/spotlight/OOoMetaDataParser.h deleted file mode 100644 index fdeb61d15..000000000 --- a/extensions/source/macosx/spotlight/OOoMetaDataParser.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import - - -@interface OOoMetaDataParser : NSObject { - //indicates if content should be read - BOOL shouldReadCharacters; - //indicates if the current element is a custom metadata tag - BOOL isCustom; - - NSMutableDictionary *metaValues; - NSMutableString *textCurrentElement; - NSString *customAttribute; -} - -- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict; - -//delegates -- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict; - -- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName; - -- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string; - -- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError; -@end - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/OOoMetaDataParser.m b/extensions/source/macosx/spotlight/OOoMetaDataParser.m deleted file mode 100644 index cddbbd130..000000000 --- a/extensions/source/macosx/spotlight/OOoMetaDataParser.m +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import "OOoMetaDataParser.h" - -static NSSet *singleValueXMLElements; -static NSSet *multiValueXMLElements; -static NSDictionary *metaXML2MDIKeys; - -@implementation OOoMetaDataParser - -+ (void)initialize -{ - static BOOL isInitialized = NO; - - if (isInitialized == NO) { - //set up the meta elements with only one value - NSMutableSet *temp = [NSMutableSet new]; - [temp addObject:@"dc:title"]; - [temp addObject:@"dc:description"]; - [temp addObject:@"meta:user-defined"]; - singleValueXMLElements = [[NSSet setWithSet:temp] retain]; - - //set up the meta elements that can have more than one value - [temp removeAllObjects]; - [temp addObject:@"dc:subject"]; - [temp addObject:@"meta:keyword"]; - [temp addObject:@"meta:initial-creator"]; - [temp addObject:@"dc:creator"]; - multiValueXMLElements = [[NSSet setWithSet:temp] retain]; - [temp release]; - - //set up the map to store the values with the correct MDI keys - NSMutableDictionary *tempDict = [NSMutableDictionary new]; - [tempDict setObject:(NSString*)kMDItemTitle forKey:@"dc:title"]; - [tempDict setObject:(NSString*)kMDItemDescription forKey:@"dc:description"]; - [tempDict setObject:(NSString*)kMDItemKeywords forKey:@"dc:subject"]; - [tempDict setObject:(NSString*)kMDItemAuthors forKey:@"meta:initial-creator"]; - [tempDict setObject:(NSString*)kMDItemAuthors forKey:@"dc:creator"]; - [tempDict setObject:(NSString*)kMDItemKeywords forKey:@"meta:keyword"]; - [tempDict setObject:@"org_openoffice_opendocument_custominfo1" forKey:@"Info 1"]; - [tempDict setObject:@"org_openoffice_opendocument_custominfo2" forKey:@"Info 2"]; - [tempDict setObject:@"org_openoffice_opendocument_custominfo3" forKey:@"Info 3"]; - [tempDict setObject:@"org_openoffice_opendocument_custominfo4" forKey:@"Info 4"]; - metaXML2MDIKeys = [[NSDictionary dictionaryWithDictionary:tempDict] retain]; - [tempDict release]; - - isInitialized = YES; - } -} - -- (id)init -{ - if ((self = [super init]) != nil) { - shouldReadCharacters = NO; -// currentElement = nil; - textCurrentElement = nil; - - return self; - } - - return nil; -} - -- (void)parseXML:(NSData*)data intoDictionary:(NSMutableDictionary*)dict -{ - metaValues = dict; - - //NSLog(@"data: %@ %d", data, [data length]); - - //init parser settings - shouldReadCharacters = NO; - - NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; - - [parser setDelegate:self]; - [parser setShouldResolveExternalEntities:NO]; - [parser parse]; - - [parser release]; - - //NSLog(@"finished parsing meta"); -} - -- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict -{ -// NSLog(@"<%@>", elementName); - if ([singleValueXMLElements containsObject:elementName] == YES) { - shouldReadCharacters = YES; - } else if ([multiValueXMLElements containsObject:elementName] == YES) { - shouldReadCharacters = YES; - } else { - //we are not interested in this element - shouldReadCharacters = NO; - return; - } - - if (shouldReadCharacters == YES) { - textCurrentElement = [NSMutableString new]; - isCustom = [elementName isEqualToString:@"meta:user-defined"]; - if (isCustom == YES) { - customAttribute = [[attributeDict objectForKey:@"meta:name"] retain]; - //NSLog(customAttribute); - } - } - - //NSLog(@"start element %@", elementName); -} - -- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName -{ -// NSLog(@"", elementName); - if (shouldReadCharacters == YES) { - NSString *mdiName = nil; - if (isCustom == YES) { - mdiName = (NSString*)[metaXML2MDIKeys objectForKey:customAttribute]; - } else { - mdiName = (NSString*)[metaXML2MDIKeys objectForKey:elementName]; - } - //NSLog(@"mdiName: %@", mdiName); - - if (mdiName == nil) { - return; - } - - if ([singleValueXMLElements containsObject:elementName] == YES) { - [metaValues setObject:textCurrentElement forKey:mdiName]; - } else { - // must be multi-value - NSMutableArray *arr = [metaValues objectForKey:mdiName]; - if (arr == nil) { - // we have no array yet, create it - arr = [[NSMutableArray new] autorelease]; - // and store it - [metaValues setObject:arr forKey:mdiName]; - } - // only store an element once, no need for duplicates - if ([arr containsObject:textCurrentElement] == NO) { - [arr addObject:textCurrentElement]; - } - } - // cleanup part 1 - [textCurrentElement release]; - if (customAttribute != nil) { - [customAttribute release]; - } - } - - //cleanup part 2 - shouldReadCharacters = NO; - isCustom = NO; -} - -- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string -{ -// NSLog(@"%@", string); - if (shouldReadCharacters == NO) { - return; - } - - // this delegate method might be called several times for a single element, - // so we have to collect the received data - [textCurrentElement appendString:string]; - - //NSLog(@"chars read: %@", string); -} - -- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError -{ - //NSLog(@"parsing finished with error"); - NSLog([NSString stringWithFormat:@"Error %i, Description: %@, Line: %i, Column: %i", [parseError code], - [[parser parserError] localizedDescription], [parser lineNumber], - [parser columnNumber]]); -} - -@end diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h b/extensions/source/macosx/spotlight/OOoSpotlightImporter.h deleted file mode 100644 index 6fec52fae..000000000 --- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import - -#include "unzip.h" //for unzFile - -@interface OOoSpotlightImporter : NSObject { -} - -- (BOOL)importDocument:(NSString*)pathToFile contentType:(NSString*)contentTypeUTI attributes:(NSMutableDictionary*)attributes; - -- (unzFile)openZipFileAtPath:(NSString*)pathToFile; - -- (NSData*)metaDataFileFromZip:(unzFile)unzipFile; - -- (NSData*)contentDataFileFromZip:(unzFile)unzipFile; -@end - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m b/extensions/source/macosx/spotlight/OOoSpotlightImporter.m deleted file mode 100644 index c5918e242..000000000 --- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.m +++ /dev/null @@ -1,235 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -#import "OOoSpotlightImporter.h" -#import "OOoMetaDataParser.h" -#import "OOoContentDataParser.h" - -#define CASESENSITIVITY (0) -#define BUFFER_SIZE (4096) - -/* a dictionary to hold the UTIs */ -static NSDictionary *uti2kind; - -@implementation OOoSpotlightImporter - -/* initialize is only called once the first time this class is loaded */ -+ (void)initialize -{ - static BOOL isInitialized = NO; - if (isInitialized == NO) { - NSMutableDictionary *temp = [NSMutableDictionary new]; - [temp setObject:@"OpenOffice.org 1.0 Text" forKey:@"org.openoffice.text"]; - [temp setObject:@"OpenDocument Text" forKey:@"org.oasis.opendocument.text"]; - [temp setObject:@"OpenOffice.org 1.0 Spreadsheet" forKey:@"org.openoffice.spreadsheet"]; - [temp setObject:@"OpenDocument Spreadsheet" forKey:@"org.oasis.opendocument.spreadsheet"]; - [temp setObject:@"OpenOffice.org 1.0 Presentation" forKey:@"org.openoffice.presentation"]; - [temp setObject:@"OpenDocument Presentation" forKey:@"org.oasis.opendocument.presentation"]; - [temp setObject:@"OpenOffice.org 1.0 Drawing" forKey:@"org.openoffice.graphics"]; - [temp setObject:@"OpenDocument Drawing" forKey:@"org.oasis.opendocument.graphics"]; - [temp setObject:@"OpenOffice.org 1.0 Master" forKey:@"org.openoffice.text-master"]; - [temp setObject:@"OpenDocument Master" forKey:@"org.oasis.opendocument.text-master"]; - [temp setObject:@"OpenOffice.org 1.0 Formula" forKey:@"org.openoffice.formula"]; - [temp setObject:@"OpenDocument Formula" forKey:@"org.oasis.opendocument.formula"]; - [temp setObject:@"OpenOffice.org 1.0 Text Template" forKey:@"org.openoffice.text-template"]; - [temp setObject:@"OpenDocument Text Template" forKey:@"org.oasis.opendocument.text-template"]; - [temp setObject:@"OpenOffice.org 1.0 Spreadsheet Template" forKey:@"org.openoffice.spreadsheet-template"]; - [temp setObject:@"OpenDocument Spreadsheet Template" forKey:@"org.oasis.opendocument.spreadsheet-template"]; - [temp setObject:@"OpenOffice.org 1.0 Presentation Template" forKey:@"org.openoffice.presentation-template"]; - [temp setObject:@"OpenDocument Presentation Template" forKey:@"org.oasis.opendocument.presentation-template"]; - [temp setObject:@"OpenOffice.org 1.0 Drawing Template" forKey:@"org.openoffice.graphics-template"]; - [temp setObject:@"OpenDocument Drawing Template" forKey:@"org.oasis.opendocument.graphics-template"]; - [temp setObject:@"OpenOffice.org 1.0 Database" forKey:@"org.openoffice.database"]; - [temp setObject:@"OpenDocument Chart" forKey:@"org.oasis.opendocument.chart"]; - - uti2kind = [[NSDictionary dictionaryWithDictionary:temp] retain]; - [temp release]; - - isInitialized = YES; - } -} - -/* importDocument is the real starting point for our plugin */ -- (BOOL)importDocument:(NSString*)pathToFile contentType:(NSString*)contentTypeUTI attributes:(NSMutableDictionary*)attributes -{ - //NSLog(contentTypeUTI); - //NSLog(pathToFile); - - NSString *itemKind = [uti2kind objectForKey:contentTypeUTI]; - if (itemKind != nil) { - [attributes setObject:itemKind forKey:(NSString*)kMDItemKind]; - } - - //first check to see if this is a valid zipped file that contains a file "meta.xml" - unzFile unzipFile = [self openZipFileAtPath:pathToFile]; - - // - if (unzipFile == nil) { - //NSLog(@"zip file not open"); - return YES; - } - - //first get the metadata - NSData *metaData = [self metaDataFileFromZip:unzipFile]; - if (metaData == nil) { - unzClose(unzipFile); - return YES; - } - - [metaData retain]; - - OOoMetaDataParser *parser = [OOoMetaDataParser new]; - if (parser != nil) { - //parse and extract the data - [parser parseXML:metaData intoDictionary:attributes]; - } - - [metaData release]; - [parser release]; - - //and now get the content - NSData *contentData = [self contentDataFileFromZip:unzipFile]; - if (contentData == nil) { - unzClose(unzipFile); - return YES; - } - - [contentData retain]; - - OOoContentDataParser *parser2 = [OOoContentDataParser new]; - if (parser2 != nil) { - //parse and extract the data - [parser2 parseXML:contentData intoDictionary:attributes]; - } - - [contentData release]; - [parser2 release]; - - unzClose(unzipFile); - - return YES; -} - -/* openZipFileAtPath returns the file as a valid data structure or nil otherwise*/ -- (unzFile)openZipFileAtPath:(NSString*)pathToFile -{ - unzFile unzipFile = nil; - - const char *zipfilename = [pathToFile UTF8String]; - - if (zipfilename != nil) - { - unzipFile = unzOpen(zipfilename); - } - - if (unzipFile == nil) - { - //NSLog(@"Cannot open %s",zipfilename); - return nil; - } - - //NSLog(@"%s opened",zipfilename); - - return unzipFile; -} - -/* metaDataFileFromZip extracts the file meta.xml from the zip file and returns it as an NSData* structure - or nil if the metadata is not present */ -- (NSData*) metaDataFileFromZip:(unzFile)unzipFile -{ - //search and set the cursor to meta.xml - if (unzLocateFile(unzipFile, "meta.xml", CASESENSITIVITY) != UNZ_OK) { - //we hit an error, do cleanup - unzCloseCurrentFile(unzipFile); - return nil; - } - - //open the current file - if (unzOpenCurrentFile(unzipFile) != UNZ_OK) { - //we hit an error, do cleanup - unzCloseCurrentFile(unzipFile); - unzClose(unzipFile); - return nil; - } - - NSMutableData *data = [NSMutableData new]; - - unsigned buffer[BUFFER_SIZE]; - int bytesRead = 0; - while ((bytesRead = unzReadCurrentFile(unzipFile, buffer, sizeof(buffer))) > 0) { - //append the data until we are finished - [data appendData:[NSData dataWithBytes:(const void *)buffer length:bytesRead]]; - } - - //we no longer need the file, so close it - unzCloseCurrentFile(unzipFile); - - NSData *returnValue = [NSData dataWithData:data]; - [data release]; - - return returnValue; -} - -/* contentDataFileFromZip extracts the file content.xml from the zip file and returns it as an NSData* structure - or nil if the metadata is not present */ -- (NSData*) contentDataFileFromZip:(unzFile)unzipFile -{ - //search and set the cursor to content.xml - if (unzLocateFile(unzipFile, "content.xml", CASESENSITIVITY) != UNZ_OK) { - //we hit an error, do cleanup - unzCloseCurrentFile(unzipFile); - return nil; - } - - //open the current file - if (unzOpenCurrentFile(unzipFile) != UNZ_OK) { - //we hit an error, do cleanup - unzCloseCurrentFile(unzipFile); - unzClose(unzipFile); - return nil; - } - - NSMutableData *data = [NSMutableData new]; - - unsigned buffer[BUFFER_SIZE]; - int bytesRead = 0; - while ((bytesRead = unzReadCurrentFile(unzipFile, buffer, sizeof(buffer))) > 0) { - //append the data - [data appendData:[NSData dataWithBytes:(const void *)buffer length:bytesRead]]; - } - - //we no longer need the file, so close it - unzCloseCurrentFile(unzipFile); - - NSData *returnValue = [NSData dataWithData:data]; - [data release]; - - return returnValue; -} - - -@end diff --git a/extensions/source/macosx/spotlight/delzip b/extensions/source/macosx/spotlight/delzip deleted file mode 100644 index e69de29bb..000000000 diff --git a/extensions/source/macosx/spotlight/ioapi.h b/extensions/source/macosx/spotlight/ioapi.h deleted file mode 100644 index 4b10726a7..000000000 --- a/extensions/source/macosx/spotlight/ioapi.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -/* ioapi.h -- IO base function header for compress/uncompress .zip - files using zlib + zip or unzip API - - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant -*/ - -#ifndef _ZLIBIOAPI_H -#define _ZLIBIOAPI_H - -#include - -#define ZLIB_FILEFUNC_SEEK_CUR (1) -#define ZLIB_FILEFUNC_SEEK_END (2) -#define ZLIB_FILEFUNC_SEEK_SET (0) - -#define ZLIB_FILEFUNC_MODE_READ (1) -#define ZLIB_FILEFUNC_MODE_WRITE (2) -#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) - -#define ZLIB_FILEFUNC_MODE_EXISTING (4) -#define ZLIB_FILEFUNC_MODE_CREATE (8) - - -#ifndef ZCALLBACK -#define ZCALLBACK -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); -typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); -typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); -typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); -typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); -typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); -typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); - -typedef struct zlib_filefunc_def_s -{ - open_file_func zopen_file; - read_file_func zread_file; - write_file_func zwrite_file; - tell_file_func ztell_file; - seek_file_func zseek_file; - close_file_func zclose_file; - testerror_file_func zerror_file; - voidpf opaque; -} zlib_filefunc_def; - - - -void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); - -#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) -#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) -#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) -#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) -#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) -#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) - - -#ifdef __cplusplus -} -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/ioapi.m b/extensions/source/macosx/spotlight/ioapi.m deleted file mode 100644 index c1508d7fa..000000000 --- a/extensions/source/macosx/spotlight/ioapi.m +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -/* ioapi.c -- IO base function header for compress/uncompress .zip - files using zlib + zip or unzip API - - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant -*/ - -#include -#include -#include - -#include -#include "ioapi.h" - - - -/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -voidpf ZCALLBACK fopen_file_func OF(( - voidpf opaque, - const char* filename, - int mode)); - -uLong ZCALLBACK fread_file_func OF(( - voidpf opaque, - voidpf stream, - void* buf, - uLong size)); - -uLong ZCALLBACK fwrite_file_func OF(( - voidpf opaque, - voidpf stream, - const void* buf, - uLong size)); - -long ZCALLBACK ftell_file_func OF(( - voidpf opaque, - voidpf stream)); - -long ZCALLBACK fseek_file_func OF(( - voidpf opaque, - voidpf stream, - uLong offset, - int origin)); - -int ZCALLBACK fclose_file_func OF(( - voidpf opaque, - voidpf stream)); - -int ZCALLBACK ferror_file_func OF(( - voidpf opaque, - voidpf stream)); - - -voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) - voidpf opaque; - const char* filename; - int mode; -{ - FILE* file = NULL; - const char* mode_fopen = NULL; - if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - mode_fopen = "rb"; - else - if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - mode_fopen = "r+b"; - else - if (mode & ZLIB_FILEFUNC_MODE_CREATE) - mode_fopen = "wb"; - - if ((filename!=NULL) && (mode_fopen != NULL)) - file = fopen(filename, mode_fopen); - return file; -} - - -uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) - voidpf opaque; - voidpf stream; - void* buf; - uLong size; -{ - uLong ret; - ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); - return ret; -} - - -uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) - voidpf opaque; - voidpf stream; - const void* buf; - uLong size; -{ - uLong ret; - ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); - return ret; -} - -long ZCALLBACK ftell_file_func (opaque, stream) - voidpf opaque; - voidpf stream; -{ - long ret; - ret = ftell((FILE *)stream); - return ret; -} - -long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) - voidpf opaque; - voidpf stream; - uLong offset; - int origin; -{ - int fseek_origin=0; - long ret; - switch (origin) - { - case ZLIB_FILEFUNC_SEEK_CUR : - fseek_origin = SEEK_CUR; - break; - case ZLIB_FILEFUNC_SEEK_END : - fseek_origin = SEEK_END; - break; - case ZLIB_FILEFUNC_SEEK_SET : - fseek_origin = SEEK_SET; - break; - default: return -1; - } - ret = 0; - fseek((FILE *)stream, offset, fseek_origin); - return ret; -} - -int ZCALLBACK fclose_file_func (opaque, stream) - voidpf opaque; - voidpf stream; -{ - int ret; - ret = fclose((FILE *)stream); - return ret; -} - -int ZCALLBACK ferror_file_func (opaque, stream) - voidpf opaque; - voidpf stream; -{ - int ret; - ret = ferror((FILE *)stream); - return ret; -} - -void fill_fopen_filefunc (pzlib_filefunc_def) - zlib_filefunc_def* pzlib_filefunc_def; -{ - pzlib_filefunc_def->zopen_file = fopen_file_func; - pzlib_filefunc_def->zread_file = fread_file_func; - pzlib_filefunc_def->zwrite_file = fwrite_file_func; - pzlib_filefunc_def->ztell_file = ftell_file_func; - pzlib_filefunc_def->zseek_file = fseek_file_func; - pzlib_filefunc_def->zclose_file = fclose_file_func; - pzlib_filefunc_def->zerror_file = ferror_file_func; - pzlib_filefunc_def->opaque = NULL; -} diff --git a/extensions/source/macosx/spotlight/main.m b/extensions/source/macosx/spotlight/main.m deleted file mode 100644 index b9afc65e0..000000000 --- a/extensions/source/macosx/spotlight/main.m +++ /dev/null @@ -1,225 +0,0 @@ -// -// main.c -// SpotlightTester -// -// Created by Florian Heckl on 10.07.07. -// Copyright (c) 2007 __MyCompanyName__. All rights reserved. -// - - - - - -//============================================================================== -// -// DO NO MODIFY THE CONTENT OF THIS FILE -// -// This file contains the generic CFPlug-in code necessary for your importer -// To complete your importer implement the function in GetMetadataForFile.c -// -//============================================================================== - - - - - - -#include -#include -#include - -// ----------------------------------------------------------------------------- -// constants -// ----------------------------------------------------------------------------- - - -#define PLUGIN_ID "A3FCC88D-B9A6-4364-8B93-92123C8A2D18" - -// -// Below is the generic glue code for all plug-ins. -// -// You should not have to modify this code aside from changing -// names if you decide to change the names defined in the Info.plist -// - - -// ----------------------------------------------------------------------------- -// typedefs -// ----------------------------------------------------------------------------- - -// The import function to be implemented in GetMetadataForFile.c -Boolean GetMetadataForFile(void *thisInterface, - CFMutableDictionaryRef attributes, - CFStringRef contentTypeUTI, - CFStringRef pathToFile); - -// The layout for an instance of MetaDataImporterPlugIn -typedef struct __MetadataImporterPluginType -{ - MDImporterInterfaceStruct *conduitInterface; - CFUUIDRef factoryID; - UInt32 refCount; -} MetadataImporterPluginType; - -// ----------------------------------------------------------------------------- -// prototypes -// ----------------------------------------------------------------------------- -// Forward declaration for the IUnknown implementation. -// - -MetadataImporterPluginType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID); -void DeallocMetadataImporterPluginType(MetadataImporterPluginType *thisInstance); -HRESULT MetadataImporterQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); -void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); -ULONG MetadataImporterPluginAddRef(void *thisInstance); -ULONG MetadataImporterPluginRelease(void *thisInstance); -// ----------------------------------------------------------------------------- -// testInterfaceFtbl definition -// ----------------------------------------------------------------------------- -// The TestInterface function table. -// - -static MDImporterInterfaceStruct testInterfaceFtbl = { - NULL, - MetadataImporterQueryInterface, - MetadataImporterPluginAddRef, - MetadataImporterPluginRelease, - GetMetadataForFile -}; - - -// ----------------------------------------------------------------------------- -// AllocMetadataImporterPluginType -// ----------------------------------------------------------------------------- -// Utility function that allocates a new instance. -// You can do some initial setup for the importer here if you wish -// like allocating globals etc... -// -MetadataImporterPluginType *AllocMetadataImporterPluginType(CFUUIDRef inFactoryID) -{ - MetadataImporterPluginType *theNewInstance; - - theNewInstance = (MetadataImporterPluginType *)malloc(sizeof(MetadataImporterPluginType)); - memset(theNewInstance,0,sizeof(MetadataImporterPluginType)); - - /* Point to the function table */ - theNewInstance->conduitInterface = &testInterfaceFtbl; - - /* Retain and keep an open instance refcount for each factory. */ - theNewInstance->factoryID = CFRetain(inFactoryID); - CFPlugInAddInstanceForFactory(inFactoryID); - - /* This function returns the IUnknown interface so set the refCount to one. */ - theNewInstance->refCount = 1; - return theNewInstance; -} - -// ----------------------------------------------------------------------------- -// DeallocSpotlightTesterMDImporterPluginType -// ----------------------------------------------------------------------------- -// Utility function that deallocates the instance when -// the refCount goes to zero. -// In the current implementation importer interfaces are never deallocated -// but implement this as this might change in the future -// -void DeallocMetadataImporterPluginType(MetadataImporterPluginType *thisInstance) -{ - CFUUIDRef theFactoryID; - - theFactoryID = thisInstance->factoryID; - free(thisInstance); - if (theFactoryID){ - CFPlugInRemoveInstanceForFactory(theFactoryID); - CFRelease(theFactoryID); - } -} - -// ----------------------------------------------------------------------------- -// MetadataImporterQueryInterface -// ----------------------------------------------------------------------------- -// Implementation of the IUnknown QueryInterface function. -// -HRESULT MetadataImporterQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv) -{ - CFUUIDRef interfaceID; - - interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid); - - if (CFEqual(interfaceID,kMDImporterInterfaceID)){ - /* If the Right interface was requested, bump the ref count, - * set the ppv parameter equal to the instance, and - * return good status. - */ - ((MetadataImporterPluginType*)thisInstance)->conduitInterface->AddRef(thisInstance); - *ppv = thisInstance; - CFRelease(interfaceID); - return S_OK; - }else{ - if (CFEqual(interfaceID,IUnknownUUID)){ - /* If the IUnknown interface was requested, same as above. */ - ((MetadataImporterPluginType*)thisInstance )->conduitInterface->AddRef(thisInstance); - *ppv = thisInstance; - CFRelease(interfaceID); - return S_OK; - }else{ - /* Requested interface unknown, bail with error. */ - *ppv = NULL; - CFRelease(interfaceID); - return E_NOINTERFACE; - } - } -} - -// ----------------------------------------------------------------------------- -// MetadataImporterPluginAddRef -// ----------------------------------------------------------------------------- -// Implementation of reference counting for this type. Whenever an interface -// is requested, bump the refCount for the instance. NOTE: returning the -// refcount is a convention but is not required so don't rely on it. -// -ULONG MetadataImporterPluginAddRef(void *thisInstance) -{ - ((MetadataImporterPluginType *)thisInstance )->refCount += 1; - return ((MetadataImporterPluginType*) thisInstance)->refCount; -} - -// ----------------------------------------------------------------------------- -// SampleCMPluginRelease -// ----------------------------------------------------------------------------- -// When an interface is released, decrement the refCount. -// If the refCount goes to zero, deallocate the instance. -// -ULONG MetadataImporterPluginRelease(void *thisInstance) -{ - ((MetadataImporterPluginType*)thisInstance)->refCount -= 1; - if (((MetadataImporterPluginType*)thisInstance)->refCount == 0){ - DeallocMetadataImporterPluginType((MetadataImporterPluginType*)thisInstance ); - return 0; - }else{ - return ((MetadataImporterPluginType*) thisInstance )->refCount; - } -} - -// ----------------------------------------------------------------------------- -// SpotlightTesterMDImporterPluginFactory -// ----------------------------------------------------------------------------- -// Implementation of the factory function for this type. -// -void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) -{ - MetadataImporterPluginType *result; - CFUUIDRef uuid; - - /* If correct type is being requested, allocate an - * instance of TestType and return the IUnknown interface. - */ - if (CFEqual(typeID,kMDImporterTypeID)){ - uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); - result = AllocMetadataImporterPluginType(uuid); - CFRelease(uuid); - return result; - } - /* If the requested type is incorrect, return NULL. */ - return NULL; -} - diff --git a/extensions/source/macosx/spotlight/makefile.mk b/extensions/source/macosx/spotlight/makefile.mk deleted file mode 100644 index e7b15150b..000000000 --- a/extensions/source/macosx/spotlight/makefile.mk +++ /dev/null @@ -1,99 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=../../.. -PRJNAME=extensions -TARGET=spotlightplugin - -# --- Settings ---------------------------------- -.INCLUDE : settings.mk - -.IF "$(OS)"!="MACOSX" -dummy: - @echo Not using Mac OS X - nothing to build -.ENDIF - -# --- Files ------------------------------------- - -# ... object files ............................ -SLOFILES= \ - $(SLO)$/ioapi.obj \ - $(SLO)$/unzip.obj \ - $(SLO)$/main.obj \ - $(SLO)$/GetMetadataForFile.obj \ - $(SLO)$/OOoContentDataParser.obj \ - $(SLO)$/OOoMetaDataParser.obj \ - $(SLO)$/OOoSpotlightImporter.obj \ - -BUNDLE = $(MISC)$/OOoSpotlightImporter.mdimporter -CONTENTS = $(BUNDLE)$/Contents -RESOURCES = $(CONTENTS)$/Resources -MACOS = $(CONTENTS)$/MacOS - -BUNDLELIBS= -framework CoreFoundation \ - -framework Foundation \ - -framework CoreServices \ - $(ZLIB3RDLIB) - -plistfiles = $(CONTENTS)$/Info.plist -binaries = $(MACOS)$/OOoSpotlightImporter -resources = $(RESOURCES)/en.lproj/schema.strings \ - $(RESOURCES)/schema.xml - -ZIPFLAGS = -r -ZIP1TARGET = mdibundle -ZIP1DIR = $(CONTENTS) -ZIP1LIST = * - - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - -.IF "$(ZIP1TARGETN)"!="" -$(ZIP1TARGETN) : $(plistfiles) $(binaries) $(resources) - -.ENDIF # "$(ZIP1TARGETN)"!="" - -# Info.plist is just versioned and copied into the bundle -$(CONTENTS)$/%.plist : mdimporter/%.plist - $(MKDIRHIER) $(@:d) - $(COPY) "$<" "$@" - -$(MACOS)$/OOoSpotlightImporter: $(SLOFILES) - $(MKDIRHIER) $(@:d) - $(CC) -o $(MACOS)$/OOoSpotlightImporter $(SLOFILES:s/.obj/.o/) $(EXTRA_LINKFLAGS) $(BUNDLELIBS) -bundle -# we have to change the zlib install name, otherwise the plugin will not work - .IF "$(SYSTEM_ZLIB)"=="NO" - install_name_tool -change @executable_path/libz.1.dylib @executable_path/../../../../MacOS/libz.1.dylib $(MACOS)$/OOoSpotlightImporter - .ENDIF - -#the resources are just copied -$(RESOURCES)$/% : mdimporter/% - $(MKDIRHIER) $(@:d) - $(COPY) "$<" "$@" - diff --git a/extensions/source/macosx/spotlight/mdimporter/Info.plist b/extensions/source/macosx/spotlight/mdimporter/Info.plist deleted file mode 100644 index f2de1fb0e..000000000 --- a/extensions/source/macosx/spotlight/mdimporter/Info.plist +++ /dev/null @@ -1,70 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDocumentTypes - - - CFBundleTypeRole - MDImporter - LSItemContentTypes - - org.openoffice.text - org.oasis-open.opendocument.text - org.openoffice.spreadsheet - org.oasis-open.opendocument.spreadsheet - org.openoffice.presentation - org.oasis-open.opendocument.presentation - org.openoffice.graphics - org.oasis-open.opendocument.graphics - org.openoffice.text-master - org.oasis-open.opendocument.text-master - org.openoffice.formula - org.oasis-open.opendocument.formula - org.openoffice.text-template - org.oasis-open.opendocument.text-template - org.openoffice.spreadsheet-template - org.oasis-open.opendocument.spreadsheet-template - org.openoffice.presentation-template - org.oasis-open.opendocument.presentation-template - org.openoffice.graphics-template - org.oasis-open.opendocument.graphics-template - org.oasis-open.opendocument.database - - - - CFBundleExecutable - OOoSpotlightImporter - CFBundleName - OOoSpotlightImporter - CFBundleIconFile - - CFBundleIdentifier - org.openoffice.mdimporter - CFBundleInfoDictionaryVersion - 6.0 - CFBundleVersion - 1.0 - CFPlugInDynamicRegisterFunction - - CFPlugInDynamicRegistration - NO - CFPlugInFactories - - A3FCC88D-B9A6-4364-8B93-92123C8A2D18 - MetadataImporterPluginFactory - - CFPlugInTypes - - 8B08C4BF-415B-11D8-B3F9-0003936726FC - - A3FCC88D-B9A6-4364-8B93-92123C8A2D18 - - - CFPlugInUnloadFunction - - - - diff --git a/extensions/source/macosx/spotlight/mdimporter/en.lproj/schema.strings b/extensions/source/macosx/spotlight/mdimporter/en.lproj/schema.strings deleted file mode 100644 index 355998783..000000000 --- a/extensions/source/macosx/spotlight/mdimporter/en.lproj/schema.strings +++ /dev/null @@ -1 +0,0 @@ -ÿþ \ No newline at end of file diff --git a/extensions/source/macosx/spotlight/mdimporter/schema.xml b/extensions/source/macosx/spotlight/mdimporter/schema.xml deleted file mode 100644 index 06457c86f..000000000 --- a/extensions/source/macosx/spotlight/mdimporter/schema.xml +++ /dev/null @@ -1,397 +0,0 @@ - - - - - OpenOffice.org allows the user to enter 4 pieces of custom information in the document's metadata. - These metadata fields are described here for Spotlight's use. - - - - - - - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - - The custom metadata info. - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - org_openoffice_opendocument_custominfo1 - org_openoffice_opendocument_custominfo2 - org_openoffice_opendocument_custominfo3 - org_openoffice_opendocument_custominfo4 - - - - - diff --git a/extensions/source/macosx/spotlight/unzip.h b/extensions/source/macosx/spotlight/unzip.h deleted file mode 100644 index e710cd84a..000000000 --- a/extensions/source/macosx/spotlight/unzip.h +++ /dev/null @@ -1,380 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -/* unzip.h -- IO for uncompress .zip files using zlib - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant - - This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g - WinZip, InfoZip tools and compatible. - - Multi volume ZipFile (span) are not supported. - Encryption compatible with pkzip 2.04g only supported - Old compressions used by old PKZip 1.x are not supported - - - I WAIT FEEDBACK at mail info@winimage.com - Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - -*/ - -/* for more info about .ZIP format, see - http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip - http://www.info-zip.org/pub/infozip/doc/ - PkWare has also a specification at : - ftp://ftp.pkware.com/probdesc.zip -*/ - -#ifndef _unz_H -#define _unz_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "ioapi.h" - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; -typedef unzFile__ *unzFile; -#else -typedef voidp unzFile; -#endif - - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (Z_ERRNO) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) - -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - - -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - -extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) -*/ - - -extern unzFile ZEXPORT unzOpen OF((const char *path)); -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer - "zlib/zlib113.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ - -extern unzFile ZEXPORT unzOpen2 OF((const char *path, - zlib_filefunc_def* pzlib_filefunc_def)); -/* - Open a Zip file, like unzOpen, but provide a set of file low level API - for read/write the zip file (see ioapi.h) -*/ - -extern int ZEXPORT unzClose OF((unzFile file)); -/* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. - return UNZ_OK if there is no problem. */ - -extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ - - -extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ - - -/***************************************************************************/ -/* Unzip package allow you browse the directory of the zipfile */ - -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ - -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ - -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ - - -/* ****************************************** */ -/* Ryan supplied functions */ -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_pos_s -{ - uLong pos_in_zip_directory; /* offset in zip file directory */ - uLong num_of_file; /* # of file */ -} unz_file_pos; - -extern int ZEXPORT unzGetFilePos( - unzFile file, - unz_file_pos* file_pos); - -extern int ZEXPORT unzGoToFilePos( - unzFile file, - unz_file_pos* file_pos); - -/* ****************************************** */ - -extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); -/* - Get Info about the current file - if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file - if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) - if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) -*/ - -/***************************************************************************/ -/* for reading the content of the current zipfile, you can open it, read data - from it, and close it (you can close it before reading all the file) - */ - -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); -/* - Open for reading data the current file in the zipfile. - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, - const char* password)); -/* - Open for reading data the current file in the zipfile. - password is a crypting password - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, - int* method, - int* level, - int raw)); -/* - Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) - if raw==1 - *method will receive method of compression, *level will receive level of - compression - note : you can set level parameter as NULL (if you did not want known level, - but you CANNOT set method parameter as NULL -*/ - -extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, - int* method, - int* level, - int raw, - const char* password)); -/* - Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) - if raw==1 - *method will receive method of compression, *level will receive level of - compression - note : you can set level parameter as NULL (if you did not want known level, - but you CANNOT set method parameter as NULL -*/ - - -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read bytes from the current file (opened by unzOpenCurrentFile) - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ - -extern z_off_t ZEXPORT unztell OF((unzFile file)); -/* - Give the current position in uncompressed data -*/ - -extern int ZEXPORT unzeof OF((unzFile file)); -/* - return 1 if the end of file was reached, 0 elsewhere -*/ - -extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ - -/***************************************************************************/ - -/* Get the current file offset */ -extern uLong ZEXPORT unzGetOffset (unzFile file); - -/* Set the current file offset */ -extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); - - - -#ifdef __cplusplus -} -#endif - -#endif /* _unz_H */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/macosx/spotlight/unzip.m b/extensions/source/macosx/spotlight/unzip.m deleted file mode 100644 index fe8fad538..000000000 --- a/extensions/source/macosx/spotlight/unzip.m +++ /dev/null @@ -1,1586 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -*************************************************************************/ - -/* unzip.c -- IO for uncompress .zip files using zlib - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant - - Read unzip.h for more info -*/ - -/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of -compatibility with older software. The following is from the original crypt.c. Code -woven in by Terry Thorsen 1/2003. -*/ -/* - Copyright (c) 1990-2000 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2000-Apr-09 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, all these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* - crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] - - The encryption/decryption parts of this source code (as opposed to the - non-echoing password parts) were originally written in Europe. The - whole source package can be freely distributed, including from the USA. - (Prior to January 2000, re-export from the US was a violation of US law.) - */ - -/* - This encryption code is a direct transcription of the algorithm from - Roger Schlafly, described by Phil Katz in the file appnote.txt. This - file (appnote.txt) is distributed with the PKZIP program (even in the - version without encryption capabilities). - */ - - -#include -#include -#include -#include -#include "ioapi.h" -#include "unzip.h" - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - - -#ifndef CASESENSITIVITYDEFAULT_NO -# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) -# define CASESENSITIVITYDEFAULT_NO -# endif -#endif - - -#ifndef UNZ_BUFSIZE -#define UNZ_BUFSIZE (16384) -#endif - -#ifndef UNZ_MAXFILENAMEINZIP -#define UNZ_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -# define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} -#endif - -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) - - - - -const char unz_copyright[] = - " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; - -/* unz_file_info_interntal contain internal info about a file in zipfile*/ -typedef struct unz_file_info_internal_s -{ - uLong offset_curfile;/* relative offset of local header 4 bytes */ -} unz_file_info_internal; - - -/* file_in_zip_read_info_s contain internal information about a file in zipfile, - when reading and decompress it */ -typedef struct -{ - char *read_buffer; /* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ - - uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ - uLong stream_initialised; /* flag set if stream structure is initialised*/ - - uLong offset_local_extrafield;/* offset of the local extra field */ - uInt size_local_extrafield;/* size of the local extra field */ - uLong pos_local_extrafield; /* position in the local extra field in read*/ - - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - uLong rest_read_compressed; /* number of byte to be decompressed */ - uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ - zlib_filefunc_def z_filefunc; - voidpf filestream; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - int raw; -} file_in_zip_read_info_s; - - -/* unz_s contain internal information about the zipfile -*/ -typedef struct -{ - zlib_filefunc_def z_filefunc; - voidpf filestream; /* io structore of the zipfile */ - unz_global_info gi; /* public global information */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - uLong num_file; /* number of the current file in the zipfile*/ - uLong pos_in_central_dir; /* pos of the current file in the central dir*/ - uLong current_file_ok; /* flag about the usability of the current file*/ - uLong central_pos; /* position of the beginning of the central dir*/ - - uLong size_central_dir; /* size of the central directory */ - uLong offset_central_dir; /* offset of start of central directory with - respect to the starting disk number */ - - unz_file_info cur_file_info; /* public info about the current file in zip*/ - unz_file_info_internal cur_file_info_internal; /* private info about it*/ - file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ - int encrypted; -} unz_s; - - - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ - - -local int unzlocal_getByte OF(( - const zlib_filefunc_def* pzlib_filefunc_def, - voidpf filestream, - int *pi)); - -local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi) - const zlib_filefunc_def* pzlib_filefunc_def; - voidpf filestream; - int *pi; -{ - unsigned char c; - int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); - if (err==1) - { - *pi = (int)c; - return UNZ_OK; - } - else - { - if (ZERROR(*pzlib_filefunc_def,filestream)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } -} - - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets -*/ -local int unzlocal_getShort OF(( - const zlib_filefunc_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX)); - -local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX) - const zlib_filefunc_def* pzlib_filefunc_def; - voidpf filestream; - uLong *pX; -{ - uLong x ; - int i; - int err; - - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int unzlocal_getLong OF(( - const zlib_filefunc_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX)); - -local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX) - const zlib_filefunc_def* pzlib_filefunc_def; - voidpf filestream; - uLong *pX; -{ - uLong x ; - int i; - int err; - - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<16; - - if (err==UNZ_OK) - err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<24; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - - -/* My own strcmpi / strcasecmp */ -local int strcmpcasenosensitive_internal (fileName1,fileName2) - const char* fileName1; - const char* fileName2; -{ - for (;;) - { - char c1=*(fileName1++); - char c2=*(fileName2++); - if ((c1>='a') && (c1<='z')) - c1 -= 0x20; - if ((c2>='a') && (c2<='z')) - c2 -= 0x20; - if (c1=='\0') - return ((c2=='\0') ? 0 : -1); - if (c2=='\0') - return 1; - if (c1c2) - return 1; - } -} - - -#ifdef CASESENSITIVITYDEFAULT_NO -#define CASESENSITIVITYDEFAULTVALUE 2 -#else -#define CASESENSITIVITYDEFAULTVALUE 1 -#endif - -#ifndef STRCMPCASENOSENTIVEFUNCTION -#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal -#endif - -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) - -*/ -extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) - const char* fileName1; - const char* fileName2; - int iCaseSensitivity; -{ - if (iCaseSensitivity==0) - iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; - - if (iCaseSensitivity==1) - return strcmp(fileName1,fileName2); - - return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} - -#ifndef BUFREADCOMMENT -#define BUFREADCOMMENT (0x400) -#endif - -/* - Locate the Central directory of a zipfile (at the end, just before - the global comment) -*/ -local uLong unzlocal_SearchCentralDir OF(( - const zlib_filefunc_def* pzlib_filefunc_def, - voidpf filestream)); - -local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream) - const zlib_filefunc_def* pzlib_filefunc_def; - voidpf filestream; -{ - unsigned char* buf; - uLong uSizeFile; - uLong uBackRead; - uLong uMaxBack=0xffff; /* maximum size of global comment */ - uLong uPosFound=0; - - if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; - - - uSizeFile = ZTELL(*pzlib_filefunc_def,filestream); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); - if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) - break; - - if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; -} - -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer - "zlib/zlib114.zip". - If the zipfile cannot be opened (file doesn't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ -extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def) - const char *path; - zlib_filefunc_def* pzlib_filefunc_def; -{ - unz_s us; - unz_s *s; - uLong central_pos,uL; - - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ - - int err=UNZ_OK; - - if (unz_copyright[0]!=' ') - return NULL; - - if (pzlib_filefunc_def==NULL) - fill_fopen_filefunc(&us.z_filefunc); - else - us.z_filefunc = *pzlib_filefunc_def; - - us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque, - path, - ZLIB_FILEFUNC_MODE_READ | - ZLIB_FILEFUNC_MODE_EXISTING); - if (us.filestream==NULL) - return NULL; - - central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream); - if (central_pos==0) - err=UNZ_ERRNO; - - if (ZSEEK(us.z_filefunc, us.filestream, - central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) - err=UNZ_ERRNO; - - /* the signature, already checked */ - if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of this disk */ - if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir on this disk */ - if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir */ - if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* offset of start of central directory with respect to the - starting disk number */ - if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* zipfile comment length */ - if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((central_pospfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); - - ZCLOSE(s->z_filefunc, s->filestream); - TRYFREE(s); - return UNZ_OK; -} - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) - unzFile file; - unz_global_info *pglobal_info; -{ - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - *pglobal_info=s->gi; - return UNZ_OK; -} - - -/* - Translate date/time from Dos format to tm_unz (readable more easilty) -*/ -local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) - uLong ulDosDate; - tm_unz* ptm; -{ - uLong uDate; - uDate = (uLong)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; - - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; -} - -/* - Get Info about the current file in the zipfile, with internal only info -*/ -local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, - unz_file_info *pfile_info, - unz_file_info_internal - *pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - -local int unzlocal_GetCurrentFileInfoInternal (file, - pfile_info, - pfile_info_internal, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - unz_file_info_internal *pfile_info_internal; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - unz_s* s; - unz_file_info file_info; - unz_file_info_internal file_info_internal; - int err=UNZ_OK; - uLong uMagic; - long lSeek=0; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (ZSEEK(s->z_filefunc, s->filestream, - s->pos_in_central_dir+s->byte_before_the_zipfile, - ZLIB_FILEFUNC_SEEK_SET)!=0) - err=UNZ_ERRNO; - - - /* we check the magic */ - if (err==UNZ_OK) { - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x02014b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK) - err=UNZ_ERRNO; - - unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) - err=UNZ_ERRNO; - - lSeek+=file_info.size_filename; - if ((err==UNZ_OK) && (szFileName!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_filename0) && (fileNameBufferSize>0)) - if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - lSeek -= uSizeRead; - } - - - if ((err==UNZ_OK) && (extraField!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_extraz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) - if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - lSeek += file_info.size_file_extra - uSizeRead; - } - else - lSeek+=file_info.size_file_extra; - - - if ((err==UNZ_OK) && (szComment!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_commentz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_comment>0) && (commentBufferSize>0)) - if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - lSeek+=file_info.size_file_comment - uSizeRead; - } - else - lSeek+=file_info.size_file_comment; - - if ((err==UNZ_OK) && (pfile_info!=NULL)) - *pfile_info=file_info; - - if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) - *pfile_info_internal=file_info_internal; - - return err; -} - - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. -*/ -extern int ZEXPORT unzGetCurrentFileInfo (file, - pfile_info, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); -} - -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ -extern int ZEXPORT unzGoToFirstFile (file) - unzFile file; -{ - int err=UNZ_OK; - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - s->pos_in_central_dir=s->offset_central_dir; - s->num_file=0; - err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ -extern int ZEXPORT unzGoToNextFile (file) - unzFile file; -{ - unz_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ - if (s->num_file+1==s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; - - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; - s->num_file++; - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzipStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ -extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) - unzFile file; - const char *szFileName; - int iCaseSensitivity; -{ - unz_s* s; - int err; - - /* We remember the 'current' position in the file so that we can jump - * back there if we fail. - */ - unz_file_info cur_file_infoSaved; - unz_file_info_internal cur_file_info_internalSaved; - uLong num_fileSaved; - uLong pos_in_central_dirSaved; - - - if (file==NULL) - return UNZ_PARAMERROR; - - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; - - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - /* Save the current state */ - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; - cur_file_infoSaved = s->cur_file_info; - cur_file_info_internalSaved = s->cur_file_info_internal; - - err = unzGoToFirstFile(file); - - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; - err = unzGetCurrentFileInfo(file,NULL, - szCurrentFileName,sizeof(szCurrentFileName)-1, - NULL,0,NULL,0); - if (err == UNZ_OK) - { - if (unzStringFileNameCompare(szCurrentFileName, - szFileName,iCaseSensitivity)==0) - return UNZ_OK; - err = unzGoToNextFile(file); - } - } - - /* We failed, so restore the state of the 'current file' to where we - * were. - */ - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; - s->cur_file_info = cur_file_infoSaved; - s->cur_file_info_internal = cur_file_info_internalSaved; - return err; -} - - -/* -/////////////////////////////////////////// -// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) -// I need random access -// -// Further optimization could be realized by adding an ability -// to cache the directory in memory. The goal being a single -// comprehensive file read to put the file I need in a memory. -*/ - -/* -typedef struct unz_file_pos_s -{ - uLong pos_in_zip_directory; // offset in file - uLong num_of_file; // # of file -} unz_file_pos; -*/ - -extern int ZEXPORT unzGetFilePos(file, file_pos) - unzFile file; - unz_file_pos* file_pos; -{ - unz_s* s; - - if (file==NULL || file_pos==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - file_pos->pos_in_zip_directory = s->pos_in_central_dir; - file_pos->num_of_file = s->num_file; - - return UNZ_OK; -} - -extern int ZEXPORT unzGoToFilePos(file, file_pos) - unzFile file; - unz_file_pos* file_pos; -{ - unz_s* s; - int err; - - if (file==NULL || file_pos==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - - /* jump to the right spot */ - s->pos_in_central_dir = file_pos->pos_in_zip_directory; - s->num_file = file_pos->num_of_file; - - /* set the current file */ - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - /* return results */ - s->current_file_ok = (err == UNZ_OK); - return err; -} - -/* -// Unzip Helper Functions - should be here? -/////////////////////////////////////////// -*/ - -/* - Read the local header of the current zipfile - Check the coherency of the local header and info in the end of central - directory about this file - store in *piSizeVar the size of extra info in local header - (filename and size of extra field data) -*/ -local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, - poffset_local_extrafield, - psize_local_extrafield) - unz_s* s; - uInt* piSizeVar; - uLong *poffset_local_extrafield; - uInt *psize_local_extrafield; -{ - uLong uMagic,uData,uFlags; - uLong size_filename; - uLong size_extra_field; - int err=UNZ_OK; - - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; - - if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - - if (err==UNZ_OK) { - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x04034b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) - err=UNZ_ERRNO; -/* - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - err=UNZ_BADZIPFILE; -*/ - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) - err=UNZ_BADZIPFILE; - - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */ - err=UNZ_ERRNO; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) - err=UNZ_BADZIPFILE; - - *piSizeVar += (uInt)size_filename; - - if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK) - err=UNZ_ERRNO; - *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt)size_extra_field; - - *piSizeVar += (uInt)size_extra_field; - - return err; -} - -/* - Open for reading data the current file in the zipfile. - If there is no error and the file is opened, the return value is UNZ_OK. -*/ -extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password) - unzFile file; - int* method; - int* level; - int raw; - const char* password; -{ - int err=UNZ_OK; - uInt iSizeVar; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uLong offset_local_extrafield; /* offset of the local extra field */ - uInt size_local_extrafield; /* size of the local extra field */ - if (password != NULL) - return UNZ_PARAMERROR; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); - - if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, - &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) - return UNZ_BADZIPFILE; - - pfile_in_zip_read_info = (file_in_zip_read_info_s*) - ALLOC(sizeof(file_in_zip_read_info_s)); - if (pfile_in_zip_read_info==NULL) - return UNZ_INTERNALERROR; - - pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield=0; - pfile_in_zip_read_info->raw=raw; - - if (pfile_in_zip_read_info->read_buffer==NULL) - { - TRYFREE(pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } - - pfile_in_zip_read_info->stream_initialised=0; - - if (method!=NULL) - *method = (int)s->cur_file_info.compression_method; - - if (level!=NULL) - { - *level = 6; - switch (s->cur_file_info.flag & 0x06) - { - case 6 : *level = 1; break; - case 4 : *level = 2; break; - case 2 : *level = 9; break; - } - } - - if ((s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - - pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; - pfile_in_zip_read_info->crc32=0; - pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; - pfile_in_zip_read_info->filestream=s->filestream; - pfile_in_zip_read_info->z_filefunc=s->z_filefunc; - pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; - - pfile_in_zip_read_info->stream.total_out = 0; - - if ((s->cur_file_info.compression_method==Z_DEFLATED) && - (!raw)) - { - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - pfile_in_zip_read_info->stream.next_in = (voidpf)0; - pfile_in_zip_read_info->stream.avail_in = 0; - - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=1; - else - { - TRYFREE(pfile_in_zip_read_info); - return err; - } - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ - } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; - - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt)0; - - s->pfile_in_zip_read = pfile_in_zip_read_info; - - return UNZ_OK; -} - -extern int ZEXPORT unzOpenCurrentFile (file) - unzFile file; -{ - return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); -} - -extern int ZEXPORT unzOpenCurrentFilePassword (file, password) - unzFile file; - const char* password; -{ - return unzOpenCurrentFile3(file, NULL, NULL, 0, password); -} - -extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw) - unzFile file; - int* method; - int* level; - int raw; -{ - return unzOpenCurrentFile3(file, method, level, raw, NULL); -} - -/* - Read bytes from the current file. - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ -extern int ZEXPORT unzReadCurrentFile (file, buf, len) - unzFile file; - voidp buf; - unsigned len; -{ - int err=UNZ_OK; - uInt iRead = 0; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->read_buffer == NULL)) - return UNZ_END_OF_LIST_OF_FILE; - if (len==0) - return 0; - - pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; - - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - - if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && - (!(pfile_in_zip_read_info->raw))) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_uncompressed; - - if ((len>pfile_in_zip_read_info->rest_read_compressed+ - pfile_in_zip_read_info->stream.avail_in) && - (pfile_in_zip_read_info->raw)) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_compressed+ - pfile_in_zip_read_info->stream.avail_in; - - while (pfile_in_zip_read_info->stream.avail_out>0) - { - if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (ZSEEK(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile, - ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - if (ZREAD(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->read_buffer, - uReadThis)!=uReadThis) - return UNZ_ERRNO; - - - - - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; - } - - if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) - { - uInt uDoCopy,i ; - - if ((pfile_in_zip_read_info->stream.avail_in == 0) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - return (iRead==0) ? UNZ_EOF : iRead; - - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - - for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - } - else - { - uLong uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - int flush=Z_SYNC_FLUSH; - - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; - - /* - if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - flush = Z_FINISH; - */ - err=inflate(&pfile_in_zip_read_info->stream,flush); - - if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL)) - err = Z_DATA_ERROR; - - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); - - pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; - - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) - break; - } - } - - if (err==Z_OK) - return iRead; - return err; -} - - -/* - Give the current position in uncompressed data -*/ -extern z_off_t ZEXPORT unztell (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - return (z_off_t)pfile_in_zip_read_info->stream.total_out; -} - - -/* - return 1 if the end of file was reached, 0 elsewhere -*/ -extern int ZEXPORT unzeof (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; -} - - - -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field that can be read - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ -extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) - unzFile file; - voidp buf; - unsigned len; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uInt read_now; - uLong size_to_read; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); - - if (buf==NULL) - return (int)size_to_read; - - if (len>size_to_read) - read_now = (uInt)size_to_read; - else - read_now = (uInt)len ; - - if (read_now==0) - return 0; - - if (ZSEEK(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield, - ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - if (ZREAD(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - buf,read_now)!=read_now) - return UNZ_ERRNO; - - return (int)read_now; -} - -/* - Close the file in zip opened with unzipOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ -extern int ZEXPORT unzCloseCurrentFile (file) - unzFile file; -{ - int err=UNZ_OK; - - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && - (!pfile_in_zip_read_info->raw)) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err=UNZ_CRCERROR; - } - - - TRYFREE(pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised) - inflateEnd(&pfile_in_zip_read_info->stream); - - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE(pfile_in_zip_read_info); - - s->pfile_in_zip_read=NULL; - - return err; -} - - -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ -extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) - unzFile file; - char *szComment; - uLong uSizeBuf; -{ -// int err=UNZ_OK; - unz_s* s; - uLong uReadThis ; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - - uReadThis = uSizeBuf; - if (uReadThis>s->gi.size_comment) - uReadThis = s->gi.size_comment; - - if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - if (uReadThis>0) - { - *szComment='\0'; - if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis) - return UNZ_ERRNO; - } - - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment+s->gi.size_comment)='\0'; - return (int)uReadThis; -} - -/* Additions by RX '2004 */ -extern uLong ZEXPORT unzGetOffset (file) - unzFile file; -{ - unz_s* s; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return 0; - if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) - if (s->num_file==s->gi.number_entry) - return 0; - return s->pos_in_central_dir; -} - -extern int ZEXPORT unzSetOffset (file, pos) - unzFile file; - uLong pos; -{ - unz_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - - s->pos_in_central_dir = pos; - s->num_file = s->gi.number_entry; /* hack */ - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} diff --git a/extensions/source/macosx/spotlight/version.plist b/extensions/source/macosx/spotlight/version.plist deleted file mode 100644 index 79fc99b2c..000000000 --- a/extensions/source/macosx/spotlight/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 266 - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3070000 - - diff --git a/extensions/source/nsplugin/source/exports.dxp b/extensions/source/nsplugin/source/exports.dxp deleted file mode 100644 index e8b697289..000000000 --- a/extensions/source/nsplugin/source/exports.dxp +++ /dev/null @@ -1,16 +0,0 @@ -NPP_GetMIMEDescription -NPP_GetValue -NPP_Initialize -NPP_GetJavaClass -NPP_Shutdown -NPP_New -NPP_Destroy -NPP_SetWindow -NPP_NewStream -NPP_WriteReady -NPP_Write -NPP_DestroyStream -NPP_StreamAsFile -NPP_URLNotify -NPP_Print -NPP_Shutdown diff --git a/extensions/source/nsplugin/source/exports_wnt.dxp b/extensions/source/nsplugin/source/exports_wnt.dxp deleted file mode 100644 index a27be8c38..000000000 --- a/extensions/source/nsplugin/source/exports_wnt.dxp +++ /dev/null @@ -1,18 +0,0 @@ -NPP_GetMIMEDescription -NPP_Initialize -NPP_Shutdown -NPP_New -NPP_Destroy -NPP_SetWindow -NPP_NewStream -NPP_WriteReady -NPP_Write -NPP_DestroyStream -NPP_StreamAsFile -NPP_URLNotify -NPP_Print -NPP_Shutdown -NP_GetEntryPoints -NP_Initialize -NP_Shutdown -NP_GetMIMEDescription diff --git a/extensions/source/nsplugin/source/makefile.mk b/extensions/source/nsplugin/source/makefile.mk deleted file mode 100644 index aac2a4838..000000000 --- a/extensions/source/nsplugin/source/makefile.mk +++ /dev/null @@ -1,160 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -PRJNAME=extensions -TARGET=npsoplugin - -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -INCPRE=$(SOLARINCDIR)$/npsdk - -.IF "$(GUI)"=="UNX" - -# not sure about -DMOZ_X11 but otheriwse some struct member don't exist... -CFLAGS+=-DMOZ_X11 - -.IF "$(ENABLE_GTK)"=="" - -dummy: - @echo GTK disabled - nothing to build - -.ELSE # "$(ENABLE_GTK)"=="" -.IF "$(OS)"=="LINUX" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || \ - "$(OS)"=="OPENBSD" || "$(OS)"=="DRAGONFLY" -INC+= -DNP_LINUX -.ENDIF -PKGCONFIG_MODULES=gtk+-2.0 -.INCLUDE: pkg_config.mk -.ENDIF # "$(ENABLE_GTK)"=="" -.ENDIF # "$(GUI)"=="UNX" -.IF "$(GUI)"=="WNT" -INC+= -DENGLISH -.ENDIF - - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/npshell.obj \ - $(SLO)$/so_env.obj - -SHL1OBJS= $(SLO)$/npshell.obj \ - $(SLO)$/so_env.obj - -.IF "$(GUI)"=="UNX" -STDLIBS+=$(SOLARLIBDIR)$/npunix.o -SHL1STDLIBS+=$(SOLARLIBDIR)$/npunix.o -.ENDIF #UNX -.IF "$(GUI)"=="WNT" -SHL1OBJS+=$(SOLARLIBDIR)$/pathutils-obj.obj -STDLIBS+=$(SOLARLIBDIR)$/npwin.obj -SHL1STDLIBS+= $(SHELL32LIB) $(SOLARLIBDIR)$/npwin.obj - -.ENDIF - -OBJFILES=\ - $(OBJ)$/so_closelistener.obj\ - $(OBJ)$/so_instance.obj\ - $(OBJ)$/so_env.obj\ - $(OBJ)$/so_main.obj - -# --- Plugin executable ------------------------- -APP1TARGET=nsplugin$(EXEPOSTFIX) -APP1OBJS=$(OBJFILES) - -APP1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) - -.IF "$(OS)"=="SOLARIS" -APP1STDLIBS+= -lsocket -lnsl -.ENDIF - -.IF "$(GUI)"=="WNT" -DEPOBJFILES=$(OBJ)$/nsp_windows.obj -APP1OBJS+=$(OBJ)$/nsp_windows.obj $(SOLARLIBDIR)$/pathutils-obj.obj -APP1STDLIBS+= $(WS2_32LIB) $(SHELL32LIB) $(OLE32LIB) $(KERNEL32LIB) $(USER32LIB) $(GDI32LIB) $(WINSPOOLLIB) $(COMDLG32LIB) $(ADVAPI32LIB) $(OLEAAUT32LIB) $(UUIDLIB) -.ENDIF - -# --- Library ----------------------------------- - -SHL1TARGET=$(TARGET)_so -.IF "$(GUI)"=="WNT" -SHL1STDLIBS+= $(WS2_32LIB) $(SHELL32LIB) $(OLE32LIB) $(KERNEL32LIB) $(USER32LIB) $(GDI32LIB) $(WINSPOOLLIB) $(COMDLG32LIB) $(ADVAPI32LIB) $(OLE32LIB) $(OLEAAUT32LIB) $(UUIDLIB) $(KERNEL32LIB) $(USER32LIB) $(GDI32LIB) $(WINSPOOLLIB) $(COMDLG32LIB) $(ADVAPI32LIB) -.ENDIF - -SHL1DEPN= -SHL1IMPLIB= i$(SHL1TARGET) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1RPATH=BRAND - -# ----- get some additional keys in versioninfo ------------ -SHL1ADD_VERINFO=nsplugin.rc -SHL1DEPN+=$(SHL1ADD_VERINFO) - -DEF1NAME=$(SHL1TARGET) -.IF "$(GUI)"=="UNX" -DEF1EXPORTFILE=exports.dxp -.ENDIF -.IF "$(GUI)"=="WNT" -DEF1EXPORTFILE=exports_wnt.dxp -.ENDIF - -SHL2OBJS=$(SHL1OBJS) -SHL2STDLIBS=$(SHL1STDLIBS) -SHL2TARGET=$(TARGET) -.IF "$(GUI)"=="WNT" -SHL2STDLIBS+= $(WS2_32LIB) $(SHELL32LIB) $(OLE32LIB) $(KERNEL32LIB) $(USER32LIB) $(GDI32LIB) $(WINSPOOLLIB) $(COMDLG32LIB) $(ADVAPI32LIB) $(OLE32LIB) $(OLEAAUT32LIB) $(UUIDLIB) $(KERNEL32LIB) $(USER32LIB) $(GDI32LIB) $(WINSPOOLLIB) $(COMDLG32LIB) $(ADVAPI32LIB) -.ENDIF - -SHL2DEPN= -SHL2IMPLIB= i$(SHL2TARGET) -SHL2DEF= $(MISC)$/$(SHL2TARGET).def -SHL2RPATH=BRAND - -# ----- get some additional keys in versioninfo ------------ -SHL2ADD_VERINFO=nsplugin_oo.rc -SHL2DEPN+=$(SHL2ADD_VERINFO) - -DEF2NAME=$(SHL2TARGET) -.IF "$(GUI)"=="UNX" -DEF2EXPORTFILE=exports.dxp -.ENDIF -.IF "$(GUI)"=="WNT" -DEF2EXPORTFILE=exports_wnt.dxp -.ENDIF - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx deleted file mode 100644 index 6aaaea654..000000000 --- a/extensions/source/nsplugin/source/npshell.cxx +++ /dev/null @@ -1,929 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef UNIX - -#define XP_UNIX 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif //end of UNIX - -#ifdef WNT - -#define _WINDOWS - -#pragma warning (push,1) -#pragma warning (disable:4668) - -#include -#include -#include -#include -#include -#include - -#pragma warning (pop) - -#endif //end of WNT - - -#include - -#include -#include -#include "boost/scoped_array.hpp" -#include "tools/pathutils.hxx" - -//http://qa.openoffice.org/issues/show_bug.cgi?id=82545 -//https://bugzilla.mozilla.org/show_bug.cgi?id=241262 -#ifdef UNIX -# ifndef _UINT32 -# if defined(__alpha) || defined(__LP64__) || defined(AIX) - typedef unsigned int uint32; -# else /* __alpha */ - typedef unsigned long uint32; -# endif -# define _UINT32 -# endif -# ifndef _INT32 -# if defined(__alpha) || defined(__LP64__) || defined(AIX) - typedef int int32; -# else /* __alpha */ - typedef long int32; -# endif -# define _INT32 -# endif -#endif - -#include "npapi.h" -#include "npshell.hxx" -#include "so_env.hxx" -#include "so_msg.hxx" -#include "ns_debug.hxx" - - -#include "nsp_func.hxx" - -#include - -/*********************************************************************** - * - * Implementations of plugin API functions - * - ***********************************************************************/ - -static NSP_Mute_Obj send_lock = NSP_New_Mute_Obj(); -static NSP_PIPE_FD write_fd = 0; - - -long int NSP_WriteToPipe(NSP_PIPE_FD fp, void* buf, unsigned long int len) -{ - unsigned long int len_unix = 0, len_wnt = 0; - - len_unix = NSP_Write_Pipe(fp, buf, len, &len_wnt); -#ifdef UNIX - (void)len_wnt; - return len_unix; -#endif //end of UNIX -#ifdef WNT - return len_wnt; -#endif //end of WNT - -} - -#ifdef UNIX -static pid_t nChildPID = 0; -#endif - -#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) -#define MY_STRING(s) (s), MY_LENGTH(s) - -#if defined WNT -namespace { - -bool extendEnvironment( - boost::scoped_array< WCHAR > * environment, WCHAR const * pathBegin, - WCHAR const * pathEnd) -{ - WCHAR ure[MAX_PATH]; - if (tools::buildPath(ure, pathBegin, pathEnd, MY_STRING(L"\\ure-link")) == - NULL) - { - return false; - } - WCHAR * ureEnd = tools::resolveLink(ure); - if (ureEnd == NULL) { - return false; - } - ureEnd = tools::buildPath(ure, ure, ureEnd, MY_STRING(L"\\bin")); - if (ureEnd == NULL) { - return false; - } - WCHAR const * env = GetEnvironmentStringsW(); - if (env == NULL) { - return false; - } - WCHAR const * p = env; - WCHAR const * p1 = NULL; - while (*p != L'\0') { - size_t n = wcslen(p); - if (p1 == NULL && n >= MY_LENGTH(L"PATH=") && - (p[0] == L'P' || p[0] == L'p') && - (p[1] == L'A' || p[1] == L'a') && - (p[2] == L'T' || p[2] == L't') && - (p[3] == L'H' || p[3] == L'h') && p[4] == L'=') - { - p1 = p + MY_LENGTH(L"PATH="); - //TODO: check whether the ure path is already present in PATH (at - // the beginning of PATH?) - } - p += n + 1; - } - ++p; - if (p1 == NULL) { - environment->reset( - new WCHAR[MY_LENGTH(L"PATH=") + (ureEnd - ure) + 1 + (p - env)]); - //TODO: overflow - memcpy(environment->get(), MY_STRING(L"PATH=") * sizeof (WCHAR)); - memcpy( - environment->get() + MY_LENGTH(L"PATH="), ure, - ((ureEnd - ure) + 1) * sizeof (WCHAR)); - memcpy( - environment->get() + MY_LENGTH(L"PATH=") + (ureEnd - ure) + 1, env, - (p - env) * sizeof (WCHAR)); - } else { - environment->reset( - new WCHAR[(p - env) + (ureEnd - ure) + MY_LENGTH(L";")]); - //TODO: overflow - memcpy(environment->get(), env, (p1 - env) * sizeof (WCHAR)); - memcpy( - environment->get() + (p1 - env), ure, - (ureEnd - ure) * sizeof (WCHAR)); - environment->get()[(p1 - env) + (ureEnd - ure)] = L';'; - memcpy( - environment->get() + (p1 - env) + (ureEnd - ure) + 1, p1, - (p - p1) * sizeof (WCHAR)); - } - return true; -} - -} -#endif - -// start nspluin executable in child process, and use pipe to talk with it -int do_init_pipe() -{ - debug_fprintf(NSP_LOG_APPEND, "enter do_init_pipe 1\n"); - NSP_PIPE_FD fd[2]; - - if( 0 != NSP_Inherited_Pipe(fd) ) - return NPERR_GENERIC_ERROR; - - write_fd = fd[1]; // write fd -#ifdef UNIX - // the parent process will wait for the child process in NPP_Shutdown code - nChildPID = fork(); - - if( ! nChildPID ) // child process -#endif //end of UNIX - { -#ifdef UNIX - char s_read_fd[16] = {0}; - char s_write_fd[16] = {0}; - sprintf(s_read_fd, "%d", fd[0]); - sprintf(s_write_fd, "%d", fd[1]); - char const * instdir = findInstallDir(); - boost::scoped_array< char > exepath( - new char[strlen(instdir) + - RTL_CONSTASCII_LENGTH("/basis-link/program/nsplugin") + - 1]); - sprintf(exepath.get(), "%s/basis-link/program/nsplugin", instdir); - char const * progdir = findProgramDir(); - boost::scoped_array< char > inifilepath( - new char[ - RTL_CONSTASCII_LENGTH( - "-env:INIFILENAME=vnd.sun.star.pathname:") + - strlen(progdir) + RTL_CONSTASCII_LENGTH("/redirectrc") + 1]); - //TODO: overflow - sprintf( - inifilepath.get(), - "-env:INIFILENAME=vnd.sun.star.pathname:%s/redirectrc", progdir); - execl( - exepath.get(), exepath.get(), s_read_fd, s_write_fd, - inifilepath.get(), progdir, NULL); - _exit(255); -#endif //end of UNIX -#ifdef WNT - WCHAR s_read_fd[16] = {0}; - WCHAR s_write_fd[16] = {0}; - wsprintfW(s_read_fd, L"%d", fd[0]); - wsprintfW(s_write_fd, L"%d", fd[1]); - WCHAR brand[MAX_PATH]; - int brandLen = MultiByteToWideChar( - CP_ACP, MB_PRECOMPOSED, findInstallDir(), -1, brand, MAX_PATH); - //TODO: conversion errors - if (brandLen == 0) { - return NPERR_GENERIC_ERROR; - } - WCHAR path[MAX_PATH]; - if (tools::buildPath( - path, brand, brand + brandLen - 1, MY_STRING(L"\\basis-link")) - == NULL) - { - return NPERR_GENERIC_ERROR; - } - WCHAR * pathEnd = tools::resolveLink(path); - if (pathEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - boost::scoped_array< WCHAR > env; - if (!extendEnvironment(&env, path, pathEnd)) { - return NPERR_GENERIC_ERROR; - } - pathEnd = tools::buildPath( - path, path, pathEnd, MY_STRING(L"\\program")); - if (pathEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - WCHAR exe[MAX_PATH]; - WCHAR * exeEnd = tools::buildPath( - exe, path, pathEnd, MY_STRING(L"\\nsplugin.exe")); - if (exeEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - WCHAR * brandEnd = tools::buildPath( - brand, brand, brand + brandLen - 1, - MY_STRING(L"\\program\\redirect.ini")); - if (brandEnd == NULL) { - return NPERR_GENERIC_ERROR; - } - boost::scoped_array< WCHAR > args( - new WCHAR[ - MY_LENGTH(L"\"") + (exeEnd - exe) + MY_LENGTH(L"\" ") + - wcslen(s_read_fd) + MY_LENGTH(L" ") + wcslen(s_write_fd) + - MY_LENGTH(L" \"-env:INIFILENAME=vnd.sun.star.pathname:") + - (brandEnd - brand) + MY_LENGTH(L"\"") + 1]); //TODO: overflow - wsprintfW( - args.get(), - L"\"%s\" %s %s \"-env:INIFILENAME=vnd.sun.star.pathname:%s\"", exe, - s_read_fd, s_write_fd, brand); - STARTUPINFOW NSP_StarInfo; - memset((void*) &NSP_StarInfo, 0, sizeof(STARTUPINFOW)); - NSP_StarInfo.cb = sizeof(STARTUPINFOW); - PROCESS_INFORMATION NSP_ProcessInfo; - memset((void*)&NSP_ProcessInfo, 0, sizeof(PROCESS_INFORMATION)); - if(!CreateProcessW( - exe, args.get(), NULL, NULL, TRUE, - CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT, env.get(), path, - &NSP_StarInfo, &NSP_ProcessInfo)) - { - DWORD Err = GetLastError(); - (void)Err; - } -#endif //end of WNT - } - NSP_Close_Pipe(fd[0]); - return NPERR_NO_ERROR; -} - -bool sendMsg( PLUGIN_MSG* pMsg, size_t len, int iEnsure) -{ - NSP_Lock_Mute_Obj(send_lock); - size_t len_w = 0; - - debug_fprintf(NSP_LOG_APPEND, "try to send message type:%d; len: %d\n", pMsg->msg_id, len); - /* - debug_fprintf(NSP_LOG_APPEND, "NSPlugin Message: msg_id:%d; instance_id:%d; - wnd_id:%d;wnd_x:%d;wnd_y:%d;wnd_w:%d;wnd_h:%d; url:%s\n", - pMsg->msg_id, pMsg->instance_id, pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h, pMsg->url);*/ - len_w = NSP_WriteToPipe(write_fd, (void*) pMsg, len); - if (len_w != len){ - if(errno == EPIPE) // If pipe breaks, then init pipe again and resend the msg - { - if(iEnsure){ - debug_fprintf(NSP_LOG_APPEND, "send message error, plugin exec need to be restart\n"); - NSP_Close_Pipe(write_fd); - do_init_pipe(); - len_w = NSP_WriteToPipe(write_fd, (void*) pMsg, len); - } - } - else if(errno == EINTR) // If interrupted by signal, then continue to send - { - long new_len; - debug_fprintf(NSP_LOG_APPEND, "send message error, send intrrupted by singal, resend again\n"); - new_len = NSP_WriteToPipe(write_fd, (char*)pMsg+len_w, len-len_w); - len_w = len_w + new_len; - } - else // else return error - { - debug_fprintf(NSP_LOG_APPEND, "send message error :%s.\n", strerror(errno)); - len_w = 0; - } - } - NSP_Unlock_Mute_Obj(send_lock); - debug_fprintf(NSP_LOG_APPEND, "send message success!\n"); - return len_w == len; -} - -extern "C" -{ -char* pMimeTypes = const_cast< char* >( "application/vnd.stardivision.calc:sdc:StarCalc 3.0 - 5.0;" -"application/vnd.stardivision.chart:sds:StarChart 3.0 - 5.0;" -"application/vnd.stardivision.draw:sda:StarDraw 3.0 - 5.0;" -"application/vnd.stardivision.impress:sdd:StarImpress 3.0 - 5.0;" -"application/vnd.stardivision.impress-packed:sdp:StarImpress-packed 3.0 - 5.0;" -"application/vnd.stardivision.math:smf:StarMath 3.0 - 5.0;" -"application/vnd.stardivision.writer:vor:StarWriter Template 3.0 - 5.0;" -"application/vnd.stardivision.writer-global:sgl:StarWriter Global 3.0 - 5.0;" -"application/vnd.staroffice.writer:sdw:StarWriter 3.0 - 5.0;" -MIMETYPE_VND_SUN_XML_CALC_ASCII ":sxc:StarOffice 6.0/7 Spreadsheet;" -MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII":stc:StarOffice 6.0/7 Spreadsheet Template;" -MIMETYPE_VND_SUN_XML_DRAW_ASCII ":sxd:StarOffice 6.0/7 Drawing;" -MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII ":std:StarOffice 6.0/7 Drawing Template;" -MIMETYPE_VND_SUN_XML_IMPRESS_ASCII ":sxi:StarOffice 6.0/7 Presentation;" -MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII ":sti:StarOffice 6.0/7 Presentation Template;" -MIMETYPE_VND_SUN_XML_MATH_ASCII ":sxm:StarOffice 6.0/7 Formula;" -MIMETYPE_VND_SUN_XML_WRITER_ASCII ":sxw:StarOffice 6.0/7 Text Document;" -MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII ":sxg:StarOffice 6.0/7 Master Document;" -MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII ":stw:StarOffice 6.0/7 Text Document Template;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ":odt:OpenDocument Text;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ":ott:OpenDocument Text Template;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ":odm:OpenDocument Master Document;" -MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ":oth:HTML Document Template;" -MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ":ods:OpenDocument Spreadsheet;" -MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ":ots:OpenDocument Spreadsheet Template;" -MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ":odg:OpenDocument Drawing;" -MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ":otg:OpenDocument Drawing Template;" -MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ":odp:OpenDocument Presentation;" -MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ":otp:OpenDocument Presentation Template;" -MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ":odf:OpenDocument Formula;" ); - -char* -NPP_GetMIMEDescription(void) -{ - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, NPP_GetMIMEDescription:%s.\n", pMimeTypes); - return(pMimeTypes); -} - -#ifdef UNIX -NPError -// I am not actually sure wrt this, it ast least compiles with external -// npapi.h now... -NPP_GetValue(NPP /*instance*/, NPPVariable variable, void *value) -{ - NPError err = NPERR_NO_ERROR; - - switch (variable) { - case NPPVpluginNameString: - // add here, for dynamic productname - *((char **)value) = NSP_getPluginName(); - break; - case NPPVpluginDescriptionString: - // add here, for dynamic product description - *((char **)value) = NSP_getPluginDesc(); - break; - default: - err = NPERR_GENERIC_ERROR; - } - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, NPP_GetValue return %d.\n", err); - return err; -} - - -NPMIMEType -dupMimeType(NPMIMEType type) -{ - NPMIMEType mimetype = (NPMIMEType) NPN_MemAlloc(strlen(type)+1); - mimetype[strlen(type)] = 0; - if (mimetype) - strcpy(mimetype, type); - return(mimetype); -} -#endif // end of UNIX - -NPError -NPP_Initialize(void) -{ - debug_fprintf(NSP_LOG_NEW, "NS Plugin begin initialize.\n"); - return (NPError)do_init_pipe(); -} - -#ifdef OJI -jref -NPP_GetJavaClass() -{ - return NULL; -} -#endif - -void -NPP_Shutdown(void) -{ - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SHUTDOWN; - sendMsg(&msg, sizeof(PLUGIN_MSG), 0); - NSP_Close_Pipe(write_fd); - -#ifdef UNIX - // on Unix we should wait till the child process is dead - int nStatus; - waitpid( nChildPID, &nStatus, 0 ); -#endif -} - -NPError -NPP_New(NPMIMEType pluginType, - NPP instance, - uint16 mode, - int16 /*argc*/, - char* /*argn*/[], - char* /*argv*/[], - NPSavedData* /*saved*/) -{ - PluginInstance* This; - - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, enter NPP_New.\n"); - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - instance->pdata = (PluginInstance*)NPN_MemAlloc(sizeof(PluginInstance)); - - memset(instance->pdata, 0 , sizeof(PluginInstance)); - This = (PluginInstance*) instance->pdata; - - if (This == NULL) - { - return NPERR_OUT_OF_MEMORY_ERROR; - } - - memset(This, 0, sizeof(PluginInstance)); - - /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */ -#ifdef UNIX - This->mode = mode; - This->type = dupMimeType(pluginType); - This->instance = instance; - This->pluginsPageUrl = NULL; - This->exists = FALSE; -#endif //end of UNIX -#ifdef WNT - (void)pluginType; - This->fWindow = (NPWindow*)NPN_MemAlloc(sizeof(NPWindow)); - memset(This->fWindow, 0, sizeof (NPWindow)); - This->fMode = mode; - #endif //end of WNT - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_NEW_INSTANCE; - msg.instance_id = (plugin_Int32)instance; - if (!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - return NPERR_GENERIC_ERROR; - - NPN_Status(instance, "......"); - return NPERR_NO_ERROR; -} - -NPError -NPP_Destroy(NPP instance, NPSavedData** /*save*/) -{ - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, enter NPP_Destroy.\n"); - PluginInstance* This; - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Send destroy message - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_DESTROY; - msg.instance_id = (plugin_Int32)instance; -#ifdef UNIX - msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->window; -#endif //end of UNIX -#ifdef WNT - msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->fhWnd; -#endif //end of WNT - sendMsg(&msg, sizeof(PLUGIN_MSG), 0); - - // Free the instance space - This = (PluginInstance*) instance->pdata; - if (This != NULL) { -#ifdef UNIX - if (This->type) - NPN_MemFree(This->type); - if (This->pluginsPageUrl) - NPN_MemFree(This->pluginsPageUrl); - if (This->pluginsFileUrl) - NPN_MemFree(This->pluginsFileUrl); -#endif //end of UNIX -#ifdef WNT - if(This->fWindow) - NPN_MemFree(This->fWindow); -#endif //end of WNT - NPN_MemFree(instance->pdata); - instance->pdata = NULL; - } - - return NPERR_NO_ERROR; -} - - -NPError -NPP_SetWindow(NPP instance, NPWindow* window) -{ - PluginInstance* This; -#ifdef UNIX - NPSetWindowCallbackStruct *ws_info; -#endif //end of UNIX - - debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin, received window resize.\n"); - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - if (This == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Prepare the general part of the SET_WINDOW message - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(msg)); - msg.msg_id = SO_SET_WINDOW; - msg.instance_id = (plugin_Int32)instance; - - if ( window ) - { - // Set window info for instance -#ifdef UNIX - ws_info = (NPSetWindowCallbackStruct *)window->ws_info; - This->window = (Window) window->window; - This->x = window->x; - This->y = window->y; - This->width = window->width; - This->height = window->height; - This->display = ws_info->display; - This->visual = ws_info->visual; - This->depth = ws_info->depth; - This->colormap = ws_info->colormap; -#endif //end of UNIX -#ifdef WNT - This->fhWnd = (HWND) window->window; - This->fWindow->x = window->x; - This->fWindow->y = window->y; - This->fWindow->width = window->width; - This->fWindow->height = window->height; -#endif //end of WNT - debug_fprintf(NSP_LOG_APPEND, "begin Set window of Office\n"); - debug_fprintf(NSP_LOG_APPEND, "W=(%d) H=(%d)\n", window->width, window->height); - - // fill the window dependent part of the message - msg.wnd_id = (plugin_Int32) window->window; - msg.wnd_x = window->x; - msg.wnd_y = window->y; - msg.wnd_w = window->width; - msg.wnd_h = window->height; - } - else - { - // empty window pointer usually means closing of the parent window -#ifdef UNIX - ws_info = NULL; - This->window = (Window) NULL; - This->x = 0; - This->y = 0; - This->width = 0; - This->height = 0; - This->display = NULL; - This->visual = NULL; -#endif //end of UNIX -#ifdef WNT - This->fhWnd = (HWND) NULL; - This->fWindow->x = 0; - This->fWindow->y = 0; - This->fWindow->width = 0; - This->fWindow->height = 0; -#endif //end of WNT - debug_fprintf(NSP_LOG_APPEND, "Empty window pointer is provided\n"); - - // fill the window dependent part of the message - msg.wnd_id = (plugin_Int32) NULL; - msg.wnd_x = 0; - msg.wnd_y = 0; - msg.wnd_w = 0; - msg.wnd_h = 0; - } - - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - { - debug_fprintf(NSP_LOG_APPEND, "NPP_SetWindow return failure \n"); - return NPERR_GENERIC_ERROR; - } - - return NPERR_NO_ERROR; -} - - -NPError -NPP_NewStream(NPP instance, - NPMIMEType /*type*/, - NPStream* /*stream*/, - NPBool /*seekable*/, - uint16 *stype) -{ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - // Notify Mozilla to fetch the remote file into local cache directory - *stype=NP_ASFILEONLY; - - return NPERR_NO_ERROR; -} - - -int32 STREAMBUFSIZE = 0X0FFFFFFF; -/* If we are reading from a file in NPAsFile - * mode so we can take any size stream in our - * write call (since we ignore it) */ - -int32 -NPP_WriteReady(NPP /*instance*/, NPStream* /*stream*/) -{ - return STREAMBUFSIZE; -} - - -int32 -NPP_Write(NPP /*instance*/, NPStream* /*stream*/, int32 /*offset*/, int32 len, void* /*buffer*/) -{ - return len; /* The number of bytes accepted */ -} - - -NPError -NPP_DestroyStream(NPP instance, NPStream* /*stream*/, NPError /*reason*/) -{ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - return NPERR_NO_ERROR; -} - -// save fname to another file with the original file name -void -NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - debug_fprintf(NSP_LOG_APPEND, "Into Stream\n"); - char* url = (char*)stream->url; - char filename[1024] = {0}; - char* pfilename = NULL; - if (NULL != (pfilename = strrchr(url, '/'))) - { - strcpy(filename, pfilename+1); - } else { - return; - } - - int length = strlen(url); - debug_fprintf(NSP_LOG_APPEND, "url: %s; length: %d\n", url, length); - PluginInstance* This; - This = (PluginInstance*) instance->pdata; - - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile\n"); - - // copy cached file to another file with original name - char localPathNew[NPP_PATH_MAX] = {0}; - char localFileNew[NPP_PATH_MAX] = {0}; - // if the file is from local - if (0 == STRNICMP(url, "file:///", strlen("file:///"))) - { - sprintf(localPathNew, "%s", fname); - char* pAskSymbol = NULL; - if(NULL != (pAskSymbol = strrchr(localPathNew, '?'))) - *pAskSymbol = 0; - } - else // from network, on windows, fname is c:\abc123 - { - strncpy(localPathNew, fname, sizeof(localPathNew)); - char* pRandomFilename = NULL; - -#ifdef UNIX - if(NULL != (pRandomFilename = strrchr(localPathNew, '/'))) -#endif //end of UNIX -#ifdef WNT - if(NULL != (pRandomFilename = strrchr(localPathNew, '\\'))) -#endif //end of WNT - { - pRandomFilename[1] = 0; - } else { - return; - } - strcat(localPathNew, filename); - char* pAskSymbol = NULL; - if(NULL != (pAskSymbol = strrchr(localPathNew, '?'))) - *pAskSymbol = 0; - - sprintf(localFileNew, "file://%s", localPathNew); - UnixToDosPath(localFileNew); - debug_fprintf(NSP_LOG_APPEND, "fname: %s\n localPathNew: %s\nlocalFileNew: %s\n", - fname, localPathNew, localFileNew); - - restoreUTF8(localPathNew); - restoreUTF8(localFileNew); - if(0 != strcmp(fname, localPathNew)) { - -#ifdef WNT - if(NULL == CopyFile(fname, localPathNew, FALSE)) - return; -#endif //end of WNT - -#ifdef UNIX - int fdSrc, fdDst; - if((0 > (fdSrc = open(fname, O_RDONLY)))){ - return; - } - remove(localPathNew); - umask(0); - if (0 > (fdDst = open(localPathNew, O_WRONLY|O_CREAT, - S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))){ - close( fdSrc); - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:can not create cache file %s. error: %s \n", - localPathNew, strerror(errno)); - return; - } - char buffer[NPP_BUFFER_SIZE] = {0}; - int ret; - while(0 <= (ret = read(fdSrc, buffer, NPP_BUFFER_SIZE))) - { - if (0 == ret) - { - if(EINTR == errno) - continue; - else - - break; - } - write(fdDst, buffer, ret); - } - close(fdSrc); - close(fdDst); -#endif //end of UNIX - - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile:before SetURL\n"); - } - } - - // send SO_SET_URl message to inform the new URL - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SET_URL; - msg.instance_id = (plugin_Int32)instance; -#ifdef UNIX - msg.wnd_id =(plugin_Int32)(This->window); - sprintf(msg.url, "file://%s", localPathNew); -#endif //end of UNIX -#ifdef WNT - msg.wnd_id =(int)(This->fhWnd); - sprintf(msg.url, "file:///%s", localPathNew); - DosToUnixPath(msg.url); -#endif //endof WNT - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_URL return failure \n"); - - // send SO_SET_WINDOW message -// memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_SET_WINDOW; - msg.instance_id = (plugin_Int32)instance; -// msg.wnd_id =(plugin_Int32)((PluginInstance*) instance->pdata)->window; -#ifdef UNIX - msg.wnd_x = This->x; - msg.wnd_y = This->y; - msg.wnd_w = This->width; - msg.wnd_h = This->height; -#endif //end of UNIX -#ifdef WNT - msg.wnd_x = This->fWindow->x; - msg.wnd_y = This->fWindow->y; - msg.wnd_w = This->fWindow->width; - msg.wnd_h = This->fWindow->height; -#endif //endof WNT - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_WINDOW return failure \n"); -} - -void -NPP_URLNotify(NPP /*instance*/, const char* /*url*/, - NPReason /*reason*/, void* /*notifyData*/) -{ -} - - -void -NPP_Print(NPP instance, NPPrint* printInfo) -{ - if(printInfo == NULL) - return; - - if (instance != NULL) { - /***** Insert NPP_Print code here *****/ - PluginInstance* This = (PluginInstance*) instance->pdata; - (void)This; - PLUGIN_MSG msg; - memset((char*)&msg, 0, sizeof(PLUGIN_MSG)); - msg.msg_id = SO_PRINT; - msg.instance_id = (plugin_Int32)instance; - if(!sendMsg(&msg, sizeof(PLUGIN_MSG), 1)) - debug_fprintf(NSP_LOG_APPEND, "NPP_StreamAsFile send SO_SET_WINDOW return failure \n"); - printInfo->mode = TRUE; - /**************************************/ - - if (printInfo->mode == NP_FULL) { - /* - * PLUGIN DEVELOPERS: - * If your plugin would like to take over - * printing completely when it is in full-screen mode, - * set printInfo->pluginPrinted to TRUE and print your - * plugin as you see fit. If your plugin wants Netscape - * to handle printing in this case, set - * printInfo->pluginPrinted to FALSE (the default) and - * do nothing. If you do want to handle printing - * yourself, printOne is true if the print button - * (as opposed to the print menu) was clicked. - * On the Macintosh, platformPrint is a THPrint; on - * Windows, platformPrint is a structure - * (defined in npapi.h) containing the printer name, port, - * etc. - */ - - /***** Insert NPP_Print code here *****\ - void* platformPrint = - printInfo->print.fullPrint.platformPrint; - NPBool printOne = - printInfo->print.fullPrint.printOne; - \**************************************/ - - /* Do the default*/ - printInfo->print.fullPrint.pluginPrinted = FALSE; - } - else { /* If not fullscreen, we must be embedded */ - /* - * PLUGIN DEVELOPERS: - * If your plugin is embedded, or is full-screen - * but you returned false in pluginPrinted above, NPP_Print - * will be called with mode == NP_EMBED. The NPWindow - * in the printInfo gives the location and dimensions of - * the embedded plugin on the printed page. On the - * Macintosh, platformPrint is the printer port; on - * Windows, platformPrint is the handle to the printing - * device context. - */ - - /***** Insert NPP_Print code here *****\ - NPWindow* printWindow = - &(printInfo->print.embedPrint.window); - void* platformPrint = - printInfo->print.embedPrint.platformPrint; - \**************************************/ - } - } -} - -}// end of extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/npshell.hxx b/extensions/source/nsplugin/source/npshell.hxx deleted file mode 100644 index e3e44c93a..000000000 --- a/extensions/source/nsplugin/source/npshell.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifdef UNIX - -#ifndef MOZ_X11 -# define MOZ_X11 -#endif - -#include -#include - -typedef struct _PluginInstance -{ - uint16 mode; -#ifdef MOZ_X11 - Window window; - Display *display; -#endif - uint32 x, y; - uint32 width, height; - NPMIMEType type; - char *message; - - NPP instance; - char *pluginsPageUrl; - char *pluginsFileUrl; - NPBool pluginsHidden; -#ifdef MOZ_X11 - Visual* visual; - Colormap colormap; -#endif - unsigned int depth; - GtkWidget* dialogBox; - - NPBool exists; /* Does the widget already exist? */ - int action; /* What action should we take? (GET or REFRESH) */ - -} PluginInstance; - -typedef struct _MimeTypeElement -{ - PluginInstance *pinst; - struct _MimeTypeElement *next; -} MimeTypeElement; - -#endif //end of UNIX - - -#ifdef WNT - -#include - -typedef struct _PluginInstance -{ - NPWindow* fWindow; - uint16 fMode; - - HWND fhWnd; - WNDPROC fDefaultWindowProc; -} PluginInstance; - -#endif //end of WNT - - -/* Extern functions */ -extern "C" NPMIMEType dupMimeType(NPMIMEType type); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/ns_debug.hxx b/extensions/source/nsplugin/source/ns_debug.hxx deleted file mode 100644 index d2ee5b0bd..000000000 --- a/extensions/source/nsplugin/source/ns_debug.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __NSDEBUG_HXX_ -#define __NSDEBUG_HXX_ - -#define NPP_PATH_MAX 1024 -#define NPP_BUFFER_SIZE 1024 - -#define NSP_LOG_APPEND 2 -#define NSP_LOG_NEW 0 - -#define debug_fprintf NSP_WriteLog - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_func.hxx b/extensions/source/nsplugin/source/nsp_func.hxx deleted file mode 100644 index c9ebbc7d7..000000000 --- a/extensions/source/nsplugin/source/nsp_func.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __NSP_FUNC_HXX -#define __NSP_FUNC_HXX - - -// Some function diffrent from UNIX and Window. - -/************************ In UNIX ************************/ - - -#ifdef UNIX -// for chdir() -#define NSP_CHDIR chdir -//for vsnprintf() -#define NSP_vsnprintf vsnprintf - - -//for pipe() -typedef int NSP_PIPE_FD; -#define NSP_Inherited_Pipe(fp) pipe(fd) -#define NSP_Close_Pipe(fp) close(fp) -//for write(), read() -#define NSP_Write_Pipe(a, b, c, d) write(a, b, c) -#define NSP_Read_Pipe(a, b, c, d) read(a, b, c) - -//for socket -#define NSP_CloseSocket close - -//for sleep -#define NSP_Sleep(a) sleep(a) - -//for mutex -#define NSP_Mute_Obj pthread_mutex_t -#define NSP_New_Mute_Obj() PTHREAD_MUTEX_INITIALIZER -#define NSP_Lock_Mute_Obj(a) pthread_mutex_lock(&a) -#define NSP_Unlock_Mute_Obj(a) pthread_mutex_unlock(&a) - -#define STRNICMP(a, b ,c) strncasecmp(a, b ,c) -#endif //end of UNIX - -/************************ In WINWS ************************/ - -#ifdef WNT - -#include -//for chdir() -#define NSP_CHDIR(a) _chdir(a) -//for vsnprintf() -#define NSP_vsnprintf _vsnprintf - -//for pipe() -typedef HANDLE NSP_PIPE_FD; -SECURITY_ATTRIBUTES NSP_pipe_access = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE}; -#define NSP_Inherited_Pipe(fd) (!CreatePipe(&fd[0], &fd[1], &NSP_pipe_access, 1024*10)) -#define NSP_Close_Pipe(fp) CloseHandle(fp) -//for write(), read() -#define NSP_Write_Pipe(a, b, c, d) WriteFile(a, b, c, d, NULL) -#define NSP_Read_Pipe(a, b, c, d) ReadFile(a, b, c, d, NULL) - -//for execl() -#define NSP_CreateProcess(a, b ) CreateProcess(a, b, NULL, NULL, TRUE, 0, NULL, NULL, NULL, NULL) - -//for socket -#define NSP_CloseSocket closesocket -//for sleep -#define NSP_Sleep(a) Sleep(a*1000) - -//for mutex -#define NSP_Mute_Obj HANDLE -#define NSP_New_Mute_Obj() CreateMutex (NULL, FALSE, NULL) -#define NSP_Lock_Mute_Obj(a) WaitForSingleObject(a, INFINITE) -#define NSP_Unlock_Mute_Obj(a) ReleaseMutex(a) -#define STRNICMP(a, b ,c) strnicmp(a, b ,c) - -#endif //end of WNT - - -#endif //end of __NSP_FUNC_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_windows.cxx b/extensions/source/nsplugin/source/nsp_windows.cxx deleted file mode 100644 index 85cabfbb2..000000000 --- a/extensions/source/nsplugin/source/nsp_windows.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef WNT - #pragma warning (push,1) - #pragma warning (disable:4668) - #include - #pragma warning (pop) -#endif - -int NSP_ResetWinStyl(long hParent) -{ - int ret = 0; -#ifdef WNT - LONG dOldStyl = GetWindowLong( (HWND)hParent, GWL_STYLE); - ret = dOldStyl; - - if(ret != 0) - { - LONG dNewStyl = dOldStyl|WS_CLIPCHILDREN; - if(0 == SetWindowLong((HWND)hParent, GWL_STYLE, dNewStyl)) - ret = 0; - } -#endif - return ret; - -} - -int NSP_RestoreWinStyl(long hParent, long dOldStyle) -{ - int ret = 0; -#ifdef WNT - ret = SetWindowLong((HWND)hParent, GWL_STYLE, dOldStyle); -#endif - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsp_windows.hxx b/extensions/source/nsplugin/source/nsp_windows.hxx deleted file mode 100644 index 4ed2f89c3..000000000 --- a/extensions/source/nsplugin/source/nsp_windows.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __NSP_WINDOWS_HXX__ -#define __NSP_WINDOWS_HXX__ - - -int NSP_ResetWinStyl(long hParent); -int NSP_RestoreWinStyl(long hParent, long dOldStyle); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/nsplugin.rc b/extensions/source/nsplugin/source/nsplugin.rc deleted file mode 100644 index ee7107a43..000000000 --- a/extensions/source/nsplugin/source/nsplugin.rc +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define ADDITIONAL_VERINFO1 VALUE "FileExtents", "sdc|sds|sda|sdd|sdp|smf|vor|sgl|sdw|sxc|stc|sxd|std|sxi|sti|sxm|sxw|sxg|stw|odt|ott|odm|oth|ods|ots|odg|otg|odp|otp|odf\0"\ - VALUE "FileOpenName", "StarCalc 3.0 - 5.0|StarChart 3.0 - 5.0|StarDraw 3.0 - 5.0|StarImpress 3.0 - 5.0|StarImpress-packed 3.0 - 5.0|StarMath 3.0 - 5.0|StarWriter Template 3.0 - 5.0|StarWriter Global 3.0 - 5.0|StarWriter 3.0 - 5.0|StarOffice 6.0/7 Spreadsheet|StarOffice 6.0/7 Spreadsheet Template|StarOffice 6.0/7 Drawing|StarOffice 6.0/7 Drawing Template|StarOffice 6.0/7 Presentation|StarOffice 6.0/7 Presentation Template|StarOffice 6.0/7 Formula|StarOffice 6.0/7 Text Document|StarOffice 6.0/7 Master Document|StarOffice 6.0/7 Text Document Template|OpenDocument Text|OpenDocument Text Template|OpenDocument Master Document|HTML Document Template|OpenDocument Spreadsheet|OpenDocument Spreadsheet Template|OpenDocument Drawing|OpenDocument Drawing Template|OpenDocument Presentation|OpenDocument Presentation Template|OpenDocument Formula\0" -#define ADDITIONAL_VERINFO2 VALUE "FileDescription", "Oracle Open Office Plug-in handles all its documents" VALUE "ProductName", "Oracle Open Office Plug-in" VALUE "MIMEType", "application/vnd.stardivision.calc|application/vnd.stardivision.chart|application/vnd.stardivision.draw|application/vnd.stardivision.impress|application/vnd.stardivision.impress-packed|application/vnd.stardivision.math|application/vnd.stardivision.writer|application/vnd.stardivision.writer-global|application/vnd.staroffice.writer|application/vnd.sun.xml.calc|application/vnd.sun.xml.calc.template|application/vnd.sun.xml.draw|application/vnd.sun.xml.draw.template| -#define ADDITIONAL_VERINFO3 "application/vnd.sun.xml.impress|application/vnd.sun.xml.impress.template|application/vnd.sun.xml.math|application/vnd.sun.xml.writer|application/vnd.sun.xml.writer.global|application/vnd.sun.xml.writer.template|application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.text-template|application/vnd.oasis.opendocument.text-master|application/vnd.oasis.opendocument.text-web|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.formula\0" diff --git a/extensions/source/nsplugin/source/nsplugin_oo.rc b/extensions/source/nsplugin/source/nsplugin_oo.rc deleted file mode 100644 index 1fc8285c6..000000000 --- a/extensions/source/nsplugin/source/nsplugin_oo.rc +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define ADDITIONAL_VERINFO1 VALUE "FileExtents", "sdc|sds|sda|sdd|sdp|smf|vor|sgl|sdw|sxc|stc|sxd|std|sxi|sti|sxm|sxw|sxg|stw|odt|ott|odm|oth|ods|ots|odg|otg|odp|otp|odf\0"\ - VALUE "FileOpenName", "StarCalc 3.0 - 5.0|StarChart 3.0 - 5.0|StarDraw 3.0 - 5.0|StarImpress 3.0 - 5.0|StarImpress-packed 3.0 - 5.0|StarMath 3.0 - 5.0|StarWriter Template 3.0 - 5.0|StarWriter Global 3.0 - 5.0|StarWriter 3.0 - 5.0|StarOffice 6.0/7 Spreadsheet|StarOffice 6.0/7 Spreadsheet Template|StarOffice 6.0/7 Drawing|StarOffice 6.0/7 Drawing Template|StarOffice 6.0/7 Presentation|StarOffice 6.0/7 Presentation Template|StarOffice 6.0/7 Formula|StarOffice 6.0/7 Text Document|StarOffice 6.0/7 Master Document|StarOffice 6.0/7 Text Document Template|OpenDocument Text|OpenDocument Text Template|OpenDocument Master Document|HTML Document Template|OpenDocument Spreadsheet|OpenDocument Spreadsheet Template|OpenDocument Drawing|OpenDocument Drawing Template|OpenDocument Presentation|OpenDocument Presentation Template|OpenDocument Formula\0" -#define ADDITIONAL_VERINFO2 VALUE "FileDescription", "LibreOffice Plug-in handles all its documents" VALUE "ProductName", "LibreOffice Plug-in" VALUE "MIMEType", "application/vnd.stardivision.calc|application/vnd.stardivision.chart|application/vnd.stardivision.draw|application/vnd.stardivision.impress|application/vnd.stardivision.impress-packed|application/vnd.stardivision.math|application/vnd.stardivision.writer|application/vnd.stardivision.writer-global|application/vnd.staroffice.writer|application/vnd.sun.xml.calc|application/vnd.sun.xml.calc.template|application/vnd.sun.xml.draw|application/vnd.sun.xml.draw.template|" -#define ADDITIONAL_VERINFO3 "application/vnd.sun.xml.impress|application/vnd.sun.xml.impress.template|application/vnd.sun.xml.math|application/vnd.sun.xml.writer|application/vnd.sun.xml.writer.global|application/vnd.sun.xml.writer.template|application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.text-template|application/vnd.oasis.opendocument.text-master|application/vnd.oasis.opendocument.text-web|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.formula\0" diff --git a/extensions/source/nsplugin/source/so_closelistener.cxx b/extensions/source/nsplugin/source/so_closelistener.cxx deleted file mode 100644 index 4fb26e593..000000000 --- a/extensions/source/nsplugin/source/so_closelistener.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "so_closelistener.hxx" - -using namespace ::com::sun::star; - -void SAL_CALL PluginDocumentClosePreventer::queryClosing( const lang::EventObject& /*aEvent*/, sal_Bool /*bDeliverOwnership*/ ) - throw ( uno::RuntimeException, util::CloseVetoException ) -{ - if ( m_bPreventClose ) - throw util::CloseVetoException(); -} - -void SAL_CALL PluginDocumentClosePreventer::notifyClosing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException ) -{} - -void SAL_CALL PluginDocumentClosePreventer::disposing( const lang::EventObject& /*aEvent*/ ) throw ( uno::RuntimeException ) -{} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_closelistener.hxx b/extensions/source/nsplugin/source/so_closelistener.hxx deleted file mode 100644 index 7451c44b8..000000000 --- a/extensions/source/nsplugin/source/so_closelistener.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SO_CLOSELISTENER_HXX_ -#define __SO_CLOSELISTENER_HXX_ - -#include -#include - -class PluginDocumentClosePreventer : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XCloseListener > -{ - sal_Bool m_bPreventClose; - -public: - PluginDocumentClosePreventer() - : m_bPreventClose( sal_True ) - {} - - void StopPreventClose() { m_bPreventClose = sal_False; } - - virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& aEvent, sal_Bool bDeliverOwnership ) - throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::util::CloseVetoException ); - - virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException ) ; - - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException ) ; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx deleted file mode 100644 index 8f8e436f0..000000000 --- a/extensions/source/nsplugin/source/so_env.cxx +++ /dev/null @@ -1,509 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef UNIX -#include -#include -#ifdef LINUX -#include -#endif -#include -// For vsnprintf() -#define NSP_vsnprintf vsnprintf -#include "nsp_func.hxx" -#endif // End UNIX - -#ifdef WNT -#define _WINDOWS - -#pragma warning (push,1) -#pragma warning (disable:4668) -#pragma warning (disable:4917) - -#include -#include -#include -#include -#include -// For vsnprintf() -#define NSP_vsnprintf _vsnprintf - -#pragma warning (pop) -#endif // End WNT - -#include -#include -#include "so_env.hxx" -#include "ns_debug.hxx" -#include - -#define PLUGIN_NAME "OpenOffice.org" - -// Tranform all strings like %20 in pPath to one char like space -/*int retoreUTF8(char* pPath) -{ - // Prepare buf - int len = strlen(pPath) + 1; - char* pBuf = (char*)malloc(len); - memset(pBuf, 0, len); - - // Store the original pBuf and pPath - char* pBufCur = pBuf; - char* pPathCur = pPath; - // ie, for %20, UTF8Numbers[0][0] = 2, UTF8Numbers[1][0] = 0 - char UTF8Numbers[2][2] = {{0, 0}, {0,0}}; - int temp; - - while (*pPathCur) { - if (('%' == *pPathCur) && (0 != *(pPathCur + 1)) - && (0 != *(pPathCur + 2))) - { - UTF8Numbers[0][0] = *(pPathCur + 1); - UTF8Numbers[1][0] = *(pPathCur + 2); - temp = 0; - temp = atoi(UTF8Numbers[0])*16 + atoi(UTF8Numbers[1]); - *pBufCur = (char)temp; - pBufCur++; - pPathCur += 3; - } else { - *pBufCur++ = *pPathCur++; - } - } - - *pBufCur = 0; - strcpy(pPath, pBuf); - free(pBuf); - return 0; -}*/ - -int -restoreUTF8(char *pPath) -{ - unsigned char *s, *d; - -#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10) - - s = d = (unsigned char *)pPath; - do { - if (*s == '%' && s[1] && s[2]) { - *d++ = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]); - s += 2; - } else - *d++ = *s; - } while (*s++); - debug_fprintf(NSP_LOG_APPEND, "after restoreUTF8, pPath is %s\n", pPath); - return 0; -} - -#ifdef LINUX -extern int nspluginOOoModuleHook (void** aResult); -int nspluginOOoModuleHook (void** aResult) -{ - void *dl_handle; - - dl_handle = dlopen(NULL, RTLD_NOW); - if (!dl_handle) - { - fprintf (stderr, "Can't open myself '%s'\n", dlerror()); - return 1; - } - - Dl_info dl_info = { 0,0,0,0 }; - if(!dladdr((void *)nspluginOOoModuleHook, &dl_info)) - { - fprintf (stderr, "Can't find my own address '%s'\n", dlerror()); - return 1; - } - - if (!dl_info.dli_fname) - { - fprintf (stderr, "Can't find my own file name\n"); - return 1; - } - - char cwdstr[NPP_PATH_MAX]; - if (!getcwd (cwdstr, sizeof(cwdstr))) - { - fprintf (stderr, "Can't get cwd\n"); - return 1; - } - - char libFileName[NPP_PATH_MAX]; - - if (dl_info.dli_fname[0] != '/') - { - if ((strlen(cwdstr) + 1 + strlen(dl_info.dli_fname)) >= NPP_PATH_MAX) - { - fprintf (stderr, "Plugin path too long\n"); - return 1; - } - strcpy (libFileName, cwdstr); - strcat (libFileName, "/"); - strcat (libFileName, dl_info.dli_fname); - } - else - { - if (strlen(dl_info.dli_fname) >= NPP_PATH_MAX) - { - fprintf (stderr, "Plugin path too long\n"); - return 1; - } - strcpy (libFileName, dl_info.dli_fname); - } - - char *clobber; - static char realFileName[NPP_PATH_MAX] = {0}; -# define SEARCH_SUFFIX "/program/libnpsoplug" - - if (!(clobber = strstr (libFileName, SEARCH_SUFFIX))) - { - ssize_t len = readlink(libFileName, realFileName, NPP_PATH_MAX-1); - if (len == -1) - { - fprintf (stderr, "Couldn't read link '%s'\n", libFileName); - return 1; - } - realFileName[len] = '\0'; - if (!(clobber = strstr (realFileName, SEARCH_SUFFIX))) - { - fprintf (stderr, "Couldn't find suffix in '%s'\n", realFileName); - return 1; - } - *clobber = '\0'; - } - else - { - *clobber = '\0'; - strcpy (realFileName, libFileName); - } - -#if OSL_DEBUG_LEVEL > 0 - fprintf (stderr, "LibreOffice path before fixup is '%s'\n", realFileName); -#endif - - if (realFileName[0] != '/') { - /* a relative sym-link and we need to get an absolute path */ - char scratch[NPP_PATH_MAX] = {0}; - if (strlen (realFileName) + strlen (libFileName) + 2 >= NPP_PATH_MAX - 1) - { - fprintf (stderr, "Paths too long to fix up.\n"); - return 1; - } - strcpy (scratch, libFileName); - if (strrchr (scratch, '/')) /* remove the last element */ - *(strrchr (scratch, '/') + 1) = '\0'; - strcat (scratch, realFileName); - strcpy (realFileName, scratch); - } - - *aResult = realFileName; - -#if OSL_DEBUG_LEVEL > 0 - fprintf (stderr, "LibreOffice path is '%s'\n", realFileName); -#endif - - return 0; -} -#endif - -// *aResult points the static string holding "/opt/staroffice8" -int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const char* /*entry*/) -{ -#ifdef UNIX - // The real space to hold "/opt/staroffice8" - static char realFileName[NPP_PATH_MAX] = {0}; - memset(realFileName, 0, NPP_PATH_MAX); - *aResult = realFileName; - - // Filename of lnk file, eg. "soffice" - char lnkFileName[NPP_PATH_MAX] = {0}; - char* pTempZero = NULL; - -#ifdef LINUX - /* try to fetch a 'self' pointer */ - if (!nspluginOOoModuleHook (aResult)) - return 0; - - /* .. now in $HOME */ -#endif - sprintf(lnkFileName, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION); -#ifdef LINUX - ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX-1); - if (-1 == len) - { - *realFileName = 0; - return -1; - } - realFileName[len] = '\0'; - - if (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))) -#else - if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) || - (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION)))) -#endif - { - *realFileName = 0; - return -1; - } - *pTempZero = 0; - return 0; -#endif -#ifdef WNT - static char realFileName[NPP_PATH_MAX] = {0}; - *aResult = realFileName; - HKEY hKey; - DWORD dwBufLen = NPP_PATH_MAX; - LONG lRet; - - debug_fprintf(NSP_LOG_APPEND, "1 before before strstr realFileName is %s\n", realFileName); - lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, - "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", - 0, KEY_QUERY_VALUE, &hKey ); - if (lRet == ERROR_FILE_NOT_FOUND) { - lRet = RegOpenKeyEx( - HKEY_CURRENT_USER, - "SOFTWARE\\MozillaPlugins\\@sun.com/npsopluginmi;version=1.0", 0, - KEY_QUERY_VALUE, &hKey); - } - debug_fprintf(NSP_LOG_APPEND, "2 before before strstr realFileName is %s\n", realFileName); - if( lRet != ERROR_SUCCESS ) - return FALSE; - - lRet = RegQueryValueEx( hKey, "Path", NULL, NULL, - (LPBYTE) realFileName, &dwBufLen); - debug_fprintf(NSP_LOG_APPEND, "3 before before strstr realFileName is %s\n", realFileName); - if( (lRet != ERROR_SUCCESS) || (dwBufLen > NPP_PATH_MAX) ) - return FALSE; - - RegCloseKey( hKey ); - char* pTempZero = NULL; - debug_fprintf(NSP_LOG_APPEND, "before strstr realFileName is %s\n", realFileName); - if (NULL == (pTempZero = strstr(realFileName, "\\program"))) - { - *realFileName = 0; - return -1; - } - *pTempZero = 0; - debug_fprintf(NSP_LOG_APPEND, "realFileName is %s\n", realFileName); - return 0; -#endif -} - -// Return the install dir path of staroffice, return value like "/home/build/staroffice" -const char* findInstallDir() -{ - static char* pInstall = NULL; - debug_fprintf(NSP_LOG_APPEND, "start of findInstallDir()\n"); - if (!pInstall) - { - findReadSversion((void**)&pInstall, 0, "["SECTION_NAME"]", SOFFICE_VERSION"="); - if (!pInstall) - pInstall = const_cast< char* >( "" ); - } - return pInstall; -} - -// Return the program dir path of staroffice, return value like "/home/build/staroffice/program" -const char* findProgramDir() -{ - static char sProgram[NPP_BUFFER_SIZE] = {0}; - if (!sProgram[0]) - { - sprintf(sProgram, "%s/program", findInstallDir()); -#ifdef WNT - UnixToDosPath(sProgram); -#endif - } - return sProgram; -} - -#ifdef WNT -// Return SO executable absolute path, like "/home/build/staroffice/program/soffice" -const char* findSofficeExecutable() -{ - static char pSofficeExeccutable[NPP_PATH_MAX] = {0}; - if (!pSofficeExeccutable[0]) - { - sprintf(pSofficeExeccutable, "%s/%s", findProgramDir(), STAROFFICE_EXE_FILE_NAME); -#ifdef WNT - UnixToDosPath(pSofficeExeccutable); -#endif - } - - return pSofficeExeccutable; -} - -// Change Dos path such as c:\program\soffice to c:/program/soffice -int DosToUnixPath(char* sPath) -{ - if (!sPath) - return -1; - char* p = sPath; - while (*p) - { - if(*p == '\\') - *p = '/'; - p++; - } - return 0; - -} -#endif -// Change Unix path such as program/soffice to program\soffice -int UnixToDosPath(char* sPath) -{ - if (!sPath) - return -1; - char* p = sPath; - while (*p) - { - if(*p == '/') - *p = '\\'; - p++; - } - return 0; - -} - -#ifdef UNIX -char productName[128] = {0}; -char* NSP_getProductName() -{ - if(productName[0]) - return productName; - char fullBootstrapIniPath[1024] = {0}; - const char* pFullFilePath = findProgramDir(); - if(0 == *pFullFilePath) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - sprintf(fullBootstrapIniPath, "%s/%s", pFullFilePath, - "bootstraprc"); - - FILE* fp = fopen(fullBootstrapIniPath, "r"); - - if (NULL == fp) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - char line[4096] = {0}; - char *pStart = 0; - char *pEnd = 0; - while(!feof(fp)) - { - if (fgets( line, sizeof(line), fp ) == NULL) - continue; - if (NULL == (pStart = strstr( line, "ProductKey=" ))) - continue; - pStart += strlen("ProductKey="); - if (NULL == (pEnd = strchr( pStart, ' ' )) && - (NULL == (pEnd = strchr( pStart, '\r' )))) - continue; - *pEnd = 0; - strcpy(productName, pStart); - } - fclose(fp); - if ((*productName == 0) || - (0 != STRNICMP(productName, "StarOffice", sizeof("StarOffice")))) - { - strcpy(productName, PLUGIN_NAME); - return productName; - } - memset(productName, 0, sizeof(productName)); - strcat(productName, "StarOffice/StarSuite"); - return productName; -} - -char PluginName[1024] = {0}; -char* NSP_getPluginName() -{ - if(*PluginName) - return PluginName; - sprintf(PluginName, "%s Plug-in", NSP_getProductName()); - return PluginName; -} - -char PluginDesc[1024] = {0}; -char* NSP_getPluginDesc() -{ - if(*PluginDesc) - return PluginDesc; - - sprintf(PluginDesc, "%s Plug-in handles all its documents", - productName); - return PluginDesc; -} -#endif //end of UNIX - -void NSP_WriteLog(int level, const char* pFormat, ...) -{ - (void)level; -#ifndef DEBUG - (void)pFormat; -#else - va_list ap; - char msgBuf[NPP_BUFFER_SIZE]; - static char logName[NPP_PATH_MAX] = {0}; - FILE * fp = NULL; - - va_start(ap,pFormat); - NSP_vsnprintf(msgBuf, NPP_BUFFER_SIZE, pFormat, ap); - va_end(ap); - - if (!logName[0]) - { -#ifdef UNIX - const char* homeDir = getenv("HOME"); - sprintf(logName,"%s/%s",homeDir,"nsplugin.log"); -#endif // End UNIX -#ifdef WNT - char szPath[MAX_PATH]; - if (!SHGetSpecialFolderPath(NULL, szPath, CSIDL_APPDATA, 0)) - { - return; - } - char* homeDir = szPath; - sprintf(logName,"%s\\%s", szPath, "nsplugin.log"); -#endif // End WNT - } - else - fp = fopen(logName, "a+"); - - if (!fp) - return; - fputs(msgBuf, fp); - fclose(fp); -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_env.hxx b/extensions/source/nsplugin/source/so_env.hxx deleted file mode 100644 index 9737425f4..000000000 --- a/extensions/source/nsplugin/source/so_env.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SO_ENVIRON_HXX__ -#define __SO_ENVIRON_HXX__ - - - -#ifdef UNIX - - -#include -#include -#include - -#endif //end of UNIX - - -#include -#include -#include -#include -#include - -#define SO_SERVER_PORT 8100 - - -#ifdef UNIX -#define STAROFFICE_VERSION_FILE "/.sversionrc" -#define STAROFFICE_EXE_FILE_NAME "soffice" -#endif -#ifdef WNT -#define STAROFFICE_VERSION_FILE "\\sversion.ini" -#define STAROFFICE_EXE_FILE_NAME "soffice.exe" -#endif - -#define SECTION_NAME "Versions" -#define SOFFICE_VERSION "StarOffice 8" -//#define SOFFICE_VERSION "SunShine Office 1.0" - -#define APP_ERROR 1 -#define APP_CHAR 2 -#define APP_WCHAR 3 - -// return the install path of staroffice, return value like "/home/build/staroffice" -const char* findInstallDir(); - -// return SO program dir absolute path, like "/home/build/staroffice/program" -const char* findProgramDir(); - -#ifdef WNT -// return SO executable absolute path, like "/home/build/staroffice/program/soffice" -const char* findSofficeExecutable(); - -// change Dos path such as c:\program\soffice to c:/program/soffice -int DosToUnixPath(char*); -#endif - -//change Unix path such as program\soffice to program/soffice -int UnixToDosPath(char*); - -void NSP_WriteLog(int level, const char* pFormat, ...); - -int restoreUTF8(char* pPath); - -char* NSP_getPluginName(); - -char* NSP_getPluginDesc(); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx deleted file mode 100644 index 658d73a59..000000000 --- a/extensions/source/nsplugin/source/so_instance.cxx +++ /dev/null @@ -1,485 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "so_instance.hxx" -#include "ns_debug.hxx" -#include "so_env.hxx" -#include "nsp_windows.hxx" -#include "so_closelistener.hxx" -#include - -namespace css=com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::connection; -using namespace cppu; -using namespace com::sun::star; - -using ::rtl::OUString; -using ::rtl::OString; - -char SoPluginInstance::sSO_Dir[] = {0}; -Reference< XMultiServiceFactory > SoPluginInstance::mxRemoteMSF = Reference< XMultiServiceFactory >(NULL); - -SoPluginInstance::SoPluginInstance(long pParent, Reference< XMultiServiceFactory > xMSF): - m_xUnoWin(NULL), - m_xComponent(NULL), - m_xFrame(NULL), - m_xFrames(NULL), - m_xDispatcher(NULL), - m_xDispatchProvider(NULL), - m_pCloseListener(NULL) -{ - m_nWidth = 0; - m_nHeight = 0; - m_nX = 0; - m_nY = 0; - m_nFlag = 15; - m_bInit = sal_False; - m_hParent = 0; - m_pParent = pParent; - m_dParentStyl = 0; - mxRemoteMSF = xMSF; -} - -SoPluginInstance::~SoPluginInstance() -{ -} - -sal_Bool SoPluginInstance::SetURL(char* aURL) -{ - debug_fprintf(NSP_LOG_APPEND, "SoPluginInstance::SetURL %s\n", aURL); - sal_uInt16 encoding = 11; - - rtl_Locale* pLocale = NULL; - osl_getProcessLocale(&pLocale); - encoding = osl_getTextEncodingFromLocale(pLocale); - - m_sURL = ::rtl::OUString(aURL, strlen(aURL), encoding); - debug_fprintf(NSP_LOG_APPEND, "SetURL %s\nencoding is: %d\n", ::rtl::OUStringToOString(m_sURL, - RTL_TEXTENCODING_GB_18030).getStr(), m_sURL.getLength(), encoding); - return sal_True; -} - -// plugin window UI part: create window, load document -sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent) -{ - // If doc has been loaded, we just resize the window and return - if(m_bInit) - { - debug_fprintf(NSP_LOG_APPEND, "only reset windows size\n"); - m_xUnoWin->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag ); - debug_fprintf(NSP_LOG_APPEND, "set windows to x:%d y:%d w:%d h%d falg:%d\n", - m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag); - return sal_True; - } - - // If mxRemoteMSF is not initialized, we assert and return sal_False - if(!mxRemoteMSF.is()) - { - debug_fprintf(NSP_LOG_APPEND, "Remote StarOfiice ServiceManager is not initilzed correctly!\n"); - return sal_False; - } - - try - { - // try to create netscape plugin window - Reference< awt::XToolkit > xToolkit( - mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ), - uno::UNO_QUERY ); - if( !xToolkit.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "Can not create Toolkit!\n"); - return sal_False; - } - - // prepare parameters for plugin window - css::uno::Any hwndParent = css::uno::makeAny((sal_Int32)hParent); -#ifdef UNIX - sal_Int16 nWindowType = css::lang::SystemDependent::SYSTEM_XWINDOW; -#endif //end of UNIX -#ifdef WNT - sal_Int16 nWindowType = css::lang::SystemDependent::SYSTEM_WIN32; -#endif //end of WNT - - Reference< awt::XSystemChildFactory > xToolkitSystemChildFactory(xToolkit, uno::UNO_QUERY); - if (!xToolkitSystemChildFactory.is()) - { - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, get xToolkitSystemChildFactory failure.\n"); - return sal_False; - } - - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, try to create plugin container window HWIN:%ld.\n", hParent); - - // create the plugin window - Reference< awt::XWindowPeer > xNewWinPeer = - xToolkitSystemChildFactory->createSystemChild( hwndParent, - css::uno::Sequence(), nWindowType ); - if ( !xNewWinPeer.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not create first window\n", hParent); - return sal_False; - } - - // get interface of first window - m_xUnoWin = Reference< awt::XWindow >( xNewWinPeer, uno::UNO_QUERY ); - if( !m_xUnoWin.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get interface of first window\n", hParent); - return sal_False; - } - - // initialize window - xNewWinPeer->setBackground( COL_GRAY ); - m_xUnoWin->setVisible( sal_True ); - m_xUnoWin->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag ); - debug_fprintf(NSP_LOG_APPEND, "set windows to x:%d y:%d w:%d h%d falg:%d\n", - m_nX, m_nY, m_nWidth, m_nHeight, m_nFlag); - - // create frame - m_xFrame = Reference< frame::XFrame >( - mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame") )), - uno::UNO_QUERY ); - if (!m_xFrame.is()) - { - debug_fprintf(NSP_LOG_APPEND, "can not create frame\n"); - return sal_False; - } - - // initialize frame - m_xFrame->initialize( m_xUnoWin ); - - try - { - // currently ignore errors in this code - uno::Reference< beans::XPropertySet > xFrameProps( m_xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xLMProps; - xFrameProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LayoutManager")) ) >>= xLMProps; - if ( xLMProps.is() ) - xLMProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticToolbars")), uno::makeAny( (sal_Bool)sal_False ) ); - } - catch( uno::Exception& ) - {} - - // get frames supplier - Reference< frame::XFramesSupplier > m_xFramesSupplier( - mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), - uno::UNO_QUERY ); - if ( !m_xFramesSupplier.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get desktop\n"); - return sal_False; - } - - // get frames - m_xFrames = m_xFramesSupplier->getFrames(); - if ( !m_xFrames.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get frames from FramesSupplier\n"); - return sal_False; - } - - // append m_xFrame to m_xFrames - m_xFrames->append( m_xFrame ); - - // create XComponentLoader - Reference< frame::XComponentLoader > xLoader( m_xFrame, uno::UNO_QUERY ); - if ( !xLoader.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "can not get ComponentLoader to load URL\n"); - return sal_False; - } - - //create stream for the document - Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccessw")) ), - uno::UNO_QUERY ); - if(!xSimpleFileAccess.is()) - { - debug_fprintf(NSP_LOG_APPEND, "can not create SimpleFileAccess to load URL\n"); - return sal_False; - } - Reference xInputStream = xSimpleFileAccess->openFileRead( m_sURL ); - - if(!xInputStream.is()) - { - debug_fprintf(NSP_LOG_APPEND, "can not create XInputStream for URL\n"); - return sal_False; - } - - // prepare to load document - debug_fprintf(NSP_LOG_APPEND, "try to load document\n"); - Sequence< ::com::sun::star::beans::PropertyValue > setPropValues(3); - setPropValues[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOnly") ); - setPropValues[0].Value <<= sal_True; - setPropValues[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); - setPropValues[1].Value <<= sal_True; - setPropValues[2].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")); - setPropValues[2].Value <<= xInputStream; - /* - setPropValues[ 3 ].Name = "FilterName"; - setPropValues[ 3 ].Value = "Flat XML File";*/ - - debug_fprintf(NSP_LOG_APPEND, "try to load copy of URL from local file %s:%d\n", - ::rtl::OUStringToOString( m_sURL, RTL_TEXTENCODING_ASCII_US ).getStr( ), - m_sURL.getLength() ); - - // load document - Sequence< ::com::sun::star::beans::PropertyValue > setPropValues2(3); - setPropValues2[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ViewOnly") ); - setPropValues2[0].Value <<= sal_True; - setPropValues2[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); - setPropValues2[1].Value <<= sal_True; - setPropValues2[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("AsTemplate") ); - setPropValues2[2].Value <<= sal_False; - m_xComponent = xLoader->loadComponentFromURL( - m_sURL, - m_xFrame->getName(), 0, setPropValues2 ); - - if ( !m_xComponent.is() ) - { - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, Load Componment error\n"); - return sal_False; - } - - // register the closelistener that will prevent closing of the component - Reference< util::XCloseable > xCloseable( m_xFrame, uno::UNO_QUERY ); - if ( xCloseable.is() ) - { - m_pCloseListener = new PluginDocumentClosePreventer(); - m_xCloseListener = Reference< util::XCloseListener >( m_pCloseListener ); - xCloseable->addCloseListener( m_xCloseListener ); - } - - //free the input stream, it is hold by the m_xComponent - xInputStream = Reference(); - - debug_fprintf(NSP_LOG_APPEND, "load document success\n"); - - // create frame::XDispatchHelper and frame::XDispatchProvider - m_xDispatcher = Reference< frame::XDispatchHelper > ( - mxRemoteMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper"))), - uno::UNO_QUERY ); - if(!m_xDispatcher.is()) - { - debug_fprintf(NSP_LOG_APPEND, "m_xDispatcher can not be getten\n"); - return sal_False; - } - m_xDispatchProvider = Reference< frame::XDispatchProvider >(m_xFrame, uno::UNO_QUERY); - if(!m_xDispatchProvider.is()) - { - debug_fprintf(NSP_LOG_APPEND, "m_xDispatchProvider can not be getten\n"); - return sal_False; - } - - //try to enable toolbar and tool windows - Sequence< ::com::sun::star::beans::PropertyValue > propertyValue(1); - propertyValue[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FunctionBarVisible") ); - propertyValue[0].Value <<= sal_True; - m_xDispatcher->executeDispatch(m_xDispatchProvider, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FunctionBarVisible")), - m_xFrame->getName(), 0, - propertyValue ); - - // reset window style of parent window -#ifdef WNT - m_dParentStyl = ::NSP_ResetWinStyl (m_hParent); -#endif - m_bInit = sal_True; - - try - { - // in case of presentation try to set the mode of slide-show, and start it - uno::Reference< presentation::XPresentationSupplier > xPresSuppl( m_xComponent, uno::UNO_QUERY_THROW ); - uno::Reference< presentation::XPresentation > xPres( xPresSuppl->getPresentation(), uno::UNO_SET_THROW ); - uno::Reference< beans::XPropertySet > xProps( xPresSuppl->getPresentation(), uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ), uno::makeAny( sal_False ) ); - xPres->start(); - } - catch( uno::Exception& ) - {} - } - catch( uno::Exception& e ) - { - debug_fprintf(NSP_LOG_APPEND, "Unknown exception while loading document in netscape plugin windows\n"); - OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); - debug_fprintf(NSP_LOG_APPEND, "error: %s \n", o.pData->buffer ); - return sal_False; - } - return sal_True; -} - -sal_Bool SoPluginInstance::SetWindow(NSP_HWND hParent, int x, int y, int w, int h) -{ - sal_Bool bRetval(sal_True); - - if ( m_hParent && !hParent ) - { - // the plugin instance has the parent window set already and now it becomes NULL as parent window - // that means that the instance should be closed - Destroy(); - m_hParent = hParent; - } - else - { - m_hParent = hParent; - - debug_fprintf(NSP_LOG_APPEND, "SoPluginInstance::SetWindow %s : %d\n", - ::rtl::OUStringToOString(m_sURL, RTL_TEXTENCODING_ASCII_US).getStr(), - m_sURL.getLength() ); - m_nWidth = w; - m_nHeight =h; - m_nX = x; - m_nY = y; - - if (0 == m_sURL.getLength()) - return sal_True; - - if(!mxRemoteMSF.is()) - { - debug_fprintf(NSP_LOG_APPEND, "Remote StarOfiice ServiceManager is not initilzed correctly!\n"); - return sal_False; - } - debug_fprintf(NSP_LOG_APPEND, "in SoPluginInstance::SetWindow, begin LoadDocument(hParent)\n"); - bRetval = LoadDocument(hParent); // Load document into current window - if(!bRetval){ - // try to reload document again - debug_fprintf(NSP_LOG_APPEND, "load document error, try to reload it once again\n"); - mxRemoteMSF = Reference< XMultiServiceFactory >(); - m_bInit = sal_False; - bRetval = LoadDocument(hParent); - debug_fprintf(NSP_LOG_APPEND, "load document again, return %d\n", bRetval); - } - } - - return bRetval; -} - -sal_Bool SoPluginInstance::Destroy(void) -{ -#ifdef WNT - if(m_dParentStyl != 0) - NSP_RestoreWinStyl(m_hParent, m_dParentStyl); -#endif - - uno::Reference< util::XCloseable > xCloseable( m_xFrame, uno::UNO_QUERY ); - - try - { - if ( m_xCloseListener.is() ) - { - if ( m_pCloseListener ) - m_pCloseListener->StopPreventClose(); - - if ( xCloseable.is() ) - xCloseable->removeCloseListener( m_xCloseListener ); - } - } - catch( uno::Exception& ) - {} - - try - { - uno::Sequence< uno::Any > aArgs( 1 ); - aArgs[0] <<= m_xFrame; - uno::Reference< lang::XComponent > xDocumentCloser( - mxRemoteMSF->createInstanceWithArguments( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.DocumentCloser" ) ), - aArgs ), - uno::UNO_QUERY_THROW ); - - xDocumentCloser->dispose(); // this call should close the document - } - catch( uno::Exception& ) - { - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin.exe, could not close the document correctly!\n"); - try - { - if ( xCloseable.is() ) - xCloseable->close( sal_True ); - else - { - uno::Reference< lang::XComponent > xDisposable( m_xFrame, uno::UNO_QUERY ); - if ( xDisposable.is() ) - xDisposable->dispose(); - } - } - catch (const uno::Exception&) - { - } - } - - m_xUnoWin = Reference< awt::XWindow >(); - m_xComponent = Reference< XComponent >(); - m_xFrame = Reference< frame::XFrame >(); - m_xFrames = Reference< frame::XFrames >(); - m_xDispatcher = Reference< frame::XDispatchHelper >(); - m_xDispatchProvider = Reference< frame::XDispatchProvider >(); - return sal_True; -} - -sal_Bool SoPluginInstance::Print(void) -{ - if(!m_xDispatcher.is()) - return sal_False; - - Sequence< ::com::sun::star::beans::PropertyValue > propertyValue(1); - m_xDispatcher->executeDispatch(m_xDispatchProvider, - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:PrintDefault")), - m_xFrame->getName(), 0, - propertyValue ); - return sal_True; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_instance.hxx b/extensions/source/nsplugin/source/so_instance.hxx deleted file mode 100644 index 07b73ba8c..000000000 --- a/extensions/source/nsplugin/source/so_instance.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __SO_INSTANCE_HXX__ -#define __SO_INSTANCE_HXX__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ns_debug.hxx" - -typedef sal_Int32 NSP_HWND; - -class PluginDocumentClosePreventer; -class SoPluginInstance -{ - -private: - // Service manager of remote Soffice - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxRemoteMSF; - // Dir where Soffice is in, ie. /Soffice7/program - static char sSO_Dir[NPP_PATH_MAX]; - int m_nWidth; - int m_nHeight; - int m_nX; - int m_nY; - sal_Int16 m_nFlag; // Set to 12 during initialization - ::rtl::OUString m_sURL; // URL of the document to be loaded - sal_Bool m_bInit; // If the Plugin instance is initilaized. - NSP_HWND m_hParent; // Windows handle of parent window - long m_pParent; // ID of this instance - get from NPP - // StarOffice window - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xUnoWin; - // StarOffice component window - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent; - // StarOffice frame for this Plugin - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - // Frames of StarOffice - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrames > m_xFrames; - // Dispatcher of frame - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchHelper > m_xDispatcher; - // DispatchProvider of frame - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; - - // the closelistener that will prevent document closing - PluginDocumentClosePreventer* m_pCloseListener; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener > m_xCloseListener; - - sal_Bool LoadDocument(NSP_HWND hParent); - - long m_dParentStyl; // Old Windows style of parent window - - -public: - SoPluginInstance(long iInstance, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF); - virtual ~SoPluginInstance(void); - virtual sal_Bool SetURL(char* aURL); - virtual sal_Bool IsInit(void){return m_bInit;}; - virtual sal_Bool SetWindow(NSP_HWND hParent, int x, int y, int w, int h) ; - virtual sal_Bool Destroy(void) ; - virtual sal_Bool Print(void) ; - - static sal_Bool ShutDown(void); - static char* GetSODir(void) {return sSO_Dir;}; - long GetParent(void) {return m_pParent;}; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_main.cxx b/extensions/source/nsplugin/source/so_main.cxx deleted file mode 100644 index 8df760da9..000000000 --- a/extensions/source/nsplugin/source/so_main.cxx +++ /dev/null @@ -1,499 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#ifdef UNIX -#include -#include -#include -#include -#include -#endif //end of UNIX - -#ifdef WNT -#ifdef _MSC_VER -#pragma once -#endif -#pragma warning (push,1) -#pragma warning (disable:4668) -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#pragma warning (pop) -#endif //end of WNT - -#include -#include -#include -#include -#include "boost/scoped_array.hpp" - -#include "ns_debug.hxx" -#include "so_msg.hxx" -#include "so_instance.hxx" -#include "so_env.hxx" - -#include "nsp_func.hxx" - -#include "sal/main.h" -#include - -#include "rtl/process.h" -#include "rtl/bootstrap.hxx" -#include "rtl/string.hxx" -#include "rtl/ustrbuf.hxx" - -#include "osl/security.hxx" -#include "osl/thread.hxx" - -#include "cppuhelper/bootstrap.hxx" - - - -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/bridge/UnoUrlResolver.hpp" -#include "com/sun/star/bridge/XUnoUrlResolver.hpp" - -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - -using namespace ::rtl; -using namespace ::osl; -using namespace ::cppu; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -#define MAX_NODE_NUM 1024 - -SoPluginInstance* lpInstance[MAX_NODE_NUM]; - -static NSP_PIPE_FD la_read_fd = 0; -static char const * progdir = NULL; - - -long int NSP_ReadFromPipe(NSP_PIPE_FD fp, void* buf, unsigned long int len) -{ - unsigned long int len_unix = 0, len_wnt = 0; - - len_unix = NSP_Read_Pipe(fp, buf, len, &len_wnt); -#ifdef UNIX - (void)len_wnt; - return len_unix; -#endif //end of UNIX -#ifdef WNT - return len_wnt; -#endif //end of WNT - -} - -int find_free_node() -{ - for(int i=0; iGetParent()) - return i; - } - return -1; -} - -sal_Bool dump_plugin_message(PLUGIN_MSG* pMsg) -{ - if (!pMsg) - return sal_False; - debug_fprintf(NSP_LOG_APPEND, "NSPlugin Message: msg_id:%d; instance_id:%d;wnd_id:%d;wnd_x:%d;wnd_y:%d;wnd_w:%d;wnd_h:%d; url:%s\n", - pMsg->msg_id, pMsg->instance_id, pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h, pMsg->url); - return sal_True; -} - -int Set_Window(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no]->SetWindow(pMsg->wnd_id, - pMsg->wnd_x, pMsg->wnd_y, pMsg->wnd_w, pMsg->wnd_h)) - return 0; - else - return -1; -} - -int Set_URL(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no]->SetURL(pMsg->url)) - return 0; - else - return -1; -} - -int New_Instance(PLUGIN_MSG* pMsg, Reference< lang::XMultiServiceFactory > xMSF) -{ - dump_plugin_message(pMsg); - int free_no; - if( -1 == (free_no = find_free_node())) - return -1; - lpInstance[free_no] = new SoPluginInstance(pMsg->instance_id, xMSF); - return 0; -} - -int Destroy(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no] != NULL) - { - lpInstance[cur_no]->Destroy(); - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, begin delete.\n"); - delete(lpInstance[cur_no]); - lpInstance[cur_no] = NULL; - } - return 0; -} - -int Print(PLUGIN_MSG* pMsg) -{ - dump_plugin_message(pMsg); - int cur_no; - if( -1 == (cur_no = find_cur_node(pMsg->instance_id))) - return -1; - if(lpInstance[cur_no] != NULL) - { - lpInstance[cur_no]->Print(); - } - return 0; -} - -int Shutdown() -{ - for(int cur_no=0; cur_noDestroy(); - debug_fprintf(NSP_LOG_APPEND, "print by Nsplugin, begin delete.\n"); - delete(lpInstance[cur_no]); - lpInstance[cur_no] = NULL; - } - return -1; -} - -int dispatchMsg(PLUGIN_MSG* pMsg, Reference< lang::XMultiServiceFactory > xMSF) -{ - switch(pMsg->msg_id) - { - case SO_SET_WINDOW: - return Set_Window(pMsg); - case SO_NEW_INSTANCE: - if(xMSF.is()) - return New_Instance(pMsg, xMSF); - case SO_SET_URL: - return Set_URL(pMsg); - case SO_DESTROY: - return Destroy(pMsg); - case SO_SHUTDOWN: - Shutdown(); - return -1; - case SO_PRINT: - Print(pMsg); - return 0; - default: - return -1; - } -} - -Reference< lang::XMultiServiceFactory > SAL_CALL start_office(NSP_PIPE_FD read_fd) -{ - Reference< XComponentContext > xRemoteContext; - - try - { - OUString aOfficePath; - -#ifdef UNIX - boost::scoped_array< char > exepath( - new char[( progdir ? strlen( progdir ) : 0 ) + RTL_CONSTASCII_LENGTH( "/soffice" ) + 1] ); - if ( progdir ) - sprintf( exepath.get(), "%s/soffice", progdir ); - else - sprintf( exepath.get(), "soffice" ); - if (!rtl_convertStringToUString( - &aOfficePath.pData, exepath.get(), strlen(exepath.get()), osl_getThreadTextEncoding(), - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) - { - debug_fprintf(NSP_LOG_APPEND,"bad characters in soffice installation path!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif //end of UNIX -#ifdef WNT - char sPath[NPP_PATH_MAX]; - sPath[0] = 0; - - // The quotes will be added in osl_executeProcess - sprintf(sPath, "%s", findSofficeExecutable() ); - if (!rtl_convertStringToUString( - &aOfficePath.pData, sPath, strlen(sPath), osl_getThreadTextEncoding(), - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) - { - debug_fprintf(NSP_LOG_APPEND,"bad characters in soffice installation path!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif //end of WNT - - // create default local component context - Reference< XComponentContext > xLocalContext( - defaultBootstrap_InitialComponentContext() ); - if ( !xLocalContext.is() ) - { - debug_fprintf(NSP_LOG_APPEND,"no local component context!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - - // env string - ::rtl::OUStringBuffer buf; - OUString aIniPath, aPluginPipeName; - - if(!Bootstrap::get(OUSTR("BRAND_BASE_DIR"), aIniPath)) - { - debug_fprintf(NSP_LOG_APPEND,"failed to get BRAND_BASE_DIR!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - aIniPath += OUSTR("/program/"); - aIniPath += OUSTR(SAL_CONFIGFILE("bootstrap")); - Bootstrap aVersionFile(aIniPath); - aVersionFile.getFrom(OUSTR("BaseInstallation"), aPluginPipeName, OUString()); - - aPluginPipeName = ::rtl::OUString::valueOf( aPluginPipeName.hashCode() ); - - // accept string - OSL_ASSERT( buf.getLength() == 0 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "-accept=pipe,name=" ) ); - buf.append( aPluginPipeName ); //user installation path as pipe name - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ";urp;" ) ); - OUString sConnectStartString( buf.makeStringAndClear() ); - - // arguments - OUString args [] = { - OUSTR( "-nologo" ), - OUSTR( "-nodefault" ), - OUSTR( "-nolockcheck" ), - sConnectStartString, - }; - - // create a URL resolver - Reference< bridge::XUnoUrlResolver > xUrlResolver( - bridge::UnoUrlResolver::create( xLocalContext ) ); - - // connection string - OSL_ASSERT( buf.getLength() == 0 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "uno:pipe,name=" ) ); - buf.append( aPluginPipeName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( - ";urp;StarOffice.ComponentContext" ) ); - OUString sConnectString( buf.makeStringAndClear() ); - - try - { - // try to connect to office, no need to start instance again if office already started - xRemoteContext.set( - xUrlResolver->resolve( sConnectString ), UNO_QUERY_THROW ); - debug_fprintf(NSP_LOG_APPEND, "Staroffice already start\n"); - return Reference< lang::XMultiServiceFactory >(xRemoteContext->getServiceManager(), UNO_QUERY); - } - catch ( connection::NoConnectException & ) - { - } - - // start office process -#ifdef UNIX - // a temporary solution - // in future the process should be started using the osl_executeProcess call - int nChildPID = fork(); - if( ! nChildPID ) // child process - { - NSP_Close_Pipe(read_fd); - execl( "/bin/sh", - "/bin/sh", - ::rtl::OUStringToOString( aOfficePath, osl_getThreadTextEncoding() ).getStr(), - ::rtl::OUStringToOString( args[0], osl_getThreadTextEncoding() ).getStr(), - ::rtl::OUStringToOString( args[1], osl_getThreadTextEncoding() ).getStr(), - ::rtl::OUStringToOString( args[2], osl_getThreadTextEncoding() ).getStr(), - ::rtl::OUStringToOString( args[3], osl_getThreadTextEncoding() ).getStr(), - NULL); - _exit(255); - } -#else - (void) read_fd; /* avoid warning about unused parameter */ - Security sec; - oslProcess hProcess = 0; - rtl_uString * ar_args [] = { - args[ 0 ].pData, - args[ 1 ].pData, - args[ 2 ].pData, - args[ 3 ].pData, - }; - - oslProcessError rc = osl_executeProcess( - aOfficePath.pData, - ar_args, - SAL_N_ELEMENTS( ar_args ), - osl_Process_DETACHED, - sec.getHandle(), - 0, // => current working dir - 0, - 0, // => no env vars - &hProcess ); - switch ( rc ) - { - case osl_Process_E_None: - osl_freeProcessHandle( hProcess ); - break; - default: - debug_fprintf(NSP_LOG_APPEND, "unmapped error!\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } -#endif - - // wait until office is started - for ( int i = 0; i < 240 /* stop the connection after 240 * 500ms */; ++i ) - { - try - { - // try to connect to office - xRemoteContext.set( - xUrlResolver->resolve( sConnectString ), UNO_QUERY_THROW ); - return Reference< lang::XMultiServiceFactory >(xRemoteContext->getServiceManager(), UNO_QUERY); - } - catch ( connection::NoConnectException & ) - { - // wait 500 ms, then try to connect again - TimeValue tv = { 0 /* secs */, 500000000 /* nanosecs */ }; - ::osl::Thread::wait( tv ); - } - } - debug_fprintf(NSP_LOG_APPEND, "Failed to connect to Staroffice in 2 minutes\n"); - return Reference< lang::XMultiServiceFactory >(NULL); - } - catch ( Exception & e) - { - debug_fprintf(NSP_LOG_APPEND, "unexpected UNO exception caught: "); - debug_fprintf(NSP_LOG_APPEND, (sal_Char *)e.Message.getStr()); - return Reference< lang::XMultiServiceFactory >(NULL); - } - -} - - -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - // Sleep(20*1000); - debug_fprintf(NSP_LOG_APPEND, "start of main\n"); - memset(lpInstance, 0, sizeof(lpInstance)); - - // MessageBox( NULL, "nsplugin has been started", "Info", MB_OK ); - - NSP_PIPE_FD fd_pipe[2]; - int iPipe[2]; - if(argc < 3) - { - debug_fprintf(NSP_LOG_APPEND, "print by nsplugin, command error; too little argument to start plugin exec\n"); - return EXIT_FAILURE; - } - iPipe[0] = atoi(argv[1]); - iPipe[1] = atoi(argv[2]); - - // fd_pipe[0]: read, fd_pipe[0]: write - fd_pipe[0] = (NSP_PIPE_FD) iPipe[0] ; - fd_pipe[1] = (NSP_PIPE_FD) iPipe[1] ; - NSP_Close_Pipe(fd_pipe[1]); - - la_read_fd = fd_pipe[0]; - if(la_read_fd < 0) - { - debug_fprintf(NSP_LOG_APPEND, "print by nsplugin, command error: bad read file id:%s \n", la_read_fd); - return 0; - } - - // the program path is provided only on unix, on windows the registry entry is used - if ( argc > 4 ) - progdir = argv[4]; - - Reference< lang::XMultiServiceFactory > xFactory = start_office(la_read_fd); - if(!xFactory.is()) - { - NSP_Close_Pipe(la_read_fd); - return -1; - } - PLUGIN_MSG nMsg; - int len; - while(1) - { - memset(&nMsg, 0, sizeof(PLUGIN_MSG)); - len = NSP_ReadFromPipe(la_read_fd, (char*)&nMsg, sizeof(PLUGIN_MSG)); - if(len != sizeof(PLUGIN_MSG)) - break; - debug_fprintf(NSP_LOG_APPEND, "Read message from pipe type %d \n", nMsg.msg_id); - if(-1 == dispatchMsg(&nMsg, xFactory)) - { - debug_fprintf(NSP_LOG_APPEND, "plugin will shutdown\n"); - break; - } - } - NSP_Close_Pipe(la_read_fd); - _exit(0); - return EXIT_SUCCESS; // avoid warnings -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/nsplugin/source/so_msg.hxx b/extensions/source/nsplugin/source/so_msg.hxx deleted file mode 100644 index 162bb40f0..000000000 --- a/extensions/source/nsplugin/source/so_msg.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __PLUGIN_MSG_HXX -#define __PLUGIN_MSG_HXX -enum msg_type -{ - SO_EMPTY, // 0 - SO_SET_WINDOW, // 1 - SO_SET_URL, // 2 - SO_NEW_INSTANCE, // 3 - SO_DESTROY, // 4 - SO_SHUTDOWN, // 5 - SO_PRINT // 6 -}; - -#define plugin_Int32 unsigned long int - -typedef struct _PLUGIN_MSG { - plugin_Int32 msg_id; - plugin_Int32 instance_id; - plugin_Int32 wnd_id; - plugin_Int32 wnd_x; - plugin_Int32 wnd_y; - plugin_Int32 wnd_w; - plugin_Int32 wnd_h; - char url[484]; -} PLUGIN_MSG; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/comifaces.hxx b/extensions/source/ole/comifaces.hxx deleted file mode 100644 index d33f350b8..000000000 --- a/extensions/source/ole/comifaces.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __COMIFACES_HXX -#define __COMIFACES_HXX - -#include - -using namespace com::sun::star::uno; - -#ifdef __MINGW32__ -DEFINE_GUID(IID_IJScriptValueObject, 0xe40a2331, 0x3bc1, 0x11d4, 0x83, 0x21, 0x00, 0x50, 0x04, 0x52, 0x6a, 0xb4); -DEFINE_GUID(IID_IUnoObjectWrapper, 0x7B5C3410, 0x66FA, 0x11d4, 0x83, 0x2A, 0x00, 0x50, 0x04, 0x52, 0x6A, 0xB4); -DEFINE_GUID(IID_IUnoTypeWrapper, 0x8BB66591, 0xA544, 0x4de9, 0x82, 0x2C, 0x57, 0xAB, 0x57, 0xBC, 0xED, 0x1C); -#endif -MIDL_INTERFACE("e40a2331-3bc1-11d4-8321-005004526ab4") -IJScriptValueObject: public IUnknown -{ - STDMETHOD( Set)( VARIANT type, VARIANT value)= 0; - STDMETHOD( Get)( VARIANT *val)= 0; - STDMETHOD( InitOutParam)()= 0; - STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value)= 0; - STDMETHOD( IsOutParam)( VARIANT_BOOL * flag)= 0; - STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag)= 0; - STDMETHOD( GetValue)( BSTR* type, VARIANT *value)= 0; - -}; - -MIDL_INTERFACE("7B5C3410-66FA-11d4-832A-005004526AB4") -IUnoObjectWrapper: public IUnknown -{ - STDMETHOD( getWrapperXInterface)( Reference* pInt)=0; - STDMETHOD( getOriginalUnoObject)( Reference* pInt)=0; - STDMETHOD( getOriginalUnoStruct)( Any * pStruct)=0; - -}; - -MIDL_INTERFACE("8BB66591-A544-4de9-822C-57AB57BCED1C") -IUnoTypeWrapper: public IUnknown -{ - STDMETHOD(put_Name)(BSTR val) = 0; - STDMETHOD(get_Name)(BSTR* pVal) = 0; -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/jscriptclasses.cxx b/extensions/source/ole/jscriptclasses.cxx deleted file mode 100644 index 5b5083a0c..000000000 --- a/extensions/source/ole/jscriptclasses.cxx +++ /dev/null @@ -1,324 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "jscriptclasses.hxx" - -//======================================================================== -// JScriptValue -//======================================================================== -JScriptValue::JScriptValue(): m_bOutParam(0), m_bInOutParam(0) -{ -} - -JScriptValue::~JScriptValue() -{ -} - - -// JScriptValue, IDispatch -------------------------------------------- -STDMETHODIMP JScriptValue::GetTypeInfoCount(UINT* /*pctinfo*/) -{ - return E_NOTIMPL; -} - -// JScriptValue, IDispatch -------------------------------------------- -STDMETHODIMP JScriptValue::GetTypeInfo( UINT /*iTInfo*/, - LCID /*lcid*/, - ITypeInfo** /*ppTInfo*/) -{ - return E_NOTIMPL; -} - -// JScriptValue, IDispatch -------------------------------------------- -STDMETHODIMP JScriptValue::GetIDsOfNames( REFIID /*riid*/, - LPOLESTR *rgszNames, - UINT /*cNames*/, - LCID /*lcid*/, - DISPID *rgDispId) -{ - if( !rgDispId) - return E_POINTER; - - - HRESULT ret= S_OK; - CComBSTR name(*rgszNames); - name.ToLower(); - - if( name == CComBSTR( L"set") ) - *rgDispId= 1; - else if( name == CComBSTR( L"get") ) - *rgDispId= 2; - else if( name == CComBSTR( L"initoutparam") ) - *rgDispId= 3; - else if( name == CComBSTR( L"initinoutparam") ) - *rgDispId= 4; - else - ret= DISP_E_UNKNOWNNAME; - - return ret; -} - -// JScriptValue, IDispatch -------------------------------------------- -STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember, - REFIID /*riid*/, - LCID /*lcid*/, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO* /*pExcepInfo*/, - UINT* /*puArgErr*/) -{ - if( pDispParams->cNamedArgs) - return DISP_E_NONAMEDARGS; - - - HRESULT ret= S_OK; - switch( dispIdMember) - { - case 0: // DISPID_VALUE - if( wFlags & DISPATCH_PROPERTYGET && pVarResult) - { - if( FAILED( VariantCopy( pVarResult, &m_varValue))) - ret= E_FAIL; - } - else - ret= E_POINTER; - break; - case 1: - if( wFlags & DISPATCH_METHOD) - ret= Set( pDispParams->rgvarg[1], pDispParams->rgvarg[0]); - if( FAILED( ret)) - ret= DISP_E_EXCEPTION; - break; - case 2: - if( wFlags & DISPATCH_METHOD) - ret= Get( pVarResult); - if( FAILED( ret)) - ret= DISP_E_EXCEPTION; - break; - case 3: - if( wFlags & DISPATCH_METHOD) - ret= InitOutParam(); - if( FAILED( ret)) - ret= DISP_E_EXCEPTION; - break; - case 4: - if( wFlags & DISPATCH_METHOD) - ret= InitInOutParam( pDispParams->rgvarg[1], pDispParams->rgvarg[0]); - if( FAILED( ret)) - ret= DISP_E_EXCEPTION; - break; - default: - ret= DISP_E_MEMBERNOTFOUND; - break; - } - - return ret; -} - -// JScriptValue, IScriptOutParam----------------------- -STDMETHODIMP JScriptValue::Set( VARIANT type, VARIANT value) -{ - Lock(); - HRESULT hr= S_OK; - m_varValue.Clear(); - hr= VariantCopyInd( &m_varValue, &value); - VARIANT var; - VariantInit( &var); - if( SUCCEEDED( hr= VariantChangeType( &var, &type, 0, VT_BSTR))) - m_bstrType= var.bstrVal; - Unlock(); - return hr; -} -// JScriptValue, IScriptOutParam----------------------- -STDMETHODIMP JScriptValue::Get( VARIANT *val) -{ - Lock(); - if( !val) - return E_POINTER; - HRESULT hr= VariantCopy( val, &m_varValue); - Unlock(); - return hr; -} - -STDMETHODIMP JScriptValue::InitOutParam() -{ - Lock(); - m_varValue.Clear(); - m_bOutParam= true; - m_bInOutParam= false; - Unlock(); - return S_OK; -} - -STDMETHODIMP JScriptValue::InitInOutParam( VARIANT type, VARIANT value) -{ - Lock(); - m_bInOutParam= true; - m_bOutParam= false; - Unlock(); - return Set( type, value); -} - -STDMETHODIMP JScriptValue::IsOutParam( VARIANT_BOOL * flag) -{ - Lock(); - if( !flag) - return E_POINTER; - *flag= m_bOutParam ? VARIANT_TRUE : VARIANT_FALSE; - Unlock(); - return S_OK; -} - -STDMETHODIMP JScriptValue::IsInOutParam( VARIANT_BOOL * flag) -{ - Lock(); - if( !flag) - return E_POINTER; - *flag= m_bInOutParam ? VARIANT_TRUE : VARIANT_FALSE; - Unlock(); - return S_OK; -} - -STDMETHODIMP JScriptValue::GetValue( BSTR* type, VARIANT *value) -{ - Lock(); - if( !type || !value) - return E_POINTER; - HRESULT hr; - if( SUCCEEDED( hr= m_bstrType.CopyTo( type))) - hr= VariantCopy( value, &m_varValue); - Unlock(); - return hr; -} - -//########################################################################################## -// JScriptOutValue -//########################################################################################## - -JScriptOutParam::JScriptOutParam() -{ -} - -JScriptOutParam::~JScriptOutParam() -{ -} - - -// JScriptOutParam, IDispatch -------------------------------------------- -STDMETHODIMP JScriptOutParam::GetTypeInfoCount(UINT* /*pctinfo*/) -{ - return E_NOTIMPL; -} - -// JScriptOutParam, IDispatch -------------------------------------------- -STDMETHODIMP JScriptOutParam::GetTypeInfo( UINT /*iTInfo*/, - LCID /*lcid*/, - ITypeInfo** /*ppTInfo*/) -{ - return E_NOTIMPL; -} - -// JScriptOutParam, IDispatch -------------------------------------------- -STDMETHODIMP JScriptOutParam::GetIDsOfNames( REFIID /*riid*/, - LPOLESTR *rgszNames, - UINT /*cNames*/, - LCID /*lcid*/, - DISPID *rgDispId) -{ - if( !rgDispId) - return E_POINTER; - - - HRESULT ret= S_OK; - CComBSTR name(*rgszNames); - name.ToLower(); - - if( name == CComBSTR( L"0") ) - *rgDispId= 1; - else - ret= DISP_E_UNKNOWNNAME; - - return ret; -} - -// JScriptOutParam, IDispatch -------------------------------------------- -STDMETHODIMP JScriptOutParam::Invoke( DISPID dispIdMember, - REFIID /*riid*/, - LCID /*lcid*/, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO* /*pExcepInfo*/, - UINT* /*puArgErr*/) -{ - HRESULT ret= S_OK; - switch( dispIdMember) - { - case 0: // DISPID_VALUE - if( wFlags & DISPATCH_PROPERTYGET && pVarResult) - { - if( FAILED( VariantCopy( pVarResult, &m_varValue))) - ret= E_FAIL; - } - else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF) - { - m_varValue.Clear(); - if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0]))) - ret= E_FAIL; - } - else - ret= E_POINTER; - break; - case 1: // - if( wFlags & DISPATCH_PROPERTYGET && pVarResult) - { - if( FAILED( VariantCopy( pVarResult, &m_varValue))) - ret= E_FAIL; - } - else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF) - { - m_varValue.Clear(); - if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0]))) - ret= E_FAIL; - } - else - ret= E_POINTER; - break; - - default: - ret= DISP_E_MEMBERNOTFOUND; - break; - } - - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/jscriptclasses.hxx b/extensions/source/ole/jscriptclasses.hxx deleted file mode 100644 index f19898e39..000000000 --- a/extensions/source/ole/jscriptclasses.hxx +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __JSCRIPTCLASSES_HXX -#define __JSCRIPTCLASSES_HXX - - -#pragma warning (push,1) -#pragma warning (disable:4548) - -#include -#define STRICT -#define _WIN32_WINNT 0x0403 -#define _WIN32_DCOM -#if OSL_DEBUG_LEVEL > 0 -//#define _ATL_DEBUG_INTERFACES -#endif -#include -extern CComModule _Module; -#include - -#pragma warning (pop) -#pragma warning (disable:4505) - // disable "unreferenced local function has been removed" globally - -#include "comifaces.hxx" - - - -// Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc. - -// To make a JScriptValue object to an out parameter, call -// "InitOutParam" and to make it a in/out parameter call -// "InitInOutParam" - -// If the object represents an out parameter then the value can after the call -// be retrived by "Get". - -// From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are -// used, that is they are accessible through IDispatch. The functions are used -// by the bridge. - -class JScriptValue: - public CComObjectRootEx, - public IJScriptValueObject, - public IDispatch -{ -public: - JScriptValue(); - virtual ~JScriptValue(); - - BEGIN_COM_MAP(JScriptValue) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IJScriptValueObject) - END_COM_MAP() - - // IDispatch ------------------------------------------- - STDMETHOD( GetTypeInfoCount)(UINT *pctinfo); - - STDMETHOD( GetTypeInfo)( UINT iTInfo, - LCID lcid, - ITypeInfo **ppTInfo); - - STDMETHOD( GetIDsOfNames)( REFIID riid, - LPOLESTR *rgszNames, - UINT cNames, - LCID lcid, - DISPID *rgDispId); - - STDMETHOD( Invoke)( DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO *pExcepInfo, - UINT *puArgErr); - // IJScriptOutParam -------------------------------------- - - STDMETHOD( Set)( VARIANT type, VARIANT value); - STDMETHOD( Get)( VARIANT *val); - STDMETHOD( InitOutParam)(); - STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value); - STDMETHOD( IsOutParam)( VARIANT_BOOL * flag); - STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag); - STDMETHOD( GetValue)( BSTR* type, VARIANT *value); - - - CComVariant m_varValue; - CComBSTR m_bstrType; - unsigned m_bOutParam: 1; - unsigned m_bInOutParam: 1; - -}; - -// If a class is implemented in JScript, then its method -class JScriptOutParam: - public CComObjectRootEx, - public IDispatch -{ -public: - JScriptOutParam(); - virtual ~JScriptOutParam(); - - BEGIN_COM_MAP(JScriptOutParam) - COM_INTERFACE_ENTRY(IDispatch) - END_COM_MAP() - - // IDispatch ------------------------------------------- - STDMETHOD( GetTypeInfoCount)(UINT *pctinfo); - - STDMETHOD( GetTypeInfo)( UINT iTInfo, - LCID lcid, - ITypeInfo **ppTInfo); - - STDMETHOD( GetIDsOfNames)( REFIID riid, - LPOLESTR *rgszNames, - UINT cNames, - LCID lcid, - DISPID *rgDispId); - - STDMETHOD( Invoke)( DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO *pExcepInfo, - UINT *puArgErr); - - -private: - CComVariant m_varValue; -}; - -#include - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/makefile.mk b/extensions/source/ole/makefile.mk deleted file mode 100644 index a9ff68118..000000000 --- a/extensions/source/ole/makefile.mk +++ /dev/null @@ -1,132 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -# ----------------------------------------------------------------- - -PRJNAME=extensions -TARGET=oleautobridge.uno -TARGET2=oleautobridge2.uno - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -LIBTARGET=NO -USE_DEFFILE=YES - -USE_DEFFILE=TRUE - -INCPRE+= $(foreach,i,$(ATL_INCLUDE) -I$(i)) - -# --- Settings ----------------------------------------------------- - -.IF "$(GUI)" == "WNT" && "$(DISABLE_ATL)"=="" - -.IF "$(USE_DEBUG_RUNTIME)"!="" -CDEFS+=-D_DEBUG -.ENDIF # "$(USE_DEBUG_RUNTIME)"!="" - -SLOFILES= \ - $(SLO)$/servreg.obj \ - $(SLO)$/servprov.obj \ - $(SLO)$/unoobjw.obj \ - $(SLO)$/oleobjw.obj \ - $(SLO)$/olethread.obj \ - $(SLO)$/oledll.obj \ - $(SLO)$/jscriptclasses.obj \ - $(SLO)$/ole2uno.obj \ - $(SLO)$/windata.obj \ - $(SLO)$/unotypewrapper.obj - -SECOND_BUILD=OWNGUID -OWNGUID_SLOFILES=$(SLOFILES) -OWNGUIDCDEFS+= -DOWNGUID - -# the original library -SHL1TARGET=$(TARGET) -SHL1STDLIBS=\ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(OLE32LIB) \ - $(UUIDLIB) \ - $(ADVAPI32LIB) \ - $(OLEAUT32LIB) - -.IF "$(COM)"=="MSC" -.IF "$(USE_DEBUG_RUNTIME)" != "" - SHL1STDLIBS+= $(ATL_LIB)$/atlsd.lib -.ELSE - SHL1STDLIBS+= $(ATL_LIB)$/atls.lib -.ENDIF -.ENDIF # "$(COM)"=="MSC" - -SHL1LIBS= -SHL1OBJS=$(SLOFILES) - -DEF1NAME=$(SHL1TARGET) -DEF1EXPORTFILE=$(SHL1TARGET).dxp - -# the second library -SHL2TARGET=$(TARGET2) -SHL2STDLIBS=\ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(OLE32LIB) \ - $(UUIDLIB) \ - $(ADVAPI32LIB) \ - $(OLEAUT32LIB) - -.IF "$(COM)"=="MSC" -.IF "$(USE_DEBUG_RUNTIME)" != "" - SHL2STDLIBS+= $(ATL_LIB)$/atlsd.lib -.ELSE - SHL2STDLIBS+= $(ATL_LIB)$/atls.lib -.ENDIF -.ENDIF # "$(COM)"=="MSC" - -SHL2LIBS= -SHL2OBJS=$(REAL_OWNGUID_SLOFILES) - -DEF2NAME=$(SHL2TARGET) -DEF2EXPORTFILE=$(TARGET).dxp - -.ENDIF # "$(GUI)" == "WNT" && "$(DISABLE_ATL)"=="" - -#---------------------------------------------------------------- - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/oleautobridge.component - -$(MISC)/oleautobridge.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt oleautobridge.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oleautobridge.component diff --git a/extensions/source/ole/ole2uno.cxx b/extensions/source/ole/ole2uno.cxx deleted file mode 100644 index 741634e07..000000000 --- a/extensions/source/ole/ole2uno.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "osl/getglobalmutex.hxx" -#include "rtl/instance.hxx" -#include "ole2uno.hxx" - -using namespace osl; -namespace ole_adapter -{ - -struct MutexInit -{ - Mutex * operator () () - { - static Mutex aInstance; - return &aInstance; - } -}; - - -Mutex * getBridgeMutex() -{ - return rtl_Instance< Mutex, MutexInit, ::osl::MutexGuard, - ::osl::GetGlobalMutex >::create( - MutexInit(), ::osl::GetGlobalMutex()); -} - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx deleted file mode 100644 index ca902f4e8..000000000 --- a/extensions/source/ole/ole2uno.hxx +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _OLE2UNO_HXX -#define _OLE2UNO_HXX - - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif - -#define _WIN32_DCOM -#if OSL_DEBUG_LEVEL > 0 -//#define _ATL_DEBUG_INTERFACES -#endif - -#pragma warning (push,1) -#pragma warning (disable:4917) -#pragma warning (disable:4005) -#pragma warning (disable:4548) - -#include -#if (_MSC_VER >= 1200) || defined(__MINGW32__) -#include -#endif - -#include -#include -#include - -#pragma warning (pop) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define UNO_2_OLE_EXCEPTIONCODE 1001 -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::script; -using namespace com::sun::star::registry; -using namespace com::sun::star::reflection; -using namespace com::sun::star::beans; -using namespace osl; -using namespace std; - -using ::rtl::OUString; - -namespace ole_adapter -{ - -const VARTYPE getVarType( const Any& val); -/* creates a Type object for a given type name. - - The function returns false if the name does not represent - a valid type. -*/ -bool getType( BSTR name, Type & type); -void o2u_attachCurrentThread(); - -struct equalOUString_Impl -{ - bool operator()(const OUString & s1, const OUString & s2) const - { - return s1 == s2; - } -}; - -struct hashOUString_Impl -{ - size_t operator()(const OUString & rName) const - { - return rName.hashCode(); - } -}; - - -class BridgeRuntimeError -{ -public: - BridgeRuntimeError(const OUString& sMessage) - { - message = sMessage; - } - OUString message; -}; - - -Mutex* getBridgeMutex(); - -} // end namespace - - - -#endif // _OLE2UNO_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/oleautobridge.component b/extensions/source/ole/oleautobridge.component deleted file mode 100644 index 6f5309e42..000000000 --- a/extensions/source/ole/oleautobridge.component +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/ole/oleautobridge.uno.dxp b/extensions/source/ole/oleautobridge.uno.dxp deleted file mode 100644 index 843ff2fc3..000000000 --- a/extensions/source/ole/oleautobridge.uno.dxp +++ /dev/null @@ -1,2 +0,0 @@ -component_getFactory @101 -component_canUnload @103 diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx deleted file mode 100644 index b8f62768d..000000000 --- a/extensions/source/ole/oledll.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#define STRICT -#define _WIN32_WINNT 0x0403 -#define _WIN32_DCOM - -#pragma warning (push,1) -#pragma warning (disable:4548) - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_DEBUG_RUNTIME) -#undef _DEBUG -#endif -#ifdef __MINGW32__ -#define _INIT_ATL_COMMON_VARS -#endif -#include -CComModule _Module; -#include - -#pragma warning (pop) - -BEGIN_OBJECT_MAP(ObjectMap) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, NULL); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - _Module.Term(); - } - return TRUE; // ok -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx deleted file mode 100644 index dbc37ffae..000000000 --- a/extensions/source/ole/oleobjw.cxx +++ /dev/null @@ -1,2644 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "ole2uno.hxx" -#include "rtl/ustrbuf.hxx" - - -#include "osl/diagnose.h" -#include "osl/doublecheckedlocking.h" -#include "osl/thread.h" - -#include "boost/scoped_array.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "com/sun/star/bridge/oleautomation/NamedArgument.hpp" -#include "com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp" - -#include -#include -#include -#include - -#include "jscriptclasses.hxx" - -#include "oleobjw.hxx" -#include "unoobjw.hxx" -#include -using namespace std; -using namespace boost; -using namespace osl; -using namespace cppu; -using namespace com::sun::star::script; -using namespace com::sun::star::lang; -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::oleautomation; -using namespace com::sun::star::bridge::ModelDependent; -using namespace ::com::sun::star; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringBuffer; - -#define JSCRIPT_ID_PROPERTY L"_environment" -#define JSCRIPT_ID L"jscript" -namespace ole_adapter -{ - - -// key: XInterface pointer created by Invocation Adapter Factory -// value: XInterface pointer to the wrapper class. -// Entries to the map are made within -// Any createOleObjectWrapper(IUnknown* pUnknown, const Type& aType); -// Entries are being deleted if the wrapper class's destructor has been -// called. -// Before UNO object is wrapped to COM object this map is checked -// to see if the UNO object is already a wrapper. -boost::unordered_map AdapterToWrapperMap; -// key: XInterface of the wrapper object. -// value: XInterface of the Interface created by the Invocation Adapter Factory. -// A COM wrapper is responsible for removing the corresponding entry -// in AdapterToWrappperMap if it is being destroyed. Because the wrapper does not -// know about its adapted interface it uses WrapperToAdapterMap to get the -// adapted interface which is then used to locate the entry in AdapterToWrapperMap. -boost::unordered_map WrapperToAdapterMap; - -boost::unordered_map > ComPtrToWrapperMap; -/***************************************************************************** - - class implementation IUnknownWrapper_Impl - -*****************************************************************************/ - -IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference& xFactory, - sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass): - UnoConversionUtilities( xFactory, unoWrapperClass, comWrapperClass), - m_pxIdlClass( NULL), m_eJScript( JScriptUndefined), - m_bComTlbIndexInit(false), m_bHasDfltMethod(false), m_bHasDfltProperty(false) -{ -} - - -IUnknownWrapper_Impl::~IUnknownWrapper_Impl() -{ - o2u_attachCurrentThread(); - MutexGuard guard(getBridgeMutex()); - XInterface * xIntRoot = (OWeakObject *)this; -#if OSL_DEBUG_LEVEL > 0 - acquire(); // make sure we don't delete us twice because of Reference - OSL_ASSERT( Reference( static_cast(this), UNO_QUERY).get() == xIntRoot ); -#endif - - // remove entries in global maps - typedef boost::unordered_map::iterator _IT; - _IT it= WrapperToAdapterMap.find( (sal_uInt32) xIntRoot); - if( it != WrapperToAdapterMap.end()) - { - sal_uInt32 adapter= it->second; - - AdapterToWrapperMap.erase( adapter); - WrapperToAdapterMap.erase( it); - } - - IT_Com it_c= ComPtrToWrapperMap.find( (sal_uInt32) m_spUnknown.p); - if(it_c != ComPtrToWrapperMap.end()) - ComPtrToWrapperMap.erase(it_c); - -#if OSL_DEBUG_LEVEL > 0 - fprintf(stderr,"[automation bridge] ComPtrToWrapperMap contains: %i \n", - ComPtrToWrapperMap.size()); -#endif -} - -Any IUnknownWrapper_Impl::queryInterface(const Type& t) - throw (RuntimeException) -{ - if (t == getCppuType(static_cast*>( 0)) && !m_bHasDfltMethod ) - return Any(); - if (t == getCppuType(static_cast*>( 0)) && !m_bHasDfltProperty ) - return Any(); - if ( ( t == getCppuType(static_cast*>( 0)) || t == getCppuType(static_cast*>( 0)) ) && !m_spDispatch) - return Any(); - // XDirectInvocation seems to be an oracle replacement for XAutomationInvocation, however it is flawed esecially wrt. assumptions about whether to invoke a - // Put or Get property, the implementation code has no business guessing that, it's up to the caller to decide that. Worse XDirectInvocation duplicates lots of code. - // XAutomationInvocation provides seperate calls for put& get - // properties. Note: Currently the basic runtime doesn't call put properties directly, it should... after all the basic runtime should know whether it is calling a put or get property. - // For the moment for ease of merging we will let the XDirectInvoke and XAuthomationInvocation interfaces stay side by side ( and for the momemnt at least I would prefer the basic - // runtime to call XAutomationInvocation instead of XDirectInvoke - return WeakImplHelper8::queryInterface(t); -} - -Reference SAL_CALL IUnknownWrapper_Impl::getIntrospection(void) - throw (RuntimeException ) -{ - Reference ret; - - return ret; -} - -Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) -{ - Any aResult; - try - { - o2u_attachCurrentThread(); - ITypeInfo * pInfo = getTypeInfo(); - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc); - if ( !aDescGet ) - { - OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName + - OUSTR("\" is not supported")); - throw UnknownPropertyException(msg, Reference()); - } - aResult = invokeWithDispIdComTlb( aDescGet, aPropertyName, aParams, aOutParamIndex, aOutParam ); - } - catch ( Exception& e ) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::invokeGetProperty ! Message : \n") + - e.Message, Reference()); - } - return aResult; -} - -Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) -{ - Any aResult; - try - { - o2u_attachCurrentThread(); - ITypeInfo * pInfo = getTypeInfo(); - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc); - if ( !aDescPut ) - { - OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName + - OUSTR("\" is not supported")); - throw UnknownPropertyException(msg, Reference()); - } - aResult = invokeWithDispIdComTlb( aDescPut, aPropertyName, aParams, aOutParamIndex, aOutParam ); - } - catch ( Exception& e ) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::invokePutProperty ! Message : \n") + - e.Message, Reference()); - } - return aResult; -} - - -Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName, - const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, - Sequence< Any >& aOutParam ) - throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, - RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - - Any ret; - - try - { - o2u_attachCurrentThread(); - - TypeDescription methodDesc; - getMethodInfo(aFunctionName, methodDesc); - if( methodDesc.is()) - { - ret = invokeWithDispIdUnoTlb(aFunctionName, - aParams, - aOutParamIndex, - aOutParam); - } - else - { - ret= invokeWithDispIdComTlb( aFunctionName, - aParams, - aOutParamIndex, - aOutParam); - } - } - catch (IllegalArgumentException &) - { - throw; - } - catch (CannotConvertException &) - { - throw; - } - catch (InvocationTargetException &) - { - throw; - } - catch (BridgeRuntimeError & e) - { - throw RuntimeException(e.message, Reference()); - } - catch (Exception & e) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::invoke ! Message : \n") + - e.Message, Reference()); - - } - catch(...) - { - throw RuntimeException( - OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::Invoke !"), Reference()); - } - return ret; -} - -void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName, - const Any& aValue ) - throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, - RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - try - { - o2u_attachCurrentThread(); - - ITypeInfo * pInfo = getTypeInfo(); - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc); - //check if there is such a property at all or if it is read only - if ( ! aDescPut && ! aDescGet && ! aVarDesc) - { - OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName + - OUSTR("\" is not supported")); - throw UnknownPropertyException(msg, Reference()); - } - - if ( (! aDescPut && aDescGet) || aVarDesc - && aVarDesc->wVarFlags == VARFLAG_FREADONLY ) - { - //read-only - OUString msg(OUSTR("[automation bridge] Property ") + aPropertyName + - OUSTR(" is read-only")); - OString sMsg = OUStringToOString(msg, osl_getThreadTextEncoding()); - OSL_FAIL(sMsg.getStr()); - // ignore silently - return; - } - - HRESULT hr= S_OK; - DISPPARAMS dispparams; - CComVariant varArg; - CComVariant varRefArg; - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; - - // converting UNO value to OLE variant - DISPID dispidPut= DISPID_PROPERTYPUT; - dispparams.rgdispidNamedArgs = &dispidPut; - dispparams.cArgs = 1; - dispparams.cNamedArgs = 1; - dispparams.rgvarg = & varArg; - - OSL_ASSERT(aDescPut || aVarDesc); - - VARTYPE vt = 0; - DISPID dispid = 0; - INVOKEKIND invkind = INVOKE_PROPERTYPUT; - //determine the expected type, dispid, invoke kind (DISPATCH_PROPERTYPUT, - //DISPATCH_PROPERTYPUTREF) - if (aDescPut) - { - vt = getElementTypeDesc(& aDescPut->lprgelemdescParam[0].tdesc); - dispid = aDescPut->memid; - invkind = aDescPut->invkind; - } - else - { - vt = getElementTypeDesc( & aVarDesc->elemdescVar.tdesc); - dispid = aVarDesc->memid; - if (vt == VT_UNKNOWN || vt == VT_DISPATCH || - (vt & VT_ARRAY) || (vt & VT_BYREF)) - { - invkind = INVOKE_PROPERTYPUTREF; - } - } - - // convert the uno argument - if (vt & VT_BYREF) - { - anyToVariant( & varRefArg, aValue, ::sal::static_int_cast< VARTYPE, int >( vt ^ VT_BYREF ) ); - varArg.vt = vt; - if( (vt & VT_TYPEMASK) == VT_VARIANT) - varArg.byref = & varRefArg; - else if ((vt & VT_TYPEMASK) == VT_DECIMAL) - varArg.byref = & varRefArg.decVal; - else - varArg.byref = & varRefArg.byref; - } - else - { - anyToVariant(& varArg, aValue, vt); - } - // call to IDispatch - hr = m_spDispatch->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, ::sal::static_int_cast< WORD, INVOKEKIND >( invkind ), - &dispparams, & varResult, & excepinfo, &uArgErr); - - // lookup error code - switch (hr) - { - case S_OK: - break; - case DISP_E_BADPARAMCOUNT: - throw RuntimeException(); - break; - case DISP_E_BADVARTYPE: - throw RuntimeException(); - break; - case DISP_E_EXCEPTION: - throw InvocationTargetException(); - break; - case DISP_E_MEMBERNOTFOUND: - throw UnknownPropertyException(); - break; - case DISP_E_NONAMEDARGS: - throw RuntimeException(); - break; - case DISP_E_OVERFLOW: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr); - break; - case DISP_E_PARAMNOTFOUND: - throw IllegalArgumentException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )) ; - break; - case DISP_E_TYPEMISMATCH: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::UNKNOWN, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_UNKNOWNINTERFACE: - throw RuntimeException(); - break; - case DISP_E_UNKNOWNLCID: - throw RuntimeException(); - break; - case DISP_E_PARAMNOTOPTIONAL: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")),static_cast( - static_cast(this)) , TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr); - break; - default: - throw RuntimeException(); - break; - } - } - catch (CannotConvertException &) - { - throw; - } - catch (UnknownPropertyException &) - { - throw; - } - catch (BridgeRuntimeError& e) - { - throw RuntimeException( - e.message, Reference()); - } - catch (Exception & e) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::setValue ! Message : \n") + - e.Message, Reference()); - - } - catch (...) - { - throw RuntimeException( - OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::setValue !"), Reference()); - } -} - -Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName ) - throw(UnknownPropertyException, RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - Any ret; - try - { - o2u_attachCurrentThread(); - ITypeInfo * pInfo = getTypeInfo(); - // I was going to implement an XServiceInfo interface to allow the type - // of the automation object to be exposed.. but it seems - // from looking at comments in the code that it is possible for - // this object to actually wrap an UNO object ( I guess if automation is - // used from MSO to create Openoffice objects ) Therefore, those objects - // will more than likely already have their own XServiceInfo interface. - // Instead here I chose a name that should be illegal both in COM and - // UNO ( from an IDL point of view ) therefore I think this is a safe - // hack - if ( aPropertyName.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$GetTypeName")) )) - { - if ( pInfo && m_sTypeName.getLength() == 0 ) - { - m_sTypeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ); - CComBSTR sName; - - if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) ) - { - rtl::OUString sTmp( reinterpret_cast(LPCOLESTR(sName))); - if ( sTmp.indexOf('_') == 0 ) - sTmp = sTmp.copy(1); - // do we own the memory for pTypeLib, msdn doco is vague - // I'll assume we do - CComPtr< ITypeLib > pTypeLib; - unsigned int index; - if ( SUCCEEDED( pInfo->GetContainingTypeLib( &pTypeLib.p, &index )) ) - { - if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) ) - { - rtl::OUString sLibName( reinterpret_cast(LPCOLESTR(sName))); - m_sTypeName = sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sTmp ); - - } - } - } - - } - ret <<= m_sTypeName; - return ret; - } - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(aPropertyName, & aDescGet, & aDescPut, & aVarDesc); - if ( ! aDescGet && ! aDescPut && ! aVarDesc) - { - //property not found - OUString msg(OUSTR("[automation bridge]Property \"") + aPropertyName + - OUSTR("\" is not supported")); - throw UnknownPropertyException(msg, Reference()); - } - // write-only should not be possible - OSL_ASSERT( aDescGet || ! aDescPut); - - HRESULT hr; - DISPPARAMS dispparams = {0, 0, 0, 0}; - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; - DISPID dispid; - if (aDescGet) - dispid = aDescGet->memid; - else if (aVarDesc) - dispid = aVarDesc->memid; - else - dispid = aDescPut->memid; - - hr = m_spDispatch->Invoke(dispid, - IID_NULL, - LOCALE_USER_DEFAULT, - DISPATCH_PROPERTYGET, - &dispparams, - &varResult, - &excepinfo, - &uArgErr); - - // converting return value and out parameter back to UNO - if (hr == S_OK) - { - // If the com object implements uno interfaces then we have - // to convert the attribute into the expected type. - TypeDescription attrInfo; - getAttributeInfo(aPropertyName, attrInfo); - if( attrInfo.is() ) - variantToAny( &varResult, ret, Type( attrInfo.get()->pWeakRef)); - else - variantToAny(&varResult, ret); - } - - // lookup error code - switch (hr) - { - case S_OK: - break; - case DISP_E_BADPARAMCOUNT: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_BADVARTYPE: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_EXCEPTION: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_MEMBERNOTFOUND: - throw UnknownPropertyException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_NONAMEDARGS: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_OVERFLOW: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_PARAMNOTFOUND: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_TYPEMISMATCH: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_UNKNOWNINTERFACE: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_UNKNOWNLCID: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - case DISP_E_PARAMNOTOPTIONAL: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - default: - throw RuntimeException(OUString(reinterpret_cast(excepinfo.bstrDescription)), - Reference()); - break; - } - } - catch (UnknownPropertyException& ) - { - throw; - } - catch (BridgeRuntimeError& e) - { - throw RuntimeException( - e.message, Reference()); - } - catch (Exception & e) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::getValue ! Message : \n") + - e.Message, Reference()); - } - catch (...) - { - throw RuntimeException( - OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::getValue !"), Reference()); - } - return ret; -} - -sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName ) - throw(RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - sal_Bool ret = sal_False; - - try - { - o2u_attachCurrentThread(); - ITypeInfo* pInfo = getTypeInfo(); - FuncDesc aDesc(pInfo); - getFuncDesc(aName, & aDesc); - // Automation properties can have arguments. Those are treated as methods and - //are called through XInvocation::invoke. - if ( ! aDesc) - { - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc( aName, & aDescGet, & aDescPut, & aVarDesc); - if (aDescGet && aDescGet->cParams > 0 - || aDescPut && aDescPut->cParams > 0) - ret = sal_True; - } - else - ret = sal_True; - } - catch (BridgeRuntimeError& e) - { - throw RuntimeException(e.message, Reference()); - } - catch (Exception & e) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::hasMethod ! Message : \n") + - e.Message, Reference()); - } - catch (...) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::hasMethod !"), Reference());; - } - return ret; -} - -sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName ) - throw(RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException(OUSTR("[automation bridge] The object does not have an " - "IDispatch interface"), Reference()); - return sal_False; - } - sal_Bool ret = sal_False; - try - { - o2u_attachCurrentThread(); - - ITypeInfo * pInfo = getTypeInfo(); - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(aName, & aDescGet, & aDescPut, & aVarDesc); - - // we should probably just check the funckind - // basic has been modified to handle properties ( 'get' ) props at - // least with paramaters - // additionally you can call invoke(Get|Set)Property on the bridge - // you can determine if a property has parameter is hasMethod - // returns true for the name - if (aVarDesc - || aDescPut - || aDescGet ) - { - ret = sal_True; - } - } - catch (BridgeRuntimeError& e) - { - throw RuntimeException(e.message, Reference()); - } - catch (Exception & e) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::hasProperty ! Message : \n") + - e.Message, Reference()); - - } - catch (...) - { - throw RuntimeException(OUSTR("[automation bridge] unexpected exception in " - "IUnknownWrapper_Impl::hasProperty !"), Reference()); - } - return ret; -} - -Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject, - const Sequence< sal_Int8 >& /*aProcessId*/, sal_Int16 sourceModelType, - sal_Int16 destModelType ) - throw( IllegalArgumentException, RuntimeException) -{ - Any ret; - o2u_attachCurrentThread(); - - if ( - (sourceModelType == UNO) && - (destModelType == OLE) && - (modelDepObject.getValueTypeClass() == TypeClass_INTERFACE) - ) - { - Reference xInt( *(XInterface**) modelDepObject.getValue()); - Reference xSelf( (OWeakObject*)this); - - if (xInt == xSelf) - { - VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT)); - - VariantInit(pVariant); - if (m_bOriginalDispatch == sal_True) - { - pVariant->vt = VT_DISPATCH; - pVariant->pdispVal = m_spDispatch; - pVariant->pdispVal->AddRef(); - } - else - { - pVariant->vt = VT_UNKNOWN; - pVariant->punkVal = m_spUnknown; - pVariant->punkVal->AddRef(); - } - - ret.setValue((void*)&pVariant, getCppuType( (sal_uInt32*) 0)); - } - } - - return ret; -} -/** @internal - @exception IllegalArgumentException - @exception CannotConvertException - @exception InvocationTargetException - @RuntimeException -*/ -Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam) -{ - Any ret; - HRESULT hr= S_OK; - - sal_Int32 parameterCount= Params.getLength(); - sal_Int32 outParameterCount= 0; - typelib_InterfaceMethodTypeDescription* pMethod= NULL; - TypeDescription methodDesc; - getMethodInfo(sFunctionName, methodDesc); - - // We need to know whether the IDispatch is from a JScript object. - // Then out and in/out parameters have to be treated differently than - // with common COM objects. - sal_Bool bJScriptObject= isJScriptObject(); - scoped_array sarParams; - scoped_array sarParamsRef; - CComVariant *pVarParams= NULL; - CComVariant *pVarParamsRef= NULL; - sal_Bool bConvRet= sal_True; - - if( methodDesc.is()) - { - pMethod = (typelib_InterfaceMethodTypeDescription* )methodDesc.get(); - parameterCount = pMethod->nParams; - // Create the Array for the array being passed in DISPPARAMS - // the array also contains the outparameter (but not the values) - if( pMethod->nParams > 0) - { - sarParams.reset(new CComVariant[ parameterCount]); - pVarParams = sarParams.get(); - } - - // Create the Array for the out an in/out parameter. These values - // are referenced by the VT_BYREF VARIANTs in DISPPARAMS. - // We need to find out the number of out and in/out parameter. - for( sal_Int32 i=0; i < parameterCount; i++) - { - if( pMethod->pParams[i].bOut) - outParameterCount++; - } - - if( !bJScriptObject) - { - sarParamsRef.reset(new CComVariant[outParameterCount]); - pVarParamsRef = sarParamsRef.get(); - // build up the parameters for IDispatch::Invoke - sal_Int32 outParamIndex=0; - int i = 0; - try - { - for( i= 0; i < parameterCount; i++) - { - // In parameter - if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut) - { - anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]); - } - // Out parameter + in/out parameter - else if( pMethod->pParams[i].bOut == sal_True) - { - CComVariant var; - if(pMethod->pParams[i].bIn) - { - anyToVariant( & var,Params[i]); - pVarParamsRef[outParamIndex] = var; - } - - switch( pMethod->pParams[i].pTypeRef->eTypeClass) - { - case TypeClass_INTERFACE: - case TypeClass_STRUCT: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt= VT_DISPATCH; - pVarParamsRef[ outParamIndex].pdispVal= 0; - } - pVarParams[parameterCount - i -1].vt = VT_DISPATCH | VT_BYREF; - pVarParams[parameterCount - i -1].ppdispVal= &pVarParamsRef[outParamIndex].pdispVal; - break; - case TypeClass_ENUM: - case TypeClass_LONG: - case TypeClass_UNSIGNED_LONG: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_I4; - pVarParamsRef[ outParamIndex].lVal = 0; - } - pVarParams[parameterCount - i -1].vt = VT_I4 | VT_BYREF; - pVarParams[parameterCount - i -1].plVal= &pVarParamsRef[outParamIndex].lVal; - break; - case TypeClass_SEQUENCE: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_ARRAY| VT_VARIANT; - pVarParamsRef[ outParamIndex].parray= NULL; - } - pVarParams[parameterCount - i -1].vt = VT_ARRAY| VT_BYREF | VT_VARIANT; - pVarParams[parameterCount - i -1].pparray= &pVarParamsRef[outParamIndex].parray; - break; - case TypeClass_ANY: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_EMPTY; - pVarParamsRef[ outParamIndex].lVal = 0; - } - pVarParams[parameterCount - i -1].vt = VT_VARIANT | VT_BYREF; - pVarParams[parameterCount - i -1].pvarVal = &pVarParamsRef[outParamIndex]; - break; - case TypeClass_BOOLEAN: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_BOOL; - pVarParamsRef[ outParamIndex].boolVal = 0; - } - pVarParams[parameterCount - i -1].vt = VT_BOOL| VT_BYREF; - pVarParams[parameterCount - i -1].pboolVal = - & pVarParamsRef[outParamIndex].boolVal; - break; - - case TypeClass_STRING: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_BSTR; - pVarParamsRef[ outParamIndex].bstrVal= 0; - } - pVarParams[parameterCount - i -1].vt = VT_BSTR| VT_BYREF; - pVarParams[parameterCount - i -1].pbstrVal= - & pVarParamsRef[outParamIndex].bstrVal; - break; - - case TypeClass_FLOAT: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_R4; - pVarParamsRef[ outParamIndex].fltVal= 0; - } - pVarParams[parameterCount - i -1].vt = VT_R4| VT_BYREF; - pVarParams[parameterCount - i -1].pfltVal = - & pVarParamsRef[outParamIndex].fltVal; - break; - case TypeClass_DOUBLE: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_R8; - pVarParamsRef[ outParamIndex].dblVal= 0; - } - pVarParams[parameterCount - i -1].vt = VT_R8| VT_BYREF; - pVarParams[parameterCount - i -1].pdblVal= - & pVarParamsRef[outParamIndex].dblVal; - break; - case TypeClass_BYTE: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_UI1; - pVarParamsRef[ outParamIndex].bVal= 0; - } - pVarParams[parameterCount - i -1].vt = VT_UI1| VT_BYREF; - pVarParams[parameterCount - i -1].pbVal= - & pVarParamsRef[outParamIndex].bVal; - break; - case TypeClass_CHAR: - case TypeClass_SHORT: - case TypeClass_UNSIGNED_SHORT: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_I2; - pVarParamsRef[ outParamIndex].iVal = 0; - } - pVarParams[parameterCount - i -1].vt = VT_I2| VT_BYREF; - pVarParams[parameterCount - i -1].piVal= - & pVarParamsRef[outParamIndex].iVal; - break; - - default: - if( ! pMethod->pParams[i].bIn) - { - pVarParamsRef[ outParamIndex].vt = VT_EMPTY; - pVarParamsRef[ outParamIndex].lVal = 0; - } - pVarParams[parameterCount - i -1].vt = VT_VARIANT | VT_BYREF; - pVarParams[parameterCount - i -1].pvarVal = - & pVarParamsRef[outParamIndex]; - } - outParamIndex++; - } // end else if - } // end for - } - catch (IllegalArgumentException & e) - { - e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, int >( i ); - throw; - } - catch (CannotConvertException & e) - { - e.ArgumentIndex = i; - throw; - } - } - else // it is an JScriptObject - { - int i = 0; - try - { - for( ; i< parameterCount; i++) - { - // In parameter - if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut) - { - anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]); - } - // Out parameter + in/out parameter - else if( pMethod->pParams[i].bOut == sal_True) - { - CComObject* pParamObject; - if( SUCCEEDED( CComObject::CreateInstance( &pParamObject))) - { - CComPtr pUnk(pParamObject->GetUnknown()); -#ifdef __MINGW32__ - CComQIPtr pDisp( pUnk); -#else - CComQIPtr pDisp( pUnk); -#endif - - pVarParams[ parameterCount - i -1].vt= VT_DISPATCH; - pVarParams[ parameterCount - i -1].pdispVal= pDisp; - pVarParams[ parameterCount - i -1].pdispVal->AddRef(); - // if the param is in/out then put the parameter on index 0 - if( pMethod->pParams[i].bIn == sal_True ) // in / out - { - CComVariant varParam; - anyToVariant( &varParam, Params.getConstArray()[i]); - CComDispatchDriver dispDriver( pDisp); - if(FAILED( dispDriver.PutPropertyByName( L"0", &varParam))) - throw BridgeRuntimeError( - OUSTR("[automation bridge]IUnknownWrapper_Impl::" - "invokeWithDispIdUnoTlb\n" - "Could not set property \"0\" for the in/out " - "param!")); - - } - } - else - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]IUnknownWrapper_Impl::" - "invokeWithDispIdUnoTlb\n" - "Could not create out parameter at index: ") + - OUString::valueOf((sal_Int32) i)); - } - - } - } - } - catch (IllegalArgumentException & e) - { - e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, int >( i ); - throw; - } - catch (CannotConvertException & e) - { - e.ArgumentIndex = i; - throw; - } - } - } - // No type description Available, that is we have to deal with a COM component, - // that does not implements UNO interfaces ( IDispatch based) - else - { - //We should not run into this block, because invokeWithDispIdComTlb should - //have been called instead. - OSL_ASSERT(0); - } - - - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; - DISPPARAMS dispparams= { pVarParams, NULL, parameterCount, 0}; - // Get the DISPID - FuncDesc aDesc(getTypeInfo()); - getFuncDesc(sFunctionName, & aDesc); - // invoking OLE method - hr = m_spDispatch->Invoke(aDesc->memid, - IID_NULL, - LOCALE_USER_DEFAULT, - DISPATCH_METHOD, - &dispparams, - &varResult, - &excepinfo, - &uArgErr); - - // converting return value and out parameter back to UNO - if (hr == S_OK) - { - if( outParameterCount && pMethod) - { - OutParamIndex.realloc( outParameterCount); - OutParam.realloc( outParameterCount); - sal_Int32 outIndex=0; - int i = 0; - try - { - for( ; i < parameterCount; i++) - { - if( pMethod->pParams[i].bOut ) - { - OutParamIndex[outIndex]= (sal_Int16) i; - Any outAny; - if( !bJScriptObject) - { - variantToAny( &pVarParamsRef[outIndex], outAny, - Type(pMethod->pParams[i].pTypeRef), sal_False); - OutParam[outIndex++]= outAny; - } - else //JScriptObject - { - if( pVarParams[i].vt == VT_DISPATCH) - { - CComDispatchDriver pDisp( pVarParams[i].pdispVal); - if( pDisp) - { - CComVariant varOut; - if( SUCCEEDED( pDisp.GetPropertyByName( L"0", &varOut))) - { - variantToAny( &varOut, outAny, - Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), sal_False); - OutParam[outParameterCount - 1 - outIndex++]= outAny; - } - else - bConvRet= sal_False; - } - else - bConvRet= sal_False; - } - else - bConvRet= sal_False; - } - } - if( !bConvRet) break; - } - } - catch(IllegalArgumentException & e) - { - e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, int >( i ); - throw; - } - catch(CannotConvertException & e) - { - e.ArgumentIndex = i; - throw; - } - } - // return value, no type information available - if ( bConvRet) - { - try - { - if( pMethod ) - variantToAny(&varResult, ret, Type( pMethod->pReturnTypeRef), sal_False); - else - variantToAny(&varResult, ret, sal_False); - } - catch (IllegalArgumentException & e) - { - e.Message = - OUSTR("[automation bridge]IUnknownWrapper_Impl::invokeWithDispIdUnoTlb\n" - "Could not convert return value! \n Message: \n") + e.Message; - throw; - } - catch (CannotConvertException & e) - { - e.Message = - OUSTR("[automation bridge]IUnknownWrapper_Impl::invokeWithDispIdUnoTlb\n" - "Could not convert return value! \n Message: \n") + e.Message; - throw; - } - } - } - - if( !bConvRet) // conversion of return or out parameter failed - throw CannotConvertException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Call to COM object failed. Conversion of return or out value failed")), - Reference( static_cast(this), UNO_QUERY ), TypeClass_UNKNOWN, - FailReason::UNKNOWN, 0);// lookup error code - // conversion of return or out parameter failed - switch (hr) - { - case S_OK: - break; - case DISP_E_BADPARAMCOUNT: - throw IllegalArgumentException(); - break; - case DISP_E_BADVARTYPE: - throw RuntimeException(); - break; - case DISP_E_EXCEPTION: - throw InvocationTargetException(); - break; - case DISP_E_MEMBERNOTFOUND: - throw IllegalArgumentException(); - break; - case DISP_E_NONAMEDARGS: - throw IllegalArgumentException(); - break; - case DISP_E_OVERFLOW: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr); - break; - case DISP_E_PARAMNOTFOUND: - throw IllegalArgumentException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_TYPEMISMATCH: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")),static_cast( - static_cast(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr); - break; - case DISP_E_UNKNOWNINTERFACE: - throw RuntimeException() ; - break; - case DISP_E_UNKNOWNLCID: - throw RuntimeException() ; - break; - case DISP_E_PARAMNOTOPTIONAL: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("call to OLE object failed")), static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr); - break; - default: - throw RuntimeException(); - break; - } - - return ret; -} - - - -// -------------------------- -// XInitialization -void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) -{ - // 1.parameter is IUnknown - // 2.parameter is a boolean which indicates if the the COM pointer was a IUnknown or IDispatch - // 3.parameter is a Sequence - o2u_attachCurrentThread(); - OSL_ASSERT(aArguments.getLength() == 3); - - m_spUnknown= *(IUnknown**) aArguments[0].getValue(); -#ifdef __MINGW32__ - m_spUnknown->QueryInterface(IID_IDispatch, reinterpret_cast( & m_spDispatch.p)); -#else - m_spUnknown.QueryInterface( & m_spDispatch.p); -#endif - - aArguments[1] >>= m_bOriginalDispatch; - aArguments[2] >>= m_seqTypes; - - ITypeInfo* pType = NULL; - try - { - // a COM object implementation that has no TypeInfo is still a legal COM object; - // such objects can at least be transported through UNO using the bridge - // so we should allow to create wrappers for them as well - pType = getTypeInfo(); - } - catch( BridgeRuntimeError& ) - {} - catch( Exception& ) - {} - - if ( pType ) - { - try - { - // Get Default member - CComBSTR defaultMemberName; - if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) ) - { - OUString usName(reinterpret_cast(LPCOLESTR(defaultMemberName))); - FuncDesc aDescGet(pType); - FuncDesc aDescPut(pType); - VarDesc aVarDesc(pType); - // see if this is a property first ( more likely to be a property then a method ) - getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc); - - if ( !aDescGet && !aDescPut ) - { - getFuncDesc( usName, &aDescGet ); - if ( !aDescGet ) - throw BridgeRuntimeError( OUSTR("[automation bridge]IUnknownWrapper_Impl::initialize() Failed to get Function or Property desc. for " ) + usName ); - } - // now for some funny heuristics to make basic understand what to do - // a single aDescGet ( that doesn't take any params ) would be - // a read only ( defaultmember ) property e.g. this object - // should implement XDefaultProperty - // a single aDescGet ( that *does* ) take params is basically a - // default method e.g. implement XDefaultMethod - - // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway ) - if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) ) - m_bHasDfltProperty = true; - if ( aDescGet->cParams > 0 ) - m_bHasDfltMethod = true; - if ( m_bHasDfltProperty || m_bHasDfltMethod ) - m_sDefaultMember = usName; - } - } - catch ( BridgeRuntimeError & e ) - { - throw RuntimeException( e.message, Reference() ); - } - catch( Exception& e ) - { - throw RuntimeException( - OUSTR("[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n") + e.Message, - Reference() ); - } - } -} - -// -------------------------- -// XDirectInvocation -uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const ::rtl::OUString& aName, const uno::Sequence< uno::Any >& aParams ) - throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - Any aResult; - - if ( !m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - - o2u_attachCurrentThread(); - DISPID dispid; - if ( !getDispid( aName, &dispid ) ) - throw IllegalArgumentException( - OUSTR( "[automation bridge] The object does not have a function or property " ) - + aName, Reference(), 0); - - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr = 0; - INVOKEKIND pInvkinds[2]; - pInvkinds[0] = INVOKE_FUNC; - pInvkinds[1] = aParams.getLength() ? INVOKE_PROPERTYPUT : INVOKE_PROPERTYGET; - HRESULT hInvRes = E_FAIL; - - // try Invoke first, if it does not work, try put/get property - for ( sal_Int32 nStep = 0; FAILED( hInvRes ) && nStep < 2; nStep++ ) - { - DISPPARAMS dispparams = {NULL, NULL, 0, 0}; - - DISPID idPropertyPut = DISPID_PROPERTYPUT; - scoped_array arDispidNamedArgs; - scoped_array ptrArgs; - scoped_array ptrRefArgs; // referenced arguments - CComVariant * arArgs = NULL; - CComVariant * arRefArgs = NULL; - - dispparams.cArgs = aParams.getLength(); - - // Determine the number of named arguments - for ( sal_Int32 nInd = 0; nInd < aParams.getLength(); nInd++ ) - if ( aParams[nInd].getValueType() == getCppuType((NamedArgument*) 0) ) - dispparams.cNamedArgs ++; - - // fill the named arguments - if ( dispparams.cNamedArgs > 0 - && !( dispparams.cNamedArgs == 1 && pInvkinds[nStep] == INVOKE_PROPERTYPUT ) ) - { - int nSizeAr = dispparams.cNamedArgs + 1; - if ( pInvkinds[nStep] == INVOKE_PROPERTYPUT ) - nSizeAr = dispparams.cNamedArgs; - - scoped_array saNames(new OLECHAR*[nSizeAr]); - OLECHAR ** pNames = saNames.get(); - pNames[0] = const_cast(reinterpret_cast(aName.getStr())); - - int cNamedArg = 0; - for ( size_t nInd = 0; nInd < dispparams.cArgs; nInd++ ) - { - if ( aParams[nInd].getValueType() == getCppuType((NamedArgument*) 0)) - { - const NamedArgument& arg = *(NamedArgument const*)aParams[nInd].getValue(); - - //We put the parameter names in reverse order into the array, - //so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs - //The first name in the array is the method name - pNames[nSizeAr - 1 - cNamedArg++] = const_cast(reinterpret_cast(arg.Name.getStr())); - } - } - - arDispidNamedArgs.reset( new DISPID[nSizeAr] ); - HRESULT hr = getTypeInfo()->GetIDsOfNames( pNames, nSizeAr, arDispidNamedArgs.get() ); - if ( hr == E_NOTIMPL ) - hr = m_spDispatch->GetIDsOfNames(IID_NULL, pNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() ); - - if ( SUCCEEDED( hr ) ) - { - if ( pInvkinds[nStep] == DISPATCH_PROPERTYPUT ) - { - DISPID* arIDs = arDispidNamedArgs.get(); - arIDs[0] = DISPID_PROPERTYPUT; - dispparams.rgdispidNamedArgs = arIDs; - } - else - { - DISPID* arIDs = arDispidNamedArgs.get(); - dispparams.rgdispidNamedArgs = & arIDs[1]; - } - } - else if (hr == DISP_E_UNKNOWNNAME) - { - throw IllegalArgumentException( - OUSTR("[automation bridge]One of the named arguments is wrong!"), - Reference(), 0); - } - else - { - throw InvocationTargetException( - OUSTR("[automation bridge] ITypeInfo::GetIDsOfNames returned error ") - + OUString::valueOf((sal_Int32) hr, 16), Reference(), Any()); - } - } - - //Convert arguments - ptrArgs.reset(new CComVariant[dispparams.cArgs]); - ptrRefArgs.reset(new CComVariant[dispparams.cArgs]); - arArgs = ptrArgs.get(); - arRefArgs = ptrRefArgs.get(); - - sal_Int32 nInd = 0; - try - { - sal_Int32 revIndex = 0; - for ( nInd = 0; nInd < sal_Int32(dispparams.cArgs); nInd++) - { - revIndex = dispparams.cArgs - nInd - 1; - arRefArgs[revIndex].byref = 0; - Any anyArg; - if ( nInd < aParams.getLength() ) - anyArg = aParams.getConstArray()[nInd]; - - // Property Put arguments - if ( anyArg.getValueType() == getCppuType((PropertyPutArgument*)0) ) - { - PropertyPutArgument arg; - anyArg >>= arg; - anyArg <<= arg.Value; - } - // named argument - if (anyArg.getValueType() == getCppuType((NamedArgument*) 0)) - { - NamedArgument aNamedArgument; - anyArg >>= aNamedArgument; - anyArg <<= aNamedArgument.Value; - } - - if ( nInd < aParams.getLength() && anyArg.getValueTypeClass() != TypeClass_VOID ) - { - anyToVariant( &arArgs[revIndex], anyArg, VT_VARIANT ); - } - else - { - arArgs[revIndex].vt = VT_ERROR; - arArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; - } - } - } - catch (IllegalArgumentException & e) - { - e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, sal_Int32 >( nInd ); - throw; - } - catch (CannotConvertException & e) - { - e.ArgumentIndex = nInd; - throw; - } - - dispparams.rgvarg = arArgs; - // invoking OLE method - DWORD localeId = LOCALE_USER_DEFAULT; - hInvRes = m_spDispatch->Invoke( dispid, - IID_NULL, - localeId, - ::sal::static_int_cast< WORD, INVOKEKIND >( pInvkinds[nStep] ), - &dispparams, - &varResult, - &excepinfo, - &uArgErr); - } - - // converting return value and out parameter back to UNO - if ( SUCCEEDED( hInvRes ) ) - variantToAny( &varResult, aResult, sal_False ); - else - { - // map error codes to exceptions - OUString message; - switch ( hInvRes ) - { - case S_OK: - break; - case DISP_E_BADPARAMCOUNT: - throw IllegalArgumentException(OUSTR("[automation bridge] Wrong " - "number of arguments. Object returned DISP_E_BADPARAMCOUNT."), - 0, 0); - break; - case DISP_E_BADVARTYPE: - throw RuntimeException(OUSTR("[automation bridge] One or more " - "arguments have the wrong type. Object returned " - "DISP_E_BADVARTYPE."), 0); - break; - case DISP_E_EXCEPTION: - message = OUSTR("[automation bridge]: "); - message += OUString(reinterpret_cast(excepinfo.bstrDescription), - ::SysStringLen(excepinfo.bstrDescription)); - throw InvocationTargetException(message, Reference(), Any()); - break; - case DISP_E_MEMBERNOTFOUND: - message = OUSTR("[automation bridge]: A function with the name \"") - + aName + OUSTR("\" is not supported. Object returned " - "DISP_E_MEMBERNOTFOUND."); - throw IllegalArgumentException(message, 0, 0); - break; - case DISP_E_NONAMEDARGS: - throw IllegalArgumentException(OUSTR("[automation bridge] Object " - "returned DISP_E_NONAMEDARGS"),0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_OVERFLOW: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[automation bridge] Call failed.")), - static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr); - break; - case DISP_E_PARAMNOTFOUND: - throw IllegalArgumentException(OUSTR("[automation bridge]Call failed." - "Object returned DISP_E_PARAMNOTFOUND."), - 0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_TYPEMISMATCH: - throw CannotConvertException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_TYPEMISMATCH"), - static_cast( - static_cast(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr); - break; - case DISP_E_UNKNOWNINTERFACE: - throw RuntimeException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_UNKNOWNINTERFACE."),0); - break; - case DISP_E_UNKNOWNLCID: - throw RuntimeException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_UNKNOWNLCID."),0); - break; - case DISP_E_PARAMNOTOPTIONAL: - throw CannotConvertException(OUSTR("[automation bridge] Call failed." - "Object returned DISP_E_PARAMNOTOPTIONAL"), - static_cast(static_cast(this)), - TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr); - break; - default: - throw RuntimeException(); - break; - } - } - - return aResult; -} - -::sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMember( const ::rtl::OUString& aName ) - throw (uno::RuntimeException) -{ - if ( ! m_spDispatch ) - { - throw RuntimeException( - OUSTR("[automation bridge] The object does not have an IDispatch interface"), - Reference()); - } - - o2u_attachCurrentThread(); - DISPID dispid; - return getDispid( aName, &dispid ); -} - - -// UnoConversionUtilities -------------------------------------------------------------------------------- -Reference< XInterface > IUnknownWrapper_Impl::createUnoWrapperInstance() -{ - if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL) - { - Reference xWeak= static_cast( new InterfaceOleWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT) - { - Reference xWeak= static_cast( new UnoObjectWrapperRemoteOpt( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else - return Reference(); -} -Reference IUnknownWrapper_Impl::createComWrapperInstance() -{ - Reference xWeak= static_cast( new IUnknownWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - - - -void IUnknownWrapper_Impl::getMethodInfo(const OUString& sName, TypeDescription& methodInfo) -{ - TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName); - if( desc.is()) - { - typelib_TypeDescription* pMember= desc.get(); - if( pMember->eTypeClass == TypeClass_INTERFACE_METHOD ) - methodInfo= pMember; - } -} - -void IUnknownWrapper_Impl::getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo) -{ - TypeDescription desc= getInterfaceMemberDescOfCurrentCall(sName); - if( desc.is()) - { - typelib_TypeDescription* pMember= desc.get(); - if( pMember->eTypeClass == TypeClass_INTERFACE_ATTRIBUTE ) - { - attributeInfo= ((typelib_InterfaceAttributeTypeDescription*)pMember)->pAttributeTypeRef; - } - } -} -TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const OUString& sName) -{ - TypeDescription ret; - - for( sal_Int32 i=0; i < m_seqTypes.getLength(); i++) - { - TypeDescription _curDesc( m_seqTypes[i]); - _curDesc.makeComplete(); - typelib_InterfaceTypeDescription * pInterface= (typelib_InterfaceTypeDescription*) _curDesc.get(); - if( pInterface) - { - typelib_InterfaceMemberTypeDescription* pMember= NULL; - //find the member description of the current call - for( int i=0; i < pInterface->nAllMembers; i++) - { - typelib_TypeDescriptionReference* pTypeRefMember = pInterface->ppAllMembers[i]; - typelib_TypeDescription* pDescMember= NULL; - TYPELIB_DANGER_GET( &pDescMember, pTypeRefMember) - - typelib_InterfaceMemberTypeDescription* pInterfaceMember= - (typelib_InterfaceMemberTypeDescription*) pDescMember; - if( OUString( pInterfaceMember->pMemberName) == sName) - { - pMember= pInterfaceMember; - break; - } - TYPELIB_DANGER_RELEASE( pDescMember) - } - - if( pMember) - { - ret= (typelib_TypeDescription*)pMember; - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription*)pMember); - } - } - if( ret.is()) - break; - } - return ret; -} - -sal_Bool IUnknownWrapper_Impl::isJScriptObject() -{ - if( m_eJScript == JScriptUndefined) - { - CComDispatchDriver disp( m_spDispatch); - if( disp) - { - CComVariant result; - if( SUCCEEDED( disp.GetPropertyByName( JSCRIPT_ID_PROPERTY, &result))) - { - if(result.vt == VT_BSTR) - { - CComBSTR name( result.bstrVal); - name.ToLower(); - if( name == CComBSTR(JSCRIPT_ID)) - m_eJScript= IsJScript; - } - } - } - if( m_eJScript == JScriptUndefined) - m_eJScript= NoJScript; - } - - return m_eJScript == NoJScript ? sal_False : sal_True; -} - - - -/** @internal - The function ultimately calls IDispatch::Invoke on the wrapped COM object. - The COM object does not implement UNO Interfaces ( via IDispatch). This - is the case when the OleObjectFactory service has been used to create a - component. - @exception IllegalArgumentException - @exception CannotConvertException - @InvocationTargetException - @RuntimeException - @BridgeRuntimeError -*/ -Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam) -{ - // Get type info for the call. It can be a method call or property put or - // property get operation. - FuncDesc aFuncDesc(getTypeInfo()); - getFuncDescForInvoke(sFuncName, Params, & aFuncDesc); - return invokeWithDispIdComTlb( aFuncDesc, sFuncName, Params, OutParamIndex, OutParam ); -} - -Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, - const OUString& sFuncName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam) -{ - Any ret; - HRESULT result; - - DISPPARAMS dispparams = {NULL, NULL, 0, 0}; - CComVariant varResult; - ExcepInfo excepinfo; - unsigned int uArgErr; - sal_Int32 i = 0; - sal_Int32 nUnoArgs = Params.getLength(); - DISPID idPropertyPut = DISPID_PROPERTYPUT; - scoped_array arDispidNamedArgs; - scoped_array ptrArgs; - scoped_array ptrRefArgs; // referenced arguments - CComVariant * arArgs = NULL; - CComVariant * arRefArgs = NULL; - sal_Int32 revIndex = 0; - - //Set the array of DISPIDs for named args if it is a property put operation. - //If there are other named arguments another array is set later on. - if (aFuncDesc->invkind == INVOKE_PROPERTYPUT - || aFuncDesc->invkind == INVOKE_PROPERTYPUTREF) - dispparams.rgdispidNamedArgs = & idPropertyPut; - - //Determine the number of named arguments - for (int iParam = 0; iParam < nUnoArgs; iParam ++) - { - const Any & curArg = Params[iParam]; - if (curArg.getValueType() == getCppuType((NamedArgument*) 0)) - dispparams.cNamedArgs ++; - } - //In a property put operation a property value is a named argument (DISPID_PROPERTYPUT). - //Therefore the number of named arguments is increased by one. - //Although named, the argument is not named in a actual language, such as Basic, - //therefore it is never a com.sun.star.bridge.oleautomation.NamedArgument - if (aFuncDesc->invkind == DISPATCH_PROPERTYPUT - || aFuncDesc->invkind == DISPATCH_PROPERTYPUTREF) - dispparams.cNamedArgs ++; - - //Determine the number of all arguments and named arguments - if (aFuncDesc->cParamsOpt == -1) - { - //Attribute vararg is set on this method. "Unlimited" number of args - //supported. There can be no optional or defaultvalue on any of the arguments. - dispparams.cArgs = nUnoArgs; - } - else - { - //If there are namesd arguments, then the dispparams.cArgs - //is the number of supplied args, otherwise it is the expected number. - if (dispparams.cNamedArgs) - dispparams.cArgs = nUnoArgs; - else - dispparams.cArgs = aFuncDesc->cParams; - } - - //check if there are not to many arguments supplied - if (::sal::static_int_cast< sal_uInt32, int >( nUnoArgs ) > dispparams.cArgs) - { - OUStringBuffer buf(256); - buf.appendAscii("[automation bridge] There are too many arguments for this method"); - throw IllegalArgumentException( buf.makeStringAndClear(), - Reference(), (sal_Int16) dispparams.cArgs); - } - - //Set up the array of DISPIDs (DISPPARAMS::rgdispidNamedArgs) - //for the named arguments. - //If there is only one named arg and if it is because of a property put - //operation, then we need not set up the DISPID array. - if (dispparams.cNamedArgs > 0 && - ! (dispparams.cNamedArgs == 1 && - (aFuncDesc->invkind == INVOKE_PROPERTYPUT || - aFuncDesc->invkind == INVOKE_PROPERTYPUT))) - { - //set up an array containing the member and parameter names - //which is then used in ITypeInfo::GetIDsOfNames - //First determine the size of the array of names which is passed to - //ITypeInfo::GetIDsOfNames. It must hold the method names + the named - //args. - int nSizeAr = dispparams.cNamedArgs + 1; - if (aFuncDesc->invkind == INVOKE_PROPERTYPUT - || aFuncDesc->invkind == INVOKE_PROPERTYPUTREF) - { - nSizeAr = dispparams.cNamedArgs; //counts the DISID_PROPERTYPUT - } - - scoped_array saNames(new OLECHAR*[nSizeAr]); - OLECHAR ** arNames = saNames.get(); - arNames[0] = const_cast(reinterpret_cast(sFuncName.getStr())); - - int cNamedArg = 0; - for (size_t iParams = 0; iParams < dispparams.cArgs; iParams ++) - { - const Any & curArg = Params[iParams]; - if (curArg.getValueType() == getCppuType((NamedArgument*) 0)) - { - const NamedArgument& arg = *(NamedArgument const*) curArg.getValue(); - //We put the parameter names in reverse order into the array, - //so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs - //The first name in the array is the method name - arNames[nSizeAr - 1 - cNamedArg++] = const_cast(reinterpret_cast(arg.Name.getStr())); - } - } - - //Prepare the array of DISPIDs for ITypeInfo::GetIDsOfNames - //it must be big enough to contain the DISPIDs of the member + parameters - arDispidNamedArgs.reset(new DISPID[nSizeAr]); - HRESULT hr = getTypeInfo()->GetIDsOfNames(arNames, nSizeAr, - arDispidNamedArgs.get()); - if ( hr == E_NOTIMPL ) - hr = m_spDispatch->GetIDsOfNames(IID_NULL, arNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() ); - - if (hr == S_OK) - { - // In a "property put" operation, the property value is a named param with the - //special DISPID DISPID_PROPERTYPUT - if (aFuncDesc->invkind == DISPATCH_PROPERTYPUT - || aFuncDesc->invkind == DISPATCH_PROPERTYPUTREF) - { - //Element at index 0 in the DISPID array must be DISPID_PROPERTYPUT - //The first item in the array arDispidNamedArgs is the DISPID for - //the method. We replace it with DISPID_PROPERTYPUT. - DISPID* arIDs = arDispidNamedArgs.get(); - arIDs[0] = DISPID_PROPERTYPUT; - dispparams.rgdispidNamedArgs = arIDs; - } - else - { - //The first item in the array arDispidNamedArgs is the DISPID for - //the method. It must be removed - DISPID* arIDs = arDispidNamedArgs.get(); - dispparams.rgdispidNamedArgs = & arIDs[1]; - } - } - else if (hr == DISP_E_UNKNOWNNAME) - { - throw IllegalArgumentException( - OUSTR("[automation bridge]One of the named arguments is wrong!"), - Reference(), 0); - } - else - { - throw InvocationTargetException( - OUSTR("[automation bridge] ITypeInfo::GetIDsOfNames returned error ") - + OUString::valueOf((sal_Int32) hr, 16), Reference(), Any()); - } - } - - //Convert arguments - ptrArgs.reset(new CComVariant[dispparams.cArgs]); - ptrRefArgs.reset(new CComVariant[dispparams.cArgs]); - arArgs = ptrArgs.get(); - arRefArgs = ptrRefArgs.get(); - try - { - for (i = 0; i < (sal_Int32) dispparams.cArgs; i++) - { - revIndex= dispparams.cArgs - i -1; - arRefArgs[revIndex].byref=0; - Any anyArg; - if ( i < nUnoArgs) - anyArg= Params.getConstArray()[i]; - - unsigned short paramFlags = PARAMFLAG_FOPT | PARAMFLAG_FIN; - VARTYPE varType = VT_VARIANT; - if (aFuncDesc->cParamsOpt != -1 || aFuncDesc->cParams != (i + 1)) - { - paramFlags = aFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags; - varType = getElementTypeDesc(&aFuncDesc->lprgelemdescParam[i].tdesc); - } - - // Make sure that there is a UNO parameter for every - // expected parameter. If there is no UNO parameter where the - // called function expects one, then it must be optional. Otherwise - // its a UNO programming error. - if (i >= nUnoArgs && !(paramFlags & PARAMFLAG_FOPT)) - { - OUStringBuffer buf(256); - buf.appendAscii("ole automation bridge: The called function expects an argument at" - "position: "); //a different number of arguments")), - buf.append(OUString::valueOf((sal_Int32) i)); - buf.appendAscii(" (index starting at 0)."); - throw IllegalArgumentException( buf.makeStringAndClear(), - Reference(), (sal_Int16) i); - } - - // Property Put arguments - if (anyArg.getValueType() == getCppuType((PropertyPutArgument*)0)) - { - PropertyPutArgument arg; - anyArg >>= arg; - anyArg <<= arg.Value; - } - // named argument - if (anyArg.getValueType() == getCppuType((NamedArgument*) 0)) - { - NamedArgument aNamedArgument; - anyArg >>= aNamedArgument; - anyArg <<= aNamedArgument.Value; - } - // out param - if (paramFlags & PARAMFLAG_FOUT && - ! (paramFlags & PARAMFLAG_FIN) ) - { - VARTYPE type = ::sal::static_int_cast< VARTYPE, int >( varType ^ VT_BYREF ); - if (i < nUnoArgs) - { - arRefArgs[revIndex].vt= type; - } - else - { - //optional arg - arRefArgs[revIndex].vt = VT_ERROR; - arRefArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; - } - if( type == VT_VARIANT ) - { - arArgs[revIndex].vt= VT_VARIANT | VT_BYREF; - arArgs[revIndex].byref= &arRefArgs[revIndex]; - } - else - { - arArgs[revIndex].vt= varType; - if (type == VT_DECIMAL) - arArgs[revIndex].byref= & arRefArgs[revIndex].decVal; - else - arArgs[revIndex].byref= & arRefArgs[revIndex].byref; - } - } - // in/out + in byref params - else if (varType & VT_BYREF) - { - VARTYPE type = ::sal::static_int_cast< VARTYPE, int >( varType ^ VT_BYREF ); - CComVariant var; - - if (i < nUnoArgs && anyArg.getValueTypeClass() != TypeClass_VOID) - { - anyToVariant( & arRefArgs[revIndex], anyArg, type); - } - else if (paramFlags & PARAMFLAG_FHASDEFAULT) - { - //optional arg with default - VariantCopy( & arRefArgs[revIndex], - & aFuncDesc->lprgelemdescParam[i].paramdesc. - pparamdescex->varDefaultValue); - } - else - { - //optional arg - //e.g: call func(x) in basic : func() ' no arg supplied - OSL_ASSERT(paramFlags & PARAMFLAG_FOPT); - arRefArgs[revIndex].vt = VT_ERROR; - arRefArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; - } - - // Set the converted arguments in the array which will be - // DISPPARAMS::rgvarg - // byref arg VT_XXX |VT_BYREF - arArgs[revIndex].vt = varType; - if (revIndex == 0 && aFuncDesc->invkind == INVOKE_PROPERTYPUT) - { - arArgs[revIndex] = arRefArgs[revIndex]; - } - else if (type == VT_DECIMAL) - { - arArgs[revIndex].byref= & arRefArgs[revIndex].decVal; - } - else if (type == VT_VARIANT) - { - if ( ! (paramFlags & PARAMFLAG_FOUT)) - arArgs[revIndex] = arRefArgs[revIndex]; - else - arArgs[revIndex].byref = & arRefArgs[revIndex]; - } - else - { - arArgs[revIndex].byref = & arRefArgs[revIndex].byref; - arArgs[revIndex].vt = ::sal::static_int_cast< VARTYPE, int >( arRefArgs[revIndex].vt | VT_BYREF ); - } - - } - // in parameter no VT_BYREF except for array, interfaces - else - { // void any stands for optional param - if (i < nUnoArgs && anyArg.getValueTypeClass() != TypeClass_VOID) - { - anyToVariant( & arArgs[revIndex], anyArg, varType); - } - //optional arg but no void any supplied - //Basic: obj.func() ' first parameter left out because it is optional - else if (paramFlags & PARAMFLAG_FHASDEFAULT) - { - //optional arg with defaulteithter as direct arg : VT_XXX or - VariantCopy( & arArgs[revIndex], - & aFuncDesc->lprgelemdescParam[i].paramdesc. - pparamdescex->varDefaultValue); - } - else if (paramFlags & PARAMFLAG_FOPT) - { - arArgs[revIndex].vt = VT_ERROR; - arArgs[revIndex].scode = DISP_E_PARAMNOTFOUND; - } - else - { - arArgs[revIndex].vt = VT_EMPTY; - arArgs[revIndex].lVal = 0; - } - } - } - } - catch (IllegalArgumentException & e) - { - e.ArgumentPosition = ::sal::static_int_cast< sal_Int16, sal_Int32 >( i ); - throw; - } - catch (CannotConvertException & e) - { - e.ArgumentIndex = i; - throw; - } - dispparams.rgvarg= arArgs; - // invoking OLE method - DWORD localeId = LOCALE_USER_DEFAULT; - result = m_spDispatch->Invoke(aFuncDesc->memid, - IID_NULL, - localeId, - ::sal::static_int_cast< WORD, INVOKEKIND >( aFuncDesc->invkind ), - &dispparams, - &varResult, - &excepinfo, - &uArgErr); - - // converting return value and out parameter back to UNO - if (result == S_OK) - { - - // allocate space for the out param Sequence and indices Sequence - int outParamsCount= 0; // includes in/out parameter - for (int i = 0; i < aFuncDesc->cParams; i++) - { - if (aFuncDesc->lprgelemdescParam[i].paramdesc.wParamFlags & - PARAMFLAG_FOUT) - outParamsCount++; - } - - OutParamIndex.realloc(outParamsCount); - OutParam.realloc(outParamsCount); - // Convert out params - if (outParamsCount) - { - int outParamIndex=0; - for (int paramIndex = 0; paramIndex < nUnoArgs; paramIndex ++) - { - //Determine the index within the method sinature - int realParamIndex = paramIndex; - int revParamIndex = dispparams.cArgs - paramIndex - 1; - if (Params[paramIndex].getValueType() - == getCppuType((NamedArgument*) 0)) - { - //dispparams.rgdispidNamedArgs contains the mapping from index - //of named args list to index of parameter list - realParamIndex = dispparams.rgdispidNamedArgs[revParamIndex]; - } - - // no named arg, always come before named args - if (! (aFuncDesc->lprgelemdescParam[realParamIndex].paramdesc.wParamFlags - & PARAMFLAG_FOUT)) - continue; - Any outAny; - // variantToAny is called with the "reduce range" parameter set to sal_False. - // That causes VT_I4 values not to be converted down to a "lower" type. That - // feature exist for JScript only because it only uses VT_I4 for integer types. - try - { - variantToAny( & arRefArgs[revParamIndex], outAny, sal_False ); - } - catch (IllegalArgumentException & e) - { - e.ArgumentPosition = (sal_Int16)paramIndex; - throw; - } - catch (CannotConvertException & e) - { - e.ArgumentIndex = paramIndex; - throw; - } - OutParam[outParamIndex] = outAny; - OutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); - outParamIndex++; - } - OutParam.realloc(outParamIndex); - OutParamIndex.realloc(outParamIndex); - } - // Return value - variantToAny(&varResult, ret, sal_False); - } - - // map error codes to exceptions - OUString message; - switch (result) - { - case S_OK: - break; - case DISP_E_BADPARAMCOUNT: - throw IllegalArgumentException(OUSTR("[automation bridge] Wrong " - "number of arguments. Object returned DISP_E_BADPARAMCOUNT."), - 0, 0); - break; - case DISP_E_BADVARTYPE: - throw RuntimeException(OUSTR("[automation bridge] One or more " - "arguments have the wrong type. Object returned " - "DISP_E_BADVARTYPE."), 0); - break; - case DISP_E_EXCEPTION: - { - message = OUSTR("[automation bridge]: "); - message += OUString(reinterpret_cast(excepinfo.bstrDescription), - ::SysStringLen(excepinfo.bstrDescription)); - - // Add for VBA, to throw an exception with the correct error code and message. - sal_Int32 nErrorCode = excepinfo.wCode; - if ( nErrorCode == 0 ) - { - // The low 16-bit of scode describing the error or warning. - nErrorCode = ( excepinfo.scode & 0xFFFF ); - } - BasicErrorException aBasicErrExp(message, Reference(), nErrorCode, message); - throw InvocationTargetException(message, Reference(), makeAny(aBasicErrExp)); - // End add - - break; - } - case DISP_E_MEMBERNOTFOUND: - message = OUSTR("[automation bridge]: A function with the name \"") - + sFuncName + OUSTR("\" is not supported. Object returned " - "DISP_E_MEMBERNOTFOUND."); - throw IllegalArgumentException(message, 0, 0); - break; - case DISP_E_NONAMEDARGS: - throw IllegalArgumentException(OUSTR("[automation bridge] Object " - "returned DISP_E_NONAMEDARGS"),0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_OVERFLOW: - throw CannotConvertException(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[automation bridge] Call failed.")), - static_cast( - static_cast(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr); - break; - case DISP_E_PARAMNOTFOUND: - throw IllegalArgumentException(OUSTR("[automation bridge]Call failed." - "Object returned DISP_E_PARAMNOTFOUND."), - 0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr )); - break; - case DISP_E_TYPEMISMATCH: - throw CannotConvertException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_TYPEMISMATCH"), - static_cast( - static_cast(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr); - break; - case DISP_E_UNKNOWNINTERFACE: - throw RuntimeException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_UNKNOWNINTERFACE."),0); - break; - case DISP_E_UNKNOWNLCID: - throw RuntimeException(OUSTR("[automation bridge] Call failed. " - "Object returned DISP_E_UNKNOWNLCID."),0); - break; - case DISP_E_PARAMNOTOPTIONAL: - throw CannotConvertException(OUSTR("[automation bridge] Call failed." - "Object returned DISP_E_PARAMNOTOPTIONAL"), - static_cast(static_cast(this)), - TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr); - break; - default: - throw RuntimeException(); - break; - } - - return ret; -} - -void IUnknownWrapper_Impl::getFuncDescForInvoke(const OUString & sFuncName, - const Sequence & seqArgs, - FUNCDESC** pFuncDesc) -{ - int nUnoArgs = seqArgs.getLength(); - const Any * arArgs = seqArgs.getConstArray(); - ITypeInfo* pInfo = getTypeInfo(); - - //If the last of the positional arguments is a PropertyPutArgument - //then obtain the type info for the property put operation. - - //The property value is always the last argument, in a positional argument list - //or in a list of named arguments. A PropertyPutArgument is actually a named argument - //hence it must not be put in an extra NamedArgument structure - if (nUnoArgs > 0 && - arArgs[nUnoArgs - 1].getValueType() == getCppuType((PropertyPutArgument*) 0)) - { - // DISPATCH_PROPERTYPUT - FuncDesc aDescGet(pInfo); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(sFuncName, & aDescGet, & aDescPut, & aVarDesc); - if ( ! aDescPut) - { - throw IllegalArgumentException( - OUSTR("[automation bridge] The object does not have a writeable property: ") - + sFuncName, Reference(), 0); - } - *pFuncDesc = aDescPut.Detach(); - } - else - { // DISPATCH_METHOD - FuncDesc aFuncDesc(pInfo); - getFuncDesc(sFuncName, & aFuncDesc); - if ( ! aFuncDesc) - { - // Fallback: DISPATCH_PROPERTYGET can mostly be called as - // DISPATCH_METHOD - ITypeInfo * pInfo = getTypeInfo(); - FuncDesc aDescPut(pInfo); - VarDesc aVarDesc(pInfo); - getPropDesc(sFuncName, & aFuncDesc, & aDescPut, & aVarDesc); - if ( ! aFuncDesc ) - { - throw IllegalArgumentException( - OUSTR("[automation bridge] The object does not have a function" - "or readable property \"") - + sFuncName, Reference(), 0); - } - } - *pFuncDesc = aFuncDesc.Detach(); - } -} -bool IUnknownWrapper_Impl::getDispid(const OUString& sFuncName, DISPID * id) -{ - OSL_ASSERT(m_spDispatch); - LPOLESTR lpsz = const_cast (reinterpret_cast(sFuncName.getStr())); - HRESULT hr = m_spDispatch->GetIDsOfNames(IID_NULL, &lpsz, 1, LOCALE_USER_DEFAULT, id); - return hr == S_OK ? true : false; -} -void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc) - -{ - OSL_ASSERT( * pFuncDesc == 0); - buildComTlbIndex(); - typedef TLBFuncIndexMap::const_iterator cit; - typedef TLBFuncIndexMap::iterator it; - //We assume there is only one entry with the function name. A property - //would have two entries. - cit itIndex= m_mapComFunc.find(sFuncName); - if (itIndex == m_mapComFunc.end()) - { - //try case insensive with IDispatch::GetIDsOfNames - DISPID id; - if (getDispid(sFuncName, &id)) - { - CComBSTR memberName; - unsigned int pcNames=0; - // get the case sensitive name - if( SUCCEEDED(getTypeInfo()->GetNames( id, & memberName, 1, &pcNames))) - { - //get the associated index and add an entry to the map - //with the name sFuncName which differs in the casing of the letters to - //the actual name as obtained from ITypeInfo - OUString sRealName(reinterpret_cast(LPCOLESTR(memberName))); - cit itOrg = m_mapComFunc.find(sRealName); - OSL_ASSERT(itOrg != m_mapComFunc.end()); - // maybe this is a property, if so we need - // to store either both id's ( put/get ) or - // just the get. Storing both is more consistent - pair pItems = m_mapComFunc.equal_range( sRealName ); - for ( ;pItems.first != pItems.second; ++pItems.first ) - m_mapComFunc.insert( TLBFuncIndexMap::value_type ( make_pair(sFuncName, pItems.first->second ) )); - itIndex = - m_mapComFunc.find( sFuncName ); - } - } - } - -#if OSL_DEBUG_LEVEL >= 1 - // There must only be one entry if sFuncName represents a function or two - // if it is a property - pair p = m_mapComFunc.equal_range(sFuncName.toAsciiLowerCase()); - int numEntries = 0; - for ( ;p.first != p.second; p.first ++, numEntries ++); - OSL_ASSERT( ! (numEntries > 3) ); -#endif - if( itIndex != m_mapComFunc.end()) - { - ITypeInfo* pType= getTypeInfo(); - FUNCDESC * pDesc = NULL; - if (SUCCEEDED(pType->GetFuncDesc(itIndex->second, & pDesc))) - { - if (pDesc->invkind == INVOKE_FUNC) - { - (*pFuncDesc) = pDesc; - } - else - { - pType->ReleaseFuncDesc(pDesc); - } - } - else - { - throw BridgeRuntimeError(OUSTR("[automation bridge] Could not get " - "FUNCDESC for ") + sFuncName); - } - } - //else no entry found for sFuncName, pFuncDesc will not be filled in -} - -void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncDescGet, - FUNCDESC** pFuncDescPut, VARDESC** pVarDesc) -{ - OSL_ASSERT( * pFuncDescGet == 0 && * pFuncDescPut == 0); - buildComTlbIndex(); - typedef TLBFuncIndexMap::const_iterator cit; - pair p = m_mapComFunc.equal_range(sFuncName); - if (p.first == m_mapComFunc.end()) - { - //try case insensive with IDispatch::GetIDsOfNames - DISPID id; - if (getDispid(sFuncName, &id)) - { - CComBSTR memberName; - unsigned int pcNames=0; - // get the case sensitive name - if( SUCCEEDED(getTypeInfo()->GetNames( id, & memberName, 1, &pcNames))) - { - //As opposed to getFuncDesc, we do not add the value because we would - // need to find the get and set description for the property. This would - //mean to iterate over all FUNCDESCs again. - p = m_mapComFunc.equal_range(OUString(reinterpret_cast(LPCOLESTR(memberName)))); - } - } - } - - for ( int i = 0 ;p.first != p.second; p.first ++, i ++) - { - // There are a maximum of two entries, property put and property get - OSL_ASSERT( ! (i > 2) ); - ITypeInfo* pType= getTypeInfo(); - FUNCDESC * pFuncDesc = NULL; - if (SUCCEEDED( pType->GetFuncDesc(p.first->second, & pFuncDesc))) - { - if (pFuncDesc->invkind == INVOKE_PROPERTYGET) - { - (*pFuncDescGet) = pFuncDesc; - } - else if (pFuncDesc->invkind == INVOKE_PROPERTYPUT || - pFuncDesc->invkind == INVOKE_PROPERTYPUTREF) - { - //a property can have 3 entries, put, put ref, get - // If INVOKE_PROPERTYPUTREF or INVOKE_PROPERTYPUT is used - //depends on what is found first. - if ( * pFuncDescPut) - { - //we already have found one - pType->ReleaseFuncDesc(pFuncDesc); - } - else - { - (*pFuncDescPut) = pFuncDesc; - } - } - else - { - pType->ReleaseFuncDesc(pFuncDesc); - } - } - //ITypeInfo::GetFuncDesc may even provide a funcdesc for a VARDESC - // with invkind = INVOKE_FUNC. Since this function should only return - //a value for a real property (XInvokation::hasMethod, ..::hasProperty - //we need to make sure that sFuncName represents a real property. - VARDESC * pVD = NULL; - if (SUCCEEDED(pType->GetVarDesc(p.first->second, & pVD))) - (*pVarDesc) = pVD; - } - //else no entry for sFuncName, pFuncDesc will not be filled in -} - -VARTYPE IUnknownWrapper_Impl::getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType ) -{ - VARTYPE _type( VT_NULL ); - if ( pTypeInfo ) - { - CComPtr spRefInfo; - pTypeInfo->GetRefTypeInfo( nHrefType, &spRefInfo.p ); - if ( spRefInfo ) - { - TypeAttr attr( spRefInfo ); - spRefInfo->GetTypeAttr( &attr ); - if ( attr->typekind == TKIND_ENUM ) - { - // We use the type of the first enum value. - if ( attr->cVars == 0 ) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] Could not obtain type description")); - } - VarDesc var( spRefInfo ); - spRefInfo->GetVarDesc( 0, &var ); - _type = var->lpvarValue->vt; - } - else if ( attr->typekind == TKIND_INTERFACE ) - { - _type = VT_UNKNOWN; - } - else if ( attr->typekind == TKIND_DISPATCH ) - { - _type = VT_DISPATCH; - } - else if ( attr->typekind == TKIND_ALIAS ) - { - // TKIND_ALIAS is a type that is an alias for another type. So get that alias type. - _type = getUserDefinedElementType( pTypeInfo, attr->tdescAlias.hreftype ); - } - else - { - throw BridgeRuntimeError( OUSTR("[automation bridge] Unhandled user defined type.") ); - } - } - } - return _type; -} - -VARTYPE IUnknownWrapper_Impl::getElementTypeDesc(const TYPEDESC *desc) -{ - VARTYPE _type( VT_NULL ); - - if (desc->vt == VT_PTR) - { - _type = getElementTypeDesc(desc->lptdesc); - _type |= VT_BYREF; - } - else if (desc->vt == VT_SAFEARRAY) - { - _type = getElementTypeDesc(desc->lptdesc); - _type |= VT_ARRAY; - } - else if (desc->vt == VT_USERDEFINED) - { - ITypeInfo* thisInfo = getTypeInfo(); //kept by this instance - _type = getUserDefinedElementType( thisInfo, desc->hreftype ); - } - else - { - _type = desc->vt; - } - return _type; -} - -void IUnknownWrapper_Impl::buildComTlbIndex() -{ - if ( ! m_bComTlbIndexInit) - { - MutexGuard guard(getBridgeMutex()); - { - if ( ! m_bComTlbIndexInit) - { - OUString sError; - ITypeInfo* pType= getTypeInfo(); - TypeAttr typeAttr(pType); - if( SUCCEEDED( pType->GetTypeAttr( &typeAttr))) - { - for( long i= 0; i < typeAttr->cFuncs; i++) - { - FuncDesc funcDesc(pType); - if( SUCCEEDED( pType->GetFuncDesc( i, &funcDesc))) - { - CComBSTR memberName; - unsigned int pcNames=0; - if( SUCCEEDED(pType->GetNames( funcDesc->memid, & memberName, 1, &pcNames))) - { - OUString usName(reinterpret_cast(LPCOLESTR(memberName))); - m_mapComFunc.insert( TLBFuncIndexMap::value_type( usName, i)); - } - else - { - sError = OUSTR("[automation bridge] IUnknownWrapper_Impl::buildComTlbIndex, " \ - "ITypeInfo::GetNames failed."); - } - } - else - sError = OUSTR("[automation bridge] IUnknownWrapper_Impl::buildComTlbIndex, " \ - "ITypeInfo::GetFuncDesc failed."); - } - - //If we create an Object in JScript and a a property then it - //has VARDESC instead of FUNCDESC - for (long i = 0; i < typeAttr->cVars; i++) - { - VarDesc varDesc(pType); - if (SUCCEEDED(pType->GetVarDesc(i, & varDesc))) - { - CComBSTR memberName; - unsigned int pcNames = 0; - if (SUCCEEDED(pType->GetNames(varDesc->memid, & memberName, 1, &pcNames))) - { - if (varDesc->varkind == VAR_DISPATCH) - { - OUString usName(reinterpret_cast(LPCOLESTR(memberName))); - m_mapComFunc.insert(TLBFuncIndexMap::value_type( - usName, i)); - } - } - else - { - sError = OUSTR("[automation bridge] IUnknownWrapper_Impl::buildComTlbIndex, " \ - "ITypeInfo::GetNames failed."); - } - } - else - sError = OUSTR("[automation bridge] IUnknownWrapper_Impl::buildComTlbIndex, " \ - "ITypeInfo::GetVarDesc failed."); - - } - } - else - sError = OUSTR("[automation bridge] IUnknownWrapper_Impl::buildComTlbIndex, " \ - "ITypeInfo::GetTypeAttr failed."); - - if (sError.getLength()) - { - throw BridgeRuntimeError(sError); - } - - m_bComTlbIndexInit = true; - } - } - } -} - -ITypeInfo* IUnknownWrapper_Impl::getTypeInfo() -{ - if( !m_spDispatch) - { - throw BridgeRuntimeError(OUSTR("The object has no IDispatch interface!")); - } - - if( !m_spTypeInfo ) - { - MutexGuard guard(getBridgeMutex()); - if( ! m_spTypeInfo) - { - CComPtr< ITypeInfo > spType; - if( SUCCEEDED( m_spDispatch->GetTypeInfo( 0, LOCALE_USER_DEFAULT, &spType.p))) - - { - OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); - - //If this is a dual interface then TYPEATTR::typekind is usually TKIND_INTERFACE - //We need to get the type description for TKIND_DISPATCH - TypeAttr typeAttr(spType.p); - if( SUCCEEDED(spType->GetTypeAttr( &typeAttr))) - { - if (typeAttr->typekind == TKIND_INTERFACE && - typeAttr->wTypeFlags & TYPEFLAG_FDUAL) - { - HREFTYPE refDispatch; - if (SUCCEEDED(spType->GetRefTypeOfImplType(::sal::static_int_cast< UINT, int >( -1 ), &refDispatch))) - { - CComPtr spTypeDisp; - if (SUCCEEDED(spType->GetRefTypeInfo(refDispatch, & spTypeDisp))) - m_spTypeInfo= spTypeDisp; - } - else - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] Could not obtain type information " - "for dispatch interface." )); - } - } - else if (typeAttr->typekind == TKIND_DISPATCH) - { - m_spTypeInfo= spType; - } - else - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] Automation object does not " - "provide type information.")); - } - } - } - else - { - throw BridgeRuntimeError(OUSTR("[automation bridge]The dispatch object does not " - "support ITypeInfo!")); - } - } - } - return m_spTypeInfo; -} - -} // end namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx deleted file mode 100644 index 387d91d60..000000000 --- a/extensions/source/ole/oleobjw.hxx +++ /dev/null @@ -1,295 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __OLEOBJW_HXX -#define __OLEOBJW_HXX -#include "ole2uno.hxx" - -#ifdef _MSC_VER -#pragma warning (push,1) -#pragma warning (disable:4548) -#endif - -#include -#define _WIN32_WINNT 0x0403 - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include -#include -#include -#include - -#ifdef _MSC_VER -#pragma warning (pop) -#endif -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include "unoconversionutilities.hxx" -#include "windata.hxx" -using namespace cppu; -using namespace std; -using namespace com::sun::star::lang; -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::oleautomation; - -using ::rtl::OUString; -namespace ole_adapter -{ - - - -typedef boost::unordered_map, hashOUString_Impl, equalOUString_Impl> DispIdMap; - -typedef boost::unordered_multimap TLBFuncIndexMap; - -// This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object. -// If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component. -// The interface is not a real interface in terms of an abstract class but is realized through IDispatch. -class IUnknownWrapper_Impl : public WeakImplHelper8< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >, - - public UnoConversionUtilities - -{ -public: - IUnknownWrapper_Impl(Reference &xFactory, - sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass); - - ~IUnknownWrapper_Impl(); - - //XInterface - Any SAL_CALL queryInterface(const Type& t) - throw (RuntimeException); - - // XInvokation - virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) - throw(RuntimeException); - virtual Any SAL_CALL invoke( const OUString& aFunctionName, - const Sequence< Any >& aParams, - Sequence< sal_Int16 >& aOutParamIndex, - Sequence< Any >& aOutParam ) - throw(IllegalArgumentException, CannotConvertException, - InvocationTargetException, RuntimeException); - virtual void SAL_CALL setValue( const OUString& aPropertyName, - const Any& aValue ) - throw(UnknownPropertyException, CannotConvertException, - InvocationTargetException, RuntimeException); - virtual Any SAL_CALL getValue( const OUString& aPropertyName ) - throw(UnknownPropertyException, RuntimeException); - virtual sal_Bool SAL_CALL hasMethod( const OUString& aName ) - throw(RuntimeException); - virtual sal_Bool SAL_CALL hasProperty( const OUString& aName ) - throw(RuntimeException); - - // XBridgeSupplier2 - // This interface is implemented to provide a safe way to obtain the original - // IUnknown or IDispatch within the function anyToVariant. The function asks - // every UNO object for its XBridgeSupplier2 and if it is available uses it to convert - // the object with its own supplier. - virtual Any SAL_CALL createBridge( const Any& modelDepObject, - const Sequence< sal_Int8 >& aProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType ) - throw(IllegalArgumentException, RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException); - - // XDefaultProperty - virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } - - // XDefaultMethod - virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } - - virtual ::com::sun::star::uno::Any SAL_CALL invokeGetProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL invokePutProperty( const ::rtl::OUString& aFunctionName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< ::sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException); - - // XDirectInvocation - virtual ::com::sun::star::uno::Any SAL_CALL directInvoke( const ::rtl::OUString& aName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasMember( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); - - - Any invokeWithDispIdComTlb(FuncDesc& aFuncDesc, - const OUString& sFuncName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam); - - -protected: - // ---------------------------------------------------------------------------- - virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName, - const Sequence< Any >& Params, - Sequence& OutParamIndex, - Sequence< Any >& OutParam); - // Is used for OleObjectFactory service - virtual Any invokeWithDispIdComTlb(const OUString& sFuncName, - const Sequence< Any >& Params, - Sequence< sal_Int16 >& OutParamIndex, - Sequence< Any >& OutParam); - -// virtual void setValueWithDispId(DISPID dispID, const Any& Value); - -// virtual Any getValueWithDispId(const OUString& sName, DISPID dispID); - - - // UnoConversionUtilities ------------------------------------------------------------------------------- - virtual Reference createUnoWrapperInstance(); - virtual Reference createComWrapperInstance(); - - /**Obtains a FUNCDESC structure for a function. - Fills the FUNCDESC structure if ITypeInfo provides information for - the function of name sFuncName or pFuncDesc will not be filled in. - May throw a BridgeRuntimeError. - */ - void getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc); - /**Obtains a FUNCDESC structures or a VARDESC structure - for a property. pFuncDescPut may also contain - a structure for a "propertyputref" operation. If pFuncDesc contains a - "put ref" or "put" FUNCDESC depends on what was found first in the type - description. - Fills the FUNCDESC structure if ITypeInfo provides information for - the respective property functions or the structures will not be filled in. - May throw a BridgeRuntimeError. - */ - void getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncDescGet, - FUNCDESC** pFuncDescPut, VARDESC ** pVarDesc); - // These functions are for the case if an object of this class wraps an IDispatch - // object that implements UNO interfaces. In that case the member m_seqTypes - // is set through XInitialization::initialize. - void getMethodInfo(const OUString& sName, TypeDescription& methodDescription); - // After return attributInfo contains typelib_InterfaceAttributeTypeDescription::pAttributeTypeRef - void getAttributeInfo(const OUString& sName, TypeDescription& attributeInfo); - // used by get MethodInfo - TypeDescription getInterfaceMemberDescOfCurrentCall(const OUString& sName); - /** Returns alway a valid ITypeInfo interface or throws a BridgeRuntimeError. - The returned interface does not need to be AddRef'ed as long as it is locally - used. The interface is kept in the instance of this class. - */ - ITypeInfo* getTypeInfo(); - - /** Returns the DISPID for a function or property name. If true is returned then - id contains a valid DISPID. - */ - - bool getDispid(const OUString& sFuncName, DISPID * id); - - VARTYPE getUserDefinedElementType( ITypeInfo* pTypeInfo, const DWORD nHrefType ); - - /** Gets the element type in a VARIANT like style. E.g. if desc->lptdesc contains - a VT_PTR than it is replaced by VT_BYREF and VT_SAFEARRAY is replaced by VT_ARRAY - If the TYPEDESC describes an SAFEARRAY then varType is a combination of VT_ARRAY - and the element type. - The argument desc must be obtained from FUNCDESC::lprgelemdescParam[i].tdesc where - FUNCDESC was obtained from the ITypeInfo belonging to wrapped IDispatch. - */ - VARTYPE getElementTypeDesc( const TYPEDESC *desc); - /** Iterates over all functions and put the names and indices into the map - m_mapComFunc of type TLBFuncIndexMap. - Call the function every time before accessing the map. - Throws a BridgeRuntimeError on failure. - */ - void buildComTlbIndex(); - - /** Returns a FUNCDESC structure which contains type information about the - current XInvocation::invoke call. The FUNCDESC either describes a method, - a property put or a property get operation. - It uses the types com.sun.star.bridge.oleautomation.PropertyPutArgument - which can be - contained in the sequence of in-arguments of invoke to determine if the call is - a property put or property get operation. - If no adequate FUNCDESC was found, an IllegalArgumentException is thrown. - Therefore it is safe to assume that the returned FUNCDESC* is not NULL. - - @exception IllegalArgumentException - Thrown if no adequate FUNCDESC could be found. - */ - void getFuncDescForInvoke(const OUString & sFuncName, - const Sequence & seqArgs, FUNCDESC** pFuncDesc); - - // Finds out wheter the wrapped IDispatch is an JScript Object. This is is - // done by - // asking for the property "_environment". If it has the value "JScript" - // (case insensitive) then the IDispatch is considered a JScript object. - sal_Bool isJScriptObject(); - // ------------------------------------------------------------------------------- - - // If UNO interfaces are implemented in JScript objects, VB or C++ COM objects - // and those are passed as parameter to a UNO interface function, then - // the IDispatch* are wrapped by objects of this class. Assuming that the functions - // implemented by the IDispatch object returns another UNO interface then - // it has to be wrapped to this type. But this is only possible if an object of this - // wrapper class knows what type it is represting. The member m_TypeDescription holds this - // information. - // m_TypeDescription is only useful when an object wraps an IDispatch object that implements - // an UNO interface. The value is set during a call to XInitialization::initialize. - Sequence m_seqTypes; - CComPtr m_spUnknown; - CComPtr m_spDispatch; - rtl::OUString m_sTypeName; // is "" ( not initialised ), "IDispatch" ( we have no idea ) or "SomeLibrary.SomeTypeName" if we managed to get a type - /** This value is set dureing XInitialization::initialize. It indicates that the COM interface - was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN - */ - sal_Bool m_bOriginalDispatch; - DispIdMap m_dispIdMap; - Reference* m_pxIdlClass; - - - // used by isJScriptObject - enum JScriptDetermination{ JScriptUndefined=0, NoJScript, IsJScript}; - JScriptDetermination m_eJScript; - // The map is filled by buildComTlbIndex - // It maps Uno Function names to an index which is used in ITypeInfo::GetFuncDesc - TLBFuncIndexMap m_mapComFunc; - // used for synchroizing the computation of the content for m_mapComFunc - bool m_bComTlbIndexInit; - // Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo - CComPtr< ITypeInfo > m_spTypeInfo; - rtl::OUString m_sDefaultMember; - bool m_bHasDfltMethod; - bool m_bHasDfltProperty; -}; - -} // end namespace -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx deleted file mode 100644 index bd6f5fbce..000000000 --- a/extensions/source/ole/olethread.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#if defined _MSC_VER && ( _MSC_VER >= 1200 ) -#define _WIN32_WINNT 0x0400 -#endif - -#include "ole2uno.hxx" - -#include -#include - -#include - -using namespace std; - -namespace ole_adapter -{ -// CoInitializeEx * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD); -// CoInitialize * -typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID); - -void o2u_attachCurrentThread() -{ - static osl::ThreadData oleThreadData; - - if ((sal_Bool)(sal_IntPtr)oleThreadData.getData() != sal_True) - { - HINSTANCE inst= LoadLibrary( _T("ole32.dll")); - if( inst ) - { - HRESULT hr; - // Try DCOM - ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx")); - if( initFuncEx) - hr= initFuncEx( NULL, COINIT_MULTITHREADED); - // No DCOM, try COM - else - { - ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize")); - if( initFunc) - hr= initFunc( NULL); - } - } - oleThreadData.setData((void*)sal_True); - } -} - -} // end namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx deleted file mode 100644 index d939927b4..000000000 --- a/extensions/source/ole/servprov.cxx +++ /dev/null @@ -1,754 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -#ifdef __MINGW32__ -#define INITGUID -#include -#else -#include "ole2uno.hxx" -#include "unoconversionutilities.hxx" -#endif -#include "servprov.hxx" -#include "unoobjw.hxx" -#include "oleobjw.hxx" -#include - -#include -#define _WIN32_WINNT 0x0403 - -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -#undef _DEBUG -#endif -#include -extern CComModule _Module; -#include -#include - - -using namespace cppu; -using namespace osl; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::ModelDependent; - -using ::rtl::OUString; - -namespace ole_adapter -{ - -#include - -#ifndef OWNGUID -// GUID used since 5.2 ( src569 m) -// {82154420-0FBF-11d4-8313-005004526AB4} -DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4); -#else -// Alternative GUID -// {D9BB9D1D-BFA9-4357-9F11-9A2E9061F06E} -DEFINE_GUID(OID_ServiceManager, 0xd9bb9d1d, 0xbfa9, 0x4357, 0x9f, 0x11, 0x9a, 0x2e, 0x90, 0x61, 0xf0, 0x6e); -#endif - -extern rtl_StandardModuleCount globalModuleCount; - -/***************************************************************************** - - class implementation ProviderOleWrapper_Impl - -*****************************************************************************/ - -ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference& smgr, - const Reference& xSFact, GUID* pGuid) - : m_xSingleServiceFactory(xSFact), - m_smgr( smgr) -{ - m_guid = *pGuid; - - Reference xInt = smgr->createInstance(reinterpret_cast(L"com.sun.star.bridge.oleautomation.BridgeSupplier")); - - if (xInt.is()) - { - Any a= xInt->queryInterface( ::getCppuType( reinterpret_cast< - Reference< XBridgeSupplier2>* >(0))); - a >>= m_bridgeSupplier; - - } -} - -ProviderOleWrapper_Impl::~ProviderOleWrapper_Impl() -{ -} - -sal_Bool ProviderOleWrapper_Impl::registerClass() -{ - HRESULT hresult; - - o2u_attachCurrentThread(); - - hresult = CoRegisterClassObject( - m_guid, - this, - CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE, - &m_factoryHandle); - - return (hresult == NOERROR); -} - -sal_Bool ProviderOleWrapper_Impl::deregisterClass() -{ - HRESULT hresult = CoRevokeClassObject(m_factoryHandle); - - return (hresult == NOERROR); -} - -STDMETHODIMP ProviderOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IClassFactory*) this; - return NOERROR; - } - else if (IsEqualIID(riid, IID_IClassFactory)) - { - AddRef(); - *ppv = (IClassFactory*) this; - return NOERROR; - } - - *ppv = NULL; - return ResultFromScode(E_NOINTERFACE); -} - -STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::AddRef() -{ - return osl_incrementInterlockedCount( &m_refCount); -} - -STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::Release() -{ - MutexGuard aGuard( Mutex::getGlobalMutex()); - ULONG refCount = --m_refCount; - if (m_refCount == 0) - { - delete this; - } - - return refCount; -} - -STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) -{ - HRESULT ret = ResultFromScode(E_UNEXPECTED); - punkOuter = NULL; - - Reference xInstance; - - if (m_xSingleServiceFactory.is()) - { - xInstance = m_xSingleServiceFactory->createInstance(); - - if (xInstance.is()) - { - Any usrAny(&xInstance, getCppuType( & xInstance)); - - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId ); - Any oleAny = m_bridgeSupplier->createBridge(usrAny, - Sequence((sal_Int8*)arId, 16), - UNO, - OLE); - - - if (oleAny.getValueTypeClass() == getCppuType( (sal_uInt32 *)0).getTypeClass()) - { - VARIANT* pVariant = *(VARIANT**)oleAny.getValue(); - - if (pVariant->vt == VT_DISPATCH) - { - ret = pVariant->pdispVal->QueryInterface(riid, ppv); - } - - VariantClear(pVariant); - CoTaskMemFree(pVariant); - } - } - } - - return ret; -} - -STDMETHODIMP ProviderOleWrapper_Impl::LockServer(int /*fLock*/) -{ - return NOERROR; -} - -/***************************************************************************** - - class implementation OneInstanceOleWrapper_Impl - -*****************************************************************************/ - -OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl( const Reference& smgr, - const Reference& xInst, - GUID* pGuid, - sal_Bool bAsApplication ) - : m_xInst(xInst), m_refCount(0), - m_smgr( smgr), - m_factoryHandle( 0 ), - m_bAsApplication( bAsApplication ), - m_nApplRegHandle( 0 ) -{ - m_guid = *pGuid; - - Reference xInt = m_smgr->createInstance(reinterpret_cast(L"com.sun.star.bridge.oleautomation.BridgeSupplier")); - - if (xInt.is()) - { - Any a= xInt->queryInterface( getCppuType( - reinterpret_cast< Reference*>(0))); - a >>= m_bridgeSupplier; - } -} - -OneInstanceOleWrapper_Impl::~OneInstanceOleWrapper_Impl() -{ -} - -sal_Bool OneInstanceOleWrapper_Impl::registerClass() -{ - HRESULT hresult; - - o2u_attachCurrentThread(); - - hresult = CoRegisterClassObject( - m_guid, - this, - CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE, - &m_factoryHandle); - - if ( hresult == NOERROR && m_bAsApplication ) - hresult = RegisterActiveObject( this, m_guid, ACTIVEOBJECT_WEAK, &m_nApplRegHandle ); - - return (hresult == NOERROR); -} - -sal_Bool OneInstanceOleWrapper_Impl::deregisterClass() -{ - HRESULT hresult1 = NOERROR; - if ( m_bAsApplication ) - hresult1 = RevokeActiveObject( m_nApplRegHandle, NULL ); - - HRESULT hresult2 = CoRevokeClassObject(m_factoryHandle); - - return (hresult1 == NOERROR && hresult2 == NOERROR); -} - -STDMETHODIMP OneInstanceOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IClassFactory*) this; - return NOERROR; - } - else if (IsEqualIID(riid, IID_IClassFactory)) - { - AddRef(); - *ppv = (IClassFactory*) this; - return NOERROR; - } - - *ppv = NULL; - return ResultFromScode(E_NOINTERFACE); -} - -STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::AddRef() -{ - return osl_incrementInterlockedCount( &m_refCount); -} - -STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::Release() -{ - MutexGuard oGuard( Mutex::getGlobalMutex()); - ULONG refCount = --m_refCount; - if ( m_refCount == 0) - { - delete this; - } - - return refCount; -} - -STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) -{ - HRESULT ret = ResultFromScode(E_UNEXPECTED); - punkOuter = NULL; - - if (m_xInst.is()) - { - Any usrAny(&m_xInst, getCppuType( &m_xInst)); - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId); - Any oleAny = m_bridgeSupplier->createBridge(usrAny, - Sequence( (sal_Int8*)arId, 16), - UNO, - OLE); - - - if (oleAny.getValueTypeClass() == TypeClass_UNSIGNED_LONG) - { - VARIANT* pVariant = *(VARIANT**)oleAny.getValue(); - - if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH)) - { - ret = pVariant->punkVal->QueryInterface(riid, ppv); - } - - VariantClear(pVariant); - CoTaskMemFree(pVariant); - } - } - - return ret; -} - -STDMETHODIMP OneInstanceOleWrapper_Impl::LockServer(int /*fLock*/) -{ - return NOERROR; -} - - -/***************************************************************************** - - class implementation OleConverter_Impl2 - -*****************************************************************************/ - -OleConverter_Impl2::OleConverter_Impl2( const Reference &smgr): - UnoConversionUtilities( smgr) - -{ - // library unloading support - globalModuleCount.modCnt.acquire( &globalModuleCount.modCnt); -} - -// The XMultiServiceFactory is later set by XInitialization -OleConverter_Impl2::OleConverter_Impl2( const Reference& smgr, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ): - UnoConversionUtilities( smgr, unoWrapperClass, comWrapperClass ) - -{ - //library unloading support - globalModuleCount.modCnt.acquire( &globalModuleCount.modCnt); -} - -OleConverter_Impl2::~OleConverter_Impl2() -{ - globalModuleCount.modCnt.release( &globalModuleCount.modCnt); -} - -// XBridgeSupplier -------------------------------------------------------------- -Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject, - const Sequence< sal_Int8 >& ProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType) - throw (IllegalArgumentException, - RuntimeException ) -{ - Any ret; - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId ); - - Sequence< sal_Int8 > seqProcessId( (sal_Int8*)arId, 16); - - if ( seqProcessId == ProcessId) - { - if (sourceModelType == UNO) - { - if (destModelType == UNO) - { - // same model -> copy value only - ret = modelDepObject; - } - else if (destModelType == OLE) - { - // convert UNO any into variant - VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT)); - VariantInit( pVariant); - try - { - anyToVariant( pVariant, modelDepObject); - } - catch(...) - { - CoTaskMemFree(pVariant); - throw IllegalArgumentException(); - } - ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0)); - } - else - throw IllegalArgumentException(); - } - else if (sourceModelType == OLE) - { - if (modelDepObject.getValueType() != getCppuType((sal_uInt32*)0)) - { - throw IllegalArgumentException(); - } - else if (destModelType == OLE) - { - // same model -> copy value only - VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT)); - - if (NOERROR != VariantCopy(pVariant, *(VARIANT**)modelDepObject.getValue())) - { - CoTaskMemFree(pVariant); - throw(IllegalArgumentException()); - } - else - { - ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0)); - } - } - else if (destModelType == UNO) - { - // convert variant into UNO any - VARIANT* pVariant = *(VARIANT**)modelDepObject.getValue(); - try - { - variantToAny(pVariant, ret); - } - catch (CannotConvertException & e) - { - throw IllegalArgumentException( - e.Message, 0, -1); - } - } - else - throw IllegalArgumentException(); - - } - else - throw IllegalArgumentException(); - } - - return ret; -} - - -// XInitialize ------------------------------------------------------------------------------ -// the first argument is an XMultiServiceFactory if at all -void SAL_CALL OleConverter_Impl2::initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException) -{ - if( aArguments.getLength() == 1 && aArguments[0].getValueTypeClass() == TypeClass_INTERFACE) - { - Reference < XInterface > xInt; - aArguments[0] >>= xInt; - Reference xMulti( xInt, UNO_QUERY); - m_smgrRemote= xMulti; - } -} - -// UnoConversionUtilities ------------------------------------------------------------------- -Reference< XInterface > OleConverter_Impl2::createUnoWrapperInstance() -{ - if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL) - { - Reference xWeak= static_cast( new InterfaceOleWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT) - { - Reference xWeak= static_cast( new UnoObjectWrapperRemoteOpt( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else - return Reference(); -} - -Reference< XInterface > OleConverter_Impl2::createComWrapperInstance() -{ - Reference xWeak= static_cast( new IUnknownWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - - - -/***************************************************************************** - - class implementation OleClient_Impl - -*****************************************************************************/ - -OleClient_Impl::OleClient_Impl( const Reference& smgr): - UnoConversionUtilities( smgr) -{ - // library unloading support - globalModuleCount.modCnt.acquire( &globalModuleCount.modCnt); - Reference xInt;// = m_smgr->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2"); - - if (xInt.is()) - { - Any a= xInt->queryInterface(getCppuType( - reinterpret_cast*>(0))); - a >>= m_bridgeSupplier; - } -} - -OleClient_Impl::~OleClient_Impl() -{ - // library unloading support - globalModuleCount.modCnt.release( &globalModuleCount.modCnt); -} - -Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() throw( RuntimeException ) -{ - Sequence< OUString > ret; - - return ret; -} - - -OUString OleClient_Impl::getImplementationName() -{ - return OUString(reinterpret_cast(L"com.sun.star.comp.ole.OleClient")); -} - -Reference SAL_CALL OleClient_Impl::createInstance(const OUString& ServiceSpecifier) throw (Exception, RuntimeException ) -{ - Reference ret; - HRESULT result; - IUnknown* pUnknown = NULL; - CLSID classId; - - o2u_attachCurrentThread(); - - result = CLSIDFromProgID( - reinterpret_cast(ServiceSpecifier.getStr()), //Pointer to the ProgID - &classId); //Pointer to the CLSID - - - if (result == NOERROR) - { - result = CoCreateInstance( - classId, //Class identifier (CLSID) of the object - NULL, //Pointer to whether object is or isn't part of an aggregate - CLSCTX_SERVER, //Context for running executable code - IID_IUnknown, //Reference to the identifier of the interface - (void**)&pUnknown); //Address of output variable that receives - // the interface pointer requested in riid - } - - if (pUnknown != NULL) - { - Any any; - CComVariant variant; - - V_VT(&variant) = VT_UNKNOWN; - V_UNKNOWN(&variant) = pUnknown; - // AddRef for Variant - pUnknown->AddRef(); - - // When the object is wrapped, then its refcount is increased - variantToAny(&variant, any); - if (any.getValueTypeClass() == TypeClass_INTERFACE) - { - any >>= ret; - } - pUnknown->Release(); // CoCreateInstance - } - - return ret; -} - -Reference SAL_CALL OleClient_Impl::createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& /*Arguments*/) throw (Exception, RuntimeException) -{ - return createInstance( ServiceSpecifier); -} - -// UnoConversionUtilities ----------------------------------------------------------------------------- -Reference< XInterface > OleClient_Impl::createUnoWrapperInstance() -{ - if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL) - { - Reference xWeak= static_cast( new InterfaceOleWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT) - { - Reference xWeak= static_cast( new UnoObjectWrapperRemoteOpt( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); - } - else - return Reference< XInterface>(); -} -// UnoConversionUtilities ----------------------------------------------------------------------------- -Reference< XInterface > OleClient_Impl::createComWrapperInstance( ) -{ - Reference xWeak= static_cast( new IUnknownWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - - - -/***************************************************************************** - - class implementation OleServer_Impl - -*****************************************************************************/ - -OleServer_Impl::OleServer_Impl( const Reference& smgr): - m_smgr( smgr) -{ - //library unloading support - globalModuleCount.modCnt.acquire( &globalModuleCount.modCnt); - Reference xInt = m_smgr->createInstance(reinterpret_cast(L"com.sun.star.bridge.oleautomation.BridgeSupplier")); - - if (xInt.is()) - { - Any a= xInt->queryInterface( getCppuType( - reinterpret_cast< Reference*>(0))); - a >>= m_bridgeSupplier; - } - -#ifndef OWNGUID - sal_Bool bOLERegister = sal_False; -#else - sal_Bool bOLERegister = sal_True; -#endif - sal_Bool ret = provideInstance( m_smgr, (GUID*)&OID_ServiceManager, bOLERegister ); - (void)ret; -} - -OleServer_Impl::~OleServer_Impl() -{ - while (!m_wrapperList.empty()) - { - (*m_wrapperList.begin())->deregisterClass(); - (*m_wrapperList.begin())->Release(); - m_wrapperList.pop_front(); - } - //library unloading support - globalModuleCount.modCnt.release( &globalModuleCount.modCnt); -} -// XInterface -------------------------------------------------- -Any SAL_CALL OleServer_Impl::queryInterface( const Type& aType ) throw(RuntimeException) -{ - Any a= ::cppu::queryInterface( aType, static_cast(this)); - if( a == Any()) - return OWeakObject::queryInterface( aType); - else - return a; -} -void SAL_CALL OleServer_Impl::acquire( ) throw() -{ - OWeakObject::acquire(); -} -void SAL_CALL OleServer_Impl::release( ) throw () -{ - OWeakObject::release(); -} - - -// XTypeProvider -------------------------------------------------- -Sequence< Type > SAL_CALL OleServer_Impl::getTypes( ) throw(RuntimeException) -{ - static OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static OTypeCollection collection( - getCppuType(reinterpret_cast< Reference< XWeak>*>(0)), - getCppuType(reinterpret_cast< Reference< XTypeProvider>*>(0)) ); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); -} -Sequence< sal_Int8 > SAL_CALL OleServer_Impl::getImplementationId() throw(RuntimeException) -{ - static OImplementationId *pId = 0; - if( ! pId ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pId ) - { - static OImplementationId id( sal_False ); - pId = &id; - } - } - return (*pId).getImplementationId(); -} - - -sal_Bool OleServer_Impl::provideService(const Reference& xSFact, GUID* guid) -{ - IClassFactoryWrapper* pFac = new ProviderOleWrapper_Impl( m_smgr, xSFact, guid); - - pFac->AddRef(); - - m_wrapperList.push_back(pFac); - - return pFac->registerClass(); -} - -sal_Bool OleServer_Impl::provideInstance(const Reference& xInst, GUID* guid, sal_Bool bAsApplication ) -{ - IClassFactoryWrapper* pFac = new OneInstanceOleWrapper_Impl( m_smgr, xInst, guid, bAsApplication ); - - pFac->AddRef(); - m_wrapperList.push_back(pFac); - - return pFac->registerClass(); -} - - - -} // end namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx deleted file mode 100644 index 9b4264fb4..000000000 --- a/extensions/source/ole/servprov.hxx +++ /dev/null @@ -1,276 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SERVPROV_HXX -#define _SERVPROV_HXX - -#include -#include - -#include "ole2uno.hxx" -#include "unoconversionutilities.hxx" - -using namespace com::sun::star::bridge; -using namespace cppu; -using namespace std; - -namespace ole_adapter -{ -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance( const Reference & xSMgr) - throw( Exception); -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference & xSMgr) - throw( Exception); -Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference & xSMgr) - throw( Exception); -Reference SAL_CALL OleClient_CreateInstance( const Reference & xSMgr) - throw( Exception); -Reference SAL_CALL OleServer_CreateInstance( const Reference & xSMgr) - throw( Exception); -/***************************************************************************** - - class declaration IClassFactoryWrapper - - Specify abstract helper methods on class factories, which provide - UNO objects. These methods are used by objects of class OleServer_Impl, - to handle the OLE registration of different class factories. - -*****************************************************************************/ - -class IClassFactoryWrapper : public IClassFactory -{ -public: - - virtual sal_Bool registerClass() = 0; - virtual sal_Bool deregisterClass() = 0; -}; - -/***************************************************************************** - - class declaration ProviderOleWrapper_Impl - - Provides an UNO service provider as OLE class factory. Handle the - OLE registration by overloading the abstract methods from - IClassFactoryWrapper. - - Acts as a COM class factory. When IClassFactory::CreateInstance is being called - then it creates an service by help of the XSingleServiceFactory member and maps - maps it to a COM object. - -*****************************************************************************/ - -class ProviderOleWrapper_Impl : public IClassFactoryWrapper -{ -public: - - ProviderOleWrapper_Impl( const Reference& smgr, - const Reference& xSFactory, GUID* pGuid); - virtual ~ProviderOleWrapper_Impl(); - - sal_Bool registerClass(); - sal_Bool deregisterClass(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); - STDMETHOD(LockServer)(int fLock); - -protected: - - oslInterlockedCount m_refCount; - Reference m_xSingleServiceFactory; - GUID m_guid; - DWORD m_factoryHandle; - Reference m_bridgeSupplier; - Reference m_smgr; -}; - -/***************************************************************************** - - class declaration OneInstanceOleWrapper_Impl - - Provides an single UNO object as OLE object. Handle the - OLE registration by overloading the abstract methods from - IClassFactoryWrapper. - - Acts as a COM class factory. When IClassFactory::CreateInstance is being called - then it maps the XInstance member it to a COM object. - -*****************************************************************************/ - -class OneInstanceOleWrapper_Impl : public IClassFactoryWrapper -{ -public: - - OneInstanceOleWrapper_Impl( const Reference& smgr, const Reference& xInst, GUID* pGuid, sal_Bool bAsApplication ); - virtual ~OneInstanceOleWrapper_Impl(); - - sal_Bool registerClass(); - sal_Bool deregisterClass(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); - STDMETHOD(LockServer)(int fLock); - -protected: - - oslInterlockedCount m_refCount; - Reference m_xInst; - GUID m_guid; - DWORD m_factoryHandle; - Reference m_bridgeSupplier; - Reference m_smgr; - unsigned long m_nApplRegHandle; - sal_Bool m_bAsApplication; -}; - -/***************************************************************************** - - class declaration OleConverter_Impl2 - - Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2. - -*****************************************************************************/ - -// This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and -// com.sun.star.bridge.OleBridgeSupplierVar1. The class implements XBridgeSupplier2 -// instead of XBridgeSuppplier as done by class OleConverter_Impl. The XBridgeSupplier2 -// interface does not need a Maschine Id in its createBridge function anymore, -// If an UNO interface is to be converted then the member m_nUnoWrapperClass determines -// what wrapper class is to be used. There are currently InterfaceOleWrapper_Impl and -// UnoObjectWrapperRemoteOpt. The first is used for the OleBridgeSupplier2 and the -// latter for OleBridgeSupplierVar1. -// The m_nComWrapperClass specifies the class which is used as wrapper for COM interfaces. -// Currently there is only one class available ( IUnknownWrapper_Impl). -class OleConverter_Impl2 : public WeakImplHelper2, - public UnoConversionUtilities -{ -public: - OleConverter_Impl2( const Reference& smgr); - OleConverter_Impl2( const Reference& smgr, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ); - virtual ~OleConverter_Impl2(); - - // XBridgeSupplier2 --------------------------------------------------- - - virtual Any SAL_CALL createBridge(const Any& modelDepObject, - const Sequence& ProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType) - throw (IllegalArgumentException, RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); - - // Abstract struct UnoConversionUtilities - virtual Reference< XInterface > createUnoWrapperInstance(); - virtual Reference< XInterface > createComWrapperInstance(); -protected: - -}; - - -/***************************************************************************** - - class declaration OleClient_Impl - - Implementation of the UNO service com.sun.star.bridge.OleObjectFactory. - -*****************************************************************************/ - - -class OleClient_Impl : public WeakImplHelper1, - public UnoConversionUtilities -{ -public: - OleClient_Impl( const Reference& smgr); - ~OleClient_Impl(); - - // XMultiServiceFactory - virtual Reference SAL_CALL createInstance(const OUString& ServiceSpecifier) throw( Exception, RuntimeException); - virtual Reference SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException); - Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException); - - // Abstract struct UnoConversionUtilities - virtual Reference< XInterface > createUnoWrapperInstance(); - virtual Reference< XInterface > createComWrapperInstance(); - - - OUString getImplementationName(); -protected: - Reference m_bridgeSupplier; -}; - -/***************************************************************************** - - class declaration OleServer_Impl - - Implementation of the UNO service com.sun.star.bridge.OleApplicationRegistration. - Register the calling application as OLE automation server for - standard OLE object. The objects will be registered while instanciating - this implementation and deregistrated, if this implementation is destroyed. - -*****************************************************************************/ - -class OleServer_Impl : public OWeakObject, XTypeProvider -{ -public: - OleServer_Impl( const Reference &smgr); - ~OleServer_Impl(); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type& aType ) throw(RuntimeException); - virtual void SAL_CALL acquire( ) throw (); - virtual void SAL_CALL release( ) throw (); - - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes( ) throw(RuntimeException); - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException); - -protected: - - sal_Bool provideService(const Reference& xMulFact, GUID* guid); - sal_Bool provideInstance(const Reference& xInst, GUID* guid, sal_Bool bAsApplication ); - - list< IClassFactoryWrapper* > m_wrapperList; - Reference< XBridgeSupplier2 > m_bridgeSupplier; - - Reference m_smgr; -}; - -} // end namespace -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx deleted file mode 100644 index 5e49c5da8..000000000 --- a/extensions/source/ole/servreg.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include "ole2uno.hxx" -#include "servprov.hxx" -#include -#include -using namespace ole_adapter; -using namespace cppu; - -using ::rtl::OUString; - -namespace ole_adapter -{ -rtl_StandardModuleCount globalModuleCount= MODULE_COUNT_INIT; - - - -Reference SAL_CALL ConverterProvider_CreateInstance2( const Reference & xSMgr) - throw(Exception) -{ - Reference xService = *new OleConverter_Impl2( xSMgr); - return xService; -} - -Reference SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference & xSMgr) - throw(Exception) -{ - Reference xService = *new OleConverter_Impl2( xSMgr, UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL); - return xService; -} - -Reference SAL_CALL OleClient_CreateInstance( const Reference & xSMgr) - throw(Exception) -{ - Reference xService = *new OleClient_Impl( xSMgr); - return xService; -} - -Reference SAL_CALL OleServer_CreateInstance( const Reference & xSMgr) - throw (Exception) -{ - Reference xService = *new OleServer_Impl(xSMgr); - return xService; -} -} // end namespace - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - - OUString aImplName( OUString::createFromAscii( pImplName ) ); - Reference< XSingleServiceFactory > xFactory; - Sequence seqServiceNames; - if (pServiceManager && aImplName.equals( reinterpret_cast(L"com.sun.star.comp.ole.OleConverter2") )) - { - xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverter2")), - ConverterProvider_CreateInstance2, seqServiceNames, - &globalModuleCount.modCnt ); - } - else if (pServiceManager && aImplName.equals( reinterpret_cast(L"com.sun.star.comp.ole.OleConverterVar1") )) - { - xFactory= createSingleFactory( reinterpret_cast(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverterVar1")), - ConverterProvider_CreateInstanceVar1, seqServiceNames, - &globalModuleCount.modCnt ); - } - else if(pServiceManager && aImplName.equals(reinterpret_cast(L"com.sun.star.comp.ole.OleClient"))) - { - xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleClient")), - OleClient_CreateInstance, seqServiceNames, - &globalModuleCount.modCnt); - } - else if(pServiceManager && aImplName.equals(reinterpret_cast(L"com.sun.star.comp.ole.OleServer"))) - { - xFactory= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager), - OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleServer")), - OleServer_CreateInstance, seqServiceNames, - &globalModuleCount.modCnt); - } - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -extern "C" sal_Bool component_canUnload( TimeValue* libUnused) -{ - return globalModuleCount.canUnload( &globalModuleCount, libUnused); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx deleted file mode 100644 index 328fec41e..000000000 --- a/extensions/source/ole/unoconversionutilities.hxx +++ /dev/null @@ -1,2445 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _UNO_CONVERSION_UTILITIES -#define _UNO_CONVERSION_UTILITIES - -#include "boost/scoped_array.hpp" -#include "com/sun/star/script/XInvocationAdapterFactory.hpp" -#include "com/sun/star/script/XInvocationAdapterFactory2.hpp" -#include "com/sun/star/script/XTypeConverter.hpp" -#include "com/sun/star/script/FailReason.hpp" -#include "com/sun/star/bridge/oleautomation/Date.hpp" -#include "com/sun/star/bridge/oleautomation/Currency.hpp" -#include "com/sun/star/bridge/oleautomation/SCode.hpp" -#include "com/sun/star/bridge/oleautomation/Decimal.hpp" -#include "typelib/typedescription.hxx" -#include "ole2uno.hxx" - -#include "unotypewrapper.hxx" -#include - -// for some reason DECIMAL_NEG (wtypes.h) which contains BYTE is not resolved. -typedef unsigned char BYTE; -// classes for wrapping uno objects -#define INTERFACE_OLE_WRAPPER_IMPL 1 -#define UNO_OBJECT_WRAPPER_REMOTE_OPT 2 - -#define INVOCATION_SERVICE reinterpret_cast(L"com.sun.star.script.Invocation") - - -// classes for wrapping ole objects -#define IUNKNOWN_WRAPPER_IMPL 1 - -#define INTERFACE_ADAPTER_FACTORY reinterpret_cast(L"com.sun.star.script.InvocationAdapterFactory") -// COM or JScript objects implementing UNO interfaces have to implement this property -#define SUPPORTED_INTERFACES_PROP L"_implementedInterfaces" -// Second property without leading underscore for use in VB -#define SUPPORTED_INTERFACES_PROP2 L"Bridge_ImplementedInterfaces" - -using namespace com::sun::star::script; -using namespace com::sun::star::beans; -using namespace com::sun::star::uno; -#ifdef __MINGW32__ -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::ModelDependent; -#endif -using namespace com::sun::star::bridge::oleautomation; -using namespace boost; -namespace ole_adapter -{ -extern boost::unordered_map AdapterToWrapperMap; -extern boost::unordered_map WrapperToAdapterMap; -typedef boost::unordered_map::iterator IT_Wrap; -typedef boost::unordered_map::iterator CIT_Wrap; -//Maps IUnknown pointers to a weak reference of the respective wrapper class (e.g. -// IUnknownWrapperImpl. It is the responsibility of the wrapper to remove the entry when -// it is being destroyed. -// Used to ensure that an Automation object is always mapped to the same UNO objects. -extern boost::unordered_map > ComPtrToWrapperMap; -typedef boost::unordered_map >::iterator IT_Com; -typedef boost::unordered_map >::const_iterator CIT_Com; - -// Maps XInterface pointers to a weak reference of its wrapper class (i.e. -// InterfaceOleWrapper_Impl). It is the responsibility of the wrapper to remove the entry when -// it is being destroyed. It is used to ensure the identity of objects. That is, an UNO interface -// is mapped to IDispatch which is kept alive in the COM environment. If the same -// UNO interface is mapped again to COM then the IDispach of the first mapped instance -// must be returned. -extern boost::unordered_map > UnoObjToWrapperMap; -typedef boost::unordered_map >::iterator IT_Uno; -typedef boost::unordered_map >::const_iterator CIT_Uno; -#ifdef __MINGW32__ -inline void reduceRange( Any& any); -#endif - - - - -// createUnoObjectWrapper gets a wrapper instance by calling createUnoWrapperInstance - // and initializes it via XInitialization. The wrapper object is required to implement - // XBridgeSupplier so that it can convert itself to IDispatch. - // class T: Deriving class ( must implement XInterface ) -/** All methods are allowed to throw at least a BridgeRuntimeError. - */ -template< class > -class UnoConversionUtilities -{ -public: - UnoConversionUtilities( const Reference & smgr): - m_nUnoWrapperClass( INTERFACE_OLE_WRAPPER_IMPL), - m_nComWrapperClass( IUNKNOWN_WRAPPER_IMPL), - m_smgr( smgr) - {} - - UnoConversionUtilities( const Reference & xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ) - : m_smgr( xFactory), m_nComWrapperClass( comWrapperClass), m_nUnoWrapperClass( unoWrapperClass) - {} - - virtual ~UnoConversionUtilities() {} - /** converts only into oleautomation types, that is there is no VT_I1, VT_UI2, VT_UI4 - a sal_Unicode character is converted into a BSTR. - @exception com.sun.star.lang.IllegalArgumentException - If the any was inappropriate for conversion. - @exception com.sun.star.script.CannotConvertException - The any contains a type class for which no conversion is provided. - */ - void anyToVariant(VARIANT* pVariant, const Any& rAny); - void anyToVariant(VARIANT* pVariant, const Any& rAny, VARTYPE type); - - /** @exception com.sun.star.lang.IllegalArgumentException - If rSeq does not contain a sequence then the exception is thrown. - */ - SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq); - /** @exception com.sun.star.lang.IllegalArgumentException - If rSeq does not contain a sequence or elemtype has no proper value - then the exception is thrown. - */ - SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq, VARTYPE elemtype); - /** - @exception com.sun.star.lang.IllegalArgumentException - If rObj does not contain a struct or interface - */ - void createUnoObjectWrapper(const Any & rObj, VARIANT * pVar); - /** @exception CannotConvertException - Thrown if the VARIANT contains a type that cannot be coerced in the expected Any. - ArgumentIndex is 0. - @IllegalArgumentException - Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1, - */ - void variantToAny(const VARIANT* pVariant, Any& rAny, sal_Bool bReduceValueRange = sal_True); - /** This method converts variants arguments in calls from COM -> UNO. Only then - the expected UNO type is known. - @exception CannotConvertException - Thrown if the VARIANT contains a type that cannot be coerced in the expected Any. - ArgumentIndex is 0. - @IllegalArgumentException - Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1, - */ - void variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange = sal_True); - - /** - @exception IllegalArgumentException - -if pVar does not contain VT_UNKNOWN or VT_DISPATCH or - pVar is used for a particular UNO type which is not supported by pVar - */ - Any createOleObjectWrapper(VARIANT* pVar, const Type& aType= Type()); - - /* - Return true means var contained a ValueObject, and it was successfully converted. - The result is in any. It an error occurred a BridgeRuntimeError will be thrown. - */ - bool convertValueObject( const VARIANTARG *var, Any& any); - void dispatchExObject2Sequence( const VARIANTARG* pvar, Any& anySeq, const Type& type); - - Sequence createOleArrayWrapperOfDim(SAFEARRAY* pArray, unsigned int dimCount, unsigned int actDim, long* index, - VARTYPE type, const Type& unotype); - Sequence createOleArrayWrapper(SAFEARRAY* pArray, VARTYPE type, const Type& unotype= Type()); - - - VARTYPE mapTypeClassToVartype( TypeClass type); - Reference< XSingleServiceFactory > getInvocationFactory(const Any& anyObject); - - - virtual Reference< XInterface > createUnoWrapperInstance()=0; - virtual Reference< XInterface > createComWrapperInstance()=0; - - static sal_Bool isJScriptArray(const VARIANT* pvar); - - Sequence getImplementedInterfaces(IUnknown* pUnk); - -protected: - Reference createAdapter(const Sequence& types, const Reference& receiver); - - // helper function for Sequence conversion - void getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc); - // helper function for Sequence conversion - sal_Bool incrementMultidimensionalIndex(sal_Int32 dimensions, const sal_Int32 * parDimensionLength, - sal_Int32 * parMultidimensionalIndex); - // helper function for Sequence conversion - size_t getOleElementSize( VARTYPE type); - - Type getElementTypeOfSequence( const Type& seqType); - - //Provides a typeconverter - Reference getTypeConverter(); - - // This member determines what class is used to convert a UNO object - // or struct to a COM object. It is passed along to the o2u_anyToVariant - // function in the createBridge function implementation - sal_uInt8 m_nUnoWrapperClass; - sal_uInt8 m_nComWrapperClass; - - // The servicemanager is either a local smgr or remote when the service - // com.sun.star.bridge.OleBridgeSupplierVar1 is used. This service can be - // created by createInstanceWithArguments where one can supply a service - // manager that is to be used. - // Local service manager as supplied by the loader when the creator function - // of the service is being called. - Reference m_smgr; - // An explicitly supplied service manager when the service - // com.sun.star.bridge.OleBridgeSupplierVar1 is used. That can be a remote - // manager. - Reference m_smgrRemote; - Reference m_xInvocationFactoryLocal; - Reference m_xInvocationFactoryRemote; - -private: - // Holds the type converter which is used for sequence conversion etc. - // Use the getTypeConverter function to obtain the interface. - Reference m_typeConverter; - - -}; - -// ask the object for XBridgeSupplier2 and on success bridges -// the uno object to IUnknown or IDispatch. -// return true the UNO object supports -template < class T > -bool convertSelfToCom( T& unoInterface, VARIANT * pVar) -{ - bool ret = false; - Reference< XInterface > xInt( unoInterface, UNO_QUERY); - if( xInt.is()) - { - Reference< XBridgeSupplier2 > xSupplier( xInt, UNO_QUERY); - if( xSupplier.is()) - { - sal_Int8 arId[16]; - rtl_getGlobalProcessId( (sal_uInt8*)arId); - Sequence seqId( arId, 16); - Any anySource; - anySource <<= xInt; - Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE); - if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG) - { - VARIANT* pvariant= *(VARIANT**)anyDisp.getValue(); - HRESULT hr; - if (FAILED(hr = VariantCopy(pVar, pvariant))) - throw BridgeRuntimeError( - OUSTR("[automation bridge] convertSelfToCom\n" - "VariantCopy failed! Error: ") + - OUString::valueOf(hr)); - VariantClear( pvariant); - CoTaskMemFree( pvariant); - ret = true; - } - } - } - return ret; -} - - - -// Gets the invocation factory depending on the Type in the Any. -// The factory can be created by a local or remote multi service factory. -// In case there is a remote multi service factory available there are -// some services or types for which the local factory is used. The exceptions -// are: all structs. -// Param anyObject - contains the object ( interface, struct) for what we need an invocation object. -// -template -Reference< XSingleServiceFactory > UnoConversionUtilities::getInvocationFactory(const Any& anyObject) -{ - Reference< XSingleServiceFactory > retVal; - MutexGuard guard( getBridgeMutex()); - if( anyObject.getValueTypeClass() != TypeClass_STRUCT && - m_smgrRemote.is() ) - { - if( ! m_xInvocationFactoryRemote.is() ) - m_xInvocationFactoryRemote= Reference( - m_smgrRemote->createInstance( INVOCATION_SERVICE), UNO_QUERY); - retVal= m_xInvocationFactoryRemote; - } - else - { - if( ! m_xInvocationFactoryLocal.is() ) - m_xInvocationFactoryLocal= Reference( - m_smgr->createInstance(INVOCATION_SERVICE ), UNO_QUERY); - retVal= m_xInvocationFactoryLocal; - } - return retVal; -} - -template -void UnoConversionUtilities::variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange /* = sal_True */) -{ - try - { - HRESULT hr; - bool bFail = false; - bool bCannotConvert = false; - CComVariant var; - - // There is no need to support indirect values, since they're not supported by UNO - if( FAILED(hr= VariantCopyInd( &var, const_cast(pArg)))) // remove VT_BYREF - throw BridgeRuntimeError( - OUSTR("[automation bridge] UnoConversionUtilities::variantToAny \n" - "VariantCopyInd failed for reason : ") + OUString::valueOf(hr)); - bool bHandled = convertValueObject( & var, rAny); - if( bHandled) - OSL_ENSURE( rAny.getValueType() == ptype, "type in Value Object must match the type parameter"); - - if( ! bHandled) - { - // convert into a variant type that is the equivalent to the type - // the sequence expects. Thus variantToAny produces the correct type - // E.g. An Array object contains VT_I4 and the sequence expects shorts - // than the vartype must be changed. The reason is, you can't specify the - // type in JavaScript and the script engine determines the type beeing used. - switch( ptype.getTypeClass()) - { - case TypeClass_CHAR: // could be: new Array( 12, 'w', "w") - if( var.vt == VT_BSTR) - { - if(SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_BSTR))) - rAny.setValue( (void*)V_BSTR( &var), ptype); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - } - else - { - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I2))) - rAny.setValue((void*) & var.iVal, ptype); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - } - break; - case TypeClass_INTERFACE: // could also be an IUnknown - case TypeClass_STRUCT: - { - rAny = createOleObjectWrapper( & var, ptype); - break; - } - case TypeClass_ENUM: - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I4))) - rAny.setValue((void*) & var.lVal, ptype); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_SEQUENCE: - // There are different ways of receiving a sequence: - // 1: JScript, VARTYPE: VT_DISPATCH - // 2. VBScript simple arraysVT_VARIANT|VT_BYREF the referenced VARIANT contains - // a VT_ARRAY| - // 3. VBSrcript multi dimensional arrays: VT_ARRAY|VT_BYREF - if( pArg->vt == VT_DISPATCH) - { - dispatchExObject2Sequence( pArg, rAny, ptype); - } - else - { - if ((var.vt & VT_ARRAY) != 0) - { - VARTYPE oleType = ::sal::static_int_cast< VARTYPE, int >( var.vt ^ VT_ARRAY ); - Sequence unoSeq = createOleArrayWrapper( var.parray, oleType, ptype); - Reference conv = getTypeConverter(); - if (conv.is()) - { - try - { - Any anySeq = makeAny(unoSeq); - Any convAny = conv->convertTo(anySeq, ptype); - rAny = convAny; - } - catch (IllegalArgumentException& e) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]com.sun.star.lang.IllegalArgumentException " - "in UnoConversionUtilities::variantToAny! Message: ") + - e.Message); - } - catch (CannotConvertException& e) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]com.sun.star.script.CannotConvertException " - "in UnoConversionUtilities::variantToAny! Message: ") + - e.Message); - } - } - } - } - break; - case TypeClass_VOID: - rAny.setValue(NULL,Type()); - break; - case TypeClass_ANY: // Any - // There could be a JScript Array that needs special handling - // If an Any is expected and this Any must contain a Sequence - // then we cannot figure out what element type is required. - // Therefore we convert to Sequence< Any > - if( pArg->vt == VT_DISPATCH && isJScriptArray( pArg)) - { - dispatchExObject2Sequence( pArg, rAny, - getCppuType((Sequence*) 0)); - } - else if (pArg->vt == VT_DECIMAL) - { - //Decimal maps to hyper in calls from COM -> UNO - // It does not matter if we create a sal_uInt64 or sal_Int64, - // because the UNO object is called through invocation which - //will do a type conversion if necessary - if (var.decVal.sign == 0) - { - // positive value - variantToAny( & var, rAny, getCppuType( (sal_uInt64*) 0), - bReduceValueRange); - } - else - { - //negative value - variantToAny( & var, rAny, getCppuType( (sal_Int64*) 0), - bReduceValueRange); - } - } - else - { - variantToAny( & var, rAny); - } - break; - case TypeClass_BOOLEAN: // VARIANT could be VARIANT_BOOL or other - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_BOOL))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_STRING: // UString - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_BSTR))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_FLOAT: // float - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_R4))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_DOUBLE: // double - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_R8))) - variantToAny(& var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_BYTE: // BYTE - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I1))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_SHORT: // INT16 - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I2))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_LONG: - if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_I4))) - variantToAny( & var, rAny, bReduceValueRange); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_HYPER: - if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_DECIMAL))) - { - if (var.decVal.Lo64 > SAL_CONST_UINT64(0x8000000000000000) - || var.decVal.Hi32 > 0 - || var.decVal.scale > 0) - { - bFail = true; - break; - } - sal_Int64 value = var.decVal.Lo64; - if (var.decVal.sign == DECIMAL_NEG) - value |= SAL_CONST_UINT64(0x8000000000000000); - rAny <<= value; - } - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_UNSIGNED_SHORT: // UINT16 - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_UI2))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_UNSIGNED_LONG: - if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_UI4))) - variantToAny( & var, rAny, bReduceValueRange); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_UNSIGNED_HYPER: - if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_DECIMAL))) - { - if (var.decVal.Hi32 > 0 || var.decVal.scale > 0) - { - bFail = true; - break; - } - rAny <<= var.decVal.Lo64; - } - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - case TypeClass_TYPE: - if(SUCCEEDED(hr = VariantChangeType(& var, &var, 0, VT_UNKNOWN))) - variantToAny( & var, rAny); - else if (hr == DISP_E_TYPEMISMATCH) - bCannotConvert = true; - else - bFail = true; - break; - default: - bCannotConvert = true; - break; - } - } - if (bCannotConvert) - throw CannotConvertException( - OUSTR("[automation bridge]UnoConversionUtilities::variantToAny \n" - "Cannot convert the value of vartype :\"") + - OUString::valueOf((sal_Int32) var.vt) + - OUSTR("\" to the expected UNO type of type class: ") + - OUString::valueOf((sal_Int32) ptype.getTypeClass()), - 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); - - if (bFail) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities:variantToAny\n" - "The provided VARIANT of type\" ") + OUString::valueOf((sal_Int32) var.vt) + - OUSTR("\" is unappropriate for conversion!"), Reference(), -1); - } - catch (CannotConvertException &) - { - throw; - } - catch (IllegalArgumentException &) - { - throw; - } - catch (BridgeRuntimeError &) - { - throw; - } - catch (Exception & e) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::variantToAny ! Message : \n") + - e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::variantToAny !")); - } -} - -// The function only converts Sequences to SAFEARRAYS with elements of the type -// specified by the parameter type. Everything else is forwarded to -// anyToVariant(VARIANT* pVariant, const Any& rAny) -// Param type must not be VT_BYREF -template -void UnoConversionUtilities::anyToVariant(VARIANT* pVariant, const Any& rAny, VARTYPE type) -{ - try - { - HRESULT hr= S_OK; - - OSL_ASSERT( (type & VT_BYREF) == 0); - if (type & VT_ARRAY) - { - type ^= VT_ARRAY; - SAFEARRAY* ar= createUnoSequenceWrapper( rAny, type); - if( ar) - { - VariantClear( pVariant); - pVariant->vt= ::sal::static_int_cast< VARTYPE, int >( VT_ARRAY | type ); - pVariant->byref= ar; - } - } - else if(type == VT_VARIANT) - { - anyToVariant(pVariant, rAny); - } - else - { - CComVariant var; - anyToVariant( &var, rAny); - if(FAILED(hr = VariantChangeType(&var, &var, 0, type))) - { - if (hr == DISP_E_TYPEMISMATCH) - throw CannotConvertException( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Cannot convert the value of type :\"") + - rAny.getValueTypeName() + - OUSTR("\" to the expected Automation type of VARTYPE: ") + - OUString::valueOf((sal_Int32)type), - 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); - - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Conversion of any with ") + - rAny.getValueType().getTypeName() + - OUSTR(" to VARIANT with type: ") + OUString::valueOf((sal_Int32) type) + - OUSTR(" failed! Error code: ") + OUString::valueOf(hr)); - - } - if(FAILED(hr = VariantCopy(pVariant, &var))) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "VariantCopy failed for reason: ") + OUString::valueOf(hr)); - } - } - } - catch (IllegalArgumentException &) - { - throw; - } - catch (CannotConvertException & ) - { - throw; - } - catch (BridgeRuntimeError&) - { - throw; - } - catch(Exception & e) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Unexpected exception occurred. Message: ") + e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Unexpected exception occurred.")); - } -} - -template -void UnoConversionUtilities::anyToVariant(VARIANT* pVariant, const Any& rAny) -{ - bool bIllegal = false; - try - { - switch (rAny.getValueTypeClass()) - { - case TypeClass_INTERFACE: - { - Reference xInt; - if (rAny >>= xInt) - { - createUnoObjectWrapper(rAny, pVariant); - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_STRUCT: - { - if (rAny.getValueType() == getCppuType((Date*)0)) - { - Date d; - if (rAny >>= d) - { - pVariant->vt = VT_DATE; - pVariant->date = d.Value; - } - else - { - bIllegal = true; - } - } - else if(rAny.getValueType() == getCppuType((Decimal*)0)) - { - Decimal d; - if (rAny >>= d) - { - pVariant->vt = VT_DECIMAL; - pVariant->decVal.scale = d.Scale; - pVariant->decVal.sign = d.Sign; - pVariant->decVal.Lo32 = d.LowValue; - pVariant->decVal.Mid32 = d.MiddleValue; - pVariant->decVal.Hi32 = d.HighValue; - } - else - { - bIllegal = true; - } - } - else if (rAny.getValueType() == getCppuType((Currency*)0)) - { - Currency c; - if (rAny >>= c) - { - pVariant->vt = VT_CY; - pVariant->cyVal.int64 = c.Value; - } - else - { - bIllegal = true; - } - } - else if(rAny.getValueType() == getCppuType((SCode*)0)) - { - SCode s; - if (rAny >>= s) - { - pVariant->vt = VT_ERROR; - pVariant->scode = s.Value; - } - else - { - bIllegal = true; - } - } - else - { - createUnoObjectWrapper(rAny, pVariant); - } - break; - } - case TypeClass_SEQUENCE: // sequence ??? SafeArray descriptor - { - SAFEARRAY* pArray = createUnoSequenceWrapper(rAny); - if (pArray) - { - V_VT(pVariant) = VT_ARRAY | VT_VARIANT; - V_ARRAY(pVariant) = pArray; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_VOID: - { - HRESULT hr = S_OK; - if (FAILED(hr = VariantClear(pVariant))) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant\n" - "VariantClear failed with error:") + OUString::valueOf(hr)); - } - break; - } - case TypeClass_BOOLEAN: - { - sal_Bool value; - if (rAny >>= value) - { - pVariant->vt = VT_BOOL; - pVariant->boolVal = value == sal_True? VARIANT_TRUE: VARIANT_FALSE; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_CHAR: - { - // Because VT_UI2 does not conform to oleautomation we convert into VT_I2 instead - sal_uInt16 value = *(sal_Unicode*) rAny.getValue(); - pVariant->vt = VT_I2; - pVariant->iVal = value; - break; - } - case TypeClass_STRING: - { - OUString value; - if (rAny >>= value) - { - pVariant->vt = VT_BSTR; - pVariant->bstrVal = SysAllocString(reinterpret_cast(value.getStr())); - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_FLOAT: - { - float value; - if (rAny >>= value) - { - pVariant->vt = VT_R4; - pVariant->fltVal = value; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_DOUBLE: - { - double value; - if (rAny >>= value) - { - pVariant->vt = VT_R8; - pVariant->dblVal = value; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_BYTE: - { - // ole automation does not know a signed char but only unsigned char - sal_Int8 value; - if (rAny >>= value) - { - pVariant->vt = VT_UI1; - pVariant->bVal = value; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_SHORT: // INT16 - case TypeClass_UNSIGNED_SHORT: // UINT16 - { - sal_Int16 value; - if (rAny >>= value) - { - pVariant->vt = VT_I2; - pVariant->iVal = value; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_ENUM: - { - sal_Int32 value = *(sal_Int32*) rAny.getValue(); - pVariant->vt = VT_I4; - pVariant->lVal= value; - break; - } - case TypeClass_LONG: - case TypeClass_UNSIGNED_LONG: - { - sal_Int32 value; - if (rAny >>= value) - { - pVariant->vt = VT_I4; - pVariant->lVal= value; - } - else - { - bIllegal = true; - } - break; - } - case TypeClass_HYPER: - { - - pVariant->vt = VT_DECIMAL; - pVariant->decVal.scale = 0; - pVariant->decVal.sign = 0; - pVariant->decVal.Hi32 = 0; - - sal_Int64 value; - rAny >>= value; - - if (value & SAL_CONST_UINT64(0x8000000000000000)) - pVariant->decVal.sign = DECIMAL_NEG; - - pVariant->decVal.Lo64 = value; - break; - } - case TypeClass_UNSIGNED_HYPER: - { - pVariant->vt = VT_DECIMAL; - pVariant->decVal.scale = 0; - pVariant->decVal.sign = 0; - pVariant->decVal.Hi32 = 0; - - sal_uInt64 value; - rAny >>= value; - pVariant->decVal.Lo64 = value; - break; - } - case TypeClass_TYPE: - { - Type type; - rAny >>= type; - CComVariant var; - if (createUnoTypeWrapper(type.getTypeName(), & var) == false) - throw BridgeRuntimeError( - OUSTR("[automation bridge] UnoConversionUtilities::anyToVariant \n" - "Error during conversion of UNO type to Automation object!")); - - if (FAILED(VariantCopy(pVariant, &var))) - throw BridgeRuntimeError( - OUSTR("[automation bridge] UnoConversionUtilities::anyToVariant \n" - "Unexpected error!")); - break; - } - default: - //TypeClass_SERVICE: - //TypeClass_EXCEPTION: - //When a InvocationTargetException is thrown when calling XInvocation::invoke - //on a UNO object, then the target exception is directly used to create a - //EXEPINFO structure - //TypeClass_TYPEDEF - //TypeClass_ANY: - //TypeClass_UNKNOWN: - //TypeClass_UNSIGNED_OCTET: - // TypeClass_UNION: - // TypeClass_ARRAY: - // TypeClass_UNSIGNED_INT: - // TypeClass_UNSIGNED_BYTE: - // TypeClass_MODULE: - throw CannotConvertException( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant\n" - "There is no conversion for this UNO type to a Automation type." - "The destination type class is the type class of the UNO " - "argument which was to be converted."), - Reference(), rAny.getValueTypeClass(), - FailReason::TYPE_NOT_SUPPORTED, 0); - - break; - } - if (bIllegal) - { - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant\n" - "The provided any of type\" ") + rAny.getValueType().getTypeName() + - OUSTR("\" is unappropriate for conversion!"), Reference(), -1); - - } - } - catch (CannotConvertException & ) - { - throw; - } - catch (IllegalArgumentException & ) - { - throw; - } - catch(BridgeRuntimeError&) - { - throw; - } - catch(Exception & e) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Unexpected exception occurred. Message: ") + e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::anyToVariant \n" - "Unexpected exception occurred. ") ); - } -} - -// Creates an SAFEARRAY of the specified element and if necessary -// creates a SAFEARRAY whith multiple dimensions. -// Used by sal_Bool anyToVariant(VARIANT* pVariant, const Any& rAny, VARTYPE type); -template -SAFEARRAY* UnoConversionUtilities::createUnoSequenceWrapper(const Any& rSeq, VARTYPE elemtype) -{ - if (rSeq.getValueTypeClass() != TypeClass_SEQUENCE) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createUnoSequenceWrapper \n" - "The any does not contain a sequence!"), 0, 0); - if (elemtype == VT_NULL || elemtype == VT_EMPTY) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createUnoSequenceWrapper \n" - "No element type supplied!"),0, -1); - SAFEARRAY* pArray= NULL; - // Get the dimensions. This is done by examining the type name string - // The count of brackets determines the dimensions. - OUString sTypeName= rSeq.getValueType().getTypeName(); - sal_Int32 dims=0; - for(sal_Int32 lastIndex=0;(lastIndex= sTypeName.indexOf( L'[', lastIndex)) != -1; lastIndex++,dims++); - - //get the maximum number of elements per dimensions and the typedescription of the elements - Sequence seqElementCounts( dims); - TypeDescription elementTypeDesc; - getElementCountAndTypeOfSequence( rSeq, 1, seqElementCounts, elementTypeDesc ); - - if( elementTypeDesc.is() ) - { - // set up the SAFEARRAY - scoped_array sarSafeArrayBound(new SAFEARRAYBOUND[dims]); - SAFEARRAYBOUND* prgsabound= sarSafeArrayBound.get(); - for( sal_Int32 i=0; i < dims; i++) - { - //prgsabound[0] is the right most dimension - prgsabound[dims - i - 1].lLbound = 0; - prgsabound[dims - i - 1].cElements = seqElementCounts[i]; - } - - typelib_TypeDescription* rawTypeDesc= elementTypeDesc.get(); - sal_Int32 elementSize= rawTypeDesc->nSize; - size_t oleElementSize= getOleElementSize( elemtype); - // SafeArrayCreate clears the memory for the data itself. - pArray = SafeArrayCreate(elemtype, dims, prgsabound); - - // convert the Sequence's elements and populate the SAFEARRAY - if( pArray) - { - // Iterate over every Sequence that contains the actual elements - void* pSAData; - if( SUCCEEDED( SafeArrayAccessData( pArray, &pSAData))) - { - const sal_Int32* parElementCount= seqElementCounts.getConstArray(); - uno_Sequence * pMultiSeq= *(uno_Sequence* const*) rSeq.getValue(); - sal_Int32 dimsSeq= dims - 1; - - // arDimSeqIndizes contains the current index of a block of data. - // E.g. Sequence> , the index would refer to Sequence - // In this case arDimSeqIndices would have the size 1. That is the elements are not counted - // but the Sequences that contain those elements. - // The indices ar 0 based - scoped_array sarDimsSeqIndices; - sal_Int32* arDimsSeqIndices= NULL; - if( dimsSeq > 0) - { - sarDimsSeqIndices.reset(new sal_Int32[dimsSeq]); - arDimsSeqIndices = sarDimsSeqIndices.get(); - memset( arDimsSeqIndices, 0, sizeof( sal_Int32 ) * dimsSeq); - } - - char* psaCurrentData= (char*)pSAData; - - do - { - // Get the Sequence at the current index , see arDimsSeqIndices - uno_Sequence * pCurrentSeq= pMultiSeq; - sal_Int32 curDim=1; // 1 based - sal_Bool skipSeq= sal_False; - while( curDim <= dimsSeq ) - { - // get the Sequence at the index if valid - if( pCurrentSeq->nElements > arDimsSeqIndices[ curDim - 1] ) // don't point to Nirvana - { - // size of Sequence is 4 - sal_Int32 offset= arDimsSeqIndices[ curDim - 1] * 4; - pCurrentSeq= *(uno_Sequence**) &pCurrentSeq->elements[ offset]; - curDim++; - } - else - { - // There is no Sequence at this index, so skip this index - skipSeq= sal_True; - break; - } - } - - if( skipSeq) - continue; - - // Calculate the current position within the datablock of the SAFEARRAY - // for the next Sequence. - sal_Int32 memOffset= 0; - sal_Int32 dimWeight= parElementCount[ dims - 1]; // size of the rightmost dimension - for(sal_Int16 idims=0; idims < dimsSeq; idims++ ) - { - memOffset+= arDimsSeqIndices[dimsSeq - 1 - idims] * dimWeight; - // now determine the weight of the dimension to the left of the current. - if( dims - 2 - idims >=0) - dimWeight*= parElementCount[dims - 2 - idims]; - } - psaCurrentData= (char*)pSAData + memOffset * oleElementSize; - // convert the Sequence and put the elements into the Safearray - for( sal_Int32 i= 0; i < pCurrentSeq->nElements; i++) - { - Any unoElement( pCurrentSeq->elements + i * elementSize, rawTypeDesc ); - // The any is being converted into an VARIANT which value is then copied - // to the SAFEARRAY's data block. When copying one has to follow the rules for - // copying certain types, as are VT_DISPATCH, VT_UNKNOWN, VT_VARIANT, VT_BSTR. - // To increase performance, we just do a memcpy of VARIANT::byref. This is possible - // because anyToVariant has already followed the copying rules. To make this - // work there must not be a VariantClear. - // One Exception is VARIANT because I don't know how VariantCopy works. - - VARIANT var; - VariantInit( &var); - anyToVariant( &var, unoElement); - if( elemtype == VT_VARIANT ) - { - VariantCopy( ( VARIANT*)psaCurrentData, &var); - VariantClear( &var); - } - else - memcpy( psaCurrentData, &var.byref, oleElementSize); - - psaCurrentData+= oleElementSize; - } - } - while( incrementMultidimensionalIndex( dimsSeq, parElementCount, arDimsSeqIndices)); - - SafeArrayUnaccessData( pArray); - } - } - } - return pArray; -} - -// Increments a multi dimensional index. -// Returns true as long as the index has been successfully incremented, false otherwise. -// False is also returned if an overflow of the most significant dimension occurs. E.g. -// assume an array with the dimensions (2,2), then the lowest index is (0,0) and the highest -// index is (1,1). If the function is being called with the index (1,1) then the overflow would -// occur, with the result (0,0) and a sal_False as return value. -// Param dimensions - number of dimensions -// Param parDimensionsLength - The array contains the size of each dimension, that is the -// size of the array equals the parameter dimensions. -// The rightmost dimensions is the least significant one -// ( parDimensionsLengths[ dimensions -1 ] ). -// Param parMultiDimensionalIndex - The array contains the index. Each dimension index is -// 0 based. -template -sal_Bool UnoConversionUtilities::incrementMultidimensionalIndex(sal_Int32 dimensions, - const sal_Int32 * parDimensionLengths, - sal_Int32 * parMultidimensionalIndex) -{ - if( dimensions < 1) - return sal_False; - - sal_Bool ret= sal_True; - sal_Bool carry= sal_True; // to get into the while loop - - sal_Int32 currentDimension= dimensions; //most significant is 1 - while( carry) - { - parMultidimensionalIndex[ currentDimension - 1]++; - // if carryover, set index to 0 and handle carry on a level above - if( parMultidimensionalIndex[ currentDimension - 1] > (parDimensionLengths[ currentDimension - 1] - 1)) - parMultidimensionalIndex[ currentDimension - 1]= 0; - else - carry= sal_False; - - currentDimension --; - // if dimensions drops below 1 and carry is set than then all indices are 0 again - // this is signalled by returning sal_False - if( currentDimension < 1 && carry) - { - carry= sal_False; - ret= sal_False; - } - } - return ret; -} - -// Determines the size of a certain OLE type. The function takes -// only those types into account which are oleautomation types and -// can have a value ( unless VT_NULL, VT_EMPTY, VT_ARRAY, VT_BYREF). -// Currently used in createUnoSequenceWrapper to calculate addresses -// for data within a SAFEARRAY. -template -size_t UnoConversionUtilities::getOleElementSize( VARTYPE type) -{ - size_t size; - switch( type) - { - case VT_BOOL: size= sizeof( VARIANT_BOOL);break; - case VT_UI1: size= sizeof( unsigned char);break; - case VT_R8: size= sizeof( double);break; - case VT_R4: size= sizeof( float);break; - case VT_I2: size= sizeof( short);break; - case VT_I4: size= sizeof( long);break; - case VT_BSTR: size= sizeof( BSTR); break; - case VT_ERROR: size= sizeof( SCODE); break; - case VT_DISPATCH: - case VT_UNKNOWN: size= sizeof( IUnknown*); break; - case VT_VARIANT: size= sizeof( VARIANT);break; - default: size= 0; - } - return size; -} - -//If a Sequence is being converted into a SAFEARRAY then we possibly have -// to create a SAFEARRAY with multiple dimensions. This is the case when a -// Sequence contains Sequences ( Sequence< Sequence < XXX > > ). The leftmost -// Sequence in the declaration is assumed to represent dimension 1. Because -// all Sequence elements of a Sequence can have different length, we have to -// determine the maximum length which is then the length of the respective -// dimension. -// getElementCountAndTypeOfSequence determines the length of each dimension and calls itself recursively -// in the process. -// param rSeq - an Any that has to contain a Sequence -// param dim - the dimension for which the number of elements is being determined, -// must be one. -// param seqElementCounts - countains the maximum number of elements for each -// dimension. Index 0 contains the number of dimension one. -// After return the Sequence contains the maximum number of -// elements for each dimension. -// The length of the Sequence must equal the number of dimensions. -// param typeClass - TypeClass of the element type that is no Sequence, e.g. -// Sequence< Sequence > > - type is sal_Int32) -template -void UnoConversionUtilities::getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, - Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc) -{ - sal_Int32 dimCount= (*(uno_Sequence* const *) rSeq.getValue())->nElements; - if( dimCount > seqElementCounts[ dim-1]) - seqElementCounts[ dim-1]= dimCount; - - // we need the element type to construct the any that is - // passed into getElementCountAndTypeOfSequence again - typelib_TypeDescription* pSeqDesc= NULL; - rSeq.getValueTypeDescription( &pSeqDesc); - typelib_TypeDescriptionReference* pElementDescRef= ((typelib_IndirectTypeDescription*)pSeqDesc)->pType; - - // if the elements are Sequences than do recursion - if( dim < seqElementCounts.getLength() ) - { - uno_Sequence* pSeq = *(uno_Sequence* const*) rSeq.getValue(); - uno_Sequence** arSequences= (uno_Sequence**)pSeq->elements; - for( sal_Int32 i=0; i < dimCount; i++) - { - uno_Sequence* arElement= arSequences[ i]; - getElementCountAndTypeOfSequence( Any( &arElement, pElementDescRef), dim + 1 , seqElementCounts, typeDesc); - } - } - else - { - // determine the element type ( e.g. Sequence< Sequence > > - type is sal_Int32) - typeDesc= pElementDescRef; - } - typelib_typedescription_release( pSeqDesc); -} - - -template -SAFEARRAY* UnoConversionUtilities::createUnoSequenceWrapper(const Any& rSeq) -{ - SAFEARRAY* pArray = NULL; - sal_uInt32 n = 0; - - if( rSeq.getValueTypeClass() != TypeClass_SEQUENCE ) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createUnoSequenceWrapper\n" - "The UNO argument is not a sequence"), 0, -1); - - uno_Sequence * punoSeq= *(uno_Sequence**) rSeq.getValue(); - - typelib_TypeDescriptionReference* pSeqTypeRef= rSeq.getValueTypeRef(); - typelib_TypeDescription* pSeqType= NULL; - TYPELIB_DANGER_GET( &pSeqType, pSeqTypeRef); - typelib_IndirectTypeDescription * pSeqIndDec= (typelib_IndirectTypeDescription*) pSeqType; - - - typelib_TypeDescriptionReference * pSeqElementTypeRef= pSeqIndDec->pType; - TYPELIB_DANGER_RELEASE( pSeqType); - - typelib_TypeDescription* pSeqElementDesc= NULL; - TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); - - // try to find VARIANT type that is related to the UNO type of the sequence elements - // the sequence as a sequence element should be handled in a special way - VARTYPE eTargetElementType = VT_EMPTY; - if ( pSeqElementDesc->eTypeClass != TypeClass_SEQUENCE ) - eTargetElementType = mapTypeClassToVartype( static_cast< TypeClass >( pSeqElementDesc->eTypeClass ) ); - - if ( eTargetElementType != VT_EMPTY ) - pArray = createUnoSequenceWrapper( rSeq, eTargetElementType ); - - if ( !pArray ) - { - sal_Int32 nElementSize= pSeqElementDesc->nSize; - n= punoSeq->nElements; - - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].lLbound = 0; - rgsabound[0].cElements = n; - VARIANT oleElement; - long safeI[1]; - - pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); - - Any unoElement; - // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; - sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - - for (sal_uInt32 i = 0; i < n; i++) - { - unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); - VariantInit(&oleElement); - - anyToVariant(&oleElement, unoElement); - - safeI[0] = i; - SafeArrayPutElement(pArray, safeI, &oleElement); - - VariantClear(&oleElement); - } - } - - TYPELIB_DANGER_RELEASE( pSeqElementDesc); - - return pArray; -} - -/* The argument rObj can contain -- UNO struct -- UNO interface -- UNO interface created by this bridge (adapter factory) -- UNO interface created by this bridge ( COM Wrapper) - -pVar must be initialized. -*/ -template -void UnoConversionUtilities::createUnoObjectWrapper(const Any & rObj, VARIANT * pVar) -{ - MutexGuard guard(getBridgeMutex()); - - Reference xInt; - - TypeClass tc = rObj.getValueTypeClass(); - if (tc != TypeClass_INTERFACE && tc != TypeClass_STRUCT) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createUnoObjectWrapper \n" - "Cannot create an Automation interface for a UNO type which is not " - "a struct or interface!"), 0, -1); - - if (rObj.getValueTypeClass() == TypeClass_INTERFACE) - { - if (! (rObj >>= xInt)) - throw IllegalArgumentException( - OUSTR("[automation bridge] UnoConversionUtilities::createUnoObjectWrapper\n " - "Could not create wrapper object for UNO object!"), 0, -1); - //If XInterface is NULL, which is a valid value, then simply return NULL. - if ( ! xInt.is()) - { - pVar->vt = VT_UNKNOWN; - pVar->punkVal = NULL; - return; - } - //make sure we have the main XInterface which is used with a map - xInt = Reference(xInt, UNO_QUERY); - //If there is already a wrapper for the UNO object then use it - - Reference xIntWrapper; - // Does a UNO wrapper exist already ? - IT_Uno it_uno = UnoObjToWrapperMap.find( (sal_uInt32) xInt.get()); - if(it_uno != UnoObjToWrapperMap.end()) - { - xIntWrapper = it_uno->second; - if (xIntWrapper.is()) - { - convertSelfToCom(xIntWrapper, pVar); - return; - } - } - // Is the object a COM wrapper ( either XInvocation, or Adapter object) - // or does it suppy an IDispatch by its own ? - else - { - Reference xIntComWrapper = xInt; - typedef boost::unordered_map::iterator _IT; - // Adapter? then get the COM wrapper to which the adapter delegates its calls - _IT it= AdapterToWrapperMap.find( (sal_uInt32) xInt.get()); - if( it != AdapterToWrapperMap.end() ) - xIntComWrapper= reinterpret_cast(it->second); - - if (convertSelfToCom(xIntComWrapper, pVar)) - return; - } - } - // If we have no UNO wrapper nor the IDispatch yet then we have to create - // a wrapper. For that we need an XInvocation from the UNO object. - - // get an XInvocation or create one using the invocation service - Reference xInv(xInt, UNO_QUERY); - if ( ! xInv.is()) - { - Reference xInvFactory= getInvocationFactory(rObj); - if (xInvFactory.is()) - { - Sequence params(1); - params.getArray()[0] = rObj; - Reference xInt = xInvFactory->createInstanceWithArguments(params); - xInv= Reference(xInt, UNO_QUERY); - } - } - - if (xInv.is()) - { - Reference xNewWrapper = createUnoWrapperInstance(); - Reference xInitWrapper(xNewWrapper, UNO_QUERY); - if (xInitWrapper.is()) - { - VARTYPE vartype= getVarType( rObj); - - if (xInt.is()) - { - Any params[3]; - params[0] <<= xInv; - params[1] <<= xInt; - params[2] <<= vartype; - xInitWrapper->initialize( Sequence(params, 3)); - } - else - { - Any params[2]; - params[0] <<= xInv; - params[1] <<= vartype; - xInitWrapper->initialize( Sequence(params, 2)); - } - - // put the newly created object into a map. If the same object will - // be mapped again and there is already a wrapper then the old wrapper - // will be used. - if(xInt.is()) // only interfaces - UnoObjToWrapperMap[(sal_uInt32) xInt.get()]= xNewWrapper; - convertSelfToCom(xNewWrapper, pVar); - return; - } - } -} - -template -void UnoConversionUtilities::variantToAny( const VARIANT* pVariant, Any& rAny, - sal_Bool bReduceValueRange /* = sal_True */) -{ - HRESULT hr = S_OK; - try - { - CComVariant var; - - // There is no need to support indirect values, since they're not supported by UNO - if( FAILED(hr= VariantCopyInd( &var, const_cast(pVariant)))) // remove VT_BYREF - throw BridgeRuntimeError( - OUSTR("[automation bridge] UnoConversionUtilities::variantToAny \n" - "VariantCopyInd failed for reason : ") + OUString::valueOf(hr)); - - if ( ! convertValueObject( & var, rAny)) - { - if ((var.vt & VT_ARRAY) > 0) - { - VARTYPE oleTypeFlags = ::sal::static_int_cast< VARTYPE, int >( var.vt ^ VT_ARRAY ); - - Sequence unoSeq = createOleArrayWrapper(var.parray, oleTypeFlags); - rAny.setValue( &unoSeq, getCppuType( &unoSeq)); - } - else - { - switch (var.vt) - { - case VT_EMPTY: - rAny.setValue(NULL, Type()); - break; - case VT_NULL: - rAny.setValue(NULL, Type()); - break; - case VT_I2: - rAny.setValue( & var.iVal, getCppuType( (sal_Int16*)0)); - break; - case VT_I4: - rAny.setValue( & var.lVal, getCppuType( (sal_Int32*)0)); - // necessary for use in JavaScript ( see "reduceRange") - if( bReduceValueRange) - reduceRange(rAny); - break; - case VT_R4: - rAny.setValue( & var.fltVal, getCppuType( (float*)0)); - break; - case VT_R8: - rAny.setValue(& var.dblVal, getCppuType( (double*)0)); - break; - case VT_CY: - { - Currency cy(var.cyVal.int64); - rAny <<= cy; - break; - } - case VT_DATE: - { - Date d(var.date); - rAny <<= d; - break; - } - case VT_BSTR: - { - OUString b(reinterpret_cast(var.bstrVal)); - rAny.setValue( &b, getCppuType( &b)); - break; - } - case VT_UNKNOWN: - case VT_DISPATCH: - { - //check if it is a UNO type -#ifdef __MINGW32__ - CComQIPtr spType((IUnknown*) var.byref); -#else - CComQIPtr spType((IUnknown*) var.byref); -#endif - if (spType) - { - CComBSTR sName; - if (FAILED(spType->get_Name(&sName))) - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::variantToAny \n" - "Failed to get the type name from a UnoTypeWrapper!")); - Type type; - if (getType(sName, type) == false) - { - throw CannotConvertException( - OUSTR("[automation bridge]UnoConversionUtilities::variantToAny \n" - "A UNO type with the name: ") + OUString(reinterpret_cast(LPCOLESTR(sName))) + - OUSTR("does not exist!"), - 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); - } - rAny <<= type; - } - else - { - rAny = createOleObjectWrapper( & var); - } - break; - } - case VT_ERROR: - { - SCode scode(var.scode); - rAny <<= scode; - break; - } - case VT_BOOL: - { - sal_Bool b= var.boolVal == VARIANT_TRUE; - rAny.setValue( &b, getCppuType( &b)); - break; - } - case VT_I1: - rAny.setValue( & var.cVal, getCppuType((sal_Int8*)0)); - break; - case VT_UI1: // there is no unsigned char in UNO - rAny.setValue( & var.bVal, getCppuType( (sal_Int8*)0)); - break; - case VT_UI2: - rAny.setValue( & var.uiVal, getCppuType( (sal_uInt16*)0)); - break; - case VT_UI4: - rAny.setValue( & var.ulVal, getCppuType( (sal_uInt32*)0)); - break; - case VT_INT: - rAny.setValue( & var.intVal, getCppuType( (sal_Int32*)0)); - break; - case VT_UINT: - rAny.setValue( & var.uintVal, getCppuType( (sal_uInt32*)0)); - break; - case VT_VOID: - rAny.setValue( NULL, Type()); - break; - case VT_DECIMAL: - { - Decimal dec; - dec.Scale = var.decVal.scale; - dec.Sign = var.decVal.sign; - dec.LowValue = var.decVal.Lo32; - dec.MiddleValue = var.decVal.Mid32; - dec.HighValue = var.decVal.Hi32; - rAny <<= dec; - break; - } - - default: - break; - } - } - } - } - catch (IllegalArgumentException & ) - { - throw; - } - catch (CannotConvertException &) - { - throw; - } - catch (BridgeRuntimeError & ) - { - throw; - } - catch (Exception & e) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::variantToAny ! Message : \n") + - e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::variantToAny !")); - } - -} -// The function converts an IUnknown* into an UNO interface or struct. The -// IUnknown pointer can constitute different kind of objects: -// 1. a wrapper of an UNO struct (the wrapper was created by this bridge) -// 2. a wrapper of an UNO interface (created by this bridge) -// 3. a dispatch object that implements UNO interfaces -// 4. a dispatch object. - -// If the parameter "aType" has a value then the COM object ( pUnknown) is supposed to -// implement the interface described by "aType". Moreover it ( pUnknown) can implement -// several other -// UNO interfaces in which case it has to support the SUPPORTED_INTERFACES_PROP (see -// #define) property. That property contains all names of interfaces. -// "pUnknown" is wrapped by a COM wrapper object that implements XInvocation, e.g. -// IUnknownWrapper_Impl. Additionally an object of type "aType" is created by help -// of the INTERFACE_ADAPTER_FACTORY (see #define) service. The implementation of -// "aType" calls on the COM wrapper's XInvocation::invoke. If the COM object supports -// more then one UNO interfaces, as can be determined by the property -// SUPPORTED_INTERFACES_PROP, then the INTERFACE_ADAPTER_FACTORY creates an object that -// implements all these interfaces. -// This is only done if "pUnknown" is not already a UNO wrapper, -// that is it is actually NOT an UNO object that was converted to a COM object. If it is an -// UNO wrapper than the original UNO object is being extracted, queried for "aType" (if -// it is no struct) and returned. -template -#ifdef __MINGW32__ -Any UnoConversionUtilities::createOleObjectWrapper(VARIANT* pVar, const Type& aType) -#else -Any UnoConversionUtilities::createOleObjectWrapper(VARIANT* pVar, const Type& aType= Type()) -#endif -{ - //To allow passing "Nothing" in VS 2008 we need to accept VT_EMPTY - if (pVar->vt != VT_UNKNOWN && pVar->vt != VT_DISPATCH && pVar->vt != VT_EMPTY) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createOleObjectWrapper \n" - "The VARIANT does not contain an object type! "), 0, -1); - - MutexGuard guard( getBridgeMutex()); - - CComPtr spUnknown; - CComPtr spDispatch; - - if (pVar->vt == VT_UNKNOWN) - { - spUnknown = pVar->punkVal; - if (spUnknown) -#ifdef __MINGW32__ - spUnknown->QueryInterface( IID_IDispatch, reinterpret_cast( & spDispatch.p)); -#else - spUnknown.QueryInterface( & spDispatch.p); -#endif - } - else if (pVar->vt == VT_DISPATCH && pVar->pdispVal != NULL) - { - CComPtr spDispatch(pVar->pdispVal); - if (spDispatch) -#ifdef __MINGW32__ - spDispatch->QueryInterface( IID_IUnknown, reinterpret_cast( & spUnknown.p)); -#else - spDispatch.QueryInterface( & spUnknown.p); -#endif - } - - static Type VOID_TYPE= Type(); - Any ret; - //If no Type is provided and pVar contains IUnknown then we return a XInterface. - //If pVar contains an IDispatch then we return a XInvocation. - Type desiredType = aType; - - if (aType == VOID_TYPE) - { - switch (pVar->vt) - { - case VT_EMPTY: - case VT_UNKNOWN: - desiredType = getCppuType((Reference*) 0); - break; - case VT_DISPATCH: - desiredType = getCppuType((Reference*) 0); - break; - default: - desiredType = aType; - } - } - - // COM pointer are NULL, no wrapper required - if (spUnknown == NULL) - { - Reference xInt; - if( aType.getTypeClass() == TypeClass_INTERFACE) - ret.setValue( &xInt, aType); - else if( aType.getTypeClass() == TypeClass_STRUCT) - ret.setValue( NULL, aType); - else - ret <<= xInt; - return ret; - } - - - // Check if "spUnknown" is a UNO wrapper, that is an UNO object that has been - // passed to COM. Then it supports IUnoObjectWrapper - // and we extract the original UNO object. -#ifdef __MINGW32__ - CComQIPtr spUno( spUnknown); -#else - CComQIPtr spUno( spUnknown); -#endif - if( spUno) - { // it is a wrapper - Reference xInt; - if( SUCCEEDED( spUno->getOriginalUnoObject( &xInt))) - { - ret <<= xInt; - } - else - { - Any any; - if( SUCCEEDED( spUno->getOriginalUnoStruct(&any))) - ret= any; - } - return ret; - } - - // "spUnknown" is a real COM object. - // Before we create a new wrapper object we check if there is an existing wrapper - // There can be two kinds of wrappers, those who wrap dispatch - UNO objects, and those who - // wrap ordinary dispatch objects. The dispatch-UNO objects usually are adapted to represent - // particular UNO interfaces. - Reference xIntWrapper; - CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast(spUnknown.p)); - if(cit_currWrapper != ComPtrToWrapperMap.end()) - xIntWrapper = cit_currWrapper->second; - if (xIntWrapper.is()) - { - //Try to find an adapter for the wrapper - //find the proper Adapter. The pointer in the WrapperToAdapterMap are valid as long as - //we get a pointer to the wrapper from ComPtrToWrapperMap, because the Adapter hold references - //to the wrapper. - CIT_Wrap it = WrapperToAdapterMap.find((sal_uInt32) xIntWrapper.get()); - if (it == WrapperToAdapterMap.end()) - { - // No adapter available. - //The COM component could be a UNO object. Then we need to provide - // a proxy that implements all interfaces - Sequence seqTypes= getImplementedInterfaces(spUnknown); - Reference xIntAdapter; - if (seqTypes.getLength() > 0) - { - //It is a COM UNO object - xIntAdapter = createAdapter(seqTypes, xIntWrapper); - } - else - { - // Some ordinary COM object - xIntAdapter = xIntWrapper; - } - // return the wrapper directly, return XInterface or XInvocation - ret = xIntWrapper->queryInterface(desiredType); - if ( ! ret.hasValue()) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createOleObjectWrapper \n" - "The COM object is not suitable for the UNO type: ") + - desiredType.getTypeName(), 0, -1); - } - else - { - //There is an adapter available - Reference xIntAdapter((XInterface*) it->second); - ret = xIntAdapter->queryInterface( desiredType); - if ( ! ret.hasValue()) - throw IllegalArgumentException( - OUSTR("[automation bridge]UnoConversionUtilities::createOleObjectWrapper \n" - "The COM object is not suitable for the UNO type: ") + - desiredType.getTypeName(), 0, -1); - } - - return ret; - } - // No existing wrapper. Therefore create a new proxy. - // If the object implements UNO interfaces then get the types. - Sequence seqTypes = getImplementedInterfaces(spUnknown); - if (seqTypes.getLength() == 0 && - aType != VOID_TYPE && aType != getCppuType((Reference*)0)) - { - seqTypes = Sequence( & aType, 1); - } - - //There is no existing wrapper, therefore we create one for the real COM object - Reference xIntNewProxy= createComWrapperInstance(); - if ( ! xIntNewProxy.is()) - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::createOleObjectWrapper \n" - "Could not create proxy object for COM object!")); - - // initialize the COM wrapper - Reference xInit( xIntNewProxy, UNO_QUERY); - OSL_ASSERT( xInit.is()); - - Any params[3]; -#ifdef __MINGW32__ - params[0] <<= reinterpret_cast( spUnknown.p ); -#else - params[0] <<= (sal_uInt32) spUnknown.p; -#endif - sal_Bool bDisp = pVar->vt == VT_DISPATCH ? sal_True : sal_False; - params[1].setValue( & bDisp, getBooleanCppuType()); - params[2] <<= seqTypes; - - xInit->initialize( Sequence( params, 3)); -#ifdef __MINGW32__ - ComPtrToWrapperMap[reinterpret_cast( spUnknown.p )]= xIntNewProxy; -#else - ComPtrToWrapperMap[reinterpret_cast(spUnknown.p)]= xIntNewProxy; -#endif - - // we have a wrapper object - //The wrapper implements already XInvocation and XInterface. If - //param aType is void then the object is supposed to have XInvocation. - if (aType == getCppuType((Reference*)0) || - (aType == VOID_TYPE && seqTypes.getLength() == 0 )) - { - ret = xIntNewProxy->queryInterface(desiredType); - } - else - { - Reference xIntAdapter = - createAdapter(seqTypes, xIntNewProxy); - ret = xIntAdapter->queryInterface(desiredType); - } - return ret; -} -template -Reference UnoConversionUtilities::createAdapter(const Sequence& seqTypes, - const Reference& receiver) -{ - Reference< XInterface> xIntAdapterFac; - xIntAdapterFac= m_smgr->createInstance(INTERFACE_ADAPTER_FACTORY); - // We create an adapter object that does not only implement the required type but also - // all types that the COM object pretends to implement. An COM object must therefore - // support the property "_implementedInterfaces". - Reference xIntAdapted; - Reference xInv(receiver, UNO_QUERY); - Reference xAdapterFac( xIntAdapterFac, UNO_QUERY); - if( xAdapterFac.is()) - xIntAdapted= xAdapterFac->createAdapter( xInv, seqTypes); - - if( xIntAdapted.is()) - { - // Put the pointer to the wrapper object and the interface pointer of the adapted interface - // in a global map. Thus we can determine in a call to createUnoObjectWrapper whether the UNO - // object is a wrapped COM object. In that case we extract the original COM object rather than - // creating a wrapper around the UNO object. - typedef boost::unordered_map::value_type VALUE; - AdapterToWrapperMap.insert( VALUE( (sal_uInt32) xIntAdapted.get(), (sal_uInt32) receiver.get())); - WrapperToAdapterMap.insert( VALUE( (sal_uInt32) receiver.get(), (sal_uInt32) xIntAdapted.get())); - } - else - { - throw BridgeRuntimeError( - OUSTR("[automation bridge]UnoConversionUtilities::createOleObjectWrapper \n" - "Could not create a proxy for COM object! Creation of adapter failed.")); - } - return xIntAdapted; -} -// "convertValueObject" converts a JScriptValue object contained in "var" into -// an any. The type contained in the any is stipulated by a "type value" thas -// was set within the JScript script on the value object ( see JScriptValue). -template -bool UnoConversionUtilities::convertValueObject( const VARIANTARG *var, Any& any) -{ - bool ret = false; - try - { - bool bFail = false; - HRESULT hr= S_OK; - CComVariant varDisp; - - if(SUCCEEDED(hr = varDisp.ChangeType( VT_DISPATCH, var))) - { - CComPtr spValue; - VARIANT_BOOL varBool; - CComBSTR bstrType; - CComVariant varValue; - CComPtr spDisp( varDisp.pdispVal); - if(spDisp) - { - if(SUCCEEDED( spDisp->QueryInterface( __uuidof( IJScriptValueObject), - reinterpret_cast (&spValue)))) - { - ret = true; // is is a ValueObject - //If it is an out - param then it does not need to be converted. In/out and - // in params does so. - if (SUCCEEDED(hr= spValue->IsOutParam( &varBool))) - { - // if varBool == true then no conversion needed because out param - if (varBool == VARIANT_FALSE) - { - if(SUCCEEDED(hr = spValue->GetValue( & bstrType, & varValue))) - { - Type type; - if (getType(bstrType, type)) - variantToAny( & varValue, any, type); - else - bFail = true; - } - else - bFail = true; - } - } - else - bFail = true;; - } - } - } - else if( hr != DISP_E_TYPEMISMATCH && hr != E_NOINTERFACE) - bFail = true; - - if (bFail) - throw BridgeRuntimeError( - OUSTR("[automation bridge] Conversion of ValueObject failed ")); - } - catch (BridgeRuntimeError &) - { - throw; - } - catch (Exception & e) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::convertValueObject ! Message : \n") + - e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::convertValueObject !")); - } - return ret; -} - -template -void UnoConversionUtilities::dispatchExObject2Sequence( const VARIANTARG* pvar, Any& anySeq, const Type& type) -{ - try - { - bool bFail = false; - if( pvar->vt != VT_DISPATCH) - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - IDispatchEx* pdispEx; - HRESULT hr; - if( FAILED( hr= pvar->pdispVal->QueryInterface( IID_IDispatchEx, - reinterpret_cast( &pdispEx)))) - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - - DISPID dispid; - OUString sindex; - DISPPARAMS param= {0,0,0,0}; - CComVariant result; - - OLECHAR* sLength= L"length"; - - // Get the length of the array. Can also be obtained throu GetNextDispID. The - // method only returns DISPIDs of the array data. Their names are like "0", "1" etc. - if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sLength , 1, LOCALE_USER_DEFAULT, &dispid))) - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, - ¶m, &result, NULL, NULL))) - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - if( FAILED( VariantChangeType( &result, &result, 0, VT_I4))) - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - long length= result.lVal; - - result.Clear(); - - // get a few basic facts about the sequence, and reallocate: - // create the Sequences - // get the size of the elements - typelib_TypeDescription *pDesc= NULL; - type.getDescription( &pDesc); - - typelib_IndirectTypeDescription *pSeqDesc= reinterpret_cast(pDesc); - typelib_TypeDescriptionReference *pSeqElemDescRef= pSeqDesc->pType; // type of the Sequence' elements - Type elemType( pSeqElemDescRef); - _typelib_TypeDescription* pSeqElemDesc=NULL; - TYPELIB_DANGER_GET( &pSeqElemDesc, pSeqElemDescRef) - sal_uInt32 nelementSize= pSeqElemDesc->nSize; - TYPELIB_DANGER_RELEASE( pSeqElemDesc) - - uno_Sequence *p_uno_Seq; - uno_sequence_construct( &p_uno_Seq, pDesc, NULL, length, cpp_acquire); - - typelib_TypeClass typeElement= pSeqDesc->pType->eTypeClass; - char *pArray= p_uno_Seq->elements; - - // Get All properties in the object, convert their values to the expected type and - // put them into the passed in sequence - for( sal_Int32 i= 0; i< length; i++) - { - OUString ousIndex=OUString::valueOf( i); - OLECHAR* sindex = (OLECHAR*)ousIndex.getStr(); - - if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid))) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - } - if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, - ¶m, &result, NULL, NULL))) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] UnoConversionUtilities::dispatchExObject2Sequence \n" - "Conversion of dispatch object to Sequence failed!")); - } - - // If the result is VT_DISPATCH than the Sequence's element type could be Sequence - // Look that up in the CoreReflection to make clear. - // That requires a recursiv conversion - Any any; - // Destination address within the out-Sequence "anySeq" where to copy the next converted element - void* pDest= (void*)(pArray + (i * nelementSize)); - - if( result.vt & VT_DISPATCH && typeElement == typelib_TypeClass_SEQUENCE) - { - variantToAny( &result, any, elemType, sal_False); - // copy the converted VARIANT, that is a Sequence to the Sequence - uno_Sequence * p_unoSeq= *(uno_Sequence**)any.getValue(); - // just copy the pointer of the uno_Sequence - // nelementSize should be 4 !!!! - memcpy( pDest, &p_unoSeq, nelementSize); - osl_incrementInterlockedCount( &p_unoSeq->nRefCount); - } - else // Element type is no Sequence -> do one conversion - { - variantToAny( &result, any, elemType, sal_False); - if( typeElement == typelib_TypeClass_ANY) - { - // copy the converted VARIANT to the Sequence - uno_type_assignData( pDest, pSeqElemDescRef , &any, pSeqElemDescRef,cpp_queryInterface, - cpp_acquire, cpp_release); - } - else - { - // type after conversion must be the element type of the sequence - OSL_ENSURE( (any.getValueTypeClass() == typeElement), "wrong conversion"); - uno_type_assignData( pDest, pSeqElemDescRef,const_cast( any.getValue()), any.getValueTypeRef(), - cpp_queryInterface, cpp_acquire, cpp_release); - } - } - } // else - result.Clear(); - anySeq.setValue( &p_uno_Seq, pDesc); - uno_destructData( &p_uno_Seq, pDesc, cpp_release); - typelib_typedescription_release( pDesc); - - if (bFail) - throw BridgeRuntimeError( - OUSTR("[automation bridge] Conversion of ValueObject failed ")); - } - catch (BridgeRuntimeError & ) - { - throw; - } - catch (Exception & e) - { - throw BridgeRuntimeError(OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::convertValueObject ! Message : \n") + - e.Message); - } - catch(...) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] unexpected exception in " - "UnoConversionUtilities::convertValueObject !")); - } -} - -/* The argument unotype is the type that is expected by the currently called UNO function. - For example: []long, [][]long. If the function calls itself recursively then the element type - is passed on. For example a two dimensional SAFEARRAY of type VT_I4 is to be converted. Then - unotype has to be either void or [][]long. When the function calls itself recursivly then - it passes the element type which is []long. -*/ -template -Sequence UnoConversionUtilities::createOleArrayWrapperOfDim(SAFEARRAY* pArray, - unsigned int dimCount, unsigned int actDim, long* index, VARTYPE type, const Type& unotype) -{ - HRESULT hr= S_OK; - long lBound; - long uBound; - long nCountElements; - - SafeArrayGetLBound(pArray, actDim, &lBound); - SafeArrayGetUBound(pArray, actDim, &uBound); - nCountElements= uBound - lBound +1; - - Sequence anySeq(nCountElements); - Any* pUnoArray = anySeq.getArray(); - - for (index[actDim - 1] = lBound; index[actDim - 1] <= uBound; index[actDim - 1]++) - { - if (actDim > 1 ) - { - Sequence element = createOleArrayWrapperOfDim(pArray, dimCount, - actDim - 1, index, type, getElementTypeOfSequence(unotype)); - - pUnoArray[index[actDim - 1] - lBound].setValue(&element, getCppuType(&element)); - } - else - { - VARIANT variant; - - VariantInit(&variant); - - V_VT(&variant) = type; - - switch (type) - { - case VT_I2: - SafeArrayGetElement(pArray, index, &V_I2(&variant)); - break; - case VT_I4: - SafeArrayGetElement(pArray, index, &V_I4(&variant)); - break; - case VT_R4: - SafeArrayGetElement(pArray, index, &V_R4(&variant)); - break; - case VT_R8: - SafeArrayGetElement(pArray, index, &V_R8(&variant)); - break; - case VT_CY: - SafeArrayGetElement(pArray, index, &V_CY(&variant)); - break; - case VT_DATE: - SafeArrayGetElement(pArray, index, &V_DATE(&variant)); - break; - case VT_BSTR: - hr= SafeArrayGetElement(pArray, index, &V_BSTR(&variant)); - break; - case VT_DISPATCH: - SafeArrayGetElement(pArray, index, &V_DISPATCH(&variant)); - break; - case VT_ERROR: - SafeArrayGetElement(pArray, index, &V_ERROR(&variant)); - break; - case VT_BOOL: - SafeArrayGetElement(pArray, index, &V_BOOL(&variant)); - break; - case VT_VARIANT: - SafeArrayGetElement(pArray, index, &variant); - break; - case VT_UNKNOWN: - SafeArrayGetElement(pArray, index, &V_UNKNOWN(&variant)); - break; - case VT_I1: - SafeArrayGetElement(pArray, index, &V_I1(&variant)); - break; - case VT_UI1: - SafeArrayGetElement(pArray, index, &V_UI1(&variant)); - break; - case VT_UI2: - SafeArrayGetElement(pArray, index, &V_UI2(&variant)); - break; - case VT_UI4: - SafeArrayGetElement(pArray, index, &V_UI4(&variant)); - break; - default: - break; - } - - if( unotype.getTypeClass() == TypeClass_VOID) - // the function was called without specifying the destination type - variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], sal_False); - else - variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], - getElementTypeOfSequence(unotype), sal_False); - - VariantClear(&variant); - } - } - return anySeq; -} - -template -Type UnoConversionUtilities::getElementTypeOfSequence( const Type& seqType) -{ - Type retValue; - if( seqType.getTypeClass() != TypeClass_VOID) - { - OSL_ASSERT( seqType.getTypeClass() == TypeClass_SEQUENCE); - typelib_IndirectTypeDescription* pDescSeq= NULL; - seqType.getDescription((typelib_TypeDescription** ) & pDescSeq); - retValue = Type(pDescSeq->pType); - typelib_typedescription_release( (typelib_TypeDescription*) pDescSeq); - } - return retValue; -} -template -Sequence UnoConversionUtilities::createOleArrayWrapper(SAFEARRAY* pArray, VARTYPE type, const Type& unoType) -{ - sal_uInt32 dim = SafeArrayGetDim(pArray); - - Sequence ret; - - if (dim > 0) - { - scoped_array sarIndex(new long[dim]); - long * index = sarIndex.get(); - - for (unsigned int i = 0; i < dim; i++) - { - index[i] = 0; - } - - ret = createOleArrayWrapperOfDim(pArray, dim, dim, index, type, unoType); - } - - return ret; -} - -// If an VARIANT has the type VT_DISPATCH it can either be an JScript Array -// or some other object. This function finds out if it is such an array or -// not. Currently there's no way to make sure it's an array -// so we assume that when the object has a property "0" then it is an Array. -// An JScript has property like "0", "1", "2" etc. which represent the -// value at the corresponding index of the array -template -sal_Bool UnoConversionUtilities::isJScriptArray(const VARIANT* rvar) -{ - OSL_ENSURE( rvar->vt == VT_DISPATCH, "param is not a VT_DISPATCH"); - HRESULT hr; - OLECHAR* sindex= L"0"; - DISPID id; - if ( rvar->vt == VT_DISPATCH && rvar->pdispVal ) - { - hr= rvar->pdispVal->GetIDsOfNames( IID_NULL, &sindex, 1, - LOCALE_USER_DEFAULT, &id); - - if( SUCCEEDED ( hr) ) - return sal_True; - } - - return sal_False; -} - -template -VARTYPE UnoConversionUtilities::mapTypeClassToVartype( TypeClass type) -{ - VARTYPE ret; - switch( type) - { - case TypeClass_INTERFACE: ret= VT_DISPATCH; - break; - case TypeClass_STRUCT: ret= VT_DISPATCH; - break; - case TypeClass_ENUM: ret= VT_I4; - break; - case TypeClass_SEQUENCE: ret= VT_ARRAY; - break; - case TypeClass_ANY: ret= VT_VARIANT; - break; - case TypeClass_BOOLEAN: ret= VT_BOOL; - break; - case TypeClass_CHAR: ret= VT_I2; - break; - case TypeClass_STRING: ret= VT_BSTR; - break; - case TypeClass_FLOAT: ret= VT_R4; - break; - case TypeClass_DOUBLE: ret= VT_R8; - break; - case TypeClass_BYTE: ret= VT_UI1; - break; - case TypeClass_SHORT: ret= VT_I2; - break; - case TypeClass_LONG: ret= VT_I4; - break; - case TypeClass_UNSIGNED_SHORT: ret= VT_UI2; - break; - case TypeClass_UNSIGNED_LONG: ret= VT_UI4; - break; - default: - ret= VT_EMPTY; - } - return ret; -} - -template -Sequence UnoConversionUtilities::getImplementedInterfaces(IUnknown* pUnk) -{ - Sequence seqTypes; - CComDispatchDriver disp( pUnk); - if( disp) - { - CComVariant var; - HRESULT hr= S_OK; - // There are two different property names possible. - if( FAILED( hr= disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP, &var))) - { - hr= disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP2, &var); - } - if (SUCCEEDED( hr)) - { - // we exspect an array( SafeArray or IDispatch) of Strings. - Any anyNames; - variantToAny( &var, anyNames, getCppuType( (Sequence*) 0)); - Sequence seqAny; - if( anyNames >>= seqAny) - { - seqTypes.realloc( seqAny.getLength()); - for( sal_Int32 i=0; i < seqAny.getLength(); i++) - { - OUString typeName; - seqAny[i] >>= typeName; - seqTypes[i]= Type( TypeClass_INTERFACE, typeName); - } - } - } - } - return seqTypes; -} -template -Reference UnoConversionUtilities::getTypeConverter() -{ - if ( ! m_typeConverter.is()) - { - MutexGuard guard(getBridgeMutex()); - if ( ! m_typeConverter.is()) - { - Reference xIntConverter = - m_smgr->createInstance(OUSTR("com.sun.star.script.Converter")); - if (xIntConverter.is()) - m_typeConverter = Reference(xIntConverter, UNO_QUERY); - } - } - return m_typeConverter; -} - -// This function tries to the change the type of a value (contained in the Any) -// to the smallest possible that can hold the value. This is actually done only -// for types of VT_I4 (see o2u_variantToAny). The reason is the following: -// JavaScript passes integer values always as VT_I4. If there is a parameter or -// property of type any then the bridge converts the any's content according -// to "o2u_variantToAny". Because the VARTYPE is VT_I4 the value would be converted -// to TypeClass_LONG. Say the method XPropertySet::setPropertyValue( string name, any value) -// would be called on an object and the property actually is of TypeClass_SHORT. -// After conversion of the VARIANT parameter the Any would contain type -// TypeClass_LONG. Because the corereflection does not cast from long to short -// the "setPropertValue" would fail as the value has not the right type. - -// The corereflection does convert small integer types to bigger types. -// Therefore we can reduce the type if possible and avoid the above mentioned -// problem. - -// The function is not used when elements are to be converted for Sequences. - -#ifndef _REDUCE_RANGE -#define _REDUCE_RANGE -inline void reduceRange( Any& any) -{ - OSL_ASSERT( any.getValueTypeClass() == TypeClass_LONG); - - sal_Int32 value= *(sal_Int32*)any.getValue(); - if( value <= 0x7f && value >= -0x80) - {// -128 bis 127 - sal_Int8 charVal= static_cast( value); - any.setValue( &charVal, getCppuType( (sal_Int8*)0)); - } - else if( value <= 0x7fff && value >= -0x8000) - {// -32768 bis 32767 - sal_Int16 shortVal= static_cast( value); - any.setValue( &shortVal, getCppuType( (sal_Int16*)0)); - } -} -#endif - - - -} // end namespace -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx deleted file mode 100644 index 268370cab..000000000 --- a/extensions/source/ole/unoobjw.cxx +++ /dev/null @@ -1,1688 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "ole2uno.hxx" -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "comifaces.hxx" -#include "jscriptclasses.hxx" -#include "unotypewrapper.hxx" -#include "oleobjw.hxx" -#include "unoobjw.hxx" -#include "servprov.hxx" - -using namespace std; -using namespace osl; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; -using namespace com::sun::star::script; -using namespace com::sun::star::lang; -using namespace com::sun::star::bridge::ModelDependent; -using namespace com::sun::star::reflection; - -using ::rtl::OUString; - -#if _MSC_VER < 1200 -extern "C" const GUID IID_IDispatchEx; -#endif - -namespace ole_adapter -{ -boost::unordered_map > UnoObjToWrapperMap; -static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource); -static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource); -static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int * puArgErr); - - -/* Does not throw any exceptions. - Param pInfo can be NULL. - */ -static void writeExcepinfo(EXCEPINFO * pInfo, const OUString& message) -{ - if (pInfo != NULL) - { - pInfo->wCode = UNO_2_OLE_EXCEPTIONCODE; - pInfo->bstrSource = SysAllocString(L"[automation bridge] "); - pInfo->bstrDescription = SysAllocString(reinterpret_cast(message.getStr())); - } -} - -/***************************************************************************** - - class implementation: InterfaceOleWrapper_Impl - -*****************************************************************************/ -InterfaceOleWrapper_Impl::InterfaceOleWrapper_Impl( Reference& xFactory, - sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass): - m_defaultValueType( 0), - UnoConversionUtilities( xFactory, unoWrapperClass, comWrapperClass) -{ -} - -InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl() -{ - MutexGuard guard(getBridgeMutex()); - // remove entries in global map - IT_Uno it= UnoObjToWrapperMap.find( (sal_uInt32) m_xOrigin.get()); - if(it != UnoObjToWrapperMap.end()) - UnoObjToWrapperMap.erase(it); -#if OSL_DEBUG_LEVEL > 0 - fprintf(stderr,"[automation bridge] UnoObjToWrapperMap contains: %i \n", - UnoObjToWrapperMap.size()); -#endif - -} - -STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv) -{ - HRESULT ret= S_OK; - - if( !ppv) - return E_POINTER; - - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = (IUnknown*) (IDispatch*) this; - } - else if (IsEqualIID(riid, IID_IDispatch)) - { - AddRef(); - *ppv = (IDispatch*) this; - } - else if( IsEqualIID( riid, __uuidof( IUnoObjectWrapper))) - { - AddRef(); - *ppv= (IUnoObjectWrapper*) this; - } - else - ret= E_NOINTERFACE; - return ret; -} - -STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::AddRef() -{ - acquire(); - // does not need to guard because one should not rely on the return value of - // AddRef anyway - return m_refCount; -} - -STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::Release() -{ - ULONG n= m_refCount; - release(); - return n - 1; -} - -// IUnoObjectWrapper -------------------------------------------------------- -STDMETHODIMP InterfaceOleWrapper_Impl::getWrapperXInterface( Reference* pXInt) -{ - *pXInt= Reference( static_cast( this), UNO_QUERY); - return pXInt->is() ? S_OK : E_FAIL; -} -STDMETHODIMP InterfaceOleWrapper_Impl::getOriginalUnoObject( Reference* pXInt) -{ - *pXInt= m_xOrigin; - return m_xOrigin.is() ? S_OK : E_FAIL; -} -STDMETHODIMP InterfaceOleWrapper_Impl::getOriginalUnoStruct( Any * pStruct) -{ - HRESULT ret= E_FAIL; - if( !m_xOrigin.is()) - { - Reference xMatHolder( m_xInvocation, UNO_QUERY); - if( xMatHolder.is()) - { - Any any = xMatHolder->getMaterial(); - if( any.getValueTypeClass() == TypeClass_STRUCT) - { - *pStruct= any; - ret= S_OK; - } - } - } - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfoCount( unsigned int * /*pctinfo*/ ) -{ - return E_NOTIMPL ; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfo(unsigned int /*itinfo*/, LCID /*lcid*/, ITypeInfo ** /*pptinfo*/) -{ - return E_NOTIMPL; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, - OLECHAR ** rgszNames, - unsigned int cNames, - LCID /*lcid*/, - DISPID * rgdispid ) -{ - HRESULT ret = DISP_E_UNKNOWNNAME; - try - { - MutexGuard guard( getBridgeMutex()); - if( ! rgdispid) - return E_POINTER; - - // ---------------------------------------- - if( ! _wcsicmp( *rgszNames, JSCRIPT_VALUE_FUNC) || - ! _wcsicmp( *rgszNames, BRIDGE_VALUE_FUNC)) - { - *rgdispid= DISPID_JSCRIPT_VALUE_FUNC; - return S_OK; - } - else if( ! _wcsicmp( *rgszNames, GET_STRUCT_FUNC) || - ! _wcsicmp( *rgszNames, BRIDGE_GET_STRUCT_FUNC)) - { - *rgdispid= DISPID_GET_STRUCT_FUNC; - return S_OK; - } - else if( ! _wcsicmp( *rgszNames, BRIDGE_CREATE_TYPE_FUNC)) - { - *rgdispid= DISPID_CREATE_TYPE_FUNC; - return S_OK; - } - - // ---------------------------------------- - if (m_xInvocation.is() && (cNames > 0)) - { - OUString name(reinterpret_cast(rgszNames[0])); - NameToIdMap::iterator iter = m_nameToDispIdMap.find(name); - - if (iter == m_nameToDispIdMap.end()) - { - OUString exactName; - - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName(name); - } - else - { - exactName = name; - } - - MemberInfo d(0, exactName); - - if (m_xInvocation->hasProperty(exactName)) - { - d.flags |= DISPATCH_PROPERTYGET; - d.flags |= DISPATCH_PROPERTYPUT; - d.flags |= DISPATCH_PROPERTYPUTREF; - } - - if (m_xInvocation->hasMethod(exactName)) - { - d.flags |= DISPATCH_METHOD; - } - - if (d.flags != 0) - { - m_MemberInfos.push_back(d); - iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(exactName, (DISPID)m_MemberInfos.size())).first; - - if (exactName != name) - { - iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(name, (DISPID)m_MemberInfos.size())).first; - } - } - } - - if (iter == m_nameToDispIdMap.end()) - { - ret = DISP_E_UNKNOWNNAME; - } - else - { - *rgdispid = (*iter).second; - ret = S_OK; - } - } - } - catch(BridgeRuntimeError& ) - { - OSL_ASSERT(0); - } - catch(Exception& ) - { - OSL_ASSERT(0); - } - catch(...) - { - OSL_ASSERT(0); - } - - return ret; -} - -// "convertDispparamsArgs" converts VARIANTS to their respecting Any counterparts -// The parameters "id", "wFlags" and "pdispparams" equal those as used in -// IDispatch::Invoke. The function handles special JavaScript -// cases where a VARIANT of type VT_DISPATCH is ambiguous and could represent -// an object, array ( JavaScript Array object), out parameter and in/out ( JavaScript Array object) -// parameter (JavaScript Array object) -// Because all those VT_DISPATCH objects need a different conversion -// we have to find out what the object is supposed to be. The function does this -// by either using type information or by help of a specialized ValueObject object. - -// A. Type Information -// ----------------------------------------------------------------------------- -// With the help of type information the kind of parameter can be exactly determined -// and an appropriate conversion can be choosen. A problem arises if a method expects -// an Any. Then the type info does not tell what the type of the value, that is kept -// by the any, should be. In this situation the decision wheter the param is a -// sequence or an object is made upon the fact if the object has a property "0" -// ( see function "isJScriptArray"). Since this is unsafe it is recommended to use -// the JScript value objects within a JScript script on such an occasion. - -// B. JavaScript Value Object ( class JScriptValue ) -// ----------------------------------------------------------------------------- -// A JScriptValue (ValueObject) object is a COM object in that it implements IDispatch and the -// IJScriptValue object interface. Such objects are provided by all UNO wrapper -// objects used within a JScript script. To obtain an instance one has to call -// "_GetValueObject() or Bridge_GetValueObject()" on an UNO wrapper object (class InterfaceOleWrapper_Impl). -// A value object is appropriately initialized within the script and passed as -// parameter to an UNO object method or property. The convertDispparamsArgs function -// can easily find out that a param is such an object by queriing for the -// IJScriptValue interface. By this interface one the type and kind ( out, in/out) -// can be determined and the right conversion can be applied. -// Using ValueObjects we spare us the effort of aquiring and examining type information -// in order to figure out what the an IDispatch parameter is meant for. - -// Normal JScript object parameter can be mixed with JScriptValue object. If an -// VARIANT contains an VT_DISPATCH that is no JScriptValue than the type information -// is used to find out about the reqired type. -void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id, - unsigned short /*wFlags*/, DISPPARAMS* pdispparams, Sequence& rSeq) -{ - HRESULT hr= S_OK; - sal_Int32 countArgs= pdispparams->cArgs; - if( countArgs == 0) - return; - - rSeq.realloc( countArgs); - Any* pParams = rSeq.getArray(); - - Any anyParam; - - //Get type information for the current call - InvocationInfo info; - if( ! getInvocationInfoForCall( id, info)) - throw BridgeRuntimeError( - OUSTR("[automation bridge]InterfaceOleWrapper_Impl::convertDispparamsArgs \n" - "Could not obtain type information for current call.")); - - for (int i = 0; i < countArgs; i++) - { - if (info.eMemberType == MemberType_METHOD && - info.aParamModes[ countArgs - i -1 ] == ParamMode_OUT) - continue; - - if(convertValueObject( & pdispparams->rgvarg[i], anyParam)) - { //a param is a ValueObject and could be converted - pParams[countArgs - (i + 1)] = anyParam; - continue; - } - - // If the param is an out, in/out parameter in - // JScript (Array object, with value at index 0) then we - // extract Array[0] and put the value into varParam. At the end of the loop varParam - // is converted if it contains a value otherwise the VARIANT from - // DISPPARAMS is converted. - CComVariant varParam; - - // Check for JScript out and in/out paramsobjects (VT_DISPATCH). - // To find them out we use typeinformation of the function being called. - if( pdispparams->rgvarg[i].vt == VT_DISPATCH ) - { - if( info.eMemberType == MemberType_METHOD && info.aParamModes[ countArgs - i -1 ] == ParamMode_INOUT) - { - // INOUT-param - // Index ( property) "0" contains the actual IN-param. The object is a JScript - // Array object. - // Get the IN-param at index "0" - IDispatch* pdisp= pdispparams->rgvarg[i].pdispVal; - - OLECHAR* sindex= L"0"; - DISPID id; - DISPPARAMS noParams= {0,0,0,0}; - if(SUCCEEDED( hr= pdisp->GetIDsOfNames( IID_NULL, &sindex, 1, LOCALE_USER_DEFAULT, &id))) - hr= pdisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, - & noParams, & varParam, NULL, NULL); - if( FAILED( hr)) - { - throw BridgeRuntimeError( - OUSTR("[automation bridge] Could not determine " - "if the object has a member \"0\". Error: ") + - OUString::valueOf(hr)); - } - } - } - - if( varParam.vt == VT_EMPTY) // then it was no in/out parameter - varParam= pdispparams->rgvarg[i]; - - if(info.eMemberType == MemberType_METHOD) - variantToAny( & varParam, anyParam, - info.aParamTypes[ countArgs - i - 1]); - else if(info.eMemberType == MemberType_PROPERTY) - variantToAny( & varParam, anyParam, info.aType); - else - OSL_ASSERT(0); - - pParams[countArgs - (i + 1)]= anyParam; - }// end for / iterating over all parameters -} - -sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, InvocationInfo& info) -{ - sal_Bool bTypesAvailable= sal_False; - - if( !m_xInvocation.is() )return false; - Reference inv2( m_xInvocation, UNO_QUERY); - if( inv2.is()) - { - // We need the name of the property or method to get its type information. - // The name can be identified through the param "id" - // that is kept as value in the map m_nameToDispIdMap. - // Proplem: the Windows JScript engine sometimes changes small letters to capital - // letters as happens in xidlclass_obj.createObject( var) // in JScript. - // IDispatch::GetIdsOfNames is then called with "CreateObject" !!! - // m_nameToDispIdMap can contain several names for one DISPID but only one is - // the exact one. If there's no m_xExactName and therefore no exact name then - // there's only one entry in the map. - typedef NameToIdMap::const_iterator cit; - OUString sMemberName; - - for(cit ci1= m_nameToDispIdMap.begin(); ci1 != m_nameToDispIdMap.end(); ++ci1) - { - if( (*ci1).second == id) // iterator is a pair< OUString, DISPID> - { - sMemberName= (*ci1).first; - break; - } - } - // Get information for the current call ( property or method). - // There could be similar names which only differ in the cases - // of letters. First we assume that the name which was passed into - // GetIDsOfNames is correct. If we won't get information with that - // name then we have the invocation service use the XExactName interface. - sal_Bool validInfo= sal_True; - InvocationInfo invInfo; - try{ - invInfo= inv2->getInfoForName( sMemberName, sal_False); - } - catch( IllegalArgumentException ) - { - validInfo= sal_False; - } - - if( ! validInfo) - { - invInfo= inv2->getInfoForName( sMemberName, sal_True); - } - if( invInfo.aName.pData) - { - bTypesAvailable= sal_True; - info= invInfo; - } - } - return bTypesAvailable; -} -// XBridgeSupplier2 --------------------------------------------------- -// only bridges itself ( this instance of InterfaceOleWrapper_Impl)from UNO to IDispatch -// If sourceModelType is UNO than any UNO interface implemented by InterfaceOleWrapper_Impl -// can bridged to IDispatch ( if destModelType == OLE). The IDispatch is -// implemented by this class. -Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject, - const Sequence& /*ProcessId*/, - sal_Int16 sourceModelType, - sal_Int16 destModelType) - throw (IllegalArgumentException, RuntimeException) -{ - - Any retAny; - if( sourceModelType == UNO && destModelType == OLE && - modelDepObject.getValueTypeClass() == TypeClass_INTERFACE ) - { - Reference xInt; - if( modelDepObject >>= xInt ) - { - if( xInt == Reference( static_cast( this), UNO_QUERY)) - { - VARIANT *pVar= (VARIANT*)CoTaskMemAlloc( sizeof( VARIANT)); - if( pVar) - { - pVar->vt= VT_DISPATCH; - pVar->pdispVal= static_cast( this); - AddRef(); - - retAny<<= reinterpret_cast< sal_uInt32 >( pVar); - } - } - } - } - - return retAny; -} - - -// XInitialization -------------------------------------------------- -void SAL_CALL InterfaceOleWrapper_Impl::initialize( const Sequence< Any >& aArguments ) - throw(Exception, RuntimeException) -{ - switch( aArguments.getLength() ) - { - case 2: // the object wraps an UNO struct - aArguments[0] >>= m_xInvocation; - aArguments[1] >>= m_defaultValueType; - break; - case 3: // the object wraps an UNO interface - aArguments[0] >>= m_xInvocation; - aArguments[1] >>= m_xOrigin; - aArguments[2] >>= m_defaultValueType; - break; - } - - m_xExactName= Reference( m_xInvocation, UNO_QUERY); -} - -Reference< XInterface > InterfaceOleWrapper_Impl::createUnoWrapperInstance() -{ - Reference xWeak= static_cast( new InterfaceOleWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - -Reference InterfaceOleWrapper_Impl::createComWrapperInstance() -{ - Reference xWeak= static_cast( new IUnknownWrapper_Impl( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - - - -// "getType" is used in convertValueObject to map the string denoting the type -// to an actual Type object. -bool getType( const BSTR name, Type & type) -{ - Type retType; - bool ret = false; - typelib_TypeDescription * pDesc= NULL; - OUString str( reinterpret_cast(name)); - typelib_typedescription_getByName( &pDesc, str.pData ); - if( pDesc) - { - type = Type( pDesc->pWeakRef ); - typelib_typedescription_release( pDesc); - ret = true; - } - return ret; -} - -static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource) -{ - sal_Bool ret = sal_False; - HRESULT hr; - - // Handle JScriptValue objects and JScript out params ( Array object ) - CComVariant varDest( *pDest); - - if( SUCCEEDED( varDest.ChangeType(VT_DISPATCH))) - { - CComPtr spDispDest(varDest.pdispVal); - - // special Handling for a JScriptValue object -#ifdef __MINGW32__ - CComQIPtr spValueDest(spDispDest); -#else - CComQIPtr spValueDest(spDispDest); -#endif - if (spValueDest) - { - VARIANT_BOOL varBool= VARIANT_FALSE; - if( SUCCEEDED( hr= spValueDest->IsOutParam( &varBool) ) - && varBool == VARIANT_TRUE || - SUCCEEDED(hr= spValueDest->IsInOutParam( &varBool) ) - && varBool == VARIANT_TRUE ) - { - if( SUCCEEDED( spValueDest->Set( CComVariant(), *pSource))) - ret= sal_True; - } - } - else if (pDest->vt == VT_DISPATCH)// VT_DISPATCH -> JScript out param - { - // We use IDispatchEx because its GetDispID function causes the creation - // of a property if it does not exist already. This is convenient for - // out parameters in JScript. Then the user must not specify propery "0" - // explicitly -#ifdef __MINGW32__ - CComQIPtr spDispEx( spDispDest); -#else - CComQIPtr spDispEx( spDispDest); -#endif - if( spDispEx) - { - CComBSTR nullProp(L"0"); - DISPID dwDispID; - if( SUCCEEDED( spDispEx->GetDispID( nullProp, fdexNameEnsure, &dwDispID))) - { - DISPPARAMS dispparams = {NULL, NULL, 1, 1}; - dispparams.rgvarg = pSource; - DISPID dispidPut = DISPID_PROPERTYPUT; - dispparams.rgdispidNamedArgs = &dispidPut; - - if (pSource->vt == VT_UNKNOWN || pSource->vt == VT_DISPATCH || - (pSource->vt & VT_ARRAY) || (pSource->vt & VT_BYREF)) - hr = spDispEx->InvokeEx(dwDispID, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUTREF, - &dispparams, NULL, NULL, NULL); - else - hr= spDispEx->InvokeEx(dwDispID, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, - &dispparams, NULL, NULL, NULL); - if( SUCCEEDED(hr)) - ret= sal_True; - } - } - } - else - ret= writeBackOutParameter( pDest, pSource); - } - else // The param can't be a JScript out-parameter ( an Array object), it could be a VBScript - { // param. The function checks itself for correct VBScript params - ret= writeBackOutParameter( pDest, pSource); - } - return ret; -} -// VisualBasic Script passes arguments as VT_VARIANT | VT_BYREF be it in or out parameter. -// Thus we are in charge of freeing an eventual value contained by the inner VARIANT -// Please note: VariantCopy doesn't free a VT_BYREF value -// The out parameters are expected to have always a valid type -static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource) -{ - HRESULT hr; - sal_Bool ret = FALSE; - // Out parameter must be VT_BYREF - if ((V_VT(pDest) & VT_BYREF) != 0 ) - { - VARTYPE oleTypeFlags = V_VT(pSource); - - // if caller accept VARIANT as out parameter, any value must be converted - if (V_VT(pDest) == (VT_VARIANT | VT_BYREF)) - { - // When the user provides a VARIANT rather then a concrete type - // we just copy the source to the out, in/out parameter - // VT_DISPATCH, VT_UNKNOWN, VT_ARRAY, VT_BSTR in the VARIANT that - // is contained in pDest are released by VariantCopy - VariantCopy(V_VARIANTREF(pDest), pSource); - ret = sal_True; - } - else - { - // variantarg and variant must have same type - if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags) - { - if ((oleTypeFlags & VT_ARRAY) != 0) - { - // In / Out Param - if( *V_ARRAYREF(pDest) != NULL) - hr= SafeArrayCopyData( V_ARRAY(pSource), *V_ARRAYREF(pDest)); - else - // Out Param - hr= SafeArrayCopy(V_ARRAY(pSource), V_ARRAYREF(pDest)) == NOERROR; - if( SUCCEEDED( hr)) - ret = sal_True; - } - else - { - // copy base type - switch (V_VT(pSource)) - { - case VT_I2: - { - *V_I2REF(pDest) = V_I2(pSource); - ret = sal_True; - break; - } - case VT_I4: - *V_I4REF(pDest) = V_I4(pSource); - ret = sal_True; - break; - case VT_R4: - *V_R4REF(pDest) = V_R4(pSource); - ret = sal_True; - break; - case VT_R8: - *V_R8REF(pDest) = V_R8(pSource); - ret = sal_True; - break; - case VT_CY: - *V_CYREF(pDest) = V_CY(pSource); - ret = sal_True; - break; - case VT_DATE: - *V_DATEREF(pDest) = V_DATE(pSource); - ret = sal_True; - break; - case VT_BSTR: - SysFreeString( *pDest->pbstrVal); - - *V_BSTRREF(pDest) = SysAllocString(V_BSTR(pSource)); - ret = sal_True; - break; - case VT_DISPATCH: - if (*V_DISPATCHREF(pDest) != NULL) - (*V_DISPATCHREF(pDest))->Release(); - - *V_DISPATCHREF(pDest) = V_DISPATCH(pSource); - - if (*V_DISPATCHREF(pDest) != NULL) - (*V_DISPATCHREF(pDest))->AddRef(); - - ret = sal_True; - break; - case VT_ERROR: - *V_ERRORREF(pDest) = V_ERROR(pSource); - ret = sal_True; - break; - case VT_BOOL: - *V_BOOLREF(pDest) = V_BOOL(pSource); - ret = sal_True; - break; - case VT_UNKNOWN: - if (*V_UNKNOWNREF(pDest) != NULL) - (*V_UNKNOWNREF(pDest))->Release(); - - *V_UNKNOWNREF(pDest) = V_UNKNOWN(pSource); - - if (*V_UNKNOWNREF(pDest) != NULL) - (*V_UNKNOWNREF(pDest))->AddRef(); - - ret = sal_True; - break; - case VT_I1: - *V_I1REF(pDest) = V_I1(pSource); - ret = sal_True; - break; - case VT_UI1: - *V_UI1REF(pDest) = V_UI1(pSource); - ret = sal_True; - break; - case VT_UI2: - *V_UI2REF(pDest) = V_UI2(pSource); - ret = sal_True; - break; - case VT_UI4: - *V_UI4REF(pDest) = V_UI4(pSource); - ret = sal_True; - break; - case VT_INT: - *V_INTREF(pDest) = V_INT(pSource); - ret = sal_True; - break; - case VT_UINT: - *V_UINTREF(pDest) = V_UINT(pSource); - ret = sal_True; - break; - case VT_DECIMAL: - memcpy(pDest->pdecVal, pSource, sizeof(DECIMAL)); - ret = sal_True; - break; - default: - break; - } - } - } - else - { - // Handling of special cases - // Destination and source types are different - if( pDest->vt == (VT_BSTR | VT_BYREF) - && pSource->vt == VT_I2) - { - // When the user provides a String as out our in/out parameter - // and the type is char (TypeClass_CHAR) then we convert to a BSTR - // instead of VT_I2 as is done otherwise - OLECHAR buff[]= {0,0}; - buff[0]= pSource->iVal; - - SysFreeString( *pDest->pbstrVal); - *pDest->pbstrVal= SysAllocString( buff); - ret = sal_True; - } - } - } - } - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, - REFIID /*riid*/, - LCID /*lcid*/, - unsigned short wFlags, - DISPPARAMS * pdispparams, - VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, - unsigned int * puArgErr ) -{ - HRESULT ret = S_OK; - - try - { - sal_Bool bHandled= sal_False; - ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo, - puArgErr, bHandled); - if( bHandled) - return ret; - - if ((dispidMember > 0) && ((size_t)dispidMember <= m_MemberInfos.size()) && m_xInvocation.is()) - { - MemberInfo d = m_MemberInfos[dispidMember - 1]; - DWORD flags = wFlags & d.flags; - - if (flags != 0) - { - if ((flags & DISPATCH_METHOD) != 0) - { - if (pdispparams->cNamedArgs > 0) - ret = DISP_E_NONAMEDARGS; - else - { - Sequence params; - - convertDispparamsArgs(dispidMember, wFlags, pdispparams , params ); - - ret= doInvoke(pdispparams, pvarResult, - pexcepinfo, puArgErr, d.name, params); - } - } - else if ((flags & DISPATCH_PROPERTYGET) != 0) - { - ret= doGetProperty( pdispparams, pvarResult, - pexcepinfo, d.name); - } - else if ((flags & DISPATCH_PROPERTYPUT || flags & DISPATCH_PROPERTYPUTREF) != 0) - { - if (pdispparams->cArgs != 1) - ret = DISP_E_BADPARAMCOUNT; - else - { - Sequence params; - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - if(params.getLength() > 0) - ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, d.name, params); - else - ret = DISP_E_BADVARTYPE; - } - } - } - else - ret= DISP_E_MEMBERNOTFOUND; - } - else - ret = DISP_E_MEMBERNOTFOUND; - } - catch(BridgeRuntimeError& e) - { - writeExcepinfo(pexcepinfo, e.message); - ret = DISP_E_EXCEPTION; - } - catch(Exception& e) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::Invoke : \n") + - e.Message; - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - catch(...) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::Invoke : \n" - "Unexpected exception"); - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - - return ret; -} - -HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence& params) -{ - - - HRESULT ret= S_OK; - try - { - Sequence outIndex; - Sequence outParams; - Any returnValue; - - if (pdispparams->cNamedArgs > 0) - return DISP_E_NONAMEDARGS; - - // invoke method and take care of exceptions - returnValue = m_xInvocation->invoke(name, - params, - outIndex, - outParams); - - // try to write back out parameter - if (outIndex.getLength() > 0) - { - const sal_Int16* pOutIndex = outIndex.getConstArray(); - const Any* pOutParams = outParams.getConstArray(); - - for (sal_Int32 i = 0; i < outIndex.getLength(); i++) - { - CComVariant variant; - // Currently a Sequence is converted to an SafeArray of VARIANTs. - anyToVariant( &variant, pOutParams[i]); - - // out parameter need special handling if they are VT_DISPATCH - // and used in JScript - int outindex= pOutIndex[i]; - writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]), - &variant ); - } - } - - // write back return value - if (pvarResult != NULL) - anyToVariant(pvarResult, returnValue); - } - catch(IllegalArgumentException & e) //XInvocation::invoke - { - writeExcepinfo(pexcepinfo, e.Message); - ret = DISP_E_TYPEMISMATCH; - } - catch(CannotConvertException & e) //XInvocation::invoke - { - writeExcepinfo(pexcepinfo, e.Message); - ret = mapCannotConvertException( e, puArgErr); - } - catch(InvocationTargetException & e) //XInvocation::invoke - { - const Any& org = e.TargetException; - Exception excTarget; - org >>= excTarget; - OUString message= - org.getValueType().getTypeName() + OUSTR(": ") + excTarget.Message; - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - catch(NoSuchMethodException & e) //XInvocation::invoke - { - writeExcepinfo(pexcepinfo, e.Message); - ret = DISP_E_MEMBERNOTFOUND; - } - catch(BridgeRuntimeError & e) - { - writeExcepinfo(pexcepinfo, e.message); - ret = DISP_E_EXCEPTION; - } - catch(Exception & e) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n") + - e.Message; - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - catch( ... ) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" - "Unexpected exception"); - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - return ret; -} - -HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, OUString& name) -{ - HRESULT ret= S_OK; - - Any value; - try - { - Any returnValue = m_xInvocation->getValue( name); - // write back return value - if (pvarResult) - anyToVariant(pvarResult, returnValue); - } - catch(UnknownPropertyException e) //XInvocation::getValue - { - writeExcepinfo(pexcepinfo, e.Message); - ret = DISP_E_MEMBERNOTFOUND; - } - catch(BridgeRuntimeError& e) - { - writeExcepinfo(pexcepinfo, e.message); - ret = DISP_E_EXCEPTION; - } - catch(Exception& e) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doGetProperty : \n") + - e.Message; - writeExcepinfo(pexcepinfo, message); - } - catch( ... ) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::doInvoke : \n" - "Unexpected exception"); - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - return ret; -} - -HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, - EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence params) -{ - HRESULT ret= S_OK; - - try - { - m_xInvocation->setValue( name, params.getConstArray()[0]); - } - catch(UnknownPropertyException ) - { - ret = DISP_E_MEMBERNOTFOUND; - } - catch(CannotConvertException e) - { - ret= mapCannotConvertException( e, puArgErr); - } - catch(InvocationTargetException e) - { - if (pexcepinfo != NULL) - { - Any org = e.TargetException; - - pexcepinfo->wCode = UNO_2_OLE_EXCEPTIONCODE; - pexcepinfo->bstrSource = SysAllocString(L"any ONE component"); - pexcepinfo->bstrDescription = SysAllocString( - reinterpret_cast(org.getValueType().getTypeName().getStr())); - } - ret = DISP_E_EXCEPTION; - } - catch( ... ) - { - ret= DISP_E_EXCEPTION; - } - return ret; -} - -HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned short wFlags, - DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, - unsigned int * /*puArgErr*/, sal_Bool& bHandled) -{ - HRESULT ret= S_OK; - try - { -// DISPID_VALUE | The DEFAULT Value is required in JScript when the situation -// is that we put an object into an Array object ( out parameter). We have to return -// IDispatch otherwise the object cannot be accessed from the Script. - if( dispidMember == DISPID_VALUE && wFlags == DISPATCH_PROPERTYGET - && m_defaultValueType != VT_EMPTY && pvarResult != NULL) - { - bHandled= sal_True; - if( m_defaultValueType == VT_DISPATCH) - { - pvarResult->vt= VT_DISPATCH; - pvarResult->pdispVal= static_cast( this); - AddRef(); - ret= S_OK; - } - } -// --------- - // function: _GetValueObject - else if( dispidMember == DISPID_JSCRIPT_VALUE_FUNC) - { - bHandled= sal_True; - if( !pvarResult) - ret= E_POINTER; - CComObject< JScriptValue>* pValue; - if( SUCCEEDED( CComObject::CreateInstance( &pValue))) - { - pValue->AddRef(); - pvarResult->vt= VT_DISPATCH; -#ifdef __MINGW32__ - pvarResult->pdispVal= CComQIPtr(pValue->GetUnknown()); -#else - pvarResult->pdispVal= CComQIPtr(pValue->GetUnknown()); -#endif - ret= S_OK; - } - else - ret= DISP_E_EXCEPTION; - } - else if( dispidMember == DISPID_GET_STRUCT_FUNC) - { - bHandled= sal_True; - sal_Bool bStruct= sal_False; - - - Reference xIntCore= m_smgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection"))); - Reference xRefl( xIntCore, UNO_QUERY); - if( xRefl.is() ) - { - // the first parameter is in DISPPARAMS rgvargs contains the name of the struct. - CComVariant arg; - if( pdispparams->cArgs == 1 && SUCCEEDED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0])) ) - { - Reference classStruct= xRefl->forName( reinterpret_cast(arg.bstrVal)); - if( classStruct.is()) - { - Any anyStruct; - classStruct->createObject( anyStruct); - CComVariant var; - anyToVariant( &var, anyStruct ); - - if( var.vt == VT_DISPATCH) - { - VariantCopy( pvarResult, & var); - bStruct= sal_True; - } - } - } - } - ret= bStruct == sal_True ? S_OK : DISP_E_EXCEPTION; - } - else if (dispidMember == DISPID_CREATE_TYPE_FUNC) - { - bHandled= sal_True; - if( !pvarResult) - ret= E_POINTER; - // the first parameter is in DISPPARAMS rgvargs contains the name of the struct. - CComVariant arg; - if( pdispparams->cArgs != 1) - return DISP_E_BADPARAMCOUNT; - if (FAILED( arg.ChangeType( VT_BSTR, &pdispparams->rgvarg[0]))) - return DISP_E_BADVARTYPE; - - //check if the provided name represents a valid type - Type type; - if (getType(arg.bstrVal, type) == false) - { - writeExcepinfo(pexcepinfo,OUString( - OUSTR("[automation bridge] A UNO type with the name ") + - OUString(reinterpret_cast(arg.bstrVal)) + OUSTR(" does not exist!"))); - return DISP_E_EXCEPTION; - } - - if (createUnoTypeWrapper(arg.bstrVal, pvarResult) == false) - { - writeExcepinfo(pexcepinfo,OUSTR("[automation bridge] InterfaceOleWrapper_Impl::InvokeGeneral\n" - "Could not initialize UnoTypeWrapper object!")); - return DISP_E_EXCEPTION; - } - } - } - catch(BridgeRuntimeError & e) - { - writeExcepinfo(pexcepinfo, e.message); - ret = DISP_E_EXCEPTION; - } - catch(Exception & e) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::InvokeGeneral : \n") + - e.Message; - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - catch( ... ) - { - OUString message= OUSTR("InterfaceOleWrapper_Impl::InvokeGeneral : \n" - "Unexpected exception"); - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - return ret; -} - - - - -STDMETHODIMP InterfaceOleWrapper_Impl::GetDispID(BSTR /*bstrName*/, DWORD /*grfdex*/, DISPID __RPC_FAR* /*pid*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx( - /* [in] */ DISPID /*id*/, - /* [in] */ LCID /*lcid*/, - /* [in] */ WORD /*wFlags*/, - /* [in] */ DISPPARAMS __RPC_FAR* /*pdp*/, - /* [out] */ VARIANT __RPC_FAR* /*pvarRes*/, - /* [out] */ EXCEPINFO __RPC_FAR* /*pei*/, - /* [unique][in] */ IServiceProvider __RPC_FAR* /*pspCaller*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - - -STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByName( - /* [in] */ BSTR /*bstr*/, - /* [in] */ DWORD /*grfdex*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByDispID(DISPID /*id*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties( - /* [in] */ DISPID /*id*/, - /* [in] */ DWORD /*grfdexFetch*/, - /* [out] */ DWORD __RPC_FAR* /*pgrfdex*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberName( - /* [in] */ DISPID /*id*/, - /* [out] */ BSTR __RPC_FAR* /*pbstrName*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID( - /* [in] */ DWORD /*grfdex*/, - /* [in] */ DISPID /*id*/, - /* [out] */ DISPID __RPC_FAR* /*pid*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - -STDMETHODIMP InterfaceOleWrapper_Impl::GetNameSpaceParent( - /* [out] */ IUnknown __RPC_FAR *__RPC_FAR* /*ppunk*/) -{ - HRESULT ret = ResultFromScode(E_NOTIMPL); - - return ret; -} - - -/************************************************************************* - - UnoObjectWrapperRemoteOpt - -*************************************************************************/ -UnoObjectWrapperRemoteOpt::UnoObjectWrapperRemoteOpt( Reference& aFactory, - sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass): -InterfaceOleWrapper_Impl( aFactory, unoWrapperClass, comWrapperClass), -m_currentId(1) - -{ -} -UnoObjectWrapperRemoteOpt::~UnoObjectWrapperRemoteOpt() -{ -} - -// UnoConversionUtilities -Reference< XInterface > UnoObjectWrapperRemoteOpt::createUnoWrapperInstance() -{ - Reference xWeak= static_cast( new UnoObjectWrapperRemoteOpt( - m_smgr, m_nUnoWrapperClass, m_nComWrapperClass)); - return Reference( xWeak, UNO_QUERY); -} - -STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( REFIID /*riid*/, OLECHAR ** rgszNames, unsigned int cNames, - LCID /*lcid*/, DISPID * rgdispid ) -{ - MutexGuard guard( getBridgeMutex()); - - if( ! rgdispid) - return E_POINTER; - HRESULT ret = E_UNEXPECTED; - // ---------------------------------------- - // _GetValueObject - if( ! wcscmp( *rgszNames, JSCRIPT_VALUE_FUNC)) - { - *rgdispid= DISPID_JSCRIPT_VALUE_FUNC; - return S_OK; - } - else if( ! wcscmp( *rgszNames, GET_STRUCT_FUNC)) - { - *rgdispid= DISPID_GET_STRUCT_FUNC; - return S_OK; - } - - // ---------------------------------------- - if (m_xInvocation.is() && (cNames > 0)) - { - OUString name(reinterpret_cast(rgszNames[0])); - // has this name been determined as "bad" - BadNameMap::iterator badIter= m_badNameMap.find( name); - if( badIter == m_badNameMap.end() ) - { - // name has not been bad before( member exists - typedef NameToIdMap::iterator ITnames; - pair< ITnames, bool > pair_id= m_nameToDispIdMap.insert( NameToIdMap::value_type(name, m_currentId++)); - // new ID inserted ? - if( pair_id.second ) - {// yes, now create MemberInfo and ad to IdToMemberInfoMap - MemberInfo d(0, name); - m_idToMemberInfoMap.insert( IdToMemberInfoMap::value_type( m_currentId - 1, d)); - } - - *rgdispid = pair_id.first->second; - ret = S_OK; - } - else - ret= DISP_E_UNKNOWNNAME; - } - return ret; -} - -STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /*riid*/, LCID /*lcid*/, unsigned short wFlags, - DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, - unsigned int * puArgErr ) -{ - HRESULT ret = S_OK; - try - { - sal_Bool bHandled= sal_False; - ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo, - puArgErr, bHandled); - if( bHandled) - return ret; - - if ( dispidMember > 0 && m_xInvocation.is()) - { - - IdToMemberInfoMap::iterator it_MemberInfo= m_idToMemberInfoMap.find( dispidMember); - if( it_MemberInfo != m_idToMemberInfoMap.end() ) - { - MemberInfo& info= it_MemberInfo->second; - - Sequence params; // holds converted any s - if( ! info.flags ) - { // DISPID called for the first time - if( wFlags == DISPATCH_METHOD ) - { - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - - if( FAILED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - OUString exactName; - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName( info.name); - // invoke again - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_METHOD; - } //if( wFlags == DISPATCH_METHOD ) - - else if( wFlags == DISPATCH_PROPERTYPUT || wFlags == DISPATCH_PROPERTYPUTREF) - { - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - if( FAILED( ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - OUString exactName; - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName( info.name); - // invoke again - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET; - } - - else if( wFlags == DISPATCH_PROPERTYGET) - { - if( FAILED( ret= doGetProperty( pdispparams, pvarResult, - pexcepinfo, info.name)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - OUString exactName; - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName( info.name); - // invoke again - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doGetProperty( pdispparams, pvarResult, - pexcepinfo, exactName))) - info.name= exactName; - } - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT; - } - else if( wFlags & DISPATCH_METHOD && - (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)) - { - - OUString exactName; - // convert params for DISPATCH_METHOD or DISPATCH_PROPERTYPUT - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - // try first as method - if( FAILED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName( info.name); - // invoke again - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_METHOD; - - // try as property - if( FAILED( ret) && pdispparams->cArgs == 1) - { - if( FAILED( ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET; - } - } - else if( wFlags & DISPATCH_METHOD && wFlags & DISPATCH_PROPERTYGET) - { - OUString exactName; - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - - if( FAILED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params)) - && ret == DISP_E_MEMBERNOTFOUND) - { - // try to get the exact name - if (m_xExactName.is()) - { - exactName = m_xExactName->getExactName( info.name); - // invoke again - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_METHOD; - - // try as property - if( FAILED( ret) && pdispparams->cArgs == 1) - { - if( FAILED( ret= doGetProperty( pdispparams, pvarResult, - pexcepinfo, info.name)) - && ret == DISP_E_MEMBERNOTFOUND) - { - if( exactName.getLength() != 0) - { - if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, exactName, params))) - info.name= exactName; - } - } - if( SUCCEEDED( ret ) ) - info.flags= DISPATCH_PROPERTYGET; - } - } - - // update ínformation about this member - if( ret == DISP_E_MEMBERNOTFOUND) - { - // Remember the name as not existing - // and remove the MemberInfo - m_badNameMap[info.name]= sal_False; - m_idToMemberInfoMap.erase( it_MemberInfo); - } - } // if( ! info.flags ) - else // IdToMemberInfoMap contains a MemberInfo - { - if( wFlags & DISPATCH_METHOD && info.flags == DISPATCH_METHOD) - { - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - ret= doInvoke( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params); - } - else if( (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF ) && - info.flags & DISPATCH_PROPERTYPUT) - { - convertDispparamsArgs(dispidMember, wFlags, pdispparams, params ); - ret= doSetProperty( pdispparams, pvarResult, - pexcepinfo, puArgErr, info.name, params); - } - else if( (wFlags & DISPATCH_PROPERTYGET) && ( info.flags & DISPATCH_PROPERTYGET)) - { - ret= doGetProperty( pdispparams, pvarResult, - pexcepinfo, info.name); - } - else - { - ret= DISP_E_MEMBERNOTFOUND; - } - } - }// if( it_MemberInfo != m_idToMemberInfoMap.end() ) - else - ret= DISP_E_MEMBERNOTFOUND; - } - } - catch(BridgeRuntimeError& e) - { - writeExcepinfo(pexcepinfo, e.message); - ret = DISP_E_EXCEPTION; - } - catch(Exception& e) - { - OUString message= OUSTR("UnoObjectWrapperRemoteOpt::Invoke : \n") + - e.Message; - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - catch(...) - { - OUString message= OUSTR("UnoObjectWrapperRemoteOpt::Invoke : \n" - "Unexpected exception"); - writeExcepinfo(pexcepinfo, message); - ret = DISP_E_EXCEPTION; - } - - return ret; -} - -HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID /*dispidMember*/, DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/, - EXCEPINFO * /*pexcepinfo*/, unsigned int * /*puArgErr*/, Sequence params) -{ - return S_OK; -} - - -// The returned HRESULT is only appropriate for IDispatch::Invoke -static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int * puArgErr) -{ - HRESULT ret; - sal_Bool bWriteIndex= sal_True; - - switch ( e.Reason) - { - case FailReason::OUT_OF_RANGE: - ret = DISP_E_OVERFLOW; - break; - case FailReason::IS_NOT_NUMBER: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::IS_NOT_ENUM: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::IS_NOT_BOOL: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::NO_SUCH_INTERFACE: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::SOURCE_IS_NO_DERIVED_TYPE: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::TYPE_NOT_SUPPORTED: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::INVALID: - ret = DISP_E_TYPEMISMATCH; - break; - case FailReason::NO_DEFAULT_AVAILABLE: - ret = DISP_E_BADPARAMCOUNT; - break; - case FailReason::UNKNOWN: - ret = E_UNEXPECTED; - break; - default: - ret = E_UNEXPECTED; - bWriteIndex= sal_False; - break; - } - - if( bWriteIndex && puArgErr != NULL) - *puArgErr = e.ArgumentIndex; - return ret; -} - -// The function maps the TypeClass of the any to VARTYPE: If -// the Any contains STRUCT or INTERFACE then the return value -// is VT_DISPATCH. The function is used from o2u_createUnoObjectWrapper -// and the result is put into the constructor of the uno - wrapper -// object. If a client asks the object for DISPID_VALUE and this -// funtion returned VT_DISPATCH then the IDispatch of the same -// object is being returned. -// See InterfaceOleWrapper_Impl::Invoke, InterfaceOleWrapper_Impl::m_defaultValueType -const VARTYPE getVarType( const Any& value) -{ - VARTYPE ret= VT_EMPTY; - - switch ( value.getValueTypeClass()) - { - case TypeClass_STRUCT: ret= VT_DISPATCH; break; - case TypeClass_INTERFACE: ret= VT_DISPATCH; break; - default: break; - } - return ret; -} - - - - -} // end namespace - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx deleted file mode 100644 index 7d7bca7c4..000000000 --- a/extensions/source/ole/unoobjw.hxx +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UNOOBJW_HXX -#define _UNOOBJW_HXX - -#include -#include -#include -#include -#include - -#include "comifaces.hxx" -#include "ole2uno.hxx" -#include "unoconversionutilities.hxx" - -//#define INVOCATION_SERVICE L"com.sun.star.script.Invocation" -#define JSCRIPT_VALUE_FUNC L"_GetValueObject" -#define GET_STRUCT_FUNC L"_GetStruct" -#define BRIDGE_VALUE_FUNC L"Bridge_GetValueObject" -#define BRIDGE_GET_STRUCT_FUNC L"Bridge_GetStruct" -#define BRIDGE_CREATE_TYPE_FUNC L"Bridge_CreateType" - -#define DISPID_JSCRIPT_VALUE_FUNC -10l -#define DISPID_GET_STRUCT_FUNC -102 -#define DISPID_CREATE_TYPE_FUNC -103 - -using namespace std; -using namespace cppu; -using namespace com::sun::star::bridge; -using namespace com::sun::star::script; -namespace ole_adapter -{ - - - -struct hash_IUnknown_Impl -{ - size_t operator()(const IUnknown* p) const - { - return (size_t)p; - } -}; - -struct equal_to_IUnknown_Impl -{ - bool operator()(const IUnknown* s1, const IUnknown* s2) const - { - return s1 == s2; - } -}; - - - -struct MemberInfo -{ - MemberInfo() : flags(0), name() {} - MemberInfo(WORD f, const OUString& n) : flags(f), name(n) {} - - WORD flags; - OUString name; -}; - -typedef boost::unordered_map -< - OUString, - DISPID, - hashOUString_Impl, - equalOUString_Impl -> NameToIdMap; - -typedef boost::unordered_map -< - OUString, - sal_Bool, - hashOUString_Impl, - equalOUString_Impl -> BadNameMap; - -typedef boost::unordered_map -< - DISPID, - MemberInfo -> IdToMemberInfoMap; - -/***************************************************************************** - - class declaration: InterfaceOleWrapper_Impl - -*****************************************************************************/ - -class InterfaceOleWrapper_Impl : public WeakImplHelper2, - public IDispatchEx, - public UnoConversionUtilities, - public IUnoObjectWrapper -{ -public: - - - InterfaceOleWrapper_Impl(Reference& xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass); - ~InterfaceOleWrapper_Impl(); - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - - /* IDispatch methods */ - STDMETHOD( GetTypeInfoCount )( unsigned int * pctinfo ); - STDMETHOD( GetTypeInfo )( unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo ); - STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames, - LCID lcid, DISPID * rgdispid ); - STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags, - DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, - unsigned int * puArgErr ); - - /* IDispatchEx methods */ - - virtual HRESULT STDMETHODCALLTYPE GetDispID( - /* [in] */ BSTR bstrName, - /* [in] */ DWORD grfdex, - /* [out] */ DISPID __RPC_FAR *pid); - - virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx( - /* [in] */ DISPID id, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [in] */ DISPPARAMS __RPC_FAR *pdp, - /* [out] */ VARIANT __RPC_FAR *pvarRes, - /* [out] */ EXCEPINFO __RPC_FAR *pei, - /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller); - - virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName( - /* [in] */ BSTR bstr, - /* [in] */ DWORD grfdex); - - virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID( - /* [in] */ DISPID id); - - virtual HRESULT STDMETHODCALLTYPE GetMemberProperties( - /* [in] */ DISPID id, - /* [in] */ DWORD grfdexFetch, - /* [out] */ DWORD __RPC_FAR *pgrfdex); - - virtual HRESULT STDMETHODCALLTYPE GetMemberName( - /* [in] */ DISPID id, - /* [out] */ BSTR __RPC_FAR *pbstrName); - - virtual HRESULT STDMETHODCALLTYPE GetNextDispID( - /* [in] */ DWORD grfdex, - /* [in] */ DISPID id, - /* [out] */ DISPID __RPC_FAR *pid); - - virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent( - /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk); - - // XBridgeSupplier2 --------------------------------------------------- - virtual Any SAL_CALL createBridge(const Any& modelDepObject, - const Sequence& ProcessId, - sal_Int16 sourceModelType, - sal_Int16 destModelType) - throw (IllegalArgumentException, RuntimeException); - - //XInitialization ----------------------------------------------------- - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); - - // IUnoObjectWrapper - STDMETHOD( getWrapperXInterface)( Reference* pXInt); - STDMETHOD( getOriginalUnoObject)( Reference* pXInt); - STDMETHOD( getOriginalUnoStruct)( Any * pStruct); - - // UnoConversionUtility - virtual Reference< XInterface > createUnoWrapperInstance(); - virtual Reference< XInterface > createComWrapperInstance(); - - -protected: - virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence& params); - - virtual HRESULT doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, OUString & name ); - - virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence params); - - virtual HRESULT InvokeGeneral( DISPID dispidMember, unsigned short wFlags, - DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, - unsigned int * puArgErr, sal_Bool& bHandled); - - void convertDispparamsArgs( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams, - Sequence& rSeq); - - sal_Bool getInvocationInfoForCall(DISPID id, InvocationInfo& info); - - Reference m_xInvocation; - Reference m_xExactName; - Reference m_xOrigin; - NameToIdMap m_nameToDispIdMap; - vector m_MemberInfos; - // This member is used to determine the default value - // denoted by DISPID_VALUE (0). For proper results in JavaScript - // we have to return the default value when we write an object - // as out parameter. That is, we get an JScript Array as parameter - // and put a wrapped object on index null. The array object tries - // to detect the default value. The wrapped object must then return - // its own IDispatch* otherwise we cannot access it within the script. - // see InterfaceOleWrapper_Impl::Invoke - VARTYPE m_defaultValueType; - -}; - -/***************************************************************************** - - class declaration: UnoObjectWrapperRemoteOpt - ( Uno Object Wrapper Remote Optimized) - This is the UNO wrapper used in the service com.sun.star.bridge.OleBridgeSupplierVar1. - Key features: - DISPIDs are passed out blindly. That is in GetIDsOfNames is no name checking carried out. - Only if Invoke fails the name is being checked. Moreover Invoke tries to figure out - if a call is made to a property or method if the flags are DISPATCH_METHOD | DISPATCH_PROPERTYPUT. - If something has been found out about a property or member than it is saved - in a MemberInfo structure hold by a IdToMemberInfoMap stl map. - -*****************************************************************************/ -class UnoObjectWrapperRemoteOpt: public InterfaceOleWrapper_Impl -{ -public: - UnoObjectWrapperRemoteOpt( Reference& aFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass); - ~UnoObjectWrapperRemoteOpt(); - - STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames, - LCID lcid, DISPID * rgdispid ); - STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags, - DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, - unsigned int * puArgErr ); - - // UnoConversionUtility - // If UNO interfaces are converted in methods of this class then - // they are always wrapped with instances of this class - virtual Reference< XInterface > createUnoWrapperInstance(); - -protected: - - HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult, - EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence params); - // In GetIDsOfNames are blindly passed out, that is without verifying - // the name. If two names are passed in during different calls to - // GetIDsOfNames and the names differ only in their cases then different - // id's are passed out ( e.g. "doSomethingMethod" or "dosomethingmethod"). - // In Invoke the DISPID is remapped to the name passed to GetIDsOfNames - // and the name is used as parameter for XInvocation::invoke. If invoke - // fails because of a wrong name, then m_xExactName ( XExactName) is used - // to verify the name. The correct name is then inserted to m_MemberInfos - // ( vector ). During the next call to Invoke the right name - // is used. . - - - BadNameMap m_badNameMap; - - IdToMemberInfoMap m_idToMemberInfoMap; - - DISPID m_currentId; - - -}; - -} // end namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unotypewrapper.cxx b/extensions/source/ole/unotypewrapper.cxx deleted file mode 100644 index 7461d7d0e..000000000 --- a/extensions/source/ole/unotypewrapper.cxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "unotypewrapper.hxx" -#include "rtl/ustring.hxx" - - -bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVar) -{ - bool ret = false; - OSL_ASSERT(sTypeName && pVar); - CComObject< UnoTypeWrapper>* pObj; - VariantClear(pVar); - if( SUCCEEDED( CComObject::CreateInstance( &pObj))) - { - pObj->AddRef(); - pVar->vt= VT_DISPATCH; -#ifdef __MINGW32__ - pVar->pdispVal= CComQIPtr(pObj->GetUnknown()); -#else - pVar->pdispVal= CComQIPtr(pObj->GetUnknown()); -#endif - //now set the value, e.i. the name of the type -#ifdef __MINGW32__ - CComQIPtr spType(pVar->pdispVal); -#else - CComQIPtr spType(pVar->pdispVal); -#endif - OSL_ASSERT(spType); - if (SUCCEEDED(spType->put_Name(sTypeName))) - { - ret = true; - } - } - return ret; -} - - -bool createUnoTypeWrapper(const rtl::OUString& sTypeName, VARIANT * pVar) -{ - CComBSTR bstr(reinterpret_cast(sTypeName.getStr())); - return createUnoTypeWrapper(bstr, pVar); -} - -UnoTypeWrapper::UnoTypeWrapper() -{ -} - -UnoTypeWrapper::~UnoTypeWrapper() -{ -} - - -// UnoTypeWrapper, IDispatch -------------------------------------------- -STDMETHODIMP UnoTypeWrapper::GetTypeInfoCount(UINT* /*pctinfo*/) -{ - return E_NOTIMPL; -} - -// UnoTypeWrapper, IDispatch -------------------------------------------- -STDMETHODIMP UnoTypeWrapper::GetTypeInfo( UINT /*iTInfo*/, - LCID /*lcid*/, - ITypeInfo** /*ppTInfo*/) -{ - return E_NOTIMPL; -} - -// UnoTypeWrapper, IDispatch -------------------------------------------- -STDMETHODIMP UnoTypeWrapper::GetIDsOfNames( REFIID /*riid*/, - LPOLESTR *rgszNames, - UINT /*cNames*/, - LCID /*lcid*/, - DISPID *rgDispId) -{ - if( !rgDispId) - return E_POINTER; - - HRESULT ret= S_OK; - CComBSTR name(*rgszNames); - name.ToLower(); - - if( name == CComBSTR( L"name") ) - *rgDispId= DISPID_VALUE; - else - ret= DISP_E_UNKNOWNNAME; - - return ret; -} - -// UnoTypeWrapper, IDispatch -------------------------------------------- -STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember, - REFIID /*riid*/, - LCID /*lcid*/, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO* /*pExcepInfo*/, - UINT* /*puArgErr*/) -{ - if (pDispParams == NULL) - return DISP_E_EXCEPTION; - - if( pDispParams->cNamedArgs) - return DISP_E_NONAMEDARGS; - - - HRESULT ret= S_OK; - switch( dispIdMember) - { - case DISPID_VALUE: // DISPID_VALUE - if (wFlags & DISPATCH_PROPERTYGET) - { - if (pVarResult == NULL) - { - ret = E_POINTER; - break; - } - get_Name( & pVarResult->bstrVal); - pVarResult->vt = VT_BSTR; - } - break; - default: - ret= DISP_E_MEMBERNOTFOUND; - break; - } - - return ret; -} - -// IUnoTypeWrapper----------------------- -STDMETHODIMP UnoTypeWrapper::put_Name(BSTR val) -{ - Lock(); - HRESULT hr = S_OK; - m_sName = val; - Unlock(); - return hr; -} - -// (UnoTypeWrapper----------------------- -STDMETHODIMP UnoTypeWrapper::get_Name(BSTR *pVal) -{ - Lock(); - HRESULT hr = S_OK; - if( !pVal) - return E_POINTER; - *pVal = m_sName.Copy(); - Unlock(); - return hr; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/unotypewrapper.hxx b/extensions/source/ole/unotypewrapper.hxx deleted file mode 100644 index 141aa3641..000000000 --- a/extensions/source/ole/unotypewrapper.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef UNO_TYPE_WRAPPER_HXX -#define UNO_TYPE_WRAPPER_HXX - -#pragma warning (push,1) -#pragma warning (disable:4548) - -#include -#define STRICT -#define _WIN32_WINNT 0x0403 -#define _WIN32_DCOM -#if OSL_DEBUG_LEVEL > 1 -#define _ATL_DEBUG_INTERFACES -#endif -#include -extern CComModule _Module; -#include - -#pragma warning (pop) -#pragma warning (disable:4505) - // disable "unreferenced local function has been removed" globally - -#include "comifaces.hxx" - -/* creates an UnoTypWrapper and sets the Name property to the value - specified by sTypeName. - Returns true if the object could be created and initialized. - */ -bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVariant); -bool createUnoTypeWrapper(const rtl::OUString& sTypeName, VARIANT * pVar); - -class UnoTypeWrapper: - public CComObjectRootEx, - public IUnoTypeWrapper, - public IDispatch -{ -public: - UnoTypeWrapper(); - virtual ~UnoTypeWrapper(); - - BEGIN_COM_MAP(UnoTypeWrapper) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IUnoTypeWrapper) - END_COM_MAP() - - // IDispatch ------------------------------------------- - STDMETHOD( GetTypeInfoCount)(UINT *pctinfo); - - STDMETHOD( GetTypeInfo)( UINT iTInfo, - LCID lcid, - ITypeInfo **ppTInfo); - - STDMETHOD( GetIDsOfNames)( REFIID riid, - LPOLESTR *rgszNames, - UINT cNames, - LCID lcid, - DISPID *rgDispId); - - STDMETHOD( Invoke)( DISPID dispIdMember, - REFIID riid, - LCID lcid, - WORD wFlags, - DISPPARAMS *pDispParams, - VARIANT *pVarResult, - EXCEPINFO *pExcepInfo, - UINT *puArgErr); - // IUnoTypeWrapper -------------------------------------- - STDMETHOD(put_Name)(BSTR val); - STDMETHOD(get_Name)(BSTR* pVal); - - CComBSTR m_sName; -}; - -// This here so that WIN_ULONG is used also in the magic macros above -#include - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/windata.cxx b/extensions/source/ole/windata.cxx deleted file mode 100644 index e4047e3b1..000000000 --- a/extensions/source/ole/windata.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "windata.hxx" - - -namespace ole_adapter -{ - - - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx deleted file mode 100644 index fce3d4af5..000000000 --- a/extensions/source/ole/windata.hxx +++ /dev/null @@ -1,201 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef AUTOMATION_BRIDGE_WINDATA_HXX -#define AUTOMATION_BRIDGE_WINDATA_HXX - -#pragma warning (push,1) -#pragma warning (disable:4668) -#pragma warning (disable:4548) -#include "oleidl.h" - -#include -#pragma warning (pop) -#include "osl/diagnose.h" - -namespace ole_adapter -{ -//Wrapper for VARDESC -class VarDesc -{ - VARDESC* operator = (const VarDesc*); - VarDesc(const VarDesc&); -// Construction -public: - CComPtr< ITypeInfo > m_pTypeInfo; - VARDESC* m_pVarDesc; - - VarDesc(ITypeInfo* pTypeInfo) : - m_pVarDesc(NULL), - m_pTypeInfo(pTypeInfo) - { - OSL_ASSERT(pTypeInfo); - } - ~VarDesc() - { - if (m_pVarDesc != NULL) - { - m_pTypeInfo->ReleaseVarDesc(m_pVarDesc); - } - } - - VARDESC* operator->() - { - return m_pVarDesc; - } - - VARDESC** operator&() - { - return &m_pVarDesc; - } - - operator VARDESC* () - { - return m_pVarDesc; - } -}; - -//Wrapper for FUNCDESC structure -class FuncDesc -{ - FUNCDESC* operator = (const FuncDesc &); - FuncDesc(const FuncDesc&); - CComPtr m_pTypeInfo; - FUNCDESC * m_pFuncDesc; - -public: - - FuncDesc(ITypeInfo * pTypeInfo) : - m_pFuncDesc(NULL), - m_pTypeInfo(pTypeInfo) - { - OSL_ASSERT(pTypeInfo); - } - ~FuncDesc() - { - ReleaseFUNCDESC(); - } - - FUNCDESC* operator -> () - { - return m_pFuncDesc; - } - - FUNCDESC** operator & () - { - return & m_pFuncDesc; - } - - operator FUNCDESC* () - { - return m_pFuncDesc; - } - - FUNCDESC* operator = (FUNCDESC* pDesc) - { - ReleaseFUNCDESC(); - m_pFuncDesc = pDesc; - return m_pFuncDesc; - } - FUNCDESC* Detach() - { - FUNCDESC* pDesc = m_pFuncDesc; - m_pFuncDesc = NULL; - return pDesc; - } - - void ReleaseFUNCDESC() - { - if (m_pFuncDesc != NULL) - { - m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc); - } - m_pFuncDesc = NULL; - } -}; -//Wrapper for EXCEPINFO structure -class ExcepInfo : public EXCEPINFO -{ - EXCEPINFO* operator = (const ExcepInfo& ); - ExcepInfo(const ExcepInfo &); -public: - ExcepInfo() - { - memset(this, 0, sizeof(ExcepInfo)); - } - ~ExcepInfo() - { - if (bstrSource != NULL) - ::SysFreeString(bstrSource); - if (bstrDescription != NULL) - ::SysFreeString(bstrDescription); - if (bstrHelpFile != NULL) - ::SysFreeString(bstrHelpFile); - } -}; - -//Wrapper for TYPEATTR -class TypeAttr -{ - TYPEATTR* operator = (const TypeAttr &); - TypeAttr(const TypeAttr &); -public: - CComPtr< ITypeInfo > m_pTypeInfo; - TYPEATTR* m_pTypeAttr; - - TypeAttr(ITypeInfo* pTypeInfo) : - m_pTypeAttr( NULL ), - m_pTypeInfo( pTypeInfo ) - { - OSL_ASSERT(pTypeInfo); - } - ~TypeAttr() throw() - { - if (m_pTypeAttr != NULL) - { - m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr); - } - } - - TYPEATTR** operator&() throw() - { - return &m_pTypeAttr; - } - - TYPEATTR* operator->() throw() - { - return m_pTypeAttr; - } -}; - - - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/core.cxx b/extensions/source/oooimprovecore/core.cxx deleted file mode 100644 index 1836e4dc2..000000000 --- a/extensions/source/oooimprovecore/core.cxx +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -#include "oooimprovecore_module.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::com::sun::star::oooimprovement; -using ::com::sun::star::frame::XTerminateListener; -using ::com::sun::star::lang::EventObject; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::lang::XServiceInfo; -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; -using ::com::sun::star::uno::XComponentContext; -using ::com::sun::star::uno::XInterface; -using ::comphelper::UiEventsLogger; -using ::rtl::OUString; - -// declaration -namespace oooimprovecore -{ - class Core : public ::cppu::WeakImplHelper3 - { - public: - // XServiceInfo - static version - static OUString SAL_CALL getImplementationName_static(); - static Sequence SAL_CALL getSupportedServiceNames_static(); - static Reference Create(const Reference& context ); - - protected: - Core(const Reference&); - virtual ~Core(); - - // XCore - virtual sal_Int32 SAL_CALL getSessionLogEventCount() throw(RuntimeException); - virtual sal_Bool SAL_CALL getUiEventsLoggerEnabled() throw(RuntimeException); - virtual void SAL_CALL inviteUser() throw(RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); - virtual sal_Bool SAL_CALL supportsService(const OUString& service_name) throw(RuntimeException); - virtual Sequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); - - // XTerminateListener - virtual void SAL_CALL queryTermination(const EventObject&) throw(RuntimeException); - virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException); - }; -} - - -// implementation -namespace oooimprovecore -{ - - Core::Core(const Reference&) - { } - - Core::~Core() - { } - - sal_Int32 SAL_CALL Core::getSessionLogEventCount() throw(RuntimeException) - { return UiEventsLogger::getSessionLogEventCount(); } - - sal_Bool SAL_CALL Core::getUiEventsLoggerEnabled() throw(RuntimeException) - { return UiEventsLogger::isEnabled(); } - - void SAL_CALL Core::inviteUser() throw(RuntimeException) - { - Reference xServiceFactory = ::comphelper::getProcessServiceFactory(); - - OUString help_url; - Reference core_c( - xServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController"))), - UNO_QUERY); - if(core_c.is()) - ::comphelper::ConfigurationHelper::readDirectKey( - xServiceFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings")), - OUString(RTL_CONSTASCII_USTRINGPARAM("Participation")), - OUString(RTL_CONSTASCII_USTRINGPARAM("HelpUrl")), - ::comphelper::ConfigurationHelper::E_READONLY) >>= help_url; - else - help_url = OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.libreoffice.org")); - { - SolarMutexGuard aGuard; - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - aSet.Put( SfxStringItem( SID_CURRENT_URL, help_url ) ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - SfxAbstractDialog *pDlg = pFact->CreateSfxDialog( NULL, aSet, 0, RID_SVXPAGE_IMPROVEMENT ); - pDlg->Execute(); - delete pDlg; - } - } - } - - sal_Bool SAL_CALL Core::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL Core::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence SAL_CALL Core::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL Core::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovecore.Core")); } - - Sequence SAL_CALL Core::getSupportedServiceNames_static() - { - Sequence aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.Core")); - return aServiceNames; - } - - void Core::queryTermination(const EventObject&) throw(RuntimeException) - { } - - void Core::notifyTermination(const EventObject&) throw(RuntimeException) - { - UiEventsLogger::disposing(); - } - - void Core::disposing(const EventObject&) throw(RuntimeException) - { } - - Reference Core::Create(const Reference& context) - { return *(new Core(context)); } - - void createRegistryInfo_Core() - { - static OAutoRegistration auto_reg; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/makefile.mk b/extensions/source/oooimprovecore/makefile.mk deleted file mode 100644 index 66ab6cd10..000000000 --- a/extensions/source/oooimprovecore/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=extensions -TARGET=oooimprovecore - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -# --- Files ------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/core.obj \ - $(SLO)$/oooimprovecore_services.obj \ - -SLOFILES= \ - $(EXCEPTIONSFILES) \ - $(SLO)$/oooimprovecore_module.obj \ - -LIB1TARGET=$(SLB)$/$(TARGET)_t.lib -LIB1FILES= \ - $(SLB)$/$(TARGET).lib \ - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(SVTOOLLIB) \ - $(SFXLIB) \ - $(SVXCORELIB) \ - $(SVXLIB) \ - $(TOOLSLIB) - - -SHL1LIBS=$(LIB1TARGET) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/oooimprovecore.component - -$(MISC)/oooimprovecore.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovecore.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovecore.component diff --git a/extensions/source/oooimprovecore/oooimprovecore.component b/extensions/source/oooimprovecore/oooimprovecore.component deleted file mode 100644 index 58bdaf37c..000000000 --- a/extensions/source/oooimprovecore/oooimprovecore.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/oooimprovecore/oooimprovecore_module.cxx b/extensions/source/oooimprovecore/oooimprovecore_module.cxx deleted file mode 100644 index 6457da10d..000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_module.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "oooimprovecore_module.hxx" -#include - -namespace oooimprovecore -{ - struct OooimprovecoreModuleCreator - { - OooimprovecoreModule m_aOooimprovecoreModule; - }; - namespace - { - class theOooimprovecoreModuleInstance : public rtl::Static {}; - } - - OooimprovecoreModule::OooimprovecoreModule() - :BaseClass() - { - } - - OooimprovecoreModule& OooimprovecoreModule::getInstance() - { - return theOooimprovecoreModuleInstance::get().m_aOooimprovecoreModule; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/oooimprovecore_module.hxx b/extensions/source/oooimprovecore/oooimprovecore_module.hxx deleted file mode 100644 index aeb1ff0ed..000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_module.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_OOOIMPROVECORE_MODULE_HXX -#define EXTENSIONS_OOOIMPROVECORE_MODULE_HXX - -#include - -namespace oooimprovecore -{ - /* -------------------------------------------------------------------- */ - class OooimprovecoreModule : public ::comphelper::OModule - { - friend struct OooimprovecoreModuleCreator; - typedef ::comphelper::OModule BaseClass; - - public: - static OooimprovecoreModule& getInstance(); - - private: - OooimprovecoreModule(); - }; - - /* -------------------------------------------------------------------- */ - class OooimprovecoreModuleClient : public ::comphelper::OModuleClient - { - private: - typedef ::comphelper::OModuleClient BaseClass; - - public: - OooimprovecoreModuleClient() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > - { - private: - typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; - - public: - OAutoRegistration() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; - - /* -------------------------------------------------------------------- */ - template < class TYPE > - class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > - { - private: - typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; - - public: - OSingletonRegistration() : BaseClass( OooimprovecoreModule::getInstance() ) - { - } - }; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovecore/oooimprovecore_services.cxx b/extensions/source/oooimprovecore/oooimprovecore_services.cxx deleted file mode 100644 index d0800869f..000000000 --- a/extensions/source/oooimprovecore/oooimprovecore_services.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "oooimprovecore_module.hxx" - -namespace oooimprovecore -{ - extern void createRegistryInfo_Core(); - - static void initializeModule() - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - createRegistryInfo_Core(); - } - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) -{ - ::oooimprovecore::initializeModule(); - return ::oooimprovecore::OooimprovecoreModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/Jobs.xcu b/extensions/source/oooimprovement/Jobs.xcu deleted file mode 100644 index 206d83dd7..000000000 --- a/extensions/source/oooimprovement/Jobs.xcu +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - com.sun.star.comp.extensions.oooimprovement.OnLogRotateJob - - - - - - com.sun.star.comp.extensions.oooimprovement.InviteJob - - - - - - - - - - - - - diff --git a/extensions/source/oooimprovement/Logging.xcu b/extensions/source/oooimprovement/Logging.xcu deleted file mode 100644 index 4ea492d67..000000000 --- a/extensions/source/oooimprovement/Logging.xcu +++ /dev/null @@ -1,8 +0,0 @@ - - - - - true - - - diff --git a/extensions/source/oooimprovement/config.cxx b/extensions/source/oooimprovement/config.cxx deleted file mode 100644 index bbbc811ad..000000000 --- a/extensions/source/oooimprovement/config.cxx +++ /dev/null @@ -1,299 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "config.hxx" -#include "myconfigurationhelper.hxx" -#include - - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - using namespace oooimprovement; - - static const OUString CFG_COUNTERS(RTL_CONSTASCII_USTRINGPARAM("Counters")); - static const OUString CFG_ENABLINGALLOWED(RTL_CONSTASCII_USTRINGPARAM("EnablingAllowed")); - static const OUString CFG_EVENTSCOUNT(RTL_CONSTASCII_USTRINGPARAM("LoggedEvents")); - static const OUString CFG_EXTENSION(RTL_CONSTASCII_USTRINGPARAM("ooSetupExtension")); - static const OUString CFG_FAILEDATTEMPTS(RTL_CONSTASCII_USTRINGPARAM("FailedAttempts")); - static const OUString CFG_INVACCEPT(RTL_CONSTASCII_USTRINGPARAM("InvitationAccepted")); - static const OUString CFG_L10N(RTL_CONSTASCII_USTRINGPARAM("L10N")); - static const OUString CFG_LOCALE(RTL_CONSTASCII_USTRINGPARAM("ooLocale")); - static const OUString CFG_LOGGING(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Logging")); - static const OUString CFG_LOGPATH(RTL_CONSTASCII_USTRINGPARAM("LogPath")); - static const OUString CFG_NAME(RTL_CONSTASCII_USTRINGPARAM("ooName")); - static const OUString CFG_OFFICESTARTCOUNTDOWN(RTL_CONSTASCII_USTRINGPARAM("OfficeStartCounterdown")); - static const OUString CFG_OOOIMPROVEMENT(RTL_CONSTASCII_USTRINGPARAM("OOoImprovement")); - static const OUString CFG_OOOIMPROVEMENTPACK(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.OOoImprovement.Settings")); - static const OUString CFG_PARTICIPATION(RTL_CONSTASCII_USTRINGPARAM("Participation")); - static const OUString CFG_PRODUCT(RTL_CONSTASCII_USTRINGPARAM("Product")); - static const OUString CFG_REPORTCOUNT(RTL_CONSTASCII_USTRINGPARAM("UploadedReports")); - static const OUString CFG_REPORTEREMAIL(RTL_CONSTASCII_USTRINGPARAM("ReporterEmail")); - static const OUString CFG_SETUP(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup")); - static const OUString CFG_SHOWEDINV(RTL_CONSTASCII_USTRINGPARAM("ShowedInvitation")); - static const OUString CFG_SOAPIDADD(RTL_CONSTASCII_USTRINGPARAM("SoapIdAdditions")); - static const OUString CFG_SOAPURL(RTL_CONSTASCII_USTRINGPARAM("SoapUrl")); - static const OUString CFG_UPLOAD(RTL_CONSTASCII_USTRINGPARAM("Upload")); - static const OUString CFG_VERSION(RTL_CONSTASCII_USTRINGPARAM("ooSetupVersion")); - - static const OUString SOAPID(RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org Improvement Report - Version 1\n")); - - static sal_Int32 incrementCfgValue( - const Reference sm, - const OUString& package, - const OUString& rel_path, - const OUString& key, - sal_Int32 increment_by) - { - sal_Int32 value; - Reference cfg = - MyConfigurationHelper::openConfig( - sm, - package, MyConfigurationHelper::E_STANDARD); - MyConfigurationHelper::readRelativeKey( - cfg, - rel_path, key) >>= value; - value += increment_by; - MyConfigurationHelper::writeRelativeKey( - cfg, - rel_path, key, - Any(value)); - MyConfigurationHelper::flush(cfg); - return value; - }; -} - -namespace oooimprovement -{ - Config::Config(const Reference& sf) - : m_ServiceFactory(sf) - {} - - OUString Config::getSoapUrl() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_SOAPURL, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - OUString Config::getSoapId() const - { - OUString value; - OUStringBuffer result = SOAPID; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_SOAPIDADD, - MyConfigurationHelper::E_READONLY) >>= value; - result.append(value); - return result.makeStringAndClear(); - } - - OUString Config::getReporterEmail() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_UPLOAD, CFG_REPORTEREMAIL, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - OUString Config::getLogPath() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_LOGGING, CFG_OOOIMPROVEMENT, CFG_LOGPATH, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - bool Config::getEnablingAllowed() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_LOGGING, CFG_OOOIMPROVEMENT, CFG_ENABLINGALLOWED, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - bool Config::getInvitationAccepted() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_INVACCEPT, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - }; - - bool Config::getShowedInvitation() const - { - bool result = false; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_SHOWEDINV, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - }; - - OUString Config::getCompleteProductname() const - { - OUStringBuffer result; - OUString value; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_NAME, - MyConfigurationHelper::E_READONLY) >>= value; - result.append(value); - - value = OUString(); - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_VERSION, - MyConfigurationHelper::E_READONLY) >>= value; - if(value.getLength()) result.appendAscii(" ").append(value); - - value = OUString(); - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_PRODUCT, CFG_EXTENSION, - MyConfigurationHelper::E_READONLY) >>= value; - if(value.getLength()) result.appendAscii(" ").append(value); - - return result.makeStringAndClear(); - } - - OUString Config::getSetupLocale() const - { - OUString result; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_SETUP, CFG_L10N, CFG_LOCALE, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - sal_Int32 Config::getReportCount() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_REPORTCOUNT, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - -#ifdef FUTURE - sal_Int32 Config::getFailedAttempts() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } -#endif - - sal_Int32 Config::getOfficeStartCounterdown() const - { - sal_Int32 result = 0; - MyConfigurationHelper::readDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_OFFICESTARTCOUNTDOWN, - MyConfigurationHelper::E_READONLY) >>= result; - return result; - } - - sal_Int32 Config::incrementReportCount(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_REPORTCOUNT, - by); - } - - sal_Int32 Config::incrementEventCount(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_EVENTSCOUNT, - by); - } - - sal_Int32 Config::incrementFailedAttempts(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - by); - } - - sal_Int32 Config::decrementOfficeStartCounterdown(sal_Int32 by) - { - return incrementCfgValue( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_OFFICESTARTCOUNTDOWN, - -by); - } - - void Config::resetFailedAttempts() - { - sal_Int32 zero = 0; - MyConfigurationHelper::writeDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_COUNTERS, CFG_FAILEDATTEMPTS, - Any(zero), - MyConfigurationHelper::E_STANDARD); - } - - void Config::giveupUploading() - { - sal_Bool f = false; - MyConfigurationHelper::writeDirectKey( - m_ServiceFactory, - CFG_OOOIMPROVEMENTPACK, CFG_PARTICIPATION, CFG_INVACCEPT, - Any(f), - MyConfigurationHelper::E_STANDARD); - resetFailedAttempts(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/config.hxx b/extensions/source/oooimprovement/config.hxx deleted file mode 100644 index e0ed58c3e..000000000 --- a/extensions/source/oooimprovement/config.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CONFIG_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CONFIG_HXX - -#include -#include - - -namespace oooimprovement -{ - class Config - { - public: - Config(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sf); - bool getEnablingAllowed() const; - bool getInvitationAccepted() const; - bool getShowedInvitation() const; - ::rtl::OUString getCompleteProductname() const; - ::rtl::OUString getLogPath() const; - ::rtl::OUString getReporterEmail() const; - ::rtl::OUString getSetupLocale() const; - ::rtl::OUString getSoapId() const; - ::rtl::OUString getSoapUrl() const; - sal_Int32 getReportCount() const; - sal_Int32 getOfficeStartCounterdown() const; - sal_Int32 incrementEventCount(sal_Int32 by); - sal_Int32 incrementReportCount(sal_Int32 by); - sal_Int32 incrementFailedAttempts(sal_Int32 by); - sal_Int32 decrementOfficeStartCounterdown(sal_Int32 by); - void resetFailedAttempts(); - void giveupUploading(); - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_ServiceFactory; - }; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/corecontroller.cxx b/extensions/source/oooimprovement/corecontroller.cxx deleted file mode 100644 index 23c2e2083..000000000 --- a/extensions/source/oooimprovement/corecontroller.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "corecontroller.hxx" -#include "config.hxx" - -using ::rtl::OUString; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; - - -namespace oooimprovement -{ - CoreController::CoreController(const Reference& sf) - : m_ServiceFactory(sf) - { } - - CoreController::~CoreController() - { } - - sal_Bool SAL_CALL CoreController::enablingUiEventsLoggerAllowed(sal_Int16 version) throw(RuntimeException) - { - Config config(m_ServiceFactory); - if(version==1 && config.getEnablingAllowed() && config.getShowedInvitation() && config.getInvitationAccepted()) - return true; - return false; - } - - sal_Bool SAL_CALL CoreController::showBuiltinOptionsPage(sal_Int16 version) throw(RuntimeException) - { - Config config(m_ServiceFactory); - if(version==1 && config.getEnablingAllowed()) - return true; - return false; - } - - sal_Bool SAL_CALL CoreController::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL CoreController::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence SAL_CALL CoreController::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL CoreController::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.CoreController")); } - - Sequence SAL_CALL CoreController::getSupportedServiceNames_static() - { - Sequence aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.CoreController")); - return aServiceNames; - } - - Reference SAL_CALL CoreController::Create(const Reference& sm) - { return *(new CoreController(sm)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/corecontroller.hxx b/extensions/source/oooimprovement/corecontroller.hxx deleted file mode 100644 index 5d68cc039..000000000 --- a/extensions/source/oooimprovement/corecontroller.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CORECONTROLLER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CORECONTROLLER_HXX - -#include -#include -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class CoreController : public ::cppu::WeakImplHelper2< - css::oooimprovement::XCoreController, - css::lang::XServiceInfo> - { - public: - // css::lang::XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - // const css::uno::Reference& context); - - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - - protected: - CoreController(const css::uno::Reference< css::uno::XComponentContext>& context); - CoreController(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - virtual ~CoreController(); - - // css::oooimprovement::XCoreController - virtual sal_Bool SAL_CALL enablingUiEventsLoggerAllowed(sal_Int16 version) - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL showBuiltinOptionsPage(sal_Int16 version) - throw(css::uno::RuntimeException); - - // css::lang::XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& service_name) - throw(css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException); - - private: - css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/errormail.cxx b/extensions/source/oooimprovement/errormail.cxx deleted file mode 100644 index db0e1edb3..000000000 --- a/extensions/source/oooimprovement/errormail.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "errormail.hxx" -#include "config.hxx" -#include -#include -#include -#include - -#if defined(UNIX) - #include -#endif -#ifdef WIN32 - #include -#endif - - -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace oooimprovement; -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringBuffer; - - -namespace { - static OString replaceAll(const OString& str, sal_Char old, const OString& replacement) - { - OStringBuffer result; - sal_Int32 idx = 0; - do { - result.append(str.getToken(0, old, idx)); - if(idx>=0) result.append(replacement); - } while(idx >= 0); - return result.makeStringAndClear(); - }; - - static OString xmlAttrEncode(const OString& input) - { - OString result = replaceAll(input, '&', OString("&")); - result = replaceAll(result, '<', OString("<")); - result = replaceAll(result, '"', OString(""")); - return replaceAll(result, '>', OString(">")); - } - - static OString getPlatform() - { - #ifdef SOLARIS - return "Solaris"; - #elif defined LINUX - return "Linux"; - #elif defined WIN32 - return "Win32"; - #elif defined UNIX - return "Unix"; - #else - return "Unknown"; - #endif - }; - -#if defined(UNIX) - static const OString getLocale() - { - const char * locale = getenv( "LC_ALL" ); - if( NULL == locale ) - locale = getenv( "LC_CTYPE" ); - - if( NULL == locale ) - locale = getenv( "LANG" ); - - if( NULL == locale ) - locale = "C"; - return locale; - }; - - static OString getSystemInfoXml(const Reference&) - { - struct utsname info; - //memset(&info, 0, sizeof(info)); - uname(&info); - OStringBuffer result = - "\n" - "\n" - "\n" - "\n"; - return result.makeStringAndClear(); - }; -#else - static OString getSystemInfoXml(const Reference&) - { - OSVERSIONINFO info; - ZeroMemory(&info, sizeof(OSVERSIONINFO)); - info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&info); - OStringBuffer result = OString( - "\n" - "(info.dwMajorVersion)); - result.append(".").append(static_cast(info.dwMinorVersion)); - result.append("\" build=\"").append(static_cast(info.dwBuildNumber)); - result.append("\" locale=\"").append(static_cast(GetUserDefaultLangID())); - result.append("\"/>\n"); - result.append("\n" - "\n"); - return result.makeStringAndClear(); - }; -#endif - - static OString getOfficeInfoXml(const Reference& sf) - { - Config config(sf); - const OString product = OUStringToOString(config.getCompleteProductname(), RTL_TEXTENCODING_ASCII_US); - const OString platform = getPlatform(); - const OString language = OUStringToOString(config.getSetupLocale(), RTL_TEXTENCODING_ASCII_US); - // If the oooimprovement lib is packaged in an extension, this needs to - // be done in another way: The build version string needs to be made - // available in an UNO service (if no better place is found for this, - // com.sun.star.comp.extensions.oooimprovecore.Core in oooimprovecore - // is likely the best fit) - const OString build = OUStringToOString(::utl::Bootstrap::getBuildIdData(OUString()), RTL_TEXTENCODING_ASCII_US); - const OString exceptiontype = ""; - OStringBuffer result = - "\n"; - return result.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - Errormail::Errormail(const Reference& sf) - : m_ServiceFactory(sf) - {} - - OString Errormail::getXml() - { - Config config(m_ServiceFactory); - const OString usertype; - const OString email = OUStringToOString(config.getReporterEmail(), RTL_TEXTENCODING_ASCII_US); - OString feedback; - { - OStringBuffer temp; - temp.append(config.getReportCount()); - feedback = temp.makeStringAndClear(); - } - const OString title; - OStringBuffer result = - "\n" - "\n" - "\n" - "\n" - "" - + xmlAttrEncode(title) + "\n" - "\n" - "\n" - + getOfficeInfoXml(m_ServiceFactory) - + getSystemInfoXml(m_ServiceFactory) + - "\n"; - return result.makeStringAndClear(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/errormail.hxx b/extensions/source/oooimprovement/errormail.hxx deleted file mode 100644 index 8a9f3a4db..000000000 --- a/extensions/source/oooimprovement/errormail.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_ERRORMAIL_HXX -#define EXTENSIONS_OOOIMPROVEMENT_ERRORMAIL_HXX - -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class Errormail - { - public: - Errormail(const css::uno::Reference& sf); - // Errormail does NOT use CDATA so it can be included - // in a CDATA of another XML document without further - // quoting - ::rtl::OString getXml(); - private: - css::uno::Reference m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/invite_job.cxx b/extensions/source/oooimprovement/invite_job.cxx deleted file mode 100644 index b13a52438..000000000 --- a/extensions/source/oooimprovement/invite_job.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include "invite_job.hxx" -#include "config.hxx" -#include "logstorage.hxx" -#include -#include - - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::uno; -using ::com::sun::star::oooimprovement::XCore; -using ::rtl::OUString; - -namespace -{ - // dont show Invitation, when: - // -nofirststartwizard commandline switch is present - // [add additional conditions here] - static bool lcl_IsInvitationAllowed() - { - static OUString sNoFirstStartWizard(RTL_CONSTASCII_USTRINGPARAM("-nofirststartwizard")); - sal_Int32 nCount = rtl_getAppCommandArgCount(); - for(sal_Int32 nCurrent=0; nCurrent& sf) - : m_ServiceFactory(sf) - { } - - InviteJob::~InviteJob() - { } - - void SAL_CALL InviteJob::executeAsync(const Sequence&, const Reference& listener) throw(RuntimeException) - { - Config config(m_ServiceFactory); - { - LogStorage log_storage(m_ServiceFactory); - log_storage.assureExists(); - } - if(config.getOfficeStartCounterdown() > 0) - config.decrementOfficeStartCounterdown(1); - else - { - if(lcl_IsInvitationAllowed() && !config.getShowedInvitation()) - { - Reference core( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.oooimprovement.Core"))), - UNO_QUERY); - if(core.is()) core->inviteUser(); - } - } - Any result; - listener->jobFinished(Reference(this), result); - } - - sal_Bool SAL_CALL InviteJob::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL InviteJob::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence SAL_CALL InviteJob::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL InviteJob::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.InviteJob")); } - - Sequence SAL_CALL InviteJob::getSupportedServiceNames_static() - { - Sequence aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.AsyncJob")); - return aServiceNames; - } - - Reference InviteJob::Create(const Reference& sm) - { return *(new InviteJob(sm)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/invite_job.hxx b/extensions/source/oooimprovement/invite_job.hxx deleted file mode 100644 index fc2feb515..000000000 --- a/extensions/source/oooimprovement/invite_job.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_INVITEJOB_HXX -#define EXTENSIONS_OOOIMPROVEMENT_INVITEJOB_HXX - -#include -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class InviteJob : public ::cppu::WeakImplHelper2< - css::task::XAsyncJob, - css::lang::XServiceInfo> - { - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create( - // const css::uno::Reference< css::uno::XComponentContext>& context); - - static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm); - - protected: - InviteJob(const css::uno::Reference< css::uno::XComponentContext>& context); - InviteJob(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - virtual ~InviteJob(); - - // XAsyncJob - virtual void SAL_CALL executeAsync( - const css::uno::Sequence< css::beans::NamedValue>& args, - const css::uno::Reference< css::task::XJobListener>& listener) - throw(css::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() - throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& service_name) - throw(css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(css::uno::RuntimeException); - - private: - css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logpacker.cxx b/extensions/source/oooimprovement/logpacker.cxx deleted file mode 100644 index 7c1e27fa3..000000000 --- a/extensions/source/oooimprovement/logpacker.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "logpacker.hxx" -#include -#include -#include -#include -#include -#include - - -using namespace com::sun::star::embed; -using namespace com::sun::star::io; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - static const OUString getZipfileurl(const OUString& csvfileurl) - { - OUStringBuffer buf(csvfileurl); - buf.setLength(csvfileurl.getLength()-3); - buf.appendAscii("zip"); - return buf.makeStringAndClear(); - }; - - static sal_Int32 countLines(const Sequence& data) - { - sal_Int32 result = 0; - for(sal_Int32 idx = data.getLength()-1; idx>=0; --idx) - if(data[idx]==0x0a) result++; - return result; - }; -} - -namespace oooimprovement -{ - LogPacker::LogPacker(const Reference& sf) - : m_ServiceFactory(sf) - {} - - sal_Int32 LogPacker::pack(const OUString& fileurl) - { - Reference file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - - Reference storage; - { - Reference storage_factory( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))), - UNO_QUERY_THROW); - Sequence storage_init_args(2); - storage_init_args[0] = Any(getZipfileurl(fileurl)); - storage_init_args[1] = Any(ElementModes::WRITE); - storage = Reference( - storage_factory->createInstanceWithArguments(storage_init_args), - UNO_QUERY_THROW); - } - - Reference zipped_stream = storage->openStreamElement( - OUString(RTL_CONSTASCII_USTRINGPARAM("logdata.csv")), - ElementModes::WRITE)->getOutputStream(); - Reference unzipped_stream = file_access->openFileRead(fileurl); - const sal_Int32 bufsize = 1024; - sal_Int32 read_bytes; - sal_Int32 logged_events = -1; // ignore header row - Sequence buf(bufsize); - do - { - read_bytes = unzipped_stream->readBytes(buf, bufsize); - buf.realloc(read_bytes); - logged_events += countLines(buf); - zipped_stream->writeBytes(buf); - } while(read_bytes == bufsize); - unzipped_stream->closeInput(); - zipped_stream->flush(); - zipped_stream->closeOutput(); - Reference(storage, UNO_QUERY_THROW)->commit(); - file_access->kill(fileurl); - return logged_events; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logpacker.hxx b/extensions/source/oooimprovement/logpacker.hxx deleted file mode 100644 index 52e86fd8e..000000000 --- a/extensions/source/oooimprovement/logpacker.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_LOGPACKER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_LOGPACKER_HXX - -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class LogPacker - { - public: - LogPacker(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - sal_Int32 pack(const ::rtl::OUString& fileurl); - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logstorage.cxx b/extensions/source/oooimprovement/logstorage.cxx deleted file mode 100644 index da15ebc5c..000000000 --- a/extensions/source/oooimprovement/logstorage.cxx +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "logstorage.hxx" -#include "config.hxx" -#include -#include - - -using namespace com::sun::star::io; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::std::vector; - - -namespace -{ - using namespace oooimprovement; - - static const OUString CSSU_PATHSUB(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")); - - static OUString getLogPathFromCfg(const Reference& sf) - { - Config config(sf); - OUString result=config.getLogPath(); - Reference path_sub( - sf->createInstance(CSSU_PATHSUB), - UNO_QUERY); - if(path_sub.is()) - result = path_sub->substituteVariables(result, sal_False); - return result; - } - - static bool isZipfile(const OUString& fileurl) - { - static const OUString file_extension(RTL_CONSTASCII_USTRINGPARAM(".zip")); - return fileurl.match(file_extension, fileurl.getLength()-file_extension.getLength()); - }; - - static bool isLogfile(const OUString& fileurl) - { - static const OUString file_extension(RTL_CONSTASCII_USTRINGPARAM(".csv")); - static const OUString current(RTL_CONSTASCII_USTRINGPARAM("Current.csv")); - return - fileurl.match(file_extension, fileurl.getLength()-file_extension.getLength()) - && !fileurl.match(current, fileurl.getLength()-current.getLength()); - }; - - static bool isZipOrLogFile(const OUString& fileurl) - { - return isZipfile(fileurl) || isLogfile(fileurl); - } - - static Sequence getAllLogStoragefiles(const Reference& sf) - { - Reference file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - return file_access->getFolderContents( - getLogPathFromCfg(sf), - false); - }; - - static vector getLogStoragefiles( - const Reference& sf, - bool (*condition)(const OUString& path)) - { - Sequence candidates = getAllLogStoragefiles(sf); - vector result; - result.reserve(candidates.getLength()); - for(sal_Int32 idx=0; idx& sf) - { - Reference file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - OUString log_path(getLogPathFromCfg(sf)); - if(!file_access->isFolder(log_path)) - file_access->createFolder(log_path); - }; -} - -namespace oooimprovement -{ - - LogStorage::LogStorage(const Reference& sf) - : m_ServiceFactory(sf) - {} - - void LogStorage::assureExists() - { - assureLogStorageExists(m_ServiceFactory); - } - - void LogStorage::clear() - { - Reference file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - vector files_to_kill = getLogStoragefiles(m_ServiceFactory, &isZipOrLogFile); - for(vector::iterator item = files_to_kill.begin(); - item != files_to_kill.end(); - ++item) - file_access->kill(*item); - } - - const vector LogStorage::getUnzippedLogFiles() const - { return getLogStoragefiles(m_ServiceFactory, &isLogfile); } - - const vector LogStorage::getZippedLogFiles() const - { return getLogStoragefiles(m_ServiceFactory, &isZipfile); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/logstorage.hxx b/extensions/source/oooimprovement/logstorage.hxx deleted file mode 100644 index f97c99a51..000000000 --- a/extensions/source/oooimprovement/logstorage.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_LOGSTORAGE_HXX -#define EXTENSIONS_OOOIMPROVEMENT_LOGSTORAGE_HXX - -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class LogStorage - { - public: - LogStorage(const css::uno::Reference< css::lang::XMultiServiceFactory>& sf); - void assureExists(); - void clear(); - const std::vector< ::rtl::OUString> getUnzippedLogFiles() const; - const std::vector< ::rtl::OUString> getZippedLogFiles() const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/makefile.mk b/extensions/source/oooimprovement/makefile.mk deleted file mode 100644 index a24707ecd..000000000 --- a/extensions/source/oooimprovement/makefile.mk +++ /dev/null @@ -1,109 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -PRJ=..$/.. - -PRJNAME=extensions -TARGET=oooimprovement -ENABLE_EXCEPTIONS=TRUE - -PACKAGE=org.openoffice.Office -ABSXCSROOT=$(SOLARXMLDIR) -XCSROOT=.. -DTDDIR=$(ABSXCSROOT) -XSLDIR=$(ABSXCSROOT)$/processing -PROCESSOUT=$(MISC)$/$(TARGET) -PROCESSORDIR=$(SOLARBINDIR) - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/myconfigurationhelper.obj \ - $(SLO)$/config.obj \ - $(SLO)$/corecontroller.obj \ - $(SLO)$/errormail.obj \ - $(SLO)$/invite_job.obj \ - $(SLO)$/logpacker.obj \ - $(SLO)$/logstorage.obj \ - $(SLO)$/onlogrotate_job.obj \ - $(SLO)$/oooimprovement_exports.obj \ - $(SLO)$/soaprequest.obj \ - $(SLO)$/soapsender.obj \ - -SHL1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(UNOTOOLSLIB) \ - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -PACKAGEDIR=$(subst,.,$/ $(PACKAGE)) -SPOOLDIR=$(MISC)$/registry$/spool - -XCUFILES= \ - Jobs.xcu \ - Logging.xcu - -MYXCUFILES= \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-oooimprovement.xcu \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Logging$/Logging-oooimprovement.xcu - - -# --- Targets --- - -.INCLUDE : target.mk - -ALLTAR : $(MYXCUFILES) - -XCU_SOURCEDIR:=. - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-oooimprovement.xcu : $(XCU_SOURCEDIR)$/Jobs.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Logging$/Logging-oooimprovement.xcu : $(XCU_SOURCEDIR)$/Logging.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ - -ALLTAR : $(MISC)/oooimprovement.component - -$(MISC)/oooimprovement.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovement.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt oooimprovement.component diff --git a/extensions/source/oooimprovement/makefile.pmk b/extensions/source/oooimprovement/makefile.pmk deleted file mode 100644 index f5c8da25b..000000000 --- a/extensions/source/oooimprovement/makefile.pmk +++ /dev/null @@ -1,29 +0,0 @@ -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -XSLDIR=$(SOLARXMLDIR)$/processing -XCSROOT=$(SOLARXMLDIR) -ABSXCSROOT=$(SOLARXMLDIR) -DTDDIR=$(SOLARXMLDIR) -PROCESSOUT=$(MISC)$/$(CUSTID) -PROCESSORDIR=$(SOLARBINDIR) - -# no validation by inspector class -NO_INSPECTION=TRUE - diff --git a/extensions/source/oooimprovement/myconfigurationhelper.cxx b/extensions/source/oooimprovement/myconfigurationhelper.cxx deleted file mode 100644 index c9bd2f2bb..000000000 --- a/extensions/source/oooimprovement/myconfigurationhelper.cxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "myconfigurationhelper.hxx" -#include -#include -#include -#include -#include -#include - - -namespace css = ::com::sun::star; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; -using ::std::vector; - - -namespace -{ - static const Sequence sequenceFromVector(const vector& vec) - { - Sequence result(vec.size()); - for(size_t idx = 0; idx < vec.size(); ++idx) - result[idx] = vec[idx]; - return result; - }; - - static const OUString noSuchElement(const OUString& path) - { - OUStringBuffer buf(256); - buf.appendAscii("The requested path \""); - buf.append(path); - buf.appendAscii("\" does not exists."); - return buf.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - Reference MyConfigurationHelper::openConfig( - const Reference xSMGR, - const OUString& sPackage, - sal_Int32 eMode) - { - Reference xConfigProvider( - xSMGR->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))), - UNO_QUERY_THROW); - - vector lParams; - css::beans::PropertyValue aParam; - - // set root path - aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")); - aParam.Value <<= sPackage; - lParams.push_back(makeAny(aParam)); - - // enable all locales mode - if ((eMode & MyConfigurationHelper::E_ALL_LOCALES)==MyConfigurationHelper::E_ALL_LOCALES) - { - aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("locale")); - aParam.Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("*")); - lParams.push_back(makeAny(aParam)); - } - - // enable lazy writing - sal_Bool bLazy = ((eMode & MyConfigurationHelper::E_LAZY_WRITE)==MyConfigurationHelper::E_LAZY_WRITE); - aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")); - aParam.Value = makeAny(bLazy); - lParams.push_back(makeAny(aParam)); - - // open it - Reference xCFG; - - sal_Bool bReadOnly = ((eMode & MyConfigurationHelper::E_READONLY)==MyConfigurationHelper::E_READONLY); - if (bReadOnly) - xCFG = xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), - sequenceFromVector(lParams)); - else - xCFG = xConfigProvider->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationUpdateAccess")), - sequenceFromVector(lParams)); - return xCFG; - } - - Any MyConfigurationHelper::readRelativeKey( - const Reference xCFG, - const OUString& sRelPath, - const OUString& sKey) - { - Reference xAccess(xCFG, UNO_QUERY_THROW); - - Reference xProps; - xAccess->getByHierarchicalName(sRelPath) >>= xProps; - if (!xProps.is()) - throw css::container::NoSuchElementException( - noSuchElement(sRelPath), - Reference()); - return xProps->getPropertyValue(sKey); - } - - void MyConfigurationHelper::writeRelativeKey( - const Reference xCFG, - const OUString& sRelPath, - const OUString& sKey, - const Any& aValue) - { - Reference xAccess(xCFG, UNO_QUERY_THROW); - - Reference xProps; - xAccess->getByHierarchicalName(sRelPath) >>= xProps; - if (!xProps.is()) - throw css::container::NoSuchElementException( - noSuchElement(sRelPath), - Reference()); - xProps->setPropertyValue(sKey, aValue); - } - - Any MyConfigurationHelper::readDirectKey( - const Reference xSMGR, - const OUString& sPackage, - const OUString& sRelPath, - const OUString& sKey, - sal_Int32 eMode) - { - Reference xCFG = MyConfigurationHelper::openConfig(xSMGR, sPackage, eMode); - return MyConfigurationHelper::readRelativeKey(xCFG, sRelPath, sKey); - } - - void MyConfigurationHelper::writeDirectKey( - const Reference xSMGR, - const OUString& sPackage, - const OUString& sRelPath, - const OUString& sKey, - const Any& aValue, - sal_Int32 eMode) - { - Reference xCFG = MyConfigurationHelper::openConfig(xSMGR, sPackage, eMode); - MyConfigurationHelper::writeRelativeKey(xCFG, sRelPath, sKey, aValue); - MyConfigurationHelper::flush(xCFG); - } - - void MyConfigurationHelper::flush(const Reference& xCFG) - { - Reference xBatch(xCFG, UNO_QUERY_THROW); - xBatch->commitChanges(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/myconfigurationhelper.hxx b/extensions/source/oooimprovement/myconfigurationhelper.hxx deleted file mode 100644 index 96936bcb9..000000000 --- a/extensions/source/oooimprovement/myconfigurationhelper.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_CONFIGURATIONHELPER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_CONFIGURATIONHELPER_HXX - -#include -#include -#include -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - // Copy from comphelper module, we cant use that directly from an extension - class MyConfigurationHelper - { - public: - //----------------------------------------------- - /** specify all possible modes, which can be used to open a configuration access. - * - * @see openConfig() - * @see readDirectKey() - * @see writeDirectKey() - */ - enum EConfigurationModes - { - /// opens configuration in read/write mode (without LAZY writing!) - E_STANDARD = 0, - /// configuration will be opened readonly - E_READONLY = 1, - /// all localized nodes will be interpreted as css::uno::XInterface instead of interpreting it as atomic value nodes - E_ALL_LOCALES = 2, - /// enable lazy writing - E_LAZY_WRITE = 4 - }; - - //----------------------------------------------- - /** returns access to the specified configuration package. - * - * This method should be used, if e.g. more then one request to the same - * configuration package is needed. The configuration access can be cached - * outside and used inbetween. - * - * @param xSMGR - * the uno service manager, which should be used to create the - * configuration access. - * - * @param sPackage - * the name of the configuration package. - * e.g.
            - *
          • org.openoffice.Office.Common
          • - *
          • org.openoffice.Office.Common/Menu
          • - *
          - * - * @param eMode - * specify the open mode for the returned configuration access. - * It's interpreted as a flag field and can be any usefull combination - * of values of EConfigurationModes. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::uno::Exception if the configuration could not be opened. - */ - static css::uno::Reference< css::uno::XInterface> openConfig( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - sal_Int32 eMode); - - //----------------------------------------------- - /** reads the value of an existing(!) configuration key, - * which is searched relative to the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here ... and - * all operations are made relativ to this access point. - * - * @param xCFG - * the configuration root, where sRelPath should be interpreted. - * as relativ path - * - * @param sRelPath - * path relative to xCFG parameter. - * - * @param sKey - * the configuration node, where we should read the value. - * - * @return [css.uno.css::uno::Any] - * the value of sKey. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::container::NoSuchElementException if the specified - * key does not exists. - */ - static css::uno::Any readRelativeKey( - const css::uno::Reference< css::uno::XInterface> xCFG, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey); - - //----------------------------------------------- - /** writes a new value for an existing(!) configuration key, - * which is searched relative to the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here ... and - * all operations are made relativ to this access point. - * - * @param xCFG - * the configuration root, where sRelPath should be interpreted. - * as relativ path - * - * @param sRelPath - * path relative to xCFG parameter. - * - * @param sKey - * the configuration node, where we should write the new value. - * - * @param aValue - * the new value for sKey. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. css::container::NoSuchElementException if the specified - * key does not exists or css::uno::Exception if the provided configuration - * access does not allow writing for this key. - */ - static void writeRelativeKey( - const css::uno::Reference< css::uno::XInterface> xCFG, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - const css::uno::Any& aValue); - - //----------------------------------------------- - /** commit all changes made on the specified configuration access. - * - * This method must be used in combination with openConfig(). - * The cached configuration access must be provided here. - * - * @param xCFG - * the configuration root, where changes should be commited. - * - * @throw css::uno::Any exceptions the underlying configuration can throw. - * E.g. uno::Exception if the provided configuration - * access does not allow writing for this set. - */ - static void flush(const css::uno::Reference< css::uno::XInterface>& xCFG); - - //----------------------------------------------- - /** does the same then openConfig() & readRelativeKey() together. - * - * This method should be used for reading one key at one code place only. - * Because it opens the specified configuration package, reads the key and - * closes the configuration again. - * - * So its not very usefull to use this method for reading multiple keys at the same time. - * (Excepting these keys exists inside different configuration packages ...)) - */ - static css::uno::Any readDirectKey( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - sal_Int32 eMode); - - //----------------------------------------------- - /** does the same then openConfig() / writeRelativeKey() & flush() together. - * - * This method should be used for writing one key at one code place only. - * Because it opens the specified configuration package, writes the key, flush - * all changes and closes the configuration again. - * - * So its not very usefull to use this method for writing multiple keys at the same time. - * (Excepting these keys exists inside different configuration packages ...)) - */ - static void writeDirectKey( - const css::uno::Reference< css::lang::XMultiServiceFactory> xSMGR, - const ::rtl::OUString& sPackage, - const ::rtl::OUString& sRelPath, - const ::rtl::OUString& sKey, - const css::uno::Any& aValue, - sal_Int32 eMode); - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/onlogrotate_job.cxx b/extensions/source/oooimprovement/onlogrotate_job.cxx deleted file mode 100644 index c13690e85..000000000 --- a/extensions/source/oooimprovement/onlogrotate_job.cxx +++ /dev/null @@ -1,243 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "onlogrotate_job.hxx" -#include "config.hxx" -#include "logpacker.hxx" -#include "logstorage.hxx" -#include "soaprequest.hxx" -#include "soapsender.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::uno; -using ::com::sun::star::frame::XTerminateListener; -using ::com::sun::star::frame::XDesktop; -using ::com::sun::star::ucb::XSimpleFileAccess; -using ::rtl::OUString; -using ::std::vector; - -namespace -{ - using namespace oooimprovement; - - static void packLogs(const Reference& sf) - { - try - { - Config config(sf); - LogPacker log_packer(sf); - vector csvfiles = LogStorage(sf).getUnzippedLogFiles(); - for( - vector::iterator item = csvfiles.begin(); - item!=csvfiles.end(); - item++) - config.incrementEventCount(log_packer.pack(*item)); - } catch(...) {}; - }; - - static void uploadLogs(const Reference& sf) - { - try - { - Config config(sf); - Reference file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - SoapSender sender(sf, config.getSoapUrl()); - OUString soap_id = config.getSoapId(); - vector zipfiles = LogStorage(sf).getZippedLogFiles(); - for( - vector::iterator item = zipfiles.begin(); - item!=zipfiles.end(); - item++) - { - if(config.incrementFailedAttempts(1) > 25) - { - config.giveupUploading(); - LogStorage(sf).clear(); - return; - } - sender.send(SoapRequest(sf, soap_id, *item)); - config.incrementReportCount(1); - file_access->kill(*item); - config.resetFailedAttempts(); - } - } catch(...) {}; - } - - class OnLogRotateThread : public ::osl::Thread - { - public: - OnLogRotateThread(Reference sf); - virtual void SAL_CALL run(); - void stop(); - - private: - Reference m_ServiceFactory; - ::osl::Condition m_Stop; - }; - - OnLogRotateThread::OnLogRotateThread(Reference sf) - : m_ServiceFactory(sf) - { - OSL_ASSERT(sf.is()); - } - - void SAL_CALL OnLogRotateThread::run() - { - TimeValue wait_intervall = {30,0}; - if (m_Stop.wait(&wait_intervall) == ::osl::Condition::result_timeout) - { - try - { - if(Config(m_ServiceFactory).getInvitationAccepted()) - { - packLogs(m_ServiceFactory); - uploadLogs(m_ServiceFactory); - } - else - LogStorage(m_ServiceFactory).clear(); - } - catch(...) {} - } - } - - void OnLogRotateThread::stop() - { - m_Stop.set(); - } - - class OnLogRotateThreadWatcher : public ::cppu::WeakImplHelper1 - { - public: - OnLogRotateThreadWatcher(Reference sf) - : m_Thread(new OnLogRotateThread(sf)) - { - m_Thread->create(); - } - virtual ~OnLogRotateThreadWatcher() - { - m_Thread->stop(); - m_Thread->join(); - }; - - // XTerminateListener - virtual void SAL_CALL queryTermination(const EventObject&) throw(RuntimeException) - { }; - virtual void SAL_CALL notifyTermination(const EventObject&) throw(RuntimeException) - { - m_Thread->stop(); - m_Thread->join(); - }; - // XEventListener - virtual void SAL_CALL disposing(const EventObject&) throw(RuntimeException) - { - m_Thread->stop(); - m_Thread->join(); - }; - private: - ::std::auto_ptr m_Thread; - }; -} - -namespace oooimprovement -{ - OnLogRotateJob::OnLogRotateJob(const Reference& context) - : m_ServiceFactory(Reference( - context->getServiceManager()->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.lang.XMultiServiceFactory")), context), - UNO_QUERY)) - { } - - OnLogRotateJob::OnLogRotateJob(const Reference& sf) - : m_ServiceFactory(sf) - { } - - OnLogRotateJob::~OnLogRotateJob() - { } - - void SAL_CALL OnLogRotateJob::executeAsync( - const Sequence&, - const Reference& listener) - throw(RuntimeException) - { - Reference xDesktop( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), - UNO_QUERY); - if(xDesktop.is()) - xDesktop->addTerminateListener(Reference(new OnLogRotateThreadWatcher(m_ServiceFactory))); - Any result; - listener->jobFinished(Reference(this), result); - } - - sal_Bool SAL_CALL OnLogRotateJob::supportsService(const OUString& service_name) throw(RuntimeException) - { - const Sequence service_names(getSupportedServiceNames()); - for (sal_Int32 idx = service_names.getLength()-1; idx>=0; --idx) - if(service_name == service_names[idx]) return sal_True; - return sal_False; - } - - OUString SAL_CALL OnLogRotateJob::getImplementationName() throw(RuntimeException) - { return getImplementationName_static(); } - - Sequence SAL_CALL OnLogRotateJob::getSupportedServiceNames() throw(RuntimeException) - { return getSupportedServiceNames_static(); } - - OUString SAL_CALL OnLogRotateJob::getImplementationName_static() - { return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.extensions.oooimprovement.OnLogRotateJob")); } - - Sequence SAL_CALL OnLogRotateJob::getSupportedServiceNames_static() - { - Sequence aServiceNames(1); - aServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.AsyncJob")); - return aServiceNames; - } - - Reference OnLogRotateJob::Create(const Reference& context) - { return *(new OnLogRotateJob(context)); } - - Reference OnLogRotateJob::Create(const Reference& sf) - { return *(new OnLogRotateJob(sf)); } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/onlogrotate_job.hxx b/extensions/source/oooimprovement/onlogrotate_job.hxx deleted file mode 100644 index 5832c44d6..000000000 --- a/extensions/source/oooimprovement/onlogrotate_job.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_ONLOGROTATEJOB_HXX -#define EXTENSIONS_OOOIMPROVEMENT_ONLOGROTATEJOB_HXX - -#include -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class OnLogRotateJob : public ::cppu::WeakImplHelper2< - ::com::sun::star::task::XAsyncJob, - ::com::sun::star::lang::XServiceInfo> - { - public: - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static(); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL Create( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& context); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL Create( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sf); - - protected: - OnLogRotateJob(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& context); - OnLogRotateJob(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& sm); - virtual ~OnLogRotateJob(); - - // XAsyncJob - virtual void SAL_CALL executeAsync( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue>& args, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XJobListener>& listener) - 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& service_name) - throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() - throw(::com::sun::star::uno::RuntimeException); - - private: - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_ServiceFactory; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/oooimprovement.component b/extensions/source/oooimprovement/oooimprovement.component deleted file mode 100644 index e133f932c..000000000 --- a/extensions/source/oooimprovement/oooimprovement.component +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - diff --git a/extensions/source/oooimprovement/oooimprovement_exports.cxx b/extensions/source/oooimprovement/oooimprovement_exports.cxx deleted file mode 100644 index c33157926..000000000 --- a/extensions/source/oooimprovement/oooimprovement_exports.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "corecontroller.hxx" -#include "invite_job.hxx" -#include "onlogrotate_job.hxx" -#include -#include -#include -#include -#include -#include - - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::uno; -using namespace ::oooimprovement; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - - -namespace -{ - void writeInfo(const Reference& reg_key, - const OUString& implementation_name, - const OUString& service_name) - { - OUStringBuffer buf(256); - buf.append(implementation_name); - buf.appendAscii("/UNO/SERVICES/"); - buf.append(service_name); - reg_key->createKey(buf.makeStringAndClear()); - } -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName, void* pServiceManager, void*) - { - if ( !pServiceManager || !pImplName ) return 0; - - Reference factory; - Reference sm(reinterpret_cast(pServiceManager), UNO_QUERY); - OUString impl_name = OUString::createFromAscii(pImplName); - Sequence names(1); - names[0] = impl_name; - - if (impl_name.equals(CoreController::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, CoreController::Create, names); - if (impl_name.equals(OnLogRotateJob::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, OnLogRotateJob::Create, names); - if (impl_name.equals(InviteJob::getImplementationName_static())) - factory = ::cppu::createSingleFactory(sm, impl_name, InviteJob::Create, names); - if (!factory.is()) return 0; - factory->acquire(); - return factory.get(); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soaprequest.cxx b/extensions/source/oooimprovement/soaprequest.cxx deleted file mode 100644 index fa7b60003..000000000 --- a/extensions/source/oooimprovement/soaprequest.cxx +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "soaprequest.hxx" -#include "errormail.hxx" -#include "config.hxx" -#include -#include -#include -#include -#include -#include - - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using boost::shared_ptr; -using com::sun::star::io::XOutputStream; -using com::sun::star::ucb::XSimpleFileAccess; -using rtl::OUString; -using rtl::OString; -using rtl::OStringBuffer; - - -namespace -{ - static unsigned long asUlong(sal_Int8 input) - { - return *reinterpret_cast(&input); - }; - - static Sequence base64_encode(const Sequence& input) - { - static const char base64_tab[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - Sequence result(4); - unsigned long value = asUlong(input[0]) << 16; - if(input.getLength() > 1) value |= asUlong(input[1]) << 8; - if(input.getLength() > 2) value |= asUlong(input[2]); - - result[0] = static_cast(base64_tab[(value >> 18) & 0x3F]); - result[1] = static_cast(base64_tab[(value >> 12) & 0x3F]); - result[2] = static_cast('='); - result[3] = static_cast('='); - - if (input.getLength() > 1) - { - result[2] = base64_tab[(value >> 6) & 0x3F]; - if (input.getLength() > 2) - result[3] = base64_tab[(value >> 0) & 0x3F]; - } - return result; - }; - - static OString replaceAll(const OString& str, sal_Char old, const OString& replacement) - { - OStringBuffer result; - sal_Int32 idx = 0; - do { - result.append(str.getToken(0, old, idx)); - if(idx>=0) result.append(replacement); - } while(idx >= 0); - return result.makeStringAndClear(); - }; - - static OString xmlEncode(const OString& input) - { - OString result = replaceAll(input, '&', OString("&")); - result = replaceAll(result, '<', OString("<")); - return replaceAll(result, '>', OString(">")); - } - - static shared_ptr > createSequenceFromString(const OString& str) - { - const sal_Int32 size = str.getLength(); - shared_ptr > result(new Sequence(size)); - for(sal_Int32 idx=0; idx < size; idx++) - (*result)[idx] = str[idx]; - return result; - }; - - static void writeString(const Reference& target, const OString& str) - { - shared_ptr > seq = createSequenceFromString(str); - target->writeBytes(*seq); - }; - - static void writeFile(const Reference& sf, const Reference& target, const OUString& fileurl) - { - Reference file_access( - sf->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY); - Reference file = file_access->openFileRead(fileurl); - const sal_Int32 bufsize = 3; - sal_Int32 bytes_read; - Sequence buf(bufsize); - do - { - bytes_read = file->readBytes(buf, bufsize); - if(bytes_read < buf.getLength()) buf.realloc(bytes_read); - if(bytes_read) target->writeBytes(base64_encode(buf)); - } while(bytes_read == bufsize); - }; - - static const OString SOAP_START( - "\n" - "\n" - "\n" - "\n"); - static const OString SOAP_ITEMS_START("\n"); - static const OString SOAP_ITEMS_END("\n"); - static const OString SOAP_END( - "\n" - "\n" - "\n"); - static const OString SOAP_ITEM_END("]]>\n"); - - static const OString getSoapOfficeversion(const Reference& sf) - { - return ::rtl::OUStringToOString(oooimprovement::Config(sf).getCompleteProductname(), RTL_TEXTENCODING_ASCII_US); - }; - - static const OString getSoapSoapId(const Reference& sf, const OString& soap_id) - { - OStringBuffer buf; - buf.append(""); - buf.append(xmlEncode(soap_id)).append("\n"); - buf.append(xmlEncode(getSoapOfficeversion(sf))).append("\n"); - buf.append("\n"); - return buf.makeStringAndClear(); - }; - - static const OString getSoapItemStart(const OString& key) - { - OStringBuffer buf = - "\n" - "" + key + "\n" - "& sf, const OUString& soap_id, const OUString& logfile) - : m_ServiceFactory(sf) - , m_SoapId(soap_id) - , m_Logfile(logfile) - {} - - void SoapRequest::writeTo(const Reference& target) const - { - writeString(target, SOAP_START); - writeString( - target, - getSoapSoapId(m_ServiceFactory, rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US))); - writeString(target, SOAP_ITEMS_START); - writeString(target, getSoapItemStart("reportmail.xml")); - writeString(target, Errormail(m_ServiceFactory).getXml()); - writeString(target, SOAP_ITEM_END); - writeString(target, getSoapItemStart("data.zip")); - writeFile(m_ServiceFactory, target, m_Logfile); - writeString(target, SOAP_ITEM_END); - writeString(target, SOAP_ITEMS_END); - writeString(target, SOAP_END); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soaprequest.hxx b/extensions/source/oooimprovement/soaprequest.hxx deleted file mode 100644 index 126bc0948..000000000 --- a/extensions/source/oooimprovement/soaprequest.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_SOAPREQUEST_HXX -#define EXTENSIONS_OOOIMPROVEMENT_SOAPREQUEST_HXX - -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class SoapRequest - { - public: - SoapRequest( - const css::uno::Reference< css::lang::XMultiServiceFactory>& sf, - const ::rtl::OUString& soap_id, - const ::rtl::OUString& logfile); - void writeTo(const css::uno::Reference< css::io::XOutputStream>& target) const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - // soap_id has to be a plain 7-Bit ASCII String for identification of - // automated test logs etc. - const ::rtl::OUString m_SoapId; - // logfile is the file-url to the file to include - const ::rtl::OUString m_Logfile; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soapsender.cxx b/extensions/source/oooimprovement/soapsender.cxx deleted file mode 100644 index 285f506c2..000000000 --- a/extensions/source/oooimprovement/soapsender.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "soapsender.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using boost::shared_ptr; -using com::sun::star::io::XTempFile; -using com::sun::star::ucb::XSimpleFileAccess; -using com::sun::star::util::URL; -using com::sun::star::util::XURLTransformer; -using osl::ConnectorSocket; -using rtl::OString; -using rtl::OUString; -using rtl::OStringBuffer; - - -namespace -{ - static OString getHttpPostHeader(OString path, sal_Int32 length) - { - OStringBuffer result = - "POST " + path + " HTTP/1.0\r\n" - "Content-Type: text/xml; charset=\"utf-8\"\r\n" - "Content-Length: "; - result.append(length); - result.append("\r\nSOAPAction: \"\"\r\n\r\n"); - return result.makeStringAndClear(); - }; -} - -namespace oooimprovement -{ - SoapSender::SoapSender(const Reference sf, const OUString& url) - : m_ServiceFactory(sf) - , m_Url(url) - { } - - void SoapSender::send(const SoapRequest& request) const - { - Reference temp_file( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), - UNO_QUERY_THROW); - Reference file_access( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), - UNO_QUERY_THROW); - Reference url_trans( - m_ServiceFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), - UNO_QUERY_THROW); - - // writing request to tempfile - { - Reference temp_stream = temp_file->getOutputStream(); - request.writeTo(temp_stream); - temp_stream->flush(); - temp_stream->closeOutput(); - } - - // parse Url - URL url; - { - url.Complete = m_Url; - url_trans->parseStrict(url); - } - - // connect socket - shared_ptr socket(new ConnectorSocket(osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream)); - { - ::osl::SocketAddr addr(url.Server, url.Port); - oslSocketResult result = socket->connect(addr); - if(result != osl_Socket_Ok) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("unable to connect to SOAP server")), - Reference()); - } - - // send header - { - OStringBuffer path_on_server = - OUStringToOString(url.Path, RTL_TEXTENCODING_ASCII_US) + - OUStringToOString(url.Name, RTL_TEXTENCODING_ASCII_US); - const OString header = getHttpPostHeader(path_on_server.makeStringAndClear(), file_access->getSize(temp_file->getUri())); - if(socket->write(header.getStr(), header.getLength()) != static_cast(header.getLength())) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("error while sending HTTP header")), - Reference()); - } - - // send soap request - { - Reference temp_stream = file_access->openFileRead(temp_file->getUri()); - const sal_Int32 bufsize = 1024; - sal_Int32 bytes_read; - Sequence buf(bufsize); - char buf2[bufsize]; - do - { - bytes_read = temp_stream->readBytes(buf, bufsize); - buf.realloc(bytes_read); - for(sal_Int32 idx = 0; idx < bytes_read; idx++) - buf2[idx] = buf[idx]; - if(socket->write(buf2, bytes_read) != bytes_read) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("error while sending SOAP request")), - Reference()); - } while(bytes_read == bufsize); - } - - // receive answer - { - const sal_Int32 bufsize = 1024; - char buf[bufsize]; - sal_Int32 bytes_read = socket->read(buf, bufsize); - OString answer(buf, bytes_read); - const sal_Int32 returncode_start = answer.indexOf(' '); - if(returncode_start==-1 || !answer.copy(returncode_start, 4).equals(OString(" 200"))) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("SOAP server returns a error")), - Reference()); - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/oooimprovement/soapsender.hxx b/extensions/source/oooimprovement/soapsender.hxx deleted file mode 100644 index 6a3e3d6f1..000000000 --- a/extensions/source/oooimprovement/soapsender.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_OOOIMPROVEMENT_SOAPSENDER_HXX -#define EXTENSIONS_OOOIMPROVEMENT_SOAPSENDER_HXX - -#include "soaprequest.hxx" -#include -#include -#include - - -namespace oooimprovement -{ - #ifdef css - #error css defined globally - #endif - #define css ::com::sun::star - class SoapSender - { - public: - SoapSender( - const css::uno::Reference< css::lang::XMultiServiceFactory> sf, - const ::rtl::OUString& url); - void send(const SoapRequest& request) const; - private: - const css::uno::Reference< css::lang::XMultiServiceFactory> m_ServiceFactory; - const ::rtl::OUString m_Url; - }; - #undef css -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/aqua/macmgr.cxx b/extensions/source/plugin/aqua/macmgr.cxx deleted file mode 100644 index bfc23a99c..000000000 --- a/extensions/source/plugin/aqua/macmgr.cxx +++ /dev/null @@ -1,654 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "rtl/ustrbuf.hxx" -#include "rtl/strbuf.hxx" - -#include "plugin/impl.hxx" -#include "osl/file.h" -#include "osl/module.hxx" - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::plugin; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringBuffer; -using ::rtl::OStringBuffer; -using ::rtl::OUStringToOString; -using ::rtl::OStringToOUString; - -namespace plugstringhelper -{ - -rtl::OUString getString( CFStringRef i_xString ) -{ - rtl::OUStringBuffer aBuf; - if( i_xString ) - { - CFIndex nChars = CFStringGetLength( i_xString ); - CFRange aRange = { 0, nChars }; - aBuf.setLength( nChars ); - CFStringGetCharacters( i_xString, aRange, static_cast< UniChar* >(const_cast(aBuf.getStr())) ); - } - return aBuf.makeStringAndClear(); -} - -rtl::OUString getString( CFURLRef i_xURL ) -{ - CFStringRef xString = CFURLGetString( i_xURL ); - return getString( xString ); -} - -CFMutableStringRef createString( const rtl::OUString& i_rString ) -{ - CFMutableStringRef xString = CFStringCreateMutable( NULL, 0 ); - if( xString ) - CFStringAppendCharacters( xString, i_rString.getStr(), i_rString.getLength() ); - return xString; -} - -CFURLRef createURL( const rtl::OUString& i_rString ) -{ - - CFMutableStringRef xMutableString = createString( i_rString ); - CFURLRef xURL = CFURLCreateWithString( NULL, xMutableString, NULL ); - CFRelease( xMutableString ); - return xURL; -} - -rtl::OUString getURLFromPath( const rtl::OUString& i_rPath ) -{ - CFMutableStringRef xMutableString = createString( i_rPath ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - CFRelease( xMutableString ); - CFStringRef xString = CFURLGetString( xURL ); - rtl::OUString aRet = getString( xString ); - CFRelease( xURL ); - return aRet; -} - -CFURLRef createURLFromPath( const rtl::OUString& i_rPath ) -{ - CFMutableStringRef xMutableString = createString( i_rPath ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - return xURL; -} - -rtl::OUString CFURLtoOSLURL( CFURLRef i_xURL ) -{ - // make URL absolute - CFURLRef xAbsURL = CFURLCopyAbsoluteURL( i_xURL ); - // copy system path - CFStringRef xSysPath = CFURLCopyFileSystemPath( xAbsURL ? xAbsURL : i_xURL, kCFURLPOSIXPathStyle ); - if( xAbsURL ) - CFRelease( xAbsURL ); - rtl::OUString aSysPath( getString( xSysPath ) ); - CFRelease( xSysPath ); - rtl::OUString aFileURL; - osl_getFileURLFromSystemPath( aSysPath.pData, &aFileURL.pData ); - return aFileURL; -} - -} - -using namespace plugstringhelper; - -static int parsePlist( CFBundleRef i_xBundle, const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions ) -{ - CFTypeRef xMimeDict = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginMIMETypes")); - int nMimetypes = 0; - if( xMimeDict == 0 || - CFGetTypeID(xMimeDict) != CFDictionaryGetTypeID() || - (nMimetypes = CFDictionaryGetCount( static_cast(xMimeDict))) <= 0 ) - { - return 0; - } - - // prepare an array of key and value refs - std::vector< CFTypeRef > aKeys( nMimetypes, CFTypeRef(NULL) ); - std::vector< CFTypeRef > aValues( nMimetypes, CFTypeRef(NULL) ); - CFDictionaryGetKeysAndValues(static_cast(xMimeDict), &aKeys[0], &aValues[0] ); - - int nAdded = 0; - for( int i = 0; i < nMimetypes; i++ ) - { - // get the mimetype - CFTypeRef xKey = aKeys[i]; - if( ! xKey || CFGetTypeID(xKey) != CFStringGetTypeID() ) - continue; - rtl::OUString aMimetype = getString( (CFStringRef)xKey ); - - // the correspoding value should be a dictionary - CFTypeRef xDict = aValues[i]; - if( ! xDict || CFGetTypeID( xDict ) != CFDictionaryGetTypeID() ) - continue; - - // get the extension list - CFTypeRef xExtArray = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginExtensions" ) ); - if( !xExtArray || CFGetTypeID( xExtArray ) != CFArrayGetTypeID() ) - continue; - - OUStringBuffer aExtBuf; - int nExtensions = CFArrayGetCount( (CFArrayRef)xExtArray ); - for( int n = 0; n < nExtensions; n++ ) - { - CFTypeRef xExt = CFArrayGetValueAtIndex( (CFArrayRef)xExtArray, n ); - if( xExt && CFGetTypeID( xExt ) == CFStringGetTypeID() ) - { - if( aExtBuf.getLength() > 0 ) - aExtBuf.append( sal_Unicode(';') ); - OUString aExt( getString( (CFStringRef)xExt ) ); - if( aExt.indexOfAsciiL( "*.", 2 ) != 0 ) - aExtBuf.appendAscii( "*." ); - aExtBuf.append( aExt ); - } - } - - // get the description string - CFTypeRef xDescString = CFDictionaryGetValue( (CFDictionaryRef)xDict, CFSTR("WebPluginTypeDescription" ) ); - if( !xDescString || CFGetTypeID( xDescString ) != CFStringGetTypeID() ) - continue; - rtl::OUString aDescription = getString( (CFStringRef)xDescString ); - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = aMimetype; - // set extension line - pNew->Extension = aExtBuf.makeStringAndClear(); - // set description - pNew->Description= aDescription; - - io_rDescriptions.push_back( pNew ); - nAdded++; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from PList:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr() - ); -#endif - - } - - return nAdded; -} - -static int parseMimeString( const rtl::OUString& i_rBundleURL , list< PluginDescription* >& io_rDescriptions, const char* i_pMime ) -{ - if( ! i_pMime ) - return 0; - - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - - OStringBuffer aMIME; - aMIME.append( i_pMime ); - - if( aMIME.getLength() < 1 ) - return 0; - - OString aLine = aMIME.makeStringAndClear(); - - int nAdded = 0; - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OString aType = aLine.getToken( 0, ';', nIndex ); - - sal_Int32 nTypeIndex = 0; - OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); - OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); - if( nTypeIndex < 0 ) // ensure at least three tokens - continue; - OString aDesc = aType.getToken( 0, ':', nTypeIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOf( "*." ) != 0 ) - aExtension.append( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( ';' ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); - // set extension line - pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); - // set description - pNew->Description= OStringToOUString( aDesc, aEncoding ); - io_rDescriptions.push_back( pNew ); - nAdded++; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from mime string:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, aEncoding ).getStr(), - OUStringToOString( pNew->Extension, aEncoding ).getStr(), - OUStringToOString( pNew->Description, aEncoding ).getStr() - ); -#endif - } - return nAdded; -} - -// this is so ugly it you want to tear your eyes out -static rtl::OUString GetNextPluginStringFromHandle(Handle h, short *index) -{ - char* pPascalBytes = (*h + *index); - sal_uInt32 nLen = (unsigned char)pPascalBytes[0]; - rtl::OStringBuffer aBuf( nLen ); - aBuf.append( pPascalBytes+1, nLen ); - *index += nLen + 1; - return rtl::OStringToOUString( aBuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); -} - -static int parseMimeResource( CFBundleRef i_xBundle, - oslModule& i_rMod, - const rtl::OUString& i_rBundleURL, - list< PluginDescription* >& io_rDescriptions ) -{ - int nAdded = 0; - // just to hurt our eyes more there is an alternative mimetype function plus the possibility - // of a resource fork. Must be a case of think different. - #if __LP64__ - int - #else - SInt16 - #endif - xRes = 0; - BPSupportedMIMETypes aMIMETypesStrangeStruct = {kBPSupportedMIMETypesStructVers_1, NULL, NULL}; - - BP_GetSupportedMIMETypesUPP pBPGetSupp = (BP_GetSupportedMIMETypesUPP)osl_getAsciiFunctionSymbol( i_rMod, "BP_GetSupportedMIMETypes" ); - if( pBPGetSupp && - noErr == pBPGetSupp( &aMIMETypesStrangeStruct, 0 ) && - aMIMETypesStrangeStruct.typeStrings ) - { - HLock( aMIMETypesStrangeStruct.typeStrings ); - if( aMIMETypesStrangeStruct.infoStrings ) // it's possible some plugins have infoStrings missing - HLock( aMIMETypesStrangeStruct.infoStrings ); - } - else // Try to get data from the resource fork - { - xRes = CFBundleOpenBundleResourceMap( i_xBundle ); - if( xRes > 0 ) - { - aMIMETypesStrangeStruct.typeStrings = Get1Resource('STR#', 128); - if( aMIMETypesStrangeStruct.typeStrings ) - { - DetachResource( aMIMETypesStrangeStruct.typeStrings ); - HLock( aMIMETypesStrangeStruct.typeStrings ); - aMIMETypesStrangeStruct.infoStrings = Get1Resource('STR#', 127); - if( aMIMETypesStrangeStruct.infoStrings ) - { - DetachResource( aMIMETypesStrangeStruct.infoStrings ); - HLock( aMIMETypesStrangeStruct.infoStrings ); - } - } - } - } - - if( aMIMETypesStrangeStruct.typeStrings && aMIMETypesStrangeStruct.infoStrings ) - { - short nVariantCount = (**(short**)aMIMETypesStrangeStruct.typeStrings) / 2; - // Fill in the info struct based on the data in the BPSupportedMIMETypes struct - // this is an array of pascal string of unknown (!) encoding - // whoever thought of this deserves a fair beating - short mimeIndex = 2; - short descriptionIndex = 2; - for( int i = 0; i < nVariantCount; i++ ) - { - rtl::OUString aMimetype = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex ); - rtl::OUString aExtLine = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.typeStrings, &mimeIndex ); - rtl::OUString aDescription; - if( aMIMETypesStrangeStruct.infoStrings ) - aDescription = GetNextPluginStringFromHandle( aMIMETypesStrangeStruct.infoStrings, &descriptionIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OUStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OUString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOfAsciiL( "*.", 2 ) != 0 ) - aExtension.appendAscii( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( sal_Unicode(';') ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = i_rBundleURL; - // set mimetype - pNew->Mimetype = aMimetype; - // set extension line - pNew->Extension = aExtension.makeStringAndClear(); - // set description - pNew->Description= aDescription; - io_rDescriptions.push_back( pNew ); - nAdded++; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "Inserting from resource:\n" - " Mimetype: %s\n" - " Extension: %s\n" - " Description: %s\n", - OUStringToOString( pNew->Mimetype, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Extension, RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pNew->Description, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - } - } - - - // clean up - if( aMIMETypesStrangeStruct.typeStrings ) - { - HUnlock( aMIMETypesStrangeStruct.typeStrings ); - DisposeHandle( aMIMETypesStrangeStruct.typeStrings ); - } - if( aMIMETypesStrangeStruct.infoStrings ) - { - HUnlock( aMIMETypesStrangeStruct.infoStrings ); - DisposeHandle( aMIMETypesStrangeStruct.infoStrings ); - } - if( xRes ) - CFBundleCloseBundleResourceMap( i_xBundle, xRes ); - - return nAdded; -} - -// check some known bad plugins to avoid crashes -static bool checkBlackList( CFBundleRef i_xBundle ) -{ - rtl::OUString aBundleName; - CFTypeRef bundlename = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleName")); - if( bundlename && CFGetTypeID(bundlename) == CFStringGetTypeID() ) - aBundleName = getString( static_cast(bundlename) ); - - rtl::OUString aBundleVersion; - CFTypeRef bundleversion = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleVersion")); - if( bundleversion && CFGetTypeID(bundleversion) == CFStringGetTypeID() ) - aBundleVersion = getString( static_cast(bundleversion) ); - - bool bReject = false; - // #i102735# VLC plugin prior to 1.0 tends to crash - if( aBundleName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VLC Plug-in" ) ) ) - { - sal_Int32 nIndex = 0; - rtl::OUString aMajor( aBundleVersion.getToken( 0, '.', nIndex ) ); - if( aMajor.toInt32() < 1 ) - { - bReject = true; - } - } - // #i103674# Garmin Communicator Plugin crashes - else if( aBundleName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Garmin Communicator Plugin" ) ) ) - { - bReject = true; - } - - #if OSL_DEBUG_LEVEL > 1 - if( bReject ) - fprintf( stderr, "rejecting plugin \"%s\" version %s\n", - rtl::OUStringToOString( aBundleName, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aBundleVersion, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - - return bReject; -} - -static int getPluginDescriptions( CFBundleRef i_xBundle , list< PluginDescription* >& io_rDescriptions ) -{ - int nDescriptions = 0; - if( ! i_xBundle ) - return nDescriptions; - - if( checkBlackList( i_xBundle ) ) - return 0; - - rtl::OUString aPlugURL; - CFURLRef xURL = CFBundleCopyBundleURL( i_xBundle ); - aPlugURL = getString( xURL ); - CFRelease( xURL ); - - #if OSL_DEBUG_LEVEL > 1 - rtl::OUString aPlugName, aPlugDescription; - CFTypeRef name = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginName")); - if( name && CFGetTypeID(name) == CFStringGetTypeID() ) - aPlugName = getString( static_cast(name) ); - - CFTypeRef description = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("WebPluginDescription")); - if( description && CFGetTypeID(description) == CFStringGetTypeID() ) - aPlugDescription = getString( static_cast(description) ); - - fprintf( stderr, "URL: %s\nname: %s\ndescription: %s\n", - rtl::OUStringToOString( aPlugURL, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aPlugName, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( aPlugDescription, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - - - // get location of plugin library - CFURLRef xLibURL = CFBundleCopyExecutableURL( i_xBundle ); - if( ! xLibURL ) - return 0; - // get the file system path - rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) ); - CFRelease( xLibURL ); - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "exec URL = %s\n", rtl::OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - - /* TODO: originally the C++ wrapper for oslModule was used here, but that led to - mysterious crashes in the event loop (pointing to heap corruption). Why using - the C style oslModule should fix this is completely unknown. It may be that - we have just hidden the heap corruption a little more. - */ - oslModule aMod = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT ); - if( ! aMod ) - return 0; - - // check for at least the init function of a plugin - if( ! osl_getAsciiFunctionSymbol( aMod, "NP_Initialize") && - ! osl_getAsciiFunctionSymbol( aMod, "NP_GetEntryPoints" ) ) - { - return 0; - } - - // ask the plist of the bundle for mimetypes - nDescriptions = parsePlist( i_xBundle, aPlugURL, io_rDescriptions ); - if( nDescriptions ) - { - osl_unloadModule( aMod ); - return nDescriptions; - } - - // resolve the symbol that might get us the mimetypes - const char* (*pGetMimeDescription)() = (const char*(*)())osl_getAsciiFunctionSymbol( aMod, "_NP_GetMIMEDescription" ); - if( pGetMimeDescription ) - { - const char* pMime = pGetMimeDescription(); - if( pMime ) - { - nDescriptions = parseMimeString( aPlugURL, io_rDescriptions, pMime ); - if( nDescriptions ) - { - osl_unloadModule( aMod ); - return nDescriptions; - } - } - } - - // and as last resort check the resource of the bundle - nDescriptions = parseMimeResource( i_xBundle, aMod, aPlugURL, io_rDescriptions ); - osl_unloadModule( aMod ); - - return nDescriptions; -} - -// Unix specific implementation -static bool CheckPlugin( const rtl::OUString& rPath, list< PluginDescription* >& rDescriptions ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Trying path %s ... ", rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - CFURLRef xURL = createURL( rPath ); - - CFArrayRef xBundles = CFBundleCreateBundlesFromDirectory( NULL, xURL, CFSTR("plugin") ); - if( ! xBundles ) - return false; - - CFIndex nBundles = CFArrayGetCount( xBundles ); - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "got %d bundles\n", (int)nBundles ); -#endif - - int nDescriptions = 0; - for( CFIndex i = 0; i < nBundles; i++ ) - { - CFBundleRef xBundle = (CFBundleRef)CFArrayGetValueAtIndex( xBundles, i ); - nDescriptions += getPluginDescriptions( xBundle, rDescriptions ); - - CFRelease( xBundle ); - } - CFRelease( xBundles ); - - - return nDescriptions > 0; -} - -static rtl::OUString FindFolderURL( FSVolumeRefNum vRefNum, OSType folderType ) -{ - rtl::OUString aRet; - - FSRef aFSRef; - OSErr err = FSFindFolder( vRefNum, folderType, kDontCreateFolder, &aFSRef ); - if( err == noErr ) - { - CFURLRef xURL = CFURLCreateFromFSRef( NULL, &aFSRef ); - aRet = getString( xURL ); - CFRelease( xURL ); - } - - return aRet; -} - -Sequence XPluginManager_Impl::impl_getPluginDescriptions() throw() -{ - static Sequence aDescriptions; - static sal_Bool bHavePlugins = sal_False; - if( ! bHavePlugins ) - { - std::list aPlugins; - - static const char* pNPXPluginPath = getenv( "MOZ_PLUGIN_PATH" ); - - // get directories - std::list< rtl::OUString > aPaths; - if( pNPXPluginPath ) - { - CFMutableStringRef xMutableString = CFStringCreateMutable( NULL, 0 ); - CFStringAppendCString( xMutableString, pNPXPluginPath, kCFStringEncodingUTF8 ); - CFURLRef xURL = CFURLCreateWithFileSystemPath( NULL, xMutableString, kCFURLPOSIXPathStyle, true ); - CFRelease( xMutableString ); - aPaths.push_back( getString( xURL ) ); - CFRelease( xURL ); - } - - rtl::OUString aPath = FindFolderURL( kUserDomain, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - aPath = FindFolderURL( kLocalDomain, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - aPath = FindFolderURL( kOnAppropriateDisk, kInternetPlugInFolderType ); - if( aPath.getLength() ) - aPaths.push_back( aPath ); - - - const Sequence< ::rtl::OUString >& rPaths( PluginManager::getAdditionalSearchPaths() ); - for( sal_Int32 i = 0; i < rPaths.getLength(); i++ ) - { - aPaths.push_back( getURLFromPath( rPaths.getConstArray()[i] ) ); - } - - for( std::list< rtl::OUString >::const_iterator it = aPaths.begin(); it != aPaths.end(); ++it ) - { - rtl::OUString aPath( *it ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "check path %s\n", rtl::OUStringToOString( *it, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - CheckPlugin( aPath, aPlugins ); - } - - - // create return value - aDescriptions = Sequence( aPlugins.size() ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %d plugins\n", (int)aPlugins.size() ); -#endif - list::iterator iter; - sal_Int32 nPlug = 0; - for( iter = aPlugins.begin(); iter != aPlugins.end(); ++iter ) - { - aDescriptions.getArray()[ nPlug++ ] = **iter; - delete *iter; - } - aPlugins.clear(); - bHavePlugins = sal_True; - } - return aDescriptions; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/aqua/makefile.mk b/extensions/source/plugin/aqua/makefile.mk deleted file mode 100644 index 8d1aaa484..000000000 --- a/extensions/source/plugin/aqua/makefile.mk +++ /dev/null @@ -1,63 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=plaqua - -.INCLUDE : ..$/util$/makefile.pmk - -.IF "$(GUIBASE)"!="aqua" || "$(WITH_MOZILLA)"=="NO" - -dummy: - @echo "Nothing to build for GUIBASE $(GUIBASE)." - -.ELSE - -# --- Files -------------------------------------------------------- - -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin -.IF "$(SOLAR_JAVA)" != "" -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr -INCPRE+=-I$(SOLARINCDIR)$/npsdk -CDEFS+=-DOJI -.ENDIF - -.IF "$(GUIBASE)"=="aqua" -CFLAGSCXX+=$(OBJCXXFLAGS) -.ENDIF # "$(GUIBASE)"=="aqua" - -SLOFILES=\ - $(SLO)$/macmgr.obj \ - $(SLO)$/sysplug.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -.ENDIF # $(GUIBASE)==aqua diff --git a/extensions/source/plugin/aqua/sysplug.cxx b/extensions/source/plugin/aqua/sysplug.cxx deleted file mode 100644 index ec54f4aa3..000000000 --- a/extensions/source/plugin/aqua/sysplug.cxx +++ /dev/null @@ -1,812 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -#include -#include -#include -#include - -#include - -extern NPNetscapeFuncs aNPNFuncs; - -#include - -using namespace plugstringhelper; - -using ::rtl::OUString; -using ::rtl::OUStringToOString; - -#if OSL_DEBUG_LEVEL > 1 -void TRACE( char const * s ); -void TRACEN( char const * s, long n ); -#else -#define TRACE(x) -#define TRACEN(x,n) -#endif - -struct FakeEventRecord : public EventRecord -{ - FakeEventRecord() - { - memset( this, 0, sizeof(EventRecord) ); - ::GetGlobalMouse( &where ); - when = ::TickCount(); - modifiers = ::GetCurrentEventKeyModifiers(); - } -}; - - -@interface OOoPluginView : NSView -{ - XPlugin_Impl* m_pImpl; - MacPluginComm* m_pCom; -} --(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect)i_aRect; --(void)drawRect: (NSRect)i_aRect; --(BOOL)isOpaque; --(BOOL)isFlipped; - -// NSResponder --(void)mouseMoved: (NSEvent*)i_pEvent; --(void)mouseDown: (NSEvent*)i_pEvent; --(void)mouseDragged: (NSEvent*)i_pEvent; --(void)mouseUp: (NSEvent*)i_pEvent; --(void)rightMouseDown: (NSEvent*)i_pEvent; --(void)rightMouseDragged: (NSEvent*)i_pEvent; --(void)rightMouseUp: (NSEvent*)i_pEvent; --(void)otherMouseDown: (NSEvent*)i_pEvent; --(void)otherMouseDragged: (NSEvent*)i_pEvent; --(void)otherMouseUp: (NSEvent*)i_pEvent; --(void)mouseEntered: (NSEvent*)i_pEvent; --(void)mouseExited: (NSEvent*)i_pEvent; -@end - -@implementation OOoPluginView --(id)initWithInstance: (XPlugin_Impl*)i_pImpl pluginComm: (MacPluginComm*)i_pCom frame: (NSRect) i_aRect -{ - if( (self = [super initWithFrame: i_aRect]) ) - { - m_pImpl = i_pImpl; - m_pCom = i_pCom; - } - return self; -} - --(void)drawRect: (NSRect) i_aRect -{ - m_pCom->drawView( m_pImpl ); -} - --(BOOL)isOpaque -{ - return NO; -} - --(BOOL)isFlipped -{ - return YES; -} - -// NSResponder --(void)mouseMoved: (NSEvent*)i_pEvent -{ - FakeEventRecord aRec; - aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseDown: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseDragged: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseUp: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseDown: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseDragged: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)rightMouseUp: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseDown: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseDown; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseDragged: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)otherMouseUp: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = mouseUp; - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseEntered: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - --(void)mouseExited: (NSEvent*)i_pEvent; -{ - FakeEventRecord aRec; - aRec.what = aRec.what = osEvt + 18; // NPEventType_AdjustCursorEvent - m_pCom->NPP_HandleEvent( m_pImpl->getNPPInstance(), &aRec ); -} - -@end - -//-------------------------------------------------------------------------------------------------- -MacPluginComm::MacPluginComm( const rtl::OUString& i_rMimetype, const rtl::OUString& i_rBundle, NSView* i_pParent ) - : PluginComm( OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ) ), - m_xBundle( NULL ), - m_hPlugLib( NULL ), - m_pNullTimer( NULL ) -{ - // initialize plugin function table - memset( &m_aNPPfuncs, 0, sizeof( m_aNPPfuncs ) ); - - // load the bundle - CFURLRef xURL = createURL( i_rBundle ); - m_xBundle = CFBundleCreate( NULL, xURL ); - CFRelease( xURL ); - if( m_xBundle ) - { - // ask the plugin library - // first get its location - CFURLRef xLibURL = CFBundleCopyExecutableURL( m_xBundle ); - if( xLibURL ) - { - // get the file system path - rtl::OUString aModuleURL( CFURLtoOSLURL( xLibURL ) ); - CFRelease( xLibURL ); - m_hPlugLib = osl_loadModule( aModuleURL.pData, SAL_LOADMODULE_DEFAULT ); - #if OSL_DEBUG_LEVEL > 1 - if( ! m_hPlugLib ) - fprintf( stderr, "module %s could not be loaded\n", OUStringToOString( aModuleURL, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - #if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "bundle %s has no exectutable URL\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - else - { - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "bundle %s could not be loaded\n", OUStringToOString( i_rBundle, RTL_TEXTENCODING_UTF8 ).getStr() ); - #endif - } - - DBG_ASSERT( m_xBundle && m_hPlugLib, "loading plugin bundle failed!" ); - - - m_aNPPfuncs.size = sizeof( m_aNPPfuncs ); - m_aNPPfuncs.version = 0; - - - m_eCall = eNP_Initialize; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -MacPluginComm::~MacPluginComm() -{ - if( m_hPlugLib ) - { - // NPP_Shutdown(); - NPError (*pShutdown)(); - if( retrieveFunction( "NP_Shutdown", (void**)&pShutdown ) ) - { - NPError nErr = (*pShutdown)(); (void)nErr; - DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_Shutdown() failed!" ); - } - osl_unloadModule( m_hPlugLib ); - } - if( m_xBundle ) - CFRelease( m_xBundle ); -} - -//-------------------------------------------------------------------------------------------------- -sal_Bool MacPluginComm::retrieveFunction( const char* i_pName, void** o_ppFunc ) const -{ - if( ! m_hPlugLib || ! o_ppFunc ) - return sal_False; - - *o_ppFunc = (void*)osl_getAsciiFunctionSymbol( m_hPlugLib, i_pName ); - - if( ! *o_ppFunc && m_xBundle ) - { - rtl::OUString aName( OUString::createFromAscii( *i_pName == '_' ? i_pName+1 : i_pName ) ); - CFStringRef xName = createString( aName ); - if( xName ) - { - *o_ppFunc = CFBundleGetFunctionPointerForName( m_xBundle, xName ); - CFRelease( xName ); - } - } - - return (*o_ppFunc != NULL); -} - -IMPL_LINK( MacPluginComm, NullTimerHdl, void*, EMPTYARG ) -{ - // note: this is a Timer handler, we are already protected by the SolarMutex - - FakeEventRecord aRec; - aRec.what = nullEvent; - aRec.where.h = aRec.where.v = 20000; - - for( std::list< XPlugin_Impl* >::iterator it = m_aNullEventClients.begin(); - it != m_aNullEventClients.end(); ++it ) - { - SysPlugData& rPlugData( (*it)->getSysPlugData() ); - if( rPlugData.m_pPlugView ) // for safety do not dispatch null events before first NPP_SetWindow - (*m_aNPPfuncs.event)( (*it)->getNPPInstance(), &aRec ); - } - - return 0; -} - -//-------------------------------------------------------------------------------------------------- - -long MacPluginComm::doIt() -{ - long nRet = 0; - switch( m_eCall ) - { - case eNP_Initialize: - { - TRACE( "eNP_Initialize" ); - NPError (*pInit)( NPNetscapeFuncs* ); - if( retrieveFunction( "NP_Initialize", (void**)&pInit ) ) - { - nRet = (*pInit)( &aNPNFuncs ); - - NPError nErr = NPERR_NO_ERROR; - NPError (*pEntry)( NPPluginFuncs* ); - retrieveFunction( "NP_GetEntryPoints", (void**)&pEntry ); - nErr = (*pEntry)( &m_aNPPfuncs ); - - DBG_ASSERT( nErr == NPERR_NO_ERROR, "NP_GetEntryPoints() failed!" ); - } - else - { - nRet = NPERR_GENERIC_ERROR; - } - DBG_ASSERT( nRet == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); - } - break; - case eNPP_Destroy: - if( m_aNullEventClients.empty() ) - delete m_pNullTimer, m_pNullTimer = NULL; - - TRACE( "eNPP_Destroy" ); - nRet = (m_aNPPfuncs.destroy - ? (*m_aNPPfuncs.destroy)( - (NPP)m_aArgs[0], - (NPSavedData**)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_DestroyStream: - TRACE( "eNPP_DestroyStream" ); - nRet = (m_aNPPfuncs.destroystream - ? (*m_aNPPfuncs.destroystream)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (NPError)(sal_IntPtr)m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_New: - TRACE( "eNPP_New" ); - nRet = (m_aNPPfuncs.newp - ? (*m_aNPPfuncs.newp)( - (NPMIMEType)m_aArgs[0], - (NPP)m_aArgs[1], - (uint16)(sal_IntPtr)m_aArgs[2], - (int16)(sal_IntPtr)m_aArgs[3], - (char**)m_aArgs[4], - (char**)m_aArgs[5], - (NPSavedData*)m_aArgs[6] ) - : NPERR_GENERIC_ERROR); - - if( ! m_pNullTimer && m_aNPPfuncs.event ) - { - m_pNullTimer = new AutoTimer(); - m_pNullTimer->SetTimeout( 50 ); - m_pNullTimer->SetTimeoutHdl( LINK( this, MacPluginComm, NullTimerHdl ) ); - m_pNullTimer->Start(); - } - - break; - case eNPP_NewStream: - TRACE( "eNPP_NewStream" ); - nRet = (m_aNPPfuncs.newstream - ? (*m_aNPPfuncs.newstream)( - (NPP)m_aArgs[0], - (NPMIMEType)m_aArgs[1], - (NPStream*)m_aArgs[2], - (NPBool)(sal_IntPtr)m_aArgs[3], - (uint16*)m_aArgs[4] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Print: - TRACE( "eNPP_Print" ); - if (m_aNPPfuncs.print) - (*m_aNPPfuncs.print)( - (NPP)m_aArgs[0], - (NPPrint*)m_aArgs[1] ); - break; - case eNPP_SetWindow: - { - TRACE( "eNPP_SetWindow" ); - nRet = (m_aNPPfuncs.setwindow - ? (*m_aNPPfuncs.setwindow)( - (NPP)m_aArgs[0], - (NPWindow*)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - - break; - } - case eNPP_HandleEvent: - { - TRACE( "eNPP_HandleEvent" ); - nRet = (m_aNPPfuncs.event - ? (*m_aNPPfuncs.event)( - (NPP)m_aArgs[0], - m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - - break; - } - case eNPP_StreamAsFile: - TRACE( "eNPP_StreamAsFile" ); - if (m_aNPPfuncs.asfile) - (*m_aNPPfuncs.asfile)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (char*)m_aArgs[2] ); - break; - case eNPP_URLNotify: - TRACE( "eNPP_URLNotify" ); - if (m_aNPPfuncs.urlnotify) - (*m_aNPPfuncs.urlnotify)( - (NPP)m_aArgs[0], - (char*)m_aArgs[1], - (NPReason)(sal_IntPtr)m_aArgs[2], - m_aArgs[3] ); - break; - case eNPP_Write: - TRACEN( "eNPP_Write n=", (int32)m_aArgs[3] ); - nRet = (m_aNPPfuncs.write - ? (*m_aNPPfuncs.write)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (int32)m_aArgs[2], - (int32)m_aArgs[3], - m_aArgs[4] ) - : 0); - break; - case eNPP_WriteReady: - TRACE( "eNPP_WriteReady" ); - nRet = (m_aNPPfuncs.writeready - ? (*m_aNPPfuncs.writeready)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1] ) - : 0); - break; - case eNPP_GetValue: - TRACE( "eNPP_GetValue" ); - nRet = (m_aNPPfuncs.getvalue - ? (*m_aNPPfuncs.getvalue)( - (NPP)m_aArgs[0], - (NPPVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_SetValue: - TRACE( "eNPP_SetValue" ); - nRet = (m_aNPPfuncs.setvalue - ? (*m_aNPPfuncs.setvalue)( - (NPP)m_aArgs[0], - (NPNVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Shutdown: - { - TRACE( "eNPP_Shutdown" ); - NPP_ShutdownUPP pFunc; - if (retrieveFunction( "NPP_Shutdown", (void**)&pFunc )) - (*pFunc)(); - } - break; - case eNPP_Initialize: - TRACE( "eNPP_Initialize" ); - OSL_FAIL( "NPP_Initialize: not implemented!" ); - break; - case eNPP_GetJavaClass: - TRACE( "eNPP_GetJavaClass" ); - OSL_FAIL( "NPP_GetJavaClass: not implemented!" ); - break; - } - return nRet; -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save ) -{ - // remove from NullEvent timer - m_aNullEventClients.remove( i_pImpl ); - - NPError nErr = NPP_Destroy( i_pImpl->getNPPInstance(), save ); - - // release plugin view - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - if( rPlugData.m_pPlugView ) - { - [rPlugData.m_pPlugView removeFromSuperview]; - [rPlugData.m_pPlugView release]; - rPlugData.m_pPlugView = nil; - } - - return nErr; -} - - -NPError MacPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - DBG_ASSERT( m_aNPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Destroy; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)save; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - DBG_ASSERT( m_aNPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_DestroyStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)reason; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - DBG_ASSERT( pImpl, "no instance found" ); - - if( pImpl ) // sanity check - m_aNullEventClients.push_back( pImpl ); - - DBG_ASSERT( m_aNPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" ); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "NPP_New( %s. %p, %d, %d", - pluginType, instance, (int)mode, (int)argc ); - for( int16 i = 0; i < argc; i++ ) - fprintf( stderr, "\n%s = %s", argn[i], argv[i] ); - fprintf( stderr, ", %p )\n", saved ); - #endif - m_eCall = eNPP_New; - m_aArgs[0] = (void*)pluginType; - m_aArgs[1] = (void*)instance; - m_aArgs[2] = (void*)mode; - m_aArgs[3] = (void*)argc; - m_aArgs[4] = (void*)argn; - m_aArgs[5] = (void*)argv; - m_aArgs[6] = (void*)saved; - - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype ) -{ - DBG_ASSERT( m_aNPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_NewStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)type; - m_aArgs[2] = (void*)stream; - m_aArgs[3] = (void*)seekable; - m_aArgs[4] = (void*)stype; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void MacPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint ) -{ - DBG_ASSERT( m_aNPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Print; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)platformPrint; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - DBG_ASSERT( m_aNPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetWindow; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)window; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_HandleEvent( NPP instance, void* event ) -{ - DBG_ASSERT( m_aNPPfuncs.event, "### NPP_HandleEvent(): null pointer in NPP functions table!" ); - m_eCall = eNPP_HandleEvent; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = event; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void MacPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - DBG_ASSERT( m_aNPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" ); - m_eCall = eNPP_StreamAsFile; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)fname; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -void MacPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) -{ - DBG_ASSERT( m_aNPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" ); - m_eCall = eNPP_URLNotify; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)url; - m_aArgs[2] = (void*)reason; - m_aArgs[3] = notifyData; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -int32 MacPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer ) -{ - DBG_ASSERT( m_aNPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Write; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)offset; - m_aArgs[3] = (void*)len; - m_aArgs[4] = buffer; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -int32 MacPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - DBG_ASSERT( m_aNPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" ); - m_eCall = eNPP_WriteReady; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - return execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ) -{ - DBG_ASSERT( m_aNPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_GetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = ret_value; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_SetValue( NPP instance, NPNVariable variable, void *set_value ) -{ - DBG_ASSERT( m_aNPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = set_value; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void * MacPluginComm::NPP_GetJavaClass() -{ - OSL_FAIL( "no java class available!" ); - return 0; -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_Initialize() -{ - return NPERR_NO_ERROR; -} - -//-------------------------------------------------------------------------------------------------- -void MacPluginComm::NPP_Shutdown() -{ - m_eCall = eNPP_Shutdown; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError MacPluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl ) -{ - // update window NPWindow from view - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - - // update plug view - NSRect aPlugRect = [rPlugData.m_pParentView frame]; - aPlugRect.origin.x = aPlugRect.origin.y = 0; - if( ! rPlugData.m_pPlugView ) - { - rPlugData.m_pPlugView = [[OOoPluginView alloc] initWithInstance: i_pImpl pluginComm: this frame: aPlugRect]; - [rPlugData.m_pParentView addSubview: rPlugData.m_pPlugView]; - } - else - [rPlugData.m_pPlugView setFrame: aPlugRect]; - - NPWindow* pNPWin = i_pImpl->getNPWindow(); - NSWindow* pWin = [rPlugData.m_pPlugView window]; - NSRect aWinRect = [pWin frame]; - NSRect aBounds = [rPlugData.m_pPlugView frame]; - NSRect aVisibleBounds = [rPlugData.m_pPlugView visibleRect]; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "visible bounds = %d+%d+%dx%d\n", - (int)aVisibleBounds.origin.x, (int)aVisibleBounds.origin.y, - (int)aVisibleBounds.size.width, (int)aVisibleBounds.size.height ); - #endif - - NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil]; - // save view origin so we can notice movement of the view in drawView - // in case of a moved view we need to reset the port/context - rPlugData.m_aLastPlugViewOrigin = aViewOrigin; - - // convert view origin to topdown coordinates - aViewOrigin.y = aWinRect.size.height - aViewOrigin.y; - - // same for clipping - NSPoint aClipOrigin = [rPlugData.m_pPlugView convertPoint: aVisibleBounds.origin toView: nil]; - aClipOrigin.y = aWinRect.size.height - aClipOrigin.y; - - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "view origin: %d+%d, clip origin = %d+%d\n", - (int)aViewOrigin.x, (int)aViewOrigin.y, - (int)aClipOrigin.x, (int)aClipOrigin.y ); - #endif - - pNPWin->x = aViewOrigin.x; - pNPWin->y = aViewOrigin.y; - pNPWin->width = aBounds.size.width; - pNPWin->height = aBounds.size.height; - pNPWin->clipRect.left = aClipOrigin.x; - pNPWin->clipRect.top = aClipOrigin.y; - pNPWin->clipRect.right = aClipOrigin.x + aVisibleBounds.size.width; - pNPWin->clipRect.bottom = aClipOrigin.y + aVisibleBounds.size.height; - - if( rPlugData.m_nDrawingModel == 1 ) - { - rPlugData.m_aCGContext.window = reinterpret_cast([pWin windowRef]); - pNPWin->window = &rPlugData.m_aCGContext; - rPlugData.m_aCGContext.context = reinterpret_cast([[pWin graphicsContext] graphicsPort]); - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "window is %p, context is %p\n", - rPlugData.m_aCGContext.window, rPlugData.m_aCGContext.context ); - #endif - } - else - { - rPlugData.m_aNPPort.port = GetWindowPort( reinterpret_cast([pWin windowRef]) ); - rPlugData.m_aNPPort.portx = aClipOrigin.x; - rPlugData.m_aNPPort.porty = aClipOrigin.y; - pNPWin->window = &rPlugData.m_aNPPort; - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "port is %p at (%d,%d)\n", - rPlugData.m_aNPPort.port, (int)rPlugData.m_aNPPort.portx, (int)rPlugData.m_aNPPort.porty ); - #endif - } - - if( pNPWin->width == 0 || pNPWin->height == 0 || [rPlugData.m_pPlugView isHiddenOrHasHiddenAncestor] ) - rPlugData.m_bSetWindowOnDraw = true; - - NPError nErr = NPP_SetWindow( i_pImpl->getNPPInstance(), i_pImpl->getNPWindow() ); - - return nErr; -} - -void MacPluginComm::drawView( XPlugin_Impl* i_pImpl ) -{ - SysPlugData& rPlugData( i_pImpl->getSysPlugData() ); - - // check if the view was moved since the last SetWindow - NSPoint aViewOrigin = [rPlugData.m_pPlugView convertPoint: NSZeroPoint toView: nil]; - if( rPlugData.m_bSetWindowOnDraw || - aViewOrigin.x != rPlugData.m_aLastPlugViewOrigin.x || - aViewOrigin.y != rPlugData.m_aLastPlugViewOrigin.y ) - { - NPP_SetWindow( i_pImpl ); - rPlugData.m_bSetWindowOnDraw = false; - } - - // send a paint event - NSWindow* pWin = [rPlugData.m_pPlugView window]; - FakeEventRecord aRec; - aRec.what = updateEvt; - aRec.message = (UInt32)[pWin windowRef]; - this->NPP_HandleEvent( i_pImpl->getNPPInstance(), &aRec ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx deleted file mode 100644 index bf5f95400..000000000 --- a/extensions/source/plugin/base/context.cxx +++ /dev/null @@ -1,354 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include -#include - -#include - -#include -#include -#include -#include - -#include - -using namespace com::sun::star::io; - -namespace ext_plug { - -class FileSink : public ::cppu::WeakAggImplHelper1< ::com::sun::star::io::XOutputStream > -{ -private: - Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; - FILE* fp; - Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; - ::rtl::OUString m_aMIMEType; - ::rtl::OUString m_aTarget; - ::rtl::OUString m_aFileName; - -public: - FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > &, - const Reference< ::com::sun::star::plugin::XPlugin > & plugin, - const ::rtl::OUString& mimetype, - const ::rtl::OUString& target, - const Reference< ::com::sun::star::io::XActiveDataSource > & source ); - virtual ~FileSink(); - - // ::com::sun::star::io::XOutputStream - virtual void SAL_CALL writeBytes( const Sequence& ) throw(); - virtual void SAL_CALL flush() throw(); - virtual void SAL_CALL closeOutput() throw(); -}; - -} -using namespace ext_plug; - -class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginContext > -{ - Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr; - rtl_TextEncoding m_aEncoding; -public: - - XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); - virtual ~XPluginContext_Impl(); - - - virtual ::rtl::OUString SAL_CALL getValue(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL newStream(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual void SAL_CALL displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); - virtual ::rtl::OUString SAL_CALL getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin) throw( ::com::sun::star::plugin::PluginException, RuntimeException ); -}; - -Reference< ::com::sun::star::plugin::XPluginContext > XPluginManager_Impl::createPluginContext() throw() -{ - return new XPluginContext_Impl( m_xSMgr ); -} - -XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) - : m_xSMgr( rSMgr ), - m_aEncoding( gsl_getSystemTextEncoding() ) -{ -} - -XPluginContext_Impl::~XPluginContext_Impl() -{ -} - -::rtl::OUString XPluginContext_Impl::getValue( const Reference< ::com::sun::star::plugin::XPlugin > & /*plugin*/, ::com::sun::star::plugin::PluginVariable /*variable*/ ) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - return ::rtl::OUString(); -} - - -void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ); - if( ! xInst.is() ) - return; - - if( ! target.getLength() ) - { - INetURLObject aURL; - aURL.SetSmartProtocol( INET_PROT_FILE ); - aURL.SetSmartURL( ::rtl::OUStringToOString( url, m_aEncoding ) ); - - rtl::OUString aUrl = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); - // the mimetype cannot be specified - plugin->provideNewStream( ::rtl::OUString(), - Reference< XActiveDataSource >(), - aUrl, - 0, 0, (sal_Bool)(aUrl.compareToAscii( "file:", 5 ) == 0) ); - return; - } - - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - - if( xLoader.is() && pPlugin ) - { - try - { - ::com::sun::star::beans::PropertyValue aValue; - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); - aValue.Value <<= pPlugin->getRefererURL(); - - Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 ); - Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( - url, - target, - ::com::sun::star::frame::FrameSearchFlag::PARENT | - ::com::sun::star::frame::FrameSearchFlag::SELF | - ::com::sun::star::frame::FrameSearchFlag::CHILDREN | - ::com::sun::star::frame::FrameSearchFlag::SIBLINGS | - ::com::sun::star::frame::FrameSearchFlag::TASKS | - ::com::sun::star::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch(...) - { - throw ::com::sun::star::plugin::PluginException(); - } - } -} - -void XPluginContext_Impl::getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener ) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - getURL( plugin, url, target ); - if( listener.is() ) - listener->disposing( ::com::sun::star::lang::EventObject() ); -} - -::rtl::OUString XPluginContext_Impl::getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & /*plugin*/) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Mozilla 3.0")); -} - -void XPluginContext_Impl::displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & /*plugin*/, const ::rtl::OUString& /*message*/) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ -} - -void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - Sequence< sal_Int8 > aBuf; - - if( file ) - { - String aFileName( (char*)buf.getConstArray(), m_aEncoding ); - INetURLObject aFilePath( aFileName ); - aFileName = aFilePath.PathToFileName(); - SvFileStream aStream( aFileName, STREAM_READ ); - if( aStream.IsOpen() ) - { - int nBytes = 0; - aStream.Seek( STREAM_SEEK_TO_END ); - aBuf = Sequence( nBytes = aStream.Tell() ); - aStream.Seek( STREAM_SEEK_TO_BEGIN ); - aStream.Read( aBuf.getArray(), nBytes ); - aStream.Close(); - DirEntry( aFileName ).Kill(); - } - } - - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ); - if( ! xInst.is() ) - return ; - - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin ); - if( xLoader.is() && pPlugin ) - { - try - { - ::com::sun::star::beans::PropertyValue aValues[2]; - aValues[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); - aValues[0].Value <<= pPlugin->getRefererURL(); - - aValues[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PostString")); - aValues[1].Value <<= ::rtl::OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding ); - Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 ); - Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( - url, - target, - ::com::sun::star::frame::FrameSearchFlag::PARENT | - ::com::sun::star::frame::FrameSearchFlag::SELF | - ::com::sun::star::frame::FrameSearchFlag::CHILDREN | - ::com::sun::star::frame::FrameSearchFlag::SIBLINGS | - ::com::sun::star::frame::FrameSearchFlag::TASKS | - ::com::sun::star::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch( ... ) - { - throw ::com::sun::star::plugin::PluginException(); - } - } -} - -void XPluginContext_Impl::postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener ) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - postURL( plugin, url, target, buf, file ); - if( listener.is() ) - listener->disposing( ::com::sun::star::lang::EventObject() ); -} - -void XPluginContext_Impl::newStream( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) - throw( ::com::sun::star::plugin::PluginException, RuntimeException ) -{ - FileSink* pNewSink = new FileSink( m_xSMgr, plugin, mimetype, target, source ); - pNewSink->acquire(); -} - - - -FileSink::FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, const Reference< ::com::sun::star::plugin::XPlugin > & plugin, - const ::rtl::OUString& mimetype, - const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) : - m_xSMgr( rSMgr ), - m_xPlugin( plugin ), - m_aMIMEType( mimetype ), - m_aTarget( target ) -{ - DirEntry aEntry; - m_aFileName = aEntry.TempName().GetFull(); - ::rtl::OString aFile = ::rtl::OUStringToOString( m_aFileName, gsl_getSystemTextEncoding() ); - fp = fopen( aFile.getStr() , "wb" ); - - Reference< ::com::sun::star::io::XActiveDataControl > xControl( source, UNO_QUERY ); - - source->setOutputStream( Reference< ::com::sun::star::io::XOutputStream > ( this ) ); - if( xControl.is() ) - xControl->start(); -} - -FileSink::~FileSink() -{ - DirEntry aEntry( m_aFileName ); - aEntry.Kill(); -} - -void FileSink::closeOutput() throw() -{ - if( fp ) - fclose( fp ); - - Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ); - Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY ); - XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin ); - - if( xLoader.is() && pPlugin ) - { - try - { - ::com::sun::star::beans::PropertyValue aValue; - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); - aValue.Value <<= pPlugin->getRefererURL(); - - Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 ); - Reference< ::com::sun::star::lang::XComponent > xComp = - xLoader->loadComponentFromURL( - m_aFileName, - m_aTarget, - ::com::sun::star::frame::FrameSearchFlag::PARENT | - ::com::sun::star::frame::FrameSearchFlag::SELF | - ::com::sun::star::frame::FrameSearchFlag::CHILDREN | - ::com::sun::star::frame::FrameSearchFlag::SIBLINGS | - ::com::sun::star::frame::FrameSearchFlag::TASKS | - ::com::sun::star::frame::FrameSearchFlag::CREATE, - aArgs - ); - } - catch( ... ) - { - } - } - release(); -} - -void FileSink::writeBytes( const Sequence& Buffer ) throw() -{ - if( fp ) - fwrite( Buffer.getConstArray(), 1, Buffer.getLength(), fp ); -} - -void FileSink::flush() throw() -{ - if( fp ) - fflush( fp ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/evtlstnr.cxx b/extensions/source/plugin/base/evtlstnr.cxx deleted file mode 100644 index b566f9117..000000000 --- a/extensions/source/plugin/base/evtlstnr.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include - -#include - -PluginEventListener::PluginEventListener( XPlugin_Impl* pPlugin, - const char* url, - const char* normurl, - void* notifyData ) : - m_pPlugin( pPlugin ), - m_xPlugin( pPlugin ), - m_pUrl( strdup( url ) ), - m_pNormalizedUrl( strdup( normurl ) ), - m_pNotifyData( notifyData ) -{ -} - -PluginEventListener::~PluginEventListener() -{ - if( m_pUrl ) - free( m_pUrl ); - if( m_pNormalizedUrl ) - free( m_pNormalizedUrl ); -} - -void PluginEventListener::disposing( const ::com::sun::star::lang::EventObject& /*rEvt*/ ) throw() -{ - m_pPlugin->getPluginComm()-> - NPP_URLNotify( m_pPlugin->getNPPInstance(), - m_pUrl, - NPRES_DONE, - m_pNotifyData ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/makefile.mk b/extensions/source/plugin/base/makefile.mk deleted file mode 100644 index 3049d9e9c..000000000 --- a/extensions/source/plugin/base/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=plbase -TARGETTYPE=GUI -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : ..$/util$/makefile.pmk - -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin -.IF "$(SOLAR_JAVA)" != "" -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr -CDEFS+=-DOJI -.ENDIF - -.IF "$(WITH_MOZILLA)" != "NO" - -.IF "$(GUIBASE)"=="aqua" -CFLAGSCXX+=$(OBJCXXFLAGS) -.ENDIF # "$(GUIBASE)"=="aqua" - -SLOFILES= \ - $(SLO)$/plctrl.obj \ - $(SLO)$/service.obj \ - $(SLO)$/xplugin.obj \ - $(SLO)$/nfuncs.obj \ - $(SLO)$/manager.obj \ - $(SLO)$/context.obj \ - $(SLO)$/evtlstnr.obj \ - $(SLO)$/plcom.obj \ - $(SLO)$/multiplx.obj \ - $(SLO)$/plmodel.obj - -.ENDIF # $(WITH_MOZILLA) != "NO" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx deleted file mode 100644 index 2806ee4cf..000000000 --- a/extensions/source/plugin/base/manager.cxx +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include - -#include "plugin/impl.hxx" - -#include "osl/mutex.hxx" -#include "unotools/pathoptions.hxx" -#include "vcl/configsettings.hxx" - -#include "com/sun/star/container/XEnumerationAccess.hpp" -#include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/container/XEnumeration.hpp" -#include "com/sun/star/container/XElementAccess.hpp" -#include "com/sun/star/container/XIndexAccess.hpp" -#include "com/sun/star/loader/XImplementationLoader.hpp" -#include "com/sun/star/loader/CannotActivateFactoryException.hpp" - -PluginManager* PluginManager::pManager = NULL; - -PluginManager& PluginManager::get() -{ - if( ! pManager ) - pManager = new PluginManager(); - return *pManager; -} - -void PluginManager::setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) -{ - PluginManager& rManager = get(); - if( ! rManager.m_xSMgr.is() ) - rManager.m_xSMgr = xFactory; -} - -PluginManager::PluginManager() -{ -} - -const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths() -{ - static Sequence< ::rtl::OUString > aPaths; - - if( ! aPaths.getLength() ) - { - SvtPathOptions aOptions; - String aPluginPath( aOptions.GetPluginPath() ); - if( aPluginPath.Len() ) - { - sal_uInt16 nPaths = aPluginPath.GetTokenCount( ';' ); - aPaths.realloc( nPaths ); - for( sal_uInt16 i = 0; i < nPaths; i++ ) - aPaths.getArray()[i] = aPluginPath.GetToken( i, ';' ); - } - } - - return aPaths; -} - -//================================================================================================== -Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( Exception ) -{ - Reference< XInterface > xService = *new XPluginManager_Impl( rSMgr ); - return xService; -} - -// ::com::sun::star::lang::XServiceInfo -::rtl::OUString XPluginManager_Impl::getImplementationName() throw( ) - -{ - return getImplementationName_Static(); - -} - -// ::com::sun::star::lang::XServiceInfo -sal_Bool XPluginManager_Impl::supportsService(const ::rtl::OUString& ServiceName) throw( ) -{ - Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames(); - const ::rtl::OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -// ::com::sun::star::lang::XServiceInfo -Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames(void) throw( ) -{ - return getSupportedServiceNames_Static(); -} - -// XPluginManager_Impl -Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames_Static(void) throw( ) -{ - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginManager")); - return aSNS; -} - -XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) -: m_xSMgr( rSMgr ) -{ - PluginManager::setServiceFactory( rSMgr ); -} - -XPluginManager_Impl::~XPluginManager_Impl() -{ -} - -XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance ) -{ - ::std::list::iterator iter; - for( iter = PluginManager::get().getPlugins().begin(); - iter != PluginManager::get().getPlugins().end(); ++iter ) - { - if( (*iter)->getNPPInstance() == instance ) - return *iter; - } - - return NULL; -} - -XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin ) -{ - ::std::list::iterator iter; - for( iter = PluginManager::get().getPlugins().begin(); - iter != PluginManager::get().getPlugins().end(); ++iter ) - { - if( plugin == Reference< ::com::sun::star::plugin::XPlugin >((*iter)) ) - return *iter; - } - - return NULL; -} - -Sequence XPluginManager_Impl::getPluginDescriptions() throw() -{ - Sequence aRet; - - vcl::SettingsConfigItem* pCfg = vcl::SettingsConfigItem::get(); - rtl::OUString aVal( pCfg->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowserPlugins" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Disabled" ) ) ) ); - if( ! aVal.toBoolean() ) - { - aRet = impl_getPluginDescriptions(); - } - return aRet; -} - -Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype) - throw( RuntimeException,::com::sun::star::plugin::PluginException ) -{ - XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr ); - pImpl->setPluginContext( acontext ); - - PluginManager::get().getPlugins().push_back( pImpl ); - - pImpl->initInstance( plugintype, - argn, - argv, - mode ); - - return pImpl; -} - -Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url ) throw() -{ - XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr ); - Reference< ::com::sun::star::plugin::XPlugin > xRef = pImpl; - - pImpl->setPluginContext( acontext ); - - PluginManager::get().getPlugins().push_back( pImpl ); - - - pImpl->initInstance( url, - argn, - argv, - mode ); - - pImpl->createPeer( toolkit, parent ); - - pImpl->provideNewStream( pImpl->getDescription().Mimetype, - Reference< com::sun::star::io::XActiveDataSource >(), - url, - 0, 0, (sal_Bool)(url.compareToAscii( "file:", 5 ) == 0) ); - - if( ! pImpl->getPluginComm() ) - { - pImpl->dispose(); - xRef = NULL; - } - - return xRef; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/multiplx.cxx b/extensions/source/plugin/base/multiplx.cxx deleted file mode 100644 index a9890e57b..000000000 --- a/extensions/source/plugin/base/multiplx.cxx +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include - -// --------------------------------------------------------------------- -// class MRCListenerMultiplexerHelper -// --------------------------------------------------------------------- -MRCListenerMultiplexerHelper::MRCListenerMultiplexerHelper -( - const Reference< ::com::sun::star::awt::XWindow > & rControl - , const Reference< ::com::sun::star::awt::XWindow > & rPeer -) - : xPeer( rPeer ) - , xControl( Reference< ::com::sun::star::awt::XControl >( rControl, UNO_QUERY ) ) - , aListenerHolder( aMutex ) -{ -} - - -void MRCListenerMultiplexerHelper::setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer ) -{ - ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - if( xPeer != rPeer ) - { - if( xPeer.is() ) - { - // get all uiks from the listener added to the peer - Sequence aContainedTypes = aListenerHolder.getContainedTypes(); - const Type* pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); - // loop over all listener types and remove the listeners from the peer - for( sal_Int32 i = 0; i < nCount; i++ ) - unadviseFromPeer( xPeer, pArray[i] ); - } - xPeer = rPeer; - if( xPeer.is() ) - { - // get all uiks from the listener added to the peer - Sequence aContainedTypes = aListenerHolder.getContainedTypes(); - const Type * pArray = aContainedTypes.getConstArray(); - sal_Int32 nCount = aContainedTypes.getLength(); - // loop over all listener types and add the listeners to the peer - for( sal_Int32 i = 0; i < nCount; i++ ) - adviseToPeer( xPeer, pArray[i] ); - } - } -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::disposeAndClear() -{ - ::com::sun::star::lang::EventObject aEvt; - aEvt.Source = xControl; - aListenerHolder.disposeAndClear( aEvt ); -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type ) -{ - // add a listener to the source (peer) - if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) ) - rPeer->addWindowListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) ) - rPeer->addKeyListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) ) - rPeer->addFocusListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) ) - rPeer->addMouseListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) ) - rPeer->addMouseMotionListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) ) - rPeer->addPaintListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) ) - { - Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->addTopWindowListener( this ); - } - else - { - OSL_FAIL( "unknown listener" ); - } -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type ) -{ - // the last listener is removed, remove the listener from the source (peer) - if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) ) - rPeer->removeWindowListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) ) - rPeer->removeKeyListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) ) - rPeer->removeFocusListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) ) - rPeer->removeMouseListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) ) - rPeer->removeMouseMotionListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) ) - rPeer->removePaintListener( this ); - else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) ) - { - Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY ); - if( xTop.is() ) - xTop->removeTopWindowListener( this ); - } - else - { - OSL_FAIL( "unknown listener" ); - } -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::advise( const Type & type, const Reference< XInterface > & listener) -{ - ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - if( 1 == aListenerHolder.addInterface( type, listener ) ) - { - // the first listener is added - if( xPeer.is() ) - adviseToPeer( xPeer, type ); - } -} - -// MRCListenerMultiplexerHelper -void MRCListenerMultiplexerHelper::unadvise(const Type & type, const Reference< XInterface > & listener) -{ - ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - ::cppu::OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( type ); - if( pCont ) - { - if( 0 == pCont->removeInterface( listener ) && xPeer.is() ) - // the last listener is removed - unadviseFromPeer( xPeer, type ); - } -} - -// ::com::sun::star::lang::XEventListener -void MRCListenerMultiplexerHelper::disposing(const ::com::sun::star::lang::EventObject& ) throw() -{ - ::osl::Guard< ::osl::Mutex > aGuard( aMutex ); - // peer is disposed, clear the reference - xPeer = Reference< ::com::sun::star::awt::XWindow > (); -} - -#define MULTIPLEX( InterfaceName, MethodName, EventName ) \ -::cppu::OInterfaceContainerHelper * pCont; \ -pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< InterfaceName >*)0) ); \ -if( pCont ) \ -{ \ - ::cppu::OInterfaceIteratorHelper aIt( *pCont ); \ - EventName aEvt = e; \ - /* Remark: The control is the event source not the peer. We must change */ \ - /* the source of the event */ \ - aEvt.Source = xControl;\ - /*.is the control not destroyed */ \ - if( aEvt.Source.is() ) \ - { \ - if( aIt.hasMoreElements() ) \ - { \ - InterfaceName * pListener = (InterfaceName *)aIt.next(); \ - try \ - { \ - pListener->MethodName( aEvt ); \ - } \ - catch( RuntimeException& ) \ - { \ - /* ignore all usr system exceptions from the listener */ \ - } \ - } \ - } \ -} - -// ::com::sun::star::awt::XFocusListener -void MRCListenerMultiplexerHelper::focusGained(const ::com::sun::star::awt::FocusEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent ) -} - -// ::com::sun::star::awt::XFocusListener -void MRCListenerMultiplexerHelper::focusLost(const ::com::sun::star::awt::FocusEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent ) -} - -// ::com::sun::star::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowResized(const ::com::sun::star::awt::WindowEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent ) -} - -// ::com::sun::star::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowMoved(const ::com::sun::star::awt::WindowEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent ) -} - -// ::com::sun::star::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowShown(const ::com::sun::star::lang::EventObject& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XWindowListener -void MRCListenerMultiplexerHelper::windowHidden(const ::com::sun::star::lang::EventObject& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XKeyListener -void MRCListenerMultiplexerHelper::keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent ) -} - -// ::com::sun::star::awt::XKeyListener -void MRCListenerMultiplexerHelper::keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent ) -} - -// ::com::sun::star::awt::XMouseListener -void MRCListenerMultiplexerHelper::mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XMouseListener -void MRCListenerMultiplexerHelper::mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XMouseMotionListener -void MRCListenerMultiplexerHelper::mouseDragged(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XMouseMotionListener -void MRCListenerMultiplexerHelper::mouseMoved(const ::com::sun::star::awt::MouseEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent ) -} - -// ::com::sun::star::awt::XPaintListener -void MRCListenerMultiplexerHelper::windowPaint(const ::com::sun::star::awt::PaintEvent& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowOpened(const ::com::sun::star::lang::EventObject& e) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowClosing( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowActivated( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject ) -} - -// ::com::sun::star::awt::XTopWindowListener -void MRCListenerMultiplexerHelper::windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw() -{ - MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject ) -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx deleted file mode 100644 index 0d50bcf1c..000000000 --- a/extensions/source/plugin/base/nfuncs.cxx +++ /dev/null @@ -1,675 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include -#include - -#include -#include - -#if OSL_DEBUG_LEVEL > 1 -#include -#include -static FILE * s_file = 0; -void TRACE( char const * s ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl_getThreadIdentifier(0); - fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s\n", t, s ); - fflush( s_file ); - } -} -void TRACEN( char const * s, long n ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl_getThreadIdentifier(0); - fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s%ld\n", t, s, n ); - fflush( s_file ); - } -} -void TRACES( char const* s, char const* s2 ) -{ - if (! s_file) - s_file = stderr; - if (s_file) - { - oslThreadIdentifier t = osl_getThreadIdentifier(0); - fprintf( s_file, "log [t_id=%"SAL_PRIuUINT32"]: %s %s\n", t, s, s2 ); - fflush( s_file ); - } -} -#else -#define TRACE(x) -#define TRACEN(x,n) -#define TRACES(x,s) -#endif - -using namespace com::sun::star::lang; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringToOUString; - -NPNetscapeFuncs aNPNFuncs = -{ - sizeof( NPNetscapeFuncs ), - (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR, - NPN_GetURL, - NPN_PostURL, - NPN_RequestRead, - NPN_NewStream, - NPN_Write, - NPN_DestroyStream, - NPN_Status, - NPN_UserAgent, - NPN_MemAlloc, - NPN_MemFree, - NPN_MemFlush, - NPN_ReloadPlugins, -#ifdef OJI - NPN_GetJavaEnv, - NPN_GetJavaPeer, -#else - 0, - 0, -#endif - NPN_GetURLNotify, - NPN_PostURLNotify, - NPN_GetValue, - NPN_SetValue, - NPN_InvalidateRect, - NPN_InvalidateRegion, - NPN_ForceRedraw -}; - -static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url ) -{ - ::rtl::OString aLoadURL; - if( url.indexOf( ":" ) == -1 ) - { - aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() ); - int nPos; - if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 ) - { - if( url.getLength() && (url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1) ) - { - // this means same server but new path - nPos = aLoadURL.indexOf( '/', nPos+3 ); - - if( nPos != -1 ) - aLoadURL = aLoadURL.copy( 0, url.getStr()[0] == '/' ? nPos : nPos+1 ); - } - else - { - // same server but new file - nPos = aLoadURL.lastIndexOf( '/' ); - aLoadURL = aLoadURL.copy( 0, nPos+1 ); - } - aLoadURL += url; - } - else - aLoadURL = url; - } - else if( url.indexOf( ":/" ) != -1 ) - aLoadURL = url; - - return aLoadURL; -} - -struct AsynchronousGetURL -{ - OUString aUrl; - OUString aTarget; - Reference< XEventListener > xListener; - - DECL_LINK( getURL, XPlugin_Impl* ); -}; - -IMPL_LINK( AsynchronousGetURL, getURL, XPlugin_Impl*, pImpl ) -{ - try - { - pImpl->enterPluginCallback(); - if( xListener.is() ) - pImpl->getPluginContext()-> - getURLNotify( pImpl, - aUrl, - aTarget, - xListener ); - else - pImpl->getPluginContext()-> - getURL( pImpl, - aUrl, - aTarget ); - } - catch( ::com::sun::star::plugin::PluginException& e ) - { - (void)e; - } - pImpl->leavePluginCallback(); - delete this; - return 0; -} - - -extern "C" { - - void* SAL_CALL NP_LOADDS NPN_MemAlloc( uint32 nBytes ) - { - TRACE( "NPN_MemAlloc" ); - void* pMem = malloc( nBytes ); - return pMem; - } - - void SAL_CALL NP_LOADDS NPN_MemFree( void* pMem ) - { - TRACE( "NPN_MemFree" ); - free( pMem ); - } - - uint32 SAL_CALL NP_LOADDS NPN_MemFlush( uint32 /*nSize*/ ) - { - TRACE( "NPN_MemFlush" ); - return 0; - } - - NPError SAL_CALL NP_LOADDS NPN_DestroyStream( NPP instance, NPStream* stream, NPError /*reason*/ ) - { - TRACE( "NPN_DestroyStream" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - PluginStream* pStream = pImpl->getStreamFromNPStream( stream ); - if( pStream ) - { - if( pStream->getStreamType() == InputStream ) - static_cast(pStream)->releaseSelf(); - else - delete pStream; - } - - return NPERR_NO_ERROR; - } - - #ifdef OJI - const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv() - { - TRACE( "NPN_GetJavaEnv" ); - // no java in this program - return NULL; - } - - jref SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP /*instance*/ ) - { - TRACE( "NPN_GetJavaPeer" ); - return NULL; - } - #endif - - NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window ) - { - TRACES( "NPN_GetURL", url ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - AsynchronousGetURL* pAsync = new AsynchronousGetURL(); - - OString aLoadURL = normalizeURL( pImpl, url ); - TRACES( "NPN_GetURL", aLoadURL.getStr() ); - pAsync->aUrl = OStringToOUString( aLoadURL, pImpl->getTextEncoding() ); - pAsync->aTarget = OStringToOUString( window, pImpl->getTextEncoding() ); - pImpl->setLastGetUrl( aLoadURL ); - Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl ); - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_GetURLNotify( NPP instance, const char* url, const char* target, - void* notifyData ) - { - TRACES( "NPN_GetURLNotify", url ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - OString aLoadURL = normalizeURL( pImpl, url ); - if( !aLoadURL.getLength() ) - return NPERR_INVALID_URL; - - AsynchronousGetURL* pAsync = new AsynchronousGetURL(); - PluginEventListener* pListener = - new PluginEventListener( pImpl, url, aLoadURL.getStr(), notifyData ); - if( ! target || ! *target ) - { - // stream will be fed back to plugin, - // notify immediately after destruction of stream - pImpl->addPluginEventListener( pListener ); - pListener = NULL; - } - pAsync->aUrl = OStringToOUString( aLoadURL, pImpl->getTextEncoding() ); - pAsync->aTarget = OStringToOUString( target, pImpl->getTextEncoding() ); - pAsync->xListener = pListener; - pImpl->setLastGetUrl( aLoadURL ); - Application::PostUserEvent( LINK( pAsync, AsynchronousGetURL, getURL ), pImpl ); - - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_NewStream( NPP instance, NPMIMEType type, const char* target, - NPStream** stream ) - // stream is a return value - { - TRACE( "NPN_NewStream" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - PluginOutputStream* pStream = new PluginOutputStream( pImpl, - "", 0, 0 ); - *stream = pStream->getStream(); - - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - newStream( - pImpl, - ::rtl::OStringToOUString( type, pImpl->getTextEncoding () ), - ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ), - ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY ) - ); - pImpl->leavePluginCallback(); - } - catch( ::com::sun::star::plugin::PluginException& e ) - { - pImpl->leavePluginCallback(); - return e.ErrorCode; - } - - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData ) - { - TRACE( "NPN_PostURLNotify" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - ::com::sun::star::uno::Sequence Bytes( (sal_Int8*)buf, len ); - - ::rtl::OString aPostURL = normalizeURL( pImpl, url ); - PluginEventListener* pListener = - new PluginEventListener( pImpl, url, aPostURL.getStr(), notifyData ); - - if( ! target || ! *target ) - { - // stream will be fed back to plugin, - // notify immediately after destruction of stream - pImpl->addPluginEventListener( pListener ); - pListener = NULL; - } - - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - postURLNotify( pImpl, - ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ), - ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ), - Bytes, - file, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) ); - pImpl->leavePluginCallback(); - } - catch( ::com::sun::star::plugin::PluginException& e ) - { - pImpl->leavePluginCallback(); - return e.ErrorCode; - } - - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file ) - { - TRACE( "NPN_PostURL" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return NPERR_INVALID_INSTANCE_ERROR; - - ::com::sun::star::uno::Sequence Bytes( (sal_Int8*)buf, len ); - ::rtl::OString aPostURL = normalizeURL( pImpl, url ); - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - postURL( pImpl, - ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ), - ::rtl::OStringToOUString( window, pImpl->getTextEncoding () ), - Bytes, - file ); - pImpl->leavePluginCallback(); - } - catch( ::com::sun::star::plugin::PluginException& e ) - { - pImpl->leavePluginCallback(); - return e.ErrorCode; - } - - return NPERR_NO_ERROR; - } - - NPError SAL_CALL NP_LOADDS NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) - { - TRACE( "NPN_RequestRead" ); - if( ! rangeList ) - return NPERR_NO_ERROR; - - ::std::list& rList = PluginManager::get().getPlugins(); - ::std::list::iterator iter; - XPlugin_Impl* pPlugin = NULL; - PluginStream* pStream = NULL; - for( iter = rList.begin(); iter!= rList.end(); ++iter ) - { - pStream = (*iter)->getStreamFromNPStream( stream ); - if( pStream ) - { - pPlugin = *iter; - break; - } - } - if( ! pPlugin ) - return NPERR_INVALID_INSTANCE_ERROR; - if( ! pStream || pStream->getStreamType() != InputStream ) - return NPERR_FILE_NOT_FOUND; - - PluginInputStream* pInputStream = (PluginInputStream*)pStream; - sal_Int8* pBytes = NULL; - int nBytes = 0; - pPlugin->enterPluginCallback(); - while( rangeList ) - { - if( pBytes && nBytes < (int)rangeList->length ) - { - delete [] pBytes; - pBytes = NULL; - } - if( ! pBytes ) - pBytes = new sal_Int8[ nBytes = rangeList->length ]; - int nRead = - pInputStream->read( rangeList->offset, pBytes, rangeList->length ); - int nPos = 0; - int nNow; - do - { - nNow = pPlugin->getPluginComm()-> - NPP_WriteReady( pPlugin->getNPPInstance(), - stream ); - nNow = pPlugin->getPluginComm()-> - NPP_Write( pPlugin->getNPPInstance(), - stream, - rangeList->offset + nPos, - nNow, - pBytes+nPos ); - nPos += nNow; - nRead -= nNow; - } while( nRead > 0 && nNow ); - rangeList = rangeList->next; - } - pPlugin->leavePluginCallback(); - - return NPERR_NO_ERROR; - } - - void SAL_CALL NP_LOADDS NPN_Status( NPP instance, const char* message ) - { - TRACE( "NPN_Status" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return; - - try - { - pImpl->enterPluginCallback(); - pImpl->getPluginContext()-> - displayStatusText( pImpl, ::rtl::OStringToOUString( message, pImpl->getTextEncoding() ) ); - pImpl->leavePluginCallback(); - } - catch( ::com::sun::star::plugin::PluginException& ) - { - pImpl->leavePluginCallback(); - return; - } - } - - const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance ) - { - static char* pAgent = strdup( "Mozilla 3.0" ); - - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( pImpl ) - { - rtl::OUString UserAgent; - try - { - pImpl->enterPluginCallback(); - UserAgent = pImpl->getPluginContext()-> - getUserAgent( pImpl ); - pImpl->leavePluginCallback(); - if( pAgent ) - free( pAgent ); - pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() ); - } - catch( ::com::sun::star::plugin::PluginException& ) - { - pImpl->leavePluginCallback(); - } - } - - TRACES( "NPN_UserAgent: returning", pAgent ); - - return pAgent; - } - -void SAL_CALL NP_LOADDS NPN_Version( int* major, int* minor, int* net_major, int* net_minor ) -{ - TRACE( "NPN_Version" ); - *major = 4; - *minor = 0; - *net_major = 4; - *net_minor = 5; -} - -int32 SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32 len, - void* buffer ) -{ - TRACE( "NPN_Write" ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( ! pImpl ) - return 0; - - PluginStream* pStream = pImpl->getStreamFromNPStream( stream ); - if( ! pStream || pStream->getStreamType() != OutputStream ) - return 0; - - pImpl->enterPluginCallback(); - ::com::sun::star::uno::Sequence Bytes( (sal_Int8*)buffer, len ); - ((PluginOutputStream*)pStream)->getOutputStream()->writeBytes( Bytes ); - pImpl->leavePluginCallback(); - - return len; -} - - -NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value ) -{ - TRACEN( "NPN_GetValue: ", variable ); - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - - if( ! pImpl ) - return 0; - - NPError aResult( NPERR_NO_ERROR ); - - switch( variable ) - { - case NPNVxDisplay: - // Unix only, handled in sysdep part - case NPNVxtAppContext: - // Unix only, handled in sysdep part - default: - aResult = NPERR_INVALID_PARAM; - break; - #ifdef QUARTZ - case 2000: // NPNVsupportsQuickDrawBool - *(NPBool*)value = false; - break; - case 2001: // NPNVsupportsCoreGraphicsBool - *(NPBool*)value = true; - break; - #endif - case NPNVjavascriptEnabledBool: - // no javascript - *(NPBool*)value = false; - break; - case NPNVasdEnabledBool: - // no SmartUpdate - *(NPBool*)value = false; - break; - case NPNVisOfflineBool: - // no offline browsing - *(NPBool*)value = false; - break; - } - - return aResult; -} - -void SAL_CALL NP_LOADDS NPN_ReloadPlugins(NPBool /*reloadPages*/) -{ - TRACE( "NPN_ReloadPlugins" ); -} - - -NPError SAL_CALL NP_LOADDS NPN_SetValue( NPP instance, - NPPVariable variable, - void* value ) -{ - NPError nError = NPERR_NO_ERROR; - TRACEN( "NPN_SetValue ", variable ); - switch( variable ) - { - #ifdef QUARTZ - case (NPPVariable)1000: // NPNVpluginDrawingModel - { - int nDrawingModel = (int)value; // ugly, but that's the way we need to do it - - TRACEN( "drawing model: ", nDrawingModel ); - - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( pImpl ) - pImpl->getSysPlugData().m_nDrawingModel = nDrawingModel; - } - break; - #endif - case NPPVpluginNameString: // make the windows compiler happy, it needs at least one case statement - break; - default: - break; - } - #ifndef QUARTZ - (void)instance; - (void)value; - #endif - return nError; -} - -void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect* /*invalidRect*/) -{ - TRACE( "NPN_InvalidateRect" ); - - #ifdef QUARTZ - NPN_ForceRedraw( instance ); - #else - (void)instance; - #endif -} - -void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion /*invalidRegion*/) -{ - TRACE( "NPN_InvalidateRegion" ); - - #ifdef QUARTZ - NPN_ForceRedraw( instance ); - #else - (void)instance; - #endif -} - -void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance) -{ - TRACE( "NPN_ForceRedraw" ); - #ifdef QUARTZ - XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance ); - if( pImpl ) - { - SysPlugData& rPlugData( pImpl->getSysPlugData() ); - if( rPlugData.m_pPlugView ) - [rPlugData.m_pPlugView setNeedsDisplay: YES]; - } - #else - (void)instance; - #endif -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx deleted file mode 100644 index ac3401935..000000000 --- a/extensions/source/plugin/base/plcom.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#ifdef SOLARIS -#include -#endif - -#include - -#include -#include - -PluginComm::PluginComm( const ::rtl::OString& rLibName, bool bReusable ) : - m_nRefCount( 0 ), - m_aLibName( rLibName ) -{ - if( bReusable ) - PluginManager::get().getPluginComms().push_back( this ); -} - -PluginComm::~PluginComm() -{ - PluginManager::get().getPluginComms().remove( this ); - while( m_aFilesToDelete.size() ) - { - String aFile = m_aFilesToDelete.front(); - m_aFilesToDelete.pop_front(); - DirEntry aEntry( aFile ); - aEntry.Kill(); - } -} - -NPError PluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl ) -{ - return NPP_SetWindow( i_pImpl->getNPPInstance(), i_pImpl->getNPWindow() ); -} - -NPError PluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save ) -{ - return NPP_Destroy( i_pImpl->getNPPInstance(), save ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx deleted file mode 100644 index 44a473ab0..000000000 --- a/extensions/source/plugin/base/plctrl.cxx +++ /dev/null @@ -1,325 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -//-------------------------------------------------------------------------------------------------- -PluginControl_Impl::PluginControl_Impl() : - _pMultiplexer( NULL ) - , _nX( 0 ) - , _nY( 0 ) - , _nWidth( 100 ) - , _nHeight( 100 ) - , _nFlags( WINDOW_POSSIZE_ALL ) - , _bVisible( sal_False ) - , _bInDesignMode( sal_False ) - , _bEnable( sal_True ) -{ -} - -//-------------------------------------------------------------------------------------------------- -PluginControl_Impl::~PluginControl_Impl() -{ -} - -MRCListenerMultiplexerHelper* PluginControl_Impl::getMultiplexer() -{ - if( ! _pMultiplexer ) - _pMultiplexer = new MRCListenerMultiplexerHelper( this, _xPeerWindow ); - return _pMultiplexer; -} -//================================================================================================== - -void PluginControl_Impl::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) - throw( RuntimeException ) -{ - _aDisposeListeners.push_back( l ); -} - -//---- ::com::sun::star::lang::XComponent ---------------------------------------------------------------------------------- -void PluginControl_Impl::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) - throw( RuntimeException ) -{ - _aDisposeListeners.remove( l ); -} - -//---- ::com::sun::star::lang::XComponent ---------------------------------------------------------------------------------- -void PluginControl_Impl::dispose(void) - throw( RuntimeException ) -{ - // send disposing events - ::com::sun::star::lang::EventObject aEvt; - if( getMultiplexer() ) - getMultiplexer()->disposeAndClear(); - - // release context - _xContext = Reference< XInterface > (); - releasePeer(); -} - - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) - throw( RuntimeException ) -{ - _nX = nX_ >=0 ? nX_ : 0; - _nY = nY_ >=0 ? nY_ : 0; - _nWidth = nWidth_ >=0 ? nWidth_ : 0; - _nHeight = nHeight_ >=0 ? nHeight_ : 0; - _nFlags = nFlags; - - if (_xPeerWindow.is()) - _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, nFlags ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -::com::sun::star::awt::Rectangle PluginControl_Impl::getPosSize(void) - throw( RuntimeException ) -{ - return _xPeerWindow->getPosSize(); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setVisible( sal_Bool bVisible ) - throw( RuntimeException ) -{ - _bVisible = bVisible; - if (_xPeerWindow.is()) - _xPeerWindow->setVisible( _bVisible && !_bInDesignMode ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setEnable( sal_Bool bEnable ) - throw( RuntimeException ) -{ - _bEnable = bEnable; - if (_xPeerWindow.is()) - _xPeerWindow->setEnable( _bEnable ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::setFocus(void) throw( RuntimeException ) -{ - if (_xPeerWindow.is()) - _xPeerWindow->setFocus(); -} - - -//-------------------------------------------------------------------------------------------------- -void PluginControl_Impl::releasePeer() -{ - if (_xPeer.is()) - { - _xParentWindow->removeFocusListener( this ); - _xPeerWindow->dispose(); - _pSysChild = NULL; - _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > (); - _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > (); - getMultiplexer()->setPeer( Reference< ::com::sun::star::awt::XWindow > () ); - } -} - -//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------ -void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & /*xToolkit*/, const Reference< ::com::sun::star::awt::XWindowPeer > & xParentPeer ) - throw( RuntimeException ) -{ - if (_xPeer.is()) - { - OSL_FAIL( "### Peer is already set!" ); - return; - } - - _xParentPeer = xParentPeer; - _xParentWindow = Reference< ::com::sun::star::awt::XWindow > ( xParentPeer, UNO_QUERY ); - DBG_ASSERT( _xParentWindow.is(), "### no parent peer window!" ); - - Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer ); - if (pImpl) - { - _pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN ); - if (pImpl->HasFocus()) - _pSysChild->GrabFocus(); - - // get peer - _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ( _pSysChild->GetComponentInterface() ); - _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ( _xPeer, UNO_QUERY ); - // !_BOTH_ MUST BE VALID! - DBG_ASSERT( (_xPeer.is() && _xPeerWindow.is()), "### no peer!" ); - - _xParentWindow->addFocusListener( this ); - _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, _nFlags ); - _xPeerWindow->setEnable( _bEnable ); - _xPeerWindow->setVisible( _bVisible && !_bInDesignMode ); - } - else - { - OSL_FAIL( "### cannot get implementation of parent peer!" ); - } - - getMultiplexer()->setPeer( _xPeerWindow ); -} - -//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------ -void PluginControl_Impl::setDesignMode( sal_Bool bOn ) - throw( RuntimeException ) -{ - _bInDesignMode = bOn; - if (_xPeerWindow.is()) - _xPeerWindow->setVisible( _bVisible && !_bInDesignMode ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l ); -} - -//---- ::com::sun::star::awt::XWindow ------------------------------------------------------------------------------------- -void PluginControl_Impl::removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) - throw( RuntimeException ) -{ - getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l ); -} - - -//---- ::com::sun::star::awt::XView --------------------------------------------------------------------------------------- -void PluginControl_Impl::draw( sal_Int32 /*x*/, sal_Int32 /*y*/ ) - throw( RuntimeException ) -{ - // has to be done by further implementation of control -} - -//---- ::com::sun::star::awt::XView --------------------------------------------------------------------------------------- -void PluginControl_Impl::setZoom( float /*ZoomX*/, float /*ZoomY*/ ) - throw( RuntimeException ) -{ - // has to be done by further implementation of control -} - -//---- ::com::sun::star::lang::XEventListener ------------------------------------------------------------------------------ -void PluginControl_Impl::disposing( const ::com::sun::star::lang::EventObject & /*rSource*/ ) - throw( RuntimeException ) -{ -} -//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------ -void PluginControl_Impl::focusGained( const ::com::sun::star::awt::FocusEvent & /*rEvt*/ ) - throw( RuntimeException ) -{ - if (_xPeerWindow.is()) - _xPeerWindow->setFocus(); -} -//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------ -void PluginControl_Impl::focusLost( const ::com::sun::star::awt::FocusEvent & /*rEvt*/ ) - throw( RuntimeException ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/plmodel.cxx b/extensions/source/plugin/base/plmodel.cxx deleted file mode 100644 index d09bd7c14..000000000 --- a/extensions/source/plugin/base/plmodel.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include - -using namespace com::sun::star::uno; - -//================================================================================================== -Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception ) -{ - Reference< XInterface > xService = *new PluginModel(); - return xService; -} - -Any PluginModel::queryAggregation( const Type& type ) throw( RuntimeException ) -{ - Any aRet( ::cppu::queryInterface( type, - static_cast< ::com::sun::star::lang::XComponent* >(this), - static_cast< ::com::sun::star::io::XPersistObject* >(this ), - static_cast< ::com::sun::star::awt::XControlModel* >(this), - static_cast< ::com::sun::star::beans::XPropertySet* >(this), - static_cast< ::com::sun::star::beans::XMultiPropertySet* >(this), - static_cast< ::com::sun::star::beans::XFastPropertySet* >(this) - ) ); - return aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( type ); -} - - -// XPluginManager_Impl -Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames_Static(void) throw() -{ - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginModel")); - return aSNS; -} - - -static const char* aCreationURL = "URL"; -static const char* aMime = "TYPE"; - -static ::osl::Mutex aPropertyMutex; - -static ::com::sun::star::beans::Property aProps[] = -{ - ::com::sun::star::beans::Property( - ::rtl::OUString::createFromAscii( aMime ), - 1, - ::getCppuType((const ::rtl::OUString*)0), - ::com::sun::star::beans::PropertyAttribute::BOUND ), - ::com::sun::star::beans::Property( - ::rtl::OUString::createFromAscii( aCreationURL ), - 2, - ::getCppuType((const ::rtl::OUString*)0), - ::com::sun::star::beans::PropertyAttribute::BOUND ) -}; - -PluginModel::PluginModel() : - BroadcasterHelperHolder( aPropertyMutex ), - OPropertySetHelper( m_aHelper ), - OPropertyArrayHelper( aProps, 2 ) -{ -} - -PluginModel::PluginModel(const ::rtl::OUString& rURL, const rtl::OUString& rMimeType ) : - BroadcasterHelperHolder( aPropertyMutex ), - OPropertySetHelper( m_aHelper ), - OPropertyArrayHelper( aProps, 2 ), - m_aCreationURL( rURL ), - m_aMimeType( rMimeType ) -{ -} - -PluginModel::~PluginModel() -{ -} - -Reference< ::com::sun::star::beans::XPropertySetInfo > PluginModel::getPropertySetInfo() throw() -{ - static Reference< ::com::sun::star::beans::XPropertySetInfo > aInfo = - createPropertySetInfo( *this ); - return aInfo; -} - -::cppu::IPropertyArrayHelper& PluginModel::getInfoHelper() -{ - return *this; -} - -sal_Bool PluginModel::convertFastPropertyValue( Any & rConvertedValue, - Any & rOldValue, - sal_Int32 nHandle, - const Any& rValue ) throw() -{ - if( nHandle == 1 || nHandle == 2 ) - { - if( rValue.getValueTypeClass() == TypeClass_STRING ) - { - rConvertedValue = rValue; - if( nHandle == 2 ) - rOldValue <<= m_aCreationURL; - else if( nHandle == 1 ) - rOldValue <<= m_aMimeType; - return sal_True; - } - } - return sal_False; -} - -void PluginModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const Any& rValue ) - throw(::com::sun::star::uno::Exception) -{ - if( rValue.getValueTypeClass() == TypeClass_STRING ) // FIXME wrong type! - - { - if( nHandle == 2 ) - rValue >>= m_aCreationURL; - else if( nHandle == 1 ) - rValue >>= m_aMimeType; - } - else - throw ::com::sun::star::lang::IllegalArgumentException(); -} - -void PluginModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const throw() -{ - if( nHandle == 2 ) - rValue <<= m_aCreationURL; - else if( nHandle == 1 ) - rValue <<= m_aMimeType; -} - -//---- ::com::sun::star::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw() -{ - m_aDisposeListeners.push_back( l ); -} - -//---- ::com::sun::star::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw() -{ - m_aDisposeListeners.remove( l ); -} - -//---- ::com::sun::star::lang::XComponent ---------------------------------------------------------------------------------- -void PluginModel::dispose(void) throw() -{ - // send disposing events - ::com::sun::star::lang::EventObject aEvt; - aEvt.Source = (::cppu::OWeakObject*)this; - ::std::list< Reference< ::com::sun::star::lang::XEventListener > > aLocalListeners = m_aDisposeListeners; - for( ::std::list< Reference< ::com::sun::star::lang::XEventListener > >::iterator it = aLocalListeners.begin(); - it != aLocalListeners.end(); ++it ) - (*it)->disposing( aEvt ); - - m_aDisposeListeners.clear(); - - disposing(); -} - - -// ::com::sun::star::io::XPersistObject -::rtl::OUString PluginModel::getServiceName() throw() -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginModel")); -} - -void PluginModel::write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream) throw() -{ - OutStream->writeUTF( m_aCreationURL ); -} - -void PluginModel::read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream) throw() -{ - m_aCreationURL = InStream->readUTF(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/service.cxx b/extensions/source/plugin/base/service.cxx deleted file mode 100644 index 5ecb800d4..000000000 --- a/extensions/source/plugin/base/service.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include - -#include -#include -#include -#include -#include -#include - -#include // declaration of generic uno interface -#include // mapping stuff - -#include - -using namespace cppu; - -extern "C" { - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pXUnoSMgr, - void* /*pXUnoKey*/ - ) - { - void* pRet = 0; - - ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) ); - - if( pXUnoSMgr ) - { - Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( - reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr ) - ); - Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory; - if( aImplName.equals( XPluginManager_Impl::getImplementationName_Static() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, PluginManager_CreateInstance, - XPluginManager_Impl::getSupportedServiceNames_Static() ); - } - else if( aImplName.equals( PluginModel::getImplementationName_Static() ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, aImplName, PluginModel_CreateInstance, - PluginModel::getSupportedServiceNames_Static() ); - } - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - return pRet; - } -} /* extern "C" */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx deleted file mode 100644 index 19d1d6cb0..000000000 --- a/extensions/source/plugin/base/xplugin.cxx +++ /dev/null @@ -1,1157 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#ifdef WNT -#include -#include -#undef OPTIONAL -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef UNX -#include -#include -#endif - -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -using namespace com::sun::star; -using namespace com::sun::star::io; -using namespace com::sun::star::beans; -using namespace com::sun::star::plugin; -using namespace osl; - -using ::rtl::OUString; -using ::rtl::OString; - -class PluginDisposer : public salhelper::Timer -{ -private: - XPlugin_Impl* m_pPlugin; - - virtual void SAL_CALL onShot(); -public: - PluginDisposer( XPlugin_Impl* pPlugin ) : - salhelper::Timer( salhelper::TTimeValue( 2, 0 ), - salhelper::TTimeValue( 2, 0 ) ), - m_pPlugin( pPlugin ) - { start(); } - ~PluginDisposer() {} -}; - -void PluginDisposer::onShot() -{ - if( m_pPlugin ) - { - if( m_pPlugin->isDisposable() ) - { - sal_uLong nEvent; - Application::PostUserEvent( nEvent, LINK( m_pPlugin, XPlugin_Impl, secondLevelDispose ), (void*)m_pPlugin ); - } - } - else - release(); -} - -//================================================================================================== - -Any XPlugin_Impl::queryInterface( const Type& type ) throw( RuntimeException ) -{ - return OWeakAggObject::queryInterface( type ); -} - -Any XPlugin_Impl::queryAggregation( const Type& type ) throw( RuntimeException ) -{ - Any aRet( cppu::queryInterface( type, static_cast< XPlugin* >(this) ) ); - if( ! aRet.hasValue() ) - aRet = PluginControl_Impl::queryAggregation( type ); - return aRet; -} - - -XPlugin_Impl::XPlugin_Impl( const uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) : - PluginControl_Impl(), - m_xSMgr( rSMgr ), - m_pPluginComm( NULL ), - m_aEncoding( gsl_getSystemTextEncoding() ), - m_pArgv( NULL ), - m_pArgn( NULL ), - m_nArgs( 0 ), - m_aPluginMode( NP_FULL ), - m_nProvidingState( PROVIDING_NONE ), - m_nCalledFromPlugin( 0 ), - m_pDisposer( NULL ), - m_bIsDisposed( sal_False ) -{ - memset( &m_aInstance, 0, sizeof( m_aInstance ) ); - memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) ); - memset( &m_aSysPlugData, 0, sizeof( m_aSysPlugData ) ); - - m_xModel = new PluginModel(); - uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - xPS->addPropertyChangeListener( OUString(), this ); - - Guard< Mutex > aGuard( PluginManager::get().getPluginMutex() ); - PluginManager::get().getPlugins().push_back( this ); -} - -void XPlugin_Impl::destroyInstance() -{ - Guard< Mutex > aGuard( m_aMutex ); - - NPSavedData* pSavedData = NULL; - - destroyStreams(); - if( getPluginComm() ) - { - getPluginComm()->NPP_Destroy( this, &pSavedData ); - getPluginComm()->decRef(); - m_pPluginComm = NULL; - } - - freeArgs(); - - while( m_aPEventListeners.size() ) - { - delete *m_aPEventListeners.begin(); - m_aPEventListeners.pop_front(); - } -} - -XPlugin_Impl::~XPlugin_Impl() -{ - destroyInstance(); -} - -void XPlugin_Impl::checkListeners( const char* normalizedURL ) -{ - if( ! normalizedURL ) - return; - - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = m_aPEventListeners.begin(); - iter != m_aPEventListeners.end(); - ++iter ) - { - if( ! strcmp( normalizedURL, (*iter)->getURL() ) || - ! strcmp( normalizedURL, (*iter)->getNormalizedURL() ) ) - { - (*iter)->disposing( com::sun::star::lang::EventObject() ); - delete *iter; - m_aPEventListeners.remove( *iter ); - return; - } - } -} - -IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, /*pThis*/ ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - // may have become undisposable between PostUserEvent and here - // or may have disposed and receive a second UserEvent - std::list& rList = PluginManager::get().getPlugins(); - std::list::iterator iter; - - { - Guard< Mutex > aPluginGuard( PluginManager::get().getPluginMutex() ); - for( iter = rList.begin(); iter != rList.end(); ++iter ) - { - if( *iter == this ) - break; - } - if( iter == rList.end() || ! isDisposable() ) - return 0; - } - - if (m_pDisposer) - { - m_pDisposer->release(); - m_pDisposer = NULL; - } - - uno::Reference< XPlugin > xProtection( this ); - uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - xPS->removePropertyChangeListener( OUString(), this ); - { - Guard< Mutex > aPluginGuard( PluginManager::get().getPluginMutex() ); - rList.remove( this ); - } - m_aNPWindow.window = NULL; -#ifndef UNX - // acrobat does an unconditional XtParent on the windows widget - getPluginComm()->NPP_SetWindow( this ); -#endif - destroyInstance(); - PluginControl_Impl::dispose(); - return 0; -} - -void XPlugin_Impl::dispose() throw() -{ - Guard< Mutex > aGuard( m_aMutex ); - - if (m_bIsDisposed || !getPluginComm()) - return; - m_bIsDisposed = sal_True; - - if( isDisposable() ) - secondLevelDispose( this ); - else - { - m_pDisposer = new PluginDisposer( this ); - m_pDisposer->acquire(); - } -} - -void XPlugin_Impl::initArgs( const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - m_aPluginMode = mode; - - m_nArgs = argn.getLength(); - m_pArgn = new const char*[m_nArgs]; - m_pArgv = new const char*[m_nArgs]; - const OUString* pUArgn = argn.getConstArray(); - const OUString* pUArgv = argv.getConstArray(); - for( int i = 0; i < m_nArgs; i++ ) - { - m_pArgn[i] = strdup( - OUStringToOString( pUArgn[i], m_aEncoding ).getStr() - ); - m_pArgv[i] = strdup( - OUStringToOString( pUArgv[i], m_aEncoding ).getStr() - ); - } -} - -void XPlugin_Impl::freeArgs() -{ - if( m_nArgs > 0 ) - { - for( ; m_nArgs--; ) - { - free( (void*)m_pArgn[m_nArgs] ); - free( (void*)m_pArgv[m_nArgs] ); - } - delete [] m_pArgn; - delete [] m_pArgv; - } -} - -void XPlugin_Impl::prependArg( const char* pName, const char* pValue ) -{ - const char** pNewNames = new const char*[m_nArgs+1]; - const char** pNewValues = new const char*[m_nArgs+1]; - - pNewNames[0] = strdup( pName ); - pNewValues[0] = strdup( pValue ); - for( int nIndex = 0; nIndex < m_nArgs; ++nIndex ) - { - pNewNames[nIndex+1] = m_pArgn[nIndex]; - pNewValues[nIndex+1]= m_pArgv[nIndex]; - } - // free old arrays - delete [] m_pArgn; - delete [] m_pArgv; - // set new arrays - m_pArgn = pNewNames; - m_pArgv = pNewValues; - // set new number of arguments - m_nArgs++; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "inserted %s=%s\n", pNewNames[0], pNewValues[0] ); -#endif -} - -void XPlugin_Impl::handleSpecialArgs() -{ - // special handling for real audio which needs a lot of parameters - // or won't function at all - if( ! m_aDescription.Mimetype.compareToAscii( "audio/x-pn-realaudio-plugin" ) && m_nArgs < 1 ) - { - OUString aURL; - if( m_xModel.is() ) - { - try - { - uno::Reference< XPropertySet > xProp( m_xModel, UNO_QUERY ); - Any aProp = xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); - aProp >>= aURL; - } - catch( UnknownPropertyException ) - { - } - } - - if( aURL.getLength() ) - { - // set new args, old args need not be freed as there were none set - m_nArgs = 6; - m_pArgn = new const char*[m_nArgs]; - m_pArgv = new const char*[m_nArgs]; - - // SRC - m_pArgn[0] = strdup( "SRC" ); - m_pArgv[0] = strdup( OUStringToOString( aURL, m_aEncoding ).getStr() ); - // WIDTH - m_pArgn[1] = strdup( "WIDTH" ); - m_pArgv[1] = strdup( "200" ); - // HEIGHT - m_pArgn[2] = strdup( "HEIGHT" ); - m_pArgv[2] = strdup( "200" ); - // CONTROLS - m_pArgn[3] = strdup( "CONTROLS" ); - m_pArgv[3] = strdup( "PlayButton,StopButton,ImageWindow" ); - // AUTOSTART - m_pArgn[4] = strdup( "AUTOSTART" ); - m_pArgv[4] = strdup( "TRUE" ); - // NOJAVA - m_pArgn[5] = strdup( "NOJAVA" ); - m_pArgv[5] = strdup( "TRUE" ); - } - } - // #69333# special for pdf - else if( ! m_aDescription.Mimetype.compareToAscii( "application/pdf" ) ) - m_aPluginMode = PluginMode::FULL; - - // see if we have a TYPE tag - int nIndex; - for( nIndex = 0; nIndex < m_nArgs; ++nIndex ) - if( m_pArgn[nIndex][0] == 'T' && - m_pArgn[nIndex][1] == 'Y' && - m_pArgn[nIndex][2] == 'P' && - m_pArgn[nIndex][3] == 'E' && - m_pArgn[nIndex][4] == 0 ) - break; - if( nIndex >= m_nArgs ) - { - // TYPE - prependArg( "TYPE", OUStringToOString( m_aDescription.Mimetype, m_aEncoding ).getStr() ); - } - - // see if we have a SRC tag - for( nIndex = 0; nIndex < m_nArgs; ++nIndex ) - if( m_pArgn[nIndex][0] == 'S' && - m_pArgn[nIndex][1] == 'R' && - m_pArgn[nIndex][2] == 'C' && - m_pArgn[nIndex][3] == 0 ) - break; - if( nIndex >= m_nArgs ) - { - // need a SRC parameter (as all browser set one on the plugin - OUString aURL; - if( m_xModel.is() ) - { - try - { - uno::Reference< XPropertySet > xProp( m_xModel, UNO_QUERY ); - Any aProp = xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); - aProp >>= aURL; - } - catch( UnknownPropertyException ) - { - } - } - - if( aURL.getLength() ) - { - // SRC - prependArg( "SRC", OUStringToOString( aURL, m_aEncoding ).getStr() ); - } - } -} - -void XPlugin_Impl::initInstance( const PluginDescription& rDescription, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - m_aDescription = rDescription; - initArgs( argn, argv, mode ); - handleSpecialArgs(); -} - -void XPlugin_Impl::initInstance( const OUString& rURL, - const Sequence< OUString >& argn, - const Sequence< OUString >& argv, - sal_Int16 mode ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - initArgs( argn, argv, mode ); - m_aDescription = fitDescription( rURL ); - - m_xModel = new PluginModel( rURL, m_aDescription.Mimetype ); - handleSpecialArgs(); -} - -void XPlugin_Impl::modelChanged() -{ - Guard< Mutex > aGuard( m_aMutex ); - - m_nProvidingState = PROVIDING_MODEL_UPDATE; - - destroyInstance(); - - m_aDescription = fitDescription( getCreationURL() ); - if( !m_aDescription.Mimetype.getLength() ) - { - m_nProvidingState = PROVIDING_NONE; - return; - } - - OUString aURL = getCreationURL(); - provideNewStream( m_aDescription.Mimetype, - uno::Reference< XActiveDataSource >(), - aURL, - 0, 0, (sal_Bool)(aURL.compareToAscii( "file:", 5 ) == 0) ); - m_nProvidingState = PROVIDING_NONE; -} - -OUString XPlugin_Impl::getCreationURL() -{ - Guard< Mutex > aGuard( m_aMutex ); - - OUString aRet; - uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - Any aValue = xPS->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ); - aValue >>= aRet; - } - return aRet; -} - - -sal_Bool XPlugin_Impl::setModel( const uno::Reference< com::sun::star::awt::XControlModel > & Model ) - throw( RuntimeException ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - uno::Reference< com::sun::star::beans::XPropertySet > xPS( Model, UNO_QUERY ); - if( ! xPS.is() ) - return sal_False; - - if( getCreationURL().getLength() ) - { - m_xModel = Model; - modelChanged(); - xPS->addPropertyChangeListener( OUString(), this ); - return sal_True; - } - return sal_False; -} - -void XPlugin_Impl::createPeer( const uno::Reference< com::sun::star::awt::XToolkit > & xToolkit, const uno::Reference< com::sun::star::awt::XWindowPeer > & Parent ) - throw( RuntimeException ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - if( ! _xPeer.is() ) - { - if( ! Parent.is() ) - throw RuntimeException(); - PluginControl_Impl::createPeer( xToolkit, Parent ); - } -} - -void XPlugin_Impl::loadPlugin() -{ - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = PluginManager::get().getPluginComms().begin(); - iter != PluginManager::get().getPluginComms().end(); ++iter ) - { - if( OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName ) - { - setPluginComm( *iter ); - break; - } - } - const SystemEnvData* pEnvData = getSysChildSysData(); -#if defined( UNX ) && !(defined(QUARTZ)) - XSync( (Display*)pEnvData->pDisplay, False ); -#endif - if( ! getPluginComm() ) - { - if( m_aDescription.PluginName.getLength() ) - { -#if defined QUARTZ - PluginComm* pComm = new MacPluginComm( m_aDescription.Mimetype, - m_aDescription.PluginName, - pEnvData->pView ); -#elif defined UNX - // need a new PluginComm - PluginComm* pComm = NULL; - int sv[2]; - if( !socketpair( AF_UNIX, SOCK_STREAM, 0, sv ) ) - pComm = new UnxPluginComm( m_aDescription.Mimetype, - m_aDescription.PluginName, - (XLIB_Window)pEnvData->aWindow, - sv[0], - sv[1] - ); -#elif defined WNT - PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype, - m_aDescription.PluginName, - (HWND)pEnvData->hWnd ); -#endif - setPluginComm( pComm ); - } - else - return; - } - - getPluginComm()-> - NPP_New( (char*)OUStringToOString( m_aDescription.Mimetype, - m_aEncoding).getStr(), - getNPPInstance(), - m_aPluginMode == PluginMode::FULL ? NP_FULL : NP_EMBED, - ::sal::static_int_cast< int16, int >( m_nArgs ), - (char**)(m_nArgs ? m_pArgn : NULL), - (char**)(m_nArgs ? m_pArgv : NULL), - NULL ); -#ifdef QUARTZ - // m_aNPWindow is set up in the MacPluginComm from the view - m_aSysPlugData.m_pParentView = pEnvData->pView; -#elif defined( UNX ) - XSync( (Display*)pEnvData->pDisplay, False ); - m_aNPWindow.window = (void*)pEnvData->aWindow; - m_aNPWindow.ws_info = NULL; -#else - m_aNPWindow.window = (void*)pEnvData->hWnd; -#endif - com::sun::star::awt::Rectangle aPosSize = getPosSize(); - - for( int i = 0; i < m_nArgs; i++ ) - { - OString aName( m_pArgn[i] ); - if( aName.equalsIgnoreAsciiCase( "width" ) ) - { - OString aValue( m_pArgv[i] ); - aPosSize.Width = aValue.toInt32(); - } - else if( aName.equalsIgnoreAsciiCase( "height" ) ) - { - OString aValue( m_pArgv[i] ); - aPosSize.Height = aValue.toInt32(); - } - } - - m_aNPWindow.clipRect.top = 0; - m_aNPWindow.clipRect.left = 0; - m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16, sal_Int32 >( aPosSize.Height ); - m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16, sal_Int32 >( aPosSize.Width ); - m_aNPWindow.type = NPWindowTypeWindow; - - m_aNPWindow.x = 0; - m_aNPWindow.y = 0; - m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600; - m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600; - - getPluginComm()->NPP_SetWindow( this ); -} - -void XPlugin_Impl::destroyStreams() -{ - Guard< Mutex > aGuard( m_aMutex ); - - // streams remove themselves from this list when deleted - while( m_aOutputStreams.size() ) - delete *m_aOutputStreams.begin(); - - // input streams are XOutputStreams, they cannot be simply deleted - std::list aLocalList( m_aInputStreams ); - for( std::list::iterator it = aLocalList.begin(); - it != aLocalList.end(); ++it ) - (*it)->setMode( -1 ); -} - -PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream ) -{ - Guard< Mutex > aGuard( m_aMutex ); - - std::list::iterator iter; - for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter ) - if( (*iter)->getStream() == stream ) - return *iter; - - std::list::iterator iter2; - for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 ) - if( (*iter2)->getStream() == stream ) - return *iter2; - - return NULL; -} - -sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, - const uno::Reference< com::sun::star::io::XActiveDataSource > & stream, - const OUString& url, sal_Int32 length, - sal_Int32 lastmodified, sal_Bool isfile) throw() - -{ - Guard< Mutex > aGuard( m_aMutex ); - sal_Bool bRet = sal_False; - - if( m_nProvidingState != PROVIDING_NONE ) - { - m_nProvidingState = PROVIDING_NOW; - Any aAny; - aAny <<= url; - uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - try - { - xPS->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("URL")), aAny ); - aAny <<= mimetype; - xPS->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE")), aAny ); - } - catch(...) - { - } - } - } - m_nProvidingState = PROVIDING_NOW; - - OString aMIME; - if( mimetype.getLength() ) - aMIME = OUStringToOString( mimetype, m_aEncoding ); - else - aMIME = OUStringToOString( m_aDescription.Mimetype, m_aEncoding ); - - OString aURL = OUStringToOString( url, m_aEncoding ); - - // check wether there is a notifylistener for this stream - // this means that the strema is created from the plugin - // via NPN_GetURLNotify or NPN_PostURLNotify - std::list::iterator iter; - for( iter = m_aPEventListeners.begin(); - iter != m_aPEventListeners.end(); - ++iter ) - { - if( (*iter)->getNormalizedURL() == aURL ) - { - aURL = (*iter)->getURL(); - break; - } - } - - if( ! m_pPluginComm ) - { - loadPlugin(); - if( m_aLastGetUrl.getLength() && m_aLastGetUrl == aURL ) - { - // plugin is pulling data, don't push the same stream; - // this complicated method could have been avoided if - // all plugins respected the SRC parameter; but e.g. - // acrobat reader plugin does not - m_nProvidingState = PROVIDING_NONE; - return sal_True; - } - } - if( ! m_pPluginComm ) - return sal_False; - - if( ! url.getLength() ) - // this is valid if the plugin is supposed to - // pull data (via e.g. NPN_GetURL) - return sal_True; - - // set mimetype on model - { - uno::Reference< com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY ); - if( xPS.is() ) - { - try - { - Any aAny; - aAny <<= m_aDescription.Mimetype; - xPS->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE")), aAny ); - } - catch(...) - { - } - } - } - - // there may be plugins that can use the file length information, - // but currently none are known. Since this file opening/seeking/closing - // is rather costly, it is not implemented. If there are plugins known to - // make use of the file length, simply put it in - - PluginInputStream* pStream = new PluginInputStream( this, aURL.getStr(), - length, lastmodified ); - uno::Reference< com::sun::star::io::XOutputStream > xNewStream( pStream ); - - if( iter != m_aPEventListeners.end() ) - pStream->getStream()->notifyData = (*iter)->getNotifyData(); - - uint16 stype = 0; - - // special handling acrobat reader - // presenting a seekable stream to it does not seem to work correctly - if( aMIME.equals( "application/pdf" ) ) - isfile = sal_False; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, - "new stream \"%s\" of MIMEType \"%s\"\n" - "for plugin \"%s\"\n" - "seekable = %s, length = %"SAL_PRIdINT32"\n", - aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr(), - isfile ? "true" : "false", length ); - -#endif - if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, - (char*)aMIME.getStr(), - pStream->getStream(), isfile, - &stype ) ) - { -#if OSL_DEBUG_LEVEL > 1 - const char* pType; - switch( stype ) - { - case NP_NORMAL: pType = "NP_NORMAL";break; - case NP_SEEK: pType = "NP_SEEK";break; - case NP_ASFILE: pType = "NP_ASFILE";break; - case NP_ASFILEONLY: pType = "NP_ASFILEONLY";break; - default: pType = "unknown!!!"; - } - fprintf( stderr, "Plugin wants it in Mode %s\n", pType ); -#endif - if( isfile && stype == NP_ASFILEONLY ) - { - OString aFileName; - if( url.compareToAscii( "file:", 5 ) == 0 ) - { - OUString aSysName; - osl_getSystemPathFromFileURL( url.pData, &aSysName.pData ); - aFileName = OUStringToOString( aSysName, m_aEncoding ); - } - else - aFileName = OUStringToOString( url, m_aEncoding ); - m_pPluginComm-> - NPP_StreamAsFile( &m_aInstance, - pStream->getStream(), - aFileName.getStr() ); - } - else - { - pStream->setMode( stype ); - - if( ! stream.is() ) - { - // stream has to be loaded by PluginStream itself via UCB - pStream->load(); - } - else - { - uno::Reference< com::sun::star::io::XConnectable > xConnectable( stream, UNO_QUERY ); - pStream->setPredecessor( xConnectable ); - if( xConnectable.is() ) - { - xConnectable->setSuccessor( static_cast< com::sun::star::io::XConnectable* >(pStream) ); - while( xConnectable->getPredecessor().is() ) - xConnectable = xConnectable->getPredecessor(); - } - stream->setOutputStream( xNewStream ); - pStream->setSource( stream ); - uno::Reference< com::sun::star::io::XActiveDataControl > xController; - if( xConnectable.is() ) - xController = uno::Reference< com::sun::star::io::XActiveDataControl >( xConnectable, UNO_QUERY ); - else - xController = uno::Reference< com::sun::star::io::XActiveDataControl >( stream, UNO_QUERY ); - - if( xController.is() ) - xController->start(); - } - } - bRet = sal_True; - } - - m_nProvidingState = PROVIDING_NONE; - - return bRet; -} - -void XPlugin_Impl::disposing( const com::sun::star::lang::EventObject& /*rSource*/ ) throw() -{ -} - -void XPlugin_Impl::propertyChange( const com::sun::star::beans::PropertyChangeEvent& rEvent ) throw() -{ - Guard< Mutex > aGuard( m_aMutex ); - - if( ! rEvent.PropertyName.compareToAscii( "URL" ) ) - { - OUString aStr; - rEvent.NewValue >>= aStr; - if( m_nProvidingState == PROVIDING_NONE ) - { - if( aStr != m_aURL ) - { - m_aURL = aStr; - modelChanged(); - } - } - } -} - -void XPlugin_Impl::setPluginContext( const uno::Reference< XPluginContext > & rContext ) -{ - m_rBrowserContext = rContext; -} - -void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) - throw( RuntimeException ) -{ - Guard< Mutex > aGuard( m_aMutex ); - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "XPlugin_Impl::setPosSize( %"SAL_PRIdINT32", %"SAL_PRIdINT32", %"SAL_PRIdINT32", %"SAL_PRIdINT32", %d )\n", - nX_, nY_, nWidth_, nHeight_, nFlags ); -#endif - - PluginControl_Impl::setPosSize(nX_, nY_, nWidth_, nHeight_, nFlags); - - m_aNPWindow.x = 0; - m_aNPWindow.y = 0; - m_aNPWindow.width = nWidth_; - m_aNPWindow.height = nHeight_; - m_aNPWindow.clipRect.top = 0; - m_aNPWindow.clipRect.left = 0; - m_aNPWindow.clipRect.right = ::sal::static_int_cast< uint16, sal_Int32 >( nWidth_ ); - m_aNPWindow.clipRect.bottom = ::sal::static_int_cast< uint16, sal_Int32 >( nHeight_ ); - - if( getPluginComm() ) - getPluginComm()->NPP_SetWindow( this ); -} - -PluginDescription XPlugin_Impl::fitDescription( const OUString& rURL ) -{ - uno::Reference< XPluginManager > xPMgr( m_xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.plugin.PluginManager")) ), UNO_QUERY ); - if( !xPMgr.is() ) - { - m_nProvidingState = PROVIDING_NONE; - return PluginDescription(); - } - - Sequence< PluginDescription > aDescrs = xPMgr->getPluginDescriptions(); - const PluginDescription* pDescrs = aDescrs.getConstArray(); - - for( int nArg = 0; nArg < m_nArgs; nArg++ ) - { - if( strncmp( m_pArgn[nArg], "TYPE", 4 ) == 0 && - m_pArgn[nArg][4] == 0 ) - { - for( int i = 0; i < aDescrs.getLength(); i++ ) - { - if( pDescrs[i].Mimetype.compareToAscii( m_pArgv[nArg] ) == 0 ) - return pDescrs[i]; - } - } - } - - int nPos = rURL.lastIndexOf( (sal_Unicode)'.' ); - OUString aExt = rURL.copy( nPos ).toAsciiLowerCase(); - if( nPos != -1 ) - { - for( int i = 0; i < aDescrs.getLength(); i++ ) - { - OUString aThisExt = pDescrs[ i ].Extension.toAsciiLowerCase(); - if( aThisExt.indexOf( aExt ) != -1 ) - { - return pDescrs[i]; - } - } - } - return PluginDescription(); -} - - -PluginStream::PluginStream( XPlugin_Impl* pPlugin, - const char* url, sal_uInt32 len, sal_uInt32 lastmod ) : - m_pPlugin( pPlugin ) -{ - memset( &m_aNPStream, 0, sizeof( m_aNPStream ) ); - m_aNPStream.url = strdup( url ); - m_aNPStream.end = len; - m_aNPStream.lastmodified = lastmod; -} - -PluginStream::~PluginStream() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - if( m_pPlugin && m_pPlugin->getPluginComm() ) - { - m_pPlugin->getPluginComm()->NPP_DestroyStream( m_pPlugin->getNPPInstance(), - &m_aNPStream, NPRES_DONE ); - m_pPlugin->checkListeners( m_aNPStream.url ); - m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin ); - } - ::free( (void*)m_aNPStream.url ); -} - -PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin, - const char* url, - sal_uInt32 len, - sal_uInt32 lastmod ) : - PluginStream( pPlugin, url, len, lastmod ), - m_pContent( NULL ), - m_nMode( NP_NORMAL ), - m_nWritePos( 0 ) -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getInputStreams().push_back( this ); - DirEntry aEntry; - aEntry = aEntry.TempName(); - - // set correct extension, some plugins need that - DirEntry aName( String( m_aNPStream.url, m_pPlugin->getTextEncoding() ) ); - String aExtension = aName.GetExtension(); - if( aExtension.Len() ) - aEntry.SetExtension( aExtension ); - m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE ); - if( ! m_aFileStream.IsOpen() ) - { - // #74808# might be that the extension scrambled the whole filename - aEntry = aEntry.TempName(); - m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE ); - } -} - -PluginInputStream::~PluginInputStream() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getInputStreams().remove( this ); - - String aFile( m_aFileStream.GetFileName() ); - - m_aFileStream.Close(); - if( m_pPlugin ) - { - ByteString aFileName( aFile, m_pPlugin->getTextEncoding() ); - if( m_pPlugin->getPluginComm() && m_nMode != -1 ) - // mode -1 means either an error occurred, - // or the plugin is already disposing - { - m_pPlugin->getPluginComm()->addFileToDelete( aFile ); - if( m_nMode == NP_ASFILE ) - { - m_pPlugin->getPluginComm()-> - NPP_StreamAsFile( m_pPlugin->getNPPInstance(), - &m_aNPStream, - aFileName.GetBuffer() ); - } - m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin ); - m_pPlugin->getInputStreams().remove( this ); - } - else - DirEntry( m_aFileStream.GetFileName() ).Kill(); - } - else - DirEntry( m_aFileStream.GetFileName() ).Kill(); - if( m_pContent ) - delete m_pContent; -} - -PluginStreamType PluginInputStream::getStreamType() -{ - return InputStream; -} - -void PluginInputStream::load() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - INetURLObject aUrl; - aUrl.SetSmartProtocol( INET_PROT_FILE ); - aUrl.SetSmartURL( - String( getStream()->url, - ::sal::static_int_cast< sal_uInt16, size_t >( strlen( getStream()->url ) ), - RTL_TEXTENCODING_MS_1252 - ) ); - try - { - m_pContent = - new ::ucbhelper::Content( - aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI), - uno::Reference< com::sun::star::ucb::XCommandEnvironment >() - ); - m_pContent->openStream( static_cast< XOutputStream* >( this ) ); - } - catch( com::sun::star::uno::Exception ) - { - } -} - -void PluginInputStream::setMode( sal_Int32 nMode ) -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_nMode = nMode; - - // invalidation by plugin - if( m_nMode == -1 && m_pPlugin ) - { - m_pPlugin->getInputStreams().remove( this ); - m_pPlugin = NULL; - } -} - -void PluginInputStream::writeBytes( const Sequence& Buffer ) throw() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_aFileStream.Seek( STREAM_SEEK_TO_END ); - m_aFileStream.Write( Buffer.getConstArray(), Buffer.getLength() ); - - if( m_nMode == NP_SEEK ) - // hold reference, streem gets destroyed in NPN_DestroyStream - m_xSelf = this; - - if( m_nMode == -1 || !m_pPlugin->getPluginComm() ) - return; - - sal_uInt32 nPos = m_aFileStream.Tell(); - sal_uInt32 nBytes = 0; - while( m_nMode != NP_ASFILEONLY && - m_nWritePos < nPos && - (nBytes = m_pPlugin->getPluginComm()-> NPP_WriteReady( - m_pPlugin->getNPPInstance(), &m_aNPStream )) > 0 ) - { - nBytes = (nBytes > nPos - m_nWritePos) ? nPos - m_nWritePos : nBytes; - - char* pBuffer = new char[ nBytes ]; - m_aFileStream.Seek( m_nWritePos ); - nBytes = m_aFileStream.Read( pBuffer, nBytes ); - - int32 nBytesRead = 0; - try - { - nBytesRead = m_pPlugin->getPluginComm()->NPP_Write( - m_pPlugin->getNPPInstance(), &m_aNPStream, m_nWritePos, nBytes, pBuffer ); - } - catch( ... ) - { - nBytesRead = 0; - } - delete [] pBuffer; - - if( nBytesRead < 0 ) - { - m_nMode = -1; - return; - } - - m_nWritePos += nBytesRead; - } -} - -void PluginInputStream::closeOutput() throw() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - flush(); - m_xSource = uno::Reference< com::sun::star::io::XActiveDataSource >(); -} - -sal_uInt32 PluginInputStream::read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size ) -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - if( m_nMode != NP_SEEK ) - return 0; - - m_aFileStream.Seek( offset ); - return m_aFileStream.Read( buffer, size ); -} - -void PluginInputStream::flush(void) throw() -{ -} - -PluginOutputStream::PluginOutputStream( XPlugin_Impl* pPlugin, - const char* url, - sal_uInt32 len, - sal_uInt32 lastmod ) : - PluginStream( pPlugin, url, len, lastmod ), - m_xStream( pPlugin->getServiceManager()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.DataOutputStream")) ), UNO_QUERY ) -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getOutputStreams().push_back( this ); -} - -PluginOutputStream::~PluginOutputStream() -{ - Guard< Mutex > aGuard( m_pPlugin->getMutex() ); - - m_pPlugin->getOutputStreams().remove( this ); -} - -PluginStreamType PluginOutputStream::getStreamType() -{ - return OutputStream; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx b/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx deleted file mode 100644 index 3c088735d..000000000 --- a/extensions/source/plugin/inc/plugin/aqua/sysplug.hxx +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLUGIN_INC_MACPLUG_HXX -#define __PLUGIN_INC_MACPLUG_HXX - -#include - -#include -#include -#include -#include "premac.h" -#include -#include -#include "postmac.h" -#undef uint32 - -#define XP_MAC -#include "npsdk/npapi.h" -#include "npsdk/npupp.h" - -#include "plugin/plcom.hxx" -#include "premac.h" -#include -#include "postmac.h" - -#include "vcl/sysdata.hxx" -#include "vcl/threadex.hxx" -#include "vcl/timer.hxx" -#include "osl/module.h" - -class XPlugin_Impl; - -namespace plugstringhelper -{ -rtl::OUString getString( CFStringRef i_xString ); -rtl::OUString getString( CFURLRef i_xURL ); -CFMutableStringRef createString( const rtl::OUString& i_rString ); -CFURLRef createURL( const rtl::OUString& i_rString ); -rtl::OUString getURLFromPath( const rtl::OUString& i_rPath ); -CFURLRef createURLFromPath( const rtl::OUString& i_rPath ); -rtl::OUString CFURLtoOSLURL( CFURLRef i_xURL ); -} - -//================================================================================================== -class MacPluginComm : - public PluginComm, - public ::vcl::SolarThreadExecutor - -{ - enum CallType { - eNPP_Destroy, - eNPP_DestroyStream, - eNPP_GetJavaClass, - eNPP_Initialize, - eNPP_New, - eNPP_NewStream, - eNPP_Print, - eNPP_SetWindow, - eNPP_Shutdown, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_Write, - eNPP_WriteReady, - eNPP_GetValue, - eNPP_SetValue, - eNPP_HandleEvent, - eNP_Initialize - }; - - void* m_aArgs[ 8 ]; - CallType m_eCall; - - virtual long doIt(); -public: - MacPluginComm( const rtl::OUString& rMIME, const rtl::OUString& rName, NSView* pView ); - virtual ~MacPluginComm(); - - // FIXME: - // this actually should be from the NP headers - // but currently we have too old a version - // changes this when we have updated our headers - typedef struct NP_CGContext - { - CGContextRef context; - WindowRef window; - } NP_CGContext; - -public: - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ); - virtual void * NPP_GetJavaClass(); - virtual NPError NPP_Initialize(); - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ); - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype ); - virtual void NPP_Print( NPP instance, NPPrint* platformPrint ); - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ); - virtual void NPP_Shutdown(); - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ); - virtual void NPP_URLNotify( NPP instance, const char* url, - NPReason reason, void* notifyData ); - virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer ); - virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ); - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ); - virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_value ); - virtual int16 NPP_HandleEvent( NPP instance, void* event ); - - virtual NPError NPP_SetWindow( XPlugin_Impl* ); - virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save ); - - void drawView( XPlugin_Impl* ); -private: - sal_Bool retrieveFunction( const char* i_pName, void** i_ppFunc ) const; - DECL_LINK( NullTimerHdl, void* ); - -private: - CFBundleRef m_xBundle; - oslModule m_hPlugLib; - NPPluginFuncs m_aNPPfuncs; - - // timer for sending nullEvents - AutoTimer* m_pNullTimer; - std::list< XPlugin_Impl* > m_aNullEventClients; -}; - -struct SysPlugData -{ - MacPluginComm::NP_CGContext m_aCGContext; - NP_Port m_aNPPort; - NSView* m_pParentView; - NSView* m_pPlugView; - int m_nDrawingModel; - NSPoint m_aLastPlugViewOrigin; - bool m_bSetWindowOnDraw; -}; - - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx deleted file mode 100644 index 0ca0125f5..000000000 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ /dev/null @@ -1,431 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLUGIN_SOURCE_MGR_IMPL_HXX -#define __PLUGIN_SOURCE_MGR_IMPL_HXX - -#ifdef SOLARIS -#include -#endif - -#include "cppuhelper/weak.hxx" - -#include "com/sun/star/awt/Key.hpp" -#include "com/sun/star/awt/KeyFunction.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/plugin/PluginMode.hpp" -#include "com/sun/star/plugin/PluginDescription.hpp" -#include "com/sun/star/plugin/PluginException.hpp" -#include "com/sun/star/plugin/PluginVariable.hpp" -#include "com/sun/star/plugin/XPlugin.hpp" -#include "com/sun/star/plugin/XPluginManager.hpp" -#include "com/sun/star/plugin/XPluginContext.hpp" -#include "com/sun/star/io/XConnectable.hpp" -#include "com/sun/star/io/XOutputStream.hpp" -#include "com/sun/star/io/XDataOutputStream.hpp" -#include "com/sun/star/io/XActiveDataControl.hpp" -#include "com/sun/star/io/XDataInputStream.hpp" -#include "com/sun/star/io/XMarkableStream.hpp" -#include "com/sun/star/io/XInputStream.hpp" -#include "com/sun/star/io/XStreamListener.hpp" -#include "com/sun/star/io/XActiveDataSink.hpp" -#include "com/sun/star/io/XActiveDataSource.hpp" -#include "com/sun/star/lang/XServiceName.hpp" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/lang/XSingleServiceFactory.hpp" -#include "com/sun/star/awt/GradientStyle.hpp" -#include "com/sun/star/awt/RasterOperation.hpp" -#include "com/sun/star/awt/Gradient.hpp" -#include "com/sun/star/awt/XGraphics.hpp" - -#include "cppuhelper/implbase3.hxx" -#include "cppuhelper/implbase2.hxx" -#include "cppuhelper/implbase1.hxx" - -#include - -#ifdef WNT -#include "plugin/win/sysplug.hxx" -#endif - -#ifdef WNT -#include -#elif defined(QUARTZ) -#include "plugin/aqua/sysplug.hxx" -#elif defined(UNX) -#include "plugin/unx/sysplug.hxx" -#endif - -#if ! defined (QUARTZ) -// the QUARTZ implementation needs special instance data -typedef int SysPlugData; -#endif - -#include "plugin/plctrl.hxx" -#include "plugin/model.hxx" - -#include "vcl/sysdata.hxx" -#include "vcl/syschild.hxx" - -#include "tools/link.hxx" -#include "tools/stream.hxx" - - -using namespace com::sun::star::uno; - -#define PROVIDING_NONE 0 -#define PROVIDING_NOW 1 -#define PROVIDING_MODEL_UPDATE 2 - -// forwards -namespace ucbhelper { class Content; } -class PluginStream; -class PluginInputStream; -class PluginOutputStream; -class XPlugin_Impl; -class PluginDisposer; -class PluginEventListener; - -class XPlugin_Impl : public com::sun::star::plugin::XPlugin, - public PluginControl_Impl, - public com::sun::star::beans::XPropertyChangeListener -{ -private: - ::osl::Mutex m_aMutex; - Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; - Reference< com::sun::star::plugin::XPluginContext > m_rBrowserContext; - - PluginComm* m_pPluginComm; - NPP_t m_aInstance; - NPWindow m_aNPWindow; - SysPlugData m_aSysPlugData; - rtl_TextEncoding m_aEncoding; - - const char** m_pArgv; - const char** m_pArgn; - int m_nArgs; - rtl::OString m_aLastGetUrl; - - Reference< com::sun::star::awt::XControlModel > m_xModel; - - ::com::sun::star::plugin::PluginDescription m_aDescription; - sal_Int16 m_aPluginMode; - - int m_nProvidingState; - int m_nCalledFromPlugin; - PluginDisposer* m_pDisposer; - - ::std::list m_aInputStreams; - ::std::list m_aOutputStreams; - ::std::list m_aPEventListeners; - ::rtl::OUString m_aURL; - - sal_Bool m_bIsDisposed; - - void prependArg( const char* pName, const char* pValue ); // arguments will be strdup'ed - void initArgs( const Sequence< rtl::OUString >& argn, - const Sequence< rtl::OUString >& argv, - sal_Int16 mode ); - void freeArgs(); - void handleSpecialArgs(); - - void loadPlugin(); - void destroyInstance(); - void modelChanged(); - -public: - XPlugin_Impl( const Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr ); - virtual ~XPlugin_Impl(); - - ::osl::Mutex& getMutex() { return m_aMutex; } - - void destroyStreams(); - - void setLastGetUrl( const rtl::OString& rUrl ) { m_aLastGetUrl = rUrl; } - - com::sun::star::plugin::PluginDescription fitDescription( const rtl::OUString& rURL ); - - ::std::list& getInputStreams() { return m_aInputStreams; } - ::std::list& getOutputStreams() { return m_aOutputStreams; } - PluginComm* getPluginComm() { return m_pPluginComm; } - void setPluginComm( PluginComm* comm ) - { - if( ! m_pPluginComm ) - { - m_pPluginComm = comm; - m_pPluginComm->addRef(); - } - } - Reference< com::sun::star::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; } - const com::sun::star::plugin::PluginDescription& getDescription() const { return m_aDescription; } - rtl_TextEncoding getTextEncoding() { return m_aEncoding; } - NPP getNPPInstance() { return &m_aInstance; } - NPWindow* getNPWindow() { return &m_aNPWindow; } - SysPlugData& getSysPlugData() { return m_aSysPlugData; } - - void enterPluginCallback() { m_nCalledFromPlugin++; } - void leavePluginCallback() { m_nCalledFromPlugin--; } - sal_Bool isDisposable() { return m_nCalledFromPlugin < 1 ? sal_True : sal_False; } - DECL_LINK( secondLevelDispose, XPlugin_Impl* ); - - void addPluginEventListener( PluginEventListener* pListener ) - { m_aPEventListeners.push_back( pListener ); } - void checkListeners( const char* normalizedURL ); - - void initInstance( - const com::sun::star::plugin::PluginDescription& rDescription, - const Sequence< rtl::OUString >& argn, - const Sequence< rtl::OUString >& argv, - sal_Int16 mode ); - void initInstance( - const rtl::OUString& rURL, - const Sequence< rtl::OUString >& argn, - const Sequence< rtl::OUString >& argv, - sal_Int16 mode ); - - const rtl::OUString& getRefererURL() { return m_aURL; } - ::rtl::OUString getCreationURL(); - - PluginStream* getStreamFromNPStream( NPStream* ); - - const SystemEnvData* getSysChildSysData() - { return _pSysChild->GetSystemData(); } - - const Reference< com::sun::star::plugin::XPluginContext > & getPluginContext() const - { return m_rBrowserContext; } - void setPluginContext( const Reference< com::sun::star::plugin::XPluginContext > & ); - - void secondLevelDispose(); - -// static const Reference< com::sun::star::reflection::XIdlClass > & staticGetIdlClass(); - - // XInterface - virtual Any SAL_CALL queryInterface( const Type& ) throw( com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL acquire() throw() - { OWeakAggObject::acquire(); } - virtual void SAL_CALL release() throw() - { OWeakAggObject::release(); } - - // OWeakAggObject - virtual Any SAL_CALL queryAggregation( const Type& ) - throw( com::sun::star::uno::RuntimeException ); - - // PluginContol_Impl - virtual void SAL_CALL dispose() throw(); - virtual void SAL_CALL createPeer( const Reference< com::sun::star::awt::XToolkit > & xToolkit, const Reference< com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException ); - - virtual sal_Bool SAL_CALL setModel( const Reference< com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException ); - virtual Reference< com::sun::star::awt::XControlModel > SAL_CALL getModel()throw( RuntimeException ) - { return m_xModel; } - - virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException ); - - // com::sun::star::plugin::XPlugin - virtual sal_Bool SAL_CALL provideNewStream(const rtl::OUString& mimetype, const Reference< com::sun::star::io::XActiveDataSource > & stream, const rtl::OUString& url, sal_Int32 length, sal_Int32 lastmodified, sal_Bool isfile) throw(); - - // com::sun::star::beans::XPropertyChangeListener - virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& rSource ) throw(); - virtual void SAL_CALL propertyChange( const com::sun::star::beans::PropertyChangeEvent& rEvent ) throw(); -}; - -class PluginManager -{ -private: - Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; - ::std::list m_aPluginComms; - ::std::list m_aAllPlugins; - ::osl::Mutex m_aPluginMutex; - - static PluginManager* pManager; - - PluginManager(); -public: - - static PluginManager& get(); - static void setServiceFactory( const Reference< com::sun::star::lang::XMultiServiceFactory >& xFactory ); - static const Sequence< rtl::OUString >& getAdditionalSearchPaths(); - - ::std::list& getPluginComms() { return m_aPluginComms; } - ::std::list& getPlugins() { return m_aAllPlugins; } - ::osl::Mutex& getPluginMutex() { return m_aPluginMutex; } -}; - -class XPluginManager_Impl : - public cppu::WeakAggImplHelper1< com::sun::star::plugin::XPluginManager > -{ - Reference< com::sun::star::lang::XMultiServiceFactory > m_xSMgr; -public: - XPluginManager_Impl( const Reference< com::sun::star::lang::XMultiServiceFactory > & ); - virtual ~XPluginManager_Impl(); - - static XPlugin_Impl* getXPluginFromNPP( NPP ); - static XPlugin_Impl* getPluginImplementation( const Reference< com::sun::star::plugin::XPlugin >& plugin ); - - virtual Reference< com::sun::star::plugin::XPluginContext > SAL_CALL createPluginContext() throw(); - - // has to be implemented per system - virtual Sequence< com::sun::star::plugin::PluginDescription > SAL_CALL impl_getPluginDescriptions(void) throw(); - // calls system specific impl_getPluginDescriptions - // checks whether plugins are disabled - virtual Sequence< com::sun::star::plugin::PluginDescription > SAL_CALL getPluginDescriptions(void) throw(); - - virtual Reference< com::sun::star::plugin::XPlugin > SAL_CALL createPlugin( const Reference< com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< rtl::OUString >& argn, const Sequence< rtl::OUString >& argv, const com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException ); - - virtual Reference< com::sun::star::plugin::XPlugin > SAL_CALL createPluginFromURL( const Reference< com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< rtl::OUString >& argn, const Sequence< rtl::OUString >& argv, const Reference< com::sun::star::awt::XToolkit > & toolkit, const Reference< com::sun::star::awt::XWindowPeer > & parent, const rtl::OUString& url ) throw(); - - virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw(); - virtual rtl::OUString SAL_CALL getImplementationName() throw(); - - Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ); - static Sequence< rtl::OUString > getSupportedServiceNames_Static(void) throw( ); - static rtl::OUString getImplementationName_Static() throw( ) - { - /** the soplayer uses this name in its source! maybe not after 5.2 */ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.extensions.PluginManager" )); - } -}; -Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception ); - -enum PluginStreamType { InputStream, OutputStream }; - -class PluginStream -{ -protected: - XPlugin_Impl* m_pPlugin; - NPStream m_aNPStream; -public: - PluginStream( XPlugin_Impl* pPlugin, - const char* url, sal_uInt32 len, sal_uInt32 lastmod ); - virtual ~PluginStream(); - - NPStream* getStream() { return &m_aNPStream; } - XPlugin_Impl* getPlugin() { return m_pPlugin; } - - virtual PluginStreamType getStreamType() = 0; -}; - -class PluginInputStream : - public PluginStream, - public cppu::WeakAggImplHelper2< - ::com::sun::star::io::XOutputStream, - ::com::sun::star::io::XConnectable - > -{ -private: - ::ucbhelper::Content* m_pContent; - sal_Int32 m_nMode; - sal_uInt32 m_nWritePos; - - Reference< com::sun::star::io::XActiveDataSource > m_xSource; - // hold a reference on input until closeOutput is called - - Reference< com::sun::star::io::XConnectable > m_xPredecessor; - Reference< com::sun::star::io::XConnectable > m_xSuccessor; - - // needed to hold a reference to self in NP_SEEK mode - Reference< com::sun::star::io::XOutputStream > m_xSelf; - - SvFileStream m_aFileStream; -public: - PluginInputStream( XPlugin_Impl* pPlugin, - const char* url, sal_uInt32 len, sal_uInt32 lastmod ); - - PluginInputStream() : PluginStream( NULL, NULL, 0, 0 ) {} - - virtual ~PluginInputStream(); - - virtual PluginStreamType getStreamType(); - - void setMode( sal_Int32 nMode ); - sal_uInt32 read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size ); - void setSource( const Reference< com::sun::star::io::XActiveDataSource >& xSource ) { m_xSource = xSource; } - // get contents ot url via ucbhelper::Content - void load(); - - // clear reference - bool releaseSelf() - { bool bRet = m_xSelf.is(); m_xSelf.clear(); return bRet; } - - // XOutputStream - virtual void SAL_CALL writeBytes( const Sequence& ) throw(); - virtual void SAL_CALL flush() throw(); - virtual void SAL_CALL closeOutput() throw(); - - // XConnectable - virtual void SAL_CALL setPredecessor( const Reference< com::sun::star::io::XConnectable >& xPredecessor ) throw() - { m_xPredecessor = xPredecessor; } - virtual Reference< com::sun::star::io::XConnectable > SAL_CALL getPredecessor() throw() - { return m_xPredecessor; } - - virtual void SAL_CALL setSuccessor( const Reference< com::sun::star::io::XConnectable >& xSuccessor ) throw() - { m_xSuccessor = xSuccessor; } - virtual Reference< com::sun::star::io::XConnectable > SAL_CALL getSuccessor() throw() - { return m_xSuccessor; } -}; - -class PluginOutputStream : public PluginStream -{ -private: - Reference< com::sun::star::io::XOutputStream > m_xStream; -public: - PluginOutputStream( XPlugin_Impl* pPlugin, const char* url, - sal_uInt32 len, sal_uInt32 lastmod ); - virtual ~PluginOutputStream(); - - virtual PluginStreamType getStreamType(); - - Reference< com::sun::star::io::XOutputStream > & getOutputStream() { return m_xStream; } -}; - -class PluginEventListener : - public cppu::WeakAggImplHelper1< com::sun::star::lang::XEventListener > -{ -private: - XPlugin_Impl* m_pPlugin; - Reference< com::sun::star::plugin::XPlugin > m_xPlugin; // just to hold the plugin - char* m_pUrl; - char* m_pNormalizedUrl; - void* m_pNotifyData; -public: - PluginEventListener( XPlugin_Impl*, - const char* url, - const char* normurl, - void* notifyData ); - virtual ~PluginEventListener(); - - const char* getURL() { return m_pUrl; } - const char* getNormalizedURL() { return m_pNormalizedUrl; } - void* getNotifyData() { return m_pNotifyData; } - - // com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw(); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/model.hxx b/extensions/source/plugin/inc/plugin/model.hxx deleted file mode 100644 index 5937a8d95..000000000 --- a/extensions/source/plugin/inc/plugin/model.hxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLUGIN_MODEL_HXX -#define __PLUGIN_MODEL_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace com::sun::star::uno; - -class BroadcasterHelperHolder -{ -protected: - ::cppu::OBroadcastHelper m_aHelper; -public: - BroadcasterHelperHolder( osl::Mutex& rMutex ) : - m_aHelper( rMutex ) {} - ~BroadcasterHelperHolder() {} - - ::cppu::OBroadcastHelper& getHelper() { return m_aHelper; } - -}; - -class PluginModel : public BroadcasterHelperHolder, - public cppu::OPropertySetHelper, - public cppu::OPropertyArrayHelper, - public cppu::OWeakAggObject, - public com::sun::star::lang::XComponent, - public com::sun::star::io::XPersistObject, - public com::sun::star::awt::XControlModel -{ - private: - rtl::OUString m_aCreationURL; - rtl::OUString m_aMimeType; - - std::list< Reference< com::sun::star::lang::XEventListener > > - m_aDisposeListeners; - public: - // these are here to force memory de/allocation to sal lib. - static void * SAL_CALL operator new( size_t nSize ) throw() - { return rtl_allocateMemory( nSize ); } - static void SAL_CALL operator delete( void * pMem ) throw() - { rtl_freeMemory( pMem ); } - - PluginModel(); - PluginModel( const rtl::OUString& rURL, const rtl::OUString& rMimeType ); - virtual ~PluginModel(); - - - const rtl::OUString& getCreationURL() { return m_aCreationURL; } - void setMimeType( const rtl::OUString& rMime ) { m_aMimeType = rMime; } - - // XInterface - virtual Any SAL_CALL queryInterface( const Type& rType ) throw( com::sun::star::uno::RuntimeException ) - { return OWeakAggObject::queryInterface( rType ); } - virtual void SAL_CALL acquire() throw() - { OWeakAggObject::acquire(); } - virtual void SAL_CALL release() throw() - { OWeakAggObject::release(); } - - virtual Any SAL_CALL queryAggregation( const Type& ) throw( com::sun::star::uno::RuntimeException ); - - - // com::sun::star::lang::XTypeProvider - - static Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw( ); - static rtl::OUString SAL_CALL getImplementationName_Static() throw( ) - { - /** the soplayer uses this name in its source! maybe not after 5.2 */ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.extensions.PluginModel" )); - } - - // OPropertySetHelper - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue, - Any & rOldValue, - sal_Int32 nHandle, - const Any& rValue ) throw(); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const Any& rValue ) - throw(::com::sun::star::uno::Exception); - virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const throw(); - virtual Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(); - - // com::sun::star::io::XPersistObject - virtual rtl::OUString SAL_CALL getServiceName() throw(); - virtual void SAL_CALL write(const Reference< com::sun::star::io::XObjectOutputStream > & OutStream) throw(); - virtual void SAL_CALL read(const Reference< com::sun::star::io::XObjectInputStream > & InStream) throw(); - - // com::sun::star::lang::XComponent - virtual void SAL_CALL addEventListener( const Reference< com::sun::star::lang::XEventListener > & l ) throw(); - virtual void SAL_CALL removeEventListener( const Reference< com::sun::star::lang::XEventListener > & l ) throw(); - virtual void SAL_CALL dispose() throw(); - private: - using cppu::OPropertySetHelper::getFastPropertyValue; -}; -Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception ); - -#endif // __PLUGIN_MODEL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/multiplx.hxx b/extensions/source/plugin/inc/plugin/multiplx.hxx deleted file mode 100644 index 4544304b7..000000000 --- a/extensions/source/plugin/inc/plugin/multiplx.hxx +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MRC_MULTIPLX_HXX -#define _MRC_MULTIPLX_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace com::sun::star::uno; - -struct MRCListenerMultiplexerHelper_Mutex -{ - ::osl::Mutex aMutex; -}; - -class MRCListenerMultiplexerHelper : - public MRCListenerMultiplexerHelper_Mutex, - - public ::cppu::WeakAggImplHelper7< - ::com::sun::star::awt::XFocusListener, - ::com::sun::star::awt::XWindowListener, - ::com::sun::star::awt::XKeyListener, - ::com::sun::star::awt::XMouseListener, - ::com::sun::star::awt::XMouseMotionListener, - ::com::sun::star::awt::XPaintListener, - ::com::sun::star::awt::XTopWindowListener > -{ -public: - /** - * Create a Multiplexer of XWindowEvents. - * - * @param rControl The control. All listeners think that this is the original - * broadcaster. - * @param rPeer The peer from which the original events are dispatched. Null is - * allowed. - */ - MRCListenerMultiplexerHelper( const Reference< ::com::sun::star::awt::XWindow > & rControl, const Reference< ::com::sun::star::awt::XWindow > & rPeer ); - - /** - * Remove all listeners from the previous set peer and add the needed listeners to rPeer. - * @param rPeer The peer from which the original events are dispatched. Null is - * allowed. - */ - void setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer ); - - /** - * Remove all listeners and send a disposing message. - */ - void disposeAndClear(); - - /** - * Add the specified listener to the source. - */ - void advise( const Type& type, const Reference< XInterface > & listener); - /** - * Remove the specified listener from the source. - */ - void unadvise(const Type& type, const Reference< XInterface > & listener); - - // ::com::sun::star::lang::XEventListener - void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(); - // ::com::sun::star::awt::XFocusListener - void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw(); - void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw(); - // ::com::sun::star::awt::XWindowListener - void SAL_CALL windowResized(const ::com::sun::star::awt::WindowEvent& e) throw(); - void SAL_CALL windowMoved(const ::com::sun::star::awt::WindowEvent& e) throw(); - void SAL_CALL windowShown(const ::com::sun::star::lang::EventObject& e) throw(); - void SAL_CALL windowHidden(const ::com::sun::star::lang::EventObject& e) throw(); - // ::com::sun::star::awt::XKeyListener - void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw(); - void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw(); - // ::com::sun::star::awt::XMouseListener - void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw(); - void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw(); - void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw(); - void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw(); - // ::com::sun::star::awt::XMouseMotionListener - void SAL_CALL mouseDragged(const ::com::sun::star::awt::MouseEvent& e) throw(); - void SAL_CALL mouseMoved(const ::com::sun::star::awt::MouseEvent& e) throw(); - // ::com::sun::star::awt::XPaintListener - void SAL_CALL windowPaint(const ::com::sun::star::awt::PaintEvent& e) throw(); - // ::com::sun::star::awt::XTopWindowListener - void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw(); - void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw(); -protected: - /** - * Remove the listener with the uik rUik from the peer rPeer. - * @param rPeer the peer from which the listener is removed. - * @param rUik the listener uik, which specify the type of the listener. - */ - void adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type ); - /** - * Add the listener with the uik rUik to the peer rPeer. - * @param rPeer the peer to which the listener is added. - * @param rUik the listener uik, which specify the type of the listener. - */ - void unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type ); -private: - /** The source of the events. Normally this is the peer object.*/ - Reference< ::com::sun::star::awt::XWindow > xPeer; - WeakReference< ::com::sun::star::awt::XControl > xControl; - ::cppu::OMultiTypeInterfaceContainerHelper aListenerHolder; - - - MRCListenerMultiplexerHelper( const MRCListenerMultiplexerHelper & ); - MRCListenerMultiplexerHelper & operator = ( const MRCListenerMultiplexerHelper & ); -}; - -#endif // _MRC_MULTIPLX_HXX - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/plcom.hxx b/extensions/source/plugin/inc/plugin/plcom.hxx deleted file mode 100644 index 8775a8450..000000000 --- a/extensions/source/plugin/inc/plugin/plcom.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLUGIN_INC_PLCOM_HXX -#define __PLUGIN_INC_PLCOM_HXX - -#include -#include - -class XPlugin_Impl; - -class PluginComm -{ -protected: - int m_nRefCount; - ::rtl::OString m_aLibName; - std::list< String > m_aFilesToDelete; -public: - PluginComm( const ::rtl::OString& rLibName, bool bReusable = true ); - virtual ~PluginComm(); - - int getRefCount() { return m_nRefCount; } - void addRef() { m_nRefCount++; } - void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; } - - const ::rtl::OString& getLibName() { return m_aLibName; } - void setLibName( const ::rtl::OString& rName ) { m_aLibName = rName; } - - void addFileToDelete( const String& filename ) - { m_aFilesToDelete.push_back( filename ); } - - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) = 0; - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, - NPError reason ) = 0; - virtual void* NPP_GetJavaClass() = 0; - virtual NPError NPP_Initialize() = 0; - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, - uint16 mode, int16 argc, - char* argn[], char* argv[], - NPSavedData *saved ) = 0; - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, - NPStream* stream, - NPBool seekable, uint16* stype ) = 0; - virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0; - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0; - virtual void NPP_Shutdown() = 0; - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, - const char* fname ) = 0; - virtual void NPP_URLNotify( NPP instance, const char* url, - NPReason reason, void* notifyData ) = 0; - virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer ) = 0; - virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ) = 0; - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0; - virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, - void *value) = 0; - - virtual NPError NPP_SetWindow( XPlugin_Impl* ); - virtual NPError NPP_Destroy( XPlugin_Impl*, NPSavedData** save ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/plctrl.hxx b/extensions/source/plugin/inc/plugin/plctrl.hxx deleted file mode 100644 index 0d424ed20..000000000 --- a/extensions/source/plugin/inc/plugin/plctrl.hxx +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLCTRL_HXX -#define __PLCTRL_HXX - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -class SystemChildWindow; - -//================================================================================================== -class PluginControl_Impl : public ::cppu::WeakAggImplHelper4< - ::com::sun::star::awt::XControl, - ::com::sun::star::awt::XWindow, - ::com::sun::star::awt::XFocusListener, - ::com::sun::star::awt::XView > -{ -public: - // ::com::sun::star::awt::XControl - virtual void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xContext ) throw( ::com::sun::star::uno::RuntimeException ) - { _xContext = xContext; } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext() throw( ::com::sun::star::uno::RuntimeException ) - { return _xContext; } - - virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( ::com::sun::star::uno::RuntimeException ) = 0; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw( ::com::sun::star::uno::RuntimeException ) = 0; - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw( ::com::sun::star::uno::RuntimeException ) - { return (::com::sun::star::awt::XView*)this; } - - virtual sal_Bool SAL_CALL isTransparent() throw( ::com::sun::star::uno::RuntimeException ) - { return sal_False; } - - virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL isDesignMode() throw( ::com::sun::star::uno::RuntimeException ) - { return _bInDesignMode; } - - virtual void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw( ::com::sun::star::uno::RuntimeException ) - { return _xPeer; } - - // ::com::sun::star::awt::XWindow - virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setFocus(void) throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(void) throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException ); - virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject & rSource ) throw( ::com::sun::star::uno::RuntimeException ); - // ::com::sun::star::awt::XFocusListener - virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::lang::XComponent - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::awt::XView - virtual sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > & /*aDevice*/ ) throw( ::com::sun::star::uno::RuntimeException ) - { return sal_False; } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(void) throw( ::com::sun::star::uno::RuntimeException ) - { return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > (); } - - virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw( ::com::sun::star::uno::RuntimeException ) - { return ::com::sun::star::awt::Size(_nWidth, _nHeight); } - - virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setZoom( float ZoomX, float ZoomY ) throw( ::com::sun::star::uno::RuntimeException ); - -public: - PluginControl_Impl(); - virtual ~PluginControl_Impl(); - - MRCListenerMultiplexerHelper* getMultiplexer(); - -protected: - void releasePeer(); - -protected: - ::std::list< Reference< ::com::sun::star::lang::XEventListener > > _aDisposeListeners; - MRCListenerMultiplexerHelper* _pMultiplexer; - - Reference< XInterface > _xContext; - - sal_Int32 _nX; - sal_Int32 _nY; - sal_Int32 _nWidth; - sal_Int32 _nHeight; - sal_Int16 _nFlags; - - sal_Bool _bVisible; - sal_Bool _bInDesignMode; - sal_Bool _bEnable; - - SystemChildWindow* _pSysChild; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > _xPeer; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > _xPeerWindow; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > _xParentWindow; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > _xParentPeer; -}; - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/mediator.hxx b/extensions/source/plugin/inc/plugin/unx/mediator.hxx deleted file mode 100644 index ff1eb2662..000000000 --- a/extensions/source/plugin/inc/plugin/unx/mediator.hxx +++ /dev/null @@ -1,186 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _MEDIATOR_HXX -#define _MEDIATOR_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -#include - -struct MediatorMessage -{ - sal_uLong m_nID; - sal_uLong m_nBytes; - char* m_pBytes; - char* m_pRun; - - MediatorMessage() : m_nID( 0 ), m_nBytes( 0 ), - m_pBytes( NULL ), m_pRun( NULL ) {} - MediatorMessage( sal_uLong nID, sal_uLong nBytes, char* pBytes ) : - m_nID( nID ),m_nBytes( nBytes ), m_pRun( NULL ) - { - m_pBytes = new char[ m_nBytes ]; - memcpy( m_pBytes, pBytes, (size_t)m_nBytes ); - } - - ~MediatorMessage() - { - if( m_pBytes ) - delete [] m_pBytes; - } - - void Set( sal_uLong nBytes, char* pBytes ) - { - if( m_pBytes ) - delete [] m_pBytes; - m_nBytes = nBytes; - m_pBytes = new char[ m_nBytes ]; - memcpy( m_pBytes, pBytes, (size_t)m_nBytes ); - } - - sal_uLong ExtractULONG(); - char* GetString(); - sal_uInt32 GetUINT32(); - void* GetBytes( sal_uLong& ); - void* GetBytes() { sal_uLong nBytes; return GetBytes( nBytes ); } - - void Rewind() { m_pRun = NULL; } -}; - -class MediatorListener; - -class Mediator -{ - friend class MediatorListener; -protected: - int m_nSocket; - - std::vector m_aMessageQueue; - osl::Mutex m_aQueueMutex; - osl::Mutex m_aSendMutex; - // only one thread can send a message at any given time - osl::Condition m_aNewMessageCdtn; - MediatorListener* m_pListener; - // thread to fill the queue - - sal_uLong m_nCurrentID; - // will be constantly increased with each message sent - bool m_bValid; - - Link m_aConnectionLostHdl; - Link m_aNewMessageHdl; -public: - Mediator( int nSocket ); - ~Mediator(); - - // mark mediator as invalid. No more messages will be processed, - // SendMessage, WaitForMessage, TransactMessage will return immediatly - // with error - void invalidate() { m_bValid = false; } - - sal_uLong SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong nMessageID = 0 ); - sal_uLong SendMessage( const ByteString& rMessage, sal_uLong nMessageID = 0 ) - { - return SendMessage( rMessage.Len(), rMessage.GetBuffer(), nMessageID ); - } - - sal_Bool WaitForMessage( sal_uLong nTimeOut = 5000 ); - // timeout in ms - // TRUE: Message came in - // FALSE: timed out - // if timeout is set, WaitForMessage will wait even if there are messages - // in the queue - - virtual MediatorMessage* WaitForAnswer( sal_uLong nMessageID ); - // wait for an answer message ( ID >= 1 << 24 ) - // the message will be removed from the queue and returned - - MediatorMessage* TransactMessage( sal_uLong nBytes, char* pBytes ); - // sends a message and waits for an answer - - MediatorMessage* GetNextMessage( sal_Bool bWait = sal_False ); - - - Link SetConnectionLostHdl( const Link& rLink ) - { - Link aRet = m_aConnectionLostHdl; - m_aConnectionLostHdl = rLink; - return aRet; - } - - Link SetNewMessageHdl( const Link& rLink ) - { - Link aRet = m_aNewMessageHdl; - m_aNewMessageHdl = rLink; - return aRet; - } -}; - -class MediatorListener : public osl::Thread -{ - friend class Mediator; - private: - Mediator* m_pMediator; - ::osl::Mutex m_aMutex; - - MediatorListener( Mediator* ); - ~MediatorListener(); - - virtual void run(); - virtual void onTerminated(); -}; - -inline void medDebug( int condition, const char* pFormat, ... ) -{ -#if OSL_DEBUG_LEVEL > 1 - if( condition ) - { - va_list ap; - va_start( ap, pFormat ); - vfprintf( stderr, pFormat, ap ); - va_end( ap ); - } -#else - (void)condition; - (void)pFormat; -#endif -} - -#endif // _MEDIATOR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx deleted file mode 100644 index 62dffea55..000000000 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _PLUGCON_HXX -#define _PLUGCON_HXX - -#include -#include - -#include -#include -#include - -#if defined SOLARIS -# define USE_MOTIF -#endif - -#define Window XLIB_Window -#define Font XLIB_Font -#define KeyCode XLIB_KeyCode -#define Time XLIB_Time -#define Cursor XLIB_Cursor -#define Region XLIB_Region -#define String XLIB_String -#define Boolean XLIB_Boolean -#define XPointer XLIB_XPointer -#include -extern "C" { -#include -} -#include -#include /* Intrinsics Definitions*/ -#include /* Standard Name-String definitions*/ -#if defined USE_MOTIF -#include -#else -#include -#endif -#include -#ifndef XP_UNIX -# define XP_UNIX -#endif -#define MOZ_X11 -#include -#ifdef SYSTEM_MOZILLA -#ifndef OJI -# define OJI -#endif -#define MOZ_X11 -#endif - -//http://qa.openoffice.org/issues/show_bug.cgi?id=82545 -//https://bugzilla.mozilla.org/show_bug.cgi?id=241262 -#ifdef UNIX -# ifndef _UINT32 -# if defined(__alpha) || defined(__LP64__) || defined(AIX) - typedef unsigned int uint32; -# else /* __alpha */ - typedef unsigned long uint32; -# endif -# define _UINT32 -# endif -# ifndef _INT32 -# if defined(__alpha) || defined(__LP64__) || defined(AIX) - typedef int int32; -# else /* __alpha */ - typedef long int32; -# endif -# define _INT32 -# endif -#endif - -#if ! defined ( _NPAPI_H_) && ! defined (npapi_h_) -extern "C" { -#include -} -#include - -#if NP_VERSION_MINOR < 17 -// compatibility hack: compile with older NPN api header, but define -// some later introduced constants -// for gcc 3 -#define NP_ABI_MASK 0x10000000 -#define NPNVSupportsXEmbedBool ((NPNVariable)14) -#define NPPVpluginNeedsXEmbed ((NPPVariable)14) -#define NPNVToolkit ((int)(13 | NP_ABI_MASK)) -#define NPNVGtk12 1 -#define NPNVGtk2 2 -#endif -#endif - -#ifdef ENABLE_GTK -#include -#include -#else -#define GtkWidget void -#endif - -#undef Window -#undef Font -#undef KeyCode -#undef Time -#undef Cursor -#undef String -#undef Region -#undef Boolean -#undef XPointer - -class ConnectorInstance -{ -public: - NPP instance; - NPWindow window; - NPSetWindowCallbackStruct ws_info; - char* pMimeType; - void* pShell; - void* pWidget; - void* pForm; - - GtkWidget* pGtkWindow; - GtkWidget* pGtkWidget; - - bool bShouldUseXEmbed; - - int nArg; - char** argn; - char** argv; - char* pArgnBuf; - char* pArgvBuf; - NPSavedData aData; - - ConnectorInstance( NPP inst, char* type, - int args, char* pargnbuf, sal_uLong nargnbytes, - char* pargvbuf, sal_uLong nargvbytes, - char* savedata, sal_uLong savebytes ); - ~ConnectorInstance(); -}; - -class PluginConnector : public Mediator -{ -protected: - osl::Mutex m_aUserEventMutex; - - static std::vector allConnectors; - - DECL_LINK( NewMessageHdl, Mediator* ); - DECL_LINK( WorkOnNewMessageHdl, Mediator* ); - - std::vector m_aNPWrapStreams; - std::vector m_aInstances; - - sal_uLong FillBuffer( char*&, const char*, sal_uLong, va_list ); -public: - PluginConnector( int nSocket ); - ~PluginConnector(); - - virtual MediatorMessage* WaitForAnswer( sal_uLong nMessageID ); - MediatorMessage* Transact( const char*, sal_uLong, ... ); - MediatorMessage* Transact( sal_uInt32, ... ); - void Respond( sal_uLong nID, char*, sal_uLong, ... ); - sal_uLong Send( sal_uInt32, ... ); - - static const sal_uInt32 UnknownStreamID = 0xffffffff; - static const sal_uInt32 UnknownNPPID = 0xffffffff; - - sal_uInt32 GetStreamID( NPStream* pStream ); - sal_uInt32 GetNPPID( NPP ); - - std::vector& getStreamList() { return m_aNPWrapStreams; } - - NPError GetNPError( MediatorMessage* pMes ) - { - NPError* pErr = (NPError*)pMes->GetBytes(); - NPError aErr = *pErr; - delete [] pErr; - return aErr; - } - - void CallWorkHandler() - { - LINK( this, PluginConnector, WorkOnNewMessageHdl ). - Call( (Mediator*)this ); - } - - ConnectorInstance* getInstance( NPP ); - ConnectorInstance* getInstanceById( sal_uInt32 ); -}; - -enum CommandAtoms -{ - eNPN_GetURL, - eNPN_GetURLNotify, - eNPN_DestroyStream, - eNPN_NewStream, - eNPN_PostURLNotify, - eNPN_PostURL, - eNPN_RequestRead, - eNPN_Status, - eNPN_Version, - eNPN_Write, - eNPN_UserAgent, - - eNPP_DestroyStream, - eNPP_Destroy, - eNPP_DestroyPhase2, - eNPP_NewStream, - eNPP_New, - eNPP_SetWindow, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_WriteReady, - eNPP_Write, - eNPP_GetMIMEDescription, - eNPP_Initialize, - eNPP_Shutdown, - - eMaxCommand -}; - -const char* GetCommandName( CommandAtoms ); - -#define POST_STRING( x ) x ? x : const_cast(""), x ? strlen(x) : 1 - -#endif // _PLUGCON_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx deleted file mode 100644 index 69d64f7ac..000000000 --- a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __PLUGIN_INC_UNXPLUG_HXX -#define __PLUGIN_INC_UNXPLUG_HXX - -#include - -#include -#include -#include - -class UnxPluginComm : public PluginComm, public PluginConnector -{ -private: - static int nConnCounter; - - pid_t m_nCommPID; -public: - UnxPluginComm( const String& mimetype, - const String& library, - XLIB_Window aParent, - int nDescriptor1, - int nDescriptor2 - ); - virtual ~UnxPluginComm(); - - using PluginComm::NPP_Destroy; - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, - NPError reason ); - virtual void* NPP_GetJavaClass(); - virtual NPError NPP_Initialize(); - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, - uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ); - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, - NPStream* stream, - NPBool seekable, uint16* stype ); - virtual void NPP_Print( NPP instance, NPPrint* platformPrint ); - - using PluginComm::NPP_SetWindow; - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ); - virtual void NPP_Shutdown(); - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, - const char* fname ); - virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason, - void* notifyData ); - virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer ); - virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ); - virtual char* NPP_GetMIMEDescription(); - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ); - virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, - void *value); - - static bool getPluginappPath(rtl::OString * path); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/inc/plugin/win/sysplug.hxx b/extensions/source/plugin/inc/plugin/win/sysplug.hxx deleted file mode 100644 index cd351b517..000000000 --- a/extensions/source/plugin/inc/plugin/win/sysplug.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __PLUGIN_INC_WINPLUG_HXX -#define __PLUGIN_INC_WINPLUG_HXX - -#pragma warning (push,1) -#pragma warning (disable:4005) - -#include - -#pragma pack( push, 8 ) -#include -#include -#pragma pack( pop ) - -#pragma warning (pop) - -#include -#include -#include - -#include -#include - -//================================================================================================== -class PluginComm_Impl : - public PluginComm, - public ::vcl::SolarThreadExecutor - -{ - enum CallType { - eNPP_Destroy, - eNPP_DestroyStream, - eNPP_GetJavaClass, - eNPP_Initialize, - eNPP_New, - eNPP_NewStream, - eNPP_Print, - eNPP_SetWindow, - eNPP_Shutdown, - eNPP_StreamAsFile, - eNPP_URLNotify, - eNPP_Write, - eNPP_WriteReady, - eNPP_GetValue, - eNPP_SetValue, - eNP_Initialize - }; - - void* m_aArgs[ 8 ]; - CallType m_eCall; - - virtual long doIt(); -public: - PluginComm_Impl( const rtl::OUString& rMIME, const rtl::OUString& rName, HWND hWnd ); - virtual ~PluginComm_Impl(); - -public: - using PluginComm::NPP_Destroy; - virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ); - virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ); - virtual void * NPP_GetJavaClass(); - virtual NPError NPP_Initialize(); - virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ); - virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype ); - virtual void NPP_Print( NPP instance, NPPrint* platformPrint ); - - using PluginComm::NPP_SetWindow; - virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ); - virtual void NPP_Shutdown(); - virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ); - virtual void NPP_URLNotify( NPP instance, const char* url, - NPReason reason, void* notifyData ); - virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset, - int32 len, void* buffer ); - virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ); - virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue ); - virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue ); - -private: - BOOL retrieveFunction( TCHAR* pName, void** ppFunc ) const; - -private: - HINSTANCE _plDLL; - - NPPluginFuncs _NPPfuncs; -}; - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/makefile.mk b/extensions/source/plugin/unx/makefile.mk deleted file mode 100644 index 9dcdf1ace..000000000 --- a/extensions/source/plugin/unx/makefile.mk +++ /dev/null @@ -1,104 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=plunx -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : ..$/util$/makefile.pmk - -.IF "$(GUIBASE)"=="aqua" -dummy: - @echo "Nothing to build for GUIBASE aqua." - -.ELSE - -# --- Files -------------------------------------------------------- - -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin -.IF "$(SOLAR_JAVA)" != "" -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr -CDEFS+=-DOJI -.ENDIF - -.IF "$(WITH_MOZILLA)" != "NO" - -SLOFILES=\ - $(SLO)$/nppapi.obj \ - $(SLO)$/sysplug.obj \ - $(SLO)$/mediator.obj \ - $(SLO)$/plugcon.obj \ - $(SLO)$/unxmgr.obj - -OBJFILES=\ - $(OBJ)$/npwrap.obj \ - $(OBJ)$/npnapi.obj \ - $(OBJ)$/mediator.obj \ - $(OBJ)$/plugcon.obj - -APP1TARGET=pluginapp.bin -APP1OBJS=$(OBJFILES) -APP1STDLIBS= $(SALLIB) - -.IF "$(OS)"=="SOLARIS" || "$(OS)"=="SCO" -APP1STDLIBS+=-lXm -lXt $(X11LINK_DYNAMIC) -ldl -.ELSE -.IF "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || "$(OS)"=="OPENBSD" || "$(OS)"=="DRAGONFLY" -APP1STDLIBS+= -lXt -lXext -lX11 -.ELIF "$(OS)"=="AIX" -APP1STDLIBS+= -lXpm -lXmu -lXt $(X11LINK_DYNAMIC) -ldl -.ELSE -APP1STDLIBS+= -lXt $(X11LINK_DYNAMIC) -ldl -.ENDIF -.ENDIF - -.IF "$(ENABLE_GTK)" == "TRUE" -# libs for gtk plugin -APP1STDLIBS+=$(PKGCONFIG_LIBS:s/ -lpangoxft-1.0//) -# hack for faked SO environment -.IF "$(PKGCONFIG_ROOT)"!="" -.IF "$(OS)" == "SOLARIS" -# don't ask, it's ugly -DIRECT :=-z nodefs $(DIRECT) -.ENDIF -.ENDIF # "$(PKGCONFIG_ROOT)"!="" -.ENDIF - - -APP1DEF= $(MISC)$/$(TARGET).def - -.ENDIF # $(WITH_MOZILLA) != "NO" - -.ENDIF # $(GUIBASE)==aqua - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/extensions/source/plugin/unx/mediator.cxx b/extensions/source/plugin/unx/mediator.cxx deleted file mode 100644 index e44c1b3d9..000000000 --- a/extensions/source/plugin/unx/mediator.cxx +++ /dev/null @@ -1,312 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include - -#include -#include - -#define MEDIATOR_MAGIC 0xf7a8d2f4 - -Mediator::Mediator( int nSocket ) : - m_nSocket( nSocket ), - m_pListener( NULL ), - m_nCurrentID( 1 ), - m_bValid( true ) -{ - m_pListener = new MediatorListener( this ); - m_pListener->create(); -} - -Mediator::~Mediator() -{ - if( m_pListener ) - { - { - ::osl::MutexGuard aGuard( m_pListener->m_aMutex ); - m_pListener->m_pMediator = NULL; - } - m_pListener = NULL; - if( m_bValid ) - { - sal_uLong aHeader[3]; - aHeader[0] = 0; - aHeader[1] = 0; - aHeader[2] = MEDIATOR_MAGIC; - write( m_nSocket, aHeader, sizeof( aHeader ) ); - } - // kick the thread out of its run method; it deletes itself - close( m_nSocket ); - } - else - close( m_nSocket ); - for( std::vector< MediatorMessage* >::iterator it = m_aMessageQueue.begin(); - it != m_aMessageQueue.end(); ++it ) - { - delete *it; - } -} - - -sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong nMessageID ) -{ - if( ! m_pListener ) - return 0; - - osl::MutexGuard aGuard( m_aSendMutex ); - if( ! nMessageID ) - nMessageID = m_nCurrentID; - - m_nCurrentID++; - if( m_nCurrentID >= 1 << 24 ) // protection against overflow - m_nCurrentID = 1; - - if( ! m_bValid ) - return nMessageID; - - sal_uLong* pBuffer = new sal_uLong[ (nBytes/sizeof(sal_uLong)) + 4 ]; - pBuffer[ 0 ] = nMessageID; - pBuffer[ 1 ] = nBytes; - pBuffer[ 2 ] = MEDIATOR_MAGIC; - memcpy( &pBuffer[3], pBytes, (size_t)nBytes ); - write( m_nSocket, pBuffer, nBytes + 3*sizeof( sal_uLong ) ); - delete [] pBuffer; - - return nMessageID; -} - -sal_Bool Mediator::WaitForMessage( sal_uLong nTimeOut ) -{ - if( ! m_pListener ) - return sal_False; - - size_t nItems = m_aMessageQueue.size(); - - if( ! nTimeOut && nItems > 0 ) - return sal_True; - - TimeValue aValue; - aValue.Seconds = nTimeOut/1000; - aValue.Nanosec = ( nTimeOut % 1000 ) * 1000; - - while( m_aMessageQueue.size() == nItems ) - { - m_aNewMessageCdtn.wait( & aValue ); - m_aNewMessageCdtn.reset(); - if( nTimeOut && m_aMessageQueue.size() == nItems ) - return sal_False; - } - return sal_True; -} - -MediatorMessage* Mediator::WaitForAnswer( sal_uLong nMessageID ) -{ - nMessageID &= 0x00ffffff; - while( m_pListener ) - { - { - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - sal_uLong nID = pMessage->m_nID; - if( ( nID & 0xff000000 ) && - ( ( nID & 0x00ffffff ) == nMessageID ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - } - WaitForMessage( 10 ); - } - return NULL; -} - -MediatorMessage* Mediator::GetNextMessage( sal_Bool bWait ) -{ - while( m_pListener ) - { - { - // guard must be after WaitForMessage, else the listener - // cannot insert a new one -> deadlock - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - if( ! ( pMessage->m_nID & 0xff000000 ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - if( ! bWait ) - return NULL; - } - WaitForMessage(); - } - return NULL; -} - -MediatorMessage* Mediator::TransactMessage( sal_uLong nBytes, char* pBytes ) -{ - sal_uLong nID = SendMessage( nBytes, pBytes ); - return WaitForAnswer( nID ); -} - -MediatorListener::MediatorListener( Mediator* pMediator ) : - m_pMediator( pMediator ) -{ -} - -MediatorListener::~MediatorListener() -{ -} - -void MediatorListener::run() -{ - bool bRun = true; - while( schedule() && m_pMediator && bRun ) - { - sal_uLong nHeader[ 3 ]; - int nBytes; - - if( m_pMediator && ( nBytes = read( m_pMediator->m_nSocket, nHeader, sizeof( nHeader ) ) ) == sizeof( nHeader ) && nHeader[2] == MEDIATOR_MAGIC) - { - if( nHeader[ 0 ] == 0 && nHeader[ 1 ] == 0 ) - return; - char* pBuffer = new char[ nHeader[ 1 ] ]; - if( m_pMediator && (sal_uLong)read( m_pMediator->m_nSocket, pBuffer, nHeader[ 1 ] ) == nHeader[ 1 ] ) - { - ::osl::MutexGuard aMyGuard( m_aMutex ); - { - osl::MutexGuard - aGuard( m_pMediator->m_aQueueMutex ); - MediatorMessage* pMessage = - new MediatorMessage( nHeader[ 0 ], nHeader[ 1 ], pBuffer ); - m_pMediator->m_aMessageQueue.push_back( pMessage ); - } - m_pMediator->m_aNewMessageCdtn.set(); - m_pMediator->m_aNewMessageHdl.Call( m_pMediator ); - } - else - { - medDebug( 1, "got incomplete MediatorMessage: { %d, %d, %*s }\n", - nHeader[0], nHeader[1], nHeader[1], pBuffer ); - bRun = false; - } - delete [] pBuffer; - } - else - { - medDebug( 1, "got incomplete message header of %d bytes ( nHeader = [ %u, %u ] ), errno is %d\n", - nBytes, nHeader[ 0 ], nHeader[ 1 ], (int)errno ); - bRun = false; - } - } -} - -void MediatorListener::onTerminated() -{ - if( m_pMediator ) - { - m_pMediator->m_aConnectionLostHdl.Call( m_pMediator ); - m_pMediator->m_pListener = NULL; - } - delete this; -} - -sal_uLong MediatorMessage::ExtractULONG() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::ExtractULONG\n" ); - sal_uLong nCount; - memcpy( &nCount, m_pRun, sizeof( sal_uLong ) ); - m_pRun += sizeof( sal_uLong ); - return nCount; -} - -void* MediatorMessage::GetBytes( sal_uLong& rBytes ) -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetBytes\n" ); - sal_uLong nBytes = ExtractULONG(); - - if( nBytes == 0 ) - return NULL; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetBytes\n" ); - char* pBuffer = new char[ nBytes ]; - memcpy( pBuffer, m_pRun, nBytes ); - m_pRun += nBytes; - rBytes = nBytes; - return pBuffer; -} - -char* MediatorMessage::GetString() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetString\n" ); - sal_uLong nBytes = ExtractULONG(); - - if( nBytes == 0 ) - return NULL; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetString\n" ); - char* pBuffer = new char[ nBytes+1 ]; - memcpy( pBuffer, m_pRun, nBytes ); - pBuffer[ nBytes ] = 0; - m_pRun += nBytes; - return pBuffer; -} - -sal_uInt32 MediatorMessage::GetUINT32() -{ - if( ! m_pRun ) - m_pRun = m_pBytes; - - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetUINT32\n" ); - sal_uLong nBytes = ExtractULONG(); - medDebug( nBytes != sizeof( sal_uInt32 ), "No sal_uInt32 in MediatorMessage::GetUINT32\n" ); - medDebug( (sal_uLong)(m_pRun - m_pBytes) >= m_nBytes, "Overflow in MediatorMessage::GetUINT32\n" ); - sal_uInt32 nRet; - memcpy( &nRet, m_pRun, sizeof( nRet ) ); - m_pRun += sizeof( sal_uInt32 ); - return nRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx deleted file mode 100644 index 145bac0b5..000000000 --- a/extensions/source/plugin/unx/npnapi.cxx +++ /dev/null @@ -1,905 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include - -#include - -extern PluginConnector* pConnector; -extern XtAppContext app_context; -extern int wakeup_fd[]; -extern Widget topLevel, topBox; -extern Display* pAppDisplay; -extern Display* pXtAppDisplay; -extern int nAppArguments; -extern char** pAppArguments; - -void* CreateNewShell( void**, XLIB_Window ); - -// begin Netscape plugin api calls -extern "C" { - -static void* l_NPN_MemAlloc( uint32 nBytes ) -{ - void* pMem = new char[nBytes]; - return pMem; -} - -static void l_NPN_MemFree( void* pMem ) -{ - delete [] (char*)pMem; -} - -static uint32 l_NPN_MemFlush( uint32 /*nSize*/ ) -{ - return 0; -} - -static NPError l_NPN_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_DestroyStream, - &nInstance, sizeof( nInstance ), - &nFileID, sizeof( nFileID ), - POST_STRING( stream->url ), - &reason, sizeof( reason ), - NULL ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - for( std::vector< NPStream* >::iterator it = pConnector->getStreamList().begin(); - it != pConnector->getStreamList().end(); ++it ) - { - if( *it == stream ) - { - pConnector->getStreamList().erase( it ); - break; - } - } - delete [] stream->url; - delete stream; - // returns NPError - NPError aRet = pConnector->GetNPError( pMes ); - delete pMes; - return aRet; -} - -#ifdef OJI -static JRIEnv* l_NPN_GetJavaEnv() -{ - // no java in this program - medDebug( 1, "SNI: NPN_GetJavaEnv\n" ); - return NULL; -} - -static jref l_NPN_GetJavaPeer( NPP /*instance*/ ) -{ - medDebug( 1, "SNI: NPN_GetJavaPeer\n" ); - return NULL; -} -#endif - -static NPError l_NPN_GetURL( NPP instance, const char* url, const char* window ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_GetURL, - &nInstance, sizeof( nInstance ), - POST_STRING(url), - POST_STRING(window), - NULL ); - medDebug( !pMes, "geturl: message unaswered\n" ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns NPError - NPError aRet = pConnector->GetNPError( pMes ); - medDebug( aRet, "geturl returns %d\n", (int)aRet ); - delete pMes; - return aRet; -} - -static NPError l_NPN_GetURLNotify( NPP instance, const char* url, const char* target, - void* notifyData ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_GetURLNotify, - &nInstance, sizeof( nInstance ), - POST_STRING(url), - POST_STRING(target), - ¬ifyData, sizeof( void* ), // transmit the actual pointer - // since it is a pointer to private data fed back - // by NPP_URLNotify; this can be thought of as an ID - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns NPError - NPError aRet = pConnector->GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_NewStream( NPP instance, NPMIMEType type, const char* target, - NPStream** stream ) - // stream is a return value -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes= - pConnector-> - Transact( eNPN_NewStream, - &nInstance, sizeof( nInstance ), - POST_STRING(type), - POST_STRING(target), - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - // returns a new NPStream and an error - NPError aRet = pConnector->GetNPError( pMes ); - if( ! aRet ) - { - NPStream* pStream = new NPStream; - pStream->url = pMes->GetString(); - pStream->end = pMes->GetUINT32(); - pStream->lastmodified = pMes->GetUINT32(); - pStream->ndata = pStream->pdata = pStream->notifyData = NULL; - - pConnector->getStreamList().push_back( pStream ); - *stream = pStream; - } - - delete pMes; - return aRet; -} - -static NPError l_NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_PostURLNotify, - &nInstance, sizeof( nInstance ), - POST_STRING( url ), - POST_STRING( target ), - &len, sizeof( len ), - buf, len, - &file, sizeof( NPBool ), - ¬ifyData, sizeof( void* ), // send the real pointer - NULL ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = pConnector->GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_PostURL, - &nInstance, sizeof( nInstance ), - POST_STRING( url ), - POST_STRING( window ), - &len, sizeof( len ), - buf, len, - &file, sizeof( NPBool ), - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = pConnector->GetNPError( pMes ); - delete pMes; - return aRet; -} - -static NPError l_NPN_RequestRead( NPStream* stream, NPByteRange* rangeList ) -{ - medDebug( 1, "pluginapp: NPN_RequestRead\n" ); - - NPByteRange* pRange = rangeList; - sal_uInt32 nRanges = 0; - while( pRange ) - { - nRanges++; - pRange = pRange->next; - } - - sal_uInt32* pArray = new sal_uInt32[ 2 * nRanges ]; - pRange = rangeList; - sal_uInt32 n = 0; - while( pRange ) - { - pArray[ 2*n ] = (sal_uInt32)pRange->offset; - pArray[ 2*n + 1] = (sal_uInt32)pRange->length; - n++; - pRange = pRange->next; - } - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - MediatorMessage* pMes = pConnector-> - Transact( eNPN_RequestRead, - &nFileID, sizeof( nFileID ), - &nRanges, sizeof( nRanges ), - pArray, sizeof( sal_uInt32 ) * 2 * nRanges, - NULL ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = pConnector->GetNPError( pMes ); - delete [] pArray; - delete pMes; - return aRet; -} - -static void l_NPN_Status( NPP instance, const char* message ) -{ - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return; - - pConnector->Send( eNPN_Status, - &nInstance, sizeof( nInstance ), - POST_STRING( message ), - NULL ); -} - -static const char* l_NPN_UserAgent( NPP instance ) -{ - static char* pAgent = NULL; - - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - { - if( instance ) - return "Mozilla 3.0"; - else // e.g. flashplayer calls NPN_UserAgent with NULL - nInstance = 0; - } - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_UserAgent, - &nInstance, sizeof( nInstance ), - NULL ); - - if( ! pMes ) - return pAgent; - - if( pAgent ) - delete [] pAgent; - pAgent = pMes->GetString(); - - delete pMes; - - medDebug( 1, "NPN_UserAgent returns %s\n", pAgent ); - - return pAgent; -} - -static int32 l_NPN_Write( NPP instance, NPStream* stream, int32 len, void* buffer ) -{ - sal_uInt32 nFileID = pConnector->GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return NPERR_GENERIC_ERROR; - sal_uInt32 nInstance = pConnector->GetNPPID( instance ); - if( nInstance == PluginConnector::UnknownNPPID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = pConnector-> - Transact( eNPN_Write, - &nInstance, sizeof( nInstance ), - &nFileID, sizeof( nFileID ), - &len, sizeof( len ), - buffer, len, - NULL ); - - if( ! pMes ) - return 0; - - sal_Int32 nRet = pMes->GetUINT32(); - return nRet; -} - -static void l_NPN_ReloadPlugins( NPBool /*reloadPages*/ ) -{ - medDebug( 1, "NPN_ReloadPlugins: SNI\n" ); -} - -static NPError l_NPN_GetValue( NPP, NPNVariable variable, void* value ) -{ - /* - * We want to handle values injected into a NPNVariable which aren't in - * the old enum we build against, but that we know are in the new enum - * we want to support - */ - switch( (int)variable ) - { - case NPNVxDisplay: - *((Display**)value) = pXtAppDisplay; - medDebug( 1, "Display requested\n" ); - break; - case NPNVxtAppContext: - *((XtAppContext*)value) = app_context; - medDebug( 1, "AppContext requested\n" ); - break; - case NPNVjavascriptEnabledBool: - // no javascript - *(NPBool*)value = false; - medDebug( 1, "javascript enabled requested\n" ); - break; - case NPNVasdEnabledBool: - // no SmartUpdate - *(NPBool*)value = false; - medDebug( 1, "smart update enabled requested\n" ); - break; - case NPNVisOfflineBool: - // no offline browsing - *(NPBool*)value = false; - medDebug( 1, "offline browsing requested\n" ); - break; - case NPNVSupportsXEmbedBool: - // asking xembed - *(int*)value = true; - medDebug( 1, "xembed requested\n" ); - break; - case NPNVToolkit: -# ifdef ENABLE_GTK - *(int*)value = NPNVGtk2; -# else - *(int*)value = 0; -# endif - medDebug( 1, "toolkit requested\n" ); - break; - default: - medDebug( 1, "unknown NPNVariable %x requested\n", variable ); - return NPERR_INVALID_PARAM; - } - return NPERR_NO_ERROR; -} - -static NPError l_NPN_SetValue(NPP /*instance*/, NPPVariable variable, void *value) -{ - medDebug( 1, "NPN_SetValue %d=%p\n", variable, value ); - return 0; -} - -static void l_NPN_InvalidateRect(NPP /*instance*/, NPRect* /*invalidRect*/) -{ - medDebug( 1, "NPN_InvalidateRect\n" ); -} - -static void l_NPN_InvalidateRegion(NPP /*instance*/, NPRegion /*invalidRegion*/) -{ - medDebug( 1, "NPN_InvalidateRegion\n" ); -} - -static void l_NPN_ForceRedraw(NPP /*instance*/) -{ - medDebug( 1, "NPN_ForceRedraw\n" ); -} - -} - -static NPNetscapeFuncs aNetscapeFuncs = -{ - sizeof(aNetscapeFuncs), - (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR, - l_NPN_GetURL, - l_NPN_PostURL, - l_NPN_RequestRead, - l_NPN_NewStream, - l_NPN_Write, - l_NPN_DestroyStream, - l_NPN_Status, - l_NPN_UserAgent, - l_NPN_MemAlloc, - l_NPN_MemFree, - l_NPN_MemFlush, - l_NPN_ReloadPlugins, -# ifdef OJI - l_NPN_GetJavaEnv, - l_NPN_GetJavaPeer, -# else - NULL, - NULL, -# endif - l_NPN_GetURLNotify, - l_NPN_PostURLNotify, - l_NPN_GetValue, - l_NPN_SetValue, - l_NPN_InvalidateRect, - l_NPN_InvalidateRegion, - l_NPN_ForceRedraw -}; - -static NPPluginFuncs aPluginFuncs = -{ - sizeof(aPluginFuncs), - (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; - - -oslModule pPluginLib = NULL; -char*(*pNPP_GetMIMEDescription)() = NULL; -NPError (*pNP_Initialize)(NPNetscapeFuncs*,NPPluginFuncs*) = NULL; -NPError (*pNP_Shutdown)() = NULL; - -std::vector< PluginConnector* > PluginConnector::allConnectors; - -PluginConnector::PluginConnector( int nSocket ) : - Mediator( nSocket ) -{ - SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) ); -} - -PluginConnector::~PluginConnector() -{ -} - -IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) -{ - MediatorMessage* pMessage; - CommandAtoms nCommand; - while( (pMessage = GetNextMessage( sal_False )) ) - { - nCommand = (CommandAtoms)pMessage->GetUINT32(); - medDebug( 1, "pluginapp: %s\n", GetCommandName( nCommand ) ); - switch( nCommand ) - { - case eNPP_DestroyStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - NPError aReason = GetNPError( pMessage ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - - aReason = aPluginFuncs.destroystream( instance, pStream, aReason ); - Respond( pMessage->m_nID, - (char*)&aReason, sizeof( aReason ), - NULL ); - - delete [] pStream->url; - delete pStream; - } - break; - case eNPP_Destroy: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - - // some plugin rely on old netscapes behaviour - // to first destroy the widget and then destroy - // the instance, so mimic that behaviour here - if( pInst->pShell ) - XtDestroyWidget( (Widget)pInst->pShell ); - - pInst->pWidget = pInst->pShell = NULL; - - // the other side will call eNPP_DestroyPhase2 after this - NPError aReason = NPERR_NO_ERROR; - Respond( pMessage->m_nID, (char*)&aReason, sizeof( aReason ), NULL ); - } - break; - case eNPP_DestroyPhase2: - { - // now really destroy the instance - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPP instance = pInst->instance; - NPSavedData* pSave = NULL; - - NPError aRet = aPluginFuncs.destroy( instance, &pSave ); - if( pSave ) - { - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - pSave->buf, pSave->len, - NULL ); - delete [] (char*)pSave->buf; - } - else - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - "0000", 4, - NULL ); - - #ifdef ENABLE_GTK - if( pInst->pGtkWindow ) - g_object_unref( G_OBJECT(pInst->pGtkWindow) ); - if( pInst->pGtkWidget ) - g_object_unref( G_OBJECT(pInst->pGtkWidget) ); - #endif - - m_aInstances.erase( m_aInstances.begin() + nInstance ); - delete pInst; - delete instance; - medDebug( 1, "destroyed instance (returning %d)\n", aRet ); - } - break; - case eNPP_NewStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pType = pMessage->GetString(); - NPStream* pStream = new NPStream; - pStream->url = pMessage->GetString(); - pStream->end = pMessage->GetUINT32(); - pStream->lastmodified = pMessage->GetUINT32(); - pStream->pdata = pStream->ndata = pStream->notifyData = NULL; - NPBool* pSeekable = (NPBool*)pMessage->GetBytes(); - m_aNPWrapStreams.push_back( pStream ); - uint16 nStype = NP_ASFILE; - NPError aRet = aPluginFuncs.newstream( instance, pType, pStream, - *pSeekable, &nStype ); - medDebug( 1, "pluginapp: NPP_NewStream( %p, %s, %p, %s, %p ) returns %d\n" - "stream = { pdata = %p, ndata = %p, url = %s, end = %d, lastmodified = %d, notifyData = %p }\n", - instance, pType, pStream, *pSeekable ? "seekable" : "not seekable", &nStype, (int)aRet, - pStream->pdata, pStream->ndata, pStream->url, pStream->end, pStream->lastmodified, pStream->notifyData ); - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - &nStype, sizeof( nStype ), - NULL ); - delete [] pType; - delete [] pSeekable; - } - break; - case eNPP_New: - { - char* pType = pMessage->GetString(); - uint16* pMode = (uint16*)pMessage->GetBytes(); - int16* pArgc = (int16*)pMessage->GetBytes(); - NPP instance = new NPP_t; - instance->pdata = instance->ndata = NULL; - sal_uLong nArgnBytes, nArgvBytes; - char* pArgn = (char*)pMessage->GetBytes( nArgnBytes ); - char* pArgv = (char*)pMessage->GetBytes( nArgvBytes ); - sal_uLong nSaveBytes; - char* pSavedData = (char*)pMessage->GetBytes( nSaveBytes ); - ConnectorInstance* pInst = - new ConnectorInstance( instance, pType, - *pArgc, - pArgn, nArgnBytes, - pArgv, nArgvBytes, - pSavedData, nSaveBytes ); - m_aInstances.push_back( pInst ); - NPError aRet; - aRet = aPluginFuncs.newp( pInst->pMimeType, instance, *pMode, *pArgc, - pInst->nArg ? pInst->argn : NULL, - pInst->nArg ? pInst->argv : NULL, - ( nSaveBytes == 4 && *(sal_uInt32*)pSavedData == 0 ) ? - &(pInst->aData) : NULL ); - medDebug( 1, "pluginapp: NPP_New( %s, %p, %d, %d, %p, %p, %p ) returns %d\n", - pInst->pMimeType, - instance, *pMode, pInst->nArg, pInst->argn, pInst->argv, &pInst->aData, - (int) aRet ); -#if OSL_DEBUG_LEVEL > 1 - for( int i = 0; i < pInst->nArg; i++ ) - medDebug( 1, " \"%s\"=\"%s\"\n", pInst->argn[i], pInst->argv[i] ); -#endif - - #ifdef ENABLE_GTK - // check if XEMBED is to be used - // ask for Bool. there seems to be no clear definition whether the - // return value should be an int or unsigned char - // int can hold both and will be nonzero in case of "true" - if( aPluginFuncs.getvalue ) - { - int bNeedsXEmbed = 0; - NPError error = aPluginFuncs.getvalue( instance, NPPVpluginNeedsXEmbed, (void *)&bNeedsXEmbed ); - if( error == NPERR_NO_ERROR ) - pInst->bShouldUseXEmbed = (bNeedsXEmbed != 0); - medDebug( 1, "should use xembed = %s\n", pInst->bShouldUseXEmbed ? "true" : "false" ); - } - #endif - - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - NULL ); - delete [] pMode; - delete [] pArgc; - delete [] pType; - } - break; - case eNPP_SetWindow: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - ConnectorInstance* pInst= m_aInstances[ nInstance ]; - NPWindow* pWindow = (NPWindow*)pMessage->GetBytes(); - - if( pWindow->width < 1 ) - pWindow->width = 1; - if( pWindow->height < 1 ) - pWindow->height = 1; - - #ifdef ENABLE_GTK - if( pInst->bShouldUseXEmbed ) - { - if( ! pInst->pGtkWidget ) - { - medDebug( 1, "creating gtk plug and socket\n" ); - - pInst->pGtkWindow = gtk_plug_new((GdkNativeWindow)reinterpret_cast(pWindow->window)); - gtk_widget_show( pInst->pGtkWindow ); - pInst->pGtkWidget = gtk_socket_new(); - gtk_widget_show( pInst->pGtkWidget ); - gtk_container_add( GTK_CONTAINER(pInst->pGtkWindow), pInst->pGtkWidget ); - gtk_widget_show_all( pInst->pGtkWindow ); - pInst->window.window = (void *)(sal_uIntPtr)gtk_socket_get_id( GTK_SOCKET(pInst->pGtkWidget ) ); - - XSync( pAppDisplay, False ); - - XMapWindow( pAppDisplay, GDK_WINDOW_XWINDOW(pInst->pGtkWindow->window) ); - - XSync( pAppDisplay, False ); - } - - // update widget size; alas out parent is not yet really XEMBED conformant - gtk_widget_set_size_request( pInst->pGtkWidget, pWindow->width, pWindow->height ); - gtk_window_resize( GTK_WINDOW(pInst->pGtkWindow), pWindow->width, pWindow->height ); - - GdkScreen* pGdkScreen = gtk_widget_get_screen( pInst->pGtkWidget ); - Screen* pScreen = ScreenOfDisplay( pAppDisplay, gdk_screen_get_number( pGdkScreen ) ); - - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = pAppDisplay; - pInst->ws_info.visual = DefaultVisualOfScreen( pScreen ); - pInst->ws_info.colormap = DefaultColormapOfScreen( pScreen ); - pInst->ws_info.depth = DefaultDepthOfScreen( pScreen ); - } - else - #endif - { - if( ! pInst->pWidget ) - { - pInst->pWidget = CreateNewShell( &(pInst->pShell), (XLIB_Window)pWindow->window ); - } - - // fill in NPWindow and NPCallbackStruct - pInst->window.window = (void*)XtWindow( (Widget)pInst->pWidget ); - pInst->window.x = 0; - pInst->window.y = 0; - pInst->window.width = pWindow->width; - pInst->window.height = pWindow->height; - pInst->window.clipRect.left = 0; - pInst->window.clipRect.top = 0; - pInst->window.clipRect.right = pWindow->width; - pInst->window.clipRect.bottom = pWindow->height; - pInst->window.ws_info = &pInst->ws_info; - pInst->window.type = NPWindowTypeWindow; - pInst->ws_info.type = NP_SETWINDOW; - pInst->ws_info.display = XtDisplay( (Widget)pInst->pWidget ); - pInst->ws_info.visual = DefaultVisualOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.colormap = DefaultColormapOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - pInst->ws_info.depth = DefaultDepthOfScreen( XtScreen( (Widget)pInst->pWidget ) ); - - XtResizeWidget( (Widget)pInst->pShell, - pInst->window.width, - pInst->window.height, - 0 ); - XtResizeWidget( (Widget)pInst->pWidget, - pInst->window.width, - pInst->window.height, - 0 ); - } - - NPError aRet = aPluginFuncs.setwindow( pInst->instance, &pInst->window ); - medDebug( 1, "pluginapp: NPP_SetWindow returns %d\n", (int) aRet ); - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - NULL ); - delete [] (char*)pWindow; - } - break; - case eNPP_StreamAsFile: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - char* fname = pMessage->GetString(); - medDebug( 1, "pluginapp: NPP_StreamAsFile %s\n", fname ); - aPluginFuncs.asfile( instance, pStream, fname ); - delete [] fname; - } - break; - case eNPP_URLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* url = pMessage->GetString(); - NPReason* pReason = (NPReason*)pMessage->GetBytes(); - void** notifyData = (void**)pMessage->GetBytes(); - aPluginFuncs.urlnotify( instance, url, *pReason, *notifyData ); - delete [] url; - delete [] pReason; - delete [] notifyData; - } - break; - case eNPP_WriteReady: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - int32 nRet = aPluginFuncs.writeready( instance, pStream ); - - medDebug( 1, "pluginapp: NPP_WriteReady( %p, %p ) (stream id = %d) returns %d\n", - instance, pStream, nFileID, nRet ); - - Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), - NULL ); - } - break; - case eNPP_Write: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - int32 offset = pMessage->GetUINT32(); - sal_uLong len; - char* buffer = (char*)pMessage->GetBytes( len ); - int32 nRet = aPluginFuncs.write( instance, pStream, offset, len, buffer ); - - medDebug( 1,"pluginapp: NPP_Write( %p, %p, %d, %d, %p ) returns %d\n" - "stream = { pdata = %p, ndata = %p, url = %s, end = %d, lastmodified = %d, notifyData = %p }\n", - instance, pStream, offset, len, buffer, nRet, - pStream->pdata, pStream->ndata, pStream->url, pStream->end, pStream->lastmodified, pStream->notifyData ); - - Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), - NULL ); - delete [] buffer; - } - break; - case eNPP_GetMIMEDescription: - { - if( ! pNPP_GetMIMEDescription ) - pNPP_GetMIMEDescription = (char*(*)()) - osl_getAsciiFunctionSymbol( pPluginLib, "NPP_GetMIMEDescription" ); - char* pMIME = pNPP_GetMIMEDescription(); - Respond( pMessage->m_nID, - POST_STRING( pMIME ), - NULL ); - } - break; - case eNPP_Initialize: - { - - pNP_Initialize = - (NPError(*)(NPNetscapeFuncs*, NPPluginFuncs*)) - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Initialize" ); - medDebug( !pNP_Initialize, "no NP_Initialize, %s\n", dlerror() ); - pNP_Shutdown = (NPError(*)()) - osl_getAsciiFunctionSymbol( pPluginLib, "NP_Shutdown" ); - medDebug( !pNP_Initialize, "no NP_Shutdown, %s\n", dlerror() ); - - medDebug( 1, "entering NP_Initialize\n" ); - NPError aRet = pNP_Initialize( &aNetscapeFuncs, &aPluginFuncs ); - medDebug( 1, "pluginapp: NP_Initialize returns %d\n", (int) aRet ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); - } - break; - case eNPP_Shutdown: - { - write( wakeup_fd[1], "xxxx", 4 ); - } - break; - default: - medDebug( 1, "caught unknown NPP request %d\n", nCommand ); - break; - } - delete pMessage; - } - return 0; -} - -void LoadAdditionalLibs( const char* _pPluginLib ) -{ - medDebug( 1, "LoadAdditionalLibs %s\n", _pPluginLib ); - - if( ! strncmp( _pPluginLib, "libflashplayer.so", 17 ) ) - { - /* #b4951312# flash 7 implicitly assumes a gtk application - * if the API version is greater or equal to 12 (probably - * because they think they run in mozilla then). In that - * case they try to find gtk within the process and crash - * when they don't find it. - */ - aNetscapeFuncs.version = 11; - aPluginFuncs.version = 11; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx deleted file mode 100644 index dfb181809..000000000 --- a/extensions/source/plugin/unx/nppapi.cxx +++ /dev/null @@ -1,628 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include - -std::vector PluginConnector::allConnectors; - -PluginConnector::PluginConnector( int nSocket ) : - Mediator( nSocket ) -{ - allConnectors.push_back( this ); - SetNewMessageHdl( LINK( this, PluginConnector, NewMessageHdl ) ); -} - -PluginConnector::~PluginConnector() -{ - osl::MutexGuard aGuard( m_aUserEventMutex ); - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end(); ++it ) - { - if( *it == this ) - { - allConnectors.erase( it ); - break; - } - } -} - -IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ ) -{ - osl::MutexGuard aGuard( m_aUserEventMutex ); - bool bFound = false; - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end() && bFound == false; ++it ) - { - if( *it == this ) - bFound = true; - } - if( ! bFound ) - return 0; - Application::PostUserEvent( LINK( this, PluginConnector, WorkOnNewMessageHdl ) ); - return 0; -} - -IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) -{ - bool bFound = false; - for( std::vector< PluginConnector* >::iterator it = allConnectors.begin(); - it != allConnectors.end() && bFound == false; ++it ) - { - if( *it == this ) - bFound = true; - } - if( ! bFound ) - return 0; -/* - { - osl::MutexGuard aGuard( m_aUserEventMutex ); - m_aUserEventIDs.pop_front(); - } -*/ - - MediatorMessage* pMessage; - CommandAtoms nCommand; - while( (pMessage = GetNextMessage( sal_False )) ) - { - nCommand = (CommandAtoms)pMessage->GetUINT32(); - medDebug( 1, "%s\n", GetCommandName( nCommand ) ); - switch( nCommand ) - { - case eNPN_GetURL: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - NPError aRet = NPN_GetURL( instance, pUrl, pWindow ); - Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); - delete [] pUrl; - delete [] pWindow; - } - break; - case eNPN_GetURLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - void** pNotifyData = (void**)pMessage->GetBytes(); - NPError aRet = NPN_GetURLNotify( instance, pUrl, pWindow, - *pNotifyData ); - Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); - delete [] pUrl; - delete [] pWindow; - delete [] pNotifyData; - } - break; - case eNPN_DestroyStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - char* pUrl = pMessage->GetString(); - NPError* pReason = (NPError*)pMessage->GetBytes(); - NPError aRet = NPERR_FILE_NOT_FOUND; - if( nFileID < static_cast(m_aNPWrapStreams.size()) ) - { - if( ! strcmp( m_aNPWrapStreams[ nFileID ]->url, pUrl ) ) - { - aRet = - NPN_DestroyStream( instance, m_aNPWrapStreams[ nFileID ], - *pReason ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - } - else - medDebug( 1, "StreamID %d has incoherent urls %s and %s\n", - nFileID, pUrl, m_aNPWrapStreams[ nFileID ]->url ); - } - else - medDebug( 1, "Nonexistent StreamID %d\n", nFileID ); - - Respond( pMessage->m_nID, - (char*)(&aRet), sizeof( NPError ), NULL ); - - delete [] pUrl; - delete [] pReason; - } - break; - case eNPN_NewStream: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - NPMIMEType pType = pMessage->GetString(); - char* pTarget = pMessage->GetString(); - - NPStream* pStream = NULL; - - NPError aRet = NPN_NewStream( instance, pType, pTarget, &pStream ); - - if( aRet != NPERR_NO_ERROR ) - { - sal_uInt32 nDummy = 0; - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - "", 0, - &nDummy, sizeof(sal_uInt32), - &nDummy, sizeof(sal_uInt32), - NULL ); - } - else - { - m_aNPWrapStreams.push_back( pStream ); - - sal_uLong nLen = strlen( pStream->url ); - Respond( pMessage->m_nID, - (char*)&aRet, sizeof( aRet ), - pStream->url, nLen, - &pStream->end, sizeof(sal_uInt32), - &pStream->lastmodified, sizeof(sal_uInt32), - NULL ); - } - - delete [] pTarget; - delete [] pType; - } - break; - case eNPN_PostURLNotify: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pTarget = pMessage->GetString(); - sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); - void** pNData = (void**)pMessage->GetBytes(); - NPError aRet = - NPN_PostURLNotify( instance, pUrl, pTarget, nLen, pBuf, *pFile, *pNData ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); - delete [] pUrl; - delete [] pTarget; - delete [] pBuf; - delete [] pFile; - delete [] pNData; - } - break; - case eNPN_PostURL: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pUrl = pMessage->GetString(); - char* pWindow = pMessage->GetString(); - sal_uInt32 nLen = pMessage->GetUINT32(); - char* pBuf = (char*)pMessage->GetBytes(); - NPBool* pFile = (NPBool*)pMessage->GetBytes(); - NPError aRet = - NPN_PostURL( instance, pUrl, pWindow, nLen, pBuf, *pFile ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); - delete [] pUrl; - delete [] pWindow; - delete [] pBuf; - delete [] pFile; - } - break; - case eNPN_RequestRead: - { - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - sal_uInt32 nRanges = pMessage->GetUINT32(); - sal_uInt32* pArray = (sal_uInt32*)pMessage->GetBytes(); - // build ranges table - NPByteRange* pFirst = new NPByteRange; - NPByteRange* pRun = pFirst; - for( sal_uInt32 n = 0; n < nRanges; n++ ) - { - pRun->offset = pArray[ 2*n ]; - pRun->length = pArray[ 2*n+1 ]; - pRun->next = n < nRanges-1 ? new NPByteRange : NULL; - pRun = pRun->next; - } - NPError aRet = NPN_RequestRead( pStream, pFirst ); - Respond( pMessage->m_nID, (char*)&aRet, sizeof( aRet ), NULL ); - while( pFirst ) - { - pRun = pFirst->next; - delete pFirst; - pFirst = pRun; - } - delete [] pArray; - } - break; - case eNPN_Status: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - char* pString = pMessage->GetString(); - NPN_Status( instance, pString ); - delete [] pString; - } - break; - case eNPN_Version: - { - int major, minor, net_major, net_minor; - NPN_Version( &major, &minor, &net_major, &net_minor ); - Respond( pMessage->m_nID, - (char*)&major, sizeof( int ), - &minor, sizeof( int ), - &net_major, sizeof( int ), - &net_minor, sizeof( int ), - NULL ); - } - break; - case eNPN_Write: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - sal_uInt32 nFileID = pMessage->GetUINT32(); - NPStream* pStream = m_aNPWrapStreams[ nFileID ]; - sal_Int32 nLen = pMessage->GetUINT32(); - void* pBuffer = pMessage->GetBytes(); - sal_Int32 nRet = NPN_Write( instance, pStream, nLen, pBuffer ); - Respond( pMessage->m_nID, - (char*)&nRet, sizeof( nRet ), - NULL ); - delete [] (char*)pBuffer; - delete instance; - } - break; - case eNPN_UserAgent: - { - sal_uInt32 nInstance = pMessage->GetUINT32(); - NPP instance = m_aInstances[ nInstance ]->instance; - const char* pAnswer = NPN_UserAgent( instance ); - Respond( pMessage->m_nID, - (char*)pAnswer, strlen( pAnswer ), - NULL ); - } - break; - default: - medDebug( 1, "caught unknown NPN request %d\n", nCommand ); - } - - delete pMessage; - } - return 0; -} - -#define GET_INSTANCE() \ - sal_uInt32 nInstance; \ - nInstance = GetNPPID( instance ); - -#define GET_INSTANCE_RET( err ) \ - GET_INSTANCE() \ - if( nInstance == PluginConnector::UnknownNPPID ) \ - return err - - -#define POST_INSTANCE() (char*)&nInstance, sizeof( nInstance ) - -NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - MediatorMessage* pMes = - Transact( eNPP_Destroy, - POST_INSTANCE(), - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - delete pMes; - - pMes = Transact( eNPP_DestroyPhase2, - POST_INSTANCE(), - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - sal_uLong nSaveBytes; - void* pSaveData = pMes->GetBytes( nSaveBytes ); - if( nSaveBytes == 4 && *(sal_uInt32*)pSaveData == 0 ) - *save = NULL; - else - { - *save = new NPSavedData; - (*save)->len = nSaveBytes; - (*save)->buf = pSaveData; - } - delete pMes; - - return aRet; -} - -NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return NPERR_GENERIC_ERROR; - - MediatorMessage* pMes = - Transact( eNPP_DestroyStream, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - &reason, sizeof( reason ), - NULL ); - m_aNPWrapStreams.erase( m_aNPWrapStreams.begin() + nFileID ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -void* UnxPluginComm::NPP_GetJavaClass() -{ - return NULL; -} - -NPError UnxPluginComm::NPP_Initialize() -{ - MediatorMessage* pMes = - Transact( eNPP_Initialize, - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - m_aInstances.push_back( - new ConnectorInstance( instance, pluginType, 0, - NULL, 0, NULL, 0, - saved ? (char*)saved->buf : NULL, - saved ? saved->len : 0 ) ); - - char *pArgnBuf, *pArgvBuf; - size_t nArgnLen = 0, nArgvLen = 0; - int i; - for( i = 0; i < argc; i++ ) - { - nArgnLen += strlen( argn[i] ) +1; - nArgvLen += strlen( argv[i] ) +1; - } - pArgnBuf = new char[ nArgnLen ]; - pArgvBuf = new char[ nArgvLen ]; - char* pRunArgn = pArgnBuf; - char* pRunArgv = pArgvBuf; - for( i = 0; i < argc; i++ ) - { - strcpy( pRunArgn, argn[i] ); - strcpy( pRunArgv, argv[i] ); - pRunArgn += strlen( argn[i] ) +1; - pRunArgv += strlen( argv[i] ) +1; - } - - MediatorMessage* pMes; - if( saved ) - pMes = - Transact( eNPP_New, - pluginType, strlen( pluginType ), - &mode, sizeof( mode ), - &argc, sizeof( argc ), - pArgnBuf, nArgnLen, - pArgvBuf, nArgvLen, - saved->buf, static_cast(saved->len), - NULL ); - else - pMes = - Transact( eNPP_New, - pluginType, strlen( pluginType ), - &mode, sizeof( mode ), - &argc, sizeof( argc ), - pArgnBuf, nArgnLen, - pArgvBuf, nArgvLen, - "0000", size_t(4), - NULL ); - delete [] pArgnBuf; - delete [] pArgvBuf; - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - NPError aRet = GetNPError( pMes ); - delete pMes; - - return aRet; -} - -NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - - m_aNPWrapStreams.push_back( stream ); - MediatorMessage* pMes = - Transact( eNPP_NewStream, - POST_INSTANCE(), - type, strlen( type ), - stream->url, strlen( stream->url ), - &stream->end, sizeof( stream->end ), - &stream->lastmodified, sizeof( stream->lastmodified ), - &seekable, sizeof( seekable ), - NULL ); - - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - uint16* pSType = (uint16*)pMes->GetBytes(); - *stype = *pSType; - - delete [] pSType; - delete pMes; - return aRet; -} - -void UnxPluginComm::NPP_Print( NPP /*instance*/, NPPrint* /*platformPrint*/ ) -{ -} - -NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - NPError aRet = NPERR_GENERIC_ERROR; - GET_INSTANCE_RET( aRet ); - - MediatorMessage* pMes = - Transact( eNPP_SetWindow, - POST_INSTANCE(), - window, sizeof( NPWindow ), - NULL ); - if( ! pMes ) - return NPERR_GENERIC_ERROR; - - aRet = GetNPError( pMes ); - delete pMes; - return aRet; -} - -void UnxPluginComm::NPP_Shutdown() -{ - Send( eNPP_Shutdown, NULL ); -} - -void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - GET_INSTANCE(); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return; - - Send( eNPP_StreamAsFile, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - fname, strlen( fname ), - NULL ); -} - -void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) -{ - GET_INSTANCE(); - - Send( eNPP_URLNotify, - POST_INSTANCE(), - url, strlen( url ), - &reason, sizeof( reason ), - ¬ifyData, sizeof( void* ), - NULL ); -} - -int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer ) -{ - GET_INSTANCE_RET( -1 ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return -1; - - MediatorMessage* pMes = - Transact( eNPP_Write, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - &offset, sizeof( offset ), - buffer, static_cast(len), - NULL ); - if( ! pMes ) - return 0; - - int32 aRet = pMes->GetUINT32(); - delete pMes; - - return aRet; -} - -int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - GET_INSTANCE_RET( -1 ); - sal_uInt32 nFileID = GetStreamID( stream ); - if( nFileID == PluginConnector::UnknownStreamID ) - return -1; - - MediatorMessage* pMes = - Transact( eNPP_WriteReady, - POST_INSTANCE(), - &nFileID, sizeof( nFileID ), - NULL ); - - if( ! pMes ) - return 0; - - int32 aRet = pMes->GetUINT32(); - delete pMes; - - return aRet; -} - -char* UnxPluginComm::NPP_GetMIMEDescription() -{ - static char* pDesc = NULL; - MediatorMessage* pMes = - Transact( eNPP_GetMIMEDescription, - NULL ); - if( ! pMes ) - return (char*)""; - - if( pDesc ) - delete [] pDesc; - pDesc = pMes->GetString(); - delete pMes; - return pDesc; -} - -NPError UnxPluginComm::NPP_GetValue( NPP /*instance*/, NPPVariable /*variable*/, void* /*value*/ ) -{ - return 0; -} - -NPError UnxPluginComm::NPP_SetValue( NPP /*instance*/, NPNVariable /*variable*/, void* /*value*/ ) -{ - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/npwrap.cxx b/extensions/source/plugin/unx/npwrap.cxx deleted file mode 100644 index 668239f7b..000000000 --- a/extensions/source/plugin/unx/npwrap.cxx +++ /dev/null @@ -1,518 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -PluginConnector* pConnector = NULL; - -int nAppArguments = 0; -char** pAppArguments = NULL; -Display* pAppDisplay = NULL; -Display* pXtAppDisplay = NULL; - -extern oslModule pPluginLib; -extern NPError (*pNP_Shutdown)(); - -void LoadAdditionalLibs(const char*); - -XtAppContext app_context; -Widget topLevel = NULL, topBox = NULL; -int wakeup_fd[2] = { 0, 0 }; -static bool bPluginAppQuit = false; - -static long GlobalConnectionLostHdl( void* /*pInst*/, void* /*pArg*/ ) -{ - medDebug( 1, "pluginapp exiting due to connection lost\n" ); - - write( wakeup_fd[1], "xxxx", 4 ); - return 0; -} - -extern "C" -{ - static int plugin_x_error_handler( Display*, XErrorEvent* ) - { - return 0; - } - - #ifndef ENABLE_GTK - static void ThreadEventHandler( XtPointer /*client_data*/, int* /*source*/, XtInputId* id ) - { - char buf[256]; - // clear pipe - int len, nLast = -1; - - while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) - nLast = len-1; - if( ! bPluginAppQuit ) - { - if( ( nLast == -1 || buf[nLast] != 'x' ) && pConnector ) - pConnector->CallWorkHandler(); - else - { - // it seems you can use XtRemoveInput only - // safely from within the callback - // why is that ? - medDebug( 1, "removing wakeup pipe\n" ); - XtRemoveInput( *id ); - XtAppSetExitFlag( app_context ); - bPluginAppQuit = true; - - delete pConnector; - pConnector = NULL; - } - } - } - #endif -} - - -IMPL_LINK( PluginConnector, NewMessageHdl, Mediator*, /*pMediator*/ ) -{ - medDebug( 1, "new message handler\n" ); - write( wakeup_fd[1], "cccc", 4 ); - return 0; - -} - -Widget createSubWidget( char* /*pPluginText*/, Widget shell, XLIB_Window aParentWindow ) -{ - Widget newWidget = XtVaCreateManagedWidget( -#if defined USE_MOTIF - "drawingArea", - xmDrawingAreaWidgetClass, -#else - "", - compositeWidgetClass, -#endif - shell, - XtNwidth, 200, - XtNheight, 200, - (char *)NULL ); - XtRealizeWidget( shell ); - XtRealizeWidget( newWidget ); - - medDebug( 1, "Reparenting new widget %x to %x\n", XtWindow( newWidget ), aParentWindow ); - XReparentWindow( pXtAppDisplay, - XtWindow( shell ), - aParentWindow, - 0, 0 ); - XtMapWidget( shell ); - XtMapWidget( newWidget ); - XRaiseWindow( pXtAppDisplay, XtWindow( shell ) ); - XSync( pXtAppDisplay, False ); - - return newWidget; -} - -void* CreateNewShell( void** pShellReturn, XLIB_Window aParentWindow ) -{ - XLIB_String n, c; - XtGetApplicationNameAndClass(pXtAppDisplay, &n, &c); - - Widget newShell = - XtVaAppCreateShell( "pane", c, - topLevelShellWidgetClass, - pXtAppDisplay, - XtNwidth, 200, - XtNheight, 200, - XtNoverrideRedirect, True, - (char *)NULL ); - *pShellReturn = newShell; - - char pText[1024]; - sprintf( pText, "starting plugin %s ...", pAppArguments[2] ); - - Widget newWidget = createSubWidget( pText, newShell, aParentWindow ); - - return newWidget; -} - -static oslModule LoadModule( const char* pPath ) -{ - ::rtl::OUString sSystemPath( ::rtl::OUString::createFromAscii( pPath ) ); - ::rtl::OUString sFileURL; - osl_getFileURLFromSystemPath( sSystemPath.pData, &sFileURL.pData ); - - oslModule pLib = osl_loadModule( sFileURL.pData, SAL_LOADMODULE_LAZY ); - if( ! pLib ) - { - medDebug( 1, "could not open %s: %s\n", pPath, dlerror() ); - } - return pLib; -} - -// Unix specific implementation -static void CheckPlugin( const char* pPath ) -{ - oslModule pLib = LoadModule( pPath ); - - char*(*pNP_GetMIMEDescription)() = (char*(*)()) - osl_getAsciiFunctionSymbol( pLib, "NP_GetMIMEDescription" ); - if( pNP_GetMIMEDescription ) - printf( "%s\n", pNP_GetMIMEDescription() ); - else - medDebug( 1, "could not get symbol NP_GetMIMEDescription %s\n", dlerror() ); - - osl_unloadModule( pLib ); -} - -#if OSL_DEBUG_LEVEL > 1 && defined LINUX -#include -#endif - -extern "C" { - -static void signal_handler( int nSig ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "caught signal %d, exiting\n", nSig ); -#ifdef LINUX - void* pStack[64]; - int nStackLevels = backtrace( pStack, SAL_N_ELEMENTS(pStack) ); - backtrace_symbols_fd( pStack, nStackLevels, STDERR_FILENO ); -#endif -#endif - if( pConnector ) - { - // ensure that a read on the other side will wakeup - delete pConnector; - pConnector = NULL; - } - - _exit(nSig); -} - -#ifdef ENABLE_GTK - -static gboolean noClosure( gpointer ) -{ - return sal_True; -} - -// Xt events -static gboolean prepareXtEvent( GSource*, gint* ) -{ - int nMask = XtAppPending( app_context ); - return (nMask & XtIMAll) != 0; -} - -static gboolean checkXtEvent( GSource* ) -{ - int nMask = XtAppPending( app_context ); - return (nMask & XtIMAll) != 0; -} - -static gboolean dispatchXtEvent( GSource*, GSourceFunc, gpointer ) -{ - XtAppProcessEvent( app_context, XtIMAll ); - return sal_True; -} - -static GSourceFuncs aXtEventFuncs = -{ - prepareXtEvent, - checkXtEvent, - dispatchXtEvent, - NULL, - noClosure, - NULL -}; - -static gboolean pollXtTimerCallback(gpointer) -{ - for(int i = 0; i < 5; i++) - { - if( (XtAppPending(app_context) & (XtIMAll & ~XtIMXEvent)) == 0 ) - break; - XtAppProcessEvent(app_context, XtIMAll & ~XtIMXEvent); - } - return sal_True; -} - -static gboolean prepareWakeupEvent( GSource*, gint* ) -{ - struct pollfd aPoll = { wakeup_fd[0], POLLIN, 0 }; - poll( &aPoll, 1, 0 ); - return (aPoll.revents & POLLIN ) != 0; -} - -static gboolean checkWakeupEvent( GSource* pSource ) -{ - gint nDum = 0; - return prepareWakeupEvent( pSource, &nDum ); -} - -static gboolean dispatchWakeupEvent( GSource*, GSourceFunc, gpointer ) -{ - char buf[256]; - // clear pipe - int len, nLast = -1; - - while( (len = read( wakeup_fd[0], buf, sizeof( buf ) ) ) > 0 ) - nLast = len-1; - if( ( nLast == -1 || buf[nLast] != 'x' ) && pConnector ) - pConnector->CallWorkHandler(); - else - { - XtAppSetExitFlag( app_context ); - bPluginAppQuit = true; - - delete pConnector; - pConnector = NULL; - } - - return sal_True; -} - -static GSourceFuncs aWakeupEventFuncs = { - prepareWakeupEvent, - checkWakeupEvent, - dispatchWakeupEvent, - NULL, - noClosure, - NULL -}; - -#endif // GTK - -} - -int main( int argc, char **argv) -{ - struct sigaction aSigAction; - aSigAction.sa_handler = signal_handler; - sigemptyset( &aSigAction.sa_mask ); - aSigAction.sa_flags = SA_NOCLDSTOP; - sigaction( SIGSEGV, &aSigAction, NULL ); - sigaction( SIGBUS, &aSigAction, NULL ); - sigaction( SIGABRT, &aSigAction, NULL ); - sigaction( SIGTERM, &aSigAction, NULL ); - sigaction( SIGILL, &aSigAction, NULL ); - - int nArg = (argc < 3) ? 1 : 2; - char* pBaseName = argv[nArg] + strlen(argv[nArg]); - while( pBaseName > argv[nArg] && pBaseName[-1] != '/' ) - pBaseName--; - LoadAdditionalLibs( pBaseName ); - - if( argc == 2 ) - { - CheckPlugin(argv[1]); - exit(0); - } - nAppArguments = argc; - pAppArguments = argv; - - XSetErrorHandler( plugin_x_error_handler ); - - if( pipe( wakeup_fd ) ) - { - medDebug( 1, "could not pipe()\n" ); - return 1; - } - // initialize 'wakeup' pipe. - int flags; - - // set close-on-exec descriptor flag. - if ((flags = fcntl (wakeup_fd[0], F_GETFD)) != -1) - { - flags |= FD_CLOEXEC; - fcntl (wakeup_fd[0], F_SETFD, flags); - } - if ((flags = fcntl (wakeup_fd[1], F_GETFD)) != -1) - { - flags |= FD_CLOEXEC; - fcntl (wakeup_fd[1], F_SETFD, flags); - } - - // set non-blocking I/O flag. - if ((flags = fcntl (wakeup_fd[0], F_GETFL)) != -1) - { - flags |= O_NONBLOCK; - fcntl (wakeup_fd[0], F_SETFL, flags); - } - if ((flags = fcntl (wakeup_fd[1], F_GETFL)) != -1) - { - flags |= O_NONBLOCK; - fcntl (wakeup_fd[1], F_SETFL, flags); - } - - pPluginLib = LoadModule( argv[2] ); - if( ! pPluginLib ) - { - exit(255); - } - int nSocket = atol( argv[1] ); - - #ifdef ENABLE_GTK - g_thread_init(NULL); - gtk_init(&argc, &argv); - #endif - - pConnector = new PluginConnector( nSocket ); - pConnector->SetConnectionLostHdl( Link( NULL, GlobalConnectionLostHdl ) ); - - XtSetLanguageProc( NULL, NULL, NULL ); - - XtToolkitInitialize(); - app_context = XtCreateApplicationContext(); - pXtAppDisplay = XtOpenDisplay( app_context, NULL, "SOPlugin", "SOPlugin", NULL, 0, &argc, argv ); - - - #ifdef ENABLE_GTK - // integrate Xt events into GTK event loop - GPollFD aXtPollDesc, aWakeupPollDesc; - - GSource* pXTSource = g_source_new( &aXtEventFuncs, sizeof(GSource) ); - if( !pXTSource ) - { - medDebug( 1, "could not get Xt GSource" ); - return 1; - } - - g_source_set_priority( pXTSource, GDK_PRIORITY_EVENTS ); - g_source_set_can_recurse( pXTSource, sal_True ); - g_source_attach( pXTSource, NULL ); - aXtPollDesc.fd = ConnectionNumber( pXtAppDisplay ); - aXtPollDesc.events = G_IO_IN; - aXtPollDesc.revents = 0; - g_source_add_poll( pXTSource, &aXtPollDesc ); - - gint xt_polling_timer_id = g_timeout_add( 25, pollXtTimerCallback, NULL); - // Initialize wakeup events listener - GSource *pWakeupSource = g_source_new( &aWakeupEventFuncs, sizeof(GSource) ); - if ( pWakeupSource == NULL ) - { - medDebug( 1, "could not get wakeup source" ); - return 1; - } - g_source_set_priority( pWakeupSource, GDK_PRIORITY_EVENTS); - g_source_attach( pWakeupSource, NULL ); - aWakeupPollDesc.fd = wakeup_fd[0]; - aWakeupPollDesc.events = G_IO_IN; - aWakeupPollDesc.revents = 0; - g_source_add_poll( pWakeupSource, &aWakeupPollDesc ); - - pAppDisplay = gdk_x11_display_get_xdisplay( gdk_display_get_default() ); - #else - pAppDisplay = pXtAppDisplay; - XtAppAddInput( app_context, - wakeup_fd[0], - (XtPointer)XtInputReadMask, - ThreadEventHandler, NULL ); - #endif - - // send that we are ready to go - MediatorMessage* pMessage = - pConnector->Transact( "init req", 8, - NULL ); - delete pMessage; - -#if OSL_DEBUG_LEVEL > 3 - int nPID = getpid(); - int nChild = fork(); - if( nChild == 0 ) - { - char pidbuf[16]; - char* pArgs[] = { "xterm", "-sl", "2000", "-sb", "-e", "gdb", "pluginapp.bin", pidbuf, NULL }; - sprintf( pidbuf, "%d", nPID ); - execvp( pArgs[0], pArgs ); - _exit(255); - } - else - sleep( 10 ); -#endif - - /* - * Loop for events. - */ - // for some reason XtAppSetExitFlag won't quit the application - // in ThreadEventHandler most of times; Xt will hang in select - // (hat is in XtAppNextEvent). Have our own mainloop instead - // of XtAppMainLoop - do - { - #ifdef ENABLE_GTK - g_main_context_iteration( NULL, sal_True ); - #else - XtAppProcessEvent( app_context, XtIMAll ); - #endif - } while( ! XtAppGetExitFlag( app_context ) && ! bPluginAppQuit ); - - medDebug( 1, "left plugin app main loop\n" ); - - #ifdef ENABLE_GTK - g_source_remove(xt_polling_timer_id); - #endif - - pNP_Shutdown(); - medDebug( 1, "NP_Shutdown done\n" ); - osl_unloadModule( pPluginLib ); - medDebug( 1, "plugin close\n" ); - - close( wakeup_fd[0] ); - close( wakeup_fd[1] ); - - return 0; -} - -#ifdef GCC -extern "C" { - void __pure_virtual() - {} - - void* __builtin_new( int nBytes ) - { return malloc(nBytes); } - void* __builtin_vec_new( int nBytes ) - { return malloc(nBytes); } - void __builtin_delete( char* pMem ) - { free(pMem); } - void __builtin_vec_delete( char* pMem ) - { free(pMem); } -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/plugcon.cxx b/extensions/source/plugin/unx/plugcon.cxx deleted file mode 100644 index b15f01289..000000000 --- a/extensions/source/plugin/unx/plugcon.cxx +++ /dev/null @@ -1,292 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include - -sal_uInt32 PluginConnector::GetStreamID( NPStream* pStream ) -{ - size_t nLen = m_aNPWrapStreams.size(); - for( size_t i = 0; i < nLen; i++ ) - if( m_aNPWrapStreams[ i ] == pStream ) - return static_cast(i); - medDebug( 1, "Error: NPStream has no ID\n" ); - return UnknownStreamID; -} - -sal_uInt32 PluginConnector::GetNPPID( NPP instance ) -{ - size_t nLen = m_aInstances.size(); - for( size_t i=0; i instance == instance ) - return static_cast(i); - medDebug( 1, "Error: NPP has no ID\n" ); - - return UnknownNPPID; -} - -ConnectorInstance* PluginConnector::getInstance( NPP instance ) -{ - size_t nLen = m_aInstances.size(); - for( size_t i=0; i instance == instance ) - return pInst; - } - return NULL; -} - -ConnectorInstance* PluginConnector::getInstanceById( sal_uInt32 nInstanceID ) -{ - return nInstanceID < static_cast(m_aInstances.size()) ? m_aInstances[ nInstanceID ] : NULL; -} - -struct PtrStruct -{ - char* pData; - sal_uLong nBytes; - - PtrStruct( char* i_pData, sal_uLong i_nBytes ) - : pData( i_pData ), nBytes( i_nBytes ) {} -}; - -sal_uLong PluginConnector::FillBuffer( char*& rpBuffer, - const char* pFunction, - sal_uLong nFunctionLen, - va_list ap ) -{ - std::vector< PtrStruct > aList; - aList.reserve( 5 ); - - sal_uLong nDataSize = nFunctionLen + sizeof( sal_uLong ); - char* pNext; - - do { - pNext = va_arg( ap, char* ); - if( pNext ) - { - aList.push_back( PtrStruct( pNext, va_arg( ap, sal_uLong ) ) ); - nDataSize += aList.back().nBytes + sizeof(sal_uLong); - } - } while( pNext ); - - rpBuffer = new char[ nDataSize ]; - char* pRun = rpBuffer; - memcpy( pRun, &nFunctionLen, sizeof( nFunctionLen ) ); - pRun += sizeof( nFunctionLen ); - memcpy( pRun, pFunction, nFunctionLen ); - pRun += nFunctionLen; - - for( std::vector::const_iterator it = aList.begin(); it != aList.end(); ++it ) - { - memcpy( pRun, &it->nBytes, sizeof( sal_uLong ) ); - pRun += sizeof( sal_uLong ); - memcpy( pRun, it->pData, it->nBytes ); - pRun += it->nBytes; - } - return nDataSize; -} - -MediatorMessage* PluginConnector::Transact( const char* pFunction, - sal_uLong nFunctionLen, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunctionLen ); - sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); - va_end( ap ); - return TransactMessage( nSize, pBuffer ); -} - -MediatorMessage* PluginConnector::Transact( sal_uInt32 nFunction, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); - va_end( ap ); - return TransactMessage( nSize, pBuffer ); -} - -sal_uLong PluginConnector::Send( sal_uInt32 nFunction, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunction ); - sal_uLong nSize = FillBuffer( pBuffer, (char*)&nFunction, sizeof( nFunction ), ap ); - va_end( ap ); - return SendMessage( nSize, pBuffer ); -} - -void PluginConnector::Respond( sal_uLong nID, - char* pFunction, - sal_uLong nFunctionLen, ... ) -{ - va_list ap; - char* pBuffer; - - va_start( ap, nFunctionLen ); - sal_uLong nSize = FillBuffer( pBuffer, pFunction, nFunctionLen, ap ); - va_end( ap ); - SendMessage( nSize, pBuffer, nID | ( 1 << 24 ) ); -} - -MediatorMessage* PluginConnector::WaitForAnswer( sal_uLong nMessageID ) -{ - if( ! m_bValid ) - return NULL; - - nMessageID &= 0x00ffffff; - while( m_pListener ) - { - { - osl::MutexGuard aGuard( m_aQueueMutex ); - for( size_t i = 0; i < m_aMessageQueue.size(); i++ ) - { - MediatorMessage* pMessage = m_aMessageQueue[ i ]; - sal_uLong nID = pMessage->m_nID; - if( ( nID & 0xff000000 ) && - ( ( nID & 0x00ffffff ) == nMessageID ) ) - { - m_aMessageQueue.erase( m_aMessageQueue.begin() + i ); - return pMessage; - } - } - } - if( ! m_aMessageQueue.empty() ) - CallWorkHandler(); - WaitForMessage( 2000 ); - } - return NULL; -} - -ConnectorInstance::ConnectorInstance( NPP inst, char* type, - int args, char* pargnbuf, sal_uLong nargnbytes, - char* pargvbuf, sal_uLong nargvbytes, - char* savedata, sal_uLong savebytes ) : - instance( inst ), - pShell( NULL ), - pWidget( NULL ), - pForm( NULL ), - pGtkWindow( NULL ), - pGtkWidget( NULL ), - bShouldUseXEmbed( false ), - nArg( args ), - pArgnBuf( pargnbuf ), - pArgvBuf( pargvbuf ) -{ - memset( &window, 0, sizeof(window) ); - pMimeType = new char[ strlen( type ) + 1 ]; - strcpy( pMimeType, type ); - aData.len = savebytes; - aData.buf = savedata; - argn = new char*[ nArg ]; - argv = new char*[ nArg ]; - int i; - char* pRun = pArgnBuf; - for( i = 0; i < nArg; i++ ) - { - argn[i] = pRun; - while( *pRun != 0 && (sal_uLong)(pRun - pArgnBuf) < nargnbytes ) - pRun++; - if( (sal_uLong)(pRun - pArgnBuf) < nargnbytes ) - pRun++; - } - pRun = pArgvBuf; - for( i = 0; i < nArg; i++ ) - { - argv[i] = pRun; - while( *pRun != 0 && (sal_uLong)(pRun - pArgvBuf) < nargvbytes ) - pRun++; - if( (sal_uLong)(pRun - pArgvBuf) < nargvbytes ) - pRun++; - } -} - -ConnectorInstance::~ConnectorInstance() -{ - delete [] pMimeType; - delete [] argn; - delete [] argv; - delete [] pArgnBuf; - delete [] pArgvBuf; - delete [] (char*)aData.buf; -} - -const char* GetCommandName( CommandAtoms eCommand ) -{ - switch( eCommand ) - { - case eNPN_GetURL: return "NPN_GetURL"; - case eNPN_GetURLNotify: return "NPN_GetURLNotify"; - case eNPN_DestroyStream: return "NPN_DestroyStream"; - case eNPN_NewStream: return "NPN_NewStream"; - case eNPN_PostURLNotify: return "NPN_PostURLNotify"; - case eNPN_PostURL: return "NPN_PostURL"; - case eNPN_RequestRead: return "NPN_RequestRead"; - case eNPN_Status: return "NPN_Status"; - case eNPN_Version: return "NPN_Version"; - case eNPN_Write: return "NPN_Write"; - case eNPN_UserAgent: return "NPN_UserAgent"; - - case eNPP_DestroyStream: return "NPP_DestroyStream"; - case eNPP_Destroy: return "NPP_Destroy"; - case eNPP_DestroyPhase2: return "NPP_DestroyPhase2"; - case eNPP_NewStream: return "NPP_NewStream"; - case eNPP_New: return "NPP_New"; - case eNPP_SetWindow: return "NPP_SetWindow"; - case eNPP_StreamAsFile: return "NPP_StreamAsFile"; - case eNPP_URLNotify: return "NPP_URLNotify"; - case eNPP_WriteReady: return "NPP_WriteReady"; - case eNPP_Write: return "NPP_Write"; - case eNPP_GetMIMEDescription: return "NPP_GetMIMEDescription"; - case eNPP_Initialize: return "NPP_Initialize"; - case eNPP_Shutdown: return "NPP_Shutdown"; - - case eMaxCommand: return "eMaxCommand"; - default: return "unknown command"; - } - return NULL; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx deleted file mode 100644 index 2152e8a54..000000000 --- a/extensions/source/plugin/unx/sysplug.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include - -#include -#include -#include -#include -#include -#include - -#include - -int UnxPluginComm::nConnCounter = 0; - -UnxPluginComm::UnxPluginComm( - const String& /*mimetype*/, - const String& library, - XLIB_Window aParent, - int nDescriptor1, - int nDescriptor2 - ) : - PluginComm( ::rtl::OUStringToOString( library, osl_getThreadTextEncoding() ), false ), - PluginConnector( nDescriptor2 ) -{ - char pDesc[32]; - char pWindow[32]; - sprintf( pWindow, "%d", (int)aParent ); - sprintf( pDesc, "%d", nDescriptor1 ); - ByteString aLib( library, osl_getThreadTextEncoding() ); - rtl::OString path; - if (!getPluginappPath(&path)) { - fprintf( stderr, "cannot construct path to pluginapp.bin\n" ); - m_nCommPID = -1; - return; - } - - char const* pArgs[5]; - pArgs[0] = path.getStr(); - pArgs[1] = pDesc; - pArgs[2] = aLib.GetBuffer(); - pArgs[3] = pWindow; - pArgs[4] = NULL; - -#if OSL_DEBUG_LEVEL > 1 - m_nCommPID = 10; - fprintf( stderr, "Try to launch: %s %s %s %s, descriptors are %d, %d\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3], nDescriptor1, nDescriptor2 ); -#endif - - if( ! ( m_nCommPID = fork() ) ) - { - execvp( pArgs[0], const_cast< char ** >(pArgs) ); - fprintf( stderr, "Error: could not exec %s\n", pArgs[0] ); - _exit(255); - } - - if( m_nCommPID != -1 ) - { - // wait for pluginapp.bin to start up - if( ! WaitForMessage( 5000 ) ) - { - fprintf( stderr, "Timeout on command: %s %s %s %s\n", pArgs[0], pArgs[1], pArgs[2], pArgs[3] ); - invalidate(); - } - else - { - MediatorMessage* pMessage = GetNextMessage( sal_True ); - Respond( pMessage->m_nID, - const_cast("init ack"),8, - NULL ); - delete pMessage; - NPP_Initialize(); - } - } -} - -UnxPluginComm::~UnxPluginComm() -{ - NPP_Shutdown(); - if( m_nCommPID != -1 && m_nCommPID != 0 ) - { - int status = 16777216; - pid_t nExit = waitpid( m_nCommPID, &status, WUNTRACED ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "child %d (plugin app child %d) exited with status %d\n", (int)nExit, (int)m_nCommPID, (int)WEXITSTATUS(status) ); -#else - (void)nExit; -#endif - } -} - -bool UnxPluginComm::getPluginappPath(rtl::OString * path) { - OSL_ASSERT(path != NULL); - rtl::OUString p( - RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program/pluginapp.bin")); - rtl::Bootstrap::expandMacros(p); - return - (osl::FileBase::getSystemPathFromFileURL(p, p) == - osl::FileBase::E_None) && - p.convertToString( - path, osl_getThreadTextEncoding(), - (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | - RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx deleted file mode 100644 index 29a0596a3..000000000 --- a/extensions/source/plugin/unx/unxmgr.cxx +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifdef AIX -#define _LINUX_SOURCE_COMPAT -#include -#undef _LINUX_SOURCE_COMPAT -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace com::sun::star::uno; -using namespace com::sun::star::plugin; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringBuffer; -using ::rtl::OStringToOUString; - -// Unix specific implementation -static bool CheckPlugin( const ByteString& rPath, list< PluginDescription* >& rDescriptions ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Trying plugin %s ... ", rPath.GetBuffer() ); -#endif - - xub_StrLen nPos = rPath.SearchBackward( '/' ); - if( nPos == STRING_NOTFOUND ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "no absolute path to plugin\n" ); -#endif - return false; - } - - ByteString aBaseName = rPath.Copy( nPos+1 ); - if( aBaseName.Equals( "libnullplugin.so" ) ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "don't like %s\n", aBaseName.GetBuffer() ); -#endif - return false; - } - - struct stat aStat; - if( stat( rPath.GetBuffer(), &aStat ) || ! S_ISREG( aStat.st_mode ) ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "%s is not a regular file\n", rPath.GetBuffer() ); -#endif - return false; - } - - - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - - rtl::OString path; - if (!UnxPluginComm::getPluginappPath(&path)) { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "cannot construct path to pluginapp.bin\n" ); -#endif - return false; - } - rtl::OStringBuffer cmd; - tools::appendUnixShellWord(&cmd, path); - cmd.append(' '); - tools::appendUnixShellWord(&cmd, rPath); - rtl::OString aCommand(cmd.makeStringAndClear()); - - FILE* pResult = popen( aCommand.getStr(), "r" ); - int nDescriptions = 0; - if( pResult ) - { - OStringBuffer aMIME; - char buf[256]; - while( fgets( buf, sizeof( buf ), pResult ) ) - { - for( size_t i = 0; i < sizeof(buf) && buf[i]; ++i ) - { - if( buf[i] == '\n' ) - buf[i] = ';'; - } - aMIME.append( buf ); - } - pclose( pResult ); - - if( aMIME.getLength() > 0 ) - { - OString aLine = aMIME.makeStringAndClear(); - - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OString aType = aLine.getToken( 0, ';', nIndex ); - - sal_Int32 nTypeIndex = 0; - OString aMimetype = aType.getToken( 0, ':', nTypeIndex ); - OString aExtLine = aType.getToken( 0, ':', nTypeIndex ); - if( nTypeIndex < 0 ) // ensure at least three tokens - continue; - OString aDesc = aType.getToken( 0, ':', nTypeIndex ); - - // create extension list string - sal_Int32 nExtIndex = 0; - OStringBuffer aExtension; - while( nExtIndex != -1 ) - { - OString aExt = aExtLine.getToken( 0, ',', nExtIndex); - if( aExt.indexOf( "*." ) != 0 ) - aExtension.append( "*." ); - aExtension.append( aExt ); - if( nExtIndex != -1 ) - aExtension.append( ';' ); - } - - PluginDescription* pNew = new PluginDescription; - // set plugin name (path to library) - pNew->PluginName = OStringToOUString( rPath, aEncoding ); - // set mimetype - pNew->Mimetype = OStringToOUString( aMimetype, aEncoding ); - // set extension line - pNew->Extension = OStringToOUString( aExtension.makeStringAndClear(), aEncoding ); - // set description - pNew->Description= OStringToOUString( aDesc, aEncoding ); - rDescriptions.push_back( pNew ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "Mimetype: %s\nExtension: %s\n" - "Description: %s\n", - OUStringToOString( pNew->Mimetype, aEncoding ).getStr(), - OUStringToOString( pNew->Extension, aEncoding ).getStr(), - OUStringToOString( pNew->Description, aEncoding ).getStr() - ); -#endif - } - } -#if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "result of \"%s\" contains no mimtype\n", - aCommand.getStr() ); -#endif - } -#if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "command \"%s\" failed\n", aCommand.getStr() ); -#endif - return nDescriptions > 0; -} - -union maxDirent -{ - char aBuffer[ sizeof( struct dirent ) + _PC_NAME_MAX +1 ]; - struct dirent asDirent; -}; - -static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDescription* >& rDescriptions ) -{ - rtl::OStringBuffer aPath( 1024 ); - aPath.append( rPath ); - aPath.append( "/pluginreg.dat" ); - FILE* fp = fopen( aPath.getStr(), "r" ); - if( fp ) - { -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "parsing %s\n", aPath.getStr() ); -#endif - char aLine[1024]; - while( fgets( aLine, sizeof( aLine ), fp ) ) - { - int nLineLen = strlen( aLine ); - int nDotPos; - for( nDotPos = nLineLen-1; nDotPos > 0 && aLine[nDotPos] != ':'; nDotPos-- ) - ; - if( aLine[0] == '/' && aLine[nDotPos] == ':' && aLine[nDotPos+1] == '$' ) - CheckPlugin( ByteString( aLine, nDotPos ), rDescriptions ); - } - fclose( fp ); - } - - // check subdirectories - DIR* pDIR = opendir( rPath.getStr() ); - struct dirent* pDirEnt = NULL; - struct stat aStat; - maxDirent u; - while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt ) - { - char* pBaseName = u.asDirent.d_name; - if( rtl_str_compare( ".", pBaseName ) && rtl_str_compare( "..", pBaseName ) ) - { - rtl::OStringBuffer aBuf( 1024 ); - aBuf.append( rPath ); - aBuf.append( '/' ); - aBuf.append( pBaseName ); - - if( ! stat( aBuf.getStr(), &aStat ) ) - { - if( S_ISDIR( aStat.st_mode ) ) - CheckPluginRegistryFiles( aBuf.makeStringAndClear(), rDescriptions ); - } - } - } - if( pDIR ) - closedir( pDIR ); -} - -Sequence XPluginManager_Impl::impl_getPluginDescriptions() throw() -{ - static Sequence aDescriptions; - static sal_Bool bHavePlugins = sal_False; - if( ! bHavePlugins ) - { - rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - list aPlugins; - int i; - - // unix: search for plugins in /usr/lib/netscape/plugins, - // ~/.netscape/plugins und NPX_PLUGIN_PATH - // additionally: search in PluginsPath - static const char* pHome = getenv( "HOME" ); - static const char* pNPXPluginPath = getenv( "NPX_PLUGIN_PATH" ); - - ByteString aSearchPath( "/usr/lib/netscape/plugins" ); - if( pHome ) - { - aSearchPath.Append( ':' ); - aSearchPath.Append( pHome ); - aSearchPath += "/.netscape/plugins"; - } - if( pNPXPluginPath ) - { - aSearchPath.Append( ':' ); - aSearchPath += pNPXPluginPath; - } - - const Sequence< ::rtl::OUString >& rPaths( PluginManager::getAdditionalSearchPaths() ); - for( i = 0; i < rPaths.getLength(); i++ ) - { - aSearchPath += ":"; - aSearchPath += ByteString( String( rPaths.getConstArray()[i] ), aEncoding ); - } - - int nPaths = aSearchPath.GetTokenCount( ':' ); - maxDirent u; - for( i = 0; i < nPaths; i++ ) - { - ByteString aPath( aSearchPath.GetToken( i, ':' ) ); - if( aPath.Len() ) - { - DIR* pDIR = opendir( aPath.GetBuffer() ); - struct dirent* pDirEnt = NULL; - while( pDIR && ! readdir_r( pDIR, &u.asDirent, &pDirEnt ) && pDirEnt ) - { - char* pBaseName = u.asDirent.d_name; - if( pBaseName[0] != '.' || - pBaseName[1] != '.' || - pBaseName[2] != 0 ) - { - ByteString aFileName( aPath ); - aFileName += "/"; - aFileName += pBaseName; - CheckPlugin( aFileName, aPlugins ); - } - } - if( pDIR ) - closedir( pDIR ); - } - } - - // try ~/.mozilla/pluginreg.dat - rtl::OStringBuffer aBuf(256); - aBuf.append( pHome ); - aBuf.append( "/.mozilla" ); - CheckPluginRegistryFiles( aBuf.makeStringAndClear(), aPlugins ); - - // create return value - aDescriptions = Sequence( aPlugins.size() ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "found %" SAL_PRI_SIZET "u plugins\n", aPlugins.size() ); -#endif - list::iterator iter; - for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ ) - { - aDescriptions.getArray()[ i ] = **iter; - delete *iter; - } - aPlugins.clear(); - bHavePlugins = sal_True; - } - return aDescriptions; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/util/makefile.mk b/extensions/source/plugin/util/makefile.mk deleted file mode 100644 index 7b7d047a1..000000000 --- a/extensions/source/plugin/util/makefile.mk +++ /dev/null @@ -1,109 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=pl -TARGETTYPE=GUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -.IF "$(WITH_MOZILLA)" != "NO" - -LIB1TARGET = $(SLB)$/plall.lib -LIB1FILES = \ - $(SLB)$/plbase.lib \ - $(SHL1LINKLIB) - -.IF "$(GUI)" == "UNX" -.IF "$(GUIBASE)"=="aqua" -.IF "$(WITH_MOZILLA)"=="YES" -SHL1LINKLIB = $(SLB)$/plaqua.lib -.ENDIF -.ELSE -SHL1LINKLIB = $(SLB)$/plunx.lib -.ENDIF # $(GUIBASE)==aqua -.IF "$(OS)" == "SOLARIS" -SHL1OWNLIBS = -lsocket -.ENDIF # SOLARIS -.ENDIF # UNX - -.IF "$(GUI)" == "WNT" -SHL1LINKLIB = $(SLB)$/plwin.lib -SHL1OWNLIBS = \ - $(VERSIONLIB) \ - $(OLE32LIB) \ - $(ADVAPI32LIB) -.ENDIF # WNT - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1IMPLIB= i$(TARGET) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -SHL1LIBS=$(LIB1TARGET) - -SHL1STDLIBS+= \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(UCBHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(SALHELPERLIB) - -.IF "$(GUIBASE)"=="unx" -SHL1STDLIBS+=$(X11LINK_DYNAMIC) -.ENDIF - -SHL1STDLIBS+=$(SHL1OWNLIBS) - -.ENDIF # $(WITH_MOZILLA) != "NO" - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - - - -ALLTAR : $(MISC)/pl.component - -$(MISC)/pl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - pl.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt pl.component diff --git a/extensions/source/plugin/util/makefile.pmk b/extensions/source/plugin/util/makefile.pmk deleted file mode 100644 index 0f06ea2a5..000000000 --- a/extensions/source/plugin/util/makefile.pmk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -NOUNODOC=true - -.INCLUDE : settings.mk - -.IF "$(SYSTEM_MOZILLA)" == "YES" -CFLAGS+=-DSYSTEM_MOZILLA -PKGCONFIG_MODULES+=$(MOZ_FLAVOUR)-plugin -.ENDIF - -.IF "$(GUIBASE)" == "unx" && "$(ENABLE_GTK)" == "TRUE" -CDEFS+=-DENABLE_GTK -PKGCONFIG_MODULES+=gtk+-2.0 gthread-2.0 -.ENDIF - -.IF "$(GUIBASE)" == "aqua" -CFLAGS += -I$(FRAMEWORKSHOME)/ApplicationServices.framework/Versions/Current/Frameworks/QD.framework/Headers\ - -I$(FRAMEWORKSHOME)/Carbon.framework/Versions/Current/Frameworks/HIToolbox.framework/Versions/Current/Headers -.ENDIF - -.IF "$(PKGCONFIG_MODULES)" != "" -.INCLUDE : pkg_config.mk -.ENDIF diff --git a/extensions/source/plugin/util/pl.component b/extensions/source/plugin/util/pl.component deleted file mode 100644 index 4a9d98f7d..000000000 --- a/extensions/source/plugin/util/pl.component +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - diff --git a/extensions/source/plugin/win/makefile.mk b/extensions/source/plugin/win/makefile.mk deleted file mode 100644 index 7f676ac16..000000000 --- a/extensions/source/plugin/win/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=plwin -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- -.IF "$(GUI)" == "WNT" - -.INCLUDE : ..$/util$/makefile.pmk - -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/plugin -.IF "$(SOLAR_JAVA)" != "" -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/java -INCPRE+=-I$(SOLARINCDIR)$/mozilla$/nspr -CDEFS+=-DOJI -.ENDIF - -# --- Types ------------------------------------- - -.IF "$(WITH_MOZILLA)" != "NO" -SLOFILES = $(SLO)$/winmgr.obj \ - $(SLO)$/sysplug.obj -.ENDIF # $(WITH_MOZILLA) != "NO" - -.ENDIF - -# ------------------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx deleted file mode 100644 index 4d25d597a..000000000 --- a/extensions/source/plugin/win/sysplug.cxx +++ /dev/null @@ -1,445 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#undef OPTIONAL - -#include - -#pragma warning (push,1) -#pragma warning (disable:4005) - -#include -#include -#include - -#pragma warning (pop) - -#include -#include -#include - - -extern NPNetscapeFuncs aNPNFuncs; - -#include - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OUStringToOString; - -#if OSL_DEBUG_LEVEL > 1 -void TRACE( char const * s ); -void TRACEN( char const * s, long n ); -#else -#define TRACE(x) -#define TRACEN(x,n) -#endif - - -//-------------------------------------------------------------------------------------------------- -PluginComm_Impl::PluginComm_Impl( const OUString& /*rMIME*/, const OUString& rName, HWND /*hWnd*/ ) - : PluginComm( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) ) -{ - // initialize plugin function table - memset( &_NPPfuncs, 0, sizeof( _NPPfuncs ) ); -#ifdef UNICODE - _plDLL = ::LoadLibrary( rName.getStr() ); -#else - OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) ); - _plDLL = ::LoadLibrary( aStr.getStr() ); -#endif - DBG_ASSERT( _plDLL, "### loading plugin dll failed!" ); - - NPError nErr = NPERR_NO_ERROR; - NPError (WINAPI * pEntry)( NPPluginFuncs* ); - retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry ); - - _NPPfuncs.size = sizeof( _NPPfuncs ); - _NPPfuncs.version = 0; - nErr = (*pEntry)( &_NPPfuncs ); - - DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" ); - DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR, - "### version failure!" ); - - m_eCall = eNP_Initialize; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -PluginComm_Impl::~PluginComm_Impl() -{ - if (_plDLL) - { -// NPP_Shutdown(); - - NPError (WINAPI * pShutdown)(); - if (retrieveFunction( _T("NP_Shutdown"), (void**)&pShutdown )) - { - NPError nErr = (*pShutdown)(); (void)nErr; - DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Shutdown() failed!" ); - } - - BOOL bRet = (BOOL)::FreeLibrary( _plDLL ); (void)bRet; - DBG_ASSERT( bRet, "### unloading plugin dll failed!" ); - _plDLL = NULL; - } -} - -//-------------------------------------------------------------------------------------------------- -BOOL PluginComm_Impl::retrieveFunction( TCHAR* pName, void** ppFunc ) const -{ - if( ! _plDLL ) - return FALSE; - - *ppFunc = (void*)::GetProcAddress( _plDLL, pName ); - - return (*ppFunc != NULL); -} - -//-------------------------------------------------------------------------------------------------- - -long PluginComm_Impl::doIt() -{ - long nRet = 0; - switch( m_eCall ) - { - case eNP_Initialize: - { - TRACE( "eNP_Initialize" ); - NPError (WINAPI * pInit)( NPNetscapeFuncs* ); - if ((_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR && - (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) || - retrieveFunction( _T("NP_PluginInit"), (void**)&pInit ))) - { - nRet = (*pInit)( &aNPNFuncs ); - } - else - { - nRet = NPERR_GENERIC_ERROR; - } - DBG_ASSERT( nRet == NPERR_NO_ERROR, "### NP_Initialize() failed!" ); - } - break; - case eNPP_Destroy: - TRACE( "eNPP_Destroy" ); - nRet = (_NPPfuncs.destroy - ? (*_NPPfuncs.destroy)( - (NPP)m_aArgs[0], - (NPSavedData**)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_DestroyStream: - TRACE( "eNPP_DestroyStream" ); - nRet = (_NPPfuncs.destroystream - ? (*_NPPfuncs.destroystream)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (NPError)(sal_IntPtr)m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_New: - TRACE( "eNPP_New" ); - nRet = (_NPPfuncs.newp - ? (*_NPPfuncs.newp)( - (NPMIMEType)m_aArgs[0], - (NPP)m_aArgs[1], - (uint16)(sal_IntPtr)m_aArgs[2], - (int16)(sal_IntPtr)m_aArgs[3], - (char**)m_aArgs[4], - (char**)m_aArgs[5], - (NPSavedData*)m_aArgs[6] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_NewStream: - TRACE( "eNPP_NewStream" ); - nRet = (_NPPfuncs.newstream - ? (*_NPPfuncs.newstream)( - (NPP)m_aArgs[0], - (NPMIMEType)m_aArgs[1], - (NPStream*)m_aArgs[2], - (NPBool)(sal_IntPtr)m_aArgs[3], - (uint16*)m_aArgs[4] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Print: - TRACE( "eNPP_Print" ); - if (_NPPfuncs.print) - (*_NPPfuncs.print)( - (NPP)m_aArgs[0], - (NPPrint*)m_aArgs[1] ); - break; - case eNPP_SetWindow: - { - TRACE( "eNPP_SetWindow" ); - nRet = (_NPPfuncs.setwindow - ? (*_NPPfuncs.setwindow)( - (NPP)m_aArgs[0], - (NPWindow*)m_aArgs[1] ) - : NPERR_GENERIC_ERROR); - break; - } - case eNPP_StreamAsFile: - TRACE( "eNPP_StreamAsFile" ); - if (_NPPfuncs.asfile) - (*_NPPfuncs.asfile)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (char*)m_aArgs[2] ); - break; - case eNPP_URLNotify: - TRACE( "eNPP_URLNotify" ); - if (_NPPfuncs.urlnotify) - (*_NPPfuncs.urlnotify)( - (NPP)m_aArgs[0], - (char*)m_aArgs[1], - (NPReason)(sal_IntPtr)m_aArgs[2], - m_aArgs[3] ); - break; - case eNPP_Write: - TRACEN( "eNPP_Write n=", (int32)m_aArgs[3] ); - nRet = (_NPPfuncs.write - ? (*_NPPfuncs.write)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1], - (int32)m_aArgs[2], - (int32)m_aArgs[3], - m_aArgs[4] ) - : 0); - break; - case eNPP_WriteReady: - TRACE( "eNPP_WriteReady" ); - nRet = (_NPPfuncs.writeready - ? (*_NPPfuncs.writeready)( - (NPP)m_aArgs[0], - (NPStream*)m_aArgs[1] ) - : 0); - break; - case eNPP_GetValue: - TRACE( "eNPP_GetValue" ); - nRet = (_NPPfuncs.getvalue - ? (*_NPPfuncs.getvalue)( - (NPP)m_aArgs[0], - (NPPVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_SetValue: - TRACE( "eNPP_SetValue" ); - nRet = (_NPPfuncs.setvalue - ? (*_NPPfuncs.setvalue)( - (NPP)m_aArgs[0], - (NPNVariable)(int)m_aArgs[1], - m_aArgs[2] ) - : NPERR_GENERIC_ERROR); - break; - case eNPP_Shutdown: - { - TRACE( "eNPP_Shutdown" ); - NPP_ShutdownUPP pFunc; - if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc )) - (*pFunc)(); - } - break; - case eNPP_Initialize: - TRACE( "eNPP_Initialize" ); - OSL_FAIL( "NPP_Initialize: not implemented!" ); - break; - case eNPP_GetJavaClass: - TRACE( "eNPP_GetJavaClass" ); - OSL_FAIL( "NPP_GetJavaClass: not implemented!" ); - break; - } - return nRet; -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save ) -{ - DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Destroy; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)save; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason ) -{ - DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_DestroyStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)reason; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData *saved ) -{ - DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" ); - m_eCall = eNPP_New; - m_aArgs[0] = (void*)pluginType; - m_aArgs[1] = (void*)instance; - m_aArgs[2] = (void*)mode; - m_aArgs[3] = (void*)argc; - m_aArgs[4] = (void*)argn; - m_aArgs[5] = (void*)argv; - m_aArgs[6] = (void*)saved; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream, - NPBool seekable, uint16* stype ) -{ - DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" ); - m_eCall = eNPP_NewStream; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)type; - m_aArgs[2] = (void*)stream; - m_aArgs[3] = (void*)seekable; - m_aArgs[4] = (void*)stype; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint ) -{ - DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Print; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)platformPrint; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window ) -{ - DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetWindow; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)window; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname ) -{ - DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" ); - m_eCall = eNPP_StreamAsFile; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)fname; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -void PluginComm_Impl::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData ) -{ - DBG_ASSERT( _NPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" ); - m_eCall = eNPP_URLNotify; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)url; - m_aArgs[2] = (void*)reason; - m_aArgs[3] = notifyData; - execute(); -} - -//-------------------------------------------------------------------------------------------------- -int32 PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer ) -{ - DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" ); - m_eCall = eNPP_Write; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - m_aArgs[2] = (void*)offset; - m_aArgs[3] = (void*)len; - m_aArgs[4] = buffer; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -int32 PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream ) -{ - DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" ); - m_eCall = eNPP_WriteReady; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)stream; - return execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_value ) -{ - DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_GetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = ret_value; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *set_value ) -{ - DBG_ASSERT( _NPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" ); - m_eCall = eNPP_SetValue; - m_aArgs[0] = (void*)instance; - m_aArgs[1] = (void*)variable; - m_aArgs[2] = set_value; - return (NPError)execute(); -} - -//-------------------------------------------------------------------------------------------------- -void * PluginComm_Impl::NPP_GetJavaClass() -{ - OSL_FAIL( "no java class available!" ); - return 0; -} - -//-------------------------------------------------------------------------------------------------- -NPError PluginComm_Impl::NPP_Initialize() -{ - return NPERR_NO_ERROR; -} - -//-------------------------------------------------------------------------------------------------- -void PluginComm_Impl::NPP_Shutdown() -{ - m_eCall = eNPP_Shutdown; - execute(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx deleted file mode 100644 index c92b31054..000000000 --- a/extensions/source/plugin/win/winmgr.cxx +++ /dev/null @@ -1,453 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#undef OPTIONAL - -#include "vcl/svapp.hxx" -#include "tools/fsys.hxx" -#include "tools/urlobj.hxx" -#include "osl/mutex.hxx" - -#include "rtl/string.hxx" -#include "rtl/ustring.hxx" -#include "rtl/ustrbuf.hxx" - -#include "plugin/impl.hxx" - -#pragma warning (push,1) -#pragma warning (disable:4005) - -#include -#include -#include - -#pragma warning (pop) - -#include -#include -#include - - -using namespace std; -using namespace osl; -using namespace com::sun::star::uno; -using namespace com::sun::star::plugin; - -using ::rtl::OUString; -using ::rtl::OString; -using ::rtl::OStringToOUString; -using ::rtl::OUStringToOString; - -typedef map< OString, OUString, less< OString > > PluginLocationMap; - -//__________________________________________________________________________________________________ -static void addPluginsFromPath( const TCHAR * pPluginsPath, PluginLocationMap & rPlugins ) -{ - // append dll name pattern we are looking for - TCHAR arPluginsPath[MAX_PATH]; - arPluginsPath[0] = 0; - - if (::rtl_str_indexOfStr( pPluginsPath, "%programfiles%" ) == 0) - { - const char * p = ::getenv( "ProgramFiles" ); - if (p) - { - ::lstrcpy( arPluginsPath, p ); - pPluginsPath += 14; - } - } - ::lstrcat( arPluginsPath, pPluginsPath ); - ::lstrcat( arPluginsPath, _T("\\") ); - - TCHAR arPluginsPattern[MAX_PATH]; - ::lstrcpy( arPluginsPattern, arPluginsPath ); - ::lstrcat( arPluginsPattern, _T("NP*.DLL") ); - - WIN32_FIND_DATA aFindData; - HANDLE hFind = ::FindFirstFile( arPluginsPattern, &aFindData ); - - while (hFind != INVALID_HANDLE_VALUE) - { - OString aName( aFindData.cFileName ); - aName.toAsciiLowerCase(); - - // no netscape default plugin anymore... - // and no double plugin dlls - if ( !aName.equals( "npnul32.dll" ) && - ! aName.equals( "npnrvp.dll" ) && - rPlugins.find( aName ) == rPlugins.end()) - { - TCHAR arComplete[MAX_PATH]; - ::lstrcpy( arComplete, arPluginsPath ); - ::lstrcat( arComplete, aFindData.cFileName ); - - OUString path( OStringToOUString( arComplete, RTL_TEXTENCODING_MS_1252 ) ); - rPlugins[ aName ] = path; - } - - if (! ::FindNextFile( hFind, &aFindData )) - break; - } - - if (hFind != INVALID_HANDLE_VALUE) - ::FindClose( hFind ); -} -//__________________________________________________________________________________________________ -static void addPluginsFromPath( const OUString & rPath, PluginLocationMap & rPlugins ) -{ - TCHAR arPluginsPath[MAX_PATH]; - DWORD dwPluginsPathSize = sizeof(arPluginsPath); - arPluginsPath[dwPluginsPathSize-1] = 0; - - OString aStr( OUStringToOString( rPath, RTL_TEXTENCODING_MS_1252 ) ); - ::strncpy( arPluginsPath, aStr.getStr(), dwPluginsPathSize ); - - addPluginsFromPath( arPluginsPath, rPlugins ); -} - - -//__________________________________________________________________________________________________ -static void add_IE_Plugins( PluginLocationMap & rPlugins ) -{ - HKEY hKey; - TCHAR arCurrent[MAX_PATH]; - DWORD dwType, dwCurrentSize = sizeof(arCurrent); - - if (::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\IE4\\SETUP"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - if (::RegQueryValueEx( hKey, _T("Path"), NULL, &dwType, - (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - // add \\Plugins - ::lstrcat( arCurrent, _T("\\Plugins") ); - - addPluginsFromPath( arCurrent, rPlugins ); - } - ::RegCloseKey( hKey ); - } -} - -//-------------------------------------------------------------------------------------------------- -static void add_NS_keys( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR value[MAX_PATH]; - DWORD dwType, size = sizeof(value); - - // 4.7 - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Plugins Directory"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - addPluginsFromPath( value, rPlugins ); - } - // 6 - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Install Directory"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - int n = size / sizeof (TCHAR); - if ('\\' != value[ n -2 ]) - { - value[ n -1 ] = '\\'; - value[ n ] = 0; - } - addPluginsFromPath( ::lstrcat( value, _T("Plugins") ), rPlugins ); - } - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Plugins"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - addPluginsFromPath( value, rPlugins ); - } -} -//-------------------------------------------------------------------------------------------------- -static void add_NS_lookupRecursive( HKEY hKey, PluginLocationMap & rPlugins ) -{ - add_NS_keys( hKey, rPlugins ); - - TCHAR keyName[MAX_PATH]; - DWORD dwIndex = 0, size = sizeof (keyName); - - while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) - { - size = sizeof (keyName); - HKEY hSubKey; - if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hSubKey, rPlugins ); - ::RegCloseKey( hSubKey ); - } - ++dwIndex; - } -} -//__________________________________________________________________________________________________ -static void add_MozPlugin( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR value[MAX_PATH]; - DWORD dwType, size = sizeof(value); - - size = sizeof(value); - if (::RegQueryValueEx( - hKey, _T("Path"), NULL, &dwType, - (LPBYTE)value, &size ) == ERROR_SUCCESS && - (dwType == REG_SZ || dwType == REG_EXPAND_SZ)) - { - OUString aUPath( OStringToOUString( value, RTL_TEXTENCODING_MS_1252 ) ); - INetURLObject aURL( aUPath ); - OString aName( OUStringToOString( aURL.GetName().toAsciiLowerCase(), RTL_TEXTENCODING_MS_1252 ) ); - - // no netscape default plugin anymore... - // and no double plugin dlls - if ( !aName.equals( "npnul32.dll" ) && - ! aName.equals( "npnrvp.dll" ) && - rPlugins.find( aName ) == rPlugins.end()) - { - rPlugins[ aName ] = aUPath; - } - } -} -static void add_MozillaPlugin( HKEY hKey, PluginLocationMap & rPlugins ) -{ - TCHAR keyName[MAX_PATH]; - DWORD dwIndex = 0, size = sizeof (keyName); - - while (::RegEnumKeyEx( hKey, dwIndex, keyName, &size, NULL, NULL, NULL, NULL ) == ERROR_SUCCESS) - { - size = sizeof (keyName); - HKEY hSubKey; - if (::RegOpenKeyEx( hKey, keyName, 0, KEY_READ, &hSubKey ) == ERROR_SUCCESS) - { - add_MozPlugin( hSubKey, rPlugins ); - ::RegCloseKey( hSubKey ); - } - ++dwIndex; - } -} -//__________________________________________________________________________________________________ -static void add_NS_Plugins( PluginLocationMap & rPlugins ) -{ - HKEY hKey; - // Netscape - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\Netscape"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } - // Mozilla - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\Mozilla"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_NS_lookupRecursive( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } - // Mozilla - plugins - if (::RegOpenKeyEx( - HKEY_LOCAL_MACHINE, _T("Software\\MozillaPlugins"), - 0, KEY_READ, &hKey ) == ERROR_SUCCESS) - { - add_MozillaPlugin( hKey, rPlugins ); - ::RegCloseKey( hKey ); - } -} - -//__________________________________________________________________________________________________ -static void add_SO_Plugins( PluginLocationMap & rPlugins ) -{ - const Sequence< OUString > & rPaths = PluginManager::getAdditionalSearchPaths(); - - const OUString * pPaths = rPaths.getConstArray(); - for ( UINT32 nPos = rPaths.getLength(); nPos--; ) - { - addPluginsFromPath( pPaths[nPos], rPlugins ); - } -} - -//__________________________________________________________________________________________________ -Sequence< PluginDescription > XPluginManager_Impl::impl_getPluginDescriptions(void) throw() -{ - Guard< Mutex > aGuard( Mutex::getGlobalMutex() ); - static Sequence s_aDescriptions( 0 ); - static bool s_bInit = FALSE; - - if (! s_bInit) - { - // collect all distinct plugin dlls - PluginLocationMap aPlugins; - add_SO_Plugins( aPlugins ); - add_NS_Plugins( aPlugins ); - add_IE_Plugins( aPlugins ); - - // collect mime types of plugin dlls - for ( PluginLocationMap::iterator iPos( aPlugins.begin() ); - iPos != aPlugins.end(); - ++iPos ) - { - TCHAR arFileName[MAX_PATH]; - DWORD dwDummy, dwSize; - - // DLL name - OUString aName( (*iPos).second.getStr() ); - - OString aStr( OUStringToOString( aName, RTL_TEXTENCODING_MS_1252 ) ); - ::strcpy( arFileName, aStr.getStr() ); - dwSize = ::GetFileVersionInfoSize( arFileName, &dwDummy ); - - if ( !dwSize ) - continue; - - char * pVersionData = new char[dwSize]; - if (pVersionData && ::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData )) - { - // optional comment - OUString aComment; - - TCHAR * pInfo = NULL, * pInfo2 = NULL; - UINT nSize = 0; - if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\ProductName"), - (void**)&pInfo, &nSize ) && pInfo) - { - aComment.operator=( OStringToOUString( OString(pInfo), RTL_TEXTENCODING_MS_1252 ) ); - } - - // mandatory mime type and file extensions - if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\MIMEType"), - (void**)&pInfo, &nSize ) && pInfo && - ::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\FileExtents"), - (void**)&pInfo2, &nSize ) && pInfo2) - { - OString aStr2( pInfo2 ); - OString aExt( aStr2 ); - OString aStr( pInfo ); - OString aMIME( aStr ); - aMIME.trim(); - - // count mime tokens - USHORT nToken = 0; - if (aMIME.getLength()) - { - ++nToken; - for ( sal_Int32 n = aMIME.getLength(); n--; ) - { - if (aMIME[ n ] == '|') - { - ++nToken; - } - } - } - sal_Int32 nIndex = 0, nIndex2 = 0; - - UINT32 nStart = s_aDescriptions.getLength(); - s_aDescriptions.realloc( nStart + nToken ); - PluginDescription* pDescriptions = s_aDescriptions.getArray(); - // for every MIME Type - sal_Int32 nTok = 0; - while (true) - { - if (nIndex < 0 || nIndex2 < 0) - break; - - PluginDescription & rDescr = pDescriptions[nStart+nTok]; - OString aMIMEToken( aMIME.getToken( 0, '|', nIndex ) ); - OString aExtToken2( aExt.getToken( 0, '|', nIndex2 ) ); - if( aMIMEToken.getLength() == 0 || aExtToken2.getLength() == 0 ) - continue; - - rDescr.Mimetype = OUString( - aMIMEToken.getStr(), aMIMEToken.getLength(), RTL_TEXTENCODING_MS_1252 ); - if (! rDescr.Mimetype.getLength()) - break; - - OUString aExtToken( aExtToken2.getStr(), aExtToken2.getLength(), RTL_TEXTENCODING_MS_1252 ); - rDescr.PluginName = aName; - rDescr.Description = aComment; - - sal_Int32 nPos = 0, nLen = aExtToken.getLength(); - OUString aExtensions = nLen ? OUString(RTL_CONSTASCII_USTRINGPARAM("*.")) : OUString(RTL_CONSTASCII_USTRINGPARAM("*.*")); - - for ( ; nPos < nLen; ++nPos ) - { - sal_Unicode c = aExtToken[nPos]; - switch (c) - { - case ',': - case ';': - aExtensions += OUString(RTL_CONSTASCII_USTRINGPARAM(";*.")); - case ' ': - break; - case '*': - if (nPos < (nLen-1) && aExtToken[ nPos+1 ] == '.') - { - ++nPos; - break; - } - default: - aExtensions += OUString( &c, 1 ); - } - } - rDescr.Extension = aExtensions; - - ++nTok; - } - - if (nToken != nTok) - { - s_aDescriptions.realloc( nTok ); - } - } -#if OSL_DEBUG_LEVEL > 1 - else - OSL_FAIL( "### cannot get MIME type or extensions!" ); -#endif - } - if (pVersionData) - delete[] pVersionData; - } - - s_bInit = TRUE; - } - return s_aDescriptions; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx deleted file mode 100644 index 644331acd..000000000 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - #include "precompiled_extensions.hxx" - #include "MasterDetailLinkDialog.hxx" - #include "formlinkdialog.hxx" - - extern "C" void SAL_CALL createRegistryInfo_MasterDetailLinkDialog() -{ - ::pcr::OAutoRegistration< ::pcr::MasterDetailLinkDialog > aAutoRegistration; -} - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - - //==================================================================== - //= MasterDetailLinkDialog - //==================================================================== - //--------------------------------------------------------------------- - MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext ) - :OGenericUnoDialog( _rxContext ) - { - } -//--------------------------------------------------------------------- - Sequence SAL_CALL MasterDetailLinkDialog::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL MasterDetailLinkDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new MasterDetailLinkDialog( _rxContext ) ); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL MasterDetailLinkDialog::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString MasterDetailLinkDialog::getImplementationName_static() throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.form.ui.MasterDetailLinkDialog")); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL MasterDetailLinkDialog::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence MasterDetailLinkDialog::getSupportedServiceNames_static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.MasterDetailLinkDialog")); - return aSupported; - } - - //--------------------------------------------------------------------- - Reference SAL_CALL MasterDetailLinkDialog::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& MasterDetailLinkDialog::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - - //-------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* MasterDetailLinkDialog::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //-------------------------------------------------------------------------- - Dialog* MasterDetailLinkDialog::createDialog(Window* _pParent) - { - return new FormLinkDialog(_pParent,m_xDetail,m_xMaster,m_aContext.getLegacyServiceFactory() - ,m_sExplanation,m_sDetailLabel,m_sMasterLabel); - } - //--------------------------------------------------------------------- - void MasterDetailLinkDialog::implInitialize(const Any& _rValue) - { - PropertyValue aProperty; - if (_rValue >>= aProperty) - { - if (0 == aProperty.Name.compareToAscii("Detail")) - { - OSL_VERIFY( aProperty.Value >>= m_xDetail ); - return; - } - else if (0 == aProperty.Name.compareToAscii("Master")) - { - OSL_VERIFY( aProperty.Value >>= m_xMaster ); - return; - } - else if (0 == aProperty.Name.compareToAscii("Explanation")) - { - OSL_VERIFY( aProperty.Value >>= m_sExplanation ); - return; - } - else if (0 == aProperty.Name.compareToAscii("DetailLabel")) - { - OSL_VERIFY( aProperty.Value >>= m_sDetailLabel ); - return; - } - else if (0 == aProperty.Name.compareToAscii("MasterLabel")) - { - OSL_VERIFY( aProperty.Value >>= m_sMasterLabel ); - return; - } - } - MasterDetailLinkDialog_DBase::implInitialize(_rValue); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx deleted file mode 100644 index dcfd8e76e..000000000 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef PROPCTRLR_MASTERDETAILLINKDIALOG_HXX -#define PROPCTRLR_MASTERDETAILLINKDIALOG_HXX -#include -#include "modulepcr.hxx" -//........................................................................ -namespace pcr -{ -//........................................................................ - - class MasterDetailLinkDialog; - typedef ::svt::OGenericUnoDialog MasterDetailLinkDialog_DBase; - typedef ::comphelper::OPropertyArrayUsageHelper< MasterDetailLinkDialog > MasterDetailLinkDialog_PBase; - - //======================================================================== - //= MasterDetailLinkDialog - //======================================================================== - class MasterDetailLinkDialog : public MasterDetailLinkDialog_DBase - ,public MasterDetailLinkDialog_PBase - ,public PcrClient - { - public: - MasterDetailLinkDialog(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& _rxContext); - - // XServiceInfo - static methods - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >&); - private: - // XTypeProvider - virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - virtual void implInitialize(const com::sun::star::uno::Any& _rValue); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDetail; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xMaster; - ::rtl::OUString m_sExplanation; - ::rtl::OUString m_sDetailLabel; - ::rtl::OUString m_sMasterLabel; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ -#endif // PROPCTRLR_MASTERDETAILLINKDIALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx deleted file mode 100644 index e337bc6fe..000000000 --- a/extensions/source/propctrlr/browserline.cxx +++ /dev/null @@ -1,532 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "browserline.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::inspection::XPropertyControlContext; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::graphic::XGraphicProvider; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::graphic::XGraphic; - /** === end UNO using === **/ - - namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; - - //================================================================== - //= OBrowserLine - //================================================================== - DBG_NAME(OBrowserLine) - //------------------------------------------------------------------ - - OBrowserLine::OBrowserLine( const ::rtl::OUString& _rEntryName, Window* pParent ) - :m_sEntryName( _rEntryName ) - ,m_aFtTitle(pParent) - ,m_pControlWindow( NULL ) - ,m_pBrowseButton(NULL) - ,m_pAdditionalBrowseButton( NULL ) - ,m_pClickListener( NULL ) - ,m_pTheParent(pParent) - ,m_nNameWidth(0) - ,m_nEnableFlags( 0xFFFF ) - ,m_bIndentTitle( false ) - ,m_bReadOnly( false ) - { - DBG_CTOR(OBrowserLine,NULL); - m_aFtTitle.Show(); - } - - //------------------------------------------------------------------ - OBrowserLine::~OBrowserLine() - { - implHideBrowseButton( true, false ); - implHideBrowseButton( false, false ); - - DBG_DTOR(OBrowserLine,NULL); - } - - //------------------------------------------------------------------ - void OBrowserLine::IndentTitle( bool _bIndent ) - { - if ( m_bIndentTitle != _bIndent ) - { - m_bIndentTitle = _bIndent; - impl_layoutComponents(); - } - } - - //------------------------------------------------------------------ - void OBrowserLine::SetComponentHelpIds( const rtl::OString& _rHelpId, const rtl::OString& _sPrimaryButtonId, const rtl::OString& _sSecondaryButtonId ) - { - if ( m_pControlWindow ) - m_pControlWindow->SetHelpId( _rHelpId ); - - if ( m_pBrowseButton ) - { - m_pBrowseButton->SetHelpId( _rHelpId ); - m_pBrowseButton->SetUniqueId( _sPrimaryButtonId ); - - if ( m_pAdditionalBrowseButton ) - { - m_pAdditionalBrowseButton->SetHelpId( _rHelpId ); - m_pAdditionalBrowseButton->SetUniqueId( _sSecondaryButtonId ); - } - } - } - - //------------------------------------------------------------------ - void OBrowserLine::setControl( const Reference< XPropertyControl >& _rxControl ) - { - m_xControl = _rxControl; - m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : NULL; - DBG_ASSERT( m_pControlWindow, "OBrowserLine::setControl: setting NULL controls/windows is not allowed!" ); - - if ( m_pControlWindow ) - { - m_pControlWindow->SetParent( m_pTheParent ); - m_pControlWindow->Show(); - } - impl_layoutComponents(); - } - - //------------------------------------------------------------------ - Window* OBrowserLine::GetRefWindow() - { - Window* pRefWindow=&m_aFtTitle; - - if(m_pBrowseButton) - { - pRefWindow=(Window*)m_pBrowseButton; - } - else if ( m_pControlWindow ) - { - pRefWindow = m_pControlWindow; - } - return pRefWindow; - } - - //------------------------------------------------------------------ - void OBrowserLine::SetTabOrder(Window* pRefWindow, sal_uInt16 nFlags ) - { - m_aFtTitle.SetZOrder(pRefWindow,nFlags); - if ( m_pControlWindow ) - m_pControlWindow->SetZOrder( (Window*)&m_aFtTitle, WINDOW_ZORDER_BEHIND ); - - if ( m_pBrowseButton ) - m_pBrowseButton->SetZOrder( m_pControlWindow, WINDOW_ZORDER_BEHIND ); - - if ( m_pAdditionalBrowseButton ) - m_pAdditionalBrowseButton->SetZOrder( m_pBrowseButton, WINDOW_ZORDER_BEHIND ); - } - - //------------------------------------------------------------------ - sal_Bool OBrowserLine::GrabFocus() - { - sal_Bool bRes=sal_False; - - if ( m_pControlWindow && m_pControlWindow->IsEnabled() ) - { - m_pControlWindow->GrabFocus(); - bRes = sal_True; - } - else if ( m_pAdditionalBrowseButton && m_pAdditionalBrowseButton->IsEnabled() ) - { - m_pAdditionalBrowseButton->GrabFocus(); - bRes = sal_True; - } - else if ( m_pBrowseButton && m_pBrowseButton->IsEnabled() ) - { - m_pBrowseButton->GrabFocus(); - bRes = sal_True; - } - return bRes; - } - - //------------------------------------------------------------------ - void OBrowserLine::SetPosSizePixel( Point _rPos, Size _rSize ) - { - m_aLinePos = _rPos; - m_aOutputSize = _rSize; - - impl_layoutComponents(); - } - - //------------------------------------------------------------------ - void OBrowserLine::Show(sal_Bool bFlag) - { - m_aFtTitle.Show(bFlag); - if ( m_pControlWindow ) - m_pControlWindow->Show( bFlag ); - if ( m_pBrowseButton ) - m_pBrowseButton->Show( bFlag ); - if ( m_pAdditionalBrowseButton ) - m_pAdditionalBrowseButton->Show( bFlag ); - } - - //------------------------------------------------------------------ - void OBrowserLine::Hide() - { - Show(sal_False); - } - - //------------------------------------------------------------------ - sal_Bool OBrowserLine::IsVisible() - { - return m_aFtTitle.IsVisible(); - } - - //------------------------------------------------------------------ - void OBrowserLine::impl_layoutComponents() - { - { - Point aTitlePos( m_aLinePos.X(), m_aLinePos.Y() + 8 ); - Size aTitleSize( m_nNameWidth - 3, m_aOutputSize.Height() ); - - if ( m_bIndentTitle ) - { - Size aIndent( m_pTheParent->LogicToPixel( Size( 8, 0 ), MAP_APPFONT ) ); - aTitlePos.X() += aIndent.Width(); - aTitleSize.Width() -= aIndent.Width(); - } - m_aFtTitle.SetPosSizePixel( aTitlePos, aTitleSize ); - } - - sal_Int32 nBrowseButtonSize = m_aOutputSize.Height() - 4; - - if ( m_pControlWindow ) - { - Point aControlPos( m_aLinePos.X() + m_nNameWidth, m_aLinePos.Y() + 2 ); - m_pControlWindow->SetPosPixel( aControlPos ); - - Size aControlSize( m_aOutputSize.Width() - 4 - m_nNameWidth - nBrowseButtonSize - 4, m_pControlWindow->GetSizePixel().Height() ); - if ( m_pAdditionalBrowseButton ) - aControlSize.Width() -= nBrowseButtonSize + 4; - m_pControlWindow->SetSizePixel( aControlSize ); - } - - if ( m_pBrowseButton ) - { - Point aButtonPos( m_aOutputSize.Width() - 4 - nBrowseButtonSize, m_aLinePos.Y() + 2 ); - Size aButtonSize( nBrowseButtonSize, nBrowseButtonSize ); - m_pBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize ); - - if ( m_pAdditionalBrowseButton ) - { - aButtonPos.X() -= nBrowseButtonSize + 4; - m_pAdditionalBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize ); - } - } - } - - //------------------------------------------------------------------ - void OBrowserLine::SetTitle(const XubString& _rNewTtile ) - { - if ( GetTitle() == _rNewTtile ) - return; - // #99102# -------------- - m_aFtTitle.SetText( _rNewTtile ); - if ( m_pControlWindow ) - m_pControlWindow->SetAccessibleName( _rNewTtile ); - if ( m_pBrowseButton ) - m_pBrowseButton->SetAccessibleName( _rNewTtile ); - FullFillTitleString(); - } - - // #99102# --------------------------------------------------------- - void OBrowserLine::FullFillTitleString() - { - if( m_pTheParent ) - { - String aText = m_aFtTitle.GetText(); - - while( m_pTheParent->GetTextWidth( aText ) < m_nNameWidth ) - aText.AppendAscii("..........."); - - // for Issue 69452 - if (Application::GetSettings().GetLayoutRTL()) - { - sal_Unicode cRTL_mark = 0x200F; - aText.Append(cRTL_mark); - } - - m_aFtTitle.SetText(aText); - } - } - - //------------------------------------------------------------------ - XubString OBrowserLine::GetTitle() const - { - String sDisplayName = m_aFtTitle.GetText(); - - // for Issue 69452 - if (Application::GetSettings().GetLayoutRTL()) - { - sal_Unicode cRTL_mark = 0x200F; - sDisplayName.EraseTrailingChars(cRTL_mark); - } - - sDisplayName.EraseTrailingChars( '.' ); - - return sDisplayName; - } - - //------------------------------------------------------------------ - void OBrowserLine::SetReadOnly( bool _bReadOnly ) - { - if ( m_bReadOnly != _bReadOnly ) - { - m_bReadOnly = _bReadOnly; - implUpdateEnabledDisabled(); - } - } - - //------------------------------------------------------------------ - namespace - { - void implSetBitIfAffected( sal_uInt16& _nEnabledBits, sal_Int16 _nAffectedMask, sal_Int16 _nTestBit, bool _bSet ) - { - if ( _nAffectedMask & _nTestBit ) - { - if ( _bSet ) - _nEnabledBits |= _nTestBit; - else - _nEnabledBits &= ~_nTestBit; - } - } - - void implEnable( Window* _pWindow, sal_uInt16 _nEnabledBits, sal_uInt16 _nMatchBits ) - { - if ( _pWindow ) - _pWindow->Enable( ( _nEnabledBits & _nMatchBits ) == _nMatchBits ); - } - - void implEnable( Window* _pWindow, bool _bEnable ) - { - if ( _pWindow ) - _pWindow->Enable( _bEnable ); - } - } - - //------------------------------------------------------------------ - void OBrowserLine::implUpdateEnabledDisabled() - { - implEnable( &m_aFtTitle, m_nEnableFlags, PropertyLineElement::CompleteLine ); - if ( m_pControlWindow ) - implEnable( m_pControlWindow, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::InputControl ); - - if ( m_bReadOnly ) - { - implEnable( m_pBrowseButton, false ); - implEnable( m_pAdditionalBrowseButton, false ); - } - else - { - implEnable( m_pBrowseButton, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::PrimaryButton ); - implEnable( m_pAdditionalBrowseButton, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::SecondaryButton ); - } - } - - //------------------------------------------------------------------ - void OBrowserLine::EnablePropertyLine( bool _bEnable ) - { - implSetBitIfAffected( m_nEnableFlags, PropertyLineElement::CompleteLine, PropertyLineElement::CompleteLine, _bEnable ); - implUpdateEnabledDisabled(); - } - - //------------------------------------------------------------------ - void OBrowserLine::EnablePropertyControls( sal_Int16 _nControls, bool _bEnable ) - { - implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::InputControl, _bEnable ); - implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::PrimaryButton, _bEnable ); - implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::SecondaryButton, _bEnable ); - implUpdateEnabledDisabled(); - } - - //------------------------------------------------------------------ - PushButton& OBrowserLine::impl_ensureButton( bool _bPrimary ) - { - PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton; - - if ( !rpButton ) - { - rpButton = new PushButton( m_pTheParent, WB_NOPOINTERFOCUS ); - rpButton->SetGetFocusHdl( LINK( this, OBrowserLine, OnButtonFocus ) ); - rpButton->SetClickHdl( LINK( this, OBrowserLine, OnButtonClicked ) ); - rpButton->SetText( String::CreateFromAscii( "..." ) ); - } - - rpButton->Show(); - - impl_layoutComponents(); - - return *rpButton; - } - - //------------------------------------------------------------------ - void OBrowserLine::impl_getImagesFromURL_nothrow( const ::rtl::OUString& _rImageURL, Image& _out_rImage ) - { - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); - - Sequence< PropertyValue > aMediaProperties(1); - aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); - aMediaProperties[0].Value <<= _rImageURL; - - Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ), UNO_QUERY_THROW ); - _out_rImage = Image( xGraphic ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------ - void OBrowserLine::ShowBrowseButton( const ::rtl::OUString& _rImageURL, sal_Bool _bPrimary ) - { - PushButton& rButton( impl_ensureButton( _bPrimary ) ); - - OSL_PRECOND( _rImageURL.getLength(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" ); - Image aImage; - impl_getImagesFromURL_nothrow( _rImageURL, aImage ); - - rButton.SetModeImage( aImage ); - } - - //------------------------------------------------------------------ - void OBrowserLine::ShowBrowseButton( const Image& _rImage, sal_Bool _bPrimary ) - { - PushButton& rButton( impl_ensureButton( _bPrimary ) ); - if ( !!_rImage ) - rButton.SetModeImage( _rImage ); - } - - //------------------------------------------------------------------ - void OBrowserLine::ShowBrowseButton( sal_Bool _bPrimary ) - { - impl_ensureButton( _bPrimary ); - } - - //------------------------------------------------------------------ - void OBrowserLine::implHideBrowseButton( sal_Bool _bPrimary, bool _bReLayout ) - { - PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton; - - if ( rpButton ) - { - rpButton->Hide(); - delete rpButton; - rpButton = NULL; - } - - if ( _bReLayout ) - impl_layoutComponents(); - } - - //------------------------------------------------------------------ - void OBrowserLine::HideBrowseButton( sal_Bool _bPrimary ) - { - implHideBrowseButton( _bPrimary, true ); - } - - //------------------------------------------------------------------ - void OBrowserLine::SetTitleWidth(sal_uInt16 nWidth) - { - if (m_nNameWidth != nWidth+10) - { - m_nNameWidth = nWidth+10; - impl_layoutComponents(); - } - // #99102# --------- - FullFillTitleString(); - } - - //------------------------------------------------------------------ - void OBrowserLine::SetClickListener( IButtonClickListener* _pListener ) - { - m_pClickListener = _pListener; - } - - //------------------------------------------------------------------ - IMPL_LINK( OBrowserLine, OnButtonClicked, PushButton*, _pButton ) - { - if ( m_pClickListener ) - m_pClickListener->buttonClicked( this, _pButton == m_pBrowseButton ); - - return 0L; - } - - //------------------------------------------------------------------ - IMPL_LINK( OBrowserLine, OnButtonFocus, PushButton*, /*pPB*/ ) - { - if ( m_xControl.is() ) - { - try - { - Reference< XPropertyControlContext > xContext( m_xControl->getControlContext(), UNO_QUERY_THROW ); - xContext->focusGained( m_xControl ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return 0; - } -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx deleted file mode 100644 index 0f0b2f30a..000000000 --- a/extensions/source/propctrlr/browserline.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ -#define _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include -#include - -namespace com { namespace sun { namespace star { namespace inspection { namespace PropertyLineElement -{ - const sal_Int16 CompleteLine = 0x4000; -} } } } } - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class OBrowserLine; - - //======================================================================== - class IButtonClickListener - { - public: - virtual void buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ) = 0; - }; - - //======================================================================== - class OBrowserLine - { - private: - ::rtl::OUString m_sEntryName; - FixedText m_aFtTitle; - Size m_aOutputSize; - Point m_aLinePos; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - m_xControl; - Window* m_pControlWindow; - PushButton* m_pBrowseButton; - PushButton* m_pAdditionalBrowseButton; - IButtonClickListener* m_pClickListener; - Window* m_pTheParent; - sal_uInt16 m_nNameWidth; - sal_uInt16 m_nEnableFlags; - bool m_bIndentTitle; - bool m_bReadOnly; - - public: - OBrowserLine( const ::rtl::OUString& _rEntryName, Window* pParent); - ~OBrowserLine(); - - void setControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ); - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& getControl() const - { - return m_xControl; - } - inline Window* getControlWindow() const - { - return m_pControlWindow; - } - - const ::rtl::OUString& - GetEntryName() const { return m_sEntryName; } - - void SetComponentHelpIds( const rtl::OString& _rHelpId, const rtl::OString& _sPrimaryButtonId, const rtl::OString& _sSecondaryButtonId ); - - void SetTitle(const String& rString ); - void FullFillTitleString(); - String GetTitle() const; - void SetTitleWidth(sal_uInt16); - - void SetPosSizePixel(Point aPos,Size aSize); - void Show(sal_Bool bFlag=sal_True); - void Hide(); - sal_Bool IsVisible(); - - Window* GetRefWindow(); - void SetTabOrder(Window* pRefWindow, sal_uInt16 nFlags ); - - sal_Bool GrabFocus(); - void ShowBrowseButton( const ::rtl::OUString& _rImageURL, sal_Bool _bPrimary ); - void ShowBrowseButton( const Image& _rImage, sal_Bool _bPrimary ); - void ShowBrowseButton( sal_Bool _bPrimary ); - void HideBrowseButton( sal_Bool _bPrimary ); - - void EnablePropertyControls( sal_Int16 _nControls, bool _bEnable ); - void EnablePropertyLine( bool _bEnable ); - - void SetReadOnly( bool _bReadOnly ); - - void SetClickListener( IButtonClickListener* _pListener ); - - void IndentTitle( bool _bIndent ); - - private: - DECL_LINK( OnButtonClicked, PushButton* ); - DECL_LINK( OnButtonFocus, PushButton* ); - - void implHideBrowseButton( sal_Bool _bPrimary, bool _bReLayout ); - void implUpdateEnabledDisabled(); - - void impl_layoutComponents(); - - PushButton& impl_ensureButton( bool _bPrimary ); - void impl_getImagesFromURL_nothrow( const ::rtl::OUString& _rImageURL, Image& _out_rImage ); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_BROWSERLINE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx deleted file mode 100644 index b24bc99fb..000000000 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ /dev/null @@ -1,1311 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "browserlistbox.hxx" -#include "propresid.hrc" -#include "proplinelistener.hxx" -#include "propcontrolobserver.hxx" -#include "linedescriptor.hxx" -#include "inspectorhelpwindow.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - #define FRAME_OFFSET 4 - // TODO: find out what this is really for ... and check if it does make sense in the new - // browser environment - #define LAYOUT_HELP_WINDOW_DISTANCE_APPFONT 3 - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::inspection::XPropertyControlContext; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::XComponent; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::graphic::XGraphic; - /** === end UNO using === **/ - namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; - - //================================================================== - //= ControlEvent - //================================================================== - enum ControlEventType - { - FOCUS_GAINED, - VALUE_CHANGED, - ACTIVATE_NEXT - }; - - struct ControlEvent : public ::comphelper::AnyEvent - { - Reference< XPropertyControl > xControl; - ControlEventType eType; - - ControlEvent( const Reference< XPropertyControl >& _rxControl, ControlEventType _eType ) - :xControl( _rxControl ) - ,eType( _eType ) - { - } - }; - - //================================================================== - //= SharedNotifier - //================================================================== - class SharedNotifier - { - private: - static ::osl::Mutex& getMutex(); - static ::rtl::Reference< ::comphelper::AsyncEventNotifier > s_pNotifier; - - public: - static const ::rtl::Reference< ::comphelper::AsyncEventNotifier >& - getNotifier(); - - private: - SharedNotifier(); // never implemented - SharedNotifier( const SharedNotifier& ); // never implemented - SharedNotifier& operator=( const SharedNotifier& ); // never implemented - }; - - //------------------------------------------------------------------ - ::rtl::Reference< ::comphelper::AsyncEventNotifier > SharedNotifier::s_pNotifier; - - //------------------------------------------------------------------ - ::osl::Mutex& SharedNotifier::getMutex() - { - static ::osl::Mutex s_aMutex; - return s_aMutex; - } - - //------------------------------------------------------------------ - const ::rtl::Reference< ::comphelper::AsyncEventNotifier >& SharedNotifier::getNotifier() - { - ::osl::MutexGuard aGuard( getMutex() ); - if ( !s_pNotifier.is() ) - { - s_pNotifier.set( new ::comphelper::AsyncEventNotifier ); - s_pNotifier->create(); - } - return s_pNotifier; - } - - //================================================================== - //= PropertyControlContext_Impl - //================================================================== - /** implementation for of XPropertyControlContext - which forwards all events to a non-UNO version of this interface - */ - typedef ::cppu::WeakImplHelper1< XPropertyControlContext > PropertyControlContext_Impl_Base; - class PropertyControlContext_Impl :public PropertyControlContext_Impl_Base - ,public ::comphelper::IEventProcessor - { - public: - enum NotifcationMode - { - eSynchronously, - eAsynchronously - }; - - private: - IControlContext* m_pContext; - NotifcationMode m_eMode; - - public: - /** creates an instance - @param _rContextImpl - the instance to delegate events to - */ - PropertyControlContext_Impl( IControlContext& _rContextImpl ); - - /** disposes the context. - - When you call this method, all subsequent callbacks to the - XPropertyControlContext methods - will throw a DisposedException. - */ - void SAL_CALL dispose(); - - /** sets the notification mode, so that notifications recieved from the controls are - forwarded to our IControlContext either synchronously or asynchronously - @param _eMode - the new notification mode - */ - void setNotificationMode( NotifcationMode _eMode ); - - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - protected: - ~PropertyControlContext_Impl(); - - // XPropertyControlObserver - virtual void SAL_CALL focusGained( const Reference< XPropertyControl >& Control ) throw (RuntimeException); - virtual void SAL_CALL valueChanged( const Reference< XPropertyControl >& Control ) throw (RuntimeException); - // XPropertyControlContext - virtual void SAL_CALL activateNextControl( const Reference< XPropertyControl >& CurrentControl ) throw (RuntimeException); - - // IEventProcessor - virtual void processEvent( const ::comphelper::AnyEvent& _rEvent ); - - private: - /** processes the given event, i.e. notifies it to our IControlContext - @param _rEvent - the event no notify - @precond - our mutex (well, the SolarMutex) is locked - */ - void impl_processEvent_throw( const ::comphelper::AnyEvent& _rEvent ); - - /** checks whether we're alive - - @throws DisposedException - if the instance is already disposed - */ - void impl_checkAlive_throw() const; - - /** checks whether the instance is already disposed - */ - bool impl_isDisposed_nothrow() const { return m_pContext == NULL; } - - /** notifies the given event originating from the given control - @throws DisposedException - @param _rxControl - @param _eType - */ - void impl_notify_throw( const Reference< XPropertyControl >& _rxControl, ControlEventType _eType ); - }; - - //-------------------------------------------------------------------- - PropertyControlContext_Impl::PropertyControlContext_Impl( IControlContext& _rContextImpl ) - :m_pContext( &_rContextImpl ) - ,m_eMode( eAsynchronously ) - { - } - - //-------------------------------------------------------------------- - PropertyControlContext_Impl::~PropertyControlContext_Impl() - { - if ( !impl_isDisposed_nothrow() ) - dispose(); - } - - //-------------------------------------------------------------------- - void PropertyControlContext_Impl::impl_checkAlive_throw() const - { - if ( impl_isDisposed_nothrow() ) - throw DisposedException( ::rtl::OUString(), *const_cast< PropertyControlContext_Impl* >( this ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::dispose() - { - SolarMutexGuard aGuard; - if ( impl_isDisposed_nothrow() ) - return; - - SharedNotifier::getNotifier()->removeEventsForProcessor( this ); - m_pContext = NULL; - } - - //-------------------------------------------------------------------- - void PropertyControlContext_Impl::setNotificationMode( NotifcationMode _eMode ) - { - SolarMutexGuard aGuard; - m_eMode = _eMode; - } - - //-------------------------------------------------------------------- - void PropertyControlContext_Impl::impl_notify_throw( const Reference< XPropertyControl >& _rxControl, ControlEventType _eType ) - { - ::comphelper::AnyEventRef pEvent; - - { - SolarMutexGuard aGuard; - impl_checkAlive_throw(); - pEvent = new ControlEvent( _rxControl, _eType ); - - if ( m_eMode == eSynchronously ) - { - impl_processEvent_throw( *pEvent ); - return; - } - } - - SharedNotifier::getNotifier()->addEvent( pEvent, this ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::focusGained( const Reference< XPropertyControl >& Control ) throw (RuntimeException) - { - OSL_TRACE( "PropertyControlContext_Impl: FOCUS_GAINED" ); - impl_notify_throw( Control, FOCUS_GAINED ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::valueChanged( const Reference< XPropertyControl >& Control ) throw (RuntimeException) - { - OSL_TRACE( "PropertyControlContext_Impl: VALUE_CHANGED" ); - impl_notify_throw( Control, VALUE_CHANGED ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::activateNextControl( const Reference< XPropertyControl >& CurrentControl ) throw (RuntimeException) - { - OSL_TRACE( "PropertyControlContext_Impl: ACTIVATE_NEXT" ); - impl_notify_throw( CurrentControl, ACTIVATE_NEXT ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::acquire() throw() - { - PropertyControlContext_Impl_Base::acquire(); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlContext_Impl::release() throw() - { - PropertyControlContext_Impl_Base::release(); - } - - //-------------------------------------------------------------------- - void PropertyControlContext_Impl::processEvent( const ::comphelper::AnyEvent& _rEvent ) - { - SolarMutexGuard aGuard; - if ( impl_isDisposed_nothrow() ) - return; - - try - { - impl_processEvent_throw( _rEvent ); - } - catch( const Exception& ) - { - // can't handle otherwise, since our caller (the notification thread) does not allow - // for exceptions (it could itself abort only) - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void PropertyControlContext_Impl::impl_processEvent_throw( const ::comphelper::AnyEvent& _rEvent ) - { - const ControlEvent& rControlEvent = static_cast< const ControlEvent& >( _rEvent ); - switch ( rControlEvent.eType ) - { - case FOCUS_GAINED: - OSL_TRACE( "PropertyControlContext_Impl::processEvent: FOCUS_GAINED" ); - m_pContext->focusGained( rControlEvent.xControl ); - break; - case VALUE_CHANGED: - OSL_TRACE( "PropertyControlContext_Impl::processEvent: VALUE_CHANGED" ); - m_pContext->valueChanged( rControlEvent.xControl ); - break; - case ACTIVATE_NEXT: - OSL_TRACE( "PropertyControlContext_Impl::processEvent: ACTIVATE_NEXT" ); - m_pContext->activateNextControl( rControlEvent.xControl ); - break; - } - } - - //================================================================== - //= OBrowserListBox - //================================================================== - DBG_NAME(OBrowserListBox) - //------------------------------------------------------------------ - OBrowserListBox::OBrowserListBox( Window* pParent, WinBits nWinStyle) - :Control(pParent, nWinStyle| WB_CLIPCHILDREN) - ,m_aLinesPlayground(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN) - ,m_aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG) - ,m_pHelpWindow( new InspectorHelpWindow( this ) ) - ,m_pLineListener(NULL) - ,m_pControlObserver( NULL ) - ,m_nYOffset(0) - ,m_nCurrentPreferredHelpHeight(0) - ,m_nTheNameSize(0) - ,m_bIsActive(sal_False) - ,m_bUpdate(sal_True) - ,m_pControlContextImpl( new PropertyControlContext_Impl( *this ) ) - { - DBG_CTOR(OBrowserListBox,NULL); - - ListBox aListBox(this,WB_DROPDOWN); - aListBox.SetPosSizePixel(Point(0,0),Size(100,100)); - m_nRowHeight = (sal_uInt16)aListBox.GetSizePixel().Height()+2; - SetBackground( pParent->GetBackground() ); - m_aLinesPlayground.SetBackground( GetBackground() ); - - m_aLinesPlayground.SetPosPixel(Point(0,0)); - m_aLinesPlayground.SetPaintTransparent(sal_True); - m_aLinesPlayground.Show(); - m_aVScroll.Hide(); - m_aVScroll.SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl)); - } - - //------------------------------------------------------------------ - OBrowserListBox::~OBrowserListBox() - { - OSL_ENSURE( !IsModified(), "OBrowserListBox::~OBrowserListBox: still modified - should have been committed before!" ); - // doing the commit here, while we, as well as our owner, as well as some other components, - // are already "half dead" (means within their dtor) is potentially dangerous. - // By definition, CommitModified has to be called (if necessary) before destruction - - m_pControlContextImpl->dispose(); - m_pControlContextImpl.clear(); - - Hide(); - Clear(); - - DBG_DTOR(OBrowserListBox,NULL); - } - - //------------------------------------------------------------------ - sal_Bool OBrowserListBox::IsModified( ) const - { - sal_Bool bModified = sal_False; - - if ( m_bIsActive && m_xActiveControl.is() ) - bModified = m_xActiveControl->isModified(); - - return bModified; - } - - //------------------------------------------------------------------ - void OBrowserListBox::CommitModified( ) - { - if ( IsModified() && m_xActiveControl.is() ) - { - // for the time of this commit, notify all events synchronously - // #i63814# - m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eSynchronously ); - try - { - m_xActiveControl->notifyModifiedValue(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - m_pControlContextImpl->setNotificationMode( PropertyControlContext_Impl::eAsynchronously ); - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::ActivateListBox(sal_Bool _bActive) - { - m_bIsActive = _bActive; - if (m_bIsActive) - { - // TODO: what's the sense of this? - m_aVScroll.SetThumbPos(100); - MoveThumbTo(0); - Resize(); - } - } - - //------------------------------------------------------------------ - long OBrowserListBox::impl_getPrefererredHelpHeight() - { - return HasHelpSection() ? m_pHelpWindow->GetOptimalHeightPixel() : 0; - } - - //------------------------------------------------------------------ - void OBrowserListBox::Resize() - { - Rectangle aPlayground( Point( 0, 0 ), GetOutputSizePixel() ); - Size aHelpWindowDistance( LogicToPixel( Size( 0, LAYOUT_HELP_WINDOW_DISTANCE_APPFONT ), MAP_APPFONT ) ); - - long nHelpWindowHeight = m_nCurrentPreferredHelpHeight = impl_getPrefererredHelpHeight(); - bool bPositionHelpWindow = ( nHelpWindowHeight != 0 ); - - Rectangle aLinesArea( aPlayground ); - if ( bPositionHelpWindow ) - { - aLinesArea.Bottom() -= nHelpWindowHeight; - aLinesArea.Bottom() -= aHelpWindowDistance.Height(); - } - m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() ); - - UpdateVScroll(); - - sal_Bool bNeedScrollbar = m_aOrderedLines.size() > (sal_uInt32)CalcVisibleLines(); - if ( !bNeedScrollbar ) - { - if ( m_aVScroll.IsVisible() ) - m_aVScroll.Hide(); - // scroll to top - m_nYOffset = 0; - m_aVScroll.SetThumbPos( 0 ); - } - else - { - Size aVScrollSize( m_aVScroll.GetSizePixel() ); - - // adjust the playground's width - aLinesArea.Right() -= aVScrollSize.Width(); - m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() ); - - // position the scrollbar - aVScrollSize.Height() = aLinesArea.GetHeight(); - Point aVScrollPos( aLinesArea.GetWidth(), 0 ); - m_aVScroll.SetPosSizePixel( aVScrollPos, aVScrollSize ); - } - - for ( sal_uInt16 i = 0; i < m_aOrderedLines.size(); ++i ) - m_aOutOfDateLines.insert( i ); - - // repaint - EnablePaint(sal_False); - UpdatePlayGround(); - EnablePaint(sal_True); - - // show the scrollbar - if ( bNeedScrollbar ) - m_aVScroll.Show(); - - // position the help window - if ( bPositionHelpWindow ) - { - Rectangle aHelpArea( aPlayground ); - aHelpArea.Top() = aLinesArea.Bottom() + aHelpWindowDistance.Height(); - m_pHelpWindow->SetPosSizePixel( aHelpArea.TopLeft(), aHelpArea.GetSize() ); - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::SetListener( IPropertyLineListener* _pListener ) - { - m_pLineListener = _pListener; - } - - //------------------------------------------------------------------ - void OBrowserListBox::SetObserver( IPropertyControlObserver* _pObserver ) - { - m_pControlObserver = _pObserver; - } - - //------------------------------------------------------------------ - void OBrowserListBox::EnableHelpSection( bool _bEnable ) - { - m_pHelpWindow->Show( _bEnable ); - Resize(); - } - - //------------------------------------------------------------------ - bool OBrowserListBox::HasHelpSection() const - { - return m_pHelpWindow->IsVisible(); - } - - //------------------------------------------------------------------ - void OBrowserListBox::SetHelpText( const ::rtl::OUString& _rHelpText ) - { - OSL_ENSURE( HasHelpSection(), "OBrowserListBox::SetHelpText: help section not visible!" ); - m_pHelpWindow->SetText( _rHelpText ); - if ( m_nCurrentPreferredHelpHeight != impl_getPrefererredHelpHeight() ) - Resize(); - } - - //------------------------------------------------------------------ - void OBrowserListBox::SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ) - { - m_pHelpWindow->SetLimits( _nMinLines, _nMaxLines ); - } - - //------------------------------------------------------------------ - sal_uInt16 OBrowserListBox::CalcVisibleLines() - { - Size aSize(m_aLinesPlayground.GetOutputSizePixel()); - sal_uInt16 nResult = 0; - if (0 != m_nRowHeight) - nResult = (sal_uInt16) aSize.Height()/m_nRowHeight; - - return nResult; - } - - //------------------------------------------------------------------ - void OBrowserListBox::UpdateVScroll() - { - sal_uInt16 nLines = CalcVisibleLines(); - m_aVScroll.SetPageSize(nLines-1); - m_aVScroll.SetVisibleSize(nLines-1); - - size_t nCount = m_aLines.size(); - if (nCount>0) - { - m_aVScroll.SetRange(Range(0,nCount-1)); - m_nYOffset = -m_aVScroll.GetThumbPos()*m_nRowHeight; - } - else - { - m_aVScroll.SetRange(Range(0,0)); - m_nYOffset = 0; - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::PositionLine( sal_uInt16 _nIndex ) - { - Size aSize(m_aLinesPlayground.GetOutputSizePixel()); - Point aPos(0, m_nYOffset); - - aSize.Height() = m_nRowHeight; - - aPos.Y() += _nIndex * m_nRowHeight; - - if ( _nIndex < m_aOrderedLines.size() ) - { - m_aOrderedLines[ _nIndex ]->second.pLine->SetPosSizePixel( aPos, aSize ); - - m_aOrderedLines[ _nIndex ]->second.pLine->SetTitleWidth( m_nTheNameSize + 2 * FRAME_OFFSET ); - - // show the line if necessary - if ( !m_aOrderedLines[ _nIndex ]->second.pLine->IsVisible() ) - m_aOrderedLines[ _nIndex ]->second.pLine->Show(); - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::UpdatePosNSize() - { - for ( ::std::set< sal_uInt16 >::const_iterator aLoop = m_aOutOfDateLines.begin(); - aLoop != m_aOutOfDateLines.end(); - ++aLoop - ) - { - DBG_ASSERT( *aLoop < m_aOrderedLines.size(), "OBrowserListBox::UpdatePosNSize: invalid line index!" ); - if ( *aLoop < m_aOrderedLines.size() ) - PositionLine( *aLoop ); - } - m_aOutOfDateLines.clear(); - } - - //------------------------------------------------------------------ - void OBrowserListBox::UpdatePlayGround() - { - sal_Int32 nThumbPos = m_aVScroll.GetThumbPos(); - sal_Int32 nLines = CalcVisibleLines(); - - sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines); - if (nEnd >= m_aOrderedLines.size()) - nEnd = (sal_uInt16)m_aOrderedLines.size()-1; - - if ( !m_aOrderedLines.empty() ) - { - for ( sal_uInt16 i = (sal_uInt16)nThumbPos; i <= nEnd; ++i ) - m_aOutOfDateLines.insert( i ); - UpdatePosNSize(); - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::UpdateAll() - { - Resize(); - } - - //------------------------------------------------------------------ - void OBrowserListBox::DisableUpdate() - { - m_bUpdate = sal_False; - } - - //------------------------------------------------------------------ - void OBrowserListBox::EnableUpdate() - { - m_bUpdate = sal_True; - UpdateAll(); - } - - //------------------------------------------------------------------ - void OBrowserListBox::SetPropertyValue(const ::rtl::OUString& _rEntryName, const Any& _rValue, bool _bUnknownValue ) - { - ListBoxLines::iterator line = m_aLines.find( _rEntryName ); - if ( line != m_aLines.end() ) - { - if ( _bUnknownValue ) - { - Reference< XPropertyControl > xControl( line->second.pLine->getControl() ); - OSL_ENSURE( xControl.is(), "OBrowserListBox::SetPropertyValue: illegal control!" ); - if ( xControl.is() ) - xControl->setValue( Any() ); - } - else - impl_setControlAsPropertyValue( line->second, _rValue ); - } - } - - //------------------------------------------------------------------------ - sal_uInt16 OBrowserListBox::GetPropertyPos( const ::rtl::OUString& _rEntryName ) const - { - sal_uInt16 nRet = LISTBOX_ENTRY_NOTFOUND; - for ( OrderedListBoxLines::const_iterator linePos = m_aOrderedLines.begin(); - linePos != m_aOrderedLines.end(); - ++linePos - ) - { - if ( (*linePos)->first == _rEntryName ) - { - nRet = (sal_uInt16)( linePos - m_aOrderedLines.begin() ); - break; - } - } - - return nRet; - } - - //------------------------------------------------------------------------ - bool OBrowserListBox::impl_getBrowserLineForName( const ::rtl::OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const - { - ListBoxLines::const_iterator line = m_aLines.find( _rEntryName ); - if ( line != m_aLines.end() ) - _out_rpLine = line->second.pLine; - else - _out_rpLine.reset(); - return ( NULL != _out_rpLine.get() ); - } - - //------------------------------------------------------------------------ - void OBrowserListBox::EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ) - { - BrowserLinePointer pLine; - if ( impl_getBrowserLineForName( _rEntryName, pLine ) ) - pLine->EnablePropertyControls( _nControls, _bEnable ); - } - - //------------------------------------------------------------------------ - void OBrowserListBox::EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ) - { - BrowserLinePointer pLine; - if ( impl_getBrowserLineForName( _rEntryName, pLine ) ) - pLine->EnablePropertyLine( _bEnable ); - } - - //------------------------------------------------------------------------ - Reference< XPropertyControl > OBrowserListBox::GetPropertyControl( const ::rtl::OUString& _rEntryName ) - { - BrowserLinePointer pLine; - if ( impl_getBrowserLineForName( _rEntryName, pLine ) ) - return pLine->getControl(); - return NULL; - } - - //------------------------------------------------------------------ - sal_uInt16 OBrowserListBox::InsertEntry(const OLineDescriptor& _rPropertyData, sal_uInt16 _nPos) - { - // create a new line - BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, &m_aLinesPlayground ) ); - - ListBoxLine aNewLine( pBrowserLine, _rPropertyData.xPropertyHandler ); - ::std::pair< ListBoxLines::iterator, bool > insertPoint = - m_aLines.insert( ListBoxLines::value_type( _rPropertyData.sName, aNewLine ) ); - OSL_ENSURE( insertPoint.second, "OBrowserListBox::InsertEntry: already have another line for this name!" ); - - sal_uInt16 nInsertPos = _nPos; - if ( nInsertPos > m_aOrderedLines.size() ) - nInsertPos = EDITOR_LIST_APPEND; - if ( EDITOR_LIST_APPEND == nInsertPos ) - { - nInsertPos = (sal_uInt16)m_aOrderedLines.size(); - m_aOrderedLines.push_back( insertPoint.first ); - } - else - m_aOrderedLines.insert( m_aOrderedLines.begin() + nInsertPos, insertPoint.first ); - - pBrowserLine->SetTitleWidth(m_nTheNameSize); - if (m_bUpdate) - { - UpdateVScroll(); - Invalidate(); - } - - // initialize the entry - ChangeEntry(_rPropertyData, nInsertPos); - - // update the positions of possibly affected lines - sal_uInt16 nUpdatePos = nInsertPos; - while ( nUpdatePos < m_aOrderedLines.size() ) - m_aOutOfDateLines.insert( nUpdatePos++ ); - UpdatePosNSize( ); - - return nInsertPos; - } - - //------------------------------------------------------------------ - sal_Int32 OBrowserListBox::GetMinimumWidth() - { - return m_nTheNameSize + 2 * FRAME_OFFSET + (m_nRowHeight - 4) * 8; - } - - //------------------------------------------------------------------ - sal_Int32 OBrowserListBox::GetMinimumHeight() - { - // assume that we want to display 5 rows, at least - sal_Int32 nMinHeight = m_nRowHeight * 5; - - if ( HasHelpSection() ) - { - Size aHelpWindowDistance( LogicToPixel( Size( 0, LAYOUT_HELP_WINDOW_DISTANCE_APPFONT ), MAP_APPFONT ) ); - nMinHeight += aHelpWindowDistance.Height(); - - nMinHeight += m_pHelpWindow->GetMinimalHeightPixel(); - } - - return nMinHeight; - } - - //------------------------------------------------------------------ - void OBrowserListBox::ShowEntry(sal_uInt16 _nPos) - { - if ( _nPos < m_aOrderedLines.size() ) - { - sal_Int32 nThumbPos = m_aVScroll.GetThumbPos(); - - if (_nPos < nThumbPos) - MoveThumbTo(_nPos); - else - { - sal_Int32 nLines = CalcVisibleLines(); - if (_nPos >= nThumbPos + nLines) - MoveThumbTo(_nPos - nLines + 1); - } - } - - } - - //------------------------------------------------------------------ - void OBrowserListBox::MoveThumbTo(sal_Int32 _nNewThumbPos) - { - // disable painting to prevent flicker - m_aLinesPlayground.EnablePaint(sal_False); - - sal_Int32 nDelta = _nNewThumbPos - m_aVScroll.GetThumbPos(); - // adjust the scrollbar - m_aVScroll.SetThumbPos(_nNewThumbPos); - sal_Int32 nThumbPos = _nNewThumbPos; - - m_nYOffset = -m_aVScroll.GetThumbPos() * m_nRowHeight; - - sal_Int32 nLines = CalcVisibleLines(); - sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines); - - m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN); - - if (1 == nDelta) - { - // TODO: what's the sense of this two PositionLines? Why not just one call? - PositionLine(nEnd-1); - PositionLine(nEnd); - } - else if (-1 == nDelta) - { - PositionLine((sal_uInt16)nThumbPos); - } - else if (0 != nDelta) - { - UpdatePlayGround(); - } - - m_aLinesPlayground.EnablePaint(sal_True); - m_aLinesPlayground.Invalidate(INVALIDATE_CHILDREN); - } - - //------------------------------------------------------------------ - IMPL_LINK(OBrowserListBox, ScrollHdl, ScrollBar*, _pScrollBar ) - { - DBG_ASSERT(_pScrollBar == &m_aVScroll, "OBrowserListBox::ScrollHdl: where does this come from?"); - (void)_pScrollBar; - - // disable painting to prevent flicker - m_aLinesPlayground.EnablePaint(sal_False); - - sal_Int32 nThumbPos = m_aVScroll.GetThumbPos(); - - sal_Int32 nDelta = m_aVScroll.GetDelta(); - m_nYOffset = -nThumbPos * m_nRowHeight; - - sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + CalcVisibleLines()); - - m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN); - - if (1 == nDelta) - { - PositionLine(nEnd-1); - PositionLine(nEnd); - } - else if (nDelta==-1) - { - PositionLine((sal_uInt16)nThumbPos); - } - else if (nDelta!=0 || m_aVScroll.GetType() == SCROLL_DONTKNOW) - { - UpdatePlayGround(); - } - - m_aLinesPlayground.EnablePaint(sal_True); - return 0; - } - - //------------------------------------------------------------------ - void OBrowserListBox::buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ) - { - DBG_ASSERT( _pLine, "OBrowserListBox::buttonClicked: invalid browser line!" ); - if ( _pLine && m_pLineListener ) - { - m_pLineListener->Clicked( _pLine->GetEntryName(), _bPrimary ); - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const Any& _rPropertyValue ) - { - Reference< XPropertyControl > xControl( _rLine.pLine->getControl() ); - try - { - if ( _rPropertyValue.getValueType().equals( _rLine.pLine->getControl()->getValueType() ) ) - { - xControl->setValue( _rPropertyValue ); - } - else - { - #ifdef DBG_UTIL - if ( !_rLine.xHandler.is() ) - { - ::rtl::OString sMessage( "OBrowserListBox::impl_setControlAsPropertyValue: no handler -> no conversion (property: '" ); - ::rtl::OUString sPropertyName( _rLine.pLine->GetEntryName() ); - sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += ::rtl::OString( "')!" ); - OSL_FAIL( sMessage.getStr() ); - } - #endif - if ( _rLine.xHandler.is() ) - { - Any aControlValue = _rLine.xHandler->convertToControlValue( - _rLine.pLine->GetEntryName(), _rPropertyValue, xControl->getValueType() ); - xControl->setValue( aControlValue ); - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------ - Any OBrowserListBox::impl_getControlAsPropertyValue( const ListBoxLine& _rLine ) const - { - Reference< XPropertyControl > xControl( _rLine.pLine->getControl() ); - Any aPropertyValue; - try - { - #ifdef DBG_UTIL - if ( !_rLine.xHandler.is() ) - { - ::rtl::OString sMessage( "OBrowserListBox::impl_getControlAsPropertyValue: no handler -> no conversion (property: '" ); - ::rtl::OUString sPropertyName( _rLine.pLine->GetEntryName() ); - sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += ::rtl::OString( "')!" ); - OSL_FAIL( sMessage.getStr() ); - } - #endif - if ( _rLine.xHandler.is() ) - aPropertyValue = _rLine.xHandler->convertToPropertyValue( _rLine.pLine->GetEntryName(), xControl->getValue() ); - else - aPropertyValue = xControl->getValue(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aPropertyValue; - } - - //------------------------------------------------------------------ - sal_uInt16 OBrowserListBox::impl_getControlPos( const Reference< XPropertyControl >& _rxControl ) const - { - for ( OrderedListBoxLines::const_iterator search = m_aOrderedLines.begin(); - search != m_aOrderedLines.end(); - ++search - ) - if ( (*search)->second.pLine->getControl().get() == _rxControl.get() ) - return sal_uInt16( search - m_aOrderedLines.begin() ); - OSL_FAIL( "OBrowserListBox::impl_getControlPos: invalid control - not part of any of our lines!" ); - return (sal_uInt16)-1; - } - - //-------------------------------------------------------------------- - void SAL_CALL OBrowserListBox::focusGained( const Reference< XPropertyControl >& _rxControl ) throw (RuntimeException) - { - DBG_TESTSOLARMUTEX(); - - DBG_ASSERT( _rxControl.is(), "OBrowserListBox::focusGained: invalid event source!" ); - if ( !_rxControl.is() ) - return; - - if ( m_pControlObserver ) - m_pControlObserver->focusGained( _rxControl ); - - m_xActiveControl = _rxControl; - ShowEntry( impl_getControlPos( m_xActiveControl ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OBrowserListBox::valueChanged( const Reference< XPropertyControl >& _rxControl ) throw (RuntimeException) - { - DBG_TESTSOLARMUTEX(); - - DBG_ASSERT( _rxControl.is(), "OBrowserListBox::valueChanged: invalid event source!" ); - if ( !_rxControl.is() ) - return; - - if ( m_pControlObserver ) - m_pControlObserver->valueChanged( _rxControl ); - - if ( m_pLineListener ) - { - const ListBoxLine& rLine = impl_getControlLine( _rxControl ); - m_pLineListener->Commit( - rLine.pLine->GetEntryName(), - impl_getControlAsPropertyValue( rLine ) - ); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL OBrowserListBox::activateNextControl( const Reference< XPropertyControl >& _rxCurrentControl ) throw (RuntimeException) - { - DBG_TESTSOLARMUTEX(); - - sal_uInt16 nLine = impl_getControlPos( _rxCurrentControl ); - - // cycle forwards, 'til we've the next control which can grab the focus - ++nLine; - while ( (size_t)nLine < m_aOrderedLines.size() ) - { - if ( m_aOrderedLines[nLine]->second.pLine->GrabFocus() ) - break; - ++nLine; - } - - if ( ( (size_t)nLine >= m_aOrderedLines.size() ) - && ( m_aOrderedLines.size() > 0 ) - ) - // wrap around - m_aOrderedLines[0]->second.pLine->GrabFocus(); - } - - //------------------------------------------------------------------ - namespace - { - //.............................................................. - void lcl_implDisposeControl_nothrow( const Reference< XPropertyControl >& _rxControl ) - { - if ( !_rxControl.is() ) - return; - try - { - _rxControl->setControlContext( NULL ); - Reference< XComponent > xControlComponent( _rxControl, UNO_QUERY ); - if ( xControlComponent.is() ) - xControlComponent->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //------------------------------------------------------------------ - void OBrowserListBox::Clear() - { - for ( ListBoxLines::iterator loop = m_aLines.begin(); - loop != m_aLines.end(); - ++loop - ) - { - // hide the line - loop->second.pLine->Hide(); - // reset the listener - lcl_implDisposeControl_nothrow( loop->second.pLine->getControl() ); - } - - clearContainer( m_aLines ); - clearContainer( m_aOrderedLines ); - } - - //------------------------------------------------------------------ - sal_Bool OBrowserListBox::RemoveEntry( const ::rtl::OUString& _rName ) - { - sal_uInt16 nPos = GetPropertyPos( _rName ); - if ( nPos == LISTBOX_ENTRY_NOTFOUND ) - return sal_False; - - OrderedListBoxLines::iterator orderedPos = m_aOrderedLines.begin() + nPos; - BrowserLinePointer pLine = (*orderedPos)->second.pLine; - pLine->Hide(); - lcl_implDisposeControl_nothrow( pLine->getControl() ); - - m_aLines.erase( *orderedPos ); - m_aOrderedLines.erase( orderedPos ); - m_aOutOfDateLines.erase( (sal_uInt16)m_aOrderedLines.size() ); - // this index *may* have been out of date, which is obsoleted now by m_aOrderedLines shrinking - - // update the positions of possibly affected lines - while ( nPos < m_aOrderedLines.size() ) - m_aOutOfDateLines.insert( nPos++ ); - UpdatePosNSize( ); - - return sal_True; - } - - //------------------------------------------------------------------ - void OBrowserListBox::ChangeEntry( const OLineDescriptor& _rPropertyData, sal_uInt16 nPos ) - { - OSL_PRECOND( _rPropertyData.Control.is(), "OBrowserListBox::ChangeEntry: invalid control!" ); - if ( !_rPropertyData.Control.is() ) - return; - - if ( nPos == EDITOR_LIST_REPLACE_EXISTING ) - nPos = GetPropertyPos( _rPropertyData.sName ); - - if ( nPos < m_aOrderedLines.size() ) - { - Window* pRefWindow = NULL; - if ( nPos > 0 ) - pRefWindow = m_aOrderedLines[nPos-1]->second.pLine->GetRefWindow(); - - // the current line and control - ListBoxLine& rLine = m_aOrderedLines[nPos]->second; - - // the old control and some data about it - Reference< XPropertyControl > xControl = rLine.pLine->getControl(); - Window* pControlWindow = rLine.pLine->getControlWindow(); - Point aControlPos; - if ( pControlWindow ) - aControlPos = pControlWindow->GetPosPixel(); - - // clean up the old control - lcl_implDisposeControl_nothrow( xControl ); - - // set the new control at the line - rLine.pLine->setControl( _rPropertyData.Control ); - xControl = rLine.pLine->getControl(); - - if ( xControl.is() ) - xControl->setControlContext( m_pControlContextImpl.get() ); - - // the initial property value - if ( _rPropertyData.bUnknownValue ) - xControl->setValue( Any() ); - else - impl_setControlAsPropertyValue( rLine, _rPropertyData.aValue ); - - rLine.pLine->SetTitle(_rPropertyData.DisplayName); - rLine.xHandler = _rPropertyData.xPropertyHandler; - - sal_uInt16 nTextWidth = (sal_uInt16)m_aLinesPlayground.GetTextWidth(_rPropertyData.DisplayName); - if (m_nTheNameSize< nTextWidth) - m_nTheNameSize = nTextWidth; - - if ( _rPropertyData.HasPrimaryButton ) - { - if ( _rPropertyData.PrimaryButtonImageURL.getLength() ) - rLine.pLine->ShowBrowseButton( _rPropertyData.PrimaryButtonImageURL, true ); - else if ( _rPropertyData.PrimaryButtonImage.is() ) - rLine.pLine->ShowBrowseButton( Image( _rPropertyData.PrimaryButtonImage ), true ); - else - rLine.pLine->ShowBrowseButton( true ); - - if ( _rPropertyData.HasSecondaryButton ) - { - if ( _rPropertyData.SecondaryButtonImageURL.getLength() ) - rLine.pLine->ShowBrowseButton( _rPropertyData.SecondaryButtonImageURL, false ); - else if ( _rPropertyData.SecondaryButtonImage.is() ) - rLine.pLine->ShowBrowseButton( Image( _rPropertyData.SecondaryButtonImage ), false ); - else - rLine.pLine->ShowBrowseButton( false ); - } - else - rLine.pLine->HideBrowseButton( false ); - - rLine.pLine->SetClickListener( this ); - } - else - { - rLine.pLine->HideBrowseButton( true ); - rLine.pLine->HideBrowseButton( false ); - } - - DBG_ASSERT( ( _rPropertyData.IndentLevel == 0 ) || ( _rPropertyData.IndentLevel == 1 ), - "OBrowserListBox::ChangeEntry: unsupported indent level!" ); - rLine.pLine->IndentTitle( _rPropertyData.IndentLevel > 0 ); - - if ( nPos > 0 ) - rLine.pLine->SetTabOrder( pRefWindow, WINDOW_ZORDER_BEHIND ); - else - rLine.pLine->SetTabOrder( pRefWindow, WINDOW_ZORDER_FIRST ); - - m_aOutOfDateLines.insert( nPos ); - rLine.pLine->SetComponentHelpIds( - HelpIdUrl::getHelpId( _rPropertyData.HelpURL ), - rtl::OUStringToOString( _rPropertyData.PrimaryButtonId, RTL_TEXTENCODING_UTF8 ), - rtl::OUStringToOString( _rPropertyData.SecondaryButtonId, RTL_TEXTENCODING_UTF8 ) - ); - - if ( _rPropertyData.bReadOnly ) - { - rLine.pLine->SetReadOnly( true ); - - // user controls (i.e. the ones not provided by the usual - // XPropertyControlFactory) have no chance to know that they should be read-only, - // since XPropertyHandler::describePropertyLine does not transport this - // information. - // So, we manually switch this to read-only. - if ( xControl.is() && ( xControl->getControlType() == PropertyControlType::Unknown ) ) - { - Edit* pControlWindowAsEdit = dynamic_cast< Edit* >( rLine.pLine->getControlWindow() ); - if ( pControlWindowAsEdit ) - pControlWindowAsEdit->SetReadOnly( sal_True ); - else - pControlWindowAsEdit->Enable( sal_False ); - } - } - } - } - - //------------------------------------------------------------------ - long OBrowserListBox::PreNotify( NotifyEvent& _rNEvt ) - { - switch ( _rNEvt.GetType() ) - { - case EVENT_KEYINPUT: - { - const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); - if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 ) - || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP ) - && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN ) - ) - ) - break; - - long nScrollOffset = 0; - if ( m_aVScroll.IsVisible() ) - { - if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP ) - nScrollOffset = -m_aVScroll.GetPageSize(); - else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN ) - nScrollOffset = m_aVScroll.GetPageSize(); - } - - if ( nScrollOffset ) - { - long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset; - nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() ); - nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() ); - m_aVScroll.DoScroll( nNewThumbPos ); - nNewThumbPos = m_aVScroll.GetThumbPos(); - - sal_uInt16 nFocusControlPos = 0; - sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl ); - if ( nActiveControlPos < nNewThumbPos ) - nFocusControlPos = (sal_uInt16)nNewThumbPos; - else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() ) - nFocusControlPos = (sal_uInt16)nNewThumbPos + CalcVisibleLines() - 1; - if ( nFocusControlPos ) - { - if ( nFocusControlPos < m_aOrderedLines.size() ) - { - m_aOrderedLines[ nFocusControlPos ]->second.pLine->GrabFocus(); - } - else - OSL_FAIL( "OBrowserListBox::PreNotify: internal error, invalid focus control position!" ); - } - } - - return 1L; - // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling, - // otherwise they would be used to scroll the document view, which does not sound like it is desired by - // the user. - } - } - return Control::PreNotify( _rNEvt ); - } - - //------------------------------------------------------------------ - long OBrowserListBox::Notify( NotifyEvent& _rNEvt ) - { - switch ( _rNEvt.GetType() ) - { - case EVENT_COMMAND: - { - const CommandEvent* pCommand = _rNEvt.GetCommandEvent(); - if ( ( COMMAND_WHEEL == pCommand->GetCommand() ) - || ( COMMAND_STARTAUTOSCROLL == pCommand->GetCommand() ) - || ( COMMAND_AUTOSCROLL == pCommand->GetCommand() ) - ) - { - // interested in scroll events if we have a scrollbar - if ( m_aVScroll.IsVisible() ) - { - HandleScrollCommand( *pCommand, NULL, &m_aVScroll ); - } - } - } - break; - } - - return Control::Notify( _rNEvt ); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx deleted file mode 100644 index 36a471f14..000000000 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_ -#define _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_ - -#include "browserline.hxx" -#include "modulepcr.hxx" -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class IPropertyLineListener; - class IPropertyControlObserver; - struct OLineDescriptor; - class InspectorHelpWindow; - class PropertyControlContext_Impl; - - //======================================================================== - //= administrative structures for OBrowserListBox - //======================================================================== - typedef ::boost::shared_ptr< OBrowserLine > BrowserLinePointer; - struct ListBoxLine - { - BrowserLinePointer pLine; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > - xHandler; - - ListBoxLine() { } - ListBoxLine( BrowserLinePointer _pLine, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler ) - :pLine( _pLine ) - ,xHandler( _rxHandler ) - { - } - }; - typedef ::boost::unordered_map< ::rtl::OUString, ListBoxLine, ::rtl::OUStringHash > ListBoxLines; - typedef ::std::vector< ListBoxLines::iterator > OrderedListBoxLines; - - //======================================================================== - //= IControlContext - //======================================================================== - /** non-UNO version of XPropertyControlContext - */ - class SAL_NO_VTABLE IControlContext - { - public: - virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0; - virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0; - virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException) = 0; - }; - - //======================================================================== - //= OBrowserListBox - //======================================================================== - class OBrowserListBox :public Control - ,public IButtonClickListener - ,public IControlContext - ,public PcrClient - { - protected: - Window m_aLinesPlayground; - ScrollBar m_aVScroll; - ::std::auto_ptr< InspectorHelpWindow > - m_pHelpWindow; - ListBoxLines m_aLines; - OrderedListBoxLines m_aOrderedLines; - IPropertyLineListener* m_pLineListener; - IPropertyControlObserver* m_pControlObserver; - long m_nYOffset; - long m_nCurrentPreferredHelpHeight; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - m_xActiveControl; - sal_uInt16 m_nTheNameSize; - sal_uInt16 m_nRowHeight; - ::std::set< sal_uInt16 > m_aOutOfDateLines; - sal_Bool m_bIsActive : 1; - sal_Bool m_bUpdate : 1; - ::rtl::Reference< PropertyControlContext_Impl > - m_pControlContextImpl; - - protected: - void PositionLine( sal_uInt16 _nIndex ); - void UpdatePosNSize(); - void UpdatePlayGround(); - void UpdateVScroll(); - void ShowEntry(sal_uInt16 nPos); - void MoveThumbTo(sal_Int32 nNewThumbPos); - void Resize(); - - public: - OBrowserListBox( Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL ); - - ~OBrowserListBox(); - - void UpdateAll(); - - void ActivateListBox( sal_Bool _bActive ); - - sal_uInt16 CalcVisibleLines(); - void EnableUpdate(); - void DisableUpdate(); - long Notify( NotifyEvent& _rNEvt ); - long PreNotify( NotifyEvent& _rNEvt ); - - void SetListener( IPropertyLineListener* _pListener ); - void SetObserver( IPropertyControlObserver* _pObserver ); - - void EnableHelpSection( bool _bEnable ); - bool HasHelpSection() const; - void SetHelpText( const ::rtl::OUString& _rHelpText ); - void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ); - - void Clear(); - - sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 nPos = EDITOR_LIST_APPEND ); - sal_Bool RemoveEntry( const ::rtl::OUString& _rName ); - void ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos ); - - void SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue ); - sal_uInt16 GetPropertyPos( const ::rtl::OUString& rEntryName ) const; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - GetPropertyControl( const ::rtl::OUString& rEntryName ); - void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ); - void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ); - - sal_Int32 GetMinimumWidth(); - sal_Int32 GetMinimumHeight(); - - - sal_Bool IsModified( ) const; - void CommitModified( ); - - protected: - // IControlContext - virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException); - - // IButtonClickListener - void buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ); - - using Window::SetHelpText; - private: - DECL_LINK( ScrollHdl, ScrollBar* ); - - /** retrieves the index of a given control in our line list - @param _rxControl - The control to lookup. Must denote a control of one of the lines in ->m_aLines - */ - sal_uInt16 impl_getControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const; - - /** retrieves (a reference to) the ->ListBoxLine for a given control - @param _rxControl - The control to lookup. Must denote a control of one of the lines in ->m_aLines - */ - inline const ListBoxLine& - impl_getControlLine( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const - { - return m_aOrderedLines[ impl_getControlPos( _rxControl ) ]->second; - } - - /** sets the given property value at the given control, after converting it as necessary - @param _rLine - The line whose at which the value is to be set. - @param _rPropertyValue - the property value to set. If it's not compatible with the control value, - it will be converted, using XPropertyHandler::convertToControlValue - */ - void impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const ::com::sun::star::uno::Any& _rPropertyValue ); - - /** retrieves the value for the given control, as a property value, after converting it as necessary - @param _rLine - The line whose at which the value is to be set. - */ - ::com::sun::star::uno::Any - impl_getControlAsPropertyValue( const ListBoxLine& _rLine ) const; - - /** retrieves the ->BrowserLinePointer for a given entry name - @param _rEntryName - the name whose line is to be looked up - @param _out_rpLine - contains, upon return, the found browser line, if any - @return - if and only if a non- line for the given entry name could be - found. - */ - bool impl_getBrowserLineForName( const ::rtl::OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const; - - /** returns the preferred height (in pixels) of the help section, or 0 if we - currently don't have a help section - */ - long impl_getPrefererredHelpHeight(); - - private: - using Window::Activate; - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserpage.cxx b/extensions/source/propctrlr/browserpage.cxx deleted file mode 100644 index 4afa64619..000000000 --- a/extensions/source/propctrlr/browserpage.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "browserpage.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - #define LAYOUT_BORDER_LEFT 3 - #define LAYOUT_BORDER_TOP 3 - #define LAYOUT_BORDER_RIGHT 3 - #define LAYOUT_BORDER_BOTTOM 3 - - //================================================================== - // class OBrowserPage - //================================================================== - //------------------------------------------------------------------ - OBrowserPage::OBrowserPage(Window* pParent,WinBits nWinStyle) - :TabPage(pParent,nWinStyle) - ,m_aListBox(this) - { - m_aListBox.SetBackground(GetBackground()); - m_aListBox.SetPaintTransparent( sal_True ); - m_aListBox.Show(); - } - - //------------------------------------------------------------------ - OBrowserPage::~OBrowserPage() - { - } - - //------------------------------------------------------------------ - void OBrowserPage::Resize() - { - Size aSize( GetOutputSizePixel() ); - aSize.Width() -= LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT; - aSize.Height() -= LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM; - m_aListBox.SetPosSizePixel( Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), aSize ); - } - - //------------------------------------------------------------------ - OBrowserListBox& OBrowserPage::getListBox() - { - return m_aListBox; - } - - //------------------------------------------------------------------ - const OBrowserListBox& OBrowserPage::getListBox() const - { - return m_aListBox; - } - - //------------------------------------------------------------------ - void OBrowserPage::StateChanged(StateChangedType nType) - { - Window::StateChanged( nType); - if (STATE_CHANGE_VISIBLE == nType) - m_aListBox.ActivateListBox(IsVisible()); - } - - //------------------------------------------------------------------ - sal_Int32 OBrowserPage::getMinimumWidth() - { - return m_aListBox.GetMinimumWidth() + LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT; - } - - //------------------------------------------------------------------ - sal_Int32 OBrowserPage::getMinimumHeight() - { - return m_aListBox.GetMinimumHeight() + LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserpage.hxx b/extensions/source/propctrlr/browserpage.hxx deleted file mode 100644 index 348e56bbc..000000000 --- a/extensions/source/propctrlr/browserpage.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_BROWSERPAGE_HXX_ -#define _EXTENSIONS_PROPCTRLR_BROWSERPAGE_HXX_ - -#include -#include "browserlistbox.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= OBrowserPage - //======================================================================== - class OBrowserPage : public TabPage - { - private: - OBrowserListBox m_aListBox; - - protected: - virtual void Resize(); - virtual void StateChanged(StateChangedType nType); - - public: - OBrowserPage(Window* pParent, WinBits nWinStyle = 0); - ~OBrowserPage(); - - sal_Int32 getMinimumWidth(); - sal_Int32 getMinimumHeight(); - - OBrowserListBox& getListBox(); - const OBrowserListBox& getListBox() const; - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_BROWSERPAGE_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx deleted file mode 100644 index b3cd531cf..000000000 --- a/extensions/source/propctrlr/browserview.cxx +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "browserview.hxx" -#include "propertyeditor.hxx" -#include "propctrlr.hrc" -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - - - //======================================================================== - //= class OPropertyBrowserView - //======================================================================== - DBG_NAME(OPropertyBrowserView) - //------------------------------------------------------------------------ - OPropertyBrowserView::OPropertyBrowserView( const Reference< XMultiServiceFactory >& _rxORB, - Window* _pParent, WinBits nBits) - :Window(_pParent, nBits | WB_3DLOOK) - ,m_xORB(_rxORB) - ,m_nActivePage(0) - { - DBG_CTOR(OPropertyBrowserView,NULL); - - m_pPropBox = new OPropertyEditor( this ); - m_pPropBox->SetHelpId(HID_FM_PROPDLG_TABCTR); - m_pPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation)); - - m_pPropBox->Show(); - } - - //------------------------------------------------------------------------ - IMPL_LINK(OPropertyBrowserView, OnPageActivation, void*, EMPTYARG) - { - m_nActivePage = m_pPropBox->GetCurPage(); - if (m_aPageActivationHandler.IsSet()) - m_aPageActivationHandler.Call(NULL); - return 0L; - } - - //------------------------------------------------------------------------ - OPropertyBrowserView::~OPropertyBrowserView() - { - if(m_pPropBox) - { - sal_uInt16 nTmpPage = m_pPropBox->GetCurPage(); - if (nTmpPage) - m_nActivePage = nTmpPage; - ::std::auto_ptr aTemp(m_pPropBox); - m_pPropBox = NULL; - } - m_xORB = NULL; - - DBG_DTOR(OPropertyBrowserView, NULL); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserView::activatePage(sal_uInt16 _nPage) - { - m_nActivePage = _nPage; - getPropertyBox().SetPage(m_nActivePage); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserView::GetFocus() - { - if (m_pPropBox) - m_pPropBox->GrabFocus(); - else - Window::GetFocus(); - } - - //------------------------------------------------------------------------ - long OPropertyBrowserView::Notify( NotifyEvent& _rNEvt ) - { - if ( EVENT_KEYINPUT == _rNEvt.GetType() ) - { - sal_uInt16 nKey = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); - - if ( ( KEY_DELETE == nKey ) || ( KEY_BACKSPACE == nKey ) ) - // silence this, we don't want to propagate this outside the property - // browser, as it will probably do harm there - // #i63285# - return 1; - } - return Window::Notify( _rNEvt ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserView::Resize() - { - Size aSize = GetOutputSizePixel(); - m_pPropBox->SetSizePixel(aSize); - } - - // #95343# --------------------------------------------------------------- - ::com::sun::star::awt::Size OPropertyBrowserView::getMinimumSize() - { - Size aSize = GetOutputSizePixel(); - if( m_pPropBox ) - { - aSize.setHeight( m_pPropBox->getMinimumHeight() ); - aSize.setWidth( m_pPropBox->getMinimumWidth() ); - } - return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() ); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/browserview.hxx b/extensions/source/propctrlr/browserview.hxx deleted file mode 100644 index c7d301e4e..000000000 --- a/extensions/source/propctrlr/browserview.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_BROWSERVIEW_HXX_ -#define _EXTENSIONS_PROPCTRLR_BROWSERVIEW_HXX_ - -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class OPropertyEditor; - - //======================================================================== - //= - //======================================================================== - class OPropertyBrowserView : public Window - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; - - OPropertyEditor* m_pPropBox; - sal_uInt16 m_nActivePage; - Link m_aPageActivationHandler; - - protected: - virtual void Resize(); - virtual void GetFocus(); - virtual long Notify( NotifyEvent& _rNEvt ); - - public: - OPropertyBrowserView(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB, - Window* pParent, WinBits nBits = 0); - - virtual ~OPropertyBrowserView(); - - OPropertyEditor& getPropertyBox() { return *m_pPropBox; } - - // page handling - sal_uInt16 getActivaPage() const { return m_nActivePage; } - void activatePage(sal_uInt16 _nPage); - - void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; } - Link getPageActivationHandler() const { return m_aPageActivationHandler; } - - ::com::sun::star::awt::Size getMinimumSize(); - - protected: - DECL_LINK(OnPageActivation, void*); - }; - - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_BROWSERVIEW_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/buttonnavigationhandler.cxx b/extensions/source/propctrlr/buttonnavigationhandler.cxx deleted file mode 100644 index ae1f6df7d..000000000 --- a/extensions/source/propctrlr/buttonnavigationhandler.cxx +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "buttonnavigationhandler.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" -#include "pushbuttonnavigation.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_ButtonNavigationHandler() -{ - ::pcr::ButtonNavigationHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= ButtonNavigationHandler - //==================================================================== - DBG_NAME( ButtonNavigationHandler ) - //-------------------------------------------------------------------- - ButtonNavigationHandler::ButtonNavigationHandler( const Reference< XComponentContext >& _rxContext ) - :ButtonNavigationHandler_Base( _rxContext ) - { - DBG_CTOR( ButtonNavigationHandler, NULL ); - - m_aContext.createComponent( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.FormComponentPropertyHandler" ) ), - m_xSlaveHandler ); - if ( !m_xSlaveHandler.is() ) - throw RuntimeException(); - } - - //-------------------------------------------------------------------- - ButtonNavigationHandler::~ButtonNavigationHandler( ) - { - DBG_DTOR( ButtonNavigationHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL ButtonNavigationHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.ButtonNavigationHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL ButtonNavigationHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.ButtonNavigationHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - void SAL_CALL ButtonNavigationHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) - { - ButtonNavigationHandler_Base::inspect( _rxIntrospectee ); - m_xSlaveHandler->inspect( _rxIntrospectee ); - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL ButtonNavigationHandler::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - PropertyState eState = PropertyState_DIRECT_VALUE; - switch ( nPropId ) - { - case PROPERTY_ID_BUTTONTYPE: - { - PushButtonNavigation aHelper( m_xComponent ); - eState = aHelper.getCurrentButtonTypeState(); - } - break; - case PROPERTY_ID_TARGET_URL: - { - PushButtonNavigation aHelper( m_xComponent ); - eState = aHelper.getCurrentTargetURLState(); - } - break; - - default: - OSL_FAIL( "ButtonNavigationHandler::getPropertyState: cannot handle this property!" ); - break; - } - - return eState; - } - - //-------------------------------------------------------------------- - Any SAL_CALL ButtonNavigationHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - Any aReturn; - switch ( nPropId ) - { - case PROPERTY_ID_BUTTONTYPE: - { - PushButtonNavigation aHelper( m_xComponent ); - aReturn = aHelper.getCurrentButtonType(); - } - break; - - case PROPERTY_ID_TARGET_URL: - { - PushButtonNavigation aHelper( m_xComponent ); - aReturn = aHelper.getCurrentTargetURL(); - } - break; - - default: - OSL_FAIL( "ButtonNavigationHandler::getPropertyValue: cannot handle this property!" ); - break; - } - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL ButtonNavigationHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_BUTTONTYPE: - { - PushButtonNavigation aHelper( m_xComponent ); - aHelper.setCurrentButtonType( _rValue ); - } - break; - - case PROPERTY_ID_TARGET_URL: - { - PushButtonNavigation aHelper( m_xComponent ); - aHelper.setCurrentTargetURL( _rValue ); - } - break; - - default: - OSL_FAIL( "ButtonNavigationHandler::setPropertyValue: cannot handle this id!" ); - } - } - - //-------------------------------------------------------------------- - bool ButtonNavigationHandler::isNavigationCapableButton( const Reference< XPropertySet >& _rxComponent ) - { - Reference< XPropertySetInfo > xPSI; - if ( _rxComponent.is() ) - xPSI = _rxComponent->getPropertySetInfo(); - - return xPSI.is() - && xPSI->hasPropertyByName( PROPERTY_TARGET_URL ) - && xPSI->hasPropertyByName( PROPERTY_BUTTONTYPE ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL ButtonNavigationHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - - if ( isNavigationCapableButton( m_xComponent ) ) - { - addStringPropertyDescription( aProperties, PROPERTY_TARGET_URL ); - implAddPropertyDescription( aProperties, PROPERTY_BUTTONTYPE, ::getCppuType( static_cast< sal_Int32* >( NULL ) ) ); - } - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL ButtonNavigationHandler::getActuatingProperties( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aActuating( 2 ); - aActuating[0] = PROPERTY_BUTTONTYPE; - aActuating[1] = PROPERTY_TARGET_URL; - return aActuating; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL ButtonNavigationHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - InteractiveSelectionResult eReturn( InteractiveSelectionResult_Cancelled ); - - switch ( nPropId ) - { - case PROPERTY_ID_TARGET_URL: - eReturn = m_xSlaveHandler->onInteractivePropertySelection( _rPropertyName, _bPrimary, _rData, _rxInspectorUI ); - break; - default: - eReturn = ButtonNavigationHandler_Base::onInteractivePropertySelection( _rPropertyName, _bPrimary, _rData, _rxInspectorUI ); - break; - } - - return eReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL ButtonNavigationHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_BUTTONTYPE: - { - PushButtonNavigation aHelper( m_xComponent ); - _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_URL, aHelper.currentButtonTypeIsOpenURL() ); - } - break; - - case PROPERTY_ID_TARGET_URL: - { - PushButtonNavigation aHelper( m_xComponent ); - _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_FRAME, aHelper.hasNonEmptyCurrentTargetURL() ); - } - break; - - default: - OSL_FAIL( "ButtonNavigationHandler::actuatingPropertyChanged: cannot handle this id!" ); - } - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL ButtonNavigationHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, const Reference< XPropertyControlFactory >& _rxControlFactory ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - LineDescriptor aReturn; - - switch ( nPropId ) - { - case PROPERTY_ID_TARGET_URL: - aReturn = m_xSlaveHandler->describePropertyLine( _rPropertyName, _rxControlFactory ); - break; - default: - aReturn = ButtonNavigationHandler_Base::describePropertyLine( _rPropertyName, _rxControlFactory ); - break; - } - - return aReturn; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/buttonnavigationhandler.hxx b/extensions/source/propctrlr/buttonnavigationhandler.hxx deleted file mode 100644 index d3be8b131..000000000 --- a/extensions/source/propctrlr/buttonnavigationhandler.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= ButtonNavigationHandler - //==================================================================== - class ButtonNavigationHandler; - typedef HandlerComponentBase< ButtonNavigationHandler > ButtonNavigationHandler_Base; - /** a property handler for any virtual string properties - */ - class ButtonNavigationHandler : public ButtonNavigationHandler_Base - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > - m_xSlaveHandler; - - public: - ButtonNavigationHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~ButtonNavigationHandler(); - - static bool isNavigationCapableButton( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent ); - - protected: - // XPropertyHandler overriables - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor - SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_BUTTONNAVIGATIONHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx deleted file mode 100644 index d70c36493..000000000 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ /dev/null @@ -1,507 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "cellbindinghandler.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" -#include "cellbindinghelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_CellBindingPropertyHandler() -{ - ::pcr::CellBindingPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::table; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::inspection; - using namespace ::com::sun::star::form::binding; - using namespace ::comphelper; - - //==================================================================== - //= CellBindingPropertyHandler - //==================================================================== - DBG_NAME( CellBindingPropertyHandler ) - //-------------------------------------------------------------------- - CellBindingPropertyHandler::CellBindingPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :CellBindingPropertyHandler_Base( _rxContext ) - ,m_pCellExchangeConverter( new DefaultEnumRepresentation( *m_pInfoService, ::getCppuType( static_cast< sal_Int16* >( NULL ) ), PROPERTY_ID_CELL_EXCHANGE_TYPE ) ) - { - DBG_CTOR( CellBindingPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL CellBindingPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.CellBindingPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL CellBindingPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.CellBindingPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - void CellBindingPropertyHandler::onNewComponent() - { - PropertyHandlerComponent::onNewComponent(); - - Reference< XModel > xDocument( impl_getContextDocument_nothrow() ); - DBG_ASSERT( xDocument.is(), "CellBindingPropertyHandler::onNewComponent: no document!" ); - if ( CellBindingHelper::isSpreadsheetDocument( xDocument ) ) - m_pHelper.reset( new CellBindingHelper( m_xComponent, xDocument ) ); - } - - //-------------------------------------------------------------------- - CellBindingPropertyHandler::~CellBindingPropertyHandler( ) - { - DBG_DTOR( CellBindingPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL CellBindingPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aInterestingProperties( 3 ); - aInterestingProperties[0] = PROPERTY_LIST_CELL_RANGE; - aInterestingProperties[1] = PROPERTY_BOUND_CELL; - aInterestingProperties[2] = PROPERTY_CONTROLSOURCE; - return aInterestingProperties; - } - - //-------------------------------------------------------------------- - void SAL_CALL CellBindingPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - OSL_PRECOND( m_pHelper.get(), "CellBindingPropertyHandler::actuatingPropertyChanged: inconsistentcy!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - OSL_PRECOND( _rxInspectorUI.is(), "FormComponentPropertyHandler::actuatingPropertyChanged: no access to the UI!" ); - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::std::vector< PropertyId > aDependentProperties; - - switch ( nActuatingPropId ) - { - // ----- BoundCell ----- - case PROPERTY_ID_BOUND_CELL: - { - // the SQL-data-binding related properties need to be enabled if and only if - // there is *no* valid cell binding - Reference< XValueBinding > xBinding; - _rNewValue >>= xBinding; - - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_CELL_EXCHANGE_TYPE ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_CELL_EXCHANGE_TYPE, xBinding.is() ); - if ( impl_componentHasProperty_throw( PROPERTY_CONTROLSOURCE ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_CONTROLSOURCE, !xBinding.is() ); - - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_FILTERPROPOSAL ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_FILTERPROPOSAL, !xBinding.is() ); - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_EMPTY_IS_NULL ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_EMPTY_IS_NULL, !xBinding.is() ); - - aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN ); - - if ( !xBinding.is() && m_pHelper->getCurrentBinding().is() ) - { - // ensure that the "transfer selection as" property is reset. Since we can't remember - // it at the object itself, but derive it from the binding only, we have to normalize - // it now that there *is* no binding anymore. - setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, makeAny( (sal_Int16) 0 ) ); - } - } - break; - - // ----- CellRange ----- - case PROPERTY_ID_LIST_CELL_RANGE: - { - // the list source related properties need to be enabled if and only if - // there is *no* valid external list source for the control - Reference< XListEntrySource > xSource; - _rNewValue >>= xSource; - - _rxInspectorUI->enablePropertyUI( PROPERTY_STRINGITEMLIST, !xSource.is() ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LISTSOURCE, !xSource.is() ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LISTSOURCETYPE, !xSource.is() ); - - aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN ); - - // also reset the list entries if the cell range is reset - // #i28319# - if ( !_bFirstTimeInit ) - { - try - { - if ( !xSource.is() ) - setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( Sequence< ::rtl::OUString >() ) ); - } - catch( const Exception& ) - { - OSL_FAIL( "OPropertyBrowserController::actuatingPropertyChanged( ListCellRange ): caught an exception while resetting the string items!" ); - } - } - } - break; // case PROPERTY_ID_LIST_CELL_RANGE - - // ----- DataField ----- - case PROPERTY_ID_CONTROLSOURCE: - { - ::rtl::OUString sControlSource; - _rNewValue >>= sControlSource; - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_BOUND_CELL ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_BOUND_CELL, sControlSource.getLength() == 0 ); - } - break; // case PROPERTY_ID_CONTROLSOURCE - - default: - OSL_FAIL( "CellBindingPropertyHandler::actuatingPropertyChanged: did not register for this property!" ); - } - - for ( ::std::vector< PropertyId >::const_iterator loopAffected = aDependentProperties.begin(); - loopAffected != aDependentProperties.end(); - ++loopAffected - ) - { - impl_updateDependentProperty_nothrow( *loopAffected, _rxInspectorUI ); - } - } - - //-------------------------------------------------------------------- - void CellBindingPropertyHandler::impl_updateDependentProperty_nothrow( PropertyId _nPropId, const Reference< XObjectInspectorUI >& _rxInspectorUI ) const - { - try - { - switch ( _nPropId ) - { - // ----- BoundColumn ----- - case PROPERTY_ID_BOUNDCOLUMN: - { - CellBindingPropertyHandler* pNonConstThis = const_cast< CellBindingPropertyHandler* >( this ); - Reference< XValueBinding > xBinding( pNonConstThis->getPropertyValue( PROPERTY_BOUND_CELL ), UNO_QUERY ); - Reference< XListEntrySource > xListSource( pNonConstThis->getPropertyValue( PROPERTY_LIST_CELL_RANGE ), UNO_QUERY ); - - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_BOUNDCOLUMN ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN, !xBinding.is() && !xListSource.is() ); - } - break; // case PROPERTY_ID_BOUNDCOLUMN - - } // switch - - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingPropertyHandler::impl_updateDependentProperty_nothrow: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL CellBindingPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::getPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - Any aReturn; - switch ( nPropId ) - { - case PROPERTY_ID_BOUND_CELL: - { - Reference< XValueBinding > xBinding( m_pHelper->getCurrentBinding() ); - if ( !m_pHelper->isCellBinding( xBinding ) ) - xBinding.clear(); - - aReturn <<= xBinding; - } - break; - - case PROPERTY_ID_LIST_CELL_RANGE: - { - Reference< XListEntrySource > xSource( m_pHelper->getCurrentListSource() ); - if ( !m_pHelper->isCellRangeListSource( xSource ) ) - xSource.clear(); - - aReturn <<= xSource; - } - break; - - case PROPERTY_ID_CELL_EXCHANGE_TYPE: - { - Reference< XValueBinding > xBinding( m_pHelper->getCurrentBinding() ); - aReturn <<= (sal_Int16)( m_pHelper->isCellIntegerBinding( xBinding ) ? 1 : 0 ); - } - break; - - default: - OSL_FAIL( "CellBindingPropertyHandler::getPropertyValue: cannot handle this!" ); - break; - } - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL CellBindingPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::setPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - try - { - Any aOldValue = getPropertyValue( _rPropertyName ); - - switch ( nPropId ) - { - case PROPERTY_ID_BOUND_CELL: - { - Reference< XValueBinding > xBinding; - _rValue >>= xBinding; - m_pHelper->setBinding( xBinding ); - } - break; - - case PROPERTY_ID_LIST_CELL_RANGE: - { - Reference< XListEntrySource > xSource; - _rValue >>= xSource; - m_pHelper->setListSource( xSource ); - } - break; - - case PROPERTY_ID_CELL_EXCHANGE_TYPE: - { - sal_Int16 nExchangeType = 0; - OSL_VERIFY( _rValue >>= nExchangeType ); - - Reference< XValueBinding > xBinding = m_pHelper->getCurrentBinding( ); - if ( xBinding.is() ) - { - sal_Bool bNeedIntegerBinding = ( nExchangeType == 1 ); - if ( (bool)bNeedIntegerBinding != m_pHelper->isCellIntegerBinding( xBinding ) ) - { - CellAddress aAddress; - if ( m_pHelper->getAddressFromCellBinding( xBinding, aAddress ) ) - { - xBinding = m_pHelper->createCellBindingFromAddress( aAddress, bNeedIntegerBinding ); - m_pHelper->setBinding( xBinding ); - } - } - } - } - break; - - default: - OSL_FAIL( "CellBindingPropertyHandler::setPropertyValue: cannot handle this!" ); - break; - } - - impl_setContextDocumentModified_nothrow(); - - Any aNewValue( getPropertyValue( _rPropertyName ) ); - firePropertyChange( _rPropertyName, nPropId, aOldValue, aNewValue ); - // TODO/UNOize: can't we make this a part of the base class, for all those "virtual" - // properties? Base class'es |setPropertyValue| could call some |doSetPropertyValue|, - // and handle the listener notification itself - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingPropertyHandler::setPropertyValue: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL CellBindingPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aPropertyValue; - - OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aPropertyValue; - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - switch( nPropId ) - { - case PROPERTY_ID_LIST_CELL_RANGE: - aPropertyValue <<= m_pHelper->createCellListSourceFromStringAddress( sControlValue ); - break; - - case PROPERTY_ID_BOUND_CELL: - { - // if we have the possibility of an integer binding, then we must preserve - // this property's value (e.g. if the current binding is an integer binding, then - // the newly created one must be, too) - bool bIntegerBinding = false; - if ( m_pHelper->isCellIntegerBindingAllowed() ) - { - sal_Int16 nCurrentBindingType = 0; - getPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE ) >>= nCurrentBindingType; - bIntegerBinding = ( nCurrentBindingType != 0 ); - } - aPropertyValue <<= m_pHelper->createCellBindingFromStringAddress( sControlValue, bIntegerBinding ); - } - break; - - case PROPERTY_ID_CELL_EXCHANGE_TYPE: - m_pCellExchangeConverter->getValueFromDescription( sControlValue, aPropertyValue ); - break; - - default: - OSL_FAIL( "CellBindingPropertyHandler::convertToPropertyValue: cannot handle this!" ); - break; - } - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL CellBindingPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, - const Any& _rPropertyValue, const Type& /*_rControlValueType*/ ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aControlValue; - - OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::convertToControlValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aControlValue; - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - - switch ( nPropId ) - { - case PROPERTY_ID_BOUND_CELL: - { - Reference< XValueBinding > xBinding; -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - _rPropertyValue >>= xBinding; - OSL_ENSURE( bSuccess, "CellBindingPropertyHandler::convertToControlValue: invalid value (1)!" ); - - // the only value binding we support so far is linking to spreadsheet cells - aControlValue <<= m_pHelper->getStringAddressFromCellBinding( xBinding ); - } - break; - - case PROPERTY_ID_LIST_CELL_RANGE: - { - Reference< XListEntrySource > xSource; -#if OSL_DEBUG_LEVEL > 0 - sal_Bool bSuccess = -#endif - _rPropertyValue >>= xSource; - OSL_ENSURE( bSuccess, "CellBindingPropertyHandler::convertToControlValue: invalid value (2)!" ); - - // the only value binding we support so far is linking to spreadsheet cells - aControlValue <<= m_pHelper->getStringAddressFromCellListSource( xSource ); - } - break; - - case PROPERTY_ID_CELL_EXCHANGE_TYPE: - aControlValue <<= m_pCellExchangeConverter->getDescriptionForValue( _rPropertyValue ); - break; - - default: - OSL_FAIL( "CellBindingPropertyHandler::convertToControlValue: cannot handle this!" ); - break; - } - - return aControlValue; - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL CellBindingPropertyHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - - bool bAllowCellLinking = m_pHelper.get() && m_pHelper->isCellBindingAllowed(); - bool bAllowCellIntLinking = m_pHelper.get() && m_pHelper->isCellIntegerBindingAllowed(); - bool bAllowListCellRange = m_pHelper.get() && m_pHelper->isListCellRangeAllowed(); - if ( bAllowCellLinking || bAllowListCellRange || bAllowCellIntLinking ) - { - sal_Int32 nPos = ( bAllowCellLinking ? 1 : 0 ) - + ( bAllowListCellRange ? 1 : 0 ) - + ( bAllowCellIntLinking ? 1 : 0 ); - aProperties.resize( nPos ); - - if ( bAllowCellLinking ) - { - aProperties[ --nPos ] = Property( PROPERTY_BOUND_CELL, PROPERTY_ID_BOUND_CELL, - ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ), 0 ); - } - if ( bAllowCellIntLinking ) - { - aProperties[ --nPos ] = Property( PROPERTY_CELL_EXCHANGE_TYPE, PROPERTY_ID_CELL_EXCHANGE_TYPE, - ::getCppuType( static_cast< sal_Int16* >( NULL ) ), 0 ); - } - if ( bAllowListCellRange ) - { - aProperties[ --nPos ] = Property( PROPERTY_LIST_CELL_RANGE, PROPERTY_ID_LIST_CELL_RANGE, - ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ), 0 ); - } - } - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghandler.hxx b/extensions/source/propctrlr/cellbindinghandler.hxx deleted file mode 100644 index e5e27f609..000000000 --- a/extensions/source/propctrlr/cellbindinghandler.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class CellBindingHelper; - class IPropertyEnumRepresentation; - //==================================================================== - //= CellBindingPropertyHandler - //==================================================================== - class CellBindingPropertyHandler; - typedef HandlerComponentBase< CellBindingPropertyHandler > CellBindingPropertyHandler_Base; - class CellBindingPropertyHandler : public CellBindingPropertyHandler_Base - { - private: - ::std::auto_ptr< CellBindingHelper > m_pHelper; - ::rtl::Reference< IPropertyEnumRepresentation > m_pCellExchangeConverter; - - public: - CellBindingPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~CellBindingPropertyHandler(); - - protected: - // XPropertyHandler overriables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - virtual void onNewComponent(); - - private: - /** updates a property (UI) whose state depends on more than one other property - - ->actuatingPropertyChanged is called for certain properties in whose changes - we expressed interes (->getActuatingProperty). Now such a property change can - result in simple UI updates, for instance another property being enabled or disabled. - - However, it can also result in a more complex change: The current (UI) state might - depend on the value of more than one other property. Those dependent properties (their - UI, more precisly) are updated in this method. - - @param _nPropid - the ->PropertyId of the dependent property whose UI state is to be updated - - @param _rxInspectorUI - provides access to the property browser UI. Must not be . - */ - void impl_updateDependentProperty_nothrow( PropertyId _nPropId, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) const; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_CELLBINDINGHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx deleted file mode 100644 index 41a560f70..000000000 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ /dev/null @@ -1,568 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "cellbindinghelper.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "formstrings.hxx" - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::sheet; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::drawing; - using namespace ::com::sun::star::table; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::i18n; - using namespace ::com::sun::star::form::binding; - - namespace - { - //.................................................................... - struct StringCompare : public ::std::unary_function< ::rtl::OUString, bool > - { - private: - ::rtl::OUString m_sReference; - - public: - StringCompare( const ::rtl::OUString& _rReference ) : m_sReference( _rReference ) { } - - inline bool operator()( const ::rtl::OUString& _rCompare ) - { - return ( _rCompare == m_sReference ) ? true : false; - } - }; - } - - //======================================================================== - //= CellBindingHelper - //======================================================================== - //------------------------------------------------------------------------ - CellBindingHelper::CellBindingHelper( const Reference< XPropertySet >& _rxControlModel, const Reference< XModel >& _rxContextDocument ) - :m_xControlModel( _rxControlModel ) - { - OSL_ENSURE( m_xControlModel.is(), "CellBindingHelper::CellBindingHelper: invalid control model!" ); - - m_xDocument = m_xDocument.query( _rxContextDocument ); - OSL_ENSURE( m_xDocument.is(), "CellBindingHelper::CellBindingHelper: This is no spreadsheet document!" ); - - OSL_ENSURE( isSpreadsheetDocumentWhichSupplies( SERVICE_ADDRESS_CONVERSION ), - "CellBindingHelper::CellBindingHelper: the document cannot convert address representations!" ); - } - - //------------------------------------------------------------------------ - sal_Bool CellBindingHelper::isSpreadsheetDocument( const Reference< XModel >& _rxContextDocument ) - { - return Reference< XSpreadsheetDocument >::query( _rxContextDocument ).is(); - } - - //------------------------------------------------------------------------ - sal_Int16 CellBindingHelper::getControlSheetIndex( Reference< XSpreadsheet >& _out_rxSheet ) const - { - sal_Int16 nSheetIndex = -1; - // every sheet has a draw page, and every draw page has a forms collection. - // Our control, OTOH, belongs to a forms collection. Match these ... - try - { - // for determining the draw page, we need the forms collection which - // the object belongs to. This is the first object up the hierarchy which is - // *no* XForm (and, well, no XGridColumnFactory) - Reference< XChild > xCheck( m_xControlModel, UNO_QUERY ); - Reference< XForm > xParentAsForm; if ( xCheck.is() ) xParentAsForm = xParentAsForm.query( xCheck->getParent() ); - Reference< XGridColumnFactory > xParentAsGrid; if ( xCheck.is() ) xParentAsGrid = xParentAsGrid.query( xCheck->getParent() ); - - while ( ( xParentAsForm.is() || xParentAsGrid.is() ) && xCheck.is() ) - { - xCheck = xCheck.query( xCheck->getParent() ); - xParentAsForm = xParentAsForm.query( xCheck.is() ? xCheck->getParent() : (Reference< XInterface >) Reference< XForm >() ); - xParentAsGrid = xParentAsGrid.query( xCheck.is() ? xCheck->getParent() : (Reference< XInterface >) Reference< XGridColumnFactory >() ); - } - Reference< XInterface > xFormsCollection( xCheck.is() ? xCheck->getParent() : Reference< XInterface >() ); - - // now iterate through the sheets - Reference< XIndexAccess > xSheets( m_xDocument->getSheets(), UNO_QUERY ); - if ( xSheets.is() && xFormsCollection.is() ) - { - for ( sal_Int32 i = 0; i < xSheets->getCount(); ++i ) - { - Reference< XDrawPageSupplier > xSuppPage( xSheets->getByIndex( i ), UNO_QUERY_THROW ); - Reference< XFormsSupplier > xSuppForms( xSuppPage->getDrawPage(), UNO_QUERY_THROW ); - - if ( xSuppForms->getForms() == xFormsCollection ) - { // found it - nSheetIndex = (sal_Int16)i; - _out_rxSheet.set( xSuppPage, UNO_QUERY_THROW ); - break; - } - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return nSheetIndex; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription, CellAddress& /* [out] */ _rAddress ) const - { - Any aAddress; - return doConvertAddressRepresentations( - PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), - PROPERTY_ADDRESS, - aAddress, - false - ) - && ( aAddress >>= _rAddress ); - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::doConvertAddressRepresentations( const ::rtl::OUString& _rInputProperty, const Any& _rInputValue, - const ::rtl::OUString& _rOutputProperty, Any& _rOutputValue, bool _bIsRange ) const SAL_THROW(()) - { - bool bSuccess = false; - - Reference< XPropertySet > xConverter( - createDocumentDependentInstance( - _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION, - ::rtl::OUString(), - Any() - ), - UNO_QUERY - ); - OSL_ENSURE( xConverter.is(), "CellBindingHelper::doConvertAddressRepresentations: could not get a converter service!" ); - if ( xConverter.is() ) - { - try - { - Reference< XSpreadsheet > xSheet; - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( (sal_Int32)getControlSheetIndex( xSheet ) ) ); - xConverter->setPropertyValue( _rInputProperty, _rInputValue ); - _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); - bSuccess = true; - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::doConvertAddressRepresentations: caught an exception!" ); - } - } - - return bSuccess; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription, - CellRangeAddress& /* [out] */ _rAddress ) const - { - Any aAddress; - return doConvertAddressRepresentations( - PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), - PROPERTY_ADDRESS, - aAddress, - true - ) - && ( aAddress >>= _rAddress ); - } - - //------------------------------------------------------------------------ - Reference< XValueBinding > CellBindingHelper::createCellBindingFromAddress( const CellAddress& _rAddress, bool _bSupportIntegerExchange ) const - { - Reference< XValueBinding > xBinding( createDocumentDependentInstance( - _bSupportIntegerExchange ? SERVICE_SHEET_CELL_INT_BINDING : SERVICE_SHEET_CELL_BINDING, - PROPERTY_BOUND_CELL, - makeAny( _rAddress ) - ), UNO_QUERY ); - - return xBinding; - } - - //------------------------------------------------------------------------ - Reference< XValueBinding > CellBindingHelper::createCellBindingFromStringAddress( const ::rtl::OUString& _rAddress, bool _bSupportIntegerExchange ) const - { - Reference< XValueBinding > xBinding; - if ( !m_xDocument.is() ) - // very bad ... - return xBinding; - - // get the UNO representation of the address - CellAddress aAddress; - if ( !_rAddress.getLength() || !convertStringAddress( _rAddress, aAddress ) ) - return xBinding; - - return createCellBindingFromAddress( aAddress, _bSupportIntegerExchange ); - } - - //------------------------------------------------------------------------ - Reference< XListEntrySource > CellBindingHelper::createCellListSourceFromStringAddress( const ::rtl::OUString& _rAddress ) const - { - Reference< XListEntrySource > xSource; - - CellRangeAddress aRangeAddress; - if ( !_rAddress.getLength() || !convertStringAddress( _rAddress, aRangeAddress ) ) - return xSource; - - // create a range object for this address - xSource = xSource.query( createDocumentDependentInstance( - SERVICE_SHEET_CELLRANGE_LISTSOURCE, - PROPERTY_LIST_CELL_RANGE, - makeAny( aRangeAddress ) - ) ); - - return xSource; - } - - //------------------------------------------------------------------------ - Reference< XInterface > CellBindingHelper::createDocumentDependentInstance( const ::rtl::OUString& _rService, const ::rtl::OUString& _rArgumentName, - const Any& _rArgumentValue ) const - { - Reference< XInterface > xReturn; - - Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY ); - OSL_ENSURE( xDocumentFactory.is(), "CellBindingHelper::createDocumentDependentInstance: no document service factory!" ); - if ( xDocumentFactory.is() ) - { - try - { - if ( _rArgumentName.getLength() ) - { - NamedValue aArg; - aArg.Name = _rArgumentName; - aArg.Value = _rArgumentValue; - - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= aArg; - - xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs ); - } - else - { - xReturn = xDocumentFactory->createInstance( _rService ); - } - } - catch ( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::createDocumentDependentInstance: could not create the binding at the document!" ); - } - } - return xReturn; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::getAddressFromCellBinding( - const Reference< XValueBinding >& _rxBinding, CellAddress& _rAddress ) const - { - OSL_PRECOND( !_rxBinding.is() || isCellBinding( _rxBinding ), "CellBindingHelper::getAddressFromCellBinding: this is no cell binding!" ); - - bool bReturn = false; - if ( !m_xDocument.is() ) - // very bad ... - return bReturn; - - try - { - Reference< XPropertySet > xBindingProps( _rxBinding, UNO_QUERY ); - OSL_ENSURE( xBindingProps.is() || !_rxBinding.is(), "CellBindingHelper::getAddressFromCellBinding: no property set for the binding!" ); - if ( xBindingProps.is() ) - { - CellAddress aAddress; - bReturn = (bool)( xBindingProps->getPropertyValue( PROPERTY_BOUND_CELL ) >>= _rAddress ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::getAddressFromCellBinding: caught an exception!" ); - } - - return bReturn; - } - - //------------------------------------------------------------------------ - ::rtl::OUString CellBindingHelper::getStringAddressFromCellBinding( const Reference< XValueBinding >& _rxBinding ) const - { - CellAddress aAddress; - ::rtl::OUString sAddress; - if ( getAddressFromCellBinding( _rxBinding, aAddress ) ) - { - Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ), - PROPERTY_UI_REPRESENTATION, aStringAddress, false ); - - aStringAddress >>= sAddress; - } - - return sAddress; - } - - //------------------------------------------------------------------------ - ::rtl::OUString CellBindingHelper::getStringAddressFromCellListSource( const Reference< XListEntrySource >& _rxSource ) const - { - OSL_PRECOND( !_rxSource.is() || isCellRangeListSource( _rxSource ), "CellBindingHelper::getStringAddressFromCellListSource: this is no cell list source!" ); - - ::rtl::OUString sAddress; - if ( !m_xDocument.is() ) - // very bad ... - return sAddress; - - try - { - Reference< XPropertySet > xSourceProps( _rxSource, UNO_QUERY ); - OSL_ENSURE( xSourceProps.is() || !_rxSource.is(), "CellBindingHelper::getStringAddressFromCellListSource: no property set for the list source!" ); - if ( xSourceProps.is() ) - { - CellRangeAddress aRangeAddress; - xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress; - - Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ), - PROPERTY_UI_REPRESENTATION, aStringAddress, true ); - aStringAddress >>= sAddress; - } - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::getStringAddressFromCellListSource: caught an exception!" ); - } - - return sAddress; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isSpreadsheetDocumentWhichSupplies( const ::rtl::OUString& _rService ) const - { - bool bYesItIs = false; - - Reference< XServiceInfo > xSI( m_xDocument, UNO_QUERY ); - if ( xSI.is() && xSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) - { - Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY ); - OSL_ENSURE( xDocumentFactory.is(), "CellBindingHelper::isSpreadsheetDocumentWhichSupplies: spreadsheet document, but no factory?" ); - - Sequence< ::rtl::OUString > aAvailableServices; - if ( xDocumentFactory.is() ) - aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); - - const ::rtl::OUString* pFound = ::std::find_if( - aAvailableServices.getConstArray(), - aAvailableServices.getConstArray() + aAvailableServices.getLength(), - StringCompare( _rService ) - ); - if ( pFound - aAvailableServices.getConstArray() < aAvailableServices.getLength() ) - { - bYesItIs = true; - } - } - - return bYesItIs; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isListCellRangeAllowed( ) const - { - bool bAllow( false ); - - Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - if ( xSink.is() ) - { - bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_SHEET_CELLRANGE_LISTSOURCE ); - } - - return bAllow; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isCellIntegerBindingAllowed( ) const - { - bool bAllow( true ); - - // first, we only offer this for controls which allow bindings in general - Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); - if ( !xBindable.is() ) - bAllow = false; - - // then, we must live in a spreadsheet document which can provide the special - // service needed for exchanging integer values - if ( bAllow ) - bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_SHEET_CELL_INT_BINDING ); - - // then, we only offer this for list boxes - if ( bAllow ) - { - try - { - sal_Int16 nClassId = FormComponentType::CONTROL; - m_xControlModel->getPropertyValue( PROPERTY_CLASSID ) >>= nClassId; - if ( FormComponentType::LISTBOX != nClassId ) - bAllow = false; - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::isCellIntegerBindingAllowed: caught an exception!" ); - // are there really control models which survive isCellBindingAllowed, but don't have a ClassId - // property? - bAllow = false; - } - } - - return bAllow; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isCellBindingAllowed( ) const - { - bool bAllow( false ); - - Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); - if ( xBindable.is() ) - { - // the control can potentially be bound to an external value - // Does it live within a Calc document, and is able to supply CellBindings? - bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_SHEET_CELL_BINDING ); - } - - // disallow for some types - // TODO: shouldn't the XBindableValue supply a list of supported types, and we can distingusih - // using this list? The current behavior below is somewhat hackish ... - if ( bAllow ) - { - try - { - sal_Int16 nClassId = FormComponentType::CONTROL; - m_xControlModel->getPropertyValue( PROPERTY_CLASSID ) >>= nClassId; - if ( ( FormComponentType::DATEFIELD == nClassId ) || ( FormComponentType::TIMEFIELD == nClassId ) ) - bAllow = false; - } - catch( const Exception& ) - { - OSL_FAIL( "CellBindingHelper::isCellBindingAllowed: caught an exception!" ); - bAllow = false; - } - } - return bAllow; - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isCellBinding( const Reference< XValueBinding >& _rxBinding ) const - { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_BINDING ); - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isCellIntegerBinding( const Reference< XValueBinding >& _rxBinding ) const - { - return doesComponentSupport( _rxBinding.get(), SERVICE_SHEET_CELL_INT_BINDING ); - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::isCellRangeListSource( const Reference< XListEntrySource >& _rxSource ) const - { - return doesComponentSupport( _rxSource.get(), SERVICE_SHEET_CELLRANGE_LISTSOURCE ); - } - - //------------------------------------------------------------------------ - bool CellBindingHelper::doesComponentSupport( const Reference< XInterface >& _rxComponent, const ::rtl::OUString& _rService ) const - { - bool bDoes = false; - Reference< XServiceInfo > xSI( _rxComponent, UNO_QUERY ); - bDoes = xSI.is() && xSI->supportsService( _rService ); - return bDoes; - } - - //------------------------------------------------------------------------ - Reference< XValueBinding > CellBindingHelper::getCurrentBinding( ) const - { - Reference< XValueBinding > xBinding; - Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); - if ( xBindable.is() ) - xBinding = xBindable->getValueBinding(); - return xBinding; - } - - //------------------------------------------------------------------------ - Reference< XListEntrySource > CellBindingHelper::getCurrentListSource( ) const - { - Reference< XListEntrySource > xSource; - Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - if ( xSink.is() ) - xSource = xSink->getListEntrySource(); - return xSource; - } - - //------------------------------------------------------------------------ - void CellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding ) - { - Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); - OSL_PRECOND( xBindable.is(), "CellBindingHelper::setBinding: the object is not bindable!" ); - if ( xBindable.is() ) - xBindable->setValueBinding( _rxBinding ); - } - - //------------------------------------------------------------------------ - void CellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource ) - { - Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - OSL_PRECOND( xSink.is(), "CellBindingHelper::setListSource: the object is no list entry sink!" ); - if ( xSink.is() ) - xSink->setListEntrySource( _rxSource ); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghelper.hxx b/extensions/source/propctrlr/cellbindinghelper.hxx deleted file mode 100644 index a6767c4f1..000000000 --- a/extensions/source/propctrlr/cellbindinghelper.hxx +++ /dev/null @@ -1,293 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPCTRLR_CELLBINDINGHELPER_HXX -#define EXTENSIONS_PROPCTRLR_CELLBINDINGHELPER_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= CellBindingHelper - //======================================================================== - /** encapsulates functionality related to binding a form control to a spreadsheet cell - */ - class CellBindingHelper - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xControlModel; // the model we work for - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > - m_xDocument; // the document where the model lives - - public: - /** ctor - @param _rxControlModel - the control model which is or will be bound - */ - CellBindingHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - - public: - /** determines whether the given model is a spreadsheet document model - -

          If this method returns , you cannot instantiate a CellBindingHelper with - the document, since then no of it's functionality will be available.

          - */ - static sal_Bool isSpreadsheetDocument( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - - /** gets a cell binding for the given address - @precond - isCellBindingAllowed returns - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > - createCellBindingFromStringAddress( - const ::rtl::OUString& _rAddress, - bool _bSupportIntegerExchange = false - ) const; - - /** creates a cell binding (supporting integer exchange, if requested) for - the given address object - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > - createCellBindingFromAddress( - const ::com::sun::star::table::CellAddress& _rAddress, - bool _bSupportIntegerExchange = false - ) const; - - /** gets a cell range list source binding for the given address - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource > - createCellListSourceFromStringAddress( const ::rtl::OUString& _rAddress ) const; - - /** creates a string representation for the given value binding's address - -

          If the sheet of the bound cell is the same as the sheet which our control belongs - to, then the sheet name is omitted in the resulting string representation.

          - - @precond - The binding is a valid cell binding, or - @see isCellBinding - */ - ::rtl::OUString getStringAddressFromCellBinding( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding - ) const; - - /** creates an address object for the given value binding's address - - @precond - The binding is a valid cell binding, or - @return - if and only if an error occurred and no valid address could be obtained - @see isCellBinding - */ - bool getAddressFromCellBinding( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding, - ::com::sun::star::table::CellAddress& _rAddress - ) const; - - /** creates a string representation for the given list source's range address - -

          If the sheet of the cell range which acts as list source is the same as the - sheet which our control belongs to, then the sheet name is omitted in the - resulting string representation.

          - - @precond - The object is a valid cell range list source, or - @see isCellRangeListSource - */ - ::rtl::OUString getStringAddressFromCellListSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource - ) const; - - /** returns the current binding of our control model, if any. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > - getCurrentBinding( ) const; - - /** returns the current external list source of the control model, if any - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource > - getCurrentListSource( ) const; - - /** sets a new binding for our control model - @precond - the control model is bindable (which is implied by isCellBindingAllowed - returning ) - */ - void setBinding( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding - ); - - /** sets a list source for our control model - @precond - the control model is a list sink (which is implied by isListCellRangeAllowed - returning ) - */ - void setListSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource - ); - - /** checks whether it's possible to bind the control model to a spreadsheet cell - */ - bool isCellBindingAllowed( ) const; - - /** checks whether it's possible to bind the control model to a spreadsheet cell, - with exchanging integer values - */ - bool isCellIntegerBindingAllowed( ) const; - - /** checks whether it's possible to bind the control model to range of spreadsheet cells - supplying the list entries - */ - bool isListCellRangeAllowed( ) const; - - /** checks whether a given binding is a spreadsheet cell binding - */ - bool isCellBinding( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding - ) const; - - /** checks whether a given binding is a spreadsheet cell binding, exchanging - integer values - */ - bool isCellIntegerBinding( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding - ) const; - - /** checks whether a given list source is a spreadsheet cell list source - */ - bool isCellRangeListSource( - const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxSource - ) const; - - /** retrieves the index of the sheet which our control belongs to - @return the index of the sheet which our control belongs to or -1, if an error occurred - */ - sal_Int16 getControlSheetIndex( - ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& _out_rxSheet - ) const; - - protected: - /** creates an address object from a string representation of a cell address - */ - bool convertStringAddress( - const ::rtl::OUString& _rAddressDescription, - ::com::sun::star::table::CellAddress& /* [out] */ _rAddress - ) const; - - /** creates an address range object from a string representation of a cell range address - */ - bool convertStringAddress( - const ::rtl::OUString& _rAddressDescription, - ::com::sun::star::table::CellRangeAddress& /* [out] */ _rAddress - ) const; - - /** determines if our document is a spreadsheet document, *and* can supply - the given service - */ - bool isSpreadsheetDocumentWhichSupplies( const ::rtl::OUString& _rService ) const; - - /** checkes whether a given component supports a given servive - */ - bool doesComponentSupport( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent, - const ::rtl::OUString& _rService - ) const; - - /** uses the document (it's factory interface, respectively) to create a component instance - @param _rService - the service name - @param _rArgumentName - the name of the single argument to pass during creation. May be empty, in this case - no arguments are passed - @param _rArgumentValue - the value of the instantiation argument. Not evaluated if _rArgumentName - is empty. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - createDocumentDependentInstance( - const ::rtl::OUString& _rService, - const ::rtl::OUString& _rArgumentName, - const ::com::sun::star::uno::Any& _rArgumentValue - ) const; - - /** converts an address representation into another one - - @param _rInputProperty - the input property name for the conversion service - @param _rInputValue - the input property value for the conversion service - @param _rOutputProperty - the output property name for the conversion service - @param _rOutputValue - the output property value for the conversion service - @param _bIsRange - if , the RangeAddressConversion service will be used, else - the AddressConversion service - - @return - if any only if the conversion was successfull - - @see com::sun::star::table::CellAddressConversion - @see com::sun::star::table::CellRangeAddressConversion - */ - bool doConvertAddressRepresentations( - const ::rtl::OUString& _rInputProperty, - const ::com::sun::star::uno::Any& _rInputValue, - const ::rtl::OUString& _rOutputProperty, - ::com::sun::star::uno::Any& _rOutputValue, - bool _bIsRange - ) const SAL_THROW(()); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // EXTENSIONS_PROPCTRLR_CELLBINDINGHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx deleted file mode 100644 index f532fe25c..000000000 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "commoncontrol.hxx" -#include "pcrcommon.hxx" -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::inspection::XPropertyControlContext; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::inspection::XPropertyControl; - /** === end UNO using === **/ - - //================================================================== - //= ControlHelper - //================================================================== - //------------------------------------------------------------------ - ControlHelper::ControlHelper( Window* _pControlWindow, sal_Int16 _nControlType, XPropertyControl& _rAntiImpl, IModifyListener* _pModifyListener ) - :m_pControlWindow( _pControlWindow ) - ,m_nControlType( _nControlType ) - ,m_rAntiImpl( _rAntiImpl ) - ,m_pModifyListener( _pModifyListener ) - ,m_bModified( sal_False ) - { - DBG_ASSERT( m_pControlWindow != NULL, "ControlHelper::ControlHelper: invalid window!" ); - } - - //------------------------------------------------------------------ - ControlHelper::~ControlHelper() - { - } - - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL ControlHelper::getControlType() throw (RuntimeException) - { - return m_nControlType; - } - - //-------------------------------------------------------------------- - Reference< XPropertyControlContext > SAL_CALL ControlHelper::getControlContext() throw (RuntimeException) - { - return m_xContext; - } - - //-------------------------------------------------------------------- - void SAL_CALL ControlHelper::setControlContext( const Reference< XPropertyControlContext >& _controlcontext ) throw (RuntimeException) - { - m_xContext = _controlcontext; - } - - //-------------------------------------------------------------------- - Reference< XWindow > SAL_CALL ControlHelper::getControlWindow() throw (RuntimeException) - { - return VCLUnoHelper::GetInterface( m_pControlWindow ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ControlHelper::isModified( ) throw (RuntimeException) - { - return m_bModified; - } - - //-------------------------------------------------------------------- - void SAL_CALL ControlHelper::notifyModifiedValue( ) throw (RuntimeException) - { - if ( isModified() && m_xContext.is() ) - { - try - { - m_xContext->valueChanged( &m_rAntiImpl ); - m_bModified = sal_False; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //------------------------------------------------------------------ - void SAL_CALL ControlHelper::dispose() - { - DELETEZ( m_pControlWindow ); - } - - //------------------------------------------------------------------ - void ControlHelper::autoSizeWindow() - { - OSL_PRECOND( m_pControlWindow, "ControlHelper::autoSizeWindow: no window!" ); - if ( !m_pControlWindow ) - return; - - ComboBox aComboBox(m_pControlWindow, WB_DROPDOWN); - aComboBox.SetPosSizePixel(Point(0,0), Size(100,100)); - m_pControlWindow->SetSizePixel(aComboBox.GetSizePixel()); - - // TODO/UNOize: why do the controls this themselves? Shouldn't this be the task - // of the the browser listbox/line? - } - - //------------------------------------------------------------------ - void ControlHelper::impl_activateNextControl_nothrow() const - { - try - { - if ( m_xContext.is() ) - m_xContext->activateNextControl( const_cast< XPropertyControl* >( &m_rAntiImpl ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------ - bool ControlHelper::handlePreNotify(NotifyEvent& rNEvt) - { - if (EVENT_KEYINPUT == rNEvt.GetType()) - { - const KeyCode& aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - - if (nKey == KEY_RETURN && !aKeyCode.IsShift()) - { - LoseFocusHdl(m_pControlWindow); - impl_activateNextControl_nothrow(); - return true; - } - } - return false; - } - - //------------------------------------------------------------------ - IMPL_LINK( ControlHelper, ModifiedHdl, Window*, /*_pWin*/ ) - { - if ( m_pModifyListener ) - m_pModifyListener->modified(); - return 0; - } - - //------------------------------------------------------------------ - IMPL_LINK( ControlHelper, GetFocusHdl, Window*, /*_pWin*/ ) - { - try - { - if ( m_xContext.is() ) - m_xContext->focusGained( &m_rAntiImpl ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return 0; - } - - //------------------------------------------------------------------ - IMPL_LINK( ControlHelper, LoseFocusHdl, Window*, /*_pWin*/ ) - { - // TODO/UNOize: should this be outside the default control's implementations? If somebody - // has an own control implementation, which does *not* do this - would this be allowed? - // If not, then we must move this logic out of here. - notifyModifiedValue(); - return 0; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx deleted file mode 100644 index 6c834e977..000000000 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ /dev/null @@ -1,339 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_COMMONCONTROL_HXX_ -#define _EXTENSIONS_PROPCTRLR_COMMONCONTROL_HXX_ - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -class NotifyEvent; -//............................................................................ -namespace pcr -{ -//............................................................................ - - class ControlHelper; - //======================================================================== - //= ControlWindow - //======================================================================== - template< class WINDOW > - class ControlWindow : public WINDOW - { - protected: - typedef WINDOW WindowType; - - protected: - ControlHelper* m_pHelper; - - public: - ControlWindow( Window* _pParent, WinBits _nStyle ) - :WindowType( _pParent, _nStyle ) - ,m_pHelper( NULL ) - { - } - - /// sets a ControlHelper instance which some functionality is delegated to - inline virtual void setControlHelper( ControlHelper& _rControlHelper ); - - protected: - // Window overridables - inline virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - //======================================================================== - //= IModifyListener - //======================================================================== - class SAL_NO_VTABLE IModifyListener - { - public: - virtual void modified() = 0; - }; - - //======================================================================== - //= ControlHelper - //======================================================================== - /** A helper class for implementing the XPropertyControl - or one of its derived interfaces. - - This class is intended to be held as member of another class which implements the - XPropertyControl interface. The pointer - to this interface is to be passed to the ctor. - */ - class ControlHelper - { - private: - Window* m_pControlWindow; - sal_Int16 m_nControlType; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext > - m_xContext; - ::com::sun::star::inspection::XPropertyControl& - m_rAntiImpl; - IModifyListener* m_pModifyListener; - sal_Bool m_bModified; - - public: - /** creates the instance - @param _rControlWindow - the window which is associated with the XPropertyControl. - Must not be .
          - Ownership for this window is taken by the ControlHelper - it will be deleted in disposing. - @param _nControlType - the type of the control - one of the PropertyControlType - constants - @param _pAntiImpl - Reference to the instance as whose "impl-class" we act. This reference is held during lifetime - of the ControlHelper class, within acquiring it. Thus, the owner of the - ControlHelper is responsible for assuring the lifetime of the instance - pointed to by _pAntiImpl. - @param _pModifyListener - a listener to be modfied when the user modified the control's value. the - IModifyListener::modified of this listener is called from within our - ModifiedHdl. A default implementation of IModifyListener::modified - would just call our setModified. - */ - ControlHelper( - Window* _pControlWindow, - sal_Int16 _nControlType, - ::com::sun::star::inspection::XPropertyControl& _rAntiImpl, - IModifyListener* _pModifyListener ); - - virtual ~ControlHelper(); - - /** sets our "modified" flag to - */ - inline void setModified() { m_bModified = sal_True; } - inline Window* getVclControlWindow() { return m_pControlWindow; } - inline const Window* getVclControlWindow() const { return m_pControlWindow; } - - public: - // XPropertyControl - ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext > SAL_CALL getControlContext() throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setControlContext( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext >& _controlcontext ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getControlWindow() throw (::com::sun::star::uno::RuntimeException); - ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL notifyModifiedValue( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose(); - - /** (fail-safe) wrapper around calling our context's activateNextControl - */ - inline void activateNextControl() const { impl_activateNextControl_nothrow(); } - - public: - /// may be used to implement the default handling in PreNotify; returns sal_True if handled - bool handlePreNotify(NotifyEvent& _rNEvt); - - /// automatically size the window given in the ctor - void autoSizeWindow(); - - /// may be used by derived classes, they forward the event to the PropCtrListener - DECL_LINK( ModifiedHdl, Window* ); - DECL_LINK( GetFocusHdl, Window* ); - DECL_LINK( LoseFocusHdl, Window* ); - - private: - /** fail-safe wrapper around calling our context's activateNextControl - */ - void impl_activateNextControl_nothrow() const; - }; - - //======================================================================== - //= CommonBehaviourControl - //======================================================================== - /** implements a base class for XPropertyControl - implementations, which delegates the generic functionality of this interface to a - ControlHelper member. - - @param CONTROL_INTERFACE - an interface class which is derived from (or identical to) XPropertyControl - @param CONTROL_WINDOW - a class which is derived from ControlWindow - */ - template < class CONTROL_INTERFACE, class CONTROL_WINDOW > - class CommonBehaviourControl :public ::comphelper::OBaseMutex - ,public ::cppu::WeakComponentImplHelper1< CONTROL_INTERFACE > - ,public IModifyListener - { - protected: - typedef CONTROL_INTERFACE InterfaceType; - typedef CONTROL_WINDOW WindowType; - - typedef ::comphelper::OBaseMutex MutexBaseClass; - typedef ::cppu::WeakComponentImplHelper1< CONTROL_INTERFACE > ComponentBaseClass; - - protected: - ControlHelper m_aImplControl; - - protected: - inline CommonBehaviourControl( sal_Int16 _nControlType, Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers = true ); - - // XPropertyControl - delegated to ->m_aImplControl - inline ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException); - inline ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext > SAL_CALL getControlContext() throw (::com::sun::star::uno::RuntimeException); - inline void SAL_CALL setControlContext( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext >& _controlcontext ) throw (::com::sun::star::uno::RuntimeException); - inline ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getControlWindow() throw (::com::sun::star::uno::RuntimeException); - inline ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException); - inline void SAL_CALL notifyModifiedValue( ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - inline virtual void SAL_CALL disposing(); - - // IModifyListener - inline virtual void modified(); - - /// returns a typed pointer to our control window - WindowType* getTypedControlWindow() { return static_cast< WindowType* > ( m_aImplControl.getVclControlWindow() ); } - const WindowType* getTypedControlWindow() const { return static_cast< const WindowType* >( m_aImplControl.getVclControlWindow() ); } - - protected: - /** checks whether the instance is already disposed - @throws DisposedException - if the instance is already disposed - */ - inline void impl_checkDisposed_throw(); - }; - - //======================================================================== - //= ControlWindow - implementation - //======================================================================== - //------------------------------------------------------------------------ - template< class WINDOW > - inline void ControlWindow< WINDOW >::setControlHelper( ControlHelper& _rControlHelper ) - { - m_pHelper = &_rControlHelper; - } - - //------------------------------------------------------------------------ - template< class WINDOW > - inline long ControlWindow< WINDOW >::PreNotify( NotifyEvent& rNEvt ) - { - if ( m_pHelper && m_pHelper->handlePreNotify( rNEvt ) ) - return 1; - return WindowType::PreNotify( rNEvt ); - } - - //======================================================================== - //= CommonBehaviourControl - implementation - //======================================================================== - //------------------------------------------------------------------------ - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::CommonBehaviourControl ( sal_Int16 _nControlType, Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers ) - :ComponentBaseClass( m_aMutex ) - ,m_aImplControl( new WindowType( _pParentWindow, _nWindowStyle ), _nControlType, *this, this ) - { - WindowType* pControlWindow( getTypedControlWindow() ); - pControlWindow->setControlHelper( m_aImplControl ); - if ( _bDoSetHandlers ) - { - pControlWindow->SetModifyHdl( LINK( &m_aImplControl, ControlHelper, ModifiedHdl ) ); - pControlWindow->SetGetFocusHdl( LINK( &m_aImplControl, ControlHelper, GetFocusHdl ) ); - pControlWindow->SetLoseFocusHdl( LINK( &m_aImplControl, ControlHelper, LoseFocusHdl ) ); - } - m_aImplControl.autoSizeWindow(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline ::sal_Int16 SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::getControlType() throw (::com::sun::star::uno::RuntimeException) - { - return m_aImplControl.getControlType(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext > SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::getControlContext() throw (::com::sun::star::uno::RuntimeException) - { - return m_aImplControl.getControlContext(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline void SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::setControlContext( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlContext >& _controlcontext ) throw (::com::sun::star::uno::RuntimeException) - { - m_aImplControl.setControlContext( _controlcontext ); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::getControlWindow() throw (::com::sun::star::uno::RuntimeException) - { - return m_aImplControl.getControlWindow(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline ::sal_Bool SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::isModified( ) throw (::com::sun::star::uno::RuntimeException) - { - return m_aImplControl.isModified(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline void SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::notifyModifiedValue( ) throw (::com::sun::star::uno::RuntimeException) - { - m_aImplControl.notifyModifiedValue(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline void SAL_CALL CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::disposing() - { - m_aImplControl.dispose(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline void CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::modified() - { - m_aImplControl.setModified(); - } - - //-------------------------------------------------------------------- - template< class CONTROL_INTERFACE, class CONTROL_WINDOW > - inline void CommonBehaviourControl< CONTROL_INTERFACE, CONTROL_WINDOW >::impl_checkDisposed_throw() - { - if ( ComponentBaseClass::rBHelper.bDisposed ) - throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_COMMONCONTROL_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/composeduiupdate.cxx b/extensions/source/propctrlr/composeduiupdate.cxx deleted file mode 100644 index b8aa757a6..000000000 --- a/extensions/source/propctrlr/composeduiupdate.cxx +++ /dev/null @@ -1,861 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "composeduiupdate.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Exception; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::inspection::XPropertyHandler; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::inspection::XObjectInspectorUI; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::lang::NoSupportException; - using ::com::sun::star::inspection::XPropertyControlObserver; - /** === end UNO using === **/ - - namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; - - //==================================================================== - //= helper - //==================================================================== - namespace - { - struct HandlerLess : public ::std::binary_function < Reference< XPropertyHandler > - , Reference< XPropertyHandler > - , bool - > - { - bool operator()( const Reference< XPropertyHandler >& lhs, const Reference< XPropertyHandler >& rhs) const - { - return lhs.get() < rhs.get(); - } - }; - - //================================================================ - typedef ::std::set< ::rtl::OUString > StringBag; - typedef ::std::map< sal_Int16, StringBag > MapIntToStringBag; - } - - //==================================================================== - //= callbacks for CachedInspectorUI - //==================================================================== - typedef void (ComposedPropertyUIUpdate::*FNotifySingleUIChange)(); - - //==================================================================== - //= CachedInspectorUI - //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::inspection::XObjectInspectorUI - > CachedInspectorUI_Base; - struct CachedInspectorUI : public CachedInspectorUI_Base - { - private: - ::osl::Mutex m_aMutex; - oslInterlockedCount m_refCount; - bool m_bDisposed; - ComposedPropertyUIUpdate& - m_rMaster; - FNotifySingleUIChange m_pUIChangeNotification; - - // enablePropertyUI cache - StringBag aEnabledProperties; - StringBag aDisabledProperties; - - // show/hidePropertyUI cache - StringBag aShownProperties; - StringBag aHiddenProperties; - - // rebuildPropertyUI cache - StringBag aRebuiltProperties; - - // showCategory cache - StringBag aShownCategories; - StringBag aHiddenCategories; - - // enablePropertyUIElements cache - MapIntToStringBag aEnabledElements; - MapIntToStringBag aDisabledElements; - - public: - typedef StringBag& (CachedInspectorUI::*FGetStringBag)(); - - // enablePropertyUI cache - StringBag& getEnabledProperties() { return aEnabledProperties; } - StringBag& getDisabledProperties() { return aDisabledProperties; } - - // show/hidePropertyUI cache - StringBag& getShownProperties() { return aShownProperties; } - StringBag& getHiddenProperties() { return aHiddenProperties; } - - // rebuildPropertyUI cache - StringBag& getRebuiltProperties() { return aRebuiltProperties; } - - // showCategory cache - StringBag& getShownCategories() { return aShownCategories; } - StringBag& getHiddenCategories() { return aHiddenCategories; } - - // enablePropertyUIElements - StringBag& getEnabledInputControls() { return aEnabledElements[ PropertyLineElement::InputControl ]; } - StringBag& getDisabledInputControls() { return aDisabledElements[ PropertyLineElement::InputControl ]; } - StringBag& getEnabledPrimaryButtons() { return aEnabledElements[ PropertyLineElement::PrimaryButton ]; } - StringBag& getDisabledPrimaryButtons() { return aDisabledElements[ PropertyLineElement::PrimaryButton ]; } - StringBag& getEnabledSecondaryButtons() { return aEnabledElements[ PropertyLineElement::SecondaryButton ]; } - StringBag& getDisabledSecondaryButtons() { return aDisabledElements[ PropertyLineElement::SecondaryButton ]; } - - public: - CachedInspectorUI( ComposedPropertyUIUpdate& _rMaster, FNotifySingleUIChange _pUIChangeNotification ); - - /// disposes the instance - void dispose(); - - // XObjectInspectorUI overridables - virtual void SAL_CALL enablePropertyUI( const ::rtl::OUString& _rPropertyName, ::sal_Bool _bEnable ) throw (RuntimeException); - virtual void SAL_CALL enablePropertyUIElements( const ::rtl::OUString& _rPropertyName, ::sal_Int16 _nElements, ::sal_Bool _bEnable ) throw (RuntimeException); - virtual void SAL_CALL rebuildPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException); - virtual void SAL_CALL showPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException); - virtual void SAL_CALL hidePropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException); - virtual void SAL_CALL showCategory( const ::rtl::OUString& _rCategory, ::sal_Bool _bShow ) throw (RuntimeException); - virtual Reference< XPropertyControl > SAL_CALL getPropertyControl( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException); - virtual void SAL_CALL registerControlObserver( const Reference< XPropertyControlObserver >& Observer ) throw (RuntimeException); - virtual void SAL_CALL revokeControlObserver( const Reference< XPropertyControlObserver >& Observer ) throw (RuntimeException); - virtual void SAL_CALL setHelpSectionText( const ::rtl::OUString& _HelpText ) throw (NoSupportException, RuntimeException); - - // UNOCompatibleNonUNOReference overridables - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - protected: - ~CachedInspectorUI(); - - /// determines whether the instance is already disposed - inline bool isDisposed() const { return m_bDisposed; } - - /// throws an exception if the component is already disposed - void checkDisposed() const; - - private: - void impl_markElementEnabledOrDisabled( const ::rtl::OUString& _rPropertyName, sal_Int16 _nElementIdOrZero, sal_Bool _bEnable ); - - /** calls m_pUIChangeNotification at m_rMaster - */ - void impl_notifySingleUIChange() const; - - private: - CachedInspectorUI( const CachedInspectorUI& ); // never implemented - CachedInspectorUI& operator=( const CachedInspectorUI& ); // never implemented - - private: - class MethodGuard; - friend class MethodGuard; - class MethodGuard : public ::osl::MutexGuard - { - public: - MethodGuard( CachedInspectorUI& rInstance ) - : ::osl::MutexGuard( rInstance.m_aMutex ) - { - rInstance.checkDisposed(); - } - }; - }; - - //---------------------------------------------------------------- - CachedInspectorUI::CachedInspectorUI( ComposedPropertyUIUpdate& _rMaster, FNotifySingleUIChange _pUIChangeNotification ) - :m_refCount( 0 ) - ,m_bDisposed( false ) - ,m_rMaster( _rMaster ) - ,m_pUIChangeNotification( _pUIChangeNotification ) - { - } - - //---------------------------------------------------------------- - CachedInspectorUI::~CachedInspectorUI() - { - } - - //---------------------------------------------------------------- - void CachedInspectorUI::dispose() - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_bDisposed = true; - - clearContainer( aEnabledProperties ); - clearContainer( aDisabledProperties ); - clearContainer( aRebuiltProperties ); - clearContainer( aShownProperties ); - clearContainer( aHiddenProperties ); - clearContainer( aShownCategories ); - clearContainer( aHiddenCategories ); - clearContainer( aEnabledElements ); - clearContainer( aDisabledElements ); - } - - //---------------------------------------------------------------- - void SAL_CALL CachedInspectorUI::acquire() throw() - { - osl_incrementInterlockedCount( &m_refCount ); - } - - //---------------------------------------------------------------- - void SAL_CALL CachedInspectorUI::release() throw() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - delete this; - } - - - //---------------------------------------------------------------- - void CachedInspectorUI::checkDisposed() const - { - if ( isDisposed() ) - throw DisposedException(); - } - - //---------------------------------------------------------------- - namespace - { - void lcl_markStringKeyPositiveOrNegative( const ::rtl::OUString& _rKeyName, StringBag& _rPositives, StringBag& _rNegatives, sal_Bool _bMarkPositive ) - { - if ( _bMarkPositive ) - { - _rPositives.insert( _rKeyName ); - // if the same key has been remember as in the "negative" list before, clear this information, since it's overruled - _rNegatives.erase( _rKeyName ); - } - else - _rNegatives.insert( _rKeyName ); - } - } - - //---------------------------------------------------------------- - void CachedInspectorUI::enablePropertyUI( const ::rtl::OUString& _rPropertyName, sal_Bool _bEnable ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return; - - lcl_markStringKeyPositiveOrNegative( _rPropertyName, aEnabledProperties, aDisabledProperties, _bEnable ); - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::impl_markElementEnabledOrDisabled( const ::rtl::OUString& _rPropertyName, sal_Int16 _nElementIdOrZero, sal_Bool _bEnable ) - { - if ( _nElementIdOrZero == 0 ) - return; - - lcl_markStringKeyPositiveOrNegative( - _rPropertyName, - aEnabledElements[ _nElementIdOrZero ], - aDisabledElements[ _nElementIdOrZero ], - _bEnable - ); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::impl_notifySingleUIChange() const - { - (m_rMaster.*m_pUIChangeNotification)(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::enablePropertyUIElements( const ::rtl::OUString& _rPropertyName, sal_Int16 _nElements, sal_Bool _bEnable ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return; - - impl_markElementEnabledOrDisabled( _rPropertyName, _nElements & PropertyLineElement::InputControl, _bEnable ); - impl_markElementEnabledOrDisabled( _rPropertyName, _nElements & PropertyLineElement::PrimaryButton, _bEnable ); - impl_markElementEnabledOrDisabled( _rPropertyName, _nElements & PropertyLineElement::SecondaryButton, _bEnable ); - - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::rebuildPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return; - - aRebuiltProperties.insert( _rPropertyName ); - - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::showPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return; - - aShownProperties.insert( _rPropertyName ); - // if the same category has been hidden before, clear this information, since it's overruled - aHiddenProperties.erase( _rPropertyName ); - - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::hidePropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return; - - aHiddenProperties.insert( _rPropertyName ); - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - void CachedInspectorUI::showCategory( const ::rtl::OUString& _rCategory, sal_Bool _bShow ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - lcl_markStringKeyPositiveOrNegative( _rCategory, aShownCategories, aHiddenCategories, _bShow ); - impl_notifySingleUIChange(); - } - - //---------------------------------------------------------------- - Reference< XPropertyControl > SAL_CALL CachedInspectorUI::getPropertyControl( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - if ( !m_rMaster.shouldContinuePropertyHandling( _rPropertyName ) ) - return Reference< XPropertyControl >(); - - return m_rMaster.getDelegatorUI()->getPropertyControl( _rPropertyName ); - } - - //-------------------------------------------------------------------- - void SAL_CALL CachedInspectorUI::registerControlObserver( const Reference< XPropertyControlObserver >& _Observer ) throw (RuntimeException) - { - OSL_FAIL( "CachedInspectorUI::registerControlObserver: not expected to be called!" ); - // CachedInspectorUI is used as context for the controls, and we don't expect them to - // register listeners themself - m_rMaster.getDelegatorUI()->registerControlObserver( _Observer ); - } - - //-------------------------------------------------------------------- - void SAL_CALL CachedInspectorUI::revokeControlObserver( const Reference< XPropertyControlObserver >& _Observer ) throw (RuntimeException) - { - OSL_FAIL( "CachedInspectorUI::revokeControlObserver: not expected to be called!" ); - // CachedInspectorUI is used as context for the controls, and we don't expect them to - // register listeners themself - m_rMaster.getDelegatorUI()->revokeControlObserver( _Observer ); - } - - //---------------------------------------------------------------- - void SAL_CALL CachedInspectorUI::setHelpSectionText( const ::rtl::OUString& _HelpText ) throw (NoSupportException, RuntimeException) - { - m_rMaster.getDelegatorUI()->setHelpSectionText( _HelpText ); - } - - //==================================================================== - //= HandlerMap - //==================================================================== - typedef ::std::map < Reference< XPropertyHandler > - , ::rtl::Reference< CachedInspectorUI > - , HandlerLess - > ImplMapHandlerToUI; - struct MapHandlerToUI - { - ImplMapHandlerToUI aHandlers; - }; - - //==================================================================== - //= ComposedPropertyUIUpdate - //==================================================================== - //---------------------------------------------------------------- - ComposedPropertyUIUpdate::ComposedPropertyUIUpdate( const Reference< XObjectInspectorUI >& _rxDelegatorUI, - IPropertyExistenceCheck* _pPropertyCheck ) - :m_pCollectedUIs( new MapHandlerToUI ) - ,m_xDelegatorUI( _rxDelegatorUI ) - ,m_nSuspendCounter( 0 ) - ,m_pPropertyCheck( _pPropertyCheck ) - { - if ( !m_xDelegatorUI.is() ) - throw NullPointerException(); - } - - //---------------------------------------------------------------- - ComposedPropertyUIUpdate::~ComposedPropertyUIUpdate( ) - { - } - - //---------------------------------------------------------------- - Reference< XObjectInspectorUI > ComposedPropertyUIUpdate::getUIForPropertyHandler( const Reference< XPropertyHandler >& _rxHandler ) - { - impl_checkDisposed(); - - ::rtl::Reference< CachedInspectorUI >& rUI = m_pCollectedUIs->aHandlers[ _rxHandler ]; - if ( !rUI.is() ) - rUI = new CachedInspectorUI( *this, &ComposedPropertyUIUpdate::callback_inspectorUIChanged_throw ); - return rUI.get(); - } - - //---------------------------------------------------------------- - namespace - { - //============================================================ - //= StringBagCollector - //============================================================ - /** an STL-compatible structure which collects strings from a CachedInspectorUI instances - */ - struct StringBagCollector : public ::std::unary_function< ImplMapHandlerToUI::value_type, void > - { - private: - StringBag& m_rBag; - CachedInspectorUI::FGetStringBag m_pGetter; - - public: - StringBagCollector( StringBag& _rBag, CachedInspectorUI::FGetStringBag _pGetter ) :m_rBag( _rBag ), m_pGetter( _pGetter ) { } - - void operator()( const ImplMapHandlerToUI::value_type& _rUI ) - { - StringBag& rBag( ((_rUI.second.get())->*m_pGetter)() ); - m_rBag.insert( rBag.begin(), rBag.end() ); - } - - static void collectAll( StringBag& _rAll, const ImplMapHandlerToUI& _rMap, CachedInspectorUI::FGetStringBag _pGetter ) - { - ::std::for_each( _rMap.begin(), _rMap.end(), StringBagCollector( _rAll, _pGetter ) ); - } - }; - - //============================================================ - //= StringBagClearer - //============================================================ - /** an STL-compatible structure which cleans a certain string bag in a CachedInspectorUI instances - */ - struct StringBagClearer : public ::std::unary_function< ImplMapHandlerToUI::value_type, void > - { - private: - CachedInspectorUI::FGetStringBag m_pGetter; - - public: - StringBagClearer( CachedInspectorUI::FGetStringBag _pGetter ) :m_pGetter( _pGetter ) { } - - void operator()( const ImplMapHandlerToUI::value_type& _rUI ) - { - clearContainer( ((_rUI.second.get())->*m_pGetter)() ); - } - - static void clearAll( const ImplMapHandlerToUI& _rMap, CachedInspectorUI::FGetStringBag _pGetter ) - { - ::std::for_each( _rMap.begin(), _rMap.end(), StringBagClearer( _pGetter ) ); - } - }; - - //============================================================ - //= FPropertyUISetter - //============================================================ - /** a typedef for a ->XObjectInspectorUI member function taking a string - */ - typedef void ( SAL_CALL XObjectInspectorUI::*FPropertyUISetter )( const ::rtl::OUString& ); - - //============================================================ - //= PropertyUIOperator - //============================================================ - /** an STL-compatible struct which calls a certain member method (taking a string) at a - given ->XObjectInspectorUI instance - */ - struct PropertyUIOperator : public ::std::unary_function< ::rtl::OUString, void > - { - private: - Reference< XObjectInspectorUI > m_xUpdater; - FPropertyUISetter m_pSetter; - - public: - PropertyUIOperator( const Reference< XObjectInspectorUI >& _rxInspectorUI, FPropertyUISetter _pSetter ) - :m_xUpdater( _rxInspectorUI ) - ,m_pSetter( _pSetter ) - { - } - - void operator()( const ::rtl::OUString& _rPropertyName ) - { - ((m_xUpdater.get())->*m_pSetter)( _rPropertyName ); - } - - static void forEach( const StringBag& _rProperties, const Reference< XObjectInspectorUI >& _rxDelegatorUI, FPropertyUISetter _pSetter ) - { - ::std::for_each( _rProperties.begin(), _rProperties.end(), PropertyUIOperator( _rxDelegatorUI, _pSetter ) ); - } - }; - - //============================================================ - //= IStringKeyBooleanUIUpdate - //============================================================ - /** an interface which encapsulates access to a single aspect of the ->XObjectInspectorUI, - where this aspect is given by a string key, and has a boolean value. - */ - class IStringKeyBooleanUIUpdate - { - public: - virtual void updateUIForKey( const ::rtl::OUString& _rKey, sal_Bool _bFlag ) const = 0; - - virtual ~IStringKeyBooleanUIUpdate() { } - }; - - //============================================================ - //= FPropertyUIFlagSetter - //============================================================ - /** an implementation of the ->IStringKeyBooleanUIUpdate interface which, - for a fixed ->XObjectInspectorUI instance and a fixed UI element (->PropertyLineElement), - updates this element for a given property with a given boolean flag - (->XObjectInspectorUI::enablePropertyUIElements) - */ - class EnablePropertyUIElement : public IStringKeyBooleanUIUpdate - { - private: - Reference< XObjectInspectorUI > m_xUIUpdate; - sal_Int16 m_nElement; - - public: - EnablePropertyUIElement( const Reference< XObjectInspectorUI >& _rxUIUpdate, sal_Int16 _nElement ) - :m_xUIUpdate( _rxUIUpdate ) - ,m_nElement( _nElement ) - { - } - // IStringKeyBooleanUIUpdate - virtual void updateUIForKey( const ::rtl::OUString& _rKey, sal_Bool _bFlag ) const; - }; - - //............................................................ - void EnablePropertyUIElement::updateUIForKey( const ::rtl::OUString& _rKey, sal_Bool _bFlag ) const - { - m_xUIUpdate->enablePropertyUIElements( _rKey, m_nElement, _bFlag ); - } - - //============================================================ - //= FPropertyUIFlagSetter - //============================================================ - /** a ->XObjectInspectorUI method taking a string and a boolean - */ - typedef void ( SAL_CALL XObjectInspectorUI::*FPropertyUIFlagSetter )( const ::rtl::OUString&, sal_Bool ); - - //============================================================ - //= DefaultStringKeyBooleanUIUpdate - //============================================================ - /** an implementaiton of the ->IStringKeyBooleanUIUpdate interface which calls - am arbitrary ->XObjectInspectorUI method taking a string and a boolean flag - */ - class DefaultStringKeyBooleanUIUpdate : public IStringKeyBooleanUIUpdate - { - private: - Reference< XObjectInspectorUI > m_xUIUpdate; - FPropertyUIFlagSetter m_pSetter; - - public: - DefaultStringKeyBooleanUIUpdate( const Reference< XObjectInspectorUI >& _rxUIUpdate, FPropertyUIFlagSetter _pSetter ); - // IStringKeyBooleanUIUpdate - virtual void updateUIForKey( const ::rtl::OUString& _rKey, sal_Bool _bFlag ) const; - }; - - //............................................................ - DefaultStringKeyBooleanUIUpdate::DefaultStringKeyBooleanUIUpdate( const Reference< XObjectInspectorUI >& _rxUIUpdate, FPropertyUIFlagSetter _pSetter ) - :m_xUIUpdate( _rxUIUpdate ) - ,m_pSetter( _pSetter ) - { - } - - //............................................................ - void DefaultStringKeyBooleanUIUpdate::updateUIForKey( const ::rtl::OUString& _rKey, sal_Bool _bFlag ) const - { - ((m_xUIUpdate.get())->*m_pSetter)( _rKey, _bFlag ); - } - - //============================================================ - //= BooleanUIAspectUpdate - //============================================================ - /** an STL-compatible structure which applies a ->IStringKeyBooleanUIUpdate::updateUIForKey - operation with a fixed boolean value, for a given string value - */ - struct BooleanUIAspectUpdate : public ::std::unary_function< ::rtl::OUString, void > - { - private: - const IStringKeyBooleanUIUpdate& m_rUpdater; - sal_Bool m_bFlag; - - public: - BooleanUIAspectUpdate( const IStringKeyBooleanUIUpdate& _rUpdater, sal_Bool _bFlag ) - :m_rUpdater( _rUpdater ) - ,m_bFlag( _bFlag ) - { - } - - void operator()( const ::rtl::OUString& _rPropertyName ) - { - m_rUpdater.updateUIForKey( _rPropertyName, m_bFlag ); - } - - static void forEach( const StringBag& _rProperties, const IStringKeyBooleanUIUpdate& _rUpdater, sal_Bool _bFlag ) - { - ::std::for_each( _rProperties.begin(), _rProperties.end(), BooleanUIAspectUpdate( _rUpdater, _bFlag ) ); - } - }; - - //============================================================ - //= BooleanUIAspectUpdate - //============================================================ - /** an STL-compatible structure subtracting a given string from a fixed ->StringBag - */ - struct StringBagComplement : public ::std::unary_function< ::rtl::OUString, void > - { - private: - StringBag& m_rMinuend; - - public: - StringBagComplement( StringBag& _rMinuend ) :m_rMinuend( _rMinuend ) { } - - void operator()( const ::rtl::OUString& _rPropertyToSubtract ) - { - m_rMinuend.erase( _rPropertyToSubtract ); - } - - static void subtract( StringBag& _rMinuend, const StringBag& _rSubtrahend ) - { - ::std::for_each( _rSubtrahend.begin(), _rSubtrahend.end(), StringBagComplement( _rMinuend ) ); - } - }; - - //============================================================ - //= BooleanUIAspectUpdate - //============================================================ - void lcl_fireUIStateFlag( - const IStringKeyBooleanUIUpdate& _rUIUpdate, - const ImplMapHandlerToUI& _rHandlerUIs, - CachedInspectorUI::FGetStringBag _pGetPositives, - CachedInspectorUI::FGetStringBag _pGetNegatives - ) - { - // all strings which are in the "positive" list of one handler - StringBag aAllPositives; - StringBagCollector::collectAll( aAllPositives, _rHandlerUIs, _pGetPositives ); - - // all strings which are in the "negative" list of one handler - StringBag aAllNegatives; - StringBagCollector::collectAll( aAllNegatives, _rHandlerUIs, _pGetNegatives ); - - // propagate the "negative" flags to the delegator UI - BooleanUIAspectUpdate::forEach( aAllNegatives, _rUIUpdate, sal_False ); - - // propagate the "positive" flags to the delegator UI, for all elements where _no_ - // "negative" flag exists - StringBagComplement::subtract( aAllPositives, aAllNegatives ); - BooleanUIAspectUpdate::forEach( aAllPositives, _rUIUpdate, sal_True ); - - // the "positive" request can be cleared no, only negative requests - // (such as "disable a property" or "hide a category") need to be preserved for the next round - StringBagClearer::clearAll( _rHandlerUIs, _pGetPositives ); - } - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireEnablePropertyUI_throw() - { - lcl_fireUIStateFlag( - DefaultStringKeyBooleanUIUpdate( m_xDelegatorUI, &XObjectInspectorUI::enablePropertyUI ), - m_pCollectedUIs->aHandlers, - &CachedInspectorUI::getEnabledProperties, - &CachedInspectorUI::getDisabledProperties - ); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireRebuildPropertyUI_throw() - { - // collect all properties for which a rebuild request has been made - StringBag aAllRebuilt; - StringBagCollector::collectAll( aAllRebuilt, m_pCollectedUIs->aHandlers, &CachedInspectorUI::getRebuiltProperties ); - - // rebuild all those properties - PropertyUIOperator::forEach( aAllRebuilt, m_xDelegatorUI, &XObjectInspectorUI::rebuildPropertyUI ); - - // clear the "properties to rebuild" at all handlers, since the request has been fulfilled now. - StringBagClearer::clearAll( m_pCollectedUIs->aHandlers, &CachedInspectorUI::getRebuiltProperties ); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireShowHidePropertyUI_throw() - { - // all properties which have been shown by at least one handler - StringBag aAllShown; - StringBagCollector::collectAll( aAllShown, m_pCollectedUIs->aHandlers, &CachedInspectorUI::getShownProperties ); - // all properties which have been hidden by at least one handler - StringBag aAllHidden; - StringBagCollector::collectAll( aAllHidden, m_pCollectedUIs->aHandlers, &CachedInspectorUI::getHiddenProperties ); - - // hide properties as necessary - PropertyUIOperator::forEach( aAllHidden, m_xDelegatorUI, &XObjectInspectorUI::hidePropertyUI ); - - // for those properties which are hidden, ignore all "show" requests which other handlers might have had - StringBagComplement::subtract( aAllShown, aAllHidden ); - - // show properties - PropertyUIOperator::forEach( aAllShown, m_xDelegatorUI, &XObjectInspectorUI::showPropertyUI ); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireShowCategory_throw() - { - lcl_fireUIStateFlag( - DefaultStringKeyBooleanUIUpdate( m_xDelegatorUI, &XObjectInspectorUI::showCategory ), - m_pCollectedUIs->aHandlers, - &CachedInspectorUI::getShownCategories, - &CachedInspectorUI::getHiddenCategories - ); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireEnablePropertyUIElements_throw() - { - lcl_fireUIStateFlag( - EnablePropertyUIElement( m_xDelegatorUI, PropertyLineElement::InputControl ), - m_pCollectedUIs->aHandlers, - &CachedInspectorUI::getEnabledInputControls, - &CachedInspectorUI::getDisabledInputControls - ); - - lcl_fireUIStateFlag( - EnablePropertyUIElement( m_xDelegatorUI, PropertyLineElement::PrimaryButton ), - m_pCollectedUIs->aHandlers, - &CachedInspectorUI::getEnabledPrimaryButtons, - &CachedInspectorUI::getDisabledPrimaryButtons - ); - - lcl_fireUIStateFlag( - EnablePropertyUIElement( m_xDelegatorUI, PropertyLineElement::SecondaryButton ), - m_pCollectedUIs->aHandlers, - &CachedInspectorUI::getEnabledSecondaryButtons, - &CachedInspectorUI::getDisabledSecondaryButtons - ); - } - - //-------------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_fireAll_throw() - { - OSL_PRECOND( !impl_isDisposed(), "ComposedPropertyUIUpdate::impl_fireAll_throw: already disposed, this will crash!" ); - - impl_fireEnablePropertyUI_throw(); - impl_fireShowHidePropertyUI_throw(); - impl_fireRebuildPropertyUI_throw(); - impl_fireShowCategory_throw(); - impl_fireEnablePropertyUIElements_throw(); - } - - //-------------------------------------------------------------------- - void SAL_CALL ComposedPropertyUIUpdate::suspendAutoFire() - { - impl_checkDisposed(); - osl_incrementInterlockedCount( &m_nSuspendCounter ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ComposedPropertyUIUpdate::resumeAutoFire() - { - impl_checkDisposed(); - if ( 0 == osl_decrementInterlockedCount( &m_nSuspendCounter ) ) - impl_fireAll_throw(); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::impl_checkDisposed() const - { - if ( impl_isDisposed() ) - throw DisposedException(); - } - - //---------------------------------------------------------------- - void ComposedPropertyUIUpdate::callback_inspectorUIChanged_throw() - { - if ( 0 == m_nSuspendCounter ) - impl_fireAll_throw(); - } - - //---------------------------------------------------------------- - Reference< XObjectInspectorUI > ComposedPropertyUIUpdate::getDelegatorUI() const - { - impl_checkDisposed(); - return m_xDelegatorUI; - } - - //---------------------------------------------------------------- - void SAL_CALL ComposedPropertyUIUpdate::dispose() - { - if ( impl_isDisposed() ) - return; - - OSL_ENSURE( m_nSuspendCounter == 0, "ComposedPropertyUIUpdate::dispose: still suspended, the changes will be lost!" ); - - for ( ImplMapHandlerToUI::const_iterator singleUI = m_pCollectedUIs->aHandlers.begin(); - singleUI != m_pCollectedUIs->aHandlers.end(); - ++singleUI - ) - { - singleUI->second->dispose(); - } - m_pCollectedUIs.reset( NULL ); - m_xDelegatorUI.set( NULL ); - } - - //---------------------------------------------------------------- - bool ComposedPropertyUIUpdate::shouldContinuePropertyHandling( const ::rtl::OUString& _rName ) const - { - if ( !m_pPropertyCheck ) - return true; - if ( m_pPropertyCheck->hasPropertyByName( _rName ) ) - return true; - return false; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/composeduiupdate.hxx b/extensions/source/propctrlr/composeduiupdate.hxx deleted file mode 100644 index 3660246d3..000000000 --- a/extensions/source/propctrlr/composeduiupdate.hxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= some helper types - //==================================================================== - - struct MapHandlerToUI; - - /** callback for an ComposedPropertyUIUpdate checking a given property for existence - */ - class SAL_NO_VTABLE IPropertyExistenceCheck - { - public: - virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException) = 0; - }; - - //==================================================================== - //= ComposedPropertyUIUpdate - //==================================================================== - /** helper class composing requests to a ->XObjectInspectorUI interface, coming - from multiple sources - - Usually, a handler tells the browser UI to enable to disable, or show or hide, certain - elements. Now when multiple handlers do this, their instructions must be combined: - If one handler disables a certain element, but others enable it, it must in the - result still be disabled. Similar for showing/hiding elements. - - ->ComposedPropertyUIUpdate implements this combination. It does so by providing a dedicated - ->XObjectInspectorUI instance for every participating handler, and remembering the UI - state on a per-handler basis. Upon request (->fire), the combined UI state is - forwarded to another ->XObjectInspectorUI instance, the so-called delegator UI. - */ - class ComposedPropertyUIUpdate - { - private: - ::std::auto_ptr< MapHandlerToUI > m_pCollectedUIs; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > - m_xDelegatorUI; - oslInterlockedCount m_nSuspendCounter; - IPropertyExistenceCheck* m_pPropertyCheck; - - public: - /** constructs a ->ComposedPropertyUIUpdate instance - @param _rxDelegatorUI - a ->XObjectInspectorUI instance to which composed UI requests should be forwarded. Must - not be . - @param _pPropertyCheck - an instance checking properties for existence. If this is not , it will be invoked - whenever one of the ->XObjectInspectorUI methods is called, to check the passed property - name.
          - Beware of lifetime issues. The instance pointed to by _pPropertyCheck must - live at least as long as the ->ComposedPropertyUIUpdate instance you're going to create. - @throws ::com::sun::star::lang::NullPointerException - if ->_rxDelegatorUI is - */ - ComposedPropertyUIUpdate( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxDelegatorUI, - IPropertyExistenceCheck* _pPropertyCheck ); - ~ComposedPropertyUIUpdate(); - - /** returns the delegator UI - @throw ::com::sun::star::lang::DisposedException - */ - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > getDelegatorUI() const; - - /** returns a ->XObjectInspectorUI instance belonging to a given property handler - - In every call to an ->XPropertyHandler method which requires a ->XObjectInspectorUI, - the same UI instance should be used. The instance here will cache all requests passed - to it, and ->ComposedPropertyUIUpdate::fire will use the combination of all - cached UI states of all handlers to update the delegator UI. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > - getUIForPropertyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler ); - - /** Suspends automatic firing of UI changes - - normally, as soon as any of the property handlers does a request for an - arbitrary UI change, the set of collected UI changes is evaluated, and the combined - UI state is fired to the delegator UI. - - You can disable this automatic firing by calling ->suspendAutoFire. As longs as auto - firing is suspended, only explicit ->fire calls trigger the notification to the - delegator UI. - - Note that calls to ->suspendAutoFire are culmulative, that is, if you make multiple calls - they must be accompanied by an equal number of calls to ->resumeAutoFire, to enable - auto-firing again. - - @seealso resumeAutoFire - */ - void SAL_CALL suspendAutoFire(); - - /** Suspends automatic firing of UI changes - - @seealso suspendAutoFire - */ - void SAL_CALL resumeAutoFire(); - - /** disposes the instance, so it becomes non-functional. - - All cached handlers and cached ->XObjectInspectorUI instances will be released, - the latter will also be disposed, so that if anybody still holds a reference to them - and tries to operate them will get a DisposedException. - */ - void SAL_CALL dispose(); - - /** invokes m_pPropertyCheck to check whether a given property should be handled - */ - bool shouldContinuePropertyHandling( const ::rtl::OUString& _rName ) const; - - private: - /// determines whether the instance is already disposed - inline bool impl_isDisposed() const { return m_pCollectedUIs.get() == NULL; } - - /// throws an exception if the component is already disposed - void impl_checkDisposed() const; - - /** fires the collected UI changes to our delegator UI - - All operations for any elements are forwarded: -
          • If an element has been hidden at least once, it's also hidden at the delegator UI.
          • -
          • If an element has been shown at least once, and never been hidden, it's also - shown at the delegator UI.
          • -
          • If an element has never been shown or hidden, it's also not touched at the delegator UI.
          • -
          • The same holds if you replace "hidden" in the last three items with "disabled", - and "shown" with "enabled".
          • -
          • If an element should have been rebuilt (->XObjectInspectorUI::rebuiltPropertyUI) - at least once, it's rebuilt at the delegator UI, too.
            - After that, the request to rebuild the UI for this property is cleared, so subsequent - calls to ->fire will not trigger an new rebuilt request. -
          - - @precond - instance is not disposed - */ - void impl_fireAll_throw(); - - /// fires the combination of ->XObjectInspectorUI::enablePropertyUI calls - void impl_fireEnablePropertyUI_throw(); - - /// fires the combination of ->XObjectInspectorUI::enablePropertyUIElements calls - void impl_fireEnablePropertyUIElements_throw(); - - /// fires the combination of ->XObjectInspectorUI::rebuildPropertyUI calls - void impl_fireRebuildPropertyUI_throw(); - - /// fires the combination of ->XObjectInspectorUI::showPropertyUI and ->XObjectInspectorUI::hidePropertyUI calls - void impl_fireShowHidePropertyUI_throw(); - - /// fires the combination of ->XObjectInspectorUI::showCategory calls - void impl_fireShowCategory_throw(); - - /** callback for when a single property handler requested any change in the inspector UI - */ - void callback_inspectorUIChanged_throw(); - - private: - ComposedPropertyUIUpdate(); // never implemented - ComposedPropertyUIUpdate( const ComposedPropertyUIUpdate& ); // never implemented - ComposedPropertyUIUpdate& operator=( const ComposedPropertyUIUpdate& ); // never implemented - }; - - //==================================================================== - //= ComposedUIAutoFireGuard - //==================================================================== - class ComposedUIAutoFireGuard - { - private: - ComposedPropertyUIUpdate& m_rUIUpdate; - public: - ComposedUIAutoFireGuard( ComposedPropertyUIUpdate& _rUIUpdate ) - :m_rUIUpdate( _rUIUpdate ) - { - m_rUIUpdate.suspendAutoFire(); - } - ~ComposedUIAutoFireGuard() - { - m_rUIUpdate.resumeAutoFire(); - } - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_COMPOSEDUIUPDATE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx deleted file mode 100644 index 0fda4c8e8..000000000 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "controlfontdialog.hxx" -#include -#include "fontdialog.hxx" -#include "formstrings.hxx" -#include "pcrcommon.hxx" - -extern "C" void SAL_CALL createRegistryInfo_OControlFontDialog() -{ - ::pcr::OAutoRegistration< ::pcr::OControlFontDialog > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - - //==================================================================== - //= OControlFontDialog - //==================================================================== - //--------------------------------------------------------------------- - OControlFontDialog::OControlFontDialog(const Reference< XComponentContext >& _rxContext ) - :OGenericUnoDialog( _rxContext ) - ,m_pFontItems(NULL) - ,m_pItemPool(NULL) - ,m_pItemPoolDefaults(NULL) - { - registerProperty(PROPERTY_INTROSPECTEDOBJECT, OWN_PROPERTY_ID_INTROSPECTEDOBJECT, - PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, - &m_xControlModel, ::getCppuType(&m_xControlModel)); - } - - //--------------------------------------------------------------------- - OControlFontDialog::~OControlFontDialog() - { - if (m_pDialog) - { - ::osl::MutexGuard aGuard(m_aMutex); - if (m_pDialog) - destroyDialog(); - } - } - - //--------------------------------------------------------------------- - Sequence SAL_CALL OControlFontDialog::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OControlFontDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new OControlFontDialog( _rxContext ) ); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OControlFontDialog::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString OControlFontDialog::getImplementationName_static() throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.form.ui.OControlFontDialog")); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OControlFontDialog::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence OControlFontDialog::getSupportedServiceNames_static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.ControlFontDialog")); - return aSupported; - } - - //--------------------------------------------------------------------- - Reference SAL_CALL OControlFontDialog::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OControlFontDialog::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - - //-------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* OControlFontDialog::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - } - - //-------------------------------------------------------------------------- - Dialog* OControlFontDialog::createDialog(Window* _pParent) - { - ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); - - OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!"); - if (m_xControlModel.is()) - ControlCharacterDialog::translatePropertiesToItems(m_xControlModel, m_pFontItems); - // TODO: we need a mechanism to prevent that somebody creates us, sets an introspectee, executes us, - // sets a new introspectee and re-executes us. In this case, the dialog returned here (upon the first - // execute) will be re-used upon the second execute, and thus it won't be initialized correctly. - - ControlCharacterDialog* pDialog = new ControlCharacterDialog(_pParent, *m_pFontItems); - return pDialog; - } - - //------------------------------------------------------------------------- - void OControlFontDialog::destroyDialog() - { - OGenericUnoDialog::destroyDialog(); - ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); - } - - //------------------------------------------------------------------------- - void OControlFontDialog::executedDialog(sal_Int16 _nExecutionResult) - { - OSL_ENSURE(m_pDialog, "OControlFontDialog::executedDialog: no dialog anymore?!!"); - if (m_pDialog && (sal_True == _nExecutionResult) && m_xControlModel.is()) - { - const SfxItemSet* pOutput = static_cast(m_pDialog)->GetOutputItemSet(); - if (pOutput) - ControlCharacterDialog::translateItemsToProperties( *pOutput, m_xControlModel ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx deleted file mode 100644 index 555370d37..000000000 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_CONTROLFONTDIALOG_HXX_ -#define _EXTENSIONS_PROPCTRLR_CONTROLFONTDIALOG_HXX_ - -#include -#include "modulepcr.hxx" - -class SfxItemSet; -class SfxItemPool; -class SfxPoolItem; -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= OControlFontDialog - //==================================================================== - class OControlFontDialog; - typedef ::svt::OGenericUnoDialog OControlFontDialog_DBase; - typedef ::comphelper::OPropertyArrayUsageHelper< OControlFontDialog > OControlFontDialog_PBase; - - class OControlFontDialog - :public OControlFontDialog_DBase - ,public OControlFontDialog_PBase - ,public PcrClient - { - protected: - // - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xControlModel; - // - - SfxItemSet* m_pFontItems; // item set for the dialog - SfxItemPool* m_pItemPool; // item pool for the item set for the dialog - SfxPoolItem** m_pItemPoolDefaults; // pool defaults - - public: - OControlFontDialog(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& _rxContext); - ~OControlFontDialog(); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >&); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - virtual void destroyDialog(); - virtual void executedDialog(sal_Int16 _nExecutionResult); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_CONTROLFONTDIALOG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controltype.hxx b/extensions/source/propctrlr/controltype.hxx deleted file mode 100644 index c2c502449..000000000 --- a/extensions/source/propctrlr/controltype.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= control types, analogous to FormComponentType - //==================================================================== - namespace ControlType - { - static const sal_Int16 FIXEDLINE = (sal_Int16)100; - static const sal_Int16 FORMATTEDFIELD = (sal_Int16)101; - static const sal_Int16 PROGRESSBAR = (sal_Int16)102; - - // need only those which are not already covered as FormComponentType - } - -//........................................................................ -} // namespacepcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_CONTROLTYPE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx deleted file mode 100644 index 9d6584d75..000000000 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "defaultforminspection.hxx" -#include "pcrcommon.hxx" -#include "propresid.hrc" -#include "formresid.hrc" -#include "modulepcr.hxx" -#include "propctrlr.hrc" -#include "formmetadata.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ -#include -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_DefaultFormComponentInspectorModel() -{ - ::pcr::OAutoRegistration< ::pcr::DefaultFormComponentInspectorModel > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::inspection::PropertyCategoryDescriptor; - using ::com::sun::star::beans::UnknownPropertyException; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::lang::IllegalArgumentException; - /** === end UNO using === **/ - - //==================================================================== - //= DefaultFormComponentInspectorModel - //==================================================================== - //-------------------------------------------------------------------- - DefaultFormComponentInspectorModel::DefaultFormComponentInspectorModel( const Reference< XComponentContext >& _rxContext, bool _bUseFormFormComponentHandlers ) - :ImplInspectorModel( _rxContext ) - ,m_bUseFormComponentHandlers( _bUseFormFormComponentHandlers ) - ,m_bConstructed( false ) - ,m_pInfoService( new OPropertyInfoService ) - { - } - - //------------------------------------------------------------------------ - DefaultFormComponentInspectorModel::~DefaultFormComponentInspectorModel() - { - } - - //------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL DefaultFormComponentInspectorModel::getImplementationName( ) throw(RuntimeException) - { - return getImplementationName_static(); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL DefaultFormComponentInspectorModel::getSupportedServiceNames( ) throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //------------------------------------------------------------------------ - ::rtl::OUString DefaultFormComponentInspectorModel::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.extensions.DefaultFormComponentInspectorModel")); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > DefaultFormComponentInspectorModel::getSupportedServiceNames_static( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.inspection.DefaultFormComponentInspectorModel")); - return aSupported; - } - - //------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL DefaultFormComponentInspectorModel::Create( const Reference< XComponentContext >& _rxContext ) - { - return *new DefaultFormComponentInspectorModel( _rxContext ); - } - - //-------------------------------------------------------------------- - Sequence< Any > SAL_CALL DefaultFormComponentInspectorModel::getHandlerFactories() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // service names for all our handlers - struct - { - const sal_Char* serviceName; - bool isFormOnly; - } aFactories[] = { - - // a generic handler for form component properties (must precede the ButtonNavigationHandler) - { "com.sun.star.form.inspection.FormComponentPropertyHandler", false }, - - // generic virtual edit properties - { "com.sun.star.form.inspection.EditPropertyHandler", false }, - - // a handler which virtualizes the ButtonType property, to provide additional types like - // "move to next record" - { "com.sun.star.form.inspection.ButtonNavigationHandler", false }, - - // a handler for script events bound to form components or dialog elements - { "com.sun.star.form.inspection.EventHandler", false }, - - // a handler which introduces virtual properties for binding controls to spreadsheet cells - { "com.sun.star.form.inspection.CellBindingPropertyHandler", false }, - - // properties related to binding to an XForms DOM node - { "com.sun.star.form.inspection.XMLFormsPropertyHandler", true }, - - // properties related to the XSD data against which a control content is validated - { "com.sun.star.form.inspection.XSDValidationPropertyHandler", true }, - - // a handler which cares for XForms submissions - { "com.sun.star.form.inspection.SubmissionPropertyHandler", true }, - - // a handler which cares for geometry properties of form controls - { "com.sun.star.form.inspection.FormGeometryHandler", true } - }; - - sal_Int32 nFactories = SAL_N_ELEMENTS( aFactories ); - Sequence< Any > aReturn( nFactories ); - Any* pReturn = aReturn.getArray(); - for ( sal_Int32 i = 0; i < nFactories; ++i ) - { - if ( aFactories[i].isFormOnly && !m_bUseFormComponentHandlers ) - continue; - *pReturn++ <<= ::rtl::OUString::createFromAscii( aFactories[i].serviceName ); - } - aReturn.realloc( pReturn - aReturn.getArray() ); - - return aReturn; - } - - //-------------------------------------------------------------------- - Sequence< PropertyCategoryDescriptor > SAL_CALL DefaultFormComponentInspectorModel::describeCategories( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - struct - { - const sal_Char* programmaticName; - sal_uInt16 uiNameResId; - const sal_Char* helpId; - } aCategories[] = { - { "General", RID_STR_PROPPAGE_DEFAULT, HID_FM_PROPDLG_TAB_GENERAL }, - { "Data", RID_STR_PROPPAGE_DATA, HID_FM_PROPDLG_TAB_DATA }, - { "Events", RID_STR_EVENTS, HID_FM_PROPDLG_TAB_EVT } - }; - - sal_Int32 nCategories = SAL_N_ELEMENTS( aCategories ); - Sequence< PropertyCategoryDescriptor > aReturn( nCategories ); - PropertyCategoryDescriptor* pReturn = aReturn.getArray(); - for ( sal_Int32 i=0; iProgrammaticName = ::rtl::OUString::createFromAscii( aCategories[i].programmaticName ); - pReturn->UIName = String( PcrRes( aCategories[i].uiNameResId ) ); - pReturn->HelpURL = HelpIdUrl::getHelpURL( aCategories[i].helpId ); - } - - return aReturn; - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL DefaultFormComponentInspectorModel::getPropertyOrderIndex( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - sal_Int32 nPropertyId( m_pInfoService->getPropertyId( _rPropertyName ) ); - if ( nPropertyId == -1 ) - { - if ( _rPropertyName.indexOf( ';' ) != -1 ) - // it's an event. Just give it an arbitrary number - events will be on a separate - // page, and by definition, if two properties have the same OrderIndex, then - // they will be ordered as they appear in the handler's getSupportedProperties. - return 1000; - return 0; - } - return m_pInfoService->getPropertyPos( nPropertyId ); - } - - //-------------------------------------------------------------------- - void SAL_CALL DefaultFormComponentInspectorModel::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException) - { - if ( m_bConstructed ) - throw AlreadyInitializedException(); - - StlSyntaxSequence< Any > arguments( _arguments ); - if ( arguments.empty() ) - { // constructor: "createDefault()" - createDefault(); - return; - } - - sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); - if ( arguments.size() == 2 ) - { // constructor: "createWithHelpSection( long, long )" - if ( !( arguments[0] >>= nMinHelpTextLines ) || !( arguments[1] >>= nMaxHelpTextLines ) ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - createWithHelpSection( nMinHelpTextLines, nMaxHelpTextLines ); - return; - } - - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - } - - //-------------------------------------------------------------------- - void DefaultFormComponentInspectorModel::createDefault() - { - m_bConstructed = true; - } - - //-------------------------------------------------------------------- - void DefaultFormComponentInspectorModel::createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) - { - if ( ( _nMinHelpTextLines <= 0 ) || ( _nMaxHelpTextLines <= 0 ) || ( _nMinHelpTextLines > _nMaxHelpTextLines ) ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - - enableHelpSectionProperties( _nMinHelpTextLines, _nMaxHelpTextLines ); - m_bConstructed = true; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaultforminspection.hxx b/extensions/source/propctrlr/defaultforminspection.hxx deleted file mode 100644 index 9fe1cd397..000000000 --- a/extensions/source/propctrlr/defaultforminspection.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX - -#include "inspectormodelbase.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class OPropertyInfoService; - //==================================================================== - //= DefaultFormComponentInspectorModel - //==================================================================== - class DefaultFormComponentInspectorModel : public ImplInspectorModel - { - private: - bool m_bUseFormComponentHandlers; - bool m_bConstructed; - - /// access to property meta data - ::std::auto_ptr< OPropertyInfoService > m_pInfoService; - - protected: - ~DefaultFormComponentInspectorModel(); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XObjectInspectorModel - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getHandlerFactories() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::inspection::PropertyCategoryDescriptor > SAL_CALL describeCategories( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const ::rtl::OUString& PropertyName ) 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); - - public: - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); - - public: - DefaultFormComponentInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, bool _bUseFormFormComponentHandlers = true ); - - protected: - // Service constructors - void createDefault(); - void createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_DEFAULTFORMINSPECTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx deleted file mode 100644 index 7447a48e5..000000000 --- a/extensions/source/propctrlr/defaulthelpprovider.cxx +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "defaulthelpprovider.hxx" -#include "pcrcommon.hxx" -#include "modulepcr.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_DefaultHelpProvider() -{ - ::pcr::OAutoRegistration< ::pcr::DefaultHelpProvider > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::inspection::XObjectInspectorUI; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::awt::XVclWindowPeer; - /** === end UNO using === **/ - - //==================================================================== - //= DefaultHelpProvider - //==================================================================== - //-------------------------------------------------------------------- - DefaultHelpProvider::DefaultHelpProvider( const Reference< XComponentContext >& _rxContext ) - :m_aContext( _rxContext ) - ,m_bConstructed( false ) - { - } - - //-------------------------------------------------------------------- - DefaultHelpProvider::~DefaultHelpProvider() - { - } - - //------------------------------------------------------------------------ - ::rtl::OUString DefaultHelpProvider::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.extensions.DefaultHelpProvider")); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > DefaultHelpProvider::getSupportedServiceNames_static( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.inspection.DefaultHelpProvider")); - return aSupported; - } - - //------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL DefaultHelpProvider::Create( const Reference< XComponentContext >& _rxContext ) - { - return *new DefaultHelpProvider( _rxContext ); - } - - //-------------------------------------------------------------------- - void SAL_CALL DefaultHelpProvider::focusGained( const Reference< XPropertyControl >& _Control ) throw (RuntimeException) - { - if ( !m_xInspectorUI.is() ) - throw RuntimeException( ::rtl::OUString(), *this ); - - try - { - m_xInspectorUI->setHelpSectionText( impl_getHelpText_nothrow( _Control ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL DefaultHelpProvider::valueChanged( const Reference< XPropertyControl >& /*_Control*/ ) throw (RuntimeException) - { - // not interested in - } - - //-------------------------------------------------------------------- - void SAL_CALL DefaultHelpProvider::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException) - { - if ( m_bConstructed ) - throw AlreadyInitializedException(); - - StlSyntaxSequence< Any > arguments( _arguments ); - if ( arguments.size() == 1 ) - { // constructor: "create( XObjectInspectorUI )" - Reference< XObjectInspectorUI > xUI( arguments[0], UNO_QUERY ); - create( xUI ); - return; - } - - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - } - - //-------------------------------------------------------------------- - void DefaultHelpProvider::create( const Reference< XObjectInspectorUI >& _rxUI ) - { - if ( !_rxUI.is() ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - - try - { - m_xInspectorUI = _rxUI; - m_xInspectorUI->registerControlObserver( this ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - m_bConstructed = true; - } - - //-------------------------------------------------------------------- - Window* DefaultHelpProvider::impl_getVclControlWindow_nothrow( const Reference< XPropertyControl >& _rxControl ) - { - Window* pControlWindow = NULL; - OSL_PRECOND( _rxControl.is(), "DefaultHelpProvider::impl_getVclControlWindow_nothrow: illegal control!" ); - if ( !_rxControl.is() ) - return pControlWindow; - - try - { - Reference< XWindow > xControlWindow( _rxControl->getControlWindow(), UNO_QUERY_THROW ); - pControlWindow = VCLUnoHelper::GetWindow( xControlWindow ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return pControlWindow; - } - - //-------------------------------------------------------------------- - ::rtl::OUString DefaultHelpProvider::impl_getHelpText_nothrow( const Reference< XPropertyControl >& _rxControl ) - { - ::rtl::OUString sHelpText; - OSL_PRECOND( _rxControl.is(), "DefaultHelpProvider::impl_getHelpText_nothrow: illegal control!" ); - if ( !_rxControl.is() ) - return sHelpText; - - Window* pControlWindow( impl_getVclControlWindow_nothrow( _rxControl ) ); - OSL_ENSURE( pControlWindow, "DefaultHelpProvider::impl_getHelpText_nothrow: could not determine the VCL window!" ); - if ( !pControlWindow ) - return sHelpText; - - sHelpText = pControlWindow->GetHelpText(); - return sHelpText; - } -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaulthelpprovider.hxx b/extensions/source/propctrlr/defaulthelpprovider.hxx deleted file mode 100644 index 625521660..000000000 --- a/extensions/source/propctrlr/defaulthelpprovider.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_DEFAULTHELPPROVIDER_HXX -#define EXTENSIONS_DEFAULTHELPPROVIDER_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include - -class Window; - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= DefaultHelpProvider - //==================================================================== - typedef ::cppu::WeakImplHelper2 < ::com::sun::star::inspection::XPropertyControlObserver - , ::com::sun::star::lang::XInitialization - > DefaultHelpProvider_Base; - class DefaultHelpProvider : public DefaultHelpProvider_Base - { - private: - ::comphelper::ComponentContext m_aContext; - bool m_bConstructed; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > - m_xInspectorUI; - - public: - DefaultHelpProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); - - protected: - ~DefaultHelpProvider(); - - // XPropertyControlObserver - virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) 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); - - protected: - // Service constructors - void create( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxUI ); - - private: - Window* impl_getVclControlWindow_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ); - ::rtl::OUString impl_getHelpText_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_DEFAULTHELPPROVIDER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx deleted file mode 100644 index a1693ae3f..000000000 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ /dev/null @@ -1,325 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "editpropertyhandler.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -#define TEXTTYPE_SINGLELINE 0 -#define TEXTTYPE_MULTILINE 1 -#define TEXTTYPE_RICHTEXT 2 - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_EditPropertyHandler() -{ - ::pcr::EditPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= EditPropertyHandler - //==================================================================== - DBG_NAME( EditPropertyHandler ) - //-------------------------------------------------------------------- - EditPropertyHandler::EditPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EditPropertyHandler_Base( _rxContext ) - { - DBG_CTOR( EditPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - EditPropertyHandler::~EditPropertyHandler( ) - { - DBG_DTOR( EditPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EditPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EditPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EditPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.EditPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Any SAL_CALL EditPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - Any aReturn; - try - { - switch ( nPropId ) - { - case PROPERTY_ID_SHOW_SCROLLBARS: - { - sal_Bool bHasVScroll = sal_False; - m_xComponent->getPropertyValue( PROPERTY_VSCROLL ) >>= bHasVScroll; - sal_Bool bHasHScroll = sal_False; - m_xComponent->getPropertyValue( PROPERTY_HSCROLL ) >>= bHasHScroll; - - aReturn <<= (sal_Int32)( ( bHasVScroll ? 2 : 0 ) + ( bHasHScroll ? 1 : 0 ) ); - } - break; - - case PROPERTY_ID_TEXTTYPE: - { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; - sal_Bool bRichText = sal_False; - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_RICHTEXT ) >>= bRichText ); - if ( bRichText ) - nTextType = TEXTTYPE_RICHTEXT; - else - { - sal_Bool bMultiLine = sal_False; - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_MULTILINE ) >>= bMultiLine ); - if ( bMultiLine ) - nTextType = TEXTTYPE_MULTILINE; - else - nTextType = TEXTTYPE_SINGLELINE; - } - aReturn <<= nTextType; - } - break; - - - default: - OSL_FAIL( "EditPropertyHandler::getPropertyValue: cannot handle this property!" ); - break; - } - } - catch( const Exception& ) - { - OSL_FAIL( "EditPropertyHandler::getPropertyValue: caught an exception!" ); - } - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL EditPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - try - { - switch ( nPropId ) - { - case PROPERTY_ID_SHOW_SCROLLBARS: - { - sal_Int32 nScrollbars = 0; - _rValue >>= nScrollbars; - - sal_Bool bHasVScroll = 0 != ( nScrollbars & 2 ); - sal_Bool bHasHScroll = 0 != ( nScrollbars & 1 ); - - m_xComponent->setPropertyValue( PROPERTY_VSCROLL, makeAny( (sal_Bool)bHasVScroll ) ); - m_xComponent->setPropertyValue( PROPERTY_HSCROLL, makeAny( (sal_Bool)bHasHScroll ) ); - } - break; - - case PROPERTY_ID_TEXTTYPE: - { - sal_Bool bMultiLine = sal_False; - sal_Bool bRichText = sal_False; - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; - OSL_VERIFY( _rValue >>= nTextType ); - switch ( nTextType ) - { - case TEXTTYPE_SINGLELINE: bMultiLine = bRichText = sal_False; break; - case TEXTTYPE_MULTILINE: bMultiLine = sal_True; bRichText = sal_False; break; - case TEXTTYPE_RICHTEXT: bMultiLine = sal_True; bRichText = sal_True; break; - default: - OSL_FAIL( "EditPropertyHandler::setPropertyValue: invalid text type!" ); - } - - m_xComponent->setPropertyValue( PROPERTY_MULTILINE, makeAny( bMultiLine ) ); - m_xComponent->setPropertyValue( PROPERTY_RICHTEXT, makeAny( bRichText ) ); - } - break; - - default: - OSL_FAIL( "EditPropertyHandler::setPropertyValue: cannot handle this id!" ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EditPropertyHandler::setPropertyValue: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - bool EditPropertyHandler::implHaveBothScrollBarProperties() const - { - // have a "Scrollbars" property if the object supports both "HScroll" and "VScroll" - Reference< XPropertySetInfo > xPSI; - if ( m_xComponent.is() ) - xPSI = m_xComponent->getPropertySetInfo(); - - return xPSI.is() - && xPSI->hasPropertyByName( PROPERTY_HSCROLL ) - && xPSI->hasPropertyByName( PROPERTY_VSCROLL ); - } - - //-------------------------------------------------------------------- - bool EditPropertyHandler::implHaveTextTypeProperty() const - { - // have a "Scrollbars" property if the object supports both "HScroll" and "VScroll" - Reference< XPropertySetInfo > xPSI; - if ( m_xComponent.is() ) - xPSI = m_xComponent->getPropertySetInfo(); - - return xPSI.is() - && xPSI->hasPropertyByName( PROPERTY_RICHTEXT ) - && xPSI->hasPropertyByName( PROPERTY_MULTILINE ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL EditPropertyHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - - if ( implHaveBothScrollBarProperties() ) - addInt32PropertyDescription( aProperties, PROPERTY_SHOW_SCROLLBARS ); - - if ( implHaveTextTypeProperty() ) - addInt32PropertyDescription( aProperties, PROPERTY_TEXTTYPE ); - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EditPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - ::std::vector< ::rtl::OUString > aSuperseded; - if ( implHaveBothScrollBarProperties() ) - { - aSuperseded.push_back( PROPERTY_HSCROLL ); - aSuperseded.push_back( PROPERTY_VSCROLL ); - } - if ( implHaveTextTypeProperty() ) - { - aSuperseded.push_back( PROPERTY_RICHTEXT ); - aSuperseded.push_back( PROPERTY_MULTILINE ); - } - if ( aSuperseded.empty() ) - return Sequence< ::rtl::OUString >(); - return Sequence< ::rtl::OUString >( &(*aSuperseded.begin()), aSuperseded.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EditPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - ::std::vector< ::rtl::OUString > aInterestingActuatingProps; - if ( implHaveTextTypeProperty() ) - aInterestingActuatingProps.push_back( PROPERTY_TEXTTYPE ); - aInterestingActuatingProps.push_back( PROPERTY_MULTILINE ); - return Sequence< ::rtl::OUString >( &(*aInterestingActuatingProps.begin()), aInterestingActuatingProps.size() );; - } - - //-------------------------------------------------------------------- - void SAL_CALL EditPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - switch ( nActuatingPropId ) - { - case PROPERTY_ID_TEXTTYPE: - { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; - getPropertyValue( PROPERTY_TEXTTYPE ) >>= nTextType; - - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_WORDBREAK ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_VERTICAL_ALIGN, nTextType == TEXTTYPE_SINGLELINE ); - - _rxInspectorUI->showCategory( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) ), nTextType != TEXTTYPE_RICHTEXT ); - } - break; - - case PROPERTY_ID_MULTILINE: - { - sal_Bool bIsMultiline = sal_False; - _rNewValue >>= bIsMultiline; - - _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, bIsMultiline ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, !bIsMultiline ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, bIsMultiline ); - } - break; - - default: - OSL_FAIL( "EditPropertyHandler::actuatingPropertyChanged: cannot handle this id!" ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/editpropertyhandler.hxx b/extensions/source/propctrlr/editpropertyhandler.hxx deleted file mode 100644 index 8035cc893..000000000 --- a/extensions/source/propctrlr/editpropertyhandler.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= EditPropertyHandler - //==================================================================== - class EditPropertyHandler; - typedef HandlerComponentBase< EditPropertyHandler > EditPropertyHandler_Base; - /** a property handler for any virtual string properties - */ - class EditPropertyHandler : public EditPropertyHandler_Base - { - public: - EditPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~EditPropertyHandler(); - - protected: - // XPropertyHandler overriables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - private: - bool implHaveBothScrollBarProperties() const; - bool implHaveTextTypeProperty() const; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_EDITPROPERTYHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx deleted file mode 100644 index ee70cbcc5..000000000 --- a/extensions/source/propctrlr/eformshelper.cxx +++ /dev/null @@ -1,789 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "eformshelper.hxx" -#include "formstrings.hxx" -#include "formresid.hrc" -#include "modulepcr.hxx" -#include "propeventtranslation.hxx" -#include "formbrowsertools.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::form::binding; - using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - - //==================================================================== - //= file-local helpers - //==================================================================== - namespace - { - //-------------------------------------------------------------------- - ::rtl::OUString composeModelElementUIName( const ::rtl::OUString& _rModelName, const ::rtl::OUString& _rElementName ) - { - ::rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii( "[" ); - aBuffer.append( _rModelName ); - aBuffer.appendAscii( "] " ); - aBuffer.append( _rElementName ); - return aBuffer.makeStringAndClear(); - } - } - - //==================================================================== - //= EFormsHelper - //==================================================================== - //-------------------------------------------------------------------- - EFormsHelper::EFormsHelper( ::osl::Mutex& _rMutex, const Reference< XPropertySet >& _rxControlModel, const Reference< frame::XModel >& _rxContextDocument ) - :m_xControlModel( _rxControlModel ) - ,m_aPropertyListeners( _rMutex ) - { - OSL_ENSURE( _rxControlModel.is(), "EFormsHelper::EFormsHelper: invalid control model!" ); - m_xBindableControl = m_xBindableControl.query( _rxControlModel ); - - m_xDocument = m_xDocument.query( _rxContextDocument ); - OSL_ENSURE( m_xDocument.is(), "EFormsHelper::EFormsHelper: invalid document!" ); - - } - - //-------------------------------------------------------------------- - bool EFormsHelper::isEForm( const Reference< frame::XModel >& _rxContextDocument ) - { - try - { - Reference< xforms::XFormsSupplier > xDocument( _rxContextDocument, UNO_QUERY ); - if ( !xDocument.is() ) - return false; - - return xDocument->getXForms().is(); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::isEForm: caught an exception!" ); - } - return false; - } - - //-------------------------------------------------------------------- - bool EFormsHelper::canBindToDataType( sal_Int32 _nDataType ) const SAL_THROW(()) - { - if ( !m_xBindableControl.is() ) - // cannot bind at all - return false; - - // some types cannot be bound, independent from the control type - if ( ( DataTypeClass::hexBinary == _nDataType ) - || ( DataTypeClass::base64Binary == _nDataType ) - || ( DataTypeClass::QName == _nDataType ) - || ( DataTypeClass::NOTATION == _nDataType ) - ) - return false; - - bool bCan = false; - try - { - // classify the control model - sal_Int16 nControlType = FormComponentType::CONTROL; - OSL_VERIFY( m_xControlModel->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType ); - - // some lists - sal_Int16 nNumericCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, 0 }; - sal_Int16 nDateCompatibleTypes[] = { DataTypeClass::DATE, 0 }; - sal_Int16 nTimeCompatibleTypes[] = { DataTypeClass::TIME, 0 }; - sal_Int16 nCheckboxCompatibleTypes[] = { DataTypeClass::BOOLEAN, DataTypeClass::STRING, DataTypeClass::anyURI, 0 }; - sal_Int16 nRadiobuttonCompatibleTypes[] = { DataTypeClass::STRING, DataTypeClass::anyURI, 0 }; - sal_Int16 nFormattedCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, DataTypeClass::DATETIME, DataTypeClass::DATE, DataTypeClass::TIME, 0 }; - - sal_Int16* pCompatibleTypes = NULL; - switch ( nControlType ) - { - case FormComponentType::SPINBUTTON: - case FormComponentType::NUMERICFIELD: - pCompatibleTypes = nNumericCompatibleTypes; - break; - case FormComponentType::DATEFIELD: - pCompatibleTypes = nDateCompatibleTypes; - break; - case FormComponentType::TIMEFIELD: - pCompatibleTypes = nTimeCompatibleTypes; - break; - case FormComponentType::CHECKBOX: - pCompatibleTypes = nCheckboxCompatibleTypes; - break; - case FormComponentType::RADIOBUTTON: - pCompatibleTypes = nRadiobuttonCompatibleTypes; - break; - - case FormComponentType::TEXTFIELD: - { - // both the normal text field, and the formatted field, claim to be a TEXTFIELD - // need to distinguish by service name - Reference< XServiceInfo > xSI( m_xControlModel, UNO_QUERY ); - OSL_ENSURE( xSI.is(), "EFormsHelper::canBindToDataType: a control model which has no service info?" ); - if ( xSI.is() ) - { - if ( xSI->supportsService( SERVICE_COMPONENT_FORMATTEDFIELD ) ) - { - pCompatibleTypes = nFormattedCompatibleTypes; - break; - } - } - // NO break here! - } - case FormComponentType::LISTBOX: - case FormComponentType::COMBOBOX: - // edit fields and list/combo boxes can be bound to anything - bCan = true; - } - - if ( !bCan && pCompatibleTypes ) - { - if ( _nDataType == -1 ) - { - // the control can be bound to at least one type, and exactly this is being asked for - bCan = true; - } - else - { - while ( *pCompatibleTypes && !bCan ) - bCan = ( *pCompatibleTypes++ == _nDataType ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::canBindToDataType: caught an exception!" ); - } - - return bCan; - } - - //-------------------------------------------------------------------- - bool EFormsHelper::isListEntrySink() const SAL_THROW(()) - { - bool bIs = false; - try - { - Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY ); - bIs = xAsSink.is(); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::isListEntrySink: caught an exception!" ); - } - return bIs; - } - - //-------------------------------------------------------------------- - void EFormsHelper::impl_switchBindingListening_throw( bool _bDoListening, const Reference< XPropertyChangeListener >& _rxListener ) - { - Reference< XPropertySet > xBindingProps; - if ( m_xBindableControl.is() ) - xBindingProps = xBindingProps.query( m_xBindableControl->getValueBinding() ); - if ( !xBindingProps.is() ) - return; - - if ( _bDoListening ) - { - xBindingProps->addPropertyChangeListener( ::rtl::OUString(), _rxListener ); - } - else - { - xBindingProps->removePropertyChangeListener( ::rtl::OUString(), _rxListener ); - } - } - - //-------------------------------------------------------------------- - void EFormsHelper::registerBindingListener( const Reference< XPropertyChangeListener >& _rxBindingListener ) - { - if ( !_rxBindingListener.is() ) - return; - impl_toggleBindingPropertyListening_throw( true, _rxBindingListener ); - } - - //-------------------------------------------------------------------- - void EFormsHelper::impl_toggleBindingPropertyListening_throw( bool _bDoListen, const Reference< XPropertyChangeListener >& _rxConcreteListenerOrNull ) - { - if ( !_bDoListen ) - { - ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > pListenerIterator = m_aPropertyListeners.createIterator(); - while ( pListenerIterator->hasMoreElements() ) - { - PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( pListenerIterator->next() ); - OSL_ENSURE( pTranslator, "EFormsHelper::impl_toggleBindingPropertyListening_throw: invalid listener element in my container!" ); - if ( !pTranslator ) - continue; - - Reference< XPropertyChangeListener > xEventSourceTranslator( pTranslator ); - if ( _rxConcreteListenerOrNull.is() ) - { - if ( pTranslator->getDelegator() == _rxConcreteListenerOrNull ) - { - impl_switchBindingListening_throw( false, xEventSourceTranslator ); - m_aPropertyListeners.removeListener( xEventSourceTranslator ); - break; - } - } - else - { - impl_switchBindingListening_throw( false, xEventSourceTranslator ); - } - } - } - else - { - if ( _rxConcreteListenerOrNull.is() ) - { - Reference< XPropertyChangeListener > xEventSourceTranslator( new PropertyEventTranslation( _rxConcreteListenerOrNull, m_xBindableControl ) ); - m_aPropertyListeners.addListener( xEventSourceTranslator ); - impl_switchBindingListening_throw( true, xEventSourceTranslator ); - } - else - { - ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > pListenerIterator = m_aPropertyListeners.createIterator(); - while ( pListenerIterator->hasMoreElements() ) - { - Reference< XPropertyChangeListener > xListener( pListenerIterator->next(), UNO_QUERY ); - impl_switchBindingListening_throw( true, xListener ); - } - } - } - } - - //-------------------------------------------------------------------- - void EFormsHelper::revokeBindingListener( const Reference< XPropertyChangeListener >& _rxBindingListener ) - { - impl_toggleBindingPropertyListening_throw( false, _rxBindingListener ); - } - - //-------------------------------------------------------------------- - void EFormsHelper::getFormModelNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rModelNames ) const SAL_THROW(()) - { - if ( m_xDocument.is() ) - { - try - { - _rModelNames.resize( 0 ); - - Reference< XNameContainer > xForms( m_xDocument->getXForms() ); - OSL_ENSURE( xForms.is(), "EFormsHelper::getFormModelNames: invalid forms container!" ); - if ( xForms.is() ) - { - Sequence< ::rtl::OUString > aModelNames = xForms->getElementNames(); - _rModelNames.resize( aModelNames.getLength() ); - ::std::copy( aModelNames.getConstArray(), aModelNames.getConstArray() + aModelNames.getLength(), - _rModelNames.begin() - ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getFormModelNames: caught an exception!" ); - } - } - } - - //-------------------------------------------------------------------- - void EFormsHelper::getBindingNames( const ::rtl::OUString& _rModelName, ::std::vector< ::rtl::OUString >& /* [out] */ _rBindingNames ) const SAL_THROW(()) - { - _rBindingNames.resize( 0 ); - try - { - Reference< xforms::XModel > xModel( getFormModelByName( _rModelName ) ); - if ( xModel.is() ) - { - Reference< XNameAccess > xBindings( xModel->getBindings(), UNO_QUERY ); - OSL_ENSURE( xBindings.is(), "EFormsHelper::getBindingNames: invalid bindings container obtained from the model!" ); - if ( xBindings.is() ) - { - Sequence< ::rtl::OUString > aNames = xBindings->getElementNames(); - _rBindingNames.resize( aNames.getLength() ); - ::std::copy( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength(), _rBindingNames.begin() ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getBindingNames: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Reference< xforms::XModel > EFormsHelper::getFormModelByName( const ::rtl::OUString& _rModelName ) const SAL_THROW(()) - { - Reference< xforms::XModel > xReturn; - try - { - Reference< XNameContainer > xForms( m_xDocument->getXForms() ); - OSL_ENSURE( xForms.is(), "EFormsHelper::getFormModelByName: invalid forms container!" ); - if ( xForms.is() ) - OSL_VERIFY( xForms->getByName( _rModelName ) >>= xReturn ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getFormModelByName: caught an exception!" ); - } - return xReturn; - } - - //-------------------------------------------------------------------- - Reference< xforms::XModel > EFormsHelper::getCurrentFormModel() const SAL_THROW(()) - { - Reference< xforms::XModel > xModel; - try - { - Reference< XPropertySet > xBinding( getCurrentBinding() ); - if ( xBinding.is() ) - { - OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_MODEL ) >>= xModel ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getCurrentFormModel: caught an exception!" ); - } - return xModel; - } - - //-------------------------------------------------------------------- - ::rtl::OUString EFormsHelper::getCurrentFormModelName() const SAL_THROW(()) - { - ::rtl::OUString sModelName; - try - { - Reference< xforms::XModel > xFormsModel( getCurrentFormModel() ); - if ( xFormsModel.is() ) - sModelName = xFormsModel->getID(); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getCurrentFormModel: caught an exception!" ); - } - return sModelName; - } - - //-------------------------------------------------------------------- - Reference< XPropertySet > EFormsHelper::getCurrentBinding() const SAL_THROW(()) - { - Reference< XPropertySet > xBinding; - - try - { - if ( m_xBindableControl.is() ) - xBinding = xBinding.query( m_xBindableControl->getValueBinding() ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getCurrentBinding: caught an exception!" ); - } - - return xBinding; - } - - //-------------------------------------------------------------------- - ::rtl::OUString EFormsHelper::getCurrentBindingName() const SAL_THROW(()) - { - ::rtl::OUString sBindingName; - try - { - Reference< XPropertySet > xBinding( getCurrentBinding() ); - if ( xBinding.is() ) - xBinding->getPropertyValue( PROPERTY_BINDING_ID ) >>= sBindingName; - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getCurrentBindingName: caught an exception!" ); - } - return sBindingName; - } - - //-------------------------------------------------------------------- - Reference< XListEntrySource > EFormsHelper::getCurrentListSourceBinding() const SAL_THROW(()) - { - Reference< XListEntrySource > xReturn; - try - { - Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY ); - OSL_ENSURE( xAsSink.is(), "EFormsHelper::getCurrentListSourceBinding: you should have used isListEntrySink before!" ); - if ( xAsSink.is() ) - xReturn = xAsSink->getListEntrySource(); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getCurrentListSourceBinding: caught an exception!" ); - } - return xReturn; - } - - //-------------------------------------------------------------------- - void EFormsHelper::setListSourceBinding( const Reference< XListEntrySource >& _rxListSource ) SAL_THROW(()) - { - try - { - Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY ); - OSL_ENSURE( xAsSink.is(), "EFormsHelper::setListSourceBinding: you should have used isListEntrySink before!" ); - if ( xAsSink.is() ) - xAsSink->setListEntrySource( _rxListSource ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::setListSourceBinding: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void EFormsHelper::setBinding( const Reference< ::com::sun::star::beans::XPropertySet >& _rxBinding ) SAL_THROW(()) - { - if ( !m_xBindableControl.is() ) - return; - - try - { - Reference< XPropertySet > xOldBinding( m_xBindableControl->getValueBinding(), UNO_QUERY ); - - Reference< XValueBinding > xBinding( _rxBinding, UNO_QUERY ); - OSL_ENSURE( xBinding.is() || !_rxBinding.is(), "EFormsHelper::setBinding: invalid binding!" ); - - impl_toggleBindingPropertyListening_throw( false, NULL ); - m_xBindableControl->setValueBinding( xBinding ); - impl_toggleBindingPropertyListening_throw( true, NULL ); - - ::std::set< ::rtl::OUString > aSet; - firePropertyChanges( xOldBinding, _rxBinding, aSet ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::setBinding: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Reference< XPropertySet > EFormsHelper::getOrCreateBindingForModel( const ::rtl::OUString& _rTargetModel, const ::rtl::OUString& _rBindingName ) const SAL_THROW(()) - { - OSL_ENSURE( _rBindingName.getLength(), "EFormsHelper::getOrCreateBindingForModel: invalid binding name!" ); - return implGetOrCreateBinding( _rTargetModel, _rBindingName ); - } - - //-------------------------------------------------------------------- - Reference< XPropertySet > EFormsHelper::implGetOrCreateBinding( const ::rtl::OUString& _rTargetModel, const ::rtl::OUString& _rBindingName ) const SAL_THROW(()) - { - OSL_ENSURE( !( !_rTargetModel.getLength() && _rBindingName .getLength() ), "EFormsHelper::implGetOrCreateBinding: no model, but a binding name?" ); - - Reference< XPropertySet > xBinding; - try - { - ::rtl::OUString sTargetModel( _rTargetModel ); - // determine the model which the binding should belong to - if ( !sTargetModel.getLength() ) - { - ::std::vector< ::rtl::OUString > aModelNames; - getFormModelNames( aModelNames ); - if ( !aModelNames.empty() ) - sTargetModel = *aModelNames.begin(); - OSL_ENSURE( sTargetModel.getLength(), "EFormsHelper::implGetOrCreateBinding: unable to obtain a default model!" ); - } - Reference< xforms::XModel > xModel( getFormModelByName( sTargetModel ) ); - Reference< XNameAccess > xBindingNames( xModel.is() ? xModel->getBindings() : Reference< XSet >(), UNO_QUERY ); - if ( xBindingNames.is() ) - { - // get or create the binding instance - if ( _rBindingName.getLength() ) - { - if ( xBindingNames->hasByName( _rBindingName ) ) - OSL_VERIFY( xBindingNames->getByName( _rBindingName ) >>= xBinding ); - else - { - xBinding = xModel->createBinding( ); - if ( xBinding.is() ) - { - xBinding->setPropertyValue( PROPERTY_BINDING_ID, makeAny( _rBindingName ) ); - xModel->getBindings()->insert( makeAny( xBinding ) ); - } - } - } - else - { - xBinding = xModel->createBinding( ); - if ( xBinding.is() ) - { - // find a nice name for it - String sBaseName( PcrRes( RID_STR_BINDING_UI_NAME ) ); - sBaseName += String::CreateFromAscii( " " ); - String sNewName; - sal_Int32 nNumber = 1; - do - { - sNewName = sBaseName + ::rtl::OUString::valueOf( nNumber++ ); - } - while ( xBindingNames->hasByName( sNewName ) ); - Reference< XNamed > xName( xBinding, UNO_QUERY_THROW ); - xName->setName( sNewName ); - // and insert into the model - xModel->getBindings()->insert( makeAny( xBinding ) ); - } - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return xBinding; - } - - //-------------------------------------------------------------------- - namespace - { - //................................................................ - struct PropertyBagInserter : public ::std::unary_function< Property, void > - { - private: - PropertyBag& m_rProperties; - - public: - PropertyBagInserter( PropertyBag& rProperties ) : m_rProperties( rProperties ) { } - - void operator()( const Property& _rProp ) - { - m_rProperties.insert( _rProp ); - } - }; - - //................................................................ - Reference< XPropertySetInfo > collectPropertiesGetInfo( const Reference< XPropertySet >& _rxProps, PropertyBag& _rBag ) - { - Reference< XPropertySetInfo > xInfo; - if ( _rxProps.is() ) - xInfo = _rxProps->getPropertySetInfo(); - if ( xInfo.is() ) - { - Sequence< Property > aProperties = xInfo->getProperties(); - ::std::for_each( aProperties.getConstArray(), aProperties.getConstArray() + aProperties.getLength(), - PropertyBagInserter( _rBag ) - ); - } - return xInfo; - } - } - - //-------------------------------------------------------------------- - ::rtl::OUString EFormsHelper::getModelElementUIName( const EFormsHelper::ModelElementType _eType, const Reference< XPropertySet >& _rxElement ) const SAL_THROW(()) - { - ::rtl::OUString sUIName; - try - { - // determine the model which the element belongs to - Reference< xforms::XFormsUIHelper1 > xHelper; - if ( _rxElement.is() ) - _rxElement->getPropertyValue( PROPERTY_MODEL ) >>= xHelper; - OSL_ENSURE( xHelper.is(), "EFormsHelper::getModelElementUIName: invalid element or model!" ); - if ( xHelper.is() ) - { - ::rtl::OUString sElementName = ( _eType == Submission ) ? xHelper->getSubmissionName( _rxElement, sal_True ) : xHelper->getBindingName( _rxElement, sal_True ); - Reference< xforms::XModel > xModel( xHelper, UNO_QUERY_THROW ); - sUIName = composeModelElementUIName( xModel->getID(), sElementName ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getModelElementUIName: caught an exception!" ); - } - - return sUIName; - } - - //-------------------------------------------------------------------- - Reference< XPropertySet > EFormsHelper::getModelElementFromUIName( const EFormsHelper::ModelElementType _eType, const ::rtl::OUString& _rUIName ) const SAL_THROW(()) - { - const MapStringToPropertySet& rMapUINameToElement( ( _eType == Submission ) ? m_aSubmissionUINames : m_aBindingUINames ); - MapStringToPropertySet::const_iterator pos = rMapUINameToElement.find( _rUIName ); - OSL_ENSURE( pos != rMapUINameToElement.end(), "EFormsHelper::getModelElementFromUIName: didn't find it!" ); - - return ( pos != rMapUINameToElement.end() ) ? pos->second : Reference< XPropertySet >(); - } - - //-------------------------------------------------------------------- - void EFormsHelper::getAllElementUINames( const ModelElementType _eType, ::std::vector< ::rtl::OUString >& /* [out] */ _rElementNames, bool _bPrepentEmptyEntry ) - { - MapStringToPropertySet& rMapUINameToElement( ( _eType == Submission ) ? m_aSubmissionUINames : m_aBindingUINames ); - rMapUINameToElement.clear(); - _rElementNames.resize( 0 ); - - if ( _bPrepentEmptyEntry ) - rMapUINameToElement[ ::rtl::OUString() ] = Reference< XPropertySet >(); - - try - { - // obtain the model names - ::std::vector< ::rtl::OUString > aModels; - getFormModelNames( aModels ); - _rElementNames.reserve( aModels.size() * 2 ); // heuristics - - // for every model, obtain the element - for ( ::std::vector< ::rtl::OUString >::const_iterator pModelName = aModels.begin(); - pModelName != aModels.end(); - ++pModelName - ) - { - Reference< xforms::XModel > xModel = getFormModelByName( *pModelName ); - OSL_ENSURE( xModel.is(), "EFormsHelper::getAllElementUINames: inconsistency in the models!" ); - Reference< xforms::XFormsUIHelper1 > xHelper( xModel, UNO_QUERY ); - - Reference< XIndexAccess > xElements; - if ( xModel.is() ) - xElements = xElements.query( ( _eType == Submission ) ? xModel->getSubmissions() : xModel->getBindings() ); - if ( !xElements.is() ) - break; - - sal_Int32 nElementCount = xElements->getCount(); - for ( sal_Int32 i = 0; i < nElementCount; ++i ) - { - Reference< XPropertySet > xElement( xElements->getByIndex( i ), UNO_QUERY ); - OSL_ENSURE( xElement.is(), "EFormsHelper::getAllElementUINames: empty element!" ); - if ( !xElement.is() ) - continue; -#if OSL_DEBUG_LEVEL > 0 - { - Reference< xforms::XModel > xElementsModel; - xElement->getPropertyValue( PROPERTY_MODEL ) >>= xElementsModel; - OSL_ENSURE( xElementsModel == xModel, "EFormsHelper::getAllElementUINames: inconsistency in the model-element relationship!" ); - if ( !( xElementsModel == xModel ) ) - xElement->setPropertyValue( PROPERTY_MODEL, makeAny( xModel ) ); - } -#endif - ::rtl::OUString sElementName = ( _eType == Submission ) ? xHelper->getSubmissionName( xElement, sal_True ) : xHelper->getBindingName( xElement, sal_True ); - ::rtl::OUString sUIName = composeModelElementUIName( *pModelName, sElementName ); - - OSL_ENSURE( rMapUINameToElement.find( sUIName ) == rMapUINameToElement.end(), "EFormsHelper::getAllElementUINames: duplicate name!" ); - rMapUINameToElement.insert( MapStringToPropertySet::value_type( sUIName, xElement ) ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::getAllElementUINames: caught an exception!" ); - } - - _rElementNames.resize( rMapUINameToElement.size() ); - ::std::transform( rMapUINameToElement.begin(), rMapUINameToElement.end(), _rElementNames.begin(), ::o3tl::select1st< MapStringToPropertySet::value_type >() ); - } - - //-------------------------------------------------------------------- - void EFormsHelper::firePropertyChange( const ::rtl::OUString& _rName, const Any& _rOldValue, const Any& _rNewValue ) const - { - if ( m_aPropertyListeners.empty() ) - return; - - if ( _rOldValue == _rNewValue ) - return; - - try - { - PropertyChangeEvent aEvent; - - aEvent.Source = m_xBindableControl.get(); - aEvent.PropertyName = _rName; - aEvent.OldValue = _rOldValue; - aEvent.NewValue = _rNewValue; - - const_cast< EFormsHelper* >( this )->m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::firePropertyChange: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void EFormsHelper::firePropertyChanges( const Reference< XPropertySet >& _rxOldProps, const Reference< XPropertySet >& _rxNewProps, ::std::set< ::rtl::OUString >& _rFilter ) const - { - if ( m_aPropertyListeners.empty() ) - return; - - try - { - PropertyBag aProperties; - Reference< XPropertySetInfo > xOldInfo = collectPropertiesGetInfo( _rxOldProps, aProperties ); - Reference< XPropertySetInfo > xNewInfo = collectPropertiesGetInfo( _rxNewProps, aProperties ); - - for ( PropertyBag::const_iterator aProp = aProperties.begin(); - aProp != aProperties.end(); - ++aProp - ) - { - if ( _rFilter.find( aProp->Name ) != _rFilter.end() ) - continue; - - Any aOldValue( NULL, aProp->Type ); - if ( xOldInfo.is() && xOldInfo->hasPropertyByName( aProp->Name ) ) - aOldValue = _rxOldProps->getPropertyValue( aProp->Name ); - - Any aNewValue( NULL, aProp->Type ); - if ( xNewInfo.is() && xNewInfo->hasPropertyByName( aProp->Name ) ) - aNewValue = _rxNewProps->getPropertyValue( aProp->Name ); - - firePropertyChange( aProp->Name, aOldValue, aNewValue ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsHelper::firePropertyChanges: caught an exception!" ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformshelper.hxx b/extensions/source/propctrlr/eformshelper.hxx deleted file mode 100644 index 53883b348..000000000 --- a/extensions/source/propctrlr/eformshelper.hxx +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX - -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, ::std::less< ::rtl::OUString > > - MapStringToPropertySet; - - //==================================================================== - //= EFormsHelper - //==================================================================== - class EFormsHelper - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xControlModel; - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XBindableValue > - m_xBindableControl; - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XFormsSupplier > - m_xDocument; - PropertyChangeListeners - m_aPropertyListeners; - MapStringToPropertySet - m_aSubmissionUINames; // only filled upon request - MapStringToPropertySet - m_aBindingUINames; // only filled upon request - - public: - EFormsHelper( - ::osl::Mutex& _rMutex, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - - /** determines whether the given document is an eForm - - If this method returns , you cannot instantiate a EFormsHelper with - this document, since then no of it's functionality will be available. - */ - static bool - isEForm( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ) SAL_THROW(()); - - /** registers a listener to be notified when any aspect of the binding changes. - - The listener will be registered at the current binding of the control model. If the binding - changes (see setBinding), the listener will be revoked from the old binding, - registered at the new binding, and for all properties which differ between both bindings, - the listener will be notified. - @see revokeBindingListener - */ - void registerBindingListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxBindingListener - ); - - /** revokes the binding listener which has previously been registered - @see registerBindingListener - */ - void revokeBindingListener( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxBindingListener - ); - - /** checks whether it's possible to bind the control model to a given XSD data type - - @param _nDataType - the data type which should be bound. If this is -1, is returned if the control model - can be bound to any data type. - */ - bool canBindToDataType( sal_Int32 _nDataType = -1 ) const SAL_THROW(()); - - /** checks whether the control model cna be bound to any XSD data type - */ - bool canBindToAnyDataType() const SAL_THROW(()) { return canBindToDataType( -1 ); } - - /** checks whether the control model is a source for list entries, as supplied by XML data bindings - */ - bool isListEntrySink() const SAL_THROW(()); - - /** retrieves the names of all XForms models in the document the control lives in - */ - void getFormModelNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rModelNames ) const SAL_THROW(()); - - /** retrieves the names of all bindings for a given model - @see getFormModelNames - */ - void getBindingNames( const ::rtl::OUString& _rModelName, ::std::vector< ::rtl::OUString >& /* [out] */ _rBindingNames ) const SAL_THROW(()); - - /// retrieves the XForms model (within the control model's document) with the given name - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XModel > - getFormModelByName( const ::rtl::OUString& _rModelName ) const SAL_THROW(()); - - /** retrieves the model which the active binding of the control model belongs to - */ - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XModel > - getCurrentFormModel() const SAL_THROW(()); - - /** retrieves the name of the model which the active binding of the control model belongs to - */ - ::rtl::OUString - getCurrentFormModelName() const SAL_THROW(()); - - /** retrieves the binding instance which is currently attached to the control model - */ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - getCurrentBinding() const SAL_THROW(()); - - /** retrieves the name of the binding instance which is currently attached to the control model - */ - ::rtl::OUString - getCurrentBindingName() const SAL_THROW(()); - - /** sets a new binding at the control model - */ - void setBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxBinding ) SAL_THROW(()); - - /** retrieves the binding instance which is currently used as list source for the control model - @see isListEntrySink - */ - ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource > - getCurrentListSourceBinding() const SAL_THROW(()); - - /** sets a new list source at the control model - @see isListEntrySink - */ - void setListSourceBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XListEntrySource >& _rxListSource ) SAL_THROW(()); - - /** retrieves a given binding for a given model, or creates a new one - - @param _rTargetModel - the name of the model to create a binding for. Must not be empty - @param _rBindingName - the name of the binding to retrieve. If the model denoted by _rTargetModel does not - have a binding with this name, a new binding is created and returned. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - getOrCreateBindingForModel( const ::rtl::OUString& _rTargetModel, const ::rtl::OUString& _rBindingName ) const SAL_THROW(()); - - /** types of sub-elements of a model - */ - enum ModelElementType - { - Submission, - Binding - }; - - /** retrieves the name of a model's sub-element, as to be shown in the UI - @see getModelElementFromUIName - @see getAllElementUINames - */ - ::rtl::OUString - getModelElementUIName( - const ModelElementType _eType, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxElement - ) const SAL_THROW(()); - - /** retrieves the submission object for an UI name - - Note that getAllElementUINames must have been called before, for the given element type - - @see getModelElementUIName - @see getAllElementUINames - */ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - getModelElementFromUIName( - const ModelElementType _eType, - const ::rtl::OUString& _rUIName - ) const SAL_THROW(()); - - /** retrieves the UI names of all elements of all models in our document - @param _eType - the type of elements for which the names should be retrieved - @param _rElementNames - the array of element names - @see getModelElementUIName - @see getModelElementFromUIName - */ - void getAllElementUINames( - const ModelElementType _eType, - ::std::vector< ::rtl::OUString >& /* [out] */ _rElementNames, - bool _bPrepentEmptyEntry - ); - - protected: - void firePropertyChanges( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxOldProps, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxNewProps, - ::std::set< ::rtl::OUString >& _rFilter - ) const; - - /** fires a change in a single property, if the property value changed, and if we have a listener - interested in property changes - */ - void firePropertyChange( - const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Any& _rOldValue, - const ::com::sun::star::uno::Any& _rNewValue - ) const; - - private: - void impl_switchBindingListening_throw( bool _bDoListening, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ); - - /// implementation for both getOrCreateBindingForModel - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - implGetOrCreateBinding( const ::rtl::OUString& _rTargetModel, const ::rtl::OUString& _rBindingName ) const SAL_THROW(()); - - void - impl_toggleBindingPropertyListening_throw( bool _bDoListen, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxConcreteListenerOrNull ); - - private: - EFormsHelper(); // never implemented - EFormsHelper( const EFormsHelper& ); // never implemented - EFormsHelper& operator=( const EFormsHelper& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_EFORMSHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx deleted file mode 100644 index 06cce6221..000000000 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ /dev/null @@ -1,618 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "eformspropertyhandler.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" -#include "propctrlr.hrc" -#include "formbrowsertools.hxx" -#include "eformshelper.hxx" -#include "handlerhelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include - -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_EFormsPropertyHandler() -{ - ::pcr::EFormsPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - 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::xforms; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::ui::dialogs; - using namespace ::com::sun::star::form::binding; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= EFormsPropertyHandler - //==================================================================== - DBG_NAME( EFormsPropertyHandler ) - //-------------------------------------------------------------------- - EFormsPropertyHandler::EFormsPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EFormsPropertyHandler_Base( _rxContext ) - ,m_bSimulatingModelChange( false ) - { - DBG_CTOR( EFormsPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - EFormsPropertyHandler::~EFormsPropertyHandler( ) - { - DBG_DTOR( EFormsPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EFormsPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EFormsPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EFormsPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.XMLFormsPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - ::rtl::OUString EFormsPropertyHandler::getModelNamePropertyValue() const - { - ::rtl::OUString sModelName = m_pHelper->getCurrentFormModelName(); - if ( !sModelName.getLength() ) - sModelName = m_sBindingLessModelName; - return sModelName; - } - - //-------------------------------------------------------------------- - Any SAL_CALL EFormsPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::getPropertyValue: we don't have any SupportedProperties!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - Any aReturn; - try - { - switch ( nPropId ) - { - case PROPERTY_ID_LIST_BINDING: - aReturn <<= m_pHelper->getCurrentListSourceBinding(); - break; - - case PROPERTY_ID_XML_DATA_MODEL: - aReturn <<= getModelNamePropertyValue(); - break; - - case PROPERTY_ID_BINDING_NAME: - aReturn <<= m_pHelper->getCurrentBindingName(); - break; - - case PROPERTY_ID_BIND_EXPRESSION: - case PROPERTY_ID_XSD_CONSTRAINT: - case PROPERTY_ID_XSD_CALCULATION: - case PROPERTY_ID_XSD_REQUIRED: - case PROPERTY_ID_XSD_RELEVANT: - case PROPERTY_ID_XSD_READONLY: - { - Reference< XPropertySet > xBindingProps( m_pHelper->getCurrentBinding() ); - if ( xBindingProps.is() ) - { - aReturn = xBindingProps->getPropertyValue( _rPropertyName ); - DBG_ASSERT( aReturn.getValueType().equals( ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ) ), - "EFormsPropertyHandler::getPropertyValue: invalid BindingExpression value type!" ); - } - else - aReturn <<= ::rtl::OUString(); - } - break; - - default: - OSL_FAIL( "EFormsPropertyHandler::getPropertyValue: cannot handle this property!" ); - break; - } - } - catch( const Exception& ) - { -#if OSL_DEBUG_LEVEL > 0 - ::rtl::OString sMessage( "EFormsPropertyHandler::getPropertyValue: caught an exception!" ); - sMessage += "\n(have been asked for the \""; - sMessage += ::rtl::OString( _rPropertyName.getStr(), _rPropertyName.getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += "\" property.)"; - OSL_FAIL( sMessage.getStr() ); -#endif - } - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL EFormsPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::setPropertyValue: we don't have any SupportedProperties!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - try - { - Any aOldValue = getPropertyValue( _rPropertyName ); - - switch ( nPropId ) - { - case PROPERTY_ID_LIST_BINDING: - { - Reference< XListEntrySource > xSource; - OSL_VERIFY( _rValue >>= xSource ); - m_pHelper->setListSourceBinding( xSource ); - } - break; - - case PROPERTY_ID_XML_DATA_MODEL: - { - OSL_VERIFY( _rValue >>= m_sBindingLessModelName ); - - // if the model changed, reset the binding to NULL - if ( m_pHelper->getCurrentFormModelName() != m_sBindingLessModelName ) - { - ::rtl::OUString sOldBindingName = m_pHelper->getCurrentBindingName(); - m_pHelper->setBinding( NULL ); - firePropertyChange( PROPERTY_BINDING_NAME, PROPERTY_ID_BINDING_NAME, - makeAny( sOldBindingName ), makeAny( ::rtl::OUString() ) ); - } - } - break; - - case PROPERTY_ID_BINDING_NAME: - { - ::rtl::OUString sNewBindingName; - OSL_VERIFY( _rValue >>= sNewBindingName ); - - bool bPreviouslyEmptyModel = !m_pHelper->getCurrentFormModel().is(); - - Reference< XPropertySet > xNewBinding; - if ( sNewBindingName.getLength() ) - // obtain the binding with this name, for the current model - xNewBinding = m_pHelper->getOrCreateBindingForModel( getModelNamePropertyValue(), sNewBindingName ); - - m_pHelper->setBinding( xNewBinding ); - - if ( bPreviouslyEmptyModel ) - { // simulate a property change for the model property - // This is because we "simulate" the Model property by remembering the - // value ourself. Other instances might, however, not know this value, - // but prefer to retrieve it somewhere else - e.g. from the EFormsHelper - // - // The really correct solution would be if *all* property handlers - // obtain a "current property value" for *all* properties from a central - // instance. Then, handler A could ask it for the value of property - // X, and this request would be re-routed to handler B, which ultimately - // knows the current value. - // However, there's no such mechanism in place currently. - m_bSimulatingModelChange = true; - firePropertyChange( PROPERTY_XML_DATA_MODEL, PROPERTY_ID_XML_DATA_MODEL, - makeAny( ::rtl::OUString() ), makeAny( getModelNamePropertyValue() ) ); - m_bSimulatingModelChange = false; - } - } - break; - - case PROPERTY_ID_BIND_EXPRESSION: - { - Reference< XPropertySet > xBinding( m_pHelper->getCurrentBinding() ); - OSL_ENSURE( xBinding.is(), "You should not reach this without an active binding!" ); - if ( xBinding.is() ) - xBinding->setPropertyValue( PROPERTY_BIND_EXPRESSION, _rValue ); - } - break; - - case PROPERTY_ID_XSD_REQUIRED: - case PROPERTY_ID_XSD_RELEVANT: - case PROPERTY_ID_XSD_READONLY: - case PROPERTY_ID_XSD_CONSTRAINT: - case PROPERTY_ID_XSD_CALCULATION: - { - Reference< XPropertySet > xBindingProps( m_pHelper->getCurrentBinding() ); - DBG_ASSERT( xBindingProps.is(), "EFormsPropertyHandler::setPropertyValue: how can I set a property if there's no binding?" ); - if ( xBindingProps.is() ) - { - DBG_ASSERT( _rValue.getValueType().equals( ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ) ), - "EFormsPropertyHandler::setPropertyValue: invalid value type!" ); - xBindingProps->setPropertyValue( _rPropertyName, _rValue ); - } - } - break; - - default: - OSL_FAIL( "EFormsPropertyHandler::setPropertyValue: cannot handle this property!" ); - break; - } - - impl_setContextDocumentModified_nothrow(); - - Any aNewValue( getPropertyValue( _rPropertyName ) ); - firePropertyChange( _rPropertyName, nPropId, aOldValue, aNewValue ); - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsPropertyHandler::setPropertyValue: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void EFormsPropertyHandler::onNewComponent() - { - EFormsPropertyHandler_Base::onNewComponent(); - - Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); - DBG_ASSERT( xDocument.is(), "EFormsPropertyHandler::onNewComponent: no document!" ); - if ( EFormsHelper::isEForm( xDocument ) ) - m_pHelper.reset( new EFormsHelper( m_aMutex, m_xComponent, xDocument ) ); - else - m_pHelper.reset( NULL ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL EFormsPropertyHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - - if ( m_pHelper.get() ) - { - if ( m_pHelper->canBindToAnyDataType() ) - { - aProperties.reserve( 7 ); - addStringPropertyDescription( aProperties, PROPERTY_XML_DATA_MODEL ); - addStringPropertyDescription( aProperties, PROPERTY_BINDING_NAME ); - addStringPropertyDescription( aProperties, PROPERTY_BIND_EXPRESSION ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_REQUIRED ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_RELEVANT ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_READONLY ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_CONSTRAINT ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_CALCULATION ); - } - if ( m_pHelper->isListEntrySink() ) - { - implAddPropertyDescription( aProperties, PROPERTY_LIST_BINDING, - ::getCppuType( static_cast< Reference< XListEntrySource > * >( NULL ) ) ); - } - } - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL EFormsPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aReturn; - - OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aReturn; - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - - ::rtl::OUString sControlValue; - switch ( nPropId ) - { - case PROPERTY_ID_LIST_BINDING: - { - OSL_VERIFY( _rControlValue >>= sControlValue ); - Reference< XListEntrySource > xListSource( m_pHelper->getModelElementFromUIName( EFormsHelper::Binding, sControlValue ), UNO_QUERY ); - OSL_ENSURE( xListSource.is() || !m_pHelper->getModelElementFromUIName( EFormsHelper::Binding, sControlValue ).is(), - "EFormsPropertyHandler::convertToPropertyValue: there's a binding which is no ListEntrySource!" ); - aReturn <<= xListSource; - } - break; - - default: - aReturn = EFormsPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); - break; - } - - return aReturn; - } - - //-------------------------------------------------------------------- - Any SAL_CALL EFormsPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aReturn; - - OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::convertToControlValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aReturn; - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - - OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, - "EFormsPropertyHandler::convertToControlValue: all our controls should use strings for value exchange!" ); - - switch ( nPropId ) - { - case PROPERTY_ID_LIST_BINDING: - { - Reference< XPropertySet > xListSourceBinding( _rPropertyValue, UNO_QUERY ); - if ( xListSourceBinding.is() ) - aReturn <<= m_pHelper->getModelElementUIName( EFormsHelper::Binding, xListSourceBinding ); - } - break; - - default: - aReturn = EFormsPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); - break; - } - - return aReturn; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EFormsPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pHelper.get() ) - return Sequence< ::rtl::OUString >(); - - ::std::vector< ::rtl::OUString > aInterestedInActuations( 2 ); - aInterestedInActuations[ 0 ] = PROPERTY_XML_DATA_MODEL; - aInterestedInActuations[ 1 ] = PROPERTY_BINDING_NAME; - return Sequence< ::rtl::OUString >( &(*aInterestedInActuations.begin()), aInterestedInActuations.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EFormsPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pHelper.get() ) - return Sequence< ::rtl::OUString >(); - - Sequence< ::rtl::OUString > aReturn( 1 ); - aReturn[ 0 ] = PROPERTY_INPUT_REQUIRED; - return aReturn; - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL EFormsPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - if ( !m_pHelper.get() ) - throw RuntimeException(); - - LineDescriptor aDescriptor; - sal_Int16 nControlType = PropertyControlType::TextField; - ::std::vector< ::rtl::OUString > aListEntries; - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_LIST_BINDING: - nControlType = PropertyControlType::ListBox; - const_cast< EFormsHelper* >( m_pHelper.get() )->getAllElementUINames( EFormsHelper::Binding, aListEntries, true ); - break; - - case PROPERTY_ID_XML_DATA_MODEL: - nControlType = PropertyControlType::ListBox; - m_pHelper->getFormModelNames( aListEntries ); - break; - - case PROPERTY_ID_BINDING_NAME: - { - nControlType = PropertyControlType::ComboBox; - ::rtl::OUString sCurrentModel( getModelNamePropertyValue() ); - if ( sCurrentModel.getLength() ) - m_pHelper->getBindingNames( sCurrentModel, aListEntries ); - } - break; - - case PROPERTY_ID_BIND_EXPRESSION: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_BIND_EXPRESSION); break; - case PROPERTY_ID_XSD_REQUIRED: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_XSD_REQUIRED); break; - case PROPERTY_ID_XSD_RELEVANT: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_XSD_RELEVANT); break; - case PROPERTY_ID_XSD_READONLY: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_XSD_READONLY); break; - case PROPERTY_ID_XSD_CONSTRAINT: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_XSD_CONSTRAINT); break; - case PROPERTY_ID_XSD_CALCULATION: aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_XSD_CALCULATION); break; - - default: - OSL_FAIL( "EFormsPropertyHandler::describePropertyLine: cannot handle this property!" ); - break; - } - - switch ( nControlType ) - { - case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_True ); - break; - case PropertyControlType::ComboBox: - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_True ); - break; - default: - aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, sal_False ); - break; - } - - aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) ); - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); - return aDescriptor; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL EFormsPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool /*_bPrimary*/, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::onInteractivePropertySelection: we do not have any SupportedProperties!" ); - if ( !m_pHelper.get() ) - return InteractiveSelectionResult_Cancelled; - - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - (void)nPropId; - OSL_ENSURE( ( PROPERTY_ID_BINDING_NAME == nPropId ) - || ( PROPERTY_ID_BIND_EXPRESSION == nPropId ) - || ( PROPERTY_ID_XSD_REQUIRED == nPropId ) - || ( PROPERTY_ID_XSD_RELEVANT == nPropId ) - || ( PROPERTY_ID_XSD_READONLY == nPropId ) - || ( PROPERTY_ID_XSD_CONSTRAINT == nPropId ) - || ( PROPERTY_ID_XSD_CALCULATION == nPropId ), "EFormsPropertyHandler::onInteractivePropertySelection: unexpected!" ); - - try - { - Reference< XExecutableDialog > xDialog; - m_aContext.createComponent( "com.sun.star.xforms.ui.dialogs.AddCondition", xDialog ); - Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); - - // the model for the dialog to work with - Reference< xforms::XModel > xModel( m_pHelper->getCurrentFormModel() ); - // the binding for the dialog to work with - Reference< XPropertySet > xBinding( m_pHelper->getCurrentBinding() ); - // the aspect of the binding which the dialog should modify - ::rtl::OUString sFacetName( _rPropertyName ); - - OSL_ENSURE( xModel.is() && xBinding.is() && sFacetName.getLength(), - "EFormsPropertyHandler::onInteractivePropertySelection: something is missing for the dialog initialization!" ); - if ( !( xModel.is() && xBinding.is() && sFacetName.getLength() ) ) - return InteractiveSelectionResult_Cancelled; - - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormModel" ) ), makeAny( xModel ) ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Binding" ) ), makeAny( xBinding ) ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FacetName" ) ), makeAny( sFacetName ) ); - - if ( !xDialog->execute() ) - // cancelled - return InteractiveSelectionResult_Cancelled; - - _rData = xDialogProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConditionValue" ) ) ); - return InteractiveSelectionResult_ObtainedValue; - } - catch( const Exception& ) - { - OSL_FAIL( "EFormsPropertyHandler::onInteractivePropertySelection: caught an exception!" ); - } - - // something went wrong here ...(but has been asserted already) - return InteractiveSelectionResult_Cancelled; - } - - //-------------------------------------------------------------------- - void SAL_CALL EFormsPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - EFormsPropertyHandler_Base::addPropertyChangeListener( _rxListener ); - if ( m_pHelper.get() ) - m_pHelper->registerBindingListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EFormsPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pHelper.get() ) - m_pHelper->revokeBindingListener( _rxListener ); - EFormsPropertyHandler_Base::removePropertyChangeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EFormsPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - OSL_PRECOND( m_pHelper.get(), "EFormsPropertyHandler::actuatingPropertyChanged: inconsistentcy!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - DBG_ASSERT( _rxInspectorUI.is(), "EFormsPropertyHandler::actuatingPropertyChanged: invalid callback!" ); - if ( !_rxInspectorUI.is() ) - return; - - switch ( nActuatingPropId ) - { - case PROPERTY_ID_XML_DATA_MODEL: - { - if ( m_bSimulatingModelChange ) - break; - ::rtl::OUString sDataModelName; - OSL_VERIFY( _rNewValue >>= sDataModelName ); - sal_Bool bBoundToSomeModel = 0 != sDataModelName.getLength(); - _rxInspectorUI->rebuildPropertyUI( PROPERTY_BINDING_NAME ); - _rxInspectorUI->enablePropertyUI( PROPERTY_BINDING_NAME, bBoundToSomeModel ); - } - // NO break - - case PROPERTY_ID_BINDING_NAME: - { - sal_Bool bHaveABinding = ( m_pHelper->getCurrentBindingName().getLength() > 0 ); - _rxInspectorUI->enablePropertyUI( PROPERTY_BIND_EXPRESSION, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_REQUIRED, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_RELEVANT, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_READONLY, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_CONSTRAINT, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_CALCULATION, bHaveABinding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_XSD_DATA_TYPE, bHaveABinding ); - } - break; - - default: - OSL_FAIL( "EFormsPropertyHandler::actuatingPropertyChanged: cannot handle this property!" ); - break; - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformspropertyhandler.hxx b/extensions/source/propctrlr/eformspropertyhandler.hxx deleted file mode 100644 index f1613a661..000000000 --- a/extensions/source/propctrlr/eformspropertyhandler.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class EFormsHelper; - //==================================================================== - //= EFormsPropertyHandler - //==================================================================== - class EFormsPropertyHandler; - typedef HandlerComponentBase< EFormsPropertyHandler > EFormsPropertyHandler_Base; - class EFormsPropertyHandler : public EFormsPropertyHandler_Base - { - private: - ::std::auto_ptr< EFormsHelper > m_pHelper; - /** current value of the Model property, if there is no binding, yet - */ - ::rtl::OUString m_sBindingLessModelName; - /** are we currently simulating a propertyChange event of the Model property? - */ - bool m_bSimulatingModelChange; - - public: - EFormsPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~EFormsPropertyHandler(); - - protected: - // XPropertyHandler overriables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor - SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - virtual void onNewComponent(); - - protected: - /** returns the value of the PROPERTY_XML_DATA_MODEL property. - - An extra method is necessary here, which respects both the value set at our helper, - and m_sBindingLessModelName - */ - ::rtl::OUString getModelNamePropertyValue() const; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_EFORMSPROPERTYHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/enumrepresentation.hxx b/extensions/source/propctrlr/enumrepresentation.hxx deleted file mode 100644 index 058dd1096..000000000 --- a/extensions/source/propctrlr/enumrepresentation.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= IPropertyEnumRepresentation - //==================================================================== - class SAL_NO_VTABLE IPropertyEnumRepresentation : public ::rtl::IReference - { - public: - /** retrieves all descriptions of all possible values of the enumeration property - */ - virtual ::std::vector< ::rtl::OUString > SAL_CALL getDescriptions( - ) const = 0; - - /** converts a given description into a property value - */ - virtual void SAL_CALL getValueFromDescription( - const ::rtl::OUString& _rDescription, - ::com::sun::star::uno::Any& _out_rValue - ) const = 0; - - /** converts a given property value into a description - */ - virtual ::rtl::OUString SAL_CALL getDescriptionForValue( - const ::com::sun::star::uno::Any& _rEnumValue - ) const = 0; - - virtual ~IPropertyEnumRepresentation() { }; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_ENUMREPRESENTATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx deleted file mode 100644 index 0fe072a6d..000000000 --- a/extensions/source/propctrlr/eventhandler.cxx +++ /dev/null @@ -1,1289 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "eventhandler.hxx" -#include "propctrlr.hrc" -#include "formbrowsertools.hxx" -#include "formresid.hrc" -#include "formstrings.hxx" -#include "handlerhelper.hxx" -#include "modulepcr.hxx" -#include "pcrcommon.hxx" -#include "pcrstrings.hxx" -#include "propertycontrolextender.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_EventHandler() -{ - ::pcr::OAutoRegistration< ::pcr::EventHandler > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::TypeClass_STRING; - using ::com::sun::star::uno::Type; - using ::com::sun::star::beans::XPropertyChangeListener; - using ::com::sun::star::beans::Property; - using ::com::sun::star::beans::PropertyState; - using ::com::sun::star::beans::PropertyState_DIRECT_VALUE; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::script::ScriptEventDescriptor; - using ::com::sun::star::script::XScriptEventsSupplier; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::container::XChild; - using ::com::sun::star::container::XIndexAccess; - using ::com::sun::star::script::XEventAttacherManager; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::beans::XIntrospection; - using ::com::sun::star::beans::XIntrospectionAccess; - using ::com::sun::star::container::XNameContainer; - using ::com::sun::star::awt::XTabControllerModel; - using ::com::sun::star::form::XForm; - using ::com::sun::star::form::runtime::XFormController; - using ::com::sun::star::beans::UnknownPropertyException; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::container::NoSuchElementException; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::container::XNameReplace; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::lang::WrappedTargetException; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::inspection::LineDescriptor; - using ::com::sun::star::inspection::XPropertyControlFactory; - using ::com::sun::star::inspection::InteractiveSelectionResult; - using ::com::sun::star::inspection::InteractiveSelectionResult_Cancelled; - using ::com::sun::star::inspection::InteractiveSelectionResult_Success; - using ::com::sun::star::inspection::XObjectInspectorUI; - using ::com::sun::star::util::XModifiable; - using ::com::sun::star::beans::PropertyChangeEvent; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::frame::XModel; - using ::com::sun::star::frame::XController; - using ::com::sun::star::uno::UNO_SET_THROW; - using com::sun::star::uri::UriReferenceFactory; - using com::sun::star::uri::XUriReferenceFactory; - using com::sun::star::uri::XVndSunStarScriptUrlReference; - using ::com::sun::star::lang::XEventListener; - /** === end UNO using === **/ - namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; - namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; - namespace FormComponentType = ::com::sun::star::form::FormComponentType; - - //==================================================================== - //= EventDescription - //==================================================================== - EventDescription::EventDescription( EventId _nId, const sal_Char* _pListenerNamespaceAscii, const sal_Char* _pListenerClassAsciiName, - const sal_Char* _pListenerMethodAsciiName, sal_uInt16 _nDisplayNameResId, const rtl::OString& _sHelpId, const rtl::OString& _sUniqueBrowseId ) - :sDisplayName( String( PcrRes( _nDisplayNameResId ) ) ) - ,sListenerMethodName( ::rtl::OUString::createFromAscii( _pListenerMethodAsciiName ) ) - ,sHelpId( _sHelpId ) - ,sUniqueBrowseId( _sUniqueBrowseId ) - ,nId( _nId ) - { - ::rtl::OUStringBuffer aQualifiedListenerClass; - aQualifiedListenerClass.appendAscii( "com.sun.star." ); - aQualifiedListenerClass.appendAscii( _pListenerNamespaceAscii ); - aQualifiedListenerClass.appendAscii( "." ); - aQualifiedListenerClass.appendAscii( _pListenerClassAsciiName ); - sListenerClassName = aQualifiedListenerClass.makeStringAndClear(); - } - - //======================================================================== - //= helper - //======================================================================== - namespace - { - //.................................................................... - #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \ - s_aKnownEvents.insert( EventMap::value_type( \ - ::rtl::OUString::createFromAscii( asciimethod ), \ - EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) ) - - //.................................................................... - bool lcl_getEventDescriptionForMethod( const ::rtl::OUString& _rMethodName, EventDescription& _out_rDescription ) - { - static EventMap s_aKnownEvents; - if ( s_aKnownEvents.empty() ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( s_aKnownEvents.empty() ) - { - static sal_Int32 nEventId = 0; - - DESCRIBE_EVENT( "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED ); - DESCRIBE_EVENT( "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED ); - DESCRIBE_EVENT( "form", "XChangeListener", "changed", CHANGED ); - DESCRIBE_EVENT( "awt", "XTextListener", "textChanged", TEXTCHANGED ); - DESCRIBE_EVENT( "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED ); - DESCRIBE_EVENT( "awt", "XFocusListener", "focusGained", FOCUSGAINED ); - DESCRIBE_EVENT( "awt", "XFocusListener", "focusLost", FOCUSLOST ); - DESCRIBE_EVENT( "awt", "XKeyListener", "keyPressed", KEYTYPED ); - DESCRIBE_EVENT( "awt", "XKeyListener", "keyReleased", KEYUP ); - DESCRIBE_EVENT( "awt", "XMouseListener", "mouseEntered", MOUSEENTERED ); - DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED ); - DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED ); - DESCRIBE_EVENT( "awt", "XMouseListener", "mousePressed", MOUSEPRESSED ); - DESCRIBE_EVENT( "awt", "XMouseListener", "mouseReleased", MOUSERELEASED ); - DESCRIBE_EVENT( "awt", "XMouseListener", "mouseExited", MOUSEEXITED ); - DESCRIBE_EVENT( "form", "XResetListener", "approveReset", APPROVERESETTED ); - DESCRIBE_EVENT( "form", "XResetListener", "resetted", RESETTED ); - DESCRIBE_EVENT( "form", "XSubmitListener", "approveSubmit", SUBMITTED ); - DESCRIBE_EVENT( "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE ); - DESCRIBE_EVENT( "form", "XUpdateListener", "updated", AFTERUPDATE ); - DESCRIBE_EVENT( "form", "XLoadListener", "loaded", LOADED ); - DESCRIBE_EVENT( "form", "XLoadListener", "reloading", RELOADING ); - DESCRIBE_EVENT( "form", "XLoadListener", "reloaded", RELOADED ); - DESCRIBE_EVENT( "form", "XLoadListener", "unloading", UNLOADING ); - DESCRIBE_EVENT( "form", "XLoadListener", "unloaded", UNLOADED ); - DESCRIBE_EVENT( "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE ); - DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE ); - DESCRIBE_EVENT( "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE ); - DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING ); - DESCRIBE_EVENT( "sdbc", "XRowSetListener", "cursorMoved", POSITIONED ); - DESCRIBE_EVENT( "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER ); - DESCRIBE_EVENT( "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURRED ); - DESCRIBE_EVENT( "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED ); - } - } - - EventMap::const_iterator pos = s_aKnownEvents.find( _rMethodName ); - if ( pos == s_aKnownEvents.end() ) - return false; - - _out_rDescription = pos->second; - return true; - } - - //.................................................................... - ::rtl::OUString lcl_getEventPropertyName( const ::rtl::OUString& _rListenerClassName, const ::rtl::OUString& _rMethodName ) - { - ::rtl::OUStringBuffer aPropertyName; - aPropertyName.append( _rListenerClassName ); - aPropertyName.append( (sal_Unicode)';' ); - aPropertyName.append( _rMethodName.getStr() ); - return aPropertyName.makeStringAndClear(); - } - - //................................................................ - ScriptEventDescriptor lcl_getAssignedScriptEvent( const EventDescription& _rEvent, const Sequence< ScriptEventDescriptor >& _rAllAssignedMacros ) - { - ScriptEventDescriptor aScriptEvent; - // for the case there is actually no event assigned, initialize at least ListenerType and MethodName, - // so this ScriptEventDescriptor properly describes the given event - aScriptEvent.ListenerType = _rEvent.sListenerClassName; - aScriptEvent.EventMethod = _rEvent.sListenerMethodName; - - const ScriptEventDescriptor* pAssignedEvent = _rAllAssignedMacros.getConstArray(); - sal_Int32 assignedEventCount( _rAllAssignedMacros.getLength() ); - for ( sal_Int32 assignedEvent = 0; assignedEvent < assignedEventCount; ++assignedEvent, ++pAssignedEvent ) - { - if ( ( pAssignedEvent->ListenerType != _rEvent.sListenerClassName ) - || ( pAssignedEvent->EventMethod != _rEvent.sListenerMethodName ) - ) - continue; - - if ( ( pAssignedEvent->ScriptCode.getLength() == 0 ) - || ( pAssignedEvent->ScriptType.getLength() == 0 ) - ) - { - OSL_FAIL( "lcl_getAssignedScriptEvent: me thinks this should not happen!" ); - continue; - } - - aScriptEvent = *pAssignedEvent; - - if ( !aScriptEvent.ScriptType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarBasic" ) ) ) - continue; - - // this is an old-style macro specification: - // [document|application]:Library.Module.Function - // we need to translate this to the new-style macro specification - // vnd.sun.star.script:Library.Module.Function?language=Basic&location=[document|application] - - sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' ); - OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" ); - ::rtl::OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen ); - ::rtl::OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 ); - - ::rtl::OUStringBuffer aNewStyleSpec; - aNewStyleSpec.appendAscii( "vnd.sun.star.script:" ); - aNewStyleSpec.append ( sMacroPath ); - aNewStyleSpec.appendAscii( "?language=Basic&location=" ); - aNewStyleSpec.append ( sLocation ); - - aScriptEvent.ScriptCode = aNewStyleSpec.makeStringAndClear(); - - // also, this new-style spec requires the script code to be "Script" instead of "StarBasic" - aScriptEvent.ScriptType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ); - } - return aScriptEvent; - } - - //................................................................ - ::rtl::OUString lcl_getQualifiedKnownListenerName( const ScriptEventDescriptor& _rFormComponentEventDescriptor ) - { - EventDescription aKnownEvent; - if ( lcl_getEventDescriptionForMethod( _rFormComponentEventDescriptor.EventMethod, aKnownEvent ) ) - return aKnownEvent.sListenerClassName; - OSL_FAIL( "lcl_getQualifiedKnownListenerName: unknown method name!" ); - // somebody assigned an script to a form component event which we don't know - // Speaking strictly, this is not really an error - it is possible to do - // this programmatically -, but it should rarely happen, since it's not possible - // via UI - return _rFormComponentEventDescriptor.ListenerType; - } - - //................................................................ - typedef ::std::set< Type, TypeLessByName > TypeBag; - - //................................................................ - void lcl_addListenerTypesFor_throw( const Reference< XInterface >& _rxComponent, - const Reference< XIntrospection >& _rxIntrospection, TypeBag& _out_rTypes ) - { - if ( !_rxComponent.is() ) - return; - OSL_PRECOND( _rxIntrospection.is(), "lcl_addListenerTypesFor_throw: this will crash!" ); - - Reference< XIntrospectionAccess > xIntrospectionAccess( - _rxIntrospection->inspect( makeAny( _rxComponent ) ), UNO_QUERY_THROW ); - - Sequence< Type > aListeners( xIntrospectionAccess->getSupportedListeners() ); - - ::std::copy( aListeners.getConstArray(), aListeners.getConstArray() + aListeners.getLength(), - ::std::insert_iterator< TypeBag >( _out_rTypes, _out_rTypes.begin() ) ); - } - - //................................................................ - bool operator ==( const ScriptEventDescriptor _lhs, const ScriptEventDescriptor _rhs ) - { - return ( ( _lhs.ListenerType == _rhs.ListenerType ) - && ( _lhs.EventMethod == _rhs.EventMethod ) - && ( _lhs.AddListenerParam == _rhs.AddListenerParam ) - && ( _lhs.ScriptType == _rhs.ScriptType ) - && ( _lhs.ScriptCode == _rhs.ScriptCode ) - ); - } - } - - //==================================================================== - //= EventHandler - //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::container::XNameReplace - > EventHolder_Base; - /** a UNO component holding assigned event descriptions, for use with a SvxMacroAssignDlg - */ - class EventHolder : public EventHolder_Base - { - private: - typedef ::boost::unordered_map< ::rtl::OUString, ScriptEventDescriptor, ::rtl::OUStringHash > EventMap; - typedef ::std::map< EventId, EventMap::iterator > EventMapIndexAccess; - - EventMap m_aEventNameAccess; - EventMapIndexAccess m_aEventIndexAccess; - - public: - EventHolder( ); - - void addEvent( EventId _nId, const ::rtl::OUString& _rEventName, const ScriptEventDescriptor& _rScriptEvent ); - - /** effectively the same as getByName, but instead of converting the ScriptEventDescriptor to the weird - format used by the macro assignment dialog, it is returned directly - */ - ScriptEventDescriptor getNormalizedDescriptorByName( const ::rtl::OUString& _rEventName ) const; - - // XNameReplace - virtual void SAL_CALL replaceByName( const ::rtl::OUString& _rName, const Any& aElement ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException); - virtual Any SAL_CALL getByName( const ::rtl::OUString& _rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& _rName ) throw (RuntimeException); - virtual Type SAL_CALL getElementType( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL hasElements( ) throw (RuntimeException); - - protected: - ~EventHolder( ); - - private: - ScriptEventDescriptor impl_getDescriptor_throw( const ::rtl::OUString& _rEventName ) const; - }; - - DBG_NAME( EventHolder ) - //------------------------------------------------------------------------ - EventHolder::EventHolder() - { - DBG_CTOR( EventHolder, NULL ); - } - - //------------------------------------------------------------------------ - EventHolder::~EventHolder() - { - m_aEventNameAccess.clear(); - m_aEventIndexAccess.clear(); - DBG_DTOR( EventHolder, NULL ); - } - - //------------------------------------------------------------------------ - void EventHolder::addEvent( EventId _nId, const ::rtl::OUString& _rEventName, const ScriptEventDescriptor& _rScriptEvent ) - { - ::std::pair< EventMap::iterator, bool > insertionResult = - m_aEventNameAccess.insert( EventMap::value_type( _rEventName, _rScriptEvent ) ); - OSL_ENSURE( insertionResult.second, "EventHolder::addEvent: there already was a MacroURL for this event!" ); - m_aEventIndexAccess[ _nId ] = insertionResult.first; - } - - //------------------------------------------------------------------------ - ScriptEventDescriptor EventHolder::getNormalizedDescriptorByName( const ::rtl::OUString& _rEventName ) const - { - return impl_getDescriptor_throw( _rEventName ); - } - - //------------------------------------------------------------------------ - ScriptEventDescriptor EventHolder::impl_getDescriptor_throw( const ::rtl::OUString& _rEventName ) const - { - EventMap::const_iterator pos = m_aEventNameAccess.find( _rEventName ); - if ( pos == m_aEventNameAccess.end() ) - throw NoSuchElementException( ::rtl::OUString(), *const_cast< EventHolder* >( this ) ); - return pos->second; - } - - //------------------------------------------------------------------------ - void SAL_CALL EventHolder::replaceByName( const ::rtl::OUString& _rName, const Any& _rElement ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) - { - EventMap::iterator pos = m_aEventNameAccess.find( _rName ); - if ( pos == m_aEventNameAccess.end() ) - throw NoSuchElementException( ::rtl::OUString(), *this ); - - Sequence< PropertyValue > aScriptDescriptor; - OSL_VERIFY( _rElement >>= aScriptDescriptor ); - - ::comphelper::NamedValueCollection aExtractor( aScriptDescriptor ); - - pos->second.ScriptType = aExtractor.getOrDefault( "EventType", ::rtl::OUString() ); - pos->second.ScriptCode = aExtractor.getOrDefault( "Script", ::rtl::OUString() ); - } - - //------------------------------------------------------------------------ - Any SAL_CALL EventHolder::getByName( const ::rtl::OUString& _rName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) - { - ScriptEventDescriptor aDescriptor( impl_getDescriptor_throw( _rName ) ); - - Any aRet; - Sequence< PropertyValue > aScriptDescriptor( 2 ); - aScriptDescriptor[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EventType")); - aScriptDescriptor[0].Value <<= aDescriptor.ScriptType; - aScriptDescriptor[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Script")); - aScriptDescriptor[1].Value <<= aDescriptor.ScriptCode; - - return makeAny( aScriptDescriptor ); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL EventHolder::getElementNames( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aReturn( m_aEventIndexAccess.size() ); - ::rtl::OUString* pReturn = aReturn.getArray(); - - // SvxMacroAssignDlg has a weird API: It expects a XNameReplace, means a container whose - // main access method is by name. In it's UI, it shows the possible events in exactly the - // order in which XNameAccess::getElementNames returns them. - // However, SvxMacroAssignDlg *also* takes an index for the initial selection, which is - // relative to the sequence returned by XNameAccess::getElementNames. - // This is IMO weird, since it mixes index access with name access, which decreases efficiency - // of the implementation. - // Well, it means we're forced to return the events in getElementNames in exactly the same as they - // appear in the property browser UI. - for ( EventMapIndexAccess::const_iterator loop = m_aEventIndexAccess.begin(); - loop != m_aEventIndexAccess.end(); - ++loop, ++pReturn - ) - *pReturn = loop->second->first; - return aReturn; - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL EventHolder::hasByName( const ::rtl::OUString& _rName ) throw (RuntimeException) - { - EventMap::const_iterator pos = m_aEventNameAccess.find( _rName ); - return pos != m_aEventNameAccess.end(); - } - - //------------------------------------------------------------------------ - Type SAL_CALL EventHolder::getElementType( ) throw (RuntimeException) - { - return ::getCppuType( static_cast< Sequence< PropertyValue >* >( NULL ) ); - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL EventHolder::hasElements( ) throw (RuntimeException) - { - return !m_aEventNameAccess.empty(); - } - - - //==================================================================== - //= EventHandler - //==================================================================== - DBG_NAME( EventHandler ) - //-------------------------------------------------------------------- - EventHandler::EventHandler( const Reference< XComponentContext >& _rxContext ) - :EventHandler_Base( m_aMutex ) - ,m_aContext( _rxContext ) - ,m_aPropertyListeners( m_aMutex ) - ,m_bEventsMapInitialized( false ) - ,m_bIsDialogElement( false ) - ,m_nGridColumnType( -1 ) - { - DBG_CTOR( EventHandler, NULL ); - } - - //-------------------------------------------------------------------- - EventHandler::~EventHandler() - { - DBG_DTOR( EventHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EventHandler::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL EventHandler::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) - { - StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() ); - return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end(); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupportedServiceNames( ) throw (RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL EventHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EventHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.EventHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL EventHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new EventHandler( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !_rxIntrospectee.is() ) - throw NullPointerException(); - - m_xComponent = Reference< XPropertySet >( _rxIntrospectee, UNO_QUERY_THROW ); - - m_bEventsMapInitialized = false; - EventMap aEmpty; - m_aEvents.swap( aEmpty ); - - m_bIsDialogElement = false; - m_nGridColumnType = -1; - try - { - Reference< XPropertySetInfo > xPSI( m_xComponent->getPropertySetInfo() ); - m_bIsDialogElement = xPSI.is() - && xPSI->hasPropertyByName( PROPERTY_WIDTH ) - && xPSI->hasPropertyByName( PROPERTY_HEIGHT ) - && xPSI->hasPropertyByName( PROPERTY_POSITIONX ) - && xPSI->hasPropertyByName( PROPERTY_POSITIONY ); - - Reference< XChild > xAsChild( _rxIntrospectee, UNO_QUERY ); - if ( xAsChild.is() && !Reference< XForm >( _rxIntrospectee, UNO_QUERY ).is() ) - { - if ( FormComponentType::GRIDCONTROL == classifyComponent( xAsChild->getParent() ) ) - { - m_nGridColumnType = classifyComponent( _rxIntrospectee ); - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL EventHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); - - Sequence< ScriptEventDescriptor > aEvents; - impl_getComponentScriptEvents_nothrow( aEvents ); - - sal_Int32 nEventCount = aEvents.getLength(); - const ScriptEventDescriptor* pEvents = aEvents.getConstArray(); - - ScriptEventDescriptor aPropertyValue; - for ( sal_Int32 event = 0; event < nEventCount; ++event, ++pEvents ) - { - if ( rEvent.sListenerClassName == pEvents->ListenerType - && rEvent.sListenerMethodName == pEvents->EventMethod - ) - { - aPropertyValue = *pEvents; - break; - } - } - - return makeAny( aPropertyValue ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); - - ScriptEventDescriptor aNewScriptEvent; - OSL_VERIFY( _rValue >>= aNewScriptEvent ); - - ScriptEventDescriptor aOldScriptEvent; - OSL_VERIFY( getPropertyValue( _rPropertyName ) >>= aOldScriptEvent ); - if ( aOldScriptEvent == aNewScriptEvent ) - return; - - if ( m_bIsDialogElement ) - impl_setDialogElementScriptEvent_nothrow( aNewScriptEvent ); - else - impl_setFormComponentScriptEvent_nothrow( aNewScriptEvent ); - - Reference< XModifiable > xDoc( m_aContext.getContextValueByAsciiName( "ContextDocument" ), UNO_QUERY ); - if ( xDoc.is() ) - xDoc->setModified( sal_True ); - - PropertyChangeEvent aEvent; - aEvent.Source = m_xComponent; - aEvent.PropertyHandle = rEvent.nId; - aEvent.PropertyName = _rPropertyName; - aEvent.OldValue <<= aOldScriptEvent; - aEvent.NewValue <<= aNewScriptEvent; - m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL EventHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ::rtl::OUString sNewScriptCode; - OSL_VERIFY( _rControlValue >>= sNewScriptCode ); - - Sequence< ScriptEventDescriptor > aAllAssignedEvents; - impl_getComponentScriptEvents_nothrow( aAllAssignedEvents ); - - const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); - ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent( rEvent, aAllAssignedEvents ); - - OSL_ENSURE( !sNewScriptCode.getLength(), "EventHandler::convertToPropertyValue: cannot convert a non-empty display name!" ); - // Usually, there is no possibility for the user to change the content of an event binding directly in the - // input field, this instead is done with the macro assignment dialog. - // The only exception is the user pressing "DEL" while the control has the focus, in this case, we reset the - // control content to an empty string. So this is the only scenario where this method is allowed to be called. - - // Striclty, we would be able to convert the display value to a property value, - // using the "name (location, language)" format we used in convertToControlValue. However, - // there is no need for this code ... - - aAssignedScript.ScriptCode = sNewScriptCode; - return makeAny( aAssignedScript ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL EventHandler::convertToControlValue( const ::rtl::OUString& /*_rPropertyName*/, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ScriptEventDescriptor aScriptEvent; - OSL_VERIFY( _rPropertyValue >>= aScriptEvent ); - - OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, - "EventHandler::convertToControlValue: unexpected ControlValue type class!" ); - (void)_rControlValueType; - - ::rtl::OUString sScript( aScriptEvent.ScriptCode ); - if ( sScript.getLength() ) - { - // format is: "name (location, language)" - try - { - // parse - Reference< XUriReferenceFactory > xUriRefFac = UriReferenceFactory::create( m_aContext.getUNOContext() ); - Reference< XVndSunStarScriptUrlReference > xScriptUri( xUriRefFac->parse( sScript ), UNO_QUERY_THROW ); - - ::rtl::OUStringBuffer aComposeBuffer; - - // name - aComposeBuffer.append( xScriptUri->getName() ); - - // location - const ::rtl::OUString sLocationParamName( RTL_CONSTASCII_USTRINGPARAM( "location" ) ); - const ::rtl::OUString sLocation = xScriptUri->getParameter( sLocationParamName ); - const ::rtl::OUString sLangParamName( RTL_CONSTASCII_USTRINGPARAM( "language" ) ); - const ::rtl::OUString sLanguage = xScriptUri->getParameter( sLangParamName ); - - if ( sLocation.getLength() || sLanguage.getLength() ) - { - aComposeBuffer.appendAscii( " (" ); - - // location - OSL_ENSURE( sLocation.getLength(), "EventHandler::convertToControlValue: unexpected: no location!" ); - if ( sLocation.getLength() ) - { - aComposeBuffer.append( sLocation ); - aComposeBuffer.appendAscii( ", " ); - } - - // language - if ( sLanguage.getLength() ) - { - aComposeBuffer.append( sLanguage ); - } - - aComposeBuffer.append( sal_Unicode( ')' ) ); - } - - sScript = aComposeBuffer.makeStringAndClear(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - return makeAny( sScript ); - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL EventHandler::getPropertyState( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) - { - return PropertyState_DIRECT_VALUE; - } - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rxListener.is() ) - throw NullPointerException(); - m_aPropertyListeners.addListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_aPropertyListeners.removeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL EventHandler::getSupportedProperties() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_bEventsMapInitialized ) - { - const_cast< EventHandler* >( this )->m_bEventsMapInitialized = true; - try - { - Sequence< Type > aListeners; - impl_getCopmonentListenerTypes_nothrow( aListeners ); - sal_Int32 listenerCount = aListeners.getLength(); - - Property aCurrentProperty; - ::rtl::OUString sListenerClassName; - - // loop through all listeners and all methods, and see which we can present at the UI - const Type* pListeners = aListeners.getConstArray(); - for ( sal_Int32 listener = 0; listener < listenerCount; ++listener, ++pListeners ) - { - aCurrentProperty = Property(); - - // the programmatic name of the listener, to be used as "property" name - sListenerClassName = pListeners->getTypeName(); - OSL_ENSURE( sListenerClassName.getLength(), "EventHandler::getSupportedProperties: strange - no listener name ..." ); - if ( !sListenerClassName.getLength() ) - continue; - - // loop through all methods - Sequence< ::rtl::OUString > aMethods( comphelper::getEventMethodsForType( *pListeners ) ); - - const ::rtl::OUString* pMethods = aMethods.getConstArray(); - sal_uInt32 methodCount = aMethods.getLength(); - - for (sal_uInt32 method = 0 ; method < methodCount ; ++method, ++pMethods ) - { - EventDescription aEvent; - if ( !lcl_getEventDescriptionForMethod( *pMethods, aEvent ) ) - continue; - - if ( !impl_filterMethod_nothrow( aEvent ) ) - continue; - - const_cast< EventHandler* >( this )->m_aEvents.insert( EventMap::value_type( - lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) ); - } - } - - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - // sort them by ID - this is the relative ordering in the UI - ::std::map< EventId, Property > aOrderedProperties; - for ( EventMap::const_iterator loop = m_aEvents.begin(); - loop != m_aEvents.end(); - ++loop - ) - { - aOrderedProperties[ loop->second.nId ] = Property( - loop->first, loop->second.nId, - ::getCppuType( static_cast< const ::rtl::OUString* >( NULL ) ), - PropertyAttribute::BOUND ); - } - - StlSyntaxSequence< Property > aReturn( aOrderedProperties.size() ); - ::std::transform( aOrderedProperties.begin(), aOrderedProperties.end(), aReturn.begin(), - ::o3tl::select2nd< ::std::map< EventId, Property >::value_type >() ); - return aReturn; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EventHandler::getSupersededProperties( ) throw (RuntimeException) - { - // none - return Sequence< ::rtl::OUString >( ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL EventHandler::getActuatingProperties( ) throw (RuntimeException) - { - // none - return Sequence< ::rtl::OUString >( ); - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL EventHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - - LineDescriptor aDescriptor; - - aDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::TextField, sal_True ); - Reference< XEventListener > xControlExtender = new PropertyControlExtender( aDescriptor.Control ); - - const EventDescription& rEvent = impl_getEventForName_throw( _rPropertyName ); - aDescriptor.DisplayName = rEvent.sDisplayName; - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( rEvent.sHelpId ); - aDescriptor.PrimaryButtonId = rtl::OStringToOUString(rEvent.sUniqueBrowseId, RTL_TEXTENCODING_UTF8); - aDescriptor.HasPrimaryButton = sal_True; - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Events" ) ); - return aDescriptor; - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL EventHandler::isComposable( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) - { - return sal_False; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL EventHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - const EventDescription& rForEvent = impl_getEventForName_throw( _rPropertyName ); - - Sequence< ScriptEventDescriptor > aAllAssignedEvents; - impl_getComponentScriptEvents_nothrow( aAllAssignedEvents ); - - // SvxMacroAssignDlg-compatible structure holding all event/assignments - ::rtl::Reference< EventHolder > pEventHolder( new EventHolder ); - - for ( EventMap::const_iterator event = m_aEvents.begin(); - event != m_aEvents.end(); - ++event - ) - { - // the script which is assigned to the current event (if any) - ScriptEventDescriptor aAssignedScript = lcl_getAssignedScriptEvent( event->second, aAllAssignedEvents ); - pEventHolder->addEvent( event->second.nId, event->second.sListenerMethodName, aAssignedScript ); - } - - // the inital selection in the dialog - Sequence< ::rtl::OUString > aNames( pEventHolder->getElementNames() ); - const ::rtl::OUString* pChosenEvent = ::std::find( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength(), rForEvent.sListenerMethodName ); - sal_uInt16 nInitialSelection = (sal_uInt16)( pChosenEvent - aNames.getConstArray() ); - - // the dialog - SvxAbstractDialogFactory* pFactory = SvxAbstractDialogFactory::Create(); - if ( !pFactory ) - return InteractiveSelectionResult_Cancelled; - - ::std::auto_ptr< VclAbstractDialog > pDialog( pFactory->CreateSvxMacroAssignDlg( - PropertyHandlerHelper::getDialogParentWindow( m_aContext ), - impl_getContextFrame_nothrow(), - m_bIsDialogElement, - pEventHolder.get(), - nInitialSelection - ) ); - - if ( !pDialog.get() ) - return InteractiveSelectionResult_Cancelled; - - // DF definite problem here - // OK & Cancel seem to be both returning 0 - if ( pDialog->Execute() == RET_CANCEL ) - return InteractiveSelectionResult_Cancelled; - - try - { - for ( EventMap::const_iterator event = m_aEvents.begin(); - event != m_aEvents.end(); - ++event - ) - { - ScriptEventDescriptor aScriptDescriptor( pEventHolder->getNormalizedDescriptorByName( event->second.sListenerMethodName ) ); - - // set the new "property value" - setPropertyValue( - lcl_getEventPropertyName( event->second.sListenerClassName, event->second.sListenerMethodName ), - makeAny( aScriptDescriptor ) - ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return InteractiveSelectionResult_Success; - } - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) - { - OSL_FAIL( "EventHandler::actuatingPropertyChanged: no actuating properties -> no callback (well, this is how it *should* be!)" ); - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XCOMPONENT( EventHandler, EventHandler_Base ) - - //-------------------------------------------------------------------- - void SAL_CALL EventHandler::disposing() - { - EventMap aEmpty; - m_aEvents.swap( aEmpty ); - m_xComponent.clear(); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL EventHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException) - { - return sal_True; - } - - //------------------------------------------------------------------------ - Reference< XFrame > EventHandler::impl_getContextFrame_nothrow() const - { - Reference< XFrame > xContextFrame; - - try - { - Reference< XModel > xContextDocument( m_aContext.getContextValueByAsciiName( "ContextDocument" ), UNO_QUERY_THROW ); - Reference< XController > xController( xContextDocument->getCurrentController(), UNO_SET_THROW ); - xContextFrame.set( xController->getFrame(), UNO_SET_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return xContextFrame; - } - - //-------------------------------------------------------------------- - sal_Int32 EventHandler::impl_getComponentIndexInParent_throw() const - { - Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); - Reference< XIndexAccess > xParentAsIndexAccess( xChild->getParent(), UNO_QUERY_THROW ); - - // get the index of the inspected object within it's parent container - sal_Int32 nElements = xParentAsIndexAccess->getCount(); - for ( sal_Int32 i=0; i xElement( xParentAsIndexAccess->getByIndex( i ), UNO_QUERY_THROW ); - if ( xElement == m_xComponent ) - return i; - } - throw NoSuchElementException(); - } - - //-------------------------------------------------------------------- - void EventHandler::impl_getFormComponentScriptEvents_nothrow( Sequence < ScriptEventDescriptor >& _out_rEvents ) const - { - _out_rEvents = Sequence < ScriptEventDescriptor >(); - try - { - Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); - Reference< XEventAttacherManager > xEventManager( xChild->getParent(), UNO_QUERY_THROW ); - _out_rEvents = xEventManager->getScriptEvents( impl_getComponentIndexInParent_throw() ); - - // the form component script API has unqualified listener names, but for normalization - // purpose, we want fully qualified ones - ScriptEventDescriptor* pEvents = _out_rEvents.getArray(); - ScriptEventDescriptor* pEventsEnd = _out_rEvents.getArray() + _out_rEvents.getLength(); - while ( pEvents != pEventsEnd ) - { - pEvents->ListenerType = lcl_getQualifiedKnownListenerName( *pEvents ); - ++pEvents; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void EventHandler::impl_getCopmonentListenerTypes_nothrow( Sequence< Type >& _out_rTypes ) const - { - _out_rTypes.realloc( 0 ); - try - { - // we use a set to avoid duplicates - TypeBag aListeners; - - Reference< XIntrospection > xIntrospection( m_aContext.createComponent( "com.sun.star.beans.Introspection" ), UNO_QUERY_THROW ); - - // --- model listeners - lcl_addListenerTypesFor_throw( - m_xComponent, xIntrospection, aListeners ); - - // --- "secondary component" (usually: "control" listeners) - { - Reference< XInterface > xSecondaryComponent( impl_getSecondaryComponentForEventInspection_throw() ); - lcl_addListenerTypesFor_throw( xSecondaryComponent, xIntrospection, aListeners ); - ::comphelper::disposeComponent( xSecondaryComponent ); - } - - // now that they're disambiguated, copy these types into our member - _out_rTypes.realloc( aListeners.size() ); - ::std::copy( aListeners.begin(), aListeners.end(), _out_rTypes.getArray() ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void EventHandler::impl_getDialogElementScriptEvents_nothrow( Sequence < ScriptEventDescriptor >& _out_rEvents ) const - { - _out_rEvents = Sequence < ScriptEventDescriptor >(); - try - { - Reference< XScriptEventsSupplier > xEventsSupplier( m_xComponent, UNO_QUERY_THROW ); - Reference< XNameContainer > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); - Sequence< ::rtl::OUString > aEventNames( xEvents->getElementNames() ); - - sal_Int32 nEventCount = aEventNames.getLength(); - _out_rEvents.realloc( nEventCount ); - - const ::rtl::OUString* pNames = aEventNames.getConstArray(); - ScriptEventDescriptor* pDescs = _out_rEvents.getArray(); - - for( sal_Int32 i = 0 ; i < nEventCount ; ++i, ++pNames, ++pDescs ) - OSL_VERIFY( xEvents->getByName( *pNames ) >>= *pDescs ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - Reference< XInterface > EventHandler::impl_getSecondaryComponentForEventInspection_throw( ) const - { - Reference< XInterface > xReturn; - - // if it's a form, create a form controller for the additional events - Reference< XForm > xComponentAsForm( m_xComponent, UNO_QUERY ); - if ( xComponentAsForm.is() ) - { - Reference< XTabControllerModel > xComponentAsTCModel( m_xComponent, UNO_QUERY_THROW ); - Reference< XFormController > xController( - m_aContext.createComponent( "com.sun.star.form.runtime.FormController" ), UNO_QUERY_THROW ); - xController->setModel( xComponentAsTCModel ); - - xReturn = xController; - } - else - { - ::rtl::OUString sControlService; - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_DEFAULTCONTROL ) >>= sControlService ); - - xReturn = m_aContext.createComponent( sControlService ); - } - return xReturn; - } - - //-------------------------------------------------------------------- - const EventDescription& EventHandler::impl_getEventForName_throw( const ::rtl::OUString& _rPropertyName ) const - { - EventMap::const_iterator pos = m_aEvents.find( _rPropertyName ); - if ( pos == m_aEvents.end() ) - throw UnknownPropertyException(); - return pos->second; - } - - //-------------------------------------------------------------------- - namespace - { - static bool lcl_endsWith( const ::rtl::OUString& _rText, const ::rtl::OUString& _rCheck ) - { - sal_Int32 nTextLen = _rText.getLength(); - sal_Int32 nCheckLen = _rCheck.getLength(); - if ( nCheckLen > nTextLen ) - return false; - - return _rText.indexOf( _rCheck ) == ( nTextLen - nCheckLen ); - } - } - //-------------------------------------------------------------------- - void EventHandler::impl_setFormComponentScriptEvent_nothrow( const ScriptEventDescriptor& _rScriptEvent ) - { - try - { - ::rtl::OUString sScriptCode( _rScriptEvent.ScriptCode ); - ::rtl::OUString sScriptType( _rScriptEvent.ScriptType ); - bool bResetScript = ( sScriptCode.getLength() == 0 ); - - sal_Int32 nObjectIndex = impl_getComponentIndexInParent_throw(); - Reference< XChild > xChild( m_xComponent, UNO_QUERY_THROW ); - Reference< XEventAttacherManager > xEventManager( xChild->getParent(), UNO_QUERY_THROW ); - Sequence< ScriptEventDescriptor > aEvents( xEventManager->getScriptEvents( nObjectIndex ) ); - - // is there already a registered script for this event? - ScriptEventDescriptor* pEvent = aEvents.getArray(); - sal_Int32 eventCount = aEvents.getLength(), event = 0; - for ( event = 0; event < eventCount; ++event, ++pEvent ) - { - if ( ( pEvent->EventMethod == _rScriptEvent.EventMethod ) - && ( lcl_endsWith( _rScriptEvent.ListenerType, pEvent->ListenerType ) ) - // (strange enough, the events we get from getScriptEvents are not fully qualified) - ) - { - // yes - if ( !bResetScript ) - { - // set to something non-empty -> overwrite - pEvent->ScriptCode = sScriptCode; - pEvent->ScriptType = sScriptType; - } - else - { - // set to empty -> remove from sequence - ::std::copy( pEvent + 1, aEvents.getArray() + eventCount, pEvent ); - aEvents.realloc( eventCount - 1 ); - --eventCount; - } - break; - } - } - if ( ( event >= eventCount ) && !bResetScript ) - { - // no, did not find it -> append - aEvents.realloc( eventCount + 1 ); - aEvents[ eventCount ] = _rScriptEvent; - } - - xEventManager->revokeScriptEvents( nObjectIndex ); - xEventManager->registerScriptEvents( nObjectIndex, aEvents ); - - PropertyHandlerHelper::setContextDocumentModified( m_aContext ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void EventHandler::impl_setDialogElementScriptEvent_nothrow( const ScriptEventDescriptor& _rScriptEvent ) - { - try - { - ::rtl::OUString sScriptCode( _rScriptEvent.ScriptCode ); - bool bResetScript = ( sScriptCode.getLength() == 0 ); - - Reference< XScriptEventsSupplier > xEventsSupplier( m_xComponent, UNO_QUERY_THROW ); - Reference< XNameContainer > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); - - ::rtl::OUStringBuffer aCompleteName; - aCompleteName.append( _rScriptEvent.ListenerType ); - aCompleteName.appendAscii( "::" ); - aCompleteName.append( _rScriptEvent.EventMethod ); - ::rtl::OUString sCompleteName( aCompleteName.makeStringAndClear() ); - - bool bExists = xEvents->hasByName( sCompleteName ); - - if ( bResetScript ) - { - if ( bExists ) - xEvents->removeByName( sCompleteName ); - } - else - { - Any aNewValue; aNewValue <<= _rScriptEvent; - - if ( bExists ) - xEvents->replaceByName( sCompleteName, aNewValue ); - else - xEvents->insertByName( sCompleteName, aNewValue ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - bool EventHandler::impl_filterMethod_nothrow( const EventDescription& _rEvent ) const - { - // some (control-triggered) events do not make sense for certain grid control columns. However, - // our mechnism to retrieve control-triggered events does not know about this, so we do some - // late filtering here. - switch ( m_nGridColumnType ) - { - case FormComponentType::COMBOBOX: - if ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId ) - return false; - break; - case FormComponentType::LISTBOX: - if ( ( UID_BRWEVT_CHANGED == _rEvent.sUniqueBrowseId ) - || ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.sUniqueBrowseId ) - ) - return false; - break; - } - - return true; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx deleted file mode 100644 index 31fb9a776..000000000 --- a/extensions/source/propctrlr/eventhandler.hxx +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX - -#include "pcrcomponentcontext.hxx" -#include "pcrcommontypes.hxx" -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= EventDescription - //==================================================================== - typedef sal_Int32 EventId; - struct EventDescription - { - public: - ::rtl::OUString sDisplayName; - ::rtl::OUString sListenerClassName; - ::rtl::OUString sListenerMethodName; - ::rtl::OString sHelpId; - ::rtl::OString sUniqueBrowseId; - EventId nId; - - EventDescription() - :nId( 0 ) - { - } - - EventDescription( - EventId _nId, - const sal_Char* _pListenerNamespaceAscii, - const sal_Char* _pListenerClassAsciiName, - const sal_Char* _pListenerMethodAsciiName, - sal_uInt16 _nDisplayNameResId, - const rtl::OString& _sHelpId, - const rtl::OString& _sUniqueBrowseId ); - }; - - typedef ::boost::unordered_map< ::rtl::OUString, EventDescription, ::rtl::OUStringHash > EventMap; - - //==================================================================== - //= EventHandler - //==================================================================== - typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler - , ::com::sun::star::lang::XServiceInfo - > EventHandler_Base; - class EventHandler : public EventHandler_Base - { - private: - mutable ::osl::Mutex m_aMutex; - - /// the context in which the instance was created - ComponentContext m_aContext; - /// the properties of the object we're handling - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xComponent; - /// our XPropertyChangeListener(s) - PropertyChangeListeners m_aPropertyListeners; - /// cache of the events we found at our introspectee - EventMap m_aEvents; - /// has m_aEvents been initialized? - bool m_bEventsMapInitialized; - /// is our introspectee a dialog element? - bool m_bIsDialogElement; - // TODO: move different handling into different derived classes? - /// (FormComponent) type of the grid column being inspected, or -1 if we're not inspecting a grid column - sal_Int16 m_nGridColumnType; - - public: - // XServiceInfo - static versions - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - protected: - EventHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - ~EventHandler(); - - protected: - // XPropertyHandler overridables - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - DECLARE_XCOMPONENT() - virtual void SAL_CALL disposing(); - - // 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); - - private: - /** returns the script events associated with our introspectee - @param _out_rEvents - Takes, upon successfull return, the events currently associated with the introspectee - @precond - Our introspectee is a form component - */ - void impl_getFormComponentScriptEvents_nothrow( - ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _out_rEvents - ) const; - - /** returns the script events associated with our introspectee - @param _out_rEvents - Takes, upon successfull return, the events currently associated with the introspectee - @precond - Our introspectee is a dialog element - */ - void impl_getDialogElementScriptEvents_nothrow( - ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _out_rEvents - ) const; - - /** returns the script events associated with our introspectee - @param _out_rEvents - Takes, the events currently associated with the introspectee - */ - inline void impl_getComponentScriptEvents_nothrow( - ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _out_rEvents - ) const - { - if ( m_bIsDialogElement ) - impl_getDialogElementScriptEvents_nothrow( _out_rEvents ); - else - impl_getFormComponentScriptEvents_nothrow( _out_rEvents ); - } - - /** returns the types of the listeners which can be registered at our introspectee - @param _out_rTypes - Takes, upon successfull return, the types of possible listeners at the introspectee - */ - void impl_getCopmonentListenerTypes_nothrow( - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _out_rTypes - ) const; - - /** returns a secondary component to be used for event inspection - - In the UI, we want to mix events for the control model with events for the control. - Since our introspectee is a model, this method creates a control for it (if possible). - - @return - the secondary component whose events should be mixed with the introspectee's events - The caller takes the ownership of the component (if not ). - - @throws - if an unexpected error occurs during creation of the secondary component. - A component to be returned is not unexpected, but allowed - - @precond - ->m_xComponent is not - */ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - impl_getSecondaryComponentForEventInspection_throw( ) const; - - /** returns the event description for the given (programmatic) property name - @param _rPropertyName - the name whose event description should be looked up - @return - the event description for the property name - @throws ::com::sun::star::beans::UnknownPropertyException - if our introspectee does not have an event with the given logical name (see ->getSupportedProperties) - */ - const EventDescription& - impl_getEventForName_throw( const ::rtl::OUString& _rPropertyName ) const; - - /** returns the index of our component within its parent, if this parent can be - obtained (XChild::getParent) and supports an ->XIndexAccess interface - */ - sal_Int32 impl_getComponentIndexInParent_throw() const; - - /** sets a given script event as event handler at a form component - - @param _rScriptEvent - the script event to set - */ - void impl_setFormComponentScriptEvent_nothrow( const ::com::sun::star::script::ScriptEventDescriptor& _rScriptEvent ); - - /** sets a given script event as event handler at a dialog component - - @param _rScriptEvent - the script event to set - */ - void impl_setDialogElementScriptEvent_nothrow( const ::com::sun::star::script::ScriptEventDescriptor& _rScriptEvent ); - - /** returns the frame associated with our context document - */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - impl_getContextFrame_nothrow() const; - - /** approves or denies a certain method to be included in the UI - @return - if and only if the given method is allowed. - */ - bool impl_filterMethod_nothrow( const EventDescription& _rEvent ) const; - - private: - EventHandler(); // never implemented - EventHandler( const EventHandler& ); // never implemented - EventHandler& operator=( const EventHandler& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_EVENTHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx deleted file mode 100644 index 6f005f583..000000000 --- a/extensions/source/propctrlr/fontdialog.cxx +++ /dev/null @@ -1,608 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include "fontdialog.hxx" -#include "formresid.hrc" -#include "modulepcr.hxx" -#include "formlocalid.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "formstrings.hxx" -#include "fontitemids.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - - //======================================================================== - //= OFontPropertyExtractor - //======================================================================== - class OFontPropertyExtractor - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xPropValueAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > - m_xPropStateAccess; - - public: - OFontPropertyExtractor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& - _rxProps ); - - public: - sal_Bool getCheckFontProperty(const ::rtl::OUString& _rPropName, ::com::sun::star::uno::Any& _rValue); - ::rtl::OUString getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault); - sal_Int16 getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault); - sal_Int32 getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault); - float getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault); - - void invalidateItem( - const ::rtl::OUString& _rPropName, - sal_uInt16 _nItemId, - SfxItemSet& _rSet, - sal_Bool _bForceInvalidation = sal_False); - }; - - //------------------------------------------------------------------------ - OFontPropertyExtractor::OFontPropertyExtractor(const Reference< XPropertySet >& _rxProps) - :m_xPropValueAccess(_rxProps) - ,m_xPropStateAccess(_rxProps, UNO_QUERY) - { - OSL_ENSURE(m_xPropValueAccess.is(), "OFontPropertyExtractor::OFontPropertyExtractor: invalid property set!"); - } - - //------------------------------------------------------------------------ - sal_Bool OFontPropertyExtractor::getCheckFontProperty(const ::rtl::OUString& _rPropName, Any& _rValue) - { - _rValue = m_xPropValueAccess->getPropertyValue(_rPropName); - if (m_xPropStateAccess.is()) - return PropertyState_DEFAULT_VALUE == m_xPropStateAccess->getPropertyState(_rPropName); - - return sal_False; - } - - //------------------------------------------------------------------------ - ::rtl::OUString OFontPropertyExtractor::getStringFontProperty(const ::rtl::OUString& _rPropName, const ::rtl::OUString& _rDefault) - { - Any aValue; - if (getCheckFontProperty(_rPropName, aValue)) - return _rDefault; - - return ::comphelper::getString(aValue); - } - - //------------------------------------------------------------------------ - sal_Int16 OFontPropertyExtractor::getInt16FontProperty(const ::rtl::OUString& _rPropName, const sal_Int16 _nDefault) - { - Any aValue; - if (getCheckFontProperty(_rPropName, aValue)) - return _nDefault; - - sal_Int32 nValue(_nDefault); - ::cppu::enum2int(nValue, aValue); - return (sal_Int16)nValue; - } - - //------------------------------------------------------------------------ - sal_Int32 OFontPropertyExtractor::getInt32FontProperty(const ::rtl::OUString& _rPropName, const sal_Int32 _nDefault) - { - Any aValue; - if (getCheckFontProperty(_rPropName, aValue)) - return _nDefault; - - sal_Int32 nValue(_nDefault); - ::cppu::enum2int(nValue, aValue); - return nValue; - } - - //------------------------------------------------------------------------ - float OFontPropertyExtractor::getFloatFontProperty(const ::rtl::OUString& _rPropName, const float _nDefault) - { - Any aValue; - if (getCheckFontProperty(_rPropName, aValue)) - return _nDefault; - - return ::comphelper::getFloat(aValue); - } - - //------------------------------------------------------------------------ - void OFontPropertyExtractor::invalidateItem(const ::rtl::OUString& _rPropName, sal_uInt16 _nItemId, SfxItemSet& _rSet, sal_Bool _bForceInvalidation) - { - if ( _bForceInvalidation - || ( m_xPropStateAccess.is() - && (PropertyState_AMBIGUOUS_VALUE == m_xPropStateAccess->getPropertyState(_rPropName)) - ) - ) - _rSet.InvalidateItem(_nItemId); - } - - //======================================================================== - //= ControlCharacterDialog - //======================================================================== - //------------------------------------------------------------------------ - ControlCharacterDialog::ControlCharacterDialog(Window* _pParent, const SfxItemSet& _rCoreSet) - :SfxTabDialog(_pParent, PcrRes(RID_TABDLG_FONTDIALOG), &_rCoreSet) - { - FreeResource(); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "CreateFactory fail!"); - AddTabPage(TABPAGE_CHARACTERS, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME), 0 ); - AddTabPage(TABPAGE_CHARACTERS_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS), 0 ); - } - - //------------------------------------------------------------------------ - ControlCharacterDialog::~ControlCharacterDialog() - { - } - - //------------------------------------------------------------------------ - void ControlCharacterDialog::translatePropertiesToItems(const Reference< XPropertySet >& _rxModel, SfxItemSet* _pSet) - { - OSL_ENSURE(_pSet && _rxModel.is(), "ControlCharacterDialog::translatePropertiesToItems: invalid arguments!"); - if (!_pSet || !_rxModel.is()) - return; - - try - { - OFontPropertyExtractor aPropExtractor(_rxModel); - - // some items, which may be in default state, have to be filled with non-void information - Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); - ::com::sun::star::awt::FontDescriptor aDefaultFont = VCLUnoHelper::CreateFontDescriptor(aDefaultVCLFont); - - // get the current properties - ::rtl::OUString aFontName = aPropExtractor.getStringFontProperty(PROPERTY_FONT_NAME, aDefaultFont.Name); - ::rtl::OUString aFontStyleName = aPropExtractor.getStringFontProperty(PROPERTY_FONT_STYLENAME, aDefaultFont.StyleName); - sal_Int16 nFontFamily = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_FAMILY, aDefaultFont.Family); - sal_Int16 nFontCharset = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_CHARSET, aDefaultFont.CharSet); - float nFontHeight = aPropExtractor.getFloatFontProperty(PROPERTY_FONT_HEIGHT, (float)aDefaultFont.Height); - float nFontWeight = aPropExtractor.getFloatFontProperty(PROPERTY_FONT_WEIGHT, aDefaultFont.Weight); - sal_Int16 nFontSlant = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_SLANT, (sal_Int16)aDefaultFont.Slant); - sal_Int16 nFontUnderline = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_UNDERLINE, aDefaultFont.Underline); - sal_Int16 nFontStrikeout = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_STRIKEOUT, aDefaultFont.Strikeout); - - sal_Int32 nTextLineColor = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTLINECOLOR, COL_AUTO); - sal_Int16 nFontRelief = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_RELIEF, (sal_Int16)aDefaultVCLFont.GetRelief()); - sal_Int16 nFontEmphasisMark = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_EMPHASIS_MARK, aDefaultVCLFont.GetEmphasisMark()); - - Any aValue; - sal_Bool bWordLineMode = aPropExtractor.getCheckFontProperty(PROPERTY_WORDLINEMODE, aValue) ? aDefaultFont.WordLineMode : ::cppu::any2bool(aValue); - sal_Int32 nColor32 = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTCOLOR, 0); - - // build SfxItems with the values - SvxFontItem aFontItem((FontFamily)nFontFamily, aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT); - - nFontHeight = (float)OutputDevice::LogicToLogic(Size(0, (sal_Int32)nFontHeight), MAP_POINT, MAP_TWIP).Height(); - SvxFontHeightItem aSvxFontHeightItem((sal_uInt32)nFontHeight,100,CFID_HEIGHT); - - FontWeight eWeight=VCLUnoHelper::ConvertFontWeight(nFontWeight); - FontItalic eItalic=(FontItalic)nFontSlant; - FontUnderline eUnderline=(FontUnderline)nFontUnderline; - FontStrikeout eStrikeout=(FontStrikeout)nFontStrikeout; - - SvxWeightItem aWeightItem(eWeight,CFID_WEIGHT); - SvxPostureItem aPostureItem(eItalic,CFID_POSTURE); - - SvxCrossedOutItem aCrossedOutItem(eStrikeout,CFID_STRIKEOUT); - SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE); - - SvxUnderlineItem aUnderlineItem(eUnderline,CFID_UNDERLINE); - aUnderlineItem.SetColor(Color(nTextLineColor)); - - SvxColorItem aSvxColorItem(nColor32,CFID_CHARCOLOR); - SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE); - - // the 2 CJK props - SvxCharReliefItem aFontReliefItem((FontRelief)nFontRelief, CFID_RELIEF); - SvxEmphasisMarkItem aEmphasisMarkitem((FontEmphasisMark)nFontEmphasisMark, CFID_EMPHASIS); - - _pSet->Put(aFontItem, CFID_FONT); - _pSet->Put(aSvxFontHeightItem,CFID_HEIGHT); - _pSet->Put(aWeightItem, CFID_WEIGHT); - _pSet->Put(aPostureItem, CFID_POSTURE); - _pSet->Put(aLanguageItem, CFID_LANGUAGE); - _pSet->Put(aUnderlineItem,CFID_UNDERLINE); - _pSet->Put(aCrossedOutItem,CFID_STRIKEOUT); - _pSet->Put(aWordLineModeItem, CFID_WORDLINEMODE); - _pSet->Put(aSvxColorItem, CFID_CHARCOLOR); - _pSet->Put(aFontReliefItem, CFID_RELIEF); - _pSet->Put(aEmphasisMarkitem, CFID_EMPHASIS); - - aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, CFID_FONT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, CFID_HEIGHT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, CFID_WEIGHT, *_pSet, ::com::sun::star::awt::FontWeight::DONTKNOW == nFontWeight); - aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, CFID_POSTURE, *_pSet, ::com::sun::star::awt::FontSlant_DONTKNOW == nFontSlant); - aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, CFID_UNDERLINE, *_pSet, ::com::sun::star::awt::FontUnderline::DONTKNOW == nFontUnderline); - aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, CFID_STRIKEOUT, *_pSet, ::com::sun::star::awt::FontStrikeout::DONTKNOW == nFontStrikeout); - aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, CFID_WORDLINEMODE, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, CFID_CHARCOLOR, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, CFID_RELIEF, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, CFID_EMPHASIS, *_pSet); - } - catch (Exception&) - { - OSL_FAIL("ControlCharacterDialog::translatePropertiesToItems: caught an exception!"); - } - - _pSet->DisableItem(SID_ATTR_CHAR_CJK_FONT); - _pSet->DisableItem(SID_ATTR_CHAR_CJK_FONTHEIGHT); - _pSet->DisableItem(SID_ATTR_CHAR_CJK_LANGUAGE); - _pSet->DisableItem(SID_ATTR_CHAR_CJK_POSTURE); - _pSet->DisableItem(SID_ATTR_CHAR_CJK_WEIGHT); - - _pSet->DisableItem(SID_ATTR_CHAR_CASEMAP); - _pSet->DisableItem(SID_ATTR_CHAR_CONTOUR); - _pSet->DisableItem(SID_ATTR_CHAR_SHADOWED); - - } - - //------------------------------------------------------------------------ - namespace - { - void lcl_pushBackPropertyValue( Sequence< NamedValue >& _out_properties, const ::rtl::OUString& _name, const Any& _value ) - { - _out_properties.realloc( _out_properties.getLength() + 1 ); - _out_properties[ _out_properties.getLength() - 1 ] = NamedValue( _name, _value ); - } - } - - //------------------------------------------------------------------------ - void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, Sequence< NamedValue >& _out_properties ) - { - _out_properties.realloc( 0 ); - - try - { - // -------------------------- - // font name - SfxItemState eState = _rSet.GetItemState(CFID_FONT); - - if ( eState == SFX_ITEM_SET ) - { - const SvxFontItem& rFontItem = - static_cast(_rSet.Get(CFID_FONT)); - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , makeAny(::rtl::OUString(rFontItem.GetFamilyName()))); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, makeAny(::rtl::OUString(rFontItem.GetStyleName()))); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , makeAny((sal_Int16)rFontItem.GetFamily())); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , makeAny((sal_Int16)rFontItem.GetCharSet())); - } - - // -------------------------- - // font height - eState = _rSet.GetItemState(CFID_HEIGHT); - - if ( eState == SFX_ITEM_SET ) - { - const SvxFontHeightItem& rSvxFontHeightItem = - static_cast(_rSet.Get(CFID_HEIGHT)); - - float nHeight = (float)OutputDevice::LogicToLogic(Size(0, rSvxFontHeightItem.GetHeight()), MAP_TWIP, MAP_POINT).Height(); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight)); - - } - - // -------------------------- - // font weight - eState = _rSet.GetItemState(CFID_WEIGHT); - - if ( eState == SFX_ITEM_SET ) - { - const SvxWeightItem& rWeightItem = - static_cast(_rSet.Get(CFID_WEIGHT)); - - float nWeight = VCLUnoHelper::ConvertFontWeight( rWeightItem.GetWeight()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight)); - } - - // -------------------------- - // font slant - eState = _rSet.GetItemState(CFID_POSTURE); - - if ( eState == SFX_ITEM_SET ) - { - const SvxPostureItem& rPostureItem = - static_cast(_rSet.Get(CFID_POSTURE)); - - ::com::sun::star::awt::FontSlant eSlant = (::com::sun::star::awt::FontSlant)rPostureItem.GetPosture(); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny((sal_Int16)eSlant)); - } - - // -------------------------- - // font underline - eState = _rSet.GetItemState(CFID_UNDERLINE); - - if ( eState == SFX_ITEM_SET ) - { - const SvxUnderlineItem& rUnderlineItem = - static_cast(_rSet.Get(CFID_UNDERLINE)); - - sal_Int16 nUnderline = (sal_Int16)rUnderlineItem.GetLineStyle(); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,makeAny(nUnderline)); - - // the text line color is transported in this item, too - sal_Int32 nColor = rUnderlineItem.GetColor().GetColor(); - - Any aUnoColor; - if (COL_AUTO != (sal_uInt32)nColor) - aUnoColor <<= nColor; - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTLINECOLOR, aUnoColor ); - } - - // -------------------------- - // font strikeout - eState = _rSet.GetItemState(CFID_STRIKEOUT); - - if ( eState == SFX_ITEM_SET ) - { - const SvxCrossedOutItem& rCrossedOutItem = - static_cast(_rSet.Get(CFID_STRIKEOUT)); - - sal_Int16 nStrikeout = (sal_Int16)rCrossedOutItem.GetStrikeout(); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,makeAny(nStrikeout)); - } - - - // -------------------------- - // font wordline mode - eState = _rSet.GetItemState(CFID_WORDLINEMODE); - - if ( eState == SFX_ITEM_SET ) - { - const SvxWordLineModeItem& rWordLineModeItem = - static_cast(_rSet.Get(CFID_WORDLINEMODE)); - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, ::cppu::bool2any(rWordLineModeItem.GetValue())); - } - - - // -------------------------- - // text color - eState = _rSet.GetItemState(CFID_CHARCOLOR); - - if ( eState == SFX_ITEM_SET ) - { - const SvxColorItem& rColorItem = - static_cast(_rSet.Get(CFID_CHARCOLOR)); - - sal_Int32 nColor = rColorItem.GetValue().GetColor(); - - Any aUnoColor; - if (COL_AUTO != (sal_uInt32)nColor) - aUnoColor <<= nColor; - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_TEXTCOLOR, aUnoColor ); - } - - // -------------------------- - // font relief - eState = _rSet.GetItemState(CFID_RELIEF); - - if ( eState == SFX_ITEM_SET ) - { - const SvxCharReliefItem& rReliefItem = - static_cast(_rSet.Get(CFID_RELIEF)); - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, makeAny((sal_Int16)rReliefItem.GetValue()) ); - } - - // -------------------------- - // font emphasis mark - eState = _rSet.GetItemState(CFID_EMPHASIS); - - if ( eState == SFX_ITEM_SET ) - { - const SvxEmphasisMarkItem& rEmphMarkItem = - static_cast(_rSet.Get(CFID_EMPHASIS)); - - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, makeAny((sal_Int16)rEmphMarkItem.GetEmphasisMark()) ); - } - } - catch (const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------ - void ControlCharacterDialog::translateItemsToProperties( const SfxItemSet& _rSet, const Reference< XPropertySet >& _rxModel) - { - OSL_ENSURE( _rxModel.is(), "ControlCharacterDialog::translateItemsToProperties: invalid arguments!" ); - if ( !_rxModel.is()) - return; - - Sequence< NamedValue > aPropertyValues; - translateItemsToProperties( _rSet, aPropertyValues ); - try - { - const NamedValue* propertyValue = aPropertyValues.getConstArray(); - const NamedValue* propertyValueEnd = propertyValue + aPropertyValues.getLength(); - for ( ; propertyValue != propertyValueEnd; ++propertyValue ) - _rxModel->setPropertyValue( propertyValue->Name, propertyValue->Value ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------ - SfxItemSet* ControlCharacterDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults) - { - // just to be sure .... - _rpSet = NULL; - _rpPool = NULL; - _rppDefaults = NULL; - - // create and initialize the defaults - _rppDefaults = new SfxPoolItem*[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1]; - - Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); - - SfxPoolItem** pCounter = _rppDefaults; // want to modify this without affecting the out param _rppDefaults - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_LANGUAGE); - *pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), CFID_UNDERLINE); - *pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), CFID_STRIKEOUT); - *pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), CFID_WORDLINEMODE); - *pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), CFID_CHARCOLOR); - *pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), CFID_RELIEF); - *pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), CFID_EMPHASIS); - - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamily(), aDefaultVCLFont.GetName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_CJK_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetHeight(), 100, CFID_CJK_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_CJK_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_CJK_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguage(), CFID_CJK_LANGUAGE); - - *pCounter++ = new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, CFID_CASEMAP); - *pCounter++ = new SvxContourItem(sal_False, CFID_CONTOUR); - *pCounter++ = new SvxShadowedItem(sal_False, CFID_SHADOWED); - - *pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), CFID_FONTLIST); - - // create the pool - static SfxItemInfo const aItemInfos[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1] = - { - { SID_ATTR_CHAR_FONT, 0 }, - { SID_ATTR_CHAR_FONTHEIGHT, 0 }, - { SID_ATTR_CHAR_WEIGHT, 0 }, - { SID_ATTR_CHAR_POSTURE, 0 }, - { SID_ATTR_CHAR_LANGUAGE, 0 }, - { SID_ATTR_CHAR_UNDERLINE, 0 }, - { SID_ATTR_CHAR_STRIKEOUT, 0 }, - { SID_ATTR_CHAR_WORDLINEMODE, 0 }, - { SID_ATTR_CHAR_COLOR, 0 }, - { SID_ATTR_CHAR_RELIEF, 0 }, - { SID_ATTR_CHAR_EMPHASISMARK, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { SID_ATTR_CHAR_FONTLIST, 0 } - }; - - _rpPool = new SfxItemPool(String::CreateFromAscii("PCRControlFontItemPool"), CFID_FIRST_ITEM_ID, CFID_LAST_ITEM_ID, - aItemInfos, _rppDefaults); - _rpPool->FreezeIdRanges(); - - // and, finally, the set - _rpSet = new SfxItemSet(*_rpPool, sal_True); - - return _rpSet; - } - - //------------------------------------------------------------------------- - void ControlCharacterDialog::destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults) - { - // from the pool, get and remember the font list (needs to be deleted) - const SvxFontListItem& rFontListItem = static_cast(_rpPool->GetDefaultItem(CFID_FONTLIST)); - const FontList* pFontList = rFontListItem.GetFontList(); - - // _first_ delete the set (refering the pool) - if (_rpSet) - { - delete _rpSet; - _rpSet = NULL; - } - - // delete the pool - if (_rpPool) - { - _rpPool->ReleaseDefaults(sal_True); - // the "true" means delete the items, too - SfxItemPool::Free(_rpPool); - _rpPool = NULL; - } - - // reset the defaults ptr - _rppDefaults = NULL; - // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults - - delete pFontList; - } - - //------------------------------------------------------------------------ - void ControlCharacterDialog::PageCreated( sal_uInt16 _nId, SfxTabPage& _rPage ) - { - SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - if ( _nId == TABPAGE_CHARACTERS ) { - aSet.Put (SvxFontListItem(static_cast(GetInputSetImpl()->Get(CFID_FONTLIST)))); - aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE)); - _rPage.PageCreated(aSet); - } - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx deleted file mode 100644 index b7d812c4a..000000000 --- a/extensions/source/propctrlr/fontdialog.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_FONTDIALOG_HXX_ -#define _EXTENSIONS_PROPCTRLR_FONTDIALOG_HXX_ - -#include -#include -#include - -class SvxFontListItem; -class FontList; - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= ControlCharacterDialog - //======================================================================== - class ControlCharacterDialog : public SfxTabDialog - { - public: - ControlCharacterDialog(Window* _pParent, const SfxItemSet& _rCoreSet); - ~ControlCharacterDialog(); - - /// creates an item set to be used with this dialog - static SfxItemSet* createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults); - - /// destroys an item previously created with createItemSet - static void destroyItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rpPool, SfxPoolItem**& _rppDefaults); - - /// fills the given item set with values obtained from the given property set - static void translatePropertiesToItems( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel, - SfxItemSet* _pSet); - - /** fills the given property set with values obtained from the given item set - */ - static void translateItemsToProperties( - const SfxItemSet& _rSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel); - - /** fills the given property set with values obtained from the given item set - */ - static void translateItemsToProperties( - const SfxItemSet& _rSet, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_properties ); - - protected: - virtual void PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage); - }; -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_FONTDIALOG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/fontdialog.src b/extensions/source/propctrlr/fontdialog.src deleted file mode 100644 index 7d628e9ef..000000000 --- a/extensions/source/propctrlr/fontdialog.src +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "formresid.hrc" -#endif -#ifndef _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ -#include "formlocalid.hrc" -#endif - -TabDialog RID_TABDLG_FONTDIALOG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Text [ en-US ] = "Character" ; - Moveable = TRUE ; - TabControl 1 - { - OutputSize = TRUE ; - PageList = - { - PageItem - { - Identifier = TABPAGE_CHARACTERS ; - PageResID = TABPAGE_CHARACTERS ; - Text [ en-US ] = "Font" ; - }; - PageItem - { - Identifier = TABPAGE_CHARACTERS_EXT ; - PageResID = TABPAGE_CHARACTERS_EXT ; - Text [ en-US ] = "Font Effects" ; - }; - }; - }; -}; diff --git a/extensions/source/propctrlr/fontitemids.hxx b/extensions/source/propctrlr/fontitemids.hxx deleted file mode 100644 index 2089f93cc..000000000 --- a/extensions/source/propctrlr/fontitemids.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_FONTITEMIDS_HXX_ -#define _EXTENSIONS_PROPCTRLR_FONTITEMIDS_HXX_ - -#define CFID_FONT 1 -#define CFID_HEIGHT 2 -#define CFID_WEIGHT 3 -#define CFID_POSTURE 4 -#define CFID_LANGUAGE 5 -#define CFID_UNDERLINE 6 -#define CFID_STRIKEOUT 7 -#define CFID_WORDLINEMODE 8 -#define CFID_CHARCOLOR 9 -#define CFID_RELIEF 10 -#define CFID_EMPHASIS 11 - -#define CFID_CJK_FONT 12 -#define CFID_CJK_HEIGHT 13 -#define CFID_CJK_WEIGHT 14 -#define CFID_CJK_POSTURE 15 -#define CFID_CJK_LANGUAGE 16 -#define CFID_CASEMAP 17 -#define CFID_CONTOUR 18 -#define CFID_SHADOWED 19 - -#define CFID_FONTLIST 20 - -#define CFID_FIRST_ITEM_ID CFID_FONT -#define CFID_LAST_ITEM_ID CFID_FONTLIST - -//........................................................................ -namespace pcr -{ -//........................................................................ -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_FONTITEMIDS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formbrowsertools.cxx b/extensions/source/propctrlr/formbrowsertools.cxx deleted file mode 100644 index d39e6c1ee..000000000 --- a/extensions/source/propctrlr/formbrowsertools.cxx +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "formbrowsertools.hxx" -#include -#include -#include -#include "formresid.hrc" -#include "modulepcr.hxx" -#include -#include "formstrings.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - - //------------------------------------------------------------------------ - ::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj) - { - PcrClient aResourceAccess; - // this ensures that we have our resource file loaded - - ::rtl::OUString sClassName; - switch (nClassId) - { - case FormComponentType::TEXTFIELD: - { - Reference< XInterface > xIFace; - aUnoObj >>= xIFace; - sClassName = String(PcrRes(RID_STR_PROPTITLE_EDIT)); - if (xIFace.is()) - { // we have a chance to check if it's a formatted field model - Reference< XServiceInfo > xInfo(xIFace, UNO_QUERY); - if (xInfo.is() && (xInfo->supportsService(SERVICE_COMPONENT_FORMATTEDFIELD))) - sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED)); - else if (!xInfo.is()) - { - // couldn't distinguish between formatted and edit with the service name, so try with the properties - Reference< XPropertySet > xProps(xIFace, UNO_QUERY); - if (xProps.is()) - { - Reference< XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo(); - if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(PROPERTY_FORMATSSUPPLIER)) - sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED)); - } - } - } - } - break; - - case FormComponentType::COMMANDBUTTON: - sClassName = String(PcrRes(RID_STR_PROPTITLE_PUSHBUTTON)); break; - case FormComponentType::RADIOBUTTON: - sClassName = String(PcrRes(RID_STR_PROPTITLE_RADIOBUTTON)); break; - case FormComponentType::CHECKBOX: - sClassName = String(PcrRes(RID_STR_PROPTITLE_CHECKBOX)); break; - case FormComponentType::LISTBOX: - sClassName = String(PcrRes(RID_STR_PROPTITLE_LISTBOX)); break; - case FormComponentType::COMBOBOX: - sClassName = String(PcrRes(RID_STR_PROPTITLE_COMBOBOX)); break; - case FormComponentType::GROUPBOX: - sClassName = String(PcrRes(RID_STR_PROPTITLE_GROUPBOX)); break; - case FormComponentType::IMAGEBUTTON: - sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGEBUTTON)); break; - case FormComponentType::FIXEDTEXT: - sClassName = String(PcrRes(RID_STR_PROPTITLE_FIXEDTEXT)); break; - case FormComponentType::GRIDCONTROL: - sClassName = String(PcrRes(RID_STR_PROPTITLE_DBGRID)); break; - case FormComponentType::FILECONTROL: - sClassName = String(PcrRes(RID_STR_PROPTITLE_FILECONTROL)); break; - - case FormComponentType::DATEFIELD: - sClassName = String(PcrRes(RID_STR_PROPTITLE_DATEFIELD)); break; - case FormComponentType::TIMEFIELD: - sClassName = String(PcrRes(RID_STR_PROPTITLE_TIMEFIELD)); break; - case FormComponentType::NUMERICFIELD: - sClassName = String(PcrRes(RID_STR_PROPTITLE_NUMERICFIELD)); break; - case FormComponentType::CURRENCYFIELD: - sClassName = String(PcrRes(RID_STR_PROPTITLE_CURRENCYFIELD)); break; - case FormComponentType::PATTERNFIELD: - sClassName = String(PcrRes(RID_STR_PROPTITLE_PATTERNFIELD)); break; - case FormComponentType::IMAGECONTROL: - sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGECONTROL)); break; - case FormComponentType::HIDDENCONTROL: - sClassName = String(PcrRes(RID_STR_PROPTITLE_HIDDENCONTROL)); break; - - case FormComponentType::CONTROL: - default: - sClassName = String(PcrRes(RID_STR_PROPTITLE_UNKNOWNCONTROL)); break; - } - - return sClassName; - } - - //------------------------------------------------------------------------ - sal_Int16 classifyComponent( const Reference< XInterface >& _rxComponent ) - { - Reference< XPropertySet > xComponentProps( _rxComponent, UNO_QUERY_THROW ); - Reference< XPropertySetInfo > xPSI( xComponentProps->getPropertySetInfo(), UNO_SET_THROW ); - - sal_Int16 nControlType( FormComponentType::CONTROL ); - if ( xPSI->hasPropertyByName( PROPERTY_CLASSID ) ) - { - OSL_VERIFY( xComponentProps->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType ); - } - return nControlType; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formbrowsertools.hxx b/extensions/source/propctrlr/formbrowsertools.hxx deleted file mode 100644 index ec6d329e5..000000000 --- a/extensions/source/propctrlr/formbrowsertools.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_ -#define _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_ - -#include -#include -#include - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - ::rtl::OUString GetUIHeadlineName(sal_Int16 _nClassId, const ::com::sun::star::uno::Any& _rUnoObject); - sal_Int16 classifyComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); - - //======================================================================== - struct FindPropertyByHandle : public ::std::unary_function< ::com::sun::star::beans::Property, bool > - { - private: - sal_Int32 m_nId; - - public: - FindPropertyByHandle( sal_Int32 _nId ) : m_nId ( _nId ) { } - bool operator()( const ::com::sun::star::beans::Property& _rProp ) const - { - return m_nId == _rProp.Handle; - } - }; - - //======================================================================== - struct FindPropertyByName : public ::std::unary_function< ::com::sun::star::beans::Property, bool > - { - private: - ::rtl::OUString m_sName; - - public: - FindPropertyByName( const ::rtl::OUString& _rName ) : m_sName( _rName ) { } - bool operator()( const ::com::sun::star::beans::Property& _rProp ) const - { - return m_sName == _rProp.Name; - } - }; - - //======================================================================== - struct PropertyLessByName - :public ::std::binary_function < ::com::sun::star::beans::Property, - ::com::sun::star::beans::Property, - bool - > - { - bool operator() (::com::sun::star::beans::Property _rLhs, ::com::sun::star::beans::Property _rRhs) const - { - return _rLhs.Name < _rRhs.Name ? true : false; - } - }; - - //======================================================================== - struct TypeLessByName - :public ::std::binary_function < ::com::sun::star::uno::Type, - ::com::sun::star::uno::Type, - bool - > - { - bool operator() (::com::sun::star::uno::Type _rLhs, ::com::sun::star::uno::Type _rRhs) const - { - return _rLhs.getTypeName() < _rRhs.getTypeName() ? true : false; - } - }; - - //======================================================================== - typedef ::std::set< ::com::sun::star::beans::Property, PropertyLessByName > PropertyBag; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx deleted file mode 100644 index 48d0bbef3..000000000 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ /dev/null @@ -1,3343 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "controltype.hxx" -#include "propctrlr.hrc" -#include "extensio.hrc" -#include "fontdialog.hxx" -#include "formcomponenthandler.hxx" -#include "formlinkdialog.hxx" -#include "formmetadata.hxx" -#include "formresid.hrc" -#include "formstrings.hxx" -#include "handlerhelper.hxx" -#include "listselectiondlg.hxx" -#include "pcrcommon.hxx" -#include "selectlabeldialog.hxx" -#include "taborder.hxx" -#include "usercontrol.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler() -{ - ::pcr::FormComponentPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star; - using namespace uno; - using namespace lang; - using namespace beans; - using namespace frame; - using namespace script; - using namespace form; - using namespace util; - using namespace awt; - using namespace sdb; - using namespace sdbc; - using namespace sdbcx; - using namespace form; - using namespace container; - using namespace ui::dialogs; - using namespace inspection; - using namespace ::dbtools; - - namespace WritingMode2 = ::com::sun::star::text::WritingMode2; - - //==================================================================== - //= FormComponentPropertyHandler - //==================================================================== - DBG_NAME( FormComponentPropertyHandler ) -#define PROPERTY_ID_ROWSET 1 - //-------------------------------------------------------------------- - FormComponentPropertyHandler::FormComponentPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :FormComponentPropertyHandler_Base( _rxContext ) - ,::comphelper::OPropertyContainer(FormComponentPropertyHandler_Base::rBHelper) - ,m_sDefaultValueString( String( PcrRes( RID_STR_STANDARD ) ) ) - ,m_eComponentClass( eUnknown ) - ,m_bComponentIsSubForm( false ) - ,m_bHaveListSource( false ) - ,m_bHaveCommand( false ) - ,m_nClassId( 0 ) - { - DBG_CTOR( FormComponentPropertyHandler, NULL ); - registerProperty(PROPERTY_ROWSET,PROPERTY_ID_ROWSET,0,&m_xRowSet,::getCppuType(&m_xRowSet)); - } - - //-------------------------------------------------------------------- - FormComponentPropertyHandler::~FormComponentPropertyHandler() - { - DBG_DTOR( FormComponentPropertyHandler, NULL ); - } - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2(FormComponentPropertyHandler,FormComponentPropertyHandler_Base,::comphelper::OPropertyContainer) - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL FormComponentPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.FormComponentPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.FormComponentPropertyHandler" ) ); - return aSupported; - } - - //============================================ - // TODO: -> export from toolkit - struct LanguageDependentProp - { - const char* pPropName; - sal_Int32 nPropNameLength; - }; - - static LanguageDependentProp aLanguageDependentProp[] = - { - { "Text", 4 }, - { "Label", 5 }, - { "Title", 5 }, - { "HelpText", 8 }, - { "CurrencySymbol", 14 }, - { "StringItemList", 14 }, - { 0, 0 } - }; - - namespace - { - bool lcl_isLanguageDependentProperty( ::rtl::OUString aName ) - { - bool bRet = false; - - LanguageDependentProp* pLangDepProp = aLanguageDependentProp; - while( pLangDepProp->pPropName != 0 ) - { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) - { - bRet = true; - break; - } - pLangDepProp++; - } - return bRet; - } - - Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty - ( Reference< XPropertySet > _xComponent, const ::rtl::OUString& _rPropertyName, - const Any& _rPropertyValue ) - { - Reference< resource::XStringResourceResolver > xRet; - const TypeClass eType = _rPropertyValue.getValueType().getTypeClass(); - if ( (eType == TypeClass_STRING || eType == TypeClass_SEQUENCE) && - lcl_isLanguageDependentProperty( _rPropertyName ) ) - { - static const ::rtl::OUString s_sResourceResolverPropName(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver")); - - Reference< resource::XStringResourceResolver > xStringResourceResolver; - try - { - xStringResourceResolver.set( _xComponent->getPropertyValue( s_sResourceResolverPropName ),UNO_QUERY); - if( xStringResourceResolver.is() && - xStringResourceResolver->getLocales().getLength() > 0 ) - { - xRet = xStringResourceResolver; - } - } - catch(UnknownPropertyException&) - { - // nii - } - } - - return xRet; - } - } - - //-------------------------------------------------------------------- - Any FormComponentPropertyHandler::impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ) const - { - const PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) ); - - Reference< resource::XStringResourceResolver > xStringResourceResolver - = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, aPropertyValue ); - if( xStringResourceResolver.is() ) - { - TypeClass eType = aPropertyValue.getValueType().getTypeClass(); - if( eType == TypeClass_STRING ) - { - ::rtl::OUString aPropStr; - aPropertyValue >>= aPropStr; - if( aPropStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aPropStr.copy( 1 ); - if( xStringResourceResolver->hasEntryForId( aPureIdStr ) ) - { - ::rtl::OUString aResourceStr = xStringResourceResolver->resolveString( aPureIdStr ); - aPropertyValue <<= aResourceStr; - } - } - } - // StringItemList? - else if( eType == TypeClass_SEQUENCE ) - { - Sequence< ::rtl::OUString > aStrings; - aPropertyValue >>= aStrings; - - const ::rtl::OUString* pStrings = aStrings.getConstArray(); - sal_Int32 nCount = aStrings.getLength(); - - Sequence< ::rtl::OUString > aResolvedStrings; - aResolvedStrings.realloc( nCount ); - ::rtl::OUString* pResolvedStrings = aResolvedStrings.getArray(); - try - { - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - ::rtl::OUString aIdStr = pStrings[i]; - ::rtl::OUString aPureIdStr = aIdStr.copy( 1 ); - if( xStringResourceResolver->hasEntryForId( aPureIdStr ) ) - pResolvedStrings[i] = xStringResourceResolver->resolveString( aPureIdStr ); - else - pResolvedStrings[i] = aIdStr; - } - } - catch( resource::MissingResourceException & ) - {} - aPropertyValue <<= aResolvedStrings; - } - } - else - impl_normalizePropertyValue_nothrow( aPropertyValue, nPropId ); - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL FormComponentPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - if( _rPropertyName == PROPERTY_ROWSET ) - return ::comphelper::OPropertyContainer::getPropertyValue( _rPropertyName ); - - ::osl::MutexGuard aGuard( m_aMutex ); - return impl_getPropertyValue_throw( _rPropertyName ); - } - - //-------------------------------------------------------------------- - void SAL_CALL FormComponentPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - if( _rPropertyName == PROPERTY_ROWSET ) - { - ::comphelper::OPropertyContainer::setPropertyValue( _rPropertyName, _rValue ); - return; - } - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler - - Reference< graphic::XGraphicObject > xGrfObj; - if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) - { - DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); - rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) ); - sObjectID = sObjectID + xGrfObj->getUniqueID(); - m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) ); - } - else if ( PROPERTY_ID_FONT == nPropId ) - { - // special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow - Sequence< NamedValue > aFontPropertyValues; - OSL_VERIFY( _rValue >>= aFontPropertyValues ); - const NamedValue* fontPropertyValue = aFontPropertyValues.getConstArray(); - const NamedValue* fontPropertyValueEnd = fontPropertyValue + aFontPropertyValues.getLength(); - for ( ; fontPropertyValue != fontPropertyValueEnd; ++fontPropertyValue ) - m_xComponent->setPropertyValue( fontPropertyValue->Name, fontPropertyValue->Value ); - } - else - { - Any aValue = _rValue; - - Reference< resource::XStringResourceResolver > xStringResourceResolver - = lcl_getStringResourceResolverForProperty( m_xComponent, _rPropertyName, _rValue ); - if( xStringResourceResolver.is() ) - { - Reference< resource::XStringResourceManager > - xStringResourceManager( xStringResourceResolver, UNO_QUERY ); - if( xStringResourceManager.is() ) - { - Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) ); - TypeClass eType = aPropertyValue.getValueType().getTypeClass(); - if( eType == TypeClass_STRING ) - { - ::rtl::OUString aPropStr; - aPropertyValue >>= aPropStr; - if( aPropStr.getLength() > 1 ) - { - ::rtl::OUString aPureIdStr = aPropStr.copy( 1 ); - ::rtl::OUString aValueStr; - _rValue >>= aValueStr; - xStringResourceManager->setString( aPureIdStr, aValueStr ); - aValue = aPropertyValue; // set value to force modified - } - } - // StringItemList? - else if( eType == TypeClass_SEQUENCE ) - { - static ::rtl::OUString aDot(RTL_CONSTASCII_USTRINGPARAM(".")); - static ::rtl::OUString aEsc(RTL_CONSTASCII_USTRINGPARAM("&")); - - // Put strings into resource using new ids - Sequence< ::rtl::OUString > aNewStrings; - _rValue >>= aNewStrings; - - const ::rtl::OUString* pNewStrings = aNewStrings.getConstArray(); - sal_Int32 nNewCount = aNewStrings.getLength(); - - // Create new Ids - ::rtl::OUString* pNewPureIds = new ::rtl::OUString[nNewCount]; - ::rtl::OUString aIdStrBase = aDot; - Any aNameAny = m_xComponent->getPropertyValue(PROPERTY_NAME); - ::rtl::OUString sControlName; - aNameAny >>= sControlName; - aIdStrBase += sControlName; - aIdStrBase += aDot; - aIdStrBase += _rPropertyName; - sal_Int32 i; - ::rtl::OUString aDummyStr; - for ( i = 0; i < nNewCount; ++i ) - { - sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId(); - ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId ); - aPureIdStr += aIdStrBase; - pNewPureIds[i] = aPureIdStr; - // Force usage of next Unique Id - xStringResourceManager->setString( aPureIdStr, aDummyStr ); - } - - // Move strings to new Ids for all locales - Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 nLocaleCount = aLocaleSeq.getLength(); - Sequence< ::rtl::OUString > aOldIdStrings; - aPropertyValue >>= aOldIdStrings; - try - { - const ::rtl::OUString* pOldIdStrings = aOldIdStrings.getConstArray(); - sal_Int32 nOldIdCount = aOldIdStrings.getLength(); - for ( i = 0; i < nNewCount; ++i ) - { - ::rtl::OUString aOldIdStr; - ::rtl::OUString aOldPureIdStr; - if( i < nOldIdCount ) - { - aOldIdStr = pOldIdStrings[i]; - aOldPureIdStr = aOldIdStr.copy( 1 ); - } - ::rtl::OUString aNewPureIdStr = pNewPureIds[i]; - - for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale ) - { - Locale aLocale = pLocale[iLocale]; - - ::rtl::OUString aResourceStr; - if( aOldPureIdStr.getLength() != 0 ) - { - if( xStringResourceManager->hasEntryForIdAndLocale( aOldPureIdStr, aLocale ) ) - { - aResourceStr = xStringResourceManager-> - resolveStringForLocale( aOldPureIdStr, aLocale ); - } - } - xStringResourceManager->setStringForLocale( aNewPureIdStr, aResourceStr, aLocale ); - } - } - } - catch( resource::MissingResourceException & ) - {} - - - // Set new strings for current locale and create - // new Id sequence as new property value - Sequence< ::rtl::OUString > aNewIdStrings; - aNewIdStrings.realloc( nNewCount ); - ::rtl::OUString* pNewIdStrings = aNewIdStrings.getArray(); - for ( i = 0; i < nNewCount; ++i ) - { - ::rtl::OUString aPureIdStr = pNewPureIds[i]; - ::rtl::OUString aStr = pNewStrings[i]; - xStringResourceManager->setString( aPureIdStr, aStr ); - - ::rtl::OUString aIdStr = aEsc; - aIdStr += aPureIdStr; - pNewIdStrings[i] = aIdStr; - } - aValue <<= aNewIdStrings; - - // Remove old ids from resource for all locales - const ::rtl::OUString* pOldIdStrings = aOldIdStrings.getConstArray(); - sal_Int32 nOldIdCount = aOldIdStrings.getLength(); - for( i = 0 ; i < nOldIdCount ; ++i ) - { - ::rtl::OUString aIdStr = pOldIdStrings[i]; - ::rtl::OUString aPureIdStr = aIdStr.copy( 1 ); - for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale ) - { - Locale aLocale = pLocale[iLocale]; - try - { - xStringResourceManager->removeIdForLocale( aPureIdStr, aLocale ); - } - catch( resource::MissingResourceException & ) - {} - } - } - delete[] pNewPureIds; - } - } - } - - m_xComponent->setPropertyValue( _rPropertyName, aValue ); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL FormComponentPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - Property aProperty( impl_getPropertyFromId_throw( nPropId ) ); - - Any aPropertyValue( _rControlValue ); - if ( !aPropertyValue.hasValue() ) - { - if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) == 0 ) - // default construct an instance of the proper type - aPropertyValue = Any( NULL, aProperty.Type ); - // nothing to do - return aPropertyValue; - } - - /// care for the special "default" string, translate it to VOID - if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() ) - { - // it's a control with a string list - ::rtl::OUString sStringValue; - if ( _rControlValue >>= sStringValue ) - { // note that ColorListBoxes might transfer values either as string or as css.util.Color, - // so this check here is important - if ( sStringValue == m_sDefaultValueString ) - return Any(); - } - } - - switch ( nPropId ) - { - case PROPERTY_ID_DATASOURCE: - { - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - - if ( sControlValue.getLength() ) - { - Reference< XNameAccess > xDatabaseContext; - m_aContext.createComponent( (::rtl::OUString)SERVICE_DATABASE_CONTEXT, xDatabaseContext ); - if ( !xDatabaseContext.is() || !xDatabaseContext->hasByName( sControlValue ) ) - { - ::svt::OFileNotation aTransformer(sControlValue); - aPropertyValue <<= ::rtl::OUString( aTransformer.get( ::svt::OFileNotation::N_URL ) ); - } - } - } - break; // case PROPERTY_ID_DATASOURCE - - case PROPERTY_ID_SHOW_POSITION: - case PROPERTY_ID_SHOW_NAVIGATION: - case PROPERTY_ID_SHOW_RECORDACTIONS: - case PROPERTY_ID_SHOW_FILTERSORT: - { - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries ); - OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!" ); - sal_Bool bShow = ( aListEntries.size() < 2 ) || ( sControlValue == aListEntries[1] ); - - aPropertyValue <<= bShow; - } - break; - - case PROPERTY_ID_TARGET_URL: - case PROPERTY_ID_IMAGE_URL: - { - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - // Don't convert a placeholder - if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ) - aPropertyValue <<= sControlValue; - else - { - INetURLObject aDocURL( impl_getDocumentURL_nothrow() ); - aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI ); - } - } - break; - - case PROPERTY_ID_DATEMIN: - case PROPERTY_ID_DATEMAX: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DATE: - { - util::Date aDate; - OSL_VERIFY( _rControlValue >>= aDate ); - aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aDate ); - } - break; - - case PROPERTY_ID_TIMEMIN: - case PROPERTY_ID_TIMEMAX: - case PROPERTY_ID_DEFAULT_TIME: - case PROPERTY_ID_TIME: - { - util::Time aTime; - OSL_VERIFY( _rControlValue >>= aTime ); - aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aTime ); - } - break; - - case PROPERTY_ID_WRITING_MODE: - { - aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); - - sal_Int16 nNormalizedValue( 2 ); - OSL_VERIFY( aPropertyValue >>= nNormalizedValue ); - sal_Int16 nWritingMode = WritingMode2::CONTEXT; - switch ( nNormalizedValue ) - { - case 0: nWritingMode = WritingMode2::LR_TB; break; - case 1: nWritingMode = WritingMode2::RL_TB; break; - case 2: nWritingMode = WritingMode2::CONTEXT; break; - default: - OSL_FAIL( "FormComponentPropertyHandler::convertToPropertyValue: unexpected 'normalized value' for WritingMode!" ); - nWritingMode = WritingMode2::CONTEXT; - break; - } - - aPropertyValue <<= nWritingMode; - } - break; - - default: - aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); - break; // default - - } // switch ( nPropId ) - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL FormComponentPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int32 nPropId = m_pInfoService->getPropertyId( _rPropertyName ); - DBG_ASSERT( nPropId != -1, "FormComponentPropertyHandler::convertToPropertyValue: not one of my properties!!" ); - - Property aProperty( impl_getPropertyFromId_throw( nPropId ) ); - - Any aControlValue( _rPropertyValue ); - if ( !aControlValue.hasValue() ) - { - // if the property is represented with a list box or color list box, we need to - // translate this into the string "Default" - if ( m_aPropertiesWithDefListEntry.find( _rPropertyName ) != m_aPropertiesWithDefListEntry.end() ) - aControlValue <<= m_sDefaultValueString; - - return aControlValue; - } - - switch ( nPropId ) - { - ////////////////////////////////////////////////////////////// - case PROPERTY_ID_SHOW_POSITION: - case PROPERTY_ID_SHOW_NAVIGATION: - case PROPERTY_ID_SHOW_RECORDACTIONS: - case PROPERTY_ID_SHOW_FILTERSORT: - { - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries ); - OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToControlValue: broken resource for Show/Hide!" ); - - if ( aListEntries.size() == 2 ) - { - ::rtl::OUString sControlValue = ::comphelper::getBOOL( _rPropertyValue ) - ? aListEntries[1] - : aListEntries[0]; - aControlValue <<= sControlValue; - } - } - break; - - ////////////////////////////////////////////////////////////// - case PROPERTY_ID_DATASOURCE: - { - OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, - "FormComponentPropertyHandler::convertToControlValue: wrong ControlValueType!" ); - - ::rtl::OUString sDataSource; - _rPropertyValue >>= sDataSource; - if ( sDataSource.getLength() ) - { - ::svt::OFileNotation aTransformer( sDataSource ); - sDataSource = aTransformer.get( ::svt::OFileNotation::N_SYSTEM ); - } - aControlValue <<= sDataSource; - } - break; - - ////////////////////////////////////////////////////////////// - case PROPERTY_ID_CONTROLLABEL: - { - ::rtl::OUString sControlValue; - - Reference< XPropertySet > xSet; - _rPropertyValue >>= xSet; - Reference< XPropertySetInfo > xPSI; - if ( xSet.is() ) - xPSI = xSet->getPropertySetInfo(); - if ( xPSI.is() && xPSI->hasPropertyByName( PROPERTY_LABEL ) ) - { - ::rtl::OUStringBuffer aValue; - aValue.append( (sal_Unicode)'<' ); - ::rtl::OUString sLabel; - OSL_VERIFY( xSet->getPropertyValue( PROPERTY_LABEL ) >>= sLabel ); - aValue.append( sLabel ); - aValue.append( (sal_Unicode)'>' ); - sControlValue = aValue.makeStringAndClear(); - } - - aControlValue <<= sControlValue; - } - break; - - ////////////////////////////////////////////////////////////// - case PROPERTY_ID_DATEMIN: - case PROPERTY_ID_DATEMAX: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DATE: - { - sal_Int32 nDate = 0; - OSL_VERIFY( _rPropertyValue >>= nDate ); - aControlValue <<= DBTypeConversion::toDate( nDate ); - } - break; - - case PROPERTY_ID_TIMEMIN: - case PROPERTY_ID_TIMEMAX: - case PROPERTY_ID_DEFAULT_TIME: - case PROPERTY_ID_TIME: - { - sal_Int32 nTime = 0; - OSL_VERIFY( _rPropertyValue >>= nTime ); - aControlValue <<= DBTypeConversion::toTime( nTime ); - } - break; - - case PROPERTY_ID_WRITING_MODE: - { - sal_Int16 nWritingMode( WritingMode2::CONTEXT ); - OSL_VERIFY( _rPropertyValue >>= nWritingMode ); - sal_Int16 nNormalized = 2; - switch ( nWritingMode ) - { - case WritingMode2::LR_TB: nNormalized = 0; break; - case WritingMode2::RL_TB: nNormalized = 1; break; - case WritingMode2::CONTEXT: nNormalized = 2; break; - default: - OSL_FAIL( "FormComponentPropertyHandler::convertToControlValue: unsupported API value for WritingMode!" ); - nNormalized = 2; - break; - } - - aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); - } - break; - - case PROPERTY_ID_FONT: - { - FontDescriptor aFont; - OSL_VERIFY( _rPropertyValue >>= aFont ); - - ::rtl::OUStringBuffer displayName; - if ( !aFont.Name.getLength() ) - { - displayName.append( String( PcrRes( RID_STR_FONT_DEFAULT ) ) ); - } - else - { - // font name - displayName.append( aFont.Name ); - displayName.appendAscii( ", " ); - - // font style - ::FontWeight eWeight = VCLUnoHelper::ConvertFontWeight( aFont.Weight ); - sal_uInt16 nStyleResID = RID_STR_FONTSTYLE_REGULAR; - if ( aFont.Slant == FontSlant_ITALIC ) - { - if ( eWeight > WEIGHT_NORMAL ) - nStyleResID = RID_STR_FONTSTYLE_BOLD_ITALIC; - else - nStyleResID = RID_STR_FONTSTYLE_ITALIC; - } - else - { - if ( eWeight > WEIGHT_NORMAL ) - nStyleResID = RID_STR_FONTSTYLE_BOLD; - } - displayName.append( String( PcrRes( nStyleResID ) ) ); - - // font size - if ( aFont.Height ) - { - displayName.appendAscii( ", " ); - displayName.append( sal_Int32( aFont.Height ) ); - } - } - - aControlValue <<= displayName.makeStringAndClear(); - } - break; - - default: - aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); - break; - - } // switch ( nPropId ) - - return aControlValue; - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL FormComponentPropertyHandler::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_xPropertyState.is() ) - return m_xPropertyState->getPropertyState( _rPropertyName ); - return PropertyState_DIRECT_VALUE; - } - - //-------------------------------------------------------------------- - void SAL_CALL FormComponentPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - FormComponentPropertyHandler_Base::addPropertyChangeListener( _rxListener ); - if ( m_xComponent.is() ) - m_xComponent->addPropertyChangeListener( ::rtl::OUString(), _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL FormComponentPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_xComponent.is() ) - m_xComponent->removePropertyChangeListener( ::rtl::OUString(), _rxListener ); - FormComponentPropertyHandler_Base::removePropertyChangeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void FormComponentPropertyHandler::onNewComponent() - { - FormComponentPropertyHandler_Base::onNewComponent(); - if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() ) - throw NullPointerException(); - - m_xPropertyState.set( m_xComponent, UNO_QUERY ); - m_eComponentClass = eUnknown; - m_bComponentIsSubForm = m_bHaveListSource = m_bHaveCommand = false; - m_nClassId = 0; - - impl_initComponentMetaData_throw(); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL FormComponentPropertyHandler::doDescribeSupportedProperties() const - { - if ( !m_xComponentPropertyInfo.is() ) - return Sequence< Property >(); - - ::std::vector< Property > aProperties; - - Sequence< Property > aAllProperties( m_xComponentPropertyInfo->getProperties() ); - aProperties.reserve( aAllProperties.getLength() ); - - // filter the properties - PropertyId nPropId( 0 ); - ::rtl::OUString sDisplayName; - - Property* pProperty = aAllProperties.getArray(); - Property* pPropertiesEnd = pProperty + aAllProperties.getLength(); - for ( ; pProperty != pPropertiesEnd; ++pProperty ) - { - nPropId = m_pInfoService->getPropertyId( pProperty->Name ); - if ( nPropId == -1 ) - continue; - pProperty->Handle = nPropId; - - sDisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - if ( !sDisplayName.getLength() ) - continue; - - sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId ); - bool bIsVisibleForForms = ( nPropertyUIFlags & PROP_FLAG_FORM_VISIBLE ) != 0; - bool bIsVisibleForDialogs = ( nPropertyUIFlags & PROP_FLAG_DIALOG_VISIBLE ) != 0; - - // depending on whether we're working for a form or a UNO dialog, some - // properties are not displayed - if ( ( m_eComponentClass == eFormControl && !bIsVisibleForForms ) - || ( m_eComponentClass == eDialogControl && !bIsVisibleForDialogs ) - ) - continue; - - // some generic sanity checks - if ( impl_shouldExcludeProperty_nothrow( *pProperty ) ) - continue; - - switch ( nPropId ) - { - case PROPERTY_ID_BORDER: - case PROPERTY_ID_TABSTOP: - // BORDER and TABSTOP are normalized (see impl_normalizePropertyValue_nothrow) - // to not allow VOID values - pProperty->Attributes &= ~( PropertyAttribute::MAYBEVOID ); - break; - - case PROPERTY_ID_LISTSOURCE: - // no cursor source if no Base is installed. #124939# - // This fix is not intendend to appear on the main trunk. If you find it there, - // please tell me! frank.schoenheit@sun.com - if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - const_cast< FormComponentPropertyHandler* >( this )->m_bHaveListSource = true; - break; - - case PROPERTY_ID_COMMAND: - // no cursor source if no Base is installed. #124939# - // This fix is not intendend to appear on the main trunk. If you find it there, - // please tell me! frank.schoenheit@sun.com - if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - const_cast< FormComponentPropertyHandler* >( this )->m_bHaveCommand = true; - break; - } // switch ( nPropId ) - - aProperties.push_back( *pProperty ); - } - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - return Sequence< ::rtl::OUString >( ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - ::std::vector< ::rtl::OUString > aInterestingProperties; - aInterestingProperties.push_back( PROPERTY_DATASOURCE ); - aInterestingProperties.push_back( PROPERTY_COMMAND ); - aInterestingProperties.push_back( PROPERTY_COMMANDTYPE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCE ); - aInterestingProperties.push_back( PROPERTY_LISTSOURCETYPE ); - aInterestingProperties.push_back( PROPERTY_SUBMIT_ENCODING ); - aInterestingProperties.push_back( PROPERTY_REPEAT ); - aInterestingProperties.push_back( PROPERTY_TABSTOP ); - aInterestingProperties.push_back( PROPERTY_BORDER ); - aInterestingProperties.push_back( PROPERTY_CONTROLSOURCE ); - aInterestingProperties.push_back( PROPERTY_DROPDOWN ); - aInterestingProperties.push_back( PROPERTY_IMAGE_URL ); - aInterestingProperties.push_back( PROPERTY_TARGET_URL ); - aInterestingProperties.push_back( PROPERTY_STRINGITEMLIST ); - aInterestingProperties.push_back( PROPERTY_BUTTONTYPE ); - aInterestingProperties.push_back( PROPERTY_ESCAPE_PROCESSING ); - aInterestingProperties.push_back( PROPERTY_TRISTATE ); - aInterestingProperties.push_back( PROPERTY_DECIMAL_ACCURACY ); - aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP ); - aInterestingProperties.push_back( PROPERTY_FORMATKEY ); - aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL ); - aInterestingProperties.push_back( PROPERTY_TOGGLE ); - return Sequence< ::rtl::OUString >( &(*aInterestingProperties.begin()), aInterestingProperties.size() ); - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL FormComponentPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - Property aProperty( impl_getPropertyFromId_throw( nPropId ) ); - - ////////////////////////////////////////////////////////////////////// - // for the MultiLine property, we have different UI translations depending on the control - // type - if ( nPropId == PROPERTY_ID_MULTILINE ) - { - if ( ( m_nClassId == FormComponentType::FIXEDTEXT ) - || ( m_nClassId == FormComponentType::COMMANDBUTTON ) - || ( m_nClassId == FormComponentType::RADIOBUTTON ) - || ( m_nClassId == FormComponentType::CHECKBOX ) - ) - nPropId = PROPERTY_ID_WORDBREAK; - } - - String sDisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - if ( !sDisplayName.Len() ) - { - OSL_FAIL( "FormComponentPropertyHandler::describePropertyLine: did getSupportedProperties not work properly?" ); - throw UnknownPropertyException(); - } - - ////////////////////////////////////////////////////////////////////// - - LineDescriptor aDescriptor; - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); - aDescriptor.DisplayName = sDisplayName; - - // for the moment, assume a text field - sal_Int16 nControlType = PropertyControlType::TextField; - sal_Bool bReadOnly = sal_False; - aDescriptor.Control.clear(); - - ////////////////////////////////////////////////////////////////////// - - bool bNeedDefaultStringIfVoidAllowed = false; - - TypeClass eType = aProperty.Type.getTypeClass(); - - switch ( nPropId ) - { - case PROPERTY_ID_DEFAULT_SELECT_SEQ: - case PROPERTY_ID_SELECTEDITEMS: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SELECTION); - break; - - case PROPERTY_ID_FILTER: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FILTER); - break; - - case PROPERTY_ID_SORT: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_ORDER); - break; - - case PROPERTY_ID_MASTERFIELDS: - case PROPERTY_ID_DETAILFIELDS: - nControlType = PropertyControlType::StringListField; - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FORMLINKFIELDS); - break; - - case PROPERTY_ID_COMMAND: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SQLCOMMAND); - break; - - case PROPERTY_ID_TABINDEX: - { - Reference< XControlContainer > xControlContext( impl_getContextControlContainer_nothrow() ); - if ( xControlContext.is() ) - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_TABINDEX); - nControlType = PropertyControlType::NumericField; - }; - break; - - case PROPERTY_ID_FONT: - bReadOnly = sal_True; - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FONT_TYPE); - break; - - case PROPERTY_ID_TARGET_URL: - case PROPERTY_ID_IMAGE_URL: - { - aDescriptor.Control = new OFileUrlControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER ); - - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(( PROPERTY_ID_TARGET_URL == nPropId ) - ? UID_PROP_DLG_ATTR_TARGET_URL : UID_PROP_DLG_IMAGE_URL); - } - break; - - case PROPERTY_ID_ECHO_CHAR: - nControlType = PropertyControlType::CharacterField; - break; - - case PROPERTY_ID_BACKGROUNDCOLOR: - case PROPERTY_ID_FILLCOLOR: - case PROPERTY_ID_SYMBOLCOLOR: - case PROPERTY_ID_BORDERCOLOR: - nControlType = PropertyControlType::ColorListBox; - - switch( nPropId ) - { - case PROPERTY_ID_BACKGROUNDCOLOR: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_BACKGROUNDCOLOR); break; - case PROPERTY_ID_FILLCOLOR: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_FILLCOLOR); break; - case PROPERTY_ID_SYMBOLCOLOR: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SYMBOLCOLOR); break; - case PROPERTY_ID_BORDERCOLOR: - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_BORDERCOLOR); break; - } - break; - - case PROPERTY_ID_LABEL: - nControlType = PropertyControlType::MultiLineTextField; - break; - - case PROPERTY_ID_DEFAULT_TEXT: - { - if (FormComponentType::FILECONTROL == m_nClassId) - nControlType = PropertyControlType::TextField; - else - nControlType = PropertyControlType::MultiLineTextField; - } - break; - - case PROPERTY_ID_TEXT: - if ( impl_componentHasProperty_throw( PROPERTY_MULTILINE ) ) - nControlType = PropertyControlType::MultiLineTextField; - break; - - case PROPERTY_ID_CONTROLLABEL: - bReadOnly = sal_True; - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_CONTROLLABEL); - break; - - case PROPERTY_ID_FORMATKEY: - case PROPERTY_ID_EFFECTIVE_MIN: - case PROPERTY_ID_EFFECTIVE_MAX: - case PROPERTY_ID_EFFECTIVE_DEFAULT: - case PROPERTY_ID_EFFECTIVE_VALUE: - { - // and the supplier is really available - Reference< XNumberFormatsSupplier > xSupplier; - m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier; - if (xSupplier.is()) - { - Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); - DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::describePropertyLine : xTunnel is invalid!"); - SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); - - if (pSupplier != NULL) - { - sal_Bool bIsFormatKey = (PROPERTY_ID_FORMATKEY == nPropId); - - bReadOnly = bIsFormatKey; - - if ( bIsFormatKey ) - { - OFormatSampleControl* pControl = new OFormatSampleControl( impl_getDefaultDialogParent_nothrow(), WB_READONLY | WB_TABSTOP | WB_BORDER ); - aDescriptor.Control = pControl; - pControl->SetFormatSupplier( pSupplier ); - - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_NUMBER_FORMAT); - } - else - { - OFormattedNumericControl* pControl = new OFormattedNumericControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER ); - aDescriptor.Control = pControl; - - FormatDescription aDesc; - aDesc.pSupplier = pSupplier; - Any aFormatKeyValue = m_xComponent->getPropertyValue(PROPERTY_FORMATKEY); - if ( !( aFormatKeyValue >>= aDesc.nKey ) ) - aDesc.nKey = 0; - - pControl->SetFormatDescription( aDesc ); - } - } - } - } - break; - - case PROPERTY_ID_DATEMIN: - case PROPERTY_ID_DATEMAX: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DATE: - nControlType = PropertyControlType::DateField; - break; - - case PROPERTY_ID_TIMEMIN: - case PROPERTY_ID_TIMEMAX: - case PROPERTY_ID_DEFAULT_TIME: - case PROPERTY_ID_TIME: - nControlType = PropertyControlType::TimeField; - break; - - case PROPERTY_ID_VALUEMIN: - case PROPERTY_ID_VALUEMAX: - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_VALUE: - { - OFormattedNumericControl* pControl = new OFormattedNumericControl( impl_getDefaultDialogParent_nothrow(), WB_TABSTOP | WB_BORDER | WB_SPIN | WB_REPEAT ); - aDescriptor.Control = pControl; - - // we don't set a formatter so the control uses a default (which uses the application - // language and a default numeric format) - // but we set the decimal digits - pControl->SetDecimalDigits( - ::comphelper::getINT16( m_xComponent->getPropertyValue( PROPERTY_DECIMAL_ACCURACY ) ) - ); - - // and the thousands separator - pControl->SetThousandsSep( - ::comphelper::getBOOL( m_xComponent->getPropertyValue(PROPERTY_SHOWTHOUSANDSEP) ) - ); - - // and the default value for the property - try - { - if (m_xPropertyState.is() && ((PROPERTY_ID_VALUEMIN == nPropId) || (PROPERTY_ID_VALUEMAX == nPropId))) - { - double nDefault = 0; - if ( m_xPropertyState->getPropertyDefault( aProperty.Name ) >>= nDefault ) - pControl->SetDefaultValue( nDefault ); - } - } - catch (Exception&) - { - // just ignore it - } - - // and allow empty values only for the default value and the value - pControl->EnableEmptyField( ( PROPERTY_ID_DEFAULT_VALUE == nPropId ) - || ( PROPERTY_ID_VALUE == nPropId ) ); - } - break; - - default: - if ( TypeClass_BYTE <= eType && eType <= TypeClass_DOUBLE ) - { - sal_Int16 nDigits = 0; - sal_Int16 nValueUnit = -1; - sal_Int16 nDisplayUnit = -1; - if ( m_eComponentClass == eFormControl ) - { - if ( ( nPropId == PROPERTY_ID_WIDTH ) - || ( nPropId == PROPERTY_ID_ROWHEIGHT ) - || ( nPropId == PROPERTY_ID_HEIGHT ) - ) - { - nValueUnit = MeasureUnit::MM_10TH; - nDisplayUnit = impl_getDocumentMeasurementUnit_throw(); - nDigits = 2; - } - } - - Optional< double > aValueNotPresent( sal_False, 0 ); - aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, nDigits, aValueNotPresent, aValueNotPresent, sal_False ); - - Reference< XNumericControl > xNumericControl( aDescriptor.Control, UNO_QUERY_THROW ); - if ( nValueUnit != -1 ) - xNumericControl->setValueUnit( nValueUnit ); - if ( nDisplayUnit != -1 ) - xNumericControl->setDisplayUnit( nDisplayUnit ); - } - break; - } - - ////////////////////////////////////////////////////////////////////// - if ( eType == TypeClass_SEQUENCE ) - nControlType = PropertyControlType::StringListField; - - ////////////////////////////////////////////////////////////////////// - // boolean values - if ( eType == TypeClass_BOOLEAN ) - { - sal_uInt16 nResId = RID_RSC_ENUM_YESNO; - if ( ( nPropId == PROPERTY_ID_SHOW_POSITION ) - || ( nPropId == PROPERTY_ID_SHOW_NAVIGATION ) - || ( nPropId == PROPERTY_ID_SHOW_RECORDACTIONS ) - || ( nPropId == PROPERTY_ID_SHOW_FILTERSORT ) - ) - nResId = RID_RSC_ENUM_SHOWHIDE; - - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes(PcrRes(nResId),aListEntries); - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False ); - bNeedDefaultStringIfVoidAllowed = true; - } - - ////////////////////////////////////////////////////////////////////// - // enum properties - sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( nPropId ); - bool bIsEnumProperty = ( nPropertyUIFlags & PROP_FLAG_ENUM ) != 0; - if ( bIsEnumProperty || ( PROPERTY_ID_TARGET_FRAME == nPropId ) ) - { - ::std::vector< ::rtl::OUString > aEnumValues = m_pInfoService->getPropertyEnumRepresentations( nPropId ); - ::std::vector< ::rtl::OUString >::const_iterator pStart = aEnumValues.begin(); - ::std::vector< ::rtl::OUString >::const_iterator pEnd = aEnumValues.end(); - - // for a checkbox: if "ambiguous" is not allowed, remove this from the sequence - if ( ( PROPERTY_ID_DEFAULT_STATE == nPropId ) - || ( PROPERTY_ID_STATE == nPropId ) - ) - { - if ( impl_componentHasProperty_throw( PROPERTY_TRISTATE ) ) - { - if ( !::comphelper::getBOOL( m_xComponent->getPropertyValue( PROPERTY_TRISTATE ) ) ) - { // remove the last sequence element - if ( pEnd > pStart ) - --pEnd; - } - } - else - --pEnd; - } - - if ( PROPERTY_ID_LISTSOURCETYPE == nPropId ) - if ( FormComponentType::COMBOBOX == m_nClassId ) - // remove the first sequence element -> value list not possible for combo boxes - ++pStart; - - // copy the sequence - ::std::vector< ::rtl::OUString > aListEntries( pEnd - pStart ); - ::std::copy( pStart, pEnd, aListEntries.begin() ); - - // create the control - if ( PROPERTY_ID_TARGET_FRAME == nPropId ) - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False ); - else - { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False ); - bNeedDefaultStringIfVoidAllowed = true; - } - } - - ////////////////////////////////////////////////////////////////////// - switch( nPropId ) - { - case PROPERTY_ID_REPEAT_DELAY: - { - OTimeDurationControl* pControl = new OTimeDurationControl( impl_getDefaultDialogParent_nothrow(), WB_BORDER | WB_TABSTOP ); - aDescriptor.Control = pControl; - - pControl->setMinValue( Optional< double >( sal_True, 0 ) ); - pControl->setMaxValue( Optional< double >( sal_True, ::std::numeric_limits< double >::max() ) ); - } - break; - - case PROPERTY_ID_TABINDEX: - case PROPERTY_ID_BOUNDCOLUMN: - case PROPERTY_ID_VISIBLESIZE: - case PROPERTY_ID_MAXTEXTLEN: - case PROPERTY_ID_LINEINCREMENT: - case PROPERTY_ID_BLOCKINCREMENT: - case PROPERTY_ID_SPININCREMENT: - { - Optional< double > aMinValue( sal_True, 0 ); - Optional< double > aMaxValue( sal_True, 0x7FFFFFFF ); - - if ( nPropId == PROPERTY_ID_MAXTEXTLEN ) - aMinValue.Value = -1; - else if ( nPropId == PROPERTY_ID_VISIBLESIZE ) - aMinValue.Value = 1; - else - aMinValue.Value = 0; - - aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 0, aMinValue, aMaxValue, sal_False ); - } - break; - - case PROPERTY_ID_DECIMAL_ACCURACY: - { - Optional< double > aMinValue( sal_True, 0 ); - Optional< double > aMaxValue( sal_True, 20 ); - - aDescriptor.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 0, aMinValue, aMaxValue, sal_False ); - } - break; - - ////////////////////////////////////////////////////////////////////// - // DataSource - case PROPERTY_ID_DATASOURCE: - { - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_ATTR_DATASOURCE); - - ::std::vector< ::rtl::OUString > aListEntries; - - Reference< XNameAccess > xDatabaseContext; - m_aContext.createComponent( (rtl::OUString)SERVICE_DATABASE_CONTEXT, xDatabaseContext ); - if (xDatabaseContext.is()) - { - Sequence< ::rtl::OUString > aDatasources = xDatabaseContext->getElementNames(); - aListEntries.resize( aDatasources.getLength() ); - ::std::copy( aDatasources.getConstArray(), aDatasources.getConstArray() + aDatasources.getLength(), - aListEntries.begin() ); - } - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aListEntries, sal_False, sal_True ); - } - break; - - case PROPERTY_ID_CONTROLSOURCE: - { - ::std::vector< ::rtl::OUString > aFieldNames; - impl_initFieldList_nothrow( aFieldNames ); - aDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( - _rxControlFactory, aFieldNames, sal_False, sal_False ); - } - break; - - case PROPERTY_ID_COMMAND: - impl_describeCursorSource_nothrow( aDescriptor, _rxControlFactory ); - break; - - case PROPERTY_ID_LISTSOURCE: - impl_describeListSourceUI_throw( aDescriptor, _rxControlFactory ); - break; - } - - if ( !aDescriptor.Control.is() ) - aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, bReadOnly ); - - if ( ( aProperty.Attributes & PropertyAttribute::MAYBEVOID ) != 0 ) - { - // insert the string "Default" string, if necessary - if ( bNeedDefaultStringIfVoidAllowed || ( nControlType == PropertyControlType::ColorListBox ) ) - { - Reference< XStringListControl > xStringList( aDescriptor.Control, UNO_QUERY_THROW ); - xStringList->prependListEntry( m_sDefaultValueString ); - m_aPropertiesWithDefListEntry.insert( _rPropertyName ); - } - } - - if ( aDescriptor.PrimaryButtonId.getLength() ) - aDescriptor.HasPrimaryButton = sal_True; - if ( aDescriptor.SecondaryButtonId.getLength() ) - aDescriptor.HasSecondaryButton = sal_True; - - bool bIsDataProperty = ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0; - aDescriptor.Category = bIsDataProperty ? ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Data")) : ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("General")); - return aDescriptor; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL FormComponentPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool /*_bPrimary*/, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - InteractiveSelectionResult eResult = InteractiveSelectionResult_Cancelled; - switch ( nPropId ) - { - case PROPERTY_ID_DEFAULT_SELECT_SEQ: - case PROPERTY_ID_SELECTEDITEMS: - if ( impl_dialogListSelection_nothrow( _rPropertyName, aGuard ) ) - eResult = InteractiveSelectionResult_Success; - break; - - case PROPERTY_ID_FILTER: - case PROPERTY_ID_SORT: - { - ::rtl::OUString sClause; - if ( impl_dialogFilterOrSort_nothrow( PROPERTY_ID_FILTER == nPropId, sClause, aGuard ) ) - { - _rData <<= sClause; - eResult = InteractiveSelectionResult_ObtainedValue; - } - } - break; - - case PROPERTY_ID_MASTERFIELDS: - case PROPERTY_ID_DETAILFIELDS: - if ( impl_dialogLinkedFormFields_nothrow( aGuard ) ) - eResult = InteractiveSelectionResult_Success; - break; - - case PROPERTY_ID_FORMATKEY: - if ( impl_dialogFormatting_nothrow( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_IMAGE_URL: - if ( impl_browseForImage_nothrow( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_TARGET_URL: - if ( impl_browseForTargetURL_nothrow( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_FONT: - if ( impl_executeFontDialog_nothrow( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_DATASOURCE: - if ( impl_browseForDatabaseDocument_throw( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_BACKGROUNDCOLOR: - case PROPERTY_ID_FILLCOLOR: - case PROPERTY_ID_SYMBOLCOLOR: - case PROPERTY_ID_BORDERCOLOR: - if ( impl_dialogColorChooser_throw( nPropId, _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_CONTROLLABEL: - if ( impl_dialogChooseLabelControl_nothrow( _rData, aGuard ) ) - eResult = InteractiveSelectionResult_ObtainedValue; - break; - - case PROPERTY_ID_TABINDEX: - if ( impl_dialogChangeTabOrder_nothrow( aGuard ) ) - eResult = InteractiveSelectionResult_Success; - break; - - case PROPERTY_ID_COMMAND: - case PROPERTY_ID_LISTSOURCE: - if ( impl_doDesignSQLCommand_nothrow( _rxInspectorUI, nPropId ) ) - eResult = InteractiveSelectionResult_Pending; - break; - default: - OSL_FAIL( "FormComponentPropertyHandler::onInteractivePropertySelection: request for a property which does not have dedicated UI!" ); - break; - } - return eResult; - } - - //-------------------------------------------------------------------- - namespace - { - void lcl_rebuildAndResetCommand( const Reference< XObjectInspectorUI >& _rxInspectorUI, const Reference< XPropertyHandler >& _rxHandler ) - { - OSL_PRECOND( _rxInspectorUI.is(), "lcl_rebuildAndResetCommand: invalid BrowserUI!" ); - OSL_PRECOND( _rxHandler.is(), "lcl_rebuildAndResetCommand: invalid handler!" ); - _rxInspectorUI->rebuildPropertyUI( PROPERTY_COMMAND ); - _rxHandler->setPropertyValue( PROPERTY_COMMAND, makeAny( ::rtl::OUString() ) ); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL FormComponentPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - - ::std::vector< PropertyId > aDependentProperties; - - switch ( nActuatingPropId ) - { - // ----- EscapeProcessing ----- - case PROPERTY_ID_ESCAPE_PROCESSING: - aDependentProperties.push_back( PROPERTY_ID_FILTER ); - aDependentProperties.push_back( PROPERTY_ID_SORT ); - break; // case PROPERTY_ID_ESCAPE_PROCESSING - - // ----- CommandType ----- - case PROPERTY_ID_COMMANDTYPE: - // available commands (tables or queries) might have changed - if ( !_bFirstTimeInit && m_bHaveCommand ) - lcl_rebuildAndResetCommand( _rxInspectorUI, this ); - aDependentProperties.push_back( PROPERTY_ID_COMMAND ); - break; // case PROPERTY_ID_COMMANDTYPE - - // ----- DataSourceName ----- - case PROPERTY_ID_DATASOURCE: - // reset the connection, now that we have a new data source - impl_clearRowsetConnection_nothrow(); - - // available list source values (tables or queries) might have changed - if ( !_bFirstTimeInit && m_bHaveListSource ) - _rxInspectorUI->rebuildPropertyUI( PROPERTY_LISTSOURCE ); - - // available commands (tables or queries) might have changed - if ( !_bFirstTimeInit && m_bHaveCommand ) - lcl_rebuildAndResetCommand( _rxInspectorUI, this ); - - // Command also depends on DataSource - aDependentProperties.push_back( PROPERTY_ID_COMMAND ); - // NO break! - - // ----- Command ----- - case PROPERTY_ID_COMMAND: - aDependentProperties.push_back( PROPERTY_ID_FILTER ); - aDependentProperties.push_back( PROPERTY_ID_SORT ); - if ( m_bComponentIsSubForm ) - aDependentProperties.push_back( PROPERTY_ID_DETAILFIELDS ); - break; - - // ----- ListSourceType ----- - case PROPERTY_ID_LISTSOURCETYPE: - if ( !_bFirstTimeInit && m_bHaveListSource ) - // available list source values (tables or queries) might have changed - _rxInspectorUI->rebuildPropertyUI( PROPERTY_LISTSOURCE ); - aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN ); - aDependentProperties.push_back( PROPERTY_ID_STRINGITEMLIST ); - // NO break! - - // ----- StringItemList ----- - case PROPERTY_ID_STRINGITEMLIST: - aDependentProperties.push_back( PROPERTY_ID_SELECTEDITEMS ); - aDependentProperties.push_back( PROPERTY_ID_DEFAULT_SELECT_SEQ ); - break; - - // ----- ListSource ----- - case PROPERTY_ID_LISTSOURCE: - aDependentProperties.push_back( PROPERTY_ID_STRINGITEMLIST ); - break; - - // ----- DataField ----- - case PROPERTY_ID_CONTROLSOURCE: - { - ::rtl::OUString sControlSource; - _rNewValue >>= sControlSource; - if ( impl_componentHasProperty_throw( PROPERTY_FILTERPROPOSAL ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_FILTERPROPOSAL, sControlSource.getLength() > 0 ); - if ( impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_EMPTY_IS_NULL, sControlSource.getLength() > 0 ); - - aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN ); - aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE ); - aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE ); - aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED ); - } - break; - - case PROPERTY_ID_EMPTY_IS_NULL: - aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED ); - break; - - // ----- SubmitEncoding ----- - case PROPERTY_ID_SUBMIT_ENCODING: - { - FormSubmitEncoding eEncoding = FormSubmitEncoding_URL; - OSL_VERIFY( _rNewValue >>= eEncoding ); - _rxInspectorUI->enablePropertyUI( PROPERTY_SUBMIT_METHOD, eEncoding == FormSubmitEncoding_URL ); - } - break; - - // ----- Repeat ----- - case PROPERTY_ID_REPEAT: - { - sal_Bool bIsRepeating = sal_False; - OSL_VERIFY( _rNewValue >>= bIsRepeating ); - _rxInspectorUI->enablePropertyUI( PROPERTY_REPEAT_DELAY, bIsRepeating ); - } - break; - - // ----- TabStop ----- - case PROPERTY_ID_TABSTOP: - { - if ( !impl_componentHasProperty_throw( PROPERTY_TABINDEX ) ) - break; - sal_Bool bHasTabStop = sal_False; - _rNewValue >>= bHasTabStop; - _rxInspectorUI->enablePropertyUI( PROPERTY_TABINDEX, bHasTabStop ); - } - break; - - // ----- Border ----- - case PROPERTY_ID_BORDER: - { - sal_Int16 nBordeType = VisualEffect::NONE; - OSL_VERIFY( _rNewValue >>= nBordeType ); - _rxInspectorUI->enablePropertyUI( PROPERTY_BORDERCOLOR, nBordeType == VisualEffect::FLAT ); - } - break; - - // ----- DropDown ----- - case PROPERTY_ID_DROPDOWN: - { - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_LINECOUNT ) ) - { - sal_Bool bDropDown = sal_True; - _rNewValue >>= bDropDown; - _rxInspectorUI->enablePropertyUI( PROPERTY_LINECOUNT, bDropDown ); - } - } - break; - - // ----- ImageURL ----- - case PROPERTY_ID_IMAGE_URL: - { - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_IMAGEPOSITION ) ) - { - ::rtl::OUString sImageURL; - OSL_VERIFY( _rNewValue >>= sImageURL ); - _rxInspectorUI->enablePropertyUI( PROPERTY_IMAGEPOSITION, sImageURL.getLength() != 0 ); - } - - aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE ); - aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE ); - } - break; - - // ----- ButtonType ----- - case PROPERTY_ID_BUTTONTYPE: - { - FormButtonType eButtonType( FormButtonType_PUSH ); - OSL_VERIFY( _rNewValue >>= eButtonType ); - _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_URL, FormButtonType_URL == eButtonType ); - } - // NO break! - - // ----- TargetURL ----- - case PROPERTY_ID_TARGET_URL: - aDependentProperties.push_back( PROPERTY_ID_TARGET_FRAME ); - break; // case PROPERTY_ID_TARGET_URL - - // ----- TriState ----- - case PROPERTY_ID_TRISTATE: - if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); - break; // case PROPERTY_ID_TRISTATE - - // ----- DecimalAccuracy ----- - case PROPERTY_ID_DECIMAL_ACCURACY: - // ----- ShowThousandsSeparator ----- - case PROPERTY_ID_SHOWTHOUSANDSEP: - { - sal_Bool bAccuracy = (PROPERTY_ID_DECIMAL_ACCURACY == nActuatingPropId); - sal_uInt16 nNewDigits = 0; - sal_Bool bUseSep = sal_False; - if ( bAccuracy ) - OSL_VERIFY( _rNewValue >>= nNewDigits ); - else - OSL_VERIFY( _rNewValue >>= bUseSep ); - - // propagate the changes to the min/max/default fields - Any aCurrentProp; - ::rtl::OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX }; - for (sal_uInt16 i=0; i xControl; - try - { - xControl = _rxInspectorUI->getPropertyControl( aAffectedProps[i] ); - } - catch( const UnknownPropertyException& e ) { (void)e; } - if ( xControl.is() ) - { - OFormattedNumericControl* pControl = dynamic_cast< OFormattedNumericControl* >( xControl.get() ); - DBG_ASSERT( pControl, "FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" ); - if ( pControl ) - { - if ( bAccuracy ) - pControl->SetDecimalDigits( nNewDigits ); - else - pControl->SetThousandsSep( bUseSep ); - } - } - } - } - break; - - // ----- FormatKey ----- - case PROPERTY_ID_FORMATKEY: - { - FormatDescription aNewDesc; - - Reference< XNumberFormatsSupplier > xSupplier; - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier ); - - Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY ); - DBG_ASSERT(xTunnel.is(), "FormComponentPropertyHandler::actuatingPropertyChanged: xTunnel is invalid!"); - if ( xTunnel.is() ) - { - SvNumberFormatsSupplierObj* pSupplier = reinterpret_cast(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); - // the same again - - aNewDesc.pSupplier = pSupplier; - if ( !( _rNewValue >>= aNewDesc.nKey ) ) - aNewDesc.nKey = 0; - - // give each control which has to know this an own copy of the description - ::rtl::OUString aFormattedPropertyControls[] = { - PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE - }; - for ( sal_uInt16 i=0; i xControl; - try - { - xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControls[i] ); - } - catch( const UnknownPropertyException& e ) { (void)e; } - if ( xControl.is() ) - { - OFormattedNumericControl* pControl = dynamic_cast< OFormattedNumericControl* >( xControl.get() ); - DBG_ASSERT( pControl, "FormComponentPropertyHandler::actuatingPropertyChanged: invalid control!" ); - if ( pControl ) - pControl->SetFormatDescription( aNewDesc ); - } - } - } - } - break; - - case PROPERTY_ID_TOGGLE: - { - sal_Bool bIsToggleButton = sal_False; - OSL_VERIFY( _rNewValue >>= bIsToggleButton ); - _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_STATE, bIsToggleButton ); - } - break; - - default: - OSL_FAIL( "FormComponentPropertyHandler::actuatingPropertyChanged: did not register for this property!" ); - break; - - } // switch ( nActuatingPropId ) - - for ( ::std::vector< PropertyId >::const_iterator loopAffected = aDependentProperties.begin(); - loopAffected != aDependentProperties.end(); - ++loopAffected - ) - { - if ( impl_isSupportedProperty_nothrow( *loopAffected ) ) - impl_updateDependentProperty_nothrow( *loopAffected, _rxInspectorUI ); - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_updateDependentProperty_nothrow( PropertyId _nPropId, const Reference< XObjectInspectorUI >& _rxInspectorUI ) const - { - try - { - switch ( _nPropId ) - { - // ----- StringItemList ----- - case PROPERTY_ID_STRINGITEMLIST: - { - ListSourceType eLSType = ListSourceType_VALUELIST; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType ); - - ::rtl::OUString sListSource; - { - Sequence< ::rtl::OUString > aListSource; - Any aListSourceValue( impl_getPropertyValue_throw( PROPERTY_LISTSOURCE ) ); - if ( aListSourceValue >>= aListSource ) - { - if ( aListSource.getLength() ) - sListSource = aListSource[0]; - } - else - OSL_VERIFY( aListSourceValue >>= sListSource ); - } - - sal_Bool bIsEnabled = ( ( eLSType == ListSourceType_VALUELIST ) - || ( sListSource.getLength() == 0 ) - ); - _rxInspectorUI->enablePropertyUI( PROPERTY_STRINGITEMLIST, bIsEnabled ); - } - break; // case PROPERTY_ID_STRINGITEMLIST - - // ----- BoundColumn ----- - case PROPERTY_ID_BOUNDCOLUMN: - { - ::rtl::OUString sControlSource; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource ); - - ListSourceType eLSType = ListSourceType_VALUELIST; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType ); - - _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN, - ( sControlSource.getLength() > 0 ) - && ( eLSType != ListSourceType_TABLEFIELDS ) - && ( eLSType != ListSourceType_VALUELIST ) - ); - } - break; // case PROPERTY_ID_BOUNDCOLUMN - - // ----- ScaleImage, ScaleMode ----- - case PROPERTY_ID_SCALEIMAGE: - case PROPERTY_ID_SCALE_MODE: - { - ::rtl::OUString sControlSource; - if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_CONTROLSOURCE ) ) - impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource; - - ::rtl::OUString sImageURL; - impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sImageURL; - - _rxInspectorUI->enablePropertyUI( impl_getPropertyNameFromId_nothrow( _nPropId ), - ( sControlSource.getLength() != 0 ) || ( sImageURL.getLength() != 0 ) - ); - } - break; // case PROPERTY_ID_SCALEIMAGE, PROPERTY_ID_SCALE_MODE - - // ----- InputRequired ----- - case PROPERTY_ID_INPUT_REQUIRED: - { - ::rtl::OUString sControlSource; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource ); - - sal_Bool bEmptyIsNULL = sal_False; - sal_Bool bHasEmptyIsNULL = impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL ); - if ( bHasEmptyIsNULL ) - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_EMPTY_IS_NULL ) >>= bEmptyIsNULL ); - - // if the control is not bound to a DB field, there is no sense in having the "Input required" - // property - // Also, if an empty input of this control are *not* written as NULL, but as empty strings, - // then "Input required" does not make sense, too (since there's always an input, even if the control - // is empty). - _rxInspectorUI->enablePropertyUI( PROPERTY_INPUT_REQUIRED, - ( sControlSource.getLength() != 0 ) && ( !bHasEmptyIsNULL || bEmptyIsNULL ) - ); - } - break; - - // ----- SelectedItems, DefaultSelection ----- - case PROPERTY_ID_SELECTEDITEMS: - case PROPERTY_ID_DEFAULT_SELECT_SEQ: - { - Sequence< ::rtl::OUString > aEntries; - impl_getPropertyValue_throw( PROPERTY_STRINGITEMLIST ) >>= aEntries; - bool isEnabled = aEntries.getLength() != 0; - - if ( ( m_nClassId == FormComponentType::LISTBOX ) && ( m_eComponentClass == eFormControl ) ) - { - ListSourceType eLSType = ListSourceType_VALUELIST; - impl_getPropertyValue_throw( PROPERTY_LISTSOURCETYPE ) >>= eLSType; - isEnabled &= ( eLSType == ListSourceType_VALUELIST ); - } - _rxInspectorUI->enablePropertyUIElements( impl_getPropertyNameFromId_nothrow( _nPropId ), - PropertyLineElement::PrimaryButton, isEnabled ); - } - break; // case PROPERTY_ID_DEFAULT_SELECT_SEQ - - // ----- TargetFrame ------ - case PROPERTY_ID_TARGET_FRAME: - { - ::rtl::OUString sTargetURL; - impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sTargetURL; - FormButtonType eButtonType( FormButtonType_URL ); - if ( 0 != m_nClassId ) - { - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_BUTTONTYPE ) >>= eButtonType ); - } - // if m_nClassId is 0, then we're inspecting a form. In this case, eButtonType is always - // FormButtonType_URL here - _rxInspectorUI->enablePropertyUI( PROPERTY_TARGET_FRAME, - ( eButtonType == FormButtonType_URL ) && ( sTargetURL.getLength() > 0 ) - ); - } - break; - - // ----- Order ------ - case PROPERTY_ID_SORT: - // ----- Filter ------ - case PROPERTY_ID_FILTER: - { - Reference< XConnection > xConnection; - bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection ); - - // if there's no escape processing, we cannot enter any values for this property - sal_Bool bDoEscapeProcessing( sal_False ); - impl_getPropertyValue_throw( PROPERTY_ESCAPE_PROCESSING ) >>= bDoEscapeProcessing; - _rxInspectorUI->enablePropertyUI( - impl_getPropertyNameFromId_nothrow( _nPropId ), - bDoEscapeProcessing - ); - - // also care for the browse button - enabled if we have escape processing, and a valid - // data source signature - _rxInspectorUI->enablePropertyUIElements( - impl_getPropertyNameFromId_nothrow( _nPropId ), - PropertyLineElement::PrimaryButton, - impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS ) - && bDoEscapeProcessing - ); - } - break; // case PROPERTY_ID_FILTER: - - // ----- Command ----- - case PROPERTY_ID_COMMAND: - { - sal_Int32 nCommandType( CommandType::COMMAND ); - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType ); - - impl_ensureRowsetConnection_nothrow(); - Reference< XConnection > xConnection = m_xRowSetConnection.getTyped(); - bool bAllowEmptyDS = false; - if ( !xConnection.is() ) - bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection ); - - bool doEnable = ( nCommandType == CommandType::COMMAND ) - && ( m_xRowSetConnection.is() - || xConnection.is() - || impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS) - ); - - _rxInspectorUI->enablePropertyUIElements( - PROPERTY_COMMAND, - PropertyLineElement::PrimaryButton, - doEnable - ); - } - break; // case PROPERTY_ID_COMMAND - - // ----- DetailFields ----- - case PROPERTY_ID_DETAILFIELDS: - { - Reference< XConnection > xConnection; - bool bAllowEmptyDS = ::dbtools::isEmbeddedInDatabase( m_xComponent, xConnection ); - - // both our current form, and it's parent form, need to have a valid - // data source signature - bool bDoEnableMasterDetailFields = - impl_hasValidDataSourceSignature_nothrow( m_xComponent, bAllowEmptyDS ) - && impl_hasValidDataSourceSignature_nothrow( Reference< XPropertySet >( m_xObjectParent, UNO_QUERY ), bAllowEmptyDS ); - - // in opposite to the other properties, here in real *two* properties are - // affected - _rxInspectorUI->enablePropertyUIElements( PROPERTY_DETAILFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields ); - _rxInspectorUI->enablePropertyUIElements( PROPERTY_MASTERFIELDS, PropertyLineElement::PrimaryButton, bDoEnableMasterDetailFields ); - } - break; - - default: - OSL_FAIL( "FormComponentPropertyHandler::impl_updateDependentProperty_nothrow: unexpected property to update!" ); - break; - - } // switch - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_updateDependentProperty_nothrow: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - void SAL_CALL FormComponentPropertyHandler::disposing() - { - FormComponentPropertyHandler_Base::disposing(); - if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() ) - m_xCommandDesigner->dispose(); - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL FormComponentPropertyHandler::suspend( sal_Bool _bSuspend ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( _bSuspend ) - if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() ) - return m_xCommandDesigner->suspend(); - return sal_True; - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_initComponentMetaData_throw() - { - try - { - ////////////////////////////////////////////////////////////////// - // component class - m_eComponentClass = eUnknown; - - if ( impl_componentHasProperty_throw( PROPERTY_WIDTH ) - && impl_componentHasProperty_throw( PROPERTY_HEIGHT ) - && impl_componentHasProperty_throw( PROPERTY_POSITIONX ) - && impl_componentHasProperty_throw( PROPERTY_POSITIONY ) - && impl_componentHasProperty_throw( PROPERTY_STEP ) - && impl_componentHasProperty_throw( PROPERTY_TABINDEX ) - ) - { - m_eComponentClass = eDialogControl; - } - else - { - m_eComponentClass = eFormControl; - } - - ////////////////////////////////////////////////////////////////// - // (database) sub form? - Reference< XForm > xAsForm( m_xComponent, UNO_QUERY ); - if ( xAsForm.is() ) - { - Reference< XChild > xFormAsChild( xAsForm, UNO_QUERY ); - Reference< XForm > xFormsParent; - if ( xFormAsChild.is() ) - xFormsParent = xFormsParent.query( xFormAsChild->getParent() ); - m_bComponentIsSubForm = xFormsParent.is(); - } - - ////////////////////////////////////////////////////////////////// - // ClassId - Reference< XChild > xCompAsChild( m_xComponent, UNO_QUERY ); - if ( xCompAsChild.is() ) - m_xObjectParent = xCompAsChild->getParent(); - - ////////////////////////////////////////////////////////////////// - // ClassId - impl_classifyControlModel_throw(); - } - catch( const RuntimeException& ) - { - throw; - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_initComponentMetaData_throw: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_classifyControlModel_throw( ) - { - if ( impl_componentHasProperty_throw( PROPERTY_CLASSID ) ) - { - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_CLASSID ) >>= m_nClassId ); - } - else if ( eDialogControl == m_eComponentClass ) - { - Reference< XControlModel > xControlModel( m_xComponent, UNO_QUERY ); - Reference< XServiceInfo > xServiceInfo( m_xComponent, UNO_QUERY ); - if ( xServiceInfo.is() ) - { - // it's a control model, and can tell about it's supported services - m_nClassId = FormComponentType::CONTROL; - - const sal_Char* aControlModelServiceNames[] = - { - "UnoControlButtonModel", - "UnoControlCheckBoxModel", - "UnoControlComboBoxModel", - "UnoControlCurrencyFieldModel", - "UnoControlDateFieldModel", - "UnoControlEditModel", - "UnoControlFileControlModel", - "UnoControlFixedTextModel", - "UnoControlGroupBoxModel", - "UnoControlImageControlModel", - "UnoControlListBoxModel", - "UnoControlNumericFieldModel", - "UnoControlPatternFieldModel", - "UnoControlRadioButtonModel", - "UnoControlScrollBarModel", - "UnoControlSpinButtonModel", - "UnoControlTimeFieldModel", - - "UnoControlFixedLineModel", - "UnoControlFormattedFieldModel", - "UnoControlProgressBarModel" - }; - const sal_Int16 nClassIDs[] = - { - FormComponentType::COMMANDBUTTON, - FormComponentType::CHECKBOX, - FormComponentType::COMBOBOX, - FormComponentType::CURRENCYFIELD, - FormComponentType::DATEFIELD, - FormComponentType::TEXTFIELD, - FormComponentType::FILECONTROL, - FormComponentType::FIXEDTEXT, - FormComponentType::GROUPBOX, - FormComponentType::IMAGECONTROL, - FormComponentType::LISTBOX, - FormComponentType::NUMERICFIELD, - FormComponentType::PATTERNFIELD, - FormComponentType::RADIOBUTTON, - FormComponentType::SCROLLBAR, - FormComponentType::SPINBUTTON, - FormComponentType::TIMEFIELD, - - ControlType::FIXEDLINE, - ControlType::FORMATTEDFIELD, - ControlType::PROGRESSBAR - }; - - sal_Int32 nKnownControlTypes = SAL_N_ELEMENTS( aControlModelServiceNames ); - OSL_ENSURE( nKnownControlTypes == SAL_N_ELEMENTS( nClassIDs ), - "FormComponentPropertyHandler::impl_classifyControlModel_throw: inconsistence" ); - - for ( sal_Int32 i = 0; i < nKnownControlTypes; ++i ) - { - ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt." ) ); - sServiceName += ::rtl::OUString::createFromAscii( aControlModelServiceNames[ i ] ); - - if ( xServiceInfo->supportsService( sServiceName ) ) - { - m_nClassId = nClassIDs[ i ]; - break; - } - } - } - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_normalizePropertyValue_nothrow( Any& _rValue, PropertyId _nPropId ) const - { - switch ( _nPropId ) - { - case PROPERTY_ID_TABSTOP: - if ( !_rValue.hasValue() ) - { - switch ( m_nClassId ) - { - case FormComponentType::COMMANDBUTTON: - case FormComponentType::RADIOBUTTON: - case FormComponentType::CHECKBOX: - case FormComponentType::TEXTFIELD: - case FormComponentType::LISTBOX: - case FormComponentType::COMBOBOX: - case FormComponentType::FILECONTROL: - case FormComponentType::DATEFIELD: - case FormComponentType::TIMEFIELD: - case FormComponentType::NUMERICFIELD: - case ControlType::FORMATTEDFIELD: - case FormComponentType::CURRENCYFIELD: - case FormComponentType::PATTERNFIELD: - _rValue = makeAny( (sal_Bool)sal_True ); - break; - default: - _rValue = makeAny( (sal_Bool)sal_False ); - break; - } - } - break; - } - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow( const Property& _rProperty ) const - { - OSL_ENSURE( _rProperty.Handle == m_pInfoService->getPropertyId( _rProperty.Name ), - "FormComponentPropertyHandler::impl_shouldExcludeProperty_nothrow: insonsistency in the property!" ); - - if ( _rProperty.Handle == PROPERTY_ID_CONTROLLABEL ) - // prevent that this is caught below - return false; - - if ( ( _rProperty.Type.getTypeClass() == TypeClass_INTERFACE ) - || ( _rProperty.Type.getTypeClass() == TypeClass_ARRAY ) - || ( _rProperty.Type.getTypeClass() == TypeClass_UNKNOWN ) - ) - return true; - - if ( ( _rProperty.Attributes & PropertyAttribute::TRANSIENT ) && ( m_eComponentClass != eDialogControl ) ) - // strange enough, dialog controls declare a lot of their properties as transient - return true; - - if ( _rProperty.Attributes & PropertyAttribute::READONLY ) - return true; - - switch ( _rProperty.Handle ) - { - case PROPERTY_ID_MASTERFIELDS: - case PROPERTY_ID_DETAILFIELDS: - if ( !m_bComponentIsSubForm ) - // no master and detail fields for forms which are no sub forms - return true; - break; - - case PROPERTY_ID_DATASOURCE: - { - // don't show DataSource if the component is part of an embedded form document - Reference< XConnection > xConn; - if ( isEmbeddedInDatabase( m_xComponent, xConn ) ) - return true; - } - break; - - case PROPERTY_ID_TEXT: - // don't show the "Text" property of formatted fields - if ( ControlType::FORMATTEDFIELD == m_nClassId ) - return true; - break; - - case PROPERTY_ID_FORMATKEY: - case PROPERTY_ID_EFFECTIVE_MIN: - case PROPERTY_ID_EFFECTIVE_MAX: - case PROPERTY_ID_EFFECTIVE_DEFAULT: - case PROPERTY_ID_EFFECTIVE_VALUE: - // only if the set has a formats supplier, too - if ( !impl_componentHasProperty_throw( PROPERTY_FORMATSSUPPLIER ) ) - return true; - // (form) date and time fields also have a formats supplier, but the format itself - // is reflected in another property - if ( ( FormComponentType::DATEFIELD == m_nClassId ) - || ( FormComponentType::TIMEFIELD == m_nClassId ) - ) - return true; - break; - - case PROPERTY_ID_SCALEIMAGE: - if ( impl_componentHasProperty_throw( PROPERTY_SCALE_MODE ) ) - // ScaleImage is superseded by ScaleMode - return true; - break; - - case PROPERTY_ID_WRITING_MODE: - if ( !SvtCTLOptions().IsCTLFontEnabled() ) - return true; - break; - } - - sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( _rProperty.Handle ); - - // don't show experimental properties unless allowed to do so - if ( ( nPropertyUIFlags & PROP_FLAG_EXPERIMENTAL ) != 0 ) - { - if ( true ) // TODO - return true; - } - - // no data properties if no Base is installed. #124939# - // This fix is not intendend to appear on the main trunk. If you find it there, - // please tell me! frank.schoenheit@sun.com - if ( ( nPropertyUIFlags & PROP_FLAG_DATA_PROPERTY ) != 0 ) - if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) ) - return true; - - return false; - } - - //------------------------------------------------------------------------ - Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_throw( ) const - { - Reference< XRowSet > xRowSet = m_xRowSet; - if ( !xRowSet.is() ) - { - xRowSet.set( m_xComponent, UNO_QUERY ); - if ( !xRowSet.is() ) - { - xRowSet = Reference< XRowSet >( m_xObjectParent, UNO_QUERY ); - if ( !xRowSet.is() ) - { - // are we inspecting a grid column? - if (Reference< XGridColumnFactory >( m_xObjectParent, UNO_QUERY) .is()) - { // yes - Reference< XChild > xParentAsChild( m_xObjectParent, UNO_QUERY ); - if ( xParentAsChild.is() ) - xRowSet = Reference< XRowSet >( xParentAsChild->getParent(), UNO_QUERY ); - } - } - if ( !xRowSet.is() ) - xRowSet = m_xRowSet; - } - DBG_ASSERT( xRowSet.is(), "FormComponentPropertyHandler::impl_getRowSet_throw: could not obtain the rowset for the introspectee!" ); - } - return xRowSet; - } - - //------------------------------------------------------------------------ - Reference< XRowSet > FormComponentPropertyHandler::impl_getRowSet_nothrow( ) const - { - Reference< XRowSet > xReturn; - try - { - xReturn = impl_getRowSet_throw(); - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_getRowSet_nothrow: caught an exception!" ); - } - return xReturn; - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_initFieldList_nothrow( ::std::vector< ::rtl::OUString >& _rFieldNames ) const - { - clearContainer( _rFieldNames ); - try - { - WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() ); - - Reference< XPreparedStatement > xStatement; - - // get the form of the control we're inspecting - Reference< XPropertySet > xFormSet( impl_getRowSet_throw(), UNO_QUERY ); - if ( !xFormSet.is() ) - return; - - ::rtl::OUString sObjectName; - OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMAND ) >>= sObjectName ); - // when there is no command we don't need to ask for columns - if ( sObjectName.getLength() && impl_ensureRowsetConnection_nothrow() ) - { - ::rtl::OUString aDatabaseName; - OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_DATASOURCE ) >>= aDatabaseName ); - sal_Int32 nObjectType = CommandType::COMMAND; - OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType ); - - Sequence< ::rtl::OUString > aFields( ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ) ); - - const ::rtl::OUString* pFields = aFields.getConstArray(); - for ( sal_Int32 i = 0; i < aFields.getLength(); ++i, ++pFields ) - _rFieldNames.push_back( *pFields ); - } - } - catch (Exception&) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_initFieldList_nothrow: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_clearRowsetConnection_nothrow() - { - m_xRowSetConnection.clear(); - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const - { - ::dbtools::showError( _rErrorDescriptor, VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ), m_aContext.getLegacyServiceFactory() ); - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow() const - { - if ( !m_xRowSetConnection.is() ) - { - uno::Reference xConnection(m_aContext.getContextValueByAsciiName( "ActiveConnection" ),uno::UNO_QUERY); - m_xRowSetConnection.reset(xConnection,::dbtools::SharedConnection::NoTakeOwnership); - } - if ( m_xRowSetConnection.is() ) - return true; - - Reference< XRowSet > xRowSet( impl_getRowSet_throw() ); - Reference< XPropertySet > xRowSetProps( xRowSet, UNO_QUERY ); - - // connect the row set - this is delegated to elsewhere - while observing errors - SQLExceptionInfo aError; - try - { - if ( xRowSetProps.is() ) - { - WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() ); - m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_aContext.getLegacyServiceFactory(), false ); - } - } - catch ( const SQLException& ) { aError = SQLExceptionInfo( ::cppu::getCaughtException() ); } - catch ( const WrappedTargetException& e ) { aError = SQLExceptionInfo( e.TargetException ); } - catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - - // report errors, if necessary - if ( aError.isValid() ) - { - ::rtl::OUString sDataSourceName; - try - { - xRowSetProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDataSourceName; - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_ensureRowsetConnection_nothrow: caught an exception during error handling!" ); - } - // additional info about what happended - String sInfo( PcrRes( RID_STR_UNABLETOCONNECT ) ); - INetURLObject aParser( sDataSourceName ); - if ( aParser.GetProtocol() != INET_PROT_NOT_VALID ) - sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - sInfo.SearchAndReplaceAllAscii( "$name$", sDataSourceName ); - - SQLContext aContext; - aContext.Message = sInfo; - aContext.NextException = aError.get(); - impl_displaySQLError_nothrow( aContext ); - } - - return m_xRowSetConnection.is(); - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_describeCursorSource_nothrow( LineDescriptor& _out_rProperty, const Reference< XPropertyControlFactory >& _rxControlFactory ) const - { - try - { - WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() ); - - //////////////////////////////////////////////////////////// - // Setzen der UI-Daten - _out_rProperty.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_COMMAND ); - - _out_rProperty.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_COMMAND ) ); - _out_rProperty.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_DLG_SQLCOMMAND); - - //////////////////////////////////////////////////////////// - sal_Int32 nCommandType = CommandType::COMMAND; - impl_getPropertyValue_throw( PROPERTY_COMMANDTYPE ) >>= nCommandType; - - switch ( nCommandType ) - { - case CommandType::TABLE: - case CommandType::QUERY: - { - ::std::vector< ::rtl::OUString > aNames; - if ( impl_ensureRowsetConnection_nothrow() ) - { - if ( nCommandType == CommandType::TABLE ) - impl_fillTableNames_throw( aNames ); - else - impl_fillQueryNames_throw( aNames ); - } - _out_rProperty.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aNames, sal_False, sal_True ); - } - break; - - default: - _out_rProperty.Control = _rxControlFactory->createPropertyControl( PropertyControlType::MultiLineTextField, sal_False ); - break; - } - } - catch (Exception&) - { - OSL_FAIL("FormComponentPropertyHandler::impl_describeCursorSource_nothrow: caught an exception !"); - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_fillTableNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const - { - OSL_PRECOND( m_xRowSetConnection.is(), "FormComponentPropertyHandler::impl_fillTableNames_throw: need a connection!" ); - _out_rNames.resize( 0 ); - - Reference< XTablesSupplier > xSupplyTables( m_xRowSetConnection, UNO_QUERY ); - Reference< XNameAccess > xTableNames; - if ( xSupplyTables.is() ) - xTableNames = xSupplyTables->getTables(); - DBG_ASSERT( xTableNames.is(), "FormComponentPropertyHandler::impl_fillTableNames_throw: no way to obtain the tables of the connection!" ); - if ( !xTableNames.is() ) - return; - - Sequence< ::rtl::OUString> aTableNames = xTableNames->getElementNames(); - sal_uInt32 nCount = aTableNames.getLength(); - const ::rtl::OUString* pTableNames = aTableNames.getConstArray(); - - for ( sal_uInt32 i=0; i& _out_rNames ) const - { - OSL_PRECOND( m_xRowSetConnection.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: need a connection!" ); - _out_rNames.resize( 0 ); - - Reference< XQueriesSupplier > xSupplyQueries( m_xRowSetConnection, UNO_QUERY ); - Reference< XNameAccess > xQueryNames; - if ( xSupplyQueries.is() ) - { - xQueryNames = xSupplyQueries->getQueries(); - impl_fillQueryNames_throw(xQueryNames,_out_rNames); - } - } - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,::std::vector< ::rtl::OUString >& _out_rNames,const ::rtl::OUString& _sName ) const - { - DBG_ASSERT( _xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); - if ( !_xQueryNames.is() ) - return; - - Sequence< ::rtl::OUString> aQueryNames = _xQueryNames->getElementNames(); - sal_uInt32 nCount = aQueryNames.getLength(); - const ::rtl::OUString* pQueryNames = aQueryNames.getConstArray(); - sal_Bool bAdd = _sName.getLength(); - - for ( sal_uInt32 i=0; i xSubQueries(_xQueryNames->getByName(*pQueryNames),UNO_QUERY); - if ( xSubQueries.is() ) - impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); - else - _out_rNames.push_back( sTemp.makeStringAndClear() ); - } - } - - //------------------------------------------------------------------------ - void FormComponentPropertyHandler::impl_describeListSourceUI_throw( LineDescriptor& _out_rDescriptor, const Reference< XPropertyControlFactory >& _rxControlFactory ) const - { - OSL_PRECOND( m_xComponent.is(), "FormComponentPropertyHandler::impl_describeListSourceUI_throw: no component!" ); - - //////////////////////////////////////////////////////////// - // Auslesen des ListSourceTypes - Any aListSourceType( m_xComponent->getPropertyValue( PROPERTY_LISTSOURCETYPE ) ); - - sal_Int32 nListSourceType = ListSourceType_VALUELIST; - ::cppu::enum2int( nListSourceType, aListSourceType ); - - _out_rDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( PROPERTY_ID_LISTSOURCE ); - _out_rDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( PROPERTY_ID_LISTSOURCE ) ); - - //////////////////////////////////////////////////////////// - // Enums setzen - switch( nListSourceType ) - { - case ListSourceType_VALUELIST: - _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( PropertyControlType::StringListField, sal_False ); - break; - - case ListSourceType_TABLEFIELDS: - case ListSourceType_TABLE: - case ListSourceType_QUERY: - { - ::std::vector< ::rtl::OUString > aListEntries; - if ( impl_ensureRowsetConnection_nothrow() ) - { - if ( nListSourceType == ListSourceType_QUERY ) - impl_fillQueryNames_throw( aListEntries ); - else - impl_fillTableNames_throw( aListEntries ); - } - _out_rDescriptor.Control = PropertyHandlerHelper::createComboBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False ); - } - break; - case ListSourceType_SQL: - case ListSourceType_SQLPASSTHROUGH: - impl_ensureRowsetConnection_nothrow(); - _out_rDescriptor.HasPrimaryButton = m_xRowSetConnection.is(); - break; - } - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogListSelection_nothrow( const ::rtl::OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - OSL_PRECOND( m_pInfoService.get(), "FormComponentPropertyHandler::impl_dialogListSelection_nothrow: no property meta data!" ); - - String sPropertyUIName( m_pInfoService->getPropertyTranslation( m_pInfoService->getPropertyId( _rProperty ) ) ); - ListSelectionDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, _rProperty, sPropertyUIName ); - _rClearBeforeDialog.clear(); - return ( RET_OK == aDialog.Execute() ); - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow( bool _bFilter, ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - OSL_PRECOND( Reference< XRowSet >( m_xComponent, UNO_QUERY ).is(), - "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: to be called for forms only!" ); - - _out_rSelectedClause = ::rtl::OUString(); - bool bSuccess = false; - SQLExceptionInfo aErrorInfo; - try - { - if ( !impl_ensureRowsetConnection_nothrow() ) - return false; - - // get a composer for the statement which the form is currently based on - Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_aContext.getLegacyServiceFactory() ) ); - OSL_ENSURE( xComposer.is(), "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: could not obtain a composer!" ); - if ( !xComposer.is() ) - return false; - - ::rtl::OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( _bFilter ? PROPERTY_ID_FILTER : PROPERTY_ID_SORT ) ); - - const sal_Char* pAsciiServiceName = _bFilter ? "com.sun.star.sdb.FilterDialog" : "com.sun.star.sdb.OrderDialog"; - - // create the dialog - Reference< XExecutableDialog > xDialog; - if ( !m_aContext.createComponent( pAsciiServiceName, xDialog ) ) - { - ShowServiceNotAvailableError( impl_getDefaultDialogParent_nothrow(), ::rtl::OUString::createFromAscii( pAsciiServiceName ), sal_True ); - return false; - } - - // initialize the dialog - Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) ), makeAny( xComposer ) ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) ), makeAny( m_xComponent ) ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( impl_getDefaultDialogParent_nothrow() ) ) ); - xDialogProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), makeAny( sPropertyUIName ) ); - - _rClearBeforeDialog.clear(); - bSuccess = ( xDialog->execute() != 0 ); - if ( bSuccess ) - _out_rSelectedClause = _bFilter ? xComposer->getFilter() : xComposer->getOrder(); - } - catch (SQLContext& e) { aErrorInfo = e; } - catch (SQLWarning& e) { aErrorInfo = e; } - catch (SQLException& e) { aErrorInfo = e; } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: caught an exception!" ); - } - - if ( aErrorInfo.isValid() ) - impl_displaySQLError_nothrow( aErrorInfo ); - - return bSuccess; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - Reference< XForm > xDetailForm( m_xComponent, UNO_QUERY ); - Reference< XForm > xMasterForm( m_xObjectParent, UNO_QUERY ); - uno::Reference xMasterProp(m_xObjectParent,uno::UNO_QUERY); - OSL_PRECOND( xDetailForm.is() && xMasterForm.is(), "FormComponentPropertyHandler::impl_dialogLinkedFormFields_nothrow: no forms!" ); - if ( !xDetailForm.is() || !xMasterForm.is() ) - return false; - - - FormLinkDialog aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, xMasterProp, m_aContext.getLegacyServiceFactory() ); - _rClearBeforeDialog.clear(); - return ( RET_OK == aDialog.Execute() ); - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogFormatting_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - bool bChanged = false; - try - { - // create the itemset for the dialog - SfxItemSet aCoreSet(SFX_APP()->GetPool(), - SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, - SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO, - 0); // ripped this somewhere ... don't understand it :( - - // get the number formats supplier - Reference< XNumberFormatsSupplier > xSupplier; - m_xComponent->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier; - - DBG_ASSERT(xSupplier.is(), "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" ); - Reference< XUnoTunnel > xTunnel( xSupplier, UNO_QUERY_THROW ); - SvNumberFormatsSupplierObj* pSupplier = - reinterpret_cast< SvNumberFormatsSupplierObj* >( xTunnel->getSomething( SvNumberFormatsSupplierObj::getUnoTunnelId() ) ); - DBG_ASSERT( pSupplier != NULL, "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: invalid call !" ); - - sal_Int32 nFormatKey = 0; - impl_getPropertyValue_throw( PROPERTY_FORMATKEY ) >>= nFormatKey; - aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormatKey ) ); - - SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter(); - double dPreviewVal = OFormatSampleControl::getPreviewValue(pFormatter,nFormatKey); - SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, String( PcrRes( RID_STR_TEXT_FORMAT ) ), SID_ATTR_NUMBERFORMAT_INFO ); - aCoreSet.Put( aFormatter ); - - // a tab dialog with a single page - ::std::auto_ptr< SfxSingleTabDialog > pDialog( new SfxSingleTabDialog( impl_getDefaultDialogParent_nothrow(), aCoreSet, 0 ) ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT( pFact, "CreateFactory fail!" ); - ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ); - if ( !fnCreatePage ) - throw RuntimeException(); // caught below - - SfxTabPage* pPage = (*fnCreatePage)( pDialog.get(), aCoreSet ); - pDialog->SetTabPage( pPage ); - - _rClearBeforeDialog.clear(); - if ( RET_OK == pDialog->Execute() ) - { - const SfxItemSet* pResult = pDialog->GetOutputItemSet(); - - const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - const SvxNumberInfoItem* pInfoItem = dynamic_cast< const SvxNumberInfoItem* >( pItem ); - if (pInfoItem && pInfoItem->GetDelCount()) - { - const sal_uInt32* pDeletedKeys = pInfoItem->GetDelArray(); - - for (sal_uInt16 i=0; i< pInfoItem->GetDelCount(); ++i, ++pDeletedKeys) - pFormatter->DeleteEntry(*pDeletedKeys); - } - - pItem = NULL; - if ( SFX_ITEM_SET == pResult->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_False, &pItem ) ) - { - _out_rNewValue <<= (sal_Int32)( static_cast< const SfxUInt32Item* >( pItem )->GetValue() ); - bChanged = true; - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_dialogFormatting_nothrow: : caught an exception!" ); - } - return bChanged; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - bool bIsLink = true;// reflect the legacy behavior - ::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL ); - - ::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC); - - aFileDlg.SetTitle(aStrTrans); - // non-linked images ( e.g. those located in the document - // stream ) only if document is available - Reference< XModel > xModel( impl_getContextDocument_nothrow() ); - bool bHandleNonLink = xModel.is(); - - Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY); - DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!"); - if (xController.is()) - { - // do a preview by default - xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); - - xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(bIsLink)); - xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink ); - - } - - ::rtl::OUString sCurValue; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue ); - if ( sCurValue.getLength() != 0 && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 ) - { - aFileDlg.SetDisplayDirectory( sCurValue ); - // TODO: need to set the display directory _and_ the default name - } - - _rClearBeforeDialog.clear(); - bool bSuccess = ( 0 == aFileDlg.Execute() ); - if ( bSuccess ) - { - if ( bHandleNonLink && xController.is() ) - { - xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink; - } - if ( !bIsLink ) - { - Graphic aGraphic; - aFileDlg.GetGraphic( aGraphic ); - - Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() ); - xGrfObj->setGraphic( aGraphic.GetXGraphic() ); - - - _out_rNewValue <<= xGrfObj; - - } - else - _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath(); - } - return bSuccess; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_browseForTargetURL_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - ::sfx2::FileDialogHelper aFileDlg( WB_3DLOOK ); - - ::rtl::OUString sURL; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_TARGET_URL ) >>= sURL ); - INetURLObject aParser( sURL ); - if ( INET_PROT_FILE == aParser.GetProtocol() ) - // set the initial directory only for file-URLs. Everything else - // is considered to be potentially expensive - aFileDlg.SetDisplayDirectory( sURL ); - - _rClearBeforeDialog.clear(); - bool bSuccess = ( 0 == aFileDlg.Execute() ); - if ( bSuccess ) - _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath(); - return bSuccess; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_executeFontDialog_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - bool bSuccess = false; - - // create an item set for use with the dialog - SfxItemSet* pSet = NULL; - SfxItemPool* pPool = NULL; - SfxPoolItem** pDefaults = NULL; - ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults); - ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet); - - { // do this in an own block. The dialog needs to be destroyed before we call - // destroyItemSet - ControlCharacterDialog aDlg( impl_getDefaultDialogParent_nothrow(), *pSet ); - _rClearBeforeDialog.clear(); - if ( RET_OK == aDlg.Execute() ) - { - const SfxItemSet* pOut = aDlg.GetOutputItemSet(); - if ( pOut ) - { - Sequence< NamedValue > aFontPropertyValues; - ControlCharacterDialog::translateItemsToProperties( *pOut, aFontPropertyValues ); - _out_rNewValue <<= aFontPropertyValues; - bSuccess = true; - } - } - } - - ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults); - return bSuccess; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_browseForDatabaseDocument_throw( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - ::sfx2::FileDialogHelper aFileDlg(WB_3DLOOK|WB_OPEN,::String::CreateFromAscii("sdatabase")); - - ::rtl::OUString sDataSource; - OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_DATASOURCE ) >>= sDataSource ); - INetURLObject aParser( sDataSource ); - if ( INET_PROT_FILE == aParser.GetProtocol() ) - // set the initial directory only for file-URLs. Everything else - // is considered to be potentially expensive - aFileDlg.SetDisplayDirectory( sDataSource ); - - const String s_sDatabaseType = String::CreateFromAscii("StarOffice XML (Base)"); - const SfxFilter* pFilter = SfxFilter::GetFilterByName( s_sDatabaseType); - OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!"); - if ( pFilter ) - { - aFileDlg.SetCurrentFilter(pFilter->GetUIName()); - //aFileDlg.AddFilter(pFilter->GetFilterName(),pFilter->GetDefaultExtension()); - } - - _rClearBeforeDialog.clear(); - bool bSuccess = ( 0 == aFileDlg.Execute() ); - if ( bSuccess ) - _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath(); - return bSuccess; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - sal_Int32 nColor = 0; - OSL_VERIFY( impl_getPropertyValue_throw( impl_getPropertyNameFromId_nothrow( _nColorPropertyId ) ) >>= nColor ); - ::Color aColor( nColor ); - SvColorDialog aColorDlg( impl_getDefaultDialogParent_nothrow() ); - aColorDlg.SetColor( aColor ); - - _rClearBeforeDialog.clear(); - if ( !aColorDlg.Execute() ) - return false; - - aColor = aColorDlg.GetColor(); - nColor = aColor.GetColor(); - _out_rNewValue <<= (sal_Int32)nColor; - return true; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogChooseLabelControl_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - OSelectLabelDialog dlgSelectLabel( impl_getDefaultDialogParent_nothrow(), m_xComponent ); - _rClearBeforeDialog.clear(); - bool bSuccess = ( RET_OK == dlgSelectLabel.Execute() ); - if ( bSuccess ) - _out_rNewValue <<= dlgSelectLabel.GetSelected(); - return bSuccess; - } - - //------------------------------------------------------------------------ - Reference< XControlContainer > FormComponentPropertyHandler::impl_getContextControlContainer_nothrow() const - { - Reference< XControlContainer > xControlContext( - m_aContext.getContextValueByAsciiName( "ControlContext" ), - UNO_QUERY ); - return xControlContext; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const - { - OSL_PRECOND( impl_getContextControlContainer_nothrow().is(), "FormComponentPropertyHandler::impl_dialogChangeTabOrder_nothrow: invalid control context!" ); - - Reference< XTabControllerModel > xTabControllerModel( impl_getRowSet_nothrow(), UNO_QUERY ); - TabOrderDialog aDialog( - impl_getDefaultDialogParent_nothrow(), - xTabControllerModel, - impl_getContextControlContainer_nothrow(), - m_aContext.getLegacyServiceFactory() - ); - _rClearBeforeDialog.clear(); - return ( RET_OK == aDialog.Execute() ); - } - - //------------------------------------------------------------------------ - namespace - { - //-------------------------------------------------------------------- - //- ISQLCommandPropertyUI - //-------------------------------------------------------------------- - class ISQLCommandPropertyUI : public ISQLCommandAdapter - { - public: - /** returns the empty-string-terminated list of names of properties - whose UI is to be disabled while the SQL command property is - being edited. - */ - virtual ::rtl::OUString* getPropertiesToDisable() = 0; - }; - - //-------------------------------------------------------------------- - //- SQLCommandPropertyUI - //-------------------------------------------------------------------- - class SQLCommandPropertyUI : public ISQLCommandPropertyUI - { - protected: - SQLCommandPropertyUI( const Reference< XPropertySet >& _rxObject ) - :m_xObject( _rxObject ) - { - if ( !m_xObject.is() ) - throw NullPointerException(); - } - - virtual oslInterlockedCount SAL_CALL acquire() - { - return osl_incrementInterlockedCount( &m_refCount ); - } - - virtual oslInterlockedCount SAL_CALL release() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - { - delete this; - return 0; - } - return m_refCount; - } - - protected: - Reference< XPropertySet > m_xObject; - - private: - oslInterlockedCount m_refCount; - }; - - //-------------------------------------------------------------------- - //- FormSQLCommandUI - declaration - //-------------------------------------------------------------------- - class FormSQLCommandUI : public SQLCommandPropertyUI - { - public: - FormSQLCommandUI( const Reference< XPropertySet >& _rxForm ); - - // ISQLCommandAdapter - virtual ::rtl::OUString getSQLCommand() const; - virtual sal_Bool getEscapeProcessing() const; - virtual void setSQLCommand( const ::rtl::OUString& _rCommand ) const; - virtual void setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const; - - // ISQLCommandPropertyUI - virtual ::rtl::OUString* getPropertiesToDisable(); - }; - - //-------------------------------------------------------------------- - //- FormSQLCommandUI - implementation - //-------------------------------------------------------------------- - //.................................................................... - FormSQLCommandUI::FormSQLCommandUI( const Reference< XPropertySet >& _rxForm ) - :SQLCommandPropertyUI( _rxForm ) - { - } - - //.................................................................... - ::rtl::OUString FormSQLCommandUI::getSQLCommand() const - { - ::rtl::OUString sCommand; - OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand ); - return sCommand; - } - - //.................................................................... - sal_Bool FormSQLCommandUI::getEscapeProcessing() const - { - sal_Bool bEscapeProcessing( sal_False ); - OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_ESCAPE_PROCESSING ) >>= bEscapeProcessing ); - return bEscapeProcessing; - } - - //.................................................................... - void FormSQLCommandUI::setSQLCommand( const ::rtl::OUString& _rCommand ) const - { - m_xObject->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) ); - } - - //.................................................................... - void FormSQLCommandUI::setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const - { - m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( _bEscapeProcessing ) ); - } - - //.................................................................... - ::rtl::OUString* FormSQLCommandUI::getPropertiesToDisable() - { - static ::rtl::OUString s_aCommandProps[] = { - PROPERTY_DATASOURCE, - PROPERTY_COMMAND, - PROPERTY_COMMANDTYPE, - PROPERTY_ESCAPE_PROCESSING, - ::rtl::OUString() - }; - return s_aCommandProps; - } - //-------------------------------------------------------------------- - //- ValueListCommandUI - declaration - //-------------------------------------------------------------------- - class ValueListCommandUI : public SQLCommandPropertyUI - { - public: - ValueListCommandUI( const Reference< XPropertySet >& _rxListOrCombo ); - - // ISQLCommandAdapter - virtual ::rtl::OUString getSQLCommand() const; - virtual sal_Bool getEscapeProcessing() const; - virtual void setSQLCommand( const ::rtl::OUString& _rCommand ) const; - virtual void setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const; - - // ISQLCommandPropertyUI - virtual ::rtl::OUString* getPropertiesToDisable(); - private: - mutable bool m_bPropertyValueIsList; - }; - - //-------------------------------------------------------------------- - //- ValueListCommandUI - implementation - //-------------------------------------------------------------------- - //.................................................................... - ValueListCommandUI::ValueListCommandUI( const Reference< XPropertySet >& _rxListOrCombo ) - :SQLCommandPropertyUI( _rxListOrCombo ) - ,m_bPropertyValueIsList( false ) - { - } - - //.................................................................... - ::rtl::OUString ValueListCommandUI::getSQLCommand() const - { - ::rtl::OUString sValue; - m_bPropertyValueIsList = false; - - // for combo boxes, the property is a mere string - Any aValue( m_xObject->getPropertyValue( PROPERTY_LISTSOURCE ) ); - if ( aValue >>= sValue ) - return sValue; - - Sequence< ::rtl::OUString > aValueList; - if ( aValue >>= aValueList ) - { - m_bPropertyValueIsList = true; - if ( aValueList.getLength() ) - sValue = aValueList[0]; - return sValue; - } - - OSL_FAIL( "ValueListCommandUI::getSQLCommand: unexpected property type!" ); - return sValue; - } - - //.................................................................... - sal_Bool ValueListCommandUI::getEscapeProcessing() const - { - enum ListSourceType eType( ListSourceType_SQL ); - OSL_VERIFY( m_xObject->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eType ); - OSL_ENSURE( ( eType == ListSourceType_SQL ) || ( eType == ListSourceType_SQLPASSTHROUGH ), - "ValueListCommandUI::getEscapeProcessing: unexpected list source type!" ); - return ( eType == ListSourceType_SQL ); - } - - //.................................................................... - void ValueListCommandUI::setSQLCommand( const ::rtl::OUString& _rCommand ) const - { - Any aValue; - if ( m_bPropertyValueIsList ) - aValue <<= Sequence< ::rtl::OUString >( &_rCommand, 1 ); - else - aValue <<= _rCommand; - m_xObject->setPropertyValue( PROPERTY_LISTSOURCE, aValue ); - } - - //.................................................................... - void ValueListCommandUI::setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const - { - m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, makeAny( - _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) ); - } - - //.................................................................... - ::rtl::OUString* ValueListCommandUI::getPropertiesToDisable() - { - static ::rtl::OUString s_aListSourceProps[] = { - PROPERTY_LISTSOURCETYPE, - PROPERTY_LISTSOURCE, - ::rtl::OUString() - }; - return s_aListSourceProps; - } - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_doDesignSQLCommand_nothrow( const Reference< XObjectInspectorUI >& _rxInspectorUI, PropertyId _nDesignForProperty ) - { - try - { - if ( m_xCommandDesigner.is() ) - { - if ( m_xCommandDesigner->isActive() ) - { - m_xCommandDesigner->raise(); - return true; - } - m_xCommandDesigner->dispose(); - m_xCommandDesigner.set( NULL ); - } - - if ( !impl_ensureRowsetConnection_nothrow() ) - return false; - - Reference< XPropertySet > xComponentProperties( m_xComponent, UNO_QUERY_THROW ); - - ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI; - switch ( _nDesignForProperty ) - { - case PROPERTY_ID_COMMAND: - xCommandUI = new FormSQLCommandUI( xComponentProperties ); - break; - case PROPERTY_ID_LISTSOURCE: - xCommandUI = new ValueListCommandUI( xComponentProperties ); - break; - default: - OSL_FAIL( "FormComponentPropertyHandler::OnDesignerClosed: invalid property id!" ); - return false; - } - - m_xCommandDesigner.set( new SQLCommandDesigner( m_aContext.getUNOContext(), xCommandUI.get(), m_xRowSetConnection, LINK( this, FormComponentPropertyHandler, OnDesignerClosed ) ) ); - - DBG_ASSERT( _rxInspectorUI.is(), "FormComponentPropertyHandler::OnDesignerClosed: no access to the property browser ui!" ); - if ( m_xCommandDesigner->isActive() && _rxInspectorUI.is() ) - { - m_xBrowserUI = _rxInspectorUI; - // disable everything which would affect this property - const ::rtl::OUString* pToDisable = xCommandUI->getPropertiesToDisable(); - while ( pToDisable->getLength() ) - { - m_xBrowserUI->enablePropertyUIElements( *pToDisable++, PropertyLineElement::All, sal_False ); - } - - // but enable the browse button for the property itself - so it can be used to raise the query designer - ::rtl::OUString sPropertyName( impl_getPropertyNameFromId_nothrow( _nDesignForProperty ) ); - m_xBrowserUI->enablePropertyUIElements( sPropertyName, PropertyLineElement::PrimaryButton, sal_True ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return m_xCommandDesigner.is(); - } - - //------------------------------------------------------------------------ - IMPL_LINK( FormComponentPropertyHandler, OnDesignerClosed, void*, /*NOTINTERESTEDIN*/ ) - { - OSL_ENSURE( m_xBrowserUI.is() && m_xCommandDesigner.is(), "FormComponentPropertyHandler::OnDesignerClosed: too many NULLs!" ); - if ( m_xBrowserUI.is() && m_xCommandDesigner.is() ) - { - try - { - ::rtl::Reference< ISQLCommandPropertyUI > xCommandUI( - dynamic_cast< ISQLCommandPropertyUI* >( m_xCommandDesigner->getPropertyAdapter().get() ) ); - if ( !xCommandUI.is() ) - throw NullPointerException(); - - const ::rtl::OUString* pToEnable = xCommandUI->getPropertiesToDisable(); - while ( pToEnable->getLength() ) - { - m_xBrowserUI->enablePropertyUIElements( *pToEnable++, PropertyLineElement::All, sal_True ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - return 0L; - } - - //------------------------------------------------------------------------ - bool FormComponentPropertyHandler::impl_hasValidDataSourceSignature_nothrow( const Reference< XPropertySet >& _xFormProperties, bool _bAllowEmptyDataSourceName ) SAL_THROW(()) - { - bool bHas = false; - if ( _xFormProperties.is() ) - { - try - { - ::rtl::OUString sPropertyValue; - // first, we need the name of an existent data source - if ( _xFormProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_DATASOURCE) ) - _xFormProperties->getPropertyValue( PROPERTY_DATASOURCE ) >>= sPropertyValue; - bHas = ( sPropertyValue.getLength() != 0 ) || _bAllowEmptyDataSourceName; - - // then, the command should not be empty - if ( bHas ) - { - if ( _xFormProperties->getPropertySetInfo()->hasPropertyByName(PROPERTY_COMMAND) ) - _xFormProperties->getPropertyValue( PROPERTY_COMMAND ) >>= sPropertyValue; - bHas = ( sPropertyValue.getLength() != 0 ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "FormComponentPropertyHandler::impl_hasValidDataSourceSignature_nothrow: caught an exception!" ); - } - } - return bHas; - } - //------------------------------------------------------------------------ - ::rtl::OUString FormComponentPropertyHandler::impl_getDocumentURL_nothrow() const - { - ::rtl::OUString sURL; - try - { - Reference< XModel > xDocument( impl_getContextDocument_nothrow() ); - if ( xDocument.is() ) - sURL = xDocument->getURL(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return sURL; - } - // ------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* FormComponentPropertyHandler::createArrayHelper( ) const - { - uno::Sequence< beans::Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); - - } - // ------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper & FormComponentPropertyHandler::getInfoHelper() - { - return *const_cast(this)->getArrayHelper(); - } - // ----------------------------------------------------------------------------- - uno::Reference< beans::XPropertySetInfo > SAL_CALL FormComponentPropertyHandler::getPropertySetInfo( ) throw(uno::RuntimeException) - { - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx deleted file mode 100644 index f27af2671..000000000 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ /dev/null @@ -1,481 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX - -#include "propertyhandler.hxx" -#include "sqlcommanddesign.hxx" -#include "pcrcommon.hxx" -#include -#include -#include -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= ComponentClassification - //==================================================================== - enum ComponentClassification - { - eFormControl, - eDialogControl, - eUnknown - }; - - //==================================================================== - //= FormComponentPropertyHandler - //==================================================================== - class FormComponentPropertyHandler; - typedef HandlerComponentBase< FormComponentPropertyHandler > FormComponentPropertyHandler_Base; - typedef ::comphelper::OPropertyArrayUsageHelper FormComponentPropertyHandler_PROP; - /** default ->XPropertyHandler for all form components. - */ - class FormComponentPropertyHandler : public FormComponentPropertyHandler_Base, - public ::comphelper::OPropertyContainer, - public FormComponentPropertyHandler_PROP - { - private: - /// access to property states - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > m_xPropertyState; - /// the parent of our component - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xObjectParent; - - /// the database connection. Owned by us if and only if we created it ourself. - mutable ::dbtools::SharedConnection m_xRowSetConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; - /** helper component encapsulating the handling for the QueryDesign component for - interactively designing an SQL command - */ - ::rtl::Reference< SQLCommandDesigner > m_xCommandDesigner; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > m_xBrowserUI; - - /// the string indicating a "default" (VOID) value in list-like controls - ::rtl::OUString m_sDefaultValueString; - /// all properties to whose control's we added ->m_sDefaultValueString - ::std::set< ::rtl::OUString > m_aPropertiesWithDefListEntry; - /// type of our component - ComponentClassification m_eComponentClass; - /// is our component a (database) sub form? - bool m_bComponentIsSubForm : 1; - /// our component has a "ListSource" property - bool m_bHaveListSource : 1; - /// our component has a "Command" property - bool m_bHaveCommand : 1; - /// the class id of the component - if appliable - sal_Int16 m_nClassId; - - public: - FormComponentPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - DECLARE_XINTERFACE( ) - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~FormComponentPropertyHandler(); - - protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - // XPropertyHandler overridables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL disposing(); - - // PropertyHandler - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - virtual void onNewComponent(); - - private: - /** initializes some (cached) meta data about the component - @throws RuntimeException - if a serious error occurs, for instance if the component does not provide an XPropertySetInfo instance - */ - void impl_initComponentMetaData_throw(); - - /** classifies our component, in case it's a control model, by ClassId - - Note that UNO dialog controls are also classified, though they don't have the ClassId property - */ - void impl_classifyControlModel_throw(); - - /** const-version of ->getPropertyValue - */ - ::com::sun::star::uno::Any impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ) const; - - // some property values are faked, and not used in the way they're provided by our component - void impl_normalizePropertyValue_nothrow( ::com::sun::star::uno::Any& _rValue, PropertyId _nPropId ) const; - - /** determines whether we should exclude a given property from our "supported properties" - */ - bool impl_shouldExcludeProperty_nothrow( const ::com::sun::star::beans::Property& _rProperty ) const; - - /** initializes the list of field names, if we're handling a control which supports the - DataField property - */ - void impl_initFieldList_nothrow( ::std::vector< ::rtl::OUString >& rFieldNames ) const; - - /** obtaines the RowSet to which our component belongs - - If the component is a RowSet itself, it's returned directly. Else, the parent - is examined for the XRowSet interface. If the parent is no XRowSet, then - a check is made whether our component is a grid control column, and if so, - the parent of the grid control is examied for the XRowSet interace. - - Normally, at least one of those methods should succeed. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > impl_getRowSet_throw( ) const; - - /** nothrow-version of ->impl_getRowSet_throw - */ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > impl_getRowSet_nothrow( ) const; - - /** connects the row set belonging to our introspected data aware form component, - and remembers the connection in ->m_xRowSetConnection. - - If the row set already is connected, ->m_xRowSetConnection will be set, too, but - not take the ownership of the connection. - - If ->m_xRowSetConnection is already set, nothing happens, so if you want to - force creation of a connection, you need to clear ->m_xRowSetConnection. - */ - bool impl_ensureRowsetConnection_nothrow() const; - - /** clears ->m_xRowSetConnection - */ - void impl_clearRowsetConnection_nothrow(); - - /** fills an ->LineDescriptor with information to represent a cursor source - of our form - that is, a table, a query, or an SQL statement. - - As an example, if our form has currently a CommandType of TABLE, then the - value list in the LineDescriptor will contain a list of all tables - of the data source which the form is bound to. - - @seealso impl_fillTableNames_throw - @seealso impl_fillQueryNames_throw - */ - void impl_describeCursorSource_nothrow( - ::com::sun::star::inspection::LineDescriptor& _out_rProperty, - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory - ) const; - - /** describes the UI for selecting a table name - - @precond - m_xRowSetConnection is not - */ - void impl_fillTableNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const; - - /** describes the UI for selecting a query name - - @precond - m_xRowSetConnection is not - */ - void impl_fillQueryNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const; - - /** describes the UI for selecting a query name - - @precond - m_xRowSetConnection is not - */ - void impl_fillQueryNames_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xQueryNames - ,::std::vector< ::rtl::OUString >& _out_rNames - ,const ::rtl::OUString& _sName = ::rtl::OUString() ) const; - - /** describes the UI for selecting a ListSource (for list-like form controls) - @precond - ->m_xRowSetConnection is not - @precond - ->m_xComponent is not - */ - void impl_describeListSourceUI_throw( - ::com::sun::star::inspection::LineDescriptor& _out_rDescriptor, - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory - ) const; - - /** displays a datbase-related error to the user - */ - void impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const; - - /** let's the user chose a selection of entries from a string list, and stores this - selection in the given property - @return - if and only if the user successfully changed the property - */ - bool impl_dialogListSelection_nothrow( const ::rtl::OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog for chosing a filter or sort criterion for a database form - @param _bFilter - if the Filter property should be used, if it's the Order - property - @param _out_rSelectedClause - the filter or order clause as chosen by the user - @precond - we're really inspecting a database form (well, a RowSet at least) - @return - if and only if the user successfully chose a clause - */ - bool impl_dialogFilterOrSort_nothrow( bool _bFilter, ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog which allows the user to chose the columns linking - a sub to a master form, and sets the respective MasterFields / SlaveFields - properties at the form. - @precond - we're inspecting (sub) database form - @return - if and only if the user successfully eneter master and slave fields - */ - bool impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog which allows the user to modify the FormatKey - property of our component, by chosing a (number) format. - @precond - Our component actually has a FormatKey property. - @param _out_rNewValue - the new property value, if the user chose a new formatting - @return - if and only if a new formatting has been chosen by the user. - In this case, ->_out_rNewValue is filled with the new property value - */ - bool impl_dialogFormatting_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog which allows to the user to change the ImageURL property - of our component by browsing for an image file. - @precond - our component actually has a ImageURL property - @param _out_rNewValue - the new property value, if the user chose a new image url - @return - if and only if a new image URL has been chosen by the user. - In this case, ->_out_rNewValue is filled with the new property value - */ - bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog which allows the user to change the TargetURL property of - our component - @precond - our component actually has a TargetURL property - @param _out_rNewValue - the new property value, if the user chose a new TargetURL - @return - if and only if a new TargetURL has been chosen by the user. - In this case, ->_out_rNewValue is filled with the new property value - */ - bool impl_browseForTargetURL_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** executes a dialog which allows the user to change the font, plus related properties, - of our component - @precond - our component actually has a Font property - @param _out_rNewValue - a value desribing the new font, as Sequence< NamedValue > - @return - if and only if the user successfully changed the font of our component - */ - bool impl_executeFontDialog_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** allows the user browsing for a database document - @precond - our component actually has a DataSource property - @param _out_rNewValue - the new property value, if the user chose a new DataSource - @return - if and only if a new DataSource has been chosen by the user. - In this case, ->_out_rNewValue is filled with the new property value - */ - bool impl_browseForDatabaseDocument_throw( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** raises a dialog which allows the user to choose a color - @param _nColorPropertyId - the ID of the color property - @param _out_rNewValue - the chosen color value - @return - if and only if a color was chosen by the user - */ - bool impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** raises a dialog which allows the user to choose a label control for our component - @param _out_rNewValue - the chosen label control, if any - @return - if and only if a label control was chosen by the user - */ - bool impl_dialogChooseLabelControl_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** raises a dialog which lets the user chose the tab order of controls of a form - @precond - we have a view control container in which our controls live - @return - if and only if the user successfully changed the tab order - @seealso impl_getContextControlContainer_nothrow - */ - bool impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; - - /** retrieves the context for controls, whose model(s) we're inspecting - - If we're inspecting a control model, this is usually part of a set of controls - and control models, where the controls live in a certain context (a ->XControlContainer). - If we know this context, we can enable additional special functionality. - - The ->XComponentContext in which we were created is examined for a value - named "ControlContext", and this value is returned. - */ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - impl_getContextControlContainer_nothrow() const; - - /** opens a query design window for interactively designing the SQL command of a - database form - @param _rxUIUpdate - access to the property browser UI - @param _nDesignForProperty - the ID for the property for which the designer is opened - @return - if the window was successfully opened, or was previously open, - otherwise - */ - bool impl_doDesignSQLCommand_nothrow( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, - PropertyId _nDesignForProperty - ); - - /** updates a property (UI) whose state depends on more than one other property - - ->actuatingPropertyChanged is called for certain properties in whose changes - we expressed interes (->getActuatingProperty). Now such a property change can - result in simple UI updates, for instance another property being enabled or disabled. - - However, it can also result in a more complex change: The current (UI) state might - depend on the value of more than one other property. Those dependent properties (their - UI, more precisly) are updated in this method. - - @param _nPropid - the ->PropertyId of the dependent property whose UI state is to be updated - - @param _rxInspectorUI - provides access to the property browser UI. Must not be . - */ - void impl_updateDependentProperty_nothrow( PropertyId _nPropId, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) const; - - /** determines whether the given form has a valid data source signature. - - Valid here means that the DataSource property denotes an existing data source, and the - Command property is not empty. No check is made whether the value of the Command property - denotes an existent object, since this would be way too expensive. - - @param _xFormProperties - the form to check. Must not be . - @param _bAllowEmptyDataSourceName - determine whether an empty data source name is allowed (), and should not - lead to rejection - */ - static bool impl_hasValidDataSourceSignature_nothrow( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xFormProperties, - bool _bAllowEmptyDataSourceName ); - - /** returns the URL of our context document - @return - */ - ::rtl::OUString impl_getDocumentURL_nothrow() const; - - private: - DECL_LINK( OnDesignerClosed, void* ); - - private: - FormComponentPropertyHandler(); // never implemented - FormComponentPropertyHandler( const FormComponentPropertyHandler& ); // never implemented - FormComponentPropertyHandler& operator=( const FormComponentPropertyHandler& ); // never implemented - - private: - using ::comphelper::OPropertyContainer::addPropertyChangeListener; - using ::comphelper::OPropertyContainer::removePropertyChangeListener; - }; - - //==================================================================== - //= WaitCursor - //==================================================================== - /** wrapper around a ->WaitObject which can cope with a NULL window - */ - class WaitCursor - { - private: - ::std::auto_ptr< WaitObject > m_aWaitObject; - - public: - WaitCursor( Window* _pWindow ) - { - if ( _pWindow ) - m_aWaitObject.reset( new WaitObject( _pWindow ) ); - } - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx deleted file mode 100644 index 34673bdec..000000000 --- a/extensions/source/propctrlr/formcontroller.cxx +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "formcontroller.hxx" -#include "pcrcommon.hxx" -#include "formstrings.hxx" -#include "defaultforminspection.hxx" -#include "propctrlr.hrc" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_FormController() -{ - ::pcr::OAutoRegistration< ::pcr::FormController > aFormControllerRegistration; - ::pcr::OAutoRegistration< ::pcr::DialogController > aDialogControllerRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::TypeClass_INTERFACE; - using ::com::sun::star::uno::TypeClass_STRING; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::inspection::XObjectInspectorModel; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::beans::Property; - using ::com::sun::star::uno::Any; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::Type; - using ::com::sun::star::util::VetoException; - using ::com::sun::star::beans::PropertyVetoException; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::form::XGridColumnFactory; - using ::com::sun::star::form::XForm; - using ::com::sun::star::container::XChild; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::awt::XWindow; - /** === end UNO using === **/ - - namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; - - //==================================================================== - //= FormController - //==================================================================== - //-------------------------------------------------------------------- - FormController::FormController( const Reference< XComponentContext >& _rxContext, ServiceDescriptor _aServiceDescriptor, - bool _bUseFormFormComponentHandlers ) - :OPropertyBrowserController( _rxContext ) - ,FormController_PropertyBase1( m_aBHelper ) - ,m_aServiceDescriptor( _aServiceDescriptor ) - { - osl_incrementInterlockedCount( &m_refCount ); - { - Reference< XObjectInspectorModel > xModel( - *(new DefaultFormComponentInspectorModel( _rxContext, _bUseFormFormComponentHandlers )), - UNO_QUERY_THROW - ); - setInspectorModel( xModel ); - } - osl_decrementInterlockedCount( &m_refCount ); - } - - //------------------------------------------------------------------------ - FormController::~FormController() - { - } - - //------------------------------------------------------------------------ - IMPLEMENT_FORWARD_XINTERFACE2( FormController, OPropertyBrowserController, FormController_PropertyBase1 ) - - //------------------------------------------------------------------------ - Sequence< Type > SAL_CALL FormController::getTypes( ) throw(RuntimeException) - { - ::cppu::OTypeCollection aTypes( - ::getCppuType( static_cast< Reference< XPropertySet >* >(NULL) ), - ::getCppuType( static_cast< Reference< XMultiPropertySet >* >(NULL) ), - ::getCppuType( static_cast< Reference< XFastPropertySet >* >(NULL) ), - OPropertyBrowserController::getTypes()); - return aTypes.getTypes(); - } - - //------------------------------------------------------------------------ - IMPLEMENT_GET_IMPLEMENTATION_ID( FormController ) - - //------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL FormController::getImplementationName( ) throw(RuntimeException) - { - return m_aServiceDescriptor.GetImplementationName(); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL FormController::getSupportedServiceNames( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( m_aServiceDescriptor.GetSupportedServiceNames() ); - aSupported.realloc( aSupported.getLength() + 1 ); - aSupported[ aSupported.getLength() - 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.ObjectInspector" ) ); - return aSupported; - } - - //------------------------------------------------------------------------ - ::rtl::OUString FormController::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.extensions.FormController")); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > FormController::getSupportedServiceNames_static( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.PropertyBrowserController")); - return aSupported; - } - - //------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL FormController::Create(const Reference< XComponentContext >& _rxContext ) - { - ServiceDescriptor aService; - aService.GetImplementationName = &FormController::getImplementationName_static; - aService.GetSupportedServiceNames = &FormController::getSupportedServiceNames_static; - return *(new FormController( _rxContext, aService, true ) ); - } - - //------------------------------------------------------------------------ - Reference< XPropertySetInfo > SAL_CALL FormController::getPropertySetInfo( ) throw(RuntimeException) - { - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); - } - - //------------------------------------------------------------------------ - ::cppu::IPropertyArrayHelper& SAL_CALL FormController::getInfoHelper() - { - return *getArrayHelper(); - } - - //------------------------------------------------------------------------ - ::cppu::IPropertyArrayHelper* FormController::createArrayHelper( ) const - { - Sequence< Property > aProps( 2 ); - aProps[0] = Property( - PROPERTY_CURRENTPAGE, - OWN_PROPERTY_ID_CURRENTPAGE, - ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ), - PropertyAttribute::TRANSIENT - ); - aProps[1] = Property( - PROPERTY_INTROSPECTEDOBJECT, - OWN_PROPERTY_ID_INTROSPECTEDOBJECT, - XPropertySet::static_type(), - PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED - ); - return new ::cppu::OPropertyArrayHelper( aProps ); - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL FormController::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException) - { - switch ( nHandle ) - { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: - if ( rValue.getValueTypeClass() != TypeClass_INTERFACE ) - throw IllegalArgumentException(); - break; - case OWN_PROPERTY_ID_CURRENTPAGE: - if ( rValue.getValueTypeClass() != TypeClass_STRING ) - throw IllegalArgumentException(); - break; - } - - getFastPropertyValue( rOldValue, nHandle ); - rConvertedValue = rValue; - return sal_True; - } - - //------------------------------------------------------------------------ - void SAL_CALL FormController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception) - { - switch ( _nHandle ) - { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: - { - Reference< XObjectInspectorModel > xModel( getInspectorModel() ); - if ( xModel.is() ) - { - try - { - m_xCurrentInspectee.set( _rValue, UNO_QUERY ); - Sequence< Reference< XInterface > > aObjects; - if ( m_xCurrentInspectee.is() ) - { - aObjects.realloc( 1 ); - aObjects[0] = m_xCurrentInspectee; - } - - Reference< XObjectInspector > xInspector( *this, UNO_QUERY_THROW ); - xInspector->inspect( aObjects ); - } - catch( const VetoException& e ) - { - throw PropertyVetoException( e.Message, e.Context ); - } - } - } - break; - case OWN_PROPERTY_ID_CURRENTPAGE: - restoreViewData( _rValue ); - break; - } - } - - //------------------------------------------------------------------------ - void SAL_CALL FormController::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const - { - switch ( nHandle ) - { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: - rValue <<= m_xCurrentInspectee; - break; - - case OWN_PROPERTY_ID_CURRENTPAGE: - rValue = const_cast< FormController* >( this )->getViewData(); - break; - } - } - - //==================================================================== - //= DialogController - //==================================================================== - //------------------------------------------------------------------------ - ::rtl::OUString DialogController::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.extensions.DialogController")); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > DialogController::getSupportedServiceNames_static( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PropertyBrowserController")); - return aSupported; - } - - //------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL DialogController::Create(const Reference< XComponentContext >& _rxContext) - { - ServiceDescriptor aService; - aService.GetImplementationName = &DialogController::getImplementationName_static; - aService.GetSupportedServiceNames = &DialogController::getSupportedServiceNames_static; - return *(new FormController( _rxContext, aService, false ) ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcontroller.hxx b/extensions/source/propctrlr/formcontroller.hxx deleted file mode 100644 index fc398beb4..000000000 --- a/extensions/source/propctrlr/formcontroller.hxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX - -#include "propcontroller.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= ServiceDescriptor - //==================================================================== - struct ServiceDescriptor - { - ::rtl::OUString - ( *GetImplementationName )( void ); - ::com::sun::star::uno::Sequence< ::rtl::OUString > - ( *GetSupportedServiceNames )( void ); - }; - - //==================================================================== - //= FormController - //==================================================================== - class FormController; - typedef ::cppu::OPropertySetHelper FormController_PropertyBase1; - typedef ::comphelper::OPropertyArrayUsageHelper< FormController > FormController_PropertyBase2; - - /** Legacy implementation of com.sun.star.form.PropertyBrowserController - - Nowadays only a wrapper around an ObjectInspector using a - DefaultFormComponentInspectorModel. - */ - class FormController :public OPropertyBrowserController - ,public FormController_PropertyBase1 - ,public FormController_PropertyBase2 - { - private: - ServiceDescriptor m_aServiceDescriptor; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xCurrentInspectee; - bool m_bUseFormComponentHandlers; - public: - FormController( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, - ServiceDescriptor _aServiceDescriptor, - bool _bUseFormFormComponentHandlers - ); - - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); - - protected: - ~FormController(); - - DECLARE_XINTERFACE() - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XPropertySet and friends - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - 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); - virtual void SAL_CALL getFastPropertyValue( - ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle - ) const; - private: - using FormController_PropertyBase1::getFastPropertyValue; - }; - - //==================================================================== - //= DialogController - //==================================================================== - /** Legacy implementation of com.sun.star.awt.PropertyBrowserController - */ - class DialogController - { - public: - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); - - private: - DialogController(); // never implemented - DialogController( const DialogController& ); // never implemented - DialogController& operator=( const DialogController& ); // never implemented - }; -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMCONTROLLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx deleted file mode 100644 index 9f02c35b1..000000000 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ /dev/null @@ -1,829 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "propertyhandler.hxx" -#include "formmetadata.hxx" -#include "formstrings.hxx" -#include "handlerhelper.hxx" -#include "cellbindinghelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === 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::uno::XComponentContext; - using ::com::sun::star::beans::UnknownPropertyException; - using ::com::sun::star::beans::Property; - using ::com::sun::star::awt::XControlModel; - using ::com::sun::star::drawing::XControlShape; - using ::com::sun::star::container::XMap; - using ::com::sun::star::inspection::LineDescriptor; - using ::com::sun::star::inspection::XPropertyControlFactory; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::beans::Optional; - using ::com::sun::star::inspection::XNumericControl; - using ::com::sun::star::drawing::XShape; - using ::com::sun::star::beans::PropertyChangeEvent; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::beans::XPropertyChangeListener; - using ::com::sun::star::text::TextContentAnchorType; - using ::com::sun::star::text::TextContentAnchorType_AT_PARAGRAPH; - using ::com::sun::star::text::TextContentAnchorType_AS_CHARACTER; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::inspection::XObjectInspectorUI; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::sheet::XSpreadsheet; - using ::com::sun::star::table::XColumnRowRange; - using ::com::sun::star::table::XTableColumns; - using ::com::sun::star::table::XTableRows; - using ::com::sun::star::table::XCellRange; - using ::com::sun::star::container::XIndexAccess; - using ::com::sun::star::container::XChild; - using ::com::sun::star::form::XGridColumnFactory; - /** === end UNO using === **/ - namespace MeasureUnit = ::com::sun::star::util::MeasureUnit; - - typedef ::com::sun::star::awt::Point AwtPoint; - typedef ::com::sun::star::awt::Size AwtSize; - - #define ANCHOR_TO_SHEET 0 - #define ANCHOR_TO_CELL 1 - - //==================================================================== - //= BroadcastHelperBase - //==================================================================== - class BroadcastHelperBase - { - protected: - BroadcastHelperBase( ::osl::Mutex& _rMutex ) - :maBHelper( _rMutex ) - { - } - - protected: - ::cppu::OBroadcastHelper& getBroadcastHelper() { return maBHelper; } - - private: - ::cppu::OBroadcastHelper maBHelper; - }; - - //==================================================================== - //= ShapeGeometryChangeNotifier - declaration - //==================================================================== - /** helper class to work around the ...unfortunate implementation of property change broadcasts - in the XShape implementation, which broadcasts way too generous and unspecified - */ - typedef ::comphelper::ComponentBase ShapeGeometryChangeNotifier_CBase; - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener - > ShapeGeometryChangeNotifier_IBase; - - class ShapeGeometryChangeNotifier :public BroadcastHelperBase - ,public ShapeGeometryChangeNotifier_CBase - ,public ShapeGeometryChangeNotifier_IBase - { - public: - ShapeGeometryChangeNotifier( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rParentMutex, const Reference< XShape >& _shape ) - :BroadcastHelperBase( _rParentMutex ) - ,ShapeGeometryChangeNotifier_CBase( BroadcastHelperBase::getBroadcastHelper(), ::comphelper::ComponentBase::NoInitializationNeeded() ) - ,ShapeGeometryChangeNotifier_IBase() - ,m_rParent( _rParent ) - ,m_aPropertyChangeListeners( _rParentMutex ) - ,m_xShape( _shape ) - { - ENSURE_OR_THROW( m_xShape.is(), "illegal shape!" ); - impl_init_nothrow(); - } - - // property change broadcasting - void addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) - { - m_aPropertyChangeListeners.addInterface( _listener ); - } - void removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) - { - m_aPropertyChangeListeners.removeInterface( _listener ); - } - - // XComponent equivalent - void dispose() - { - ::osl::MutexGuard aGuard( getMutex() ); - impl_dispose_nothrow(); - } - - // XInterface - virtual void SAL_CALL acquire( ) throw () - { - m_rParent.acquire(); - } - - virtual void SAL_CALL release( ) throw () - { - m_rParent.release(); - } - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( const EventObject& _event ) throw (RuntimeException); - - protected: - virtual ~ShapeGeometryChangeNotifier() - { - if ( !getBroadcastHelper().bDisposed ) - { - acquire(); - dispose(); - } - } - - protected: - ::cppu::OBroadcastHelper& getBroadcastHelper() { return BroadcastHelperBase::getBroadcastHelper(); } - - private: - void impl_init_nothrow(); - void impl_dispose_nothrow(); - - private: - ::cppu::OWeakObject& m_rParent; - ::cppu::OInterfaceContainerHelper m_aPropertyChangeListeners; - Reference< XShape > m_xShape; - }; - - //==================================================================== - //= FormGeometryHandler - declaration - //==================================================================== - class FormGeometryHandler; - typedef HandlerComponentBase< FormGeometryHandler > FormGeometryHandler_Base; - /** a property handler for any virtual string properties - */ - class FormGeometryHandler : public FormGeometryHandler_Base - { - public: - FormGeometryHandler( - const Reference< XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (RuntimeException); - static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (RuntimeException); - - protected: - ~FormGeometryHandler(); - - protected: - // XPropertyHandler overriables - virtual Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException); - virtual LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& _rOldValue, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException); - - // OComponentHandler overridables - virtual void SAL_CALL disposing(); - - // PropertyHandler overridables - virtual Sequence< Property > SAL_CALL doDescribeSupportedProperties() const; - - protected: - virtual void onNewComponent(); - - private: - bool impl_haveTextAnchorType_nothrow() const; - bool impl_haveSheetAnchorType_nothrow() const; - void impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const; - - private: - Reference< XControlShape > m_xAssociatedShape; - Reference< XPropertySet > m_xShapeProperties; - ::rtl::Reference< ShapeGeometryChangeNotifier > m_xChangeNotifier; - }; - - //==================================================================== - //= FormGeometryHandler - implementation - //==================================================================== - DBG_NAME( FormGeometryHandler ) - //-------------------------------------------------------------------- - FormGeometryHandler::FormGeometryHandler( const Reference< XComponentContext >& _rxContext ) - :FormGeometryHandler_Base( _rxContext ) - { - DBG_CTOR( FormGeometryHandler, NULL ); - } - - //-------------------------------------------------------------------- - FormGeometryHandler::~FormGeometryHandler( ) - { - if ( !rBHelper.bDisposed ) - { - acquire(); - dispose(); - } - - DBG_DTOR( FormGeometryHandler, NULL ); - } - - //-------------------------------------------------------------------- - void FormGeometryHandler::onNewComponent() - { - if ( m_xChangeNotifier.is() ) - { - m_xChangeNotifier->dispose(); - m_xChangeNotifier.clear(); - } - m_xAssociatedShape.clear(); - m_xShapeProperties.clear(); - - FormGeometryHandler_Base::onNewComponent(); - - try - { - Reference< XControlModel > xControlModel( m_xComponent, UNO_QUERY ); - if ( xControlModel.is() ) - { - // do not ask the map for shapes for grid control columns .... - Reference< XChild > xCompChild( m_xComponent, UNO_QUERY_THROW ); - Reference< XGridColumnFactory > xCheckGrid( xCompChild->getParent(), UNO_QUERY ); - if ( !xCheckGrid.is() ) - { - Reference< XMap > xControlMap( m_aContext.getContextValueByAsciiName( "ControlShapeAccess" ), UNO_QUERY_THROW ); - m_xAssociatedShape.set( xControlMap->get( makeAny( xControlModel ) ), UNO_QUERY_THROW ); - m_xShapeProperties.set( m_xAssociatedShape, UNO_QUERY_THROW ); - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - if ( m_xAssociatedShape.is() ) - m_xChangeNotifier = new ShapeGeometryChangeNotifier( *this, m_aMutex, m_xAssociatedShape.get() ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL FormGeometryHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.FormGeometryHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.FormGeometryHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Any SAL_CALL FormGeometryHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); - ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: no shape properties!", *this ); - - Any aReturn; - try - { - switch ( nPropId ) - { - case PROPERTY_ID_POSITIONX: - aReturn <<= m_xAssociatedShape->getPosition().X; - break; - case PROPERTY_ID_POSITIONY: - aReturn <<= m_xAssociatedShape->getPosition().Y; - break; - case PROPERTY_ID_WIDTH: - aReturn <<= m_xAssociatedShape->getSize().Width; - break; - case PROPERTY_ID_HEIGHT: - aReturn <<= m_xAssociatedShape->getSize().Height; - break; - case PROPERTY_ID_TEXT_ANCHOR_TYPE: - aReturn = m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR_TYPE ); - OSL_ENSURE( aReturn.hasValue(), "FormGeometryHandler::getPropertyValue: illegal anchor type!" ); - break; - case PROPERTY_ID_SHEET_ANCHOR_TYPE: - { - Reference< XSpreadsheet > xAnchorSheet( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ), UNO_QUERY ); - aReturn <<= sal_Int32( xAnchorSheet.is() ? ANCHOR_TO_SHEET : ANCHOR_TO_CELL ); - } - break; - - default: - OSL_FAIL( "FormGeometryHandler::getPropertyValue: huh?" ); - break; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL FormGeometryHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this ); - ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: properties, but no shape!", *this ); - - try - { - switch ( nPropId ) - { - case PROPERTY_ID_POSITIONX: - case PROPERTY_ID_POSITIONY: - { - sal_Int32 nPosition(0); - OSL_VERIFY( _rValue >>= nPosition ); - - AwtPoint aPos( m_xAssociatedShape->getPosition() ); - if ( nPropId == PROPERTY_ID_POSITIONX ) - aPos.X = nPosition; - else - aPos.Y = nPosition; - m_xAssociatedShape->setPosition( aPos ); - } - break; - - case PROPERTY_ID_WIDTH: - case PROPERTY_ID_HEIGHT: - { - sal_Int32 nSize(0); - OSL_VERIFY( _rValue >>= nSize ); - - AwtSize aSize( m_xAssociatedShape->getSize() ); - if ( nPropId == PROPERTY_ID_WIDTH ) - aSize.Width = nSize; - else - aSize.Height = nSize; - m_xAssociatedShape->setSize( aSize ); - } - break; - - case PROPERTY_ID_TEXT_ANCHOR_TYPE: - m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR_TYPE, _rValue ); - break; - - case PROPERTY_ID_SHEET_ANCHOR_TYPE: - { - sal_Int32 nSheetAnchorType = 0; - OSL_VERIFY( _rValue >>= nSheetAnchorType ); - impl_setSheetAnchorType_nothrow( nSheetAnchorType ); - } - break; - - default: - OSL_FAIL( "FormGeometryHandler::getPropertyValue: huh?" ); - break; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL FormGeometryHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - LineDescriptor aLineDesc( PropertyHandler::describePropertyLine( _rPropertyName, _rxControlFactory ) ); - try - { - bool bIsSize = false; - switch ( nPropId ) - { - case PROPERTY_ID_WIDTH: - case PROPERTY_ID_HEIGHT: - bIsSize = true; - // NO break! - case PROPERTY_ID_POSITIONX: - case PROPERTY_ID_POSITIONY: - { - Optional< double > aZero( sal_True, 0 ); - Optional< double > aValueNotPresent( sal_False, 0 ); - aLineDesc.Control = PropertyHandlerHelper::createNumericControl( - _rxControlFactory, 2, bIsSize ? aZero : aValueNotPresent, aValueNotPresent, sal_False ); - - Reference< XNumericControl > xNumericControl( aLineDesc.Control, UNO_QUERY_THROW ); - xNumericControl->setValueUnit( MeasureUnit::MM_100TH ); - xNumericControl->setDisplayUnit( impl_getDocumentMeasurementUnit_throw() ); - } - break; - - case PROPERTY_ID_TEXT_ANCHOR_TYPE: - case PROPERTY_ID_SHEET_ANCHOR_TYPE: - // default handling from PropertyHandler is sufficient - break; - - default: - OSL_FAIL( "FormGeometryHandler::describePropertyLine: huh?" ); - break; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return aLineDesc; - } - - //-------------------------------------------------------------------- - void SAL_CALL FormGeometryHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::addPropertyChangeListener: no notified, implies no shape!?" ); - if ( m_xChangeNotifier.is() ) - m_xChangeNotifier->addPropertyChangeListener( _listener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL FormGeometryHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _listener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_PRECOND( m_xChangeNotifier.is(), "FormGeometryHandler::removePropertyChangeListener: no notified, implies no shape!?" ); - if ( m_xChangeNotifier.is() ) - m_xChangeNotifier->removePropertyChangeListener( _listener ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL FormGeometryHandler::getActuatingProperties( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aInterestedIn(1); - aInterestedIn[0] = PROPERTY_TEXT_ANCHOR_TYPE; - return aInterestedIn; - } - - //-------------------------------------------------------------------- - void SAL_CALL FormGeometryHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - - switch ( nActuatingPropId ) - { - case PROPERTY_ID_TEXT_ANCHOR_TYPE: - { - TextContentAnchorType eAnchorType( TextContentAnchorType_AT_PARAGRAPH ); - OSL_VERIFY( _rNewValue >>= eAnchorType ); - _rxInspectorUI->enablePropertyUI( PROPERTY_POSITIONX, eAnchorType != TextContentAnchorType_AS_CHARACTER ); - } - break; - default: - OSL_FAIL( "FormGeometryHandler::actuatingPropertyChanged: not registered for this property!" ); - break; - } - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL FormGeometryHandler::doDescribeSupportedProperties() const - { - if ( !m_xAssociatedShape.is() ) - return Sequence< Property >(); - - ::std::vector< Property > aProperties; - - addInt32PropertyDescription( aProperties, PROPERTY_POSITIONX ); - addInt32PropertyDescription( aProperties, PROPERTY_POSITIONY ); - addInt32PropertyDescription( aProperties, PROPERTY_WIDTH ); - addInt32PropertyDescription( aProperties, PROPERTY_HEIGHT ); - - if ( impl_haveTextAnchorType_nothrow() ) - implAddPropertyDescription( aProperties, PROPERTY_TEXT_ANCHOR_TYPE, ::cppu::UnoType< TextContentAnchorType >::get() ); - - if ( impl_haveSheetAnchorType_nothrow() ) - addInt32PropertyDescription( aProperties, PROPERTY_SHEET_ANCHOR_TYPE ); - - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - void SAL_CALL FormGeometryHandler::disposing() - { - FormGeometryHandler_Base::disposing(); - - if ( m_xChangeNotifier.is() ) - { - m_xChangeNotifier->dispose(); - m_xChangeNotifier.clear(); - } - } - - //-------------------------------------------------------------------- - bool FormGeometryHandler::impl_haveTextAnchorType_nothrow() const - { - ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); - try - { - Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); - if ( xPSI->hasPropertyByName( PROPERTY_ANCHOR_TYPE ) ) - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - //-------------------------------------------------------------------- - bool FormGeometryHandler::impl_haveSheetAnchorType_nothrow() const - { - ENSURE_OR_THROW( m_xShapeProperties.is(), "not to be called without shape properties" ); - try - { - Reference< XPropertySetInfo > xPSI( m_xShapeProperties->getPropertySetInfo(), UNO_SET_THROW ); - if ( !xPSI->hasPropertyByName( PROPERTY_ANCHOR ) ) - return false; - Reference< XServiceInfo > xSI( m_xAssociatedShape, UNO_QUERY_THROW ); - if ( xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.Shape" ) ) ) ) - return true; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return false; - } - - //-------------------------------------------------------------------- - namespace - { - static sal_Int32 lcl_getLowerBoundRowOrColumn( const Reference< XIndexAccess >& _rxRowsOrColumns, const bool _bRows, - const AwtPoint& _rRelativePosition ) - { - sal_Int32 nAccumulated = 0; - - const sal_Int32& rRelativePos = _bRows ? _rRelativePosition.Y : _rRelativePosition.X; - - sal_Int32 nElements = _rxRowsOrColumns->getCount(); - sal_Int32 currentPos = 0; - for ( currentPos=0; currentPos xRowOrColumn( _rxRowsOrColumns->getByIndex( currentPos ), UNO_QUERY_THROW ); - - sal_Bool bIsVisible = sal_True; - OSL_VERIFY( xRowOrColumn->getPropertyValue( PROPERTY_IS_VISIBLE ) >>= bIsVisible ); - if ( !bIsVisible ) - continue; - - sal_Int32 nHeightOrWidth( 0 ); - OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? PROPERTY_HEIGHT : PROPERTY_WIDTH ) >>= nHeightOrWidth ); - - if ( nAccumulated + nHeightOrWidth > rRelativePos ) - break; - - nAccumulated += nHeightOrWidth; - } - - return currentPos; - } - } - - //-------------------------------------------------------------------- - void FormGeometryHandler::impl_setSheetAnchorType_nothrow( const sal_Int32 _nAnchorType ) const - { - ENSURE_OR_THROW( m_xShapeProperties.is(), "illegal to be called without shape properties." ); - try - { - CellBindingHelper aHelper( m_xComponent, impl_getContextDocument_nothrow() ); - // find the sheet which the control belongs to - Reference< XSpreadsheet > xSheet; - aHelper.getControlSheetIndex( xSheet ); - - switch ( _nAnchorType ) - { - case ANCHOR_TO_SHEET: - OSL_ENSURE( xSheet.is(), - "FormGeometryHandler::impl_setSheetAnchorType_nothrow: sheet not found!" ); - if ( xSheet.is() ) - { - AwtPoint aPreservePosition( m_xAssociatedShape->getPosition() ); - m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, makeAny( xSheet ) ); - m_xAssociatedShape->setPosition( aPreservePosition ); - } - break; - - case ANCHOR_TO_CELL: - { - Reference< XColumnRowRange > xColsRows( xSheet, UNO_QUERY_THROW ); - - // get the current anchor - Reference< XSpreadsheet > xCurrentAnchor; - OSL_VERIFY( m_xShapeProperties->getPropertyValue( PROPERTY_ANCHOR ) >>= xCurrentAnchor ); - OSL_ENSURE( xCurrentAnchor.is(), "FormGeometryHandler::impl_setSheetAnchorType_nothrow: only to be called when currently anchored to a sheet!" ); - - // get the current position - AwtPoint aRelativePosition( m_xAssociatedShape->getPosition() ); - - Reference< XTableColumns > xCols( xColsRows->getColumns(), UNO_SET_THROW ); - sal_Int32 nNewAnchorCol = lcl_getLowerBoundRowOrColumn( xCols.get(), false, aRelativePosition ); - - Reference< XTableRows > xRows( xColsRows->getRows(), UNO_SET_THROW ); - sal_Int32 nNewAnchorRow = lcl_getLowerBoundRowOrColumn( xRows.get(), true, aRelativePosition ); - - Reference< XCellRange > xSheetCellRange( xSheet, UNO_QUERY_THROW ); - Any aNewAnchorCell( xSheetCellRange->getCellByPosition( nNewAnchorCol, nNewAnchorRow ) ); - m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, aNewAnchorCell ); - } - break; - - default: - OSL_FAIL( "FormGeometryHandler::impl_setSheetAnchorType_nothrow: illegal anchor type!" ); - break; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //==================================================================== - //= ShapeGeometryChangeNotifier - implementation - //==================================================================== - namespace - { - struct EventTranslation - { - ::rtl::OUString sPropertyName; - Any aNewPropertyValue; - - EventTranslation( const ::rtl::OUString& _propertyName, const Any& _newPropertyValue ) - :sPropertyName( _propertyName ) - ,aNewPropertyValue( _newPropertyValue ) - { - } - }; - } - - //-------------------------------------------------------------------- - void SAL_CALL ShapeGeometryChangeNotifier::propertyChange( const PropertyChangeEvent& _event ) throw (RuntimeException) - { - ::comphelper::ComponentMethodGuard aGuard( *this ); - - ::std::vector< EventTranslation > aEventTranslations; - aEventTranslations.reserve(2); - - if ( _event.PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Position" ) ) ) - { - AwtPoint aPos = m_xShape->getPosition(); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONX, makeAny( aPos.X ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONY, makeAny( aPos.Y ) ) ); - } - else if ( _event.PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) - { - AwtSize aSize = m_xShape->getSize(); - aEventTranslations.push_back( EventTranslation( PROPERTY_WIDTH, makeAny( aSize.Width ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_HEIGHT, makeAny( aSize.Height ) ) ); - } - else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) - { - aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); - } - else if ( _event.PropertyName == PROPERTY_ANCHOR ) - { - aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); - } - - PropertyChangeEvent aTranslatedEvent( _event ); - aTranslatedEvent.Source = m_rParent; - - aGuard.clear(); - for ( ::std::vector< EventTranslation >::const_iterator t = aEventTranslations.begin(); - t != aEventTranslations.end(); - ++t - ) - { - aTranslatedEvent.PropertyName = t->sPropertyName; - aTranslatedEvent.NewValue = t->aNewPropertyValue; - m_aPropertyChangeListeners.notifyEach( &XPropertyChangeListener::propertyChange, aTranslatedEvent ); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL ShapeGeometryChangeNotifier::disposing( const EventObject& /*_event*/ ) throw (RuntimeException) - { - ::comphelper::ComponentMethodGuard aGuard( *this ); - impl_dispose_nothrow(); - } - - //-------------------------------------------------------------------- - void ShapeGeometryChangeNotifier::impl_init_nothrow() - { - osl_incrementInterlockedCount( &m_refCount ); - try - { - Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); - xShapeProperties->addPropertyChangeListener( ::rtl::OUString(), this ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - osl_decrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - void ShapeGeometryChangeNotifier::impl_dispose_nothrow() - { - try - { - Reference< XPropertySet > xShapeProperties( m_xShape, UNO_QUERY_THROW ); - xShapeProperties->removePropertyChangeListener( ::rtl::OUString(), this ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - getBroadcastHelper().bDisposed = true; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler() -{ - ::pcr::FormGeometryHandler::registerImplementation(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx deleted file mode 100644 index 1d3a3553a..000000000 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ /dev/null @@ -1,675 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "formlinkdialog.hxx" -#include "formlinkdialog.hrc" - -#include "modulepcr.hxx" -#include "formresid.hrc" -#include "formstrings.hxx" -#include -#include -#include -#include -#include -#include -#include - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::container; - - //======================================================================== - //= FieldLinkRow - //======================================================================== - class FieldLinkRow : public Window - { - private: - ComboBox m_aDetailColumn; - FixedText m_aEqualSign; - ComboBox m_aMasterColumn; - - Link m_aLinkChangeHandler; - - public: - FieldLinkRow( Window* _pParent, const ResId& _rId ); - - inline void SetLinkChangeHandler( const Link& _rHdl ) { m_aLinkChangeHandler = _rHdl; } - inline const Link& GetLinkChangeHandler( ) const { return m_aLinkChangeHandler; } - - enum LinkParticipant - { - eDetailField, - eMasterField - }; - /** retrieves the selected field name for either the master or the detail field - @return if and only a valid field is selected - */ - bool GetFieldName( LinkParticipant _eWhich, String& /* [out] */ _rName ) const; - void SetFieldName( LinkParticipant _eWhich, const String& _rName ); - - void fillList( LinkParticipant _eWhich, const Sequence< ::rtl::OUString >& _rFieldNames ); - - private: - DECL_LINK( OnFieldNameChanged, ComboBox* ); - }; - - //------------------------------------------------------------------------ - FieldLinkRow::FieldLinkRow( Window* _pParent, const ResId& _rId ) - :Window( _pParent, _rId ) - ,m_aDetailColumn( this, ResId( 1, *_rId.GetResMgr() ) ) - ,m_aEqualSign ( this, ResId( 1, *_rId.GetResMgr() ) ) - ,m_aMasterColumn( this, ResId( 2, *_rId.GetResMgr() ) ) - { - FreeResource(); - - m_aDetailColumn.SetDropDownLineCount( 10 ); - m_aMasterColumn.SetDropDownLineCount( 10 ); - - m_aDetailColumn.SetModifyHdl( LINK( this, FieldLinkRow, OnFieldNameChanged ) ); - m_aMasterColumn.SetModifyHdl( LINK( this, FieldLinkRow, OnFieldNameChanged ) ); - } - - //------------------------------------------------------------------------ - void FieldLinkRow::fillList( LinkParticipant _eWhich, const Sequence< ::rtl::OUString >& _rFieldNames ) - { - ComboBox* pBox = ( _eWhich == eDetailField ) ? &m_aDetailColumn : &m_aMasterColumn; - - const ::rtl::OUString* pFieldName = _rFieldNames.getConstArray(); - const ::rtl::OUString* pFieldNameEnd = pFieldName + _rFieldNames.getLength(); - for ( ; pFieldName != pFieldNameEnd; ++pFieldName ) - pBox->InsertEntry( *pFieldName ); - } - - //------------------------------------------------------------------------ - bool FieldLinkRow::GetFieldName( LinkParticipant _eWhich, String& /* [out] */ _rName ) const - { - const ComboBox* pBox = ( _eWhich == eDetailField ) ? &m_aDetailColumn : &m_aMasterColumn; - _rName = pBox->GetText(); - return _rName.Len() != 0; - } - - //------------------------------------------------------------------------ - void FieldLinkRow::SetFieldName( LinkParticipant _eWhich, const String& _rName ) - { - ComboBox* pBox = ( _eWhich == eDetailField ) ? &m_aDetailColumn : &m_aMasterColumn; - pBox->SetText( _rName ); - } - - //------------------------------------------------------------------------ - IMPL_LINK( FieldLinkRow, OnFieldNameChanged, ComboBox*, /*_pBox*/ ) - { - if ( m_aLinkChangeHandler.IsSet() ) - return m_aLinkChangeHandler.Call( this ); - - return 0L; - } - - //======================================================================== - //= FormLinkDialog - //======================================================================== - //------------------------------------------------------------------------ - FormLinkDialog::FormLinkDialog( Window* _pParent, const Reference< XPropertySet >& _rxDetailForm, - const Reference< XPropertySet >& _rxMasterForm, const Reference< XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _sExplanation, - const ::rtl::OUString& _sDetailLabel, - const ::rtl::OUString& _sMasterLabel) - :ModalDialog( _pParent, PcrRes( RID_DLG_FORMLINKS ) ) - ,m_aExplanation( this, PcrRes( FT_EXPLANATION ) ) - ,m_aDetailLabel( this, PcrRes( FT_DETAIL_LABEL ) ) - ,m_aMasterLabel( this, PcrRes( FT_MASTER_LABEL ) ) - ,m_aRow1 ( new FieldLinkRow( this, PcrRes( 1 ) ) ) - ,m_aRow2 ( new FieldLinkRow( this, PcrRes( 2 ) ) ) - ,m_aRow3 ( new FieldLinkRow( this, PcrRes( 3 ) ) ) - ,m_aRow4 ( new FieldLinkRow( this, PcrRes( 4 ) ) ) - ,m_aOK ( this, PcrRes( PB_OK ) ) - ,m_aCancel ( this, PcrRes( PB_CANCEL ) ) - ,m_aHelp ( this, PcrRes( PB_HELP ) ) - ,m_aSuggest ( this, PcrRes( PB_SUGGEST ) ) - ,m_xORB ( _rxORB ) - ,m_xDetailForm( _rxDetailForm ) - ,m_xMasterForm( _rxMasterForm ) - ,m_sDetailLabel(_sDetailLabel) - ,m_sMasterLabel(_sMasterLabel) - { - FreeResource(); - if ( _sExplanation.getLength() ) - m_aExplanation.SetText(_sExplanation); - - m_aSuggest.SetClickHdl ( LINK( this, FormLinkDialog, OnSuggest ) ); - m_aRow1->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); - m_aRow2->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); - m_aRow3->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); - m_aRow4->SetLinkChangeHandler( LINK( this, FormLinkDialog, OnFieldChanged ) ); - - PostUserEvent( LINK( this, FormLinkDialog, OnInitialize ) ); - - updateOkButton(); - } - - //------------------------------------------------------------------------ - FormLinkDialog::~FormLinkDialog( ) - { - } - - //------------------------------------------------------------------------ - void FormLinkDialog::commitLinkPairs() - { - // collect the field lists from the rows - ::std::vector< ::rtl::OUString > aDetailFields; aDetailFields.reserve( 4 ); - ::std::vector< ::rtl::OUString > aMasterFields; aMasterFields.reserve( 4 ); - - const FieldLinkRow* aRows[] = { - m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() - }; - - for ( sal_Int32 i = 0; i < 4; ++i ) - { - String sDetailField, sMasterField; - aRows[ i ]->GetFieldName( FieldLinkRow::eDetailField, sDetailField ); - aRows[ i ]->GetFieldName( FieldLinkRow::eMasterField, sMasterField ); - if ( !sDetailField.Len() && !sMasterField.Len() ) - continue; - - aDetailFields.push_back( sDetailField ); - aMasterFields.push_back( sMasterField ); - } - - // and set as property values - try - { - Reference< XPropertySet > xDetailFormProps( m_xDetailForm, UNO_QUERY ); - if ( xDetailFormProps.is() ) - { - ::rtl::OUString *pFields = aDetailFields.empty() ? 0 : &aDetailFields[0]; - xDetailFormProps->setPropertyValue( PROPERTY_DETAILFIELDS, makeAny( Sequence< ::rtl::OUString >( pFields, aDetailFields.size() ) ) ); - pFields = aMasterFields.empty() ? 0 : &aMasterFields[0]; - xDetailFormProps->setPropertyValue( PROPERTY_MASTERFIELDS, makeAny( Sequence< ::rtl::OUString >( pFields, aMasterFields.size() ) ) ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::commitLinkPairs: caught an exception while setting the properties!" ); - } - } - - //------------------------------------------------------------------------ - short FormLinkDialog::Execute() - { - short nResult = ModalDialog::Execute(); - - if ( RET_OK == nResult ) - commitLinkPairs(); - - return nResult; - } - - //------------------------------------------------------------------------ - void FormLinkDialog::initializeFieldLists() - { - Sequence< ::rtl::OUString > sDetailFields; - getFormFields( m_xDetailForm, sDetailFields ); - - Sequence< ::rtl::OUString > sMasterFields; - getFormFields( m_xMasterForm, sMasterFields ); - - FieldLinkRow* aRows[] = { - m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() - }; - for ( sal_Int32 i = 0; i < 4 ; ++i ) - { - aRows[i]->fillList( FieldLinkRow::eDetailField, sDetailFields ); - aRows[i]->fillList( FieldLinkRow::eMasterField, sMasterFields ); - } - - } - - //------------------------------------------------------------------------ - void FormLinkDialog::initializeColumnLabels() - { - // label for the detail form - String sDetailType = getFormDataSourceType( m_xDetailForm ); - if ( !sDetailType.Len() ) - { - if ( !m_sDetailLabel.getLength() ) - { - ::svt::OLocalResourceAccess aStringAccess( PcrRes( RID_DLG_FORMLINKS ), RSC_MODALDIALOG ); - m_sDetailLabel = String( PcrRes( STR_DETAIL_FORM ) ); - } - sDetailType = m_sDetailLabel; - } - m_aDetailLabel.SetText( sDetailType ); - - // label for the master form - String sMasterType = getFormDataSourceType( m_xMasterForm ); - if ( !sMasterType.Len() ) - { - if ( !m_sMasterLabel.getLength() ) - { - ::svt::OLocalResourceAccess aStringAccess( PcrRes( RID_DLG_FORMLINKS ), RSC_MODALDIALOG ); - m_sMasterLabel = String( PcrRes( STR_MASTER_FORM ) ); - } - sMasterType = m_sMasterLabel; - } - m_aMasterLabel.SetText( sMasterType ); - } - - //------------------------------------------------------------------------ - void FormLinkDialog::initializeFieldRowsFrom( Sequence< ::rtl::OUString >& _rDetailFields, Sequence< ::rtl::OUString >& _rMasterFields ) - { - // our UI does allow 4 fields max - _rDetailFields.realloc( 4 ); - _rMasterFields.realloc( 4 ); - - const ::rtl::OUString* pDetailFields = _rDetailFields.getConstArray(); - const ::rtl::OUString* pMasterFields = _rMasterFields.getConstArray(); - - FieldLinkRow* aRows[] = { - m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() - }; - for ( sal_Int32 i = 0; i < 4; ++i, ++pDetailFields, ++pMasterFields ) - { - aRows[ i ]->SetFieldName( FieldLinkRow::eDetailField, *pDetailFields ); - aRows[ i ]->SetFieldName( FieldLinkRow::eMasterField, *pMasterFields ); - } - } - - //------------------------------------------------------------------------ - void FormLinkDialog::initializeLinks() - { - try - { - Sequence< ::rtl::OUString > aDetailFields; - Sequence< ::rtl::OUString > aMasterFields; - - Reference< XPropertySet > xDetailFormProps( m_xDetailForm, UNO_QUERY ); - if ( xDetailFormProps.is() ) - { - xDetailFormProps->getPropertyValue( PROPERTY_DETAILFIELDS ) >>= aDetailFields; - xDetailFormProps->getPropertyValue( PROPERTY_MASTERFIELDS ) >>= aMasterFields; - } - - initializeFieldRowsFrom( aDetailFields, aMasterFields ); - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::initializeLinks: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - void FormLinkDialog::updateOkButton() - { - // in all rows, there must be either two valid selections, or none at all - // If there is at least one row with exactly one valid selection, then the - // OKButton needs to be disabled - sal_Bool bEnable = sal_True; - - const FieldLinkRow* aRows[] = { - m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() - }; - - for ( sal_Int32 i = 0; ( i < 4 ) && bEnable; ++i ) - { - String sNotInterestedInRightNow; - if ( aRows[ i ]->GetFieldName( FieldLinkRow::eDetailField, sNotInterestedInRightNow ) - != aRows[ i ]->GetFieldName( FieldLinkRow::eMasterField, sNotInterestedInRightNow ) - ) - bEnable = sal_False; - } - - m_aOK.Enable( bEnable ); - } - - //------------------------------------------------------------------------ - String FormLinkDialog::getFormDataSourceType( const Reference< XPropertySet >& _rxForm ) const SAL_THROW(()) - { - String sReturn; - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - if ( !xFormProps.is() ) - return sReturn; - - try - { - sal_Int32 nCommandType = CommandType::COMMAND; - ::rtl::OUString sCommand; - - xFormProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; - xFormProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; - - if ( ( nCommandType == CommandType::TABLE ) - || ( nCommandType == CommandType::QUERY ) - ) - sReturn = sCommand; - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::getFormDataSourceType: caught an exception!" ); - } - return sReturn; - } - - //------------------------------------------------------------------------ - void FormLinkDialog::getFormFields( const Reference< XPropertySet >& _rxForm, Sequence< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(( )) - { - _rNames.realloc( 0 ); - - ::dbtools::SQLExceptionInfo aErrorInfo; - ::rtl::OUString sCommand; - try - { - WaitObject aWaitCursor( const_cast< FormLinkDialog* >( this ) ); - - Reference< XPropertySet > xFormProps( _rxForm, UNO_QUERY ); - OSL_ENSURE( xFormProps.is(), "FormLinkDialog::getFormFields: invalid form!" ); - - sal_Int32 nCommandType = CommandType::COMMAND; - - xFormProps->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nCommandType; - xFormProps->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand; - - Reference< XConnection > xConnection; - ensureFormConnection( xFormProps, xConnection ); - - _rNames = ::dbtools::getFieldNamesByCommandDescriptor( - xConnection, - nCommandType, - sCommand, - &aErrorInfo - ); - } - catch (const SQLContext& e) { aErrorInfo = e; } - catch (const SQLWarning& e) { aErrorInfo = e; } - catch (const SQLException& e ) { aErrorInfo = e; } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::getFormFields: caught a non-SQL exception!" ); - } - - if ( aErrorInfo.isValid() ) - { - String sErrorMessage; - { - ::svt::OLocalResourceAccess aStringAccess( PcrRes( RID_DLG_FORMLINKS ), RSC_MODALDIALOG ); - sErrorMessage = String( PcrRes( STR_ERROR_RETRIEVING_COLUMNS) ); - sErrorMessage.SearchAndReplace('#',sCommand); - } - - SQLContext aContext; - aContext.Message = sErrorMessage; - aContext.NextException = aErrorInfo.get(); - ::dbtools::showError( aContext, VCLUnoHelper::GetInterface( const_cast< FormLinkDialog* >( this ) ), m_xORB ); - } - } - - //------------------------------------------------------------------------ - void FormLinkDialog::ensureFormConnection( const Reference< XPropertySet >& _rxFormProps, Reference< XConnection >& /* [out] */ _rxConnection ) const SAL_THROW(( Exception )) - { - OSL_PRECOND( _rxFormProps.is(), "FormLinkDialog::ensureFormConnection: invalid form!" ); - if ( !_rxFormProps.is() ) - return; - if ( _rxFormProps->getPropertySetInfo()->hasPropertyByName(PROPERTY_ACTIVE_CONNECTION) ) - _rxConnection.set(_rxFormProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY); - - if ( !_rxConnection.is() ) - _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), m_xORB, sal_True ); - } - - //------------------------------------------------------------------------ - void FormLinkDialog::getConnectionMetaData( const Reference< XPropertySet >& _rxFormProps, Reference< XDatabaseMetaData >& /* [out] */ _rxMeta ) const SAL_THROW(( Exception )) - { - if ( _rxFormProps.is() ) - { - Reference< XConnection > xConnection; - if ( !::dbtools::isEmbeddedInDatabase( _rxFormProps, xConnection ) ) - _rxFormProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConnection; - if ( xConnection.is() ) - _rxMeta = xConnection->getMetaData(); - } - } - - //------------------------------------------------------------------------ - Reference< XPropertySet > FormLinkDialog::getCanonicUnderlyingTable( const Reference< XPropertySet >& _rxFormProps ) const - { - Reference< XPropertySet > xTable; - try - { - Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, m_xORB ), UNO_QUERY ); - Reference< XNameAccess > xTables; - if ( xTablesInForm.is() ) - xTables = xTablesInForm->getTables(); - Sequence< ::rtl::OUString > aTableNames; - if ( xTables.is() ) - aTableNames = xTables->getElementNames(); - - if ( aTableNames.getLength() == 1 ) - { - xTables->getByName( aTableNames[ 0 ] ) >>= xTable; - OSL_ENSURE( xTable.is(), "FormLinkDialog::getCanonicUnderlyingTable: invalid table!" ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::getCanonicUnderlyingTable: caught an exception!" ); - } - return xTable; - } - - //------------------------------------------------------------------------ - sal_Bool FormLinkDialog::getExistingRelation( const Reference< XPropertySet >& _rxLHS, const Reference< XPropertySet >& /*_rxRHS*/, - // TODO: fix the usage of _rxRHS. This is issue #i81956#. - Sequence< ::rtl::OUString >& _rLeftFields, Sequence< ::rtl::OUString >& _rRightFields ) const - { - try - { - Reference< XKeysSupplier > xSuppKeys( _rxLHS, UNO_QUERY ); - Reference< XIndexAccess > xKeys; - if ( xSuppKeys.is() ) - xKeys = xSuppKeys->getKeys(); - - if ( xKeys.is() ) - { - Reference< XPropertySet > xKey; - Reference< XColumnsSupplier > xKeyColSupp( xKey, UNO_QUERY ); - Reference< XIndexAccess > xKeyColumns; - Reference< XPropertySet > xKeyColumn; - ::rtl::OUString sColumnName, sRelatedColumnName; - - const sal_Int32 keyCount = xKeys->getCount(); - for ( sal_Int32 key = 0; key < keyCount; ++key ) - { - xKeys->getByIndex( key ) >>= xKey; - sal_Int32 nKeyType = 0; - xKey->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) ) >>= nKeyType; - if ( nKeyType != KeyType::FOREIGN ) - continue; - - xKeyColumns.clear(); - xKeyColSupp = xKeyColSupp.query( xKey ); - if ( xKeyColSupp.is() ) - xKeyColumns = xKeyColumns.query( xKeyColSupp->getColumns() ); - OSL_ENSURE( xKeyColumns.is(), "FormLinkDialog::getExistingRelation: could not obtain the columns for the key!" ); - - if ( !xKeyColumns.is() ) - continue; - - const sal_Int32 columnCount = xKeyColumns->getCount(); - _rLeftFields.realloc( columnCount ); - _rRightFields.realloc( columnCount ); - for ( sal_Int32 column = 0; column < columnCount; ++column ) - { - xKeyColumn.clear(); - xKeyColumns->getByIndex( column ) >>= xKeyColumn; - OSL_ENSURE( xKeyColumn.is(), "FormLinkDialog::getExistingRelation: invalid key column!" ); - if ( xKeyColumn.is() ) - { - xKeyColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumnName; - xKeyColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RelatedColumn" ) ) ) >>= sRelatedColumnName; - - _rLeftFields[ column ] = sColumnName; - _rRightFields[ column ] = sRelatedColumnName; - } - } - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::getExistingRelation: caught an exception!" ); - } - - return ( _rLeftFields.getLength() > 0 ) && ( _rLeftFields[ 0 ].getLength() > 0 ); - } - - //------------------------------------------------------------------------ - void FormLinkDialog::initializeSuggest() - { - Reference< XPropertySet > xDetailFormProps( m_xDetailForm, UNO_QUERY ); - Reference< XPropertySet > xMasterFormProps( m_xMasterForm, UNO_QUERY ); - if ( !xDetailFormProps.is() || !xMasterFormProps.is() ) - return; - - try - { - sal_Bool bEnable = sal_True; - - // only show the button when both forms are based on the same data source - if ( bEnable ) - { - ::rtl::OUString sMasterDS, sDetailDS; - xMasterFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sMasterDS; - xDetailFormProps->getPropertyValue( PROPERTY_DATASOURCE ) >>= sDetailDS; - bEnable = ( sMasterDS == sDetailDS ); - } - - // only show the button when the connection supports relations - if ( bEnable ) - { - Reference< XDatabaseMetaData > xMeta; - getConnectionMetaData( xDetailFormProps, xMeta ); - OSL_ENSURE( xMeta.is(), "FormLinkDialog::initializeSuggest: unable to retrieve the meta data for the connection!" ); - try - { - bEnable = xMeta.is() && xMeta->supportsIntegrityEnhancementFacility(); - } - catch(const Exception&) - { - bEnable = sal_False; - } - } - - // only enable the button if there is a "canonic" table underlying both forms - Reference< XPropertySet > xDetailTable, xMasterTable; - if ( bEnable ) - { - xDetailTable = getCanonicUnderlyingTable( xDetailFormProps ); - xMasterTable = getCanonicUnderlyingTable( xMasterFormProps ); - bEnable = xDetailTable.is() && xMasterTable.is(); - } - - // only enable the button if there is a relation between both tables - m_aRelationDetailColumns.realloc( 0 ); - m_aRelationMasterColumns.realloc( 0 ); - if ( bEnable ) - { - bEnable = getExistingRelation( xDetailTable, xMasterTable, m_aRelationDetailColumns, m_aRelationMasterColumns ); - OSL_POSTCOND( m_aRelationMasterColumns.getLength() == m_aRelationDetailColumns.getLength(), "FormLinkDialog::initializeSuggest: nonsense!" ); - if ( m_aRelationMasterColumns.getLength() == 0 ) - { // okay, there is no relation "pointing" (via a foreign key) from the detail table to the master table - // but perhaps the other way round (would make less sense, but who knows ...) - bEnable = getExistingRelation( xMasterTable, xDetailTable, m_aRelationMasterColumns, m_aRelationDetailColumns ); - } - } - - // only enable the button if the relation contains at most 4 field pairs - if ( bEnable ) - { - bEnable = ( m_aRelationMasterColumns.getLength() <= 4 ); - } - - m_aSuggest.Enable( bEnable ); - } - catch( const Exception& ) - { - OSL_FAIL( "FormLinkDialog::initializeSuggest: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - IMPL_LINK( FormLinkDialog, OnSuggest, void*, /*_pNotInterestedIn*/ ) - { - initializeFieldRowsFrom( m_aRelationDetailColumns, m_aRelationMasterColumns ); - return 0L; - } - - //------------------------------------------------------------------------ - IMPL_LINK( FormLinkDialog, OnFieldChanged, FieldLinkRow*, /*_pRow*/ ) - { - updateOkButton(); - return 0L; - } - - //------------------------------------------------------------------------ - IMPL_LINK( FormLinkDialog, OnInitialize, void*, /*_pNotInterestedIn*/ ) - { - initializeColumnLabels(); - initializeFieldLists(); - initializeLinks(); - initializeSuggest(); - return 0L; - } -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formlinkdialog.hrc b/extensions/source/propctrlr/formlinkdialog.hrc deleted file mode 100644 index 25a179352..000000000 --- a/extensions/source/propctrlr/formlinkdialog.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HRC -#define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HRC - -#define FT_EXPLANATION 1 -#define FT_DETAIL_LABEL 2 -#define FT_MASTER_LABEL 3 - -#define PB_OK 1 -#define PB_CANCEL 2 -#define PB_HELP 3 -#define PB_SUGGEST 4 - -#define STR_DETAIL_FORM 1 -#define STR_MASTER_FORM 2 -#define STR_ERROR_RETRIEVING_COLUMNS 3 - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HRC diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx deleted file mode 100644 index 04d35cc9f..000000000 --- a/extensions/source/propctrlr/formlinkdialog.hxx +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX - -#include -#include -#include - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class FieldLinkRow; - //======================================================================== - //= FormLinkDialog - //======================================================================== - class FormLinkDialog : public ModalDialog - { - private: - FixedText m_aExplanation; - FixedText m_aDetailLabel; - FixedText m_aMasterLabel; - ::std::auto_ptr< FieldLinkRow > m_aRow1; - ::std::auto_ptr< FieldLinkRow > m_aRow2; - ::std::auto_ptr< FieldLinkRow > m_aRow3; - ::std::auto_ptr< FieldLinkRow > m_aRow4; - OKButton m_aOK; - CancelButton m_aCancel; - HelpButton m_aHelp; - PushButton m_aSuggest; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xDetailForm; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xMasterForm; - - ::com::sun::star::uno::Sequence< ::rtl::OUString > - m_aRelationDetailColumns; - ::com::sun::star::uno::Sequence< ::rtl::OUString > - m_aRelationMasterColumns; - - ::rtl::OUString m_sDetailLabel; - ::rtl::OUString m_sMasterLabel; - - public: - FormLinkDialog( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _sExplanation = ::rtl::OUString(), - const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(), - const ::rtl::OUString& _sMasterLabel = ::rtl::OUString() - ); - ~FormLinkDialog( ); - - // Dialog overridables - virtual short Execute(); - - private: - DECL_LINK( OnSuggest, void* ); - DECL_LINK( OnFieldChanged, FieldLinkRow* ); - DECL_LINK( OnInitialize, void* ); - - void updateOkButton(); - void initializeFieldLists(); - void initializeColumnLabels(); - void initializeLinks(); - void initializeSuggest(); - void commitLinkPairs(); - - void initializeFieldRowsFrom( - ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rDetailFields, - ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rMasterFields - ); - - String getFormDataSourceType( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm - ) const SAL_THROW(()); - - void getFormFields( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, - ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rNames - ) const SAL_THROW(()); - - void ensureFormConnection( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps, - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection - ) const SAL_THROW(( ::com::sun::star::uno::Exception )); - - void getConnectionMetaData( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps, - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& /* [out] */ _rxMeta - ) const SAL_THROW(( ::com::sun::star::uno::Exception )); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps ) const; - sal_Bool getExistingRelation( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLHS, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRHS, - ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rLeftFields, - ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rRightFields - ) const; - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formlinkdialog.src b/extensions/source/propctrlr/formlinkdialog.src deleted file mode 100644 index db0ef08d6..000000000 --- a/extensions/source/propctrlr/formlinkdialog.src +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ -#include "formresid.hrc" -#endif -#include "propctrlr.hrc" -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HRC -#include "formlinkdialog.hrc" -#endif - -ModalDialog RID_DLG_FORMLINKS -{ - HelpID = "extensions:ModalDialog:RID_DLG_FORMLINKS"; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 252, 110 ) ; - - Text [ en-US ] = "Link fields"; - - FixedText FT_EXPLANATION - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 187, 24 ); - - WordBreak = TRUE; - - Text [ en-US ] = "Sub forms can be used to display detailed data about the current record of the master form. To do this, you can specify which columns in the sub form match which columns in the master form."; - }; - - FixedText FT_DETAIL_LABEL - { - Pos = MAP_APPFONT( 6, 36 ); - Size = MAP_APPFONT( 85, 8 ); - }; - - FixedText FT_MASTER_LABEL - { - Pos = MAP_APPFONT( 102, 36 ); - Size = MAP_APPFONT( 85, 8 ); - }; - -#define ROW( n ) \ - Window n \ - { \ - Pos = MAP_APPFONT( 6, 47 + 15 * ( n - 1 ) ); \ - Size = MAP_APPFONT( 181, 13 ); \ - \ - Hide = FALSE; \ - DialogControl = TRUE; \ - \ - ComboBox 1 \ - { \ - Pos = MAP_APPFONT( 0, 0 ); \ - Size = MAP_APPFONT( 85, 12 ); \ - \ - DropDown = TRUE; \ - TabStop = TRUE; \ - \ - HelpId = HID_FIELDLINK_DETAIL_COLUMN; \ - UniqueId = UID_FIELDLINK_DETAIL#n; \ - }; \ - FixedText 1 \ - { \ - Pos = MAP_APPFONT( 85, 0 ); \ - Size = MAP_APPFONT( 10, 12 ); \ - Center = TRUE; \ - }; \ - ComboBox 2 \ - { \ - Pos = MAP_APPFONT( 95, 0 ); \ - Size = MAP_APPFONT( 85, 12 ); \ - \ - DropDown = TRUE; \ - TabStop = TRUE; \ - \ - HelpId = HID_FIELDLINK_MASTER_COLUMN; \ - UniqueId = UID_FIELDLINK_MASTER#n; \ - }; \ - } - - ROW( 1 ); - ROW( 2 ); - ROW( 3 ); - ROW( 4 ); - - OKButton PB_OK - { - Pos = MAP_APPFONT( 199, 6 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT( 199, 23 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT( 199, 43 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; - - PushButton PB_SUGGEST - { - HelpID = "extensions:PushButton:RID_DLG_FORMLINKS:PB_SUGGEST"; - Pos = MAP_APPFONT( 199, 90 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - Hide = FALSE; - Disable = TRUE; - - Text [ en-US ] = "Suggest"; - }; - - String STR_DETAIL_FORM - { - Text [ en-US ] = "Sub Form"; - }; - - String STR_MASTER_FORM - { - Text [ en-US ] = "Master Form"; - }; - - String STR_ERROR_RETRIEVING_COLUMNS - { - Text [ en-US ] = "The columns of '#' could not be retrieved."; - Text [ x-comment ] ="# will be replace with a name."; - }; -}; diff --git a/extensions/source/propctrlr/formlocalid.hrc b/extensions/source/propctrlr/formlocalid.hrc deleted file mode 100644 index 61c9f82e5..000000000 --- a/extensions/source/propctrlr/formlocalid.hrc +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ -#define _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ - -#define TABPAGE_CHARACTERS 1 -#define TABPAGE_CHARACTERS_EXT 2 - -#define IMG_PLUS 1 -#define IMG_MINUS 2 - -#endif // _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx deleted file mode 100644 index 512978f08..000000000 --- a/extensions/source/propctrlr/formmetadata.cxx +++ /dev/null @@ -1,704 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "formmetadata.hxx" -#include "formstrings.hxx" -#include "formresid.hrc" -#include "propctrlr.hrc" -#include -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - - //======================================================================== - //= OPropertyInfoImpl - //======================================================================== - struct OPropertyInfoImpl - { - String sName; - String sTranslation; - rtl::OString sHelpId; - sal_Int32 nId; - sal_uInt16 nPos; - sal_uInt32 nUIFlags; - - OPropertyInfoImpl( - const ::rtl::OUString& rName, - sal_Int32 _nId, - const String& aTranslation, - sal_uInt16 nPosId, - const rtl::OString&, - sal_uInt32 _nUIFlags); - }; - - //------------------------------------------------------------------------ - OPropertyInfoImpl::OPropertyInfoImpl(const ::rtl::OUString& _rName, sal_Int32 _nId, - const String& aString, sal_uInt16 nP, const rtl::OString& sHid, sal_uInt32 _nUIFlags) - :sName(_rName) - ,sTranslation(aString) - ,sHelpId(sHid) - ,nId(_nId) - ,nPos(nP) - ,nUIFlags(_nUIFlags) - { - } - - //------------------------------------------------------------------------ - // Vergleichen von PropertyInfo - struct PropertyInfoLessByName : public ::std::binary_function< OPropertyInfoImpl, OPropertyInfoImpl, bool > - { - bool operator()( const OPropertyInfoImpl& _rLHS, const OPropertyInfoImpl& _rRHS ) - { - return _rLHS.sName.CompareTo( _rRHS.sName ) == COMPARE_LESS; - } - }; - - //======================================================================== - //= OPropertyInfoService - //======================================================================== -#define DEF_INFO( ident, uinameres, helpid, flags ) \ - OPropertyInfoImpl( PROPERTY_##ident, PROPERTY_ID_##ident, \ - String( PcrRes( RID_STR_##uinameres ) ), nPos++, HID_PROP_##helpid, flags ) - -#define DEF_INFO_1( ident, uinameres, helpid, flag1 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 ) - -#define DEF_INFO_2( ident, uinameres, helpid, flag1, flag2 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 ) - -#define DEF_INFO_3( ident, uinameres, helpid, flag1, flag2, flag3 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 ) - -#define DEF_INFO_4( ident, uinameres, helpid, flag1, flag2, flag3, flag4 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 ) - -#define DEF_INFO_5( ident, uinameres, helpid, flag1, flag2, flag3, flag4, flag5 ) \ - DEF_INFO( ident, uinameres, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 | PROP_FLAG_##flag5 ) - - sal_uInt16 OPropertyInfoService::s_nCount = 0; - OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = NULL; - //------------------------------------------------------------------------ - const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo() - { - if ( s_pPropertyInfos ) - return s_pPropertyInfos; - - PcrClient aResourceAccess; - // this ensures that we have our resource file loaded - - sal_uInt16 nPos = 1; - - static OPropertyInfoImpl aPropertyInfos[] = - { - /* - DEF_INFO_?( propname and id, resoure id, help id, flags ), - */ - DEF_INFO_3( NAME, NAME, NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( TITLE, TITLE, TITLE, FORM_VISIBLE, DIALOG_VISIBLE ), - DEF_INFO_3( LABEL, LABEL, LABEL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( CONTROLLABEL, LABELCONTROL, CONTROLLABEL, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( WRITING_MODE, WRITING_MODE, WRITING_MODE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( GROUP_NAME, GROUP_NAME, GROUP_NAME, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( TEXT, TEXT, TEXT, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( MAXTEXTLEN, MAXTEXTLEN, MAXTEXTLEN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( EDITMASK, EDITMASK, EDITMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( LITERALMASK, LITERALMASK, LITERALMASK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( STRICTFORMAT, STRICTFORMAT, STRICTFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( ENABLED, ENABLED, ENABLED, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( ENABLE_VISIBLE, ENABLE_VISIBLE, ENABLE_VISIBLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( READONLY, READONLY, READONLY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( PRINTABLE, PRINTABLE, PRINTABLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( STEP, STEP, STEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TABSTOP, TABSTOP, TABSTOP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( TABINDEX, TABINDEX, TABINDEX, FORM_VISIBLE, DIALOG_VISIBLE ), - DEF_INFO_3( WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, WHEEL_BEHAVIOR, FORM_VISIBLE, ENUM, COMPOSEABLE ), - - DEF_INFO_2( BOUND_CELL, BOUND_CELL, BOUND_CELL, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ), - DEF_INFO_2( LIST_CELL_RANGE, LIST_CELL_RANGE, LIST_CELL_RANGE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_3( CONTROLSOURCE, CONTROLSOURCE, CONTROLSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( EMPTY_IS_NULL, EMPTY_IS_NULL, EMPTY_IS_NULL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( INPUT_REQUIRED, INPUT_REQUIRED, INPUT_REQUIRED, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( REFVALUE, REFVALUE, REFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( DATASOURCE, DATASOURCE, DATASOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_4( COMMANDTYPE, CURSORSOURCETYPE, CURSORSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ), - DEF_INFO_3( COMMAND, CURSORSOURCE, CURSORSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( ESCAPE_PROCESSING, ESCAPE_PROCESSING, ESCAPE_PROCESSING, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( FILTER, FILTER, FILTER, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( SORT, SORT_CRITERIA, SORT_CRITERIA, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_2( MASTERFIELDS, MASTERFIELDS, MASTERFIELDS, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( DETAILFIELDS, SLAVEFIELDS, SLAVEFIELDS, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_3( ALLOWADDITIONS, ALLOW_ADDITIONS, ALLOW_ADDITIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( ALLOWEDITS, ALLOW_EDITS, ALLOW_EDITS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( ALLOWDELETIONS, ALLOW_DELETIONS, ALLOW_DELETIONS, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_4( INSERTONLY, DATAENTRY, DATAENTRY, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE, COMPOSEABLE ), - DEF_INFO_4( NAVIGATION, NAVIGATION, NAVIGATION, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ), - DEF_INFO_4( CYCLE, CYCLE, CYCLE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ), - DEF_INFO_3( FILTERPROPOSAL, FILTERPROPOSAL, FILTERPROPOSAL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_4( LISTSOURCETYPE, LISTSOURCETYPE, LISTSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ), - DEF_INFO_3( LISTSOURCE, LISTSOURCE, LISTSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - DEF_INFO_3( BOUNDCOLUMN, BOUNDCOLUMN, BOUNDCOLUMN, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ), - - // - // XML node binding - DEF_INFO_2( LIST_BINDING, LIST_BINDING, LIST_BINDING, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XML_DATA_MODEL, XML_DATA_MODEL, XML_DATA_MODEL, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( BINDING_NAME, BINDING_NAME, BINDING_NAME, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( BIND_EXPRESSION, BIND_EXPRESSION, BIND_EXPRESSION, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_REQUIRED, XSD_REQUIRED, XSD_REQUIRED, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_RELEVANT, XSD_RELEVANT, XSD_RELEVANT, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_READONLY, XSD_READONLY, XSD_READONLY, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_CONSTRAINT, XSD_CONSTRAINT, XSD_CONSTRAINT, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_CALCULATION, XSD_CALCULATION, XSD_CALCULATION, FORM_VISIBLE, DATA_PROPERTY ), - - // data type - DEF_INFO_2( XSD_DATA_TYPE, XSD_DATA_TYPE, XSD_DATA_TYPE, FORM_VISIBLE, DATA_PROPERTY ), - // data types facets - // common - DEF_INFO_3( XSD_WHITESPACES, XSD_WHITESPACES, XSD_WHITESPACES, FORM_VISIBLE, DATA_PROPERTY, ENUM ), - DEF_INFO_2( XSD_PATTERN, XSD_PATTERN, XSD_PATTERN, FORM_VISIBLE, DATA_PROPERTY ), - // string - DEF_INFO_2( XSD_LENGTH, XSD_LENGTH, XSD_LENGTH, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_LENGTH, XSD_MIN_LENGTH, XSD_MIN_LENGTH, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_LENGTH, XSD_MAX_LENGTH, XSD_MAX_LENGTH, FORM_VISIBLE, DATA_PROPERTY ), - // decimal - DEF_INFO_2( XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, XSD_TOTAL_DIGITS, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,XSD_FRACTION_DIGITS,FORM_VISIBLE, DATA_PROPERTY ), - // int value types (year, month, day) - DEF_INFO_2( XSD_MAX_INCLUSIVE_INT, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_EXCLUSIVE_INT, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_INCLUSIVE_INT, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_EXCLUSIVE_INT, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - // double value types (double, float, decimal) - DEF_INFO_2( XSD_MAX_INCLUSIVE_DOUBLE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_EXCLUSIVE_DOUBLE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_INCLUSIVE_DOUBLE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_EXCLUSIVE_DOUBLE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - // date value type - DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - // time value type - DEF_INFO_2( XSD_MAX_INCLUSIVE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_EXCLUSIVE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_INCLUSIVE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_EXCLUSIVE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - // dateTime value type - DEF_INFO_2( XSD_MAX_INCLUSIVE_DATE_TIME, XSD_MAX_INCLUSIVE, XSD_MAX_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MAX_EXCLUSIVE_DATE_TIME, XSD_MAX_EXCLUSIVE, XSD_MAX_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_INCLUSIVE_DATE_TIME, XSD_MIN_INCLUSIVE, XSD_MIN_INCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - DEF_INFO_2( XSD_MIN_EXCLUSIVE_DATE_TIME, XSD_MIN_EXCLUSIVE, XSD_MIN_EXCLUSIVE, FORM_VISIBLE, DATA_PROPERTY ), - // - - DEF_INFO_2( HIDDEN_VALUE, VALUE, HIDDEN_VALUE, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( VALUE, VALUE, VALUE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( VALUEMIN, VALUEMIN, VALUEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( VALUEMAX, VALUEMAX, VALUEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( VALUESTEP, VALUESTEP, VALUESTEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_VALUE, DEFAULTVALUE, DEFAULT_LONG_VALUE,FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( DECIMAL_ACCURACY, DECIMAL_ACCURACY, DECIMAL_ACCURACY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, SHOWTHOUSANDSEP, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_3( CURRENCYSYMBOL, CURRENCYSYMBOL, CURRENCYSYMBOL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( CURRSYM_POSITION, CURRSYM_POSITION, CURRSYM_POSITION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_2( DATE, DATE, DATE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( DATEMIN, DATEMIN, DATEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( DATEMAX, DATEMAX, DATEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( DATEFORMAT, DATEFORMAT, DATEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_DATE, DEFAULTDATE, DEFAULT_DATE, FORM_VISIBLE, COMPOSEABLE ), - - DEF_INFO_2( TIME, TIME, TIME, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TIMEMIN, TIMEMIN, TIMEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TIMEMAX, TIMEMAX, TIMEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( TIMEFORMAT, TIMEFORMAT, TIMEFORMAT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_TIME, DEFAULTTIME, DEFAULT_TIME, FORM_VISIBLE, COMPOSEABLE ), - - DEF_INFO_1( EFFECTIVE_VALUE, VALUE, VALUE, DIALOG_VISIBLE ), - DEF_INFO_3( EFFECTIVE_MIN, VALUEMIN, EFFECTIVEMIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( EFFECTIVE_MAX, VALUEMAX, EFFECTIVEMAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( EFFECTIVE_DEFAULT, DEFAULTVALUE, EFFECTIVEDEFAULT, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FORMATKEY, FORMATKEY, FORMATKEY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_3( PROGRESSVALUE, PROGRESSVALUE, PROGRESSVALUE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, PROGRESSVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, PROGRESSVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_2( SCROLLVALUE, SCROLLVALUE, SCROLLVALUE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SCROLLVALUE_MIN, SCROLLVALUE_MIN, SCROLLVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SCROLLVALUE_MAX, SCROLLVALUE_MAX, SCROLLVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( LINEINCREMENT, LINEINCREMENT, LINEINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( BLOCKINCREMENT, BLOCKINCREMENT, BLOCKINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_2( SPINVALUE, VALUE, SPINVALUE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SPINVALUE_MIN, VALUEMIN, SPINVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SPINVALUE_MAX, VALUEMAX, SPINVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_SPINVALUE,DEFAULTVALUE, DEFAULT_SPINVALUE, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SPININCREMENT, VALUESTEP, SPININCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_3( SPIN, SPIN, SPIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( REPEAT, REPEAT, REPEAT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( REPEAT_DELAY, REPEAT_DELAY, REPEAT_DELAY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( VISIBLESIZE, VISIBLESIZE, VISIBLESIZE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( ORIENTATION, ORIENTATION, ORIENTATION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( FOCUSONCLICK, FOCUSONCLICK, FOCUSONCLICK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TOGGLE, TOGGLE, TOGGLE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( DEFAULT_STATE, DEFAULT_STATE, DEFAULT_STATE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - - DEF_INFO_3( TEXT_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( SHEET_ANCHOR_TYPE, ANCHOR_TYPE, ANCHOR_TYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( POSITIONX, POSITIONX, POSITIONX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( POSITIONY, POSITIONY, POSITIONY, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( WIDTH, WIDTH, WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HEIGHT, HEIGHT, HEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - - DEF_INFO_1( LISTINDEX, LISTINDEX, LISTINDEX, FORM_VISIBLE ), - DEF_INFO_3( STRINGITEMLIST, STRINGITEMLIST, STRINGITEMLIST, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( DEFAULT_TEXT, DEFAULTTEXT, DEFAULTVALUE, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FONT, FONT, FONT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( VISUALEFFECT, VISUALEFFECT, VISUALEFFECT, FORM_VISIBLE, DIALOG_VISIBLE, ENUM_ONE, COMPOSEABLE ), - DEF_INFO_4( ALIGN, ALIGN, ALIGN, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( VERTICAL_ALIGN, VERTICAL_ALIGN, VERTICAL_ALIGN, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( ROWHEIGHT, ROWHEIGHT, ROWHEIGHT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( BACKGROUNDCOLOR, BACKGROUNDCOLOR, BACKGROUNDCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SYMBOLCOLOR, SYMBOLCOLOR, SYMBOLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( FILLCOLOR, FILLCOLOR, FILLCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( LINECOLOR, LINECOLOR, LINECOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( BORDER, BORDER, BORDER, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( BORDERCOLOR, BORDERCOLOR, BORDERCOLOR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( ICONSIZE, ICONSIZE, ICONSIZE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( SHOW_POSITION, SHOW_POSITION, SHOW_POSITION, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SHOW_NAVIGATION, SHOW_NAVIGATION, SHOW_NAVIGATION, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SHOW_RECORDACTIONS,SHOW_RECORDACTIONS, SHOW_RECORDACTIONS,FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SHOW_FILTERSORT, SHOW_FILTERSORT, SHOW_FILTERSORT, FORM_VISIBLE, COMPOSEABLE ), - - DEF_INFO_3( DROPDOWN, DROPDOWN, DROPDOWN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( LINECOUNT, LINECOUNT, LINECOUNT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( AUTOCOMPLETE, AUTOCOMPLETE, AUTOCOMPLETE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( MULTILINE, MULTILINE, MULTILINE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( WORDBREAK, WORDBREAK, WORDBREAK, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TEXTTYPE, TEXTTYPE, TEXTTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( LINEEND_FORMAT, LINEEND_FORMAT, LINEEND_FORMAT, FORM_VISIBLE, ENUM_ONE, COMPOSEABLE ), - DEF_INFO_3( MULTISELECTION, MULTISELECTION, MULTISELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( SHOW_SCROLLBARS, SHOW_SCROLLBARS, SHOW_SCROLLBARS, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( HSCROLL, HSCROLL, HSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( VSCROLL, VSCROLL, VSCROLL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( XFORMS_BUTTONTYPE, BUTTONTYPE, BUTTONTYPE, FORM_VISIBLE, ENUM ), - DEF_INFO_1( SUBMISSION_ID, SUBMISSION_ID, SUBMISSION_ID, FORM_VISIBLE ), - DEF_INFO_2( PUSHBUTTONTYPE, PUSHBUTTONTYPE, PUSHBUTTONTYPE, DIALOG_VISIBLE, ENUM ), - DEF_INFO_2( TARGET_URL, TARGET_URL, TARGET_URL, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_1( TARGET_FRAME, TARGET_FRAME, TARGET_FRAME, FORM_VISIBLE ), - DEF_INFO_2( SUBMIT_ACTION, SUBMIT_ACTION, SUBMIT_ACTION, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SUBMIT_TARGET, SUBMIT_TARGET, SUBMIT_TARGET, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SUBMIT_ENCODING, SUBMIT_ENCODING, SUBMIT_ENCODING, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( SUBMIT_METHOD, SUBMIT_METHOD, SUBMIT_METHOD, FORM_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( STATE, STATE, STATE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( DEFAULTBUTTON, DEFAULT_BUTTON, DEFAULT_BUTTON, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_3( SCALEIMAGE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_4( SCALE_MODE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE, ENUM ), - DEF_INFO_2( DEFAULT_SELECT_SEQ,DEFAULT_SELECT_SEQ, DEFAULT_SELECT_SEQ,FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SELECTEDITEMS, SELECTEDITEMS, SELECTEDITEMS, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( ECHO_CHAR, ECHO_CHAR, ECHO_CHAR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, HIDEINACTIVESELECTION, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TRISTATE, TRISTATE, TRISTATE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( HASNAVIGATION, NAVIGATION, NAVIGATIONBAR, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( RECORDMARKER, RECORDMARKER, RECORDMARKER, FORM_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( TAG, TAG, TAG, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HELPTEXT, HELPTEXT, HELPTEXT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( HELPURL, HELPURL, HELPURL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_3( SELECTION_TYPE, SELECTION_TYPE, SELECTION_TYPE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ), - DEF_INFO_2( ROOT_DISPLAYED, ROOT_DISPLAYED, ROOT_DISPLAYED, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SHOWS_HANDLES, SHOWS_HANDLES, SHOWS_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, SHOWS_ROOT_HANDLES, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( EDITABLE, EDITABLE, EDITABLE, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, INVOKES_STOP_NOT_EDITING, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( DECORATION, DECORATION, DECORATION, DIALOG_VISIBLE, COMPOSEABLE ), - DEF_INFO_2( NOLABEL, NOLABEL, NOLABEL, DIALOG_VISIBLE, COMPOSEABLE ) - }; - - s_pPropertyInfos = aPropertyInfos; - s_nCount = SAL_N_ELEMENTS(aPropertyInfos); - - // sort - ::std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() ); - -#if OSL_DEBUG_LEVEL > 0 - for ( const OPropertyInfoImpl* pCheck = s_pPropertyInfos; pCheck != s_pPropertyInfos + s_nCount - 1; ++pCheck ) - { - OSL_ENSURE( pCheck->sName != ( pCheck + 1 )->sName, "OPropertyInfoService::getPropertyInfo: duplicate entry in the table!" ); - } -#endif - - return s_pPropertyInfos; - } - - //------------------------------------------------------------------------ - sal_Int32 OPropertyInfoService::getPropertyId(const String& _rName) const - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName); - return pInfo ? pInfo->nId : -1; - } - - //------------------------------------------------------------------------ - String OPropertyInfoService::getPropertyName( sal_Int32 _nPropId ) - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_nPropId); - return pInfo ? pInfo->sName : String(); - } - - //------------------------------------------------------------------------ - String OPropertyInfoService::getPropertyTranslation(sal_Int32 _nId) const - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sTranslation : String(); - } - - //------------------------------------------------------------------------ - rtl::OString OPropertyInfoService::getPropertyHelpId(sal_Int32 _nId) const - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->sHelpId : rtl::OString(); - } - - //------------------------------------------------------------------------ - sal_Int16 OPropertyInfoService::getPropertyPos(sal_Int32 _nId) const - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nPos : 0xFFFF; - } - - //------------------------------------------------------------------------ - sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) const - { - const OPropertyInfoImpl* pInfo = getPropertyInfo(_nId); - return (pInfo) ? pInfo->nUIFlags : 0; - } - - //------------------------------------------------------------------------ - ::std::vector< ::rtl::OUString > OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const - { - OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ), - "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" ); - - sal_Int16 nStringItemsResId = 0; - switch ( _nId ) - { - case PROPERTY_ID_IMAGEPOSITION: - nStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION; - break; - case PROPERTY_ID_BORDER: - nStringItemsResId = RID_RSC_ENUM_BORDER_TYPE; - break; - case PROPERTY_ID_ICONSIZE: - nStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE; - break; - case PROPERTY_ID_COMMANDTYPE: - nStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE; - break; - case PROPERTY_ID_LISTSOURCETYPE: - nStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE; - break; - case PROPERTY_ID_ALIGN: - nStringItemsResId = RID_RSC_ENUM_ALIGNMENT; - break; - case PROPERTY_ID_VERTICAL_ALIGN: - nStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN; - break; - case PROPERTY_ID_BUTTONTYPE: - nStringItemsResId = RID_RSC_ENUM_BUTTONTYPE; - break; - case PROPERTY_ID_PUSHBUTTONTYPE: - nStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE; - break; - case PROPERTY_ID_SUBMIT_METHOD: - nStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD; - break; - case PROPERTY_ID_SUBMIT_ENCODING: - nStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING; - break; - case PROPERTY_ID_DATEFORMAT: - nStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST; - break; - case PROPERTY_ID_TIMEFORMAT: - nStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST; - break; - case PROPERTY_ID_DEFAULT_STATE: - case PROPERTY_ID_STATE: - nStringItemsResId = RID_RSC_ENUM_CHECKED; - break; - case PROPERTY_ID_CYCLE: - nStringItemsResId = RID_RSC_ENUM_CYCLE; - break; - case PROPERTY_ID_NAVIGATION: - nStringItemsResId = RID_RSC_ENUM_NAVIGATION; - break; - case PROPERTY_ID_TARGET_FRAME: - nStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET; - break; - case PROPERTY_ID_ORIENTATION: - nStringItemsResId = RID_RSC_ENUM_ORIENTATION; - break; - case PROPERTY_ID_CELL_EXCHANGE_TYPE: - nStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE; - break; - case PROPERTY_ID_SHOW_SCROLLBARS: - nStringItemsResId = RID_RSC_ENUM_SCROLLBARS; - break; - case PROPERTY_ID_VISUALEFFECT: - nStringItemsResId = RID_RSC_ENUM_VISUALEFFECT; - break; - case PROPERTY_ID_TEXTTYPE: - nStringItemsResId = RID_RSC_ENUM_TEXTTYPE; - break; - case PROPERTY_ID_LINEEND_FORMAT: - nStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT; - break; - case PROPERTY_ID_XSD_WHITESPACES: - nStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING; - break; - case PROPERTY_ID_SELECTION_TYPE: - nStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE; - break; - case PROPERTY_ID_SCALE_MODE: - nStringItemsResId = RID_RSC_ENUM_SCALE_MODE; - break; - case PROPERTY_ID_WRITING_MODE: - nStringItemsResId = RID_RSC_ENUM_WRITING_MODE; - break; - case PROPERTY_ID_WHEEL_BEHAVIOR: - nStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR; - break; - case PROPERTY_ID_TEXT_ANCHOR_TYPE: - nStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE; - break; - case PROPERTY_ID_SHEET_ANCHOR_TYPE: - nStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE; - break; - default: - OSL_FAIL( "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" ); - break; - } - - ::std::vector< ::rtl::OUString > aReturn; - - if ( nStringItemsResId ) - { - PcrRes aResId( nStringItemsResId ); - ::svt::OLocalResourceAccess aEnumStrings( aResId, RSC_RESOURCE ); - - sal_Int16 i = 1; - PcrRes aLocalId( i ); - while ( aEnumStrings.IsAvailableRes( aLocalId.SetRT( RSC_STRING ) ) ) - { - aReturn.push_back( String( aLocalId ) ); - aLocalId = PcrRes( ++i ); - } - } - - return aReturn; - } - - //------------------------------------------------------------------------ - sal_Bool OPropertyInfoService::isComposeable( const ::rtl::OUString& _rPropertyName ) const - { - sal_Int32 nId = getPropertyId( _rPropertyName ); - if ( nId == -1 ) - return sal_False; - - sal_uInt32 nFlags = getPropertyUIFlags( nId ); - return ( nFlags & PROP_FLAG_COMPOSEABLE ) != 0; - } - - //------------------------------------------------------------------------ - const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const String& _rName) - { - // intialisierung - if(!s_pPropertyInfos) - getPropertyInfo(); - OPropertyInfoImpl aSearch(_rName, 0L, String(), 0, "", 0); - - const OPropertyInfoImpl* pInfo = ::std::lower_bound( - s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() ); - - if ( pInfo == s_pPropertyInfos + s_nCount ) - return NULL; - - if ( pInfo->sName != _rName ) - return NULL; - - return pInfo; - } - - - //------------------------------------------------------------------------ - const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId) - { - // intialisierung - if(!s_pPropertyInfos) - getPropertyInfo(); - - // TODO: a real structure which allows quick access by name as well as by id - for (sal_uInt16 i = 0; i < s_nCount; i++) - if (s_pPropertyInfos[i].nId == _nId) - return &s_pPropertyInfos[i]; - - return NULL; - } - - //==================================================================== - //= DefaultEnumRepresentation - //==================================================================== - DBG_NAME( DefaultEnumRepresentation ) - //-------------------------------------------------------------------- - DefaultEnumRepresentation::DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const Type& _rType, sal_Int32 _nPropertyId ) - :m_refCount( 0 ) - ,m_rMetaData( _rInfo ) - ,m_aType( _rType ) - ,m_nPropertyId( _nPropertyId ) - { - DBG_CTOR( DefaultEnumRepresentation, NULL ); - } - - //-------------------------------------------------------------------- - DefaultEnumRepresentation::~DefaultEnumRepresentation() - { - DBG_DTOR( DefaultEnumRepresentation, NULL ); - } - - //-------------------------------------------------------------------- - ::std::vector< ::rtl::OUString > SAL_CALL DefaultEnumRepresentation::getDescriptions() const - { - return m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - } - - //-------------------------------------------------------------------- - void SAL_CALL DefaultEnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const - { - sal_uInt32 nPropertyUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId ); - ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - ::std::vector< ::rtl::OUString >::const_iterator pos = ::std::find( aEnumStrings.begin(), aEnumStrings.end(), _rDescription ); - if ( pos != aEnumStrings.end() ) - { - sal_Int32 nPos = pos - aEnumStrings.begin(); - if ( ( nPropertyUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE ) - // enum value starting with 1 - ++nPos; - - switch ( m_aType.getTypeClass() ) - { - case TypeClass_ENUM: - _out_rValue = ::cppu::int2enum( nPos, m_aType ); - break; - - case TypeClass_SHORT: - _out_rValue <<= (sal_Int16)nPos; - break; - - case TypeClass_UNSIGNED_SHORT: - _out_rValue <<= (sal_uInt16)nPos; - break; - - case TypeClass_UNSIGNED_LONG: - _out_rValue <<= (sal_uInt32)nPos; - break; - - default: - _out_rValue <<= (sal_Int32)nPos; - break; - } - } - else - { - OSL_FAIL( "DefaultEnumRepresentation::getValueFromDescription: could not translate the enum string!" ); - _out_rValue.clear(); - } - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL DefaultEnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const - { - ::rtl::OUString sReturn; - sal_Int32 nIntValue = -1; - OSL_VERIFY( ::cppu::enum2int( nIntValue, _rEnumValue ) ); - - sal_uInt32 nUIFlags = m_rMetaData.getPropertyUIFlags( m_nPropertyId ); - if ( ( nUIFlags & PROP_FLAG_ENUM_ONE ) == PROP_FLAG_ENUM_ONE ) - // enum value starting with 1 - --nIntValue; - - ::std::vector< ::rtl::OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - if ( ( nIntValue >= 0 ) && ( nIntValue < (sal_Int32)aEnumStrings.size() ) ) - { - sReturn = aEnumStrings[ nIntValue ]; - } - else - { - OSL_FAIL( "DefaultEnumRepresentation::getDescriptionForValue: could not translate an enum value" ); - } - return sReturn; - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL DefaultEnumRepresentation::acquire() - { - return osl_incrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL DefaultEnumRepresentation::release() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - { - delete this; - return 0; - } - return m_refCount; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx deleted file mode 100644 index 83c71194c..000000000 --- a/extensions/source/propctrlr/formmetadata.hxx +++ /dev/null @@ -1,351 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_FORMMETADATA_HXX_ -#define _EXTENSIONS_PROPCTRLR_FORMMETADATA_HXX_ - -#include "propertyinfo.hxx" -#include "modulepcr.hxx" -#include "enumrepresentation.hxx" -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - struct OPropertyInfoImpl; - - //======================================================================== - //= OPropertyInfoService - //======================================================================== - class OPropertyInfoService - :public IPropertyInfoService - ,public ::comphelper::IPropertySetComposerCallback - ,public PcrClient - { - protected: - static sal_uInt16 s_nCount; - static OPropertyInfoImpl* s_pPropertyInfos; - // TODO: a real structure which allows quick access by name as well as by id - - public: - // IPropertyInfoService - virtual sal_Int32 getPropertyId(const String& _rName) const; - virtual String getPropertyTranslation(sal_Int32 _nId) const; - virtual rtl::OString getPropertyHelpId(sal_Int32 _nId) const; - virtual sal_Int16 getPropertyPos(sal_Int32 _nId) const; - virtual sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const; - virtual ::std::vector< ::rtl::OUString > getPropertyEnumRepresentations(sal_Int32 _nId) const; - virtual String getPropertyName( sal_Int32 _nPropId ); - - // IPropertySetComposerCallback - virtual sal_Bool isComposeable( const ::rtl::OUString& _rPropertyName ) const; - - protected: - static const OPropertyInfoImpl* getPropertyInfo(); - - static const OPropertyInfoImpl* getPropertyInfo(const String& _rName); - static const OPropertyInfoImpl* getPropertyInfo(sal_Int32 _nId); - }; - - //======================================================================== - //= DefaultEnumRepresentation - //======================================================================== - /** an implementation of the IPropertyEnumRepresentation - - To be used with properties which, in formmetadata.cxx, are declared as ENUM. - */ - class DefaultEnumRepresentation : public IPropertyEnumRepresentation - { - private: - oslInterlockedCount m_refCount; - const IPropertyInfoService& m_rMetaData; - ::com::sun::star::uno::Type m_aType; - const sal_Int32 m_nPropertyId; - - public: - /** constructs an instance - - @param _rInfo - An instance implementing IPropertyInfoService. Must live at least as - long as the DefaultEnumRepresentation should live. - */ - DefaultEnumRepresentation( const IPropertyInfoService& _rInfo, const ::com::sun::star::uno::Type& _rType, sal_Int32 _nPropertyId ); - - protected: - ~DefaultEnumRepresentation(); - - protected: - // IPropertyEnumRepresentation implementqation - virtual ::std::vector< ::rtl::OUString > - SAL_CALL getDescriptions() const; - virtual void SAL_CALL getValueFromDescription( const ::rtl::OUString& _rDescription, ::com::sun::star::uno::Any& _out_rValue ) const; - virtual ::rtl::OUString SAL_CALL getDescriptionForValue( const ::com::sun::star::uno::Any& _rEnumValue ) const; - - // IReference implementqation - virtual oslInterlockedCount SAL_CALL acquire(); - virtual oslInterlockedCount SAL_CALL release(); - - private: - DefaultEnumRepresentation(); // never implemented - DefaultEnumRepresentation( const DefaultEnumRepresentation& ); // never implemented - DefaultEnumRepresentation& operator=( const DefaultEnumRepresentation& ); // never implemented - }; - - //======================================================================== - //= UI flags (for all browseable properties) - //======================================================================== - -#define PROP_FLAG_NONE 0x00000000 // no special flag -#define PROP_FLAG_FORM_VISIBLE 0x00000001 // the property is visible when inspecting a form object -#define PROP_FLAG_DIALOG_VISIBLE 0x00000002 // the property is visible when inspecting a dialog object -#define PROP_FLAG_DATA_PROPERTY 0x00000004 // the property is to appear on the "Data" page -#define PROP_FLAG_ENUM 0x00000020 // the property is some kind of enum property, i.e. its - // value is chosen from a fixed list of possible values -#define PROP_FLAG_ENUM_ONE 0x00000060 // the property is an enum property starting with 1 - // (note that this includes PROP_FLAG_ENUM) -#define PROP_FLAG_COMPOSEABLE 0x00000080 // the property is "composeable", i.e. an intersection of property - // sets should expose it, if all elements do -#define PROP_FLAG_EXPERIMENTAL 0x00000100 // the property is experimental, i.e. should not appear in the - // UI, unless experimental properties are enabled by a configuraiton - // option - - //======================================================================== - //= property ids (for all browseable properties) - //======================================================================== - - #define PROPERTY_ID_NAME 1 - #define PROPERTY_ID_LABEL 2 - #define PROPERTY_ID_CONTROLLABEL 3 - #define PROPERTY_ID_MAXTEXTLEN 4 - #define PROPERTY_ID_EDITMASK 5 - #define PROPERTY_ID_LITERALMASK 6 - #define PROPERTY_ID_STRICTFORMAT 7 - #define PROPERTY_ID_ENABLED 8 - #define PROPERTY_ID_READONLY 9 - #define PROPERTY_ID_PRINTABLE 10 - #define PROPERTY_ID_CONTROLSOURCE 11 - #define PROPERTY_ID_TABSTOP 12 - #define PROPERTY_ID_TABINDEX 13 - #define PROPERTY_ID_DATASOURCE 14 - #define PROPERTY_ID_COMMAND 15 - #define PROPERTY_ID_COMMANDTYPE 16 - #define PROPERTY_ID_FILTER 17 - #define PROPERTY_ID_SORT 18 - #define PROPERTY_ID_INSERTONLY 19 - #define PROPERTY_ID_ALLOWADDITIONS 20 - #define PROPERTY_ID_ALLOWEDITS 21 - #define PROPERTY_ID_ALLOWDELETIONS 22 - #define PROPERTY_ID_GROUP_NAME 23 - #define PROPERTY_ID_NAVIGATION 24 - #define PROPERTY_ID_CYCLE 25 - #define PROPERTY_ID_HIDDEN_VALUE 26 - #define PROPERTY_ID_VALUEMIN 27 - #define PROPERTY_ID_VALUEMAX 28 - #define PROPERTY_ID_VALUESTEP 29 - #define PROPERTY_ID_DEFAULT_VALUE 30 - #define PROPERTY_ID_DECIMAL_ACCURACY 31 - #define PROPERTY_ID_SHOWTHOUSANDSEP 32 - #define PROPERTY_ID_REFVALUE 33 - #define PROPERTY_ID_CURRENCYSYMBOL 34 - #define PROPERTY_ID_CURRSYM_POSITION 35 - #define PROPERTY_ID_DATEMIN 36 - #define PROPERTY_ID_DATEMAX 37 - #define PROPERTY_ID_DATEFORMAT 38 - #define PROPERTY_ID_SELECTEDITEMS 39 - #define PROPERTY_ID_DEFAULT_DATE 40 - #define PROPERTY_ID_TIMEMIN 41 - #define PROPERTY_ID_TIMEMAX 42 - #define PROPERTY_ID_TIMEFORMAT 43 - #define PROPERTY_ID_DEFAULT_TIME 44 - #define PROPERTY_ID_EFFECTIVE_MIN 45 - #define PROPERTY_ID_EFFECTIVE_MAX 46 - #define PROPERTY_ID_EFFECTIVE_DEFAULT 47 - #define PROPERTY_ID_FORMATKEY 48 - #define PROPERTY_ID_CLASSID 50 - #define PROPERTY_ID_HEIGHT 51 - #define PROPERTY_ID_WIDTH 52 - #define PROPERTY_ID_BOUNDCOLUMN 53 - #define PROPERTY_ID_LISTSOURCETYPE 54 - #define PROPERTY_ID_LISTSOURCE 55 - #define PROPERTY_ID_LISTINDEX 56 - #define PROPERTY_ID_STRINGITEMLIST 57 - #define PROPERTY_ID_DEFAULT_TEXT 58 - #define PROPERTY_ID_FONT 59 - #define PROPERTY_ID_ALIGN 60 - #define PROPERTY_ID_ROWHEIGHT 61 - #define PROPERTY_ID_BACKGROUNDCOLOR 62 - #define PROPERTY_ID_FILLCOLOR 63 - #define PROPERTY_ID_ESCAPE_PROCESSING 64 - #define PROPERTY_ID_LINECOLOR 65 - #define PROPERTY_ID_BORDER 66 - #define PROPERTY_ID_DROPDOWN 67 - #define PROPERTY_ID_AUTOCOMPLETE 68 - #define PROPERTY_ID_LINECOUNT 69 - #define PROPERTY_ID_WORDBREAK 70 - #define PROPERTY_ID_MULTILINE 71 - #define PROPERTY_ID_MULTISELECTION 72 - #define PROPERTY_ID_AUTOLINEBREAK 73 - #define PROPERTY_ID_HSCROLL 74 - #define PROPERTY_ID_VSCROLL 75 - #define PROPERTY_ID_SPIN 76 - #define PROPERTY_ID_BUTTONTYPE 77 - #define PROPERTY_ID_TARGET_URL 78 - #define PROPERTY_ID_TARGET_FRAME 79 - #define PROPERTY_ID_SUBMIT_ACTION 80 - #define PROPERTY_ID_SUBMIT_TARGET 81 - #define PROPERTY_ID_SUBMIT_METHOD 82 - #define PROPERTY_ID_SUBMIT_ENCODING 83 - #define PROPERTY_ID_DEFAULT_STATE 84 - #define PROPERTY_ID_DEFAULTBUTTON 85 - #define PROPERTY_ID_IMAGE_URL 86 - #define PROPERTY_ID_DEFAULT_SELECT_SEQ 87 - #define PROPERTY_ID_ECHO_CHAR 88 - #define PROPERTY_ID_EMPTY_IS_NULL 89 - #define PROPERTY_ID_TRISTATE 90 - #define PROPERTY_ID_MASTERFIELDS 91 - #define PROPERTY_ID_DETAILFIELDS 92 - #define PROPERTY_ID_RECORDMARKER 93 - #define PROPERTY_ID_FILTERPROPOSAL 94 - #define PROPERTY_ID_TAG 95 - #define PROPERTY_ID_HELPTEXT 96 - #define PROPERTY_ID_HELPURL 97 - #define PROPERTY_ID_HASNAVIGATION 98 - #define PROPERTY_ID_POSITIONX 99 - #define PROPERTY_ID_POSITIONY 100 - #define PROPERTY_ID_TITLE 101 - #define PROPERTY_ID_STEP 102 - #define PROPERTY_ID_PROGRESSVALUE 103 - #define PROPERTY_ID_PROGRESSVALUE_MIN 104 - #define PROPERTY_ID_PROGRESSVALUE_MAX 105 - #define PROPERTY_ID_SCROLLVALUE 106 - #define PROPERTY_ID_SCROLLVALUE_MAX 107 - #define PROPERTY_ID_LINEINCREMENT 108 - #define PROPERTY_ID_BLOCKINCREMENT 109 - #define PROPERTY_ID_VISIBLESIZE 110 - #define PROPERTY_ID_ORIENTATION 111 - #define PROPERTY_ID_IMAGEPOSITION 112 - #define PROPERTY_ID_DATE 113 - #define PROPERTY_ID_STATE 114 - #define PROPERTY_ID_TIME 115 - #define PROPERTY_ID_VALUE 116 - #define PROPERTY_ID_SCALEIMAGE 117 - #define PROPERTY_ID_PUSHBUTTONTYPE 118 - #define PROPERTY_ID_EFFECTIVE_VALUE 119 - #define PROPERTY_ID_TEXT 120 - #define PROPERTY_ID_BOUND_CELL 121 - #define PROPERTY_ID_LIST_CELL_RANGE 122 - #define PROPERTY_ID_CELL_EXCHANGE_TYPE 123 - #define PROPERTY_ID_SCROLLVALUE_MIN 124 - #define PROPERTY_ID_DEFAULT_SCROLLVALUE 125 - #define PROPERTY_ID_REPEAT_DELAY 126 - #define PROPERTY_ID_SYMBOLCOLOR 127 - #define PROPERTY_ID_SPINVALUE 128 - #define PROPERTY_ID_SPINVALUE_MIN 129 - #define PROPERTY_ID_SPINVALUE_MAX 130 - #define PROPERTY_ID_DEFAULT_SPINVALUE 131 - #define PROPERTY_ID_SPININCREMENT 132 - #define PROPERTY_ID_REPEAT 133 - #define PROPERTY_ID_SHOW_SCROLLBARS 134 - #define PROPERTY_ID_ICONSIZE 135 - #define PROPERTY_ID_SHOW_POSITION 136 - #define PROPERTY_ID_SHOW_NAVIGATION 137 - #define PROPERTY_ID_SHOW_RECORDACTIONS 138 - #define PROPERTY_ID_SHOW_FILTERSORT 139 - #define PROPERTY_ID_TEXTTYPE 140 - #define PROPERTY_ID_LINEEND_FORMAT 141 - #define PROPERTY_ID_TOGGLE 142 - #define PROPERTY_ID_FOCUSONCLICK 143 - #define PROPERTY_ID_HIDEINACTIVESELECTION 144 - #define PROPERTY_ID_VISUALEFFECT 145 - #define PROPERTY_ID_BORDERCOLOR 146 - #define PROPERTY_ID_XML_DATA_MODEL 147 - #define PROPERTY_ID_BIND_EXPRESSION 148 - #define PROPERTY_ID_XSD_REQUIRED 149 - #define PROPERTY_ID_XSD_RELEVANT 150 - #define PROPERTY_ID_XSD_READONLY 151 - #define PROPERTY_ID_XSD_CONSTRAINT 152 - #define PROPERTY_ID_XSD_CALCULATION 153 - #define PROPERTY_ID_XSD_DATA_TYPE 154 - #define PROPERTY_ID_XSD_WHITESPACES 155 - #define PROPERTY_ID_XSD_PATTERN 156 - #define PROPERTY_ID_XSD_LENGTH 157 - #define PROPERTY_ID_XSD_MIN_LENGTH 158 - #define PROPERTY_ID_XSD_MAX_LENGTH 159 - #define PROPERTY_ID_XSD_TOTAL_DIGITS 160 - #define PROPERTY_ID_XSD_FRACTION_DIGITS 161 - #define PROPERTY_ID_XSD_MAX_INCLUSIVE_INT 162 - #define PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT 163 - #define PROPERTY_ID_XSD_MIN_INCLUSIVE_INT 164 - #define PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT 165 - #define PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE 166 - #define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE 167 - #define PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE 168 - #define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE 169 - #define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE 170 - #define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE 171 - #define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE 172 - #define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE 173 - #define PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME 174 - #define PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME 175 - #define PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME 176 - #define PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME 177 - #define PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME 178 - #define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME 179 - #define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME 180 - #define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME 181 - #define PROPERTY_ID_UNCHECKEDREFVALUE 182 - #define PROPERTY_ID_SUBMISSION_ID 183 - #define PROPERTY_ID_XFORMS_BUTTONTYPE 184 - #define PROPERTY_ID_LIST_BINDING 185 - #define PROPERTY_ID_VERTICAL_ALIGN 186 - #define PROPERTY_ID_BINDING_NAME 187 - #define PROPERTY_ID_DECORATION 188 - #define PROPERTY_ID_SELECTION_TYPE 189 - #define PROPERTY_ID_ROOT_DISPLAYED 190 - #define PROPERTY_ID_SHOWS_HANDLES 191 - #define PROPERTY_ID_SHOWS_ROOT_HANDLES 192 - #define PROPERTY_ID_EDITABLE 193 - #define PROPERTY_ID_INVOKES_STOP_NOT_EDITING 194 - #define PROPERTY_ID_NOLABEL 195 - #define PROPERTY_ID_SCALE_MODE 196 - #define PROPERTY_ID_INPUT_REQUIRED 197 - #define PROPERTY_ID_WRITING_MODE 198 - #define PROPERTY_ID_ENABLE_VISIBLE 199 - #define PROPERTY_ID_WHEEL_BEHAVIOR 200 - #define PROPERTY_ID_TEXT_ANCHOR_TYPE 201 - #define PROPERTY_ID_SHEET_ANCHOR_TYPE 202 - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_FORMMETADATA_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src deleted file mode 100644 index c486643f2..000000000 --- a/extensions/source/propctrlr/formres.src +++ /dev/null @@ -1,1527 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "formresid.hrc" -#endif -#ifndef _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ -#include "formlocalid.hrc" -#endif - -String RID_STR_EDITMASK -{ - Text [ en-US ] = "Edit mask" ; -}; -String RID_STR_LITERALMASK -{ - Text [ en-US ] = "Literal mask" ; -}; -String RID_STR_READONLY -{ - Text [ en-US ] = "Read-only" ; -}; -String RID_STR_ENABLED -{ - Text [ en-US ] = "Enabled" ; -}; -String RID_STR_ENABLE_VISIBLE -{ - Text [ en-US ] = "Visible" ; -}; -String RID_STR_AUTOCOMPLETE -{ - Text [ en-US ] = "AutoFill" ; -}; -String RID_STR_LINECOUNT -{ - Text [ en-US ] = "Line count" ; -}; -String RID_STR_MAXTEXTLEN -{ - Text [ en-US ] = "Max. text length" ; -}; -String RID_STR_SPIN -{ - Text [ en-US ] = "Spin Button" ; -}; -String RID_STR_STRICTFORMAT -{ - Text [ en-US ] = "Strict format" ; -}; -String RID_STR_SHOWTHOUSANDSEP -{ - Text [ en-US ] = "Thousands separator" ; -}; -String RID_STR_PRINTABLE -{ - Text [ en-US ] = "Printable" ; -}; -String RID_STR_TARGET_URL -{ - Text [ en-US ] = "URL" ; -}; -String RID_STR_TARGET_FRAME -{ - Text [ en-US ] = "Frame" ; -}; -String RID_STR_HELPTEXT -{ - Text [ en-US ] = "Help text" ; -}; -String RID_STR_HELPURL -{ - Text [ en-US ] = "Help URL"; -}; -String RID_STR_TAG -{ - Text [ en-US ] = "Additional information" ; -}; -String RID_STR_ECHO_CHAR -{ - Text [ en-US ] = "Password character" ; -}; - -String RID_STR_TRISTATE -{ - Text [ en-US ] = "Tristate" ; -}; -String RID_STR_EMPTY_IS_NULL -{ - Text [ en-US ] = "Empty string is NULL" ; -}; -String RID_STR_DECIMAL_ACCURACY -{ - Text [ en-US ] = "Decimal accuracy" ; -}; -String RID_STR_IMAGE_URL -{ - Text [ en-US ] = "Graphics" ; -}; -String RID_STR_DEFAULT_SELECT_SEQ -{ - Text [ en-US ] = "Default selection" ; -}; -String RID_STR_DEFAULT_BUTTON -{ - Text [ en-US ] = "Default button" ; -}; -String RID_STR_LABELCONTROL -{ - Text [ en-US ] = "Label Field"; -}; -String RID_STR_LABEL -{ - Text [ en-US ] = "Label" ; -}; -String RID_STR_ALIGN -{ - Text [ en-US ] = "Alignment" ; -}; -String RID_STR_VERTICAL_ALIGN -{ - Text [ en-US ] = "Vert. Alignment" ; -}; -Resource RID_RSC_ENUM_VERTICAL_ALIGN -{ - String 1 - { - Text [ en-US ] = "Top"; - }; - String 2 - { - Text [ en-US ] = "Middle"; - }; - String 3 - { - Text [ en-US ] = "Bottom"; - }; -}; -String RID_STR_IMAGEPOSITION -{ - Text [ en-US ] = "Graphics alignment"; -}; -String RID_STR_FONT -{ - Text [ en-US ] = "Font" ; -}; -String RID_STR_BACKGROUNDCOLOR -{ - Text [ en-US ] = "Background color" ; -}; -String RID_STR_BORDER -{ - Text [ en-US ] = "Border" ; -}; -String RID_STR_ICONSIZE -{ - Text [ en-US ] = "Icon size" ; -}; -Resource RID_RSC_ENUM_ICONSIZE_TYPE -{ - String 1 - { - Text [ en-US ] = "Small" ; - }; - String 2 - { - Text [ en-US ] = "Large" ; - }; -}; -String RID_STR_SHOW_POSITION -{ - Text [ en-US ] = "Positioning"; -}; -String RID_STR_SHOW_NAVIGATION -{ - Text [ en-US ] = "Navigation"; -}; -String RID_STR_SHOW_RECORDACTIONS -{ - Text [ en-US ] = "Acting on a record"; -}; -String RID_STR_SHOW_FILTERSORT -{ - Text [ en-US ] = "Filtering / Sorting"; -}; -String RID_STR_HSCROLL -{ - Text [ en-US ] = "Horizontal scroll bar" ; -}; -String RID_STR_VSCROLL -{ - Text [ en-US ] = "Vertical scroll bar" ; -}; -String RID_STR_WORDBREAK -{ - Text [ en-US ] = "Word break"; -}; -String RID_STR_MULTILINE -{ - Text [ en-US ] = "Multiline input" ; -}; -String RID_STR_MULTISELECTION -{ - Text [ en-US ] = "Multiselection" ; -}; -String RID_STR_NAME -{ - Text [ en-US ] = "Name" ; -}; -String RID_STR_GROUP_NAME -{ - Text [ en-US ] = "Group name" ; -}; -String RID_STR_TABINDEX -{ - Text [ en-US ] = "Tab order" ; -}; -String RID_STR_WHEEL_BEHAVIOR -{ - Text [ en-US ] = "Mouse wheel scroll" ; -}; -String RID_STR_FILTER -{ - Text [ en-US ] = "Filter" ; -}; -String RID_STR_SORT_CRITERIA -{ - Text [ en-US ] = "Sort" ; -}; -String RID_STR_RECORDMARKER -{ - Text [ en-US ] = "Record marker"; -}; -String RID_STR_FILTERPROPOSAL -{ - Text [ en-US ] = "Filter proposal"; -}; -String RID_STR_NAVIGATION -{ - Text [ en-US ] = "Navigation bar" ; -}; -String RID_STR_CYCLE -{ - Text [ en-US ] = "Cycle" ; -}; -String RID_STR_TABSTOP -{ - Text [ en-US ] = "Tabstop" ; -}; -String RID_STR_CONTROLSOURCE -{ - Text [ en-US ] = "Data field" ; -}; -String RID_STR_DROPDOWN -{ - Text [ en-US ] = "Dropdown" ; -}; -String RID_STR_BOUNDCOLUMN -{ - Text [ en-US ] = "Bound field" ; -}; -String RID_STR_LISTSOURCE -{ - Text [ en-US ] = "List content" ; -}; -String RID_STR_LISTSOURCETYPE -{ - Text [ en-US ] = "Type of list contents" ; -}; -String RID_STR_CURSORSOURCE -{ - Text [ en-US ] = "Content" ; -}; -String RID_STR_CURSORSOURCETYPE -{ - Text [ en-US ] = "Content type"; -}; -String RID_STR_ALLOW_ADDITIONS -{ - Text [ en-US ] = "Allow additions" ; -}; -String RID_STR_ALLOW_DELETIONS -{ - Text [ en-US ] = "Allow deletions" ; -}; -String RID_STR_ALLOW_EDITS -{ - Text [ en-US ] = "Allow modifications" ; -}; -String RID_STR_DATAENTRY -{ - Text [ en-US ] = "Add data only" ; -}; -String RID_STR_DATASOURCE -{ - Text [ en-US ] = "Data source"; -}; -String RID_STR_MASTERFIELDS -{ - Text [ en-US ] = "Link master fields" ; -}; -String RID_STR_SLAVEFIELDS -{ - Text [ en-US ] = "Link slave fields" ; -}; -String RID_STR_VALUEMIN -{ - Text [ en-US ] = "Value min." ; -}; -String RID_STR_VALUEMAX -{ - Text [ en-US ] = "Value max." ; -}; -String RID_STR_VALUESTEP -{ - Text [ en-US ] = "Incr./decrement value" ; -}; -String RID_STR_CURRENCYSYMBOL -{ - Text [ en-US ] = "Currency symbol" ; -}; -String RID_STR_DATEMIN -{ - Text [ en-US ] = "Date min." ; -}; -String RID_STR_DATEMAX -{ - Text [ en-US ] = "Date max." ; -}; -String RID_STR_DATEFORMAT -{ - Text [ en-US ] = "Date format" ; -}; -String RID_STR_SELECTEDITEMS -{ - Text [ en-US ] = "Selection" ; -}; -String RID_STR_TIMEMIN -{ - Text [ en-US ] = "Time min." ; -}; -String RID_STR_TIMEMAX -{ - Text [ en-US ] = "Time max." ; -}; -String RID_STR_TIMEFORMAT -{ - Text [ en-US ] = "Time format" ; -}; -String RID_STR_CURRSYM_POSITION -{ - Text [ en-US ] = "Prefix symbol"; -}; -String RID_STR_VALUE -{ - Text [ en-US ] = "Value" ; -}; -String RID_STR_FORMATKEY -{ - Text [ en-US ] = "Formatting" ; -}; -String RID_STR_CLASSID -{ - Text [ en-US ] = "Class ID" ; -}; -String RID_STR_HEIGHT -{ - Text [ en-US ] = "Height" ; -}; -String RID_STR_WIDTH -{ - Text [ en-US ] = "Width" ; -}; -String RID_STR_LISTINDEX -{ - Text [ en-US ] = "List index" ; -}; -String RID_STR_ROWHEIGHT -{ - Text [ en-US ] = "Row height" ; -}; -String RID_STR_FILLCOLOR -{ - Text [ en-US ] = "Fill color" ; -}; -String RID_STR_LINECOLOR -{ - Text [ en-US ] = "Line color" ; -}; -String RID_STR_REFVALUE -{ - Text [ en-US ] = "Reference value (on)" ; -}; -String RID_STR_UNCHECKEDREFVALUE -{ - Text [ en-US ] = "Reference value (off)"; -}; -String RID_STR_STRINGITEMLIST -{ - Text [ en-US ] = "List entries" ; -}; -String RID_STR_BUTTONTYPE -{ - Text [ en-US ] = "Action"; -}; -String RID_STR_SUBMIT_ACTION -{ - Text [ en-US ] = "URL" ; -}; -String RID_STR_SUBMIT_METHOD -{ - Text [ en-US ] = "Type of submission" ; -}; -String RID_STR_DEFAULT_STATE -{ - Text [ en-US ] = "Default status" ; -}; -String RID_STR_SUBMIT_ENCODING -{ - Text [ en-US ] = "Submission encoding" ; -}; -String RID_STR_DEFAULTVALUE -{ - Text [ en-US ] = "Default value" ; -}; -String RID_STR_DEFAULTTEXT -{ - Text [ en-US ] = "Default text"; -}; -String RID_STR_DEFAULTDATE -{ - Text [ en-US ] = "Default date"; -}; -String RID_STR_DEFAULTTIME -{ - Text [ en-US ] = "Default time"; -}; -String RID_STR_SUBMIT_TARGET -{ - Text [ en-US ] = "Frame" ; -}; - -Resource RID_RSC_ENUM_BORDER_TYPE -{ - String 1 - { - Text [ en-US ] = "Without frame" ; - }; - String 2 - { - Text [ en-US ] = "3D look" ; - }; - String 3 - { - Text [ en-US ] = "Flat" ; - }; -}; - -Resource RID_RSC_ENUM_LISTSOURCE_TYPE -{ - String 1 - { - Text [ en-US ] = "Valuelist"; - }; - String 2 - { - Text [ en-US ] = "Table"; - }; - String 3 - { - Text [ en-US ] = "Query"; - }; - String 4 - { - Text [ en-US ] = "Sql"; - }; - String 5 - { - Text [ en-US ] = "Sql [Native]"; - }; - String 6 - { - Text [ en-US ] = "Tablefields" ; - }; -}; -Resource RID_RSC_ENUM_ALIGNMENT -{ - String 1 - { - Text [ en-US ] = "Left"; - }; - String 2 - { - Text [ en-US ] = "Center"; - }; - String 3 - { - Text [ en-US ] = "Right" ; - }; -}; -Resource RID_RSC_ENUM_BUTTONTYPE -{ - String 1 - { - Text [ en-US ] = "None"; - }; - String 2 - { - Text [ en-US ] = "Submit form"; - }; - String 3 - { - Text [ en-US ] = "Reset form"; - }; - String 4 - { - Text [ en-US ] = "Open document/web page"; - }; - String 5 - { - Text [ en-US ] = "First record"; - }; - String 6 - { - Text [ en-US ] = "Previous record"; - }; - String 7 - { - Text [ en-US ] = "Next record"; - }; - String 8 - { - Text [ en-US ] = "Last record"; - }; - String 9 - { - Text [ en-US ] = "Save record"; - }; - String 10 - { - Text [ en-US ] = "Undo data entry"; - }; - String 11 - { - Text [ en-US ] = "New record"; - }; - String 12 - { - Text [ en-US ] = "Delete record"; - }; - String 13 - { - Text [ en-US ] = "Refresh form"; - }; -}; -Resource RID_RSC_ENUM_SUBMIT_METHOD -{ - String 1 - { - Text [ en-US ] = "Get"; - }; - String 2 - { - Text [ en-US ] = "Post" ; - }; -}; -Resource RID_RSC_ENUM_SUBMIT_ENCODING -{ - String 1 - { - Text [ en-US ] = "URL"; - }; - String 2 - { - Text [ en-US ] = "Multipart"; - }; - String 3 - { - Text [ en-US ] = "Text" ; - }; -}; -Resource RID_RSC_ENUM_DATEFORMAT_LIST -{ - String 1 - { - Text [ en-US ] = "Standard (short)"; - }; - String 2 - { - Text [ en-US ] = "Standard (short YY)"; - }; - String 3 - { - Text [ en-US ] = "Standard (short YYYY)"; - }; - String 4 - { - Text [ en-US ] = "Standard (long)"; - }; - String 5 - { - Text [ en-US ] = "DD/MM/YY"; - }; - String 6 - { - Text [ en-US ] = "MM/DD/YY"; - }; - String 7 - { - Text [ en-US ] = "YY/MM/DD"; - }; - String 8 - { - Text [ en-US ] = "DD/MM/YYYY"; - }; - String 9 - { - Text [ en-US ] = "MM/DD/YYYY"; - }; - String 10 - { - Text [ en-US ] = "YYYY/MM/DD"; - }; - String 11 - { - Text [ en-US ] = "YY-MM-DD"; - }; - String 12 - { - Text [ en-US ] = "YYYY-MM-DD" ; - }; -}; -Resource RID_RSC_ENUM_TIMEFORMAT_LIST -{ - String 1 - { - Text [ en-US ] = "13:45"; - }; - String 2 - { - Text [ en-US ] = "13:45:00"; - }; - String 3 - { - Text [ en-US ] = "01:45 PM"; - }; - String 4 - { - Text [ en-US ] = "01:45:00 PM" ; - }; -}; -Resource RID_RSC_ENUM_CHECKED -{ - String 1 - { - Text [ en-US ] = "Not Selected"; - }; - String 2 - { - Text [ en-US ] = "Selected"; - }; - String 3 - { - Text [ en-US ] = "Not Defined" ; - }; -}; -Resource RID_RSC_ENUM_CYCLE -{ - String 1 - { - Text [ en-US ] = "All records"; - }; - String 2 - { - Text [ en-US ] = "Active record"; - }; - String 3 - { - Text [ en-US ] = "Current page" ; - }; -}; -Resource RID_RSC_ENUM_NAVIGATION -{ - String 1 - { - Text [ en-US ] = "No"; - }; - String 2 - { - Text [ en-US ] = "Yes"; - }; - String 3 - { - Text [ en-US ] = "Parent Form"; - }; -}; -Resource RID_RSC_ENUM_SUBMIT_TARGET -{ - String 1 { Text = "_blank"; }; - String 2 { Text = "_parent"; }; - String 3 { Text = "_self"; }; - String 4 { Text = "_top"; }; -}; - -Resource RID_RSC_ENUM_SELECTION_TYPE -{ - String 1 - { - Text [ en-US ] = "None" ; - }; - String 2 - { - Text [ en-US ] = "Single" ; - }; - String 3 - { - Text [ en-US ] = "Multi" ; - }; - String 4 - { - Text [ en-US ] = "Range" ; - }; - -}; - -String RID_STR_EVT_APPROVEPARAMETER -{ - Text [ en-US ] = "Fill parameters" ; -}; -String RID_STR_EVT_ACTIONPERFORMED -{ - Text [ en-US ] = "Execute action" ; -}; -String RID_STR_EVT_AFTERUPDATE -{ - Text [ en-US ] = "After updating" ; -}; -String RID_STR_EVT_BEFOREUPDATE -{ - Text [ en-US ] = "Before updating" ; -}; -String RID_STR_EVT_APPROVEROWCHANGE -{ - Text [ en-US ] = "Before record action" ; -}; -String RID_STR_EVT_ROWCHANGE -{ - Text [ en-US ] = "After record action" ; -}; -String RID_STR_EVT_CONFIRMDELETE -{ - Text [ en-US ] = "Confirm deletion" ; -}; -String RID_STR_EVT_ERROROCCURRED -{ - Text [ en-US ] = "Error occurred" ; -}; -String RID_STR_EVT_FOCUSGAINED -{ - Text [ en-US ] = "When receiving focus" ; -}; -String RID_STR_EVT_FOCUSLOST -{ - Text [ en-US ] = "When losing focus" ; -}; -String RID_STR_EVT_ITEMSTATECHANGED -{ - Text [ en-US ] = "Item status changed" ; -}; -String RID_STR_EVT_KEYTYPED -{ - Text [ en-US ] = "Key pressed" ; -}; -String RID_STR_EVT_KEYUP -{ - Text [ en-US ] = "Key released" ; -}; -String RID_STR_EVT_LOADED -{ - Text [ en-US ] = "When loading" ; -}; -String RID_STR_EVT_RELOADING -{ - Text [ en-US ] = "Before reloading" ; -}; -String RID_STR_EVT_RELOADED -{ - Text [ en-US ] = "When reloading" ; -}; -String RID_STR_EVT_MOUSEDRAGGED -{ - Text [ en-US ] = "Mouse moved while key pressed" ; -}; -String RID_STR_EVT_MOUSEENTERED -{ - Text [ en-US ] = "Mouse inside" ; -}; -String RID_STR_EVT_MOUSEEXITED -{ - Text [ en-US ] = "Mouse outside" ; -}; -String RID_STR_EVT_MOUSEMOVED -{ - Text [ en-US ] = "Mouse moved" ; -}; -String RID_STR_EVT_MOUSEPRESSED -{ - Text [ en-US ] = "Mouse button pressed" ; -}; -String RID_STR_EVT_MOUSERELEASED -{ - Text [ en-US ] = "Mouse button released" ; -}; -String RID_STR_EVT_POSITIONING -{ - Text [ en-US ] = "Before record change" ; -}; -String RID_STR_EVT_POSITIONED -{ - Text [ en-US ] = "After record change" ; -}; -String RID_STR_EVT_RESETTED -{ - Text [ en-US ] = "After resetting" ; -}; -String RID_STR_EVT_APPROVERESETTED -{ - Text [ en-US ] = "Prior to reset" ; -}; -String RID_STR_EVT_APPROVEACTIONPERFORMED -{ - Text [ en-US ] = "Approve action" ; -}; -String RID_STR_EVT_SUBMITTED -{ - Text [ en-US ] = "Before submitting" ; -}; -String RID_STR_EVT_TEXTCHANGED -{ - Text [ en-US ] = "Text modified" ; -}; -String RID_STR_EVT_UNLOADING -{ - Text [ en-US ] = "Before unloading" ; -}; -String RID_STR_EVT_UNLOADED -{ - Text [ en-US ] = "When unloading" ; -}; -String RID_STR_EVT_CHANGED -{ - Text [ en-US ] = "Changed" ; -}; -String RID_STR_EVENTS -{ - Text [ en-US ] = "Events" ; -}; -String RID_STR_ESCAPE_PROCESSING -{ - Text [ en-US ] = "Analyze SQL command"; -}; -String RID_STR_POSITIONX -{ - Text [ en-US ] = "PositionX"; -}; -String RID_STR_POSITIONY -{ - Text [ en-US ] = "PositionY"; -}; -String RID_STR_TITLE -{ - Text [ en-US ] = "Title"; -}; -String RID_STR_STEP -{ - Text [ en-US ] = "Page (step)"; -}; -String RID_STR_PROGRESSVALUE -{ - Text [ en-US ] = "Progress value"; -}; -String RID_STR_PROGRESSVALUE_MIN -{ - Text [ en-US ] = "Progress value min."; -}; -String RID_STR_PROGRESSVALUE_MAX -{ - Text [ en-US ] = "Progress value max."; -}; -String RID_STR_SCROLLVALUE -{ - Text [ en-US ] = "Scroll value"; -}; -String RID_STR_SCROLLVALUE_MAX -{ - Text [ en-US ] = "Scroll value max."; -}; -String RID_STR_SCROLLVALUE_MIN -{ - Text [ en-US ] = "Scroll value min."; -}; -String RID_STR_DEFAULT_SCROLLVALUE -{ - Text [ en-US ] = "Default scroll value"; -}; -String RID_STR_LINEINCREMENT -{ - Text [ en-US ] = "Small change"; -}; -String RID_STR_BLOCKINCREMENT -{ - Text [ en-US ] = "Large change"; -}; -String RID_STR_REPEAT_DELAY -{ - Text [ en-US ] = "Delay"; -}; -String RID_STR_REPEAT -{ - Text [ en-US ] = "Repeat"; -}; -String RID_STR_VISIBLESIZE -{ - Text [ en-US ] = "Visible size"; -}; -String RID_STR_ORIENTATION -{ - Text [ en-US ] = "Orientation"; -}; -Resource RID_RSC_ENUM_ORIENTATION -{ - String 1 - { - Text [ en-US ] = "Horizontal"; - }; - String 2 - { - Text [ en-US ] = "Vertical"; - }; -}; -String RID_STR_EVT_ADJUSTMENTVALUECHANGED -{ - Text [ en-US ] = "While adjusting"; -}; -String RID_STR_DATE -{ - Text [ en-US ] = "Date"; -}; -String RID_STR_STATE -{ - Text [ en-US ] = "State"; -}; -String RID_STR_TIME -{ - Text [ en-US ] = "Time"; -}; -String RID_STR_SCALEIMAGE -{ - Text [ en-US ] = "Scale"; -}; -String RID_STR_PUSHBUTTONTYPE -{ - Text [ en-US ] = "Button type"; -}; -Resource RID_RSC_ENUM_PUSHBUTTONTYPE -{ - String 1 - { - Text [ en-US ] = "Default"; - }; - String 2 - { - Text [ en-US ] = "OK"; - }; - String 3 - { - Text [ en-US ] = "Cancel"; - }; - String 4 - { - Text [ en-US ] = "Help"; - }; -}; -String RID_STR_UNABLETOCONNECT -{ - Text [ en-US ] = "The connection to the data source \"$name$\" could not be established."; -}; -String RID_STR_TEXT -{ - Text [ en-US ] = "Text"; -}; - -String RID_STR_BOUND_CELL -{ - Text [ en-US ] = "Linked cell"; -}; - -String RID_STR_LIST_CELL_RANGE -{ - Text [ en-US ] = "Source cell range"; -}; - -String RID_STR_CELL_EXCHANGE_TYPE -{ - Text [ en-US ] = "Contents of the linked cell"; -}; - -Resource RID_RSC_ENUM_CELL_EXCHANGE_TYPE -{ - String 1 - { - Text [ en-US ] = "The selected entry"; - }; - String 2 - { - Text [ en-US ] = "Position of the selected entry"; - }; -}; - -String RID_STR_SHOW_SCROLLBARS -{ - Text [ en-US ] = "Scrollbars"; -}; - -Resource RID_RSC_ENUM_TEXTTYPE -{ - String 1 - { - Text [ en-US ] = "Single-line"; - }; - String 2 - { - Text [ en-US ] = "Multi-line"; - }; - String 3 - { - Text [ en-US ] = "Multi-line with formatting"; - }; -}; - -String RID_STR_SYMBOLCOLOR -{ - Text [ en-US ] = "Symbol color" ; -}; - -String RID_STR_LINEEND_FORMAT -{ - Text [ en-US ] = "Text lines end with"; -}; - -Resource RID_RSC_ENUM_LINEEND_FORMAT -{ - String 1 - { - Text [ en-US ] = "LF (Unix)"; - }; - String 2 - { - Text [ en-US ] = "CR+LF (Windows)"; - }; -}; - -Resource RID_RSC_ENUM_SCROLLBARS -{ - String 1 - { - Text [ en-US ] = "None"; - }; - String 2 - { - Text [ en-US ] = "Horizontal"; - }; - String 3 - { - Text [ en-US ] = "Vertical"; - }; - String 4 - { - Text [ en-US ] = "Both"; - }; -}; - -Resource RID_RSC_ENUM_COMMAND_TYPE -{ - String 1 - { - Text [ en-US ] = "Table"; - }; - String 2 - { - Text [ en-US ] = "Query"; - }; - String 3 - { - Text [ en-US ] = "SQL command"; - }; -}; -String RID_STR_TOGGLE -{ - Text [ en-US ] = "Toggle"; -}; - -String RID_STR_FOCUSONCLICK -{ - Text [ en-US ] = "Take Focus on Click"; -}; - -String RID_STR_HIDEINACTIVESELECTION -{ - Text [ en-US ] = "Hide selection"; -}; - -String RID_STR_VISUALEFFECT -{ - Text [ en-US ] = "Style"; -}; - -Resource RID_RSC_ENUM_VISUALEFFECT -{ - String 1 - { - Text [ en-US ] = "3D"; - }; - String 2 - { - Text [ en-US ] = "Flat"; - }; -}; - -String RID_STR_BORDERCOLOR -{ - Text [ en-US ] = "Border color"; -}; - -Resource RID_RSC_ENUM_IMAGE_POSITION -{ - String 1 - { - Text [ en-US ] = "Left top"; - }; - String 2 - { - Text [ en-US ] = "Left centered"; - }; - String 3 - { - Text [ en-US ] = "Left bottom"; - }; - String 4 - { - Text [ en-US ] = "Right top"; - }; - String 5 - { - Text [ en-US ] = "Right centered"; - }; - String 6 - { - Text [ en-US ] = "Right bottom"; - }; - String 7 - { - Text [ en-US ] = "Above left"; - }; - String 8 - { - Text [ en-US ] = "Above centered"; - }; - String 9 - { - Text [ en-US ] = "Above right"; - }; - String 10 - { - Text [ en-US ] = "Below left"; - }; - String 11 - { - Text [ en-US ] = "Below centered"; - }; - String 12 - { - Text [ en-US ] = "Below right"; - }; - String 13 - { - Text [ en-US ] = "Centered"; - }; -}; - -String RID_STR_AUTOLINEBREAK -{ - Text [ en-US ] = "Wrap text automatically"; -}; - -String RID_STR_TEXTTYPE -{ - Text [ en-US ] = "Text type"; -}; - -Resource RID_RSC_ENUM_SHOWHIDE -{ - String 1 - { - Text [ en-US ] = "Hide" ; - }; - String 2 - { - Text [ en-US ] = "Show" ; - }; -}; -String RID_STR_XML_DATA_MODEL -{ - Text [ en-US ] = "XML data model"; -}; - -String RID_STR_BIND_EXPRESSION -{ - Text [ en-US ] = "Binding expression"; -}; - -String RID_STR_XSD_REQUIRED -{ - Text [ en-US ] = "Required"; -}; - -String RID_STR_LIST_BINDING -{ - Text [ en-US ] = "List entry source"; -}; - -String RID_STR_XSD_RELEVANT -{ - Text [ en-US ] = "Relevant"; -}; - -String RID_STR_XSD_READONLY -{ - Text [ en-US ] = "Read-only"; -}; - -String RID_STR_XSD_CONSTRAINT -{ - Text [ en-US ] = "Constraint"; -}; - -String RID_STR_XSD_CALCULATION -{ - Text [ en-US ] = "Calculation"; -}; - -String RID_STR_XSD_DATA_TYPE -{ - Text [ en-US ] = "Data type"; -}; - -String RID_STR_XSD_WHITESPACES -{ - Text [ en-US ] = "Whitespaces"; -}; - -Resource RID_RSC_ENUM_WHITESPACE_HANDLING -{ - String 1 - { - Text [ en-US ] = "Preserve"; - }; - String 2 - { - Text [ en-US ] = "Replace"; - }; - String 3 - { - Text [ en-US ] = "Collapse"; - }; -}; - -String RID_STR_XSD_PATTERN -{ - Text [ en-US ] = "Pattern"; -}; - -String RID_STR_XSD_LENGTH -{ - Text [ en-US ] = "Length"; -}; - -String RID_STR_XSD_MIN_LENGTH -{ - Text [ en-US ] = "Length (at least)"; -}; - -String RID_STR_XSD_MAX_LENGTH -{ - Text [ en-US ] = "Length (at most)"; -}; - -String RID_STR_XSD_TOTAL_DIGITS -{ - Text [ en-US ] = "Digits (total)"; -}; - -String RID_STR_XSD_FRACTION_DIGITS -{ - Text [ en-US ] = "Digits (fraction)"; -}; - -String RID_STR_XSD_MAX_INCLUSIVE -{ - Text [ en-US ] = "Max. (inclusive)"; -}; - -String RID_STR_XSD_MAX_EXCLUSIVE -{ - Text [ en-US ] = "Max. (exclusive)"; -}; - -String RID_STR_XSD_MIN_INCLUSIVE -{ - Text [ en-US ] = "Min. (inclusive)"; -}; - -String RID_STR_XSD_MIN_EXCLUSIVE -{ - Text [ en-US ] = "Min. (exclusive)"; -}; - -String RID_STR_SUBMISSION_ID -{ - Text [ en-US ] = "Submission"; -}; - -String RID_STR_BINDING_UI_NAME -{ - Text [ en-US ] = "Binding" ; -}; - -String RID_STR_SELECTION_TYPE -{ - Text [ en-US ] = "Selection type" ; -}; - -String RID_STR_ROOT_DISPLAYED -{ - Text [ en-US ] = "Root displayed" ; -}; - -String RID_STR_SHOWS_HANDLES -{ - Text [ en-US ] = "Show handles" ; -}; - -String RID_STR_SHOWS_ROOT_HANDLES -{ - Text [ en-US ] = "Show root handles" ; -}; - -String RID_STR_EDITABLE -{ - Text [ en-US ] = "Editable" ; -}; - -String RID_STR_INVOKES_STOP_NOT_EDITING -{ - Text [ en-US ] = "Invokes stop node editing" ; -}; - -String RID_STR_DECORATION -{ - Text [ en-US ] = "With title bar" ; -}; - -String RID_STR_NOLABEL -{ - Text [ en-US ] = "No Label" ; -}; - -Resource RID_RSC_ENUM_SCALE_MODE -{ - String 1 - { - Text [ en-US ] = "No"; - }; - String 2 - { - Text [ en-US ] = "Keep Ratio"; - }; - String 3 - { - Text [ en-US ] = "Fit to Size"; - }; -}; -String RID_STR_INPUT_REQUIRED -{ - Text [ en-US ] = "Input required"; -}; - -String RID_STR_WRITING_MODE -{ - Text [ en-US ] = "Text direction"; -}; - -Resource RID_RSC_ENUM_WRITING_MODE -{ - String 1 - { - Text [ en-US ] = "Left-to-right"; - }; - String 2 - { - Text [ en-US ] = "Right-to-left"; - }; - String 3 - { - Text [ en-US ] = "Use superordinate object settings"; - }; -}; - -Resource RID_RSC_ENUM_WHEEL_BEHAVIOR -{ - String 1 - { - Text [ en-US ] = "Never"; - }; - String 2 - { - Text [ en-US ] = "When focused"; - }; - String 3 - { - Text [ en-US ] = "Always"; - }; -}; - -String RID_STR_ANCHOR_TYPE -{ - Text [ en-US ] = "Anchor"; -}; - -Resource RID_RSC_ENUM_TEXT_ANCHOR_TYPE -{ - String 1 - { - Text [ en-US ] = "To Paragraph"; - }; - String 2 - { - Text [ en-US ] = "As Character"; - }; - String 3 - { - Text [ en-US ] = "To Page"; - }; - String 4 - { - Text [ en-US ] = "To Frame"; - }; - String 5 - { - Text [ en-US ] = "To Character"; - }; -}; - -Resource RID_RSC_ENUM_SHEET_ANCHOR_TYPE -{ - String 1 - { - Text [ en-US ] = "To Page"; - }; - String 2 - { - Text [ en-US ] = "To Cell"; - }; -}; - -String RID_STR_FONTSTYLE_REGULAR -{ - Text [ en-US ] = "Regular"; - Text [ x-comment ] = "That's the 'Regular' as used for a font style (as opposed to 'italic' and 'bold'), so please use a consistent translation."; -}; - -String RID_STR_FONTSTYLE_BOLD_ITALIC -{ - Text [ en-US ] = "Bold Italic"; - Text [ x-comment ] = "That's the 'Bold Italic' as used for a font style, so please use a consistent translation."; -}; - -String RID_STR_FONTSTYLE_ITALIC -{ - Text [ en-US ] = "Italic"; - Text [ x-comment ] = "That's the 'Italic' as used for a font style, so please use a consistent translation."; -}; - -String RID_STR_FONTSTYLE_BOLD -{ - Text [ en-US ] = "Bold"; - Text [ x-comment ] = "That's the 'Bold' as used for a font style, so please use a consistent translation."; -}; - -String RID_STR_FONT_DEFAULT -{ - Text [ en-US ] = "(Default)"; -}; diff --git a/extensions/source/propctrlr/formresid.hrc b/extensions/source/propctrlr/formresid.hrc deleted file mode 100644 index b8ba28c12..000000000 --- a/extensions/source/propctrlr/formresid.hrc +++ /dev/null @@ -1,388 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ -#define _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "propresid.hrc" -#endif - -// ----------------------------------------------------------------------- -// - Strings - -#define RID_STR_FORMS ( RID_FORMBROWSER_START + 1 ) -#define RID_STR_PROPTITLE_DBGRID ( RID_FORMBROWSER_START + 2 ) -#define RID_STR_PROPTITLE_PATTERNFIELD ( RID_FORMBROWSER_START + 3 ) -#define RID_STR_PROPTITLE_CURRENCYFIELD ( RID_FORMBROWSER_START + 4 ) -#define RID_STR_PROPTITLE_NUMERICFIELD ( RID_FORMBROWSER_START + 5 ) -#define RID_STR_PROPTITLE_TIMEFIELD ( RID_FORMBROWSER_START + 6 ) -#define RID_STR_PROPTITLE_DATEFIELD ( RID_FORMBROWSER_START + 7 ) -#define RID_STR_PROPTITLE_FILECONTROL ( RID_FORMBROWSER_START + 8 ) -#define RID_STR_PROPTITLE_IMAGECONTROL ( RID_FORMBROWSER_START + 9 ) -#define RID_STR_PROPTITLE_IMAGEBUTTON ( RID_FORMBROWSER_START + 10 ) -#define RID_STR_PROPTITLE_COMBOBOX ( RID_FORMBROWSER_START + 11 ) -#define RID_STR_PROPTITLE_LISTBOX ( RID_FORMBROWSER_START + 12 ) -#define RID_STR_PROPTITLE_FORMATTED ( RID_FORMBROWSER_START + 13 ) -#define RID_STR_PROPTITLE_EDIT ( RID_FORMBROWSER_START + 14 ) -#define RID_STR_PROPTITLE_GROUPBOX ( RID_FORMBROWSER_START + 15 ) -#define RID_STR_PROPTITLE_FIXEDTEXT ( RID_FORMBROWSER_START + 16 ) -#define RID_STR_PROPTITLE_CHECKBOX ( RID_FORMBROWSER_START + 17 ) -#define RID_STR_PROPTITLE_RADIOBUTTON ( RID_FORMBROWSER_START + 18 ) -#define RID_STR_PROPTITLE_PUSHBUTTON ( RID_FORMBROWSER_START + 19 ) -#define RID_STR_PROPTITLE_HIDDENCONTROL ( RID_FORMBROWSER_START + 30 ) -#define RID_STR_PROPTITLE_UNKNOWNCONTROL ( RID_FORMBROWSER_START + 31 ) - -#define RID_STR_NAME ( RID_FORMBROWSER_START + 32 ) -#define RID_STR_LABEL ( RID_FORMBROWSER_START + 33 ) -#define RID_STR_LABELCONTROL ( RID_FORMBROWSER_START + 34 ) -#define RID_STR_MAXTEXTLEN ( RID_FORMBROWSER_START + 35 ) -#define RID_STR_EDITMASK ( RID_FORMBROWSER_START + 36 ) -#define RID_STR_LITERALMASK ( RID_FORMBROWSER_START + 37 ) -#define RID_STR_STRICTFORMAT ( RID_FORMBROWSER_START + 38 ) -#define RID_STR_ENABLED ( RID_FORMBROWSER_START + 39 ) -#define RID_STR_READONLY ( RID_FORMBROWSER_START + 40 ) -#define RID_STR_PRINTABLE ( RID_FORMBROWSER_START + 41 ) -#define RID_STR_CONTROLSOURCE ( RID_FORMBROWSER_START + 42 ) -#define RID_STR_TABSTOP ( RID_FORMBROWSER_START + 43 ) -#define RID_STR_TABINDEX ( RID_FORMBROWSER_START + 44 ) -#define RID_STR_DATASOURCE ( RID_FORMBROWSER_START + 45 ) -#define RID_STR_CURSORSOURCE ( RID_FORMBROWSER_START + 46 ) -#define RID_STR_CURSORSOURCETYPE ( RID_FORMBROWSER_START + 47 ) -#define RID_STR_FILTER ( RID_FORMBROWSER_START + 48 ) -#define RID_STR_SORT_CRITERIA ( RID_FORMBROWSER_START + 49 ) -#define RID_STR_ALLOW_ADDITIONS ( RID_FORMBROWSER_START + 50 ) -#define RID_STR_ALLOW_EDITS ( RID_FORMBROWSER_START + 51 ) -#define RID_STR_ALLOW_DELETIONS ( RID_FORMBROWSER_START + 52 ) -#define RID_STR_DATAENTRY ( RID_FORMBROWSER_START + 53 ) -#define RID_STR_CYCLE ( RID_FORMBROWSER_START + 54 ) -#define RID_STR_VALUE ( RID_FORMBROWSER_START + 55 ) -#define RID_STR_VALUESTEP ( RID_FORMBROWSER_START + 56 ) -#define RID_STR_DECIMAL_ACCURACY ( RID_FORMBROWSER_START + 57 ) -#define RID_STR_SHOWTHOUSANDSEP ( RID_FORMBROWSER_START + 58 ) -#define RID_STR_REFVALUE ( RID_FORMBROWSER_START + 59 ) -#define RID_STR_CURRENCYSYMBOL ( RID_FORMBROWSER_START + 60 ) -#define RID_STR_CURRSYM_POSITION ( RID_FORMBROWSER_START + 61 ) -#define RID_STR_DATEMIN ( RID_FORMBROWSER_START + 62 ) -#define RID_STR_DATEMAX ( RID_FORMBROWSER_START + 63 ) -#define RID_STR_DATEFORMAT ( RID_FORMBROWSER_START + 64 ) -#define RID_STR_SELECTEDITEMS ( RID_FORMBROWSER_START + 65 ) -#define RID_STR_TIMEMIN ( RID_FORMBROWSER_START + 66 ) -#define RID_STR_TIMEMAX ( RID_FORMBROWSER_START + 67 ) -#define RID_STR_TIMEFORMAT ( RID_FORMBROWSER_START + 68 ) -#define RID_STR_VALUEMIN ( RID_FORMBROWSER_START + 69 ) -#define RID_STR_VALUEMAX ( RID_FORMBROWSER_START + 70 ) -#define RID_STR_FORMATKEY ( RID_FORMBROWSER_START + 71 ) -#define RID_STR_CLASSID ( RID_FORMBROWSER_START + 72 ) -#define RID_STR_HEIGHT ( RID_FORMBROWSER_START + 73 ) -#define RID_STR_WIDTH ( RID_FORMBROWSER_START + 74 ) -#define RID_STR_BOUNDCOLUMN ( RID_FORMBROWSER_START + 75 ) -#define RID_STR_LISTSOURCETYPE ( RID_FORMBROWSER_START + 76 ) -#define RID_STR_LISTSOURCE ( RID_FORMBROWSER_START + 77 ) -#define RID_STR_LISTINDEX ( RID_FORMBROWSER_START + 78 ) -#define RID_STR_STRINGITEMLIST ( RID_FORMBROWSER_START + 79 ) -#define RID_STR_DEFAULTVALUE ( RID_FORMBROWSER_START + 80 ) -#define RID_STR_FONT ( RID_FORMBROWSER_START + 81 ) -#define RID_STR_ALIGN ( RID_FORMBROWSER_START + 82 ) -#define RID_STR_ROWHEIGHT ( RID_FORMBROWSER_START + 83 ) -#define RID_STR_BACKGROUNDCOLOR ( RID_FORMBROWSER_START + 84 ) -#define RID_STR_FILLCOLOR ( RID_FORMBROWSER_START + 85 ) -#define RID_STR_LINECOLOR ( RID_FORMBROWSER_START + 86 ) -#define RID_STR_BORDER ( RID_FORMBROWSER_START + 87 ) -#define RID_STR_DROPDOWN ( RID_FORMBROWSER_START + 88 ) -#define RID_STR_AUTOCOMPLETE ( RID_FORMBROWSER_START + 89 ) -#define RID_STR_LINECOUNT ( RID_FORMBROWSER_START + 90 ) -#define RID_STR_MULTILINE ( RID_FORMBROWSER_START + 91 ) -#define RID_STR_MULTISELECTION ( RID_FORMBROWSER_START + 92 ) -#define RID_STR_BUTTONTYPE ( RID_FORMBROWSER_START + 93 ) -#define RID_STR_HSCROLL ( RID_FORMBROWSER_START + 94 ) -#define RID_STR_VSCROLL ( RID_FORMBROWSER_START + 95 ) -#define RID_STR_SPIN ( RID_FORMBROWSER_START + 96 ) -#define RID_STR_AUTOLINEBREAK ( RID_FORMBROWSER_START + 97 ) -#define RID_STR_TARGET_URL ( RID_FORMBROWSER_START + 98 ) -#define RID_STR_TARGET_FRAME ( RID_FORMBROWSER_START + 99 ) -#define RID_STR_SUBMIT_ACTION ( RID_FORMBROWSER_START + 100 ) -#define RID_STR_SUBMIT_TARGET ( RID_FORMBROWSER_START + 101 ) -#define RID_STR_SUBMIT_METHOD ( RID_FORMBROWSER_START + 102 ) -#define RID_STR_SUBMIT_ENCODING ( RID_FORMBROWSER_START + 103 ) -#define RID_STR_DEFAULT_STATE ( RID_FORMBROWSER_START + 104 ) -#define RID_STR_DEFAULT_BUTTON ( RID_FORMBROWSER_START + 105 ) -#define RID_STR_IMAGE_URL ( RID_FORMBROWSER_START + 106 ) -#define RID_STR_DEFAULT_SELECT_SEQ ( RID_FORMBROWSER_START + 107 ) -#define RID_STR_ECHO_CHAR ( RID_FORMBROWSER_START + 108 ) -#define RID_STR_EMPTY_IS_NULL ( RID_FORMBROWSER_START + 109 ) -#define RID_STR_TRISTATE ( RID_FORMBROWSER_START + 110 ) -#define RID_STR_MASTERFIELDS ( RID_FORMBROWSER_START + 111 ) -#define RID_STR_SLAVEFIELDS ( RID_FORMBROWSER_START + 112 ) -#define RID_STR_NAVIGATION ( RID_FORMBROWSER_START + 113 ) -#define RID_STR_RECORDMARKER ( RID_FORMBROWSER_START + 114 ) -#define RID_STR_FILTERPROPOSAL ( RID_FORMBROWSER_START + 115 ) -#define RID_STR_TAG ( RID_FORMBROWSER_START + 116 ) -#define RID_STR_HELPTEXT ( RID_FORMBROWSER_START + 117 ) -#define RID_STR_HELPURL ( RID_FORMBROWSER_START + 118 ) -#define RID_STR_INPUT_REQUIRED ( RID_FORMBROWSER_START + 119 ) -#define RID_STR_UNCHECKEDREFVALUE ( RID_FORMBROWSER_START + 120 ) -#define RID_STR_CURSOR_TYPE ( RID_FORMBROWSER_START + 121 ) -#define RID_STR_ENABLE_VISIBLE ( RID_FORMBROWSER_START + 122 ) -#define RID_STR_WHEEL_BEHAVIOR ( RID_FORMBROWSER_START + 123 ) -#define RID_STR_GROUP_NAME ( RID_FORMBROWSER_START + 124 ) - // FREE - // FREE - // FREE - // FREE - // FREE - // FREE - // FREE -#define RID_STR_ENUM_NAVIGATION ( RID_FORMBROWSER_START + 131 ) -#define RID_STR_EVT_APPROVEACTIONPERFORMED ( RID_FORMBROWSER_START + 132 ) -#define RID_STR_EVT_ACTIONPERFORMED ( RID_FORMBROWSER_START + 133 ) -#define RID_STR_EVT_CHANGED ( RID_FORMBROWSER_START + 134 ) -#define RID_STR_EVT_TEXTCHANGED ( RID_FORMBROWSER_START + 135 ) -#define RID_STR_EVT_ITEMSTATECHANGED ( RID_FORMBROWSER_START + 136 ) -#define RID_STR_EVT_FOCUSGAINED ( RID_FORMBROWSER_START + 137 ) -#define RID_STR_EVT_FOCUSLOST ( RID_FORMBROWSER_START + 138 ) -#define RID_STR_EVT_KEYTYPED ( RID_FORMBROWSER_START + 139 ) -#define RID_STR_EVT_KEYUP ( RID_FORMBROWSER_START + 140 ) -#define RID_STR_EVT_MOUSEENTERED ( RID_FORMBROWSER_START + 141 ) -#define RID_STR_EVT_MOUSEDRAGGED ( RID_FORMBROWSER_START + 142 ) -#define RID_STR_EVT_MOUSEMOVED ( RID_FORMBROWSER_START + 143 ) -#define RID_STR_EVT_MOUSEPRESSED ( RID_FORMBROWSER_START + 144 ) -#define RID_STR_EVT_MOUSERELEASED ( RID_FORMBROWSER_START + 145 ) -#define RID_STR_EVT_MOUSEEXITED ( RID_FORMBROWSER_START + 146 ) -#define RID_STR_EVT_APPROVERESETTED ( RID_FORMBROWSER_START + 147 ) -#define RID_STR_EVT_RESETTED ( RID_FORMBROWSER_START + 148 ) -#define RID_STR_EVT_SUBMITTED ( RID_FORMBROWSER_START + 149 ) -#define RID_STR_EVT_BEFOREUPDATE ( RID_FORMBROWSER_START + 150 ) -#define RID_STR_EVT_AFTERUPDATE ( RID_FORMBROWSER_START + 151 ) -#define RID_STR_EVT_LOADED ( RID_FORMBROWSER_START + 152 ) -#define RID_STR_EVT_RELOADING ( RID_FORMBROWSER_START + 153 ) -#define RID_STR_EVT_RELOADED ( RID_FORMBROWSER_START + 154 ) -#define RID_STR_EVT_UNLOADING ( RID_FORMBROWSER_START + 155 ) -#define RID_STR_EVT_UNLOADED ( RID_FORMBROWSER_START + 156 ) -#define RID_STR_EVT_CONFIRMDELETE ( RID_FORMBROWSER_START + 157 ) -#define RID_STR_EVT_APPROVEROWCHANGE ( RID_FORMBROWSER_START + 158 ) -#define RID_STR_EVT_ROWCHANGE ( RID_FORMBROWSER_START + 159 ) -#define RID_STR_EVT_POSITIONING ( RID_FORMBROWSER_START + 160 ) -#define RID_STR_EVT_POSITIONED ( RID_FORMBROWSER_START + 161 ) -#define RID_STR_EVT_APPROVEPARAMETER ( RID_FORMBROWSER_START + 162 ) -#define RID_STR_EVT_ERROROCCURRED ( RID_FORMBROWSER_START + 163 ) -#define RID_STR_EVENTS ( RID_FORMBROWSER_START + 164 ) -#define RID_STR_ESCAPE_PROCESSING ( RID_FORMBROWSER_START + 165 ) - // FREE -#define RID_STR_POSITIONX ( RID_FORMBROWSER_START + 167 ) -#define RID_STR_POSITIONY ( RID_FORMBROWSER_START + 168 ) -#define RID_STR_TITLE ( RID_FORMBROWSER_START + 169 ) -#define RID_STR_STEP ( RID_FORMBROWSER_START + 170 ) -#define RID_STR_PROGRESSVALUE ( RID_FORMBROWSER_START + 171 ) -#define RID_STR_PROGRESSVALUE_MIN ( RID_FORMBROWSER_START + 172 ) -#define RID_STR_PROGRESSVALUE_MAX ( RID_FORMBROWSER_START + 173 ) -#define RID_STR_SCROLLVALUE ( RID_FORMBROWSER_START + 174 ) -#define RID_STR_SCROLLVALUE_MAX ( RID_FORMBROWSER_START + 175 ) -#define RID_STR_LINEINCREMENT ( RID_FORMBROWSER_START + 176 ) -#define RID_STR_BLOCKINCREMENT ( RID_FORMBROWSER_START + 177 ) -#define RID_STR_VISIBLESIZE ( RID_FORMBROWSER_START + 178 ) -#define RID_STR_ORIENTATION ( RID_FORMBROWSER_START + 179 ) - // FREE -#define RID_STR_VERTICAL_ALIGN ( RID_FORMBROWSER_START + 181 ) -#define RID_STR_EVT_ADJUSTMENTVALUECHANGED ( RID_FORMBROWSER_START + 182 ) -#define RID_STR_DATE ( RID_FORMBROWSER_START + 183 ) -#define RID_STR_STATE ( RID_FORMBROWSER_START + 184 ) -#define RID_STR_TIME ( RID_FORMBROWSER_START + 185 ) -#define RID_STR_SCALEIMAGE ( RID_FORMBROWSER_START + 186 ) -#define RID_STR_PUSHBUTTONTYPE ( RID_FORMBROWSER_START + 187 ) -#define RID_STR_ENUM_PUSHBUTTONTYPE ( RID_FORMBROWSER_START + 188 ) -#define RID_STR_UNABLETOCONNECT ( RID_FORMBROWSER_START + 189 ) -#define RID_STR_TEXT ( RID_FORMBROWSER_START + 190 ) -#define RID_STR_BOUND_CELL ( RID_FORMBROWSER_START + 191 ) -#define RID_STR_LIST_CELL_RANGE ( RID_FORMBROWSER_START + 192 ) -#define RID_STR_CELL_EXCHANGE_TYPE ( RID_FORMBROWSER_START + 193 ) -#define RID_STR_ANCHOR_TYPE ( RID_FORMBROWSER_START + 194 ) -#define RID_STR_SCROLLVALUE_MIN ( RID_FORMBROWSER_START + 195 ) -#define RID_STR_DEFAULT_SCROLLVALUE ( RID_FORMBROWSER_START + 196 ) -#define RID_STR_REPEAT_DELAY ( RID_FORMBROWSER_START + 197 ) -#define RID_STR_SYMBOLCOLOR ( RID_FORMBROWSER_START + 198 ) -#define RID_STR_REPEAT ( RID_FORMBROWSER_START + 199 ) -#define RID_STR_IMAGEPOSITION ( RID_FORMBROWSER_START + 200 ) -#define RID_STR_DEFAULTTEXT ( RID_FORMBROWSER_START + 201 ) -#define RID_STR_DEFAULTDATE ( RID_FORMBROWSER_START + 202 ) -#define RID_STR_DEFAULTTIME ( RID_FORMBROWSER_START + 203 ) -#define RID_STR_WORDBREAK ( RID_FORMBROWSER_START + 204 ) -#define RID_STR_SHOW_SCROLLBARS ( RID_FORMBROWSER_START + 205 ) -#define RID_STR_QUERYDESIGN_TITLE ( RID_FORMBROWSER_START + 206 ) -#define RID_STR_ICONSIZE ( RID_FORMBROWSER_START + 207 ) -#define RID_STR_WRITING_MODE ( RID_FORMBROWSER_START + 208 ) -#define RID_STR_SHOW_POSITION ( RID_FORMBROWSER_START + 209 ) -#define RID_STR_SHOW_NAVIGATION ( RID_FORMBROWSER_START + 210 ) -#define RID_STR_SHOW_RECORDACTIONS ( RID_FORMBROWSER_START + 211 ) -#define RID_STR_SHOW_FILTERSORT ( RID_FORMBROWSER_START + 212 ) -#define RID_STR_TEXTTYPE ( RID_FORMBROWSER_START + 213 ) -#define RID_STR_LINEEND_FORMAT ( RID_FORMBROWSER_START + 214 ) -#define RID_STR_TOGGLE ( RID_FORMBROWSER_START + 215 ) -#define RID_STR_FOCUSONCLICK ( RID_FORMBROWSER_START + 216 ) -#define RID_STR_HIDEINACTIVESELECTION ( RID_FORMBROWSER_START + 217 ) -#define RID_STR_VISUALEFFECT ( RID_FORMBROWSER_START + 218 ) -#define RID_STR_BORDERCOLOR ( RID_FORMBROWSER_START + 219 ) - // FREE -#define RID_STR_XML_DATA_MODEL ( RID_FORMBROWSER_START + 221 ) -#define RID_STR_BIND_EXPRESSION ( RID_FORMBROWSER_START + 222 ) -#define RID_STR_XSD_REQUIRED ( RID_FORMBROWSER_START + 223 ) -#define RID_STR_XSD_RELEVANT ( RID_FORMBROWSER_START + 224 ) -#define RID_STR_XSD_READONLY ( RID_FORMBROWSER_START + 225 ) -#define RID_STR_XSD_CONSTRAINT ( RID_FORMBROWSER_START + 226 ) -#define RID_STR_XSD_CALCULATION ( RID_FORMBROWSER_START + 227 ) -#define RID_STR_XSD_DATA_TYPE ( RID_FORMBROWSER_START + 228 ) -#define RID_STR_XSD_WHITESPACES ( RID_FORMBROWSER_START + 229 ) -#define RID_STR_XSD_PATTERN ( RID_FORMBROWSER_START + 230 ) -#define RID_STR_XSD_LENGTH ( RID_FORMBROWSER_START + 231 ) -#define RID_STR_XSD_MIN_LENGTH ( RID_FORMBROWSER_START + 232 ) -#define RID_STR_XSD_MAX_LENGTH ( RID_FORMBROWSER_START + 233 ) -#define RID_STR_XSD_TOTAL_DIGITS ( RID_FORMBROWSER_START + 234 ) -#define RID_STR_XSD_FRACTION_DIGITS ( RID_FORMBROWSER_START + 235 ) -#define RID_STR_XSD_MAX_INCLUSIVE ( RID_FORMBROWSER_START + 236 ) -#define RID_STR_XSD_MAX_EXCLUSIVE ( RID_FORMBROWSER_START + 237 ) -#define RID_STR_XSD_MIN_INCLUSIVE ( RID_FORMBROWSER_START + 238 ) -#define RID_STR_XSD_MIN_EXCLUSIVE ( RID_FORMBROWSER_START + 239 ) -#define RID_STR_SUBMISSION_ID ( RID_FORMBROWSER_START + 240 ) -#define RID_STR_LIST_BINDING ( RID_FORMBROWSER_START + 241 ) -#define RID_STR_BINDING_UI_NAME ( RID_FORMBROWSER_START + 242 ) -#define RID_STR_BINDING_NAME RID_STR_BINDING_UI_NAME -#define RID_STR_DECORATION ( RID_FORMBROWSER_START + 243 ) -#define RID_STR_SELECTION_TYPE ( RID_FORMBROWSER_START + 244 ) -#define RID_STR_ROOT_DISPLAYED ( RID_FORMBROWSER_START + 245 ) -#define RID_STR_SHOWS_HANDLES ( RID_FORMBROWSER_START + 246 ) -#define RID_STR_SHOWS_ROOT_HANDLES ( RID_FORMBROWSER_START + 247 ) -#define RID_STR_EDITABLE ( RID_FORMBROWSER_START + 248 ) -#define RID_STR_INVOKES_STOP_NOT_EDITING ( RID_FORMBROWSER_START + 249 ) -#define RID_STR_NOLABEL ( RID_FORMBROWSER_START + 250 ) -#define RID_STR_FONTSTYLE_REGULAR ( RID_FORMBROWSER_START + 251 ) -#define RID_STR_FONTSTYLE_BOLD_ITALIC ( RID_FORMBROWSER_START + 252 ) -#define RID_STR_FONTSTYLE_ITALIC ( RID_FORMBROWSER_START + 253 ) -#define RID_STR_FONTSTYLE_BOLD ( RID_FORMBROWSER_START + 254 ) -#define RID_STR_FONT_DEFAULT ( RID_FORMBROWSER_START + 255 ) - - -// ----------------------------------------------------------------------- -// - message strings - -#define RID_STR_CONFIRM_DELETE_DATA_TYPE ( RID_FORMBROWSER_START + 500 ) - -// ----------------------------------------------------------------------- -// - dialogs - -#define RID_DLG_SELECTLABELCONTROL ( RID_PROPCONTROLLER_START + 0 ) -#define RID_DLG_TABORDER ( RID_PROPCONTROLLER_START + 1 ) -#define RID_DLG_FORMLINKS ( RID_PROPCONTROLLER_START + 2 ) -#define RID_DLG_SELECTION ( RID_PROPCONTROLLER_START + 3 ) -#define RID_DLG_NEW_DATA_TYPE ( RID_PROPCONTROLLER_START + 4 ) - -// ----------------------------------------------------------------------- -// - tab dialogs - -#define RID_TABDLG_FONTDIALOG ( RID_PROPCONTROLLER_START + 0 ) - -// ----------------------------------------------------------------------- -// - ImageLists - -#define RID_IL_FORMEXPLORER ( RID_PROPCONTROLLER_START + 0 ) - -// ----------------------------------------------------------------------- -// - untyped resources - -#define RID_RSC_ENUM_SCROLLBARS ( RID_PROPCONTROLLER_START + 0 ) -#define RID_RSC_ENUM_COMMAND_TYPE ( RID_PROPCONTROLLER_START + 1 ) -#define RID_RSC_ENUM_LINEEND_FORMAT ( RID_PROPCONTROLLER_START + 2 ) -#define RID_RSC_ENUM_TEXTTYPE ( RID_PROPCONTROLLER_START + 3 ) -#define RID_RSC_ENUM_VISUALEFFECT ( RID_PROPCONTROLLER_START + 4 ) -#define RID_RSC_ENUM_IMAGE_POSITION ( RID_PROPCONTROLLER_START + 5 ) -#define RID_RSC_BUTTON_IMAGES ( RID_PROPCONTROLLER_START + 6 ) -#define RID_RSC_ENUM_WHITESPACE_HANDLING ( RID_PROPCONTROLLER_START + 7 ) -#define RID_RSC_ENUM_VERTICAL_ALIGN ( RID_PROPCONTROLLER_START + 8 ) -#define RID_RSC_ENUM_BORDER_TYPE ( RID_PROPCONTROLLER_START + 9 ) -#define RID_RSC_ENUM_ICONSIZE_TYPE ( RID_PROPCONTROLLER_START + 10 ) -#define RID_RSC_ENUM_LISTSOURCE_TYPE ( RID_PROPCONTROLLER_START + 11 ) -#define RID_RSC_ENUM_ALIGNMENT ( RID_PROPCONTROLLER_START + 12 ) -#define RID_RSC_ENUM_BUTTONTYPE ( RID_PROPCONTROLLER_START + 13 ) -#define RID_RSC_ENUM_PUSHBUTTONTYPE ( RID_PROPCONTROLLER_START + 14 ) -#define RID_RSC_ENUM_SUBMIT_METHOD ( RID_PROPCONTROLLER_START + 15 ) -#define RID_RSC_ENUM_SUBMIT_ENCODING ( RID_PROPCONTROLLER_START + 16 ) -#define RID_RSC_ENUM_DATEFORMAT_LIST ( RID_PROPCONTROLLER_START + 17 ) -#define RID_RSC_ENUM_TIMEFORMAT_LIST ( RID_PROPCONTROLLER_START + 18 ) -#define RID_RSC_ENUM_CHECKED ( RID_PROPCONTROLLER_START + 19 ) -#define RID_RSC_ENUM_CYCLE ( RID_PROPCONTROLLER_START + 20 ) -#define RID_RSC_ENUM_NAVIGATION ( RID_PROPCONTROLLER_START + 21 ) -#define RID_RSC_ENUM_ORIENTATION ( RID_PROPCONTROLLER_START + 22 ) -#define RID_RSC_ENUM_CELL_EXCHANGE_TYPE ( RID_PROPCONTROLLER_START + 23 ) -#define RID_RSC_ENUM_SUBMIT_TARGET ( RID_PROPCONTROLLER_START + 24 ) -#define RID_RSC_ENUM_SELECTION_TYPE ( RID_PROPCONTROLLER_START + 25 ) -#define RID_RSC_ENUM_SCALE_MODE ( RID_PROPCONTROLLER_START + 26 ) -#define RID_RSC_ENUM_YESNO ( RID_PROPCONTROLLER_START + 27 ) -#define RID_RSC_ENUM_SHOWHIDE ( RID_PROPCONTROLLER_START + 28 ) -#define RID_RSC_ENUM_WRITING_MODE ( RID_PROPCONTROLLER_START + 29 ) -#define RID_RSC_ENUM_WHEEL_BEHAVIOR ( RID_PROPCONTROLLER_START + 30 ) -#define RID_RSC_ENUM_TEXT_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 31 ) -#define RID_RSC_ENUM_SHEET_ANCHOR_TYPE ( RID_PROPCONTROLLER_START + 32 ) - -// ----------------------------------------------------------------------- -// - ImageList - local ids -// ----------------------------------------------------------------------- -// HACK HACK HACK -// as long as we have no real property browser, but this outsourcing only, -// we do not duplicate images. Instead we do some hard coding for the image ids - - -#define RID_SVXIMG_CONTROL 10144 -#define RID_SVXIMG_BUTTON 10594 -#define RID_SVXIMG_RADIOBUTTON 10595 -#define RID_SVXIMG_CHECKBOX 10596 -#define RID_SVXIMG_FIXEDTEXT 10597 -#define RID_SVXIMG_GROUPBOX 10598 -#define RID_SVXIMG_EDIT 10599 -#define RID_SVXIMG_LISTBOX 10600 -#define RID_SVXIMG_COMBOBOX 10601 -#define RID_SVXIMG_GRID 10603 -#define RID_SVXIMG_IMAGEBUTTON 10604 -#define RID_SVXIMG_FILECONTROL 10605 -#define RID_SVXIMG_DATEFIELD 10704 -#define RID_SVXIMG_TIMEFIELD 10705 -#define RID_SVXIMG_NUMERICFIELD 10706 -#define RID_SVXIMG_CURRENCYFIELD 10707 -#define RID_SVXIMG_PATTERNFIELD 10708 -#define RID_SVXIMG_IMAGECONTROL 10710 -#define RID_SVXIMG_HIDDEN 18022 -#define RID_SVXIMG_FORMATTEDFIELD 10728 -#define RID_SVXIMG_FILTER 10715 -#define RID_SVXIMG_FORMS 18013 -#define RID_SVXIMG_FORM 10593 -#define RID_SVXIMG_COLLAPSEDNODE 18002 -#define RID_SVXIMG_EXPANDEDNODE 18003 -#define RID_SVXIMG_SCROLLBAR 10768 -#define RID_SVXIMG_SPINBUTTON 10769 -#define RID_SVXIMG_NAVIGATIONBAR 10607 - - -#endif // _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ - diff --git a/extensions/source/propctrlr/formstrings.cxx b/extensions/source/propctrlr/formstrings.cxx deleted file mode 100644 index 45aefb4b0..000000000 --- a/extensions/source/propctrlr/formstrings.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifndef _EXTENSIONS_FORMSCTRLR_FORMSTRINGS_HXX_ -#define PCR_IMPLEMENT_STRINGS -#include "formstrings.hxx" -#undef PCR_IMPLEMENT_STRINGS -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx deleted file mode 100644 index 0910105da..000000000 --- a/extensions/source/propctrlr/formstrings.hxx +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMSCTRLR_FORMSTRINGS_HXX_ -#define _EXTENSIONS_FORMSCTRLR_FORMSTRINGS_HXX_ - -#include "stringdefine.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - PCR_CONSTASCII_STRING( PROPERTY_DEFAULTCONTROL, "DefaultControl" ); - PCR_CONSTASCII_STRING( PROPERTY_INTROSPECTEDOBJECT, "IntrospectedObject" ); - PCR_CONSTASCII_STRING( PROPERTY_CURRENTPAGE, "CurrentPage" ); - PCR_CONSTASCII_STRING( PROPERTY_CONTROLCONTEXT, "ControlContext" ); - - // properties - PCR_CONSTASCII_STRING( PROPERTY_CLASSID, "ClassId" ); - PCR_CONSTASCII_STRING( PROPERTY_CONTROLLABEL, "LabelControl"); - PCR_CONSTASCII_STRING( PROPERTY_LABEL, "Label"); - PCR_CONSTASCII_STRING( PROPERTY_TABINDEX, "TabIndex"); - PCR_CONSTASCII_STRING( PROPERTY_WHEEL_BEHAVIOR, "MouseWheelBehavior"); - PCR_CONSTASCII_STRING( PROPERTY_TAG, "Tag"); - PCR_CONSTASCII_STRING( PROPERTY_NAME, "Name"); - PCR_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName"); - PCR_CONSTASCII_STRING( PROPERTY_VALUE, "Value"); - PCR_CONSTASCII_STRING( PROPERTY_TEXT, "Text"); - PCR_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode"); - PCR_CONSTASCII_STRING( PROPERTY_CYCLE, "Cycle"); - PCR_CONSTASCII_STRING( PROPERTY_CONTROLSOURCE, "DataField"); - PCR_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired"); - PCR_CONSTASCII_STRING( PROPERTY_ENABLED, "Enabled"); - PCR_CONSTASCII_STRING( PROPERTY_ENABLE_VISIBLE, "EnableVisible" ); - PCR_CONSTASCII_STRING( PROPERTY_READONLY, "ReadOnly"); - PCR_CONSTASCII_STRING( PROPERTY_ISREADONLY, "IsReadOnly"); - PCR_CONSTASCII_STRING( PROPERTY_FILTER, "Filter"); - PCR_CONSTASCII_STRING( PROPERTY_WIDTH, "Width"); - PCR_CONSTASCII_STRING( PROPERTY_MULTILINE, "MultiLine"); - PCR_CONSTASCII_STRING( PROPERTY_WORDBREAK, "WordBreak"); - PCR_CONSTASCII_STRING( PROPERTY_TARGET_URL, "TargetURL"); - PCR_CONSTASCII_STRING( PROPERTY_TARGET_FRAME, "TargetFrame"); - PCR_CONSTASCII_STRING( PROPERTY_MAXTEXTLEN, "MaxTextLen"); - PCR_CONSTASCII_STRING( PROPERTY_EDITMASK, "EditMask"); - PCR_CONSTASCII_STRING( PROPERTY_SPIN, "Spin"); - PCR_CONSTASCII_STRING( PROPERTY_TRISTATE, "TriState"); - PCR_CONSTASCII_STRING( PROPERTY_HIDDEN_VALUE, "HiddenValue"); - PCR_CONSTASCII_STRING( PROPERTY_BUTTONTYPE, "ButtonType"); - PCR_CONSTASCII_STRING( PROPERTY_XFORMS_BUTTONTYPE, "XFormsButtonType"); - PCR_CONSTASCII_STRING( PROPERTY_STRINGITEMLIST, "StringItemList"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_TEXT, "DefaultText"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_STATE, "DefaultState"); - PCR_CONSTASCII_STRING( PROPERTY_FORMATKEY, "FormatKey"); - PCR_CONSTASCII_STRING( PROPERTY_FORMATSSUPPLIER, "FormatsSupplier"); - PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_ACTION, "SubmitAction"); - PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_TARGET, "SubmitTarget"); - PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_METHOD, "SubmitMethod"); - PCR_CONSTASCII_STRING( PROPERTY_SUBMIT_ENCODING, "SubmitEncoding"); - PCR_CONSTASCII_STRING( PROPERTY_IMAGE_URL, "ImageURL"); - PCR_CONSTASCII_STRING( PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull"); - PCR_CONSTASCII_STRING( PROPERTY_LISTSOURCETYPE, "ListSourceType"); - PCR_CONSTASCII_STRING( PROPERTY_LISTSOURCE, "ListSource"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection"); - PCR_CONSTASCII_STRING( PROPERTY_MULTISELECTION, "MultiSelection"); - PCR_CONSTASCII_STRING( PROPERTY_ALIGN, "Align"); - PCR_CONSTASCII_STRING( PROPERTY_VERTICAL_ALIGN, "VerticalAlign"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_DATE, "DefaultDate"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_TIME, "DefaultTime"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_VALUE, "DefaultValue"); - PCR_CONSTASCII_STRING( PROPERTY_DECIMAL_ACCURACY, "DecimalAccuracy"); - PCR_CONSTASCII_STRING( PROPERTY_REFVALUE, "RefValue"); - PCR_CONSTASCII_STRING( PROPERTY_UNCHECKEDREFVALUE, "SecondaryRefValue"); - PCR_CONSTASCII_STRING( PROPERTY_VALUEMIN, "ValueMin"); - PCR_CONSTASCII_STRING( PROPERTY_VALUEMAX, "ValueMax"); - PCR_CONSTASCII_STRING( PROPERTY_STRICTFORMAT, "StrictFormat"); - PCR_CONSTASCII_STRING( PROPERTY_ALLOWADDITIONS, "AllowInserts"); - PCR_CONSTASCII_STRING( PROPERTY_ALLOWEDITS, "AllowUpdates"); - PCR_CONSTASCII_STRING( PROPERTY_ALLOWDELETIONS, "AllowDeletes"); - PCR_CONSTASCII_STRING( PROPERTY_MASTERFIELDS, "MasterFields"); - PCR_CONSTASCII_STRING( PROPERTY_LITERALMASK, "LiteralMask"); - PCR_CONSTASCII_STRING( PROPERTY_VALUESTEP, "ValueStep"); - PCR_CONSTASCII_STRING( PROPERTY_SHOWTHOUSANDSEP, "ShowThousandsSeparator"); - PCR_CONSTASCII_STRING( PROPERTY_CURRENCYSYMBOL, "CurrencySymbol"); - PCR_CONSTASCII_STRING( PROPERTY_DATEFORMAT, "DateFormat"); - PCR_CONSTASCII_STRING( PROPERTY_DATEMIN, "DateMin"); - PCR_CONSTASCII_STRING( PROPERTY_DATEMAX, "DateMax"); - PCR_CONSTASCII_STRING( PROPERTY_TIMEFORMAT, "TimeFormat"); - PCR_CONSTASCII_STRING( PROPERTY_TIMEMIN, "TimeMin"); - PCR_CONSTASCII_STRING( PROPERTY_TIMEMAX, "TimeMax"); - PCR_CONSTASCII_STRING( PROPERTY_LINECOUNT, "LineCount"); - PCR_CONSTASCII_STRING( PROPERTY_BOUNDCOLUMN, "BoundColumn"); - PCR_CONSTASCII_STRING( PROPERTY_BACKGROUNDCOLOR, "BackgroundColor"); - PCR_CONSTASCII_STRING( PROPERTY_FILLCOLOR, "FillColor"); - PCR_CONSTASCII_STRING( PROPERTY_TEXTCOLOR, "TextColor"); - PCR_CONSTASCII_STRING( PROPERTY_LINECOLOR, "LineColor"); - PCR_CONSTASCII_STRING( PROPERTY_BORDER, "Border"); - PCR_CONSTASCII_STRING( PROPERTY_ICONSIZE, "IconSize"); - PCR_CONSTASCII_STRING( PROPERTY_DROPDOWN, "Dropdown"); - PCR_CONSTASCII_STRING( PROPERTY_HSCROLL, "HScroll"); - PCR_CONSTASCII_STRING( PROPERTY_VSCROLL, "VScroll"); - PCR_CONSTASCII_STRING( PROPERTY_SHOW_SCROLLBARS, "ShowScrollbars"); - PCR_CONSTASCII_STRING( PROPERTY_TABSTOP, "Tabstop"); - PCR_CONSTASCII_STRING( PROPERTY_AUTOCOMPLETE, "Autocomplete"); - PCR_CONSTASCII_STRING( PROPERTY_PRINTABLE, "Printable"); - PCR_CONSTASCII_STRING( PROPERTY_ECHO_CHAR, "EchoChar"); - PCR_CONSTASCII_STRING( PROPERTY_ROWHEIGHT, "RowHeight"); - PCR_CONSTASCII_STRING( PROPERTY_HELPTEXT, "HelpText"); - PCR_CONSTASCII_STRING( PROPERTY_FONT, "FontDescriptor"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_NAME, "FontName"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_STYLENAME, "FontStyleName"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_FAMILY, "FontFamily"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_CHARSET, "FontCharset"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_HEIGHT, "FontHeight"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_WEIGHT, "FontWeight"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_SLANT, "FontSlant"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_UNDERLINE, "FontUnderline"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_STRIKEOUT, "FontStrikeout"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_RELIEF, "FontRelief"); - PCR_CONSTASCII_STRING( PROPERTY_FONT_EMPHASIS_MARK, "FontEmphasisMark"); - PCR_CONSTASCII_STRING( PROPERTY_TEXTLINECOLOR, "TextLineColor"); - PCR_CONSTASCII_STRING( PROPERTY_HELPURL, "HelpURL"); - PCR_CONSTASCII_STRING( PROPERTY_RECORDMARKER, "HasRecordMarker"); - PCR_CONSTASCII_STRING( PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault"); - PCR_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MIN, "EffectiveMin"); - PCR_CONSTASCII_STRING( PROPERTY_EFFECTIVE_MAX, "EffectiveMax"); - PCR_CONSTASCII_STRING( PROPERTY_FILTERPROPOSAL, "UseFilterValueProposal"); - PCR_CONSTASCII_STRING( PROPERTY_CURRSYM_POSITION, "PrependCurrencySymbol"); - PCR_CONSTASCII_STRING( PROPERTY_COMMAND, "Command"); - PCR_CONSTASCII_STRING( PROPERTY_COMMANDTYPE, "CommandType"); - PCR_CONSTASCII_STRING( PROPERTY_INSERTONLY, "IgnoreResult"); - PCR_CONSTASCII_STRING( PROPERTY_ESCAPE_PROCESSING, "EscapeProcessing"); - PCR_CONSTASCII_STRING( PROPERTY_TITLE, "Title"); - PCR_CONSTASCII_STRING( PROPERTY_SORT, "Order"); - PCR_CONSTASCII_STRING( PROPERTY_DATASOURCE, "DataSourceName"); - PCR_CONSTASCII_STRING( PROPERTY_DETAILFIELDS, "DetailFields"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULTBUTTON, "DefaultButton"); - PCR_CONSTASCII_STRING( PROPERTY_LISTINDEX, "ListIndex"); - PCR_CONSTASCII_STRING( PROPERTY_HEIGHT, "Height"); - PCR_CONSTASCII_STRING( PROPERTY_HASNAVIGATION, "HasNavigationBar"); - PCR_CONSTASCII_STRING( PROPERTY_POSITIONX, "PositionX"); - PCR_CONSTASCII_STRING( PROPERTY_POSITIONY, "PositionY"); - PCR_CONSTASCII_STRING( PROPERTY_STEP, "Step"); - PCR_CONSTASCII_STRING( PROPERTY_WORDLINEMODE, "FontWordLineMode"); - PCR_CONSTASCII_STRING( PROPERTY_PROGRESSVALUE, "ProgressValue"); - PCR_CONSTASCII_STRING( PROPERTY_PROGRESSVALUE_MIN, "ProgressValueMin"); - PCR_CONSTASCII_STRING( PROPERTY_PROGRESSVALUE_MAX, "ProgressValueMax"); - PCR_CONSTASCII_STRING( PROPERTY_SCROLLVALUE, "ScrollValue"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_SCROLLVALUE, "DefaultScrollValue"); - PCR_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MIN, "ScrollValueMin"); - PCR_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MAX, "ScrollValueMax"); - PCR_CONSTASCII_STRING( PROPERTY_LINEINCREMENT, "LineIncrement"); - PCR_CONSTASCII_STRING( PROPERTY_BLOCKINCREMENT, "BlockIncrement"); - PCR_CONSTASCII_STRING( PROPERTY_VISIBLESIZE, "VisibleSize"); - PCR_CONSTASCII_STRING( PROPERTY_ORIENTATION, "Orientation"); - PCR_CONSTASCII_STRING( PROPERTY_IMAGEPOSITION, "ImagePosition"); - PCR_CONSTASCII_STRING( PROPERTY_ACTIVE_CONNECTION, "ActiveConnection"); - PCR_CONSTASCII_STRING( PROPERTY_ACTIVECOMMAND, "ActiveCommand"); - PCR_CONSTASCII_STRING( PROPERTY_DATE, "Date"); - PCR_CONSTASCII_STRING( PROPERTY_STATE, "State"); - PCR_CONSTASCII_STRING( PROPERTY_TIME, "Time"); - PCR_CONSTASCII_STRING( PROPERTY_SCALEIMAGE, "ScaleImage"); - PCR_CONSTASCII_STRING( PROPERTY_SCALE_MODE, "ScaleMode"); - PCR_CONSTASCII_STRING( PROPERTY_PUSHBUTTONTYPE, "PushButtonType"); - PCR_CONSTASCII_STRING( PROPERTY_EFFECTIVE_VALUE, "EffectiveValue"); - PCR_CONSTASCII_STRING( PROPERTY_SELECTEDITEMS, "SelectedItems"); - PCR_CONSTASCII_STRING( PROPERTY_REPEAT, "Repeat"); - PCR_CONSTASCII_STRING( PROPERTY_REPEAT_DELAY, "RepeatDelay"); - PCR_CONSTASCII_STRING( PROPERTY_SYMBOLCOLOR, "SymbolColor"); - PCR_CONSTASCII_STRING( PROPERTY_SPINVALUE, "SpinValue"); - PCR_CONSTASCII_STRING( PROPERTY_SPINVALUE_MIN, "SpinValueMin"); - PCR_CONSTASCII_STRING( PROPERTY_SPINVALUE_MAX, "SpinValueMax"); - PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_SPINVALUE, "DefaultSpinValue"); - PCR_CONSTASCII_STRING( PROPERTY_SPININCREMENT, "SpinIncrement"); - PCR_CONSTASCII_STRING( PROPERTY_SHOW_POSITION, "ShowPosition" ); - PCR_CONSTASCII_STRING( PROPERTY_SHOW_NAVIGATION, "ShowNavigation" ); - PCR_CONSTASCII_STRING( PROPERTY_SHOW_RECORDACTIONS, "ShowRecordActions" ); - PCR_CONSTASCII_STRING( PROPERTY_SHOW_FILTERSORT, "ShowFilterSort" ); - PCR_CONSTASCII_STRING( PROPERTY_LINEEND_FORMAT, "LineEndFormat"); - PCR_CONSTASCII_STRING( PROPERTY_DECORATION, "Decoration" ); - PCR_CONSTASCII_STRING( PROPERTY_NOLABEL, "NoLabel" ); - - PCR_CONSTASCII_STRING( PROPERTY_SELECTION_TYPE, "SelectionType"); - PCR_CONSTASCII_STRING( PROPERTY_ROOT_DISPLAYED, "RootDisplayed"); - PCR_CONSTASCII_STRING( PROPERTY_SHOWS_HANDLES, "ShowsHandles"); - PCR_CONSTASCII_STRING( PROPERTY_SHOWS_ROOT_HANDLES, "ShowsRootHandles"); - PCR_CONSTASCII_STRING( PROPERTY_EDITABLE, "Editable"); - PCR_CONSTASCII_STRING( PROPERTY_INVOKES_STOP_NOT_EDITING, "InvokesStopNodeEditing"); - - PCR_CONSTASCII_STRING( PROPERTY_HARDLINEBREAKS, "HardLineBreaks"); - - PCR_CONSTASCII_STRING( PROPERTY_TOGGLE, "Toggle" ); - PCR_CONSTASCII_STRING( PROPERTY_FOCUSONCLICK, "FocusOnClick" ); - PCR_CONSTASCII_STRING( PROPERTY_HIDEINACTIVESELECTION, "HideInactiveSelection" ); - PCR_CONSTASCII_STRING( PROPERTY_VISUALEFFECT, "VisualEffect" ); - PCR_CONSTASCII_STRING( PROPERTY_BORDERCOLOR, "BorderColor" ); - - PCR_CONSTASCII_STRING( PROPERTY_ADDRESS, "Address"); - PCR_CONSTASCII_STRING( PROPERTY_REFERENCE_SHEET, "ReferenceSheet"); - PCR_CONSTASCII_STRING( PROPERTY_UI_REPRESENTATION, "UserInterfaceRepresentation"); - - PCR_CONSTASCII_STRING( PROPERTY_XML_DATA_MODEL, "XMLDataModel" ); - PCR_CONSTASCII_STRING( PROPERTY_BINDING_NAME, "BindingName" ); - PCR_CONSTASCII_STRING( PROPERTY_BIND_EXPRESSION, "BindingExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_LIST_BINDING, "ListBinding" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_REQUIRED, "RequiredExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_RELEVANT, "RelevantExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_READONLY, "ReadonlyExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_CONSTRAINT, "ConstraintExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_CALCULATION, "CalculateExpression" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_DATA_TYPE, "Type" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_WHITESPACES, "WhiteSpace" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_PATTERN, "Pattern" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_LENGTH, "Length" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_LENGTH, "MinLength" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_LENGTH, "MaxLength" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_TOTAL_DIGITS, "TotalDigits" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_FRACTION_DIGITS, "FractionDigits" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_INT, "MaxInclusiveInt" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_INT, "MaxExclusiveInt" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_INT, "MinInclusiveInt" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_INT, "MinExclusiveInt" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, "MaxInclusiveDouble" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, "MaxExclusiveDouble" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, "MinInclusiveDouble" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, "MinExclusiveDouble" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DATE, "MaxInclusiveDate" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DATE, "MaxExclusiveDate" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DATE, "MinInclusiveDate" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DATE, "MinExclusiveDate" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_TIME, "MaxInclusiveTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_TIME, "MaxExclusiveTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_TIME, "MinInclusiveTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_TIME, "MinExclusiveTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, "MaxInclusiveDateTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, "MaxExclusiveDateTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, "MinInclusiveDateTime" ); - PCR_CONSTASCII_STRING( PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME, "MinExclusiveDateTime" ); - PCR_CONSTASCII_STRING( PROPERTY_SUBMISSION_ID, "SubmissionID" ); - PCR_CONSTASCII_STRING( PROPERTY_BINDING_ID, "BindingID" ); - PCR_CONSTASCII_STRING( PROPERTY_ID, "ID" ); - PCR_CONSTASCII_STRING( PROPERTY_WRITING_MODE, "WritingMode" ); - PCR_CONSTASCII_STRING( PROPERTY_TEXT_ANCHOR_TYPE, "TextAnchorType" ); - PCR_CONSTASCII_STRING( PROPERTY_SHEET_ANCHOR_TYPE, "SheetAnchorType" ); - PCR_CONSTASCII_STRING( PROPERTY_ANCHOR_TYPE, "AnchorType" ); - PCR_CONSTASCII_STRING( PROPERTY_ANCHOR, "Anchor" ); - PCR_CONSTASCII_STRING( PROPERTY_IS_VISIBLE, "IsVisible" ); - - PCR_CONSTASCII_STRING( PROPERTY_MODEL, "Model" ); - - PCR_CONSTASCII_STRING( PROPERTY_CELL_EXCHANGE_TYPE, "ExchangeSelectionIndex"); - PCR_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell"); - PCR_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange"); - PCR_CONSTASCII_STRING( PROPERTY_AUTOLINEBREAK, "AutomaticLineBreak"); - PCR_CONSTASCII_STRING( PROPERTY_TEXTTYPE, "TextType"); - PCR_CONSTASCII_STRING( PROPERTY_RICHTEXT, "RichText"); - PCR_CONSTASCII_STRING( PROPERTY_ROWSET, "RowSet"); - - // services - PCR_CONSTASCII_STRING( SERVICE_COMPONENT_GROUPBOX, "com.sun.star.form.component.GroupBox" ); - PCR_CONSTASCII_STRING( SERVICE_COMPONENT_FIXEDTEXT, "com.sun.star.form.component.FixedText" ); - PCR_CONSTASCII_STRING( SERVICE_COMPONENT_FORMATTEDFIELD,"com.sun.star.form.component.FormattedField" ); - PCR_CONSTASCII_STRING( SERVICE_DATABASE_CONTEXT, "com.sun.star.sdb.DatabaseContext" ); - - PCR_CONSTASCII_STRING( SERVICE_TEXT_DOCUMENT, "com.sun.star.text.TextDocument" ); - PCR_CONSTASCII_STRING( SERVICE_WEB_DOCUMENT, "com.sun.star.text.WebDocument" ); - PCR_CONSTASCII_STRING( SERVICE_SPREADSHEET_DOCUMENT, "com.sun.star.sheet.SpreadsheetDocument" ); - PCR_CONSTASCII_STRING( SERVICE_DRAWING_DOCUMENT, "com.sun.star.drawing.DrawingDocument" ); - PCR_CONSTASCII_STRING( SERVICE_PRESENTATION_DOCUMENT, "com.sun.star.presentation.PresentationDocument" ); - - PCR_CONSTASCII_STRING( SERVICE_SHEET_CELL_BINDING, "com.sun.star.table.CellValueBinding" ); - PCR_CONSTASCII_STRING( SERVICE_SHEET_CELL_INT_BINDING, "com.sun.star.table.ListPositionCellBinding" ); - PCR_CONSTASCII_STRING( SERVICE_SHEET_CELLRANGE_LISTSOURCE, "com.sun.star.table.CellRangeListSource" ); - PCR_CONSTASCII_STRING( SERVICE_ADDRESS_CONVERSION, "com.sun.star.table.CellAddressConversion" ); - PCR_CONSTASCII_STRING( SERVICE_RANGEADDRESS_CONVERSION, "com.sun.star.table.CellRangeAddressConversion" ); - - PCR_CONSTASCII_STRING( SERVICE_DESKTOP, "com.sun.star.frame.Desktop" ); - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_FORMSCTRLR_FORMSTRINGS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx deleted file mode 100644 index 38a776a69..000000000 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ /dev/null @@ -1,729 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "genericpropertyhandler.hxx" -#include "formmetadata.hxx" -#include "handlerhelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler() -{ - ::pcr::OAutoRegistration< ::pcr::GenericPropertyHandler > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::reflection; - using namespace ::com::sun::star::inspection; - using ::com::sun::star::awt::XActionListener; - using ::com::sun::star::awt::ActionEvent; - - //==================================================================== - //= EnumRepresentation - //==================================================================== - class EnumRepresentation : public IPropertyEnumRepresentation - { - private: - oslInterlockedCount m_refCount; - Reference< XEnumTypeDescription > m_xTypeDescription; - Type m_aEnumType; - - public: - EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType ); - - // IPropertyEnumRepresentation implementqation - virtual ::std::vector< ::rtl::OUString > - SAL_CALL getDescriptions() const; - virtual void SAL_CALL getValueFromDescription( const ::rtl::OUString& _rDescription, ::com::sun::star::uno::Any& _out_rValue ) const; - virtual ::rtl::OUString SAL_CALL getDescriptionForValue( const ::com::sun::star::uno::Any& _rEnumValue ) const; - - // IReference implementqation - virtual oslInterlockedCount SAL_CALL acquire(); - virtual oslInterlockedCount SAL_CALL release(); - - private: - void impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const; - - private: - EnumRepresentation(); // never implemented - EnumRepresentation( const EnumRepresentation& ); // never implemented - EnumRepresentation& operator=( const EnumRepresentation& ); // never implemented - }; - - //-------------------------------------------------------------------- - EnumRepresentation::EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType ) - :m_refCount( 0 ) - ,m_aEnumType( _rEnumType ) - { - try - { - if ( _rxContext.is() ) - { - Reference< XHierarchicalNameAccess > xTypeDescProv( - _rxContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) ) ), - UNO_QUERY_THROW ); - - m_xTypeDescription = Reference< XEnumTypeDescription >( xTypeDescProv->getByHierarchicalName( m_aEnumType.getTypeName() ), UNO_QUERY_THROW ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "EnumRepresentation::EnumRepresentation: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - ::std::vector< ::rtl::OUString > EnumRepresentation::getDescriptions() const - { - Sequence< ::rtl::OUString > aNames; - try - { - if ( m_xTypeDescription.is() ) - aNames = m_xTypeDescription->getEnumNames(); - } - catch( const Exception& ) - { - OSL_FAIL( "EnumRepresentation::getDescriptions: caught an exception!" ); - } - - return ::std::vector< ::rtl::OUString >( aNames.getConstArray(), aNames.getConstArray() + aNames.getLength() ); - } - - //-------------------------------------------------------------------- - void EnumRepresentation::impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const - { - _out_rValues.realloc( 0 ); - try - { - if ( m_xTypeDescription.is() ) - _out_rValues = m_xTypeDescription->getEnumValues(); - } - catch( const Exception& ) - { - OSL_FAIL( "EnumRepresentation::impl_getValues: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void EnumRepresentation::getValueFromDescription( const ::rtl::OUString& _rDescription, Any& _out_rValue ) const - { - ::std::vector< ::rtl::OUString > aDescriptions( getDescriptions() ); - - sal_Int32 index = ::std::find( aDescriptions.begin(), aDescriptions.end(), - _rDescription ) - aDescriptions.begin(); - - Sequence< sal_Int32 > aValues; - impl_getValues( aValues ); - - if ( ( index >= 0 ) && ( index < aValues.getLength() ) ) - _out_rValue = ::cppu::int2enum( aValues[ index ], m_aEnumType ); - else - { - OSL_FAIL( "EnumRepresentation::getValueFromDescription: cannot convert!" ); - _out_rValue.clear(); - } - } - - //-------------------------------------------------------------------- - ::rtl::OUString EnumRepresentation::getDescriptionForValue( const Any& _rEnumValue ) const - { - ::rtl::OUString sDescription; - - sal_Int32 nAsInt = 0; - OSL_VERIFY( ::cppu::enum2int( nAsInt, _rEnumValue ) ); - - Sequence< sal_Int32 > aValues; - impl_getValues( aValues ); - - sal_Int32 index = ::std::find( aValues.getConstArray(), aValues.getConstArray() + aValues.getLength(), - nAsInt ) - aValues.getConstArray(); - - ::std::vector< ::rtl::OUString > aDescriptions( getDescriptions() ); - if ( ( index >= 0 ) && ( index < (sal_Int32)aDescriptions.size() ) ) - sDescription = aDescriptions[ index ]; - else - { - OSL_FAIL( "EnumRepresentation::getDescriptionForValue: cannot convert!" ); - } - return sDescription; - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL EnumRepresentation::acquire() - { - return osl_incrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL EnumRepresentation::release() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - { - delete this; - return 0; - } - return m_refCount; - } - - //==================================================================== - //= UrlClickHandler - //==================================================================== - typedef ::cppu::WeakImplHelper1 < XActionListener - > UrlClickHandler_Base; - class UrlClickHandler : public UrlClickHandler_Base - { - ComponentContext m_aContext; - public: - UrlClickHandler( const ComponentContext& _rContext, const Reference< XHyperlinkControl >& _rxControl ); - - protected: - ~UrlClickHandler(); - - // XActionListener - virtual void SAL_CALL actionPerformed( const ActionEvent& rEvent ) throw (RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException); - - protected: - void impl_dispatch_throw( const ::rtl::OUString& _rURL ); - }; - - //-------------------------------------------------------------------- - DBG_NAME( UrlClickHandler ) - //-------------------------------------------------------------------- - UrlClickHandler::UrlClickHandler( const ComponentContext& _rContext, const Reference< XHyperlinkControl >& _rxControl ) - :m_aContext( _rContext ) - { - if ( !_rxControl.is() ) - throw NullPointerException(); - - osl_incrementInterlockedCount( &m_refCount ); - { - _rxControl->addActionListener( this ); - } - osl_decrementInterlockedCount( &m_refCount ); - OSL_ENSURE( m_refCount > 0, "UrlClickHandler::UrlClickHandler: leaking!" ); - - DBG_CTOR( UrlClickHandler, NULL ); - } - - //-------------------------------------------------------------------- - UrlClickHandler::~UrlClickHandler() - { - DBG_DTOR( UrlClickHandler, NULL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL UrlClickHandler::actionPerformed( const ActionEvent& rEvent ) throw (RuntimeException) - { - Reference< XPropertyControl > xControl( rEvent.Source, UNO_QUERY_THROW ); - Any aControlValue( xControl->getValue() ); - - ::rtl::OUString sURL; - if ( aControlValue.hasValue() && !( aControlValue >>= sURL ) ) - throw RuntimeException( ::rtl::OUString(), *this ); - - if ( !sURL.getLength() ) - return; - - impl_dispatch_throw( sURL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL UrlClickHandler::disposing( const EventObject& /*Source*/ ) throw (RuntimeException) - { - // not interested in - } - - //-------------------------------------------------------------------- - void UrlClickHandler::impl_dispatch_throw( const ::rtl::OUString& _rURL ) - { - Reference< XURLTransformer > xTransformer( m_aContext.createComponent( "com.sun.star.util.URLTransformer" ), UNO_QUERY_THROW ); - URL aURL; aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:OpenHyperlink" ) ); - xTransformer->parseStrict( aURL ); - - Reference< XDispatchProvider > xDispProv( m_aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - Reference< XDispatch > xDispatch( xDispProv->queryDispatch( aURL, ::rtl::OUString(), 0 ), UNO_QUERY_THROW ); - - Sequence< PropertyValue > aDispatchArgs(1); - aDispatchArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); - aDispatchArgs[0].Value <<= _rURL; - - xDispatch->dispatch( aURL, aDispatchArgs ); - } - - //==================================================================== - //= GenericPropertyHandler - //==================================================================== - DBG_NAME( GenericPropertyHandler ) - //-------------------------------------------------------------------- - GenericPropertyHandler::GenericPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :GenericPropertyHandler_Base( m_aMutex ) - ,m_aContext( _rxContext ) - ,m_aPropertyListeners( m_aMutex ) - ,m_bPropertyMapInitialized( false ) - { - DBG_CTOR( GenericPropertyHandler, NULL ); - - m_xTypeConverter = Reference< XTypeConverter >( - m_aContext.createComponent( "com.sun.star.script.Converter" ), - UNO_QUERY_THROW - ); - } - - //-------------------------------------------------------------------- - GenericPropertyHandler::~GenericPropertyHandler() - { - DBG_DTOR( GenericPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL GenericPropertyHandler::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL GenericPropertyHandler::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) - { - StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() ); - return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end(); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupportedServiceNames( ) throw (RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL GenericPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.GenericPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.GenericPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL GenericPropertyHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new GenericPropertyHandler( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !_rxIntrospectee.is() ) - throw NullPointerException(); - - // revoke old property change listeners - ::cppu::OInterfaceIteratorHelper iterRemove( m_aPropertyListeners ); - ::cppu::OInterfaceIteratorHelper iterReAdd( m_aPropertyListeners ); // this holds a copy of the container ... - while ( iterRemove.hasMoreElements() ) - m_xComponent->removePropertyChangeListener( ::rtl::OUString(), static_cast< XPropertyChangeListener* >( iterRemove.next() ) ); - - m_xComponentIntrospectionAccess.clear(); - m_xComponent.clear(); - m_xPropertyState.clear(); - - // create an introspection adapter for the component - Reference< XIntrospection > xIntrospection; - if ( !m_aContext.createComponent( "com.sun.star.beans.Introspection", xIntrospection ) ) - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not create an instance of the service com.sun.star.beans.Introspection." ) ), *this ); - - Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( makeAny( _rxIntrospectee ) ) ); - if ( !xIntrospectionAccess.is() ) - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The introspection service could not handle the given component." ) ), *this ); - - m_xComponent = Reference< XPropertySet >( xIntrospectionAccess->queryAdapter( XPropertySet::static_type() ), UNO_QUERY_THROW ); - // now that we survived so far, remember m_xComponentIntrospectionAccess - m_xComponentIntrospectionAccess = xIntrospectionAccess; - m_xPropertyState = m_xPropertyState.query( m_xComponent ); - - m_bPropertyMapInitialized = false; - m_aProperties.clear(); - - // re-add the property change listeners - while ( iterReAdd.hasMoreElements() ) - m_xComponent->addPropertyChangeListener( ::rtl::OUString(), static_cast< XPropertyChangeListener* >( iterReAdd.next() ) ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL GenericPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xComponent.is() ) - throw UnknownPropertyException(); - - return m_xComponent->getPropertyValue( _rPropertyName ); - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_xComponent.is() ) - throw UnknownPropertyException(); - - m_xComponent->setPropertyValue( _rPropertyName, _rValue ); - } - - //-------------------------------------------------------------------- - ::rtl::Reference< IPropertyEnumRepresentation > GenericPropertyHandler::impl_getEnumConverter( const Type& _rEnumType ) - { - ::rtl::Reference< IPropertyEnumRepresentation >& rConverter = m_aEnumConverters[ _rEnumType ]; - if ( !rConverter.is() ) - rConverter = new EnumRepresentation( m_aContext.getUNOContext(), _rEnumType ); - return rConverter; - } - - //-------------------------------------------------------------------- - Any SAL_CALL GenericPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap(); - - PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName ); - if ( pos == m_aProperties.end() ) - throw UnknownPropertyException(); - - Any aPropertyValue; - if ( !_rControlValue.hasValue() ) - // NULL is converted to NULL - return aPropertyValue; - - if ( pos->second.Type.getTypeClass() == TypeClass_ENUM ) - { - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - impl_getEnumConverter( pos->second.Type )->getValueFromDescription( sControlValue, aPropertyValue ); - } - else - aPropertyValue = PropertyHandlerHelper::convertToPropertyValue( m_aContext.getContext(),m_xTypeConverter, pos->second, _rControlValue ); - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL GenericPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap(); - - PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName ); - if ( pos == m_aProperties.end() ) - throw UnknownPropertyException(); - - Any aControlValue; - if ( !_rPropertyValue.hasValue() ) - // NULL is converted to NULL - return aControlValue; - - if ( pos->second.Type.getTypeClass() == TypeClass_ENUM ) - { - aControlValue <<= impl_getEnumConverter( pos->second.Type )->getDescriptionForValue( _rPropertyValue ); - } - else - aControlValue = PropertyHandlerHelper::convertToControlValue( m_aContext.getContext(),m_xTypeConverter, _rPropertyValue, _rControlValueType ); - return aControlValue; - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL GenericPropertyHandler::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyState eState = PropertyState_DIRECT_VALUE; - if ( m_xPropertyState.is() ) - eState = m_xPropertyState->getPropertyState( _rPropertyName ); - return eState; - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - if ( !_rxListener.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - m_aPropertyListeners.addInterface( _rxListener ); - if ( m_xComponent.is() ) - { - try - { - m_xComponent->addPropertyChangeListener( ::rtl::OUString(), _rxListener ); - } - catch( const UnknownPropertyException& ) - { - OSL_FAIL( "GenericPropertyHandler::addPropertyChangeListener:\nThe inspected component does not allow registering for all properties at once! This violates the interface contract!" ); - } - } - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_xComponent.is() ) - { - try - { - m_xComponent->removePropertyChangeListener( ::rtl::OUString(), _rxListener ); - } - catch( const UnknownPropertyException& ) - { - OSL_FAIL( "GenericPropertyHandler::removePropertyChangeListener:\nThe inspected component does not allow de-registering for all properties at once! This violates the interface contract!" ); - } - } - m_aPropertyListeners.removeInterface( _rxListener ); - } - - //-------------------------------------------------------------------- - void GenericPropertyHandler::impl_ensurePropertyMap() - { - if ( !m_bPropertyMapInitialized ) - { - m_bPropertyMapInitialized = true; - try - { - Reference< XPropertySetInfo > xPSI; - if ( m_xComponent.is() ) - xPSI = m_xComponent->getPropertySetInfo(); - Sequence< Property > aProperties; - if ( xPSI.is() ) - aProperties = xPSI->getProperties(); - DBG_ASSERT( aProperties.getLength(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); - - for ( const Property* pProperties = aProperties.getConstArray(); - pProperties != aProperties.getConstArray() + aProperties.getLength(); - ++pProperties - ) - { - switch ( pProperties->Type.getTypeClass() ) - { - case TypeClass_BOOLEAN: - case TypeClass_BYTE: - case TypeClass_SHORT: - case TypeClass_UNSIGNED_SHORT: - case TypeClass_LONG: - case TypeClass_UNSIGNED_LONG: - case TypeClass_HYPER: - case TypeClass_UNSIGNED_HYPER: - case TypeClass_FLOAT: - case TypeClass_DOUBLE: - case TypeClass_ENUM: - case TypeClass_STRING: - // allowed, we can handle this type - break; - - case TypeClass_SEQUENCE: - { - TypeClass eElementTypeClass = ::comphelper::getSequenceElementType( pProperties->Type ).getTypeClass(); - if ( ( eElementTypeClass != TypeClass_STRING ) - && ( eElementTypeClass != TypeClass_BYTE ) - && ( eElementTypeClass != TypeClass_SHORT ) - && ( eElementTypeClass != TypeClass_UNSIGNED_SHORT ) - && ( eElementTypeClass != TypeClass_LONG ) - && ( eElementTypeClass != TypeClass_UNSIGNED_LONG ) - ) - // can only handle the above - continue; - } - break; - - default: - // next property, we don't support this type - continue; - } - - m_aProperties.insert( PropertyMap::value_type( pProperties->Name, *pProperties ) ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "GenericPropertyHandler::impl_ensurePropertyMap: caught an exception!" ); - } - } - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL GenericPropertyHandler::getSupportedProperties() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap(); - - Sequence< Property > aReturn( m_aProperties.size() ); - ::std::transform( m_aProperties.begin(), m_aProperties.end(), - aReturn.getArray(), ::o3tl::select2nd< PropertyMap::value_type >() ); - return aReturn; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - // no superseded properties at all. This handler offers the very basic PropertyHandler - // functionality, so it's much more likely that other handlers want to supersede - // *our* properties .... - return Sequence< ::rtl::OUString >( ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL GenericPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - // This basic PropertyHandler implementation is too dumb^Wgeneric to know - // anything about property dependencies - return Sequence< ::rtl::OUString >( ); - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL GenericPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - const_cast< GenericPropertyHandler* >( this )->impl_ensurePropertyMap(); - - PropertyMap::const_iterator pos = m_aProperties.find( _rPropertyName ); - if ( pos == m_aProperties.end() ) - throw UnknownPropertyException(); - - LineDescriptor aDescriptor; - aDescriptor.DisplayName = _rPropertyName; - switch ( pos->second.Type.getTypeClass() ) - { - case TypeClass_ENUM: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, - impl_getEnumConverter( pos->second.Type )->getDescriptions(), - PropertyHandlerHelper::requiresReadOnlyControl( pos->second.Attributes ), - sal_False ); - break; - case TypeClass_STRING: - { - // some special handling for URL properties - bool bIsURLProperty = ( _rPropertyName.getLength() >= 3 ) && _rPropertyName.matchAsciiL( "URL", 3, _rPropertyName.getLength() - 3 ); - if ( bIsURLProperty ) - { - aDescriptor.Control = _rxControlFactory->createPropertyControl( - PropertyControlType::HyperlinkField, PropertyHandlerHelper::requiresReadOnlyControl( pos->second.Attributes ) ); - - Reference< XHyperlinkControl > xControl( aDescriptor.Control, UNO_QUERY_THROW ); - Reference< XActionListener > xEnsureDelete( new UrlClickHandler( m_aContext, xControl ) ); - } - } - break; - default: - break; - } - // fallback - if ( !aDescriptor.Control.is() ) - PropertyHandlerHelper::describePropertyLine( pos->second, aDescriptor, _rxControlFactory ); - - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) ); - return aDescriptor; - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL GenericPropertyHandler::isComposable( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) - { - return sal_False; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL GenericPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& /*_rPropertyName*/, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/ ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - OSL_FAIL( "GenericPropertyHandler::onInteractivePropertySelection: I'm too dumb to know anything about property browse buttons!" ); - return InteractiveSelectionResult_Cancelled; - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) - { - OSL_FAIL( "GenericPropertyHandler::actuatingPropertyChanged: no no no, I did not register for any actuating properties!" ); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL GenericPropertyHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException) - { - return sal_True; - } - - //-------------------------------------------------------------------- - void SAL_CALL GenericPropertyHandler::disposing() - { - m_aPropertyListeners.clear(); - // not disposeAndClear: the listeners are (virtually) listeners at our introspectee, not - // at this handler instance - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XCOMPONENT( GenericPropertyHandler, GenericPropertyHandler_Base ); - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx deleted file mode 100644 index 4d5fc7a1e..000000000 --- a/extensions/source/propctrlr/genericpropertyhandler.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX - -#include "propertyhandler.hxx" -#include "pcrcommontypes.hxx" -#include "pcrcommon.hxx" -#include "pcrcomponentcontext.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - struct TypeLess : ::std::binary_function< ::com::sun::star::uno::Type, ::com::sun::star::uno::Type, bool > - { - bool operator()( const ::com::sun::star::uno::Type& _rLHS, const ::com::sun::star::uno::Type& _rRHS ) const - { - return _rLHS.getTypeName() < _rRHS.getTypeName(); - } - }; - - class IPropertyInfoService; - class IPropertyEnumRepresentation; - //==================================================================== - //= GenericPropertyHandler - //==================================================================== - typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler - , ::com::sun::star::lang::XServiceInfo - > GenericPropertyHandler_Base; - class GenericPropertyHandler : public GenericPropertyHandler_Base - { - private: - mutable ::osl::Mutex m_aMutex; - - private: - /// the service factory for creating services - ComponentContext m_aContext; - /// need this to keep alive as long as m_xComponent lives - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > m_xComponentIntrospectionAccess; - /// the properties of the object we're handling - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xComponent; - /// cached interface of ->m_xComponent - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > m_xPropertyState; - /// type converter, needed on various occasions - ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter; - /// cache of our supported properties - PropertyMap m_aProperties; - /// property change listeners - ::cppu::OInterfaceContainerHelper m_aPropertyListeners; - ::std::map< ::com::sun::star::uno::Type, ::rtl::Reference< IPropertyEnumRepresentation >, TypeLess > - m_aEnumConverters; - - /// has ->m_aProperties been initialized? - bool m_bPropertyMapInitialized : 1; - - public: - // XServiceInfo - static versions - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - protected: - GenericPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - ~GenericPropertyHandler(); - - protected: - // XPropertyHandler overridables - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - DECLARE_XCOMPONENT() - virtual void SAL_CALL disposing(); - - // 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); - - private: - /** ensures that ->m_aProperties is initialized - @precond - our mutex is locked - */ - void impl_ensurePropertyMap(); - - /** retrieves the enum converter for the given ENUM type - */ - ::rtl::Reference< IPropertyEnumRepresentation > - impl_getEnumConverter( const ::com::sun::star::uno::Type& _rEnumType ); - - private: - GenericPropertyHandler(); // never implemented - GenericPropertyHandler( const GenericPropertyHandler& ); // never implemented - GenericPropertyHandler& operator=( const GenericPropertyHandler& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_GENERICPROPERTYHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx deleted file mode 100644 index 5ce232e8a..000000000 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ /dev/null @@ -1,290 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "handlerhelper.hxx" -#include "propresid.hrc" -#include "formresid.hrc" -#include -#include "modulepcr.hxx" -#include "enumrepresentation.hxx" -#include "formmetadata.hxx" -#include "pcrcomponentcontext.hxx" - -/** === begin UNO includes === **/ -#include "com/sun/star/inspection/StringRepresentation.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= PropertyHandlerHelper - //==================================================================== - //-------------------------------------------------------------------- - void PropertyHandlerHelper::describePropertyLine( const Property& _rProperty, - LineDescriptor& /* [out] */ _out_rDescriptor, const Reference< XPropertyControlFactory >& _rxControlFactory ) - { - // display the pure property name - no L10N - _out_rDescriptor.DisplayName = _rProperty.Name; - - OSL_PRECOND( _rxControlFactory.is(), "PropertyHandlerHelper::describePropertyLine: no factory -> no control!" ); - if ( !_rxControlFactory.is() ) - return; - - sal_Bool bReadOnlyControl = requiresReadOnlyControl( _rProperty.Attributes ); - - // special handling for booleans (this will become a list) - if ( _rProperty.Type.getTypeClass() == TypeClass_BOOLEAN ) - { - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries); - _out_rDescriptor.Control = createListBoxControl( _rxControlFactory, aListEntries, bReadOnlyControl, sal_False ); - return; - } - - sal_Int16 nControlType = PropertyControlType::TextField; - switch ( _rProperty.Type.getTypeClass() ) - { - case TypeClass_BYTE: - case TypeClass_SHORT: - case TypeClass_UNSIGNED_SHORT: - case TypeClass_LONG: - case TypeClass_UNSIGNED_LONG: - case TypeClass_HYPER: - case TypeClass_UNSIGNED_HYPER: - case TypeClass_FLOAT: - case TypeClass_DOUBLE: - nControlType = PropertyControlType::NumericField; - break; - - case TypeClass_SEQUENCE: - nControlType = PropertyControlType::StringListField; - break; - - default: - OSL_FAIL( "PropertyHandlerHelper::describePropertyLine: don't know how to represent this at the UI!" ); - // NO break! - - case TypeClass_STRING: - nControlType = PropertyControlType::TextField; - break; - } - - // create a control - _out_rDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, bReadOnlyControl ); - } - - //-------------------------------------------------------------------- - namespace - { - Reference< XPropertyControl > lcl_implCreateListLikeControl( - const Reference< XPropertyControlFactory >& _rxControlFactory, - const ::std::vector< ::rtl::OUString >& _rInitialListEntries, - sal_Bool _bReadOnlyControl, - sal_Bool _bSorted, - sal_Bool _bTrueIfListBoxFalseIfComboBox - ) - { - Reference< XStringListControl > xListControl( - _rxControlFactory->createPropertyControl( - _bTrueIfListBoxFalseIfComboBox ? PropertyControlType::ListBox : PropertyControlType::ComboBox, _bReadOnlyControl - ), - UNO_QUERY_THROW - ); - - ::std::vector< ::rtl::OUString > aInitialEntries( _rInitialListEntries ); - if ( _bSorted ) - ::std::sort( aInitialEntries.begin(), aInitialEntries.end() ); - - for ( ::std::vector< ::rtl::OUString >::const_iterator loop = aInitialEntries.begin(); - loop != aInitialEntries.end(); - ++loop - ) - xListControl->appendListEntry( *loop ); - return xListControl.get(); - } - } - - //-------------------------------------------------------------------- - Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const ::std::vector< ::rtl::OUString >& _rInitialListEntries, sal_Bool _bReadOnlyControl, sal_Bool _bSorted ) - { - return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, sal_True ); - } - - //-------------------------------------------------------------------- - Reference< XPropertyControl > PropertyHandlerHelper::createComboBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - const ::std::vector< ::rtl::OUString >& _rInitialListEntries, sal_Bool _bReadOnlyControl, sal_Bool _bSorted ) - { - return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, sal_False ); - } - - //-------------------------------------------------------------------- - Reference< XPropertyControl > PropertyHandlerHelper::createNumericControl( const Reference< XPropertyControlFactory >& _rxControlFactory, - sal_Int16 _nDigits, const Optional< double >& _rMinValue, const Optional< double >& _rMaxValue, sal_Bool _bReadOnlyControl ) - { - Reference< XNumericControl > xNumericControl( - _rxControlFactory->createPropertyControl( PropertyControlType::NumericField, _bReadOnlyControl ), - UNO_QUERY_THROW - ); - - xNumericControl->setDecimalDigits( _nDigits ); - xNumericControl->setMinValue( _rMinValue ); - xNumericControl->setMaxValue( _rMaxValue ); - - return xNumericControl.get(); - } - - //-------------------------------------------------------------------- - Any PropertyHandlerHelper::convertToPropertyValue( const Reference< XComponentContext >& _rxContext,const Reference< XTypeConverter >& _rxTypeConverter, - const Property& _rProperty, const Any& _rControlValue ) - { - Any aPropertyValue( _rControlValue ); - if ( !aPropertyValue.hasValue() ) - // NULL is converted to NULL - return aPropertyValue; - - if ( aPropertyValue.getValueType().equals( _rProperty.Type ) ) - // nothing to do, type is already as desired - return aPropertyValue; - - if ( _rControlValue.getValueType().getTypeClass() == TypeClass_STRING ) - { - ::rtl::OUString sControlValue; - _rControlValue >>= sControlValue; - - Reference< XStringRepresentation > xConversionHelper = StringRepresentation::create( _rxContext,_rxTypeConverter ); - aPropertyValue = xConversionHelper->convertToPropertyValue( sControlValue, _rProperty.Type ); - } - else - { - try - { - if ( _rxTypeConverter.is() ) - aPropertyValue = _rxTypeConverter->convertTo( _rControlValue, _rProperty.Type ); - } - catch( const Exception& ) - { - OSL_FAIL( "PropertyHandlerHelper::convertToPropertyValue: caught an exception while converting via TypeConverter!" ); - } - } - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any PropertyHandlerHelper::convertToControlValue( const Reference< XComponentContext >& _rxContext,const Reference< XTypeConverter >& _rxTypeConverter, - const Any& _rPropertyValue, const Type& _rControlValueType ) - { - Any aControlValue( _rPropertyValue ); - if ( !aControlValue.hasValue() ) - // NULL is converted to NULL - return aControlValue; - - if ( _rControlValueType.getTypeClass() == TypeClass_STRING ) - { - Reference< XStringRepresentation > xConversionHelper = StringRepresentation::create( _rxContext,_rxTypeConverter ); - aControlValue <<= xConversionHelper->convertToControlValue( _rPropertyValue ); - } - else - { - try - { - if ( _rxTypeConverter.is() ) - aControlValue = _rxTypeConverter->convertTo( _rPropertyValue, _rControlValueType ); - } - catch( const Exception& ) - { - OSL_FAIL( "PropertyHandlerHelper::convertToControlValue: caught an exception while converting via TypeConverter!" ); - } - } - - return aControlValue; - } - - //-------------------------------------------------------------------- - void PropertyHandlerHelper::setContextDocumentModified( const ComponentContext& _rContext ) - { - try - { - Reference< XModifiable > xDocumentModifiable( _rContext.getContextValueByAsciiName( "ContextDocument" ), UNO_QUERY_THROW ); - xDocumentModifiable->setModified( sal_True ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - Window* PropertyHandlerHelper::getDialogParentWindow( const ComponentContext& _rContext ) - { - Window* pInspectorWindow = NULL; - try - { - Reference< XWindow > xInspectorWindow( _rContext.getContextValueByAsciiName( "DialogParentWindow" ), UNO_QUERY_THROW ); - pInspectorWindow = VCLUnoHelper::GetWindow( xInspectorWindow ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return pInspectorWindow; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx deleted file mode 100644 index 1505997e8..000000000 --- a/extensions/source/propctrlr/handlerhelper.hxx +++ /dev/null @@ -1,219 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -class Window; -namespace com { namespace sun { namespace star { - namespace inspection { - struct LineDescriptor; - } -} } } -//........................................................................ -namespace pcr -{ -//........................................................................ - - class ComponentContext; - - //==================================================================== - //= PropertyHandlerHelper - //==================================================================== - class PropertyHandlerHelper - { - public: - /** helper for implementing XPropertyHandler::describePropertyLine in a generic way - */ - static void describePropertyLine( - const ::com::sun::star::beans::Property& _rProperty, - ::com::sun::star::inspection::LineDescriptor& /* [out] */ _out_rDescriptor, - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory - ); - - /** helper for implementing XPropertyHandler::convertToPropertyValue - */ - static ::com::sun::star::uno::Any convertToPropertyValue( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter, - const ::com::sun::star::beans::Property& _rProperty, - const ::com::sun::star::uno::Any& _rControlValue - ); - - /// helper for implementing XPropertyHandler::convertToControlValue - static ::com::sun::star::uno::Any convertToControlValue( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter, - const ::com::sun::star::uno::Any& _rPropertyValue, - const ::com::sun::star::uno::Type& _rControlValueType - ); - - /** creates an PropertyControlType::ListBox-type control - and fills it with initial values - - @param _rxControlFactory - A control factory. Must not be . - - @param _rInitialListEntries - the initial values of the control - - @param _bReadOnlyControl - determines whether the control should be read-only - - @param _bSorted - determines whether the list entries should be sorted - - @return - the newly created control - */ - static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - createListBoxControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory, - const ::std::vector< ::rtl::OUString >& _rInitialListEntries, - sal_Bool _bReadOnlyControl, - sal_Bool _bSorted - ); - - /** creates an PropertyControlType::ComboBox-type control - and fills it with initial values - - @param _rxControlFactory - A control factory. Must not be . - - @param _rInitialListEntries - the initial values of the control - - @param _bReadOnlyControl - determines whether the control should be read-only - - @param _bSorted - determines whether the list entries should be sorted - - @return - the newly created control - */ - static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - createComboBoxControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory, - const ::std::vector< ::rtl::OUString >& _rInitialListEntries, - sal_Bool _bReadOnlyControl, - sal_Bool _bSorted - ); - - /** creates an PropertyControlType::NumericField-type control - and initializes it - - @param _rxControlFactory - A control factory. Must not be . - @param _nDigits - number of decimal digits for the control - (XNumericControl::DecimalDigits) - @param _rMinValue - minimum value which can be entered in the control - (XNumericControl::MinValue) - @param _rMaxValue - maximum value which can be entered in the control - (XNumericControl::MaxValue) - @param _bReadOnlyControl - determines whether the control should be read-only - - @return - the newly created control - */ - static ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - createNumericControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory, - sal_Int16 _nDigits, - const ::com::sun::star::beans::Optional< double >& _rMinValue, - const ::com::sun::star::beans::Optional< double >& _rMaxValue, - sal_Bool _bReadOnlyControl - ); - - /** marks the document passed in our UNO context as modified - - The method looks up a value called "ContextDocument" in the given UNO component context, - queries it for the ->com::sun::star::util::XModifiable interface, and calls its - setModified method. If either of those steps fails, this is asserted in a non-product - version, and silently ignore otherwise. - - @param _rContext - the component context which was used to create the component calling this method - */ - static void setContextDocumentModified( - const ComponentContext& _rContext - ); - - /** gets the window of the ObjectInspector in which an property handler lives - - The method looks up a value called "DialogParentWindow" in the given UNO copmonent context, - queries it for XWindow, and returns the respective Window*. If either of those steps fails, - this is asserted in a non-product version, and silently ignore otherwise. - - @param _rContext - the component context which was used to create the component calling this method - */ - static Window* getDialogParentWindow( const ComponentContext& _rContext ); - - - /** determines whether given PropertyAttributes require a to-be-created - XPropertyControl to be read-only - - @param _nPropertyAttributes - the attributes of the property which should be reflected by a to-be-created - XPropertyControl - */ - inline static sal_Bool requiresReadOnlyControl( sal_Int16 _nPropertyAttributes ) - { - return ( _nPropertyAttributes & ::com::sun::star::beans::PropertyAttribute::READONLY ) != 0; - } - - private: - PropertyHandlerHelper(); // never implemented - PropertyHandlerHelper( const PropertyHandlerHelper& ); // never implemented - PropertyHandlerHelper& operator=( const PropertyHandlerHelper& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_HANDLERHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectorhelpwindow.cxx b/extensions/source/propctrlr/inspectorhelpwindow.cxx deleted file mode 100644 index 3ec26deae..000000000 --- a/extensions/source/propctrlr/inspectorhelpwindow.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "inspectorhelpwindow.hxx" -#include "modulepcr.hxx" -#include "propresid.hrc" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - /** === end UNO using === **/ - - //==================================================================== - //= InspectorHelpWindow - //==================================================================== - //-------------------------------------------------------------------- - InspectorHelpWindow::InspectorHelpWindow( Window* _pParent ) - :Window( _pParent, WB_DIALOGCONTROL ) - ,m_aSeparator( this ) - ,m_aHelpText( this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL ) - ,m_nMinLines( 3 ) - ,m_nMaxLines( 8 ) - { - SetBackground(); - SetPaintTransparent(sal_True); - m_aSeparator.SetText( String( PcrRes( RID_STR_HELP_SECTION_LABEL ) ) ); - m_aSeparator.SetBackground(); - m_aSeparator.Show(); - - m_aHelpText.SetControlBackground( /*m_aSeparator.GetBackground().GetColor() */); - m_aHelpText.SetBackground(); - m_aHelpText.SetPaintTransparent(sal_True); - m_aHelpText.Show(); - } - - //-------------------------------------------------------------------- - void InspectorHelpWindow::SetText( const XubString& _rStr ) - { - m_aHelpText.SetText( _rStr ); - } - - //-------------------------------------------------------------------- - void InspectorHelpWindow::SetLimits( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ) - { - m_nMinLines = _nMinLines; - m_nMaxLines = _nMaxLines; - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::impl_getHelpTextBorderHeight() - { - sal_Int32 nTop(0), nBottom(0), nDummy(0); - m_aHelpText.GetBorder( nDummy, nTop, nDummy, nBottom ); - return nTop + nBottom; - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::impl_getSpaceAboveTextWindow() - { - Size aSeparatorSize( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ) ); - Size a3AppFontSize( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); - return aSeparatorSize.Height() + a3AppFontSize.Height(); - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::GetMinimalHeightPixel() - { - return impl_getMinimalTextWindowHeight() + impl_getSpaceAboveTextWindow(); - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::impl_getMinimalTextWindowHeight() - { - return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMinLines; - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::impl_getMaximalTextWindowHeight() - { - return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMaxLines; - } - - //-------------------------------------------------------------------- - long InspectorHelpWindow::GetOptimalHeightPixel() - { - // --- calc the height as needed for the mere text window - long nMinTextWindowHeight = impl_getMinimalTextWindowHeight(); - long nMaxTextWindowHeight = impl_getMaximalTextWindowHeight(); - - Rectangle aTextRect( Point( 0, 0 ), m_aHelpText.GetOutputSizePixel() ); - aTextRect = m_aHelpText.GetTextRect( aTextRect, m_aHelpText.GetText(), - TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - long nActTextWindowHeight = impl_getHelpTextBorderHeight() + aTextRect.GetHeight(); - - long nOptTextWindowHeight = ::std::max( nMinTextWindowHeight, ::std::min( nMaxTextWindowHeight, nActTextWindowHeight ) ); - - // --- then add the space above the text window - return nOptTextWindowHeight + impl_getSpaceAboveTextWindow(); - } - - //-------------------------------------------------------------------- - void InspectorHelpWindow::Resize() - { - Size a3AppFont( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); - - Rectangle aPlayground( Point( 0, 0 ), GetOutputSizePixel() ); - - Rectangle aSeparatorArea( aPlayground ); - aSeparatorArea.Bottom() = aSeparatorArea.Top() + LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height(); - m_aSeparator.SetPosSizePixel( aSeparatorArea.TopLeft(), aSeparatorArea.GetSize() ); - - Rectangle aTextArea( aPlayground ); - aTextArea.Top() = aSeparatorArea.Bottom() + a3AppFont.Height(); - m_aHelpText.SetPosSizePixel( aTextArea.TopLeft(), aTextArea.GetSize() ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx deleted file mode 100644 index bae38265a..000000000 --- a/extensions/source/propctrlr/inspectorhelpwindow.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef INSPECTORHELPWINDOW_HXX -#define INSPECTORHELPWINDOW_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= InspectorHelpWindow - //==================================================================== - class InspectorHelpWindow : public Window - { - private: - FixedLine m_aSeparator; - MultiLineEdit m_aHelpText; - - sal_Int32 m_nMinLines; - sal_Int32 m_nMaxLines; - - public: - InspectorHelpWindow( Window* _pParent ); - - virtual void SetText( const XubString& rStr ); - - void SetLimits( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ); - long GetMinimalHeightPixel(); - long GetOptimalHeightPixel(); - - protected: - // Window overridables - virtual void Resize(); - - private: - long impl_getMinimalTextWindowHeight(); - long impl_getMaximalTextWindowHeight(); - long impl_getHelpTextBorderHeight(); - long impl_getSpaceAboveTextWindow(); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // HELPWINDOW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectormodelbase.cxx b/extensions/source/propctrlr/inspectormodelbase.cxx deleted file mode 100644 index 3402d28a4..000000000 --- a/extensions/source/propctrlr/inspectormodelbase.cxx +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "inspectormodelbase.hxx" -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - -#define MODEL_PROPERTY_ID_HAS_HELP_SECTION 2000 -#define MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES 2001 -#define MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES 2002 -#define MODEL_PROPERTY_ID_IS_READ_ONLY 2003 - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::inspection::PropertyCategoryDescriptor; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::beans::Property; - /** === end UNO using === **/ - namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; - - //==================================================================== - //= InspectorModelProperties - //==================================================================== - /** helper class for implementing the property set related functionality - of an ImplInspectorModel - */ - class InspectorModelProperties : public ::comphelper::OPropertyContainerHelper - { - private: - ::osl::Mutex& m_rMutex; - sal_Bool m_bHasHelpSection; - sal_Int32 m_nMinHelpTextLines; - sal_Int32 m_nMaxHelpTextLines; - sal_Bool m_bIsReadOnly; - ::std::auto_ptr< ::cppu::IPropertyArrayHelper > - m_pPropertyInfo; - - public: - InspectorModelProperties( ::osl::Mutex& _rMutex ); - - using ::comphelper::OPropertyContainerHelper::convertFastPropertyValue; - using ::comphelper::OPropertyContainerHelper::setFastPropertyValue; - using ::comphelper::OPropertyContainerHelper::getFastPropertyValue; - - public: - inline sal_Bool hasHelpSection() const { return m_bHasHelpSection; } - inline sal_Bool isReadOnly() const { return m_bIsReadOnly; } - inline sal_Int32 getMinHelpTextLines() const { return m_nMinHelpTextLines; } - inline sal_Int32 getMaxHelpTextLines() const { return m_nMaxHelpTextLines; } - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > - getPropertySetInfo(); - ::cppu::IPropertyArrayHelper& - getInfoHelper(); - - void constructWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); - }; - - //==================================================================== - //= InspectorModelProperties - //==================================================================== - //-------------------------------------------------------------------- - InspectorModelProperties::InspectorModelProperties( ::osl::Mutex& _rMutex ) - :m_rMutex( _rMutex ) - ,m_bHasHelpSection( sal_False ) - ,m_nMinHelpTextLines( 3 ) - ,m_nMaxHelpTextLines( 8 ) - ,m_bIsReadOnly( sal_False ) - { - registerProperty( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasHelpSection" ) ), - MODEL_PROPERTY_ID_HAS_HELP_SECTION, - PropertyAttribute::READONLY, - &m_bHasHelpSection, ::getCppuType( &m_bHasHelpSection ) - ); - registerProperty( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MinHelpTextLines" ) ), - MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES, - PropertyAttribute::READONLY, - &m_nMinHelpTextLines, ::getCppuType( &m_nMinHelpTextLines ) - ); - registerProperty( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxHelpTextLines" ) ), - MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES, - PropertyAttribute::READONLY, - &m_nMaxHelpTextLines, ::getCppuType( &m_nMaxHelpTextLines ) - ); - registerProperty( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ), - MODEL_PROPERTY_ID_IS_READ_ONLY, - PropertyAttribute::BOUND, - &m_bIsReadOnly, ::getCppuType( &m_bIsReadOnly ) - ); - } - - //-------------------------------------------------------------------- - void InspectorModelProperties::constructWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) - { - m_bHasHelpSection = sal_True; - m_nMinHelpTextLines = _nMinHelpTextLines; - m_nMaxHelpTextLines = _nMaxHelpTextLines; - // no need to notify this, those properties are not bound. Also, the method should - // only be used during construction phase, where we don't expect to have any listeners. - } - - //-------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& InspectorModelProperties::getInfoHelper() - { - ::osl::MutexGuard aGuard( m_rMutex ); - if ( m_pPropertyInfo.get() == NULL ) - { - Sequence< Property > aProperties; - describeProperties( aProperties ); - - m_pPropertyInfo.reset( new ::cppu::OPropertyArrayHelper( aProperties ) ); - } - return *m_pPropertyInfo; - } - - //-------------------------------------------------------------------- - Reference< XPropertySetInfo > InspectorModelProperties::getPropertySetInfo() - { - return ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); - } - - //==================================================================== - //= ImplInspectorModel - //==================================================================== - ImplInspectorModel::ImplInspectorModel( const Reference< XComponentContext >& _rxContext ) - :ImplInspectorModel_PBase( GetBroadcastHelper() ) - ,m_aContext( _rxContext ) - ,m_pProperties( new InspectorModelProperties( m_aMutex ) ) - { - } - - //-------------------------------------------------------------------- - ImplInspectorModel::~ImplInspectorModel() - { - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( ImplInspectorModel, ImplInspectorModel_Base, ImplInspectorModel_PBase ) - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( ImplInspectorModel, ImplInspectorModel_Base, ImplInspectorModel_PBase ) - - //-------------------------------------------------------------------- - Reference< XPropertySetInfo > SAL_CALL ImplInspectorModel::getPropertySetInfo( ) throw (RuntimeException) - { - return m_pProperties->getPropertySetInfo(); - } - - //-------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& SAL_CALL ImplInspectorModel::getInfoHelper() - { - return m_pProperties->getInfoHelper(); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL ImplInspectorModel::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) throw (IllegalArgumentException) - { - return m_pProperties->convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ImplInspectorModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) - { - m_pProperties->setFastPropertyValue( nHandle, rValue ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ImplInspectorModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const - { - m_pProperties->getFastPropertyValue( rValue, nHandle ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ImplInspectorModel::getHasHelpSection() throw (RuntimeException) - { - return m_pProperties->hasHelpSection(); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL ImplInspectorModel::getMinHelpTextLines() throw (RuntimeException) - { - return m_pProperties->getMinHelpTextLines(); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL ImplInspectorModel::getMaxHelpTextLines() throw (RuntimeException) - { - return m_pProperties->getMaxHelpTextLines(); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ImplInspectorModel::getIsReadOnly() throw (::com::sun::star::uno::RuntimeException) - { - return m_pProperties->isReadOnly(); - } - - //-------------------------------------------------------------------- - void SAL_CALL ImplInspectorModel::setIsReadOnly( ::sal_Bool _IsReadOnly ) throw (::com::sun::star::uno::RuntimeException) - { - setFastPropertyValue( MODEL_PROPERTY_ID_IS_READ_ONLY, makeAny( _IsReadOnly ) ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL ImplInspectorModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) - { - StlSyntaxSequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator check = aSupported.begin(); - check != aSupported.end(); - ++check - ) - if ( check->equals( ServiceName ) ) - return sal_True; - - return sal_False; - } - - //-------------------------------------------------------------------- - void ImplInspectorModel::enableHelpSectionProperties( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) - { - m_pProperties->constructWithHelpSection( _nMinHelpTextLines, _nMaxHelpTextLines ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/inspectormodelbase.hxx b/extensions/source/propctrlr/inspectormodelbase.hxx deleted file mode 100644 index 3c79dfe2d..000000000 --- a/extensions/source/propctrlr/inspectormodelbase.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INSPECTORMODELBASE_HXX -#define INSPECTORMODELBASE_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include - -#include -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class InspectorModelProperties; - //==================================================================== - //= ImplInspectorModel - //==================================================================== - typedef ::cppu::WeakImplHelper3 < ::com::sun::star::inspection::XObjectInspectorModel - , ::com::sun::star::lang::XInitialization - , ::com::sun::star::lang::XServiceInfo - > ImplInspectorModel_Base; - typedef ::cppu::OPropertySetHelper ImplInspectorModel_PBase; - - class ImplInspectorModel - :public ::comphelper::OMutexAndBroadcastHelper - ,public ImplInspectorModel_Base - ,public ImplInspectorModel_PBase - { - protected: - ::comphelper::ComponentContext m_aContext; - ::std::auto_ptr< InspectorModelProperties > m_pProperties; - - protected: - ~ImplInspectorModel(); - - public: - ImplInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - DECLARE_XINTERFACE() - DECLARE_XTYPEPROVIDER() - - // ::com::sun::star::beans::XPropertySet and friends - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - 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); - virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - - // ::com::sun::star::inspection::XObjectInspectorModel - virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setIsReadOnly( ::sal_Bool _IsReadOnly ) throw (::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XServiceInfo - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - - protected: - void enableHelpSectionProperties( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); - - private: - using ImplInspectorModel_PBase::getFastPropertyValue; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // INSPECTORMODELBASE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/linedescriptor.hxx b/extensions/source/propctrlr/linedescriptor.hxx deleted file mode 100644 index 84d11e17f..000000000 --- a/extensions/source/propctrlr/linedescriptor.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EXTENSIONS_PROPCTRLR_LINEDESCRIPTOR_HXX_ -#define _EXTENSIONS_PROPCTRLR_LINEDESCRIPTOR_HXX_ - -#include -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= OLineDescriptor - //======================================================================== - struct OLineDescriptor : public ::com::sun::star::inspection::LineDescriptor - { - ::rtl::OUString sName; // the name of the property - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > - xPropertyHandler; // the handler for this property - ::com::sun::star::uno::Any aValue; // the current value of the property - - bool bUnknownValue : 1; // is the property value currently "unknown"? (PropertyState_AMBIGUOUS) - bool bReadOnly : 1; - - OLineDescriptor() - :bUnknownValue( false ) - ,bReadOnly( false ) - { - } - - void assignFrom( const ::com::sun::star::inspection::LineDescriptor& _rhs ) - { - ::com::sun::star::inspection::LineDescriptor::operator=( _rhs ); - } - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_LINEDESCRIPTOR_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/listselectiondlg.cxx b/extensions/source/propctrlr/listselectiondlg.cxx deleted file mode 100644 index e67279a08..000000000 --- a/extensions/source/propctrlr/listselectiondlg.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "listselectiondlg.hxx" -#include "listselectiondlg.hrc" - -#include "modulepcr.hxx" -#include "formresid.hrc" -#include "formstrings.hxx" -#include - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - - //==================================================================== - //= ListSelectionDialog - //==================================================================== - //-------------------------------------------------------------------- - ListSelectionDialog::ListSelectionDialog( Window* _pParent, const Reference< XPropertySet >& _rxListBox, - const ::rtl::OUString& _rPropertyName, const String& _rPropertyUIName ) - :ModalDialog( _pParent, PcrRes( RID_DLG_SELECTION ) ) - ,m_aLabel ( this, PcrRes( FT_ENTRIES ) ) - ,m_aEntries ( this, PcrRes( LB_ENTRIES ) ) - ,m_aOK ( this, PcrRes( PB_OK ) ) - ,m_aCancel ( this, PcrRes( PB_CANCEL ) ) - ,m_aHelp ( this, PcrRes( PB_HELP ) ) - ,m_xListBox ( _rxListBox ) - ,m_sPropertyName( _rPropertyName ) - { - FreeResource(); - - OSL_PRECOND( m_xListBox.is(), "ListSelectionDialog::ListSelectionDialog: invalid list box!" ); - - SetText( _rPropertyUIName ); - m_aLabel.SetText( _rPropertyUIName ); - - initialize( ); - } - - //------------------------------------------------------------------------ - short ListSelectionDialog::Execute() - { - short nResult = ModalDialog::Execute(); - - if ( RET_OK == nResult ) - commitSelection(); - - return nResult; - } - - //-------------------------------------------------------------------- - void ListSelectionDialog::initialize( ) - { - if ( !m_xListBox.is() ) - return; - - m_aEntries.SetStyle( GetStyle() | WB_SIMPLEMODE ); - - try - { - // initialize the multi-selection flag - sal_Bool bMultiSelection = sal_False; - OSL_VERIFY( m_xListBox->getPropertyValue( PROPERTY_MULTISELECTION ) >>= bMultiSelection ); - m_aEntries.EnableMultiSelection( bMultiSelection ); - - // fill the list box with all entries - Sequence< ::rtl::OUString > aListEntries; - OSL_VERIFY( m_xListBox->getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aListEntries ); - fillEntryList( aListEntries ); - - // select entries according to the property - Sequence< sal_Int16 > aSelection; - OSL_VERIFY( m_xListBox->getPropertyValue( m_sPropertyName ) >>= aSelection ); - selectEntries( aSelection ); - } - catch( const Exception& ) - { - OSL_FAIL( "ListSelectionDialog::initialize: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void ListSelectionDialog::commitSelection() - { - if ( !m_xListBox.is() ) - return; - - Sequence< sal_Int16 > aSelection; - collectSelection( aSelection ); - - try - { - m_xListBox->setPropertyValue( m_sPropertyName, makeAny( aSelection ) ); - } - catch( const Exception& ) - { - OSL_FAIL( "ListSelectionDialog::commitSelection: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void ListSelectionDialog::fillEntryList( const Sequence< ::rtl::OUString >& _rListEntries ) - { - m_aEntries.Clear(); - const ::rtl::OUString* _pListEntries = _rListEntries.getConstArray(); - const ::rtl::OUString* _pListEntriesEnd = _rListEntries.getConstArray() + _rListEntries.getLength(); - for ( ; _pListEntries < _pListEntriesEnd; ++_pListEntries ) - m_aEntries.InsertEntry( *_pListEntries ); - } - - //-------------------------------------------------------------------- - void ListSelectionDialog::collectSelection( Sequence< sal_Int16 >& /* [out] */ _rSelection ) - { - sal_uInt16 nSelectedCount = m_aEntries.GetSelectEntryCount( ); - _rSelection.realloc( nSelectedCount ); - sal_Int16* pSelection = _rSelection.getArray(); - for ( sal_uInt16 selected = 0; selected < nSelectedCount; ++selected, ++pSelection ) - *pSelection = static_cast< sal_Int16 >( m_aEntries.GetSelectEntryPos( selected ) ); - } - - //-------------------------------------------------------------------- - void ListSelectionDialog::selectEntries( const Sequence< sal_Int16 >& /* [in ] */ _rSelection ) - { - m_aEntries.SetNoSelection(); - const sal_Int16* pSelection = _rSelection.getConstArray(); - const sal_Int16* pSelectionEnd = _rSelection.getConstArray() + _rSelection.getLength(); - for ( ; pSelection != pSelectionEnd; ++pSelection ) - m_aEntries.SelectEntryPos( *pSelection ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/listselectiondlg.hrc b/extensions/source/propctrlr/listselectiondlg.hrc deleted file mode 100644 index 6419f5303..000000000 --- a/extensions/source/propctrlr/listselectiondlg.hrc +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HRC -#define EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HRC - -#define FT_ENTRIES 1 - -#define LB_ENTRIES 1 - -#define PB_OK 1 -#define PB_CANCEL 2 -#define PB_HELP 3 - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HRC diff --git a/extensions/source/propctrlr/listselectiondlg.hxx b/extensions/source/propctrlr/listselectiondlg.hxx deleted file mode 100644 index feaf8c0fa..000000000 --- a/extensions/source/propctrlr/listselectiondlg.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX - -#include -#include -#include -#include - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= ListSelectionDialog - //==================================================================== - class ListSelectionDialog : public ModalDialog - { - private: - FixedText m_aLabel; - ListBox m_aEntries; - OKButton m_aOK; - CancelButton m_aCancel; - HelpButton m_aHelp; - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xListBox; - ::rtl::OUString m_sPropertyName; - - public: - ListSelectionDialog( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxListBox, - const ::rtl::OUString& _rPropertyName, - const String& _rPropertyUIName - ); - - // Dialog overridables - virtual short Execute(); - - private: - void initialize( ); - void commitSelection(); - - void fillEntryList ( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rListEntries ); - - void selectEntries ( const ::com::sun::star::uno::Sequence< sal_Int16 >& /* [in ] */ _rSelection ); - void collectSelection( ::com::sun::star::uno::Sequence< sal_Int16 >& /* [out] */ _rSelection ); - }; - -//........................................................................ -} // namespacepcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/listselectiondlg.src b/extensions/source/propctrlr/listselectiondlg.src deleted file mode 100644 index c2cae7ab0..000000000 --- a/extensions/source/propctrlr/listselectiondlg.src +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ -#include "formresid.hrc" -#endif -#include "propctrlr.hrc" -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HRC -#include "listselectiondlg.hrc" -#endif - -ModalDialog RID_DLG_SELECTION -{ - HelpID = "extensions:ModalDialog:RID_DLG_SELECTION"; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 150, 120 ) ; - - FixedText FT_ENTRIES - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 85, 8 ); - }; - - ListBox LB_ENTRIES - { - HelpID = "extensions:ListBox:RID_DLG_SELECTION:LB_ENTRIES"; - Pos = MAP_APPFONT( 6, 17 ); - Size = MAP_APPFONT( 85, 97 ); - - Border = TRUE; - DropDown = FALSE; - }; - - OKButton PB_OK - { - Pos = MAP_APPFONT( 97, 6 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - DefButton = TRUE; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT( 97, 23 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT( 97, 43 ); - Size = MAP_APPFONT( 50, 14 ); - TabStop = TRUE; - }; -}; diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk deleted file mode 100644 index ebb629ae3..000000000 --- a/extensions/source/propctrlr/makefile.mk +++ /dev/null @@ -1,154 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. -PRJINC=..$/inc - -PRJNAME=extensions -TARGET=pcr -USE_DEFFILE=TRUE - -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/controlfontdialog.obj \ - $(SLO)$/fontdialog.obj \ - $(SLO)$/pcrservices.obj \ - $(SLO)$/selectlabeldialog.obj \ - $(SLO)$/propcontroller.obj \ - $(SLO)$/formcontroller.obj \ - $(SLO)$/modulepcr.obj \ - $(SLO)$/cellbindinghelper.obj \ - $(SLO)$/taborder.obj \ - $(SLO)$/pcrunodialogs.obj \ - $(SLO)$/unourl.obj \ - $(SLO)$/formlinkdialog.obj \ - $(SLO)$/listselectiondlg.obj \ - $(SLO)$/browserlistbox.obj \ - $(SLO)$/stringrepresentation.obj \ - $(SLO)$/eformshelper.obj \ - $(SLO)$/xsddatatypes.obj \ - $(SLO)$/xsdvalidationhelper.obj \ - $(SLO)$/pushbuttonnavigation.obj \ - $(SLO)$/sqlcommanddesign.obj \ - $(SLO)$/composeduiupdate.obj \ - $(SLO)$/propertycomposer.obj \ - $(SLO)$/pcrcomponentcontext.obj \ - $(SLO)$/commoncontrol.obj \ - $(SLO)$/standardcontrol.obj \ - $(SLO)$/usercontrol.obj \ - $(SLO)$/browserline.obj \ - $(SLO)$/genericpropertyhandler.obj \ - $(SLO)$/buttonnavigationhandler.obj \ - $(SLO)$/handlerhelper.obj \ - $(SLO)$/propertyhandler.obj \ - $(SLO)$/eventhandler.obj \ - $(SLO)$/editpropertyhandler.obj \ - $(SLO)$/eformspropertyhandler.obj \ - $(SLO)$/cellbindinghandler.obj \ - $(SLO)$/submissionhandler.obj \ - $(SLO)$/xsdvalidationpropertyhandler.obj \ - $(SLO)$/formcomponenthandler.obj \ - $(SLO)$/formmetadata.obj \ - $(SLO)$/defaultforminspection.obj \ - $(SLO)$/formbrowsertools.obj \ - $(SLO)$/browserpage.obj \ - $(SLO)$/propertyeditor.obj \ - $(SLO)$/formstrings.obj \ - $(SLO)$/pcrstrings.obj \ - $(SLO)$/browserview.obj \ - $(SLO)$/pcrcommon.obj \ - $(SLO)$/newdatatype.obj \ - $(SLO)$/propeventtranslation.obj \ - $(SLO)$/objectinspectormodel.obj \ - $(SLO)$/inspectorhelpwindow.obj \ - $(SLO)$/defaulthelpprovider.obj \ - $(SLO)$/MasterDetailLinkDialog.obj \ - $(SLO)$/inspectormodelbase.obj \ - $(SLO)$/propertycontrolextender.obj \ - $(SLO)$/formgeometryhandler.obj - -SRS1NAME=$(TARGET) -SRC1FILES= propres.src \ - formres.src \ - pcrmiscres.src \ - taborder.src \ - fontdialog.src \ - selectlabeldialog.src \ - formlinkdialog.src \ - listselectiondlg.src \ - newdatatype.src - -RESLIB1NAME=$(TARGET) -RESLIB1IMAGES=$(PRJ)$/res -RESLIB1SRSFILES= $(SRS)$/$(TARGET).srs - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -SHL1STDLIBS= \ - $(EDITENGLIB) \ - $(SVXCORELIB) \ - $(SVXLIB) \ - $(SFXLIB) \ - $(SVTOOLLIB)\ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(DBTOOLSLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(UNOTOOLSLIB) \ - $(SALLIB) - -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/pcr.component - -$(MISC)/pcr.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - pcr.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt pcr.component diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx deleted file mode 100644 index 06d89a385..000000000 --- a/extensions/source/propctrlr/modulepcr.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "modulepcr.hxx" - -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - IMPLEMENT_MODULE( PcrModule, "pcr" ) - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx deleted file mode 100644 index 458aff77b..000000000 --- a/extensions/source/propctrlr/modulepcr.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPCTRLR_MODULEPRC_HXX -#define EXTENSIONS_PROPCTRLR_MODULEPRC_HXX - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - DEFINE_MODULE( PcrModule, PcrClient, PcrRes ) - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_MODULEPRC_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx deleted file mode 100644 index cf97f503c..000000000 --- a/extensions/source/propctrlr/newdatatype.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "newdatatype.hxx" -#include "newdatatype.hrc" - -#include "modulepcr.hxx" -#include "formresid.hrc" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= NewDataTypeDialog - //==================================================================== - //-------------------------------------------------------------------- - NewDataTypeDialog::NewDataTypeDialog( Window* _pParent, const ::rtl::OUString& _rNameBase, const ::std::vector< ::rtl::OUString >& _rProhibitedNames ) - :ModalDialog( _pParent, PcrRes( RID_DLG_NEW_DATA_TYPE ) ) - ,m_aLabel ( this, PcrRes( FT_LABEL ) ) - ,m_aName ( this, PcrRes( ED_NAME ) ) - ,m_aOK ( this, PcrRes( PB_OK ) ) - ,m_aCancel ( this, PcrRes( PB_CANCEL ) ) - ,m_aProhibitedNames( _rProhibitedNames.begin(), _rProhibitedNames.end() ) - { - FreeResource(); - - m_aName.SetModifyHdl( LINK( this, NewDataTypeDialog, OnNameModified ) ); - - // find an initial name - // for this, first remove trailing digits - sal_Int32 nStripUntil = _rNameBase.getLength(); - while ( nStripUntil > 0 ) - { - sal_Unicode nChar = _rNameBase[ --nStripUntil ]; - if ( ( nChar < '0' ) || ( nChar > '9' ) ) - { - if ( nChar == ' ' ) - --nStripUntil; // strip the space, too - break; - } - } - - String sNameBase( _rNameBase.copy( 0, nStripUntil ? nStripUntil + 1 : 0 ) ); - sNameBase.Append( ' ' ); - String sInitialName; - sal_Int32 nPostfixNumber = 1; - do - { - ( sInitialName = sNameBase ) += String::CreateFromInt32( nPostfixNumber++ ); - } - while ( m_aProhibitedNames.find( sInitialName ) != m_aProhibitedNames.end() ); - - m_aName.SetText( sInitialName ); - OnNameModified( NULL ); - } - - //-------------------------------------------------------------------- - IMPL_LINK( NewDataTypeDialog, OnNameModified, void*, /*_pNotInterestedIn*/ ) - { - String sCurrentName = GetName(); - bool bNameIsOK = ( sCurrentName.Len() > 0 ) - && ( m_aProhibitedNames.find( sCurrentName ) == m_aProhibitedNames.end() ); - - m_aOK.Enable( bNameIsOK ); - - return 0L; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/newdatatype.hrc b/extensions/source/propctrlr/newdatatype.hrc deleted file mode 100644 index 91f641285..000000000 --- a/extensions/source/propctrlr/newdatatype.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HRC -#define EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HRC - -#define FT_LABEL 1 - -#define ED_NAME 2 - -#define PB_OK 1 -#define PB_CANCEL 2 - -#endif diff --git a/extensions/source/propctrlr/newdatatype.hxx b/extensions/source/propctrlr/newdatatype.hxx deleted file mode 100644 index e4fc0aec2..000000000 --- a/extensions/source/propctrlr/newdatatype.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include -#include -#include - -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= NewDataTypeDialog - //==================================================================== - class NewDataTypeDialog : public ModalDialog - { - private: - FixedText m_aLabel; - Edit m_aName; - OKButton m_aOK; - CancelButton m_aCancel; - - ::std::set< ::rtl::OUString > - m_aProhibitedNames; - - public: - NewDataTypeDialog( Window* _pParent, const ::rtl::OUString& _rNameBase, const ::std::vector< ::rtl::OUString >& _rProhibitedNames ); - - inline String GetName() const { return m_aName.GetText(); } - - private: - DECL_LINK( OnNameModified, void* ); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/newdatatype.src b/extensions/source/propctrlr/newdatatype.src deleted file mode 100644 index 90be27153..000000000 --- a/extensions/source/propctrlr/newdatatype.src +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "formresid.hrc" -#endif -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_NEWDATATYPE_HRC -#include "newdatatype.hrc" -#endif - -#define DIALOG_WIDTH 150 -#define DIALOG_HEIGHT 55 -#define BUTTON_WIDTH 50 -#define BUTTON_HEIGHT 14 - -ModalDialog RID_DLG_NEW_DATA_TYPE -{ - HelpID = "extensions:ModalDialog:RID_DLG_NEW_DATA_TYPE"; - OutputSize = TRUE ; - Moveable = TRUE ; - Closeable = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( DIALOG_WIDTH, DIALOG_HEIGHT ) ; - - Text [ en-US ] = "New Data Type"; - - FixedText FT_LABEL - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( DIALOG_WIDTH - 2 * 6, 8 ); - - Text [ en-US ] = "Type a name for the new data type:"; - }; - - Edit ED_NAME - { - HelpID = "extensions:Edit:RID_DLG_NEW_DATA_TYPE:ED_NAME"; - Pos = MAP_APPFONT( 6, 17 ); - Size = MAP_APPFONT( DIALOG_WIDTH - 2 * 6, 12 ); - Border = TRUE; - }; - - OKButton PB_OK - { - Pos = MAP_APPFONT( DIALOG_WIDTH - 6 - BUTTON_WIDTH - 3 - BUTTON_WIDTH, 35 ); - Size = MAP_APPFONT( BUTTON_WIDTH, BUTTON_HEIGHT ); - DefButton = TRUE; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT( DIALOG_WIDTH - 6 - BUTTON_WIDTH, 35 ); - Size = MAP_APPFONT( BUTTON_WIDTH, BUTTON_HEIGHT ); - }; -}; diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx deleted file mode 100644 index 6c7a4f991..000000000 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "modulepcr.hxx" -#include "pcrcommon.hxx" -#include "inspectormodelbase.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -#include - -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::inspection::XObjectInspectorModel; - using ::com::sun::star::lang::XInitialization; - using ::com::sun::star::lang::XServiceInfo; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Any; - using ::com::sun::star::inspection::PropertyCategoryDescriptor; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::lang::IllegalArgumentException; - using ::com::sun::star::ucb::AlreadyInitializedException; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::uno::makeAny; - /** === end UNO using === **/ - - //==================================================================== - //= ObjectInspectorModel - //==================================================================== - class ObjectInspectorModel : public ImplInspectorModel - { - private: - Sequence< Any > m_aFactories; - - public: - ObjectInspectorModel( const Reference< XComponentContext >& _rxContext ); - - // XObjectInspectorModel - virtual Sequence< Any > SAL_CALL getHandlerFactories() throw (RuntimeException); - virtual Sequence< PropertyCategoryDescriptor > SAL_CALL describeCategories( ) throw (RuntimeException); - virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const ::rtl::OUString& PropertyName ) throw (RuntimeException); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(RuntimeException); - static Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(RuntimeException); - static Reference< XInterface > SAL_CALL - Create(const Reference< XComponentContext >&); - - protected: - void createDefault(); - void createWithHandlerFactories( const Sequence< Any >& _rFactories ); - void createWithHandlerFactoriesAndHelpSection( const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); - - private: - /** checks a given condition to be , and throws an IllegalArgumentException if not - */ - void impl_verifyArgument_throw( bool _bCondition, sal_Int16 _nArgumentPosition ); - }; - - //==================================================================== - //= ObjectInspectorModel - //==================================================================== - ObjectInspectorModel::ObjectInspectorModel( const Reference< XComponentContext >& _rxContext ) - :ImplInspectorModel( _rxContext ) - { - } - - //-------------------------------------------------------------------- - Sequence< Any > SAL_CALL ObjectInspectorModel::getHandlerFactories() throw (RuntimeException) - { - return m_aFactories; - } - - //-------------------------------------------------------------------- - Sequence< PropertyCategoryDescriptor > SAL_CALL ObjectInspectorModel::describeCategories( ) throw (RuntimeException) - { - // no category info provided by this default implementation - return Sequence< PropertyCategoryDescriptor >( ); - } - - //-------------------------------------------------------------------- - ::sal_Int32 SAL_CALL ObjectInspectorModel::getPropertyOrderIndex( const ::rtl::OUString& /*PropertyName*/ ) throw (RuntimeException) - { - // no ordering provided by this default implementation - return 0; - } - - //-------------------------------------------------------------------- - void SAL_CALL ObjectInspectorModel::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_aFactories.getLength() ) - throw AlreadyInitializedException(); - - StlSyntaxSequence< Any > arguments( _arguments ); - if ( arguments.empty() ) - { // constructor: "createDefault()" - createDefault(); - return; - } - - Sequence< Any > factories; - impl_verifyArgument_throw( arguments[0] >>= factories, 1 ); - - if ( arguments.size() == 1 ) - { // constructor: "createWithHandlerFactories( any[] )" - createWithHandlerFactories( factories ); - return; - } - - sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); - if ( arguments.size() == 3 ) - { // constructor: "createWithHandlerFactoriesAndHelpSection( any[], long, long )" - impl_verifyArgument_throw( arguments[1] >>= nMinHelpTextLines, 2 ); - impl_verifyArgument_throw( arguments[2] >>= nMaxHelpTextLines, 3 ); - createWithHandlerFactoriesAndHelpSection( factories, nMinHelpTextLines, nMaxHelpTextLines ); - return; - } - - impl_verifyArgument_throw( false, 2 ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL ObjectInspectorModel::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_static(); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL ObjectInspectorModel::getSupportedServiceNames( ) throw (RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - ::rtl::OUString ObjectInspectorModel::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.extensions.ObjectInspectorModel" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > ObjectInspectorModel::getSupportedServiceNames_static( ) throw(RuntimeException) - { - ::rtl::OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.ObjectInspectorModel" ) ); - return Sequence< ::rtl::OUString >( &sService, 1 ); - } - - //-------------------------------------------------------------------- - Reference< XInterface > SAL_CALL ObjectInspectorModel::Create(const Reference< XComponentContext >& _rxContext ) - { - return *( new ObjectInspectorModel( _rxContext ) ); - } - - //-------------------------------------------------------------------- - void ObjectInspectorModel::createDefault() - { - m_aFactories.realloc( 1 ); - m_aFactories[0] <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.inspection.GenericPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - void ObjectInspectorModel::createWithHandlerFactories( const Sequence< Any >& _rFactories ) - { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); - m_aFactories = _rFactories; - } - - //-------------------------------------------------------------------- - void ObjectInspectorModel::createWithHandlerFactoriesAndHelpSection( const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) - { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); - impl_verifyArgument_throw( _nMinHelpTextLines >= 1, 2 ); - impl_verifyArgument_throw( _nMaxHelpTextLines >= 1, 3 ); - impl_verifyArgument_throw( _nMinHelpTextLines <= _nMaxHelpTextLines, 2 ); - - m_aFactories = _rFactories; - enableHelpSectionProperties( _nMinHelpTextLines, _nMaxHelpTextLines ); - } - - //-------------------------------------------------------------------- - void ObjectInspectorModel::impl_verifyArgument_throw( bool _bCondition, sal_Int16 _nArgumentPosition ) - { - if ( !_bCondition ) - throw IllegalArgumentException( ::rtl::OUString(), *this, _nArgumentPosition ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_ObjectInspectorModel() -{ - ::pcr::OAutoRegistration< ::pcr::ObjectInspectorModel > aObjectInspectorModelRegistration; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcr.component b/extensions/source/propctrlr/pcr.component deleted file mode 100644 index 2b606cc01..000000000 --- a/extensions/source/propctrlr/pcr.component +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/propctrlr/pcr.xml b/extensions/source/propctrlr/pcr.xml deleted file mode 100644 index abd86572f..000000000 --- a/extensions/source/propctrlr/pcr.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - pcr - - - Frank Schönheit - org.openoffice.comp.form.ui.OTabOrderDialog - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.ui.TabOrderDialog - - - - Frank Schönheit - org.openoffice.comp.form.ControlFontDialog - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.ui.TabOrderDialog - - - - Frank Schönheit - com.sun.star.comp.extensions.FormComponentPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.FormComponentPropertyHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.EFormsPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.XMLFormsPropertyHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.EditPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.EditPropertyHandler - - - - Frank Schönheit - org.openoffice.comp.extensions.ObjectInspector - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.inspection.ObjectInspector - - - - Frank Schönheit - org.openoffice.comp.extensions.ObjectInspectorModel - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.inspection.ObjectInspectorModel - - - - Frank Schönheit - org.openoffice.comp.extensions.FormController - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.PropertyBrowserController - - - - Frank Schönheit - com.sun.star.comp.extensions.GenericPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.inspection.GenericPropertyHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.EventHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.EventHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.XSDValidationPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.XSDValidationPropertyHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.CellBindingPropertyHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.CellBindingPropertyHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.ButtonNavigationHandler - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.ButtonNavigationHandler - - - - Frank Schönheit - com.sun.star.comp.extensions.DefaultFormComponentInspectorModel - - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.form.inspection.DefaultFormComponentInspectorModel - - - diff --git a/extensions/source/propctrlr/pcrcommon.cxx b/extensions/source/propctrlr/pcrcommon.cxx deleted file mode 100644 index e9089d5e9..000000000 --- a/extensions/source/propctrlr/pcrcommon.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "pcrcommon.hxx" -#include "modulepcr.hxx" -#include "propresid.hrc" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::util; - - //======================================================================== - //= HelpIdUrl - //======================================================================== - //------------------------------------------------------------------------ - rtl::OString HelpIdUrl::getHelpId( const ::rtl::OUString& _rHelpURL ) - { - INetURLObject aHID( _rHelpURL ); - if ( aHID.GetProtocol() == INET_PROT_HID ) - return rtl::OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ); - else - return rtl::OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); - } - - //------------------------------------------------------------------------ - ::rtl::OUString HelpIdUrl::getHelpURL( const rtl::OString& sHelpId ) - { - ::rtl::OUStringBuffer aBuffer; - ::rtl::OUString aTmp( sHelpId, sHelpId.getLength(), RTL_TEXTENCODING_UTF8 ); - INetURLObject aHID( aTmp ); - if ( aHID.GetProtocol() == INET_PROT_NOT_VALID ) - aBuffer.appendAscii( INET_HID_SCHEME ); - aBuffer.append( aTmp.getStr() ); - return aBuffer.makeStringAndClear(); - } -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx deleted file mode 100644 index 2f82e31d3..000000000 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_ -#define _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_ - -#define EDITOR_LIST_APPEND (sal_uInt16)-1 -#define EDITOR_LIST_REPLACE_EXISTING (sal_uInt16)-1 - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010 - #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011 - #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012 - #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013 - - //======================================================================== - //= types - //======================================================================== - typedef ::comphelper::OSimpleListenerContainer < ::com::sun::star::beans::XPropertyChangeListener - , ::com::sun::star::beans::PropertyChangeEvent - > PropertyChangeListeners; - - //======================================================================== - //= helper - //======================================================================== - // small helper to make the "swap" call on an STL container a single-line call, which - // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC - template< class CONTAINER > - void clearContainer( CONTAINER& _rContainer ) - { - CONTAINER aEmpty; - _rContainer.swap( aEmpty ); - } - - //======================================================================== - //= HelpIdUrl - //======================================================================== - /// small helper to translate help ids into help urls - class HelpIdUrl - { - public: - static rtl::OString getHelpId( const ::rtl::OUString& _rHelpURL ); - static ::rtl::OUString getHelpURL( const rtl::OString& ); - }; - - //==================================================================== - //= StlSyntaxSequence - //==================================================================== - template< class ELEMENT > - class StlSyntaxSequence : public ::com::sun::star::uno::Sequence< ELEMENT > - { - private: - typedef ::com::sun::star::uno::Sequence< ELEMENT > UnoBase; - - public: - inline StlSyntaxSequence() : UnoBase() { } - inline StlSyntaxSequence( const UnoBase& rSeq ) : UnoBase( rSeq ) { } - inline StlSyntaxSequence( const ELEMENT* pElements, sal_Int32 len ) : UnoBase( pElements, len ) { } - inline StlSyntaxSequence( sal_Int32 len ) : UnoBase( len ) { } - - operator const UnoBase&() const { return *this; } - operator UnoBase&() { return *this; } - - typedef const ELEMENT* const_iterator; - typedef ELEMENT* iterator; - - inline const_iterator begin() const { return UnoBase::getConstArray(); } - inline const_iterator end() const { return UnoBase::getConstArray() + UnoBase::getLength(); } - - inline iterator begin() { return UnoBase::getArray(); } - inline iterator end() { return UnoBase::getArray() + UnoBase::getLength(); } - - inline sal_Int32 size() const { return UnoBase::getLength(); } - inline bool empty() const { return UnoBase::getLength() == 0; } - - inline void resize( size_t _newSize ) { UnoBase::realloc( _newSize ); } - - inline iterator erase( iterator _pos ) - { - iterator loop = end(); - while ( --loop != _pos ) - *( loop - 1 ) = *loop; - resize( size() - 1 ); - } - }; - - //======================================================================== - //= UNO helpers - //======================================================================== -#define DECLARE_XCOMPONENT() \ - virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); \ - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); \ - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - -#define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \ - void SAL_CALL classname::dispose( ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - baseclass::WeakComponentImplHelperBase::dispose(); \ - } \ - void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \ - } \ - void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \ - } \ - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrcommontypes.hxx b/extensions/source/propctrlr/pcrcommontypes.hxx deleted file mode 100644 index 28c18eeec..000000000 --- a/extensions/source/propctrlr/pcrcommontypes.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - typedef ::boost::unordered_map< ::rtl::OUString, ::com::sun::star::beans::Property, ::rtl::OUStringHash > - PropertyMap; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrcomponentcontext.cxx b/extensions/source/propctrlr/pcrcomponentcontext.cxx deleted file mode 100644 index fe2ee37a2..000000000 --- a/extensions/source/propctrlr/pcrcomponentcontext.cxx +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "pcrcomponentcontext.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::lang::ServiceNotRegisteredException; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::lang::XMultiServiceFactory; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::RuntimeException; - /** === end UNO using === **/ - - //==================================================================== - //= ComponentContext - //==================================================================== - //-------------------------------------------------------------------- - ComponentContext::ComponentContext( const Reference< XComponentContext >& _rxContext ) - :m_xContext( _rxContext ) - { - if ( m_xContext.is() ) - m_xORB = m_xContext->getServiceManager(); - if ( !m_xORB.is() ) - throw NullPointerException(); - } - - //------------------------------------------------------------------------ - Any ComponentContext::getContextValueByName( const ::rtl::OUString& _rName ) const - { - Any aReturn; - try - { - aReturn = m_xContext->getValueByName( _rName ); - } - catch( const Exception& ) - { - OSL_FAIL( "PropertyHandler::getContextValueByName: caught an exception!" ); - } - return aReturn; - } - - //------------------------------------------------------------------------ - Reference< XInterface > ComponentContext::createComponent( const ::rtl::OUString& _rServiceName ) const - { - Reference< XInterface > xComponent( - m_xORB->createInstanceWithContext( _rServiceName, m_xContext ) - ); - if ( !xComponent.is() ) - throw ServiceNotRegisteredException( _rServiceName, NULL ); - return xComponent; - } - - //------------------------------------------------------------------------ - Reference< XMultiServiceFactory > ComponentContext::getLegacyServiceFactory() const - { - return Reference< XMultiServiceFactory >( m_xORB, UNO_QUERY_THROW ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrcomponentcontext.hxx b/extensions/source/propctrlr/pcrcomponentcontext.hxx deleted file mode 100644 index d050f3ad9..000000000 --- a/extensions/source/propctrlr/pcrcomponentcontext.hxx +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PCROMPONENTCONTEXT_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PCROMPONENTCONTEXT_HXX - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= ComponentContext - //==================================================================== - /** a helper class for working with a component context - */ - class ComponentContext - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xORB; - - public: - /** constructs an instance - @param _rxContext - the component context to manage - @throws ::com::sun::star::lang::NullPointerException - if the given context, or its component factory, are - */ - ComponentContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - /** returns the ->XComponentContext interface - */ - inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > - getUNOContext() const { return m_xContext; } - - /** determines whether the context is not - */ - inline sal_Bool is() const - { - return m_xContext.is(); - } - - /** creates a component using our component factory/context - @throws ::com::sun::star::uno::Exception - @return - if and only if the component could be successfully created - */ - template < class INTERFACE > - bool createComponent( const ::rtl::OUString& _rServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const - { - _out_rxComponent.clear(); - _out_rxComponent = _out_rxComponent.query( - m_xORB->createInstanceWithContext( _rServiceName, m_xContext ) - ); - return _out_rxComponent.is(); - } - - /** creates a component using our component factory/context - @throws ::com::sun::star::uno::Exception - @return - if and only if the component could be successfully created - */ - template < class INTERFACE > - bool createComponent( const sal_Char* _pAsciiServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const - { - return createComponent( ::rtl::OUString::createFromAscii( _pAsciiServiceName ), _out_rxComponent ); - } - - /** creates a component using our component factory/context - - @throws ::com::sun::star::lang::ServiceNotRegisteredException - if the given service is not registered - @throws Exception - if an exception occurred during creating the component - @return - the newly created component. Is never . - */ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const ::rtl::OUString& _rServiceName ) const; - - /** creates a component using our component factory/context - - @throws ::com::sun::star::lang::ServiceNotRegisteredException - if the given service is not registered - @throws Exception - if an exception occurred during creating the component - @return - the newly created component. Is never . - */ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const sal_Char* _pAsciiServiceName ) const - { - return createComponent( ::rtl::OUString::createFromAscii( _pAsciiServiceName ) ); - } - - /** returns the ->XMultiServiceFactory interface of ->m_xORB, for passing to - older code which does not yet support ->XMultiComponentFactory - @throws ::com::sun::star::uno::RuntimeException - if our our component factory does not support this interface - */ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getLegacyServiceFactory() const; - - /** retrieves a value from our component context - @param _rName - the name of the value to retrieve - @return - the context value with the given name - @seealso XComponentContext::getValueByName - @seealso getContextValueByAsciiName - */ - ::com::sun::star::uno::Any - getContextValueByName( const ::rtl::OUString& _rName ) const; - - /** retrieves a value from our component context, specified by 8-bit ASCII string - @param _rName - the name of the value to retrieve, as ASCII character string - @return - the context value with the given name - @seealso XComponentContext::getValueByName - @seealso getContextValueByName - */ - inline ::com::sun::star::uno::Any - getContextValueByAsciiName( const sal_Char* _pAsciiName ) const - { - return getContextValueByName( ::rtl::OUString::createFromAscii( _pAsciiName ) ); - } - - /** retrieve context to create interfaces by the ctors - */ - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext;} - - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PCROMPONENTCONTEXT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrmiscres.src b/extensions/source/propctrlr/pcrmiscres.src deleted file mode 100644 index cac5bce71..000000000 --- a/extensions/source/propctrlr/pcrmiscres.src +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "formresid.hrc" -#endif -#ifndef _EXTENSIONS_PROPCTRLR_FORMLOCALID_HRC_ -#include "formlocalid.hrc" -#endif - -String RID_STR_CONFIRM_DELETE_DATA_TYPE -{ - Text [ en-US ] = "Do you want to delete the data type '#type#' from the model?\n" - "Please note that this will affect all controls which are bound to this data type."; -}; - -Resource RID_RSC_BUTTON_IMAGES -{ - Image IMG_PLUS - { - ImageBitmap = Bitmap{ file = "buttonplus.png"; }; - }; - Image IMG_MINUS - { - ImageBitmap = Bitmap{ file = "buttonminus.png"; }; - }; -}; - -#define IMAGE_IDS \ - IdList = \ - { \ - RID_SVXIMG_CONTROL; \ - RID_SVXIMG_BUTTON; \ - RID_SVXIMG_RADIOBUTTON; \ - RID_SVXIMG_CHECKBOX; \ - RID_SVXIMG_FIXEDTEXT; \ - RID_SVXIMG_GROUPBOX; \ - RID_SVXIMG_EDIT; \ - RID_SVXIMG_LISTBOX; \ - RID_SVXIMG_COMBOBOX; \ - RID_SVXIMG_GRID; \ - RID_SVXIMG_IMAGEBUTTON; \ - RID_SVXIMG_FILECONTROL; \ - RID_SVXIMG_DATEFIELD; \ - RID_SVXIMG_TIMEFIELD; \ - RID_SVXIMG_NUMERICFIELD; \ - RID_SVXIMG_CURRENCYFIELD; \ - RID_SVXIMG_PATTERNFIELD; \ - RID_SVXIMG_IMAGECONTROL; \ - RID_SVXIMG_HIDDEN; \ - RID_SVXIMG_FORMATTEDFIELD; \ - RID_SVXIMG_FILTER; \ - RID_SVXIMG_FORMS; \ - RID_SVXIMG_FORM; \ - RID_SVXIMG_COLLAPSEDNODE; \ - RID_SVXIMG_EXPANDEDNODE; \ - RID_SVXIMG_SCROLLBAR; \ - RID_SVXIMG_SPINBUTTON; \ - RID_SVXIMG_NAVIGATIONBAR; \ - }; \ - IdCount = 29 - -ImageList RID_IL_FORMEXPLORER -{ - Prefix = "sx"; - MaskColor = Color { Red = 0xff00 ; Green = 0x0000 ; Blue = 0xff00 ; }; - IMAGE_IDS; -}; - -String RID_STR_PROPTITLE_PUSHBUTTON -{ - Text [ en-US ] = "Button" ; -}; -String RID_STR_PROPTITLE_RADIOBUTTON -{ - Text [ en-US ] = "Option Button" ; -}; -String RID_STR_PROPTITLE_CHECKBOX -{ - Text [ en-US ] = "Check Box" ; -}; -String RID_STR_PROPTITLE_FIXEDTEXT -{ - Text [ en-US ] = "Label Field" ; -}; -String RID_STR_PROPTITLE_GROUPBOX -{ - Text [ en-US ] = "Group Box" ; -}; -String RID_STR_PROPTITLE_EDIT -{ - Text [ en-US ] = "Text Box" ; -}; -String RID_STR_PROPTITLE_FORMATTED -{ - Text [ en-US ] = "Formatted Field"; -}; -String RID_STR_PROPTITLE_LISTBOX -{ - Text [ en-US ] = "List Box" ; -}; -String RID_STR_PROPTITLE_COMBOBOX -{ - Text [ en-US ] = "Combo Box" ; -}; -String RID_STR_PROPTITLE_IMAGEBUTTON -{ - Text [ en-US ] = "Image Button" ; -}; -String RID_STR_PROPTITLE_HIDDENCONTROL -{ - Text [ en-US ] = "Hidden Control" ; -}; -String RID_STR_PROPTITLE_UNKNOWNCONTROL -{ - Text [ en-US ] = "Control (unknown type)" ; -}; -String RID_STR_PROPTITLE_IMAGECONTROL -{ - Text [ en-US ] = "Image Control" ; -}; -String RID_STR_PROPTITLE_FILECONTROL -{ - Text [ en-US ] = "File Selection" ; -}; -String RID_STR_PROPTITLE_DATEFIELD -{ - Text [ en-US ] = "Date Field" ; -}; -String RID_STR_PROPTITLE_TIMEFIELD -{ - Text [ en-US ] = "Time Field" ; -}; -String RID_STR_PROPTITLE_NUMERICFIELD -{ - Text [ en-US ] = "Numeric Field" ; -}; -String RID_STR_PROPTITLE_CURRENCYFIELD -{ - Text [ en-US ] = "Currency Field" ; -}; -String RID_STR_PROPTITLE_PATTERNFIELD -{ - Text [ en-US ] = "Pattern Field" ; -}; -String RID_STR_PROPTITLE_DBGRID -{ - Text [ en-US ] = "Table Control " ; -}; diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx deleted file mode 100644 index 43f40c571..000000000 --- a/extensions/source/propctrlr/pcrservices.cxx +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "modulepcr.hxx" - -//--------------------------------------------------------------------------------------- - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL createRegistryInfo_OPropertyBrowserController(); -extern "C" void SAL_CALL createRegistryInfo_FormController(); -extern "C" void SAL_CALL createRegistryInfo_DefaultFormComponentInspectorModel(); -extern "C" void SAL_CALL createRegistryInfo_DefaultHelpProvider(); -extern "C" void SAL_CALL createRegistryInfo_OControlFontDialog(); -extern "C" void SAL_CALL createRegistryInfo_OTabOrderDialog(); -extern "C" void SAL_CALL createRegistryInfo_CellBindingPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_ButtonNavigationHandler(); -extern "C" void SAL_CALL createRegistryInfo_EditPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_EFormsPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_XSDValidationPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_EventHandler(); -extern "C" void SAL_CALL createRegistryInfo_GenericPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_ObjectInspectorModel(); -extern "C" void SAL_CALL createRegistryInfo_SubmissionPropertyHandler(); -extern "C" void SAL_CALL createRegistryInfo_StringRepresentation(); -extern "C" void SAL_CALL createRegistryInfo_MasterDetailLinkDialog(); -extern "C" void SAL_CALL createRegistryInfo_FormGeometryHandler(); - -//--------------------------------------------------------------------------------------- - -extern "C" void SAL_CALL pcr_initializeModule() -{ - static sal_Bool s_bInit = sal_False; - if (!s_bInit) - { - createRegistryInfo_OPropertyBrowserController(); - createRegistryInfo_FormController(); - createRegistryInfo_DefaultFormComponentInspectorModel(); - createRegistryInfo_DefaultHelpProvider(); - createRegistryInfo_OControlFontDialog(); - createRegistryInfo_OTabOrderDialog(); - createRegistryInfo_CellBindingPropertyHandler(); - createRegistryInfo_ButtonNavigationHandler(); - createRegistryInfo_EditPropertyHandler(); - createRegistryInfo_FormComponentPropertyHandler(); - createRegistryInfo_EFormsPropertyHandler(); - createRegistryInfo_XSDValidationPropertyHandler(); - createRegistryInfo_EventHandler(); - createRegistryInfo_GenericPropertyHandler(); - createRegistryInfo_ObjectInspectorModel(); - createRegistryInfo_SubmissionPropertyHandler(); - createRegistryInfo_StringRepresentation(); - createRegistryInfo_MasterDetailLinkDialog(); - createRegistryInfo_FormGeometryHandler(); - s_bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( - const sal_Char* pImplementationName, - void* pServiceManager, - void* /*pRegistryKey*/) -{ - pcr_initializeModule(); - - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::pcr::PcrModule::getInstance().getComponentFactory( - ::rtl::OUString::createFromAscii(pImplementationName), - static_cast< XMultiServiceFactory* >(pServiceManager)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrstrings.cxx b/extensions/source/propctrlr/pcrstrings.cxx deleted file mode 100644 index 378312fca..000000000 --- a/extensions/source/propctrlr/pcrstrings.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#ifndef _EXTENSIONS_FORMSCTRLR_PCRSTRINGS_HXX_ -#define PCR_IMPLEMENT_STRINGS -#include "pcrstrings.hxx" -#undef PCR_IMPLEMENT_STRINGS -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrstrings.hxx b/extensions/source/propctrlr/pcrstrings.hxx deleted file mode 100644 index 413b1c6a6..000000000 --- a/extensions/source/propctrlr/pcrstrings.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMSCTRLR_PCRSTRINGS_HXX_ -#define _EXTENSIONS_FORMSCTRLR_PCRSTRINGS_HXX_ - -#include "stringdefine.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - // properties - PCR_CONSTASCII_STRING( PROPERTY_TABBINGMODEL, "TabbingModel" ); - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_FORMSCTRLR_PCRSTRINGS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx deleted file mode 100644 index 5447b226e..000000000 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "pcrunodialogs.hxx" -#include "formstrings.hxx" -#include "pcrstrings.hxx" -#include "taborder.hxx" -#include "pcrcommon.hxx" - -extern "C" void SAL_CALL createRegistryInfo_OTabOrderDialog() -{ - ::pcr::OAutoRegistration< ::pcr::OTabOrderDialog > aAutoRegistration; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - - //==================================================================== - //= OTabOrderDialog - //==================================================================== - //--------------------------------------------------------------------- - OTabOrderDialog::OTabOrderDialog( const Reference< XComponentContext >& _rxContext ) - :OGenericUnoDialog( _rxContext ) - { - registerProperty( PROPERTY_CONTROLCONTEXT, OWN_PROPERTY_ID_CONTROLCONTEXT, - PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, - &m_xControlContext, ::getCppuType( &m_xControlContext ) ); - - registerProperty( PROPERTY_TABBINGMODEL, OWN_PROPERTY_ID_TABBINGMODEL, - PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, - &m_xTabbingModel, ::getCppuType( &m_xTabbingModel ) ); - } - - //--------------------------------------------------------------------- - OTabOrderDialog::~OTabOrderDialog() - { - if ( m_pDialog ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pDialog ) - destroyDialog(); - } - } - - //--------------------------------------------------------------------- - Sequence SAL_CALL OTabOrderDialog::getImplementationId( ) throw(RuntimeException) - { - static ::cppu::OImplementationId aId; - return aId.getImplementationId(); - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OTabOrderDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new OTabOrderDialog( _rxContext ) ); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OTabOrderDialog::getImplementationName() throw(RuntimeException) - { - return getImplementationName_static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString OTabOrderDialog::getImplementationName_static() throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.form.ui.OTabOrderDialog")); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence SAL_CALL OTabOrderDialog::getSupportedServiceNames() throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //--------------------------------------------------------------------- - ::comphelper::StringSequence OTabOrderDialog::getSupportedServiceNames_static() throw(RuntimeException) - { - ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.ui.TabOrderDialog" ) ); - return aSupported; - } - - //--------------------------------------------------------------------- - Reference SAL_CALL OTabOrderDialog::getPropertySetInfo() throw(RuntimeException) - { - Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //--------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OTabOrderDialog::getInfoHelper() - { - return *const_cast< OTabOrderDialog* >( this )->getArrayHelper(); - } - - //-------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* OTabOrderDialog::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties( aProps ); - return new ::cppu::OPropertyArrayHelper( aProps ); - } - - //-------------------------------------------------------------------------- - Dialog* OTabOrderDialog::createDialog( Window* _pParent ) - { - return new TabOrderDialog( _pParent, m_xTabbingModel, m_xControlContext, m_aContext.getLegacyServiceFactory() ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrunodialogs.hxx b/extensions/source/propctrlr/pcrunodialogs.hxx deleted file mode 100644 index 5175cfe62..000000000 --- a/extensions/source/propctrlr/pcrunodialogs.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX - -#include -#include "modulepcr.hxx" -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= OTabOrderDialog - //==================================================================== - class OTabOrderDialog; - typedef ::svt::OGenericUnoDialog OTabOrderDialog_DBase; - typedef ::comphelper::OPropertyArrayUsageHelper< OTabOrderDialog > OTabOrderDialog_PBase; - - class OTabOrderDialog - :public OTabOrderDialog_DBase - ,public OTabOrderDialog_PBase - ,public PcrClient - { - protected: - // - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > - m_xTabbingModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - m_xControlContext; - // - - public: - OTabOrderDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& _rxContext ); - ~OTabOrderDialog(); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - static methods - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException ); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >&); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // OPropertyArrayUsageHelper - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - protected: - // OGenericUnoDialog overridables - virtual Dialog* createDialog(Window* _pParent); - }; - -//........................................................................ -} // namespacepcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PCRUNODIALOGS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx deleted file mode 100644 index bdb662621..000000000 --- a/extensions/source/propctrlr/propcontroller.cxx +++ /dev/null @@ -1,1773 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "propcontroller.hxx" -#include "pcrstrings.hxx" -#include "standardcontrol.hxx" -#include "linedescriptor.hxx" -#include "propresid.hrc" -#include "formresid.hrc" -#include "propertyeditor.hxx" -#include "modulepcr.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" -#include "formbrowsertools.hxx" -#include "propertycomposer.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -//------------------------------------------------------------------------ -// !!! outside the namespace !!! -extern "C" void SAL_CALL createRegistryInfo_OPropertyBrowserController() -{ - ::pcr::OAutoRegistration< ::pcr::OPropertyBrowserController > aAutoRegistration; -} - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::inspection; - using namespace ::com::sun::star::ucb; - using namespace ::comphelper; - -#define THISREF() static_cast< XController* >(this) - - //======================================================================== - //= OPropertyBrowserController - //======================================================================== - DBG_NAME(OPropertyBrowserController) - //------------------------------------------------------------------------ - OPropertyBrowserController::OPropertyBrowserController( const Reference< XComponentContext >& _rxContext ) - :m_aContext(_rxContext) - ,m_aDisposeListeners( m_aMutex ) - ,m_aControlObservers( m_aMutex ) - ,m_pView(NULL) - ,m_bContainerFocusListening( false ) - ,m_bSuspendingPropertyHandlers( false ) - ,m_bConstructed( false ) - ,m_bBindingIntrospectee( false ) - { - DBG_CTOR(OPropertyBrowserController,NULL); - } - - //------------------------------------------------------------------------ - OPropertyBrowserController::~OPropertyBrowserController() - { - // stop listening for property changes - acquire(); - stopInspection( true ); - DBG_DTOR(OPropertyBrowserController,NULL); - } - - //------------------------------------------------------------------------ - IMPLEMENT_FORWARD_REFCOUNT( OPropertyBrowserController, OPropertyBrowserController_Base ) - - //------------------------------------------------------------------------ - Any SAL_CALL OPropertyBrowserController::queryInterface( const Type& _rType ) throw (RuntimeException) - { - Any aReturn = OPropertyBrowserController_Base::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = ::cppu::queryInterface( - _rType, - static_cast< XObjectInspectorUI* >( this ) - ); - return aReturn; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::startContainerWindowListening() - { - if (m_bContainerFocusListening) - return; - - if (m_xFrame.is()) - { - Reference< XWindow > xContainerWindow = m_xFrame->getContainerWindow(); - if (xContainerWindow.is()) - { - xContainerWindow->addFocusListener(this); - m_bContainerFocusListening = sal_True; - } - } - - DBG_ASSERT(m_bContainerFocusListening, "OPropertyBrowserController::startContainerWindowListening: unable to start listening (inconsistence)!"); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::stopContainerWindowListening() - { - if (!m_bContainerFocusListening) - return; - - if (m_xFrame.is()) - { - Reference< XWindow > xContainerWindow = m_xFrame->getContainerWindow(); - if (xContainerWindow.is()) - { - xContainerWindow->removeFocusListener(this); - m_bContainerFocusListening = sal_False; - } - } - - DBG_ASSERT(!m_bContainerFocusListening, "OPropertyBrowserController::stopContainerWindowListening: unable to stop listening (inconsistence)!"); - } - - //-------------------------------------------------------------------- - Reference< XObjectInspectorModel > SAL_CALL OPropertyBrowserController::getInspectorModel() throw (RuntimeException) - { - return m_xModel; - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::impl_initializeView_nothrow() - { - OSL_PRECOND( haveView(), "OPropertyBrowserController::impl_initializeView_nothrow: not to be called when we have no view!" ); - if ( !haveView() ) - return; - - if ( !m_xModel.is() ) - // allowed - return; - - try - { - getPropertyBox().EnableHelpSection( m_xModel->getHasHelpSection() ); - getPropertyBox().SetHelpLineLimites( m_xModel->getMinHelpTextLines(), m_xModel->getMaxHelpTextLines() ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::impl_updateReadOnlyView_nothrow() - { - // this is a huge cudgel, admitted. - // The problem is that in case we were previously read-only, all our controls - // were created read-only, too. We cannot simply switch them to not-read-only. - // Even if they had an API for this, we do not know whether they were - // originally created read-only, or if they are read-only just because - // the model was. - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); - } - - //-------------------------------------------------------------------- - bool OPropertyBrowserController::impl_isReadOnlyModel_throw() const - { - if ( !m_xModel.is() ) - return false; - - return m_xModel->getIsReadOnly(); - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::impl_startOrStopModelListening_nothrow( bool _bDoListen ) const - { - try - { - Reference< XPropertySet > xModelProperties( m_xModel, UNO_QUERY ); - if ( !xModelProperties.is() ) - // okay, so the model doesn't want to change its properties - // dynamically - fine with us - return; - - void (SAL_CALL XPropertySet::*pListenerOperation)( const ::rtl::OUString&, const Reference< XPropertyChangeListener >& ) - = _bDoListen ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener; - - (xModelProperties.get()->*pListenerOperation)( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ), - const_cast< OPropertyBrowserController* >( this ) - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::impl_bindToNewModel_nothrow( const Reference< XObjectInspectorModel >& _rxInspectorModel ) - { - impl_startOrStopModelListening_nothrow( false ); - m_xModel = _rxInspectorModel; - impl_startOrStopModelListening_nothrow( true ); - - // initialize the view, if we already have one - if ( haveView() ) - impl_initializeView_nothrow(); - - // inspect again, if we already have inspectees - if ( !m_aInspectedObjects.empty() ) - impl_rebindToInspectee_nothrow( m_aInspectedObjects ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OPropertyBrowserController::setInspectorModel( const Reference< XObjectInspectorModel >& _inspectorModel ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_xModel == _inspectorModel ) - return; - - impl_bindToNewModel_nothrow( _inspectorModel ); - } - - //-------------------------------------------------------------------- - Reference< XObjectInspectorUI > SAL_CALL OPropertyBrowserController::getInspectorUI() throw (RuntimeException) - { - // we're derived from this interface, though we do not expose it in queryInterface and getTypes. - return this; - } - - //-------------------------------------------------------------------- - void SAL_CALL OPropertyBrowserController::inspect( const Sequence< Reference< XInterface > >& _rObjects ) throw (com::sun::star::util::VetoException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( m_bSuspendingPropertyHandlers || !suspendAll_nothrow() ) - { // we already are trying to suspend the component (this is somewhere up the stack) - // OR one of our property handlers raised a veto against closing. Well, we *need* to close - // it in order to inspect another object. - throw VetoException(); - } - if ( m_bBindingIntrospectee ) - throw VetoException(); - - m_bBindingIntrospectee = true; - impl_rebindToInspectee_nothrow( InterfaceArray( _rObjects.getConstArray(), _rObjects.getConstArray() + _rObjects.getLength() ) ); - m_bBindingIntrospectee = false; - - } - - //-------------------------------------------------------------------- - Reference< XDispatch > SAL_CALL OPropertyBrowserController::queryDispatch( const URL& /*URL*/, const ::rtl::OUString& /*TargetFrameName*/, ::sal_Int32 /*SearchFlags*/ ) throw (RuntimeException) - { - // we don't have any dispatches at all, right now - return Reference< XDispatch >(); - } - - //-------------------------------------------------------------------- - Sequence< Reference< XDispatch > > SAL_CALL OPropertyBrowserController::queryDispatches( const Sequence< DispatchDescriptor >& Requests ) throw (RuntimeException) - { - Sequence< Reference< XDispatch > > aReturn; - sal_Int32 nLen = Requests.getLength(); - aReturn.realloc( nLen ); - - Reference< XDispatch >* pReturn = aReturn.getArray(); - const Reference< XDispatch >* pReturnEnd = aReturn.getArray() + nLen; - const DispatchDescriptor* pDescripts = Requests.getConstArray(); - - for ( ; pReturn != pReturnEnd; ++ pReturn, ++pDescripts ) - *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags ); - - return aReturn; - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException) - { - if ( m_bConstructed ) - throw AlreadyInitializedException(); - - StlSyntaxSequence< Any > arguments( _arguments ); - if ( arguments.empty() ) - { // constructor: "createDefault()" - createDefault(); - return; - } - - Reference< XObjectInspectorModel > xModel; - if ( arguments.size() == 1 ) - { // constructor: "createWithModel( XObjectInspectorModel )" - if ( !( arguments[0] >>= xModel ) ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - createWithModel( xModel ); - return; - } - - throw IllegalArgumentException( ::rtl::OUString(), *this, 0 ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::createDefault() - { - m_bConstructed = true; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::createWithModel( const Reference< XObjectInspectorModel >& _rxModel ) - { - osl_incrementInterlockedCount( &m_refCount ); - { - setInspectorModel( _rxModel ); - } - osl_decrementInterlockedCount( &m_refCount ); - - m_bConstructed = true; - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::attachFrame( const Reference< XFrame >& _rxFrame ) throw(RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if (_rxFrame.is() && haveView()) - throw RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to attach to a second frame.")),*this); - - // revoke as focus listener from the old container window - stopContainerWindowListening(); - - m_xFrame = _rxFrame; - if (!m_xFrame.is()) - return; - - // TODO: this construction perhaps should be done outside. Don't know the exact meaning of attachFrame. - // Maybe it is intended to only announce the frame to the controller, and the instance doing this - // announcement is responsible for calling setComponent, too. - Reference< XWindow > xContainerWindow = m_xFrame->getContainerWindow(); - VCLXWindow* pContainerWindow = VCLXWindow::GetImplementation(xContainerWindow); - Window* pParentWin = pContainerWindow ? pContainerWindow->GetWindow() : NULL; - if (!pParentWin) - throw RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("The frame is invalid. Unable to extract the container window.")),*this); - - if ( Construct( pParentWin ) ) - { - try - { - m_xFrame->setComponent( VCLUnoHelper::GetInterface( m_pView ), this ); - } - catch( const Exception& ) - { - OSL_FAIL( "OPropertyBrowserController::attachFrame: caught an exception!" ); - } - } - - startContainerWindowListening(); - - UpdateUI(); - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL OPropertyBrowserController::attachModel( const Reference< XModel >& _rxModel ) throw(RuntimeException) - { - Reference< XObjectInspectorModel > xModel( _rxModel, UNO_QUERY ); - if ( !xModel.is() ) - return false; - - setInspectorModel( xModel ); - return getInspectorModel() == _rxModel; - } - - //------------------------------------------------------------------------ - sal_Bool OPropertyBrowserController::suspendAll_nothrow() - { - // if there is a handle inside its "onInteractivePropertySelection" method, - // then veto - // Normally, we could expect every handler to do this itself, but being - // realistic, it's safer to handle this here in general. - if ( m_xInteractiveHandler.is() ) - return sal_False; - - m_bSuspendingPropertyHandlers = true; - sal_Bool bHandlerVeto = !suspendPropertyHandlers_nothrow( sal_True ); - m_bSuspendingPropertyHandlers = false; - if ( bHandlerVeto ) - return sal_False; - - return sal_True; - } - - //------------------------------------------------------------------------ - sal_Bool OPropertyBrowserController::suspendPropertyHandlers_nothrow( sal_Bool _bSuspend ) - { - PropertyHandlerArray aAllHandlers; // will contain every handler exactly once - for ( PropertyHandlerRepository::const_iterator handler = m_aPropertyHandlers.begin(); - handler != m_aPropertyHandlers.end(); - ++handler - ) - { - if ( ::std::find( aAllHandlers.begin(), aAllHandlers.end(), handler->second ) != aAllHandlers.end() ) - // already visited this particular handler (m_aPropertyHandlers usually contains - // the same handler more than once) - continue; - aAllHandlers.push_back( handler->second ); - } - - for ( PropertyHandlerArray::iterator loop = aAllHandlers.begin(); - loop != aAllHandlers.end(); - ++loop - ) - { - try - { - if ( !(*loop)->suspend( _bSuspend ) ) - if ( _bSuspend ) - // if we're not suspending, but reactivating, ignore the error - return sal_False; - } - catch( const Exception& ) - { - OSL_FAIL( "OPropertyBrowserController::suspendPropertyHandlers_nothrow: caught an exception!" ); - } - } - return sal_True; - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL OPropertyBrowserController::suspend( sal_Bool _bSuspend ) throw(RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( haveView(), "OPropertyBrowserController::suspend: don't have a view anymore!" ); - - if ( !_bSuspend ) - { // this means a "suspend" is to be "revoked" - suspendPropertyHandlers_nothrow( sal_False ); - // we ourself cannot revoke our suspend - return sal_False; - } - - if ( !suspendAll_nothrow() ) - return sal_False; - - // commit the editor's content - if ( haveView() ) - getPropertyBox().CommitModified(); - - // stop listening - stopContainerWindowListening(); - - // outtahere - return sal_True; - } - - //------------------------------------------------------------------------ - Any SAL_CALL OPropertyBrowserController::getViewData( ) throw(RuntimeException) - { - return makeAny( m_sPageSelection ); - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::restoreViewData( const Any& Data ) throw(RuntimeException) - { - ::rtl::OUString sPageSelection; - if ( ( Data >>= sPageSelection ) && sPageSelection.getLength() ) - { - m_sPageSelection = sPageSelection; - selectPageFromViewData(); - } - } - - //------------------------------------------------------------------------ - Reference< XModel > SAL_CALL OPropertyBrowserController::getModel( ) throw(RuntimeException) - { - // have no model - return Reference< XModel >(); - } - - //------------------------------------------------------------------------ - Reference< XFrame > SAL_CALL OPropertyBrowserController::getFrame( ) throw(RuntimeException) - { - return m_xFrame; - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::dispose( ) throw(RuntimeException) - { - SolarMutexGuard aSolarGuard; - - // stop inspecting the current object - stopInspection( false ); - - // say our dispose listeners goodbye - ::com::sun::star::lang::EventObject aEvt; - aEvt.Source = static_cast< ::cppu::OWeakObject* >(this); - m_aDisposeListeners.disposeAndClear(aEvt); - m_aControlObservers.disposeAndClear(aEvt); - - // don't delete explicitly (this is done by the frame we reside in) - m_pView = NULL; - - Reference< XComponent > xViewAsComp( m_xView, UNO_QUERY ); - if ( xViewAsComp.is() ) - xViewAsComp->removeEventListener( static_cast< XPropertyChangeListener* >( this ) ); - m_xView.clear( ); - - m_aInspectedObjects.clear(); - impl_bindToNewModel_nothrow( NULL ); - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::addEventListener( const Reference< XEventListener >& _rxListener ) throw(RuntimeException) - { - m_aDisposeListeners.addInterface(_rxListener); - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::removeEventListener( const Reference< XEventListener >& _rxListener ) throw(RuntimeException) - { - m_aDisposeListeners.removeInterface(_rxListener); - } - - //------------------------------------------------------------------------ - ::rtl::OUString SAL_CALL OPropertyBrowserController::getImplementationName( ) throw(RuntimeException) - { - return getImplementationName_static(); - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL OPropertyBrowserController::supportsService( const ::rtl::OUString& ServiceName ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pArray = aSupported.getConstArray(); - for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray) - if (pArray->equals(ServiceName)) - return sal_True; - return sal_False; - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL OPropertyBrowserController::getSupportedServiceNames( ) throw(RuntimeException) - { - return getSupportedServiceNames_static(); - } - - //------------------------------------------------------------------------ - ::rtl::OUString OPropertyBrowserController::getImplementationName_static( ) throw(RuntimeException) - { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.extensions.ObjectInspector")); - } - - //------------------------------------------------------------------------ - Sequence< ::rtl::OUString > OPropertyBrowserController::getSupportedServiceNames_static( ) throw(RuntimeException) - { - Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.inspection.ObjectInspector")); - return aSupported; - } - - //------------------------------------------------------------------------ - Reference< XInterface > SAL_CALL OPropertyBrowserController::Create(const Reference< XComponentContext >& _rxContext) - { - return *(new OPropertyBrowserController( _rxContext ) ); - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::focusGained( const FocusEvent& _rSource ) throw (RuntimeException) - { - Reference< XWindow > xSourceWindow(_rSource.Source, UNO_QUERY); - Reference< XWindow > xContainerWindow; - if (m_xFrame.is()) - xContainerWindow = m_xFrame->getContainerWindow(); - - if ( xContainerWindow.get() == xSourceWindow.get() ) - { // our container window got the focus - if ( haveView() ) - getPropertyBox().GrabFocus(); - } - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::focusLost( const FocusEvent& /*_rSource*/ ) throw (RuntimeException) - { - // not interested in - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::disposing( const EventObject& _rSource ) throw(RuntimeException) - { - if ( m_xView.is() && ( m_xView == _rSource.Source ) ) - { - m_xView = NULL; - m_pView = NULL; - } - - for ( InterfaceArray::iterator loop = m_aInspectedObjects.begin(); - loop != m_aInspectedObjects.end(); - ++loop - ) - { - if ( *loop == _rSource.Source ) - { - m_aInspectedObjects.erase( loop ); - break; - } - } - } - - //------------------------------------------------------------------------ - IMPL_LINK(OPropertyBrowserController, OnPageActivation, void*, EMPTYARG) - { - updateViewDataFromActivePage(); - return 0L; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::updateViewDataFromActivePage() - { - if (!haveView()) - return; - - ::rtl::OUString sOldSelection = m_sPageSelection; - m_sPageSelection = ::rtl::OUString(); - - const sal_uInt16 nCurrentPage = m_pView->getActivaPage(); - if ( (sal_uInt16)-1 != nCurrentPage ) - { - for ( HashString2Int16::const_iterator pageId = m_aPageIds.begin(); - pageId != m_aPageIds.end(); - ++pageId - ) - { - if ( nCurrentPage == pageId->second ) - { - m_sPageSelection = pageId->first; - break; - } - } - } - - if ( m_sPageSelection.getLength() ) - m_sLastValidPageSelection = m_sPageSelection; - else if ( sOldSelection.getLength() ) - m_sLastValidPageSelection = sOldSelection; - } - - //------------------------------------------------------------------------ - sal_uInt16 OPropertyBrowserController::impl_getPageIdForCategory_nothrow( const ::rtl::OUString& _rCategoryName ) const - { - sal_uInt16 nPageId = (sal_uInt16)-1; - HashString2Int16::const_iterator pagePos = m_aPageIds.find( _rCategoryName ); - if ( pagePos != m_aPageIds.end() ) - nPageId = pagePos->second; - return nPageId; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::selectPageFromViewData() - { - sal_uInt16 nNewPage = impl_getPageIdForCategory_nothrow( m_sPageSelection ); - - if ( haveView() && ( nNewPage != (sal_uInt16)-1 ) ) - m_pView->activatePage( nNewPage ); - - // just in case ... - updateViewDataFromActivePage(); - } - - //------------------------------------------------------------------------ - sal_Bool OPropertyBrowserController::Construct(Window* _pParentWin) - { - DBG_ASSERT(!haveView(), "OPropertyBrowserController::Construct: already have a view!"); - DBG_ASSERT(_pParentWin, "OPropertyBrowserController::Construct: invalid parent window!"); - - m_pView = new OPropertyBrowserView(m_aContext.getLegacyServiceFactory(), _pParentWin); - m_pView->setPageActivationHandler(LINK(this, OPropertyBrowserController, OnPageActivation)); - - // add as dispose listener for our view. The view is disposed by the frame we're plugged into, - // and this disposal _deletes_ the view, so it would be deadly if we use our m_pView member - // after that - m_xView = VCLUnoHelper::GetInterface(m_pView); - Reference< XComponent > xViewAsComp(m_xView, UNO_QUERY); - if (xViewAsComp.is()) - xViewAsComp->addEventListener( static_cast< XPropertyChangeListener* >( this ) ); - - getPropertyBox().SetLineListener(this); - getPropertyBox().SetControlObserver(this); - impl_initializeView_nothrow(); - - m_pView->Show(); - - return sal_True; - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException) - { - if ( _rEvent.Source == m_xModel ) - { - if ( _rEvent.PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) ) - impl_updateReadOnlyView_nothrow(); - return; - } - - if ( m_sCommittingProperty == _rEvent.PropertyName ) - return; - - if ( !haveView() ) - return; - - Any aNewValue( _rEvent.NewValue ); - if ( impl_hasPropertyHandlerFor_nothrow( _rEvent.PropertyName ) ) - { - // forward the new value to the property box, to reflect the change in the UI - aNewValue = impl_getPropertyValue_throw( _rEvent.PropertyName ); - - // check whether the state is ambiguous. This is interesting in case we display the properties - // for multiple objects at once: In this case, we'll get a notification from one of the objects, - // but need to care for the "composed" value, which can be "ambiguous". - PropertyHandlerRef xHandler( impl_getHandlerForProperty_throw( _rEvent.PropertyName ), UNO_SET_THROW ); - PropertyState ePropertyState( xHandler->getPropertyState( _rEvent.PropertyName ) ); - bool bAmbiguousValue = ( PropertyState_AMBIGUOUS_VALUE == ePropertyState ); - - getPropertyBox().SetPropertyValue( _rEvent.PropertyName, aNewValue, bAmbiguousValue ); - } - - // if it's a actuating property, then update the UI for any dependent - // properties - if ( impl_isActuatingProperty_nothrow( _rEvent.PropertyName ) ) - impl_broadcastPropertyChange_nothrow( _rEvent.PropertyName, aNewValue, _rEvent.OldValue, false ); - } - - //------------------------------------------------------------------------ - Reference< XPropertyControl > SAL_CALL OPropertyBrowserController::createPropertyControl( ::sal_Int16 ControlType, ::sal_Bool _CreateReadOnly ) throw (IllegalArgumentException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XPropertyControl > xControl; - - // default winbits: a border only - WinBits nWinBits = WB_BORDER; - - // read-only-ness - _CreateReadOnly |= (sal_Bool)impl_isReadOnlyModel_throw(); - if ( _CreateReadOnly ) - nWinBits |= WB_READONLY; - - switch ( ControlType ) - { - case PropertyControlType::StringListField: - xControl = new OMultilineEditControl( &getPropertyBox(), eStringList, nWinBits | WB_DROPDOWN | WB_TABSTOP ); - break; - - case PropertyControlType::MultiLineTextField: - xControl = new OMultilineEditControl( &getPropertyBox(), eMultiLineText, nWinBits | WB_DROPDOWN | WB_TABSTOP ); - break; - - case PropertyControlType::ListBox: - xControl = new OListboxControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_DROPDOWN); - break; - - case PropertyControlType::ComboBox: - xControl = new OComboboxControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_DROPDOWN); - break; - - case PropertyControlType::TextField: - xControl = new OEditControl( &getPropertyBox(), sal_False, nWinBits | WB_TABSTOP ); - break; - - case PropertyControlType::CharacterField: - xControl = new OEditControl( &getPropertyBox(), sal_True, nWinBits | WB_TABSTOP ); - break; - - case PropertyControlType::NumericField: - xControl = new ONumericControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_SPIN | WB_REPEAT ); - break; - - case PropertyControlType::DateTimeField: - xControl = new ODateTimeControl( &getPropertyBox(), nWinBits | WB_TABSTOP ); - break; - - case PropertyControlType::DateField: - xControl = new ODateControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_SPIN | WB_REPEAT ); - break; - - case PropertyControlType::TimeField: - xControl = new OTimeControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_SPIN | WB_REPEAT ); - break; - - case PropertyControlType::ColorListBox: - xControl = new OColorControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_DROPDOWN ); - break; - - case PropertyControlType::HyperlinkField: - xControl = new OHyperlinkControl( &getPropertyBox(), nWinBits | WB_TABSTOP | WB_DROPDOWN ); - break; - - default: - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - } - - return xControl; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::impl_toggleInspecteeListening_nothrow( bool _bOn ) - { - for ( InterfaceArray::const_iterator loop = m_aInspectedObjects.begin(); - loop != m_aInspectedObjects.end(); - ++loop - ) - { - try - { - Reference< XComponent > xComp( *loop, UNO_QUERY ); - if ( xComp.is() ) - { - if ( _bOn ) - xComp->addEventListener( static_cast< XPropertyChangeListener* >( this ) ); - else - xComp->removeEventListener( static_cast< XPropertyChangeListener* >( this ) ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::stopInspection( bool _bCommitModified ) - { - if ( haveView() ) - { - if ( _bCommitModified ) - // commit the editor's content - getPropertyBox().CommitModified(); - - // hide the property box so that it does not flicker - getPropertyBox().Hide(); - - // clear the property box - getPropertyBox().ClearAll(); - } - - // destroy the view first - if ( haveView() ) - { - // remove the pages - for ( HashString2Int16::const_iterator erase = m_aPageIds.begin(); - erase != m_aPageIds.end(); - ++erase - ) - getPropertyBox().RemovePage( erase->second ); - clearContainer( m_aPageIds ); - } - - clearContainer( m_aProperties ); - - // de-register as dispose-listener from our inspected objects - impl_toggleInspecteeListening_nothrow( false ); - - // handlers are obsolete, so is our "composer" for their UI requests - if ( m_pUIRequestComposer.get() ) - m_pUIRequestComposer->dispose(); - m_pUIRequestComposer.reset( NULL ); - - // clean up the property handlers - PropertyHandlerArray aAllHandlers; // will contain every handler exactly once - for ( PropertyHandlerRepository::const_iterator aHandler = m_aPropertyHandlers.begin(); - aHandler != m_aPropertyHandlers.end(); - ++aHandler - ) - if ( ::std::find( aAllHandlers.begin(), aAllHandlers.end(), aHandler->second ) == aAllHandlers.end() ) - aAllHandlers.push_back( aHandler->second ); - - for ( PropertyHandlerArray::iterator loop = aAllHandlers.begin(); - loop != aAllHandlers.end(); - ++loop - ) - { - try - { - (*loop)->removePropertyChangeListener( this ); - (*loop)->dispose(); - } - catch( const DisposedException& ) - { - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - clearContainer( m_aPropertyHandlers ); - clearContainer( m_aDependencyHandlers ); - } - - //------------------------------------------------------------------------ - bool OPropertyBrowserController::impl_hasPropertyHandlerFor_nothrow( const ::rtl::OUString& _rPropertyName ) const - { - PropertyHandlerRepository::const_iterator handlerPos = m_aPropertyHandlers.find( _rPropertyName ); - return ( handlerPos != m_aPropertyHandlers.end() ); - } - - //------------------------------------------------------------------------ - OPropertyBrowserController::PropertyHandlerRef OPropertyBrowserController::impl_getHandlerForProperty_throw( const ::rtl::OUString& _rPropertyName ) const - { - PropertyHandlerRepository::const_iterator handlerPos = m_aPropertyHandlers.find( _rPropertyName ); - if ( handlerPos == m_aPropertyHandlers.end() ) - throw RuntimeException(); - return handlerPos->second; - } - - //------------------------------------------------------------------------ - Any OPropertyBrowserController::impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ) - { - PropertyHandlerRef handler = impl_getHandlerForProperty_throw( _rPropertyName ); - return handler->getPropertyValue( _rPropertyName ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ) - { - try - { - // stop inspecting the old object(s) - stopInspection( true ); - - // inspect the new object(s) - m_aInspectedObjects = _rObjects; - doInspection(); - - // update the user interface - UpdateUI(); - } - - catch(Exception&) - { - OSL_FAIL("OPropertyBrowserController::impl_rebindToInspectee_nothrow: caught an exception !"); - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::doInspection() - { - try - { - ////////////////////////////////////////////////////////////////////// - // obtain the properties of the object - ::std::vector< Property > aProperties; - - PropertyHandlerArray aPropertyHandlers; - getPropertyHandlers( m_aInspectedObjects, aPropertyHandlers ); - - PropertyHandlerArray::iterator aHandler( aPropertyHandlers.begin() ); - while ( aHandler != aPropertyHandlers.end() ) - { - DBG_ASSERT( aHandler->get(), "OPropertyBrowserController::doInspection: invalid handler!" ); - - StlSyntaxSequence< Property > aThisHandlersProperties = (*aHandler)->getSupportedProperties(); - - if ( aThisHandlersProperties.empty() ) - { - // this handler doesn't know anything about the current inspectee -> ignore it - (*aHandler)->dispose(); - aHandler = aPropertyHandlers.erase( aHandler ); - continue; - } - - // append these properties to our "all properties" array - aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); - for ( StlSyntaxSequence< Property >::const_iterator copyProperty = aThisHandlersProperties.begin(); - copyProperty != aThisHandlersProperties.end(); - ++copyProperty - ) - { - ::std::vector< Property >::const_iterator previous = ::std::find_if( - aProperties.begin(), - aProperties.end(), - FindPropertyByName( copyProperty->Name ) - ); - if ( previous == aProperties.end() ) - { - aProperties.push_back( *copyProperty ); - continue; - } - - // there already was another (previous) handler which supported this property. - // Don't add it to aProperties, again. - - // Also, ensure that handlers which previously expressed interest in *changes* - // of this property are not notified. - // This is 'cause we have a new handler which is responsible for this property, - // which means it can give it a completely different meaning than the previous - // handler for this property is prepared for. - ::std::pair< PropertyHandlerMultiRepository::iterator, PropertyHandlerMultiRepository::iterator > - aDepHandlers = m_aDependencyHandlers.equal_range( copyProperty->Name ); - m_aDependencyHandlers.erase( aDepHandlers.first, aDepHandlers.second ); - } - - // determine the superseded properties - StlSyntaxSequence< ::rtl::OUString > aSupersededByThisHandler = (*aHandler)->getSupersededProperties(); - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator superseded = aSupersededByThisHandler.begin(); - superseded != aSupersededByThisHandler.end(); - ++superseded - ) - { - ::std::vector< Property >::iterator existent = ::std::find_if( - aProperties.begin(), - aProperties.end(), - FindPropertyByName( *superseded ) - ); - if ( existent != aProperties.end() ) - // one of the properties superseded by this handler was supported by a previous - // one -> erase - aProperties.erase( existent ); - } - - // be notified of changes which this handler is responsible for - (*aHandler)->addPropertyChangeListener( this ); - - // remember this handler for every of the properties which it is responsible - // for - for ( StlSyntaxSequence< Property >::const_iterator remember = aThisHandlersProperties.begin(); - remember != aThisHandlersProperties.end(); - ++remember - ) - { - m_aPropertyHandlers[ remember->Name ] = *aHandler; - // note that this implies that if two handlers support the same property, - // the latter wins - } - - // see if the handler expresses interest in any actuating properties - StlSyntaxSequence< ::rtl::OUString > aInterestingActuations = (*aHandler)->getActuatingProperties(); - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator aLoop = aInterestingActuations.begin(); - aLoop != aInterestingActuations.end(); - ++aLoop - ) - { - m_aDependencyHandlers.insert( PropertyHandlerMultiRepository::value_type( - *aLoop, *aHandler ) ); - } - - ++aHandler; - } - - // create a new composer for UI requests coming from the handlers - m_pUIRequestComposer.reset( new ComposedPropertyUIUpdate( getInspectorUI(), this ) ); - - // sort the properties by relative position, as indicated by the model - for ( ::std::vector< Property >::const_iterator sourceProps = aProperties.begin(); - sourceProps != aProperties.end(); - ++sourceProps - ) - { - sal_Int32 nRelativePropertyOrder = sourceProps - aProperties.begin(); - if ( m_xModel.is() ) - nRelativePropertyOrder = m_xModel->getPropertyOrderIndex( sourceProps->Name ); - while ( m_aProperties.find( nRelativePropertyOrder ) != m_aProperties.end() ) - ++nRelativePropertyOrder; - m_aProperties[ nRelativePropertyOrder ] = *sourceProps; - } - - // be notified when one of our inspectees dies - impl_toggleInspecteeListening_nothrow( true ); - } - catch(Exception&) - { - OSL_FAIL("OPropertyBrowserController::doInspection : caught an exception !"); - } - } - - //------------------------------------------------------------------------ - ::com::sun::star::awt::Size SAL_CALL OPropertyBrowserController::getMinimumSize() throw (::com::sun::star::uno::RuntimeException) - { - ::com::sun::star::awt::Size aSize; - if( m_pView ) - return m_pView->getMinimumSize(); - else - return aSize; - } - - //------------------------------------------------------------------------ - ::com::sun::star::awt::Size SAL_CALL OPropertyBrowserController::getPreferredSize() throw (::com::sun::star::uno::RuntimeException) - { - return getMinimumSize(); - } - - //------------------------------------------------------------------------ - ::com::sun::star::awt::Size SAL_CALL OPropertyBrowserController::calcAdjustedSize( const ::com::sun::star::awt::Size& _rNewSize ) throw (::com::sun::star::uno::RuntimeException) - { - awt::Size aMinSize = getMinimumSize( ); - awt::Size aAdjustedSize( _rNewSize ); - if ( aAdjustedSize.Width < aMinSize.Width ) - aAdjustedSize.Width = aMinSize.Width; - if ( aAdjustedSize.Height < aMinSize.Height ) - aAdjustedSize.Height = aMinSize.Height; - return aAdjustedSize; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::describePropertyLine( const Property& _rProperty, OLineDescriptor& _rDescriptor ) SAL_THROW((Exception)) - { - try - { - PropertyHandlerRepository::const_iterator handler = m_aPropertyHandlers.find( _rProperty.Name ); - if ( handler == m_aPropertyHandlers.end() ) - throw RuntimeException(); // caught below - - _rDescriptor.assignFrom( handler->second->describePropertyLine( _rProperty.Name, this ) ); - - ////////////////////////////////////////////////////////////////////// - - _rDescriptor.xPropertyHandler = handler->second; - _rDescriptor.sName = _rProperty.Name; - _rDescriptor.aValue = _rDescriptor.xPropertyHandler->getPropertyValue( _rProperty.Name ); - - if ( !_rDescriptor.DisplayName.getLength() ) - { - #ifdef DBG_UTIL - ::rtl::OString sMessage( "OPropertyBrowserController::describePropertyLine: handler did not provide a display name for '" ); - sMessage += ::rtl::OString( _rProperty.Name.getStr(), _rProperty.Name.getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += ::rtl::OString( "'!" ); - DBG_ASSERT( _rDescriptor.DisplayName.getLength(), sMessage ); - #endif - _rDescriptor.DisplayName = _rProperty.Name; - } - - PropertyState ePropertyState( _rDescriptor.xPropertyHandler->getPropertyState( _rProperty.Name ) ); - if ( PropertyState_AMBIGUOUS_VALUE == ePropertyState ) - { - _rDescriptor.bUnknownValue = true; - _rDescriptor.aValue.clear(); - } - - _rDescriptor.bReadOnly = impl_isReadOnlyModel_throw(); - } - catch( const Exception& ) - { - OSL_FAIL( "OPropertyBrowserController::describePropertyLine: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::impl_buildCategories_throw() - { - OSL_PRECOND( m_aPageIds.empty(), "OPropertyBrowserController::impl_buildCategories_throw: duplicate call!" ); - - StlSyntaxSequence< PropertyCategoryDescriptor > aCategories; - if ( m_xModel.is() ) - aCategories = m_xModel->describeCategories(); - - for ( StlSyntaxSequence< PropertyCategoryDescriptor >::const_iterator category = aCategories.begin(); - category != aCategories.end(); - ++category - ) - { - OSL_ENSURE( m_aPageIds.find( category->ProgrammaticName ) == m_aPageIds.end(), - "OPropertyBrowserController::impl_buildCategories_throw: duplicate programmatic name!" ); - - m_aPageIds[ category->ProgrammaticName ] = - getPropertyBox().AppendPage( category->UIName, HelpIdUrl::getHelpId( category->HelpURL ) ); - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::UpdateUI() - { - try - { - if ( !haveView() ) - // too early, will return later - return; - - getPropertyBox().DisableUpdate(); - - sal_Bool bHaveFocus = getPropertyBox().HasChildPathFocus(); - - // create our tab pages - impl_buildCategories_throw(); - // (and allow for pages to be actually unused) - ::std::set< sal_uInt16 > aUsedPages; - - // when building the UI below, remember which properties are actuating, - // to allow for a initial actuatinPropertyChanged call - ::std::vector< ::rtl::OUString > aActuatingProperties; - ::std::vector< Any > aActuatingPropertyValues; - - // ask the handlers to describe the property UI, and insert the resulting - // entries into our list boxes - OrderedPropertyMap::const_iterator property( m_aProperties.begin() ); - for ( ; property != m_aProperties.end(); ++property ) - { - OLineDescriptor aDescriptor; - describePropertyLine( property->second, aDescriptor ); - - bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( property->second.Name ); - - #if OSL_DEBUG_LEVEL > 0 - if ( !aDescriptor.Category.getLength() ) - { - ::rtl::OString sMessage( "OPropertyBrowserController::UpdateUI: empty category provided for property '" ); - sMessage += ::rtl::OString( property->second.Name.getStr(), property->second.Name.getLength(), osl_getThreadTextEncoding() ); - sMessage += "'!"; - OSL_FAIL( sMessage ); - } - #endif - // finally insert this property control - sal_uInt16 nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); - if ( nTargetPageId == (sal_uInt16)-1 ) - { - // this category does not yet exist. This is allowed, as an inspector model might be lazy, and not provide - // any category information of its own. In this case, we have a fallback ... - m_aPageIds[ aDescriptor.Category ] = - getPropertyBox().AppendPage( aDescriptor.Category, rtl::OString() ); - nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); - } - - getPropertyBox().InsertEntry( aDescriptor, nTargetPageId ); - aUsedPages.insert( nTargetPageId ); - - // if it's an actuating property, remember it - if ( bIsActuatingProperty ) - { - aActuatingProperties.push_back( property->second.Name ); - aActuatingPropertyValues.push_back( impl_getPropertyValue_throw( property->second.Name ) ); - } - } - - // update any dependencies for the actuating properties which we encountered - { - ::std::vector< ::rtl::OUString >::const_iterator aProperty = aActuatingProperties.begin(); - ::std::vector< Any >::const_iterator aPropertyValue = aActuatingPropertyValues.begin(); - for ( ; aProperty != aActuatingProperties.end(); ++aProperty, ++aPropertyValue ) - impl_broadcastPropertyChange_nothrow( *aProperty, *aPropertyValue, *aPropertyValue, true ); - } - - // remove any unused pages (which we did not encounter properties for) - HashString2Int16 aSurvivingPageIds; - for ( HashString2Int16::iterator pageId = m_aPageIds.begin(); - pageId != m_aPageIds.end(); - ++pageId - ) - { - if ( aUsedPages.find( pageId->second ) == aUsedPages.end() ) - getPropertyBox().RemovePage( pageId->second ); - else - aSurvivingPageIds.insert( *pageId ); - } - m_aPageIds.swap( aSurvivingPageIds ); - - - getPropertyBox().Show(); - getPropertyBox().EnableUpdate(); - if ( bHaveFocus ) - getPropertyBox().GrabFocus(); - - // activate the first page - if ( !m_aPageIds.empty() ) - { - Sequence< PropertyCategoryDescriptor > aCategories( m_xModel->describeCategories() ); - if ( aCategories.getLength() ) - m_pView->activatePage( m_aPageIds[ aCategories[0].ProgrammaticName ] ); - else - // allowed: if we default-created the pages ... - m_pView->activatePage( m_aPageIds.begin()->second ); - } - - // activate the previously active page (if possible) - if ( m_sLastValidPageSelection.getLength() ) - m_sPageSelection = m_sLastValidPageSelection; - selectPageFromViewData(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::Clicked( const ::rtl::OUString& _rName, sal_Bool _bPrimary ) - { - try - { - // since the browse buttons do not get the focus when clicked with the mouse, - // we need to commit the changes in the current property field - getPropertyBox().CommitModified(); - - PropertyHandlerRepository::const_iterator handler = m_aPropertyHandlers.find( _rName ); - DBG_ASSERT( handler != m_aPropertyHandlers.end(), "OPropertyBrowserController::Clicked: a property without handler? This will crash!" ); - - ComposedUIAutoFireGuard aAutoFireGuard( *m_pUIRequestComposer ); - - Any aData; - m_xInteractiveHandler = handler->second; - InteractiveSelectionResult eResult = - handler->second->onInteractivePropertySelection( _rName, _bPrimary, aData, - m_pUIRequestComposer->getUIForPropertyHandler( handler->second ) ); - - switch ( eResult ) - { - case InteractiveSelectionResult_Cancelled: - case InteractiveSelectionResult_Success: - // okay, nothing to do - break; - case InteractiveSelectionResult_ObtainedValue: - handler->second->setPropertyValue( _rName, aData ); - break; - case InteractiveSelectionResult_Pending: - // also okay, we expect that the handler has disabled the UI as necessary - break; - default: - OSL_FAIL( "OPropertyBrowserController::Clicked: unknown result value!" ); - break; - } - } - catch (Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - m_xInteractiveHandler = NULL; - } - - //------------------------------------------------------------------------ - sal_Bool SAL_CALL OPropertyBrowserController::hasPropertyByName( const ::rtl::OUString& _rName ) throw (RuntimeException) - { - for ( OrderedPropertyMap::const_iterator search = m_aProperties.begin(); - search != m_aProperties.end(); - ++search - ) - if ( search->second.Name == _rName ) - return true; - return false; - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::Commit( const ::rtl::OUString& rName, const Any& _rValue ) - { - try - { - rtl::OUString sPlcHolder = String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ); - bool bIsPlaceHolderValue = false; - - if ( rName.equals( PROPERTY_IMAGE_URL ) ) - { - // if the prop value is the PlaceHolder - // can ignore it - rtl::OUString sVal; - _rValue >>= sVal; - if ( sVal.equals( sPlcHolder ) ) - bIsPlaceHolderValue = true; - } - m_sCommittingProperty = rName; - - bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( rName ); - - Any aOldValue; - if ( bIsActuatingProperty ) - aOldValue = impl_getPropertyValue_throw( rName ); - - // do we have a dedicated handler for this property, which we can delegate some tasks to? - PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName ); - - ////////////////////////////////////////////////////////////////////// - // set the value ( only if it's not a placeholder ) - if ( !bIsPlaceHolderValue ) - handler->setPropertyValue( rName, _rValue ); - - ////////////////////////////////////////////////////////////////////// - // re-retrieve the value - Any aNormalizedValue = handler->getPropertyValue( rName ); - - // care for any inter-property dependencies - if ( bIsActuatingProperty ) - impl_broadcastPropertyChange_nothrow( rName, aNormalizedValue, aOldValue, false ); - - // and display it again. This ensures proper formatting - getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); - } - catch(PropertyVetoException& eVetoException) - { - InfoBox(m_pView, eVetoException.Message).Execute(); - PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName ); - Any aNormalizedValue = handler->getPropertyValue( rName ); - getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); - } - catch(Exception&) - { - OSL_FAIL("OPropertyBrowserController::Commit : caught an exception !"); - } - - m_sCommittingProperty = ::rtl::OUString(); - } - - //-------------------------------------------------------------------- - namespace - { - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::focusGained( const Reference< XPropertyControl >& _Control ) - { - m_aControlObservers.notifyEach( &XPropertyControlObserver::focusGained, _Control ); - } - - //-------------------------------------------------------------------- - void OPropertyBrowserController::valueChanged( const Reference< XPropertyControl >& _Control ) - { - m_aControlObservers.notifyEach( &XPropertyControlObserver::valueChanged, _Control ); - } - - //------------------------------------------------------------------------ - namespace - { - Reference< XPropertyHandler > lcl_createHandler( const ComponentContext& _rContext, const Any& _rFactoryDescriptor ) - { - Reference< XPropertyHandler > xHandler; - - ::rtl::OUString sServiceName; - Reference< XSingleServiceFactory > xServiceFac; - Reference< XSingleComponentFactory > xComponentFac; - - if ( _rFactoryDescriptor >>= sServiceName ) - _rContext.createComponent( sServiceName, xHandler ); - else if ( _rFactoryDescriptor >>= xServiceFac ) - xHandler = xHandler.query( xServiceFac->createInstance() ); - else if ( _rFactoryDescriptor >>= xComponentFac ) - xHandler = xHandler.query( xComponentFac->createInstanceWithContext( _rContext.getUNOContext() ) ); - OSL_ENSURE(xHandler.is(),"lcl_createHandler: Can not create handler"); - return xHandler; - } - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::getPropertyHandlers( const InterfaceArray& _rObjects, PropertyHandlerArray& _rHandlers ) - { - _rHandlers.resize( 0 ); - if ( _rObjects.empty() ) - return; - - // create a component context for the handlers, containing some information about where - // they live - Reference< XComponentContext > xHandlerContext( m_aContext.getUNOContext() ); - - // if our own creator did not pass a dialog parent window, use our own view for this - Reference< XWindow > xParentWindow( m_aContext.getContextValueByAsciiName( "DialogParentWindow" ), UNO_QUERY ); - if ( !xParentWindow.is() ) - { - ::cppu::ContextEntry_Init aHandlerContextInfo[] = - { - ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ), makeAny( VCLUnoHelper::GetInterface( m_pView ) ) ) - }; - xHandlerContext = ::cppu::createComponentContext( - aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), - m_aContext.getUNOContext() ); - } - - Sequence< Any > aHandlerFactories; - if ( m_xModel.is() ) - aHandlerFactories = m_xModel->getHandlerFactories(); - - const Any* pHandlerFactory = aHandlerFactories.getConstArray(); - const Any* pHandlerFactoryEnd = aHandlerFactories.getConstArray() + aHandlerFactories.getLength(); - - while ( pHandlerFactory != pHandlerFactoryEnd ) - { - if ( _rObjects.size() == 1 ) - { // we're inspecting only one object -> one handler - Reference< XPropertyHandler > xHandler( lcl_createHandler( m_aContext, *pHandlerFactory ) ); - if ( xHandler.is() ) - { - xHandler->inspect( _rObjects[0] ); - _rHandlers.push_back( xHandler ); - } - } - else - { - // create a single handler for every single object - ::std::vector< Reference< XPropertyHandler > > aSingleHandlers( _rObjects.size() ); - ::std::vector< Reference< XPropertyHandler > >::iterator pHandler = aSingleHandlers.begin(); - - InterfaceArray::const_iterator pObject = _rObjects.begin(); - InterfaceArray::const_iterator pObjectEnd = _rObjects.end(); - - for ( ; pObject != pObjectEnd; ++pObject ) - { - *pHandler = lcl_createHandler( m_aContext, *pHandlerFactory ); - if ( pHandler->is() ) - { - (*pHandler)->inspect( *pObject ); - ++pHandler; - } - } - aSingleHandlers.resize( pHandler - aSingleHandlers.begin() ); - - // then create a handler which composes information out of those single handlers - if ( !aSingleHandlers.empty() ) - _rHandlers.push_back( new PropertyComposer( aSingleHandlers ) ); - } - - ++pHandlerFactory; - } - - // note that the handlers will not be used by our caller, if they indicate that there are no - // properties they feel responsible for - } - - //------------------------------------------------------------------------ - bool OPropertyBrowserController::impl_findObjectProperty_nothrow( const ::rtl::OUString& _rName, OrderedPropertyMap::const_iterator* _pProperty ) - { - OrderedPropertyMap::const_iterator search = m_aProperties.begin(); - for ( ; search != m_aProperties.end(); ++search ) - if ( search->second.Name == _rName ) - break; - if ( _pProperty ) - *_pProperty = search; - return ( search != m_aProperties.end() ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::rebuildPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - OrderedPropertyMap::const_iterator propertyPos; - if ( !impl_findObjectProperty_nothrow( _rPropertyName, &propertyPos ) ) - return; - - OLineDescriptor aDescriptor; - try - { - describePropertyLine( propertyPos->second, aDescriptor ); - } - catch( const Exception& ) - { - OSL_FAIL( "OPropertyBrowserController::rebuildPropertyUI: caught an exception!" ); - } - - getPropertyBox().ChangeEntry( aDescriptor ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::enablePropertyUI( const ::rtl::OUString& _rPropertyName, sal_Bool _bEnable ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - if ( !impl_findObjectProperty_nothrow( _rPropertyName ) ) - return; - - getPropertyBox().EnablePropertyLine( _rPropertyName, _bEnable ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::enablePropertyUIElements( const ::rtl::OUString& _rPropertyName, sal_Int16 _nElements, sal_Bool _bEnable ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - if ( !impl_findObjectProperty_nothrow( _rPropertyName ) ) - return; - - getPropertyBox().EnablePropertyControls( _rPropertyName, _nElements, _bEnable ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::showPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - // look up the property in our object properties - OrderedPropertyMap::const_iterator propertyPos; - if ( !impl_findObjectProperty_nothrow( _rPropertyName, &propertyPos ) ) - return; - - if ( getPropertyBox().GetPropertyPos( _rPropertyName ) != LISTBOX_ENTRY_NOTFOUND ) - { - rebuildPropertyUI( _rPropertyName ); - return; - } - - OLineDescriptor aDescriptor; - describePropertyLine( propertyPos->second, aDescriptor ); - - // look for the position to insert the property - - // side note: The methods GetPropertyPos and InsertEntry of the OPropertyEditor work - // only on the current page. This implies that it's impossible to use this method here - // to show property lines which are *not* on the current page. - // This is sufficient for now, but should be changed in the future. - - // by definition, the properties in m_aProperties are in the order in which they appear in the UI - // So all we need is a predecessor of pProperty in m_aProperties - sal_uInt16 nUIPos = LISTBOX_ENTRY_NOTFOUND; - do - { - if ( propertyPos != m_aProperties.begin() ) - --propertyPos; - nUIPos = getPropertyBox().GetPropertyPos( propertyPos->second.Name ); - } - while ( ( nUIPos == LISTBOX_ENTRY_NOTFOUND ) && ( propertyPos != m_aProperties.begin() ) ); - - if ( nUIPos == LISTBOX_ENTRY_NOTFOUND ) - // insert at the very top - nUIPos = 0; - else - // insert right after the predecessor we found - ++nUIPos; - - getPropertyBox().InsertEntry( - aDescriptor, impl_getPageIdForCategory_nothrow( aDescriptor.Category ), nUIPos ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::hidePropertyUI( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - if ( !impl_findObjectProperty_nothrow( _rPropertyName ) ) - return; - - getPropertyBox().RemoveEntry( _rPropertyName ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::showCategory( const ::rtl::OUString& _rCategory, sal_Bool _bShow ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - sal_uInt16 nPageId = impl_getPageIdForCategory_nothrow( _rCategory ); - OSL_ENSURE( nPageId != (sal_uInt16)-1, "OPropertyBrowserController::showCategory: invalid category!" ); - - getPropertyBox().ShowPropertyPage( nPageId, _bShow ); - } - - //------------------------------------------------------------------------ - Reference< XPropertyControl > SAL_CALL OPropertyBrowserController::getPropertyControl( const ::rtl::OUString& _rPropertyName ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !haveView() ) - throw RuntimeException(); - - Reference< XPropertyControl > xControl( getPropertyBox().GetPropertyControl( _rPropertyName ) ); - return xControl; - } - - //-------------------------------------------------------------------- - void SAL_CALL OPropertyBrowserController::registerControlObserver( const Reference< XPropertyControlObserver >& _Observer ) throw (RuntimeException) - { - m_aControlObservers.addInterface( _Observer ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OPropertyBrowserController::revokeControlObserver( const Reference< XPropertyControlObserver >& _Observer ) throw (RuntimeException) - { - m_aControlObservers.removeInterface( _Observer ); - } - - //------------------------------------------------------------------------ - void SAL_CALL OPropertyBrowserController::setHelpSectionText( const ::rtl::OUString& _rHelpText ) throw (NoSupportException, RuntimeException) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - if ( !haveView() ) - throw DisposedException(); - - if ( !getPropertyBox().HasHelpSection() ) - throw NoSupportException(); - - getPropertyBox().SetHelpText( _rHelpText ); - } - - //------------------------------------------------------------------------ - void OPropertyBrowserController::impl_broadcastPropertyChange_nothrow( const ::rtl::OUString& _rPropertyName, const Any& _rNewValue, const Any& _rOldValue, bool _bFirstTimeInit ) const - { - // are there one or more handlers which are interested in the actuation? - ::std::pair< PropertyHandlerMultiRepository::const_iterator, PropertyHandlerMultiRepository::const_iterator > aInterestedHandlers = - m_aDependencyHandlers.equal_range( _rPropertyName ); - if ( aInterestedHandlers.first == aInterestedHandlers.second ) - // none of our handlers is interested in this - return; - - ComposedUIAutoFireGuard aAutoFireGuard( *m_pUIRequestComposer ); - try - { - // collect the responses from all interested handlers - PropertyHandlerMultiRepository::const_iterator handler = aInterestedHandlers.first; - while ( handler != aInterestedHandlers.second ) - { - handler->second->actuatingPropertyChanged( _rPropertyName, _rNewValue, _rOldValue, - m_pUIRequestComposer->getUIForPropertyHandler( handler->second ), - _bFirstTimeInit ); - ++handler; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//............................................................................ -} // namespace pcr -//............................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx deleted file mode 100644 index 8e768f0ab..000000000 --- a/extensions/source/propctrlr/propcontroller.hxx +++ /dev/null @@ -1,429 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_PROPCONTROLLER_HXX_ -#define _EXTENSIONS_PROPCTRLR_PROPCONTROLLER_HXX_ - -#include "composeduiupdate.hxx" -#include "formbrowsertools.hxx" -#include "formmetadata.hxx" -#include "proplinelistener.hxx" -#include "propcontrolobserver.hxx" -#include "browserview.hxx" -#include "modulepcr.hxx" -#include "propertyinfo.hxx" -#include "pcrcomponentcontext.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -#include -#include -#include -#include - -class SvNumberFormatsSupplierObj; -class Font; -class Window; -class SfxItemSet; - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class OPropertyEditor; - struct OLineDescriptor; - -#if OSL_DEBUG_LEVEL > 0 - const char* CheckPropertyBrowserInvariants( const void* pVoid ); - // for dignostics with DBG_CHKTHIS -#endif - DBG_NAMEEX( OPropertyBrowserController ) - - //======================================================================== - //= OPropertyBrowserController - //======================================================================== - // #95343#------------------------------------------------------------------------------------ - typedef ::cppu::WeakImplHelper7 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::awt::XFocusListener - , ::com::sun::star::awt::XLayoutConstrains - , ::com::sun::star::beans::XPropertyChangeListener - , ::com::sun::star::inspection::XPropertyControlFactory - , ::com::sun::star::inspection::XObjectInspector - , ::com::sun::star::lang::XInitialization - > OPropertyBrowserController_Base; - - class OPropertyBrowserController - :public ::comphelper::OMutexAndBroadcastHelper - ,public OPropertyBrowserController_Base - ,public ::com::sun::star::inspection::XObjectInspectorUI - // that's intentionally *not* part of the OPropertyBrowserController_Base - // We do not want this to be available in queryInterface, getTypes, and the like. - ,public IPropertyLineListener - ,public IPropertyControlObserver - ,public IPropertyExistenceCheck - { - private: - typedef ::std::map< sal_Int32, ::com::sun::star::beans::Property > OrderedPropertyMap; - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > - InterfaceArray; - - protected: - ComponentContext m_aContext; - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xView; - - ::cppu::OInterfaceContainerHelper m_aDisposeListeners; - ::cppu::OInterfaceContainerHelper m_aControlObservers; - // meta data about the properties - OPropertyBrowserView* m_pView; - - ::rtl::OUString m_sPageSelection; - ::rtl::OUString m_sLastValidPageSelection; - - typedef ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > - PropertyHandlerRef; - typedef ::std::vector< PropertyHandlerRef > PropertyHandlerArray; - typedef ::boost::unordered_map< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > - PropertyHandlerRepository; - typedef ::boost::unordered_multimap< ::rtl::OUString, PropertyHandlerRef, ::rtl::OUStringHash > - PropertyHandlerMultiRepository; - PropertyHandlerRepository m_aPropertyHandlers; - PropertyHandlerMultiRepository m_aDependencyHandlers; - PropertyHandlerRef m_xInteractiveHandler; - - ::std::auto_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer; - - /// our InspectorModel - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > - m_xModel; - /// the object(s) we're currently inspecting - InterfaceArray m_aInspectedObjects; - /// the properties of the currently inspected object(s) - OrderedPropertyMap m_aProperties; - /// the property we're just committing - ::rtl::OUString m_sCommittingProperty; - - typedef ::boost::unordered_map< ::rtl::OUString, sal_uInt16, ::rtl::OUStringHash > HashString2Int16; - HashString2Int16 m_aPageIds; - - bool m_bContainerFocusListening; - bool m_bSuspendingPropertyHandlers; - bool m_bConstructed; - bool m_bBindingIntrospectee; - - protected: - DECLARE_XINTERFACE() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - - // XController - virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getViewData( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL restoreViewData( const ::com::sun::star::uno::Any& Data ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame( ) throw(::com::sun::star::uno::RuntimeException); - - // XComponent - virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); - - // XFocusListener - virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& _rSource ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& _rSource ) 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); - - // XLayoutConstrains #95343# ---------------- - virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw (::com::sun::star::uno::RuntimeException); - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); - - /** XPropertyControlFactory - */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > SAL_CALL createPropertyControl( ::sal_Int16 ControlType, ::sal_Bool CreateReadOnly ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - public: - OPropertyBrowserController( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); - - protected: - virtual ~OPropertyBrowserController(); - - public: - // XServiceInfo - static versions - static ::rtl::OUString getImplementationName_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); - - protected: - // IPropertyLineListener - virtual void Clicked( const ::rtl::OUString& _rName, sal_Bool _bPrimary ); - virtual void Commit( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& _rVal ); - - // IPropertyControlObserver - virtual void focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _Control ); - virtual void valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _Control ); - - // IPropertyExistenceCheck - virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException); - - // XObjectInspectorUI - virtual void SAL_CALL enablePropertyUI( const ::rtl::OUString& _rPropertyName, ::sal_Bool _bEnable ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL enablePropertyUIElements( const ::rtl::OUString& _rPropertyName, ::sal_Int16 _nElements, ::sal_Bool _bEnable ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rebuildPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL showPropertyUI( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL hidePropertyUI( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL showCategory( const ::rtl::OUString& _rCategory, ::sal_Bool _bShow ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > SAL_CALL getPropertyControl( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL registerControlObserver( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlObserver >& _Observer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL revokeControlObserver( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlObserver >& _Observer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setHelpSectionText( const ::rtl::OUString& HelpText ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - - // XObjectInspector - virtual ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > SAL_CALL getInspectorModel() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >& _inspectormodel ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > SAL_CALL getInspectorUI() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects ) throw (::com::sun::star::util::VetoException, ::com::sun::star::uno::RuntimeException); - - // XDispatchProvider - virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& URL, const ::rtl::OUString& TargetFrameName, ::sal_Int32 SearchFlags ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& Requests ) 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); - - private: - void UpdateUI(); - - void startContainerWindowListening(); - void stopContainerWindowListening(); - - // stop the inspection - void stopInspection( bool _bCommitModified ); - - sal_Bool haveView() const { return NULL != m_pView; } - OPropertyEditor& getPropertyBox() { return m_pView->getPropertyBox(); } - - // does the inspection of the objects as indicated by our model - void doInspection(); - - // bind the browser to m_xIntrospecteeAsProperty - void impl_rebindToInspectee_nothrow( const InterfaceArray& _rObjects ); - - /** retrieves special property handlers for our introspectee - */ - void getPropertyHandlers( const InterfaceArray& _rObjects, PropertyHandlerArray& _rHandlers ); - - /** called when a property changed, to broadcast any handlers which might have - registered for this property - - @param _bFirstTimeInit - if set to , this is a real change in the property value, not just a call - for purposes of initialization. - */ - void impl_broadcastPropertyChange_nothrow( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, bool _bFirstTimeInit ) const; - - /** determines whether the given property is an actuating property, that is, at least one - handler expressed interest in changes to this property's value. - */ - inline bool impl_isActuatingProperty_nothrow( const ::rtl::OUString& _rPropertyName ) const - { - return ( m_aDependencyHandlers.find( _rPropertyName ) != m_aDependencyHandlers.end() ); - } - - sal_uInt32 GetPropertyPos(const ::rtl::OUString& _rPropName); - - /** retrieves the value of the given property, by asking the appropriate XPropertyHandler - @param _rPropertyName - the name whose handler is to be obtained. Must be the name of a property - for which a handler is registered. - @throws - RuntimeException if there is no handler for the given property - @return - the value of this property - */ - ::com::sun::star::uno::Any - impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ); - - /// calls XPropertyHandler::suspend for all our property handlers - sal_Bool suspendPropertyHandlers_nothrow( sal_Bool _bSuspend ); - - /// suspends the complete inspector - sal_Bool suspendAll_nothrow(); - - /** selects a page according to our current view data - */ - void selectPageFromViewData(); - - /** updates our view data from the currently active page - */ - void updateViewDataFromActivePage(); - - /// describes the UI for the given property - void describePropertyLine( const ::com::sun::star::beans::Property& _rPropertyName, OLineDescriptor& _rDescriptor ) - SAL_THROW((::com::sun::star::uno::Exception)); - - /** retrieves the position of the property given by name in m_aProperties - @return - if and only if the property could be found. In this case, _pProperty (if - not contains the iterator pointing to this property. - */ - bool impl_findObjectProperty_nothrow( const ::rtl::OUString& _rName, OrderedPropertyMap::const_iterator* _pProperty = NULL ); - - sal_Bool Construct(Window* _pParentWin); - - /** retrieves the property handler for a given property name - @param _rPropertyName - the name whose handler is to be obtained. Must be the name of a property - for which a handler is registered. - @throws - RuntimeException if there is no handler for the given property - @return - the handler which is responsible for the given property - */ - PropertyHandlerRef - impl_getHandlerForProperty_throw( const ::rtl::OUString& _rPropertyName ) const; - - /** determines whether we have a handler for the given property - @param _rPropertyName - the name of the property for which the existence of a handler should be checked - */ - bool - impl_hasPropertyHandlerFor_nothrow( const ::rtl::OUString& _rPropertyName ) const; - - /** builds up m_aPageIds from InspectorModel::describeCategories, and insert all the - respective tab pages into our view - @precond - m_aPageIds is empty - @throws ::com::sun::star::uno::RuntimeException - if one of the callees of this method throws this exception - */ - void - impl_buildCategories_throw(); - - /** retrieves the id of the tab page which represents a given category. - @param _rCategoryName - the programmatic name of a category. - @return - the id of the tab page, or (sal_uInt16)-1 if there - is no tab page for the given category - */ - sal_uInt16 - impl_getPageIdForCategory_nothrow( const ::rtl::OUString& _rCategoryName ) const; - - /** adds or removes ourself as XEventListener to/from all our inspectees - */ - void impl_toggleInspecteeListening_nothrow( bool _bOn ); - - /** binds the instance to a new model - */ - void impl_bindToNewModel_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >& _rxInspectorModel ); - - /** initializes our view, as indicated by the model's view-relevant properties - - It's allowed to call this method when no model exists, yet. In this case, nothing - happens. - */ - void impl_initializeView_nothrow(); - - /** determines whether the view should be readonly. - - Effectively, this means that the method simply checks the IsReadOnly attribute of the model. - If there is no model, is returned. - - @throws ::com::sun::star::uno::RuntimeException - in case asking the model for its IsReadOnly attribute throws a ::com::sun::star::uno::RuntimeException - itself. - */ - bool impl_isReadOnlyModel_throw() const; - - /** updates our view so that it is read-only, as indicated by the model property - @see impl_isReadOnlyModel_throw - */ - void impl_updateReadOnlyView_nothrow(); - - /** starts or stops listening at the model - */ - void impl_startOrStopModelListening_nothrow( bool _bDoListen ) const; - - private: - DECL_LINK(OnPageActivation, void*); - - private: - // constructors - void createDefault(); - void createWithModel( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel >& _rxModel ); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_PROPCONTROLLER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontrolobserver.hxx b/extensions/source/propctrlr/propcontrolobserver.hxx deleted file mode 100644 index fc4fcf2b3..000000000 --- a/extensions/source/propctrlr/propcontrolobserver.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef PROPCONTROLOBSERVER_HXX -#define PROPCONTROLOBSERVER_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= IPropertyControlObserver - //==================================================================== - /** non-UNO version of the XPropertyControlObserver - */ - class IPropertyControlObserver - { - public: - virtual void focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _Control ) = 0; - virtual void valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _Control ) = 0; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // PROPCONTROLOBSERVER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx deleted file mode 100644 index 82a275f0d..000000000 --- a/extensions/source/propctrlr/propertycomposer.cxx +++ /dev/null @@ -1,518 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "propertycomposer.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ -#include -#include - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= helper - //==================================================================== - namespace - { - //---------------------------------------------------------------- - struct SetPropertyValue : public ::std::unary_function< Reference< XPropertyHandler >, void > - { - ::rtl::OUString sPropertyName; - const Any& rValue; - SetPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) : sPropertyName( _rPropertyName ), rValue( _rValue ) { } - void operator()( const Reference< XPropertyHandler >& _rHandler ) - { - _rHandler->setPropertyValue( sPropertyName, rValue ); - } - }; - - //---------------------------------------------------------------- - template < class BagType > - void putIntoBag( const Sequence< typename BagType::value_type >& _rArray, BagType& /* [out] */ _rBag ) - { - ::std::copy( _rArray.getConstArray(), _rArray.getConstArray() + _rArray.getLength(), - ::std::insert_iterator< BagType >( _rBag, _rBag.begin() ) ); - } - - //---------------------------------------------------------------- - template < class BagType > - void copyBagToArray( const BagType& /* [out] */ _rBag, Sequence< typename BagType::value_type >& _rArray ) - { - _rArray.realloc( _rBag.size() ); - ::std::copy( _rBag.begin(), _rBag.end(), _rArray.getArray() ); - } - } - - //==================================================================== - //= PropertyComposer - //==================================================================== - - // TODO: there are various places where we determine the first handler in our array which - // supports a given property id. This is, at the moment, done with searching all handlers, - // which is O( n * k ) at worst (n being the number of handlers, k being the maximum number - // of supported properties per handler). Shouldn't we cache this? So that it is O( log k )? - - //-------------------------------------------------------------------- - PropertyComposer::PropertyComposer( const ::std::vector< Reference< XPropertyHandler > >& _rSlaveHandlers ) - :PropertyComposer_Base ( m_aMutex ) - ,m_aSlaveHandlers ( _rSlaveHandlers ) - ,m_aPropertyListeners ( m_aMutex ) - ,m_bSupportedPropertiesAreKnown ( false ) - { - if ( m_aSlaveHandlers.empty() ) - throw IllegalArgumentException(); - - osl_incrementInterlockedCount( &m_refCount ); - { - Reference< XPropertyChangeListener > xMeMyselfAndI( this ); - for ( HandlerArray::const_iterator loop = m_aSlaveHandlers.begin(); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - if ( !loop->is() ) - throw NullPointerException(); - (*loop)->addPropertyChangeListener( xMeMyselfAndI ); - } - } - osl_decrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) - { - MethodGuard aGuard( *this ); - - for ( HandlerArray::const_iterator loop = m_aSlaveHandlers.begin(); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - (*loop)->inspect( _rxIntrospectee ); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL PropertyComposer::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aSlaveHandlers[0]->getPropertyValue( _rPropertyName ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - ::std::for_each( m_aSlaveHandlers.begin(), m_aSlaveHandlers.end(), SetPropertyValue( _rPropertyName, _rValue ) ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL PropertyComposer::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aSlaveHandlers[0]->convertToPropertyValue( _rPropertyName, _rControlValue ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL PropertyComposer::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aSlaveHandlers[0]->convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL PropertyComposer::getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - - // assume DIRECT for the moment. This will stay this way if *all* slaves - // tell the property has DIRECT state, and if *all* values equal - PropertyState eState = PropertyState_DIRECT_VALUE; - - // check the master state - Reference< XPropertyHandler > xPrimary( *m_aSlaveHandlers.begin() ); - Any aPrimaryValue = xPrimary->getPropertyValue( _rPropertyName ); - eState = xPrimary->getPropertyState( _rPropertyName ); - - // loop through the secondary sets - PropertyState eSecondaryState = PropertyState_DIRECT_VALUE; - for ( HandlerArray::const_iterator loop = ( m_aSlaveHandlers.begin() + 1 ); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - // the secondary state - eSecondaryState = (*loop)->getPropertyState( _rPropertyName ); - - // the secondary value - Any aSecondaryValue( (*loop)->getPropertyValue( _rPropertyName ) ); - - if ( ( PropertyState_AMBIGUOUS_VALUE == eSecondaryState ) // secondary is ambiguous - || ( aPrimaryValue != aSecondaryValue ) // unequal values - ) - { - eState = PropertyState_AMBIGUOUS_VALUE; - break; - } - } - - return eState; - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aPropertyListeners.addListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aPropertyListeners.removeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL PropertyComposer::getSupportedProperties() throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - if ( !m_bSupportedPropertiesAreKnown ) - { - // we support a property if and only if all of our slaves support it - - // initially, use all the properties of an arbitrary handler (we take the first one) - putIntoBag( (*m_aSlaveHandlers.begin())->getSupportedProperties(), m_aSupportedProperties ); - - // now intersect with the properties of *all* other handlers - for ( HandlerArray::const_iterator loop = ( m_aSlaveHandlers.begin() + 1 ); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - // the properties supported by the current handler - PropertyBag aThisRound; - putIntoBag( (*loop)->getSupportedProperties(), aThisRound ); - - // the intersection of those properties with all we already have - PropertyBag aIntersection; - ::std::set_intersection( aThisRound.begin(), aThisRound.end(), m_aSupportedProperties.begin(), m_aSupportedProperties.end(), - ::std::insert_iterator< PropertyBag >( aIntersection, aIntersection.begin() ), PropertyLessByName() ); - - m_aSupportedProperties.swap( aIntersection ); - if ( m_aSupportedProperties.empty() ) - break; - } - - // remove those properties which are not composable - for ( PropertyBag::iterator check = m_aSupportedProperties.begin(); - check != m_aSupportedProperties.end(); - ) - { - sal_Bool bIsComposable = isComposable( check->Name ); - if ( !bIsComposable ) - { - PropertyBag::iterator next = check; ++next; - m_aSupportedProperties.erase( check ); - check = next; - } - else - ++check; - } - - m_bSupportedPropertiesAreKnown = true; - } - - Sequence< Property > aSurvived; - copyBagToArray( m_aSupportedProperties, aSurvived ); - return aSurvived; - } - - //-------------------------------------------------------------------- - void uniteStringArrays( const PropertyComposer::HandlerArray& _rHandlers, Sequence< ::rtl::OUString > (SAL_CALL XPropertyHandler::*pGetter)( void ), - Sequence< ::rtl::OUString >& /* [out] */ _rUnion ) - { - ::std::set< ::rtl::OUString > aUnitedBag; - - Sequence< ::rtl::OUString > aThisRound; - for ( PropertyComposer::HandlerArray::const_iterator loop = _rHandlers.begin(); - loop != _rHandlers.end(); - ++loop - ) - { - aThisRound = (loop->get()->*pGetter)(); - putIntoBag( aThisRound, aUnitedBag ); - } - - copyBagToArray( aUnitedBag, _rUnion ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PropertyComposer::getSupersededProperties( ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - // we supersede those properties which are superseded by at least one of our slaves - Sequence< ::rtl::OUString > aSuperseded; - uniteStringArrays( m_aSlaveHandlers, &XPropertyHandler::getSupersededProperties, aSuperseded ); - return aSuperseded; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PropertyComposer::getActuatingProperties( ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - - // we're interested in those properties which at least one handler wants to have - Sequence< ::rtl::OUString > aActuating; - uniteStringArrays( m_aSlaveHandlers, &XPropertyHandler::getActuatingProperties, aActuating ); - return aActuating; - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL PropertyComposer::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aSlaveHandlers[0]->describePropertyLine( _rPropertyName, _rxControlFactory ); - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL PropertyComposer::isComposable( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - MethodGuard aGuard( *this ); - return m_aSlaveHandlers[0]->isComposable( _rPropertyName ); - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL PropertyComposer::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - MethodGuard aGuard( *this ); - - impl_ensureUIRequestComposer( _rxInspectorUI ); - ComposedUIAutoFireGuard aAutoFireGuard( *m_pUIRequestComposer ); - - // ask the first of the handlers - InteractiveSelectionResult eResult = (*m_aSlaveHandlers.begin())->onInteractivePropertySelection( - _rPropertyName, - _bPrimary, - _rData, - m_pUIRequestComposer->getUIForPropertyHandler( *m_aSlaveHandlers.begin() ) - ); - - switch ( eResult ) - { - case InteractiveSelectionResult_Cancelled: - // fine - break; - - case InteractiveSelectionResult_Success: - case InteractiveSelectionResult_Pending: - OSL_FAIL( "PropertyComposer::onInteractivePropertySelection: no chance to forward the new value to the other handlers!" ); - // This means that we cannot know the new property value, which either has already been set - // at the first component ("Success"), or will be set later on once the asynchronous input - // is finished ("Pending"). So, we also cannot forward this new property value to the other - // handlers. - // We would need to be a listener at the property at the first component, but even this wouldn't - // be sufficient, since the property handler is free to change *any* property during a dedicated - // property UI. - eResult = InteractiveSelectionResult_Cancelled; - break; - - case InteractiveSelectionResult_ObtainedValue: - // OK. Our own caller will pass this as setPropertyValue, and we will then pass it to - // all slave handlers - break; - - default: - OSL_FAIL( "OPropertyBrowserController::onInteractivePropertySelection: unknown result value!" ); - break; - } - - return eResult; - } - - //-------------------------------------------------------------------- - void PropertyComposer::impl_ensureUIRequestComposer( const Reference< XObjectInspectorUI >& _rxInspectorUI ) - { - OSL_ENSURE( !m_pUIRequestComposer.get() || m_pUIRequestComposer->getDelegatorUI().get() == _rxInspectorUI.get(), - "PropertyComposer::impl_ensureUIRequestComposer: somebody's changing the horse in the mid of the race!" ); - - if ( !m_pUIRequestComposer.get() ) - m_pUIRequestComposer.reset( new ComposedPropertyUIUpdate( _rxInspectorUI, this ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& _rOldValue, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - MethodGuard aGuard( *this ); - - impl_ensureUIRequestComposer( _rxInspectorUI ); - ComposedUIAutoFireGuard aAutoFireGuard( *m_pUIRequestComposer ); - - // ask all handlers which expressed interest in this particular property, and "compose" their - // commands for the UIUpdater - for ( HandlerArray::const_iterator loop = m_aSlaveHandlers.begin(); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - // TODO: make this cheaper (cache it?) - const StlSyntaxSequence< ::rtl::OUString > aThisHandlersActuatingProps = (*loop)->getActuatingProperties(); - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator loopProps = aThisHandlersActuatingProps.begin(); - loopProps != aThisHandlersActuatingProps.end(); - ++loopProps - ) - { - if ( *loopProps == _rActuatingPropertyName ) - { - (*loop)->actuatingPropertyChanged( _rActuatingPropertyName, _rNewValue, _rOldValue, - m_pUIRequestComposer->getUIForPropertyHandler( *loop ), - _bFirstTimeInit ); - break; - } - } - } - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XCOMPONENT( PropertyComposer, PropertyComposer_Base ) - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::disposing() - { - MethodGuard aGuard( *this ); - - // dispose our slave handlers - for ( PropertyComposer::HandlerArray::const_iterator loop = m_aSlaveHandlers.begin(); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - (*loop)->removePropertyChangeListener( this ); - (*loop)->dispose(); - } - - clearContainer( m_aSlaveHandlers ); - - if ( m_pUIRequestComposer.get() ) - m_pUIRequestComposer->dispose(); - m_pUIRequestComposer.reset( NULL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException) - { - if ( !impl_isSupportedProperty_nothrow( evt.PropertyName ) ) - // A slave handler might fire events for more properties than we support. Ignore those. - return; - - PropertyChangeEvent aTranslatedEvent( evt ); - try - { - aTranslatedEvent.NewValue = getPropertyValue( evt.PropertyName ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - m_aPropertyListeners.notify( aTranslatedEvent, &XPropertyChangeListener::propertyChange ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyComposer::disposing( const EventObject& Source ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - m_aPropertyListeners.disposing( Source ); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL PropertyComposer::suspend( sal_Bool _bSuspend ) throw (RuntimeException) - { - MethodGuard aGuard( *this ); - for ( PropertyComposer::HandlerArray::const_iterator loop = m_aSlaveHandlers.begin(); - loop != m_aSlaveHandlers.end(); - ++loop - ) - { - if ( !(*loop)->suspend( _bSuspend ) ) - { - if ( _bSuspend && ( loop != m_aSlaveHandlers.begin() ) ) - { - // if we tried to suspend, but one of the slave handlers vetoed, - // re-activate the handlers which actually did *not* veto - // the suspension - do - { - --loop; - (*loop)->suspend( sal_False ); - } - while ( loop != m_aSlaveHandlers.begin() ); - } - return false; - } - } - return true; - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL PropertyComposer::hasPropertyByName( const ::rtl::OUString& _rName ) throw (RuntimeException) - { - return impl_isSupportedProperty_nothrow( _rName ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycomposer.hxx b/extensions/source/propctrlr/propertycomposer.hxx deleted file mode 100644 index 4f4418792..000000000 --- a/extensions/source/propctrlr/propertycomposer.hxx +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX - -#include "pcrcommon.hxx" -#include "composeduiupdate.hxx" -#include "formbrowsertools.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include - -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= PropertyComposer - //==================================================================== - typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::inspection::XPropertyHandler - , ::com::sun::star::beans::XPropertyChangeListener - > PropertyComposer_Base; - /** implements an XPropertyHandler which composes it's information - from a set of other property handlers - */ - class PropertyComposer :public PropertyComposer_Base - ,public ::comphelper::OBaseMutex - ,public IPropertyExistenceCheck - { - public: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > > - HandlerArray; - - private: - HandlerArray m_aSlaveHandlers; - ::std::auto_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer; - PropertyChangeListeners m_aPropertyListeners; - bool m_bSupportedPropertiesAreKnown; - PropertyBag m_aSupportedProperties; - - public: - /** constructs an XPropertyHandler which composes it's information from a set - of other property handlers - - @param _rSlaveHandlers - the set of slave handlers to invoke. Must not be - */ - PropertyComposer( const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > >& _rSlaveHandlers ); - - public: - // XPropertyHandler overridables - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState - SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor - SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - DECLARE_XCOMPONENT() - virtual void SAL_CALL disposing(); - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) 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); - - // IPropertyExistenceCheck - virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& _rName ) throw (::com::sun::star::uno::RuntimeException); - - private: - /** ensures that m_pUIRequestComposer exists - */ - void impl_ensureUIRequestComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ); - - /** checks whether a given property exists in m_aSupportedProperties - */ - bool impl_isSupportedProperty_nothrow( const ::rtl::OUString& _rPropertyName ) - { - ::com::sun::star::beans::Property aDummy; aDummy.Name = _rPropertyName; - return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end(); - } - - private: - class MethodGuard; - friend class MethodGuard; - class MethodGuard : public ::osl::MutexGuard - { - public: - MethodGuard( PropertyComposer& _rInstance ) - : ::osl::MutexGuard( _rInstance.m_aMutex ) - { - if ( _rInstance.m_aSlaveHandlers.empty() ) - throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *(&_rInstance) ); - } - }; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYCOMPOSER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycontrolextender.cxx b/extensions/source/propctrlr/propertycontrolextender.cxx deleted file mode 100644 index 5b69e2104..000000000 --- a/extensions/source/propctrlr/propertycontrolextender.cxx +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "propertycontrolextender.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === 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::XWindow; - using ::com::sun::star::awt::KeyEvent; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::inspection::XPropertyControlContext; - /** === end UNO using === **/ - namespace KeyFunction = ::com::sun::star::awt::KeyFunction; - - //==================================================================== - //= PropertyControlExtender_Data - //==================================================================== - struct PropertyControlExtender_Data - { - Reference< XPropertyControl > xControl; - Reference< XWindow > xControlWindow; - }; - - //==================================================================== - //= PropertyControlExtender - //==================================================================== - //-------------------------------------------------------------------- - PropertyControlExtender::PropertyControlExtender( const Reference< XPropertyControl >& _rxObservedControl ) - :m_pData( new PropertyControlExtender_Data ) - { - try - { - m_pData->xControl.set( _rxObservedControl, UNO_SET_THROW ); - m_pData->xControlWindow.set( m_pData->xControl->getControlWindow(), UNO_SET_THROW ); - m_pData->xControlWindow->addKeyListener( this ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - PropertyControlExtender::~PropertyControlExtender() - { - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlExtender::keyPressed( const KeyEvent& _event ) throw (RuntimeException) - { - OSL_ENSURE( _event.Source == m_pData->xControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); - if ( ( _event.KeyFunc == KeyFunction::DELETE ) - && ( _event.Modifiers == 0 ) - ) - { - try - { - Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW ); - - // reset the value - xControl->setValue( Any() ); - - // and notify the change - // don't use XPropertyControl::notifyModifiedValue. It only notifies when the control content - // is recognized as being modified by the user, which is not the case, since we just modified - // it programmatically. - Reference< XPropertyControlContext > xControlContext( xControl->getControlContext(), UNO_SET_THROW ); - xControlContext->valueChanged( xControl ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlExtender::keyReleased( const KeyEvent& /*_event*/ ) throw (RuntimeException) - { - // not interested in - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyControlExtender::disposing( const EventObject& Source ) throw (RuntimeException) - { - OSL_ENSURE( Source.Source == m_pData->xControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); - (void)Source.Source; - m_pData->xControlWindow.clear(); - m_pData->xControl.clear(); - } - - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertycontrolextender.hxx b/extensions/source/propctrlr/propertycontrolextender.hxx deleted file mode 100644 index 12e300cc2..000000000 --- a/extensions/source/propctrlr/propertycontrolextender.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX -#define EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= PropertyControlExtender - //==================================================================== - struct PropertyControlExtender_Data; - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XKeyListener - > PropertyControlExtender_Base; - class PropertyControlExtender : public PropertyControlExtender_Base - { - public: - PropertyControlExtender( - const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxObservedControl - ); - - // XKeyListener - virtual void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) 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); - - protected: - virtual ~PropertyControlExtender(); - - private: - ::std::auto_ptr< PropertyControlExtender_Data > m_pData; - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_PROPERTYCONTROLEXTENDER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx deleted file mode 100644 index 0a50fff7f..000000000 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ /dev/null @@ -1,544 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "propertyeditor.hxx" -#include "browserpage.hxx" -#include "linedescriptor.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - #define LAYOUT_BORDER_LEFT 3 - #define LAYOUT_BORDER_TOP 3 - #define LAYOUT_BORDER_RIGHT 3 - #define LAYOUT_BORDER_BOTTOM 3 - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Any; - using ::com::sun::star::inspection::XPropertyControl; - using ::com::sun::star::uno::Reference; - /** === end UNO using === **/ - - //================================================================== - // class OPropertyEditor - //================================================================== - DBG_NAME(OPropertyEditor) - //------------------------------------------------------------------ - OPropertyEditor::OPropertyEditor( Window* pParent, WinBits nWinStyle) - :Control(pParent, nWinStyle) - ,m_aTabControl( this ) - ,m_nNextId(1) - ,m_bHasHelpSection( false ) - ,m_nMinHelpLines( 0 ) - ,m_nMaxHelpLines( 0 ) - { - DBG_CTOR(OPropertyEditor,NULL); - - m_aTabControl.Show(); - m_aTabControl.SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate)); - m_aTabControl.SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate)); - m_aTabControl.SetBackground(GetBackground()); - m_aTabControl.SetPaintTransparent(sal_True); - } - - //------------------------------------------------------------------ - OPropertyEditor::~OPropertyEditor() - { - Hide(); - ClearAll(); - DBG_DTOR(OPropertyEditor,NULL); - } - - //------------------------------------------------------------------ - void OPropertyEditor::ClearAll() - { - m_nNextId=1; - sal_uInt16 nCount = m_aTabControl.GetPageCount(); - for(long i = nCount-1; i >= 0; --i) - { - sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i); - OBrowserPage* pPage = static_cast(m_aTabControl.GetTabPage(nID)); - if (pPage) - { - pPage->EnableInput(sal_False); - m_aTabControl.RemovePage(nID); - delete pPage; - } - } - m_aTabControl.Clear(); - - { - MapStringToPageId aEmpty; - m_aPropertyPageIds.swap( aEmpty ); - } - - while ( !m_aHiddenPages.empty() ) - { - delete m_aHiddenPages.begin()->second.pPage; - m_aHiddenPages.erase( m_aHiddenPages.begin() ); - } - } - - //------------------------------------------------------------------ - sal_Int32 OPropertyEditor::getMinimumHeight() - { - sal_Int32 nMinHeight( LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM ); - - if ( m_aTabControl.GetPageCount() > 0 ) - { - sal_uInt16 nFirstID = m_aTabControl.GetPageId( 0 ); - - // reserve space for the tabs themself - Rectangle aTabArea( m_aTabControl.GetTabBounds( nFirstID ) ); - nMinHeight += aTabArea.GetHeight(); - - // ask the page how much it requires - OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nFirstID ) ); - if ( pPage ) - nMinHeight += pPage->getMinimumHeight(); - } - else - nMinHeight += 250; // arbitrary ... - - return nMinHeight; - } - - //------------------------------------------------------------------ - sal_Int32 OPropertyEditor::getMinimumWidth() - { - sal_uInt16 nCount = m_aTabControl.GetPageCount(); - sal_Int32 nPageMinWidth = 0; - for(long i = nCount-1; i >= 0; --i) - { - sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i); - OBrowserPage* pPage = static_cast(m_aTabControl.GetTabPage(nID)); - if (pPage) - { - sal_Int32 nCurPageMinWidth = pPage->getMinimumWidth(); - if( nCurPageMinWidth > nPageMinWidth ) - nPageMinWidth = nCurPageMinWidth; - } - } - return nPageMinWidth+6; - } - - //------------------------------------------------------------------ - void OPropertyEditor::CommitModified() - { - // commit all of my pages, if necessary - - sal_uInt16 nCount = m_aTabControl.GetPageCount(); - for ( sal_uInt16 i=0; i( m_aTabControl.GetTabPage( nID ) ); - - if ( pPage && pPage->getListBox().IsModified() ) - pPage->getListBox().CommitModified(); - } - } - - //------------------------------------------------------------------ - void OPropertyEditor::GetFocus() - { - m_aTabControl.GrabFocus(); - } - - //------------------------------------------------------------------ - OBrowserPage* OPropertyEditor::getPage( const ::rtl::OUString& _rPropertyName ) - { - OBrowserPage* pPage = NULL; - MapStringToPageId::const_iterator aPropertyPageIdPos = m_aPropertyPageIds.find( _rPropertyName ); - if ( aPropertyPageIdPos != m_aPropertyPageIds.end() ) - pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( aPropertyPageIdPos->second ) ); - return pPage; - } - - //------------------------------------------------------------------ - const OBrowserPage* OPropertyEditor::getPage( const ::rtl::OUString& _rPropertyName ) const - { - return const_cast< OPropertyEditor* >( this )->getPage( _rPropertyName ); - } - - //------------------------------------------------------------------ - OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId ) - { - return static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( _rPageId ) ); - } - - //------------------------------------------------------------------ - const OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId ) const - { - return const_cast< OPropertyEditor* >( this )->getPage( _rPageId ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::Resize() - { - Rectangle aPlayground( - Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), - Size( - GetOutputSizePixel().Width() - LAYOUT_BORDER_LEFT - LAYOUT_BORDER_RIGHT, - GetOutputSizePixel().Height() - LAYOUT_BORDER_TOP - LAYOUT_BORDER_BOTTOM - ) - ); - - Rectangle aTabArea( aPlayground ); - m_aTabControl.SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() ); - } - - //------------------------------------------------------------------ - sal_uInt16 OPropertyEditor::AppendPage( const String & _rText, const rtl::OString& _rHelpId ) - { - // obtain a new id - sal_uInt16 nId = m_nNextId++; - // insert the id - m_aTabControl.InsertPage(nId, _rText); - - // create a new page - OBrowserPage* pPage = new OBrowserPage(&m_aTabControl); - pPage->SetText( _rText ); - // some knittings - pPage->SetSizePixel(m_aTabControl.GetTabPageSizePixel()); - pPage->getListBox().SetListener(m_pListener); - pPage->getListBox().SetObserver(m_pObserver); - pPage->getListBox().EnableHelpSection( m_bHasHelpSection ); - pPage->getListBox().SetHelpLineLimites( m_nMinHelpLines, m_nMaxHelpLines ); - pPage->SetHelpId( _rHelpId ); - - // immediately activate the page - m_aTabControl.SetTabPage(nId, pPage); - m_aTabControl.SetCurPageId(nId); - - return nId; - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetHelpId( const rtl::OString& rHelpId ) - { - Control::SetHelpId(""); - m_aTabControl.SetHelpId(rHelpId); - } - - //------------------------------------------------------------------ - void OPropertyEditor::RemovePage(sal_uInt16 nID) - { - OBrowserPage* pPage = static_cast(m_aTabControl.GetTabPage(nID)); - - if (pPage) - pPage->EnableInput(sal_False); - m_aTabControl.RemovePage(nID); - if (pPage) - delete pPage; - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetPage(sal_uInt16 nId) - { - m_aTabControl.SetCurPageId(nId); - } - - //------------------------------------------------------------------ - sal_uInt16 OPropertyEditor::GetCurPage() - { - if(m_aTabControl.GetPageCount()>0) - return m_aTabControl.GetCurPageId(); - else - return 0; - } - - //------------------------------------------------------------------ - void OPropertyEditor::Update(const ::std::mem_fun_t& _aUpdateFunction) - { - // forward this to all our pages - sal_uInt16 nCount = m_aTabControl.GetPageCount(); - for (sal_uInt16 i=0;i(m_aTabControl.GetTabPage(nID)); - if (pPage) - _aUpdateFunction(&pPage->getListBox()); - } - } - //------------------------------------------------------------------ - void OPropertyEditor::EnableUpdate() - { - Update(::std::mem_fun(&OBrowserListBox::EnableUpdate)); - } - //------------------------------------------------------------------ - void OPropertyEditor::DisableUpdate() - { - Update(::std::mem_fun(&OBrowserListBox::DisableUpdate)); - } - - //------------------------------------------------------------------ - void OPropertyEditor::forEachPage( PageOperation _pOperation, const void* _pArgument ) - { - sal_uInt16 nCount = m_aTabControl.GetPageCount(); - for ( sal_uInt16 i=0; i( m_aTabControl.GetTabPage( nID ) ); - if ( !pPage ) - continue; - (this->*_pOperation)( *pPage, _pArgument ); - } - } - - //------------------------------------------------------------------ - void OPropertyEditor::setPageLineListener( OBrowserPage& _rPage, const void* ) - { - _rPage.getListBox().SetListener( m_pListener ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetLineListener(IPropertyLineListener* _pListener) - { - m_pListener = _pListener; - forEachPage( &OPropertyEditor::setPageLineListener ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::setPageControlObserver( OBrowserPage& _rPage, const void* ) - { - _rPage.getListBox().SetObserver( m_pObserver ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetControlObserver( IPropertyControlObserver* _pObserver ) - { - m_pObserver = _pObserver; - forEachPage( &OPropertyEditor::setPageControlObserver ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::EnableHelpSection( bool _bEnable ) - { - m_bHasHelpSection = _bEnable; - forEachPage( &OPropertyEditor::enableHelpSection ); - } - - //------------------------------------------------------------------ - bool OPropertyEditor::HasHelpSection() const - { - return m_bHasHelpSection; - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetHelpText( const ::rtl::OUString& _rHelpText ) - { - forEachPage( &OPropertyEditor::setHelpSectionText, &_rHelpText ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ) - { - m_nMinHelpLines = _nMinLines; - m_nMaxHelpLines = _nMaxLines; - forEachPage( &OPropertyEditor::setHelpLineLimits ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::enableHelpSection( OBrowserPage& _rPage, const void* ) - { - _rPage.getListBox().EnableHelpSection( m_bHasHelpSection ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString ) - { - OSL_ENSURE( _pPointerToOUString, "OPropertyEditor::setHelpSectionText: invalid argument!" ); - if ( !_pPointerToOUString ) - return; - - const ::rtl::OUString& rText( *(const ::rtl::OUString*)_pPointerToOUString ); - _rPage.getListBox().SetHelpText( rText ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::setHelpLineLimits( OBrowserPage& _rPage, const void* ) - { - _rPage.getListBox().SetHelpLineLimites( m_nMinHelpLines, m_nMaxHelpLines ); - } - - //------------------------------------------------------------------ - sal_uInt16 OPropertyEditor::InsertEntry( const OLineDescriptor& rData, sal_uInt16 _nPageId, sal_uInt16 nPos ) - { - // let the current page handle this - OBrowserPage* pPage = getPage( _nPageId ); - DBG_ASSERT( pPage, "OPropertyEditor::InsertEntry: don't have such a page!" ); - if ( !pPage ) - return LISTBOX_ENTRY_NOTFOUND; - - sal_uInt16 nEntry = pPage->getListBox().InsertEntry( rData, nPos ); - - OSL_ENSURE( m_aPropertyPageIds.find( rData.sName ) == m_aPropertyPageIds.end(), - "OPropertyEditor::InsertEntry: property already present in the map!" ); - m_aPropertyPageIds.insert( MapStringToPageId::value_type( rData.sName, _nPageId ) ); - - return nEntry; - } - - //------------------------------------------------------------------ - void OPropertyEditor::RemoveEntry( const ::rtl::OUString& _rName ) - { - OBrowserPage* pPage = getPage( _rName ); - if ( pPage ) - { - OSL_VERIFY( pPage->getListBox().RemoveEntry( _rName ) ); - - OSL_ENSURE( m_aPropertyPageIds.find( _rName ) != m_aPropertyPageIds.end(), - "OPropertyEditor::RemoveEntry: property not present in the map!" ); - m_aPropertyPageIds.erase( _rName ); - } - } - - //------------------------------------------------------------------ - void OPropertyEditor::ChangeEntry( const OLineDescriptor& rData ) - { - OBrowserPage* pPage = getPage( rData.sName ); - if ( pPage ) - pPage->getListBox().ChangeEntry( rData, EDITOR_LIST_REPLACE_EXISTING ); - } - - //------------------------------------------------------------------ - void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue, bool _bUnknownValue ) - { - OBrowserPage* pPage = getPage( rEntryName ); - if ( pPage ) - pPage->getListBox().SetPropertyValue( rEntryName, _rValue, _bUnknownValue ); - } - - //------------------------------------------------------------------ - sal_uInt16 OPropertyEditor::GetPropertyPos( const ::rtl::OUString& rEntryName ) const - { - sal_uInt16 nVal=LISTBOX_ENTRY_NOTFOUND; - const OBrowserPage* pPage = getPage( rEntryName ); - if ( pPage ) - nVal = pPage->getListBox().GetPropertyPos( rEntryName ); - return nVal; - } - - //------------------------------------------------------------------ - void OPropertyEditor::ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow ) - { - if ( !_bShow ) - { - sal_uInt16 nPagePos = m_aTabControl.GetPagePos( _nPageId ); - if ( TAB_PAGE_NOTFOUND == nPagePos ) - return; - DBG_ASSERT( m_aHiddenPages.find( _nPageId ) == m_aHiddenPages.end(), "OPropertyEditor::ShowPropertyPage: page already hidden!" ); - - m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl.GetTabPage( _nPageId ) ); - m_aTabControl.RemovePage( _nPageId ); - } - else - { - ::std::map< sal_uInt16, HiddenPage >::iterator aPagePos = m_aHiddenPages.find( _nPageId ); - if ( aPagePos == m_aHiddenPages.end() ) - return; - - aPagePos->second.pPage->SetSizePixel( m_aTabControl.GetTabPageSizePixel() ); - m_aTabControl.InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos ); - m_aTabControl.SetTabPage( aPagePos->first, aPagePos->second.pPage ); - - m_aHiddenPages.erase( aPagePos ); - } - } - - //------------------------------------------------------------------ - void OPropertyEditor::EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ) - { - for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i ) - { - OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) ); - if ( pPage ) - pPage->getListBox().EnablePropertyControls( _rEntryName, _nControls, _bEnable ); - } - } - - //------------------------------------------------------------------ - void OPropertyEditor::EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ) - { - for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i ) - { - OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) ); - if ( pPage ) - pPage->getListBox().EnablePropertyLine( _rEntryName, _bEnable ); - } - } - - //------------------------------------------------------------------ - Reference< XPropertyControl > OPropertyEditor::GetPropertyControl(const ::rtl::OUString& rEntryName) - { - Reference< XPropertyControl > xControl; - // let the current page handle this - OBrowserPage* pPage = static_cast(m_aTabControl.GetTabPage(m_aTabControl.GetCurPageId())); - if (pPage) - xControl = pPage->getListBox().GetPropertyControl(rEntryName); - return xControl; - } - - //------------------------------------------------------------------ - IMPL_LINK(OPropertyEditor, OnPageActivate, TabControl*, EMPTYARG) - { - if (m_aPageActivationHandler.IsSet()) - m_aPageActivationHandler.Call(NULL); - return 0L; - } - - //------------------------------------------------------------------ - IMPL_LINK(OPropertyEditor, OnPageDeactivate, TabControl*, EMPTYARG) - { - // commit the data on the current (to-be-decativated) tab page - // (79404) - sal_Int32 nCurrentId = m_aTabControl.GetCurPageId(); - OBrowserPage* pCurrentPage = static_cast(m_aTabControl.GetTabPage((sal_uInt16)nCurrentId)); - if ( !pCurrentPage ) - return 1L; - - if ( pCurrentPage->getListBox().IsModified() ) - pCurrentPage->getListBox().CommitModified(); - - return 1L; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx deleted file mode 100644 index 451a3f82f..000000000 --- a/extensions/source/propctrlr/propertyeditor.hxx +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ -#define _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ - -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - class IPropertyLineListener; - class IPropertyControlObserver; - class OBrowserPage; - struct OLineDescriptor; - class OBrowserListBox; - - //======================================================================== - //= OPropertyEditor - //======================================================================== - class OPropertyEditor : public Control - { - private: - typedef ::std::map< ::rtl::OUString, sal_uInt16 > MapStringToPageId; - struct HiddenPage - { - sal_uInt16 nPos; - TabPage* pPage; - HiddenPage() : nPos( 0 ), pPage( NULL ) { } - HiddenPage( sal_uInt16 _nPos, TabPage* _pPage ) : nPos( _nPos ), pPage( _pPage ) { } - }; - - private: - TabControl m_aTabControl; - IPropertyLineListener* m_pListener; - IPropertyControlObserver* m_pObserver; - sal_uInt16 m_nNextId; - Link m_aPageActivationHandler; - bool m_bHasHelpSection; - sal_Int32 m_nMinHelpLines; - sal_Int32 m_nMaxHelpLines; - - MapStringToPageId m_aPropertyPageIds; - ::std::map< sal_uInt16, HiddenPage > m_aHiddenPages; - - protected: - void Resize(); - void GetFocus(); - - public: - OPropertyEditor (Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL); - - ~OPropertyEditor(); - - void EnableUpdate(); - void DisableUpdate(); - - void SetLineListener( IPropertyLineListener* ); - void SetControlObserver( IPropertyControlObserver* ); - - void EnableHelpSection( bool _bEnable ); - bool HasHelpSection() const; - void SetHelpText( const ::rtl::OUString& _rHelpText ); - void SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines ); - - void SetHelpId( const rtl::OString& sHelpId ); - sal_uInt16 AppendPage( const String& r, const rtl::OString& _rHelpId ); - void SetPage( sal_uInt16 ); - void RemovePage(sal_uInt16 nID); - sal_uInt16 GetCurPage(); - void ClearAll(); - - void SetPropertyValue(const ::rtl::OUString& _rEntryName, const ::com::sun::star::uno::Any& _rValue, bool _bUnknownValue ); - ::com::sun::star::uno::Any GetPropertyValue(const ::rtl::OUString& rEntryName ) const; - sal_uInt16 GetPropertyPos(const ::rtl::OUString& rEntryName ) const; - ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl > - GetPropertyControl( const ::rtl::OUString& rEntryName ); - void EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable ); - void EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable ); - - void ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow ); - - sal_uInt16 InsertEntry( const OLineDescriptor&, sal_uInt16 _nPageId, sal_uInt16 nPos = EDITOR_LIST_APPEND ); - void RemoveEntry( const ::rtl::OUString& _rName ); - void ChangeEntry( const OLineDescriptor& ); - - void setPageActivationHandler(const Link& _rHdl) { m_aPageActivationHandler = _rHdl; } - Link getPageActivationHandler() const { return m_aPageActivationHandler; } - - // #95343# ------------------------------- - sal_Int32 getMinimumWidth(); - sal_Int32 getMinimumHeight(); - - void CommitModified(); - - protected: - using Window::SetHelpText; - using Window::Update; - - private: - OBrowserPage* getPage( sal_uInt16& _rPageId ); - const OBrowserPage* getPage( sal_uInt16& _rPageId ) const; - - OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ); - const OBrowserPage* getPage( const ::rtl::OUString& _rPropertyName ) const; - - void Update(const ::std::mem_fun_t& _aUpdateFunction); - - typedef void (OPropertyEditor::*PageOperation)( OBrowserPage&, const void* ); - void forEachPage( PageOperation _pOperation, const void* _pArgument = NULL ); - - void setPageLineListener( OBrowserPage& _rPage, const void* ); - void setPageControlObserver( OBrowserPage& _rPage, const void* ); - void enableHelpSection( OBrowserPage& _rPage, const void* ); - void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString ); - void setHelpLineLimits( OBrowserPage& _rPage, const void* ); - - protected: - DECL_LINK(OnPageDeactivate, TabControl*); - DECL_LINK(OnPageActivate, TabControl*); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_PROPERTYEDITOR_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx deleted file mode 100644 index 0571311a6..000000000 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ /dev/null @@ -1,466 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "propertyhandler.hxx" -#include "formmetadata.hxx" -#include "formbrowsertools.hxx" -#include "handlerhelper.hxx" -#include "formstrings.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::inspection; - using namespace ::comphelper; - - //==================================================================== - //= PropertyHandler - //==================================================================== - DBG_NAME( PropertyHandler ) - //-------------------------------------------------------------------- - PropertyHandler::PropertyHandler( const Reference< XComponentContext >& _rxContext ) - :PropertyHandler_Base( m_aMutex ) - ,m_bSupportedPropertiesAreKnown( false ) - ,m_aPropertyListeners( m_aMutex ) - ,m_aContext( _rxContext ) - ,m_pInfoService ( new OPropertyInfoService ) - { - DBG_CTOR( PropertyHandler, NULL ); - - m_xTypeConverter = Reference< XTypeConverter >( - m_aContext.createComponent( "com.sun.star.script.Converter" ), - UNO_QUERY_THROW - ); - } - - //-------------------------------------------------------------------- - PropertyHandler::~PropertyHandler() - { - DBG_DTOR( PropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) throw (RuntimeException, NullPointerException) - { - if ( !_rxIntrospectee.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XPropertySet > xNewComponent( _rxIntrospectee, UNO_QUERY ); - if ( xNewComponent == m_xComponent ) - return; - - // remove all old property change listeners - ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > removeListener = m_aPropertyListeners.createIterator(); - ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > readdListener = m_aPropertyListeners.createIterator(); // will copy the container as needed - while ( removeListener->hasMoreElements() ) - removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener->next() ) ); - OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" ); - - // remember the new component, and give derived classes the chance to react on it - m_xComponent = xNewComponent; - onNewComponent(); - - // add the listeners, again - while ( readdListener->hasMoreElements() ) - addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener->next() ) ); - } - - //-------------------------------------------------------------------- - void PropertyHandler::onNewComponent() - { - if ( m_xComponent.is() ) - m_xComponentPropertyInfo = m_xComponent->getPropertySetInfo(); - else - m_xComponentPropertyInfo.clear(); - - m_bSupportedPropertiesAreKnown = false; - m_aSupportedProperties.realloc( 0 ); - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL PropertyHandler::getSupportedProperties() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_bSupportedPropertiesAreKnown ) - { - m_aSupportedProperties = doDescribeSupportedProperties(); - m_bSupportedPropertiesAreKnown = true; - } - return (Sequence< Property >)m_aSupportedProperties; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - return Sequence< ::rtl::OUString >(); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL PropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - return Sequence< ::rtl::OUString >(); - } - - //-------------------------------------------------------------------- - Any SAL_CALL PropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName ); - Property aProperty( impl_getPropertyFromName_throw( _rPropertyName ) ); - - Any aPropertyValue; - if ( !_rControlValue.hasValue() ) - // NULL is converted to NULL - return aPropertyValue; - - if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 ) - { - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, aProperty.Type, nPropId ) ); - // TODO/UNOize: cache those converters? - aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue ); - } - else - aPropertyValue = PropertyHandlerHelper::convertToPropertyValue( - m_aContext.getContext(),m_xTypeConverter, aProperty, _rControlValue ); - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL PropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName ); - - if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 ) - { - DBG_ASSERT( _rControlValueType.getTypeClass() == TypeClass_STRING, "PropertyHandler::convertToControlValue: ENUM, but not STRING?" ); - - ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), nPropId ) ); - // TODO/UNOize: cache those converters? - return makeAny( aEnumConversion->getDescriptionForValue( _rPropertyValue ) ); - } - - return PropertyHandlerHelper::convertToControlValue( - m_aContext.getContext(),m_xTypeConverter, _rPropertyValue, _rControlValueType ); - } - - //-------------------------------------------------------------------- - PropertyState SAL_CALL PropertyHandler::getPropertyState( const ::rtl::OUString& /*_rPropertyName*/ ) throw (UnknownPropertyException, RuntimeException) - { - return PropertyState_DIRECT_VALUE; - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL PropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - const Property& rProperty( impl_getPropertyFromId_throw( nPropId ) ); - - LineDescriptor aDescriptor; - if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_ENUM ) != 0 ) - { - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( - _rxControlFactory, m_pInfoService->getPropertyEnumRepresentations( nPropId ), - PropertyHandlerHelper::requiresReadOnlyControl( rProperty.Attributes ), sal_False ); - } - else - PropertyHandlerHelper::describePropertyLine( rProperty, aDescriptor, _rxControlFactory ); - - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); - aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - - if ( ( m_pInfoService->getPropertyUIFlags( nPropId ) & PROP_FLAG_DATA_PROPERTY ) != 0 ) - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) ); - else - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) ); - return aDescriptor; - } - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL PropertyHandler::isComposable( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return m_pInfoService->isComposeable( _rPropertyName ); - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL PropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& /*_rPropertyName*/, sal_Bool /*_bPrimary*/, Any& /*_rData*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/ ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - OSL_FAIL( "PropertyHandler::onInteractivePropertySelection: not implemented!" ); - return InteractiveSelectionResult_Cancelled; - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& /*_rActuatingPropertyName*/, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& /*_rxInspectorUI*/, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException) - { - OSL_FAIL( "PropertyHandler::actuatingPropertyChanged: not implemented!" ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rxListener.is() ) - throw NullPointerException(); - m_aPropertyListeners.addListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_aPropertyListeners.removeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL PropertyHandler::suspend( sal_Bool /*_bSuspend*/ ) throw (RuntimeException) - { - return sal_True; - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XCOMPONENT( PropertyHandler, PropertyHandler_Base ) - //-------------------------------------------------------------------- - void SAL_CALL PropertyHandler::disposing() - { - m_xComponent.clear(); - m_aPropertyListeners.clear(); - m_xTypeConverter.clear(); - m_aSupportedProperties.realloc( 0 ); - } - - //-------------------------------------------------------------------- - void PropertyHandler::firePropertyChange( const ::rtl::OUString& _rPropName, PropertyId _nPropId, const Any& _rOldValue, const Any& _rNewValue ) SAL_THROW(()) - { - PropertyChangeEvent aEvent; - aEvent.Source = m_xComponent; - aEvent.PropertyHandle = _nPropId; - aEvent.PropertyName = _rPropName; - aEvent.OldValue = _rOldValue; - aEvent.NewValue = _rNewValue; - m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange ); - } - - //-------------------------------------------------------------------- - const Property* PropertyHandler::impl_getPropertyFromId_nothrow( PropertyId _nPropId ) const - { - const_cast< PropertyHandler* >( this )->getSupportedProperties(); - const Property* pFound = ::std::find_if( m_aSupportedProperties.begin(), m_aSupportedProperties.end(), - FindPropertyByHandle( _nPropId ) - ); - if ( pFound != m_aSupportedProperties.end() ) - return &(*pFound); - return NULL; - } - - //-------------------------------------------------------------------- - const Property& PropertyHandler::impl_getPropertyFromId_throw( PropertyId _nPropId ) const - { - const Property* pProperty = impl_getPropertyFromId_nothrow( _nPropId ); - if ( !pProperty ) - throw UnknownPropertyException(); - - return *pProperty; - } - - //-------------------------------------------------------------------- - const Property& PropertyHandler::impl_getPropertyFromName_throw( const ::rtl::OUString& _rPropertyName ) const - { - const_cast< PropertyHandler* >( this )->getSupportedProperties(); - StlSyntaxSequence< Property >::const_iterator pFound = ::std::find_if( m_aSupportedProperties.begin(), m_aSupportedProperties.end(), - FindPropertyByName( _rPropertyName ) - ); - if ( pFound == m_aSupportedProperties.end() ) - throw UnknownPropertyException(); - - return *pFound; - } - - //-------------------------------------------------------------------- - void PropertyHandler::implAddPropertyDescription( ::std::vector< Property >& _rProperties, const ::rtl::OUString& _rPropertyName, const Type& _rType, sal_Int16 _nAttribs ) const - { - _rProperties.push_back( Property( - _rPropertyName, - m_pInfoService->getPropertyId( _rPropertyName ), - _rType, - _nAttribs - ) ); - } - - //------------------------------------------------------------------------ - Window* PropertyHandler::impl_getDefaultDialogParent_nothrow() const - { - return PropertyHandlerHelper::getDialogParentWindow( m_aContext ); - } - - //------------------------------------------------------------------------ - PropertyId PropertyHandler::impl_getPropertyId_throw( const ::rtl::OUString& _rPropertyName ) const - { - PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName ); - if ( nPropId == -1 ) - throw UnknownPropertyException(); - return nPropId; - } - - //------------------------------------------------------------------------ - void PropertyHandler::impl_setContextDocumentModified_nothrow() const - { - Reference< XModifiable > xModifiable( impl_getContextDocument_nothrow(), UNO_QUERY ); - if ( xModifiable.is() ) - xModifiable->setModified( sal_True ); - } - - //------------------------------------------------------------------------ - bool PropertyHandler::impl_componentHasProperty_throw( const ::rtl::OUString& _rPropName ) const - { - return m_xComponentPropertyInfo.is() && m_xComponentPropertyInfo->hasPropertyByName( _rPropName ); - } - - //-------------------------------------------------------------------- - sal_Int16 PropertyHandler::impl_getDocumentMeasurementUnit_throw() const - { - FieldUnit eUnit = FUNIT_NONE; - - Reference< XServiceInfo > xDocumentSI( impl_getContextDocument_nothrow(), UNO_QUERY ); - OSL_ENSURE( xDocumentSI.is(), "PropertyHandlerHelper::impl_getDocumentMeasurementUnit_throw: No context document - where do I live?" ); - if ( xDocumentSI.is() ) - { - // determine the application type we live in - ::rtl::OUString sConfigurationLocation; - ::rtl::OUString sConfigurationProperty; - if ( xDocumentSI->supportsService( SERVICE_WEB_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.WriterWeb/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_TEXT_DOCUMENT ) ) - { // writer - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Writer/Layout/Other" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MeasureUnit" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) ) - { // calc - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Calc/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_DRAWING_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Draw/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - else if ( xDocumentSI->supportsService( SERVICE_PRESENTATION_DOCUMENT ) ) - { - sConfigurationLocation = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Impress/Layout/Other/MeasureUnit" ) ); - sConfigurationProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); - } - - // read the measurement unit from the configuration - if ( sConfigurationLocation.getLength() && sConfigurationProperty.getLength() ) - { - ::utl::OConfigurationTreeRoot aConfigTree( ::utl::OConfigurationTreeRoot::createWithServiceFactory( - m_aContext.getLegacyServiceFactory(), sConfigurationLocation, -1, ::utl::OConfigurationTreeRoot::CM_READONLY ) ); - sal_Int32 nUnitAsInt = (sal_Int32)FUNIT_NONE; - aConfigTree.getNodeValue( sConfigurationProperty ) >>= nUnitAsInt; - - // if this denotes a valid (and accepted) unit, then use it - if ( ( nUnitAsInt > FUNIT_NONE ) && ( nUnitAsInt <= FUNIT_100TH_MM ) ) - eUnit = static_cast< FieldUnit >( nUnitAsInt ); - } - } - - if ( FUNIT_NONE == eUnit ) - { - MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - eUnit = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; - } - - return VCLUnoHelper::ConvertToMeasurementUnit( eUnit, 1 ); - } - - //==================================================================== - //= PropertyHandlerComponent - //==================================================================== - //------------------------------------------------------------------------ - PropertyHandlerComponent::PropertyHandlerComponent( const Reference< XComponentContext >& _rxContext ) - :PropertyHandler( _rxContext ) - { - } - - //-------------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( PropertyHandlerComponent, PropertyHandler, PropertyHandlerComponent_Base ) - IMPLEMENT_FORWARD_XTYPEPROVIDER2( PropertyHandlerComponent, PropertyHandler, PropertyHandlerComponent_Base ) - - //-------------------------------------------------------------------- - ::sal_Bool SAL_CALL PropertyHandlerComponent::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) - { - StlSyntaxSequence< ::rtl::OUString > aAllServices( getSupportedServiceNames() ); - return ::std::find( aAllServices.begin(), aAllServices.end(), ServiceName ) != aAllServices.end(); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx deleted file mode 100644 index 8e5fa68ea..000000000 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX - -#include "pcrcomponentcontext.hxx" -#include "pcrcommon.hxx" -#include "modulepcr.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -#include -#include - -namespace com { namespace sun { namespace star { - namespace inspection { - struct LineDescriptor; - class XPropertyControlFactory; - } -} } } - -class Window; -//........................................................................ -namespace pcr -{ -//........................................................................ - - typedef sal_Int32 PropertyId; - - //==================================================================== - //= PropertyHandler - //==================================================================== - class OPropertyInfoService; - typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::inspection::XPropertyHandler - > PropertyHandler_Base; - /** the base class for property handlers - */ - class PropertyHandler : public PropertyHandler_Base - { - private: - /// cache for getSupportedProperties - mutable StlSyntaxSequence< ::com::sun::star::beans::Property > - m_aSupportedProperties; - mutable bool m_bSupportedPropertiesAreKnown; - - /// helper which ensures that we can access resources as long as the instance lives - PcrClient m_aEnsureResAccess; - - private: - /// the property listener which has been registered - PropertyChangeListeners m_aPropertyListeners; - - protected: - mutable ::osl::Mutex m_aMutex; - /// the context in which the instance was created - ComponentContext m_aContext; - /// the component we're inspecting - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xComponent; - /// info about our component's properties - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xComponentPropertyInfo; - /// type converter, needed on various occasions - ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter; - /// access to property meta data - ::std::auto_ptr< OPropertyInfoService > m_pInfoService; - - protected: - PropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - ~PropertyHandler(); - - // default implementations for XPropertyHandler - virtual void SAL_CALL inspect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIntrospectee ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isComposable( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException); - - // XComponent - DECLARE_XCOMPONENT() - virtual void SAL_CALL disposing(); - - // own overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const = 0; - - /// called when XPropertyHandler::inspect has been called, and we thus have a new component to inspect - virtual void onNewComponent(); - - protected: - /** fires the change in a property value to our listener (if any) - @see addPropertyChangeListener - */ - void firePropertyChange( const ::rtl::OUString& _rPropName, PropertyId _nPropId, - const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Any& _rNewValue ) SAL_THROW(()); - - /** retrieves a window which can be used as parent for dialogs - */ - Window* impl_getDefaultDialogParent_nothrow() const; - - /** retrieves the property id for a given property name - @throw com::sun::star::beans::UnknownPropertyException - if the property name is not known to our ->m_pInfoService - */ - PropertyId impl_getPropertyId_throw( const ::rtl::OUString& _rPropertyName ) const; - - //------------------------------------------------------------------------------- - // helper for implementing doDescribeSupportedProperties - /** adds a description for the given string property to the given property vector - Most probably to be called from within getSupportedProperties - */ - inline void addStringPropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given int32 property to the given property vector - */ - inline void addInt32PropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given int16 property to the given property vector - */ - inline void addInt16PropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given double property to the given property vector - */ - inline void addDoublePropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given date property to the given property vector - */ - inline void addDatePropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given time property to the given property vector - */ - inline void addTimePropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /** adds a description for the given DateTime property to the given property vector - */ - inline void addDateTimePropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - sal_Int16 _nAttribs = 0 - ) const; - - /// adds a Property, given by name only, to a given vector of Properties - void implAddPropertyDescription( - ::std::vector< ::com::sun::star::beans::Property >& _rProperties, - const ::rtl::OUString& _rPropertyName, - const ::com::sun::star::uno::Type& _rType, - sal_Int16 _nAttribs = 0 - ) const; - - //------------------------------------------------------------------------------- - // helper for accessing and maintaining meta data about our supported properties - - /** retrieves a property given by handle - - @return - a pointer to the descriptor for the given properties, if it is one of our - supported properties, else. - - @see doDescribeSupportedProperties - @see impl_getPropertyFromId_throw - */ - const ::com::sun::star::beans::Property* - impl_getPropertyFromId_nothrow( PropertyId _nPropId ) const; - - /** retrieves a property given by handle - - @throws UnknownPropertyException - if the handler does not support a property with the given handle - - @seealso doDescribeSupportedProperties - @see impl_getPropertyFromId_nothrow - */ - const ::com::sun::star::beans::Property& - impl_getPropertyFromId_throw( PropertyId _nPropId ) const; - - /** determines whether a given property id is part of our supported properties - @see getSupportedProperties - @see doDescribeSupportedProperties - */ - inline bool impl_isSupportedProperty_nothrow( PropertyId _nPropId ) const - { - return impl_getPropertyFromId_nothrow( _nPropId ) != NULL; - } - - /** retrieves a property given by name - - @throws UnknownPropertyException - if the handler does not support a property with the given name - - @seealso doDescribeSupportedProperties - */ - const ::com::sun::star::beans::Property& - impl_getPropertyFromName_throw( const ::rtl::OUString& _rPropertyName ) const; - - /** get the name of a property given by handle - */ - inline ::rtl::OUString - impl_getPropertyNameFromId_nothrow( PropertyId _nPropId ) const; - - /** returns the value of the ContextDocument property in the ComponentContext which was used to create - this handler. - */ - inline ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > - impl_getContextDocument_nothrow() const - { - return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >( - m_aContext.getContextValueByAsciiName( "ContextDocument" ), ::com::sun::star::uno::UNO_QUERY ); - } - - /** marks the context document as modified - - @see impl_getContextDocument_nothrow - */ - void impl_setContextDocumentModified_nothrow() const; - - /// determines whether our component has a given property - bool impl_componentHasProperty_throw( const ::rtl::OUString& _rPropName ) const; - - /** determines the default measure unit for the document in which our component lives - */ - sal_Int16 impl_getDocumentMeasurementUnit_throw() const; - - private: - PropertyHandler(); // never implemented - PropertyHandler( const PropertyHandler& ); // never implemented - PropertyHandler& operator=( const PropertyHandler& ); // never implemented - }; - - //-------------------------------------------------------------------- - inline void PropertyHandler::addStringPropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addInt32PropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< sal_Int32* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addInt16PropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< sal_Int16* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addDoublePropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< double* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addDatePropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< com::sun::star::util::Date* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addTimePropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< com::sun::star::util::Time* >( NULL ) ), _nAttribs ); - } - - inline void PropertyHandler::addDateTimePropertyDescription( ::std::vector< ::com::sun::star::beans::Property >& _rProperties, const ::rtl::OUString& _rPropertyName, sal_Int16 _nAttribs ) const - { - implAddPropertyDescription( _rProperties, _rPropertyName, ::getCppuType( static_cast< com::sun::star::util::DateTime* >( NULL ) ), _nAttribs ); - } - - inline ::rtl::OUString PropertyHandler::impl_getPropertyNameFromId_nothrow( PropertyId _nPropId ) const - { - const ::com::sun::star::beans::Property* pProp = impl_getPropertyFromId_nothrow( _nPropId ); - return pProp ? pProp->Name : ::rtl::OUString(); - } - - //==================================================================== - //= PropertyHandlerComponent - //==================================================================== - typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo - > PropertyHandlerComponent_Base; - /** PropertyHandler implementation which additionally supports XServiceInfo - */ - class PropertyHandlerComponent :public PropertyHandler - ,public PropertyHandlerComponent_Base - { - protected: - PropertyHandlerComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - DECLARE_XINTERFACE() - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0; - 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) = 0; - }; - - //==================================================================== - //= HandlerComponentBase - //==================================================================== - /** a PropertyHandlerComponent implementation which routes XServiceInfo::getImplementationName and - XServiceInfo::getSupportedServiceNames to static versions of those methods, which are part of - the derived class. - - Additionally, a method Create is provided which takes a component context, and returns a new - instance of the derived class. This Create is used to register the implementation - of the derived class at the PcrModule. - - Well, every time we're talking about derived class, we in fact mean the template argument of - HandlerComponentBase. But usually this equals your derived class: -
          -        class MyHandler;
          -        typedef HandlerComponentBase< MyHandler > MyHandler_Base;
          -        class MyHandler : MyHandler_Base
          -        {
          -            ...
          -        public:
          -            static ::rtl::OUString SAL_CALL getImplementationName_static(  ) throw (::com::sun::star::uno::RuntimeException);
          -            static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(  ) throw (::com::sun::star::uno::RuntimeException);
          -        };
          -        
          - */ - template < class HANDLER > - class HandlerComponentBase : public PropertyHandlerComponent - { - protected: - HandlerComponentBase( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) - :PropertyHandlerComponent( _rxContext ) - { - } - - protected: - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); - - public: - /** registers the implementation of HANDLER at the PcrModule - */ - static void registerImplementation(); - }; - - //-------------------------------------------------------------------- - template < class HANDLER > - ::rtl::OUString SAL_CALL HandlerComponentBase< HANDLER >::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) - { - return HANDLER::getImplementationName_static(); - } - - //-------------------------------------------------------------------- - template < class HANDLER > - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL HandlerComponentBase< HANDLER >::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) - { - return HANDLER::getSupportedServiceNames_static(); - } - - //-------------------------------------------------------------------- - template < class HANDLER > - void HandlerComponentBase< HANDLER >::registerImplementation() - { - PcrModule::getInstance().registerImplementation( - HANDLER::getImplementationName_static(), - HANDLER::getSupportedServiceNames_static(), - HANDLER::Create - ); - } - - //-------------------------------------------------------------------- - template < class HANDLER > - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL HandlerComponentBase< HANDLER >::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) - { - return *( new HANDLER( _rxContext ) ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPERTYHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propertyinfo.hxx b/extensions/source/propctrlr/propertyinfo.hxx deleted file mode 100644 index df7f65bf4..000000000 --- a/extensions/source/propctrlr/propertyinfo.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_PROPERTYINFO_HXX_ -#define _EXTENSIONS_PROPCTRLR_PROPERTYINFO_HXX_ - -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= IPropertyInfoService - //======================================================================== - class SAL_NO_VTABLE IPropertyInfoService - { - public: - virtual sal_Int32 getPropertyId(const String& _rName) const = 0; - virtual String getPropertyTranslation(sal_Int32 _nId) const = 0; - virtual rtl::OString getPropertyHelpId(sal_Int32 _nId) const = 0; - virtual sal_Int16 getPropertyPos(sal_Int32 _nId) const = 0; - virtual sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const = 0; - virtual ::std::vector< ::rtl::OUString > getPropertyEnumRepresentations(sal_Int32 _nId) const = 0; - - // this is only temporary, until the UNOization of the property browser is completed - virtual String getPropertyName( sal_Int32 _nPropId ) = 0; - - virtual ~IPropertyInfoService() { } - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_PROPERTYINFO_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propeventtranslation.cxx b/extensions/source/propctrlr/propeventtranslation.cxx deleted file mode 100644 index d3dabd93f..000000000 --- a/extensions/source/propctrlr/propeventtranslation.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "propeventtranslation.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::beans::PropertyChangeEvent; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::uno::Reference; - using ::com::sun::star::beans::XPropertyChangeListener; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::beans::PropertyChangeEvent; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::NullPointerException; - /** === end UNO using === **/ - - //==================================================================== - //= PropertyEventTranslation - //==================================================================== - //-------------------------------------------------------------------- - PropertyEventTranslation::PropertyEventTranslation( const Reference< XPropertyChangeListener >& _rxDelegator, - const Reference< XInterface >& _rxTranslatedEventSource ) - :m_xDelegator( _rxDelegator ) - ,m_xTranslatedEventSource( _rxTranslatedEventSource ) - { - if ( !m_xDelegator.is() ) - throw NullPointerException(); - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyEventTranslation::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException) - { - if ( !m_xDelegator.is() ) - throw DisposedException(); - - if ( !m_xTranslatedEventSource.is() ) - m_xDelegator->propertyChange( evt ); - else - { - PropertyChangeEvent aTranslatedEvent( evt ); - aTranslatedEvent.Source = m_xTranslatedEventSource; - m_xDelegator->propertyChange( aTranslatedEvent ); - } - } - - //-------------------------------------------------------------------- - void SAL_CALL PropertyEventTranslation::disposing( const EventObject& Source ) throw (RuntimeException) - { - if ( !m_xDelegator.is() ) - throw DisposedException(); - - if ( !m_xTranslatedEventSource.is() ) - m_xDelegator->disposing( Source ); - else - { - EventObject aTranslatedEvent( Source ); - aTranslatedEvent.Source = m_xTranslatedEventSource; - m_xDelegator->disposing( aTranslatedEvent ); - } - - m_xDelegator.clear(); - m_xTranslatedEventSource.clear(); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propeventtranslation.hxx b/extensions/source/propctrlr/propeventtranslation.hxx deleted file mode 100644 index c5f5c8165..000000000 --- a/extensions/source/propctrlr/propeventtranslation.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= PropertyEventTranslation - //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener - > PropertyEventTranslation_Base; - - class PropertyEventTranslation : public PropertyEventTranslation_Base - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > - m_xDelegator; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - m_xTranslatedEventSource; - - public: - /** constructs the object - @throws NullPointerException - if _rxDelegator is - */ - PropertyEventTranslation( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxDelegator, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxTranslatedEventSource - ); - - inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& - getDelegator() const { return m_xDelegator; } - - protected: - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) 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: - PropertyEventTranslation(); // never implemented - PropertyEventTranslation( const PropertyEventTranslation& ); // never implemented - PropertyEventTranslation& operator=( const PropertyEventTranslation& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_PROPEVENTTRANSLATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/proplinelistener.hxx b/extensions/source/propctrlr/proplinelistener.hxx deleted file mode 100644 index e1eb39e64..000000000 --- a/extensions/source/propctrlr/proplinelistener.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_PROPLINELISTENER_HXX_ -#define _EXTENSIONS_PROPCTRLR_PROPLINELISTENER_HXX_ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - class IPropertyLineListener - { - public: - virtual void Clicked( const ::rtl::OUString& _rName, sal_Bool _bPrimary ) = 0; - virtual void Commit( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& _rVal ) = 0; - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_PROPLINELISTENER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propres.src b/extensions/source/propctrlr/propres.src deleted file mode 100644 index 6449f86f0..000000000 --- a/extensions/source/propctrlr/propres.src +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "propresid.hrc" -#endif -#include "formresid.hrc" - -String RID_STR_STANDARD -{ - Text [ en-US ] = "Default" ; -}; -String RID_STR_PROPPAGE_DEFAULT -{ - Text [ en-US ] = "General" ; -}; -String RID_STR_PROPPAGE_DATA -{ - Text [ en-US ] = "Data" ; -}; -Resource RID_RSC_ENUM_YESNO -{ - String 1 - { - Text [ en-US ] = "No" ; - }; - String 2 - { - Text [ en-US ] = "Yes" ; - }; -}; -String RID_STR_HELP_SECTION_LABEL -{ - Text [ en-US ] = "Help"; -}; -String RID_EMBED_IMAGE_PLACEHOLDER -{ - Text [ en-US ] = ""; -}; - -String RID_STR_TEXT_FORMAT -{ - Text [ en-US ] = "Text"; -}; diff --git a/extensions/source/propctrlr/propresid.hrc b/extensions/source/propctrlr/propresid.hrc deleted file mode 100644 index e1fc83667..000000000 --- a/extensions/source/propctrlr/propresid.hrc +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#define EXTENSIONS_PROPRESID_HRC - -// TODO: create a new resource range in - -#define RID_PROPCONTROLLER_START 1000 - // arbitrary at the moment -#define RID_FORMBROWSER_START RID_PROPCONTROLLER_START + 2000 - -// ----------------------------------------------------------------------- -// - Strings -// ----------------------------------------------------------------------- - -#define RID_STR_STANDARD ( RID_PROPCONTROLLER_START + 0 ) -#define RID_STR_PROPPAGE_DEFAULT ( RID_PROPCONTROLLER_START + 1 ) -#define RID_STR_PROPPAGE_DATA ( RID_PROPCONTROLLER_START + 2 ) -#define RID_STR_HELP_SECTION_LABEL ( RID_PROPCONTROLLER_START + 3 ) -#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 4 ) -#define RID_STR_TEXT_FORMAT ( RID_PROPCONTROLLER_START + 5 ) - -#endif // EXTENSIONS_PROPRESID_HRC diff --git a/extensions/source/propctrlr/pushbuttonnavigation.cxx b/extensions/source/propctrlr/pushbuttonnavigation.cxx deleted file mode 100644 index dc1486676..000000000 --- a/extensions/source/propctrlr/pushbuttonnavigation.cxx +++ /dev/null @@ -1,309 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "pushbuttonnavigation.hxx" -#include -#include -#include "formstrings.hxx" -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::form; - - //------------------------------------------------------------------------ - namespace - { - static const sal_Int32 s_nFirstVirtualButtonType = 1 + (sal_Int32)FormButtonType_URL; - - static const sal_Char* pNavigationURLs[] = - { - ".uno:FormController/moveToFirst", - ".uno:FormController/moveToPrev", - ".uno:FormController/moveToNext", - ".uno:FormController/moveToLast", - ".uno:FormController/saveRecord", - ".uno:FormController/undoRecord", - ".uno:FormController/moveToNew", - ".uno:FormController/deleteRecord", - ".uno:FormController/refreshForm", - NULL - }; - - static sal_Int32 lcl_getNavigationURLIndex( const ::rtl::OUString& _rNavURL ) - { - const sal_Char** pLookup = pNavigationURLs; - while ( *pLookup ) - { - if ( _rNavURL.equalsAscii( *pLookup ) ) - return pLookup - pNavigationURLs; - ++pLookup; - } - return -1; - } - - static const sal_Char* lcl_getNavigationURL( sal_Int32 _nButtonTypeIndex ) - { - const sal_Char** pLookup = pNavigationURLs; - while ( _nButtonTypeIndex-- && *pLookup++ ) - ; - OSL_ENSURE( *pLookup, "lcl_getNavigationURL: invalid index!" ); - return *pLookup; - } - } - - //======================================================================== - //= PushButtonNavigation - //======================================================================== - //------------------------------------------------------------------------ - PushButtonNavigation::PushButtonNavigation( const Reference< XPropertySet >& _rxControlModel ) - :m_xControlModel( _rxControlModel ) - ,m_bIsPushButton( sal_False ) - { - OSL_ENSURE( m_xControlModel.is(), "PushButtonNavigation::PushButtonNavigation: invalid control model!" ); - - try - { - m_bIsPushButton = ::comphelper::hasProperty( PROPERTY_BUTTONTYPE, m_xControlModel ); - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::PushButtonNavigation: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - sal_Int32 PushButtonNavigation::implGetCurrentButtonType() const SAL_THROW((Exception)) - { - sal_Int32 nButtonType = FormButtonType_PUSH; - if ( !m_xControlModel.is() ) - return nButtonType; - OSL_VERIFY( ::cppu::enum2int( nButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); - - if ( nButtonType == FormButtonType_URL ) - { - // there's a chance that this is a "virtual" button type - // (which are realized by special URLs) - ::rtl::OUString sTargetURL; - m_xControlModel->getPropertyValue( PROPERTY_TARGET_URL ) >>= sTargetURL; - - sal_Int32 nNavigationURLIndex = lcl_getNavigationURLIndex( sTargetURL ); - if ( nNavigationURLIndex >= 0) - // it actually *is* a virtual button type - nButtonType = s_nFirstVirtualButtonType + nNavigationURLIndex; - } - return nButtonType; - } - - //------------------------------------------------------------------------ - Any PushButtonNavigation::getCurrentButtonType() const SAL_THROW(()) - { - OSL_ENSURE( m_bIsPushButton, "PushButtonNavigation::getCurrentButtonType: not expected to be called for forms!" ); - Any aReturn; - - try - { - aReturn <<= implGetCurrentButtonType(); - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::getCurrentButtonType: caught an exception!" ); - } - return aReturn; - } - - //------------------------------------------------------------------------ - void PushButtonNavigation::setCurrentButtonType( const Any& _rValue ) const SAL_THROW(()) - { - OSL_ENSURE( m_bIsPushButton, "PushButtonNavigation::setCurrentButtonType: not expected to be called for forms!" ); - if ( !m_xControlModel.is() ) - return; - - try - { - sal_Int32 nButtonType = FormButtonType_PUSH; - OSL_VERIFY( ::cppu::enum2int( nButtonType, _rValue ) ); - ::rtl::OUString sTargetURL; - - bool bIsVirtualButtonType = nButtonType >= s_nFirstVirtualButtonType; - if ( bIsVirtualButtonType ) - { - const sal_Char* pURL = lcl_getNavigationURL( nButtonType - s_nFirstVirtualButtonType ); - sTargetURL = ::rtl::OUString::createFromAscii( pURL ); - - nButtonType = FormButtonType_URL; - } - - m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, makeAny( static_cast< FormButtonType >( nButtonType ) ) ); - m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, makeAny( sTargetURL ) ); - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::setCurrentButtonType: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - PropertyState PushButtonNavigation::getCurrentButtonTypeState( ) const SAL_THROW(()) - { - OSL_ENSURE( m_bIsPushButton, "PushButtonNavigation::getCurrentButtonTypeState: not expected to be called for forms!" ); - PropertyState eState = PropertyState_DIRECT_VALUE; - - try - { - Reference< XPropertyState > xStateAccess( m_xControlModel, UNO_QUERY ); - if ( xStateAccess.is() ) - { - // let's see what the model says about the ButtonType property - eState = xStateAccess->getPropertyState( PROPERTY_BUTTONTYPE ); - if ( eState == PropertyState_DIRECT_VALUE ) - { - sal_Int32 nRealButtonType = FormButtonType_PUSH; - OSL_VERIFY( ::cppu::enum2int( nRealButtonType, m_xControlModel->getPropertyValue( PROPERTY_BUTTONTYPE ) ) ); - // perhaps it's one of the virtual button types? - if ( FormButtonType_URL == nRealButtonType ) - { - // yes, it is -> rely on the state of the URL property - eState = xStateAccess->getPropertyState( PROPERTY_TARGET_URL ); - } - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::getCurrentButtonTypeState: caught an exception!" ); - } - - return eState; - } - - //------------------------------------------------------------------------ - Any PushButtonNavigation::getCurrentTargetURL() const SAL_THROW(()) - { - Any aReturn; - if ( !m_xControlModel.is() ) - return aReturn; - - try - { - aReturn = m_xControlModel->getPropertyValue( PROPERTY_TARGET_URL ); - if ( m_bIsPushButton ) - { - sal_Int32 nCurrentButtonType = implGetCurrentButtonType(); - bool bIsVirtualButtonType = nCurrentButtonType >= s_nFirstVirtualButtonType; - if ( bIsVirtualButtonType ) - { - // pretend (to the user) that there's no URL set - since - // virtual button types imply a special (technical) URL which - // the user should not see - aReturn <<= ::rtl::OUString(); - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::getCurrentTargetURL: caught an exception!" ); - } - return aReturn; - } - - //------------------------------------------------------------------------ - void PushButtonNavigation::setCurrentTargetURL( const Any& _rValue ) const SAL_THROW(()) - { - if ( !m_xControlModel.is() ) - return; - - try - { - m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, _rValue ); - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::setCurrentTargetURL: caught an exception!" ); - } - } - - //------------------------------------------------------------------------ - PropertyState PushButtonNavigation::getCurrentTargetURLState( ) const SAL_THROW(()) - { - PropertyState eState = PropertyState_DIRECT_VALUE; - - try - { - Reference< XPropertyState > xStateAccess( m_xControlModel, UNO_QUERY ); - if ( xStateAccess.is() ) - { - eState = xStateAccess->getPropertyState( PROPERTY_TARGET_URL ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "PushButtonNavigation::setCurrentTargetURL: caught an exception!" ); - } - - return eState; - } - - //------------------------------------------------------------------------ - bool PushButtonNavigation::currentButtonTypeIsOpenURL() const - { - sal_Int32 nButtonType( FormButtonType_PUSH ); - try - { - nButtonType = implGetCurrentButtonType(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return nButtonType == FormButtonType_URL; - } - - //------------------------------------------------------------------------ - bool PushButtonNavigation::hasNonEmptyCurrentTargetURL() const - { - ::rtl::OUString sTargetURL; - OSL_VERIFY( getCurrentTargetURL() >>= sTargetURL ); - return sTargetURL.getLength() != 0; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pushbuttonnavigation.hxx b/extensions/source/propctrlr/pushbuttonnavigation.hxx deleted file mode 100644 index 3626e4234..000000000 --- a/extensions/source/propctrlr/pushbuttonnavigation.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX -#define EXTENSIONS_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= PushButtonNavigation - //======================================================================== - class PushButtonNavigation - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - m_xControlModel; - sal_Bool m_bIsPushButton; - - public: - /** ctor - @param _rxControlModel - the control model which is or will be bound - */ - PushButtonNavigation( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel - ); - - /** returns the current value of the "ButtonType" property, taking into account - the "virtual" button types such as "move-to-next-record button". - */ - ::com::sun::star::uno::Any - getCurrentButtonType() const SAL_THROW(()); - - /** sets the current value of the "ButtonType" property, taking into account - the "virtual" button types such as "move-to-next-record button". - */ - void setCurrentButtonType( const ::com::sun::star::uno::Any& _rValue ) const SAL_THROW(()); - - /** retrieves the current state of the "ButtonType" property, taking into account - the "virtual" button types such as "move-to-next-record button". - */ - ::com::sun::star::beans::PropertyState - getCurrentButtonTypeState( ) const SAL_THROW(()); - - /** returns the current value of the "TargetURL" property, taking into account - that some URLs are special values caused by "virtual" ButtonTypes - */ - ::com::sun::star::uno::Any - getCurrentTargetURL() const SAL_THROW(()); - - /** sets the current value of the "TargetURL" property, taking into account - that some URLs are special values caused by "virtual" ButtonTypes - */ - void setCurrentTargetURL( const ::com::sun::star::uno::Any& _rValue ) const SAL_THROW(()); - - /** retrieves the current state of the "TargetURL" property, taking into account - that some URLs are special values caused by "virtual" ButtonTypes - */ - ::com::sun::star::beans::PropertyState - getCurrentTargetURLState( ) const SAL_THROW(()); - - /** determines whether the current button tpye is FormButtonType_URL - */ - bool currentButtonTypeIsOpenURL() const; - - /** determines whether the TargetURL property does currently denote a non-empty string - */ - bool hasNonEmptyCurrentTargetURL() const; - - private: - sal_Int32 implGetCurrentButtonType() const SAL_THROW(( ::com::sun::star::uno::Exception )); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // EXTENSIONS_PROPCTRLR_PUSHBUTTONNAVIGATION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx deleted file mode 100644 index 31a0e54b7..000000000 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "selectlabeldialog.hxx" -#include "formresid.hrc" -#include "formbrowsertools.hxx" -#include "formstrings.hxx" -#include -#include -#include -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::lang; - - //======================================================================== - // OSelectLabelDialog - //======================================================================== - DBG_NAME(OSelectLabelDialog) - //------------------------------------------------------------------------ - OSelectLabelDialog::OSelectLabelDialog( Window* pParent, Reference< XPropertySet > _xControlModel ) - :ModalDialog(pParent, PcrRes(RID_DLG_SELECTLABELCONTROL)) - ,m_aMainDesc(this, PcrRes(1)) - ,m_aControlTree(this, PcrRes(1)) - ,m_aNoAssignment(this, PcrRes(1)) - ,m_aSeparator(this, PcrRes(1)) - ,m_aOk(this, PcrRes(1)) - ,m_aCancel(this, PcrRes(1)) - ,m_aModelImages(PcrRes(RID_IL_FORMEXPLORER)) - ,m_xControlModel(_xControlModel) - ,m_pInitialSelection(NULL) - ,m_pLastSelected(NULL) - ,m_bHaveAssignableControl(sal_False) - { - DBG_CTOR(OSelectLabelDialog,NULL); - - // initialize the TreeListBox - m_aControlTree.SetSelectionMode( SINGLE_SELECTION ); - m_aControlTree.SetDragDropMode( 0 ); - m_aControlTree.EnableInplaceEditing( sal_False ); - m_aControlTree.SetStyle(m_aControlTree.GetStyle() | WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HSCROLL); - - m_aControlTree.SetNodeBitmaps( m_aModelImages.GetImage( RID_SVXIMG_COLLAPSEDNODE ), m_aModelImages.GetImage( RID_SVXIMG_EXPANDEDNODE ) ); - m_aControlTree.SetSelectHdl(LINK(this, OSelectLabelDialog, OnEntrySelected)); - m_aControlTree.SetDeselectHdl(LINK(this, OSelectLabelDialog, OnEntrySelected)); - - // fill the description - UniString sDescription = m_aMainDesc.GetText(); - sal_Int16 nClassID = FormComponentType::CONTROL; - if (::comphelper::hasProperty(PROPERTY_CLASSID, m_xControlModel)) - nClassID = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); - - sDescription.SearchAndReplace(String::CreateFromAscii("$control_class$"), GetUIHeadlineName(nClassID, makeAny(m_xControlModel))); - UniString sName = ::comphelper::getString(m_xControlModel->getPropertyValue(PROPERTY_NAME)).getStr(); - sDescription.SearchAndReplace(String::CreateFromAscii("$control_name$"), sName); - m_aMainDesc.SetText(sDescription); - - // search for the root of the form hierarchy - Reference< XChild > xCont(m_xControlModel, UNO_QUERY); - Reference< XInterface > xSearch( xCont.is() ? xCont->getParent() : Reference< XInterface > ()); - Reference< XResultSet > xParentAsResultSet(xSearch, UNO_QUERY); - while (xParentAsResultSet.is()) - { - xCont = Reference< XChild > (xSearch, UNO_QUERY); - xSearch = xCont.is() ? xCont->getParent() : Reference< XInterface > (); - xParentAsResultSet = Reference< XResultSet > (xSearch, UNO_QUERY); - } - - // and insert all entries below this root into the listbox - if (xSearch.is()) - { - // check wich service the allowed components must suppport - sal_Int16 nClassId = 0; - try { nClassId = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); } catch(...) { } - m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? SERVICE_COMPONENT_GROUPBOX : SERVICE_COMPONENT_FIXEDTEXT; - m_aRequiredControlImage = m_aModelImages.GetImage((FormComponentType::RADIOBUTTON == nClassId) ? RID_SVXIMG_GROUPBOX : RID_SVXIMG_FIXEDTEXT); - - // calc the currently set label control (so InsertEntries can calc m_pInitialSelection) - Any aCurrentLabelControl( m_xControlModel->getPropertyValue(PROPERTY_CONTROLLABEL) ); - DBG_ASSERT((aCurrentLabelControl.getValueTypeClass() == TypeClass_INTERFACE) || !aCurrentLabelControl.hasValue(), - - "OSelectLabelDialog::OSelectLabelDialog : invalid ControlLabel property !"); - if (aCurrentLabelControl.hasValue()) - aCurrentLabelControl >>= m_xInitialLabelControl; - - // insert the root - Image aRootImage = m_aModelImages.GetImage(RID_SVXIMG_FORMS); - SvLBoxEntry* pRoot = m_aControlTree.InsertEntry(PcrRes(RID_STR_FORMS), aRootImage, aRootImage); - - // build the tree - m_pInitialSelection = NULL; - m_bHaveAssignableControl = sal_False; - InsertEntries(xSearch, pRoot); - m_aControlTree.Expand(pRoot); - } - - if (m_pInitialSelection) - { - m_aControlTree.MakeVisible(m_pInitialSelection, sal_True); - m_aControlTree.Select(m_pInitialSelection, sal_True); - } - else - { - m_aControlTree.MakeVisible(m_aControlTree.First(), sal_True); - if (m_aControlTree.FirstSelected()) - m_aControlTree.Select(m_aControlTree.FirstSelected(), sal_False); - m_aNoAssignment.Check(sal_True); - } - - if (!m_bHaveAssignableControl) - { // no controls which can be assigned - m_aNoAssignment.Check(sal_True); - m_aNoAssignment.Enable(sal_False); - } - - m_aNoAssignment.SetClickHdl(LINK(this, OSelectLabelDialog, OnNoAssignmentClicked)); - m_aNoAssignment.GetClickHdl().Call(&m_aNoAssignment); - - FreeResource(); - } - - //------------------------------------------------------------------------ - OSelectLabelDialog::~OSelectLabelDialog() - { - // delete the entry datas of the listbox entries - SvLBoxEntry* pLoop = m_aControlTree.First(); - while (pLoop) - { - void* pData = pLoop->GetUserData(); - if (pData) - delete (Reference< XPropertySet > *)pData; - pLoop = m_aControlTree.Next(pLoop); - } - - DBG_DTOR(OSelectLabelDialog,NULL); - } - - //------------------------------------------------------------------------ - sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, SvLBoxEntry* pContainerEntry) - { - Reference< XIndexAccess > xContainer(_xContainer, UNO_QUERY); - if (!xContainer.is()) - return 0; - - sal_Int32 nChildren = 0; - UniString sName,sDisplayName; - Reference< XPropertySet > xAsSet; - for (sal_Int32 i=0; igetCount(); ++i) - { - xContainer->getByIndex(i) >>= xAsSet; - if (!xAsSet.is()) - { - DBG_WARNING("OSelectLabelDialog::InsertEntries : strange : a form component which isn't a property set !"); - continue; - } - - if (!::comphelper::hasProperty(PROPERTY_NAME, xAsSet)) - // we need at least a name for displaying ... - continue; - sName = ::comphelper::getString(xAsSet->getPropertyValue(PROPERTY_NAME)).getStr(); - - // we need to check if the control model supports the required service - Reference< XServiceInfo > xInfo(xAsSet, UNO_QUERY); - if (!xInfo.is()) - continue; - - if (!xInfo->supportsService(m_sRequiredService)) - { // perhaps it is a container - Reference< XIndexAccess > xCont(xAsSet, UNO_QUERY); - if (xCont.is() && xCont->getCount()) - { // yes -> step down - Image aFormImage = m_aModelImages.GetImage( RID_SVXIMG_FORM ); - SvLBoxEntry* pCont = m_aControlTree.InsertEntry(sName, aFormImage, aFormImage, pContainerEntry); - sal_Int32 nContChildren = InsertEntries(xCont, pCont); - if (nContChildren) - { - m_aControlTree.Expand(pCont); - ++nChildren; - } - else - { // oops, no valid childs -> remove the entry - m_aControlTree.ModelIsRemoving(pCont); - m_aControlTree.GetModel()->Remove(pCont); - m_aControlTree.ModelHasRemoved(pCont); - } - } - continue; - } - - // get the label - if (!::comphelper::hasProperty(PROPERTY_LABEL, xAsSet)) - continue; - sDisplayName = ::comphelper::getString(xAsSet->getPropertyValue(PROPERTY_LABEL)).getStr(); - sDisplayName += String::CreateFromAscii(" ("); - sDisplayName += sName; - sDisplayName += ')'; - - // all requirements met -> insert - SvLBoxEntry* pCurrent = m_aControlTree.InsertEntry(sDisplayName, m_aRequiredControlImage, m_aRequiredControlImage, pContainerEntry); - pCurrent->SetUserData(new Reference< XPropertySet > (xAsSet)); - ++nChildren; - - if (m_xInitialLabelControl == xAsSet) - m_pInitialSelection = pCurrent; - - m_bHaveAssignableControl = sal_True; - } - - return nChildren; - } - - //------------------------------------------------------------------------ - IMPL_LINK(OSelectLabelDialog, OnEntrySelected, SvTreeListBox*, pLB) - { - DBG_ASSERT(pLB == &m_aControlTree, "OSelectLabelDialog::OnEntrySelected : where did this come from ?"); - (void)pLB; - SvLBoxEntry* pSelected = m_aControlTree.FirstSelected(); - void* pData = pSelected ? pSelected->GetUserData() : NULL; - - if (pData) - m_xSelectedControl = Reference< XPropertySet > (*(Reference< XPropertySet > *)pData); - - m_aNoAssignment.SetClickHdl(Link()); - m_aNoAssignment.Check(pData == NULL); - m_aNoAssignment.SetClickHdl(LINK(this, OSelectLabelDialog, OnNoAssignmentClicked)); - - return 0L; - } - - //------------------------------------------------------------------------ - IMPL_LINK(OSelectLabelDialog, OnNoAssignmentClicked, Button*, pButton) - { - DBG_ASSERT(pButton == &m_aNoAssignment, "OSelectLabelDialog::OnNoAssignmentClicked : where did this come from ?"); - (void)pButton; - - if (m_aNoAssignment.IsChecked()) - m_pLastSelected = m_aControlTree.FirstSelected(); - else - { - DBG_ASSERT(m_bHaveAssignableControl, "OSelectLabelDialog::OnNoAssignmentClicked"); - // search the first assignable entry - SvLBoxEntry* pSearch = m_aControlTree.First(); - while (pSearch) - { - if (pSearch->GetUserData()) - break; - pSearch = m_aControlTree.Next(pSearch); - } - // and select it - if (pSearch) - { - m_aControlTree.Select(pSearch); - m_pLastSelected = pSearch; - } - } - - if (m_pLastSelected) - { - m_aControlTree.SetSelectHdl(Link()); - m_aControlTree.SetDeselectHdl(Link()); - m_aControlTree.Select(m_pLastSelected, !m_aNoAssignment.IsChecked()); - m_aControlTree.SetSelectHdl(LINK(this, OSelectLabelDialog, OnEntrySelected)); - m_aControlTree.SetDeselectHdl(LINK(this, OSelectLabelDialog, OnEntrySelected)); - } - - return 0L; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx deleted file mode 100644 index bb713b875..000000000 --- a/extensions/source/propctrlr/selectlabeldialog.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_SELECTLABELDIALOG_HXX_ -#define _EXTENSIONS_PROPCTRLR_SELECTLABELDIALOG_HXX_ - -#include -#include -#include -#include -#include -#include -#include "modulepcr.hxx" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - // OSelectLabelDialog - //======================================================================== - class OSelectLabelDialog - :public ModalDialog - ,public PcrClient - { - FixedText m_aMainDesc; - SvTreeListBox m_aControlTree; - CheckBox m_aNoAssignment; - FixedLine m_aSeparator; - OKButton m_aOk; - CancelButton m_aCancel; - - ImageList m_aModelImages; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xControlModel; - ::rtl::OUString m_sRequiredService; - Image m_aRequiredControlImage; - SvLBoxEntry* m_pInitialSelection; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xInitialLabelControl; - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelectedControl; - SvLBoxEntry* m_pLastSelected; - sal_Bool m_bHaveAssignableControl; - - public: - OSelectLabelDialog(Window* pParent, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xControlModel); - ~OSelectLabelDialog(); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetSelected() const { return m_aNoAssignment.IsChecked() ? ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > () : m_xSelectedControl; } - - protected: - sal_Int32 InsertEntries(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xContainer, SvLBoxEntry* pContainerEntry); - - DECL_LINK(OnEntrySelected, SvTreeListBox*); - DECL_LINK(OnNoAssignmentClicked, Button*); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_SELECTLABELDIALOG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/selectlabeldialog.src b/extensions/source/propctrlr/selectlabeldialog.src deleted file mode 100644 index ab961c456..000000000 --- a/extensions/source/propctrlr/selectlabeldialog.src +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_PROPRESID_HRC -#include "formresid.hrc" -#endif - -ModalDialog RID_DLG_SELECTLABELCONTROL -{ - HelpID = "extensions:ModalDialog:RID_DLG_SELECTLABELCONTROL"; - OutputSize = TRUE; - Size = MAP_APPFONT( 200, 151 ); - Moveable = TRUE; - Closeable = TRUE; - FixedText 1 - { - Pos = MAP_APPFONT( 6, 6 ); - Size = MAP_APPFONT( 188, 20 ); - WordBreak = TRUE; - Text [ en-US ] = "These are control fields that can be used as label fields for the $control_class$ $control_name$."; - }; - Control 1 - { - Pos = MAP_APPFONT( 6, 29 ); - Size = MAP_APPFONT( 188, 83 ); - TabStop = TRUE; - Border = TRUE ; - }; - CheckBox 1 - { - HelpID = "extensions:CheckBox:RID_DLG_SELECTLABELCONTROL:1"; - Pos = MAP_APPFONT( 6, 115 ); - Size = MAP_APPFONT( 188, 8 ); - Text [ en-US ] = "~No assignment"; - }; - FixedLine 1 - { - Pos = MAP_APPFONT( 3, 126 ); - Size = MAP_APPFONT( 194, 2 ); - }; - OKButton 1 - { - Pos = MAP_APPFONT ( 91 , 131 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton 1 - { - Pos = MAP_APPFONT ( 144 , 131 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Text [ en-US ] = "Label Field Selection"; -}; - -String RID_STR_FORMS -{ - Text [ en-US ] = "Forms" ; -}; - diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx deleted file mode 100644 index d7abbc8b6..000000000 --- a/extensions/source/propctrlr/sqlcommanddesign.cxx +++ /dev/null @@ -1,391 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "sqlcommanddesign.hxx" -#include "formstrings.hxx" -#include "formresid.hrc" -#include "modulepcr.hxx" -#include "unourl.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::lang::XMultiComponentFactory; - using ::com::sun::star::beans::PropertyChangeEvent; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::awt::XTopWindow; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::lang::XComponent; - using ::com::sun::star::frame::XComponentLoader; - using ::com::sun::star::beans::XPropertySet; - using ::com::sun::star::beans::XPropertySetInfo; - using ::com::sun::star::frame::XController; - using ::com::sun::star::frame::XTitle; - using ::com::sun::star::lang::EventObject; - using ::com::sun::star::lang::NullPointerException; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::frame::XFramesSupplier; - using ::com::sun::star::frame::XFrames; - using ::com::sun::star::util::XCloseable; - using ::com::sun::star::uno::TypeClass_STRING; - using ::com::sun::star::lang::XMultiServiceFactory; - using ::com::sun::star::frame::XDispatchProvider; - using ::com::sun::star::frame::XDispatch; - using ::com::sun::star::uno::Any; - /** === end UNO using === **/ - namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; - namespace CommandType = ::com::sun::star::sdb::CommandType; - - //==================================================================== - //= ISQLCommandAdapter - //==================================================================== - //-------------------------------------------------------------------- - ISQLCommandAdapter::~ISQLCommandAdapter() - { - } - - //==================================================================== - //= SQLCommandDesigner - //==================================================================== - //-------------------------------------------------------------------- - SQLCommandDesigner::SQLCommandDesigner( const Reference< XComponentContext >& _rxContext, - const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, const Link& _rCloseLink ) - :m_xContext( _rxContext ) - ,m_xConnection( _rConnection ) - ,m_xObjectAdapter( _rxPropertyAdapter ) - ,m_aCloseLink( _rCloseLink ) - { - if ( m_xContext.is() ) - m_xORB = m_xContext->getServiceManager(); - if ( !m_xORB.is() || !_rxPropertyAdapter.is() || !m_xConnection.is() ) - throw NullPointerException(); - - impl_doOpenDesignerFrame_nothrow(); - } - - //-------------------------------------------------------------------- - SQLCommandDesigner::~SQLCommandDesigner() - { - } - - //-------------------------------------------------------------------- - void SAL_CALL SQLCommandDesigner::propertyChange( const PropertyChangeEvent& Event ) throw (RuntimeException) - { - OSL_ENSURE( m_xDesigner.is() && ( Event.Source == m_xDesigner ), "SQLCommandDesigner::propertyChange: where did this come from?" ); - - if ( m_xDesigner.is() && ( Event.Source == m_xDesigner ) ) - { - try - { - if ( PROPERTY_ACTIVECOMMAND == Event.PropertyName ) - { - ::rtl::OUString sCommand; - OSL_VERIFY( Event.NewValue >>= sCommand ); - m_xObjectAdapter->setSQLCommand( sCommand ); - } - else if ( PROPERTY_ESCAPE_PROCESSING == Event.PropertyName ) - { - sal_Bool bEscapeProcessing( sal_False ); - OSL_VERIFY( Event.NewValue >>= bEscapeProcessing ); - m_xObjectAdapter->setEscapeProcessing( bEscapeProcessing ); - } - } - catch( const RuntimeException& ) { throw; } - catch( const Exception& ) - { - // not allowed to leave, so silence it - DBG_UNHANDLED_EXCEPTION(); - } - } - } - - //-------------------------------------------------------------------- - void SAL_CALL SQLCommandDesigner::disposing( const EventObject& Source ) throw (RuntimeException) - { - if ( m_xDesigner.is() && ( Source.Source == m_xDesigner ) ) - { - impl_designerClosed_nothrow(); - m_xDesigner.clear(); - } - } - - //-------------------------------------------------------------------- - void SQLCommandDesigner::dispose() - { - if ( impl_isDisposed() ) - return; - - if ( isActive() ) - impl_closeDesigner_nothrow(); - - m_xConnection.clear(); - m_xContext.clear(); - m_xORB.clear(); - } - - //-------------------------------------------------------------------- - void SQLCommandDesigner::impl_checkDisposed_throw() const - { - if ( impl_isDisposed() ) - throw DisposedException(); - } - - //-------------------------------------------------------------------- - void SQLCommandDesigner::raise() const - { - impl_checkDisposed_throw(); - impl_raise_nothrow(); - } - - //------------------------------------------------------------------------ - bool SQLCommandDesigner::suspend() const - { - impl_checkDisposed_throw(); - return impl_trySuspendDesigner_nothrow(); - } - - //-------------------------------------------------------------------- - void SQLCommandDesigner::impl_raise_nothrow() const - { - OSL_PRECOND( isActive(), "SQLCommandDesigner::impl_raise_nothrow: not active!" ); - if ( !isActive() ) - return; - - try - { - // activate the frame for this component - Reference< XFrame > xFrame( m_xDesigner->getFrame(), UNO_QUERY_THROW ); - Reference< XWindow > xWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW ); - Reference< XTopWindow > xTopWindow( xWindow, UNO_QUERY_THROW ); - - xTopWindow->toFront(); - xWindow->setFocus(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void SQLCommandDesigner::impl_doOpenDesignerFrame_nothrow() - { - OSL_PRECOND( !isActive(), - "SQLCommandDesigner::impl_doOpenDesignerFrame_nothrow: already active!" ); - OSL_PRECOND( m_xConnection.is(), "SQLCommandDesigner::impl_doOpenDesignerFrame_nothrow: this will crash!" ); - osl_incrementInterlockedCount(&m_refCount); - - try - { - // for various reasons, we don't want the new frame to appear in the desktop's frame list - // thus, we create a blank frame at the desktop, remove it from the desktop's frame list - // immediately, and then load the component into this blank (and now parent-less) frame - Reference< XComponentLoader > xLoader( impl_createEmptyParentlessTask_nothrow(), UNO_QUERY_THROW ); - Sequence< PropertyValue > aArgs( 5 ); - aArgs[0].Name = PROPERTY_ACTIVE_CONNECTION; - aArgs[0].Value <<= m_xConnection.getTyped(); - - aArgs[1].Name = PROPERTY_COMMAND; - aArgs[1].Value <<= m_xObjectAdapter->getSQLCommand(); - aArgs[2].Name = PROPERTY_COMMANDTYPE; - aArgs[2].Value <<= (sal_Int32)CommandType::COMMAND; - aArgs[3].Name = PROPERTY_ESCAPE_PROCESSING; - aArgs[3].Value <<= m_xObjectAdapter->getEscapeProcessing(); - - aArgs[4].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicalDesign" ) ); - aArgs[4].Value <<= m_xObjectAdapter->getEscapeProcessing(); - - Reference< XComponent > xQueryDesign = xLoader->loadComponentFromURL( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".component:DB/QueryDesign" ) ), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), - FrameSearchFlag::TASKS | FrameSearchFlag::CREATE, - aArgs - ); - - // remember this newly loaded component - we need to care for it e.g. when we're suspended - m_xDesigner = m_xDesigner.query( xQueryDesign ); - OSL_ENSURE( m_xDesigner.is() || !xQueryDesign.is(), "SQLCommandDesigner::impl_doOpenDesignerFrame_nothrow: the component is expected to be a controller!" ); - if ( m_xDesigner.is() ) - { - Reference< XPropertySet > xQueryDesignProps( m_xDesigner, UNO_QUERY ); - OSL_ENSURE( xQueryDesignProps.is(), "SQLCommandDesigner::impl_doOpenDesignerFrame_nothrow: the controller should have properties!" ); - if ( xQueryDesignProps.is() ) - { - xQueryDesignProps->addPropertyChangeListener( PROPERTY_ACTIVECOMMAND, this ); - xQueryDesignProps->addPropertyChangeListener( PROPERTY_ESCAPE_PROCESSING, this ); - } - } - - // get the frame which we just opened and set it's title - Reference< XTitle> xTitle(xQueryDesign,UNO_QUERY); - if ( xTitle.is() ) - { - ::svt::OLocalResourceAccess aEnumStrings( PcrRes( RID_RSC_ENUM_COMMAND_TYPE ), RSC_RESOURCE ); - ::rtl::OUString sDisplayName = String( PcrRes( CommandType::COMMAND + 1 ) ); - xTitle->setTitle( sDisplayName ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - m_xDesigner.clear(); - } - osl_decrementInterlockedCount(&m_refCount); - } - - //------------------------------------------------------------------------ - Reference< XFrame > SQLCommandDesigner::impl_createEmptyParentlessTask_nothrow( ) const - { - OSL_PRECOND( m_xORB.is(), "SQLCommandDesigner::impl_createEmptyParentlessTask_nothrow: this will crash!" ); - - Reference< XFrame > xFrame; - try - { - Reference< XInterface > xDesktop ( m_xORB->createInstanceWithContext( SERVICE_DESKTOP, m_xContext ) ); - Reference< XFrame > xDesktopFrame ( xDesktop, UNO_QUERY_THROW ); - Reference< XFramesSupplier > xSuppDesktopFrames( xDesktopFrame, UNO_QUERY_THROW ); - - Reference< XFrames > xDesktopFramesCollection( xSuppDesktopFrames->getFrames(), UNO_QUERY_THROW ); - xFrame = xDesktopFrame->findFrame( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), FrameSearchFlag::CREATE ); - OSL_ENSURE( xFrame.is(), "SQLCommandDesigner::impl_createEmptyParentlessTask_nothrow: could not create an empty frame!" ); - xDesktopFramesCollection->remove( xFrame ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xFrame; - } - - //------------------------------------------------------------------------ - void SQLCommandDesigner::impl_designerClosed_nothrow() - { - if ( m_aCloseLink.IsSet() ) - m_aCloseLink.Call( this ); - } - - //------------------------------------------------------------------------ - void SQLCommandDesigner::impl_closeDesigner_nothrow() - { - OSL_PRECOND( isActive(), "SQLCommandDesigner::impl_closeDesigner_nothrow: invalid calle!" ); - // close it - try - { - // do not listen anymore .... - Reference< XPropertySet > xProps( m_xDesigner, UNO_QUERY ); - if ( xProps.is() ) - xProps->removePropertyChangeListener( PROPERTY_ACTIVECOMMAND, this ); - - // we need to close the frame via the "user interface", by dispatching a close command, - // instead of calling XCloseable::close directly. The latter method would also close - // the frame, but not care for things like shutting down the office when the last - // frame is gone ... - const UnoURL aCloseURL( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ), - Reference< XMultiServiceFactory >( m_xORB, UNO_QUERY ) ); - - Reference< XDispatchProvider > xProvider( m_xDesigner->getFrame(), UNO_QUERY_THROW ); - Reference< XDispatch > xDispatch( xProvider->queryDispatch( aCloseURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_top" ) ), FrameSearchFlag::SELF ) ); - OSL_ENSURE( xDispatch.is(), "SQLCommandDesigner::impl_closeDesigner_nothrow: no dispatcher for the CloseDoc command!" ); - if ( xDispatch.is() ) - { - xDispatch->dispatch( aCloseURL, Sequence< PropertyValue >( ) ); - } - else - { - // fallback: use the XCloseable::close (with all possible disadvantages) - Reference< XCloseable > xClose( m_xDesigner->getFrame(), UNO_QUERY ); - if ( xClose.is() ) - xClose->close( sal_True ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - m_xDesigner.clear(); - } - - //------------------------------------------------------------------------ - bool SQLCommandDesigner::impl_trySuspendDesigner_nothrow() const - { - OSL_PRECOND( isActive(), "SQLCommandDesigner::impl_trySuspendDesigner_nothrow: no active designer, this will crash!" ); - sal_Bool bAllow = sal_True; - try - { - bAllow = m_xDesigner->suspend( sal_True ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return bAllow; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/sqlcommanddesign.hxx b/extensions/source/propctrlr/sqlcommanddesign.hxx deleted file mode 100644 index f439f6784..000000000 --- a/extensions/source/propctrlr/sqlcommanddesign.hxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class ISQLCommandAdapter; - //==================================================================== - //= SQLCommandDesigner - //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener - > SQLCommandDesigner_Base; - /** encapsulates the code for calling and managing a query design frame, used - for interactively designing the Command property of a ->RowSet - */ - class SQLCommandDesigner : public SQLCommandDesigner_Base - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xORB; - ::dbtools::SharedConnection m_xConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xDesigner; - ::rtl::Reference< ISQLCommandAdapter > m_xObjectAdapter; - Link m_aCloseLink; - - public: - /** creates the instance, and immediately opens the SQL command design frame - - @param _rxContext - our component context. Must not be , and must provide a non- XMultiComponentFactory - @param _rxPropertyAdapter - an adapter to the object's SQL command related properties - @param _rConnection - the current connection of ->_rxRowSet. Must not be . - @param _rCloseLink - link to call when the component has been closed - @throws ::com::sun::star::lang::NullPointerException - if any of the arguments (except ->_rCloseLink) is , or if the component context - does not provide a valid component factory. - */ - SQLCommandDesigner( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, - const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, - const Link& _rCloseLink - ); - - /** determines whether the SQL Command designer is currently active, i.e. - if there currently exists a frame which allows the user entering the SQL command - */ - inline bool isActive() const { return m_xDesigner.is(); } - - /** returns the property adapter used by the instance - */ - inline const ::rtl::Reference< ISQLCommandAdapter >& getPropertyAdapter() const { return m_xObjectAdapter; } - - /** raises the designer window to top - @precond - the designer is active (->isActive) - @precond - the instance is not disposed - */ - void raise() const; - - /** suspends the designer - @precond - the designer is active (->isActive) - @precond - the instance is not disposed - */ - bool suspend() const; - - /** disposes the instance so that it becomes non-functional - */ - void dispose(); - - protected: - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) 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); - - protected: - ~SQLCommandDesigner(); - - /** opens a new frame for interactively designing an SQL command - @precond - the designer is not currently active (see ->isActive) - @precond - ->m_xConnection is not - */ - void impl_doOpenDesignerFrame_nothrow(); - - /** impl-version of ->raise - */ - void impl_raise_nothrow() const; - - /** determines whether we are already disposed - */ - bool impl_isDisposed() const - { - return !m_xContext.is(); - } - /** checks whether we are already disposed - @throws ::com::sun::star::lang::DisposedException - if we in fact are disposed - */ - void impl_checkDisposed_throw() const; - - /** create an empty top-level frame, which does not belong to the desktop's frame list - @precond - ->m_xORB is not - */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - impl_createEmptyParentlessTask_nothrow() const; - - /** called whenever the component denoted by m_xDesigner has been closed - by an external instance - */ - void impl_designerClosed_nothrow(); - - /** closes the component denoted by m_xDesigner - @precond - our designer component is actually active (->isActive) - @precond - we're not disposed already - */ - void impl_closeDesigner_nothrow(); - - /** suspends our designer component - @precond - the designer component is actually active (->isActive) - @return - if the suspension was successful, if it was vetoed - */ - bool impl_trySuspendDesigner_nothrow() const; - - /** gets the current value of the command property - */ - ::rtl::OUString - impl_getCommandPropertyValue_nothrow(); - - /** sets anew value for the command property - */ - void impl_setCommandPropertyValue_nothrow( const ::rtl::OUString& _rCommand ) const; - - private: - SQLCommandDesigner(); // never implemented - SQLCommandDesigner( const SQLCommandDesigner& ); // never implemented - SQLCommandDesigner& operator=( const SQLCommandDesigner& ); // never implemented - }; - - //==================================================================== - //= ISQLCommandAdapter - //==================================================================== - /** an adapter to forward changed SQL command property values to a component - */ - class ISQLCommandAdapter : public ::rtl::IReference - { - public: - /// retrieves the current SQL command of the component - virtual ::rtl::OUString getSQLCommand() const = 0; - /// retrieves the current value of the EscapeProcessing property of the component - virtual sal_Bool getEscapeProcessing() const = 0; - - /// sets a new SQL command - virtual void setSQLCommand( const ::rtl::OUString& _rCommand ) const = 0; - /// sets a new EscapeProcessing property value - virtual void setEscapeProcessing( const sal_Bool _bEscapeProcessing ) const = 0; - - virtual ~ISQLCommandAdapter(); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx deleted file mode 100644 index bb3cf6fa6..000000000 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ /dev/null @@ -1,1438 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "standardcontrol.hxx" -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -//================================================================== -// ugly dependencies for the OColorControl -#include -#include -#include -//================================================================== -#include -#include -#include -#include -#include -#include -#include -#include -//================================================================== - -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - 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::util; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::inspection; - - //================================================================== - //= OTimeControl - //================================================================== - //------------------------------------------------------------------ - OTimeControl::OTimeControl( Window* pParent, WinBits nWinStyle ) - :OTimeControl_Base( PropertyControlType::TimeField, pParent, nWinStyle ) - { - getTypedControlWindow()->SetStrictFormat( sal_True ); - getTypedControlWindow()->SetFormat( TIMEF_SEC ); - getTypedControlWindow()->EnableEmptyFieldValue( sal_True ); - } - - //------------------------------------------------------------------ - void SAL_CALL OTimeControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - util::Time aUNOTime; - if ( !( _rValue >>= aUNOTime ) ) - { - getTypedControlWindow()->SetText( String() ); - getTypedControlWindow()->SetEmptyTime(); - } - else - { - ::Time aTime( aUNOTime.Hours, aUNOTime.Minutes, aUNOTime.Seconds, aUNOTime.HundredthSeconds ); - getTypedControlWindow()->SetTime( aTime ); - } - } - - //------------------------------------------------------------------ - Any SAL_CALL OTimeControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len()>0 ) - { - ::Time aTime( getTypedControlWindow()->GetTime() ); - util::Time aUNOTime( aTime.Get100Sec(), aTime.GetSec(), aTime.GetMin(), aTime.GetHour() ); - aPropValue <<= aUNOTime; - } - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OTimeControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< util::Time* >( NULL ) ); - } - - //================================================================== - //= ODateControl - //================================================================== - //------------------------------------------------------------------ - ODateControl::ODateControl( Window* pParent, WinBits nWinStyle ) - :ODateControl_Base( PropertyControlType::DateField, pParent, nWinStyle | WB_DROPDOWN ) - { - WindowType* pControlWindow = getTypedControlWindow(); - pControlWindow->SetStrictFormat(sal_True); - - pControlWindow->SetMin( ::Date( 1,1,1600 ) ); - pControlWindow->SetFirst( ::Date( 1,1,1600 ) ); - pControlWindow->SetLast( ::Date( 1, 1, 9999 ) ); - pControlWindow->SetMax( ::Date( 1, 1, 9999 ) ); - - pControlWindow->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY ); - pControlWindow->EnableEmptyFieldValue( sal_True ); - } - - //------------------------------------------------------------------ - void SAL_CALL ODateControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - util::Date aUNODate; - if ( !( _rValue >>= aUNODate ) ) - { - getTypedControlWindow()->SetText( String() ); - getTypedControlWindow()->SetEmptyDate(); - } - else - { - ::Date aDate( aUNODate.Day, aUNODate.Month, aUNODate.Year ); - getTypedControlWindow()->SetDate( aDate ); - } - } - - //------------------------------------------------------------------ - Any SAL_CALL ODateControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() > 0 ) - { - ::Date aDate( getTypedControlWindow()->GetDate() ); - util::Date aUNODate( aDate.GetDay(), aDate.GetMonth(), aDate.GetYear() ); - aPropValue <<= aUNODate; - } - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL ODateControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< util::Date* >( NULL ) ); - } - - //================================================================== - //= OEditControl - //================================================================== - //------------------------------------------------------------------ - OEditControl::OEditControl(Window* _pParent, sal_Bool _bPW, WinBits _nWinStyle) - :OEditControl_Base( _bPW ? PropertyControlType::CharacterField : PropertyControlType::TextField, _pParent, _nWinStyle ) - { - m_bIsPassword = _bPW; - - if ( m_bIsPassword ) - getTypedControlWindow()->SetMaxTextLen( 1 ); - } - - //------------------------------------------------------------------ - void SAL_CALL OEditControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - ::rtl::OUString sText; - if ( m_bIsPassword ) - { - sal_Int16 nValue = 0; - _rValue >>= nValue; - if ( nValue ) - { - sal_Unicode nCharacter = nValue; - sText = String( &nCharacter, 1 ); - } - } - else - _rValue >>= sText; - - getTypedControlWindow()->SetText( sText ); - } - - //------------------------------------------------------------------ - Any SAL_CALL OEditControl::getValue() throw (RuntimeException) - { - Any aPropValue; - - ::rtl::OUString sText( getTypedControlWindow()->GetText() ); - if ( m_bIsPassword ) - { - if ( sText.getLength() ) - aPropValue <<= (sal_Int16)sText.getStr()[0]; - } - else - aPropValue <<= sText; - - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OEditControl::getValueType() throw (RuntimeException) - { - return m_bIsPassword ? ::getCppuType( static_cast< sal_Int16* >( NULL ) ) : ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - } - - //------------------------------------------------------------------ - void OEditControl::modified() - { - OEditControl_Base::modified(); - - // for pasword controls, we fire a commit for every single change - if ( m_bIsPassword ) - m_aImplControl.notifyModifiedValue(); - } - - //------------------------------------------------------------------ - static long ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) - { - double n = nValue; - for ( sal_uInt16 d = 0; d < nDigits; ++d ) - n *= 10; - - if ( n > ::std::numeric_limits< long >::max() ) - return ::std::numeric_limits< long >::max(); - return (long)n; - } - - //------------------------------------------------------------------ - static double ImplCalcDoubleValue( long nValue, sal_uInt16 nDigits ) - { - double n = nValue; - for ( sal_uInt16 d = 0; d < nDigits; ++d ) - n /= 10; - return n; - } - - //================================================================== - // class ODateTimeControl - //================================================================== - //------------------------------------------------------------------ - ODateTimeControl::ODateTimeControl( Window* _pParent, WinBits _nWinStyle) - :ODateTimeControl_Base( PropertyControlType::DateTimeField, _pParent, _nWinStyle ) - { - getTypedControlWindow()->EnableEmptyField( sal_True ); - - // determine a default format - Locale aSysLocale = SvtSysLocale().GetLocaleData().getLocale(); - LanguageType eSysLanguage = MsLangId::convertLocaleToLanguage( aSysLocale ); - - getTypedControlWindow()->SetFormatter( getTypedControlWindow()->StandardFormatter() ); - SvNumberFormatter* pFormatter = getTypedControlWindow()->GetFormatter(); - sal_uLong nStandardDateTimeFormat = pFormatter->GetStandardFormat( NUMBERFORMAT_DATETIME, eSysLanguage ); - - getTypedControlWindow()->SetFormatKey( nStandardDateTimeFormat ); - } - - //------------------------------------------------------------------ - void SAL_CALL ODateTimeControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - if ( !_rValue.hasValue() ) - { - getTypedControlWindow()->SetText( String() ); - } - else - { - util::DateTime aUNODateTime; - OSL_VERIFY( _rValue >>= aUNODateTime ); - - ::DateTime aDateTime; - ::utl::typeConvert( aUNODateTime, aDateTime ); - - double nValue = aDateTime - ::DateTime( *getTypedControlWindow()->GetFormatter()->GetNullDate() ); - getTypedControlWindow()->SetValue( nValue ); - } - } - - //------------------------------------------------------------------ - Any SAL_CALL ODateTimeControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() ) - { - double nValue = getTypedControlWindow()->GetValue(); - - ::DateTime aDateTime( *getTypedControlWindow()->GetFormatter()->GetNullDate() ); - - // add the "days" part - double nDays = floor( nValue ); - aDateTime += nDays; - - // add the "time" part - double nTime = nValue - nDays; - nTime = ::rtl::math::round( nTime * 86400.0 ) / 86400.0; - // we're not interested in 100th seconds, and this here prevents rounding errors - aDateTime += nTime; - - util::DateTime aUNODateTime; - ::utl::typeConvert( aDateTime, aUNODateTime ); - - aPropValue <<= aUNODateTime; - } - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL ODateTimeControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< util::DateTime* >( NULL ) ); - } - - //======================================================================== - //= HyperlinkInput - //======================================================================== - //-------------------------------------------------------------------- - HyperlinkInput::HyperlinkInput( Window* _pParent, WinBits _nWinStyle ) - :Edit( _pParent, _nWinStyle ) - { - ::svtools::ColorConfig aColorConfig; - ::svtools::ColorConfigValue aLinkColor( aColorConfig.GetColorValue( ::svtools::LINKS ) ); - - AllSettings aAllSettings( GetSettings() ); - StyleSettings aStyleSettings( aAllSettings.GetStyleSettings() ); - - Font aFieldFont( aStyleSettings.GetFieldFont() ); - aFieldFont.SetUnderline( UNDERLINE_SINGLE ); - aFieldFont.SetColor( aLinkColor.nColor ); - aStyleSettings.SetFieldFont( aFieldFont ); - - aStyleSettings.SetFieldTextColor( aLinkColor.nColor ); - - aAllSettings.SetStyleSettings( aStyleSettings ); - SetSettings( aAllSettings ); - } - - //-------------------------------------------------------------------- - void HyperlinkInput::MouseMove( const ::MouseEvent& rMEvt ) - { - Edit::MouseMove( rMEvt ); - - PointerStyle ePointerStyle( POINTER_TEXT ); - - if ( !rMEvt.IsLeaveWindow() ) - { - if ( impl_textHitTest( rMEvt.GetPosPixel() ) ) - ePointerStyle = POINTER_REFHAND; - } - - SetPointer( Pointer( ePointerStyle ) ); - } - - //-------------------------------------------------------------------- - void HyperlinkInput::MouseButtonDown( const ::MouseEvent& rMEvt ) - { - Edit::MouseButtonDown( rMEvt ); - - if ( impl_textHitTest( rMEvt.GetPosPixel() ) ) - m_aMouseButtonDownPos = rMEvt.GetPosPixel(); - else - m_aMouseButtonDownPos.X() = m_aMouseButtonDownPos.Y() = -1; - } - - //-------------------------------------------------------------------- - void HyperlinkInput::MouseButtonUp( const ::MouseEvent& rMEvt ) - { - Edit::MouseButtonUp( rMEvt ); - - impl_checkEndClick( rMEvt ); - } - - //-------------------------------------------------------------------- - bool HyperlinkInput::impl_textHitTest( const ::Point& _rWindowPos ) - { - xub_StrLen nPos = GetCharPos( _rWindowPos ); - return ( ( nPos != STRING_LEN ) && ( nPos < GetText().Len() ) ); - } - - //-------------------------------------------------------------------- - void HyperlinkInput::impl_checkEndClick( const ::MouseEvent rMEvt ) - { - const MouseSettings& rMouseSettings( GetSettings().GetMouseSettings() ); - if ( ( abs( rMEvt.GetPosPixel().X() - m_aMouseButtonDownPos.X() ) < rMouseSettings.GetStartDragWidth() ) - && ( abs( rMEvt.GetPosPixel().Y() - m_aMouseButtonDownPos.Y() ) < rMouseSettings.GetStartDragHeight() ) - ) - Application::PostUserEvent( m_aClickHandler ); - } - - //-------------------------------------------------------------------- - void HyperlinkInput::Tracking( const TrackingEvent& rTEvt ) - { - Edit::Tracking( rTEvt ); - - if ( rTEvt.IsTrackingEnded() ) - impl_checkEndClick( rTEvt.GetMouseEvent() ); - } - - //======================================================================== - //= OHyperlinkControl - //======================================================================== - //-------------------------------------------------------------------- - OHyperlinkControl::OHyperlinkControl( Window* _pParent, WinBits _nWinStyle ) - :OHyperlinkControl_Base( PropertyControlType::HyperlinkField, _pParent, _nWinStyle ) - ,m_aActionListeners( m_aMutex ) - { - getTypedControlWindow()->SetClickHdl( LINK( this, OHyperlinkControl, OnHyperlinkClicked ) ); - } - - //-------------------------------------------------------------------- - Any SAL_CALL OHyperlinkControl::getValue() throw (RuntimeException) - { - ::rtl::OUString sText = getTypedControlWindow()->GetText(); - return makeAny( sText ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OHyperlinkControl::setValue( const Any& _value ) throw (IllegalTypeException, RuntimeException) - { - ::rtl::OUString sText; - _value >>= sText; - getTypedControlWindow()->SetText( sText ); - } - - //-------------------------------------------------------------------- - Type SAL_CALL OHyperlinkControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OHyperlinkControl::addActionListener( const Reference< XActionListener >& listener ) throw (RuntimeException) - { - if ( listener.is() ) - m_aActionListeners.addInterface( listener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL OHyperlinkControl::removeActionListener( const Reference< XActionListener >& listener ) throw (RuntimeException) - { - m_aActionListeners.removeInterface( listener ); - } - - //------------------------------------------------------------------ - void SAL_CALL OHyperlinkControl::disposing() - { - OHyperlinkControl_Base::disposing(); - - EventObject aEvent( *this ); - m_aActionListeners.disposeAndClear( aEvent ); - } - - //------------------------------------------------------------------ - IMPL_LINK( OHyperlinkControl, OnHyperlinkClicked, void*, /*_NotInterestedIn*/ ) - { - ActionEvent aEvent( *this, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "clicked" ) ) ); - m_aActionListeners.forEach< XActionListener >( - boost::bind( - &XActionListener::actionPerformed, - _1, boost::cref(aEvent) ) ); - - return 0; - } - - //================================================================== - //= ONumericControl - //================================================================== - //------------------------------------------------------------------ - ONumericControl::ONumericControl( Window* _pParent, WinBits _nWinStyle ) - :ONumericControl_Base( PropertyControlType::NumericField, _pParent, _nWinStyle ) - ,m_eValueUnit( FUNIT_NONE ) - ,m_nFieldToUNOValueFactor( 1 ) - { - getTypedControlWindow()->SetDefaultUnit( FUNIT_NONE ); - - getTypedControlWindow()->EnableEmptyFieldValue( sal_True ); - getTypedControlWindow()->SetStrictFormat( sal_True ); - Optional< double > value( getMaxValue() ); - value.Value = -value.Value; - setMinValue( value ); - } - - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL ONumericControl::getDecimalDigits() throw (RuntimeException) - { - return getTypedControlWindow()->GetDecimalDigits(); - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 _decimaldigits ) throw (RuntimeException) - { - getTypedControlWindow()->SetDecimalDigits( _decimaldigits ); - } - - //-------------------------------------------------------------------- - Optional< double > SAL_CALL ONumericControl::getMinValue() throw (RuntimeException) - { - Optional< double > aReturn( sal_True, 0 ); - - sal_Int64 minValue = getTypedControlWindow()->GetMin(); - if ( minValue == ::std::numeric_limits< sal_Int64 >::min() ) - aReturn.IsPresent = sal_False; - else - aReturn.Value = (double)minValue; - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) throw (RuntimeException) - { - if ( !_minvalue.IsPresent ) - getTypedControlWindow()->SetMin( ::std::numeric_limits< sal_Int64 >::min() ); - else - getTypedControlWindow()->SetMin( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); - } - - //-------------------------------------------------------------------- - Optional< double > SAL_CALL ONumericControl::getMaxValue() throw (RuntimeException) - { - Optional< double > aReturn( sal_True, 0 ); - - sal_Int64 maxValue = getTypedControlWindow()->GetMax(); - if ( maxValue == ::std::numeric_limits< sal_Int64 >::max() ) - aReturn.IsPresent = sal_False; - else - aReturn.Value = (double)maxValue; - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) throw (RuntimeException) - { - if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->SetMax( ::std::numeric_limits< sal_Int64 >::max() ); - else - getTypedControlWindow()->SetMax( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); - } - - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL ONumericControl::getDisplayUnit() throw (RuntimeException) - { - return VCLUnoHelper::ConvertToMeasurementUnit( getTypedControlWindow()->GetUnit(), 1 ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setDisplayUnit( ::sal_Int16 _displayunit ) throw (IllegalArgumentException, RuntimeException) - { - if ( ( _displayunit < MeasureUnit::MM_100TH ) || ( _displayunit > MeasureUnit::PERCENT ) ) - throw IllegalArgumentException(); - if ( ( _displayunit == MeasureUnit::MM_100TH ) - || ( _displayunit == MeasureUnit::MM_10TH ) - || ( _displayunit == MeasureUnit::INCH_1000TH ) - || ( _displayunit == MeasureUnit::INCH_100TH ) - || ( _displayunit == MeasureUnit::INCH_10TH ) - || ( _displayunit == MeasureUnit::PERCENT ) - ) - throw IllegalArgumentException(); - - sal_Int16 nDummyFactor = 1; - FieldUnit eFieldUnit = VCLUnoHelper::ConvertToFieldUnit( _displayunit, nDummyFactor ); - if ( nDummyFactor != 1 ) - // everything which survived the checks above should result in a factor of 1, i.e., - // it should have a direct counterpart as FieldUnit - throw RuntimeException(); - getTypedControlWindow()->MetricFormatter::SetUnit( eFieldUnit ); - } - - //-------------------------------------------------------------------- - ::sal_Int16 SAL_CALL ONumericControl::getValueUnit() throw (RuntimeException) - { - return VCLUnoHelper::ConvertToMeasurementUnit( m_eValueUnit, m_nFieldToUNOValueFactor ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setValueUnit( ::sal_Int16 _valueunit ) throw (RuntimeException) - { - if ( ( _valueunit < MeasureUnit::MM_100TH ) || ( _valueunit > MeasureUnit::PERCENT ) ) - throw IllegalArgumentException(); - m_eValueUnit = VCLUnoHelper::ConvertToFieldUnit( _valueunit, m_nFieldToUNOValueFactor ); - } - - //-------------------------------------------------------------------- - void SAL_CALL ONumericControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - if ( !_rValue.hasValue() ) - { - getTypedControlWindow()->SetText( String() ); - getTypedControlWindow()->SetEmptyFieldValue(); - } - else - { - double nValue( 0 ); - OSL_VERIFY( _rValue >>= nValue ); - long nControlValue = impl_apiValueToFieldValue_nothrow( nValue ); - getTypedControlWindow()->SetValue( nControlValue, m_eValueUnit ); - } - } - - //------------------------------------------------------------------ - long ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const - { - long nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->GetDecimalDigits() ); - nControlValue /= m_nFieldToUNOValueFactor; - return nControlValue; - } - - //------------------------------------------------------------------ - double ONumericControl::impl_fieldValueToApiValue_nothrow( sal_Int64 _nFieldValue ) const - { - double nApiValue = ImplCalcDoubleValue( (long)_nFieldValue, getTypedControlWindow()->GetDecimalDigits() ); - nApiValue *= m_nFieldToUNOValueFactor; - return nApiValue; - } - - //------------------------------------------------------------------ - Any SAL_CALL ONumericControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() ) - { - double nValue = impl_fieldValueToApiValue_nothrow( getTypedControlWindow()->GetValue( m_eValueUnit ) ); - aPropValue <<= nValue; - } - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL ONumericControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< double* >( NULL ) ); - } - - //================================================================== - //= OColorControl - //================================================================== - #define LB_DEFAULT_COUNT 20 - //------------------------------------------------------------------ - String MakeHexStr(sal_uInt32 nVal, sal_uInt32 nLength) - { - String aStr; - while (nVal>0) - { - char c=char(nVal & 0x000F); - nVal>>=4; - if (c<=9) c+='0'; - else c+='A'-10; - aStr.Insert(c,0); - } - while (aStr.Len() < nLength) aStr.Insert('0',0); - return aStr; - } - - //------------------------------------------------------------------ - OColorControl::OColorControl(Window* pParent, WinBits nWinStyle) - :OColorControl_Base( PropertyControlType::ColorListBox, pParent, nWinStyle ) - { - // initialize the color listbox - XColorTable* pColorTable = NULL; - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - const SfxPoolItem* pItem = pDocSh ? pDocSh->GetItem( SID_COLOR_TABLE ) : NULL; - if ( pItem ) - { - DBG_ASSERT(pItem->ISA(SvxColorTableItem), "OColorControl::OColorControl: invalid color item!"); - pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); - } - - if ( !pColorTable ) - pColorTable = &XColorTable::GetStdColorTable(); - - - DBG_ASSERT(pColorTable, "OColorControl::OColorControl: no color table!"); - - if (pColorTable) - { - for (sal_uInt16 i = 0; i < pColorTable->Count(); ++i) - { - XColorEntry* pEntry = pColorTable->GetColor( i ); - getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - } - - getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); - if ( ( nWinStyle & WB_READONLY ) != 0 ) - { - getTypedControlWindow()->SetReadOnly( sal_True ); - getTypedControlWindow()->Enable( sal_True ); - } - } - - //------------------------------------------------------------------ - void SAL_CALL OColorControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - if ( _rValue.hasValue() ) - { - ::com::sun::star::util::Color nColor = COL_TRANSPARENT; - if ( _rValue >>= nColor ) - { - ::Color aRgbCol((ColorData)nColor); - - getTypedControlWindow()->SelectEntry( aRgbCol ); - if ( !getTypedControlWindow()->IsEntrySelected( aRgbCol ) ) - { // the given color is not part of the list -> insert a new entry with the hex code of the color - String aStr = String::CreateFromAscii("0x"); - aStr += MakeHexStr(nColor,8); - getTypedControlWindow()->InsertEntry( aRgbCol, aStr ); - getTypedControlWindow()->SelectEntry( aRgbCol ); - } - } - else - { - ::rtl::OUString sNonColorValue; - if ( !( _rValue >>= sNonColorValue ) ) - throw IllegalTypeException(); - getTypedControlWindow()->SelectEntry( sNonColorValue ); - if ( !getTypedControlWindow()->IsEntrySelected( sNonColorValue ) ) - getTypedControlWindow()->SetNoSelection(); - } - } - else - getTypedControlWindow()->SetNoSelection(); - } - - //------------------------------------------------------------------ - Any SAL_CALL OColorControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetSelectEntryCount() > 0 ) - { - ::rtl::OUString sSelectedEntry = getTypedControlWindow()->GetSelectEntry(); - if ( m_aNonColorEntries.find( sSelectedEntry ) != m_aNonColorEntries.end() ) - aPropValue <<= sSelectedEntry; - else - { - ::Color aRgbCol = getTypedControlWindow()->GetSelectEntryColor(); - aPropValue <<= (::com::sun::star::util::Color)aRgbCol.GetColor(); - } - } - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OColorControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< sal_Int32* >( NULL ) ); - } - - //------------------------------------------------------------------ - void SAL_CALL OColorControl::clearList() throw (RuntimeException) - { - getTypedControlWindow()->Clear(); - } - - //------------------------------------------------------------------ - void SAL_CALL OColorControl::prependListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry, 0 ); - m_aNonColorEntries.insert( NewEntry ); - } - - //------------------------------------------------------------------ - void SAL_CALL OColorControl::appendListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry ); - m_aNonColorEntries.insert( NewEntry ); - } - //------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL OColorControl::getListEntries( ) throw (RuntimeException) - { - if ( !m_aNonColorEntries.empty() ) - return Sequence< ::rtl::OUString >(&(*m_aNonColorEntries.begin()),m_aNonColorEntries.size()); - return Sequence< ::rtl::OUString >(); - } - - //------------------------------------------------------------------ - void OColorControl::modified() - { - OColorControl_Base::modified(); - - if ( !getTypedControlWindow()->IsTravelSelect() ) - // fire a commit - m_aImplControl.notifyModifiedValue(); - } - - //================================================================== - //= OListboxControl - //================================================================== - //------------------------------------------------------------------ - OListboxControl::OListboxControl( Window* pParent, WinBits nWinStyle) - :OListboxControl_Base( PropertyControlType::ListBox, pParent, nWinStyle ) - { - getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); - if ( ( nWinStyle & WB_READONLY ) != 0 ) - { - getTypedControlWindow()->SetReadOnly( sal_True ); - getTypedControlWindow()->Enable( sal_True ); - } - } - - //------------------------------------------------------------------ - Any SAL_CALL OListboxControl::getValue() throw (RuntimeException) - { - ::rtl::OUString sControlValue( getTypedControlWindow()->GetSelectEntry() ); - - Any aPropValue; - if ( sControlValue.getLength() ) - aPropValue <<= sControlValue; - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OListboxControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - } - - //------------------------------------------------------------------ - void SAL_CALL OListboxControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - if ( !_rValue.hasValue() ) - getTypedControlWindow()->SetNoSelection(); - else - { - ::rtl::OUString sSelection; - _rValue >>= sSelection; - - if ( !sSelection.equals( getTypedControlWindow()->GetSelectEntry() ) ) - getTypedControlWindow()->SelectEntry( sSelection ); - - if ( !getTypedControlWindow()->IsEntrySelected( sSelection ) ) - { - getTypedControlWindow()->InsertEntry( sSelection, 0 ); - getTypedControlWindow()->SelectEntry( sSelection ); - } - } - } - - //------------------------------------------------------------------ - void SAL_CALL OListboxControl::clearList() throw (RuntimeException) - { - getTypedControlWindow()->Clear(); - } - - //------------------------------------------------------------------ - void SAL_CALL OListboxControl::prependListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry, 0 ); - } - - //------------------------------------------------------------------ - void SAL_CALL OListboxControl::appendListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry ); - } - //------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL OListboxControl::getListEntries( ) throw (RuntimeException) - { - const sal_uInt16 nCount = getTypedControlWindow()->GetEntryCount(); - Sequence< ::rtl::OUString > aRet(nCount); - ::rtl::OUString* pIter = aRet.getArray(); - for (sal_uInt16 i = 0; i < nCount ; ++i,++pIter) - *pIter = getTypedControlWindow()->GetEntry(i); - - return aRet; - } - - //------------------------------------------------------------------ - void OListboxControl::modified() - { - OListboxControl_Base::modified(); - - if ( !getTypedControlWindow()->IsTravelSelect() ) - // fire a commit - m_aImplControl.notifyModifiedValue(); - } - - //================================================================== - //= OComboboxControl - //================================================================== - //------------------------------------------------------------------ - OComboboxControl::OComboboxControl( Window* pParent, WinBits nWinStyle) - :OComboboxControl_Base( PropertyControlType::ComboBox, pParent, nWinStyle ) - { - getTypedControlWindow()->SetDropDownLineCount( LB_DEFAULT_COUNT ); - getTypedControlWindow()->SetSelectHdl( LINK( this, OComboboxControl, OnEntrySelected ) ); - } - - //------------------------------------------------------------------ - void SAL_CALL OComboboxControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - ::rtl::OUString sText; - _rValue >>= sText; - getTypedControlWindow()->SetText( sText ); - } - - //------------------------------------------------------------------ - Any SAL_CALL OComboboxControl::getValue() throw (RuntimeException) - { - return makeAny( ::rtl::OUString( getTypedControlWindow()->GetText() ) ); - } - - //------------------------------------------------------------------ - Type SAL_CALL OComboboxControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - } - - //------------------------------------------------------------------ - void SAL_CALL OComboboxControl::clearList() throw (RuntimeException) - { - getTypedControlWindow()->Clear(); - } - - //------------------------------------------------------------------ - void SAL_CALL OComboboxControl::prependListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry, 0 ); - } - - //------------------------------------------------------------------ - void SAL_CALL OComboboxControl::appendListEntry( const ::rtl::OUString& NewEntry ) throw (RuntimeException) - { - getTypedControlWindow()->InsertEntry( NewEntry ); - } - //------------------------------------------------------------------ - Sequence< ::rtl::OUString > SAL_CALL OComboboxControl::getListEntries( ) throw (RuntimeException) - { - const sal_uInt16 nCount = getTypedControlWindow()->GetEntryCount(); - Sequence< ::rtl::OUString > aRet(nCount); - ::rtl::OUString* pIter = aRet.getArray(); - for (sal_uInt16 i = 0; i < nCount ; ++i,++pIter) - *pIter = getTypedControlWindow()->GetEntry(i); - - return aRet; - } - - //------------------------------------------------------------------ - IMPL_LINK( OComboboxControl, OnEntrySelected, void*, /*_pNothing*/ ) - { - if ( !getTypedControlWindow()->IsTravelSelect() ) - // fire a commit - m_aImplControl.notifyModifiedValue(); - return 0L; - } - - //================================================================== - //= OMultilineFloatingEdit - //================================================================== - class OMultilineFloatingEdit : public FloatingWindow - { - private: - MultiLineEdit m_aImplEdit; - - protected: - virtual void Resize(); - - public: - OMultilineFloatingEdit(Window* _pParen); - MultiLineEdit* getEdit() { return &m_aImplEdit; } - - protected: - virtual long PreNotify(NotifyEvent& _rNEvt); - }; - - //------------------------------------------------------------------ - OMultilineFloatingEdit::OMultilineFloatingEdit(Window* _pParent) - :FloatingWindow(_pParent, WB_BORDER) - ,m_aImplEdit(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER) - { - m_aImplEdit.Show(); - } - - //------------------------------------------------------------------ - void OMultilineFloatingEdit::Resize() - { - m_aImplEdit.SetSizePixel(GetOutputSizePixel()); - } - - //------------------------------------------------------------------ - long OMultilineFloatingEdit::PreNotify(NotifyEvent& _rNEvt) - { - long nResult = sal_True; - - sal_uInt16 nSwitch = _rNEvt.GetType(); - if (EVENT_KEYINPUT == nSwitch) - { - const KeyCode& aKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - - if ( ( (KEY_RETURN == nKey) - && !aKeyCode.IsShift() - ) - || ( (KEY_UP == nKey) - && aKeyCode.IsMod2() - ) - ) - { - EndPopupMode(); - } - else - nResult=FloatingWindow::PreNotify(_rNEvt); - } - else - nResult=FloatingWindow::PreNotify(_rNEvt); - - return nResult; - } - - //================================================================== - //= DropDownEditControl_Base - //================================================================== - //------------------------------------------------------------------ - DropDownEditControl::DropDownEditControl( Window* _pParent, WinBits _nStyle ) - :DropDownEditControl_Base( _pParent, _nStyle ) - ,m_pFloatingEdit( NULL ) - ,m_pImplEdit( NULL ) - ,m_pDropdownButton( NULL ) - ,m_nOperationMode( eStringList ) - ,m_bDropdown( sal_False ) - { - SetCompoundControl( sal_True ); - - m_pImplEdit = new MultiLineEdit( this, WB_TABSTOP | WB_IGNORETAB | WB_NOBORDER | (_nStyle & WB_READONLY) ); - SetSubEdit( m_pImplEdit ); - m_pImplEdit->Show(); - - if ( _nStyle & WB_DROPDOWN ) - { - m_pDropdownButton = new PushButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP); - m_pDropdownButton->SetSymbol(SYMBOL_SPIN_DOWN); - m_pDropdownButton->SetClickHdl( LINK( this, DropDownEditControl, DropDownHdl ) ); - m_pDropdownButton->Show(); - } - - m_pFloatingEdit = new OMultilineFloatingEdit(this); //FloatingWindow - - m_pFloatingEdit->SetPopupModeEndHdl( LINK( this, DropDownEditControl, ReturnHdl ) ); - m_pFloatingEdit->getEdit()->SetReadOnly( ( _nStyle & WB_READONLY ) != 0 ); - } - - //------------------------------------------------------------------ - void DropDownEditControl::setControlHelper( ControlHelper& _rControlHelper ) - { - DropDownEditControl_Base::setControlHelper( _rControlHelper ); - m_pFloatingEdit->getEdit()->SetModifyHdl( LINK( &_rControlHelper, ControlHelper, ModifiedHdl ) ); - m_pImplEdit->SetGetFocusHdl( LINK( &_rControlHelper, ControlHelper, GetFocusHdl ) ); - m_pImplEdit->SetModifyHdl( LINK( &_rControlHelper, ControlHelper, ModifiedHdl ) ); - m_pImplEdit->SetLoseFocusHdl( LINK( &_rControlHelper, ControlHelper, LoseFocusHdl ) ); - } - - //------------------------------------------------------------------ - DropDownEditControl::~DropDownEditControl() - { - { - ::std::auto_ptr aTemp(m_pFloatingEdit); - m_pFloatingEdit = NULL; - } - { - ::std::auto_ptr aTemp(m_pImplEdit); - SetSubEdit( NULL ); - m_pImplEdit = NULL; - } - { - ::std::auto_ptr aTemp(m_pDropdownButton); - m_pDropdownButton = NULL; - } - } - - //------------------------------------------------------------------ - void DropDownEditControl::Resize() - { - ::Size aOutSz = GetOutputSizePixel(); - - if (m_pDropdownButton!=NULL) - { - long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); - nSBWidth = CalcZoom( nSBWidth ); - m_pImplEdit->SetPosSizePixel( 0, 1, aOutSz.Width() - nSBWidth, aOutSz.Height()-2 ); - m_pDropdownButton->SetPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() ); - } - else - m_pImplEdit->SetPosSizePixel( 0, 1, aOutSz.Width(), aOutSz.Height()-2 ); - } - - //------------------------------------------------------------------ - long DropDownEditControl::PreNotify( NotifyEvent& rNEvt ) - { - long nResult = 1; - - if (rNEvt.GetType() == EVENT_KEYINPUT) - { - const KeyCode& aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - - if ( nKey == KEY_RETURN && !aKeyCode.IsShift() ) - { - if ( m_pHelper ) - { - m_pHelper->LoseFocusHdl( m_pImplEdit ); - m_pHelper->activateNextControl(); - } - } - else if ( nKey == KEY_DOWN && aKeyCode.IsMod2() ) - { - Invalidate(); - ShowDropDown( sal_True ); - } - else if ( KEYGROUP_CURSOR == aKeyCode.GetGroup() - || nKey == KEY_HELP - || KEYGROUP_FKEYS == aKeyCode.GetGroup() - || m_nOperationMode == eMultiLineText - ) - { - nResult = DropDownEditControl_Base::PreNotify( rNEvt ); - } - else if ( m_nOperationMode == eStringList ) - { - Selection aSel = m_pImplEdit->GetSelection(); - if ( aSel.Min() != aSel.Max() ) - { - aSel.Min() = FindPos( aSel.Min() ); - aSel.Max() = FindPos( aSel.Max() ); - } - else - { - aSel.Min() = FindPos( aSel.Min() ); - aSel.Max() = aSel.Min(); - } - Invalidate(); - ShowDropDown( sal_True ); - m_pFloatingEdit->getEdit()->GrabFocus(); - m_pFloatingEdit->getEdit()->SetSelection( aSel ); - Window* pFocusWin = Application::GetFocusWindow(); - pFocusWin->KeyInput( *rNEvt.GetKeyEvent() ); - } - } - else - nResult = DropDownEditControl_Base::PreNotify(rNEvt); - - return nResult; - } - - //------------------------------------------------------------------ - namespace - { - //.............................................................. - StlSyntaxSequence< ::rtl::OUString > lcl_convertMultiLineToList( const String& _rCompsedTextWithLineBreaks ) - { - xub_StrLen nLines( _rCompsedTextWithLineBreaks.GetTokenCount( '\n' ) ); - StlSyntaxSequence< ::rtl::OUString > aStrings( nLines ); - StlSyntaxSequence< ::rtl::OUString >::iterator stringItem = aStrings.begin(); - for ( xub_StrLen token = 0; token < nLines; ++token, ++stringItem ) - *stringItem = _rCompsedTextWithLineBreaks.GetToken( token, '\n' ); - return aStrings; - } - - String lcl_convertListToMultiLine( const StlSyntaxSequence< ::rtl::OUString >& _rStrings ) - { - String sMultiLineText; - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator item = _rStrings.begin(); - item != _rStrings.end(); - ) - { - sMultiLineText += String( *item ); - if ( ++item != _rStrings.end() ) - sMultiLineText += '\n'; - } - return sMultiLineText; - } - - //.............................................................. - String lcl_convertListToDisplayText( const StlSyntaxSequence< ::rtl::OUString >& _rStrings ) - { - ::rtl::OUStringBuffer aComposed; - for ( StlSyntaxSequence< ::rtl::OUString >::const_iterator strings = _rStrings.begin(); - strings != _rStrings.end(); - ++strings - ) - { - if ( strings != _rStrings.begin() ) - aComposed.append( (sal_Unicode)';' ); - aComposed.append( (sal_Unicode)'\"' ); - aComposed.append( *strings ); - aComposed.append( (sal_Unicode)'\"' ); - } - return aComposed.makeStringAndClear(); - } - } - - //------------------------------------------------------------------ - #define STD_HEIGHT 100 - sal_Bool DropDownEditControl::ShowDropDown( sal_Bool bShow ) - { - if (bShow) - { - ::Point aMePos= GetPosPixel(); - aMePos = GetParent()->OutputToScreenPixel( aMePos ); - ::Size aSize=GetSizePixel(); - ::Rectangle aRect(aMePos,aSize); - aSize.Height() = STD_HEIGHT; - m_pFloatingEdit->SetOutputSizePixel(aSize); - m_pFloatingEdit->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); - - m_pFloatingEdit->Show(); - m_pFloatingEdit->getEdit()->GrabFocus(); - m_pFloatingEdit->getEdit()->SetSelection(Selection(m_pFloatingEdit->getEdit()->GetText().Len())); - m_bDropdown=sal_True; - if ( m_nOperationMode == eMultiLineText ) - m_pFloatingEdit->getEdit()->SetText( m_pImplEdit->GetText() ); - m_pImplEdit->SetText(String()); - } - else - { - m_pFloatingEdit->Hide(); - m_pFloatingEdit->Invalidate(); - m_pFloatingEdit->Update(); - - // transfer the text from the floating edit to our own edit - String sDisplayText( m_pFloatingEdit->getEdit()->GetText() ); - if ( m_nOperationMode == eStringList ) - sDisplayText = lcl_convertListToDisplayText( lcl_convertMultiLineToList( sDisplayText ) ); - - m_pImplEdit->SetText( sDisplayText ); - GetParent()->Invalidate( INVALIDATE_CHILDREN ); - m_bDropdown = sal_False; - m_pImplEdit->GrabFocus(); - } - return m_bDropdown; - - } - - //------------------------------------------------------------------ - long DropDownEditControl::FindPos(long nSinglePos) - { - long nPos=0; - long nDiff=0; - String aOutput; - String aStr=m_pFloatingEdit->getEdit()->GetText(); - String aStr1 = GetText(); - - if ((nSinglePos == 0) || (nSinglePos == aStr1.Len())) - { - return nSinglePos; - } - - if (aStr.Len()>0) - { - sal_Int32 nCount = aStr.GetTokenCount('\n'); - - String aInput = aStr.GetToken(0,'\n' ); - - if (aInput.Len()>0) - { - aOutput+='\"'; - nDiff++; - aOutput+=aInput; - aOutput+='\"'; - } - - if (nSinglePos <= aOutput.Len()) - { - nPos=nSinglePos-nDiff; - } - else - { - for (sal_Int32 i=1; i0) - { - aOutput += ';'; - aOutput += '\"'; - nDiff += 2; - aOutput += aInput; - aOutput += '\"'; - - if (nSinglePos <= aOutput.Len()) - { - nPos=nSinglePos-nDiff; - break; - } - } - } - } - } - return nPos; - } - - //------------------------------------------------------------------ - IMPL_LINK( DropDownEditControl, ReturnHdl, OMultilineFloatingEdit*, /*pMEd*/) - { - - String aStr = m_pFloatingEdit->getEdit()->GetText(); - String aStr2 = GetText(); - ShowDropDown(sal_False); - - if (aStr!=aStr2 || ( m_nOperationMode == eStringList ) ) - { - if ( m_pHelper ) - m_pHelper->notifyModifiedValue(); - } - - return 0; - } - - //------------------------------------------------------------------ - IMPL_LINK( DropDownEditControl, DropDownHdl, PushButton*, /*pPb*/ ) - { - ShowDropDown(!m_bDropdown); - return 0; - } - - //------------------------------------------------------------------ - void DropDownEditControl::SetStringListValue( const StlSyntaxSequence< ::rtl::OUString >& _rStrings ) - { - SetText( lcl_convertListToDisplayText( _rStrings ) ); - m_pFloatingEdit->getEdit()->SetText( lcl_convertListToMultiLine( _rStrings ) ); - } - - //------------------------------------------------------------------ - StlSyntaxSequence< ::rtl::OUString > DropDownEditControl::GetStringListValue() const - { - return lcl_convertMultiLineToList( m_pFloatingEdit->getEdit()->GetText() ); - } - - //------------------------------------------------------------------ - void DropDownEditControl::SetTextValue( const ::rtl::OUString& _rText ) - { - OSL_PRECOND( m_nOperationMode == eMultiLineText, "DropDownEditControl::SetTextValue: illegal call!" ); - - m_pFloatingEdit->getEdit()->SetText( _rText ); - SetText( _rText ); - } - - //------------------------------------------------------------------ - ::rtl::OUString DropDownEditControl::GetTextValue() const - { - OSL_PRECOND( m_nOperationMode == eMultiLineText, "DropDownEditControl::GetTextValue: illegal call!" ); - return GetText(); - } - - //================================================================== - //= OMultilineEditControl - //================================================================== - //------------------------------------------------------------------ - OMultilineEditControl::OMultilineEditControl( Window* pParent, MultiLineOperationMode _eMode, WinBits nWinStyle ) - :OMultilineEditControl_Base( _eMode == eMultiLineText ? PropertyControlType::MultiLineTextField : PropertyControlType::StringListField - , pParent - , ( nWinStyle | WB_DIALOGCONTROL ) & ( ~WB_READONLY | ~WB_DROPDOWN ) - , false ) - { - getTypedControlWindow()->setOperationMode( _eMode ); - } - - //------------------------------------------------------------------ - void SAL_CALL OMultilineEditControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - impl_checkDisposed_throw(); - - switch ( getTypedControlWindow()->getOperationMode() ) - { - case eMultiLineText: - { - ::rtl::OUString sText; - if ( !( _rValue >>= sText ) && _rValue.hasValue() ) - throw IllegalTypeException(); - getTypedControlWindow()->SetTextValue( sText ); - } - break; - case eStringList: - { - Sequence< ::rtl::OUString > aStringLines; - if ( !( _rValue >>= aStringLines ) && _rValue.hasValue() ) - throw IllegalTypeException(); - getTypedControlWindow()->SetStringListValue( aStringLines ); - } - break; - } - } - - //------------------------------------------------------------------ - Any SAL_CALL OMultilineEditControl::getValue() throw (RuntimeException) - { - impl_checkDisposed_throw(); - - Any aValue; - switch ( getTypedControlWindow()->getOperationMode() ) - { - case eMultiLineText: - aValue <<= getTypedControlWindow()->GetTextValue(); - break; - case eStringList: - aValue <<= getTypedControlWindow()->GetStringListValue(); - break; - } - return aValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OMultilineEditControl::getValueType() throw (RuntimeException) - { - if ( getTypedControlWindow()->getOperationMode() == eMultiLineText ) - return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - return ::getCppuType( static_cast< Sequence< ::rtl::OUString >* >( NULL ) ); - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx deleted file mode 100644 index 8fed840fc..000000000 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ /dev/null @@ -1,447 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_ -#define _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_ - -#include "commoncontrol.hxx" -#include "pcrcommon.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include - -#include - -class PushButton; -class MultiLineEdit; -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= ListLikeControlWithModifyHandler - //======================================================================== - /** Very small helper class which adds a SetModifyHdl to a ListBox-derived class, - thus giving this class the same API (as far as the CommonBehaviourControl is concerned) - as all other windows. - */ - template< class LISTBOX_WINDOW > - class ListLikeControlWithModifyHandler : public ControlWindow< LISTBOX_WINDOW > - { - protected: - typedef ControlWindow< LISTBOX_WINDOW > ListBoxType; - - public: - ListLikeControlWithModifyHandler( Window* _pParent, WinBits _nStyle ) - :ListBoxType( _pParent, _nStyle ) - { - } - - void SetModifyHdl( const Link& _rLink ) { ListBoxType::SetSelectHdl( _rLink ); } - - protected: - long PreNotify( NotifyEvent& _rNEvt ); - }; - - //------------------------------------------------------------------------ - template< class LISTBOX_WINDOW > - long ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::PreNotify( NotifyEvent& _rNEvt ) - { - if ( _rNEvt.GetType() == EVENT_KEYINPUT ) - { - const ::KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent(); - if ( ( pKeyEvent->GetKeyCode().GetModifier() == 0 ) - && ( ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP ) - || ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN ) - ) - ) - { - if ( !ListBoxType::IsInDropDown() ) - { - // don't give the base class a chance to consume the event, in the property browser, it is - // intended to scroll the complete property page - return ListBoxType::GetParent()->PreNotify( _rNEvt ); - } - } - } - return ListBoxType::PreNotify( _rNEvt ); - } - - //======================================================================== - //= OTimeControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< TimeField > > OTimeControl_Base; - class OTimeControl : public OTimeControl_Base - { - public: - OTimeControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - }; - - //======================================================================== - //= ODateControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< CalendarField > > ODateControl_Base; - class ODateControl : public ODateControl_Base - { - public: - ODateControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - }; - - //======================================================================== - //= OEditControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< Edit > > OEditControl_Base; - class OEditControl : public OEditControl_Base - { - protected: - sal_Bool m_bIsPassword : 1; - - public: - OEditControl( Window* _pParent, sal_Bool _bPassWord, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - protected: - virtual void modified(); - }; - - //======================================================================== - //= ODateTimeControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > ODateTimeControl_Base; - class ODateTimeControl : public ODateTimeControl_Base - { - public: - ODateTimeControl( Window* pParent,WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - }; - - //======================================================================== - //= HyperlinkInput - //======================================================================== - class HyperlinkInput : public Edit - { - private: - Point m_aMouseButtonDownPos; - Link m_aClickHandler; - - public: - HyperlinkInput( Window* _pParent, WinBits _nWinStyle ); - - /** sets the handler which will (asynchronously, with locked SolarMutex) be called - when the hyperlink has been clicked by the user - */ - void SetClickHdl( const Link& _rHdl ) { m_aClickHandler = _rHdl; } - const Link& GetClickHdl( ) const { return m_aClickHandler; } - - protected: - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void Tracking( const TrackingEvent& rTEvt ); - - private: - void impl_checkEndClick( const MouseEvent rMEvt ); - bool impl_textHitTest( const Point& _rWindowPos ); - }; - - //======================================================================== - //= OHyperlinkControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XHyperlinkControl, ControlWindow< HyperlinkInput > > OHyperlinkControl_Base; - class OHyperlinkControl : public OHyperlinkControl_Base - { - private: - ::cppu::OInterfaceContainerHelper m_aActionListeners; - - public: - OHyperlinkControl( Window* _pParent, WinBits _nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - // XHyperlinkControl - virtual void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& listener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& listener ) throw (::com::sun::star::uno::RuntimeException); - - protected: - // XComponent - virtual void SAL_CALL disposing(); - - protected: - DECL_LINK( OnHyperlinkClicked, void* ); - }; - - //======================================================================== - //= CustomConvertibleNumericField - //======================================================================== - class CustomConvertibleNumericField : public ControlWindow< MetricField > - { - typedef ControlWindow< MetricField > BaseClass; - - public: - CustomConvertibleNumericField( Window* _pParent, WinBits _nStyle ) - :BaseClass( _pParent, _nStyle ) - { - } - - sal_Int64 GetLastValue() const { return mnLastValue; } - }; - - //======================================================================== - //= ONumericControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XNumericControl, CustomConvertibleNumericField > ONumericControl_Base; - class ONumericControl : public ONumericControl_Base - { - private: - FieldUnit m_eValueUnit; - sal_Int16 m_nFieldToUNOValueFactor; - - public: - ONumericControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - // XNumericControl - virtual ::sal_Int16 SAL_CALL getDecimalDigits() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDecimalDigits( ::sal_Int16 _decimaldigits ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::Optional< double > SAL_CALL getMinValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMinValue( const ::com::sun::star::beans::Optional< double >& _minvalue ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::Optional< double > SAL_CALL getMaxValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setMaxValue( const ::com::sun::star::beans::Optional< double >& _maxvalue ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getDisplayUnit() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDisplayUnit( ::sal_Int16 _displayunit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getValueUnit() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValueUnit( ::sal_Int16 _valueunit ) throw (::com::sun::star::uno::RuntimeException); - - private: - /** converts an API value (double, as passed into set[Max|Min|]Value) into - a long value which can be passed to our NumericField. - - The conversion respects our decimal digits as well as our value factor (m_nFieldToUNOValueFactor). - */ - long impl_apiValueToFieldValue_nothrow( double _nApiValue ) const; - - /** converts a control value, as obtained from our Numeric field, into a value which can passed - to outer callers via our UNO API. - */ - double impl_fieldValueToApiValue_nothrow( sal_Int64 _nFieldValue ) const; - }; - - //======================================================================== - //= OColorControl - //======================================================================== - typedef CommonBehaviourControl < ::com::sun::star::inspection::XStringListControl - , ListLikeControlWithModifyHandler< ColorListBox > - > OColorControl_Base; - class OColorControl : public OColorControl_Base - { - private: - ::std::set< ::rtl::OUString > m_aNonColorEntries; - - public: - OColorControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - // XStringListControl - virtual void SAL_CALL clearList( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - virtual void modified(); - }; - - //======================================================================== - //= OListboxControl - //======================================================================== - typedef CommonBehaviourControl < ::com::sun::star::inspection::XStringListControl - , ListLikeControlWithModifyHandler< ListBox > - > OListboxControl_Base; - class OListboxControl : public OListboxControl_Base - { - public: - OListboxControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - // XStringListControl - virtual void SAL_CALL clearList( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - virtual void modified(); - }; - - //======================================================================== - //= OComboboxControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XStringListControl, ControlWindow< ComboBox > > OComboboxControl_Base; - class OComboboxControl : public OComboboxControl_Base - { - public: - OComboboxControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - // XStringListControl - virtual void SAL_CALL clearList( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL prependListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL appendListEntry( const ::rtl::OUString& NewEntry ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getListEntries( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - DECL_LINK( OnEntrySelected, void* ); - }; - - //======================================================================== - //= DropDownEditControl - //======================================================================== - enum MultiLineOperationMode - { - eStringList, - eMultiLineText - }; - //======================================================================== - //= DropDownEditControl - //======================================================================== - class OMultilineFloatingEdit; - typedef ControlWindow< Edit > DropDownEditControl_Base; - /** an Edit field which can be used as ControlWindow, and has a drop-down button - */ - class DropDownEditControl : public DropDownEditControl_Base - { - private: - OMultilineFloatingEdit* m_pFloatingEdit; - MultiLineEdit* m_pImplEdit; - PushButton* m_pDropdownButton; - MultiLineOperationMode m_nOperationMode; - sal_Bool m_bDropdown : 1; - - public: - DropDownEditControl( Window* _pParent, WinBits _nStyle ); - ~DropDownEditControl(); - - void setOperationMode( MultiLineOperationMode _eMode ) { m_nOperationMode = _eMode; } - MultiLineOperationMode getOperationMode() const { return m_nOperationMode; } - - void SetTextValue( const ::rtl::OUString& _rText ); - ::rtl::OUString GetTextValue() const; - - void SetStringListValue( const StlSyntaxSequence< ::rtl::OUString >& _rStrings ); - StlSyntaxSequence< ::rtl::OUString > - GetStringListValue() const; - - // ControlWindow overridables - virtual void setControlHelper( ControlHelper& _rControlHelper ); - - protected: - // Window overridables - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual void Resize(); - - protected: - long FindPos(long nSinglePos); - - private: - DECL_LINK( ReturnHdl, OMultilineFloatingEdit* ); - DECL_LINK( DropDownHdl, PushButton* ); - - sal_Bool ShowDropDown( sal_Bool bShow ); - }; - - //======================================================================== - //= OMultilineEditControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, DropDownEditControl > OMultilineEditControl_Base; - class OMultilineEditControl : public OMultilineEditControl_Base - { - public: - OMultilineEditControl( Window* pParent, MultiLineOperationMode _eMode, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_STANDARDCONTROL_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/stlops.hxx b/extensions/source/propctrlr/stlops.hxx deleted file mode 100644 index b0249ec57..000000000 --- a/extensions/source/propctrlr/stlops.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_STLOPS_HXX_ -#define _EXTENSIONS_PROPCTRLR_STLOPS_HXX_ - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - struct PropertyLessByName - :public ::std::binary_function < ::com::sun::star::beans::Property, - ::com::sun::star::beans::Property, - bool - > - { - bool operator() (::com::sun::star::beans::Property _rLhs, ::com::sun::star::beans::Property _rRhs) const - { - return _rLhs.Name < _rRhs.Name ? true : false; - } - }; - - //======================================================================== - struct TypeLessByName - :public ::std::binary_function < ::com::sun::star::uno::Type, - ::com::sun::star::uno::Type, - bool - > - { - bool operator() (::com::sun::star::uno::Type _rLhs, ::com::sun::star::uno::Type _rRhs) const - { - return _rLhs.getTypeName() < _rRhs.getTypeName() ? true : false; - } - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_STLOPS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/stringdefine.hxx b/extensions/source/propctrlr/stringdefine.hxx deleted file mode 100644 index b7101590d..000000000 --- a/extensions/source/propctrlr/stringdefine.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMSCTRLR_STRINGDEFINE_HXX_ -#define _EXTENSIONS_FORMSCTRLR_STRINGDEFINE_HXX_ - -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //============================================================ - //= a helper for static ascii pseudo-unicode strings - //============================================================ - struct ConstAsciiString - { - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ::rtl::OUString& () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - - private: - mutable ::rtl::OUString* ustring; - }; - - //------------------------------------------------------------ - inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) - { - } - - //------------------------------------------------------------ - inline ConstAsciiString::~ConstAsciiString() - { - delete ustring; - ustring = NULL; - } - - //------------------------------------------------------------ - inline ConstAsciiString::operator const ::rtl::OUString& () const - { - if (!ustring) - ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); - return *ustring; - } - - //============================================================ - -#define CONST_ASCII_LENGTH(c) \ - (const sal_Char*)c, c.length() - - //============================================================ - //= concrete strings - //============================================================ - #ifndef PCR_IMPLEMENT_STRINGS - #define PCR_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident - #else - #define PCR_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident(string, sizeof(string)-1) - #endif - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_FORMSCTRLR_STRINGDEFINE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx deleted file mode 100644 index dd39ac432..000000000 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ /dev/null @@ -1,645 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "sal/config.h" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implementationentry.hxx" -#include "cppuhelper/implbase3.hxx" -#include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/inspection/XStringRepresentation.hpp" -#include "com/sun/star/lang/XInitialization.hpp" -#include "com/sun/star/script/XTypeConverter.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include "formresid.hrc" -#include -#include -#include -#include -#include "modulepcr.hxx" - -#include -#include - -// component helper namespace -namespace comp_StringRepresentation { - -using namespace ::com::sun::star; - -// component and service helper functions: -::rtl::OUString SAL_CALL _getImplementationName(); -uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames(); -uno::Reference< uno::XInterface > SAL_CALL _create( uno::Reference< uno::XComponentContext > const & context ); - -} // closing component helper namespace - - -namespace pcr{ - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -class StringRepresentation: - public ::cppu::WeakImplHelper3< - lang::XServiceInfo, - inspection::XStringRepresentation, - lang::XInitialization> -{ -public: - explicit StringRepresentation(uno::Reference< uno::XComponentContext > const & context); - - // lang::XServiceInfo: - virtual ::rtl::OUString SAL_CALL getImplementationName() throw (uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (uno::RuntimeException); - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException); - - // inspection::XStringRepresentation: - virtual ::rtl::OUString SAL_CALL convertToControlValue(const uno::Any & PropertyValue) throw (uno::RuntimeException, uno::Exception); - virtual uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & ControlValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, uno::Exception); - - // lang::XInitialization: - virtual void SAL_CALL initialize(const uno::Sequence< uno::Any > & aArguments) throw (uno::RuntimeException, uno::Exception); - -private: - StringRepresentation(StringRepresentation &); // not defined - void operator =(StringRepresentation &); // not defined - - virtual ~StringRepresentation() {} - - /** converts a generic value into a string representation - - If you want to convert values whose string representation does not depend - on a concrete property, use this version - - @return - if and only if the value could be converted - */ - bool convertGenericValueToString( - const uno::Any& _rValue, - ::rtl::OUString& _rStringRep - ); - - /** converts string representation into generic value - - If you want to convert values whose string representation does not depend - on a concrete property, use this version - - @return - if and only if the value could be converted - */ - bool convertStringToGenericValue( - const ::rtl::OUString& _rStringRep, - uno::Any& _rValue, - const uno::Type& _rTargetType - ); - - /** uses the simple convert method from the type converter - * - * \param _rValue the value to be converted - * \return the converted string. - */ - ::rtl::OUString convertSimpleToString( const uno::Any& _rValue ); - - /** converts a string into his constant value if it exists, otherwise the type converter is used. - * \param _rValue the value to be converted - * \param _ePropertyType teh type of the propery to be converted into - * \return the converted value - */ - uno::Any convertStringToSimple( const ::rtl::OUString& _rValue,const uno::TypeClass& _ePropertyType ); - - uno::Reference< uno::XComponentContext > m_xContext; - uno::Reference< script::XTypeConverter > m_xTypeConverter; - uno::Reference< reflection::XConstantsTypeDescription > m_xTypeDescription; - uno::Sequence< ::rtl::OUString > m_aValues; - uno::Sequence< uno::Reference< reflection::XConstantTypeDescription> > m_aConstants; - -}; - -StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > const & context) : - m_xContext(context) -{} - -// com.sun.star.uno.XServiceInfo: -::rtl::OUString SAL_CALL StringRepresentation::getImplementationName() throw (uno::RuntimeException) -{ - return comp_StringRepresentation::_getImplementationName(); -} - -::sal_Bool SAL_CALL StringRepresentation::supportsService(::rtl::OUString const & serviceName) throw (uno::RuntimeException) -{ - return ::comphelper::existsValue(serviceName,comp_StringRepresentation::_getSupportedServiceNames()); -} - -uno::Sequence< ::rtl::OUString > SAL_CALL StringRepresentation::getSupportedServiceNames() throw (uno::RuntimeException) -{ - return comp_StringRepresentation::_getSupportedServiceNames(); -} - -// inspection::XStringRepresentation: -::rtl::OUString SAL_CALL StringRepresentation::convertToControlValue(const uno::Any & PropertyValue) throw (uno::RuntimeException, uno::Exception) -{ - ::rtl::OUString sReturn; - if ( !convertGenericValueToString( PropertyValue, sReturn ) ) - { - sReturn = convertSimpleToString( PropertyValue ); -#ifdef DBG_UTIL - if ( !sReturn.getLength() && PropertyValue.hasValue() ) - { - ::rtl::OString sMessage( "StringRepresentation::convertPropertyValueToStringRepresentation: cannot convert values of type '" ); - sMessage += ::rtl::OString( PropertyValue.getValueType().getTypeName().getStr(), PropertyValue.getValueType().getTypeName().getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += ::rtl::OString( "'!" ); - OSL_FAIL( sMessage.getStr() ); - } -#endif - } - - return sReturn; -} - -uno::Any SAL_CALL StringRepresentation::convertToPropertyValue(const ::rtl::OUString & ControlValue, const uno::Type & ControlValueType) throw (uno::RuntimeException, uno::Exception) -{ - uno::Any aReturn; - - uno::TypeClass ePropertyType = ControlValueType.getTypeClass(); - switch ( ePropertyType ) - { - case uno::TypeClass_FLOAT: - case uno::TypeClass_DOUBLE: - case uno::TypeClass_BYTE: - case uno::TypeClass_SHORT: - case uno::TypeClass_LONG: - case uno::TypeClass_HYPER: - case uno::TypeClass_UNSIGNED_SHORT: - case uno::TypeClass_UNSIGNED_LONG: - case uno::TypeClass_UNSIGNED_HYPER: - try - { - aReturn = convertStringToSimple(ControlValue, ePropertyType); - } - catch( const script::CannotConvertException& ) { } - catch( const lang::IllegalArgumentException& ) { } - break; - - default: - #if OSL_DEBUG_LEVEL > 0 - bool bCanConvert = - #endif - convertStringToGenericValue( ControlValue, aReturn, ControlValueType ); - - #if OSL_DEBUG_LEVEL > 0 - // could not convert ... - if ( !bCanConvert && ControlValue.getLength() ) - { - ::rtl::OString sMessage( "StringRepresentation::convertStringRepresentationToPropertyValue: cannot convert into values of type '" ); - sMessage += ::rtl::OString( ControlValueType.getTypeName().getStr(), ControlValueType.getTypeName().getLength(), RTL_TEXTENCODING_ASCII_US ); - sMessage += ::rtl::OString( "'!" ); - OSL_FAIL( sMessage.getStr() ); - } - #endif - } - - return aReturn; -} - -// lang::XInitialization: -void SAL_CALL StringRepresentation::initialize(const uno::Sequence< uno::Any > & aArguments) throw (uno::RuntimeException, uno::Exception) -{ - sal_Int32 nLength = aArguments.getLength(); - if ( nLength ) - { - const uno::Any* pIter = aArguments.getConstArray(); - m_xTypeConverter.set(*pIter++,uno::UNO_QUERY); - if ( nLength == 3 ) - { - ::rtl::OUString sConstantName; - *pIter++ >>= sConstantName; - *pIter >>= m_aValues; - - if ( m_xContext.is() ) - { - uno::Reference< container::XHierarchicalNameAccess > xTypeDescProv( - m_xContext->getValueByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) ) ), - uno::UNO_QUERY_THROW ); - - m_xTypeDescription.set( xTypeDescProv->getByHierarchicalName( sConstantName ), uno::UNO_QUERY_THROW ); - m_aConstants = m_xTypeDescription->getConstants(); - } - } - } -} -//------------------------------------------------------------------------ -::rtl::OUString StringRepresentation::convertSimpleToString( const uno::Any& _rValue ) -{ - ::rtl::OUString sReturn; - if ( m_xTypeConverter.is() && _rValue.hasValue() ) - { - try - { - if ( m_aConstants.getLength() ) - { - sal_Int16 nConstantValue = 0; - if ( _rValue >>= nConstantValue ) - { - const uno::Reference< reflection::XConstantTypeDescription>* pIter = m_aConstants.getConstArray(); - const uno::Reference< reflection::XConstantTypeDescription>* pEnd = pIter + m_aConstants.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) - { - if ( (*pIter)->getConstantValue() == _rValue ) - { - OSL_ENSURE(i < m_aValues.getLength() ,"StringRepresentation::convertSimpleToString: Index is not in range of m_aValues"); - sReturn = m_aValues[i]; - break; - } - } - } - } - - if ( !sReturn.getLength() ) - m_xTypeConverter->convertToSimpleType( _rValue, uno::TypeClass_STRING ) >>= sReturn; - } - catch( script::CannotConvertException& ) { } - catch( lang::IllegalArgumentException& ) { } - } - return sReturn; -} - -//-------------------------------------------------------------------- -namespace -{ - struct ConvertIntegerFromAndToString - { - ::rtl::OUString operator()( sal_Int32 _rIntValue ) const - { - return ::rtl::OUString::valueOf( (sal_Int32)_rIntValue ); - } - sal_Int32 operator()( const ::rtl::OUString& _rStringValue ) const - { - return _rStringValue.toInt32(); - } - }; - - struct StringIdentity - { - ::rtl::OUString operator()( const ::rtl::OUString& _rValue ) const - { - return _rValue; - } - }; - - template < class ElementType, class Transformer > - ::rtl::OUString composeSequenceElements( const Sequence< ElementType >& _rElements, const Transformer& _rTransformer ) - { - String sCompose; - - // loop through the elements and concatenate the string representations of the integers - // (separated by a line break) - const ElementType* pElements = _rElements.getConstArray(); - const ElementType* pElementsEnd = pElements + _rElements.getLength(); - for ( ; pElements != pElementsEnd; ++pElements ) - { - sCompose += String( _rTransformer( *pElements ) ); - if ( pElements != pElementsEnd ) - sCompose += '\n'; - } - - return sCompose; - } - - template < class ElementType, class Transformer > - void splitComposedStringToSequence( const ::rtl::OUString& _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) - { - _out_SplitUp.realloc( 0 ); - if ( !_rComposed.getLength() ) - return; - sal_Int32 tokenPos = 0; - do - { - _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp[ _out_SplitUp.getLength() - 1 ] = (ElementType)_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) ); - } - while ( tokenPos != -1 ); - } -} - -//-------------------------------------------------------------------- -bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue, ::rtl::OUString& _rStringRep ) -{ - bool bCanConvert = true; - - switch ( _rValue.getValueTypeClass() ) - { - case uno::TypeClass_STRING: - _rValue >>= _rStringRep; - break; - - case uno::TypeClass_BOOLEAN: - { - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries); - sal_Bool bValue = sal_False; - _rValue >>= bValue; - _rStringRep = bValue ? aListEntries[1] : aListEntries[0]; - } - break; - - // some sequence types - case uno::TypeClass_SEQUENCE: - { - Sequence< ::rtl::OUString > aStringValues; - Sequence< sal_Int8 > aInt8Values; - Sequence< sal_uInt16 > aUInt16Values; - Sequence< sal_Int16 > aInt16Values; - Sequence< sal_uInt32 > aUInt32Values; - Sequence< sal_Int32 > aInt32Values; - - // string sequences - if ( _rValue >>= aStringValues ) - { - _rStringRep = composeSequenceElements( aStringValues, StringIdentity() ); - } - // byte sequences - else if ( _rValue >>= aInt8Values ) - { - _rStringRep = composeSequenceElements( aInt8Values, ConvertIntegerFromAndToString() ); - } - // uInt16 sequences - else if ( _rValue >>= aUInt16Values ) - { - _rStringRep = composeSequenceElements( aUInt16Values, ConvertIntegerFromAndToString() ); - } - // Int16 sequences - else if ( _rValue >>= aInt16Values ) - { - _rStringRep = composeSequenceElements( aInt16Values, ConvertIntegerFromAndToString() ); - } - // uInt32 sequences - else if ( _rValue >>= aUInt32Values ) - { - _rStringRep = composeSequenceElements( aUInt32Values, ConvertIntegerFromAndToString() ); - } - // Int32 sequences - else if ( _rValue >>= aInt32Values ) - { - _rStringRep = composeSequenceElements( aInt32Values, ConvertIntegerFromAndToString() ); - } - else - bCanConvert = false; - } - break; - case uno::TypeClass_CONSTANT: - { - int i = 0; - ++i; - } - break; - - // some structs - case uno::TypeClass_STRUCT: - OSL_FAIL( "StringRepresentation::convertGenericValueToString(STRUCT): this is dead code - isn't it?" ); - if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::Date* >( NULL ) ) ) ) - { - // weird enough, the string representation of dates, as used - // by the control displaying dates, and thus as passed through the layers, - // is YYYYMMDD. - util::Date aUnoDate; - _rValue >>= aUnoDate; - _rStringRep = ::dbtools::DBTypeConversion::toDateString(aUnoDate); - } - else if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::Time* >( NULL ) ) ) ) - { - // similar for time (HHMMSSHH) - util::Time aUnoTime; - _rValue >>= aUnoTime; - _rStringRep = ::dbtools::DBTypeConversion::toTimeString(aUnoTime); - } - else if ( _rValue.getValueType().equals( ::getCppuType( static_cast< util::DateTime* >( NULL ) ) ) ) - { - util::DateTime aUnoDateTime; - _rValue >>= aUnoDateTime; - _rStringRep = ::dbtools::DBTypeConversion::toDateTimeString(aUnoDateTime); - } - else - bCanConvert = false; - break; - - default: - bCanConvert = false; - break; - } - - return bCanConvert; -} -//------------------------------------------------------------------------ -uno::Any StringRepresentation::convertStringToSimple( const ::rtl::OUString& _rValue,const uno::TypeClass& _ePropertyType ) -{ - uno::Any aReturn; - if ( m_xTypeConverter.is() && _rValue.getLength() ) - { - try - { - if ( m_aConstants.getLength() && m_aValues.getLength() ) - { - const ::rtl::OUString* pIter = m_aValues.getConstArray(); - const ::rtl::OUString* pEnd = pIter + m_aValues.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) - { - if ( *pIter == _rValue ) - { - OSL_ENSURE(i < m_aConstants.getLength() ,"StringRepresentation::convertSimpleToString: Index is not in range of m_aValues"); - aReturn <<= m_aConstants[i]->getConstantValue(); - break; - } - } - } - - if ( !aReturn.hasValue() ) - aReturn = m_xTypeConverter->convertToSimpleType( makeAny( _rValue ), _ePropertyType ); - } - catch( script::CannotConvertException& ) { } - catch( lang::IllegalArgumentException& ) { } - } - return aReturn; -} -//-------------------------------------------------------------------- -bool StringRepresentation::convertStringToGenericValue( const ::rtl::OUString& _rStringRep, uno::Any& _rValue, const uno::Type& _rTargetType ) -{ - bool bCanConvert = true; - - switch ( _rTargetType.getTypeClass() ) - { - case uno::TypeClass_STRING: - _rValue <<= _rStringRep; - break; - - case uno::TypeClass_BOOLEAN: - { - ::std::vector< ::rtl::OUString > aListEntries; - tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries); - if ( aListEntries[0] == _rStringRep ) - _rValue <<= (sal_Bool)sal_False; - else - _rValue <<= (sal_Bool)sal_True; - } - break; - - case uno::TypeClass_SEQUENCE: - { - uno::Type aElementType = ::comphelper::getSequenceElementType( _rTargetType ); - - String aStr( _rStringRep ); - switch ( aElementType.getTypeClass() ) - { - case uno::TypeClass_STRING: - { - Sequence< ::rtl::OUString > aElements; - splitComposedStringToSequence( aStr, aElements, StringIdentity() ); - _rValue <<= aElements; - } - break; - case uno::TypeClass_SHORT: - { - Sequence< sal_Int16 > aElements; - splitComposedStringToSequence( aStr, aElements, ConvertIntegerFromAndToString() ); - _rValue <<= aElements; - } - break; - case uno::TypeClass_UNSIGNED_SHORT: - { - Sequence< sal_uInt16 > aElements; - splitComposedStringToSequence( aStr, aElements, ConvertIntegerFromAndToString() ); - _rValue <<= aElements; - } - break; - case uno::TypeClass_LONG: - { - Sequence< sal_Int32 > aElements; - splitComposedStringToSequence( aStr, aElements, ConvertIntegerFromAndToString() ); - _rValue <<= aElements; - } - break; - case uno::TypeClass_UNSIGNED_LONG: - { - Sequence< sal_uInt32 > aElements; - splitComposedStringToSequence( aStr, aElements, ConvertIntegerFromAndToString() ); - _rValue <<= aElements; - } - break; - case uno::TypeClass_BYTE: - { - Sequence< sal_Int8 > aElements; - splitComposedStringToSequence( aStr, aElements, ConvertIntegerFromAndToString() ); - _rValue <<= aElements; - } - break; - default: - bCanConvert = false; - break; - } - } - break; - - case uno::TypeClass_STRUCT: - OSL_FAIL( "StringRepresentation::convertStringToGenericValue(STRUCT): this is dead code - isn't it?" ); - if ( _rTargetType.equals( ::getCppuType( static_cast< util::Date* >( NULL ) ) ) ) - { - // weird enough, the string representation of dates, as used - // by the control displaying dates, and thus as passed through the layers, - // is YYYYMMDD. - - _rValue <<= ::dbtools::DBTypeConversion::toDate(_rStringRep); - } - else if ( _rTargetType.equals( ::getCppuType( static_cast< util::Time* >( NULL ) ) ) ) - { - // similar for time (HHMMSSHH) - _rValue <<= ::dbtools::DBTypeConversion::toTime(_rStringRep); - } - else if ( _rTargetType.equals( ::getCppuType( static_cast< util::DateTime* >( NULL ) ) ) ) - { - _rValue <<= ::dbtools::DBTypeConversion::toDateTime(_rStringRep); - } - else - bCanConvert = false; - break; - - default: - bCanConvert = false; - break; - } - - return bCanConvert; -} -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ -} // pcr -//------------------------------------------------------------------------ - - -// component helper namespace -namespace comp_StringRepresentation { - -::rtl::OUString SAL_CALL _getImplementationName() { - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "StringRepresentation")); -} - -uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames() -{ - uno::Sequence< ::rtl::OUString > s(1); - s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.inspection.StringRepresentation")); - return s; -} - -uno::Reference< uno::XInterface > SAL_CALL _create( - const uno::Reference< uno::XComponentContext > & context) - SAL_THROW((uno::Exception)) -{ - return static_cast< ::cppu::OWeakObject * >(new pcr::StringRepresentation(context)); -} - -} // closing component helper namespace - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_StringRepresentation() -{ - ::pcr::PcrModule::getInstance().registerImplementation( - comp_StringRepresentation::_getImplementationName(), - comp_StringRepresentation::_getSupportedServiceNames(), - comp_StringRepresentation::_create - ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx deleted file mode 100644 index 19f413216..000000000 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ /dev/null @@ -1,450 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "submissionhandler.hxx" -#include "formmetadata.hxx" -#include "formstrings.hxx" -#include "handlerhelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_SubmissionPropertyHandler() -{ - ::pcr::SubmissionPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::comphelper; - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::xforms; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::inspection; - - //==================================================================== - //= SubmissionHelper - //==================================================================== - //-------------------------------------------------------------------- - SubmissionHelper::SubmissionHelper( ::osl::Mutex& _rMutex, const Reference< XPropertySet >& _rxIntrospectee, const Reference< frame::XModel >& _rxContextDocument ) - :EFormsHelper( _rMutex, _rxIntrospectee, _rxContextDocument ) - { - OSL_ENSURE( canTriggerSubmissions( _rxIntrospectee, _rxContextDocument ), - "SubmissionHelper::SubmissionHelper: you should not have instantiated me!" ); - } - - //-------------------------------------------------------------------- - bool SubmissionHelper::canTriggerSubmissions( const Reference< XPropertySet >& _rxControlModel, - const Reference< frame::XModel >& _rxContextDocument ) SAL_THROW(()) - { - if ( !EFormsHelper::isEForm( _rxContextDocument ) ) - return false; - - try - { - Reference< submission::XSubmissionSupplier > xSubmissionSupp( _rxControlModel, UNO_QUERY ); - if ( xSubmissionSupp.is() ) - return true; - } - catch( const Exception& ) - { - OSL_FAIL( "SubmissionHelper::canTriggerSubmissions: caught an exception!" ); - } - return false; - } - - //==================================================================== - //= SubmissionPropertyHandler - //==================================================================== - DBG_NAME( SubmissionPropertyHandler ) - //-------------------------------------------------------------------- - SubmissionPropertyHandler::SubmissionPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EditPropertyHandler_Base( _rxContext ) - ,OPropertyChangeListener( m_aMutex ) - ,m_pPropChangeMultiplexer( NULL ) - { - DBG_CTOR( SubmissionPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - SubmissionPropertyHandler::~SubmissionPropertyHandler( ) - { - disposeAdapter(); - DBG_DTOR( SubmissionPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL SubmissionPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.SubmissionPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.SubmissionPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Any SAL_CALL SubmissionPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::getPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - Any aReturn; - try - { - switch ( nPropId ) - { - case PROPERTY_ID_SUBMISSION_ID: - { - Reference< submission::XSubmissionSupplier > xSubmissionSupp( m_xComponent, UNO_QUERY ); - OSL_ENSURE( xSubmissionSupp.is(), "SubmissionPropertyHandler::getPropertyValue: this should never happen ..." ); - // this handler is not intended for components which are no XSubmissionSupplier - Reference< submission::XSubmission > xSubmission; - if ( xSubmissionSupp.is() ) - xSubmission = xSubmissionSupp->getSubmission( ); - aReturn <<= xSubmission; - } - break; - - case PROPERTY_ID_XFORMS_BUTTONTYPE: - { - FormButtonType eType = FormButtonType_PUSH; - OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_BUTTONTYPE ) >>= eType ); - if ( ( eType != FormButtonType_PUSH ) && ( eType != FormButtonType_SUBMIT ) ) - eType = FormButtonType_PUSH; - aReturn <<= eType; - } - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::getPropertyValue: cannot handle this property!" ); - break; - } - } - catch( const Exception& ) - { - OSL_FAIL( "SubmissionPropertyHandler::getPropertyValue: caught an exception!" ); - } - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL SubmissionPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::setPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - try - { - switch ( nPropId ) - { - case PROPERTY_ID_SUBMISSION_ID: - { - Reference< submission::XSubmission > xSubmission; - OSL_VERIFY( _rValue >>= xSubmission ); - - Reference< submission::XSubmissionSupplier > xSubmissionSupp( m_xComponent, UNO_QUERY ); - OSL_ENSURE( xSubmissionSupp.is(), "SubmissionPropertyHandler::setPropertyValue: this should never happen ..." ); - // this handler is not intended for components which are no XSubmissionSupplier - if ( xSubmissionSupp.is() ) - { - xSubmissionSupp->setSubmission( xSubmission ); - impl_setContextDocumentModified_nothrow(); - } - } - break; - - case PROPERTY_ID_XFORMS_BUTTONTYPE: - m_xComponent->setPropertyValue( PROPERTY_BUTTONTYPE, _rValue ); - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::setPropertyValue: cannot handle this id!" ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "SubmissionPropertyHandler::setPropertyValue: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pHelper.get() ) - return Sequence< ::rtl::OUString >(); - - Sequence< ::rtl::OUString > aReturn( 1 ); - aReturn[ 0 ] = PROPERTY_XFORMS_BUTTONTYPE; - return aReturn; - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL SubmissionPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pHelper.get() ) - return Sequence< ::rtl::OUString >(); - - Sequence< ::rtl::OUString > aReturn( 3 ); - aReturn[ 0 ] = PROPERTY_TARGET_URL; - aReturn[ 1 ] = PROPERTY_TARGET_FRAME; - aReturn[ 2 ] = PROPERTY_BUTTONTYPE; - return aReturn; - } - - //-------------------------------------------------------------------- - void SubmissionPropertyHandler::onNewComponent() - { - if ( m_pPropChangeMultiplexer ) - { - m_pPropChangeMultiplexer->dispose(); - m_pPropChangeMultiplexer->release(); - m_pPropChangeMultiplexer = NULL; - } - - EditPropertyHandler_Base::onNewComponent(); - - Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); - DBG_ASSERT( xDocument.is(), "SubmissionPropertyHandler::onNewComponent: no document!" ); - - m_pHelper.reset( NULL ); - - if ( SubmissionHelper::canTriggerSubmissions( m_xComponent, xDocument ) ) - { - m_pHelper.reset( new SubmissionHelper( m_aMutex, m_xComponent, xDocument ) ); - - m_pPropChangeMultiplexer = new OPropertyChangeMultiplexer( this, m_xComponent ); - m_pPropChangeMultiplexer->acquire(); - m_pPropChangeMultiplexer->addProperty( PROPERTY_BUTTONTYPE ); - } - } - - //-------------------------------------------------------------------- - Sequence< Property > SAL_CALL SubmissionPropertyHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - if ( m_pHelper.get() ) - { - implAddPropertyDescription( aProperties, PROPERTY_SUBMISSION_ID, ::getCppuType( static_cast< Reference< submission::XSubmission > * >( NULL ) ) ); - implAddPropertyDescription( aProperties, PROPERTY_XFORMS_BUTTONTYPE, ::getCppuType( static_cast< FormButtonType* >( NULL ) ) ); - } - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL SubmissionPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - if ( !m_pHelper.get() ) - RuntimeException(); - - ::std::vector< ::rtl::OUString > aListEntries; - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_SUBMISSION_ID: - const_cast< SubmissionHelper* >( m_pHelper.get() )->getAllElementUINames( EFormsHelper::Submission, aListEntries, false ); - break; - - case PROPERTY_ID_XFORMS_BUTTONTYPE: - { - // available options are nearly the same as for the "normal" button type, but only the - // first two options - aListEntries = m_pInfoService->getPropertyEnumRepresentations( PROPERTY_ID_BUTTONTYPE ); - aListEntries.resize( 2 ); - } - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::describePropertyLine: cannot handle this id!" ); - return LineDescriptor(); - } - - LineDescriptor aDescriptor; - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_True ); - aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "General" ) ); - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); - return aDescriptor; - } - - //-------------------------------------------------------------------- - void SAL_CALL SubmissionPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - OSL_PRECOND( m_pHelper.get(), "SubmissionPropertyHandler::actuatingPropertyChanged: inconsistentcy!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - switch ( nActuatingPropId ) - { - case PROPERTY_ID_XFORMS_BUTTONTYPE: - { - FormButtonType eType = FormButtonType_PUSH; - OSL_VERIFY( _rNewValue >>= eType ); - _rxInspectorUI->enablePropertyUI( PROPERTY_SUBMISSION_ID, eType == FormButtonType_SUBMIT ); - } - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::actuatingPropertyChanged: cannot handle this id!" ); - } - } - - //-------------------------------------------------------------------- - Any SAL_CALL SubmissionPropertyHandler::convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aPropertyValue; - - OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aPropertyValue; - - ::rtl::OUString sControlValue; - OSL_VERIFY( _rControlValue >>= sControlValue ); - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_SUBMISSION_ID: - { - Reference< XSubmission > xSubmission( m_pHelper->getModelElementFromUIName( EFormsHelper::Submission, sControlValue ), UNO_QUERY ); - aPropertyValue <<= xSubmission; - } - break; - - case PROPERTY_ID_XFORMS_BUTTONTYPE: - { - ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, ::getCppuType( static_cast< FormButtonType* >( NULL ) ), PROPERTY_ID_BUTTONTYPE ) ); - // TODO/UNOize: make aEnumConversion a member? - aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue ); - } - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::convertToPropertyValue: cannot handle this id!" ); - } - - return aPropertyValue; - } - - //-------------------------------------------------------------------- - Any SAL_CALL SubmissionPropertyHandler::convertToControlValue( const ::rtl::OUString& _rPropertyName, const Any& _rPropertyValue, const Type& _rControlValueType ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aControlValue; - - OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::convertToControlValue: we have no SupportedProperties!" ); - if ( !m_pHelper.get() ) - return aControlValue; - - OSL_ENSURE( _rControlValueType.getTypeClass() == TypeClass_STRING, - "SubmissionPropertyHandler::convertToControlValue: all our controls should use strings for value exchange!" ); - (void)_rControlValueType; - - PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) ); - switch ( nPropId ) - { - case PROPERTY_ID_SUBMISSION_ID: - { - Reference< XPropertySet > xSubmission( _rPropertyValue, UNO_QUERY ); - if ( xSubmission.is() ) - aControlValue <<= m_pHelper->getModelElementUIName( EFormsHelper::Submission, xSubmission ); - } - break; - - case PROPERTY_ID_XFORMS_BUTTONTYPE: - { - ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), PROPERTY_ID_BUTTONTYPE ) ); - // TODO/UNOize: make aEnumConversion a member? - aControlValue <<= aEnumConversion->getDescriptionForValue( _rPropertyValue ); - } - break; - - default: - OSL_FAIL( "SubmissionPropertyHandler::convertToControlValue: cannot handle this id!" ); - } - - return aControlValue; - } - - //-------------------------------------------------------------------- - void SubmissionPropertyHandler::_propertyChanged( const PropertyChangeEvent& _rEvent ) throw(RuntimeException) - { - if ( _rEvent.PropertyName == PROPERTY_BUTTONTYPE ) - firePropertyChange( PROPERTY_XFORMS_BUTTONTYPE, PROPERTY_ID_XFORMS_BUTTONTYPE, _rEvent.OldValue, _rEvent.NewValue ); - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/submissionhandler.hxx b/extensions/source/propctrlr/submissionhandler.hxx deleted file mode 100644 index 1c2bd4082..000000000 --- a/extensions/source/propctrlr/submissionhandler.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX - -#include "propertyhandler.hxx" -#include "eformshelper.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -namespace comphelper -{ - class OPropertyChangeMultiplexer; -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= SubmissionHelper - //==================================================================== - class SubmissionHelper : public EFormsHelper - { - public: - SubmissionHelper( - osl::Mutex& _rMutex, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - - /** determines whether the given control model is able to trigger submissions - - Instances of the SubmissionHelper class should not be instantiated - for components where this method returned - */ - static bool canTriggerSubmissions( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ) SAL_THROW(()); - }; - - //==================================================================== - //= SubmissionPropertyHandler - //==================================================================== - class SubmissionPropertyHandler; - typedef HandlerComponentBase< SubmissionPropertyHandler > EditPropertyHandler_Base; - /** a property handler for any virtual string properties - */ - class SubmissionPropertyHandler : public EditPropertyHandler_Base, public ::comphelper::OPropertyChangeListener - { - private: - ::osl::Mutex m_aMutex; - ::std::auto_ptr< SubmissionHelper > m_pHelper; - ::comphelper::OPropertyChangeMultiplexer* m_pPropChangeMultiplexer; - - public: - SubmissionPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - ~SubmissionPropertyHandler(); - - protected: - // XPropertyHandler overriables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor - SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - virtual void onNewComponent(); - - private: - // OPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_SUBMISSIONHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx deleted file mode 100644 index 9ea00f2f8..000000000 --- a/extensions/source/propctrlr/taborder.cxx +++ /dev/null @@ -1,417 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "taborder.hxx" -#include "taborder.hrc" - -#include "modulepcr.hxx" -#include "formresid.hrc" -#include "formstrings.hxx" -#include -#include -#include -#include -#include -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::datatransfer; - - //======================================================================== - //= OSimpleTabModel - //======================================================================== - class OSimpleTabModel : public ::cppu::WeakImplHelper1< XTabControllerModel> - { - Sequence< Reference< XControlModel > > m_aModels; - - public: - OSimpleTabModel( const Sequence< Reference< XControlModel > >& _rModels ) - :m_aModels( _rModels ) - { - } - - // XTabControllerModel - virtual void SAL_CALL setControlModels(const Sequence< Reference< XControlModel > >& rModels) throw( RuntimeException ) {m_aModels = rModels;} - virtual Sequence< Reference< XControlModel > > SAL_CALL getControlModels(void) throw( RuntimeException ) {return m_aModels;} - virtual void SAL_CALL setGroup(const Sequence< Reference< XControlModel > >& /*Group*/, const ::rtl::OUString& /*GroupName*/) throw( RuntimeException ) {} - virtual sal_Int32 SAL_CALL getGroupCount(void) throw( RuntimeException ) {return 0;} - virtual void SAL_CALL getGroup(sal_Int32 /*nGroup*/, Sequence< Reference< XControlModel > >& /*Group*/, ::rtl::OUString& /*Name*/) throw( RuntimeException ) {} - virtual void SAL_CALL getGroupByName(const ::rtl::OUString& /*Name*/, Sequence< Reference< XControlModel > >& /*Group*/) throw( RuntimeException ) {} - virtual sal_Bool SAL_CALL getGroupControl(void) throw( RuntimeException ){return sal_False;} ; - virtual void SAL_CALL setGroupControl(sal_Bool /*GroupControl*/) throw( RuntimeException ){}; - }; - - //======================================================================== - //= TabOrderDialog - //======================================================================== - DBG_NAME(TabOrderDialog) - //------------------------------------------------------------------------ - TabOrderDialog::TabOrderDialog( Window* _pParent, const Reference< XTabControllerModel >& _rxTabModel, - const Reference< XControlContainer >& _rxControlCont, const Reference< XMultiServiceFactory >& _rxORB ) - :ModalDialog( _pParent, PcrRes( RID_DLG_TABORDER ) ) - ,m_xModel( _rxTabModel ) - ,m_xControlContainer( _rxControlCont ) - ,m_xORB( _rxORB ) - ,aFT_Controls( this, PcrRes( FT_CONTROLS ) ) - ,aLB_Controls( this, PcrRes( CTRL_TREE ) ) - ,aPB_OK( this, PcrRes( PB_OK ) ) - ,aPB_CANCEL( this, PcrRes( PB_CANCEL ) ) - ,aPB_HELP( this, PcrRes( PB_HELP ) ) - ,aPB_MoveUp( this, PcrRes( PB_MOVE_UP ) ) - ,aPB_MoveDown( this, PcrRes( PB_MOVE_DOWN ) ) - ,aPB_AutoOrder( this, PcrRes( PB_AUTO_ORDER ) ) - ,pImageList( NULL ) - { - DBG_CTOR(TabOrderDialog,NULL); - - aPB_MoveUp.SetClickHdl( LINK( this, TabOrderDialog, MoveUpClickHdl ) ); - aPB_MoveDown.SetClickHdl( LINK( this, TabOrderDialog, MoveDownClickHdl ) ); - aPB_AutoOrder.SetClickHdl( LINK( this, TabOrderDialog, AutoOrderClickHdl ) ); - aPB_OK.SetClickHdl( LINK( this, TabOrderDialog, OKClickHdl ) ); - aPB_OK.Disable(); - - pImageList = new ImageList( PcrRes( RID_IL_FORMEXPLORER ) ); - - if ( m_xModel.is() ) - m_xTempModel = new OSimpleTabModel( m_xModel->getControlModels() ); - - if ( m_xTempModel.is() && m_xControlContainer.is() ) - FillList(); - - if ( aLB_Controls.GetEntryCount() < 2 ) - { - aPB_MoveUp.Disable(); - aPB_MoveDown.Disable(); - aPB_AutoOrder.Disable(); - } - - FreeResource(); - } - - //------------------------------------------------------------------------ - void TabOrderDialog::SetModified() - { - aPB_OK.Enable(); - } - - //------------------------------------------------------------------------ - TabOrderDialog::~TabOrderDialog() - { - aLB_Controls.Hide(); - // delete pLB_Controls; - delete pImageList; - - DBG_DTOR(TabOrderDialog,NULL); - } - - //------------------------------------------------------------------------ - Image TabOrderDialog::GetImage( const Reference< XPropertySet >& _rxSet ) const - { - sal_uInt16 nImageId = RID_SVXIMG_CONTROL; - // TODO: classify controls also in Basic propbrw - if ( _rxSet.is() && ::comphelper::hasProperty( PROPERTY_CLASSID, _rxSet ) ) - { - switch( ::comphelper::getINT16( _rxSet->getPropertyValue( PROPERTY_CLASSID ) ) ) - { - case FormComponentType::COMMANDBUTTON: nImageId = RID_SVXIMG_BUTTON; break; - case FormComponentType::FIXEDTEXT: nImageId = RID_SVXIMG_FIXEDTEXT; break; - case FormComponentType::TEXTFIELD: nImageId = RID_SVXIMG_EDIT; break; - case FormComponentType::RADIOBUTTON: nImageId = RID_SVXIMG_RADIOBUTTON; break; - case FormComponentType::CHECKBOX: nImageId = RID_SVXIMG_CHECKBOX; break; - case FormComponentType::LISTBOX: nImageId = RID_SVXIMG_LISTBOX; break; - case FormComponentType::COMBOBOX: nImageId = RID_SVXIMG_COMBOBOX; break; - case FormComponentType::GROUPBOX: nImageId = RID_SVXIMG_GROUPBOX; break; - case FormComponentType::IMAGEBUTTON: nImageId = RID_SVXIMG_IMAGEBUTTON; break; - case FormComponentType::FILECONTROL: nImageId = RID_SVXIMG_FILECONTROL; break; - case FormComponentType::HIDDENCONTROL: nImageId = RID_SVXIMG_HIDDEN; break; - case FormComponentType::DATEFIELD: nImageId = RID_SVXIMG_DATEFIELD; break; - case FormComponentType::TIMEFIELD: nImageId = RID_SVXIMG_TIMEFIELD; break; - case FormComponentType::NUMERICFIELD: nImageId = RID_SVXIMG_NUMERICFIELD; break; - case FormComponentType::CURRENCYFIELD: nImageId = RID_SVXIMG_CURRENCYFIELD; break; - case FormComponentType::PATTERNFIELD: nImageId = RID_SVXIMG_PATTERNFIELD; break; - case FormComponentType::IMAGECONTROL: nImageId = RID_SVXIMG_IMAGECONTROL; break; - case FormComponentType::GRIDCONTROL: nImageId = RID_SVXIMG_GRID; break; - case FormComponentType::SCROLLBAR: nImageId = RID_SVXIMG_SCROLLBAR; break; - case FormComponentType::SPINBUTTON: nImageId = RID_SVXIMG_SPINBUTTON; break; - case FormComponentType::NAVIGATIONBAR: nImageId = RID_SVXIMG_NAVIGATIONBAR; break; - default: - OSL_FAIL( "TabOrderDialog::GetImage: unknown control type" ); - } - } - - return pImageList->GetImage( nImageId ); - } - - //------------------------------------------------------------------------ - void TabOrderDialog::FillList() - { - DBG_ASSERT( m_xTempModel.is() && m_xControlContainer.is(), "TabOrderDialog::FillList: invalid call!" ); - if ( !m_xTempModel.is() || !m_xControlContainer.is() ) - return; - - aLB_Controls.Clear(); - - try - { - Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels() ); - const Reference< XControlModel >* pControlModels = aControlModels.getConstArray(); - - ::rtl::OUString aName; - Image aImage; - - for ( sal_Int32 i=0; i < aControlModels.getLength(); ++i, ++pControlModels ) - { - Reference< XPropertySet > xControl( *pControlModels, UNO_QUERY ); - Reference< XPropertySetInfo > xPI; - if ( xControl.is() ) - xPI = xControl->getPropertySetInfo(); - - if ( xPI.is() ) - { - if ( xPI->hasPropertyByName( PROPERTY_TABSTOP ) ) - { - aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) ); - // TODO: do Basic controls have a name? - aImage = GetImage( xControl ); - aLB_Controls.InsertEntry( aName, aImage, aImage, 0, sal_False, LIST_APPEND, xControl.get() ); - } - } - else - { - // no property set -> no tab order - OSL_FAIL( "TabOrderDialog::FillList: invalid control encountered!" ); - aLB_Controls.Clear(); - break; - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "TabOrderDialog::FillList: caught an exception!" ); - } - - // select first entry - SvLBoxEntry* pFirstEntry = aLB_Controls.GetEntry( 0 ); - if ( pFirstEntry ) - aLB_Controls.Select( pFirstEntry ); - } - - //------------------------------------------------------------------------ - IMPL_LINK( TabOrderDialog, MoveUpClickHdl, Button*, /*pButton*/ ) - { - aLB_Controls.MoveSelection( -1 ); - return 0; - } - - //------------------------------------------------------------------------ - IMPL_LINK( TabOrderDialog, MoveDownClickHdl, Button*, /*pButton*/ ) - { - aLB_Controls.MoveSelection( 1 ); - return 0; - } - - //------------------------------------------------------------------------ - IMPL_LINK( TabOrderDialog, AutoOrderClickHdl, Button*, /*pButton*/ ) - { - try - { - Reference< XTabController > xTabController; - if ( m_xORB.is() ) - xTabController = xTabController.query( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) ) ); - DBG_ASSERT( xTabController.is(), "TabOrderDialog::AutoOrderClickHdl: could not instantiate a tab controller!" ); - if ( !xTabController.is() ) - return 0; - - xTabController->setModel( m_xTempModel ); - xTabController->setContainer( m_xControlContainer ); - xTabController->autoTabOrder(); - - SetModified(); - FillList(); - - ::comphelper::disposeComponent( xTabController ); - } - catch( const Exception& ) - { - OSL_FAIL( "TabOrderDialog::AutoOrderClickHdl: caught an exception!" ); - } - - return 0; - } - - //------------------------------------------------------------------------ - IMPL_LINK( TabOrderDialog, OKClickHdl, Button*, /*pButton*/ ) - { - sal_uLong nEntryCount = aLB_Controls.GetEntryCount(); - Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount ); - Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels()); - Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray(); - const Reference< XControlModel > * pControlModels = aControlModels.getConstArray(); - - for (sal_uLong i=0; i < nEntryCount; i++) - { - SvLBoxEntry* pEntry = aLB_Controls.GetEntry(i); - - for( sal_Int32 j=0; j xSet(pControlModels[j], UNO_QUERY); - if ((XPropertySet*)xSet.get() == ((XPropertySet*)pEntry->GetUserData())) - { - pSortedControlModels[i] = pControlModels[j]; - break; - } - } - } - - // TODO: UNO action (to bracket all the single actions which are being created) - m_xModel->setControlModels( aSortedControlModelSeq ); - - EndDialog( sal_True ); - return 0; - } - - //======================================================================== - //= TabOrderListBox - //======================================================================== - DBG_NAME(TabOrderListBox); - //------------------------------------------------------------------------ - TabOrderListBox::TabOrderListBox( Window* pParent, const ResId& rResId ) - :SvTreeListBox( pParent, rResId ) - { - DBG_CTOR(TabOrderListBox,NULL); - SetDragDropMode(0xFFFF/*SV_DRAGDROP_CTRL_MOVE*/); - // Hmm. The flag alone is not enough, so to be on the safe side ... - - SetSelectionMode( MULTIPLE_SELECTION ); - } - - //------------------------------------------------------------------------ - TabOrderListBox::~TabOrderListBox() - { - DBG_DTOR(TabOrderListBox,NULL); - } - - //------------------------------------------------------------------------ - void TabOrderListBox::ModelHasMoved( SvListEntry* _pSource ) - { - SvTreeListBox::ModelHasMoved( _pSource ); - - ((TabOrderDialog*)Window::GetParent())->SetModified(); - } - - //------------------------------------------------------------------------ - void TabOrderListBox::MoveSelection( long nRelPos ) - { - UniString aSelEntryPrevText,aSelEntryNextText; - Image aImage; - for (long i=0; iSetModified(); - - ////////////////////////////////////////////////////////////////////// - // move entries - if( nRelPos < 0 ) - { - SvLBoxEntry* pFirstSelected = FirstSelected(); - if( !pFirstSelected ) return; - sal_uLong nFirstSelPos = GetModel()->GetAbsPos( pFirstSelected ); - if( nFirstSelPos == 0 ) return; - - SvLBoxEntry* pSelEntry = pFirstSelected; - while( pSelEntry ) - { - sal_uLong nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); - SvLBoxEntry* pSelEntryPrev = GetEntry( nSelEntryPos-1 ); - aSelEntryPrevText = GetEntryText( pSelEntryPrev ); - aImage = GetExpandedEntryBmp(pSelEntryPrev); - void* pData = pSelEntryPrev->GetUserData(); - - GetModel()->Remove( pSelEntryPrev ); - InsertEntry( aSelEntryPrevText, aImage, aImage, 0, sal_False, nSelEntryPos, pData ); - - pSelEntry = NextSelected( pSelEntry ); - } - } - - else if( nRelPos > 0 ) - { - SvLBoxEntry* pLastSelected = LastSelected(); - if( !pLastSelected ) return; - sal_uLong nLastSelPos = GetModel()->GetAbsPos( pLastSelected ); - - if( (nLastSelPos + nRelPos - i) > (GetEntryCount()-1) ) return; - -#if OSL_DEBUG_LEVEL > 0 - sal_uLong nSelCount = GetSelectionCount(); - (void)nSelCount; -#endif - - - SvLBoxEntry* pSelEntry = pLastSelected; - while( pSelEntry ) - { - sal_uLong nSelEntryPos = GetModel()->GetAbsPos( pSelEntry ); - SvLBoxEntry* pSelEntryNext = GetEntry( nSelEntryPos+1 ); - void* pData = pSelEntryNext->GetUserData(); - - aSelEntryNextText = GetEntryText( pSelEntryNext ); - aImage = GetExpandedEntryBmp(pSelEntryNext); - - GetModel()->Remove( pSelEntryNext ); - InsertEntry( aSelEntryNextText, aImage, aImage, 0, sal_False, nSelEntryPos, pData ); - - pSelEntry = PrevSelected( pSelEntry ); - } - long nThumbPos = GetVScroll()->GetThumbPos(); - long nVisibleSize = GetVScroll()->GetVisibleSize(); - long nFirstVisible = GetModel()->GetAbsPos( FirstVisible()); - - if ( ( nThumbPos + nVisibleSize + 1 ) < (long)( nLastSelPos + 3 ) ) - GetVScroll()->DoScrollAction(SCROLL_LINEDOWN); - else if((nThumbPos+nVisibleSize+1) >= (nFirstVisible)) - GetVScroll()->DoScrollAction(SCROLL_LINEUP); - } - } - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/taborder.hrc b/extensions/source/propctrlr/taborder.hrc deleted file mode 100644 index 03be169a1..000000000 --- a/extensions/source/propctrlr/taborder.hrc +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC -#define EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC - -#define FT_CONTROLS 1 - -#define LB_CONTROLS 1 - -#define PB_MOVE_UP 1 -#define PB_MOVE_DOWN 2 -#define PB_AUTO_ORDER 3 - -#define PB_OK 4 -#define PB_CANCEL 5 -#define PB_HELP 6 - -#define CTRL_TREE 1 - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC - diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx deleted file mode 100644 index e10416376..000000000 --- a/extensions/source/propctrlr/taborder.hxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= TabOrderListBox - //======================================================================== - class TabOrderListBox : public SvTreeListBox - { - public: - TabOrderListBox( Window* pParent, const ResId& rResId ); - virtual ~TabOrderListBox(); - - void MoveSelection( long nRelPos ); - - protected: - virtual void ModelHasMoved(SvListEntry* pSource ); - - private: - using SvTreeListBox::MoveSelection; - }; - - - //======================================================================== - //= TabOrderDialog - //======================================================================== - class TabOrderDialog : public ModalDialog - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > - m_xTempModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > - m_xModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > - m_xControlContainer; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - - FixedText aFT_Controls; - TabOrderListBox aLB_Controls; - - OKButton aPB_OK; - CancelButton aPB_CANCEL; - HelpButton aPB_HELP; - - PushButton aPB_MoveUp; - PushButton aPB_MoveDown; - PushButton aPB_AutoOrder; - - ImageList* pImageList; - - DECL_LINK( MoveUpClickHdl, Button* ); - DECL_LINK( MoveDownClickHdl, Button* ); - DECL_LINK( AutoOrderClickHdl, Button* ); - DECL_LINK( OKClickHdl, Button* ); - - void FillList(); - Image GetImage( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxSet - ) const; - - public: - TabOrderDialog( - Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& _rxTabModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& _rxControlCont, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - virtual ~TabOrderDialog(); - - void SetModified(); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/taborder.src b/extensions/source/propctrlr/taborder.src deleted file mode 100644 index 1dfe0ee58..000000000 --- a/extensions/source/propctrlr/taborder.src +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_ -#include "formresid.hrc" -#endif -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_TABORDER_HRC -#include "taborder.hrc" -#endif -#include "propctrlr.hrc" - -ModalDialog RID_DLG_TABORDER -{ - HelpID = "extensions:ModalDialog:RID_DLG_TABORDER"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 158 ) ; - Text [ en-US ] = "Tab Order" ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedText FT_CONTROLS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Controls" ; - }; - - Control CTRL_TREE - { - Border = TRUE; - Pos = MAP_APPFONT ( 6, 14) ; - Size = MAP_APPFONT ( 90, 136 ) ; - TabStop = TRUE; - HelpId = HID_PROP_TABORDER_CONTROLS; - }; - - PushButton PB_MOVE_UP - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_MOVE_UP"; - Pos = MAP_APPFONT ( 102 , 14 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Move Up" ; - }; - - PushButton PB_MOVE_DOWN - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_MOVE_DOWN"; - Pos = MAP_APPFONT ( 102 , 32 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Move Down" ; - }; - - PushButton PB_AUTO_ORDER - { - HelpID = "extensions:PushButton:RID_DLG_TABORDER:PB_AUTO_ORDER"; - Pos = MAP_APPFONT ( 102 , 50 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - Text [ en-US ] = "Automatic Sort" ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 102 , 100 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE; - }; - - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 102 , 118 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; - - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 102 , 136 ) ; - Size = MAP_APPFONT ( 60 , 14 ) ; - TabStop = TRUE ; - }; -}; - diff --git a/extensions/source/propctrlr/unourl.cxx b/extensions/source/propctrlr/unourl.cxx deleted file mode 100644 index 706dd7ea4..000000000 --- a/extensions/source/propctrlr/unourl.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "unourl.hxx" -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::util; - - //==================================================================== - //= UnoURL - //==================================================================== - UnoURL::UnoURL( const ::rtl::OUString& _rCompleteURL, const Reference< XMultiServiceFactory >& _rxORB ) - { - m_aURL.Complete = _rCompleteURL; - - OSL_ENSURE( _rxORB.is(), "UnoURL::UnoURL: invalid ORB!" ); - Reference< XURLTransformer > xTransform; - try - { - if ( _rxORB.is() ) - { - xTransform = xTransform.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) ) ); - OSL_ENSURE( xTransform.is(), "UnoURL::UnoURL: could not create an URL transformer!" ); - if ( xTransform.is() ) - xTransform->parseStrict( m_aURL ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "UnoURL::UnoURL: caught an exception!" ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/unourl.hxx b/extensions/source/propctrlr/unourl.hxx deleted file mode 100644 index 832475105..000000000 --- a/extensions/source/propctrlr/unourl.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX - -#include -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= UnoURL - //==================================================================== - class UnoURL - { - private: - ::com::sun::star::util::URL m_aURL; - - public: - UnoURL( - const ::rtl::OUString& _rCompleteURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ); - - inline operator const ::rtl::OUString& () const { return m_aURL.Complete; } - inline operator const ::com::sun::star::util::URL& () const { return m_aURL; } - - private: - UnoURL(); // never implemented - }; - -//........................................................................ -} // namespacepcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_UNOURL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx deleted file mode 100644 index b8a791b06..000000000 --- a/extensions/source/propctrlr/usercontrol.cxx +++ /dev/null @@ -1,371 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "usercontrol.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include "modulepcr.hxx" -#include "propresid.hrc" - -//............................................................................ -namespace pcr -{ -//............................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::Type; - using ::com::sun::star::beans::IllegalTypeException; - using ::com::sun::star::uno::RuntimeException; - /** === end UNO using === **/ - namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType; - - //================================================================== - // NumberFormatSampleField - //================================================================== - //------------------------------------------------------------------ - long NumberFormatSampleField::PreNotify( NotifyEvent& rNEvt ) - { - // want to handle two keys myself : Del/Backspace should empty the window (setting my prop to "standard" this way) - if (EVENT_KEYINPUT == rNEvt.GetType()) - { - sal_uInt16 nKey = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); - - if ((KEY_DELETE == nKey) || (KEY_BACKSPACE == nKey)) - { - SetText( String() ); - if ( m_pHelper ) - m_pHelper->ModifiedHdl( this ); - return 1; - } - } - - return BaseClass::PreNotify( rNEvt ); - } - - //------------------------------------------------------------------ - void NumberFormatSampleField::SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier ) - { - if ( pSupplier ) - { - TreatAsNumber( sal_True ); - - SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter(); - SetFormatter( pFormatter, sal_True ); - SetValue( 1234.56789 ); - } - else - { - TreatAsNumber( sal_False ); - SetFormatter( NULL, sal_True ); - SetText( String() ); - } - } - - //================================================================== - // OFormatSampleControl - //================================================================== - //------------------------------------------------------------------ - OFormatSampleControl::OFormatSampleControl( Window* pParent, WinBits nWinStyle ) - :OFormatSampleControl_Base( PropertyControlType::Unknown, pParent, nWinStyle ) - { - } - - //------------------------------------------------------------------ - void SAL_CALL OFormatSampleControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - sal_Int32 nFormatKey = 0; - if ( _rValue >>= nFormatKey ) - { - // else set the new format key, the text will be reformatted - getTypedControlWindow()->SetFormatKey( nFormatKey ); - - SvNumberFormatter* pNF = getTypedControlWindow()->GetFormatter(); - const SvNumberformat* pEntry = pNF->GetEntry( nFormatKey ); - OSL_ENSURE( pEntry, "OFormatSampleControl::setValue: invalid format entry!" ); - - const bool bIsTextFormat = ( pEntry && pEntry->IsTextFormat() ); - if ( bIsTextFormat ) - getTypedControlWindow()->SetText( String( PcrRes( RID_STR_TEXT_FORMAT ) ) ); - else - getTypedControlWindow()->SetValue( pEntry ? getPreviewValue( *pEntry ) : 1234.56789 ); - } - else - getTypedControlWindow()->SetText( String() ); - } - //------------------------------------------------------------------ - double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry ) - { - double nValue = 1234.56789; - switch ( i_rEntry.GetType() & ~NUMBERFORMAT_DEFINED ) - { - case NUMBERFORMAT_DATE: - { - Date aCurrentDate; - static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast(aCurrentDate.GetDate())),STANDARD_DB_DATE); - } - break; - case NUMBERFORMAT_TIME: - case NUMBERFORMAT_DATETIME: - { - Time aCurrentTime; - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); - } - break; - default: - break; - } - return nValue; - } - - //------------------------------------------------------------------ - double OFormatSampleControl::getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey) - { - const SvNumberformat* pEntry = _pNF->GetEntry(_nFormatKey); - DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); - double nValue = 1234.56789; - if ( pEntry ) - nValue = getPreviewValue( *pEntry ); - return nValue; - } - //------------------------------------------------------------------ - Any SAL_CALL OFormatSampleControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() ) - aPropValue <<= (sal_Int32)getTypedControlWindow()->GetFormatKey(); - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OFormatSampleControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< sal_Int32* >( NULL ) ); - } - - //================================================================== - // class OFormattedNumericControl - //================================================================== - DBG_NAME(OFormattedNumericControl); - //------------------------------------------------------------------ - OFormattedNumericControl::OFormattedNumericControl( Window* pParent, WinBits nWinStyle ) - :OFormattedNumericControl_Base( PropertyControlType::Unknown, pParent, nWinStyle ) - { - DBG_CTOR(OFormattedNumericControl,NULL); - - getTypedControlWindow()->TreatAsNumber(sal_True); - - m_nLastDecimalDigits = getTypedControlWindow()->GetDecimalDigits(); - } - - //------------------------------------------------------------------ - OFormattedNumericControl::~OFormattedNumericControl() - { - DBG_DTOR(OFormattedNumericControl,NULL); - } - - //------------------------------------------------------------------ - void SAL_CALL OFormattedNumericControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - double nValue( 0 ); - if ( _rValue >>= nValue ) - getTypedControlWindow()->SetValue( nValue ); - else - getTypedControlWindow()->SetText(String()); - } - - //------------------------------------------------------------------ - Any SAL_CALL OFormattedNumericControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() ) - aPropValue <<= (double)getTypedControlWindow()->GetValue(); - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OFormattedNumericControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< double* >( NULL ) ); - } - - //------------------------------------------------------------------ - void OFormattedNumericControl::SetFormatDescription(const FormatDescription& rDesc) - { - sal_Bool bFallback = sal_True; - - if (rDesc.pSupplier) - { - getTypedControlWindow()->TreatAsNumber(sal_True); - - SvNumberFormatter* pFormatter = rDesc.pSupplier->GetNumberFormatter(); - if (pFormatter != getTypedControlWindow()->GetFormatter()) - getTypedControlWindow()->SetFormatter(pFormatter, sal_True); - getTypedControlWindow()->SetFormatKey(rDesc.nKey); - - const SvNumberformat* pEntry = getTypedControlWindow()->GetFormatter()->GetEntry(getTypedControlWindow()->GetFormatKey()); - DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); - if ( pEntry ) - { - switch (pEntry->GetType() & ~NUMBERFORMAT_DEFINED) - { - case NUMBERFORMAT_NUMBER: - case NUMBERFORMAT_CURRENCY: - case NUMBERFORMAT_SCIENTIFIC: - case NUMBERFORMAT_FRACTION: - case NUMBERFORMAT_PERCENT: - m_nLastDecimalDigits = getTypedControlWindow()->GetDecimalDigits(); - break; - case NUMBERFORMAT_DATETIME: - case NUMBERFORMAT_DATE: - case NUMBERFORMAT_TIME: - m_nLastDecimalDigits = 7; - break; - default: - m_nLastDecimalDigits = 0; - break; - } - bFallback = sal_False; - } - - } - - if ( bFallback ) - { - getTypedControlWindow()->TreatAsNumber(sal_False); - getTypedControlWindow()->SetFormatter(NULL, sal_True); - getTypedControlWindow()->SetText(String()); - m_nLastDecimalDigits = 0; - } - } - - //======================================================================== - //= OFileUrlControl - //======================================================================== - //------------------------------------------------------------------ - OFileUrlControl::OFileUrlControl( Window* pParent, WinBits nWinStyle ) - :OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN ) - { - getTypedControlWindow()->SetDropDownLineCount( 10 ); - getTypedControlWindow()->SetPlaceHolder( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ; - } - - //------------------------------------------------------------------ - OFileUrlControl::~OFileUrlControl() - { - } - - //------------------------------------------------------------------ - void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException) - { - ::rtl::OUString sURL; - if ( ( _rValue >>= sURL ) ) - { - if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 ) - getTypedControlWindow()->DisplayURL( getTypedControlWindow()->GetPlaceHolder() ); - else - getTypedControlWindow()->DisplayURL( sURL ); - } - else - getTypedControlWindow()->SetText( String() ); - } - - //------------------------------------------------------------------ - Any SAL_CALL OFileUrlControl::getValue() throw (RuntimeException) - { - Any aPropValue; - if ( getTypedControlWindow()->GetText().Len() ) - aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL(); - return aPropValue; - } - - //------------------------------------------------------------------ - Type SAL_CALL OFileUrlControl::getValueType() throw (RuntimeException) - { - return ::getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - } - - //======================================================================== - //= OTimeDurationControl - //======================================================================== - //------------------------------------------------------------------ - OTimeDurationControl::OTimeDurationControl( ::Window* pParent, WinBits nWinStyle ) - :ONumericControl( pParent, nWinStyle ) - { - getTypedControlWindow()->SetUnit( FUNIT_CUSTOM ); - getTypedControlWindow()->SetCustomUnitText( String::CreateFromAscii( " ms" ) ); - getTypedControlWindow()->SetCustomConvertHdl( LINK( this, OTimeDurationControl, OnCustomConvert ) ); - } - - //------------------------------------------------------------------ - OTimeDurationControl::~OTimeDurationControl() - { - } - - //------------------------------------------------------------------ - ::sal_Int16 SAL_CALL OTimeDurationControl::getControlType() throw (::com::sun::star::uno::RuntimeException) - { - // don't use the base class'es method, it would claim we're a standard control, which - // we in fact aren't - return PropertyControlType::Unknown; - } - - //------------------------------------------------------------------ - IMPL_LINK( OTimeDurationControl, OnCustomConvert, MetricField*, /*pField*/ ) - { - long nMultiplier = 1; - if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "ms" ) ) - nMultiplier = 1; - if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "s" ) ) - nMultiplier = 1000; - else if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "m" ) ) - nMultiplier = 1000 * 60; - else if ( getTypedControlWindow()->GetCurUnitText().EqualsIgnoreCaseAscii( "h" ) ) - nMultiplier = 1000 * 60 * 60; - - getTypedControlWindow()->SetValue( getTypedControlWindow()->GetLastValue() * nMultiplier ); - - return 0L; - } - -//............................................................................ -} // namespace pcr -//............................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/usercontrol.hxx b/extensions/source/propctrlr/usercontrol.hxx deleted file mode 100644 index 6bd985b2e..000000000 --- a/extensions/source/propctrlr/usercontrol.hxx +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ -#define _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ - -#include "commoncontrol.hxx" -#define _ZFORLIST_DECLARE_TABLE -#include -#include -#include "standardcontrol.hxx" - -class SvNumberFormatsSupplierObj; - -//............................................................................ -namespace pcr -{ -//............................................................................ - - //======================================================================== - //= NumberFormatSampleField - //======================================================================== - class NumberFormatSampleField : public ControlWindow< FormattedField > - { - private: - typedef ControlWindow< FormattedField > BaseClass; - - public: - NumberFormatSampleField( Window* _pParent, WinBits _nStyle ) - :BaseClass( _pParent, _nStyle ) - { - } - - void SetFormatSupplier( const SvNumberFormatsSupplierObj* pSupplier ); - - protected: - virtual long PreNotify( NotifyEvent& rNEvt ); - }; - - //======================================================================== - //= OFormatSampleControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, NumberFormatSampleField > OFormatSampleControl_Base; - class OFormatSampleControl : public OFormatSampleControl_Base - { - public: - OFormatSampleControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - inline void SetFormatSupplier( const SvNumberFormatsSupplierObj* _pSupplier ) - { - getTypedControlWindow()->SetFormatSupplier( _pSupplier ); - } - - /** returns the default preview value for the given format key - * - * \param _pNF the number formatter - * \param _nFormatKey the format key - * \return current date or time or the value 1234.56789 - */ - static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey); - - private: - static double getPreviewValue( const SvNumberformat& i_rEntry ); - }; - - //======================================================================== - //= FormatDescription - //======================================================================== - struct FormatDescription - { - SvNumberFormatsSupplierObj* pSupplier; - sal_Int32 nKey; - }; - - //======================================================================== - //= OFormattedNumericControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< FormattedField > > OFormattedNumericControl_Base; - class OFormattedNumericControl : public OFormattedNumericControl_Base - { - private: - sal_Int32 m_nLastDecimalDigits; - - public: - OFormattedNumericControl( Window* pParent, WinBits nWinStyle = WB_TABSTOP); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - void SetFormatDescription( const FormatDescription& rDesc ); - - // make some FormattedField methods available - void SetDecimalDigits(sal_uInt16 nPrecision) { getTypedControlWindow()->SetDecimalDigits(nPrecision); m_nLastDecimalDigits = nPrecision; } - void SetDefaultValue(double dDef) { getTypedControlWindow()->SetDefaultValue(dDef); } - void EnableEmptyField(sal_Bool bEnable) { getTypedControlWindow()->EnableEmptyField(bEnable); } - void SetThousandsSep(sal_Bool bEnable) { getTypedControlWindow()->SetThousandsSep(bEnable); } - - protected: - ~OFormattedNumericControl(); - }; - - //======================================================================== - //= OFileUrlControl - //======================================================================== - typedef CommonBehaviourControl< ::com::sun::star::inspection::XPropertyControl, ControlWindow< ::svt::FileURLBox > > OFileUrlControl_Base; - class OFileUrlControl : public OFileUrlControl_Base - { - public: - OFileUrlControl( Window* pParent, WinBits nWinStyle ); - - // XPropertyControl - virtual ::com::sun::star::uno::Any SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& _value ) throw (::com::sun::star::beans::IllegalTypeException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Type SAL_CALL getValueType() throw (::com::sun::star::uno::RuntimeException); - - protected: - ~OFileUrlControl(); - }; - - //======================================================================== - //= OTimeDurationControl - //======================================================================== - class OTimeDurationControl : public ONumericControl - { - public: - OTimeDurationControl( ::Window* pParent, WinBits nWinStyle ); - ~OTimeDurationControl(); - - // XPropertyControl - ::sal_Int16 SAL_CALL getControlType() throw (::com::sun::star::uno::RuntimeException); - - private: - DECL_LINK( OnCustomConvert, MetricField* ); - }; - -//............................................................................ -} // namespace pcr -//............................................................................ - -#endif // _EXTENSIONS_PROPCTRLR_USERCONTROL_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx deleted file mode 100644 index 7e9c6b28a..000000000 --- a/extensions/source/propctrlr/xsddatatypes.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "xsddatatypes.hxx" -#include "formstrings.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -/** === end UNO includes === **/ -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::beans; - - //==================================================================== - //= helper - //==================================================================== - //-------------------------------------------------------------------- - template< typename INTERFACE, typename ARGUMENT > - void setSave( INTERFACE* pObject, void ( SAL_CALL INTERFACE::*pSetter )( ARGUMENT ), ARGUMENT _rArg ) - { - try - { - (pObject->*pSetter)( _rArg ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType: setSave: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - template< typename INTERFACE, typename ARGUMENT > - ARGUMENT getSave( INTERFACE* pObject, ARGUMENT ( SAL_CALL INTERFACE::*pGetter )( ) ) - { - ARGUMENT aReturn = ARGUMENT(); - try - { - aReturn = (pObject->*pGetter)( ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType: getSave: caught an exception!" ); - } - return aReturn; - } - - template< typename FACETTYPE > - FACETTYPE getFacet( const Reference< XPropertySet >& _rxFacets, const ::rtl::OUString& _rFacetName ) SAL_THROW(()) - { - FACETTYPE aReturn; - try - { - OSL_VERIFY( _rxFacets->getPropertyValue( _rFacetName ) >>= aReturn ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType: getFacet: caught an exception!" ); - } - return aReturn; - } - - //==================================================================== - //= XSDDataType - //==================================================================== - //-------------------------------------------------------------------- - XSDDataType::XSDDataType( const Reference< XDataType >& _rxDataType ) - :m_xDataType( _rxDataType ) - ,m_refCount( 0 ) - { - DBG_ASSERT( m_xDataType.is(), "XSDDataType::XSDDataType: invalid UNO object!" ); - if ( m_xDataType.is() ) - m_xFacetInfo = m_xDataType->getPropertySetInfo(); - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL XSDDataType::acquire() - { - return osl_incrementInterlockedCount( &m_refCount ); - } - - //-------------------------------------------------------------------- - oslInterlockedCount SAL_CALL XSDDataType::release() - { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - { - delete this; - return 0; - } - return m_refCount; - } - - //-------------------------------------------------------------------- - XSDDataType::~XSDDataType() - { - } - - //-------------------------------------------------------------------- - sal_Int16 XSDDataType::classify() const SAL_THROW(()) - { - sal_Int16 nTypeClass = DataTypeClass::STRING; - try - { - if ( m_xDataType.is() ) - nTypeClass = m_xDataType->getTypeClass(); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType::classify: caught an exception!" ); - } - return nTypeClass; - } - - //-------------------------------------------------------------------- - bool XSDDataType::isBasicType() const SAL_THROW(()) - { - return getSave( m_xDataType.get(), &XDataType::getIsBasic ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString XSDDataType::getName() const SAL_THROW(()) - { - return getSave( m_xDataType.get(), &XDataType::getName ); - } - - //-------------------------------------------------------------------- - void XSDDataType::setFacet( const ::rtl::OUString& _rFacetName, const Any& _rValue ) SAL_THROW(()) - { - try - { - m_xDataType->setPropertyValue( _rFacetName, _rValue ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType::setFacet: caught an exception - sure this is the right data type class for this property?" ); - } - } - - //-------------------------------------------------------------------- - bool XSDDataType::hasFacet( const ::rtl::OUString& _rFacetName ) const SAL_THROW(()) - { - bool bReturn = false; - try - { - bReturn = m_xFacetInfo.is() && m_xFacetInfo->hasPropertyByName( _rFacetName ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType::hasFacet: caught an exception!" ); - } - return bReturn; - } - //-------------------------------------------------------------------- - Any XSDDataType::getFacet( const ::rtl::OUString& _rFacetName ) SAL_THROW(()) - { - Any aReturn; - try - { - aReturn = m_xDataType->getPropertyValue( _rFacetName ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType::getFacet: caught an exception - sure this is the right data type class for this property?" ); - } - return aReturn; - } - - //-------------------------------------------------------------------- - namespace - { - void lcl_copyProperties( const Reference< XPropertySet >& _rxSource, const Reference< XPropertySet >& _rxDest ) - { - Reference< XPropertySetInfo > xSourceInfo; - if ( _rxSource.is() ) - xSourceInfo = _rxSource->getPropertySetInfo(); - Reference< XPropertySetInfo > xDestInfo; - if ( _rxDest.is() ) - xDestInfo = _rxDest->getPropertySetInfo(); - OSL_ENSURE( xSourceInfo.is() && xDestInfo.is(), "lcl_copyProperties: invalid property set( info)s!" ); - if ( !xSourceInfo.is() || !xDestInfo.is() ) - return; - - Sequence< Property > aProperties( xSourceInfo->getProperties() ); - const Property* pProperties = aProperties.getConstArray(); - const Property* pPropertiesEnd = pProperties + aProperties.getLength(); - for ( ; pProperties != pPropertiesEnd; ++pProperties ) - { - if ( xDestInfo->hasPropertyByName( pProperties->Name ) ) - _rxDest->setPropertyValue( pProperties->Name, _rxSource->getPropertyValue( pProperties->Name ) ); - } - } - } - - //-------------------------------------------------------------------- - void XSDDataType::copyFacetsFrom( const ::rtl::Reference< XSDDataType >& _pSourceType ) - { - OSL_ENSURE( _pSourceType.is(), "XSDDataType::copyFacetsFrom: invalid source type!" ); - if ( !_pSourceType.is() ) - return; - - try - { - Reference< XPropertySet > xSource( _pSourceType->getUnoDataType(), UNO_QUERY ); - Reference< XPropertySet > xDest( getUnoDataType(), UNO_QUERY ); - lcl_copyProperties( xSource, xDest ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDDataType::copyFacetsFrom: caught an exception!" ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsddatatypes.hxx b/extensions/source/propctrlr/xsddatatypes.hxx deleted file mode 100644 index 22307028b..000000000 --- a/extensions/source/propctrlr/xsddatatypes.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ -#include - -namespace com { namespace sun { namespace star { - namespace xsd { - class XDataType; - } - namespace beans { - class XPropertySet; - class XPropertySetInfo; - } -} } } - -//........................................................................ -namespace pcr -{ -//........................................................................ - - //==================================================================== - //= XSDDataType - //==================================================================== - class XSDDataType : public ::rtl::IReference - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType > - m_xDataType; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > - m_xFacetInfo; - - protected: - oslInterlockedCount m_refCount; - - protected: - inline ::com::sun::star::xsd::XDataType* getDataTypeInterface() const { return m_xDataType.get(); } - - public: - XSDDataType( - const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >& _rxDataType - ); - - // IReference - virtual oslInterlockedCount SAL_CALL acquire(); - virtual oslInterlockedCount SAL_CALL release(); - - /// retrieves the underlying UNO component - inline const ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType >& - getUnoDataType() const { return m_xDataType; } - - /// classifies the data typ - sal_Int16 classify() const SAL_THROW(()); - - // attribute access - ::rtl::OUString getName() const SAL_THROW(()); - bool isBasicType() const SAL_THROW(()); - - /// determines whether a given facet exists at the type - bool hasFacet( const ::rtl::OUString& _rFacetName ) const SAL_THROW(()); - /// retrieves a facet value - ::com::sun::star::uno::Any - getFacet( const ::rtl::OUString& _rFacetName ) SAL_THROW(()); - /// sets a facet value - void setFacet( const ::rtl::OUString& _rFacetName, const ::com::sun::star::uno::Any& _rFacetValue ) SAL_THROW(()); - - /** copies as much facets (values, respectively) from a give data type instance - */ - void copyFacetsFrom( const ::rtl::Reference< XSDDataType >& _pSourceType ); - - protected: - virtual ~XSDDataType(); - - private: - XSDDataType(); // never implemented - XSDDataType( const XSDDataType& ); // never implemented - XSDDataType& operator=( const XSDDataType& ); // never implemented - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDDATATYPES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationhelper.cxx b/extensions/source/propctrlr/xsdvalidationhelper.cxx deleted file mode 100644 index 4ade7c580..000000000 --- a/extensions/source/propctrlr/xsdvalidationhelper.cxx +++ /dev/null @@ -1,414 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "xsdvalidationhelper.hxx" -#include "xsddatatypes.hxx" -#include "formstrings.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - using namespace ::com::sun::star; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::xforms; - - namespace NumberFormat = ::com::sun::star::util::NumberFormat; - - //==================================================================== - //= XSDValidationHelper - //==================================================================== - //-------------------------------------------------------------------- - XSDValidationHelper::XSDValidationHelper( ::osl::Mutex& _rMutex, const Reference< XPropertySet >& _rxIntrospectee, const Reference< frame::XModel >& _rxContextDocument ) - :EFormsHelper( _rMutex, _rxIntrospectee, _rxContextDocument ) - ,m_bInspectingFormattedField( false ) - { - try - { - Reference< XPropertySetInfo > xPSI; - Reference< XServiceInfo > xSI( _rxIntrospectee, UNO_QUERY ); - if ( m_xControlModel.is() ) - xPSI = m_xControlModel->getPropertySetInfo(); - if ( xPSI.is() - && xPSI->hasPropertyByName( PROPERTY_FORMATKEY ) - && xPSI->hasPropertyByName( PROPERTY_FORMATSSUPPLIER ) - && xSI.is() - && xSI->supportsService( SERVICE_COMPONENT_FORMATTEDFIELD ) - ) - m_bInspectingFormattedField = true; - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::XSDValidationHelper: caught an exception while examining the introspectee!" ); - } - } - - //-------------------------------------------------------------------- - void XSDValidationHelper::getAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(()) - { - _rNames.resize( 0 ); - - try - { - Reference< XDataTypeRepository > xRepository = getDataTypeRepository(); - Sequence< ::rtl::OUString > aElements; - if ( xRepository.is() ) - aElements = xRepository->getElementNames(); - - _rNames.resize( aElements.getLength() ); - ::std::copy( aElements.getConstArray(), aElements.getConstArray() + aElements.getLength(), _rNames.begin() ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::getAvailableDataTypeNames: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - Reference< XDataTypeRepository > XSDValidationHelper::getDataTypeRepository() const SAL_THROW((Exception)) - { - Reference< XDataTypeRepository > xRepository; - - Reference< xforms::XModel > xModel( getCurrentFormModel( ) ); - if ( xModel.is() ) - xRepository = xModel->getDataTypeRepository(); - - return xRepository; - } - - //-------------------------------------------------------------------- - Reference< XDataTypeRepository > XSDValidationHelper::getDataTypeRepository( const ::rtl::OUString& _rModelName ) const SAL_THROW((Exception)) - { - Reference< XDataTypeRepository > xRepository; - - Reference< xforms::XModel > xModel( getFormModelByName( _rModelName ) ); - if ( xModel.is() ) - xRepository = xModel->getDataTypeRepository(); - - return xRepository; - } - - //-------------------------------------------------------------------- - Reference< XDataType > XSDValidationHelper::getDataType( const ::rtl::OUString& _rName ) const SAL_THROW((Exception)) - { - Reference< XDataType > xDataType; - - if ( _rName.getLength() ) - { - Reference< XDataTypeRepository > xRepository = getDataTypeRepository(); - if ( xRepository.is() ) - xDataType = xRepository->getDataType( _rName ); - } - return xDataType; - } - - //-------------------------------------------------------------------- - ::rtl::OUString XSDValidationHelper::getValidatingDataTypeName( ) const SAL_THROW(()) - { - ::rtl::OUString sDataTypeName; - try - { - Reference< XPropertySet > xBinding( getCurrentBinding() ); - // it's allowed here to not (yet) have a binding - if ( xBinding.is() ) - { - OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sDataTypeName ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::getValidatingDataTypeName: caught an exception!" ); - } - return sDataTypeName; - } - - //-------------------------------------------------------------------- - ::rtl::Reference< XSDDataType > XSDValidationHelper::getDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()) - { - ::rtl::Reference< XSDDataType > pReturn; - - try - { - Reference< XDataType > xValidatedAgainst; - - if ( _rName.getLength() ) - xValidatedAgainst = getDataType( _rName ); - - if ( xValidatedAgainst.is() ) - pReturn = new XSDDataType( xValidatedAgainst ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::getDataTypeByName: caught an exception!" ); - } - - return pReturn; - } - - //-------------------------------------------------------------------- - ::rtl::Reference< XSDDataType > XSDValidationHelper::getValidatingDataType( ) const SAL_THROW(()) - { - return getDataTypeByName( getValidatingDataTypeName() ); - } - - //-------------------------------------------------------------------- - bool XSDValidationHelper::cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const ::rtl::OUString& _rNewName ) const SAL_THROW(()) - { - OSL_ENSURE( _pDataType.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type!" ); - if ( !_pDataType.is() ) - return false; - - try - { - Reference< XDataTypeRepository > xRepository( getDataTypeRepository() ); - OSL_ENSURE( xRepository.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type repository!" ); - if ( !xRepository.is() ) - return false; - - Reference< XDataType > xDataType( _pDataType->getUnoDataType() ); - OSL_ENSURE( xDataType.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type (II)!" ); - if ( !xDataType.is() ) - return false; - - xRepository->cloneDataType( xDataType->getName(), _rNewName ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::cloneDataType: caught an exception!" ); - } - return true; - } - - //-------------------------------------------------------------------- - bool XSDValidationHelper::removeDataTypeFromRepository( const ::rtl::OUString& _rName ) const SAL_THROW(()) - { - try - { - Reference< XDataTypeRepository > xRepository( getDataTypeRepository() ); - OSL_ENSURE( xRepository.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type repository!" ); - if ( !xRepository.is() ) - return false; - - if ( !xRepository->hasByName( _rName ) ) - { - OSL_FAIL( "XSDValidationHelper::removeDataTypeFromRepository: invalid repository and/or data type!" ); - return false; - } - - xRepository->revokeDataType( _rName ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::removeDataTypeFromRepository: caught an exception!" ); - return false; - } - return true; - } - - //-------------------------------------------------------------------- - void XSDValidationHelper::setValidatingDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()) - { - try - { - Reference< XPropertySet > xBinding( getCurrentBinding() ); - OSL_ENSURE( xBinding.is(), "XSDValidationHelper::setValidatingDataTypeByName: no active binding - how this?" ); - - if ( xBinding.is() ) - { - // get the old data type - this is necessary for notifying property changes - ::rtl::OUString sOldDataTypeName; - OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sOldDataTypeName ); - Reference< XPropertySet > xOldType; - try { xOldType = xOldType.query( getDataType( sOldDataTypeName ) ); } catch( const Exception& ) { } - - // set the new data type name - xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, makeAny( _rName ) ); - - // retrieve the new data type object - Reference< XPropertySet > xNewType( getDataType( _rName ), UNO_QUERY ); - - // fire any changes in the properties which result from this new type - std::set< ::rtl::OUString > aFilter; aFilter.insert( PROPERTY_NAME ); - firePropertyChanges( xOldType, xNewType, aFilter ); - - // fire the change in the Data Type property - ::rtl::OUString sNewDataTypeName; - OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sNewDataTypeName ); - firePropertyChange( PROPERTY_XSD_DATA_TYPE, makeAny( sOldDataTypeName ), makeAny( sNewDataTypeName ) ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void XSDValidationHelper::copyDataType( const ::rtl::OUString& _rFromModel, const ::rtl::OUString& _rToModel, - const ::rtl::OUString& _rDataTypeName ) const SAL_THROW(()) - { - if ( _rFromModel == _rToModel ) - // nothing to do (me thinks) - return; - - try - { - Reference< XDataTypeRepository > xFromRepository, xToRepository; - if ( _rFromModel.getLength() ) - xFromRepository = getDataTypeRepository( _rFromModel ); - if ( _rToModel.getLength() ) - xToRepository = getDataTypeRepository( _rToModel ); - - if ( !xFromRepository.is() || !xToRepository.is() ) - return; - - if ( !xFromRepository->hasByName( _rDataTypeName ) || xToRepository->hasByName( _rDataTypeName ) ) - // not existent in the source, or already existent (by name) in the destination - return; - - // determine the built-in type belonging to the source type - ::rtl::Reference< XSDDataType > pSourceType = new XSDDataType( xFromRepository->getDataType( _rDataTypeName ) ); - ::rtl::OUString sTargetBaseType = getBasicTypeNameForClass( pSourceType->classify(), xToRepository ); - - // create the target type - Reference< XDataType > xTargetType = xToRepository->cloneDataType( sTargetBaseType, _rDataTypeName ); - ::rtl::Reference< XSDDataType > pTargetType = new XSDDataType( xTargetType ); - - // copy the facets - pTargetType->copyFacetsFrom( pSourceType ); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::copyDataType: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - void XSDValidationHelper::findDefaultFormatForIntrospectee() SAL_THROW(()) - { - try - { - ::rtl::Reference< XSDDataType > xDataType = getValidatingDataType(); - if ( xDataType.is() ) - { - // find a NumberFormat type corresponding to the DataTypeClass - sal_Int16 nNumberFormatType = NumberFormat::NUMBER; - switch ( xDataType->classify() ) - { - case DataTypeClass::DATETIME: - nNumberFormatType = NumberFormat::DATETIME; - break; - case DataTypeClass::DATE: - nNumberFormatType = NumberFormat::DATE; - break; - case DataTypeClass::TIME: - nNumberFormatType = NumberFormat::TIME; - break; - case DataTypeClass::STRING: - case DataTypeClass::anyURI: - case DataTypeClass::QName: - case DataTypeClass::NOTATION: - nNumberFormatType = NumberFormat::TEXT; - break; - } - - // get the number formatter from the introspectee - Reference< XNumberFormatsSupplier > xSupplier; - Reference< XNumberFormatTypes > xFormatTypes; - OSL_VERIFY( m_xControlModel->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier ); - if ( xSupplier.is() ) - xFormatTypes = xFormatTypes.query( xSupplier->getNumberFormats() ); - OSL_ENSURE( xFormatTypes.is(), "XSDValidationHelper::findDefaultFormatForIntrospectee: no number formats for the introspectee!" ); - if ( !xFormatTypes.is() ) - return; - - // and the standard format for the given NumberFormat type - sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLocaleData().getLocale() ); - - // set this at the introspectee - m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, makeAny( nDesiredFormat ) ); - } - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::findDefaultFormatForIntrospectee: caught an exception!" ); - } - } - - //-------------------------------------------------------------------- - ::rtl::OUString XSDValidationHelper::getBasicTypeNameForClass( sal_Int16 _nClass ) const SAL_THROW(()) - { - return getBasicTypeNameForClass( _nClass, getDataTypeRepository() ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString XSDValidationHelper::getBasicTypeNameForClass( sal_Int16 _nClass, Reference< XDataTypeRepository > _rxRepository ) const SAL_THROW(()) - { - ::rtl::OUString sReturn; - OSL_ENSURE( _rxRepository.is(), "XSDValidationHelper::getBasicTypeNameForClass: invalid repository!" ); - if ( !_rxRepository.is() ) - return sReturn; - - try - { - Reference< XDataType > xDataType = _rxRepository->getBasicDataType( _nClass ); - OSL_ENSURE( xDataType.is(), "XSDValidationHelper::getBasicTypeNameForClass: invalid data type returned!" ); - if ( xDataType.is() ) - sReturn = xDataType->getName(); - } - catch( const Exception& ) - { - OSL_FAIL( "XSDValidationHelper::getBasicTypeNameForClass: caught an exception!" ); - } - - return sReturn; - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationhelper.hxx b/extensions/source/propctrlr/xsdvalidationhelper.hxx deleted file mode 100644 index 4b514b757..000000000 --- a/extensions/source/propctrlr/xsdvalidationhelper.hxx +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX - -#include "eformshelper.hxx" -#include "xsddatatypes.hxx" - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class XSDDataType; - //==================================================================== - //= XSDValidationHelper - //==================================================================== - class XSDValidationHelper : public EFormsHelper - { - private: - bool m_bInspectingFormattedField; - public: - bool isInspectingFormattedField() const { return m_bInspectingFormattedField; } - - public: - XSDValidationHelper( - ::osl::Mutex& _rMutex, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxIntrospectee, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxContextDocument - ); - - /** retrieves the names of all XForms models in the document the control lives in - */ - void getAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(()); - - /** retrieves a particular data type given by name - */ - ::rtl::Reference< XSDDataType > - getDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()); - - /** retrieves the DataType instance which the control model is currently validated against - - If there is a binding set at our control model, which at the same time acts as validator, - and if this validator is bound to an XDataType, then this data type is retrieved here. - */ - ::rtl::Reference< XSDDataType > - getValidatingDataType( ) const SAL_THROW(()); - - /** retrieves the name of the data type which the control model is currently validated against - - @seealso getValidatingDataType - */ - ::rtl::OUString - getValidatingDataTypeName( ) const SAL_THROW(()); - - /** binds the validator to a new data type - - To be called with an active binding only. - */ - void setValidatingDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(()); - - /** removes the data type given by name from the data type repository - */ - bool removeDataTypeFromRepository( const ::rtl::OUString& _rName ) const SAL_THROW(()); - - /** creates a new data type, which is a clone of an existing data type - */ - bool cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const ::rtl::OUString& _rNewName ) const SAL_THROW(()); - - /** retrieves the name of the basic data type which has the given class - */ - ::rtl::OUString - getBasicTypeNameForClass( sal_Int16 _eClass ) const SAL_THROW(()); - - /** copy a data type from one model to another - - If a data type with the given name already exists in the target model, then nothing - happens. In particular, the facets of the data type are not copied. - */ - void copyDataType( const ::rtl::OUString& _rFromModel, const ::rtl::OUString& _rToModel, - const ::rtl::OUString& _rDataTypeName ) const SAL_THROW(()); - - /** finds (and sets) a default format for the formatted field we're inspecting, - according to the current data type the control value is evaluated against - */ - void findDefaultFormatForIntrospectee() SAL_THROW(()); - - private: - /** retrieves the data type repository associated with the current model - */ - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > - getDataTypeRepository() const SAL_THROW((::com::sun::star::uno::Exception)); - - /** retrieves the data type repository associated with any model - */ - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > - getDataTypeRepository( const ::rtl::OUString& _rModelName ) const SAL_THROW((::com::sun::star::uno::Exception)); - - /** retrieves the data type object for the given name - */ - ::com::sun::star::uno::Reference< ::com::sun::star::xsd::XDataType > - getDataType( const ::rtl::OUString& _rName ) const - SAL_THROW((::com::sun::star::uno::Exception)); - - /** retrieves the name of the basic data type which has the given class, in the given repository - */ - ::rtl::OUString - getBasicTypeNameForClass( - sal_Int16 _nClass, - ::com::sun::star::uno::Reference< ::com::sun::star::xforms::XDataTypeRepository > _rxRepository - ) const SAL_THROW(()); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx deleted file mode 100644 index b9ca34513..000000000 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ /dev/null @@ -1,695 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include "xsdvalidationpropertyhandler.hxx" -#include "formstrings.hxx" -#include "formmetadata.hxx" -#include "xsddatatypes.hxx" -#include "modulepcr.hxx" -#include "formresid.hrc" -#include "formlocalid.hrc" -#include "propctrlr.hrc" -#include "newdatatype.hxx" -#include "xsdvalidationhelper.hxx" -#include "pcrcommon.hxx" -#include "handlerhelper.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ -#include -#include -#include -#include - -#include -#include -#include - -//------------------------------------------------------------------------ -extern "C" void SAL_CALL createRegistryInfo_XSDValidationPropertyHandler() -{ - ::pcr::XSDValidationPropertyHandler::registerImplementation(); -} - -//........................................................................ -namespace pcr -{ -//........................................................................ - - 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::xforms; - using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::inspection; - - using ::com::sun::star::beans::PropertyAttribute::MAYBEVOID; - - //==================================================================== - //= XSDValidationPropertyHandler - //==================================================================== - DBG_NAME( XSDValidationPropertyHandler ) - //-------------------------------------------------------------------- - XSDValidationPropertyHandler::XSDValidationPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :XSDValidationPropertyHandler_Base( _rxContext ) - { - DBG_CTOR( XSDValidationPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - XSDValidationPropertyHandler::~XSDValidationPropertyHandler() - { - DBG_DTOR( XSDValidationPropertyHandler, NULL ); - } - - //-------------------------------------------------------------------- - ::rtl::OUString SAL_CALL XSDValidationPropertyHandler::getImplementationName_static( ) throw (RuntimeException) - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.XSDValidationPropertyHandler" ) ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL XSDValidationPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( 1 ); - aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.XSDValidationPropertyHandler" ) ); - return aSupported; - } - - //-------------------------------------------------------------------- - Any SAL_CALL XSDValidationPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "XSDValidationPropertyHandler::getPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - Any aReturn; - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - switch ( nPropId ) - { - // common facets - case PROPERTY_ID_XSD_DATA_TYPE: aReturn = pType.is() ? pType->getFacet( PROPERTY_NAME ) : makeAny( ::rtl::OUString() ); break; - case PROPERTY_ID_XSD_WHITESPACES:aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_WHITESPACES ) : makeAny( WhiteSpaceTreatment::Preserve ); break; - case PROPERTY_ID_XSD_PATTERN: aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_PATTERN ) : makeAny( ::rtl::OUString() ); break; - - // all other properties are simply forwarded, if they exist at the given type - default: - { - if ( pType.is() && pType->hasFacet( _rPropertyName ) ) - aReturn = pType->getFacet( _rPropertyName ); - } - break; - } - - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL XSDValidationPropertyHandler::setPropertyValue( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - OSL_ENSURE( m_pHelper.get(), "XSDValidationPropertyHandler::getPropertyValue: inconsistency!" ); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - if ( PROPERTY_ID_XSD_DATA_TYPE == nPropId ) - { - ::rtl::OUString sTypeName; - OSL_VERIFY( _rValue >>= sTypeName ); - m_pHelper->setValidatingDataTypeByName( sTypeName ); - impl_setContextDocumentModified_nothrow(); - return; - } - - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - if ( !pType.is() ) - { - OSL_FAIL( "XSDValidationPropertyHandler::setPropertyValue: you're trying to set a type facet, without a current type!" ); - return; - } - - pType->setFacet( _rPropertyName, _rValue ); - impl_setContextDocumentModified_nothrow(); - } - - //-------------------------------------------------------------------- - void XSDValidationPropertyHandler::onNewComponent() - { - XSDValidationPropertyHandler_Base::onNewComponent(); - - Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); - DBG_ASSERT( xDocument.is(), "XSDValidationPropertyHandler::onNewComponent: no document!" ); - if ( EFormsHelper::isEForm( xDocument ) ) - m_pHelper.reset( new XSDValidationHelper( m_aMutex, m_xComponent, xDocument ) ); - else - m_pHelper.reset( NULL ); - } - - //-------------------------------------------------------------------- - Sequence< Property > XSDValidationPropertyHandler::doDescribeSupportedProperties() const - { - ::std::vector< Property > aProperties; - - if ( m_pHelper.get() ) - { - bool bAllowBinding = m_pHelper->canBindToAnyDataType(); - - if ( bAllowBinding ) - { - aProperties.reserve( 12 ); - - addStringPropertyDescription( aProperties, PROPERTY_XSD_DATA_TYPE ); - addInt16PropertyDescription ( aProperties, PROPERTY_XSD_WHITESPACES ); - addStringPropertyDescription( aProperties, PROPERTY_XSD_PATTERN ); - - // string facets - addInt32PropertyDescription( aProperties, PROPERTY_XSD_LENGTH, MAYBEVOID ); - addInt32PropertyDescription( aProperties, PROPERTY_XSD_MIN_LENGTH, MAYBEVOID ); - addInt32PropertyDescription( aProperties, PROPERTY_XSD_MAX_LENGTH, MAYBEVOID ); - - // decimal facets - addInt32PropertyDescription( aProperties, PROPERTY_XSD_TOTAL_DIGITS, MAYBEVOID ); - addInt32PropertyDescription( aProperties, PROPERTY_XSD_FRACTION_DIGITS, MAYBEVOID ); - - // facets for different types - addInt16PropertyDescription( aProperties, PROPERTY_XSD_MAX_INCLUSIVE_INT, MAYBEVOID ); - addInt16PropertyDescription( aProperties, PROPERTY_XSD_MAX_EXCLUSIVE_INT, MAYBEVOID ); - addInt16PropertyDescription( aProperties, PROPERTY_XSD_MIN_INCLUSIVE_INT, MAYBEVOID ); - addInt16PropertyDescription( aProperties, PROPERTY_XSD_MIN_EXCLUSIVE_INT, MAYBEVOID ); - addDoublePropertyDescription( aProperties, PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, MAYBEVOID ); - addDoublePropertyDescription( aProperties, PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, MAYBEVOID ); - addDoublePropertyDescription( aProperties, PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, MAYBEVOID ); - addDoublePropertyDescription( aProperties, PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, MAYBEVOID ); - addDatePropertyDescription( aProperties, PROPERTY_XSD_MAX_INCLUSIVE_DATE, MAYBEVOID ); - addDatePropertyDescription( aProperties, PROPERTY_XSD_MAX_EXCLUSIVE_DATE, MAYBEVOID ); - addDatePropertyDescription( aProperties, PROPERTY_XSD_MIN_INCLUSIVE_DATE, MAYBEVOID ); - addDatePropertyDescription( aProperties, PROPERTY_XSD_MIN_EXCLUSIVE_DATE, MAYBEVOID ); - addTimePropertyDescription( aProperties, PROPERTY_XSD_MAX_INCLUSIVE_TIME, MAYBEVOID ); - addTimePropertyDescription( aProperties, PROPERTY_XSD_MAX_EXCLUSIVE_TIME, MAYBEVOID ); - addTimePropertyDescription( aProperties, PROPERTY_XSD_MIN_INCLUSIVE_TIME, MAYBEVOID ); - addTimePropertyDescription( aProperties, PROPERTY_XSD_MIN_EXCLUSIVE_TIME, MAYBEVOID ); - addDateTimePropertyDescription( aProperties, PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, MAYBEVOID ); - addDateTimePropertyDescription( aProperties, PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, MAYBEVOID ); - addDateTimePropertyDescription( aProperties, PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, MAYBEVOID ); - addDateTimePropertyDescription( aProperties, PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME, MAYBEVOID ); - } - } - - if ( aProperties.empty() ) - return Sequence< Property >(); - return Sequence< Property >( &(*aProperties.begin()), aProperties.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL XSDValidationPropertyHandler::getSupersededProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ::std::vector< ::rtl::OUString > aSuperfluous; - if ( m_pHelper.get() ) - { - aSuperfluous.push_back( PROPERTY_CONTROLSOURCE ); - aSuperfluous.push_back( PROPERTY_EMPTY_IS_NULL ); - aSuperfluous.push_back( PROPERTY_FILTERPROPOSAL ); - aSuperfluous.push_back( PROPERTY_LISTSOURCETYPE ); - aSuperfluous.push_back( PROPERTY_LISTSOURCE ); - aSuperfluous.push_back( PROPERTY_BOUNDCOLUMN ); - - bool bAllowBinding = m_pHelper->canBindToAnyDataType(); - - if ( bAllowBinding ) - { - aSuperfluous.push_back( PROPERTY_MAXTEXTLEN ); - aSuperfluous.push_back( PROPERTY_VALUEMIN ); - aSuperfluous.push_back( PROPERTY_VALUEMAX ); - aSuperfluous.push_back( PROPERTY_DECIMAL_ACCURACY ); - aSuperfluous.push_back( PROPERTY_TIMEMIN ); - aSuperfluous.push_back( PROPERTY_TIMEMAX ); - aSuperfluous.push_back( PROPERTY_DATEMIN ); - aSuperfluous.push_back( PROPERTY_DATEMAX ); - aSuperfluous.push_back( PROPERTY_EFFECTIVE_MIN ); - aSuperfluous.push_back( PROPERTY_EFFECTIVE_MAX ); - } - } - - if ( aSuperfluous.empty() ) - return Sequence< ::rtl::OUString >(); - return Sequence< ::rtl::OUString >( &(*aSuperfluous.begin()), aSuperfluous.size() ); - } - - //-------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL XSDValidationPropertyHandler::getActuatingProperties( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - ::std::vector< ::rtl::OUString > aInterestedInActuations( 2 ); - if ( m_pHelper.get() ) - { - aInterestedInActuations.push_back( PROPERTY_XSD_DATA_TYPE ); - aInterestedInActuations.push_back( PROPERTY_XML_DATA_MODEL ); - } - if ( aInterestedInActuations.empty() ) - return Sequence< ::rtl::OUString >(); - return Sequence< ::rtl::OUString >( &(*aInterestedInActuations.begin()), aInterestedInActuations.size() ); - } - - //-------------------------------------------------------------------- - namespace - { - void showPropertyUI( const Reference< XObjectInspectorUI >& _rxInspectorUI, const ::rtl::OUString& _rPropertyName, bool _bShow ) - { - if ( _bShow ) - _rxInspectorUI->showPropertyUI( _rPropertyName ); - else - _rxInspectorUI->hidePropertyUI( _rPropertyName ); - } - } - - //-------------------------------------------------------------------- - LineDescriptor SAL_CALL XSDValidationPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName, - const Reference< XPropertyControlFactory >& _rxControlFactory ) - throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !_rxControlFactory.is() ) - throw NullPointerException(); - if ( !m_pHelper.get() ) - throw RuntimeException(); - - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - LineDescriptor aDescriptor; - if ( nPropId != PROPERTY_ID_XSD_DATA_TYPE ) - aDescriptor.IndentLevel = 1; - - // collect some information about the to-be-created control - sal_Int16 nControlType = PropertyControlType::TextField; - ::std::vector< ::rtl::OUString > aListEntries; - Optional< double > aMinValue( sal_False, 0 ); - Optional< double > aMaxValue( sal_False, 0 ); - - switch ( nPropId ) - { - case PROPERTY_ID_XSD_DATA_TYPE: - nControlType = PropertyControlType::ListBox; - - implGetAvailableDataTypeNames( aListEntries ); - - aDescriptor.PrimaryButtonId = rtl::OUString::createFromAscii(UID_PROP_ADD_DATA_TYPE); - aDescriptor.SecondaryButtonId = rtl::OUString::createFromAscii(UID_PROP_REMOVE_DATA_TYPE);; - aDescriptor.HasPrimaryButton = aDescriptor.HasSecondaryButton = sal_True; - aDescriptor.PrimaryButtonImageURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:graphicrepository/extensions/res/buttonplus.png" ) ); - aDescriptor.SecondaryButtonImageURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:graphicrepository/extensions/res/buttonminus.png" ) ); - break; - - case PROPERTY_ID_XSD_WHITESPACES: - { - nControlType = PropertyControlType::ListBox; - aListEntries = m_pInfoService->getPropertyEnumRepresentations( PROPERTY_ID_XSD_WHITESPACES ); - } - break; - - case PROPERTY_ID_XSD_PATTERN: - nControlType = PropertyControlType::TextField; - break; - - case PROPERTY_ID_XSD_LENGTH: - case PROPERTY_ID_XSD_MIN_LENGTH: - case PROPERTY_ID_XSD_MAX_LENGTH: - nControlType = PropertyControlType::NumericField; - break; - - case PROPERTY_ID_XSD_TOTAL_DIGITS: - case PROPERTY_ID_XSD_FRACTION_DIGITS: - nControlType = PropertyControlType::NumericField; - break; - - case PROPERTY_ID_XSD_MAX_INCLUSIVE_INT: - case PROPERTY_ID_XSD_MAX_EXCLUSIVE_INT: - case PROPERTY_ID_XSD_MIN_INCLUSIVE_INT: - case PROPERTY_ID_XSD_MIN_EXCLUSIVE_INT: - { - nControlType = PropertyControlType::NumericField; - - // handle limits for various 'INT' types according to - // their actual semantics (year, month, day) - - ::rtl::Reference< XSDDataType > xDataType( m_pHelper->getValidatingDataType() ); - sal_Int16 nTypeClass = xDataType.is() ? xDataType->classify() : DataTypeClass::STRING; - - aMinValue.IsPresent = aMaxValue.IsPresent = sal_True; - aMinValue.Value = DataTypeClass::gYear == nTypeClass ? 0 : 1; - aMaxValue.Value = ::std::numeric_limits< sal_Int32 >::max(); - if ( DataTypeClass::gMonth == nTypeClass ) - aMaxValue.Value = 12; - else if ( DataTypeClass::gDay == nTypeClass ) - aMaxValue.Value = 31; - } - break; - - case PROPERTY_ID_XSD_MAX_INCLUSIVE_DOUBLE: - case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DOUBLE: - case PROPERTY_ID_XSD_MIN_INCLUSIVE_DOUBLE: - case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DOUBLE: - nControlType = PropertyControlType::NumericField; - // TODO/eForms: do we have "auto-digits"? - break; - - case PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE: - case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE: - case PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE: - case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE: - nControlType = PropertyControlType::DateField; - break; - - case PROPERTY_ID_XSD_MAX_INCLUSIVE_TIME: - case PROPERTY_ID_XSD_MAX_EXCLUSIVE_TIME: - case PROPERTY_ID_XSD_MIN_INCLUSIVE_TIME: - case PROPERTY_ID_XSD_MIN_EXCLUSIVE_TIME: - nControlType = PropertyControlType::TimeField; - break; - - case PROPERTY_ID_XSD_MAX_INCLUSIVE_DATE_TIME: - case PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME: - case PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME: - case PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME: - nControlType = PropertyControlType::DateTimeField; - break; - - default: - OSL_FAIL( "XSDValidationPropertyHandler::describePropertyLine: cannot handle this property!" ); - break; - } - - switch ( nControlType ) - { - case PropertyControlType::ListBox: - aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, sal_False, sal_False ); - break; - case PropertyControlType::NumericField: - aDescriptor.Control = PropertyHandlerHelper::createNumericControl( _rxControlFactory, 0, aMinValue, aMaxValue, sal_False ); - break; - default: - aDescriptor.Control = _rxControlFactory->createPropertyControl( nControlType, sal_False ); - break; - } - - aDescriptor.Category = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) ); - aDescriptor.DisplayName = m_pInfoService->getPropertyTranslation( nPropId ); - aDescriptor.HelpURL = HelpIdUrl::getHelpURL( m_pInfoService->getPropertyHelpId( nPropId ) ); - - return aDescriptor; - } - - //-------------------------------------------------------------------- - InteractiveSelectionResult SAL_CALL XSDValidationPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, Any& /*_rData*/, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( m_pHelper.get(), "XSDValidationPropertyHandler::onInteractivePropertySelection: we don't have any SupportedProperties!" ); - if ( !m_pHelper.get() ) - return InteractiveSelectionResult_Cancelled; - - PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); - - switch ( nPropId ) - { - case PROPERTY_ID_XSD_DATA_TYPE: - { - if ( _bPrimary ) - { - ::rtl::OUString sNewDataTypeName; - if ( implPrepareCloneDataCurrentType( sNewDataTypeName ) ) - { - implDoCloneCurrentDataType( sNewDataTypeName ); - return InteractiveSelectionResult_Success; - } - } - else - return implPrepareRemoveCurrentDataType() && implDoRemoveCurrentDataType() ? InteractiveSelectionResult_Success : InteractiveSelectionResult_Cancelled; - } - break; - - default: - OSL_FAIL( "XSDValidationPropertyHandler::onInteractivePropertySelection: unexpected property to build a dedicated UI!" ); - break; - } - return InteractiveSelectionResult_Cancelled; - } - - //-------------------------------------------------------------------- - void SAL_CALL XSDValidationPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - XSDValidationPropertyHandler_Base::addPropertyChangeListener( _rxListener ); - if ( m_pHelper.get() ) - m_pHelper->registerBindingListener( _rxListener ); - } - - //-------------------------------------------------------------------- - void SAL_CALL XSDValidationPropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_pHelper.get() ) - m_pHelper->revokeBindingListener( _rxListener ); - XSDValidationPropertyHandler_Base::removePropertyChangeListener( _rxListener ); - } - - //-------------------------------------------------------------------- - bool XSDValidationPropertyHandler::implPrepareCloneDataCurrentType( ::rtl::OUString& _rNewName ) SAL_THROW(()) - { - OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implPrepareCloneDataCurrentType: this will crash!" ); - - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - if ( !pType.is() ) - { - OSL_FAIL( "XSDValidationPropertyHandler::implPrepareCloneDataCurrentType: invalid current data type!" ); - return false; - } - - ::std::vector< ::rtl::OUString > aExistentNames; - m_pHelper->getAvailableDataTypeNames( aExistentNames ); - - NewDataTypeDialog aDialog( NULL, pType->getName(), aExistentNames ); // TODO/eForms: proper parent - if ( aDialog.Execute() != RET_OK ) - return false; - - _rNewName = aDialog.GetName(); - return true; - } - - //-------------------------------------------------------------------- - bool XSDValidationPropertyHandler::implDoCloneCurrentDataType( const ::rtl::OUString& _rNewName ) SAL_THROW(()) - { - OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implDoCloneCurrentDataType: this will crash!" ); - - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - if ( !pType.is() ) - return false; - - if ( !m_pHelper->cloneDataType( pType, _rNewName ) ) - return false; - - m_pHelper->setValidatingDataTypeByName( _rNewName ); - return true; - } - - //-------------------------------------------------------------------- - bool XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType() SAL_THROW(()) - { - OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType: this will crash!" ); - - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - if ( !pType.is() ) - { - OSL_FAIL( "XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType: invalid current data type!" ); - return false; - } - - // confirmation message - String sConfirmation( PcrRes( RID_STR_CONFIRM_DELETE_DATA_TYPE ) ); - sConfirmation.SearchAndReplaceAscii( "#type#", pType->getName() ); - QueryBox aQuery( NULL, WB_YES_NO, sConfirmation ); // TODO/eForms: proper parent - if ( aQuery.Execute() != RET_YES ) - return false; - - return true; - } - - //-------------------------------------------------------------------- - bool XSDValidationPropertyHandler::implDoRemoveCurrentDataType() SAL_THROW(()) - { - OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implDoRemoveCurrentDataType: this will crash!" ); - - ::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType(); - if ( !pType.is() ) - return false; - - // set a new data type at the binding, which is the "basic" type for the one - // we are going to delete - // (do this before the actual deletion, so the old type is still valid for property change - // notifications) - m_pHelper->setValidatingDataTypeByName( m_pHelper->getBasicTypeNameForClass( pType->classify() ) ); - // now remove the type - m_pHelper->removeDataTypeFromRepository( pType->getName() ); - - return true; - } - - //-------------------------------------------------------------------- - void SAL_CALL XSDValidationPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& _rOldValue, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException) - { - if ( !_rxInspectorUI.is() ) - throw NullPointerException(); - - ::osl::MutexGuard aGuard( m_aMutex ); - PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) ); - if ( !m_pHelper.get() ) - throw RuntimeException(); - // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties - - switch ( nActuatingPropId ) - { - case PROPERTY_ID_XSD_DATA_TYPE: - { - ::rtl::Reference< XSDDataType > xDataType( m_pHelper->getValidatingDataType() ); - - // is removal of this type possible? - sal_Bool bIsBasicType = xDataType.is() && xDataType->isBasicType(); - _rxInspectorUI->enablePropertyUIElements( PROPERTY_XSD_DATA_TYPE, PropertyLineElement::PrimaryButton, xDataType.is() ); - _rxInspectorUI->enablePropertyUIElements( PROPERTY_XSD_DATA_TYPE, PropertyLineElement::SecondaryButton, xDataType.is() && !bIsBasicType ); - - //------------------------------------------------------------ - // show the facets which are available at the data type - ::rtl::OUString aFacets[] = { - PROPERTY_XSD_WHITESPACES, PROPERTY_XSD_PATTERN, - PROPERTY_XSD_LENGTH, PROPERTY_XSD_MIN_LENGTH, PROPERTY_XSD_MAX_LENGTH, PROPERTY_XSD_TOTAL_DIGITS, - PROPERTY_XSD_FRACTION_DIGITS, - PROPERTY_XSD_MAX_INCLUSIVE_INT, - PROPERTY_XSD_MAX_EXCLUSIVE_INT, - PROPERTY_XSD_MIN_INCLUSIVE_INT, - PROPERTY_XSD_MIN_EXCLUSIVE_INT, - PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, - PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, - PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, - PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, - PROPERTY_XSD_MAX_INCLUSIVE_DATE, - PROPERTY_XSD_MAX_EXCLUSIVE_DATE, - PROPERTY_XSD_MIN_INCLUSIVE_DATE, - PROPERTY_XSD_MIN_EXCLUSIVE_DATE, - PROPERTY_XSD_MAX_INCLUSIVE_TIME, - PROPERTY_XSD_MAX_EXCLUSIVE_TIME, - PROPERTY_XSD_MIN_INCLUSIVE_TIME, - PROPERTY_XSD_MIN_EXCLUSIVE_TIME, - PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, - PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, - PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, - PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME - }; - - size_t i=0; - const ::rtl::OUString* pLoop = NULL; - for ( i = 0, pLoop = aFacets; - i < SAL_N_ELEMENTS( aFacets ); - ++i, ++pLoop - ) - { - showPropertyUI( _rxInspectorUI, *pLoop, xDataType.is() && xDataType->hasFacet( *pLoop ) ); - _rxInspectorUI->enablePropertyUI( *pLoop, !bIsBasicType ); - } - } - break; - - case PROPERTY_ID_XML_DATA_MODEL: - { - // The data type which the current binding works with may not be present in the - // new model. Thus, transfer it. - ::rtl::OUString sOldModelName; _rOldValue >>= sOldModelName; - ::rtl::OUString sNewModelName; _rNewValue >>= sNewModelName; - ::rtl::OUString sDataType = m_pHelper->getValidatingDataTypeName(); - m_pHelper->copyDataType( sOldModelName, sNewModelName, sDataType ); - - // the list of available data types depends on the chosen model, so update this - if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( PROPERTY_XSD_DATA_TYPE ); - } - break; - - default: - OSL_FAIL( "XSDValidationPropertyHandler::actuatingPropertyChanged: cannot handle this property!" ); - return; - } - - // in both cases, we need to care for the current value of the XSD_DATA_TYPE property, - // and update the FormatKey of the formatted field we're inspecting (if any) - if ( !_bFirstTimeInit && m_pHelper->isInspectingFormattedField() ) - m_pHelper->findDefaultFormatForIntrospectee(); - } - - //-------------------------------------------------------------------- - void XSDValidationPropertyHandler::implGetAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(()) - { - OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implGetAvailableDataTypeNames: this will crash!" ); - // start with *all* types which are available at the model - ::std::vector< ::rtl::OUString > aAllTypes; - m_pHelper->getAvailableDataTypeNames( aAllTypes ); - _rNames.clear(); - _rNames.reserve( aAllTypes.size() ); - - // then allow only those which are "compatible" with our control - for ( ::std::vector< ::rtl::OUString >::const_iterator dataType = aAllTypes.begin(); - dataType != aAllTypes.end(); - ++dataType - ) - { - ::rtl::Reference< XSDDataType > pType = m_pHelper->getDataTypeByName( *dataType ); - if ( pType.is() && m_pHelper->canBindToDataType( pType->classify() ) ) - _rNames.push_back( *dataType ); - } - } - -//........................................................................ -} // namespace pcr -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx deleted file mode 100644 index 9763d43ba..000000000 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX -#define EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX - -#include "propertyhandler.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include - -//........................................................................ -namespace pcr -{ -//........................................................................ - - class XSDValidationHelper; - //==================================================================== - //= XSDValidationPropertyHandler - //==================================================================== - class XSDValidationPropertyHandler; - typedef HandlerComponentBase< XSDValidationPropertyHandler > XSDValidationPropertyHandler_Base; - class XSDValidationPropertyHandler : public XSDValidationPropertyHandler_Base - { - private: - ::std::auto_ptr< XSDValidationHelper > m_pHelper; - - public: - XSDValidationPropertyHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext - ); - - static ::rtl::OUString SAL_CALL getImplementationName_static( ) throw (::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ~XSDValidationPropertyHandler(); - - protected: - // XPropertyHandler overriables - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > - SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::LineDescriptor - SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::inspection::InteractiveSelectionResult - SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException); - - // PropertyHandler overridables - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > - SAL_CALL doDescribeSupportedProperties() const; - virtual void onNewComponent(); - - private: - bool implPrepareRemoveCurrentDataType() SAL_THROW(()); - bool implDoRemoveCurrentDataType() SAL_THROW(()); - - bool implPrepareCloneDataCurrentType( ::rtl::OUString& _rNewName ) SAL_THROW(()); - bool implDoCloneCurrentDataType( const ::rtl::OUString& _rNewName ) SAL_THROW(()); - - /** retrieves the names of the data types which our introspectee can be validated against - */ - void implGetAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(()); - }; - -//........................................................................ -} // namespace pcr -//........................................................................ - -#endif // EXTENSIONS_SOURCE_PROPCTRLR_XSDVALIDATIONPROPERTYHANDLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceIndexAccess.cxx b/extensions/source/resource/ResourceIndexAccess.cxx deleted file mode 100644 index 31a244b96..000000000 --- a/extensions/source/resource/ResourceIndexAccess.cxx +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Bjoern Michaelsen - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ::extensions::resource; -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 ::comphelper::stl_begin; -using ::comphelper::stl_end; -using ::rtl::OString; -using ::rtl::OUString; -using ::rtl::OUStringToOString; - -namespace -{ - static ::boost::shared_ptr GetResMgr(Sequence const& rArgs) - { - if(rArgs.getLength()!=1) - return ::boost::shared_ptr(); - OUString sFilename; - rArgs[0] >>= sFilename; - SolarMutexGuard aGuard; - const OString sEncName(OUStringToOString(sFilename, osl_getThreadTextEncoding())); - return ::boost::shared_ptr(ResMgr::CreateResMgr(sEncName)); - } - - class ResourceIndexAccessBase : public cppu::WeakImplHelper1< ::com::sun::star::container::XIndexAccess> - { - public: - ResourceIndexAccessBase( ::boost::shared_ptr pResMgr) - : m_pResMgr(pResMgr) - { - OSL_ENSURE(m_pResMgr, "no ressource manager given"); - } - - // XIndexAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException) - { return m_pResMgr.get() ? SAL_MAX_UINT16 : 0; }; - // XElementAccess - virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) - { return static_cast(m_pResMgr.get()); }; - - protected: - // m_pResMgr should never be NULL - const ::boost::shared_ptr m_pResMgr; - }; - - class ResourceStringIndexAccess : public ResourceIndexAccessBase - { - public: - ResourceStringIndexAccess( ::boost::shared_ptr pResMgr) - : ResourceIndexAccessBase(pResMgr) {} - // XIndexAccess - 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); - // XElementAccessBase - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) - { return ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)); }; - }; - - class ResourceStringListIndexAccess : public ResourceIndexAccessBase - { - public: - ResourceStringListIndexAccess( ::boost::shared_ptr pResMgr) - : ResourceIndexAccessBase(pResMgr) {} - // XIndexAccess - 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); - // XElementAccessBase - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) - { return ::getCppuType(reinterpret_cast * >(NULL)); }; - }; -} - -ResourceIndexAccess::ResourceIndexAccess(Sequence const& rArgs, Reference const&) - : m_pResMgr(GetResMgr(rArgs)) -{}; - -Reference initResourceIndexAccess(ResourceIndexAccess* pResourceIndexAccess) -{ - Reference xResult(static_cast(pResourceIndexAccess)); - if(!pResourceIndexAccess->hasElements()) - // xResult does not help the client to analyse the problem - // and will crash on getByIndex calls, better just give back an empty Reference - // so that such ResourceStringIndexAccess instances are never release into the wild - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("ressource manager could not get initialized")), - /* xResult */ Reference()); - return xResult; -} - -Any SAL_CALL ResourceIndexAccess::getByName(const OUString& aName) - throw (NoSuchElementException, WrappedTargetException, RuntimeException) -{ - const Sequence aNames(getElementNames()); - Reference xResult; - switch(::std::find(stl_begin(aNames), stl_end(aNames), aName)-stl_begin(aNames)) - { - case 0: - xResult = Reference(new ResourceStringIndexAccess(m_pResMgr)); - break; - case 1: - xResult = Reference(new ResourceStringListIndexAccess(m_pResMgr)); - break; - default: - throw NoSuchElementException(); - } - return makeAny(xResult); -} - -Sequence SAL_CALL ResourceIndexAccess::getElementNames( ) - throw (RuntimeException) -{ - static Sequence aResult; - if( aResult.getLength() == 0) - { - aResult.realloc(2); - aResult[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("String")); - aResult[1] = OUString(RTL_CONSTASCII_USTRINGPARAM("StringList")); - } - return aResult; -} - -::sal_Bool SAL_CALL ResourceIndexAccess::hasByName(const OUString& aName) - throw (RuntimeException) -{ - const Sequence aNames(getElementNames()); - return (::std::find(stl_begin(aNames), stl_end(aNames), aName) != stl_end(aNames)); -} - -Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx) - throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -{ - if(nIdx > SAL_MAX_UINT16 || nIdx < 0) - throw IndexOutOfBoundsException(); - SolarMutexGuard aGuard; - const ResId aId(static_cast(nIdx), *m_pResMgr); - aId.SetRT(RSC_STRING); - if(!m_pResMgr->IsAvailable(aId)) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("string ressource for id not available")), - Reference()); - return makeAny(OUString(String(aId))); -} - -Any SAL_CALL ResourceStringListIndexAccess::getByIndex(sal_Int32 nIdx) - throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -{ - if(nIdx > SAL_MAX_UINT16 || nIdx < 0) - throw IndexOutOfBoundsException(); - SolarMutexGuard aGuard; - const ResId aId(static_cast(nIdx), *m_pResMgr); - aId.SetRT(RSC_STRINGARRAY); - if(!m_pResMgr->IsAvailable(aId)) - throw RuntimeException( - OUString(RTL_CONSTASCII_USTRINGPARAM("string list ressource for id not available")), - Reference()); - const ResStringArray aStringList(aId); - Sequence aPropList(aStringList.Count()); - for(sal_Int32 nCount = 0; nCount != aPropList.getLength(); ++nCount) - { - aPropList[nCount].Name = aStringList.GetString(nCount); - aPropList[nCount].Handle = -1; - aPropList[nCount].Value <<= aStringList.GetValue(nCount); - aPropList[nCount].State = PropertyState_DIRECT_VALUE; - } - return makeAny(aPropList); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/ResourceIndexAccess.hxx b/extensions/source/resource/ResourceIndexAccess.hxx deleted file mode 100644 index 41632591a..000000000 --- a/extensions/source/resource/ResourceIndexAccess.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Bjoern Michaelsen - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX -#define EXTENSIONS_RESOURCE_RESOURCESTRINGINDEXACCESS_HXX - -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include - -class ResMgr; - -namespace extensions { namespace resource -{ - /** This class provides access to tools library text resources */ - class ResourceIndexAccess : public cppu::WeakImplHelper1< ::com::sun::star::container::XNameAccess> - { - public: - /** The ctor takes a sequence with one element: the name of the resource, e.g. svt */ - ResourceIndexAccess(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& rArgs, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); - // XNameAccess - // The XNameAccess provides access to two named elements: - // "String" returns a XIndexAccess to String resources - // "StringList" returns a XIndexAccess to StringList/StringArray resources - 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); - // XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException) - { return ::getCppuType(reinterpret_cast< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*>(NULL)); }; - virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException) - { return static_cast(m_pResMgr.get()); }; - - private: - // m_pResMgr should never be NULL - const ::boost::shared_ptr m_pResMgr; - }; -}} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> initResourceIndexAccess(::extensions::resource::ResourceIndexAccess*); - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/exports.dxp b/extensions/source/resource/exports.dxp deleted file mode 100644 index 700330789..000000000 --- a/extensions/source/resource/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/extensions/source/resource/makefile.mk b/extensions/source/resource/makefile.mk deleted file mode 100644 index 4839ec0b7..000000000 --- a/extensions/source/resource/makefile.mk +++ /dev/null @@ -1,86 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=extensions -TARGET=res -LIBTARGET=NO -USE_LDUMP2=TRUE -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= \ - $(SLO)$/ResourceIndexAccess.obj \ - $(SLO)$/oooresourceloader.obj \ - $(SLO)$/resourceservices.obj - -LIB1TARGET= $(SLB)$/$(TARGET).lib -LIB1OBJFILES= $(SLOFILES) - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) - -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(VCLLIB) \ - $(TOOLSLIB) - -SHL1DEPN= -SHL1IMPLIB= ires -SHL1LIBS= $(LIB1TARGET) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk - - -ALLTAR : $(MISC)/res.component - -$(MISC)/res.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - res.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt res.component diff --git a/extensions/source/resource/oooresourceloader.cxx b/extensions/source/resource/oooresourceloader.cxx deleted file mode 100644 index 9488c658e..000000000 --- a/extensions/source/resource/oooresourceloader.cxx +++ /dev/null @@ -1,341 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::resource; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - - -namespace extensions { namespace resource -{ - /** encapsulates access to a fixed resource type - */ - class IResourceType - { - public: - /** returns the RESOURCE_TYPE associated with this instance - */ - virtual RESOURCE_TYPE getResourceType() const = 0; - - /** reads a single resource from the given resource manager - @param _resourceManager - the resource manager to read from - @param _resourceId - the id of the resource to read - @return - the required resource - @precond - the caler checked via _resourceManager.IsAvailable( getResourceType(), _resourceId ) - that the required resource really exists - */ - virtual Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const = 0; - - virtual ~IResourceType() { }; - }; - - class StringResourceAccess : public IResourceType - { - public: - StringResourceAccess(); - - // IResourceType - virtual RESOURCE_TYPE getResourceType() const; - virtual Any getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const; - }; - - StringResourceAccess::StringResourceAccess() - { - } - - RESOURCE_TYPE StringResourceAccess::getResourceType() const - { - return RSC_STRING; - } - - Any StringResourceAccess::getResource( SimpleResMgr& _resourceManager, sal_Int32 _resourceId ) const - { - OSL_PRECOND( _resourceManager.IsAvailable( getResourceType(), _resourceId ), "StringResourceAccess::getResource: precondition not met!" ); - Any aResource; - aResource <<= ::rtl::OUString( _resourceManager.ReadString( _resourceId ) ); - return aResource; - } - - typedef ::cppu::WeakImplHelper1 < XResourceBundle - > OpenOfficeResourceBundle_Base; - class OpenOfficeResourceBundle : public OpenOfficeResourceBundle_Base - { - private: - typedef ::boost::shared_ptr< IResourceType > ResourceTypePtr; - typedef ::std::map< ::rtl::OUString, ResourceTypePtr > ResourceTypes; - - ::osl::Mutex m_aMutex; - Reference< XResourceBundle > m_xParent; - Locale m_aLocale; - SimpleResMgr* m_pResourceManager; - ResourceTypes m_aResourceTypes; - - public: - OpenOfficeResourceBundle( - const Reference< XComponentContext >& _rxContext, - const ::rtl::OUString& _rBaseName, - const Locale& _rLocale - ); - - protected: - ~OpenOfficeResourceBundle(); - - public: - // XResourceBundle - virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle > SAL_CALL getParent() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle >& _parent ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getDirectElement( const ::rtl::OUString& key ) throw (::com::sun::star::uno::RuntimeException); - - // XNameAccess (base of XResourceBundle) - 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); - - // XElementAccess (base of XNameAccess) - 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); - - private: - /** retrievs the element with the given key, without asking our parent bundle - @param _key - the key of the element to retrieve - @param _out_Element - will contained the retrieved element upon successful return. If the method is unsuccessful, the - value will not be touched. - @return - if and only if the element could be retrieved - @precond - our mutex is locked - */ - bool impl_getDirectElement_nothrow( const ::rtl::OUString& _key, Any& _out_Element ) const; - - /** retrieves the resource type and id from a given resource key, which assembles those two - @param _key - the resource key as got via a public API call - @param _out_resourceType - the resource type, if successful - @param _out_resourceId - the resource id, if successful - @return - if and only if the given key specifies a known resource type, and contains a valid - resource id - */ - bool impl_getResourceTypeAndId_nothrow( const ::rtl::OUString& _key, ResourceTypePtr& _out_resourceType, sal_Int32& _out_resourceId ) const; - }; - - OpenOfficeResourceLoader::OpenOfficeResourceLoader( Reference< XComponentContext > const& _rxContext ) - :m_xContext( _rxContext ) - { - } - - //-------------------------------------------------------------------- - Reference< XResourceBundle > SAL_CALL OpenOfficeResourceLoader::loadBundle_Default( const ::rtl::OUString& _baseName ) throw (MissingResourceException, RuntimeException) - { - return loadBundle( _baseName, Application::GetSettings().GetUILocale() ); - } - - //-------------------------------------------------------------------- - Reference< XResourceBundle > SAL_CALL OpenOfficeResourceLoader::loadBundle( const ::rtl::OUString& _baseName, const Locale& _locale ) throw (MissingResourceException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Reference< XResourceBundle > xBundle; - - ResourceBundleDescriptor resourceDescriptor( _baseName, _locale ); - ResourceBundleCache::iterator cachePos = m_aBundleCache.find( resourceDescriptor ); - if ( cachePos != m_aBundleCache.end() ) - xBundle = cachePos->second; - - if ( !xBundle.is() ) - { // not in the cache, or already died - xBundle = new OpenOfficeResourceBundle( m_xContext, _baseName, _locale ); - m_aBundleCache.insert( ResourceBundleCache::value_type( resourceDescriptor, xBundle ) ); - } - - return xBundle; - } - - OpenOfficeResourceBundle::OpenOfficeResourceBundle( const Reference< XComponentContext >& /*_rxContext*/, const ::rtl::OUString& _rBaseName, const Locale& _rLocale ) - :m_aLocale( _rLocale ) - ,m_pResourceManager( NULL ) - { - ::rtl::OUString sBaseName( _rBaseName ); - m_pResourceManager = new SimpleResMgr( sBaseName, m_aLocale ); - - if ( !m_pResourceManager->IsValid() ) - { - delete m_pResourceManager, m_pResourceManager = NULL; - throw MissingResourceException(); - } - - // supported resource types so far: strings - m_aResourceTypes[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "string" ) ) ] = - ResourceTypePtr( new StringResourceAccess ); - } - - OpenOfficeResourceBundle::~OpenOfficeResourceBundle() - { - delete m_pResourceManager; - } - - Reference< XResourceBundle > SAL_CALL OpenOfficeResourceBundle::getParent() throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return m_xParent; - } - - void SAL_CALL OpenOfficeResourceBundle::setParent( const Reference< XResourceBundle >& _parent ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_xParent = _parent; - } - - Locale SAL_CALL OpenOfficeResourceBundle::getLocale( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - return m_aLocale; - } - - bool OpenOfficeResourceBundle::impl_getResourceTypeAndId_nothrow( const ::rtl::OUString& _key, ResourceTypePtr& _out_resourceType, sal_Int32& _out_resourceId ) const - { - sal_Int32 typeSeparatorPos = _key.indexOf( ':' ); - if ( typeSeparatorPos == -1 ) - // invalid key - return false; - - ::rtl::OUString resourceType = _key.copy( 0, typeSeparatorPos ); - - ResourceTypes::const_iterator typePos = m_aResourceTypes.find( resourceType ); - if ( typePos == m_aResourceTypes.end() ) - // don't know this resource type - return false; - - _out_resourceType = typePos->second; - _out_resourceId = _key.copy( typeSeparatorPos + 1 ).toInt32(); - return true; - } - - bool OpenOfficeResourceBundle::impl_getDirectElement_nothrow( const ::rtl::OUString& _key, Any& _out_Element ) const - { - ResourceTypePtr resourceType; - sal_Int32 resourceId( 0 ); - if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) ) - return false; - - if ( !m_pResourceManager->IsAvailable( resourceType->getResourceType(), resourceId ) ) - // no such resource with the given type/id - return false; - - _out_Element = resourceType->getResource( *m_pResourceManager, resourceId ); - return _out_Element.hasValue(); - } - - Any SAL_CALL OpenOfficeResourceBundle::getDirectElement( const ::rtl::OUString& _key ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Any aElement; - impl_getDirectElement_nothrow( _key, aElement ); - return aElement; - } - - Any SAL_CALL OpenOfficeResourceBundle::getByName( const ::rtl::OUString& _key ) throw (NoSuchElementException, WrappedTargetException, RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - Any aElement; - if ( !impl_getDirectElement_nothrow( _key, aElement ) ) - { - if ( m_xParent.is() ) - aElement = m_xParent->getByName( _key ); - } - - if ( !aElement.hasValue() ) - throw NoSuchElementException( ::rtl::OUString(), *this ); - - return aElement; - } - - Sequence< ::rtl::OUString > SAL_CALL OpenOfficeResourceBundle::getElementNames( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_FAIL( "OpenOfficeResourceBundle::getElementNames: not implemented!" ); - // the (Simple)ResManager does not provide an API to enumerate the resources - return Sequence< ::rtl::OUString >( ); - } - - ::sal_Bool SAL_CALL OpenOfficeResourceBundle::hasByName( const ::rtl::OUString& _key ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - ResourceTypePtr resourceType; - sal_Int32 resourceId( 0 ); - if ( !impl_getResourceTypeAndId_nothrow( _key, resourceType, resourceId ) ) - return sal_False; - - if ( !m_pResourceManager->IsAvailable( resourceType->getResourceType(), resourceId ) ) - return sal_False; - - return sal_True; - } - - Type SAL_CALL OpenOfficeResourceBundle::getElementType( ) throw (RuntimeException) - { - return ::cppu::UnoType< Any >::get(); - } - - ::sal_Bool SAL_CALL OpenOfficeResourceBundle::hasElements( ) throw (RuntimeException) - { - ::osl::MutexGuard aGuard( m_aMutex ); - OSL_FAIL( "OpenOfficeResourceBundle::hasElements: not implemented!" ); - // the (Simple)ResManager does not provide an API to enumerate the resources - return ::sal_Bool( ); - } - -}} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/oooresourceloader.hxx b/extensions/source/resource/oooresourceloader.hxx deleted file mode 100644 index fd7f526ce..000000000 --- a/extensions/source/resource/oooresourceloader.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX -#define EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX - -#include -#include -#include -#include - -#include -#include -#include - -namespace extensions { namespace resource -{ - typedef ::std::pair< ::rtl::OUString, ::com::sun::star::lang::Locale> ResourceBundleDescriptor; - - struct ResourceBundleDescriptorLess : public ::std::binary_function - { - bool operator()( const ResourceBundleDescriptor& _lhs, const ResourceBundleDescriptor& _rhs ) const - { - if ( _lhs.first < _rhs.first ) - return true; - if ( _lhs.second.Language < _rhs.second.Language ) - return true; - if ( _lhs.second.Country < _rhs.second.Country ) - return true; - if ( _lhs.second.Variant < _rhs.second.Variant ) - return true; - return false; - } - }; - - class OpenOfficeResourceLoader : public ::cppu::WeakImplHelper1< ::com::sun::star::resource::XResourceBundleLoader> - { - public: - typedef ::std::map< - ResourceBundleDescriptor, - ::com::sun::star::uno::WeakReference< ::com::sun::star::resource::XResourceBundle>, - ResourceBundleDescriptorLess> ResourceBundleCache; - - OpenOfficeResourceLoader(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); - // XResourceBundleLoader - virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle_Default( const ::rtl::OUString& aBaseName ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::resource::XResourceBundle> SAL_CALL loadBundle( const ::rtl::OUString& abaseName, const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::resource::MissingResourceException, ::com::sun::star::uno::RuntimeException); - - private: - OpenOfficeResourceLoader(); // never implemented - OpenOfficeResourceLoader( const OpenOfficeResourceLoader& ); // never implemented - OpenOfficeResourceLoader& operator=( const OpenOfficeResourceLoader& ); // never implemented - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext; - ::osl::Mutex m_aMutex; - ResourceBundleCache m_aBundleCache; - }; -}} - -#endif // EXTENSIONS_RESOURCE_OOORESOURCELOADER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/resource/res.component b/extensions/source/resource/res.component deleted file mode 100644 index b5df9748e..000000000 --- a/extensions/source/resource/res.component +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - diff --git a/extensions/source/resource/resourceservices.cxx b/extensions/source/resource/resourceservices.cxx deleted file mode 100644 index 0a08bb526..000000000 --- a/extensions/source/resource/resourceservices.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Bjoern Michaelsen - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Major Contributor(s): - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include - -namespace sdecl = ::comphelper::service_decl; - -sdecl::class_< ::extensions::resource::ResourceIndexAccess, sdecl::with_args > ResourceIndexAccessServiceImpl; -sdecl::class_< ::extensions::resource::OpenOfficeResourceLoader> OpenOfficeResourceLoaderServiceImpl; - -const sdecl::ServiceDecl ResourceIndexAccessDecl( - ResourceIndexAccessServiceImpl, - "org.libreoffice.extensions.resource.ResourceIndexAccess", - "org.libreoffice.resource.ResourceIndexAccess"); - -const sdecl::ServiceDecl OpenOfficeResourceLoaderDecl( - OpenOfficeResourceLoaderServiceImpl, - "com.sun.star.comp.resource.OpenOfficeResourceLoader", - "com.sun.star.resource.OfficeResourceLoader"); - -COMPHELPER_SERVICEDECL_EXPORTS2( - ResourceIndexAccessDecl, - OpenOfficeResourceLoaderDecl -); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/exports.dxp b/extensions/source/scanner/exports.dxp deleted file mode 100644 index 700330789..000000000 --- a/extensions/source/scanner/exports.dxp +++ /dev/null @@ -1 +0,0 @@ -component_getFactory diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx deleted file mode 100644 index 03f33dcb8..000000000 --- a/extensions/source/scanner/grid.cxx +++ /dev/null @@ -1,611 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include // for M_LN10 and M_E - -#define _USE_MATH_DEFINES -#include -#undef _USE_MATH_DEFINES - -#include - -// for ::std::sort -#include - -ResId SaneResId( sal_uInt32 ); - -/*********************************************************************** - * - * GridWindow - * - ***********************************************************************/ - -// --------------------------------------------------------------------- - -GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* pParent, sal_Bool bCutValues ) -: ModalDialog( pParent, SaneResId( GRID_DIALOG ) ), - m_aGridArea( 50, 15, 100, 100 ), - m_pXValues( pXValues ), - m_pOrigYValues( pYValues ), - m_nValues( nValues ), - m_pNewYValues( NULL ), - m_bCutValues( bCutValues ), - m_aHandles(), - m_nDragIndex( 0xffffffff ), - m_aMarkerBitmap( Bitmap( SaneResId( GRID_DIALOG_HANDLE_BMP ) ), Color( 255, 255, 255 ) ), - m_aOKButton( this, SaneResId( GRID_DIALOG_OK_BTN ) ), - m_aCancelButton( this, SaneResId( GRID_DIALOG_CANCEL_BTN ) ), - m_aResetTypeBox( this, SaneResId( GRID_DIALOG_TYPE_BOX ) ), - m_aResetButton( this, SaneResId( GRID_DIALOG_RESET_BTN ) ) -{ - sal_uInt16 nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_LINEAR_ASCENDING ) ) ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_ASCENDING ); - - nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_LINEAR_DESCENDING ) ) ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_DESCENDING ); - - nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_RESET ) ) ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_RESET ); - - nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_EXPONENTIAL ) ) ); - m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_EXPONENTIAL ); - - m_aResetTypeBox.SelectEntryPos( 0 ); - - m_aResetButton.SetClickHdl( LINK( this, GridWindow, ClickButtonHdl ) ); - - SetMapMode( MapMode( MAP_PIXEL ) ); - Size aSize = GetOutputSizePixel(); - Size aBtnSize = m_aOKButton.GetOutputSizePixel(); - m_aGridArea.setWidth( aSize.Width() - aBtnSize.Width() - 80 ); - m_aGridArea.setHeight( aSize.Height() - 40 ); - - if( m_pOrigYValues && m_nValues ) - { - m_pNewYValues = new double[ m_nValues ]; - memcpy( m_pNewYValues, m_pOrigYValues, sizeof( double ) * m_nValues ); - } - - setBoundings( 0, 0, 1023, 1023 ); - computeExtremes(); - - // create left and right marker as first and last entry - m_BmOffX = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Width() >> 1); - m_BmOffY = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Height() >> 1); - m_aHandles.push_back(impHandle(transform(findMinX(), findMinY()), m_BmOffX, m_BmOffY)); - m_aHandles.push_back(impHandle(transform(findMaxX(), findMaxY()), m_BmOffX, m_BmOffY)); - - FreeResource(); -} - -// --------------------------------------------------------------------- - -GridWindow::~GridWindow() -{ - if( m_pNewYValues ) - delete [] m_pNewYValues; -} - -// --------------------------------------------------------------------- - -double GridWindow::findMinX() -{ - if( ! m_pXValues ) - return 0.0; - double fMin = m_pXValues[0]; - for( int i = 1; i < m_nValues; i++ ) - if( m_pXValues[ i ] < fMin ) - fMin = m_pXValues[ i ]; - return fMin; -} - -// --------------------------------------------------------------------- - -double GridWindow::findMinY() -{ - if( ! m_pNewYValues ) - return 0.0; - double fMin = m_pNewYValues[0]; - for( int i = 1; i < m_nValues; i++ ) - if( m_pNewYValues[ i ] < fMin ) - fMin = m_pNewYValues[ i ]; - return fMin; -} - -// --------------------------------------------------------------------- - -double GridWindow::findMaxX() -{ - if( ! m_pXValues ) - return 0.0; - double fMax = m_pXValues[0]; - for( int i = 1; i < m_nValues; i++ ) - if( m_pXValues[ i ] > fMax ) - fMax = m_pXValues[ i ]; - return fMax; -} - -// --------------------------------------------------------------------- - -double GridWindow::findMaxY() -{ - if( ! m_pNewYValues ) - return 0.0; - double fMax = m_pNewYValues[0]; - for( int i = 1; i < m_nValues; i++ ) - if( m_pNewYValues[ i ] > fMax ) - fMax = m_pNewYValues[ i ]; - return fMax; -} - -// --------------------------------------------------------------------- - -void GridWindow::computeExtremes() -{ - if( m_nValues && m_pXValues && m_pOrigYValues ) - { - m_fMaxX = m_fMinX = m_pXValues[0]; - m_fMaxY = m_fMinY = m_pOrigYValues[0]; - for( int i = 1; i < m_nValues; i++ ) - { - if( m_pXValues[ i ] > m_fMaxX ) - m_fMaxX = m_pXValues[ i ]; - else if( m_pXValues[ i ] < m_fMinX ) - m_fMinX = m_pXValues[ i ]; - if( m_pOrigYValues[ i ] > m_fMaxY ) - m_fMaxY = m_pOrigYValues[ i ]; - else if( m_pOrigYValues[ i ] < m_fMinY ) - m_fMinY = m_pOrigYValues[ i ]; - } - setBoundings( m_fMinX, m_fMinY, m_fMaxX, m_fMaxY ); - } -} - -// --------------------------------------------------------------------- - -Point GridWindow::transform( double x, double y ) -{ - Point aRet; - - aRet.X() = (long)( ( x - m_fMinX ) * - (double)m_aGridArea.GetWidth() / ( m_fMaxX - m_fMinX ) - + m_aGridArea.Left() ); - aRet.Y() = (long)( - m_aGridArea.Bottom() - - ( y - m_fMinY ) * - (double)m_aGridArea.GetHeight() / ( m_fMaxY - m_fMinY ) ); - return aRet; -} - -// --------------------------------------------------------------------- - -void GridWindow::transform( const Point& rOriginal, double& x, double& y ) -{ - x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)m_aGridArea.GetWidth() + m_fMinX; - y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)m_aGridArea.GetHeight() + m_fMinY; -} - -// --------------------------------------------------------------------- - -void GridWindow::drawLine( double x1, double y1, double x2, double y2 ) -{ - DrawLine( transform( x1, y1 ), transform( x2, y2 ) ); -} - -// --------------------------------------------------------------------- - -void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut ) -{ - // get a nice chunk size like 10, 100, 25 or such - fChunkOut = ( fMax - fMin ) / 6.0; - int logchunk = (int)std::log10( fChunkOut ); - int nChunk = (int)( fChunkOut / std::exp( (double)(logchunk-1) * M_LN10 ) ); - if( nChunk >= 75 ) - nChunk = 100; - else if( nChunk >= 35 ) - nChunk = 50; - else if ( nChunk > 20 ) - nChunk = 25; - else if ( nChunk >= 13 ) - nChunk = 20; - else if( nChunk > 5 ) - nChunk = 10; - else - nChunk = 5; - fChunkOut = (double) nChunk * exp( (double)(logchunk-1) * M_LN10 ); - // compute whole chunks fitting into fMin - nChunk = (int)( fMin / fChunkOut ); - fMinChunkOut = (double)nChunk * fChunkOut; - while( fMinChunkOut < fMin ) - fMinChunkOut += fChunkOut; -} - -// --------------------------------------------------------------------- - -void GridWindow::computeNew() -{ - if(2L == m_aHandles.size()) - { - // special case: only left and right markers - double xleft, yleft; - double xright, yright; - transform(m_aHandles[0L].maPos, xleft, yleft); - transform(m_aHandles[1L].maPos, xright, yright ); - double factor = (yright-yleft)/(xright-xleft); - for( int i = 0; i < m_nValues; i++ ) - { - m_pNewYValues[ i ] = yleft + ( m_pXValues[ i ] - xleft )*factor; - } - } - else - { - // sort markers - std::sort(m_aHandles.begin(), m_aHandles.end()); - const int nSorted = m_aHandles.size(); - int i; - - // get node arrays - double* nodex = new double[ nSorted ]; - double* nodey = new double[ nSorted ]; - - for( i = 0L; i < nSorted; i++ ) - transform( m_aHandles[i].maPos, nodex[ i ], nodey[ i ] ); - - for( i = 0; i < m_nValues; i++ ) - { - double x = m_pXValues[ i ]; - m_pNewYValues[ i ] = interpolate( x, nodex, nodey, nSorted ); - if( m_bCutValues ) - { - if( m_pNewYValues[ i ] > m_fMaxY ) - m_pNewYValues[ i ] = m_fMaxY; - else if( m_pNewYValues[ i ] < m_fMinY ) - m_pNewYValues[ i ] = m_fMinY; - } - } - - delete [] nodex; - delete [] nodey; - } -} - -// --------------------------------------------------------------------- - -double GridWindow::interpolate( - double x, - double* pNodeX, - double* pNodeY, - int nNodes ) -{ - // compute Lagrange interpolation - double ret = 0; - for( int i = 0; i < nNodes; i++ ) - { - double sum = pNodeY[ i ]; - for( int n = 0; n < nNodes; n++ ) - { - if( n != i ) - { - sum *= x - pNodeX[ n ]; - sum /= pNodeX[ i ] - pNodeX[ n ]; - } - } - ret += sum; - } - return ret; -} - -// --------------------------------------------------------------------- - -void GridWindow::setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY ) -{ - m_fMinX = fMinX; - m_fMinY = fMinY; - m_fMaxX = fMaxX; - m_fMaxY = fMaxY; - - computeChunk( m_fMinX, m_fMaxX, m_fChunkX, m_fMinChunkX ); - computeChunk( m_fMinY, m_fMaxY, m_fChunkY, m_fMinChunkY ); -} - -// --------------------------------------------------------------------- - -void GridWindow::drawGrid() -{ - char pBuf[256]; - SetLineColor( Color( COL_BLACK ) ); - // draw vertical lines - for( double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX ) - { - drawLine( fX, m_fMinY, fX, m_fMaxY ); - // draw tickmarks - Point aPt = transform( fX, m_fMinY ); - std::sprintf( pBuf, "%g", fX ); - String aMark( pBuf, gsl_getSystemTextEncoding() ); - Size aTextSize( GetTextWidth( aMark ), GetTextHeight() ); - aPt.X() -= aTextSize.Width()/2; - aPt.Y() += aTextSize.Height()/2; - DrawText( aPt, aMark ); - } - // draw horizontal lines - for( double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY ) - { - drawLine( m_fMinX, fY, m_fMaxX, fY ); - // draw tickmarks - Point aPt = transform( m_fMinX, fY ); - std::sprintf( pBuf, "%g", fY ); - String aMark( pBuf, gsl_getSystemTextEncoding() ); - Size aTextSize( GetTextWidth( aMark ), GetTextHeight() ); - aPt.X() -= aTextSize.Width() + 2; - aPt.Y() -= aTextSize.Height()/2; - DrawText( aPt, aMark ); - } - - // draw boundings - drawLine( m_fMinX, m_fMinY, m_fMaxX, m_fMinY ); - drawLine( m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY ); - drawLine( m_fMinX, m_fMinY, m_fMinX, m_fMaxY ); - drawLine( m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY ); -} - -// --------------------------------------------------------------------- - -void GridWindow::drawOriginal() -{ - if( m_nValues && m_pXValues && m_pOrigYValues ) - { - SetLineColor( Color( COL_RED ) ); - for( int i = 0; i < m_nValues-1; i++ ) - { - drawLine( m_pXValues[ i ], m_pOrigYValues[ i ], - m_pXValues[ i+1 ], m_pOrigYValues[ i+1 ] ); - } - } -} - -// --------------------------------------------------------------------- - -void GridWindow::drawNew() -{ - if( m_nValues && m_pXValues && m_pNewYValues ) - { - SetClipRegion( m_aGridArea ); - SetLineColor( Color( COL_YELLOW ) ); - for( int i = 0; i < m_nValues-1; i++ ) - { - drawLine( m_pXValues[ i ], m_pNewYValues[ i ], - m_pXValues[ i+1 ], m_pNewYValues[ i+1 ] ); - } - SetClipRegion(); - } -} - -// --------------------------------------------------------------------- - -void GridWindow::drawHandles() -{ - for(sal_uInt32 i(0L); i < m_aHandles.size(); i++) - { - m_aHandles[i].draw(*this, m_aMarkerBitmap); - } -} - -// --------------------------------------------------------------------- - -void GridWindow::Paint( const Rectangle& rRect ) -{ - ModalDialog::Paint( rRect ); - drawGrid(); - drawOriginal(); - drawNew(); - drawHandles(); -} - -// --------------------------------------------------------------------- - -void GridWindow::MouseMove( const MouseEvent& rEvt ) -{ - if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != 0xffffffff ) - { - Point aPoint( rEvt.GetPosPixel() ); - - if( m_nDragIndex == 0L || m_nDragIndex == m_aHandles.size() - 1L) - { - aPoint.X() = m_aHandles[m_nDragIndex].maPos.X(); - } - else - { - if(aPoint.X() < m_aGridArea.Left()) - aPoint.X() = m_aGridArea.Left(); - else if(aPoint.X() > m_aGridArea.Right()) - aPoint.X() = m_aGridArea.Right(); - } - - if( aPoint.Y() < m_aGridArea.Top() ) - aPoint.Y() = m_aGridArea.Top(); - else if( aPoint.Y() > m_aGridArea.Bottom() ) - aPoint.Y() = m_aGridArea.Bottom(); - - if( aPoint != m_aHandles[m_nDragIndex].maPos ) - { - m_aHandles[m_nDragIndex].maPos = aPoint; - Invalidate( m_aGridArea ); - } - } - - ModalDialog::MouseMove( rEvt ); -} - -// --------------------------------------------------------------------- - -void GridWindow::MouseButtonUp( const MouseEvent& rEvt ) -{ - if( rEvt.GetButtons() == MOUSE_LEFT ) - { - if( m_nDragIndex != 0xffffffff ) - { - m_nDragIndex = 0xffffffff; - computeNew(); - Invalidate( m_aGridArea ); - Paint( m_aGridArea ); - } - } - - ModalDialog::MouseButtonUp( rEvt ); -} - -// --------------------------------------------------------------------- - -void GridWindow::MouseButtonDown( const MouseEvent& rEvt ) -{ - Point aPoint( rEvt.GetPosPixel() ); - sal_uInt32 nMarkerIndex = 0xffffffff; - - for(sal_uInt32 a(0L); nMarkerIndex == 0xffffffff && a < m_aHandles.size(); a++) - { - if(m_aHandles[a].isHit(*this, aPoint)) - { - nMarkerIndex = a; - } - } - - if( rEvt.GetButtons() == MOUSE_LEFT ) - { - // user wants to drag a button - if( nMarkerIndex != 0xffffffff ) - { - m_nDragIndex = nMarkerIndex; - } - } - else if( rEvt.GetButtons() == MOUSE_RIGHT ) - { - // user wants to add/delete a button - if( nMarkerIndex != 0xffffffff ) - { - if( nMarkerIndex != 0L && nMarkerIndex != m_aHandles.size() - 1L) - { - // delete marker under mouse - if( m_nDragIndex == nMarkerIndex ) - m_nDragIndex = 0xffffffff; - - m_aHandles.erase(m_aHandles.begin() + nMarkerIndex); - } - } - else - { - m_BmOffX = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Width() >> 1); - m_BmOffY = sal_uInt16(m_aMarkerBitmap.GetSizePixel().Height() >> 1); - m_aHandles.push_back(impHandle(aPoint, m_BmOffX, m_BmOffY)); - } - - computeNew(); - Invalidate( m_aGridArea ); - Paint( m_aGridArea ); - } - - ModalDialog::MouseButtonDown( rEvt ); -} - -// --------------------------------------------------------------------- - -IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton ) -{ - if( pButton == &m_aResetButton ) - { - int nType = (int)(sal_IntPtr)m_aResetTypeBox.GetEntryData( m_aResetTypeBox.GetSelectEntryPos() ); - switch( nType ) - { - case RESET_TYPE_LINEAR_ASCENDING: - { - for( int i = 0; i < m_nValues; i++ ) - { - m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX); - } - } - break; - case RESET_TYPE_LINEAR_DESCENDING: - { - for( int i = 0; i < m_nValues; i++ ) - { - m_pNewYValues[ i ] = m_fMaxY - (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX); - } - } - break; - case RESET_TYPE_RESET: - { - if( m_pOrigYValues && m_pNewYValues && m_nValues ) - memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) ); - } - break; - case RESET_TYPE_EXPONENTIAL: - { - for( int i = 0; i < m_nValues; i++ ) - { - m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::exp((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX))-1.0)/(M_E-1.0); - } - } - break; - - default: - break; - } - - for(sal_uInt32 i(0L); i < m_aHandles.size(); i++) - { - // find nearest xvalue - double x, y; - transform( m_aHandles[i].maPos, x, y ); - int nIndex = 0; - double delta = std::fabs( x-m_pXValues[0] ); - for( int n = 1; n < m_nValues; n++ ) - { - if( delta > std::fabs( x - m_pXValues[ n ] ) ) - { - delta = std::fabs( x - m_pXValues[ n ] ); - nIndex = n; - } - } - if( 0 == i ) - m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] ); - else if( m_aHandles.size() - 1L == i ) - m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] ); - else - m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] ); - } - - Invalidate( m_aGridArea ); - Paint(Rectangle()); - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/grid.hrc b/extensions/source/scanner/grid.hrc deleted file mode 100644 index fa364b909..000000000 --- a/extensions/source/scanner/grid.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef GRID_HRC -#define GRID_HRC - -#define GRID_DIALOG 1100 -#define GRID_DIALOG_OK_BTN 1 -#define GRID_DIALOG_CANCEL_BTN 2 -#define GRID_DIALOG_RESET_BTN 3 -#define GRID_DIALOG_TYPE_BOX 4 -#define GRID_DIALOG_HANDLE_BMP 5 - -#define RESET_TYPE_LINEAR_ASCENDING 10 -#define RESET_TYPE_LINEAR_DESCENDING 11 -#define RESET_TYPE_RESET 12 -#define RESET_TYPE_EXPONENTIAL 13 - -#endif diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx deleted file mode 100644 index eca7667d0..000000000 --- a/extensions/source/scanner/grid.hxx +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EXTENSIONS_SCANNER_GRID_HXX -#define _EXTENSIONS_SCANNER_GRID_HXX - -#include -#include -#include -#include - -class GridWindow : public ModalDialog -{ - // helper class for handles - struct impHandle - { - Point maPos; - sal_uInt16 mnOffX; - sal_uInt16 mnOffY; - - impHandle(const Point& rPos, sal_uInt16 nX, sal_uInt16 nY) - : maPos(rPos), mnOffX(nX), mnOffY(nY) - { - } - - bool operator<(const impHandle& rComp) const - { - return (maPos.X() < rComp.maPos.X()); - } - - void draw(Window& rWin, const BitmapEx& rBitmapEx) - { - const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY))); - rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx); - } - - bool isHit(Window& rWin, const Point& rPos) - { - const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY))); - const Rectangle aTarget(maPos - aOffset, maPos + aOffset); - return aTarget.IsInside(rPos); - } - }; - - Rectangle m_aGridArea; - - double m_fMinX; - double m_fMinY; - double m_fMaxX; - double m_fMaxY; - - double m_fChunkX; - double m_fMinChunkX; - double m_fChunkY; - double m_fMinChunkY; - - double* m_pXValues; - double* m_pOrigYValues; - int m_nValues; - double* m_pNewYValues; - - sal_uInt16 m_BmOffX; - sal_uInt16 m_BmOffY; - - sal_Bool m_bCutValues; - - // stuff for handles - std::vector< impHandle > m_aHandles; - sal_uInt32 m_nDragIndex; - - BitmapEx m_aMarkerBitmap; - - OKButton m_aOKButton; - CancelButton m_aCancelButton; - - ListBox m_aResetTypeBox; - PushButton m_aResetButton; - - - Point transform( double x, double y ); - void transform( const Point& rOriginal, double& x, double& y ); - - double findMinX(); - double findMinY(); - double findMaxX(); - double findMaxY(); - - void drawGrid(); - void drawOriginal(); - void drawNew(); - void drawHandles(); - - void computeExtremes(); - void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut ); - void computeNew(); - double interpolate( double x, double* pNodeX, double* pNodeY, int nNodes ); - - DECL_LINK( ClickButtonHdl, Button* ); - - virtual void MouseMove( const MouseEvent& ); - virtual void MouseButtonDown( const MouseEvent& ); - virtual void MouseButtonUp( const MouseEvent& ); -public: - GridWindow( double* pXValues, double* pYValues, int nValues, - Window* pParent, sal_Bool bCutValues = sal_True ); - ~GridWindow(); - - void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY ); - double getMinX() { return m_fMinX; } - double getMinY() { return m_fMinY; } - double getMaxX() { return m_fMaxX; } - double getMaxY() { return m_fMaxY; } - - int countValues() { return m_nValues; } - double* getXValues() { return m_pXValues; } - double* getOrigYValues() { return m_pOrigYValues; } - double* getNewYValues() { return m_pNewYValues; } - - void drawLine( double x1, double y1, double x2, double y2 ); - - virtual void Paint( const Rectangle& rRect ); -}; - -#endif // _EXTENSIONS_SCANNER_GRID_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/grid.src b/extensions/source/scanner/grid.src deleted file mode 100644 index e1734456f..000000000 --- a/extensions/source/scanner/grid.src +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include - -ModalDialog GRID_DIALOG -{ - HelpID = "extensions:ModalDialog:GRID_DIALOG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 10 , 10 ) ; - Size = MAP_APPFONT ( 300, 200 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - OKButton GRID_DIALOG_OK_BTN - { - Pos = MAP_APPFONT( 245, 5 ); - Size = MAP_APPFONT( 50, 15 ); - DefButton = TRUE; - }; - CancelButton GRID_DIALOG_CANCEL_BTN - { - Pos = MAP_APPFONT ( 245 , 25 ) ; - Size = MAP_APPFONT ( 50 , 15 ) ; - }; - ListBox GRID_DIALOG_TYPE_BOX - { - HelpID = "extensions:ListBox:GRID_DIALOG:GRID_DIALOG_TYPE_BOX"; - Border = TRUE ; - Dropdown = TRUE ; - Pos = MAP_APPFONT( 245, 45 ); - Size = MAP_APPFONT( 50, 130 ); - }; - PushButton GRID_DIALOG_RESET_BTN - { - HelpID = "extensions:PushButton:GRID_DIALOG:GRID_DIALOG_RESET_BTN"; - Pos = MAP_APPFONT( 245, 65 ); - Size = MAP_APPFONT( 50, 15 ); - Text [ en-US ] = "Set"; - }; - Bitmap GRID_DIALOG_HANDLE_BMP - { - File = "handle.bmp"; - }; - String RESET_TYPE_LINEAR_ASCENDING - { - Text [ en-US ] = "Linear ascending"; - }; - String RESET_TYPE_LINEAR_DESCENDING - { - Text [ en-US ] = "Linear descending"; - }; - String RESET_TYPE_RESET - { - Text [ en-US ] = "Original values"; - }; - String RESET_TYPE_EXPONENTIAL - { - Text [ en-US ] = "Exponential increasing"; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/scanner/makefile.mk b/extensions/source/scanner/makefile.mk deleted file mode 100644 index 60d1900f0..000000000 --- a/extensions/source/scanner/makefile.mk +++ /dev/null @@ -1,104 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. -PRJNAME=extensions -TARGET=scn -ENABLE_EXCEPTIONS=TRUE -PACKAGE=com$/sun$/star$/scanner -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/scnserv.obj \ - $(SLO)$/scanner.obj - -.IF "$(GUI)"=="WNT" -SLOFILES+=\ - $(SLO)$/scanwin.obj -.ENDIF - -.IF "$(GUI)"=="UNX" -SLOFILES+=\ - $(SLO)$/sane.obj \ - $(SLO)$/sanedlg.obj \ - $(SLO)$/scanunx.obj \ - $(SLO)$/grid.obj - -.ENDIF - -SRS1NAME=$(TARGET) -SRC1FILES=\ - sanedlg.src \ - grid.src - -RESLIB1NAME=san -RESLIB1IMAGES=$(PRJ)$/source$/scanner -RESLIB1SRSFILES= $(SRS)$/scn.srs -RESLIB1DEPN= sanedlg.src sanedlg.hrc grid.src grid.hrc - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -SHL1STDLIBS=\ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(COMPHELPERLIB) \ - $(SALLIB) \ - $(ONELIB) \ - $(TOOLSLIB) \ - $(VCLLIB) \ - $(SVTOOLLIB) - -.IF "$(GUI)"=="UNX" && "$(OS)"!="FREEBSD" && \ - "$(OS)"!="NETBSD" && "$(OS)"!="OPENBSD" && "$(OS)"!="DRAGONFLY" -SHL1STDLIBS+=$(SVTOOLLIB) -ldl -.ENDIF - -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib -SHL1VERSIONMAP=$(SOLARENV)/src/component.map - -DEF1NAME=$(SHL1TARGET) -DEF1EXPORTFILE=exports.dxp - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/scn.component - -$(MISC)/scn.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - scn.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt scn.component diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx deleted file mode 100644 index f18bc7a71..000000000 --- a/extensions/source/scanner/sane.cxx +++ /dev/null @@ -1,1007 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL -#include -#define dump_state( a, b, c, d ) fprintf( stderr, a, b, c, d ); -#else -#define dump_state( a, b, c, d ) ; -#endif -inline void dbg_msg( const char* pString, ... ) -{ -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - va_list ap; - va_start( ap, pString ); - vfprintf( stderr, pString, ap ); - va_end( ap ); -#else - (void)pString; -#endif -} - -#define FAIL_SHUTDOWN_STATE( x, y, z ) \ - if( x != SANE_STATUS_GOOD ) \ - { \ - dump_state( "%s returned error %d (%s)\n", \ - y, x, p_strstatus( x ) ); \ - DeInit(); \ - return z; \ - } - -#define FAIL_STATE( x, y, z ) \ - if( x != SANE_STATUS_GOOD ) \ - { \ - dump_state( "%s returned error %d (%s)\n", \ - y, x, p_strstatus( x ) ); \ - return z; \ - } - -#define DUMP_STATE( x, y ) \ - if( x != SANE_STATUS_GOOD ) \ - { \ - dump_state( "%s returned error %d (%s)\n", \ - y, x, p_strstatus( x ) ); \ - } - -#define CHECK_STATE( x, y ) \ - if( x != SANE_STATUS_GOOD ) \ - { \ - dump_state( "%s returned error %d (%s)\n", \ - y, x, p_strstatus( x ) ); \ - } \ - else - -int Sane::nRefCount = 0; -oslModule Sane::pSaneLib = 0; -SANE_Int Sane::nVersion = 0; -SANE_Device** Sane::ppDevices = 0; -int Sane::nDevices = 0; - -SANE_Status (*Sane::p_init)( SANE_Int*, - SANE_Auth_Callback ) = 0; -void (*Sane::p_exit)() = 0; -SANE_Status (*Sane::p_get_devices)( const SANE_Device***, - SANE_Bool ) = 0; -SANE_Status (*Sane::p_open)( SANE_String_Const, SANE_Handle ) = 0; -void (*Sane::p_close)( SANE_Handle ) = 0; -const SANE_Option_Descriptor* (*Sane::p_get_option_descriptor)( - SANE_Handle, SANE_Int ) = 0; -SANE_Status (*Sane::p_control_option)( SANE_Handle, SANE_Int, - SANE_Action, void*, - SANE_Int* ) = 0; -SANE_Status (*Sane::p_get_parameters)( SANE_Handle, - SANE_Parameters* ) = 0; -SANE_Status (*Sane::p_start)( SANE_Handle ) = 0; -SANE_Status (*Sane::p_read)( SANE_Handle, SANE_Byte*, SANE_Int, - SANE_Int* ) = 0; -void (*Sane::p_cancel)( SANE_Handle ) = 0; -SANE_Status (*Sane::p_set_io_mode)( SANE_Handle, SANE_Bool ) = 0; -SANE_Status (*Sane::p_get_select_fd)( SANE_Handle, SANE_Int* ) = 0; -SANE_String_Const (*Sane::p_strstatus)( SANE_Status ) = 0; - -static sal_Bool bSaneSymbolLoadFailed = sal_False; - -inline oslGenericFunction Sane::LoadSymbol( const char* pSymbolname ) -{ - oslGenericFunction pFunction = osl_getAsciiFunctionSymbol( pSaneLib, pSymbolname ); - if( ! pFunction ) - { - fprintf( stderr, "Could not load symbol %s\n", - pSymbolname ); - bSaneSymbolLoadFailed = sal_True; - } - return pFunction; -} - -SANE_Status Sane::ControlOption( int nOption, SANE_Action nAction, - void* pData ) -{ - SANE_Status nStatus = SANE_STATUS_GOOD; - SANE_Int nInfo = 0; - - nStatus = p_control_option( maHandle, (SANE_Int)nOption, - nAction, pData, &nInfo ); - DUMP_STATE( nStatus, "sane_control_option" ); -#if OSL_DEBUG_LEVEL > 1 - if( nStatus != SANE_STATUS_GOOD ) - { - const char* pAction = "Unknown"; - switch( nAction ) - { - case SANE_ACTION_GET_VALUE: - pAction = "SANE_ACTION_GET_VALUE";break; - case SANE_ACTION_SET_VALUE: - pAction = "SANE_ACTION_SET_VALUE";break; - case SANE_ACTION_SET_AUTO: - pAction = "SANE_ACTION_SET_AUTO";break; - } - dbg_msg( "Option: \"%s\" action: %s\n", - ByteString( GetOptionName( nOption ), gsl_getSystemTextEncoding() ).GetBuffer(), - pAction ); - } -#endif - if( nInfo & SANE_INFO_RELOAD_OPTIONS ) - ReloadOptions(); - return nStatus; -} - -Sane::Sane() : - mppOptions( 0 ), - mnOptions( 0 ), - mnDevice( -1 ), - maHandle( 0 ) -{ - if( ! nRefCount || ! pSaneLib ) - Init(); - nRefCount++; -}; - -Sane::~Sane() -{ - if( IsOpen() ) - Close(); - nRefCount--; - if( ! nRefCount && pSaneLib ) - DeInit(); -} - -void Sane::Init() -{ - ::rtl::OUString sSaneLibName( RTL_CONSTASCII_USTRINGPARAM( "libsane" SAL_DLLEXTENSION ) ); - pSaneLib = osl_loadModule( sSaneLibName.pData, SAL_LOADMODULE_LAZY ); - if( ! pSaneLib ) - { - sSaneLibName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "libsane" SAL_DLLEXTENSION ".1" )); - pSaneLib = osl_loadModule( sSaneLibName.pData, SAL_LOADMODULE_LAZY ); - } - // try reasonable places that might not be in the library search path - if( ! pSaneLib ) - { - ::rtl::OUString sSaneLibSystemPath( RTL_CONSTASCII_USTRINGPARAM( "/usr/local/lib/libsane" SAL_DLLEXTENSION ) ); - osl_getFileURLFromSystemPath( sSaneLibSystemPath.pData, &sSaneLibName.pData ); - pSaneLib = osl_loadModule( sSaneLibName.pData, SAL_LOADMODULE_LAZY ); - } - - if( pSaneLib ) - { - bSaneSymbolLoadFailed = sal_False; - p_init = (SANE_Status(*)(SANE_Int*, SANE_Auth_Callback )) - LoadSymbol( "sane_init" ); - p_exit = (void(*)()) - LoadSymbol( "sane_exit" ); - p_get_devices = (SANE_Status(*)(const SANE_Device***, - SANE_Bool )) - LoadSymbol( "sane_get_devices" ); - p_open = (SANE_Status(*)(SANE_String_Const, SANE_Handle )) - LoadSymbol( "sane_open" ); - p_close = (void(*)(SANE_Handle)) - LoadSymbol( "sane_close" ); - p_get_option_descriptor = (const SANE_Option_Descriptor*(*)(SANE_Handle, - SANE_Int)) - LoadSymbol( "sane_get_option_descriptor" ); - p_control_option = (SANE_Status(*)(SANE_Handle, SANE_Int, - SANE_Action, void*, SANE_Int*)) - LoadSymbol( "sane_control_option" ); - p_get_parameters = (SANE_Status(*)(SANE_Handle,SANE_Parameters*)) - LoadSymbol( "sane_get_parameters" ); - p_start = (SANE_Status(*)(SANE_Handle)) - LoadSymbol( "sane_start" ); - p_read = (SANE_Status(*)(SANE_Handle, SANE_Byte*, - SANE_Int, SANE_Int* )) - LoadSymbol( "sane_read" ); - p_cancel = (void(*)(SANE_Handle)) - LoadSymbol( "sane_cancel" ); - p_set_io_mode = (SANE_Status(*)(SANE_Handle, SANE_Bool)) - LoadSymbol( "sane_set_io_mode" ); - p_get_select_fd = (SANE_Status(*)(SANE_Handle, SANE_Int*)) - LoadSymbol( "sane_get_select_fd" ); - p_strstatus = (SANE_String_Const(*)(SANE_Status)) - LoadSymbol( "sane_strstatus" ); - if( bSaneSymbolLoadFailed ) - DeInit(); - else - { - SANE_Status nStatus = p_init( &nVersion, 0 ); - FAIL_SHUTDOWN_STATE( nStatus, "sane_init", ); - nStatus = p_get_devices( (const SANE_Device***)&ppDevices, - SANE_FALSE ); - FAIL_SHUTDOWN_STATE( nStatus, "sane_get_devices", ); - for( nDevices = 0 ; ppDevices[ nDevices ]; nDevices++ ) ; - } - } -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - else - fprintf( stderr, "libsane%s could not be opened: %s\n", SAL_DLLEXTENSION, - dlerror() ); -#endif -} - -void Sane::DeInit() -{ - if( pSaneLib ) - { - p_exit(); - osl_unloadModule( pSaneLib ); - pSaneLib = 0; - } -} - -void Sane::ReloadDevices() -{ - if( IsOpen() ) - Close(); - DeInit(); - Init(); -} - -void Sane::ReloadOptions() -{ - if( ! IsOpen() ) - return; - - SANE_Option_Descriptor* pZero = (SANE_Option_Descriptor*) - p_get_option_descriptor( maHandle, 0 ); - SANE_Word pOptions[2]; - SANE_Status nStatus = p_control_option( maHandle, 0, SANE_ACTION_GET_VALUE, - (void*)pOptions, NULL ); - if( nStatus != SANE_STATUS_GOOD ) - fprintf( stderr, "Error: sane driver returned %s while reading number of options !\n", p_strstatus( nStatus ) ); - - mnOptions = pOptions[ 0 ]; - if( (size_t)pZero->size > sizeof( SANE_Word ) ) - fprintf( stderr, "driver returned numer of options with larger size tha SANE_Word !!!\n" ); - if( mppOptions ) - delete [] mppOptions; - mppOptions = (const SANE_Option_Descriptor**)new SANE_Option_Descriptor*[ mnOptions ]; - mppOptions[ 0 ] = (SANE_Option_Descriptor*)pZero; - for( int i = 1; i < mnOptions; i++ ) - mppOptions[ i ] = (SANE_Option_Descriptor*) - p_get_option_descriptor( maHandle, i ); - - CheckConsistency( NULL, sal_True ); - - maReloadOptionsLink.Call( this ); -} - -sal_Bool Sane::Open( const char* name ) -{ - int i; - - SANE_Status nStatus = p_open( (SANE_String_Const)name, &maHandle ); - FAIL_STATE( nStatus, "sane_open", sal_False ); - - ReloadOptions(); - - if( mnDevice == -1 ) - { - ByteString aDevice( name ); - for( i = 0; i < nDevices; i++ ) - { - if( aDevice.Equals( ppDevices[i]->name ) ) - { - mnDevice = i; - break; - } - } - } - - return sal_True; -} - -sal_Bool Sane::Open( int n ) -{ - if( n >= 0 && n < nDevices ) - { - mnDevice = n; - return Open( (char*)ppDevices[n]->name ); - } - return sal_False; -} - -void Sane::Close() -{ - if( maHandle ) - { - p_close( maHandle ); - delete [] mppOptions; - mppOptions = 0; - maHandle = 0; - mnDevice = -1; - } -} - -int Sane::GetOptionByName( const char* rName ) -{ - int i; - ByteString aOption( rName ); - for( i = 0; i < mnOptions; i++ ) - { - if( mppOptions[i]->name && aOption.Equals( mppOptions[i]->name ) ) - return i; - } - return -1; -} - -sal_Bool Sane::GetOptionValue( int n, sal_Bool& rRet ) -{ - if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL ) - return sal_False; - SANE_Word nRet; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, &nRet ); - if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - - rRet = nRet; - return sal_True; -} - -sal_Bool Sane::GetOptionValue( int n, ByteString& rRet ) -{ - sal_Bool bSuccess = sal_False; - if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) - return sal_False; - char* pRet = new char[mppOptions[n]->size+1]; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet ); - if( nStatus == SANE_STATUS_GOOD ) - { - bSuccess = sal_True; - rRet = pRet; - } - delete [] pRet; - return bSuccess; -} - -sal_Bool Sane::GetOptionValue( int n, double& rRet, int nElement ) -{ - sal_Bool bSuccess = sal_False; - - if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && - mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; - - SANE_Word* pRet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet ); - if( nStatus == SANE_STATUS_GOOD ) - { - bSuccess = sal_True; - if( mppOptions[n]->type == SANE_TYPE_INT ) - rRet = (double)pRet[ nElement ]; - else - rRet = SANE_UNFIX( pRet[nElement] ); - } - delete [] pRet; - return bSuccess; -} - -sal_Bool Sane::GetOptionValue( int n, double* pSet ) -{ - if( ! maHandle || ! ( mppOptions[n]->type == SANE_TYPE_FIXED || - mppOptions[n]->type == SANE_TYPE_INT ) ) - return sal_False; - - SANE_Word* pFixedSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pFixedSet ); - if( nStatus != SANE_STATUS_GOOD ) - { - delete [] pFixedSet; - return sal_False; - } - for( size_t i = 0; i size/sizeof(SANE_Word); i++ ) - { - if( mppOptions[n]->type == SANE_TYPE_FIXED ) - pSet[i] = SANE_UNFIX( pFixedSet[i] ); - else - pSet[i] = (double) pFixedSet[i]; - } - delete [] pFixedSet; - return sal_True; -} - -sal_Bool Sane::SetOptionValue( int n, sal_Bool bSet ) -{ - if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL ) - return sal_False; - SANE_Word nRet = bSet ? SANE_TRUE : SANE_FALSE; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nRet ); - if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; -} - -sal_Bool Sane::SetOptionValue( int n, const String& rSet ) -{ - if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) - return sal_False; - ByteString aSet( rSet, gsl_getSystemTextEncoding() ); - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, (void*)aSet.GetBuffer() ); - if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; -} - -sal_Bool Sane::SetOptionValue( int n, double fSet, int nElement ) -{ - sal_Bool bSuccess = sal_False; - - if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && - mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; - - SANE_Status nStatus; - if( mppOptions[n]->size/sizeof(SANE_Word) > 1 ) - { - SANE_Word* pSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]; - nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet ); - if( nStatus == SANE_STATUS_GOOD ) - { - pSet[nElement] = mppOptions[n]->type == SANE_TYPE_INT ? - (SANE_Word)fSet : SANE_FIX( fSet ); - nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pSet ); - } - delete [] pSet; - } - else - { - SANE_Word nSetTo = - mppOptions[n]->type == SANE_TYPE_INT ? - (SANE_Word)fSet : SANE_FIX( fSet ); - - nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo ); - if( nStatus == SANE_STATUS_GOOD ) - bSuccess = sal_True; - } - return bSuccess; -} - -sal_Bool Sane::SetOptionValue( int n, double* pSet ) -{ - if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && - mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return sal_False; - SANE_Word* pFixedSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]; - for( size_t i = 0; i < mppOptions[n]->size/sizeof(SANE_Word); i++ ) - { - if( mppOptions[n]->type == SANE_TYPE_FIXED ) - pFixedSet[i] = SANE_FIX( pSet[i] ); - else - pFixedSet[i] = (SANE_Word)pSet[i]; - } - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet ); - delete [] pFixedSet; - if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; -} - -enum FrameStyleType { - FrameStyle_BW, FrameStyle_Gray, FrameStyle_RGB, FrameStyle_Separated -}; - -#define BYTE_BUFFER_SIZE 32768 - -static inline sal_uInt8 _ReadValue( FILE* fp, int depth ) -{ - if( depth == 16 ) - { - sal_uInt16 nWord; - // data always come in native byte order ! - // 16 bits is not really supported by backends as of now - // e.g. UMAX Astra 1200S delivers 16 bit but in BIGENDIAN - // against SANE documentation (xscanimage gets the same result - // as we do - fread( &nWord, 1, 2, fp ); - return (sal_uInt8)( nWord / 256 ); - } - sal_uInt8 nByte; - fread( &nByte, 1, 1, fp ); - return nByte; -} - -sal_Bool Sane::CheckConsistency( const char* pMes, sal_Bool bInit ) -{ - static SANE_Option_Descriptor** pDescArray = NULL; - static SANE_Option_Descriptor* pZero = NULL; - - if( bInit ) - { - pDescArray = (SANE_Option_Descriptor**)mppOptions; - if( mppOptions ) - pZero = (SANE_Option_Descriptor*)mppOptions[0]; - return sal_True; - } - - sal_Bool bConsistent = sal_True; - - if( pDescArray != mppOptions ) - bConsistent = sal_False; - if( pZero != mppOptions[0] ) - bConsistent = sal_False; - - if( ! bConsistent ) - dbg_msg( "Sane is not consistent. (%s)\n", pMes ); - - return bConsistent; -} - -sal_Bool Sane::Start( BitmapTransporter& rBitmap ) -{ - int nStream = 0, nLine = 0, i = 0; - SANE_Parameters aParams; - FrameStyleType eType = FrameStyle_Gray; - sal_Bool bSuccess = sal_True; - sal_Bool bWidthSet = sal_False; - - if( ! maHandle ) - return sal_False; - - int nWidthMM = 0; - int nHeightMM = 0; - double fTLx, fTLy, fBRx, fBRy, fResl = 0.0; - int nOption; - if( ( nOption = GetOptionByName( "tl-x" ) ) != -1 && - GetOptionValue( nOption, fTLx, 0 ) && - GetOptionUnit( nOption ) == SANE_UNIT_MM ) - { - if( ( nOption = GetOptionByName( "br-x" ) ) != -1 && - GetOptionValue( nOption, fBRx, 0 ) && - GetOptionUnit( nOption ) == SANE_UNIT_MM ) - { - nWidthMM = (int)fabs(fBRx - fTLx); - } - } - if( ( nOption = GetOptionByName( "tl-y" ) ) != -1 && - GetOptionValue( nOption, fTLy, 0 ) && - GetOptionUnit( nOption ) == SANE_UNIT_MM ) - { - if( ( nOption = GetOptionByName( "br-y" ) ) != -1 && - GetOptionValue( nOption, fBRy, 0 ) && - GetOptionUnit( nOption ) == SANE_UNIT_MM ) - { - nHeightMM = (int)fabs(fBRy - fTLy); - } - } - if( ( nOption = GetOptionByName( "resolution" ) ) != -1 ) - GetOptionValue( nOption, fResl ); - - sal_uInt8* pBuffer = NULL; - - SANE_Status nStatus = SANE_STATUS_GOOD; - - rBitmap.lock(); - SvMemoryStream& aConverter = rBitmap.getStream(); - aConverter.Seek( 0 ); - aConverter.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - - // write bitmap stream header - aConverter << 'B' << 'M'; - aConverter << (sal_uInt32) 0; - aConverter << (sal_uInt32) 0; - aConverter << (sal_uInt32) 60; - - // write BITMAPINFOHEADER - aConverter << (sal_uInt32)40; - aConverter << (sal_uInt32)0; // fill in width later - aConverter << (sal_uInt32)0; // fill in height later - aConverter << (sal_uInt16)1; - // create header for 24 bits - // correct later if necessary - aConverter << (sal_uInt16)24; - aConverter << (sal_uInt32)0; - aConverter << (sal_uInt32)0; - aConverter << (sal_uInt32)0; - aConverter << (sal_uInt32)0; - aConverter << (sal_uInt32)0; - aConverter << (sal_uInt32)0; - - for( nStream=0; nStream < 3 && bSuccess ; nStream++ ) - { - nStatus = p_start( maHandle ); - DUMP_STATE( nStatus, "sane_start" ); - CheckConsistency( "sane_start" ); - if( nStatus == SANE_STATUS_GOOD ) - { - nStatus = p_get_parameters( maHandle, &aParams ); - DUMP_STATE( nStatus, "sane_get_parameters" ); - CheckConsistency( "sane_get_parameters" ); - if (nStatus != SANE_STATUS_GOOD || aParams.bytes_per_line == 0) - { - bSuccess = sal_False; - break; - } -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - const char* ppFormats[] = { "SANE_FRAME_GRAY", "SANE_FRAME_RGB", - "SANE_FRAME_RED", "SANE_FRAME_GREEN", - "SANE_FRAME_BLUE", "Unknown !!!" }; - fprintf( stderr, "Parameters for frame %d:\n", nStream ); - if( aParams.format < 0 || aParams.format > 4 ) - aParams.format = (SANE_Frame)5; - fprintf( stderr, "format: %s\n", ppFormats[ (int)aParams.format ] ); - fprintf( stderr, "last_frame: %s\n", aParams.last_frame ? "TRUE" : "FALSE" ); - fprintf( stderr, "depth: %d\n", (int)aParams.depth ); - fprintf( stderr, "pixels_per_line: %d\n", (int)aParams.pixels_per_line ); - fprintf( stderr, "bytes_per_line: %d\n", (int)aParams.bytes_per_line ); -#endif - if( ! pBuffer ) - { - pBuffer = new sal_uInt8[ BYTE_BUFFER_SIZE < 4*aParams.bytes_per_line ? 4*aParams.bytes_per_line : BYTE_BUFFER_SIZE ]; - } - - if( aParams.last_frame ) - nStream=3; - - switch( aParams.format ) - { - case SANE_FRAME_GRAY: - eType = FrameStyle_Gray; - if( aParams.depth == 1 ) - eType = FrameStyle_BW; - break; - case SANE_FRAME_RGB: - eType = FrameStyle_RGB; - break; - case SANE_FRAME_RED: - case SANE_FRAME_GREEN: - case SANE_FRAME_BLUE: - eType = FrameStyle_Separated; - break; - default: - fprintf( stderr, "Warning: unknown frame style !!!\n" ); - } - - sal_Bool bSynchronousRead = sal_True; - - // should be fail safe, but ... ?? - nStatus = p_set_io_mode( maHandle, SANE_FALSE ); - CheckConsistency( "sane_set_io_mode" ); - if( nStatus != SANE_STATUS_GOOD ) - { - bSynchronousRead = sal_False; - nStatus = p_set_io_mode( maHandle, SANE_TRUE ); - CheckConsistency( "sane_set_io_mode" ); -#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL - if( nStatus != SANE_STATUS_GOOD ) - // what ?!? - fprintf( stderr, "Sane::Start: driver is confused\n" ); -#endif - } - - SANE_Int nLen=0; - SANE_Int fd = 0; - - if( ! bSynchronousRead ) - { - nStatus = p_get_select_fd( maHandle, &fd ); - DUMP_STATE( nStatus, "sane_get_select_fd" ); - CheckConsistency( "sane_get_select_fd" ); - if( nStatus != SANE_STATUS_GOOD ) - bSynchronousRead = sal_True; - } - FILE* pFrame = tmpfile(); - if( ! pFrame ) - { - bSuccess = sal_False; - break; - } - do { - if( ! bSynchronousRead ) - { - fd_set fdset; - struct timeval tv; - - FD_ZERO( &fdset ); - FD_SET( (int)fd, &fdset ); - tv.tv_sec = 5; - tv.tv_usec = 0; - if( select( fd+1, &fdset, NULL, NULL, &tv ) == 0 ) - fprintf( stderr, "Timout on sane_read descriptor\n" ); - } - nLen = 0; - nStatus = p_read( maHandle, pBuffer, BYTE_BUFFER_SIZE, &nLen ); - CheckConsistency( "sane_read" ); - if( nLen && ( nStatus == SANE_STATUS_GOOD || - nStatus == SANE_STATUS_EOF ) ) - { - fwrite( pBuffer, 1, nLen, pFrame ); - } - else - DUMP_STATE( nStatus, "sane_read" ); - } while( nStatus == SANE_STATUS_GOOD ); - if( nStatus != SANE_STATUS_EOF ) - { - fclose( pFrame ); - bSuccess = sal_False; - break; - } - - int nFrameLength = ftell( pFrame ); - fseek( pFrame, 0, SEEK_SET ); - sal_uInt32 nWidth = (sal_uInt32) aParams.pixels_per_line; - sal_uInt32 nHeight = (sal_uInt32) (nFrameLength / aParams.bytes_per_line); - if( ! bWidthSet ) - { - if( ! fResl ) - fResl = 300; // if all else fails that's a good guess - if( ! nWidthMM ) - nWidthMM = (int)(((double)nWidth / fResl) * 25.4); - if( ! nHeightMM ) - nHeightMM = (int)(((double)nHeight / fResl) * 25.4); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "set dimensions to (%d, %d) Pixel, (%d, %d) mm, resolution is %lg\n", (int)nWidth, (int)nHeight, (int)nWidthMM, (int)nHeightMM, fResl ); -#endif - - aConverter.Seek( 18 ); - aConverter << (sal_uInt32)nWidth; - aConverter << (sal_uInt32)nHeight; - aConverter.Seek( 38 ); - aConverter << (sal_uInt32)(1000*nWidth/nWidthMM); - aConverter << (sal_uInt32)(1000*nHeight/nHeightMM); - bWidthSet = sal_True; - } - aConverter.Seek(60); - - if( eType == FrameStyle_BW ) - { - aConverter.Seek( 10 ); - aConverter << (sal_uInt32)64; - aConverter.Seek( 28 ); - aConverter << (sal_uInt16) 1; - aConverter.Seek( 54 ); - // write color table - aConverter << (sal_uInt16)0xffff; - aConverter << (sal_uInt8)0xff; - aConverter << (sal_uInt8)0; - aConverter << (sal_uInt32)0; - aConverter.Seek( 64 ); - } - else if( eType == FrameStyle_Gray ) - { - aConverter.Seek( 10 ); - aConverter << (sal_uInt32)1084; - aConverter.Seek( 28 ); - aConverter << (sal_uInt16) 8; - aConverter.Seek( 54 ); - // write color table - for( nLine = 0; nLine < 256; nLine++ ) - { - aConverter << (sal_uInt8)nLine; - aConverter << (sal_uInt8)nLine; - aConverter << (sal_uInt8)nLine; - aConverter << (sal_uInt8)0; - } - aConverter.Seek( 1084 ); - } - - for( nLine = nHeight-1; - nLine >= 0; nLine-- ) - { - fseek( pFrame, nLine * aParams.bytes_per_line, SEEK_SET ); - if( eType == FrameStyle_BW || - ( eType == FrameStyle_Gray && aParams.depth == 8 ) - ) - { - fread( pBuffer, 1, aParams.bytes_per_line, pFrame ); - aConverter.Write( pBuffer, aParams.bytes_per_line ); - } - else if( eType == FrameStyle_Gray ) - { - for( i = 0; i < (aParams.pixels_per_line); i++ ) - { - sal_uInt8 nGray = _ReadValue( pFrame, aParams.depth ); - aConverter << nGray; - } - } - else if( eType == FrameStyle_RGB ) - { - for( i = 0; i < (aParams.pixels_per_line); i++ ) - { - sal_uInt8 nRed, nGreen, nBlue; - nRed = _ReadValue( pFrame, aParams.depth ); - nGreen = _ReadValue( pFrame, aParams.depth ); - nBlue = _ReadValue( pFrame, aParams.depth ); - aConverter << nBlue; - aConverter << nGreen; - aConverter << nRed; - } - } - else if( eType == FrameStyle_Separated ) - { - for( i = 0; i < (aParams.pixels_per_line); i++ ) - { - sal_uInt8 nValue = _ReadValue( pFrame, aParams.depth ); - switch( aParams.format ) - { - case SANE_FRAME_RED: - aConverter.SeekRel( 2 ); - aConverter << nValue; - break; - case SANE_FRAME_GREEN: - aConverter.SeekRel( 1 ); - aConverter << nValue; - aConverter.SeekRel( 1 ); - break; - case SANE_FRAME_BLUE: - aConverter << nValue; - aConverter.SeekRel( 2 ); - break; - case SANE_FRAME_GRAY: - case SANE_FRAME_RGB: - break; - } - } - } - int nGap = aConverter.Tell() & 3; - if( nGap ) - aConverter.SeekRel( 4-nGap ); - } - fclose( pFrame ); // deletes tmpfile - if( eType != FrameStyle_Separated ) - break; - } - else - bSuccess = sal_False; - } - // get stream length - aConverter.Seek( STREAM_SEEK_TO_END ); - int nPos = aConverter.Tell(); - - aConverter.Seek( 2 ); - aConverter << (sal_uInt32) nPos+1; - aConverter.Seek( 0 ); - - rBitmap.unlock(); - - if( bSuccess ) - { - // only cancel a successful operation - // sane disrupts memory else - p_cancel( maHandle ); - CheckConsistency( "sane_cancel" ); - } - if( pBuffer ) - delete [] pBuffer; - - ReloadOptions(); - - - dbg_msg( "Sane::Start returns with %s\n", bSuccess ? "TRUE" : "FALSE" ); - - return bSuccess; -} - -int Sane::GetRange( int n, double*& rpDouble ) -{ - if( mppOptions[n]->constraint_type != SANE_CONSTRAINT_RANGE && - mppOptions[n]->constraint_type != SANE_CONSTRAINT_WORD_LIST ) - { - return -1; - } - - rpDouble = 0; - int nItems, i; - sal_Bool bIsFixed = mppOptions[n]->type == SANE_TYPE_FIXED ? sal_True : sal_False; - - dbg_msg( "Sane::GetRange of option %s ", mppOptions[n]->name ); - if(mppOptions[n]->constraint_type == SANE_CONSTRAINT_RANGE ) - { - double fMin, fMax, fQuant; - if( bIsFixed ) - { - fMin = SANE_UNFIX( mppOptions[n]->constraint.range->min ); - fMax = SANE_UNFIX( mppOptions[n]->constraint.range->max ); - fQuant = SANE_UNFIX( mppOptions[n]->constraint.range->quant ); - } - else - { - fMin = (double)mppOptions[n]->constraint.range->min; - fMax = (double)mppOptions[n]->constraint.range->max; - fQuant = (double)mppOptions[n]->constraint.range->quant; - } - if( fQuant != 0.0 ) - { - dbg_msg( "quantum range [ %lg ; %lg ; %lg ]\n", - fMin, fQuant, fMax ); - nItems = (int)((fMax - fMin)/fQuant)+1; - rpDouble = new double[ nItems ]; - double fValue = fMin; - for( i = 0; i < nItems; i++, fValue += fQuant ) - rpDouble[i] = fValue; - rpDouble[ nItems-1 ] = fMax; - return nItems; - } - else - { - dbg_msg( "normal range [ %lg %lg ]\n", - fMin, fMax ); - rpDouble = new double[2]; - rpDouble[0] = fMin; - rpDouble[1] = fMax; - return 0; - } - } - else - { - nItems = mppOptions[n]->constraint.word_list[0]; - rpDouble = new double[nItems]; - for( i=0; iconstraint.word_list[i+1] ) : - (double)mppOptions[n]->constraint.word_list[i+1]; - } - dbg_msg( "wordlist [ %lg ... %lg ]\n", - rpDouble[ 0 ], rpDouble[ nItems-1 ] ); - return nItems; - } -} - -static const char *ppUnits[] = { - "", - "[Pixel]", - "[Bit]", - "[mm]", - "[DPI]", - "[%]", - "[usec]" -}; - -String Sane::GetOptionUnitName( int n ) -{ - String aText; - SANE_Unit nUnit = mppOptions[n]->unit; - size_t nUnitAsSize = (size_t)nUnit; - if( nUnitAsSize > SAL_N_ELEMENTS( ppUnits ) ) - aText = String::CreateFromAscii( "[unknown units]" ); - else - aText = String( ppUnits[ nUnit ], gsl_getSystemTextEncoding() ); - return aText; -} - -sal_Bool Sane::ActivateButtonOption( int n ) -{ - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, NULL ); - if( nStatus != SANE_STATUS_GOOD ) - return sal_False; - return sal_True; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx deleted file mode 100644 index ebe2b1aca..000000000 --- a/extensions/source/scanner/sane.hxx +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SANE_HXX -#define _SANE_HXX - -#include -#include -#include -#include -#include -#include - -// --------------------- -// - BitmapTransporter - -// --------------------- - -class BitmapTransporter : public OWeakObject, AWT::XBitmap -{ - SvMemoryStream m_aStream; - osl::Mutex m_aProtector; - -public: - - BitmapTransporter(); - virtual ~BitmapTransporter(); - - - // XInterface - virtual ANY SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - virtual void SAL_CALL release() throw() { OWeakObject::release(); } - - virtual AWT::Size SAL_CALL getSize() throw(); - virtual SEQ( sal_Int8 ) SAL_CALL getDIB() throw(); - virtual SEQ( sal_Int8 ) SAL_CALL getMaskDIB() throw() { return SEQ( sal_Int8 )(); } - - // Misc - void lock() { m_aProtector.acquire(); } - void unlock() { m_aProtector.release(); } - SvMemoryStream& getStream() { return m_aStream; } -}; - -// -------- -// - Sane - -// -------- - -class Sane -{ -private: - static int nRefCount; - static oslModule pSaneLib; - - static SANE_Status (*p_init)( SANE_Int*, - SANE_Auth_Callback ); - static void (*p_exit)(); - static SANE_Status (*p_get_devices)( const SANE_Device***, - SANE_Bool ); - static SANE_Status (*p_open)( SANE_String_Const, SANE_Handle ); - static void (*p_close)( SANE_Handle ); - static const SANE_Option_Descriptor* (*p_get_option_descriptor)( - SANE_Handle, SANE_Int ); - static SANE_Status (*p_control_option)( SANE_Handle, SANE_Int, - SANE_Action, void*, - SANE_Int* ); - static SANE_Status (*p_get_parameters)( SANE_Handle, - SANE_Parameters* ); - static SANE_Status (*p_start)( SANE_Handle ); - static SANE_Status (*p_read)( SANE_Handle, SANE_Byte*, SANE_Int, - SANE_Int* ); - static void (*p_cancel)( SANE_Handle ); - static SANE_Status (*p_set_io_mode)( SANE_Handle, SANE_Bool ); - static SANE_Status (*p_get_select_fd)( SANE_Handle, SANE_Int* ); - static SANE_String_Const (*p_strstatus)( SANE_Status ); - - static SANE_Int nVersion; - static SANE_Device** ppDevices; - static int nDevices; - - const SANE_Option_Descriptor** mppOptions; - int mnOptions; - int mnDevice; - SANE_Handle maHandle; - - Link maReloadOptionsLink; - - inline oslGenericFunction - LoadSymbol( const char* ); - void Init(); - void DeInit(); - - SANE_Status ControlOption( int, SANE_Action, void* ); - - sal_Bool CheckConsistency( const char*, sal_Bool bInit = sal_False ); - -public: - Sane(); - ~Sane(); - - static sal_Bool IsSane() - { return pSaneLib ? sal_True : sal_False; } - sal_Bool IsOpen() - { return maHandle ? sal_True : sal_False; } - static int CountDevices() - { return nDevices; } - static String GetName( int n ) - { return String( ppDevices[n]->name ? ppDevices[n]->name : "", osl_getThreadTextEncoding() ); } - static String GetVendor( int n ) - { return String( ppDevices[n]->vendor ? ppDevices[n]->vendor : "", osl_getThreadTextEncoding() ); } - static String GetModel( int n ) - { return String( ppDevices[n]->model ? ppDevices[n]->model : "", osl_getThreadTextEncoding() ); } - static String GetType( int n ) - { return String( ppDevices[n]->type ? ppDevices[n]->type : "", osl_getThreadTextEncoding() ); } - - String GetOptionName( int n ) - { return String( mppOptions[n]->name ? (char*)mppOptions[n]->name : "", osl_getThreadTextEncoding() ); } - String GetOptionTitle( int n ) - { return String( mppOptions[n]->title ? (char*)mppOptions[n]->title : "", osl_getThreadTextEncoding() ); } - SANE_Value_Type GetOptionType( int n ) - { return mppOptions[n]->type; } - SANE_Unit GetOptionUnit( int n ) - { return mppOptions[n]->unit; } - String GetOptionUnitName( int n ); - SANE_Int GetOptionCap( int n ) - { return mppOptions[n]->cap; } - SANE_Constraint_Type GetOptionConstraintType( int n ) - { return mppOptions[n]->constraint_type; } - const char** GetStringConstraint( int n ) - { return (const char**)mppOptions[n]->constraint.string_list; } - int GetRange( int, double*& ); - - inline int GetOptionElements( int n ); - int GetOptionByName( const char* ); - sal_Bool GetOptionValue( int, sal_Bool& ); - sal_Bool GetOptionValue( int, ByteString& ); - sal_Bool GetOptionValue( int, double&, int nElement = 0 ); - sal_Bool GetOptionValue( int, double* ); - - sal_Bool SetOptionValue( int, sal_Bool ); - sal_Bool SetOptionValue( int, const String& ); - sal_Bool SetOptionValue( int, double, int nElement = 0 ); - sal_Bool SetOptionValue( int, double* ); - - sal_Bool ActivateButtonOption( int ); - - int CountOptions() { return mnOptions; } - int GetDeviceNumber() { return mnDevice; } - - sal_Bool Open( const char* ); - sal_Bool Open( int ); - void Close(); - void ReloadDevices(); - void ReloadOptions(); - - sal_Bool Start( BitmapTransporter& ); - - inline Link SetReloadOptionsHdl( const Link& rLink ); -}; - -inline int Sane::GetOptionElements( int n ) -{ - if( mppOptions[n]->type == SANE_TYPE_FIXED || - mppOptions[n]->type == SANE_TYPE_INT ) - { - return mppOptions[n]->size/sizeof( SANE_Word ); - } - return 1; -} - -inline Link Sane::SetReloadOptionsHdl( const Link& rLink ) -{ - Link aRet = maReloadOptionsLink; - maReloadOptionsLink = rLink; - return aRet; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx deleted file mode 100644 index 9d6ef73bd..000000000 --- a/extensions/source/scanner/sanedlg.cxx +++ /dev/null @@ -1,1373 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -ResId SaneResId( sal_uInt32 nID ) -{ - static ResMgr* pResMgr = ResMgr::CreateResMgr( "san" ); - return ResId( nID, *pResMgr ); -} - -SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) : - ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ), - mrSane( rSane ), - mbIsDragging( sal_False ), - mbDragDrawn( sal_False ), - maMapMode( MAP_APPFONT ), - maOKButton( this, SaneResId( RID_SCAN_OK ) ), - maCancelButton( this, SaneResId( RID_SCAN_CANCEL ) ), - maDeviceInfoButton( this, SaneResId( RID_DEVICEINFO_BTN ) ), - maPreviewButton( this, SaneResId( RID_PREVIEW_BTN ) ), - maButtonOption( this, SaneResId( RID_SCAN_BUTTON_OPTION_BTN ) ), - maOptionsTxt( this, SaneResId( RID_SCAN_OPTION_TXT ) ), - maOptionTitle( this, SaneResId( RID_SCAN_OPTIONTITLE_TXT ) ), - maOptionDescTxt( this, SaneResId( RID_SCAN_OPTION_DESC_TXT ) ), - maVectorTxt( this, SaneResId( RID_SCAN_NUMERIC_VECTOR_TXT ) ), - maScanLeftTxt( this, SaneResId( RID_SCAN_LEFT_TXT ) ), - maLeftField( this, SaneResId( RID_SCAN_LEFT_BOX ) ), - maScanTopTxt( this, SaneResId( RID_SCAN_TOP_TXT ) ), - maTopField( this, SaneResId( RID_SCAN_TOP_BOX ) ), - maRightTxt( this, SaneResId( RID_SCAN_RIGHT_TXT ) ), - maRightField( this, SaneResId( RID_SCAN_RIGHT_BOX ) ), - maBottomTxt( this, SaneResId( RID_SCAN_BOTTOM_TXT ) ), - maBottomField( this, SaneResId( RID_SCAN_BOTTOM_BOX ) ), - maDeviceBoxTxt( this, SaneResId( RID_DEVICE_BOX_TXT ) ), - maDeviceBox( this, SaneResId( RID_DEVICE_BOX ) ), - maReslTxt( this, SaneResId( RID_SCAN_RESOLUTION_TXT ) ), - maReslBox( this, SaneResId( RID_SCAN_RESOLUTION_BOX ) ), - maAdvancedTxt( this, SaneResId( RID_SCAN_ADVANCED_TXT ) ), - maAdvancedBox( this, SaneResId( RID_SCAN_ADVANCED_BOX ) ), - maVectorBox( this, SaneResId( RID_SCAN_NUMERIC_VECTOR_BOX ) ), - maQuantumRangeBox( this, SaneResId( RID_SCAN_QUANTUM_RANGE_BOX ) ), - maStringRangeBox( this, SaneResId( RID_SCAN_STRING_RANGE_BOX ) ), - maPreviewBox( this, SaneResId( RID_PREVIEW_BOX ) ), - maAreaBox( this, SaneResId( RID_SCANAREA_BOX ) ), - maBoolCheckBox( this, SaneResId( RID_SCAN_BOOL_OPTION_BOX ) ), - maStringEdit( this, SaneResId( RID_SCAN_STRING_OPTION_EDT ) ), - maNumericEdit( this, SaneResId( RID_SCAN_NUMERIC_OPTION_EDT ) ), - maOptionBox( this, SaneResId( RID_SCAN_OPTION_BOX ) ), - mpRange( 0 ) -{ - if( Sane::IsSane() ) - { - InitDevices(); // opens first sane device - DisableOption(); - InitFields(); - } - - maDeviceInfoButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maPreviewButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maButtonOption.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maDeviceBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) ); - maOptionBox.SetSelectHdl( LINK( this, SaneDlg, OptionsBoxSelectHdl ) ); - maOKButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maCancelButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maBoolCheckBox.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - maStringEdit.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maNumericEdit.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maVectorBox.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maReslBox.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maStringRangeBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) ); - maQuantumRangeBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) ); - maLeftField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maRightField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maTopField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maBottomField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) ); - maAdvancedBox.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) ); - - maOldLink = mrSane.SetReloadOptionsHdl( LINK( this, SaneDlg, ReloadSaneOptionsHdl ) ); - - maOptionBox.SetNodeBitmaps( - Bitmap( SaneResId( RID_SCAN_BITMAP_PLUS ) ), - Bitmap( SaneResId( RID_SCAN_BITMAP_MINUS ) ) - ); - maOptionBox.SetStyle( maOptionBox.GetStyle()| - WB_HASLINES | - WB_HASBUTTONS | - WB_NOINITIALSELECTION | - WB_HASBUTTONSATROOT | - WB_HASLINESATROOT - ); - FreeResource(); -} - -SaneDlg::~SaneDlg() -{ - mrSane.SetReloadOptionsHdl( maOldLink ); -} - -short SaneDlg::Execute() -{ - if( ! Sane::IsSane() ) - { - ErrorBox aErrorBox( NULL, WB_OK | WB_DEF_OK, - String( SaneResId( RID_SANE_NOSANELIB_TXT ) ) ); - aErrorBox.Execute(); - return sal_False; - } - LoadState(); - return ModalDialog::Execute(); -} - -void SaneDlg::InitDevices() -{ - if( ! Sane::IsSane() ) - return; - - if( mrSane.IsOpen() ) - mrSane.Close(); - mrSane.ReloadDevices(); - maDeviceBox.Clear(); - for( int i = 0; i < Sane::CountDevices(); i++ ) - maDeviceBox.InsertEntry( Sane::GetName( i ) ); - if( Sane::CountDevices() ) - { - mrSane.Open( 0 ); - maDeviceBox.SelectEntry( Sane::GetName( 0 ) ); - - } -} - -void SaneDlg::InitFields() -{ - if( ! Sane::IsSane() ) - return; - - int nOption, i, nValue; - double fValue; - sal_Bool bSuccess = sal_False; - const char *ppSpecialOptions[] = { - "resolution", - "tl-x", - "tl-y", - "br-x", - "br-y", - "preview" - }; - - mbDragEnable = sal_True; - maReslBox.Clear(); - maMinTopLeft = Point( 0, 0 ); - maMaxBottomRight = Point( PREVIEW_WIDTH, PREVIEW_HEIGHT ); - - if( ! mrSane.IsOpen() ) - return; - - // set Resolution - nOption = mrSane.GetOptionByName( "resolution" ); - if( nOption != -1 ) - { - double fRes; - - bSuccess = mrSane.GetOptionValue( nOption, fRes ); - if( bSuccess ) - { - maReslBox.Enable( sal_True ); - - maReslBox.SetValue( (long)fRes ); - double *pDouble = NULL; - nValue = mrSane.GetRange( nOption, pDouble ); - if( nValue > -1 ) - { - if( nValue ) - { - maReslBox.SetMin( (long)pDouble[0] ); - maReslBox.SetMax( (long)pDouble[ nValue-1 ] ); - for( i=0; i 300 ) { - nRes = 300; bGot300 = 1; - } - maReslBox.InsertValue(nRes); - } - maReslBox.InsertValue( (long)pDouble[1] ); - } - if( pDouble ) - delete [] pDouble; - } - else - maReslBox.Enable( sal_False ); - } - } - else - maReslBox.Enable( sal_False ); - - // set scan area - for( i = 0; i < 4; i++ ) - { - char const *pOptionName = NULL; - MetricField* pField = NULL; - switch( i ) - { - case 0: - pOptionName = "tl-x"; - pField = &maLeftField; - break; - case 1: - pOptionName = "tl-y"; - pField = &maTopField; - break; - case 2: - pOptionName = "br-x"; - pField = &maRightField; - break; - case 3: - pOptionName = "br-y"; - pField = &maBottomField; - } - nOption = pOptionName ? mrSane.GetOptionByName( pOptionName ) : -1; - bSuccess = sal_False; - if( nOption != -1 ) - { - bSuccess = mrSane.GetOptionValue( nOption, fValue, 0 ); - if( bSuccess ) - { - if( mrSane.GetOptionUnit( nOption ) == SANE_UNIT_MM ) - { - pField->SetUnit( FUNIT_MM ); - pField->SetValue( (int)fValue, FUNIT_MM ); - } - else // SANE_UNIT_PIXEL - { - pField->SetValue( (int)fValue, FUNIT_CUSTOM ); - pField->SetCustomUnitText( String::CreateFromAscii( "Pixel" ) ); - } - switch( i ) { - case 0: maTopLeft.X() = (int)fValue;break; - case 1: maTopLeft.Y() = (int)fValue;break; - case 2: maBottomRight.X() = (int)fValue;break; - case 3: maBottomRight.Y() = (int)fValue;break; - } - } - double *pDouble = NULL; - nValue = mrSane.GetRange( nOption, pDouble ); - if( nValue > -1 ) - { - if( pDouble ) - { - pField->SetMin( (long)pDouble[0] ); - if( nValue ) - pField->SetMax( (long)pDouble[ nValue-1 ] ); - else - pField->SetMax( (long)pDouble[ 1 ] ); - delete [] pDouble; - } - switch( i ) { - case 0: maMinTopLeft.X() = pField->GetMin();break; - case 1: maMinTopLeft.Y() = pField->GetMin();break; - case 2: maMaxBottomRight.X() = pField->GetMax();break; - case 3: maMaxBottomRight.Y() = pField->GetMax();break; - } - } - else - { - switch( i ) { - case 0: maMinTopLeft.X() = (int)fValue;break; - case 1: maMinTopLeft.Y() = (int)fValue;break; - case 2: maMaxBottomRight.X() = (int)fValue;break; - case 3: maMaxBottomRight.Y() = (int)fValue;break; - } - } - pField->Enable( sal_True ); - } - else - { - mbDragEnable = sal_False; - pField->SetMin( 0 ); - switch( i ) { - case 0: - maMinTopLeft.X() = 0; - maTopLeft.X() = 0; - pField->SetMax( PREVIEW_WIDTH ); - pField->SetValue( 0 ); - break; - case 1: - maMinTopLeft.Y() = 0; - maTopLeft.Y() = 0; - pField->SetMax( PREVIEW_HEIGHT ); - pField->SetValue( 0 ); - break; - case 2: - maMaxBottomRight.X() = PREVIEW_WIDTH; - maBottomRight.X() = PREVIEW_WIDTH; - pField->SetMax( PREVIEW_WIDTH ); - pField->SetValue( PREVIEW_WIDTH ); - break; - case 3: - maMaxBottomRight.Y() = PREVIEW_HEIGHT; - maBottomRight.Y() = PREVIEW_HEIGHT; - pField->SetMax( PREVIEW_HEIGHT ); - pField->SetValue( PREVIEW_HEIGHT ); - break; - } - pField->Enable( sal_False ); - } - } - maTopLeft = GetPixelPos( maTopLeft ); - maBottomRight = GetPixelPos( maBottomRight ); - maPreviewRect = Rectangle( maTopLeft, - Size( maBottomRight.X() - maTopLeft.X(), - maBottomRight.Y() - maTopLeft.Y() ) - ); - // fill OptionBox - maOptionBox.Clear(); - SvLBoxEntry* pParentEntry = 0; - sal_Bool bGroupRejected = sal_False; - for( i = 1; i < mrSane.CountOptions(); i++ ) - { - String aOption=mrSane.GetOptionName( i ); - sal_Bool bInsertAdvanced = - mrSane.GetOptionCap( i ) & SANE_CAP_ADVANCED && - ! maAdvancedBox.IsChecked() ? sal_False : sal_True; - if( mrSane.GetOptionType( i ) == SANE_TYPE_GROUP ) - { - if( bInsertAdvanced ) - { - aOption = mrSane.GetOptionTitle( i ); - pParentEntry = maOptionBox.InsertEntry( aOption ); - bGroupRejected = sal_False; - } - else - bGroupRejected = sal_True; - } - else if( aOption.Len() && - ! ( mrSane.GetOptionCap( i ) & - ( - SANE_CAP_HARD_SELECT | - SANE_CAP_INACTIVE - ) ) && - bInsertAdvanced && ! bGroupRejected ) - { - sal_Bool bIsSpecial = sal_False; - for( size_t n = 0; !bIsSpecial && - n < SAL_N_ELEMENTS(ppSpecialOptions); n++ ) - { - if( aOption.EqualsAscii( ppSpecialOptions[n] ) ) - bIsSpecial=sal_True; - } - if( ! bIsSpecial ) - { - if( pParentEntry ) - maOptionBox.InsertEntry( aOption, pParentEntry ); - else - maOptionBox.InsertEntry( aOption ); - } - } - } -} - -IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton ) -{ - if( mrSane.IsOpen() ) - { - if( pButton == &maDeviceInfoButton ) - { - String aString( SaneResId( RID_SANE_DEVICEINFO_TXT ) ); - String aSR( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ); - aString.SearchAndReplace( aSR, Sane::GetName( mrSane.GetDeviceNumber() ) ); - aString.SearchAndReplace( aSR, Sane::GetVendor( mrSane.GetDeviceNumber() ) ); - aString.SearchAndReplace( aSR, Sane::GetModel( mrSane.GetDeviceNumber() ) ); - aString.SearchAndReplace( aSR, Sane::GetType( mrSane.GetDeviceNumber() ) ); - InfoBox aInfoBox( this, aString ); - aInfoBox.Execute(); - } - else if( pButton == &maPreviewButton ) - AcquirePreview(); - else if( pButton == &maBoolCheckBox ) - { - mrSane.SetOptionValue( mnCurrentOption, - maBoolCheckBox.IsChecked() ? - (sal_Bool)sal_True : (sal_Bool)sal_False ); - } - else if( pButton == &maButtonOption ) - { - - SANE_Value_Type nType = mrSane.GetOptionType( mnCurrentOption ); - switch( nType ) - { - case SANE_TYPE_BUTTON: - mrSane.ActivateButtonOption( mnCurrentOption ); - break; - case SANE_TYPE_FIXED: - case SANE_TYPE_INT: - { - int nElements = mrSane.GetOptionElements( mnCurrentOption ); - double* x = new double[ nElements ]; - double* y = new double[ nElements ]; - for( int i = 0; i < nElements; i++ ) - x[ i ] = (double)i; - mrSane.GetOptionValue( mnCurrentOption, y ); - - GridWindow aGrid( x, y, nElements, this ); - aGrid.SetText( mrSane.GetOptionName( mnCurrentOption ) ); - aGrid.setBoundings( 0, mfMin, nElements, mfMax ); - if( aGrid.Execute() && aGrid.getNewYValues() ) - mrSane.SetOptionValue( mnCurrentOption, aGrid.getNewYValues() ); - - delete [] x; - delete [] y; - } - break; - case SANE_TYPE_BOOL: - case SANE_TYPE_STRING: - case SANE_TYPE_GROUP: - break; - } - } - else if( pButton == &maAdvancedBox ) - { - ReloadSaneOptionsHdl( NULL ); - } - } - if( pButton == &maOKButton ) - { - double fRes = (double)maReslBox.GetValue(); - SetAdjustedNumericalValue( "resolution", fRes ); - UpdateScanArea( sal_True ); - SaveState(); - EndDialog( mrSane.IsOpen() ? 1 : 0 ); - } - else if( pButton == &maCancelButton ) - { - mrSane.Close(); - EndDialog( 0 ); - } - return 0; -} - -IMPL_LINK( SaneDlg, SelectHdl, ListBox*, pListBox ) -{ - if( pListBox == &maDeviceBox && Sane::IsSane() && Sane::CountDevices() ) - { - String aNewDevice = maDeviceBox.GetSelectEntry(); - int nNumber; - if( aNewDevice.Equals( Sane::GetName( nNumber = mrSane.GetDeviceNumber() ) ) ) - { - mrSane.Close(); - mrSane.Open( nNumber ); - InitFields(); - } - } - if( mrSane.IsOpen() ) - { - if( pListBox == &maQuantumRangeBox ) - { - ByteString aValue( maQuantumRangeBox.GetSelectEntry(), osl_getThreadTextEncoding() ); - double fValue = atof( aValue.GetBuffer() ); - mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); - } - else if( pListBox == &maStringRangeBox ) - { - mrSane.SetOptionValue( mnCurrentOption, maStringRangeBox.GetSelectEntry() ); - } - } - return 0; -} - -IMPL_LINK( SaneDlg, OptionsBoxSelectHdl, SvTreeListBox*, pBox ) -{ - if( pBox == &maOptionBox && Sane::IsSane() ) - { - String aOption = - maOptionBox.GetEntryText( maOptionBox.FirstSelected() ); - int nOption = mrSane.GetOptionByName( ByteString( aOption, osl_getThreadTextEncoding() ).GetBuffer() ); - if( nOption != -1 && nOption != mnCurrentOption ) - { - DisableOption(); - mnCurrentOption = nOption; - maOptionTitle.SetText( mrSane.GetOptionTitle( mnCurrentOption ) ); - SANE_Value_Type nType = mrSane.GetOptionType( mnCurrentOption ); - SANE_Constraint_Type nConstraint; - switch( nType ) - { - case SANE_TYPE_BOOL: EstablishBoolOption();break; - case SANE_TYPE_STRING: - nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption ); - if( nConstraint == SANE_CONSTRAINT_STRING_LIST ) - EstablishStringRange(); - else - EstablishStringOption(); - break; - case SANE_TYPE_FIXED: - case SANE_TYPE_INT: - { - nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption ); - int nElements = mrSane.GetOptionElements( mnCurrentOption ); - mnCurrentElement = 0; - if( nConstraint == SANE_CONSTRAINT_RANGE || - nConstraint == SANE_CONSTRAINT_WORD_LIST ) - EstablishQuantumRange(); - else - { - mfMin = mfMax = 0.0; - EstablishNumericOption(); - } - if( nElements > 1 ) - { - if( nElements <= 10 ) - { - maVectorBox.SetValue( 1 ); - maVectorBox.SetMin( 1 ); - maVectorBox.SetMax( - mrSane.GetOptionElements( mnCurrentOption ) ); - maVectorBox.Show( sal_True ); - maVectorTxt.Show( sal_True ); - } - else - { - DisableOption(); - // bring up dialog only on button click - EstablishButtonOption(); - } - } - } - break; - case SANE_TYPE_BUTTON: - EstablishButtonOption(); - break; - default: break; - } - } - } - return 0; -} - -IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit ) -{ - if( mrSane.IsOpen() ) - { - if( pEdit == &maStringEdit ) - { - mrSane.SetOptionValue( mnCurrentOption, maStringEdit.GetText() ); - } - else if( pEdit == &maReslBox ) - { - double fRes = (double)maReslBox.GetValue(); - int nOption = mrSane.GetOptionByName( "resolution" ); - if( nOption != -1 ) - { - double* pDouble = NULL; - int nValues = mrSane.GetRange( nOption, pDouble ); - if( nValues > 0 ) - { - int i; - for( i = 0; i < nValues; i++ ) - { - if( fRes == pDouble[i] ) - break; - } - if( i >= nValues ) - fRes = pDouble[0]; - } - else if( nValues == 0 ) - { - if( fRes < pDouble[ 0 ] ) - fRes = pDouble[ 0 ]; - if( fRes > pDouble[ 1 ] ) - fRes = pDouble[ 1 ]; - } - maReslBox.SetValue( (sal_uLong)fRes ); - } - } - else if( pEdit == &maNumericEdit ) - { - double fValue; - char pBuf[256]; - ByteString aContents( maNumericEdit.GetText(), osl_getThreadTextEncoding() ); - fValue = atof( aContents.GetBuffer() ); - if( mfMin != mfMax && ( fValue < mfMin || fValue > mfMax ) ) - { - if( fValue < mfMin ) - fValue = mfMin; - else if( fValue > mfMax ) - fValue = mfMax; - sprintf( pBuf, "%g", fValue ); - maNumericEdit.SetText( String( pBuf, osl_getThreadTextEncoding() ) ); - } - mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); - } - else if( pEdit == &maVectorBox ) - { - char pBuf[256]; - mnCurrentElement = maVectorBox.GetValue()-1; - double fValue; - mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); - sprintf( pBuf, "%g", fValue ); - String aValue( pBuf, osl_getThreadTextEncoding() ); - maNumericEdit.SetText( aValue ); - maQuantumRangeBox.SelectEntry( aValue ); - } - else if( pEdit == &maTopField ) - { - Point aPoint( 0, maTopField.GetValue() ); - aPoint = GetPixelPos( aPoint ); - maTopLeft.Y() = aPoint.Y(); - DrawDrag(); - } - else if( pEdit == &maLeftField ) - { - Point aPoint( maLeftField.GetValue(), 0 ); - aPoint = GetPixelPos( aPoint ); - maTopLeft.X() = aPoint.X(); - DrawDrag(); - } - else if( pEdit == &maBottomField ) - { - Point aPoint( 0, maBottomField.GetValue() ); - aPoint = GetPixelPos( aPoint ); - maBottomRight.Y() = aPoint.Y(); - DrawDrag(); - } - else if( pEdit == &maRightField ) - { - Point aPoint( maRightField.GetValue(), 0 ); - aPoint = GetPixelPos( aPoint ); - maBottomRight.X() = aPoint.X(); - DrawDrag(); - } - } - return 0; -} - -IMPL_LINK( SaneDlg, ReloadSaneOptionsHdl, Sane*, /*pSane*/ ) -{ - mnCurrentOption = -1; - mnCurrentElement = 0; - DisableOption(); - // #92024# preserve preview rect, should only be set - // initially or in AcquirePreview - Rectangle aPreviewRect = maPreviewRect; - InitFields(); - maPreviewRect = aPreviewRect; - Rectangle aDummyRect( Point( 0, 0 ), GetSizePixel() ); - Paint( aDummyRect ); - return 0; -} - -void SaneDlg::AcquirePreview() -{ - if( ! mrSane.IsOpen() ) - return; - - UpdateScanArea( sal_True ); - // set small resolution for preview - double fResl = (double)maReslBox.GetValue(); - SetAdjustedNumericalValue( "resolution", 30.0 ); - - int nOption = mrSane.GetOptionByName( "preview" ); - if( nOption == -1 ) - { - String aString( SaneResId( RID_SANE_NORESOLUTIONOPTION_TXT ) ); - WarningBox aBox( this, WB_OK_CANCEL | WB_DEF_OK, aString ); - if( aBox.Execute() == RET_CANCEL ) - return; - } - else - mrSane.SetOptionValue( nOption, (sal_Bool)sal_True ); - - BitmapTransporter aTransporter; - if( ! mrSane.Start( aTransporter ) ) - { - ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, - String( SaneResId( RID_SANE_SCANERROR_TXT ) ) ); - aErrorBox.Execute(); - } - else - { -#if OSL_DEBUG_LEVEL > 1 - aTransporter.getStream().Seek( STREAM_SEEK_TO_END ); - fprintf( stderr, "Previewbitmapstream contains %d bytes\n", (int)aTransporter.getStream().Tell() ); -#endif - aTransporter.getStream().Seek( STREAM_SEEK_TO_BEGIN ); - maPreviewBitmap.Read( aTransporter.getStream(), sal_True ); - } - - SetAdjustedNumericalValue( "resolution", fResl ); - maReslBox.SetValue( (sal_uLong)fResl ); - - if( mbDragEnable ) - { - maPreviewRect = Rectangle( maTopLeft, - Size( maBottomRight.X() - maTopLeft.X(), - maBottomRight.Y() - maTopLeft.Y() ) - ); - } - else - { - Size aBMSize( maPreviewBitmap.GetSizePixel() ); - if( aBMSize.Width() > aBMSize.Height() && aBMSize.Width() ) - { - int nVHeight = (maBottomRight.X() - maTopLeft.X()) * aBMSize.Height() / aBMSize.Width(); - maPreviewRect = Rectangle( Point( maTopLeft.X(), ( maTopLeft.Y() + maBottomRight.Y() )/2 - nVHeight/2 ), - Size( maBottomRight.X() - maTopLeft.X(), - nVHeight ) ); - } - else if (aBMSize.Height()) - { - int nVWidth = (maBottomRight.Y() - maTopLeft.Y()) * aBMSize.Width() / aBMSize.Height(); - maPreviewRect = Rectangle( Point( ( maTopLeft.X() + maBottomRight.X() )/2 - nVWidth/2, maTopLeft.Y() ), - Size( nVWidth, - maBottomRight.Y() - maTopLeft.Y() ) ); - } - } - - Paint( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); -} - -void SaneDlg::Paint( const Rectangle& rRect ) -{ - SetMapMode( maMapMode ); - SetFillColor( Color( COL_WHITE ) ); - SetLineColor( Color( COL_WHITE ) ); - DrawRect( Rectangle( Point( PREVIEW_UPPER_LEFT, PREVIEW_UPPER_TOP ), - Size( PREVIEW_WIDTH, PREVIEW_HEIGHT ) ) ); - SetMapMode( MapMode( MAP_PIXEL ) ); - // check for sane values - DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(), - maPreviewBitmap ); - - mbDragDrawn = sal_False; - DrawDrag(); - - ModalDialog::Paint( rRect ); -} - -void SaneDlg::DisableOption() -{ - maBoolCheckBox.Show( sal_False ); - maStringEdit.Show( sal_False ); - maNumericEdit.Show( sal_False ); - maQuantumRangeBox.Show( sal_False ); - maStringRangeBox.Show( sal_False ); - maButtonOption.Show( sal_False ); - maVectorBox.Show( sal_False ); - maVectorTxt.Show( sal_False ); - maOptionDescTxt.Show( sal_False ); -} - -void SaneDlg::EstablishBoolOption() -{ - sal_Bool bSuccess, bValue; - - bSuccess = mrSane.GetOptionValue( mnCurrentOption, bValue ); - if( bSuccess ) - { - maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) ); - maOptionDescTxt.Show( sal_True ); - maBoolCheckBox.Check( bValue ); - maBoolCheckBox.Show( sal_True ); - } -} - -void SaneDlg::EstablishStringOption() -{ - sal_Bool bSuccess; - ByteString aValue; - - bSuccess = mrSane.GetOptionValue( mnCurrentOption, aValue ); - if( bSuccess ) - { - maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) ); - maOptionDescTxt.Show( sal_True ); - maStringEdit.SetText( String( aValue, osl_getThreadTextEncoding() ) ); - maStringEdit.Show( sal_True ); - } -} - -void SaneDlg::EstablishStringRange() -{ - const char** ppStrings = mrSane.GetStringConstraint( mnCurrentOption ); - maStringRangeBox.Clear(); - for( int i = 0; ppStrings[i] != 0; i++ ) - maStringRangeBox.InsertEntry( String( ppStrings[i], osl_getThreadTextEncoding() ) ); - ByteString aValue; - mrSane.GetOptionValue( mnCurrentOption, aValue ); - maStringRangeBox.SelectEntry( String( aValue, osl_getThreadTextEncoding() ) ); - maStringRangeBox.Show( sal_True ); - maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) ); - maOptionDescTxt.Show( sal_True ); -} - -void SaneDlg::EstablishQuantumRange() -{ - if( mpRange ) - { - delete [] mpRange; - mpRange = 0; - } - int nValues = mrSane.GetRange( mnCurrentOption, mpRange ); - if( nValues == 0 ) - { - mfMin = mpRange[ 0 ]; - mfMax = mpRange[ 1 ]; - delete [] mpRange; - mpRange = 0; - EstablishNumericOption(); - } - else if( nValues > 0 ) - { - char pBuf[ 256 ]; - maQuantumRangeBox.Clear(); - mfMin = mpRange[ 0 ]; - mfMax = mpRange[ nValues-1 ]; - for( int i = 0; i < nValues; i++ ) - { - sprintf( pBuf, "%g", mpRange[ i ] ); - maQuantumRangeBox.InsertEntry( String( pBuf, osl_getThreadTextEncoding() ) ); - } - double fValue; - if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ) ) - { - sprintf( pBuf, "%g", fValue ); - maQuantumRangeBox.SelectEntry( String( pBuf, osl_getThreadTextEncoding() ) ); - } - maQuantumRangeBox.Show( sal_True ); - String aText( mrSane.GetOptionName( mnCurrentOption ) ); - aText += ' '; - aText += mrSane.GetOptionUnitName( mnCurrentOption ); - maOptionDescTxt.SetText( aText ); - maOptionDescTxt.Show( sal_True ); - } -} - -void SaneDlg::EstablishNumericOption() -{ - sal_Bool bSuccess; - double fValue; - - bSuccess = mrSane.GetOptionValue( mnCurrentOption, fValue ); - if( ! bSuccess ) - return; - - char pBuf[256]; - String aText( mrSane.GetOptionName( mnCurrentOption ) ); - aText += ' '; - aText += mrSane.GetOptionUnitName( mnCurrentOption ); - if( mfMin != mfMax ) - { - sprintf( pBuf, " < %g ; %g >", mfMin, mfMax ); - aText += String( pBuf, osl_getThreadTextEncoding() ); - } - maOptionDescTxt.SetText( aText ); - maOptionDescTxt.Show( sal_True ); - sprintf( pBuf, "%g", fValue ); - maNumericEdit.SetText( String( pBuf, osl_getThreadTextEncoding() ) ); - maNumericEdit.Show( sal_True ); -} - -void SaneDlg::EstablishButtonOption() -{ - maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) ); - maOptionDescTxt.Show( sal_True ); - maButtonOption.Show( sal_True ); -} - -#define RECT_SIZE_PIX 7 - -void SaneDlg::MouseMove( const MouseEvent& rMEvt ) -{ - if( mbIsDragging ) - { - Point aMousePos = rMEvt.GetPosPixel(); - // move into valid area - Point aLogicPos = GetLogicPos( aMousePos ); - aMousePos = GetPixelPos( aLogicPos ); - switch( meDragDirection ) - { - case TopLeft: maTopLeft = aMousePos; break; - case Top: maTopLeft.Y() = aMousePos.Y(); break; - case TopRight: - maTopLeft.Y() = aMousePos.Y(); - maBottomRight.X() = aMousePos.X(); - break; - case Right: maBottomRight.X() = aMousePos.X(); break; - case BottomRight: maBottomRight = aMousePos; break; - case Bottom: maBottomRight.Y() = aMousePos.Y(); break; - case BottomLeft: - maTopLeft.X() = aMousePos.X(); - maBottomRight.Y() = aMousePos.Y(); - break; - case Left: maTopLeft.X() = aMousePos.X(); break; - default: break; - } - int nSwap; - if( maTopLeft.X() > maBottomRight.X() ) - { - nSwap = maTopLeft.X(); - maTopLeft.X() = maBottomRight.X(); - maBottomRight.X() = nSwap; - } - if( maTopLeft.Y() > maBottomRight.Y() ) - { - nSwap = maTopLeft.Y(); - maTopLeft.Y() = maBottomRight.Y(); - maBottomRight.Y() = nSwap; - } - DrawDrag(); - UpdateScanArea( sal_False ); - } - ModalDialog::MouseMove( rMEvt ); -} - -void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt ) -{ - Point aMousePixel = rMEvt.GetPosPixel(); - - if( ! mbIsDragging && mbDragEnable ) - { - int nMiddleX = ( maBottomRight.X() - maTopLeft.X() ) / 2 - RECT_SIZE_PIX/2 + maTopLeft.X(); - int nMiddleY = ( maBottomRight.Y() - maTopLeft.Y() ) / 2 - RECT_SIZE_PIX/2 + maTopLeft.Y(); - if( aMousePixel.Y() >= maTopLeft.Y() && - aMousePixel.Y() < maTopLeft.Y() + RECT_SIZE_PIX ) - { - if( aMousePixel.X() >= maTopLeft.X() && - aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX ) - { - meDragDirection = TopLeft; - aMousePixel = maTopLeft; - mbIsDragging = sal_True; - } - else if( aMousePixel.X() >= nMiddleX && - aMousePixel.X() < nMiddleX + RECT_SIZE_PIX ) - { - meDragDirection = Top; - aMousePixel.Y() = maTopLeft.Y(); - mbIsDragging = sal_True; - } - else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && - aMousePixel.X() <= maBottomRight.X() ) - { - meDragDirection = TopRight; - aMousePixel = Point( maBottomRight.X(), maTopLeft.Y() ); - mbIsDragging = sal_True; - } - } - else if( aMousePixel.Y() >= nMiddleY && - aMousePixel.Y() < nMiddleY + RECT_SIZE_PIX ) - { - if( aMousePixel.X() >= maTopLeft.X() && - aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX ) - { - meDragDirection = Left; - aMousePixel.X() = maTopLeft.X(); - mbIsDragging = sal_True; - } - else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && - aMousePixel.X() <= maBottomRight.X() ) - { - meDragDirection = Right; - aMousePixel.X() = maBottomRight.X(); - mbIsDragging = sal_True; - } - } - else if( aMousePixel.Y() <= maBottomRight.Y() && - aMousePixel.Y() > maBottomRight.Y() - RECT_SIZE_PIX ) - { - if( aMousePixel.X() >= maTopLeft.X() && - aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX ) - { - meDragDirection = BottomLeft; - aMousePixel = Point( maTopLeft.X(), maBottomRight.Y() ); - mbIsDragging = sal_True; - } - else if( aMousePixel.X() >= nMiddleX && - aMousePixel.X() < nMiddleX + RECT_SIZE_PIX ) - { - meDragDirection = Bottom; - aMousePixel.Y() = maBottomRight.Y(); - mbIsDragging = sal_True; - } - else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX && - aMousePixel.X() <= maBottomRight.X() ) - { - meDragDirection = BottomRight; - aMousePixel = maBottomRight; - mbIsDragging = sal_True; - } - } - } - if( mbIsDragging ) - { - SetPointerPosPixel( aMousePixel ); - DrawDrag(); - } - ModalDialog::MouseButtonDown( rMEvt ); -} - -void SaneDlg::MouseButtonUp( const MouseEvent& rMEvt ) -{ - if( mbIsDragging ) - { - UpdateScanArea( sal_True ); - } - mbIsDragging = sal_False; - - ModalDialog::MouseButtonUp( rMEvt ); -} - -void SaneDlg::DrawRectangles( Point& rUL, Point& rBR ) -{ - int nMiddleX, nMiddleY; - Point aBL, aUR; - - aUR = Point( rBR.X(), rUL.Y() ); - aBL = Point( rUL.X(), rBR.Y() ); - nMiddleX = ( rBR.X() - rUL.X() ) / 2 + rUL.X(); - nMiddleY = ( rBR.Y() - rUL.Y() ) / 2 + rUL.Y(); - - DrawLine( rUL, aBL ); - DrawLine( aBL, rBR ); - DrawLine( rBR, aUR ); - DrawLine( aUR, rUL ); - DrawRect( Rectangle( rUL, Size( RECT_SIZE_PIX,RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( aBL, Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( rBR, Size( -RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( aUR, Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rUL.Y() ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rBR.Y() ), Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( Point( rUL.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) ); - DrawRect( Rectangle( Point( rBR.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) ); -} - -void SaneDlg::DrawDrag() -{ - static Point aLastUL, aLastBR; - - if( ! mbDragEnable ) - return; - - RasterOp eROP = GetRasterOp(); - SetRasterOp( ROP_INVERT ); - SetMapMode( MapMode( MAP_PIXEL ) ); - - if( mbDragDrawn ) - DrawRectangles( aLastUL, aLastBR ); - - aLastUL = maTopLeft; - aLastBR = maBottomRight; - DrawRectangles( maTopLeft, maBottomRight ); - - mbDragDrawn = sal_True; - SetRasterOp( eROP ); - SetMapMode( maMapMode ); -} - -Point SaneDlg::GetPixelPos( const Point& rIn ) -{ - Point aConvert( - ( ( rIn.X() * PREVIEW_WIDTH ) / - ( maMaxBottomRight.X() - maMinTopLeft.X() ) ) - + PREVIEW_UPPER_LEFT, - ( ( rIn.Y() * PREVIEW_HEIGHT ) - / ( maMaxBottomRight.Y() - maMinTopLeft.Y() ) ) - + PREVIEW_UPPER_TOP ); - - return LogicToPixel( aConvert, maMapMode ); -} - -Point SaneDlg::GetLogicPos( const Point& rIn ) -{ - Point aConvert = PixelToLogic( rIn, maMapMode ); - aConvert.X() -= PREVIEW_UPPER_LEFT; - aConvert.Y() -= PREVIEW_UPPER_TOP; - if( aConvert.X() < 0 ) - aConvert.X() = 0; - if( aConvert.X() >= PREVIEW_WIDTH ) - aConvert.X() = PREVIEW_WIDTH-1; - if( aConvert.Y() < 0 ) - aConvert.Y() = 0; - if( aConvert.Y() >= PREVIEW_HEIGHT ) - aConvert.Y() = PREVIEW_HEIGHT-1; - - aConvert.X() *= ( maMaxBottomRight.X() - maMinTopLeft.X() ); - aConvert.X() /= PREVIEW_WIDTH; - aConvert.Y() *= ( maMaxBottomRight.Y() - maMinTopLeft.Y() ); - aConvert.Y() /= PREVIEW_HEIGHT; - return aConvert; -} - -void SaneDlg::UpdateScanArea( sal_Bool bSend ) -{ - if( ! mbDragEnable ) - return; - - Point aUL = GetLogicPos( maTopLeft ); - Point aBR = GetLogicPos( maBottomRight ); - - maLeftField.SetValue( aUL.X() ); - maTopField.SetValue( aUL.Y() ); - maRightField.SetValue( aBR.X() ); - maBottomField.SetValue( aBR.Y() ); - - if( ! bSend ) - return; - - if( mrSane.IsOpen() ) - { - SetAdjustedNumericalValue( "tl-x", (double)aUL.X() ); - SetAdjustedNumericalValue( "tl-y", (double)aUL.Y() ); - SetAdjustedNumericalValue( "br-x", (double)aBR.X() ); - SetAdjustedNumericalValue( "br-y", (double)aBR.Y() ); - } -} - -sal_Bool SaneDlg::LoadState() -{ - int i; - - if( ! Sane::IsSane() ) - return sal_False; - - const char* pEnv = getenv("HOME"); - String aFileName( pEnv ? pEnv : "", osl_getThreadTextEncoding() ); - aFileName += String( RTL_CONSTASCII_USTRINGPARAM( "/.so_sane_state" ) ); - Config aConfig( aFileName ); - if( ! aConfig.HasGroup( "SANE" ) ) - return sal_False; - - aConfig.SetGroup( "SANE" ); - ByteString aString = aConfig.ReadKey( "SO_LastSaneDevice" ); - for( i = 0; i < Sane::CountDevices() && ! aString.Equals( ByteString( Sane::GetName( i ), osl_getThreadTextEncoding() ) ); i++ ) ; - if( i == Sane::CountDevices() ) - return sal_False; - - mrSane.Close(); - mrSane.Open( aString.GetBuffer() ); - - DisableOption(); - InitFields(); - - if( mrSane.IsOpen() ) - { - int iMax = aConfig.GetKeyCount(); - for( i = 0; i < iMax; i++ ) - { - aString = aConfig.GetKeyName( i ); - ByteString aValue = aConfig.ReadKey( i ); - int nOption = mrSane.GetOptionByName( aString.GetBuffer() ); - if( nOption != -1 ) - { - if( aValue.CompareTo( "BOOL=", 5 ) == COMPARE_EQUAL ) - { - aValue.Erase( 0, 5 ); - sal_Bool aBOOL = (sal_Bool)aValue.ToInt32(); - mrSane.SetOptionValue( nOption, aBOOL ); - } - else if( aValue.CompareTo( "STRING=", 7 ) == COMPARE_EQUAL ) - { - aValue.Erase( 0, 7 ); - mrSane.SetOptionValue( nOption, String( aValue, osl_getThreadTextEncoding() ) ); - } - else if( aValue.CompareTo( "NUMERIC=", 8 ) == COMPARE_EQUAL ) - { - aValue.Erase( 0, 8 ); - int nMax = aValue.GetTokenCount( ':' ); - double fValue=0.0; - for( int n = 0; n < nMax ; n++ ) - { - ByteString aSub = aValue.GetToken( n, ':' ); - sscanf( aSub.GetBuffer(), "%lg", &fValue ); - SetAdjustedNumericalValue( aString.GetBuffer(), fValue, n ); - } - } - } - } - } - - DisableOption(); - InitFields(); - - return sal_True; -} - -void SaneDlg::SaveState() -{ - if( ! Sane::IsSane() ) - return; - - const char* pEnv = getenv( "HOME" ); - String aFileName( pEnv ? pEnv : "", osl_getThreadTextEncoding() ); - aFileName.AppendAscii( "/.so_sane_state" ); - - Config aConfig( aFileName ); - aConfig.DeleteGroup( "SANE" ); - aConfig.SetGroup( "SANE" ); - aConfig.WriteKey( "SO_LastSANEDevice", ByteString( maDeviceBox.GetSelectEntry(), RTL_TEXTENCODING_UTF8 ) ); - - static char const* pSaveOptions[] = { - "resolution", - "tl-x", - "tl-y", - "br-x", - "br-y" - }; - for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); i++ ) - { - ByteString aOption = pSaveOptions[i]; - int nOption = mrSane.GetOptionByName( pSaveOptions[i] ); - if( nOption > -1 ) - { - SANE_Value_Type nType = mrSane.GetOptionType( nOption ); - switch( nType ) - { - case SANE_TYPE_BOOL: - { - sal_Bool bValue; - if( mrSane.GetOptionValue( nOption, bValue ) ) - { - rtl::OStringBuffer aString(RTL_CONSTASCII_STRINGPARAM( - "BOOL=")); - aString.append(static_cast(bValue)); - aConfig.WriteKey(aOption, aString.makeStringAndClear()); - } - } - break; - case SANE_TYPE_STRING: - { - ByteString aString( "STRING=" ); - ByteString aValue; - if( mrSane.GetOptionValue( nOption, aValue ) ) - { - aString += aValue; - aConfig.WriteKey( aOption, aString ); - } - } - break; - case SANE_TYPE_FIXED: - case SANE_TYPE_INT: - { - ByteString aString( "NUMERIC=" ); - double fValue; - char buf[256]; - int n; - - for( n = 0; n < mrSane.GetOptionElements( nOption ); n++ ) - { - if( ! mrSane.GetOptionValue( nOption, fValue, n ) ) - break; - if( n > 0 ) - aString += ":"; - sprintf( buf, "%lg", fValue ); - aString += buf; - } - if( n >= mrSane.GetOptionElements( nOption ) ) - aConfig.WriteKey( aOption, aString ); - } - break; - default: - break; - } - } - } -} - -sal_Bool SaneDlg::SetAdjustedNumericalValue( - const char* pOption, - double fValue, - int nElement ) -{ - int nOption; - if( ! Sane::IsSane() || ! mrSane.IsOpen() || ( nOption = mrSane.GetOptionByName( pOption ) ) == -1 ) - return sal_False; - - if( nElement < 0 || nElement >= mrSane.GetOptionElements( nOption ) ) - return sal_False; - - double* pValues = NULL; - int nValues; - if( ( nValues = mrSane.GetRange( nOption, pValues ) ) < 0 ) - return sal_False; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SaneDlg::SetAdjustedNumericalValue( \"%s\", %lg ) ", - pOption, fValue ); -#endif - - if( nValues ) - { - int nNearest = 0; - double fNearest = 1e6; - for( int i = 0; i < nValues; i++ ) - { - if( fabs( fValue - pValues[ i ] ) < fNearest ) - { - fNearest = fabs( fValue - pValues[ i ] ); - nNearest = i; - } - } - fValue = pValues[ nNearest ]; - } - else - { - if( fValue < pValues[0] ) - fValue = pValues[0]; - if( fValue > pValues[1] ) - fValue = pValues[1]; - } - delete [] pValues; - mrSane.SetOptionValue( nOption, fValue, nElement ); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "yields %lg\n", fValue ); -#endif - - - return sal_True; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sanedlg.hrc b/extensions/source/scanner/sanedlg.hrc deleted file mode 100644 index 711caff9a..000000000 --- a/extensions/source/scanner/sanedlg.hrc +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_SANEDLG_HRC -#define _SVT_SANEDLG_HRC - -#define RID_SANE_DIALOG 1000 -#define RID_SCAN_OK 1 -#define RID_SCAN_CANCEL 2 -#define RID_DEVICEINFO_BTN 3 -#define RID_PREVIEW_BOX 4 -#define RID_DEVICE_BOX_TXT 5 -#define RID_DEVICE_BOX 6 -#define RID_SCANAREA_BOX 7 -#define RID_SCAN_LEFT_TXT 8 -#define RID_SCAN_LEFT_BOX 9 -#define RID_SCAN_TOP_BOX 10 -#define RID_SCAN_TOP_TXT 11 -#define RID_SCAN_RIGHT_TXT 12 -#define RID_SCAN_RIGHT_BOX 13 -#define RID_SCAN_BOTTOM_TXT 14 -#define RID_SCAN_BOTTOM_BOX 15 -#define RID_SCAN_RESOLUTION_TXT 16 -#define RID_SCAN_RESOLUTION_BOX 17 -#define RID_PREVIEW_BTN 18 -#define RID_SCAN_OPTION_BOX 19 -#define RID_SCAN_OPTIONTITLE_TXT 20 -#define RID_SCAN_OPTION_DESC_TXT 21 -#define RID_SCAN_BOOL_OPTION_BOX 22 -#define RID_SCAN_OPTION_TXT 23 -#define RID_SCAN_STRING_OPTION_EDT 24 -#define RID_SCAN_QUANTUM_RANGE_BOX 25 -#define RID_SCAN_STRING_RANGE_BOX 26 -#define RID_SCAN_NUMERIC_OPTION_EDT 27 -#define RID_SCAN_BUTTON_OPTION_BTN 28 -#define RID_SCAN_NUMERIC_VECTOR_BOX 29 -#define RID_SCAN_NUMERIC_VECTOR_TXT 30 -#define RID_SCAN_BITMAP_PLUS 31 -#define RID_SCAN_BITMAP_MINUS 32 -#define RID_SCAN_ADVANCED_BOX 33 -#define RID_SCAN_ADVANCED_TXT 34 - -#define RID_SANE_DEVICEINFO_TXT 1001 -#define RID_SANE_SCANERROR_TXT 1002 -#define RID_SANE_NORESOLUTIONOPTION_TXT 1003 -#define RID_SANE_NOSANELIB_TXT 1004 - -#define SCAN_AREA_TOP 17 -#define SCAN_AREA_LEFT 8 -#define PREVIEW_UPPER_LEFT SCAN_AREA_LEFT -#define PREVIEW_UPPER_TOP SCAN_AREA_TOP + 80 -#define PREVIEW_WIDTH 113 -#define PREVIEW_HEIGHT 160 -#define PREVIEW_BOTTOM PREVIEW_UPPER_TOP + PREVIEW_HEIGHT -#define PREVIEW_RIGHT PREVIEW_UPPER_LEFT + PREVIEW_WIDTH -#define SECOND_COLUMN PREVIEW_WIDTH + 20 -#define THIRD_COLUMN SECOND_COLUMN + 135 - -#endif diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx deleted file mode 100644 index 29c9de8b7..000000000 --- a/extensions/source/scanner/sanedlg.hxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SVT_SANEDLG_HXX -#define _SVT_SANEDLG_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class SaneDlg : public ModalDialog -{ -private: - enum DragDirection { TopLeft, Top, TopRight, Right, BottomRight, Bottom, - BottomLeft, Left }; - - Sane& mrSane; - Bitmap maPreviewBitmap; - Rectangle maPreviewRect; - Point maTopLeft, maBottomRight; - Point maMinTopLeft, maMaxBottomRight; - sal_Bool mbDragEnable; - sal_Bool mbIsDragging; - int mnDragMode; - sal_Bool mbDragDrawn; - DragDirection meDragDirection; - - MapMode maMapMode; - - Link maOldLink; - - OKButton maOKButton; - CancelButton maCancelButton; - PushButton maDeviceInfoButton; - PushButton maPreviewButton; - PushButton maButtonOption; - - FixedText maOptionsTxt; - FixedText maOptionTitle; - FixedText maOptionDescTxt; - FixedText maVectorTxt; - - FixedText maScanLeftTxt; - MetricField maLeftField; - FixedText maScanTopTxt; - MetricField maTopField; - FixedText maRightTxt; - MetricField maRightField; - FixedText maBottomTxt; - MetricField maBottomField; - - FixedText maDeviceBoxTxt; - ListBox maDeviceBox; - FixedText maReslTxt; - NumericBox maReslBox; - FixedText maAdvancedTxt; - CheckBox maAdvancedBox; - - NumericField maVectorBox; - ListBox maQuantumRangeBox; - ListBox maStringRangeBox; - - FixedLine maPreviewBox; - FixedLine maAreaBox; - - CheckBox maBoolCheckBox; - - Edit maStringEdit; - Edit maNumericEdit; - - SvTreeListBox maOptionBox; - - int mnCurrentOption; - int mnCurrentElement; - double* mpRange; - double mfMin, mfMax; - - DECL_LINK( ClickBtnHdl, Button* ); - DECL_LINK( SelectHdl, ListBox* ); - DECL_LINK( ModifyHdl, Edit* ); - DECL_LINK( ReloadSaneOptionsHdl, Sane* ); - DECL_LINK( OptionsBoxSelectHdl, SvTreeListBox* ); - - void SaveState(); - sal_Bool LoadState(); - - void InitDevices(); - void InitFields(); - void AcquirePreview(); - void DisableOption(); - void EstablishBoolOption(); - void EstablishStringOption(); - void EstablishStringRange(); - void EstablishQuantumRange(); - void EstablishNumericOption(); - void EstablishButtonOption(); - - void DrawRectangles( Point&, Point& ); - void DrawDrag(); - Point GetPixelPos( const Point& ); - Point GetLogicPos( const Point& ); - void UpdateScanArea( sal_Bool ); - - // helper - sal_Bool SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 ); - - virtual void Paint( const Rectangle& ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); -public: - SaneDlg( Window*, Sane& ); - ~SaneDlg(); - - virtual short Execute(); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/sanedlg.src b/extensions/source/scanner/sanedlg.src deleted file mode 100644 index 20e825c07..000000000 --- a/extensions/source/scanner/sanedlg.src +++ /dev/null @@ -1,318 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include -ModalDialog RID_SANE_DIALOG -{ - HelpID = "extensions:ModalDialog:RID_SANE_DIALOG"; - OutputSize = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 10 , 10 ) ; - Size = MAP_APPFONT ( THIRD_COLUMN + 60 , 268 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton RID_SCAN_OK - { - Pos = MAP_APPFONT ( THIRD_COLUMN , 6 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - DefButton = TRUE; - }; - CancelButton RID_SCAN_CANCEL - { - Pos = MAP_APPFONT ( THIRD_COLUMN , 25 ) ; - Size = MAP_APPFONT ( 55 , 14 ) ; - }; - PushButton RID_DEVICEINFO_BTN - { - HelpID = "extensions:PushButton:RID_SANE_DIALOG:RID_DEVICEINFO_BTN"; - Pos = MAP_APPFONT ( THIRD_COLUMN , 44 ) ; - Size = MAP_APPFONT ( 55 , 22 ) ; - Text [ en-US ] = "About\n Dev~ice" ; - }; - PushButton RID_PREVIEW_BTN - { - HelpID = "extensions:PushButton:RID_SANE_DIALOG:RID_PREVIEW_BTN"; - Pos = MAP_APPFONT ( THIRD_COLUMN , 71 ) ; - Size = MAP_APPFONT ( 55 , 22 ) ; - Text [ en-US ] = "Create\nPreview" ; - }; - FixedLine RID_PREVIEW_BOX - { - Pos = MAP_APPFONT ( PREVIEW_UPPER_LEFT - 5 , PREVIEW_UPPER_TOP - 8 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH + 10 , 8 ) ; - Text [ en-US ] = "Preview" ; - }; - FixedLine RID_SCANAREA_BOX - { - Pos = MAP_APPFONT ( SCAN_AREA_LEFT - 5 , SCAN_AREA_TOP - 12 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH + 10 , 8 ) ; - Text [ en-US ] = "Scan area" ; - }; - FixedText RID_SCAN_LEFT_TXT - { - Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Left:" ; - }; - MetricField RID_SCAN_LEFT_BOX - { - HelpID = "extensions:MetricField:RID_SANE_DIALOG:RID_SCAN_LEFT_BOX"; - Spin = TRUE ; - Repeat = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP - 2 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ; - }; - FixedText RID_SCAN_TOP_TXT - { - Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 17 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Top:" ; - }; - MetricField RID_SCAN_TOP_BOX - { - HelpID = "extensions:MetricField:RID_SANE_DIALOG:RID_SCAN_TOP_BOX"; - Spin = TRUE ; - Repeat = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 15 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ; - }; - FixedText RID_SCAN_RIGHT_TXT - { - Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 34 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Right:" ; - }; - MetricField RID_SCAN_RIGHT_BOX - { - HelpID = "extensions:MetricField:RID_SANE_DIALOG:RID_SCAN_RIGHT_BOX"; - Spin = TRUE ; - Repeat = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 32 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ; - }; - FixedText RID_SCAN_BOTTOM_TXT - { - Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 51 ) ; - Size = MAP_APPFONT ( 50 , 8 ) ; - Text [ en-US ] = "Bottom:" ; - }; - MetricField RID_SCAN_BOTTOM_BOX - { - HelpID = "extensions:MetricField:RID_SANE_DIALOG:RID_SCAN_BOTTOM_BOX"; - Spin = TRUE ; - Repeat = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 49 ) ; - Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ; - }; - FixedText RID_DEVICE_BOX_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 8 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Device used:" ; - }; - ListBox RID_DEVICE_BOX - { - HelpID = "extensions:ListBox:RID_SANE_DIALOG:RID_DEVICE_BOX"; - Border = TRUE ; - Dropdown = TRUE ; - Sort = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN + 70 , 6 ) ; - Size = MAP_APPFONT ( 60 , 80 ) ; - }; - FixedText RID_SCAN_RESOLUTION_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 25 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Resolution [~DPI]" ; - }; - NumericBox RID_SCAN_RESOLUTION_BOX - { - HelpID = "extensions:NumericBox:RID_SANE_DIALOG:RID_SCAN_RESOLUTION_BOX"; - Dropdown = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN + 70 , 23 ) ; - Size = MAP_APPFONT ( 60 , 80 ) ; - }; - FixedText RID_SCAN_ADVANCED_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 40 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - Text [ en-US ] = "Show advanced options" ; - }; - CheckBox RID_SCAN_ADVANCED_BOX - { - HelpID = "extensions:CheckBox:RID_SANE_DIALOG:RID_SCAN_ADVANCED_BOX"; - Check = FALSE ; - Pos = MAP_APPFONT ( SECOND_COLUMN + 120 , 40 ) ; - Size = MAP_APPFONT ( 8 , 8 ) ; - }; - FixedText RID_SCAN_OPTION_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 54 ) ; - Size = MAP_APPFONT ( 130 , 8 ) ; - Text [ en-US ] = "Options:" ; - }; - Control RID_SCAN_OPTION_BOX - { - Border = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 63 ) ; - Size = MAP_APPFONT ( 130 , 102 ) ; - }; - FixedText RID_SCAN_OPTIONTITLE_TXT - { - WordBreak = TRUE ; - Border = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 170 ) ; - Size = MAP_APPFONT ( 130 , 50 ) ; - }; - FixedText RID_SCAN_OPTION_DESC_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 225 ) ; - Size = MAP_APPFONT ( 120 , 8 ) ; - }; - CheckBox RID_SCAN_BOOL_OPTION_BOX - { - HelpID = "extensions:CheckBox:RID_SANE_DIALOG:RID_SCAN_BOOL_OPTION_BOX"; - Pos = MAP_APPFONT ( SECOND_COLUMN + 120 , 225 ) ; - Size = MAP_APPFONT ( 8 , 8 ) ; - }; - Edit RID_SCAN_STRING_OPTION_EDT - { - HelpID = "extensions:Edit:RID_SANE_DIALOG:RID_SCAN_STRING_OPTION_EDT"; - Border = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ; - Size = MAP_APPFONT ( 130 , 12 ) ; - }; - ListBox RID_SCAN_QUANTUM_RANGE_BOX - { - HelpID = "extensions:ListBox:RID_SANE_DIALOG:RID_SCAN_QUANTUM_RANGE_BOX"; - Border = TRUE ; - Dropdown = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ; - Size = MAP_APPFONT ( 130 , 80 ) ; - }; - ListBox RID_SCAN_STRING_RANGE_BOX - { - HelpID = "extensions:ListBox:RID_SANE_DIALOG:RID_SCAN_STRING_RANGE_BOX"; - Border = TRUE ; - Dropdown = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ; - Size = MAP_APPFONT ( 130 , 80 ) ; - }; - Edit RID_SCAN_NUMERIC_OPTION_EDT - { - HelpID = "extensions:Edit:RID_SANE_DIALOG:RID_SCAN_NUMERIC_OPTION_EDT"; - Border = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ; - Size = MAP_APPFONT ( 130 , 12 ) ; - }; - FixedText RID_SCAN_NUMERIC_VECTOR_TXT - { - Pos = MAP_APPFONT ( SECOND_COLUMN , 253 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Vector element" ; - }; - NumericField RID_SCAN_NUMERIC_VECTOR_BOX - { - HelpID = "extensions:NumericField:RID_SANE_DIALOG:RID_SCAN_NUMERIC_VECTOR_BOX"; - Border = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - Pos = MAP_APPFONT ( SECOND_COLUMN + 90 , 251 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - }; - PushButton RID_SCAN_BUTTON_OPTION_BTN - { - HelpID = "extensions:PushButton:RID_SANE_DIALOG:RID_SCAN_BUTTON_OPTION_BTN"; - Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ; - Size = MAP_APPFONT ( 130 , 14 ) ; - Text [ en-US ] = "Set" ; - }; - Bitmap RID_SCAN_BITMAP_PLUS - { - File = "plus.bmp" ; - }; - Bitmap RID_SCAN_BITMAP_MINUS - { - File = "minus.bmp" ; - }; - Text [ en-US ] = "Scanner" ; -}; -String RID_SANE_DEVICEINFO_TXT -{ - Text [ en-US ] = "Device: %s\nVendor: %s\nModel: %s\nType: %s" ; -}; -String RID_SANE_SCANERROR_TXT -{ - Text [ en-US ] = "An error occurred while scanning." ; -}; -String RID_SANE_NORESOLUTIONOPTION_TXT -{ - Text [ en-US ] = "The device does not offer a preview option. Therefore, a normal scan will be used as a preview instead. This may take a considerable amount of time." ; -}; -String RID_SANE_NOSANELIB_TXT -{ - Text [ en-US ] = "The SANE interface could not be initialized. Scanning is not possible." ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/source/scanner/scanner.cxx b/extensions/source/scanner/scanner.cxx deleted file mode 100644 index 97d8b925c..000000000 --- a/extensions/source/scanner/scanner.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include - -// ------------------ -// - ScannerManager - -// ------------------ - -REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& /*rxFactory*/ ) throw ( Exception ) -{ - return *( new ScannerManager() ); -} - -// ----------------------------------------------------------------------------- - -ScannerManager::ScannerManager() : - mpData( NULL ) -{ - AcquireData(); -} - -// ----------------------------------------------------------------------------- - -ScannerManager::~ScannerManager() -{ - ReleaseData(); -} - -// ----------------------------------------------------------------------------- - -ANY SAL_CALL ScannerManager::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - const ANY aRet( cppu::queryInterface( rType, - static_cast< XScannerManager* >( this ), - static_cast< AWT::XBitmap* >( this ) ) ); - - return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) ); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ScannerManager::acquire() throw() -{ - OWeakObject::acquire(); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ScannerManager::release() throw() -{ - OWeakObject::release(); -} - -// ----------------------------------------------------------------------------- - -SEQ( sal_Int8 ) SAL_CALL ScannerManager::getMaskDIB() throw() -{ - return SEQ( sal_Int8 )(); -} - -// ----------------------------------------------------------------------------- - -OUString ScannerManager::getImplementationName_Static() throw() -{ - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) ); -} - -// ----------------------------------------------------------------------------- - -SEQ( OUString ) ScannerManager::getSupportedServiceNames_Static() throw () -{ - SEQ( OUString ) aSNS( 1 ); - - aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) ); - - return aSNS; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx deleted file mode 100644 index 432ee63d5..000000000 --- a/extensions/source/scanner/scanner.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _EXT_SCANNER_HXX -#define _EXT_SCANNER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::scanner; - -using ::rtl::OUString; - -// ----------- -// - Defines - -// ----------- - -#define REF( _def_Obj ) Reference< _def_Obj > -#define SEQ( _def_Obj ) Sequence< _def_Obj > -#define ANY Any -#define AWT com::sun::star::awt - -// ------------------ -// - ScannerManager - -// ------------------ - -class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap -{ -protected: - - osl::Mutex maProtector; - void* mpData; - - void AcquireData(); - void ReleaseData(); - -public: - - ScannerManager(); - virtual ~ScannerManager(); - - // XInterface - virtual ANY SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException ); - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XScannerManager - virtual SEQ( ScannerContext ) SAL_CALL getAvailableScanners() throw(); - virtual sal_Bool SAL_CALL configureScanner( ScannerContext& scanner_context ) throw( ScannerException ); - virtual void SAL_CALL startScan( const ScannerContext& scanner_context, const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException ); - virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context ) throw( ScannerException ); - virtual REF( AWT::XBitmap ) SAL_CALL getBitmap( const ScannerContext& scanner_context ) throw( ScannerException ); - - // XBitmap - virtual AWT::Size SAL_CALL getSize() throw(); - virtual SEQ( sal_Int8 ) SAL_CALL getDIB() throw(); - virtual SEQ( sal_Int8 ) SAL_CALL getMaskDIB() throw(); - - // Misc - static OUString getImplementationName_Static() throw(); - static Sequence< OUString > getSupportedServiceNames_Static() throw(); - - void Lock() { maProtector.acquire(); } - void Unlock() { maProtector.release(); } - - void* GetData() const { return mpData; } - void SetData( void* pData ) { ReleaseData(); mpData = pData; } -}; - -// ----------------------------------------------------------------------------- - -REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& rxFactory ) throw( Exception ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx deleted file mode 100644 index 5c475689e..000000000 --- a/extensions/source/scanner/scanunx.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include - -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -BitmapTransporter::BitmapTransporter() -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "BitmapTransporter\n" ); -#endif -} - -BitmapTransporter::~BitmapTransporter() -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "~BitmapTransporter\n" ); -#endif -} - -// ----------------------------------------------------------------------------- - -ANY SAL_CALL BitmapTransporter::queryInterface( const Type& rType ) throw( RuntimeException ) -{ - const ANY aRet( cppu::queryInterface( rType, static_cast< AWT::XBitmap* >( this ) ) ); - - return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) ); -} - -// ----------------------------------------------------------------------------- - -AWT::Size BitmapTransporter::getSize() throw() -{ - osl::MutexGuard aGuard( m_aProtector ); - int nPreviousPos = m_aStream.Tell(); - AWT::Size aRet; - - // ensure that there is at least a header - m_aStream.Seek( STREAM_SEEK_TO_END ); - int nLen = m_aStream.Tell(); - if( nLen > 15 ) - { - m_aStream.Seek( 4 ); - m_aStream >> aRet.Width >> aRet.Height; - } - else - aRet.Width = aRet.Height = 0; - - m_aStream.Seek( nPreviousPos ); - - return aRet; -} - -// ----------------------------------------------------------------------------- - -SEQ( sal_Int8 ) BitmapTransporter::getDIB() throw() -{ - osl::MutexGuard aGuard( m_aProtector ); - int nPreviousPos = m_aStream.Tell(); - - // create return value - m_aStream.Seek( STREAM_SEEK_TO_END ); - int nBytes = m_aStream.Tell(); - m_aStream.Seek( 0 ); - - SEQ( sal_Int8 ) aValue( nBytes ); - m_aStream.Read( aValue.getArray(), nBytes ); - m_aStream.Seek( nPreviousPos ); - - return aValue; -} - -// -------------- -// - SaneHolder - -// -------------- - -struct SaneHolder -{ - Sane m_aSane; - REF( AWT::XBitmap ) m_xBitmap; - osl::Mutex m_aProtector; - ScanError m_nError; - bool m_bBusy; - - SaneHolder() : m_nError(ScanError_ScanErrorNone), m_bBusy(false) {} -}; - -namespace -{ - typedef std::vector< boost::shared_ptr > sanevec; - class allSanes - { - private: - int mnRefCount; - public: - sanevec m_aSanes; - allSanes() : mnRefCount(0) {} - void acquire(); - void release(); - }; - - void allSanes::acquire() - { - ++mnRefCount; - } - - void allSanes::release() - { - // was unused, now because of i99835: "Scanning interface not SANE API - // compliant" destroy all SaneHolder to get Sane Dtor called - --mnRefCount; - if (!mnRefCount) - m_aSanes.clear(); - } - - struct theSaneProtector : public rtl::Static {}; - struct theSanes : public rtl::Static {}; -} - -// ----------------- -// - ScannerThread - -// ----------------- - -class ScannerThread : public osl::Thread -{ - boost::shared_ptr m_pHolder; - REF( com::sun::star::lang::XEventListener ) m_xListener; - ScannerManager* m_pManager; // just for the disposing call - -public: - virtual void run(); - virtual void onTerminated() { delete this; } -public: - ScannerThread( boost::shared_ptr pHolder, - const REF( com::sun::star::lang::XEventListener )& listener, - ScannerManager* pManager ); - virtual ~ScannerThread(); -}; - -// ----------------------------------------------------------------------------- - -ScannerThread::ScannerThread( - boost::shared_ptr pHolder, - const REF( com::sun::star::lang::XEventListener )& listener, - ScannerManager* pManager ) - : m_pHolder( pHolder ), m_xListener( listener ), m_pManager( pManager ) -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "ScannerThread\n" ); -#endif -} - -ScannerThread::~ScannerThread() -{ -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "~ScannerThread\n" ); -#endif -} - -void ScannerThread::run() -{ - osl::MutexGuard aGuard( m_pHolder->m_aProtector ); - BitmapTransporter* pTransporter = new BitmapTransporter; - REF( XInterface ) aIf( static_cast< OWeakObject* >( pTransporter ) ); - - m_pHolder->m_xBitmap = REF( AWT::XBitmap )( aIf, UNO_QUERY ); - - m_pHolder->m_bBusy = true; - if( m_pHolder->m_aSane.IsOpen() ) - { - int nOption = m_pHolder->m_aSane.GetOptionByName( "preview" ); - if( nOption != -1 ) - m_pHolder->m_aSane.SetOptionValue( nOption, (sal_Bool)sal_False ); - - m_pHolder->m_nError = - m_pHolder->m_aSane.Start( *pTransporter ) ? - ScanError_ScanErrorNone : ScanError_ScanCanceled; - } - else - m_pHolder->m_nError = ScanError_ScannerNotAvailable; - - - REF( XInterface ) xXInterface( static_cast< OWeakObject* >( m_pManager ) ); - m_xListener->disposing( com::sun::star::lang::EventObject(xXInterface) ); - m_pHolder->m_bBusy = false; -} - -// ------------------ -// - ScannerManager - -// ------------------ - -void ScannerManager::AcquireData() -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - theSanes::get().acquire(); -} - -void ScannerManager::ReleaseData() -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - theSanes::get().release(); -} - -// ----------------------------------------------------------------------------- - -AWT::Size ScannerManager::getSize() throw() -{ - AWT::Size aRet; - aRet.Width = aRet.Height = 0; - return aRet; -} - -// ----------------------------------------------------------------------------- - -SEQ( sal_Int8 ) ScannerManager::getDIB() throw() -{ - return SEQ( sal_Int8 )(); -} - -// ----------------------------------------------------------------------------- - -SEQ( ScannerContext ) ScannerManager::getAvailableScanners() throw() -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - sanevec &rSanes = theSanes::get().m_aSanes; - - if( rSanes.empty() ) - { - boost::shared_ptr pSaneHolder(new SaneHolder); - if( Sane::IsSane() ) - rSanes.push_back( pSaneHolder ); - } - - if( Sane::IsSane() ) - { - SEQ( ScannerContext ) aRet(1); - aRet.getArray()[0].ScannerName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SANE")); - aRet.getArray()[0].InternalData = 0; - return aRet; - } - - return SEQ( ScannerContext )(); -} - -// ----------------------------------------------------------------------------- - -sal_Bool ScannerManager::configureScanner( ScannerContext& scanner_context ) throw( ScannerException ) -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - sanevec &rSanes = theSanes::get().m_aSanes; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "ScannerManager::configureScanner\n" ); -#endif - - if( scanner_context.InternalData < 0 || (sal_uLong)scanner_context.InternalData >= rSanes.size() ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner does not exist")), - REF( XScannerManager )( this ), - ScanError_InvalidContext - ); - - boost::shared_ptr pHolder = rSanes[scanner_context.InternalData]; - if( pHolder->m_bBusy ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner is busy")), - REF( XScannerManager )( this ), - ScanError_ScanInProgress - ); - - pHolder->m_bBusy = true; - SaneDlg aDlg( NULL, pHolder->m_aSane ); - sal_Bool bRet = (sal_Bool)aDlg.Execute(); - pHolder->m_bBusy = false; - - return bRet; -} - -// ----------------------------------------------------------------------------- - -void ScannerManager::startScan( const ScannerContext& scanner_context, - const REF( com::sun::star::lang::XEventListener )& listener ) throw( ScannerException ) -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - sanevec &rSanes = theSanes::get().m_aSanes; - -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "ScannerManager::startScan\n" ); -#endif - - if( scanner_context.InternalData < 0 || (sal_uLong)scanner_context.InternalData >= rSanes.size() ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner does not exist")), - REF( XScannerManager )( this ), - ScanError_InvalidContext - ); - boost::shared_ptr pHolder = rSanes[scanner_context.InternalData]; - if( pHolder->m_bBusy ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner is busy")), - REF( XScannerManager )( this ), - ScanError_ScanInProgress - ); - pHolder->m_bBusy = true; - - ScannerThread* pThread = new ScannerThread( pHolder, listener, this ); - pThread->create(); -} - -// ----------------------------------------------------------------------------- - -ScanError ScannerManager::getError( const ScannerContext& scanner_context ) throw( ScannerException ) -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - sanevec &rSanes = theSanes::get().m_aSanes; - - if( scanner_context.InternalData < 0 || (sal_uLong)scanner_context.InternalData >= rSanes.size() ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner does not exist")), - REF( XScannerManager )( this ), - ScanError_InvalidContext - ); - - boost::shared_ptr pHolder = rSanes[scanner_context.InternalData]; - - return pHolder->m_nError; -} - -// ----------------------------------------------------------------------------- - -REF( AWT::XBitmap ) ScannerManager::getBitmap( const ScannerContext& scanner_context ) throw( ScannerException ) -{ - osl::MutexGuard aGuard( theSaneProtector::get() ); - sanevec &rSanes = theSanes::get().m_aSanes; - - if( scanner_context.InternalData < 0 || (sal_uLong)scanner_context.InternalData >= rSanes.size() ) - throw ScannerException( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Scanner does not exist")), - REF( XScannerManager )( this ), - ScanError_InvalidContext - ); - boost::shared_ptr pHolder = rSanes[scanner_context.InternalData]; - - osl::MutexGuard aProtGuard( pHolder->m_aProtector ); - - REF( AWT::XBitmap ) xRet( pHolder->m_xBitmap ); - pHolder->m_xBitmap = REF( AWT::XBitmap )(); - - return xRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx deleted file mode 100644 index f8d006f08..000000000 --- a/extensions/source/scanner/scanwin.cxx +++ /dev/null @@ -1,1059 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "scanner.hxx" - -#pragma warning (push,1) -#pragma warning (disable:4668) -#include "twain/twain.h" -#pragma warning (pop) - -using namespace ::com::sun::star; - -// ----------- -// - Defines - -// ----------- - -#define TWAIN_SELECT 0x00000001UL -#define TWAIN_ACQUIRE 0x00000002UL -#define TWAIN_TERMINATE 0xFFFFFFFFUL - -#define TWAIN_EVENT_NONE 0x00000000UL -#define TWAIN_EVENT_QUIT 0x00000001UL -#define TWAIN_EVENT_SCANNING 0x00000002UL -#define TWAIN_EVENT_XFER 0x00000004UL - -#define PFUNC (*pDSM) -#define PTWAINMSG MSG* -#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.) -#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5)) - -#if defined WNT -#define TWAIN_LIBNAME "TWAIN_32.DLL" -#define TWAIN_FUNCNAME "DSM_Entry" -#endif - -// -------------- -// - TwainState - -// -------------- - -enum TwainState -{ - TWAIN_STATE_NONE = 0, - TWAIN_STATE_SCANNING = 1, - TWAIN_STATE_DONE = 2, - TWAIN_STATE_CANCELED = 3 -}; - -// ------------ -// - ImpTwain - -// ------------ - -class ImpTwain : public ::cppu::WeakImplHelper1< util::XCloseListener > -{ - friend LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam ); - - uno::Reference< uno::XInterface > mxSelfRef; - uno::Reference< scanner::XScannerManager > mxMgr; - ScannerManager& mrMgr; - TW_IDENTITY aAppIdent; - TW_IDENTITY aSrcIdent; - Link aNotifyLink; - DSMENTRYPROC pDSM; - osl::Module* pMod; - ULONG nCurState; - HWND hTwainWnd; - HHOOK hTwainHook; - bool mbCloseFrameOnExit; - - bool ImplHandleMsg( void* pMsg ); - void ImplCreate(); - void ImplOpenSourceManager(); - void ImplOpenSource(); - bool ImplEnableSource(); - void ImplXfer(); - void ImplFallback( ULONG nEvent ); - void ImplSendCloseEvent(); - void ImplDeregisterCloseListener(); - void ImplRegisterCloseListener(); - uno::Reference< frame::XFrame > ImplGetActiveFrame(); - uno::Reference< util::XCloseBroadcaster > ImplGetActiveFrameCloseBroadcaster(); - - DECL_LINK( ImplFallbackHdl, void* ); - DECL_LINK( ImplDestroyHdl, void* ); - - // from util::XCloseListener - virtual void SAL_CALL queryClosing( const lang::EventObject& Source, sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException); - virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException); - - // from lang::XEventListener - virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException); - -public: - - ImpTwain( ScannerManager& rMgr, const Link& rNotifyLink ); - ~ImpTwain(); - - void Destroy(); - - bool SelectSource(); - bool InitXfer(); -}; - -// --------- -// - Procs - -// --------- - -static ImpTwain* pImpTwainInstance = NULL; - -// ------------------------------------------------------------------------- - -LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) -{ - return DefWindowProc( hWnd, nMsg, nPar1, nPar2 ); -} - -// ------------------------------------------------------------------------- - -LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) -{ - MSG* pMsg = (MSG*) lParam; - - if( ( nCode < 0 ) || ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) || !pImpTwainInstance->ImplHandleMsg( (void*) lParam ) ) - { - return CallNextHookEx( pImpTwainInstance->hTwainHook, nCode, wParam, lParam ); - } - else - { - pMsg->message = WM_USER; - pMsg->lParam = 0; - - return 0; - } -} - -// ----------------------------------------------------------------------------- - -// #107835# hold reference to ScannerManager, to prevent premature death -ImpTwain::ImpTwain( ScannerManager& rMgr, const Link& rNotifyLink ) : - mrMgr( rMgr ), - mxMgr( uno::Reference< scanner::XScannerManager >( static_cast< OWeakObject* >( &rMgr ), uno::UNO_QUERY) ), - aNotifyLink( rNotifyLink ), - pDSM( NULL ), - pMod( NULL ), - hTwainWnd( 0 ), - hTwainHook( 0 ), - nCurState( 1 ), - mbCloseFrameOnExit( false ) -{ - // setup TWAIN window - pImpTwainInstance = this; - - aAppIdent.Id = 0; - aAppIdent.Version.MajorNum = 1; - aAppIdent.Version.MinorNum = 0; - aAppIdent.Version.Language = TWLG_USA; - aAppIdent.Version.Country = TWCY_USA; - aAppIdent.ProtocolMajor = TWON_PROTOCOLMAJOR; - aAppIdent.ProtocolMinor = TWON_PROTOCOLMINOR; - aAppIdent.SupportedGroups = DG_IMAGE | DG_CONTROL; - strncpy( aAppIdent.Version.Info, "8.0", 32 ); - aAppIdent.Version.Info[32] = aAppIdent.Version.Info[33] = 0; - strncpy( aAppIdent.Manufacturer, "Sun Microsystems", 32 ); - aAppIdent.Manufacturer[32] = aAppIdent.Manufacturer[33] = 0; - strncpy( aAppIdent.ProductFamily,"Office", 32 ); - aAppIdent.ProductFamily[32] = aAppIdent.ProductFamily[33] = 0; - strncpy( aAppIdent.ProductName, "Office", 32 ); - aAppIdent.ProductName[32] = aAppIdent.ProductName[33] = 0; - - WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, "TwainClass" }; - RegisterClass( &aWc ); - - hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, HWND_DESKTOP, NULL, aWc.hInstance, 0 ); - hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, NULL, GetCurrentThreadId() ); - - // block destruction until ImplDestroyHdl is called - mxSelfRef = static_cast< ::cppu::OWeakObject* >( this ); -} - -// ----------------------------------------------------------------------------- - -ImpTwain::~ImpTwain() -{ - // are we responsible for application shutdown? - if( mbCloseFrameOnExit ) - ImplSendCloseEvent(); -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::Destroy() -{ - ImplFallback( TWAIN_EVENT_NONE ); - Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ), NULL ); -} - -// ----------------------------------------------------------------------------- - -bool ImpTwain::SelectSource() -{ - TW_UINT16 nRet = TWRC_FAILURE; - - ImplOpenSourceManager(); - - if( 3 == nCurState ) - { - TW_IDENTITY aIdent; - - aIdent.Id = 0, aIdent.ProductName[ 0 ] = '\0'; - aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING ); - nRet = PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent ); - } - - ImplFallback( TWAIN_EVENT_QUIT ); - - return( TWRC_SUCCESS == nRet ); -} - -// ----------------------------------------------------------------------------- - -bool ImpTwain::InitXfer() -{ - bool bRet = false; - - ImplOpenSourceManager(); - - if( 3 == nCurState ) - { - ImplOpenSource(); - - if( 4 == nCurState ) - bRet = ImplEnableSource(); - } - - if( !bRet ) - ImplFallback( TWAIN_EVENT_QUIT ); - - return bRet; -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplOpenSourceManager() -{ - if( 1 == nCurState ) - { - pMod = new ::osl::Module( ::rtl::OUString() ); - - if( pMod->load( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( TWAIN_LIBNAME ) ) ) ) - { - nCurState = 2; - - if( ( ( pDSM = (DSMENTRYPROC) pMod->getSymbol( String( RTL_CONSTASCII_USTRINGPARAM( TWAIN_FUNCNAME ) ) ) ) != NULL ) && - ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) ) - { - nCurState = 3; - } - } - else - { - delete pMod; - pMod = NULL; - } - } -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplOpenSource() -{ - if( 3 == nCurState ) - { - if( ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) && - ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) ) - { - TW_CAPABILITY aCap = { CAP_XFERCOUNT, TWON_ONEVALUE, GlobalAlloc( GHND, sizeof( TW_ONEVALUE ) ) }; - TW_ONEVALUE* pVal = (TW_ONEVALUE*) GlobalLock( aCap.hContainer ); - - pVal->ItemType = TWTY_INT16, pVal->Item = 1; - GlobalUnlock( aCap.hContainer ); - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &aCap ); - GlobalFree( aCap.hContainer ); - nCurState = 4; - } - } -} - -// ----------------------------------------------------------------------------- - -bool ImpTwain::ImplEnableSource() -{ - bool bRet = false; - - if( 4 == nCurState ) - { - TW_USERINTERFACE aUI = { true, true, hTwainWnd }; - - aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING ); - nCurState = 5; - - // register as vetoable close listener, to prevent application to die under us - ImplRegisterCloseListener(); - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDS, &aUI ) == TWRC_SUCCESS ) - { - bRet = true; - } - else - { - nCurState = 4; - - // deregister as vetoable close listener, dialog failed - ImplDeregisterCloseListener(); - } - } - - return bRet; -} - -// ----------------------------------------------------------------------------- - -bool ImpTwain::ImplHandleMsg( void* pMsg ) -{ - TW_UINT16 nRet; - PTWAINMSG pMess = (PTWAINMSG) pMsg; - TW_EVENT aEvt = { pMess, MSG_NULL }; - - nRet = PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &aEvt ); - - if( aEvt.TWMessage != MSG_NULL ) - { - switch( aEvt.TWMessage ) - { - case MSG_XFERREADY: - { - ULONG nEvent = TWAIN_EVENT_QUIT; - - if( 5 == nCurState ) - { - nCurState = 6; - ImplXfer(); - - if( mrMgr.GetData() ) - nEvent = TWAIN_EVENT_XFER; - } - - ImplFallback( nEvent ); - } - break; - - case MSG_CLOSEDSREQ: - ImplFallback( TWAIN_EVENT_QUIT ); - break; - - default: - break; - } - } - else - nRet = TWRC_NOTDSEVENT; - - return( TWRC_DSEVENT == nRet ); -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplXfer() -{ - if( nCurState == 6 ) - { - TW_IMAGEINFO aInfo; - TW_UINT32 hDIB = 0; - long nWidth, nHeight, nXRes, nYRes; - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo ) == TWRC_SUCCESS ) - { - nWidth = aInfo.ImageWidth; - nHeight = aInfo.ImageLength; - nXRes = FIXTOLONG( aInfo.XResolution ); - nYRes = FIXTOLONG( aInfo.YResolution ); - } - else - nWidth = nHeight = nXRes = nYRes = -1L; - - switch( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDIB ) ) - { - case( TWRC_CANCEL ): - nCurState = 7; - break; - - case( TWRC_XFERDONE ): - { - if( hDIB ) - { - if( ( nXRes != -1 ) && ( nYRes != - 1 ) && ( nWidth != - 1 ) && ( nHeight != - 1 ) ) - { - // set resolution of bitmap - BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( (HGLOBAL) hDIB ); - static const double fFactor = 100.0 / 2.54; - - pBIH->biXPelsPerMeter = FRound( fFactor * nXRes ); - pBIH->biYPelsPerMeter = FRound( fFactor * nYRes ); - - GlobalUnlock( (HGLOBAL) hDIB ); - } - - mrMgr.SetData( (void*)(long) hDIB ); - } - else - GlobalFree( (HGLOBAL) hDIB ); - - nCurState = 7; - } - break; - - default: - break; - } - } -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplFallback( ULONG nEvent ) -{ - Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), (void*) nEvent ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData ) -{ - const ULONG nEvent = (ULONG) pData; - bool bFallback = true; - - switch( nCurState ) - { - case( 7 ): - case( 6 ): - { - TW_PENDINGXFERS aXfers; - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_ENDXFER, &aXfers ) == TWRC_SUCCESS ) - { - if( aXfers.Count != 0 ) - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_RESET, &aXfers ); - } - - nCurState = 5; - } - break; - - case( 5 ): - { - TW_USERINTERFACE aUI = { true, true, hTwainWnd }; - - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, &aUI ); - nCurState = 4; - - // deregister as vetoable close listener - ImplDeregisterCloseListener(); - } - break; - - case( 4 ): - { - PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent ); - nCurState = 3; - } - break; - - case( 3 ): - { - PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd ); - nCurState = 2; - } - break; - - case( 2 ): - { - delete pMod; - pMod = NULL; - nCurState = 1; - } - break; - - default: - { - if( nEvent != TWAIN_EVENT_NONE ) - aNotifyLink.Call( (void*) nEvent ); - - bFallback = false; - } - break; - } - - if( bFallback ) - ImplFallback( nEvent ); - - return 0L; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( ImpTwain, ImplDestroyHdl, void*, /*p*/ ) -{ - if( hTwainWnd ) - DestroyWindow( hTwainWnd ); - - if( hTwainHook ) - UnhookWindowsHookEx( hTwainHook ); - - // permit destruction of ourselves (normally, refcount - // should drop to zero exactly here) - mxSelfRef = NULL; - pImpTwainInstance = NULL; - - return 0L; -} - -// ----------------------------------------------------------------------------- - -uno::Reference< frame::XFrame > ImpTwain::ImplGetActiveFrame() -{ - try - { - uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - - if( xMgr.is() ) - { - // query desktop instance - uno::Reference< frame::XDesktop > xDesktop( xMgr->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY ); - - if( xDesktop.is() ) - { - // query property set from desktop, which contains the currently active frame - uno::Reference< beans::XPropertySet > xDesktopProps( xDesktop, uno::UNO_QUERY ); - - if( xDesktopProps.is() ) - { - uno::Any aActiveFrame; - - try - { - aActiveFrame = xDesktopProps->getPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveFrame")) ); - } - catch( const beans::UnknownPropertyException& ) - { - // property unknown. - OSL_FAIL("ImpTwain::ImplGetActiveFrame: ActiveFrame property unknown, cannot determine active frame!"); - return uno::Reference< frame::XFrame >(); - } - - uno::Reference< frame::XFrame > xActiveFrame; - - if( (aActiveFrame >>= xActiveFrame) && - xActiveFrame.is() ) - { - return xActiveFrame; - } - } - } - } - } - catch( const uno::Exception& ) - { - } - - OSL_FAIL("ImpTwain::ImplGetActiveFrame: Could not determine active frame!"); - return uno::Reference< frame::XFrame >(); -} - -// ----------------------------------------------------------------------------- - -uno::Reference< util::XCloseBroadcaster > ImpTwain::ImplGetActiveFrameCloseBroadcaster() -{ - try - { - return uno::Reference< util::XCloseBroadcaster >( ImplGetActiveFrame(), uno::UNO_QUERY ); - } - catch( const uno::Exception& ) - { - } - - OSL_FAIL("ImpTwain::ImplGetActiveFrameCloseBroadcaster: Could determine close broadcaster on active frame!"); - return uno::Reference< util::XCloseBroadcaster >(); -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplRegisterCloseListener() -{ - try - { - uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( ImplGetActiveFrameCloseBroadcaster() ); - - if( xCloseBroadcaster.is() ) - { - xCloseBroadcaster->addCloseListener(this); - return; // successfully registered as a close listener - } - else - { - // interface unknown. don't register, then - OSL_FAIL("ImpTwain::ImplRegisterCloseListener: XFrame has no XCloseBroadcaster!"); - return; - } - } - catch( const uno::Exception& ) - { - } - - OSL_FAIL("ImpTwain::ImplRegisterCloseListener: Could not register as close listener!"); -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplDeregisterCloseListener() -{ - try - { - uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( - ImplGetActiveFrameCloseBroadcaster() ); - - if( xCloseBroadcaster.is() ) - { - xCloseBroadcaster->removeCloseListener(this); - return; // successfully deregistered as a close listener - } - else - { - // interface unknown. don't deregister, then - OSL_FAIL("ImpTwain::ImplDeregisterCloseListener: XFrame has no XCloseBroadcaster!"); - return; - } - } - catch( const uno::Exception& ) - { - } - - OSL_FAIL("ImpTwain::ImplDeregisterCloseListener: Could not deregister as close listener!"); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ImpTwain::queryClosing( const lang::EventObject& /*Source*/, sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException) -{ - // shall we re-send the close query later on? - mbCloseFrameOnExit = GetsOwnership; - - // the sole purpose of this listener is to forbid closing of the listened-at frame - throw util::CloseVetoException(); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ImpTwain::notifyClosing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) -{ - // should not happen - OSL_FAIL("ImpTwain::notifyClosing called, but we vetoed the closing before!"); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ImpTwain::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) -{ - // we're not holding any references to the frame, thus noop -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplSendCloseEvent() -{ - try - { - uno::Reference< util::XCloseable > xCloseable( ImplGetActiveFrame(), uno::UNO_QUERY ); - - if( xCloseable.is() ) - xCloseable->close( true ); - } - catch( const uno::Exception& ) - { - } - - OSL_FAIL("ImpTwain::ImplSendCloseEvent: Could not send required close broadcast!"); -} - - -// --------- -// - Twain - -// --------- - -class Twain -{ - uno::Reference< lang::XEventListener > mxListener; - uno::Reference< scanner::XScannerManager > mxMgr; - const ScannerManager* mpCurMgr; - ImpTwain* mpImpTwain; - TwainState meState; - - DECL_LINK( ImpNotifyHdl, ImpTwain* ); - -public: - - Twain(); - ~Twain(); - - bool SelectSource( ScannerManager& rMgr ); - bool PerformTransfer( ScannerManager& rMgr, const uno::Reference< lang::XEventListener >& rxListener ); - - TwainState GetState() const { return meState; } -}; - -// ------------------------------------------------------------------------ - -Twain::Twain() : - mpCurMgr( NULL ), - mpImpTwain( NULL ), - meState( TWAIN_STATE_NONE ) -{ -} - -// ------------------------------------------------------------------------ - -Twain::~Twain() -{ - if( mpImpTwain ) - mpImpTwain->Destroy(); -} - -// ------------------------------------------------------------------------ - -bool Twain::SelectSource( ScannerManager& rMgr ) -{ - bool bRet; - - if( !mpImpTwain ) - { - // hold reference to ScannerManager, to prevent premature death - mxMgr = uno::Reference< scanner::XScannerManager >( static_cast< OWeakObject* >( const_cast< ScannerManager* >( mpCurMgr = &rMgr ) ), - uno::UNO_QUERY ), - - meState = TWAIN_STATE_NONE; - mpImpTwain = new ImpTwain( rMgr, LINK( this, Twain, ImpNotifyHdl ) ); - bRet = mpImpTwain->SelectSource(); - } - else - bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------ - -bool Twain::PerformTransfer( ScannerManager& rMgr, const uno::Reference< lang::XEventListener >& rxListener ) -{ - bool bRet; - - if( !mpImpTwain ) - { - // hold reference to ScannerManager, to prevent premature death - mxMgr = uno::Reference< scanner::XScannerManager >( static_cast< OWeakObject* >( const_cast< ScannerManager* >( mpCurMgr = &rMgr ) ), - uno::UNO_QUERY ), - - mxListener = rxListener; - meState = TWAIN_STATE_NONE; - mpImpTwain = new ImpTwain( rMgr, LINK( this, Twain, ImpNotifyHdl ) ); - bRet = mpImpTwain->InitXfer(); - } - else - bRet = false; - - return bRet; -} - -// ------------------------------------------------------------------------ - -IMPL_LINK( Twain, ImpNotifyHdl, ImpTwain*, nEvent ) -{ - switch( (ULONG)(void*) nEvent ) - { - case( TWAIN_EVENT_SCANNING ): - meState = TWAIN_STATE_SCANNING; - break; - - case( TWAIN_EVENT_QUIT ): - { - if( meState != TWAIN_STATE_DONE ) - meState = TWAIN_STATE_CANCELED; - - if( mpImpTwain ) - { - mpImpTwain->Destroy(); - mpImpTwain = NULL; - mpCurMgr = NULL; - } - - if( mxListener.is() ) - mxListener->disposing( lang::EventObject( mxMgr ) ); - - mxListener = NULL; - } - break; - - case( TWAIN_EVENT_XFER ): - { - if( mpImpTwain ) - { - meState = ( mpCurMgr->GetData() ? TWAIN_STATE_DONE : TWAIN_STATE_CANCELED ); - - mpImpTwain->Destroy(); - mpImpTwain = NULL; - mpCurMgr = NULL; - - if( mxListener.is() ) - mxListener->disposing( lang::EventObject( mxMgr ) ); - } - - mxListener = NULL; - } - break; - - default: - break; - } - - return 0L; -} - -// ----------- -// - statics - -// ----------- - -static Twain aTwain; - -// ------------------ -// - ScannerManager - -// ------------------ - -void ScannerManager::AcquireData() -{ -} - -void ScannerManager::ReleaseData() -{ - if( mpData ) - { - GlobalFree( (HGLOBAL)(long) mpData ); - mpData = NULL; - } -} - -// ----------------------------------------------------------------------------- - -AWT::Size ScannerManager::getSize() throw() -{ - AWT::Size aRet; - HGLOBAL hDIB = (HGLOBAL)(long) mpData; - - if( hDIB ) - { - BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB ); - - if( pBIH ) - { - aRet.Width = pBIH->biWidth; - aRet.Height = pBIH->biHeight; - } - else - aRet.Width = aRet.Height = 0; - - GlobalUnlock( hDIB ); - } - else - aRet.Width = aRet.Height = 0; - - return aRet; -} - -// ----------------------------------------------------------------------------- - -SEQ( sal_Int8 ) ScannerManager::getDIB() throw() -{ - SEQ( sal_Int8 ) aRet; - - if( mpData ) - { - HGLOBAL hDIB = (HGLOBAL)(long) mpData; - const sal_uInt32 nDIBSize = GlobalSize( hDIB ); - BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB ); - - if( pBIH ) - { - sal_uInt32 nColEntries; - - switch( pBIH->biBitCount ) - { - case( 1 ): - case( 4 ): - case( 8 ): - nColEntries = pBIH->biClrUsed ? pBIH->biClrUsed : ( 1 << pBIH->biBitCount ); - break; - - case( 24 ): - nColEntries = pBIH->biClrUsed ? pBIH->biClrUsed : 0; - break; - - case( 16 ): - case( 32 ): - { - nColEntries = pBIH->biClrUsed; - - if( pBIH->biCompression == BI_BITFIELDS ) - nColEntries += 3; - } - break; - - default: - nColEntries = 0; - break; - } - - aRet = SEQ( sal_Int8 )( sizeof( BITMAPFILEHEADER ) + nDIBSize ); - - sal_Int8* pBuf = aRet.getArray(); - SvMemoryStream* pMemStm = new SvMemoryStream( (char*) pBuf, sizeof( BITMAPFILEHEADER ), STREAM_WRITE ); - - *pMemStm << 'B' << 'M' << (sal_uInt32) 0 << (sal_uInt32) 0; - *pMemStm << (sal_uInt32) ( sizeof( BITMAPFILEHEADER ) + pBIH->biSize + ( nColEntries * sizeof( RGBQUAD ) ) ); - - delete pMemStm; - memcpy( pBuf + sizeof( BITMAPFILEHEADER ), pBIH, nDIBSize ); - } - - GlobalUnlock( hDIB ); - ReleaseData(); - } - - return aRet; -} - -// ----------------------------------------------------------------------------- - -SEQ( ScannerContext ) SAL_CALL ScannerManager::getAvailableScanners() throw() -{ - osl::MutexGuard aGuard( maProtector ); - SEQ( ScannerContext ) aRet( 1 ); - - aRet.getArray()[0].ScannerName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ); - aRet.getArray()[0].InternalData = 0; - - return aRet; -} - -// ----------------------------------------------------------------------------- - -sal_Bool SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext ) - throw( ScannerException ) -{ - osl::MutexGuard aGuard( maProtector ); - uno::Reference< XScannerManager > xThis( this ); - - if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) ) - throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext ); - - ReleaseData(); - - return aTwain.SelectSource( *this ); -} - -// ----------------------------------------------------------------------------- - -void SAL_CALL ScannerManager::startScan( const ScannerContext& rContext, const uno::Reference< lang::XEventListener >& rxListener ) - throw( ScannerException ) -{ - osl::MutexGuard aGuard( maProtector ); - uno::Reference< XScannerManager > xThis( this ); - - if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) ) - throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext ); - - ReleaseData(); - aTwain.PerformTransfer( *this, rxListener ); -} - -// ----------------------------------------------------------------------------- - -ScanError SAL_CALL ScannerManager::getError( const ScannerContext& rContext ) - throw( ScannerException ) -{ - osl::MutexGuard aGuard( maProtector ); - uno::Reference< XScannerManager > xThis( this ); - - if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) ) - throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext ); - - return( ( aTwain.GetState() == TWAIN_STATE_CANCELED ) ? ScanError_ScanCanceled : ScanError_ScanErrorNone ); -} - -// ----------------------------------------------------------------------------- - -uno::Reference< awt::XBitmap > SAL_CALL ScannerManager::getBitmap( const ScannerContext& /*rContext*/ ) - throw( ScannerException ) -{ - osl::MutexGuard aGuard( maProtector ); - return uno::Reference< awt::XBitmap >( this ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/scn.component b/extensions/source/scanner/scn.component deleted file mode 100644 index d7daf3ae3..000000000 --- a/extensions/source/scanner/scn.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/scanner/scnserv.cxx b/extensions/source/scanner/scnserv.cxx deleted file mode 100644 index ad74c1561..000000000 --- a/extensions/source/scanner/scnserv.cxx +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include "scanner.hxx" - -#include - -using namespace com::sun::star::registry; - - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ ) -{ - REF( ::com::sun::star::lang::XSingleServiceFactory ) xFactory; - void* pRet = 0; - - if( ::rtl::OUString::createFromAscii( pImplName ) == ScannerManager::getImplementationName_Static() ) - { - xFactory = REF( ::com::sun::star::lang::XSingleServiceFactory )( ::cppu::createSingleFactory( - static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ), - ScannerManager::getImplementationName_Static(), - ScannerManager_CreateInstance, - ScannerManager::getSupportedServiceNames_Static() ) ); - } - - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/twain.cxx b/extensions/source/scanner/twain.cxx deleted file mode 100644 index 9f41919eb..000000000 --- a/extensions/source/scanner/twain.cxx +++ /dev/null @@ -1,480 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include - -#if defined( WNT ) -#include -#endif -#include -#include -#include -#include -#include -#include "twain.hxx" - -// ----------- -// - Defines - -// ----------- - -#define PFUNC (*pDSM) -#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.) -#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5)) - -#if defined WNT -#define TWAIN_LIBNAME "TWAIN_32.DLL" -#define TWAIN_FUNCNAME "DSM_Entry" -#endif - -// ----------- -// - Statics - -// ----------- - -static ImpTwain* pImpTwainInstance = NULL; - -// --------- -// - Procs - -// --------- - - #define PTWAINMSG MSG* - - // ------------------------------------------------------------------------- - - LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) - { - return DefWindowProc( hWnd, nMsg, nPar1, nPar2 ); - } - - // ------------------------------------------------------------------------- - - LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) - { - MSG* pMsg = (MSG*) lParam; - - if( ( nCode < 0 ) || - ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) || - !pImpTwainInstance->ImplHandleMsg( (void*) lParam ) ) - { - return CallNextHookEx( pImpTwainInstance->hTwainHook, nCode, wParam, lParam ); - } - else - { - pMsg->message = WM_USER; - pMsg->lParam = 0; - - return 0; - } - } - -// ------------ -// - ImpTwain - -// ------------ - -ImpTwain::ImpTwain( const Link& rNotifyLink ) : - aNotifyLink ( rNotifyLink ), - pDSM ( NULL ), - pMod ( NULL ), - hTwainWnd ( 0 ), - hTwainHook ( 0 ), - nCurState ( 1 ) -{ - pImpTwainInstance = this; - - aAppIdent.Id = 0; - aAppIdent.Version.MajorNum = 1; - aAppIdent.Version.MinorNum = 0; - aAppIdent.Version.Language = TWLG_USA; - aAppIdent.Version.Country = TWCY_USA; - aAppIdent.ProtocolMajor = TWON_PROTOCOLMAJOR; - aAppIdent.ProtocolMinor = TWON_PROTOCOLMINOR; - aAppIdent.SupportedGroups = DG_IMAGE | DG_CONTROL; - strcpy( aAppIdent.Version.Info, "6.0" ); - strcpy( aAppIdent.Manufacturer, "Sun Microsystems"); - strcpy( aAppIdent.ProductFamily,"Office"); - strcpy( aAppIdent.ProductName, "Office"); - - HWND hParentWnd = HWND_DESKTOP; - WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( NULL ), - NULL, NULL, NULL, NULL, "TwainClass" }; - - RegisterClass( &aWc ); - hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, hParentWnd, NULL, aWc.hInstance, 0 ); - hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, NULL, GetCurrentThreadId() ); -} - -// ----------------------------------------------------------------------------- - -ImpTwain::~ImpTwain() -{ -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::Destroy() -{ - ImplFallback( TWAIN_EVENT_NONE ); - Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ), NULL ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool ImpTwain::SelectSource() -{ - TW_UINT16 nRet = TWRC_FAILURE; - - if( !!aBitmap ) - aBitmap = Bitmap(); - - ImplOpenSourceManager(); - - if( 3 == nCurState ) - { - TW_IDENTITY aIdent; - - aIdent.Id = 0, aIdent.ProductName[ 0 ] = '\0'; - aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING ); - nRet = PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent ); - } - - ImplFallback( TWAIN_EVENT_QUIT ); - - return( nRet == TWRC_SUCCESS || nRet == TWRC_CANCEL ); -} - -// ----------------------------------------------------------------------------- - -sal_Bool ImpTwain::InitXfer() -{ - sal_Bool bRet = sal_False; - - if( !!aBitmap ) - aBitmap = Bitmap(); - - ImplOpenSourceManager(); - - if( 3 == nCurState ) - { - ImplOpenSource(); - - if( 4 == nCurState ) - bRet = ImplEnableSource(); - } - - if( !bRet ) - ImplFallback( TWAIN_EVENT_QUIT ); - - return bRet; -} - -// ----------------------------------------------------------------------------- - -Bitmap ImpTwain::GetXferBitmap() -{ - Bitmap aRet( aBitmap ); - aBitmap = Bitmap(); - return aRet; -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplOpenSourceManager() -{ - if( 1 == nCurState ) - { - pMod = new osl::Module(); - - if( pMod->load( TWAIN_LIBNAME ) ) - { - nCurState = 2; - - if( ( ( pDSM = (DSMENTRYPROC) pMod->getSymbol( TWAIN_FUNCNAME ) ) != NULL ) && - ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) ) - { - nCurState = 3; - } - } - else - { - delete pMod; - pMod = NULL; - } - } -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplOpenSource() -{ - if( 3 == nCurState ) - { - if( ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) && - ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) ) - { - - TW_CAPABILITY aCap = { CAP_XFERCOUNT, TWON_ONEVALUE, GlobalAlloc( GHND, sizeof( TW_ONEVALUE ) ) }; - TW_ONEVALUE* pVal = (TW_ONEVALUE*) GlobalLock( aCap.hContainer ); - - pVal->ItemType = TWTY_INT16, pVal->Item = 1; - GlobalUnlock( aCap.hContainer ); - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &aCap ); - GlobalFree( aCap.hContainer ); - - nCurState = 4; - } - } -} - -// ----------------------------------------------------------------------------- - -BOOL ImpTwain::ImplEnableSource() -{ - BOOL bRet = FALSE; - - if( 4 == nCurState ) - { - TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd }; - - aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING ); - nCurState = 5; - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDS, &aUI ) == TWRC_SUCCESS ) - bRet = TRUE; - else - nCurState = 4; - } - - return bRet; -} - -// ----------------------------------------------------------------------------- - -BOOL ImpTwain::ImplHandleMsg( void* pMsg ) -{ - TW_UINT16 nRet; - PTWAINMSG pMess = (PTWAINMSG) pMsg; - TW_EVENT aEvt = { pMess, MSG_NULL }; - - nRet = PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &aEvt ); - - if( aEvt.TWMessage != MSG_NULL ) - { - switch( aEvt.TWMessage ) - { - case MSG_XFERREADY: - { - ULONG nEvent = TWAIN_EVENT_QUIT; - - if( 5 == nCurState ) - { - nCurState = 6; - ImplXfer(); - - if( !!aBitmap ) - nEvent = TWAIN_EVENT_XFER; - } - - ImplFallback( nEvent ); - } - break; - - case MSG_CLOSEDSREQ: - ImplFallback( TWAIN_EVENT_QUIT ); - break; - - default: - break; - } - } - else - nRet = TWRC_NOTDSEVENT; - - return( TWRC_DSEVENT == nRet ); -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplXfer() -{ - if( nCurState == 6 ) - { - TW_IMAGEINFO aInfo; - TW_UINT32 hDIB = 0; - long nWidth = aInfo.ImageWidth; - long nHeight = aInfo.ImageLength; - long nXRes = FIXTOLONG( aInfo.XResolution ); - long nYRes = FIXTOLONG( aInfo.YResolution ); - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo ) == TWRC_SUCCESS ) - { - nWidth = aInfo.ImageWidth; - nHeight = aInfo.ImageLength; - nXRes = FIXTOLONG( aInfo.XResolution ); - nYRes = FIXTOLONG( aInfo.YResolution ); - } - else - nWidth = nHeight = nXRes = nYRes = -1L; - - switch( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDIB ) ) - { - case( TWRC_CANCEL ): - nCurState = 7; - break; - - case( TWRC_XFERDONE ): - { - const ULONG nSize = GlobalSize( (HGLOBAL) hDIB ); - char* pBuf = (char*) GlobalLock( (HGLOBAL) hDIB ); - - if( pBuf ) - { - SvMemoryStream aMemStm; - aMemStm.SetBuffer( pBuf, nSize, FALSE, nSize ); - aBitmap.Read( aMemStm, FALSE ); - GlobalUnlock( (HGLOBAL) hDIB ); - } - - GlobalFree( (HGLOBAL) hDIB ); - - // set resolution of bitmap if neccessary - if ( ( nXRes != -1 ) && ( nYRes != - 1 ) && ( nWidth != - 1 ) && ( nHeight != - 1 ) ) - { - const MapMode aMapMode( MAP_100TH_INCH, Point(), Fraction( 100, nXRes ), Fraction( 100, nYRes ) ); - aBitmap.SetPrefMapMode( aMapMode ); - aBitmap.SetPrefSize( Size( nWidth, nHeight ) ); - } - - nCurState = 7; - } - break; - - default: - break; - } - } -} - -// ----------------------------------------------------------------------------- - -void ImpTwain::ImplFallback( ULONG nEvent ) -{ - Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), (void*) nEvent ); -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData ) -{ - const ULONG nEvent = (ULONG) pData; - sal_Bool bFallback = sal_True; - - switch( nCurState ) - { - case( 7 ): - case( 6 ): - { - TW_PENDINGXFERS aXfers; - - if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_ENDXFER, &aXfers ) == TWRC_SUCCESS ) - { - if( aXfers.Count != 0 ) - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_RESET, &aXfers ); - } - - nCurState = 5; - } - break; - - case( 5 ): - { - TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd }; - - PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, &aUI ); - nCurState = 4; - } - break; - - case( 4 ): - { - PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent ); - nCurState = 3; - } - break; - - case( 3 ): - { - PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd ); - nCurState = 2; - } - break; - - case( 2 ): - { - delete pMod; - pMod = NULL; - nCurState = 1; - } - break; - - default: - { - if( nEvent != TWAIN_EVENT_NONE ) - aNotifyLink.Call( (void*) nEvent ); - - bFallback = sal_False; - } - break; - } - - if( bFallback ) - ImplFallback( nEvent ); - - return 0L; -} - -// ----------------------------------------------------------------------------- - -IMPL_LINK( ImpTwain, ImplDestroyHdl, void*, p ) -{ - - if( hTwainWnd ) - DestroyWindow( hTwainWnd ); - - if( hTwainHook ) - UnhookWindowsHookEx( hTwainHook ); - - delete this; - pImpTwainInstance = NULL; - - return 0L; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/scanner/twain.hxx b/extensions/source/scanner/twain.hxx deleted file mode 100644 index 031a38514..000000000 --- a/extensions/source/scanner/twain.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _TWAIN_HXX -#define _TWAIN_HXX - -#include -#include -#include "twain/twain.h" - - -// ----------- -// - Defines - -// ----------- - -#define TWAIN_SELECT 0x00000001UL -#define TWAIN_ACQUIRE 0x00000002UL -#define TWAIN_TERMINATE 0xFFFFFFFFUL - -#define TWAIN_EVENT_NONE 0x00000000UL -#define TWAIN_EVENT_QUIT 0x00000001UL -#define TWAIN_EVENT_SCANNING 0x00000002UL -#define TWAIN_EVENT_XFER 0x00000004UL - -// ------------ -// - ImpTwain - -// ------------ - -class ImpTwain -{ - TW_IDENTITY aAppIdent; - TW_IDENTITY aSrcIdent; - Link aNotifyLink; - Bitmap aBitmap; - DSMENTRYPROC pDSM; - osl::Module pMod; - sal_uLong nCurState; - - void ImplCreate(); - void ImplOpenSourceManager(); - void ImplOpenSource(); - sal_Bool ImplEnableSource(); - void ImplXfer(); - void ImplFallback( sal_uLong nEvent ); - - DECL_LINK( ImplFallbackHdl, void* ); - DECL_LINK( ImplDestroyHdl, void* ); - -public: - - sal_Bool ImplHandleMsg( void* pMsg ); - - HWND hTwainWnd; - HHOOK hTwainHook; - -public: - - ImpTwain( const Link& rNotifyLink ); - ~ImpTwain(); - - void Destroy(); - - sal_Bool SelectSource(); - sal_Bool InitXfer(); - Bitmap GetXferBitmap(); -}; - -#endif // _TWAIN_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/unoactivex/main/initwindowpeer.cxx b/extensions/source/unoactivex/main/initwindowpeer.cxx deleted file mode 100644 index 195f5811e..000000000 --- a/extensions/source/unoactivex/main/initwindowpeer.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "initwindowpeer.hxx" - -using namespace ::com::sun::star; - - -uno::Any SAL_CALL InitWindowPeer::getWindowHandle( const uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) - throw ( uno::RuntimeException ) -{ - uno::Any aRes; - sal_Int32 nHwnd = (sal_Int32)m_hwnd; - aRes <<= nHwnd; - return aRes; -} - - -uno::Reference< awt::XToolkit > SAL_CALL InitWindowPeer::getToolkit() - throw ( uno::RuntimeException ) -{ - return uno::Reference< awt::XToolkit >(); -} - -void SAL_CALL InitWindowPeer::setPointer( const uno::Reference< awt::XPointer >& Pointer ) - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::setBackground( sal_Int32 Color ) - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::invalidate( sal_Int16 Flags ) - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::invalidateRect( const awt::Rectangle& Rect, sal_Int16 Flags ) - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::dispose() - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) - throw ( uno::RuntimeException ) -{ -} - -void SAL_CALL InitWindowPeer::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) - throw ( uno::RuntimeException ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/Addons.xcu b/extensions/source/update/check/Addons.xcu deleted file mode 100644 index 8794ce858..000000000 --- a/extensions/source/update/check/Addons.xcu +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - vnd.sun.star.job:alias=UpdateCheck - - - - - - Check for ~Updates... - - - _self - - - - - - - - - diff --git a/extensions/source/update/check/Jobs.xcu b/extensions/source/update/check/Jobs.xcu deleted file mode 100644 index 840d63069..000000000 --- a/extensions/source/update/check/Jobs.xcu +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - com.sun.star.setup.UpdateCheck - - - - true - - - 0 - - - 604800 - - - - - - false - - - true - - - false - - - - - - - - - - - - - diff --git a/extensions/source/update/check/actionlistener.hxx b/extensions/source/update/check/actionlistener.hxx deleted file mode 100644 index e5df3dd5a..000000000 --- a/extensions/source/update/check/actionlistener.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_ACTION_LISTENER_HXX -#define INCLUDED_ACTION_LISTENER_HXX - -#include - -class IActionListener : public rtl::IReference -{ - public: - - virtual void cancel() = 0; - virtual void download() = 0; - virtual void install() = 0; - virtual void pause() = 0; - virtual void resume() = 0; - virtual void closeAfterFailure() = 0; -}; - -#endif //INCLUDED_ACTION_LISTENER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx deleted file mode 100644 index ff1905be1..000000000 --- a/extensions/source/update/check/download.cxx +++ /dev/null @@ -1,463 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#if defined WNT -#ifdef _MSC_VER -#pragma warning(push, 1) /* disable warnings within system headers */ -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#else -#include -#endif -#include -#include -#include - -#include "download.hxx" - -namespace beans = com::sun::star::beans ; -namespace container = com::sun::star::container ; -namespace lang = com::sun::star::lang ; -namespace uno = com::sun::star::uno ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - - -struct OutData -{ - rtl::Reference< DownloadInteractionHandler >Handler; - rtl::OUString File; - rtl::OUString DestinationDir; - oslFileHandle FileHandle; - sal_uInt64 Offset; - osl::Condition& StopCondition; - CURL *curl; - - OutData(osl::Condition& rCondition) : FileHandle(NULL), Offset(0), StopCondition(rCondition), curl(NULL) {}; -}; - -//------------------------------------------------------------------------------ - -static void openFile( OutData& out ) -{ - char * effective_url; - curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, &effective_url); - - double fDownloadSize; - curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize); - - rtl::OString aURL(effective_url); - - // ensure no trailing '/' - sal_Int32 nLen = aURL.getLength(); - while( (nLen > 0) && ('/' == aURL[nLen-1]) ) - aURL = aURL.copy(0, --nLen); - - // extract file name last '/' - sal_Int32 nIndex = aURL.lastIndexOf('/'); - if( nIndex > 0 ) - { - out.File = out.DestinationDir + rtl::OStringToOUString(aURL.copy(nIndex), RTL_TEXTENCODING_UTF8); - - oslFileError rc; - - // Give the user an overwrite warning if the target file exists - const sal_Int32 openFlags = osl_File_OpenFlag_Write | osl_File_OpenFlag_Create; - do - { - rc = osl_openFile(out.File.pData, &out.FileHandle, openFlags); - - if( osl_File_E_EXIST == rc && ! out.Handler->downloadTargetExists(out.File) ) - { - out.StopCondition.set(); - break; - } - - } while( osl_File_E_EXIST == rc ); - - if( osl_File_E_None == rc ) - out.Handler->downloadStarted(out.File, (sal_Int64) fDownloadSize); - } -} - -//------------------------------------------------------------------------------ - -static inline rtl::OString -getStringValue(const uno::Reference< container::XNameAccess >& xNameAccess, const rtl::OUString& aName) -{ - rtl::OString aRet; - - OSL_ASSERT(xNameAccess->hasByName(aName)); - uno::Any aValue = xNameAccess->getByName(aName); - - return rtl::OUStringToOString(aValue.get(), RTL_TEXTENCODING_UTF8); -} - -//------------------------------------------------------------------------------ - -static inline sal_Int32 -getInt32Value(const uno::Reference< container::XNameAccess >& xNameAccess, - const rtl::OUString& aName, sal_Int32 nDefault=-1) -{ - OSL_ASSERT(xNameAccess->hasByName(aName)); - uno::Any aValue = xNameAccess->getByName(aName); - - sal_Int32 n=nDefault; - aValue >>= n; - return n; -} - -//------------------------------------------------------------------------------ - -static size_t -write_function( void *ptr, size_t size, size_t nmemb, void *stream ) -{ - OutData *out = reinterpret_cast < OutData * > (stream); - - if( NULL == out->FileHandle ) - openFile(*out); - - sal_uInt64 nBytesWritten = 0; - - if( NULL != out->FileHandle ) - osl_writeFile(out->FileHandle, ptr, size * nmemb, &nBytesWritten); - - return (size_t) nBytesWritten; -} - -//------------------------------------------------------------------------------ - -static int -progress_callback( void *clientp, double dltotal, double dlnow, double ultotal, double ulnow ) -{ - (void) ultotal; - (void) ulnow; - - OutData *out = reinterpret_cast < OutData * > (clientp); - - OSL_ASSERT( out ); - - if( ! out->StopCondition.check() ) - { - double fPercent = 0; - if ( dltotal + out->Offset ) - fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset); - if( fPercent < 0 ) - fPercent = 0; - - // Do not report progress for redirection replies - long nCode; - curl_easy_getinfo(out->curl, CURLINFO_RESPONSE_CODE, &nCode); - if( (nCode != 302) && (nCode != 303) && (dltotal > 0) ) - out->Handler->downloadProgressAt((sal_Int8)fPercent); - - return 0; - } - - // If stop condition is set, return non 0 value to abort - return -1; -} - -//------------------------------------------------------------------------------ - -void -Download::getProxyForURL(const rtl::OUString& rURL, rtl::OString& rHost, sal_Int32& rPort) const -{ - if( !m_xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "Download: empty component context" ), - uno::Reference< uno::XInterface >() ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(m_xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "Download: unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface >() ); - - uno::Reference< lang::XMultiServiceFactory > xConfigProvider( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" ), m_xContext ), - uno::UNO_QUERY_THROW); - - beans::PropertyValue aProperty; - aProperty.Name = UNISTRING( "nodepath" ); - aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Inet/Settings") ); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] = uno::makeAny( aProperty ); - - uno::Reference< container::XNameAccess > xNameAccess( - xConfigProvider->createInstanceWithArguments( - UNISTRING("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ), - uno::UNO_QUERY_THROW ); - - OSL_ASSERT(xNameAccess->hasByName(UNISTRING("ooInetProxyType"))); - uno::Any aValue = xNameAccess->getByName(UNISTRING("ooInetProxyType")); - - sal_Int32 nProxyType = aValue.get< sal_Int32 >(); - if( 0 != nProxyType ) // type 0 means "direct connection to the internet - { - if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("http:")) ) - { - rHost = getStringValue(xNameAccess, UNISTRING("ooInetHTTPProxyName")); - rPort = getInt32Value(xNameAccess, UNISTRING("ooInetHTTPProxyPort")); - } - else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("https:")) ) - { - rHost = getStringValue(xNameAccess, UNISTRING("ooInetHTTPSProxyName")); - rPort = getInt32Value(xNameAccess, UNISTRING("ooInetHTTPSProxyPort")); - } - else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("ftp:")) ) - { - rHost = getStringValue(xNameAccess, UNISTRING("ooInetFTPProxyName")); - rPort = getInt32Value(xNameAccess, UNISTRING("ooInetFTPProxyPort")); - } - } -} - -//------------------------------------------------------------------------------ - -bool curl_run(const rtl::OUString& rURL, OutData& out, const rtl::OString& aProxyHost, sal_Int32 nProxyPort) -{ - /* Need to investigate further whether it is necessary to call - * curl_global_init or not - leave it for now (as the ftp UCB content - * provider does as well). - */ - - CURL * pCURL = curl_easy_init(); - bool ret = false; - - if( NULL != pCURL ) - { - out.curl = pCURL; - - rtl::OString aURL(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); - curl_easy_setopt(pCURL, CURLOPT_URL, aURL.getStr()); - - // abort on http errors - curl_easy_setopt(pCURL, CURLOPT_FAILONERROR, 1); - - // enable redirection - curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1); - - // write function - curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, &out); - curl_easy_setopt(pCURL, CURLOPT_WRITEFUNCTION, &write_function); - - // progress handler - Condition::check unfortunatly is not defined const - curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(pCURL, CURLOPT_PROGRESSFUNCTION, &progress_callback); - curl_easy_setopt(pCURL, CURLOPT_PROGRESSDATA, &out); - - // proxy - curl_easy_setopt(pCURL, CURLOPT_PROXY, aProxyHost.getStr()); - curl_easy_setopt(pCURL, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); - if( -1 != nProxyPort ) - curl_easy_setopt(pCURL, CURLOPT_PROXYPORT, nProxyPort); - - if( out.Offset > 0 ) - { - // curl_off_t offset = nOffset; libcurl seems to be compiled with large - // file support (and we not) .. - sal_Int64 offset = (sal_Int64) out.Offset; - curl_easy_setopt(pCURL, CURLOPT_RESUME_FROM_LARGE, offset); - } - - CURLcode cc = curl_easy_perform(pCURL); - - // treat zero byte downloads as errors - if( NULL == out.FileHandle ) - openFile(out); - - if( CURLE_OK == cc ) - { - out.Handler->downloadFinished(out.File); - ret = true; - } - - if ( CURLE_PARTIAL_FILE == cc ) - { - // this sometimes happens, when a user throws away his user data, but has already - // completed the download of an update. - double fDownloadSize; - curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize ); - if ( -1 == fDownloadSize ) - { - out.Handler->downloadFinished(out.File); - ret = true; - } - } - - // Avoid target file being removed - else if( (CURLE_ABORTED_BY_CALLBACK == cc) || out.StopCondition.check() ) - ret = true; - - // Only report errors when not stopped - else - { - rtl::OString aMessage(RTL_CONSTASCII_STRINGPARAM("Unknown error")); - - const char * error_message = curl_easy_strerror(cc); - if( NULL != error_message ) - aMessage = error_message; - - if ( CURLE_HTTP_RETURNED_ERROR == cc ) - { - long nError; - curl_easy_getinfo( pCURL, CURLINFO_RESPONSE_CODE, &nError ); - - if ( 403 == nError ) - aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " 403: Access denied!" ) ); - else if ( 404 == nError ) - aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " 404: File not found!" ) ); - else if ( 416 == nError ) - { - // we got this error probably, because we already downloaded the file - out.Handler->downloadFinished(out.File); - ret = true; - } - else - { - aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( ":error code = " ) ); - aMessage += aMessage.valueOf( nError ); - aMessage += rtl::OString( RTL_CONSTASCII_STRINGPARAM( " !" ) ); - } - } - if ( !ret ) - out.Handler->downloadStalled( rtl::OStringToOUString(aMessage, RTL_TEXTENCODING_UTF8) ); - } - - curl_easy_cleanup(pCURL); - } - - return ret; -} - -//------------------------------------------------------------------------------ - -bool -Download::start(const rtl::OUString& rURL, const rtl::OUString& rFile, const rtl::OUString& rDestinationDir) -{ - OSL_ASSERT( m_aHandler.is() ); - - OutData out(m_aCondition); - rtl::OUString aFile( rFile ); - - // when rFile is empty, there is no remembered file name. If there is already a file with the - // same name ask the user if she wants to resume a download or restart the download - if ( !aFile.getLength() ) - { - // GetFileName() - rtl::OUString aURL( rURL ); - // ensure no trailing '/' - sal_Int32 nLen = aURL.getLength(); - while( (nLen > 0) && ('/' == aURL[ nLen-1 ]) ) - aURL = aURL.copy( 0, --nLen ); - - // extract file name last '/' - sal_Int32 nIndex = aURL.lastIndexOf('/'); - aFile = rDestinationDir + aURL.copy( nIndex ); - - // check for existing file - oslFileError rc = osl_openFile( aFile.pData, &out.FileHandle, osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); - osl_closeFile(out.FileHandle); - out.FileHandle = NULL; - - if( osl_File_E_EXIST == rc ) - { - if ( m_aHandler->checkDownloadDestination( aURL.copy( nIndex+1 ) ) ) - { - osl_removeFile( aFile.pData ); - aFile = rtl::OUString(); - } - else - m_aHandler->downloadStarted( aFile, 0 ); - } - else - { - osl_removeFile( aFile.pData ); - aFile = rtl::OUString(); - } - } - - out.File = aFile; - out.DestinationDir = rDestinationDir; - out.Handler = m_aHandler; - - if( aFile.getLength() > 0 ) - { - oslFileError rc = osl_openFile(aFile.pData, &out.FileHandle, osl_File_OpenFlag_Write); - - if( osl_File_E_None == rc ) - { - // Set file pointer to the end of the file on resume - if( osl_File_E_None == osl_setFilePos(out.FileHandle, osl_Pos_End, 0) ) - { - osl_getFilePos(out.FileHandle, &out.Offset); - } - } - else if( osl_File_E_NOENT == rc ) // file has been deleted meanwhile .. - out.File = rtl::OUString(); - } - - rtl::OString aProxyHost; - sal_Int32 nProxyPort = -1; - getProxyForURL(rURL, aProxyHost, nProxyPort); - - bool ret = curl_run(rURL, out, aProxyHost, nProxyPort); - - if( NULL != out.FileHandle ) - { - osl_syncFile(out.FileHandle); - osl_closeFile(out.FileHandle); - -// #i90930# Don't remove already downloaded bits, when curl_run reports an error -// because later calls might be successful -// if( ! ret ) -// osl_removeFile(out.File.pData); - } - - m_aCondition.reset(); - return ret; -} - -//------------------------------------------------------------------------------ - -void -Download::stop() -{ - m_aCondition.set(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx deleted file mode 100644 index 8aa9e4ea3..000000000 --- a/extensions/source/update/check/download.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include - -#include -#include -#include -#include - -struct DownloadInteractionHandler : public rtl::IReference -{ - virtual bool checkDownloadDestination(const rtl::OUString& rFileName) = 0; - - // called if the destination file already exists, but resume is false - virtual bool downloadTargetExists(const rtl::OUString& rFileName) = 0; - - // called when curl reports an error - virtual void downloadStalled(const rtl::OUString& rErrorMessage) = 0; - - // progress handler - virtual void downloadProgressAt(sal_Int8 nPercent) = 0; - - // called on first progress notification - virtual void downloadStarted(const rtl::OUString& rFileName, sal_Int64 nFileSize) = 0; - - // called when download has been finished - virtual void downloadFinished(const rtl::OUString& rFileName) = 0; -}; - - -class Download -{ -public: - Download(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext, - const rtl::Reference< DownloadInteractionHandler >& rHandler) : m_xContext(xContext), m_aHandler(rHandler) {}; - - // returns true when the content of rURL was successfully written to rLocalFile - bool start(const rtl::OUString& rURL, const rtl::OUString& rFile, const rtl::OUString& rDestinationDir); - - // stops the download after the next write operation - void stop(); - - // returns true if the stop condition is set - bool isStopped() const - { return sal_True == const_cast (this)->m_aCondition.check(); }; - -protected: - - // Determines the appropriate proxy settings for the given URL. Returns true if a proxy should be used - void getProxyForURL(const rtl::OUString& rURL, rtl::OString& rHost, sal_Int32& rPort) const; - -private: - osl::Condition m_aCondition; - const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& m_xContext; - const rtl::Reference< DownloadInteractionHandler > m_aHandler; -}; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/makefile.mk b/extensions/source/update/check/makefile.mk deleted file mode 100644 index 47da869ea..000000000 --- a/extensions/source/update/check/makefile.mk +++ /dev/null @@ -1,142 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=updchk -PACKAGE=org.openoffice.Office - -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -ABSXCSROOT=$(SOLARXMLDIR) -XCSROOT=.. -DTDDIR=$(ABSXCSROOT) -XSLDIR=$(ABSXCSROOT)$/processing -PROCESSOUT=$(MISC)$/$(TARGET) -PROCESSORDIR=$(SOLARBINDIR) - -# no validation by inspector class -NO_INSPECTION=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# no "lib" prefix -DLLPRE = - -# --- Files --- - -SRS2NAME=$(TARGET) -SRC2FILES=\ - updatehdl.src - -RESLIB2NAME=upd -RESLIB2SRSFILES= $(SRS)$/updchk.srs -RESLIB2DEPN= updatehdl.src updatehdl.hrc - -SLOFILES=\ - $(SLO)$/download.obj \ - $(SLO)$/updatecheck.obj \ - $(SLO)$/updatecheckjob.obj \ - $(SLO)$/updatecheckconfig.obj \ - $(SLO)$/updateprotocol.obj \ - $(SLO)$/updatehdl.obj - -SHL1NOCHECK=TRUE -SHL1TARGET=$(TARGET).uno -SHL1OBJS=$(SLOFILES) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -SHL1IMPLIB=i$(SHL1TARGET) -SHL1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(CURLLIB) \ - $(SALLIB) \ - $(SHELL32LIB) \ - $(OLE32LIB) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -PACKAGEDIR=$(subst,.,$/ $(PACKAGE)) -SPOOLDIR=$(MISC)$/registry$/spool - -XCUFILES= \ - Addons.xcu \ - Jobs.xcu - -MYXCUFILES= \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Addons$/Addons-onlineupdate.xcu \ - $(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-onlineupdate.xcu - -LOCALIZEDFILES= \ - Addons.xcu \ - Jobs.xcu - -.IF "$(test)" != "" -APP1TARGET=updateprotocoltest -APP1STDLIBS= $(SHL1STDLIBS) -APP1OBJS= \ - $(SLO)$/updateprotocol.obj \ - $(SLO)$/updateprotocoltest.obj - - -.ENDIF # "$(test)" != "" - -# --- Targets --- - -.INCLUDE : target.mk - -ALLTAR : $(MYXCUFILES) - -.IF "$(WITH_LANG)"!="" -XCU_SOURCEDIR:=$(PROCESSOUT)$/merge$/$(PACKAGEDIR) -.ELSE # "$(WITH_LANG)"!="" -XCU_SOURCEDIR:=. -.ENDIF # "$(WITH_LANG)"!="" - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Addons$/Addons-onlineupdate.xcu : $(XCU_SOURCEDIR)$/Addons.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ - -$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-onlineupdate.xcu : $(XCU_SOURCEDIR)$/Jobs.xcu - @-$(MKDIRHIER) $(@:d) - @$(COPY) $< $@ -# @$(PERL) transform.pl < $< > $@ - - -ALLTAR : $(MISC)/updchk.uno.component - -$(MISC)/updchk.uno.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - updchk.uno.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt updchk.uno.component diff --git a/extensions/source/update/check/transform.pl b/extensions/source/update/check/transform.pl deleted file mode 100644 index 760acf55e..000000000 --- a/extensions/source/update/check/transform.pl +++ /dev/null @@ -1,61 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -while (<>) { - - if( // ) { - next if( $prop =~ /Text/ || $prop =~ /Bubble/ ); - } - - if( /xml:lang/ ) { - $lang = $_; - $lang =~ s/.*xml:lang=\"//; - $lang =~ s/\".*//; - chomp $lang; - $line = $prop; - $line =~ s/\" oor:type/_$lang\" oor:type/; - print $line; - $line = $_; - $line =~ s/ xml:lang=\".*\"//; - print $line; - $line = $prop; - $line =~ s//; - print $line; - next; - } - - print; -} \ No newline at end of file diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx deleted file mode 100644 index 9ce657e99..000000000 --- a/extensions/source/update/check/updatecheck.cxx +++ /dev/null @@ -1,1692 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "updatecheck.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#ifdef WNT -#ifdef _MSC_VER -#pragma warning(push,1) // disable warnings within system headers -//#pragma warning(disable: 4917) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif - -#include "updateprotocol.hxx" -#include "updatecheckconfig.hxx" - -namespace awt = com::sun::star::awt ; -namespace beans = com::sun::star::beans ; -namespace container = com::sun::star::container ; -namespace deployment = com::sun::star::deployment ; -namespace frame = com::sun::star::frame ; -namespace lang = com::sun::star::lang ; -namespace c3s = com::sun::star::system ; -namespace task = com::sun::star::task ; -namespace util = com::sun::star::util ; -namespace uno = com::sun::star::uno ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -#define PROPERTY_TITLE UNISTRING("BubbleHeading") -#define PROPERTY_TEXT UNISTRING("BubbleText") -#define PROPERTY_IMAGE UNISTRING("BubbleImageURL") -#define PROPERTY_SHOW_BUBBLE UNISTRING("BubbleVisible") -#define PROPERTY_CLICK_HDL UNISTRING("MenuClickHDL") -#define PROPERTY_DEFAULT_TITLE UNISTRING("DefaultHeading") -#define PROPERTY_DEFAULT_TEXT UNISTRING("DefaultText") -#define PROPERTY_SHOW_MENUICON UNISTRING("MenuIconVisible") - -//------------------------------------------------------------------------------ - -// Returns the URL of the release note for the given position -rtl::OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled) -{ - std::vector< ReleaseNote >::const_iterator iter = rInfo.ReleaseNotes.begin(); - while( iter != rInfo.ReleaseNotes.end() ) - { - if( pos == iter->Pos ) - { - if( (pos > 2) || !autoDownloadEnabled || ! (iter->URL2.getLength() > 0) ) - return iter->URL; - } - else if( (pos == iter->Pos2) && ((1 == iter->Pos) || (2 == iter->Pos)) && autoDownloadEnabled ) - return iter->URL2; - - ++iter; - } - - return rtl::OUString(); -} - -//------------------------------------------------------------------------------ - -namespace -{ - -static inline rtl::OUString getBuildId() -{ - rtl::OUString aPathVal(UNISTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}")); - rtl::Bootstrap::expandMacros(aPathVal); - return aPathVal; -} - -//------------------------------------------------------------------------------ -static inline rtl::OUString getBaseInstallation() -{ - rtl::OUString aPathVal(UNISTRING("${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("bootstrap") ":BaseInstallation}")); - rtl::Bootstrap::expandMacros(aPathVal); - return aPathVal; -} - -//------------------------------------------------------------------------------ - -inline bool isObsoleteUpdateInfo(const rtl::OUString& rBuildId) -{ - return sal_True != rBuildId.equals(getBuildId()) && rBuildId.getLength() > 0; -} - - -//------------------------------------------------------------------------------ - -rtl::OUString getImageFromFileName(const rtl::OUString& aFile) -{ -#ifndef WNT - rtl::OUString aUnpackPath; - if( osl_getExecutableFile(&aUnpackPath.pData) == osl_Process_E_None ) - { - sal_uInt32 lastIndex = aUnpackPath.lastIndexOf('/'); - if ( lastIndex > 0 ) - { - aUnpackPath = aUnpackPath.copy( 0, lastIndex+1 ); - aUnpackPath += UNISTRING( "unpack_update" ); - } - - oslFileHandle hOut = NULL; - oslProcess hProcess = NULL; - - rtl::OUString aSystemPath; - osl::File::getSystemPathFromFileURL(aFile, aSystemPath); - - oslProcessError rc = osl_executeProcess_WithRedirectedIO( - aUnpackPath.pData, // [in] Image name - &aSystemPath.pData, 1, // [in] Arguments - osl_Process_WAIT || osl_Process_NORMAL, // [in] Options - NULL, // [in] Security - NULL, // [in] Working directory - NULL, 0, // [in] Environment variables - &hProcess, // [out] Process handle - NULL, &hOut, NULL // [out] File handles for redirected I/O - ); - - if( osl_Process_E_None == rc ) - { - oslProcessInfo aInfo; - aInfo.Size = sizeof(oslProcessInfo); - - if( osl_Process_E_None == osl_getProcessInfo(hProcess, osl_Process_EXITCODE, &aInfo) ) - { - if( 0 == aInfo.Code ) - { - sal_Char szBuffer[4096]; - sal_uInt64 nBytesRead = 0; - const sal_uInt64 nBytesToRead = sizeof(szBuffer) - 1; - - rtl::OUString aImageName; - while( osl_File_E_None == osl_readFile(hOut, szBuffer, nBytesToRead, &nBytesRead) ) - { - sal_Char *pc = szBuffer + nBytesRead; - do - { - *pc = '\0'; --pc; - } - while( ('\n' == *pc) || ('\r' == *pc) ); - - aImageName += rtl::OUString(szBuffer, pc - szBuffer + 1, osl_getThreadTextEncoding()); - - if( nBytesRead < nBytesToRead ) - break; - } - - if( osl::FileBase::E_None == osl::FileBase::getFileURLFromSystemPath(aImageName, aImageName) ) - return aImageName; - } - } - - osl_closeFile(hOut); - osl_freeProcessHandle(hProcess); - } - } -#endif - - return aFile; -} - - -//------------------------------------------------------------------------------ - -static uno::Reference< beans::XPropertySet > createMenuBarUI( - const uno::Reference< uno::XComponentContext >& xContext, - const uno::Reference< task::XJob >& xJob) -{ - if( !xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckJob: empty component context" ), uno::Reference< uno::XInterface > () ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckJob: unable to obtain service manager from component context" ), uno::Reference< uno::XInterface > () ); - - uno::Reference< beans::XPropertySet > xMenuBarUI = - uno::Reference< beans::XPropertySet > ( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.setup.UpdateCheckUI" ), xContext ), - uno::UNO_QUERY_THROW); - - xMenuBarUI->setPropertyValue( PROPERTY_CLICK_HDL, uno::makeAny( xJob ) ); - - return xMenuBarUI; -} - -//------------------------------------------------------------------------------ - - - -typedef sal_Bool (* OnlineCheckFunc) (); - -class UpdateCheckThread : public WorkerThread -{ - -public: - UpdateCheckThread( osl::Condition& rCondition, - const uno::Reference& xContext ); - - virtual void SAL_CALL join(); - virtual void SAL_CALL terminate(); - virtual void SAL_CALL cancel(); - -protected: - virtual ~UpdateCheckThread(); - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - /* Wrapper around checkForUpdates */ - bool runCheck( bool & rbExtensionsChecked ); - -private: - - /* Used to avoid dialup login windows (on platforms we know how to double this) */ - inline bool hasInternetConnection() const - { - if(m_pHasInternetConnection != NULL ) - return (sal_True == m_pHasInternetConnection()); - return true; - } - - /* Creates a new instance of UpdateInformationProvider and returns this instance */ - inline uno::Reference createProvider() - { - osl::MutexGuard aGuard(m_aMutex); - m_xProvider = deployment::UpdateInformationProvider::create(m_xContext); - return m_xProvider; - }; - - /* Returns the remembered instance of UpdateInformationProvider if any */ - inline uno::Reference getProvider() - { osl::MutexGuard aGuard(m_aMutex); return m_xProvider; }; - - /* Releases the remembered instance of UpdateInformationProvider if any */ - inline void clearProvider() - { osl::MutexGuard aGuard(m_aMutex); m_xProvider.clear(); }; - - osl::Mutex m_aMutex; - osl::Module m_aModule; - -protected: - osl::Condition& m_aCondition; - -private: - -// const - OnlineCheckFunc m_pHasInternetConnection; - - const uno::Reference m_xContext; - uno::Reference m_xProvider; -}; - - -class ManualUpdateCheckThread : public UpdateCheckThread -{ -public: - ManualUpdateCheckThread( osl::Condition& rCondition, const uno::Reference& xContext ) : - UpdateCheckThread(rCondition, xContext) {}; - - virtual void SAL_CALL run(); -}; - - -class MenuBarButtonJob : public ::cppu::WeakImplHelper1< task::XJob > -{ -public: - MenuBarButtonJob(const rtl::Reference< UpdateCheck >& rUpdateCheck); - - // XJob - virtual uno::Any SAL_CALL execute(const uno::Sequence&) - throw (lang::IllegalArgumentException, uno::Exception); - -private: - rtl::Reference< UpdateCheck > m_aUpdateCheck; -}; - -class DownloadThread : public WorkerThread -{ -public: - DownloadThread( - osl::Condition& rCondition, - const uno::Reference& xContext, - const rtl::Reference< DownloadInteractionHandler >& rHandler, - const rtl::OUString& rURL ); - - virtual void SAL_CALL run(); - virtual void SAL_CALL cancel(); - virtual void SAL_CALL suspend(); - virtual void SAL_CALL onTerminated(); - -protected: - ~DownloadThread(); - -private: - osl::Condition& m_aCondition; - const uno::Reference m_xContext; - const rtl::OUString m_aURL; - Download m_aDownload; -}; - -//------------------------------------------------------------------------------ -class ShutdownThread : public osl::Thread -{ -public: - ShutdownThread( const uno::Reference& xContext ); - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - -protected: - ~ShutdownThread(); - -private: - osl::Condition m_aCondition; - const uno::Reference m_xContext; -}; - -//------------------------------------------------------------------------------ - -UpdateCheckThread::UpdateCheckThread( osl::Condition& rCondition, - const uno::Reference& xContext ) : - m_aCondition(rCondition), - m_pHasInternetConnection(NULL), - m_xContext(xContext) -{ - -#ifdef WNT - rtl::OUString aPath; - if( osl_getExecutableFile(&aPath.pData) == osl_Process_E_None ) - { - sal_uInt32 lastIndex = aPath.lastIndexOf('/'); - if ( lastIndex > 0 ) - { - aPath = aPath.copy( 0, lastIndex+1 ); - aPath += UNISTRING( "onlinecheck" ); - } - - if ( m_aModule.load(aPath) ) - { - m_pHasInternetConnection = - reinterpret_cast < OnlineCheckFunc > ( - m_aModule.getFunctionSymbol( UNISTRING("hasInternetConnection"))); - } - } -#endif - - createSuspended(); - - // actually run the thread - resume(); -} - -//------------------------------------------------------------------------------ - -UpdateCheckThread::~UpdateCheckThread() -{ -} - -//------------------------------------------------------------------------------ - - -void SAL_CALL -UpdateCheckThread::terminate() -{ - // Cancel potentially hanging http request .. - cancel(); - // .. before terminating - osl::Thread::terminate(); -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateCheckThread::join() -{ - uno::Reference< deployment::XUpdateInformationProvider > xProvider(getProvider()); - - // do not join during an update check until #i73893# is fixed - if( ! xProvider.is() ) - { - osl::Thread::join(); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateCheckThread::cancel() -{ - uno::Reference< deployment::XUpdateInformationProvider > xProvider(getProvider()); - - if( xProvider.is() ) - xProvider->cancel(); -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheckThread::runCheck( bool & rbExtensionsChecked ) -{ - bool ret = false; - UpdateState eUIState = UPDATESTATE_NO_UPDATE_AVAIL; - - UpdateInfo aInfo; - rtl::Reference< UpdateCheck > aController(UpdateCheck::get()); - - if( checkForUpdates(aInfo, m_xContext, aController->getInteractionHandler(), createProvider()) ) - { - aController->setUpdateInfo(aInfo); - eUIState = aController->getUIState(aInfo); - ret = true; - } - else - aController->setCheckFailedState(); - - // We will only look for extension updates, when there is no 'check for office updates' dialog open - // and when there was no office update found - if ( ( eUIState != UPDATESTATE_UPDATE_AVAIL ) && - ( eUIState != UPDATESTATE_UPDATE_NO_DOWNLOAD ) && - !aController->isDialogShowing() && - !rbExtensionsChecked ) - { - bool bHasExtensionUpdates = checkForExtensionUpdates( m_xContext ); - aController->setHasExtensionUpdates( bHasExtensionUpdates ); - if ( bHasExtensionUpdates ) - aController->setUIState( UPDATESTATE_EXT_UPD_AVAIL ); - rbExtensionsChecked = true; - } - - // joining with this thread is safe again - clearProvider(); - return ret; -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateCheckThread::onTerminated() -{ - delete this; -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateCheckThread::run() -{ - bool bExtensionsChecked = false; - TimeValue systime; - TimeValue nExtCheckTime; - osl_getSystemTime( &nExtCheckTime ); - - osl::Condition::Result aResult = osl::Condition::result_timeout; - TimeValue tv = { 10, 0 }; - - // Initial wait to avoid doing further time consuming tasks during start-up - aResult = m_aCondition.wait(&tv); - - try { - - while( sal_True == schedule() ) - { - /* Use cases: - * a) manual check requested from auto check thread - "last check" should not be checked (one time) - * a1) manual check was requested in the middle of a running auto check, - * condition is set - * a2) manual check was requested while waiting for a retry, - * condition is set - * a3) manual check was requested while waiting for time to next - * scheduled check elapsing, condition is set - * a4) manual check was requested during initial wait, condition is set - * b) check interval got changed, condition may be set - same sub-cases as a), - * but "last check" should be honored - * c) normal auto check mode, condition not set - "last check" should be honored - */ - - // Accessing const members without synchronization - rtl::Reference< UpdateCheck > aController(UpdateCheck::get()); - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext, *aController); - - // FIXME: remember last & offset ? - sal_Int64 last = rModel->getLastChecked(); - sal_Int64 offset = rModel->getCheckInterval(); - - rModel.clear(); - - // last == 0 means check immediately - bool checkNow = ! (last > 0); - - // Reset the condition to avoid busy loops - if( osl::Condition::result_ok == aResult ) - { - m_aCondition.reset(); - aResult = osl::Condition::result_timeout; - checkNow = aController->isDialogShowing(); - } - - if( ! checkNow ) - { - osl_getSystemTime(&systime); - - // Go back to sleep until time has elapsed - sal_Int64 next = last + offset; - if( last + offset > systime.Seconds ) - { - // This can not be > 32 Bit for now .. - tv.Seconds = static_cast< sal_Int32 > (next - systime.Seconds); - aResult = m_aCondition.wait(&tv); - continue; - } - } - - static sal_uInt8 n = 0; - - if( ! hasInternetConnection() || ! runCheck( bExtensionsChecked ) ) - { - // the extension update check should be independent from the office update check - // - osl_getSystemTime( &systime ); - if ( nExtCheckTime.Seconds + offset < systime.Seconds ) - bExtensionsChecked = false; - - // Increase next by 15, 60, .. minutes - static const sal_Int32 nRetryInterval[] = { 900, 3600, 14400, 86400 }; - - if( n < SAL_N_ELEMENTS(nRetryInterval) ) - ++n; - - tv.Seconds = nRetryInterval[n-1]; - aResult = m_aCondition.wait(&tv); - } - else // reset retry counter - { - n = 0; - bExtensionsChecked = false; - } - } - } - - catch(const uno::Exception& e) { - // Silently catch all errors - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr() ); - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -ManualUpdateCheckThread::run() -{ - bool bExtensionsChecked = false; - - try { - runCheck( bExtensionsChecked ); - m_aCondition.reset(); - } - catch(const uno::Exception& e) { - // Silently catch all errors - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr() ); - } -} - -//------------------------------------------------------------------------------ - -MenuBarButtonJob::MenuBarButtonJob(const rtl::Reference< UpdateCheck >& rUpdateCheck) : - m_aUpdateCheck(rUpdateCheck) -{ -}; - -//------------------------------------------------------------------------------ - -uno::Any SAL_CALL -MenuBarButtonJob::execute(const uno::Sequence& ) - throw (lang::IllegalArgumentException, uno::Exception) -{ - if ( m_aUpdateCheck->shouldShowExtUpdDlg() ) - m_aUpdateCheck->showExtensionDialog(); - else - m_aUpdateCheck->showDialog(); - - return uno::Any(); -} - -//------------------------------------------------------------------------------ - -DownloadThread::DownloadThread(osl::Condition& rCondition, - const uno::Reference& xContext, - const rtl::Reference< DownloadInteractionHandler >& rHandler, - const rtl::OUString& rURL) : - m_aCondition(rCondition), - m_xContext(xContext), - m_aURL(rURL), - m_aDownload(xContext, rHandler) -{ - createSuspended(); -} - -//------------------------------------------------------------------------------ - -DownloadThread::~DownloadThread() -{ -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -DownloadThread::run() -{ -#ifdef WNT - CoUninitialize(); - CoInitialize( NULL ); -#endif - - while( schedule() ) - { - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext); - - rtl::OUString aLocalFile = rModel->getLocalFileName(); - rtl::OUString aDownloadDest = rModel->getDownloadDestination(); - - // release config class for now - rModel.clear(); - - static sal_uInt8 n = 0; - if( ! m_aDownload.start(m_aURL, aLocalFile, aDownloadDest ) ) - { - // retry every 15s unless the dialog is not visible - TimeValue tv; - tv.Seconds = 15; - - if( ! UpdateCheck::get()->isDialogShowing() ) - { - // Increase next by 1, 5, 15, 60, .. minutes - static const sal_Int16 nRetryInterval[] = { 60, 300, 900, 3600 }; - - if( n < SAL_N_ELEMENTS(nRetryInterval) ) - ++n; - - tv.Seconds = nRetryInterval[n-1]; - } - m_aCondition.wait(&tv); - } - else - { - // reset wait period after successful download - n=0; - } - } -} - -//------------------------------------------------------------------------------ - -void SAL_CALL DownloadThread::cancel() -{ - m_aDownload.stop(); - resume(); - - rtl::Reference< UpdateCheck > aController(UpdateCheck::get()); - aController->cancelDownload(); -} - -//------------------------------------------------------------------------------ - -void SAL_CALL DownloadThread::suspend() -{ - osl::Thread::suspend(); - m_aDownload.stop(); -} - -//------------------------------------------------------------------------------ - -void SAL_CALL DownloadThread::onTerminated() -{ - delete this; -} - -//------------------------------------------------------------------------------ -ShutdownThread::ShutdownThread( const uno::Reference& xContext) : - m_xContext( xContext ) -{ - create(); -} - -//------------------------------------------------------------------------------ -ShutdownThread::~ShutdownThread() -{ -} - -//------------------------------------------------------------------------------ -void SAL_CALL -ShutdownThread::run() -{ - TimeValue tv = { 0, 250 }; - - m_aCondition.wait(&tv); - - // Tell QuickStarter not to veto .. - uno::Reference< beans::XFastPropertySet > xQuickStarter( - UpdateCheck::createService(UNISTRING("com.sun.star.office.Quickstart"), m_xContext), - uno::UNO_QUERY - ); - - if (xQuickStarter.is()) - xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); - - // Shutdown the office - uno::Reference< frame::XDesktop > xDesktop( - UpdateCheck::createService(UNISTRING("com.sun.star.frame.Desktop"), m_xContext), - uno::UNO_QUERY); - - if( xDesktop.is() ) - xDesktop->terminate(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ShutdownThread::onTerminated() -{ - delete this; -} - -//------------------------------------------------------------------------------ - -} // anonymous namespace - - -//------------------------------------------------------------------------------ - - -void -UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, - const uno::Reference& xContext) -{ - osl::MutexGuard aGuard(m_aMutex); - - if( NOT_INITIALIZED == m_eState ) - { - NamedValueByNameAccess aNameAccess(rValues); - UpdateCheckROModel aModel( aNameAccess ); - m_xContext = xContext; - - rtl::OUString aUpdateEntryVersion = aModel.getUpdateEntryVersion(); - - aModel.getUpdateEntry(m_aUpdateInfo); - - bool obsoleteUpdateInfo = isObsoleteUpdateInfo(aUpdateEntryVersion); - bool bContinueDownload = false; - bool bDownloadAvailable = false; - - m_bHasExtensionUpdate = checkForPendingUpdates( xContext ); - m_bShowExtUpdDlg = false; - - rtl::OUString aLocalFileName = aModel.getLocalFileName(); - - if( aLocalFileName.getLength() > 0 ) - { - bContinueDownload = true; - - // Try to get the number of bytes already on disk - osl::DirectoryItem aDirectoryItem; - if( osl::DirectoryItem::E_None == osl::DirectoryItem::get(aLocalFileName, aDirectoryItem) ) - { - osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileSize); - if( osl::DirectoryItem::E_None == aDirectoryItem.getFileStatus(aFileStatus) ) - { - sal_Int64 nDownloadSize = aModel.getDownloadSize(); - sal_Int64 nFileSize = aFileStatus.getFileSize(); - - if( nDownloadSize > 0 ) - { - if ( nDownloadSize <= nFileSize ) // we have already downloaded everthing - { - bContinueDownload = false; - bDownloadAvailable = true; - m_aImageName = getImageFromFileName( aLocalFileName ); - } - else // Calculate initial percent value. - { - sal_Int32 nPercent = (sal_Int32) (100 * nFileSize / nDownloadSize); - getUpdateHandler()->setProgress( nPercent ); - } - } - } - } - - if ( bContinueDownload ) - { - bool downloadPaused = aModel.isDownloadPaused(); - - enableDownload(true, downloadPaused); - setUIState(downloadPaused ? UPDATESTATE_DOWNLOAD_PAUSED : UPDATESTATE_DOWNLOADING); - } - - } - if ( !bContinueDownload ) - { - // We do this intentionally only if no download is in progress .. - if( obsoleteUpdateInfo ) - { - // Bring-up release note for position 5 .. - const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 5)); - if( aURL.getLength() > 0 ) - showReleaseNote(aURL); - - // Data is outdated, probably due to installed update - rtl::Reference< UpdateCheckConfig > aConfig = UpdateCheckConfig::get( xContext, *this ); - aConfig->clearUpdateFound(); - aConfig->clearLocalFileName(); - - - m_aUpdateInfo = UpdateInfo(); - // Remove outdated release notes - storeReleaseNote( 1, rtl::OUString() ); - storeReleaseNote( 2, rtl::OUString() ); - } - else - { - enableAutoCheck(aModel.isAutoCheckEnabled()); - if ( bDownloadAvailable ) - setUIState( UPDATESTATE_DOWNLOAD_AVAIL ); - else - setUIState(getUIState(m_aUpdateInfo)); - } - } - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::cancel() -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - WorkerThread *pThread = m_pThread; - UpdateState eUIState = getUIState(m_aUpdateInfo); - - aGuard.clear(); - - if( NULL != pThread ) - pThread->cancel(); - - setUIState(eUIState); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::download() -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - UpdateInfo aInfo(m_aUpdateInfo); - State eState = m_eState; - aGuard.clear(); - - if( aInfo.Sources[0].IsDirect ) - { - // Ignore second click of a double click - if( DOWNLOADING != eState ) - { - shutdownThread(true); - - osl::ClearableMutexGuard aGuard2(m_aMutex); - enableDownload(true); - aGuard2.clear(); - setUIState(UPDATESTATE_DOWNLOADING); - } - } - else - { - showReleaseNote(aInfo.Sources[0].URL); // Display in browser - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::install() -{ - osl::MutexGuard aGuard(m_aMutex); - - const uno::Reference< c3s::XSystemShellExecute > xShellExecute( - createService( UNISTRING( "com.sun.star.system.SystemShellExecute" ), m_xContext ), - uno::UNO_QUERY ); - - try { - // Construct install command ?? - - // Store release note for position 3 and 4 - rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 3)); - storeReleaseNote(1, aURL); - - aURL = getReleaseNote(m_aUpdateInfo, 4); - storeReleaseNote(2, aURL); - - if( xShellExecute.is() ) - { - rtl::OUString aInstallImage(m_aImageName); - osl::FileBase::getSystemPathFromFileURL(aInstallImage, aInstallImage); - - rtl::OUString aParameter; - sal_Int32 nFlags = c3s::SystemShellExecuteFlags::DEFAULTS; -#if ( defined LINUX || defined SOLARIS ) - nFlags = 42; - aParameter = getBaseInstallation(); - if( aParameter.getLength() > 0 ) - osl::FileBase::getSystemPathFromFileURL(aParameter, aParameter); - - aParameter += UNISTRING(" &"); -#endif - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); - rModel->clearLocalFileName(); - - xShellExecute->execute(aInstallImage, aParameter, nFlags); - ShutdownThread *pShutdownThread = new ShutdownThread( m_xContext ); - (void) pShutdownThread; - } - } catch(uno::Exception&) { - m_aUpdateHandler->setErrorMessage( m_aUpdateHandler->getDefaultInstErrMsg() ); - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::pause() -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - if( NULL != m_pThread ) - m_pThread->suspend(); - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext); - aGuard.clear(); - - rModel->storeDownloadPaused(true); - setUIState(UPDATESTATE_DOWNLOAD_PAUSED); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::resume() -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - if( NULL != m_pThread ) - m_pThread->resume(); - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext); - aGuard.clear(); - - rModel->storeDownloadPaused(false); - setUIState(UPDATESTATE_DOWNLOADING); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::closeAfterFailure() -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - if ( ( m_eState == DISABLED ) || ( m_eState == CHECK_SCHEDULED ) ) - { - const UpdateState eUIState = getUIState( m_aUpdateInfo ); - aGuard.clear(); - setUIState( eUIState, true ); - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::shutdownThread(bool join) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - // copy thread object pointer to stack - osl::Thread *pThread = m_pThread; - m_pThread = NULL; - aGuard.clear(); - - if( NULL != pThread ) - { - pThread->terminate(); - if( join ) - { - m_aCondition.set(); - pThread->join(); - m_aCondition.reset(); - } - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::enableAutoCheck(bool enable) -{ - if( enable ) - m_pThread = new UpdateCheckThread(m_aCondition, m_xContext); - - m_eState = enable ? CHECK_SCHEDULED : DISABLED; -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::enableDownload(bool enable, bool paused) -{ - OSL_ASSERT(NULL == m_pThread); - - State eState = DISABLED; - if( enable ) - { - m_pThread = new DownloadThread(m_aCondition, m_xContext, this, m_aUpdateInfo.Sources[0].URL ); - if( !paused ) - { - eState = DOWNLOADING; - m_pThread->resume(); - } - else - eState = DOWNLOAD_PAUSED; - - m_eState = eState; - } - else { - enableAutoCheck(UpdateCheckConfig::get(m_xContext)->isAutoCheckEnabled()); - } - -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheck::downloadTargetExists(const rtl::OUString& rFileName) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - rtl::Reference< UpdateHandler > aUpdateHandler(getUpdateHandler()); - UpdateState eUIState = UPDATESTATE_DOWNLOADING; - - bool cont = false; - - if( aUpdateHandler->isVisible() ) - { - cont = aUpdateHandler->showOverwriteWarning(); - if( cont ) - { - if( osl_File_E_None != osl_removeFile(rFileName.pData) ) - { - // FIXME: error message - cont = false; - } - } - else - eUIState = getUIState(m_aUpdateInfo); - } - else - { - m_aImageName = getImageFromFileName(rFileName); - eUIState = UPDATESTATE_DOWNLOAD_AVAIL; - } - - if( !cont ) - { - shutdownThread(false); - enableDownload(false); - - aGuard.clear(); - setUIState(eUIState); - } - - return cont; -} - -//------------------------------------------------------------------------------ -bool UpdateCheck::checkDownloadDestination( const rtl::OUString& rFileName ) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - rtl::Reference< UpdateHandler > aUpdateHandler( getUpdateHandler() ); - - bool bReload = false; - - if( aUpdateHandler->isVisible() ) - { - bReload = aUpdateHandler->showOverwriteWarning( rFileName ); - } - - return bReload; -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::downloadStalled(const rtl::OUString& rErrorMessage) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - rtl::Reference< UpdateHandler > aUpdateHandler(getUpdateHandler()); - aGuard.clear(); - - aUpdateHandler->setErrorMessage(rErrorMessage); - setUIState(UPDATESTATE_ERROR_DOWNLOADING); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::downloadProgressAt(sal_Int8 nPercent) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - rtl::Reference< UpdateHandler > aUpdateHandler(getUpdateHandler()); - aGuard.clear(); - - aUpdateHandler->setProgress(nPercent); - setUIState(UPDATESTATE_DOWNLOADING); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::downloadStarted(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize) -{ - if ( nFileSize > 0 ) - { - osl::MutexGuard aGuard(m_aMutex); - - rtl::Reference< UpdateCheckConfig > aModel(UpdateCheckConfig::get(m_xContext)); - aModel->storeLocalFileName(rLocalFileName, nFileSize); - - // Bring-up release note for position 1 .. - const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 1, aModel->isAutoDownloadEnabled())); - if( aURL.getLength() > 0 ) - showReleaseNote(aURL); - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::downloadFinished(const rtl::OUString& rLocalFileName) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - // no more retries - m_pThread->terminate(); - - m_aImageName = getImageFromFileName(rLocalFileName); - UpdateInfo aUpdateInfo(m_aUpdateInfo); - - aGuard.clear(); - setUIState(UPDATESTATE_DOWNLOAD_AVAIL); - - // Bring-up release note for position 2 .. - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); - const rtl::OUString aURL(getReleaseNote(aUpdateInfo, 2, rModel->isAutoDownloadEnabled())); - if( aURL.getLength() > 0 ) - showReleaseNote(aURL); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::cancelDownload() -{ - shutdownThread(true); - - osl::MutexGuard aGuard(m_aMutex); - enableDownload(false); - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext); - - rtl::OUString aLocalFile(rModel->getLocalFileName()); - rModel->clearLocalFileName(); - rModel->storeDownloadPaused(false); - - if( isObsoleteUpdateInfo(rModel->getUpdateEntryVersion()) ) - { - rModel->clearUpdateFound(); // This wasn't done during init yet .. - m_aUpdateInfo = UpdateInfo(); - } - - /*oslFileError rc =*/ osl_removeFile(aLocalFile.pData); - // FIXME: error handling .. - -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::showDialog(bool forceCheck) -{ - osl::ResettableMutexGuard aGuard(m_aMutex); - - bool update_found = m_aUpdateInfo.BuildId.getLength() > 0; - bool bSetUIState = ! m_aUpdateHandler.is(); - - UpdateState eDialogState = UPDATESTATES_COUNT; - - switch( m_eState ) - { - case DISABLED: - case CHECK_SCHEDULED: - if( forceCheck || ! update_found ) // Run check when forced or if we did not find an update yet - { - eDialogState = UPDATESTATE_CHECKING; - bSetUIState = true; - } - else if(m_aUpdateInfo.Sources[0].IsDirect) - eDialogState = UPDATESTATE_UPDATE_AVAIL; - else - eDialogState = UPDATESTATE_UPDATE_NO_DOWNLOAD; - break; - - case DOWNLOADING: - eDialogState = UPDATESTATE_DOWNLOADING; - break; - - case DOWNLOAD_PAUSED: - eDialogState = UPDATESTATE_DOWNLOAD_PAUSED; - break; - - case NOT_INITIALIZED: - OSL_ASSERT( false ); - break; - } - - if( bSetUIState ) - { - aGuard.clear(); - setUIState(eDialogState, true); // suppress bubble as Dialog will be visible soon - aGuard.reset(); - } - - getUpdateHandler()->setVisible(true); - - // Run check in separate thread .. - if( UPDATESTATE_CHECKING == eDialogState ) - { - if( DISABLED == m_eState ) - { - // destructs itself when done, not cancellable for now .. - new ManualUpdateCheckThread(m_aCondition, m_xContext); - } - - m_aCondition.set(); - } -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::setUpdateInfo(const UpdateInfo& aInfo) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - bool bSuppressBubble = (sal_True == aInfo.BuildId.equals(m_aUpdateInfo.BuildId)); - m_aUpdateInfo = aInfo; - - OSL_ASSERT(DISABLED == m_eState || CHECK_SCHEDULED == m_eState); - - // Ignore leading non direct download if we get direct ones - std::vector< DownloadSource >::iterator iter = m_aUpdateInfo.Sources.begin(); - while( iter != m_aUpdateInfo.Sources.end() ) - { - if( iter->IsDirect ) - break; - - ++iter; - } - - if( (iter != m_aUpdateInfo.Sources.begin()) && - (iter != m_aUpdateInfo.Sources.end()) && - iter->IsDirect ) - { - m_aUpdateInfo.Sources.erase(m_aUpdateInfo.Sources.begin(), --iter); - } - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get(m_xContext, *this); - OSL_ASSERT( rModel.is() ); - - // Decide whether to use alternate release note pos .. - bool autoDownloadEnabled = rModel->isAutoDownloadEnabled(); - - std::vector< ReleaseNote >::iterator iter2 = m_aUpdateInfo.ReleaseNotes.begin(); - while( iter2 != m_aUpdateInfo.ReleaseNotes.end() ) - { - if( ((1 == iter2->Pos) || (2 == iter2->Pos)) && autoDownloadEnabled && (iter2->URL2.getLength() > 0)) - { - iter2->URL = iter2->URL2; - iter2->URL2 = rtl::OUString(); - iter2->Pos = iter2->Pos2; - iter2->Pos2 = 0; - } - - ++iter2; - } - - // do not move below store/clear .. - rModel->updateLastChecked(); - - UpdateState eUIState; - if( m_aUpdateInfo.Sources.size() > 0 ) - { - rModel->storeUpdateFound(aInfo, getBuildId()); - - if( m_aUpdateInfo.Sources[0].IsDirect ) - { - eUIState = UPDATESTATE_UPDATE_AVAIL; - - if( rModel->isAutoDownloadEnabled() ) - { - shutdownThread(false); - eUIState = UPDATESTATE_DOWNLOADING; - enableDownload(true); - } - } - else - eUIState = UPDATESTATE_UPDATE_NO_DOWNLOAD; - } - else - { - eUIState = UPDATESTATE_NO_UPDATE_AVAIL; - rModel->clearUpdateFound(); - } - - aGuard.clear(); - setUIState(eUIState, bSuppressBubble); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::setCheckFailedState() -{ - setUIState(UPDATESTATE_ERROR_CHECKING); -} - -//------------------------------------------------------------------------------ -void UpdateCheck::handleMenuBarUI( rtl::Reference< UpdateHandler > rUpdateHandler, - UpdateState& eState, - bool suppressBubble ) -{ - uno::Reference xMenuBarUI( m_xMenuBarUI ); - - if ( ( UPDATESTATE_NO_UPDATE_AVAIL == eState ) && m_bHasExtensionUpdate ) - eState = UPDATESTATE_EXT_UPD_AVAIL; - - if ( UPDATESTATE_EXT_UPD_AVAIL == eState ) - m_bShowExtUpdDlg = true; - else - m_bShowExtUpdDlg = false; - - if( xMenuBarUI.is() ) - { - if( UPDATESTATE_NO_UPDATE_AVAIL == eState ) - { - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(sal_False) ); - } - else - { - xMenuBarUI->setPropertyValue( PROPERTY_TITLE, uno::makeAny(rUpdateHandler->getBubbleTitle(eState)) ); - xMenuBarUI->setPropertyValue( PROPERTY_TEXT, uno::makeAny(rUpdateHandler->getBubbleText(eState)) ); - - if( ! suppressBubble && ( ! rUpdateHandler->isVisible() || rUpdateHandler->isMinimized() ) ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_BUBBLE, uno::makeAny( sal_True ) ); - - if( UPDATESTATE_CHECKING != eState ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(sal_True) ); - } - } -} - -//------------------------------------------------------------------------------ -void UpdateCheck::setUIState(UpdateState eState, bool suppressBubble) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - if( ! m_xMenuBarUI.is() && - (DISABLED != m_eState) && - ( m_bHasExtensionUpdate || (UPDATESTATE_NO_UPDATE_AVAIL != eState)) && - (UPDATESTATE_CHECKING != eState) && - (UPDATESTATE_ERROR_CHECKING != eState) - ) - { - m_xMenuBarUI = createMenuBarUI(m_xContext, new MenuBarButtonJob(this)); - } - - // Show bubble only when the status has changed - if ( eState == m_eUpdateState ) - suppressBubble = true; - else - m_eUpdateState = eState; - - rtl::Reference aUpdateHandler(getUpdateHandler()); - OSL_ASSERT( aUpdateHandler.is() ); - - UpdateInfo aUpdateInfo(m_aUpdateInfo); - rtl::OUString aImageName(m_aImageName); - - aGuard.clear(); - - handleMenuBarUI( aUpdateHandler, eState, suppressBubble ); - - if( (UPDATESTATE_UPDATE_AVAIL == eState) - || (UPDATESTATE_DOWNLOAD_PAUSED == eState) - || (UPDATESTATE_DOWNLOADING == eState) ) - { - uno::Reference< uno::XComponentContext > xContext(m_xContext); - - rtl::OUString aDownloadDestination = - UpdateCheckConfig::get(xContext, this)->getDownloadDestination(); - - osl_getSystemPathFromFileURL(aDownloadDestination.pData, &aDownloadDestination.pData); - - aUpdateHandler->setDownloadPath(aDownloadDestination); - } - else if( UPDATESTATE_DOWNLOAD_AVAIL == eState ) - { - aUpdateHandler->setDownloadFile(aImageName); - } - - aUpdateHandler->setDescription(aUpdateInfo.Description); - aUpdateHandler->setNextVersion(aUpdateInfo.Version); - aUpdateHandler->setState(eState); -} - -//------------------------------------------------------------------------------ - -UpdateState -UpdateCheck::getUIState(const UpdateInfo& rInfo) -{ - UpdateState eUIState = UPDATESTATE_NO_UPDATE_AVAIL; - - if( rInfo.BuildId.getLength() > 0 ) - { - if( rInfo.Sources[0].IsDirect ) - eUIState = UPDATESTATE_UPDATE_AVAIL; - else - eUIState = UPDATESTATE_UPDATE_NO_DOWNLOAD; - } - - return eUIState; -} - -//------------------------------------------------------------------------------ - -void -UpdateCheck::showReleaseNote(const rtl::OUString& rURL) const -{ - const uno::Reference< c3s::XSystemShellExecute > xShellExecute( - createService( UNISTRING( "com.sun.star.system.SystemShellExecute" ), m_xContext ), - uno::UNO_QUERY ); - - try { - - if( xShellExecute.is() ) - xShellExecute->execute(rURL, rtl::OUString(), c3s::SystemShellExecuteFlags::DEFAULTS); - } catch(c3s::SystemShellExecuteException&) { - } -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheck::storeReleaseNote(sal_Int8 nNum, const rtl::OUString &rURL) -{ - osl::FileBase::RC rc; - rtl::OUString aTargetDir( UpdateCheckConfig::getAllUsersDirectory() + UNISTRING( "/sun" ) ); - - rc = osl::Directory::createPath( aTargetDir ); - - rtl::OUString aFileName = UNISTRING("releasenote") + - rtl::OUString::valueOf( (sal_Int32) nNum ) + - UNISTRING(".url"); - - rtl::OUString aFilePath; - rc = osl::FileBase::getAbsoluteFileURL( aTargetDir, aFileName, aFilePath ); - if ( rc != osl::FileBase::E_None ) return false; - - rc = osl::File::remove( aFilePath ); - - // don't store empty release notes, but delete old ones - if ( rURL.getLength() == 0 ) - return true; - - osl::File aFile( aFilePath ); - rc = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); - - if ( rc != osl::FileBase::E_None ) return false; - - rtl::OString aLineBuf("[InternetShortcut]\r\n"); - sal_uInt64 nWritten = 0; - - rtl::OUString aURL( rURL ); -#ifdef WNT - rc = aFile.write( aLineBuf.getStr(), aLineBuf.getLength(), nWritten ); - if ( rc != osl::FileBase::E_None ) return false; - aURL = UNISTRING("URL=") + rURL; -#endif - aLineBuf = rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ); - rc = aFile.write( aLineBuf.getStr(), aLineBuf.getLength(), nWritten ); - if ( rc != osl::FileBase::E_None ) return false; - - aFile.close(); - return true; -} - -//------------------------------------------------------------------------------ -void UpdateCheck::showExtensionDialog() -{ - rtl::OUString sServiceName = UNISTRING("com.sun.star.deployment.ui.PackageManagerDialog"); - rtl::OUString sArguments = UNISTRING("SHOW_UPDATE_DIALOG"); - uno::Reference< uno::XInterface > xService; - - if( ! m_xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheck::showExtensionDialog(): empty component context" ), uno::Reference< uno::XInterface > () ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_xContext->getServiceManager() ); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheck::showExtensionDialog(): unable to obtain service manager from component context" ), uno::Reference< uno::XInterface > () ); - - xService = xServiceManager->createInstanceWithContext( sServiceName, m_xContext ); - uno::Reference< task::XJobExecutor > xExecuteable( xService, uno::UNO_QUERY ); - if ( xExecuteable.is() ) - xExecuteable->trigger( sArguments ); -} - -//------------------------------------------------------------------------------ - -rtl::Reference -UpdateCheck::getUpdateHandler() -{ - osl::MutexGuard aGuard(m_aMutex); - - if( ! m_aUpdateHandler.is() ) - m_aUpdateHandler = new UpdateHandler(m_xContext, this); - - return m_aUpdateHandler; -} - -//------------------------------------------------------------------------------ - -uno::Reference< task::XInteractionHandler > -UpdateCheck::getInteractionHandler() const -{ - osl::MutexGuard aGuard(m_aMutex); - - uno::Reference< task::XInteractionHandler > xHandler; - - if( m_aUpdateHandler.is() && m_aUpdateHandler->isVisible() ) - xHandler = m_aUpdateHandler.get(); - - return xHandler; -} - -//------------------------------------------------------------------------------ - -uno::Reference< uno::XInterface > -UpdateCheck::createService(const rtl::OUString& rServiceName, - const uno::Reference& xContext) -{ - if( !xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckConfig: empty component context" ), - uno::Reference< uno::XInterface >() ); - - const uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckConfig: unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface >() ); - - return xServiceManager->createInstanceWithContext(rServiceName, xContext); -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheck::isDialogShowing() const -{ - osl::MutexGuard aGuard(m_aMutex); - return sal_True == m_aUpdateHandler.is() && m_aUpdateHandler->isVisible(); -}; - -//------------------------------------------------------------------------------ - -void -UpdateCheck::autoCheckStatusChanged(bool enabled) -{ - osl::ClearableMutexGuard aGuard(m_aMutex); - - if( (CHECK_SCHEDULED == m_eState) && !enabled ) - shutdownThread(false); - - if( (DISABLED == m_eState) || (CHECK_SCHEDULED == m_eState) ) - { - enableAutoCheck(enabled); - UpdateState eState = getUIState(m_aUpdateInfo); - aGuard.clear(); - setUIState(eState); - } -}; - -//------------------------------------------------------------------------------ - -void -UpdateCheck::autoCheckIntervalChanged() -{ - // just wake-up - m_aCondition.set(); -}; - -//------------------------------------------------------------------------------ - -oslInterlockedCount SAL_CALL -UpdateCheck::acquire() SAL_THROW(()) -{ - return ReferenceObject::acquire(); -} - -//------------------------------------------------------------------------------ - -oslInterlockedCount SAL_CALL -UpdateCheck::release() SAL_THROW(()) -{ - return ReferenceObject::release(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx deleted file mode 100644 index 00d3ede1f..000000000 --- a/extensions/source/update/check/updatecheck.hxx +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "updateinfo.hxx" -#include "updatecheckconfiglistener.hxx" -#include "actionlistener.hxx" -#include "updatehdl.hxx" -#include "download.hxx" - - -class UpdateCheck; -class UpdateCheckConfig; - -class UpdateCheckInitData { - -public: - inline rtl::Reference< UpdateCheck > SAL_CALL operator() () const; -}; - -class WorkerThread : public osl::Thread -{ -public: - virtual void SAL_CALL cancel() = 0; -}; - -class UpdateCheck : - public UpdateCheckConfigListener, - public IActionListener, - public DownloadInteractionHandler, - public salhelper::ReferenceObject, - public rtl::StaticWithInit< rtl::Reference< UpdateCheck >, UpdateCheckInitData > -{ - UpdateCheck() : m_eState(NOT_INITIALIZED), m_eUpdateState(UPDATESTATES_COUNT), m_pThread(NULL) {}; - -public: - inline SAL_CALL operator rtl::Reference< UpdateCheckConfigListener > () - { return static_cast< UpdateCheckConfigListener * > (this); } - - void initialize(const com::sun::star::uno::Sequence& rValues, - const com::sun::star::uno::Reference& xContext); - - /* Returns an instance of the specified service obtained from the specified - * component context - */ - - static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > createService( - const rtl::OUString& aServiceName, - const com::sun::star::uno::Reference& xContext); - - // Update internal update info member - void setUpdateInfo(const UpdateInfo& aInfo); - - /* This method turns on the menubar icon, triggers the bubble window or - * updates the dialog text when appropriate - */ - void setUIState(UpdateState eState, bool suppressBubble = false); - - // Returns the UI state that matches rInfo best - static UpdateState getUIState(const UpdateInfo& rInfo); - - // Check for updates failed - void setCheckFailedState(); - - // Executes the update check dialog for manual checks and downloads interaction - void showDialog(bool forceCheck = false); - - // Returns true if the update dialog is currently showing - bool isDialogShowing() const; - bool shouldShowExtUpdDlg() const { return ( m_bShowExtUpdDlg && m_bHasExtensionUpdate ); } - void showExtensionDialog(); - void setHasExtensionUpdates( bool bHasUpdates ) { m_bHasExtensionUpdate = bHasUpdates; } - bool hasOfficeUpdate() const { return (m_aUpdateInfo.BuildId.getLength() > 0); } - - // DownloadInteractionHandler - virtual bool downloadTargetExists(const rtl::OUString& rFileName); - virtual void downloadStalled(const rtl::OUString& rErrorMessage); - virtual void downloadProgressAt(sal_Int8 nProcent); - virtual void downloadStarted(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize); - virtual void downloadFinished(const rtl::OUString& rLocalFileName); - // checks if the download target already exists and asks user what to do next - virtual bool checkDownloadDestination( const rtl::OUString& rFile ); - - // Cancels the download action (and resumes checking if enabled) - void cancelDownload(); - - // Returns the XInteractionHandler of the UpdateHandler instance if present (and visible) - com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > getInteractionHandler() const; - - // UpdateCheckConfigListener - virtual void autoCheckStatusChanged(bool enabled); - virtual void autoCheckIntervalChanged(); - - // IActionListener - void cancel(); - void download(); - void install(); - void pause(); - void resume(); - void closeAfterFailure(); - - // rtl::IReference - virtual oslInterlockedCount SAL_CALL acquire() SAL_THROW(()); - virtual oslInterlockedCount SAL_CALL release() SAL_THROW(()); - -private: - - // Schedules or cancels next automatic check for updates - void enableAutoCheck(bool enable); - - // Starts/resumes or stops a download - void enableDownload(bool enable, bool paused=false); - - // Shuts down the currently running thread - void shutdownThread(bool join); - - // Returns the update handler instance - rtl::Reference getUpdateHandler(); - - // Open the given URL in a browser - void showReleaseNote(const rtl::OUString& rURL) const; - - // stores the release note url on disk to be used by setup app - static bool storeReleaseNote(sal_Int8 nNum, const rtl::OUString &rURL); - - /* This method turns on the menubar icon and triggers the bubble window - */ - void handleMenuBarUI( rtl::Reference< UpdateHandler > rUpdateHandler, - UpdateState& eState, bool suppressBubble ); - enum State { - NOT_INITIALIZED, - DISABLED, - CHECK_SCHEDULED, - DOWNLOADING, - DOWNLOAD_PAUSED - }; - - State m_eState; - UpdateState m_eUpdateState; - - mutable osl::Mutex m_aMutex; - WorkerThread *m_pThread; - osl::Condition m_aCondition; - - UpdateInfo m_aUpdateInfo; - rtl::OUString m_aImageName; - bool m_bHasExtensionUpdate; - bool m_bShowExtUpdDlg; - - rtl::Reference m_aUpdateHandler; - com::sun::star::uno::Reference m_xMenuBarUI; - com::sun::star::uno::Reference m_xContext; - - friend class UpdateCheckInitData; -}; - -inline rtl::Reference< UpdateCheck > SAL_CALL -UpdateCheckInitData::operator() () const -{ - return rtl::Reference< UpdateCheck > (new UpdateCheck()); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx deleted file mode 100644 index 99dab40e0..000000000 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ /dev/null @@ -1,812 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include "updatecheckconfig.hxx" -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef WNT -#ifdef _MSC_VER -#pragma warning(push,1) // disable warnings within system headers -#pragma warning(disable: 4917) -#endif -#include -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif - -namespace container = com::sun::star::container ; -namespace beans = com::sun::star::beans ; -namespace lang = com::sun::star::lang ; -namespace util = com::sun::star::util ; -namespace uno = com::sun::star::uno ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -#define LAST_CHECK "LastCheck" -#define VERSION_FOUND "UpdateVersionFound" -#define UPDATE_VERSION "UpdateVersion" -#define UPDATE_BUILDID "UpdateBuildId" -#define UPDATE_DESCRIPTION "UpdateDescription" -#define DOWNLOAD_URL "DownloadURL" -#define IS_DIRECT_DOWNLOAD "IsDirectDownload" -#define OLD_VERSION "UpdateFoundFor" -#define AUTOCHECK_ENABLED "AutoCheckEnabled" -#define AUTODOWNLOAD_ENABLED "AutoDownloadEnabled" -#define CHECK_INTERVAL "CheckInterval" -#define LOCAL_FILE "LocalFile" -#define DOWNLOAD_SIZE "DownloadSize" -#define DOWNLOAD_PAUSED "DownloadPaused" -#define DOWNLOAD_DESTINATION "DownloadDestination" -#define RELEASE_NOTE "ReleaseNote" -#define EXTENSION_PREFIX "Extension_" - -#define PROPERTY_VERSION UNISTRING("Version") - -static const sal_Char * const aUpdateEntryProperties[] = { - UPDATE_VERSION, - UPDATE_BUILDID, - UPDATE_DESCRIPTION, - DOWNLOAD_URL, - IS_DIRECT_DOWNLOAD, - RELEASE_NOTE"1", - RELEASE_NOTE"2", - RELEASE_NOTE"3", - RELEASE_NOTE"4", - RELEASE_NOTE"5", - OLD_VERSION -}; - -static const sal_uInt32 nUpdateEntryProperties = SAL_N_ELEMENTS(aUpdateEntryProperties); - -//------------------------------------------------------------------------------ - -NamedValueByNameAccess::~NamedValueByNameAccess() -{ -} - -//------------------------------------------------------------------------------ - -::com::sun::star::uno::Any -NamedValueByNameAccess::getValue(const sal_Char * pName) -{ - const sal_Int32 nLen = m_rValues.getLength(); - for( sal_Int32 n=0; n < nLen; ++n ) - { - if( m_rValues[n].Name.equalsAscii( pName ) ) - return m_rValues[n].Value; - } - return ::com::sun::star::uno::Any(); -} - - -//------------------------------------------------------------------------------ - -bool -UpdateCheckROModel::isAutoCheckEnabled() const -{ - return sal_True == m_aNameAccess.getValue(AUTOCHECK_ENABLED).get< sal_Bool >(); -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheckROModel::isDownloadPaused() const -{ - return sal_True == m_aNameAccess.getValue(DOWNLOAD_PAUSED).get< sal_Bool >(); -} - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckROModel::getStringValue(const sal_Char * pStr) const -{ - uno::Any aAny( m_aNameAccess.getValue(pStr) ); - rtl::OUString aRet; - - aAny >>= aRet; - - return aRet; -} - -//------------------------------------------------------------------------------ - -rtl::OUString UpdateCheckROModel::getLocalFileName() const -{ - return getStringValue(LOCAL_FILE); -}; - -//------------------------------------------------------------------------------ - -sal_Int64 UpdateCheckROModel::getDownloadSize() const -{ - uno::Any aAny( m_aNameAccess.getValue(DOWNLOAD_SIZE) ); - sal_Int64 nRet = -1; - - aAny >>= nRet; - return nRet; -}; - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckROModel::getUpdateEntryVersion() const -{ - return getStringValue(OLD_VERSION); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const -{ - rInfo.BuildId = getStringValue(UPDATE_BUILDID); - rInfo.Version = getStringValue(UPDATE_VERSION); - rInfo.Description = getStringValue(UPDATE_DESCRIPTION); - - sal_Bool isDirectDownload = sal_False; - m_aNameAccess.getValue(IS_DIRECT_DOWNLOAD) >>= isDirectDownload; - - rInfo.Sources.push_back( DownloadSource( isDirectDownload, getStringValue(DOWNLOAD_URL) ) ); - - rtl::OString aStr(RELEASE_NOTE); - for(sal_Int32 n=1; n < 6; ++n ) - { - rtl::OUString aUStr = getStringValue(aStr + rtl::OString::valueOf(n)); - if( aUStr.getLength() > 0 ) - rInfo.ReleaseNotes.push_back(ReleaseNote((sal_Int8) n, aUStr)); - } -} - - -//------------------------------------------------------------------------------ - -rtl::OUString UpdateCheckConfig::getDesktopDirectory() -{ - rtl::OUString aRet; - -#ifdef WNT - WCHAR szPath[MAX_PATH]; - - if( ! FAILED( SHGetSpecialFolderPathW( NULL, szPath, CSIDL_DESKTOPDIRECTORY, true ) ) ) - { - aRet = rtl::OUString( reinterpret_cast< sal_Unicode * >(szPath) ); - osl::FileBase::getFileURLFromSystemPath( aRet, aRet ); - } -#else - // This should become a desktop specific setting in some system backend .. - rtl::OUString aHomeDir; - osl::Security().getHomeDir( aHomeDir ); - aRet = aHomeDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/Desktop")); - - // Set path to home directory when there is no /Desktop directory - osl::Directory aDocumentsDir( aRet ); - if( osl::FileBase::E_None != aDocumentsDir.open() ) - aRet = aHomeDir; -#endif - - return aRet; -} - -//------------------------------------------------------------------------------ - -rtl::OUString UpdateCheckConfig::getAllUsersDirectory() -{ - rtl::OUString aRet; - -#ifdef WNT - WCHAR szPath[MAX_PATH]; - - if( ! FAILED( SHGetSpecialFolderPathW( NULL, szPath, CSIDL_COMMON_DOCUMENTS, true ) ) ) - { - aRet = rtl::OUString( reinterpret_cast< sal_Unicode * >(szPath) ); - osl::FileBase::RC rc; - rc = osl::FileBase::getFileURLFromSystemPath( aRet, aRet ); - } -#else - osl::FileBase::getTempDirURL(aRet); -#endif - - return aRet; -} - -//------------------------------------------------------------------------------ -UpdateCheckConfig::UpdateCheckConfig( const uno::Reference& xContainer, - const uno::Reference& xAvailableUpdates, - const uno::Reference& xIgnoredUpdates, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener ) : - m_xContainer( xContainer ), - m_xAvailableUpdates( xAvailableUpdates ), - m_xIgnoredUpdates( xIgnoredUpdates ), - m_rListener( rListener ) -{} - -//------------------------------------------------------------------------------ -UpdateCheckConfig::~UpdateCheckConfig() -{} - -//------------------------------------------------------------------------------ - -::rtl::Reference< UpdateCheckConfig > -UpdateCheckConfig::get( - const uno::Reference& xContext, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener) -{ - if( !xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckConfig: empty component context" ), - uno::Reference< uno::XInterface >() ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckConfig: unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface >() ); - - uno::Reference< lang::XMultiServiceFactory > xConfigProvider( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" ), xContext ), - uno::UNO_QUERY_THROW); - - beans::PropertyValue aProperty; - aProperty.Name = UNISTRING( "nodepath" ); - aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Office.Jobs/Jobs/UpdateCheck/Arguments") ); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] = uno::makeAny( aProperty ); - - uno::Reference< container::XNameContainer > xContainer( - xConfigProvider->createInstanceWithArguments( - UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), - uno::UNO_QUERY_THROW ); - - aProperty.Value = uno::makeAny( UNISTRING("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates") ); - aArgumentList[0] = uno::makeAny( aProperty ); - uno::Reference< container::XNameContainer > xIgnoredExt( xConfigProvider->createInstanceWithArguments( UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), uno::UNO_QUERY_THROW ); - - aProperty.Value = uno::makeAny( UNISTRING("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/AvailableUpdates") ); - aArgumentList[0] = uno::makeAny( aProperty ); - uno::Reference< container::XNameContainer > xUpdateAvail( xConfigProvider->createInstanceWithArguments( UNISTRING("com.sun.star.configuration.ConfigurationUpdateAccess"), aArgumentList ), uno::UNO_QUERY_THROW ); - - return new UpdateCheckConfig( xContainer, xUpdateAvail, xIgnoredExt, rListener ); -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheckConfig::isAutoCheckEnabled() const -{ - sal_Bool nValue = sal_False; - const_cast < UpdateCheckConfig *> (this)->getByName( UNISTRING( AUTOCHECK_ENABLED ) ) >>= nValue; - return nValue; -} - -//------------------------------------------------------------------------------ - -bool -UpdateCheckConfig::isAutoDownloadEnabled() const -{ - sal_Bool nValue = sal_False; - const_cast < UpdateCheckConfig *> (this)->getByName( UNISTRING( AUTODOWNLOAD_ENABLED ) ) >>= nValue; - return nValue; -} - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckConfig::getUpdateEntryVersion() const -{ - rtl::OUString aValue; - - // getByName is defined as non const in XNameAccess - const_cast < UpdateCheckConfig *> (this)->getByName( UNISTRING( OLD_VERSION ) ) >>= aValue; - - return aValue; -} - -//------------------------------------------------------------------------------ - -sal_Int64 -UpdateCheckConfig::getLastChecked() const -{ - sal_Int64 nValue = 0; - - // getByName is defined as non const in XNameAccess - const_cast < UpdateCheckConfig *> (this)->getByName( UNISTRING( LAST_CHECK ) ) >>= nValue; - - return nValue; -} - -//------------------------------------------------------------------------------ - -sal_Int64 -UpdateCheckConfig::getCheckInterval() const -{ - sal_Int64 nValue = 0; - - // getByName is defined as non const in XNameAccess - const_cast < UpdateCheckConfig *> (this)->getByName( UNISTRING( CHECK_INTERVAL ) ) >>= nValue; - - return nValue; -} - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckConfig::getLocalFileName() const -{ - rtl::OUString aName = UNISTRING(LOCAL_FILE); - rtl::OUString aRet; - - if( m_xContainer->hasByName(aName) ) - m_xContainer->getByName(aName) >>= aRet; - - return aRet; -} - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckConfig::getDownloadDestination() const -{ - rtl::OUString aName = UNISTRING(DOWNLOAD_DESTINATION); - rtl::OUString aRet; - - const_cast (this)->getByName(aName) >>= aRet; - - return aRet; -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::storeLocalFileName(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize) -{ - const sal_uInt8 nItems = 2; - const rtl::OUString aNameList[nItems] = { UNISTRING(LOCAL_FILE), UNISTRING(DOWNLOAD_SIZE) }; - const uno::Any aValueList[nItems] = { uno::makeAny(rLocalFileName), uno::makeAny(nFileSize) }; - - for( sal_uInt8 i=0; i < nItems; ++i ) - { - if( m_xContainer->hasByName(aNameList[i]) ) - m_xContainer->replaceByName(aNameList[i], aValueList[i]); - else - m_xContainer->insertByName(aNameList[i], aValueList[i]); - } - - commitChanges(); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::clearLocalFileName() -{ - const sal_uInt8 nItems = 2; - const rtl::OUString aNameList[nItems] = { UNISTRING(LOCAL_FILE), UNISTRING(DOWNLOAD_SIZE) }; - - for( sal_uInt8 i=0; i < nItems; ++i ) - { - if( m_xContainer->hasByName(aNameList[i]) ) - m_xContainer->removeByName(aNameList[i]); - } - - commitChanges(); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::storeDownloadPaused(bool paused) -{ - replaceByName(UNISTRING(DOWNLOAD_PAUSED) , uno::makeAny(paused)); - commitChanges(); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::updateLastChecked() -{ - TimeValue systime; - osl_getSystemTime(&systime); - - sal_Int64 lastCheck = systime.Seconds; - - replaceByName(UNISTRING(LAST_CHECK), uno::makeAny(lastCheck)); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::storeUpdateFound( const UpdateInfo& rInfo, const rtl::OUString& aCurrentBuild) - -{ - bool autoDownloadEnabled = isAutoDownloadEnabled(); - - uno::Any aValues[nUpdateEntryProperties] = - { - uno::makeAny(rInfo.Version), - uno::makeAny(rInfo.BuildId), - uno::makeAny(rInfo.Description), - uno::makeAny(rInfo.Sources[0].URL), - uno::makeAny(rInfo.Sources[0].IsDirect ? sal_True : sal_False), - uno::makeAny(getReleaseNote(rInfo, 1, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 2, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 3, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 4, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 5, autoDownloadEnabled) ), - uno::makeAny(aCurrentBuild) - }; - - rtl::OUString aName; - for( sal_uInt32 n=0; n < nUpdateEntryProperties; ++n ) - { - aName = rtl::OUString::createFromAscii(aUpdateEntryProperties[n]); - - if( m_xContainer->hasByName(aName) ) - m_xContainer->replaceByName(aName, aValues[n]); - else - m_xContainer->insertByName(aName,aValues[n]); - } - - commitChanges(); -} - -//------------------------------------------------------------------------------ - -void -UpdateCheckConfig::clearUpdateFound() -{ - rtl::OUString aName; - - for( sal_uInt32 n=0; n < nUpdateEntryProperties; ++n ) - { - aName = rtl::OUString::createFromAscii(aUpdateEntryProperties[n]); - - try { - if( m_xContainer->hasByName(aName) ) - m_xContainer->removeByName(aName); - } catch(const lang::WrappedTargetException& ) { - // Can not remove value, probably in share layer - OSL_ASSERT(false); - m_xContainer->replaceByName(aName, uno::makeAny(rtl::OUString())); - } - } - - /* As we have removed UpdateVersionFound from the shared configuration - * existing entries in the user layer do not have a oor operation and - * thus are completly ignored (which also means they can not be removed). - */ - - commitChanges(); -} - -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > -UpdateCheckConfig::getServiceNames() -{ - uno::Sequence< rtl::OUString > aServiceList(1); - aServiceList[0] = UNISTRING( "com.sun.star.setup.UpdateCheckConfig"); - return aServiceList; -} - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckConfig::getImplName() -{ - return UNISTRING( "vnd.sun.UpdateCheckConfig"); -} - -//------------------------------------------------------------------------------ - -uno::Type SAL_CALL -UpdateCheckConfig::getElementType() throw (uno::RuntimeException) -{ - return m_xContainer->getElementType(); -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateCheckConfig::hasElements() throw (uno::RuntimeException) -{ - return m_xContainer->hasElements(); -} - -//------------------------------------------------------------------------------ - -uno::Any SAL_CALL -UpdateCheckConfig::getByName( const ::rtl::OUString& aName ) - throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Any aValue = m_xContainer->getByName( aName ); - - // Provide dynamic default value - if( aName.equalsAscii(DOWNLOAD_DESTINATION) ) - { - rtl::OUString aStr; - aValue >>= aStr; - - if( aStr.getLength() == 0 ) - aValue = uno::makeAny(getDesktopDirectory()); - } - - return aValue; -} - -//------------------------------------------------------------------------------ - -uno::Sequence< ::rtl::OUString > SAL_CALL -UpdateCheckConfig::getElementNames( ) throw (uno::RuntimeException) -{ - return m_xContainer->getElementNames(); -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateCheckConfig::hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -{ - return m_xContainer->hasByName( aName ); -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateCheckConfig::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) - throw (lang::IllegalArgumentException, container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) -{ - return m_xContainer->replaceByName( aName, aElement ); -} - -//------------------------------------------------------------------------------ -// XChangesBatch - -void SAL_CALL -UpdateCheckConfig::commitChanges() - throw (lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Reference< util::XChangesBatch > xChangesBatch(m_xContainer, uno::UNO_QUERY); - if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) - { - util::ChangesSet aChangesSet = xChangesBatch->getPendingChanges(); - xChangesBatch->commitChanges(); - - if( m_rListener.is() ) - { - const sal_Int32 nChanges = aChangesSet.getLength(); - rtl::OUString aString; - - for( sal_Int32 i=0; i>= aString; - - // FIXME: use non IgnoreAsciiCase version as soon as it becomes available - if( aString.endsWithIgnoreAsciiCaseAsciiL(AUTOCHECK_ENABLED "']", sizeof(AUTOCHECK_ENABLED)+1) ) - { - sal_Bool bEnabled = sal_False; - aChangesSet[i].Element >>= bEnabled; - m_rListener->autoCheckStatusChanged(sal_True == bEnabled); - } - // FIXME: use non IgnoreAsciiCase version as soon as it becomes available - else if( aString.endsWithIgnoreAsciiCaseAsciiL(CHECK_INTERVAL "']", sizeof(CHECK_INTERVAL)+1) ) - { - m_rListener->autoCheckIntervalChanged(); - } - } - } - } - - xChangesBatch = uno::Reference< util::XChangesBatch > ( m_xAvailableUpdates, uno::UNO_QUERY ); - if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) - { - util::ChangesSet aChangesSet = xChangesBatch->getPendingChanges(); - xChangesBatch->commitChanges(); - } - xChangesBatch = uno::Reference< util::XChangesBatch > ( m_xIgnoredUpdates, uno::UNO_QUERY ); - if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) - { - util::ChangesSet aChangesSet = xChangesBatch->getPendingChanges(); - xChangesBatch->commitChanges(); - } -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateCheckConfig::hasPendingChanges( ) throw (uno::RuntimeException) -{ - uno::Reference< util::XChangesBatch > xChangesBatch(m_xContainer, uno::UNO_QUERY); - if( xChangesBatch.is() ) - return xChangesBatch->hasPendingChanges(); - - return sal_False; -} - -//------------------------------------------------------------------------------ - -uno::Sequence< util::ElementChange > SAL_CALL -UpdateCheckConfig::getPendingChanges( ) throw (uno::RuntimeException) -{ - uno::Reference< util::XChangesBatch > xChangesBatch(m_xContainer, uno::UNO_QUERY); - if( xChangesBatch.is() ) - return xChangesBatch->getPendingChanges(); - - return uno::Sequence< util::ElementChange >(); -} - -//------------------------------------------------------------------------------ -bool UpdateCheckConfig::storeExtensionVersion( const rtl::OUString& rExtensionName, - const rtl::OUString& rVersion ) -{ - bool bNotify = true; - - if ( m_xAvailableUpdates->hasByName( rExtensionName ) ) - uno::Reference< beans::XPropertySet >( m_xAvailableUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->setPropertyValue( PROPERTY_VERSION, uno::Any( rVersion ) ); - else - { - uno::Reference< beans::XPropertySet > elem( uno::Reference< lang::XSingleServiceFactory >( m_xAvailableUpdates, uno::UNO_QUERY_THROW )->createInstance(), uno::UNO_QUERY_THROW ); - elem->setPropertyValue( PROPERTY_VERSION, uno::Any( rVersion ) ); - m_xAvailableUpdates->insertByName( rExtensionName, uno::Any( elem ) ); - } - - if ( m_xIgnoredUpdates->hasByName( rExtensionName ) ) - { - ::rtl::OUString aIgnoredVersion; - uno::Any aValue( uno::Reference< beans::XPropertySet >( m_xIgnoredUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); - aValue >>= aIgnoredVersion; - if ( aIgnoredVersion.getLength() == 0 ) // no version means ignore all updates - bNotify = false; - else if ( aIgnoredVersion == rVersion ) // the user wanted to ignore this update - bNotify = false; - } - - commitChanges(); - - return bNotify; -} - -//------------------------------------------------------------------------------ -bool UpdateCheckConfig::checkExtensionVersion( const rtl::OUString& rExtensionName, - const rtl::OUString& rVersion ) -{ - if ( m_xAvailableUpdates->hasByName( rExtensionName ) ) - { - ::rtl::OUString aStoredVersion; - uno::Any aValue( uno::Reference< beans::XPropertySet >( m_xAvailableUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); - aValue >>= aStoredVersion; - - if ( m_xIgnoredUpdates->hasByName( rExtensionName ) ) - { - ::rtl::OUString aIgnoredVersion; - uno::Any aValue2( uno::Reference< beans::XPropertySet >( m_xIgnoredUpdates->getByName( rExtensionName ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); - aValue2 >>= aIgnoredVersion; - if ( aIgnoredVersion.getLength() == 0 ) // no version means ignore all updates - return false; - else if ( aIgnoredVersion == aStoredVersion ) // the user wanted to ignore this update - return false; - // TODO: else delete ignored entry? - } - if ( isVersionGreater( rVersion, aStoredVersion ) ) - return true; - else - { - m_xAvailableUpdates->removeByName( rExtensionName ); - commitChanges(); - } - } - - return false; -} - -//------------------------------------------------------------------------------ -rtl::OUString UpdateCheckConfig::getSubVersion( const rtl::OUString& rVersion, - sal_Int32 *nIndex ) -{ - while ( *nIndex < rVersion.getLength() && rVersion[*nIndex] == '0') - { - ++*nIndex; - } - - return rVersion.getToken( 0, '.', *nIndex ); -} - -//------------------------------------------------------------------------------ -// checks if the second version string is greater than the first one - -bool UpdateCheckConfig::isVersionGreater( const rtl::OUString& rVersion1, - const rtl::OUString& rVersion2 ) -{ - for ( sal_Int32 i1 = 0, i2 = 0; i1 >= 0 || i2 >= 0; ) - { - ::rtl::OUString sSub1( getSubVersion( rVersion1, &i1 ) ); - ::rtl::OUString sSub2( getSubVersion( rVersion2, &i2 ) ); - - if ( sSub1.getLength() < sSub2.getLength() ) { - return true; - } else if ( sSub1.getLength() > sSub2.getLength() ) { - return false; - } else if ( sSub1 < sSub2 ) { - return true; - } else if ( sSub1 > sSub2 ) { - return false; - } - } - return false; -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL -UpdateCheckConfig::getImplementationName() throw (uno::RuntimeException) -{ - return getImplName(); -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateCheckConfig::supportsService(rtl::OUString const & serviceName) - throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > aServiceNameList = getServiceNames(); - - for( sal_Int32 n=0; n < aServiceNameList.getLength(); n++ ) - if( aServiceNameList[n].equals(serviceName) ) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > SAL_CALL -UpdateCheckConfig::getSupportedServiceNames() throw (uno::RuntimeException) -{ - return getServiceNames(); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx deleted file mode 100644 index 4266159a8..000000000 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ /dev/null @@ -1,245 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "updatecheckconfiglistener.hxx" -#include "updateinfo.hxx" - -/* Interface to acess configuration data read-only */ -struct IByNameAccess -{ - virtual ::com::sun::star::uno::Any getValue(const sal_Char * pName) = 0; -}; - -/* This helper class provides by name access to a sequence of named values */ -class NamedValueByNameAccess : public IByNameAccess -{ - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& m_rValues; - -public: - NamedValueByNameAccess( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rValues) : - m_rValues(rValues) {} ; - - virtual ~NamedValueByNameAccess(); - - virtual ::com::sun::star::uno::Any getValue(const sal_Char * pName); -}; - - -/* This class encapsulates the configuration item actually used for storing the state - * the update check is actually in. - */ -class UpdateCheckROModel -{ -public: - UpdateCheckROModel(IByNameAccess& aNameAccess) : m_aNameAccess(aNameAccess) {}; - - bool isAutoCheckEnabled() const; - bool isDownloadPaused() const; - rtl::OUString getLocalFileName() const; - sal_Int64 getDownloadSize() const; - - rtl::OUString getUpdateEntryVersion() const; - void getUpdateEntry(UpdateInfo& rInfo) const; - -private: - - rtl::OUString getStringValue(const sal_Char *) const; - - IByNameAccess& m_aNameAccess; -}; - - - -/* This class implements the non published UNO service com.sun.star.setup.UpdateCheckConfig, - * which primary use is to be able to track changes done in the Toos -> Options page of this - * component, as this is not supported by the OOo configuration for extendable groups. - */ - -class UpdateCheckConfig : public ::cppu::WeakImplHelper3< - ::com::sun::star::container::XNameReplace, - ::com::sun::star::util::XChangesBatch, - ::com::sun::star::lang::XServiceInfo > -{ - UpdateCheckConfig( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xContainer, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAvailableUpdates, - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xIgnoredUpdates, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener ); - - virtual ~UpdateCheckConfig(); - -public: - - static ::com::sun::star::uno::Sequence< rtl::OUString > getServiceNames(); - static rtl::OUString getImplName(); - - static ::rtl::Reference< UpdateCheckConfig > get( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, - const ::rtl::Reference< UpdateCheckConfigListener >& rListener = ::rtl::Reference< UpdateCheckConfigListener >()); - - // Should really implement ROModel .. - bool isAutoCheckEnabled() const; - bool isAutoDownloadEnabled() const; - rtl::OUString getUpdateEntryVersion() const; - - /* Updates the timestamp of last check, but does not commit the change - * as either clearUpdateFound() or setUpdateFound() are expected to get - * called next. - */ - void updateLastChecked(); - - /* Returns the date of the last successful check in seconds since 1970 */ - sal_Int64 getLastChecked() const; - - /* Returns configured check interval in seconds */ - sal_Int64 getCheckInterval() const; - - /* Reset values of previously remembered update - */ - void clearUpdateFound(); - - /* Stores the specified data of an available update - */ - void storeUpdateFound(const UpdateInfo& rInfo, const rtl::OUString& aCurrentBuild); - - // Returns the local file name of a started download - rtl::OUString getLocalFileName() const; - - // Returns the local file name of a started download - rtl::OUString getDownloadDestination() const; - - // stores the local file name of a just started download - void storeLocalFileName(const rtl::OUString& rFileName, sal_Int64 nFileSize); - - // Removes the local file name of a download - void clearLocalFileName(); - - // Stores the bool value for manually paused downloads - void storeDownloadPaused(bool paused); - - // Returns the directory that acts as the user's desktop - static rtl::OUString getDesktopDirectory(); - - // Returns a directory accessible for all users - static rtl::OUString getAllUsersDirectory(); - - // store and retrieve information about extensions - bool storeExtensionVersion( const rtl::OUString& rExtensionName, - const rtl::OUString& rVersion ); - bool checkExtensionVersion( const rtl::OUString& rExtensionName, - const rtl::OUString& rVersion ); - - // 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); - - // 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); - - // 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); - - // XChangesBatch - virtual void SAL_CALL commitChanges( ) - throw (::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasPendingChanges( ) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::util::ElementChange > SAL_CALL getPendingChanges( ) - 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(rtl::OUString const & serviceName) - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException); - -private: - - static rtl::OUString getSubVersion( const rtl::OUString& rVersion, sal_Int32 *nIndex ); - static bool isVersionGreater( const rtl::OUString& rVersion1, const rtl::OUString& rVersion2 ); - - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xContainer; - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xAvailableUpdates; - const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xIgnoredUpdates; - const ::rtl::Reference< UpdateCheckConfigListener > m_rListener; -}; - -//------------------------------------------------------------------------------ - - -template -T getValue( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rNamedValues, const sal_Char * pszName ) - throw (::com::sun::star::uno::RuntimeException) -{ - for( sal_Int32 n=0; n < rNamedValues.getLength(); n++ ) - { - // Unfortunatly gcc-3.3 does not like Any.get(); - if( rNamedValues[n].Name.equalsAscii( pszName ) ) - { - T value = T(); - if( ! (rNamedValues[n].Value >>= value) ) - throw ::com::sun::star::uno::RuntimeException( - ::rtl::OUString( - cppu_Any_extraction_failure_msg( - &rNamedValues[n].Value, - ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ), - SAL_NO_ACQUIRE ), - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); - - return value; - } - } - - return T(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckconfiglistener.hxx b/extensions/source/update/check/updatecheckconfiglistener.hxx deleted file mode 100644 index d0c79eb65..000000000 --- a/extensions/source/update/check/updatecheckconfiglistener.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#ifndef _UPDATECHECKCONFIGLISTENER_HXX_ -#define _UPDATECHECKCONFIGLISTENER_HXX_ - -/* This interface should be implemented by classes acting - * as controller (as in the MVC pattern). - */ - -struct UpdateCheckConfigListener : public rtl::IReference -{ - virtual void autoCheckStatusChanged(bool enabled) = 0; - virtual void autoCheckIntervalChanged() = 0; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx deleted file mode 100644 index e2e85d308..000000000 --- a/extensions/source/update/check/updatecheckjob.cxx +++ /dev/null @@ -1,393 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -#include "updatecheck.hxx" -#include "updatecheckconfig.hxx" -#include "updatehdl.hxx" -#include "updateprotocol.hxx" - -#include -#include - -#include "com/sun/star/frame/XDesktop.hpp" -#include "com/sun/star/frame/XTerminateListener.hpp" -#include - -namespace beans = com::sun::star::beans ; -namespace frame = com::sun::star::frame ; -namespace lang = com::sun::star::lang ; -namespace task = com::sun::star::task ; -namespace uno = com::sun::star::uno ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -namespace -{ - -class InitUpdateCheckJobThread : public osl::Thread -{ -public: - InitUpdateCheckJobThread( const uno::Reference< uno::XComponentContext > &xContext, - const uno::Sequence< beans::NamedValue > &xParameters, - bool bShowDialog ); - - virtual void SAL_CALL run(); - - void setTerminating(); - -private: - osl::Condition m_aCondition; - uno::Reference m_xContext; - uno::Sequence m_xParameters; - bool m_bShowDialog; - bool m_bTerminating; -}; - -class UpdateCheckJob : - public ::cppu::WeakImplHelper3< task::XJob, lang::XServiceInfo, frame::XTerminateListener > -{ - virtual ~UpdateCheckJob(); - -public: - - UpdateCheckJob(const uno::Reference& xContext); - - static uno::Sequence< rtl::OUString > getServiceNames(); - static rtl::OUString getImplName(); - - // Allows runtime exceptions to be thrown by const methods - inline SAL_CALL operator uno::Reference< uno::XInterface > () const - { return const_cast< cppu::OWeakObject * > (static_cast< cppu::OWeakObject const * > (this)); }; - - // XJob - virtual uno::Any SAL_CALL execute(const uno::Sequence&) - throw (lang::IllegalArgumentException, uno::Exception); - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() - throw (uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName) - throw (uno::RuntimeException); - virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (uno::RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) - throw (::com::sun::star::uno::RuntimeException); - - // XTerminateListener - virtual void SAL_CALL queryTermination( lang::EventObject const & evt ) - throw ( frame::TerminationVetoException, uno::RuntimeException ); - virtual void SAL_CALL notifyTermination( lang::EventObject const & evt ) - throw ( uno::RuntimeException ); - -private: - uno::Reference m_xContext; - uno::Reference< frame::XDesktop > m_xDesktop; - std::auto_ptr< InitUpdateCheckJobThread > m_pInitThread; - - void handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ); -}; - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -InitUpdateCheckJobThread::InitUpdateCheckJobThread( - const uno::Reference< uno::XComponentContext > &xContext, - const uno::Sequence< beans::NamedValue > &xParameters, - bool bShowDialog ) : - m_xContext( xContext ), - m_xParameters( xParameters ), - m_bShowDialog( bShowDialog ), - m_bTerminating( false ) -{ - create(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL InitUpdateCheckJobThread::run() -{ - if (!m_bShowDialog) { - TimeValue tv = { 25, 0 }; - m_aCondition.wait( &tv ); - if ( m_bTerminating ) - return; - } - - rtl::Reference< UpdateCheck > aController( UpdateCheck::get() ); - aController->initialize( m_xParameters, m_xContext ); - - if ( m_bShowDialog ) - aController->showDialog( true ); -} - -void InitUpdateCheckJobThread::setTerminating() { - m_bTerminating = true; - m_aCondition.set(); -} - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -UpdateCheckJob::UpdateCheckJob( const uno::Reference& xContext ) : - m_xContext(xContext) -{ - m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( UNISTRING("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener( this ); -} - -//------------------------------------------------------------------------------ - -UpdateCheckJob::~UpdateCheckJob() -{ -} - -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > -UpdateCheckJob::getServiceNames() -{ - uno::Sequence< rtl::OUString > aServiceList(1); - aServiceList[0] = UNISTRING( "com.sun.star.setup.UpdateCheck"); - return aServiceList; -}; - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateCheckJob::getImplName() -{ - return UNISTRING( "vnd.sun.UpdateCheck"); -} - - -//------------------------------------------------------------------------------ - -uno::Any -UpdateCheckJob::execute(const uno::Sequence& namedValues) - throw (lang::IllegalArgumentException, uno::Exception) -{ - for ( sal_Int32 n=namedValues.getLength(); n-- > 0; ) - { - if ( namedValues[ n ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DynamicData" ) ) ) - { - uno::Sequence aListProp; - if ( namedValues[n].Value >>= aListProp ) - { - for ( sal_Int32 i=aListProp.getLength(); i-- > 0; ) - { - if ( aListProp[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "updateList" ) ) ) - { - handleExtensionUpdates( aListProp ); - return uno::Any(); - } - } - } - } - } - - uno::Sequence aConfig = - getValue< uno::Sequence > (namedValues, "JobConfig"); - - /* Determine the way we got invoked here - - * see Developers Guide Chapter "4.7.2 Jobs" to understand the magic - */ - - uno::Sequence aEnvironment = - getValue< uno::Sequence > (namedValues, "Environment"); - - rtl::OUString aEventName = getValue< rtl::OUString > (aEnvironment, "EventName"); - - m_pInitThread.reset( - new InitUpdateCheckJobThread( - m_xContext, aConfig, - !aEventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("onFirstVisibleTask")))); - - return uno::Any(); -} - -//------------------------------------------------------------------------------ -void UpdateCheckJob::handleExtensionUpdates( const uno::Sequence< beans::NamedValue > &rListProp ) -{ - try { - uno::Sequence< uno::Sequence< rtl::OUString > > aList = - getValue< uno::Sequence< uno::Sequence< rtl::OUString > > > ( rListProp, "updateList" ); - bool bPrepareOnly = getValue< bool > ( rListProp, "prepareOnly" ); - - // we will first store any new found updates and then check, if there are any - // pending updates. - storeExtensionUpdateInfos( m_xContext, aList ); - - if ( bPrepareOnly ) - return; - - bool bHasUpdates = checkForPendingUpdates( m_xContext ); - - rtl::Reference aController( UpdateCheck::get() ); - if ( ! aController.is() ) - return; - - aController->setHasExtensionUpdates( bHasUpdates ); - - if ( ! aController->hasOfficeUpdate() ) - { - if ( bHasUpdates ) - aController->setUIState( UPDATESTATE_EXT_UPD_AVAIL, true ); - else - aController->setUIState( UPDATESTATE_NO_UPDATE_AVAIL, true ); - } - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - } -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL -UpdateCheckJob::getImplementationName() throw (uno::RuntimeException) -{ - return getImplName(); -} - -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > SAL_CALL -UpdateCheckJob::getSupportedServiceNames() throw (uno::RuntimeException) -{ - return getServiceNames(); -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateCheckJob::supportsService( rtl::OUString const & serviceName ) throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > aServiceNameList = getServiceNames(); - - for( sal_Int32 n=0; n < aServiceNameList.getLength(); n++ ) - if( aServiceNameList[n].equals(serviceName) ) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------------ -// XEventListener -void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) - throw ( uno::RuntimeException ) -{ - bool shutDown = ( rEvt.Source == m_xDesktop ); - - if ( shutDown && m_xDesktop.is() ) - { - m_xDesktop->removeTerminateListener( this ); - m_xDesktop.clear(); - } -} - -//------------------------------------------------------------------------------ -// XTerminateListener -void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) - throw ( frame::TerminationVetoException, uno::RuntimeException ) -{ -} - -//------------------------------------------------------------------------------ -void SAL_CALL UpdateCheckJob::notifyTermination( lang::EventObject const & ) - throw ( uno::RuntimeException ) -{ - if ( m_pInitThread.get() != 0 ) - { - m_pInitThread->setTerminating(); - m_pInitThread->join(); - } -} - -} // anonymous namespace - -//------------------------------------------------------------------------------ - -static uno::Reference SAL_CALL -createJobInstance(const uno::Reference& xContext) -{ - return *new UpdateCheckJob(xContext); -} - -//------------------------------------------------------------------------------ - -static uno::Reference SAL_CALL -createConfigInstance(const uno::Reference& xContext) -{ - return *UpdateCheckConfig::get(xContext, *UpdateCheck::get()); -} - -//------------------------------------------------------------------------------ - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createJobInstance, - UpdateCheckJob::getImplName, - UpdateCheckJob::getServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { - createConfigInstance, - UpdateCheckConfig::getImplName, - UpdateCheckConfig::getServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; - -//------------------------------------------------------------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char *pszImplementationName, void *pServiceManager, void *pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pszImplementationName, - pServiceManager, - pRegistryKey, - kImplementations_entries) ; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx deleted file mode 100644 index 36958e09c..000000000 --- a/extensions/source/update/check/updatehdl.cxx +++ /dev/null @@ -1,1423 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "updatehdl.hxx" -#include "update.hrc" - -#include "osl/diagnose.h" -#include "osl/thread.hxx" -#include "osl/file.hxx" -#include "rtl/ustring.hxx" -#include "rtl/bootstrap.hxx" - -#include "com/sun/star/uno/Sequence.h" - -#include - -#include "com/sun/star/awt/ActionEvent.hpp" -#include "com/sun/star/awt/PushButtonType.hpp" -#include "com/sun/star/awt/VclWindowPeerAttribute.hpp" -#include "com/sun/star/awt/WindowAttribute.hpp" -#include "com/sun/star/awt/XButton.hpp" -#include "com/sun/star/awt/XControl.hpp" -#include "com/sun/star/awt/XControlContainer.hpp" -#include "com/sun/star/awt/XMessageBox.hpp" -#include "com/sun/star/awt/XAnimation.hpp" -#include "com/sun/star/awt/XTopWindow.hpp" -#include "com/sun/star/awt/XVclWindowPeer.hpp" -#include "com/sun/star/awt/XVclContainer.hpp" -#include "com/sun/star/awt/XWindow.hpp" -#include "com/sun/star/awt/XWindow2.hpp" - -#include -#include "com/sun/star/beans/XPropertySet.hpp" - -#include "com/sun/star/container/XNameContainer.hpp" - -#include "com/sun/star/frame/XDesktop.hpp" - -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/task/InteractionRequestStringResolver.hpp" - -#include - -#include "updatehdl.hrc" -#include - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -#define COMMAND_CLOSE UNISTRING("close") - -#define CTRL_THROBBER UNISTRING("throbber") -#define CTRL_PROGRESS UNISTRING("progress") - -#define TEXT_STATUS UNISTRING("text_status") -#define TEXT_PERCENT UNISTRING("text_percent") -#define TEXT_DESCRIPTION UNISTRING("text_description") - -#define FIXED_LINE_MODEL UNISTRING("com.sun.star.awt.UnoControlFixedLineModel") -#define FIXED_TEXT_MODEL UNISTRING("com.sun.star.awt.UnoControlFixedTextModel") -#define EDIT_FIELD_MODEL UNISTRING("com.sun.star.awt.UnoControlEditModel") -#define BUTTON_MODEL UNISTRING("com.sun.star.awt.UnoControlButtonModel") -#define GROUP_BOX_MODEL UNISTRING("com.sun.star.awt.UnoControlGroupBoxModel") - -using namespace com::sun::star; - -//-------------------------------------------------------------------- -UpdateHandler::UpdateHandler( const uno::Reference< uno::XComponentContext > & rxContext, - const rtl::Reference< IActionListener > & rxActionListener ) : - mxContext( rxContext ), - mxActionListener( rxActionListener ), - meCurState( UPDATESTATES_COUNT ), - meLastState( UPDATESTATES_COUNT ), - mnPercent( 0 ), - mnLastCtrlState( -1 ), - mbDownloadBtnHasDots( false ), - mbVisible( false ), - mbStringsLoaded( false ), - mbMinimized( false ), - mbListenerAdded(false), - mbShowsMessageBox(false) -{ -} - -//-------------------------------------------------------------------- -UpdateHandler::~UpdateHandler() -{ - mxContext = NULL; - mxUpdDlg = NULL; - mxInteractionHdl = NULL; - mxActionListener = NULL; -} - -//-------------------------------------------------------------------- -void UpdateHandler::enableControls( short nCtrlState ) -{ - osl::MutexGuard aGuard( maMutex ); - - if ( nCtrlState == mnLastCtrlState ) - return; - - bool bEnableControl; - - short nCurStateVal = nCtrlState; - short nOldStateVal = mnLastCtrlState; - - // the help button should always be the last button in the - // enum list und must never be disabled - for ( int i=0; i> i); - nOldStateVal = (short)(mnLastCtrlState >> i); - if ( ( nCurStateVal & 0x01 ) != ( nOldStateVal & 0x01 ) ) - { - bEnableControl = ( ( nCurStateVal & 0x01 ) == 0x01 ); - setControlProperty( msButtonIDs[i], UNISTRING("Enabled"), uno::Any( bEnableControl ) ); - } - } - - mnLastCtrlState = nCtrlState; -} - -//-------------------------------------------------------------------- -void UpdateHandler::setDownloadBtnLabel( bool bAppendDots ) -{ - osl::MutexGuard aGuard( maMutex ); - - if ( mbDownloadBtnHasDots != bAppendDots ) - { - rtl::OUString aLabel( msDownload ); - - if ( bAppendDots ) - aLabel += UNISTRING( "..." ); - - setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], UNISTRING("Label"), uno::Any( aLabel ) ); - setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_DOWNLOAD2 ) ) ); - - mbDownloadBtnHasDots = bAppendDots; - } -} - -//-------------------------------------------------------------------- -void UpdateHandler::setState( UpdateState eState ) -{ - osl::MutexGuard aGuard( maMutex ); - - meCurState = eState; - - if ( mxUpdDlg.is() && mbVisible ) - updateState( meCurState ); -} - -//-------------------------------------------------------------------- -bool UpdateHandler::isVisible() const -{ - if ( !mxUpdDlg.is() ) return false; - - uno::Reference< awt::XWindow2 > xWindow( mxUpdDlg, uno::UNO_QUERY ); - - if ( xWindow.is() ) - return xWindow->isVisible(); - else - return false; -} - -//-------------------------------------------------------------------- -void UpdateHandler::setVisible( bool bVisible ) -{ - osl::MutexGuard aGuard( maMutex ); - - mbVisible = bVisible; - - if ( bVisible ) - { - if ( !mxUpdDlg.is() ) - createDialog(); - - // this should never happen, but if it happens we better return here - if ( !mxUpdDlg.is() ) - return; - - updateState( meCurState ); - - uno::Reference< awt::XWindow > xWindow( mxUpdDlg, uno::UNO_QUERY ); - - if ( xWindow.is() ) - xWindow->setVisible( bVisible ); - - uno::Reference< awt::XTopWindow > xTopWindow( mxUpdDlg, uno::UNO_QUERY ); - if ( xTopWindow.is() ) - { - xTopWindow->toFront(); - if ( !mbListenerAdded ) - { - xTopWindow->addTopWindowListener( this ); - mbListenerAdded = true; - } - } - } - else if ( mxUpdDlg.is() ) - { - uno::Reference< awt::XWindow > xWindow( mxUpdDlg, uno::UNO_QUERY ); - - if ( xWindow.is() ) - xWindow->setVisible( bVisible ); - } -} - -//-------------------------------------------------------------------- -void UpdateHandler::setProgress( sal_Int32 nPercent ) -{ - if ( nPercent > 100 ) - nPercent = 100; - else if ( nPercent < 0 ) - nPercent = 0; - - if ( nPercent != mnPercent ) - { - osl::MutexGuard aGuard( maMutex ); - - mnPercent = nPercent; - setControlProperty( CTRL_PROGRESS, UNISTRING("ProgressValue"), uno::Any( nPercent ) ); - setControlProperty( TEXT_PERCENT, UNISTRING("Text"), uno::Any( substVariables(msPercent) ) ); - } -} - -//-------------------------------------------------------------------- -void UpdateHandler::setErrorMessage( const rtl::OUString& rErrorMsg ) -{ - setControlProperty( TEXT_DESCRIPTION, UNISTRING("Text"), uno::Any( rErrorMsg ) ); -} - -//-------------------------------------------------------------------- -void UpdateHandler::setDownloadFile( const rtl::OUString& rFilePath ) -{ - sal_Int32 nLast = rFilePath.lastIndexOf( '/' ); - if ( nLast != -1 ) - { - msDownloadFile = rFilePath.copy( nLast+1 ); - const rtl::OUString aDownloadURL = rFilePath.copy( 0, nLast ); - osl::FileBase::getSystemPathFromFileURL( aDownloadURL, msDownloadPath ); - } -} - -//-------------------------------------------------------------------- -rtl::OUString UpdateHandler::getBubbleText( UpdateState eState ) -{ - osl::MutexGuard aGuard( maMutex ); - - rtl::OUString sText; - sal_Int32 nIndex = (sal_Int32) eState; - - loadStrings(); - - if ( ( UPDATESTATE_UPDATE_AVAIL <= nIndex ) && ( nIndex < UPDATESTATES_COUNT ) ) - sText = substVariables( msBubbleTexts[ nIndex - UPDATESTATE_UPDATE_AVAIL ] ); - - return sText; -} - -//-------------------------------------------------------------------- -rtl::OUString UpdateHandler::getBubbleTitle( UpdateState eState ) -{ - osl::MutexGuard aGuard( maMutex ); - - rtl::OUString sText; - sal_Int32 nIndex = (sal_Int32) eState; - - loadStrings(); - - if ( ( UPDATESTATE_UPDATE_AVAIL <= nIndex ) && ( nIndex < UPDATESTATES_COUNT ) ) - sText = substVariables( msBubbleTitles[ nIndex - UPDATESTATE_UPDATE_AVAIL] ); - - return sText; -} - -//-------------------------------------------------------------------- -rtl::OUString UpdateHandler::getDefaultInstErrMsg() -{ - osl::MutexGuard aGuard( maMutex ); - - loadStrings(); - - return substVariables( msInstallError ); -} - -// XActionListener -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::disposing( const lang::EventObject& rEvt ) - throw( uno::RuntimeException ) -{ - if ( rEvt.Source == mxUpdDlg ) - mxUpdDlg.clear(); -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::actionPerformed( awt::ActionEvent const & rEvent ) - throw( uno::RuntimeException ) -{ - DialogControls eButton = BUTTON_COUNT; - for ( int i = 0; i < BUTTON_COUNT; i++ ) - { - if ( rEvent.ActionCommand.equals( msButtonIDs[i] ) ) - { - eButton = (DialogControls) i; - break; - } - } - - if ( rEvent.ActionCommand.equals( COMMAND_CLOSE ) ) - { - if ( ( mnLastCtrlState & ( 1 << CLOSE_BUTTON ) ) == ( 1 << CLOSE_BUTTON ) ) - eButton = CLOSE_BUTTON; - else - eButton = CANCEL_BUTTON; - } - - switch ( eButton ) { - case CANCEL_BUTTON: - { - bool bCancel = true; - - if ( ( meCurState == UPDATESTATE_DOWNLOADING ) || - ( meCurState == UPDATESTATE_DOWNLOAD_PAUSED ) || - ( meCurState == UPDATESTATE_ERROR_DOWNLOADING ) ) - bCancel = showWarning( msCancelMessage ); - - if ( bCancel ) - { - mxActionListener->cancel(); - setVisible( false ); - } - break; - } - case CLOSE_BUTTON: - setVisible( false ); - if ( meCurState == UPDATESTATE_ERROR_CHECKING ) - mxActionListener->closeAfterFailure(); - break; - case DOWNLOAD_BUTTON: - mxActionListener->download(); - break; - case INSTALL_BUTTON: - if ( showWarning( msInstallMessage ) ) - mxActionListener->install(); - break; - case PAUSE_BUTTON: - mxActionListener->pause(); - break; - case RESUME_BUTTON: - mxActionListener->resume(); - break; - case HELP_BUTTON: - break; - default: - OSL_FAIL( "UpdateHandler::actionPerformed: unknown command!" ); - } -} - -// XTopWindowListener -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowOpened( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowClosing( const lang::EventObject& e ) - throw( uno::RuntimeException ) -{ - awt::ActionEvent aActionEvt; - aActionEvt.ActionCommand = COMMAND_CLOSE; - aActionEvt.Source = e.Source; - - actionPerformed( aActionEvt ); -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowClosed( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowMinimized( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ - mbMinimized = true; -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowNormalized( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ - mbMinimized = false; -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowActivated( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ -} - -//-------------------------------------------------------------------- -void SAL_CALL UpdateHandler::windowDeactivated( const lang::EventObject& ) - throw( uno::RuntimeException ) -{ -} - -// XInteractionHandler -//------------------------------------------------------------------------------ -void SAL_CALL UpdateHandler::handle( uno::Reference< task::XInteractionRequest > const & rRequest) - throw (uno::RuntimeException) -{ - if ( !mxInteractionHdl.is() ) - { - if( !mxContext.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateHandler:: empty component context" ), *this ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(mxContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateHandler: unable to obtain service manager from component context" ), *this ); - - mxInteractionHdl = uno::Reference ( - xServiceManager->createInstanceWithContext( - UNISTRING( "com.sun.star.task.InteractionHandler" ), - mxContext), - uno::UNO_QUERY_THROW); - if( !mxInteractionHdl.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateHandler:: could not get default interaction handler" ), *this ); - } - uno::Reference< task::XInteractionRequestStringResolver > xStrResolver = - task::InteractionRequestStringResolver::create( mxContext ); - beans::Optional< ::rtl::OUString > aErrorText = xStrResolver->getStringFromInformationalRequest( rRequest ); - if ( aErrorText.IsPresent ) - { - setControlProperty( TEXT_DESCRIPTION, UNISTRING("Text"), uno::Any( aErrorText.Value ) ); - - uno::Sequence< uno::Reference< task::XInteractionContinuation > > xContinuations = rRequest->getContinuations(); - if ( xContinuations.getLength() == 1 ) - { - if ( meCurState == UPDATESTATE_CHECKING ) - setState( UPDATESTATE_ERROR_CHECKING ); - else if ( meCurState == UPDATESTATE_DOWNLOADING ) - setState( UPDATESTATE_ERROR_DOWNLOADING ); - - xContinuations[0]->select(); - } - else - mxInteractionHdl->handle( rRequest ); - } - else - mxInteractionHdl->handle( rRequest ); -} - -//------------------------------------------------------------------------------ -// XTerminateListener -//------------------------------------------------------------------------------ -void SAL_CALL UpdateHandler::queryTermination( const lang::EventObject& ) - throw ( frame::TerminationVetoException, uno::RuntimeException ) -{ - if ( mbShowsMessageBox ) - { - uno::Reference< awt::XTopWindow > xTopWindow( mxUpdDlg, uno::UNO_QUERY ); - if ( xTopWindow.is() ) - xTopWindow->toFront(); - - throw frame::TerminationVetoException( - UNISTRING("The office cannot be closed while displaying a warning!"), - uno::Reference(static_cast(this), uno::UNO_QUERY)); - } - else - setVisible( false ); -} - -//------------------------------------------------------------------------------ -void SAL_CALL UpdateHandler::notifyTermination( const lang::EventObject& ) - throw ( uno::RuntimeException ) -{ - osl::MutexGuard aGuard( maMutex ); - - if ( mxUpdDlg.is() ) - { - uno::Reference< awt::XTopWindow > xTopWindow( mxUpdDlg, uno::UNO_QUERY ); - if ( xTopWindow.is() ) - xTopWindow->removeTopWindowListener( this ); - - uno::Reference< lang::XComponent > xComponent( mxUpdDlg, uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - - mxUpdDlg.clear(); - } -} - -//-------------------------------------------------------------------- -//-------------------------------------------------------------------- -//-------------------------------------------------------------------- -void UpdateHandler::updateState( UpdateState eState ) -{ - if ( meLastState == eState ) - return; - - if ( isVisible() ) - {} // ToTop(); - - rtl::OUString sText; - - switch ( eState ) - { - case UPDATESTATE_CHECKING: - showControls( (1< xBundle, - sal_Int32 nResourceId ) const -{ - rtl::OUString sString; - rtl::OUString sKey = UNISTRING( "string:" ) + rtl::OUString::valueOf( nResourceId ); - - try - { - OSL_VERIFY( xBundle->getByName( sKey ) >>= sString ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "UpdateHandler::loadString: caught an exception!" ); - sString = UNISTRING("Missing ") + sKey; - } - - return sString; -} - -rtl::OUString UpdateHandler::substVariables( const rtl::OUString &rSource ) const -{ - rtl::OUString sString( rSource ); - - searchAndReplaceAll( sString, UNISTRING( "%NEXTVERSION" ), msNextVersion ); - searchAndReplaceAll( sString, UNISTRING( "%DOWNLOAD_PATH" ), msDownloadPath ); - searchAndReplaceAll( sString, UNISTRING( "%FILE_NAME" ), msDownloadFile ); - searchAndReplaceAll( sString, UNISTRING( "%PERCENT" ), rtl::OUString::valueOf( mnPercent ) ); - - return sString; -} - -//-------------------------------------------------------------------- -void UpdateHandler::loadStrings() -{ - if ( mbStringsLoaded ) - return; - else - mbStringsLoaded = true; - - uno::Reference< resource::XResourceBundleLoader > xLoader; - try - { - uno::Any aValue( mxContext->getValueByName( - UNISTRING( "/singletons/com.sun.star.resource.OfficeResourceLoader" ) ) ); - OSL_VERIFY( aValue >>= xLoader ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "UpdateHandler::loadStrings: could not create the resource loader!" ); - } - - if ( !xLoader.is() ) return; - - uno::Reference< resource::XResourceBundle > xBundle; - - try - { - xBundle = xLoader->loadBundle_Default( UNISTRING( "upd" ) ); - } - catch( const resource::MissingResourceException& ) - { - OSL_FAIL( "UpdateHandler::loadStrings: missing the resource bundle!" ); - } - - if ( !xBundle.is() ) return; - - msChecking = loadString( xBundle, RID_UPDATE_STR_CHECKING ); - msCheckingError = loadString( xBundle, RID_UPDATE_STR_CHECKING_ERR ); - msNoUpdFound = loadString( xBundle, RID_UPDATE_STR_NO_UPD_FOUND ); - - msUpdFound = loadString( xBundle, RID_UPDATE_STR_UPD_FOUND ); - setFullVersion( msUpdFound ); - - msDlgTitle = loadString( xBundle, RID_UPDATE_STR_DLG_TITLE ); - msDownloadPause = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_PAUSE ); - msDownloadError = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_ERR ); - msDownloadWarning = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_WARN ); - msDownloadDescr = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_DESCR ); - msDownloadNotAvail = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_UNAVAIL ); - msDownloading = loadString( xBundle, RID_UPDATE_STR_DOWNLOADING ); - msReady2Install = loadString( xBundle, RID_UPDATE_STR_READY_INSTALL ); - msCancelTitle = loadString( xBundle, RID_UPDATE_STR_CANCEL_TITLE ); - msCancelMessage = loadString( xBundle, RID_UPDATE_STR_CANCEL_DOWNLOAD ); - msInstallMessage = loadString( xBundle, RID_UPDATE_STR_BEGIN_INSTALL ); - msInstallNow = loadString( xBundle, RID_UPDATE_STR_INSTALL_NOW ); - msInstallLater = loadString( xBundle, RID_UPDATE_STR_INSTALL_LATER ); - msInstallError = loadString( xBundle, RID_UPDATE_STR_INSTALL_ERROR ); - msOverwriteWarning = loadString( xBundle, RID_UPDATE_STR_OVERWRITE_WARNING ); - msPercent = loadString( xBundle, RID_UPDATE_STR_PERCENT ); - msReloadWarning = loadString( xBundle, RID_UPDATE_STR_RELOAD_WARNING ); - msReloadReload = loadString( xBundle, RID_UPDATE_STR_RELOAD_RELOAD ); - msReloadContinue = loadString( xBundle, RID_UPDATE_STR_RELOAD_CONTINUE ); - - msStatusFL = loadString( xBundle, RID_UPDATE_FT_STATUS ); - msDescription = loadString( xBundle, RID_UPDATE_FT_DESCRIPTION ); - - msClose = loadString( xBundle, RID_UPDATE_BTN_CLOSE ); - msDownload = loadString( xBundle, RID_UPDATE_BTN_DOWNLOAD ); - msInstall = loadString( xBundle, RID_UPDATE_BTN_INSTALL ); - msPauseBtn = loadString( xBundle, RID_UPDATE_BTN_PAUSE ); - msResumeBtn = loadString( xBundle, RID_UPDATE_BTN_RESUME ); - msCancelBtn = loadString( xBundle, RID_UPDATE_BTN_CANCEL ); - - // all update states before UPDATESTATE_UPDATE_AVAIL don't have a bubble - // so we can ignore them - for ( int i=0; i < (int)(UPDATESTATES_COUNT - UPDATESTATE_UPDATE_AVAIL); i++ ) - { - msBubbleTexts[ i ] = loadString( xBundle, RID_UPDATE_BUBBLE_TEXT_START + i ); - msBubbleTitles[ i ] = loadString( xBundle, RID_UPDATE_BUBBLE_T_TEXT_START + i ); - } - - for ( int i=0; i < BUTTON_COUNT; i++ ) - { - msButtonIDs[ i ] = UNISTRING("BUTTON_") + rtl::OUString::valueOf( (sal_Int32) i ); - } -} - - -//-------------------------------------------------------------------- -void UpdateHandler::startThrobber( bool bStart ) -{ - uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, uno::UNO_QUERY ); - uno::Reference< awt::XAnimation > xThrobber( xContainer->getControl( CTRL_THROBBER ), uno::UNO_QUERY ); - - if ( xThrobber.is() ) - { - if ( bStart ) - xThrobber->startAnimation(); - else - xThrobber->stopAnimation(); - } - - uno::Reference< awt::XWindow > xWindow( xContainer->getControl( CTRL_THROBBER ), uno::UNO_QUERY ); - if (xWindow.is() ) - xWindow->setVisible( bStart ); -} - -//-------------------------------------------------------------------- -void UpdateHandler::setControlProperty( const rtl::OUString &rCtrlName, - const rtl::OUString &rPropName, - const uno::Any &rPropValue ) -{ - if ( !mxUpdDlg.is() ) return; - - uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, uno::UNO_QUERY ); - uno::Reference< awt::XControl > xControl( xContainer->getControl( rCtrlName ), uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControlModel > xControlModel( xControl->getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); - - try { - xPropSet->setPropertyValue( rPropName, rPropValue ); - } - catch( const beans::UnknownPropertyException& ) - { - OSL_FAIL( "UpdateHandler::setControlProperty: caught an exception!" ); - } -} - -//-------------------------------------------------------------------- -void UpdateHandler::showControl( const rtl::OUString &rCtrlName, bool bShow ) -{ - uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, uno::UNO_QUERY ); - - if ( !xContainer.is() ) - { - OSL_FAIL( "UpdateHandler::showControl: could not get control container!" ); - return; - } - - uno::Reference< awt::XWindow > xWindow( xContainer->getControl( rCtrlName ), uno::UNO_QUERY ); - if ( xWindow.is() ) - xWindow->setVisible( bShow ); -} - -//-------------------------------------------------------------------- -void UpdateHandler::focusControl( DialogControls eID ) -{ - uno::Reference< awt::XControlContainer > xContainer( mxUpdDlg, uno::UNO_QUERY ); - - if ( !xContainer.is() ) - { - OSL_FAIL( "UpdateHandler::focusControl: could not get control container!" ); - return; - } - - OSL_ENSURE( (eID < BUTTON_COUNT), "UpdateHandler::focusControl: id to big!" ); - - uno::Reference< awt::XWindow > xWindow( xContainer->getControl( msButtonIDs[(short)eID] ), uno::UNO_QUERY ); - if ( xWindow.is() ) - xWindow->setFocus(); -} - -//-------------------------------------------------------------------- -void UpdateHandler::insertControlModel( uno::Reference< awt::XControlModel > & rxDialogModel, - rtl::OUString const & rServiceName, - rtl::OUString const & rControlName, - awt::Rectangle const & rPosSize, - uno::Sequence< beans::NamedValue > const & rProps ) -{ - uno::Reference< lang::XMultiServiceFactory > xFactory (rxDialogModel, uno::UNO_QUERY_THROW); - uno::Reference< awt::XControlModel > xModel (xFactory->createInstance (rServiceName), uno::UNO_QUERY_THROW); - uno::Reference< beans::XPropertySet > xPropSet (xModel, uno::UNO_QUERY_THROW); - - for (sal_Int32 i = 0, n = rProps.getLength(); i < n; i++) - { - xPropSet->setPropertyValue (rProps[i].Name, rProps[i].Value); - } - - // @see awt/UnoControlDialogElement.idl - xPropSet->setPropertyValue( UNISTRING("Name"), uno::Any (rControlName) ); - xPropSet->setPropertyValue( UNISTRING("PositionX"), uno::Any (rPosSize.X) ); - xPropSet->setPropertyValue( UNISTRING("PositionY"), uno::Any (rPosSize.Y) ); - xPropSet->setPropertyValue( UNISTRING("Height"), uno::Any (rPosSize.Height) ); - xPropSet->setPropertyValue( UNISTRING("Width"), uno::Any (rPosSize.Width) ); - - // insert by Name into DialogModel container - uno::Reference< container::XNameContainer > xContainer (rxDialogModel, uno::UNO_QUERY_THROW); - xContainer->insertByName( rControlName, uno::Any (uno::Reference< uno::XInterface >(xModel, uno::UNO_QUERY))); -} - -//-------------------------------------------------------------------- -void UpdateHandler::setFullVersion( rtl::OUString& rString ) -{ - if( !mxContext.is() ) - throw uno::RuntimeException( UNISTRING( "getProductName: empty component context" ), *this ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( UNISTRING( "getProductName: unable to obtain service manager from component context" ), *this ); - - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.configuration.ConfigurationProvider" ), mxContext ), - uno::UNO_QUERY_THROW); - - beans::PropertyValue aProperty; - aProperty.Name = UNISTRING( "nodepath" ); - aProperty.Value = uno::makeAny( UNISTRING("org.openoffice.Setup/Product") ); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] = uno::makeAny( aProperty ); - - uno::Reference< uno::XInterface > xConfigAccess; - xConfigAccess = xConfigurationProvider->createInstanceWithArguments( UNISTRING("com.sun.star.configuration.ConfigurationAccess"), - aArgumentList ); - - uno::Reference< container::XNameAccess > xNameAccess( xConfigAccess, uno::UNO_QUERY_THROW ); - - rtl::OUString aProductVersion; - rtl::OUString aProductFullVersion; - - xNameAccess->getByName(UNISTRING("ooSetupVersion")) >>= aProductVersion; - aProductFullVersion = aProductVersion; - - sal_Int32 nVerIndex = rString.indexOf( aProductVersion ); - if ( nVerIndex != -1 ) - { - rtl::OUString aPackageVersion = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":OOOPackageVersion}" ); - rtl::Bootstrap::expandMacros( aPackageVersion ); - - if ( aPackageVersion.getLength() ) - { - sal_Int32 nTokIndex = 0; - rtl::OUString aVersionMinor = aPackageVersion.getToken( 1, '.', nTokIndex ); - rtl::OUString aVersionMicro; - - if ( nTokIndex > 0 ) - aVersionMicro = aPackageVersion.getToken( 0, '.', nTokIndex ); - - if ( aVersionMinor.getLength() == 0 ) - aVersionMinor = UNISTRING( "0" ); - if ( aVersionMicro.getLength() == 0 ) - aVersionMicro = UNISTRING( "0" ); - - sal_Int32 nIndex = aProductFullVersion.indexOf( '.' ); - if ( nIndex == -1 ) - { - aProductFullVersion += UNISTRING( "." ); - aProductFullVersion += aVersionMinor; - } - else - { - nIndex = aProductFullVersion.indexOf( '.', nIndex+1 ); - } - if ( nIndex == -1 ) - { - aProductFullVersion += UNISTRING( "." ); - aProductFullVersion += aVersionMicro; - } - else - { - aProductFullVersion = aProductFullVersion.replaceAt( nIndex+1, aProductFullVersion.getLength()-nIndex-1, aVersionMicro ); - } - } - rString = rString.replaceAt( nVerIndex, aProductVersion.getLength(), aProductFullVersion ); - } -} - -//-------------------------------------------------------------------- -bool UpdateHandler::showWarning( const rtl::OUString &rWarningText ) const -{ - bool bRet = false; - - uno::Reference< awt::XControl > xControl( mxUpdDlg, uno::UNO_QUERY ); - if ( !xControl.is() ) return bRet; - - uno::Reference< awt::XWindowPeer > xPeer = xControl->getPeer(); - if ( !xPeer.is() ) return bRet; - - uno::Reference< awt::XToolkit > xToolkit = xPeer->getToolkit(); - if ( !xToolkit.is() ) return bRet; - - awt::WindowDescriptor aDescriptor; - - sal_Int32 nWindowAttributes = awt::WindowAttribute::BORDER | awt::WindowAttribute::MOVEABLE | awt::WindowAttribute::CLOSEABLE; - nWindowAttributes |= awt::VclWindowPeerAttribute::YES_NO; - nWindowAttributes |= awt::VclWindowPeerAttribute::DEF_NO; - - aDescriptor.Type = awt::WindowClass_MODALTOP; - aDescriptor.WindowServiceName = UNISTRING( "warningbox" ); - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = xPeer; - aDescriptor.Bounds = awt::Rectangle( 10, 10, 250, 150 ); - aDescriptor.WindowAttributes = nWindowAttributes; - - uno::Reference< awt::XMessageBox > xMsgBox( xToolkit->createWindow( aDescriptor ), uno::UNO_QUERY ); - if ( xMsgBox.is() ) - { - mbShowsMessageBox = true; - sal_Int16 nRet; - // xMsgBox->setCaptionText( msCancelTitle ); - xMsgBox->setMessageText( rWarningText ); - nRet = xMsgBox->execute(); - if ( nRet == 2 ) // RET_YES == 2 - bRet = true; - mbShowsMessageBox = false; - } - - uno::Reference< lang::XComponent > xComponent( xMsgBox, uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - - return bRet; -} - -//-------------------------------------------------------------------- -bool UpdateHandler::showWarning( const rtl::OUString &rWarningText, - const rtl::OUString &rBtnText_1, - const rtl::OUString &rBtnText_2 ) const -{ - bool bRet = false; - - uno::Reference< awt::XControl > xControl( mxUpdDlg, uno::UNO_QUERY ); - if ( !xControl.is() ) return bRet; - - uno::Reference< awt::XWindowPeer > xPeer = xControl->getPeer(); - if ( !xPeer.is() ) return bRet; - - uno::Reference< awt::XToolkit > xToolkit = xPeer->getToolkit(); - if ( !xToolkit.is() ) return bRet; - - awt::WindowDescriptor aDescriptor; - - sal_Int32 nWindowAttributes = awt::WindowAttribute::BORDER | awt::WindowAttribute::MOVEABLE | awt::WindowAttribute::CLOSEABLE; - nWindowAttributes |= awt::VclWindowPeerAttribute::YES_NO; - nWindowAttributes |= awt::VclWindowPeerAttribute::DEF_NO; - - aDescriptor.Type = awt::WindowClass_MODALTOP; - aDescriptor.WindowServiceName = UNISTRING( "warningbox" ); - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = xPeer; - aDescriptor.Bounds = awt::Rectangle( 10, 10, 250, 150 ); - aDescriptor.WindowAttributes = nWindowAttributes; - - uno::Reference< awt::XMessageBox > xMsgBox( xToolkit->createWindow( aDescriptor ), uno::UNO_QUERY ); - if ( xMsgBox.is() ) - { - uno::Reference< awt::XVclContainer > xMsgBoxCtrls( xMsgBox, uno::UNO_QUERY ); - if ( xMsgBoxCtrls.is() ) - { - uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows(); - - for ( long i=0; i < xChildren.getLength(); i++ ) - { - uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( xChildren[i], uno::UNO_QUERY ); - if ( xMsgBoxCtrl.is() ) - { - bool bIsDefault = true; - uno::Any aValue = xMsgBoxCtrl->getProperty( UNISTRING("DefaultButton") ); - aValue >>= bIsDefault; - if ( bIsDefault ) - xMsgBoxCtrl->setProperty( UNISTRING("Text"), uno::Any( rBtnText_1 ) ); - else - xMsgBoxCtrl->setProperty( UNISTRING("Text"), uno::Any( rBtnText_2 ) ); - } - } - } - - sal_Int16 nRet; - // xMsgBox->setCaptionText( msCancelTitle ); - mbShowsMessageBox = true; - xMsgBox->setMessageText( rWarningText ); - nRet = xMsgBox->execute(); - if ( nRet == 2 ) // RET_YES == 2 - bRet = true; - - mbShowsMessageBox = false; - } - - uno::Reference< lang::XComponent > xComponent( xMsgBox, uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - - return bRet; -} - -//-------------------------------------------------------------------- -bool UpdateHandler::showOverwriteWarning( const rtl::OUString& rFileName ) const -{ - rtl::OUString aMsg( msReloadWarning ); - searchAndReplaceAll( aMsg, UNISTRING( "%FILENAME" ), rFileName ); - searchAndReplaceAll( aMsg, UNISTRING( "%DOWNLOAD_PATH" ), msDownloadPath ); - return showWarning( aMsg, msReloadContinue, msReloadReload ); -} - -//-------------------------------------------------------------------- -bool UpdateHandler::showOverwriteWarning() const -{ - return showWarning( msOverwriteWarning ); -} - -//-------------------------------------------------------------------- -#define BUTTON_HEIGHT 14 -#define BUTTON_WIDTH 50 -#define BUTTON_X_OFFSET 7 -#define BUTTON_Y_OFFSET 3 -#define LABEL_HEIGHT 10 - -#define DIALOG_WIDTH 300 -#define DIALOG_BORDER 5 -#define INNER_BORDER 3 -#define TEXT_OFFSET 1 -#define BOX_HEIGHT1 ( LABEL_HEIGHT + 3*BUTTON_HEIGHT + 2*BUTTON_Y_OFFSET + 2*INNER_BORDER ) -#define BOX_HEIGHT2 50 -#define EDIT_WIDTH ( DIALOG_WIDTH - 2 * DIALOG_BORDER ) -#define BOX1_BTN_X ( DIALOG_BORDER + EDIT_WIDTH - BUTTON_WIDTH - INNER_BORDER ) -#define BOX1_BTN_Y ( DIALOG_BORDER + LABEL_HEIGHT + INNER_BORDER) -#define THROBBER_WIDTH 16 -#define THROBBER_HEIGHT 16 -#define THROBBER_X_POS ( DIALOG_BORDER + 8 ) -#define THROBBER_Y_POS ( DIALOG_BORDER + 23 ) -#define BUTTON_BAR_HEIGHT 24 -#define LABEL_OFFSET ( LABEL_HEIGHT + 4 ) -#define DIALOG_HEIGHT ( BOX_HEIGHT1 + BOX_HEIGHT2 + LABEL_OFFSET + BUTTON_BAR_HEIGHT + 3 * DIALOG_BORDER ) -#define LABEL_Y_POS ( 2 * DIALOG_BORDER + BOX_HEIGHT1 ) -#define EDIT2_Y_POS ( LABEL_Y_POS + LABEL_HEIGHT ) -#define BUTTON_BAR_Y_POS ( EDIT2_Y_POS + DIALOG_BORDER + BOX_HEIGHT2 ) -#define BUTTON_Y_POS ( BUTTON_BAR_Y_POS + 8 ) -#define CLOSE_BTN_X ( DIALOG_WIDTH - DIALOG_BORDER - BUTTON_WIDTH ) -#define INSTALL_BTN_X ( CLOSE_BTN_X - 2 * BUTTON_X_OFFSET - BUTTON_WIDTH ) -#define DOWNLOAD_BTN_X ( INSTALL_BTN_X - BUTTON_X_OFFSET - BUTTON_WIDTH ) -#define PROGRESS_WIDTH 80 -#define PROGRESS_HEIGHT 10 -#define PROGRESS_X_POS ( DIALOG_BORDER + 8 ) -#define PROGRESS_Y_POS ( DIALOG_BORDER + 2*LABEL_OFFSET ) - -//-------------------------------------------------------------------- -void UpdateHandler::showControls( short nControls ) -{ - // The buttons from CANCEL_BUTTON to RESUME_BUTTON will be shown or - // hidden on demand - short nShiftMe; - for ( int i = 0; i <= (int)RESUME_BUTTON; i++ ) - { - nShiftMe = (short)(nControls >> i); - showControl( msButtonIDs[i], (bool)(nShiftMe & 0x01) ); - } - - nShiftMe = (short)(nControls >> THROBBER_CTRL); - startThrobber( (bool)(nShiftMe & 0x01) ); - - nShiftMe = (short)(nControls >> PROGRESS_CTRL); - showControl( CTRL_PROGRESS, (bool)(nShiftMe & 0x01) ); - showControl( TEXT_PERCENT, (bool)(nShiftMe & 0x01) ); - - // Status text needs to be smaller, when there are buttons at the right side of the dialog - if ( ( nControls & ( (1< xServiceManager( mxContext->getServiceManager() ); - - if( xServiceManager.is() ) - { - uno::Reference< frame::XDesktop > xDesktop( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.frame.Desktop"), mxContext ), - uno::UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( this ); - } - - loadStrings(); - - uno::Reference< lang::XMultiComponentFactory > xFactory( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControlModel > xControlModel( xFactory->createInstanceWithContext( - UNISTRING("com.sun.star.awt.UnoControlDialogModel"), - mxContext), uno::UNO_QUERY_THROW ); - { - // @see awt/UnoControlDialogModel.idl - uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); - - xPropSet->setPropertyValue( UNISTRING("Title"), uno::Any( msDlgTitle ) ); - xPropSet->setPropertyValue( UNISTRING("Closeable"), uno::Any( true ) ); - xPropSet->setPropertyValue( UNISTRING("Enabled"), uno::Any( true ) ); - xPropSet->setPropertyValue( UNISTRING("Moveable"), uno::Any( true ) ); - xPropSet->setPropertyValue( UNISTRING("Sizeable"), uno::Any( true ) ); - xPropSet->setPropertyValue( UNISTRING("DesktopAsParent"), uno::Any( true ) ); - xPropSet->setPropertyValue( UNISTRING("PositionX"), uno::Any(sal_Int32( 100 )) ); - xPropSet->setPropertyValue( UNISTRING("PositionY"), uno::Any(sal_Int32( 100 )) ); - xPropSet->setPropertyValue( UNISTRING("Width"), uno::Any(sal_Int32( DIALOG_WIDTH )) ); - xPropSet->setPropertyValue( UNISTRING("Height"), uno::Any(sal_Int32( DIALOG_HEIGHT )) ); - xPropSet->setPropertyValue( UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_DLG ) ) ); - } - { // Label (fixed text) - uno::Sequence< beans::NamedValue > aProps(1); - - setProperty( aProps, 0, UNISTRING("Label"), uno::Any( msStatusFL ) ); - - insertControlModel( xControlModel, FIXED_TEXT_MODEL, UNISTRING( "fixedLineStatus" ), - awt::Rectangle( DIALOG_BORDER+1, DIALOG_BORDER, EDIT_WIDTH-2, LABEL_HEIGHT ), - aProps ); - } - { // box around text - uno::Sequence< beans::NamedValue > aProps; - - insertControlModel( xControlModel, GROUP_BOX_MODEL, UNISTRING( "StatusBox" ), - awt::Rectangle( DIALOG_BORDER, DIALOG_BORDER + LABEL_HEIGHT, EDIT_WIDTH, BOX_HEIGHT1 - LABEL_HEIGHT ), - aProps ); - } - { // Text (multiline edit) - uno::Sequence< beans::NamedValue > aProps(7); - - setProperty( aProps, 0, UNISTRING("Text"), uno::Any( substVariables(msChecking) ) ); - setProperty( aProps, 1, UNISTRING("Border"), uno::Any( sal_Int16( 0 ) ) ); - setProperty( aProps, 2, UNISTRING("PaintTransparent"), uno::Any( true ) ); - setProperty( aProps, 3, UNISTRING("MultiLine"), uno::Any( true ) ); - setProperty( aProps, 4, UNISTRING("ReadOnly"), uno::Any( true ) ); - setProperty( aProps, 5, UNISTRING("AutoVScroll"), uno::Any( true ) ); - setProperty( aProps, 6, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_STATUS ) ) ); - - insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_STATUS, - awt::Rectangle( DIALOG_BORDER + TEXT_OFFSET, - DIALOG_BORDER + LABEL_HEIGHT + TEXT_OFFSET, - EDIT_WIDTH - 2*TEXT_OFFSET, - BOX_HEIGHT1 - 4*TEXT_OFFSET - LABEL_HEIGHT ), - aProps ); - } - { // Text (edit) - uno::Sequence< beans::NamedValue > aProps(4); - - setProperty( aProps, 0, UNISTRING("Text"), uno::Any( msPercent ) ); - setProperty( aProps, 1, UNISTRING("Border"), uno::Any( sal_Int16( 0 ) ) ); - setProperty( aProps, 2, UNISTRING("PaintTransparent"), uno::Any( true ) ); - setProperty( aProps, 3, UNISTRING("ReadOnly"), uno::Any( true ) ); - - insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_PERCENT, - awt::Rectangle( PROGRESS_X_POS + PROGRESS_WIDTH + DIALOG_BORDER, - PROGRESS_Y_POS, - EDIT_WIDTH - PROGRESS_WIDTH - BUTTON_WIDTH - 2*DIALOG_BORDER, - LABEL_HEIGHT ), - aProps ); - } - { // pause button - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msPauseBtn ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_PAUSE ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[PAUSE_BUTTON], - awt::Rectangle( BOX1_BTN_X, BOX1_BTN_Y, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } - { // resume button - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msResumeBtn ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_RESUME ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[RESUME_BUTTON], - awt::Rectangle( BOX1_BTN_X, - BOX1_BTN_Y + BUTTON_Y_OFFSET + BUTTON_HEIGHT, - BUTTON_WIDTH, - BUTTON_HEIGHT ), - aProps ); - } - { // abort button - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msCancelBtn ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_CANCEL ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[CANCEL_BUTTON], - awt::Rectangle( BOX1_BTN_X, - BOX1_BTN_Y + (2*(BUTTON_HEIGHT+BUTTON_Y_OFFSET)), - BUTTON_WIDTH, - BUTTON_HEIGHT ), - aProps ); - } - { // Label (FixedText) - uno::Sequence< beans::NamedValue > aProps(1); - - setProperty( aProps, 0, UNISTRING("Label"), uno::Any( msDescription ) ); - - insertControlModel( xControlModel, FIXED_TEXT_MODEL, UNISTRING( "fixedTextDescription" ), - awt::Rectangle( DIALOG_BORDER+1, LABEL_Y_POS, EDIT_WIDTH-2, LABEL_HEIGHT ), - aProps ); - } - { // box around text - uno::Sequence< beans::NamedValue > aProps; - - insertControlModel( xControlModel, GROUP_BOX_MODEL, UNISTRING( "DescriptionBox" ), - awt::Rectangle( DIALOG_BORDER, EDIT2_Y_POS, EDIT_WIDTH, BOX_HEIGHT2 ), - aProps ); - } - { // Text (MultiLineEdit) - uno::Sequence< beans::NamedValue > aProps(7); - - setProperty( aProps, 0, UNISTRING("Text"), uno::Any( rtl::OUString() ) ); - setProperty( aProps, 1, UNISTRING("Border"), uno::Any( sal_Int16( 0 ) ) ); - setProperty( aProps, 2, UNISTRING("PaintTransparent"), uno::Any( true ) ); - setProperty( aProps, 3, UNISTRING("MultiLine"), uno::Any( true ) ); - setProperty( aProps, 4, UNISTRING("ReadOnly"), uno::Any( true ) ); - setProperty( aProps, 5, UNISTRING("AutoVScroll"), uno::Any( true ) ); - setProperty( aProps, 6, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_DESCRIPTION ) ) ); - - insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_DESCRIPTION, - awt::Rectangle( DIALOG_BORDER + TEXT_OFFSET, - EDIT2_Y_POS + 2*TEXT_OFFSET, - EDIT_WIDTH - 3*TEXT_OFFSET, - BOX_HEIGHT2 - 3*TEXT_OFFSET ), - aProps ); - } - { // @see awt/UnoControlFixedLineModel.idl - uno::Sequence< beans::NamedValue > aProps(1); - - setProperty( aProps, 0, UNISTRING("Orientation"), uno::Any( sal_Int32( 0 ) ) ); - - insertControlModel( xControlModel, FIXED_LINE_MODEL, UNISTRING("fixedLine"), - awt::Rectangle( 0, BUTTON_BAR_Y_POS, DIALOG_WIDTH, 5 ), - aProps ); - } - { // close button // @see awt/UnoControlButtonModel.idl - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - // [property] short PushButtonType - // with own "ButtonActionListener" - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - // with default ActionListener => endDialog(). - // setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_CANCEL) ) ); - // [property] string Label // only if PushButtonType_STANDARD - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msClose ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_CLOSE ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[ CLOSE_BUTTON ], - awt::Rectangle( CLOSE_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } - { // install button - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msInstall ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_INSTALL ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[INSTALL_BUTTON], - awt::Rectangle( INSTALL_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } - { // download button - uno::Sequence< beans::NamedValue > aProps(5); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) ); - setProperty( aProps, 3, UNISTRING("Label"), uno::Any( msDownload ) ); - setProperty( aProps, 4, UNISTRING("HelpURL"), uno::Any( UNISTRING( INET_HID_SCHEME ) + rtl::OUString::createFromAscii( HID_CHECK_FOR_UPD_DOWNLOAD ) ) ); - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[DOWNLOAD_BUTTON], - awt::Rectangle( DOWNLOAD_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } - { // help button - uno::Sequence< beans::NamedValue > aProps(3); - - setProperty( aProps, 0, UNISTRING("DefaultButton"), uno::Any( false ) ); - setProperty( aProps, 1, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 2, UNISTRING("PushButtonType"), uno::Any( sal_Int16(awt::PushButtonType_HELP) ) ); - - insertControlModel( xControlModel, BUTTON_MODEL, msButtonIDs[HELP_BUTTON], - awt::Rectangle( DIALOG_BORDER, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } - { // @see awt/UnoControlThrobberModel.idl - uno::Sequence< beans::NamedValue > aProps; - - insertControlModel( xControlModel, UNISTRING("com.sun.star.awt.SpinningProgressControlModel"), CTRL_THROBBER, - awt::Rectangle( THROBBER_X_POS, THROBBER_Y_POS, THROBBER_WIDTH, THROBBER_HEIGHT), - aProps ); - } - { // @see awt/UnoControlProgressBarModel.idl - uno::Sequence< beans::NamedValue > aProps(4); - setProperty( aProps, 0, UNISTRING("Enabled"), uno::Any( true ) ); - setProperty( aProps, 1, UNISTRING("ProgressValue"), uno::Any( sal_Int32( 0 ) ) ); - setProperty( aProps, 2, UNISTRING("ProgressValueMax"), uno::Any( sal_Int32( 100 ) ) ); - setProperty( aProps, 3, UNISTRING("ProgressValueMin"), uno::Any( sal_Int32( 0 ) ) ); - - insertControlModel( xControlModel, UNISTRING("com.sun.star.awt.UnoControlProgressBarModel"), CTRL_PROGRESS, - awt::Rectangle( PROGRESS_X_POS, PROGRESS_Y_POS, PROGRESS_WIDTH, PROGRESS_HEIGHT ), - aProps); - } - - uno::Reference< awt::XControl > xControl( - xFactory->createInstanceWithContext( UNISTRING("com.sun.star.awt.UnoControlDialog"), mxContext), - uno::UNO_QUERY_THROW ); - xControl->setModel( xControlModel ); - - if ( mbVisible == false ) - { - uno::Reference< awt::XWindow > xWindow( xControl, uno::UNO_QUERY ); - - if ( xWindow.is() ) - xWindow->setVisible( false ); - } - - xControl->createPeer( NULL, NULL ); - { - uno::Reference< awt::XControlContainer > xContainer (xControl, uno::UNO_QUERY); - for ( int i = 0; i < HELP_BUTTON; i++ ) - { - uno::Reference< awt::XButton > xButton ( xContainer->getControl( msButtonIDs[i] ), uno::UNO_QUERY); - if (xButton.is()) - { - xButton->setActionCommand( msButtonIDs[i] ); - xButton->addActionListener( this ); - } - } - } - - mxUpdDlg.set( xControl, uno::UNO_QUERY_THROW ); - mnLastCtrlState = -1; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatehdl.hrc b/extensions/source/update/check/updatehdl.hrc deleted file mode 100644 index 6d7b93086..000000000 --- a/extensions/source/update/check/updatehdl.hrc +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - #define RID_UPDATE_HDL_START 1200 - - #define RID_UPDATE_STR_CHECKING RID_UPDATE_HDL_START + 1 - #define RID_UPDATE_STR_NO_UPD_FOUND RID_UPDATE_HDL_START + 2 - #define RID_UPDATE_STR_UPD_FOUND RID_UPDATE_HDL_START + 3 - #define RID_UPDATE_STR_DLG_TITLE RID_UPDATE_HDL_START + 4 - #define RID_UPDATE_STR_DOWNLOAD_ERR RID_UPDATE_HDL_START + 5 - #define RID_UPDATE_STR_DOWNLOAD_WARN RID_UPDATE_HDL_START + 6 - #define RID_UPDATE_STR_DOWNLOADING RID_UPDATE_HDL_START + 7 - #define RID_UPDATE_STR_READY_INSTALL RID_UPDATE_HDL_START + 8 - #define RID_UPDATE_STR_CANCEL_TITLE RID_UPDATE_HDL_START + 9 - #define RID_UPDATE_STR_CANCEL_DOWNLOAD RID_UPDATE_HDL_START + 10 - #define RID_UPDATE_STR_BEGIN_INSTALL RID_UPDATE_HDL_START + 11 - #define RID_UPDATE_STR_INSTALL_NOW RID_UPDATE_HDL_START + 12 - #define RID_UPDATE_STR_INSTALL_LATER RID_UPDATE_HDL_START + 13 - #define RID_UPDATE_STR_CHECKING_ERR RID_UPDATE_HDL_START + 14 - #define RID_UPDATE_STR_OVERWRITE_WARNING RID_UPDATE_HDL_START + 15 - #define RID_UPDATE_STR_DOWNLOAD_PAUSE RID_UPDATE_HDL_START + 16 - #define RID_UPDATE_STR_DOWNLOAD_UNAVAIL RID_UPDATE_HDL_START + 17 - #define RID_UPDATE_STR_PERCENT RID_UPDATE_HDL_START + 18 - #define RID_UPDATE_STR_DOWNLOAD_DESCR RID_UPDATE_HDL_START + 19 - #define RID_UPDATE_STR_INSTALL_ERROR RID_UPDATE_HDL_START + 20 - #define RID_UPDATE_STR_RELOAD_WARNING RID_UPDATE_HDL_START + 21 - #define RID_UPDATE_STR_RELOAD_RELOAD RID_UPDATE_HDL_START + 22 - #define RID_UPDATE_STR_RELOAD_CONTINUE RID_UPDATE_HDL_START + 23 - - #define RID_UPDATE_FT_DESCRIPTION RID_UPDATE_HDL_START + 25 - #define RID_UPDATE_FT_STATUS RID_UPDATE_HDL_START + 26 - - #define RID_UPDATE_BTN_CLOSE RID_UPDATE_HDL_START + 30 - #define RID_UPDATE_BTN_DOWNLOAD RID_UPDATE_HDL_START + 31 - #define RID_UPDATE_BTN_INSTALL RID_UPDATE_HDL_START + 32 - #define RID_UPDATE_BTN_PAUSE RID_UPDATE_HDL_START + 33 - #define RID_UPDATE_BTN_RESUME RID_UPDATE_HDL_START + 34 - #define RID_UPDATE_BTN_CANCEL RID_UPDATE_HDL_START + 35 - - #define RID_UPDATE_BUBBLE_TEXT_START RID_UPDATE_HDL_START + 40 - #define RID_UPDATE_BUBBLE_UPDATE_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 0 - #define RID_UPDATE_BUBBLE_UPDATE_NO_DOWN RID_UPDATE_BUBBLE_TEXT_START + 1 - #define RID_UPDATE_BUBBLE_AUTO_START RID_UPDATE_BUBBLE_TEXT_START + 2 - #define RID_UPDATE_BUBBLE_DOWNLOADING RID_UPDATE_BUBBLE_TEXT_START + 3 - #define RID_UPDATE_BUBBLE_DOWNLOAD_PAUSED RID_UPDATE_BUBBLE_TEXT_START + 4 - #define RID_UPDATE_BUBBLE_ERROR_DOWNLOADING RID_UPDATE_BUBBLE_TEXT_START + 5 - #define RID_UPDATE_BUBBLE_DOWNLOAD_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 6 - #define RID_UPDATE_BUBBLE_EXT_UPD_AVAIL RID_UPDATE_BUBBLE_TEXT_START + 7 - - #define RID_UPDATE_BUBBLE_T_TEXT_START RID_UPDATE_HDL_START + 50 - #define RID_UPDATE_BUBBLE_T_UPDATE_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 0 - #define RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN RID_UPDATE_BUBBLE_T_TEXT_START + 1 - #define RID_UPDATE_BUBBLE_T_AUTO_START RID_UPDATE_BUBBLE_T_TEXT_START + 2 - #define RID_UPDATE_BUBBLE_T_DOWNLOADING RID_UPDATE_BUBBLE_T_TEXT_START + 3 - #define RID_UPDATE_BUBBLE_T_DOWNLOAD_PAUSED RID_UPDATE_BUBBLE_T_TEXT_START + 4 - #define RID_UPDATE_BUBBLE_T_ERROR_DOWNLOADING RID_UPDATE_BUBBLE_T_TEXT_START + 5 - #define RID_UPDATE_BUBBLE_T_DOWNLOAD_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 6 - #define RID_UPDATE_BUBBLE_T_EXT_UPD_AVAIL RID_UPDATE_BUBBLE_T_TEXT_START + 7 - diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx deleted file mode 100644 index cc451df57..000000000 --- a/extensions/source/update/check/updatehdl.hxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_UPDATE_HDL_HXX -#define INCLUDED_UPDATE_HDL_HXX - -#include "boost/utility.hpp" -#include -#include "com/sun/star/uno/Any.h" -#include "com/sun/star/uno/Reference.h" -#include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/awt/Rectangle.hpp" -#include "com/sun/star/awt/XActionListener.hpp" -#include "com/sun/star/awt/XControlModel.hpp" -#include "com/sun/star/awt/XDialog.hpp" -#include "com/sun/star/awt/XTopWindowListener.hpp" -#include "com/sun/star/beans/NamedValue.hpp" -#include "com/sun/star/frame/XTerminateListener.hpp" -#include -#include -#include "cppuhelper/implbase4.hxx" - -#include "actionlistener.hxx" - -enum DialogControls -{ - CANCEL_BUTTON = 0, - PAUSE_BUTTON, - RESUME_BUTTON, - INSTALL_BUTTON, - DOWNLOAD_BUTTON, - CLOSE_BUTTON, - HELP_BUTTON, - BUTTON_COUNT, - THROBBER_CTRL, - PROGRESS_CTRL -}; - -enum UpdateState { - UPDATESTATE_CHECKING = 0, - UPDATESTATE_ERROR_CHECKING, - UPDATESTATE_NO_UPDATE_AVAIL, - UPDATESTATE_UPDATE_AVAIL, - UPDATESTATE_UPDATE_NO_DOWNLOAD, - UPDATESTATE_AUTO_START, - UPDATESTATE_DOWNLOADING, - UPDATESTATE_DOWNLOAD_PAUSED, - UPDATESTATE_ERROR_DOWNLOADING, - UPDATESTATE_DOWNLOAD_AVAIL, - UPDATESTATE_EXT_UPD_AVAIL, - UPDATESTATES_COUNT -}; - -class UpdateHandler : ::boost::noncopyable, - public cppu::WeakImplHelper4< com::sun::star::awt::XActionListener, - com::sun::star::awt::XTopWindowListener, - com::sun::star::task::XInteractionHandler, - com::sun::star::frame::XTerminateListener > -{ -private: - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; - com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxUpdDlg; - com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > mxInteractionHdl; - rtl::Reference< IActionListener > mxActionListener; - - UpdateState meCurState; - UpdateState meLastState; - sal_Int32 mnPercent; - short mnLastCtrlState; - bool mbDownloadBtnHasDots; - bool mbVisible; - bool mbStringsLoaded; - bool mbMinimized; - bool mbListenerAdded; - mutable bool mbShowsMessageBox; - - osl::Mutex maMutex; - - rtl::OUString msNextVersion; - rtl::OUString msDownloadPath; - rtl::OUString msDownloadFile; - rtl::OUString msDescriptionMsg; - rtl::OUString msChecking; // RID_UPDATE_STR_CHECKING - rtl::OUString msCheckingError; // RID_UPDATE_STR_CHECKING_ERR - rtl::OUString msNoUpdFound; // RID_UPDATE_STR_NO_UPD_FOUND - rtl::OUString msUpdFound; // RID_UPDATE_STR_UPD_FOUND - rtl::OUString msDlgTitle; // RID_UPDATE_STR_DLG_TITLE - rtl::OUString msDownloadPause; // RID_UPDATE_STR_DOWNLOAD_PAUSE - rtl::OUString msDownloadError; // RID_UPDATE_STR_DOWNLOAD_ERR - rtl::OUString msDownloadWarning; // RID_UPDATE_STR_DOWNLOAD_WARN - rtl::OUString msDownloadDescr; // RID_UPDATE_STR_DOWNLOAD_WARN - rtl::OUString msDownloadNotAvail; // RID_UPDATE_STR_DOWNLOAD_UNAVAIL - rtl::OUString msDownloading; // RID_UPDATE_STR_DOWNLOADING - rtl::OUString msReady2Install; // RID_UPDATE_STR_READY_INSTALL - rtl::OUString msCancelTitle; // RID_UPDATE_STR_CANCEL_TITLE - rtl::OUString msCancelMessage; // RID_UPDATE_STR_CANCEL_DOWNLOAD - rtl::OUString msInstallMessage; // RID_UPDATE_STR_BEGIN_INSTALL - rtl::OUString msInstallNow; // RID_UPDATE_STR_INSTALL_NOW - rtl::OUString msInstallLater; // RID_UPDATE_STR_INSTALL_LATER - rtl::OUString msInstallError; // RID_UPDATE_STR_INSTALL_ERROR - rtl::OUString msOverwriteWarning; // RID_UPDATE_STR_OVERWRITE_WARNING - rtl::OUString msPercent; // RID_UPDATE_STR_PERCENT - rtl::OUString msReloadWarning; // RID_UPDATE_STR_OVERWRITE_WARNING - rtl::OUString msReloadReload; // RID_UPDATE_STR_OVERWRITE_WARNING - rtl::OUString msReloadContinue; // RID_UPDATE_STR_OVERWRITE_WARNING - rtl::OUString msStatusFL; // RID_UPDATE_FT_STATUS - rtl::OUString msDescription; // RID_UPDATE_FT_DESCRIPTION - rtl::OUString msClose; // RID_UPDATE_BTN_CLOSE - rtl::OUString msDownload; // RID_UPDATE_BTN_DOWNLOAD - rtl::OUString msInstall; // RID_UPDATE_BTN_INSTALL - rtl::OUString msPauseBtn; // RID_UPDATE_BTN_PAUSE - rtl::OUString msResumeBtn; // RID_UPDATE_BTN_RESUME - rtl::OUString msCancelBtn; // RID_UPDATE_BTN_CANCEL - rtl::OUString msButtonIDs[ BUTTON_COUNT ]; - rtl::OUString msBubbleTexts[ UPDATESTATES_COUNT ]; - rtl::OUString msBubbleTitles[ UPDATESTATES_COUNT ]; - - void createDialog(); - void updateState( UpdateState eNewState ); - void startThrobber( bool bStart = true ); - void setControlProperty( const rtl::OUString &rCtrlName, - const rtl::OUString &rPropName, - const com::sun::star::uno::Any &rPropValue ); - void showControl( const rtl::OUString &rCtrlName, bool bShow = true ); - void showControls( short nControls ); - void focusControl( DialogControls eID ); - void enableControls( short nCtrlState ); - void setDownloadBtnLabel( bool bAppendDots ); - void loadStrings(); - rtl::OUString loadString( const com::sun::star::uno::Reference< com::sun::star::resource::XResourceBundle > xBundle, - sal_Int32 nResourceId ) const; - rtl::OUString substVariables( const rtl::OUString &rSource ) const; - static void setProperty( com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > &rProps, - const int nIndex, const rtl::OUString &rPropName, const com::sun::star::uno::Any &rPropValue ) - { rProps[ nIndex ].Name = rPropName; rProps[ nIndex ].Value = rPropValue; } - static void insertControlModel( com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > & rxDialogModel, - rtl::OUString const & rServiceName, - rtl::OUString const & rControlName, - com::sun::star::awt::Rectangle const & rPosSize, - com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > const & rProps ); - - void setFullVersion( rtl::OUString& rString ); - void searchAndReplaceAll( rtl::OUString &rText, const rtl::OUString &rWhat, const rtl::OUString &rWith ) const; - -public: - UpdateHandler( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext, - const rtl::Reference< IActionListener > & rxActionListener ); - virtual ~UpdateHandler(); - - bool isVisible() const; - bool isMinimized() const { return mbMinimized; } - void setVisible( bool bVisible = true ); - void setProgress( sal_Int32 nPercent ); - void setNextVersion( const rtl::OUString &rNextVersion ) { msNextVersion = rNextVersion; } - void setDownloadPath( const rtl::OUString &rPath ) { msDownloadPath = rPath; } - void setDownloadFile( const rtl::OUString &rPath ); - void setErrorMessage( const rtl::OUString &rErrorMsg ); - void setDescription( const rtl::OUString &rDescription ){ msDescriptionMsg = rDescription; } - - void setState( UpdateState eState ); - rtl::OUString getBubbleText( UpdateState eState ); - rtl::OUString getBubbleTitle( UpdateState eState ); - rtl::OUString getDefaultInstErrMsg(); - bool showWarning( const rtl::OUString &rWarning ) const; - bool showWarning( const rtl::OUString &rWarning, const rtl::OUString& rBtnText_1, const rtl::OUString& rBtnText_2 ) const; - bool showOverwriteWarning( const rtl::OUString &rFileName ) const; - bool showOverwriteWarning() const; - - // Allows runtime exceptions to be thrown by const methods - inline SAL_CALL operator com::sun::star::uno::Reference< com::sun::star::uno::XInterface > () const - { return const_cast< cppu::OWeakObject * > (static_cast< cppu::OWeakObject const * > (this)); }; - - // XActionListener - virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject &rObj ) throw( com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL actionPerformed( com::sun::star::awt::ActionEvent const & rEvent) throw( com::sun::star::uno::RuntimeException ); - - // XTopWindowListener - virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - - // XInteractionHandler - virtual void SAL_CALL handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& Request ) - throw( com::sun::star::uno::RuntimeException ); - - // XTerminateListener - virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); -}; - -#endif /* INCLUDED_UPDATE_HDL_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updatehdl.src b/extensions/source/update/check/updatehdl.src deleted file mode 100644 index ccfcf9109..000000000 --- a/extensions/source/update/check/updatehdl.src +++ /dev/null @@ -1,264 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "updatehdl.hrc" - -String RID_UPDATE_STR_CHECKING -{ - Text [ en-US ] = "Checking..."; -}; - -String RID_UPDATE_STR_CHECKING_ERR -{ - Text [ en-US ] = "Checking for an update failed."; -}; - -String RID_UPDATE_STR_NO_UPD_FOUND -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION is up to date."; -}; - -String RID_UPDATE_STR_UPD_FOUND -{ - Text [ en-US ] = "%PRODUCTNAME %NEXTVERSION is available.\n\nThe installed version is %PRODUCTNAME %PRODUCTVERSION.\n\nNote: Before downloading an update, please ensure that you have sufficient access rights to install it.\nA password, usually the administrator's or root password, may be required."; -}; - -String RID_UPDATE_STR_DLG_TITLE -{ - Text [ en-US ] = "Check for Updates"; -}; - -String RID_UPDATE_STR_DOWNLOAD_PAUSE -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION paused at..."; -}; - -String RID_UPDATE_STR_DOWNLOAD_ERR -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION stalled at"; -}; - -String RID_UPDATE_STR_DOWNLOAD_WARN -{ - Text [ en-US ] = "The download location is: %DOWNLOAD_PATH.\n\nUnder Tools – Options... - %PRODUCTNAME – Online Update you can change the download location."; -}; - -String RID_UPDATE_STR_DOWNLOAD_DESCR -{ - Text [ en-US ] = "%FILE_NAME has been downloaded to %DOWNLOAD_PATH."; -}; - -String RID_UPDATE_STR_DOWNLOAD_UNAVAIL -{ - Text [ en-US ] = "The automatic download of the update is currently not available.\n\nClick 'Download...' to download %PRODUCTNAME %NEXTVERSION manually from the web site."; -}; - -String RID_UPDATE_STR_DOWNLOADING -{ - Text [ en-US ] = "Downloading %PRODUCTNAME %NEXTVERSION..."; -}; - -String RID_UPDATE_STR_READY_INSTALL -{ - Text [ en-US ] = "Download of %PRODUCTNAME %NEXTVERSION completed. Ready for installation."; -}; - -String RID_UPDATE_STR_CANCEL_TITLE -{ - Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION"; -}; - -String RID_UPDATE_STR_CANCEL_DOWNLOAD -{ - Text [ en-US ] = "Do you really want to cancel the download?"; -}; - -String RID_UPDATE_STR_BEGIN_INSTALL -{ - Text [ en-US ] = "To install the update, %PRODUCTNAME %PRODUCTVERSION needs to be closed. Do you want to install the update now?"; -}; - -String RID_UPDATE_STR_INSTALL_NOW -{ - Text [ en-US ] = "Install ~now"; -}; - -String RID_UPDATE_STR_INSTALL_LATER -{ - Text [ en-US ] = "Install ~later"; -}; - -String RID_UPDATE_STR_INSTALL_ERROR -{ - Text [ en-US ] = "Could not run the installer application, please run %FILE_NAME in %DOWNLOAD_PATH manually."; -}; - -String RID_UPDATE_STR_OVERWRITE_WARNING -{ - Text [ en-US ] = "A file with that name already exists! Do you want to overwrite the existing file?"; -}; - -String RID_UPDATE_STR_RELOAD_WARNING -{ - Text [ en-US ] = "A file with the name '%FILENAME' already exists in '%DOWNLOAD_PATH'! Do you want to continue with the download or delete and reload the file?"; -}; - -String RID_UPDATE_STR_RELOAD_RELOAD -{ - Text [ en-US ] = "Reload File"; -}; - -String RID_UPDATE_STR_RELOAD_CONTINUE -{ - Text [ en-US ] = "Continue"; -}; - -String RID_UPDATE_STR_PERCENT -{ - Text [ en-US ] = "%PERCENT%"; -}; - -String RID_UPDATE_FT_STATUS -{ - Text [ en-US ] = "Status"; -}; - -String RID_UPDATE_FT_DESCRIPTION -{ - Text [ en-US ] = "Description"; -}; - -String RID_UPDATE_BTN_CLOSE -{ - Text [ en-US ] = "Close"; -}; - -String RID_UPDATE_BTN_DOWNLOAD -{ - Text [ en-US ] = "~Download"; -}; - -String RID_UPDATE_BTN_INSTALL -{ - Text [ en-US ] = "~Install"; -}; - -String RID_UPDATE_BTN_PAUSE -{ - Text [ en-US ] = "~Pause"; -}; - -String RID_UPDATE_BTN_RESUME -{ - Text [ en-US ] = "~Resume"; -}; - -String RID_UPDATE_BTN_CANCEL -{ - Text [ en-US ] = "Cancel"; -}; - -String RID_UPDATE_BUBBLE_T_UPDATE_AVAIL -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_UPDATE_AVAIL -{ - Text [ en-US ] = "Click here to start the download."; -}; - -String RID_UPDATE_BUBBLE_T_UPDATE_NO_DOWN -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_UPDATE_NO_DOWN -{ - Text [ en-US ] = "Click here for more information."; -}; - -String RID_UPDATE_BUBBLE_T_AUTO_START -{ - Text [ en-US ] = "%PRODUCTNAME update available"; -}; - -String RID_UPDATE_BUBBLE_AUTO_START -{ - Text [ en-US ] = "Download of update begins."; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOADING -{ - Text [ en-US ] = "Download of update in progress"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOADING -{ - Text [ en-US ] = ""; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOAD_PAUSED -{ - Text [ en-US ] = "Download of update paused"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOAD_PAUSED -{ - Text [ en-US ] = "Click here to resume."; -}; - -String RID_UPDATE_BUBBLE_T_ERROR_DOWNLOADING -{ - Text [ en-US ] = "Download of update stalled"; -}; - -String RID_UPDATE_BUBBLE_ERROR_DOWNLOADING -{ - Text [ en-US ] = "Click here for more information."; -}; - -String RID_UPDATE_BUBBLE_T_DOWNLOAD_AVAIL -{ - Text [ en-US ] = "Download of update completed"; -}; - -String RID_UPDATE_BUBBLE_DOWNLOAD_AVAIL -{ - Text [ en-US ] = "Click here to start the installation."; -}; - -String RID_UPDATE_BUBBLE_T_EXT_UPD_AVAIL -{ - Text [ en-US ] = "Updates for extensions available"; -}; - -String RID_UPDATE_BUBBLE_EXT_UPD_AVAIL -{ - Text [ en-US ] = "Click here for more information."; -}; - diff --git a/extensions/source/update/check/updateinfo.hxx b/extensions/source/update/check/updateinfo.hxx deleted file mode 100644 index 0db0c4e66..000000000 --- a/extensions/source/update/check/updateinfo.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _UPDATE_INFO_INCLUDED_ -#define _UPDATE_INFO_INCLUDED_ - -#include -#include - -struct DownloadSource -{ - bool IsDirect; - rtl::OUString URL; - - DownloadSource(bool bIsDirect, const rtl::OUString& aURL) : IsDirect(bIsDirect), URL(aURL) {}; - DownloadSource(const DownloadSource& ds) : IsDirect(ds.IsDirect), URL(ds.URL) {}; - - DownloadSource & operator=( const DownloadSource & ds ) { IsDirect = ds.IsDirect; URL = ds.URL; return *this; }; -}; - -struct ReleaseNote -{ - sal_uInt8 Pos; - rtl::OUString URL; - sal_uInt8 Pos2; - rtl::OUString URL2; - - ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL) : Pos(pos), URL(aURL), Pos2(0), URL2() {}; - ReleaseNote(sal_uInt8 pos, const rtl::OUString aURL, sal_uInt8 pos2, const rtl::OUString aURL2) : Pos(pos), URL(aURL), Pos2(pos2), URL2(aURL2) {}; - - ReleaseNote(const ReleaseNote& rn) :Pos(rn.Pos), URL(rn.URL), Pos2(rn.Pos2), URL2(rn.URL2) {}; - ReleaseNote & operator=( const ReleaseNote& rn) { Pos=rn.Pos; URL=rn.URL; Pos2=rn.Pos2; URL2=rn.URL2; return *this; }; -}; - -struct UpdateInfo -{ - rtl::OUString BuildId; - rtl::OUString Version; - rtl::OUString Description; - std::vector< DownloadSource > Sources; - std::vector< ReleaseNote > ReleaseNotes; - - UpdateInfo() : BuildId(), Version(), Description(), Sources(), ReleaseNotes() {}; - UpdateInfo(const UpdateInfo& ui) : BuildId(ui.BuildId), Version(ui.Version), Description(ui.Description), Sources(ui.Sources), ReleaseNotes(ui.ReleaseNotes) {}; - inline UpdateInfo & operator=( const UpdateInfo& ui ); -}; - -UpdateInfo & UpdateInfo::operator=( const UpdateInfo& ui ) -{ - BuildId = ui.BuildId; - Version = ui.Version; - Description = ui.Description; - Sources = ui.Sources; - ReleaseNotes = ui.ReleaseNotes; - return *this; -} - - -// Returns the URL of the release note for the given position -rtl::OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled=false); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx deleted file mode 100644 index 54771b1ac..000000000 --- a/extensions/source/update/check/updateprotocol.cxx +++ /dev/null @@ -1,336 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include - -#include "updateprotocol.hxx" -#include "updatecheckconfig.hxx" - -#include -#include - - -#include -#include -#include -#include -#include -#include - -#include - -namespace css = com::sun::star ; -namespace container = css::container ; -namespace deployment = css::deployment ; -namespace lang = css::lang ; -namespace uno = css::uno ; -namespace task = css::task ; -namespace xml = css::xml ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -//------------------------------------------------------------------------------ - -static bool -getBootstrapData( - uno::Sequence< ::rtl::OUString > & rRepositoryList, - ::rtl::OUString & rBuildID, - ::rtl::OUString & rInstallSetID) -{ - rBuildID = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ); - rtl::Bootstrap::expandMacros( rBuildID ); - if ( ! rBuildID.getLength() ) - return false; - - rInstallSetID = UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateID}" ); - rtl::Bootstrap::expandMacros( rInstallSetID ); - if ( ! rInstallSetID.getLength() ) - return false; - - rtl::OUString aValue( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateURL}" ) ); - rtl::Bootstrap::expandMacros( aValue ); - - if( aValue.getLength() > 0 ) - { - rRepositoryList.realloc(1); - rRepositoryList[0] = aValue; - } - - return true; -} - -//------------------------------------------------------------------------------ - -// Returns 'true' if successfully connected to the update server -bool -checkForUpdates( - UpdateInfo& o_rUpdateInfo, - uno::Reference< uno::XComponentContext > const & rxContext, - uno::Reference< task::XInteractionHandler > const & rxInteractionHandler, - const uno::Reference< deployment::XUpdateInformationProvider >& rUpdateInfoProvider) -{ - OSL_TRACE("checking for updates ..\n"); - - ::rtl::OUString myArch; - ::rtl::OUString myOS; - - rtl::Bootstrap::get(UNISTRING("_OS"), myOS); - rtl::Bootstrap::get(UNISTRING("_ARCH"), myArch); - - uno::Sequence< ::rtl::OUString > aRepositoryList; - ::rtl::OUString aBuildID; - ::rtl::OUString aInstallSetID; - - if( ! ( getBootstrapData(aRepositoryList, aBuildID, aInstallSetID) && (aRepositoryList.getLength() > 0) ) ) - return false; - - if( !rxContext.is() ) - throw uno::RuntimeException( - UNISTRING( "checkForUpdates: empty component context" ), uno::Reference< uno::XInterface >() ); - - OSL_ASSERT( rxContext->getServiceManager().is() ); - - // XPath implementation - uno::Reference< xml::xpath::XXPathAPI > xXPath( - rxContext->getServiceManager()->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), rxContext ), - uno::UNO_QUERY_THROW); - - xXPath->registerNS( UNISTRING("inst"), UNISTRING("http://installation.openoffice.org/description") ); - - if( rxInteractionHandler.is() ) - rUpdateInfoProvider->setInteractionHandler(rxInteractionHandler); - - try - { - uno::Reference< container::XEnumeration > aUpdateInfoEnumeration = - rUpdateInfoProvider->getUpdateInformationEnumeration( aRepositoryList, aInstallSetID ); - - if ( !aUpdateInfoEnumeration.is() ) - return false; // something went wrong .. - - rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii("/child::inst:description[inst:os=\'"); - aBuffer.append( myOS ); - aBuffer.appendAscii("\' and inst:arch=\'"); - aBuffer.append( myArch ); - aBuffer.appendAscii("\' and inst:buildid>"); - aBuffer.append( aBuildID ); - aBuffer.appendAscii("]"); - - rtl::OUString aXPathExpression = aBuffer.makeStringAndClear(); - - while( aUpdateInfoEnumeration->hasMoreElements() ) - { - deployment::UpdateInformationEntry aEntry; - - if( aUpdateInfoEnumeration->nextElement() >>= aEntry ) - { - uno::Reference< xml::dom::XNode > xNode( aEntry.UpdateDocument.get() ); - uno::Reference< xml::dom::XNodeList > xNodeList; - try { - xNodeList = xXPath->selectNodeList(xNode, aXPathExpression - + UNISTRING("/inst:update/attribute::src")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - -/* - o_rUpdateInfo.Sources.push_back( DownloadSource(true, - UNISTRING("http://openoffice.bouncer.osuosl.org/?product=OpenOffice.org&os=solarissparcwjre&lang=en-US&version=2.2.1") ) ); -*/ - - sal_Int32 i, imax = xNodeList->getLength(); - for( i = 0; i < imax; ++i ) - { - uno::Reference< xml::dom::XNode > xNode2( xNodeList->item(i) ); - - if( xNode2.is() ) - { - uno::Reference< xml::dom::XElement > xParent(xNode2->getParentNode(), uno::UNO_QUERY_THROW); - rtl::OUString aType = xParent->getAttribute(UNISTRING("type")); - bool bIsDirect = ( sal_False == aType.equalsIgnoreAsciiCaseAscii("text/html") ); - - o_rUpdateInfo.Sources.push_back( DownloadSource(bIsDirect, xNode2->getNodeValue()) ); - } - } - - uno::Reference< xml::dom::XNode > xNode2; - try { - xNode2 = xXPath->selectSingleNode(xNode, aXPathExpression - + UNISTRING("/inst:version/text()")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - - if( xNode2.is() ) - o_rUpdateInfo.Version = xNode2->getNodeValue(); - - try { - xNode2 = xXPath->selectSingleNode(xNode, aXPathExpression - + UNISTRING("/inst:buildid/text()")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - - if( xNode2.is() ) - o_rUpdateInfo.BuildId = xNode2->getNodeValue(); - - o_rUpdateInfo.Description = aEntry.Description; - - // Release Notes - try { - xNodeList = xXPath->selectNodeList(xNode, aXPathExpression - + UNISTRING("/inst:relnote")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - imax = xNodeList->getLength(); - for( i = 0; i < imax; ++i ) - { - uno::Reference< xml::dom::XElement > xRelNote(xNodeList->item(i), uno::UNO_QUERY); - if( xRelNote.is() ) - { - sal_Int32 pos = xRelNote->getAttribute(UNISTRING("pos")).toInt32(); - - ReleaseNote aRelNote((sal_uInt8) pos, xRelNote->getAttribute(UNISTRING("src"))); - - if( xRelNote->hasAttribute(UNISTRING("src2")) ) - { - pos = xRelNote->getAttribute(UNISTRING("pos2")).toInt32(); - aRelNote.Pos2 = (sal_Int8) pos; - aRelNote.URL2 = xRelNote->getAttribute(UNISTRING("src2")); - } - - o_rUpdateInfo.ReleaseNotes.push_back(aRelNote); - } - } -/* - o_rUpdateInfo.ReleaseNotes.push_back( - ReleaseNote(1, UNISTRING("http://qa.openoffice.org/tests/online_update_test.html")) - ); -*/ - - if( o_rUpdateInfo.Sources.size() > 0 ) - return true; - } - } - } - catch( ... ) - { - return false; - } - - return true; -} - -//------------------------------------------------------------------------------ -bool storeExtensionUpdateInfos( const uno::Reference< uno::XComponentContext > & rxContext, - const uno::Sequence< uno::Sequence< rtl::OUString > > &rUpdateInfos ) -{ - bool bNotify = false; - - if ( rUpdateInfos.hasElements() ) - { - rtl::Reference< UpdateCheckConfig > aConfig = UpdateCheckConfig::get( rxContext ); - - for ( sal_Int32 i = rUpdateInfos.getLength() - 1; i >= 0; i-- ) - { - bNotify |= aConfig->storeExtensionVersion( rUpdateInfos[i][0], rUpdateInfos[i][1] ); - } - } - return bNotify; -} - -//------------------------------------------------------------------------------ -// Returns 'true' if there are updates for any extension - -bool checkForExtensionUpdates( const uno::Reference< uno::XComponentContext > & rxContext ) -{ - uno::Sequence< uno::Sequence< rtl::OUString > > aUpdateList; - - uno::Reference< deployment::XPackageInformationProvider > xInfoProvider; - try - { - uno::Any aValue( rxContext->getValueByName( - UNISTRING( "/singletons/com.sun.star.deployment.PackageInformationProvider" ) ) ); - OSL_VERIFY( aValue >>= xInfoProvider ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "checkForExtensionUpdates: could not create the PackageInformationProvider!" ); - } - - if ( !xInfoProvider.is() ) return false; - - aUpdateList = xInfoProvider->isUpdateAvailable( ::rtl::OUString() ); - bool bNotify = storeExtensionUpdateInfos( rxContext, aUpdateList ); - - return bNotify; -} - -//------------------------------------------------------------------------------ -// Returns 'true' if there are any pending updates for any extension (offline check) - -bool checkForPendingUpdates( const uno::Reference< uno::XComponentContext > & rxContext ) -{ - uno::Sequence< uno::Sequence< rtl::OUString > > aExtensionList; - uno::Reference< deployment::XPackageInformationProvider > xInfoProvider; - try - { - uno::Any aValue( rxContext->getValueByName( - UNISTRING( "/singletons/com.sun.star.deployment.PackageInformationProvider" ) ) ); - OSL_VERIFY( aValue >>= xInfoProvider ); - } - catch( const uno::Exception& ) - { - OSL_FAIL( "checkForExtensionUpdates: could not create the PackageInformationProvider!" ); - } - - if ( !xInfoProvider.is() ) return false; - - bool bPendingUpdateFound = false; - - aExtensionList = xInfoProvider->getExtensionList(); - if ( aExtensionList.hasElements() ) - { - rtl::Reference< UpdateCheckConfig > aConfig = UpdateCheckConfig::get( rxContext ); - - for ( sal_Int32 i = aExtensionList.getLength() - 1; i >= 0; i-- ) - { - bPendingUpdateFound = aConfig->checkExtensionVersion( aExtensionList[i][0], aExtensionList[i][1] ); - if ( bPendingUpdateFound ) - break; - } - } - - return bPendingUpdateFound; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updateprotocol.hxx b/extensions/source/update/check/updateprotocol.hxx deleted file mode 100644 index 3510367b0..000000000 --- a/extensions/source/update/check/updateprotocol.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include - -#include -#include "updateinfo.hxx" - -// Returns 'true' if successfully connected to the update server -bool checkForUpdates( - UpdateInfo& o_rUpdateInfo, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& rxInteractionHandler, - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XUpdateInformationProvider >& rxProvider -); - -// Returns 'true' if there are updates for any extension -bool checkForExtensionUpdates( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext -); - -bool checkForPendingUpdates( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext -); - -bool storeExtensionUpdateInfos( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< rtl::OUString > > &rUpdateInfos -); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updateprotocoltest.cxx b/extensions/source/update/check/updateprotocoltest.cxx deleted file mode 100644 index c9fe2f33c..000000000 --- a/extensions/source/update/check/updateprotocoltest.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -#include "updateprotocol.hxx" - -#include -#include -#include - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -namespace task = ::com::sun::star::task; -namespace uno = ::com::sun::star::uno; - -// ----------------------------------------------------------------------- - -SAL_IMPLEMENT_MAIN() -{ - (void) argv; - (void) argc; - - if( osl_getCommandArgCount() != 0 ) - { - fprintf(stderr, "Usage: updateprotocoltest\n"); - return -1; - } - - // create the initial component context - uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext(); - - // initialize UCB - uno::Sequence< uno::Any > theArguments(2); - theArguments[0] = uno::makeAny( UNISTRING( "Local") ); - theArguments[1] = uno::makeAny( UNISTRING( "Office") ); - - uno::Reference< uno::XInterface > xUCB = - rComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext( - UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ), - theArguments, - rComponentContext ); - - - rtl::OUString aURL; - rtl::OUString aVersion; - - try - { - if( checkForUpdates(rComponentContext, uno::Reference< task::XInteractionHandler > (), aURL, aVersion) ) - { - OSL_TRACE( "Update found: %s on %s", - rtl::OUStringToOString( aVersion, RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8).getStr()); - } - else - { - OSL_TRACE( "no updates found" ); - } - } - catch( ... ) - { - OSL_TRACE( "unhandled exception caught" ); - } - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/updchk.uno.component b/extensions/source/update/check/updchk.uno.component deleted file mode 100644 index b1eb32917..000000000 --- a/extensions/source/update/check/updchk.uno.component +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - diff --git a/extensions/source/update/check/updchk.xml b/extensions/source/update/check/updchk.xml deleted file mode 100644 index 487034ecf..000000000 --- a/extensions/source/update/check/updchk.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - updchk - - Oliver Braun - vnd.sun.UpdateCheck - The - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.setup.UpdateCheck - ... - com.sun.star.beans.NamedValue - com.sun.star.beans.PropertyValue - com.sun.star.container.XNameReplace - com.sun.star.deployment.UpdateInformationProvider - com.sun.star.frame.DispatchResultEvent - com.sun.star.frame.DispatchResultState - com.sun.star.frame.XFrame - com.sun.star.io.XInputStream - com.sun.star.io.XOutputStream - com.sun.star.lang.XComponent - com.sun.star.lang.XMultiComponentFactory - com.sun.star.lang.XMultiServiceFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XSingleComponentFactory - com.sun.star.lang.XSingleServiceFactory - com.sun.star.lang.XTypeProvider - com.sun.star.registry.XRegistryKey - com.sun.star.system.SystemShellExecuteFlags - com.sun.star.system.XSystemShellExecute - com.sun.star.task.XInteractionHandler - com.sun.star.task.XJob - com.sun.star.uno.TypeClass - com.sun.star.uno.XAggregation - com.sun.star.uno.XComponentContext - com.sun.star.uno.XCurrentContext - com.sun.star.uno.XWeak - com.sun.star.util.XChangesBatch - com.sun.star.xml.xpath.XXPathAPI - - cppuhelper - cppu - sal - cppuhelper3$(COM) - cppu3 - sal3 - diff --git a/extensions/source/update/feed/makefile.mk b/extensions/source/update/feed/makefile.mk deleted file mode 100644 index 6361f20bd..000000000 --- a/extensions/source/update/feed/makefile.mk +++ /dev/null @@ -1,72 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=updatefeed - -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# no "lib" prefix -DLLPRE = - -# --- Files --- - -SLOFILES=\ - $(SLO)$/updatefeed.obj \ - -SHL1NOCHECK=TRUE -SHL1TARGET=$(TARGET).uno -SHL1OBJS=$(SLOFILES) - -SHL1IMPLIB=i$(SHL1TARGET) -SHL1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -# --- Targets --- - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/updatefeed.component - -$(MISC)/updatefeed.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - updatefeed.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt updatefeed.component diff --git a/extensions/source/update/feed/test/makefile.mk b/extensions/source/update/feed/test/makefile.mk deleted file mode 100644 index 3d972a761..000000000 --- a/extensions/source/update/feed/test/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/..$/.. - -PRJNAME=extensions -TARGET=updatefeedtest - -TARGETTYPE=CUI -ENABLE_EXCEPTIONS=TRUE - -INCPRE=$(OUT)$/inc$/updatefeed - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - - -SLOFILES=\ - $(SLO)$/updatefeedtest.obj \ - -APP1TARGET=$(TARGET) -APP1OBJS=$(SLOFILES) - -APP1STDLIBS= \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -# --- Targets --- - -.INCLUDE : target.mk - diff --git a/extensions/source/update/feed/test/updatefeedtest.cxx b/extensions/source/update/feed/test/updatefeedtest.cxx deleted file mode 100644 index 073eb9216..000000000 --- a/extensions/source/update/feed/test/updatefeedtest.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include - -#include -#include - -#include - - -#include - -#include -#include -#include - -namespace deployment = ::com::sun::star::deployment; -namespace lang = ::com::sun::star::lang; -namespace uno = ::com::sun::star::uno; -namespace xml = ::com::sun::star::xml; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -// ----------------------------------------------------------------------- - -SAL_IMPLEMENT_MAIN() -{ - (void) argv; - (void) argc; - - if( osl_getCommandArgCount() != 1 ) - { - fprintf(stderr, "Usage: updatefeedtest \n"); - return -1; - } - - // create the initial component context - uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext(); - - // initialize UCB - uno::Sequence< uno::Any > theArguments(2); - theArguments[0] = uno::makeAny( UNISTRING( "Local") ); - theArguments[1] = uno::makeAny( UNISTRING( "Office") ); - - uno::Reference< uno::XInterface > xUCB = - rComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext( - UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ), - theArguments, - rComponentContext ); - - // retrieve the update information provider - uno::Reference< deployment::XUpdateInformationProvider > rUpdateInformationProvider = - deployment::UpdateInformationProvider::create( rComponentContext ); - - uno::Sequence< rtl::OUString > theURLs(1); - osl_getCommandArg( 0, &theURLs[0].pData ); - // theURLs[0] = UNISTRING( "http://localhost/~olli/atomfeed.xml" ); - - rtl::OUString aExtension = UNISTRING( "MyExtension" ); - - try - { - uno::Sequence< uno::Reference< xml::dom::XElement > > theUpdateInfo = - rUpdateInformationProvider->getUpdateInformation( theURLs, aExtension ); - - OSL_TRACE( "getUpdateInformation returns %d element(s)", theUpdateInfo.getLength() ); - } - catch( const uno::Exception & e ) - { - OSL_TRACE( "exception caught: %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr()); - } - catch( ... ) - { - OSL_TRACE( "exception of undetermined type caught" ); - } - - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/feed/updatefeed.component b/extensions/source/update/feed/updatefeed.component deleted file mode 100644 index 2d53ff5f9..000000000 --- a/extensions/source/update/feed/updatefeed.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx deleted file mode 100644 index 87d743945..000000000 --- a/extensions/source/update/feed/updatefeed.cxx +++ /dev/null @@ -1,856 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp" -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace beans = com::sun::star::beans ; -namespace container = com::sun::star::container ; -namespace deployment = com::sun::star::deployment ; -namespace io = com::sun::star::io ; -namespace lang = com::sun::star::lang ; -namespace task = com::sun::star::task ; -namespace ucb = com::sun::star::ucb ; -namespace uno = com::sun::star::uno ; -namespace xml = com::sun::star::xml ; -namespace sdbc = com::sun::star::sdbc ; - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -//------------------------------------------------------------------------------ - -namespace -{ - -#ifdef DEBUG - -class InputStreamWrapper : public ::cppu::WeakImplHelper1< io::XInputStream > -{ - uno::Reference< io::XInputStream > m_xStream; - -public: - InputStreamWrapper(const uno::Reference< io::XInputStream >& rxStream) : - m_xStream(rxStream) {}; - - virtual sal_Int32 SAL_CALL readBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) - { - sal_Int32 n = m_xStream->readBytes(aData, nBytesToRead); - if ( n ) - OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); - return n; - }; - virtual sal_Int32 SAL_CALL readSomeBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) - { - sal_Int32 n = m_xStream->readSomeBytes(aData, nMaxBytesToRead); - if ( n ) - OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); - return n; - }; - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) - throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) - { m_xStream->skipBytes(nBytesToSkip); }; - virtual sal_Int32 SAL_CALL available() - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) - { return m_xStream->available(); }; - virtual void SAL_CALL closeInput( ) - throw (io::NotConnectedException, io::IOException, uno::RuntimeException) - {}; -}; - -#define INPUT_STREAM(i) new InputStreamWrapper(i) -#else -#define INPUT_STREAM(i) i -#endif - -//------------------------------------------------------------------------------ - -class ActiveDataSink : public ::cppu::WeakImplHelper1< io::XActiveDataSink > -{ - uno::Reference< io::XInputStream > m_xStream; - -public: - ActiveDataSink() {}; - - inline operator uno::Reference< io::XActiveDataSink > () { return this; }; - - virtual uno::Reference< io::XInputStream > SAL_CALL getInputStream() - throw (uno::RuntimeException) { return m_xStream; }; - virtual void SAL_CALL setInputStream( uno::Reference< io::XInputStream > const & rStream ) - throw (uno::RuntimeException) { m_xStream = rStream; }; -}; - -//------------------------------------------------------------------------------ - -class UpdateInformationProvider : - public ::cppu::WeakImplHelper4< deployment::XUpdateInformationProvider, - ucb::XCommandEnvironment, - ucb::XWebDAVCommandEnvironment, - lang::XServiceInfo > -{ -public: - static uno::Reference< uno::XInterface > createInstance(const uno::Reference& xContext); - - static uno::Sequence< rtl::OUString > getServiceNames(); - static rtl::OUString getImplName(); - - uno::Reference< xml::dom::XElement > getDocumentRoot(const uno::Reference< xml::dom::XNode >& rxNode); - uno::Reference< xml::dom::XNode > getChildNode(const uno::Reference< xml::dom::XNode >& rxNode, const rtl::OUString& rName); - - - // XUpdateInformationService - virtual uno::Sequence< uno::Reference< xml::dom::XElement > > SAL_CALL - getUpdateInformation( - uno::Sequence< rtl::OUString > const & repositories, - rtl::OUString const & extensionId - ) throw (uno::Exception, uno::RuntimeException); - - virtual void SAL_CALL cancel() - throw (uno::RuntimeException); - - virtual void SAL_CALL setInteractionHandler( - uno::Reference< task::XInteractionHandler > const & handler ) - throw (uno::RuntimeException); - - virtual uno::Reference< container::XEnumeration > SAL_CALL - getUpdateInformationEnumeration( - uno::Sequence< rtl::OUString > const & repositories, - rtl::OUString const & extensionId - ) throw (uno::Exception, uno::RuntimeException); - - // XCommandEnvironment - virtual uno::Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler() - throw ( uno::RuntimeException ); - - virtual uno::Reference< ucb::XProgressHandler > SAL_CALL getProgressHandler() - throw ( uno::RuntimeException ) { return uno::Reference< ucb::XProgressHandler >(); }; - - // XWebDAVCommandEnvironment - virtual uno::Sequence< beans::NamedValue > SAL_CALL getUserRequestHeaders( - const rtl::OUString&, const rtl::OUString& ) - throw ( uno::RuntimeException ) { return m_aRequestHeaderList; }; - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() - throw (uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName) - throw (uno::RuntimeException); - virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (uno::RuntimeException); - -protected: - - virtual ~UpdateInformationProvider(); - static uno::Any getConfigurationItem(uno::Reference const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item); - -private: - uno::Reference< io::XInputStream > load(const rtl::OUString& rURL); - - void storeCommandInfo( sal_Int32 nCommandId, - uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor); - - UpdateInformationProvider(const uno::Reference& xContext, - const uno::Reference< ucb::XContentIdentifierFactory >& xContentIdFactory, - const uno::Reference< ucb::XContentProvider >& xContentProvider, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI); - - const uno::Reference< uno::XComponentContext> m_xContext; - - const uno::Reference< ucb::XContentIdentifierFactory > m_xContentIdFactory; - const uno::Reference< ucb::XContentProvider > m_xContentProvider; - const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder; - const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI; - - uno::Sequence< beans::NamedValue > m_aRequestHeaderList; - - uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor; - uno::Reference< task::XInteractionHandler > m_xInteractionHandler; - uno::Reference< task::XInteractionHandler > m_xPwContainerInteractionHandler; - - osl::Mutex m_aMutex; - osl::Condition m_bCancelled; - - sal_Int32 m_nCommandId; -}; - -//------------------------------------------------------------------------------ - -class UpdateInformationEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration > -{ -public: - UpdateInformationEnumeration(const uno::Reference< xml::dom::XNodeList >& xNodeList, - const uno::Reference< UpdateInformationProvider > xUpdateInformationProvider) : - m_xUpdateInformationProvider(xUpdateInformationProvider), - m_xNodeList(xNodeList), - m_nNodes(xNodeList.is() ? xNodeList->getLength() : 0), - m_nCount(0) - { - }; - - virtual ~UpdateInformationEnumeration() {}; - - // XEnumeration - sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException) { return m_nCount < m_nNodes; }; - uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - OSL_ASSERT( m_xNodeList.is() ); - OSL_ASSERT( m_xUpdateInformationProvider.is() ); - - if( !(m_nCount < m_nNodes ) ) - throw container::NoSuchElementException(rtl::OUString::valueOf(m_nCount), *this); - - try - { - deployment::UpdateInformationEntry aEntry; - - uno::Reference< xml::dom::XNode > xAtomEntryNode( m_xNodeList->item(m_nCount++) ); - - uno::Reference< xml::dom::XNode > xSummaryNode( - m_xUpdateInformationProvider->getChildNode( xAtomEntryNode, UNISTRING( "summary/text()" ) ) - ); - - if( xSummaryNode.is() ) - aEntry.Description = xSummaryNode->getNodeValue(); - - uno::Reference< xml::dom::XNode > xContentNode( - m_xUpdateInformationProvider->getChildNode( xAtomEntryNode, UNISTRING( "content" ) ) ); - - if( xContentNode.is() ) - aEntry.UpdateDocument = m_xUpdateInformationProvider->getDocumentRoot(xContentNode); - - return uno::makeAny(aEntry); - } - - // action has been aborted - catch( ucb::CommandAbortedException const & e) - { throw lang::WrappedTargetException( UNISTRING( "Command aborted" ), *this, uno::makeAny(e) ); } - - // let runtime exception pass - catch( uno::RuntimeException const & ) { throw; } - - // document not accessible - catch( uno::Exception const & e) - { throw lang::WrappedTargetException( UNISTRING( "Document not accessible" ), *this, uno::makeAny(e) ); } - } - -private: - const uno::Reference< UpdateInformationProvider > m_xUpdateInformationProvider; - const uno::Reference< xml::dom::XNodeList > m_xNodeList; - const sal_Int32 m_nNodes; - sal_Int32 m_nCount; -}; - -//------------------------------------------------------------------------------ - -class SingleUpdateInformationEnumeration : public ::cppu::WeakImplHelper1< container::XEnumeration > -{ -public: - SingleUpdateInformationEnumeration(const uno::Reference< xml::dom::XElement >& xElement) - : m_nCount(0) { m_aEntry.UpdateDocument = xElement; }; - virtual ~SingleUpdateInformationEnumeration() {}; - - // XEnumeration - sal_Bool SAL_CALL hasMoreElements() throw (uno::RuntimeException) { return 0 == m_nCount; }; - uno::Any SAL_CALL nextElement() throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if( m_nCount > 0 ) - throw container::NoSuchElementException(rtl::OUString::valueOf(m_nCount), *this); - - ++m_nCount; - return uno::makeAny(m_aEntry); - }; - -private: - sal_uInt8 m_nCount; - deployment::UpdateInformationEntry m_aEntry; -}; - - -//------------------------------------------------------------------------------ - -UpdateInformationProvider::UpdateInformationProvider( - const uno::Reference& xContext, - const uno::Reference< ucb::XContentIdentifierFactory >& xContentIdFactory, - const uno::Reference< ucb::XContentProvider >& xContentProvider, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI -) : m_xContext(xContext), m_xContentIdFactory(xContentIdFactory), - m_xContentProvider(xContentProvider), m_xDocumentBuilder(xDocumentBuilder), - m_xXPathAPI(xXPathAPI), m_aRequestHeaderList(1) -{ - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING("unable to obtain service manager from component context"), - uno::Reference< uno::XInterface >()); - - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( - xServiceManager->createInstanceWithContext( - UNISTRING("com.sun.star.configuration.ConfigurationProvider"), - xContext ), - uno::UNO_QUERY_THROW); - - rtl::OUStringBuffer buf; - rtl::OUString name; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooName")) >>= name; - buf.append(name); - buf.append(sal_Unicode(' ')); - rtl::OUString version; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupVersion")) >>= version; - buf.append(version); - rtl::OUString edition( - UNISTRING( - "${${BRAND_BASE_DIR}/program/edition/edition.ini:" - "EDITIONNAME}")); - rtl::Bootstrap::expandMacros(edition); - if (edition.getLength() != 0) { - buf.append(sal_Unicode(' ')); - buf.append(edition); - } - rtl::OUString extension; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupExtension")) >>= extension; - if (extension.getLength() != 0) { - buf.append(sal_Unicode(' ')); - buf.append(extension); - } - rtl::OUString product(buf.makeStringAndClear()); - - rtl::OUString aBaseBuildId( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); - rtl::Bootstrap::expandMacros( aBaseBuildId ); - - rtl::OUString aBrandBuildId( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); - rtl::Bootstrap::expandMacros( aBrandBuildId ); - - rtl::OUString aUserAgent( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateUserAgent}" ) ); - rtl::Bootstrap::expandMacros( aUserAgent ); - - if ( ! aBaseBuildId.equals( aBrandBuildId ) ) - { - sal_Int32 nIndex = aUserAgent.indexOf( aBrandBuildId, 0 ); - if ( nIndex != -1 ) - aUserAgent = aUserAgent.replaceAt( nIndex, aBrandBuildId.getLength(), aBaseBuildId ); - } - - for (sal_Int32 i = 0;;) { - i = aUserAgent.indexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM(""), i); - if (i == -1) { - break; - } - aUserAgent = aUserAgent.replaceAt( - i, RTL_CONSTASCII_LENGTH(""), product); - i += product.getLength(); - } - - m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language"); - m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); - if( aUserAgent.getLength() > 0 ) - { - m_aRequestHeaderList.realloc(2); - m_aRequestHeaderList[1].Name = UNISTRING("User-Agent"); - m_aRequestHeaderList[1].Value = uno::makeAny(aUserAgent); - } -} - -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > -UpdateInformationProvider::createInstance(const uno::Reference& xContext) -{ - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface > ()); - - uno::Reference< ucb::XContentIdentifierFactory > xContentIdFactory( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ), xContext ), - uno::UNO_QUERY_THROW); - - uno::Reference< ucb::XContentProvider > xContentProvider(xContentIdFactory, uno::UNO_QUERY_THROW); - - uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.dom.DocumentBuilder" ), xContext ), - uno::UNO_QUERY_THROW); - - uno::Reference< xml::xpath::XXPathAPI > xXPath( - xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), xContext ), - uno::UNO_QUERY_THROW); - - xXPath->registerNS( UNISTRING("atom"), UNISTRING("http://www.w3.org/2005/Atom") ); - - return *new UpdateInformationProvider(xContext, xContentIdFactory, xContentProvider, xDocumentBuilder, xXPath); -} - -//------------------------------------------------------------------------------ - -UpdateInformationProvider::~UpdateInformationProvider() -{ -} - -//------------------------------------------------------------------------------ - -uno::Any -UpdateInformationProvider::getConfigurationItem(uno::Reference const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item) -{ - beans::PropertyValue aProperty; - aProperty.Name = UNISTRING("nodepath"); - aProperty.Value = uno::makeAny(node); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] = uno::makeAny( aProperty ); - - uno::Reference< container::XNameAccess > xNameAccess( - configurationProvider->createInstanceWithArguments( - UNISTRING("com.sun.star.configuration.ConfigurationAccess"), - aArgumentList ), - uno::UNO_QUERY_THROW); - - return xNameAccess->getByName(item); -} - -//------------------------------------------------------------------------------ - -void -UpdateInformationProvider::storeCommandInfo( - sal_Int32 nCommandId, - uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor) -{ - osl::MutexGuard aGuard(m_aMutex); - - m_nCommandId = nCommandId; - m_xCommandProcessor = rxCommandProcessor; -} - -//------------------------------------------------------------------------------ - -uno::Reference< io::XInputStream > -UpdateInformationProvider::load(const rtl::OUString& rURL) -{ - uno::Reference< ucb::XContentIdentifier > xId = m_xContentIdFactory->createContentIdentifier(rURL); - - if( !xId.is() ) - throw uno::RuntimeException( - UNISTRING( "unable to obtain universal content id" ), *this); - - uno::Reference< ucb::XCommandProcessor > xCommandProcessor(m_xContentProvider->queryContent(xId), uno::UNO_QUERY_THROW); - rtl::Reference< ActiveDataSink > aSink(new ActiveDataSink()); - - ucb::OpenCommandArgument2 aOpenArgument; - aOpenArgument.Mode = ucb::OpenMode::DOCUMENT; - aOpenArgument.Priority = 32768; - aOpenArgument.Sink = *aSink; - - ucb::Command aCommand; - aCommand.Name = UNISTRING("open"); - aCommand.Argument = uno::makeAny(aOpenArgument); - - sal_Int32 nCommandId = xCommandProcessor->createCommandIdentifier(); - - storeCommandInfo(nCommandId, xCommandProcessor); - try - { - uno::Any aResult = xCommandProcessor->execute(aCommand, nCommandId, - static_cast < XCommandEnvironment *> (this)); - } - catch( const uno::Exception & /* e */ ) - { - storeCommandInfo(0, uno::Reference< ucb::XCommandProcessor > ()); - - uno::Reference< ucb::XCommandProcessor2 > xCommandProcessor2(xCommandProcessor, uno::UNO_QUERY); - if( xCommandProcessor2.is() ) - xCommandProcessor2->releaseCommandIdentifier(nCommandId); - - throw; - } - storeCommandInfo(0, uno::Reference< ucb::XCommandProcessor > ()); - - uno::Reference< ucb::XCommandProcessor2 > xCommandProcessor2(xCommandProcessor, uno::UNO_QUERY); - if( xCommandProcessor2.is() ) - xCommandProcessor2->releaseCommandIdentifier(nCommandId); - - return INPUT_STREAM(aSink->getInputStream()); -} - -//------------------------------------------------------------------------------ - -// TODO: docu content node - -uno::Reference< xml::dom::XElement > -UpdateInformationProvider::getDocumentRoot(const uno::Reference< xml::dom::XNode >& rxNode) -{ - OSL_ASSERT(m_xDocumentBuilder.is()); - - uno::Reference< xml::dom::XElement > xElement(rxNode, uno::UNO_QUERY_THROW); - - // load the document referenced in 'src' attribute .. - if( xElement->hasAttribute( UNISTRING("src") ) ) - { - uno::Reference< xml::dom::XDocument > xUpdateXML = - m_xDocumentBuilder->parse(load(xElement->getAttribute( UNISTRING("src") ))); - - OSL_ASSERT( xUpdateXML.is() ); - - if( xUpdateXML.is() ) - return xUpdateXML->getDocumentElement(); - } - // .. or return the (single) child element - else - { - uno::Reference< xml::dom::XNodeList> xChildNodes = rxNode->getChildNodes(); - - // ignore possible #text nodes - sal_Int32 nmax = xChildNodes->getLength(); - for(sal_Int32 n=0; n < nmax; n++) - { - uno::Reference< xml::dom::XElement > xChildElement(xChildNodes->item(n), uno::UNO_QUERY); - if( xChildElement.is() ) - { - /* Copy the content to a dedicated document since XXPathAPI->selectNodeList - * seems to evaluate expression always relative to the root node. - */ - uno::Reference< xml::dom::XDocument > xUpdateXML = m_xDocumentBuilder->newDocument(); - xUpdateXML->appendChild( xUpdateXML->importNode(xChildElement.get(), sal_True ) ); - return xUpdateXML->getDocumentElement(); - } - } - } - - return uno::Reference< xml::dom::XElement > (); -} - -//------------------------------------------------------------------------------ - -uno::Reference< xml::dom::XNode > -UpdateInformationProvider::getChildNode(const uno::Reference< xml::dom::XNode >& rxNode, - const rtl::OUString& rName) -{ - OSL_ASSERT(m_xXPathAPI.is()); - try { - return m_xXPathAPI->selectSingleNode(rxNode, UNISTRING( "./atom:" ) + rName); - } catch (xml::xpath::XPathException &) { - // ignore - return 0; - } -} - -//------------------------------------------------------------------------------ - -uno::Reference< container::XEnumeration > SAL_CALL -UpdateInformationProvider::getUpdateInformationEnumeration( - uno::Sequence< rtl::OUString > const & repositories, - rtl::OUString const & extensionId -) throw (uno::Exception, uno::RuntimeException) -{ - OSL_ASSERT(m_xDocumentBuilder.is()); - - // reset cancelled flag - m_bCancelled.reset(); - - for(sal_Int32 n=0; n xDocument = m_xDocumentBuilder->parse(load(repositories[n])); - uno::Reference< xml::dom::XElement > xElement; - - if( xDocument.is() ) - xElement = xDocument->getDocumentElement(); - - if( xElement.is() ) - { - if( xElement->getNodeName().equalsAsciiL("feed", 4) ) - { - rtl::OUString aXPathExpression; - - if( extensionId.getLength() > 0 ) - aXPathExpression = UNISTRING("//atom:entry/atom:category[@term=\'") + extensionId + UNISTRING("\']/.."); - else - aXPathExpression = UNISTRING("//atom:entry"); - - uno::Reference< xml::dom::XNodeList > xNodeList; - try { - xNodeList = m_xXPathAPI->selectNodeList(xDocument.get(), - aXPathExpression); - } catch (xml::xpath::XPathException &) { - // ignore - } - - return new UpdateInformationEnumeration(xNodeList, this); - } - else - { - return new SingleUpdateInformationEnumeration(xElement); - } - } - - if( m_bCancelled.check() ) - break; - } - // rethrow runtime exceptions - catch( uno::RuntimeException const & ) { throw; } - - // rethrow only if last url in the list - catch( uno::Exception const & ) - { - if( n+1 >= repositories.getLength() ) - throw; - } - } - - return uno::Reference< container::XEnumeration >(); -} - -//------------------------------------------------------------------------------ - -uno::Sequence< uno::Reference< xml::dom::XElement > > SAL_CALL -UpdateInformationProvider::getUpdateInformation( - uno::Sequence< rtl::OUString > const & repositories, - rtl::OUString const & extensionId -) throw (uno::Exception, uno::RuntimeException) -{ - uno::Reference< container::XEnumeration > xEnumeration( - getUpdateInformationEnumeration(repositories, extensionId) - ); - - uno::Sequence< uno::Reference< xml::dom::XElement > > aRet; - - if( xEnumeration.is() ) - { - while( xEnumeration->hasMoreElements() ) - { - try - { - deployment::UpdateInformationEntry aEntry; - if( (xEnumeration->nextElement() >>= aEntry ) && aEntry.UpdateDocument.is() ) - { - sal_Int32 n = aRet.getLength(); - aRet.realloc(n + 1); - aRet[n] = aEntry.UpdateDocument; - } - } - - catch( const lang::WrappedTargetException& e ) - { - // command aborted, return what we have got so far - if( e.TargetException.isExtractableTo( ::cppu::UnoType< ::com::sun::star::ucb::CommandAbortedException >::get() ) ) - { - break; - } - - // ignore files that can't be loaded - } - } - } - - return aRet; -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateInformationProvider::cancel() throw (uno::RuntimeException) -{ - m_bCancelled.set(); - - osl::MutexGuard aGuard(m_aMutex); - if( m_xCommandProcessor.is() ) - m_xCommandProcessor->abort(m_nCommandId); -} - -//------------------------------------------------------------------------------ - -void SAL_CALL -UpdateInformationProvider::setInteractionHandler( - uno::Reference< task::XInteractionHandler > const & handler ) - throw (uno::RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - m_xInteractionHandler = handler; -} - -//------------------------------------------------------------------------------ - -uno::Reference< task::XInteractionHandler > SAL_CALL -UpdateInformationProvider::getInteractionHandler() - throw ( uno::RuntimeException ) -{ - osl::MutexGuard aGuard( m_aMutex ); - - if ( m_xInteractionHandler.is() ) - return m_xInteractionHandler; - else - { - try - { - // Supply an interaction handler that uses the password container - // service to obtain credentials without displaying a password gui. - - if ( !m_xPwContainerInteractionHandler.is() ) - m_xPwContainerInteractionHandler - = task::PasswordContainerInteractionHandler::create( - m_xContext ); - } - catch ( uno::RuntimeException const & ) - { - throw; - } - catch ( uno::Exception const & ) - { - } - return m_xPwContainerInteractionHandler; - } -} -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > -UpdateInformationProvider::getServiceNames() -{ - uno::Sequence< rtl::OUString > aServiceList(1); - aServiceList[0] = UNISTRING( "com.sun.star.deployment.UpdateInformationProvider"); - return aServiceList; -}; - -//------------------------------------------------------------------------------ - -rtl::OUString -UpdateInformationProvider::getImplName() -{ - return UNISTRING( "vnd.sun.UpdateInformationProvider"); -} - -//------------------------------------------------------------------------------ - -rtl::OUString SAL_CALL -UpdateInformationProvider::getImplementationName() throw (uno::RuntimeException) -{ - return getImplName(); -} - -//------------------------------------------------------------------------------ - -uno::Sequence< rtl::OUString > SAL_CALL -UpdateInformationProvider::getSupportedServiceNames() throw (uno::RuntimeException) -{ - return getServiceNames(); -} - -//------------------------------------------------------------------------------ - -sal_Bool SAL_CALL -UpdateInformationProvider::supportsService( rtl::OUString const & serviceName ) throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > aServiceNameList = getServiceNames(); - - for( sal_Int32 n=0; n < aServiceNameList.getLength(); n++ ) - if( aServiceNameList[n].equals(serviceName) ) - return sal_True; - - return sal_False; -} - -} // anonymous namespace - -//------------------------------------------------------------------------------ - -static uno::Reference SAL_CALL -createInstance(uno::Reference const & xContext) -{ - return UpdateInformationProvider::createInstance(xContext); -} - -//------------------------------------------------------------------------------ - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createInstance, - UpdateInformationProvider::getImplName, - UpdateInformationProvider::getServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; - -//------------------------------------------------------------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char *pszImplementationName, void *pServiceManager, void *pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pszImplementationName, - pServiceManager, - pRegistryKey, - kImplementations_entries) ; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/feed/updatefeed.xml b/extensions/source/update/feed/updatefeed.xml deleted file mode 100644 index b8606a643..000000000 --- a/extensions/source/update/feed/updatefeed.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - updatefeed - - Oliver Braun - vnd.sun.UpdateCheck - The - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.deployment.UpdateInformationProvider - ... - com.sun.star.beans.NamedValue - com.sun.star.beans.PropertyValue - com.sun.star.container.XNameReplace - com.sun.star.deployment.UpdateInformationProvider - com.sun.star.io.XInputStream - com.sun.star.io.XOutputStream - com.sun.star.lang.XComponent - com.sun.star.lang.XInitialization - com.sun.star.lang.XMultiComponentFactory - com.sun.star.lang.XMultiServiceFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XSingleComponentFactory - com.sun.star.lang.XSingleServiceFactory - com.sun.star.lang.XTypeProvider - com.sun.star.registry.XRegistryKey - com.sun.star.task.XInteractionHandler - com.sun.star.ucb.PostCommandArgument2 - com.sun.star.ucb.XCommandEnvironment - com.sun.star.ucb.XCommandProcessor2 - com.sun.star.ucb.XContentIdentifierFactory - com.sun.star.ucb.XContentProvider - com.sun.star.ucb.XProgressHandler - com.sun.star.uno.TypeClass - com.sun.star.uno.XAggregation - com.sun.star.uno.XComponentContext - com.sun.star.uno.XCurrentContext - com.sun.star.uno.XWeak - com.sun.star.util.XChangesBatch - - cppuhelper - cppu - sal - cppuhelper3$(COM) - cppu3 - sal3 - diff --git a/extensions/source/update/tools/makefile.mk b/extensions/source/update/tools/makefile.mk deleted file mode 100644 index 110887bb1..000000000 --- a/extensions/source/update/tools/makefile.mk +++ /dev/null @@ -1,44 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/.. -PRJNAME = extensions -TARGET = ztool -LIBTARGET = NO -TARGETTYPE = CUI -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE: settings.mk - -OBJFILES = \ - $(OBJ)$/ztool.obj - -APP1TARGET = ztool -APP1OBJS = $(OBJ)$/ztool.obj -APP1STDLIBS = $(TOOLSLIB) - -.INCLUDE: target.mk diff --git a/extensions/source/update/tools/ztool.cxx b/extensions/source/update/tools/ztool.cxx deleted file mode 100644 index ad40c9feb..000000000 --- a/extensions/source/update/tools/ztool.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include - -#include -#include - -void show_usage() -{ - fputs("ztool usage: ztool \n", stderr); -} - -int SAL_CALL main( int argc, char **argv ) -{ - if ( argc != 3 ) - { - show_usage(); - return -1; - } - UniString aInName = UniString::CreateFromAscii( argv[1] ); - UniString aOutName = UniString::CreateFromAscii( argv[2] ); - SvFileStream aInFile( aInName, STREAM_READ ); - SvFileStream aOutFile( aOutName, STREAM_WRITE | STREAM_TRUNC ); - - ZCodec aCompressor; - aCompressor.BeginCompression(); - aCompressor.Compress( aInFile, aOutFile ); - aCompressor.EndCompression(); - - return 0; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/ui/makefile.mk b/extensions/source/update/ui/makefile.mk deleted file mode 100644 index 5ea6994d3..000000000 --- a/extensions/source/update/ui/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=updchkui - -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - -SLOFILES=\ - $(SLO)$/updatecheckui.obj - -SRS1NAME=$(TARGET) -SRC1FILES=\ - updatecheckui.src - -RESLIB1NAME=updchk -RESLIB1IMAGES=$(PRJ)$/source$/update$/ui -RESLIB1SRSFILES= $(SRS)$/updchkui.srs -RESLIB1DEPN= updatecheckui.src updatecheckui.hrc - -SHL1NOCHECK=TRUE -SHL1TARGET=updchk$(DLLPOSTFIX) -SHL1OBJS=$(SLOFILES) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -SHL1IMPLIB=i$(SHL1TARGET) -SHL1STDLIBS= \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(VCLLIB) \ - $(TOOLSLIB) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -# --- Targets --- - -.INCLUDE : target.mk - - -ALLTAR : $(MISC)/updchk.component - -$(MISC)/updchk.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - updchk.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt updchk.component diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx deleted file mode 100644 index 8c5be1bdf..000000000 --- a/extensions/source/update/ui/updatecheckui.cxx +++ /dev/null @@ -1,1056 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rtl/ustrbuf.hxx" - -#include "updatecheckui.hrc" - -#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) - -#define MSG_ERR_NO_WEBBROWSER_FOUND (RID_SFX_APP_START + 7) -#define DEFAULT_MENUBAR_HEIGHT 24 - -#define PROPERTY_TITLE RTL_CONSTASCII_STRINGPARAM("BubbleHeading") -#define PROPERTY_TEXT RTL_CONSTASCII_STRINGPARAM("BubbleText") -#define PROPERTY_IMAGE RTL_CONSTASCII_STRINGPARAM("BubbleImageURL") -#define PROPERTY_SHOW_BUBBLE RTL_CONSTASCII_STRINGPARAM("BubbleVisible") -#define PROPERTY_CLICK_HDL RTL_CONSTASCII_STRINGPARAM("MenuClickHDL") -#define PROPERTY_SHOW_MENUICON RTL_CONSTASCII_STRINGPARAM("MenuIconVisible") - -#define START_TIMER 1 - -using namespace ::com::sun::star; - -//------------------------------------------------------------------------------ - -static uno::Sequence< rtl::OUString > getServiceNames() -{ - uno::Sequence< rtl::OUString > aServiceList(1); - aServiceList[0] = UNISTRING( "com.sun.star.setup.UpdateCheckUI"); - return aServiceList; -} - -//------------------------------------------------------------------------------ - -static rtl::OUString getImplementationName() -{ - return UNISTRING( "vnd.sun.UpdateCheckUI"); -} - -//------------------------------------------------------------------------------ - -namespace -{ - -//------------------------------------------------------------------------------ -class BubbleWindow : public FloatingWindow -{ - Point maTipPos; - Region maBounds; - Polygon maRectPoly; - Polygon maTriPoly; - XubString maBubbleTitle; - XubString maBubbleText; - Image maBubbleImage; - Size maMaxTextSize; - Rectangle maTitleRect; - Rectangle maTextRect; - long mnTipOffset; - -private: - void RecalcTextRects(); - -public: - BubbleWindow( Window* pParent, const XubString& rTitle, - const XubString& rText, const Image& rImage ); - ~BubbleWindow(); - - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Paint( const Rectangle& rRect ); - void Resize(); - void Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = SHOW_NOACTIVATE ); - void SetTipPosPixel( const Point& rTipPos ) { maTipPos = rTipPos; } - void SetTitleAndText( const XubString& rTitle, const XubString& rText, - const Image& rImage ); -}; - -//------------------------------------------------------------------------------ -class UpdateCheckUI : public ::cppu::WeakImplHelper3 - < lang::XServiceInfo, document::XEventListener, beans::XPropertySet > -{ - uno::Reference< uno::XComponentContext > m_xContext; - uno::Reference< task::XJob > mrJob; - rtl::OUString maBubbleTitle; - rtl::OUString maBubbleText; - rtl::OUString maBubbleImageURL; - Image maBubbleImage; - BubbleWindow* mpBubbleWin; - SystemWindow* mpIconSysWin; - MenuBar* mpIconMBar; - ResMgr* mpUpdResMgr; - ResMgr* mpSfxResMgr; - Timer maWaitTimer; - Timer maTimeoutTimer; - Link maWindowEventHdl; - Link maApplicationEventHdl; - bool mbShowBubble; - bool mbShowMenuIcon; - bool mbBubbleChanged; - sal_uInt16 mnIconID; - -private: - DECL_LINK( ClickHdl, sal_uInt16* ); - DECL_LINK( HighlightHdl, MenuBar::MenuBarButtonCallbackArg* ); - DECL_LINK( WaitTimeOutHdl, Timer* ); - DECL_LINK( TimeOutHdl, Timer* ); - DECL_LINK( UserEventHdl, UpdateCheckUI* ); - DECL_LINK( WindowEventHdl, VclWindowEvent* ); - DECL_LINK( ApplicationEventHdl, VclSimpleEvent* ); - - BubbleWindow* GetBubbleWindow(); - void RemoveBubbleWindow( bool bRemoveIcon ); - Image GetMenuBarIcon( MenuBar* pMBar ); - void AddMenuBarIcon( SystemWindow* pSysWin, bool bAddEventHdl ); - Image GetBubbleImage( ::rtl::OUString &rURL ); - - uno::Reference< document::XEventBroadcaster > getGlobalEventBroadcaster() const - throw (uno::RuntimeException); - -public: - UpdateCheckUI(const uno::Reference&); - virtual ~UpdateCheckUI(); - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() - throw (uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName) - throw (uno::RuntimeException); - virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() - throw (uno::RuntimeException); - - // XEventListener - virtual void SAL_CALL notifyEvent(const document::EventObject& Event) - throw (uno::RuntimeException); - virtual void SAL_CALL disposing(const lang::EventObject& Event) - throw (uno::RuntimeException); - - //XPropertySet - virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(void) - throw ( uno::RuntimeException ); - virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const uno::Any& aValue) - throw( beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ); - virtual uno::Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) - throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ); - virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, - const uno::Reference< beans::XPropertyChangeListener > & aListener) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ); - virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, - const uno::Reference< beans::XPropertyChangeListener > & aListener) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ); - virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener > & aListener) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ); - virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, - const uno::Reference< beans::XVetoableChangeListener > & aListener) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ); -}; - -//------------------------------------------------------------------------------ -UpdateCheckUI::UpdateCheckUI(const uno::Reference& xContext) : - m_xContext(xContext) - , mpBubbleWin( NULL ) - , mpIconSysWin( NULL ) - , mpIconMBar( NULL ) - , mbShowBubble( false ) - , mbShowMenuIcon( false ) - , mbBubbleChanged( false ) - , mnIconID( 0 ) -{ - mpUpdResMgr = ResMgr::CreateResMgr( "updchk" ); - mpSfxResMgr = ResMgr::CreateResMgr( "sfx" ); - - maBubbleImage = GetBubbleImage( maBubbleImageURL ); - - maWaitTimer.SetTimeout( 400 ); - maWaitTimer.SetTimeoutHdl( LINK( this, UpdateCheckUI, WaitTimeOutHdl ) ); - - maTimeoutTimer.SetTimeout( 10000 ); - maTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateCheckUI, TimeOutHdl ) ); - - uno::Reference< document::XEventBroadcaster > xBroadcaster( getGlobalEventBroadcaster() ); - xBroadcaster->addEventListener( this ); - - maWindowEventHdl = LINK( this, UpdateCheckUI, WindowEventHdl ); - maApplicationEventHdl = LINK( this, UpdateCheckUI, ApplicationEventHdl ); - Application::AddEventListener( maApplicationEventHdl ); -} - -//------------------------------------------------------------------------------ -UpdateCheckUI::~UpdateCheckUI() -{ - Application::RemoveEventListener( maApplicationEventHdl ); - RemoveBubbleWindow( true ); - delete mpUpdResMgr; - delete mpSfxResMgr; -} - -//------------------------------------------------------------------------------ -uno::Reference -UpdateCheckUI::getGlobalEventBroadcaster() const throw (uno::RuntimeException) -{ - if( !m_xContext.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckUI: empty component context" ), - uno::Reference< uno::XInterface >() ); - - uno::Reference< lang::XMultiComponentFactory > xServiceManager(m_xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface >() ); - - return uno::Reference ( - xServiceManager->createInstanceWithContext( - UNISTRING( "com.sun.star.frame.GlobalEventBroadcaster" ), - m_xContext), - uno::UNO_QUERY_THROW); -} - -//------------------------------------------------------------------------------ -rtl::OUString SAL_CALL -UpdateCheckUI::getImplementationName() throw (uno::RuntimeException) -{ - return ::getImplementationName(); -} - -//------------------------------------------------------------------------------ -uno::Sequence< rtl::OUString > SAL_CALL -UpdateCheckUI::getSupportedServiceNames() throw (uno::RuntimeException) -{ - return ::getServiceNames(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL -UpdateCheckUI::supportsService( rtl::OUString const & serviceName ) throw (uno::RuntimeException) -{ - uno::Sequence< rtl::OUString > aServiceNameList = ::getServiceNames(); - - for( sal_Int32 n=0; n < aServiceNameList.getLength(); n++ ) - if( aServiceNameList[n].equals(serviceName) ) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------------ -Image UpdateCheckUI::GetMenuBarIcon( MenuBar* pMBar ) -{ - sal_uInt32 nResID; - Window *pMBarWin = pMBar->GetWindow(); - sal_uInt32 nMBarHeight = 20; - - if ( pMBarWin ) - nMBarHeight = pMBarWin->GetOutputSizePixel().getHeight(); - - if ( nMBarHeight >= 35 ) - nResID = RID_UPDATE_AVAILABLE_26; - else - nResID = RID_UPDATE_AVAILABLE_16; - - return Image( ResId( nResID, *mpUpdResMgr ) ); -} - -//------------------------------------------------------------------------------ -Image UpdateCheckUI::GetBubbleImage( ::rtl::OUString &rURL ) -{ - Image aImage; - - if ( maBubbleImageURL.getLength() != 0 ) - { - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING( "UpdateCheckUI: unable to obtain service manager from component context" ), - uno::Reference< uno::XInterface >() ); - - try - { - uno::Reference< graphic::XGraphicProvider > xGraphProvider( - xServiceManager->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), - uno::UNO_QUERY ); - if ( xGraphProvider.is() ) - { - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); - aMediaProps[0].Value <<= rURL; - - uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); - if ( xGraphic.is() ) - { - aImage = Image( xGraphic ); - } - } - } - catch( uno::Exception& ) - { - } - } - - if ( aImage.GetSizePixel().Width() == 0 ) - aImage = InfoBox::GetStandardImage(); - - return aImage; -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::AddMenuBarIcon( SystemWindow *pSysWin, bool bAddEventHdl ) -{ - if ( ! mbShowMenuIcon ) - return; - - SolarMutexGuard aGuard; - - MenuBar *pActiveMBar = pSysWin->GetMenuBar(); - if ( ( pSysWin != mpIconSysWin ) || ( pActiveMBar != mpIconMBar ) ) - { - if ( bAddEventHdl && mpIconSysWin ) - mpIconSysWin->RemoveEventListener( maWindowEventHdl ); - - RemoveBubbleWindow( true ); - - if ( pActiveMBar ) - { - rtl::OUStringBuffer aBuf; - if( maBubbleTitle.getLength() ) - aBuf.append( maBubbleTitle ); - if( maBubbleText.getLength() ) - { - if( maBubbleTitle.getLength() ) - aBuf.appendAscii( "\n\n" ); - aBuf.append( maBubbleText ); - } - - Image aImage = GetMenuBarIcon( pActiveMBar ); - mnIconID = pActiveMBar->AddMenuBarButton( aImage, - LINK( this, UpdateCheckUI, ClickHdl ), - aBuf.makeStringAndClear() - ); - pActiveMBar->SetMenuBarButtonHighlightHdl( mnIconID, - LINK( this, UpdateCheckUI, HighlightHdl ) ); - } - mpIconMBar = pActiveMBar; - mpIconSysWin = pSysWin; - if ( bAddEventHdl && mpIconSysWin ) - mpIconSysWin->AddEventListener( maWindowEventHdl ); - } - - if ( mbShowBubble && pActiveMBar ) - { - mpBubbleWin = GetBubbleWindow(); - if ( mpBubbleWin ) - { - mpBubbleWin->Show( sal_True ); - maTimeoutTimer.Start(); - } - mbShowBubble = false; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL UpdateCheckUI::notifyEvent(const document::EventObject& rEvent) - throw (uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - if( rEvent.EventName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("OnPrepareViewClosing") ) == 0 ) - { - RemoveBubbleWindow( true ); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL UpdateCheckUI::disposing(const lang::EventObject&) - throw (uno::RuntimeException) -{ -} - -//------------------------------------------------------------------------------ -uno::Reference< beans::XPropertySetInfo > UpdateCheckUI::getPropertySetInfo(void) - throw ( uno::RuntimeException ) -{ - return NULL; -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::setPropertyValue(const rtl::OUString& rPropertyName, - const uno::Any& rValue) - throw( beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - SolarMutexGuard aGuard; - - rtl::OUString aString; - - if( rPropertyName.compareToAscii( PROPERTY_TITLE ) == 0 ) { - rValue >>= aString; - if ( aString != maBubbleTitle ) { - maBubbleTitle = aString; - mbBubbleChanged = true; - } - } - else if( rPropertyName.compareToAscii( PROPERTY_TEXT ) == 0 ) { - rValue >>= aString; - if ( aString != maBubbleText ) { - maBubbleText = aString; - mbBubbleChanged = true; - } - } - else if( rPropertyName.compareToAscii( PROPERTY_IMAGE ) == 0 ) { - rValue >>= aString; - if ( aString != maBubbleImageURL ) { - maBubbleImageURL = aString; - maBubbleImage = GetBubbleImage( maBubbleImageURL ); - mbBubbleChanged = true; - } - } - else if( rPropertyName.compareToAscii( PROPERTY_SHOW_BUBBLE ) == 0 ) { - rValue >>= mbShowBubble; - if ( mbShowBubble ) - Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) ); - else if ( mpBubbleWin ) - mpBubbleWin->Show( sal_False ); - } - else if( rPropertyName.compareToAscii( PROPERTY_CLICK_HDL ) == 0 ) { - uno::Reference< task::XJob > aJob; - rValue >>= aJob; - if ( aJob.is() ) - mrJob = aJob; - else - throw lang::IllegalArgumentException(); - } - else if (rPropertyName.compareToAscii( PROPERTY_SHOW_MENUICON ) == 0) { - bool bShowMenuIcon = sal_False; - rValue >>= bShowMenuIcon; - if ( bShowMenuIcon != mbShowMenuIcon ) - { - mbShowMenuIcon = bShowMenuIcon; - if ( bShowMenuIcon ) - Application::PostUserEvent( LINK( this, UpdateCheckUI, UserEventHdl ) ); - else - RemoveBubbleWindow( true ); - } - } - else - throw beans::UnknownPropertyException(); - - if ( mbBubbleChanged && mpBubbleWin ) - mpBubbleWin->Show( sal_False ); -} - -//------------------------------------------------------------------------------ -uno::Any UpdateCheckUI::getPropertyValue(const rtl::OUString& rPropertyName) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ - SolarMutexGuard aGuard; - - uno::Any aRet; - - if( rPropertyName.compareToAscii( PROPERTY_TITLE ) == 0 ) - aRet = uno::makeAny( maBubbleTitle ); - else if( rPropertyName.compareToAscii( PROPERTY_TEXT ) == 0 ) - aRet = uno::makeAny( maBubbleText ); - else if( rPropertyName.compareToAscii( PROPERTY_SHOW_BUBBLE ) == 0 ) - aRet = uno::makeAny( mbShowBubble ); - else if( rPropertyName.compareToAscii( PROPERTY_IMAGE ) == 0 ) - aRet = uno::makeAny( maBubbleImageURL ); - else if( rPropertyName.compareToAscii( PROPERTY_CLICK_HDL ) == 0 ) - aRet = uno::makeAny( mrJob ); - else if( rPropertyName.compareToAscii( PROPERTY_SHOW_MENUICON ) == 0 ) - aRet = uno::makeAny( mbShowMenuIcon ); - else - throw beans::UnknownPropertyException(); - - return aRet; -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::addPropertyChangeListener( const rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ - //no bound properties -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::removePropertyChangeListener( const rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ - //no bound properties -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::addVetoableChangeListener( const rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ - //no vetoable properties -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::removeVetoableChangeListener( const rtl::OUString& /*aPropertyName*/, - const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ - //no vetoable properties -} - - -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -BubbleWindow * UpdateCheckUI::GetBubbleWindow() -{ - if ( !mpIconSysWin ) - return NULL; - - Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID ); - if( aIconRect.IsEmpty() ) - return NULL; - - BubbleWindow* pBubbleWin = mpBubbleWin; - - if ( !pBubbleWin ) { - pBubbleWin = new BubbleWindow( mpIconSysWin, - XubString( maBubbleTitle ), - XubString( maBubbleText ), - maBubbleImage ); - mbBubbleChanged = false; - } - else if ( mbBubbleChanged ) { - pBubbleWin->SetTitleAndText( XubString( maBubbleTitle ), - XubString( maBubbleText ), - maBubbleImage ); - mbBubbleChanged = false; - } - - Point aWinPos = aIconRect.BottomCenter(); - - pBubbleWin->SetTipPosPixel( aWinPos ); - - return pBubbleWin; -} - -//------------------------------------------------------------------------------ -void UpdateCheckUI::RemoveBubbleWindow( bool bRemoveIcon ) -{ - SolarMutexGuard aGuard; - - maWaitTimer.Stop(); - maTimeoutTimer.Stop(); - - if ( mpBubbleWin ) - { - delete mpBubbleWin; - mpBubbleWin = NULL; - } - - if ( bRemoveIcon ) - { - try { - if ( mpIconMBar && ( mnIconID != 0 ) ) - { - mpIconMBar->RemoveMenuBarButton( mnIconID ); - mpIconMBar = NULL; - mnIconID = 0; - } - } - catch ( ... ) { - mpIconMBar = NULL; - mnIconID = 0; - } - - mpIconSysWin = NULL; - } -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, ClickHdl, sal_uInt16*, EMPTYARG ) -{ - SolarMutexGuard aGuard; - - maWaitTimer.Stop(); - if ( mpBubbleWin ) - mpBubbleWin->Show( sal_False ); - - if ( mrJob.is() ) - { - try { - uno::Sequence aEmpty; - mrJob->execute( aEmpty ); - } - catch(const uno::Exception&) { - ErrorBox( NULL, ResId( MSG_ERR_NO_WEBBROWSER_FOUND, *mpSfxResMgr )).Execute(); - } - } - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, HighlightHdl, MenuBar::MenuBarButtonCallbackArg*, pData ) -{ - if ( pData->bHighlight ) - maWaitTimer.Start(); - else - RemoveBubbleWindow( false ); - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, WaitTimeOutHdl, Timer*, EMPTYARG ) -{ - SolarMutexGuard aGuard; - - mpBubbleWin = GetBubbleWindow(); - - if ( mpBubbleWin ) - { - mpBubbleWin->Show(); - } - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, TimeOutHdl, Timer*, EMPTYARG ) -{ - RemoveBubbleWindow( false ); - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, UserEventHdl, UpdateCheckUI*, EMPTYARG ) -{ - SolarMutexGuard aGuard; - - Window *pTopWin = Application::GetFirstTopLevelWindow(); - Window *pActiveWin = Application::GetActiveTopWindow(); - SystemWindow *pActiveSysWin = NULL; - - Window *pBubbleWin = NULL; - if ( mpBubbleWin ) - pBubbleWin = mpBubbleWin; - - if ( pActiveWin && ( pActiveWin != pBubbleWin ) && pActiveWin->IsTopWindow() ) - pActiveSysWin = pActiveWin->GetSystemWindow(); - - if ( pActiveWin == pBubbleWin ) - pActiveSysWin = NULL; - - while ( !pActiveSysWin && pTopWin ) - { - if ( ( pTopWin != pBubbleWin ) && pTopWin->IsTopWindow() ) - pActiveSysWin = pTopWin->GetSystemWindow(); - if ( !pActiveSysWin ) - pTopWin = Application::GetNextTopLevelWindow( pTopWin ); - } - - if ( pActiveSysWin ) - AddMenuBarIcon( pActiveSysWin, true ); - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( UpdateCheckUI, WindowEventHdl, VclWindowEvent*, pEvent ) -{ - sal_uLong nEventID = pEvent->GetId(); - - if ( VCLEVENT_OBJECT_DYING == nEventID ) - { - SolarMutexGuard aGuard; - if ( mpIconSysWin == pEvent->GetWindow() ) - { - mpIconSysWin->RemoveEventListener( maWindowEventHdl ); - RemoveBubbleWindow( true ); - } - } - else if ( VCLEVENT_WINDOW_MENUBARADDED == nEventID ) - { - SolarMutexGuard aGuard; - Window *pWindow = pEvent->GetWindow(); - if ( pWindow ) - { - SystemWindow *pSysWin = pWindow->GetSystemWindow(); - if ( pSysWin ) - { - AddMenuBarIcon( pSysWin, false ); - } - } - } - else if ( VCLEVENT_WINDOW_MENUBARREMOVED == nEventID ) - { - SolarMutexGuard aGuard; - MenuBar *pMBar = (MenuBar*) pEvent->GetData(); - if ( pMBar && ( pMBar == mpIconMBar ) ) - RemoveBubbleWindow( true ); - } - else if ( ( nEventID == VCLEVENT_WINDOW_MOVE ) || - ( nEventID == VCLEVENT_WINDOW_RESIZE ) ) - { - SolarMutexGuard aGuard; - if ( ( mpIconSysWin == pEvent->GetWindow() ) && - ( mpBubbleWin != NULL ) && ( mpIconMBar != NULL ) ) - { - Rectangle aIconRect = mpIconMBar->GetMenuBarButtonRectPixel( mnIconID ); - Point aWinPos = aIconRect.BottomCenter(); - mpBubbleWin->SetTipPosPixel( aWinPos ); - if ( mpBubbleWin->IsVisible() ) - mpBubbleWin->Show(); // This will recalc the screen positon of the bubble - } - } - - return 0; -} - -//------------------------------------------------------------------------------ -IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent) -{ - switch (pEvent->GetId()) - { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_ACTIVATE: - case VCLEVENT_WINDOW_GETFOCUS: { - SolarMutexGuard aGuard; - - Window *pWindow = static_cast< VclWindowEvent * >(pEvent)->GetWindow(); - if ( pWindow && pWindow->IsTopWindow() ) - { - SystemWindow *pSysWin = pWindow->GetSystemWindow(); - MenuBar *pMBar = pSysWin->GetMenuBar(); - if ( pSysWin && pMBar ) - { - AddMenuBarIcon( pSysWin, true ); - } - } - break; - } - } - return 0; -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -#define TIP_HEIGHT 15 -#define TIP_WIDTH 7 -#define TIP_RIGHT_OFFSET 18 -#define BUBBLE_BORDER 10 -#define TEXT_MAX_WIDTH 300 -#define TEXT_MAX_HEIGHT 200 -#define INITIAL_SHOW_TIME 10000 - -//------------------------------------------------------------------------------ -BubbleWindow::BubbleWindow( Window* pParent, const XubString& rTitle, - const XubString& rText, const Image& rImage ) - : FloatingWindow( pParent, WB_SYSTEMWINDOW - | WB_OWNERDRAWDECORATION - | WB_NOBORDER - ) - , maBubbleTitle( rTitle ) - , maBubbleText( rText ) - , maBubbleImage( rImage ) - , maMaxTextSize( TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT ) - , mnTipOffset( 0 ) -{ - SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetHelpColor() ) ); -} - -//------------------------------------------------------------------------------ -BubbleWindow::~BubbleWindow() -{ -} - -//------------------------------------------------------------------------------ -void BubbleWindow::Resize() -{ - SolarMutexGuard aGuard; - - FloatingWindow::Resize(); - - Size aSize = GetSizePixel(); - - if ( ( aSize.Height() < 20 ) || ( aSize.Width() < 60 ) ) - return; - - Rectangle aRect( 0, TIP_HEIGHT, aSize.Width(), aSize.Height() - TIP_HEIGHT ); - maRectPoly = Polygon( aRect, 6, 6 ); - Region aRegion( maRectPoly ); - long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - - Point aPointArr[4]; - aPointArr[0] = Point( nTipOffset, TIP_HEIGHT ); - aPointArr[1] = Point( nTipOffset, 0 ); - aPointArr[2] = Point( nTipOffset + TIP_WIDTH , TIP_HEIGHT ); - aPointArr[3] = Point( nTipOffset, TIP_HEIGHT ); - maTriPoly = Polygon( 4, aPointArr ); - Region aTriRegion( maTriPoly ); - - aRegion.Union( aTriRegion); - maBounds = aRegion; - - SetWindowRegionPixel( maBounds ); -} - -//------------------------------------------------------------------------------ -void BubbleWindow::SetTitleAndText( const XubString& rTitle, - const XubString& rText, - const Image& rImage ) -{ - maBubbleTitle = rTitle; - maBubbleText = rText; - maBubbleImage = rImage; - - Resize(); -} - -//------------------------------------------------------------------------------ -void BubbleWindow::Paint( const Rectangle& ) -{ - SolarMutexGuard aGuard; - - LineInfo aThickLine( LINE_SOLID, 2 ); - - DrawPolyLine( maRectPoly, aThickLine ); - DrawPolyLine( maTriPoly ); - - Color aOldLine = GetLineColor(); - Size aSize = GetSizePixel(); - long nTipOffset = aSize.Width() - TIP_RIGHT_OFFSET + mnTipOffset; - - SetLineColor( GetSettings().GetStyleSettings().GetHelpColor() ); - DrawLine( Point( nTipOffset+2, TIP_HEIGHT ), - Point( nTipOffset + TIP_WIDTH -1 , TIP_HEIGHT ), - aThickLine ); - SetLineColor( aOldLine ); - - //Image aImage = InfoBox::GetStandardImage(); - Size aImgSize = maBubbleImage.GetSizePixel(); - - DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); - - Font aOldFont = GetFont(); - Font aBoldFont = aOldFont; - aBoldFont.SetWeight( WEIGHT_BOLD ); - - SetFont( aBoldFont ); - Rectangle aTitleRect = maTitleRect; - aTitleRect.Move( aImgSize.Width(), 0 ); - DrawText( aTitleRect, maBubbleTitle, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - - SetFont( aOldFont ); - Rectangle aTextRect = maTextRect; - aTextRect.Move( aImgSize.Width(), 0 ); - DrawText( aTextRect, maBubbleText, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); -} - -//------------------------------------------------------------------------------ -void BubbleWindow::MouseButtonDown( const MouseEvent& ) -{ - Show( sal_False ); -} - -//------------------------------------------------------------------------------ -void BubbleWindow::Show( sal_Bool bVisible, sal_uInt16 nFlags ) -{ - SolarMutexGuard aGuard; - - if ( !bVisible ) - { - FloatingWindow::Show( bVisible ); - return; - } - - // don't show bubbles without a text - if ( ( maBubbleTitle.Len() == 0 ) && ( maBubbleText.Len() == 0 ) ) - return; - - Size aWindowSize = GetSizePixel(); - - // Image aImage = InfoBox::GetStandardImage(); - Size aImgSize = maBubbleImage.GetSizePixel(); - - RecalcTextRects(); - - aWindowSize.setHeight( maTitleRect.GetHeight() * 7 / 4+ maTextRect.GetHeight() + - 3 * BUBBLE_BORDER + TIP_HEIGHT ); - - if ( maTitleRect.GetWidth() > maTextRect.GetWidth() ) - aWindowSize.setWidth( maTitleRect.GetWidth() ); - else - aWindowSize.setWidth( maTextRect.GetWidth() ); - - aWindowSize.setWidth( aWindowSize.Width() + 3 * BUBBLE_BORDER + aImgSize.Width() ); - - if ( aWindowSize.Height() < aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER ) - aWindowSize.setHeight( aImgSize.Height() + TIP_HEIGHT + 2 * BUBBLE_BORDER ); - - Point aPos; - aPos.X() = maTipPos.X() - aWindowSize.Width() + TIP_RIGHT_OFFSET; - aPos.Y() = maTipPos.Y(); - Point aScreenPos = GetParent()->OutputToAbsoluteScreenPixel( aPos ); - if ( aScreenPos.X() < 0 ) - { - mnTipOffset = aScreenPos.X(); - aPos.X() -= mnTipOffset; - } - SetPosSizePixel( aPos, aWindowSize ); - - FloatingWindow::Show( bVisible, nFlags ); -} - -//------------------------------------------------------------------------------ -void BubbleWindow::RecalcTextRects() -{ - Size aTotalSize; - sal_Bool bFinished = sal_False; - Font aOldFont = GetFont(); - Font aBoldFont = aOldFont; - - aBoldFont.SetWeight( WEIGHT_BOLD ); - - while ( !bFinished ) - { - SetFont( aBoldFont ); - - maTitleRect = GetTextRect( Rectangle( Point( 0, 0 ), maMaxTextSize ), - maBubbleTitle, - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - - SetFont( aOldFont ); - maTextRect = GetTextRect( Rectangle( Point( 0, 0 ), maMaxTextSize ), - maBubbleText, - TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - - if ( maTextRect.GetHeight() < 10 ) - maTextRect.setHeight( 10 ); - - aTotalSize.setHeight( maTitleRect.GetHeight() + - aBoldFont.GetHeight() * 3 / 4 + - maTextRect.GetHeight() + - 3 * BUBBLE_BORDER + TIP_HEIGHT ); - if ( aTotalSize.Height() > maMaxTextSize.Height() ) - { - maMaxTextSize.Width() = maMaxTextSize.Width() * 3 / 2; - maMaxTextSize.Height() = maMaxTextSize.Height() * 3 / 2; - } - else - bFinished = sal_True; - } - maTitleRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ); - maTextRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT + maTitleRect.GetHeight() + aBoldFont.GetHeight() * 3 / 4 ); -} -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -} // anonymous namespace - -//------------------------------------------------------------------------------ - -static uno::Reference SAL_CALL -createInstance(const uno::Reference& xContext) -{ - return *new UpdateCheckUI(xContext); -} - -//------------------------------------------------------------------------------ - -static const cppu::ImplementationEntry kImplementations_entries[] = -{ - { - createInstance, - getImplementationName, - getServiceNames, - cppu::createSingleComponentFactory, - NULL, - 0 - }, - { NULL, NULL, NULL, NULL, NULL, 0 } -} ; - -//------------------------------------------------------------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char *pszImplementationName, void *pServiceManager, void *pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pszImplementationName, - pServiceManager, - pRegistryKey, - kImplementations_entries) ; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/ui/updatecheckui.hrc b/extensions/source/update/ui/updatecheckui.hrc deleted file mode 100644 index 47034b3a2..000000000 --- a/extensions/source/update/ui/updatecheckui.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - #define RID_UPDATECHECKUI_START 1100 - - #define RID_UPDATE_AVAIL_IMAGES RID_UPDATECHECKUI_START + 1 - - #define RID_UPDATE_AVAILABLE_16 RID_UPDATECHECKUI_START + 1 - #define RID_UPDATE_AVAILABLE_26 RID_UPDATECHECKUI_START + 2 - diff --git a/extensions/source/update/ui/updatecheckui.src b/extensions/source/update/ui/updatecheckui.src deleted file mode 100644 index 1e3e11332..000000000 --- a/extensions/source/update/ui/updatecheckui.src +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "updatecheckui.hrc" - -#define STD_MASK_COLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }; - - Image RID_UPDATE_AVAILABLE_16 - { - ImageBitmap = Bitmap{ file = "onlineupdate_16.png"; }; - STD_MASK_COLOR - }; - Image RID_UPDATE_AVAILABLE_26 - { - ImageBitmap = Bitmap{ file = "onlineupdate_26.png"; }; - STD_MASK_COLOR - }; diff --git a/extensions/source/update/ui/updchk.component b/extensions/source/update/ui/updchk.component deleted file mode 100644 index bd533e30d..000000000 --- a/extensions/source/update/ui/updchk.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/update/ui/updchkui.xml b/extensions/source/update/ui/updchkui.xml deleted file mode 100644 index 6c7625ad3..000000000 --- a/extensions/source/update/ui/updchkui.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - updchkui - - Oliver Braun - vnd.sun.UpdateCheck - The - com.sun.star.loader.SharedLibrary - c++ - - com.sun.star.setup.UpdateCheckUI - ... - com.sun.star.document.XEventBroadcaster - com.sun.star.document.XEventListener - com.sun.star.lang.XEventListener - com.sun.star.lang.XMultiComponentFactory - com.sun.star.lang.XServiceInfo - com.sun.star.lang.XSingleComponentFactory - com.sun.star.lang.XTypeProvider - com.sun.star.uno.TypeClass - com.sun.star.uno.XAggregation - com.sun.star.uno.XComponentContext - com.sun.star.uno.XCurrentContext - com.sun.star.uno.XWeak - com.sun.star.registry.XRegistryKey - - cppuhelper - cppu - sal - cppuhelper3$(COM) - cppu3 - sal3 - diff --git a/extensions/source/xmlextract/makefile.mk b/extensions/source/xmlextract/makefile.mk deleted file mode 100644 index fa54df738..000000000 --- a/extensions/source/xmlextract/makefile.mk +++ /dev/null @@ -1,73 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=extensions -TARGET=xmx - -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/xmxuno.obj \ - $(SLO)$/xmxtrct.obj - -# --- Library ----------------------------------- - -SHL1TARGET=$(TARGET)$(DLLPOSTFIX) -SHL1IMPLIB= i$(SHL1TARGET) - -SHL1VERSIONMAP=$(SOLARENV)/src/component.map -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -DEF1NAME=$(SHL1TARGET) - -SHL1STDLIBS=\ - $(SOTLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1LIBS= $(SLB)$/$(TARGET).lib - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/xmx.component - -$(MISC)/xmx.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - xmx.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt xmx.component diff --git a/extensions/source/xmlextract/xmx.component b/extensions/source/xmlextract/xmx.component deleted file mode 100644 index 456ff33b6..000000000 --- a/extensions/source/xmlextract/xmx.component +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - diff --git a/extensions/source/xmlextract/xmxcom.hxx b/extensions/source/xmlextract/xmxcom.hxx deleted file mode 100644 index 9258895be..000000000 --- a/extensions/source/xmlextract/xmxcom.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XMXCOM_HXX -#define _XMXCOM_HXX - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -// ----------------------------------------------------------------------------- - -#define NMSP_CPPU ::cppu -#define NMSP_RTL ::rtl -#define NMSP_UNO ::com::sun::star::uno -#define NMSP_LANG ::com::sun::star::lang -#define NMSP_IO ::com::sun::star::io -#define NMSP_REGISTRY ::com::sun::star::registry - - -#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj > -#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj > -#define ANY NMSP_UNO::Any -#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar ))) - -#endif // _XMXCOM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/xmlextract/xmxtrct.cxx b/extensions/source/xmlextract/xmxtrct.cxx deleted file mode 100644 index 2db82067e..000000000 --- a/extensions/source/xmlextract/xmxtrct.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "xmxtrct.hxx" - -#include -#include -#include -#include - -// ---------------- -// - XMXLockBytes - -// ---------------- - -class XMXLockBytes : public SvLockBytes -{ - REF( NMSP_IO::XInputStream ) mxIStm; - SEQ( sal_Int8 ) maSeq; - - XMXLockBytes(); - -public: - - XMXLockBytes( const REF( NMSP_IO::XInputStream )& rxIStm ); - virtual ~XMXLockBytes(); - - virtual ErrCode ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const; - virtual ErrCode WriteAt( sal_Size nPos, const void* pBuffer, sal_Size nCount, sal_Size* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( sal_Size nSize ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; -}; - -// ------------------------------------------------------------------------ - -XMXLockBytes::XMXLockBytes( const REF( NMSP_IO::XInputStream )& rxIStm ) : - mxIStm( rxIStm ) -{ - if( mxIStm.is() ) - { - const sal_uInt32 nBytesToRead = 65535; - sal_uInt32 nRead; - - do - { - SEQ( sal_Int8 ) aReadSeq; - - nRead = mxIStm->readSomeBytes( aReadSeq, nBytesToRead ); - - if( nRead ) - { - const sal_uInt32 nOldLength = maSeq.getLength(); - maSeq.realloc( nOldLength + nRead ); - rtl_copyMemory( maSeq.getArray() + nOldLength, aReadSeq.getConstArray(), aReadSeq.getLength() ); - } - } - while( nBytesToRead == nRead ); - } -} - -// ------------------------------------------------------------------------ - -XMXLockBytes::~XMXLockBytes() -{ -} - -// ------------------------------------------------------------------------ - -ErrCode XMXLockBytes::ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const -{ - const sal_Size nSeqLen = maSeq.getLength(); - ErrCode nErr = ERRCODE_NONE; - - if( nPos < nSeqLen ) - { - if( ( nPos + nCount ) > nSeqLen ) - nCount = nSeqLen - nPos; - - rtl_copyMemory( pBuffer, maSeq.getConstArray() + nPos, nCount ); - *pRead = nCount; - } - else - *pRead = 0UL; - - return nErr; -} - -// ------------------------------------------------------------------------ - -ErrCode XMXLockBytes::WriteAt( sal_Size /*nPos*/, const void* /*pBuffer*/, sal_Size /*nCount*/, sal_Size* /*pWritten*/ ) -{ - return ERRCODE_IO_CANTWRITE; -} - -// ------------------------------------------------------------------------ - -ErrCode XMXLockBytes::Flush() const -{ - return ERRCODE_NONE; -} - -// ------------------------------------------------------------------------ - -ErrCode XMXLockBytes::SetSize( sal_Size /*nSize*/ ) -{ - return ERRCODE_IO_CANTWRITE; -} - -// ------------------------------------------------------------------------ - -ErrCode XMXLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag /*eFlag*/ ) const -{ - pStat->nSize = maSeq.getLength(); - return ERRCODE_NONE; -} - -// ---------------- -// - XMLExtractor - -// ---------------- - -XMLExtractor::XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) : - mxFact( rxMgr ) -{ -} - -// ----------------------------------------------------------------------------- - -XMLExtractor::~XMLExtractor() -{ -} - -// ----------------------------------------------------------------------------- - -REF( NMSP_IO::XInputStream ) SAL_CALL XMLExtractor::extract( const REF( NMSP_IO::XInputStream )& rxIStm ) throw( NMSP_UNO::RuntimeException ) -{ - REF( NMSP_IO::XInputStream ) xRet; - - if( rxIStm.is() ) - { - SvStream aIStm( new XMXLockBytes( rxIStm ) ); - SvStorageRef aStorage( new SvStorage( aIStm ) ); - String aStmName; - const String aFormat1( String::CreateFromAscii( "XMLFormat" ) ); - const String aFormat2( String::CreateFromAscii( "XMLFormat2" ) ); - - if( aStorage->IsContained( aFormat2 ) ) - aStmName = aFormat2; - else if( aStorage->IsContained( aFormat1 ) ) - aStmName = aFormat1; - - if( !aStorage->GetError() && aStmName.Len() && aStorage->IsStream( aStmName ) ) - { - SvStorageStreamRef xStream( aStorage->OpenSotStream( aStmName ) ); - - if( xStream.Is() ) - { - SvMemoryStream* pMemStm = new SvMemoryStream( 65535, 65535 ); - ZCodec aCodec; - - aCodec.BeginCompression( ZCODEC_BEST_COMPRESSION ); - aCodec.Decompress( *xStream, *pMemStm ); - aCodec.EndCompression(); - - xRet = new ::utl::OInputStreamHelper( new SvLockBytes( pMemStm, sal_True ), 65535 ); - } - } - } - - return xRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/xmlextract/xmxtrct.hxx b/extensions/source/xmlextract/xmxtrct.hxx deleted file mode 100644 index 8b972530b..000000000 --- a/extensions/source/xmlextract/xmxtrct.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XMXTRCT_HXX -#define _XMXTRCT_HXX - -#include "xmxcom.hxx" - -// ---------------- -// - XMLExtractor - -// ---------------- - -class XMLExtractor : public ::cppu::WeakImplHelper1< NMSP_IO::XXMLExtractor > -{ -private: - - REF( NMSP_LANG::XMultiServiceFactory ) mxFact; - - XMLExtractor(); - -public: - - XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ); - virtual ~XMLExtractor(); - - // XXMLExtractor - virtual REF( NMSP_IO::XInputStream ) SAL_CALL extract( const REF( NMSP_IO::XInputStream )& rxIStm ) throw( NMSP_UNO::RuntimeException ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/xmlextract/xmxuno.cxx b/extensions/source/xmlextract/xmxuno.cxx deleted file mode 100644 index d0366ce10..000000000 --- a/extensions/source/xmlextract/xmxuno.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include "xmxcom.hxx" -#include "xmxtrct.hxx" -#include -#include -#include - -// ------------------- -// - factory methods - -// ------------------- - -static REF( NMSP_UNO::XInterface ) SAL_CALL create_XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact ) -{ - return REF( NMSP_UNO::XInterface )( *new XMLExtractor( rxFact ) ); -} - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - - if (rtl_str_compare( pImplName, "com.sun.star.comp.io.XMLExtractor" ) == 0) - { - NMSP_RTL::OUString aServiceName( B2UCONST( "com.sum.star.io.XMLExtractor" ) ); - - REF( NMSP_LANG::XSingleServiceFactory ) xFactory( NMSP_CPPU::createSingleFactory( - reinterpret_cast< NMSP_LANG::XMultiServiceFactory * >( pServiceManager ), - NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.io.XMLExtractor") ), - create_XMLExtractor, - SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) ); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/stardiv/fontest/fontest.idl b/extensions/stardiv/fontest/fontest.idl deleted file mode 100644 index 85d891619..000000000 --- a/extensions/stardiv/fontest/fontest.idl +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _EXTENSIONS_FONTEST_IDL -#define _EXTENSIONS_FONTEST_IDL - - -#include -#include -#include - -module stardiv -{ - - module extensions - { - - module fontest - { - -/** a flag called "surpressed" changes the action of check and checkWithDialog - @author Berndt Reinhold - @see stardiv::uno::XInterface - */ - [ uik(BF6D5A72-B53B-11d2-A17B00A0-243D2A0B), ident("FonTest", 1.0) ] - interface XFonTest: stardiv::uno::XInterface - { - /** Checks if "StarMath" and "StarBats" fonts are installed. -

          - @param bForce: If TRUE check the fonts even if surpressed. - Otherwise check the fonts only if not surpressed. - @see resetSurpressed - @returns TRUE if the fonts are available. Also TRUE if surpressed - is TRUE and bForce is FALSE. Otherwise return FALSE. -

          - */ - boolean check([in] boolean bForce); - - /** Same as check but additional shows a dialog if result is FALSE. -

          - @param bForce: same as in check - @see check - @see resetSurpressed -

          - */ - boolean checkWithDialog([in] boolean bForce); - - /** Shows a dialog if the font "StarBats" or "StarMath" is missing. -

          - The dialog shows which font(s) is/are missing and have a checkbox, - that represents the state of the flag surpressed. This dialog is - the only way to set the flag surpressed to TRUE. This method is - not affected by the value of the flag surpressed. - @see resetSurpressed -

          - */ - boolean executeDialog(); - - /** Set flag surpressed to FALSE -

          - The flag surpressed is stored in the registry. If surpressed is - FALSE the methods check and checkWithDialog ignores the parameter - bForce. if surpressed is TRUE check and checkWithDialog only - perform any action if their parameter bForce is TRUE. otherwise - they simply return TRUE. -

          - */ - void resetSurpressed(); - }; - -/*-------------- services ------------------------------------------- - This service is the implementation of the interface XFonTest. - @version 1.0 - @author Berndt Reinhold - */ - - service FonTestService - { - interface XFonTest; - }; - -//------------------------------------------------------------------- - - }; // fontest - }; // extensions -}; // stardiv - -#endif diff --git a/extensions/stardiv/fontest/makefile.mk b/extensions/stardiv/fontest/makefile.mk deleted file mode 100644 index 3ea8d98cf..000000000 --- a/extensions/stardiv/fontest/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -prjpch= - -PRJ=..$/.. - -PRJNAME=extensions -TARGET=fontestidl -IDLMAP=stardiv$/usrmap.idl -PACKAGE=stardiv$/fontest -ENABLE_EXCEPTIONS=TRUE - - -# --- Settings ----------------------------------------------------- -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# ------------------------------------------------------------------ -IDLFILES= fontest.idl - -# ------------------------------------------------------------------ -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk - diff --git a/extensions/stardiv/oinstchk/makefile.mk b/extensions/stardiv/oinstchk/makefile.mk deleted file mode 100644 index ea4961669..000000000 --- a/extensions/stardiv/oinstchk/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -prjpch= - -PRJ=..$/.. - -PRJNAME=extensions -TARGET=oinstchkidl -IDLMAP=stardiv$/usrmap.idl -PACKAGE=stardiv$/oinstchk -ENABLE_EXCEPTIONS=TRUE - - -# --- Settings ----------------------------------------------------- -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# ------------------------------------------------------------------ -IDLFILES= oinstchk.idl - -# ------------------------------------------------------------------ -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/extensions/stardiv/oinstchk/oinstchk.idl b/extensions/stardiv/oinstchk/oinstchk.idl deleted file mode 100644 index 5c1a3b159..000000000 --- a/extensions/stardiv/oinstchk/oinstchk.idl +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _INSTALLATION_OINSTCHK_IDL -#define _INSTALLATION_OINSTCHK_IDL - - -#include -#include -#include - -module stardiv -{ - - module installation - { - -/** a flag called "surpressed" changes the action of check and checkWithDialog - @author Berndt Reinhold - @see stardiv::uno::XInterface - */ - - [ uik(BF6D5A72-B53B-11d2-A17B00A0-243D2A0B), ident("OInstChk", 1.0) ] - interface XOInstChk: stardiv::uno::XInterface - { - /** Checks if "StarMath" and "StarBats" fonts are installed. -

          - @param bForce: If TRUE check the fonts even if surpressed. - Otherwise check the fonts only if not surpressed. - @see resetSurpressed - @returns TRUE if the fonts are available. Also TRUE if surpressed - is TRUE and bForce is FALSE. Otherwise return FALSE. -

          - */ - boolean check([in] boolean bForce); - - /** Same as check but additional shows a dialog if result is FALSE. -

          - @param bForce: same as in check - @see check - @see resetSurpressed -

          - */ - boolean checkWithDialog([in] boolean bForce); - - /** Shows a dialog if the font "StarBats" or "StarMath" is missing. -

          - The dialog shows which font(s) is/are missing and have a checkbox, - that represents the state of the flag surpressed. This dialog is - the only way to set the flag surpressed to TRUE. This method is - not affected by the value of the flag surpressed. - @see resetSurpressed -

          - */ - boolean executeDialog(); - - /** Set flag surpressed to FALSE -

          - The flag surpressed is stored in the registry. If surpressed is - FALSE the methods check and checkWithDialog ignores the parameter - bForce. if surpressed is TRUE check and checkWithDialog only - perform any action if their parameter bForce is TRUE. otherwise - they simply return TRUE. -

          - */ - void resetSurpressed(); - }; - -/*-------------- services ------------------------------------------- - This service is the implementation of the interface XOInstChk. - @version 1.0 - @author Berndt Reinhold - */ - - service OInstChkService - { - interface XOInstChk; - }; - -//------------------------------------------------------------------- - - }; // installation -}; // stardiv - -#endif diff --git a/extensions/stardiv/pgp/makefile.mk b/extensions/stardiv/pgp/makefile.mk deleted file mode 100644 index dbce7d52b..000000000 --- a/extensions/stardiv/pgp/makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -prjpch= - -PRJ=..$/.. - -PRJNAME=extensions -TARGET=pgpidl -IDLMAP=stardiv$/usrmap.idl -PACKAGE=stardiv$/extensions$/pgp -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -#javauno= - -# --- Files -------------------------------------------------------- - -JARFILES+= usr.jar -IDLFILES= pgp.idl - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk - diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp deleted file mode 100644 index c8b8c7568..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f AxTestComponentsps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include - -#include "Basic.h" -#include "Foo.h" - - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_Basic, CBasic) -OBJECT_ENTRY(CLSID_Foo, CFoo) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - -//VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.def b/extensions/test/ole/AxTestComponents/AxTestComponents.def deleted file mode 100644 index 5d8c019ad..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.def +++ /dev/null @@ -1,9 +0,0 @@ -; AxTestComponents.def : Declares the module parameters. - -LIBRARY "AxTestComponents.DLL" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp deleted file mode 100644 index 43fbbe53d..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp +++ /dev/null @@ -1,325 +0,0 @@ -# Microsoft Developer Studio Project File - Name="AxTestComponents" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=AxTestComponents - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "AxTestComponents.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "AxTestComponents.mak" CFG="AxTestComponents - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "AxTestComponents - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "AxTestComponents - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "AxTestComponents - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "AxTestComponents - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "AxTestComponents - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "AxTestComponents - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "AxTestComponents - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\AxTestComponents.dll -InputPath=.\Debug\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\DebugU -TargetPath=.\DebugU\AxTestComponents.dll -InputPath=.\DebugU\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinSize" -# PROP BASE Intermediate_Dir "ReleaseMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinSize" -# PROP Intermediate_Dir "ReleaseMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinSize -TargetPath=.\ReleaseMinSize\AxTestComponents.dll -InputPath=.\ReleaseMinSize\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinDependency" -# PROP BASE Intermediate_Dir "ReleaseMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinDependency" -# PROP Intermediate_Dir "ReleaseMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinDependency -TargetPath=.\ReleaseMinDependency\AxTestComponents.dll -InputPath=.\ReleaseMinDependency\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinSize" -# PROP BASE Intermediate_Dir "ReleaseUMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinSize" -# PROP Intermediate_Dir "ReleaseUMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinSize -TargetPath=.\ReleaseUMinSize\AxTestComponents.dll -InputPath=.\ReleaseUMinSize\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinDependency" -# PROP BASE Intermediate_Dir "ReleaseUMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinDependency" -# PROP Intermediate_Dir "ReleaseUMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinDependency -TargetPath=.\ReleaseUMinDependency\AxTestComponents.dll -InputPath=.\ReleaseUMinDependency\AxTestComponents.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "AxTestComponents - Win32 Debug" -# Name "AxTestComponents - Win32 Unicode Debug" -# Name "AxTestComponents - Win32 Release MinSize" -# Name "AxTestComponents - Win32 Release MinDependency" -# Name "AxTestComponents - Win32 Unicode Release MinSize" -# Name "AxTestComponents - Win32 Unicode Release MinDependency" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\AxTestComponents.cpp -# End Source File -# Begin Source File - -SOURCE=.\AxTestComponents.def -# End Source File -# Begin Source File - -SOURCE=.\AxTestComponents.idl -# ADD MTL /tlb ".\AxTestComponents.tlb" /h "AxTestComponents.h" /iid "AxTestComponents_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\AxTestComponents.rc -# End Source File -# Begin Source File - -SOURCE=.\Basic.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Basic.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\Basic.rgs -# End Source File -# End Group -# End Target -# End Project - - diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.idl b/extensions/test/ole/AxTestComponents/AxTestComponents.idl deleted file mode 100644 index ad8cca5d2..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.idl +++ /dev/null @@ -1,257 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// AxTestComponents.idl : IDL source for AxTestComponents.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (AxTestComponents.tlb) and marshalling code. -// next id 86 -import "oaidl.idl"; -import "ocidl.idl"; - [ - object, - uuid(BFE10EBD-8584-11D4-8335-005004526AB4), - dual, - helpstring("IBasic Interface"), - pointer_default(unique) - ] - interface IBasic : IDispatch - { - [id(82), helpstring("method inBool")] HRESULT inBool([in]VARIANT_BOOL val); - [id(1), helpstring("method inByte")] HRESULT inByte([in] unsigned char val); - [id(2), helpstring("method inShort")] HRESULT inShort([in] short val); - [id(3), helpstring("method inLong")] HRESULT inLong([in] long val); - [id(4), helpstring("method inString")] HRESULT inString([in] BSTR val); - [id(5), helpstring("method inFloat")] HRESULT inFloat([in] float val); - [id(6), helpstring("method inDouble")] HRESULT inDouble([in] double val); - [id(7), helpstring("method inVariant")] HRESULT inVariant([in] VARIANT val); - [id(8), helpstring("method inArray")] HRESULT inArray([in] SAFEARRAY(VARIANT) val); - [id(9), helpstring("method inObject")] HRESULT inObject([in] IDispatch* val); - [id(83), helpstring("method inoutBool")] HRESULT inoutBool([in,out]VARIANT_BOOL* val); - [id(12), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* val); - [id(13), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* val); - [id(14), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long * val); - [id(15), helpstring("method inoutString")] HRESULT inoutString([in, out] BSTR* val); - [id(16), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float * val); - [id(17), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double * val); - [id(18), helpstring("method inoutVariant")] HRESULT inoutVariant([in,out] VARIANT * val); - [id(19), helpstring("method inoutArray")] HRESULT inoutArray([in,out] SAFEARRAY(VARIANT) * val); - [id(20), helpstring("method inoutObject")] HRESULT inoutObject([in,out] IDispatch** val); - [id(84), helpstring("method outBool")] HRESULT outBool([out] VARIANT_BOOL* val); - [id(23), helpstring("method outByte")] HRESULT outByte([out] unsigned char* val); - [id(24), helpstring("method outShort")] HRESULT outShort([out] short* val); - [id(25), helpstring("method outLong")] HRESULT outLong([out] long* val); - [id(26), helpstring("method outString")] HRESULT outString([out] BSTR* val); - [id(27), helpstring("method outFloat")] HRESULT outFloat([out] float* val); - [id(28), helpstring("method outDouble")] HRESULT outDouble([out] double* val); - [id(29), helpstring("method outVariant")] HRESULT outVariant([out] VARIANT* val); - [id(30), helpstring("method outArray")] HRESULT outArray([out] SAFEARRAY(VARIANT) * val); - [id(31), helpstring("method outObject")] HRESULT outObject([out] IDispatch** val); - [propget, id(85), helpstring("property prpBool")] HRESULT prpBool([out, retval] VARIANT_BOOL *pVal); - [propput, id(85), helpstring("property prpBool")] HRESULT prpBool([in] VARIANT_BOOL newVal); - [propget, id(34), helpstring("property prpByte")] HRESULT prpByte([out, retval] unsigned char *pVal); - [propput, id(34), helpstring("property prpByte")] HRESULT prpByte([in] unsigned char newVal); - [propget, id(35), helpstring("property prpShort")] HRESULT prpShort([out, retval] short *pVal); - [propput, id(35), helpstring("property prpShort")] HRESULT prpShort([in] short newVal); - [propget, id(36), helpstring("property prpLong")] HRESULT prpLong([out, retval] long *pVal); - [propput, id(36), helpstring("property prpLong")] HRESULT prpLong([in] long newVal); - [propget, id(37), helpstring("property prpString")] HRESULT prpString([out, retval] BSTR *pVal); - [propput, id(37), helpstring("property prpString")] HRESULT prpString([in] BSTR newVal); - [propget, id(38), helpstring("property prpFloat")] HRESULT prpFloat([out, retval] float *pVal); - [propput, id(38), helpstring("property prpFloat")] HRESULT prpFloat([in] float newVal); - [propget, id(39), helpstring("property prpDouble")] HRESULT prpDouble([out, retval] double *pVal); - [propput, id(39), helpstring("property prpDouble")] HRESULT prpDouble([in] double newVal); - [propget, id(40), helpstring("property prpVariant")] HRESULT prpVariant([out, retval] VARIANT *pVal); - [propput, id(40), helpstring("property prpVariant")] HRESULT prpVariant([in] VARIANT newVal); - [propget, id(41), helpstring("property prpArray")] HRESULT prpArray([out, retval]SAFEARRAY(VARIANT) *pVal); - [propput, id(41), helpstring("property prpArray")] HRESULT prpArray([in] SAFEARRAY(VARIANT) newVal); - [propget, id(42), helpstring("property prpObject")] HRESULT prpObject([out, retval] IDispatch* *pVal); - [propput, id(42), helpstring("property prpObject")] HRESULT prpObject([in] IDispatch* newVal); - [id(43), helpstring("method mixed1")] HRESULT mixed1( - [in, out] unsigned char* aChar, - [in, out] float *aFloat, - [in,out] VARIANT* inoutVar); - [id(44), helpstring("method inSequenceLong")] HRESULT inSequenceLong([in] SAFEARRAY(long) ar); - [id(45), helpstring("method inSequenceByte")] HRESULT inSequenceByte([in] SAFEARRAY(byte) ar); - [id(46), helpstring("method inSequenceShort")] HRESULT inSequenceShort([in] SAFEARRAY(short) ar); - [id(47), helpstring("method inSequenceString")] HRESULT inSequenceString([in] SAFEARRAY( BSTR) ar); - [id(48), helpstring("method inSequenceFloat")] HRESULT inSequenceFloat([in] SAFEARRAY(float) ar); - [id(49), helpstring("method inSequenceDouble")] HRESULT inSequenceDouble([in] SAFEARRAY(double) ar); - [id(50), helpstring("method inSequenceObject")] HRESULT inSequenceObject([in] SAFEARRAY(IDispatch*) ar); - [id(51), helpstring("method outSequenceByte")] HRESULT outSequenceByte([out] SAFEARRAY(unsigned char)* val); - [id(52), helpstring("method outSequenceShort")] HRESULT outSequenceShort([out] SAFEARRAY(short)* val); - [id(53), helpstring("method outSequenceLong")] HRESULT outSequenceLong([out] SAFEARRAY(long )*val); - [id(54), helpstring("method outSequenceString")] HRESULT outSequenceString([out] SAFEARRAY(BSTR)* val); - [id(55), helpstring("method outSequenceFloat")] HRESULT outSequenceFloat([out] SAFEARRAY(float)* val); - [id(56), helpstring("method outSequenceDouble")] HRESULT outSequenceDouble([out] SAFEARRAY(double)* val); - [id(57), helpstring("method outSequenceObject")] HRESULT outSequenceObject([out] SAFEARRAY(IDispatch*)* val); - [id(58), helpstring("method inoutSequenceByte")] HRESULT inoutSequenceByte([in,out] SAFEARRAY(unsigned char)* val); - [id(59), helpstring("method inoutSequenceShort")] HRESULT inoutSequenceShort([in,out] SAFEARRAY(short)* val); - [id(60), helpstring("method inoutSequenceLong")] HRESULT inoutSequenceLong([in,out] SAFEARRAY( long)*val); - [id(61), helpstring("method inoutSequenceString")] HRESULT inoutSequenceString([in,out] SAFEARRAY(BSTR)* val); - [id(62), helpstring("method inoutSequenceFloat")] HRESULT inoutSequenceFloat([in,out] SAFEARRAY(float)* val); - [id(63), helpstring("method inoutSequenceDouble")] HRESULT inoutSequenceDouble([in,out] SAFEARRAY(double)* val); - [id(64), helpstring("method inoutSequenceObject")] HRESULT inoutSequenceObject([in,out] SAFEARRAY(IDispatch*)* val); - [id(65), helpstring("method inMulDimArrayLong")] HRESULT inMulDimArrayLong([in] SAFEARRAY(long) val ); - [id(66), helpstring("method inMulDimArrayVariant")] HRESULT inMulDimArrayVariant([in] SAFEARRAY(VARIANT) val); - [id(67), helpstring("method inMulDimArrayLong2")] HRESULT inMulDimArrayLong2([in] SAFEARRAY(long) val); - [id(68), helpstring("method inMulDimArrayVariant2")] HRESULT inMulDimArrayVariant2([in] SAFEARRAY(VARIANT) val); - [id(69), helpstring("method inMulDimArrayByte")] HRESULT inMulDimArrayByte([in] SAFEARRAY(unsigned char) val); - [id(70), helpstring("method inMulDimArrayByte2")] HRESULT inMulDimArrayByte2([in] SAFEARRAY(unsigned char) val); - [id(71), helpstring("method outMore")] HRESULT outMore([out]long* val1, [out]long* val2); - - [id(72), helpstring("method optional1")] - HRESULT optional1([in] long val1, [in, optional] VARIANT* val2); - [id(73), helpstring("method optional2")] - HRESULT optional2([out] long* val1, [out, optional] VARIANT* val2); - [id(74), helpstring("method optional3")] - HRESULT optional3([in, optional] VARIANT* val1, [in, optional] VARIANT* val2); - [id(75), helpstring("method optional4")] - HRESULT optional4([in, out, optional] VARIANT* val1, [in, out, optional] VARIANT* val2); - [id(76), helpstring("method optional5")] - HRESULT optional5([out, optional] VARIANT* val1, [out, optional] VARIANT* val2); - //midl creates for val4 a BSTR "4" as default value in the TLB. The midl complains - //but the error message seems to be not for this case. - //in defaultvalue2 val4 has an VT_I4 in the TLB. This must be a bug! - [id(77), helpstring("method defaultvalue1")] - HRESULT defaultvalue1([in, defaultvalue(1)] long val1, - [in, defaultvalue(2)] double* val2, - // [in, defaultvalue(3)] VARIANT val3, //ok - [in, defaultvalue(4)] VARIANT* val4); - - // bug im midl: when val3 and val4 are pointers then the generated header cretates - // for all params default values: - //HRESULT STDMETHODCALLTYPE defaultvalue2( - // /* [defaultvalue][in] */ long *val1 = 10, - // /* [defaultvalue][in] */ double *val2 = 3.14, - // /* [defaultvalue][in] */ VARIANT *val3 = 10, - // /* [defaultvalue][in] */ VARIANT *val4 = 100) = 0; - // And that does not compile. - //Therefore we must not include the midl generated header, instead use - // #import to create the interface header - [id(78), helpstring("method defaultvalue2")] - HRESULT defaultvalue2([in, out, defaultvalue(1)]long* val1, - [in, out, defaultvalue(2)] double* val2, - // [in, out, defaultvalue(3)] VARIANT *val3, - [in, out, defaultvalue(4)] VARIANT *val4); - - [id(79), helpstring("method varargfunc1"),vararg] - HRESULT varargfunc1([in] long val1, [in] SAFEARRAY(VARIANT) val2); - [id(80), helpstring("method varargfunc2")] - HRESULT varargfunc2([out] long* val1, [out] SAFEARRAY(VARIANT)* val2); - - - [id(86), helpstring("method inSequenceByteDim2")] HRESULT inSequenceByteDim2([in] SAFEARRAY(byte) val); - [id(87), helpstring("method inCurrency")] HRESULT inCurrency([in] CY val); - [id(88), helpstring("method outCurrency")] HRESULT outCurrency([out] CY* val); - [id(89), helpstring("method inoutCurrency")] HRESULT inoutCurrency([in,out] CY* val); - [id(90), helpstring("method inDate")] HRESULT inDate([in] DATE val); - [id(91), helpstring("method outDate")] HRESULT outDate([out] DATE* val); - [id(92), helpstring("method inoutDate")] HRESULT inoutDate([in,out] DATE* val); - [propget, id(93), helpstring("property prpCY")] HRESULT prpCurrency([out, retval] CY* pVal); - [propput, id(93), helpstring("property prpCY")] HRESULT prpCurrency([in] CY newVal); - [propget, id(94), helpstring("property prpDate")] HRESULT prpDate([out, retval] DATE* pVal); - [propput, id(94), helpstring("property prpDate")] HRESULT prpDate([in] DATE newVal); - [id(95), helpstring("method inDecimal")] HRESULT inDecimal([in] DECIMAL val); - [id(96), helpstring("method outDecimal")] HRESULT outDecimal([out] DECIMAL* val); - [id(97), helpstring("method inoutDecimal")] HRESULT inoutDecimal([in,out] DECIMAL* val); - [propget, id(98), helpstring("property prpDecimal")] HRESULT prpDecimal([out, retval] DECIMAL* pVal); - [propput, id(98), helpstring("property prpDecimal")] HRESULT prpDecimal([in] DECIMAL newVal); - [id(99), helpstring("method inSCode")] HRESULT inSCode([in] SCODE val); - [id(100), helpstring("method outScode")] HRESULT outScode([out] SCODE* val); - [id(101), helpstring("method inoutSCode")] HRESULT inoutSCode([in,out] SCODE* val); - [propget, id(102), helpstring("property prpSCode")] HRESULT prpSCode([out, retval] SCODE* pVal); - [propput, id(102), helpstring("property prpSCode")] HRESULT prpSCode([in] SCODE newVal); - [id(103), helpstring("method inrefLong")] HRESULT inrefLong([in] LONG* val); - [id(104), helpstring("method inrefVARIANT")] HRESULT inrefVariant([in] VARIANT* val); - [id(105), helpstring("method inrefDecimal")] HRESULT inrefDecimal(DECIMAL* val); - [propget, id(106), helpstring("property prpRefLong")] HRESULT prpRefLong([out, retval] long* pVal); - [propputref, id(106), helpstring("property prpRefLong")] HRESULT prpRefLong([in] long* newVal); - [propget, id(107), helpstring("property prprefVariant")] HRESULT prprefVariant([out, retval] VARIANT* pVal); - [propputref, id(107), helpstring("property prprefVariant")] HRESULT prprefVariant([in] VARIANT* newVal); - [propget, id(108), helpstring("property prprefDecimal")] HRESULT prprefDecimal([out, retval] DECIMAL* pVal); - [propputref, id(108), helpstring("property prprefDecimal")] HRESULT prprefDecimal([in] DECIMAL* newVal); - [id(109), helpstring("method optional6")] HRESULT optional6([in,optional] VARIANT* val1, - [in,optional] VARIANT * val2, [in,optional] VARIANT* val3, [in,optional] VARIANT* val4); - [id(110), helpstring("method optional7")] HRESULT optional7([out,optional] VARIANT* val1, - [out,optional] VARIANT * val2, [out,optional] VARIANT* val3, [out,optional] VARIANT* val4); - - [propget, id(111), helpstring("property prpMultiArg1")] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal); - [propput, id(111), helpstring("property prpMultiArg1")] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal); - [propget, id(112), helpstring("property prpMultiArg2")] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal); - [propput, id(112), helpstring("property prpMultiArg2")] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal); - [id(113), helpstring("method prpMultiArg2GetValues")] HRESULT prpMultiArg2GetValues([out] VARIANT* val1, [out] VARIANT* valProperty); - [propget, id(114), helpstring("property prpMultiArg3")] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal); - [propput, id(114), helpstring("property prpMultiArg3")] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal); - [id(115), helpstring("method inUnknown")] HRESULT inUnknown([in] IUnknown* val); - [id(116), helpstring("method outUnknown")] HRESULT outUnknown([out] IUnknown** val); - [id(117), helpstring("method inoutUnknown")] HRESULT inoutUnknown([in,out] IUnknown** val); - [propget, id(118), helpstring("property prpUnknown")] HRESULT prpUnknown([out, retval] IUnknown** pVal); - [propput, id(118), helpstring("property prpUnknown")] HRESULT prpUnknown([in] IUnknown* newVal); -}; - -[ - object, - uuid(96E6105A-A436-48b3-BFE7-C9302D927CCF), - dual, - helpstring("IFoo Interface"), - pointer_default(unique) -] -interface IFoo : IUnknown -{ - HRESULT Foo([in] IUnknown* val); -}; - -[ - uuid(BFE10EB1-8584-11D4-8335-005004526AB4), - version(1.0), - helpstring("AxTestComponents 1.0 Type Library") -] -library AXTESTCOMPONENTSLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(BFE10EBE-8584-11D4-8335-005004526AB4), - helpstring("Basic Class") - ] - coclass Basic - { - [default] interface IBasic; - }; - - [ - uuid(14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D), - helpstring("Foo Class") - ] - coclass Foo - { - [default] interface IFoo; - }; - -}; diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.rc b/extensions/test/ole/AxTestComponents/AxTestComponents.rc deleted file mode 100644 index b2b3c96ba..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.rc +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -**************************************************************************/ - -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_BASIC REGISTRY DISCARDABLE "Basic.rgs" -IDR_FOO REGISTRY DISCARDABLE "Basic.rgs" -#endif // German (Germany) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""AxTestComponents.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "AxTestComponents Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "AxTestComponents\0" - VALUE "LegalCopyright", "Copyright 2000\0" - VALUE "OriginalFilename", "AxTestComponents.DLL\0" - VALUE "ProductName", "AxTestComponents Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "AxTestComponents" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "AxTestComponents.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.sln b/extensions/test/ole/AxTestComponents/AxTestComponents.sln deleted file mode 100644 index eadaa373e..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.sln +++ /dev/null @@ -1,31 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AxTestComponents", "AxTestComponents.vcproj", "{CF6DC513-B04E-420A-A0F9-6D1F4046D098}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release MinDependency|Win32 = Release MinDependency|Win32 - Release MinSize|Win32 = Release MinSize|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32 - Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Debug|Win32.Build.0 = Debug|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Release MinSize|Win32.Build.0 = Release MinSize|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32 - {CF6DC513-B04E-420A-A0F9-6D1F4046D098}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj b/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj deleted file mode 100644 index 078daba3d..000000000 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.vcproj +++ /dev/null @@ -1,819 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/AxTestComponents/Basic.cpp b/extensions/test/ole/AxTestComponents/Basic.cpp deleted file mode 100644 index fab6e68f5..000000000 --- a/extensions/test/ole/AxTestComponents/Basic.cpp +++ /dev/null @@ -1,1366 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "stdafx.h" -#include "Basic.h" - - -///////////////////////////////////////////////////////////////////////////// -// CBasic -CBasic::CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0), -m_safearray(NULL), m_bool(VARIANT_FALSE), -m_arByte(0), m_arShort(0), m_arLong(0), m_arString(0), m_arVariant(0), m_arFloat(0), -m_arDouble(0), m_arObject(0), m_arByteDim2(0), m_date(0.), m_scode(0) - -{ - memset(&m_cy, 0, sizeof(CY)); - memset(&m_decimal, 0, sizeof(DECIMAL)); -} - -CBasic::~CBasic() -{ - SafeArrayDestroy(m_safearray); - SafeArrayDestroy(m_arByte); - SafeArrayDestroy(m_arShort); - SafeArrayDestroy(m_arLong); - SafeArrayDestroy(m_arString); - SafeArrayDestroy(m_arVariant); - SafeArrayDestroy(m_arFloat); - SafeArrayDestroy(m_arDouble); - SafeArrayDestroy(m_arObject); - SafeArrayDestroy(m_arByteDim2); - -} -STDMETHODIMP CBasic::inBool(VARIANT_BOOL val) -{ - m_bool = val; - return S_OK; -} -STDMETHODIMP CBasic::inByte(unsigned char val) -{ - m_byte = val; - return S_OK; -} - -STDMETHODIMP CBasic::inShort(short val) -{ - m_short = val; - return S_OK; -} - -STDMETHODIMP CBasic::inLong(long val) -{ - m_long = val; - return S_OK; -} - -STDMETHODIMP CBasic::inString(BSTR val) -{ - m_bstr = val; - return S_OK; -} - -STDMETHODIMP CBasic::inFloat(float val) -{ - m_float = val; - return S_OK; -} - -STDMETHODIMP CBasic::inDouble(double val) -{ - m_double = val; - - CComVariant varDest; - CComVariant varSource(val); - HRESULT hr = VariantChangeType(&varDest, &varSource, 0, VT_BSTR); - return S_OK; -} - -STDMETHODIMP CBasic::inVariant(VARIANT val) -{ - m_var1 = val; - return S_OK; -} - -STDMETHODIMP CBasic::inArray(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_safearray))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, &m_safearray))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::inObject(IDispatch *val) -{ - m_obj = val; - return S_OK; -} - -STDMETHODIMP CBasic::inoutBool(VARIANT_BOOL* val) -{ - VARIANT_BOOL aBool = *val; - *val = m_bool; - m_bool = aBool; - return S_OK; -} - - -STDMETHODIMP CBasic::inoutByte(unsigned char* val) -{ - unsigned char aByte = *val; - *val = m_byte; - m_byte = aByte; - return S_OK; -} - -STDMETHODIMP CBasic::inoutShort(short *val) -{ - short aShort = *val; - *val = m_short; - m_short = aShort; - return S_OK; -} - -STDMETHODIMP CBasic::inoutLong(long *val) -{ - long aLong = *val; - *val = m_long; - m_long = aLong; - return S_OK; -} - -STDMETHODIMP CBasic::inoutString(BSTR *val) -{ - CComBSTR aStr = *val; - HRESULT hr = S_OK; - if (FAILED( hr = m_bstr.CopyTo(val))) - return hr; - m_bstr = aStr; - return S_OK; -} - -STDMETHODIMP CBasic::inoutFloat(float *val) -{ - float aFloat = *val; - *val = m_float; - m_float = aFloat; - return S_OK; -} - -STDMETHODIMP CBasic::inoutDouble(double *val) -{ - double aDouble = *val; - *val = m_double; - m_double = aDouble; - return S_OK; -} - -STDMETHODIMP CBasic::inoutVariant(VARIANT *val) -{ - CComVariant aVar = *val; - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy(val, &m_var1))) - return hr; - m_var1 = aVar; - return S_OK; -} - -/* The array contains VARIANT according to IDL. - If the VARIANTs contain strings then we append "out" to each string. -*/ -STDMETHODIMP CBasic::inoutArray(LPSAFEARRAY *val) -{ - SAFEARRAY* aAr = NULL; - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayCopy(*val, &aAr))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_safearray, val))) - return hr; - if (FAILED(hr = SafeArrayCopy(aAr, & m_safearray))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::inoutObject(IDispatch **val) -{ - CComPtr disp = *val; - if (*val) - (*val)->Release(); - *val = m_obj; - if (*val) - (*val)->AddRef(); - m_obj = disp; - return S_OK; -} - - -STDMETHODIMP CBasic::outBool(VARIANT_BOOL* val) -{ - *val = m_bool; - return S_OK; -} - -STDMETHODIMP CBasic::outByte(unsigned char *val) -{ - *val= m_byte; - return S_OK; -} - -STDMETHODIMP CBasic::outShort(short *val) -{ - *val= m_short; - return S_OK; -} - -STDMETHODIMP CBasic::outLong(long *val) -{ - *val= m_long; - return S_OK; -} - -STDMETHODIMP CBasic::outString(BSTR *val) -{ - *val= SysAllocString(m_bstr); - return S_OK; -} - -STDMETHODIMP CBasic::outFloat(float *val) -{ - *val= m_float; - return S_OK; -} - -STDMETHODIMP CBasic::outDouble(double *val) -{ - *val= m_double; - return S_OK; -} - -STDMETHODIMP CBasic::outVariant(VARIANT *val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy(val, &m_var1))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::outArray(LPSAFEARRAY *val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayCopy(m_safearray, val))) - return false; - return S_OK; -} - -STDMETHODIMP CBasic::outObject(IDispatch* *val) -{ - *val = m_obj; - if (m_obj) - (*val)->AddRef(); - - return S_OK; -} - - -STDMETHODIMP CBasic::get_prpBool(VARIANT_BOOL* pVal) -{ - if (!pVal) return E_POINTER; - *pVal = m_bool; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpBool(VARIANT_BOOL val) -{ - m_bool = val; - return S_OK; -} - - -STDMETHODIMP CBasic::get_prpByte(unsigned char *pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_cPrpByte; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpByte(unsigned char newVal) -{ - m_cPrpByte= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpShort(short *pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_nPrpShort; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpShort(short newVal) -{ - m_nPrpShort= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpLong(long *pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_lPrpLong; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpLong(long newVal) -{ - m_lPrpLong= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpString(BSTR *pVal) -{ - if( !pVal) - return E_POINTER; - m_bstrPrpString.CopyTo( pVal ); - return S_OK; -} - -STDMETHODIMP CBasic::put_prpString(BSTR newVal) -{ - m_bstrPrpString= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpFloat(float *pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_fPrpFloat; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpFloat(float newVal) -{ - m_fPrpFloat= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpDouble(double *pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_dPrpDouble; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpDouble(double newVal) -{ - m_dPrpDouble= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpVariant(VARIANT *pVal) -{ - if( !pVal) - return E_POINTER; - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy( pVal, &m_PropVariant))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::put_prpVariant(VARIANT newVal) -{ - m_PropVariant= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpArray(LPSAFEARRAY *pVal) -{ - if( !pVal) - return E_POINTER; - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayCopy( m_PrpArray, pVal))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::put_prpArray(LPSAFEARRAY newVal) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy( m_PrpArray))) - return hr; - if (FAILED(hr = SafeArrayCopy( newVal, &m_PrpArray))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::get_prpObject(IDispatch **pVal) -{ - if( !pVal) - return E_POINTER; - *pVal= m_PrpObject; - if( *pVal != NULL) - (*pVal)->AddRef(); - return S_OK; -} - -STDMETHODIMP CBasic::put_prpObject(IDispatch *newVal) -{ - m_PrpObject= newVal; - return S_OK; -} - -STDMETHODIMP CBasic::mixed1( - /* [out][in] */ unsigned char *aChar, - /* [out][in] */ float *aFloat, - /* [out][in] */ VARIANT *aVar) - -{ - HRESULT hr= S_OK; - inoutByte(aChar); - inoutFloat(aFloat); - inoutVariant(aVar); - return hr; -} - - - - -// VT_UI1 - -STDMETHODIMP CBasic::inSequenceLong(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arLong))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arLong))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceByte( LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arByte))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arByte))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceShort(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arShort))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arShort))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceString(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arString))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arString))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceFloat(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arFloat))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arFloat))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceDouble(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arDouble))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arDouble))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::inSequenceObject(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arObject))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arObject))) - return hr; - return hr; -} - -void CBasic::printArray( LPSAFEARRAY val, BSTR message, VARTYPE type) -{ - - HRESULT hr= S_OK; - USES_CONVERSION; - long lbound=0; - long ubound= 0; - hr= SafeArrayGetLBound( val, 1, &lbound); - hr= SafeArrayGetUBound( val, 1, &ubound); - long length= ubound - lbound +1; - - CComVariant varElement; - char buf[1024]; - sprintf( buf,"%s", W2A(message)); - - for( long i= 0; i < length ; i++) - { - char tmp[1024]; - long data=0; - CComVariant var; - switch( type) - { - case VT_UI1: - case VT_I2: - case VT_I4: - case VT_ERROR: - hr= SafeArrayGetElement( val, &i, (void*)&data); - sprintf( tmp, "%d \n", *(long*)&data); - break; - case VT_BSTR: - hr= SafeArrayGetElement( val, &i, (void*)&data); - sprintf( tmp, "%S \n", (BSTR)data); - break; - case VT_VARIANT: - hr= SafeArrayGetElement( val, &i, &var); - sprintf( tmp, "%x \n", var.byref); - break; - case VT_R4: - hr= SafeArrayGetElement( val, &i, (void*)&data); - sprintf( tmp, "%f \n", *(float*) &data); - break; - case VT_R8: ; - hr= SafeArrayGetElement( val, &i, (void*)&data); - sprintf( tmp, "%f \n", *(double*) &data); - break; - case VT_DISPATCH: - // we assume the objects are instances of this component and have the - // property prpString set. - hr= SafeArrayGetElement( val, &i, (void*)&data); - IDispatch* pdisp= ( IDispatch*) data; - CComDispatchDriver driver( pdisp); - CComVariant var; - if( pdisp) - { - driver.GetPropertyByName(L"prpString", &var); - sprintf( tmp, "%x : %S \n", *(long*)&data, var.bstrVal); - } - else - sprintf( tmp, "%x\n", *(long*)&data); - } - - strcat( buf, tmp); - } - MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK); - -} -// V_ERROR OLECHAR VARIANT VT_UI1 - -STDMETHODIMP CBasic::outSequenceByte(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arByte, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceShort(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arShort, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceLong(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arLong, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceString(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arString, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceFloat(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arFloat, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceDouble(LPSAFEARRAY* val) -{ - HRESULT hr= S_OK; - hr = SafeArrayCopy(m_arDouble, val); - return hr; -} - -STDMETHODIMP CBasic::outSequenceObject(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - hr = SafeArrayCopy(m_arObject, val); - return S_OK; -} - -STDMETHODIMP CBasic::inoutSequenceByte(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arByte, val))) - return hr; - m_arByte = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceShort(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arShort, val))) - return hr; - m_arShort = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceLong(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arLong, val))) - return hr; - m_arLong = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceString(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arString, val))) - return hr; - m_arString = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceFloat(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arFloat, val))) - return hr; - m_arFloat = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceDouble(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arDouble, val))) - return hr; - m_arDouble = arTemp; - return hr; -} - -STDMETHODIMP CBasic::inoutSequenceObject(LPSAFEARRAY* val) -{ - HRESULT hr = S_OK; - SAFEARRAY *arTemp = NULL; - if (FAILED(hr = SafeArrayCopy(*val, &arTemp))) - return hr; - if (FAILED(hr = SafeArrayCopy(m_arObject, val))) - return hr; - m_arObject = arTemp; - return hr; -} - -// 2-dimensional Array -STDMETHODIMP CBasic::inMulDimArrayLong(LPSAFEARRAY val) -{ - printMulArray( val, VT_I4); - return S_OK; -} -// 2-dimensional Array -STDMETHODIMP CBasic::inMulDimArrayVariant(LPSAFEARRAY val) -{ - printMulArray( val, VT_VARIANT); - return S_OK; -} -// 3-dimensional Array -STDMETHODIMP CBasic::inMulDimArrayLong2(LPSAFEARRAY val) -{ - printMulArray( val, VT_I4); - return S_OK; -} -// 3-dimensional Array -STDMETHODIMP CBasic::inMulDimArrayVariant2(LPSAFEARRAY val) -{ - return S_OK; -} - - -STDMETHODIMP CBasic::inMulDimArrayByte(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arByteDim2))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arByteDim2))) - return hr; - return hr; -} -// 3-dimensionales array -STDMETHODIMP CBasic::inMulDimArrayByte2(LPSAFEARRAY val) -{ - - // TODO: Add your implementation code here - //printMulArray( val, VT_UI1); - return S_OK; -} - -// supports 2 and 3 dimensionals SAFEARRAY with elements of long or VARIANT -void CBasic::printMulArray( SAFEARRAY* val, VARTYPE type) -{ - HRESULT hr= S_OK; - UINT dims= SafeArrayGetDim( val); - long lbound1; - long ubound1; - long lbound2; - long ubound2; - long lbound3; - long ubound3; - long length1; - long length2; - long length3; - - char buff[4096]; - buff[0]=0; - - if( dims == 2) - { - hr= SafeArrayGetLBound( val, 1, &lbound1); - hr= SafeArrayGetUBound( val, 1, &ubound1); - length1= ubound1 - lbound1 +1; - - hr= SafeArrayGetLBound( val, 2, &lbound2); - hr= SafeArrayGetUBound( val, 2, &ubound2); - length2= ubound2 - lbound2 + 1; - char tmpBuf[1024]; - tmpBuf[0]=0; - long index[2]; - for( long i= 0; i< length2; i++) - { - for( long j= 0; jvt != VT_ERROR) - m_var1 = *val2; - return S_OK; -} - -STDMETHODIMP CBasic::optional2(/*[out]*/ long* val1,/*[out, optional]*/ VARIANT* val2) -{ - HRESULT hr = S_OK; - *val1 = m_long; - - if (val2->vt != VT_ERROR) - hr = VariantCopy(val2, & m_var1); - return hr; -} - -STDMETHODIMP CBasic::optional3(/*[in, optional]*/ VARIANT* val1,/*[in, optional]*/ VARIANT* val2) -{ - //if (val1->vt != VT_ERROR) - m_var1 = *val1; - - //if (val2->vt != VT_ERROR) - m_var2 = *val2; - return S_OK; -} - -STDMETHODIMP CBasic::optional4(/*[in, out, optional]*/ VARIANT* val1, - /*[in, out, optional]*/ VARIANT* val2) -{ - HRESULT hr = S_OK; - //return the previously set in values - if (val1->vt != VT_ERROR) - { - CComVariant var1(*val1); - if (FAILED(hr = VariantCopy(val1, & m_var1))) - return hr; - m_var1 = var1; - } - if (val2->vt != VT_ERROR) - { - CComVariant var2(*val2); - if (FAILED(hr = VariantCopy(val2, & m_var2))) - return hr; - m_var2 = var2; - } - return hr; -} - -STDMETHODIMP CBasic::optional5(/*[out, optional]*/ VARIANT* val1, - /*[out, optional]*/ VARIANT* val2) -{ - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy(val1, &m_var1))) - return hr; - if (FAILED(hr = VariantCopy(val2, &m_var2))) - return hr; - return hr; -} - -STDMETHODIMP CBasic::defaultvalue1(/*[in, defaultvalue(10)]*/ long val1, - /*[in, defaultvalue(3.14)]*/ double* val2, - // /*[in, defaultvalue(10)]*/ VARIANT val3, - /*[in, defaultvalue(100)]*/ VARIANT* val4) -{ - m_long = val1; - m_double = *val2; -// m_var1 = val3; - m_var2 = *val4; - return S_OK; -} -STDMETHODIMP CBasic::defaultvalue2(/*[in, out, defaultvalue(10)]*/ long* val1, - /*[in, out, defaultvalue(3.14)]*/ double* val2, - // /*[in, out, defaultvalue(10)]*/ VARIANT* val3, - /*[in, out, defaultvalue(100)]*/ VARIANT* val4) -{ - HRESULT hr = S_OK; - long aLong = *val1; - double aDouble = *val2; -// CComVariant var1(*val3); - CComVariant var2(*val4); - *val1 = m_long; - *val2 = m_double; - //if (FAILED(hr = VariantCopy(val3, &m_var1))) - // return hr; - if (FAILED(hr = VariantCopy(val4, &m_var2))) - return hr; - m_long = aLong; - m_double = aDouble; -// m_var1 = var1; - m_var2 = var2; - return hr; -} -/* val2 contains the variable argument list. If no such arguments are supplied - then the safearray is invalid. SafeArrayCopy then returns E_INVALIDARG -*/ -STDMETHODIMP CBasic::varargfunc1(/*[in]*/ long val1,/*[in]*/ LPSAFEARRAY val2) -{ - m_long = val1; - - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_safearray))) - return hr; - if (FAILED(hr = SafeArrayCopy(val2, & m_safearray))) - { - if (hr != E_INVALIDARG) - return hr; - } - return S_OK; -} - -STDMETHODIMP CBasic::varargfunc2(/*[out]*/ long* val1, /*[out]*/ SAFEARRAY ** val2) -{ - *val1 = m_long; - HRESULT hr = SafeArrayCopy(m_safearray, val2); - return hr; -} - -STDMETHODIMP CBasic::inSequenceByteDim2(LPSAFEARRAY val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = SafeArrayDestroy(m_arByteDim2))) - return hr; - if (FAILED(hr = SafeArrayCopy(val, & m_arByteDim2))) - return hr; - return hr; -} - - -STDMETHODIMP CBasic::inCurrency(CY val) -{ - m_cy = val; - return S_OK; -} - -STDMETHODIMP CBasic::outCurrency(CY* val) -{ - *val = m_cy; - return S_OK; -} - -STDMETHODIMP CBasic::inoutCurrency(CY* val) -{ - CY tmp = *val; - *val = m_cy; - m_cy = tmp; - return S_OK; -} - -STDMETHODIMP CBasic::inDate(DATE val) -{ - m_date = val; - return S_OK; -} - -STDMETHODIMP CBasic::outDate(DATE* val) -{ - *val = m_date; - return S_OK; -} - -STDMETHODIMP CBasic::inoutDate(DATE* val) -{ - DATE tmp = *val; - *val = m_date; - m_date = tmp; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpCurrency(CY* pVal) -{ - *pVal = m_cy; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpCurrency(CY newVal) -{ - m_cy = newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpDate(DATE* pVal) -{ - *pVal = m_date; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpDate(DATE newVal) -{ - m_date = newVal; - return S_OK; -} - -//VT_I4 DECIMAL_NEG //tagVARIANT DISPATCH_PROPERTYPUT -STDMETHODIMP CBasic::inDecimal(DECIMAL val) -{ - m_decimal = val; - return S_OK; -} - -STDMETHODIMP CBasic::outDecimal(DECIMAL* val) -{ - * val = m_decimal; - return S_OK; -} - -STDMETHODIMP CBasic::inoutDecimal(DECIMAL* val) -{ - DECIMAL tmp; - tmp = * val; - * val = m_decimal; - m_decimal = tmp; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpDecimal(DECIMAL* pVal) -{ - * pVal = m_decimal; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpDecimal(DECIMAL newVal) -{ - m_decimal = newVal; - return S_OK; -} - -STDMETHODIMP CBasic::inSCode(SCODE val) -{ - m_scode = val; - return S_OK; -} - -STDMETHODIMP CBasic::outScode(SCODE* val) -{ - * val = m_scode; - return S_OK; -} - -STDMETHODIMP CBasic::inoutSCode(SCODE* val) -{ - SCODE tmp = *val; - * val = m_scode; - m_scode = tmp; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpSCode(SCODE* pVal) -{ - * pVal = m_scode; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpSCode(SCODE newVal) -{ - m_scode = newVal; - return S_OK; -} - -STDMETHODIMP CBasic::inrefLong(LONG* val) -{ - m_long = * val; - return S_OK; -} - -STDMETHODIMP CBasic::inrefVariant(VARIANT* val) -{ - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy( & m_var1, val))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::inrefDecimal(DECIMAL* val) -{ - m_decimal = * val; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpRefLong(long* pVal) -{ - *pVal = m_long; - return S_OK; -} - -STDMETHODIMP CBasic::putref_prpRefLong(long* newVal) -{ - m_long = * newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prprefVariant(VARIANT* pVal) -{ - HRESULT hr = S_OK; - hr = VariantCopy(pVal, & m_var1); - return hr; -} - -STDMETHODIMP CBasic::putref_prprefVariant(VARIANT* newVal) -{ - m_var1 = * newVal; - return S_OK; -} - -STDMETHODIMP CBasic::get_prprefDecimal(DECIMAL* pVal) -{ - * pVal = m_decimal; - return S_OK; -} - -STDMETHODIMP CBasic::putref_prprefDecimal(DECIMAL* newVal) -{ - m_decimal = *newVal; - return S_OK; -} - - -STDMETHODIMP CBasic::optional6(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4) -{ - HRESULT hr = S_OK; - if (FAILED(hr = m_var1.Copy(val1))) - return hr; - if (FAILED(hr = m_var2.Copy(val2))) - return hr; - if (FAILED(hr = m_var3.Copy(val3))) - return hr; - if (FAILED(hr = m_var4.Copy(val4))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::optional7(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4) -{ - HRESULT hr = S_OK; - if (FAILED(hr = VariantCopy(val1, & m_var1))) - return hr; - if (FAILED(hr = VariantCopy(val2, & m_var2))) - return hr; - if (FAILED(hr = VariantCopy(val3, & m_var3))) - return hr; - if (FAILED(hr = VariantCopy(val4, & m_var4))) - return hr; - - return S_OK; -} - -STDMETHODIMP CBasic::get_prpMultiArg1(VARIANT* val1, VARIANT* val2, VARIANT* pVal) -{ - HRESULT hr = S_OK; - CComVariant tmp1(*val1); - CComVariant tmp2(*val2); - - if (FAILED(hr = VariantCopy(val1, & m_var1))) - return hr; - if (FAILED(hr = VariantCopy(val2, & m_var2))) - return hr; - m_var1 = tmp1; - m_var2 = tmp2; - if (FAILED(hr = VariantCopy(pVal, & m_var3))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpMultiArg1(VARIANT* val1, VARIANT* val2, VARIANT* newVal) -{ - HRESULT hr = S_OK; - CComVariant tmp1( * val1); - CComVariant tmp2( * val2); - - if (FAILED(hr = VariantCopy(val1, & m_var1))) - return hr; - if (FAILED(hr = VariantCopy(val2, & m_var2))) - return hr; - m_var1 = tmp1; - m_var2 = tmp2; - - m_var3 = *newVal; - return S_OK; -} - -// tagVARIANT DISPATCH_PROPERTYPUT DISPID_PROPERTYPUT VARIANTARG LOCALE_USER_DEFAULT - -STDMETHODIMP CBasic::get_prpMultiArg2(VARIANT val1, VARIANT* pVal) -{ - HRESULT hr = S_OK; - m_var1 = val1; - - if (FAILED(hr = VariantCopy(pVal, & m_var2))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpMultiArg2(VARIANT val1, VARIANT newVal) -{ - m_var1 = val1; - m_var2 = newVal; - return S_OK; -} - -// returns the values set by prpMultiArg2 -STDMETHODIMP CBasic::prpMultiArg2GetValues(VARIANT* val1, VARIANT* valProperty) -{ - HRESULT hr = S_OK; - if (FAILED(VariantCopy(val1, & m_var1))) - return hr; - if (FAILED(VariantCopy(valProperty, & m_var2))) - return hr; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpMultiArg3(LONG* val1, LONG* pVal) -{ - long aLong = *val1; - *val1 = m_long; - m_long = aLong; - - * pVal = m_long2; - return S_OK; -} - -STDMETHODIMP CBasic::put_prpMultiArg3(LONG* val1, LONG newVal) -{ - long aLong = *val1; - *val1 = m_long; - m_long = aLong; - - m_long2 = newVal; - return S_OK; -} - -STDMETHODIMP CBasic::inUnknown(IUnknown* val) -{ - m_unknown = val; - - return S_OK; -} - -STDMETHODIMP CBasic::outUnknown(IUnknown** val) -{ - m_unknown.CopyTo(val); - return S_OK; -} - -STDMETHODIMP CBasic::inoutUnknown(IUnknown** val) -{ - CComPtr tmp = *val; - m_unknown.CopyTo(val); - m_unknown = tmp; - return S_OK; -} - -STDMETHODIMP CBasic::get_prpUnknown(IUnknown** pVal) -{ - m_prpUnknown.CopyTo(pVal); - return S_OK; -} - -STDMETHODIMP CBasic::put_prpUnknown(IUnknown* newVal) -{ - m_prpUnknown = newVal; - return S_OK; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Basic.h b/extensions/test/ole/AxTestComponents/Basic.h deleted file mode 100644 index eb67ce8bb..000000000 --- a/extensions/test/ole/AxTestComponents/Basic.h +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Basic.h : Declaration of the CBasic - -#ifndef __BASIC_H_ -#define __BASIC_H_ - -#include "resource.h" // main symbols -#import "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids - -///////////////////////////////////////////////////////////////////////////// -// CBasic -class ATL_NO_VTABLE CBasic : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl - { -public: - CBasic(); - ~CBasic(); - - DECLARE_REGISTRY_RESOURCEID(IDR_BASIC) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(CBasic) - COM_INTERFACE_ENTRY(IBasic) - COM_INTERFACE_ENTRY(IDispatch) - END_COM_MAP() - - // IBasic -public: - STDMETHOD(outMore)(/*[out]*/long* val1, /*[out]*/long* val2); - STDMETHOD(inMulDimArrayByte2)(LPSAFEARRAY val); - STDMETHOD(inMulDimArrayByte)(LPSAFEARRAY val); - STDMETHOD(inMulDimArrayVariant2)(LPSAFEARRAY val); - STDMETHOD(inMulDimArrayLong2)(LPSAFEARRAY val); - STDMETHOD(inMulDimArrayVariant)(LPSAFEARRAY val); - STDMETHOD(inMulDimArrayLong)( LPSAFEARRAY val); - STDMETHOD(inoutSequenceObject)(LPSAFEARRAY* val); - STDMETHOD(inoutSequenceDouble)(LPSAFEARRAY * val); - STDMETHOD(inoutSequenceFloat)(LPSAFEARRAY * val); - STDMETHOD(inoutSequenceString)(LPSAFEARRAY* val); - STDMETHOD(inoutSequenceLong)(LPSAFEARRAY * val); - STDMETHOD(inoutSequenceShort)(LPSAFEARRAY * val); - STDMETHOD(inoutSequenceByte)(LPSAFEARRAY * val); - STDMETHOD(outSequenceObject)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceDouble)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceFloat)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceString)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceLong)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceShort)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(outSequenceByte)(/*[out]*/ LPSAFEARRAY* val); - STDMETHOD(inSequenceObject)(LPSAFEARRAY ar); - STDMETHOD(inSequenceDouble)(LPSAFEARRAY ar); - STDMETHOD(inSequenceFloat)(LPSAFEARRAY ar); - STDMETHOD(inSequenceString)(LPSAFEARRAY ar); - STDMETHOD(inSequenceShort)(LPSAFEARRAY ar); - STDMETHOD(inSequenceByte)(LPSAFEARRAY ar); - STDMETHOD(inSequenceLong)(LPSAFEARRAY ar); - STDMETHOD(mixed1)( - /* [out][in] */ unsigned char *aChar, - /* [out][in] */ float *aFloat, - /* [out][in] */ VARIANT *aVar); - STDMETHOD(get_prpObject)(/*[out, retval]*/ IDispatch* *pVal); - STDMETHOD(put_prpObject)(/*[in]*/ IDispatch* newVal); - STDMETHOD(get_prpArray)(/*[out, retval]*/ LPSAFEARRAY *pVal); - STDMETHOD(put_prpArray)(/*[in]*/ LPSAFEARRAY newVal); - STDMETHOD(get_prpVariant)(/*[out, retval]*/ VARIANT *pVal); - STDMETHOD(put_prpVariant)(/*[in]*/ VARIANT newVal); - STDMETHOD(get_prpDouble)(/*[out, retval]*/ double *pVal); - STDMETHOD(put_prpDouble)(/*[in]*/ double newVal); - STDMETHOD(get_prpFloat)(/*[out, retval]*/ float *pVal); - STDMETHOD(put_prpFloat)(/*[in]*/ float newVal); - STDMETHOD(get_prpString)(/*[out, retval]*/ BSTR *pVal); - STDMETHOD(put_prpString)(/*[in]*/ BSTR newVal); - STDMETHOD(get_prpLong)(/*[out, retval]*/ long *pVal); - STDMETHOD(put_prpLong)(/*[in]*/ long newVal); - STDMETHOD(get_prpShort)(/*[out, retval]*/ short *pVal); - STDMETHOD(put_prpShort)(/*[in]*/ short newVal); - STDMETHOD(get_prpByte)(/*[out, retval]*/ unsigned char *pVal); - STDMETHOD(put_prpByte)(/*[in]*/ unsigned char newVal); - STDMETHOD(get_prpBool)(/*[out, retval]*/ VARIANT_BOOL *pVal); - STDMETHOD(put_prpBool)(/*[in]*/ VARIANT_BOOL newVal); - - STDMETHOD(outObject)(/*[out]*/ IDispatch* *val); - STDMETHOD(outArray)(/*[out]*/ LPSAFEARRAY * val); - STDMETHOD(outVariant)(/*[out]*/ VARIANT* val); - STDMETHOD(outDouble)(/*[out]*/ double* val); - STDMETHOD(outFloat)(/*[out]*/ float* val); - STDMETHOD(outString)(/*[out]*/ BSTR* val); - STDMETHOD(outLong)(/*[out]*/ long* val); - STDMETHOD(outShort)(/*[out]*/ short* val); - STDMETHOD(outByte)(/*[out]*/ unsigned char* val); - STDMETHOD(outBool)(/*[out]*/ VARIANT_BOOL* val); - - STDMETHOD(inoutObject)(/*[in,out]*/ IDispatch* *val); - STDMETHOD(inoutArray)(/*[in,out]*/ LPSAFEARRAY * val); - STDMETHOD(inoutVariant)(/*[in,out]*/ VARIANT * val); - STDMETHOD(inoutDouble)(/*[in,out]*/ double * val); - STDMETHOD(inoutFloat)(/*[in,out]*/ float * val); - STDMETHOD(inoutString)(/*[in, out]*/ BSTR* val); - STDMETHOD(inoutLong)(/*[in,out]*/ long * val); - STDMETHOD(inoutShort)(/*[in,out]*/ short* val); - STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* val); - STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL* val); - - - STDMETHOD(inObject)(/*[in]*/ IDispatch* val); - STDMETHOD(inArray)(/*[in]*/ LPSAFEARRAY val); - STDMETHOD(inVariant)(/*[in]*/ VARIANT val); - STDMETHOD(inDouble)(/*[in]*/ double val); - STDMETHOD(inFloat)(/*[in]*/ float val); - STDMETHOD(inString)(/*[in]*/ BSTR val); - STDMETHOD(inLong)(/*[in]*/ long val); - STDMETHOD(inShort)(/*[in]*/ short val); - STDMETHOD(inByte)(/*[in]*/ unsigned char val); - STDMETHOD(inBool)(/*[in]*/ VARIANT_BOOL val); - - - STDMETHOD(optional1)(/*[in]*/ long val1, /*[in, optional]*/ VARIANT* val2); - STDMETHOD(optional2)(/*[out]*/ long* val1,/*[out, optional]*/ VARIANT* val2); - STDMETHOD(optional3)(/*[in, optional]*/ VARIANT* val1,/*[in, optional]*/ VARIANT* val2); - STDMETHOD(optional4)(/*[in, out, optional]*/ VARIANT* val1,/*[in, out, optional]*/ VARIANT* val2); - STDMETHOD(optional5)(/*[out, optional]*/ VARIANT* val1,/*[out, optional]*/ VARIANT* val2); - - - STDMETHOD(defaultvalue1)(/*[in, defaultvalue(10)]*/ long val1, - /*[in, defaultvalue(3.14)]*/ double* val2, - // /*[in, defaultvalue(10)]*/ VARIANT val3, - /*[in, defaultvalue(100)]*/ VARIANT* val4); - - STDMETHOD(defaultvalue2)(/*[in, out, defaultvalue(10)]*/ long* val1, - /*[in, out, defaultvalue(3.14)]*/ double* val2, - // /*[in, out, defaultvalue(10)]*/ VARIANT* val3, - /*[in, out, defaultvalue(100)]*/ VARIANT* val4); - - STDMETHOD(varargfunc1)(/*[in]*/ long val1,/*[in]*/ LPSAFEARRAY val2); - - STDMETHOD(varargfunc2)(/*[out]*/ long* val1, /*[out]*/ SAFEARRAY ** val2); - - - // members for property implementations - unsigned char m_cPrpByte; - short m_nPrpShort; - long m_lPrpLong; - float m_fPrpFloat; - double m_dPrpDouble; - CComPtr m_PrpObject; - CComPtr m_prpUnknown; - - CComBSTR m_bstrPrpString; - CComVariant m_PropVariant; - LPSAFEARRAY m_PrpArray; -protected: - VARIANT_BOOL m_bool; - unsigned char m_byte; - short m_short; - long m_long; - long m_long2; - float m_float; - double m_double; - CComVariant m_var1; - CComVariant m_var2; - CComVariant m_var3; - CComVariant m_var4; - CComBSTR m_bstr; - CY m_cy; - DATE m_date; - DECIMAL m_decimal; - SCODE m_scode; - SAFEARRAY * m_safearray; - CComPtr m_obj; - CComPtr m_unknown; - - SAFEARRAY * m_arByte; - SAFEARRAY * m_arShort; - SAFEARRAY * m_arLong; - SAFEARRAY * m_arString; - SAFEARRAY * m_arVariant; - SAFEARRAY * m_arFloat; - SAFEARRAY * m_arDouble; - SAFEARRAY * m_arObject; - SAFEARRAY * m_arByteDim2; - - static void printArray(LPSAFEARRAY val, BSTR message, VARTYPE type); - static void printMulArray(LPSAFEARRAY val, VARTYPE type); - - -public: - STDMETHOD(inSequenceByteDim2)(LPSAFEARRAY val); - STDMETHOD(inCurrency)(CY val); - STDMETHOD(outCurrency)(CY* val); - STDMETHOD(inoutCurrency)(CY* val); - STDMETHOD(inDate)(DATE val); - STDMETHOD(outDate)(DATE* val); - STDMETHOD(inoutDate)(DATE* val); - STDMETHOD(get_prpCurrency)(CY* pVal); - STDMETHOD(put_prpCurrency)(CY newVal); - STDMETHOD(get_prpDate)(DATE* pVal); - STDMETHOD(put_prpDate)(DATE newVal); - STDMETHOD(inDecimal)(DECIMAL val); - STDMETHOD(outDecimal)(DECIMAL* val); - STDMETHOD(inoutDecimal)(DECIMAL* val); - STDMETHOD(get_prpDecimal)(DECIMAL* pVal); - STDMETHOD(put_prpDecimal)(DECIMAL newVal); - STDMETHOD(inSCode)(SCODE val); - STDMETHOD(outScode)(SCODE* val); - STDMETHOD(inoutSCode)(SCODE* val); - STDMETHOD(get_prpSCode)(SCODE* pVal); - STDMETHOD(put_prpSCode)(SCODE newVal); - STDMETHOD(inrefLong)(LONG* val); - STDMETHOD(inrefVariant)(VARIANT* val); - STDMETHOD(inrefDecimal)(DECIMAL* val); - STDMETHOD(get_prpRefLong)(long* pVal); - STDMETHOD(putref_prpRefLong)(long* newVal); - STDMETHOD(get_prprefVariant)(VARIANT* pVal); - STDMETHOD(putref_prprefVariant)(VARIANT* newVal); - STDMETHOD(get_prprefDecimal)(DECIMAL* pVal); - STDMETHOD(putref_prprefDecimal)(DECIMAL* newVal); - STDMETHOD(optional6)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4); - STDMETHOD(optional7)(VARIANT* val1, VARIANT* val2, VARIANT* val3, VARIANT* val4); - - STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* pVal); - //STDMETHOD(get_prpMultiArg1)(VARIANT* val1, VARIANT* pVal); - STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* val2, VARIANT* newVal); - //STDMETHOD(put_prpMultiArg1)(VARIANT* val1, VARIANT* newVal); - STDMETHOD(get_prpMultiArg2)(VARIANT val1, VARIANT* pVal); - STDMETHOD(put_prpMultiArg2)(VARIANT val1, VARIANT newVal); - STDMETHOD(prpMultiArg2GetValues)(VARIANT* val1, VARIANT* valProperty); - STDMETHOD(get_prpMultiArg3)(LONG* val1, LONG* pVal); - STDMETHOD(put_prpMultiArg3)(LONG* val1, LONG newVal); - - // IFoo Methods -public: - STDMETHOD(inUnknown)(IUnknown* val); - STDMETHOD(outUnknown)(IUnknown** val); - STDMETHOD(inoutUnknown)(IUnknown** val); - STDMETHOD(get_prpUnknown)(IUnknown** pVal); - STDMETHOD(put_prpUnknown)(IUnknown* newVal); -}; - -#endif //__BASIC_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Basic.rgs b/extensions/test/ole/AxTestComponents/Basic.rgs deleted file mode 100644 index 67fa86008..000000000 --- a/extensions/test/ole/AxTestComponents/Basic.rgs +++ /dev/null @@ -1,50 +0,0 @@ -HKCR -{ - AxTestComponents.Basic.1 = s 'Basic Class' - { - CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}' - } - AxTestComponents.Basic = s 'Basic Class' - { - CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}' - CurVer = s 'AxTestComponents.Basic.1' - } - NoRemove CLSID - { - ForceRemove {BFE10EBE-8584-11D4-8335-005004526AB4} = s 'Basic Class' - { - ProgID = s 'AxTestComponents.Basic.1' - VersionIndependentProgID = s 'AxTestComponents.Basic' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{BFE10EB1-8584-11D4-8335-005004526AB4}' - } - } - AxTestComponents.Foo.1 = s 'Foo Class' - { - CLSID = s '{14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D}' - } - AxTestComponents.Foo = s 'Foo Class' - { - CLSID = s '{14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D}' - CurVer = s 'AxTestComponents.Foo.1' - } - NoRemove CLSID - { - ForceRemove {14DE9D5D-EB9D-4091-8E1B-A1B1672D8C1D} = s 'Foo Class' - { - ProgID = s 'AxTestComponents.Foo.1' - VersionIndependentProgID = s 'AxTestComponents.Foo' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{BFE10EB1-8584-11D4-8335-005004526AB4}' - } - } - -} diff --git a/extensions/test/ole/AxTestComponents/Foo.cpp b/extensions/test/ole/AxTestComponents/Foo.cpp deleted file mode 100644 index 6eacea772..000000000 --- a/extensions/test/ole/AxTestComponents/Foo.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "stdafx.h" -#include "Foo.h" - - -///////////////////////////////////////////////////////////////////////////// -// CBasic -CFoo::CFoo() -{ -} - -CFoo::~CFoo() -{ - -} - -STDMETHODIMP CFoo::Foo(IUnknown *pVal) -{ - return S_OK; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/Foo.h b/extensions/test/ole/AxTestComponents/Foo.h deleted file mode 100644 index a4024ea01..000000000 --- a/extensions/test/ole/AxTestComponents/Foo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Basic.h : Declaration of the CBasic - -#ifndef __Foo_H_ -#define __Foo_H_ - -#include "resource.h" // main symbols -#import "AxTestComponents.tlb" no_namespace no_implementation raw_interfaces_only named_guids - -///////////////////////////////////////////////////////////////////////////// -// CBasic -class ATL_NO_VTABLE CFoo : - public CComObjectRootEx, - public CComCoClass, - public IFoo - -// public IDispatchImpl -{ -public: - CFoo(); - ~CFoo(); - - DECLARE_REGISTRY_RESOURCEID(IDR_BASIC) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(CFoo) - COM_INTERFACE_ENTRY(IFoo) - END_COM_MAP() - - -STDMETHOD(Foo)(IUnknown* val); - - // IFoo Methods -public: -}; - -#endif //__BASIC_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/StdAfx.cpp b/extensions/test/ole/AxTestComponents/StdAfx.cpp deleted file mode 100644 index d881698b2..000000000 --- a/extensions/test/ole/AxTestComponents/StdAfx.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/StdAfx.h b/extensions/test/ole/AxTestComponents/StdAfx.h deleted file mode 100644 index a46eeeb61..000000000 --- a/extensions/test/ole/AxTestComponents/StdAfx.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_) -#define AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/AxTestComponents/readme.txt b/extensions/test/ole/AxTestComponents/readme.txt deleted file mode 100644 index 363a0ed33..000000000 --- a/extensions/test/ole/AxTestComponents/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ - -The component does not use the AxTestComponent.h created by the midl -compiler. Instead #import is used. This is because of a bug when -using attribute "defaultvalue" in idl. \ No newline at end of file diff --git a/extensions/test/ole/AxTestComponents/resource.h b/extensions/test/ole/AxTestComponents/resource.h deleted file mode 100644 index b92618918..000000000 --- a/extensions/test/ole/AxTestComponents/resource.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by AxTestComponents.rc -// -#define IDS_PROJNAME 100 -#define IDR_BASIC 101 -//#define IDR_FOO 501 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas b/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas deleted file mode 100644 index e9bb197ed..000000000 --- a/extensions/test/ole/DCOM/Clients/WriterDemo/Module1.bas +++ /dev/null @@ -1,8 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit - -Sub main() - Dim obj As Object - Set obj = CreateObject("dcomtest.writerdemo.wsc") - obj.run -End Sub diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp deleted file mode 100644 index ca477cff6..000000000 --- a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbp +++ /dev/null @@ -1,33 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation -Module=Module1; Module1.bas -Startup="Sub Main" -HelpFile="" -Command32="" -Name="client_writerdemo" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="StarOffice" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw b/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw deleted file mode 100644 index 067d7529e..000000000 --- a/extensions/test/ole/DCOM/Clients/WriterDemo/client_writerdemo.vbw +++ /dev/null @@ -1 +0,0 @@ -Module1 = 108, 108, 685, 544, diff --git a/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt b/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt deleted file mode 100644 index 1d5a63492..000000000 --- a/extensions/test/ole/DCOM/Clients/WriterDemo/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -Visual Basic client that instantiates a Windows Script Component -,dcomtest.writerdemo.wsc. That component is located in -extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc. Don't forget to -register that component (right-click,select register). diff --git a/extensions/test/ole/DCOM/dcom_test/Module1.bas b/extensions/test/ole/DCOM/dcom_test/Module1.bas deleted file mode 100644 index c41c3a073..000000000 --- a/extensions/test/ole/DCOM/dcom_test/Module1.bas +++ /dev/null @@ -1,38 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit - -Sub main() - -MsgBox "hallo" - -'The service manager is always the starting point -'If there is no office running then an office is started up -Dim objServiceManager As Object -Set objServiceManager = CreateObject("com.sun.star.ServiceManager") - -'Create the CoreReflection service that is later used to create structs -Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection") - -'Create the Desktop -Set objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop") - -'Open a new empty writer document - -Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection") -'get a type description class for Size -Set propClass = objCoreReflection.forName("com.sun.star.beans.PropertyValue") - -Dim prop -propClass.CreateObject prop -prop.Name = "Hidden" -prop.Value = True - -'create the actual object -Dim args(0) -Set args(0) = prop - -Dim args2() -'Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args) -Set objDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args2) - -End Sub diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp deleted file mode 100644 index 5b896434f..000000000 --- a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbp +++ /dev/null @@ -1,37 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation -Module=Module1; ..\..\..\..\..\..\Projects\VBasic\dcom_test\Module1.bas -Startup="Sub Main" -HelpFile="" -Title="dcom_test" -ExeName32="dcom_test.exe" -Path32="..\..\..\..\..\..\Projects\VBasic\dcom_test" -Command32="" -Name="dcom_test" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="StarOffice" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw b/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw deleted file mode 100644 index dfe34e0d1..000000000 --- a/extensions/test/ole/DCOM/dcom_test/dcom_test.vbw +++ /dev/null @@ -1 +0,0 @@ -Module1 = 1, 1, 849, 604, Z diff --git a/extensions/test/ole/DCOM/dcom_test/readme.txt b/extensions/test/ole/DCOM/dcom_test/readme.txt deleted file mode 100644 index 215d6f409..000000000 --- a/extensions/test/ole/DCOM/dcom_test/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ -The program creates the com.sun.star.Servicemanager on a remote machine: - -Set objServiceManager = CreateObject("com.sun.star.ServiceManager", "\\jl-1036") - -creates a document and writes in it. \ No newline at end of file diff --git a/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc b/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc deleted file mode 100644 index bb3317793..000000000 --- a/extensions/test/ole/DCOM/scriptComponents/WriterDemo.wsc +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/DCOM/scriptComponents/readme.txt b/extensions/test/ole/DCOM/scriptComponents/readme.txt deleted file mode 100644 index 81dff56b4..000000000 --- a/extensions/test/ole/DCOM/scriptComponents/readme.txt +++ /dev/null @@ -1,13 +0,0 @@ -WriterDemo.wsc -================================================================================= -Register the component by right-clicking on the file in the file explorer and select -register. -The component registered as being remotable.That is, it has got an AppID entry (with -a DllSurrogate subkey).That enables us to use dcomcnfg.exe in order to set AccessPermissions,etc. -which is necessary because of the use of the JScript Array object. The automation -bridge will query for IDispatchEx,which is a call from server to client.Hence the server -needs the proper right within the client. - -The component implements a run function, which runs the demo example that is written -in JScript. - diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp deleted file mode 100644 index 9512ec4c2..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// EventListener.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f EventListenerps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include -#include "EventListener.h" - -#include "EventListener_i.c" -#include "EvtListener.h" - - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_EvtListener, CEvtListener) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_EVENTLISTENERLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.def b/extensions/test/ole/EventListenerSample/EventListener/EventListener.def deleted file mode 100644 index 9d88a68f7..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.def +++ /dev/null @@ -1,9 +0,0 @@ -; EventListener.def : Declares the module parameters. - -LIBRARY "EventListener.DLL" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl b/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl deleted file mode 100644 index 6272173a2..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.idl +++ /dev/null @@ -1,39 +0,0 @@ -// EventListener.idl : IDL source for EventListener.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (EventListener.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; - [ - object, - uuid(86653399-24C6-4C2B-9E8A-564175250CB2), - dual, - helpstring("IEvtListener-Schnittstelle"), - pointer_default(unique) - ] - interface IEvtListener : IDispatch - { - [id(1), helpstring("Methode disposing")] HRESULT disposing([in] IDispatch* source); - }; - -[ - uuid(E3E61535-3262-45E6-BFD9-EE8AED051BD1), - version(1.0), - helpstring("EventListener 1.0 Type Library") -] -library EVENTLISTENERLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(830E0743-87C1-4C99-A77A-5FBA0C2EBD9A), - helpstring("EvtListener Class") - ] - coclass EvtListener - { - [default] interface IEvtListener; - }; -}; diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc b/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc deleted file mode 100644 index 90f0c7bd2..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.rc +++ /dev/null @@ -1,136 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Deutschland) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""EventListener.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "EventListener Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "EventListener\0" - VALUE "LegalCopyright", "Copyright 2001\0" - VALUE "OriginalFilename", "EventListener.DLL\0" - VALUE "ProductName", "EventListener Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "EventListener" -END - -#endif // Deutsch (Deutschland) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Englisch (USA) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_EVTLISTENER REGISTRY DISCARDABLE "EvtListener.rgs" -#endif // Englisch (USA) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "EventListener.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln b/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln deleted file mode 100644 index 8420bb492..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.sln +++ /dev/null @@ -1,32 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventListener", "EventListener.vcproj", "{055137B6-A402-4913-AC11-9A096E866F5B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release MinDependency|Win32 = Release MinDependency|Win32 - Release MinSize|Win32 = Release MinSize|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32 - Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {055137B6-A402-4913-AC11-9A096E866F5B}.Debug|Win32.ActiveCfg = Debug|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Debug|Win32.Build.0 = Debug|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Release MinSize|Win32.Build.0 = Release MinSize|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32 - {055137B6-A402-4913-AC11-9A096E866F5B}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj b/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj deleted file mode 100644 index e8aef5532..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.vcproj +++ /dev/null @@ -1,927 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp deleted file mode 100644 index 1605b0982..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// EvtListener.cpp : Implementierung von CEvtListener -#include "stdafx.h" -#include "EventListener.h" -#include "EvtListener.h" - -///////////////////////////////////////////////////////////////////////////// -// CEvtListener - -STDMETHODIMP CEvtListener::disposing( IDispatch* source) -{ - ::MessageBox(NULL,_T("XEventListener::disposing"), - _T("EventListener.EvtListener component"), MB_OK); - return S_OK; -} - -CEvtListener::~CEvtListener() -{ - -} -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h deleted file mode 100644 index 2bc0a6a9a..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// EvtListener.h : Deklaration von CEvtListener - -#ifndef __EVTLISTENER_H_ -#define __EVTLISTENER_H_ - -#include "resource.h" // Hauptsymbole - -///////////////////////////////////////////////////////////////////////////// -// CEvtListener -class ATL_NO_VTABLE CEvtListener : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ -public: - CEvtListener() - { - } - ~CEvtListener(); - -DECLARE_REGISTRY_RESOURCEID(IDR_EVTLISTENER) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CEvtListener) - COM_INTERFACE_ENTRY(IEvtListener) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// IEvtListener -public: - STDMETHOD(disposing)(IDispatch* source); -}; - -#endif //__EVTLISTENER_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs deleted file mode 100644 index e0aa9bbb7..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - EventListener.EvtListener.1 = s 'EvtListener Class' - { - CLSID = s '{830E0743-87C1-4C99-A77A-5FBA0C2EBD9A}' - } - EventListener.EvtListener = s 'EvtListener Class' - { - CLSID = s '{830E0743-87C1-4C99-A77A-5FBA0C2EBD9A}' - CurVer = s 'EventListener.EvtListener.1' - } - NoRemove CLSID - { - ForceRemove {830E0743-87C1-4C99-A77A-5FBA0C2EBD9A} = s 'EvtListener Class' - { - ProgID = s 'EventListener.EvtListener.1' - VersionIndependentProgID = s 'EventListener.EvtListener' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{E3E61535-3262-45E6-BFD9-EE8AED051BD1}' - } - } -} diff --git a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp deleted file mode 100644 index c25536a52..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h b/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h deleted file mode 100644 index def66faf1..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/StdAfx.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED_) -#define AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__E275407A_804A_477E_9A28_F5CA84E711C3__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/resource.h b/extensions/test/ole/EventListenerSample/EventListener/resource.h deleted file mode 100644 index 70bf51a6f..000000000 --- a/extensions/test/ole/EventListenerSample/EventListener/resource.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by EventListener.rc -// -#define IDS_PROJNAME 100 -#define IDR_EVTLISTENER 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 102 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas b/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas deleted file mode 100644 index aafd265a0..000000000 --- a/extensions/test/ole/EventListenerSample/VBEventListener/Module1.bas +++ /dev/null @@ -1,9 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit - - -Sub Main() - -End Sub - - diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls b/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls deleted file mode 100644 index 4c36785b5..000000000 --- a/extensions/test/ole/EventListenerSample/VBEventListener/VBEventListener.cls +++ /dev/null @@ -1,78 +0,0 @@ -'************************************************************************* -' -' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -' -' Copyright 2000, 2010 Oracle and/or its affiliates. -' -' OpenOffice.org - a multi-platform office productivity suite -' -' This file is part of OpenOffice.org. -' -' OpenOffice.org is free software: you can redistribute it and/or modify -' it under the terms of the GNU Lesser General Public License version 3 -' only, as published by the Free Software Foundation. -' -' OpenOffice.org is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU Lesser General Public License version 3 for more details -' (a copy is included in the LICENSE file that accompanied this code). -' -' You should have received a copy of the GNU Lesser General Public License -' version 3 along with OpenOffice.org. If not, see -' -' for a copy of the LGPLv3 License. -' -'************************************************************************* - -VERSION 1.0 CLASS -BEGIN - MultiUse = -1 'True - Persistable = 0 'NotPersistable - DataBindingBehavior = 0 'vbNone - DataSourceBehavior = 0 'vbNone - MTSTransactionMode = 0 'NotAnMTSObject -END -Attribute VB_Name = "VBEventListener" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = True -Attribute VB_PredeclaredId = False -Attribute VB_Exposed = True -Option Explicit -Private interfaces(0) As String -Private bDisposingCalled As Boolean -Private bQuiet As Boolean - -Public Property Get Bridge_ImplementedInterfaces() As Variant - Bridge_ImplementedInterfaces = interfaces -End Property - -Private Sub Class_Initialize() -interfaces(0) = "com.sun.star.lang.XEventListener" -bDisposingCalled = False -bQuiet = False -End Sub - -Private Sub Class_Terminate() - On Error Resume Next - Debug.Print "Terminate VBEventListener" -End Sub - -Public Sub disposing(ByVal source As Object) - If bQuiet = False Then - MsgBox "disposing called" - End If - bDisposingCalled = True -End Sub - -Public Sub setQuiet(quiet As Boolean) - bQuiet = quiet -End Sub - -Public Sub resetDisposing() - bDisposingCalled = False -End Sub - -Public Function disposingCalled() - disposingCalled = bDisposingCalled -End Function diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.dll b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.dll deleted file mode 100644 index 5ac90de39..000000000 Binary files a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.dll and /dev/null differ diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp deleted file mode 100644 index f89b866be..000000000 --- a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbp +++ /dev/null @@ -1,38 +0,0 @@ -Type=OleDll -Class=VBEventListener; VBEventListener.cls -Module=Module1; Module1.bas -Startup="Sub Main" -HelpFile="" -ExeName32="VBasicEventListener.dll" -Command32="" -Name="VBasicEventListener" -HelpContextID="0" -Description="Implementation of UNO XEventListener" -CompatibleMode="1" -CompatibleEXE32="VBasicEventListener.dll" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="StarOffice" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=1 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -ThreadingModel=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw b/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw deleted file mode 100644 index cf737ac40..000000000 --- a/extensions/test/ole/EventListenerSample/VBEventListener/VBasicEventListener.vbw +++ /dev/null @@ -1,2 +0,0 @@ -VBEventListener = 132, 132, 732, 748, -Module1 = 64, 33, 849, 530, diff --git a/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt b/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt deleted file mode 100644 index 1daace267..000000000 --- a/extensions/test/ole/EventListenerSample/VBEventListener/readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -VBasicEventListener.dll is an ActiveX component written with VisualBasic. The -component registers on the system with a particular ID. When the library is build -this ID is generated, unless a previously build library exists. Then the ID of that -library is used. In order to use always the same ID, the library must be as binary in -the cvs. - -The library can be used under the licences noted in VBEventListener.cls. \ No newline at end of file diff --git a/extensions/test/ole/EventListenerSample/events.htm b/extensions/test/ole/EventListenerSample/events.htm deleted file mode 100644 index 973a21528..000000000 --- a/extensions/test/ole/EventListenerSample/events.htm +++ /dev/null @@ -1,98 +0,0 @@ - - - - -Document Title - - - - - - -

          -The script on this page creates a new StarOffice document and connects an event listener -to it. When the document is closed then the XEventListener::disposing method is called on the -listener object. How the listener is set up depends on the button being clicked. -

          -

          -The button will run JScript code that and adds an JScript event listener to the document. -The listener is also implemented in JScript an is on this page.. -

          - -

          - -The button runs JScript code that creates the ActiveX component EventListener.EvtListener that -is written in C++ and housed in a dll. Then the event listener is added to the document. -

          - -

          -The button runs VBScript code that creates the components EventListener.EvtListener and adds it -to the document. -

          - -

          -Runs VBScript code that creates VBasicEventListener.VBEventListener ActiveX component which was -written with VB -

          - - - - - - diff --git a/extensions/test/ole/EventListenerSample/readme.txt b/extensions/test/ole/EventListenerSample/readme.txt deleted file mode 100644 index 6485571ec..000000000 --- a/extensions/test/ole/EventListenerSample/readme.txt +++ /dev/null @@ -1,20 +0,0 @@ -EventListener -======================================== - -The folder EventListener contains an MSDEV project that builds a dll that -contains the EventListener.EvtListener ActiveX component. The component -implements the XEventListener interface according to the rules of the -OleBridge. The component will be used from the HTML page events.htm. - - -VBEventListener: -======================================== - -Contains a Visual Basic project that builds an ActiveX component that implements -com.sun.star.lang.XEventListener. Its ProgId is -VBasicEventListener.VBEventListener The dll should also be checked in. VB needs -its TLB, so it uses the same CLSIDs on the next build. The component will create -a message box when its disposing function has been called. - -The project also contains a client that builds a Project1.exe (in the same -folder) that creates VBEventListener and adds it to a StarOffice document diff --git a/extensions/test/ole/JScriptNewStyle.htm b/extensions/test/ole/JScriptNewStyle.htm deleted file mode 100644 index 016119d19..000000000 --- a/extensions/test/ole/JScriptNewStyle.htm +++ /dev/null @@ -1,1054 +0,0 @@ - - - - -Document Title - - - - - - - -
          - - - -

          JScript with _GetValueObject

          -Tests Array/Sequence conversion.
          -All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons. -
          - - - - - - - - - - - - -

          - - -Out Parameter
          - - - - - - - - - - - - - - - - - -

          -In Out Parameter
          - - - - - - - - - - - - - -

          - -Tests Array/Sequence conversion with Attributes. All params are of type Sequence and - the element type of the Sequence is written on the buttons.
          - - - - - - - - - - - - - -

          - - - -

          Visual Basic Tests

          -Test array /Sequence conversion and return value
          -Template: Sequence < type > method( Sequence< type > ) -

          - - - - -

          - - -Out parameter
          -Template: void method( Sequence < type > )
          - - -

          - - - - diff --git a/extensions/test/ole/MfcControl/MfcControl.cpp b/extensions/test/ole/MfcControl/MfcControl.cpp deleted file mode 100644 index 355476237..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// MfcControl.cpp : Implementation of CMfcControlApp and DLL registration. - -#include "stdafx.h" -#include "MfcControl.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -CMfcControlApp NEAR theApp; - -const GUID CDECL BASED_CODE _tlid = - { 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; -const WORD _wVerMajor = 1; -const WORD _wVerMinor = 0; - - -//////////////////////////////////////////////////////////////////////////// -// CMfcControlApp::InitInstance - DLL initialization - -BOOL CMfcControlApp::InitInstance() -{ - BOOL bInit = COleControlModule::InitInstance(); - - if (bInit) - { - // TODO: Add your own module initialization code here. - } - - return bInit; -} - - -//////////////////////////////////////////////////////////////////////////// -// CMfcControlApp::ExitInstance - DLL termination - -int CMfcControlApp::ExitInstance() -{ - // TODO: Add your own module termination code here. - - return COleControlModule::ExitInstance(); -} - - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - AFX_MANAGE_STATE(_afxModuleAddrThis); - - if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) - return ResultFromScode(SELFREG_E_TYPELIB); - - if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) - return ResultFromScode(SELFREG_E_CLASS); - - return NOERROR; -} - - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - AFX_MANAGE_STATE(_afxModuleAddrThis); - - if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) - return ResultFromScode(SELFREG_E_TYPELIB); - - if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) - return ResultFromScode(SELFREG_E_CLASS); - - return NOERROR; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.def b/extensions/test/ole/MfcControl/MfcControl.def deleted file mode 100644 index 8c164a7b5..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.def +++ /dev/null @@ -1,9 +0,0 @@ -; MfcControl.def : Declares the module parameters. - -LIBRARY "MFCCONTROL.OCX" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE diff --git a/extensions/test/ole/MfcControl/MfcControl.dsp b/extensions/test/ole/MfcControl/MfcControl.dsp deleted file mode 100644 index f327a9893..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.dsp +++ /dev/null @@ -1,265 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MfcControl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=MfcControl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "MfcControl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "MfcControl.mak" CFG="MfcControl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "MfcControl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MfcControl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MfcControl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "MfcControl - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MfcControl - Win32 Release" - -# PROP BASE Use_MFC 2 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Ext "ocx" -# PROP BASE Target_Dir "" -# PROP Use_MFC 2 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Ext "ocx" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Registering ActiveX Control... -OutDir=.\Release -TargetPath=.\Release\MfcControl.ocx -InputPath=.\Release\MfcControl.ocx -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MfcControl - Win32 Debug" - -# PROP BASE Use_MFC 2 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Ext "ocx" -# PROP BASE Target_Dir "" -# PROP Use_MFC 2 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Ext "ocx" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Registering ActiveX Control... -OutDir=.\Debug -TargetPath=.\Debug\MfcControl.ocx -InputPath=.\Debug\MfcControl.ocx -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MfcControl - Win32 Unicode Debug" - -# PROP BASE Use_MFC 2 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Target_Ext "ocx" -# PROP BASE Target_Dir "" -# PROP Use_MFC 2 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Target_Ext "ocx" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Registering ActiveX Control... -OutDir=.\DebugU -TargetPath=.\DebugU\MfcControl.ocx -InputPath=.\DebugU\MfcControl.ocx -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "MfcControl - Win32 Unicode Release" - -# PROP BASE Use_MFC 2 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseU" -# PROP BASE Intermediate_Dir "ReleaseU" -# PROP BASE Target_Ext "ocx" -# PROP BASE Target_Dir "" -# PROP Use_MFC 2 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseU" -# PROP Intermediate_Dir "ReleaseU" -# PROP Target_Ext "ocx" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Registering ActiveX Control... -OutDir=.\ReleaseU -TargetPath=.\ReleaseU\MfcControl.ocx -InputPath=.\ReleaseU\MfcControl.ocx -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "MfcControl - Win32 Release" -# Name "MfcControl - Win32 Debug" -# Name "MfcControl - Win32 Unicode Debug" -# Name "MfcControl - Win32 Unicode Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\MfcControl.cpp -# End Source File -# Begin Source File - -SOURCE=.\MfcControl.def -# End Source File -# Begin Source File - -SOURCE=.\MfcControl.odl -# End Source File -# Begin Source File - -SOURCE=.\MfcControl.rc -# End Source File -# Begin Source File - -SOURCE=.\MfcControlCtl.cpp -# End Source File -# Begin Source File - -SOURCE=.\MfcControlPpg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\MfcControl.h -# End Source File -# Begin Source File - -SOURCE=.\MfcControlCtl.h -# End Source File -# Begin Source File - -SOURCE=.\MfcControlPpg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\MfcControlCtl.bmp -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project - diff --git a/extensions/test/ole/MfcControl/MfcControl.h b/extensions/test/ole/MfcControl/MfcControl.h deleted file mode 100644 index 6c6a190b5..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if !defined(AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED_) -#define AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// MfcControl.h : main header file for MFCCONTROL.DLL - -#if !defined( __AFXCTL_H__ ) - #error include 'afxctl.h' before including this file -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlApp : See MfcControl.cpp for implementation. - -class CMfcControlApp : public COleControlModule -{ -public: - BOOL InitInstance(); - int ExitInstance(); -}; - -extern const GUID CDECL _tlid; -extern const WORD _wVerMajor; -extern const WORD _wVerMinor; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MFCCONTROL_H__AC221FBC_A0D8_11D4_833B_005004526AB4__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.odl b/extensions/test/ole/MfcControl/MfcControl.odl deleted file mode 100644 index f00ebe518..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.odl +++ /dev/null @@ -1,82 +0,0 @@ -// MfcControl.odl : type library source for ActiveX Control project. - -// This file will be processed by the Make Type Library (mktyplib) tool to -// produce the type library (MfcControl.tlb) that will become a resource in -// MfcControl.ocx. - -#include -#include - -[ uuid(AC221FB3-A0D8-11D4-833B-005004526AB4), version(1.0), - helpfile("MfcControl.hlp"), - helpstring("MfcControl ActiveX Control module"), - control ] -library MFCCONTROLLib -{ - importlib(STDOLE_TLB); - importlib(STDTYPE_TLB); - - // Primary dispatch interface for CMfcControlCtrl - - [ uuid(AC221FB4-A0D8-11D4-833B-005004526AB4), - helpstring("Dispatch interface for MfcControl Control"), hidden ] - dispinterface _DMfcControl - { - properties: - // NOTE - ClassWizard will maintain property information here. - // Use extreme caution when editing this section. - //{{AFX_ODL_PROP(CMfcControlCtrl) - //}}AFX_ODL_PROP - - methods: - // NOTE - ClassWizard will maintain method information here. - // Use extreme caution when editing this section. - //{{AFX_ODL_METHOD(CMfcControlCtrl) - [id(1)] short inShort(short val); - [id(2)] long inLong(long val); - [id(3)] BSTR inString(BSTR* val); - [id(4)] float inFloat(float val); - [id(5)] double inDouble(double val); - [id(6)] VARIANT inVariant(VARIANT val); - [id(7)] IDispatch* inObject(IDispatch* val); - [id(8)] void outShort([out] short* val); - [id(9)] void outLong([out] long* val); - [id(10)] void outString([out] BSTR* val); - [id(11)] void outFloat([out] float* val); - [id(12)] void outDouble([out] double* val); - [id(13)] void outVariant([out] VARIANT* val); - [id(14)] void outObject([out] IDispatch** val); - //}}AFX_ODL_METHOD - }; - - // Event dispatch interface for CMfcControlCtrl - - [ uuid(AC221FB5-A0D8-11D4-833B-005004526AB4), - helpstring("Event interface for MfcControl Control") ] - dispinterface _DMfcControlEvents - { - properties: - // Event interface has no properties - - methods: - // NOTE - ClassWizard will maintain event information here. - // Use extreme caution when editing this section. - //{{AFX_ODL_EVENT(CMfcControlCtrl) - //}}AFX_ODL_EVENT - }; - - // Class information for CMfcControlCtrl - - [ uuid(AC221FB6-A0D8-11D4-833B-005004526AB4), - helpstring("MfcControl Control"), control ] - coclass MfcControl - { - [default] dispinterface _DMfcControl; - [default, source] dispinterface _DMfcControlEvents; - }; - - - //{{AFX_APPEND_ODL}} - //}}AFX_APPEND_ODL}} -}; -//VT_I2 diff --git a/extensions/test/ole/MfcControl/MfcControl.rc b/extensions/test/ole/MfcControl/MfcControl.rc deleted file mode 100644 index e052b9f26..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.rc +++ /dev/null @@ -1,145 +0,0 @@ -//Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""MfcControl.tlb""\r\n" - "\0" -END - -///////////////////////////////////////////////////////////////////////////// -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Star Office Entwicklungs GmbH\0" - VALUE "FileDescription", "MfcControl ActiveX Control Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "MfcControl\0" - VALUE "LegalCopyright", "Copyright (C) 2000\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "MfcControl.OCX\0" - VALUE "ProductName", "MfcControl ActiveX Control Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -//IDB_MFCCONTROL BITMAP DISCARDABLE "MfcControlCtl.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - - -IDD_PROPPAGE_MFCCONTROL DIALOG DISCARDABLE 0, 0, 250, 62 -STYLE WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - LTEXT "TODO: Place controls to manipulate properties of MfcControl Control on this dialog.", - IDC_STATIC,7,25,229,16 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PROPPAGE_MFCCONTROL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 243 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END -END -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MFCCONTROL "MfcControl Control" - IDS_MFCCONTROL_PPG "MfcControl Property Page" - IDS_MFCCONTROL_PPG_CAPTION "General" - -END - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "MfcControl.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/extensions/test/ole/MfcControl/MfcControl.sln b/extensions/test/ole/MfcControl/MfcControl.sln deleted file mode 100644 index 24e646c86..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.sln +++ /dev/null @@ -1,25 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MfcControl", "MfcControl.vcproj", "{07D59661-3519-4F10-AE9F-22DB0479E25A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release|Win32 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Debug|Win32.ActiveCfg = Debug|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Debug|Win32.Build.0 = Debug|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Release|Win32.ActiveCfg = Release|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Release|Win32.Build.0 = Release|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 - {07D59661-3519-4F10-AE9F-22DB0479E25A}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/MfcControl/MfcControl.vcproj b/extensions/test/ole/MfcControl/MfcControl.vcproj deleted file mode 100644 index 6099d8242..000000000 --- a/extensions/test/ole/MfcControl/MfcControl.vcproj +++ /dev/null @@ -1,581 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.cpp b/extensions/test/ole/MfcControl/MfcControlCtl.cpp deleted file mode 100644 index 399fb5db9..000000000 --- a/extensions/test/ole/MfcControl/MfcControlCtl.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// MfcControlCtl.cpp : Implementation of the CMfcControlCtrl ActiveX Control class. - -#include "stdafx.h" -#include "MfcControl.h" -#include "MfcControlCtl.h" -#include "MfcControlPpg.h" - - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -IMPLEMENT_DYNCREATE(CMfcControlCtrl, COleControl) - - -///////////////////////////////////////////////////////////////////////////// -// Message map - -BEGIN_MESSAGE_MAP(CMfcControlCtrl, COleControl) - //{{AFX_MSG_MAP(CMfcControlCtrl) - // NOTE - ClassWizard will add and remove message map entries - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG_MAP - ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties) -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// Dispatch map - -BEGIN_DISPATCH_MAP(CMfcControlCtrl, COleControl) - //{{AFX_DISPATCH_MAP(CMfcControlCtrl) - DISP_FUNCTION(CMfcControlCtrl, "inShort", inShort, VT_I2, VTS_I2) - DISP_FUNCTION(CMfcControlCtrl, "inLong", inLong, VT_I4, VTS_I4) - DISP_FUNCTION(CMfcControlCtrl, "inString", inString, VT_BSTR, VTS_PBSTR) - DISP_FUNCTION(CMfcControlCtrl, "inFloat", inFloat, VT_R4, VTS_R4) - DISP_FUNCTION(CMfcControlCtrl, "inDouble", inDouble, VT_R8, VTS_R8) - DISP_FUNCTION(CMfcControlCtrl, "inVariant", inVariant, VT_VARIANT, VTS_VARIANT) - DISP_FUNCTION(CMfcControlCtrl, "inObject", inObject, VT_DISPATCH, VTS_DISPATCH) - DISP_FUNCTION(CMfcControlCtrl, "outShort", outShort, VT_EMPTY, VTS_PI2) - DISP_FUNCTION(CMfcControlCtrl, "outLong", outLong, VT_EMPTY, VTS_PI4) - DISP_FUNCTION(CMfcControlCtrl, "outString", outString, VT_EMPTY, VTS_PBSTR) - DISP_FUNCTION(CMfcControlCtrl, "outFloat", outFloat, VT_EMPTY, VTS_PR4) - DISP_FUNCTION(CMfcControlCtrl, "outDouble", outDouble, VT_EMPTY, VTS_PR8) - DISP_FUNCTION(CMfcControlCtrl, "outVariant", outVariant, VT_EMPTY, VTS_PVARIANT) - DISP_FUNCTION(CMfcControlCtrl, "outObject", outObject, VT_EMPTY, VTS_PDISPATCH) - //}}AFX_DISPATCH_MAP -END_DISPATCH_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// Event map - -BEGIN_EVENT_MAP(CMfcControlCtrl, COleControl) - //{{AFX_EVENT_MAP(CMfcControlCtrl) - // NOTE - ClassWizard will add and remove event map entries - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_EVENT_MAP -END_EVENT_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// Property pages - -// TODO: Add more property pages as needed. Remember to increase the count! -BEGIN_PROPPAGEIDS(CMfcControlCtrl, 1) - PROPPAGEID(CMfcControlPropPage::guid) -END_PROPPAGEIDS(CMfcControlCtrl) - - -///////////////////////////////////////////////////////////////////////////// -// Initialize class factory and guid - -IMPLEMENT_OLECREATE_EX(CMfcControlCtrl, "MFCCONTROL.MfcControlCtrl.1", - 0xac221fb6, 0xa0d8, 0x11d4, 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4) - - -///////////////////////////////////////////////////////////////////////////// -// Type library ID and version - -IMPLEMENT_OLETYPELIB(CMfcControlCtrl, _tlid, _wVerMajor, _wVerMinor) - - -///////////////////////////////////////////////////////////////////////////// -// Interface IDs - -const IID BASED_CODE IID_DMfcControl = - { 0xac221fb4, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; -const IID BASED_CODE IID_DMfcControlEvents = - { 0xac221fb5, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; - - -///////////////////////////////////////////////////////////////////////////// -// Control type information - -static const DWORD BASED_CODE _dwMfcControlOleMisc = - OLEMISC_ACTIVATEWHENVISIBLE | - OLEMISC_SETCLIENTSITEFIRST | - OLEMISC_INSIDEOUT | - OLEMISC_CANTLINKINSIDE | - OLEMISC_RECOMPOSEONRESIZE; - -IMPLEMENT_OLECTLTYPE(CMfcControlCtrl, IDS_MFCCONTROL, _dwMfcControlOleMisc) - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::CMfcControlCtrlFactory::UpdateRegistry - -// Adds or removes system registry entries for CMfcControlCtrl - -BOOL CMfcControlCtrl::CMfcControlCtrlFactory::UpdateRegistry(BOOL bRegister) -{ - // TODO: Verify that your control follows apartment-model threading rules. - // Refer to MFC TechNote 64 for more information. - // If your control does not conform to the apartment-model rules, then - // you must modify the code below, changing the 6th parameter from - // afxRegApartmentThreading to 0. - - if (bRegister) - return AfxOleRegisterControlClass( - AfxGetInstanceHandle(), - m_clsid, - m_lpszProgID, - IDS_MFCCONTROL, - IDB_MFCCONTROL, - afxRegApartmentThreading, - _dwMfcControlOleMisc, - _tlid, - _wVerMajor, - _wVerMinor); - else - return AfxOleUnregisterClass(m_clsid, m_lpszProgID); -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::CMfcControlCtrl - Constructor - -CMfcControlCtrl::CMfcControlCtrl() -{ - InitializeIIDs(&IID_DMfcControl, &IID_DMfcControlEvents); - - // TODO: Initialize your control's instance data here. -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::~CMfcControlCtrl - Destructor - -CMfcControlCtrl::~CMfcControlCtrl() -{ - // TODO: Cleanup your control's instance data here. -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::OnDraw - Drawing function - -void CMfcControlCtrl::OnDraw( - CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) -{ - // TODO: Replace the following code with your own drawing code. - pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH))); - pdc->Ellipse(rcBounds); -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::DoPropExchange - Persistence support - -void CMfcControlCtrl::DoPropExchange(CPropExchange* pPX) -{ - ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); - COleControl::DoPropExchange(pPX); - - // TODO: Call PX_ functions for each persistent custom property. - -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl::OnResetState - Reset control to default state - -void CMfcControlCtrl::OnResetState() -{ - COleControl::OnResetState(); // Resets defaults found in DoPropExchange - - // TODO: Reset any other control state here. -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl message handlers - - -short CMfcControlCtrl::inShort(short val) -{ - char buf[256]; - sprintf( buf, "inByte: value= %d", val); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - return val+1; -} - -long CMfcControlCtrl::inLong(long val) -{ - char buf[256]; - sprintf( buf, "inLong: value= %d", val); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - return val+1; -} - -BSTR CMfcControlCtrl::inString(BSTR* val) -{ - CString strResult; - strResult= *val; - char buf[256]; - sprintf( buf, "inString: value= %S", *val); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - strResult += L" an appended string"; - return strResult.AllocSysString(); -} - -float CMfcControlCtrl::inFloat(float val) -{ - char buf[256]; - sprintf( buf, "inFloat: value= %f", val); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - return val+1; -} - -double CMfcControlCtrl::inDouble(double val) -{ - char buf[256]; - sprintf( buf, "inDouble: value= %g", val); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - return val+1; -} - -VARIANT CMfcControlCtrl::inVariant(const VARIANT FAR& val) -{ - VARIANT vaResult; - VariantInit(&vaResult); - VariantCopyInd( &vaResult, const_cast(&val)); - if( vaResult.vt == VT_BSTR) - { - char buf[256]; - sprintf( buf, "inVariant: value= %S", vaResult.bstrVal); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - - } - return _variant_t( L" a string from CMfcControlCtrl::inVariant"); -} - -LPDISPATCH CMfcControlCtrl::inObject(LPDISPATCH val) -{ - char buf[256]; - _bstr_t bstr; - HRESULT hr= S_OK; - COleVariant var; - DISPID id; - OLECHAR* name=L"prpString"; - if( SUCCEEDED(hr= val->GetIDsOfNames( IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &id))) - { - DISPPARAMS params={0,0,0,0}; - hr= val->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, &var,0,0); - - } - - if( var.vt== VT_BSTR) - bstr= var.bstrVal; - sprintf( buf, "inObject: value= %S", (wchar_t*)bstr); - ::MessageBoxA( NULL, buf, "MFCCONTROL.MfcControl", MB_OK); - - return NULL; -} - - -void CMfcControlCtrl::outShort(short* val) -{ - *val= 123; -} - -void CMfcControlCtrl::outLong(long* val) -{ - *val= 1234; -} - -void CMfcControlCtrl::outString(BSTR FAR* val) -{ - *val= SysAllocString(L"A string from CMfcControlCtrl::outString "); -} - -void CMfcControlCtrl::outFloat(float* val) -{ - *val= 3.14f; -} - -void CMfcControlCtrl::outDouble(double* val) -{ - *val= 3.145; -} - -void CMfcControlCtrl::outVariant(VARIANT FAR* val) -{ - VariantInit( val); - val->vt= VT_BSTR; - val->bstrVal= SysAllocString( L"a string in a VARIANT"); -} - -void CMfcControlCtrl::outObject(LPDISPATCH FAR* val) -{ - //{BFE10EBE-8584-11D4-005004526AB4} - HRESULT hr= S_OK; - CLSID clsTestControl; - hr= CLSIDFromProgID( L"AxTestComponents.Basic", &clsTestControl); - - IDispatch* pDisp= NULL; - hr= CoCreateInstance( clsTestControl, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&pDisp); - - if( SUCCEEDED( hr) && val) - { - COleVariant var; - DISPID id; - OLECHAR* name=L"prpString"; - if( SUCCEEDED(hr= pDisp->GetIDsOfNames( IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &id))) - { - COleVariant vaParam1(_T("this is property prpString of AxTestComponents.Basic")); - DISPID dispidPut= DISPID_PROPERTYPUT; - DISPPARAMS params; - params.cArgs= 1; - params.cNamedArgs= 1; - params.rgdispidNamedArgs= &dispidPut; - params.rgvarg= &vaParam1; - - hr= pDisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, ¶ms, &var,0,0); - *val= pDisp; - } - - } - -} -// VT_I1 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.h b/extensions/test/ole/MfcControl/MfcControlCtl.h deleted file mode 100644 index f6d437965..000000000 --- a/extensions/test/ole/MfcControl/MfcControlCtl.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if !defined(AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED_) -#define AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// MfcControlCtl.h : Declaration of the CMfcControlCtrl ActiveX Control class. - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlCtrl : See MfcControlCtl.cpp for implementation. - -class CMfcControlCtrl : public COleControl -{ - DECLARE_DYNCREATE(CMfcControlCtrl) - -// Constructor -public: - CMfcControlCtrl(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CMfcControlCtrl) - public: - virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid); - virtual void DoPropExchange(CPropExchange* pPX); - virtual void OnResetState(); - //}}AFX_VIRTUAL - -// Implementation -protected: - ~CMfcControlCtrl(); - - DECLARE_OLECREATE_EX(CMfcControlCtrl) // Class factory and guid - DECLARE_OLETYPELIB(CMfcControlCtrl) // GetTypeInfo - DECLARE_PROPPAGEIDS(CMfcControlCtrl) // Property page IDs - DECLARE_OLECTLTYPE(CMfcControlCtrl) // Type name and misc status - -// Message maps - //{{AFX_MSG(CMfcControlCtrl) - // NOTE - ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -// Dispatch maps - //{{AFX_DISPATCH(CMfcControlCtrl) - afx_msg short inShort(short val); - afx_msg long inLong(long val); - afx_msg BSTR inString(BSTR* val); - afx_msg float inFloat(float val); - afx_msg double inDouble(double val); - afx_msg VARIANT inVariant(const VARIANT FAR& val); - afx_msg LPDISPATCH inObject(LPDISPATCH val); - afx_msg void outShort(short* val); - afx_msg void outLong(long* val); - afx_msg void outString(BSTR FAR* val); - afx_msg void outFloat(float* val); - afx_msg void outDouble(double* val); - afx_msg void outVariant(VARIANT FAR* val); - afx_msg void outObject(LPDISPATCH FAR* val); - //}}AFX_DISPATCH - DECLARE_DISPATCH_MAP() - -// Event maps - //{{AFX_EVENT(CMfcControlCtrl) - //}}AFX_EVENT - DECLARE_EVENT_MAP() - -// Dispatch and event IDs -public: - enum { - //{{AFX_DISP_ID(CMfcControlCtrl) - dispidInShort = 1L, - dispidInLong = 2L, - dispidInString = 3L, - dispidInFloat = 4L, - dispidInDouble = 5L, - dispidInVariant = 6L, - dispidInObject = 7L, - dispidOutShort = 8L, - dispidOutLong = 9L, - dispidOutString = 10L, - dispidOutFloat = 11L, - dispidOutDouble = 12L, - dispidOutVariant = 13L, - dispidOutObject = 14L, - //}}AFX_DISP_ID - }; -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MFCCONTROLCTL_H__AC221FC3_A0D8_11D4_833B_005004526AB4__INCLUDED) -// BYTE - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlCtl.png b/extensions/test/ole/MfcControl/MfcControlCtl.png deleted file mode 100644 index 77c4758c1..000000000 Binary files a/extensions/test/ole/MfcControl/MfcControlCtl.png and /dev/null differ diff --git a/extensions/test/ole/MfcControl/MfcControlPpg.cpp b/extensions/test/ole/MfcControl/MfcControlPpg.cpp deleted file mode 100644 index 66a098ba0..000000000 --- a/extensions/test/ole/MfcControl/MfcControlPpg.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// MfcControlPpg.cpp : Implementation of the CMfcControlPropPage property page class. - -#include "stdafx.h" -#include "MfcControl.h" -#include "MfcControlPpg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -IMPLEMENT_DYNCREATE(CMfcControlPropPage, COlePropertyPage) - - -///////////////////////////////////////////////////////////////////////////// -// Message map - -BEGIN_MESSAGE_MAP(CMfcControlPropPage, COlePropertyPage) - //{{AFX_MSG_MAP(CMfcControlPropPage) - // NOTE - ClassWizard will add and remove message map entries - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - - -///////////////////////////////////////////////////////////////////////////// -// Initialize class factory and guid - -IMPLEMENT_OLECREATE_EX(CMfcControlPropPage, "MFCCONTROL.MfcControlPropPage.1", - 0xac221fb7, 0xa0d8, 0x11d4, 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4) - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlPropPage::CMfcControlPropPageFactory::UpdateRegistry - -// Adds or removes system registry entries for CMfcControlPropPage - -BOOL CMfcControlPropPage::CMfcControlPropPageFactory::UpdateRegistry(BOOL bRegister) -{ - if (bRegister) - return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(), - m_clsid, IDS_MFCCONTROL_PPG); - else - return AfxOleUnregisterClass(m_clsid, NULL); -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlPropPage::CMfcControlPropPage - Constructor - -CMfcControlPropPage::CMfcControlPropPage() : - COlePropertyPage(IDD, IDS_MFCCONTROL_PPG_CAPTION) -{ - //{{AFX_DATA_INIT(CMfcControlPropPage) - // NOTE: ClassWizard will add member initialization here - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_DATA_INIT -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlPropPage::DoDataExchange - Moves data between page and properties - -void CMfcControlPropPage::DoDataExchange(CDataExchange* pDX) -{ - //{{AFX_DATA_MAP(CMfcControlPropPage) - // NOTE: ClassWizard will add DDP, DDX, and DDV calls here - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_DATA_MAP - DDP_PostProcessing(pDX); -} - - -///////////////////////////////////////////////////////////////////////////// -// CMfcControlPropPage message handlers - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControlPpg.h b/extensions/test/ole/MfcControl/MfcControlPpg.h deleted file mode 100644 index 33f564c52..000000000 --- a/extensions/test/ole/MfcControl/MfcControlPpg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if !defined(AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED_) -#define AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// MfcControlPpg.h : Declaration of the CMfcControlPropPage property page class. - -//////////////////////////////////////////////////////////////////////////// -// CMfcControlPropPage : See MfcControlPpg.cpp.cpp for implementation. - -class CMfcControlPropPage : public COlePropertyPage -{ - DECLARE_DYNCREATE(CMfcControlPropPage) - DECLARE_OLECREATE_EX(CMfcControlPropPage) - -// Constructor -public: - CMfcControlPropPage(); - -// Dialog Data - //{{AFX_DATA(CMfcControlPropPage) - enum { IDD = IDD_PROPPAGE_MFCCONTROL }; - // NOTE - ClassWizard will add data members here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_DATA - -// Implementation -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - -// Message maps -protected: - //{{AFX_MSG(CMfcControlPropPage) - // NOTE - ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() - -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_MFCCONTROLPPG_H__AC221FC5_A0D8_11D4_833B_005004526AB4__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/Resource.h b/extensions/test/ole/MfcControl/Resource.h deleted file mode 100644 index 9cd92613f..000000000 --- a/extensions/test/ole/MfcControl/Resource.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by MfcControl.rc -// - -#define IDS_MFCCONTROL 1 -#define IDS_MFCCONTROL_PPG 2 - -#define IDS_MFCCONTROL_PPG_CAPTION 200 - -#define IDD_PROPPAGE_MFCCONTROL 200 - - -#define IDB_MFCCONTROL 1 - - -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 32768 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/StdAfx.cpp b/extensions/test/ole/MfcControl/StdAfx.cpp deleted file mode 100644 index b45da9a8e..000000000 --- a/extensions/test/ole/MfcControl/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/StdAfx.h b/extensions/test/ole/MfcControl/StdAfx.h deleted file mode 100644 index 4df599c41..000000000 --- a/extensions/test/ole/MfcControl/StdAfx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#if !defined(AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_) -#define AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC support for ActiveX Controls -#include // MFC extensions -#include // MFC support for Internet Explorer 4 Comon Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -// Delete the two includes below if you do not wish to use the MFC -// database classes -#include // MFC database classes -#include // MFC DAO database classes - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#include -#endif // !defined(AFX_STDAFX_H__AC221FBA_A0D8_11D4_833B_005004526AB4__INCLUDED_) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleClient/OleClient.ini b/extensions/test/ole/OleClient/OleClient.ini deleted file mode 100644 index fa1ac118f..000000000 --- a/extensions/test/ole/OleClient/OleClient.ini +++ /dev/null @@ -1,5 +0,0 @@ -[Bootstrap] -UNO_TYPES=types.rdb -UNO_SERVICES=services.rdb - - diff --git a/extensions/test/ole/OleClient/axhost.cxx b/extensions/test/ole/OleClient/axhost.cxx deleted file mode 100644 index 93d5721b3..000000000 --- a/extensions/test/ole/OleClient/axhost.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - - -#include "axhost.hxx" - -HostWin::HostWin(LPWSTR progid) -{ - controlName= progid; - RECT rcPos={0,0,200,200}; - Create(0, rcPos, _T("HostWin")); -} -HostWin::~HostWin() -{ - DestroyWindow(); -} - - -LRESULT HostWin::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) -{ - CAxWindow wnd(m_hWnd); - - HRESULT hr= wnd.CreateControlEx( controlName, NULL, NULL,&spControl.p); - - return 0; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleClient/axhost.hxx b/extensions/test/ole/OleClient/axhost.hxx deleted file mode 100644 index 88b870f84..000000000 --- a/extensions/test/ole/OleClient/axhost.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __AXHOST_HXX -#define __AXHOST_HXX - -#include -extern CComModule _Module; -#include -#include - - -class HostWin: public CWindowImpl > -{ - CComBSTR controlName; - CComPtr spControl; -public: - HostWin(LPWSTR progid); - - ~HostWin(); - - - BEGIN_MSG_MAP(HostWin) - MESSAGE_HANDLER( WM_CREATE, OnCreate) - END_MSG_MAP() - - IUnknown* GetHostedControl(){ - return spControl; - } - - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); -}; -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx deleted file mode 100644 index 8277bd89d..000000000 --- a/extensions/test/ole/OleClient/clientTest.cxx +++ /dev/null @@ -1,1319 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include - -CComModule _Module; -#include -#include - -#include "axhost.hxx" - -#include -#include "typelib/typedescription.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) -BEGIN_OBJECT_MAP(ObjectMap) -END_OBJECT_MAP() - -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::script; -using namespace com::sun::star::bridge::oleautomation; -using namespace cppu; - -using ::rtl::OUString; - -Reference convertComObject( IUnknown* pUnk); -Reference getComObject( OUString progId); -bool checkOutArgs(const Sequence & outArgs, - const Sequence & indices, const Sequence & values); - -bool doSimpleTest(const Reference & inv); -bool doSimpleSequenceTest(const Reference & inv); -bool doParameterTest(const Reference & inv); -bool doPropertyWithArgumentTest(const Reference & inv); -bool equalSequences(const Any& orig, const Any& returned); -HRESULT doTest(); -HRESULT doTest2( Reference &); -Reference getComObject(OUString& ); - -HRESULT InitializeParameter(); -void printResultVariantArray( VARIANT & var); -void printVariant( VARIANT & var); -void printSequence( Sequence& val); - -extern "C" int SAL_CALL main( int , char **) -{ - HRESULT hr; - if( FAILED( hr=CoInitialize(NULL))) - { - _tprintf(_T("CoInitialize failed \n")); - return -1; - } - - - _Module.Init( ObjectMap, GetModuleHandle( NULL)); - - if( FAILED(hr=doTest())) - { - _com_error err( hr); - const TCHAR * errMsg= err.ErrorMessage(); - MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR); - } - else - { - MessageBox( NULL,NULL , "Test succeeded", MB_ICONINFORMATION); - } - - - _Module.Term(); - CoUninitialize(); - return 0; -} -//Also supports named args - -bool doParameterTest(const Reference & inv) -{ - Sequence< sal_Int16> seqIndices; - Sequence seqOut; - - Any arArgs[2]; - Any arValue[2]; - Any arArgs1[4]; - - NamedArgument arg1(OUString(L"val1"), makeAny((sal_Int32) 123)); - NamedArgument arg2(OUString(L"val2"), makeAny((sal_Int32) 456)); - NamedArgument arg3(OUString(L"val3"), makeAny((sal_Int32) 0xff)); - NamedArgument arg4(OUString(L"val4"), makeAny((sal_Int32) 0xffff)); - - NamedArgument argOut1(OUString(L"val1"), Any()); - NamedArgument argOut2(OUString(L"val2"), Any()); - Sequence seqNoArgs; - arArgs[0] <<= (sal_Int32) 0; - arArgs[1] <<= (sal_Int32) 0; - Sequence seqPositional0(arArgs, 2); - - - arArgs[0] <<= arg1; - arArgs[1] <<= arg2; - Sequence seqNamed(arArgs, 2); - arArgs[0] <<= arg2; - arArgs[1] <<= arg1; - Sequence seqNamed2(arArgs, 2); - arArgs[0] <<= argOut1; - arArgs[1] <<= argOut2; - Sequence seqNamed3(arArgs, 2); - arArgs[0] <<= argOut2; - arArgs[1] <<= argOut1; - Sequence seqNamed4(arArgs, 2); - - arArgs[0] <<= arg1; - Sequence seqNamed5(arArgs, 1); - arArgs[0] <<= arg2; - Sequence seqNamed6(arArgs, 1); - - arArgs[0] <<= (sal_Int32) 123; - arArgs[1] <<= (sal_Int32) 456; - Sequence seqPositional(arArgs, 2); - arArgs[0] <<= (sal_Int32) 123; - Sequence seqPositional2(arArgs, 1); - - arArgs[0] <<= Any(); - arArgs[1] <<= Any(); - Sequence seqPositional3(arArgs, 2); - - arArgs[0] <<= (sal_Int32) 123; - arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND); - Sequence seqOutOpt1(arArgs, 2); - - arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND); - arArgs[1] <<= SCode(DISP_E_PARAMNOTFOUND); - Sequence seqOutOpt2(arArgs, 2); - - arArgs[0] <<= SCode(DISP_E_PARAMNOTFOUND); - arArgs[1] <<= (sal_Int32) 456; - Sequence seqOutOpt3(arArgs, 2); - - arArgs1[0] <<= (sal_Int32) 0; - arArgs1[1] <<= (sal_Int32) 0; - arArgs1[2] <<= (sal_Int32) 0; - arArgs1[3] <<= (sal_Int32) 0; - Sequence seqMix0(arArgs1, 4); - - arArgs1[0] <<= (sal_Int32) 123; - arArgs1[1] <<= (sal_Int32) 456; - arArgs1[2] <<= arg3; - arArgs1[3] <<= arg4; - Sequence seqMix(arArgs1, 4); - - arArgs1[0] <<= Any(); - arArgs1[1] <<= (sal_Int32) 456; - arArgs1[2] <<= arg4; - Sequence seqMix2(arArgs1, 3); - - arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND); - arArgs1[1] <<= (sal_Int32) 456; - arArgs1[2] <<= SCode(DISP_E_PARAMNOTFOUND); - arArgs1[3] <<= arg4.Value; - Sequence seqMixOut(arArgs1, 4); - - arArgs1[0] <<= SCode(DISP_E_PARAMNOTFOUND); - arArgs1[1] <<= Any(); - arArgs1[2] <<= arg4; - Sequence seqMix2Out(arArgs1, 3); - - - - //in args + out, optional, positional----------------------------------------- - //first general test - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqPositional)) - return false; - - //2 optional args, 1 provided - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional2, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1)) - return false; - - //2 optional args, 0 provided - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNoArgs, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional3, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt2)) - return false; - - //named args -------------------------------------------- - - // 2 named args, correct position - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional0, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqPositional)) - return false; - - // 2named args, position differs - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed2, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqPositional)) - return false; - - //named out args, 2 named args with correct position - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut); - seqIndices.realloc(0); - seqIndices.realloc(0); - inv->invoke(OUString(L"optional5"), seqNamed3, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqNamed )) - return false; - - //named out args, 2 named args with different position - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed, seqIndices, seqOut); - seqIndices.realloc(0); - seqIndices.realloc(0); - inv->invoke(OUString(L"optional5"), seqNamed4, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqNamed2 )) - return false; - - - //2 args, 1 provided (correct order) - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed5, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt1)) - return false; - //2 args, 1 provided (incorrect order) - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqPositional0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional3"), seqNamed6, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional5"), seqPositional, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqOutOpt3)) - return false; - - //2position + 2 2named args, correct order - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional6"), seqMix, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional7"), seqMix, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqMix)) - return false; - - // 4 in args, 1 positional, 1 named, 1 positional omitted - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional6"), seqMix0, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional7"), seqMix0, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqMixOut)) - return false; - - // 4 out args, 1 positional, 1 named, 1 positional omitted - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional6"), seqMix2, seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"optional7"), seqMix2Out, seqIndices, seqOut); - if ( ! checkOutArgs(seqOut, seqIndices, seqMix2Out)) - return false; - - - return true; -} -bool doPropertyTest(const Reference & inv) -{ - Sequence< sal_Int16> seqIndices; - Sequence seqOut; - - Any inBool, outBool; - Any inByte, outByte; - Any inShort, outShort; - Any inLong, outLong; - Any inString, outString; - Any inFloat, outFloat; - Any inDouble, outDouble; - Any inVariant, outVariant; - Any inObject, outObject; - Any inUnknown, outUnknown; - Any inCY, outCY; - Any inDate, outDate; - Any inDecimal, outDecimal; - Any inSCode, outSCode; - Any inrefLong, outrefLong; - Any inrefVariant, outrefVariant; - Any inrefDecimal, outrefDecimal; - Any inParamsLong, outParamsLong; - Reference xintUnknown(getComObject(L"AxTestComponents.Foo")); - - inBool <<= (sal_Bool) sal_True; - inv->setValue(OUString(L"prpBool"), inBool); - outBool = inv->getValue(OUString(L"prpBool")); - - inByte <<= (sal_Int8) 100; - inv->setValue(OUString(L"prpByte"), inByte); - outByte = inv->getValue(OUString(L"prpByte")); - - inShort <<= static_cast( -1); - inv->setValue(OUString(L"prpShort"), inShort); - outShort = inv->getValue(OUString(L"prpShort")); - - inLong <<= ( sal_Int32) 1234567; - inv->setValue(OUString(L"prpLong"), inLong // TODO: Add your implementation code here -); - outLong = inv->getValue(OUString(L"prpLong")); - - inString <<= OUString(L" this is clientTest.exe"); - inv->setValue(OUString(L"prpString"), inString); - outString = inv->getValue(OUString(L"prpString")); - - inFloat <<= 3.14f; - inv->setValue(OUString(L"prpFloat"), inFloat); - outFloat = inv->getValue(OUString(L"prpFloat")); - - inDouble <<= ( double) 3.145; - inv->setValue(OUString(L"prpDouble"), inDouble); - outDouble = inv->getValue(OUString(L"prpDouble")); - - inVariant <<= OUString(L"A string in an any"); - inv->setValue(OUString(L"prpVariant"), inVariant); - outVariant = inv->getValue(OUString(L"prpVariant")); - - inObject <<= inv; - inv->setValue(OUString(L"prpObject"), inObject); - outObject = inv->getValue(OUString(L"prpObject")); - - inUnknown <<= xintUnknown; - inv->setValue(OUString(L"prpUnknown"), inUnknown); - outUnknown = inv->getValue(OUString(L"prpUnknown")); - - Currency cur(99999); - inCY <<= cur; - inv->setValue(OUString(L"prpCurrency"), inCY); - outCY = inv->getValue(OUString(L"prpCurrency")); - - Date d(37889.0); - inDate <<= d; - inv->setValue(OUString(L"prpDate"), inDate); - outDate = inv->getValue(OUString(L"prpDate")); - - Decimal dec(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff); - inDecimal <<= dec; - inv->setValue(OUString(L"prpDecimal"), inDecimal); - outDecimal = inv->getValue(OUString(L"prpDecimal")); - - SCode code(DISP_E_BADVARTYPE); - inSCode <<= code; - inv->setValue(OUString(L"prpSCode"), inSCode); - outSCode = inv->getValue(OUString(L"prpSCode")); - - inrefLong <<= (sal_Int32) 123456; - inv->setValue(OUString(L"prprefLong"), inrefLong); - outrefLong = inv->getValue(OUString(L"prprefLong")); - - inrefVariant <<= OUString(L"A string in an any"); - inv->setValue(OUString(L"prprefVariant"), inrefVariant); - outrefVariant = inv->getValue(OUString(L"prprefVariant")); - - Decimal decref(20, 0, 0xffffffff, 0xffffffff, 0x0fffffff); - inrefDecimal <<= decref; - inv->setValue(OUString(L"prprefDecimal"), inrefDecimal); - outrefDecimal = inv->getValue(OUString(L"prprefDecimal")); - - if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong - || inFloat != outFloat || inDouble != outDouble || inString != outString - || inVariant != outVariant || inObject != outObject - || inUnknown != outUnknown || inCY != outCY - || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode - || inrefLong != outrefLong ||inrefVariant != outrefVariant - || inrefDecimal != outrefDecimal) - return false; - return true; -} - -bool doPropertyWithArgumentTest(const Reference & inv) -{ - Sequence< sal_Int16> seqIndices; - Sequence seqOut; - - Any arMultiArgs[3]; - arMultiArgs[0] <<= makeAny((sal_Int32) 0); - arMultiArgs[1] <<= makeAny((sal_Int32) 0); - arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 0)); - Sequence seqMultiArgPut0(arMultiArgs, 3); - - arMultiArgs[0] <<= makeAny((sal_Int32) 1); - arMultiArgs[1] <<= makeAny((sal_Int32) 2); - arMultiArgs[2] <<= PropertyPutArgument(makeAny((sal_Int32) 3)); - Sequence seqMultiArgPut1(arMultiArgs, 3); - - arMultiArgs[0] <<= makeAny((sal_Int32) 1); - arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3)); - Sequence seqMultiArgPut2(arMultiArgs, 2); - - arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1)); - arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 3)); - Sequence seqMultiArgPut3(arMultiArgs, 2); - - arMultiArgs[0] <<= NamedArgument(OUString(L"val2"), makeAny((sal_Int32) 1)); - arMultiArgs[1] <<= NamedArgument(OUString(L"val3"), makeAny((sal_Int32) 3)); - Sequence seqMultiArgPut4(arMultiArgs, 2); - - arMultiArgs[0] <<= makeAny((sal_Int32) 0); - arMultiArgs[1] <<= makeAny((sal_Int32) 0); - Sequence seqMultiArgGet0(arMultiArgs, 2); - - arMultiArgs[0] <<= makeAny((sal_Int32) 1); - arMultiArgs[1] <<= makeAny((sal_Int32) 2); - Sequence seqMultiArgGet1(arMultiArgs, 2); - Sequence seqMultiArgGet2(arMultiArgs, 1); - - - arMultiArgs[0] <<= makeAny((sal_Int32) 0); - arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 0)); - Sequence seqMultiArgPut5(arMultiArgs, 2); - - arMultiArgs[0] <<= makeAny((sal_Int32) 1); - arMultiArgs[1] <<= PropertyPutArgument(makeAny((sal_Int32) 2)); - Sequence seqMultiArgPut6(arMultiArgs, 2); - - arMultiArgs[0] <<= Any(); - arMultiArgs[1] <<= Any(); - Sequence seqMultiVoid(arMultiArgs, 2); - - arMultiArgs[0] = makeAny((sal_Int32) 0); - arMultiArgs[1] = makeAny((sal_Int32) 0); - Sequence seqMultiVoid2(arMultiArgs, 2); - - //[propput, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [in] VARIANT* newVal); - //[propget, ...] HRESULT prpMultiArg1([in,out,optional] VARIANT* val1, [in,out,optional] VARIANT* val2, [out, optional, retval] VARIANT* pVal); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut1, seqIndices, seqOut); - //check in/out args - seqIndices.realloc( 0); - seqOut.realloc(0); - Any anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0, - seqIndices, seqOut); - - if (anyRet != ((PropertyPutArgument const *)seqMultiArgPut1[2].getValue())->Value - || ! checkOutArgs(seqOut, seqIndices, Sequence(seqMultiArgPut1.getArray(), 2))) - { - return false; - } - // test optional (one arg omitted - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut2, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0, - seqIndices, seqOut); - - arMultiArgs[0] = makeAny((sal_Int32) 1); - arMultiArgs[1] = makeAny((SCode(DISP_E_PARAMNOTFOUND))); - - if (anyRet != ((PropertyPutArgument const *) seqMultiArgPut2[1].getValue())->Value - || ! checkOutArgs(seqOut, seqIndices, Sequence(arMultiArgs, 2))) - { - return false; - } - - //test one named arg and one omitted - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut0, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgPut3, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - anyRet = inv->invoke(OUString(L"prpMultiArg1"), seqMultiArgGet0, - seqIndices, seqOut); - - arMultiArgs[0] = makeAny((SCode(DISP_E_PARAMNOTFOUND))); - arMultiArgs[1] = ((NamedArgument const*) seqMultiArgPut3[0].getValue())->Value; - if (anyRet != ((PropertyPutArgument const*) seqMultiArgPut3[1].getValue())->Value - || ! checkOutArgs(seqOut, seqIndices, Sequence(arMultiArgs, 2))) - { - return false; - } - -// [propget,...] HRESULT prpMultiArg2([in] VARIANT val1, [out, retval] VARIANT* pVal); -// [propput,...] HRESULT prpMultiArg2([in] VARIANT val1, [in] VARIANT newVal); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut5, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid, seqIndices, seqOut); - - if ( ! checkOutArgs(seqOut, seqIndices, seqMultiVoid2)) - return false; - seqIndices.realloc( 0); - seqOut.realloc(0); - anyRet = inv->invoke(OUString(L"prpMultiArg2"), seqMultiArgPut6, - seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - anyRet = inv->invoke(OUString(L"prpMultiArg2GetValues"), seqMultiVoid, - seqIndices, seqOut); - -// [propget,...] HRESULT prpMultiArg3([in,out] LONG* val1, [out, retval] LONG* pVal); -// [propput,...] HRESULT prpMultiArg3([in,out] LONG* val1, [in] LONG newVal); - - if ( ! checkOutArgs(seqOut, seqIndices, seqMultiArgGet1 )) - return false; - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut5, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgPut6, seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - anyRet = inv->invoke(OUString(L"prpMultiArg3"), seqMultiArgGet2, seqIndices, seqOut); - - if ( anyRet != ((PropertyPutArgument const*) seqMultiArgPut6[1].getValue())->Value - || !checkOutArgs(seqOut, seqIndices, seqMultiArgGet2)) - return false; - - - //hasProperty, hasMethod - if (inv->hasProperty(OUSTR("prpMultiArg1"))) - return false; - if ( ! inv->hasMethod(OUSTR("prpMultiArg1"))) - return false; - if ( ! inv->hasProperty(OUSTR("prprefLong"))) - return false; - if (inv->hasMethod(OUSTR("prprefLong"))) - return false; - if ( ! inv->hasMethod(OUSTR("inLong"))) - return false; - - return true; -} -bool doSimpleTest(const Reference & inv) -{ - Sequence< sal_Int16> seqIndices; - Sequence seqOut; - - Any inBool, outBool; - Any inByte, outByte; - Any inShort, outShort; - Any inLong, outLong; - Any inString, outString; - Any inFloat, outFloat; - Any inDouble, outDouble; - Any inVariant, outVariant; - Any inObject, outObject; - Any inUnknown, outUnknown; - Any inCY, outCY; - Any inDate, outDate; - Any inDecimal, outDecimal; - Any inSCode, outSCode; - Any inrefLong, outrefLong; - Any inrefVariant, outrefVariant; - Any inrefDecimal, outrefDecimal; - - Reference xIntFoo(getComObject(L"AxTestComponents.Foo")); - //################################################################################### - // in and out parameter - //################################################################################### - sal_Bool aBool = sal_True; - inBool.setValue(&aBool, getCppuBooleanType()); - inv->invoke(OUString(L"inBool"), Sequence< Any > ( &inBool, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outBool"), Sequence< Any > ( & outBool, 1), seqIndices, seqOut); - outBool <<= seqOut[0]; - - inByte <<= (sal_Int8) 127; - inv->invoke(OUString(L"inByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outByte"), Sequence< Any > ( & outByte, 1), seqIndices, seqOut); - outByte <<= seqOut[0]; - - inShort <<= static_cast(-1); - inv->invoke(OUString(L"inShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outShort"), Sequence< Any > ( & outShort, 1), seqIndices, seqOut); - outShort <<= seqOut[0]; - - inLong <<= ( sal_Int32) 1234567; - inv->invoke(OUString(L"inLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outLong"), Sequence< Any > ( & outLong, 1 ), seqIndices, seqOut); - outLong <<= seqOut[0]; - - inString <<= OUString(L" this is clientTest.exe"); - inv->invoke(OUString(L"inString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outString"), Sequence< Any > ( & outString, 1 ), seqIndices, seqOut); - outString <<= seqOut[0]; - - inFloat <<= 3.14f; - inv->invoke(OUString(L"inFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outFloat"), Sequence< Any > ( & outFloat, 1 ), seqIndices, seqOut); - outFloat <<= seqOut[0]; - - inDouble <<= ( double) 3.145; - inv->invoke(OUString(L"inDouble"), Sequence< Any > ( & inDouble, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outDouble"), Sequence< Any > ( & outDouble, 1 ), seqIndices, seqOut); - outDouble <<= seqOut[0]; - - inVariant <<= OUString(L" A string in an any"); - inv->invoke(OUString(L"inVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outVariant, 1), seqIndices, seqOut); - outVariant <<= seqOut[0]; - - inObject <<= inv; - inv->invoke(OUString(L"inObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outObject"), Sequence< Any > (& outObject, 1), seqIndices, seqOut); - outObject <<= seqOut[0]; - - inUnknown <<= xIntFoo; - inv->invoke(OUString(L"inUnknown"), Sequence< Any > ( & inUnknown, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outUnknown"), Sequence< Any > (& outUnknown, 1), seqIndices, seqOut); - outUnknown <<= seqOut[0]; - - Currency cur(999999); - inCY <<= cur; - inv->invoke(OUString(L"inCurrency"), Sequence( & inCY, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outCurrency"), Sequence< Any > (& outCY, 1), seqIndices, seqOut); - outCY <<= seqOut[0]; - - Date dDate(37889.0); - inDate <<= dDate; - inv->invoke(OUString(L"inDate"), Sequence( & inDate, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outDate"), Sequence< Any > (& outDate, 1), seqIndices, seqOut); - outDate <<= seqOut[0]; - - Decimal dec(3, 0, 0xffffffff, 0xffffffff, 0xfffffff0); - inDecimal <<= dec; - inv->invoke(OUString(L"inDecimal"), Sequence( & inDecimal, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outDecimal"), Sequence< Any > (& outDecimal, 1), seqIndices, seqOut); - outDecimal <<= seqOut[0]; - - SCode code(DISP_E_BADVARTYPE); - inSCode <<= code; - inv->invoke(OUString(L"inSCode"), Sequence( & inSCode, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSCode"), Sequence< Any > (& outSCode, 1), seqIndices, seqOut); - outSCode <<= seqOut[0]; - - if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong - || inFloat != outFloat || inDouble != outDouble || inString != outString - || inVariant != outVariant || inObject != outObject || inUnknown != outUnknown - || inCY != outCY - || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode) - return false; - //################################################################################### - // in/out parameter - //################################################################################### - outBool = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutBool"), Sequence< Any > ( & inBool, 1), seqIndices, seqOut); - outBool <<= seqOut[0]; - - outByte = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutByte"), Sequence< Any > ( & inByte, 1), seqIndices, seqOut); - outByte <<= seqOut[0]; - - outShort = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutShort"), Sequence< Any > ( & inShort, 1), seqIndices, seqOut); - outShort <<= seqOut[0]; - - outLong = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutLong"), Sequence< Any > ( & inLong, 1), seqIndices, seqOut); - outLong <<= seqOut[0]; - - outString = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutString"), Sequence< Any > ( & inString, 1), seqIndices, seqOut); - outString <<= seqOut[0]; - - outFloat = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutFloat"), Sequence< Any > ( & inFloat, 1), seqIndices, seqOut); - outFloat <<= seqOut[0]; - - outDouble = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutDouble"), Sequence< Any > ( &inDouble, 1), seqIndices, seqOut); - outDouble <<= seqOut[0]; - - outVariant = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutVariant"), Sequence< Any > ( & inVariant, 1), seqIndices, seqOut); - outVariant <<= seqOut[0]; - - outObject = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutObject"), Sequence< Any > ( & inObject, 1), seqIndices, seqOut); - outObject <<= seqOut[0]; - - outCY = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutCurrency"), Sequence< Any > ( & inCY, 1), seqIndices, seqOut); - outCY <<= seqOut[0]; - - outDate = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutDate"), Sequence< Any > ( & inDate, 1), seqIndices, seqOut); - outDate <<= seqOut[0]; - - outDecimal = Any(); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutDecimal"), Sequence< Any > (& inDecimal, 1), seqIndices, seqOut); - outDecimal <<= seqOut[0]; - - outSCode = Any(); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutSCode"), Sequence< Any > (& inSCode, 1), seqIndices, seqOut); - outSCode <<= seqOut[0]; - - if (inBool != outBool || inByte != outByte || inShort != outShort || inLong != outLong - || inFloat != outFloat || inDouble != outDouble || inString != outString - || inVariant != outVariant || inObject != outObject || inCY != outCY - || inDate != outDate || inDecimal != outDecimal || inSCode != outSCode) - return false; - - //################################################################################### - // in byref parameters - //################################################################################### - - inrefLong <<= (sal_Int32) 1234; - inv->invoke(OUString(L"inrefLong"), Sequence( & inrefLong, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outLong"), Sequence< Any > (& outrefLong, 1), seqIndices, seqOut); - outrefLong <<= seqOut[0]; - - inrefVariant <<= OUString(L" A string in an any"); - inv->invoke(OUString(L"inrefVariant"), Sequence< Any > ( & inrefVariant, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outVariant"), Sequence< Any > (&outrefVariant, 1), seqIndices, seqOut); - outrefVariant <<= seqOut[0]; - - Decimal refdec(5, 1, 0xffff, 0xff, 0x1); - inrefDecimal <<= refdec; - inv->invoke(OUString(L"inrefDecimal"), Sequence< Any > ( & inrefDecimal, 1), seqIndices, seqOut); - seqIndices.realloc( 0); - seqOut.realloc(0); - inv->invoke(OUString(L"outDecimal"), Sequence< Any > (&outrefDecimal, 1), seqIndices, seqOut); - outrefDecimal <<= seqOut[0]; - - if (inrefLong != outrefLong || inrefVariant != outrefVariant - || inrefDecimal != outrefDecimal) - return false; - - - //################################################################################### - // mixed parameter - //################################################################################### - // mixed1 - seqIndices.realloc( 0); - seqOut.realloc(0); - Any param[3]; - param[0] = inByte; - param[1] = inFloat; - param[2] = inVariant; - inv->invoke(OUString(L"mixed1"), Sequence< Any >(param, 3), seqIndices, seqOut); - - if (seqOut.getLength() != 3 || inByte != seqOut[0] || inFloat != seqOut[1] - || inVariant != seqOut[2]) - return false; - return true; -} - -bool doSimpleSequenceTest(const Reference & inv) -{ - bool ret = true; - Sequence seqIndices; - Sequence seqOut; - Any voidAny; - Any inArAny; - Any outArray; - Any inArBool, outArBool; - Any inArByte, outArByte; - Any inArShort, outArShort; - Any inArLong, outArLong; - Any inArString, outArString; - Any inArFloat, outArFloat; - Any inArDouble, outArDouble; - Any inArObject, outArObject; - Any outVariant; - - //Initialize arrays - OUString arStr[]= {L"string0", L"string1", L"string2"}; - Sequence seq( arStr, 3); - inArString <<= seq; - - Any arAnyStrTmp[3]; - arAnyStrTmp[0]<<= arStr[0]; - arAnyStrTmp[1]<<= arStr[1]; - arAnyStrTmp[2]<<= arStr[2]; - Sequence seq_1( arAnyStrTmp, 3); - inArAny <<= seq_1; - //################################################################################### - // in, out Sequences - //################################################################################### - //Test sequence containing Anys of Strings - inv->invoke(OUString(L"inArray"), Sequence< Any > ( & inArAny, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outArray"), Sequence( & voidAny, 1), seqIndices, seqOut); - if (inArAny != seqOut[0]) - return false; - - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"inArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut); - inv->invoke(OUString(L"outArray"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArray <<= seqOut[0]; - - sal_Int8 arByte[]={1,2,3}; - Sequence seqByte(arByte, 3); - inArByte <<= seqByte; - inv->invoke(OUString(L"inSequenceByte"),Sequence( & inArByte, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceByte"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArByte <<= seqOut[0]; - - sal_Int16 arShort[]={4,5,6}; - Sequence seqShort(arShort, 3); - inArShort<<= seqShort; - inv->invoke(OUString(L"inSequenceShort"),Sequence< Any >( & inArShort, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceShort"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArShort <<= seqOut[0]; - - sal_Int32 arLong[] = {7,8,9}; - Sequence seqLong(arLong, 3); - inArLong <<= seqLong; - inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArLong <<= seqOut[0]; - - inv->invoke(OUString(L"inSequenceLong"),Sequence< Any > ( & inArLong, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceLong"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArLong <<= seqOut[0]; - - inv->invoke( OUString(L"inSequenceString"),Sequence< Any > ( & inArString, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceString"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArString <<= seqOut[0]; - - float arFloat[]={3.14f, 31.4f, 314.f}; - Sequence seqFloat( arFloat, 3); - inArFloat <<= seqFloat; - inv->invoke( OUString(L"inSequenceFloat"),Sequence< Any > ( & inArFloat, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceFloat"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArFloat <<= seqOut[0]; - - double arDouble[]={3.145, 31.45, 3145.}; - Sequence seqDouble( arDouble, 3); - inArDouble <<= seqDouble; - inv->invoke(OUString(L"inSequenceDouble"),Sequence< Any >( & inArDouble, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceDouble"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArDouble <<= seqOut[0]; - - Sequence > seqObj(2); - seqObj[0]= getComObject(L"AxTestComponents.Basic"); - seqObj[1]= getComObject(L"AxTestComponents.Basic"); - inArObject <<= seqObj; - inv->invoke(OUString(L"inSequenceObject"),Sequence< Any >( & inArObject, 1), seqIndices, seqOut); - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"outSequenceObject"), Sequence< Any >( & voidAny, 1), seqIndices, seqOut); - outArObject <<= seqOut[0]; - - if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort) - || ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray) - || ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble) - || ! equalSequences(inArString, outArString) || ! equalSequences(inArObject, outArObject)) - return false; - - //################################################################################### - // in/out Sequences - //################################################################################### - seqIndices.realloc(0); - seqOut.realloc(0); - inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutArray"), Sequence< Any >( & inArString, 1), seqIndices, seqOut); - outArray <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceByte"), Sequence( & inArByte, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceByte"), Sequence( & inArByte, 1), seqIndices, seqOut); - outArByte <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceShort"), Sequence( & inArShort, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceShort"), Sequence( & inArShort, 1), seqIndices, seqOut); - outArShort <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceLong"), Sequence( & inArLong, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceLong"), Sequence< Any >( & inArLong, 1), seqIndices, seqOut); - outArLong <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceString"), Sequence( & inArString, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceString"), Sequence( & inArString, 1), seqIndices, seqOut); - outArString <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceFloat"), Sequence( & inArFloat, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceFloat"), Sequence( & inArFloat, 1), seqIndices, seqOut); - outArFloat <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceDouble"), Sequence( & inArDouble, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceDouble"), Sequence( & inArDouble, 1), seqIndices, seqOut); - outArDouble <<= seqOut[0]; - - inv->invoke(OUString(L"inoutSequenceObject"), Sequence( & inArObject, 1), seqIndices, seqOut); - inv->invoke(OUString(L"inoutSequenceObject"), Sequence( & inArObject, 1), seqIndices, seqOut); - outArObject <<= seqOut[0]; - - if ( ! equalSequences(inArByte, outArByte) || ! equalSequences(inArShort, outArShort) - || ! equalSequences(inArLong, outArLong) || ! equalSequences(inArString, outArray) - || ! equalSequences(inArFloat, outArFloat) || ! equalSequences(inArDouble, outArDouble) - || ! equalSequences(inArString, outArString) || ! equalSequences(inArObject, outArObject)) - return false; - - return ret; -} - -HRESULT doTest() -{ - HRESULT hr= S_OK; - USES_CONVERSION; - Reference inv= getComObject( L"AxTestComponents.Basic"); - - HostWin* pWin= new HostWin( L"MFCCONTROL.MfcControlCtrl.1"); - CComPtr spUnk= pWin->GetHostedControl(); - Reference invMfc= convertComObject( spUnk.p); - - Sequence< sal_Int16> seqIndices; - Sequence seqOut; - - Any aAny; - Any anyOut; - char buff[1024]; - Any seqAny; - - if (! doSimpleTest(inv)) - { - fprintf(stdout, "### Test failed!\n"); - return E_FAIL; - } - - if (! doPropertyTest(inv)) - { - fprintf(stdout, "### Test failed!\n"); - return E_FAIL; - } - - if ( ! doSimpleSequenceTest(inv)) - { - fprintf(stdout, "### Test failed! \n"); - return E_FAIL; - } - - if ( ! doParameterTest(inv)) - { - fprintf(stdout, "### Test failed! \n"); - return E_FAIL; - } - - if ( ! doPropertyWithArgumentTest(inv)) - { - fprintf(stdout, "### Test failed! \n"); - return E_FAIL; - } - - - - - -// -// //################################################################################### -// // in multi Sequences -// //################################################################################### -// // inMulDimArrayLong - sal_Int32 arLongi[]={1,2,3}; - sal_Int32 arLongi2[]={4,5,6,7}; - sal_Int32 arLongi3[]={8,9,10,11,12}; - - Sequence seqLongi1( arLongi, 3); - Sequence seqLongi2( arLongi2, 4); - Sequence seqLongi3( arLongi3, 5); - - Sequence< Sequence< sal_Int32 > > seq2i(3); - seq2i[0]= seqLongi1; - seq2i[1]= seqLongi2; - seq2i[2]= seqLongi3; - seqAny<<= seq2i; - // dimension length 3,5 - inv->invoke( OUString(L"inMulDimArrayLong"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); -// - //inMulDimArrayVariant - inv->invoke( OUString(L"inMulDimArrayVariant"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); - - //inMulDimArrayLong2 - sal_Int32 arLongii1[]={1,2,3}; - sal_Int32 arLongii2[]={4,5,6,7}; - sal_Int32 arLongii3[]={8,9,10,11,12}; - sal_Int32 arLongii4[]={13,14,15,16}; - sal_Int32 arLongii5[]={17,18,19}; - - Sequence seqLongii1( arLongii1, 3); - Sequence seqLongii2( arLongii2, 4); - Sequence seqLongii3( arLongii3, 5); - Sequence seqLongii4( arLongii4, 4); - Sequence seqLongii5( arLongii5, 3); - - Sequence< Sequence< sal_Int32 > > seq2ii(3); - Sequence< Sequence< sal_Int32> > seq2ii2(2); - seq2ii[0]= seqLongii1; - seq2ii[1]= seqLongii2; - seq2ii[2]= seqLongii3; - - seq2ii2[0]= seqLongii4; - seq2ii2[1]= seqLongii5; - - Sequence< Sequence< Sequence< sal_Int32> > > seq3ii(2); - seq3ii[0]=seq2ii; - seq3ii[1]=seq2ii2; - seqAny<<= seq3ii; - inv->invoke( OUString(L"inMulDimArrayLong2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); - - // inMulDimArrayByte2 - sal_Int8 arByteii1[]={1,2,3}; - sal_Int8 arByteii2[]={4,5,6,7}; - sal_Int8 arByteii3[]={8,9,10,11,12}; - sal_Int8 arByteii4[]={13,14,15,16}; - sal_Int8 arByteii5[]={17,18,19}; - - Sequence seqByteii1( arByteii1, 3); - Sequence seqByteii2( arByteii2, 4); - Sequence seqByteii3( arByteii3, 5); - Sequence seqByteii4( arByteii4, 4); - Sequence seqByteii5( arByteii5, 3); - - Sequence< Sequence< sal_Int8 > > seq2Byteii(3); - Sequence< Sequence< sal_Int8> > seq2Byteii2(2); - seq2Byteii[0]= seqByteii1; - seq2Byteii[1]= seqByteii2; - seq2Byteii[2]= seqByteii3; - - seq2Byteii2[0]= seqByteii4; - seq2Byteii2[1]= seqByteii5; - - Sequence< Sequence< Sequence< sal_Int8> > > seq3Byteii(2); - seq3Byteii[0]=seq2Byteii; - seq3Byteii[1]=seq2Byteii2; - seqAny<<= seq3Byteii; - inv->invoke( OUString(L"inMulDimArrayByte2"),Sequence< Any > ( &seqAny, 1), seqIndices, seqOut); - - - - //################################################################################### - //################################################################################### - //################################################################################### - // Tests with a MFC ActiveX control, ( pure dispinterface) - //################################################################################### - - //################################################################################### - // in parameter MFC ActiveX - //################################################################################### - // unsigned char is not supported by MFC - // aAny <<= ( sal_Int8) 127; - // invMfc->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - if ( ! invMfc.is()) - return hr; - aAny <<= static_cast(-1); - aAny= invMfc->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - -// - aAny <<= ( sal_Int32) 1234567; - aAny=invMfc->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - sal_Int32 retLong= *(sal_Int32*)aAny.getValue(); - - OUString str_1(L" this is clientTest.exe"); - aAny <<= str_1; - aAny=invMfc->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - aAny>>= str_1; - - aAny <<= ( float) 3.14; - aAny=invMfc->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - - aAny <<= ( double) 3.145; - aAny=invMfc->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - - aAny <<= OUString( L" A string in an any"); - aAny=invMfc->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - - - Reference < XInvocation > inv5= getComObject(L"AxTestComponents.Basic"); - Any anyVal4; - anyVal4 <<= OUString(L"this is the value of prpString"); - inv5->setValue( OUString(L"prpString"), anyVal4); - aAny <<= inv5; - aAny=invMfc->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); -// -// //################################################################################### -// // out parameter MFC ActiveX -// //################################################################################### -// -// // outShort - aAny= invMfc->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outShort %d", *(sal_Int16*)anyOut.getValue()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outLong - aAny= invMfc->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outLong %d", *(sal_Int32*)anyOut.getValue()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outString - aAny= invMfc->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outString %S", ((OUString*)anyOut.getValue())->getStr()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outFloat - aAny= invMfc->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outFloat %f", *(float*)anyOut.getValue()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outDouble - aAny= invMfc->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outFloat %f", *(double*)anyOut.getValue()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outVariant - // we expect a string!! ( VT_BSTR) - aAny= invMfc->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - anyOut<<= seqOut[0]; - sprintf(buff, "MFC outVariant %S", ((OUString*)anyOut.getValue())->getStr()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - // outDouble - aAny= invMfc->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut); - Reference invOut5; - seqOut[0]>>= invOut5; - // we assume that an object of AxTestControls.Basic is being returned. - anyOut= invOut5->getValue( OUString(L"prpString")); - OUString tmpStr; - anyOut>>=tmpStr; - sprintf(buff, "MFC outObject, property: %S", tmpStr.getStr()); - MessageBox( NULL, buff, _T("clientTest"), MB_OK); - - - //################################################################################### - // Sequence parameter MFC ActiveX - //################################################################################### - // Sequences are not directly supported. - - - delete pWin; - return hr; - -} - - - -//VARIANT_TRUE VT_UI1 - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleClient/funcs.cxx b/extensions/test/ole/OleClient/funcs.cxx deleted file mode 100644 index b797ab140..000000000 --- a/extensions/test/ole/OleClient/funcs.cxx +++ /dev/null @@ -1,358 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include "cppuhelper/bootstrap.hxx" -#include "rtl/process.h" -#include "typelib/typedescription.hxx" - -#include "com/sun/star/bridge/ModelDependent.hpp" -#include "com/sun/star/bridge/XBridgeSupplier2.hpp" -#include "com/sun/star/uno/TypeClass.hpp" -#include "com/sun/star/script/XInvocation.hpp" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/uno/XComponentContext.hpp" -#include -#include "rtl/ustring.hxx" - -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::ModelDependent; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::script; -using namespace com::sun::star::bridge::oleautomation; -using namespace cppu; - -using ::rtl::OUString; - -template< class T > -bool equalSequences(const Sequence& seqIn, const Sequence & returned); - - -Reference< XMultiServiceFactory > objectFactory;// - - -Reference getMultiServiceFactory() -{ - static Reference< XMultiServiceFactory > factory; - if( ! objectFactory.is() ) - { - Reference context = defaultBootstrap_InitialComponentContext(); - factory = Reference( context->getServiceManager(), UNO_QUERY); - - } - return factory; -} - -Reference getComObject( OUString progId) -{ - HRESULT hr= S_OK; - Reference< XInvocation > ret; -// Reference fac; - if( ! objectFactory.is()) - { Reference mgr= getMultiServiceFactory(); - Reference xInt= mgr->createInstance( - OUString(L"com.sun.star.bridge.oleautomation.Factory")); - objectFactory= Reference::query( xInt); - } - - if( objectFactory.is()) - { - Reference xIntAx= objectFactory->createInstance( progId.getStr()); - if( xIntAx.is() ) - { - Reference< XInvocation > xInv( xIntAx, UNO_QUERY); - ret= xInv; - } - } - return ret; -} - -Reference convertComObject( IUnknown* pUnk) -{ - Reference< XMultiServiceFactory > mgr= getMultiServiceFactory(); - Reference< XInterface > xIntSupplier= mgr->createInstance(OUString(L"com.sun.star.bridge.OleBridgeSupplier2")); - Reference< XBridgeSupplier2 > xSuppl( xIntSupplier, UNO_QUERY); - - Any any; - CComVariant var( pUnk); - any <<= ( sal_uInt32)&var; - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId); - Any target= xSuppl->createBridge( any, Sequence( (sal_Int8*)arId, 16), OLE, UNO ); - - Reference ret; - target>>= ret; - return ret; -} - -/* - Parameter values contains the expected return values. The value at index 0 - correspond to parameter 0 (left - most). For parameters which are not out or - in/out the value must be a void any. - - The number of items in value must be the - same as the number of provided parameter during the call on the method. - - The parameter outArgs, indices correspond to the sequences which are - arguments to XInvocation::invoke - */ -bool checkOutArgs(const Sequence & outArgs, - const Sequence & indices, const Sequence & values) -{ - if (values.getLength() != outArgs.getLength()) - return false; - //iterate over all parameters. i represents the parameter index - for (int i = 0; i < values.getLength(); i++) - { - if (values[i].getValueType() == getVoidCppuType()) - continue; - //out parameter - //Based on the parameter index find the correspondent out value - int indexOutSeq = -1; - for (int iIndices = indices.getLength() - 1; iIndices >= 0; iIndices --) - { - if (indices[iIndices] == i) - { - indexOutSeq = iIndices; - break; - } - } - if (indexOutSeq == -1) - return false; - - Any value; - Any out; - values[i] >>= value; - outArgs[indexOutSeq] >>=out; - NamedArgument naVal; - NamedArgument naOut; - value >>= naVal; - out >>= naOut; - if (values[i].getValueType() == getCppuType((NamedArgument *) 0)) - { - NamedArgument inNamed; - values[i] >>= inNamed; - value <<= inNamed.Value; - } - if (value != outArgs[indexOutSeq]) - return false; - } - return true; -} - -/* The returned sequence always contains Any elements -*/ -bool equalSequences(const Any& orig, const Any& returned) -{ - if (orig.getValueTypeClass() != TypeClass_SEQUENCE) - { - OSL_ASSERT(0); - return false; - } - TypeDescription td(orig.getValueTypeRef()); - typelib_IndirectTypeDescription * indirect_td = (typelib_IndirectTypeDescription *) td.get(); - - switch (indirect_td->pType->eTypeClass) - { - case TypeClass_CHAR: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_BOOLEAN: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_BYTE: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_SHORT: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_LONG: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_FLOAT: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_DOUBLE: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_STRING: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_ANY: - { - Sequence seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - case TypeClass_SEQUENCE: - { - //Sequence seq; - //orig >>= seq; - //Sequence seq2; - //returned >>= seq2; - //return equalSequences(seq, seq2); - break; - } - case TypeClass_INTERFACE: - { - Sequence > seq; - orig >>= seq; - Sequence seq2; - returned >>= seq2; - return equalSequences(seq, seq2); - } - default: - return false; - } - return false; -} - -template< class T > -bool equalSequences(const Sequence& seqIn, const Sequence & seqOut) -{ - if (seqIn.getLength() != seqOut.getLength()) - return false; - int len = seqIn.getLength(); - for (int i = 0; i < len; i++) - { - Any anyIn; - anyIn <<= seqIn[i]; - Any anyOut = seqOut[i]; - if (anyIn != anyOut) - return false; - } - - return true; -} - -void printSequence( Sequence& val) -{ - -// typelib_TypeDescription* desc; -// val.getValueTypeDescription( &desc); -// typelib_typedescription_release( desc); - - USES_CONVERSION; - char buff[1024]; - buff[0]=0; - char tmpBuf[1024]; - tmpBuf[0]=0; - sal_Int32 i; - - for( i=0; i< val.getLength(); i++) - { - Any& elem= val[i]; - switch ( elem.getValueTypeClass()) - { - case TypeClass_BYTE: - sprintf( tmpBuf, "sal_Int8 %d \n", *(sal_Int8*)elem.getValue()); - break; - case TypeClass_SHORT: - sprintf( tmpBuf, "sal_Int16 %d \n", *(sal_Int16*)elem.getValue()); - break; - case TypeClass_LONG: - sprintf( tmpBuf, "sal_Int32 %d \n", *(sal_Int32*)elem.getValue()); - break; - case TypeClass_DOUBLE: - sprintf( tmpBuf, "double %f \n", *(double*)elem.getValue()); - break; - case TypeClass_FLOAT: - sprintf( tmpBuf, "float %f \n", *(float*)elem.getValue()); - break; - case TypeClass_STRING: - sprintf( tmpBuf, "%S \n", (*(OUString*)elem.getValue()).getStr()); - break; - case TypeClass_INTERFACE: - { - // we assume that the interface is XInvocation of a AxTestControls.Basic component. - Reference inv; - elem>>= inv; - if( inv.is()) - { - Any prpVal= inv->getValue( OUString( L"prpString")); - sprintf( tmpBuf, "Property prpString: %S \n", (*(OUString*)prpVal.getValue()).getStr()); - } - break; - } - default:break; - } - strcat( buff, tmpBuf); - - } - - MessageBox( NULL, A2T(buff), _T("clientTest: printing Sequence elements"), MB_OK); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleClient/makefile.mk b/extensions/test/ole/OleClient/makefile.mk deleted file mode 100644 index 0587038d0..000000000 --- a/extensions/test/ole/OleClient/makefile.mk +++ /dev/null @@ -1,72 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/..$/ - -PRJNAME=extensions -TARGET=clientTest -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - -INCPRE+= $(OUT)$/inc -I$(ATL_INCLUDE) - - - -APP1TARGET= $(TARGET) -APP1OBJS= \ - $(OBJ)$/clientTest.obj \ - $(OBJ)$/axhost.obj \ - $(OBJ)$/funcs.obj - -APP1STDLIBS= \ - $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(USER32LIB) \ - $(COMPATH)$/atlmfc$/lib$/atls.lib \ - $(KERNEL32LIB) \ - $(OLE32LIB) \ - $(OLEAUT32LIB) \ - $(UUIDLIB) \ - $(GDI32LIB) \ - $(ADVAPI32LIB) - -APP1DEF= $(MISC)\$(APP1TARGET).def - -# --- Targets --- - -.INCLUDE : target.mk - - diff --git a/extensions/test/ole/OleClient/readme.txt b/extensions/test/ole/OleClient/readme.txt deleted file mode 100644 index 96181e44d..000000000 --- a/extensions/test/ole/OleClient/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -The program tests the OleObjectFactory service which enables to use COM components -through XInvocation. - -Requirements: - -types.rdb and services.rdb and OleClient.ini have to be next to the executable. -COM component: XCallback_Impl.Simple ( extensions/test/ole/unotocomcalls/XCallback_Impl ) -ActiveX controls: AxTestComponent.Basic ( extensions/test/ole/AxTestComponents) - MFCCONTROL.MfcControlCtrl.1 (extensions/test/ole/MfcControl) - diff --git a/extensions/test/ole/OleConverterVar1/convTest.cxx b/extensions/test/ole/OleConverterVar1/convTest.cxx deleted file mode 100644 index 0bc278b06..000000000 --- a/extensions/test/ole/OleConverterVar1/convTest.cxx +++ /dev/null @@ -1,660 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#pragma warning (disable: 4917) -#include -#include -#include -#include -extern CComModule _Module; -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -CComModule _Module; -BEGIN_OBJECT_MAP(ObjectMap) -END_OBJECT_MAP() - -#include "smartarray.h" -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::ModelDependent; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace oletest; -using namespace cppu; - -using ::rtl::OUString; - -HRESULT doTest(); -HRESULT InitializeParameter(); -void printResultVariantArray( VARIANT & var); -void printVariant( VARIANT & var); - - - - -int SAL_CALL _tmain( int argc, _TCHAR * argv[] ) -{ - HRESULT hr; - if( FAILED( hr=CoInitialize(NULL))) - { - _tprintf(_T("CoInitialize failed \n")); - return -1; - } - - - _Module.Init( ObjectMap, GetModuleHandle( NULL)); - - if( FAILED(hr=doTest())) - { - _com_error err( hr); - const TCHAR * errMsg= err.ErrorMessage(); - MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR); - } - - - _Module.Term(); - CoUninitialize(); - return 0; -} -char _c[]={ 1,2,3,4,5}; -short _short[]={0xffff, 1, 11 ,111, 1111 }; -unsigned short _ushort[]={0xffff, 1, 11 ,111, 1111 }; -long _long[]= { 0xffffffff, 11, 111 ,1111, 1111 }; -unsigned long _ulong[]= { 0xffffffff, 11, 111 ,1111, 1111 }; -float _float[]= { 12345.f, 1234.5f, 123.45f, 12.345f, 1.2345f}; -double _double[]= {12345, 1234.5, 123.45, 12.345, 1.2345}; - -CComVariant _variant[]= {L"variant 1", L"variant2", L"variant3"}; -wchar_t _wchar[]= {L'1', L'2', L'3', L'A', L' '}; -BSTR _bstr[]={L"Ich", L"bin", L"ein", L"Hamburger", L"Jung"}; -SmartArray arByte( _c, 5, VT_I1); -SmartArray< short> arShort( _short, 5, VT_I2); -//SmartArray< unsigned short> arUShort( _ushort, 5, VT_UI2); -SmartArray< long> arLong( _long, 5, VT_I4); -//SmartArray< unsigned long> arULong( _ulong, 5, VT_UI4); -//SmartArray< float> arFloat( _float, 5, VT_R4 ); -SmartArray< double> arDouble( _double, 5, VT_R8 ); -//SmartArray< unsigned short> arWChar( _wchar, 5, VT_UI2 ); -SmartArray< wchar_t* > arString( _bstr, 5, VT_BSTR); -SmartArray< VARIANT > arVariant( _variant, 3, VT_VARIANT); - - -HRESULT doTest() -{ - HRESULT hr; - USES_CONVERSION; - CComPtr spUnkMgr; - - putenv("UNO_TYPES=types.rdb"); - putenv("UNO_SERVICES=services.rdb"); - Reference xContext = defaultBootstrap_InitialComponentContext(); - - Reference< XMultiComponentFactory > mgr = xContext->getServiceManager();//createRegistryServiceFactory( OUString(L"services.rdb")); - Reference< XInterface > xIntSupplier= mgr->createInstanceWithContext( - OUString(L"com.sun.star.bridge.OleBridgeSupplierVar1"), xContext); - Reference< XBridgeSupplier2 > xSuppl( xIntSupplier, UNO_QUERY); - Reference xOletest= mgr->createInstanceWithContext( - OUString(L"oletest.OleTest"), xContext); - Any any; - any <<= xOletest; - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId); - Any target= xSuppl->createBridge( any, Sequence( (sal_Int8*)arId, 16), UNO, OLE); - CComDispatchDriver oletest; - if (target.getValueTypeClass() == getCppuType((sal_uInt32*) 0).getTypeClass()) - { - VARIANT* pVariant = *(VARIANT**)target.getValue(); - - oletest= pVariant->pdispVal; - - VariantClear(pVariant); - CoTaskMemFree(pVariant); - } - - CComVariant varRet; - CComVariant varParam1; - CComVariant varParam2; - CComVariant varParam3; - CComVariant varParam4; - - long value= 100; - varParam1.vt= VT_I1 | VT_BYREF; - varParam1.plVal= &value; - - // Testing the caching of DISPIDs and the process of aquiring member information - // on demand in IDispatch::Invoke - // Step through the corresponding IDispatch implementation of the ole bridge - hr= oletest.Invoke1(static_cast(L"testinout_methodByte"), &varParam1, &varRet); - hr= oletest.Invoke1(static_cast(L"testinout_methodByte"), &varParam1, &varRet); - // Name ok but different case - hr= oletest.Invoke1(static_cast(L"Testinout_methodByte"), &varParam1, &varRet); - hr= oletest.Invoke1(static_cast(L"Testinout_methodByte"), &varParam1, &varRet); - // not existing member - hr= oletest.Invoke1(static_cast(L"Testinout"), &varParam1, &varRet); - hr= oletest.Invoke1(static_cast(L"Testinout"), &varParam1, &varRet); - - // Property - varParam1.vt= VT_ARRAY | VT_I1; - varParam1.parray= (SAFEARRAY*)arByte; - hr= oletest.PutPropertyByName( static_cast(L"AttrByte"), &varParam1); - hr= oletest.PutPropertyByName( static_cast(L"AttrByte"), &varParam1); - // Name ok but different case - hr= oletest.PutPropertyByName( static_cast(L"attrByte"), &varParam1); - hr= oletest.PutPropertyByName( static_cast(L"attrByte"), &varParam1); - // not existing member - hr= oletest.PutPropertyByName( static_cast(L"attr"), &varParam1); - hr= oletest.PutPropertyByName( static_cast(L"attr"), &varParam1); - - // PropertyGet - hr= oletest.GetPropertyByName( static_cast(L"AttrByte"), &varRet); - - hr= oletest.GetPropertyByName( static_cast(L"attrByte"), &varRet); - hr= oletest.GetPropertyByName( static_cast(L"attrByte"), &varRet); - //not existing member - hr= oletest.GetPropertyByName( static_cast(L"attrBy"), &varRet); - hr= oletest.GetPropertyByName( static_cast(L"attrBy"), &varRet); - - DISPID dispid; - LPOLESTR method= L"methodByte"; - hr = oletest.p->GetIDsOfNames(IID_NULL, &method, 1, LOCALE_USER_DEFAULT, &dispid); - - - CComVariant arg[1]; - arg[0].vt= VT_ARRAY | VT_I1; - arg[0].parray= (SAFEARRAY*)arByte; - DISPPARAMS params={ arg,0,1,0}; - - hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); - - hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); - - // different case - LPOLESTR method2= L"MEthodByte"; - hr = oletest.p->GetIDsOfNames(IID_NULL, &method2, 1, LOCALE_USER_DEFAULT, &dispid); - - hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); - - hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYPUT, ¶ms, &varRet, NULL, NULL); - - LPOLESTR attrib= L"AttrByte"; - hr = oletest.p->GetIDsOfNames(IID_NULL, &attrib, 1, LOCALE_USER_DEFAULT, &dispid); - - hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYPUTREF, ¶ms, &varRet, NULL, NULL); - - hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, - DISPATCH_METHOD | DISPATCH_PROPERTYGET, ¶ms, &varRet, NULL, NULL); - - - - CComVariant varByteArray; - varByteArray.vt= VT_ARRAY | VT_I1; - varByteArray.parray= (SAFEARRAY*)arByte; - CComVariant varShortArray; - varShortArray.vt= VT_ARRAY | VT_I2; - varShortArray.parray= (SAFEARRAY*)arShort; - CComVariant varLongArray; - varLongArray.vt= VT_ARRAY | VT_I4; - varLongArray.parray= (SAFEARRAY*)arLong; - CComVariant varDoubleArray; - varDoubleArray.vt= VT_ARRAY | VT_R8; - varDoubleArray.parray= (SAFEARRAY*)arDouble; - CComVariant varStringArray; - varStringArray.vt= VT_ARRAY | VT_BSTR; - varStringArray.parray= (SAFEARRAY*)arString; - CComVariant varArray; - varArray.vt= VT_ARRAY | VT_VARIANT; - varArray.parray= (SAFEARRAY*)arVariant; - - FONTDESC fd={ sizeof( fd), L"ARIAL", 10, FW_NORMAL, 0, 0, 0, 0}; - - - CComPtr< IUnknown > unk1; - CComPtr< IUnknown > unk2; - CComPtr< IUnknown > unk3; - - IUnknown* _unknown[3]; - hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk1.p); - hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk2.p); - hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk3.p); - _unknown[0]= unk1; - _unknown[1]= unk2; - _unknown[2]= unk3; - SmartArray arUnknown( _unknown, 3, VT_UNKNOWN); - - CComVariant varUnkArray; - varUnkArray.vt= VT_ARRAY | VT_UNKNOWN; - varUnkArray.parray= (SAFEARRAY*)arUnknown; - - // preparing out parameter; - char byteOut; - CComVariant varOutByte; //### - varOutByte.vt= VT_BYREF | VT_UI1; - V_I1REF(&varOutByte)= &byteOut; - short shortOut; - CComVariant varOutShort; //### - varOutShort.vt= VT_BYREF | VT_I2; - V_I2REF( &varOutShort)= &shortOut; - long longOut; - CComVariant varOutLong; //### - varOutLong.vt= VT_BYREF | VT_I4; - V_I4REF( &varOutLong)= &longOut; - double doubleOut; - CComVariant varOutDouble; //### - varOutDouble.vt= VT_BYREF | VT_R8; - V_R8REF( &varOutDouble)= &doubleOut; - BSTR bstrOut= NULL; - CComVariant varOutString; //### - varOutString.vt= VT_BYREF | VT_BSTR; - V_BSTRREF(&varOutString)= &bstrOut; - CComVariant variantOut; - CComVariant varOutAny; //### - varOutAny.vt= VT_BYREF | VT_VARIANT; - V_VARIANTREF(&varOutAny)= &variantOut; - - CComPtr dispOut; - CComVariant varOutXInterface; //### - varOutXInterface.vt= VT_BYREF |VT_DISPATCH; - V_DISPATCHREF(&varOutXInterface)= &dispOut.p; - - // In Parameter ( all of type Sequence ########################################################### - OutputDebugString( _T("In parameter of type Sequence ###########################################\n" - "The functions return the Sequence parameter \n\n")); - - OutputDebugStringA("methodByte | Params: \n"); - printVariant( varByteArray); - hr= oletest.Invoke1(static_cast(L"methodByte"), &varByteArray, &varRet); - OutputDebugStringA("methodByte | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodShort | Params: \n"); - printVariant( varShortArray); - hr= oletest.Invoke1(static_cast(L"methodShort"), &varShortArray, &varRet); - OutputDebugStringA("methodShort | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodLong | Params: \n"); - printVariant( varLongArray); - hr= oletest.Invoke1(static_cast(L"methodLong"), &varLongArray, &varRet); - OutputDebugStringA("methodLong | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodDouble | Params: \n"); - printVariant( varDoubleArray); - hr= oletest.Invoke1(static_cast(L"methodDouble"), &varDoubleArray, &varRet); - OutputDebugStringA("methodDouble | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodString | Params: \n"); - printVariant( varStringArray); - hr= oletest.Invoke1(static_cast(L"methodString"), &varStringArray, &varRet); - OutputDebugStringA("methodString | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodAny | Params: \n"); - printVariant( varArray); - hr= oletest.Invoke1(static_cast(L"methodAny"), &varArray, &varRet); - OutputDebugStringA("methodAny | return value \n"); - printVariant( varRet); - - OutputDebugStringA("methodXInterface | Params: \n"); - printVariant( varUnkArray); - hr= oletest.Invoke1(static_cast(L"methodXInterface"), &varUnkArray, &varRet); - OutputDebugStringA("methodAny | return value \n"); - printVariant( varRet); - - // Out Parameter ########################################################################### - OutputDebugString( _T("Out parameter ###########################################\n\n")); - - OutputDebugString(_T("testout_methodByte \n")); - hr= oletest.InvokeN(static_cast(L"testout_methodByte"), &varOutByte, 1, &varRet); - OutputDebugString(_T("testout_methodByte | out value: \n")); - printVariant( varOutByte); - - OutputDebugString(_T("testout_methodShort \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodShort"), &varOutShort, &varRet); - OutputDebugString(_T("testout_methodShort | out value: \n")); - printVariant( varOutShort); - - OutputDebugString(_T("testout_methodLong \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodLong"), &varOutLong, &varRet); - OutputDebugString(_T("testout_methodLong | out value: \n")); - printVariant( varOutLong); - - OutputDebugString(_T("testout_methodDouble \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodDouble"), &varOutDouble, &varRet); - OutputDebugString(_T("testout_methodDouble | out value: \n")); - printVariant( varOutDouble); - - OutputDebugString(_T("testout_methodString \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodString"), &varOutString, &varRet); - OutputDebugString(_T("testout_methodString | out value: \n")); - printVariant( varOutString); - - OutputDebugString(_T("testout_methodAny \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodAny"), &varOutAny, &varRet); - OutputDebugString(_T("methodAny | out value: \n")); - printVariant( varOutAny); - - OutputDebugString(_T("testout_methodXInterface \n")); - hr= oletest.Invoke1(static_cast(L"testout_methodXInterface"), &varOutXInterface, &varRet); - OutputDebugString(_T("methodAny | out value: \n")); - printVariant( varOutXInterface); - CComDispatchDriver outDisp( *varOutXInterface.ppdispVal); - CComVariant varAttr3; - outDisp.GetPropertyByName(L"AttrAny2", &varAttr3); - ATLTRACE("property OleTest.AttrAny2: %s", W2T(varAttr3.bstrVal)); - - OutputDebugString(_T("testout_methodMulParams1 ( 2 out Parameter) \n")); - long longOut2=0; - CComVariant _params[2]; - longOut=0; - _params[0]= varOutLong; - _params[1].vt= VT_BYREF | VT_I4; - V_I4REF(& _params[1])= &longOut2; - hr= oletest.InvokeN( static_cast(L"testout_methodMulParams1"), (VARIANT*)&_params, 2); - OutputDebugString(_T("testout_methodMulParams1 | out values: \n")); - printVariant( _params[1]); - printVariant( _params[0]); - - OutputDebugString(_T("testout_methodMulParams2 ( 3 out Parameter) \n")); - CComVariant _params2[3]; - _params2[2]= varOutLong; - _params2[1].vt= VT_BYREF | VT_I4; - V_I4REF(& _params2[1])= &longOut2; - _params2[0]= varOutString; - hr= oletest.InvokeN( static_cast( L"testout_methodMulParams2"), (VARIANT*)&_params2, 3); - OutputDebugString(_T("testout_methodMulParams2 | out values: \n")); - printVariant( _params2[2]); - printVariant( _params2[1]); - printVariant( _params2[0]); - - OutputDebugString(_T("testout_methodMulParams3 ( 1 in and 1 out Parameter) \n")); - CComVariant _params3[2]; - _params3[1]= CComBSTR(L" In string"); - _params3[0]= varOutString; - hr= oletest.InvokeN( static_cast( L"testout_methodMulParams3"), (VARIANT*)&_params3, 2); - OutputDebugString(_T("testout_methodMulParams3 | out values: \n")); - printVariant( _params3[1]); - printVariant( _params3[0]); - - //In Out Parameter ########################################################################### - OutputDebugString( _T("In Out parameter ###########################################\n\n")); - - *V_I1REF(&varOutByte)= 5; - ATLTRACE(_T("testinout_methodByte | in value: %d \n"), *V_I1REF(&varOutByte)); - hr= oletest.InvokeN(static_cast(L"testinout_methodByte"), &varOutByte, 1, &varRet); - OutputDebugString(_T("testinout_methodByte | out value: \n")); - printVariant( varOutByte); - - OutputDebugString(_T("testinout_methodShort | in value= 1000 \n")); - *V_UI2REF(&varOutShort)= 1000; - hr= oletest.Invoke1(static_cast(L"testinout_methodShort"), &varOutShort, &varRet); - OutputDebugString(_T("testinout_methodShort | out value: \n")); - printVariant( varOutShort); - - OutputDebugString(_T("testinout_methodLong | in value= 10000 \n")); - *V_UI4REF(&varOutLong)= 10000; - hr= oletest.Invoke1(static_cast(L"testinout_methodLong"), &varOutLong, &varRet); - OutputDebugString(_T("testinout_methodLong | out value: \n")); - printVariant( varOutLong); - - *V_R8REF(&varOutDouble)= 3.14; - ATLTRACE(_T("testinou_methodDouble in value: %f \n"),*V_R8REF(&varOutDouble)); - hr= oletest.Invoke1(static_cast(L"testinout_methodDouble"), &varOutDouble, &varRet); - OutputDebugString(_T("testinout_methodDouble | out value: \n")); - printVariant( varOutDouble); - - SysFreeString( *V_BSTRREF(&varOutString)); - *V_BSTRREF(&varOutString)= SysAllocString( L"this is a in string"); - ATLTRACE(_T("testinout_methodString | value: %s \n"), W2T(*V_BSTRREF(&varOutString))); - hr= oletest.Invoke1(static_cast(L"testinout_methodString"), &varOutString, &varRet); - OutputDebugString(_T("testinout_methodString | out value: \n")); - printVariant( varOutString); - - CComVariant var1(CComBSTR(L" this is a string in a VARIANT")); - CComVariant outVar1; - outVar1.vt= VT_BYREF | VT_VARIANT; - outVar1.pvarVal= &var1; - ATLTRACE(_T("testinout_methodAny | parameter: %s\n"), W2T(var1.bstrVal)); - hr= oletest.Invoke1(static_cast(L"testinout_methodAny"), &varOutAny, &varRet); - OutputDebugString(_T("testinout_methodAny | out value: \n")); - printVariant( varOutAny); - - CComPtr< IUnknown > objectIn = unk1; - CComVariant varOutIFace; - varOutIFace.vt= VT_BYREF | VT_UNKNOWN; - varOutIFace.ppunkVal= &objectIn.p; - (*varOutIFace.ppunkVal)->AddRef(); - OutputDebugString(_T("testinout_methodXInterface | in value: \n")); - printVariant(varOutIFace); - hr= oletest.Invoke1(static_cast(L"testinout_methodXInterface"), &varOutIFace, &varRet); - OutputDebugString(_T("testinout_methodXInterface | out value: \n")); - printVariant( varOutIFace); - - // Properties ###################################################################### - OutputDebugString( _T(" Properties ###########################################\n\n")); - - OutputDebugString(_T("set property \"AttrByte\" | value")); - //CComVariant propArByte; - //propArByte.vt= VT_ARRAY | VT_I1; - varParam1.parray= (SAFEARRAY*)arByte; - printVariant( varParam1); - hr= oletest.PutPropertyByName( static_cast(L"AttrByte"), &varParam1); - OutputDebugString(_T("get property \"AttrByte\" | value:")); - varRet.Clear(); - hr= oletest.GetPropertyByName( static_cast(L"AttrByte"), &varRet); - printVariant( varRet); - - - return S_OK; - - -} - - -void printVariant( VARIANT & _var) -{ - HRESULT hr; - USES_CONVERSION; - CComVariant var; - hr= VariantCopyInd( &var, &_var); - if( var.vt & VT_ARRAY) - { - VARTYPE type= var.vt ^ VT_ARRAY; - SAFEARRAY * sarray= var.parray; - long lbound; - long ubound; - hr= SafeArrayGetLBound( sarray, 1, &lbound); - hr= SafeArrayGetUBound( sarray, 1, &ubound); - long count= ubound - lbound + 1; - char charValue; - BYTE byteValue; - short shortValue; - long longValue; - double doubleValue; - IUnknown* unkValue; - BSTR bstrValue; - OutputDebugString( _T("# Array \n")); - for( long i= 0; i < count; i++) - { -// CComVariant variantValue; - TCHAR *buf[256]; - wsprintf( (TCHAR*)buf, _T("%d : "), i); - OutputDebugString( (TCHAR*)buf); - VARIANT varTemp; - VariantInit( &varTemp); - VARIANT variantValue; - VariantInit( &variantValue); - switch( type) - { - case VT_UI1: - hr= SafeArrayGetElement( sarray, &i, &byteValue); - varTemp.vt= VT_UI1; - V_UI1( &varTemp)= byteValue; - printVariant( varTemp); - break; - case VT_I1: - hr= SafeArrayGetElement( sarray, &i, &charValue); - varTemp.vt= VT_I1; - V_I1( &varTemp)= charValue; - printVariant( varTemp); - break; - case VT_I2: - hr= SafeArrayGetElement( sarray, &i, &shortValue); - varTemp.vt= VT_I2; - V_I2( &varTemp)= shortValue; - printVariant( varTemp); - break; - - case VT_UI2: - case VT_I4: - hr= SafeArrayGetElement( sarray, &i, &longValue); - varTemp.vt= VT_I4; - V_I4( &varTemp)= longValue; - printVariant( varTemp); - break; - case VT_R8: - hr= SafeArrayGetElement( sarray, &i, &doubleValue); - varTemp.vt= VT_R8; - V_R8( &varTemp)= doubleValue; - printVariant( varTemp); - break; - case VT_BSTR: - hr= SafeArrayGetElement( sarray, &i, &bstrValue); - varTemp.vt= VT_BSTR; - varTemp.bstrVal= bstrValue; - printVariant( varTemp); - break; - case VT_VARIANT: - hr= SafeArrayGetElement( sarray, &i, &varTemp); - printVariant( varTemp); - break; - - case VT_UNKNOWN: - hr= SafeArrayGetElement( sarray, &i, &unkValue); - varTemp.vt= VT_UNKNOWN; - varTemp.punkVal= unkValue; - printVariant( varTemp); - break; - } - - VariantClear( &varTemp); - VariantClear( &variantValue); - } - - } - else - { - TCHAR buf[256]; - switch (var.vt) - { - case VT_I1: wsprintf( (TCHAR*)buf, _T(" VT_I1: %d \n"), V_I1( &var) ); - break; - case VT_UI1: wsprintf( (TCHAR*)buf, _T(" VT_UI1: %d \n"), V_I1( &var) ); - break; - - case VT_I2: wsprintf( (TCHAR*)buf, _T(" VT_I2: %d \n"), V_I2( &var) ); - break; - case VT_I4: wsprintf( (TCHAR*)buf, _T(" VT_I4: %d \n"), V_I4( &var) ); - break; - case VT_R8: - { - -// int decimal, sign; -// char *buffer; -// int precision = 14; -// double source = 3.1415926535; - -// buffer = _ecvt( V_R8(&var), precision, &decimal, &sign ); - sprintf( (TCHAR*)buf, _T(" VT_R8: %f \n"),V_R8( &var) ); - break; - } - case VT_UNKNOWN: - // The object implement IFont - { - CComDispatchDriver disp( var.punkVal); - CComVariant ret; - hr= disp.GetPropertyByName( static_cast(L"Name"), &ret); - wsprintf( (TCHAR*)buf, _T(" VT_UNKNOWN: property \"Name\": %s \n"), W2T(ret.bstrVal)); - break; - } - case VT_DISPATCH: - // The object implement IFont - { - CComDispatchDriver disp( var.punkVal); - CComVariant ret; - if( SUCCEEDED( hr= disp.GetPropertyByName( static_cast(L"Name"), &ret))) - wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH: property \"Name\": %s \n"), W2T(ret.bstrVal)); - else - wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH \n")); - - break; - } - - - case VT_BSTR: - { - TCHAR* str= W2T( var.bstrVal); - wsprintf( (TCHAR*)buf, _T(" VT_BSTR: %s \n"), str); - } - break; - default: - wsprintf( (TCHAR*)buf, _T("\n")); - - } - - OutputDebugString( (TCHAR*) buf); - } - - return; - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleConverterVar1/makefile.mk b/extensions/test/ole/OleConverterVar1/makefile.mk deleted file mode 100644 index a36c342db..000000000 --- a/extensions/test/ole/OleConverterVar1/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=convTest -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - -INCPRE+=-I$(ATL_INCLUDE) - - -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/convTest.obj - - -APP1STDLIBS= \ - $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(USER32LIB) \ - $(KERNEL32LIB) \ - $(OLE32LIB) \ - $(OLEAUT32LIB) \ - $(UUIDLIB) \ - $(COMDLG32LIB) \ - $(COMPATH)$/atlmfc$/lib$/atls.lib \ - $(ADVAPI32LIB) - -APP1DEF= $(MISC)\$(APP1TARGET).def - -# --- Targets --- -.INCLUDE : target.mk diff --git a/extensions/test/ole/OleConverterVar1/readme.txt b/extensions/test/ole/OleConverterVar1/readme.txt deleted file mode 100644 index 148bab04c..000000000 --- a/extensions/test/ole/OleConverterVar1/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -Currently broken!! - -The program test the Service com.sun.star.bridge.OleBridgeSupplierVar1. -While running in debug mode it writes infos to the debug - output. - -The executable needs a services.rdb present with the registered services -com.sun.star.bridge.OleBridgeSupplierVar1, oletest.OleTest. The OleTest -component resides in extensions/test/ole/cpnt. The build creates an -oletest.rdb file that must be merged with the types.rdb and OleTest -must be registered to the services.rdb. diff --git a/extensions/test/ole/OleConverterVar1/smartarray.h b/extensions/test/ole/OleConverterVar1/smartarray.h deleted file mode 100644 index f38c93d88..000000000 --- a/extensions/test/ole/OleConverterVar1/smartarray.h +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SMARTARRAY_H -#define _SMARTARRAY_H - - -template< class sourceType> -class SmartArray -{ - SAFEARRAY *m_array; -public: - - SmartArray( sourceType * parParams, int count, VARTYPE destVartype): m_array(NULL) - { - HRESULT hr= S_OK; - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].cElements= count; - rgsabound[0].lLbound= 0; - m_array= SafeArrayCreate( destVartype, 1, rgsabound); - SafeArrayLock( m_array); - - void* pData; - if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) - { - - for( int i=0; i< count; i++) - { - CComVariant varSource( parParams[i]); - switch (destVartype) - { - case VT_I1: - { - char* p= (char*) pData; - if( SUCCEEDED( hr= varSource.ChangeType( destVartype))) - p[i]= V_I1( &varSource); - break; - } - case VT_I2: - { - short* p= (short*) pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_I2( &varSource); - break; - } - case VT_UI2: - { - unsigned short* p= (unsigned short*) pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_UI2( &varSource); - break; - } - case VT_I4: - { - long* p= (long*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_I4( &varSource); - break; - } - case VT_UI4: - { - unsigned long* p= (unsigned long*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_UI4( &varSource); - break; - } - case VT_R4: - { - float* p= (float*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_R4( &varSource); - break; - } - case VT_R8: - { - double* p= (double*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_R8( &varSource); - break; - } - case VT_BOOL: - { - VARIANT_BOOL* p= (VARIANT_BOOL*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - p[i]= V_BOOL( &varSource); - break; - } - case VT_BSTR: - { - BSTR* pBstr= ( BSTR*)pData; - if( SUCCEEDED( hr=varSource.ChangeType( destVartype))) - pBstr[i]= SysAllocString(V_BSTR( &varSource)); - break; - } - case VT_VARIANT: - { - VARIANT *pVariant= (VARIANT*)pData; - hr= VariantCopy( &pVariant[i], &varSource); break; - } -// case VT_UNKNOWN: -// { -// long* pUnk= (long*)pData; -// pUnk[i]= reinterpret_cast(parParams[i]); -// ((IUnknown*)pUnk[i])->AddRef(); break; -// } -// case VT_DISPATCH: -// { -// long* pDisp= (long*)pData; -// pDisp[i]= (long)parParams[i]; -// ((IDispatch*)pDisp[i])->AddRef(); break; -// } - default: - hr= E_FAIL; - } - } - if( FAILED( hr)) - { - SafeArrayDestroy( m_array); - m_array= NULL; - } - } - SafeArrayUnaccessData( m_array); - } - ~SmartArray(){ - SafeArrayUnlock( m_array); - SafeArrayDestroy( m_array ); - } - - operator bool (){ return m_array == NULL ? false : true; } - - operator SAFEARRAY* (){ return m_array;} - -}; - -template<> -class SmartArray -{ - SAFEARRAY *m_array; -public: - - SmartArray( sourceType * parParams, int count, VARTYPE destVartype); -// { -// ATLTRACE("SmartArray"); -// HRESULT hr= S_OK; -// SAFEARRAYBOUND rgsabound[1]; -// rgsabound[0].cElements= count; -// rgsabound[0].lLbound= 0; -// m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count); -// SafeArrayLock( m_array); -// -// IUnknown* *pData; -// if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) -// { -// -// for( int i=0; i< count; i++) -// { -// CComVariant varSource( parParams[i]); -// switch (destVartype) -// { -// -// case VT_UNKNOWN: -// { -// pData[i]= parParams[i]; -// pData[i]->AddRef(); -// } -// default: -// hr= E_FAIL; -// } -// } -// if( FAILED( hr)) -// { -// SafeArrayDestroy( m_array); -// m_array= NULL; -// } -// } -// SafeArrayUnaccessData( m_array); -// } - ~SmartArray(){ - SafeArrayUnlock( m_array); - SafeArrayDestroy( m_array ); - } - - operator bool (){ return m_array == NULL ? false : true; } - - operator SAFEARRAY* (){ return m_array;} - -}; - -template <> SmartArray ::SmartArray(sourceType * parParams, int count, VARTYPE destVartype):m_array(NULL) -{ - ATLTRACE("SmartArray"); - HRESULT hr= S_OK; - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].cElements= count; - rgsabound[0].lLbound= 0; - m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count); - SafeArrayLock( m_array); - - IUnknown* *pData; - if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) ) - { - for( int i=0; i< count; i++) - { - pData[i]= parParams[i]; - pData[i]->AddRef(); - } - } - SafeArrayUnaccessData( m_array); -}; -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/OleTest.htm b/extensions/test/ole/OleTest.htm deleted file mode 100644 index 93d0fdc4e..000000000 --- a/extensions/test/ole/OleTest.htm +++ /dev/null @@ -1,1063 +0,0 @@ - - - - -Document Title - - - - - - - -

          - - - -

          JScript

          -Tests Array/Sequence conversion.
          -All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons. -
          - - - - - - - - - - - - - - - - -

          - -

          -Out Parameter
          - - - - - - - - - - - - - - - - - - - - -

          -In Out Parameter
          - - - - - - - - - - - - - - -

          - -Tests Array/Sequence conversion with Attributes. All params are of type Sequence and - the element type of the Sequence is written on the buttons.
          - - - - - - - - - - - - - -

          - -Test of Any parameter in a method. Any contains:
          - - - - - -

          -Test of Any parameter in a property. Any contains:
          - - - - - -

          -Test of Struct conversions
          - - - - - - - -

          - - -

          Visual Basic Tests

          -Test array /Sequence conversion and return value
          -Template: Sequence < type > method( Sequence< type > )
          - - - - - - - - - - -
          -
          - - -IN/Out parameter
          -Template: void method(type )
          - - - - - - - - - -
          - -Simple out parameter
          - - -
          - - -Tests Array/Sequence conversion with Attributes. All params are of type Sequence and - the element type of the Sequence is written on the buttons.
          - - - - - - - - - - -
          - -In Out parameter
          - -

          -Structs
          - - - - - - diff --git a/extensions/test/ole/ScriptTest.html b/extensions/test/ole/ScriptTest.html deleted file mode 100644 index 71e111457..000000000 --- a/extensions/test/ole/ScriptTest.html +++ /dev/null @@ -1,1555 +0,0 @@ - - - - -Document Title - - - - - - - - - - - - - diff --git a/extensions/test/ole/StarBasic_OleClient/oleclient.bas b/extensions/test/ole/StarBasic_OleClient/oleclient.bas deleted file mode 100644 index 7ba324660..000000000 --- a/extensions/test/ole/StarBasic_OleClient/oleclient.bas +++ /dev/null @@ -1,609 +0,0 @@ -REM ***** BASIC ***** - - -OPTION EXPLICIT -OPTION COMPATIBLE - -Sub Main -COMPATIBILITYMODE(true) - -If runtest = -1 Then - MsgBox "Test Failed!!!" -Else - MsgBox "Test Succeeded" -End If - -End Sub - -Function runtest() As Integer -Dim inBool As Boolean, inBool2 As Boolean, outBool As Boolean -Dim inByte As Integer, inByte2 As Integer -Dim inShort As Integer, inShort2 As Integer -Dim inLong As Long, inLong2 As Long, inLong3 As Long, inLong4 As Long -Dim inString As String, inString2 As String -Dim inFloat As Single, inFloat2 As Single -Dim inDouble As Double, inDouble2 As Double -Dim inVariant, inVariant2 -Dim inAr, inAr2 -Dim inDate As Date,inDate2 As Date, outDate As Date -Dim inCurrency As Currency, inCurrency2 As Currency, outCurrency As Currency -Dim inSCode As New com.sun.star.bridge.oleautomation.SCode -Dim inSCode2 As New com.sun.star.bridge.oleautomation.SCode -Dim inDecimal As Variant, inDecimal2 As Variant, outDecimal As Variant -Dim inrefDecimal As Variant, outrefDecimal As Variant -Dim outSCode As New com.sun.star.bridge.oleautomation.SCode -Dim outByte As Integer -Dim outShort As Integer -Dim outLong, outLong2 As Long -Dim outString As String -Dim outFloat As Single -Dim outDouble As Double -Dim outVariant -'bug #109936 causes an errOr when outObject is used As out param -Dim inObject As Object, inObject2 As Object, outObject As Object -Dim objNOTHING As Object -Dim inUnknown As Object, inUnknown2 As Object, outUnknown As Object - -Dim inArray, outArray, outArray2 -Dim len1, len2 -Dim arString(1) As String -arString(0)= "String one" -arString(1)= "String two" - -Dim factory As Object -factory= createUnoService("com.sun.star.bridge.OleObjectFactory") -Dim obj As Object -obj= factory.createInstance("AxTestComponents.Basic") - -Dim objFoo As Object -objFoo = factory.createInstance("AxTestComponents.Foo") - - -'in parameter ------------------------------------------------------------------- -inBool = true -inByte = 10 -inShort = 11 -inLong = 111 -inString = "Hello World" -inFloat = 3.14 -inDouble = 3.145 -inVariant = "bla" -inDate = NOW() -inCurrency = 12345.6789 -inSCode.Value = &h80020004 -inDecimal = CDec("-9223372036854775808") 'lowest int64 - -obj.inBool(inBool) -obj.inByte(inByte) -obj.inShort(inShort) -obj.inLong(inLong) -obj.inString(inString) -obj.inFloat(inFloat) -obj.inDouble(inDouble) -obj.inVariant(inVariant) -'obj.prpString= "a string property" -obj.inObject(obj) -obj.inArray(arString()) -obj.inDate(inDate) -obj.inCurrency(inCurrency) -obj.inSCode(inSCode) -obj.inUnknown(objFoo) -obj.inDecimal(inDecimal) - -'out parameter ------------------------------------------------------------------------- -outBool = false -obj.outBool(outBool) -outByte = 0 -obj.outByte(outByte) -outShort = 0 -obj.outShort(outShort) -outLong = 0 -obj.outLong(outLong) -outFloat = 0 -obj.outFloat(outFloat) -outDouble = 0 -obj.outDouble(outDouble) -outString = "" -obj.outString(outString) -outVariant = 0 -obj.outVariant(outVariant) -outObject = NOTHING -obj.outObject(outObject) -outArray = 0 -obj.outArray(outArray) -obj.outDate(outDate) -obj.outCurrency(outCurrency) -obj.outSCode(outSCode) -obj.outUnknown(outUnknown) -obj.outDecimal(outDecimal) - - -If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ - inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ - inVariant <> outVariant Or NOT equalUnoObjects(obj, outObject) Or NOT _ - equalArrays(arString(), outArray()) Or inDate <> outDate Or inCurrency <> outCurrency Or _ - inSCode.Value <> outSCode.Value Or Not equalUnoObjects(objFoo, outUnknown) Or _ - inDecimal <> outDecimal Then - runtest = -1 - exit Function -End If - - -'in-out parameter ------------------------------------------------------------- -'implementation of inout methods returns the previously set value in out param -inBool = true -inBool2 = inBool -obj.inoutBool(inBool2) -outBool = false -obj.inoutBool(outBool) -inByte = 10 -inByte2 = inByte -obj.inoutByte(inByte2) -outByte = 0 -obj.inoutByte(outByte) -inShort = 10 -inShort2 = inShort -obj.inShort(inShort2) -outShort = 0 -obj.inoutShort(outShort) -inLong = 10 -inLong2 = inLong -obj.inoutLong(inLong2) -outLong = 0 -obj.inoutLong(outLong) -inFloat = 3.14 -inFloat2 = inFloat -obj.inoutFloat(inFloat2) -outFloat = 0 -obj.inoutFloat(outFloat) -inDouble= 3.14 -inDouble2 = inDouble -obj.inoutDouble(inDouble2) -outDouble = 0 -obj.inoutDouble(outDouble) -inString = "in" -inString2 = inString -obj.inoutString(inString2) -outString = "" -obj.inoutString(outString) -inVariant = "in" -inVariant2 = inVariant -obj.inoutVariant(inVariant2) -outVariant = 0 -obj.inoutVariant(outVariant) -inObject = factory.createInstance("AxTestComponents.Basic") -inObject2 = inObject -obj.inoutObject(inObject2) -outObject = NOTHING -obj.inoutObject(outObject) -inAr = arString() -inAr2 = inAr -obj.inoutArray(inAr2) -outArray = 0 -obj.outArray(outArray()) -inDate = NOW() -inDate2 = inDate -obj.inoutDate(inDate2) -outDate = 0 -obj.inoutDate(outDate) -inCurrency = 1234.5678 -inCurrency2 = inCurrency -obj.inoutCurrency(inCurrency2) -outCurrency = 0 -obj.inoutCurrency(outCurrency) -inSCode.Value = &h80020004 -inSCode2 = inSCode -obj.inoutSCode(inSCode2) -outSCode.Value = 0 -obj.inoutSCode(outSCode) -inUnknown = objFoo -inUnknown2 = inUnknown -obj.inoutUnknown(inUnknown2) -outUnknown = Nothing -obj.inoutUnknown(outUnknown) -inDecimal = CDec("18446744073709551615") 'highest positiv value of unsigne int64 -inDecimal2 = inDecimal -obj.inoutDecimal(inDecimal2) -outDecimal = 0 -obj.inoutDecimal(outDecimal) - -If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ - inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ - inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _ - NOT equalArrays(inAr, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _ - inSCode.Value <> outSCode.Value Or Not equalUnoObjects(inUnknown, outUnknown) Or _ - inDecimal <> outDecimal Then - runtest = -1 - Exit Function -End If - -'properties ------------------------------------------------------------------------- -inBool = false -outBool = true -obj.prpBool = inBool -outBool = obj.prpBool -inByte = 11 -outByte = 0 -obj.prpByte = inByte -outByte= obj.prpByte -inShort = 127 -outShort = 0 -obj.prpShort= inShort -outShort= obj.prpShort -inLong = 1000 -outLong = 0 -obj.prpLong = inLong -outLong= obj.prpLong -inFloat = 3.14 -outFloat = 0 -obj.prpFloat = inFloat -outFloat= obj.prpFloat -inDouble = 3.123 -outDouble = 0 -obj.prpDouble = inDouble -outDouble= obj.prpDouble -inString = "bla" -outString = "" -obj.prpString = inString -outString = obj.prpString -inObject = obj -outObject = objNOTHING -obj.prpObject = inObject -outObject = obj.prpObject -inVariant = "bla" -outVariant = 0 -obj.prpVariant = inVariant -outVariant= obj.prpVariant -inArray = arString() -outArray = 0 -obj.prpArray = inArray() -outArray= obj.prpArray -inDate = NOW() -outDate = 0 -obj.prpDate = inDate -outDate = obj.prpDate -inCurrency = 1234.5678 -outCurrency = 0 -obj.prpCurrency = inCurrency -outCurrency = obj.prpCurrency -inSCode.Value = &h80020004 -outSCode.Value = 0 -obj.prpSCode = inSCode -outSCode = obj.prpSCode -inUnknown = objFoo -outUnknown= Nothing -obj.prpUnknown = inUnknown -outUnknown = obj.prpUnknown -inDecimal = CDec("18446744073709551615")' highest unsigned int64 -outDecimal = 0 -obj.prpDecimal = inDecimal -outDecimal = obj.prpDecimal - -If inBool <> outBool Or inByte <> outByte Or inShort <> outShort Or inLong <> outLong Or _ - inFloat <> outFloat Or inDouble <> outDouble Or inString <> outString Or _ - inVariant <> outVariant Or NOT equalUnoObjects(inObject, outObject) Or _ - NOT equalArrays(inArray, outArray) Or inDate <> outDate Or inCurrency <> outCurrency Or _ - inSCode.Value <> outSCode.Value Or Not equalUnoObjects(inUnknown, outUnknown) Or _ - inDecimal <> outDecimal Then - runtest = -1 - Exit Function -End If - -' ref parameter ------------------------------------------------------------------------ -obj.inLong(0) -inLong = 123 -outLong = 0 -obj.inLong(0) -obj.inrefLong(inLong) -obj.outLong(outLong) -inVariant = "bla" -outVariant = 0 -obj.inVariant(0) -obj.inrefVariant(inVariant) -obj.outVariant(outVariant) -If inLong <> outLong Or inVariant <> outVariant Then - runtest = -1 - Exit Function -End If - -outLong = 0 -obj.prprefLong = inLong -outLong = obj.prprefLong -outVariant = 0 -obj.prprefVariant = inVariant -outVariant = obj.prprefVariant -If inLong <> outLong Or inVariant <> outVariant Then - runtest = -1 - Exit Function -End If - - -'vararg -------------------------------------------------------------------------------- -inLong=1 -inLong2 = 2 -inLong3 = 3 -obj.varargfunc1(inLong) -outArray = 0 -outLong = 0 -obj.varargfunc2(outLong, outArray) -If inLong <> outLong Then - runtest = -1 - Exit Function -End If -len1 = UBound(outArray) - LBound(outArray) +1 -If len1 <> 0 Then - runtest = -1 - Exit Function -End If -outArray = 0 -obj.varargfunc1(inLong, inLong2, inLong3) -obj.varargfunc2(outLong, outArray) -len1 = UBound(outArray) - LBound(outArray) +1 -If len1 <> 2 Or outArray(0) <> inLong2 Or outArray(1) <> inLong3 Then - runtest = -1 - Exit Function -End If - - -'defaultvalue --------------------------------------------------------------------------- -inLong = 0 -inFloat = 0 -inVariant = 0 -inVariant2 = 0 -'defaults are: 1, 2, 4 -'The third parameter is a VARIANT with a default value of 4. COM gives it the type BSTR -obj.defaultvalue1() -obj.defaultvalue2(inLong, inFloat, inVariant) -If inLong <> 1 Or inFloat <> 2 Or inVariant <> "4" Then - runtest = -1 - Exit Function -End If -inLong = 10 -inFloat = 11 -inLong2 = inLong -inFloat2 = inFloat -inVariant = 0 -inVariant = 0 -obj.defaultvalue1(inLong, inFloat) -obj.defaultvalue2(inLong, inFloat, inVariant) -If inLong <> inLong2 Or inFloat <> inFloat2 Or inVariant <> "4" Then - runtest = -1 - Exit Function -End If - -'optional parameters ---------------------------------------------------------------- -inLong = 100 -outLong = 0 -obj.optional1(inLong) -obj.optional2(outLong) -If inLong <> outLong Then - runtest = -1 - Exit Function -End If - -inLong2 = 101 -outLong2 = 0 -obj.optional1(inLong, inLong2) -obj.optional2(outLong, outLong2) -If inLong <> outLong AND inLong2 <> outLong2 Then - runtest = -1 - Exit Function -End If - -inLong2 = 101 -outLong2 = 0 -obj.optional1(inLong, inLong2) -obj.optional1(inLong) -obj.optional2(outLong, outLong2) -If inLong <> outLong AND inLong2 <> outLong2 Then - runtest = -1 - Exit Function -End If - -inLong = 10 -inLong2 = 100 -outLong = 5 -outLong2 = 6 -obj.optional3() -obj.optional3(inLong, inLong2) -obj.optional4(outLong, outLong2) 'outLong = 10, outLong2 = 100 -If inLong <> outLong AND inLong2 <> outLong2 Then - runtest = -1 - Exit Function -End If -inLong = 10 -inLong2 = 100 -inLong3 = inLong -inLong4 = inLong2 -obj.optional4(inLong, inLong) -outLong = 0 -outLong2 = 0 -obj.optional5(outLong, outLong2) -If inLong3 <> outLong AND inLong4 <> outLong2 Then - runtest = -1 - Exit Function -End If - -inLong = 10 -outLong = 5 -obj.optional3(inLong) -obj.optional4(outLong) -If inLong <> outLong Then - runtest = -1 - Exit Function -End If -inLong = 10 -inLong2 = inLong -outLong = 0 -obj.optional4(inLong) -obj.optional5(outLong) -If inLong2 <> outLong Then - runtest = -1 - Exit Function -End If - -'named arguments------------------------------------------------------------------------- -'all args As named args, different order -obj.optional6(0, 0, 0, 0) -inLong = 1 -inLong2 = 2 -inLong3 = 3 -inLong4 = 4 -obj.optional6(val4:= inLong4, val3:=inLong3, val2:=inLong2, val1:= inLong) -Dim outLong3 As Long -Dim outLong4 As Long -outLong = 0 -outLong2 = 0 -outLong3 = 0 -outLong4 = 0 -obj.optional7(outLong, outLong2, outLong3, outLong4) -If inLong <> outLong Or inLong2 <> outLong2 _ - Or inLong3 <> outLong3 Or inLong4 <> outLong4 Then - runtest = -1 - Exit Function -End If - -'mixed positional and named args with omitted args -Dim scode_paramNotFound As New com.sun.star.bridge.oleautomation.SCode -scode_paramNotFound.Value = &h80020004 - -obj.optional6(0, 0, 0, 0) -'val1 and val3 will be DISP_E_PARAMNOTFOUND -obj.optional6(, inLong2, val4:=inLong4) -Dim outSCode1, outSCode2 -obj.optional7(outSCode, outLong2, outSCode2, outLong4) -If outSCode.Value <> scode_paramNotFound.Value Or inLong2 <> outLong2 _ - Or outSCode2.Value <> scode_paramNotFound.Value Or inLong4 <> outLong4 Then - runtest = -1 - Exit Function -End If - -'mixed positional and named args with ommitted args as out -args -inLong = 1 -inLong2 = 2 -inLong3 = 3 -inLong4 = 4 -obj.optional6(inLong, inLong2, inLong3, inLong4) -outLong2 = 0 -outLong3 = 0 -obj.optional7(,outLong2, val3:= outLong3) -If inLong2 <> outLong2 Or inLong3 <> outLong3 Then - runtest = -1 - Exit Function -End If - -'test properties with additional arguments ------------------------------------ -inLong = 10 -inLong2 = 20 -inLong3 = 30 -outLong = 0 -outLong2 = 0 -outLong3 = 0 -obj.prpMultiArg1(0,0) = 0 -'obj.prpMultiArg1 = 0 -obj.prpMultiArg1(inLong,inLong2) = inLong3 -outLong3 = obj.prpMultiArg1(outLong, outLong2) -If outLong <> 10 Or outLong2 <> 02 Or outLong3 <> 30 Then - runtest = -1 - Exit Function -End If - -outLong = 0 -outLong2 = 0 -obj.prpMultiArg1(0,0) = 0 -obj.prpMultiArg1(1) = 3 -outLong2 = obj.prpMultiArg1(outLong) -If outLong <> 1 Or outLong2 <> 3 Then - runtest = -1 - Exit Function -End If - -outLong = 0 -outLong2 = 0 -obj.prpMultiArg1(0,0) = 0 -obj.prpMultiArg1(val2:= 1) = 3 -outLong2 = obj.prpMultiArg1(val2:=outLong) -If outLong <> 1 Or outLong2 <> 3 Then - runtest = -1 - Exit Function -End If - -outLong = -1 -outLong2 = -1 -obj.prpMultiArg2(0) = 0 -outLong = obj.prpMultiArg2GetValues(outLong, outLong2) -If outLong <> 0 Or outLong2 <> 0 Then - runtest = -1 - Exit Function -End If - - -outLong = 0 -outLong2 = 0 -obj.prpMultiArg2(1) = 2 -obj.prpMultiArg2GetValues(outLong, outLong2) -If outLong <> 1 Or outLong2 <> 2 Then - runtest = -1 - Exit Function -End If - - - -' other tests ------------------------------------------------------------------ -obj.inObject(NOTHING) -outObject = NOTHING -'bridge should return an XInterface any with null pointer -'A basic errOr should occur if this is not the case -obj.outObject(outObject) - -If Not IsNull(outObject) Then - runtest = -1 - Exit Function -End If -'Decimal passed by reference -inrefDecimal = CDec("9223372036854775807") 'highest positiv value of int64 -obj.inrefDecimal(inrefDecimal) -outrefDecimal = 0 -obj.outDecimal(outrefDecimal) -If inrefDecimal <> outrefDecimal Then - runtest = -1 - Exit Function -End If - -' Test Automation object with dual interfaces ------------------------------------ -dim dispatcher as object -dim oExplorer as object -dispatcher = createUnoService("com.sun.star.bridge.OleObjectFactory") -oExplorer = dispatcher.createInstance("InternetExplorer.Application") -If Not IsNull(oExplorer) Then - oExplorer.visible = true - oExplorer.Navigate2("http://www.openoffice.org") -Else - MsgBox("Could not perform test with Internet Explorer!") -End If - - -End Function - -'One dimensional arrays with simple types. -'lower bound must be 0 -Function equalArrays(ar1, ar2) -Dim len1 -Dim len2 -len1 = UBound(ar1) - LBound(ar1) + 1 -len2 = UBound(ar2) - LBound(ar2) + 1 -If len1 <> len2 Then - equalArrays = false - Exit Function -End If -Dim counter -FOr counter = 0 To len1 - 1 - If ar1(counter) <> ar2(counter) Then - equalArrays = false - Exit Function - End If -Next -equalArrays = true -End Function - - diff --git a/extensions/test/ole/StarBasic_OleClient/readme.txt b/extensions/test/ole/StarBasic_OleClient/readme.txt deleted file mode 100644 index 2eca8aac3..000000000 --- a/extensions/test/ole/StarBasic_OleClient/readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -oleclient.bas is a StarBasic script that uses the -"com.sun.star.bridge.OleObjectFactory" service to instantiate -the ActiveX component "AxTestComponents.Basic" and calls -functions on it. - ------------------------------------------------------------- -Requirements: - -ActiveX component: AxTestComponent.Basic must be registered. -It is contained in extensions/test/ole/AxTestComponents diff --git a/extensions/test/ole/VisualBasic/AssemblyInfo.vb b/extensions/test/ole/VisualBasic/AssemblyInfo.vb deleted file mode 100644 index e663aa549..000000000 --- a/extensions/test/ole/VisualBasic/AssemblyInfo.vb +++ /dev/null @@ -1,33 +0,0 @@ -Imports System.Reflection -Imports System.Runtime.CompilerServices -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - - -' TODO: Review the values of the assembly attributes - - - - - - - - - - -' Version information for an assembly consists of the following four values: - -' Major version -' Minor Version -' Build Number -' Revision - -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: - - - - diff --git a/extensions/test/ole/VisualBasic/Module1.vb b/extensions/test/ole/VisualBasic/Module1.vb deleted file mode 100644 index 364af6365..000000000 --- a/extensions/test/ole/VisualBasic/Module1.vb +++ /dev/null @@ -1,853 +0,0 @@ -Option Strict Off -Option Explicit On -Module Module1 - -Private objServiceManager As Object -Private objCoreReflection As Object -Private objOleTest As Object -Private objEventListener As Object -'General counter -Dim i As Integer -Dim j As Integer -Dim sError As String -Dim outHyper, inHyper, retHyper As Object - -Public Sub Main() - objServiceManager = CreateObject("com.sun.star.ServiceManager") - objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection") - ' extensions/test/ole/cpnt - objOleTest = objServiceManager.createInstance("oletest.OleTest") - ' extensions/test/ole/EventListenerSample/VBEventListener - objEventListener = CreateObject("VBasicEventListener.VBEventListener") - Debug.Print(TypeName(objOleTest)) - - - testBasics() - testHyper() - testAny() - testObjects() - testGetStruct() - ''dispose not working i103353 - 'testImplementedInterfaces() - testGetValueObject() - testArrays() - testProps() - - End Sub - Function testProps() As Object - - Dim aToolbarItemProp1 As Object - aToolbarItemProp1 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue") - Dim aToolbarItemProp2 As Object - aToolbarItemProp2 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue") - Dim aToolbarItemProp3 As Object - aToolbarItemProp3 = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue") - Dim properties(2) As Object - - aToolbarItemProp1.Name = "CommandURL" - aToolbarItemProp1.Value = "macro:///standard.module1.TestIt" - aToolbarItemProp2.Name = "Label" - aToolbarItemProp2.Value = "Test" - aToolbarItemProp3.Name = "Type" - aToolbarItemProp3.Value = 0 - - properties(0) = aToolbarItemProp1 - properties(1) = aToolbarItemProp2 - properties(2) = aToolbarItemProp3 - - - Dim dummy(-1) As Object - - Dim Desktop As Object - Desktop = objServiceManager.createInstance("com.sun.star.frame.Desktop") - Dim Doc As Object - Doc = Desktop.loadComponentFromURL("private:factory/swriter", "_blank", 2, dummy) - Dim LayoutManager As Object - LayoutManager = Doc.currentController.Frame.LayoutManager - - LayoutManager.createElement("private:resource/toolbar/user_toolbar1") - LayoutManager.showElement("private:resource/toolbar/user_toolbar1") - Dim ToolBar As Object - ToolBar = LayoutManager.getElement("private:resource/toolbar/user_toolbar1") - Dim settings As Object - settings = ToolBar.getSettings(True) - - 'the changes are here: - Dim aany As Object - aany = objServiceManager.Bridge_GetValueObject() - Call aany.Set("[]com.sun.star.beans.PropertyValue", properties) - Call settings.insertByIndex(0, aany) - Call ToolBar.setSettings(settings) - - - End Function - - - Function testBasics() As Object - ' In Parameter, simple types - '============================================ - Dim tmpVar As Object - Dim ret As Object - Dim outByte, inByte, retByte As Byte - Dim outBool, inBool, retBool As Boolean - Dim outShort, inShort, retShort As Short - Dim outUShort, inUShort, retUShort As Short - Dim outLong, inLong, retLong As Integer - Dim outULong, inULong, retULong As Integer - Dim outHyper, inHyper, retHyper As Object - Dim outUHyper, inUHyper, retUHyper As Object - Dim outFloat, inFloat, retFloat As Single - Dim outDouble, inDouble, retDouble As Double - Dim outString, inString, retString As String - Dim retChar, inChar, outChar, retChar2 As Short - Dim outCharAsString, inCharAsString, retCharAsString As String - Dim outAny, inAny, retAny As Object - Dim outType, inType, retType As Object - Dim outXInterface, inXInterface, retXInterface As Object - Dim outXInterface2, inXInterface2, retXInterface2 As Object - - - Dim outVarByte As Object - Dim outVarBool As Object - Dim outVarShort As Object - Dim outVarUShort As Object - Dim outVarLong As Object - Dim outVarULong As Object - Dim outVarFloat As Object - Dim outVarDouble As Object - Dim outVarString As Object - Dim outVarChar As Object - Dim outVarAny As Object - Dim outVarType As Object - - inByte = 10 - inBool = True - inShort = -10 - inUShort = -100 - inLong = -1000 - inHyper = CDec("-9223372036854775808") 'lowest int64 - inUHyper = CDec("18446744073709551615") ' highest unsigned int64 - inULong = 10000 - inFloat = 3.14 - inDouble = 3.14 - inString = "Hello World!" - inChar = 65 - inCharAsString = "A" - inAny = "Hello World" - inType = objServiceManager.Bridge_CreateType("[]long") - inXInterface = objCoreReflection - inXInterface2 = objEventListener - - retByte = objOleTest.in_methodByte(inByte) - retBool = objOleTest.in_methodBool(inBool) - retShort = objOleTest.in_methodShort(inShort) - retUShort = objOleTest.in_methodUShort(inUShort) - retLong = objOleTest.in_methodLong(inLong) - retULong = objOleTest.in_methodULong(inULong) - retHyper = objOleTest.in_methodHyper(inHyper) - retUHyper = objOleTest.in_methodUHyper(inUHyper) - retFloat = objOleTest.in_methodFloat(inFloat) - retDouble = objOleTest.in_methodDouble(inDouble) - retString = objOleTest.in_methodString(inString) - retChar = objOleTest.in_methodChar(inChar) - retChar2 = objOleTest.in_methodChar(inCharAsString) - retAny = objOleTest.in_methodAny(inAny) - retType = objOleTest.in_methodType(inType) - retXInterface = objOleTest.in_methodXInterface(inXInterface) ' UNO object - retXInterface2 = objOleTest.in_methodXInterface(inXInterface2) - - If retByte <> inByte Or retBool <> inBool Or retShort <> inShort Or retUShort <> inUShort _ - Or retLong <> inLong Or retULong <> inULong Or retHyper <> inHyper _ - Or retUHyper <> inUHyper Or retFloat <> inFloat Or retDouble <> inDouble _ - Or retString <> inString Or retChar <> inChar Or retChar2 <> Asc(inCharAsString) _ - Or retAny <> inAny Or Not (retType.Name = inType.Name) _ - Or inXInterface IsNot retXInterface Or inXInterface2 IsNot retXInterface2 Then - sError = "in - parameter and return value test failed" - MsgBox(sError) - - End If - - 'Out Parameter simple types - '================================================ - - - objOleTest.testout_methodByte(outByte) - objOleTest.testout_methodFloat(outFloat) - objOleTest.testout_methodDouble(outDouble) - objOleTest.testout_methodBool(outBool) - objOleTest.testout_methodShort(outShort) - objOleTest.testout_methodUShort(outUShort) - objOleTest.testout_methodLong(outLong) - objOleTest.testout_methodULong(outULong) - objOleTest.testout_methodHyper(outHyper) - objOleTest.testout_methodUHyper(outUHyper) - objOleTest.testout_methodString(outString) - objOleTest.testout_methodChar(outChar) - 'outCharAsString is a string. Therfore the returned sal_Unicode value of 65 will be converted - 'to a string "65" - objOleTest.testout_methodChar(outCharAsString) - objOleTest.testout_methodAny(outAny) - objOleTest.testout_methodType(outType) - 'objOleTest.in_methodXInterface (inXInterface) ' UNO object - Call objOleTest.in_methodXInterface(inXInterface) ' UNO object - objOleTest.testout_methodXInterface(outXInterface) - Call objOleTest.in_methodXInterface(inXInterface2) ' COM object - objOleTest.testout_methodXInterface(outXInterface2) - - If outByte <> inByte Or outFloat <> inFloat Or outDouble <> inDouble _ - Or outBool <> inBool Or outShort <> inShort Or outUShort <> inUShort _ - Or outLong <> inLong Or outULong <> inULong Or outHyper <> inHyper _ - Or outUHyper <> inUHyper Or outString <> inString Or outChar <> inChar _ - Or Not (outCharAsString = "65") Or outAny <> inAny _ - Or Not (outType.Name = inType.Name) Or inXInterface IsNot outXInterface _ - Or inXInterface2 IsNot outXInterface2 Then - - sError = "out - parameter test failed!" - MsgBox(sError) - End If - - 'Out Parameter simple types (VARIANT var) - '==================================================== - objOleTest.testout_methodByte(outVarByte) - objOleTest.testout_methodBool(outVarBool) - objOleTest.testout_methodChar(outVarChar) - objOleTest.testout_methodShort(outVarShort) - objOleTest.testout_methodUShort(outVarUShort) - objOleTest.testout_methodLong(outVarLong) - objOleTest.testout_methodULong(outVarULong) - objOleTest.testout_methodString(outVarString) - objOleTest.testout_methodFloat(outVarFloat) - objOleTest.testout_methodDouble(outVarDouble) - objOleTest.testout_methodAny(outVarAny) - objOleTest.testout_methodType(outVarType) - - If outVarByte <> inByte Or outVarBool <> inBool Or outVarChar <> inChar _ - Or outVarShort <> inShort Or outVarUShort <> inUShort _ - Or outVarLong <> inLong Or outVarULong <> inULong Or outVarString <> inString _ - Or outVarFloat <> inFloat Or outVarDouble <> inDouble Or outVarAny <> inAny _ - Or Not (outVarType.Name = inType.Name) Then - sError = "out - parameter (VARIANT) test failed!" - MsgBox(sError) - End If - - 'In/Out simple types - '============================================ - objOleTest.in_methodByte(0) - objOleTest.in_methodBool(False) - objOleTest.in_methodShort(0) - objOleTest.in_methodUShort(0) - objOleTest.in_methodLong(0) - objOleTest.in_methodULong(0) - objOleTest.in_methodHyper(0) - objOleTest.in_methodUHyper(0) - objOleTest.in_methodFloat(0) - objOleTest.in_methodDouble(0) - objOleTest.in_methodString(0) - objOleTest.in_methodChar(0) - objOleTest.in_methodAny(0) - objOleTest.in_methodType(objServiceManager.Bridge_CreateType("boolean")) - outXInterface = Nothing - Call objOleTest.in_methodXInterface(outXInterface) - - outByte = 10 - retByte = outByte - objOleTest.testinout_methodByte(retByte) - objOleTest.testinout_methodByte(retByte) - outBool = True - retBool = outBool - objOleTest.testinout_methodBool(retBool) - objOleTest.testinout_methodBool(retBool) - outShort = 10 - retShort = outShort - objOleTest.testinout_methodShort(retShort) - objOleTest.testinout_methodShort(retShort) - outUShort = 20 - retUShort = outUShort - objOleTest.testinout_methodUShort(retUShort) - objOleTest.testinout_methodUShort(retUShort) - outLong = 30 - retLong = outLong - objOleTest.testinout_methodLong(retLong) - objOleTest.testinout_methodLong(retLong) - outULong = 40 - retULong = outULong - objOleTest.testinout_methodULong(retLong) - objOleTest.testinout_methodULong(retLong) - outHyper = CDec("9223372036854775807") 'highest positiv value of int64 - retHyper = outHyper - objOleTest.testinout_methodHyper(retHyper) - objOleTest.testinout_methodHyper(retHyper) - outUHyper = CDec("18446744073709551615") 'highest value of unsigned int64 - retUHyper = outUHyper - objOleTest.testinout_methodUHyper(retUHyper) - objOleTest.testinout_methodUHyper(retUHyper) - outFloat = 3.14 - retFloat = outFloat - objOleTest.testinout_methodFloat(retFloat) - objOleTest.testinout_methodFloat(retFloat) - outDouble = 4.14 - retDouble = outDouble - objOleTest.testinout_methodDouble(retDouble) - objOleTest.testinout_methodDouble(retDouble) - outString = "Hello World!" - retString = outString - objOleTest.testinout_methodString(retString) - objOleTest.testinout_methodString(retString) - outChar = 66 - retChar = outChar - objOleTest.testinout_methodChar(retChar) - objOleTest.testinout_methodChar(retChar) - outCharAsString = "H" - retCharAsString = outCharAsString - objOleTest.testinout_methodChar(retCharAsString) - objOleTest.testinout_methodChar(retCharAsString) - outAny = "Hello World 2!" - retAny = outAny - objOleTest.testinout_methodAny(retAny) - objOleTest.testinout_methodAny(retAny) - outType = objServiceManager.Bridge_CreateType("long") - retType = outType - objOleTest.testinout_methodType(retType) - objOleTest.testinout_methodType(retType) - - outXInterface = objCoreReflection - retXInterface = outXInterface - objOleTest.testinout_methodXInterface2(retXInterface) - - If outByte <> retByte Or outBool <> retBool Or outShort <> retShort _ - Or outUShort <> retUShort Or outLong <> retLong Or outULong <> retULong _ - Or outHyper <> retHyper Or outUHyper <> outUHyper _ - Or outFloat <> retFloat Or outDouble <> retDouble _ - Or outString <> retString Or outChar <> retChar _ - Or outCharAsString <> retCharAsString _ - Or outAny <> retAny Or Not (outType.Name = retType.Name) _ - Or outXInterface IsNot retXInterface Then - sError = "in/out - parameter test failed!" - MsgBox(sError) - End If - - 'Attributes - objOleTest.AByte = inByte - retByte = 0 - retByte = objOleTest.AByte - objOleTest.AFloat = inFloat - retFloat = 0 - retFloat = objOleTest.AFloat - objOleTest.AType = inType - retType = Nothing - - retType = objOleTest.AType - - If inByte <> retByte Or inFloat <> retFloat Or Not (inType.Name = retType.Name) Then - sError = "Attributes - test failed!" - MsgBox(sError) - End If - - End Function - Function testHyper() As Object - - '====================================================================== - ' Other Hyper tests - Dim emptyVar As Object - Dim retAny As Object - - retAny = emptyVar - inHyper = CDec("9223372036854775807") 'highest positiv value of int64 - retAny = objOleTest.in_methodAny(inHyper) - sError = "hyper test failed" - If inHyper <> retAny Then - MsgBox(sError) - End If - inHyper = CDec("-9223372036854775808") 'lowest negativ value of int64 - retAny = objOleTest.in_methodAny(inHyper) - - If inHyper <> retAny Then - MsgBox(sError) - End If - inHyper = CDec("18446744073709551615") 'highest positiv value of unsigne int64 - retAny = objOleTest.in_methodAny(inHyper) - - If inHyper <> retAny Then - MsgBox(sError) - End If - inHyper = CDec(-1) - retAny = objOleTest.in_methodAny(inHyper) - If inHyper <> retAny Then - MsgBox(sError) - End If - inHyper = CDec(0) - retAny = objOleTest.in_methodAny(inHyper) - If inHyper <> retAny Then - MsgBox(sError) - End If - - '============================================================================== - - - End Function - Function testAny() As Object - Dim outVAr As Object - - 'Any test. We pass in an any as value object. If it is not correct converted - 'then the target component throws a RuntimeException - Dim lengthInAny As Integer - - lengthInAny = 10 - Dim seqLongInAny(10) As Integer - For i = 0 To lengthInAny - 1 - seqLongInAny(i) = i + 10 - Next - Dim anySeqLong As Object - anySeqLong = objOleTest.Bridge_GetValueObject() - anySeqLong.Set("[]long", seqLongInAny) - Dim anySeqRet As Object - Err.Clear() - On Error Resume Next - anySeqRet = objOleTest.other_methodAny(anySeqLong, "[]long") - - If Err.Number <> 0 Then - MsgBox("error") - End If - End Function - - Function testObjects() As Object - ' COM obj - Dim outVAr As Object - Dim retObj As Object - 'OleTest receives a COM object that implements XEventListener - 'OleTest then calls a disposing on the object. The object then will be - 'asked if it has been called - objEventListener.setQuiet(True) - objEventListener.resetDisposing() - retObj = objOleTest.in_methodInvocation(objEventListener) - Dim ret As Object - ret = objEventListener.disposingCalled - If ret = False Then - MsgBox("Error") - End If - - 'The returned object should be objEventListener, test it by calling disposing - ' takes an IDispatch as Param ( EventObject).To provide a TypeMismatch - 'we put in another IDispatch - retObj.resetDisposing() - retObj.disposing(objEventListener) - If retObj.disposingCalled = False Then - MsgBox("Error") - End If - - ' out param gives out the OleTestComponent - 'objOleTest.testout_methodXInterface retObj - 'outVAr = Null - 'retObj.testout_methodAny outVAr - 'Debug.Print "test out Interface " & CStr(outVAr) - 'If outVAr <> "I am a string in an any" Then - ' MsgBox "error" - 'End If - - - 'in out - ' in: UNO object, the same is expected as out param - ' the function expects OleTest as parameter and sets a value - - Dim myAny As Object - - - - Dim objOleTest2 As Object - objOleTest2 = objServiceManager.createInstance("oletest.OleTest") - 'Set a value - objOleTest2.AttrAny2 = "VBString " - - 'testinout_methodXInterfaces substitutes the argument with the object set in in_methodXInterface - objOleTest.AttrAny2 = "VBString this string was written in the UNO component to the inout pararmeter" - objOleTest.in_methodXInterface(objOleTest) - objOleTest.testinout_methodXInterface2(objOleTest2) - Dim tmpVar As Object - tmpVar = System.DBNull.Value - tmpVar = objOleTest2.AttrAny2 - Debug.Print("in: Uno out: the same object // " & CStr(tmpVar)) - If tmpVar <> "VBString this string was written in the UNO component to the inout pararmeter" Then - MsgBox("error") - End If - - - 'create a struct - Dim structClass As Object - structClass = objCoreReflection.forName("oletest.SimpleStruct") - Dim structInstance As Object - structClass.CreateObject(structInstance) - structInstance.message = "Now we are in VB" - Debug.Print("struct out " & structInstance.message) - If structInstance.message <> "Now we are in VB" Then - MsgBox("error") - End If - - 'put the struct into OleTest. The same struct will be returned with an added String - Dim structRet As Object - structRet = objOleTest.in_methodStruct(structInstance) - Debug.Print("struct in - return " & structRet.message) - If structRet.message <> "Now we are in VBThis string was set in OleTest" Then - MsgBox("error") - End If - - - End Function - Function testGetStruct() As Object - 'Bridge_GetStruct - '======================================================== - Dim objDocument As Object - objDocument = createHiddenDocument() - 'dispose not working i103353 - 'objDocument.dispose() - objDocument.close(True) - End Function - - Function testImplementedInterfaces() As Object - 'Bridge_ImplementedInterfaces - '================================================= - ' call an UNO function that takes an XEventListener interface - 'We provide a COM implementation (IDispatch) as EventListener - 'Open a new empty writer document - - Dim objDocument As Object - objDocument = createHiddenDocument() - objEventListener.resetDisposing() - objDocument.addEventListener(objEventListener) - objDocument.dispose() - If objEventListener.disposingCalled = False Then - MsgBox("Error") - End If - End Function - - Function testGetValueObject() As Object - 'Bridge_GetValueObject - '================================================== - Dim objVal As Object - objVal = objOleTest.Bridge_GetValueObject() - Dim arrByte(9) As Byte - Dim countvar As Integer - For countvar = 0 To 9 - arrByte(countvar) = countvar - Next countvar - - objVal.Set("[]byte", arrByte) - Dim ret As Object - ret = 0 - ret = objOleTest.methodByte(objVal) - 'Test if ret is the same array - - Dim key As Object - key = 0 - For Each key In ret - If ret(key) <> arrByte(key) Then - MsgBox("Error") - End If - Debug.Print(ret(key)) - Next key - - Dim outByte As Byte - outByte = 77 - Dim retByte As Byte - retByte = outByte - objVal.InitInOutParam("byte", retByte) - objOleTest.testinout_methodByte(objVal) - objVal.InitInOutParam("byte", retByte) - objOleTest.testinout_methodByte(objVal) - - ret = 0 - ret = objVal.Get() - Debug.Print(ret) - If ret <> outByte Then - MsgBox("error") - End If - - objVal.InitOutParam() - Dim inChar As Short - inChar = 65 - objOleTest.in_methodChar(inChar) - objOleTest.testout_methodChar(objVal) 'Returns 'A' (65) - ret = 0 - ret = objVal.Get() - Debug.Print(ret) - If ret <> inChar Then - MsgBox("error") - End If - - End Function - - Function testArrays() As Object - 'Arrays - '======================================== - Dim arrLong(2) As Integer - Dim arrObj(2) As Object - Dim countvar As Integer - For countvar = 0 To 2 - arrLong(countvar) = countvar + 10 - Debug.Print(countvar) - arrObj(countvar) = CreateObject("VBasicEventListener.VBEventListener") - arrObj(countvar).setQuiet(True) - Next - - 'Arrays always contain VARIANTS - Dim seq() As Object - seq = objOleTest.methodLong(arrLong) - - For countvar = 0 To 2 - Debug.Print(CStr(seq(countvar))) - If arrLong(countvar) <> seq(countvar) Then - MsgBox("error") - End If - Next - seq = objOleTest.methodXInterface(arrObj) - Dim tmp As Object - For countvar = 0 To 2 - seq(countvar).resetDisposing() - seq(countvar).disposing(CObj(tmp)) - If seq(countvar).disposingCalled = False Then - MsgBox("Error") - End If - Next - - 'Array containing interfaces (element type is VT_DISPATCH) - Dim arEventListener(2) As Object - For countvar = 0 To 2 - arEventListener(countvar) = CreateObject("VBasicEventListener.VBEventListener") - arEventListener(countvar).setQuiet(True) - Next - - 'The function calls disposing on the listeners - seq = objOleTest.methodXEventListeners(arEventListener) - Dim count As Object - For countvar = 0 To 2 - If arEventListener(countvar).disposingCalled = False Then - MsgBox("Error") - End If - Next - 'Array containing interfaces (element type is VT_VARIANT which contains VT_DISPATCH - Dim arEventListener2(2) As Object - For countvar = 0 To 2 - arEventListener2(countvar) = CreateObject("VBasicEventListener.VBEventListener") - arEventListener2(countvar).setQuiet(True) - Next - seq = objOleTest.methodXEventListeners(arEventListener2) - For countvar = 0 To 2 - If arEventListener2(countvar).disposingCalled = False Then - MsgBox("Error") - End If - Next - - 'Variant containing Array containing interfaces (element type is VT_VARIANT which contains VT_DISPATCH - Dim arEventListener3(2) As Object - Dim var As Object - For countvar = 0 To 2 - arEventListener3(countvar) = CreateObject("VBasicEventListener.VBEventListener") - arEventListener3(countvar).setQuiet(True) - Next - Dim varContAr As Object - varContAr = VB6.CopyArray(arEventListener3) - seq = objOleTest.methodXEventListeners(varContAr) - For countvar = 0 To 2 - If arEventListener3(countvar).disposingCalled = False Then - MsgBox("Error") - End If - Next - - 'Get a sequence created in UNO, out param is Variant ( VT_BYREF|VT_VARIANT) - Dim seqX As Object - - objOleTest.testout_methodSequence(seqX) - Dim key As Object - For Each key In seqX - Debug.Print(CStr(seqX(key))) - If seqX(key) <> key Then - MsgBox("error") - End If - Next key - 'Get a sequence created in UNO, out param is array Variant ( VT_BYREF|VT_VARIANT|VT_ARRAY) - Dim seqX2() As Object - objOleTest.testout_methodSequence(seqX2) - - For Each key In seqX2 - Debug.Print(CStr(seqX2(key))) - Next key - - 'pass it to UNO and get it back - Dim seq7() As Object - seq7 = objOleTest.methodLong(seqX) - Dim key2 As Object - For Each key2 In seq7 - Debug.Print(CStr(seq7(key2))) - If seqX2(key) <> key Then - MsgBox("error") - End If - Next key2 - - 'array with starting index != 0 - Dim seqIndex(2) As Integer - Dim seq8() As Object - Dim longVal1, longVal2 As Integer - longVal1 = 1 - longVal2 = 2 - seqIndex(1) = longVal1 - seqIndex(2) = longVal2 - 'The bridge returns a Safearray of Variants. It does not yet convert to an _ - 'array of a particular type! - 'Comparing of elements from seq8 (Object) with long values worked without _ - 'explicit cast as is necessary in VS 2008. Also arrays in VS 2008 start at _ - 'index 0 - seq8 = objOleTest.methodLong(seqIndex) - If longVal1 <> CInt(seq8(1)) And longVal2 <> CInt(seq8(2)) Then - MsgBox("error") - End If - - 'in out Array - ' arrLong is Long Array - Dim inoutVar(2) As Object - - For countvar = 0 To 2 - inoutVar(countvar) = countvar + 10 - Next - - objOleTest.testinout_methodSequence(inoutVar) - - countvar = 0 - For countvar = 0 To 2 - Debug.Print(CStr(inoutVar(countvar))) - If inoutVar(countvar) <> countvar + 11 Then - MsgBox("error") - End If - Next - - 'Multidimensional array - '============================================================ - ' Sequence< Sequence > methodSequence( Sequence< Sequence long> >) - ' Real multidimensional array Array - ' 9 is Dim 1 (least significant) with C API - Dim mulAr(9, 1) As Integer - For i = 0 To 1 - For j = 0 To 9 - mulAr(j, i) = i * 10 + j - Next j - Next i - - Dim resMul As Object - resMul = objOleTest.methodSequence(mulAr) - - Dim countDim1 As Integer - Dim countDim2 As Integer - Dim arr As Object - For countDim2 = 0 To 1 - arr = resMul(countDim2) - For countDim1 = 0 To 9 - Debug.Print(arr(countDim1)) - If arr(countDim1) <> mulAr(countDim1, countDim2) Then - MsgBox("Error Multidimensional Array") - End If - Next countDim1 - Next countDim2 - IsArray(resMul) - - 'Array of VARIANTs containing arrays - Dim mulAr2(1) As Object - Dim arr2(9) As Integer - For i = 0 To 1 - ' Dim arr(9) As Long - For j = 0 To 9 - arr2(j) = i * 10 + j - Next j - mulAr2(i) = VB6.CopyArray(arr2) - Next i - - resMul = 0 - resMul = objOleTest.methodSequence(mulAr2) - arr = 0 - Dim tmpVar As Object - For countDim2 = 0 To 1 - arr = resMul(countDim2) - tmpVar = mulAr2(countDim2) - For countDim1 = 0 To 9 - Debug.Print(arr(countDim1)) - If arr(countDim1) <> tmpVar(countDim1) Then - MsgBox("Error Multidimensional Array") - End If - Next countDim1 - Next countDim2 - - 'Array containing interfaces (element type is VT_DISPATCH) - Dim arArEventListener(1, 2) As Object - For i = 0 To 1 - For j = 0 To 2 - arArEventListener(i, j) = CreateObject("VBasicEventListener.VBEventListener") - arArEventListener(i, j).setQuiet(True) - Next - Next - 'The function calls disposing on the listeners - seq = objOleTest.methodXEventListenersMul(arArEventListener) - For i = 0 To 1 - For j = 0 To 2 - If arArEventListener(i, j).disposingCalled = False Then - MsgBox("Error") - End If - Next - Next - - 'Array containing interfaces (element type is VT_VARIANT containing VT_DISPATCH) - Dim arArEventListener2(1, 2) As Object - For i = 0 To 1 - For j = 0 To 2 - arArEventListener2(i, j) = CreateObject("VBasicEventListener.VBEventListener") - arArEventListener2(i, j).setQuiet(True) - Next - Next - 'The function calls disposing on the listeners - seq = objOleTest.methodXEventListenersMul(arArEventListener2) - For i = 0 To 1 - For j = 0 To 2 - If arArEventListener2(i, j).disposingCalled = False Then - MsgBox("Error") - End If - Next - Next - - ' SAFEARRAY of VARIANTS containing SAFEARRAYs - 'The ultimate element type is VT_DISPATCH ( XEventListener) - Dim arEventListener4(1) As Object - Dim seq1(2) As Object - Dim seq2(2) As Object - For i = 0 To 2 - seq1(i) = CreateObject("VBasicEventListener.VBEventListener") - seq2(i) = CreateObject("VBasicEventListener.VBEventListener") - seq1(i).setQuiet(True) - seq2(i).setQuiet(True) - Next - arEventListener4(0) = VB6.CopyArray(seq1) - arEventListener4(1) = VB6.CopyArray(seq2) - 'The function calls disposing on the listeners - seq = objOleTest.methodXEventListenersMul(arEventListener4) - For i = 0 To 2 - If seq1(i).disposingCalled = False Or seq2(i).disposingCalled = False Then - MsgBox("Error") - End If - Next - - End Function - - Function createHiddenDocument() As Object - 'Try to create a hidden document - Dim objPropValue As Object - objPropValue = objOleTest.Bridge_GetStruct("com.sun.star.beans.PropertyValue") - 'Set the members. If this fails then there is an Error - objPropValue.Name = "Hidden" - objPropValue.Handle = -1 - objPropValue.Value = True - - 'create a hidden document - 'Create the Desktop - Dim objDesktop As Object - objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop") - 'Open a new empty writer document - Dim args(0) As Object - args(0) = objPropValue - createHiddenDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args) - End Function -End Module diff --git a/extensions/test/ole/VisualBasic/Project1.sln b/extensions/test/ole/VisualBasic/Project1.sln deleted file mode 100644 index ffff24e8d..000000000 --- a/extensions/test/ole/VisualBasic/Project1.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Project1", "Project1.vbproj", "{F62D440E-8976-4A6D-91A8-89F09701074F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F62D440E-8976-4A6D-91A8-89F09701074F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F62D440E-8976-4A6D-91A8-89F09701074F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F62D440E-8976-4A6D-91A8-89F09701074F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F62D440E-8976-4A6D-91A8-89F09701074F}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/VisualBasic/Project1.vbproj b/extensions/test/ole/VisualBasic/Project1.vbproj deleted file mode 100644 index 213d5928c..000000000 --- a/extensions/test/ole/VisualBasic/Project1.vbproj +++ /dev/null @@ -1,90 +0,0 @@ - - - Local - WindowsFormsWithCustomSubMain - 9.0.21022 - 2.0 - {F62D440E-8976-4A6D-91A8-89F09701074F} - Debug - AnyCPU - Project1 - WinExe - Project1.Module1 - 1 - 0 - 0 - False - StarOffice - Project1 - - - - - .\bin\ - Project1.xml - True - True - True - Win32=True - x86 - 42016,42017,42018,42019,42032 - full - - - .\bin\ - Project1.xml - False - False - True - Win32=True - x86 - 42016,42017,42018,42019,42032 - none - - - - Microsoft.VisualBasic.Compatibility - - - System - - - System.Data - - - System.Drawing - - - System.Windows.Forms - - - System.XML - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - - \ No newline at end of file diff --git a/extensions/test/ole/VisualBasic/readme.txt b/extensions/test/ole/VisualBasic/readme.txt deleted file mode 100644 index 0b18430fc..000000000 --- a/extensions/test/ole/VisualBasic/readme.txt +++ /dev/null @@ -1,18 +0,0 @@ -Runs a test written in VisualBasic. If no error message appears then the test was ok. - -Requirements: -Installed office -Component oletest.Oletest (extensions/test/ole/cpnt) -Component VBasicEventListener.VBEventListener (extensions/test/ole/EventListenerSample/VBEventListener - - -OleTest is a UNO component. It needs to be registered with the office rdb. Also there are additional -types (oletest.rdb in wntmsci7/bin/) which must be merged with the rdb. -VBEventListener is an ActiveX component. The directory contains a Visual Basic Project and also -the binary VBasicEventListener.dll. This is necessary because the dll contains the type library -which is needed by VB. Otherwise VB would generate a new CLSID on a new build. -The dll must be registered on the system. This is done by -regsvr32 VBasicEventListener.dll -or -by a rebuild of the project. - diff --git a/extensions/test/ole/callUnoToJava.htm b/extensions/test/ole/callUnoToJava.htm deleted file mode 100644 index fdc690d7e..000000000 --- a/extensions/test/ole/callUnoToJava.htm +++ /dev/null @@ -1,538 +0,0 @@ - - - - -Document Title - - - - - - - -

          Object in JScript

          - -This test passes a XCallback to an UNO function of the UNO test control. -XCallback is implemented by the JScript class XCallback_Impl. The function -XCallback::func1 is then called from the UNO test control. -
          - -
          -On the UNO object the function testInterface is called which takes -a XCallback as parameter. XCallback is implemented in a JScript object.The function -returns a XSimple Interface. Then the UNO object calls XSimple::notify. This test shall -verify the correct conversion of the return value( IDispatch JScript object) to an XSimple object.
          - -
          -

          out parameter

          -The a JScript object of class XCallback_Impl is passed to the UNO OleTest Control as parameter. -According to the buttons the OleTest object calls a function on XCallback_Impl that has appropriate type -as out parameter.
          - - - - - - - - - - - - - -
          -Other test with out parameters
          - - -

          in out parameter

          - - - - - - - - - - - - - -
          -

          Attributes

          - -
          - -Other tests with inout parameters
          - -

          in parameters

          - - -

          JScript object implements several interfaces

          - - - - - - - - - diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx deleted file mode 100644 index c826a3c91..000000000 --- a/extensions/test/ole/cpnt/cpnt.cxx +++ /dev/null @@ -1,1973 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -// OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be -// undef'd in some header files -#define OPTIONAL OPTIONAL -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using namespace cppu; -using namespace osl; -using namespace oletest; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::registry; -using namespace com::sun::star::script; -using namespace com::sun::star::reflection; - -using ::rtl::OUString; - - -#define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb -#define SERVICE_NAME L"oletest.OleTest" -#define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES" -#define KEY2 L"oletest.OleTest" - -class OComponent : public WeakImplHelper7< - XTestSequence, XTestStruct, XTestOther, XTestInterfaces, - XSimple, XTestInParameters, XIdentity > -{ - Reference m_xIntIdentity; - sal_Int32 m_arrayConstructor; - Reference m_rFactory; - - Sequence m_seqByte; - Sequence m_seqFloat; - Sequence m_seqDouble; - Sequence m_seqBool; - Sequence m_seqShort; - Sequence m_seqUShort; - Sequence m_seqLong; - Sequence m_seqULong; - Sequence m_seqChar; - Sequence m_seqString; - Sequence m_seqAny; - Sequence m_seqType; - Sequence > m_seq1; - Sequence > > m_seq2; - Any m_any; - Type m_type; - Sequence > m_seqxInterface; - - sal_Int8 m_int8; - sal_uInt8 m_uint8; - sal_Int16 m_int16; - sal_uInt16 m_uint16; - sal_Int32 m_int32; - sal_uInt32 m_uint32; - sal_Int64 m_int64; - sal_uInt64 m_uint64; - float m_float; - double m_double; - OUString m_string; - sal_Unicode m_char; - sal_Bool m_bool; - Reference m_xinterface; - - sal_Int8 m_attr_int8; - sal_uInt8 m_attr_uint8; - sal_Int16 m_attr_int16; - sal_uInt16 m_attr_uint16; - sal_Int32 m_attr_int32; - sal_uInt32 m_attr_uint32; - sal_Int64 m_attr_int64; - sal_uInt64 m_attr_uint64; - float m_attr_float; - double m_attr_double; - OUString m_attr_string; - sal_Unicode m_attr_char; - sal_Bool m_attr_bool; - Any m_attr_any; - Type m_attr_type; - Reference m_attr_xinterface; - Reference m_attr_xinvocation; - -public: - OComponent( const Reference & rFactory ) : - m_rFactory( rFactory ), m_arrayConstructor(0) {} - ~OComponent(); -public: // XTestSequence - virtual Sequence SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException ); - virtual Sequence SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException ); - virtual Sequence< double > SAL_CALL methodDouble(const Sequence< double >& aSeq) throw( RuntimeException); - virtual Sequence< sal_Bool > SAL_CALL methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException ); - virtual Sequence< sal_Int16 > SAL_CALL methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException ); - virtual Sequence< sal_uInt16 > SAL_CALL methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException ); - virtual Sequence< sal_Int32 > SAL_CALL methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) ; - virtual Sequence< sal_uInt32 > SAL_CALL methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException ); - virtual Sequence< OUString > SAL_CALL methodString(const Sequence< OUString >& aSeq) throw( RuntimeException ); - virtual Sequence< sal_Unicode > SAL_CALL methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException ); - virtual Sequence< Any > SAL_CALL methodAny(const Sequence< Any >& aSeq) throw( RuntimeException ); - virtual Sequence< Type > SAL_CALL methodType(const Sequence< Type >& aSeq) throw( RuntimeException ); - virtual Sequence< Reference< XInterface > > SAL_CALL methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) ; - virtual Sequence< Sequence< sal_Int32 > > SAL_CALL methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException ); - virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) throw( RuntimeException ); - virtual Sequence< Reference > SAL_CALL methodXEventListeners( const Sequence >& aSeq) throw( RuntimeException); - virtual Sequence< Sequence > > SAL_CALL methodXEventListenersMul( const Sequence > >& aSeq ) throw (RuntimeException); - - virtual Sequence< sal_Int8 > SAL_CALL getAttrByte(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException ); - virtual Sequence< float > SAL_CALL getAttrFloat(void) throw( RuntimeException) ; - virtual void SAL_CALL setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException ); - virtual Sequence< double > SAL_CALL getAttrDouble(void) throw( RuntimeException) ; - virtual void SAL_CALL setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException ); - virtual Sequence< sal_Bool > SAL_CALL getAttrBool(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw( RuntimeException ); - virtual Sequence< sal_Int16 > SAL_CALL getAttrShort(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException ); - virtual Sequence< sal_uInt16 > SAL_CALL getAttrUShort(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException ); - virtual Sequence< sal_Int32 > SAL_CALL getAttrLong(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException ); - virtual Sequence< sal_uInt32 > SAL_CALL getAttrULong(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException ); - virtual Sequence< OUString > SAL_CALL getAttrString(void) throw(RuntimeException ); - virtual void SAL_CALL setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException ); - virtual Sequence< sal_Unicode > SAL_CALL getAttrChar(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException ); - virtual Sequence< Any > SAL_CALL getAttrAny(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException ); - virtual Sequence< Type > SAL_CALL getAttrType(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrType( const Sequence< Type >& _attrtype ) throw (RuntimeException); - virtual Sequence< Sequence< sal_Int32 > > SAL_CALL getAttrSequence(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence_) throw( RuntimeException ); - virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL getAttrSequence2(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) throw ( RuntimeException ); - virtual Sequence< Reference< XInterface > > SAL_CALL getAttrXInterface() throw(RuntimeException); - virtual void SAL_CALL setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException); - - virtual ::sal_Int8 SAL_CALL getAByte() throw (RuntimeException); - virtual void SAL_CALL setAByte( ::sal_Int8 _abyte ) throw (RuntimeException); - virtual float SAL_CALL getAFloat() throw (RuntimeException); - virtual void SAL_CALL setAFloat( float _afloat ) throw (RuntimeException); - virtual double SAL_CALL getADouble() throw (RuntimeException); - virtual void SAL_CALL setADouble( double _adouble ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL getABool() throw (RuntimeException); - virtual void SAL_CALL setABool( ::sal_Bool _abool ) throw (RuntimeException); - virtual ::sal_Int16 SAL_CALL getAShort() throw (RuntimeException); - virtual void SAL_CALL setAShort( ::sal_Int16 _ashort ) throw (RuntimeException); - virtual ::sal_uInt16 SAL_CALL getAUShort() throw (RuntimeException); - virtual void SAL_CALL setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException); - virtual ::sal_Int32 SAL_CALL getALong() throw (RuntimeException); - virtual void SAL_CALL setALong( ::sal_Int32 _along ) throw (RuntimeException); - virtual ::sal_uInt32 SAL_CALL getAULong() throw (RuntimeException); - virtual void SAL_CALL setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException); - virtual ::rtl::OUString SAL_CALL getAString() throw (RuntimeException); - virtual void SAL_CALL setAString( const ::rtl::OUString& _astring ) throw (RuntimeException); - virtual ::sal_Unicode SAL_CALL getAChar() throw (RuntimeException); - virtual void SAL_CALL setAChar( ::sal_Unicode _achar ) throw (RuntimeException); - virtual Any SAL_CALL getAAny() throw (RuntimeException); - virtual void SAL_CALL setAAny( const Any& _aany ) throw (RuntimeException); - virtual Type SAL_CALL getAType() throw (RuntimeException); - virtual void SAL_CALL setAType( const Type& _atype ) throw (RuntimeException); - virtual Reference< XInterface > SAL_CALL getAXInterface() throw (RuntimeException); - virtual void SAL_CALL setAXInterface( const Reference& _axinterface ) throw (RuntimeException); - virtual Reference SAL_CALL getAXInvocation() throw (RuntimeException); - virtual void SAL_CALL setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException); - - virtual void SAL_CALL testout_methodByte(sal_Int8& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodFloat(float& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodDouble(double& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodBool(sal_Bool& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodShort(sal_Int16& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodLong(sal_Int32& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodULong(sal_uInt32& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodHyper(sal_Int64& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodString(OUString& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodChar(sal_Unicode& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodAny(Any& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodType(Type& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ); - virtual void SAL_CALL testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException ); - virtual void SAL_CALL testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException ); - virtual void SAL_CALL testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException ); - virtual void SAL_CALL testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException); - virtual void SAL_CALL testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException); - - virtual void SAL_CALL testinout_methodByte(sal_Int8& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodFloat(float& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodDouble(double& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodBool(sal_Bool& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodShort(sal_Int16& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodLong(sal_Int32& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodString(OUString& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodAny(Any& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodType(Type& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ); - virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException); - virtual void SAL_CALL testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException); - virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ; - virtual Any SAL_CALL getAttrAny2(void) throw( RuntimeException ) ; - virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ; - - - // XTestStruct - virtual void SAL_CALL methodStruct(const Property& aProp) throw( RuntimeException ); - - virtual Property SAL_CALL retMethodStruct(void) throw( RuntimeException ); - - virtual Property SAL_CALL getAttrStruct(void) throw( RuntimeException ); - virtual void SAL_CALL setAttrStruct(const Property& AttrStruct_) throw( RuntimeException ); - virtual Property SAL_CALL methodStruct2( const Property& aProp ) throw (RuntimeException); - - // XTestOther - virtual void SAL_CALL other_methodAnyIn(const Any& rAny) throw( RuntimeException ); - virtual void SAL_CALL other_methodAnyOut(Any& rAny) throw( RuntimeException ); - virtual Any SAL_CALL other_methodAnyRet(void) throw( RuntimeException ); - virtual void SAL_CALL in_float( float val) throw ( RuntimeException); - virtual Any SAL_CALL other_methodAny( const Any& rAny, const OUString& typeInAny ) - throw (RuntimeException); - - // XTestInParameters - virtual sal_Int8 SAL_CALL in_methodByte( sal_Int8 rIn ) throw (RuntimeException); - virtual float SAL_CALL in_methodFloat( float rIn ) throw (RuntimeException); - virtual double SAL_CALL in_methodDouble( double rIn ) throw (RuntimeException); - virtual sal_Bool SAL_CALL in_methodBool( sal_Bool rIn ) throw (RuntimeException); - virtual sal_Int16 SAL_CALL in_methodShort( sal_Int16 rIn ) throw (RuntimeException); - virtual sal_uInt16 SAL_CALL in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException); - virtual sal_Int32 SAL_CALL in_methodLong( sal_Int32 rIn ) throw (RuntimeException); - virtual sal_uInt32 SAL_CALL in_methodULong( sal_uInt32 rIn ) throw (RuntimeException); - virtual sal_Int64 SAL_CALL in_methodHyper( sal_Int64 rIn ) throw (RuntimeException); - virtual sal_uInt64 SAL_CALL in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException); - virtual OUString SAL_CALL in_methodString( const OUString& rIn ) throw (RuntimeException); - virtual sal_Unicode SAL_CALL in_methodChar( sal_Unicode rIn ) throw (RuntimeException); - virtual Any SAL_CALL in_methodAny( const Any& rIn ) throw (RuntimeException); - virtual Type SAL_CALL in_methodType( const Type& rIn ) throw (RuntimeException); - virtual Reference SAL_CALL in_methodXInterface( const Reference< XInterface >& rIn ) throw (RuntimeException); - virtual Reference SAL_CALL in_methodInvocation( const Reference< XInvocation >& inv ) throw (RuntimeException); - virtual SimpleStruct SAL_CALL in_methodStruct( const SimpleStruct& aStruct ) throw (RuntimeException); - virtual void SAL_CALL in_methodAll( sal_Int8 b, float f, double d, sal_Bool boo, sal_Int16 sh, sal_uInt16 us, sal_Int32 l, sal_uInt32 ul, const OUString& s, sal_Unicode c, const Any& a, const Type& t, const Reference& inv ) throw (RuntimeException); - - // XTestInterfaces -------------------------------------------------------------------------- - virtual void SAL_CALL testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException); - virtual void SAL_CALL testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException); - // XSimple -------------------------------------------------------------------------- - void SAL_CALL func( const OUString &message) throw(::com::sun::star::uno::RuntimeException); - OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - - // XIdentity - virtual void SAL_CALL setObject( const Reference< XInterface >& val ) throw (RuntimeException); - virtual sal_Bool SAL_CALL isSame( const Reference< XInterface >& val ) throw (RuntimeException); - virtual Reference< XInterface > SAL_CALL getThis( ) throw (RuntimeException); -}; - -class EventListener: public WeakImplHelper1 -{ -public: - EventListener::EventListener(): bCalled( sal_False) - {} - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException); - - sal_Bool bCalled; -}; - - -OComponent::~OComponent() -{ -} - - -// Funktions ============================================================================== - -Reference SAL_CALL OComponent_CreateInstance( const Reference & rSMgr ) throw(RuntimeException) -{ -// Reference xService(static_cast(new OComponent( rSMgr )), UNO_QUERY); - OComponent* o= new OComponent( rSMgr ); - Reference xService(static_cast(o), UNO_QUERY); - return xService; -} - -Sequence OComponent_getSupportedServiceNames(void) -{ - Sequence aRet(1); - aRet.getArray()[0] = SERVICE_NAME;//ODataInputStream_getImplementationName(); - - return aRet; -} - - -extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) -{ - if(pRegistryKey) - { - try - { - Reference xNewKey = - reinterpret_cast( pRegistryKey)->createKey(KEY1); - xNewKey->createKey( KEY2); - return sal_True; - - } - catch(InvalidRegistryException &) - { - OSL_FAIL( "### InvalidRegistryException!\n"); - } - } - return sal_False; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - static void * pRet= NULL; - if( ! pRet) - { - OUString aImplName( OUString::createFromAscii( pImplName ) ); - if (pServiceManager && aImplName.equals( IMPL_NAME )) - { - Reference xMulFac( - reinterpret_cast< XMultiServiceFactory*>(pServiceManager)); - - Sequence seqServiceNames; - Reference xFactory = createOneInstanceFactory( xMulFac, SERVICE_NAME, - OComponent_CreateInstance, seqServiceNames); - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - } - return pRet; -} - - -// XTestSequence ============================================================================ -Sequence SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException ) -{ - sal_Int8 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException ) -{ - float _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException) -{ - double _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException) -{ - sal_Bool _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException ) -{ - sal_Int16 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException ) -{ - sal_uInt16 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) -{ - sal_Int32 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException) -{ - sal_uInt32 _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException) -{ - OUString _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++) { - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException) -{ - sal_Unicode _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} -Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException) -{ - Any _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - TypeClass _t= _x.getValueTypeClass(); - if( _t== TypeClass_STRING) - OUString s(* (rtl_uString**)_x.getValue()); - } - return aSeq; - -} - -Sequence< Type > SAL_CALL OComponent::methodType(const Sequence< Type >& aSeq) throw( RuntimeException ) -{ - Type _x; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - _x= aSeq.getConstArray()[i]; - } - return aSeq; -} - -Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) -{ - for( sal_Int32 i= 0; i < aSeq.getLength(); i++) - { - Reference xInt= aSeq[i]; - Reference xList( xInt, UNO_QUERY); - if( xList.is()) - xList->disposing( EventObject()); - } - return aSeq; -} - -Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException) -{ - sal_Int32 value; - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - const Sequence& rseq2= aSeq.getConstArray()[i]; - for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ - value= rseq2.getConstArray()[j]; - } - } - return aSeq; -} -Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) - throw( RuntimeException ) -{ - sal_Int32 value; - sal_Int32 len= aSeq.getLength(); - for( sal_Int16 i= 0; i < aSeq.getLength(); i++){ - const Sequence< Sequence >& rseq2= aSeq.getConstArray()[i]; - len= rseq2.getLength(); - - for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ - const Sequence & rseq3= rseq2.getConstArray()[j]; - len= rseq3.getLength(); - - for (sal_Int16 k= 0; k < rseq3.getLength(); k++) - value= rseq3.getConstArray()[k]; - } - } - return aSeq; -} - -Sequence< Reference< XEventListener> > SAL_CALL OComponent::methodXEventListeners( const Sequence< Reference >& aSeq) throw( RuntimeException) -{ - Reference listener; - for( int i= 0; i < aSeq.getLength(); i++) - { - listener= aSeq[i]; - - listener->disposing( EventObject() ); - } - - return aSeq; -} - -Sequence< Sequence > > SAL_CALL OComponent::methodXEventListenersMul( const Sequence > >& aSeq ) throw (RuntimeException) -{ - Reference listener; - for( int i= 0; i < aSeq.getLength(); i++) - { - Sequence > seqInner= aSeq[i]; - for( int j= 0; j < seqInner.getLength(); j++) - { - listener= seqInner[j]; - listener->disposing( EventObject() ); - } - } - return aSeq; -} - -//--------------------------------------------------------------------------------------------- - -Sequence< sal_Int8 > SAL_CALL OComponent::getAttrByte(void) throw( RuntimeException) -{ - return m_seqByte; -} -void SAL_CALL OComponent::setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException ) -{ - m_seqByte= AttrByte_; -} -Sequence< float > SAL_CALL OComponent::getAttrFloat(void) throw( RuntimeException ) -{ - return m_seqFloat; -} -void SAL_CALL OComponent::setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException ) -{ - m_seqFloat= AttrFloat_; -} - -Sequence< double > SAL_CALL OComponent::getAttrDouble(void) throw( RuntimeException ) -{ - return m_seqDouble; -} -void SAL_CALL OComponent::setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException ) -{ - m_seqDouble= AttrDouble_; -} - -Sequence< sal_Bool > SAL_CALL OComponent::getAttrBool(void) throw( RuntimeException) -{ - return m_seqBool; -} - -void SAL_CALL OComponent::setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw (RuntimeException ) -{ - m_seqBool= AttrBool_; -} - -Sequence< sal_Int16 > SAL_CALL OComponent::getAttrShort(void) throw( RuntimeException) -{ - return m_seqShort; -} -void SAL_CALL OComponent::setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException ) -{ - m_seqShort= AttrShort_; -} - -Sequence< sal_uInt16 > SAL_CALL OComponent::getAttrUShort(void) throw( RuntimeException ) -{ - return m_seqUShort; -} -void SAL_CALL OComponent::setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException ) -{ - m_seqUShort= AttrUShort_; -} - -Sequence< sal_Int32 > SAL_CALL OComponent::getAttrLong(void) throw( RuntimeException) -{ - return m_seqLong; -} -void SAL_CALL OComponent::setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException ) -{ - m_seqLong= AttrLong_; -} - -Sequence< sal_uInt32 > SAL_CALL OComponent::getAttrULong(void) throw( RuntimeException ) -{ - return m_seqULong; -} -void SAL_CALL OComponent::setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException ) -{ - m_seqULong= AttrULong_; -} - -Sequence< OUString > SAL_CALL OComponent::getAttrString(void) throw( RuntimeException ) -{ - return m_seqString; -} -void SAL_CALL OComponent::setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException ) -{ - m_seqString= AttrString_; -} - -Sequence< sal_Unicode > SAL_CALL OComponent::getAttrChar(void) throw( RuntimeException ) -{ - return m_seqChar; -} -void SAL_CALL OComponent::setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException) -{ - m_seqChar= AttrChar_; -} - -Sequence< Any > SAL_CALL OComponent::getAttrAny(void) throw( RuntimeException) -{ - return m_seqAny; -} -void SAL_CALL OComponent::setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException ) -{ - m_seqAny= AttrAny_; -} - -Sequence< Type > SAL_CALL OComponent::getAttrType(void) throw( RuntimeException ) -{ - return m_seqType; -} - -void SAL_CALL OComponent::setAttrType( const Sequence< Type >& AttrType_) throw( RuntimeException ) -{ - m_seqType = AttrType_; -} - - -Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::getAttrSequence(void) throw( RuntimeException) -{ - return m_seq1; -} -void SAL_CALL OComponent::setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence) throw(RuntimeException ) -{ - sal_Int32 x= 0; - for( sal_Int32 i=0; i < AttrSequence.getLength(); i++) - { - Sequence< sal_Int32 > seq= AttrSequence[i]; - - for ( sal_Int32 j=0; j < seq.getLength(); j++) - { - x= seq[j]; - } - } - - m_seq1= AttrSequence; -} - -Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::getAttrSequence2(void) throw( RuntimeException ) -{ - return m_seq2; -} -void SAL_CALL OComponent::setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) - throw( RuntimeException ) -{ - m_seq2= AttrSequence2_; -} - -Sequence< Reference< XInterface > > SAL_CALL OComponent::getAttrXInterface() throw(RuntimeException) -{ - return m_seqxInterface; -} -void SAL_CALL OComponent::setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException) -{ - m_seqxInterface= _attrxinterface; -} - -// ---------------------------------------------------------------------------- - -::sal_Int8 SAL_CALL OComponent::getAByte() throw (RuntimeException) -{ - return m_attr_int8; -} - -void SAL_CALL OComponent::setAByte( ::sal_Int8 _abyte ) throw (RuntimeException) -{ - m_attr_int8 = _abyte; -} - -float SAL_CALL OComponent::getAFloat() throw (RuntimeException) -{ - return m_attr_float; -} - -void SAL_CALL OComponent::setAFloat( float _afloat ) throw (RuntimeException) -{ - m_attr_float = _afloat; -} - -double SAL_CALL OComponent::getADouble() throw (RuntimeException) -{ - return m_attr_double; -} - -void SAL_CALL OComponent::setADouble( double _adouble ) throw (RuntimeException) -{ - m_attr_double = _adouble; -} - -::sal_Bool SAL_CALL OComponent::getABool() throw (RuntimeException) -{ - return m_attr_bool; -} - -void SAL_CALL OComponent::setABool( ::sal_Bool _abool ) throw (RuntimeException) -{ - m_attr_bool = _abool; -} - -::sal_Int16 SAL_CALL OComponent::getAShort() throw (RuntimeException) -{ - return m_attr_int16; -} - -void SAL_CALL OComponent::setAShort( ::sal_Int16 _ashort ) throw (RuntimeException) -{ - m_attr_int16 = _ashort; -} - -::sal_uInt16 SAL_CALL OComponent::getAUShort() throw (RuntimeException) -{ - return m_attr_uint16; -} - -void SAL_CALL OComponent::setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException) -{ - m_attr_uint16 = _aushort; -} - -::sal_Int32 SAL_CALL OComponent::getALong() throw (RuntimeException) -{ - return m_attr_int32; -} - -void SAL_CALL OComponent::setALong( ::sal_Int32 _along ) throw (RuntimeException) -{ - m_attr_int32 = _along; -} - -::sal_uInt32 SAL_CALL OComponent::getAULong() throw (RuntimeException) -{ - return m_attr_uint32;; -} - -void SAL_CALL OComponent::setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException) -{ - m_attr_uint32 = _aulong; -} - -::rtl::OUString SAL_CALL OComponent::getAString() throw (RuntimeException) -{ - return m_attr_string; -} - -void SAL_CALL OComponent::setAString( const ::rtl::OUString& _astring ) throw (RuntimeException) -{ - m_attr_string = _astring; -} - -::sal_Unicode SAL_CALL OComponent::getAChar() throw (RuntimeException) -{ - return m_attr_char; -} - -void SAL_CALL OComponent::setAChar( ::sal_Unicode _achar ) throw (RuntimeException) -{ - m_attr_char = _achar; -} - -Any SAL_CALL OComponent::getAAny() throw (RuntimeException) -{ - return m_attr_any; -} - -void SAL_CALL OComponent::setAAny( const Any& _aany ) throw (RuntimeException) -{ - m_attr_any = _aany; -} - -Type SAL_CALL OComponent::getAType() throw (RuntimeException) -{ - return m_attr_type; -} - -void SAL_CALL OComponent::setAType( const Type& _atype ) throw (RuntimeException) -{ - m_attr_type = _atype; -} - -Reference< XInterface > SAL_CALL OComponent::getAXInterface() throw (RuntimeException) -{ - return m_attr_xinterface; -} - -void SAL_CALL OComponent::setAXInterface( const Reference& _axinterface ) throw (RuntimeException) -{ - m_attr_xinterface = _axinterface; -} - -Reference SAL_CALL OComponent::getAXInvocation() throw (RuntimeException) -{ - return m_attr_xinvocation; -} - -void SAL_CALL OComponent::setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException) -{ - m_attr_xinvocation = _axinvocation; -} -//----------------------------------------------------------------------------------- -void SAL_CALL OComponent::testout_methodByte(sal_Int8& rOut) throw( RuntimeException ) -{ - rOut= m_int8; -} -void SAL_CALL OComponent::testout_methodFloat(float& rOut) throw( RuntimeException ) -{ - rOut= m_float; -} -void SAL_CALL OComponent::testout_methodDouble(double& rOut) throw( RuntimeException ) -{ - rOut= m_double; -} - -void SAL_CALL OComponent::testout_methodBool(sal_Bool& rOut) throw( RuntimeException ) -{ - rOut= m_bool; -} -void SAL_CALL OComponent::testout_methodShort(sal_Int16& rOut) throw( RuntimeException ) -{ - rOut= m_int16; -} -void SAL_CALL OComponent::testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ) -{ - rOut= m_uint16; -} -void SAL_CALL OComponent::testout_methodLong(sal_Int32& rOut) throw( RuntimeException ) -{ - rOut = m_int32; -} -void SAL_CALL OComponent::testout_methodULong(sal_uInt32& rOut) throw( RuntimeException ) -{ - rOut= m_uint32; -} -void SAL_CALL OComponent::testout_methodHyper(sal_Int64& rOut) throw( RuntimeException ) -{ - rOut = m_int64; -} - -void SAL_CALL OComponent::testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ) -{ - rOut = m_uint64; -} - -void SAL_CALL OComponent::testout_methodString(OUString& rOut) throw( RuntimeException ) -{ - rOut= m_string; -} -void SAL_CALL OComponent::testout_methodChar(sal_Unicode& rOut) throw( RuntimeException ) -{ - rOut= m_char; -} -void SAL_CALL OComponent::testout_methodAny(Any& rOut) throw( RuntimeException) -{ - rOut = m_any; -} - -void SAL_CALL OComponent::testout_methodType(Type& rOut) throw( RuntimeException ) -{ - rOut = m_type; -} - -void SAL_CALL OComponent::testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException) -{ - rOut.realloc(10); - for( sal_Int16 i= 0; i < rOut.getLength(); i++) rOut.getArray()[i]= i; -} -void SAL_CALL OComponent::testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ) -{ - rOut.realloc( 10); - for( sal_Int16 i= 0; i < rOut.getLength(); i++){ - Sequence& rseq2= rOut.getArray()[i]; - rseq2.realloc( 10); - for (sal_Int16 j= 0; j < rseq2.getLength(); j++){ - rseq2.getArray()[j]= j; - } - } -} -void SAL_CALL OComponent::testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException ) -{ - rout1= 999; - rout2= 1111; -} -void SAL_CALL OComponent::testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException ) -{ - rout1= 1111; - rout2= 1222; - rout3= L" another string"; -} -void SAL_CALL OComponent::testout_methodMulParams3(const OUString&, OUString& sout) throw( RuntimeException ) -{ - sout= L"Out Hallo!"; -} -void SAL_CALL OComponent::testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 ) throw(RuntimeException) -{ - out1= in1 + 1; - out2= in2 + 1; -} - -void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException) -{ - rOut = m_xinterface; -} - -// XTestInParameters ------------------------------------------------------------ -sal_Int8 SAL_CALL OComponent::in_methodByte( sal_Int8 rIn ) throw (RuntimeException) -{ - m_int8 = rIn; - return rIn; -} -float SAL_CALL OComponent::in_methodFloat( float rIn ) throw (RuntimeException) -{ - m_float = rIn; - return rIn; -} -double SAL_CALL OComponent::in_methodDouble( double rIn ) throw (RuntimeException) -{ - m_double = rIn; - return rIn; -} -sal_Bool SAL_CALL OComponent::in_methodBool( sal_Bool rIn ) throw (RuntimeException) -{ - m_bool = rIn; - return rIn; -} -sal_Int16 SAL_CALL OComponent::in_methodShort( sal_Int16 rIn ) throw (RuntimeException) -{ - m_int16 = rIn; - return rIn; -} -sal_uInt16 SAL_CALL OComponent::in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException) -{ - m_uint16 = rIn; - return rIn; -} -sal_Int32 SAL_CALL OComponent::in_methodLong( sal_Int32 rIn ) throw (RuntimeException) -{ - m_int32 = rIn; - return rIn; -} -sal_uInt32 SAL_CALL OComponent::in_methodULong( sal_uInt32 rIn ) throw (RuntimeException) -{ - m_uint32 = rIn; - return rIn; -} -sal_Int64 SAL_CALL OComponent::in_methodHyper( sal_Int64 rIn ) throw (RuntimeException) -{ - m_int64 = rIn; - return rIn; -} - -sal_uInt64 SAL_CALL OComponent::in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException) -{ - m_uint64 = rIn; - return rIn; -} - -OUString SAL_CALL OComponent::in_methodString( const OUString& rIn ) throw (RuntimeException) -{ - m_string = rIn; - return rIn; -} -sal_Unicode SAL_CALL OComponent::in_methodChar( sal_Unicode rIn ) throw (RuntimeException) -{ - m_char = rIn; - return rIn; -} -Any SAL_CALL OComponent::in_methodAny( const Any& rIn ) throw (RuntimeException) -{ - m_any = rIn; - return rIn; -} - -Type SAL_CALL OComponent::in_methodType( const Type& rIn ) throw (RuntimeException) -{ - m_type = rIn; - return rIn; -} - -Reference SAL_CALL OComponent::in_methodInvocation( const Reference< XInvocation >& inv ) - throw (RuntimeException) -{ - //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener -//which implements XEventListener - // extensions/test/ole/EventListenerSample - EventObject event( Reference(static_cast(this),UNO_QUERY)); - Any anyParam; - anyParam <<= event; - Sequence params( &anyParam, 1); - Sequence outIndex; - Sequence outParams; - try{ - inv->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("disposing")), - params, outIndex, outParams); - }catch(IllegalArgumentException &) { - } - catch(CannotConvertException &){ - } - catch(InvocationTargetException&) { - } - return inv; -} -Reference SAL_CALL OComponent::in_methodXInterface( const Reference& rIn ) throw (RuntimeException) -{ - m_xinterface = rIn; - return rIn; -} - -SimpleStruct SAL_CALL OComponent::in_methodStruct( const SimpleStruct& aStruct ) - throw (RuntimeException) -{ - SimpleStruct& s= const_cast(aStruct); - s.message= s.message + OUString(RTL_CONSTASCII_USTRINGPARAM( - "This string was set in OleTest")); - return aStruct; -} -void SAL_CALL OComponent::in_methodAll( - sal_Int8, float, double, sal_Bool, sal_Int16, sal_uInt16, - sal_Int32, sal_uInt32, const OUString&, sal_Unicode, - const Any&, const Type&, const Reference&) throw (RuntimeException) -{ -} - -// INOUT ----------------------------------------------------------------------------------- -void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException ) -{ - sal_Int8 tmp = rOut; - rOut = m_int8; - m_int8 = tmp; -} -void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException ) -{ - float tmp = rOut; - rOut = m_float; - m_float = tmp; -} - -void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException ) -{ - double tmp = rOut; - rOut = m_double; - m_double = tmp; -} -void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException ) -{ - sal_Bool tmp = rOut; - rOut = m_bool; - m_bool = tmp; -} -void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException ) -{ - sal_Int16 tmp= rOut; - rOut = m_int16; - m_int16 = tmp; -} -void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException ) -{ - sal_uInt16 tmp = rOut; - rOut = m_uint16; - m_uint16 = tmp; -} -void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException ) -{ - sal_Int32 tmp = rOut; - rOut = m_int32; - m_int32 = tmp; -} -void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException ) -{ - sal_uInt32 tmp = rOut; - rOut = m_uint32; - m_uint32 = tmp; -} -void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException ) -{ - sal_Int64 tmp = rOut; - rOut = m_int64; - m_int64 = tmp; -} - -void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException ) -{ - sal_uInt64 tmp = rOut; - rOut = m_uint64; - m_uint64 = tmp; -} - -void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException ) -{ - OUString tmp = rOut; - rOut = m_string; - m_string = tmp; -} -void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException) -{ - sal_Unicode tmp = rOut; - rOut = m_char; - m_char = tmp; -} -void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException) -{ - Any tmp = rOut; - rOut = m_any; - m_any = tmp; -} -void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( RuntimeException) -{ - Type tmp = rOut; - rOut = m_type; - m_type = tmp; -} - - -void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException) -{ - - sal_Int32* arr= rOut.getArray(); - for ( sal_Int32 i=0; i < rOut.getLength(); i++) - { - rOut.getArray()[i] += 1; - } -} -void SAL_CALL OComponent::testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException ) -{ - for( sal_Int32 i=0; i < rOut.getLength(); i++) - { - Sequence< sal_Int32 >& seq= rOut.getArray()[i]; - - for ( sal_Int32 j=0; j < seq.getLength(); j++) - { - seq.getArray()[j] += seq.getArray()[j]; - } - } -} - -// The parameter should implement XInvocation and a Property "value" -void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException) -{ - Any any; - any= rOut->getValue( OUString( L"value")); - OUString _s; - any >>= _s; - OUString string(L"out"); - any <<= string; - rOut->setValue( OUString(L"value"), any); - - any= rOut->getValue( OUString( L"value")); - any >>= _s; - -} - -void SAL_CALL OComponent::testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException) -{ - Reference tmp = rOut; - rOut = m_xinterface; - m_xinterface = tmp; -} -Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException ) -{ - return rIn; -} -Any SAL_CALL OComponent::getAttrAny2(void) throw( RuntimeException ) -{ - return m_any; -} -void SAL_CALL OComponent::setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) -{ - m_any= AttrAny2_; -} - - - -// XTestStruct ======================================================================================= - -void SAL_CALL OComponent::methodStruct(const Property& aProp) throw( RuntimeException ) -{ - char buff[1024]; - buff[0]= 0; - sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S", - aProp.Attributes, aProp.Handle, (const sal_Unicode*)aProp.Name); - MessageBox( NULL, A2T(buff), _T("OleTest: methodStruct"), MB_OK); -} - -Property SAL_CALL OComponent::retMethodStruct(void) throw( RuntimeException ) -{ - Property a(L"OleTest_Property", 255, getCppuType( (Reference*)0), PropertyAttribute::MAYBEVOID | - PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED | - PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY | - PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT ); - return a; -} - -Property SAL_CALL OComponent::getAttrStruct(void) throw( RuntimeException) -{ - Property a(L"OleTest_Property", 255, getCppuType( (Reference*)0), PropertyAttribute::MAYBEVOID | - PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED | - PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY | - PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT ); - return a; - -} - -void SAL_CALL OComponent::setAttrStruct(const Property& AttrStruct_) throw( RuntimeException ) -{ - char buff[1024]; - buff[0]= 0; - sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S", - AttrStruct_.Attributes, AttrStruct_.Handle, (const sal_Unicode*)AttrStruct_.Name); -// MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK); -} - -Property SAL_CALL OComponent::methodStruct2( const Property& aProp ) throw (RuntimeException) -{ - return aProp; -} - -// XTestOther ================================================================================== -void SAL_CALL OComponent::other_methodAnyIn(const Any& ) throw( RuntimeException ) -{ -} -void SAL_CALL OComponent::other_methodAnyOut(Any& rAny) throw( RuntimeException ) -{ - rAny <<= OUString(L"Ein Any"); -} - -Any SAL_CALL OComponent::other_methodAnyRet(void) throw(RuntimeException ) -{ - Any a; - a <<= OUString(L"Ein Any"); - return a; -} -void SAL_CALL OComponent::in_float( float val) throw ( RuntimeException) -{ - USES_CONVERSION; - char buff[256]; - sprintf( buff, "parameter : %f", val); - MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK); -} -Any SAL_CALL OComponent::other_methodAny( const Any& rAny, const OUString& typeInAny ) - throw (RuntimeException) -{ - Type expectedType; - typelib_TypeDescription * pDesc= NULL; - typelib_typedescription_getByName( &pDesc, typeInAny.pData ); - if( pDesc) - { - expectedType = Type( pDesc->pWeakRef ); - typelib_typedescription_release( pDesc); - } - if (rAny.getValueType() != expectedType) - throw RuntimeException(); - - return rAny; -} - -// XTestInterfaces ------------------------------------------------------------------------------------- -void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException) -{ - USES_CONVERSION; - sal_Int32 i=0; - OUString aString; - char buff[1024]; - - Reference xSimple; - SimpleStruct aSimpleStruct; - SimpleEnum aSimpleEnum; - Sequence seqAny; - Sequence< sal_Int8 > seqByte; - Any outAny; - sal_Bool aBool; - sal_Unicode aChar; - float aFloat; - double aDouble; - sal_Int8 aByte; - sal_Int16 aShort; - sal_Int32 aLong; - - switch( mode) - { - case 1: - xCallback->func1(); break; - case 2: - xSimple= xCallback->returnInterface(); - xSimple->func(L"XCallback::returnInterface"); - break; - - - case 3: - xCallback->outInterface( xSimple); - sprintf( buff, "XCallback::outInterface, value: %x", xSimple.get()); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - xSimple->func(L"XCallback::outInterface works"); - break; - case 4: - xCallback->outStruct( aSimpleStruct); - sprintf( buff,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct.message)); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 5: - xCallback->outEnum( aSimpleEnum); - sprintf( buff,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 6: - xCallback->outSeqAny( seqAny); - sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength()); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - for( i=0; i < seqAny.getLength(); i++) - { - Any any= seqAny[i]; - if( any.getValueTypeClass() == TypeClass_STRING) - { - any >>= aString; - OutputDebugStringW( aString); - } - - } - break; - case 7: - xCallback->outAny( outAny); - if( outAny.getValueTypeClass() == TypeClass_STRING) - outAny >>= aString; - sprintf( buff,"XCallback::outAny, Any : %s", W2A( aString)); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 8: - xCallback->outBool( aBool); - sprintf( buff,"XCallback::outBool, value: %d", aBool); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 9: - xCallback->outChar( aChar); - sprintf( buff,"XCallback::outChar, value: %C", aChar); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 10: - xCallback->outString( aString); - sprintf( buff,"XCallback::outString, value: %s", W2A( aString)); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 11: - xCallback->outFloat( aFloat); - sprintf( buff,"XCallback::outFloat, value: %f", aFloat); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 12: - xCallback->outDouble( aDouble); - sprintf( buff,"XCallback::outDouble, value: %f", aDouble); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 13: - xCallback->outByte( aByte); - sprintf( buff,"XCallback::outByte, value: %d", aByte); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 14: - xCallback->outShort( aShort); - sprintf( buff,"XCallback::outShort, value: %d", aShort); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 15: - xCallback->outLong( aLong); - sprintf( buff,"XCallback::outLong, value: %d", aLong); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - break; - case 18: - case 19: - case 30: - { - - long outLong= 0; - xCallback->outValuesMixed( 1111, outLong, OUString( L"in string") ); - - sprintf( buff, "oletest.testInterface: outValue: %d", outLong); - MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK); - break; - } - - case 31: - { - Reference< XSimple > xSimple; - SimpleStruct aSimpleStruct; - SimpleEnum aSimpleEnum; - Sequence seqAny; - Any aAny; - sal_Bool aBool; - sal_Unicode aChar; - OUString aString; - float aFloat; - double aDouble; - sal_Int8 aByte; - sal_Int16 aShort; - sal_Int32 aLong; - xCallback->outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, - aChar, aString, - aFloat, aDouble, - aByte, - aShort, aLong); - - MessageBox( NULL, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK); - break; - } - case 32: - { - - xCallback->outSeqByte( seqByte); - sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength()); - MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK); - for( i=0; i < seqAny.getLength(); i++) - { - Any any= seqAny[i]; - if( any.getValueTypeClass() == TypeClass_STRING) - { - any >>= aString; - OutputDebugStringW( aString); - } - } - break; - } - // ############################################################################ - // IN OUT parameter - // ############################################################################ - case 100: - { - Reference xSimple= static_cast(this); - xCallback->inoutInterface( xSimple); - xSimple->func(L"XSimple called from OleTest"); - break; - } - case 101: - { - Reference xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); - if( xRefl.is()) - { - Reference xClass= xRefl->forName(L"oletest.SimpleStruct"); - Any any; - if( xClass.is()) - xClass->createObject( any); - - if( any.getValueTypeClass() == TypeClass_STRUCT) - { - SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); - pStruct->message= OUString(RTL_CONSTASCII_USTRINGPARAM("This struct was created in OleTest")); - - SimpleStruct aStruct; - any >>= aStruct; - xCallback->inoutStruct( aStruct); - // a Struct should now contain a different message - MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK); - } - - } - break; - } - case 102: - { - SimpleEnum aEnum= SimpleEnum_B; - xCallback->inoutEnum( aEnum); - char buff[1024]; - sprintf( buff, "Enum: %d", aEnum); - MessageBox( NULL, A2T(buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 103: - { - Any arAny[3]; - arAny[0] <<= OUString( L"string 0"); - arAny[1] <<= OUString( L"string 1"); - arAny[2] <<= OUString( L"string 2"); - - Sequence< Any >seqAny( arAny, 3); - xCallback->inoutSeqAny( seqAny); - char buff[1023]; - sprintf( buff, "Sequence length: %d", seqAny.getLength()); - MessageBox( NULL,A2T(buff) , _T("OleTest in out parameter"), MB_OK); - - for( int i=0; i < seqAny.getLength(); i++) - { - Any any; - any <<= seqAny[i]; - if(any.getValueTypeClass() == TypeClass_STRING) - { - OUString str; - any >>= str; - - } - } - - break; - } - case 104: - { - Any any; - OUString s(L" OleTest"); - any <<= s; - xCallback->inoutAny(any); - if( any.getValueTypeClass() == TypeClass_STRING) - { - OUString s= *( rtl_uString**) any.getValue(); - MessageBox( NULL, W2T( s), _T("OleTest: inout value any"), MB_OK); - } - break; - } - case 105: - { - sal_Bool b= sal_True; - xCallback->inoutBool( b); - char buff[1024]; - sprintf( buff, "out value bool: %d", b); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 106: - { - sal_Unicode uc= L'A'; - xCallback->inoutChar( uc); - char buff[1024]; - sprintf( buff, "out value sal_Unicode: %C", uc); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 107: - { - OUString s(L"OleTest"); - xCallback->inoutString( s); - char buff[1024]; - sprintf( buff, "out value string: %S", s.getStr()); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 108: - { - float f= 3.14f; - xCallback->inoutFloat(f); - char buff[1024]; - sprintf( buff, "out value float: %f", f); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 109: - { - double f= 3.145; - xCallback->inoutDouble( f); - char buff[1024]; - sprintf( buff, "out value double: %g", f); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 110: - { - sal_Int8 aByte= 0xf; - xCallback->inoutByte( aByte); - char buff[1024]; - sprintf( buff, "out value sal_Int8: %d", aByte); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 111: - { - sal_Int16 aShort= 0xff; - xCallback->inoutShort( aShort); - char buff[1024]; - sprintf( buff, "out value sal_Int16: %d", aShort); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 112: - { - sal_Int32 aLong= 0xfffe; - xCallback->inoutLong( aLong); - char buff[1024]; - sprintf( buff, "out value sal_Int32: %d", aLong); - MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK); - break; - } - case 120: - { - Reference aXSimple= static_cast(this); - - SimpleStruct aStruct; - Reference xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); - if( xRefl.is()) - { - Reference xClass= xRefl->forName(L"oletest.SimpleStruct"); - Any any; - if( xClass.is()) - xClass->createObject( any); - - if( any.getValueTypeClass() == TypeClass_STRUCT) - { - SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); - pStruct->message= OUString(RTL_CONSTASCII_USTRINGPARAM("This struct was created in OleTest")); - any >>= aStruct; - } - } - - SimpleEnum aEnum= SimpleEnum_B; - - Sequence< Any > aSeq; - Any arAny[3]; - arAny[0] <<= OUString( L"string 0"); - arAny[1] <<= OUString( L"string 1"); - arAny[2] <<= OUString( L"string 2"); - aSeq = Sequence< Any >( arAny, 3); - - Any aAny; - OUString s(L" OleTest"); - aAny <<= s; - - sal_Bool aBool= sal_True; - sal_Unicode aChar= L'A'; - OUString aString( L"OleTest"); - float aFloat=3.14f; - double aDouble= 3.145; - sal_Int8 aByte= 0xf; - sal_Int16 aShort= 0xff; - sal_Int32 aLong= 0xffe; - - xCallback->inoutValuesAll( aXSimple, aStruct, aEnum, aSeq, - aAny, aBool, aChar, aString, aFloat, aDouble, - aByte, aShort, aLong ); - - aXSimple->func(L"XSimple called from OleTest"); - MessageBox( NULL, W2T(aStruct.message), _T("OleTest"), MB_OK); - - for( int i=0; i < aSeq.getLength(); i++) - { - Any any; - any <<= aSeq[i]; - if(any.getValueTypeClass() == TypeClass_STRING) - { - OUString str; - any >>= str; - - } - } - break; - } - - // ############################################################################ - // IN parameter - // ############################################################################ - - case 200: - - xCallback->inValues( L'a', 0xffffL, OUString(L" a string from OleTest")); - break; - case 201: - { - sal_Int8 arbyte[3]= { 1,2,3}; - Sequence< sal_Int8 > seq( arbyte, 3); - xCallback->inSeqByte( seq); - break; - } - case 202: - { - const int LISTENERS= 3; - Reference arListeners[LISTENERS]; - EventObject arEvents[LISTENERS]; - - for( int i= 0; i < LISTENERS; i++) - { - Reference aList= static_cast( new EventListener()); - arListeners[i]= Reference( aList, UNO_QUERY); - } - - xCallback->inSeqXEventListener(Sequence > (arListeners, LISTENERS), - Sequence(arEvents, LISTENERS)); - break; - } - - // ############################################################################ - // Call a COM object that has not been passed as parameter to a UNO component and - // hence no type information are available in the COM wrapper - // ############################################################################ - case 300: - { - Reference xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory"); - - Reference oleFact(xIntFact, UNO_QUERY); - - Reference xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); - Reference xInv( xIntCallback, UNO_QUERY); - Sequence seqIndizes; - Sequence seqOutParams; - xInv->invoke( OUString( L"outValuesAll"), Sequence(), seqIndizes, seqOutParams); - - if( seqOutParams.getLength() == 12) - { - Reference xSimple= *(XSimple**)seqOutParams[0].getValue(); - xSimple->func( L"Call from OleTest on XSimple"); - SimpleStruct aStruct; - seqOutParams[1] >>= aStruct; - SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue(); - - Sequence seqAny; - seqOutParams[3] >>= seqAny; - for( int i=0; i>= _s; - } - - Any _any= *(Any*)seqOutParams[4].getValue(); - sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue(); - sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue(); - OUString _str= *( rtl_uString**)seqOutParams[7].getValue(); - - float _f= *( float*)seqOutParams[8].getValue(); - double _d= *( double*) seqOutParams[9].getValue(); - sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue(); - sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue(); - - sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue(); - - } - break; - } - case 301: - // in / out parameter - { - Reference xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory"); - - Reference oleFact(xIntFact, UNO_QUERY); - - Reference xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); - Reference xInv( xIntCallback, UNO_QUERY); - Sequence seqIndizes; - Sequence seqOutParams; - - - Any arAny[13]; - Reference xSimple= static_cast( this); - - arAny[0] <<= xSimple; - SimpleStruct aStruct; - Reference xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY); - if( xRefl.is()) - { - Reference xClass= xRefl->forName(L"oletest.SimpleStruct"); - Any any; - if( xClass.is()) - xClass->createObject( any); - - if( any.getValueTypeClass() == TypeClass_STRUCT) - { - SimpleStruct* pStruct= ( SimpleStruct*) any.getValue(); - pStruct->message= OUString(RTL_CONSTASCII_USTRINGPARAM("This struct was created in OleTest")); - any >>= aStruct; - } - } - arAny[1] <<= aStruct; - arAny[2] <<= SimpleEnum_C; - - Any arSeqAny[3]; - arSeqAny[0] <<= OUString( L"string 0"); - arSeqAny[1] <<= OUString( L"string 1"); - arSeqAny[2] <<= OUString( L"string 2"); - - arAny[3] <<= Sequence< Any >( arAny, 3); - - OUString str(L" Ein Any param"); - arAny[4] <<= str; - arAny[5] <<= sal_False; - arAny[6] <<= L'B'; - OUString stringParam(L" a string parameter"); - arAny[7] <<= stringParam; - float _float= 3.14f; - arAny[8] <<= _float; - double _double= 3.145; - arAny[9] <<= _double; - sal_Int8 _byte= -1; - arAny[10] <<= _byte; - sal_Int16 _short= -1; - arAny[11] <<= _short; - sal_Int32 _long= -1; - arAny[12] <<= _long; -// - Sequence params( arAny, 13); - - xInv->invoke( OUString( L"inoutValuesAll"), params, seqIndizes, seqOutParams); - - if( seqOutParams.getLength() == 12) - { - Reference xSimple= *(XSimple**)seqOutParams[0].getValue(); - xSimple->func( L"Call from OleTest on XSimple"); - SimpleStruct aStruct; - seqOutParams[1] >>= aStruct; - SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue(); - - Sequence seqAny; - seqOutParams[3] >>= seqAny; - for( int i=0; i>= _s; - } - - Any _any= *(Any*)seqOutParams[4].getValue(); - sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue(); - sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue(); - OUString _str= *( rtl_uString**)seqOutParams[7].getValue(); - - float _f= *( float*)seqOutParams[8].getValue(); - double _d= *( double*) seqOutParams[9].getValue(); - sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue(); - sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue(); - - sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue(); - - } - break; - } - case 303: - { - Reference xIntFact = m_rFactory->createInstance( - L"com.sun.star.bridge.oleautomation.Factory"); - - Reference oleFact(xIntFact, UNO_QUERY); - - Reference xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback"); - Reference xInv( xIntCallback, UNO_QUERY); - Sequence seqIndizes; - Sequence seqOutParams; - - Any arAny[3]; - sal_Unicode aChar=L'a'; - arAny[0] <<= aChar; - sal_Int32 aLong= 0xffffffff; - arAny[1] <<= aLong; - OUString aString(L" a string parameter"); - arAny[2] <<= aString; - - xInv->invoke( OUString( L"inValues"), Sequence(arAny,3), seqIndizes, seqOutParams); - - break; - } - // ############################################################################ - // Attributes - // ############################################################################ - - case 400: - Reference simple= xCallback->getsimple(); - simple->func(L"OleTest calls on XSimple"); - break; - - - - - } - -} - -void SAL_CALL OComponent::setObject( const Reference< XInterface >& val ) throw (RuntimeException) -{ - m_xIntIdentity= val; -} - -sal_Bool SAL_CALL OComponent::isSame( const Reference< XInterface >& val ) throw (RuntimeException) -{ - if( m_xIntIdentity == val) - return sal_True; - else - return sal_False; -} - -Reference< XInterface > SAL_CALL OComponent::getThis( ) throw (RuntimeException) -{ - Reference ret(static_cast(this), UNO_QUERY); - return ret; -} - -void SAL_CALL EventListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (RuntimeException) -{ - bCalled= sal_True; -} - -// XSimple -------------------------------------------------------------------------- -void SAL_CALL OComponent::func( const OUString &message)throw(::com::sun::star::uno::RuntimeException) -{ - USES_CONVERSION; - - MessageBox( NULL, W2T( message.getStr()), _T("OleTest: XSimple::func"), MB_OK); -} -// XSimple -------------------------------------------------------------------------- -OUString SAL_CALL OComponent::getName()throw(::com::sun::star::uno::RuntimeException) -{ - return L"XSimple"; -} -void SAL_CALL OComponent::testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException) -{ - switch( mode) - { - case 0: - { - xSimple->func( L"OleTest is calling XSimple"); - Reference xSimple2( xSimple, UNO_QUERY); - if( xSimple2.is()) - xSimple2->func2( L"OleTest is calling XSimple2"); - Reference xSimple3( xSimple, UNO_QUERY); - if( xSimple3.is()) - xSimple3->func3( L"OleTest is calling XSimple3"); - - break; - } - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpnt/exports.dxp b/extensions/test/ole/cpnt/exports.dxp deleted file mode 100644 index 51703a046..000000000 --- a/extensions/test/ole/cpnt/exports.dxp +++ /dev/null @@ -1,2 +0,0 @@ -component_writeInfo -component_getFactory diff --git a/extensions/test/ole/cpnt/makefile.mk b/extensions/test/ole/cpnt/makefile.mk deleted file mode 100644 index 65601edd9..000000000 --- a/extensions/test/ole/cpnt/makefile.mk +++ /dev/null @@ -1,84 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME= extensions -TARGET= oletest -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -INCPRE+= -I$(ATL_INCLUDE) - -SLOFILES= \ - $(SLO)$/cpnt.obj - -SHL1TARGET= $(TARGET) - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) - -.IF "$(COMEX)"=="8" || "$(COMEX)"=="10" -.IF "$(USE_DEBUG_RUNTIME)" != "" - SHL1STDLIBS+= $(ATL_LIB)$/atlsd.lib -.ELSE - SHL1STDLIBS+= $(ATL_LIB)$/atls.lib -.ENDIF -.ENDIF - - -SHL1DEPN= -SHL1IMPLIB= i$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - - -ALLTAR : $(MISC)$/$(TARGET).cppumaker.done - - -.INCLUDE : target.mk - -ALLIDLFILES:= ..$/idl$/oletest.idl - -$(BIN)$/oletest.rdb: $(ALLIDLFILES) - idlc -I$(PRJ) -I$(SOLARIDLDIR) -O$(BIN) $? - regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)} - touch $@ - -$(MISC)$/$(TARGET).cppumaker.done: $(BIN)$/oletest.rdb - $(CPPUMAKER) -O$(INCCOM) -BUCR $< -X$(SOLARBINDIR)/types.rdb - $(TOUCH) $@ - diff --git a/extensions/test/ole/cpnt/readme.txt b/extensions/test/ole/cpnt/readme.txt deleted file mode 100644 index 46d525efb..000000000 --- a/extensions/test/ole/cpnt/readme.txt +++ /dev/null @@ -1,21 +0,0 @@ -cpnt.cxx contains a uno component that is uses to test the olebridge within a -JavaScript context. In particular it has functions using out, in/out and -sequence parameter that have to be specifically treated in JScript because they -are represented by IDispatch objects. Other clients, such as VBScript, VB and -C++ applications can also use this component for testing. -The service name is oletest.OleTest. -The uno types are also build in this folder. The idl file is in ..\idl. The -types rdb is in wntmscixx.pro\bin\oletest.rdb - -The service is used by: -OleTest.htm -JScriptNewStyle.htm -ScriptTest.html - - -Prerequisites: - -The oletest.dll must be registered, for example in the services.rdb, using -regcomp. Then the uno types contained in oletest.rdb (wntmscixx/bin) must be merged -for example in the offapi.rdb. This is done with regmerge. - diff --git a/extensions/test/ole/cppToUno/makefile.mk b/extensions/test/ole/cppToUno/makefile.mk deleted file mode 100644 index 19942030b..000000000 --- a/extensions/test/ole/cppToUno/makefile.mk +++ /dev/null @@ -1,65 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=testcppuno -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - -INCPRE+=-I$(ATL_INCLUDE) - - - -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/testcppuno.obj - -APP1STDLIBS= \ - $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(USER32LIB) \ - $(KERNEL32LIB) \ - $(OLE32LIB) \ - $(OLEAUT32LIB) \ - $(UUIDLIB) \ - $(COMDLG32LIB) \ - $(GDI32LIB) - -APP1DEF= $(MISC)$/$(APP1TARGET).def - -# --- Targets --- -.INCLUDE : target.mk diff --git a/extensions/test/ole/cppToUno/readme.txt b/extensions/test/ole/cppToUno/readme.txt deleted file mode 100644 index 1a57d8524..000000000 --- a/extensions/test/ole/cppToUno/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -testcppuno.exe currently tests the conversion of SAFEARRAYs. There is -no output from the program. Just step through the code. - -To run the test, the service oletest.OleTest ( extensions/test/ole/cpnt) -must be in the same directory as the office dlls and it must be registered -at the applicat.rdb. Also the type information must have been merged with -applicat.rdb. The program requires an office to be present. Put testcppuno -into the Office/program folder and run it there. - \ No newline at end of file diff --git a/extensions/test/ole/cppToUno/testcppuno.cxx b/extensions/test/ole/cppToUno/testcppuno.cxx deleted file mode 100644 index 2e6a442da..000000000 --- a/extensions/test/ole/cppToUno/testcppuno.cxx +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#pragma warning(disable: 4917) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::script; -using namespace com::sun::star::bridge; -using namespace com::sun::star::bridge::ModelDependent; -using namespace cppu; - -HRESULT doTest(); -bool incrementMultidimensionalIndex( - sal_Int32 dimensions, - const sal_Int32 * parDimensionLengths, - sal_Int32 * parMultidimensionalIndex); - -int SAL_CALL _tmain( int /*argc*/, _TCHAR * /*argv[]*/ ) -{ - HRESULT hr; - if( FAILED( hr=CoInitialize(NULL))) - { - _tprintf(_T("CoInitialize failed \n")); - return -1; - } - - - if( FAILED(hr=doTest())) - { - _com_error err( hr); - const TCHAR * errMsg= err.ErrorMessage(); - MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR); - } - - CoUninitialize(); - return 0; -} - - - - -HRESULT doTest() -{ - HRESULT hr= S_OK; - long j = 0; - SAFEARRAY* par; - CComDispatchDriver disp; - CComVariant result; - CComVariant param1; - CComPtr spUnkFactory; - if( SUCCEEDED( spUnkFactory.CoCreateInstance(L"com.sun.star.ServiceManager"))) - { - disp= spUnkFactory; - param1= L"oletest.OleTest"; - disp.Invoke1( L"createInstance", ¶m1, &result); - - disp= result.pdispVal; - - // disp contains now oletest.OleTest - - // one dimensional array - par= SafeArrayCreateVector( VT_UI1, 0, 5); - unsigned char arbyte[]= { 1,2,3,4,5}; - for(long i= 0; i < 5;i++) - hr= SafeArrayPutElement( par, &i, &arbyte[i]); - - result.Clear(); - param1.vt= VT_ARRAY| VT_UI1; - param1.byref= par; - disp.Invoke1(L"methodByte", ¶m1, &result); - SafeArrayDestroy( par); - - - // two dimensional array - SAFEARRAYBOUND bounds[2]; - // least significant dimension first, Dimension 1 - bounds[0].cElements= 3; - bounds[0].lLbound= 0; - // Dimension 2 - bounds[1].cElements= 2; - bounds[1].lLbound= 0; - par= SafeArrayCreate( VT_I4, 2, bounds ); - - long uBound1; - long uBound2; - hr= SafeArrayGetUBound( par, 1, &uBound1); - hr= SafeArrayGetUBound( par, 2, &uBound2); - - long index2[2]; - memset( index2, 0, 2 * sizeof( long) ); - long dimLengths[]={3,2}; - - long data; - do - { - data= index2[1] * 3 + index2[0] +1; - hr= SafeArrayPutElement( par, index2, &data); - }while( incrementMultidimensionalIndex( 2, dimLengths, index2) ); - - long* pdata; - long (*dataL)[2][3]; - hr= SafeArrayAccessData( par, (void**)&pdata); - dataL= (long(*)[2][3])pdata; - - for (long i= 0; i < 2; i ++) - { - for(long j= 0; j < 3; j++) - data= (*dataL)[i][j]; - } - hr= SafeArrayUnaccessData(par); - - result.Clear(); - param1.vt= VT_ARRAY | VT_I4; - param1.byref= par; - disp.Invoke1(L"methodSequence", ¶m1, &result); - - SAFEARRAY* arRet= result.parray; - - for(long i= 0; i < 2 ; i++) - { - CComVariant varx; - varx.Clear(); - hr= SafeArrayGetElement( arRet, &i, &varx); - SAFEARRAY* ari= varx.parray; - - for( j= 0; j < 3; j++) - { - CComVariant varj; - varj.Clear(); - hr= SafeArrayGetElement( ari, &j, &varj); - } - - - - } - SafeArrayDestroy( par); - } - - return hr; -} - -// left index is least significant -bool incrementMultidimensionalIndex( - sal_Int32 dimensions, - const sal_Int32 * parDimensionLengths, - sal_Int32 * parMultidimensionalIndex) -{ - if( dimensions < 1) - return sal_False; - - bool ret= sal_True; - bool carry= sal_True; // to get into the while loop - - sal_Int32 currentDimension= 0; //most significant is 1 - while( carry) - { - parMultidimensionalIndex[ currentDimension ]++; - // if carryover, set index to 0 and handle carry on a level above - if( parMultidimensionalIndex[ currentDimension] > (parDimensionLengths[ currentDimension] - 1)) - parMultidimensionalIndex[ currentDimension]= 0; - else - carry= sal_False; - - currentDimension ++; - // if dimensions drops below 1 and carry is set than then all indices are 0 again - // this is signalled by returning sal_False - if( currentDimension > dimensions - 1 && carry) - { - carry= sal_False; - ret= sal_False; - } - } - return ret; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpptest/cpptest.cxx b/extensions/test/ole/cpptest/cpptest.cxx deleted file mode 100644 index 9582415df..000000000 --- a/extensions/test/ole/cpptest/cpptest.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -// cpptest.cpp : Defines the entry point for the console application. -// - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 -#pragma warning(disable: 4917) -#include -#include -#include -#include - -HRESULT doTest(); - -int main(int /*argc*/, char** /*argv*/) -{ - HRESULT hr; - if( FAILED( hr=CoInitialize(NULL))) - { - _tprintf(_T("CoInitialize failed \n")); - return -1; - } - - if( FAILED(hr=doTest())) - { - _com_error err( hr); - const TCHAR * errMsg= err.ErrorMessage(); - MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR); - } - - CoUninitialize(); - return 0; -} - -HRESULT doTest() -{ - HRESULT hr; - CComPtr spUnkMgr; - - - if( FAILED(hr= spUnkMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) - return hr; - - IDispatchPtr starManager; - // var starManager=new ActiveXObject("com.sun.star.ServiceManager"); - if (FAILED(hr= starManager.CreateInstance(_T("com.sun.star.ServiceManager")))) - { - fprintf(stderr, "creating ServiceManager failed\n"); - return hr; - } - // var starDesktop=starManager.createInstance("com.sun.star.frame.Desktop"); - _variant_t varP1(L"com.sun.star.frame.Desktop"); - _variant_t varRet; - CComDispatchDriver dispMgr(starManager); - if (FAILED(hr= dispMgr.Invoke1(L"createInstance", &varP1, &varRet))) - { - fprintf(stderr,"createInstance of Desktop failed\n"); - return hr; - } - CComDispatchDriver dispDesk(varRet.pdispVal); - varP1.Clear(); - varRet.Clear(); - // var bOK=new Boolean(true); - - // var noArgs=new Array(); - // var oDoc=starDesktop.loadComponentFromURL("private:factory/swriter", "Test", 40, noArgs); - IDispatchPtr oDoc; - SAFEARRAY* ar= SafeArrayCreateVector(VT_DISPATCH, 0, 0); - _variant_t args[4]; - args[3]= _variant_t(L"private:factory/swriter"); - args[2]= _variant_t(L"Test"); - args[1]= _variant_t((long) 40); - args[0].vt= VT_ARRAY | VT_DISPATCH;; - args[0].parray= ar; - if (FAILED(hr= dispDesk.InvokeN(L"loadComponentFromURL", args, 4, &varRet))) - { - fprintf(stderr,"loadComponentFromURL failed\n"); - return hr; - } - CComDispatchDriver dispDoc(varRet.pdispVal); - varRet.Clear(); - return S_OK; - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpptest/makefile.mk b/extensions/test/ole/cpptest/makefile.mk deleted file mode 100644 index af97b63c7..000000000 --- a/extensions/test/ole/cpptest/makefile.mk +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=extensions -TARGET=cppTest -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings --- - -.INCLUDE : settings.mk - -# --- Files --- - -INCPRE+=-I$(ATL_INCLUDE) - - -APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/cppTest.obj - -APP1STDLIBS= \ - $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(USER32LIB) \ - $(KERNEL32LIB) \ - $(OLE32LIB) \ - $(OLEAUT32LIB) \ - $(UUIDLIB) \ - $(COMDLG32LIB) \ - comsupp.lib - -APP1DEF= $(MISC)\$(APP1TARGET).def - -# --- Targets --- -.INCLUDE : target.mk diff --git a/extensions/test/ole/cpptest/readme.txt b/extensions/test/ole/cpptest/readme.txt deleted file mode 100644 index 4af8cfee3..000000000 --- a/extensions/test/ole/cpptest/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -Creates the com.sun.star.ServiceManager with CoCreateInstance in a cpp program. -This little program can be used as starting point for further tests. - - -It needs uwinapi.dll, which is in the program folder of OOo (URE\bin in -OOo 3.0) diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl deleted file mode 100644 index c62c236de..000000000 --- a/extensions/test/ole/idl/oletest.idl +++ /dev/null @@ -1,308 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include -#include -#include -#include - - -module oletest -{ - -interface XTestSequence: com::sun::star::uno::XInterface -{ - sequence methodByte( [in] sequence aSeq ); - sequence methodFloat( [in] sequence aSeq); - sequence methodDouble( [in] sequence aSeq); - sequence methodBool( [in] sequence aSeq); - sequence methodShort( [in] sequence aSeq); - sequence methodUShort( [in] sequence aSeq); - sequence methodLong( [in] sequence aSeq); - sequence methodULong( [in] sequence aSeq); - sequence methodString( [in] sequence aSeq); - sequence methodChar( [in] sequence aSeq); - sequence methodAny ( [in] sequence aSeq); - sequence methodType ( [in] sequence aSeq); - sequence methodXInterface ( [in] sequence aSeq); - sequence< sequence > methodSequence( [in] sequence< sequence< long > > aSeq); - sequence< sequence > > methodSequence2( [in] sequence< sequence< sequence > > aSeq); - sequence< com::sun::star::lang::XEventListener > methodXEventListeners( [in] sequence aSeq); - sequence< sequence< com::sun::star::lang::XEventListener > > methodXEventListenersMul( [in] sequence< sequence< com::sun::star::lang::XEventListener> > aSeq); - - [attribute] sequence AttrByte; - [attribute] sequence AttrFloat; - [attribute] sequence AttrDouble; - [attribute] sequence AttrBool; - [attribute] sequence AttrShort; - [attribute] sequence AttrUShort; - [attribute] sequence AttrLong; - [attribute] sequence AttrULong; - [attribute] sequence AttrString; - [attribute] sequence AttrChar; - [attribute] sequence AttrAny; - [attribute] sequence AttrType; - [attribute] sequence< sequence > AttrSequence; - [attribute] sequence< sequence< sequence > > AttrSequence2; - [attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface; - - [attribute] byte AByte; - [attribute] float AFloat; - [attribute] double ADouble; - [attribute] boolean ABool; - [attribute] short AShort; - [attribute] unsigned short AUShort; - [attribute] long ALong; - [attribute] unsigned long AULong; - [attribute] string AString; - [attribute] char AChar; - [attribute] any AAny; - [attribute] type AType; - [attribute] com::sun::star::uno::XInterface AXInterface; - [attribute] com::sun::star::script::XInvocation AXInvocation; - - void testout_methodByte( [out] byte rOut ); - void testout_methodFloat( [out] float rOut); - void testout_methodDouble( [out] double rOut); - void testout_methodBool( [out] boolean rOut); - void testout_methodShort( [out] short rOut); - void testout_methodUShort( [out] unsigned short rOut); - void testout_methodLong( [out] long rOut); - void testout_methodULong( [out] unsigned long rOut); - void testout_methodHyper( [out] hyper rOut); - void testout_methodUHyper( [out] unsigned hyper rOut); - void testout_methodString( [out] string rOut); - void testout_methodChar( [out] char rOut); - void testout_methodAny ( [out] any rOut); - void testout_methodType ( [out] type rOut); - void testout_methodSequence( [out] sequence< long > rOut); - void testout_methodSequence2( [out] sequence < sequence< long > > rOut); - void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut); - - void testout_methodMulParams1( [out] long rout1, [out] long rout2); - void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3); - void testout_methodMulParams3( [in] string sin, [out] string sout); - void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3); - - void testinout_methodByte( [inout] byte rOut ); - void testinout_methodFloat( [inout] float rOut); - void testinout_methodDouble( [inout] double rOut); - void testinout_methodBool( [inout] boolean rOut); - void testinout_methodShort( [inout] short rOut); - void testinout_methodUShort( [inout] unsigned short rOut); - void testinout_methodLong( [inout] long rOut); - void testinout_methodULong( [inout] unsigned long rOut); - void testinout_methodHyper( [inout] hyper rOut); - void testinout_methodUHyper( [inout] unsigned hyper rOut); - void testinout_methodString( [inout] string rOut); - void testinout_methodChar( [inout] char rOut); - void testinout_methodAny ( [inout] any rOut); - void testinout_methodType ( [inout] type rOut); - void testinout_methodSequence( [inout] sequence< long > rOut); - void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut); - void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut); - void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut); - - any methodAnyTest1( [in] any rIn); - [attribute] any AttrAny2; - -}; -interface XTestStruct: com::sun::star::uno::XInterface -{ -// Method taking structs as arguments - void methodStruct( [in] com::sun::star::beans::Property aProp); -// Methods returning structs - com::sun::star::beans::Property retMethodStruct(); -// Attributes as structs - [attribute] com::sun::star::beans::Property AttrStruct; - - com::sun::star::beans::Property methodStruct2( [in] com::sun::star::beans::Property aProp); -}; - - -struct SimpleStruct -{ - string message; -}; - -interface XTestInParameters: com::sun::star::uno::XInterface -{ - byte in_methodByte( [in] byte rIn ); - float in_methodFloat( [in] float rIn); - double in_methodDouble( [in] double rIn); - boolean in_methodBool( [in] boolean rIn); - short in_methodShort( [in] short rIn); - unsigned short in_methodUShort( [in] unsigned short rIn); - long in_methodLong( [in] long rIn); - unsigned long in_methodULong( [in] unsigned long rIn); - hyper in_methodHyper( [in] hyper rIn); - unsigned hyper in_methodUHyper( [in] unsigned hyper rIn); - string in_methodString( [in] string rIn); - char in_methodChar( [in] char rIn); - any in_methodAny ( [in] any rIn); - type in_methodType ( [in] type rIn); - com::sun::star::uno::XInterface in_methodXInterface([in] com::sun::star::uno::XInterface rIn); - com::sun::star::script::XInvocation in_methodInvocation( [in] com::sun::star::script::XInvocation inv); - SimpleStruct in_methodStruct( [in] SimpleStruct aStruct); - void in_methodAll( [in] byte b, [in] float f, [in] double d, [in] boolean abool, [in]short sh, - [in] unsigned short us, [in] long l, [in] unsigned long ul, - [in] string s, [in] char c, [in] any a, [in] type t, [in] com::sun::star::script::XInvocation inv); -}; - - -enum SimpleEnum -{ - A, - B, - C -}; - -interface XTestOther: com::sun::star::uno::XInterface -{ - // Any test - void other_methodAnyIn( [in] any rAny); - void other_methodAnyOut( [out] any rAny); - any other_methodAnyRet(); - void in_float( [in] float val); - //typeInAny determines what type must be in rAny. If rAny contains - //a different type then an exception is being thrown - any other_methodAny([in] any rAny, [in] string typeInAny); -}; - - -interface XSimple: com::sun::star::uno::XInterface -{ - void func( [in] string message); - string getName(); -}; - -interface XSimple2: com::sun::star::uno::XInterface -{ - void func2( [in] string message); - string getName2(); -}; - -interface XSimple3: com::sun::star::uno::XInterface -{ - void func3( [in] string message); - string getName3(); -}; - - -interface XCallback: com::sun::star::uno::XInterface -{ - void func1(); - oletest::XSimple returnInterface(); - void outInterface( [out] oletest::XSimple outInterface); - void outStruct( [out] oletest::SimpleStruct outStruct); - void outEnum( [out] oletest::SimpleEnum outEnum); - void outSeqAny( [out] sequence outSeqAny); - void outSeqByte( [out] sequence outVal); - void outAny( [out] any outAny); - void outBool( [out] boolean outBool); - void outChar( [out] char outChar); - void outString( [out] string outString); - void outFloat( [out] float outFloat); - void outDouble( [out] double outDouble); - void outByte( [out] byte outByte); - void outShort( [out] short outShort); - void outLong( [out] long outLong); - void outValuesMixed( [in] long lval, [out] long outval, [in] string sval); - void outValuesAll( [out] oletest::XSimple outInterface, - [out] SimpleStruct outStruct , - [out] SimpleEnum outEnum, - [out] sequence outSeqAny, - [out] any outAny, - [out] boolean outBool, - [out] char outChar, - [out] string outString, - [out] float outFloat, - [out] double outDouble, - [out] byte outByte, - [out] short outShort, - [out] long outLong); -// IN OUT parameters - void inoutInterface( [inout] oletest::XSimple inoutVal); - void inoutStruct( [inout] oletest::SimpleStruct inoutVal); - void inoutEnum( [inout] oletest::SimpleEnum inoutVal); - void inoutSeqAny( [inout] sequence inoutVal); - void inoutAny( [inout] any inoutVal); - void inoutBool( [inout] boolean inoutVal); - void inoutChar( [inout] char inoutVal); - void inoutString( [inout] string inoutVal); - void inoutFloat( [inout] float inoutVal); - void inoutDouble( [inout] double inoutVal); - void inoutByte( [inout] byte inoutVal); - void inoutShort( [inout] short inoutVal); - void inoutLong( [inout] long inoutVal); - - void inoutValuesAll( [inout] oletest::XSimple aXSimple, - [inout] oletest::SimpleStruct aStruct, - [inout] oletest::SimpleEnum aEnum, - [inout] sequence aSeq, - [inout] any aAny, - [inout] boolean aBool, - [inout] char aChar, - [inout] string aString, - [inout] float aFloat, - [inout] double aDouble, - [inout] byte aByte, - [inout] short aShort, - [inout] long aLong); - - // IN parameter - - void inValues( [in] char aChar, [in] long aLong, [in] string aString); - void inSeqByte( [in] sequence val); - void inSeqXEventListener( [in] sequence listener, [in] - sequence events); - - // Attributes - [attribute] oletest::XSimple simple; - - - - -}; - -interface XTestInterfaces: com::sun::star::uno::XInterface -{ - // Any test - void testInterface( [in] oletest::XCallback xCallback, [in] long mode); - void testInterface2( [in] oletest::XSimple xSimple, [in] long mode); -}; - -interface XIdentity: com::sun::star::uno::XInterface -{ - void setObject([in] com::sun::star::uno::XInterface val); - boolean isSame( [in] com::sun::star::uno::XInterface val); - - com::sun::star::uno::XInterface getThis(); -}; - -}; // oletest - diff --git a/extensions/test/ole/unloading/makefile.mk b/extensions/test/ole/unloading/makefile.mk deleted file mode 100644 index c45163813..000000000 --- a/extensions/test/ole/unloading/makefile.mk +++ /dev/null @@ -1,70 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME= extensions -TARGET= unloadtest -TARGETTYPE=CUI -COMP1TYPELIST=$(TARGET1) - -ENABLE_EXCEPTIONS=TRUE - -USE_DEFFILE= TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -APP1NOSAL=TRUE - -APP1TARGET= $(TARGET) - -APP1OBJS= $(OBJ)$/unloadTest.obj - -APP1STDLIBS= \ - $(SALLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) - -# all: \ -# $(BINDIR) \ -# $(BINDIR)$/test.ini \ -# ALLTAR - -# $(BINDIR) : -# @@-$(MKDIR) $(BINDIR) - -# $(BINDIR)$/test.ini : .$/unloadtest.ini -# -$(GNUCOPY) .$/unloadtest.ini $(BINDIR) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - - diff --git a/extensions/test/ole/unloading/readme.txt b/extensions/test/ole/unloading/readme.txt deleted file mode 100644 index d8b467ddf..000000000 --- a/extensions/test/ole/unloading/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -This project builds a unloadtest.exe. - -Function: Tests if the unloading mechanism works with the olebrdg.dll. -In several tests, all services are created and destroyed and rtl_unloadUnusedModules is called. - -Usage: copy into the \program directory and run there. diff --git a/extensions/test/ole/unloading/unloadTest.cxx b/extensions/test/ole/unloading/unloadTest.cxx deleted file mode 100644 index ed2f141db..000000000 --- a/extensions/test/ole/unloading/unloadTest.cxx +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::cppu; -using namespace ::com::sun::star::registry; - - -sal_Bool test1(); -sal_Bool test2(); -sal_Bool test3(); -sal_Bool test4(); - -int main(int, char**) -{ - sal_Bool bTest1= test1(); - sal_Bool bTest2= test2(); - sal_Bool bTest3= test3(); - sal_Bool bTest4= test4(); - - if( bTest1 && bTest2 && bTest3 && bTest4) - printf("\n#########################\n Test was successful\n#######################\n"); - - return 0; -} - -sal_Bool test1() -{ - printf("\n Test1: com.sun.star.bridge.oleautomation.BridgeSupplier\n"); - Reference xreg= createSimpleRegistry(); - xreg->open( OUString( RTL_CONSTASCII_USTRINGPARAM("services.rdb")), - sal_False, sal_False ); - - Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); - Reference fac= context->getServiceManager(); - OUString sService1( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.BridgeSupplier")); - Reference xint1= fac->createInstanceWithContext( sService1, context); - - OUString sModule( - RTL_CONSTASCII_USTRINGPARAM("oleautobridge.uno" SAL_DLLEXTENSION)); - oslModule hMod= osl_loadModule( sModule.pData, 0); - osl_unloadModule( hMod); - - rtl_unloadUnusedModules( NULL); - - OUString sFactoryFunc( RTL_CONSTASCII_USTRINGPARAM("component_getFactory")); - void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - // true, instance alive - sal_Bool bTest1= pSymbol ? sal_True : sal_False; - - xint1=0; - rtl_unloadUnusedModules( NULL); - pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - sal_Bool bTest2= pSymbol ? sal_False : sal_True; - - Reference xcomp( context, UNO_QUERY); - xcomp->dispose(); - - return bTest2 && bTest1; -} - -sal_Bool test2() -{ - printf("Test2: com.sun.star.bridge.OleBridgeSupplierVar1\n"); - Reference xreg= createSimpleRegistry(); - xreg->open( OUString( RTL_CONSTASCII_USTRINGPARAM("services.rdb")), - sal_False, sal_False ); - - Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); - Reference fac= context->getServiceManager(); - OUString sService2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.OleBridgeSupplierVar1")); - Reference xint= fac->createInstanceWithContext( sService2, context); - - OUString sModule( - RTL_CONSTASCII_USTRINGPARAM("oleautobridge.uno" SAL_DLLEXTENSION)); - oslModule hMod= osl_loadModule( sModule.pData, 0); - osl_unloadModule( hMod); - - rtl_unloadUnusedModules( NULL); - OUString sFactoryFunc( RTL_CONSTASCII_USTRINGPARAM("component_getFactory")); - void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - // true, instance alive - sal_Bool bTest1= pSymbol ? sal_True : sal_False; - - xint=0; - rtl_unloadUnusedModules( NULL); - pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - sal_Bool bTest2= pSymbol ? sal_False : sal_True; - - Reference xcomp( context, UNO_QUERY); - xcomp->dispose(); - return bTest1 && bTest2; -} - -sal_Bool test3() -{ - printf("Test3: com.sun.star.bridge.oleautomation.Factory\n"); - Reference xreg= createSimpleRegistry(); - xreg->open( OUString( RTL_CONSTASCII_USTRINGPARAM("services.rdb")), - sal_False, sal_False ); - - Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); - - Reference fac= context->getServiceManager(); - OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.Factory")); - Reference xint= fac->createInstanceWithContext( sService, context); - - - OUString sModule( - RTL_CONSTASCII_USTRINGPARAM("oleautobridge.uno" SAL_DLLEXTENSION)); - oslModule hMod= osl_loadModule( sModule.pData, 0); - osl_unloadModule( hMod); - - rtl_unloadUnusedModules( NULL); - OUString sFactoryFunc( RTL_CONSTASCII_USTRINGPARAM("component_getFactory")); - void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - // true, instance alive - sal_Bool bTest1= pSymbol ? sal_True : sal_False; - - xint=0; - rtl_unloadUnusedModules( NULL); - pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - sal_Bool bTest2= pSymbol ? sal_False : sal_True; - - Reference xcomp( context, UNO_QUERY); - xcomp->dispose(); - - return bTest1 && bTest2; -} - -sal_Bool test4() -{ - void* pSymbol= NULL; - sal_Bool bTest1= sal_False; - sal_Bool bTest2= sal_False; - oslModule hMod= NULL; - OUString sModule( - RTL_CONSTASCII_USTRINGPARAM("oleautobridge.uno" SAL_DLLEXTENSION)); - OUString sFactoryFunc( RTL_CONSTASCII_USTRINGPARAM("component_getFactory")); - { - printf("Test4: com.sun.star.bridge.oleautomation.ApplicationRegistration\n"); - Reference xreg= createSimpleRegistry(); - xreg->open( OUString( RTL_CONSTASCII_USTRINGPARAM("services.rdb")), - sal_False, sal_False ); - - Reference< XComponentContext > context= bootstrap_InitialComponentContext(xreg); - Reference fac= context->getServiceManager(); - OUString sService4( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.ApplicationRegistration")); - Reference xint= fac->createInstanceWithContext( sService4, context); - - hMod= osl_loadModule( sModule.pData, 0); - osl_unloadModule( hMod); - - rtl_unloadUnusedModules( NULL); - void* pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - // true, instance alive - bTest1= pSymbol ? sal_True : sal_False; - // ApplicationRegistration is a one-instance-service, therefore kill service manager first - Reference xcomp( context, UNO_QUERY); - xcomp->dispose(); - - } - rtl_unloadUnusedModules( NULL); - pSymbol= osl_getSymbol( hMod,sFactoryFunc.pData); - bTest2= pSymbol ? sal_False : sal_True; - - return bTest1 && bTest2; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp deleted file mode 100644 index 36ed10edd..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// stdafx.cpp : source file that includes just the standard includes -// Test.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.h b/extensions/test/ole/unoTocomCalls/Test/StdAfx.h deleted file mode 100644 index 65fffc04c..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/StdAfx.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_) -#define AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include -#include -extern CComModule _Module; -#include -#include - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.cpp b/extensions/test/ole/unoTocomCalls/Test/Test.cpp deleted file mode 100644 index fcb121be6..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/Test.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Test.cpp : Defines the entry point for the console application. -// - -#include "stdafx.h" -#include "../XCallback_Impl/XCallback_Impl.h" -#include "../XCallback_Impl/XCallback_Impl_i.c" - -CComModule _Module; -BEGIN_OBJECT_MAP(ObjectMap) -END_OBJECT_MAP() - -HRESULT doTest(); - -int main(int argc, char* argv[]) -{ - HRESULT hr; - if( FAILED( hr=CoInitialize(NULL))) - { - _tprintf(_T("CoInitialize failed \n")); - return -1; - } - - - _Module.Init( ObjectMap, GetModuleHandle( NULL)); - - if( FAILED(hr=doTest())) - { - _com_error err( hr); - const TCHAR * errMsg= err.ErrorMessage(); - MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR); - } - - - _Module.Term(); - CoUninitialize(); - - - return 0; -} - - -HRESULT doTest() -{ - HRESULT hr= S_OK; - - CComPtr spUnk; - hr= spUnk.CoCreateInstance(L"com.sun.star.ServiceManager"); - if( FAILED( hr)) - return hr; - - CComDispatchDriver manager( spUnk); - CComVariant param( L"oletest.OleTest"); - CComVariant retVal; - hr= manager.Invoke1((LPCOLESTR)L"createInstance", ¶m, &retVal ); - - CComDispatchDriver oletest( retVal.punkVal); - - spUnk.Release(); - - hr= spUnk.CoCreateInstance(L"XCallback_Impl.Callback"); - if( FAILED( hr)) - return hr; - - CComQIPtr paramDisp(spUnk); - - - //###################################################################### - // out parameters - //###################################################################### - CComVariant param1( paramDisp); - CComVariant param2(1); - - // oletest calls XCallback::func1 - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::returnInterface - param2= 2; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outInterface - param2= 3; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outStruct - param2= 4; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outEnum - param2= 5; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outSeqAny - param2= 6; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outAny - param2= 7; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outBool - param2= 8; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outChar - param2= 9; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outString - param2= 10; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outFloat - param2= 11; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outDouble - param2= 12; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outByte - param2= 13; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outShort - param2= 14; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outLong - param2= 15; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outValuesMixed - param2= 30; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::outValuesAll - param2= 31; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - - // XCallback::outSeqByte - // Does not work currently because Sequences are always converted to - // SAFEARRAY( VARIANT) - // param2= 32; - // hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - - //###################################################################### - // in / out parameters - //###################################################################### - // XCallback::inoutInterface - param2= 100; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutStruct - param2= 101; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutEnum - param2= 102; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutSeqAny - param2= 103; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutAny - param2= 104; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutBool - param2= 105; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutChar - param2= 106; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutString - param2= 107; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutFloat - param2= 108; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutDouble - param2= 109; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutByte - param2= 110; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutShort - param2= 111; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutLong - param2= 112; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutValuesAll - param2=120; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - //###################################################################### - // in parameters - //###################################################################### - // XCallback::inValues - param2= 200; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inSeqByte - // SAFEARRAY( VARIANT) - param2= 201; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - //XCallback::inSeqXEventListener - param2= 202; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - //###################################################################### - // The UNO test component OleTest calls on XCallback_Impl.Callback directly - // that is the COM object has not been past a parameter but rather OleTest - // creates the COM object itself - //###################################################################### - // XCallback::outValuesAll - // does not work currently - param2= 300; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutValuesAll - param2= 301; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - // XCallback::inoutValues - param2= 302; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - - // XCallback::inValues - param2= 303; - hr= oletest.Invoke2(L"testInterface", ¶m1, ¶m2); - //###################################################################### - // Test a COM object which implements several interfaces. - //###################################################################### - - CComQIPtr dispSimple; - hr= dispSimple.CoCreateInstance(L"XCallback_Impl.Simple"); - CComVariant varSimple( dispSimple); - param2= 0; - hr= oletest.Invoke2(L"testInterface2", &varSimple, ¶m2); - - return hr; -} -// VARIANT CComVariant VT_UNKNOWN VT_DISPATCH V_UI1 CComDispatchDriver WINAPI - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.dsp b/extensions/test/ole/unoTocomCalls/Test/Test.dsp deleted file mode 100644 index d9ef4e865..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/Test.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=Test - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Test.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "Test - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Test - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "Test - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Test - Win32 Release" -# Name "Test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\Test.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project - diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.sln b/extensions/test/ole/unoTocomCalls/Test/Test.sln deleted file mode 100644 index 428b73625..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/Test.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcproj", "{13AE4BE8-2467-4B35-800F-154379D54C24}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13AE4BE8-2467-4B35-800F-154379D54C24}.Debug|Win32.ActiveCfg = Debug|Win32 - {13AE4BE8-2467-4B35-800F-154379D54C24}.Debug|Win32.Build.0 = Debug|Win32 - {13AE4BE8-2467-4B35-800F-154379D54C24}.Release|Win32.ActiveCfg = Release|Win32 - {13AE4BE8-2467-4B35-800F-154379D54C24}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.vcproj b/extensions/test/ole/unoTocomCalls/Test/Test.vcproj deleted file mode 100644 index f31d1ffc4..000000000 --- a/extensions/test/ole/unoTocomCalls/Test/Test.vcproj +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs deleted file mode 100644 index bc1525d7e..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs +++ /dev/null @@ -1,27 +0,0 @@ -HKCR -{ - XCallback_Impl.Basic.1 = s 'Basic Class' - { - CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}' - } - XCallback_Impl.Basic = s 'Basic Class' - { - CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}' - CurVer = s 'XCallback_Impl.Basic.1' - } - NoRemove CLSID - { - ForceRemove {A0F04CB7-8494-11D4-8335-005004526AB4} = s 'Basic Class' - { - ProgID = s 'XCallback_Impl.Basic.1' - VersionIndependentProgID = s 'XCallback_Impl.Basic' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' - } - } -} - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs deleted file mode 100644 index ee718304d..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs +++ /dev/null @@ -1,27 +0,0 @@ -HKCR -{ - XCallback_Impl.BasicTest.1 = s 'BasicTest Class' - { - CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}' - } - XCallback_Impl.BasicTest = s 'BasicTest Class' - { - CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}' - CurVer = s 'XCallback_Impl.BasicTest.1' - } - NoRemove CLSID - { - ForceRemove {A0F04CBD-8494-11D4-8335-005004526AB4} = s 'BasicTest Class' - { - ProgID = s 'XCallback_Impl.BasicTest.1' - VersionIndependentProgID = s 'XCallback_Impl.BasicTest' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' - } - } -} - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp deleted file mode 100644 index ea21a9695..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp +++ /dev/null @@ -1,514 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Callback.cpp : Implementation of CCallback -#include "stdafx.h" -#include "XCallback_Impl.h" -#include "Callback.h" - -///////////////////////////////////////////////////////////////////////////// -// CCallback - - -STDMETHODIMP CCallback::func1() -{ - MessageBox( NULL, _T("Callback::func1 called"),_T(""), MB_OK); - return S_OK; -} - -STDMETHODIMP CCallback::returnInterface(IDispatch **ppdisp) -{ - if( ! ppdisp) - return E_POINTER; - CComPtr spDisp; - spDisp.CoCreateInstance( L"XCallback_Impl.Simple"); - *ppdisp= spDisp; - (*ppdisp)->AddRef(); - return S_OK; -} - -STDMETHODIMP CCallback::outInterface(IDispatch **ppdisp) -{ -// return S_OK; - if( ! ppdisp) - return E_POINTER; - CComPtr spDisp; - spDisp.CoCreateInstance( L"XCallback_Impl.Simple"); - *ppdisp= spDisp; - (*ppdisp)->AddRef(); - -// MessageBox( NULL, _T("CCallback::outInterface"), _T(""), MB_OK); - return S_OK; -} - -STDMETHODIMP CCallback::outValuesMixed(long val, long *pval, BSTR string) -{ - USES_CONVERSION; - char buff[1024]; - *pval = val+1; - sprintf( buff, "param1: %d, param2 out: %d, param3: %S", val, *pval, string); - MessageBox( NULL, A2T(buff), A2T("XCallback_Impl.Callback"), MB_OK); - return S_OK; -} - - -STDMETHODIMP CCallback::outValuesAll( - /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp, - /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct, - /* [out] */ long __RPC_FAR *aSimpleEnum, - /* [out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *outSeq, - /* [out] */ VARIANT __RPC_FAR *varAny, - /* [out] */ VARIANT_BOOL __RPC_FAR *aBool, - /* [out] */ short __RPC_FAR *aChar, - /* [out] */ BSTR __RPC_FAR *aString, - /* [out] */ float __RPC_FAR *aFloat, - /* [out] */ double __RPC_FAR *aDouble, - /* [out] */ unsigned char __RPC_FAR *aByte, - /* [out] */ short __RPC_FAR *aShort, - /* [out] */ long __RPC_FAR *aLong) -//) -{ -// if( ! ppdisp || ! ppSimpleStruct || ! aSimpleEnum || -// ! outSeq || !varAny ||! aBool || ! aChar || -// ! aString || ! aFloat || ! aDouble || ! aByte || -// ! aShort || ! aLong || ! aUShort || ! aULong) -// return E_POINTER; - - HRESULT hr=S_OK; - hr= outInterface( ppdisp); - hr= outStruct( ppSimpleStruct); - hr= outEnum( aSimpleEnum); - hr= outSeqAny( outSeq); - hr= outAny( varAny); - hr= outBool( aBool); - hr= outChar( aChar); - hr= outString( aString); - hr= outFloat( aFloat); - hr= outDouble( aDouble); - hr= outByte( aByte); - hr= outShort( aShort); - hr= outLong( aLong); - return hr; -} - -STDMETHODIMP CCallback::outStruct(IDispatch **outStruct) -{ -// return S_OK; - if( !outStruct) - return E_POINTER; - HRESULT hr= E_FAIL; -// MessageBox( NULL, _T("CCallback::outStruct"), _T(""), MB_OK); - - CComPtr _dispMgr; - if( SUCCEEDED(hr= _dispMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) - { - CComDispatchDriver manager( _dispMgr); - CComVariant param1(L"com.sun.star.reflection.CoreReflection"); - CComVariant varRet; - hr= manager.Invoke1( L"createInstance", ¶m1, &varRet); - - CComDispatchDriver reflection( varRet.pdispVal); - param1= L"oletest.SimpleStruct"; - varRet.Clear(); - hr= reflection.Invoke1( L"forName", ¶m1, &varRet); - - CComDispatchDriver classSimpleStruct( varRet.pdispVal); - - CComPtr dispStruct; - param1.vt= VT_DISPATCH | VT_BYREF; - param1.ppdispVal= &dispStruct; - if( SUCCEEDED( hr= classSimpleStruct.Invoke1(L"createObject", ¶m1))) - { - // Set the value - CComDispatchDriver simpleStruct( dispStruct); - param1=L" this is a property string"; - hr= simpleStruct.PutPropertyByName(L"message", ¶m1); - *outStruct= dispStruct; - (*outStruct)->AddRef(); - hr= S_OK; - } - } - return hr; -} - -STDMETHODIMP CCallback::outEnum(long *outEnum) -{ - if( !outEnum) - return E_POINTER; - *outEnum= 1; - return S_OK; -} - -STDMETHODIMP CCallback::outSeqAny(LPSAFEARRAY* outSeq) -{ -// _CrtDbgBreak(); - SAFEARRAY* pArr= SafeArrayCreateVector( VT_VARIANT, 0, 3); - CComVariant var[3]; - var[0]=L" variant 0"; - var[1]=L" variant 1"; - var[2]=L"variant 2"; - for( long i=0; i<3; i++) - { - SafeArrayPutElement( pArr, &i, (void*)&var[i]); - } - - *outSeq= pArr; - return S_OK; -} - -// ATLASSERT //VT_EMPTY - - -STDMETHODIMP CCallback::outAny(VARIANT *outAny) -{ - if( ! outAny) - return E_POINTER; - outAny->vt= VT_BSTR; - outAny->bstrVal= SysAllocString( L"This is a string in a VARIANT"); - - return S_OK; -} - -STDMETHODIMP CCallback::outBool(VARIANT_BOOL *outBool) -{ - if( ! outBool) - return E_POINTER; - *outBool= VARIANT_TRUE; - return S_OK; -} - -STDMETHODIMP CCallback::outChar(short *outChar) -{ - if( !outChar) - return E_POINTER; - *outChar= (short)L'A'; - return S_OK; -} - -STDMETHODIMP CCallback::outString(BSTR *outString) -{ - if( !outString) - return E_POINTER; - *outString= SysAllocString(L"This is a BSTR"); - return S_OK; -} - -STDMETHODIMP CCallback::outFloat(float *outFloat) -{ - if( !outFloat) - return E_POINTER; - *outFloat= 3.14f; - return S_OK; -} - -STDMETHODIMP CCallback::outDouble(double *outDouble) -{ - if(!outDouble) - return E_POINTER; - - *outDouble= 3.145; - return S_OK; -} - - - -STDMETHODIMP CCallback::outShort(short *outShort) -{ - if(!outShort) - return E_POINTER; - *outShort= -1; - return S_OK; -} - -STDMETHODIMP CCallback::outLong(long *outLong) -{ - if(!outLong) - return E_POINTER; - *outLong= 0xffffffff; - return S_OK; -} - - - -STDMETHODIMP CCallback::outByte(unsigned char* outByte) -{ - if(!outByte) - return E_POINTER; - *outByte= 0xff; - return S_OK; -} - -STDMETHODIMP CCallback::inoutInterface(IDispatch **ppdisp) -{ - if( !ppdisp) - return E_POINTER; - CComDispatchDriver disp( *ppdisp); - CComVariant param1(L""); - disp.Invoke1(L"func", ¶m1); - - (*ppdisp)->Release(); - - CComPtr outDisp; - outDisp.CoCreateInstance( L"XCallback_Impl.Simple"); - *ppdisp= outDisp; - (*ppdisp)->AddRef(); - - return S_OK; -} - -STDMETHODIMP CCallback::inoutStruct(IDispatch **inoutVal) -{ - if( !inoutVal) - return E_POINTER; - HRESULT hr= S_OK; - USES_CONVERSION; - CComVariant var; - CComDispatchDriver disp( *inoutVal); - - hr= disp.GetPropertyByName(L"message", &var); - MessageBox( NULL, W2T(var.bstrVal), _T("XCallback_Impl.Callback"), MB_OK); - - (*inoutVal)->Release(); - - CComDispatchDriver dispStruct; - hr= outStruct( &dispStruct.p); - var.Clear(); - var= L"This struct was created in XCallback_Imp.Callback"; - hr= dispStruct.PutPropertyByName(L"message", &var); - - *inoutVal= dispStruct; - (*inoutVal)->AddRef(); - return hr; -} - -STDMETHODIMP CCallback::inoutEnum(long *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal= *inoutVal+1; - - return S_OK; -} - -STDMETHODIMP CCallback::inoutSeqAny(LPSAFEARRAY *pArray) -{ - if( !pArray) - return E_POINTER; - HRESULT hr= S_OK; - long lbound=0; - long ubound=0; - hr= SafeArrayGetLBound( *pArray, 1, &lbound); - hr= SafeArrayGetUBound( *pArray, 1, &ubound); - long count= ubound - lbound + 1; - - // the Array is supposet to contain variants - CComVariant var; - for( long i=0; ivt= VT_BSTR) - MessageBox( NULL, W2T( inoutVal->bstrVal), _T("XCallback_Impl.Callback"), MB_OK); - - VariantClear( inoutVal); - inoutVal->vt= VT_BSTR; - inoutVal->bstrVal=SysAllocString( L" [string] XCallback_Impl.Callback inoutAny"); - return S_OK; -} - -STDMETHODIMP CCallback::inoutBool(VARIANT_BOOL *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - - *inoutVal= *inoutVal == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE; - return S_OK; -} - -STDMETHODIMP CCallback::inoutChar(short *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - USES_CONVERSION; - char buff[256]; - sprintf( buff, "character value: %C", *inoutVal); - MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK); - *inoutVal= L'B'; - return S_OK; -} - -STDMETHODIMP CCallback::inoutString(BSTR *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - USES_CONVERSION; - MessageBox( NULL, W2T(*inoutVal), _T("XCallback_Impl.Callback"), MB_OK); - SysFreeString(*inoutVal); - *inoutVal= SysAllocString(L"a string from XCallback_Impl.Callback"); - - return S_OK; -} - -STDMETHODIMP CCallback::inoutFloat(float *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal = *inoutVal+1; - return S_OK; -} - -STDMETHODIMP CCallback::inoutDouble(double *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal= *inoutVal+1; - return S_OK; -} - -STDMETHODIMP CCallback::inoutByte(unsigned char *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal= 0xff; - return S_OK; -} - -STDMETHODIMP CCallback::inoutShort(short *inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal= -1; - return S_OK; -} - -STDMETHODIMP CCallback::inoutLong(long* inoutVal) -{ - if( !inoutVal) - return E_POINTER; - *inoutVal= 0xffffffff; - return S_OK; -} - -STDMETHODIMP CCallback::inoutValuesAll( - /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple, - /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct, - /* [out][in] */ long __RPC_FAR *aEnum, - /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq, - /* [out][in] */ VARIANT __RPC_FAR *aAny, - /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool, - /* [out][in] */ short __RPC_FAR *aChar, - /* [out][in] */ BSTR __RPC_FAR *aString, - /* [out][in] */ float __RPC_FAR *aFloat, - /* [out][in] */ double __RPC_FAR *aDouble, - /* [out][in] */ unsigned char __RPC_FAR *aByte, - /* [out][in] */ short __RPC_FAR *aShort, - /* [out][in] */ long __RPC_FAR *aLong) -{ - inoutInterface( aXSimple); - inoutStruct( aStruct); - inoutEnum( aEnum); - inoutSeqAny( aSeq); - inoutAny( aAny); - inoutBool( aBool); - inoutChar( aChar); - inoutString( aString); - inoutFloat( aFloat); - inoutDouble( aDouble); - inoutByte( aByte); - inoutShort( aShort); - inoutLong( aLong); - - return S_OK; -} - - -STDMETHODIMP CCallback::inValues(short aChar, long aLong, BSTR aString) -{ - USES_CONVERSION; - wchar_t _char= (wchar_t) aChar; - char buff[1024]; - sprintf( buff, "Parameters: char= %C, long= %d, string= %s", _char, aLong, W2A(aString)); - MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK); - return S_OK; -} - -STDMETHODIMP CCallback::outSeqByte(LPSAFEARRAY * outVal) -{ - // TODO: Add your implementation code here - - return S_OK; -} - -STDMETHODIMP CCallback::inSeqByte( LPSAFEARRAY listeners) -{ - - return S_OK; -} - -STDMETHODIMP CCallback::inSeqXEventListener( LPSAFEARRAY listeners, LPSAFEARRAY events) -{ - HRESULT hr= S_OK; - long ubound= 0; - long lbound= 0; - long count= 0; - hr= SafeArrayGetUBound( listeners, 1, &ubound); - hr= SafeArrayGetLBound( listeners, 1, &lbound); - count= ubound - lbound +1; - - // We assume thate the count of EventObjects in events is the same - for( long i = 0; i < count; i++) - { - CComVariant varListener; - CComVariant varEvent; - hr= SafeArrayGetElement( listeners, &i, &varListener); - hr= SafeArrayGetElement( events, &i, &varEvent); - if( varListener.vt == VT_DISPATCH && varEvent.vt == VT_DISPATCH) - { - CComDispatchDriver disp( varListener.pdispVal); - hr= disp.Invoke1(L"disposing", &varEvent); - } - - } - - return S_OK; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h deleted file mode 100644 index 02cb6cff4..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Callback.h : Declaration of the CCallback - -#ifndef __CALLBACK_H_ -#define __CALLBACK_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CCallback -class ATL_NO_VTABLE CCallback : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ -public: - CCallback() - { - } - -DECLARE_REGISTRY_RESOURCEID(IDR_CALLBACK) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CCallback) - COM_INTERFACE_ENTRY(ICallback) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// ICallback -public: - STDMETHOD(inSeqByte)(/*[in]*/ LPSAFEARRAY val); - STDMETHOD(inSeqXEventListener)(/*[in]*/ LPSAFEARRAY listener, LPSAFEARRAY event); - STDMETHOD(outSeqByte)(/*[out]*/ LPSAFEARRAY* outVal); - STDMETHOD(inValues)(/*[in]*/short aChar, /*[in]*/ long aLong, /*[in]*/ BSTR aString); - STDMETHOD(inoutLong)(/*[in,out]*/ long* inoutVal); - STDMETHOD(inoutShort)(/*[in,out]*/ short* inoutVal); - STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* inoutVal); - STDMETHOD(inoutDouble)(/*[in,out]*/ double* inoutVal); - STDMETHOD(inoutFloat)(/*[in,out]*/ float* inoutVal); - STDMETHOD(inoutString)(/*[in,out]*/ BSTR *inoutVal); - STDMETHOD(inoutChar)(/*[in,out]*/ short* inoutVal); - STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL * inoutVal); - STDMETHOD(inoutAny)(/*[in,out]*/ VARIANT* inoutVal); - STDMETHOD(inoutSeqAny)(/*[in,out]*/ LPSAFEARRAY* pArray); - STDMETHOD(inoutEnum)(/*[in,out]*/ long * inoutVal); - STDMETHOD(inoutStruct)(/*[in,out]*/ IDispatch** inoutVal); - STDMETHOD(inoutInterface)(/*[in,out]*/ IDispatch** ppdisp); - STDMETHOD(inoutValuesAll)( - /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple, - /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct, - /* [out][in] */ long __RPC_FAR *aEnum, - /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq, - /* [out][in] */ VARIANT __RPC_FAR *aAny, - /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool, - /* [out][in] */ short __RPC_FAR *aChar, - /* [out][in] */ BSTR __RPC_FAR *aString, - /* [out][in] */ float __RPC_FAR *aFloat, - /* [out][in] */ double __RPC_FAR *aDouble, - /* [out][in] */ unsigned char __RPC_FAR *aByte, - /* [out][in] */ short __RPC_FAR *aShort, - /* [out][in] */ long __RPC_FAR *aLong); - - STDMETHOD(outByte)( unsigned char* outByte); - STDMETHOD(outLong)(/*[out]*/ long* outLong); - STDMETHOD(outShort)(/*[out]*/ short *outShort); - STDMETHOD(outDouble)(/*[out]*/ double* outDouble); - STDMETHOD(outFloat)(/*[out]*/ float* outFloat); - STDMETHOD(outString)(/*[out]*/ BSTR * outString); - STDMETHOD(outChar)(short* outChar); - STDMETHOD(outBool)(VARIANT_BOOL* outBool); - STDMETHOD(outAny)(VARIANT* outAny); - STDMETHOD(outSeqAny)(/*[out]*/LPSAFEARRAY* outSeq); - STDMETHOD(outEnum)(/*[out]*/ long* outEnum); - STDMETHOD(outStruct)(/*[out]*/ IDispatch** outStruct); - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE outValuesAll( - /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp, - /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct, - /* [out] */ long __RPC_FAR *aSimpleEnum, - /* [out] */ LPSAFEARRAY* outSeq, - /* [out] */ VARIANT __RPC_FAR *varAny, - /* [out] */ VARIANT_BOOL __RPC_FAR *aBool, - /* [out] */ short __RPC_FAR *aChar, - /* [out] */ BSTR __RPC_FAR *aString, - /* [out] */ float __RPC_FAR *aFloat, - /* [out] */ double __RPC_FAR *aDouble, - /* [out] */ unsigned char __RPC_FAR *aByte, - /* [out] */ short __RPC_FAR *aShort, - /* [out] */ long __RPC_FAR *aLong); -// ); -// -// STDMETHOD(outValuesAll)( -// /*[out]*/ IDispatch** ppdisp, -// /*[out]*/ IUnknown** ppSimpleStruct, -// /*[out]*/ long* aSimpleEnum, -// /*[out]*/ VARIANT* ArrayAny, -// /*[out]*/ VARIANT* varAny, -// /*[out]*/ VARIANT_BOOL * aBool, -// /*[out]*/ unsigned short* aChar, -// /*[out]*/ BSTR* aString, /*[out]*/ float* aFloat, -// /*[out]*/ double* aDouble, -// /*[out]*/ signed char* aByte, /*[out]*/ short* aShort, /*[out]*/long* aLong, /*[out]*/ unsigned short* aUShort, /*[out]*/ unsigned long* aULong); - STDMETHOD(outValuesMixed)(/*[in]*/ long val, /*[out]*/ long* pval, /*[in]*/ BSTR string); - STDMETHOD(outInterface)(/*[out]*/ IDispatch** ppdisp); - STDMETHOD(returnInterface)(/*[out, retval]*/ IDispatch** ppdisp); - STDMETHOD(func1)(); -}; - -#endif //__CALLBACK_H_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs deleted file mode 100644 index b3f9e071b..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs +++ /dev/null @@ -1,27 +0,0 @@ -HKCR -{ - XCallback_Impl.Callback.1 = s 'Callback Class' - { - CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}' - } - XCallback_Impl.Callback = s 'Callback Class' - { - CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}' - CurVer = s 'XCallback_Impl.Callback.1' - } - NoRemove CLSID - { - ForceRemove {180FF560-6F5C-11D4-8330-005004526AB4} = s 'Callback Class' - { - ProgID = s 'XCallback_Impl.Callback.1' - VersionIndependentProgID = s 'XCallback_Impl.Callback' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' - } - } -} - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp deleted file mode 100644 index 34a5075db..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Simple.cpp : Implementation of CSimple -#include "stdafx.h" -#include "XCallback_Impl.h" -#include "Simple.h" - -///////////////////////////////////////////////////////////////////////////// -// CSimple - - -STDMETHODIMP CSimple::func(BSTR message) -{ - USES_CONVERSION; - MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); - return S_OK; -} - - -STDMETHODIMP CSimple::func2(BSTR message) -{ - USES_CONVERSION; - MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); - return S_OK; -} - -STDMETHODIMP CSimple::func3(BSTR message) -{ - USES_CONVERSION; - MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK); - return S_OK; -} - - -STDMETHODIMP CSimple::get__implementedInterfaces(LPSAFEARRAY *pVal) -{ - HRESULT hr= S_OK; - SAFEARRAY *pArr= SafeArrayCreateVector( VT_BSTR, 0, 3); - if( pArr) - { long index=0; - BSTR name1= SysAllocString(L"oletest.XSimple"); - BSTR name2= SysAllocString(L"oletest.XSimple2"); - BSTR name3= SysAllocString(L"oletest.XSimple3"); - - hr= SafeArrayPutElement( pArr, & index, name1); - index++; - hr= SafeArrayPutElement( pArr, &index, name2); - index++; - hr= SafeArrayPutElement( pArr, &index, name3); - *pVal= pArr; - - } - *pVal= pArr; - return S_OK; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h deleted file mode 100644 index e76795925..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// Simple.h : Declaration of the CSimple - -#ifndef __SIMPLE_H_ -#define __SIMPLE_H_ - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CSimple -class ATL_NO_VTABLE CSimple : - public CComObjectRootEx, - public CComCoClass, - public IDispatchImpl -{ -public: - CSimple() - { - } - -DECLARE_REGISTRY_RESOURCEID(IDR_SIMPLE) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CSimple) - COM_INTERFACE_ENTRY(ISimple) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - -// ISimple -public: - - STDMETHOD(get__implementedInterfaces)(/*[out, retval]*/ LPSAFEARRAY *pVal); - STDMETHOD(func3)(/*[in]*/ BSTR message); - STDMETHOD(func2)(/*[in]*/ BSTR message); - STDMETHOD(func)( BSTR message); -}; - -#endif //__SIMPLE_H_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs deleted file mode 100644 index 19237bf36..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs +++ /dev/null @@ -1,27 +0,0 @@ -HKCR -{ - XCallback_Impl.Simple.1 = s 'Simple Class' - { - CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}' - } - XCallback_Impl.Simple = s 'Simple Class' - { - CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}' - CurVer = s 'XCallback_Impl.Simple.1' - } - NoRemove CLSID - { - ForceRemove {180FF565-6F5C-11D4-8330-005004526AB4} = s 'Simple Class' - { - ProgID = s 'XCallback_Impl.Simple.1' - VersionIndependentProgID = s 'XCallback_Impl.Simple' - ForceRemove 'Programmable' - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}' - } - } -} - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp deleted file mode 100644 index 902524bdf..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#ifdef _ATL_STATIC_REGISTRY -#include -#include -#endif - -#include - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h deleted file mode 100644 index f692fae95..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_) -#define AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#include -#include -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include -#include -#include - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp deleted file mode 100644 index 78585a01b..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// XCallback_Impl.cpp : Implementation of DLL Exports. - - -// Note: Proxy/Stub Information -// To build a separate proxy/stub DLL, -// run nmake -f XCallback_Implps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include -#include "XCallback_Impl.h" - -#include "XCallback_Impl_i.c" -#include "Callback.h" -#include "Simple.h" - - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_Callback, CCallback) -OBJECT_ENTRY(CLSID_Simple, CSimple) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_XCALLBACK_IMPLLib); - DisableThreadLibraryCalls(hInstance); - } - else if (dwReason == DLL_PROCESS_DETACH) - _Module.Term(); - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def deleted file mode 100644 index b2d5e9627..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.def +++ /dev/null @@ -1,10 +0,0 @@ -; XCallback_Impl.def : Declares the module parameters. - -LIBRARY "XCallback_Impl.DLL" - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp deleted file mode 100644 index 6897d0d81..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp +++ /dev/null @@ -1,337 +0,0 @@ -# Microsoft Developer Studio Project File - Name="XCallback_Impl" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=XCallback_Impl - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "XCallback_Impl.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "XCallback_Impl.mak" CFG="XCallback_Impl - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "XCallback_Impl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XCallback_Impl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XCallback_Impl - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XCallback_Impl - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XCallback_Impl - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "XCallback_Impl - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "XCallback_Impl - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\Debug -TargetPath=.\Debug\XCallback_Impl.dll -InputPath=.\Debug\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugU" -# PROP BASE Intermediate_Dir "DebugU" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugU" -# PROP Intermediate_Dir "DebugU" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# Begin Custom Build - Performing registration -OutDir=.\DebugU -TargetPath=.\DebugU\XCallback_Impl.dll -InputPath=.\DebugU\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinSize" -# PROP BASE Intermediate_Dir "ReleaseMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinSize" -# PROP Intermediate_Dir "ReleaseMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinSize -TargetPath=.\ReleaseMinSize\XCallback_Impl.dll -InputPath=.\ReleaseMinSize\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseMinDependency" -# PROP BASE Intermediate_Dir "ReleaseMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseMinDependency" -# PROP Intermediate_Dir "ReleaseMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseMinDependency -TargetPath=.\ReleaseMinDependency\XCallback_Impl.dll -InputPath=.\ReleaseMinDependency\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - -# End Custom Build - -!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinSize" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinSize" -# PROP BASE Intermediate_Dir "ReleaseUMinSize" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinSize" -# PROP Intermediate_Dir "ReleaseUMinSize" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinSize -TargetPath=.\ReleaseUMinSize\XCallback_Impl.dll -InputPath=.\ReleaseUMinSize\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinDependency" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseUMinDependency" -# PROP BASE Intermediate_Dir "ReleaseUMinDependency" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseUMinDependency" -# PROP Intermediate_Dir "ReleaseUMinDependency" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# Begin Custom Build - Performing registration -OutDir=.\ReleaseUMinDependency -TargetPath=.\ReleaseUMinDependency\XCallback_Impl.dll -InputPath=.\ReleaseUMinDependency\XCallback_Impl.dll -SOURCE="$(InputPath)" - -"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - if "%OS%"=="" goto NOTNT - if not "%OS%"=="Windows_NT" goto NOTNT - regsvr32 /s /c "$(TargetPath)" - echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" - goto end - :NOTNT - echo Warning : Cannot register Unicode DLL on Windows 95 - :end - -# End Custom Build - -!ENDIF - -# Begin Target - -# Name "XCallback_Impl - Win32 Debug" -# Name "XCallback_Impl - Win32 Unicode Debug" -# Name "XCallback_Impl - Win32 Release MinSize" -# Name "XCallback_Impl - Win32 Release MinDependency" -# Name "XCallback_Impl - Win32 Unicode Release MinSize" -# Name "XCallback_Impl - Win32 Unicode Release MinDependency" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\Callback.cpp -# End Source File -# Begin Source File - -SOURCE=.\Simple.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# Begin Source File - -SOURCE=.\XCallback_Impl.cpp -# End Source File -# Begin Source File - -SOURCE=.\XCallback_Impl.def -# End Source File -# Begin Source File - -SOURCE=.\XCallback_Impl.idl -# ADD MTL /tlb ".\XCallback_Impl.tlb" /h "XCallback_Impl.h" /iid "XCallback_Impl_i.c" /Oicf -# End Source File -# Begin Source File - -SOURCE=.\XCallback_Impl.rc -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Callback.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\Simple.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\Callback.rgs -# End Source File -# Begin Source File - -SOURCE=.\Simple.rgs -# End Source File -# End Group -# End Target -# End Project - - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl deleted file mode 100644 index 553243213..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -// XCallback_Impl.idl : IDL source for XCallback_Impl.dll -// - -// This file will be processed by the MIDL tool to -// produce the type library (XCallback_Impl.tlb) and marshalling code. - -import "oaidl.idl"; -import "ocidl.idl"; - [ - object, - uuid(180FF55F-6F5C-11D4-8330-005004526AB4), - dual, - helpstring("ICallback Interface"), - pointer_default(unique) - ] - interface ICallback : IDispatch - { - [id(1), helpstring("method func1")] HRESULT func1(); - [id(2), helpstring("method returnInterface")] HRESULT returnInterface([out, retval] IDispatch** ppdisp); - [id(3), helpstring("method outInterface")] HRESULT outInterface([out] IDispatch** ppdisp); - [id(4), helpstring("method outValuesMixed")] HRESULT outValuesMixed([in] long val, [out] long* pval, [in] BSTR string); - [id(5), helpstring("method outValuesAll")] HRESULT outValuesAll([out] IDispatch** ppdisp, [out] IDispatch** ppSimpleStruct, [out] long* aSimpleEnum, - [out] SAFEARRAY( VARIANT)* outSeq, - [out] VARIANT* varAny, - [out] VARIANT_BOOL * aBool, - [out] short* aChar, - [out] BSTR* aString , - [out] float* aFloat, - [out] double* aDouble, - [out] unsigned char* aByte, - [out] short* aShort, - [out]long* aLong); -// ); - [id(6), helpstring("method outStruct")] HRESULT outStruct([out] IDispatch** outStruct); - [id(7), helpstring("method outEnum")] HRESULT outEnum([out] long* outEnum); - [id(8), helpstring("method outSeqAny")] HRESULT outSeqAny([out] SAFEARRAY( VARIANT)* outSeq); - [id(9), helpstring("method outAny")] HRESULT outAny([out] VARIANT* outAny); - [id(10), helpstring("method outBool")] HRESULT outBool([out]VARIANT_BOOL* outBool); - [id(11), helpstring("method outChar")] HRESULT outChar([out] short* outChar); - [id(12), helpstring("method outString")] HRESULT outString([out] BSTR * outString); - [id(13), helpstring("method outFloat")] HRESULT outFloat([out] float* outFloat); - [id(14), helpstring("method outDouble")] HRESULT outDouble([out] double* outDouble); - [id(16), helpstring("method outShort")] HRESULT outShort([out] short *outShort); - [id(17), helpstring("method outLong")] HRESULT outLong([out] long* outLong); - [id(20), helpstring("method outByte")] HRESULT outByte([out] unsigned char* outByte); - [id(21), helpstring("method inoutInterface")] HRESULT inoutInterface([in,out] IDispatch** ppdisp); - [id(22), helpstring("method inoutStruct")] HRESULT inoutStruct([in,out] IDispatch** inoutVal); - [id(23), helpstring("method inoutEnum")] HRESULT inoutEnum([in,out] long * inoutVal); - [id(24), helpstring("method inoutSeqAny")] HRESULT inoutSeqAny([in,out] SAFEARRAY(VARIANT)* pArray); - [id(25), helpstring("method inoutAny")] HRESULT inoutAny([in,out] VARIANT* inoutVal); - [id(26), helpstring("method inoutBool")] HRESULT inoutBool([in,out] VARIANT_BOOL * inoutVal); - [id(27), helpstring("method inoutChar")] HRESULT inoutChar([in,out] short* inoutVal); - [id(28), helpstring("method inoutString")] HRESULT inoutString([in,out] BSTR *inoutVal); - [id(29), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float* inoutVal); - [id(30), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double* inoutVal); - [id(31), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* inoutVal); - [id(32), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* inoutVal); - [id(33), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long* inoutVal); - [id(34), helpstring("method inoutValueAll")] HRESULT inoutValuesAll( - [in,out] IDispatch** aXSimple, - [in,out] IDispatch** aStruct, - [in,out] long* aEnum, - [in,out] SAFEARRAY( VARIANT)* aSeq, - [in,out] VARIANT* aAny, - [in,out] VARIANT_BOOL* aBool, - [in,out] short* aChar, - [in,out] BSTR* aString, - [in,out] float* aFloat, - [in,out] double* aDouble, - [in,out] unsigned char* aByte, - [in,out] short* aShort, - [in,out] long* aLong); - [id(35), helpstring("method inValues")] HRESULT inValues([in]short aChar, [in] long aLong, [in] BSTR aString); - [id(36), helpstring("method outSeqByte")] HRESULT outSeqByte([out] SAFEARRAY(unsigned char)* outVal); - [id(37), helpstring("method inSeqByte")] HRESULT inSeqByte([in] SAFEARRAY(VARIANT) val); - [id(38), helpstring("method inSeqXEventListener")] HRESULT inSeqXEventListener([in] SAFEARRAY(VARIANT) listener, - [in] SAFEARRAY(VARIANT) event); - - }; - [ - object, - uuid(180FF564-6F5C-11D4-8330-005004526AB4), - dual, - helpstring("ISimple Interface"), - pointer_default(unique) - ] - interface ISimple : IDispatch - { - [id(1), helpstring("method func")] HRESULT func( [in] BSTR message); - [id(2), helpstring("method func2")] HRESULT func2([in] BSTR message); - [id(3), helpstring("method func3")] HRESULT func3([in] BSTR message); - [propget, id(4), helpstring("property _implementedInterfaces")] HRESULT _implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal); - }; - - - -[ - uuid(180FF553-6F5C-11D4-8330-005004526AB4), - version(1.0), - helpstring("XCallback_Impl 1.0 Type Library") -] -library XCALLBACK_IMPLLib -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - [ - uuid(180FF560-6F5C-11D4-8330-005004526AB4), - helpstring("Callback Class") - ] - coclass Callback - { - [default] interface ICallback; - }; - [ - uuid(180FF565-6F5C-11D4-8330-005004526AB4), - helpstring("Simple Class") - ] - coclass Simple - { - [default] interface ISimple; - }; -}; - - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc deleted file mode 100644 index 32b485233..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* -* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -**************************************************************************/ - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// German (Germany) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_CALLBACK REGISTRY DISCARDABLE "Callback.rgs" -IDR_SIMPLE REGISTRY DISCARDABLE "Simple.rgs" -#endif // German (Germany) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "1 TYPELIB ""XCallback_Impl.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "XCallback_Impl Module\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "XCallback_Impl\0" - VALUE "LegalCopyright", "Copyright 2000\0" - VALUE "OriginalFilename", "XCallback_Impl.DLL\0" - VALUE "ProductName", "XCallback_Impl Module\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "OLESelfRegister", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_PROJNAME "XCallback_Impl" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "XCallback_Impl.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln deleted file mode 100644 index 62b109fe4..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.sln +++ /dev/null @@ -1,31 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XCallback_Impl", "XCallback_Impl.vcproj", "{92A6B531-401E-4900-8217-169A96F4168D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release MinDependency|Win32 = Release MinDependency|Win32 - Release MinSize|Win32 = Release MinSize|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release MinDependency|Win32 = Unicode Release MinDependency|Win32 - Unicode Release MinSize|Win32 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {92A6B531-401E-4900-8217-169A96F4168D}.Debug|Win32.ActiveCfg = Debug|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Debug|Win32.Build.0 = Debug|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Release MinSize|Win32.ActiveCfg = Release MinSize|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Release MinSize|Win32.Build.0 = Release MinSize|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinDependency|Win32.ActiveCfg = Unicode Release MinDependency|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinDependency|Win32.Build.0 = Unicode Release MinDependency|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinSize|Win32.ActiveCfg = Unicode Release MinSize|Win32 - {92A6B531-401E-4900-8217-169A96F4168D}.Unicode Release MinSize|Win32.Build.0 = Unicode Release MinSize|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj deleted file mode 100644 index 1a9068d31..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.vcproj +++ /dev/null @@ -1,816 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h deleted file mode 100644 index d041b3790..000000000 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by XCallback_Impl.rc -// -#define IDS_PROJNAME 100 -#define IDR_CALLBACK 101 -#define IDR_SIMPLE 102 -#define IDR_SIMPLESTRUCT 103 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 104 -#endif -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/readme.txt b/extensions/test/ole/unoTocomCalls/readme.txt deleted file mode 100644 index 40841cb0e..000000000 --- a/extensions/test/ole/unoTocomCalls/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -The directory XCallback_Impl contains a MSDEV project that -creates a dll containing the ActiveX components -XCallback_Impl.Simple and XCallback_Impl.Callback -Callback implements functions defined in oletest.XCallback -and Simple implements functions defined in oletest.XSimple. -These interfaces are build in extensions/test/ole/cpnt - -The projects in unoToComCalls test the functionality of COM -and JScript object which implement UNO interfaces. diff --git a/extensions/test/pgp/TestPGP.java b/extensions/test/pgp/TestPGP.java deleted file mode 100644 index 41f21f3b7..000000000 --- a/extensions/test/pgp/TestPGP.java +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -import java.io.IOException; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyState; - -import com.sun.star.bridge.XBridge; - -// import com.sun.star.comp.bootstrap.Bootstrap; - -import com.sun.star.connection.XConnector; -import com.sun.star.connection.XConnection; - -import com.sun.star.io.BufferSizeExceededException; -import com.sun.star.io.NotConnectedException; -import com.sun.star.io.XInputStream; -import com.sun.star.io.XOutputStream; - -import com.sun.star.frame.XComponentLoader; - -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; - -import com.sun.star.text.XSimpleText; -import com.sun.star.text.XText; -import com.sun.star.text.XTextCursor; -import com.sun.star.text.XTextDocument; -import com.sun.star.text.XTextRange; - -import com.sun.star.uno.IBridge; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.XNamingService; -import com.sun.star.container.*; -import com.sun.star.lang.*; - -import com.sun.star.pgp.*; - - - -public class TestPGP { - - - static void doSomething(Object r) throws com.sun.star.uno.Exception, IOException, Exception { - XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, r); - - if(rName != null) { - System.err.println("got the remote naming service !"); - Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager"); - - XMultiServiceFactory rSmgr = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr); - if(rSmgr != null) { - System.err.println("got the remote service manager !"); - } - - XSet set= (XSet)UnoRuntime.queryInterface(XSet.class, rSmgr); - if( set == null) { - System.err.println(" couldn't get XSet from ServiceFactory"); - return; - } -// try{ - SimplePGPMailerFactoryReg mailerReg= new SimplePGPMailerFactoryReg(); - XSingleServiceFactory factory= mailerReg.getServiceFactory( - "com.sun.star.pgp.SimplePGPMailerImpl", rSmgr, null, null); - - if( factory == null) { - System.err.println("couldn't create PGP factory !"); - return; - } - set.insert(factory ); - System.err.println("PGP factory inserted into service manager"); - -// }catch(Exception e ){ -// System.err.println( "exception caught in TestPGP"); -// } - - } - } - - - - static String neededServices[] = new String[] { - "com.sun.star.comp.servicemanager.ServiceManager", - "com.sun.star.comp.loader.JavaLoader", - "com.sun.star.comp.connections.Connector", - "com.sun.star.comp.connections.Acceptor" - }; - - public static void main(String argv[]) throws Exception { - if(argv.length != 1) { - System.err.println("usage : testoffice protocol:host:port"); - System.exit(-1); - } - -// try { - com.sun.star.comp.servicemanager.ServiceManager smgr = new com.sun.star.comp.servicemanager.ServiceManager(); - smgr.addFactories(neededServices, null); - - XConnector xConnector = (XConnector)smgr.createInstance("com.sun.star.connection.Connector"); - XConnection xConnection = xConnector.connect(argv[0]); - - String rootOid = "classic_uno"; - IBridge iBridge = UnoRuntime.getBridgeByName("java", null, "remote", null, new Object[]{"iiop", xConnection, null}); - - Object rInitialObject = iBridge.mapInterfaceFrom(rootOid, XInterface.class); -// Object rInitialObject = xBridge.getInstance("NamingService"); - - if(rInitialObject != null) { - System.err.println("got the remote object"); - doSomething(rInitialObject); - } -// } -// catch (Exception exception) { -// System.err.println("Exception thrown:" + exception); -// } - } -} - diff --git a/extensions/test/pgp/makefile.mk b/extensions/test/pgp/makefile.mk deleted file mode 100644 index 96b7883e9..000000000 --- a/extensions/test/pgp/makefile.mk +++ /dev/null @@ -1,71 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME := extensions -PACKAGE := -TARGET := test_com_sun_star_pgp - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# Files -------------------------------------------------------- - -APPLICATRDB := $(SOLARBINDIR)$/applicat.rdb -RDB := $(APPLICATRDB) - -JARFILES= jurt.jar - -GENJAVACLASSFILES= \ - $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyValue.class \ - $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyState.class \ - $(CLASSDIR)$/com$/sun$/star$/container$/XSet.class \ - -JAVACLASSFILES= \ - $(CLASSDIR)$/$(PACKAGE)$/TestPGP.class - - -TYPES={$(subst,.class, $(subst,$/,. $(subst,$(CLASSDIR)$/,-T $(GENJAVACLASSFILES))))} -GENJAVAFILES = {$(subst,.class,.java $(subst,$/class, $(GENJAVACLASSFILES)))} -JAVAFILES= $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) $(GENJAVAFILES) - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALL : $(GENJAVAFILES) ALLTAR -.ELSE -ALL: ALLDEP -.ENDIF - -.INCLUDE : target.mk - -$(GENJAVAFILES) : $(RDB) - javamaker @$(mktmp -BUCR -O$(OUT) $(TYPES) $(RDB)) - -$(JAVACLASSFILES) : $(GENJAVAFILES) diff --git a/extensions/test/pgp/readme.txt b/extensions/test/pgp/readme.txt deleted file mode 100644 index 899e3377f..000000000 --- a/extensions/test/pgp/readme.txt +++ /dev/null @@ -1,33 +0,0 @@ -The program TestPGP instantiates a SimplePGPMailerFactory and adds - it to the ServiceManager obtained from a running StarOffice. -Then PGP can be used from within StarOffice. - -Prerequisites: -StarOffice needs an entry in Office/user/sofficerc under the Common - section: - - Port2=socket:hamburg-11070:1111 // old style -as of 569 m -Connection=socket,hamburg-11070,port=1111;iiop; - -Please note the semicolons! - - hamburg-11070 is the host running the office and 1111 is a - freely choosable port number. - - - For the program to run make sure that the office has access - to classes.zip, unoil.jar, jurt.jar, pgp.jar and swingall.jar. - - Therefore do the necessary entries in - Office/user/config/javarc - under SystemClasspath. - -There is a bug with jdk1.1.8, therfore use 1.2 instead. - -The TestPGP is called without ;iiop; : - -java TestPGP "socket,host=localhost,port=1111" - - - diff --git a/extensions/test/stm/datatest.cxx b/extensions/test/stm/datatest.cxx deleted file mode 100644 index 720fdad04..000000000 --- a/extensions/test/stm/datatest.cxx +++ /dev/null @@ -1,1071 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#include // for EXTERN_SERVICE_CALLTYPE -#include // OWeakObject - -#include -#include -#include - -#include - -#include "testfactreg.hxx" - -using namespace usr; - -#define DATASTREAM_TEST_MAX_HANDLE 1 - -/**** -* The following test class tests XDataInputStream and XDataOutputStream at equal terms, -* so when errors occur, it may be in either one implementation. -* The class also uses stardiv.uno.io.pipe. If problems occur, make sure to run also the -* pipe test routines ( test.com.sun.star.io.pipe ). -* -* -*****/ - -class ODataStreamTest : - public XSimpleTest, - public OWeakObject -{ -public: - ODataStreamTest( const XMultiServiceFactoryRef & rFactory ) : m_rFactory( rFactory ){} - -public: // refcounting - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: - virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject) - THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual INT32 test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual BOOL testPassed(void) THROWS( ( UsrSystemException) ); - virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) ); - virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) ); - virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) ); - -private: - void testSimple( const XDataInputStreamRef & , const XDataOutputStreamRef &); - -protected: - Sequence m_seqExceptions; - Sequence m_seqErrors; - Sequence m_seqWarnings; - - XMultiServiceFactoryRef m_rFactory; -}; - - -BOOL ODataStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut ) -{ - if( XSimpleTest::getSmartUik() == uik ) { - rOut = (XSimpleTest *) this; - } - else { - return OWeakObject::queryInterface( uik , rOut ); - } - return TRUE; -} - - -void ODataStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject ) - THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.DataInputStream" == TestName ) { - XConnectableRef connect( TestObject , USR_QUERY ); - XActiveDataSinkRef active( TestObject , USR_QUERY ); - XInputStreamRef input( TestObject , USR_QUERY ); - XDataInputStreamRef dataInput( TestObject , USR_QUERY ); - - WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" ); - WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" ); - ERROR_ASSERT( input.is() , "XInputStream cannot be queried" ); - ERROR_ASSERT( dataInput.is() , "XDataInputStream cannot be queried" ); - - - } - else if( L"com.sun.star.io.DataInputStream" == TestName ) { - XConnectableRef connect( TestObject , USR_QUERY ); - XActiveDataSourceRef active( TestObject , USR_QUERY ); - XOutputStreamRef output( TestObject , USR_QUERY ); - XDataOutputStreamRef dataOutput( TestObject , USR_QUERY ); - - WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" ); - WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" ); - ERROR_ASSERT( output.is() , "XInputStream cannot be queried" ); - ERROR_ASSERT( dataOutput.is(), "XDataInputStream cannot be queried" ); - - } - - XServiceInfoRef info( TestObject, USR_QUERY ); - ERROR_ASSERT( info.is() , "XServiceInfo not supported !" ); - if( info.is() ) - { - ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" ); - } - -} - - -INT32 ODataStreamTest::test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.DataInputStream" == TestName || - L"com.sun.star.io.DataOutputStream" == TestName ) { - - try { - if( 0 == hTestHandle ) { - testInvariant( TestName , TestObject ); - } - else { - XActiveDataSinkRef rSink( TestObject, USR_QUERY ); - XActiveDataSourceRef rSource( TestObject , USR_QUERY ); - - XDataInputStreamRef rInput( TestObject , USR_QUERY ); - XDataOutputStreamRef rOutput( TestObject , USR_QUERY ); - - - XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe"); - - XInputStreamRef rPipeInput( x , USR_QUERY ); - XOutputStreamRef rPipeOutput( x , USR_QUERY ); - - if( ! rSink.is() ) { - x = m_rFactory->createInstance( L"com.sun.star.io.DataInputStream" ); - x->queryInterface( XDataInputStream::getSmartUik() , rInput ); - x->queryInterface( XActiveDataSink::getSmartUik() , rSink ); - } - else if ( !rSource.is() ) { - - x = m_rFactory->createInstance( L"com.sun.star.io.DataOutputStream" ); - x->queryInterface( XDataOutputStream::getSmartUik() , rOutput ); - x->queryInterface( XActiveDataSource::getSmartUik() , rSource ); - } - - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rPipeOutput.is() ); - rSink->setInputStream( rPipeInput ); - rSource->setOutputStream( rPipeOutput ); - - OSL_ASSERT( rSink->getInputStream().is() ); - OSL_ASSERT( rSource->getOutputStream().is() ); - - if( 1 == hTestHandle ) { - testSimple( rInput , rOutput ); - } - } - } - catch( Exception& e ) { - BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ); - } - catch(...) { - BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" ); - } - - hTestHandle ++; - - if( hTestHandle >= 2) { - // all tests finished. - hTestHandle = -1; - } - } - else { - BUILD_ERROR( 0 , "service not supported by test." ); - } - return hTestHandle; -} - - - -BOOL ODataStreamTest::testPassed(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors.getLen() == 0; -} - - -Sequence< UString > ODataStreamTest::getErrors(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors; -} - - -Sequence< UsrAny > ODataStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) ) -{ - return m_seqExceptions; -} - - -Sequence< UString > ODataStreamTest::getWarnings(void) THROWS( (UsrSystemException) ) -{ - return m_seqWarnings; -} - -void ODataStreamTest::testSimple( const XDataInputStreamRef &rInput, - const XDataOutputStreamRef &rOutput ) -{ - rOutput->writeLong( 0x34ff3c ); - rOutput->writeLong( 0x34ff3d ); - - ERROR_ASSERT( 0x34ff3c == rInput->readLong() , "long read/write mismatch" ); - ERROR_ASSERT( 0x34ff3d == rInput->readLong() , "long read/write mismatch" ); - - rOutput->writeByte( 0x87 ); - ERROR_ASSERT( 0x87 == rInput->readByte() , "byte read/write mismatch" ); - - rOutput->writeBoolean( 25 ); - ERROR_ASSERT( rInput->readBoolean() , "boolean read/write mismatch" ); - - rOutput->writeBoolean( FALSE ); - ERROR_ASSERT( ! rInput->readBoolean() , "boolean read/write mismatch" ); - - rOutput->writeFloat( (float) 42.42 ); - ERROR_ASSERT( rInput->readFloat() == ((float)42.42) , "float read/write mismatch" ); - - rOutput->writeDouble( (double) 42.42 ); - ERROR_ASSERT( rInput->readDouble() == 42.42 , "double read/write mismatch" ); - - rOutput->writeUTF( L"Live long and prosper !" ); - ERROR_ASSERT( rInput->readUTF() == L"Live long and prosper !" , - "UTF read/write mismatch" ); - - Sequence wc(0x10001); - for( int i = 0 ; i < 0x10000 ; i ++ ) { - wc.getArray()[i] = L'c'; - } - wc.getArray()[0x10000] = 0; - UString str( wc.getArray() , 0x10000 ); - rOutput->writeUTF( str ); - ERROR_ASSERT( rInput->readUTF() == str , "error reading 64k block" ); - - rOutput->closeOutput(); - try { - rInput->readLong(); - ERROR_ASSERT( 0 , "eof-exception does not occur !" ); - } - catch ( IOException& e ){ - //ok - e.getName(); - } - catch(...) { - ERROR_ASSERT( 0 , "wrong exception after reading beyond eof" ); - } - - ERROR_ASSERT( ! rInput->readBytes( Sequence (1) , 1 ), - "stream must be on eof !" ); - - rInput->closeInput(); - - try { - rOutput->writeByte( 1 ); - ERROR_ASSERT( 0 , "writing still possible though chain must be interrupted" ); - } - catch( IOException& e ) - { - e.getName(); - // ok - } - catch( ... ) { - ERROR_ASSERT( 0 , "IOException expected, but another exception was thrown" ); - } - -} - - - -/** -* for external binding -* -* -**/ -XInterfaceRef ODataStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)) -{ - ODataStreamTest *p = new ODataStreamTest( rSMgr ); - XInterfaceRef xService = *p; - return xService; -} - -Sequence ODataStreamTest_getSupportedServiceNames( int i) THROWS( () ) -{ - Sequence aRet(1); - - aRet.getArray()[0] = ODataStreamTest_getImplementationName( i); - - - return aRet; -} - -UString ODataStreamTest_getServiceName( int i) THROWS( () ) -{ - if( 1 == i ) { - return L"test.com.sun.star.io.DataInputStream"; - } - else { - return L"test.com.sun.star.io.DataOutputStream"; - } -} - -UString ODataStreamTest_getImplementationName( int i) THROWS( () ) -{ - if( 1 == i ) { - return L"test.com.sun.star.comp.extensions.stm.DataInputStream"; - } - else { - return L"test.com.sun.star.comp.extensions.stm.DataOutputStream"; - } -} - - -/**------------------------------------------------------ -* -* -* -* -* -*------------------------------------------------------*/ -class MyPersistObject : - public XPersistObject, - public XPropertySet, - public OWeakObject -{ -public: - MyPersistObject( ) : m_sServiceName( OMyPersistObject_getServiceName() ) - {} - MyPersistObject( const UString & sServiceName ) : m_sServiceName( sServiceName ) - {} - ~MyPersistObject() - {} - -public: - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: - virtual UString getServiceName(void) const THROWS( (UsrSystemException) ); - virtual void write(const XObjectOutputStreamRef& OutStream) THROWS( (IOException, UsrSystemException) ); - virtual void read(const XObjectInputStreamRef& InStream) THROWS( (IOException, UsrSystemException) ); - -public: - - virtual XPropertySetInfoRef getPropertySetInfo(void) const THROWS( (UsrSystemException) ); - virtual void setPropertyValue(const UString& aPropertyName, const UsrAny& aValue) - THROWS( ( UnknownPropertyException, - PropertyVetoException, - IllegalArgumentException, - WrappedTargetException, - UsrSystemException) ); - virtual UsrAny getPropertyValue(const UString& PropertyName) const - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ); - virtual void addPropertyChangeListener( const UString& aPropertyName, - const XPropertyChangeListenerRef& xListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ); - virtual void removePropertyChangeListener( const UString& aPropertyName, - const XPropertyChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ); - virtual void addVetoableChangeListener( const UString& PropertyName, - const XVetoableChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ); - virtual void removeVetoableChangeListener( const UString& PropertyName, - const XVetoableChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ); - -public: - INT32 m_l; - float m_f; - double m_d; - BOOL m_b; - BYTE m_byte; - wchar_t m_c; - UString m_s; - XPersistObjectRef m_ref; - UString m_sServiceName; -}; - - - -XPropertySetInfoRef MyPersistObject::getPropertySetInfo(void) const THROWS( (UsrSystemException) ) -{ - return XPropertySetInfoRef(); -} - -void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAny& aValue) - THROWS( ( UnknownPropertyException, - PropertyVetoException, - IllegalArgumentException, - WrappedTargetException, - UsrSystemException) ) -{ - if( L"long" == aPropertyName ) { - m_l = aValue.getINT32(); - } - else if ( L"float" == aPropertyName ) { - m_f = aValue.getFloat(); - } - else if( L"double" == aPropertyName ) { - m_d = aValue.getDouble(); - } - else if( L"bool" == aPropertyName ) { - m_b = aValue.getBOOL(); - } - else if( L"byte" == aPropertyName ) { - m_byte = aValue.getBYTE(); - } - else if( L"char" == aPropertyName ) { - m_c = aValue.getChar(); - } - else if( L"string" == aPropertyName ) { - m_s = aValue.getString(); - } - else if( L"object" == aPropertyName ) { - if( aValue.getReflection() == XPersistObject_getReflection() ) { - XPersistObjectRef *pRef = (XPersistObjectRef*) aValue.get(); - if( pRef ) { - m_ref = *pRef; - } - else { - m_ref = 0; - } - } - else - { - m_ref = 0; - } - } -} - - -UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ) -{ - UsrAny aValue; - if( L"long" == aPropertyName ) { - aValue.setINT32( m_l ); - } - else if ( L"float" == aPropertyName ) { - aValue.setFloat( m_f ); - } - else if( L"double" == aPropertyName ) { - aValue.setDouble( m_d ); - } - else if( L"bool" == aPropertyName ) { - aValue.setBOOL( m_b ); - } - else if( L"byte" == aPropertyName ) { - aValue.setBYTE( m_byte ); - } - else if( L"char" == aPropertyName ) { - aValue.setChar( m_c ); - } - else if( L"string" == aPropertyName ) { - aValue.setString( m_s ); - } - else if( L"object" == aPropertyName ) { - aValue.set( &m_ref , XPersistObject_getReflection() ); - } - return aValue; -} - - -void MyPersistObject::addPropertyChangeListener( const UString& aPropertyName, - const XPropertyChangeListenerRef& xListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ) -{ - -} - -void MyPersistObject::removePropertyChangeListener( const UString& aPropertyName, - const XPropertyChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ) -{ -} -void MyPersistObject::addVetoableChangeListener(const UString& PropertyName, - const XVetoableChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ) -{ - -} - -void MyPersistObject::removeVetoableChangeListener( const UString& PropertyName, - const XVetoableChangeListenerRef& aListener) - THROWS( ( UnknownPropertyException, - WrappedTargetException, - UsrSystemException) ) -{ - -} - - - -BOOL MyPersistObject::queryInterface( Uik aUik , XInterfaceRef &rOut ) -{ - if( XPersistObject::getSmartUik() == aUik ) { - rOut = ( XPersistObject * ) this; - } - else if( XPropertySet::getSmartUik() == aUik ) { - rOut = ( XPropertySet * ) this; - } - else - return OWeakObject::queryInterface( aUik , rOut ); - - return TRUE; -} - -UString MyPersistObject::getServiceName() const THROWS( (UsrSystemException) ) -{ - return m_sServiceName; -} - -void MyPersistObject::write( const XObjectOutputStreamRef & rOut ) - THROWS( (IOException,UsrSystemException)) -{ - rOut->writeLong( m_l); - rOut->writeFloat( m_f ); - rOut->writeDouble( m_d ); - rOut->writeBoolean( m_b ); - rOut->writeByte( m_byte ); - rOut->writeChar( m_c ); - rOut->writeUTF( m_s ); - rOut->writeObject( m_ref ); -} - - -void MyPersistObject::read( const XObjectInputStreamRef & rIn ) - THROWS( (IOException, UsrSystemException) ) -{ - m_l = rIn->readLong(); - m_f = rIn->readFloat(); - m_d = rIn->readDouble(); - m_b = rIn->readBoolean(); - m_byte = rIn->readByte(); - m_c = rIn->readChar(); - m_s = rIn->readUTF(); - m_ref = rIn->readObject(); -} - -XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) - THROWS((Exception)) -{ - MyPersistObject *p = new MyPersistObject( ); - XInterfaceRef xService = *p; - return xService; -} - -Sequence OMyPersistObject_getSupportedServiceNames( ) THROWS( () ) -{ - Sequence aRet(1); - aRet.getArray()[0] = OMyPersistObject_getImplementationName(); - return aRet; -} - -UString OMyPersistObject_getServiceName( ) THROWS( () ) -{ - return L"test.com.sun.star.io.PersistTest"; -} - -UString OMyPersistObject_getImplementationName( ) THROWS( () ) -{ - return L"test.com.sun.star.io.PersistTest"; -} - - -// --------------------------------------------- -// ----------------------------------------------- -class OObjectStreamTest : - public ODataStreamTest -{ -public: - OObjectStreamTest( const XMultiServiceFactoryRef &r) : ODataStreamTest(r) {} -public: // refcounting - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - -public: - virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject) - THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual INT32 test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - -private: - void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut, - const XObjectInputStreamRef &rIn ); - -private: -}; - - - - -BOOL OObjectStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut ) -{ - if( XSimpleTest::getSmartUik() == uik ) { - rOut = (XSimpleTest *) this; - } - else { - return ODataStreamTest::queryInterface( uik , rOut ); - } - return TRUE; -} - - -void OObjectStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject ) - THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - - - if( L"com.sun.star.io.ObjectInputStream" == TestName ) { - ODataStreamTest::testInvariant( TestName , TestObject ); - XObjectInputStreamRef dataInput( TestObject , USR_QUERY ); - XMarkableStreamRef markable( TestObject , USR_QUERY ); - ERROR_ASSERT( dataInput.is() , "XObjectInputStream cannot be queried" ); - ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" ); - } - else if( L"com.sun.star.io.ObjectOutputStream" == TestName ) { - ODataStreamTest::testInvariant( TestName , TestObject ); - XMarkableStreamRef markable( TestObject , USR_QUERY ); - XObjectOutputStreamRef dataOutput( TestObject , USR_QUERY ); - ERROR_ASSERT( dataOutput.is(), "XObjectOutputStream cannot be queried" ); - ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" ); - } - - XServiceInfoRef info( TestObject, USR_QUERY ); - ERROR_ASSERT( info.is() , "XServiceInfo not supported !" ); - if( info.is() ) - { - ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" ); - } - -} - -INT32 OObjectStreamTest::test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.ObjectInputStream" == TestName || - L"com.sun.star.io.ObjectOutputStream" == TestName ) { - - try { - if( 0 == hTestHandle ) { - testInvariant( TestName , TestObject ); - } - else if( DATASTREAM_TEST_MAX_HANDLE >= hTestHandle ) { - INT32 hOldHandle = hTestHandle; - hTestHandle = ODataStreamTest::test( L"com.sun.star.io.DataInputStream" , - TestObject , hTestHandle ); - if( hTestHandle == -1 ){ - hTestHandle = hOldHandle; - } - } - else { - - XActiveDataSinkRef rSink( TestObject, USR_QUERY ); - XActiveDataSourceRef rSource( TestObject , USR_QUERY ); - - XObjectInputStreamRef rInput( TestObject , USR_QUERY ); - XObjectOutputStreamRef rOutput( TestObject , USR_QUERY ); - - - XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe"); - - XInputStreamRef rPipeInput( x , USR_QUERY ); - XOutputStreamRef rPipeOutput( x , USR_QUERY ); - - x = m_rFactory->createInstance( L"com.sun.star.io.MarkableInputStream" ); - XInputStreamRef markableInput( x , USR_QUERY ); - XActiveDataSinkRef markableSink( x , USR_QUERY ); - - x = m_rFactory->createInstance( L"com.sun.star.io.MarkableOutputStream" ); - XOutputStreamRef markableOutput( x , USR_QUERY ); - XActiveDataSourceRef markableSource( x , USR_QUERY ); - - OSL_ASSERT( markableInput.is() ); - OSL_ASSERT( markableOutput.is() ); - OSL_ASSERT( markableSink.is() ); - OSL_ASSERT( markableSource.is() ); - - markableSink->setInputStream( rPipeInput ); - markableSource->setOutputStream( rPipeOutput ); - - if( ! rSink.is() ) { - x = m_rFactory->createInstance( L"com.sun.star.io.ObjectInputStream" ); - x->queryInterface( XObjectInputStream::getSmartUik() , rInput ); - x->queryInterface( XActiveDataSink::getSmartUik() , rSink ); - } - else if ( !rSource.is() ) { - x = m_rFactory->createInstance( L"com.sun.star.io.ObjectOutputStream" ); - x->queryInterface( XObjectOutputStream::getSmartUik() , rOutput ); - x->queryInterface( XActiveDataSource::getSmartUik() , rSource ); - } - - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rPipeOutput.is() ); - - rSink->setInputStream( markableInput ); - rSource->setOutputStream( markableOutput ); - - OSL_ASSERT( rSink->getInputStream().is() ); - OSL_ASSERT( rSource->getOutputStream().is() ); - - if( 1 + DATASTREAM_TEST_MAX_HANDLE == hTestHandle ) { - testObject( rOutput , rInput); - } - rInput->closeInput(); - rOutput->closeOutput(); - - } - } - catch( Exception& e ) { - BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ); - } - catch(...) { - BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" ); - } - - hTestHandle ++; - - if( hTestHandle > 1 +DATASTREAM_TEST_MAX_HANDLE ) { - // all tests finished. - hTestHandle = -1; - } - } - else { - BUILD_ERROR( 0 , "service not supported by test." ); - } - return hTestHandle; -} - - -BOOL compareMyPropertySet( XPropertySetRef &r1 , XPropertySetRef &r2 ) -{ - BOOL b = TRUE; - - if( r1->getPropertyValue( L"long" ).getReflection() == Void_getReflection() || - r2->getPropertyValue( L"long" ).getReflection() == Void_getReflection() ) { - - // one of the objects is not the correct propertyset ! - return FALSE; - } - - b = b && ( r1->getPropertyValue( L"long" ).getINT32() == - r2->getPropertyValue( L"long" ).getINT32() ); - - b = b && ( r1->getPropertyValue( L"float" ).getFloat() == - r2->getPropertyValue( L"float" ).getFloat() ); - - b = b && ( r1->getPropertyValue( L"double" ).getDouble() == - r2->getPropertyValue( L"double" ).getDouble() ); - - b = b && ( r1->getPropertyValue( L"bool" ).getBOOL() == - r2->getPropertyValue( L"bool" ).getBOOL() ); - - b = b && ( r1->getPropertyValue( L"byte" ).getBYTE() == - r2->getPropertyValue( L"byte" ).getBYTE() ); - - b = b && ( r1->getPropertyValue( L"char" ).getChar() == - r2->getPropertyValue( L"char" ).getChar() ); - - b = b && ( r1->getPropertyValue( L"string" ).getString() == - r2->getPropertyValue( L"string" ).getString() ); - - UsrAny o1 = r1->getPropertyValue( L"object" ); - UsrAny o2 = r2->getPropertyValue( L"object" ); - - if( o1.getReflection() == XPersistObject_getReflection() ) { - - if( o2.getReflection() == XPersistObject_getReflection() ) { - XPersistObjectRef rPersist1 = *((XPersistObjectRef*) o1.get()); - XPersistObjectRef rPersist2 = *((XPersistObjectRef*) o2.get()); - XPropertySetRef rProp1( rPersist1 , USR_QUERY ); - XPropertySetRef rProp2( rPersist2 , USR_QUERY ); - - if( rProp1.is() && rProp2.is() && ! ( rProp1 == rProp2 ) - &&( rProp1 != r1 )) { - compareMyPropertySet( rProp1 , rProp2 ); - } - } - else { - b = FALSE; - } - } - else { - if( o2.getReflection() == XPersistObject_getReflection() ) { - b = FALSE; - } - } - - return b; -} - -void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut, - const XObjectInputStreamRef &rIn ) -{ - ERROR_ASSERT( rOut.is() , "no objectOutputStream" ); - ERROR_ASSERT( rIn.is() , "no objectInputStream" ); - - XMultiServiceFactoryRef xProv = getProcessServiceManager(); - ERROR_ASSERT( xProv.is() , "no global service manager" ); - - - // tests, if saving an object with an unknown service name allows - // reading the data behind the object ! - { - XInterfaceRef x = * new MyPersistObject( L"bla blubs" ); - - XPersistObjectRef persistRef( x , USR_QUERY ); - ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" ); - - rOut->writeObject( persistRef ); - rOut->writeLong( (INT32) 0xdeadbeef ); - - ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" ); - - try - { - XPersistObjectRef xReadPersistRef = rIn->readObject(); - ERROR_ASSERT( 0 , "expected exception not thrown" ); - } - catch( IOException& e ) - { - // all is ok - } - - ERROR_ASSERT( (INT32) 0xdeadbeef == rIn->readLong() , - "wrong data after object with unknown service name." ); - } - - { - XInterfaceRef x = xProv->createInstance(L"test.com.sun.star.io.PersistTest"); - XPersistObjectRef persistRef( x , USR_QUERY ); - - ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" ); - - XPropertySetRef rProp( persistRef , USR_QUERY ); - ERROR_ASSERT( rProp.is() , "test object is no property set " ); - - UsrAny any; - any.setINT32( 0x83482 ); - rProp->setPropertyValue( L"long" , any ); - - any.setFloat( 42.23 ); - rProp->setPropertyValue( L"float" , any ); - - any.setDouble( 233.321412 ); - rProp->setPropertyValue( L"double" , any ); - - any.setBOOL( TRUE ); - rProp->setPropertyValue( L"bool" , any ); - - any.setBYTE( 130 ); - rProp->setPropertyValue( L"byte" , any ); - - any.setChar( 'h' ); - rProp->setPropertyValue( L"char" , any ); - - any.setString( L"hi du !" ); - rProp->setPropertyValue( L"string" , any ); - - any.set( &persistRef, XPersistObject_getReflection() ); // try a self reference - rProp->setPropertyValue( L"object" , any ); - - // do read and write - rOut->writeObject( persistRef ); - ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" ); - XPersistObjectRef xReadPersistRef = rIn->readObject( ); - - XPropertySetRef rPropRead( xReadPersistRef , USR_QUERY ); - ERROR_ASSERT( compareMyPropertySet( rProp , rPropRead ) , "objects has not been read properly !" ); - - // destroy selfreferences - rProp->setPropertyValue( L"object", UsrAny() ); - rPropRead->setPropertyValue( L"object", UsrAny() ); - } - - { - XMarkableStreamRef markableOut( rOut , USR_QUERY ); - ERROR_ASSERT( markableOut.is() , "markable stream cannot be queried" ); - - // do the same thing multiple times to check if - // buffering and marks work correctly - for( int i = 0 ; i < 2000 ; i ++ ) { - - XInterfaceRef x = xProv->createInstance(L"test.com.sun.star.io.PersistTest"); - XPersistObjectRef persistRef( x , USR_QUERY ); - - XPropertySetRef rProp( persistRef , USR_QUERY ); - ERROR_ASSERT( rProp.is() , "test object is no property set " ); - - UsrAny any; - any.setINT32( 0x83482 ); - rProp->setPropertyValue( L"long" , any ); - - any.setFloat( 42.23 ); - rProp->setPropertyValue( L"float" , any ); - - any.setDouble( 233.321412 ); - rProp->setPropertyValue( L"double" , any ); - - any.setBOOL( TRUE ); - rProp->setPropertyValue( L"bool" , any ); - - any.setBYTE( 130 ); - rProp->setPropertyValue( L"byte" , any ); - - any.setChar( 'h' ); - rProp->setPropertyValue( L"char" , any ); - - any.setString( L"hi du !" ); - rProp->setPropertyValue( L"string" , any ); - - - x = xProv->createInstance(L"test.com.sun.star.io.PersistTest"); - XPersistObjectRef persist2ndRef( x , USR_QUERY ); - - - // Note : persist2ndRef contains coincident values, but also coincident values must be - // saved properly ! - any.set( &persist2ndRef, XPersistObject_getReflection() ); // try a self reference - rProp->setPropertyValue( L"object" , any ); - - // simply test, if markable operations and object operations do not interfere - INT32 nMark = markableOut->createMark(); - - // do read and write - rOut->writeObject( persistRef ); - - // further markable tests ! - INT32 nOffset = markableOut->offsetToMark( nMark ); - markableOut->jumpToMark( nMark ); - markableOut->deleteMark( nMark ); - markableOut->jumpToFurthest(); - - - - - - ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" ); - XPersistObjectRef xReadPersistRef = rIn->readObject( ); - - XPropertySetRef rProp1( persistRef , USR_QUERY ); - XPropertySetRef rProp2( xReadPersistRef , USR_QUERY ); - ERROR_ASSERT( compareMyPropertySet( rProp1, rProp2) , "objects has not been read properly !" ); - } - } -} - - -XInterfaceRef OObjectStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)) -{ - OObjectStreamTest *p = new OObjectStreamTest( rSMgr ); - XInterfaceRef xService = *p; - return xService; -} - -Sequence OObjectStreamTest_getSupportedServiceNames( int i) THROWS( () ) -{ - Sequence aRet(1); - aRet.getArray()[0] = OObjectStreamTest_getImplementationName( i); - return aRet; -} - -UString OObjectStreamTest_getServiceName( int i) THROWS( () ) -{ - if( 1 == i ) { - return L"test.com.sun.star.io.ObjectInputStream"; - } - else { - return L"test.com.sun.star.io.ObjectOutputStream"; - } -} - -UString OObjectStreamTest_getImplementationName( int i) THROWS( () ) -{ - if( 1 == i ) { - return L"test.com.sun.star.comp.extensions.stm.ObjectInputStream"; - } - else { - return L"test.com.sun.star.comp.extensions.stm.ObjectOutputStream"; - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/stm/exports.dxp b/extensions/test/stm/exports.dxp deleted file mode 100644 index e4bc69d23..000000000 --- a/extensions/test/stm/exports.dxp +++ /dev/null @@ -1,2 +0,0 @@ -exService_writeRegEntry -exService_getFactory diff --git a/extensions/test/stm/makefile.mk b/extensions/test/stm/makefile.mk deleted file mode 100644 index ac31f76fb..000000000 --- a/extensions/test/stm/makefile.mk +++ /dev/null @@ -1,61 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=extensions -TARGET=teststm -USE_DEFFILE=TRUE -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- -.INCLUDE : $(PRJ)$/util$/makefile.pmk - -# --- Files -------------------------------------------------------- -OBJFILES= $(SLO)$/pipetest.obj $(SLO)$/testfactreg.obj $(SLO)$/datatest.obj \ - $(SLO)$/marktest.obj - -SHL1TARGET= $(TARGET)$(DLLPOSTFIX) -LIB1TARGET= $(SLB)$/$(TARGET).lib - -SHL1STDLIBS= \ - $(SALLIB) \ - $(TOOLSLIB) - -LIB1OBJFILES= $(OBJFILES) -SHL1LIBS= $(LIB1TARGET) -SHL1IMPLIB= i$(TARGET) -SHL1DEPN= makefile.mk $(SHL1LIBS) -SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) -DEF1EXPORTFILE= exports.dxp - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk diff --git a/extensions/test/stm/marktest.cxx b/extensions/test/stm/marktest.cxx deleted file mode 100644 index a6121dee6..000000000 --- a/extensions/test/stm/marktest.cxx +++ /dev/null @@ -1,658 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include -#include - -#include - - -#include - -#include // for EXTERN_SERVICE_CALLTYPE -#include // OWeakObject - -#include -#include -#include - -#include - -#include "testfactreg.hxx" - - -using namespace usr; - -class OMarkableOutputStreamTest : - public XSimpleTest, - public OWeakObject -{ -public: - OMarkableOutputStreamTest( const XMultiServiceFactoryRef & rFactory ); - ~OMarkableOutputStreamTest(); - -public: // refcounting - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: // implementation names - static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () ); - static UString getImplementationName_Static() THROWS( () ); - -public: - virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject) - THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual INT32 test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual BOOL testPassed(void) THROWS( ( UsrSystemException) ); - virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) ); - virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) ); - virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) ); - -private: - void testSimple( const XOutputStreamRef &r, const XInputStreamRef &rInput ); - -private: - Sequence m_seqExceptions; - Sequence m_seqErrors; - Sequence m_seqWarnings; - XMultiServiceFactoryRef m_rFactory; - -}; - -OMarkableOutputStreamTest::OMarkableOutputStreamTest( const XMultiServiceFactoryRef &rFactory ) - : m_rFactory( rFactory ) -{ - -} - -OMarkableOutputStreamTest::~OMarkableOutputStreamTest() -{ - -} - - -BOOL OMarkableOutputStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut ) -{ - if( XSimpleTest::getSmartUik() == uik ) { - rOut = (XSimpleTest *) this; - } - else { - return OWeakObject::queryInterface( uik , rOut ); - } - return TRUE; -} - - -void OMarkableOutputStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject ) - THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - XServiceInfoRef info( TestObject, USR_QUERY ); - ERROR_ASSERT( info.is() , "XServiceInfo not supported !" ); - if( info.is() ) - { - ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" ); - } -} - - -INT32 OMarkableOutputStreamTest::test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.MarkableOutputStream" == TestName ) { - try { - if( 0 == hTestHandle ) { - testInvariant( TestName , TestObject ); - } - else { - XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe"); - XOutputStreamRef rPipeOutput( x , USR_QUERY ); - XInputStreamRef rPipeInput( x , USR_QUERY ); - - XActiveDataSourceRef source( TestObject , USR_QUERY ); - source->setOutputStream( rPipeOutput ); - - XOutputStreamRef rOutput( TestObject , USR_QUERY ); - - OSL_ASSERT( rPipeInput.is() ); - OSL_ASSERT( rOutput.is() ); - if( 1 == hTestHandle ) { - // checks usual streaming - testSimple( rOutput , rPipeInput ); - } - } - - } - catch( Exception& e ) { - BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ); - } - catch(...) { - BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" ); - } - - hTestHandle ++; - - if( 2 == hTestHandle ) { - // all tests finished. - hTestHandle = -1; - } - } - else { - THROW( IllegalArgumentException() ); - } - return hTestHandle; -} - - - -BOOL OMarkableOutputStreamTest::testPassed(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors.getLen() == 0; -} - - -Sequence< UString > OMarkableOutputStreamTest::getErrors(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors; -} - - -Sequence< UsrAny > OMarkableOutputStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) ) -{ - return m_seqExceptions; -} - - -Sequence< UString > OMarkableOutputStreamTest::getWarnings(void) THROWS( (UsrSystemException) ) -{ - return m_seqWarnings; -} - - -void OMarkableOutputStreamTest::testSimple( const XOutputStreamRef &rOutput , - const XInputStreamRef &rInput ) -{ - XMarkableStreamRef rMarkable( rOutput , USR_QUERY ); - - ERROR_ASSERT( rMarkable.is() , "no MarkableStream implemented" ); - - // first check normal input/output facility - char pcStr[] = "Live long and prosper !"; - - Sequence seqWrite( strlen( pcStr )+1 ); - memcpy( seqWrite.getArray() , pcStr , seqWrite.getLen() ); - - Sequence seqRead( seqWrite.getLen() ); - - int nMax = 10,i; - - for( i = 0 ; i < nMax ; i ++ ) { - rOutput->writeBytes( seqWrite ); - rInput->readBytes( seqRead , rInput->available() ); - ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) , - "error during read/write/skip" ); - } - - // Check buffer resizing - nMax = 3000; - for( i = 0 ; i < nMax ; i ++ ) { - rOutput->writeBytes( seqWrite ); - } - - for( i = 0 ; i < nMax ; i ++ ) { - rInput->readBytes( seqRead , seqWrite.getLen() ); - ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) , - "error during read/write" ); - } - - // Check creating marks ! - INT32 nMark = rMarkable->createMark(); - - for( i = 0 ; i < nMax ; i ++ ) { - rOutput->writeBytes( seqWrite ); - } - - ERROR_ASSERT( 0 == rInput->available() , "bytes available though mark is holded" ); - - ERROR_ASSERT( nMax*seqWrite.getLen() == rMarkable->offsetToMark( nMark ) , - "offsetToMark failure" ); - - rMarkable->deleteMark( nMark ); - ERROR_ASSERT( nMax*seqWrite.getLen() == rInput->available(),"bytes are not available though mark has been deleted" ); - - rInput->skipBytes( nMax*seqWrite.getLen() ); - ERROR_ASSERT( 0 == rInput->available(), "skip bytes failure" ); - - try { - rMarkable->jumpToMark( nMark ); - ERROR_ASSERT( 0 , "jump to non existing mark possible !" ); - } - catch ( IllegalArgumentException& e ) - { - e;// ok, exception was thrown - } - - // test putting marks not at the end of the stream! - ERROR_ASSERT( 0 == rInput->available(), "stream isn't clean" ); - { - Sequence< BYTE > aByte(256); - - for( i = 0 ; i < 256 ; i ++ ) - { - aByte.getArray()[i] = i; - } - INT32 nMark1 = rMarkable->createMark(); - - rOutput->writeBytes( aByte ); - rMarkable->jumpToMark( nMark1 ); - aByte.realloc( 10 ); - rOutput->writeBytes( aByte ); - - INT32 nMark2 = rMarkable->createMark( ); - - for( i = 0 ; i < 10 ; i ++ ) - { - aByte.getArray()[i] = i+10; - } - - rOutput->writeBytes( aByte ); - - // allow the bytes to be written ! - rMarkable->jumpToFurthest(); - rMarkable->deleteMark( nMark1 ); - rMarkable->deleteMark( nMark2 ); - - ERROR_ASSERT( 256 == rInput->available(), "in between mark failure" ); - rInput->readBytes( aByte ,256); - for( i = 0 ; i < 256 ; i ++ ) - { - ERROR_ASSERT( i == aByte.getArray()[i] , "in between mark failure" ); - } - } - - { - // now a more extensive mark test ! - Sequence as[4]; - INT32 an[4]; - - for( i = 0 ; i < 4 ; i ++ ) { - as[i].realloc(1); - as[i].getArray()[0] = i; - an[i] = rMarkable->createMark(); - rOutput->writeBytes( as[i] ); - } - - // check offset to mark - for( i = 0 ; i < 4 ; i ++ ) { - ERROR_ASSERT( rMarkable->offsetToMark( an[i] ) == 4-i , "offsetToMark failure" ); - } - - rMarkable->jumpToMark( an[1] ); - ERROR_ASSERT( rMarkable->offsetToMark( an[3] ) == -2 , "offsetToMark failure" ); - - rMarkable->jumpToFurthest( ); - ERROR_ASSERT( rMarkable->offsetToMark( an[0] ) == 4 , "offsetToMark failure" ); - - // now do a rewrite ! - for( i = 0 ; i < 4 ; i ++ ) { - rMarkable->jumpToMark( an[3-i] ); - rOutput->writeBytes( as[i] ); - } - // NOTE : CursorPos 1 - - // now delete the marks ! - for( i = 0 ; i < 4 ; i ++ ) { - rMarkable->deleteMark( an[i] ); - } - ERROR_ASSERT( rInput->available() == 1 , "wrong number of bytes flushed" ); - - rMarkable->jumpToFurthest(); - - ERROR_ASSERT( rInput->available() == 4 , "wrong number of bytes flushed" ); - - rInput->readBytes( seqRead , 4 ); - - ERROR_ASSERT( 3 == seqRead.getArray()[0] , "rewrite didn't work" ); - ERROR_ASSERT( 2 == seqRead.getArray()[1] , "rewrite didn't work" ); - ERROR_ASSERT( 1 == seqRead.getArray()[2] , "rewrite didn't work" ); - ERROR_ASSERT( 0 == seqRead.getArray()[3] , "rewrite didn't work" ); - - rOutput->closeOutput(); - rInput->closeInput(); - } - -} - -/** -* for external binding -**/ -XInterfaceRef OMarkableOutputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)) -{ - OMarkableOutputStreamTest *p = new OMarkableOutputStreamTest( rSMgr ); - XInterfaceRef xService = *p; - return xService; -} - - - -Sequence OMarkableOutputStreamTest_getSupportedServiceNames(void) THROWS( () ) -{ - Sequence aRet(1); - aRet.getArray()[0] = OMarkableOutputStreamTest_getImplementationName(); - - return aRet; -} - -UString OMarkableOutputStreamTest_getServiceName() THROWS( () ) -{ - return L"test.com.sun.star.io.MarkableOutputStream"; -} - -UString OMarkableOutputStreamTest_getImplementationName() THROWS( () ) -{ - return L"test.com.sun.starextensions.stm.MarkableOutputStream"; -} - - - - - - - -//----------------------------------------------------- -// Input stream - -class OMarkableInputStreamTest : - public XSimpleTest, - public OWeakObject -{ -public: - OMarkableInputStreamTest( const XMultiServiceFactoryRef & rFactory ); - ~OMarkableInputStreamTest(); - -public: // refcounting - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: // implementation names - static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () ); - static UString getImplementationName_Static() THROWS( () ); - -public: - virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject) - THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual INT32 test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual BOOL testPassed(void) THROWS( ( UsrSystemException) ); - virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) ); - virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) ); - virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) ); - -private: - void testSimple( const XOutputStreamRef &r, const XInputStreamRef &rInput ); - -private: - Sequence m_seqExceptions; - Sequence m_seqErrors; - Sequence m_seqWarnings; - XMultiServiceFactoryRef m_rFactory; - -}; - -OMarkableInputStreamTest::OMarkableInputStreamTest( const XMultiServiceFactoryRef &rFactory ) - : m_rFactory( rFactory ) -{ - -} - -OMarkableInputStreamTest::~OMarkableInputStreamTest() -{ - -} - - -BOOL OMarkableInputStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut ) -{ - if( XSimpleTest::getSmartUik() == uik ) { - rOut = (XSimpleTest *) this; - } - else { - return OWeakObject::queryInterface( uik , rOut ); - } - return TRUE; -} - - -void OMarkableInputStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject ) - THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.MarkableInputStream" == TestName ) { - XServiceInfoRef info( TestObject, USR_QUERY ); - ERROR_ASSERT( info.is() , "XServiceInfo not supported !" ); - if( info.is() ) - { - ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" ); - } - } - else { - THROW( IllegalArgumentException() ); - } -} - - -INT32 OMarkableInputStreamTest::test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.MarkableInputStream" == TestName ) { - try { - if( 0 == hTestHandle ) { - testInvariant( TestName , TestObject ); - } - else { - XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe"); - XOutputStreamRef rPipeOutput( x , USR_QUERY ); - XInputStreamRef rPipeInput( x , USR_QUERY ); - - XActiveDataSinkRef sink( TestObject , USR_QUERY ); - sink->setInputStream( rPipeInput ); - - XInputStreamRef rInput( TestObject , USR_QUERY ); - - OSL_ASSERT( rPipeOutput.is() ); - OSL_ASSERT( rInput.is() ); - if( 1 == hTestHandle ) { - // checks usual streaming - testSimple( rPipeOutput , rInput ); - } - } - - } - catch( Exception& e ) { - BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ); - } - catch(...) { - BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" ); - } - - hTestHandle ++; - - if( 2 == hTestHandle ) { - // all tests finished. - hTestHandle = -1; - } - } - else { - THROW( IllegalArgumentException() ); - } - return hTestHandle; -} - - - -BOOL OMarkableInputStreamTest::testPassed(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors.getLen() == 0; -} - - -Sequence< UString > OMarkableInputStreamTest::getErrors(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors; -} - - -Sequence< UsrAny > OMarkableInputStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) ) -{ - return m_seqExceptions; -} - - -Sequence< UString > OMarkableInputStreamTest::getWarnings(void) THROWS( (UsrSystemException) ) -{ - return m_seqWarnings; -} - - -void OMarkableInputStreamTest::testSimple( const XOutputStreamRef &rOutput , - const XInputStreamRef &rInput ) -{ - XMarkableStreamRef rMarkable( rInput , USR_QUERY ); - - Sequence seqWrite( 256 ); - Sequence seqRead(10); - - for( int i = 0 ; i < 256 ; i ++ ) - { - seqWrite.getArray()[i] = i; - } - - rOutput->writeBytes( seqWrite ); - ERROR_ASSERT( 256 == rInput->available() , "basic read/write failure" ); - - rInput->readBytes( seqRead , 10 ); - ERROR_ASSERT( 9 == seqRead.getArray()[9] , "basic read/write failure" ); - - INT32 nMark = rMarkable->createMark(); - - rInput->skipBytes( 50 ); - ERROR_ASSERT( 256-10-50 == rInput->available() , "marking error" ); - ERROR_ASSERT( 50 == rMarkable->offsetToMark( nMark ) , "marking error" ); - - rMarkable->jumpToMark( nMark ); - ERROR_ASSERT( 256-10 == rInput->available() , "marking error" ); - - rInput->readBytes( seqRead , 10 ); - ERROR_ASSERT( 10 == seqRead.getArray()[0] , "marking error" ); - - // pos 20 - { - INT32 nInBetweenMark = rMarkable->createMark( ); - rMarkable->jumpToMark( nMark ); - rMarkable->jumpToMark( nInBetweenMark ); - - rInput->readBytes( seqRead , 10 ); - ERROR_ASSERT( 20 == seqRead.getArray()[0] , "Inbetween mark failed!\n" ); - - rMarkable->deleteMark( nMark ); - - // Check if releasing the first bytes works correct. - rMarkable->jumpToMark( nInBetweenMark); - rInput->readBytes( seqRead , 10 ); - ERROR_ASSERT( 20 == seqRead.getArray()[0] , "Inbetween mark failed!\n" ); - - rMarkable->deleteMark( nInBetweenMark ); - } - - rMarkable->jumpToFurthest(); - ERROR_ASSERT( 256-10-50 == rInput->available() , "marking error" ); - - - ERROR_ASSERT( 100 == rInput->readSomeBytes( seqRead , 100 ) , "wrong results using readSomeBytes" ); - ERROR_ASSERT( 96 == rInput->readSomeBytes( seqRead , 1000) , "wrong results using readSomeBytes" ); - rOutput->closeOutput(); - rInput->closeInput(); -} - -/** -* for external binding -**/ -XInterfaceRef OMarkableInputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)) -{ - OMarkableInputStreamTest *p = new OMarkableInputStreamTest( rSMgr ); - XInterfaceRef xService = *p; - return xService; -} - - - -Sequence OMarkableInputStreamTest_getSupportedServiceNames(void) THROWS( () ) -{ - Sequence aRet(1); - aRet.getArray()[0] = OMarkableInputStreamTest_getImplementationName(); - - return aRet; -} - -UString OMarkableInputStreamTest_getServiceName() THROWS( () ) -{ - return L"test.com.sun.star.io.MarkableInputStream"; -} - -UString OMarkableInputStreamTest_getImplementationName() THROWS( () ) -{ - return L"test.com.sun.star.extensions.stm.MarkableInputStream"; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/stm/pipetest.cxx b/extensions/test/stm/pipetest.cxx deleted file mode 100644 index d40b3e077..000000000 --- a/extensions/test/stm/pipetest.cxx +++ /dev/null @@ -1,448 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include - -#include - -#include - -#include // for EXTERN_SERVICE_CALLTYPE -#include // OWeakObject - -#include -#include -#include - -#include - -#include "testfactreg.hxx" -#define IMPLEMENTATION_NAME L"test.com.sun.star.comp.extensions.stm.Pipe" -#define SERVICE_NAME L"test.com.sun.star.io.Pipe" - -using namespace usr; - -class WriteToStreamThread : - public osl::Thread -{ - -public: - - WriteToStreamThread( XOutputStreamRef xOutput , int iMax ) - { - m_output = xOutput; - m_iMax = iMax; - } - - virtual ~WriteToStreamThread() {} - - -protected: - - /// Working method which should be overridden. - virtual void run() { - for( int i = 0 ; i < m_iMax ; i ++ ) { - m_output->writeBytes( createIntSeq(i) ); - } - m_output->closeOutput(); - } - - /** Called when run() is done. - * You might want to override it to do some cleanup. - */ - virtual void onTerminated() - { - delete this; - } - - -private: - - XOutputStreamRef m_output; - int m_iMax; -}; - - - -class OPipeTest : - public XSimpleTest, - public OWeakObject -{ -public: - OPipeTest( const XMultiServiceFactoryRef & rFactory ); - ~OPipeTest(); - -public: // refcounting - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: // implementation names - static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () ); - static UString getImplementationName_Static() THROWS( () ); - -public: - virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject) - THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual INT32 test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ); - - virtual BOOL testPassed(void) THROWS( ( UsrSystemException) ); - virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) ); - virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) ); - virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) ); - -private: - void testSimple( const XInterfaceRef & ); - void testBufferResizing( const XInterfaceRef & ); - void testMultithreading( const XInterfaceRef & ); - -private: - Sequence m_seqExceptions; - Sequence m_seqErrors; - Sequence m_seqWarnings; - -}; - - - -OPipeTest::OPipeTest( const XMultiServiceFactoryRef &rFactory ) -{ - -} - -OPipeTest::~OPipeTest() -{ - -} - - -BOOL OPipeTest::queryInterface( Uik uik , XInterfaceRef &rOut ) -{ - if( XSimpleTest::getSmartUik() == uik ) { - rOut = (XSimpleTest *) this; - } - else { - return OWeakObject::queryInterface( uik , rOut ); - } - return TRUE; -} - - -void OPipeTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject ) - THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - XServiceInfoRef info( TestObject, USR_QUERY ); - ERROR_ASSERT( info.is() , "XServiceInfo not supported !" ); - if( info.is() ) - { - ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" ); - ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" ); - } - -} - - -INT32 OPipeTest::test( const UString& TestName, - const XInterfaceRef& TestObject, - INT32 hTestHandle) THROWS( ( IllegalArgumentException, - UsrSystemException) ) -{ - if( L"com.sun.star.io.Pipe" == TestName ) { - try { - if( 0 == hTestHandle ) { - testInvariant( TestName , TestObject ); - } - else if( 1 == hTestHandle ) { - testSimple( TestObject ); - } - else if( 2 == hTestHandle ) { - testBufferResizing( TestObject ); - } - else if( 3 == hTestHandle ) { - testMultithreading( TestObject ); - } - } - catch( Exception& e ) { - BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ); - } - catch(...) { - BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" ); - } - - hTestHandle ++; - - if( 4 == hTestHandle ) { - // all tests finished. - hTestHandle = -1; - } - } - else { - THROW( IllegalArgumentException() ); - } - return hTestHandle; -} - - - -BOOL OPipeTest::testPassed(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors.getLen() == 0; -} - - -Sequence< UString > OPipeTest::getErrors(void) THROWS( (UsrSystemException) ) -{ - return m_seqErrors; -} - - -Sequence< UsrAny > OPipeTest::getErrorExceptions(void) THROWS( (UsrSystemException) ) -{ - return m_seqExceptions; -} - - -Sequence< UString > OPipeTest::getWarnings(void) THROWS( (UsrSystemException) ) -{ - return m_seqWarnings; -} - - -/*** -* the test methods -* -****/ - - -void OPipeTest::testSimple( const XInterfaceRef &r ) -{ - - XInputStreamRef input( r , USR_QUERY ); - XOutputStreamRef output( r , USR_QUERY ); - - ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" ); - ERROR_ASSERT( output.is() , "queryInterface onXOutputStream failed" ); - - // basic read/write - Sequence seqWrite = createSeq( "Hallo, du Ei !" ); - - Sequence seqRead; - for( int i = 0 ; i < 5000 ; i ++ ) { - output->writeBytes( seqWrite ); - input->readBytes( seqRead , input->available() ); - - ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) , - "error during read/write/skip" ); - ERROR_ASSERT( 0 == input->available() , - "error during read/write/skip" ); - - // available shouldn't return a negative value - input->skipBytes( seqWrite.getLen() - 5 ); - ERROR_ASSERT( 0 == input->available() , "wrong available after skip" ); - - // 5 bytes should be available - output->writeBytes( seqWrite ); - ERROR_ASSERT( 5 == input->available() , "wrong available after skip/write " ); - - input->readBytes( seqRead , 5 ); - ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() , - (char*) &( seqWrite.getArray()[seqWrite.getLen()-5] ) ), - "write/read mismatich" ); - - } - - output->writeBytes( seqWrite ); - ERROR_ASSERT( seqWrite.getLen() == input->available(), "wrong available() after write" ); - - ERROR_ASSERT( 10 == input->readSomeBytes( seqRead , 10 ) , "maximal number of bytes ignored" ); - ERROR_ASSERT( seqWrite.getLen() -10 == input->readSomeBytes( seqRead , 100 ) , - "something wrong with readSomeBytes" ); - - - output->closeOutput(); - try { - output->writeBytes( Sequence (100) ); - ERROR_ASSERT( 0 , "writing on a closed stream does not cause an exception" ); - } - catch (IOException& e ) { - e; // just to suppress warning during compile - } - - ERROR_ASSERT(! input->readBytes( seqRead , 1 ), "eof not found !" ); - - input->closeInput(); - try { - input->readBytes( seqRead , 1 ); - ERROR_ASSERT( 0 , "reading from a closed stream does not cause an exception" ); - } - catch( IOException& e ) { - e; // just to suppress warning during compile - } - -} - -void OPipeTest::testBufferResizing( const XInterfaceRef &r ) -{ - - int iMax = 20000; - XInputStreamRef input( r , USR_QUERY ); - XOutputStreamRef output( r , USR_QUERY ); - - ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" ); - ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" ); - - Sequence seqRead; - - // this is just to better check the - // internal buffers - output->writeBytes( Sequence(100) ); - input->readBytes( Sequence() , 100); - - for( int i = 0 ; i < iMax ; i ++ ) { - output->writeBytes( createIntSeq( i ) ); - } - - for( i = 0 ; i < iMax ; i ++ ) { - input->readBytes( seqRead, createIntSeq(i).getLen() ); - ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() , - (char*) createIntSeq(i).getArray() ) , - "written/read mismatch\n" ); - } - - output->closeOutput(); - ERROR_ASSERT( ! input->readBytes( seqRead , 1 ) , "eof not reached !" ); - input->closeInput(); -} - - - -void OPipeTest::testMultithreading( const XInterfaceRef &r ) -{ - - - int iMax = 30000; - - XInputStreamRef input( r , USR_QUERY ); - XOutputStreamRef output( r , USR_QUERY ); - - ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" ); - ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" ); - - Sequence seqRead; - - // deletes itself - osl::Thread *p = new WriteToStreamThread( output, iMax ); - - ERROR_ASSERT( p , "couldn't create thread for testing !\n" ); - - p->create(); - - for(int i = 0 ; TRUE ; i ++ ) { - if( 0 == input->readBytes( seqRead, createIntSeq(i).getLen() ) ) { - // eof reached ! - break; - } - - ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() , - (char*) createIntSeq(i).getArray() ) , - "written/read mismatch\n" ); - } - - ERROR_ASSERT( i == iMax , "less elements read than written !"); - input->closeInput(); -} - -/* { - try { - XInterfaceRef x = xSMgr->createInstance( strService ); - - XInputStreamRef input( x , USR_QUERY ); - XOutputStreamRef output( x , USR_QUERY ); - - OSL_ASSERT( output.is() ); - while( TRUE ) { - // basic read/write - Sequence seqWrite( 500 ); - output->writeBytes( seqWrite ); - - } - } - catch( IOException& e ) { - printf( "%s %s\n" , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() , - UStringToString( e.Message , CHARSET_SYSTEM ).GetCharStr() ); - } - } -*/ - - - - -/** -* for external binding -* -* -**/ -XInterfaceRef OPipeTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)) -{ - OPipeTest *p = new OPipeTest( rSMgr ); - XInterfaceRef xService = *p; - return xService; -} - - - -Sequence OPipeTest_getSupportedServiceNames(void) THROWS( () ) -{ - Sequence aRet(1); - aRet.getArray()[0] = OPipeTest_getImplementationName(); - - return aRet; -} - -UString OPipeTest_getServiceName() THROWS( () ) -{ - return SERVICE_NAME; -} - -UString OPipeTest_getImplementationName() THROWS( () ) -{ - return IMPLEMENTATION_NAME; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/stm/testfactreg.cxx b/extensions/test/stm/testfactreg.cxx deleted file mode 100644 index 8817679b8..000000000 --- a/extensions/test/stm/testfactreg.cxx +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include - -#include // for EXTERN_SERVICE_CALLTYPE - -#include -#include "testfactreg.hxx" - - -using namespace usr; - -#ifdef __cplusplus -extern "C" -{ -#endif - -BOOL EXTERN_SERVICE_CALLTYPE exService_writeRegEntry( - const UNO_INTERFACE(XRegistryKey)* xUnoKey) - -{ - XRegistryKeyRef xKey; - uno2smart(xKey, *xUnoKey); - - UString str = UString( L"/" ) + OPipeTest_getImplementationName() + UString( L"/UNO/SERVICES" ); - XRegistryKeyRef xNewKey = xKey->createKey( str ); - xNewKey->createKey( OPipeTest_getServiceName() ); - - str = UString( L"/" ) + ODataStreamTest_getImplementationName(1) + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( ODataStreamTest_getServiceName(1) ); - - str = UString( L"/" ) + ODataStreamTest_getImplementationName(2) + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( ODataStreamTest_getServiceName(2) ); - - str = UString( L"/" ) + OObjectStreamTest_getImplementationName(1) + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OObjectStreamTest_getServiceName(1) ); - - str = UString( L"/" ) + OObjectStreamTest_getImplementationName(2) + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OObjectStreamTest_getServiceName(2) ); - - str = UString( L"/" ) + OMarkableOutputStreamTest_getImplementationName() + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OMarkableOutputStreamTest_getServiceName() ); - - str = UString( L"/" ) + OMarkableInputStreamTest_getImplementationName() + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OMarkableInputStreamTest_getServiceName() ); - - str = UString( L"/" ) + OMyPersistObject_getImplementationName() + UString( L"/UNO/SERVICES" ); - xNewKey = xKey->createKey( str ); - xNewKey->createKey( OMyPersistObject_getServiceName() ); - - return TRUE; -} - - -UNO_INTERFACE(XInterface) EXTERN_SERVICE_CALLTYPE exService_getFactory -( - const wchar_t* implementationName, - const UNO_INTERFACE(XMultiServiceFactory)* xUnoFact, - const UNO_INTERFACE(XRegistryKey)* -) -{ - UNO_INTERFACE(XInterface) xUnoRet = {0, 0}; - - XInterfaceRef xRet; - XMultiServiceFactoryRef xSMgr; - UString aImplementationName(implementationName); - - uno2smart(xSMgr, *xUnoFact); - - if (aImplementationName == OPipeTest_getImplementationName() ) - { - xRet = createSingleFactory( xSMgr, implementationName, - OPipeTest_CreateInstance, - OPipeTest_getSupportedServiceNames() ); - } - else if( aImplementationName == ODataStreamTest_getImplementationName(1) ) { - xRet = createSingleFactory( xSMgr , implementationName, - ODataStreamTest_CreateInstance, - ODataStreamTest_getSupportedServiceNames(1) ); - } - else if( aImplementationName == ODataStreamTest_getImplementationName(2) ) { - xRet = createSingleFactory( xSMgr , implementationName, - ODataStreamTest_CreateInstance, - ODataStreamTest_getSupportedServiceNames(2) ); - } - else if( aImplementationName == OObjectStreamTest_getImplementationName(1) ) { - xRet = createSingleFactory( xSMgr , implementationName, - OObjectStreamTest_CreateInstance, - OObjectStreamTest_getSupportedServiceNames(1) ); - } - else if( aImplementationName == OObjectStreamTest_getImplementationName(2) ) { - xRet = createSingleFactory( xSMgr , implementationName, - OObjectStreamTest_CreateInstance, - OObjectStreamTest_getSupportedServiceNames(2) ); - } - else if( aImplementationName == OMarkableOutputStreamTest_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , implementationName, - OMarkableOutputStreamTest_CreateInstance, - OMarkableOutputStreamTest_getSupportedServiceNames() ); - } - else if( aImplementationName == OMarkableInputStreamTest_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , implementationName, - OMarkableInputStreamTest_CreateInstance, - OMarkableInputStreamTest_getSupportedServiceNames() ); - } - else if( aImplementationName == OMyPersistObject_getImplementationName() ) { - xRet = createSingleFactory( xSMgr , implementationName, - OMyPersistObject_CreateInstance, - OMyPersistObject_getSupportedServiceNames() ); - } - if (xRet.is()) - { - smart2uno(xRet, xUnoRet); - } - - return xUnoRet; -} - -#ifdef __cplusplus -} -#endif - -Sequence createSeq( char * p ) -{ - Sequence seq( strlen( p )+1 ); - strcpy( (char * ) seq.getArray() , p ); - return seq; -} - -Sequence createIntSeq( INT32 i ) -{ - char pcCount[20]; - sprintf( pcCount , "%d" , i ); - return createSeq( pcCount ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/stm/testfactreg.hxx b/extensions/test/stm/testfactreg.hxx deleted file mode 100644 index 07e192a94..000000000 --- a/extensions/test/stm/testfactreg.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -XInterfaceRef OPipeTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence OPipeTest_getSupportedServiceNames(void) THROWS( () ); -UString OPipeTest_getServiceName() THROWS( () ); -UString OPipeTest_getImplementationName() THROWS( () ); - -XInterfaceRef ODataStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence ODataStreamTest_getSupportedServiceNames( int i) THROWS( () ); -UString ODataStreamTest_getServiceName( int i) THROWS( ( ) ); -UString ODataStreamTest_getImplementationName( int i) THROWS( () ); - -XInterfaceRef OMarkableOutputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence OMarkableOutputStreamTest_getSupportedServiceNames(void) THROWS( () ); -UString OMarkableOutputStreamTest_getServiceName() THROWS( () ); -UString OMarkableOutputStreamTest_getImplementationName() THROWS( () ); - -XInterfaceRef OMarkableInputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence OMarkableInputStreamTest_getSupportedServiceNames(void) THROWS( () ); -UString OMarkableInputStreamTest_getServiceName() THROWS( () ); -UString OMarkableInputStreamTest_getImplementationName() THROWS( () ); - -XInterfaceRef OObjectStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence OObjectStreamTest_getSupportedServiceNames( int i) THROWS( () ); -UString OObjectStreamTest_getServiceName( int i) THROWS( () ); -UString OObjectStreamTest_getImplementationName( int i) THROWS( () ); - -XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception)); -Sequence OMyPersistObject_getSupportedServiceNames( ) THROWS( () ); -UString OMyPersistObject_getServiceName( ) THROWS( () ); -UString OMyPersistObject_getImplementationName( ) THROWS( () ); - -Sequence createSeq( char * p ); -Sequence createIntSeq( INT32 i ); - -#define BUILD_ERROR(expr, Message)\ - {\ - m_seqErrors.realloc( m_seqErrors.getLen() + 1 ); \ - m_seqExceptions.realloc( m_seqExceptions.getLen() + 1 ); \ - String str; \ - str += __FILE__;\ - str += " "; \ - str += "(" ; \ - str += __LINE__ ;\ - str += ")\n";\ - str += "[ " ; \ - str += #expr; \ - str += " ] : " ; \ - str += Message; \ - m_seqErrors.getArray()[ m_seqErrors.getLen()-1] = StringToOUString( str , CHARSET_SYSTEM ); \ - }\ - ((void)0) - - -#define WARNING_ASSERT(expr, Message) \ - if( ! (expr) ) { \ - m_seqWarnings.realloc( m_seqErrors.getLen() +1 ); \ - String str;\ - str += __FILE__;\ - str += " "; \ - str += "(" ; \ - str += __LINE__ ;\ - str += ")\n";\ - str += "[ " ; \ - str += #expr; \ - str += " ] : " ; \ - str += Message; \ - m_seqWarnings.getArray()[ m_seqWarnings.getLen()-1] = StringToOUString( str , CHARSET_SYSTEM ); \ - return; \ - }\ - ((void)0) - -#define ERROR_ASSERT(expr, Message) \ - if( ! (expr) ) { \ - BUILD_ERROR(expr, Message );\ - return; \ - }\ - ((void)0) - -#define ERROR_EXCEPTION_ASSERT(expr, Message, Exception) \ - if( !(expr)) { \ - BUILD_ERROR(expr,Message);\ - m_seqExceptions.getArray()[ m_seqExceptions.getLen()-1] = UsrAny( Exception );\ - return; \ - } \ - ((void)0) - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src deleted file mode 100644 index 0ad1e2432..000000000 --- a/extensions/util/hidother.src +++ /dev/null @@ -1,428 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "../inc/abpilot.hrc" -#include "../inc/bibliography.hrc" -#include "../inc/dbpilots.hrc" -#include "../inc/propctrlr.hrc" -#include "../inc/update.hrc" - -hidspecial HID_ABSPILOT { HelpId = HID_ABSPILOT; } -hidspecial HID_ABSPILOT_CANCEL { HelpId = HID_ABSPILOT_CANCEL; } -hidspecial HID_ABSPILOT_FINISH { HelpId = HID_ABSPILOT_FINISH; } -hidspecial HID_ABSPILOT_NEXT { HelpId = HID_ABSPILOT_NEXT; } -hidspecial HID_ABSPILOT_PREVIOUS { HelpId = HID_ABSPILOT_PREVIOUS; } - -hidspecial HID_BIB_ADDRESS_POS { HelpId = HID_BIB_ADDRESS_POS; } -hidspecial HID_BIB_ANNOTE_POS { HelpId = HID_BIB_ANNOTE_POS; } -hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpId = HID_BIB_AUTHORITYTYPE_POS; } -hidspecial HID_BIB_AUTHOR_POS { HelpId = HID_BIB_AUTHOR_POS; } -hidspecial HID_BIB_BOOKTITLE_POS { HelpId = HID_BIB_BOOKTITLE_POS; } -hidspecial HID_BIB_CHANGESOURCE { HelpId = HID_BIB_CHANGESOURCE; } -hidspecial HID_BIB_CHAPTER_POS { HelpId = HID_BIB_CHAPTER_POS; } -hidspecial HID_BIB_CONTROL_PAGE { HelpId = HID_BIB_CONTROL_PAGE; } -hidspecial HID_BIB_CONTROL_PARENT { HelpId = HID_BIB_CONTROL_PARENT; } -hidspecial HID_BIB_CUSTOM1_POS { HelpId = HID_BIB_CUSTOM1_POS; } -hidspecial HID_BIB_CUSTOM2_POS { HelpId = HID_BIB_CUSTOM2_POS; } -hidspecial HID_BIB_CUSTOM3_POS { HelpId = HID_BIB_CUSTOM3_POS; } -hidspecial HID_BIB_CUSTOM4_POS { HelpId = HID_BIB_CUSTOM4_POS; } -hidspecial HID_BIB_CUSTOM5_POS { HelpId = HID_BIB_CUSTOM5_POS; } -hidspecial HID_BIB_DB_GRIDCTRL { HelpId = HID_BIB_DB_GRIDCTRL; } -hidspecial HID_BIB_DB_TBX { HelpId = HID_BIB_DB_TBX; } -hidspecial HID_BIB_DELETE_RECORD { HelpId = HID_BIB_DELETE_RECORD; } -hidspecial HID_BIB_EDITION_POS { HelpId = HID_BIB_EDITION_POS; } -hidspecial HID_BIB_EDITOR_POS { HelpId = HID_BIB_EDITOR_POS; } -hidspecial HID_BIB_HOWPUBLISHED_POS { HelpId = HID_BIB_HOWPUBLISHED_POS; } -hidspecial HID_BIB_IDENTIFIER_POS { HelpId = HID_BIB_IDENTIFIER_POS; } -hidspecial HID_BIB_INSERT_RECORD { HelpId = HID_BIB_INSERT_RECORD; } -hidspecial HID_BIB_INSTITUTION_POS { HelpId = HID_BIB_INSTITUTION_POS; } -hidspecial HID_BIB_ISBN_POS { HelpId = HID_BIB_ISBN_POS; } -hidspecial HID_BIB_JOURNAL_POS { HelpId = HID_BIB_JOURNAL_POS; } -hidspecial HID_BIB_MAPPINGDLG { HelpId = HID_BIB_MAPPINGDLG; } -hidspecial HID_BIB_MONTH_POS { HelpId = HID_BIB_MONTH_POS; } -hidspecial HID_BIB_NOTE_POS { HelpId = HID_BIB_NOTE_POS; } -hidspecial HID_BIB_NUMBER_POS { HelpId = HID_BIB_NUMBER_POS; } -hidspecial HID_BIB_ORGANIZATIONS_POS { HelpId = HID_BIB_ORGANIZATIONS_POS; } -hidspecial HID_BIB_PAGES_POS { HelpId = HID_BIB_PAGES_POS; } -hidspecial HID_BIB_PUBLISHER_POS { HelpId = HID_BIB_PUBLISHER_POS; } -hidspecial HID_BIB_REPORTTYPE_POS { HelpId = HID_BIB_REPORTTYPE_POS; } -hidspecial HID_BIB_SCHOOL_POS { HelpId = HID_BIB_SCHOOL_POS; } -hidspecial HID_BIB_SERIES_POS { HelpId = HID_BIB_SERIES_POS; } -hidspecial HID_BIB_TBX_AUTOFILTER { HelpId = HID_BIB_TBX_AUTOFILTER; } -hidspecial HID_BIB_TBX_SEARCH { HelpId = HID_BIB_TBX_SEARCH; } -hidspecial HID_BIB_TBX_TABLE { HelpId = HID_BIB_TBX_TABLE; } -hidspecial HID_BIB_TITLE_POS { HelpId = HID_BIB_TITLE_POS; } -hidspecial HID_BIB_URL_POS { HelpId = HID_BIB_URL_POS; } -hidspecial HID_BIB_VOLUME_POS { HelpId = HID_BIB_VOLUME_POS; } -hidspecial HID_BIB_YEAR_POS { HelpId = HID_BIB_YEAR_POS; } - -hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; } -hidspecial HID_CHECK_FOR_UPD_CLOSE { HelpId = HID_CHECK_FOR_UPD_CLOSE; } -hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; } -hidspecial HID_CHECK_FOR_UPD_DLG { HelpId = HID_CHECK_FOR_UPD_DLG; } -hidspecial HID_CHECK_FOR_UPD_DOWNLOAD { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD; } -hidspecial HID_CHECK_FOR_UPD_DOWNLOAD2 { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD2; } -hidspecial HID_CHECK_FOR_UPD_INSTALL { HelpId = HID_CHECK_FOR_UPD_INSTALL; } -hidspecial HID_CHECK_FOR_UPD_PAUSE { HelpId = HID_CHECK_FOR_UPD_PAUSE; } -hidspecial HID_CHECK_FOR_UPD_RESUME { HelpId = HID_CHECK_FOR_UPD_RESUME; } -hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STATUS; } - -hidspecial HID_DLG_DBCHANGE { HelpId = HID_DLG_DBCHANGE; } -hidspecial HID_DLG_MAPPING { HelpId = HID_DLG_MAPPING; } - -hidspecial HID_EVT_ACTIONPERFORMED { HelpId = HID_EVT_ACTIONPERFORMED; } -hidspecial HID_EVT_ADJUSTMENTVALUECHANGED { HelpId = HID_EVT_ADJUSTMENTVALUECHANGED; } -hidspecial HID_EVT_AFTERUPDATE { HelpId = HID_EVT_AFTERUPDATE; } -hidspecial HID_EVT_APPROVEACTIONPERFORMED { HelpId = HID_EVT_APPROVEACTIONPERFORMED; } -hidspecial HID_EVT_APPROVEPARAMETER { HelpId = HID_EVT_APPROVEPARAMETER; } -hidspecial HID_EVT_APPROVERESETTED { HelpId = HID_EVT_APPROVERESETTED; } -hidspecial HID_EVT_APPROVEROWCHANGE { HelpId = HID_EVT_APPROVEROWCHANGE; } -hidspecial HID_EVT_BEFOREUPDATE { HelpId = HID_EVT_BEFOREUPDATE; } -hidspecial HID_EVT_CHANGED { HelpId = HID_EVT_CHANGED; } -hidspecial HID_EVT_CONFIRMDELETE { HelpId = HID_EVT_CONFIRMDELETE; } -hidspecial HID_EVT_ERROROCCURRED { HelpId = HID_EVT_ERROROCCURRED; } -hidspecial HID_EVT_FOCUSGAINED { HelpId = HID_EVT_FOCUSGAINED; } -hidspecial HID_EVT_FOCUSLOST { HelpId = HID_EVT_FOCUSLOST; } -hidspecial HID_EVT_ITEMSTATECHANGED { HelpId = HID_EVT_ITEMSTATECHANGED; } -hidspecial HID_EVT_KEYTYPED { HelpId = HID_EVT_KEYTYPED; } -hidspecial HID_EVT_KEYUP { HelpId = HID_EVT_KEYUP; } -hidspecial HID_EVT_LOADED { HelpId = HID_EVT_LOADED; } -hidspecial HID_EVT_MOUSEDRAGGED { HelpId = HID_EVT_MOUSEDRAGGED; } -hidspecial HID_EVT_MOUSEENTERED { HelpId = HID_EVT_MOUSEENTERED; } -hidspecial HID_EVT_MOUSEEXITED { HelpId = HID_EVT_MOUSEEXITED; } -hidspecial HID_EVT_MOUSEMOVED { HelpId = HID_EVT_MOUSEMOVED; } -hidspecial HID_EVT_MOUSEPRESSED { HelpId = HID_EVT_MOUSEPRESSED; } -hidspecial HID_EVT_MOUSERELEASED { HelpId = HID_EVT_MOUSERELEASED; } -hidspecial HID_EVT_POSITIONED { HelpId = HID_EVT_POSITIONED; } -hidspecial HID_EVT_POSITIONING { HelpId = HID_EVT_POSITIONING; } -hidspecial HID_EVT_RELOADED { HelpId = HID_EVT_RELOADED; } -hidspecial HID_EVT_RELOADING { HelpId = HID_EVT_RELOADING; } -hidspecial HID_EVT_RESETTED { HelpId = HID_EVT_RESETTED; } -hidspecial HID_EVT_ROWCHANGE { HelpId = HID_EVT_ROWCHANGE; } -hidspecial HID_EVT_SUBMITTED { HelpId = HID_EVT_SUBMITTED; } -hidspecial HID_EVT_TEXTCHANGED { HelpId = HID_EVT_TEXTCHANGED; } -hidspecial HID_EVT_UNLOADED { HelpId = HID_EVT_UNLOADED; } -hidspecial HID_EVT_UNLOADING { HelpId = HID_EVT_UNLOADING; } - -hidspecial HID_FIELDLINK_DETAIL_COLUMN { HelpId = HID_FIELDLINK_DETAIL_COLUMN; } -hidspecial HID_FIELDLINK_MASTER_COLUMN { HelpId = HID_FIELDLINK_MASTER_COLUMN; } - -hidspecial HID_GRIDWIZARD_CANCEL { HelpId = HID_GRIDWIZARD_CANCEL; } -hidspecial HID_GRIDWIZARD_FINISH { HelpId = HID_GRIDWIZARD_FINISH; } -hidspecial HID_GRIDWIZARD_NEXT { HelpId = HID_GRIDWIZARD_NEXT; } -hidspecial HID_GRIDWIZARD_PREVIOUS { HelpId = HID_GRIDWIZARD_PREVIOUS; }; -hidspecial HID_GROUPWIZARD_CANCEL { HelpId = HID_GROUPWIZARD_CANCEL; } -hidspecial HID_GROUPWIZARD_FINISH { HelpId = HID_GROUPWIZARD_FINISH; } -hidspecial HID_GROUPWIZARD_NEXT { HelpId = HID_GROUPWIZARD_NEXT; } -hidspecial HID_GROUPWIZARD_PREVIOUS { HelpId = HID_GROUPWIZARD_PREVIOUS; } - -hidspecial HID_LISTWIZARD_CANCEL { HelpId = HID_LISTWIZARD_CANCEL; } -hidspecial HID_LISTWIZARD_FINISH { HelpId = HID_LISTWIZARD_FINISH; } -hidspecial HID_LISTWIZARD_NEXT { HelpId = HID_LISTWIZARD_NEXT; } -hidspecial HID_LISTWIZARD_PREVIOUS { HelpId = HID_LISTWIZARD_PREVIOUS; } - -hidspecial HID_PROP_ALIGN { HelpId = HID_PROP_ALIGN; } -hidspecial HID_PROP_ALLOW_ADDITIONS { HelpId = HID_PROP_ALLOW_ADDITIONS; } -hidspecial HID_PROP_ALLOW_DELETIONS { HelpId = HID_PROP_ALLOW_DELETIONS; } -hidspecial HID_PROP_ALLOW_EDITS { HelpId = HID_PROP_ALLOW_EDITS; } -hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; } -hidspecial HID_PROP_AUTOCOMPLETE { HelpId = HID_PROP_AUTOCOMPLETE; } -hidspecial HID_PROP_AUTOLINEBREAK { HelpId = HID_PROP_AUTOLINEBREAK; } -hidspecial HID_PROP_BACKGROUNDCOLOR { HelpId = HID_PROP_BACKGROUNDCOLOR; } -hidspecial HID_PROP_BINDING_NAME { HelpId = HID_PROP_BINDING_NAME; } -hidspecial HID_PROP_BIND_EXPRESSION { HelpId = HID_PROP_BIND_EXPRESSION; } -hidspecial HID_PROP_BLOCKINCREMENT { HelpId = HID_PROP_BLOCKINCREMENT; } -hidspecial HID_PROP_BORDER { HelpId = HID_PROP_BORDER; } -hidspecial HID_PROP_BORDERCOLOR { HelpId = HID_PROP_BORDERCOLOR; } -hidspecial HID_PROP_BOUNDCOLUMN { HelpId = HID_PROP_BOUNDCOLUMN; } -hidspecial HID_PROP_BOUND_CELL { HelpId = HID_PROP_BOUND_CELL; } -hidspecial HID_PROP_BUTTONTYPE { HelpId = HID_PROP_BUTTONTYPE; } -hidspecial HID_PROP_CELL_EXCHANGE_TYPE { HelpId = HID_PROP_CELL_EXCHANGE_TYPE; } -hidspecial HID_PROP_CLASSID { HelpId = HID_PROP_CLASSID; } -hidspecial HID_PROP_CONTROLLABEL { HelpId = HID_PROP_CONTROLLABEL; } -hidspecial HID_PROP_CONTROLSOURCE { HelpId = HID_PROP_CONTROLSOURCE; } -hidspecial HID_PROP_CURRENCYSYMBOL { HelpId = HID_PROP_CURRENCYSYMBOL; } -hidspecial HID_PROP_CURRSYM_POSITION { HelpId = HID_PROP_CURRSYM_POSITION; } -hidspecial HID_PROP_CURSORSOURCE { HelpId = HID_PROP_CURSORSOURCE; } -hidspecial HID_PROP_CURSORSOURCETYPE { HelpId = HID_PROP_CURSORSOURCETYPE; } -hidspecial HID_PROP_CURSORTYPE { HelpId = HID_PROP_CURSORTYPE; } -hidspecial HID_PROP_CYCLE { HelpId = HID_PROP_CYCLE; } -hidspecial HID_PROP_DATAENTRY { HelpId = HID_PROP_DATAENTRY; } -hidspecial HID_PROP_DATASOURCE { HelpId = HID_PROP_DATASOURCE; } -hidspecial HID_PROP_DATE { HelpId = HID_PROP_DATE; } -hidspecial HID_PROP_DATEFORMAT { HelpId = HID_PROP_DATEFORMAT; } -hidspecial HID_PROP_DATEMAX { HelpId = HID_PROP_DATEMAX; } -hidspecial HID_PROP_DATEMIN { HelpId = HID_PROP_DATEMIN; } -hidspecial HID_PROP_DECIMAL_ACCURACY { HelpId = HID_PROP_DECIMAL_ACCURACY; } -hidspecial HID_PROP_DECORATION { HelpId = HID_PROP_DECORATION; } -hidspecial HID_PROP_DEFAULTVALUE { HelpId = HID_PROP_DEFAULTVALUE; } -hidspecial HID_PROP_DEFAULT_BUTTON { HelpId = HID_PROP_DEFAULT_BUTTON; } -hidspecial HID_PROP_DEFAULT_DATE { HelpId = HID_PROP_DEFAULT_DATE; } -hidspecial HID_PROP_DEFAULT_LONG_VALUE { HelpId = HID_PROP_DEFAULT_LONG_VALUE; } -hidspecial HID_PROP_DEFAULT_SCROLLVALUE { HelpId = HID_PROP_DEFAULT_SCROLLVALUE; } -hidspecial HID_PROP_DEFAULT_SELECT_SEQ { HelpId = HID_PROP_DEFAULT_SELECT_SEQ; } -hidspecial HID_PROP_DEFAULT_SPINVALUE { HelpId = HID_PROP_DEFAULT_SPINVALUE; } -hidspecial HID_PROP_DEFAULT_STATE { HelpId = HID_PROP_DEFAULT_STATE; } -hidspecial HID_PROP_DEFAULT_TIME { HelpId = HID_PROP_DEFAULT_TIME; } -hidspecial HID_PROP_DIRTY { HelpId = HID_PROP_DIRTY; } -hidspecial HID_PROP_DROPDOWN { HelpId = HID_PROP_DROPDOWN; } -hidspecial HID_PROP_ECHO_CHAR { HelpId = HID_PROP_ECHO_CHAR; } -hidspecial HID_PROP_EDITABLE { HelpId = HID_PROP_EDITABLE; } -hidspecial HID_PROP_EDITMASK { HelpId = HID_PROP_EDITMASK; } -hidspecial HID_PROP_EFFECTIVEDEFAULT { HelpId = HID_PROP_EFFECTIVEDEFAULT; } -hidspecial HID_PROP_EFFECTIVEMAX { HelpId = HID_PROP_EFFECTIVEMAX; } -hidspecial HID_PROP_EFFECTIVEMIN { HelpId = HID_PROP_EFFECTIVEMIN; } -hidspecial HID_PROP_EMPTY_IS_NULL { HelpId = HID_PROP_EMPTY_IS_NULL; } -hidspecial HID_PROP_ENABLED { HelpId = HID_PROP_ENABLED; } -hidspecial HID_PROP_ENABLE_VISIBLE { HelpId = HID_PROP_ENABLE_VISIBLE; } -hidspecial HID_PROP_ESCAPE_PROCESSING { HelpId = HID_PROP_ESCAPE_PROCESSING; } -hidspecial HID_PROP_FILLCOLOR { HelpId = HID_PROP_FILLCOLOR; } -hidspecial HID_PROP_FILTER { HelpId = HID_PROP_FILTER; } -hidspecial HID_PROP_FILTERPROPOSAL { HelpId = HID_PROP_FILTERPROPOSAL; } -hidspecial HID_PROP_FOCUSONCLICK { HelpId = HID_PROP_FOCUSONCLICK; } -hidspecial HID_PROP_FONT { HelpId = HID_PROP_FONT; } -hidspecial HID_PROP_FORMATKEY { HelpId = HID_PROP_FORMATKEY; } -hidspecial HID_PROP_GROUPBOX { HelpId = HID_PROP_GROUPBOX; } -hidspecial HID_PROP_GROUP_NAME { HelpId = HID_PROP_GROUP_NAME; } -hidspecial HID_PROP_HEIGHT { HelpId = HID_PROP_HEIGHT; } -hidspecial HID_PROP_HELPTEXT { HelpId = HID_PROP_HELPTEXT; } -hidspecial HID_PROP_HELPURL { HelpId = HID_PROP_HELPURL; } -hidspecial HID_PROP_HIDDEN_VALUE { HelpId = HID_PROP_HIDDEN_VALUE; } -hidspecial HID_PROP_HIDEINACTIVESELECTION { HelpId = HID_PROP_HIDEINACTIVESELECTION; } -hidspecial HID_PROP_HSCROLL { HelpId = HID_PROP_HSCROLL; } -hidspecial HID_PROP_ICONSIZE { HelpId = HID_PROP_ICONSIZE; } -hidspecial HID_PROP_IMAGEPOSITION { HelpId = HID_PROP_IMAGEPOSITION; } -hidspecial HID_PROP_IMAGE_URL { HelpId = HID_PROP_IMAGE_URL; } -hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; } -hidspecial HID_PROP_INVOKES_STOP_NOT_EDITING { HelpId = HID_PROP_INVOKES_STOP_NOT_EDITING; } -hidspecial HID_PROP_LABEL { HelpId = HID_PROP_LABEL; } -hidspecial HID_PROP_LEFT { HelpId = HID_PROP_LEFT; } -hidspecial HID_PROP_LINECOLOR { HelpId = HID_PROP_LINECOLOR; } -hidspecial HID_PROP_LINECOUNT { HelpId = HID_PROP_LINECOUNT; } -hidspecial HID_PROP_LINEEND_FORMAT { HelpId = HID_PROP_LINEEND_FORMAT; } -hidspecial HID_PROP_LINEINCREMENT { HelpId = HID_PROP_LINEINCREMENT; } -hidspecial HID_PROP_LISTINDEX { HelpId = HID_PROP_LISTINDEX; } -hidspecial HID_PROP_LISTSOURCE { HelpId = HID_PROP_LISTSOURCE; } -hidspecial HID_PROP_LISTSOURCETYPE { HelpId = HID_PROP_LISTSOURCETYPE; } -hidspecial HID_PROP_LIST_BINDING { HelpId = HID_PROP_LIST_BINDING; } -hidspecial HID_PROP_LIST_CELL_RANGE { HelpId = HID_PROP_LIST_CELL_RANGE; } -hidspecial HID_PROP_LITERALMASK { HelpId = HID_PROP_LITERALMASK; } -hidspecial HID_PROP_LOCKED { HelpId = HID_PROP_LOCKED; } -hidspecial HID_PROP_MASTERFIELDS { HelpId = HID_PROP_MASTERFIELDS; } -hidspecial HID_PROP_MAXTEXTLEN { HelpId = HID_PROP_MAXTEXTLEN; } -hidspecial HID_PROP_MULTILINE { HelpId = HID_PROP_MULTILINE; } -hidspecial HID_PROP_MULTISELECTION { HelpId = HID_PROP_MULTISELECTION; } -hidspecial HID_PROP_NAME { HelpId = HID_PROP_NAME; } -hidspecial HID_PROP_NAVIGATION { HelpId = HID_PROP_NAVIGATION; } -hidspecial HID_PROP_NAVIGATIONBAR { HelpId = HID_PROP_NAVIGATIONBAR; } -hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; } -hidspecial HID_PROP_OLDVALUE { HelpId = HID_PROP_OLDVALUE; } -hidspecial HID_PROP_ORIENTATION { HelpId = HID_PROP_ORIENTATION; } -hidspecial HID_PROP_POSITIONX { HelpId = HID_PROP_POSITIONX; } -hidspecial HID_PROP_POSITIONY { HelpId = HID_PROP_POSITIONY; } -hidspecial HID_PROP_PRINTABLE { HelpId = HID_PROP_PRINTABLE; } -hidspecial HID_PROP_PROGRESSVALUE { HelpId = HID_PROP_PROGRESSVALUE; } -hidspecial HID_PROP_PROGRESSVALUE_MAX { HelpId = HID_PROP_PROGRESSVALUE_MAX; } -hidspecial HID_PROP_PROGRESSVALUE_MIN { HelpId = HID_PROP_PROGRESSVALUE_MIN; } -hidspecial HID_PROP_PUSHBUTTONTYPE { HelpId = HID_PROP_PUSHBUTTONTYPE; } -hidspecial HID_PROP_READONLY { HelpId = HID_PROP_READONLY; } -hidspecial HID_PROP_RECORDMARKER { HelpId = HID_PROP_RECORDMARKER; } -hidspecial HID_PROP_REFVALUE { HelpId = HID_PROP_REFVALUE; } -hidspecial HID_PROP_REPEAT { HelpId = HID_PROP_REPEAT; } -hidspecial HID_PROP_REPEAT_DELAY { HelpId = HID_PROP_REPEAT_DELAY; } -hidspecial HID_PROP_REQUIRED { HelpId = HID_PROP_REQUIRED; } -hidspecial HID_PROP_RIGHT { HelpId = HID_PROP_RIGHT; } -hidspecial HID_PROP_ROOT_DISPLAYED { HelpId = HID_PROP_ROOT_DISPLAYED; } -hidspecial HID_PROP_ROWHEIGHT { HelpId = HID_PROP_ROWHEIGHT; } -hidspecial HID_PROP_ROW_HEIGHT { HelpId = HID_PROP_ROW_HEIGHT; } -hidspecial HID_PROP_SCALEIMAGE { HelpId = HID_PROP_SCALEIMAGE; } -hidspecial HID_PROP_SCROLLVALUE { HelpId = HID_PROP_SCROLLVALUE; } -hidspecial HID_PROP_SCROLLVALUEMIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } -hidspecial HID_PROP_SCROLLVALUE_MAX { HelpId = HID_PROP_SCROLLVALUE_MAX; } -hidspecial HID_PROP_SCROLLVALUE_MIN { HelpId = HID_PROP_SCROLLVALUE_MIN; } -hidspecial HID_PROP_SEARCHING { HelpId = HID_PROP_SEARCHING; } -hidspecial HID_PROP_SELECTEDITEMS { HelpId = HID_PROP_SELECTEDITEMS; } -hidspecial HID_PROP_SELECTION_TYPE { HelpId = HID_PROP_SELECTION_TYPE; } -hidspecial HID_PROP_SHOWS_HANDLES { HelpId = HID_PROP_SHOWS_HANDLES; } -hidspecial HID_PROP_SHOWS_ROOT_HANDLES { HelpId = HID_PROP_SHOWS_ROOT_HANDLES; } -hidspecial HID_PROP_SHOWTHOUSANDSEP { HelpId = HID_PROP_SHOWTHOUSANDSEP; } -hidspecial HID_PROP_SHOW_FILTERSORT { HelpId = HID_PROP_SHOW_FILTERSORT; } -hidspecial HID_PROP_SHOW_NAVIGATION { HelpId = HID_PROP_SHOW_NAVIGATION; } -hidspecial HID_PROP_SHOW_POSITION { HelpId = HID_PROP_SHOW_POSITION; } -hidspecial HID_PROP_SHOW_RECORDACTIONS { HelpId = HID_PROP_SHOW_RECORDACTIONS; } -hidspecial HID_PROP_SHOW_SCROLLBARS { HelpId = HID_PROP_SHOW_SCROLLBARS; } -hidspecial HID_PROP_SLAVEFIELDS { HelpId = HID_PROP_SLAVEFIELDS; } -hidspecial HID_PROP_SORT_CRITERIA { HelpId = HID_PROP_SORT_CRITERIA; } -hidspecial HID_PROP_SPIN { HelpId = HID_PROP_SPIN; } -hidspecial HID_PROP_SPININCREMENT { HelpId = HID_PROP_SPININCREMENT; } -hidspecial HID_PROP_SPINVALUE { HelpId = HID_PROP_SPINVALUE; } -hidspecial HID_PROP_SPINVALUE_MAX { HelpId = HID_PROP_SPINVALUE_MAX; } -hidspecial HID_PROP_SPINVALUE_MIN { HelpId = HID_PROP_SPINVALUE_MIN; } -hidspecial HID_PROP_STATE { HelpId = HID_PROP_STATE; } -hidspecial HID_PROP_STEP { HelpId = HID_PROP_STEP; } -hidspecial HID_PROP_STRICTFORMAT { HelpId = HID_PROP_STRICTFORMAT; } -hidspecial HID_PROP_STRINGITEMLIST { HelpId = HID_PROP_STRINGITEMLIST; } -hidspecial HID_PROP_SUBMISSION_ID { HelpId = HID_PROP_SUBMISSION_ID; } -hidspecial HID_PROP_SUBMIT_ACTION { HelpId = HID_PROP_SUBMIT_ACTION; } -hidspecial HID_PROP_SUBMIT_ENCODING { HelpId = HID_PROP_SUBMIT_ENCODING; } -hidspecial HID_PROP_SUBMIT_METHOD { HelpId = HID_PROP_SUBMIT_METHOD; } -hidspecial HID_PROP_SUBMIT_TARGET { HelpId = HID_PROP_SUBMIT_TARGET; } -hidspecial HID_PROP_SYMBOLCOLOR { HelpId = HID_PROP_SYMBOLCOLOR; } -hidspecial HID_PROP_TABINDEX { HelpId = HID_PROP_TABINDEX; } -hidspecial HID_PROP_TABORDER_CONTROLS { HelpId = HID_PROP_TABORDER_CONTROLS; } -hidspecial HID_PROP_TABSTOP { HelpId = HID_PROP_TABSTOP; } -hidspecial HID_PROP_TAG { HelpId = HID_PROP_TAG; } -hidspecial HID_PROP_TARGET_FRAME { HelpId = HID_PROP_TARGET_FRAME; } -hidspecial HID_PROP_TARGET_URL { HelpId = HID_PROP_TARGET_URL; } -hidspecial HID_PROP_TEXT { HelpId = HID_PROP_TEXT; } -hidspecial HID_PROP_TEXTTYPE { HelpId = HID_PROP_TEXTTYPE; } -hidspecial HID_PROP_TIME { HelpId = HID_PROP_TIME; } -hidspecial HID_PROP_TIMEFORMAT { HelpId = HID_PROP_TIMEFORMAT; } -hidspecial HID_PROP_TIMEMAX { HelpId = HID_PROP_TIMEMAX; } -hidspecial HID_PROP_TIMEMIN { HelpId = HID_PROP_TIMEMIN; } -hidspecial HID_PROP_TITLE { HelpId = HID_PROP_TITLE; } -hidspecial HID_PROP_TOGGLE { HelpId = HID_PROP_TOGGLE; } -hidspecial HID_PROP_TRISTATE { HelpId = HID_PROP_TRISTATE; } -hidspecial HID_PROP_UNCHECKEDREFVALUE { HelpId = HID_PROP_UNCHECKEDREFVALUE; } -hidspecial HID_PROP_UNIQUE { HelpId = HID_PROP_UNIQUE; } -hidspecial HID_PROP_VALUE { HelpId = HID_PROP_VALUE; } -hidspecial HID_PROP_VALUEMAX { HelpId = HID_PROP_VALUEMAX; } -hidspecial HID_PROP_VALUEMIN { HelpId = HID_PROP_VALUEMIN; } -hidspecial HID_PROP_VALUESTEP { HelpId = HID_PROP_VALUESTEP; } -hidspecial HID_PROP_VERTICAL_ALIGN { HelpId = HID_PROP_VERTICAL_ALIGN; } -hidspecial HID_PROP_VISIBLESIZE { HelpId = HID_PROP_VISIBLESIZE; } -hidspecial HID_PROP_VISUALEFFECT { HelpId = HID_PROP_VISUALEFFECT; } -hidspecial HID_PROP_VSCROLL { HelpId = HID_PROP_VSCROLL; } -hidspecial HID_PROP_WHEEL_BEHAVIOR { HelpId = HID_PROP_WHEEL_BEHAVIOR; } -hidspecial HID_PROP_WIDTH { HelpId = HID_PROP_WIDTH; } -hidspecial HID_PROP_WORDBREAK { HelpId = HID_PROP_WORDBREAK; } -hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; } -hidspecial HID_PROP_XML_DATA_MODEL { HelpId = HID_PROP_XML_DATA_MODEL; } -hidspecial HID_PROP_XSD_CALCULATION { HelpId = HID_PROP_XSD_CALCULATION; } -hidspecial HID_PROP_XSD_CONSTRAINT { HelpId = HID_PROP_XSD_CONSTRAINT; } -hidspecial HID_PROP_XSD_DATA_TYPE { HelpId = HID_PROP_XSD_DATA_TYPE; } -hidspecial HID_PROP_XSD_FRACTION_DIGITS { HelpId = HID_PROP_XSD_FRACTION_DIGITS; } -hidspecial HID_PROP_XSD_LENGTH { HelpId = HID_PROP_XSD_LENGTH; } -hidspecial HID_PROP_XSD_MAX_EXCLUSIVE { HelpId = HID_PROP_XSD_MAX_EXCLUSIVE; } -hidspecial HID_PROP_XSD_MAX_INCLUSIVE { HelpId = HID_PROP_XSD_MAX_INCLUSIVE; } -hidspecial HID_PROP_XSD_MAX_LENGTH { HelpId = HID_PROP_XSD_MAX_LENGTH; } -hidspecial HID_PROP_XSD_MIN_EXCLUSIVE { HelpId = HID_PROP_XSD_MIN_EXCLUSIVE; } -hidspecial HID_PROP_XSD_MIN_INCLUSIVE { HelpId = HID_PROP_XSD_MIN_INCLUSIVE; } -hidspecial HID_PROP_XSD_MIN_LENGTH { HelpId = HID_PROP_XSD_MIN_LENGTH; } -hidspecial HID_PROP_XSD_PATTERN { HelpId = HID_PROP_XSD_PATTERN; } -hidspecial HID_PROP_XSD_READONLY { HelpId = HID_PROP_XSD_READONLY; } -hidspecial HID_PROP_XSD_RELEVANT { HelpId = HID_PROP_XSD_RELEVANT; } -hidspecial HID_PROP_XSD_REQUIRED { HelpId = HID_PROP_XSD_REQUIRED; } -hidspecial HID_PROP_XSD_TOTAL_DIGITS { HelpId = HID_PROP_XSD_TOTAL_DIGITS; } -hidspecial HID_PROP_XSD_WHITESPACES { HelpId = HID_PROP_XSD_WHITESPACES; } - -hidspecial HID_SELECTION_TLB { HelpId = HID_SELECTION_TLB; } - -hidspecial UID_ABSPILOT_HELP { HelpId = UID_ABSPILOT_HELP; } -hidspecial UID_BIB_FRAME_WINDOW { HelpId = UID_BIB_FRAME_WINDOW;} - -hidspecial UID_BRWEVT_ACTIONPERFORMED { HelpId = UID_BRWEVT_ACTIONPERFORMED; } -hidspecial UID_BRWEVT_ADJUSTMENTVALUECHANGED { HelpId = UID_BRWEVT_ADJUSTMENTVALUECHANGED; } -hidspecial UID_BRWEVT_AFTERUPDATE { HelpId = UID_BRWEVT_AFTERUPDATE; } -hidspecial UID_BRWEVT_APPROVEACTIONPERFORMED { HelpId = UID_BRWEVT_APPROVEACTIONPERFORMED; } -hidspecial UID_BRWEVT_APPROVEPARAMETER { HelpId = UID_BRWEVT_APPROVEPARAMETER; } -hidspecial UID_BRWEVT_APPROVERESETTED { HelpId = UID_BRWEVT_APPROVERESETTED; } -hidspecial UID_BRWEVT_APPROVEROWCHANGE { HelpId = UID_BRWEVT_APPROVEROWCHANGE; } -hidspecial UID_BRWEVT_BEFOREUPDATE { HelpId = UID_BRWEVT_BEFOREUPDATE; } -hidspecial UID_BRWEVT_CHANGED { HelpId = UID_BRWEVT_CHANGED; } -hidspecial UID_BRWEVT_CONFIRMDELETE { HelpId = UID_BRWEVT_CONFIRMDELETE; } -hidspecial UID_BRWEVT_ERROROCCURRED { HelpId = UID_BRWEVT_ERROROCCURRED; } -hidspecial UID_BRWEVT_FOCUSGAINED { HelpId = UID_BRWEVT_FOCUSGAINED; } -hidspecial UID_BRWEVT_FOCUSLOST { HelpId = UID_BRWEVT_FOCUSLOST; } -hidspecial UID_BRWEVT_ITEMSTATECHANGED { HelpId = UID_BRWEVT_ITEMSTATECHANGED; } -hidspecial UID_BRWEVT_KEYTYPED { HelpId = UID_BRWEVT_KEYTYPED; } -hidspecial UID_BRWEVT_KEYUP { HelpId = UID_BRWEVT_KEYUP; } -hidspecial UID_BRWEVT_LOADED { HelpId = UID_BRWEVT_LOADED; } -hidspecial UID_BRWEVT_MOUSEDRAGGED { HelpId = UID_BRWEVT_MOUSEDRAGGED; } -hidspecial UID_BRWEVT_MOUSEENTERED { HelpId = UID_BRWEVT_MOUSEENTERED; } -hidspecial UID_BRWEVT_MOUSEEXITED { HelpId = UID_BRWEVT_MOUSEEXITED; } -hidspecial UID_BRWEVT_MOUSEMOVED { HelpId = UID_BRWEVT_MOUSEMOVED; } -hidspecial UID_BRWEVT_MOUSEPRESSED { HelpId = UID_BRWEVT_MOUSEPRESSED; } -hidspecial UID_BRWEVT_MOUSERELEASED { HelpId = UID_BRWEVT_MOUSERELEASED; } -hidspecial UID_BRWEVT_POSITIONED { HelpId = UID_BRWEVT_POSITIONED; } -hidspecial UID_BRWEVT_POSITIONING { HelpId = UID_BRWEVT_POSITIONING; } -hidspecial UID_BRWEVT_RELOADED { HelpId = UID_BRWEVT_RELOADED; } -hidspecial UID_BRWEVT_RELOADING { HelpId = UID_BRWEVT_RELOADING; } -hidspecial UID_BRWEVT_RESETTED { HelpId = UID_BRWEVT_RESETTED; } -hidspecial UID_BRWEVT_ROWCHANGE { HelpId = UID_BRWEVT_ROWCHANGE; } -hidspecial UID_BRWEVT_SUBMITTED { HelpId = UID_BRWEVT_SUBMITTED; } -hidspecial UID_BRWEVT_TEXTCHANGED { HelpId = UID_BRWEVT_TEXTCHANGED; } -hidspecial UID_BRWEVT_UNLOADED { HelpId = UID_BRWEVT_UNLOADED; } -hidspecial UID_BRWEVT_UNLOADING { HelpId = UID_BRWEVT_UNLOADING; } - -hidspecial UID_EVT_MACRODLG { HelpId = UID_EVT_MACRODLG; } - -hidspecial UID_FIELDLINK_DETAIL1 { HelpId = UID_FIELDLINK_DETAIL1; } -hidspecial UID_FIELDLINK_DETAIL2 { HelpId = UID_FIELDLINK_DETAIL2; } -hidspecial UID_FIELDLINK_DETAIL3 { HelpId = UID_FIELDLINK_DETAIL3; } -hidspecial UID_FIELDLINK_DETAIL4 { HelpId = UID_FIELDLINK_DETAIL4; } -hidspecial UID_FIELDLINK_MASTER1 { HelpId = UID_FIELDLINK_MASTER1; } -hidspecial UID_FIELDLINK_MASTER2 { HelpId = UID_FIELDLINK_MASTER2; } -hidspecial UID_FIELDLINK_MASTER3 { HelpId = UID_FIELDLINK_MASTER3; } -hidspecial UID_FIELDLINK_MASTER4 { HelpId = UID_FIELDLINK_MASTER4; } - -hidspecial UID_PROP_ADD_DATA_TYPE { HelpId = UID_PROP_ADD_DATA_TYPE; } -hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } -hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; } -hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } -hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; } -hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } -hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; } -hidspecial UID_PROP_DLG_BIND_EXPRESSION { HelpId = UID_PROP_DLG_BIND_EXPRESSION; } -hidspecial UID_PROP_DLG_BORDERCOLOR { HelpId = UID_PROP_DLG_BORDERCOLOR; } -hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } -hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; } -hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } -hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; } -hidspecial UID_PROP_DLG_FILTER { HelpId = UID_PROP_DLG_FILTER; } -hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } -hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; } -hidspecial UID_PROP_DLG_FORMLINKFIELDS { HelpId = UID_PROP_DLG_FORMLINKFIELDS; } -hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } -hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; } -hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } -hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; } -hidspecial UID_PROP_DLG_ORDER { HelpId = UID_PROP_DLG_ORDER; } -hidspecial UID_PROP_DLG_SELECTION { HelpId = UID_PROP_DLG_SELECTION; } -hidspecial UID_PROP_DLG_SQLCOMMAND { HelpId = UID_PROP_DLG_SQLCOMMAND; } -hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; } -hidspecial UID_PROP_DLG_TABINDEX { HelpId = UID_PROP_DLG_TABINDEX; } -hidspecial UID_PROP_DLG_XSD_CALCULATION { HelpId = UID_PROP_DLG_XSD_CALCULATION; } -hidspecial UID_PROP_DLG_XSD_CONSTRAINT { HelpId = UID_PROP_DLG_XSD_CONSTRAINT; } -hidspecial UID_PROP_DLG_XSD_READONLY { HelpId = UID_PROP_DLG_XSD_READONLY; } -hidspecial UID_PROP_DLG_XSD_RELEVANT { HelpId = UID_PROP_DLG_XSD_RELEVANT; } -hidspecial UID_PROP_DLG_XSD_REQUIRED { HelpId = UID_PROP_DLG_XSD_REQUIRED; } -hidspecial UID_PROP_REMOVE_DATA_TYPE { HelpId = UID_PROP_REMOVE_DATA_TYPE; } -hidspecial HID_FM_PROPDLG_TABCTR { HelpId = HID_FM_PROPDLG_TABCTR; } -hidspecial HID_FM_PROPDLG_TAB_GENERAL { HelpId = HID_FM_PROPDLG_TAB_GENERAL; } -hidspecial HID_FM_PROPDLG_TAB_DATA { HelpId = HID_FM_PROPDLG_TAB_DATA; } -hidspecial HID_FM_PROPDLG_TAB_EVT { HelpId = HID_FM_PROPDLG_TAB_EVT; } diff --git a/extensions/util/makefile.mk b/extensions/util/makefile.mk deleted file mode 100644 index af6b1ec8c..000000000 --- a/extensions/util/makefile.mk +++ /dev/null @@ -1,39 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. -PRJNAME=extensions -TARGET=ext -GEN_HID=TRUE -GEN_HID_OTHER=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk - -.INCLUDE : target.mk - diff --git a/extensions/util/makefile.pmk b/extensions/util/makefile.pmk deleted file mode 100644 index b80a9c7bd..000000000 --- a/extensions/util/makefile.pmk +++ /dev/null @@ -1,29 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -.INCLUDE : settings.mk - diff --git a/extensions/util/target.pmk b/extensions/util/target.pmk deleted file mode 100644 index c7c1de9c2..000000000 --- a/extensions/util/target.pmk +++ /dev/null @@ -1,35 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -ALLSLO: $(SLOFILES) - -SOSHL: $(SHL1TARGETN) - -WHOLEPRJ: - cd $(PRJ)$/prj - make debug linkinc prjpch compinc - @echo "READY" - diff --git a/extensions/workben/makefile.mk b/extensions/workben/makefile.mk deleted file mode 100644 index d62100ac2..000000000 --- a/extensions/workben/makefile.mk +++ /dev/null @@ -1,152 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=extensions -TARGET=workben -LIBTARGET=NO - -TESTAPP=testpgp - -.IF "$(TESTAPP)" == "testresource" || "$(TESTAPP)" == "testframecontrol" -TARGETTYPE=GUI -.ELSE -TARGETTYPE=CUI -.ENDIF - -JVM_TARGET=jvmtest - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET) -INCPRE+=$(UNOUCROUT) - -# --- Files -------------------------------------------------------- - -# -# testpgp. -# -.IF "$(TESTAPP)" == "testpgp" - -UNOTYPES= \ - com.sun.star.lang.XMultiServiceFactory \ - com.sun.star.io.XInputStream \ - com.sun.star.io.XOutputStream \ - com.sun.star.pgp.RecipientsEvent \ - com.sun.star.pgp.SignatureEvent \ - com.sun.star.pgp.XPGPDecoder \ - com.sun.star.pgp.XPGPDecoderListener \ - com.sun.star.pgp.XPGPEncoder \ - com.sun.star.pgp.XPGPPreferences \ - com.sun.star.uno.TypeClass \ - com.sun.star.uno.XInterface \ - com.sun.star.uno.XWeak - -OBJFILES= $(OBJ)$/testpgp.obj - -APP1TARGET= testpgp -APP1OBJS= $(OBJFILES) -APP1STDLIBS= \ - $(CPPUHELPERLIB)\ - $(CPPULIB) \ - $(SALLIB) - -.ENDIF # testpgp - -# -# std testcomponent -# -.IF "$(TESTAPP)" == "testcomponent" - -OBJFILES= $(OBJ)$/testcomponent.obj - -APP2TARGET = testcomponent -APP2OBJS = $(OBJ)$/testcomponent.obj -APP2STDLIBS = \ - $(TOOLSLIB) \ - $(SALLIB) - -.ENDIF # testcomponent - -# -# test python. -# -.IF "$(TESTAPP)" == "phytontest" -OBJFILES= $(OBJ)$/pythontest.obj -.ENDIF # phytontest - -# -# python auto test -# -.IF "$(TESTAPP)" == "phytonautotest" -OBJFILES= $(OBJ)$/pythonautotest.obj -.ENDIF # phytonautotest - -# -# testresource. -# -.IF "$(TESTAPP)" == "testresource" - -OBJFILES= $(OBJ)$/testresource.obj - -SRS2NAME = testresource -SRC2FILES= testresource.src -RESLIB2SRSFILES= $(SRS)$/testresource.srs -RESLIB2NAME= testresource - -APP2TARGET= testresource -APP2OBJS= $(OBJ)$/testresource.obj -APP2STDLIBS=$(TOOLSLIB) \ - $(VCLLIB) \ - $(SALLIB) - -.ENDIF # testresource - -# -# testframecontrol. -# -.IF "$(TESTAPP)" == "testframecontrol" - -OBJFILES= $(OBJ)$/testframecontrol.obj - -APP3TARGET= testframecontrol -APP3OBJS= $(OBJ)$/testframecontrol.obj -APP3STDLIBS=$(TOOLSLIB) \ - $(SVTOOLLIB) \ - $(VCLLIB) - -.ENDIF # testframecontrol - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/extensions/workben/pythonautotest.cxx b/extensions/workben/pythonautotest.cxx deleted file mode 100644 index 47acef94d..000000000 --- a/extensions/workben/pythonautotest.cxx +++ /dev/null @@ -1,625 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace usr; - -using ::rtl::StringToOUString; -using ::rtl::OUStringToString; - -#define PCHAR_TO_USTRING(x) StringToOUString(String(x),CHARSET_SYSTEM) -#define USTRING_TO_PCHAR(x) OUStringToString(x , CHARSET_DONTKNOW ).GetCharStr() - - - - - -/***** -* -* A Test root object ! -* -*****/ -class MyPythonRoot : - public XInvokation, - public OWeakObject -{ -public: - MyPythonRoot() { m_iTestValue = 15; } - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - -public: - XIntrospectionAccessRef getIntrospection(void) const THROWS( (UsrSystemException) ) - { return XIntrospectionAccessRef(); } - - UsrAny invoke( const UString& FunctionName, - const Sequence< UsrAny >& Params, - Sequence< INT16 >& OutParamIndex, - Sequence< UsrAny >& OutParam) - THROWS( ( IllegalArgumentException, - CannotConvertException, - InvocationTargetException, - UsrSystemException) ); - void setValue(const UString& PropertyName, const UsrAny& Value) - THROWS( ( UnknownPropertyException, - CannotConvertException, - InvocationTargetException, - UsrSystemException) ); - - UsrAny getValue(const UString& PropertyName) - THROWS( ( UnknownPropertyException, - UsrSystemException) ); - BOOL hasMethod(const UString& Name) const THROWS( (UsrSystemException) ); - BOOL hasProperty(const UString& Name) const THROWS( (UsrSystemException) ); - - - void getTestValueViaInout( int &inout ) - { inout = m_iTestValue; } - - INT32 getTestValue() const - { return m_iTestValue; } - - void setTestValue( INT32 i ) - { m_iTestValue = i; } - - void printTestValue() - { fprintf( stderr, "TestValue : %d\n" , getTestValue() ); } - - void addTestValue( INT32 i ) - { m_iTestValue += i; } - -private: - - INT32 m_iTestValue; -}; - -BOOL MyPythonRoot::queryInterface( Uik aUik, XInterfaceRef &rOut ) -{ - if( aUik == XInvokation::getSmartUik() ) { - rOut = ( XInvokation * ) this; - } - else { - return OWeakObject::queryInterface( aUik , rOut ); - } - return TRUE; - -} - -UsrAny MyPythonRoot::invoke( const UString& FunctionName, - const Sequence< UsrAny >& Params, - Sequence< INT16 >& OutParamIndex, - Sequence< UsrAny >& OutParam) - THROWS( ( IllegalArgumentException, - CannotConvertException, - InvocationTargetException, - UsrSystemException) ) -{ - if( L"printTestValue" == FunctionName ) { - printTestValue(); - } - else if( L"addTestValue" == FunctionName ) { - addTestValue( Params.getConstArray()[0].getINT32() ); - } - else if( L"getTestValueViaInout" == FunctionName ) { - int i = Params.getConstArray()[0].getINT32(); - getTestValueViaInout( i ); - OutParam.getArray()[0].setINT32( i ); - } - else { - THROW( InvocationTargetException() ); - } - - return UsrAny(); -} - -void MyPythonRoot::setValue(const UString& PropertyName, const UsrAny& Value) - THROWS( ( UnknownPropertyException, - CannotConvertException, - InvocationTargetException, - UsrSystemException) ) -{ - if( L"TestValue" == PropertyName ) { - setTestValue( Value.getINT32() ); - } - else { - THROW( UnknownPropertyException() ); - } -} - -UsrAny MyPythonRoot::getValue(const UString& PropertyName) - THROWS( ( UnknownPropertyException, - UsrSystemException) ) -{ - UsrAny aRet; - - if( L"TestValue" == PropertyName ) { - aRet.setINT32( getTestValue() ); - } - else { - THROW( UnknownPropertyException() ); - } - - return aRet; -} - - -BOOL MyPythonRoot::hasMethod(const UString& Name) const THROWS( (UsrSystemException) ) -{ - if( L"printTestValue" == Name ) { - return TRUE; - } - else if( L"addTestValue" == Name ) { - return TRUE; - } - else if( L"getTestValueViaInout" == Name ) { - return TRUE; - } - return FALSE; -} - - -BOOL MyPythonRoot::hasProperty(const UString& Name) const THROWS( (UsrSystemException) ) -{ - if( L"TestValue" == Name ) { - return TRUE; - } - - return FALSE; -} - - -/***** -* -* A test engine listener to check the debug interface -* -*****/ -class TestListener : - public XEngineListener, - public OWeakObject -{ -public: - - TestListener() - { - m_pDebuggingRef = 0; - } - - - TestListener( XDebuggingRef *p ) - { - attach( p ); - } - - ~TestListener() - { - if( m_pDebuggingRef ) { - detach(); - } - } - - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - - - void attach( XDebuggingRef *p ) - { - m_pDebuggingRef = p; - } - - void detach( ); - - - virtual void disposing( const EventObject &o ) - { - if( m_pDebuggingRef ) { - detach(); - } - } - virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) ) - { - } - - virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) ) - { - (*m_pDebuggingRef)->stop(); - - m_aDebugCondition.set(); - } - - virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) ) - { - m_aDebugCondition.set(); - } - - - void cmdLine(); -protected: - - osl::Condition m_aDebugCondition; - XDebuggingRef *m_pDebuggingRef; -}; - - - -void TestListener::cmdLine() -{ - // Condition is set by running listener - m_aDebugCondition.wait(); - m_aDebugCondition.reset(); - (*m_pDebuggingRef)->doContinue(); - m_aDebugCondition.wait(); -} - -void TestListener::detach() -{ - OSL_ASSERT( m_pDebuggingRef ); - - m_pDebuggingRef = 0; -} - -BOOL TestListener::queryInterface( Uik aUik, XInterfaceRef & rOut ) -{ - if( aUik == XEngineListener::getSmartUik() ) - rOut = (XEngineListener*)this; - else - return OWeakObject::queryInterface( aUik, rOut ); - return TRUE; -} - - -void checkInvokation( const XInvokationRef &xInvoke ) -{ - UsrAny anyList; - - // check exporting an object as an invokation - OSL_ASSERT( xInvoke->hasProperty( L"list" ) ); - anyList = xInvoke->getValue( L"list" ); - - OSL_ASSERT( anyList.getReflection() == XInvokation_getReflection() ); - XInvokationRef *pRef = ( XInvokationRef * ) anyList.get(); - OSL_ASSERT( (*pRef).is() ); - - OSL_ASSERT( (*pRef)->hasMethod( L"append" ) ); - OSL_ASSERT( (*pRef)->hasMethod( L"count" ) ); - - Sequence seq(1); - UsrAny any( (INT32) 1); - (seq.getArray())[0] = any; - - any = (*pRef)->invoke( L"count" , seq , Sequence(), Sequence() ); - int nOldSize = any.getINT32(); - - any = (*pRef)->invoke( L"append" , seq , Sequence(), Sequence() ); - any = (*pRef)->invoke( L"count" , seq , Sequence(), Sequence() ); - - OSL_ASSERT( nOldSize + 1 == any.getINT32() ); -} - -// just for testing ! -class PythonCodeLibrary : - public XLibraryAccess, - public OWeakObject -{ - - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - - - virtual BOOL isFunction(const UString& FunctionName) THROWS( (UsrSystemException) ) - { - return FALSE; - } - - virtual BOOL isValidPath(const UString& PathName) THROWS( (UsrSystemException) ) - { - return FALSE; - } - - virtual Sequence< UString > getModuleNames(void) THROWS( (UsrSystemException) ) - { - return Sequence (); - } - - virtual UString getModuleSource(const UString& ModulName) THROWS( (UsrSystemException) ) - { - if( ModulName == L"testmodul" ) { - return UString( L"def testmethod():\n" - L" return 42\n"); - } - return UString(); - } - - virtual Sequence< BYTE > getModuleCode(const UString& ModuleName) THROWS( (UsrSystemException) ) - { - return Sequence< BYTE > (); - } - - virtual UString getFunctionSource(const UString& FunctionName) THROWS( (UsrSystemException) ) - { - return UString(); - } - virtual Sequence< BYTE > getFunctionCode(const UString& FunctionName) THROWS( (UsrSystemException) ) - { - return Sequence< BYTE > (); - } -}; - -BOOL PythonCodeLibrary::queryInterface( Uik aUik, XInterfaceRef & rOut ) -{ - if( XLibraryAccess::getSmartUik() == aUik ) { - rOut = (XLibraryAccess* ) this; - } - else { - return OWeakObject::queryInterface( aUik , rOut ); - } - - return TRUE; -} - - - -/* - * main. - */ -int __LOADONCALLAPI main (int argc, char **argv) -{ - // necessary startup code - XMultiServiceFactoryRef xSMgr = createRegistryServiceManager(); - registerUsrServices( xSMgr ); - setProcessServiceManager( xSMgr ); - - XInterfaceRef x = xSMgr->createInstance( L"stardiv.uno.repos.ImplementationRegistration" ); - XImplementationRegistrationRef xReg( x, USR_QUERY ); - sal_Char szBuf[1024]; - - ORealDynamicLoader::computeModuleName( "pythonengine", szBuf, 1024 ); - UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) ); - xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() ); - - x = xSMgr->createInstance( L"stardiv.script.Python" ); - XEngineRef xEngine( x, USR_QUERY ); - XInvokationRef xInvoke( x, USR_QUERY ); - XDebuggingRef xDebug( x , USR_QUERY ); - - XInterfaceRef rRoot( (XInvokation * )new MyPythonRoot , USR_QUERY ); - xEngine->setRoot( rRoot ); - - - // execute a simple script - xEngine->run( L"nIntTest = 5\n" - L"list = [2,3,4]\n" , XInterfaceRef(), Sequence () ); - - /**** - * - * Xinvokation - Test - * - *****/ - // get/set an int ! - { - OSL_ASSERT( xInvoke->hasProperty( L"nIntTest" ) ); - UsrAny any = xInvoke->getValue( L"nIntTest" ); - - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); - OSL_ASSERT( any.getINT32() == 5 ); - - // simple test: set an int ! - xInvoke->setValue( L"nIntTest" , UsrAny( (INT32) 10 ) ); - any = xInvoke->getValue( L"nIntTest" ); - - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); - OSL_ASSERT( any.getINT32() == 10 ); - } - - // call a python method ! - { - xEngine->run( L"def foo():\n" - L" return 'this is foo'\n" , XInterfaceRef() , Sequence () ); - OSL_ASSERT( xInvoke->hasMethod( L"foo" ) ); - UsrAny any = xInvoke->invoke( L"foo" , - Sequence(), - Sequence() , - Sequence () ); - OSL_ASSERT( any.getString() == L"this is foo" ); - } - - - // check exception handling ! - { - try { - xInvoke->invoke( L"foo" , Sequence(1) , Sequence(), Sequence () ); - // wrong number of arguments - OSL_ASSERT( 0 ); - } - catch ( IllegalArgumentException& e ) { - } - catch ( InvocationTargetException& e ) { - } - catch ( CannotConvertException& e ) { - // empty any cannot be converted - } - } - - // check InOut-Parameter - checkInvokation( xInvoke ); - - /******* - * - * Check Introspection Access - * - *******/ - { - XIntrospectionAccessRef xIntrospection = xInvoke->getIntrospection(); - OSL_ASSERT( xIntrospection.is() ); - - // no further test, simply call them - xIntrospection->getMethods(0); - xIntrospection->getProperties(0); - - OSL_ASSERT( xIntrospection->getSuppliedMethodConcepts() == 0 ); - OSL_ASSERT( xIntrospection->getSuppliedPropertyConcepts() == 0 ); - - Property prop = xIntrospection->getProperty( L"nIntTest" ,0 ); - OSL_ASSERT( prop.Name == L"nIntTest" ); - OSL_ASSERT( prop.Type->getTypeClass() == TypeClass_LONG ); - - XIdlMethodRef method = xIntrospection->getMethod( L"foo" , 0 ); - OSL_ASSERT( method->getName() == L"foo" ); - } - - - /****** - * - * Multithreading test - * - *******/ - - /****** - * - * XDebuggingTest - * - ******/ - // stop/doContinue + runAsync listener - { - // test hangs, if something is wrong - - TestListener *pListener = new TestListener( &xDebug ); - XEngineListenerRef ref( (XEngineListener * ) pListener , USR_QUERY ); - - // single listener check ! - xEngine->runAsync( L"pass\n" - , XInterfaceRef() , Sequence () , ref ); - pListener->cmdLine(); - } - - // ListenerAdministration check ! - { - // test hangs, if something is wrong - - TestListener *pListener = new TestListener( &xDebug ); - XEngineListenerRef ref( (XEngineListener * ) pListener , USR_QUERY ); - - // engine listener check ! - xEngine->addEngineListener( ref ); - xEngine->runAsync( L"pass\n" - , XInterfaceRef() , Sequence () , XEngineListenerRef() ); - pListener->cmdLine(); - xEngine->removeEngineListener( ref); - - } - - // check the import mechanism - { - XLibraryAccessRef xLibrary( ( XLibraryAccess * ) new PythonCodeLibrary , USR_QUERY ); - xEngine->setLibraryAccess( xLibrary ); - - xEngine->run( L"import testmodul\n" - L"x = testmodul.testmethod()\n" , XInterfaceRef() , Sequence() ); - UsrAny any = xInvoke->getValue( L"x" ); - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); - OSL_ASSERT( any.getINT32() == 42 ); - } - - // check other imports - { - // Check, if the libraries are available at run time - xEngine->run( L"import math\n" - L"dMathTest = math.exp(0)\n" , XInterfaceRef() , Sequence () ); - - OSL_ASSERT( xInvoke->hasProperty( L"dMathTest" ) ); - UsrAny any = xInvoke->getValue( L"dMathTest" ); - - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_DOUBLE ); - OSL_ASSERT( any.getDouble() == 1. ); - } - - // Test connection to root object ! - { - xEngine->run( L"x = stardiv.root.TestValue\n" - L"y = stardiv.inout(5)\n" - L"stardiv.root.getTestValueViaInout(y)\n" - L"z = y.value\n" , XInterfaceRef() , Sequence () ); - - UsrAny any = xInvoke->getValue( L"x" ); - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); - OSL_ASSERT( any.getINT32() == 15 ); - - any = xInvoke->getValue( L"z" ); - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); - OSL_ASSERT( any.getINT32() == 15 ); - } - - // Test exactName interface - { - UsrAny any = xInvoke->getValue( L"__builtins__" ); - OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_INTERFACE ); - - XInvokationRef rInv( *((XInterfaceRef *) any.get() ), USR_QUERY ); - OSL_ASSERT( rInv.is() ); - - XExactNameRef rName( *((XInterfaceRef*) any.get() ), USR_QUERY ); - OSL_ASSERT( rName.is() ); - - UString str = rName->getExactName( L"SYNTAXERROR" ); - OSL_ASSERT( str.len() ); - } - - - // Test exactName interface of the engine itself - { - XExactNameRef rName( xInvoke , USR_QUERY ); - OSL_ASSERT( rName.is() ); - UString str = rName->getExactName( L"STARDIV" ); - OSL_ASSERT( str.len() ); - } - - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/pythontest.cxx b/extensions/workben/pythontest.cxx deleted file mode 100644 index d9410f7a6..000000000 --- a/extensions/workben/pythontest.cxx +++ /dev/null @@ -1,560 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace usr; - -using ::rtl::OUStringToString; -using ::rtl::StringToOUString; - - -#define PCHAR_TO_USTRING(x) StringToOUString(String(x),CHARSET_SYSTEM) - - - -class NullEngineListenerRef : public XEngineListenerRef -{ - virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) ) {} - virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) ) {} - virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) ) {} -}; - -#define USTRING_TO_PCHAR(x) OUStringToString(x , CHARSET_DONTKNOW ).GetCharStr() - -class CmdDebugger : - public XEngineListener, - public OWeakObject -{ -public: - - CmdDebugger() - { - m_pDebuggingRef = 0; - m_pEngineRef = 0; - m_bIsTerminating = FALSE; - m_bIsRunning = FALSE; - } - - - CmdDebugger( XDebuggingRef *p, XEngineRef *pEngine , XInvokationRef *pInvokation) - { - attach( p , pEngine , pInvokation ); - } - - ~CmdDebugger() - { - if( m_pDebuggingRef ) { - detach(); - } - } - - BOOL queryInterface( Uik aUik, XInterfaceRef & rOut ); - void acquire() { OWeakObject::acquire(); } - void release() { OWeakObject::release(); } - void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); } - - - void attach( XDebuggingRef *p , XEngineRef *pEngine , XInvokationRef *pInvokation ) - { - m_pDebuggingRef = p; - m_pEngineRef = pEngine; - m_pInvokationRef = pInvokation; - m_bIsRunning = FALSE; - m_bIsTerminating = FALSE; - } - - void detach( ); - - - virtual void disposing( const EventObject &o ) - { - if( m_pDebuggingRef ) { - detach(); - } - } - virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) ) - { - if( m_pDebuggingRef && ! m_bIsTerminating ) { - (*m_pDebuggingRef)->stop(); - fprintf( stderr, "%s\n" , USTRING_TO_PCHAR(Evt.ErrorMessage ) ); - fprintf( stderr, "%s.%s (%d)\n", USTRING_TO_PCHAR(Evt.SourceCode), - USTRING_TO_PCHAR(Evt.Name ), - Evt.StartLine ); - m_aDebugCondition.set(); - m_bIsRunning = TRUE; - } - } - - virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) ) - { - if( m_pDebuggingRef && ! m_bIsTerminating ) { - (*m_pDebuggingRef)->stop(); - - m_aDebugCondition.set(); - m_bIsRunning = TRUE; - fprintf( stderr, "%s\n" , "Script starts\n" ); - } - } - - virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) ) - { - if( m_pDebuggingRef && ! m_bIsTerminating ) { - m_aDebugCondition.set(); - m_bIsRunning = FALSE; - fprintf( stderr , "%s\n", USTRING_TO_PCHAR( Evt.ErrorMessage ) ); - } - } - - void dumpIntrospectionToStream( const XIntrospectionAccessRef &, FILE *f ); - void dumpVarToStream( const char *pcName, const UsrAny &any, FILE *f ); - - - void cmdLine(); -protected: - - osl::Condition m_aDebugCondition; - XDebuggingRef *m_pDebuggingRef; - XEngineRef *m_pEngineRef; - XInvokationRef *m_pInvokationRef; - int m_bIsRunning; - int m_bIsTerminating; // The listeners ignore everything when set -}; - - - -void CmdDebugger::cmdLine() -{ - char pcLine[80]; - fprintf( stderr, "entering debugger\n" ); - while( TRUE ) { - - m_aDebugCondition.wait(); - - fprintf( stderr , "(debug %d) : " , m_bIsRunning ); - fflush( stderr); - fgets( pcLine , 79 , stdin ); - - if( strlen( pcLine) ) pcLine[strlen(pcLine)-1] =0; - String sLine( pcLine ); - - if( ! strcmp( pcLine , "g" ) ) { - if( m_bIsRunning ) { - m_aDebugCondition.reset(); - (*m_pDebuggingRef)->doContinue(); - } - else fprintf( stderr,"no script running !\n" ); - } - else if( ! strcmp( pcLine , "s" ) ) { - if( m_bIsRunning ) { - m_aDebugCondition.reset(); - (*m_pDebuggingRef)->stepOver(); - } - else fprintf(stderr, "no script running !\n" ); - } - else if( ! strcmp( pcLine , "so" ) ) { - if( m_bIsRunning ) { - m_aDebugCondition.reset(); - (*m_pDebuggingRef)->stepOut(); - } - else fprintf(stderr, "no script running !\n" ); - } - else if( ! strcmp( pcLine , "si" ) ) { - if( m_bIsRunning ) { - m_aDebugCondition.reset(); - (*m_pDebuggingRef)->stepIn(); - } - else fprintf(stderr, "no script running !\n" ); - } - else if( ! strncmp( pcLine , "sbp" , 3 ) ){ - if( m_bIsRunning ) { - (*m_pDebuggingRef)->setBreakPoint( UString( L"" ), - atoi(&pcLine[3]) , TRUE ); - } - } - else if( ! strncmp( pcLine , "rbp" , 3 ) ){ - if( m_bIsRunning ) { - (*m_pDebuggingRef)->setBreakPoint( UString( L"" ), - atoi(&pcLine[3]) , FALSE ); - } - } - else if( ! strncmp( pcLine , "dv " , 3 ) ) { - if( m_bIsRunning ) { - int nCallstack = 0; - if( sLine.GetQuotedTokenCount( String("''"),' ' ) == 3 ) { - nCallstack = atoi( sLine.GetQuotedToken( 3 , String("''"), ' ' ).GetCharStr() ); - } - - UString str = (*m_pDebuggingRef)->dumpVariable( - PCHAR_TO_USTRING( &pcLine[3]),nCallstack); - fprintf( stderr, "%s\n" , USTRING_TO_PCHAR( str ) ); - } - } - else if( ! strncmp( pcLine , "sv " , 3 ) ) { - int nCallstack = 0; - if( sLine.GetQuotedTokenCount( String("''"),' ' ) == 3 ) { - nCallstack = atoi( sLine.GetQuotedToken( 3 , String("''"), ' ' ).GetCharStr() ); - } - (*m_pDebuggingRef)->setVariable( - StringToOUString( sLine.GetQuotedToken( 1 , String("''"), ' ' ), CHARSET_SYSTEM ), - StringToOUString( sLine.GetQuotedToken( 2 , String("''"), ' ' ), CHARSET_SYSTEM ), - nCallstack ); - - } - else if( ! strncmp( pcLine , "ci" ,2 ) ) { - if( m_bIsRunning ) { - UString *aUString ; - ContextInformation ci = (*m_pDebuggingRef)->getContextInformation(atoi(&pcLine[2])); - int i,iMax; - - fprintf( stderr, "File %s (%d)\n", USTRING_TO_PCHAR(ci.Name), - ci.StartLine ); - fprintf( stderr, "Available variables : \n" ); - aUString = ci.LocalVariableNames.getArray(); - iMax = ci.LocalVariableNames.getLen(); - - for( i = 0 ; i < iMax ; i++ ) { - fprintf( stderr, " %s\n" , USTRING_TO_PCHAR( aUString[i]) ); - } - } - } - else if ( !strcmp( pcLine , "d" ) ) { - if( m_bIsRunning ) { - UString * aUString ; - Sequence seq = (*m_pDebuggingRef)->getStackTrace(); - - aUString = seq.getArray(); - int iMax = seq.getLen(); - for( int i = 0; i < iMax ; i++ ) { - fprintf( stderr , "%s\n" , USTRING_TO_PCHAR( aUString[i] ) ); - } - } - } - else if( !strcmp( pcLine , "c" ) ) { - if( m_bIsRunning ) { - (*m_pEngineRef)->cancel(); - m_aDebugCondition.reset(); - } - else fprintf( stderr,"no script running !\n" ); - } - else if( !strcmp( pcLine , "q" ) ) { - if( m_bIsRunning ) { - m_aDebugCondition.reset(); - (*m_pEngineRef)->cancel(); - } - else { - m_bIsTerminating = TRUE; - fprintf(stderr, "Debugger terminates\n" ); - break; - } - } - else if( ! strcmp( pcLine , "id" ) ) { - - XIntrospectionAccessRef ref = (*m_pInvokationRef)->getIntrospection(); - - dumpIntrospectionToStream( ref , stderr ); - - - } - else if( ! strncmp( pcLine , "idv" , 3) ) { - try { - UsrAny any = (*m_pInvokationRef)->getValue( PCHAR_TO_USTRING( &(pcLine[4]) ) ); - dumpVarToStream( &(pcLine[4]) , any , stderr ); - } - catch(UnknownPropertyException& e ) { - fprintf( stderr, "UnknownPropertyException\n" ); - } - catch(IllegalArgumentException& e ) { - fprintf( stderr, "IllegalArgumentException\n" ); - } - } - else if( !strcmp( pcLine , "t" ) ) { - } - else if( !strcmp( pcLine , "h" ) ) { - fprintf( stderr , "\nvalid commands :\n" - "Go : g\n" - "StepOver : s\n" - "StepIn : si\n" - "StepOut : so\n" - "Set BreakPoint : sbp Line [ModuleName]\n" - "Remove BreakPoint : rbp [Line] [ModuleName]\n" - "via XDebugging Interface :\n" - " dump Variable : dv varname [CallStack]\n" - " set Variable : sv varname value [CallStack]\n" - "globals via XInvokation Interface :\n" - " dump Global vars : id\n" - " dump Variable : idv varname\n" - " set Variable : isv varname value\n" - "ContextInformation : ci\n" - "Dump callstack : d\n" - "Cancel : c (stops actual script)\n" - "Quit : q (exits debugger)\n" - ); - } - else if( ! strlen( pcLine ) ) { - } - else { - fprintf( stderr , "unknown command %s\n" , pcLine ); - } - } -} - -void CmdDebugger::dumpIntrospectionToStream( const XIntrospectionAccessRef &ref, FILE *f ) -{ - int i,iMax; - fprintf( stderr, "Callable Attributes (Methods) :\n" ); - Sequence seq = ref->getMethods( 0 ); - iMax = seq.getLen(); - XIdlMethodRef *aRef = seq.getArray(); - for( i = 0; i < iMax ; i++ ) { - fprintf( f, " %s\n" , USTRING_TO_PCHAR( aRef[i]->getName( ) ) ); - } - - fprintf( stderr, "Other attributes\n" ); - Sequence seqProp = ref->getProperties( 0 ); - iMax = seqProp.getLen(); - Property *aProp = seqProp.getArray(); - for( i = 0; i < iMax ; i ++ ) { - fprintf( f, " %s %s\n" , USTRING_TO_PCHAR( aProp[i].Type->getName() ), - USTRING_TO_PCHAR( aProp[i].Name ) ); - } - -} - -void CmdDebugger::dumpVarToStream( const char *pc , const UsrAny &aValue, FILE *f ) -{ - TypeClass type = aValue.getReflection()->getTypeClass(); - - if( TypeClass_INT == type ) { - fprintf( f, "INT32 %s : %d\n" , pc , aValue.getINT32() ); - } - else if( TypeClass_ENUM == type ) { - fprintf( f, "ENUM %s : %d\n", pc , aValue.getEnumAsINT32() ); - } - else if( TypeClass_STRING == type ) { - fprintf( f, "STRING %s : %s\n" , pc , USTRING_TO_PCHAR( aValue.getString()) ); - } - else if( TypeClass_BOOLEAN == type ) { - fprintf( f, "BOOL %s : %d\n", pc , aValue.getBOOL() ); - } - else if( TypeClass_CHAR == type ) { - fprintf( f, "char %s : %d\n", pc , ( INT32) aValue.getChar() ); - } - else if( TypeClass_SHORT == type ) { - fprintf( f, "INT16 %s : %d\n", pc , (INT32) aValue.getINT16()); - } - else if( TypeClass_LONG == type ) { - fprintf( f, "LONG %s : %d\n", pc , (INT32) aValue.getINT32()); - } - else if( TypeClass_UNSIGNED_SHORT == type ) { - fprintf( f, "UINT16 %s : %d\n", pc , (INT32) aValue.getUINT16() ); - } - else if( TypeClass_UNSIGNED_BYTE == type ) { - fprintf( f, "Byte %s : %d\n", pc , (INT32) aValue.getBYTE() ); - } - else if( TypeClass_UNSIGNED_INT == type ) { - fprintf( f, "UINT32 %s : %d\n", pc , aValue.getUINT32() ); - } - else if( TypeClass_FLOAT == type ) { - fprintf( f, "float %s : %f\n" , pc , aValue.getFloat() ); - } - else if( TypeClass_DOUBLE == type ) { - fprintf( f, "double %s : %f\n" , pc , aValue.getDouble() ); - } - else if( TypeClass_VOID == type ) { - fprintf( f, "void %s :\n" , pc ); - } - else if( TypeClass_INTERFACE == type ) { - // Check, what has been put in - if( aValue.getReflection() == XPropertySet_getReflection() ) { - // XPropertySet ! - XPropertySetRef *pRef = ( XPropertySetRef * ) aValue.get(); - XPropertySetInfoRef refInfo = (*pRef)->getPropertySetInfo(); - Sequence< Property > seq = refInfo->getProperties(); - int i,iMax = seq.getLen(); - - Property *pArray; - pArray = seq.getArray(); - fprintf( stderr, "Property List :\n" ); - for( i = 0; i < iMax ; i ++ ) { - fprintf( f, "%s\t %s\n" , USTRING_TO_PCHAR(pArray[i].Type->getName()), - USTRING_TO_PCHAR( pArray[i].Name ) ); - } - } - else if( aValue.getReflection() == XInvokation_getReflection() ) { - XInvokationRef *pRef = ( XInvokationRef * ) aValue.get(); - XIntrospectionAccessRef refIntro = (*pRef)->getIntrospection(); - - dumpIntrospectionToStream( refIntro, stderr ); - } - } - else if( TypeClass_SEQUENCE == type ) { - fprintf( f , "%s Sequence \n" , pc ); - String s( " " ); - s += pc; - SequenceReflection *pSeqRefl = ( SequenceReflection * ) aValue.getReflection(); - - int i,iMax = pSeqRefl->getLen( aValue ); - - for( i = 0 ; i < iMax ; i ++ ) { - dumpVarToStream( s.GetCharStr() , pSeqRefl->get( aValue , i ) , stderr ); - } - } - else { - fprintf( f, "%s : unknown %d\n" , pc , type ); - } - -} - -void CmdDebugger::detach() -{ - OSL_ASSERT( m_pDebuggingRef ); - - m_bIsRunning = FALSE; - m_pDebuggingRef = 0; - m_pEngineRef = 0; - m_pInvokationRef = 0; -} - -// Methoden von XInterface -BOOL CmdDebugger::queryInterface( Uik aUik, XInterfaceRef & rOut ) -{ - if( aUik == XEngineListener::getSmartUik() ) - rOut = (XEngineListener*)this; - else - return OWeakObject::queryInterface( aUik, rOut ); - return TRUE; -} - - - - - - -/* - * main. - */ -int __LOADONCALLAPI main (int argc, char **argv) -{ - XMultiServiceFactoryRef xSMgr = createRegistryServiceManager(); - registerUsrServices( xSMgr ); - setProcessServiceManager( xSMgr ); - - XInterfaceRef x = xSMgr->createInstance( L"stardiv.uno.repos.ImplementationRegistration" ); - XImplementationRegistrationRef xReg( x, USR_QUERY ); - sal_Char szBuf[1024]; - - ORealDynamicLoader::computeModuleName( "pythonengine", szBuf, 1024 ); - UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) ); - xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() ); - - ORealDynamicLoader::computeModuleName( "aps", szBuf, 1024 ); - aDllName = UString( StringToOUString( szBuf, CHARSET_SYSTEM ) ); - xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() ); - - XInterfaceRef y = xSMgr->createInstance( L"stardiv.script.Python" ); - XEngineRef yEngine( y, USR_QUERY ); - - x = xSMgr->createInstance( L"stardiv.script.Python" ); - XEngineRef xEngine( x, USR_QUERY ); - - - UString Script; - - Sequence args(3); - UsrAny *pArray = args.getArray(); - pArray[0].setString( L"Arg_0" ); - pArray[1].setString( L"Arg_1" ); - pArray[2].setString( L"Arg_2" ); - - if( argc > 2) { - Script = StringToOUString( String( argv[2] ) , CHARSET_DONTKNOW ); - } - - XInvokationRef xInvokation( x , USR_QUERY ); - XDebuggingRef xDebug( x , USR_QUERY ); - - CmdDebugger *pDbg = new CmdDebugger( &xDebug , &xEngine , &xInvokation ); - - XEngineListenerRef xDebugRef( (XEngineListener *) pDbg , USR_QUERY); - xEngine->addEngineListener( xDebugRef ); - - - if( argc >1 && ! strcmp( argv[1] , "1" ) ) { - fprintf( stderr, "one thread only\n" ); - Script = UString( L"print 'Hello World'\n" ); - xEngine->runAsync( Script , XInterfaceRef(), args , XEngineListenerRef() ); - } - else if( argc >1 && ! strcmp( argv[1] , "2" ) ) { - - xEngine->runAsync( UString( L"x=1\nprint 1\n") , XInterfaceRef(), args , XEngineListenerRef() ); - xEngine->runAsync( UString( L"x=x+1\nprint 2\n") , XInterfaceRef(), args , XEngineListenerRef() ); - xEngine->runAsync( UString( L"x=x+1\nprint 3\n") , XInterfaceRef(), args , XEngineListenerRef()); - xEngine->runAsync( UString( L"x=x+1\nprint 4\n") , XInterfaceRef(), args , XEngineListenerRef() ); - - - - } - else if( argc >1 && ! strcmp( argv[1] , "3" ) ) { - - fprintf( stderr , "1st thread in engine y, next 5 threads in engine x\n" ); - yEngine->runAsync( UString( L"print 1\n") , XInterfaceRef(), args , XEngineListenerRef() ); - xEngine->runAsync( UString( L"print 2\n") , XInterfaceRef(), args , XEngineListenerRef() ); - xEngine->runAsync( UString( L"print 3\n") , XInterfaceRef(), args , XEngineListenerRef() ); - xEngine->runAsync( UString( L"print 4\n") , XInterfaceRef(), args , XEngineListenerRef()); - xEngine->runAsync( UString( L"print 5\n") , XInterfaceRef(), args , XEngineListenerRef()); - xEngine->runAsync( UString( L"print 6\n") , XInterfaceRef(), args , XEngineListenerRef()); - - - } - pDbg->cmdLine(); - - xEngine->removeEngineListener( xDebugRef ); - - xReg->revokeImplementation( aDllName, XSimpleRegistryRef() ); - - fprintf( stderr, "main terminates\n" ); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/testcomponent.cxx b/extensions/workben/testcomponent.cxx deleted file mode 100644 index 1065c6ffb..000000000 --- a/extensions/workben/testcomponent.cxx +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -//------------------------------------------------------ -// testcomponent - Loads a service and its testcomponent from dlls performs a test. -// Expands the dll-names depending on the actual environment. -// Example : testcomponent stardiv.uno.io.Pipe stm -// -// Therefor the testcode must exist in teststm and the testservice must be named test.stardiv.uno.io.Pipe -// - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -using namespace usr; - -using ::rtl::OString; -using ::rtl::OWStringToOString; -using ::rtl::OStringToOWString; - - -// Needed to switch on solaris threads -#ifdef SOLARIS -extern "C" void ChangeGlobalInit(); -#endif - -int __LOADONCALLAPI main (int argc, char **argv) -{ - - if( argc < 3) { - printf( "usage : testcomponent service dll [additional dlls]\n" ); - exit( 0 ); - } -#ifdef SOLARIS - // switch on threads in solaris - ChangeGlobalInit(); -#endif - - // create service manager -// XMultiServiceFactoryRef xSMgr = getProcessServiceManager(); - XMultiServiceFactoryRef xSMgr = createRegistryServiceManager(); - OSL_ASSERT( xSMgr.is() ); - registerUsrServices( xSMgr ); - setProcessServiceManager( xSMgr ); - - XImplementationRegistrationRef xReg; - XSimpleRegistryRef xSimpleReg; - - try { - // Create registration service - XInterfaceRef x = xSMgr->createInstance( - UString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.ImplementationRegistration" )) ); - x->queryInterface( XImplementationRegistration::getSmartUik() , xReg ); - - } - catch( Exception& e ) { - printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() ); - exit(1); - } - - sal_Char szBuf[1024]; - OString sTestName; - - try { - // Load dll for the tested component - for( int n = 2 ; n registerImplementation( - UString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.loader.SharedLibrary" )), - aDllName, - xSimpleReg ); - } - } - catch( Exception& e ) { - printf( "Couldn't reach dll %s\n" , szBuf ); - printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() ); - - exit(1); - } - - - try { - // Load dll for the test component - sTestName = "test"; - sTestName += argv[2]; - - ORealDynamicLoader::computeModuleName( sTestName.getStr() , szBuf, 1024 ); - UString aDllName = OStringToOWString( szBuf, CHARSET_SYSTEM ); - xReg->registerImplementation( - UString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.loader.SharedLibrary" )) , - aDllName, - xSimpleReg ); - } - catch( Exception& e ) { - printf( "Couldn't reach dll %s\n" , szBuf ); - printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() ); - exit(1); - } - - - // Instantiate test service - sTestName = "test."; - sTestName += argv[1]; - - XInterfaceRef xIntTest = xSMgr->createInstance( OStringToOWString( sTestName , CHARSET_SYSTEM ) ); - XSimpleTestRef xTest( xIntTest , USR_QUERY ); - - if( ! xTest.is() ) { - printf( "Couldn't instantiate test service \n" ); - exit( 1 ); - } - - - INT32 nHandle = 0; - INT32 nNewHandle; - INT32 nErrorCount = 0; - INT32 nWarningCount = 0; - - // loop until all test are performed - while( nHandle != -1 ) { - - // Instantiate serivce - XInterfaceRef x = xSMgr->createInstance( OStringToOWString( argv[1] , CHARSET_SYSTEM ) ); - if( ! x.is() ) { - printf( "Couldn't instantiate service !\n" ); - exit( 1 ); - } - - // do the test - try { - nNewHandle = xTest->test( OStringToOWString( argv[1] , CHARSET_SYSTEM ) , x , nHandle ); - } - catch ( Exception& e ) { - printf( "testcomponent : uncaught exception %s\n" , - OWStringToOString( e.getName(), CHARSET_SYSTEM ).getStr() ); - exit(1); - } - catch(...) { - printf( "testcomponent : uncaught unknown exception\n" ); - exit(1); - } - - - // print errors and warning - Sequence seqErrors = xTest->getErrors(); - Sequence seqWarnings = xTest->getWarnings(); - if( seqWarnings.getLen() > nWarningCount ) { - printf( "Warnings during test %d!\n" , nHandle ); - for( ; nWarningCount < seqWarnings.getLen() ; nWarningCount ++ ) { - printf( "Warning\n%s\n---------\n" , - OWStringToOString( seqWarnings.getArray()[nWarningCount], CHARSET_SYSTEM ).getStr() ); - } - } - - - if( seqErrors.getLen() > nErrorCount ) { - printf( "Errors during test %d!\n" , nHandle ); - for( ; nErrorCount < seqErrors.getLen() ; nErrorCount ++ ) { - printf( "%s\n" , - OWStringToOString( - seqErrors.getArray()[nErrorCount], CHARSET_SYSTEM ).getStr() ); - } - } - - nHandle = nNewHandle; - } - - if( xTest->testPassed() ) { - printf( "Test passed !\n" ); - } - else { - printf( "Test failed !\n" ); - } - - XComponentRef rComp( xSMgr , USR_QUERY ); - rComp->dispose(); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/testframecontrol.cxx b/extensions/workben/testframecontrol.cxx deleted file mode 100644 index ba5d53de1..000000000 --- a/extensions/workben/testframecontrol.cxx +++ /dev/null @@ -1,319 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -using namespace usr; - -//================================================================================================== -class Listener_Impl - : public UsrObject - , public XMouseListener - , public XMouseMotionListener - , public XKeyListener - , public XWindowListener - , public XFocusListener - , public XPaintListener -{ -public: - SMART_UNO_DECLARATION( Listener_Impl, UsrObject ); - - virtual BOOL queryInterface( Uik aUik, XInterfaceRef& rOut ); - - // XMouseListener - virtual void mousePressed( const VclMouseEvent& evt ); - virtual void mouseReleased( const VclMouseEvent& evt ); - virtual void mouseEntered( const VclMouseEvent& evt ); - virtual void mouseExited( const VclMouseEvent& evt ); - - // XMouseMotionListener - virtual void mouseDragged( const VclMouseEvent& evt ); - virtual void mouseMoved( const VclMouseEvent& evt ); - - // XKeyListener - virtual void keyPressed( const VclKeyEvent& evt ); - virtual void keyReleased( const VclKeyEvent& evt ); - - // XFocusListener - virtual void focusGained( const FocusEvent& evt ); - virtual void focusLost( const FocusEvent& evt ); - - // XWindowListener - virtual void windowResized( const WindowEvent& evt ); - virtual void windowMoved( const WindowEvent& evt ); - virtual void windowShown( const EventObject& evt ); - virtual void windowHidden( const EventObject& evt ); - - // XPaintListener - virtual void windowPaint( const PaintEvent& evt ); - - // XEventListener - virtual void disposing( const EventObject& evt ); - -public: - void addAllListeners( const XControlRef& xControl ); - void removeAllListeners( const XControlRef& xControl ); -}; - -//-------------------------------------------------------------------------------------------------- -void Listener_Impl::addAllListeners( const XControlRef& xControl ) -{ - XWindowRef xWindow( xControl, USR_QUERY ); - - xWindow->addMouseListener( (XMouseListener*)this ); - xWindow->addMouseMotionListener( (XMouseMotionListener*)this ); - xWindow->addKeyListener( (XKeyListener*)this ); - xWindow->addFocusListener( (XFocusListener*)this ); - xWindow->addWindowListener( (XWindowListener*)this ); - xWindow->addPaintListener( (XPaintListener*)this ); - // cast due to ambiguities - xControl->addEventListener( (XEventListener*)(XPaintListener*)this ); -} - -//-------------------------------------------------------------------------------------------------- -void Listener_Impl::removeAllListeners( const XControlRef& xControl ) -{ - XWindowRef xWindow( xControl, USR_QUERY ); - - xWindow->removeMouseListener( (XMouseListener*)this ); - xWindow->removeMouseMotionListener( (XMouseMotionListener*)this ); - xWindow->removeKeyListener( (XKeyListener*)this ); - xWindow->removeFocusListener( (XFocusListener*)this ); - xWindow->removeWindowListener( (XWindowListener*)this ); - xWindow->removePaintListener( (XPaintListener*)this ); - // cast due to ambiguities - xControl->removeEventListener( (XEventListener*)(XPaintListener*)this ); -} - -//-------------------------------------------------------------------------------------------------- -SMART_UNO_IMPLEMENTATION( Listener_Impl, UsrObject ); - -//-------------------------------------------------------------------------------------------------- -BOOL Listener_Impl::queryInterface( Uik aUik, XInterfaceRef& rOut ) -{ - if (aUik == XMouseListener::getSmartUik()) - rOut = (XMouseListener*)this; - else if (aUik == XMouseMotionListener::getSmartUik()) - rOut = (XMouseMotionListener*)this; - else if (aUik == XWindowListener::getSmartUik()) - rOut = (XWindowListener*)this; - else if (aUik == XFocusListener::getSmartUik()) - rOut = (XFocusListener*)this; - else if (aUik == XKeyListener::getSmartUik()) - rOut = (XKeyListener*)this; - else if (aUik == XPaintListener::getSmartUik()) - rOut = (XPaintListener*)this; - else if (aUik == ((XEventListener*)NULL)->getSmartUik()) - rOut = (XEventListener*)(XMouseListener*)this; - else - return UsrObject::queryInterface( aUik, rOut ); - - return TRUE; -} - -//-------------------------------------------------------------------------------------------------- -// XMouseListener -void Listener_Impl::mousePressed( const VclMouseEvent& evt ) {} -void Listener_Impl::mouseReleased( const VclMouseEvent& evt ) {} -void Listener_Impl::mouseEntered( const VclMouseEvent& evt ) {} -void Listener_Impl::mouseExited( const VclMouseEvent& evt ) {} - -// XMouseMotionListener -void Listener_Impl::mouseDragged( const VclMouseEvent& evt ) {} -void Listener_Impl::mouseMoved( const VclMouseEvent& evt ) {} - -// XKeyListener -void Listener_Impl::keyPressed( const VclKeyEvent& evt ) {} -void Listener_Impl::keyReleased( const VclKeyEvent& evt ) {} - -// XFocusListener -void Listener_Impl::focusGained( const FocusEvent& evt ) {} -void Listener_Impl::focusLost( const FocusEvent& evt ) {} - -// XWindowListener -void Listener_Impl::windowResized( const WindowEvent& evt ) {} -void Listener_Impl::windowMoved( const WindowEvent& evt ) {} -void Listener_Impl::windowShown( const EventObject& evt ) {} -void Listener_Impl::windowHidden( const EventObject& evt ) {} - -// XPaintListener -void Listener_Impl::windowPaint( const PaintEvent& evt ) -{ - if (evt.Source.is()) - { - XControlRef xControl( evt.Source, USR_QUERY ); - if (xControl.is()) - { - XDeviceRef xDev( xControl->getPeer(), USR_QUERY ); - XGraphicsRef xGraphics = xDev->createGraphics(); - xGraphics->drawLine( 0, 0, 200, 200 ); - xGraphics->drawLine( 200, 0, 0, 200 ); - } - } -} - -// XEventListener -void Listener_Impl::disposing( const EventObject& evt ) {} - - -//================================================================================================== -class FrameControlApplication - : public Application -{ -public: - virtual void Main(); - virtual void ShowStatusText( const XubString& rText ); - -public: - FrameControlApplication() {} - -private: - void init(); - void deinit(); - -private: - Listener_Impl* _pListener; - XControlRef _xControl; - - WorkWindow* _pWorkWin; -}; - -FrameControlApplication g_App; - -#ifdef __MWERKS__ -Application* pApp = &g_App; -#endif - - -//-------------------------------------------------------------------------------------------------- -void FrameControlApplication::init() -{ - XMultiServiceFactoryRef xMgr = createRegistryServiceManager( L"test.rdb" ); - registerUsrServices( xMgr ); - setProcessServiceManager( xMgr ); - InitExtVclToolkit(); - Application::RegisterUnoServices(); - - XServiceRegistryRef xRegMgr(xMgr, USR_QUERY); - - XImplementationRegistrationRef xIR( xMgr->createInstance(L"stardiv.uno.repos.ImplementationRegistration"), USR_QUERY ); - try - { - char szDllName[_MAX_PATH]=""; - - ORealDynamicLoader::computeModuleName("fc", szDllName, _MAX_PATH); - UString aFCDllName = StringToOUString(szDllName, CHARSET_SYSTEM); - xIR->registerImplementation(L"stardiv.loader.SharedLibrary", aFCDllName, XSimpleRegistryRef() ); - } - catch( CannotRegisterImplementationException& e ) - { - } - - - - // ... - - XInterfaceRef xInst = xMgr->createInstance( L"stardiv.one.frame.FrameControl" ); - if (xInst->queryInterface( XControl::getSmartUik(), _xControl )) - { - _pWorkWin = new WorkWindow( NULL, WB_APP | WB_STDWORK ); - _pWorkWin->Show(); - XWindowPeerRef xParent( _pWorkWin->GetComponentInterface() ); - - XToolkitRef xToolkit( xMgr->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY ); - //xToolkit = XToolkitRef( xMgr->createInstance( L"stardiv.uno.awt.Toolkit" ), USR_QUERY ); - _xControl->createPeer( xToolkit, xParent ); - XWindowRef xWin( _xControl, USR_QUERY ); - xWin->setPosSize( 50, 50, 400, 400, PosSize_POSSIZE ); - xWin->setVisible( TRUE ); - - _pListener = new Listener_Impl(); - _pListener->acquire(); - _pListener->addAllListeners( _xControl ); - // ... on paint a cross should be drawn - } -} - -//-------------------------------------------------------------------------------------------------- -void FrameControlApplication::deinit() -{ - if (_pListener) - { - - _pListener->removeAllListeners( _xControl ); - _xControl->dispose(); // disposing event should occur - _pListener->release(); - _pListener = NULL; - - _xControl = XControlRef(); - } - - _pWorkWin->Hide(); - delete _pWorkWin; -} - - -//-------------------------------------------------------------------------------------------------- -void FrameControlApplication::Main() -{ -// void TestErrcodes(); -// TestErrcodes(); - - EnterMultiThread(); - SetAppName( "RadioActiveControl-Demo" ); - EnableSVLook(); - - init(); - - Execute(); - - deinit(); -} - -//-------------------------------------------------------------------------------------------------- -void FrameControlApplication::ShowStatusText( const XubString& rStatus ) -{ - Application::GetAppWindow()->SetText( rStatus ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/testpgp.cxx b/extensions/workben/testpgp.cxx deleted file mode 100644 index 482a832e1..000000000 --- a/extensions/workben/testpgp.cxx +++ /dev/null @@ -1,753 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" -#include -#include -#ifndef _RTL_WSTRING_ -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -using namespace com::sun::star::lang; -using namespace com::sun::star::io; -using namespace com::sun::star::pgp; -using namespace com::sun::star::uno; - -/*======================================================================== - * - * DataSource_Impl interface. - * - *======================================================================*/ -class DataSource_Impl : - public OWeakObject, - public XInputStream -{ - Sequence m_buffer; - sal_Int32 m_position; - int m_fd; - -public: - DataSource_Impl (int fd = 0); - virtual ~DataSource_Impl (void); - - void setBuffer (const Sequence &rBuffer); - - /** XInterface. - */ - virtual sal_Bool SAL_CALL queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException); - - virtual void SAL_CALL acquire (void) throw(RuntimeException); - - virtual void SAL_CALL release (void) throw(RuntimeException); - - /** XInputStream. - */ - virtual sal_Int32 SAL_CALL readBytes ( - Sequence &rData, sal_Int32 nBytesToRead) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); - - virtual sal_Int32 SAL_CALL readSomeBytes ( - Sequence &rData, sal_Int32 nMaxBytesToRead) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); - - virtual void SAL_CALL skipBytes (sal_Int32 nBytesToSkip) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); - - virtual sal_Int32 SAL_CALL available (void) - throw (NotConnectedException, IOException); - - virtual void SAL_CALL closeInput (void) - throw (NotConnectedException, IOException); -}; - -/*======================================================================== - * - * DataSink_Impl interface. - * - *======================================================================*/ -class DataSink_Impl : - public OWeakObject, - public XOutputStream -{ - Sequence m_buffer; - -public: - DataSink_Impl (void); - virtual ~DataSink_Impl (void); - - const Sequence& getBuffer (void) const { return m_buffer; } - - /** XInterface. - */ - virtual sal_Bool SAL_CALL queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException); - - virtual void SAL_CALL acquire (void) throw(RuntimeException); - virtual void SAL_CALL release (void) throw(RuntimeException); - - /** XOutputStream. - */ - virtual void SAL_CALL writeBytes ( - const Sequence &rBuffer) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); - - virtual void SAL_CALL flush (void) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); - - virtual void SAL_CALL closeOutput (void) - throw (NotConnectedException, - BufferSizeExceededException, - IOException); -}; - -/*======================================================================== - * - * DecoderListener_Impl interface. - * - *======================================================================*/ -class DecoderListener_Impl : - public OWeakObject, - public XPGPDecoderListener -{ -public: - DecoderListener_Impl (void); - virtual ~DecoderListener_Impl (void); - - /** XInterface. - */ - virtual sal_Bool SAL_CALL queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException); - - virtual void SAL_CALL acquire (void) throw(RuntimeException); - - virtual void SAL_CALL release (void) throw(RuntimeException); - - /** XEventListener. - */ - virtual void SAL_CALL disposing (const EventObject &rSource); - - /** XPGPDecoderListener. - */ - virtual void SAL_CALL decrypted (const RecipientsEvent &rEvent); - virtual void SAL_CALL verified (const SignatureEvent &rEvent); -}; - -/*======================================================================== - * - * DataSource_Impl implementation. - * - *======================================================================*/ -/* - * DataSource_Impl. - */ -DataSource_Impl::DataSource_Impl (int fd) - : m_fd (fd), m_position (0) -{ -} - -/* - * ~DataSource_Impl. - */ -DataSource_Impl::~DataSource_Impl (void) -{ -} - -/* - * DataSource_Impl: setBuffer. - */ -void DataSource_Impl::setBuffer (const Sequence &rBuffer) -{ - m_buffer = rBuffer; - if (!m_buffer.getLength()) - { - // Fill buffer from file descriptor. - char buffer[1024]; - rtl_zeroMemory (buffer, sizeof(buffer)); - - int k = read (m_fd, buffer, sizeof(buffer)); - while (k > 0) - { - sal_Int32 n = m_buffer.getLength(); - m_buffer.realloc (n + k); - - rtl_copyMemory (m_buffer.getArray() + n, buffer, k); - n += k; - - rtl_zeroMemory (buffer, k); - k = read (m_fd, buffer, sizeof(buffer)); - } - } - m_position = 0; -} - -/* - * XInterface: queryInterface. - */ -sal_Bool SAL_CALL DataSource_Impl::queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException) -{ - if (com::sun::star::uno::queryInterface ( - rUik, rIfc, - SAL_STATIC_CAST (XInputStream*, this))) - return sal_True; - else - return OWeakObject::queryInterface (rUik, rIfc); -} - -/* - * XInterface: acquire. - */ -void SAL_CALL DataSource_Impl::acquire (void) throw(RuntimeException) -{ - OWeakObject::acquire(); -} - -/* - * XInterface: release. - */ -void SAL_CALL DataSource_Impl::release (void) throw(RuntimeException) -{ - OWeakObject::release(); -} - -/* - * XInputStream: readBytes. - */ -sal_Int32 SAL_CALL DataSource_Impl::readBytes ( - Sequence &rData, sal_Int32 nBytesToRead) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - if (nBytesToRead < 0) - throw IOException(); - - sal_Int32 k = m_buffer.getLength() - m_position; - k = SAL_BOUND(k, 0, nBytesToRead); - if (k > 0) - { - rData.realloc(k); - rtl_copyMemory ( - rData.getArray(), m_buffer.getConstArray() + m_position, k); - m_position += k; - } - return k; -} - -/* - * XInputStream: readSomeBytes. - */ -sal_Int32 SAL_CALL DataSource_Impl::readSomeBytes ( - Sequence &rData, sal_Int32 nMaxBytesToRead) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - return readBytes (rData, nMaxBytesToRead); -} - -/* - * XInputStream: skipBytes. - */ -void SAL_CALL DataSource_Impl::skipBytes (sal_Int32 nBytesToSkip) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - if (nBytesToSkip < 0) - throw IOException(); - - m_position += nBytesToSkip; -} - -/* - * XInputStream: available. - */ -sal_Int32 SAL_CALL DataSource_Impl::available (void) - throw (NotConnectedException, IOException) -{ - sal_Int32 k = m_buffer.getLength() - m_position; - return ((k > 0) ? k : 0); -} - -/* - * XInputStream: closeInput. - */ -void SAL_CALL DataSource_Impl::closeInput (void) - throw (NotConnectedException, IOException) -{ -} - -/*======================================================================== - * - * DataSink_Impl implementation. - * - *======================================================================*/ -/* - * DataSink_Impl. - */ -DataSink_Impl::DataSink_Impl (void) -{ -} - -/* - * ~DataSink_Impl. - */ -DataSink_Impl::~DataSink_Impl (void) -{ -} - -/* - * XInterface: queryInterface. - */ -sal_Bool SAL_CALL DataSink_Impl::queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException) -{ - if (com::sun::star::uno::queryInterface ( - rUik, rIfc, - SAL_STATIC_CAST (XOutputStream*, this))) - return sal_True; - else - return OWeakObject::queryInterface (rUik, rIfc); -} - -/* - * XInterface: acquire. - */ -void SAL_CALL DataSink_Impl::acquire (void) throw(RuntimeException) -{ - OWeakObject::acquire(); -} - -/* - * XInterface: release. - */ -void SAL_CALL DataSink_Impl::release (void) throw(RuntimeException) -{ - OWeakObject::release(); -} - -/* - * XOutputStream: writeBytes. - */ -void SAL_CALL DataSink_Impl::writeBytes (const Sequence &rBuffer) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - if (rBuffer.getLength()) - { - sal_Int32 n = m_buffer.getLength(); - m_buffer.realloc (n + rBuffer.getLength()); - - rtl_copyMemory ( - m_buffer.getArray() + n, - rBuffer.getConstArray(), - rBuffer.getLength()); - } -} - -/* - * XOutputStream: flush. - */ -void SAL_CALL DataSink_Impl::flush (void) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - if (m_buffer.getLength()) - { - // Write data to stdout. - const sal_Int8 *pData = m_buffer.getConstArray(); - sal_Int32 nData = m_buffer.getLength(); - - int prev = ::setmode (1, O_BINARY); - if (!(prev < 0)) - { - int k = ::write (1, pData, nData); - if (k > 0) - ::write (1, "\n", 1); - ::setmode (1, prev); - } - } -} - -/* - * XOutputStream: closeOutput. - */ -void SAL_CALL DataSink_Impl::closeOutput (void) - throw (NotConnectedException, BufferSizeExceededException, IOException) -{ - flush(); -} - -/*======================================================================== - * - * DecoderListener_Impl implementation. - * - *======================================================================*/ -/* - * DecoderListener_Impl. - */ -DecoderListener_Impl::DecoderListener_Impl (void) -{ -} - -/* - * ~DecoderListener_Impl. - */ -DecoderListener_Impl::~DecoderListener_Impl (void) -{ -} - -/* - * XInterface: queryInterface. - */ -sal_Bool SAL_CALL DecoderListener_Impl::queryInterface ( - const Uik &rUik, Any &rIfc) throw(RuntimeException) -{ - if (com::sun::star::uno::queryInterface ( - rUik, rIfc, - SAL_STATIC_CAST (XEventListener*, this), - SAL_STATIC_CAST (XPGPDecoderListener*, this))) - return sal_True; - else - return OWeakObject::queryInterface (rUik, rIfc); -} - -/* - * XInterface: acquire. - */ -void SAL_CALL DecoderListener_Impl::acquire (void) throw(RuntimeException) -{ - OWeakObject::acquire(); -} - -/* - * XInterface: release. - */ -void SAL_CALL DecoderListener_Impl::release (void) throw(RuntimeException) -{ - OWeakObject::release(); -} - -/* - * XEventListener: disposing. - */ -void SAL_CALL DecoderListener_Impl::disposing (const EventObject &rSource) -{ -} - -/* - * XPGPDecoderListener: decrypted. - */ -void SAL_CALL DecoderListener_Impl::decrypted (const RecipientsEvent &rEvent) -{ -} - -/* - * XPGPDecoderListener: verified. - */ -void SAL_CALL DecoderListener_Impl::verified (const SignatureEvent &rEvent) -{ -} - -/*======================================================================== - * - * Main. - * - *======================================================================*/ -inline rtl::OWString S2U (const sal_Char *ascii) -{ - return rtl::OWString::createFromAscii (ascii); -} - -/* - * main. - */ -int SAL_CALL main (int argc, char **argv) -{ - enum Option - { - OPTION_INSTALL = 0x01, - OPTION_UNINSTALL = 0x02, - - OPTION_DECRYPT = 0x04, - OPTION_ENCRYPT = 0x08, - OPTION_SIGN = 0x10, - - OPTION_FILE = 0x20, - OPTION_HELP = 0x40 - }; - - int fd = 0; - unsigned long nOptions = 0; - - for (int i = 1; i < argc; i++) - { - const char *opt = argv[i]; - if (opt[0] == '-') - { - switch (opt[1]) - { - case 'i': - nOptions |= OPTION_INSTALL; - break; - - case 'u': - nOptions |= OPTION_UNINSTALL; - break; - - case 'd': - nOptions |= OPTION_DECRYPT; - break; - - case 'e': - nOptions |= OPTION_ENCRYPT; - break; - - case 's': - nOptions |= OPTION_SIGN; - break; - - case 'f': - nOptions |= OPTION_FILE; - break; - - case 'h': - default: - nOptions |= OPTION_HELP; - break; - } - } - else - { - if (nOptions & OPTION_FILE) - { - if ((fd = open (argv[i], O_RDONLY | O_BINARY)) < 0) - { - printf ("Error: can't open file: %s\n", argv[i]); - exit (0); - } - } - } - } - - if ((nOptions == 0) || (nOptions & OPTION_HELP)) - { - printf ("Options:\n"); - printf ("-i\tinstall module\n"); - printf ("-u\tuninstall module\n"); - printf ("-d\tdecrypt and verify\n"); - printf ("-e\tencrypt test pattern\n"); - printf ("-s\tsign test pattern\n"); - printf ("-h\thelp\n"); - exit (0); - } - - Reference xManager ( - usr::createDefaultSmartRegistryServiceFactory()); - if (!xManager.is()) - { - printf ("Error: no ProcessServiceManager.\n"); - exit (1); - } - usr::setProcessServiceFactory (xManager); - - if (nOptions & OPTION_INSTALL) - { - - } - - if (nOptions & (OPTION_DECRYPT | OPTION_ENCRYPT | OPTION_SIGN)) - { - Reference xProv ( - xManager->createInstance ( - S2U("com.sun.star.pgp.PGPFactory")), - UNO_QUERY); - if (!xProv.is()) - { - printf ("Error: no PGPFactory service.\n"); - exit (1); - } - - Reference xProvInst ( - xProv->createInstance ( - S2U("com.sun.star.pgp.SimplePGPMailer"))); - if (!xProvInst.is()) - { - printf ("Error: no SimplePGPMailer service.\n"); - exit (2); - } - - Reference xPrefs (xProvInst, UNO_QUERY); - if (xPrefs.is()) - { - unsigned long nDefaults = 0; - - if (xPrefs->getEncryptByDefault()) - nDefaults |= OPTION_ENCRYPT; - if (xPrefs->getSignByDefault()) - nDefaults |= OPTION_SIGN; - if (xPrefs->getAutoDecrypt()) - nDefaults |= OPTION_DECRYPT; - - if (nDefaults) - { - } - } - - static const sal_Int8 pData[] = "" /* "Hello PGP World." */; - Sequence buffer (pData, sizeof (pData) - 1); - - if (nOptions & (OPTION_ENCRYPT | OPTION_SIGN)) - { - Reference xEncoder (xProvInst, UNO_QUERY); - if (!xEncoder.is()) - { - printf ("Error: no PGPEncoder interface.\n"); - exit (4); - } - - DataSource_Impl *source = new DataSource_Impl (fd); - source->setBuffer (buffer); - - DataSink_Impl *sink = new DataSink_Impl; - - Reference xPlainText (source); - Reference xCipherText (sink); - - if (nOptions & OPTION_ENCRYPT) - { - rtl::OWString aRecipients[] = - { - S2U("er@stardiv.de"), - // L"mhu@stardivision.de", - S2U("mhu@rabbit") - }; - - sal_Int32 nRecipients = SAL_N_ELEMENTS(aRecipients); - - if (nOptions & OPTION_SIGN) - { - xEncoder->encryptAndSign ( - Sequence(aRecipients, nRecipients), - xPlainText, - xCipherText); - nOptions &= ~OPTION_SIGN; - } - else - { - xEncoder->encrypt ( - Sequence(aRecipients, nRecipients), - xPlainText, - xCipherText); - } - nOptions &= ~OPTION_ENCRYPT; - } - - if (nOptions & OPTION_SIGN) - { - sal_Bool bDataIsAscii = (fd == 0); // stdin. - - xEncoder->sign ( - bDataIsAscii, - xPlainText, - xCipherText); - nOptions &= ~OPTION_SIGN; - } - - buffer = sink->getBuffer(); - } - - if (nOptions & OPTION_DECRYPT) - { - Reference xDecoder (xProvInst, UNO_QUERY); - if (!xDecoder.is()) - { - printf ("Error: no PGPDecoder interface.\n"); - exit (5); - } - - DataSource_Impl *source = new DataSource_Impl; - source->setBuffer (buffer); - - DataSink_Impl *sink = new DataSink_Impl; - - Reference xCipherText (source); - Reference xPlainText (sink); - - Reference xListener ( - new DecoderListener_Impl); - xDecoder->addDecoderListener (xListener); - - xDecoder->decryptAndVerify ( - xCipherText, - xPlainText); - nOptions &= ~OPTION_DECRYPT; - - xDecoder->removeDecoderListener (xListener); - - buffer = sink->getBuffer(); - } - } - - if (nOptions & OPTION_UNINSTALL) - { - - } - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/testresource.cxx b/extensions/workben/testresource.cxx deleted file mode 100644 index a0c0662c7..000000000 --- a/extensions/workben/testresource.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_extensions.hxx" - -#include -#include - -#include -#include -#include -#include - -using namespace usr; -using ::rtl::StringToOUString; - -class MyApp : public Application -{ -public: - void Main(); -}; - -MyApp aMyApp; - -// ----------------------------------------------------------------------- - -void MyApp::Main() -{ - XMultiServiceFactoryRef xSMgr = createRegistryServiceManager(); - registerUsrServices( xSMgr ); - setProcessServiceManager( xSMgr ); - - XInterfaceRef x = xSMgr->createInstance( L"com.sun.star.registry.ImplementationRegistration" ); - XImplementationRegistrationRef xReg( x, USR_QUERY ); - sal_Char szBuf[1024]; - ORealDynamicLoader::computeModuleName( "res", szBuf, 1024 ); - UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) ); - xReg->registerImplementation( L"com.sun.star.loader.SharedLibrary", aDllName, XSimpleRegistryRef() ); - - x = xSMgr->createInstance( L"com.sun.star.resource.VclStringResourceLoader" ); - XInvocationRef xResLoader( x, USR_QUERY ); - XIntrospectionAccessRef xIntrospection = xResLoader->getIntrospection(); - UString aFileName( L"TestResource" ); - UsrAny aVal; - aVal.setString( aFileName ); - xResLoader->setValue( L"FileName", aVal ); - - Sequence< UsrAny > Args( 1 ); - Sequence< INT16 > OutPos; - Sequence< UsrAny > OutArgs; - Args.getArray()[0].setINT32( 1000 ); - - BOOL b = xResLoader->invoke( L"hasString", Args, OutPos, OutArgs ).getBOOL(); - OSL_ENSURE( b, "hasString" ); - - UString aStr = xResLoader->invoke( L"getString", Args, OutPos, OutArgs ).getString(); - OSL_ENSURE( aStr == L"Hello", "getString" ); - - Args.getArray()[0].setINT32( 1001 ); - b = xResLoader->invoke( L"hasString", Args, OutPos, OutArgs ).getBOOL(); - OSL_ENSURE( !b, "!hasString" ); - - xReg->revokeImplementation( aDllName, XSimpleRegistryRef() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/workben/testresource.src b/extensions/workben/testresource.src deleted file mode 100644 index 5a9fc3a8a..000000000 --- a/extensions/workben/testresource.src +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -String 1000 -{ - Text = "Hello"; -}; diff --git a/forms/AllLangResTarget_frm.mk b/forms/AllLangResTarget_frm.mk deleted file mode 100644 index 4b7a69247..000000000 --- a/forms/AllLangResTarget_frm.mk +++ /dev/null @@ -1,51 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_AllLangResTarget_AllLangResTarget,frm)) - -$(eval $(call gb_AllLangResTarget_set_reslocation,frm,forms)) - -$(eval $(call gb_AllLangResTarget_add_srs,frm,\ - frm/res \ -)) - -$(eval $(call gb_SrsTarget_SrsTarget,frm/res)) - -$(eval $(call gb_SrsTarget_set_include,frm/res,\ - $$(INCLUDE) \ - -I$(realpath $(SRCDIR)/forms/source/inc) \ - -I$(OUTDIR)/inc \ - -I$(WORKDIR)/inc \ -)) - -$(eval $(call gb_SrsTarget_add_files,frm/res,\ - forms/source/resource/strings.src \ - forms/source/resource/xforms.src \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/JunitTest_forms_complex.mk b/forms/JunitTest_forms_complex.mk deleted file mode 100644 index 91a4b5615..000000000 --- a/forms/JunitTest_forms_complex.mk +++ /dev/null @@ -1,47 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Bjoern Michaelsen, Canonical Ltd. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_JunitTest_JunitTest,forms_complex, SRCDIR)) - -$(eval $(call gb_JunitTest_add_jars,forms_complex,\ - $(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,forms_complex,\ - forms/qa/complex/forms/CheckOGroupBoxModel \ -)) - -$(eval $(call gb_JunitTest_add_classes,forms_complex,\ - complex.forms.CheckOGroupBoxModel \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/JunitTest_forms_unoapi.mk b/forms/JunitTest_forms_unoapi.mk deleted file mode 100644 index 9fc231278..000000000 --- a/forms/JunitTest_forms_unoapi.mk +++ /dev/null @@ -1,50 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Bjoern Michaelsen, Canonical Ltd. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_JunitTest_JunitTest,forms_unoapi,SRCDIR)) - -$(eval $(call gb_JunitTest_set_defs,forms_unoapi,\ - $$(DEFS) \ - -Dorg.openoffice.test.arg.sce=$(SRCDIR)/forms/qa/unoapi/forms.sce \ - -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/forms/qa/unoapi/knownissues.xcl \ - -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/forms/qa/unoapi/testdocuments \ -)) - -$(eval $(call gb_JunitTest_add_jars,forms_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_classes,forms_unoapi,\ - org.openoffice.test.UnoApiTest \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/Library_frm.mk b/forms/Library_frm.mk deleted file mode 100644 index 6b2eac9fb..000000000 --- a/forms/Library_frm.mk +++ /dev/null @@ -1,177 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_Library_Library,frm)) - -$(eval $(call gb_Library_add_precompiled_header,frm,$(SRCDIR)/forms/inc/pch/precompiled_forms)) - -$(eval $(call gb_Library_set_include,frm,\ - $$(INCLUDE) \ - -I$(realpath $(SRCDIR)/forms/inc/pch) \ - -I$(realpath $(SRCDIR)/forms/source/inc) \ - -I$(realpath $(SRCDIR)/forms/source/solar/inc) \ - -I$(OUTDIR)/inc \ -)) - -$(eval $(call gb_Library_add_api,frm,\ - offapi \ - oovbaapi \ - udkapi \ -)) - -$(eval $(call gb_Library_add_linked_libs,frm,\ - comphelper \ - cppu \ - cppuhelper \ - dbtools \ - editeng \ - i18nisolang1 \ - sal \ - sfx \ - svl \ - svt \ - svxcore \ - tk \ - tl \ - ucbhelper \ - utl \ - vcl \ - $(gb_STDLIBS) \ -)) -$(eval $(call gb_Library_use_externals,frm,\ - icui18n \ - icuuc \ - libxml2 \ -)) - -$(eval $(call gb_Library_set_componentfile,frm,forms/util/frm)) - -$(eval $(call gb_Library_add_exception_objects,frm,\ - forms/source/component/Button \ - forms/source/component/cachedrowset \ - forms/source/component/CheckBox \ - forms/source/component/clickableimage \ - forms/source/component/cloneable \ - forms/source/component/Columns \ - forms/source/component/ComboBox \ - forms/source/component/Currency \ - forms/source/component/DatabaseForm \ - forms/source/component/Date \ - forms/source/component/EditBase \ - forms/source/component/Edit \ - forms/source/component/entrylisthelper \ - forms/source/component/errorbroadcaster \ - forms/source/component/EventThread \ - forms/source/component/File \ - forms/source/component/Filter \ - forms/source/component/findpos \ - forms/source/component/FixedText \ - forms/source/component/FormattedField \ - forms/source/component/FormattedFieldWrapper \ - forms/source/component/FormComponent \ - forms/source/component/formcontrolfont \ - forms/source/component/FormsCollection \ - forms/source/component/Grid \ - forms/source/component/GroupBox \ - forms/source/component/GroupManager \ - forms/source/component/Hidden \ - forms/source/component/ImageButton \ - forms/source/component/ImageControl \ - forms/source/component/imgprod \ - forms/source/component/ListBox \ - forms/source/component/navigationbar \ - forms/source/component/Numeric \ - forms/source/component/Pattern \ - forms/source/component/propertybaghelper \ - forms/source/component/RadioButton \ - forms/source/component/refvaluecomponent \ - forms/source/component/scrollbar \ - forms/source/component/spinbutton \ - forms/source/component/Time \ - forms/source/helper/commanddescriptionprovider \ - forms/source/helper/commandimageprovider \ - forms/source/helper/controlfeatureinterception \ - forms/source/helper/formnavigation \ - forms/source/helper/resettable \ - forms/source/helper/urltransformer \ - forms/source/helper/windowstateguard \ - forms/source/misc/componenttools \ - forms/source/misc/frm_module \ - forms/source/misc/frm_strings \ - forms/source/misc/ids \ - forms/source/misc/InterfaceContainer \ - forms/source/misc/limitedformats \ - forms/source/misc/listenercontainers \ - forms/source/misc/property \ - forms/source/misc/services \ - forms/source/resource/frm_resource \ - forms/source/richtext/attributedispatcher \ - forms/source/richtext/clipboarddispatcher \ - forms/source/richtext/featuredispatcher \ - forms/source/richtext/parametrizedattributedispatcher \ - forms/source/richtext/richtextcontrol \ - forms/source/richtext/richtextengine \ - forms/source/richtext/richtextimplcontrol \ - forms/source/richtext/richtextmodel \ - forms/source/richtext/richtextunowrapper \ - forms/source/richtext/richtextvclcontrol \ - forms/source/richtext/richtextviewport \ - forms/source/richtext/rtattributehandler \ - forms/source/richtext/specialdispatchers \ - forms/source/runtime/formoperations \ - forms/source/solar/component/navbarcontrol \ - forms/source/solar/control/navtoolbar \ - forms/source/xforms/binding \ - forms/source/xforms/boolexpression \ - forms/source/xforms/computedexpression \ - forms/source/xforms/convert \ - forms/source/xforms/datatyperepository \ - forms/source/xforms/datatypes \ - forms/source/xforms/enumeration \ - forms/source/xforms/mip \ - forms/source/xforms/model \ - forms/source/xforms/model_ui \ - forms/source/xforms/pathexpression \ - forms/source/xforms/propertysetbase \ - forms/source/xforms/resourcehelper \ - forms/source/xforms/submission \ - forms/source/xforms/submission/replace \ - forms/source/xforms/submission/serialization_app_xml \ - forms/source/xforms/submission/serialization_urlencoded \ - forms/source/xforms/submission/submission_get \ - forms/source/xforms/submission/submission_post \ - forms/source/xforms/submission/submission_put \ - forms/source/xforms/unohelper \ - forms/source/xforms/xformsevent \ - forms/source/xforms/xforms_services \ - forms/source/xforms/xmlhelper \ - forms/source/xforms/xpathlib/extension \ - forms/source/xforms/xpathlib/xpathlib \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/Makefile b/forms/Makefile deleted file mode 100644 index 8d7111991..000000000 --- a/forms/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# 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/forms/Module_forms.mk b/forms/Module_forms.mk deleted file mode 100644 index 4e4b30823..000000000 --- a/forms/Module_forms.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Bjoern Michaelsen, Canonical Ltd. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_Module_Module,forms)) - -$(eval $(call gb_Module_add_targets,forms,\ - AllLangResTarget_frm \ - Library_frm \ - Package_unotypes \ -)) - -$(eval $(call gb_Module_add_subsequentcheck_targets,forms,\ - JunitTest_forms_unoapi \ - JunitTest_forms_complex \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/Package_unotypes.mk b/forms/Package_unotypes.mk deleted file mode 100644 index 5641ac26d..000000000 --- a/forms/Package_unotypes.mk +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License or as specified alternatively below. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# David Tardon, Red Hat Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Major Contributor(s): -# -# For minor contributions see the git repository. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. - -$(eval $(call gb_Package_Package,forms_unotypes,$(SRCDIR)/forms/util)) - -$(eval $(call gb_Package_add_file,forms_unotypes,xml/frm.xml,frm.xml)) - -# vim: set noet sw=4 ts=4: diff --git a/forms/inc/pch/precompiled_forms.cxx b/forms/inc/pch/precompiled_forms.cxx deleted file mode 100644 index 990b15d0e..000000000 --- a/forms/inc/pch/precompiled_forms.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_forms.hxx" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/inc/pch/precompiled_forms.hxx b/forms/inc/pch/precompiled_forms.hxx deleted file mode 100644 index 1951442ad..000000000 --- a/forms/inc/pch/precompiled_forms.hxx +++ /dev/null @@ -1,399 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): Generated on 2006-09-01 17:49:42.358362 - -#ifdef PRECOMPILED_HEADERS -//---MARKER--- -#include "sal/config.h" -#include "sal/types.h" - -#include "com/sun/star/awt/ActionEvent.hpp" -#include "com/sun/star/awt/FontDescriptor.hpp" -#include "com/sun/star/awt/FontEmphasisMark.hpp" -#include "com/sun/star/awt/FontRelief.hpp" -#include "com/sun/star/awt/ImageStatus.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/PopupMenuDirection.hpp" -#include "com/sun/star/awt/PosSize.hpp" -#include "com/sun/star/awt/SystemPointer.hpp" -#include "com/sun/star/awt/VclWindowPeerAttribute.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/XComboBox.hpp" -#include "com/sun/star/awt/XControlModel.hpp" -#include "com/sun/star/awt/XDialog.hpp" -#include "com/sun/star/awt/XFocusListener.hpp" -#include "com/sun/star/awt/XImageConsumer.hpp" -#include "com/sun/star/awt/XImageProducer.hpp" -#include "com/sun/star/awt/XItemListener.hpp" -#include "com/sun/star/awt/XListBox.hpp" -#include "com/sun/star/awt/XMouseListener.hpp" -#include "com/sun/star/awt/XRadioButton.hpp" -#include "com/sun/star/awt/XTabControllerModel.hpp" -#include "com/sun/star/awt/XTextComponent.hpp" -#include "com/sun/star/awt/XWindowListener2.hpp" -#include "com/sun/star/beans/NamedValue.hpp" -#include "com/sun/star/beans/Property.hpp" -#include "com/sun/star/beans/PropertyAttribute.hpp" -#include "com/sun/star/beans/PropertyChangeEvent.hpp" -#include "com/sun/star/beans/PropertyValue.hpp" -#include "com/sun/star/beans/XFastPropertySet.hpp" -#include "com/sun/star/beans/XMultiPropertySet.hpp" -#include "com/sun/star/beans/XPropertyChangeListener.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/container/ElementExistException.hpp" -#include "com/sun/star/container/NoSuchElementException.hpp" -#include "com/sun/star/container/XChild.hpp" -#include "com/sun/star/container/XContainer.hpp" -#include "com/sun/star/container/XContainerListener.hpp" -#include "com/sun/star/container/XEnumeration.hpp" -#include "com/sun/star/container/XEnumerationAccess.hpp" -#include "com/sun/star/container/XIndexAccess.hpp" -#include "com/sun/star/container/XIndexContainer.hpp" -#include "com/sun/star/container/XIndexReplace.hpp" -#include "com/sun/star/container/XNameAccess.hpp" -#include "com/sun/star/container/XNameContainer.hpp" -#include "com/sun/star/container/XNameReplace.hpp" -#include "com/sun/star/container/XNamed.hpp" -#include "com/sun/star/container/XSet.hpp" -#include "com/sun/star/form/DataSelectionType.hpp" -#include "com/sun/star/form/DatabaseParameterEvent.hpp" -#include "com/sun/star/form/FormButtonType.hpp" -#include "com/sun/star/form/FormComponentType.hpp" -#include "com/sun/star/form/FormSubmitEncoding.hpp" -#include "com/sun/star/form/FormSubmitMethod.hpp" -#include "com/sun/star/form/ListSourceType.hpp" -#include "com/sun/star/form/NavigationBarMode.hpp" -#include "com/sun/star/form/TabulatorCycle.hpp" -#include "com/sun/star/form/XApproveActionBroadcaster.hpp" -#include "com/sun/star/form/XApproveActionListener.hpp" -#include "com/sun/star/form/XBoundComponent.hpp" -#include "com/sun/star/form/XBoundControl.hpp" -#include "com/sun/star/form/XChangeBroadcaster.hpp" -#include "com/sun/star/form/XDatabaseParameterBroadcaster2.hpp" -#include "com/sun/star/form/XDatabaseParameterListener.hpp" -#include "com/sun/star/form/XForm.hpp" -#include "com/sun/star/form/XFormComponent.hpp" -#include "com/sun/star/form/XGridColumnFactory.hpp" -#include "com/sun/star/form/XImageProducerSupplier.hpp" -#include "com/sun/star/form/XLoadListener.hpp" -#include "com/sun/star/form/XLoadable.hpp" -#include "com/sun/star/form/XReset.hpp" -#include "com/sun/star/form/XResetListener.hpp" -#include "com/sun/star/form/binding/XBindableValue.hpp" -#include "com/sun/star/form/binding/XListEntryListener.hpp" -#include "com/sun/star/form/binding/XListEntrySink.hpp" -#include "com/sun/star/form/binding/XListEntrySource.hpp" -#include "com/sun/star/form/binding/XValueBinding.hpp" -#include "com/sun/star/form/submission/XSubmission.hpp" -#include "com/sun/star/form/submission/XSubmissionSupplier.hpp" -#include "com/sun/star/form/validation/XValidatableFormComponent.hpp" -#include "com/sun/star/form/validation/XValidator.hpp" -#include "com/sun/star/form/validation/XValidityConstraintListener.hpp" -#include "com/sun/star/frame/FrameSearchFlag.hpp" -#include "com/sun/star/frame/XComponentLoader.hpp" -#include "com/sun/star/frame/XDispatch.hpp" -#include "com/sun/star/frame/XDispatchProvider.hpp" -#include "com/sun/star/frame/XDispatchProviderInterception.hpp" -#include "com/sun/star/frame/XDispatchProviderInterceptor.hpp" -#include "com/sun/star/frame/XStatusListener.hpp" -#include "com/sun/star/graphic/XGraphic.hpp" -#include "com/sun/star/io/NotConnectedException.hpp" -#include "com/sun/star/io/WrongFormatException.hpp" -#include "com/sun/star/io/XActiveDataSink.hpp" -#include "com/sun/star/io/XInputStream.hpp" -#include "com/sun/star/io/XMarkableStream.hpp" -#include "com/sun/star/io/XObjectInputStream.hpp" -#include "com/sun/star/io/XObjectOutputStream.hpp" -#include "com/sun/star/io/XOutputStream.hpp" -#include "com/sun/star/io/XPersistObject.hpp" -#include "com/sun/star/io/XTextInputStream.hpp" -#include "com/sun/star/lang/DisposedException.hpp" -#include "com/sun/star/lang/EventObject.hpp" -#include "com/sun/star/lang/IllegalArgumentException.hpp" -#include "com/sun/star/lang/IndexOutOfBoundsException.hpp" -#include "com/sun/star/lang/WrappedTargetException.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/script/ScriptEvent.hpp" -#include "com/sun/star/script/ScriptEventDescriptor.hpp" -#include "com/sun/star/script/XEventAttacherManager.hpp" -#include "com/sun/star/sdb/CommandType.hpp" -#include "com/sun/star/sdb/ParametersRequest.hpp" -#include "com/sun/star/sdb/RowSetVetoException.hpp" -#include "com/sun/star/sdb/SQLContext.hpp" -#include "com/sun/star/sdb/SQLErrorEvent.hpp" -#include "com/sun/star/sdb/XColumn.hpp" -#include "com/sun/star/sdb/XColumnUpdate.hpp" -#include "com/sun/star/sdb/XCompletedExecution.hpp" -#include "com/sun/star/sdb/XInteractionSupplyParameters.hpp" -#include "com/sun/star/sdb/XParametersSupplier.hpp" -#include "com/sun/star/sdb/XQueriesSupplier.hpp" -#include "com/sun/star/sdb/XResultSetAccess.hpp" -#include "com/sun/star/sdb/XRowSetApproveBroadcaster.hpp" -#include "com/sun/star/sdb/XRowSetApproveListener.hpp" -#include "com/sun/star/sdb/XSQLErrorBroadcaster.hpp" -#include "com/sun/star/sdb/XSQLErrorListener.hpp" -#include "com/sun/star/sdb/XSQLQueryComposer.hpp" -#include "com/sun/star/sdb/XSQLQueryComposerFactory.hpp" -#include "com/sun/star/sdb/XSingleSelectQueryComposer.hpp" -#include "com/sun/star/sdbc/ColumnValue.hpp" -#include "com/sun/star/sdbc/DataType.hpp" -#include "com/sun/star/sdbc/ResultSetConcurrency.hpp" -#include "com/sun/star/sdbc/ResultSetType.hpp" -#include "com/sun/star/sdbc/SQLException.hpp" -#include "com/sun/star/sdbc/XCloseable.hpp" -#include "com/sun/star/sdbc/XConnection.hpp" -#include "com/sun/star/sdbc/XDataSource.hpp" -#include "com/sun/star/sdbc/XParameters.hpp" -#include "com/sun/star/sdbc/XResultSetUpdate.hpp" -#include "com/sun/star/sdbc/XRowSet.hpp" -#include "com/sun/star/sdbc/XRowSetListener.hpp" -#include "com/sun/star/sdbcx/Privilege.hpp" -#include "com/sun/star/sdbcx/XColumnsSupplier.hpp" -#include "com/sun/star/sdbcx/XDeleteRows.hpp" -#include "com/sun/star/sdbcx/XTablesSupplier.hpp" -#include "com/sun/star/task/XInteractionContinuation.hpp" -#include "com/sun/star/task/XInteractionHandler.hpp" -#include "com/sun/star/task/XInteractionRequest.hpp" -#include "com/sun/star/ucb/PostCommandArgument2.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/ucb/XProgressHandler.hpp" -#include "com/sun/star/ucb/XSimpleFileAccess.hpp" -#include "com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp" -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" -#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" -#include "com/sun/star/ui/dialogs/XFilePicker.hpp" -#include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" -#include "com/sun/star/uno/Reference.h" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/Type.hxx" -#include "com/sun/star/uno/XAggregation.hpp" -#include "com/sun/star/uno/XInterface.hpp" -#include "com/sun/star/util/Date.hpp" -#include "com/sun/star/util/DateTime.hpp" -#include "com/sun/star/util/NumberFormat.hpp" -#include "com/sun/star/util/SearchAlgorithms.hpp" -#include "com/sun/star/util/Time.hpp" -#include "com/sun/star/util/URL.hpp" -#include "com/sun/star/util/XCancellable.hpp" -#include "com/sun/star/util/XCloneable.hpp" -#include "com/sun/star/util/XModifyBroadcaster.hpp" -#include "com/sun/star/util/XModifyListener.hpp" -#include "com/sun/star/util/XNumberFormatTypes.hpp" -#include "com/sun/star/util/XNumberFormatsSupplier.hpp" -#include "com/sun/star/util/XNumberFormatter.hpp" -#include "com/sun/star/util/XRefreshable.hpp" -#include "com/sun/star/util/XURLTransformer.hpp" -#include "com/sun/star/util/XUpdatable.hpp" -#include "com/sun/star/view/XSelectionSupplier.hpp" -#include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp" -#include "com/sun/star/xforms/XDataTypeRepository.hpp" -#include "com/sun/star/xforms/XFormsEvent.hpp" -#include "com/sun/star/xforms/XFormsSupplier.hpp" -#include "com/sun/star/xforms/XModel.hpp" -#include "com/sun/star/xforms/XSubmission.hpp" -#include "com/sun/star/xml/dom/NodeType.hpp" -#include "com/sun/star/xml/dom/XCharacterData.hpp" -#include "com/sun/star/xml/dom/XDocument.hpp" -#include "com/sun/star/xml/dom/XDocumentBuilder.hpp" -#include "com/sun/star/xml/dom/XDocumentFragment.hpp" -#include "com/sun/star/xml/dom/XElement.hpp" -#include "com/sun/star/xml/dom/XNamedNodeMap.hpp" -#include "com/sun/star/xml/dom/XNode.hpp" -#include "com/sun/star/xml/dom/XNodeList.hpp" -#include "com/sun/star/xml/dom/XText.hpp" -#include "com/sun/star/xml/dom/events/XDocumentEvent.hpp" -#include "com/sun/star/xml/dom/events/XEventListener.hpp" -#include "com/sun/star/xml/dom/events/XEventTarget.hpp" -#include "com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp" -#include "com/sun/star/xml/xpath/XPathObjectType.hpp" -#include "com/sun/star/xml/xpath/XXPathAPI.hpp" -#include "com/sun/star/xml/xpath/XXPathExtension.hpp" -#include "com/sun/star/xml/xpath/XXPathObject.hpp" -#include "com/sun/star/xsd/DataTypeClass.hpp" -#include "com/sun/star/xsd/WhiteSpaceTreatment.hpp" -#include "com/sun/star/xsd/XDataType.hpp" - -#include "comphelper/basicio.hxx" -#include "comphelper/broadcasthelper.hxx" -#include "comphelper/container.hxx" -#include "comphelper/enumhelper.hxx" -#include "comphelper/eventattachermgr.hxx" -#include "comphelper/guarding.hxx" -#include "comphelper/implementationreference.hxx" -#include "comphelper/interaction.hxx" -#include "comphelper/listenernotification.hxx" -#include "comphelper/numbers.hxx" -#include "comphelper/processfactory.hxx" -#include "comphelper/propertycontainer.hxx" -#include "comphelper/propertycontainerhelper.hxx" -#include "comphelper/propertysetinfo.hxx" -#include "comphelper/seqstream.hxx" -#include "comphelper/sequence.hxx" -#include "comphelper/stl_types.hxx" -#include "comphelper/streamsection.hxx" -#include "comphelper/types.hxx" -#include "comphelper/uno3.hxx" - -#include "connectivity/dbconversion.hxx" -#include "connectivity/predicateinput.hxx" -#include "connectivity/sqlparse.hxx" - -#include "cppuhelper/compbase3.hxx" -#include "cppuhelper/component.hxx" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/implbase11.hxx" -#include "cppuhelper/implbase2.hxx" -#include "cppuhelper/implbase3.hxx" -#include "cppuhelper/implbase4.hxx" -#include "cppuhelper/implbase5.hxx" -#include "cppuhelper/implbase6.hxx" -#include "cppuhelper/implbase7.hxx" -#include "cppuhelper/implbase8.hxx" -#include "cppuhelper/interfacecontainer.h" -#include "cppuhelper/interfacecontainer.hxx" -#include "cppuhelper/propshlp.hxx" -#include "cppuhelper/queryinterface.hxx" -#include "cppuhelper/typeprovider.hxx" -#include "cppuhelper/weak.hxx" -#include "cppuhelper/weakref.hxx" - -#include "i18npool/mslangid.hxx" - -#include "libxml/tree.h" -#include "libxml/xpath.h" -#include "libxml/xpathInternals.h" - -#include "osl/conditn.hxx" -#include "osl/diagnose.h" -#include "osl/file.hxx" - -#include "rtl/alloc.h" -#include "rtl/logfile.hxx" -#include "rtl/math.hxx" -#include "rtl/memory.h" -#include "rtl/strbuf.hxx" -#include "rtl/string.hxx" -#include "rtl/tencinfo.h" -#include "rtl/textenc.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "rtl/uuid.h" - -#include "sfx2/imgmgr.hxx" -#include "sfx2/msgpool.hxx" -#include "sfx2/sfxuno.hxx" - -#include "svtools/cliplistener.hxx" -#include "svtools/imageresourceaccess.hxx" -#include "svl/inetstrm.hxx" -#include "svl/inettype.hxx" -#include "svl/itempool.hxx" -#include "svl/itemset.hxx" -#include "svl/languageoptions.hxx" -#include "unotools/lingucfg.hxx" -#include "svl/numuno.hxx" -#include "svl/poolitem.hxx" -#include "svl/solar.hrc" -#include "svtools/transfer.hxx" - -#include "editeng/editdata.hxx" -#include "editeng/editeng.hxx" -#include "editeng/editobj.hxx" -#include "editeng/editstat.hxx" -#include "editeng/editview.hxx" -#include "editeng/eeitem.hxx" -#include "editeng/frmdir.hxx" -#include "editeng/scripttypeitem.hxx" -#include "editeng/svxenum.hxx" -#include "svx/svxids.hrc" -#include "editeng/unoedsrc.hxx" -#include "editeng/unofored.hxx" - -#include "toolkit/helper/emptyfontdescriptor.hxx" - -#include "tools/color.hxx" -#include "tools/date.hxx" -#include "tools/debug.hxx" -#include "tools/diagnose_ex.h" -#include "tools/inetmsg.hxx" -#include "tools/link.hxx" -#include "tools/resid.hxx" -#include "tools/simplerm.hxx" -#include "tools/solar.h" -#include "tools/stream.hxx" -#include "tools/string.hxx" -#include "tools/urlobj.hxx" - -#include "ucbhelper/activedatasink.hxx" -#include "ucbhelper/content.hxx" - -#include "uno/lbnames.h" -#include "uno/mapping.hxx" - -#include "unotools/desktopterminationobserver.hxx" -#include "unotools/idhelper.hxx" -#include "unotools/processfactory.hxx" -#include "unotools/streamhelper.hxx" -#include "unotools/textsearch.hxx" -#include "unotools/ucbstreamhelper.hxx" - -#include "vcl/bmpacc.hxx" -#include "vcl/cvtgrf.hxx" -#include "vcl/mapmod.hxx" -#include "tools/mapunit.hxx" -#include "vcl/stdtext.hxx" -#include "vcl/timer.hxx" -#include "tools/wintypes.hxx" - -#include "osl/mutex.hxx" -#include "osl/thread.hxx" -//---MARKER--- -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/prj/build.lst b/forms/prj/build.lst deleted file mode 100644 index 819a57cc4..000000000 --- a/forms/prj/build.lst +++ /dev/null @@ -1,4 +0,0 @@ -fm forms : TRANSLATIONS:translations oovbaapi svx sfx2 qadevOOo LIBXSLT:libxslt NULL -fm forms usr1 - all fm_mkofrm NULL -fm forms\prj nmake - all fm_prj NULL - diff --git a/forms/prj/d.lst b/forms/prj/d.lst deleted file mode 100644 index e69de29bb..000000000 diff --git a/forms/prj/makefile.mk b/forms/prj/makefile.mk deleted file mode 100755 index e312a7cca..000000000 --- a/forms/prj/makefile.mk +++ /dev/null @@ -1,40 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# 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/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java deleted file mode 100644 index 175349a29..000000000 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package complex.forms; - -import com.sun.star.beans.Property; -import com.sun.star.beans.PropertyAttribute; -import com.sun.star.beans.PropertyChangeEvent; -import com.sun.star.beans.XMultiPropertySet; -import com.sun.star.beans.XPropertiesChangeListener; -import com.sun.star.lang.EventObject; -import com.sun.star.drawing.XControlShape; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -// import complexlib.ComplexTestCase; -import com.sun.star.util.CloseVetoException; -import com.sun.star.util.XCloseable; -import java.util.Vector; -import java.util.logging.Level; -import java.util.logging.Logger; -import util.FormTools; -import util.SOfficeFactory; -import util.ValueChanger; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; -import static org.junit.Assert.*; - -/** - */ -public class CheckOGroupBoxModel -{ - - private XMultiPropertySet m_xPropSet; - private XComponent m_xDrawDoc; - -// public String[] getTestMethodNames() { -// return new String[] {"setPropertyValues"}; -// } - @Before public void before() - { - // XComponent xDrawDoc = null; - SOfficeFactory SOF = SOfficeFactory.getFactory(getMSF()); - - try - { - System.out.println("creating a draw document"); - m_xDrawDoc = SOF.createDrawDoc(null); - } - catch (com.sun.star.uno.Exception e) - { - fail("Couldn't create document."); - } - - String objName = "GroupBox"; - XControlShape shape = FormTools.insertControlShape(m_xDrawDoc, 5000, 7000, 2000, 2000, objName); - m_xPropSet = UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); - } - - @After public void after() - { - XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xDrawDoc); - if (xClose != null) - { - try - { - xClose.close(true); - } - catch (CloseVetoException ex) - { - fail("Can't close document. Exception caught: " + ex.getMessage()); - /* ignore! */ - } - } - } - @Test public void setPropertyValues() - { - String[] boundPropsToTest = getBoundPropsToTest(); - - MyChangeListener ml = new MyChangeListener(); - m_xPropSet.addPropertiesChangeListener(boundPropsToTest, ml); - - Object[] gValues = m_xPropSet.getPropertyValues(boundPropsToTest); - Object[] newValue = new Object[gValues.length]; - System.out.println("Trying to change all properties."); - for (int i = 0; i < boundPropsToTest.length; i++) - { - newValue[i] = ValueChanger.changePValue(gValues[i]); - } - try - { - m_xPropSet.setPropertyValues(boundPropsToTest, newValue); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - fail("Exception occured while trying to change the properties."); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - fail("Exception occured while trying to change the properties."); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - fail("Exception occured while trying to change the properties."); - } // end of try-catch - - assertTrue("Listener was not called.", ml.wasListenerCalled()); - m_xPropSet.removePropertiesChangeListener(ml); - } - - private String[] getBoundPropsToTest() - { - Property[] properties = m_xPropSet.getPropertySetInfo().getProperties(); - String[] testPropsNames = null; - - Vector tNames = new Vector(); - - for (int i = 0; i < properties.length; i++) - { - - Property property = properties[i]; - String name = property.Name; - boolean isWritable = ((property.Attributes - & PropertyAttribute.READONLY) == 0); - boolean isNotNull = ((property.Attributes - & PropertyAttribute.MAYBEVOID) == 0); - boolean isBound = ((property.Attributes - & PropertyAttribute.BOUND) != 0); - - if (isWritable && isNotNull && isBound) - { - tNames.add(name); - } - - } // endfor - - //get a array of bound properties - testPropsNames = new String[tNames.size()]; - testPropsNames = tNames.toArray(testPropsNames); - return testPropsNames; - } - - /** - * Listener implementation which sets a flag when - * listener was called. - */ - public class MyChangeListener implements XPropertiesChangeListener - { - - boolean propertiesChanged = false; - - public void propertiesChange(PropertyChangeEvent[] e) - { - propertiesChanged = true; - } - - public void disposing(EventObject obj) - { - } - - public boolean wasListenerCalled() - { - return propertiesChanged; - } - - public void reset() - { - propertiesChanged = false; - } - }; - - private XMultiServiceFactory getMSF() - { - final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); - return xMSF1; - } - - // setup and close connections - @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/forms/qa/forms_all.sce b/forms/qa/forms_all.sce deleted file mode 100644 index 3aef2c95e..000000000 --- a/forms/qa/forms_all.sce +++ /dev/null @@ -1,8 +0,0 @@ --o integration.forms.RadioButtons --o integration.forms.FormControlTest --o integration.forms.FormPropertyBags --o integration.forms.CellBinding --o integration.forms.ListSelection --o integration.forms.MasterDetailForms --o integration.forms.XMLFormSettings --o integration.forms.ListBox diff --git a/forms/qa/integration/forms/BooleanValidator.java b/forms/qa/integration/forms/BooleanValidator.java deleted file mode 100644 index 4353703a4..000000000 --- a/forms/qa/integration/forms/BooleanValidator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * BooleanValidator.java - * - * Created on 10. Maerz 2004, 16:27 - */ - -package integration.forms; - -/** - * - * @author fs93730 - */ -public class BooleanValidator extends integration.forms.ControlValidator -{ - private boolean m_preventChecked; - private com.sun.star.uno.AnyConverter m_converter; - - /** Creates a new instance of BooleanValidator */ - public BooleanValidator( boolean preventChecked ) - { - m_preventChecked = preventChecked; - m_converter = new com.sun.star.uno.AnyConverter(); - } - - public String explainInvalid( Object Value ) - { - try - { - if ( m_converter.isVoid( Value ) ) - return "'indetermined' is not an allowed state"; - boolean value = ((Boolean)Value).booleanValue(); - if ( m_preventChecked && ( value == true ) ) - return "no no no. Don't check it."; - } - catch( java.lang.Exception e ) - { - return "ooops. Unknown error"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - if ( m_converter.isVoid( Value ) ) - return false; - - boolean value = ((Boolean)Value).booleanValue(); - if ( m_preventChecked && ( value == true ) ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - } - return false; - } -} diff --git a/forms/qa/integration/forms/CellBinding.java b/forms/qa/integration/forms/CellBinding.java deleted file mode 100644 index 07a8fddd6..000000000 --- a/forms/qa/integration/forms/CellBinding.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * CellBinding.java - * - * Created on 12. Mai 2004, 15:15 - */ - -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.util.*; -import com.sun.star.lang.*; -import com.sun.star.beans.*; -import com.sun.star.form.binding.*; -import com.sun.star.accessibility.*; -import com.sun.star.awt.XListBox; -import com.sun.star.table.CellAddress; -import com.sun.star.table.XCell; -import com.sun.star.sheet.XCellRangeData; -import com.sun.star.sheet.XCellRangeFormula; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.text.XTextRange; - -/** - * - * @author fs93730 - */ -public class CellBinding extends complexlib.ComplexTestCase -{ - /** the test document our form layer lives in */ - private SpreadsheetDocument m_document; - /** our form layer */ - private FormLayer m_formLayer; - /** our service factory */ - private XMultiServiceFactory m_orb; - - /** Creates a new instance of CellBinding */ - public CellBinding() - { - } - - public String[] getTestMethodNames() - { - return new String[] { - "checkTextFieldBinding", - "checkBooleanRadioBinding", - "checkStringRadioBinding", - "checkBooleanCheckBoxBinding", - "checkStringCheckBoxBinding", - "checkListBoxBinding", - "checkListBoxIndexBinding" - }; - } - - public String getTestObjectName() - { - return "Form Control Spreadsheet Cell Binding Test"; - } - - /* ------------------------------------------------------------------ */ - /** closes our document, if we have an open one - */ - private void closeDocument() - { - try - { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } - } - catch ( com.sun.star.uno.Exception e ) - { - } - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - m_document = new SpreadsheetDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - closeDocument(); - } - - /* ------------------------------------------------------------------ */ - public void checkTextFieldBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - final short col = 0; - final short row = 2; - final String text = new String( "content" ); - final String otherText = new String( "something else" ); - final String yetAnotherText = new String( "yet another text" ); - - // cretae a normal text control - XPropertySet controlModel = m_formLayer.createControlAndShape( "DatabaseTextField", 30, 9, 30, 6 ); - - // bind it to cell A1 - bindToCell( controlModel, col, row ); - - // switch to alive mode - m_document.getCurrentView().toggleFormDesignMode(); - - // test the data transfer control -> cell - simulateUserTextInput( controlModel, text ); - verifyStringCellContent( col, row, text, "A text field does not forward its user input to the cell." ); - - // the same, but this time changing the control value programmatically - controlModel.setPropertyValue( "Text", otherText ); - verifyStringCellContent( col, row, otherText, "A text field does not forward programmatic changes to the cell." ); - - // the other way round: cell->control - setCellText( col, row, yetAnotherText ); - String controlText = (String)controlModel.getPropertyValue( "Text" ); - if ( !controlText.equals( yetAnotherText ) ) - failed( "Changes in the cell are not forwarded to the text field." ); - } - /* ------------------------------------------------------------------ */ - public void checkBooleanRadioBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - // two radio buttons - XPropertySet primaryRadio = createRadio( 28, "radio button no. 1", "radio group", "primary" ); - XPropertySet secondaryRadio = createRadio( 33, "radio button no. 2", "radio group", "secodary" ); - - // bind them - short col = (short)0; - short row1 = (short)6; - short row2 = (short)7; - bindToCell( primaryRadio, col, row1 ); - bindToCell( secondaryRadio, col, row2 ); - - // check the first button - simulateUserRadioCheck( primaryRadio ); - // check the cell content - verifyNumericCellContent( col, row1, 1, "Radio buttons do not forward their (boolean) values to cells (1)." ); - verifyNumericCellContent( col, row2, 0, "Radio buttons do not forward their (boolean) values to cells (2)." ); - // check the second button - simulateUserRadioCheck( secondaryRadio ); - // check the cell content - verifyNumericCellContent( col, row1, 0, "Radio buttons do not forward their (boolean) values to cells (3)." ); - verifyNumericCellContent( col, row2, 1, "Radio buttons do not forward their (boolean) values to cells (4)." ); - - // the other way round: writing values into the cell - setCellValue( col, row1, 1.0 ); - // setting this should have checked the primary radio, which should have unchecked the secondary radio, - // which should have been propagated to the second cell - verifyNumericCellContent( col, row2, 0, "Changing primary cell is not propagated to the secondary cell (via the radio buttons)." ); - - // setting an empty cell should result in the radio being unchecked - setCellEmpty( col, row1 ); - if ( ((Short)primaryRadio.getPropertyValue( "State" )).shortValue() != 0 ) - failed( "Setting a cell to 'empty' does not reset the bound radio button." ); - } - - /* ------------------------------------------------------------------ */ - public void checkStringRadioBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - // two radio buttons - XPropertySet primaryRadio = createRadio( 46, "radio button A", "radio ref group", "primary" ); - XPropertySet secondaryRadio = createRadio( 51, "radio button B", "radio ref group", "secodary" ); - - // give the ref values - String refValueA = new String( "ref value A" ); - String refValueB = new String( "ref value B" ); - primaryRadio.setPropertyValue( "RefValue", refValueA ); - secondaryRadio.setPropertyValue( "RefValue", refValueB ); - - // bind them to the same cell - short col = (short)0; - short row = (short)10; - bindToCell( primaryRadio, col, row ); - bindToCell( secondaryRadio, col, row ); - - // checking a radio should set the respective ref value at the cell - simulateUserRadioCheck( primaryRadio ); - verifyStringCellContent( col, row, refValueA, "A bound radio button with a reference value does not pass this value to the cell upon checking (1)." ); - simulateUserRadioCheck( secondaryRadio ); - verifyStringCellContent( col, row, refValueB, "A bound radio button with a reference value does not pass this value to the cell upon checking (2)." ); - - // changing the cell should check the buttons if the cell text equals the ref value - setCellText( col, row, "no ref value" ); - verifyRadioStates( primaryRadio, secondaryRadio, (short)0, (short)0, "Radio button not unchecked, though the bound cell value does not equal ref value." ); - - setCellText( col, row, refValueA ); - verifyRadioStates( primaryRadio, secondaryRadio, (short)1, (short)0, "Radio button not properly un/checked according to the cell and ref value (1)." ); - - setCellText( col, row, refValueB ); - verifyRadioStates( primaryRadio, secondaryRadio, (short)0, (short)1, "Radio button not properly un/checked according to the cell and ref value (2)." ); - } - - /* ------------------------------------------------------------------ */ - public void checkBooleanCheckBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet checkBox = m_formLayer.createControlAndShape( "DatabaseCheckBox", 30, 59, 40, 4 ); - checkBox.setPropertyValue( "Label", "check box" ); - checkBox.setPropertyValue( "TriState", new Boolean( true ) ); - - short col = (short)0; - short row = (short)13; - bindToCell( checkBox, col, row ); - - // initialize with "not checked" - checkBox.setPropertyValue( "State", new Short( (short)0 ) ); - verifyNumericCellContent( col, row, 0, "programmatically unchecking the check box is not propagated to the cell." ); - - // first click: "not checked" -> "checked" - simulateUserCheckBoxCheck( checkBox, (short)1 ); - verifyNumericCellContent( col, row, 1, "moving the check box state to 'checked' is not propagated to the cell." ); - - // second click: "checked" -> "indetermined" - simulateUserCheckBoxCheck( checkBox, (short)2 ); - verifyVoidCell( col, row, "propagating the 'indetermined' state to the cell does not work." ); - - // third click: "indetermined" -> "not checked" - simulateUserCheckBoxCheck( checkBox, (short)0 ); - verifyNumericCellContent( col, row, 0, "unchecking a check box via UI is not propagated to the cell." ); - } - - /* ------------------------------------------------------------------ */ - public void checkStringCheckBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - String refValue = new String( "checked " ); - - XPropertySet checkBox = m_formLayer.createControlAndShape( "DatabaseCheckBox", 30, 68, 40, 4 ); - checkBox.setPropertyValue( "Label", "check box with ref value" ); - checkBox.setPropertyValue( "TriState", new Boolean( true ) ); - checkBox.setPropertyValue( "RefValue", refValue ); - - short col = (short)0; - short row = (short)15; - bindToCell( checkBox, col, row ); - - // initialize with "not checked" - checkBox.setPropertyValue( "State", new Short( (short)0 ) ); - verifyNumericCellContent( col, row, 0, "programmatically unchecking the check box is not propagated to the cell." ); - - // first click: "not checked" -> "checked" - simulateUserCheckBoxCheck( checkBox, (short)1 ); - verifyStringCellContent( col, row, refValue, "moving the check box state to 'checked' does not propagated the ref value to the cell." ); - - // second click: "checked" -> "indetermined" - simulateUserCheckBoxCheck( checkBox, (short)2 ); - verifyVoidCell( col, row, "propagating the 'indetermined' state to the cell does not work, when exchanging ref values." ); - - // third click: "indetermined" -> "not checked" - simulateUserCheckBoxCheck( checkBox, (short)0 ); - verifyStringCellContent( col, row, "", "unchecking a check box via UI does not propagated the ref value to the cell." ); - } - - /* ------------------------------------------------------------------ */ - /** verifies that a list box, which is bound via an ordinary value binding, - * works as expected - */ - public void checkListBoxBinding( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet listBox = m_formLayer.createControlAndShape( "DatabaseListBox", 30, 80, 40, 6 ); - listBox.setPropertyValue( "Dropdown", new Boolean( true ) ); - listBox.setPropertyValue( "StringItemList", new String[] { "Apples", "Oranges", "Peaches" } ); - - short col = (short)0; - short row = (short)18; - - // ............................................................... - // add a list entry source which fills the list boxes list from cells in the - // spreadsheet - short sourceCol = (short)4; - setCellText( sourceCol, (short)( row - 1 ), "Apples" ); - setCellText( sourceCol, (short)( row + 0 ), "Oranges" ); - setCellText( sourceCol, (short)( row + 1 ), "Peaches" ); - - //setListSource( listBox, sourceCol, row, (short)( row + 2 ) ); - // TODO: this is currently prone to deadlocks - - // ............................................................... - // bind to a cell - bindToCell( listBox, col, row ); - - // ............................................................... - // do the tests - listBox.setPropertyValue( "SelectedItems", new short[] { (short)0 } ); - verifyStringCellContent( col, row, "Apples", "programmatically selecting a list entry is not propagated to the cell." ); - - simulateUserListBoxSelection( listBox, "Oranges" ); - verifyStringCellContent( col, row, "Oranges", "UI-selecting a list entry is not propagated to the cell." ); - - setCellText( col, row, "Peaches" ); - short[] selectedItems = (short[])listBox.getPropertyValue( "SelectedItems" ); - assureEquals( "changes in the cell bound to a list box are not propagated to the list box selection", - 2, selectedItems[0] ); - } - - /* ------------------------------------------------------------------ */ - /** verifies that a list box, which is bound via a value binding exchanging the index - * of the selected entry, works as expected - */ - public void checkListBoxIndexBinding() throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet listBox = m_formLayer.createControlAndShape( "DatabaseListBox", 30, 94, 40, 6 ); - listBox.setPropertyValue( "Dropdown", new Boolean( true ) ); - listBox.setPropertyValue( "StringItemList", new String[] { "Pears", "Bananas", "Strawberries" } ); - - short col = (short)0; - short row = (short)21; - - // ............................................................... - // add a list entry source which fills the list boxes list from cells in the - // spreadsheet - short sourceCol = (short)4; - setCellText( sourceCol, (short)( row - 1 ), "Pears" ); - setCellText( sourceCol, (short)( row + 0 ), "Bananas" ); - setCellText( sourceCol, (short)( row + 1 ), "Strawberries" ); - - //setListSource( listBox, sourceCol, row, (short)( row + 2 ) ); - // TODO: this is currently prone to deadlocks - - // ............................................................... - // bind to a cell - bindToCell( listBox, col, row, "com.sun.star.table.ListPositionCellBinding" ); - - // ............................................................... - // do the tests - listBox.setPropertyValue( "SelectedItems", new short[] { (short)0 } ); - verifyNumericCellContent( col, row, 1, "programmatically selecting a list entry is not propagated (as index) to the cell." ); - - simulateUserListBoxSelection( listBox, "Bananas" ); - verifyNumericCellContent( col, row, 2, "UI-selecting a list entry is not propagated (as index) to the cell." ); - - setCellValue( col, row, 3 ); - short[] selectedItems = (short[])listBox.getPropertyValue( "SelectedItems" ); - assureEquals( "changes in the cell bound to a list box via list index are not propagated to the list box selection", - 2, selectedItems[0] ); - } - - /* ------------------------------------------------------------------ */ - /** verifies that the content of a given cell equals a given string - */ - private XPropertySet createRadio( int yPos, String label, String name, String tag ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet radio = m_formLayer.createControlAndShape( "DatabaseRadioButton", 30, yPos, 40, 4 ); - radio.setPropertyValue( "Label", label ); - radio.setPropertyValue( "Name", name ); - radio.setPropertyValue( "Tag", tag ); - return radio; - } - - /* ------------------------------------------------------------------ */ - /** verifies the states of two radio button - */ - private boolean verifyRadioStates( XPropertySet radio1, XPropertySet radio2, short value1, short value2, - String errorMessage ) throws com.sun.star.uno.Exception, java.lang.Exception - { - if ( ( ((Short)radio1.getPropertyValue( "State" )).shortValue() != value1 ) - || ( ((Short)radio2.getPropertyValue( "State" )).shortValue() != value2 ) - ) - { - failed( errorMessage ); - return false; - } - return true; - } - - /* ------------------------------------------------------------------ */ - /** verifies that the content of a given cell equals a given string - */ - private boolean verifyVoidCell( short col, short row, String failErrorMessage ) throws com.sun.star.uno.Exception - { - XCellRangeData cell = (XCellRangeData)UnoRuntime.queryInterface( XCellRangeData.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - Object cellContent = cell.getDataArray()[0][0]; - if ( ((com.sun.star.uno.Any)cellContent).getType().getTypeClass() != com.sun.star.uno.TypeClass.VOID ) - { - failed( failErrorMessage ); - return false; - } - return true; - } - - /* ------------------------------------------------------------------ */ - /** verifies that the content of a given cell equals a given string - */ - private boolean verifyNumericCellContent( short col, short row, double value, String failErrorMessage ) throws com.sun.star.uno.Exception - { - XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - if ( cell.getValue() != value ) - { - failed( failErrorMessage ); - return false; - } - return true; - } - - /* ------------------------------------------------------------------ */ - /** verifies that the content of a given cell equals a given string - */ - private boolean verifyStringCellContent( short col, short row, String text, String failErrorMessage ) throws com.sun.star.uno.Exception - { - XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - if ( !cell.getString().equals( text ) ) - { - failed( failErrorMessage ); - return false; - } - return true; - } - - /* ------------------------------------------------------------------ */ - /** sets the text of a given cell to a given string - */ - private void setCellText( short col, short row, String text ) throws com.sun.star.uno.Exception - { - XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - cell.setString( text ); - } - - /* ------------------------------------------------------------------ */ - /** sets a numeric value in a given cell - */ - private void setCellValue( short col, short row, double value ) throws com.sun.star.uno.Exception - { - XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - cell.setValue( value ); - } - - /* ------------------------------------------------------------------ */ - /** sets a numeric value in a given cell - */ - private void setCellEmpty( short col, short row ) throws com.sun.star.uno.Exception - { - // as long as #i29130# is not fixed, we do not set the cell to "empty", but to - // an invalid formular, which serves well for our purpose - XCellRangeFormula cell = (XCellRangeFormula)UnoRuntime.queryInterface( XCellRangeFormula.class, - m_document.getSheet( 0 ).getCellByPosition( col, row ) - ); - String[][] args = new String[][] { new String[] { "=INVALID_FUNCTION()" } }; - cell.setFormulaArray( args ); - } - - /* ------------------------------------------------------------------ */ - /** binds the given control model to the given cell in the first sheet, - * using the given service name for the binding - */ - private void bindToCell( XPropertySet controlModel, short column, short row, String _bindingServiceName ) throws com.sun.star.uno.Exception - { - XBindableValue bindableModel = (XBindableValue)UnoRuntime.queryInterface( XBindableValue.class, - controlModel - ); - - CellAddress address = new CellAddress(); - address.Column = column; - address.Row = row; - address.Sheet = 0; - - NamedValue[] parameters = new NamedValue[] { new NamedValue() }; - parameters[0].Name = "BoundCell"; - parameters[0].Value = address; - - XValueBinding cellBinding = (XValueBinding)UnoRuntime.queryInterface( XValueBinding.class, - m_document.createInstanceWithArguments( _bindingServiceName, parameters ) - ); - - bindableModel.setValueBinding( cellBinding ); - } - - /* ------------------------------------------------------------------ */ - /** binds the given control model to the given cell in the first sheet - */ - private void bindToCell( XPropertySet _controlModel, short _column, short _row ) throws com.sun.star.uno.Exception - { - bindToCell( _controlModel, _column, _row, "com.sun.star.table.CellValueBinding" ); - } - - /* ------------------------------------------------------------------ */ - /** sets the given cell range as list entry source for the given control - */ - private void setListSource( XPropertySet _listSink, short _sourceCol, short _rowStart, short _rowEnd ) throws com.sun.star.uno.Exception - { - CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, (int)_sourceCol, (int)_rowStart, (int)_sourceCol, (int)_rowEnd ); - NamedValue addressParameter = new NamedValue( "CellRange", listSourceAddress ); - - XListEntrySource listSource = (XListEntrySource)UnoRuntime.queryInterface( XListEntrySource.class, - m_document.createInstanceWithArguments( "com.sun.star.table.CellRangeListSource", new NamedValue[]{ addressParameter } ) - ); - XListEntrySink listSink = (XListEntrySink)UnoRuntime.queryInterface( XListEntrySink.class, - _listSink ); - listSink.setListEntrySource( listSource ); - } - - /* ------------------------------------------------------------------ */ - /** simulates a user action to check a radio button - */ - private void simulateUserRadioCheck( XPropertySet radioModel ) throws com.sun.star.uno.Exception - { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( - XAccessible.class, m_document.getCurrentView().getControl( radioModel ) ); - - XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( - XAccessibleValue.class, accessible.getAccessibleContext() ); - - Integer newValue = new Integer( 1 ); - xValue.setCurrentValue( newValue ); - } - - /* ------------------------------------------------------------------ */ - /** simulates a user action to check a radio button - */ - private void simulateUserCheckBoxCheck( XPropertySet checkBox, short state ) throws com.sun.star.uno.Exception - { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( - XAccessible.class, m_document.getCurrentView().getControl( checkBox ) ); - - XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface( - XAccessibleValue.class, accessible.getAccessibleContext() ); - - xValue.setCurrentValue( new Short( state ) ); - } - - /* ------------------------------------------------------------------ */ - /** simulates a user selecting an entry in a list box - */ - private void simulateUserListBoxSelection( XPropertySet _listBox, String _selectEntry ) throws com.sun.star.uno.Exception - { - XListBox listBoxControl = (XListBox)UnoRuntime.queryInterface( - XListBox.class, m_document.getCurrentView().getControl( _listBox ) ); - listBoxControl.selectItem( _selectEntry, true ); - } - - /* ------------------------------------------------------------------ */ - /** simulates text input into the control belonging to the given model - */ - private void simulateUserTextInput( XPropertySet controlModel, String text ) throws com.sun.star.uno.Exception - { - XAccessible accessible = (XAccessible)UnoRuntime.queryInterface( - XAccessible.class, m_document.getCurrentView().getControl( controlModel ) ); - - XAccessibleContext context = accessible.getAccessibleContext(); - XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, - accessible.getAccessibleContext() ); - - XAccessibleEditableText textAccess = (XAccessibleEditableText)UnoRuntime.queryInterface( - XAccessibleEditableText.class, accessible.getAccessibleContext() ); - - textAccess.setText( text ); - } -} diff --git a/forms/qa/integration/forms/ControlValidation.java b/forms/qa/integration/forms/ControlValidation.java deleted file mode 100644 index fe06a5c54..000000000 --- a/forms/qa/integration/forms/ControlValidation.java +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.util.*; -import com.sun.star.lang.*; -import com.sun.star.accessibility.*; -import com.sun.star.container.*; -import com.sun.star.beans.*; -import com.sun.star.form.binding.*; - -import integration.forms.DocumentHelper; -import integration.forms.NumericValidator; -import integration.forms.TextValidator; -import integration.forms.BooleanValidator; -import integration.forms.ListSelectionValidator; -import integration.forms.SingleControlValidation; - -public class ControlValidation extends complexlib.ComplexTestCase implements com.sun.star.lang.XEventListener -{ - private DocumentHelper m_document; /// our current test document - private XMultiServiceFactory m_orb; /// our service factory - - /** Creates a new instance of ControlValidation */ - public ControlValidation() - { - } - - public String[] getTestMethodNames() - { - return new String[] { - "interactiveValidation" - }; - } - - public String getTestObjectName() - { - return "Form Control Validation Test"; - } - - public static boolean isInteractiveTest() - { - return true; - } - - /* ------------------------------------------------------------------ */ - /* test framework */ - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - } - - /* ------------------------------------------------------------------ */ - private void prepareTestStep( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - m_document = DocumentHelper.blankTextDocument( m_orb ); - m_document.getDocument( ).addEventListener( this ); - } - - /* ------------------------------------------------------------------ */ - public void after() - { - closeDocument(); - } - - /* ------------------------------------------------------------------ */ - /** closes our document, if we have an open one - */ - private void closeDocument() - { - try - { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } - } - catch ( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.out ); - } - } - - /* ------------------------------------------------------------------ */ - /* public test methods */ - /* ------------------------------------------------------------------ */ - public void interactiveValidation() throws com.sun.star.uno.Exception, java.lang.Exception - { - prepareTestStep(); - - SingleControlValidation validation; - XPropertySet focusField; - - validation = new SingleControlValidation( m_document, 5, 5, "DatabaseFormattedField", new NumericValidator() ); - focusField = validation.getInputField(); - validation.setExplanatoryText( "Please enter a number between 0 and 100, with at most 1 decimal digit" ); - - validation = new SingleControlValidation( m_document, 90, 5, "DatabaseTextField", new TextValidator() ); - validation.setExplanatoryText( "Please enter a text whose length is a multiple of 3, and which does not contain the letter 'Z'" ); - - validation = new SingleControlValidation( m_document, 5, 55, "DatabaseDateField", new DateValidator() ); - validation.setExplanatoryText( "Please enter a date in the current month" ); - validation.getInputField().setPropertyValue( "Dropdown", new Boolean( true ) ); - - validation = new SingleControlValidation( m_document, 90, 55, "DatabaseTimeField", new TimeValidator() ); - validation.setExplanatoryText( "Please enter a time. Valid values are all full hours." ); - - validation = new SingleControlValidation( m_document, 5, 110, "DatabaseCheckBox", new BooleanValidator( false ) ); - validation.setExplanatoryText( "Please check (well, or uncheck) the box. Don't leave it in indetermined state." ); - validation.getInputField().setPropertyValue( "TriState", new Boolean( true ) ); - - validation = new SingleControlValidation( m_document, 90, 110, "DatabaseRadioButton", new BooleanValidator( true ), 3, 0 ); - validation.setExplanatoryText( "Please check any but the first button" ); - - validation = new SingleControlValidation( m_document, 5, 165, "DatabaseListBox", new ListSelectionValidator( ), 1, 24 ); - validation.setExplanatoryText( "Please select not more than two entries." ); - validation.getInputField().setPropertyValue( "MultiSelection", new Boolean( true ) ); - validation.getInputField().setPropertyValue( "StringItemList", new String[] { "first", "second", "third", "forth", "fivth" } ); - - // switch to alive mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - m_document.getCurrentView( ).grabControlFocus( focusField ); - - // wait for the user telling us to exit - waitForUserInput(); - } - - /* ------------------------------------------------------------------ */ - /* internal methods */ - /* ------------------------------------------------------------------ */ - /** waits for the user to press a key (on the console where she started the java program) - or the document to be closed by the user. - @return - if the user pressed a key on the console, if she closed the document - */ - protected boolean waitForUserInput() throws java.lang.Exception - { - synchronized (this) - { - integration.forms.WaitForInput aWait = new integration.forms.WaitForInput( this ); - aWait.start(); - wait(); - - // if the waiter thread is done, the user pressed enter - boolean bKeyPressed = aWait.isDone(); - if ( !bKeyPressed ) - aWait.interrupt(); - - return bKeyPressed; - } - } - - /* ------------------------------------------------------------------ */ - /* XEventListener overridables */ - /* ------------------------------------------------------------------ */ - public void disposing( com.sun.star.lang.EventObject eventObject ) - { - if ( m_document.getDocument().equals( eventObject.Source ) ) - { - // notify ourself that we can stop waiting for user input - synchronized (this) - { - notify(); - } - } - } - -} diff --git a/forms/qa/integration/forms/ControlValidator.java b/forms/qa/integration/forms/ControlValidator.java deleted file mode 100644 index c92b33e02..000000000 --- a/forms/qa/integration/forms/ControlValidator.java +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -/** base class for components validating the content of form controls - */ -public abstract class ControlValidator implements com.sun.star.form.validation.XValidator -{ - - /** Creates a new instance of ControlValidator */ - public ControlValidator() - { - } - - public void addValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) - { - } - - public void removeValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) - { - } - - protected boolean isVoid( Object Value ) - { - try - { - return ( com.sun.star.uno.AnyConverter.getType(Value).getTypeClass() - == com.sun.star.uno.TypeClass.VOID ); - } - catch( java.lang.ClassCastException e ) - { - } - return false; - } -} diff --git a/forms/qa/integration/forms/DateValidator.java b/forms/qa/integration/forms/DateValidator.java deleted file mode 100644 index 7ea2c2a4a..000000000 --- a/forms/qa/integration/forms/DateValidator.java +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.form.binding.*; - -public class DateValidator extends integration.forms.ControlValidator -{ - - /** Creates a new instance of NumericValidator */ - public DateValidator( ) - { - } - - public String explainInvalid( Object Value ) - { - try - { - if ( isVoid( Value ) ) - return "empty input"; - - com.sun.star.util.Date dateValue = (com.sun.star.util.Date)Value; - if ( isDedicatedInvalidDate( dateValue ) ) - return "this is no valid date"; - - if ( !isNextMonthsDate( dateValue ) ) - return "date must denote a day in the current month"; - } - catch( java.lang.Exception e ) - { - return "oops. What did you enter for this to happen?"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - if ( isVoid( Value ) ) - return false; - - com.sun.star.util.Date dateValue = (com.sun.star.util.Date) - com.sun.star.uno.AnyConverter.toObject( - com.sun.star.util.Date.class, Value); - if ( isDedicatedInvalidDate( dateValue ) ) - return false; - - if ( !isNextMonthsDate( dateValue ) ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - e.printStackTrace( System.err ); - } - return false; - } - - private boolean isDedicatedInvalidDate( com.sun.star.util.Date dateValue ) - { - return ( dateValue.Day == 0 ) && ( dateValue.Month == 0 ) && ( dateValue.Year == 0 ); - } - - private boolean isNextMonthsDate( com.sun.star.util.Date dateValue ) - { - int overallMonth = dateValue.Year * 12 + dateValue.Month - 1; - - int todaysMonth = new java.util.Date().getMonth(); - int todaysYear = new java.util.Date().getYear() + 1900; - int todaysOverallMonth = todaysYear * 12 + todaysMonth; - - return overallMonth == todaysOverallMonth; - } -} diff --git a/forms/qa/integration/forms/DocumentHelper.java b/forms/qa/integration/forms/DocumentHelper.java deleted file mode 100644 index f4dbac80b..000000000 --- a/forms/qa/integration/forms/DocumentHelper.java +++ /dev/null @@ -1,404 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.beans.PropertyState; -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XChild; -import com.sun.star.container.XIndexContainer; -import com.sun.star.container.XNameContainer; -import com.sun.star.document.MacroExecMode; -import com.sun.star.drawing.XDrawPage; -import com.sun.star.drawing.XDrawPageSupplier; -import com.sun.star.drawing.XDrawPages; -import com.sun.star.drawing.XDrawPagesSupplier; -import com.sun.star.form.XFormsSupplier; -import com.sun.star.frame.XComponentLoader; -import com.sun.star.frame.XController; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XModel; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.util.XModifiable; - -/**************************************************************************/ - -/**************************************************************************/ -/** provides a small wrapper around a document -*/ -public class DocumentHelper -{ - private XMultiServiceFactory m_orb; - private XComponent m_documentComponent; - - /* ================================================================== */ - /* ------------------------------------------------------------------ */ - public DocumentHelper( XMultiServiceFactory orb, XComponent document ) - { - m_orb = orb; - m_documentComponent = document; - } - - /* ------------------------------------------------------------------ */ - protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception - { - return implLoadAsComponent( orb, documentOrFactoryURL, new PropertyValue[0] ); - } - - /* ------------------------------------------------------------------ */ - protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception - { - XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface( - XComponentLoader.class, - orb.createInstance( "com.sun.star.frame.Desktop" ) - ); - - XComponent document = dbfTools.queryComponent( - aLoader.loadComponentFromURL( documentOrFactoryURL, "_blank", 0, i_args ) - ); - return document; - } - - /* ------------------------------------------------------------------ */ - private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception - { - return implLoadDocument( orb, documentOrFactoryURL, new PropertyValue[0] ); - } - - /* ------------------------------------------------------------------ */ - private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception - { - XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args ); - - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, - document ); - if ( xSI.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) ) - return new SpreadsheetDocument( orb, document ); - return new DocumentHelper( orb, document ); - } - - /* ------------------------------------------------------------------ */ - public static DocumentHelper loadDocument( XMultiServiceFactory orb, String documentURL ) throws com.sun.star.uno.Exception - { - return implLoadDocument( orb, documentURL ); - } - - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankTextDocument( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception - { - return blankDocument( orb, DocumentType.WRITER ); - } - - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankXMLForm( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception - { - return blankDocument( orb, DocumentType.XMLFORM ); - } - - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankDocument( XMultiServiceFactory orb, DocumentType eType ) throws com.sun.star.uno.Exception - { - final PropertyValue[] args = new PropertyValue[] { - new PropertyValue( "MacroExecutionMode", -1, MacroExecMode.ALWAYS_EXECUTE, PropertyState.DIRECT_VALUE ) - }; - return implLoadDocument( orb, getDocumentFactoryURL( eType ), args ); - } - - /* ================================================================== */ - /* ------------------------------------------------------------------ */ - public XComponent getDocument( ) - { - return m_documentComponent; - } - - /* ------------------------------------------------------------------ */ - public boolean isModified() - { - XModifiable modify = (XModifiable)query( XModifiable.class ); - return modify.isModified(); - } - - /* ------------------------------------------------------------------ */ - public Object query( Class aInterfaceClass ) - { - return UnoRuntime.queryInterface( aInterfaceClass, m_documentComponent ); - } - - /* ------------------------------------------------------------------ */ - public XMultiServiceFactory getOrb( ) - { - return m_orb; - } - - /* ------------------------------------------------------------------ */ - /** retrieves the current view of the document - @return - the view component, queried for the interface described by aInterfaceClass - */ - public DocumentViewHelper getCurrentView( ) - { - // get the model interface for the document - XModel xDocModel = (XModel)UnoRuntime.queryInterface(XModel.class, m_documentComponent ); - // get the current controller for the document - as a controller is tied to a view, - // this gives us the currently active view for the document. - XController xController = xDocModel.getCurrentController(); - - if ( classify() == DocumentType.CALC ) - return new SpreadsheetView( m_orb, this, xController ); - - return new DocumentViewHelper( m_orb, this, xController ); - } - - /* ------------------------------------------------------------------ */ - /** reloads the document - * - * The reload is done by dispatching the respective URL at a frame of the document. - * As a consequence, if you have references to a view of the document, or any interface - * of the document, they will become invalid. - * The Model instance itself, at which you called reload, will still be valid, it will - * automatically update its internal state after the reload. - * - * Another consequence is that if the document does not have a view at all, it cannot - * be reloaded. - */ - public void reload() throws Exception - { - DocumentViewHelper view = getCurrentView(); - XFrame frame = view.getController().getFrame(); - XModel oldModel = frame.getController().getModel(); - - getCurrentView().dispatch( ".uno:Reload" ); - - m_documentComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class, - frame.getController().getModel() ); - - XModel newModel = getCurrentView().getController().getModel(); - if ( UnoRuntime.areSame( oldModel, newModel ) ) - throw new java.lang.IllegalStateException( "reload failed" ); - } - - /* ------------------------------------------------------------------ */ - /** creates a new form which is a child of the given form components container - - @param xParentContainer - The parent container for the new form - @param sInitialName - The initial name of the form. May be null, in this case the default (which - is an implementation detail) applies. - */ - protected XIndexContainer createSubForm( XIndexContainer xParentContainer, String sInitialName ) - throws com.sun.star.uno.Exception - { - // create a new form - Object xNewForm = m_orb.createInstance( "com.sun.star.form.component.DataForm" ); - - // insert - xParentContainer.insertByIndex( xParentContainer.getCount(), xNewForm ); - - // set the name if necessary - if ( null != sInitialName ) - { - XPropertySet xFormProps = dbfTools.queryPropertySet( xNewForm ); - xFormProps.setPropertyValue( "Name", sInitialName ); - } - - // outta here - return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xNewForm ); - } - - /* ------------------------------------------------------------------ */ - /** creates a new form which is a child of the given form components container - - @param aParentContainer - The parent container for the new form - @param sInitialName - The initial name of the form. May be null, in this case the default (which - is an implementation detail) applies. - */ - public XIndexContainer createSubForm( Object aParentContainer, String sInitialName ) - throws com.sun.star.uno.Exception - { - XIndexContainer xParentContainer = (XIndexContainer)UnoRuntime.queryInterface( - XIndexContainer.class, aParentContainer ); - return createSubForm( xParentContainer, sInitialName ); - } - - /* ------------------------------------------------------------------ */ - /** creates a form which is a sibling of the given form - @param aForm - A sinbling of the to be created form. - - @param sInitialName - The initial name of the form. May be null, in this case the default (which - is an implementation detail) applies. - */ - public XIndexContainer createSiblingForm( Object aForm, String sInitialName ) throws com.sun.star.uno.Exception - { - // get the parent - XIndexContainer xContainer = (XIndexContainer)dbfTools.getParent( - aForm, XIndexContainer.class ); - // append a new form to this parent container - return createSubForm( xContainer, sInitialName ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the document model which a given form component belongs to - */ - static public DocumentHelper getDocumentForComponent( Object aFormComponent, XMultiServiceFactory orb ) - { - XChild xChild = (XChild)UnoRuntime.queryInterface( XChild.class, aFormComponent ); - XModel xModel = null; - while ( ( null != xChild ) && ( null == xModel ) ) - { - XInterface xParent = (XInterface)xChild.getParent(); - xModel = (XModel)UnoRuntime.queryInterface( XModel.class, xParent ); - xChild = (XChild)UnoRuntime.queryInterface( XChild.class, xParent ); - } - - return new DocumentHelper( orb, xModel ); - } - - /* ------------------------------------------------------------------ */ - /** returns a URL which can be used to create a document of a certain type - */ - public static String getDocumentFactoryURL( DocumentType eType ) - { - if ( eType == DocumentType.WRITER ) - return "private:factory/swriter"; - if ( eType == DocumentType.CALC ) - return "private:factory/scalc"; - if ( eType == DocumentType.DRAWING ) - return "private:factory/sdraw"; - if ( eType == DocumentType.XMLFORM ) - return "private:factory/swriter?slot=21053"; - return "private:factory/swriter"; - } - - /* ------------------------------------------------------------------ */ - /** classifies a document - */ - public DocumentType classify( ) - { - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class, m_documentComponent ); - - if ( xSI.supportsService( "com.sun.star.text.TextDocument" ) ) - return DocumentType.WRITER; - else if ( xSI.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) ) - return DocumentType.CALC; - else if ( xSI.supportsService( "com.sun.star.drawing.DrawingDocument" ) ) - return DocumentType.DRAWING; - - return DocumentType.UNKNOWN; - } - - /* ------------------------------------------------------------------ */ - /** retrieves a com.sun.star.drawing.DrawPage of the document, denoted by index - * @param index - * the index of the draw page - * @throws - * com.sun.star.lang.IndexOutOfBoundsException - * com.sun.star.lang.WrappedTargetException - */ - protected XDrawPage getDrawPage( int index ) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException - { - XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, getDocument() ); - XDrawPages xPages = xSuppPages.getDrawPages(); - - return (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the DrawPage of the document - */ - protected XDrawPage getMainDrawPage( ) throws com.sun.star.uno.Exception - { - XDrawPage xReturn; - - // in case of a Writer document, this is rather easy: simply ask the XDrawPageSupplier - XDrawPageSupplier xSuppPage = (XDrawPageSupplier)UnoRuntime.queryInterface( - XDrawPageSupplier.class, getDocument() ); - if ( null != xSuppPage ) - xReturn = xSuppPage.getDrawPage(); - else - { // the model itself is no draw page supplier - okay, it may be a Writer or Calc document - // (or any other multi-page document) - XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, getDocument() ); - XDrawPages xPages = xSuppPages.getDrawPages(); - - xReturn = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) ); - - // Note that this is no really error-proof code: If the document model does not support the - // XDrawPagesSupplier interface, or if the pages collection returned is empty, this will break. - } - - return xReturn; - } - - /* ------------------------------------------------------------------ */ - /** retrieves the root of the hierarchy of form components - */ - protected XNameContainer getFormComponentTreeRoot( ) throws com.sun.star.uno.Exception - { - XFormsSupplier xSuppForms = (XFormsSupplier)UnoRuntime.queryInterface( - XFormsSupplier.class, getMainDrawPage( ) ); - - XNameContainer xFormsCollection = null; - if ( null != xSuppForms ) - { - xFormsCollection = xSuppForms.getForms(); - } - return xFormsCollection; - } - - /* ------------------------------------------------------------------ */ - /** creates a component at the service factory provided by the document - */ - public XInterface createInstance( String serviceSpecifier ) throws com.sun.star.uno.Exception - { - XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class, - m_documentComponent ); - return (XInterface)xORB.createInstance( serviceSpecifier ); - } - - /* ------------------------------------------------------------------ */ - /** creates a component at the service factory provided by the document - */ - public XInterface createInstanceWithArguments( String serviceSpecifier, Object[] arguments ) throws com.sun.star.uno.Exception - { - XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class, - m_documentComponent ); - return (XInterface) xORB.createInstanceWithArguments( serviceSpecifier, arguments ); - } -}; - diff --git a/forms/qa/integration/forms/DocumentType.java b/forms/qa/integration/forms/DocumentType.java deleted file mode 100644 index 88455824a..000000000 --- a/forms/qa/integration/forms/DocumentType.java +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -/** a helper "enumeration class" for classifying a document type -*/ -public class DocumentType extends com.sun.star.uno.Enum -{ - private DocumentType( int value ) - { - super( value ); - } - - public static DocumentType getDefault() - { - return WRITER; - } - - public static final DocumentType WRITER = new DocumentType(0); - public static final DocumentType CALC = new DocumentType(1); - public static final DocumentType DRAWING = new DocumentType(2); - public static final DocumentType XMLFORM = new DocumentType(3); - public static final DocumentType UNKNOWN = new DocumentType(-1); - - public static DocumentType fromInt(int value) - { - switch(value) - { - case 0: return WRITER; - case 1: return CALC; - case 2: return DRAWING; - case 3: return XMLFORM; - default: return UNKNOWN; - } - } -}; - diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java deleted file mode 100644 index 9260d680f..000000000 --- a/forms/qa/integration/forms/DocumentViewHelper.java +++ /dev/null @@ -1,257 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -/**************************************************************************/ - -import com.sun.star.awt.XControl; -import com.sun.star.awt.XControlModel; -import com.sun.star.awt.XWindow; -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexContainer; -import com.sun.star.form.FormComponentType; -import com.sun.star.form.XForm; -import com.sun.star.form.runtime.XFormController; -import com.sun.star.frame.XController; -import com.sun.star.frame.XDispatch; -import com.sun.star.frame.XDispatchProvider; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.URL; -import com.sun.star.util.XURLTransformer; -import com.sun.star.view.XControlAccess; -import com.sun.star.view.XFormLayerAccess; -import org.openoffice.xforms.XMLDocument; - -/**************************************************************************/ -/** provides a small wrapper around a document view -*/ -public class DocumentViewHelper -{ - private XMultiServiceFactory m_orb; - private XController m_controller; - private DocumentHelper m_document; - - /* ------------------------------------------------------------------ */ - final protected XController getController() - { - return m_controller; - } - - /* ------------------------------------------------------------------ */ - final protected DocumentHelper getDocument() - { - return m_document; - } - - /* ------------------------------------------------------------------ */ - public DocumentViewHelper( XMultiServiceFactory orb, DocumentHelper document, XController controller ) - { - m_orb = orb; - m_document = document; - m_controller = controller; - } - - /* ------------------------------------------------------------------ */ - /** Quick access to a given interface of the view - @param aInterfaceClass - the class of the interface which shall be returned - */ - public Object query( Class aInterfaceClass ) - { - return UnoRuntime.queryInterface( aInterfaceClass, m_controller ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves a dispatcher for the given URL, obtained at the current view of the document - @param aURL - a one-element array. The first element must contain a valid - URL::Complete value. Upon return, the URL is correctly - parsed. - @return - the dispatcher for the URL in question - */ - public XDispatch getDispatcher( URL[] aURL ) throws java.lang.Exception - { - XDispatch xReturn = null; - - // go get the current view - XController xController = (XController)query( XController.class ); - // go get the dispatch provider of it's frame - XDispatchProvider xProvider = (XDispatchProvider)UnoRuntime.queryInterface( - XDispatchProvider.class, xController.getFrame() ); - if ( null != xProvider ) - { - // need an URLTransformer - XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface( - XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) ); - xTransformer.parseStrict( aURL ); - - xReturn = xProvider.queryDispatch( aURL[0], new String( ), 0 ); - } - return xReturn; - } - - /* ------------------------------------------------------------------ */ - /** retrieves a dispatcher for the given URL, obtained at the current view of the document - */ - public XDispatch getDispatcher( String url ) throws java.lang.Exception - { - URL[] aURL = new URL[] { new URL() }; - aURL[0].Complete = url; - return getDispatcher( aURL ); - } - - /* ------------------------------------------------------------------ */ - /** dispatches the given URL into the view, if there's a dispatcher for it - - @return - if the URL was successfully dispatched - */ - public boolean dispatch( String url ) throws java.lang.Exception - { - URL[] completeURL = new URL[] { new URL() }; - completeURL[0].Complete = url; - XDispatch dispatcher = getDispatcher( completeURL ); - if ( dispatcher == null ) - return false; - - PropertyValue[] aDummyArgs = new PropertyValue[] { }; - dispatcher.dispatch( completeURL[0], aDummyArgs ); - return true; - } - - /* ------------------------------------------------------------------ */ - /** retrieves a control within the current view of a document - @param xModel - specifies the control model whose control should be located - @return - the control tied to the model - */ - public XControl getControl( XControlModel xModel ) throws com.sun.star.uno.Exception - { - // the current view of the document - XControlAccess xCtrlAcc = (XControlAccess)query( XControlAccess.class ); - // delegate the task of looking for the control - return xCtrlAcc.getControl( xModel ); - } - - /* ------------------------------------------------------------------ */ - public XControl getControl( Object aModel ) throws com.sun.star.uno.Exception - { - XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel ); - return getControl( xModel ); - } - - /* ------------------------------------------------------------------ */ - public Object getControl( Object aModel, Class aInterfaceClass ) throws com.sun.star.uno.Exception - { - XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel ); - return UnoRuntime.queryInterface( aInterfaceClass, getControl( xModel ) ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the form controller for a given logical form - */ - public XFormController getFormController( XForm _form ) - { - XFormLayerAccess formLayerAccess = (XFormLayerAccess)query( XFormLayerAccess.class ); - return formLayerAccess.getFormController( _form ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the form controller for a given logical form - */ - public XFormController getFormController( Object _form ) - { - return getFormController( UnoRuntime.queryInterface( XForm.class, _form )); - } - - /* ------------------------------------------------------------------ */ - /** toggles the design mode of the form layer of active view of our sample document - */ - protected void toggleFormDesignMode( ) throws java.lang.Exception - { - if ( m_document instanceof XMLDocument ) - dispatch( ".uno:SwitchXFormsDesignMode" ); - else - dispatch( ".uno:SwitchControlDesignMode" ); - } - - /* ------------------------------------------------------------------ */ - /** sets the focus to a specific control - @param xModel - a control model. The focus is set to that control which is part of our view - and associated with the given model. - */ - public void grabControlFocus( Object xModel ) throws com.sun.star.uno.Exception - { - // look for the control from the current view which belongs to the model - XControl xControl = getControl( xModel ); - - // the focus can be set to an XWindow only - XWindow xControlWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class, - xControl ); - - // grab the focus - xControlWindow.setFocus(); - } - - /* ------------------------------------------------------------------ */ - /** sets the focus to the first control - */ - protected void grabControlFocus( ) throws java.lang.Exception - { - // the forms container of our document - XIndexContainer xForms = dbfTools.queryIndexContainer( m_document.getFormComponentTreeRoot( ) ); - // the first form - XIndexContainer xForm = dbfTools.queryIndexContainer( xForms.getByIndex( 0 ) ); - - // the first control model which is no FixedText (FixedText's can't have the focus) - for ( int i = 0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.form.XFormsSupplier; -import com.sun.star.container.XNameAccess; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XChild; -import com.sun.star.container.XNamed; -import com.sun.star.drawing.XDrawPage; -import com.sun.star.lang.XServiceInfo; - -public class FormComponent -{ - private Object m_component; - private XNameAccess m_nameAccess; - private XIndexAccess m_indexAccess; - private XChild m_child; - private XNamed m_named; - - /* ------------------------------------------------------------------ */ - private FormComponent() - { - m_component = null; - m_nameAccess = null; - m_indexAccess = null; - m_child = null; - m_named = null; - } - - /* ------------------------------------------------------------------ */ - public FormComponent( XDrawPage drawPage ) - { - XFormsSupplier supp = (XFormsSupplier)UnoRuntime.queryInterface( - XFormsSupplier.class, drawPage ); - m_component = supp.getForms(); - - m_nameAccess = (XNameAccess)m_component; - m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface( - XIndexAccess.class, m_component ); - m_child = (XChild)UnoRuntime.queryInterface( - XChild.class, m_component ); - m_named = (XNamed)UnoRuntime.queryInterface( - XNamed.class, m_component ); - } - - /* ------------------------------------------------------------------ */ - public FormComponent( Object element ) - { - m_component = element; - m_nameAccess = (XNameAccess)UnoRuntime.queryInterface( - XNameAccess.class, m_component ); - m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface( - XIndexAccess.class, m_component ); - m_child = (XChild)UnoRuntime.queryInterface( - XChild.class, m_component ); - m_named = (XNamed)UnoRuntime.queryInterface( - XNamed.class, m_component ); - } - - /* ------------------------------------------------------------------ */ - /** Quick access to a given interface of the view - @param aInterfaceClass - the class of the interface which shall be returned - */ - public Object query( Class aInterfaceClass ) - { - return UnoRuntime.queryInterface( aInterfaceClass, m_component ); - } - - /* ------------------------------------------------------------------ */ - public FormComponent getByName( String name ) - { - try - { - if ( m_nameAccess != null ) - return new FormComponent( m_nameAccess.getByName( name ) ); - } - catch( com.sun.star.uno.Exception e ) - { - System.err.println( e ); - e.printStackTrace( System.err ); - } - return new FormComponent(); - } - - /* ------------------------------------------------------------------ */ - public String[] getElementNames() - { - if ( m_nameAccess != null ) - return m_nameAccess.getElementNames(); - return new String[]{}; - } - - /* ------------------------------------------------------------------ */ - public boolean hasByName( String name ) - { - if ( m_nameAccess != null ) - return m_nameAccess.hasByName( name ); - return false; - } - - /* ------------------------------------------------------------------ */ - public int getCount() - { - if ( m_indexAccess != null ) - return m_indexAccess.getCount(); - return 0; - } - - /* ------------------------------------------------------------------ */ - public FormComponent getByIndex( int index ) - { - try - { - if ( m_indexAccess != null ) - return new FormComponent( m_indexAccess.getByIndex( index ) ); - } - catch( com.sun.star.uno.Exception e ) - { - System.err.println( e ); - e.printStackTrace( System.err ); - } - return new FormComponent(); - } - - /* ------------------------------------------------------------------ */ - public com.sun.star.uno.Type getElementType( ) - { - if ( m_indexAccess != null ) - return m_indexAccess.getElementType(); - else if ( m_nameAccess != null ) - return m_nameAccess.getElementType(); - return new com.sun.star.uno.Type( String.class ); - } - - /* ------------------------------------------------------------------ */ - public boolean hasElements() - { - if ( m_indexAccess != null ) - return m_indexAccess.hasElements(); - else if ( m_nameAccess != null ) - return m_nameAccess.hasElements(); - return false; - } - - /* ------------------------------------------------------------------ */ - public FormComponent getParent() - { - if ( m_child != null ) - return new FormComponent( m_child.getParent() ); - return new FormComponent(); - } - - /* ------------------------------------------------------------------ */ - public String getName() - { - if ( m_named != null ) - return m_named.getName(); - return ""; - } - - /* ------------------------------------------------------------------ */ - public String getImplementationName() - { - XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class, m_component ); - if ( si != null ) - return si.getImplementationName(); - return ""; - } -} diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java deleted file mode 100644 index 58af65194..000000000 --- a/forms/qa/integration/forms/FormControlTest.java +++ /dev/null @@ -1,952 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.awt.XImageProducer; -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XNameAccess; -import com.sun.star.form.runtime.XFormController; -import com.sun.star.form.XImageProducerSupplier; -import com.sun.star.frame.XDispatch; -import com.sun.star.lang.EventObject; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.sdb.CommandType; -import com.sun.star.sdb.SQLErrorEvent; -import com.sun.star.sdb.XSQLErrorBroadcaster; -import com.sun.star.sdb.XSQLErrorListener; -import com.sun.star.sdbc.XConnection; -import com.sun.star.sdbc.XDataSource; -import com.sun.star.sdbc.XResultSet; -import com.sun.star.sdbc.XResultSetUpdate; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XNamingService; -import com.sun.star.util.URL; -import com.sun.star.util.XCloseable; -import com.sun.star.util.XURLTransformer; -import connectivity.tools.HsqlDatabase; -import connectivity.tools.sdb.Connection; -import java.io.FileOutputStream; - - -public class FormControlTest extends complexlib.ComplexTestCase implements XSQLErrorListener -{ - private static String s_tableName = "CTC_form_controls"; - - private HsqlDatabase m_databaseDocument; - private XDataSource m_dataSource; - private XPropertySet m_dataSourceProps; - private XMultiServiceFactory m_orb; - private DocumentHelper m_document; - private FormLayer m_formLayer; - private XPropertySet m_masterForm; - private XFormController m_masterFormController; - private String m_sImageURL; - private SQLErrorEvent m_mostRecentErrorEvent; - - private final String m_dataSourceName = "integration.forms.FormControlTest"; - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkFirstRow", - "checkInsertRow", - "checkImageControl", - "checkCrossUpdates_checkBox", - "checkCrossUpdates_radioButton", - "checkRowUpdates", - "checkEmptyIsNull" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Database Form Controls Test"; - } - - /* ------------------------------------------------------------------ */ - /// pre-test initialization - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - // ensure that we have a data source to work with, and the required tables - if ( !ensureDataSource() || !ensureTables() ) - { - failed( "could not access the required data source or table therein." ); - return; - } - - // create the document which we work on - createSampleDocument(); - - createImageFile(); - } - - /* ------------------------------------------------------------------ */ - public void checkFirstRow() throws com.sun.star.uno.Exception, java.lang.Exception - { - moveToFirst(); - - // and check the content of the various controls - if ( !checkRadios( (short)1, (short)0, (short)0 ) - || !checkDoubleValue( 1, "ID", "Value" ) - || !checkDoubleValue( 42, "f_integer", "EffectiveValue" ) - || !checkStringValue( "the answer", "f_text", "Text" ) - || !checkDoubleValue( 0.12, "f_decimal", "Value" ) - || !checkIntValue ( 20030922, "f_date", "Date" ) - || !checkIntValue ( 15000000, "f_time", "Time" ) - || !checkIntValue ( 20030923, "f_timestamp_date", "Date" ) - || !checkIntValue ( 17152300, "f_timestamp_time", "Time" ) - || !checkShortValue ( (short)1, "f_tinyint", "State" ) - ) - { - failed( "checking the content of one or more controls on the first row failed (see the log for details)" ); - return; - } - } - - /* ------------------------------------------------------------------ */ - public void checkInsertRow() throws com.sun.star.uno.Exception, java.lang.Exception - { - // move the cursor to the insert row - moveToInsertRow(); - - // and check the content of the various controls - if ( !verifyCleanInsertRow() ) - { - failed( "checking the content of one or more controls on the insert row failed (see the log for details)" ); - return; - } - } - - /* ------------------------------------------------------------------ */ - /// some tests with the image control - public void checkImageControl() throws com.sun.star.uno.Exception, java.lang.Exception - { - // since we did not yet insert any image, the control should not display one ... - moveToFirst(); - if ( !verifyReferenceImage( new byte[0] ) ) - { - failed( "image control failed to display empty image" ); - return; - } - - // check if the image control is able to insert our sample image into the database - // insert an - XPropertySet xImageModel = getControlModel( "f_blob" ); - xImageModel.setPropertyValue( "ImageURL", m_sImageURL ); - - if ( !verifyReferenceImage( getSamplePictureBytes() ) ) - { - failed( "image control does not display the sample image as required" ); - return; - } - - // save the record - saveRecordByUI(); - - // still needs to be the sample image - if ( !verifyReferenceImage( getSamplePictureBytes() ) ) - { - failed( "image control does not, after saving the record, display the sample image as required" ); - return; - } - - // on the next record, the image should be empty - moveToNext(); - if ( !verifyReferenceImage( new byte[0] ) ) - { - failed( "image control failed to display empty image, after coming from a non-empty image" ); - return; - } - - // back to the record where we just inserted the image, it should be our sample image - moveToFirst(); - if ( !verifyReferenceImage( getSamplePictureBytes() ) ) - { - failed( "image control does not, after coming back to the record, display the sample image as required" ); - return; - } - - // okay, now remove the image - xImageModel.setPropertyValue( "ImageURL", new String() ); - if ( !verifyReferenceImage( new byte[0] ) ) - { - failed( "image control failed to remove the image" ); - return; - } - nextRecordByUI(); - previousRecordByUI(); - if ( !verifyReferenceImage( new byte[0] ) ) - { - failed( "image still there after coming back, though we just removed it" ); - return; - } - } - - /* ------------------------------------------------------------------ */ - /** This is both a test for controls which are bound to the same column (they must reflect - * each others updates), and for the immediate updates which need to happen for both check - * boxes and radio buttons: They must commit their content to the underlying column as soon - * as the change is made, *not* only upon explicit commit - */ - public void checkCrossUpdates_checkBox() throws com.sun.star.uno.Exception, java.lang.Exception - { - // move to the first record - moveToFirst(); - if ( !checkShortValue ( (short)1, "f_tinyint", "State" ) - || !checkDoubleValue( 1, "f_tinyint_format", "EffectiveValue" ) - ) - { - failed( "huh? inconsistence in the test!" ); - // we created the sample data in a way that the f_tinyint field should contain a "1" at the first - // record. We already asserted the proper function of the check box in checkFirstRow, so if this - // fails here, the script became inconsistent - return; - } - - XPropertySet checkModel = getControlModel( "f_tinyint" ); - checkModel.setPropertyValue( "State", new Short( (short)0 ) ); - - // setting the state of the check box needs to be reflected in the formatted field immediately - if ( !checkDoubleValue( 0, "f_tinyint_format", "EffectiveValue" ) ) - { - failed( "cross-update failed: updating the check box should result in updating the same-bound formatted field (1)!" ); - return; - } - - // same for the "indetermined" state of the check box - checkModel.setPropertyValue( "State", new Short( (short)2 ) ); - if ( !checkNullValue( "f_tinyint_format", "EffectiveValue" ) ) - { - failed( "cross-update failed: updating the check box should result in updating the same-bound formatted field (2)!" ); - return; - } - - // undo the changes done so far - undoRecordByUI(); - // and see if this is properly reflected in the controls - if ( !checkShortValue ( (short)1, "f_tinyint", "State" ) - || !checkDoubleValue( 1, "f_tinyint_format", "EffectiveValue" ) - ) - { - failed( "either the check box or the formatted field failed to recognize the UNDO!" ); - return; - } - - // the other way round - when changing the formatted field - the change should *not* - // be reflected to the check box, since the formatted field needs an explicit commit - XPropertySet tinyFormattedModel = getControlModel( "f_tinyint_format" ); - m_document.getCurrentView().grabControlFocus( tinyFormattedModel ); - m_formLayer.userTextInput( tinyFormattedModel, "0" ); - if ( !checkShortValue ( (short)1, "f_tinyint", "State" ) - ) - { - failed( "the check box should not be updated here! (did the formatted model commit immediately?)" ); - return; - } - - // set the focus to *any* other control (since we just have it at hand, we use the check box control) - // this should result in the formatted control being committed, and thus in the check box updating - m_document.getCurrentView().grabControlFocus( checkModel ); - if ( !checkShortValue ( (short)0, "f_tinyint", "State" ) - ) - { - failed( "formatted field did not commit (or check box did not update)" ); - return; - } - - // undo the changes done so far, so we leave the document in a clean state for the next test - undoRecordByUI(); - } - - /* ------------------------------------------------------------------ */ - /** very similar to checkCrossUpdates_checkBox - does nearly the same for the radio buttons. See there for more - * explanations. - */ - public void checkCrossUpdates_radioButton() throws com.sun.star.uno.Exception, java.lang.Exception - { - // move to the first record - moveToFirst(); - if ( !checkRadios( (short)1, (short)0, (short)0 ) - || !checkStringValue( "none", "f_text_enum_text", "Text" ) - ) - { - failed( "huh? inconsistence in the test!" ); - return; - } - - XPropertySet radioModel = getRadioModel( "radio_group", "normal" ); - radioModel.setPropertyValue( "State", new Short( (short)1 ) ); - - // setting the state of the radio button needs to be reflected in the formatted field immediately - if ( !checkStringValue( "normal", "f_text_enum_text", "Text" ) ) - { - failed( "cross-update failed: updating the radio button should result in updating the same-bound text field (1)!" ); - return; - } - - // same for the "indetermined" state of the check box - getRadioModel( "radio_group", "important" ).setPropertyValue( "State", new Short( (short)1 ) ); - if ( !checkStringValue( "important", "f_text_enum_text", "Text" ) ) - { - failed( "cross-update failed: updating the radio button should result in updating the same-bound text field (2)!" ); - return; - } - - // undo the changes done so far - undoRecordByUI(); - // and see if this is properly reflected in the controls - if ( !checkRadios( (short)1, (short)0, (short)0 ) - || !checkStringValue( "none", "f_text_enum_text", "Text" ) - ) - { - failed( "either the radio button or the text field failed to recognize the UNDO!" ); - return; - } - - // the other way round - when changing the formatted field - the change should *not* - // be reflected to the check box, since the formatted field needs an explicit commit - XPropertySet textModel = getControlModel( "f_text_enum_text" ); - m_document.getCurrentView().grabControlFocus( textModel ); - m_formLayer.userTextInput( textModel, "normal" ); - if ( !checkRadios( (short)1, (short)0, (short)0 ) - ) - { - failed( "the radio buttons should not be updated here! (did the formatted model commit immediately?)" ); - return; - } - - // set the focus to *any* other control (since we just have it at hand, we use the check box control) - // this should result in the formatted control being committed, and thus in the check box updating - m_document.getCurrentView().grabControlFocus( radioModel ); - if ( !checkRadios( (short)0, (short)1, (short)0 ) - ) - { - failed( "text field did not commit (or radio button did not update)" ); - return; - } - - // undo the changes done so far, so we leave the document in a clean state for the next test - undoRecordByUI(); - } - - /* ------------------------------------------------------------------ */ - /** some tests with updating the table via our controls - */ - public void checkRowUpdates() throws com.sun.star.uno.Exception, java.lang.Exception - { - // start with inserting a new record - moveToInsertRow(); - assure( "insert row not in expected clean state", verifyCleanInsertRow() ); - - userTextInput( "ID", "3", true ); - userTextInput( "f_integer", "729", true ); - userTextInput( "f_text", "test", true ); - userTextInput( "f_decimal", "152343", true ); - userTextInput( "f_date", "31.12.1999", true ); - userTextInput( "f_time", "23:59:59", true ); - - // move to the next row, this should automatically commit the changes we made - nextRecordByUI(); - // and back to the row we just inserted - previousRecordByUI(); - - if ( !checkDoubleValue( 3, "ID", "Value" ) - || !checkDoubleValue( 729, "f_integer", "EffectiveValue" ) - || !checkStringValue( "test", "f_text", "Text" ) - || !checkDoubleValue( 152343, "f_decimal", "Value" ) - || !checkIntValue ( 19991231, "f_date", "Date" ) - || !checkIntValue ( 23595900, "f_time", "Time" ) - ) - { - failed( "the changes we made on the insert row have not been committed" ); - return; - } - - // now change the data, to see if regular updates work, too - userTextInput( "ID", "4", true ); - userTextInput( "f_integer", "618", true ); - userTextInput( "f_text", "yet another stupid, meaningless text", true ); - userTextInput( "f_required_text", "this must not be NULL", true ); - userTextInput( "f_decimal", "4562", true ); - userTextInput( "f_date", "26.03.2004", true ); - userTextInput( "f_time", "17:05:00", true ); - - // move to the next row, this should automatically commit the changes we made - nextRecordByUI(); - // and back to the row we just inserted - previousRecordByUI(); - - if ( !checkDoubleValue( 4, "ID", "Value" ) - || !checkDoubleValue( 618, "f_integer", "EffectiveValue" ) - || !checkStringValue( "yet another stupid, meaningless text", "f_text", "Text" ) - || !checkDoubleValue( 4562, "f_decimal", "Value" ) - || !checkIntValue ( 20040326, "f_date", "Date" ) - || !checkIntValue ( 17050000, "f_time", "Time" ) - ) - { - failed( "the changes we made on the insert row have not been committed" ); - return; - } - - m_document.getCurrentView().grabControlFocus( getControlModel( "ID" ) ); - } - - /* ------------------------------------------------------------------ */ - /** checks the "ConvertEmptyToNull" property behavior of an edit control - * - */ - public void checkEmptyIsNull() throws com.sun.star.uno.Exception, java.lang.Exception - { - // start with inserting a new record - moveToInsertRow(); - assure( "insert row not in expected clean state", verifyCleanInsertRow() ); - - // make an input in any field, but leave the edit control which is bound to a required field - // empty - userTextInput( "ID", "5", true ); - userTextInput( "f_text", "more text", true ); - - // this should *not* fail. Even if we did not input anything into the control bound to the - // f_required_text column, this control's reset (done when moving to the insertion row) is - // expected to write an empty string into its bound column, since its EmptyIsNULL property - // is set to FALSE - // (#i92471#) - m_mostRecentErrorEvent = null; - nextRecordByUI(); - assure( "updating an incomplete record did not work as expected", m_mostRecentErrorEvent == null ); - } - - /* ------------------------------------------------------------------ */ - private boolean verifyCleanInsertRow( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - // and check the content of the various controls - return ( checkRadios( (short)0, (short)0, (short)0 ) - && checkShortValue( (short)2, "f_tinyint", "State" ) - && checkStringValue( "", "f_text", "Text" ) - && checkNullValue( "ID", "Value" ) - && checkNullValue( "f_integer", "EffectiveValue" ) - && checkNullValue( "f_decimal", "Value" ) - ); - } - - /* ------------------------------------------------------------------ */ - /// post-test cleanup - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } - } - - //========================================================================= - /* ------------------------------------------------------------------ */ - private boolean ensureDataSource() throws Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - - XNameAccess databaseContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, - m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) ); - XNamingService namingService = (XNamingService)UnoRuntime.queryInterface( XNamingService.class, - databaseContext ); - - // revoke the data source, if it previously existed - if ( databaseContext.hasByName( m_dataSourceName ) ) - namingService.revokeObject( m_dataSourceName ); - - // // create a new ODB file, and register it with its URL - m_databaseDocument = new HsqlDatabase( m_orb ); - String documentURL = m_databaseDocument.getDocumentURL(); - namingService.registerObject( m_dataSourceName, databaseContext.getByName( documentURL ) ); - - m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class, - databaseContext.getByName( m_dataSourceName ) ); - m_dataSourceProps = dbfTools.queryPropertySet( m_dataSource ); - - XPropertySet dataSourceSettings = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, - m_dataSourceProps.getPropertyValue( "Settings" ) ); - dataSourceSettings.setPropertyValue( "FormsCheckRequiredFields", new Boolean( false ) ); - - return m_dataSource != null; - } - - /* ------------------------------------------------------------------ */ - /** retrives the control model with the given name - */ - private XPropertySet getControlModel( String name ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XNameAccess nameAccess = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, - m_masterForm ); - return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, - nameAccess.getByName( name ) ); - } - - /* ------------------------------------------------------------------ */ - private void createSampleDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - - m_document = DocumentHelper.blankTextDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); - - // insert some controls - XPropertySet xIDField = m_formLayer.insertControlLine( "DatabaseNumericField", "ID", "", 3 ); - m_formLayer.insertControlLine( "DatabaseFormattedField","f_integer", "", 11 ); - m_formLayer.insertControlLine( "DatabaseTextField", "f_text", "", 19 ); - XPropertySet xReqField = m_formLayer.insertControlLine( "DatabaseTextField", "f_required_text", "", 27 ); - m_formLayer.insertControlLine( "DatabaseNumericField", "f_decimal", "", 35 ); - m_formLayer.insertControlLine( "DatabaseDateField", "f_date", "", 43 ); - XPropertySet xTimeField = m_formLayer.insertControlLine( "DatabaseTimeField", "f_time", "", 51 ); - m_formLayer.insertControlLine( "DatabaseDateField", "f_timestamp", "_date", 59 ); - m_formLayer.insertControlLine( "DatabaseTimeField", "f_timestamp", "_time", 67 ); - XPropertySet xImageField = m_formLayer.insertControlLine( "DatabaseImageControl", "f_blob", "", 2, 75, 40 ); - m_formLayer.insertControlLine( "DatabaseTextField", "f_text_enum", "_text", 80, 25, 6 ); - XPropertySet xCheckBox = m_formLayer.insertControlLine( "DatabaseCheckBox", "f_tinyint", "", 80, 33, 6 ); - m_formLayer.insertControlLine( "DatabaseFormattedField","f_tinyint", "_format",80, 41, 6 ); - m_formLayer.insertControlLine( "DatabaseTextField", "dummy", "", 150 ); - - xIDField.setPropertyValue( "DecimalAccuracy", new Short( (short)0 ) ); - xImageField.setPropertyValue( "ScaleImage", new Boolean( true) ); - xImageField.setPropertyValue( "Tabstop", new Boolean( true ) ); - xCheckBox.setPropertyValue( "TriState", new Boolean( true ) ); - xCheckBox.setPropertyValue( "DefaultState", new Short( (short)2 ) ); - xTimeField.setPropertyValue( "TimeFormat", new Short( (short)1 ) ); - xTimeField.setPropertyValue( "TimeMax", new Integer( 23595999 ) ); - xReqField.setPropertyValue( "ConvertEmptyToNull", new Boolean( false ) ); - - // the logical form - m_masterForm = (XPropertySet)dbfTools.getParent( xIDField, XPropertySet.class ); - m_masterForm.setPropertyValue( "DataSourceName", m_dataSourceProps.getPropertyValue( "Name" ) ); - m_masterForm.setPropertyValue( "CommandType", new Integer( CommandType.TABLE ) ); - m_masterForm.setPropertyValue( "Command", s_tableName ); - - insertRadio( 3, "none", "none" ); - insertRadio( 10, "normal", "normal" ); - insertRadio( 17, "important", "important" ); - - // switch the forms into data entry mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - - m_masterFormController = m_document.getCurrentView().getFormController( m_masterForm ); - XSQLErrorBroadcaster errorBroadcaster = (XSQLErrorBroadcaster)UnoRuntime.queryInterface( XSQLErrorBroadcaster.class, - m_masterFormController ); - errorBroadcaster.addSQLErrorListener( this ); - - // set the focus to the ID control - m_document.getCurrentView().grabControlFocus( xIDField ); - } - - /* ------------------------------------------------------------------ */ - private void insertRadio( int nYPos, String label, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet xRadio = m_formLayer.createControlAndShape( "DatabaseRadioButton", 106, nYPos, 25, 6 ); - xRadio.setPropertyValue( "Label", label ); - xRadio.setPropertyValue( "RefValue", refValue ); - xRadio.setPropertyValue( "Name", new String( "radio_group" ) ); - xRadio.setPropertyValue( "DataField", new String( "f_text_enum" ) ); - } - - /* ------------------------------------------------------------------ */ - private String getCreateTableStatement( ) - { - String sCreateTableStatement = "CREATE TABLE \"" + s_tableName + "\" ("; - sCreateTableStatement += "\"ID\" INTEGER NOT NULL PRIMARY KEY,"; - sCreateTableStatement += "\"f_integer\" INTEGER default NULL,"; - sCreateTableStatement += "\"f_text\" VARCHAR(50) default NULL,"; - sCreateTableStatement += "\"f_required_text\" VARCHAR(50) NOT NULL,"; - sCreateTableStatement += "\"f_decimal\" DECIMAL(10,2) default NULL,"; - sCreateTableStatement += "\"f_date\" DATE default NULL,"; - sCreateTableStatement += "\"f_time\" TIME default NULL,"; - sCreateTableStatement += "\"f_timestamp\" DATETIME default NULL,"; - sCreateTableStatement += "\"f_blob\" VARBINARY,"; - sCreateTableStatement += "\"f_text_enum\" VARCHAR(50) default NULL,"; - sCreateTableStatement += "\"f_tinyint\" TINYINT default NULL"; - sCreateTableStatement += ");"; - return sCreateTableStatement; - } - - /* ------------------------------------------------------------------ */ - private String[] getSampleDataValueString( ) throws java.lang.Exception - { - String[] aValues = new String[] { - "1,42,'the answer','foo',0.12,'2003-09-22','15:00:00','2003-09-23 17:15:23',NULL,'none',1", - "2,13,'the question','bar',12.43,'2003-09-24','16:18:00','2003-09-24 08:45:12',NULL,'none',0" - }; - return aValues; - } - - /* ------------------------------------------------------------------ */ - private boolean ensureTables() throws com.sun.star.uno.Exception, java.lang.Exception - { - Connection connection = new Connection( m_dataSource.getConnection( "", "" ) ); - assure( "could not connect to the data source", connection != null ); - - // drop the table, if it already exists - if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" ) - || !implExecuteStatement( getCreateTableStatement() ) - ) - { - failed( "could not create the required sample table!" ); - return false; - } - - String sInsertionPrefix = "INSERT INTO \"" + s_tableName + "\" VALUES ("; - String[] aValues = getSampleDataValueString(); - for ( int i=0; i" ); - log.println( " found : " + value.toString() ); - } - else - return true; - - return false; - } - - /* ------------------------------------------------------------------ */ - private boolean checkIntValue( int requiredValue, String fieldName, String propertyName ) throws com.sun.star.uno.Exception, java.lang.Exception - { - try - { - if ( fieldName.equals( "f_time" ) ) - // http://bugs.mysql.com/bug.php?id=5681 - return true; - - int currentValue = ((Integer)getControlModel( fieldName ).getPropertyValue( propertyName )).intValue(); - if ( currentValue != requiredValue ) - { - log.println( "wrong value of the " + fieldName + " field!" ); - log.println( " expected: " + String.valueOf( requiredValue ) ); - log.println( " found : " + String.valueOf( currentValue ) ); - } - else - return true; - } - catch( com.sun.star.uno.Exception e ) - { - log.println( "caught an exception while retrieving property value '" + propertyName + "' of control model '" + fieldName + "'" ); - throw e; - } - - return false; - } - - /* ------------------------------------------------------------------ */ - private boolean checkShortValue( short requiredValue, String fieldName, String propertyName ) throws com.sun.star.uno.Exception, java.lang.Exception - { - try - { - short currentValue = ((Short)getControlModel( fieldName ).getPropertyValue( propertyName )).shortValue(); - if ( currentValue != requiredValue ) - { - log.println( "wrong value of the " + fieldName + " field!" ); - log.println( " expected: " + String.valueOf( requiredValue ) ); - log.println( " found : " + String.valueOf( currentValue ) ); - } - else - return true; - } - catch( com.sun.star.uno.Exception e ) - { - log.println( "caught an exception while retrieving property value '" + propertyName + "' of control model '" + fieldName + "'" ); - throw e; - } - - return false; - } - - /* ------------------------------------------------------------------ */ - private boolean checkDoubleValue( double requiredValue, String fieldName, String propertyName ) throws com.sun.star.uno.Exception, java.lang.Exception - { - double currentValue = ((Double)getControlModel( fieldName ).getPropertyValue( propertyName )).doubleValue(); - if ( currentValue != requiredValue ) - { - log.println( "wrong value of the " + fieldName + " field!" ); - log.println( " expected: " + String.valueOf( requiredValue ) ); - log.println( " found : " + String.valueOf( currentValue ) ); - } - else - return true; - - return false; - } - - /* ------------------------------------------------------------------ */ - private boolean checkStringValue( String requiredValue, String fieldName, String propertyName ) throws com.sun.star.uno.Exception, java.lang.Exception - { - String currentValue = (String)getControlModel( fieldName ).getPropertyValue( propertyName ); - if ( !currentValue.equals( requiredValue ) ) - { - log.println( "wrong value of the " + fieldName + " field!" ); - log.println( " expected: " + requiredValue ); - log.println( " found : " + currentValue ); - } - else - return true; - - return false; - } - - /* ------------------------------------------------------------------ */ - private XPropertySet getRadioModel( String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - return m_formLayer.getRadioModelByRefValue( m_masterForm, name, refValue ); - } - - /* ------------------------------------------------------------------ */ - /** executes the given statement on the given connection - */ - protected boolean implExecuteStatement( String sStatement ) throws java.lang.Exception - { - try - { - m_databaseDocument.executeSQL( sStatement ); - } - catch(com.sun.star.sdbc.SQLException e) - { - System.err.println( e ); - return false; - } - - return true; - } - - /* ------------------------------------------------------------------ */ - /** simulates a user's text input into a control given by model name - */ - private void userTextInput( String modelName, String text, boolean withCommit ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet controlModel = getControlModel( modelName ); - // the form runtime environment (namely the form controller) rely on focus events for recognizing - // control content changes ... - if ( withCommit ) - m_document.getCurrentView().grabControlFocus( controlModel ); - - m_formLayer.userTextInput( controlModel, text ); - - // focus back to a dummy control model so the content of the model we just changed will - // be committed to the underlying database column - if ( withCommit ) - m_document.getCurrentView().grabControlFocus( getControlModel( "dummy" ) ); - } - - /* ------------------------------------------------------------------ */ - private void moveToInsertRow() throws com.sun.star.uno.Exception, java.lang.Exception - { - XResultSetUpdate xResultSet = (XResultSetUpdate)UnoRuntime.queryInterface( XResultSetUpdate.class, m_masterForm ); - xResultSet.moveToInsertRow( ); - } - - /* ------------------------------------------------------------------ */ - private void moveToFirst() throws com.sun.star.uno.Exception, java.lang.Exception - { - XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); - xResultSet.first( ); - } - - /* ------------------------------------------------------------------ */ - private void moveToNext() throws com.sun.star.uno.Exception, java.lang.Exception - { - XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm ); - xResultSet.next( ); - } - - /* ------------------------------------------------------------------ */ - /** simulates pressing a toolbox button with the given URL - */ - private void executeSlot( String slotURL ) throws java.lang.Exception - { - XDispatch xDispatch = m_document.getCurrentView().getDispatcher( slotURL ); - - URL[] url = new URL[] { new URL() }; - url[0].Complete = slotURL; - XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface( - XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) ); - xTransformer.parseStrict( url ); - - PropertyValue[] aArgs = new PropertyValue[0]; - xDispatch.dispatch( url[0], aArgs ); - } - - /* ------------------------------------------------------------------ */ - /** undos the changes on the current record, by simulating pressing of the respective toolbox button - */ - private void undoRecordByUI() throws java.lang.Exception - { - executeSlot( ".uno:RecUndo" ); - } - - /* ------------------------------------------------------------------ */ - /** saves the current record, by simulating pressing of the respective toolbox button - */ - private void saveRecordByUI() throws java.lang.Exception - { - executeSlot( ".uno:RecSave" ); - } - - /* ------------------------------------------------------------------ */ - /** moves to the next record, by simulating pressing of the respective toolbox button - */ - private void nextRecordByUI() throws java.lang.Exception - { - executeSlot( ".uno:NextRecord" ); - } - /* ------------------------------------------------------------------ */ - /** moves to the previous record, by simulating pressing of the respective toolbox button - */ - private void previousRecordByUI() throws java.lang.Exception - { - executeSlot( ".uno:PrevRecord" ); - } - - /* ------------------------------------------------------------------ */ - private void createImageFile() throws java.io.IOException - { - m_sImageURL = util.utils.getOfficeTempDir( m_orb ) + "image.gif"; - - FileOutputStream aFile = new FileOutputStream( m_sImageURL ); - aFile.write( getSamplePicture() ); - aFile.close(); - log.println( "created temporary image file: " + m_sImageURL ); - - // for later setting the url at the imaghe control, we need a real URL, no system path - m_sImageURL = util.utils.getOfficeTemp( m_orb ) + "image.gif"; - } - - /* ------------------------------------------------------------------ */ - private byte[] getSamplePicture() - { - byte[] aBytes = new byte[] { - (byte)0x47, (byte)0x49, (byte)0x46, (byte)0x38, (byte)0x39, (byte)0x61, (byte)0x0A, (byte)0x00, (byte)0x0A, (byte)0x00, (byte)0xB3, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, - (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, (byte)0x00, (byte)0xFF, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF, - (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, - (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x2C, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x0A, (byte)0x00, (byte)0x0A, (byte)0x00, (byte)0x00, (byte)0x04, (byte)0x20, (byte)0x10, (byte)0xC8, (byte)0x49, (byte)0x41, (byte)0xB9, (byte)0xF8, (byte)0xCA, - (byte)0x12, (byte)0xBA, (byte)0x2F, (byte)0x5B, (byte)0x30, (byte)0x8C, (byte)0x43, (byte)0x00, (byte)0x5A, (byte)0x22, (byte)0x41, (byte)0x94, (byte)0x27, (byte)0x37, (byte)0xA8, (byte)0x6C, - (byte)0x48, (byte)0xC6, (byte)0xA8, (byte)0xD7, (byte)0xB5, (byte)0x19, (byte)0x56, (byte)0xED, (byte)0x11, (byte)0x00, (byte)0x3B - }; - - return aBytes; - } - - /* ------------------------------------------------------------------ */ - private byte[] getSamplePictureBytes() - { - byte[] aBytes = new byte[] { - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, - (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, - (byte)0x01, (byte)0x03, (byte)0x03, (byte)0x03, (byte)0x03, (byte)0x01, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x01, (byte)0x03, (byte)0x04, (byte)0x04, (byte)0x03, (byte)0x01, - (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x01, (byte)0x03, (byte)0x04, (byte)0x04, (byte)0x03, (byte)0x01, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x01, (byte)0x03, - (byte)0x03, (byte)0x03, (byte)0x03, (byte)0x01, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x05, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x05, (byte)0x00, - (byte)0x00, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x05, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, - (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 - }; - return aBytes; - } - - /* ------------------------------------------------------------------ */ - private boolean verifyReferenceImage( byte[] referenceBytes ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet xImageModel = getControlModel( "f_blob" ); - - // check if the image control properly says that there currently is no image on the first record - XImageProducerSupplier xSuppProducer = (XImageProducerSupplier)UnoRuntime.queryInterface( XImageProducerSupplier.class, - xImageModel ); - XImageProducer xProducer = xSuppProducer.getImageProducer(); - - ImageComparison compareImages = new ImageComparison( referenceBytes, this ); - synchronized( this ) - { - xProducer.addConsumer( compareImages ); - xProducer.startProduction(); -// wait(); - } - xProducer.removeConsumer( compareImages ); - - return compareImages.imagesEqual( ); - } - - /* ------------------------------------------------------------------ */ - public void errorOccured( SQLErrorEvent _event ) - { - // just remember for the moment - m_mostRecentErrorEvent = _event; - } - - /* ------------------------------------------------------------------ */ - public void disposing( EventObject _event ) - { - // not interested in - } -} diff --git a/forms/qa/integration/forms/FormLayer.java b/forms/qa/integration/forms/FormLayer.java deleted file mode 100644 index 733e813e0..000000000 --- a/forms/qa/integration/forms/FormLayer.java +++ /dev/null @@ -1,372 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleEditableText; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexContainer; -import com.sun.star.container.XIndexAccess; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.drawing.XControlShape; -import com.sun.star.drawing.XShapes; -import com.sun.star.awt.Size; -import com.sun.star.awt.Point; -import com.sun.star.awt.VisualEffect; -import com.sun.star.awt.XControlModel; -import com.sun.star.container.XNameAccess; -import com.sun.star.text.TextContentAnchorType; -import com.sun.star.drawing.XDrawPage; - -public class FormLayer -{ - private DocumentHelper m_document; - private XDrawPage m_page; - - /* ------------------------------------------------------------------ */ - /** Creates a new instance of FormLayer */ - public FormLayer( DocumentHelper _document ) - { - m_document = _document; - } - - /* ------------------------------------------------------------------ */ - /** sets the page which is to be used for subsequent insertions of controls/shapes - */ - void setInsertPage( int page ) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException - { - m_page = m_document.getDrawPage( page ); - } - - /* ------------------------------------------------------------------ */ - /** creates a control in the document - -

          Note that control here is an incorrect terminology. What the method really does is - it creates a control shape, together with a control model, and inserts them into the document model. - This will result in every view to this document creating a control described by the model-shape pair. -

          - - @param sFormComponentService - the service name of the form component to create, e.g. "TextField" - @param nXPos - the abscissa of the position of the newly inserted shape - @param nXPos - the ordinate of the position of the newly inserted shape - @param nWidth - the width of the newly inserted shape - @param nHeight - the height of the newly inserted shape - @param xParentForm - the form to use as parent for the newly create form component. May be null, in this case - a default parent is chosen by the implementation - @return - the property access to the control's model - */ - public XPropertySet createControlAndShape( String sFormComponentService, int nXPos, - int nYPos, int nWidth, int nHeight, Object _parentForm ) throws java.lang.Exception - { - // let the document create a shape - XMultiServiceFactory xDocAsFactory = UnoRuntime.queryInterface( - XMultiServiceFactory.class, m_document.getDocument() ); - XControlShape xShape = UnoRuntime.queryInterface( XControlShape.class, - xDocAsFactory.createInstance( "com.sun.star.drawing.ControlShape" ) ); - - // position and size of the shape - xShape.setSize( new Size( nWidth * 100, nHeight * 100 ) ); - xShape.setPosition( new Point( nXPos * 100, nYPos * 100 ) ); - - // adjust the anchor so that the control is tied to the page - XPropertySet xShapeProps = dbfTools.queryPropertySet( xShape ); - TextContentAnchorType eAnchorType = TextContentAnchorType.AT_PARAGRAPH; - xShapeProps.setPropertyValue( "AnchorType", eAnchorType ); - - // create the form component (the model of a form control) - String sQualifiedComponentName = "com.sun.star.form.component." + sFormComponentService; - XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, - m_document.getOrb().createInstance( sQualifiedComponentName ) ); - - // insert the model into the form component hierarchy, if the caller gave us a location - if ( null != _parentForm ) - { - XIndexContainer parentForm = null; - if ( _parentForm instanceof XIndexContainer ) - parentForm = (XIndexContainer)_parentForm; - else - parentForm = UnoRuntime.queryInterface( XIndexContainer.class, _parentForm ); - parentForm.insertByIndex( parentForm.getCount(), xModel ); - } - - // knitt them - xShape.setControl( xModel ); - - // add the shape to the shapes collection of the document - XDrawPage pageWhereToInsert = ( m_page != null ) ? m_page : m_document.getMainDrawPage(); - - XShapes xDocShapes = UnoRuntime.queryInterface( XShapes.class, pageWhereToInsert ); - xDocShapes.add( xShape ); - - // and outta here with the XPropertySet interface of the model - XPropertySet xModelProps = dbfTools.queryPropertySet( xModel ); - return xModelProps; - } - - /* ------------------------------------------------------------------ */ - /** creates a control in the document - -

          Note that control here is an incorrect terminology. What the method really does is - it creates a control shape, together with a control model, and inserts them into the document model. - This will result in every view to this document creating a control described by the model-shape pair. -

          - - @param sFormComponentService - the service name of the form component to create, e.g. "TextField" - @param nXPos - the abscissa of the position of the newly inserted shape - @param nXPos - the ordinate of the position of the newly inserted shape - @param nWidth - the width of the newly inserted shape - @param nHeight - the height of the newly inserted shape - @return - the property access to the control's model - */ - public XPropertySet createControlAndShape( String sFormComponentService, int nXPos, - int nYPos, int nWidth, int nHeight ) throws java.lang.Exception - { - return createControlAndShape( sFormComponentService, nXPos, nYPos, nWidth, nHeight, null ); - } - - /** creates a pair of controls, namely a label control, and another control labeled by it - * - * @param _formComponentServiceName - * the service name for the control which is not the label control - * @param _label - * the label to be shown in the label control - * @param _xPos - * the horizontal position of the control pair - * @param _yPos - * the vertical position of the control pair - * @param _height - * the height of the control which is not the label control - * @return - * the model of the control which is not the label control - * @throws java.lang.Exception - */ - public XPropertySet createLabeledControl( String _formComponentServiceName, String _label, int _xPos, - int _yPos, int _height ) - throws java.lang.Exception - { - // insert the label control - XPropertySet label = createControlAndShape( "FixedText", _xPos, _yPos, 25, 6 ); - label.setPropertyValue( "Label", _label ); - - // insert the text field control - XPropertySet field = createControlAndShape( _formComponentServiceName, - _xPos + 25, _yPos, 40, _height ); - // knit it to it's label component - field.setPropertyValue( "LabelControl", label ); - - // names - label.setPropertyValue( "Name", _label + "_Label" ); - field.setPropertyValue( "Name", _label ); - - return field; - } - - /* ------------------------------------------------------------------ */ - /** creates a line of controls, consisting of a label and a field for data input. - -

          In opposite to the second form of this method, here the height of the field, - as well as the abscissa of the label, are under the control of the caller.

          - - @param sControlType - specifies the type of the data input control - @param sFieldName - specifies the field name the text field should be bound to - @param sControlNamePostfix - specifies a postfix to append to the logical control names - @param nYPos - specifies the Y position of the line to start at - @param nHeight - the height of the field - @return - the control model of the created data input field - */ - public XPropertySet insertControlLine( String sControlType, String sFieldName, String _controlNamePostfix, - int nXPos, int nYPos, int nHeight ) - throws java.lang.Exception - { - // insert the label control - XPropertySet xLabelModel = createControlAndShape( "FixedText", nXPos, nYPos, 25, 6 ); - xLabelModel.setPropertyValue( "Label", sFieldName ); - - // insert the text field control - XPropertySet xFieldModel = createControlAndShape( sControlType, nXPos + 26, nYPos, 40, nHeight ); - xFieldModel.setPropertyValue( "DataField", sFieldName ); - if ( xFieldModel.getPropertySetInfo().hasPropertyByName( "Border" ) ) - { - xFieldModel.setPropertyValue( "Border", new Short( VisualEffect.FLAT ) ); - if ( xFieldModel.getPropertySetInfo().hasPropertyByName( "BorderColor" ) ) - xFieldModel.setPropertyValue( "BorderColor", new Integer( 0x00C0C0C0 ) ); - } - // knit it to it's label component - xFieldModel.setPropertyValue( "LabelControl", xLabelModel ); - - // some names, so later on we can find them - if ( _controlNamePostfix == null ) - _controlNamePostfix = ""; - xLabelModel.setPropertyValue( "Name", sFieldName + _controlNamePostfix + "_Label" ); - xFieldModel.setPropertyValue( "Name", sFieldName + _controlNamePostfix ); - - return xFieldModel; - } - - /* ------------------------------------------------------------------ */ - /** creates a line of controls, consisting of a label and a field for data input. - - @param sControlType - specifies the type of the data input control - @param sFieldName - specifies the field name the text field should be bound to - @param nYPos - specifies the Y position of the line to start at - @return - the control model of the created data input field - */ - public XPropertySet insertControlLine( String sControlType, String sFieldName, String sControlNamePostfix, int nYPos ) - throws java.lang.Exception - { - return insertControlLine( sControlType, sFieldName, sControlNamePostfix, 10, nYPos, 6 ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the radio button model with the given name and the given ref value - * @param form - * the parent form of the radio button model to find - * @param name - * the name of the radio button - * @param refValue - * the reference value of the radio button - */ - public XPropertySet getRadioModelByRefValue( XPropertySet form, String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XIndexAccess indexAccess = UnoRuntime.queryInterface( XIndexAccess.class, form ); - - for ( int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.beans.PropertyAttribute; -import com.sun.star.beans.PropertyChangeEvent; -import com.sun.star.beans.PropertyExistException; -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.UnknownPropertyException; -import com.sun.star.beans.XPropertyChangeListener; -import com.sun.star.beans.XPropertyContainer; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.XPropertySetInfo; -import com.sun.star.frame.XStorable; -import com.sun.star.lang.EventObject; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.lang.XMultiServiceFactory; - -import com.sun.star.util.XCloseable; - -public class FormPropertyBags extends complexlib.ComplexTestCase implements XPropertyChangeListener -{ - private DocumentHelper m_document; - private FormLayer m_formLayer; - private XMultiServiceFactory m_orb; - - private PropertyChangeEvent m_propertyChangeEvent; - - /** Creates a new instance of FormPropertyBags */ - public FormPropertyBags() - { - m_propertyChangeEvent = new PropertyChangeEvent(); - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkSomething" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Component Property Bag Test"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - m_document = DocumentHelper.blankTextDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); - } - - /* ------------------------------------------------------------------ */ - private void impl_closeDoc() throws com.sun.star.uno.Exception - { - if ( m_document != null ) - { - XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class, m_document.getDocument() ); - closeDoc.close( true ); - } - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - impl_closeDoc(); - } - - /* ------------------------------------------------------------------ */ - public void checkSomething() throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet textFieldModel = m_formLayer.createControlAndShape( "DatabaseTextField", 10, 10, 25, 6 ); - - // check whether adding new properties is successful - XPropertyContainer propContainer = UnoRuntime.queryInterface( - XPropertyContainer.class, textFieldModel ); - assure("XPropertyContainer not supported!", propContainer != null ); - - propContainer.addProperty( "SomeBoundText", PropertyAttribute.BOUND, "InitialBoundText" ); - propContainer.addProperty( "SomeTransientText", PropertyAttribute.TRANSIENT, "InitialTransientProperty" ); - propContainer.addProperty( "SomeReadonlyText", PropertyAttribute.READONLY, "InitialReadonlyText" ); - propContainer.addProperty( "SomeNumericValue", PropertyAttribute.BOUND, new Integer( 42 ) ); - - XPropertySetInfo propertyInfo = textFieldModel.getPropertySetInfo(); - assure( "Per service definition, dynamic properties are expected to be forced to be removeable", - ( propertyInfo.getPropertyByName("SomeBoundText").Attributes & PropertyAttribute.REMOVEABLE ) != 0 ); - - // a second addition of a property with an existent name should be rejected - boolean caughtExpected = false; - try { propContainer.addProperty( "SomeBoundText", PropertyAttribute.BOUND, "InitialBoundText" ); } - catch( PropertyExistException e ) { caughtExpected = true; } - catch( Exception e ) { } - assure( "repeated additions of a property with the same name should be rejected", - caughtExpected ); - - // check whether the properties are bound as expected - impl_checkPropertyValueNotification( textFieldModel ); - - // check property value persistence - impl_checkPropertyPersistence(); - } - - /* ------------------------------------------------------------------ */ - private void impl_checkPropertyValueNotification( XPropertySet _controlModel ) throws com.sun.star.uno.Exception - { - _controlModel.addPropertyChangeListener( "", this ); - - _controlModel.setPropertyValue( "SomeBoundText", "ChangedBoundText" ); - assure( "changes in the bound property are not properly notified", - m_propertyChangeEvent.PropertyName.equals( "SomeBoundText" ) - && m_propertyChangeEvent.OldValue.equals( "InitialBoundText" ) - && m_propertyChangeEvent.NewValue.equals( "ChangedBoundText" ) ); - - m_propertyChangeEvent = null; - _controlModel.setPropertyValue( "SomeTransientText", "ChangedTransientText" ); - assure( "changes in non-bound properties should not be notified", - m_propertyChangeEvent == null ); - - boolean caughtExpected = false; - try { _controlModel.setPropertyValue( "SomeReadonlyText", "ChangedReadonlyText" ); } - catch( PropertyVetoException e ) { caughtExpected = true; } - catch( Exception e ) { } - assure( "trying to write a read-only property did not give the expected result", - caughtExpected ); - - _controlModel.removePropertyChangeListener( "", this ); - } - - /* ------------------------------------------------------------------ */ - private void impl_checkPropertyPersistence() throws com.sun.star.uno.Exception - { - // store the document - XStorable store = UnoRuntime.queryInterface( XStorable.class, m_document.getDocument() ); - String documentURL = util.utils.getOfficeTemp( m_orb ) + "document.odt"; - PropertyValue[] storeArguments = new PropertyValue[] { new PropertyValue() }; - storeArguments[0].Name = "FilterName"; - storeArguments[0].Value = "writer8"; - store.storeAsURL( documentURL, storeArguments ); - - // close and re-load it - impl_closeDoc(); - - m_document = DocumentHelper.loadDocument( m_orb, documentURL ); - m_formLayer = new FormLayer( m_document ); - - XPropertySet textFieldModel = m_formLayer.getControlModel( new int[] { 0, 0 } ); - - // all persistent properties should have the expected values - assure( "persistent properties did not survive reload (1)!", ((String)textFieldModel.getPropertyValue( "SomeBoundText" )).equals( "ChangedBoundText" ) ); - assure( "persistent properties did not survive reload (2)!", ((String)textFieldModel.getPropertyValue( "SomeReadonlyText" )).equals( "InitialReadonlyText" ) ); -// assure( "persistent properties did not survive reload (3)!", ((Integer)textFieldModel.getPropertyValue( "SomeNumericValue" )).equals( new Integer( 42 ) ) ); - // cannot check this until the types really survice - at the moment, integers are converted to doubles ... - - // the transient property should not have survived - boolean caughtExpected = false; - try { textFieldModel.getPropertyValue( "SomeTransientText" ); } - catch( UnknownPropertyException e ) { caughtExpected = true; } - assure( "transient property did survive reload!", caughtExpected ); - - // There would be more things to check. - // For instance, it would be desirable of the property attributes would have survived - // the reload, and the property defaults (XPropertyState). - // However, the file format currently doesn't allow for this, so those information - // is lost when saving the document. - } - - /* ------------------------------------------------------------------ */ - public void propertyChange(PropertyChangeEvent _propertyChangeEvent) - { - m_propertyChangeEvent = _propertyChangeEvent; - } - - /* ------------------------------------------------------------------ */ - public void disposing(EventObject eventObject) - { - // not interested in - } -} diff --git a/forms/qa/integration/forms/ImageComparison.java b/forms/qa/integration/forms/ImageComparison.java deleted file mode 100644 index 859d1b1bb..000000000 --- a/forms/qa/integration/forms/ImageComparison.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ImageComparison.java - * - * Created on 23. September 2003, 17:40 - */ - -package integration.forms; - -/** - * - * @author fs93730 - */ -public final class ImageComparison implements com.sun.star.awt.XImageConsumer -{ - - private byte[] m_referenceBytes; - private int m_referencePosition; - private java.io.FileOutputStream m_stream; - private Object m_notifyDone; - - public boolean imagesEqual( ) - { - return m_referencePosition == m_referenceBytes.length; - } - - /** Creates a new instance of ImageComparison */ - public ImageComparison( byte[] referenceBytes, Object toNotify ) - { - m_referenceBytes = referenceBytes; - m_referencePosition = 0; - m_notifyDone = toNotify; - } - - public void complete(int param, com.sun.star.awt.XImageProducer xImageProducer) - { - synchronized( m_notifyDone ) - { - m_notifyDone.notify(); - } - } - - public void init(int param, int param1) - { - } - - public void setColorModel(short param, int[] values, int param2, int param3, int param4, int param5) - { - } - - public void setPixelsByBytes(int param, int param1, int param2, int param3, byte[] values, int param5, int param6) - { - if ( m_referencePosition == -1 ) - // already failed - return; - - int i = 0; - while ( ( m_referencePosition < m_referenceBytes.length ) && ( i < values.length ) ) - { - if ( m_referenceBytes[ m_referencePosition ] != values[ i ] ) - { - m_referencePosition = -1; - break; - } - ++i; - ++m_referencePosition; - } - } - - public void setPixelsByLongs(int param, int param1, int param2, int param3, int[] values, int param5, int param6) - { - } - -} diff --git a/forms/qa/integration/forms/ListBox.java b/forms/qa/integration/forms/ListBox.java deleted file mode 100644 index 11af26820..000000000 --- a/forms/qa/integration/forms/ListBox.java +++ /dev/null @@ -1,290 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.awt.XListBox; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XChild; -import com.sun.star.container.XIndexAccess; -import com.sun.star.container.XNameAccess; -import com.sun.star.form.ListSourceType; -import com.sun.star.form.runtime.FormFeature; -import com.sun.star.form.runtime.XFormController; -import com.sun.star.form.runtime.XFormOperations; -import com.sun.star.sdb.CommandType; -import com.sun.star.sdbc.SQLException; -import com.sun.star.sdbc.XParameters; -import com.sun.star.sdbc.XPreparedStatement; -import com.sun.star.uno.Exception; -import com.sun.star.uno.UnoRuntime; -import connectivity.tools.HsqlColumnDescriptor; -import connectivity.tools.HsqlDatabase; -import connectivity.tools.HsqlTableDescriptor; -import connectivity.tools.sdb.Connection; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -public class ListBox extends TestCase -{ - HsqlDatabase m_database = null; - private final String m_foreignKeyTableName = "foreign_keys"; - - public ListBox() - { - super( DocumentType.WRITER ); - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkForeignKeys" - }; - } - - /* ------------------------------------------------------------------ */ - public void checkForeignKeys() throws com.sun.star.uno.Exception, java.lang.Exception - { - try - { - // create the form document - prepareDocument(); - - final XIndexAccess formsCollection = UnoRuntime.queryInterface( XIndexAccess.class, - m_document.getFormComponentTreeRoot() ); - final XNameAccess form = UnoRuntime.queryInterface( XNameAccess.class, formsCollection.getByIndex(0) ); - - final DocumentViewHelper view = m_document.getCurrentView(); - final XFormController formController = view.getFormController( form ); - final XFormOperations formOperations = formController.getFormOperations(); - - // move through all records, and check that the display values in the list boxes are as expected - final String[][] fieldTypesDefinitions = impl_getFieldTypeDefinitions(); - final String[] fieldTypes = fieldTypesDefinitions[0]; - - final String[] displayValues = impl_getDisplayValues(); - - formOperations.execute( FormFeature.MoveToFirst ); - for ( int row=0; row<2; ++row ) - { - StringBuffer failedFieldTypes = new StringBuffer(); - for ( int i=0; i 0 ) - failedFieldTypes.append( ", " ); - failedFieldTypes.append( fieldTypes[i] ); - } - } - /*assure( "The following field types do not work when used as bound list box fields: " + failedFieldTypes.toString() + - " (row " + row + ")", failedFieldTypes.length() == 0 );*/ - - formOperations.execute( FormFeature.MoveToNext ); - } - - } - finally - { - closeDocument(); - } - } - - /* ------------------------------------------------------------------ */ - public void before() throws Exception, java.lang.Exception - { - super.before(); - impl_createDatabase(); - } - - /* ------------------------------------------------------------------ */ - protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.prepareDocument(); - impl_createForm(); - } - - /* ------------------------------------------------------------------ */ - private String[][] impl_getFieldTypeDefinitions() - { - return new String[][] { - new String[] { - "bigint", "boolean", "date", "decimal", "double", "float", "numeric", "time", "timestamp", "tinyint", "varchar" - }, - new String[] { - null, null, null, "(10,2)", null, null, "(10,2)", null, null, null, "(50)" - } - }; - } - - /* ------------------------------------------------------------------ */ - private String[] impl_getTypedValue( final String _asType, final int _rowNum ) throws SQLException - { - Map< String, String[] > valueMap = new HashMap< String, String[] >(); - valueMap.put( "bigint", new String[] { "1111111111", "222222222" } ); - valueMap.put( "boolean", new String[] { "false", "true" } ); - valueMap.put( "date", new String[] { "2001-01-01", "2002-02-02" } ); - valueMap.put( "decimal", new String[] { "1.11", "2.22" } ); - valueMap.put( "double", new String[] { "1.11", "2.22" } ); - valueMap.put( "float", new String[] { "1.11", "2.22" } ); - valueMap.put( "numeric", new String[] { "1.11", "2.22" } ); - valueMap.put( "time", new String[] { "01:01:01", "02:02:02" } ); - valueMap.put( "timestamp", new String[] { "2001-01-01 01:01:01", "2002-02-02 02:02:02" } ); - valueMap.put( "tinyint", new String[] { "1", "2" } ); - valueMap.put( "varchar", new String[] { "first", "second" } ); - - return valueMap.get( _asType ); - } - - /* ------------------------------------------------------------------ */ - private String[] impl_getDisplayValues() - { - return new String[] { "one", "two" }; - } - - /* ------------------------------------------------------------------ */ - private void impl_createDatabase() throws java.lang.Exception - { - try - { - m_database = new HsqlDatabase( m_orb ); - Connection connection = m_database.defaultConnection(); - System.out.println( m_database.getDocumentURL() ); - - final String[][] fieldDefinitions = impl_getFieldTypeDefinitions(); - final String[] keyTypes = fieldDefinitions[0]; - final String[] keyCreationArgs = fieldDefinitions[1]; - - Vector< HsqlColumnDescriptor > foreignKeyColumns = new Vector< HsqlColumnDescriptor >(); - foreignKeyColumns.add( new HsqlColumnDescriptor( "ID", "integer", HsqlColumnDescriptor.PRIMARY ) ); - - Vector< String[] > foreignKeyValues = new Vector< String[] >(); - - StringBuffer foreignKeyInsertSQL = new StringBuffer(); - foreignKeyInsertSQL.append( "INSERT INTO \"" + m_foreignKeyTableName + "\" VALUES (?" ); - - final String[] displayValues = impl_getDisplayValues(); - - for ( int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.beans.XPropertySet; -import com.sun.star.sheet.XSpreadsheet; -import com.sun.star.sheet.XSpreadsheets; -import com.sun.star.sheet.XSpreadsheetView; -import com.sun.star.container.XNamed; -import com.sun.star.container.XNameContainer; -import com.sun.star.container.XIndexContainer; -import com.sun.star.drawing.XDrawPageSupplier; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XControlModel; -import com.sun.star.awt.XListBox; -import com.sun.star.script.XLibraryContainer; -import com.sun.star.script.XEventAttacherManager; -import com.sun.star.script.ScriptEventDescriptor; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.accessibility.XAccessibleSelection; -import com.sun.star.frame.XStorable; - -public class ListSelection extends integration.forms.TestCase -{ - /** Creates a new instance of ListSelection */ - public ListSelection() - { - super( DocumentType.CALC ); - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkUserListSelection" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Control List Selection Test"; - } - - /* ------------------------------------------------------------------ */ - public void checkUserListSelection() throws com.sun.star.uno.Exception, java.lang.Exception - { - boolean interactiveTest = param.getBool( "Interactive" ); - - if ( interactiveTest ) - { - prepareDocument(); - waitForUserInput(); - closeDocumentByUI(); - } - else - { - int runs = param.getInt( "Runs" ); - if ( runs == 0 ) - runs = 10; - - for ( int i = 0; i < runs; ++i ) - { - log.println( "Round " + ( i + 1 ) + " of " + runs ); - prepareDocument(); - impl_clickListBox(); - synchronized( this ) { this.wait( 1000 ); } - closeDocument(); - } - } - } - - /* ------------------------------------------------------------------ */ - final private void impl_clickListBox() - { - try - { - final int runs = 10; - java.util.Random generator = new java.util.Random(); - for ( int i = 0; i < runs; ++i ) - { - // obtain the active sheet - XSpreadsheetView view = (XSpreadsheetView)m_document.getCurrentView().query( XSpreadsheetView.class ); - XSpreadsheet activeSheet = view.getActiveSheet(); - - // Accessibility access to the list box control in this sheet - XAccessible accessibleListBox = (XAccessible)UnoRuntime.queryInterface( - XAccessible.class, getListBoxControl( activeSheet ) ); - XAccessibleContext context = accessibleListBox.getAccessibleContext(); - - // the first "accessible child" of a list box is its list - XAccessibleSelection accessibleList = (XAccessibleSelection)UnoRuntime.queryInterface( - XAccessibleSelection.class, context.getAccessibleChild( 1 ) ); - - int selectPosition = generator.nextInt( 5 ); - String selectSheetName = getListBoxControl( activeSheet ).getItem( (short)selectPosition ); - accessibleList.selectAccessibleChild( selectPosition ); - try - { - synchronized( this ) - { - this.wait( 500 ); - } - } - catch( java.lang.InterruptedException e ) { } - - XNamed sheetName = (XNamed)UnoRuntime.queryInterface( XNamed.class, view.getActiveSheet() ); - assure( "sheet was not selected as expected!", sheetName.getName().equals( selectSheetName ) ); - } - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.err ); - failed( "caught an exception: " + e.toString() ); - } - } - - /* ------------------------------------------------------------------ */ - final private void impl_setupListenerScript() - { - try - { - XPropertySet docProps = dbfTools.queryPropertySet( m_document.getDocument() ); - XLibraryContainer basicLibs = (XLibraryContainer)UnoRuntime.queryInterface( - XLibraryContainer.class, docProps.getPropertyValue( "BasicLibraries" ) ); - XNameContainer basicLib = basicLibs.createLibrary( "default" ); - - String sListSelectionScript = - "Option Explicit\n" + - "\n" + - "Sub onListBoxSelected( oEvent as Object )\n" + - " Dim oView as Object\n" + - " Dim oSheet as Object\n" + - " Dim oSheets as Object\n" + - "\n" + - " Dim oControlModel as Object\n" + - " Dim sSheet as String\n" + - "\n" + - " if ( oEvent.Selected <> 65535 ) Then\n" + - " oControlModel = oEvent.Source.Model\n" + - " sSheet = oControlModel.StringItemList( oEvent.Selected )\n" + - "\n" + - " oSheets = thisComponent.Sheets\n" + - " oSheet = oSheets.getByName(sSheet)\n" + - "\n" + - " oView = thisComponent.CurrentController\n" + - " oView.setActiveSheet( oSheet )\n" + - " End If\n" + - "End Sub\n" + - "\n" + - "Sub onButtonClicked\n" + - " MsgBox \"clicked\"\n" + - "End Sub\n"; - - basicLib.insertByName( "callbacks", sListSelectionScript ); - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.err ); - failed( "caught an exception: " + e.toString() ); - } - } - - /* ------------------------------------------------------------------ */ - final private void impl_assignStarBasicScript( XPropertySet controlModel, String interfaceName, String interfaceMethod, String scriptCode ) - { - try - { - XIndexContainer parentForm = (XIndexContainer)dbfTools.getParent( controlModel, XIndexContainer.class ); - - XEventAttacherManager manager = (XEventAttacherManager)UnoRuntime.queryInterface( - XEventAttacherManager.class, parentForm ); - - int containerPosition = -1; - for ( int i = 0; i < parentForm.getCount(); ++i ) - { - XPropertySet child = dbfTools.queryPropertySet( parentForm.getByIndex( i ) ); - if ( child.equals( controlModel ) ) - { - containerPosition = i; - break; - } - } - manager.registerScriptEvent( containerPosition, new ScriptEventDescriptor( - interfaceName, - interfaceMethod, - "", - "StarBasic", - scriptCode - ) ); - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.err ); - failed( "caught an exception: " + e.toString() ); - } - } - - /* ------------------------------------------------------------------ */ - protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.prepareDocument(); - impl_setupListenerScript(); - - SpreadsheetDocument document = (SpreadsheetDocument)m_document; - XSpreadsheets sheets = document.getSheets(); - - // delete all sheets except one - String[] sheetNames = sheets.getElementNames(); - for ( short i = 1; i < sheetNames.length; ++i ) - sheets.removeByName( sheetNames[ i ] ); - - // need 5 sheets - String[] newSheetNames = new String[] { "first", "second", "third", "forth", "fifth" }; - - // give the first one the right name - XNamed sheet = (XNamed)UnoRuntime.queryInterface( XNamed.class, - sheets.getByName( sheetNames[ 0 ] ) - ); - sheet.setName( newSheetNames[ 0 ] ); - - // add some dummy buttons - for ( int i = 0; i < 4; ++i ) - { - XPropertySet buttonModel = m_formLayer.createControlAndShape( "CommandButton", 10, 10 + i * 10, 30, 8 ); - impl_assignStarBasicScript( buttonModel, "XActionListener", "actionPerformed", "document:default.callbacks.onButtonClicked" ); - } - - // and a list box - XPropertySet listBox = m_formLayer.createControlAndShape( "ListBox", 50, 10, 40, 6 ); - listBox.setPropertyValue( "Dropdown", new Boolean( true ) ); - listBox.setPropertyValue( "StringItemList", newSheetNames ); - listBox.setPropertyValue( "Name", "ListBox" ); - - impl_assignStarBasicScript( listBox, "XItemListener", "itemStateChanged", "document:default.callbacks.onListBoxSelected" ); - - // clone this sheet - for ( short i = 1; i < newSheetNames.length; ++i ) - sheets.copyByName( newSheetNames[0], newSheetNames[i], i ); - - // switch the thing to alive mode - m_document.getCurrentView().toggleFormDesignMode(); - - try - { - XStorable storable = (XStorable)m_document.query( XStorable.class ); - java.io.File testFile = java.io.File.createTempFile( getTestObjectName(),".ods"); - storable.storeAsURL( testFile.getAbsoluteFile().toURI().toURL().toString(), new com.sun.star.beans.PropertyValue[]{} ); - testFile.deleteOnExit(); - } - catch( java.lang.Throwable e ) - { - e.printStackTrace(); - failed( "caught an exception: " + e.toString() ); - } - } - - /* ------------------------------------------------------------------ */ - protected XControlModel getListBoxModel( XSpreadsheet sheet ) - { - XDrawPageSupplier suppPage = (XDrawPageSupplier)UnoRuntime.queryInterface( - XDrawPageSupplier.class, sheet ); - FormComponent formsRoot = new FormComponent( suppPage.getDrawPage() ); - XControlModel listBoxModel = (XControlModel)formsRoot.getByIndex( 0 ). - getByName( "ListBox" ).query( XControlModel.class ); - return listBoxModel; - } - - /* ------------------------------------------------------------------ */ - protected XListBox getListBoxControl( XSpreadsheet sheet ) throws com.sun.star.uno.Exception - { - return (XListBox)UnoRuntime.queryInterface( - XListBox.class, m_document.getCurrentView().getControl( getListBoxModel( sheet ) ) ); - } - } diff --git a/forms/qa/integration/forms/ListSelection.props b/forms/qa/integration/forms/ListSelection.props deleted file mode 100644 index 4464e3205..000000000 --- a/forms/qa/integration/forms/ListSelection.props +++ /dev/null @@ -1,3 +0,0 @@ -ThreadTimeOut=600000 -Interactive=false -Runs=5 diff --git a/forms/qa/integration/forms/ListSelectionValidator.java b/forms/qa/integration/forms/ListSelectionValidator.java deleted file mode 100644 index 52eb490c8..000000000 --- a/forms/qa/integration/forms/ListSelectionValidator.java +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -public class ListSelectionValidator extends integration.forms.ControlValidator -{ - /** Creates a new instance of ListSelectionValidator */ - public ListSelectionValidator() - { - } - - public String explainInvalid( Object Value ) - { - try - { - short[] selectionIndexes = (short[])Value; - if ( selectionIndexes.length > 2 ) - return "please 2 entries, at most"; - } - catch( java.lang.Exception e ) - { - return "oops. What's this?"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - short[] selectionIndexes = (short[])Value; - if ( selectionIndexes.length > 2 ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - } - return false; - } - -} diff --git a/forms/qa/integration/forms/MasterDetailForms.java b/forms/qa/integration/forms/MasterDetailForms.java deleted file mode 100644 index 90f9f511c..000000000 --- a/forms/qa/integration/forms/MasterDetailForms.java +++ /dev/null @@ -1,435 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.beans.NamedValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XIndexContainer; -import java.lang.reflect.Method; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.container.XNameContainer; -import com.sun.star.embed.XComponentSupplier; -import com.sun.star.form.XGridColumnFactory; -import com.sun.star.form.XGridFieldDataSupplier; -import com.sun.star.form.XLoadable; -import com.sun.star.lang.XComponent; -import com.sun.star.sdb.CommandType; -import com.sun.star.sdb.XFormDocumentsSupplier; -import com.sun.star.sdbc.SQLException; -import com.sun.star.sdbc.XColumnLocate; -import com.sun.star.ucb.Command; -import com.sun.star.ucb.OpenMode; -import com.sun.star.ucb.XCommandProcessor; -import com.sun.star.uno.Type; -import com.sun.star.util.XModifiable; -import connectivity.tools.CRMDatabase; -import connectivity.tools.HsqlColumnDescriptor; -import connectivity.tools.HsqlDatabase; -import connectivity.tools.HsqlTableDescriptor; -import org.openoffice.complex.forms.tools.ResultSet; - - -public class MasterDetailForms extends complexlib.ComplexTestCase implements com.sun.star.form.XLoadListener -{ - private XMultiServiceFactory m_orb; - - private XPropertySet m_masterForm; - private XPropertySet m_detailForm; - private ResultSet m_masterResult; - private ResultSet m_detailResult; - - final private Object m_waitForLoad = new Object(); - private boolean m_loaded = false; - - /** Creates a new instance of MasterDetailForms */ - public MasterDetailForms() - { - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkMultipleKeys", - "checkDetailFormDefaults" - }; - } - - /* ------------------------------------------------------------------ */ - public void before() - { - m_orb = (XMultiServiceFactory)param.getMSF(); - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Control Spreadsheet Cell Binding Test"; - } - - /* ------------------------------------------------------------------ */ - /** creates the table structure needed for the test - */ - private void impl_createTableStructure( final HsqlDatabase _databaseDocument ) throws SQLException - { - HsqlColumnDescriptor[] masterColumns = { - new HsqlColumnDescriptor( "ID1", "INTEGER", HsqlColumnDescriptor.PRIMARY ), - new HsqlColumnDescriptor( "ID2", "INTEGER", HsqlColumnDescriptor.PRIMARY ), - new HsqlColumnDescriptor( "value", "VARCHAR(50)" ), - }; - HsqlColumnDescriptor[] detailColumns = { - new HsqlColumnDescriptor( "ID", "INTEGER", HsqlColumnDescriptor.PRIMARY ), - new HsqlColumnDescriptor( "FK_ID1", "INTEGER", HsqlColumnDescriptor.REQUIRED, "master", "ID1" ), - new HsqlColumnDescriptor( "FK_ID2", "INTEGER", HsqlColumnDescriptor.REQUIRED, "master", "ID2" ), - new HsqlColumnDescriptor( "name", "VARCHAR(50)" ), - }; - _databaseDocument.createTable( new HsqlTableDescriptor( "master", masterColumns ) ); - _databaseDocument.createTable( new HsqlTableDescriptor( "detail", detailColumns ) ); - - _databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 1, 'First Record' )" ); - _databaseDocument.executeSQL( "INSERT INTO \"master\" VALUES ( 1, 2, 'Second Record' )" ); - _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 1, 1, 1, 'record 1.1 (1)')"); - _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 2, 1, 1, 'record 1.1 (2)')"); - _databaseDocument.executeSQL( "INSERT INTO \"detail\" VALUES ( 3, 1, 2, 'record 1.2 (1)')"); - - _databaseDocument.defaultConnection().refreshTables(); - } - - /* ------------------------------------------------------------------ */ - private void impl_createForms( final HsqlDatabase _databaseDocument ) throws com.sun.star.uno.Exception - { - m_masterForm = dbfTools.queryPropertySet( m_orb.createInstance( "com.sun.star.form.component.DataForm" ) ); - m_masterForm.setPropertyValue( "ActiveConnection", _databaseDocument.defaultConnection().getXConnection() ); - m_masterForm.setPropertyValue( "CommandType", new Integer( com.sun.star.sdb.CommandType.TABLE ) ); - m_masterForm.setPropertyValue( "Command", "master" ); - - m_masterResult = new ResultSet( m_masterForm ); - - m_detailForm = dbfTools.queryPropertySet( m_orb.createInstance( "com.sun.star.form.component.DataForm" ) ); - m_detailForm.setPropertyValue( "ActiveConnection", _databaseDocument.defaultConnection().getXConnection() ); - m_detailForm.setPropertyValue( "CommandType", new Integer( com.sun.star.sdb.CommandType.TABLE ) ); - m_detailForm.setPropertyValue( "Command", "detail" ); - - m_detailResult = new ResultSet( m_detailForm ); - - XNameContainer masterContainer = UnoRuntime.queryInterface( XNameContainer.class, m_masterForm ); - masterContainer.insertByName( "slave", m_detailForm ); - } - - /* ------------------------------------------------------------------ */ - /** checks if master-detail relationships including multiple keys work - */ - public void checkMultipleKeys() throws com.sun.star.uno.Exception, java.lang.Exception - { - HsqlDatabase databaseDocument = null; - try - { - databaseDocument = new HsqlDatabase( m_orb ); - impl_createTableStructure( databaseDocument ); - impl_createForms( databaseDocument ); - - m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID1", "ID2" } ); - m_detailForm.setPropertyValue( "DetailFields", new String[] { "FK_ID1", "FK_ID2" } ); - - XLoadable loadMaster = UnoRuntime.queryInterface( XLoadable.class, m_masterForm ); - XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm ); - loadDetail.addLoadListener( this ); - - // wait until the detail form is loaded - operateMasterAndWaitForDetailForm( loadMaster.getClass().getMethod( "load", new Class[] {} ), loadMaster, new Object[] { } ); - - // okay, now the master form should be on the first record - assure( "wrong form state after loading (ID1)", m_masterResult.getInt(1) == 1 ); - assure( "wrong form state after loading (ID2)", m_masterResult.getInt(2) == 1 ); - assure( "wrong form state after loading (value)", m_masterResult.getString(3).equals( "First Record" ) ); - - // the "XResultSet.next" method - Method methodNext = m_masterResult.getClass().getMethod( "next" , new Class[] {} ); - - // the values in the linked fields should be identical - int expectedDetailRowCounts[] = { 2, 1 }; - do - { - verifyColumnValueIdentity( "ID1", "FK_ID1" ); - verifyColumnValueIdentity( "ID2", "FK_ID2" ); - - m_detailResult.last(); - int masterPos = m_masterResult.getRow(); - assure( "wrong number of records in detail form, for master form at pos " + masterPos, - ((Integer)m_detailForm.getPropertyValue( "RowCount" )).intValue() == expectedDetailRowCounts[ masterPos - 1 ] ); - - operateMasterAndWaitForDetailForm( methodNext, m_masterResult, new Object[] {} ); - } - while ( !m_masterResult.isAfterLast() ); - assure( "wrong number of records in master form", 2 == ((Integer)m_masterForm.getPropertyValue( "RowCount" )).intValue() ); - } - finally - { - if ( databaseDocument != null ) - databaseDocument.closeAndDelete(); - impl_cleanUpStep(); - } - } - - /* ------------------------------------------------------------------ */ - private final void impl_cleanUpStep() - { - if ( m_masterForm != null ) - dbfTools.disposeComponent( m_masterForm ); - if ( m_detailForm != null ) - dbfTools.disposeComponent( m_detailForm ); - m_masterForm = m_detailForm = null; - } - - /* ------------------------------------------------------------------ */ - /** checks whether default values in detail forms work as expected. - * - * Effectively, this test case verifies the issues #i106574# and #i105235# did not creep back in. - */ - public void checkDetailFormDefaults() throws Exception - { - CRMDatabase database = null; - XCommandProcessor subComponentCommands = null; - try - { - // create our standard CRM database document - database = new CRMDatabase( m_orb, true ); - - // create a form document therein - XFormDocumentsSupplier formDocSupp = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, database.getDatabase().getModel() ); - XMultiServiceFactory formFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, formDocSupp.getFormDocuments() ); - NamedValue[] loadArgs = new NamedValue[] { - new NamedValue( "ActiveConnection", database.getConnection().getXConnection() ), - new NamedValue( "MediaType", "application/vnd.oasis.opendocument.text" ) - }; - - subComponentCommands = UnoRuntime.queryInterface( - XCommandProcessor.class, - formFactory.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", loadArgs ) ); - Command command = new Command(); - command.Name = "openDesign"; - command.Argument = new Short( OpenMode.DOCUMENT ); - - DocumentHelper subDocument = new DocumentHelper( m_orb, - UnoRuntime.queryInterface( XComponent.class, - subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null ) - ) - ); - FormLayer formLayer = new FormLayer( subDocument ); - XPropertySet controlModel = formLayer.insertControlLine( "DatabaseNumericField", "ID", "", 10 ); - formLayer.insertControlLine( "DatabaseTextField", "Name", "", 20 ); - formLayer.insertControlLine( "DatabaseTextField", "Description", "", 30 ); - - m_masterForm = (XPropertySet)dbfTools.getParent( controlModel, XPropertySet.class ); - m_masterForm.setPropertyValue( "Command", "categories" ); - m_masterForm.setPropertyValue( "CommandType", new Integer( CommandType.TABLE ) ); - - // create a detail form - m_detailForm = UnoRuntime.queryInterface( XPropertySet.class, subDocument.createSubForm( m_masterForm, "products" ) ); - m_detailForm.setPropertyValue( "Command", "SELECT \"ID\", \"Name\", \"CategoryID\" FROM \"products\"" ); - m_detailForm.setPropertyValue( "CommandType", new Integer( CommandType.COMMAND ) ); - m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID" } ); - m_detailForm.setPropertyValue( "DetailFields", new String[] { "CategoryID" } ); - - // create a grid control in the detail form, with some columns - XPropertySet gridControlModel = formLayer.createControlAndShape( "GridControl", 20, 40, 130, 50, m_detailForm ); - gridControlModel.setPropertyValue( "Name", "product list" ); - XIndexContainer gridColumns = UnoRuntime.queryInterface( XIndexContainer.class, gridControlModel ); - impl_createGridColumn( gridColumns, "TextField", "ID" ); - XPropertySet nameColumn = impl_createGridColumn( gridColumns, "TextField", "Name" ); - nameColumn.setPropertyValue( "Width", new Integer( 600 ) ); // 6 cm - nameColumn.setPropertyValue( "DefaultText", "default text" ); - - // go live - m_masterResult = new ResultSet( m_masterForm ); - m_detailResult = new ResultSet( m_detailForm ); - - XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm ); - loadDetail.addLoadListener( this ); - - subDocument.getCurrentView().toggleFormDesignMode(); - impl_waitForLoadedEvent(); - - // now that we set up this, do the actual tests - // First, http://www.openoffice.org/issues/show_bug.cgi?id=105235 described the problem - // that default values in the sub form didn't work when the master form was navigated to a row - // for which no detail records were present, and the default of the column/control is the same - // as the last known value. - - // so, take the current value of the "Name" column, and set it as default value ... - String defaultValue = m_detailResult.getString( 2 ); - nameColumn.setPropertyValue( "DefaultText", defaultValue ); - // ... then move to the second main form row ... - m_masterResult.absolute( 2 ); - impl_waitForLoadedEvent(); - // ... which should result in an empty sub form ... - assure( "test precondition not met: The second master form record is expected to have no detail records, " + - "else the test becomes meaningless", impl_isNewRecord( m_detailForm ) ); - // ... and in the "Name" column having the proper text - String actualValue = (String)nameColumn.getPropertyValue( "Text" ); - assureEquals( "#i105235#: default value in sub form not working (not propagated to column model)", defaultValue, actualValue ); - // However, checking the column model's value alone is not enough - we need to ensure it is properly - // propagated to the control. - XGridFieldDataSupplier gridData = (XGridFieldDataSupplier)subDocument.getCurrentView().getControl( - gridControlModel, XGridFieldDataSupplier.class ); - actualValue = (String)(gridData.queryFieldData( 0, Type.STRING )[1]); - assureEquals( "#i105235#: default value in sub form not working (not propagated to column)", defaultValue, actualValue ); - } - finally - { - if ( subComponentCommands != null ) - { - XComponentSupplier componentSupplier = UnoRuntime.queryInterface( XComponentSupplier.class, subComponentCommands ); - XModifiable modifySubComponent = UnoRuntime.queryInterface( XModifiable.class, componentSupplier.getComponent() ); - modifySubComponent.setModified( false ); - Command command = new Command(); - command.Name = "close"; - subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null ); - } - - if ( database != null ) - database.saveAndClose(); - - impl_cleanUpStep(); - } - } - - /* ------------------------------------------------------------------ */ - private boolean impl_isNewRecord( final XPropertySet _rowSet ) - { - boolean isNew = false; - try - { - isNew = ((Boolean)_rowSet.getPropertyValue( "IsNew" )).booleanValue(); - } - catch ( Exception ex ) - { - failed( "obtaining the IsNew property failed" ); - } - return isNew; - } - - /* ------------------------------------------------------------------ */ - private XPropertySet impl_createGridColumn( final XIndexContainer _gridModel, final String _columnType, final String _boundField ) throws Exception - { - final XGridColumnFactory columnFactory = UnoRuntime.queryInterface( XGridColumnFactory.class, _gridModel ); - XPropertySet column = columnFactory.createColumn( _columnType ); - column.setPropertyValue( "DataField", _boundField ); - column.setPropertyValue( "Name", _boundField ); - column.setPropertyValue( "Label", _boundField ); - _gridModel.insertByIndex( _gridModel.getCount(), column ); - return column; - } - - /* ------------------------------------------------------------------ */ - /** executes an operation on the master, and waits until the detail form has been (re)loaded aferwards - */ - private void operateMasterAndWaitForDetailForm( Method _masterMethod, Object _masterInterface, Object[] _methodParameters ) throws SQLException - { - Object result; - try - { - result = _masterMethod.invoke( _masterInterface, _methodParameters ); - } - catch( java.lang.Exception e ) - { - throw new SQLException( "invoking " + _masterMethod.getName() + " failed",new Object(), "", 0, new Object() ); - } - - if ( _masterMethod.getReturnType().getName().equals( "boolean" ) ) - if ( !((Boolean)result).booleanValue() ) - return; - - impl_waitForLoadedEvent(); - } - - private void impl_waitForLoadedEvent() - { - synchronized( m_waitForLoad ) - { - while ( !m_loaded ) - { - try { m_waitForLoad.wait(); } - catch( java.lang.InterruptedException e ) { } - } - // reset the flag for the next time - m_loaded = false; - } - } - - /** assures that the (integer) values in the given columns of our master and detail forms are identical - */ - private void verifyColumnValueIdentity( final String masterColName, final String detailColName ) throws SQLException - { - XColumnLocate locateMasterCols = UnoRuntime.queryInterface( XColumnLocate.class, m_masterForm ); - XColumnLocate locateDetailCols = UnoRuntime.queryInterface( XColumnLocate.class, m_detailForm ); - - int masterValue = m_masterResult.getInt( locateMasterCols.findColumn( masterColName ) ); - int detailValue = m_detailResult.getInt( locateDetailCols.findColumn( detailColName ) ); - - assure( "values in linked column pair " + detailColName + "->" + masterColName + " (" + - detailValue + "->" + masterValue + ") do not match (master position: " + m_masterResult.getRow() + ")!", - masterValue == detailValue ); - } - - public void disposing(com.sun.star.lang.EventObject eventObject) - { - } - - public void loaded(com.sun.star.lang.EventObject eventObject) - { - synchronized( m_waitForLoad ) - { - m_loaded = true; - m_waitForLoad.notify(); - } - } - - public void reloaded(com.sun.star.lang.EventObject eventObject) - { - synchronized( m_waitForLoad ) - { - m_loaded = true; - m_waitForLoad.notify(); - } - } - - public void reloading(com.sun.star.lang.EventObject eventObject) - { - } - - public void unloaded(com.sun.star.lang.EventObject eventObject) - { - } - - public void unloading(com.sun.star.lang.EventObject eventObject) - { - } -} diff --git a/forms/qa/integration/forms/NumericValidator.java b/forms/qa/integration/forms/NumericValidator.java deleted file mode 100644 index 9160d2301..000000000 --- a/forms/qa/integration/forms/NumericValidator.java +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.form.binding.*; - -public class NumericValidator extends integration.forms.ControlValidator -{ - - /** Creates a new instance of NumericValidator */ - public NumericValidator( ) - { - } - - public String explainInvalid( Object Value ) - { - try - { - double value = ((Double)Value).doubleValue(); - if ( Double.compare( Double.NaN, value ) == 0 ) - return "This is NotANumber"; - if ( !isProperRange( value ) ) - return "The value must be between 0 and 100"; - if ( !isProperDigitCount( value ) ) - return "The value must have at most one decimal digit"; - } - catch( java.lang.Exception e ) - { - return "This is no valid number"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - double value = ((Double)Value).doubleValue(); - if ( Double.compare( Double.NaN, value ) == 0 ) - return false; - if ( !isProperRange( value ) ) - return false; - if ( !isProperDigitCount( value ) ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - } - return false; - } - - private boolean isProperRange( double value) - { - return ( value >= 0 ) && ( value <= 100 ); - } - - private boolean isProperDigitCount( double value) - { - return ( java.lang.Math.floor( value * 10 ) == value * 10 ); - } -} diff --git a/forms/qa/integration/forms/RadioButtons.java b/forms/qa/integration/forms/RadioButtons.java deleted file mode 100644 index 9be8c8dc9..000000000 --- a/forms/qa/integration/forms/RadioButtons.java +++ /dev/null @@ -1,455 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.util.*; -import com.sun.star.lang.*; -import com.sun.star.container.*; -import com.sun.star.beans.*; -import com.sun.star.awt.XRadioButton; - -import integration.forms.dbfTools; -import integration.forms.DocumentHelper; -import integration.forms.SpreadsheetDocument; - -import util.utils; -import java.util.*; -import java.io.*; -import java.lang.*; - -public class RadioButtons extends complexlib.ComplexTestCase -{ - private DocumentHelper m_document; /// our current test document - private FormLayer m_formLayer; /// quick access to the form layer - private XMultiServiceFactory m_orb; /// our service factory - private XPropertySet m_primaryForm; /// the primary form, to be used in text documents and in the first page of spreadsheets - private XPropertySet m_secondaryForm; /// the secondary form, to be used in the second page of spreadsheets - - /* ------------------------------------------------------------------ */ - public RadioButtons() - { - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkSingleButtons", - "checkThreeGroups", - "checkMultipleForms", - "checkCalcPageSwitch" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Radio Buttons Test"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - } - - /* ------------------------------------------------------------------ */ - private XPropertySet insertRadio( int nXPos, int nYPos, String label, String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - return insertRadio( nXPos, nYPos, label, name, refValue, null ); - } - - /* ------------------------------------------------------------------ */ - private XPropertySet insertRadio( int nXPos, int nYPos, String label, String name, String refValue, XPropertySet parentForm ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XIndexContainer parentContainer = dbfTools.queryIndexContainer( parentForm ); - XPropertySet xRadio = m_formLayer.createControlAndShape( "DatabaseRadioButton", nXPos, nYPos, 25, 6, parentContainer ); - xRadio.setPropertyValue( "Label", label ); - xRadio.setPropertyValue( "RefValue", refValue ); - xRadio.setPropertyValue( "Name", name ); - - if ( null == m_primaryForm ) - m_primaryForm = (XPropertySet)dbfTools.getParent( xRadio, XPropertySet.class ); - - return xRadio; - } - - /* ------------------------------------------------------------------ */ - /** this checks whether n groups of radio buttons, consisting of only one button each, - * behave properly - */ - public void checkSingleButtons() throws com.sun.star.uno.Exception, java.lang.Exception - { - prepareTestStep( false ); - - insertRadio( 20, 30, "group 1", "group 1", "" ); - insertRadio( 20, 38, "group 2", "group 2", "" ); - insertRadio( 20, 46, "group 3", "group 3", "" ); - insertRadio( 20, 54, "group 4", "group 4", "" ); - - // switch to alive mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - - checkRadio( "group 1", "" ); - verifySingleRadios( 1, 0, 0, 0 ); - - checkRadio( "group 4", "" ); - verifySingleRadios( 1, 0, 0, 1 ); - - checkRadio( "group 2", "" ); - verifySingleRadios( 1, 1, 0, 1 ); - - checkRadio( "group 3", "" ); - verifySingleRadios( 1, 1, 1, 1 ); - - cleanupTestStep(); - } - - /* ------------------------------------------------------------------ */ - /** creates three groups of radio buttons in a sample document, and checks whether they're working - */ - public void checkThreeGroups( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - prepareTestStep( false ); - - insertRadio( 20, 30, "group 1 (a)", "group 1", "a" ); - insertRadio( 20, 38, "group 1 (b)", "group 1", "b" ); - - insertRadio( 20, 50, "group 2 (a)", "group 2", "a" ); - insertRadio( 20, 58, "group 2 (b)", "group 2", "b" ); - - insertRadio( 20, 70, "group 3 (a)", "group 3", "a" ); - insertRadio( 20, 78, "group 3 (b)", "group 3", "b" ); - - // switch to alive mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - - // initially, after switching to alive mode, all buttons should be unchecked - verifySixPack( 0, 0, 0, 0, 0, 0 ); - - // check one button in every group - checkRadio( "group 1", "a" ); - checkRadio( "group 2", "b" ); - checkRadio( "group 3", "a" ); - // and verify that this worked - verifySixPack( 1, 0, 0, 1, 1, 0 ); - - // check all buttons which are currently unchecked - checkRadio( "group 1", "b" ); - checkRadio( "group 2", "a" ); - checkRadio( "group 3", "b" ); - // this should have reset the previous checks in the respective groups - verifySixPack( 0, 1, 1, 0, 0, 1 ); - - // and back to the previous check state - checkRadio( "group 1", "a" ); - checkRadio( "group 2", "b" ); - checkRadio( "group 3", "a" ); - verifySixPack( 1, 0, 0, 1, 1, 0 ); - - cleanupTestStep(); - } - - /* ------------------------------------------------------------------ */ - /** tests whether radio buttons which belong to different forms behave properly - */ - public void checkMultipleForms( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - prepareTestStep( false ); - - insertRadio( 20, 30, "group 1 (a)", "group 1", "a" ); - insertRadio( 20, 38, "group 1 (b)", "group 1", "b" ); - insertRadio( 20, 46, "group 1 (c)", "group 1", "c" ); - - m_secondaryForm = dbfTools.queryPropertySet( m_document.createSiblingForm( m_primaryForm, "secondary" ) ); - - insertRadio( 70, 30, "group 2 (a)", "group 2", "a", m_secondaryForm ); - insertRadio( 70, 38, "group 2 (b)", "group 2", "b", m_secondaryForm ); - insertRadio( 70, 46, "group 2 (c)", "group 2", "c", m_secondaryForm ); - - // switch to alive mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - - // play around with different check states - checkRadio( "group 1", "b", m_primaryForm ); - checkRadio( "group 2", "c", m_secondaryForm ); - verifyTwoFormRadios( 0, 1, 0, 0, 0, 1 ); - - checkRadio( "group 1", "c", m_primaryForm ); - verifyTwoFormRadios( 0, 0, 1, 0, 0, 1 ); - - checkRadio( "group 2", "a", m_secondaryForm ); - verifyTwoFormRadios( 0, 0, 1, 1, 0, 0 ); - - checkRadio( "group 1", "a", m_primaryForm ); - verifyTwoFormRadios( 1, 0, 0, 1, 0, 0 ); - - checkRadio( "group 2", "b", m_secondaryForm ); - verifyTwoFormRadios( 1, 0, 0, 0, 1, 0 ); - - cleanupTestStep(); - } - - /* ------------------------------------------------------------------ */ - /** tests for a special bug which we once had, where radio buttons lost their state after - * switching spreadsheet pages - */ - public void checkCalcPageSwitch( ) throws com.sun.star.uno.Exception, java.lang.Exception - { - prepareTestStep( true ); - - m_formLayer.setInsertPage( 0 ); - insertRadio( 15, 20, "group 1 (a)", "group 1", "a" ); - insertRadio( 15, 26, "group 1 (b)", "group 1", "b" ); - - m_formLayer.setInsertPage( 1 ); - XPropertySet xRadio = insertRadio( 15, 20, "group 2 (a)", "group 2", "a" ); - insertRadio( 15, 26, "group 2 (b)", "group 2", "b" ); - m_secondaryForm = (XPropertySet)dbfTools.getParent( xRadio, XPropertySet.class ); - - // switch to alive mode - SpreadsheetView view = (SpreadsheetView)m_document.getCurrentView( ); - view.toggleFormDesignMode( ); - // and do initial checking - checkRadio( "group 1", "a", m_primaryForm ); - view.activateSheet( 1 ); - checkRadio( "group 2", "b", m_secondaryForm ); - - // see whether the check states on the first page survived the page switch - verifySheetRadios( 1, 0, 0, 1 ); - // switch back to the first sheet, and see whether the check states survived - view.activateSheet( 0 ); - verifySheetRadios( 1, 0, 0, 1 ); - // and for completely, check again after switching to third sheet and back to the first - view.activateSheet( 2 ); - view.activateSheet( 1 ); - verifySheetRadios( 1, 0, 0, 1 ); - - cleanupTestStep(); - } - - /* ------------------------------------------------------------------ */ - public void after() - { - closeDocument(); - } - - /* ------------------------------------------------------------------ */ - /** closes our document, if we have an open one - */ - private void closeDocument() - { - try - { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } - } - catch ( com.sun.star.uno.Exception e ) - { - } - } - - /* ------------------------------------------------------------------ */ - private void prepareTestStep( boolean useSpreadsheetDocument ) throws com.sun.star.uno.Exception, java.lang.Exception - { - m_primaryForm = null; - - m_document = useSpreadsheetDocument ? new SpreadsheetDocument( m_orb ) : DocumentHelper.blankTextDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); - } - - /* ------------------------------------------------------------------ */ - private void cleanupTestStep( ) - { - closeDocument(); - } - - /* ------------------------------------------------------------------ */ - /** checks or unchecks the radio button (in our primary form) with the given name and the given ref value - */ - private void checkRadio( String groupName, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - checkRadio( groupName, refValue, m_primaryForm ); - } - - /* ------------------------------------------------------------------ */ - /** checks or unchecks the radio button with the given name and the given ref value - */ - private void checkRadio( String groupName, String refValue, XPropertySet form ) throws com.sun.star.uno.Exception, java.lang.Exception - { - XPropertySet xRadio = getRadioModel( groupName, refValue, form ); - - XRadioButton radioButton = (XRadioButton)UnoRuntime.queryInterface( - XRadioButton.class, m_document.getCurrentView().getControl( xRadio ) ); - radioButton.setState( true ); - } - - /* ------------------------------------------------------------------ */ - private XPropertySet getRadioModel( String name, String refValue ) throws com.sun.star.uno.Exception, java.lang.Exception - { - return getRadioModel( name, refValue, m_primaryForm ); - } - - /* ------------------------------------------------------------------ */ - private XPropertySet getRadioModel( String name, String refValue, XPropertySet form ) throws com.sun.star.uno.Exception, java.lang.Exception - { - return m_formLayer.getRadioModelByRefValue( form, name, refValue ); - } - - /* ------------------------------------------------------------------ */ - private String stateString( short[] states ) - { - StringBuffer buf = new StringBuffer(); - for ( int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.util.*; -import com.sun.star.lang.*; -import com.sun.star.accessibility.*; -import com.sun.star.container.*; -import com.sun.star.beans.*; -import com.sun.star.form.binding.*; -import com.sun.star.form.validation.*; - -import integration.forms.DocumentHelper; - -public class SingleControlValidation implements XFormComponentValidityListener -{ - private DocumentHelper m_document; /// our current test document - private FormLayer m_formLayer; /// quick access to the form layer - private XMultiServiceFactory m_orb; /// our service factory - - private XPropertySet m_inputField; - private XPropertySet m_inputLabel; - private XPropertySet m_statusField; - private XPropertySet m_explanationField; - private XValidator m_validator; - - /* ------------------------------------------------------------------ */ - public SingleControlValidation( DocumentHelper document, int columnPos, int rowPos, String formComponentService, XValidator validator ) - { - m_document = document; - m_validator = validator; - m_formLayer = new FormLayer( m_document ); - createControls( columnPos, rowPos, formComponentService, 1, 0 ); - } - - /* ------------------------------------------------------------------ */ - public SingleControlValidation( DocumentHelper document, int columnPos, int rowPos, String formComponentService, XValidator validator, int controlCount, int controlHeight ) - { - m_document = document; - m_validator = validator; - m_formLayer = new FormLayer( m_document ); - createControls( columnPos, rowPos, formComponentService, controlCount, controlHeight ); - } - - /* ------------------------------------------------------------------ */ - public XPropertySet getInputField() - { - return m_inputField; - } - - /* ------------------------------------------------------------------ */ - public void setExplanatoryText( String text ) - { - try - { - m_inputLabel.setPropertyValue( "Label", text ); - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.err ); - } - } - - /* ------------------------------------------------------------------ */ - private void createControls( int columnPos, int rowPos, String formComponentService, int controlCount, int controlHeight ) - { - try - { - m_inputLabel = m_formLayer.createControlAndShape( "FixedText", columnPos, rowPos, 70, 12, null ); - m_inputLabel.setPropertyValue( "MultiLine", new Boolean( true ) ); - - com.sun.star.awt.FontDescriptor font = (com.sun.star.awt.FontDescriptor)m_inputLabel.getPropertyValue( "FontDescriptor" ); - font.Weight = com.sun.star.awt.FontWeight.BOLD; - m_inputLabel.setPropertyValue( "FontDescriptor", font ); - - if ( controlHeight == 0 ) - controlHeight = 6; - - int controlPos = rowPos + 12; - XPropertySet[] controls = new XPropertySet[ controlCount ]; - for ( int i = 0; i < controlCount; ++i, controlPos += controlHeight ) - { - controls[ i ] = m_formLayer.createControlAndShape( formComponentService, columnPos, controlPos, 25, controlHeight, null ); - controls[ i ].setPropertyValue( "Name", formComponentService ); - controls[ i ].setPropertyValue( "Tag", String.valueOf( i ) ); - - if ( controls[ i ].getPropertySetInfo().hasPropertyByName( "Border" ) ) - controls[ i ].setPropertyValue( "Border", new Short( (short)2 ) ); - - XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class, - controls[ i ] ); - xComp.addFormComponentValidityListener( this ); - } - m_inputField = controls[ 0 ]; - - // ---------------------------------- - controlPos += 4; - XPropertySet xLabel = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null ); - xLabel.setPropertyValue( "Label", new String( "Status:" ) ); - controlPos += 4; - m_statusField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null ); - m_statusField.setPropertyValue( "Label", new String( "" ) ); - - // ---------------------------------- - controlPos += 6; - xLabel = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null ); - xLabel.setPropertyValue( "Label", new String( "Explanation for invalidity:" ) ); - controlPos += 4; - m_explanationField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null ); - m_explanationField.setPropertyValue( "Label", new String( "" ) ); - - XValidatable xValidatable = (XValidatable)UnoRuntime.queryInterface( XValidatable.class, m_inputField ); - xValidatable.setValidator( m_validator ); - } - catch( java.lang.Exception e ) - { - e.printStackTrace( System.out ); - } - } - - /* ------------------------------------------------------------------ */ - /* XEventListener overridables */ - /* ------------------------------------------------------------------ */ - public void disposing( com.sun.star.lang.EventObject eventObject ) - { - // not interested in - } - - /* ------------------------------------------------------------------ */ - /* XFormComponentValidityListener overridables */ - /* ------------------------------------------------------------------ */ - public void componentValidityChanged( com.sun.star.lang.EventObject eventObject ) - { - try - { - if ( m_inputField.equals( eventObject.Source ) ) - { - XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class, - eventObject.Source ); - // the current value - Object value = xComp.getCurrentValue(); - - // the current validity flag - boolean isValid = xComp.isValid(); - - m_statusField.setPropertyValue("Label", isValid ? "valid" : "invalid" ); - m_statusField.setPropertyValue( "TextColor", new Integer( isValid ? 0x008000 : 0x800000 ) ); - - String validityMessage = ""; - if ( !isValid ) - validityMessage = m_validator.explainInvalid( value ); - m_explanationField.setPropertyValue( "Label", validityMessage ); - } - } - catch( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.out ); - } - } - -} diff --git a/forms/qa/integration/forms/SpreadsheetDocument.java b/forms/qa/integration/forms/SpreadsheetDocument.java deleted file mode 100644 index 91d348998..000000000 --- a/forms/qa/integration/forms/SpreadsheetDocument.java +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; -import com.sun.star.table.XCellRange; -import com.sun.star.table.CellAddress; -import com.sun.star.table.CellRangeAddress; -import com.sun.star.container.XIndexAccess; -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.sheet.XSpreadsheets; -import com.sun.star.beans.NamedValue; - -/** - * - * @author fs93730 - */ -public class SpreadsheetDocument extends DocumentHelper -{ - /** Creates a new blank spreadsheet document */ - /* ------------------------------------------------------------------ */ - public SpreadsheetDocument( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception - { - super( orb, implLoadAsComponent( orb, "private:factory/scalc" ) ); - } - - /* ------------------------------------------------------------------ */ - public SpreadsheetDocument( XMultiServiceFactory orb, XComponent document ) throws com.sun.star.uno.Exception - { - super( orb, document ); - } - - /* ------------------------------------------------------------------ */ - /** returns the sheets collection - */ - public XSpreadsheets getSheets() throws com.sun.star.uno.Exception - { - XSpreadsheetDocument spreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( XSpreadsheetDocument.class, - getDocument() - ); - return spreadsheetDoc.getSheets(); - } - - /* ------------------------------------------------------------------ */ - /** returns the sheet with the given index - */ - public XCellRange getSheet( int index ) throws com.sun.star.uno.Exception - { - XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class, - getSheets() - ); - return (XCellRange)UnoRuntime.queryInterface( XCellRange.class, - sheets.getByIndex( index ) - ); - } - - /* ------------------------------------------------------------------ */ - /** creates a value binding for a given cell - */ - public com.sun.star.form.binding.XValueBinding createCellBinding( short sheet, short column, short row ) - { - return createCellBinding( sheet, column, row, false ); - } - - /* ------------------------------------------------------------------ */ - /** creates a value binding which can be used to exchange a list box selection index with a cell - */ - public com.sun.star.form.binding.XValueBinding createListIndexBinding( short sheet, short column, short row ) - { - return createCellBinding( sheet, column, row, true ); - } - - /* ------------------------------------------------------------------ */ - /** creates a value binding for a given cell, with or without support for integer value exchange - */ - private com.sun.star.form.binding.XValueBinding createCellBinding( short sheet, short column, short row, boolean supportIntegerValues ) - { - com.sun.star.form.binding.XValueBinding cellBinding = null; - try - { - CellAddress address = new CellAddress( sheet, column, row ); - Object[] initParam = new Object[] { new NamedValue( "BoundCell", address ) }; - cellBinding = (com.sun.star.form.binding.XValueBinding)UnoRuntime.queryInterface( - com.sun.star.form.binding.XValueBinding.class, - createInstanceWithArguments( - supportIntegerValues ? "com.sun.star.table.ListPositionCellBinding" - : "com.sun.star.table.CellValueBinding", - initParam - ) - ); - } - catch( com.sun.star.uno.Exception e ) - { - System.err.println( e ); - e.printStackTrace( System.err ); - } - return cellBinding; - } - - /* ------------------------------------------------------------------ */ - /** creates a source of list entries associated with a (one-column) cell range - */ - public com.sun.star.form.binding.XListEntrySource createListEntrySource( short sheet, short column, - short topRow, short bottomRow ) - { - com.sun.star.form.binding.XListEntrySource entrySource = null; - try - { - CellRangeAddress rangeAddress = new CellRangeAddress( sheet, column, - topRow, column, bottomRow ); - Object[] initParam = new Object[] { new NamedValue( "CellRange", rangeAddress ) }; - entrySource = (com.sun.star.form.binding.XListEntrySource)UnoRuntime.queryInterface( - com.sun.star.form.binding.XListEntrySource.class, - createInstanceWithArguments( - "com.sun.star.table.CellRangeListSource", initParam ) ); - } - catch( com.sun.star.uno.Exception e ) - { - System.err.println( e ); - e.printStackTrace( System.err ); - } - return entrySource; - } -} diff --git a/forms/qa/integration/forms/SpreadsheetView.java b/forms/qa/integration/forms/SpreadsheetView.java deleted file mode 100644 index 819cca3f4..000000000 --- a/forms/qa/integration/forms/SpreadsheetView.java +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -/* - * SpreadsheetView.java - * - * Created on 2. Oktober 2003, 14:02 - */ - -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.lang.*; -import com.sun.star.frame.*; -import com.sun.star.sheet.*; -import com.sun.star.container.*; - -import integration.forms.DocumentViewHelper; -import integration.forms.DocumentHelper; - -/** - * - * @author fs93730 - */ -public class SpreadsheetView extends integration.forms.DocumentViewHelper -{ - - /** Creates a new instance of SpreadsheetView */ - public SpreadsheetView( XMultiServiceFactory orb, DocumentHelper document, XController controller ) - { - super( orb, document, controller ); - } - - /** activates the sheet with the given index - */ - void activateSheet( int sheetIndex ) - { - try - { - // get the sheet to activate - XSpreadsheetDocument doc = (XSpreadsheetDocument)UnoRuntime.queryInterface( - XSpreadsheetDocument.class, getDocument().getDocument() ); - XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( - XIndexAccess.class, doc.getSheets() ); - - XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface( - XSpreadsheet.class, sheets.getByIndex( sheetIndex ) ); - - // activate - XSpreadsheetView view = (XSpreadsheetView)UnoRuntime.queryInterface( - XSpreadsheetView.class, getController() ); - view.setActiveSheet( sheet ); - } - catch( com.sun.star.uno.Exception e ) - { - } - } -} diff --git a/forms/qa/integration/forms/TableCellTextBinding.java b/forms/qa/integration/forms/TableCellTextBinding.java deleted file mode 100644 index f6b38013e..000000000 --- a/forms/qa/integration/forms/TableCellTextBinding.java +++ /dev/null @@ -1,213 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.table.XCell; -import com.sun.star.util.XModifyListener; -import com.sun.star.beans.XPropertySet; -import com.sun.star.text.XTextRange; -import com.sun.star.form.binding.IncompatibleTypesException; - -/** a value binding to be connected to a form control - - This binding synchronizes the text contained in a table cell (which you must - pass upon construction) to the text in an XBindableValue. - - Well, in real it does not synchronize both directions. The ValueBinding - service has not much room for own activity: It allows notification of changes - in the own value, and it allows external instances to set the current value. - - Note that we implement this binding as a separate thread, which is (more or - less permanently) polling for a new text at the cell. This is unfortunate, but - sadly the Writer table cells do not support actively notifying changes in their - content to other interested parties. -*/ -public class TableCellTextBinding - extends java.lang.Thread - implements com.sun.star.form.binding.XValueBinding, - com.sun.star.util.XModifyBroadcaster -{ - private XTextRange m_cellText; - private Object m_writeSignal; - private String m_newCellText; - private String m_lastKnownCellText; - private boolean m_haveNewCellText; - private java.util.List m_listeners; - - /** Creates a new instance of TableCellTextBinding */ - public TableCellTextBinding( XCell cell ) - { - m_cellText = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, cell ); - - m_newCellText = new String(); - m_listeners = new java.util.LinkedList(); - - start(); - } - - /** retrieves the list of data types which this binding can exchange - */ - public com.sun.star.uno.Type[] getSupportedValueTypes() - { - try - { - // well, only strings here ... - return new Type[] { - getStringType() - }; - } - catch( java.lang.Exception e ) - { - } - return new Type[] { }; - } - - /** retrieves the current value - */ - public Object getValue(com.sun.star.uno.Type type) throws com.sun.star.form.binding.IncompatibleTypesException - { - if ( !type.equals( getStringType() ) ) - throw new com.sun.star.form.binding.IncompatibleTypesException(); - - return m_cellText.getString(); - } - - /** sets a new value - */ - public void setValue(Object obj) throws com.sun.star.form.binding.IncompatibleTypesException - { - String text; - try - { - text = (String)obj; - } - catch( java.lang.ClassCastException e ) - { - throw new com.sun.star.form.binding.IncompatibleTypesException(); - } - // remember the new text - synchronized( m_newCellText ) - { - m_newCellText = text; - m_haveNewCellText = true; - } - // and wake up the thread which is waiting for it - synchronized( m_writeSignal ) - { - m_writeSignal.notify(); - } - } - - /** determines whether a given value type is supported - */ - public boolean supportsType(com.sun.star.uno.Type type) - { - return type.equals( getStringType() ); - } - - /** retrieves the UNO type for the string class - */ - private static final Type getStringType() - { - return new com.sun.star.uno.Type( String.class ); - } - - /** runs the thread - */ - public void run() - { - try - { - m_writeSignal = new Object(); - while ( true ) - { - // go sleep a while - synchronized( m_writeSignal ) - { - m_writeSignal.wait( 200 ); - } - - // if there's new text in the control, propagate it to the cell - synchronized ( m_newCellText ) - { - if ( m_haveNewCellText ) - { - m_cellText.setString( m_newCellText ); - m_lastKnownCellText = m_newCellText; - } - m_haveNewCellText = false; - } - - // if there's new text in the cell, propagate it to the control - String currentCellText = m_cellText.getString(); - if ( !currentCellText.equals( m_lastKnownCellText ) ) - { - m_lastKnownCellText = currentCellText; - // notify the modification - synchronized( m_listeners ) - { - com.sun.star.lang.EventObject eventSource = new com.sun.star.lang.EventObject( this ); - - java.util.Iterator loop = m_listeners.iterator(); - while ( loop.hasNext() ) - { - ((XModifyListener)loop.next()).modified( eventSource ); - } - } - } - } - } - catch( java.lang.Exception e ) - { - e.printStackTrace(System.err); - } - } - - public void addModifyListener(com.sun.star.util.XModifyListener xModifyListener) - { - synchronized( m_listeners ) - { - m_listeners.add( xModifyListener ); - } - } - - public void removeModifyListener(com.sun.star.util.XModifyListener xModifyListener) - { - synchronized( m_listeners ) - { - m_listeners.remove( xModifyListener ); - } - } - - public void disposing(com.sun.star.lang.EventObject eventObject) - { - // not interested in - } -} diff --git a/forms/qa/integration/forms/TestCase.java b/forms/qa/integration/forms/TestCase.java deleted file mode 100644 index 6498515b6..000000000 --- a/forms/qa/integration/forms/TestCase.java +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.util.XCloseable; -import com.sun.star.util.XModifiable; - -public abstract class TestCase extends complexlib.ComplexTestCase implements com.sun.star.lang.XEventListener -{ - protected XMultiServiceFactory m_orb; /// our service factory - protected DocumentType m_documentType; /// the type of our document - protected DocumentHelper m_document; /// our current test document - protected FormLayer m_formLayer; - - /** Creates a new instance of TestCase */ - public TestCase( DocumentType docType ) - { - m_documentType = docType; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return this.getClass().getName(); - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_orb = (XMultiServiceFactory)param.getMSF(); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - /** closes our document, if we have an open one, via (simulated) user input - */ - protected void closeDocumentByUI() - { - try - { - if ( m_document != null ) - { - // first, set the document to "unmodified" - XModifiable docModify = (XModifiable)m_document.query( XModifiable.class ); - docModify.setModified( false ); - - m_document.getCurrentView().dispatch( ".uno:CloseDoc" ); - - // CloseDoc is asynchronous, so wait until it's done - or 1 second, at most - synchronized ( this ) { wait( 1000 ); } - } - } - catch ( java.lang.Exception e ) - { - e.printStackTrace( System.out ); - } - } - - /* ------------------------------------------------------------------ */ - /** closes our document, if we have an open one - */ - protected void closeDocument() - { - try - { - // close our document - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)m_document.query( XCloseable.class ); - closeDoc.close( true ); - } - } - catch ( com.sun.star.uno.Exception e ) - { - e.printStackTrace( System.out ); - } - } - - /* ------------------------------------------------------------------ */ - /** prepares a new document to work with - */ - protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - m_document = DocumentHelper.blankDocument( m_orb, m_documentType ); - m_document.getDocument( ).addEventListener( this ); - m_formLayer = new FormLayer( m_document ); - } - - /* ------------------------------------------------------------------ */ - /* internal methods */ - /* ------------------------------------------------------------------ */ - /** waits for the user to press a key (on the console where she started the java program) - or the document to be closed by the user. - @return - if the user pressed a key on the console, if she closed the document - */ - protected boolean waitForUserInput() throws java.lang.Exception - { - synchronized (this) - { - integration.forms.WaitForInput aWait = new integration.forms.WaitForInput( this ); - aWait.start(); - wait(); - - // if the waiter thread is done, the user pressed enter - boolean bKeyPressed = aWait.isDone(); - if ( !bKeyPressed ) - aWait.interrupt(); - - return bKeyPressed; - } - } - - /* ------------------------------------------------------------------ */ - /* XEventListener overridables */ - /* ------------------------------------------------------------------ */ - public void disposing( com.sun.star.lang.EventObject eventObject ) - { - if ( m_document.getDocument().equals( eventObject.Source ) ) - { - // notify ourself that we can stop waiting for user input - synchronized (this) - { - notify(); - } - } - } -} diff --git a/forms/qa/integration/forms/TestSkeleton.java b/forms/qa/integration/forms/TestSkeleton.java deleted file mode 100644 index c5471d097..000000000 --- a/forms/qa/integration/forms/TestSkeleton.java +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.uno.Exception; - -public class TestSkeleton extends TestCase -{ - /** Creates a new instance of TestSkeleton */ - public TestSkeleton() - { - super( DocumentType.WRITER ); - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkTestSkeleton" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Test Skeleton"; - } - - /* ------------------------------------------------------------------ */ - public void checkTestSkeleton() throws com.sun.star.uno.Exception, java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - public void before() throws Exception, java.lang.Exception - { - super.before(); - } - - /* ------------------------------------------------------------------ */ - public void after() throws Exception, java.lang.Exception - { - super.before(); - } - - /* ------------------------------------------------------------------ */ - protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.prepareDocument(); - } - } diff --git a/forms/qa/integration/forms/TextValidator.java b/forms/qa/integration/forms/TextValidator.java deleted file mode 100644 index a71fba97e..000000000 --- a/forms/qa/integration/forms/TextValidator.java +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.form.binding.*; - -public class TextValidator extends integration.forms.ControlValidator -{ - - /** Creates a new instance of NumericValidator */ - public TextValidator( ) - { - } - - public String explainInvalid( Object Value ) - { - try - { - String value = (String)Value; - if ( containsZs( value ) ) - return "No Z's allowed here"; - if ( !isProperChunks( value ) ) - return "Need 3 * n characters"; - } - catch( java.lang.Exception e ) - { - return "ooops. Unknown error"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - String value = (String)Value; - if ( containsZs( value ) ) - return false; - if ( !isProperChunks( value ) ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - } - return false; - } - - private boolean isProperChunks( String value ) - { - return ( value.length() % 3 ) == 0; - } - - private boolean containsZs( String value ) - { - if ( ( value.indexOf( 'Z' ) != -1 ) - || ( value.indexOf( 'z' ) != -1 ) - ) - return true; - return false; - } -} diff --git a/forms/qa/integration/forms/TimeValidator.java b/forms/qa/integration/forms/TimeValidator.java deleted file mode 100644 index 8fda09a58..000000000 --- a/forms/qa/integration/forms/TimeValidator.java +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.form.binding.*; - -public class TimeValidator extends integration.forms.ControlValidator -{ - - /** Creates a new instance of NumericValidator */ - public TimeValidator( ) - { - } - - public String explainInvalid( Object Value ) - { - try - { - if ( isVoid( Value ) ) - return "empty input"; - - com.sun.star.util.Time timeValue = (com.sun.star.util.Time)Value; - if ( isInvalidTime( timeValue ) ) - return "this is no valid time"; - if ( !isFullHour( timeValue ) ) - return "time must denote a full hour"; - } - catch( java.lang.Exception e ) - { - return "this is no valid time"; - } - return ""; - } - - public boolean isValid( Object Value ) - { - try - { - if ( isVoid( Value ) ) - return false; - - com.sun.star.util.Time timeValue = (com.sun.star.util.Time) - com.sun.star.uno.AnyConverter.toObject( - com.sun.star.util.Time.class, Value); - if ( isInvalidTime( timeValue ) ) - return false; - if ( !isFullHour( timeValue ) ) - return false; - return true; - } - catch( java.lang.Exception e ) - { - e.printStackTrace( System.err ); - } - return false; - } - - private boolean isInvalidTime( com.sun.star.util.Time timeValue ) - { - return ( timeValue.Hours == -1 ) && ( timeValue.Minutes == -1 ) && ( timeValue.Seconds == -1 ) && ( timeValue.HundredthSeconds == -1 ); - } - - private boolean isFullHour( com.sun.star.util.Time timeValue ) - { - return ( timeValue.Minutes == 0 ) && ( timeValue.Seconds == 0 ) && ( timeValue.HundredthSeconds == 0 ); - } -} diff --git a/forms/qa/integration/forms/ValueBinding.java b/forms/qa/integration/forms/ValueBinding.java deleted file mode 100644 index e53c1d2b1..000000000 --- a/forms/qa/integration/forms/ValueBinding.java +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.beans.XPropertySet; -import com.sun.star.text.XTextDocument; -import com.sun.star.text.XText; -import com.sun.star.text.XTextTable; -import com.sun.star.text.XTextCursor; -import com.sun.star.form.binding.XValueBinding; -import com.sun.star.form.binding.XBindableValue; - -import integration.forms.DocumentHelper; -import integration.forms.TableCellTextBinding; - -public class ValueBinding extends integration.forms.TestCase -{ - /** Creates a new instance of ValueBinding */ - public ValueBinding() - { - super( DocumentType.WRITER ); - } - - public static boolean isInteractiveTest() - { - return true; - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkBindingProperties" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Control Value Binding Test"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.before(); - prepareDocument(); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.waitForUserInput(); - super.closeDocument(); - } - - /* ------------------------------------------------------------------ */ - public void checkBindingProperties() throws com.sun.star.uno.Exception, java.lang.Exception - { - } - - /* ------------------------------------------------------------------ */ - protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception - { - super.prepareDocument(); - - // insert a table with exactly one cell. The content of this table will be synced with - // the content of a form control - XTextDocument textDoc = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class, m_document.getDocument() ); - XText documentText = textDoc.getText(); - XTextCursor textCursor = documentText.createTextCursor(); - - XTextTable table = (XTextTable)UnoRuntime.queryInterface( XTextTable.class, - m_document.createInstance( "com.sun.star.text.TextTable" ) - ); - table.initialize( 1, 1 ); - documentText.insertTextContent( textCursor, table, false ); - - // insert our sample control - XPropertySet textControl = m_formLayer.insertControlLine( "DatabaseTextField", "Test", "", 10 ); - - // create a value binding for the first cell of the table - XValueBinding cellBinding = new TableCellTextBinding( table.getCellByName( "A1" ) ); - // and bind it to the control - XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface( - XBindableValue.class, textControl - ); - bindable.setValueBinding( cellBinding ); - - // toggle the view to alive mode - m_document.getCurrentView( ).toggleFormDesignMode( ); - } - } diff --git a/forms/qa/integration/forms/WaitForInput.java b/forms/qa/integration/forms/WaitForInput.java deleted file mode 100644 index 8a71c8f06..000000000 --- a/forms/qa/integration/forms/WaitForInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package integration.forms; - -class WaitForInput extends java.lang.Thread -{ - private Object m_aToNotify; - private boolean m_bDone; - - public WaitForInput( Object aToNotify ) - { - m_aToNotify = aToNotify; - m_bDone = false; - } - - public boolean isDone() - { - return m_bDone; - } - - public void run() - { - try - { - System.out.println( "\npress enter to exit" ); - System.in.read(); - - m_bDone = true; - // notify that the user pressed the key - synchronized (m_aToNotify) - { - m_aToNotify.notify(); - } - } - catch( java.lang.Exception e ) - { - // not really interested in - System.err.println( e ); - } - } -}; - diff --git a/forms/qa/integration/forms/XMLFormSettings.java b/forms/qa/integration/forms/XMLFormSettings.java deleted file mode 100644 index d92cd2c53..000000000 --- a/forms/qa/integration/forms/XMLFormSettings.java +++ /dev/null @@ -1,229 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package integration.forms; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.form.binding.IncompatibleTypesException; -import com.sun.star.form.binding.XBindableValue; -import com.sun.star.form.binding.XValueBinding; -import com.sun.star.frame.XStorable; -import com.sun.star.io.IOException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.CloseVetoException; -import com.sun.star.util.XCloseable; -import com.sun.star.xml.dom.XNode; -import com.sun.star.xsd.DataTypeClass; -import java.io.File; -import org.openoffice.xforms.Instance; -import org.openoffice.xforms.Model; -import org.openoffice.xforms.XMLDocument; - -public class XMLFormSettings extends complexlib.ComplexTestCase -{ - private XMultiServiceFactory m_orb; - private XMLDocument m_document; - private Model m_defaultModel; - private FormLayer m_formLayer; - private XPropertySet m_stringBinding; - private XPropertySet m_booleanBinding; - private XPropertySet m_dateBinding; - - /** Creates a new instance of XMLFormSettings */ - public XMLFormSettings() - { - } - - /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkExternalData" - }; - } - - /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Form Control Spreadsheet Cell Binding Test"; - } - - /* ------------------------------------------------------------------ */ - public void before() throws java.lang.Exception - { - // create the document and assign related members - m_orb = (XMultiServiceFactory)param.getMSF(); - m_document = new XMLDocument( m_orb ); - m_formLayer = new FormLayer( m_document ); - - // create a simple structure in the DOM tree: an element with two attributes - String[] modelNames = m_document.getXFormModelNames(); - m_defaultModel = m_document.getXFormModel( modelNames[0] ); - Instance defaultInstance = m_defaultModel.getDefaultInstance(); - XNode stringElement = defaultInstance.createElement( "stringElement" ); - XNode booleanAttrib = defaultInstance.createAttribute( stringElement, "booleanAttribute", "true" ); - XNode dateAttrib = defaultInstance.createAttribute( stringElement, "dateAttribute" ); - - // when it comes to saving and loading, only one child of the root element of the instance - // is handled (is this a bug? see xmloff/source/xforms/XFormsInstanceContext.cxx, method - // CreateChildContext). - // So, we remove the default node of the instance which it has all the time - defaultInstance.removeNode( "instanceData" ); - - assure( "booleanAttrib's parent is wrong", - UnoRuntime.areSame( stringElement, booleanAttrib.getParentNode() ) ); - assure( "dateAttrib's parent is wrong", - UnoRuntime.areSame( stringElement, dateAttrib.getParentNode() ) ); - - // also create bindings for the element and its attributes, of the proper type - m_stringBinding = m_defaultModel.createBindingForNode( stringElement, DataTypeClass.STRING ); - m_booleanBinding = m_defaultModel.createBindingForNode( booleanAttrib, DataTypeClass.BOOLEAN ); - m_dateBinding = m_defaultModel.createBindingForNode( dateAttrib, DataTypeClass.DATE ); - - // TODO: set up the bindings so that the date bindings is relevant if and only if - // the boolean value is true - - // store the document - File tempFile = File.createTempFile( "xmlforms", ".odt" ); - tempFile.deleteOnExit(); - String fileURL = tempFile.toURI().toURL().toExternalForm(); - XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class, - m_document.getDocument() ); - store.storeAsURL( fileURL, new PropertyValue[] {} ); - assure( "document still modified after saving it", !m_document.isModified() ); - } - - /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception - { - impl_closeDocument(); - } - - /* ------------------------------------------------------------------ */ - private void impl_closeDocument() throws CloseVetoException - { - if ( m_document != null ) - { - XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, - m_document.getDocument() ); - closeDoc.close( true ); - } - } - - /* ------------------------------------------------------------------ */ - private static void impl_bind( XPropertySet _control, XPropertySet _binding ) throws IncompatibleTypesException - { - XBindableValue bindableControl = (XBindableValue)UnoRuntime.queryInterface( - XBindableValue.class, _control ); - XValueBinding binding = (XValueBinding)UnoRuntime.queryInterface( - XValueBinding.class, _binding ); - bindableControl.setValueBinding( binding ); - } - - /* ------------------------------------------------------------------ */ - /** checks if master-detail relationships including multiple keys work - */ - public void checkExternalData() throws com.sun.star.uno.Exception, java.lang.Exception - { - // some controls - XPropertySet stringControl = m_formLayer.createLabeledControl( - "DatabaseTextField", "Task", 10, 10, 6 ); - impl_bind( stringControl, m_stringBinding ); - - XPropertySet booleanControl = m_formLayer.createControlAndShape( - "DatabaseCheckBox", 35, 18, 25, 6 ); - booleanControl.setPropertyValue( "Label", "has due date" ); - impl_bind( booleanControl, m_booleanBinding ); - - XPropertySet dateControl = m_formLayer.createControlAndShape( - "DatabaseDateField", 40, 26, 25, 6 ); - dateControl.setPropertyValue( "Dropdown", new Boolean( true ) ); - impl_bind( dateControl, m_dateBinding ); - - m_document.getCurrentView( ).toggleFormDesignMode( ); - - // ensure the model is set up as containing "document-internal" data - m_defaultModel.setIsDocumentInternalData( true ); - assure( "setting up the document to contain 'internal data' failed", - m_defaultModel.getIsDocumentInternalData() ); - impl_storeDocument(); - - // okay, here we go ... - // what this particular test is about is to check whether we can set up the model - // so that any changes to any controls bound to any data in this model actually marks - // the containing document as modified - m_formLayer.userTextInput( stringControl, "don't break this test" ); - assure( "model data changed, but document is not modified", - m_document.isModified() ); - - // TODO: do this with the other control/binding types, too - - // no the other way round: set up the model to contain "document-external" data - m_defaultModel.setIsDocumentInternalData( false ); - assure( "setting up the document to contain 'internal data' failed", - !m_defaultModel.getIsDocumentInternalData() ); - impl_storeDocument(); - - // and check that now, changes in the controls / model data are not reflected in - // document's modified state - m_formLayer.userTextInput( stringControl, "(or any other test, that is)" ); - assure( "model data changed, but document is modified", - !m_document.isModified() ); - - // ................................................................. - // finally, check whether the flag survives loading and saving - Model internalDataModel = m_document.addXFormModel( "internalData" ); - internalDataModel.setIsDocumentInternalData( true ); - Model externalDataModel = m_document.addXFormModel( "externalData" ); - externalDataModel.setIsDocumentInternalData( false ); - - impl_storeDocument(); - m_document.reload(); - - internalDataModel = m_document.getXFormModel( "internalData" ); - externalDataModel = m_document.getXFormModel( "externalData" ); - - assure( "setting up a model to contain 'internal data' did not survive reloading", - internalDataModel.getIsDocumentInternalData() ); - assure( "setting up a model to contain 'external data' did not survive reloading", - !externalDataModel.getIsDocumentInternalData() ); - } - - /* ------------------------------------------------------------------ */ - /** stores our document - * @throws com.sun.star.io.IOException - */ - private void impl_storeDocument() throws IOException - { - XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class, - m_document.getDocument() ); - store.store(); - assure( "document still modified after saving it", !m_document.isModified() ); - } -} diff --git a/forms/qa/integration/forms/dbfTools.java b/forms/qa/integration/forms/dbfTools.java deleted file mode 100644 index 8588cf8a0..000000000 --- a/forms/qa/integration/forms/dbfTools.java +++ /dev/null @@ -1,55 +0,0 @@ -package integration.forms; - -import com.sun.star.uno.*; -import com.sun.star.lang.*; -import com.sun.star.beans.*; -import com.sun.star.container.*; - -/** provides global helpers -*/ -class dbfTools -{ - /* ------------------------------------------------------------------ */ - /** disposes the component given - */ - static public void disposeComponent( Object xComp ) throws java.lang.RuntimeException - { - XComponent xComponent = queryComponent( xComp ); - if ( null != xComponent ) - xComponent.dispose(); - } - - /* ------------------------------------------------------------------ */ - /** queries an object for the XPropertySet interface - */ - static public XPropertySet queryPropertySet( Object aComp ) - { - return UnoRuntime.queryInterface( XPropertySet.class, aComp ); - } - - /* ------------------------------------------------------------------ */ - /** queries an object for the XIndexContainer interface - */ - static public XIndexContainer queryIndexContainer( Object aComp ) - { - return UnoRuntime.queryInterface( XIndexContainer.class, aComp ); - } - - /* ------------------------------------------------------------------ */ - /** queries an object for the XComponent interface - */ - static public XComponent queryComponent( Object aComp ) - { - return UnoRuntime.queryInterface( XComponent.class, aComp ); - } - - /* ------------------------------------------------------------------ */ - /** retrieves the parent of the given object - */ - @SuppressWarnings("unchecked") - static Object getParent( Object aComponent, Class aInterfaceClass ) - { - XChild xAsChild = UnoRuntime.queryInterface( XChild.class, aComponent ); - return UnoRuntime.queryInterface( aInterfaceClass, xAsChild.getParent() ); - } -}; diff --git a/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java b/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java deleted file mode 100644 index 7763afe6b..000000000 --- a/forms/qa/org/openoffice/complex/forms/tools/ResultSet.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package org.openoffice.complex.forms.tools; - -import com.sun.star.container.XNameAccess; -import com.sun.star.io.XInputStream; -import com.sun.star.sdbc.SQLException; -import com.sun.star.sdbc.XArray; -import com.sun.star.sdbc.XBlob; -import com.sun.star.sdbc.XClob; -import com.sun.star.sdbc.XRef; -import com.sun.star.sdbc.XResultSet; -import com.sun.star.sdbc.XRow; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.Date; -import com.sun.star.util.DateTime; -import com.sun.star.util.Time; - -/** - * - * @author frank.schoenheit@sun.com - */ -public class ResultSet implements XResultSet, XRow -{ - private final XResultSet m_resultSet; - private final XRow m_row; - - public ResultSet( final Object _resultSet ) - { - m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, _resultSet ); - m_row = (XRow)UnoRuntime.queryInterface( XRow.class, _resultSet ); - } - - public - boolean next() throws SQLException - { - return m_resultSet.next(); - } - - public - boolean isBeforeFirst() throws SQLException - { - return m_resultSet.isBeforeFirst(); - } - - public - boolean isAfterLast() throws SQLException - { - return m_resultSet.isAfterLast(); - } - - public - boolean isFirst() throws SQLException - { - return m_resultSet.isFirst(); - } - - public - boolean isLast() throws SQLException - { - return m_resultSet.isLast(); - } - - public - void beforeFirst() throws SQLException - { - m_resultSet.beforeFirst(); - } - - public - void afterLast() throws SQLException - { - m_resultSet.afterLast(); - } - - public - boolean first() throws SQLException - { - return m_resultSet.first(); - } - - public - boolean last() throws SQLException - { - return m_resultSet.last(); - } - - public - int getRow() throws SQLException - { - return m_resultSet.getRow(); - } - - public - boolean absolute( int _row ) throws SQLException - { - return m_resultSet.absolute( _row ); - } - - public - boolean relative( int _offset ) throws SQLException - { - return m_resultSet.relative( _offset ); - } - - public - boolean previous() throws SQLException - { - return m_resultSet.previous(); - } - - public - void refreshRow() throws SQLException - { - m_resultSet.refreshRow(); - } - - public - boolean rowUpdated() throws SQLException - { - return m_resultSet.rowUpdated(); - } - - public - boolean rowInserted() throws SQLException - { - return m_resultSet.rowInserted(); - } - - public - boolean rowDeleted() throws SQLException - { - return m_resultSet.rowDeleted(); - } - - public - Object getStatement() throws SQLException - { - return m_resultSet.getStatement(); - } - - public - boolean wasNull() throws SQLException - { - return m_row.wasNull(); - } - - public - String getString( int _colIndex ) throws SQLException - { - return m_row.getString( _colIndex ); - } - - public - boolean getBoolean( int _colIndex ) throws SQLException - { - return m_row.getBoolean( _colIndex ); - } - - public - byte getByte( int _colIndex ) throws SQLException - { - return m_row.getByte( _colIndex ); - } - - public - short getShort( int _colIndex ) throws SQLException - { - return m_row.getShort( _colIndex ); - } - - public - int getInt( int _colIndex ) throws SQLException - { - return m_row.getInt( _colIndex ); - } - - public - long getLong( int _colIndex ) throws SQLException - { - return m_row.getLong( _colIndex ); - } - - public - float getFloat( int _colIndex ) throws SQLException - { - return m_row.getFloat( _colIndex ); - } - - public - double getDouble( int _colIndex ) throws SQLException - { - return m_row.getDouble( _colIndex ); - } - - public - byte[] getBytes( int _colIndex ) throws SQLException - { - return m_row.getBytes( _colIndex ); - } - - public - Date getDate( int _colIndex ) throws SQLException - { - return m_row.getDate( _colIndex ); - } - - public - Time getTime( int _colIndex ) throws SQLException - { - return m_row.getTime( _colIndex ); - } - - public - DateTime getTimestamp( int _colIndex ) throws SQLException - { - return m_row.getTimestamp( _colIndex ); - } - - public - XInputStream getBinaryStream( int _colIndex ) throws SQLException - { - return m_row.getBinaryStream( _colIndex ); - } - - public - XInputStream getCharacterStream( int _colIndex ) throws SQLException - { - return m_row.getCharacterStream( _colIndex ); - } - - public - Object getObject( int _colIndex, XNameAccess _typeMap ) throws SQLException - { - return m_row.getObject( _colIndex, _typeMap ); - } - - public - XRef getRef( int _colIndex ) throws SQLException - { - return m_row.getRef( _colIndex ); - } - - public - XBlob getBlob( int _colIndex ) throws SQLException - { - return m_row.getBlob( _colIndex ); - } - - public - XClob getClob( int _colIndex ) throws SQLException - { - return m_row.getClob( _colIndex ); - } - - public - XArray getArray( int _colIndex ) throws SQLException - { - return m_row.getArray( _colIndex ); - } -} diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java deleted file mode 100644 index 8986be44b..000000000 --- a/forms/qa/org/openoffice/xforms/Instance.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package org.openoffice.xforms; - -import com.sun.star.xml.dom.DOMException; -import com.sun.star.xml.dom.XDocument; -import com.sun.star.xml.dom.XNode; -import com.sun.star.xml.dom.XNodeList; -import java.util.NoSuchElementException; - -/** - * - * @author fs93730 - */ -public class Instance -{ - private Model m_model; - private XDocument m_domInstance; - - protected Instance( Model _model, XDocument _domInstance ) - { - m_model = _model; - m_domInstance = _domInstance; - } - - /** creates a new element in the instance - * - * The element will be inserted immediately below the root node of the instance. - * - * @param _elementName - * the name of the to-be-created element - * @return - * the node of the newly created element - * @throws com.sun.star.xml.dom.DOMException - */ - public XNode createElement( String _elementName ) throws DOMException - { - return createElement( m_domInstance, _elementName, null ); - } - - /** creates a new element in the instance - * - * The element will be inserted immediately below the root node of the instance. - * - * @param _elementName - * the name of the to-be-created element - * @param _initialNodeValue - * the initial value to set at the node. Might be null, in this case no value is set. - * @return - * the node of the newly created element - * @throws com.sun.star.xml.dom.DOMException - */ - public XNode createElement( String _elementName, String _initialNodeValue ) throws DOMException - { - return createElement( m_domInstance, _elementName, _initialNodeValue ); - } - - /** creates a new element in the instance - * - * The element will be inserted immediately below a given XNode. - * - * @param _parentElement - * the node whose child shall be created - * @param _elementName - * the name of the to-be-created element - * @return - * the node of the newly created element - * @throws com.sun.star.xml.dom.DOMException - */ - public XNode createElement( XNode _parentElement, String _elementName ) throws DOMException - { - return createElement( _parentElement, _elementName, null ); - } - - /** creates a new element in the instance - * - * The element will be inserted immediately below a given XNode. - * - * @param _parentElement - * the node whose child shall be created - * @param _elementName - * the name of the to-be-created element - * @param _initialNodeValue - * the initial value to set at the node. Might be null, in this case no value is set. - * @return - * the node of the newly created element - * @throws com.sun.star.xml.dom.DOMException - */ - public XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException - { - XNode node = _parentElement.appendChild( - m_model.getUIHelper().createElement( _parentElement, _elementName ) - ); - if ( _initialNodeValue != null ) - node.setNodeValue( _initialNodeValue ); - return node; - } - - /** removes a child of the root-level node from the instance - * - * @param _elementName - * the name of the to-be-removed child - */ - public XNode removeNode( String _elementName ) throws DOMException - { - return removeNode( m_domInstance, _elementName ); - } - - /** removes a node from the instance - * - * @param _parentElement - * the node whose child is to be removed - * @param _elementName - * the name of the to-be-removed child - */ - public XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException - { - XNodeList nodes = _parentElement.getChildNodes(); - for ( int i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FORMS_BASELISTBOX_HXX_ -#define _FORMS_BASELISTBOX_HXX_ - -//......................................................................... -namespace frm -{ - -const sal_uInt16 ENTRY_NOT_FOUND = 0xFFFF; -const sal_uInt16 BOUNDCOLUMN = 0x0001; - -//......................................................................... -} -//......................................................................... - -#endif // _FORMS_BASELISTBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx deleted file mode 100644 index 44cc3474c..000000000 --- a/forms/source/component/Button.cxx +++ /dev/null @@ -1,781 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include "Button.hxx" - -#include - -#include -#include -#include -#include -#include -#include -#include - -//......................................................................... -namespace frm -{ -//......................................................................... - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using ::com::sun::star::frame::XDispatchProviderInterceptor; - -//================================================================== -//= OButtonModel -//================================================================== -DBG_NAME(OButtonModel) -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OButtonModel_CreateInstance(const Reference& _rxFactory) -{ - return *(new OButtonModel(_rxFactory)); -} - -//------------------------------------------------------------------ -OButtonModel::OButtonModel(const Reference& _rxFactory) - :OClickableImageBaseModel( _rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON ) - // use the old control name for compatibility reasons - ,m_aResetHelper( *this, m_aMutex ) - ,m_eDefaultState( STATE_NOCHECK ) -{ - DBG_CTOR( OButtonModel, NULL ); - m_nClassId = FormComponentType::COMMANDBUTTON; -} - -//------------------------------------------------------------------ -Any SAL_CALL OButtonModel::queryAggregation( const Type& _type ) throw(RuntimeException) -{ - Any aReturn = OClickableImageBaseModel::queryAggregation( _type ); - if ( !aReturn.hasValue() ) - aReturn = OButtonModel_Base::queryInterface( _type ); - return aReturn; -} - -//------------------------------------------------------------------ -Sequence< Type > OButtonModel::_getTypes() -{ - return ::comphelper::concatSequences( - OClickableImageBaseModel::_getTypes(), - OButtonModel_Base::getTypes() - ); -} - -//------------------------------------------------------------------ -OButtonModel::OButtonModel( const OButtonModel* _pOriginal, const Reference& _rxFactory ) - :OClickableImageBaseModel( _pOriginal, _rxFactory ) - ,m_aResetHelper( *this, m_aMutex ) - ,m_eDefaultState( _pOriginal->m_eDefaultState ) -{ - DBG_CTOR( OButtonModel, NULL ); - m_nClassId = FormComponentType::COMMANDBUTTON; - - implInitializeImageURL(); -} - -//------------------------------------------------------------------------------ -OButtonModel::~OButtonModel() -{ - DBG_DTOR(OButtonModel, NULL); -} - -//------------------------------------------------------------------------------ -void OButtonModel::describeFixedProperties( Sequence< Property >& _rProps ) const -{ - BEGIN_DESCRIBE_PROPERTIES( 6, OClickableImageBaseModel ) - DECL_PROP1( BUTTONTYPE, FormButtonType, BOUND ); - DECL_PROP1( DEFAULT_STATE, sal_Int16, BOUND ); - DECL_PROP1( DISPATCHURLINTERNAL, sal_Bool, BOUND ); - DECL_PROP1( TARGET_URL, ::rtl::OUString, BOUND ); - DECL_PROP1( TARGET_FRAME, ::rtl::OUString, BOUND ); - DECL_PROP1( TABINDEX, sal_Int16, BOUND ); - END_DESCRIBE_PROPERTIES(); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OButtonModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OButtonModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OClickableImageBaseModel::getSupportedServiceNames(); - aSupported.realloc( aSupported.getLength() + 1 ); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[ aSupported.getLength() - 1 ] = FRM_SUN_COMPONENT_COMMANDBUTTON; - - return aSupported; -} - -//------------------------------------------------------------------------------ -::rtl::OUString OButtonModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_COMMANDBUTTON; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OButtonModel::write(const Reference& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OClickableImageBaseModel::write(_rxOutStream); - - _rxOutStream->writeShort(0x0003); // Version - - { - OStreamSection aSection( _rxOutStream.get() ); - // this will allow readers to skip unknown bytes in their dtor - - _rxOutStream->writeShort( (sal_uInt16)m_eButtonType ); - - ::rtl::OUString sTmp = INetURLObject::decode( m_sTargetURL, '%', INetURLObject::DECODE_UNAMBIGUOUS); - _rxOutStream << sTmp; - _rxOutStream << m_sTargetFrame; - writeHelpTextCompatibly(_rxOutStream); - _rxOutStream << isDispatchUrlInternal(); - } -} - -//------------------------------------------------------------------------------ -void OButtonModel::read(const Reference& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OClickableImageBaseModel::read(_rxInStream); - - sal_uInt16 nVersion = _rxInStream->readShort(); // Version - switch (nVersion) - { - case 0x0001: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - _rxInStream >> m_sTargetURL; - _rxInStream >> m_sTargetFrame; - } - break; - - case 0x0002: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - _rxInStream >> m_sTargetURL; - _rxInStream >> m_sTargetFrame; - readHelpTextCompatibly(_rxInStream); - } - break; - - case 0x0003: - { - OStreamSection aSection( _rxInStream.get() ); - // this will skip any unknown bytes in it's dtor - - // button type - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - // URL - _rxInStream >> m_sTargetURL; - - // target frame - _rxInStream >> m_sTargetFrame; - - // help text - readHelpTextCompatibly(_rxInStream); - - // DispatchInternal - sal_Bool bDispath; - _rxInStream >> bDispath; - setDispatchUrlInternal(bDispath); - } - break; - - default: - OSL_FAIL("OButtonModel::read : unknown version !"); - m_eButtonType = FormButtonType_PUSH; - m_sTargetURL = ::rtl::OUString(); - m_sTargetFrame = ::rtl::OUString(); - break; - } -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::disposing() -{ - m_aResetHelper.disposing(); - OClickableImageBaseModel::disposing(); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::reset() throw (RuntimeException) -{ - if ( !m_aResetHelper.approveReset() ) - return; - - impl_resetNoBroadcast_nothrow(); - - m_aResetHelper.notifyResetted(); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::addResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) -{ - m_aResetHelper.addResetListener( _listener ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::removeResetListener( const Reference< XResetListener >& _listener ) throw (RuntimeException) -{ - m_aResetHelper.removeResetListener( _listener ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const -{ - switch ( _nHandle ) - { - case PROPERTY_ID_DEFAULT_STATE: - _rValue <<= (sal_Int16)m_eDefaultState; - break; - - default: - OClickableImageBaseModel::getFastPropertyValue( _rValue, _nHandle ); - break; - } -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw (Exception) -{ - switch ( _nHandle ) - { - case PROPERTY_ID_DEFAULT_STATE: - { - sal_Int16 nDefaultState( (sal_Int16)STATE_NOCHECK ); - OSL_VERIFY( _rValue >>= nDefaultState ); - m_eDefaultState = (ToggleState)nDefaultState; - impl_resetNoBroadcast_nothrow(); - } - break; - - default: - OClickableImageBaseModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); - break; - } -} - -//-------------------------------------------------------------------- -sal_Bool SAL_CALL OButtonModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw (IllegalArgumentException) -{ - sal_Bool bModified = sal_False; - switch ( _nHandle ) - { - case PROPERTY_ID_DEFAULT_STATE: - bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, (sal_Int16)m_eDefaultState ); - break; - - default: - bModified = OClickableImageBaseModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue ); - break; - } - return bModified; -} - -//-------------------------------------------------------------------- -Any OButtonModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const -{ - Any aDefault; - switch ( _nHandle ) - { - case PROPERTY_ID_DEFAULT_STATE: - aDefault <<= (sal_Int16)STATE_NOCHECK; - break; - - default: - aDefault = OClickableImageBaseModel::getPropertyDefaultByHandle( _nHandle ); - break; - } - return aDefault; -} - -//-------------------------------------------------------------------- -void OButtonModel::impl_resetNoBroadcast_nothrow() -{ - try - { - setPropertyValue( PROPERTY_STATE, getPropertyValue( PROPERTY_DEFAULT_STATE ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} - -//================================================================== -// OButtonControl -//================================================================== -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OButtonControl_CreateInstance(const Reference& _rxFactory) -{ - return *(new OButtonControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence OButtonControl::_getTypes() -{ - return ::comphelper::concatSequences( - OButtonControl_BASE::getTypes(), - OClickableImageBaseControl::_getTypes(), - OFormNavigationHelper::getTypes() - ); -} - -//------------------------------------------------------------------------------ -StringSequence OButtonControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OClickableImageBaseControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_COMMANDBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -OButtonControl::OButtonControl(const Reference& _rxFactory) - :OClickableImageBaseControl(_rxFactory, VCL_CONTROL_COMMANDBUTTON) - ,OFormNavigationHelper( _rxFactory ) - ,m_nClickEvent( 0 ) - ,m_nTargetUrlFeatureId( -1 ) - ,m_bEnabledByPropertyValue( sal_False ) -{ - increment(m_refCount); - { - // als ActionListener anmelden - Reference xButton; - query_aggregation( m_xAggregate, xButton); - if (xButton.is()) - xButton->addActionListener(this); - } - // Refcount bei 1 fuer Listener - decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OButtonControl::~OButtonControl() -{ - if (m_nClickEvent) - Application::RemoveUserEvent(m_nClickEvent); -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OButtonControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - // if asked for the XTypeProvider, don't let OButtonControl_BASE do this - Any aReturn; - if ( !_rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >( NULL ) ) ) ) - aReturn = OButtonControl_BASE::queryInterface( _rType ); - - if ( !aReturn.hasValue() ) - aReturn = OClickableImageBaseControl::queryAggregation( _rType ); - - if ( !aReturn.hasValue() ) - aReturn = OFormNavigationHelper::queryInterface( _rType ); - - return aReturn; -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::disposing() -{ - startOrStopModelPropertyListening( false ); - - OClickableImageBaseControl::disposing(); - OFormNavigationHelper::dispose(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::disposing( const EventObject& _rSource ) throw( RuntimeException ) -{ - OControl::disposing( _rSource ); - OFormNavigationHelper::disposing( _rSource ); -} - -// ActionListener -//------------------------------------------------------------------------------ -void OButtonControl::actionPerformed(const ActionEvent& /*rEvent*/) throw ( ::com::sun::star::uno::RuntimeException) -{ - // Asynchron fuer starutil::URL-Button - sal_uLong n = Application::PostUserEvent( LINK(this, OButtonControl,OnClick) ); - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_nClickEvent = n; - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK( OButtonControl, OnClick, void*, EMPTYARG ) -{ - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - m_nClickEvent = 0; - - if (m_aApproveActionListeners.getLength()) - { - // if there are listeners, start the action in an own thread, to not allow - // them to block us here (we're in the application's main thread) - getImageProducerThread()->addEvent(); - } - else - { - // Sonst nicht. Dann darf man aber auf keinen Fal die Listener - // benachrichtigen, auch dann nicht, wenn er spaeter hinzukommt. - aGuard.clear(); - - // recognize the button type - Reference xSet(getModel(), UNO_QUERY); - if (!xSet.is()) - return 0L; - - if (FormButtonType_PUSH == *(FormButtonType*)xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue()) - { - // notify the action listeners for a push button - ::cppu::OInterfaceIteratorHelper aIter(m_aActionListeners); - ActionEvent aEvt(static_cast(this), m_aActionCommand); - while(aIter.hasMoreElements() ) - { - // catch exceptions - // and catch them on a per-listener basis - if one listener fails, the others still need - // to get notified - try - { - static_cast< XActionListener* >( aIter.next() )->actionPerformed(aEvt); - } -#ifdef DBG_UTIL - catch( const RuntimeException& ) - { - // silent this - } -#endif - catch( const Exception& ) - { - OSL_FAIL( "OButtonControl::OnClick: caught a exception other than RuntimeException!" ); - } - } - } - else - actionPerformed_Impl( sal_False, ::com::sun::star::awt::MouseEvent() ); - } - return 0L; -} - -//------------------------------------------------------------------------------ -void OButtonControl::actionPerformed_Impl( sal_Bool _bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt ) -{ - { - sal_Int16 nFeatureId = -1; - { - ::osl::MutexGuard aGuard( m_aMutex ); - nFeatureId = m_nTargetUrlFeatureId; - } - - if ( nFeatureId != -1 ) - { - if ( !approveAction() ) - return; - - SolarMutexGuard aGuard; - dispatch( nFeatureId ); - return; - } - } - - OClickableImageBaseControl::actionPerformed_Impl( _bNotifyListener, _rEvt ); -} - -// XButton -//------------------------------------------------------------------------------ -void OButtonControl::setLabel(const ::rtl::OUString& Label) throw( RuntimeException ) -{ - Reference xButton; - query_aggregation( m_xAggregate, xButton ); - if (xButton.is()) - xButton->setLabel(Label); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::setActionCommand(const ::rtl::OUString& _rCommand) throw( RuntimeException ) -{ - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_aActionCommand = _rCommand; - } - - Reference xButton; - query_aggregation( m_xAggregate, xButton); - if (xButton.is()) - xButton->setActionCommand(_rCommand); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::addActionListener(const Reference& _rxListener) throw( RuntimeException ) -{ - m_aActionListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::removeActionListener(const Reference& _rxListener) throw( RuntimeException ) -{ - m_aActionListeners.removeInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -class DoPropertyListening -{ -private: - Reference< XPropertySet > m_xProps; - Reference< XPropertyChangeListener > m_xListener; - bool m_bStartListening; - -public: - DoPropertyListening( - const Reference< XInterface >& _rxComponent, - const Reference< XPropertyChangeListener >& _rxListener, - bool _bStart - ); - - void handleListening( const ::rtl::OUString& _rPropertyName ); -}; - -//.............................................................................. -DoPropertyListening::DoPropertyListening( - const Reference< XInterface >& _rxComponent, const Reference< XPropertyChangeListener >& _rxListener, - bool _bStart ) - :m_xProps( _rxComponent, UNO_QUERY ) - ,m_xListener( _rxListener ) - ,m_bStartListening( _bStart ) -{ - DBG_ASSERT( m_xProps.is() || !_rxComponent.is(), "DoPropertyListening::DoPropertyListening: valid component, but no property set!" ); - DBG_ASSERT( m_xListener.is(), "DoPropertyListening::DoPropertyListening: invalid listener!" ); -} - -//.............................................................................. -void DoPropertyListening::handleListening( const ::rtl::OUString& _rPropertyName ) -{ - if ( m_xProps.is() ) - { - if ( m_bStartListening ) - m_xProps->addPropertyChangeListener( _rPropertyName, m_xListener ); - else - m_xProps->removePropertyChangeListener( _rPropertyName, m_xListener ); - } -} - -//------------------------------------------------------------------------------ -void OButtonControl::startOrStopModelPropertyListening( bool _bStart ) -{ - DoPropertyListening aListeningHandler( getModel(), this, _bStart ); - aListeningHandler.handleListening( PROPERTY_TARGET_URL ); - aListeningHandler.handleListening( PROPERTY_BUTTONTYPE ); - aListeningHandler.handleListening( PROPERTY_ENABLED ); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OButtonControl::setModel( const Reference< XControlModel >& _rxModel ) throw ( RuntimeException ) -{ - startOrStopModelPropertyListening( false ); - sal_Bool bResult = OClickableImageBaseControl::setModel( _rxModel ); - startOrStopModelPropertyListening( true ); - - m_bEnabledByPropertyValue = sal_True; - Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY ); - if ( xModelProps.is() ) - xModelProps->getPropertyValue( PROPERTY_ENABLED ) >>= m_bEnabledByPropertyValue; - - modelFeatureUrlPotentiallyChanged( ); - - return bResult; -} - -//------------------------------------------------------------------------------ -void OButtonControl::modelFeatureUrlPotentiallyChanged( ) -{ - sal_Int16 nOldUrlFeatureId = m_nTargetUrlFeatureId; - - // doe we have another TargetURL now? If so, we need to update our dispatches - m_nTargetUrlFeatureId = getModelUrlFeatureId( ); - if ( nOldUrlFeatureId != m_nTargetUrlFeatureId ) - { - invalidateSupportedFeaturesSet(); - if ( !isDesignMode() ) - updateDispatches( ); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::propertyChange( const PropertyChangeEvent& _rEvent ) throw ( RuntimeException ) -{ - if ( _rEvent.PropertyName.equals( PROPERTY_TARGET_URL ) - || _rEvent.PropertyName.equals( PROPERTY_BUTTONTYPE ) - ) - { - modelFeatureUrlPotentiallyChanged( ); - } - else if ( _rEvent.PropertyName.equals( PROPERTY_ENABLED ) ) - { - _rEvent.NewValue >>= m_bEnabledByPropertyValue; - } -} - -//------------------------------------------------------------------------------ -namespace -{ - bool isFormControllerURL( const ::rtl::OUString& _rURL ) - { - const sal_Int32 nPrefixLen = URL_CONTROLLER_PREFIX.length; - return ( _rURL.getLength() > nPrefixLen ) - && ( _rURL.compareToAscii( URL_CONTROLLER_PREFIX, nPrefixLen ) == 0 ); - } -} - -//------------------------------------------------------------------------------ -sal_Int16 OButtonControl::getModelUrlFeatureId( ) const -{ - sal_Int16 nFeatureId = -1; - - // some URL related properties of the model - ::rtl::OUString sUrl; - FormButtonType eButtonType = FormButtonType_PUSH; - - Reference< XPropertySet > xModelProps( const_cast< OButtonControl* >( this )->getModel(), UNO_QUERY ); - if ( xModelProps.is() ) - { - xModelProps->getPropertyValue( PROPERTY_TARGET_URL ) >>= sUrl; - xModelProps->getPropertyValue( PROPERTY_BUTTONTYPE ) >>= eButtonType; - } - - // are we an URL button? - if ( eButtonType == FormButtonType_URL ) - { - // is it a feature URL? - if ( isFormControllerURL( sUrl ) ) - { - OFormNavigationMapper aMapper( m_aContext.getLegacyServiceFactory() ); - nFeatureId = aMapper.getFeatureId( sUrl ); - } - } - - return nFeatureId; -} - -//------------------------------------------------------------------ -void SAL_CALL OButtonControl::setDesignMode( sal_Bool _bOn ) throw( RuntimeException ) -{ - OClickableImageBaseControl::setDesignMode( _bOn ); - - if ( _bOn ) - disconnectDispatchers(); - else - connectDispatchers(); - // this will connect if not already connected and just update else -} - -//------------------------------------------------------------------------------ -void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) -{ - if ( -1 != m_nTargetUrlFeatureId ) - _rFeatureIds.push_back( m_nTargetUrlFeatureId ); -} - -//------------------------------------------------------------------ -void OButtonControl::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ) -{ - if ( _nFeatureId == m_nTargetUrlFeatureId ) - { - // enable or disable our peer, according to the new state - Reference< XVclWindowPeer > xPeer( getPeer(), UNO_QUERY ); - if ( xPeer.is() ) - xPeer->setProperty( PROPERTY_ENABLED, makeAny( m_bEnabledByPropertyValue ? _bEnabled : sal_False ) ); - // if we're disabled according to our model's property, then - // we don't care for the feature state, but *are* disabled. - // If the model's property states that we're enabled, then we *do* - // care for the feature state - } - - // base class - OFormNavigationHelper::featureStateChanged( _nFeatureId, _bEnabled ); -} - -//------------------------------------------------------------------ -void OButtonControl::allFeatureStatesChanged( ) -{ - if ( -1 != m_nTargetUrlFeatureId ) - // we have only one supported feature, so simulate it has changed ... - featureStateChanged( m_nTargetUrlFeatureId, isEnabled( m_nTargetUrlFeatureId ) ); - - // base class - OFormNavigationHelper::allFeatureStatesChanged( ); -} - -//------------------------------------------------------------------ -bool OButtonControl::isEnabled( sal_Int16 _nFeatureId ) const -{ - if ( const_cast< OButtonControl* >( this )->isDesignMode() ) - // TODO: the model property? - return true; - - return OFormNavigationHelper::isEnabled( _nFeatureId ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonControl::registerDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor ) throw (RuntimeException) -{ - OClickableImageBaseControl::registerDispatchProviderInterceptor( _rxInterceptor ); - OFormNavigationHelper::registerDispatchProviderInterceptor( _rxInterceptor ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OButtonControl::releaseDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor ) throw (RuntimeException) -{ - OClickableImageBaseControl::releaseDispatchProviderInterceptor( _rxInterceptor ); - OFormNavigationHelper::releaseDispatchProviderInterceptor( _rxInterceptor ); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx deleted file mode 100644 index b7a547637..000000000 --- a/forms/source/component/Button.hxx +++ /dev/null @@ -1,212 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FRM_BUTTON_HXX_ -#define _FRM_BUTTON_HXX_ - -#include "clickableimage.hxx" -#include "togglestate.hxx" -#include "formnavigation.hxx" -#include "resettable.hxx" - -#include -#include -#include -#include -#include -#include -#include - -#include - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OButtonModel -//================================================================== -typedef ::cppu::ImplHelper1 < ::com::sun::star::form::XReset - > OButtonModel_Base; -class OButtonModel :public OClickableImageBaseModel - ,public OButtonModel_Base -{ -public: - DECLARE_DEFAULT_LEAF_XTOR( OButtonModel ); - - // UNO - DECLARE_UNO3_AGG_DEFAULTS( OButtonModel, OClickableImageBaseModel ); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OButtonModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XReset - virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); - - // OControlModel's property handling - virtual void describeFixedProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps - ) const; - - // XPropertySet and friends - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - 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 ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - - // OComponentHelper - virtual void SAL_CALL disposing(); - -protected: - DECLARE_XCLONEABLE(); - -private: - void impl_resetNoBroadcast_nothrow(); - - using ::cppu::OPropertySetHelper::getFastPropertyValue; - -private: - ResetHelper m_aResetHelper; - - // - ToggleState m_eDefaultState; // the default check state - // -protected: - using OClickableImageBaseModel::disposing; -}; - -//================================================================== -// OButtonControl -//================================================================== -typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XButton - , ::com::sun::star::awt::XActionListener - , ::com::sun::star::beans::XPropertyChangeListener - > OButtonControl_BASE; - -class OButtonControl :public OButtonControl_BASE - ,public OClickableImageBaseControl - ,public OFormNavigationHelper -{ -private: - sal_uLong m_nClickEvent; - sal_Int16 m_nTargetUrlFeatureId; - /// caches the value of the "Enabled" property of our model - sal_Bool m_bEnabledByPropertyValue; - -protected: - - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OButtonControl(); - - // XServiceInfo - IMPLEMENTATION_NAME(OButtonControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OButtonControl, OClickableImageBaseControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - // XActionListener - virtual void SAL_CALL actionPerformed(const ::com::sun::star::awt::ActionEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException); - - // XButton - virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActionCommand(const ::rtl::OUString& _rCommand) throw(::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); - - // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - - // XControl - virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel ) throw ( ::com::sun::star::uno::RuntimeException ); - void SAL_CALL setDesignMode(sal_Bool bOn) throw (::com::sun::star::uno::RuntimeException); - -protected: - // OFormNavigationHelper overriables - virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ); - virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ); - virtual void allFeatureStatesChanged( ); - virtual bool isEnabled( sal_Int16 _nFeatureId ) const; - - // XDispatchProviderInterception disambiguaiton - virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); - - // OImageControl overridables - virtual void actionPerformed_Impl( sal_Bool bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt ); - -private: - DECL_LINK( OnClick, void* ); - - /** to be called whenever the feature URL represented by our model has potentially changed - */ - void modelFeatureUrlPotentiallyChanged( ); - - /** retrieves the feature id (see OFormNavigationHelper) of the TargetURL of - the model. - */ - sal_Int16 getModelUrlFeatureId( ) const; - - /** starts or stops listening for changes in model properties we're interested in - */ - void startOrStopModelPropertyListening( bool _bStart ); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -#endif // _FRM_BUTTON_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx deleted file mode 100644 index 45964f2b2..000000000 --- a/forms/source/component/CheckBox.cxx +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" -#include "CheckBox.hxx" -#include "property.hxx" -#include "property.hrc" -#include "services.hxx" -#include -#include - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::form::binding; - -//================================================================== -//= OCheckBoxControl -//================================================================== - -//------------------------------------------------------------------ -OCheckBoxControl::OCheckBoxControl(const Reference& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_CHECKBOX) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCheckBoxControl_CreateInstance(const Reference& _rxFactory) throw (RuntimeException) -{ - return *(new OCheckBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCheckBoxControl::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_CHECKBOX; - return aSupported; -} - -//================================================================== -//= OCheckBoxModel -//================================================================== - -//================================================================== -InterfaceRef SAL_CALL OCheckBoxModel_CreateInstance(const Reference& _rxFactory) throw (RuntimeException) -{ - return *(new OCheckBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( OCheckBoxModel ) -//------------------------------------------------------------------ -OCheckBoxModel::OCheckBoxModel(const Reference& _rxFactory) - :OReferenceValueComponent( _rxFactory, VCL_CONTROLMODEL_CHECKBOX, FRM_SUN_CONTROL_CHECKBOX, sal_True ) - // use the old control name for compytibility reasons -{ - DBG_CTOR( OCheckBoxModel, NULL ); - - m_nClassId = FormComponentType::CHECKBOX; - initValueProperty( PROPERTY_STATE, PROPERTY_ID_STATE ); -} - -//------------------------------------------------------------------ -OCheckBoxModel::OCheckBoxModel( const OCheckBoxModel* _pOriginal, const Reference& _rxFactory ) - :OReferenceValueComponent( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OCheckBoxModel, NULL ); -} - -//------------------------------------------------------------------------------ -OCheckBoxModel::~OCheckBoxModel() -{ - DBG_DTOR( OCheckBoxModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OCheckBoxModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCheckBoxModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OReferenceValueComponent::getSupportedServiceNames(); - - sal_Int32 nOldLen = aSupported.getLength(); - aSupported.realloc( nOldLen + 8 ); - ::rtl::OUString* pStoreTo = aSupported.getArray() + nOldLen; - - *pStoreTo++ = BINDABLE_CONTROL_MODEL; - *pStoreTo++ = DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_CONTROL_MODEL; - - *pStoreTo++ = BINDABLE_DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_BINDABLE_CONTROL_MODEL; - - *pStoreTo++ = FRM_SUN_COMPONENT_CHECKBOX; - *pStoreTo++ = FRM_SUN_COMPONENT_DATABASE_CHECKBOX; - *pStoreTo++ = BINDABLE_DATABASE_CHECK_BOX; - - return aSupported; -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::describeFixedProperties( Sequence< Property >& _rProps ) const -{ - BEGIN_DESCRIBE_PROPERTIES( 1, OReferenceValueComponent ) - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - END_DESCRIBE_PROPERTIES(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OCheckBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_CHECKBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OCheckBoxModel::write(const Reference& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OReferenceValueComponent::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0003); - // Properties - _rxOutStream << getReferenceValue(); - _rxOutStream << (sal_Int16)getDefaultChecked(); - writeHelpTextCompatibly(_rxOutStream); - // from version 0x0003 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OCheckBoxModel::read(const Reference& _rxInStream) throw(stario::IOException, RuntimeException) -{ - OReferenceValueComponent::read(_rxInStream); - osl::MutexGuard aGuard(m_aMutex); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - - ::rtl::OUString sReferenceValue; - sal_Int16 nDefaultChecked( 0 ); - switch ( nVersion ) - { - case 0x0001: - _rxInStream >> sReferenceValue; - nDefaultChecked = _rxInStream->readShort(); - break; - case 0x0002: - _rxInStream >> sReferenceValue; - _rxInStream >> nDefaultChecked; - readHelpTextCompatibly( _rxInStream ); - break; - case 0x0003: - _rxInStream >> sReferenceValue; - _rxInStream >> nDefaultChecked; - readHelpTextCompatibly(_rxInStream); - readCommonProperties(_rxInStream); - break; - default: - OSL_FAIL("OCheckBoxModel::read : unknown version !"); - defaultCommonProperties(); - break; - } - setReferenceValue( sReferenceValue ); - setDefaultChecked( static_cast< ToggleState >( nDefaultChecked ) ); - - // Nach dem Lesen die Defaultwerte anzeigen - if ( getControlSource().getLength() ) - // (not if we don't have a control source - the "State" property acts like it is persistent, then - resetNoBroadcast(); -} - -//------------------------------------------------------------------------------ -Any OCheckBoxModel::translateDbColumnToControlValue() -{ - Any aValue; - - ////////////////////////////////////////////////////////////////// - // Wert an ControlModel setzen - sal_Bool bValue = m_xColumn->getBoolean(); - if ( m_xColumn->wasNull() ) - { - sal_Bool bTriState = sal_True; - if ( m_xAggregateSet.is() ) - m_xAggregateSet->getPropertyValue( PROPERTY_TRISTATE ) >>= bTriState; - aValue <<= (sal_Int16)( bTriState ? STATE_DONTKNOW : getDefaultChecked() ); - } - else - aValue <<= (sal_Int16)( bValue ? STATE_CHECK : STATE_NOCHECK ); - - return aValue; -} - -//----------------------------------------------------------------------------- -sal_Bool OCheckBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) -{ - OSL_PRECOND( m_xColumnUpdate.is(), "OCheckBoxModel::commitControlValueToDbColumn: not bound!" ); - if ( m_xColumnUpdate.is() ) - { - Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) ); - try - { - sal_Int16 nValue = STATE_DONTKNOW; - aControlValue >>= nValue; - switch (nValue) - { - case STATE_DONTKNOW: - m_xColumnUpdate->updateNull(); - break; - case STATE_CHECK: - m_xColumnUpdate->updateBoolean( sal_True ); - break; - case STATE_NOCHECK: - m_xColumnUpdate->updateBoolean( sal_False ); - break; - default: - OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: invalid value !"); - } - } - catch(Exception&) - { - OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: could not commit !"); - } - } - return sal_True; -} - -//......................................................................... -} -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/CheckBox.hxx b/forms/source/component/CheckBox.hxx deleted file mode 100644 index 6ae342c40..000000000 --- a/forms/source/component/CheckBox.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FORMS_CHECKBOX_HXX_ -#define _FORMS_CHECKBOX_HXX_ - -#include "refvaluecomponent.hxx" - -//......................................................................... -namespace frm -{ - -//================================================================== -//= OCheckBoxModel -//================================================================== -class OCheckBoxModel :public OReferenceValueComponent -{ -protected: - sal_Int16 getState(const ::com::sun::star::uno::Any& rValue); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OCheckBoxModel ); - - // XServiceInfo - IMPLEMENTATION_NAME(OCheckBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // OControlModel's property handling - virtual void describeFixedProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps - ) const; - -protected: - DECLARE_XCLONEABLE(); - - // OBoundControlModel overridables - virtual ::com::sun::star::uno::Any - translateDbColumnToControlValue( ); - virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); -}; - -//================================================================== -//= OCheckBoxControl -//================================================================== -class OCheckBoxControl : public OBoundControl -{ -public: - OCheckBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(OCheckBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -#endif // _FORMS_CHECKBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx deleted file mode 100644 index c30c0a06e..000000000 --- a/forms/source/component/Columns.cxx +++ /dev/null @@ -1,602 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" -#include "Columns.hxx" -#include "property.hrc" -#include "property.hxx" -#include "componenttools.hxx" -#include "ids.hxx" -#include "findpos.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "services.hxx" -#include "frm_resource.hrc" -#include -#include - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::text; -using namespace ::com::sun::star::form::binding; - -const sal_uInt16 WIDTH = 0x0001; -const sal_uInt16 ALIGN = 0x0002; -const sal_uInt16 OLD_HIDDEN = 0x0004; -const sal_uInt16 COMPATIBLE_HIDDEN = 0x0008; - -//------------------------------------------------------------------------------ -const StringSequence& getColumnTypes() -{ - static StringSequence aColumnTypes(10); - if (!aColumnTypes.getConstArray()[0].getLength()) - { - ::rtl::OUString* pNames = aColumnTypes.getArray(); - pNames[TYPE_CHECKBOX] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ) ); - pNames[TYPE_COMBOBOX] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ) ); - pNames[TYPE_CURRENCYFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencyField" ) ); - pNames[TYPE_DATEFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateField" ) ); - pNames[TYPE_FORMATTEDFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormattedField" ) ); - pNames[TYPE_LISTBOX] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ) ); - pNames[TYPE_NUMERICFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumericField" ) ); - pNames[TYPE_PATTERNFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PatternField" ) ); - pNames[TYPE_TEXTFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ); - pNames[TYPE_TIMEFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeField" ) ); - } - return aColumnTypes; -} - -//------------------------------------------------------------------------------ -sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName) -{ - const ::rtl::OUString aModelPrefix (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.") ); - const ::rtl::OUString aCompatibleModelPrefix (RTL_CONSTASCII_USTRINGPARAM("stardiv.one.form.component.") ); - - sal_Int32 nTypeId = -1; - if (aModelName == FRM_COMPONENT_EDIT) - nTypeId = TYPE_TEXTFIELD; - else - { - sal_Int32 nPrefixPos = aModelName.indexOf(aModelPrefix); -#ifdef DBG_UTIL - sal_Int32 nCompatiblePrefixPos = aModelName.indexOf(aCompatibleModelPrefix); -#endif - DBG_ASSERT( (nPrefixPos != -1) || (nCompatiblePrefixPos != -1), - "::getColumnTypeByModelName() : wrong servivce !"); - - ::rtl::OUString aColumnType = (nPrefixPos != -1) - ? aModelName.copy(aModelPrefix.getLength()) - : aModelName.copy(aCompatibleModelPrefix.getLength()); - - const StringSequence& rColumnTypes = getColumnTypes(); - nTypeId = ::detail::findPos(aColumnType, rColumnTypes); - } - return nTypeId; -} - -/*************************************************************************/ - -namespace -{ - class theOGridColumnImplementationId : public rtl::Static< UnoTunnelIdInit, theOGridColumnImplementationId > {}; -} - -const Sequence& OGridColumn::getUnoTunnelImplementationId() -{ - return theOGridColumnImplementationId::get().getSeq(); -} - -//------------------------------------------------------------------ -sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence& _rIdentifier) throw(RuntimeException) -{ - sal_Int64 nReturn(0); - - if ( (_rIdentifier.getLength() == 16) - && (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 )) - ) - { - nReturn = reinterpret_cast(this); - } - else - { - Reference< XUnoTunnel > xAggTunnel; - if ( query_aggregation( m_xAggregate, xAggTunnel ) ) - return xAggTunnel->getSomething( _rIdentifier ); - } - return nReturn; -} - -//------------------------------------------------------------------ -Sequence SAL_CALL OGridColumn::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------ -Sequence SAL_CALL OGridColumn::getTypes() throw(RuntimeException) -{ - TypeBag aTypes( OGridColumn_BASE::getTypes() ); - // erase the types which we do not support - aTypes.removeType( XFormComponent::static_type() ); - aTypes.removeType( XServiceInfo::static_type() ); - aTypes.removeType( XBindableValue::static_type() ); - aTypes.removeType( XPropertyContainer::static_type() ); - - // but re-add their base class(es) - aTypes.addType( XChild::static_type() ); - - Reference< XTypeProvider > xProv; - if ( query_aggregation( m_xAggregate, xProv )) - aTypes.addTypes( xProv->getTypes() ); - - aTypes.removeType( XTextRange::static_type() ); - aTypes.removeType( XSimpleText::static_type() ); - aTypes.removeType( XText::static_type() ); - - return aTypes.getTypes(); -} - -//------------------------------------------------------------------ -Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn; - // some functionality at our aggregate cannot be reasonably fullfilled here. - if ( _rType.equals(::getCppuType(static_cast< Reference< XFormComponent >* >(NULL))) - || _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) - || _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL))) - || _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL))) - || comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType) - ) - return aReturn; - - aReturn = OGridColumn_BASE::queryAggregation(_rType); - if (!aReturn.hasValue()) - { - aReturn = OPropertySetAggregationHelper::queryInterface(_rType); - if (!aReturn.hasValue() && m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - - return aReturn; -} - -DBG_NAME(OGridColumn); -//------------------------------------------------------------------------------ -OGridColumn::OGridColumn( const comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName ) - :OGridColumn_BASE(m_aMutex) - ,OPropertySetAggregationHelper(OGridColumn_BASE::rBHelper) - ,m_aHidden( makeAny( sal_False ) ) - ,m_aContext( _rContext ) - ,m_aModelName(_sModelName) -{ - DBG_CTOR(OGridColumn,NULL); - - // Anlegen des UnoControlModels - if ( m_aModelName.getLength() ) // is there a to-be-aggregated model? - { - increment( m_refCount ); - - { - m_xAggregate.set( m_aContext.createComponent( m_aModelName ), UNO_QUERY ); - setAggregation( m_xAggregate ); - } - - if ( m_xAggregate.is() ) - { // don't omit those brackets - they ensure that the following temporary is properly deleted - m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) ); - } - - // Refcount wieder bei NULL - decrement( m_refCount ); - } -} - -//------------------------------------------------------------------------------ -OGridColumn::OGridColumn( const OGridColumn* _pOriginal ) - :OGridColumn_BASE( m_aMutex ) - ,OPropertySetAggregationHelper( OGridColumn_BASE::rBHelper ) - ,m_aContext( _pOriginal->m_aContext ) -{ - DBG_CTOR(OGridColumn,NULL); - - m_aWidth = _pOriginal->m_aWidth; - m_aAlign = _pOriginal->m_aAlign; - m_aHidden = _pOriginal->m_aHidden; - m_aModelName = _pOriginal->m_aModelName; - m_aLabel = _pOriginal->m_aLabel; - - increment( m_refCount ); - { - { - m_xAggregate = createAggregateClone( _pOriginal ); - setAggregation( m_xAggregate ); - } - - if ( m_xAggregate.is() ) - { // don't omit this brackets - they ensure that the following temporary is properly deleted - m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) ); - } - } - decrement( m_refCount ); -} - -//------------------------------------------------------------------------------ -OGridColumn::~OGridColumn() -{ - if (!OGridColumn_BASE::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - // freigeben der Agg - if (m_xAggregate.is()) - { - InterfaceRef xIface; - m_xAggregate->setDelegator(xIface); - } - - DBG_DTOR(OGridColumn,NULL); -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::disposing(const EventObject& _rSource) throw(RuntimeException) -{ - OPropertySetAggregationHelper::disposing(_rSource); - - Reference xEvtLstner; - if (query_aggregation(m_xAggregate, xEvtLstner)) - xEvtLstner->disposing(_rSource); -} - -// OGridColumn_BASE -//----------------------------------------------------------------------------- -void OGridColumn::disposing() -{ - OGridColumn_BASE::disposing(); - OPropertySetAggregationHelper::disposing(); - - Reference xComp; - if (query_aggregation(m_xAggregate, xComp)) - xComp->dispose(); -} - -//------------------------------------------------------------------------------ -void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_Bool bAllowDropDown ) -{ - // some properties are not to be exposed to the outer world - ::std::set< ::rtl::OUString > aForbiddenProperties; - aForbiddenProperties.insert( PROPERTY_ALIGN ); - aForbiddenProperties.insert( PROPERTY_AUTOCOMPLETE ); - aForbiddenProperties.insert( PROPERTY_BACKGROUNDCOLOR ); - aForbiddenProperties.insert( PROPERTY_BORDER ); - aForbiddenProperties.insert( PROPERTY_BORDERCOLOR ); - aForbiddenProperties.insert( PROPERTY_ECHO_CHAR ); - aForbiddenProperties.insert( PROPERTY_FILLCOLOR ); - aForbiddenProperties.insert( PROPERTY_FONT ); - aForbiddenProperties.insert( PROPERTY_FONT_NAME ); - aForbiddenProperties.insert( PROPERTY_FONT_STYLENAME ); - aForbiddenProperties.insert( PROPERTY_FONT_FAMILY ); - aForbiddenProperties.insert( PROPERTY_FONT_CHARSET ); - aForbiddenProperties.insert( PROPERTY_FONT_HEIGHT ); - aForbiddenProperties.insert( PROPERTY_FONT_WEIGHT ); - aForbiddenProperties.insert( PROPERTY_FONT_SLANT ); - aForbiddenProperties.insert( PROPERTY_FONT_UNDERLINE ); - aForbiddenProperties.insert( PROPERTY_FONT_STRIKEOUT ); - aForbiddenProperties.insert( PROPERTY_FONT_WORDLINEMODE ); - aForbiddenProperties.insert( PROPERTY_TEXTLINECOLOR ); - aForbiddenProperties.insert( PROPERTY_FONTEMPHASISMARK ); - aForbiddenProperties.insert( PROPERTY_FONTRELIEF ); - aForbiddenProperties.insert( PROPERTY_HARDLINEBREAKS ); - aForbiddenProperties.insert( PROPERTY_HSCROLL ); - aForbiddenProperties.insert( PROPERTY_LABEL ); - aForbiddenProperties.insert( PROPERTY_LINECOLOR ); - aForbiddenProperties.insert( PROPERTY_MULTISELECTION ); - aForbiddenProperties.insert( PROPERTY_PRINTABLE ); - aForbiddenProperties.insert( PROPERTY_TABINDEX ); - aForbiddenProperties.insert( PROPERTY_TABSTOP ); - aForbiddenProperties.insert( PROPERTY_TEXTCOLOR ); - aForbiddenProperties.insert( PROPERTY_VSCROLL ); - aForbiddenProperties.insert( PROPERTY_CONTROLLABEL ); - aForbiddenProperties.insert( PROPERTY_RICH_TEXT ); - aForbiddenProperties.insert( PROPERTY_VERTICAL_ALIGN ); - aForbiddenProperties.insert( PROPERTY_IMAGE_URL ); - aForbiddenProperties.insert( PROPERTY_IMAGE_POSITION ); - aForbiddenProperties.insert( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) ); - if ( !bAllowDropDown ) - aForbiddenProperties.insert( PROPERTY_DROPDOWN ); - - Sequence< Property > aNewProps( _rProps.getLength() ); - Property* pNewProps = aNewProps.getArray(); - - const Property* pProps = _rProps.getConstArray(); - const Property* pPropsEnd = pProps + _rProps.getLength(); - for ( ; pProps != pPropsEnd; ++pProps ) - { - if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end() ) - *pNewProps++ = *pProps; - } - - aNewProps.realloc( pNewProps - aNewProps.getArray() ); - _rProps = aNewProps; -} - -//------------------------------------------------------------------------------ -void OGridColumn::setOwnProperties(Sequence& aDescriptor) -{ - aDescriptor.realloc(5); - Property* pProperties = aDescriptor.getArray(); - DECL_PROP1(LABEL, ::rtl::OUString, BOUND); - DECL_PROP3(WIDTH, sal_Int32, BOUND, MAYBEVOID, MAYBEDEFAULT); - DECL_PROP3(ALIGN, sal_Int16, BOUND, MAYBEVOID, MAYBEDEFAULT); - DECL_BOOL_PROP2(HIDDEN, BOUND, MAYBEDEFAULT); - DECL_PROP1(COLUMNSERVICENAME, ::rtl::OUString, READONLY); -} - -// Reference -//------------------------------------------------------------------------------ -void OGridColumn::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_COLUMNSERVICENAME: - rValue <<= m_aModelName; - break; - case PROPERTY_ID_LABEL: - rValue <<= m_aLabel; - break; - case PROPERTY_ID_WIDTH: - rValue = m_aWidth; - break; - case PROPERTY_ID_ALIGN: - rValue = m_aAlign; - break; - case PROPERTY_ID_HIDDEN: - rValue = m_aHidden; - break; - default: - OPropertySetAggregationHelper::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, - sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException ) -{ - sal_Bool bModified(sal_False); - switch (nHandle) - { - case PROPERTY_ID_LABEL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aLabel); - break; - case PROPERTY_ID_WIDTH: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL)); - break; - case PROPERTY_ID_ALIGN: - bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType( (const sal_Int32*)NULL ) ); - // strange enough, css.awt.TextAlign is a 32-bit integer, while the Align property (both here for grid controls - // and for ordinary toolkit controls) is a 16-bit integer. So, allow for 32 bit, but normalize it to 16 bit - if ( bModified ) - { - sal_Int32 nAlign( 0 ); - if ( rConvertedValue >>= nAlign ) - rConvertedValue <<= (sal_Int16)nAlign; - } - break; - case PROPERTY_ID_HIDDEN: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getBOOL(m_aHidden)); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OGridColumn::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_LABEL: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" ); - rValue >>= m_aLabel; - break; - case PROPERTY_ID_WIDTH: - m_aWidth = rValue; - break; - case PROPERTY_ID_ALIGN: - m_aAlign = rValue; - break; - case PROPERTY_ID_HIDDEN: - m_aHidden = rValue; - break; - } -} - - -// XPropertyState -//------------------------------------------------------------------------------ -Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_WIDTH: - case PROPERTY_ID_ALIGN: - return Any(); - case PROPERTY_ID_HIDDEN: - return makeAny((sal_Bool)sal_False); - default: - return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle); - } -} - -// XCloneable -//------------------------------------------------------------------------------ -Reference< XCloneable > SAL_CALL OGridColumn::createClone( ) throw (RuntimeException) -{ - OGridColumn* pNewColumn = createCloneColumn(); - return pNewColumn; -} - -//XPersistObject -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::write(const Reference& _rxOutStream) -{ - // 1. Schreiben des UnoControls - Reference xMark(_rxOutStream, UNO_QUERY); - sal_Int32 nMark = xMark->createMark(); - - sal_Int32 nLen = 0; - _rxOutStream->writeLong(nLen); - - Reference xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->write(_rxOutStream); - - // feststellen der Laenge - nLen = xMark->offsetToMark(nMark) - 4; - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); - - // 2. Schreiben einer VersionsNummer - _rxOutStream->writeShort(0x0002); - - sal_uInt16 nAnyMask = 0; - if (m_aWidth.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= WIDTH; - - if (m_aAlign.getValueTypeClass() == TypeClass_SHORT) - nAnyMask |= ALIGN; - - nAnyMask |= COMPATIBLE_HIDDEN; - - _rxOutStream->writeShort(nAnyMask); - - if (nAnyMask & WIDTH) - _rxOutStream->writeLong(getINT32(m_aWidth)); - if (nAnyMask & ALIGN) - _rxOutStream->writeShort(getINT16(m_aAlign)); - - // Name - _rxOutStream << m_aLabel; - - // the new place for the hidden flag : after m_aLabel, so older office version read the correct label, too - if (nAnyMask & COMPATIBLE_HIDDEN) - _rxOutStream->writeBoolean(getBOOL(m_aHidden)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::read(const Reference& _rxInStream) -{ - // 1. Lesen des UnoControls - sal_Int32 nLen = _rxInStream->readLong(); - if (nLen) - { - Reference xMark(_rxInStream, UNO_QUERY); - sal_Int32 nMark = xMark->createMark(); - Reference xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->read(_rxInStream); - - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nLen); - xMark->deleteMark(nMark); - } - - // 2. Lesen des Versionsnummer - sal_uInt16 nVersion = _rxInStream->readShort(); (void)nVersion; - sal_uInt16 nAnyMask = _rxInStream->readShort(); - - if (nAnyMask & WIDTH) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aWidth <<= (sal_Int32)nValue; - } - - if (nAnyMask & ALIGN) - { - sal_Int16 nValue = _rxInStream->readShort(); - m_aAlign <<= nValue; - } - if (nAnyMask & OLD_HIDDEN) - { - sal_Bool bValue = _rxInStream->readBoolean(); - m_aHidden <<= (sal_Bool)bValue; - } - - // Name - _rxInStream >> m_aLabel; - - if (nAnyMask & COMPATIBLE_HIDDEN) - { - sal_Bool bValue = _rxInStream->readBoolean(); - m_aHidden <<= (sal_Bool)bValue; - } -} - -//------------------------------------------------------------------------------ -IMPL_COLUMN(TextFieldColumn, FRM_SUN_COMPONENT_TEXTFIELD, sal_False); -IMPL_COLUMN(PatternFieldColumn, FRM_SUN_COMPONENT_PATTERNFIELD, sal_False); -IMPL_COLUMN(DateFieldColumn, FRM_SUN_COMPONENT_DATEFIELD, sal_True); -IMPL_COLUMN(TimeFieldColumn, FRM_SUN_COMPONENT_TIMEFIELD, sal_False); -IMPL_COLUMN(NumericFieldColumn, FRM_SUN_COMPONENT_NUMERICFIELD, sal_False); -IMPL_COLUMN(CurrencyFieldColumn, FRM_SUN_COMPONENT_CURRENCYFIELD, sal_False); -IMPL_COLUMN(CheckBoxColumn, FRM_SUN_COMPONENT_CHECKBOX, sal_False); -IMPL_COLUMN(ComboBoxColumn, FRM_SUN_COMPONENT_COMBOBOX, sal_False); -IMPL_COLUMN(ListBoxColumn, FRM_SUN_COMPONENT_LISTBOX, sal_False); -IMPL_COLUMN(FormattedFieldColumn, FRM_SUN_COMPONENT_FORMATTEDFIELD, sal_False); - -//......................................................................... -} // namespace frm -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Columns.hxx b/forms/source/component/Columns.hxx deleted file mode 100644 index 76c526cdc..000000000 --- a/forms/source/component/Columns.hxx +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FRM_COLUMNS_HXX -#define _FRM_COLUMNS_HXX - -#include "cloneable.hxx" -#include "frm_strings.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include - -using namespace comphelper; - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OGridColumn -//================================================================== -typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::lang::XUnoTunnel - , ::com::sun::star::util::XCloneable > OGridColumn_BASE; -class OGridColumn :public ::comphelper::OBaseMutex - ,public OGridColumn_BASE - ,public OPropertySetAggregationHelper - ,public OCloneableAggregation -{ -protected: -// [properties] - ::com::sun::star::uno::Any m_aWidth; // column width - ::com::sun::star::uno::Any m_aAlign; // column alignment - ::com::sun::star::uno::Any m_aHidden; // column hidden? -// [properties] - - ::comphelper::ComponentContext m_aContext; - ::rtl::OUString m_aModelName; - -// [properties] - ::rtl::OUString m_aLabel; // Name der Spalte -// [properties] - -public: - OGridColumn(const ::comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName = ::rtl::OUString()); - OGridColumn(const OGridColumn* _pOriginal ); - virtual ~OGridColumn(); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - - static const ::com::sun::star::uno::Sequence& getUnoTunnelImplementationId(); - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence& _rIdentifier) throw(::com::sun::star::uno::RuntimeException); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); - - // XPropertySet - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0; - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - 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 OPropertySetAggregationHelper::getFastPropertyValue; - - // ::com::sun::star::beans::XPropertyState - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - - // XCloneable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); - - const ::rtl::OUString& getModelName() const { return m_aModelName; } - -protected: - static void clearAggregateProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps, sal_Bool bAllowDropDown); - static void setOwnProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps); - - virtual OGridColumn* createCloneColumn() const = 0; -}; - -#define DECL_COLUMN(ClassName) \ -class ClassName \ - :public OGridColumn \ - ,public OAggregationArrayUsageHelper< ClassName > \ -{ \ -public: \ - ClassName(const ::comphelper::ComponentContext& _rContext ); \ - ClassName(const ClassName* _pCloneFrom); \ - \ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \ - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ - \ - virtual void fillProperties( \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ - ) const; \ - \ - virtual OGridColumn* createCloneColumn() const; \ -}; - - -#define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \ - ClassName::ClassName( const ::comphelper::ComponentContext& _rContext ) \ - :OGridColumn(_rContext, Model) \ -{ \ -} \ -ClassName::ClassName( const ClassName* _pCloneFrom ) \ - :OGridColumn( _pCloneFrom ) \ -{ \ -} \ -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> ClassName::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) \ -{ \ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \ - return xInfo; \ -} \ -::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \ -{ \ - return *const_cast(this)->getArrayHelper(); \ -} \ -void ClassName::fillProperties( \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ - ) const \ -{ \ - if (m_xAggregateSet.is()) \ - { \ - _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \ - clearAggregateProperties(_rAggregateProps, bAllowDropDown); \ - setOwnProperties(_rProps); \ - } \ -} \ -OGridColumn* ClassName::createCloneColumn() const \ -{ \ - return new ClassName( this ); \ -} \ - \ -// column type ids -#define TYPE_CHECKBOX 0 -#define TYPE_COMBOBOX 1 -#define TYPE_CURRENCYFIELD 2 -#define TYPE_DATEFIELD 3 -#define TYPE_FORMATTEDFIELD 4 -#define TYPE_LISTBOX 5 -#define TYPE_NUMERICFIELD 6 -#define TYPE_PATTERNFIELD 7 -#define TYPE_TEXTFIELD 8 -#define TYPE_TIMEFIELD 9 - -// liste aller bekannten columns -const StringSequence& getColumnTypes(); -sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName); - -// Columns -DECL_COLUMN(TextFieldColumn) -DECL_COLUMN(PatternFieldColumn) -DECL_COLUMN(DateFieldColumn) -DECL_COLUMN(TimeFieldColumn) -DECL_COLUMN(NumericFieldColumn) -DECL_COLUMN(CurrencyFieldColumn) -DECL_COLUMN(CheckBoxColumn) -DECL_COLUMN(ComboBoxColumn) -DECL_COLUMN(ListBoxColumn) -DECL_COLUMN(FormattedFieldColumn) - -#endif // _FRM_COLUMNS_HXX - -//......................................................................... -} // namespace frm -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx deleted file mode 100644 index a944de753..000000000 --- a/forms/source/component/ComboBox.cxx +++ /dev/null @@ -1,916 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include "ComboBox.hxx" -#include "property.hxx" -#include "property.hrc" -#include "services.hxx" - -#include "frm_resource.hxx" -#include "frm_resource.hrc" -#include "BaseListBox.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace dbtools; - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::form::binding; - -//======================================================================== -// class OComboBoxModel -//======================================================================== -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OComboBoxModel_CreateInstance(const Reference& _rxFactory) throw (RuntimeException) -{ - return (*new OComboBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence OComboBoxModel::_getTypes() -{ - return ::comphelper::concatSequences( - OBoundControlModel::_getTypes(), - OEntryListHelper::getTypes(), - OErrorBroadcaster::getTypes() - ); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OComboBoxModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - - sal_Int32 nOldLen = aSupported.getLength(); - aSupported.realloc( nOldLen + 8 ); - ::rtl::OUString* pStoreTo = aSupported.getArray() + nOldLen; - - *pStoreTo++ = BINDABLE_CONTROL_MODEL; - *pStoreTo++ = DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_CONTROL_MODEL; - - *pStoreTo++ = BINDABLE_DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_BINDABLE_CONTROL_MODEL; - - *pStoreTo++ = FRM_SUN_COMPONENT_COMBOBOX; - *pStoreTo++ = FRM_SUN_COMPONENT_DATABASE_COMBOBOX; - *pStoreTo++ = BINDABLE_DATABASE_COMBO_BOX; - - return aSupported; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OComboBoxModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControlModel::queryAggregation( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OEntryListHelper::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OErrorBroadcaster::queryInterface( _rType ); - return aReturn; -} - -//------------------------------------------------------------------ -DBG_NAME( OComboBoxModel ) -//------------------------------------------------------------------ -OComboBoxModel::OComboBoxModel(const Reference& _rxFactory) - :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX, sal_True, sal_True, sal_True ) - // use the old control name for compytibility reasons - ,OEntryListHelper( (OControlModel&)*this ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aListRowSet( getContext() ) - ,m_eListSourceType(ListSourceType_TABLE) - ,m_bEmptyIsNull(sal_True) -{ - DBG_CTOR( OComboBoxModel, NULL ); - - m_nClassId = FormComponentType::COMBOBOX; - initValueProperty( PROPERTY_TEXT, PROPERTY_ID_TEXT ); -} - -//------------------------------------------------------------------ -OComboBoxModel::OComboBoxModel( const OComboBoxModel* _pOriginal, const Reference& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory ) - ,OEntryListHelper( *_pOriginal, (OControlModel&)*this ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aListRowSet( getContext() ) - ,m_aListSource( _pOriginal->m_aListSource ) - ,m_aDefaultText( _pOriginal->m_aDefaultText ) - ,m_eListSourceType( _pOriginal->m_eListSourceType ) - ,m_bEmptyIsNull( _pOriginal->m_bEmptyIsNull ) -{ - DBG_CTOR( OComboBoxModel, NULL ); -} - -//------------------------------------------------------------------ -OComboBoxModel::~OComboBoxModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR( OComboBoxModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OComboBoxModel ) - -//------------------------------------------------------------------------------ -void OComboBoxModel::disposing() -{ - OBoundControlModel::disposing(); - OEntryListHelper::disposing(); - OErrorBroadcaster::disposing(); - m_xFormatter = NULL; -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const -{ - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE: - _rValue <<= m_eListSourceType; - break; - - case PROPERTY_ID_LISTSOURCE: - _rValue <<= m_aListSource; - break; - - case PROPERTY_ID_EMPTY_IS_NULL: - _rValue <<= m_bEmptyIsNull; - break; - - case PROPERTY_ID_DEFAULT_TEXT: - _rValue <<= m_aDefaultText; - break; - - case PROPERTY_ID_STRINGITEMLIST: - _rValue <<= getStringItemList(); - break; - - default: - OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); - } -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) - throw (Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast(NULL))), - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_eListSourceType; - break; - - case PROPERTY_ID_LISTSOURCE : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aListSource; - // die ListSource hat sich geaendert -> neu laden - if (ListSourceType_VALUELIST != m_eListSourceType) - { - if ( m_xCursor.is() && !hasField() && !hasExternalListSource() ) - // combo box is already connected to a database, and no external list source - // data source changed -> refresh - loadData( false ); - } - break; - - case PROPERTY_ID_EMPTY_IS_NULL : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_bEmptyIsNull; - break; - - case PROPERTY_ID_DEFAULT_TEXT : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aDefaultText; - resetNoBroadcast(); - break; - - case PROPERTY_ID_STRINGITEMLIST: - { - ControlModelLock aLock( *this ); - setNewStringItemList( _rValue, aLock ); - // TODO: this is bogus. setNewStringItemList expects a guard which has the *only* - // lock to the mutex, but setFastPropertyValue_NoBroadcast is already called with - // a lock - so we effectively has two locks here, of which setNewStringItemList can - // only control one. - } - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OComboBoxModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE : - bModified = tryPropertyValueEnum(_rConvertedValue, _rOldValue, _rValue, m_eListSourceType); - break; - - case PROPERTY_ID_LISTSOURCE : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aListSource); - break; - - case PROPERTY_ID_EMPTY_IS_NULL : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bEmptyIsNull); - break; - - case PROPERTY_ID_DEFAULT_TEXT : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aDefaultText); - break; - - case PROPERTY_ID_STRINGITEMLIST: - bModified = convertNewListSourceProperty( _rConvertedValue, _rOldValue, _rValue ); - break; - - default: - bModified = OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::describeFixedProperties( Sequence< Property >& _rProps ) const -{ - BEGIN_DESCRIBE_PROPERTIES( 6, OBoundControlModel ) - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(LISTSOURCETYPE, ListSourceType, BOUND); - DECL_PROP1(LISTSOURCE, ::rtl::OUString, BOUND); - DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND); - DECL_PROP1(DEFAULT_TEXT, ::rtl::OUString, BOUND); - DECL_PROP1(STRINGITEMLIST, Sequence< ::rtl::OUString >,BOUND); - END_DESCRIBE_PROPERTIES(); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const -{ - OBoundControlModel::describeAggregateProperties( _rAggregateProps ); - - // superseded properties: - RemoveProperty( _rAggregateProps, PROPERTY_STRINGITEMLIST ); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OComboBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_COMBOBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::write(const Reference& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Version - // Version 0x0002: EmptyIsNull - // Version 0x0003: ListSource->Seq - // Version 0x0004: DefaultText - // Version 0x0005: HelpText - _rxOutStream->writeShort(0x0006); - - // Maskierung fuer any - sal_uInt16 nAnyMask = 0; - if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT) - nAnyMask |= BOUNDCOLUMN; - _rxOutStream << nAnyMask; - - StringSequence aListSourceSeq(&m_aListSource, 1); - _rxOutStream << aListSourceSeq; - _rxOutStream << (sal_Int16)m_eListSourceType; - - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nBoundColumn = 0; - m_aBoundColumn >>= nBoundColumn; - _rxOutStream << nBoundColumn; - } - - _rxOutStream << (sal_Bool)m_bEmptyIsNull; - _rxOutStream << m_aDefaultText; - writeHelpTextCompatibly(_rxOutStream); - - // from version 0x0006 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::read(const Reference& _rxInStream) throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - ControlModelLock aLock( *this ); - - // since we are "overwriting" the StringItemList of our aggregate (means we have - // an own place to store the value, instead of relying on our aggregate storing it), - // we need to respect what the aggregate just read for the StringItemList property. - try - { - if ( m_xAggregateSet.is() ) - setNewStringItemList( m_xAggregateSet->getPropertyValue( PROPERTY_STRINGITEMLIST ), aLock ); - } - catch( const Exception& ) - { - OSL_FAIL( "OComboBoxModel::read: caught an exception while examining the aggregate's string item list!" ); - } - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - DBG_ASSERT(nVersion > 0, "OComboBoxModel::read : version 0 ? this should never have been written !"); - - if (nVersion > 0x0006) - { - OSL_FAIL("OComboBoxModel::read : invalid (means unknown) version !"); - m_aListSource = ::rtl::OUString(); - m_aBoundColumn <<= (sal_Int16)0; - m_aDefaultText = ::rtl::OUString(); - m_eListSourceType = ListSourceType_TABLE; - m_bEmptyIsNull = sal_True; - defaultCommonProperties(); - return; - } - - // Maskierung fuer any - sal_uInt16 nAnyMask; - _rxInStream >> nAnyMask; - - // ListSource - if (nVersion < 0x0003) - { - ::rtl::OUString sListSource; - _rxInStream >> m_aListSource; - } - else // nVersion == 4 - { - m_aListSource = ::rtl::OUString(); - StringSequence aListSource; - _rxInStream >> aListSource; - const ::rtl::OUString* pToken = aListSource.getConstArray(); - sal_Int32 nLen = aListSource.getLength(); - for (sal_Int32 i = 0; i < nLen; ++i, ++pToken) - m_aListSource += *pToken; - } - - sal_Int16 nListSourceType; - _rxInStream >> nListSourceType; - m_eListSourceType = (ListSourceType)nListSourceType; - - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nValue; - _rxInStream >> nValue; - m_aBoundColumn <<= nValue; - } - - if (nVersion > 0x0001) - { - sal_Bool bNull; - _rxInStream >> bNull; - m_bEmptyIsNull = bNull; - } - - if (nVersion > 0x0003) // nVersion == 4 - _rxInStream >> m_aDefaultText; - - // Stringliste muss geleert werden, wenn eine Listenquelle gesetzt ist - // dieses kann der Fall sein wenn im alive modus gespeichert wird - if ( m_aListSource.getLength() - && !hasExternalListSource() - ) - { - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( StringSequence() ) ); - } - - if (nVersion > 0x0004) - readHelpTextCompatibly(_rxInStream); - - if (nVersion > 0x0005) - readCommonProperties(_rxInStream); - - // Nach dem Lesen die Defaultwerte anzeigen - if ( getControlSource().getLength() ) - { - // (not if we don't have a control source - the "State" property acts like it is persistent, then - resetNoBroadcast(); - } -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::loadData( bool _bForce ) -{ - DBG_ASSERT(m_eListSourceType != ListSourceType_VALUELIST, "OComboBoxModel::loadData : do not call for a value list !"); - DBG_ASSERT( !hasExternalListSource(), "OComboBoxModel::loadData: cannot load from DB when I have an external list source!" ); - - if ( hasExternalListSource() ) - return; - - // Connection holen - Reference xForm(m_xCursor, UNO_QUERY); - if (!xForm.is()) - return; - Reference xConnection = getConnection(xForm); - if (!xConnection.is()) - return; - - Reference xServiceInfo(xConnection, UNO_QUERY); - if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION)) - { - OSL_FAIL("OComboBoxModel::loadData : invalid connection !"); - return; - } - - if (!m_aListSource.getLength() || m_eListSourceType == ListSourceType_VALUELIST) - return; - - ::utl::SharedUNOComponent< XResultSet > xListCursor; - try - { - m_aListRowSet.setConnection( xConnection ); - - bool bExecuteRowSet( false ); - switch (m_eListSourceType) - { - case ListSourceType_TABLEFIELDS: - // don't work with a statement here, the fields will be collected below - break; - case ListSourceType_TABLE: - { - // does the bound field belong to the table ? - // if we use an alias for the bound field, we won't find it - // in that case we use the first field of the table - - Reference xFieldsByName = getTableFields(xConnection, m_aListSource); - Reference xFieldsByIndex(xFieldsByName, UNO_QUERY); - - ::rtl::OUString aFieldName; - if ( xFieldsByName.is() && xFieldsByName->hasByName( getControlSource() ) ) - { - aFieldName = getControlSource(); - } - else - { - // otherwise look for the alias - Reference xFormProp(xForm,UNO_QUERY); - Reference< XColumnsSupplier > xSupplyFields; - xFormProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SingleSelectQueryComposer"))) >>= xSupplyFields; - - // search the field - DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !"); - - Reference< XNameAccess > xFieldNames = xSupplyFields->getColumns(); - if ( xFieldNames->hasByName( getControlSource() ) ) - { - Reference< XPropertySet > xComposerFieldAsSet; - xFieldNames->getByName( getControlSource() ) >>= xComposerFieldAsSet; - if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet)) - xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName; - } - } - - if (!aFieldName.getLength()) - break; - - Reference xMeta = xConnection->getMetaData(); - OSL_ENSURE(xMeta.is(),"No database meta data!"); - if ( xMeta.is() ) - { - ::rtl::OUString aQuote = xMeta->getIdentifierQuoteString(); - - ::rtl::OUString sCatalog, sSchema, sTable; - qualifiedNameComponents( xMeta, m_aListSource, sCatalog, sSchema, sTable, eInDataManipulation ); - - ::rtl::OUStringBuffer aStatement; - aStatement.appendAscii( "SELECT DISTINCT " ); - aStatement.append ( quoteName( aQuote, aFieldName ) ); - aStatement.appendAscii( " FROM " ); - aStatement.append ( composeTableNameForSelect( xConnection, sCatalog, sSchema, sTable ) ); - - m_aListRowSet.setEscapeProcessing( sal_False ); - m_aListRowSet.setCommand( aStatement.makeStringAndClear() ); - bExecuteRowSet = true; - } - } break; - case ListSourceType_QUERY: - { - m_aListRowSet.setCommandFromQuery( m_aListSource ); - bExecuteRowSet = true; - } - break; - - default: - { - m_aListRowSet.setEscapeProcessing( ListSourceType_SQLPASSTHROUGH != m_eListSourceType ); - m_aListRowSet.setCommand( m_aListSource ); - bExecuteRowSet = true; - } - } - - if ( bExecuteRowSet ) - { - if ( !_bForce && !m_aListRowSet.isDirty() ) - { - // if none of the settings of the row set changed, compared to the last - // invocation of loadData, then don't re-fill the list. Instead, assume - // the list entries are the same. - return; - } - xListCursor.reset( m_aListRowSet.execute() ); - } - } - catch(SQLException& eSQL) - { - onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST)); - return; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } - - ::std::vector< ::rtl::OUString > aStringList; - aStringList.reserve(16); - try - { - OSL_ENSURE( xListCursor.is() || ( ListSourceType_TABLEFIELDS == m_eListSourceType ), - "OComboBoxModel::loadData: logic error!" ); - if ( !xListCursor.is() && ( ListSourceType_TABLEFIELDS != m_eListSourceType ) ) - return; - - switch (m_eListSourceType) - { - case ListSourceType_SQL: - case ListSourceType_SQLPASSTHROUGH: - case ListSourceType_TABLE: - case ListSourceType_QUERY: - { - // die XDatabaseVAriant der ersten Spalte - Reference xSupplyCols(xListCursor, UNO_QUERY); - DBG_ASSERT(xSupplyCols.is(), "OComboBoxModel::loadData : cursor supports the row set service but is no column supplier?!"); - Reference xColumns; - if (xSupplyCols.is()) - { - xColumns = Reference(xSupplyCols->getColumns(), UNO_QUERY); - DBG_ASSERT(xColumns.is(), "OComboBoxModel::loadData : no columns supplied by the row set !"); - } - Reference< XPropertySet > xDataField; - if ( xColumns.is() ) - xColumns->getByIndex(0) >>= xDataField; - if ( !xDataField.is() ) - return; - - ::dbtools::FormattedColumnValue aValueFormatter( getContext(), xForm, xDataField ); - - // Listen fuellen - sal_Int16 i = 0; - // per definitionem the list cursor is positioned _before_ the first row at the moment - while (xListCursor->next() && (i++ xFieldNames = getTableFields(xConnection, m_aListSource); - if (xFieldNames.is()) - { - StringSequence seqNames = xFieldNames->getElementNames(); - sal_Int32 nFieldsCount = seqNames.getLength(); - const ::rtl::OUString* pustrNames = seqNames.getConstArray(); - - for (sal_Int32 k=0; k& _rxForm ) -{ - Reference xField = getField(); - if ( xField.is() ) - m_pValueFormatter.reset( new ::dbtools::FormattedColumnValue( getContext(), Reference< XRowSet >( _rxForm, UNO_QUERY ), xField ) ); - getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= m_aDesignModeStringItems; - - // Daten nur laden, wenn eine Listenquelle angegeben wurde - if ( m_aListSource.getLength() && m_xCursor.is() && !hasExternalListSource() ) - loadData( false ); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::onDisconnectedDbColumn() -{ - m_pValueFormatter.reset(); - - // reset the string item list - if ( !hasExternalListSource() ) - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( m_aDesignModeStringItems ) ); - - m_aListRowSet.dispose(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(RuntimeException) -{ - OBoundControlModel::reloaded(aEvent); - - // reload data if we have a list source - if ( m_aListSource.getLength() && m_xCursor.is() && !hasExternalListSource() ) - loadData( false ); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::resetNoBroadcast() -{ - OBoundControlModel::resetNoBroadcast(); - m_aLastKnownValue.clear(); -} - -//----------------------------------------------------------------------------- -sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) -{ - Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); - - ::rtl::OUString sNewValue; - aNewValue >>= sNewValue; - - bool bModified = ( aNewValue != m_aLastKnownValue ); - if ( bModified ) - { - if ( !aNewValue.hasValue() - || ( !sNewValue.getLength() // an empty string - && m_bEmptyIsNull // which should be interpreted as NULL - ) - ) - { - m_xColumnUpdate->updateNull(); - } - else - { - try - { - OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::commitControlValueToDbColumn: no value formatter!" ); - if ( m_pValueFormatter.get() ) - { - if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) - return sal_False; - } - else - m_xColumnUpdate->updateString( sNewValue ); - } - catch ( const Exception& ) - { - return sal_False; - } - } - - m_aLastKnownValue = aNewValue; - } - - // add the new value to the list - sal_Bool bAddToList = bModified && !_bPostReset; - // (only if this is not the "commit" triggered by a "reset") - - if ( bAddToList ) - { - StringSequence aStringItemList; - if ( getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aStringItemList ) - { - const ::rtl::OUString* pStringItems = aStringItemList.getConstArray(); - sal_Int32 i; - for (i=0; iequals( sNewValue ) ) - break; - } - - // not found -> add - if (i >= aStringItemList.getLength()) - { - sal_Int32 nOldLen = aStringItemList.getLength(); - aStringItemList.realloc( nOldLen + 1 ); - aStringItemList.getArray()[ nOldLen ] = sNewValue; - - setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) ); - } - } - } - - return sal_True; -} - -// XPropertiesChangeListener -//------------------------------------------------------------------------------ -Any OComboBoxModel::translateDbColumnToControlValue() -{ - OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::translateDbColumnToControlValue: no value formatter!" ); - if ( m_pValueFormatter.get() ) - { - ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() ); - if ( !sValue.getLength() - && m_pValueFormatter->getColumn().is() - && m_pValueFormatter->getColumn()->wasNull() - ) - { - m_aLastKnownValue.clear(); - } - else - { - - m_aLastKnownValue <<= sValue; - } - } - else - m_aLastKnownValue.clear(); - - return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() ); - // (m_aLastKnownValue is alllowed to be VOID, the control value isn't) -} - -//------------------------------------------------------------------------------ -Any OComboBoxModel::getDefaultForReset() const -{ - return makeAny( m_aDefaultText ); -} - -//-------------------------------------------------------------------- -void OComboBoxModel::stringItemListChanged( ControlModelLock& /*_rInstanceLock*/ ) -{ - if ( m_xAggregateSet.is() ) - m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( getStringItemList() ) ); -} - -//-------------------------------------------------------------------- -void OComboBoxModel::connectedExternalListSource( ) -{ - // TODO? -} - -//-------------------------------------------------------------------- -void OComboBoxModel::disconnectedExternalListSource( ) -{ - // TODO? -} - -//-------------------------------------------------------------------- -void OComboBoxModel::refreshInternalEntryList() -{ - DBG_ASSERT( !hasExternalListSource(), "OComboBoxModel::refreshInternalEntryList: invalid call!" ); - - if ( !hasExternalListSource( ) - && ( m_eListSourceType != ListSourceType_VALUELIST ) - && ( m_xCursor.is() ) - ) - { - loadData( true ); - } -} - -//-------------------------------------------------------------------- -void SAL_CALL OComboBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException ) -{ - if ( !OEntryListHelper::handleDisposing( _rSource ) ) - OBoundControlModel::disposing( _rSource ); -} - -//======================================================================== -//= OComboBoxControl -//======================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OComboBoxControl_CreateInstance(const Reference& _rxFactory) throw (RuntimeException) -{ - return *(new OComboBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -OComboBoxControl::OComboBoxControl(const Reference& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_COMBOBOX) -{ -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OComboBoxControl::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_COMBOBOX; - return aSupported; -} - -//......................................................................... -} -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx deleted file mode 100644 index 3f88658ce..000000000 --- a/forms/source/component/ComboBox.hxx +++ /dev/null @@ -1,180 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FORMS_COMBOBOX_HXX_ -#define _FORMS_COMBOBOX_HXX_ - -#include "FormComponent.hxx" -#include "errorbroadcaster.hxx" -#include "entrylisthelper.hxx" -#include "cachedrowset.hxx" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include - -#include - -#include - -#include - -//......................................................................... -namespace frm -{ - -//================================================================== -// OComboBoxModel -//================================================================== -class OComboBoxModel - :public OBoundControlModel - ,public OEntryListHelper - ,public OErrorBroadcaster -{ - CachedRowSet m_aListRowSet; // the row set to fill the list - ::com::sun::star::uno::Any m_aBoundColumn; // obsolet - ::rtl::OUString m_aListSource; // - ::rtl::OUString m_aDefaultText; // DefaultText - ::com::sun::star::uno::Any m_aLastKnownValue; - - StringSequence m_aDesignModeStringItems; - // upon loading, in some cases we reset fill our string item list ourself. We don't want - // to lose the user's items then, so we remember them here. - - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter; - - ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source - sal_Bool m_bEmptyIsNull; // LeerString wird als NULL interpretiert - - ::std::auto_ptr< ::dbtools::FormattedColumnValue > - m_pValueFormatter; - - - -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel ); - - virtual void SAL_CALL disposing(); - - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - 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); - - // XLoadListener - virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - IMPLEMENTATION_NAME(OComboBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // UNO - DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // OControlModel's property handling - virtual void describeFixedProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps - ) const; - virtual void describeAggregateProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - - // XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); - - // prevent method hiding - using OBoundControlModel::getFastPropertyValue; - -protected: - // OBoundControlModel overridables - virtual ::com::sun::star::uno::Any - translateDbColumnToControlValue( ); - virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); - - virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); - virtual void onDisconnectedDbColumn(); - - virtual ::com::sun::star::uno::Any - getDefaultForReset() const; - - virtual void resetNoBroadcast(); - - // OEntryListHelper overriables - virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ); - virtual void connectedExternalListSource( ); - virtual void disconnectedExternalListSource( ); - virtual void refreshInternalEntryList(); - -protected: - void loadData( bool _bForce ); - - DECLARE_XCLONEABLE(); -}; - -//================================================================== -// OComboBoxControl -//================================================================== - -class OComboBoxControl : public OBoundControl -{ -public: - OComboBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(OComboBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -#endif // _FORMS_COMBOBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx deleted file mode 100644 index 5f7d1db97..000000000 --- a/forms/source/component/Currency.cxx +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" -#include "Currency.hxx" -#include -#include -#include -#include - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OCurrencyControl -//================================================================== -//------------------------------------------------------------------ -OCurrencyControl::OCurrencyControl(const Reference& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_CURRENCYFIELD) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCurrencyControl_CreateInstance(const Reference& _rxFactory) -{ - return *(new OCurrencyControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence OCurrencyControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCurrencyControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_CURRENCYFIELD; - return aSupported; -} - -//================================================================== -// OCurrencyModel -//================================================================== -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCurrencyModel_CreateInstance(const Reference& _rxFactory) -{ - return *(new OCurrencyModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence OCurrencyModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - -//------------------------------------------------------------------ -void OCurrencyModel::implConstruct() -{ - if (m_xAggregateSet.is()) - { - try - { - // get the system international informations - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& aLocaleInfo = aSysLocale.GetLocaleData(); - - ::rtl::OUString sCurrencySymbol; - sal_Bool bPrependCurrencySymbol; - switch ( aLocaleInfo.getCurrPositiveFormat() ) - { - case 0: // $1 - sCurrencySymbol = String(aLocaleInfo.getCurrSymbol()); - bPrependCurrencySymbol = sal_True; - break; - case 1: // 1$ - sCurrencySymbol = String(aLocaleInfo.getCurrSymbol()); - bPrependCurrencySymbol = sal_False; - break; - case 2: // $ 1 - sCurrencySymbol = ::rtl::OUString(String(aLocaleInfo.getCurrSymbol())) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ); - bPrependCurrencySymbol = sal_True; - break; - case 3: // 1 $ - sCurrencySymbol = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ") ) + ::rtl::OUString(String(aLocaleInfo.getCurrSymbol())); - bPrependCurrencySymbol = sal_False; - break; - } - if (sCurrencySymbol.getLength()) - { - m_xAggregateSet->setPropertyValue(PROPERTY_CURRENCYSYMBOL, makeAny(sCurrencySymbol)); - m_xAggregateSet->setPropertyValue(PROPERTY_CURRSYM_POSITION, makeAny(bPrependCurrencySymbol)); - } - } - catch(Exception&) - { - OSL_FAIL( "OCurrencyModel::implConstruct: caught an exception while initializing the aggregate!" ); - } - } -} - -//------------------------------------------------------------------ -DBG_NAME( OCurrencyModel ) -//------------------------------------------------------------------ -OCurrencyModel::OCurrencyModel(const Reference& _rxFactory) - :OEditBaseModel( _rxFactory, VCL_CONTROLMODEL_CURRENCYFIELD, FRM_SUN_CONTROL_CURRENCYFIELD, sal_False, sal_True ) - // use the old control name for compytibility reasons -{ - DBG_CTOR( OCurrencyModel, NULL ); - - m_nClassId = FormComponentType::CURRENCYFIELD; - initValueProperty( PROPERTY_VALUE, PROPERTY_ID_VALUE ); - - implConstruct(); -} - -//------------------------------------------------------------------ -OCurrencyModel::OCurrencyModel( const OCurrencyModel* _pOriginal, const Reference& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OCurrencyModel, NULL ); - implConstruct(); -} - -//------------------------------------------------------------------ -OCurrencyModel::~OCurrencyModel() -{ - DBG_DTOR( OCurrencyModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OCurrencyModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCurrencyModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - - sal_Int32 nOldLen = aSupported.getLength(); - aSupported.realloc( nOldLen + 4 ); - ::rtl::OUString* pStoreTo = aSupported.getArray() + nOldLen; - - *pStoreTo++ = DATA_AWARE_CONTROL_MODEL; - *pStoreTo++ = VALIDATABLE_CONTROL_MODEL; - - *pStoreTo++ = FRM_SUN_COMPONENT_CURRENCYFIELD; - *pStoreTo++ = FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD; - - return aSupported; -} - -//------------------------------------------------------------------------------ -void OCurrencyModel::describeFixedProperties( Sequence< Property >& _rProps ) const -{ - BEGIN_DESCRIBE_PROPERTIES( 2, OEditBaseModel ) - // Value auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_VALUE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP3(DEFAULT_VALUE, double, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - END_DESCRIBE_PROPERTIES(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OCurrencyModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_CURRENCYFIELD; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -sal_Bool OCurrencyModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) -{ - Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); - if ( !compare( aControlValue, m_aSaveValue ) ) - { - if ( aControlValue.getValueType().getTypeClass() == TypeClass_VOID ) - m_xColumnUpdate->updateNull(); - else - { - try - { - m_xColumnUpdate->updateDouble( getDouble( aControlValue ) ); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aControlValue; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -Any OCurrencyModel::translateDbColumnToControlValue() -{ - m_aSaveValue <<= m_xColumn->getDouble(); - if ( m_xColumn->wasNull() ) - m_aSaveValue.clear(); - return m_aSaveValue; -} - -// XReset -//------------------------------------------------------------------------------ -Any OCurrencyModel::getDefaultForReset() const -{ - Any aValue; - if ( m_aDefault.getValueType().getTypeClass() == TypeClass_DOUBLE ) - aValue = m_aDefault; - - return aValue; -} - -//------------------------------------------------------------------------------ -void OCurrencyModel::resetNoBroadcast() -{ - OEditBaseModel::resetNoBroadcast(); - m_aSaveValue.clear(); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/Currency.hxx b/forms/source/component/Currency.hxx deleted file mode 100644 index 49f19d98d..000000000 --- a/forms/source/component/Currency.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FORMS_CURRENCY_HXX_ -#define _FORMS_CURRENCY_HXX_ - -#include "EditBase.hxx" - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= OCurrencyModel -//================================================================== -class OCurrencyModel - :public OEditBaseModel -{ - ::com::sun::star::uno::Any m_aSaveValue; - -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OCurrencyModel ); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OCurrencyModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun ::star::uno::RuntimeException); - - // OControlModel's property handling - virtual void describeFixedProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps - ) const; - -protected: - // OBoundControlModel overridables - virtual ::com::sun::star::uno::Any - translateDbColumnToControlValue( ); - virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset ); - - virtual ::com::sun::star::uno::Any - getDefaultForReset() const; - - virtual void resetNoBroadcast(); - -protected: - DECLARE_XCLONEABLE(); - - void implConstruct(); -}; - -//================================================================== -//= OCurrencyControl -//================================================================== -class OCurrencyControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OCurrencyControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OCurrencyControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -#endif // _FORMS_CURRENCY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx deleted file mode 100644 index 7ad4bf53d..000000000 --- a/forms/source/component/DatabaseForm.cxx +++ /dev/null @@ -1,4162 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_forms.hxx" - -#include "componenttools.hxx" -#include "DatabaseForm.hxx" -#include "EventThread.hxx" -#include "frm_module.hxx" -#include "frm_resource.hrc" -#include "frm_resource.hxx" -#include "GroupManager.hxx" -#include "property.hrc" -#include "property.hxx" -#include "services.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ... -namespace com { -namespace sun { -namespace star { -namespace data { - -enum DatabaseCursorType -{ - DatabaseCursorType_FORWARD = 0, - DatabaseCursorType_SNAPSHOT = 1, - DatabaseCursorType_KEYSET = 2, - DatabaseCursorType_DYNAMIC = 3, - DatabaseCursorType_MAKE_FIXED_SIZE = SAL_MAX_ENUM -}; - -} } } } - -using namespace ::dbtools; -using namespace ::comphelper; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::data; -using namespace ::com::sun::star::util; - -//-------------------------------------------------------------------------- -extern "C" void SAL_CALL createRegistryInfo_ODatabaseForm() -{ - static ::frm::OMultiInstanceAutoRegistration< ::frm::ODatabaseForm > aAutoRegistration; -} - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= DocumentModifyGuard -//================================================================== -class DocumentModifyGuard -{ -public: - DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent ) - :m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY ) - { - impl_changeModifiableFlag_nothrow( false ); - } - ~DocumentModifyGuard() - { - impl_changeModifiableFlag_nothrow( true ); - } - -private: - void impl_changeModifiableFlag_nothrow( const bool _enable ) - { - try - { - if ( m_xDocumentModify.is() ) - _enable ? m_xDocumentModify->enableSetModified() : m_xDocumentModify->disableSetModified(); - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -private: - Reference< XModifiable2 > m_xDocumentModify; -}; - -//================================================================== -//= OFormSubmitResetThread -//=----------------------------------------------------------------- -//= submitting and resetting html-forms asynchronously -//================================================================== - -//------------------------------------------------------------------ -class OFormSubmitResetThread: public OComponentEventThread -{ -protected: - - // duplicate an event with respect to it's type - virtual EventObject *cloneEvent( const EventObject *pEvt ) const; - - // process an event. while processing the mutex isn't locked, and pCompImpl - // is made sure to remain valid - virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl, - const EventObject* _pEvt, - const Reference& _rControl, - sal_Bool _bSubmit); - -public: - - OFormSubmitResetThread(ODatabaseForm* pControl) : OComponentEventThread(pControl) { } -}; - -//------------------------------------------------------------------ -EventObject* OFormSubmitResetThread::cloneEvent( - const EventObject *pEvt ) const -{ - return new ::com::sun::star::awt::MouseEvent( *(::com::sun::star::awt::MouseEvent *)pEvt ); -} - -//------------------------------------------------------------------ -void OFormSubmitResetThread::processEvent( - ::cppu::OComponentHelper* pCompImpl, - const EventObject *_pEvt, - const Reference& _rControl, - sal_Bool _bSubmit) -{ - if (_bSubmit) - ((ODatabaseForm *)pCompImpl)->submit_impl(_rControl, *static_cast(_pEvt), true); - else - ((ODatabaseForm *)pCompImpl)->reset_impl(true); -} - -//================================================================== -//= ODatabaseForm -//================================================================== - -//------------------------------------------------------------------ -Reference< XInterface > SAL_CALL ODatabaseForm::Create( const Reference< XMultiServiceFactory >& _rxFactory ) -{ - return *( new ODatabaseForm( _rxFactory ) ); -} - -//------------------------------------------------------------------------------ -Sequence SAL_CALL ODatabaseForm::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------ -Sequence SAL_CALL ODatabaseForm::getTypes() throw(RuntimeException) -{ - // ask the aggregate - Sequence aAggregateTypes; - Reference xAggregateTypes; - if (query_aggregation(m_xAggregate, xAggregateTypes)) - aAggregateTypes = xAggregateTypes->getTypes(); - - Sequence< Type > aRet = concatSequences( - aAggregateTypes, ODatabaseForm_BASE1::getTypes(), OFormComponents::getTypes() - ); - aRet = concatSequences( aRet, ODatabaseForm_BASE2::getTypes(), ODatabaseForm_BASE3::getTypes() ); - return concatSequences( aRet, OPropertySetAggregationHelper::getTypes() ); -} - -//------------------------------------------------------------------ -Any SAL_CALL ODatabaseForm::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - Any aReturn = ODatabaseForm_BASE1::queryInterface(_rType); - // our own interfaces - if (!aReturn.hasValue()) - { - aReturn = ODatabaseForm_BASE2::queryInterface(_rType); - // property set related interfaces - if (!aReturn.hasValue()) - { - aReturn = OPropertySetAggregationHelper::queryInterface(_rType); - - // form component collection related interfaces - if (!aReturn.hasValue()) - { - aReturn = OFormComponents::queryAggregation(_rType); - - // interfaces already present in the aggregate which we want to reroute - // only available if we could create the aggregate - if (!aReturn.hasValue() && m_xAggregateAsRowSet.is()) - aReturn = ODatabaseForm_BASE3::queryInterface(_rType); - - // aggregate interfaces - // (ask the aggregated object _after_ the OComponentHelper (base of OFormComponents), - // so calls to the XComponent interface reach us and not the aggreagtion) - if (!aReturn.hasValue() && m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - } - } - - return aReturn; -} - -DBG_NAME(ODatabaseForm); -//------------------------------------------------------------------ -ODatabaseForm::ODatabaseForm(const Reference& _rxFactory) - :OFormComponents(_rxFactory) - ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) - ,OPropertyChangeListener(m_aMutex) - ,m_aLoadListeners(m_aMutex) - ,m_aRowSetApproveListeners(m_aMutex) - ,m_aRowSetListeners(m_aMutex) - ,m_aSubmitListeners(m_aMutex) - ,m_aErrorListeners(m_aMutex) - ,m_aResetListeners( *this, m_aMutex ) - ,m_aPropertyBagHelper( *this ) - ,m_pAggregatePropertyMultiplexer(NULL) - ,m_pGroupManager( NULL ) - ,m_aParameterManager( m_aMutex, _rxFactory ) - ,m_aFilterManager( _rxFactory ) - ,m_pLoadTimer(NULL) - ,m_pThread(NULL) - ,m_nResetsPending(0) - ,m_nPrivileges(0) - ,m_bInsertOnly( sal_False ) - ,m_eSubmitMethod(FormSubmitMethod_GET) - ,m_eSubmitEncoding(FormSubmitEncoding_URL) - ,m_eNavigation(NavigationBarMode_CURRENT) - ,m_bAllowInsert(sal_True) - ,m_bAllowUpdate(sal_True) - ,m_bAllowDelete(sal_True) - ,m_bLoaded(sal_False) - ,m_bSubForm(sal_False) - ,m_bForwardingConnection(sal_False) - ,m_bSharingConnection( sal_False ) -{ - DBG_CTOR( ODatabaseForm, NULL ); - impl_construct(); -} - -//------------------------------------------------------------------ -ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) - :OFormComponents( _cloneSource ) - ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) - ,OPropertyChangeListener( m_aMutex ) - ,ODatabaseForm_BASE1() - ,ODatabaseForm_BASE2() - ,ODatabaseForm_BASE3() - ,IPropertyBagHelperContext() - ,m_aLoadListeners( m_aMutex ) - ,m_aRowSetApproveListeners( m_aMutex ) - ,m_aRowSetListeners( m_aMutex ) - ,m_aSubmitListeners( m_aMutex ) - ,m_aErrorListeners( m_aMutex ) - ,m_aResetListeners( *this, m_aMutex ) - ,m_aPropertyBagHelper( *this ) - ,m_pAggregatePropertyMultiplexer( NULL ) - ,m_pGroupManager( NULL ) - ,m_aParameterManager( m_aMutex, _cloneSource.m_xServiceFactory ) - ,m_aFilterManager( _cloneSource.m_xServiceFactory ) - ,m_pLoadTimer( NULL ) - ,m_pThread( NULL ) - ,m_nResetsPending( 0 ) - ,m_nPrivileges( 0 ) - ,m_bInsertOnly( _cloneSource.m_bInsertOnly ) - ,m_aControlBorderColorFocus( _cloneSource.m_aControlBorderColorFocus ) - ,m_aControlBorderColorMouse( _cloneSource.m_aControlBorderColorMouse ) - ,m_aControlBorderColorInvalid( _cloneSource.m_aControlBorderColorInvalid ) - ,m_aDynamicControlBorder( _cloneSource.m_aDynamicControlBorder ) - ,m_sName( _cloneSource.m_sName ) - ,m_aTargetURL( _cloneSource.m_aTargetURL ) - ,m_aTargetFrame( _cloneSource.m_aTargetFrame ) - ,m_eSubmitMethod( _cloneSource.m_eSubmitMethod ) - ,m_eSubmitEncoding( _cloneSource.m_eSubmitEncoding ) - ,m_eNavigation( _cloneSource.m_eNavigation ) - ,m_bAllowInsert( _cloneSource.m_bAllowInsert ) - ,m_bAllowUpdate( _cloneSource.m_bAllowUpdate ) - ,m_bAllowDelete( _cloneSource.m_bAllowDelete ) - ,m_bLoaded( sal_False ) - ,m_bSubForm( sal_False ) - ,m_bForwardingConnection( sal_False ) - ,m_bSharingConnection( sal_False ) -{ - DBG_CTOR( ODatabaseForm, NULL ); - - impl_construct(); - - osl_incrementInterlockedCount( &m_refCount ); - { - // our aggregated rowset itself is not cloneable, so simply copy the properties - ::comphelper::copyProperties( _cloneSource.m_xAggregateSet, m_xAggregateSet ); - - // also care for the dynamic properties: If the clone source has properties which we do not have, - // then add them - try - { - Reference< XPropertySet > xSourceProps( const_cast< ODatabaseForm& >( _cloneSource ).queryAggregation( - XPropertySet::static_type() ), UNO_QUERY_THROW ); - Reference< XPropertySetInfo > xSourcePSI( xSourceProps->getPropertySetInfo(), UNO_SET_THROW ); - Reference< XPropertyState > xSourcePropState( xSourceProps, UNO_QUERY ); - - Reference< XPropertySetInfo > xDestPSI( getPropertySetInfo(), UNO_QUERY_THROW ); - - Sequence< Property > aSourceProperties( xSourcePSI->getProperties() ); - for ( const Property* pSourceProperty = aSourceProperties.getConstArray(); - pSourceProperty != aSourceProperties.getConstArray() + aSourceProperties.getLength(); - ++pSourceProperty - ) - { - if ( xDestPSI->hasPropertyByName( pSourceProperty->Name ) ) - continue; - - // the initial value passed to XPropertyContainer is also used as default, usually. So, try - // to retrieve the default of the source property - Any aInitialValue; - if ( xSourcePropState.is() ) - { - aInitialValue = xSourcePropState->getPropertyDefault( pSourceProperty->Name ); - } - else - { - aInitialValue = xSourceProps->getPropertyValue( pSourceProperty->Name ); - } - addProperty( pSourceProperty->Name, pSourceProperty->Attributes, aInitialValue ); - setPropertyValue( pSourceProperty->Name, xSourceProps->getPropertyValue( pSourceProperty->Name ) ); - } - } - catch(const Exception&) - { - throw WrappedTargetException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could not clone the given database form." ) ), - *const_cast< ODatabaseForm* >( &_cloneSource ), - ::cppu::getCaughtException() - ); - } - } - osl_decrementInterlockedCount( &m_refCount ); -} - -//------------------------------------------------------------------ -void ODatabaseForm::impl_construct() -{ - // aggregate a row set - increment(m_refCount); - { - m_xAggregate = Reference< XAggregation >( m_xServiceFactory->createInstance( SRV_SDB_ROWSET ), UNO_QUERY_THROW ); - m_xAggregateAsRowSet.set( m_xAggregate, UNO_QUERY_THROW ); - setAggregation( m_xAggregate ); - } - - // listen for the properties, important for Parameters - if ( m_xAggregateSet.is() ) - { - m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False); - m_pAggregatePropertyMultiplexer->acquire(); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_COMMAND); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION); - } - - { - Reference< XWarningsSupplier > xRowSetWarnings( m_xAggregate, UNO_QUERY ); - m_aWarnings.setExternalWarnings( xRowSetWarnings ); - } - - if ( m_xAggregate.is() ) - { - m_xAggregate->setDelegator( static_cast< XWeak* >( this ) ); - } - - { - m_aFilterManager.initialize( m_xAggregateSet ); - m_aParameterManager.initialize( this, m_xAggregate ); - - declareForwardedProperty( PROPERTY_ID_ACTIVE_CONNECTION ); - } - decrement( m_refCount ); - - m_pGroupManager = new OGroupManager( this ); - m_pGroupManager->acquire(); -} - -//------------------------------------------------------------------ -ODatabaseForm::~ODatabaseForm() -{ - DBG_DTOR(ODatabaseForm,NULL); - - m_pGroupManager->release(); - m_pGroupManager = NULL; - - if (m_xAggregate.is()) - m_xAggregate->setDelegator( NULL ); - - m_aWarnings.setExternalWarnings( NULL ); - - if (m_pAggregatePropertyMultiplexer) - { - m_pAggregatePropertyMultiplexer->dispose(); - m_pAggregatePropertyMultiplexer->release(); - m_pAggregatePropertyMultiplexer = NULL; - } -} - -//============================================================================== -// html tools -//------------------------------------------------------------------------ -::rtl::OUString ODatabaseForm::GetDataURLEncoded(const Reference& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - return GetDataEncoded(true,SubmitButton,MouseEvt); -} -// ----------------------------------------------------------------------------- -::rtl::OUString ODatabaseForm::GetDataEncoded(bool _bURLEncoded,const Reference& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - - - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUStringBuffer aResult; - ::rtl::OUString aName; - ::rtl::OUString aValue; - - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - aName = pSuccObj->aName; - aValue = pSuccObj->aValue; - if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE && aValue.getLength() ) - { - // Bei File-URLs wird der Dateiname und keine URL uebertragen, - // weil Netscape dies so macht. - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - aURL.SetSmartURL(aValue); - if( INET_PROT_FILE == aURL.GetProtocol() ) - aValue = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS); - } - Encode( aName ); - Encode( aValue ); - - aResult.append(aName); - aResult.append(sal_Unicode('=')); - aResult.append(aValue); - - if (pSuccObj < aSuccObjList.end() - 1) - { - if ( _bURLEncoded ) - aResult.append(sal_Unicode('&')); - else - aResult.appendAscii("\r\n"); - } - } - - - aSuccObjList.clear(); - - return aResult.makeStringAndClear(); -} - -//============================================================================== -// html tools -//------------------------------------------------------------------------ -::rtl::OUString ODatabaseForm::GetDataTextEncoded(const Reference& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - return GetDataEncoded(false,SubmitButton,MouseEvt); -} - -//------------------------------------------------------------------------ -Sequence ODatabaseForm::GetDataMultiPartEncoded(const Reference& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt, ::rtl::OUString& rContentType) -{ - - // Parent erzeugen - INetMIMEMessage aParent; - aParent.EnableAttachChild( INETMSG_MULTIPART_FORM_DATA ); - - - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - - - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_TEXT ) - InsertTextPart( aParent, pSuccObj->aName, pSuccObj->aValue ); - else if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE ) - InsertFilePart( aParent, pSuccObj->aName, pSuccObj->aValue ); - } - - - // Liste loeschen - aSuccObjList.clear(); - - // Fuer Parent MessageStream erzeugen - INetMIMEMessageStream aMessStream; - aMessStream.SetSourceMessage( &aParent ); - aMessStream.GenerateHeader( sal_False ); - - // MessageStream in SvStream kopieren - SvMemoryStream aMemStream; - char* pBuf = new char[1025]; - int nRead; - while( (nRead = aMessStream.Read(pBuf, 1024)) > 0 ) - aMemStream.Write( pBuf, nRead ); - delete[] pBuf; - - aMemStream.Flush(); - aMemStream.Seek( 0 ); - void* pData = (void*)aMemStream.GetData(); - sal_Int32 nLen = aMemStream.Seek(STREAM_SEEK_TO_END); - - rContentType = UniString(aParent.GetContentType()); - return Sequence((sal_Int8*)pData, nLen); -} - -//------------------------------------------------------------------------ -namespace -{ - static void appendDigits( sal_Int32 _nNumber, sal_Int8 nDigits, ::rtl::OUStringBuffer& _rOut ) - { - sal_Int32 nCurLen = _rOut.getLength(); - _rOut.append( _nNumber ); - while ( _rOut.getLength() - nCurLen < nDigits ) - _rOut.insert( nCurLen, (sal_Unicode)'0' ); - } -} - -//------------------------------------------------------------------------ -void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Reference& xComponentSet, const ::rtl::OUString& rNamePrefix, - const Reference& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - if (!xComponentSet.is()) - return; - - // MIB 25.6.98: Geschachtelte Formulare abfangen ... oder muesste - // man sie submitten? - if (!hasProperty(PROPERTY_CLASSID, xComponentSet)) - return; - - // Namen ermitteln - if (!hasProperty(PROPERTY_NAME, xComponentSet)) - return; - - sal_Int16 nClassId = 0; - xComponentSet->getPropertyValue(PROPERTY_CLASSID) >>= nClassId; - ::rtl::OUString aName; - xComponentSet->getPropertyValue( PROPERTY_NAME ) >>= aName; - if( !aName.getLength() && nClassId != FormComponentType::IMAGEBUTTON) - return; - else // Name um den Prefix erweitern - aName = rNamePrefix + aName; - - switch( nClassId ) - { - // Buttons - case FormComponentType::COMMANDBUTTON: - { - // Es wird nur der gedrueckte Submit-Button ausgewertet - // MIB: Sofern ueberhaupt einer uebergeben wurde - if( rxSubmitButton.is() ) - { - Reference xSubmitButtonComponent(rxSubmitButton->getModel(), UNO_QUERY); - if (xSubmitButtonComponent == xComponentSet && hasProperty(PROPERTY_LABEL, xComponentSet)) - { - // =